From: Andrea Amorese Date: Fri, 10 Sep 2021 14:49:08 +0000 (+0200) Subject: Built motion from commit c220d7c5.|2.5.34 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22card-image.png//%27?a=commitdiff_plain;h=be419dbe21ee6e455c781db38e570bdb1f2bbacb;p=motion2.git Built motion from commit c220d7c5.|2.5.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6378689..822953c 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-10T14:24:25.812Z", + "time": "2021-09-10T14:37:38.822Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0468723..e34b4b2 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-10T14:24:25.812Z", + "time": "2021-09-10T14:37:38.822Z", "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 d12b1d9..acb1ac5 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 _0x1dcc=['action','contactManager','integration','motionbar','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL'];(function(_0x24ec05,_0x5cd9c6){var _0x25c518=function(_0x212040){while(--_0x212040){_0x24ec05['push'](_0x24ec05['shift']());}};_0x25c518(++_0x5cd9c6);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x1d0a4d,_0x4247ff){_0x1d0a4d=_0x1d0a4d-0x0;var _0x19ac91=_0x1dcc[_0x1d0a4d];return _0x19ac91;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'name':{'type':Sequelize[_0xc1dc('0x2')],'get':function(_0x151f37){return this['getDataValue'](_0xc1dc('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xc1dc('0x4'),_0xc1dc('0x5'),_0xc1dc('0x6'),'jscripty','urlForward',_0xc1dc('0x7'),_0xc1dc('0x8'),_0xc1dc('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xc1dc('0xa')},'data1':{'type':Sequelize[_0xc1dc('0xb')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xc1dc('0xb')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xc1dc('0xb')](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[_0xc1dc('0xb')](0x1000),'comments':_0xc1dc('0xc')},'data5':{'type':Sequelize[_0xc1dc('0xb')](0x1000),'comments':_0xc1dc('0xd')},'data6':{'type':Sequelize[_0xc1dc('0xb')],'comments':_0xc1dc('0xe')},'data7':{'type':Sequelize[_0xc1dc('0xf')],'comments':_0xc1dc('0x10')}}; \ No newline at end of file +var _0x84e7=['urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth]'];(function(_0xcad9e7,_0x255d6f){var _0x170a86=function(_0x38bc38){while(--_0x38bc38){_0xcad9e7['push'](_0xcad9e7['shift']());}};_0x170a86(++_0x255d6f);}(_0x84e7,0x122));var _0x784e=function(_0x122ef8,_0x3a0c24){_0x122ef8=_0x122ef8-0x0;var _0xe8424f=_0x84e7[_0x122ef8];return _0xe8424f;};'use strict';var Sequelize=require('sequelize');module[_0x784e('0x0')]={'name':{'type':Sequelize[_0x784e('0x1')],'get':function(_0x5861e2){return this[_0x784e('0x2')](_0x784e('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x784e('0x4'),_0x784e('0x5'),_0x784e('0x6'),_0x784e('0x7'),_0x784e('0x8'),_0x784e('0x9'),'bot',_0x784e('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x784e('0xb')},'data1':{'type':Sequelize[_0x784e('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[_0x784e('0xc')](0x1000),'comment':_0x784e('0xd')},'data3':{'type':Sequelize[_0x784e('0xc')](0x1000),'comment':_0x784e('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x784e('0xc')](0x1000),'comments':_0x784e('0xf')},'data6':{'type':Sequelize[_0x784e('0xc')],'comments':_0x784e('0x10')},'data7':{'type':Sequelize['TEXT'],'comments':_0x784e('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index d9e4a8c..86447a6 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 _0xc81d=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x2c5e42,_0x9b8c6a){var _0x840fde=function(_0x169c4e){while(--_0x169c4e){_0x2c5e42['push'](_0x2c5e42['shift']());}};_0x840fde(++_0x9b8c6a);}(_0xc81d,0x1e4));var _0xdc81=function(_0x4e16c9,_0x541601){_0x4e16c9=_0x4e16c9-0x0;var _0xd423e5=_0xc81d[_0x4e16c9];return _0xd423e5;};'use strict';var emlformat=require(_0xdc81('0x0'));var rimraf=require(_0xdc81('0x1'));var zipdir=require(_0xdc81('0x2'));var jsonpatch=require(_0xdc81('0x3'));var rp=require(_0xdc81('0x4'));var moment=require(_0xdc81('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdc81('0x6'));var sox=require(_0xdc81('0x7'));var csv=require(_0xdc81('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc81('0x9'));var squel=require(_0xdc81('0xa'));var crypto=require(_0xdc81('0xb'));var jsforce=require(_0xdc81('0xc'));var deskjs=require(_0xdc81('0xd'));var toCsv=require(_0xdc81('0x8'));var querystring=require(_0xdc81('0xe'));var Papa=require(_0xdc81('0xf'));var Redis=require(_0xdc81('0x10'));var authService=require(_0xdc81('0x11'));var qs=require(_0xdc81('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc81('0x13'));var logger=require(_0xdc81('0x14'))(_0xdc81('0x15'));var utils=require('../../config/utils');var config=require(_0xdc81('0x16'));var licenseUtil=require(_0xdc81('0x17'));var db=require(_0xdc81('0x18'))['db'];function respondWithStatusCode(_0x543ac8,_0x25d878){_0x25d878=_0x25d878||0xcc;return function(_0xda27b){if(_0xda27b){return _0x543ac8[_0xdc81('0x19')](_0x25d878);}return _0x543ac8['status'](_0x25d878)['end']();};}function respondWithResult(_0x40e515,_0x103ec1){_0x103ec1=_0x103ec1||0xc8;return function(_0x794799){if(_0x794799){return _0x40e515[_0xdc81('0x1a')](_0x103ec1)[_0xdc81('0x1b')](_0x794799);}};}function respondWithFilteredResult(_0x37381a,_0x570176){return function(_0x4888b8){if(_0x4888b8){var _0x3209fa=typeof _0x570176['offset']==='undefined'&&typeof _0x570176['limit']==='undefined';var _0x3c8b82=_0x4888b8[_0xdc81('0x1c')];var _0x29d017=_0x3209fa?0x0:_0x570176[_0xdc81('0x1d')];var _0x5fdf1=_0x3209fa?_0x4888b8[_0xdc81('0x1c')]:_0x570176[_0xdc81('0x1d')]+_0x570176['limit'];var _0x45610a;if(_0x5fdf1>=_0x3c8b82){_0x5fdf1=_0x3c8b82;_0x45610a=0xc8;}else{_0x45610a=0xce;}_0x37381a[_0xdc81('0x1a')](_0x45610a);return _0x37381a[_0xdc81('0x1e')](_0xdc81('0x1f'),_0x29d017+'-'+_0x5fdf1+'/'+_0x3c8b82)['json'](_0x4888b8);}return null;};}function patchUpdates(_0x4f914e){return function(_0x3fccfc){try{jsonpatch[_0xdc81('0x20')](_0x3fccfc,_0x4f914e,!![]);}catch(_0x5cb9e5){return BPromise['reject'](_0x5cb9e5);}return _0x3fccfc[_0xdc81('0x21')]();};}function saveUpdates(_0x3724b,_0x3b3a7c){return function(_0x2e0833){if(_0x2e0833){return _0x2e0833[_0xdc81('0x22')](_0x3724b)['then'](function(_0x785990){return _0x785990;});}return null;};}function removeEntity(_0x3179eb,_0x121492){return function(_0x28fd35){if(_0x28fd35){return _0x28fd35[_0xdc81('0x23')]()[_0xdc81('0x24')](function(){_0x3179eb[_0xdc81('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51462a,_0x3b600f){return function(_0xb021df){if(!_0xb021df){_0x51462a[_0xdc81('0x19')](0x194);}return _0xb021df;};}function handleError(_0x492b28,_0x36d503){_0x36d503=_0x36d503||0x1f4;return function(_0x540375){logger[_0xdc81('0x25')](_0x540375[_0xdc81('0x26')]);if(_0x540375[_0xdc81('0x27')]){delete _0x540375[_0xdc81('0x27')];}_0x492b28[_0xdc81('0x1a')](_0x36d503)[_0xdc81('0x28')](_0x540375);};}exports[_0xdc81('0x22')]=function(_0x5a52e0,_0x3815a8){if(_0x5a52e0[_0xdc81('0x29')]['id']){delete _0x5a52e0[_0xdc81('0x29')]['id'];}return db[_0xdc81('0x2a')][_0xdc81('0x2b')]({'where':{'id':_0x5a52e0[_0xdc81('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3815a8,null))['then'](saveUpdates(_0x5a52e0[_0xdc81('0x29')],null))[_0xdc81('0x24')](respondWithResult(_0x3815a8,null))[_0xdc81('0x2d')](handleError(_0x3815a8,null));};exports[_0xdc81('0x23')]=function(_0xa76d20,_0x200b5e){return db[_0xdc81('0x2a')][_0xdc81('0x2b')]({'where':{'id':_0xa76d20[_0xdc81('0x2c')]['id']}})['then'](handleEntityNotFound(_0x200b5e,null))[_0xdc81('0x24')](removeEntity(_0x200b5e,null))[_0xdc81('0x2d')](handleError(_0x200b5e,null));}; \ No newline at end of file +var _0xb3dc=['set','Content-Range','apply','save','update','destroy','then','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x78f3c6,_0x3def49){var _0xce4ed3=function(_0x33d1a7){while(--_0x33d1a7){_0x78f3c6['push'](_0x78f3c6['shift']());}};_0xce4ed3(++_0x3def49);}(_0xb3dc,0x197));var _0xcb3d=function(_0x39e4b6,_0x418f43){_0x39e4b6=_0x39e4b6-0x0;var _0x2a710c=_0xb3dc[_0x39e4b6];return _0x2a710c;};'use strict';var emlformat=require(_0xcb3d('0x0'));var rimraf=require(_0xcb3d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcb3d('0x2'));var rp=require('request-promise');var moment=require(_0xcb3d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcb3d('0x4'));var util=require(_0xcb3d('0x5'));var path=require('path');var sox=require(_0xcb3d('0x6'));var csv=require(_0xcb3d('0x7'));var ejs=require(_0xcb3d('0x8'));var fs=require('fs');var fs_extra=require(_0xcb3d('0x9'));var _=require('lodash');var squel=require(_0xcb3d('0xa'));var crypto=require(_0xcb3d('0xb'));var jsforce=require(_0xcb3d('0xc'));var deskjs=require(_0xcb3d('0xd'));var toCsv=require(_0xcb3d('0x7'));var querystring=require(_0xcb3d('0xe'));var Papa=require(_0xcb3d('0xf'));var Redis=require(_0xcb3d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcb3d('0x11'));var as=require(_0xcb3d('0x12'));var hardwareService=require(_0xcb3d('0x13'));var logger=require(_0xcb3d('0x14'))(_0xcb3d('0x15'));var utils=require(_0xcb3d('0x16'));var config=require(_0xcb3d('0x17'));var licenseUtil=require(_0xcb3d('0x18'));var db=require(_0xcb3d('0x19'))['db'];function respondWithStatusCode(_0x443b46,_0x100bbd){_0x100bbd=_0x100bbd||0xcc;return function(_0x1f6f54){if(_0x1f6f54){return _0x443b46[_0xcb3d('0x1a')](_0x100bbd);}return _0x443b46[_0xcb3d('0x1b')](_0x100bbd)[_0xcb3d('0x1c')]();};}function respondWithResult(_0x3b7412,_0x538677){_0x538677=_0x538677||0xc8;return function(_0xe8a4df){if(_0xe8a4df){return _0x3b7412[_0xcb3d('0x1b')](_0x538677)[_0xcb3d('0x1d')](_0xe8a4df);}};}function respondWithFilteredResult(_0x36bb61,_0x552fe7){return function(_0x983c8){if(_0x983c8){var _0x4d1182=typeof _0x552fe7[_0xcb3d('0x1e')]===_0xcb3d('0x1f')&&typeof _0x552fe7[_0xcb3d('0x20')]===_0xcb3d('0x1f');var _0x481a16=_0x983c8[_0xcb3d('0x21')];var _0x343724=_0x4d1182?0x0:_0x552fe7[_0xcb3d('0x1e')];var _0x410470=_0x4d1182?_0x983c8[_0xcb3d('0x21')]:_0x552fe7['offset']+_0x552fe7[_0xcb3d('0x20')];var _0x10e5ca;if(_0x410470>=_0x481a16){_0x410470=_0x481a16;_0x10e5ca=0xc8;}else{_0x10e5ca=0xce;}_0x36bb61[_0xcb3d('0x1b')](_0x10e5ca);return _0x36bb61[_0xcb3d('0x22')](_0xcb3d('0x23'),_0x343724+'-'+_0x410470+'/'+_0x481a16)[_0xcb3d('0x1d')](_0x983c8);}return null;};}function patchUpdates(_0x22f196){return function(_0x36eb5c){try{jsonpatch[_0xcb3d('0x24')](_0x36eb5c,_0x22f196,!![]);}catch(_0x1ecca1){return BPromise['reject'](_0x1ecca1);}return _0x36eb5c[_0xcb3d('0x25')]();};}function saveUpdates(_0x38fe8d,_0x2e2d29){return function(_0x27bbc0){if(_0x27bbc0){return _0x27bbc0[_0xcb3d('0x26')](_0x38fe8d)['then'](function(_0x110ed6){return _0x110ed6;});}return null;};}function removeEntity(_0x285ed2,_0x31bafd){return function(_0x2dcfb3){if(_0x2dcfb3){return _0x2dcfb3[_0xcb3d('0x27')]()[_0xcb3d('0x28')](function(){_0x285ed2['status'](0xcc)[_0xcb3d('0x1c')]();});}};}function handleEntityNotFound(_0x1274fa,_0x4bec68){return function(_0x4c1968){if(!_0x4c1968){_0x1274fa[_0xcb3d('0x1a')](0x194);}return _0x4c1968;};}function handleError(_0x179be2,_0x17aa95){_0x17aa95=_0x17aa95||0x1f4;return function(_0x3e3cb2){logger['error'](_0x3e3cb2[_0xcb3d('0x29')]);if(_0x3e3cb2[_0xcb3d('0x2a')]){delete _0x3e3cb2[_0xcb3d('0x2a')];}_0x179be2['status'](_0x17aa95)[_0xcb3d('0x2b')](_0x3e3cb2);};}exports[_0xcb3d('0x26')]=function(_0x448871,_0x759b00){if(_0x448871[_0xcb3d('0x2c')]['id']){delete _0x448871[_0xcb3d('0x2c')]['id'];}return db[_0xcb3d('0x2d')][_0xcb3d('0x2e')]({'where':{'id':_0x448871[_0xcb3d('0x2f')]['id']}})['then'](handleEntityNotFound(_0x759b00,null))[_0xcb3d('0x28')](saveUpdates(_0x448871[_0xcb3d('0x2c')],null))[_0xcb3d('0x28')](respondWithResult(_0x759b00,null))[_0xcb3d('0x30')](handleError(_0x759b00,null));};exports[_0xcb3d('0x27')]=function(_0x5ca28f,_0x54a02a){return db[_0xcb3d('0x2d')][_0xcb3d('0x2e')]({'where':{'id':_0x5ca28f[_0xcb3d('0x2f')]['id']}})[_0xcb3d('0x28')](handleEntityNotFound(_0x54a02a,null))[_0xcb3d('0x28')](removeEntity(_0x54a02a,null))[_0xcb3d('0x30')](handleError(_0x54a02a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 6449657..6210733 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 _0x24aa=['Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define'];(function(_0x11df98,_0x55313e){var _0x3d313a=function(_0xd50dc7){while(--_0xd50dc7){_0x11df98['push'](_0x11df98['shift']());}};_0x3d313a(++_0x55313e);}(_0x24aa,0x91));var _0xa24a=function(_0x3262bf,_0x4fb17d){_0x3262bf=_0x3262bf-0x0;var _0x20da0a=_0x24aa[_0x3262bf];return _0x20da0a;};'use strict';var _=require(_0xa24a('0x0'));var util=require(_0xa24a('0x1'));var logger=require(_0xa24a('0x2'))('api');var moment=require(_0xa24a('0x3'));var BPromise=require(_0xa24a('0x4'));var rp=require(_0xa24a('0x5'));var fs=require('fs');var path=require(_0xa24a('0x6'));var rimraf=require(_0xa24a('0x7'));var config=require(_0xa24a('0x8'));var attributes=require(_0xa24a('0x9'));module['exports']=function(_0x3d1fd3,_0x428ef5){return _0x3d1fd3[_0xa24a('0xa')](_0xa24a('0xb'),attributes,{'tableName':_0xa24a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a48=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','lodash'];(function(_0x810f5a,_0x5ec240){var _0x20caf3=function(_0x4f8c15){while(--_0x4f8c15){_0x810f5a['push'](_0x810f5a['shift']());}};_0x20caf3(++_0x5ec240);}(_0x9a48,0xa4));var _0x89a4=function(_0x13bea0,_0x210a0c){_0x13bea0=_0x13bea0-0x0;var _0x3f12df=_0x9a48[_0x13bea0];return _0x3f12df;};'use strict';var _=require(_0x89a4('0x0'));var util=require(_0x89a4('0x1'));var logger=require('../../config/logger')(_0x89a4('0x2'));var moment=require(_0x89a4('0x3'));var BPromise=require(_0x89a4('0x4'));var rp=require(_0x89a4('0x5'));var fs=require('fs');var path=require(_0x89a4('0x6'));var rimraf=require(_0x89a4('0x7'));var config=require(_0x89a4('0x8'));var attributes=require(_0x89a4('0x9'));module[_0x89a4('0xa')]=function(_0xd39f4d,_0x47be90){return _0xd39f4d['define']('Action',attributes,{'tableName':'tools_actions','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 16ffbad..50ebbf2 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x241fc7,_0x56c119){var _0xb751c1=function(_0x44d2a6){while(--_0x44d2a6){_0x241fc7['push'](_0x241fc7['shift']());}};_0xb751c1(++_0x56c119);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3003fc,_0x5ac5de){_0x3003fc=_0x3003fc-0x0;var _0x22cb43=_0x7fbe[_0x3003fc];return _0x22cb43;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x137c8e,_0x298b3){_0x137c8e=_0x137c8e-0x0;var _0x21cc69=_0x7a54[_0x137c8e];return _0x21cc69;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 546ae1f..ddd7900 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 _0x0093=['./action.controller','put','isAuthenticated','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0093,0x1d7));var _0x3009=function(_0x157ace,_0x184c29){_0x157ace=_0x157ace-0x0;var _0x4f28e1=_0x0093[_0x157ace];return _0x4f28e1;};'use strict';var multer=require(_0x3009('0x0'));var util=require(_0x3009('0x1'));var path=require(_0x3009('0x2'));var timeout=require(_0x3009('0x3'));var express=require(_0x3009('0x4'));var router=express[_0x3009('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3009('0x6'));var interaction=require(_0x3009('0x7'));var config=require(_0x3009('0x8'));var controller=require(_0x3009('0x9'));router[_0x3009('0xa')]('/:id',auth[_0x3009('0xb')](),controller['update']);router[_0x3009('0xc')](_0x3009('0xd'),auth[_0x3009('0xb')](),controller[_0x3009('0xe')]);module[_0x3009('0xf')]=router; \ No newline at end of file +var _0x7eb5=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','delete','/:id','isAuthenticated'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x7eb5,0x13d));var _0x57eb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7eb5[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x57eb('0x0'));var path=require(_0x57eb('0x1'));var timeout=require(_0x57eb('0x2'));var express=require(_0x57eb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x57eb('0x4'));var interaction=require(_0x57eb('0x5'));var config=require(_0x57eb('0x6'));var controller=require(_0x57eb('0x7'));router[_0x57eb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x57eb('0x9')]);router[_0x57eb('0xa')](_0x57eb('0xb'),auth[_0x57eb('0xc')](),controller[_0x57eb('0xd')]);module[_0x57eb('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index be7c7b3..a14e024 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 _0x326f=['STRING','TEXT','sequelize'];(function(_0x52e4a0,_0x332127){var _0x582129=function(_0x59bf39){while(--_0x59bf39){_0x52e4a0['push'](_0x52e4a0['shift']());}};_0x582129(++_0x332127);}(_0x326f,0xd1));var _0xf326=function(_0xeff039,_0x49aab8){_0xeff039=_0xeff039-0x0;var _0xbe4501=_0x326f[_0xeff039];return _0xbe4501;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x86e1f5,_0x54a397){var _0x5f200d=function(_0xdb27e){while(--_0xdb27e){_0x86e1f5['push'](_0x86e1f5['shift']());}};_0x5f200d(++_0x54a397);}(_0xeda8,0x104));var _0x8eda=function(_0x15de75,_0x387e8f){_0x15de75=_0x15de75-0x0;var _0x26c368=_0xeda8[_0x15de75];return _0x26c368;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 03341d5..e6eb66a 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 _0xf234=['operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','AVG(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','keyBy','DESC','parse','clone','output','web','fullPath','%s-%s.%s','randomstring','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','right_join','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules'];(function(_0x9af134,_0x24ec94){var _0xf6dd82=function(_0x18e82c){while(--_0x18e82c){_0x9af134['push'](_0x9af134['shift']());}};_0xf6dd82(++_0x24ec94);}(_0xf234,0xeb));var _0x4f23=function(_0x425c62,_0x41eb91){_0x425c62=_0x425c62-0x0;var _0x20b356=_0xf234[_0x425c62];return _0x20b356;};'use strict';var emlformat=require(_0x4f23('0x0'));var rimraf=require(_0x4f23('0x1'));var zipdir=require(_0x4f23('0x2'));var jsonpatch=require(_0x4f23('0x3'));var rp=require(_0x4f23('0x4'));var moment=require(_0x4f23('0x5'));var BPromise=require(_0x4f23('0x6'));var Mustache=require(_0x4f23('0x7'));var util=require(_0x4f23('0x8'));var path=require(_0x4f23('0x9'));var sox=require(_0x4f23('0xa'));var csv=require(_0x4f23('0xb'));var ejs=require(_0x4f23('0xc'));var fs=require('fs');var fs_extra=require(_0x4f23('0xd'));var _=require('lodash');var squel=require(_0x4f23('0xe'));var crypto=require('crypto');var jsforce=require(_0x4f23('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4f23('0xb'));var querystring=require(_0x4f23('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4f23('0x11'));var qs=require(_0x4f23('0x12'));var as=require(_0x4f23('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f23('0x14'))(_0x4f23('0x15'));var utils=require('../../config/utils');var config=require(_0x4f23('0x16'));var licenseUtil=require(_0x4f23('0x17'));var db=require(_0x4f23('0x18'))['db'];var dbH=require(_0x4f23('0x18'))[_0x4f23('0x19')];function respondWithStatusCode(_0x51048f,_0x1f56de){_0x1f56de=_0x1f56de||0xcc;return function(_0x275c59){if(_0x275c59){return _0x51048f[_0x4f23('0x1a')](_0x1f56de);}return _0x51048f[_0x4f23('0x1b')](_0x1f56de)[_0x4f23('0x1c')]();};}function respondWithResult(_0x247fa9,_0x2c369b){_0x2c369b=_0x2c369b||0xc8;return function(_0x331245){if(_0x331245){return _0x247fa9['status'](_0x2c369b)[_0x4f23('0x1d')](_0x331245);}};}function respondWithFilteredResult(_0x171201,_0x467402){return function(_0x56913e){if(_0x56913e){var _0x3e19b4=typeof _0x467402[_0x4f23('0x1e')]===_0x4f23('0x1f')&&typeof _0x467402[_0x4f23('0x20')]===_0x4f23('0x1f');var _0x5b8b04=_0x56913e['count'];var _0x37c929=_0x3e19b4?0x0:_0x467402[_0x4f23('0x1e')];var _0xba4da8=_0x3e19b4?_0x56913e['count']:_0x467402[_0x4f23('0x1e')]+_0x467402[_0x4f23('0x20')];var _0x11a9cd;if(_0xba4da8>=_0x5b8b04){_0xba4da8=_0x5b8b04;_0x11a9cd=0xc8;}else{_0x11a9cd=0xce;}_0x171201[_0x4f23('0x1b')](_0x11a9cd);return _0x171201['set'](_0x4f23('0x21'),_0x37c929+'-'+_0xba4da8+'/'+_0x5b8b04)[_0x4f23('0x1d')](_0x56913e);}return null;};}function patchUpdates(_0x53b353){return function(_0x41294c){try{jsonpatch[_0x4f23('0x22')](_0x41294c,_0x53b353,!![]);}catch(_0x4931c4){return BPromise[_0x4f23('0x23')](_0x4931c4);}return _0x41294c[_0x4f23('0x24')]();};}function saveUpdates(_0x11ce9d,_0x2cae36){return function(_0x83e567){if(_0x83e567){return _0x83e567['update'](_0x11ce9d)['then'](function(_0xe3742){return _0xe3742;});}return null;};}function removeEntity(_0x233fd9,_0x59fba5){return function(_0x33f55b){if(_0x33f55b){return _0x33f55b[_0x4f23('0x25')]()[_0x4f23('0x26')](function(){var _0xfe1368=_0x33f55b[_0x4f23('0x27')]({'plain':!![]});var _0x31531b=_0x4f23('0x28');return db[_0x4f23('0x29')]['destroy']({'where':{'type':_0x31531b,'resourceId':_0xfe1368['id']}})['then'](function(){return _0x33f55b;});})[_0x4f23('0x26')](function(){_0x233fd9[_0x4f23('0x1b')](0xcc)[_0x4f23('0x1c')]();});}};}function handleEntityNotFound(_0x4c95b0,_0x34d7e0){return function(_0x4e89ab){if(!_0x4e89ab){_0x4c95b0['sendStatus'](0x194);}return _0x4e89ab;};}function handleError(_0x52769a,_0x2d3d68){_0x2d3d68=_0x2d3d68||0x1f4;return function(_0x3550bc){logger[_0x4f23('0x2a')](_0x3550bc[_0x4f23('0x2b')]);if(_0x3550bc['name']){delete _0x3550bc[_0x4f23('0x2c')];}_0x52769a['status'](_0x2d3d68)[_0x4f23('0x2d')](_0x3550bc);};}exports[_0x4f23('0x2e')]=function(_0xf7fd17,_0x32fa99){var _0x57ad9b={},_0x2d57d4={},_0x2bad9d={'count':0x0,'rows':[]};var _0x21dbc3=_['map'](db[_0x4f23('0x2f')][_0x4f23('0x30')],function(_0x12994d){return{'name':_0x12994d['fieldName'],'type':_0x12994d[_0x4f23('0x31')][_0x4f23('0x32')]};});_0x2d57d4[_0x4f23('0x33')]=_[_0x4f23('0x34')](_0x21dbc3,_0x4f23('0x2c'));_0x2d57d4['query']=_[_0x4f23('0x35')](_0xf7fd17[_0x4f23('0x36')]);_0x2d57d4[_0x4f23('0x37')]=_[_0x4f23('0x38')](_0x2d57d4[_0x4f23('0x33')],_0x2d57d4['query']);_0x57ad9b[_0x4f23('0x39')]=_[_0x4f23('0x38')](_0x2d57d4[_0x4f23('0x33')],qs[_0x4f23('0x3a')](_0xf7fd17[_0x4f23('0x36')][_0x4f23('0x3a')]));_0x57ad9b[_0x4f23('0x39')]=_0x57ad9b['attributes'][_0x4f23('0x3b')]?_0x57ad9b[_0x4f23('0x39')]:_0x2d57d4[_0x4f23('0x33')];if(!_0xf7fd17['query']['hasOwnProperty'](_0x4f23('0x3c'))){_0x57ad9b[_0x4f23('0x20')]=qs[_0x4f23('0x20')](_0xf7fd17[_0x4f23('0x36')][_0x4f23('0x20')]);_0x57ad9b['offset']=qs[_0x4f23('0x1e')](_0xf7fd17[_0x4f23('0x36')]['offset']);}_0x57ad9b[_0x4f23('0x3d')]=qs['sort'](_0xf7fd17[_0x4f23('0x36')][_0x4f23('0x3e')]);_0x57ad9b[_0x4f23('0x3f')]=qs['filters'](_[_0x4f23('0x40')](_0xf7fd17[_0x4f23('0x36')],_0x2d57d4[_0x4f23('0x37')]),_0x21dbc3);if(_0xf7fd17[_0x4f23('0x36')][_0x4f23('0x41')]){_0x57ad9b[_0x4f23('0x3f')]=_[_0x4f23('0x42')](_0x57ad9b[_0x4f23('0x3f')],{'$or':_[_0x4f23('0x34')](_0x21dbc3,function(_0x394288){if(_0x394288[_0x4f23('0x31')]!=='VIRTUAL'){var _0x171812={};_0x171812[_0x394288[_0x4f23('0x2c')]]={'$like':'%'+_0xf7fd17[_0x4f23('0x36')][_0x4f23('0x41')]+'%'};return _0x171812;}})});}_0x57ad9b=_[_0x4f23('0x42')]({},_0x57ad9b,_0xf7fd17[_0x4f23('0x43')]);var _0x225cc2={'where':_0x57ad9b['where']};return db['AnalyticCustomReport'][_0x4f23('0x44')](_0x225cc2)[_0x4f23('0x26')](function(_0x263adc){_0x2bad9d['count']=_0x263adc;if(_0xf7fd17['query']['includeAll']){_0x57ad9b[_0x4f23('0x45')]=[{'all':!![]}];}return db[_0x4f23('0x2f')][_0x4f23('0x46')](_0x57ad9b);})[_0x4f23('0x26')](function(_0x1f5fb9){_0x2bad9d[_0x4f23('0x47')]=_0x1f5fb9;return _0x2bad9d;})[_0x4f23('0x26')](respondWithFilteredResult(_0x32fa99,_0x57ad9b))[_0x4f23('0x48')](handleError(_0x32fa99,null));};exports[_0x4f23('0x49')]=function(_0x2a07f4,_0x4b1c0f){var _0x18ec57={'raw':![],'where':{'id':_0x2a07f4[_0x4f23('0x4a')]['id']}},_0x402f67={};_0x402f67['model']=_[_0x4f23('0x35')](db[_0x4f23('0x2f')][_0x4f23('0x30')]);_0x402f67['query']=_['keys'](_0x2a07f4[_0x4f23('0x36')]);_0x402f67['filters']=_[_0x4f23('0x38')](_0x402f67[_0x4f23('0x33')],_0x402f67[_0x4f23('0x36')]);_0x18ec57['attributes']=_['intersection'](_0x402f67[_0x4f23('0x33')],qs[_0x4f23('0x3a')](_0x2a07f4[_0x4f23('0x36')][_0x4f23('0x3a')]));_0x18ec57[_0x4f23('0x39')]=_0x18ec57[_0x4f23('0x39')][_0x4f23('0x3b')]?_0x18ec57[_0x4f23('0x39')]:_0x402f67[_0x4f23('0x33')];if(_0x2a07f4[_0x4f23('0x36')][_0x4f23('0x4b')]){_0x18ec57['include']=[{'all':!![]}];}_0x18ec57=_[_0x4f23('0x42')]({},_0x18ec57,_0x2a07f4[_0x4f23('0x43')]);return db[_0x4f23('0x2f')]['find'](_0x18ec57)[_0x4f23('0x26')](handleEntityNotFound(_0x4b1c0f,null))['then'](respondWithResult(_0x4b1c0f,null))[_0x4f23('0x48')](handleError(_0x4b1c0f,null));};exports[_0x4f23('0x4c')]=function(_0x5d0230,_0x2a7718){return db['AnalyticCustomReport'][_0x4f23('0x4c')](_0x5d0230['body'],{})[_0x4f23('0x26')](function(_0x3c4412){var _0x3a0f1d=_0x5d0230[_0x4f23('0x4d')][_0x4f23('0x27')]({'plain':!![]});if(!_0x3a0f1d)throw new Error(_0x4f23('0x4e'));if(_0x3a0f1d['role']===_0x4f23('0x4d')){var _0x5a2b0d=_0x3c4412[_0x4f23('0x27')]({'plain':!![]});var _0x7f1acc='Reports';return db['UserProfileSection'][_0x4f23('0x4f')]({'where':{'name':_0x7f1acc,'userProfileId':_0x3a0f1d[_0x4f23('0x50')]},'raw':!![]})['then'](function(_0x20ea8e){if(_0x20ea8e&&_0x20ea8e['autoAssociation']===0x0){return db[_0x4f23('0x29')][_0x4f23('0x4c')]({'name':_0x5a2b0d[_0x4f23('0x2c')],'resourceId':_0x5a2b0d['id'],'type':_0x4f23('0x28'),'sectionId':_0x20ea8e['id']},{})[_0x4f23('0x26')](function(){return _0x3c4412;});}else{return _0x3c4412;}})['catch'](function(_0x5a735b){logger[_0x4f23('0x2a')](_0x4f23('0x51'),_0x5a735b);throw _0x5a735b;});}return _0x3c4412;})[_0x4f23('0x26')](respondWithResult(_0x2a7718,0xc9))['catch'](handleError(_0x2a7718,null));};exports[_0x4f23('0x52')]=function(_0x344455,_0x4f12ee){if(_0x344455[_0x4f23('0x53')]['id']){delete _0x344455[_0x4f23('0x53')]['id'];}return db[_0x4f23('0x2f')][_0x4f23('0x4f')]({'where':{'id':_0x344455[_0x4f23('0x4a')]['id']}})[_0x4f23('0x26')](handleEntityNotFound(_0x4f12ee,null))[_0x4f23('0x26')](saveUpdates(_0x344455[_0x4f23('0x53')],null))[_0x4f23('0x26')](respondWithResult(_0x4f12ee,null))[_0x4f23('0x48')](handleError(_0x4f12ee,null));};exports[_0x4f23('0x25')]=function(_0x668da0,_0x288981){return db[_0x4f23('0x2f')]['find']({'where':{'id':_0x668da0[_0x4f23('0x4a')]['id']}})[_0x4f23('0x26')](handleEntityNotFound(_0x288981,null))[_0x4f23('0x26')](removeEntity(_0x288981,null))[_0x4f23('0x48')](handleError(_0x288981,null));};exports[_0x4f23('0x54')]=function(_0x214075,_0x4aad93){var _0x263e93=0xa;var _0x24a102=[_0x4f23('0x55'),_0x4f23('0x56'),'right_join','cross_join'];var _0x14dcbb={'SUM':_0x4f23('0x57'),'COUNT':_0x4f23('0x58'),'COUNT DISTINCT':_0x4f23('0x59'),'MAX':_0x4f23('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x4f23('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f23('0x5c')};var _0x30fb9a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x24829e=function(_0x52cfa9){return!_[_0x4f23('0x5d')](['IS\x20NULL',_0x4f23('0x5e'),_0x4f23('0x5f'),'IS\x20NOT\x20EMPTY'],_0x52cfa9);};var _0x43d518=function(_0x555ed4){if(!_0x555ed4||!_0x555ed4[_0x4f23('0x60')][_0x4f23('0x3b')]){return'';}for(var _0x372dda='(',_0x58b1d7=0x0;_0x58b1d7<_0x555ed4[_0x4f23('0x60')][_0x4f23('0x3b')];_0x58b1d7+=0x1){_0x58b1d7>0x0&&(_0x372dda+='\x20'+_0x555ed4[_0x4f23('0x61')]+'\x20');_0x372dda+=_0x555ed4[_0x4f23('0x60')][_0x58b1d7][_0x4f23('0x62')]?_0x43d518(_0x555ed4[_0x4f23('0x60')][_0x58b1d7][_0x4f23('0x62')]):_0x555ed4[_0x4f23('0x60')][_0x58b1d7][_0x4f23('0x63')]+'\x20'+_0x555ed4[_0x4f23('0x60')][_0x58b1d7][_0x4f23('0x64')]+(_0x24829e(_0x555ed4[_0x4f23('0x60')][_0x58b1d7][_0x4f23('0x64')])?'\x20'+_0x555ed4[_0x4f23('0x60')][_0x58b1d7][_0x4f23('0x65')]:'');}return _0x372dda+')';};var _0x380d63={'where':{'id':_0x214075[_0x4f23('0x4a')]['id']}},_0x385116,_0x470601,_0x20588b,_0x114131,_0x26c429;_0x380d63=_['merge']({},_0x380d63,_0x214075[_0x4f23('0x43')]);return db[_0x4f23('0x2f')][_0x4f23('0x4f')](_0x380d63)['then'](function(_0x173439){if(_0x173439){_0x385116=_0x173439;return _0x173439[_0x4f23('0x66')]();}return null;})[_0x4f23('0x26')](function(_0x14f60b){if(_0x14f60b){if(!_0x14f60b[_0x4f23('0x3b')]){throw new db[(_0x4f23('0x67'))][(_0x4f23('0x68'))](_0x4f23('0x69'),0x193);}_0x470601=_0x14f60b;return db[_0x4f23('0x6a')][_0x4f23('0x46')]({'raw':!![]});}return null;})[_0x4f23('0x26')](function(_0x2ce6c5){if(_0x2ce6c5){_0x20588b=_['keyBy'](_0x2ce6c5,'id');var _0x26acd5;var _0x11b3ca=squel[_0x4f23('0x6b')]();_0x11b3ca[_0x4f23('0x6c')](_0x385116[_0x4f23('0x6d')]);for(var _0x2f20ce=0x0;_0x2f20ce<_0x470601['length'];_0x2f20ce+=0x1){_0x26acd5=_0x470601[_0x2f20ce]['MetricId']?_0x20588b[_0x470601[_0x2f20ce][_0x4f23('0x6e')]][_0x4f23('0x6f')]:_0x470601[_0x2f20ce][_0x4f23('0x63')];_0x26acd5=_0x470601[_0x2f20ce][_0x4f23('0x70')]?_[_0x4f23('0x71')](_0x14dcbb[_0x470601[_0x2f20ce][_0x4f23('0x70')]],'%s',_0x26acd5):_0x26acd5;_0x26acd5=_0x470601[_0x2f20ce][_0x4f23('0x72')]?_[_0x4f23('0x71')](_0x30fb9a[_0x470601[_0x2f20ce][_0x4f23('0x72')]],'%s',_0x26acd5):_0x26acd5;if(_0x470601[_0x2f20ce][_0x4f23('0x73')]){_0x11b3ca[_0x4f23('0x62')](_0x26acd5);}_0x470601[_0x2f20ce][_0x4f23('0x74')]&&_0x11b3ca[_0x4f23('0x3d')](_0x26acd5,_0x470601[_0x2f20ce][_0x4f23('0x74')]==='DESC'?![]:!![]);_0x11b3ca[_0x4f23('0x63')](_0x26acd5,_0x470601[_0x2f20ce][_0x4f23('0x75')]||_0x26acd5);}if(_0x385116[_0x4f23('0x76')]){_0x385116['joins']=JSON['parse'](_0x385116[_0x4f23('0x76')]);for(var _0x46c700=0x0;_0x46c700<_0x385116[_0x4f23('0x76')][_0x4f23('0x3b')];_0x46c700+=0x1){if(_0x385116['joins'][_0x46c700][_0x4f23('0x31')]&&_[_0x4f23('0x5d')](_0x24a102,_0x385116['joins'][_0x46c700][_0x4f23('0x31')])&&_0x385116['joins'][_0x46c700]['parentKey']&&_0x385116[_0x4f23('0x76')][_0x46c700][_0x4f23('0x77')]&&_0x385116[_0x4f23('0x76')][_0x46c700][_0x4f23('0x78')]){_0x11b3ca[_0x385116[_0x4f23('0x76')][_0x46c700]['type']](_0x385116[_0x4f23('0x76')][_0x46c700]['foreignTable'],null,util[_0x4f23('0x72')](_0x4f23('0x79'),_0x385116[_0x4f23('0x6d')],_0x385116[_0x4f23('0x76')][_0x46c700][_0x4f23('0x7a')],_0x385116['joins'][_0x46c700]['foreignTable'],_0x385116[_0x4f23('0x76')][_0x46c700][_0x4f23('0x78')]));}}}if(_0x385116['conditions']){_0x385116[_0x4f23('0x7b')]=JSON['parse'](_0x385116[_0x4f23('0x7b')]);_0x11b3ca[_0x4f23('0x3f')](_0x43d518(_0x385116[_0x4f23('0x7b')]['group']));}_0x26c429=_0x11b3ca['clone']();_0x11b3ca[_0x4f23('0x20')](_0x263e93);_0x11b3ca[_0x4f23('0x1e')](0x0);logger['debug'](_0x4f23('0x7c'),_0x11b3ca[_0x4f23('0x7d')]());return dbH['sequelize'][_0x4f23('0x36')](_0x11b3ca[_0x4f23('0x7d')](),{'type':dbH[_0x4f23('0x7e')][_0x4f23('0x7f')][_0x4f23('0x80')]});}})[_0x4f23('0x26')](respondWithResult(_0x4aad93,null))[_0x4f23('0x48')](handleError(_0x4aad93,null));};function runReport(_0x394633,_0x2b3c7d,_0x5caac6){var _0x327c65=_0x2b3c7d['name'];var _0x5591bb=0xa;var _0x391baf=[_0x4f23('0x55'),_0x4f23('0x56'),'right_join','cross_join'];var _0x3bafd2={'SUM':_0x4f23('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f23('0x59'),'MAX':_0x4f23('0x5a'),'MIN':_0x4f23('0x81'),'AVG':_0x4f23('0x82'),'GROUP_CONCAT':_0x4f23('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f9e85={'SEC_TO_TIME':_0x4f23('0x83'),'DATE':_0x4f23('0x84'),'HOUR':_0x4f23('0x85'),'ROUND':_0x4f23('0x86'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x48a5fc=function(_0x3913e3){return!_['includes']([_0x4f23('0x87'),_0x4f23('0x5e'),_0x4f23('0x5f'),_0x4f23('0x88')],_0x3913e3);};var _0x23048a=function(_0x5b5c56){if(!_0x5b5c56||!_0x5b5c56[_0x4f23('0x60')][_0x4f23('0x3b')]){return'';}for(var _0x494896='(',_0xe7b273=0x0;_0xe7b273<_0x5b5c56[_0x4f23('0x60')]['length'];_0xe7b273+=0x1){_0xe7b273>0x0&&(_0x494896+='\x20'+_0x5b5c56[_0x4f23('0x61')]+'\x20');_0x494896+=_0x5b5c56[_0x4f23('0x60')][_0xe7b273][_0x4f23('0x62')]?_0x23048a(_0x5b5c56['rules'][_0xe7b273][_0x4f23('0x62')]):_0x5b5c56['rules'][_0xe7b273][_0x4f23('0x63')]+'\x20'+_0x5b5c56[_0x4f23('0x60')][_0xe7b273][_0x4f23('0x64')]+(_0x48a5fc(_0x5b5c56[_0x4f23('0x60')][_0xe7b273][_0x4f23('0x64')])?'\x20'+_0x5b5c56[_0x4f23('0x60')][_0xe7b273][_0x4f23('0x65')]:'');}return _0x494896+')';};var _0x156ff8={'where':{'id':_0x394633['id']}},_0x57023d,_0x4439e2,_0x16c203,_0x2ce1af,_0xd22fc9;_0x156ff8=_[_0x4f23('0x42')]({},_0x156ff8,_0x5caac6);return db[_0x4f23('0x2f')]['find'](_0x156ff8)[_0x4f23('0x26')](function(_0x41e004){if(_0x41e004){_0x57023d=_0x41e004;return _0x41e004[_0x4f23('0x66')]();}return null;})[_0x4f23('0x26')](function(_0xc2caf2){if(_0xc2caf2){if(!_0xc2caf2[_0x4f23('0x3b')]){throw new db[(_0x4f23('0x67'))]['ValidationErrorItem'](_0x4f23('0x69'),0x193);}_0x4439e2=_0xc2caf2;return db['AnalyticMetric'][_0x4f23('0x46')]({'raw':!![]});}return null;})['then'](function(_0x21157a){if(_0x21157a){_0x16c203=_[_0x4f23('0x89')](_0x21157a,'id');var _0x5b8c43;var _0x2a01d3=squel[_0x4f23('0x6b')]();_0x2a01d3[_0x4f23('0x6c')](_0x57023d[_0x4f23('0x6d')]);for(var _0x538c85=0x0;_0x538c85<_0x4439e2[_0x4f23('0x3b')];_0x538c85+=0x1){_0x5b8c43=_0x4439e2[_0x538c85][_0x4f23('0x6e')]?_0x16c203[_0x4439e2[_0x538c85][_0x4f23('0x6e')]][_0x4f23('0x6f')]:_0x4439e2[_0x538c85][_0x4f23('0x63')];_0x5b8c43=_0x4439e2[_0x538c85]['function']?_[_0x4f23('0x71')](_0x3bafd2[_0x4439e2[_0x538c85][_0x4f23('0x70')]],'%s',_0x5b8c43):_0x5b8c43;_0x5b8c43=_0x4439e2[_0x538c85][_0x4f23('0x72')]?_[_0x4f23('0x71')](_0x1f9e85[_0x4439e2[_0x538c85][_0x4f23('0x72')]],'%s',_0x5b8c43):_0x5b8c43;if(_0x4439e2[_0x538c85]['groupBy']){_0x2a01d3[_0x4f23('0x62')](_0x5b8c43);}_0x4439e2[_0x538c85][_0x4f23('0x74')]&&_0x2a01d3[_0x4f23('0x3d')](_0x5b8c43,_0x4439e2[_0x538c85]['orderBy']===_0x4f23('0x8a')?![]:!![]);_0x2a01d3[_0x4f23('0x63')](_0x5b8c43,_0x4439e2[_0x538c85][_0x4f23('0x75')]||_0x5b8c43);}if(_0x57023d[_0x4f23('0x76')]){_0x57023d['joins']=JSON['parse'](_0x57023d['joins']);for(var _0x1f33a2=0x0;_0x1f33a2<_0x57023d['joins'][_0x4f23('0x3b')];_0x1f33a2+=0x1){if(_0x57023d[_0x4f23('0x76')][_0x1f33a2]['type']&&_[_0x4f23('0x5d')](_0x391baf,_0x57023d['joins'][_0x1f33a2]['type'])&&_0x57023d[_0x4f23('0x76')][_0x1f33a2][_0x4f23('0x7a')]&&_0x57023d[_0x4f23('0x76')][_0x1f33a2][_0x4f23('0x77')]&&_0x57023d[_0x4f23('0x76')][_0x1f33a2][_0x4f23('0x78')]){_0x2a01d3[_0x57023d['joins'][_0x1f33a2][_0x4f23('0x31')]](_0x57023d[_0x4f23('0x76')][_0x1f33a2][_0x4f23('0x77')],null,util[_0x4f23('0x72')](_0x4f23('0x79'),_0x57023d[_0x4f23('0x6d')],_0x57023d[_0x4f23('0x76')][_0x1f33a2][_0x4f23('0x7a')],_0x57023d['joins'][_0x1f33a2][_0x4f23('0x77')],_0x57023d['joins'][_0x1f33a2][_0x4f23('0x78')]));}}}if(_0x57023d['conditions']){_0x57023d[_0x4f23('0x7b')]=JSON[_0x4f23('0x8b')](_0x57023d[_0x4f23('0x7b')]);_0x2a01d3[_0x4f23('0x3f')](_0x23048a(_0x57023d[_0x4f23('0x7b')]['group']));}_0xd22fc9=_0x2a01d3[_0x4f23('0x8c')]();_0x2a01d3['limit'](_0x5591bb);_0x2a01d3[_0x4f23('0x1e')](0x0);return;}})['then'](function(){if(_0x2b3c7d[_0x4f23('0x8d')]===_0x4f23('0x8e')){return null;}var _0x45355f=_[_0x4f23('0x42')](_0x2b3c7d,{'name':_0x2b3c7d[_0x4f23('0x8f')]||_0x2b3c7d['name']||_0x57023d['name'],'basename':_0x327c65,'savename':util[_0x4f23('0x72')](_0x4f23('0x90'),_0x2b3c7d[_0x4f23('0x2c')]||_0x57023d[_0x4f23('0x2c')],require(_0x4f23('0x91'))['generate'](0x4),_0x2b3c7d[_0x4f23('0x8d')]||'csv'),'reportId':_0x57023d['id'],'reportType':'custom'});return db[_0x4f23('0x92')][_0x4f23('0x4c')](_0x45355f,{'raw':!![]});})[_0x4f23('0x26')](function(_0x8572a){if(_0x57023d[_0x4f23('0x6d')]==='cdr'){_0xd22fc9[_0x4f23('0x3f')](_0x57023d['table']+_0x4f23('0x93'),_0x2b3c7d[_0x4f23('0x94')],_0x2b3c7d[_0x4f23('0x95')]);}else{_0xd22fc9[_0x4f23('0x3f')](_0x57023d['table']+_0x4f23('0x96'),_0x2b3c7d['startDate'],_0x2b3c7d[_0x4f23('0x95')]);}if(_0x8572a){logger[_0x4f23('0x97')](_0x4f23('0x98'),_0xd22fc9[_0x4f23('0x7d')]());require(_0x4f23('0x99'))[_0x4f23('0x9a')](path[_0x4f23('0x55')](__dirname,_0x4f23('0x9b'),_0x8572a['output']),[_0x8572a['id'],_0xd22fc9[_0x4f23('0x7d')](),path['join'](__dirname,_0x4f23('0x9c'),_0x8572a[_0x4f23('0x9d')]),_0x327c65]);return _0x8572a;}else{var _0x5ab78b=squel['select']();_0x5ab78b[_0x4f23('0x6c')]('('+_0xd22fc9[_0x4f23('0x7d')]()+')',_0x4f23('0x9e'));_0x5ab78b[_0x4f23('0x63')](_0x4f23('0x9f'),'count');_0xd22fc9[_0x4f23('0x20')](_0x2b3c7d[_0x4f23('0x20')]||_0x5591bb);_0xd22fc9[_0x4f23('0x1e')](_0x2b3c7d[_0x4f23('0x1e')]||0x0);return dbH[_0x4f23('0x7e')]['query'](_0x5ab78b[_0x4f23('0x7d')](),{'type':dbH['sequelize']['QueryTypes'][_0x4f23('0x80')]})[_0x4f23('0x26')](function(_0x25c889){if(!_0x25c889[_0x4f23('0x3b')]){_0x2ce1af=0x0;}else{_0x2ce1af=_0x25c889[0x0][_0x4f23('0x44')]||0x0;}return dbH[_0x4f23('0x7e')][_0x4f23('0x36')](_0xd22fc9[_0x4f23('0x7d')](),{'type':dbH[_0x4f23('0x7e')][_0x4f23('0x7f')][_0x4f23('0x80')]});})['then'](function(_0x120502){return{'rows':_0x120502||[],'count':_0x2ce1af};});}});}exports[_0x4f23('0xa0')]=function(_0x5d36c4,_0x2a0b66){return runReport(_0x5d36c4['params'],_0x5d36c4[_0x4f23('0x36')],_0x5d36c4[_0x4f23('0x43')])[_0x4f23('0x26')](respondWithResult(_0x2a0b66,null))['catch'](handleError(_0x2a0b66,null));};exports[_0x4f23('0xa1')]=runReport;exports[_0x4f23('0x36')]=function(_0x4c5d87,_0x326f12){var _0x2f4daf=0xa;var _0x16b406=[_0x4f23('0x55'),_0x4f23('0x56'),_0x4f23('0xa2'),_0x4f23('0xa3')];var _0x14e361={'SUM':_0x4f23('0x57'),'COUNT':_0x4f23('0x58'),'COUNT DISTINCT':_0x4f23('0x59'),'MAX':_0x4f23('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x4f23('0x5b'),'GROUP_CONCAT ASC':_0x4f23('0xa4'),'GROUP_CONCAT DESC':_0x4f23('0x5c')};var _0x15ff62={'SEC_TO_TIME':_0x4f23('0x83'),'DATE':_0x4f23('0x84'),'HOUR':_0x4f23('0x85'),'ROUND':_0x4f23('0x86'),'UNIX_TIMESTAMP':_0x4f23('0xa5')};var _0x170dbc=function(_0x3be7b2){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x4f23('0x5f'),_0x4f23('0x88')],_0x3be7b2);};var _0x2a812d=function(_0x4c3531){if(!_0x4c3531||!_0x4c3531['rules'][_0x4f23('0x3b')]){return'';}for(var _0x3f41f3='(',_0x1b1bff=0x0;_0x1b1bff<_0x4c3531[_0x4f23('0x60')]['length'];_0x1b1bff+=0x1){_0x1b1bff>0x0&&(_0x3f41f3+='\x20'+_0x4c3531['operator']+'\x20');_0x3f41f3+=_0x4c3531[_0x4f23('0x60')][_0x1b1bff][_0x4f23('0x62')]?_0x2a812d(_0x4c3531[_0x4f23('0x60')][_0x1b1bff][_0x4f23('0x62')]):_0x4c3531[_0x4f23('0x60')][_0x1b1bff]['field']+'\x20'+_0x4c3531[_0x4f23('0x60')][_0x1b1bff]['condition']+(_0x170dbc(_0x4c3531['rules'][_0x1b1bff][_0x4f23('0x64')])?'\x20'+_0x4c3531[_0x4f23('0x60')][_0x1b1bff][_0x4f23('0x65')]:'');}return _0x3f41f3+')';};var _0xb61aec={'where':{'id':_0x4c5d87[_0x4f23('0x4a')]['id']}},_0x314851,_0x2ca4ae,_0x41c083,_0x1d0e8d,_0x5dbd83;_0xb61aec=_[_0x4f23('0x42')]({},_0xb61aec,_0x4c5d87[_0x4f23('0x43')]);return db[_0x4f23('0x2f')][_0x4f23('0x4f')](_0xb61aec)[_0x4f23('0x26')](function(_0x313545){if(_0x313545){_0x314851=_0x313545;return _0x313545[_0x4f23('0x66')]();}return null;})[_0x4f23('0x26')](function(_0x1e3bae){if(_0x1e3bae){if(!_0x1e3bae[_0x4f23('0x3b')]){throw new db[(_0x4f23('0x67'))][(_0x4f23('0x68'))](_0x4f23('0x69'),0x193);}_0x2ca4ae=_0x1e3bae;return db[_0x4f23('0x6a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3f166a){if(_0x3f166a){_0x41c083=_[_0x4f23('0x89')](_0x3f166a,'id');var _0x368123;var _0x4ed6f2=squel['select']();_0x4ed6f2[_0x4f23('0x6c')](_0x314851[_0x4f23('0x6d')]);for(var _0x4d1404=0x0;_0x4d1404<_0x2ca4ae[_0x4f23('0x3b')];_0x4d1404+=0x1){_0x368123=_0x2ca4ae[_0x4d1404][_0x4f23('0x6e')]?_0x41c083[_0x2ca4ae[_0x4d1404][_0x4f23('0x6e')]][_0x4f23('0x6f')]:_0x2ca4ae[_0x4d1404][_0x4f23('0x63')];_0x368123=_0x2ca4ae[_0x4d1404]['function']?_[_0x4f23('0x71')](_0x14e361[_0x2ca4ae[_0x4d1404][_0x4f23('0x70')]],'%s',_0x368123):_0x368123;_0x368123=_0x2ca4ae[_0x4d1404][_0x4f23('0x72')]?_[_0x4f23('0x71')](_0x15ff62[_0x2ca4ae[_0x4d1404][_0x4f23('0x72')]],'%s',_0x368123):_0x368123;if(_0x2ca4ae[_0x4d1404][_0x4f23('0x73')]){_0x4ed6f2[_0x4f23('0x62')](_0x368123);}_0x2ca4ae[_0x4d1404][_0x4f23('0x74')]&&_0x4ed6f2[_0x4f23('0x3d')](_0x368123,_0x2ca4ae[_0x4d1404]['orderBy']===_0x4f23('0x8a')?![]:!![]);_0x4ed6f2[_0x4f23('0x63')](_0x368123,_0x2ca4ae[_0x4d1404][_0x4f23('0x75')]||_0x368123);}if(_0x314851[_0x4f23('0x76')]){_0x314851['joins']=JSON[_0x4f23('0x8b')](_0x314851[_0x4f23('0x76')]);for(var _0x211a11=0x0;_0x211a11<_0x314851[_0x4f23('0x76')][_0x4f23('0x3b')];_0x211a11+=0x1){if(_0x314851[_0x4f23('0x76')][_0x211a11][_0x4f23('0x31')]&&_[_0x4f23('0x5d')](_0x16b406,_0x314851[_0x4f23('0x76')][_0x211a11][_0x4f23('0x31')])&&_0x314851[_0x4f23('0x76')][_0x211a11][_0x4f23('0x7a')]&&_0x314851['joins'][_0x211a11][_0x4f23('0x77')]&&_0x314851[_0x4f23('0x76')][_0x211a11][_0x4f23('0x78')]){_0x4ed6f2[_0x314851[_0x4f23('0x76')][_0x211a11][_0x4f23('0x31')]](_0x314851['joins'][_0x211a11][_0x4f23('0x77')],null,util[_0x4f23('0x72')](_0x4f23('0x79'),_0x314851['table'],_0x314851[_0x4f23('0x76')][_0x211a11][_0x4f23('0x7a')],_0x314851[_0x4f23('0x76')][_0x211a11]['foreignTable'],_0x314851[_0x4f23('0x76')][_0x211a11]['foreignKey']));}}}if(_0x314851[_0x4f23('0x7b')]){_0x314851['conditions']=JSON['parse'](_0x314851[_0x4f23('0x7b')]);_0x4ed6f2[_0x4f23('0x3f')](_0x2a812d(_0x314851[_0x4f23('0x7b')][_0x4f23('0x62')]));}_0x5dbd83=_0x4ed6f2[_0x4f23('0x8c')]();_0x4ed6f2[_0x4f23('0x20')](_0x2f4daf);_0x4ed6f2[_0x4f23('0x1e')](0x0);logger['debug'](_0x4f23('0x7c'),_0x4ed6f2[_0x4f23('0x7d')]());return dbH[_0x4f23('0x7e')][_0x4f23('0x36')](_0x4ed6f2[_0x4f23('0x7d')](),{'type':dbH[_0x4f23('0x7e')][_0x4f23('0x7f')][_0x4f23('0x80')]});}})[_0x4f23('0x26')](function(){return{'sql':_0x5dbd83['toString']()};})[_0x4f23('0x26')](respondWithResult(_0x326f12,null))['catch'](handleError(_0x326f12,null));}; \ No newline at end of file +var _0x6aa1=['hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','includeAll','include','findAll','catch','keys','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%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)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','field','function','format','replace','orderBy','order','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','debug','toString','sequelize','SELECT','join','MAX(%s)','MIN(%s)','HOUR(%s)','ROUND(%s)','Sequelize','select','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','QueryTypes','run','runReport','right_join','IS\x20EMPTY','Limited\x20Query:','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','destroy','CustomReports','UserProfileResource','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x6aa1,0x1b5));var _0x16aa=function(_0x398ec3,_0x403e6c){_0x398ec3=_0x398ec3-0x0;var _0x231f76=_0x6aa1[_0x398ec3];return _0x231f76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x16aa('0x0'));var jsonpatch=require(_0x16aa('0x1'));var rp=require(_0x16aa('0x2'));var moment=require(_0x16aa('0x3'));var BPromise=require(_0x16aa('0x4'));var Mustache=require('mustache');var util=require(_0x16aa('0x5'));var path=require(_0x16aa('0x6'));var sox=require(_0x16aa('0x7'));var csv=require(_0x16aa('0x8'));var ejs=require(_0x16aa('0x9'));var fs=require('fs');var fs_extra=require(_0x16aa('0xa'));var _=require(_0x16aa('0xb'));var squel=require(_0x16aa('0xc'));var crypto=require(_0x16aa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x16aa('0x8'));var querystring=require('querystring');var Papa=require(_0x16aa('0xe'));var Redis=require(_0x16aa('0xf'));var authService=require(_0x16aa('0x10'));var qs=require(_0x16aa('0x11'));var as=require(_0x16aa('0x12'));var hardwareService=require(_0x16aa('0x13'));var logger=require(_0x16aa('0x14'))('api');var utils=require(_0x16aa('0x15'));var config=require(_0x16aa('0x16'));var licenseUtil=require(_0x16aa('0x17'));var db=require(_0x16aa('0x18'))['db'];var dbH=require(_0x16aa('0x18'))[_0x16aa('0x19')];function respondWithStatusCode(_0x4e56b1,_0x560232){_0x560232=_0x560232||0xcc;return function(_0x477d82){if(_0x477d82){return _0x4e56b1[_0x16aa('0x1a')](_0x560232);}return _0x4e56b1['status'](_0x560232)[_0x16aa('0x1b')]();};}function respondWithResult(_0xe108fd,_0x309eb0){_0x309eb0=_0x309eb0||0xc8;return function(_0x10affb){if(_0x10affb){return _0xe108fd['status'](_0x309eb0)[_0x16aa('0x1c')](_0x10affb);}};}function respondWithFilteredResult(_0x58dd9a,_0x478849){return function(_0xc116f9){if(_0xc116f9){var _0x42f25a=typeof _0x478849[_0x16aa('0x1d')]===_0x16aa('0x1e')&&typeof _0x478849[_0x16aa('0x1f')]===_0x16aa('0x1e');var _0x358d53=_0xc116f9[_0x16aa('0x20')];var _0x3ec33d=_0x42f25a?0x0:_0x478849[_0x16aa('0x1d')];var _0x3030a8=_0x42f25a?_0xc116f9[_0x16aa('0x20')]:_0x478849[_0x16aa('0x1d')]+_0x478849[_0x16aa('0x1f')];var _0x47ea62;if(_0x3030a8>=_0x358d53){_0x3030a8=_0x358d53;_0x47ea62=0xc8;}else{_0x47ea62=0xce;}_0x58dd9a[_0x16aa('0x21')](_0x47ea62);return _0x58dd9a[_0x16aa('0x22')](_0x16aa('0x23'),_0x3ec33d+'-'+_0x3030a8+'/'+_0x358d53)[_0x16aa('0x1c')](_0xc116f9);}return null;};}function patchUpdates(_0x38a70e){return function(_0x33c2d4){try{jsonpatch['apply'](_0x33c2d4,_0x38a70e,!![]);}catch(_0x13f1ed){return BPromise[_0x16aa('0x24')](_0x13f1ed);}return _0x33c2d4['save']();};}function saveUpdates(_0x3ddeb6,_0x3de799){return function(_0x1d318f){if(_0x1d318f){return _0x1d318f[_0x16aa('0x25')](_0x3ddeb6)[_0x16aa('0x26')](function(_0x3c12a5){return _0x3c12a5;});}return null;};}function removeEntity(_0x21482c,_0xeb22fa){return function(_0x5e6721){if(_0x5e6721){return _0x5e6721[_0x16aa('0x27')]()[_0x16aa('0x26')](function(){var _0x4c2b92=_0x5e6721['get']({'plain':!![]});var _0x117d52=_0x16aa('0x28');return db[_0x16aa('0x29')][_0x16aa('0x27')]({'where':{'type':_0x117d52,'resourceId':_0x4c2b92['id']}})[_0x16aa('0x26')](function(){return _0x5e6721;});})['then'](function(){_0x21482c['status'](0xcc)[_0x16aa('0x1b')]();});}};}function handleEntityNotFound(_0x377137,_0xd80f7f){return function(_0xc88796){if(!_0xc88796){_0x377137[_0x16aa('0x1a')](0x194);}return _0xc88796;};}function handleError(_0x26a018,_0x295605){_0x295605=_0x295605||0x1f4;return function(_0x48c4ba){logger['error'](_0x48c4ba[_0x16aa('0x2a')]);if(_0x48c4ba[_0x16aa('0x2b')]){delete _0x48c4ba[_0x16aa('0x2b')];}_0x26a018[_0x16aa('0x21')](_0x295605)[_0x16aa('0x2c')](_0x48c4ba);};}exports[_0x16aa('0x2d')]=function(_0x434195,_0x25c593){var _0x3619b8={},_0x736806={},_0x2c3398={'count':0x0,'rows':[]};var _0x4f944f=_[_0x16aa('0x2e')](db[_0x16aa('0x2f')][_0x16aa('0x30')],function(_0x1329e4){return{'name':_0x1329e4[_0x16aa('0x31')],'type':_0x1329e4[_0x16aa('0x32')][_0x16aa('0x33')]};});_0x736806['model']=_[_0x16aa('0x2e')](_0x4f944f,_0x16aa('0x2b'));_0x736806[_0x16aa('0x34')]=_['keys'](_0x434195[_0x16aa('0x34')]);_0x736806['filters']=_[_0x16aa('0x35')](_0x736806[_0x16aa('0x36')],_0x736806[_0x16aa('0x34')]);_0x3619b8[_0x16aa('0x37')]=_[_0x16aa('0x35')](_0x736806['model'],qs[_0x16aa('0x38')](_0x434195[_0x16aa('0x34')][_0x16aa('0x38')]));_0x3619b8[_0x16aa('0x37')]=_0x3619b8['attributes'][_0x16aa('0x39')]?_0x3619b8['attributes']:_0x736806[_0x16aa('0x36')];if(!_0x434195[_0x16aa('0x34')][_0x16aa('0x3a')](_0x16aa('0x3b'))){_0x3619b8[_0x16aa('0x1f')]=qs['limit'](_0x434195[_0x16aa('0x34')][_0x16aa('0x1f')]);_0x3619b8['offset']=qs[_0x16aa('0x1d')](_0x434195[_0x16aa('0x34')][_0x16aa('0x1d')]);}_0x3619b8['order']=qs['sort'](_0x434195[_0x16aa('0x34')][_0x16aa('0x3c')]);_0x3619b8[_0x16aa('0x3d')]=qs['filters'](_[_0x16aa('0x3e')](_0x434195[_0x16aa('0x34')],_0x736806[_0x16aa('0x3f')]),_0x4f944f);if(_0x434195[_0x16aa('0x34')][_0x16aa('0x40')]){_0x3619b8['where']=_['merge'](_0x3619b8[_0x16aa('0x3d')],{'$or':_[_0x16aa('0x2e')](_0x4f944f,function(_0x554afa){if(_0x554afa[_0x16aa('0x32')]!=='VIRTUAL'){var _0xc4ebb4={};_0xc4ebb4[_0x554afa[_0x16aa('0x2b')]]={'$like':'%'+_0x434195['query'][_0x16aa('0x40')]+'%'};return _0xc4ebb4;}})});}_0x3619b8=_[_0x16aa('0x41')]({},_0x3619b8,_0x434195['options']);var _0x18de36={'where':_0x3619b8['where']};return db[_0x16aa('0x2f')][_0x16aa('0x20')](_0x18de36)[_0x16aa('0x26')](function(_0x2210a9){_0x2c3398[_0x16aa('0x20')]=_0x2210a9;if(_0x434195['query'][_0x16aa('0x42')]){_0x3619b8[_0x16aa('0x43')]=[{'all':!![]}];}return db[_0x16aa('0x2f')][_0x16aa('0x44')](_0x3619b8);})[_0x16aa('0x26')](function(_0x31abe2){_0x2c3398['rows']=_0x31abe2;return _0x2c3398;})[_0x16aa('0x26')](respondWithFilteredResult(_0x25c593,_0x3619b8))[_0x16aa('0x45')](handleError(_0x25c593,null));};exports['show']=function(_0x5c480e,_0x4485b8){var _0x1dcc12={'raw':![],'where':{'id':_0x5c480e['params']['id']}},_0x2590fa={};_0x2590fa[_0x16aa('0x36')]=_[_0x16aa('0x46')](db['AnalyticCustomReport'][_0x16aa('0x30')]);_0x2590fa[_0x16aa('0x34')]=_[_0x16aa('0x46')](_0x5c480e['query']);_0x2590fa['filters']=_['intersection'](_0x2590fa[_0x16aa('0x36')],_0x2590fa['query']);_0x1dcc12['attributes']=_[_0x16aa('0x35')](_0x2590fa[_0x16aa('0x36')],qs[_0x16aa('0x38')](_0x5c480e['query'][_0x16aa('0x38')]));_0x1dcc12['attributes']=_0x1dcc12[_0x16aa('0x37')][_0x16aa('0x39')]?_0x1dcc12[_0x16aa('0x37')]:_0x2590fa[_0x16aa('0x36')];if(_0x5c480e['query'][_0x16aa('0x42')]){_0x1dcc12[_0x16aa('0x43')]=[{'all':!![]}];}_0x1dcc12=_[_0x16aa('0x41')]({},_0x1dcc12,_0x5c480e['options']);return db[_0x16aa('0x2f')][_0x16aa('0x47')](_0x1dcc12)[_0x16aa('0x26')](handleEntityNotFound(_0x4485b8,null))['then'](respondWithResult(_0x4485b8,null))[_0x16aa('0x45')](handleError(_0x4485b8,null));};exports[_0x16aa('0x48')]=function(_0x22625c,_0x24b728){return db[_0x16aa('0x2f')][_0x16aa('0x48')](_0x22625c[_0x16aa('0x49')],{})['then'](function(_0x530eae){var _0x82a2c3=_0x22625c[_0x16aa('0x4a')][_0x16aa('0x4b')]({'plain':!![]});if(!_0x82a2c3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x82a2c3[_0x16aa('0x4c')]===_0x16aa('0x4a')){var _0x362176=_0x530eae[_0x16aa('0x4b')]({'plain':!![]});var _0x2232a9='Reports';return db[_0x16aa('0x4d')]['find']({'where':{'name':_0x2232a9,'userProfileId':_0x82a2c3[_0x16aa('0x4e')]},'raw':!![]})[_0x16aa('0x26')](function(_0x13791d){if(_0x13791d&&_0x13791d[_0x16aa('0x4f')]===0x0){return db[_0x16aa('0x29')][_0x16aa('0x48')]({'name':_0x362176[_0x16aa('0x2b')],'resourceId':_0x362176['id'],'type':_0x16aa('0x28'),'sectionId':_0x13791d['id']},{})['then'](function(){return _0x530eae;});}else{return _0x530eae;}})[_0x16aa('0x45')](function(_0x356d5f){logger[_0x16aa('0x50')](_0x16aa('0x51'),_0x356d5f);throw _0x356d5f;});}return _0x530eae;})[_0x16aa('0x26')](respondWithResult(_0x24b728,0xc9))[_0x16aa('0x45')](handleError(_0x24b728,null));};exports['update']=function(_0x505adb,_0x27eb5f){if(_0x505adb[_0x16aa('0x49')]['id']){delete _0x505adb['body']['id'];}return db[_0x16aa('0x2f')]['find']({'where':{'id':_0x505adb[_0x16aa('0x52')]['id']}})[_0x16aa('0x26')](handleEntityNotFound(_0x27eb5f,null))[_0x16aa('0x26')](saveUpdates(_0x505adb[_0x16aa('0x49')],null))['then'](respondWithResult(_0x27eb5f,null))[_0x16aa('0x45')](handleError(_0x27eb5f,null));};exports[_0x16aa('0x27')]=function(_0xbc2553,_0x1eab03){return db['AnalyticCustomReport'][_0x16aa('0x47')]({'where':{'id':_0xbc2553['params']['id']}})[_0x16aa('0x26')](handleEntityNotFound(_0x1eab03,null))[_0x16aa('0x26')](removeEntity(_0x1eab03,null))[_0x16aa('0x45')](handleError(_0x1eab03,null));};exports[_0x16aa('0x53')]=function(_0x366b99,_0x592dfa){var _0xf27b5c=0xa;var _0x58bf07=['join',_0x16aa('0x54'),'right_join',_0x16aa('0x55')];var _0x2d8726={'SUM':_0x16aa('0x56'),'COUNT':_0x16aa('0x57'),'COUNT DISTINCT':_0x16aa('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x16aa('0x59'),'GROUP_CONCAT':_0x16aa('0x5a'),'GROUP_CONCAT ASC':_0x16aa('0x5b'),'GROUP_CONCAT DESC':_0x16aa('0x5c')};var _0x5bf947={'SEC_TO_TIME':_0x16aa('0x5d'),'DATE':_0x16aa('0x5e'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x16aa('0x5f')};var _0x4acbe7=function(_0x673a6c){return!_[_0x16aa('0x60')](['IS\x20NULL',_0x16aa('0x61'),'IS\x20EMPTY',_0x16aa('0x62')],_0x673a6c);};var _0x300b4e=function(_0x2dc3d6){if(!_0x2dc3d6||!_0x2dc3d6[_0x16aa('0x63')][_0x16aa('0x39')]){return'';}for(var _0x397083='(',_0x256e7c=0x0;_0x256e7c<_0x2dc3d6['rules'][_0x16aa('0x39')];_0x256e7c+=0x1){_0x256e7c>0x0&&(_0x397083+='\x20'+_0x2dc3d6[_0x16aa('0x64')]+'\x20');_0x397083+=_0x2dc3d6[_0x16aa('0x63')][_0x256e7c][_0x16aa('0x65')]?_0x300b4e(_0x2dc3d6[_0x16aa('0x63')][_0x256e7c][_0x16aa('0x65')]):_0x2dc3d6[_0x16aa('0x63')][_0x256e7c]['field']+'\x20'+_0x2dc3d6[_0x16aa('0x63')][_0x256e7c]['condition']+(_0x4acbe7(_0x2dc3d6[_0x16aa('0x63')][_0x256e7c][_0x16aa('0x66')])?'\x20'+_0x2dc3d6[_0x16aa('0x63')][_0x256e7c][_0x16aa('0x67')]:'');}return _0x397083+')';};var _0x14c3e6={'where':{'id':_0x366b99[_0x16aa('0x52')]['id']}},_0x3a9ba6,_0x2d3d31,_0x6d66e8,_0x1f7ae1,_0x993ef8;_0x14c3e6=_['merge']({},_0x14c3e6,_0x366b99[_0x16aa('0x68')]);return db[_0x16aa('0x2f')][_0x16aa('0x47')](_0x14c3e6)[_0x16aa('0x26')](function(_0x3828d7){if(_0x3828d7){_0x3a9ba6=_0x3828d7;return _0x3828d7[_0x16aa('0x69')]();}return null;})[_0x16aa('0x26')](function(_0x45e20b){if(_0x45e20b){if(!_0x45e20b[_0x16aa('0x39')]){throw new db['Sequelize'][(_0x16aa('0x6a'))](_0x16aa('0x6b'),0x193);}_0x2d3d31=_0x45e20b;return db[_0x16aa('0x6c')][_0x16aa('0x44')]({'raw':!![]});}return null;})[_0x16aa('0x26')](function(_0x503fe3){if(_0x503fe3){_0x6d66e8=_[_0x16aa('0x6d')](_0x503fe3,'id');var _0x1ddea5;var _0x4eb99f=squel['select']();_0x4eb99f[_0x16aa('0x6e')](_0x3a9ba6[_0x16aa('0x6f')]);for(var _0x5e508b=0x0;_0x5e508b<_0x2d3d31[_0x16aa('0x39')];_0x5e508b+=0x1){_0x1ddea5=_0x2d3d31[_0x5e508b][_0x16aa('0x70')]?_0x6d66e8[_0x2d3d31[_0x5e508b][_0x16aa('0x70')]][_0x16aa('0x71')]:_0x2d3d31[_0x5e508b][_0x16aa('0x72')];_0x1ddea5=_0x2d3d31[_0x5e508b][_0x16aa('0x73')]?_['replace'](_0x2d8726[_0x2d3d31[_0x5e508b]['function']],'%s',_0x1ddea5):_0x1ddea5;_0x1ddea5=_0x2d3d31[_0x5e508b][_0x16aa('0x74')]?_[_0x16aa('0x75')](_0x5bf947[_0x2d3d31[_0x5e508b][_0x16aa('0x74')]],'%s',_0x1ddea5):_0x1ddea5;if(_0x2d3d31[_0x5e508b]['groupBy']){_0x4eb99f[_0x16aa('0x65')](_0x1ddea5);}_0x2d3d31[_0x5e508b][_0x16aa('0x76')]&&_0x4eb99f[_0x16aa('0x77')](_0x1ddea5,_0x2d3d31[_0x5e508b][_0x16aa('0x76')]===_0x16aa('0x78')?![]:!![]);_0x4eb99f[_0x16aa('0x72')](_0x1ddea5,_0x2d3d31[_0x5e508b][_0x16aa('0x79')]||_0x1ddea5);}if(_0x3a9ba6[_0x16aa('0x7a')]){_0x3a9ba6[_0x16aa('0x7a')]=JSON[_0x16aa('0x7b')](_0x3a9ba6[_0x16aa('0x7a')]);for(var _0x1c30b4=0x0;_0x1c30b4<_0x3a9ba6['joins'][_0x16aa('0x39')];_0x1c30b4+=0x1){if(_0x3a9ba6[_0x16aa('0x7a')][_0x1c30b4][_0x16aa('0x32')]&&_['includes'](_0x58bf07,_0x3a9ba6['joins'][_0x1c30b4]['type'])&&_0x3a9ba6[_0x16aa('0x7a')][_0x1c30b4][_0x16aa('0x7c')]&&_0x3a9ba6[_0x16aa('0x7a')][_0x1c30b4]['foreignTable']&&_0x3a9ba6['joins'][_0x1c30b4][_0x16aa('0x7d')]){_0x4eb99f[_0x3a9ba6[_0x16aa('0x7a')][_0x1c30b4][_0x16aa('0x32')]](_0x3a9ba6[_0x16aa('0x7a')][_0x1c30b4][_0x16aa('0x7e')],null,util[_0x16aa('0x74')]('%s.%s\x20=\x20%s.%s',_0x3a9ba6[_0x16aa('0x6f')],_0x3a9ba6[_0x16aa('0x7a')][_0x1c30b4]['parentKey'],_0x3a9ba6[_0x16aa('0x7a')][_0x1c30b4][_0x16aa('0x7e')],_0x3a9ba6['joins'][_0x1c30b4][_0x16aa('0x7d')]));}}}if(_0x3a9ba6['conditions']){_0x3a9ba6[_0x16aa('0x7f')]=JSON['parse'](_0x3a9ba6[_0x16aa('0x7f')]);_0x4eb99f[_0x16aa('0x3d')](_0x300b4e(_0x3a9ba6[_0x16aa('0x7f')][_0x16aa('0x65')]));}_0x993ef8=_0x4eb99f[_0x16aa('0x80')]();_0x4eb99f['limit'](_0xf27b5c);_0x4eb99f['offset'](0x0);logger[_0x16aa('0x81')]('Limited\x20Query:',_0x4eb99f[_0x16aa('0x82')]());return dbH[_0x16aa('0x83')][_0x16aa('0x34')](_0x4eb99f[_0x16aa('0x82')](),{'type':dbH[_0x16aa('0x83')]['QueryTypes'][_0x16aa('0x84')]});}})['then'](respondWithResult(_0x592dfa,null))[_0x16aa('0x45')](handleError(_0x592dfa,null));};function runReport(_0x662c5d,_0xf657ec,_0x25b3d2){var _0x535edf=_0xf657ec[_0x16aa('0x2b')];var _0x41aa18=0xa;var _0x2d4c6e=[_0x16aa('0x85'),_0x16aa('0x54'),'right_join',_0x16aa('0x55')];var _0x7fced2={'SUM':'SUM(%s)','COUNT':_0x16aa('0x57'),'COUNT DISTINCT':_0x16aa('0x58'),'MAX':_0x16aa('0x86'),'MIN':_0x16aa('0x87'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x16aa('0x5a'),'GROUP_CONCAT ASC':_0x16aa('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x58b281={'SEC_TO_TIME':_0x16aa('0x5d'),'DATE':_0x16aa('0x5e'),'HOUR':_0x16aa('0x88'),'ROUND':_0x16aa('0x89'),'UNIX_TIMESTAMP':_0x16aa('0x5f')};var _0xdfdffa=function(_0x1e3f39){return!_[_0x16aa('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x16aa('0x62')],_0x1e3f39);};var _0x1d3d91=function(_0x1c1ff9){if(!_0x1c1ff9||!_0x1c1ff9[_0x16aa('0x63')][_0x16aa('0x39')]){return'';}for(var _0x4734a2='(',_0x23f3be=0x0;_0x23f3be<_0x1c1ff9['rules'][_0x16aa('0x39')];_0x23f3be+=0x1){_0x23f3be>0x0&&(_0x4734a2+='\x20'+_0x1c1ff9[_0x16aa('0x64')]+'\x20');_0x4734a2+=_0x1c1ff9[_0x16aa('0x63')][_0x23f3be][_0x16aa('0x65')]?_0x1d3d91(_0x1c1ff9[_0x16aa('0x63')][_0x23f3be]['group']):_0x1c1ff9[_0x16aa('0x63')][_0x23f3be]['field']+'\x20'+_0x1c1ff9[_0x16aa('0x63')][_0x23f3be][_0x16aa('0x66')]+(_0xdfdffa(_0x1c1ff9['rules'][_0x23f3be][_0x16aa('0x66')])?'\x20'+_0x1c1ff9[_0x16aa('0x63')][_0x23f3be][_0x16aa('0x67')]:'');}return _0x4734a2+')';};var _0xfa5333={'where':{'id':_0x662c5d['id']}},_0x31cc3e,_0x3175de,_0x5b9602,_0xe77735,_0x5d3b47;_0xfa5333=_['merge']({},_0xfa5333,_0x25b3d2);return db[_0x16aa('0x2f')][_0x16aa('0x47')](_0xfa5333)[_0x16aa('0x26')](function(_0x3cf14b){if(_0x3cf14b){_0x31cc3e=_0x3cf14b;return _0x3cf14b[_0x16aa('0x69')]();}return null;})[_0x16aa('0x26')](function(_0x28cf22){if(_0x28cf22){if(!_0x28cf22[_0x16aa('0x39')]){throw new db[(_0x16aa('0x8a'))]['ValidationErrorItem'](_0x16aa('0x6b'),0x193);}_0x3175de=_0x28cf22;return db[_0x16aa('0x6c')][_0x16aa('0x44')]({'raw':!![]});}return null;})['then'](function(_0x476329){if(_0x476329){_0x5b9602=_['keyBy'](_0x476329,'id');var _0x51364d;var _0x26c6a1=squel[_0x16aa('0x8b')]();_0x26c6a1[_0x16aa('0x6e')](_0x31cc3e[_0x16aa('0x6f')]);for(var _0x5a2563=0x0;_0x5a2563<_0x3175de[_0x16aa('0x39')];_0x5a2563+=0x1){_0x51364d=_0x3175de[_0x5a2563]['MetricId']?_0x5b9602[_0x3175de[_0x5a2563][_0x16aa('0x70')]][_0x16aa('0x71')]:_0x3175de[_0x5a2563][_0x16aa('0x72')];_0x51364d=_0x3175de[_0x5a2563]['function']?_['replace'](_0x7fced2[_0x3175de[_0x5a2563][_0x16aa('0x73')]],'%s',_0x51364d):_0x51364d;_0x51364d=_0x3175de[_0x5a2563]['format']?_['replace'](_0x58b281[_0x3175de[_0x5a2563][_0x16aa('0x74')]],'%s',_0x51364d):_0x51364d;if(_0x3175de[_0x5a2563][_0x16aa('0x8c')]){_0x26c6a1[_0x16aa('0x65')](_0x51364d);}_0x3175de[_0x5a2563][_0x16aa('0x76')]&&_0x26c6a1[_0x16aa('0x77')](_0x51364d,_0x3175de[_0x5a2563][_0x16aa('0x76')]===_0x16aa('0x78')?![]:!![]);_0x26c6a1[_0x16aa('0x72')](_0x51364d,_0x3175de[_0x5a2563][_0x16aa('0x79')]||_0x51364d);}if(_0x31cc3e[_0x16aa('0x7a')]){_0x31cc3e[_0x16aa('0x7a')]=JSON[_0x16aa('0x7b')](_0x31cc3e[_0x16aa('0x7a')]);for(var _0x598843=0x0;_0x598843<_0x31cc3e['joins'][_0x16aa('0x39')];_0x598843+=0x1){if(_0x31cc3e['joins'][_0x598843][_0x16aa('0x32')]&&_[_0x16aa('0x60')](_0x2d4c6e,_0x31cc3e[_0x16aa('0x7a')][_0x598843][_0x16aa('0x32')])&&_0x31cc3e[_0x16aa('0x7a')][_0x598843][_0x16aa('0x7c')]&&_0x31cc3e[_0x16aa('0x7a')][_0x598843][_0x16aa('0x7e')]&&_0x31cc3e[_0x16aa('0x7a')][_0x598843][_0x16aa('0x7d')]){_0x26c6a1[_0x31cc3e[_0x16aa('0x7a')][_0x598843][_0x16aa('0x32')]](_0x31cc3e[_0x16aa('0x7a')][_0x598843][_0x16aa('0x7e')],null,util[_0x16aa('0x74')](_0x16aa('0x8d'),_0x31cc3e['table'],_0x31cc3e['joins'][_0x598843]['parentKey'],_0x31cc3e[_0x16aa('0x7a')][_0x598843][_0x16aa('0x7e')],_0x31cc3e['joins'][_0x598843]['foreignKey']));}}}if(_0x31cc3e[_0x16aa('0x7f')]){_0x31cc3e[_0x16aa('0x7f')]=JSON['parse'](_0x31cc3e[_0x16aa('0x7f')]);_0x26c6a1[_0x16aa('0x3d')](_0x1d3d91(_0x31cc3e['conditions']['group']));}_0x5d3b47=_0x26c6a1[_0x16aa('0x80')]();_0x26c6a1[_0x16aa('0x1f')](_0x41aa18);_0x26c6a1[_0x16aa('0x1d')](0x0);return;}})['then'](function(){if(_0xf657ec[_0x16aa('0x8e')]===_0x16aa('0x8f')){return null;}var _0x57e53d=_[_0x16aa('0x41')](_0xf657ec,{'name':_0xf657ec[_0x16aa('0x90')]||_0xf657ec['name']||_0x31cc3e['name'],'basename':_0x535edf,'savename':util[_0x16aa('0x74')]('%s-%s.%s',_0xf657ec[_0x16aa('0x2b')]||_0x31cc3e[_0x16aa('0x2b')],require('randomstring')['generate'](0x4),_0xf657ec[_0x16aa('0x8e')]||'csv'),'reportId':_0x31cc3e['id'],'reportType':_0x16aa('0x91')});return db[_0x16aa('0x92')][_0x16aa('0x48')](_0x57e53d,{'raw':!![]});})['then'](function(_0x40db63){if(_0x31cc3e[_0x16aa('0x6f')]===_0x16aa('0x93')){_0x5d3b47['where'](_0x31cc3e[_0x16aa('0x6f')]+_0x16aa('0x94'),_0xf657ec[_0x16aa('0x95')],_0xf657ec[_0x16aa('0x96')]);}else{_0x5d3b47[_0x16aa('0x3d')](_0x31cc3e['table']+_0x16aa('0x97'),_0xf657ec[_0x16aa('0x95')],_0xf657ec[_0x16aa('0x96')]);}if(_0x40db63){logger['info'](_0x16aa('0x98'),_0x5d3b47[_0x16aa('0x82')]());require(_0x16aa('0x99'))[_0x16aa('0x9a')](path[_0x16aa('0x85')](__dirname,_0x16aa('0x9b'),_0x40db63[_0x16aa('0x8e')]),[_0x40db63['id'],_0x5d3b47[_0x16aa('0x82')](),path[_0x16aa('0x85')](__dirname,_0x16aa('0x9c'),_0x40db63[_0x16aa('0x9d')]),_0x535edf]);return _0x40db63;}else{var _0x5e394a=squel[_0x16aa('0x8b')]();_0x5e394a['from']('('+_0x5d3b47[_0x16aa('0x82')]()+')','countTable');_0x5e394a[_0x16aa('0x72')](_0x16aa('0x9e'),_0x16aa('0x20'));_0x5d3b47[_0x16aa('0x1f')](_0xf657ec[_0x16aa('0x1f')]||_0x41aa18);_0x5d3b47[_0x16aa('0x1d')](_0xf657ec[_0x16aa('0x1d')]||0x0);return dbH[_0x16aa('0x83')][_0x16aa('0x34')](_0x5e394a[_0x16aa('0x82')](),{'type':dbH[_0x16aa('0x83')][_0x16aa('0x9f')][_0x16aa('0x84')]})[_0x16aa('0x26')](function(_0x3b2e68){if(!_0x3b2e68[_0x16aa('0x39')]){_0xe77735=0x0;}else{_0xe77735=_0x3b2e68[0x0]['count']||0x0;}return dbH[_0x16aa('0x83')][_0x16aa('0x34')](_0x5d3b47[_0x16aa('0x82')](),{'type':dbH[_0x16aa('0x83')][_0x16aa('0x9f')][_0x16aa('0x84')]});})['then'](function(_0x125f97){return{'rows':_0x125f97||[],'count':_0xe77735};});}});}exports[_0x16aa('0xa0')]=function(_0x1421c4,_0x31f2d6){return runReport(_0x1421c4['params'],_0x1421c4['query'],_0x1421c4['options'])['then'](respondWithResult(_0x31f2d6,null))[_0x16aa('0x45')](handleError(_0x31f2d6,null));};exports[_0x16aa('0xa1')]=runReport;exports[_0x16aa('0x34')]=function(_0x191261,_0x4a0d7a){var _0x4e128e=0xa;var _0x5f4f0b=[_0x16aa('0x85'),_0x16aa('0x54'),_0x16aa('0xa2'),_0x16aa('0x55')];var _0x209280={'SUM':_0x16aa('0x56'),'COUNT':_0x16aa('0x57'),'COUNT DISTINCT':_0x16aa('0x58'),'MAX':_0x16aa('0x86'),'MIN':'MIN(%s)','AVG':_0x16aa('0x59'),'GROUP_CONCAT':_0x16aa('0x5a'),'GROUP_CONCAT ASC':_0x16aa('0x5b'),'GROUP_CONCAT DESC':_0x16aa('0x5c')};var _0x81bef7={'SEC_TO_TIME':_0x16aa('0x5d'),'DATE':'DATE(%s)','HOUR':_0x16aa('0x88'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x16aa('0x5f')};var _0x550e8a=function(_0x464fc9){return!_[_0x16aa('0x60')](['IS\x20NULL',_0x16aa('0x61'),_0x16aa('0xa3'),_0x16aa('0x62')],_0x464fc9);};var _0x512608=function(_0x13c8f4){if(!_0x13c8f4||!_0x13c8f4[_0x16aa('0x63')][_0x16aa('0x39')]){return'';}for(var _0x40e6c9='(',_0x48c7c5=0x0;_0x48c7c5<_0x13c8f4[_0x16aa('0x63')][_0x16aa('0x39')];_0x48c7c5+=0x1){_0x48c7c5>0x0&&(_0x40e6c9+='\x20'+_0x13c8f4['operator']+'\x20');_0x40e6c9+=_0x13c8f4['rules'][_0x48c7c5][_0x16aa('0x65')]?_0x512608(_0x13c8f4[_0x16aa('0x63')][_0x48c7c5][_0x16aa('0x65')]):_0x13c8f4[_0x16aa('0x63')][_0x48c7c5]['field']+'\x20'+_0x13c8f4[_0x16aa('0x63')][_0x48c7c5][_0x16aa('0x66')]+(_0x550e8a(_0x13c8f4['rules'][_0x48c7c5][_0x16aa('0x66')])?'\x20'+_0x13c8f4[_0x16aa('0x63')][_0x48c7c5][_0x16aa('0x67')]:'');}return _0x40e6c9+')';};var _0x5dfb69={'where':{'id':_0x191261[_0x16aa('0x52')]['id']}},_0x22ce77,_0x327b40,_0x31aa85,_0x3d2ac4,_0x52b8d9;_0x5dfb69=_[_0x16aa('0x41')]({},_0x5dfb69,_0x191261['options']);return db[_0x16aa('0x2f')][_0x16aa('0x47')](_0x5dfb69)[_0x16aa('0x26')](function(_0x805e59){if(_0x805e59){_0x22ce77=_0x805e59;return _0x805e59[_0x16aa('0x69')]();}return null;})[_0x16aa('0x26')](function(_0x537eb1){if(_0x537eb1){if(!_0x537eb1[_0x16aa('0x39')]){throw new db[(_0x16aa('0x8a'))]['ValidationErrorItem'](_0x16aa('0x6b'),0x193);}_0x327b40=_0x537eb1;return db['AnalyticMetric'][_0x16aa('0x44')]({'raw':!![]});}return null;})['then'](function(_0x5959e0){if(_0x5959e0){_0x31aa85=_['keyBy'](_0x5959e0,'id');var _0x1b0e12;var _0x1b174e=squel['select']();_0x1b174e[_0x16aa('0x6e')](_0x22ce77[_0x16aa('0x6f')]);for(var _0x4f1ecb=0x0;_0x4f1ecb<_0x327b40[_0x16aa('0x39')];_0x4f1ecb+=0x1){_0x1b0e12=_0x327b40[_0x4f1ecb]['MetricId']?_0x31aa85[_0x327b40[_0x4f1ecb][_0x16aa('0x70')]][_0x16aa('0x71')]:_0x327b40[_0x4f1ecb][_0x16aa('0x72')];_0x1b0e12=_0x327b40[_0x4f1ecb][_0x16aa('0x73')]?_[_0x16aa('0x75')](_0x209280[_0x327b40[_0x4f1ecb]['function']],'%s',_0x1b0e12):_0x1b0e12;_0x1b0e12=_0x327b40[_0x4f1ecb][_0x16aa('0x74')]?_[_0x16aa('0x75')](_0x81bef7[_0x327b40[_0x4f1ecb]['format']],'%s',_0x1b0e12):_0x1b0e12;if(_0x327b40[_0x4f1ecb][_0x16aa('0x8c')]){_0x1b174e[_0x16aa('0x65')](_0x1b0e12);}_0x327b40[_0x4f1ecb][_0x16aa('0x76')]&&_0x1b174e['order'](_0x1b0e12,_0x327b40[_0x4f1ecb][_0x16aa('0x76')]===_0x16aa('0x78')?![]:!![]);_0x1b174e[_0x16aa('0x72')](_0x1b0e12,_0x327b40[_0x4f1ecb][_0x16aa('0x79')]||_0x1b0e12);}if(_0x22ce77[_0x16aa('0x7a')]){_0x22ce77[_0x16aa('0x7a')]=JSON[_0x16aa('0x7b')](_0x22ce77[_0x16aa('0x7a')]);for(var _0x249573=0x0;_0x249573<_0x22ce77[_0x16aa('0x7a')]['length'];_0x249573+=0x1){if(_0x22ce77[_0x16aa('0x7a')][_0x249573][_0x16aa('0x32')]&&_[_0x16aa('0x60')](_0x5f4f0b,_0x22ce77[_0x16aa('0x7a')][_0x249573][_0x16aa('0x32')])&&_0x22ce77[_0x16aa('0x7a')][_0x249573][_0x16aa('0x7c')]&&_0x22ce77[_0x16aa('0x7a')][_0x249573][_0x16aa('0x7e')]&&_0x22ce77['joins'][_0x249573][_0x16aa('0x7d')]){_0x1b174e[_0x22ce77[_0x16aa('0x7a')][_0x249573]['type']](_0x22ce77[_0x16aa('0x7a')][_0x249573][_0x16aa('0x7e')],null,util[_0x16aa('0x74')](_0x16aa('0x8d'),_0x22ce77[_0x16aa('0x6f')],_0x22ce77[_0x16aa('0x7a')][_0x249573][_0x16aa('0x7c')],_0x22ce77['joins'][_0x249573][_0x16aa('0x7e')],_0x22ce77[_0x16aa('0x7a')][_0x249573][_0x16aa('0x7d')]));}}}if(_0x22ce77[_0x16aa('0x7f')]){_0x22ce77[_0x16aa('0x7f')]=JSON[_0x16aa('0x7b')](_0x22ce77['conditions']);_0x1b174e[_0x16aa('0x3d')](_0x512608(_0x22ce77['conditions']['group']));}_0x52b8d9=_0x1b174e[_0x16aa('0x80')]();_0x1b174e[_0x16aa('0x1f')](_0x4e128e);_0x1b174e[_0x16aa('0x1d')](0x0);logger['debug'](_0x16aa('0xa4'),_0x1b174e['toString']());return dbH['sequelize']['query'](_0x1b174e[_0x16aa('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0x16aa('0x84')]});}})[_0x16aa('0x26')](function(){return{'sql':_0x52b8d9['toString']()};})[_0x16aa('0x26')](respondWithResult(_0x4a0d7a,null))['catch'](handleError(_0x4a0d7a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 458d590..700d9cf 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 _0xe6ee=['../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','../../config/logger','api','request-promise'];(function(_0x169fcd,_0x421ad8){var _0x38e1b3=function(_0x392f91){while(--_0x392f91){_0x169fcd['push'](_0x169fcd['shift']());}};_0x38e1b3(++_0x421ad8);}(_0xe6ee,0x8c));var _0xee6e=function(_0x3152a2,_0x79816c){_0x3152a2=_0x3152a2-0x0;var _0x169e23=_0xe6ee[_0x3152a2];return _0x169e23;};'use strict';var _=require(_0xee6e('0x0'));var util=require('util');var logger=require(_0xee6e('0x1'))(_0xee6e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee6e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee6e('0x4'));var attributes=require(_0xee6e('0x5'));module[_0xee6e('0x6')]=function(_0x348ee5,_0x389527){return _0x348ee5[_0xee6e('0x7')](_0xee6e('0x8'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec36=['./analyticCustomReport.attributes','define','AnalyticCustomReport','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x173f6a,_0x2ddc18){var _0x29ae30=function(_0x598c40){while(--_0x598c40){_0x173f6a['push'](_0x173f6a['shift']());}};_0x29ae30(++_0x2ddc18);}(_0xec36,0xbe));var _0x6ec3=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xec36[_0x15ea09];return _0x3e9c78;};'use strict';var _=require(_0x6ec3('0x0'));var util=require(_0x6ec3('0x1'));var logger=require('../../config/logger')(_0x6ec3('0x2'));var moment=require(_0x6ec3('0x3'));var BPromise=require(_0x6ec3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ec3('0x5'));var rimraf=require(_0x6ec3('0x6'));var config=require(_0x6ec3('0x7'));var attributes=require(_0x6ec3('0x8'));module['exports']=function(_0x1bc03b,_0x228c77){return _0x1bc03b[_0x6ec3('0x9')](_0x6ec3('0xa'),attributes,{'tableName':'analytics_custom_reports','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 c6823d9..18b136c 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 _0xeace=['code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dcfeb,_0x25c8a2){var _0x3827d0=function(_0x5637ba){while(--_0x5637ba){_0x3dcfeb['push'](_0x3dcfeb['shift']());}};_0x3827d0(++_0x25c8a2);}(_0xeace,0x123));var _0xeeac=function(_0x49a3ea,_0x575ad0){_0x49a3ea=_0x49a3ea-0x0;var _0x36be5e=_0xeace[_0x49a3ea];return _0x36be5e;};'use strict';var _=require(_0xeeac('0x0'));var util=require(_0xeeac('0x1'));var moment=require(_0xeeac('0x2'));var BPromise=require(_0xeeac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeac('0x4'));var db=require(_0xeeac('0x5'))['db'];var utils=require(_0xeeac('0x6'));var logger=require('../../config/logger')(_0xeeac('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54621a,_0x486ff1,_0x28cc45){return new BPromise(function(_0x44651e,_0x1bb891){return client[_0xeeac('0x8')](_0x54621a,_0x28cc45)[_0xeeac('0x9')](function(_0x5c0c63){logger[_0xeeac('0xa')](_0xeeac('0xb'),_0x486ff1,_0xeeac('0xc'));logger['debug'](_0xeeac('0xd'),_0x486ff1,_0xeeac('0xc'),JSON['stringify'](_0x5c0c63));if(_0x5c0c63['error']){if(_0x5c0c63[_0xeeac('0xe')][_0xeeac('0xf')]===0x1f4){logger[_0xeeac('0xe')](_0xeeac('0xb'),_0x486ff1,_0x5c0c63[_0xeeac('0xe')]['message']);return _0x1bb891(_0x5c0c63[_0xeeac('0xe')][_0xeeac('0x10')]);}logger[_0xeeac('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x486ff1,_0x5c0c63['error'][_0xeeac('0x10')]);return _0x44651e(_0x5c0c63[_0xeeac('0xe')]['message']);}else{logger[_0xeeac('0xa')](_0xeeac('0xb'),_0x486ff1,'request\x20sent');_0x44651e(_0x5c0c63[_0xeeac('0x11')][_0xeeac('0x10')]);}})['catch'](function(_0xf00418){logger[_0xeeac('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x486ff1,_0xf00418);_0x1bb891(_0xf00418);});});} \ No newline at end of file +var _0x33b2=['jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x33b2,0xf9));var _0x233b=function(_0x5a5365,_0x4a3c7f){_0x5a5365=_0x5a5365-0x0;var _0x2b1919=_0x33b2[_0x5a5365];return _0x2b1919;};'use strict';var _=require(_0x233b('0x0'));var util=require(_0x233b('0x1'));var moment=require(_0x233b('0x2'));var BPromise=require(_0x233b('0x3'));var rs=require(_0x233b('0x4'));var fs=require('fs');var Redis=require(_0x233b('0x5'));var db=require(_0x233b('0x6'))['db'];var utils=require(_0x233b('0x7'));var logger=require(_0x233b('0x8'))(_0x233b('0x9'));var config=require(_0x233b('0xa'));var jayson=require(_0x233b('0xb'));var client=jayson[_0x233b('0xc')][_0x233b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1bd51d,_0x40f2a8,_0x524942){return new BPromise(function(_0x4d858b,_0x2d1fcf){return client['request'](_0x1bd51d,_0x524942)[_0x233b('0xe')](function(_0x479c61){logger[_0x233b('0xf')](_0x233b('0x10'),_0x40f2a8,_0x233b('0x11'));logger[_0x233b('0x12')](_0x233b('0x13'),_0x40f2a8,_0x233b('0x11'),JSON[_0x233b('0x14')](_0x479c61));if(_0x479c61[_0x233b('0x15')]){if(_0x479c61['error'][_0x233b('0x16')]===0x1f4){logger[_0x233b('0x15')](_0x233b('0x10'),_0x40f2a8,_0x479c61[_0x233b('0x15')][_0x233b('0x17')]);return _0x2d1fcf(_0x479c61[_0x233b('0x15')][_0x233b('0x17')]);}logger[_0x233b('0x15')](_0x233b('0x10'),_0x40f2a8,_0x479c61[_0x233b('0x15')][_0x233b('0x17')]);return _0x4d858b(_0x479c61[_0x233b('0x15')][_0x233b('0x17')]);}else{logger[_0x233b('0xf')](_0x233b('0x10'),_0x40f2a8,_0x233b('0x11'));_0x4d858b(_0x479c61[_0x233b('0x18')]['message']);}})[_0x233b('0x19')](function(_0x175bdd){logger[_0x233b('0x15')](_0x233b('0x10'),_0x40f2a8,_0x175bdd);_0x2d1fcf(_0x175bdd);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9397d71..7e20764 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 _0xebdb=['show','preview','/:id/run','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xebdb,0x16e));var _0xbebd=function(_0x39d1dc,_0x1dc490){_0x39d1dc=_0x39d1dc-0x0;var _0xaaaafa=_0xebdb[_0x39d1dc];return _0xaaaafa;};'use strict';var multer=require(_0xbebd('0x0'));var util=require('util');var path=require(_0xbebd('0x1'));var timeout=require(_0xbebd('0x2'));var express=require(_0xbebd('0x3'));var router=express[_0xbebd('0x4')]();var fs_extra=require(_0xbebd('0x5'));var auth=require(_0xbebd('0x6'));var interaction=require(_0xbebd('0x7'));var config=require('../../config/environment');var controller=require(_0xbebd('0x8'));router[_0xbebd('0x9')]('/',auth[_0xbebd('0xa')](),controller[_0xbebd('0xb')]);router[_0xbebd('0x9')]('/:id',auth[_0xbebd('0xa')](),controller[_0xbebd('0xc')]);router[_0xbebd('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xbebd('0xd')]);router[_0xbebd('0x9')](_0xbebd('0xe'),auth[_0xbebd('0xa')](),controller['run']);router[_0xbebd('0x9')]('/:id/query',auth[_0xbebd('0xa')](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbebd('0xf')](_0xbebd('0x10'),auth[_0xbebd('0xa')](),controller[_0xbebd('0x11')]);router[_0xbebd('0x12')]('/:id',auth[_0xbebd('0xa')](),controller[_0xbebd('0x13')]);module[_0xbebd('0x14')]=router; \ No newline at end of file +var _0x1b9e=['show','/:id/preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','isAuthenticated','index','get','/:id'];(function(_0xaa5d82,_0xef3d68){var _0x191e26=function(_0x38772c){while(--_0x38772c){_0xaa5d82['push'](_0xaa5d82['shift']());}};_0x191e26(++_0xef3d68);}(_0x1b9e,0x1c4));var _0xe1b9=function(_0x8e8abb,_0x4ccb05){_0x8e8abb=_0x8e8abb-0x0;var _0x9dfe92=_0x1b9e[_0x8e8abb];return _0x9dfe92;};'use strict';var multer=require('multer');var util=require(_0xe1b9('0x0'));var path=require('path');var timeout=require(_0xe1b9('0x1'));var express=require(_0xe1b9('0x2'));var router=express[_0xe1b9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xe1b9('0x4')](),controller[_0xe1b9('0x5')]);router[_0xe1b9('0x6')](_0xe1b9('0x7'),auth[_0xe1b9('0x4')](),controller[_0xe1b9('0x8')]);router[_0xe1b9('0x6')](_0xe1b9('0x9'),auth['isAuthenticated'](),controller['preview']);router[_0xe1b9('0x6')](_0xe1b9('0xa'),auth[_0xe1b9('0x4')](),controller[_0xe1b9('0xb')]);router[_0xe1b9('0x6')](_0xe1b9('0xc'),auth['isAuthenticated'](),controller['query']);router[_0xe1b9('0xd')]('/',auth['isAuthenticated'](),controller[_0xe1b9('0xe')]);router[_0xe1b9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe1b9('0x10')]);router[_0xe1b9('0x11')](_0xe1b9('0x7'),auth['isAuthenticated'](),controller[_0xe1b9('0x12')]);module[_0xe1b9('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 27ec420..e36db95 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 _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x7f03ae,_0x38b1aa){var _0x538b5e=function(_0x2c69b9){while(--_0x2c69b9){_0x7f03ae['push'](_0x7f03ae['shift']());}};_0x538b5e(++_0x38b1aa);}(_0xe14b,0x93));var _0xbe14=function(_0x319b5b,_0x5f2557){_0x319b5b=_0x319b5b-0x0;var _0x7e5198=_0xe14b[_0x319b5b];return _0x7e5198;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file +var _0x5d17=['sequelize','exports','STRING','TEXT'];(function(_0xf8d2c5,_0x5daed5){var _0x407c3f=function(_0x333556){while(--_0x333556){_0xf8d2c5['push'](_0xf8d2c5['shift']());}};_0x407c3f(++_0x5daed5);}(_0x5d17,0x114));var _0x75d1=function(_0x32b312,_0x4e3f0f){_0x32b312=_0x32b312-0x0;var _0x313368=_0x5d17[_0x32b312];return _0x313368;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x75d1('0x2')]},'table':{'type':Sequelize[_0x75d1('0x2')]},'conditions':{'type':Sequelize[_0x75d1('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 934443c..3324b7d 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 _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x4c1c26,_0xffeca){var _0x44969b=function(_0x515ebd){while(--_0x515ebd){_0x4c1c26['push'](_0x4c1c26['shift']());}};_0x44969b(++_0xffeca);}(_0x4975,0x86));var _0x5497=function(_0x3f1086,_0x1f798c){_0x3f1086=_0x3f1086-0x0;var _0x59792f=_0x4975[_0x3f1086];return _0x59792f;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file +var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x26638c,_0x3188d1){var _0x1546bb=function(_0x375b76){while(--_0x375b76){_0x26638c['push'](_0x26638c['shift']());}};_0x1546bb(++_0x3188d1);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5a83c97..fcf823c 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 _0x4812=['rimraf','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','../../config/logger','api','moment'];(function(_0x27663f,_0x1f04e8){var _0xb0d3e0=function(_0x28a80c){while(--_0x28a80c){_0x27663f['push'](_0x27663f['shift']());}};_0xb0d3e0(++_0x1f04e8);}(_0x4812,0xd4));var _0x2481=function(_0x4f4c39,_0x4340c7){_0x4f4c39=_0x4f4c39-0x0;var _0x5cd7bb=_0x4812[_0x4f4c39];return _0x5cd7bb;};'use strict';var _=require(_0x2481('0x0'));var util=require('util');var logger=require(_0x2481('0x1'))(_0x2481('0x2'));var moment=require(_0x2481('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2481('0x4'));var config=require('../../config/environment');var attributes=require(_0x2481('0x5'));module[_0x2481('0x6')]=function(_0x2c6138,_0x3cd28e){return _0x2c6138[_0x2481('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0x2481('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6196=['./analyticDefaultReport.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4702d7,_0xa6908e){var _0x1433a3=function(_0x2b7e94){while(--_0x2b7e94){_0x4702d7['push'](_0x4702d7['shift']());}};_0x1433a3(++_0xa6908e);}(_0x6196,0xc9));var _0x6619=function(_0x44337,_0x490928){_0x44337=_0x44337-0x0;var _0x360e9f=_0x6196[_0x44337];return _0x360e9f;};'use strict';var _=require('lodash');var util=require(_0x6619('0x0'));var logger=require(_0x6619('0x1'))(_0x6619('0x2'));var moment=require('moment');var BPromise=require(_0x6619('0x3'));var rp=require(_0x6619('0x4'));var fs=require('fs');var path=require(_0x6619('0x5'));var rimraf=require(_0x6619('0x6'));var config=require(_0x6619('0x7'));var attributes=require(_0x6619('0x8'));module[_0x6619('0x9')]=function(_0x156662,_0x1ab21a){return _0x156662[_0x6619('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','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 c7b2ec7..1def249 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 _0x5dd4=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x28be07,_0x5add82){var _0x583c6a=function(_0x5040a5){while(--_0x5040a5){_0x28be07['push'](_0x28be07['shift']());}};_0x583c6a(++_0x5add82);}(_0x5dd4,0x66));var _0x45dd=function(_0x331dc2,_0x310a33){_0x331dc2=_0x331dc2-0x0;var _0x27d4c8=_0x5dd4[_0x331dc2];return _0x27d4c8;};'use strict';var _=require(_0x45dd('0x0'));var util=require('util');var moment=require(_0x45dd('0x1'));var BPromise=require(_0x45dd('0x2'));var rs=require(_0x45dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45dd('0x4'))['db'];var utils=require(_0x45dd('0x5'));var logger=require('../../config/logger')(_0x45dd('0x6'));var config=require(_0x45dd('0x7'));var jayson=require(_0x45dd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x435dd8,_0x375558,_0xf33777){return new BPromise(function(_0x1c5681,_0x4353b9){return client[_0x45dd('0x9')](_0x435dd8,_0xf33777)[_0x45dd('0xa')](function(_0x51b9b3){logger[_0x45dd('0xb')](_0x45dd('0xc'),_0x375558,_0x45dd('0xd'));logger['debug'](_0x45dd('0xe'),_0x375558,_0x45dd('0xd'),JSON[_0x45dd('0xf')](_0x51b9b3));if(_0x51b9b3[_0x45dd('0x10')]){if(_0x51b9b3['error']['code']===0x1f4){logger['error'](_0x45dd('0xc'),_0x375558,_0x51b9b3['error'][_0x45dd('0x11')]);return _0x4353b9(_0x51b9b3[_0x45dd('0x10')][_0x45dd('0x11')]);}logger[_0x45dd('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x375558,_0x51b9b3[_0x45dd('0x10')][_0x45dd('0x11')]);return _0x1c5681(_0x51b9b3[_0x45dd('0x10')][_0x45dd('0x11')]);}else{logger[_0x45dd('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x375558,'request\x20sent');_0x1c5681(_0x51b9b3[_0x45dd('0x12')][_0x45dd('0x11')]);}})[_0x45dd('0x13')](function(_0x521458){logger[_0x45dd('0x10')](_0x45dd('0xc'),_0x375558,_0x521458);_0x4353b9(_0x521458);});});} \ No newline at end of file +var _0x49fd=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3a186d,_0x329748){var _0x2abd02=function(_0x38a1d6){while(--_0x38a1d6){_0x3a186d['push'](_0x3a186d['shift']());}};_0x2abd02(++_0x329748);}(_0x49fd,0x1a5));var _0xd49f=function(_0x1a829e,_0x25602f){_0x1a829e=_0x1a829e-0x0;var _0x11177b=_0x49fd[_0x1a829e];return _0x11177b;};'use strict';var _=require(_0xd49f('0x0'));var util=require(_0xd49f('0x1'));var moment=require(_0xd49f('0x2'));var BPromise=require(_0xd49f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd49f('0x4'));var db=require(_0xd49f('0x5'))['db'];var utils=require(_0xd49f('0x6'));var logger=require('../../config/logger')(_0xd49f('0x7'));var config=require('../../config/environment');var jayson=require(_0xd49f('0x8'));var client=jayson[_0xd49f('0x9')][_0xd49f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a51a7,_0x11725b,_0x7d6d0f){return new BPromise(function(_0x140273,_0x13ea7a){return client[_0xd49f('0xb')](_0x3a51a7,_0x7d6d0f)[_0xd49f('0xc')](function(_0x303e02){logger[_0xd49f('0xd')](_0xd49f('0xe'),_0x11725b,_0xd49f('0xf'));logger['debug'](_0xd49f('0x10'),_0x11725b,_0xd49f('0xf'),JSON['stringify'](_0x303e02));if(_0x303e02[_0xd49f('0x11')]){if(_0x303e02[_0xd49f('0x11')][_0xd49f('0x12')]===0x1f4){logger[_0xd49f('0x11')](_0xd49f('0xe'),_0x11725b,_0x303e02['error'][_0xd49f('0x13')]);return _0x13ea7a(_0x303e02[_0xd49f('0x11')][_0xd49f('0x13')]);}logger['error'](_0xd49f('0xe'),_0x11725b,_0x303e02[_0xd49f('0x11')][_0xd49f('0x13')]);return _0x140273(_0x303e02[_0xd49f('0x11')]['message']);}else{logger[_0xd49f('0xd')](_0xd49f('0xe'),_0x11725b,'request\x20sent');_0x140273(_0x303e02[_0xd49f('0x14')]['message']);}})[_0xd49f('0x15')](function(_0x57428a){logger[_0xd49f('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x11725b,_0x57428a);_0x13ea7a(_0x57428a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9be67ac..42fbe17 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 _0xe45e=['run','/:id/query','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','index','isAuthenticated','show','preview'];(function(_0x196257,_0x256195){var _0x30d5c7=function(_0x100531){while(--_0x100531){_0x196257['push'](_0x196257['shift']());}};_0x30d5c7(++_0x256195);}(_0xe45e,0x1c0));var _0xee45=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0xe45e[_0x471448];return _0x38190b;};'use strict';var multer=require(_0xee45('0x0'));var util=require(_0xee45('0x1'));var path=require(_0xee45('0x2'));var timeout=require(_0xee45('0x3'));var express=require('express');var router=express[_0xee45('0x4')]();var fs_extra=require(_0xee45('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee45('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0xee45('0x7')]('/',auth['isAuthenticated'](),controller[_0xee45('0x8')]);router[_0xee45('0x7')]('/:id',auth[_0xee45('0x9')](),controller[_0xee45('0xa')]);router['get']('/:id/preview',auth[_0xee45('0x9')](),controller[_0xee45('0xb')]);router[_0xee45('0x7')]('/:id/run',auth[_0xee45('0x9')](),controller[_0xee45('0xc')]);router[_0xee45('0x7')](_0xee45('0xd'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0xee45('0x9')](),controller[_0xee45('0xe')]);router[_0xee45('0xf')](_0xee45('0x10'),auth[_0xee45('0x9')](),controller['update']);router[_0xee45('0x11')](_0xee45('0x10'),auth[_0xee45('0x9')](),controller[_0xee45('0x12')]);module[_0xee45('0x13')]=router; \ No newline at end of file +var _0xc066=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','index','get','/:id/preview','preview','/:id/run','run','isAuthenticated','query','post','create','/:id','update','exports','util','path','connect-timeout'];(function(_0x5dc22d,_0x2389d7){var _0x1fa851=function(_0x53d50d){while(--_0x53d50d){_0x5dc22d['push'](_0x5dc22d['shift']());}};_0x1fa851(++_0x2389d7);}(_0xc066,0x19f));var _0x6c06=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc066[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0x6c06('0x0'));var path=require(_0x6c06('0x1'));var timeout=require(_0x6c06('0x2'));var express=require(_0x6c06('0x3'));var router=express[_0x6c06('0x4')]();var fs_extra=require(_0x6c06('0x5'));var auth=require(_0x6c06('0x6'));var interaction=require(_0x6c06('0x7'));var config=require('../../config/environment');var controller=require(_0x6c06('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6c06('0x9')]);router[_0x6c06('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6c06('0xa')](_0x6c06('0xb'),auth['isAuthenticated'](),controller[_0x6c06('0xc')]);router[_0x6c06('0xa')](_0x6c06('0xd'),auth['isAuthenticated'](),controller[_0x6c06('0xe')]);router[_0x6c06('0xa')]('/:id/query',auth[_0x6c06('0xf')](),controller[_0x6c06('0x10')]);router[_0x6c06('0x11')]('/',auth[_0x6c06('0xf')](),controller[_0x6c06('0x12')]);router['put'](_0x6c06('0x13'),auth[_0x6c06('0xf')](),controller[_0x6c06('0x14')]);router['delete']('/:id',auth[_0x6c06('0xf')](),controller['destroy']);module[_0x6c06('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 917e9c7..4cb861a 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 _0xafea=['Loading','manual','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','xlsx'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0xafea,0x14e));var _0xaafe=function(_0x2db2c3,_0x2bad83){_0x2db2c3=_0x2db2c3-0x0;var _0x5c1c29=_0xafea[_0x2db2c3];return _0x5c1c29;};'use strict';var Sequelize=require(_0xaafe('0x0'));var moment=require(_0xaafe('0x1'));module['exports']={'name':{'type':Sequelize[_0xaafe('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xaafe('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xaafe('0x3')](_0xaafe('0x4'),'pdf',_0xaafe('0x5')),'allowNull':![],'defaultValue':_0xaafe('0x4')},'savename':{'type':Sequelize[_0xaafe('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xaafe('0x2')],'defaultValue':_0xaafe('0x6')},'type':{'type':Sequelize[_0xaafe('0x3')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xaafe('0x7')},'reportId':{'type':Sequelize[_0xaafe('0x8')](0xb)[_0xaafe('0x9')]},'reportType':{'type':Sequelize[_0xaafe('0x2')]}}; \ No newline at end of file +var _0xc7f7=['csv','DATE','Loading','manual','INTEGER','sequelize','moment','STRING','ENUM','xlsx'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xc7f7,0x9b));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7c7f('0x0'));var moment=require(_0x7c7f('0x1'));module['exports']={'name':{'type':Sequelize[_0x7c7f('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x7c7f('0x3')]('csv','pdf',_0x7c7f('0x4')),'allowNull':![],'defaultValue':_0x7c7f('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x7c7f('0x6')]},'status':{'type':Sequelize[_0x7c7f('0x2')],'defaultValue':_0x7c7f('0x7')},'type':{'type':Sequelize[_0x7c7f('0x3')](_0x7c7f('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x7c7f('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index b350554..cc10165 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 _0x9237=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','output','join','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','error','stack','name','send','AnalyticExtractedReport','fieldName','type','map','query','keys','filters','intersection','model'];(function(_0xdd7126,_0xf0bc57){var _0x50ee37=function(_0x6b85fb){while(--_0x6b85fb){_0xdd7126['push'](_0xdd7126['shift']());}};_0x50ee37(++_0xf0bc57);}(_0x9237,0x1a0));var _0x7923=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x9237[_0x5bc5fe];return _0x298ea7;};'use strict';var emlformat=require(_0x7923('0x0'));var rimraf=require(_0x7923('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7923('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7923('0x3'));var Mustache=require(_0x7923('0x4'));var util=require(_0x7923('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7923('0x6'));var ejs=require(_0x7923('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7923('0x8'));var squel=require(_0x7923('0x9'));var crypto=require(_0x7923('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7923('0xb'));var Redis=require(_0x7923('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7923('0xd'));var as=require(_0x7923('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7923('0xf'));var utils=require(_0x7923('0x10'));var config=require(_0x7923('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x7923('0x12'))['db'];function respondWithStatusCode(_0x20c946,_0x5a2175){_0x5a2175=_0x5a2175||0xcc;return function(_0xee510e){if(_0xee510e){return _0x20c946[_0x7923('0x13')](_0x5a2175);}return _0x20c946[_0x7923('0x14')](_0x5a2175)[_0x7923('0x15')]();};}function respondWithResult(_0x5b5e51,_0x451e07){_0x451e07=_0x451e07||0xc8;return function(_0x5eca16){if(_0x5eca16){return _0x5b5e51[_0x7923('0x14')](_0x451e07)[_0x7923('0x16')](_0x5eca16);}};}function respondWithFilteredResult(_0x1e3a68,_0x255da7){return function(_0x24dc2f){if(_0x24dc2f){var _0x1eb5b3=typeof _0x255da7[_0x7923('0x17')]===_0x7923('0x18')&&typeof _0x255da7[_0x7923('0x19')]===_0x7923('0x18');var _0x2d803d=_0x24dc2f['count'];var _0x42fa6f=_0x1eb5b3?0x0:_0x255da7['offset'];var _0x3dd08c=_0x1eb5b3?_0x24dc2f[_0x7923('0x1a')]:_0x255da7[_0x7923('0x17')]+_0x255da7[_0x7923('0x19')];var _0x104e45;if(_0x3dd08c>=_0x2d803d){_0x3dd08c=_0x2d803d;_0x104e45=0xc8;}else{_0x104e45=0xce;}_0x1e3a68[_0x7923('0x14')](_0x104e45);return _0x1e3a68[_0x7923('0x1b')](_0x7923('0x1c'),_0x42fa6f+'-'+_0x3dd08c+'/'+_0x2d803d)['json'](_0x24dc2f);}return null;};}function patchUpdates(_0x5b567f){return function(_0x338998){try{jsonpatch[_0x7923('0x1d')](_0x338998,_0x5b567f,!![]);}catch(_0x486317){return BPromise['reject'](_0x486317);}return _0x338998[_0x7923('0x1e')]();};}function saveUpdates(_0x493acb,_0x357c18){return function(_0x44e337){if(_0x44e337){return _0x44e337[_0x7923('0x1f')](_0x493acb)[_0x7923('0x20')](function(_0x2d2fbd){return _0x2d2fbd;});}return null;};}function removeEntity(_0x22c4e4,_0x5537d6){return function(_0x4698c0){if(_0x4698c0){return _0x4698c0[_0x7923('0x21')]()['then'](function(){var _0x3fac7d=_0x4698c0[_0x7923('0x22')]({'plain':!![]});var _0xe007c9=_0x7923('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0xe007c9,'resourceId':_0x3fac7d['id']}})[_0x7923('0x20')](function(){return _0x4698c0;});})[_0x7923('0x20')](function(){_0x22c4e4[_0x7923('0x14')](0xcc)[_0x7923('0x15')]();});}};}function handleEntityNotFound(_0x2ee865,_0x30f88f){return function(_0x1570b2){if(!_0x1570b2){_0x2ee865['sendStatus'](0x194);}return _0x1570b2;};}function handleError(_0x4e5a97,_0x50433b){_0x50433b=_0x50433b||0x1f4;return function(_0x56ba05){logger[_0x7923('0x24')](_0x56ba05[_0x7923('0x25')]);if(_0x56ba05[_0x7923('0x26')]){delete _0x56ba05[_0x7923('0x26')];}_0x4e5a97[_0x7923('0x14')](_0x50433b)[_0x7923('0x27')](_0x56ba05);};}exports['index']=function(_0x22396c,_0x4024da){var _0x5a885a={},_0x5dc72a={},_0x52240d={'count':0x0,'rows':[]};var _0x54f0ef=_['map'](db[_0x7923('0x28')]['rawAttributes'],function(_0x10f7cf){return{'name':_0x10f7cf[_0x7923('0x29')],'type':_0x10f7cf[_0x7923('0x2a')]['key']};});_0x5dc72a['model']=_[_0x7923('0x2b')](_0x54f0ef,_0x7923('0x26'));_0x5dc72a[_0x7923('0x2c')]=_[_0x7923('0x2d')](_0x22396c['query']);_0x5dc72a[_0x7923('0x2e')]=_[_0x7923('0x2f')](_0x5dc72a[_0x7923('0x30')],_0x5dc72a[_0x7923('0x2c')]);_0x5a885a[_0x7923('0x31')]=_[_0x7923('0x2f')](_0x5dc72a['model'],qs[_0x7923('0x32')](_0x22396c[_0x7923('0x2c')][_0x7923('0x32')]));_0x5a885a[_0x7923('0x31')]=_0x5a885a['attributes'][_0x7923('0x33')]?_0x5a885a[_0x7923('0x31')]:_0x5dc72a[_0x7923('0x30')];if(!_0x22396c[_0x7923('0x2c')][_0x7923('0x34')](_0x7923('0x35'))){_0x5a885a['limit']=qs[_0x7923('0x19')](_0x22396c[_0x7923('0x2c')][_0x7923('0x19')]);_0x5a885a['offset']=qs[_0x7923('0x17')](_0x22396c[_0x7923('0x2c')][_0x7923('0x17')]);}_0x5a885a[_0x7923('0x36')]=qs[_0x7923('0x37')](_0x22396c['query']['sort']);_0x5a885a[_0x7923('0x38')]=qs[_0x7923('0x2e')](_['pick'](_0x22396c[_0x7923('0x2c')],_0x5dc72a['filters']),_0x54f0ef);if(_0x22396c[_0x7923('0x2c')][_0x7923('0x39')]){_0x5a885a[_0x7923('0x38')]=_[_0x7923('0x3a')](_0x5a885a[_0x7923('0x38')],{'$or':_['map'](_0x54f0ef,function(_0x5c095a){if(_0x5c095a[_0x7923('0x2a')]!==_0x7923('0x3b')){var _0x59e627={};_0x59e627[_0x5c095a[_0x7923('0x26')]]={'$like':'%'+_0x22396c[_0x7923('0x2c')][_0x7923('0x39')]+'%'};return _0x59e627;}})});}_0x5a885a=_[_0x7923('0x3a')]({},_0x5a885a,_0x22396c['options']);var _0x18563e={'where':_0x5a885a['where']};return db['AnalyticExtractedReport'][_0x7923('0x1a')](_0x18563e)[_0x7923('0x20')](function(_0x154458){_0x52240d[_0x7923('0x1a')]=_0x154458;if(_0x22396c['query'][_0x7923('0x3c')]){_0x5a885a[_0x7923('0x3d')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7923('0x3e')](_0x5a885a);})[_0x7923('0x20')](function(_0x22a9ea){_0x52240d['rows']=_0x22a9ea;return _0x52240d;})[_0x7923('0x20')](respondWithFilteredResult(_0x4024da,_0x5a885a))[_0x7923('0x3f')](handleError(_0x4024da,null));};exports[_0x7923('0x40')]=function(_0x426cde,_0x2760f4){var _0xcf1beb={'raw':!![],'where':{'id':_0x426cde['params']['id']}},_0x3e37e5={};_0x3e37e5['model']=_['keys'](db['AnalyticExtractedReport'][_0x7923('0x41')]);_0x3e37e5['query']=_[_0x7923('0x2d')](_0x426cde[_0x7923('0x2c')]);_0x3e37e5[_0x7923('0x2e')]=_[_0x7923('0x2f')](_0x3e37e5[_0x7923('0x30')],_0x3e37e5[_0x7923('0x2c')]);_0xcf1beb[_0x7923('0x31')]=_[_0x7923('0x2f')](_0x3e37e5[_0x7923('0x30')],qs[_0x7923('0x32')](_0x426cde[_0x7923('0x2c')][_0x7923('0x32')]));_0xcf1beb[_0x7923('0x31')]=_0xcf1beb[_0x7923('0x31')]['length']?_0xcf1beb['attributes']:_0x3e37e5[_0x7923('0x30')];if(_0x426cde[_0x7923('0x2c')][_0x7923('0x3c')]){_0xcf1beb[_0x7923('0x3d')]=[{'all':!![]}];}_0xcf1beb=_[_0x7923('0x3a')]({},_0xcf1beb,_0x426cde[_0x7923('0x42')]);return db[_0x7923('0x28')][_0x7923('0x43')](_0xcf1beb)[_0x7923('0x20')](handleEntityNotFound(_0x2760f4,null))[_0x7923('0x20')](respondWithResult(_0x2760f4,null))[_0x7923('0x3f')](handleError(_0x2760f4,null));};exports[_0x7923('0x44')]=function(_0x5d776b,_0x44c022){return db[_0x7923('0x28')]['create'](_0x5d776b[_0x7923('0x45')],{})[_0x7923('0x20')](function(_0x186465){var _0x363dbd=_0x5d776b['user']['get']({'plain':!![]});if(!_0x363dbd)throw new Error(_0x7923('0x46'));if(_0x363dbd[_0x7923('0x47')]===_0x7923('0x48')){var _0x4edb05=_0x186465[_0x7923('0x22')]({'plain':!![]});var _0x43e24f=_0x7923('0x23');return db[_0x7923('0x49')][_0x7923('0x43')]({'where':{'name':_0x43e24f,'userProfileId':_0x363dbd[_0x7923('0x4a')]},'raw':!![]})[_0x7923('0x20')](function(_0x242065){if(_0x242065&&_0x242065[_0x7923('0x4b')]===0x0){return db[_0x7923('0x4c')][_0x7923('0x44')]({'name':_0x4edb05['name'],'resourceId':_0x4edb05['id'],'type':_0x242065[_0x7923('0x26')],'sectionId':_0x242065['id']},{})['then'](function(){return _0x186465;});}else{return _0x186465;}})['catch'](function(_0x1059fe){logger[_0x7923('0x24')](_0x7923('0x4d'),_0x1059fe);throw _0x1059fe;});}return _0x186465;})[_0x7923('0x20')](respondWithResult(_0x44c022,0xc9))[_0x7923('0x3f')](handleError(_0x44c022,null));};exports[_0x7923('0x1f')]=function(_0x11bb46,_0x36425b){if(_0x11bb46[_0x7923('0x45')]['id']){delete _0x11bb46['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x11bb46[_0x7923('0x4e')]['id']}})[_0x7923('0x20')](handleEntityNotFound(_0x36425b,null))['then'](saveUpdates(_0x11bb46[_0x7923('0x45')],null))['then'](respondWithResult(_0x36425b,null))['catch'](handleError(_0x36425b,null));};exports[_0x7923('0x21')]=function(_0x309d96,_0x199acd){return db[_0x7923('0x28')][_0x7923('0x43')]({'where':{'id':_0x309d96['params']['id']}})[_0x7923('0x20')](handleEntityNotFound(_0x199acd,null))['then'](removeEntity(_0x199acd,null))[_0x7923('0x3f')](handleError(_0x199acd,null));};exports[_0x7923('0x4f')]=function(_0x2f6232,_0x1d4a5e,_0x38e71b){return db[_0x7923('0x28')][_0x7923('0x43')]({'where':{'id':_0x2f6232[_0x7923('0x4e')]['id']},'attributes':[_0x7923('0x26'),_0x7923('0x50'),'savename',_0x7923('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x1d4a5e,null))['then'](function(_0x466476){if(_0x466476){if(!fs['existsSync'](path[_0x7923('0x52')](config['root'],_0x7923('0x53'),_0x466476[_0x7923('0x54')]))){throw new db[(_0x7923('0x55'))][(_0x7923('0x56'))](_0x7923('0x57'));}if(_0x2f6232['query'][_0x7923('0x58')]){return _0x1d4a5e['sendStatus'](0xc8);}return _0x1d4a5e[_0x7923('0x4f')](path['join'](config[_0x7923('0x59')],_0x7923('0x53'),_0x466476[_0x7923('0x54')]),util[_0x7923('0x5a')](_0x7923('0x5b'),_0x466476[_0x7923('0x50')]||_0x466476['name'],_0x466476[_0x7923('0x51')][_0x7923('0x5c')]()));}})['catch'](handleError(_0x1d4a5e,null));}; \ No newline at end of file +var _0x4cc8=['request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','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','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s'];(function(_0x27781b,_0x2e4f6b){var _0x55c433=function(_0x44f56c){while(--_0x44f56c){_0x27781b['push'](_0x27781b['shift']());}};_0x55c433(++_0x2e4f6b);}(_0x4cc8,0x174));var _0x84cc=function(_0x3255a5,_0x1b25e7){_0x3255a5=_0x3255a5-0x0;var _0x3e5f00=_0x4cc8[_0x3255a5];return _0x3e5f00;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x84cc('0x0'));var moment=require('moment');var BPromise=require(_0x84cc('0x1'));var Mustache=require(_0x84cc('0x2'));var util=require('util');var path=require(_0x84cc('0x3'));var sox=require(_0x84cc('0x4'));var csv=require(_0x84cc('0x5'));var ejs=require(_0x84cc('0x6'));var fs=require('fs');var fs_extra=require(_0x84cc('0x7'));var _=require(_0x84cc('0x8'));var squel=require('squel');var crypto=require(_0x84cc('0x9'));var jsforce=require(_0x84cc('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x84cc('0x5'));var querystring=require('querystring');var Papa=require(_0x84cc('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x84cc('0xc'));var as=require(_0x84cc('0xd'));var hardwareService=require(_0x84cc('0xe'));var logger=require(_0x84cc('0xf'))(_0x84cc('0x10'));var utils=require(_0x84cc('0x11'));var config=require(_0x84cc('0x12'));var licenseUtil=require(_0x84cc('0x13'));var db=require(_0x84cc('0x14'))['db'];function respondWithStatusCode(_0x7062a4,_0x26a93c){_0x26a93c=_0x26a93c||0xcc;return function(_0x20decf){if(_0x20decf){return _0x7062a4[_0x84cc('0x15')](_0x26a93c);}return _0x7062a4['status'](_0x26a93c)[_0x84cc('0x16')]();};}function respondWithResult(_0x94c3b5,_0x4f3afe){_0x4f3afe=_0x4f3afe||0xc8;return function(_0x1d571b){if(_0x1d571b){return _0x94c3b5[_0x84cc('0x17')](_0x4f3afe)[_0x84cc('0x18')](_0x1d571b);}};}function respondWithFilteredResult(_0x10e5df,_0x3dc96e){return function(_0x141245){if(_0x141245){var _0x4636ad=typeof _0x3dc96e[_0x84cc('0x19')]===_0x84cc('0x1a')&&typeof _0x3dc96e['limit']===_0x84cc('0x1a');var _0x46f3b0=_0x141245[_0x84cc('0x1b')];var _0x1fc94a=_0x4636ad?0x0:_0x3dc96e[_0x84cc('0x19')];var _0x56454f=_0x4636ad?_0x141245[_0x84cc('0x1b')]:_0x3dc96e[_0x84cc('0x19')]+_0x3dc96e[_0x84cc('0x1c')];var _0x51d943;if(_0x56454f>=_0x46f3b0){_0x56454f=_0x46f3b0;_0x51d943=0xc8;}else{_0x51d943=0xce;}_0x10e5df['status'](_0x51d943);return _0x10e5df[_0x84cc('0x1d')](_0x84cc('0x1e'),_0x1fc94a+'-'+_0x56454f+'/'+_0x46f3b0)[_0x84cc('0x18')](_0x141245);}return null;};}function patchUpdates(_0x42f926){return function(_0x4e94c3){try{jsonpatch[_0x84cc('0x1f')](_0x4e94c3,_0x42f926,!![]);}catch(_0x3895c1){return BPromise[_0x84cc('0x20')](_0x3895c1);}return _0x4e94c3[_0x84cc('0x21')]();};}function saveUpdates(_0xbd3c50,_0xa60340){return function(_0x105d94){if(_0x105d94){return _0x105d94[_0x84cc('0x22')](_0xbd3c50)[_0x84cc('0x23')](function(_0x4fb109){return _0x4fb109;});}return null;};}function removeEntity(_0x10d4cf,_0x3438d9){return function(_0x2ba428){if(_0x2ba428){return _0x2ba428['destroy']()[_0x84cc('0x23')](function(){var _0x28f690=_0x2ba428[_0x84cc('0x24')]({'plain':!![]});var _0x1b2a91=_0x84cc('0x25');return db[_0x84cc('0x26')][_0x84cc('0x27')]({'where':{'type':_0x1b2a91,'resourceId':_0x28f690['id']}})[_0x84cc('0x23')](function(){return _0x2ba428;});})[_0x84cc('0x23')](function(){_0x10d4cf['status'](0xcc)[_0x84cc('0x16')]();});}};}function handleEntityNotFound(_0x2edc53,_0x319cfa){return function(_0xbb371c){if(!_0xbb371c){_0x2edc53[_0x84cc('0x15')](0x194);}return _0xbb371c;};}function handleError(_0x583e75,_0x2655fd){_0x2655fd=_0x2655fd||0x1f4;return function(_0x2a5856){logger[_0x84cc('0x28')](_0x2a5856['stack']);if(_0x2a5856[_0x84cc('0x29')]){delete _0x2a5856[_0x84cc('0x29')];}_0x583e75['status'](_0x2655fd)[_0x84cc('0x2a')](_0x2a5856);};}exports[_0x84cc('0x2b')]=function(_0x2a2457,_0x43b774){var _0xb4bc29={},_0x351f67={},_0x29844e={'count':0x0,'rows':[]};var _0x49e506=_['map'](db[_0x84cc('0x2c')][_0x84cc('0x2d')],function(_0x4c0c2f){return{'name':_0x4c0c2f[_0x84cc('0x2e')],'type':_0x4c0c2f[_0x84cc('0x2f')][_0x84cc('0x30')]};});_0x351f67['model']=_['map'](_0x49e506,_0x84cc('0x29'));_0x351f67['query']=_['keys'](_0x2a2457[_0x84cc('0x31')]);_0x351f67[_0x84cc('0x32')]=_[_0x84cc('0x33')](_0x351f67[_0x84cc('0x34')],_0x351f67[_0x84cc('0x31')]);_0xb4bc29[_0x84cc('0x35')]=_['intersection'](_0x351f67[_0x84cc('0x34')],qs['fields'](_0x2a2457[_0x84cc('0x31')][_0x84cc('0x36')]));_0xb4bc29[_0x84cc('0x35')]=_0xb4bc29[_0x84cc('0x35')][_0x84cc('0x37')]?_0xb4bc29[_0x84cc('0x35')]:_0x351f67[_0x84cc('0x34')];if(!_0x2a2457[_0x84cc('0x31')][_0x84cc('0x38')]('nolimit')){_0xb4bc29[_0x84cc('0x1c')]=qs[_0x84cc('0x1c')](_0x2a2457[_0x84cc('0x31')][_0x84cc('0x1c')]);_0xb4bc29['offset']=qs[_0x84cc('0x19')](_0x2a2457['query'][_0x84cc('0x19')]);}_0xb4bc29['order']=qs['sort'](_0x2a2457['query'][_0x84cc('0x39')]);_0xb4bc29[_0x84cc('0x3a')]=qs[_0x84cc('0x32')](_[_0x84cc('0x3b')](_0x2a2457[_0x84cc('0x31')],_0x351f67[_0x84cc('0x32')]),_0x49e506);if(_0x2a2457[_0x84cc('0x31')][_0x84cc('0x3c')]){_0xb4bc29[_0x84cc('0x3a')]=_[_0x84cc('0x3d')](_0xb4bc29['where'],{'$or':_[_0x84cc('0x3e')](_0x49e506,function(_0x571b0e){if(_0x571b0e[_0x84cc('0x2f')]!==_0x84cc('0x3f')){var _0x562aef={};_0x562aef[_0x571b0e[_0x84cc('0x29')]]={'$like':'%'+_0x2a2457['query'][_0x84cc('0x3c')]+'%'};return _0x562aef;}})});}_0xb4bc29=_[_0x84cc('0x3d')]({},_0xb4bc29,_0x2a2457[_0x84cc('0x40')]);var _0x187e2e={'where':_0xb4bc29[_0x84cc('0x3a')]};return db[_0x84cc('0x2c')][_0x84cc('0x1b')](_0x187e2e)['then'](function(_0x4d3129){_0x29844e[_0x84cc('0x1b')]=_0x4d3129;if(_0x2a2457[_0x84cc('0x31')]['includeAll']){_0xb4bc29[_0x84cc('0x41')]=[{'all':!![]}];}return db[_0x84cc('0x2c')]['findAll'](_0xb4bc29);})[_0x84cc('0x23')](function(_0x5ac369){_0x29844e[_0x84cc('0x42')]=_0x5ac369;return _0x29844e;})[_0x84cc('0x23')](respondWithFilteredResult(_0x43b774,_0xb4bc29))[_0x84cc('0x43')](handleError(_0x43b774,null));};exports[_0x84cc('0x44')]=function(_0xac1f2b,_0x47bd71){var _0x1b066a={'raw':!![],'where':{'id':_0xac1f2b[_0x84cc('0x45')]['id']}},_0x456ea5={};_0x456ea5[_0x84cc('0x34')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x456ea5[_0x84cc('0x31')]=_['keys'](_0xac1f2b['query']);_0x456ea5[_0x84cc('0x32')]=_[_0x84cc('0x33')](_0x456ea5['model'],_0x456ea5[_0x84cc('0x31')]);_0x1b066a[_0x84cc('0x35')]=_[_0x84cc('0x33')](_0x456ea5[_0x84cc('0x34')],qs['fields'](_0xac1f2b['query'][_0x84cc('0x36')]));_0x1b066a[_0x84cc('0x35')]=_0x1b066a[_0x84cc('0x35')][_0x84cc('0x37')]?_0x1b066a[_0x84cc('0x35')]:_0x456ea5[_0x84cc('0x34')];if(_0xac1f2b[_0x84cc('0x31')][_0x84cc('0x46')]){_0x1b066a[_0x84cc('0x41')]=[{'all':!![]}];}_0x1b066a=_['merge']({},_0x1b066a,_0xac1f2b[_0x84cc('0x40')]);return db[_0x84cc('0x2c')][_0x84cc('0x47')](_0x1b066a)['then'](handleEntityNotFound(_0x47bd71,null))[_0x84cc('0x23')](respondWithResult(_0x47bd71,null))[_0x84cc('0x43')](handleError(_0x47bd71,null));};exports[_0x84cc('0x48')]=function(_0x13dc98,_0x4d8f61){return db[_0x84cc('0x2c')][_0x84cc('0x48')](_0x13dc98['body'],{})[_0x84cc('0x23')](function(_0x3bf7ca){var _0x4623db=_0x13dc98[_0x84cc('0x49')]['get']({'plain':!![]});if(!_0x4623db)throw new Error(_0x84cc('0x4a'));if(_0x4623db[_0x84cc('0x4b')]===_0x84cc('0x49')){var _0x5b7dea=_0x3bf7ca[_0x84cc('0x24')]({'plain':!![]});var _0x1b3f4a='ExtractedReports';return db[_0x84cc('0x4c')][_0x84cc('0x47')]({'where':{'name':_0x1b3f4a,'userProfileId':_0x4623db[_0x84cc('0x4d')]},'raw':!![]})[_0x84cc('0x23')](function(_0x77f014){if(_0x77f014&&_0x77f014[_0x84cc('0x4e')]===0x0){return db[_0x84cc('0x26')][_0x84cc('0x48')]({'name':_0x5b7dea[_0x84cc('0x29')],'resourceId':_0x5b7dea['id'],'type':_0x77f014[_0x84cc('0x29')],'sectionId':_0x77f014['id']},{})[_0x84cc('0x23')](function(){return _0x3bf7ca;});}else{return _0x3bf7ca;}})['catch'](function(_0x25cb9c){logger['error'](_0x84cc('0x4f'),_0x25cb9c);throw _0x25cb9c;});}return _0x3bf7ca;})[_0x84cc('0x23')](respondWithResult(_0x4d8f61,0xc9))[_0x84cc('0x43')](handleError(_0x4d8f61,null));};exports[_0x84cc('0x22')]=function(_0x62a0f0,_0x3f6674){if(_0x62a0f0['body']['id']){delete _0x62a0f0[_0x84cc('0x50')]['id'];}return db['AnalyticExtractedReport'][_0x84cc('0x47')]({'where':{'id':_0x62a0f0[_0x84cc('0x45')]['id']}})[_0x84cc('0x23')](handleEntityNotFound(_0x3f6674,null))[_0x84cc('0x23')](saveUpdates(_0x62a0f0[_0x84cc('0x50')],null))[_0x84cc('0x23')](respondWithResult(_0x3f6674,null))[_0x84cc('0x43')](handleError(_0x3f6674,null));};exports[_0x84cc('0x27')]=function(_0xd389ac,_0x58e985){return db['AnalyticExtractedReport'][_0x84cc('0x47')]({'where':{'id':_0xd389ac[_0x84cc('0x45')]['id']}})[_0x84cc('0x23')](handleEntityNotFound(_0x58e985,null))['then'](removeEntity(_0x58e985,null))['catch'](handleError(_0x58e985,null));};exports['download']=function(_0x362427,_0x4ae54e,_0x434852){return db[_0x84cc('0x2c')][_0x84cc('0x47')]({'where':{'id':_0x362427[_0x84cc('0x45')]['id']},'attributes':['name',_0x84cc('0x51'),_0x84cc('0x52'),_0x84cc('0x53')],'raw':!![]})[_0x84cc('0x23')](handleEntityNotFound(_0x4ae54e,null))['then'](function(_0x5877e5){if(_0x5877e5){if(!fs[_0x84cc('0x54')](path[_0x84cc('0x55')](config[_0x84cc('0x56')],_0x84cc('0x57'),_0x5877e5[_0x84cc('0x52')]))){throw new db[(_0x84cc('0x58'))]['ValidationError'](_0x84cc('0x59'));}if(_0x362427[_0x84cc('0x31')]['exists']){return _0x4ae54e[_0x84cc('0x15')](0xc8);}return _0x4ae54e[_0x84cc('0x5a')](path[_0x84cc('0x55')](config[_0x84cc('0x56')],_0x84cc('0x57'),_0x5877e5['savename']),util[_0x84cc('0x5b')](_0x84cc('0x5c'),_0x5877e5['basename']||_0x5877e5['name'],_0x5877e5[_0x84cc('0x53')]['toLowerCase']()));}})[_0x84cc('0x43')](handleError(_0x4ae54e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index a83f17f..f827b95 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 _0xa53b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash'];(function(_0xd77b35,_0x5d0d78){var _0x27f5e4=function(_0x2f6e4e){while(--_0x2f6e4e){_0xd77b35['push'](_0xd77b35['shift']());}};_0x27f5e4(++_0x5d0d78);}(_0xa53b,0xb3));var _0xba53=function(_0x4d119a,_0x398de0){_0x4d119a=_0x4d119a-0x0;var _0x32d5fc=_0xa53b[_0x4d119a];return _0x32d5fc;};'use strict';var _=require(_0xba53('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba53('0x1'));var moment=require(_0xba53('0x2'));var BPromise=require(_0xba53('0x3'));var rp=require(_0xba53('0x4'));var fs=require('fs');var path=require(_0xba53('0x5'));var rimraf=require(_0xba53('0x6'));var config=require(_0xba53('0x7'));var attributes=require(_0xba53('0x8'));module[_0xba53('0x9')]=function(_0x1281a5,_0x489951){return _0x1281a5[_0xba53('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xba53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x981b=['./analyticExtractedReport.attributes','exports','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb59fd9,_0x4c539){var _0x263983=function(_0x268b8a){while(--_0x268b8a){_0xb59fd9['push'](_0xb59fd9['shift']());}};_0x263983(++_0x4c539);}(_0x981b,0x6f));var _0xb981=function(_0x33841a,_0x4c70c6){_0x33841a=_0x33841a-0x0;var _0xa2b086=_0x981b[_0x33841a];return _0xa2b086;};'use strict';var _=require('lodash');var util=require(_0xb981('0x0'));var logger=require(_0xb981('0x1'))(_0xb981('0x2'));var moment=require(_0xb981('0x3'));var BPromise=require(_0xb981('0x4'));var rp=require(_0xb981('0x5'));var fs=require('fs');var path=require(_0xb981('0x6'));var rimraf=require(_0xb981('0x7'));var config=require(_0xb981('0x8'));var attributes=require(_0xb981('0x9'));module[_0xb981('0xa')]=function(_0x157177,_0x490b11){return _0x157177['define']('AnalyticExtractedReport',attributes,{'tableName':_0xb981('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 542e229..33faa5d 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 _0x6817=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x40d4e5,_0x1ebe2c){var _0x210d1a=function(_0x302f4e){while(--_0x302f4e){_0x40d4e5['push'](_0x40d4e5['shift']());}};_0x210d1a(++_0x1ebe2c);}(_0x6817,0xf8));var _0x7681=function(_0x384dc1,_0x3567d){_0x384dc1=_0x384dc1-0x0;var _0x4ae336=_0x6817[_0x384dc1];return _0x4ae336;};'use strict';var _=require(_0x7681('0x0'));var util=require(_0x7681('0x1'));var moment=require(_0x7681('0x2'));var BPromise=require(_0x7681('0x3'));var rs=require(_0x7681('0x4'));var fs=require('fs');var Redis=require(_0x7681('0x5'));var db=require(_0x7681('0x6'))['db'];var utils=require(_0x7681('0x7'));var logger=require(_0x7681('0x8'))(_0x7681('0x9'));var config=require(_0x7681('0xa'));var jayson=require(_0x7681('0xb'));var client=jayson[_0x7681('0xc')][_0x7681('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x54c74f,_0x1413ec,_0x4bdc51){return new BPromise(function(_0x4a1b66,_0x83649f){return client[_0x7681('0xe')](_0x54c74f,_0x4bdc51)['then'](function(_0x1b251f){logger[_0x7681('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1413ec,_0x7681('0x10'));logger[_0x7681('0x11')](_0x7681('0x12'),_0x1413ec,_0x7681('0x10'),JSON['stringify'](_0x1b251f));if(_0x1b251f[_0x7681('0x13')]){if(_0x1b251f['error']['code']===0x1f4){logger[_0x7681('0x13')](_0x7681('0x14'),_0x1413ec,_0x1b251f[_0x7681('0x13')][_0x7681('0x15')]);return _0x83649f(_0x1b251f[_0x7681('0x13')]['message']);}logger[_0x7681('0x13')](_0x7681('0x14'),_0x1413ec,_0x1b251f['error']['message']);return _0x4a1b66(_0x1b251f[_0x7681('0x13')][_0x7681('0x15')]);}else{logger[_0x7681('0xf')](_0x7681('0x14'),_0x1413ec,_0x7681('0x10'));_0x4a1b66(_0x1b251f[_0x7681('0x16')][_0x7681('0x15')]);}})[_0x7681('0x17')](function(_0x31057a){logger[_0x7681('0x13')](_0x7681('0x14'),_0x1413ec,_0x31057a);_0x83649f(_0x31057a);});});} \ No newline at end of file +var _0x3b44=['lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch'];(function(_0x435f7c,_0x3c50e5){var _0x11be96=function(_0x4b91e3){while(--_0x4b91e3){_0x435f7c['push'](_0x435f7c['shift']());}};_0x11be96(++_0x3c50e5);}(_0x3b44,0xa0));var _0x43b4=function(_0x3663c2,_0x1be306){_0x3663c2=_0x3663c2-0x0;var _0x26b1e6=_0x3b44[_0x3663c2];return _0x26b1e6;};'use strict';var _=require(_0x43b4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43b4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43b4('0x2'))['db'];var utils=require(_0x43b4('0x3'));var logger=require(_0x43b4('0x4'))(_0x43b4('0x5'));var config=require(_0x43b4('0x6'));var jayson=require(_0x43b4('0x7'));var client=jayson['client'][_0x43b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a279a,_0x1e461f,_0x413dd5){return new BPromise(function(_0x4b4341,_0x25c3c8){return client['request'](_0x3a279a,_0x413dd5)[_0x43b4('0x9')](function(_0x2a95bb){logger[_0x43b4('0xa')](_0x43b4('0xb'),_0x1e461f,'request\x20sent');logger[_0x43b4('0xc')](_0x43b4('0xd'),_0x1e461f,'request\x20sent',JSON[_0x43b4('0xe')](_0x2a95bb));if(_0x2a95bb[_0x43b4('0xf')]){if(_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x10')]===0x1f4){logger['error'](_0x43b4('0xb'),_0x1e461f,_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x11')]);return _0x25c3c8(_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x11')]);}logger[_0x43b4('0xf')](_0x43b4('0xb'),_0x1e461f,_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x11')]);return _0x4b4341(_0x2a95bb[_0x43b4('0xf')][_0x43b4('0x11')]);}else{logger['info'](_0x43b4('0xb'),_0x1e461f,_0x43b4('0x12'));_0x4b4341(_0x2a95bb['result']['message']);}})[_0x43b4('0x13')](function(_0x3a5462){logger[_0x43b4('0xf')](_0x43b4('0xb'),_0x1e461f,_0x3a5462);_0x25c3c8(_0x3a5462);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 4e5ad8a..9fb9032 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 _0x0317=['/:id','show','/:id/download','create','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get'];(function(_0x454ae0,_0x253c6b){var _0x2ce06f=function(_0xd023dc){while(--_0xd023dc){_0x454ae0['push'](_0x454ae0['shift']());}};_0x2ce06f(++_0x253c6b);}(_0x0317,0x94));var _0x7031=function(_0x48bc0d,_0x30becd){_0x48bc0d=_0x48bc0d-0x0;var _0x35f641=_0x0317[_0x48bc0d];return _0x35f641;};'use strict';var multer=require(_0x7031('0x0'));var util=require(_0x7031('0x1'));var path=require('path');var timeout=require(_0x7031('0x2'));var express=require(_0x7031('0x3'));var router=express['Router']();var fs_extra=require(_0x7031('0x4'));var auth=require(_0x7031('0x5'));var interaction=require(_0x7031('0x6'));var config=require(_0x7031('0x7'));var controller=require(_0x7031('0x8'));router['get']('/',auth[_0x7031('0x9')](),controller[_0x7031('0xa')]);router[_0x7031('0xb')](_0x7031('0xc'),auth[_0x7031('0x9')](),controller[_0x7031('0xd')]);router[_0x7031('0xb')](_0x7031('0xe'),auth[_0x7031('0x9')](),controller['download']);router['post']('/',auth[_0x7031('0x9')](),controller[_0x7031('0xf')]);router[_0x7031('0x10')](_0x7031('0xc'),auth[_0x7031('0x9')](),controller[_0x7031('0x11')]);router[_0x7031('0x12')](_0x7031('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7031('0x13')]=router; \ No newline at end of file +var _0xdf09=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/download','download','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5952f1,_0x36d54f){var _0x3fba63=function(_0x5e8bd5){while(--_0x5e8bd5){_0x5952f1['push'](_0x5952f1['shift']());}};_0x3fba63(++_0x36d54f);}(_0xdf09,0xae));var _0x9df0=function(_0x432430,_0x67a2e8){_0x432430=_0x432430-0x0;var _0x414d68=_0xdf09[_0x432430];return _0x414d68;};'use strict';var multer=require(_0x9df0('0x0'));var util=require(_0x9df0('0x1'));var path=require(_0x9df0('0x2'));var timeout=require(_0x9df0('0x3'));var express=require(_0x9df0('0x4'));var router=express[_0x9df0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9df0('0x6'));var interaction=require(_0x9df0('0x7'));var config=require(_0x9df0('0x8'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9df0('0x9')](_0x9df0('0xa'),auth[_0x9df0('0xb')](),controller[_0x9df0('0xc')]);router[_0x9df0('0x9')](_0x9df0('0xd'),auth[_0x9df0('0xb')](),controller[_0x9df0('0xe')]);router[_0x9df0('0xf')]('/',auth['isAuthenticated'](),controller[_0x9df0('0x10')]);router['put'](_0x9df0('0xa'),auth[_0x9df0('0xb')](),controller[_0x9df0('0x11')]);router[_0x9df0('0x12')](_0x9df0('0xa'),auth[_0x9df0('0xb')](),controller[_0x9df0('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 2306a51..c99ef10 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 _0x0ff6=['TEXT','STRING','BOOLEAN','exports'];(function(_0x5f017a,_0xf097bb){var _0x537a38=function(_0x15a617){while(--_0x15a617){_0x5f017a['push'](_0x5f017a['shift']());}};_0x537a38(++_0xf097bb);}(_0x0ff6,0x15f));var _0x60ff=function(_0x3e5803,_0x24bdcc){_0x3e5803=_0x3e5803-0x0;var _0x2b62d3=_0x0ff6[_0x3e5803];return _0x2b62d3;};'use strict';var Sequelize=require('sequelize');module[_0x60ff('0x0')]={'field':{'type':Sequelize[_0x60ff('0x1')]},'alias':{'type':Sequelize[_0x60ff('0x2')]},'function':{'type':Sequelize[_0x60ff('0x2')]},'format':{'type':Sequelize[_0x60ff('0x2')]},'groupBy':{'type':Sequelize[_0x60ff('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x60ff('0x2')]},'custom':{'type':Sequelize[_0x60ff('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0cb6=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x2228c4,_0x13c30a){var _0x1f67fb=function(_0x337ffe){while(--_0x337ffe){_0x2228c4['push'](_0x2228c4['shift']());}};_0x1f67fb(++_0x13c30a);}(_0x0cb6,0x1c3));var _0x60cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cb6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x60cb('0x0'));module[_0x60cb('0x1')]={'field':{'type':Sequelize[_0x60cb('0x2')]},'alias':{'type':Sequelize[_0x60cb('0x3')]},'function':{'type':Sequelize[_0x60cb('0x3')]},'format':{'type':Sequelize[_0x60cb('0x3')]},'groupBy':{'type':Sequelize[_0x60cb('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x60cb('0x3')]},'custom':{'type':Sequelize[_0x60cb('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 6c32f20..7d5094e 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 _0xd9d1=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','catch','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x41df9f,_0xee067c){var _0x57fe79=function(_0x3a6871){while(--_0x3a6871){_0x41df9f['push'](_0x41df9f['shift']());}};_0x57fe79(++_0xee067c);}(_0xd9d1,0x1ec));var _0x1d9d=function(_0x5d33db,_0x455ebe){_0x5d33db=_0x5d33db-0x0;var _0x149db2=_0xd9d1[_0x5d33db];return _0x149db2;};'use strict';var emlformat=require(_0x1d9d('0x0'));var rimraf=require(_0x1d9d('0x1'));var zipdir=require(_0x1d9d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1d9d('0x3'));var BPromise=require(_0x1d9d('0x4'));var Mustache=require(_0x1d9d('0x5'));var util=require(_0x1d9d('0x6'));var path=require(_0x1d9d('0x7'));var sox=require('sox');var csv=require(_0x1d9d('0x8'));var ejs=require(_0x1d9d('0x9'));var fs=require('fs');var fs_extra=require(_0x1d9d('0xa'));var _=require(_0x1d9d('0xb'));var squel=require(_0x1d9d('0xc'));var crypto=require(_0x1d9d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1d9d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1d9d('0xf'));var Papa=require(_0x1d9d('0x10'));var Redis=require(_0x1d9d('0x11'));var authService=require(_0x1d9d('0x12'));var qs=require(_0x1d9d('0x13'));var as=require(_0x1d9d('0x14'));var hardwareService=require(_0x1d9d('0x15'));var logger=require('../../config/logger')(_0x1d9d('0x16'));var utils=require(_0x1d9d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1d9d('0x18'));var db=require(_0x1d9d('0x19'))['db'];function respondWithStatusCode(_0xfda175,_0x571504){_0x571504=_0x571504||0xcc;return function(_0x24a018){if(_0x24a018){return _0xfda175[_0x1d9d('0x1a')](_0x571504);}return _0xfda175[_0x1d9d('0x1b')](_0x571504)[_0x1d9d('0x1c')]();};}function respondWithResult(_0x37b61b,_0x15a05d){_0x15a05d=_0x15a05d||0xc8;return function(_0x5bc755){if(_0x5bc755){return _0x37b61b['status'](_0x15a05d)[_0x1d9d('0x1d')](_0x5bc755);}};}function respondWithFilteredResult(_0x5747f5,_0x4fa4aa){return function(_0x54da8a){if(_0x54da8a){var _0x58979e=typeof _0x4fa4aa[_0x1d9d('0x1e')]===_0x1d9d('0x1f')&&typeof _0x4fa4aa[_0x1d9d('0x20')]===_0x1d9d('0x1f');var _0x1fe8e9=_0x54da8a[_0x1d9d('0x21')];var _0x6924b0=_0x58979e?0x0:_0x4fa4aa[_0x1d9d('0x1e')];var _0x11c3d8=_0x58979e?_0x54da8a['count']:_0x4fa4aa[_0x1d9d('0x1e')]+_0x4fa4aa[_0x1d9d('0x20')];var _0x247f99;if(_0x11c3d8>=_0x1fe8e9){_0x11c3d8=_0x1fe8e9;_0x247f99=0xc8;}else{_0x247f99=0xce;}_0x5747f5['status'](_0x247f99);return _0x5747f5['set'](_0x1d9d('0x22'),_0x6924b0+'-'+_0x11c3d8+'/'+_0x1fe8e9)['json'](_0x54da8a);}return null;};}function patchUpdates(_0x4d4bba){return function(_0x840041){try{jsonpatch[_0x1d9d('0x23')](_0x840041,_0x4d4bba,!![]);}catch(_0x49c586){return BPromise['reject'](_0x49c586);}return _0x840041[_0x1d9d('0x24')]();};}function saveUpdates(_0x25061d,_0x2b6db8){return function(_0x49b2d5){if(_0x49b2d5){return _0x49b2d5[_0x1d9d('0x25')](_0x25061d)[_0x1d9d('0x26')](function(_0x5d1a87){return _0x5d1a87;});}return null;};}function removeEntity(_0xaf040d,_0x5eb37e){return function(_0x157f1d){if(_0x157f1d){return _0x157f1d[_0x1d9d('0x27')]()['then'](function(){_0xaf040d['status'](0xcc)[_0x1d9d('0x1c')]();});}};}function handleEntityNotFound(_0xfca9e1,_0x366837){return function(_0x17b9a1){if(!_0x17b9a1){_0xfca9e1[_0x1d9d('0x1a')](0x194);}return _0x17b9a1;};}function handleError(_0x2edac0,_0x2372f4){_0x2372f4=_0x2372f4||0x1f4;return function(_0x122cb7){logger[_0x1d9d('0x28')](_0x122cb7[_0x1d9d('0x29')]);if(_0x122cb7['name']){delete _0x122cb7[_0x1d9d('0x2a')];}_0x2edac0[_0x1d9d('0x1b')](_0x2372f4)[_0x1d9d('0x2b')](_0x122cb7);};}exports['index']=function(_0x312248,_0x493547){var _0x4432da={},_0x2b7a64={},_0x16bcd5={'count':0x0,'rows':[]};var _0x26adfa=_[_0x1d9d('0x2c')](db[_0x1d9d('0x2d')][_0x1d9d('0x2e')],function(_0x3e17d7){return{'name':_0x3e17d7[_0x1d9d('0x2f')],'type':_0x3e17d7['type'][_0x1d9d('0x30')]};});_0x2b7a64['model']=_[_0x1d9d('0x2c')](_0x26adfa,_0x1d9d('0x2a'));_0x2b7a64[_0x1d9d('0x31')]=_[_0x1d9d('0x32')](_0x312248[_0x1d9d('0x31')]);_0x2b7a64[_0x1d9d('0x33')]=_[_0x1d9d('0x34')](_0x2b7a64[_0x1d9d('0x35')],_0x2b7a64[_0x1d9d('0x31')]);_0x4432da[_0x1d9d('0x36')]=_['intersection'](_0x2b7a64[_0x1d9d('0x35')],qs['fields'](_0x312248[_0x1d9d('0x31')][_0x1d9d('0x37')]));_0x4432da[_0x1d9d('0x36')]=_0x4432da[_0x1d9d('0x36')][_0x1d9d('0x38')]?_0x4432da[_0x1d9d('0x36')]:_0x2b7a64[_0x1d9d('0x35')];if(!_0x312248['query'][_0x1d9d('0x39')](_0x1d9d('0x3a'))){_0x4432da[_0x1d9d('0x20')]=qs[_0x1d9d('0x20')](_0x312248[_0x1d9d('0x31')][_0x1d9d('0x20')]);_0x4432da[_0x1d9d('0x1e')]=qs['offset'](_0x312248[_0x1d9d('0x31')][_0x1d9d('0x1e')]);}_0x4432da['order']=qs[_0x1d9d('0x3b')](_0x312248[_0x1d9d('0x31')]['sort']);_0x4432da[_0x1d9d('0x3c')]=qs['filters'](_[_0x1d9d('0x3d')](_0x312248['query'],_0x2b7a64[_0x1d9d('0x33')]),_0x26adfa);if(_0x312248[_0x1d9d('0x31')]['filter']){_0x4432da['where']=_[_0x1d9d('0x3e')](_0x4432da[_0x1d9d('0x3c')],{'$or':_[_0x1d9d('0x2c')](_0x26adfa,function(_0x2452f0){if(_0x2452f0[_0x1d9d('0x3f')]!==_0x1d9d('0x40')){var _0x428171={};_0x428171[_0x2452f0[_0x1d9d('0x2a')]]={'$like':'%'+_0x312248['query'][_0x1d9d('0x41')]+'%'};return _0x428171;}})});}_0x4432da=_[_0x1d9d('0x3e')]({},_0x4432da,_0x312248[_0x1d9d('0x42')]);var _0xf77a79={'where':_0x4432da['where']};return db[_0x1d9d('0x2d')]['count'](_0xf77a79)[_0x1d9d('0x26')](function(_0xbaa444){_0x16bcd5[_0x1d9d('0x21')]=_0xbaa444;if(_0x312248[_0x1d9d('0x31')][_0x1d9d('0x43')]){_0x4432da['include']=[{'all':!![]}];}return db[_0x1d9d('0x2d')][_0x1d9d('0x44')](_0x4432da);})['then'](function(_0x3ed6fb){_0x16bcd5[_0x1d9d('0x45')]=_0x3ed6fb;return _0x16bcd5;})[_0x1d9d('0x26')](respondWithFilteredResult(_0x493547,_0x4432da))['catch'](handleError(_0x493547,null));};exports[_0x1d9d('0x46')]=function(_0x5ac060,_0x4d09d1){var _0x14b69a={'raw':![],'where':{'id':_0x5ac060[_0x1d9d('0x47')]['id']}},_0x92f5f1={};_0x92f5f1[_0x1d9d('0x35')]=_[_0x1d9d('0x32')](db[_0x1d9d('0x2d')][_0x1d9d('0x2e')]);_0x92f5f1[_0x1d9d('0x31')]=_[_0x1d9d('0x32')](_0x5ac060[_0x1d9d('0x31')]);_0x92f5f1[_0x1d9d('0x33')]=_['intersection'](_0x92f5f1[_0x1d9d('0x35')],_0x92f5f1[_0x1d9d('0x31')]);_0x14b69a[_0x1d9d('0x36')]=_[_0x1d9d('0x34')](_0x92f5f1['model'],qs[_0x1d9d('0x37')](_0x5ac060[_0x1d9d('0x31')][_0x1d9d('0x37')]));_0x14b69a['attributes']=_0x14b69a[_0x1d9d('0x36')][_0x1d9d('0x38')]?_0x14b69a[_0x1d9d('0x36')]:_0x92f5f1[_0x1d9d('0x35')];if(_0x5ac060[_0x1d9d('0x31')][_0x1d9d('0x43')]){_0x14b69a[_0x1d9d('0x48')]=[{'all':!![]}];}_0x14b69a=_['merge']({},_0x14b69a,_0x5ac060['options']);return db[_0x1d9d('0x2d')][_0x1d9d('0x49')](_0x14b69a)[_0x1d9d('0x26')](handleEntityNotFound(_0x4d09d1,null))['then'](respondWithResult(_0x4d09d1,null))['catch'](handleError(_0x4d09d1,null));};exports[_0x1d9d('0x4a')]=function(_0x482885,_0x512b05){return db[_0x1d9d('0x2d')]['create'](_0x482885[_0x1d9d('0x4b')],{})['then'](respondWithResult(_0x512b05,0xc9))[_0x1d9d('0x4c')](handleError(_0x512b05,null));};exports[_0x1d9d('0x4d')]=function(_0x464ea5,_0x4c3e05){return db['AnalyticFieldReport']['bulkCreate'](_0x464ea5[_0x1d9d('0x4b')],{'raw':![],'individualHooks':!![]})[_0x1d9d('0x26')](respondWithResult(_0x4c3e05,0xc9))[_0x1d9d('0x4c')](handleError(_0x4c3e05,null));};exports[_0x1d9d('0x25')]=function(_0x342f22,_0x317cdf){if(_0x342f22['body']['id']){delete _0x342f22[_0x1d9d('0x4b')]['id'];}return db[_0x1d9d('0x2d')][_0x1d9d('0x49')]({'where':{'id':_0x342f22[_0x1d9d('0x47')]['id']}})[_0x1d9d('0x26')](handleEntityNotFound(_0x317cdf,null))[_0x1d9d('0x26')](saveUpdates(_0x342f22[_0x1d9d('0x4b')],null))[_0x1d9d('0x26')](respondWithResult(_0x317cdf,null))['catch'](handleError(_0x317cdf,null));};exports[_0x1d9d('0x27')]=function(_0x42cf76,_0x5ccc76){return db[_0x1d9d('0x2d')]['find']({'where':{'id':_0x42cf76['params']['id']}})[_0x1d9d('0x26')](handleEntityNotFound(_0x5ccc76,null))[_0x1d9d('0x26')](removeEntity(_0x5ccc76,null))['catch'](handleError(_0x5ccc76,null));};exports[_0x1d9d('0x4e')]=function(_0x202522,_0x3da8b7){return db[_0x1d9d('0x2d')][_0x1d9d('0x27')]({'where':{'id':_0x202522[_0x1d9d('0x31')][_0x1d9d('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0x1d9d('0x26')](respondWithResult(_0x3da8b7,0xcc))[_0x1d9d('0x4c')](handleError(_0x3da8b7,null));};exports[_0x1d9d('0x50')]=function(_0x5ed99b,_0x45256d,_0x41b921){return db[_0x1d9d('0x51')][_0x1d9d('0x52')]({'where':{'id':_0x5ed99b[_0x1d9d('0x47')]['id']}})[_0x1d9d('0x26')](handleEntityNotFound(_0x45256d,null))[_0x1d9d('0x26')](function(_0x6c0bec){if(_0x6c0bec){return db[_0x1d9d('0x53')][_0x1d9d('0x54')](function(_0x3df8d5){return db[_0x1d9d('0x2d')]['destroy']({'where':{'CustomReportId':_0x5ed99b[_0x1d9d('0x47')]['id']},'transaction':_0x3df8d5})[_0x1d9d('0x26')](function(_0x11daf6){var _0x3c0cc3=_[_0x1d9d('0x2c')](_0x5ed99b[_0x1d9d('0x4b')],function(_0x425e35){delete _0x425e35['id'];_0x425e35['CustomReportId']=_0x5ed99b[_0x1d9d('0x47')]['id'];return _0x425e35;});return db[_0x1d9d('0x2d')]['bulkCreate'](_0x3c0cc3,{'transaction':_0x3df8d5});});})['then'](function(){return db[_0x1d9d('0x2d')]['findAll']({'where':{'CustomReportId':_0x5ed99b[_0x1d9d('0x47')]['id']}});});}})['then'](respondWithResult(_0x45256d,null))['catch'](handleError(_0x45256d,null));}; \ No newline at end of file +var _0xe58e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','bulkCreate','find','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe58e,0x100));var _0xee58=function(_0x4c9b04,_0xe5027d){_0x4c9b04=_0x4c9b04-0x0;var _0x252d2a=_0xe58e[_0x4c9b04];return _0x252d2a;};'use strict';var emlformat=require(_0xee58('0x0'));var rimraf=require(_0xee58('0x1'));var zipdir=require(_0xee58('0x2'));var jsonpatch=require(_0xee58('0x3'));var rp=require(_0xee58('0x4'));var moment=require(_0xee58('0x5'));var BPromise=require(_0xee58('0x6'));var Mustache=require(_0xee58('0x7'));var util=require(_0xee58('0x8'));var path=require(_0xee58('0x9'));var sox=require(_0xee58('0xa'));var csv=require(_0xee58('0xb'));var ejs=require(_0xee58('0xc'));var fs=require('fs');var fs_extra=require(_0xee58('0xd'));var _=require(_0xee58('0xe'));var squel=require(_0xee58('0xf'));var crypto=require('crypto');var jsforce=require(_0xee58('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xee58('0xb'));var querystring=require(_0xee58('0x11'));var Papa=require(_0xee58('0x12'));var Redis=require(_0xee58('0x13'));var authService=require(_0xee58('0x14'));var qs=require(_0xee58('0x15'));var as=require(_0xee58('0x16'));var hardwareService=require(_0xee58('0x17'));var logger=require('../../config/logger')(_0xee58('0x18'));var utils=require(_0xee58('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee58('0x1a'))['db'];function respondWithStatusCode(_0x3c2045,_0x2f2c44){_0x2f2c44=_0x2f2c44||0xcc;return function(_0x421ff9){if(_0x421ff9){return _0x3c2045[_0xee58('0x1b')](_0x2f2c44);}return _0x3c2045[_0xee58('0x1c')](_0x2f2c44)[_0xee58('0x1d')]();};}function respondWithResult(_0x588327,_0x23c7af){_0x23c7af=_0x23c7af||0xc8;return function(_0x2c8aba){if(_0x2c8aba){return _0x588327['status'](_0x23c7af)['json'](_0x2c8aba);}};}function respondWithFilteredResult(_0x40a24f,_0x279551){return function(_0x3c0f8e){if(_0x3c0f8e){var _0x50fffe=typeof _0x279551[_0xee58('0x1e')]===_0xee58('0x1f')&&typeof _0x279551[_0xee58('0x20')]===_0xee58('0x1f');var _0x341c1d=_0x3c0f8e[_0xee58('0x21')];var _0x492354=_0x50fffe?0x0:_0x279551['offset'];var _0x466e70=_0x50fffe?_0x3c0f8e['count']:_0x279551[_0xee58('0x1e')]+_0x279551['limit'];var _0x1da573;if(_0x466e70>=_0x341c1d){_0x466e70=_0x341c1d;_0x1da573=0xc8;}else{_0x1da573=0xce;}_0x40a24f['status'](_0x1da573);return _0x40a24f[_0xee58('0x22')]('Content-Range',_0x492354+'-'+_0x466e70+'/'+_0x341c1d)[_0xee58('0x23')](_0x3c0f8e);}return null;};}function patchUpdates(_0x58c3a0){return function(_0x551f1d){try{jsonpatch[_0xee58('0x24')](_0x551f1d,_0x58c3a0,!![]);}catch(_0x2eeb5d){return BPromise[_0xee58('0x25')](_0x2eeb5d);}return _0x551f1d[_0xee58('0x26')]();};}function saveUpdates(_0x15b724,_0x3f20a3){return function(_0x2e34ec){if(_0x2e34ec){return _0x2e34ec[_0xee58('0x27')](_0x15b724)[_0xee58('0x28')](function(_0xe34d20){return _0xe34d20;});}return null;};}function removeEntity(_0x2f7d1c,_0x5a6f28){return function(_0x45fe2a){if(_0x45fe2a){return _0x45fe2a[_0xee58('0x29')]()[_0xee58('0x28')](function(){_0x2f7d1c[_0xee58('0x1c')](0xcc)[_0xee58('0x1d')]();});}};}function handleEntityNotFound(_0x170823,_0x45a930){return function(_0x1d2846){if(!_0x1d2846){_0x170823[_0xee58('0x1b')](0x194);}return _0x1d2846;};}function handleError(_0x12c9ac,_0x275453){_0x275453=_0x275453||0x1f4;return function(_0x34eea1){logger['error'](_0x34eea1[_0xee58('0x2a')]);if(_0x34eea1['name']){delete _0x34eea1['name'];}_0x12c9ac[_0xee58('0x1c')](_0x275453)[_0xee58('0x2b')](_0x34eea1);};}exports[_0xee58('0x2c')]=function(_0x41aa7c,_0x1ed6b1){var _0x3d3e33={},_0x331899={},_0x50c675={'count':0x0,'rows':[]};var _0x4de011=_[_0xee58('0x2d')](db[_0xee58('0x2e')][_0xee58('0x2f')],function(_0x15d7bb){return{'name':_0x15d7bb[_0xee58('0x30')],'type':_0x15d7bb[_0xee58('0x31')][_0xee58('0x32')]};});_0x331899[_0xee58('0x33')]=_[_0xee58('0x2d')](_0x4de011,_0xee58('0x34'));_0x331899[_0xee58('0x35')]=_['keys'](_0x41aa7c[_0xee58('0x35')]);_0x331899[_0xee58('0x36')]=_[_0xee58('0x37')](_0x331899[_0xee58('0x33')],_0x331899[_0xee58('0x35')]);_0x3d3e33['attributes']=_['intersection'](_0x331899[_0xee58('0x33')],qs[_0xee58('0x38')](_0x41aa7c['query']['fields']));_0x3d3e33[_0xee58('0x39')]=_0x3d3e33['attributes'][_0xee58('0x3a')]?_0x3d3e33[_0xee58('0x39')]:_0x331899[_0xee58('0x33')];if(!_0x41aa7c[_0xee58('0x35')][_0xee58('0x3b')](_0xee58('0x3c'))){_0x3d3e33['limit']=qs[_0xee58('0x20')](_0x41aa7c[_0xee58('0x35')][_0xee58('0x20')]);_0x3d3e33[_0xee58('0x1e')]=qs[_0xee58('0x1e')](_0x41aa7c[_0xee58('0x35')][_0xee58('0x1e')]);}_0x3d3e33[_0xee58('0x3d')]=qs['sort'](_0x41aa7c[_0xee58('0x35')]['sort']);_0x3d3e33['where']=qs[_0xee58('0x36')](_[_0xee58('0x3e')](_0x41aa7c[_0xee58('0x35')],_0x331899[_0xee58('0x36')]),_0x4de011);if(_0x41aa7c[_0xee58('0x35')]['filter']){_0x3d3e33[_0xee58('0x3f')]=_[_0xee58('0x40')](_0x3d3e33[_0xee58('0x3f')],{'$or':_[_0xee58('0x2d')](_0x4de011,function(_0x50c8b8){if(_0x50c8b8[_0xee58('0x31')]!==_0xee58('0x41')){var _0x3f8ba6={};_0x3f8ba6[_0x50c8b8['name']]={'$like':'%'+_0x41aa7c['query'][_0xee58('0x42')]+'%'};return _0x3f8ba6;}})});}_0x3d3e33=_['merge']({},_0x3d3e33,_0x41aa7c[_0xee58('0x43')]);var _0x35104f={'where':_0x3d3e33[_0xee58('0x3f')]};return db[_0xee58('0x2e')]['count'](_0x35104f)[_0xee58('0x28')](function(_0xcef11b){_0x50c675[_0xee58('0x21')]=_0xcef11b;if(_0x41aa7c['query']['includeAll']){_0x3d3e33[_0xee58('0x44')]=[{'all':!![]}];}return db[_0xee58('0x2e')][_0xee58('0x45')](_0x3d3e33);})[_0xee58('0x28')](function(_0x52fcd2){_0x50c675[_0xee58('0x46')]=_0x52fcd2;return _0x50c675;})[_0xee58('0x28')](respondWithFilteredResult(_0x1ed6b1,_0x3d3e33))[_0xee58('0x47')](handleError(_0x1ed6b1,null));};exports[_0xee58('0x48')]=function(_0xc09047,_0xc02b1a){var _0x23dd53={'raw':![],'where':{'id':_0xc09047[_0xee58('0x49')]['id']}},_0x535435={};_0x535435[_0xee58('0x33')]=_[_0xee58('0x4a')](db[_0xee58('0x2e')]['rawAttributes']);_0x535435[_0xee58('0x35')]=_[_0xee58('0x4a')](_0xc09047['query']);_0x535435[_0xee58('0x36')]=_['intersection'](_0x535435[_0xee58('0x33')],_0x535435[_0xee58('0x35')]);_0x23dd53[_0xee58('0x39')]=_['intersection'](_0x535435['model'],qs[_0xee58('0x38')](_0xc09047[_0xee58('0x35')]['fields']));_0x23dd53[_0xee58('0x39')]=_0x23dd53[_0xee58('0x39')][_0xee58('0x3a')]?_0x23dd53['attributes']:_0x535435[_0xee58('0x33')];if(_0xc09047[_0xee58('0x35')][_0xee58('0x4b')]){_0x23dd53[_0xee58('0x44')]=[{'all':!![]}];}_0x23dd53=_['merge']({},_0x23dd53,_0xc09047[_0xee58('0x43')]);return db[_0xee58('0x2e')]['find'](_0x23dd53)[_0xee58('0x28')](handleEntityNotFound(_0xc02b1a,null))['then'](respondWithResult(_0xc02b1a,null))[_0xee58('0x47')](handleError(_0xc02b1a,null));};exports[_0xee58('0x4c')]=function(_0x250719,_0x13f7b2){return db[_0xee58('0x2e')][_0xee58('0x4c')](_0x250719[_0xee58('0x4d')],{})[_0xee58('0x28')](respondWithResult(_0x13f7b2,0xc9))[_0xee58('0x47')](handleError(_0x13f7b2,null));};exports['bulkCreate']=function(_0x376e59,_0x297b81){return db[_0xee58('0x2e')][_0xee58('0x4e')](_0x376e59[_0xee58('0x4d')],{'raw':![],'individualHooks':!![]})[_0xee58('0x28')](respondWithResult(_0x297b81,0xc9))[_0xee58('0x47')](handleError(_0x297b81,null));};exports[_0xee58('0x27')]=function(_0x293a4b,_0x294d27){if(_0x293a4b[_0xee58('0x4d')]['id']){delete _0x293a4b[_0xee58('0x4d')]['id'];}return db[_0xee58('0x2e')]['find']({'where':{'id':_0x293a4b[_0xee58('0x49')]['id']}})[_0xee58('0x28')](handleEntityNotFound(_0x294d27,null))[_0xee58('0x28')](saveUpdates(_0x293a4b[_0xee58('0x4d')],null))[_0xee58('0x28')](respondWithResult(_0x294d27,null))[_0xee58('0x47')](handleError(_0x294d27,null));};exports[_0xee58('0x29')]=function(_0x1bf9cf,_0x38ba43){return db[_0xee58('0x2e')][_0xee58('0x4f')]({'where':{'id':_0x1bf9cf[_0xee58('0x49')]['id']}})[_0xee58('0x28')](handleEntityNotFound(_0x38ba43,null))[_0xee58('0x28')](removeEntity(_0x38ba43,null))[_0xee58('0x47')](handleError(_0x38ba43,null));};exports['bulkDestroy']=function(_0x4f8f84,_0xcc6325){return db['AnalyticFieldReport'][_0xee58('0x29')]({'where':{'id':_0x4f8f84[_0xee58('0x35')][_0xee58('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0xee58('0x28')](respondWithResult(_0xcc6325,0xcc))[_0xee58('0x47')](handleError(_0xcc6325,null));};exports['addFields']=function(_0x3ec882,_0x50ab8f,_0x57271f){return db[_0xee58('0x51')][_0xee58('0x52')]({'where':{'id':_0x3ec882[_0xee58('0x49')]['id']}})[_0xee58('0x28')](handleEntityNotFound(_0x50ab8f,null))[_0xee58('0x28')](function(_0x4973c6){if(_0x4973c6){return db[_0xee58('0x53')][_0xee58('0x54')](function(_0x4db651){return db[_0xee58('0x2e')][_0xee58('0x29')]({'where':{'CustomReportId':_0x3ec882[_0xee58('0x49')]['id']},'transaction':_0x4db651})[_0xee58('0x28')](function(_0x578686){var _0x1d2d53=_[_0xee58('0x2d')](_0x3ec882['body'],function(_0x524ac9){delete _0x524ac9['id'];_0x524ac9[_0xee58('0x55')]=_0x3ec882[_0xee58('0x49')]['id'];return _0x524ac9;});return db[_0xee58('0x2e')][_0xee58('0x4e')](_0x1d2d53,{'transaction':_0x4db651});});})[_0xee58('0x28')](function(){return db[_0xee58('0x2e')][_0xee58('0x45')]({'where':{'CustomReportId':_0x3ec882[_0xee58('0x49')]['id']}});});}})['then'](respondWithResult(_0x50ab8f,null))[_0xee58('0x47')](handleError(_0x50ab8f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b49ee07..2135300 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 _0xe050=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','util','../../config/logger','api'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xe050,0x97));var _0x0e05=function(_0x3d27b7,_0x6002f4){_0x3d27b7=_0x3d27b7-0x0;var _0x4173e4=_0xe050[_0x3d27b7];return _0x4173e4;};'use strict';var _=require('lodash');var util=require(_0x0e05('0x0'));var logger=require(_0x0e05('0x1'))(_0x0e05('0x2'));var moment=require(_0x0e05('0x3'));var BPromise=require(_0x0e05('0x4'));var rp=require(_0x0e05('0x5'));var fs=require('fs');var path=require(_0x0e05('0x6'));var rimraf=require(_0x0e05('0x7'));var config=require(_0x0e05('0x8'));var attributes=require(_0x0e05('0x9'));module[_0x0e05('0xa')]=function(_0x2ab82e,_0x5c7b8c){return _0x2ab82e['define']('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x736c=['bluebird','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x53a646,_0x565225){var _0x43a099=function(_0x7c585d){while(--_0x7c585d){_0x53a646['push'](_0x53a646['shift']());}};_0x43a099(++_0x565225);}(_0x736c,0xb0));var _0xc736=function(_0x5a435c,_0x455012){_0x5a435c=_0x5a435c-0x0;var _0x31a14f=_0x736c[_0x5a435c];return _0x31a14f;};'use strict';var _=require(_0xc736('0x0'));var util=require(_0xc736('0x1'));var logger=require(_0xc736('0x2'))(_0xc736('0x3'));var moment=require('moment');var BPromise=require(_0xc736('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc736('0x5'));var attributes=require(_0xc736('0x6'));module[_0xc736('0x7')]=function(_0x46bc05,_0x470b0f){return _0x46bc05['define'](_0xc736('0x8'),attributes,{'tableName':_0xc736('0x9'),'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 c344be4..d91c2b5 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 _0x4997=['../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','AnalyticFieldReport,\x20%s,\x20%s','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x4997,0xb8));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7499('0x0'));var util=require(_0x7499('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7499('0x2'));var fs=require('fs');var Redis=require(_0x7499('0x3'));var db=require(_0x7499('0x4'))['db'];var utils=require(_0x7499('0x5'));var logger=require('../../config/logger')(_0x7499('0x6'));var config=require(_0x7499('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7499('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x341bce,_0x3fb424,_0x242e70){return new BPromise(function(_0x163d5e,_0xf1ca2d){return client[_0x7499('0x9')](_0x341bce,_0x242e70)[_0x7499('0xa')](function(_0x5f0653){logger[_0x7499('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3fb424,_0x7499('0xc'));logger[_0x7499('0xd')](_0x7499('0xe'),_0x3fb424,_0x7499('0xc'),JSON[_0x7499('0xf')](_0x5f0653));if(_0x5f0653[_0x7499('0x10')]){if(_0x5f0653['error'][_0x7499('0x11')]===0x1f4){logger[_0x7499('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3fb424,_0x5f0653[_0x7499('0x10')][_0x7499('0x12')]);return _0xf1ca2d(_0x5f0653['error'][_0x7499('0x12')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3fb424,_0x5f0653[_0x7499('0x10')][_0x7499('0x12')]);return _0x163d5e(_0x5f0653[_0x7499('0x10')][_0x7499('0x12')]);}else{logger[_0x7499('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3fb424,_0x7499('0xc'));_0x163d5e(_0x5f0653[_0x7499('0x13')]['message']);}})['catch'](function(_0x2e8253){logger[_0x7499('0x10')](_0x7499('0x14'),_0x3fb424,_0x2e8253);_0xf1ca2d(_0x2e8253);});});} \ No newline at end of file +var _0xae7d=['jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xae7d,0x74));var _0xdae7=function(_0x288a8d,_0x567238){_0x288a8d=_0x288a8d-0x0;var _0x12ba10=_0xae7d[_0x288a8d];return _0x12ba10;};'use strict';var _=require(_0xdae7('0x0'));var util=require('util');var moment=require(_0xdae7('0x1'));var BPromise=require(_0xdae7('0x2'));var rs=require(_0xdae7('0x3'));var fs=require('fs');var Redis=require(_0xdae7('0x4'));var db=require(_0xdae7('0x5'))['db'];var utils=require(_0xdae7('0x6'));var logger=require(_0xdae7('0x7'))(_0xdae7('0x8'));var config=require('../../config/environment');var jayson=require(_0xdae7('0x9'));var client=jayson[_0xdae7('0xa')][_0xdae7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40d1b7,_0x58cad5,_0x5c4ed0){return new BPromise(function(_0xd7eda6,_0x1fd251){return client[_0xdae7('0xc')](_0x40d1b7,_0x5c4ed0)[_0xdae7('0xd')](function(_0x41c896){logger[_0xdae7('0xe')](_0xdae7('0xf'),_0x58cad5,_0xdae7('0x10'));logger[_0xdae7('0x11')](_0xdae7('0x12'),_0x58cad5,_0xdae7('0x10'),JSON[_0xdae7('0x13')](_0x41c896));if(_0x41c896[_0xdae7('0x14')]){if(_0x41c896[_0xdae7('0x14')][_0xdae7('0x15')]===0x1f4){logger['error'](_0xdae7('0xf'),_0x58cad5,_0x41c896[_0xdae7('0x14')]['message']);return _0x1fd251(_0x41c896[_0xdae7('0x14')][_0xdae7('0x16')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x58cad5,_0x41c896[_0xdae7('0x14')]['message']);return _0xd7eda6(_0x41c896[_0xdae7('0x14')]['message']);}else{logger[_0xdae7('0xe')](_0xdae7('0xf'),_0x58cad5,_0xdae7('0x10'));_0xd7eda6(_0x41c896[_0xdae7('0x17')][_0xdae7('0x16')]);}})[_0xdae7('0x18')](function(_0x236b02){logger['error'](_0xdae7('0xf'),_0x58cad5,_0x236b02);_0x1fd251(_0x236b02);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b6fa9f2..b854f2e 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(_0x3d0718,_0x4312ff){var _0x88c32b=function(_0x8d22c3){while(--_0x8d22c3){_0x3d0718['push'](_0x3d0718['shift']());}};_0x88c32b(++_0x4312ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x43494f,_0x8565ca){var _0x18093f=function(_0x16ff8d){while(--_0x16ff8d){_0x43494f['push'](_0x43494f['shift']());}};_0x18093f(++_0x8565ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 331be66..49060b8 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 _0x47fd=['TEXT','sequelize','exports','STRING','name'];(function(_0x473766,_0x46ead9){var _0x4d1e5a=function(_0x58b056){while(--_0x58b056){_0x473766['push'](_0x473766['shift']());}};_0x4d1e5a(++_0x46ead9);}(_0x47fd,0x13c));var _0xd47f=function(_0x348a50,_0xe211f1){_0x348a50=_0x348a50-0x0;var _0x29beb2=_0x47fd[_0x348a50];return _0x29beb2;};'use strict';var Sequelize=require(_0xd47f('0x0'));module[_0xd47f('0x1')]={'name':{'type':Sequelize[_0xd47f('0x2')],'allowNull':![],'unique':_0xd47f('0x3')},'table':{'type':Sequelize[_0xd47f('0x2')]},'metric':{'type':Sequelize[_0xd47f('0x4')]},'description':{'type':Sequelize[_0xd47f('0x2')]}}; \ No newline at end of file +var _0xc36d=['sequelize','exports','STRING','name','TEXT'];(function(_0x2ba735,_0x5998b5){var _0x378aa9=function(_0x3f5d9c){while(--_0x3f5d9c){_0x2ba735['push'](_0x2ba735['shift']());}};_0x378aa9(++_0x5998b5);}(_0xc36d,0x7d));var _0xdc36=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc36d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'name':{'type':Sequelize[_0xdc36('0x2')],'allowNull':![],'unique':_0xdc36('0x3')},'table':{'type':Sequelize[_0xdc36('0x2')]},'metric':{'type':Sequelize[_0xdc36('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 829c5d7..4387ac4 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 _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x84ab,0x12f));var _0xb84a=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x84ab[_0x296754];return _0x1d9f1d;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x262001,_0x29fe90){var _0x16b4bf=function(_0x498d4c){while(--_0x498d4c){_0x262001['push'](_0x262001['shift']());}};_0x16b4bf(++_0x29fe90);}(_0x9a19,0x114));var _0x99a1=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x9a19[_0x478414];return _0x5eb6b9;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b192ad1..ddf2224 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 _0x1115=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','AnalyticMetric','analytics_metrics','util','../../config/logger'];(function(_0x5edfcf,_0x2004eb){var _0x52e1ca=function(_0x1d9997){while(--_0x1d9997){_0x5edfcf['push'](_0x5edfcf['shift']());}};_0x52e1ca(++_0x2004eb);}(_0x1115,0x1b6));var _0x5111=function(_0x1fdbe8,_0x57b9e4){_0x1fdbe8=_0x1fdbe8-0x0;var _0x2b4f22=_0x1115[_0x1fdbe8];return _0x2b4f22;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var logger=require(_0x5111('0x1'))(_0x5111('0x2'));var moment=require(_0x5111('0x3'));var BPromise=require(_0x5111('0x4'));var rp=require(_0x5111('0x5'));var fs=require('fs');var path=require(_0x5111('0x6'));var rimraf=require(_0x5111('0x7'));var config=require(_0x5111('0x8'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x467c3a,_0x115ba7){return _0x467c3a['define'](_0x5111('0x9'),attributes,{'tableName':_0x5111('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2484=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x465af5,_0xc4b5c8){var _0x15c530=function(_0x2a10af){while(--_0x2a10af){_0x465af5['push'](_0x465af5['shift']());}};_0x15c530(++_0xc4b5c8);}(_0x2484,0x178));var _0x4248=function(_0x4fac58,_0x213b99){_0x4fac58=_0x4fac58-0x0;var _0x10e5d1=_0x2484[_0x4fac58];return _0x10e5d1;};'use strict';var _=require(_0x4248('0x0'));var util=require(_0x4248('0x1'));var logger=require('../../config/logger')(_0x4248('0x2'));var moment=require(_0x4248('0x3'));var BPromise=require(_0x4248('0x4'));var rp=require(_0x4248('0x5'));var fs=require('fs');var path=require(_0x4248('0x6'));var rimraf=require(_0x4248('0x7'));var config=require(_0x4248('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x4248('0x9')]=function(_0x2d220,_0x43e730){return _0x2d220[_0x4248('0xa')](_0x4248('0xb'),attributes,{'tableName':_0x4248('0xc'),'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 7d1ada6..16beda2 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 _0xa425=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x65e304,_0x151944){var _0x4c376f=function(_0x316f5f){while(--_0x316f5f){_0x65e304['push'](_0x65e304['shift']());}};_0x4c376f(++_0x151944);}(_0xa425,0x1af));var _0x5a42=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa425[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x5a42('0x0'));var util=require('util');var moment=require(_0x5a42('0x1'));var BPromise=require('bluebird');var rs=require(_0x5a42('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a42('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a42('0x4'))(_0x5a42('0x5'));var config=require(_0x5a42('0x6'));var jayson=require(_0x5a42('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e1f06,_0x1cc3bc,_0x3bfe0a){return new BPromise(function(_0x3d10e2,_0x1e1772){return client[_0x5a42('0x8')](_0x1e1f06,_0x3bfe0a)[_0x5a42('0x9')](function(_0x3f0cc8){logger[_0x5a42('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x1cc3bc,_0x5a42('0xb'));logger[_0x5a42('0xc')](_0x5a42('0xd'),_0x1cc3bc,_0x5a42('0xb'),JSON['stringify'](_0x3f0cc8));if(_0x3f0cc8[_0x5a42('0xe')]){if(_0x3f0cc8[_0x5a42('0xe')]['code']===0x1f4){logger[_0x5a42('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1cc3bc,_0x3f0cc8['error']['message']);return _0x1e1772(_0x3f0cc8[_0x5a42('0xe')][_0x5a42('0xf')]);}logger[_0x5a42('0xe')](_0x5a42('0x10'),_0x1cc3bc,_0x3f0cc8[_0x5a42('0xe')][_0x5a42('0xf')]);return _0x3d10e2(_0x3f0cc8['error'][_0x5a42('0xf')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x1cc3bc,_0x5a42('0xb'));_0x3d10e2(_0x3f0cc8[_0x5a42('0x11')][_0x5a42('0xf')]);}})[_0x5a42('0x12')](function(_0x1aa304){logger[_0x5a42('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1cc3bc,_0x1aa304);_0x1e1772(_0x1aa304);});});} \ No newline at end of file +var _0xa868=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','info'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xa868,0x66));var _0x8a86=function(_0x592416,_0x2c75e9){_0x592416=_0x592416-0x0;var _0x3005fa=_0xa868[_0x592416];return _0x3005fa;};'use strict';var _=require(_0x8a86('0x0'));var util=require(_0x8a86('0x1'));var moment=require(_0x8a86('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a86('0x3'));var fs=require('fs');var Redis=require(_0x8a86('0x4'));var db=require(_0x8a86('0x5'))['db'];var utils=require(_0x8a86('0x6'));var logger=require(_0x8a86('0x7'))(_0x8a86('0x8'));var config=require(_0x8a86('0x9'));var jayson=require(_0x8a86('0xa'));var client=jayson[_0x8a86('0xb')][_0x8a86('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd2b8c4,_0x332acb,_0x2be4d9){return new BPromise(function(_0x52ee3a,_0x5d813d){return client['request'](_0xd2b8c4,_0x2be4d9)[_0x8a86('0xd')](function(_0x3cde04){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x332acb,_0x8a86('0xe'));logger[_0x8a86('0xf')](_0x8a86('0x10'),_0x332acb,_0x8a86('0xe'),JSON[_0x8a86('0x11')](_0x3cde04));if(_0x3cde04['error']){if(_0x3cde04[_0x8a86('0x12')][_0x8a86('0x13')]===0x1f4){logger[_0x8a86('0x12')](_0x8a86('0x14'),_0x332acb,_0x3cde04['error']['message']);return _0x5d813d(_0x3cde04[_0x8a86('0x12')]['message']);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x332acb,_0x3cde04[_0x8a86('0x12')][_0x8a86('0x15')]);return _0x52ee3a(_0x3cde04[_0x8a86('0x12')]['message']);}else{logger[_0x8a86('0x16')](_0x8a86('0x14'),_0x332acb,_0x8a86('0xe'));_0x52ee3a(_0x3cde04[_0x8a86('0x17')][_0x8a86('0x15')]);}})[_0x8a86('0x18')](function(_0x5a7be8){logger[_0x8a86('0x12')](_0x8a86('0x14'),_0x332acb,_0x5a7be8);_0x5d813d(_0x5a7be8);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9b40bdc..4b0eaab 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 _0x0dec=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x215cbe,_0x24c464){var _0x20f281=function(_0x1ec394){while(--_0x1ec394){_0x215cbe['push'](_0x215cbe['shift']());}};_0x20f281(++_0x24c464);}(_0x0dec,0x11c));var _0xc0de=function(_0x153f67,_0x59061c){_0x153f67=_0x153f67-0x0;var _0x1f0c4f=_0x0dec[_0x153f67];return _0x1f0c4f;};'use strict';var multer=require(_0xc0de('0x0'));var util=require(_0xc0de('0x1'));var path=require(_0xc0de('0x2'));var timeout=require(_0xc0de('0x3'));var express=require('express');var router=express[_0xc0de('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc0de('0x5'));var config=require(_0xc0de('0x6'));var controller=require(_0xc0de('0x7'));router[_0xc0de('0x8')]('/',auth[_0xc0de('0x9')](),controller[_0xc0de('0xa')]);router[_0xc0de('0x8')](_0xc0de('0xb'),auth[_0xc0de('0x9')](),controller[_0xc0de('0xc')]);router[_0xc0de('0xd')]('/',auth[_0xc0de('0x9')](),controller[_0xc0de('0xe')]);router[_0xc0de('0xf')](_0xc0de('0xb'),auth[_0xc0de('0x9')](),controller[_0xc0de('0x10')]);router[_0xc0de('0x11')](_0xc0de('0xb'),auth[_0xc0de('0x9')](),controller[_0xc0de('0x12')]);module[_0xc0de('0x13')]=router; \ No newline at end of file +var _0xbcba=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id'];(function(_0x5e4d4d,_0x5a5aa6){var _0x40cbd6=function(_0x53c522){while(--_0x53c522){_0x5e4d4d['push'](_0x5e4d4d['shift']());}};_0x40cbd6(++_0x5a5aa6);}(_0xbcba,0x6d));var _0xabcb=function(_0x95ec49,_0x100ec9){_0x95ec49=_0x95ec49-0x0;var _0x5a241b=_0xbcba[_0x95ec49];return _0x5a241b;};'use strict';var multer=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var path=require('path');var timeout=require(_0xabcb('0x2'));var express=require(_0xabcb('0x3'));var router=express[_0xabcb('0x4')]();var fs_extra=require(_0xabcb('0x5'));var auth=require(_0xabcb('0x6'));var interaction=require(_0xabcb('0x7'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xabcb('0x8')]('/',auth[_0xabcb('0x9')](),controller['index']);router['get'](_0xabcb('0xa'),auth[_0xabcb('0x9')](),controller['show']);router['post']('/',auth[_0xabcb('0x9')](),controller['create']);router[_0xabcb('0xb')](_0xabcb('0xa'),auth[_0xabcb('0x9')](),controller[_0xabcb('0xc')]);router['delete'](_0xabcb('0xa'),auth[_0xabcb('0x9')](),controller[_0xabcb('0xd')]);module[_0xabcb('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ff1a4cf..ba25826 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 _0x2fca=['sequelize'];(function(_0x3a2010,_0x182353){var _0x171d95=function(_0x64f22a){while(--_0x64f22a){_0x3a2010['push'](_0x3a2010['shift']());}};_0x171d95(++_0x182353);}(_0x2fca,0x17a));var _0xa2fc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2fca[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xa2fc('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xbdc3=['exports','TEXT','sequelize'];(function(_0xee93d,_0xbfc866){var _0x3093d4=function(_0x5e6679){while(--_0x5e6679){_0xee93d['push'](_0xee93d['shift']());}};_0x3093d4(++_0xbfc866);}(_0xbdc3,0x1af));var _0x3bdc=function(_0x53a66b,_0x57b7df){_0x53a66b=_0x53a66b-0x0;var _0x3920e4=_0xbdc3[_0x53a66b];return _0x3920e4;};'use strict';var Sequelize=require(_0x3bdc('0x0'));module[_0x3bdc('0x1')]={'tree':{'type':Sequelize[_0x3bdc('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index fa0d9c8..041314b 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 _0x6430=['includeAll','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','params','AnalyticTreeReport','length'];(function(_0x3657e0,_0x1e57f9){var _0x39c002=function(_0x1bb873){while(--_0x1bb873){_0x3657e0['push'](_0x3657e0['shift']());}};_0x39c002(++_0x1e57f9);}(_0x6430,0xe3));var _0x0643=function(_0x41bcfa,_0x33c2f8){_0x41bcfa=_0x41bcfa-0x0;var _0x1ca030=_0x6430[_0x41bcfa];return _0x1ca030;};'use strict';var emlformat=require(_0x0643('0x0'));var rimraf=require(_0x0643('0x1'));var zipdir=require(_0x0643('0x2'));var jsonpatch=require(_0x0643('0x3'));var rp=require(_0x0643('0x4'));var moment=require(_0x0643('0x5'));var BPromise=require(_0x0643('0x6'));var Mustache=require(_0x0643('0x7'));var util=require(_0x0643('0x8'));var path=require('path');var sox=require(_0x0643('0x9'));var csv=require(_0x0643('0xa'));var ejs=require(_0x0643('0xb'));var fs=require('fs');var fs_extra=require(_0x0643('0xc'));var _=require(_0x0643('0xd'));var squel=require(_0x0643('0xe'));var crypto=require(_0x0643('0xf'));var jsforce=require(_0x0643('0x10'));var deskjs=require(_0x0643('0x11'));var toCsv=require(_0x0643('0xa'));var querystring=require(_0x0643('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0643('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0643('0x14'));var utils=require('../../config/utils');var config=require(_0x0643('0x15'));var licenseUtil=require(_0x0643('0x16'));var db=require(_0x0643('0x17'))['db'];function respondWithStatusCode(_0x3c65b3,_0x22048f){_0x22048f=_0x22048f||0xcc;return function(_0x1a959c){if(_0x1a959c){return _0x3c65b3[_0x0643('0x18')](_0x22048f);}return _0x3c65b3[_0x0643('0x19')](_0x22048f)['end']();};}function respondWithResult(_0x58f218,_0x36d539){_0x36d539=_0x36d539||0xc8;return function(_0x5cc46c){if(_0x5cc46c){return _0x58f218[_0x0643('0x19')](_0x36d539)['json'](_0x5cc46c);}};}function respondWithFilteredResult(_0x1fef6c,_0x331060){return function(_0x45f3c9){if(_0x45f3c9){var _0x14d436=typeof _0x331060[_0x0643('0x1a')]==='undefined'&&typeof _0x331060[_0x0643('0x1b')]===_0x0643('0x1c');var _0x270c3a=_0x45f3c9[_0x0643('0x1d')];var _0x1a7f9f=_0x14d436?0x0:_0x331060[_0x0643('0x1a')];var _0x2d246a=_0x14d436?_0x45f3c9['count']:_0x331060[_0x0643('0x1a')]+_0x331060['limit'];var _0x455406;if(_0x2d246a>=_0x270c3a){_0x2d246a=_0x270c3a;_0x455406=0xc8;}else{_0x455406=0xce;}_0x1fef6c[_0x0643('0x19')](_0x455406);return _0x1fef6c['set'](_0x0643('0x1e'),_0x1a7f9f+'-'+_0x2d246a+'/'+_0x270c3a)[_0x0643('0x1f')](_0x45f3c9);}return null;};}function patchUpdates(_0x2b2861){return function(_0x55c0bd){try{jsonpatch[_0x0643('0x20')](_0x55c0bd,_0x2b2861,!![]);}catch(_0x5d5d36){return BPromise[_0x0643('0x21')](_0x5d5d36);}return _0x55c0bd[_0x0643('0x22')]();};}function saveUpdates(_0x3aa050,_0x95c38a){return function(_0x24404b){if(_0x24404b){return _0x24404b['update'](_0x3aa050)[_0x0643('0x23')](function(_0x151540){return _0x151540;});}return null;};}function removeEntity(_0x3c525e,_0x3e3e8a){return function(_0x14966d){if(_0x14966d){return _0x14966d[_0x0643('0x24')]()[_0x0643('0x23')](function(){_0x3c525e[_0x0643('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a880,_0x1a0888){return function(_0x4e97a2){if(!_0x4e97a2){_0x23a880['sendStatus'](0x194);}return _0x4e97a2;};}function handleError(_0x461d9b,_0x2a672c){_0x2a672c=_0x2a672c||0x1f4;return function(_0x4eea45){logger['error'](_0x4eea45[_0x0643('0x25')]);if(_0x4eea45[_0x0643('0x26')]){delete _0x4eea45[_0x0643('0x26')];}_0x461d9b[_0x0643('0x19')](_0x2a672c)[_0x0643('0x27')](_0x4eea45);};}exports[_0x0643('0x28')]=function(_0x5df0b2,_0x1ebd99){var _0x1b0d59={},_0x4857af={},_0x1dc267={'count':0x0,'rows':[]};var _0xa75d34=_[_0x0643('0x29')](db['AnalyticTreeReport'][_0x0643('0x2a')],function(_0x5020c7){return{'name':_0x5020c7['fieldName'],'type':_0x5020c7['type'][_0x0643('0x2b')]};});_0x4857af[_0x0643('0x2c')]=_['map'](_0xa75d34,_0x0643('0x26'));_0x4857af[_0x0643('0x2d')]=_[_0x0643('0x2e')](_0x5df0b2[_0x0643('0x2d')]);_0x4857af[_0x0643('0x2f')]=_[_0x0643('0x30')](_0x4857af['model'],_0x4857af[_0x0643('0x2d')]);_0x1b0d59['attributes']=_['intersection'](_0x4857af[_0x0643('0x2c')],qs['fields'](_0x5df0b2[_0x0643('0x2d')][_0x0643('0x31')]));_0x1b0d59[_0x0643('0x32')]=_0x1b0d59[_0x0643('0x32')]['length']?_0x1b0d59['attributes']:_0x4857af['model'];if(!_0x5df0b2['query'][_0x0643('0x33')](_0x0643('0x34'))){_0x1b0d59[_0x0643('0x1b')]=qs[_0x0643('0x1b')](_0x5df0b2[_0x0643('0x2d')]['limit']);_0x1b0d59[_0x0643('0x1a')]=qs['offset'](_0x5df0b2[_0x0643('0x2d')][_0x0643('0x1a')]);}_0x1b0d59[_0x0643('0x35')]=qs['sort'](_0x5df0b2['query'][_0x0643('0x36')]);_0x1b0d59['where']=qs['filters'](_[_0x0643('0x37')](_0x5df0b2[_0x0643('0x2d')],_0x4857af[_0x0643('0x2f')]),_0xa75d34);if(_0x5df0b2[_0x0643('0x2d')]['filter']){_0x1b0d59[_0x0643('0x38')]=_[_0x0643('0x39')](_0x1b0d59[_0x0643('0x38')],{'$or':_['map'](_0xa75d34,function(_0x307bc8){if(_0x307bc8[_0x0643('0x3a')]!==_0x0643('0x3b')){var _0x539eb6={};_0x539eb6[_0x307bc8[_0x0643('0x26')]]={'$like':'%'+_0x5df0b2[_0x0643('0x2d')][_0x0643('0x3c')]+'%'};return _0x539eb6;}})});}_0x1b0d59=_[_0x0643('0x39')]({},_0x1b0d59,_0x5df0b2[_0x0643('0x3d')]);var _0x29701a={'where':_0x1b0d59[_0x0643('0x38')]};return db['AnalyticTreeReport']['count'](_0x29701a)[_0x0643('0x23')](function(_0x38f790){_0x1dc267[_0x0643('0x1d')]=_0x38f790;if(_0x5df0b2[_0x0643('0x2d')]['includeAll']){_0x1b0d59[_0x0643('0x3e')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x0643('0x3f')](_0x1b0d59);})[_0x0643('0x23')](function(_0x24700d){_0x1dc267[_0x0643('0x40')]=_0x24700d;return _0x1dc267;})[_0x0643('0x23')](respondWithFilteredResult(_0x1ebd99,_0x1b0d59))[_0x0643('0x41')](handleError(_0x1ebd99,null));};exports['show']=function(_0x1bc566,_0x6cf0b4){var _0x1fa000={'raw':!![],'where':{'id':_0x1bc566[_0x0643('0x42')]['id']}},_0x16d9a1={};_0x16d9a1['model']=_[_0x0643('0x2e')](db[_0x0643('0x43')][_0x0643('0x2a')]);_0x16d9a1[_0x0643('0x2d')]=_[_0x0643('0x2e')](_0x1bc566[_0x0643('0x2d')]);_0x16d9a1['filters']=_[_0x0643('0x30')](_0x16d9a1['model'],_0x16d9a1[_0x0643('0x2d')]);_0x1fa000[_0x0643('0x32')]=_['intersection'](_0x16d9a1['model'],qs[_0x0643('0x31')](_0x1bc566['query'][_0x0643('0x31')]));_0x1fa000['attributes']=_0x1fa000[_0x0643('0x32')][_0x0643('0x44')]?_0x1fa000['attributes']:_0x16d9a1['model'];if(_0x1bc566[_0x0643('0x2d')][_0x0643('0x45')]){_0x1fa000[_0x0643('0x3e')]=[{'all':!![]}];}_0x1fa000=_[_0x0643('0x39')]({},_0x1fa000,_0x1bc566[_0x0643('0x3d')]);return db['AnalyticTreeReport'][_0x0643('0x46')](_0x1fa000)[_0x0643('0x23')](handleEntityNotFound(_0x6cf0b4,null))[_0x0643('0x23')](respondWithResult(_0x6cf0b4,null))[_0x0643('0x41')](handleError(_0x6cf0b4,null));};exports[_0x0643('0x47')]=function(_0xbba92c,_0x3f16bb){return db['AnalyticTreeReport'][_0x0643('0x47')](_0xbba92c[_0x0643('0x48')],{})[_0x0643('0x23')](respondWithResult(_0x3f16bb,0xc9))[_0x0643('0x41')](handleError(_0x3f16bb,null));};exports[_0x0643('0x49')]=function(_0x47fd83,_0x32b191){if(_0x47fd83['body']['id']){delete _0x47fd83[_0x0643('0x48')]['id'];}return db['AnalyticTreeReport'][_0x0643('0x46')]({'where':{'id':_0x47fd83[_0x0643('0x42')]['id']}})['then'](handleEntityNotFound(_0x32b191,null))[_0x0643('0x23')](saveUpdates(_0x47fd83['body'],null))[_0x0643('0x23')](respondWithResult(_0x32b191,null))[_0x0643('0x41')](handleError(_0x32b191,null));};exports[_0x0643('0x24')]=function(_0x16a75e,_0x3713fd){return db[_0x0643('0x43')][_0x0643('0x46')]({'where':{'id':_0x16a75e[_0x0643('0x42')]['id']}})[_0x0643('0x23')](handleEntityNotFound(_0x3713fd,null))[_0x0643('0x23')](removeEntity(_0x3713fd,null))[_0x0643('0x41')](handleError(_0x3713fd,null));}; \ No newline at end of file +var _0x27c1=['error','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','name','options','findAll','rows','catch','show','length','includeAll','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0x27c1,0x6e));var _0x127c=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x27c1[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require(_0x127c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x127c('0x1'));var jsonpatch=require(_0x127c('0x2'));var rp=require(_0x127c('0x3'));var moment=require(_0x127c('0x4'));var BPromise=require(_0x127c('0x5'));var Mustache=require(_0x127c('0x6'));var util=require(_0x127c('0x7'));var path=require(_0x127c('0x8'));var sox=require('sox');var csv=require(_0x127c('0x9'));var ejs=require(_0x127c('0xa'));var fs=require('fs');var fs_extra=require(_0x127c('0xb'));var _=require(_0x127c('0xc'));var squel=require(_0x127c('0xd'));var crypto=require(_0x127c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x127c('0x9'));var querystring=require(_0x127c('0xf'));var Papa=require('papaparse');var Redis=require(_0x127c('0x10'));var authService=require(_0x127c('0x11'));var qs=require(_0x127c('0x12'));var as=require(_0x127c('0x13'));var hardwareService=require(_0x127c('0x14'));var logger=require(_0x127c('0x15'))('api');var utils=require(_0x127c('0x16'));var config=require(_0x127c('0x17'));var licenseUtil=require(_0x127c('0x18'));var db=require(_0x127c('0x19'))['db'];function respondWithStatusCode(_0x12bf26,_0x4aa98c){_0x4aa98c=_0x4aa98c||0xcc;return function(_0xb88418){if(_0xb88418){return _0x12bf26[_0x127c('0x1a')](_0x4aa98c);}return _0x12bf26[_0x127c('0x1b')](_0x4aa98c)[_0x127c('0x1c')]();};}function respondWithResult(_0x391425,_0x495a5c){_0x495a5c=_0x495a5c||0xc8;return function(_0x2f2c89){if(_0x2f2c89){return _0x391425[_0x127c('0x1b')](_0x495a5c)[_0x127c('0x1d')](_0x2f2c89);}};}function respondWithFilteredResult(_0x1c371e,_0x4689cc){return function(_0x13672f){if(_0x13672f){var _0x4aef5d=typeof _0x4689cc[_0x127c('0x1e')]==='undefined'&&typeof _0x4689cc[_0x127c('0x1f')]==='undefined';var _0x58f5e4=_0x13672f[_0x127c('0x20')];var _0x4d0f46=_0x4aef5d?0x0:_0x4689cc[_0x127c('0x1e')];var _0xb400c3=_0x4aef5d?_0x13672f['count']:_0x4689cc[_0x127c('0x1e')]+_0x4689cc['limit'];var _0x4071f9;if(_0xb400c3>=_0x58f5e4){_0xb400c3=_0x58f5e4;_0x4071f9=0xc8;}else{_0x4071f9=0xce;}_0x1c371e[_0x127c('0x1b')](_0x4071f9);return _0x1c371e['set'](_0x127c('0x21'),_0x4d0f46+'-'+_0xb400c3+'/'+_0x58f5e4)[_0x127c('0x1d')](_0x13672f);}return null;};}function patchUpdates(_0x78c715){return function(_0x59e4eb){try{jsonpatch[_0x127c('0x22')](_0x59e4eb,_0x78c715,!![]);}catch(_0x7725d2){return BPromise[_0x127c('0x23')](_0x7725d2);}return _0x59e4eb[_0x127c('0x24')]();};}function saveUpdates(_0x367f0c,_0x5bb030){return function(_0x13a9f5){if(_0x13a9f5){return _0x13a9f5[_0x127c('0x25')](_0x367f0c)[_0x127c('0x26')](function(_0x30562d){return _0x30562d;});}return null;};}function removeEntity(_0xdc81eb,_0x1291b8){return function(_0x2a1eb1){if(_0x2a1eb1){return _0x2a1eb1[_0x127c('0x27')]()[_0x127c('0x26')](function(){_0xdc81eb['status'](0xcc)[_0x127c('0x1c')]();});}};}function handleEntityNotFound(_0x8577d9,_0x12580a){return function(_0x20384c){if(!_0x20384c){_0x8577d9[_0x127c('0x1a')](0x194);}return _0x20384c;};}function handleError(_0x58b389,_0x2f9db7){_0x2f9db7=_0x2f9db7||0x1f4;return function(_0x12c590){logger[_0x127c('0x28')](_0x12c590['stack']);if(_0x12c590['name']){delete _0x12c590['name'];}_0x58b389[_0x127c('0x1b')](_0x2f9db7)[_0x127c('0x29')](_0x12c590);};}exports[_0x127c('0x2a')]=function(_0x24f632,_0x269993){var _0x1c3d19={},_0x4b0573={},_0x5d578d={'count':0x0,'rows':[]};var _0x4397ed=_[_0x127c('0x2b')](db[_0x127c('0x2c')][_0x127c('0x2d')],function(_0x59768e){return{'name':_0x59768e[_0x127c('0x2e')],'type':_0x59768e[_0x127c('0x2f')][_0x127c('0x30')]};});_0x4b0573['model']=_['map'](_0x4397ed,'name');_0x4b0573[_0x127c('0x31')]=_[_0x127c('0x32')](_0x24f632[_0x127c('0x31')]);_0x4b0573[_0x127c('0x33')]=_[_0x127c('0x34')](_0x4b0573[_0x127c('0x35')],_0x4b0573[_0x127c('0x31')]);_0x1c3d19[_0x127c('0x36')]=_[_0x127c('0x34')](_0x4b0573[_0x127c('0x35')],qs[_0x127c('0x37')](_0x24f632[_0x127c('0x31')][_0x127c('0x37')]));_0x1c3d19['attributes']=_0x1c3d19['attributes']['length']?_0x1c3d19[_0x127c('0x36')]:_0x4b0573[_0x127c('0x35')];if(!_0x24f632[_0x127c('0x31')][_0x127c('0x38')](_0x127c('0x39'))){_0x1c3d19[_0x127c('0x1f')]=qs[_0x127c('0x1f')](_0x24f632[_0x127c('0x31')][_0x127c('0x1f')]);_0x1c3d19[_0x127c('0x1e')]=qs['offset'](_0x24f632['query'][_0x127c('0x1e')]);}_0x1c3d19[_0x127c('0x3a')]=qs['sort'](_0x24f632['query']['sort']);_0x1c3d19[_0x127c('0x3b')]=qs[_0x127c('0x33')](_[_0x127c('0x3c')](_0x24f632['query'],_0x4b0573['filters']),_0x4397ed);if(_0x24f632[_0x127c('0x31')]['filter']){_0x1c3d19[_0x127c('0x3b')]=_[_0x127c('0x3d')](_0x1c3d19[_0x127c('0x3b')],{'$or':_[_0x127c('0x2b')](_0x4397ed,function(_0x513c58){if(_0x513c58[_0x127c('0x2f')]!==_0x127c('0x3e')){var _0x100a17={};_0x100a17[_0x513c58[_0x127c('0x3f')]]={'$like':'%'+_0x24f632['query']['filter']+'%'};return _0x100a17;}})});}_0x1c3d19=_[_0x127c('0x3d')]({},_0x1c3d19,_0x24f632[_0x127c('0x40')]);var _0x5d8c82={'where':_0x1c3d19['where']};return db[_0x127c('0x2c')]['count'](_0x5d8c82)[_0x127c('0x26')](function(_0x47027e){_0x5d578d[_0x127c('0x20')]=_0x47027e;if(_0x24f632[_0x127c('0x31')]['includeAll']){_0x1c3d19['include']=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x127c('0x41')](_0x1c3d19);})['then'](function(_0x18afaa){_0x5d578d[_0x127c('0x42')]=_0x18afaa;return _0x5d578d;})['then'](respondWithFilteredResult(_0x269993,_0x1c3d19))[_0x127c('0x43')](handleError(_0x269993,null));};exports[_0x127c('0x44')]=function(_0x20101f,_0x2ea0a0){var _0x4fc8d7={'raw':!![],'where':{'id':_0x20101f['params']['id']}},_0x5b0cd2={};_0x5b0cd2[_0x127c('0x35')]=_['keys'](db['AnalyticTreeReport'][_0x127c('0x2d')]);_0x5b0cd2[_0x127c('0x31')]=_[_0x127c('0x32')](_0x20101f[_0x127c('0x31')]);_0x5b0cd2[_0x127c('0x33')]=_['intersection'](_0x5b0cd2['model'],_0x5b0cd2['query']);_0x4fc8d7[_0x127c('0x36')]=_[_0x127c('0x34')](_0x5b0cd2[_0x127c('0x35')],qs[_0x127c('0x37')](_0x20101f['query'][_0x127c('0x37')]));_0x4fc8d7[_0x127c('0x36')]=_0x4fc8d7[_0x127c('0x36')][_0x127c('0x45')]?_0x4fc8d7[_0x127c('0x36')]:_0x5b0cd2[_0x127c('0x35')];if(_0x20101f[_0x127c('0x31')][_0x127c('0x46')]){_0x4fc8d7[_0x127c('0x47')]=[{'all':!![]}];}_0x4fc8d7=_[_0x127c('0x3d')]({},_0x4fc8d7,_0x20101f[_0x127c('0x40')]);return db[_0x127c('0x2c')][_0x127c('0x48')](_0x4fc8d7)['then'](handleEntityNotFound(_0x2ea0a0,null))[_0x127c('0x26')](respondWithResult(_0x2ea0a0,null))['catch'](handleError(_0x2ea0a0,null));};exports['create']=function(_0x555a63,_0x59d034){return db[_0x127c('0x2c')][_0x127c('0x49')](_0x555a63[_0x127c('0x4a')],{})['then'](respondWithResult(_0x59d034,0xc9))[_0x127c('0x43')](handleError(_0x59d034,null));};exports[_0x127c('0x25')]=function(_0x7f4d5b,_0xcc907f){if(_0x7f4d5b[_0x127c('0x4a')]['id']){delete _0x7f4d5b[_0x127c('0x4a')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x7f4d5b['params']['id']}})[_0x127c('0x26')](handleEntityNotFound(_0xcc907f,null))[_0x127c('0x26')](saveUpdates(_0x7f4d5b[_0x127c('0x4a')],null))[_0x127c('0x26')](respondWithResult(_0xcc907f,null))[_0x127c('0x43')](handleError(_0xcc907f,null));};exports['destroy']=function(_0x351125,_0x24b630){return db['AnalyticTreeReport'][_0x127c('0x48')]({'where':{'id':_0x351125['params']['id']}})[_0x127c('0x26')](handleEntityNotFound(_0x24b630,null))[_0x127c('0x26')](removeEntity(_0x24b630,null))[_0x127c('0x43')](handleError(_0x24b630,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ce84575..96e2dbc 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 _0x5417=['rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x395512,_0x1e9614){var _0x556c2c=function(_0x7fddef){while(--_0x7fddef){_0x395512['push'](_0x395512['shift']());}};_0x556c2c(++_0x1e9614);}(_0x5417,0x10a));var _0x7541=function(_0x464086,_0x363367){_0x464086=_0x464086-0x0;var _0x4133c9=_0x5417[_0x464086];return _0x4133c9;};'use strict';var _=require(_0x7541('0x0'));var util=require(_0x7541('0x1'));var logger=require(_0x7541('0x2'))(_0x7541('0x3'));var moment=require(_0x7541('0x4'));var BPromise=require(_0x7541('0x5'));var rp=require(_0x7541('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7541('0x7'));var config=require(_0x7541('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x7541('0x9')]=function(_0x1f0fa5,_0x1b2a75){return _0x1f0fa5[_0x7541('0xa')](_0x7541('0xb'),attributes,{'tableName':_0x7541('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95b3=['rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2a2754,_0x161884){var _0x12f580=function(_0x48a3e1){while(--_0x48a3e1){_0x2a2754['push'](_0x2a2754['shift']());}};_0x12f580(++_0x161884);}(_0x95b3,0x1e7));var _0x395b=function(_0x58d01d,_0x451014){_0x58d01d=_0x58d01d-0x0;var _0x456518=_0x95b3[_0x58d01d];return _0x456518;};'use strict';var _=require(_0x395b('0x0'));var util=require(_0x395b('0x1'));var logger=require(_0x395b('0x2'))(_0x395b('0x3'));var moment=require(_0x395b('0x4'));var BPromise=require('bluebird');var rp=require(_0x395b('0x5'));var fs=require('fs');var path=require(_0x395b('0x6'));var rimraf=require(_0x395b('0x7'));var config=require(_0x395b('0x8'));var attributes=require(_0x395b('0x9'));module['exports']=function(_0x4825a8,_0x2f2a48){return _0x4825a8[_0x395b('0xa')](_0x395b('0xb'),attributes,{'tableName':_0x395b('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 233b04c..2d9e2cd 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x42ef3e,_0x2846f1){var _0x28075f=function(_0x3a018b){while(--_0x3a018b){_0x42ef3e['push'](_0x42ef3e['shift']());}};_0x28075f(++_0x2846f1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2647d0,_0x276837){var _0x361dfa=function(_0x3ed79d){while(--_0x3ed79d){_0x2647d0['push'](_0x2647d0['shift']());}};_0x361dfa(++_0x276837);}(_0x5f2f,0x73));var _0xf5f2=function(_0x197268,_0x16634c){_0x197268=_0x197268-0x0;var _0x4e61e7=_0x5f2f[_0x197268];return _0x4e61e7;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a19d394..2936c7a 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 _0x8743=['show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0xe02e8b,_0x23ac2d){var _0x24ed50=function(_0x1f3188){while(--_0x1f3188){_0xe02e8b['push'](_0xe02e8b['shift']());}};_0x24ed50(++_0x23ac2d);}(_0x8743,0x6b));var _0x3874=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8743[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x3874('0x0'));var util=require('util');var path=require(_0x3874('0x1'));var timeout=require(_0x3874('0x2'));var express=require(_0x3874('0x3'));var router=express[_0x3874('0x4')]();var fs_extra=require(_0x3874('0x5'));var auth=require(_0x3874('0x6'));var interaction=require(_0x3874('0x7'));var config=require(_0x3874('0x8'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x3874('0x9')](),controller[_0x3874('0xa')]);router[_0x3874('0xb')](_0x3874('0xc'),auth[_0x3874('0x9')](),controller[_0x3874('0xd')]);router[_0x3874('0xe')]('/',auth[_0x3874('0x9')](),controller[_0x3874('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3874('0x10')]);router[_0x3874('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3874('0x12')]);module[_0x3874('0x13')]=router; \ No newline at end of file +var _0x3a10=['show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x44c0d2,_0x4e6b03){var _0x2e8743=function(_0x16f68d){while(--_0x16f68d){_0x44c0d2['push'](_0x44c0d2['shift']());}};_0x2e8743(++_0x4e6b03);}(_0x3a10,0x1ad));var _0x03a1=function(_0x2454e8,_0xe6f8c6){_0x2454e8=_0x2454e8-0x0;var _0x1593e3=_0x3a10[_0x2454e8];return _0x1593e3;};'use strict';var multer=require('multer');var util=require(_0x03a1('0x0'));var path=require(_0x03a1('0x1'));var timeout=require(_0x03a1('0x2'));var express=require(_0x03a1('0x3'));var router=express[_0x03a1('0x4')]();var fs_extra=require(_0x03a1('0x5'));var auth=require(_0x03a1('0x6'));var interaction=require(_0x03a1('0x7'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x03a1('0x8')]('/',auth[_0x03a1('0x9')](),controller[_0x03a1('0xa')]);router[_0x03a1('0x8')]('/:id',auth[_0x03a1('0x9')](),controller[_0x03a1('0xb')]);router[_0x03a1('0xc')]('/',auth[_0x03a1('0x9')](),controller[_0x03a1('0xd')]);router[_0x03a1('0xe')](_0x03a1('0xf'),auth[_0x03a1('0x9')](),controller[_0x03a1('0x10')]);router[_0x03a1('0x11')]('/:id',auth[_0x03a1('0x9')](),controller[_0x03a1('0x12')]);module[_0x03a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c4155f7..059f895 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 _0xfc1e=['STRING'];(function(_0x425d5e,_0x3b9040){var _0x3cc67b=function(_0x121446){while(--_0x121446){_0x425d5e['push'](_0x425d5e['shift']());}};_0x3cc67b(++_0x3b9040);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xfc1e[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xefc1('0x0')]},'type':{'type':Sequelize[_0xefc1('0x0')]}}; \ No newline at end of file +var _0x5eb8=['STRING','exports'];(function(_0x3b62c2,_0x2e3236){var _0x274e6a=function(_0xed66){while(--_0xed66){_0x3b62c2['push'](_0x3b62c2['shift']());}};_0x274e6a(++_0x2e3236);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x5944e9,_0xf3da60){_0x5944e9=_0x5944e9-0x0;var _0x1098b8=_0x5eb8[_0x5944e9];return _0x1098b8;};'use strict';var Sequelize=require('sequelize');module[_0x85eb('0x0')]={'name':{'type':Sequelize[_0x85eb('0x1')]},'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 ac69ff7..2c218db 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 _0x1298=['error','name','send','index','map','Attachment','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','get','omit','body','createdAt','updatedAt','create','find','originalname','basename','file','filename','mimetype','download','ChatOfflineMessageId','root','server/files/attachments/','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x4b548c,_0x142a2c){var _0x396394=function(_0x17e03a){while(--_0x17e03a){_0x4b548c['push'](_0x4b548c['shift']());}};_0x396394(++_0x142a2c);}(_0x1298,0x140));var _0x8129=function(_0x1f69c3,_0xd24681){_0x1f69c3=_0x1f69c3-0x0;var _0x4842fb=_0x1298[_0x1f69c3];return _0x4842fb;};'use strict';var emlformat=require(_0x8129('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8129('0x1'));var jsonpatch=require(_0x8129('0x2'));var rp=require(_0x8129('0x3'));var moment=require(_0x8129('0x4'));var BPromise=require(_0x8129('0x5'));var Mustache=require(_0x8129('0x6'));var util=require('util');var path=require(_0x8129('0x7'));var sox=require(_0x8129('0x8'));var csv=require(_0x8129('0x9'));var ejs=require(_0x8129('0xa'));var fs=require('fs');var fs_extra=require(_0x8129('0xb'));var _=require(_0x8129('0xc'));var squel=require(_0x8129('0xd'));var crypto=require(_0x8129('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8129('0x9'));var querystring=require(_0x8129('0xf'));var Papa=require('papaparse');var Redis=require(_0x8129('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8129('0x11'));var as=require(_0x8129('0x12'));var hardwareService=require(_0x8129('0x13'));var logger=require(_0x8129('0x14'))(_0x8129('0x15'));var utils=require('../../config/utils');var config=require(_0x8129('0x16'));var licenseUtil=require(_0x8129('0x17'));var db=require(_0x8129('0x18'))['db'];function respondWithStatusCode(_0x3607dd,_0x1d96bc){_0x1d96bc=_0x1d96bc||0xcc;return function(_0x2d1a44){if(_0x2d1a44){return _0x3607dd[_0x8129('0x19')](_0x1d96bc);}return _0x3607dd[_0x8129('0x1a')](_0x1d96bc)[_0x8129('0x1b')]();};}function respondWithResult(_0xa104a5,_0x50813f){_0x50813f=_0x50813f||0xc8;return function(_0x2c6d27){if(_0x2c6d27){return _0xa104a5['status'](_0x50813f)[_0x8129('0x1c')](_0x2c6d27);}};}function respondWithFilteredResult(_0x5ecfaa,_0x1953f2){return function(_0x9d09b6){if(_0x9d09b6){var _0x1981b6=typeof _0x1953f2[_0x8129('0x1d')]===_0x8129('0x1e')&&typeof _0x1953f2['limit']==='undefined';var _0x4248f3=_0x9d09b6[_0x8129('0x1f')];var _0x12e1a7=_0x1981b6?0x0:_0x1953f2[_0x8129('0x1d')];var _0x52ed9a=_0x1981b6?_0x9d09b6[_0x8129('0x1f')]:_0x1953f2['offset']+_0x1953f2[_0x8129('0x20')];var _0x3ea3a4;if(_0x52ed9a>=_0x4248f3){_0x52ed9a=_0x4248f3;_0x3ea3a4=0xc8;}else{_0x3ea3a4=0xce;}_0x5ecfaa[_0x8129('0x1a')](_0x3ea3a4);return _0x5ecfaa[_0x8129('0x21')](_0x8129('0x22'),_0x12e1a7+'-'+_0x52ed9a+'/'+_0x4248f3)['json'](_0x9d09b6);}return null;};}function patchUpdates(_0x20c142){return function(_0x3439ee){try{jsonpatch[_0x8129('0x23')](_0x3439ee,_0x20c142,!![]);}catch(_0xff04d7){return BPromise[_0x8129('0x24')](_0xff04d7);}return _0x3439ee['save']();};}function saveUpdates(_0x1a0389,_0x24c7da){return function(_0x26ee2c){if(_0x26ee2c){return _0x26ee2c[_0x8129('0x25')](_0x1a0389)[_0x8129('0x26')](function(_0x296701){return _0x296701;});}return null;};}function removeEntity(_0xe1ca26,_0x4a2f60){return function(_0x302727){if(_0x302727){return _0x302727[_0x8129('0x27')]()['then'](function(){_0xe1ca26[_0x8129('0x1a')](0xcc)[_0x8129('0x1b')]();});}};}function handleEntityNotFound(_0x52f50b,_0x32294e){return function(_0x1282c1){if(!_0x1282c1){_0x52f50b[_0x8129('0x19')](0x194);}return _0x1282c1;};}function handleError(_0x5454ef,_0x4f31b7){_0x4f31b7=_0x4f31b7||0x1f4;return function(_0x205e11){logger[_0x8129('0x28')](_0x205e11['stack']);if(_0x205e11['name']){delete _0x205e11[_0x8129('0x29')];}_0x5454ef[_0x8129('0x1a')](_0x4f31b7)[_0x8129('0x2a')](_0x205e11);};}exports[_0x8129('0x2b')]=function(_0x11b408,_0x20f2aa){var _0x30ea60={},_0x2cee84={},_0x4846ad={'count':0x0,'rows':[]};var _0x570158=_[_0x8129('0x2c')](db[_0x8129('0x2d')]['rawAttributes'],function(_0x5e898d){return{'name':_0x5e898d[_0x8129('0x2e')],'type':_0x5e898d[_0x8129('0x2f')][_0x8129('0x30')]};});_0x2cee84[_0x8129('0x31')]=_[_0x8129('0x2c')](_0x570158,_0x8129('0x29'));_0x2cee84['query']=_['keys'](_0x11b408[_0x8129('0x32')]);_0x2cee84['filters']=_[_0x8129('0x33')](_0x2cee84[_0x8129('0x31')],_0x2cee84[_0x8129('0x32')]);_0x30ea60[_0x8129('0x34')]=_[_0x8129('0x33')](_0x2cee84[_0x8129('0x31')],qs[_0x8129('0x35')](_0x11b408['query'][_0x8129('0x35')]));_0x30ea60['attributes']=_0x30ea60[_0x8129('0x34')][_0x8129('0x36')]?_0x30ea60[_0x8129('0x34')]:_0x2cee84[_0x8129('0x31')];if(!_0x11b408['query'][_0x8129('0x37')]('nolimit')){_0x30ea60[_0x8129('0x20')]=qs[_0x8129('0x20')](_0x11b408['query'][_0x8129('0x20')]);_0x30ea60[_0x8129('0x1d')]=qs[_0x8129('0x1d')](_0x11b408[_0x8129('0x32')][_0x8129('0x1d')]);}_0x30ea60['order']=qs[_0x8129('0x38')](_0x11b408['query'][_0x8129('0x38')]);_0x30ea60[_0x8129('0x39')]=qs['filters'](_[_0x8129('0x3a')](_0x11b408[_0x8129('0x32')],_0x2cee84[_0x8129('0x3b')]),_0x570158);if(_0x11b408['query'][_0x8129('0x3c')]){_0x30ea60['where']=_[_0x8129('0x3d')](_0x30ea60['where'],{'$or':_[_0x8129('0x2c')](_0x570158,function(_0x207b34){if(_0x207b34[_0x8129('0x2f')]!==_0x8129('0x3e')){var _0x5eeaa2={};_0x5eeaa2[_0x207b34['name']]={'$like':'%'+_0x11b408[_0x8129('0x32')][_0x8129('0x3c')]+'%'};return _0x5eeaa2;}})});}_0x30ea60=_[_0x8129('0x3d')]({},_0x30ea60,_0x11b408['options']);var _0x2710cb={'where':_0x30ea60[_0x8129('0x39')]};return db[_0x8129('0x2d')]['count'](_0x2710cb)['then'](function(_0x5630ad){_0x4846ad['count']=_0x5630ad;if(_0x11b408[_0x8129('0x32')][_0x8129('0x3f')]){_0x30ea60[_0x8129('0x40')]=[{'all':!![]}];}return db[_0x8129('0x2d')][_0x8129('0x41')](_0x30ea60);})[_0x8129('0x26')](function(_0x3b483c){_0x4846ad[_0x8129('0x42')]=_0x3b483c;return _0x4846ad;})[_0x8129('0x26')](respondWithFilteredResult(_0x20f2aa,_0x30ea60))[_0x8129('0x43')](handleError(_0x20f2aa,null));};exports[_0x8129('0x44')]=function(_0xe9a00d,_0x535f81){var _0x239f82={'raw':!![],'where':{'id':_0xe9a00d[_0x8129('0x45')]['id']}},_0x1c7116={};_0x1c7116[_0x8129('0x31')]=_['keys'](db['Attachment'][_0x8129('0x46')]);_0x1c7116[_0x8129('0x32')]=_[_0x8129('0x47')](_0xe9a00d[_0x8129('0x32')]);_0x1c7116['filters']=_['intersection'](_0x1c7116[_0x8129('0x31')],_0x1c7116[_0x8129('0x32')]);_0x239f82[_0x8129('0x34')]=_['intersection'](_0x1c7116[_0x8129('0x31')],qs[_0x8129('0x35')](_0xe9a00d[_0x8129('0x32')][_0x8129('0x35')]));_0x239f82[_0x8129('0x34')]=_0x239f82[_0x8129('0x34')][_0x8129('0x36')]?_0x239f82['attributes']:_0x1c7116[_0x8129('0x31')];if(_0xe9a00d['query'][_0x8129('0x3f')]){_0x239f82[_0x8129('0x40')]=[{'all':!![]}];}_0x239f82=_[_0x8129('0x3d')]({},_0x239f82,_0xe9a00d[_0x8129('0x48')]);return db[_0x8129('0x2d')]['find'](_0x239f82)[_0x8129('0x26')](handleEntityNotFound(_0x535f81,null))[_0x8129('0x26')](respondWithResult(_0x535f81,null))[_0x8129('0x43')](handleError(_0x535f81,null));};exports['clone']=function(_0x5d6ccc,_0x18ca1c){var _0x3a022e={'where':{'id':_0x5d6ccc[_0x8129('0x45')]['id']}},_0x270a3d={};_0x270a3d[_0x8129('0x31')]=_[_0x8129('0x47')](db[_0x8129('0x2d')][_0x8129('0x46')]);_0x3a022e[_0x8129('0x34')]=_[_0x8129('0x33')](_0x270a3d[_0x8129('0x31')],qs[_0x8129('0x35')](_0x5d6ccc['query']['fields']));_0x3a022e[_0x8129('0x34')]=_0x3a022e[_0x8129('0x34')][_0x8129('0x36')]?_0x3a022e[_0x8129('0x34')]:_0x270a3d['model'];if(_0x5d6ccc[_0x8129('0x32')][_0x8129('0x3f')]){_0x3a022e[_0x8129('0x40')]=[{'all':!![]}];}_0x3a022e=_[_0x8129('0x3d')]({},_0x3a022e,_0x5d6ccc[_0x8129('0x48')]);return db[_0x8129('0x2d')]['find'](_0x3a022e)[_0x8129('0x26')](handleEntityNotFound(_0x18ca1c,null))[_0x8129('0x26')](function(_0x5eebfb){if(_0x5eebfb){var _0x52592e=_0x5eebfb[_0x8129('0x49')]({'plain':!![]});_0x52592e=qs[_0x8129('0x4a')](_0x52592e,['id','createdAt','updatedAt']);_0x5d6ccc[_0x8129('0x4b')]=_[_0x8129('0x4a')](_0x5d6ccc[_0x8129('0x4b')],['id',_0x8129('0x4c'),_0x8129('0x4d')]);return db['Attachment'][_0x8129('0x4e')](_['merge'](_0x52592e,_0x5d6ccc[_0x8129('0x4b')]),{'include':_0x5d6ccc[_0x8129('0x32')][_0x8129('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x18ca1c,0xc9))[_0x8129('0x43')](handleError(_0x18ca1c,null));};exports[_0x8129('0x25')]=function(_0x356452,_0x2ff630){if(_0x356452['body']['id']){delete _0x356452[_0x8129('0x4b')]['id'];}return db[_0x8129('0x2d')]['find']({'where':{'id':_0x356452['params']['id']}})[_0x8129('0x26')](handleEntityNotFound(_0x2ff630,null))[_0x8129('0x26')](saveUpdates(_0x356452[_0x8129('0x4b')],null))[_0x8129('0x26')](respondWithResult(_0x2ff630,null))[_0x8129('0x43')](handleError(_0x2ff630,null));};exports['destroy']=function(_0x53d6f3,_0x4ddb7a){return db[_0x8129('0x2d')][_0x8129('0x4f')]({'where':{'id':_0x53d6f3['params']['id']}})[_0x8129('0x26')](handleEntityNotFound(_0x4ddb7a,null))[_0x8129('0x26')](removeEntity(_0x4ddb7a,null))[_0x8129('0x43')](handleError(_0x4ddb7a,null));};exports[_0x8129('0x4e')]=function(_0x32a736,_0x2ab224,_0x465739){_0x32a736[_0x8129('0x4b')][_0x8129('0x29')]=_0x32a736['file'][_0x8129('0x50')];_0x32a736['body'][_0x8129('0x51')]=_0x32a736[_0x8129('0x52')][_0x8129('0x53')];_0x32a736[_0x8129('0x4b')]['type']=_0x32a736[_0x8129('0x52')][_0x8129('0x54')];return db['Attachment'][_0x8129('0x4e')](_0x32a736['body'])[_0x8129('0x26')](respondWithResult(_0x2ab224,0xc9))[_0x8129('0x43')](handleError(_0x2ab224,null));};exports[_0x8129('0x55')]=function(_0xb22135,_0x51d82f,_0xf59e4c){return db[_0x8129('0x2d')]['findOne']({'where':{'id':_0xb22135[_0x8129('0x45')]['id']},'raw':!![]})[_0x8129('0x26')](handleEntityNotFound(_0x51d82f,null))[_0x8129('0x26')](function(_0x545a47){if(_0x545a47){var _0x3fa176=_0x545a47[_0x8129('0x56')]!==null;var _0x4da8ca=path['join'](config[_0x8129('0x57')],_0x8129('0x58'));if(_0x3fa176){_0x4da8ca=path[_0x8129('0x59')](_0x4da8ca,'offline-chat/');}var _0x21fb03=path[_0x8129('0x59')](_0x4da8ca,_0x545a47[_0x8129('0x51')]);return _0x51d82f['download'](_0x21fb03);}})[_0x8129('0x43')](handleError(_0x51d82f,null));}; \ No newline at end of file +var _0x914f=['where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Attachment','rows','show','find','params','get','omit','createdAt','updatedAt','body','catch','create','file','basename','mimetype','findOne','ChatOfflineMessageId','root','join','offline-chat/','eml-format','rimraf','zip-dir','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort'];(function(_0x3414dc,_0x1b9291){var _0x30e662=function(_0x577127){while(--_0x577127){_0x3414dc['push'](_0x3414dc['shift']());}};_0x30e662(++_0x1b9291);}(_0x914f,0xcd));var _0xf914=function(_0x1e9195,_0x50c32c){_0x1e9195=_0x1e9195-0x0;var _0x44a35d=_0x914f[_0x1e9195];return _0x44a35d;};'use strict';var emlformat=require(_0xf914('0x0'));var rimraf=require(_0xf914('0x1'));var zipdir=require(_0xf914('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf914('0x3'));var moment=require(_0xf914('0x4'));var BPromise=require(_0xf914('0x5'));var Mustache=require(_0xf914('0x6'));var util=require(_0xf914('0x7'));var path=require(_0xf914('0x8'));var sox=require(_0xf914('0x9'));var csv=require(_0xf914('0xa'));var ejs=require(_0xf914('0xb'));var fs=require('fs');var fs_extra=require(_0xf914('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf914('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf914('0xe'));var toCsv=require(_0xf914('0xa'));var querystring=require(_0xf914('0xf'));var Papa=require(_0xf914('0x10'));var Redis=require(_0xf914('0x11'));var authService=require(_0xf914('0x12'));var qs=require(_0xf914('0x13'));var as=require(_0xf914('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf914('0x15'))(_0xf914('0x16'));var utils=require(_0xf914('0x17'));var config=require(_0xf914('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf914('0x19'))['db'];function respondWithStatusCode(_0x8a7561,_0x43a6c0){_0x43a6c0=_0x43a6c0||0xcc;return function(_0x557370){if(_0x557370){return _0x8a7561[_0xf914('0x1a')](_0x43a6c0);}return _0x8a7561[_0xf914('0x1b')](_0x43a6c0)[_0xf914('0x1c')]();};}function respondWithResult(_0x7c2357,_0x290a84){_0x290a84=_0x290a84||0xc8;return function(_0x4961c5){if(_0x4961c5){return _0x7c2357[_0xf914('0x1b')](_0x290a84)[_0xf914('0x1d')](_0x4961c5);}};}function respondWithFilteredResult(_0x346a38,_0x539898){return function(_0x506e60){if(_0x506e60){var _0x1e6785=typeof _0x539898[_0xf914('0x1e')]==='undefined'&&typeof _0x539898[_0xf914('0x1f')]===_0xf914('0x20');var _0x530d56=_0x506e60[_0xf914('0x21')];var _0x143ec3=_0x1e6785?0x0:_0x539898['offset'];var _0xfdaf8e=_0x1e6785?_0x506e60[_0xf914('0x21')]:_0x539898[_0xf914('0x1e')]+_0x539898[_0xf914('0x1f')];var _0xb634cd;if(_0xfdaf8e>=_0x530d56){_0xfdaf8e=_0x530d56;_0xb634cd=0xc8;}else{_0xb634cd=0xce;}_0x346a38[_0xf914('0x1b')](_0xb634cd);return _0x346a38['set'](_0xf914('0x22'),_0x143ec3+'-'+_0xfdaf8e+'/'+_0x530d56)[_0xf914('0x1d')](_0x506e60);}return null;};}function patchUpdates(_0x3d6947){return function(_0xd67b4b){try{jsonpatch[_0xf914('0x23')](_0xd67b4b,_0x3d6947,!![]);}catch(_0xcb48f7){return BPromise[_0xf914('0x24')](_0xcb48f7);}return _0xd67b4b[_0xf914('0x25')]();};}function saveUpdates(_0x1f901e,_0x3a4e23){return function(_0x4ccfc4){if(_0x4ccfc4){return _0x4ccfc4[_0xf914('0x26')](_0x1f901e)['then'](function(_0x15d3df){return _0x15d3df;});}return null;};}function removeEntity(_0xaedfd0,_0x1b08be){return function(_0xaa0430){if(_0xaa0430){return _0xaa0430[_0xf914('0x27')]()[_0xf914('0x28')](function(){_0xaedfd0[_0xf914('0x1b')](0xcc)[_0xf914('0x1c')]();});}};}function handleEntityNotFound(_0x28ba62,_0x117aff){return function(_0x533adc){if(!_0x533adc){_0x28ba62[_0xf914('0x1a')](0x194);}return _0x533adc;};}function handleError(_0x2938e3,_0x41b3b5){_0x41b3b5=_0x41b3b5||0x1f4;return function(_0x45f2d7){logger[_0xf914('0x29')](_0x45f2d7[_0xf914('0x2a')]);if(_0x45f2d7[_0xf914('0x2b')]){delete _0x45f2d7['name'];}_0x2938e3['status'](_0x41b3b5)[_0xf914('0x2c')](_0x45f2d7);};}exports[_0xf914('0x2d')]=function(_0xb314a3,_0x1a3038){var _0x34ee1f={},_0x3ed82c={},_0x484285={'count':0x0,'rows':[]};var _0x9f6446=_[_0xf914('0x2e')](db['Attachment'][_0xf914('0x2f')],function(_0x32d27e){return{'name':_0x32d27e['fieldName'],'type':_0x32d27e['type'][_0xf914('0x30')]};});_0x3ed82c[_0xf914('0x31')]=_[_0xf914('0x2e')](_0x9f6446,'name');_0x3ed82c[_0xf914('0x32')]=_[_0xf914('0x33')](_0xb314a3[_0xf914('0x32')]);_0x3ed82c[_0xf914('0x34')]=_[_0xf914('0x35')](_0x3ed82c[_0xf914('0x31')],_0x3ed82c[_0xf914('0x32')]);_0x34ee1f[_0xf914('0x36')]=_['intersection'](_0x3ed82c['model'],qs[_0xf914('0x37')](_0xb314a3[_0xf914('0x32')][_0xf914('0x37')]));_0x34ee1f[_0xf914('0x36')]=_0x34ee1f[_0xf914('0x36')][_0xf914('0x38')]?_0x34ee1f[_0xf914('0x36')]:_0x3ed82c[_0xf914('0x31')];if(!_0xb314a3[_0xf914('0x32')][_0xf914('0x39')]('nolimit')){_0x34ee1f[_0xf914('0x1f')]=qs[_0xf914('0x1f')](_0xb314a3[_0xf914('0x32')][_0xf914('0x1f')]);_0x34ee1f[_0xf914('0x1e')]=qs[_0xf914('0x1e')](_0xb314a3['query'][_0xf914('0x1e')]);}_0x34ee1f['order']=qs[_0xf914('0x3a')](_0xb314a3['query'][_0xf914('0x3a')]);_0x34ee1f[_0xf914('0x3b')]=qs['filters'](_[_0xf914('0x3c')](_0xb314a3[_0xf914('0x32')],_0x3ed82c[_0xf914('0x34')]),_0x9f6446);if(_0xb314a3['query'][_0xf914('0x3d')]){_0x34ee1f['where']=_[_0xf914('0x3e')](_0x34ee1f[_0xf914('0x3b')],{'$or':_[_0xf914('0x2e')](_0x9f6446,function(_0x2ed91f){if(_0x2ed91f[_0xf914('0x3f')]!==_0xf914('0x40')){var _0x2c7f7f={};_0x2c7f7f[_0x2ed91f[_0xf914('0x2b')]]={'$like':'%'+_0xb314a3[_0xf914('0x32')]['filter']+'%'};return _0x2c7f7f;}})});}_0x34ee1f=_[_0xf914('0x3e')]({},_0x34ee1f,_0xb314a3[_0xf914('0x41')]);var _0x5dbaf7={'where':_0x34ee1f[_0xf914('0x3b')]};return db['Attachment']['count'](_0x5dbaf7)[_0xf914('0x28')](function(_0x5b8351){_0x484285['count']=_0x5b8351;if(_0xb314a3[_0xf914('0x32')][_0xf914('0x42')]){_0x34ee1f[_0xf914('0x43')]=[{'all':!![]}];}return db[_0xf914('0x44')]['findAll'](_0x34ee1f);})[_0xf914('0x28')](function(_0x41b0dd){_0x484285[_0xf914('0x45')]=_0x41b0dd;return _0x484285;})[_0xf914('0x28')](respondWithFilteredResult(_0x1a3038,_0x34ee1f))['catch'](handleError(_0x1a3038,null));};exports[_0xf914('0x46')]=function(_0x15c64b,_0x4fad4e){var _0x3fa744={'raw':!![],'where':{'id':_0x15c64b['params']['id']}},_0x4ff818={};_0x4ff818[_0xf914('0x31')]=_[_0xf914('0x33')](db[_0xf914('0x44')][_0xf914('0x2f')]);_0x4ff818[_0xf914('0x32')]=_['keys'](_0x15c64b['query']);_0x4ff818[_0xf914('0x34')]=_[_0xf914('0x35')](_0x4ff818[_0xf914('0x31')],_0x4ff818[_0xf914('0x32')]);_0x3fa744[_0xf914('0x36')]=_[_0xf914('0x35')](_0x4ff818['model'],qs[_0xf914('0x37')](_0x15c64b['query'][_0xf914('0x37')]));_0x3fa744['attributes']=_0x3fa744[_0xf914('0x36')]['length']?_0x3fa744[_0xf914('0x36')]:_0x4ff818[_0xf914('0x31')];if(_0x15c64b[_0xf914('0x32')][_0xf914('0x42')]){_0x3fa744['include']=[{'all':!![]}];}_0x3fa744=_[_0xf914('0x3e')]({},_0x3fa744,_0x15c64b[_0xf914('0x41')]);return db[_0xf914('0x44')][_0xf914('0x47')](_0x3fa744)[_0xf914('0x28')](handleEntityNotFound(_0x4fad4e,null))[_0xf914('0x28')](respondWithResult(_0x4fad4e,null))['catch'](handleError(_0x4fad4e,null));};exports['clone']=function(_0x3aa504,_0x371e95){var _0x341895={'where':{'id':_0x3aa504[_0xf914('0x48')]['id']}},_0x5e87e6={};_0x5e87e6['model']=_[_0xf914('0x33')](db[_0xf914('0x44')][_0xf914('0x2f')]);_0x341895[_0xf914('0x36')]=_[_0xf914('0x35')](_0x5e87e6[_0xf914('0x31')],qs[_0xf914('0x37')](_0x3aa504[_0xf914('0x32')][_0xf914('0x37')]));_0x341895[_0xf914('0x36')]=_0x341895['attributes']['length']?_0x341895[_0xf914('0x36')]:_0x5e87e6[_0xf914('0x31')];if(_0x3aa504[_0xf914('0x32')][_0xf914('0x42')]){_0x341895[_0xf914('0x43')]=[{'all':!![]}];}_0x341895=_[_0xf914('0x3e')]({},_0x341895,_0x3aa504['options']);return db['Attachment'][_0xf914('0x47')](_0x341895)[_0xf914('0x28')](handleEntityNotFound(_0x371e95,null))[_0xf914('0x28')](function(_0x2f9da2){if(_0x2f9da2){var _0x1b2d7e=_0x2f9da2[_0xf914('0x49')]({'plain':!![]});_0x1b2d7e=qs[_0xf914('0x4a')](_0x1b2d7e,['id',_0xf914('0x4b'),_0xf914('0x4c')]);_0x3aa504[_0xf914('0x4d')]=_[_0xf914('0x4a')](_0x3aa504[_0xf914('0x4d')],['id',_0xf914('0x4b'),_0xf914('0x4c')]);return db[_0xf914('0x44')]['create'](_[_0xf914('0x3e')](_0x1b2d7e,_0x3aa504[_0xf914('0x4d')]),{'include':_0x3aa504['query'][_0xf914('0x42')]?[{'all':!![]}]:undefined});}})[_0xf914('0x28')](respondWithResult(_0x371e95,0xc9))[_0xf914('0x4e')](handleError(_0x371e95,null));};exports[_0xf914('0x26')]=function(_0x568ca4,_0x55b289){if(_0x568ca4['body']['id']){delete _0x568ca4[_0xf914('0x4d')]['id'];}return db[_0xf914('0x44')][_0xf914('0x47')]({'where':{'id':_0x568ca4['params']['id']}})[_0xf914('0x28')](handleEntityNotFound(_0x55b289,null))[_0xf914('0x28')](saveUpdates(_0x568ca4[_0xf914('0x4d')],null))[_0xf914('0x28')](respondWithResult(_0x55b289,null))['catch'](handleError(_0x55b289,null));};exports[_0xf914('0x27')]=function(_0x54138f,_0x456a89){return db[_0xf914('0x44')]['find']({'where':{'id':_0x54138f['params']['id']}})['then'](handleEntityNotFound(_0x456a89,null))['then'](removeEntity(_0x456a89,null))[_0xf914('0x4e')](handleError(_0x456a89,null));};exports[_0xf914('0x4f')]=function(_0x385c29,_0x42a8c0,_0x133079){_0x385c29[_0xf914('0x4d')][_0xf914('0x2b')]=_0x385c29[_0xf914('0x50')]['originalname'];_0x385c29[_0xf914('0x4d')][_0xf914('0x51')]=_0x385c29[_0xf914('0x50')]['filename'];_0x385c29[_0xf914('0x4d')][_0xf914('0x3f')]=_0x385c29['file'][_0xf914('0x52')];return db[_0xf914('0x44')][_0xf914('0x4f')](_0x385c29[_0xf914('0x4d')])[_0xf914('0x28')](respondWithResult(_0x42a8c0,0xc9))[_0xf914('0x4e')](handleError(_0x42a8c0,null));};exports['download']=function(_0x38c801,_0x4d9ef7,_0x586fa2){return db[_0xf914('0x44')][_0xf914('0x53')]({'where':{'id':_0x38c801['params']['id']},'raw':!![]})[_0xf914('0x28')](handleEntityNotFound(_0x4d9ef7,null))[_0xf914('0x28')](function(_0x5779c8){if(_0x5779c8){var _0x3f4945=_0x5779c8[_0xf914('0x54')]!==null;var _0x3d478a=path['join'](config[_0xf914('0x55')],'server/files/attachments/');if(_0x3f4945){_0x3d478a=path[_0xf914('0x56')](_0x3d478a,_0xf914('0x57'));}var _0x87c47=path[_0xf914('0x56')](_0x3d478a,_0x5779c8[_0xf914('0x51')]);return _0x4d9ef7['download'](_0x87c47);}})[_0xf914('0x4e')](handleError(_0x4d9ef7,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3e8553e..a4dc943 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 _0xd54d=['util','../../config/logger','api','rimraf','./attachment.attributes','exports','define','Attachment','attachments'];(function(_0x29be44,_0x4f38b5){var _0x54394e=function(_0x214df0){while(--_0x214df0){_0x29be44['push'](_0x29be44['shift']());}};_0x54394e(++_0x4f38b5);}(_0xd54d,0x10e));var _0xdd54=function(_0x4f7ee9,_0x5e2e09){_0x4f7ee9=_0x4f7ee9-0x0;var _0x2dff3a=_0xd54d[_0x4f7ee9];return _0x2dff3a;};'use strict';var _=require('lodash');var util=require(_0xdd54('0x0'));var logger=require(_0xdd54('0x1'))(_0xdd54('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdd54('0x3'));var config=require('../../config/environment');var attributes=require(_0xdd54('0x4'));module[_0xdd54('0x5')]=function(_0x37ac75,_0x246439){return _0x37ac75[_0xdd54('0x6')](_0xdd54('0x7'),attributes,{'tableName':_0xdd54('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf47=['rimraf','../../config/environment','./attachment.attributes','exports','attachments','util','../../config/logger','api','moment','request-promise'];(function(_0x32a76f,_0x503d94){var _0x4c9fa0=function(_0x3562c8){while(--_0x3562c8){_0x32a76f['push'](_0x32a76f['shift']());}};_0x4c9fa0(++_0x503d94);}(_0xdf47,0x69));var _0x7df4=function(_0x2e8965,_0x91c5b0){_0x2e8965=_0x2e8965-0x0;var _0x2224b4=_0xdf47[_0x2e8965];return _0x2224b4;};'use strict';var _=require('lodash');var util=require(_0x7df4('0x0'));var logger=require(_0x7df4('0x1'))(_0x7df4('0x2'));var moment=require(_0x7df4('0x3'));var BPromise=require('bluebird');var rp=require(_0x7df4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7df4('0x5'));var config=require(_0x7df4('0x6'));var attributes=require(_0x7df4('0x7'));module[_0x7df4('0x8')]=function(_0x261b00,_0x25b759){return _0x261b00['define']('Attachment',attributes,{'tableName':_0x7df4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 04380ec..2fa0869 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 _0xa1fd=['jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','CreateAttachment','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x2ceba7,_0x451ce4){_0x2ceba7=_0x2ceba7-0x0;var _0x5348eb=_0xa1fd[_0x2ceba7];return _0x5348eb;};'use strict';var _=require(_0xda1f('0x0'));var util=require(_0xda1f('0x1'));var moment=require(_0xda1f('0x2'));var BPromise=require(_0xda1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda1f('0x4'));var db=require(_0xda1f('0x5'))['db'];var utils=require(_0xda1f('0x6'));var logger=require(_0xda1f('0x7'))(_0xda1f('0x8'));var config=require('../../config/environment');var jayson=require(_0xda1f('0x9'));var client=jayson[_0xda1f('0xa')][_0xda1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x552ba4,_0x33502e,_0x46a29e){return new BPromise(function(_0x199a8d,_0x338463){return client[_0xda1f('0xc')](_0x552ba4,_0x46a29e)[_0xda1f('0xd')](function(_0x1493f8){logger[_0xda1f('0xe')](_0xda1f('0xf'),_0x33502e,'request\x20sent');logger[_0xda1f('0x10')](_0xda1f('0x11'),_0x33502e,_0xda1f('0x12'),JSON[_0xda1f('0x13')](_0x1493f8));if(_0x1493f8['error']){if(_0x1493f8['error'][_0xda1f('0x14')]===0x1f4){logger[_0xda1f('0x15')](_0xda1f('0xf'),_0x33502e,_0x1493f8[_0xda1f('0x15')][_0xda1f('0x16')]);return _0x338463(_0x1493f8['error'][_0xda1f('0x16')]);}logger[_0xda1f('0x15')](_0xda1f('0xf'),_0x33502e,_0x1493f8[_0xda1f('0x15')][_0xda1f('0x16')]);return _0x199a8d(_0x1493f8[_0xda1f('0x15')]['message']);}else{logger[_0xda1f('0xe')](_0xda1f('0xf'),_0x33502e,_0xda1f('0x12'));_0x199a8d(_0x1493f8[_0xda1f('0x17')]['message']);}})['catch'](function(_0x3020ea){logger['error'](_0xda1f('0xf'),_0x33502e,_0x3020ea);_0x338463(_0x3020ea);});});}exports[_0xda1f('0x18')]=function(_0x1e10af){var _0x59b7bf=this;return new Promise(function(_0xe81fc2,_0xe18a0a){return db['Attachment'][_0xda1f('0x19')](_0x1e10af[_0xda1f('0x1a')],{'raw':_0x1e10af['options']?_0x1e10af[_0xda1f('0x1b')][_0xda1f('0x1c')]===undefined?!![]:![]:!![]})[_0xda1f('0xd')](function(_0xe85e94){logger[_0xda1f('0xe')](_0xda1f('0x18'),_0x1e10af);logger[_0xda1f('0x10')](_0xda1f('0x18'),_0x1e10af,JSON[_0xda1f('0x13')](_0xe85e94));_0xe81fc2(_0xe85e94);})[_0xda1f('0x1d')](function(_0x1d510b){logger[_0xda1f('0x15')]('CreateAttachment',_0x1d510b[_0xda1f('0x16')],_0x1e10af);_0xe18a0a(_0x59b7bf['error'](0x1f4,_0x1d510b[_0xda1f('0x16')]));});});}; \ No newline at end of file +var _0xb469=['options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','CreateAttachment','create','body'];(function(_0x533da3,_0x469556){var _0x2999bd=function(_0x2bb88d){while(--_0x2bb88d){_0x533da3['push'](_0x533da3['shift']());}};_0x2999bd(++_0x469556);}(_0xb469,0x13b));var _0x9b46=function(_0x4c2fee,_0x2e35a5){_0x4c2fee=_0x4c2fee-0x0;var _0x4f63ce=_0xb469[_0x4c2fee];return _0x4f63ce;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});}exports[_0x9b46('0x14')]=function(_0x5c5cc9){var _0x5dd7bd=this;return new Promise(function(_0x3d9efa,_0x4ccfd0){return db['Attachment'][_0x9b46('0x15')](_0x5c5cc9[_0x9b46('0x16')],{'raw':_0x5c5cc9['options']?_0x5c5cc9[_0x9b46('0x17')][_0x9b46('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55aece){logger[_0x9b46('0x12')](_0x9b46('0x14'),_0x5c5cc9);logger[_0x9b46('0xe')]('CreateAttachment',_0x5c5cc9,JSON['stringify'](_0x55aece));_0x3d9efa(_0x55aece);})[_0x9b46('0x19')](function(_0x51d2ca){logger[_0x9b46('0x10')](_0x9b46('0x14'),_0x51d2ca['message'],_0x5c5cc9);_0x4ccfd0(_0x5dd7bd[_0x9b46('0x10')](0x1f4,_0x51d2ca['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 49ae633..8e363b9 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x262ed7,_0x3aa5ff){_0x262ed7=_0x262ed7-0x0;var _0x1fb031=_0xdb28[_0x262ed7];return _0x1fb031;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _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(_0x35dd59,_0x5b540b){var _0xddfc18=function(_0xabadc9){while(--_0xabadc9){_0x35dd59['push'](_0x35dd59['shift']());}};_0xddfc18(++_0x5b540b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ae6ca,_0x42db9b){_0x4ae6ca=_0x4ae6ca-0x0;var _0x150b1b=_0x5f2f[_0x4ae6ca];return _0x150b1b;};'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/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4043802..00a6364 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 _0x5cf1=['google','profile','email','callback','/login','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','blockDuration','User','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser','getLicense','then','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils'];(function(_0x5d5c0d,_0x4611b6){var _0x47549d=function(_0x5f4afb){while(--_0x5f4afb){_0x5d5c0d['push'](_0x5d5c0d['shift']());}};_0x47549d(++_0x4611b6);}(_0x5cf1,0x199));var _0x15cf=function(_0x4eab61,_0x1a6e6d){_0x4eab61=_0x4eab61-0x0;var _0x342426=_0x5cf1[_0x4eab61];return _0x342426;};'use strict';var _=require(_0x15cf('0x0'));var passport=require(_0x15cf('0x1'));var GoogleStrategy=require(_0x15cf('0x2'))['Strategy'];var moment=require(_0x15cf('0x3'));var db=require(_0x15cf('0x4'))['db'];var config=require(_0x15cf('0x5'));var signToken=require(_0x15cf('0x6'))[_0x15cf('0x7')];var utils=require(_0x15cf('0x8'));exports['login']=passport['authenticate'](_0x15cf('0x9'),{'failureRedirect':'/login','scope':[_0x15cf('0xa'),_0x15cf('0xb')],'session':![]});exports[_0x15cf('0xc')]=passport['authenticate'](_0x15cf('0x9'),{'failureRedirect':_0x15cf('0xd'),'session':![]});passport[_0x15cf('0xe')](new GoogleStrategy({'clientID':config['google']?config['google'][_0x15cf('0xf')]:'id','clientSecret':config[_0x15cf('0x9')]?config[_0x15cf('0x9')][_0x15cf('0x10')]:_0x15cf('0x11'),'callbackURL':config['google']?config[_0x15cf('0x9')][_0x15cf('0x12')]:''},function(_0x349685,_0x2b0e08,_0x13b9c1,_0x3029d){var _0x45a442,_0x3142c2;return db[_0x15cf('0x13')][_0x15cf('0x14')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x15cf('0x15')],'raw':!![]})['then'](function(_0x1d8249){_0x45a442=_0x1d8249;return db[_0x15cf('0x16')]['find']({'where':{'email':_[_0x15cf('0x17')](_0x13b9c1[_0x15cf('0x18')],_0x15cf('0x19')),'role':{'$or':[_0x15cf('0x1a'),_0x15cf('0x1b'),_0x15cf('0x1c')]}}});})['then'](function(_0xde9d49){_0x3142c2=_0xde9d49;if(_0x3142c2){if(_0x3142c2[_0x15cf('0x1d')]){return _0x3029d(_0x15cf('0x1e'));}else if(_0x45a442[_0x15cf('0x15')]>0x0){if(_0x3142c2[_0x15cf('0x1f')]){if(moment(_0x3142c2[_0x15cf('0x20')])[_0x15cf('0x21')](_0x45a442['blockDuration'],'minutes')>moment()){return _0x3029d(_0x15cf('0x1e'));}else{return utils[_0x15cf('0x22')](_0x3142c2,0x0,![],null)['then'](function(){return utils[_0x15cf('0x23')](_0x3142c2);})[_0x15cf('0x24')](function(){return _0x3029d(null,_0x3142c2);});}}else{return utils['getLicense'](_0x3142c2)['then'](function(){return _0x3029d(null,_0x3142c2);});}}else{return utils[_0x15cf('0x23')](_0x3142c2)[_0x15cf('0x24')](function(){return _0x3029d(null,_0x3142c2);});}}return _0x3029d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x15cf('0x25')](function(_0x3807fb){_0x3029d(_0x3807fb);});})); \ No newline at end of file +var _0x58c8=['../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','use','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','getLicense','passport','Strategy','../../mysqldb'];(function(_0x159a71,_0x140216){var _0x18f06a=function(_0x5452ce){while(--_0x5452ce){_0x159a71['push'](_0x159a71['shift']());}};_0x18f06a(++_0x140216);}(_0x58c8,0x1d9));var _0x858c=function(_0x2b230e,_0xcc1920){_0x2b230e=_0x2b230e-0x0;var _0x2d58c7=_0x58c8[_0x2b230e];return _0x2d58c7;};'use strict';var _=require('lodash');var passport=require(_0x858c('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0x858c('0x1')];var moment=require('moment');var db=require(_0x858c('0x2'))['db'];var config=require(_0x858c('0x3'));var signToken=require(_0x858c('0x4'))[_0x858c('0x5')];var utils=require(_0x858c('0x6'));exports[_0x858c('0x7')]=passport[_0x858c('0x8')](_0x858c('0x9'),{'failureRedirect':_0x858c('0xa'),'scope':[_0x858c('0xb'),'email'],'session':![]});exports['callback']=passport[_0x858c('0x8')](_0x858c('0x9'),{'failureRedirect':_0x858c('0xa'),'session':![]});passport[_0x858c('0xc')](new GoogleStrategy({'clientID':config[_0x858c('0x9')]?config['google'][_0x858c('0xd')]:'id','clientSecret':config['google']?config[_0x858c('0x9')][_0x858c('0xe')]:'secret','callbackURL':config[_0x858c('0x9')]?config[_0x858c('0x9')][_0x858c('0xf')]:''},function(_0x592bee,_0x50253a,_0x2282aa,_0x3edc7f){var _0x59a9bc,_0x36e92b;return db[_0x858c('0x10')][_0x858c('0x11')]({'where':{'id':0x1},'attributes':[_0x858c('0x12'),_0x858c('0x13')],'raw':!![]})[_0x858c('0x14')](function(_0x2abc31){_0x59a9bc=_0x2abc31;return db[_0x858c('0x15')][_0x858c('0x16')]({'where':{'email':_[_0x858c('0x17')](_0x2282aa[_0x858c('0x18')],'value'),'role':{'$or':[_0x858c('0x19'),_0x858c('0x1a'),_0x858c('0x1b')]}}});})[_0x858c('0x14')](function(_0x14c941){_0x36e92b=_0x14c941;if(_0x36e92b){if(_0x36e92b[_0x858c('0x1c')]){return _0x3edc7f(_0x858c('0x1d'));}else if(_0x59a9bc[_0x858c('0x13')]>0x0){if(_0x36e92b['blocked']){if(moment(_0x36e92b[_0x858c('0x1e')])[_0x858c('0x1f')](_0x59a9bc[_0x858c('0x13')],_0x858c('0x20'))>moment()){return _0x3edc7f(_0x858c('0x1d'));}else{return utils['clearBlockUser'](_0x36e92b,0x0,![],null)['then'](function(){return utils[_0x858c('0x21')](_0x36e92b);})[_0x858c('0x14')](function(){return _0x3edc7f(null,_0x36e92b);});}}else{return utils[_0x858c('0x21')](_0x36e92b)[_0x858c('0x14')](function(){return _0x3edc7f(null,_0x36e92b);});}}else{return utils['getLicense'](_0x36e92b)[_0x858c('0x14')](function(){return _0x3edc7f(null,_0x36e92b);});}}return _0x3edc7f(_0x858c('0x1d'));})['catch'](function(_0x1d5d75){_0x3edc7f(_0x1d5d75);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index b1a6ec0..03378bf 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 _0xae16=['/callback','callback','setTokenCookie','exports','express','Router','../user/user.controller.js','login','get'];(function(_0x4b2b5a,_0x3f7555){var _0x47f812=function(_0x4de6ef){while(--_0x4de6ef){_0x4b2b5a['push'](_0x4b2b5a['shift']());}};_0x47f812(++_0x3f7555);}(_0xae16,0xee));var _0x6ae1=function(_0x50cafc,_0x4a691b){_0x50cafc=_0x50cafc-0x0;var _0x1990d2=_0xae16[_0x50cafc];return _0x1990d2;};'use strict';var express=require(_0x6ae1('0x0'));var passport=require('passport');var router=express[_0x6ae1('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x6ae1('0x2'));var authService=require('../../components/auth/service');router['get']('/',controller[_0x6ae1('0x3')]);router[_0x6ae1('0x4')](_0x6ae1('0x5'),controller[_0x6ae1('0x6')],authService['isMiddleware'],userController[_0x6ae1('0x3')],authService[_0x6ae1('0x7')]);module[_0x6ae1('0x8')]=router; \ No newline at end of file +var _0x338d=['callback','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','get','login','/callback'];(function(_0x1b2bd2,_0x491f68){var _0x34a271=function(_0x6036d){while(--_0x6036d){_0x1b2bd2['push'](_0x1b2bd2['shift']());}};_0x34a271(++_0x491f68);}(_0x338d,0x162));var _0xd338=function(_0x295d0f,_0x1675d0){_0x295d0f=_0x295d0f-0x0;var _0x1a2e2a=_0x338d[_0x295d0f];return _0x1a2e2a;};'use strict';var express=require('express');var passport=require(_0xd338('0x0'));var router=express['Router']();var controller=require(_0xd338('0x1'));var userController=require(_0xd338('0x2'));var authService=require('../../components/auth/service');router[_0xd338('0x3')]('/',controller[_0xd338('0x4')]);router[_0xd338('0x3')](_0xd338('0x5'),controller[_0xd338('0x6')],authService[_0xd338('0x7')],userController[_0xd338('0x4')],authService[_0xd338('0x8')]);module[_0xd338('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a6ade50..9d1de9b 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 _0x41fc=['If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','password','use','util','passport','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','email','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','message','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://'];(function(_0x462435,_0x428194){var _0x1bbfe7=function(_0xeb7e81){while(--_0xeb7e81){_0x462435['push'](_0x462435['shift']());}};_0x1bbfe7(++_0x428194);}(_0x41fc,0x1c6));var _0xc41f=function(_0xb26cca,_0x7d38ae){_0xb26cca=_0xb26cca-0x0;var _0x28f481=_0x41fc[_0xb26cca];return _0x28f481;};'use strict';var util=require(_0xc41f('0x0'));var passport=require(_0xc41f('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xc41f('0x2'));var _=require(_0xc41f('0x3'));var rs=require(_0xc41f('0x4'));var moment=require('moment');var db=require(_0xc41f('0x5'))['db'];var authService=require(_0xc41f('0x6'));var utils=require(_0xc41f('0x7'));var client=jayson['client'][_0xc41f('0x8')]({'port':0x232b});function localAuthenticate(_0x2c5489,_0x16cbdf,_0x3e9bbe,_0x373bd8){var _0x393fa2,_0x1cb648;return db[_0xc41f('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xc41f('0xa'),_0xc41f('0xb')],'raw':!![]})[_0xc41f('0xc')](function(_0x1ee603){_0x393fa2=_0x1ee603;return _0x2c5489[_0xc41f('0xd')]({'attributes':['id',_0xc41f('0xe'),'password',_0xc41f('0xf'),_0xc41f('0x10'),_0xc41f('0x11'),_0xc41f('0x12'),_0xc41f('0x13'),'loginAttempts'],'where':{'name':_0x16cbdf,'role':{'$or':[_0xc41f('0x14'),_0xc41f('0x15'),_0xc41f('0x16')]}}});})[_0xc41f('0xc')](function(_0x2cb5a9){if(!_0x2cb5a9||_0x2cb5a9&&_0x2cb5a9[_0xc41f('0xe')]!==_0x16cbdf){throw new Error(_0xc41f('0x17'));}else{_0x1cb648=_0x2cb5a9;return _0x1cb648;}})['then'](function(){_0x1cb648['authenticate'](_0x3e9bbe,function(_0x489169,_0x349fb7){var _0x22ef4e=_0x1cb648['loginAttempts']+0x1;if(_0x489169){return _0x373bd8(_0x489169);}else if(!_0x349fb7){if(_0x1cb648[_0xc41f('0x11')]){return _0x373bd8(null,![],{'message':_0xc41f('0x17')});}else if(_0x393fa2['allowedLoginAttempts']>0x0){if(_0x1cb648[_0xc41f('0x12')]){if(_0x393fa2[_0xc41f('0xb')]>0x0){if(moment(_0x1cb648[_0xc41f('0x13')])[_0xc41f('0x18')](_0x393fa2[_0xc41f('0xb')],_0xc41f('0x19'))>moment()){return _0x373bd8(null,![],{'message':_0xc41f('0x17')});}else{return utils['clearBlockUser'](_0x1cb648,_0x22ef4e,![],null)[_0xc41f('0xc')](function(){return _0x373bd8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x373bd8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x22ef4e>=_0x393fa2[_0xc41f('0xa')]){return utils[_0xc41f('0x1a')](_0x1cb648,0x0,!![],moment())[_0xc41f('0xc')](function(){return _0x373bd8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xc41f('0x1a')](_0x1cb648,_0x22ef4e,![],null)[_0xc41f('0xc')](function(){return _0x373bd8(null,![],{'message':_0xc41f('0x17')});});}}}else{return _0x373bd8(null,![],{'message':_0xc41f('0x17')});}}else{if(_0x1cb648[_0xc41f('0x11')]){return _0x373bd8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x393fa2[_0xc41f('0xa')]>0x0){if(_0x1cb648[_0xc41f('0x12')]){if(_0x393fa2['blockDuration']>0x0){if(moment(_0x1cb648[_0xc41f('0x13')])[_0xc41f('0x18')](_0x393fa2[_0xc41f('0xb')],'minutes')>moment()){return _0x373bd8(null,![],{'message':_0xc41f('0x17')});}else{return utils[_0xc41f('0x1a')](_0x1cb648,0x0,![],null)[_0xc41f('0xc')](function(){return utils[_0xc41f('0x1b')](_0x1cb648);})[_0xc41f('0xc')](function(){return _0x373bd8(null,_0x1cb648);});}}else{return _0x373bd8(null,![],{'message':_0xc41f('0x17')});}}else{return utils[_0xc41f('0x1a')](_0x1cb648,0x0,![],null)[_0xc41f('0xc')](function(){return utils[_0xc41f('0x1b')](_0x1cb648);})[_0xc41f('0xc')](function(){return _0x373bd8(null,_0x1cb648);})[_0xc41f('0x1c')](function(_0x23b0b1){return _0x373bd8(null,![],_0x23b0b1);});}}else{if(_0x1cb648[_0xc41f('0x12')]){return _0x373bd8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc41f('0x1b')](_0x1cb648)[_0xc41f('0xc')](function(){return _0x373bd8(null,_0x1cb648);});}}}});})[_0xc41f('0x1c')](function(_0x302abe){return _0x373bd8(null,![],_0x302abe);});}function sendServiceMail(_0x5591cd){return db[_0xc41f('0x1d')][_0xc41f('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xc41f('0xe'),'email'],'include':[{'model':db[_0xc41f('0x1f')],'as':_0xc41f('0x20')}]})[_0xc41f('0xc')](function(_0xd82afc){if(!_0xd82afc){throw new Error(_0xc41f('0x21'));}var _0x3bb2e9={'tls':{'rejectUnauthorized':![]}};if(_0xd82afc[_0xc41f('0x20')][_0xc41f('0x22')]){_0x3bb2e9[_0xc41f('0x22')]=_0xd82afc[_0xc41f('0x20')][_0xc41f('0x22')];}else{_0x3bb2e9['host']=_0xd82afc['Smtp'][_0xc41f('0x23')];_0x3bb2e9[_0xc41f('0x24')]=_0xd82afc[_0xc41f('0x20')]['port'];_0x3bb2e9[_0xc41f('0x25')]=_0xd82afc[_0xc41f('0x20')][_0xc41f('0x25')];}if(_0xd82afc[_0xc41f('0x20')][_0xc41f('0x26')]){_0x3bb2e9[_0xc41f('0x27')]={'user':_0xd82afc[_0xc41f('0x20')][_0xc41f('0x15')],'pass':_0xd82afc[_0xc41f('0x20')][_0xc41f('0x28')]};}var _0xecedc3={'account':_0x3bb2e9,'message':_[_0xc41f('0x29')]({'from':util['format'](_0xc41f('0x2a'),_0xd82afc[_0xc41f('0xe')],_0xd82afc[_0xc41f('0x2b')]||_0xd82afc[_0xc41f('0x20')]['user'])},_0x5591cd)};return client[_0xc41f('0x2c')](_0xc41f('0x2d'),_0xecedc3);})[_0xc41f('0xc')](function(_0xc3c384){if(_0xc3c384[_0xc41f('0x2e')]){throw new Error(util[_0xc41f('0x2f')](_0xc41f('0x30'),_0xc3c384[_0xc41f('0x2e')]['message']||JSON[_0xc41f('0x31')](_0xc3c384[_0xc41f('0x2e')])));}return!![];});}function handleError(_0x38270b,_0x3deaad,_0x342594){return _0x38270b[_0xc41f('0x32')](_0x3deaad||0x1f4)['send']({'message':_0x342594?_0x342594[_0xc41f('0x33')]||_0x342594:''});}exports[_0xc41f('0x34')]=function(_0x590bd2,_0x73aa0,_0x1fa333){passport[_0xc41f('0x35')](_0xc41f('0x36'),function(_0x47395c,_0x25905e,_0x102a43){var _0x461fef=_0x47395c||_0x102a43;if(_0x461fef){return handleError(_0x73aa0,0x191,_0x461fef);}if(!_0x25905e){return handleError(_0x73aa0,0x194,{'message':_0xc41f('0x37')});}else{var _0x331699={'payload':{'id':_0x25905e['id'],'role':_0x25905e[_0xc41f('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xc41f('0x38')](_0x331699)['then'](function(_0x12b5c4){_0x73aa0[_0xc41f('0x39')]({'id':_0x25905e['id'],'token':_0x12b5c4,'statusCall':'','isAlreadyLogged':_0x25905e[_0xc41f('0x3a')]});});}})(_0x590bd2,_0x73aa0,_0x1fa333);};exports[_0xc41f('0x3b')]=function(_0xe6dd32,_0x145bc8,_0x4991d8){if(!_0xe6dd32[_0xc41f('0x3c')][_0xc41f('0x2b')]){return handleError(_0x145bc8,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x853866=rs[_0xc41f('0x3d')]();_0xe6dd32[_0xc41f('0x3c')][_0xc41f('0x2b')]=_0xe6dd32['body'][_0xc41f('0x2b')][_0xc41f('0x3e')]()[_0xc41f('0x3f')]();var _0xeaf6b5;return db[_0xc41f('0x9')][_0xc41f('0xd')]({'where':{'id':0x1},'attributes':[_0xc41f('0xa'),_0xc41f('0xb')],'raw':!![]})['then'](function(_0x34e0df){_0xeaf6b5=_0x34e0df;return db[_0xc41f('0x40')]['find']({'where':{'email':_0xe6dd32['body'][_0xc41f('0x2b')]}});})[_0xc41f('0xc')](function(_0x405bee){if(!_0x405bee){throw new Error(_0xc41f('0x41'));}if(_0x405bee[_0xc41f('0x11')]){throw new Error(_0xc41f('0x42'));}if(_0x405bee['blocked']){if(moment(_0x405bee[_0xc41f('0x13')])[_0xc41f('0x18')](_0xeaf6b5['blockDuration'],_0xc41f('0x19'))>moment()){throw new Error(_0xc41f('0x43'));}else{_0x405bee[_0xc41f('0x12')]=![];_0x405bee['blockedAt']=null;}}_0x405bee[_0xc41f('0x44')]=_0x853866;_0x405bee[_0xc41f('0x45')]=Date[_0xc41f('0x46')]()+0x36ee80;return _0x405bee[_0xc41f('0x47')]();})[_0xc41f('0xc')](function(){return sendServiceMail({'to':_0xe6dd32[_0xc41f('0x3c')][_0xc41f('0x2b')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xc41f('0x48')+_0xc41f('0x49')+_0xe6dd32['headers'][_0xc41f('0x23')]+'/reset/'+_0x853866+'\x0a\x0a'+_0xc41f('0x4a')});})[_0xc41f('0xc')](function(){_0x145bc8[_0xc41f('0x32')](0xc8)[_0xc41f('0x4b')]({'message':_0xc41f('0x4c')});})[_0xc41f('0x1c')](function(_0x1dd5c4){return handleError(_0x145bc8,0x1f4,_0x1dd5c4);});};exports[_0xc41f('0x4d')]=function(_0x193d9f,_0x56537d,_0x578f9c){return db['User']['find']({'where':{'resetPasswordToken':_0x193d9f[_0xc41f('0x4e')][_0xc41f('0x4f')],'resetPasswordExpires':{'$gt':Date[_0xc41f('0x46')]()}}})[_0xc41f('0xc')](function(_0x288f66){if(!_0x288f66){throw new Error(_0xc41f('0x50'));}return db['Setting'][_0xc41f('0xd')]({'attributes':['id','securePassword',_0xc41f('0x51'),_0xc41f('0x52')]})[_0xc41f('0xc')](function(_0x470303){if(_0x470303[_0xc41f('0x53')])authService['validatePasswordPattern'](_0x193d9f[_0xc41f('0x3c')]['password']);if(!_0x470303['enforcePasswordHistory']||!_0x288f66[_0xc41f('0x54')])return _0x288f66;authService[_0xc41f('0x55')](_0x193d9f[_0xc41f('0x3c')][_0xc41f('0x56')],_0x288f66['previousPasswords'],_0x470303[_0xc41f('0x52')]);return _0x288f66;})['then'](function(){_0x288f66[_0xc41f('0x56')]=_0x193d9f[_0xc41f('0x3c')][_0xc41f('0x56')];_0x288f66['resetPasswordToken']=null;_0x288f66['resetPasswordExpires']=null;return _0x288f66[_0xc41f('0x47')]();});})[_0xc41f('0xc')](function(){_0x56537d[_0xc41f('0x32')](0xc8)['send']({'message':'Password\x20reset!'});})[_0xc41f('0x1c')](function(_0x56fbec){return handleError(_0x56537d,0x1f4,_0x56fbec);});};passport[_0xc41f('0x57')](new LocalStrategy({'usernameField':_0xc41f('0xe'),'passwordField':_0xc41f('0x56')},function(_0x256f48,_0x9e646a,_0x54713b){return localAuthenticate(db[_0xc41f('0x40')],_0x256f48,_0x9e646a,_0x54713b);})); \ No newline at end of file +var _0x9744=['authenticate','local','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','find','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','password','util','passport','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','secure','authentication','auth','user','format','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','login'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9744,0x1ea));var _0x4974=function(_0x470ef2,_0x177892){_0x470ef2=_0x470ef2-0x0;var _0x53783a=_0x9744[_0x470ef2];return _0x53783a;};'use strict';var util=require(_0x4974('0x0'));var passport=require(_0x4974('0x1'));var LocalStrategy=require('passport-local')[_0x4974('0x2')];var jayson=require(_0x4974('0x3'));var _=require(_0x4974('0x4'));var rs=require(_0x4974('0x5'));var moment=require(_0x4974('0x6'));var db=require(_0x4974('0x7'))['db'];var authService=require(_0x4974('0x8'));var utils=require(_0x4974('0x9'));var client=jayson[_0x4974('0xa')][_0x4974('0xb')]({'port':0x232b});function localAuthenticate(_0x2ea83a,_0x29b8dd,_0x3b5e06,_0x896dd5){var _0x459d5c,_0x4b4931;return db[_0x4974('0xc')][_0x4974('0xd')]({'where':{'id':0x1},'attributes':[_0x4974('0xe'),_0x4974('0xf')],'raw':!![]})['then'](function(_0x24f795){_0x459d5c=_0x24f795;return _0x2ea83a[_0x4974('0xd')]({'attributes':['id',_0x4974('0x10'),'password','salt',_0x4974('0x11'),_0x4974('0x12'),_0x4974('0x13'),_0x4974('0x14'),_0x4974('0x15')],'where':{'name':_0x29b8dd,'role':{'$or':[_0x4974('0x16'),'user',_0x4974('0x17')]}}});})[_0x4974('0x18')](function(_0x45c8c6){if(!_0x45c8c6||_0x45c8c6&&_0x45c8c6[_0x4974('0x10')]!==_0x29b8dd){throw new Error(_0x4974('0x19'));}else{_0x4b4931=_0x45c8c6;return _0x4b4931;}})[_0x4974('0x18')](function(){_0x4b4931['authenticate'](_0x3b5e06,function(_0x374e7c,_0x4305ab){var _0x31a947=_0x4b4931[_0x4974('0x15')]+0x1;if(_0x374e7c){return _0x896dd5(_0x374e7c);}else if(!_0x4305ab){if(_0x4b4931[_0x4974('0x12')]){return _0x896dd5(null,![],{'message':_0x4974('0x19')});}else if(_0x459d5c[_0x4974('0xe')]>0x0){if(_0x4b4931[_0x4974('0x13')]){if(_0x459d5c['blockDuration']>0x0){if(moment(_0x4b4931['blockedAt'])['add'](_0x459d5c[_0x4974('0xf')],_0x4974('0x1a'))>moment()){return _0x896dd5(null,![],{'message':_0x4974('0x19')});}else{return utils[_0x4974('0x1b')](_0x4b4931,_0x31a947,![],null)[_0x4974('0x18')](function(){return _0x896dd5(null,![],{'message':_0x4974('0x19')});});}}else{return _0x896dd5(null,![],{'message':_0x4974('0x19')});}}else{if(_0x31a947>=_0x459d5c[_0x4974('0xe')]){return utils[_0x4974('0x1b')](_0x4b4931,0x0,!![],moment())[_0x4974('0x18')](function(){return _0x896dd5(null,![],{'message':_0x4974('0x19')});});}else{return utils[_0x4974('0x1b')](_0x4b4931,_0x31a947,![],null)[_0x4974('0x18')](function(){return _0x896dd5(null,![],{'message':_0x4974('0x19')});});}}}else{return _0x896dd5(null,![],{'message':_0x4974('0x19')});}}else{if(_0x4b4931[_0x4974('0x12')]){return _0x896dd5(null,![],{'message':_0x4974('0x19')});}else if(_0x459d5c[_0x4974('0xe')]>0x0){if(_0x4b4931[_0x4974('0x13')]){if(_0x459d5c[_0x4974('0xf')]>0x0){if(moment(_0x4b4931[_0x4974('0x14')])[_0x4974('0x1c')](_0x459d5c[_0x4974('0xf')],'minutes')>moment()){return _0x896dd5(null,![],{'message':_0x4974('0x19')});}else{return utils[_0x4974('0x1b')](_0x4b4931,0x0,![],null)[_0x4974('0x18')](function(){return utils['getLicense'](_0x4b4931);})['then'](function(){return _0x896dd5(null,_0x4b4931);});}}else{return _0x896dd5(null,![],{'message':_0x4974('0x19')});}}else{return utils[_0x4974('0x1b')](_0x4b4931,0x0,![],null)[_0x4974('0x18')](function(){return utils[_0x4974('0x1d')](_0x4b4931);})[_0x4974('0x18')](function(){return _0x896dd5(null,_0x4b4931);})['catch'](function(_0x1a6090){return _0x896dd5(null,![],_0x1a6090);});}}else{if(_0x4b4931['blocked']){return _0x896dd5(null,![],{'message':_0x4974('0x19')});}else{return utils[_0x4974('0x1d')](_0x4b4931)[_0x4974('0x18')](function(){return _0x896dd5(null,_0x4b4931);});}}}});})[_0x4974('0x1e')](function(_0x151892){return _0x896dd5(null,![],_0x151892);});}function sendServiceMail(_0x4722c1){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x4974('0x10'),_0x4974('0x1f')],'include':[{'model':db[_0x4974('0x20')],'as':'Smtp'}]})[_0x4974('0x18')](function(_0x4781e1){if(!_0x4781e1){throw new Error(_0x4974('0x21'));}var _0x95145b={'tls':{'rejectUnauthorized':![]}};if(_0x4781e1[_0x4974('0x22')][_0x4974('0x23')]){_0x95145b[_0x4974('0x23')]=_0x4781e1[_0x4974('0x22')]['service'];}else{_0x95145b[_0x4974('0x24')]=_0x4781e1[_0x4974('0x22')][_0x4974('0x24')];_0x95145b['port']=_0x4781e1[_0x4974('0x22')]['port'];_0x95145b[_0x4974('0x25')]=_0x4781e1[_0x4974('0x22')][_0x4974('0x25')];}if(_0x4781e1['Smtp'][_0x4974('0x26')]){_0x95145b[_0x4974('0x27')]={'user':_0x4781e1[_0x4974('0x22')][_0x4974('0x28')],'pass':_0x4781e1[_0x4974('0x22')]['pass']};}var _0x1cdae4={'account':_0x95145b,'message':_['merge']({'from':util[_0x4974('0x29')]('\x22%s\x22\x20<%s>',_0x4781e1[_0x4974('0x10')],_0x4781e1[_0x4974('0x1f')]||_0x4781e1[_0x4974('0x22')][_0x4974('0x28')])},_0x4722c1)};return client[_0x4974('0x2a')](_0x4974('0x2b'),_0x1cdae4);})['then'](function(_0x5bb3b6){if(_0x5bb3b6['error']){throw new Error(util[_0x4974('0x29')](_0x4974('0x2c'),_0x5bb3b6[_0x4974('0x2d')][_0x4974('0x2e')]||JSON[_0x4974('0x2f')](_0x5bb3b6['error'])));}return!![];});}function handleError(_0x22b812,_0x9aeb98,_0x20fd8a){return _0x22b812[_0x4974('0x30')](_0x9aeb98||0x1f4)['send']({'message':_0x20fd8a?_0x20fd8a[_0x4974('0x2e')]||_0x20fd8a:''});}exports[_0x4974('0x31')]=function(_0x3af75c,_0x3d6d4f,_0x163234){passport[_0x4974('0x32')](_0x4974('0x33'),function(_0x44b0d1,_0x5103f5,_0x3be12b){var _0x207a3b=_0x44b0d1||_0x3be12b;if(_0x207a3b){return handleError(_0x3d6d4f,0x191,_0x207a3b);}if(!_0x5103f5){return handleError(_0x3d6d4f,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2ece99={'payload':{'id':_0x5103f5['id'],'role':_0x5103f5[_0x4974('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x4974('0x34')](_0x2ece99)[_0x4974('0x18')](function(_0x411bd2){_0x3d6d4f[_0x4974('0x35')]({'id':_0x5103f5['id'],'token':_0x411bd2,'statusCall':'','isAlreadyLogged':_0x5103f5[_0x4974('0x36')]});});}})(_0x3af75c,_0x3d6d4f,_0x163234);};exports[_0x4974('0x37')]=function(_0x12ed2e,_0x2f815e,_0x5c13e0){if(!_0x12ed2e[_0x4974('0x38')]['email']){return handleError(_0x2f815e,0x1f4,{'message':_0x4974('0x39')});}var _0x272e41=rs[_0x4974('0x3a')]();_0x12ed2e[_0x4974('0x38')]['email']=_0x12ed2e['body'][_0x4974('0x1f')][_0x4974('0x3b')]()[_0x4974('0x3c')]();var _0x13244a;return db[_0x4974('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0x4974('0xe'),_0x4974('0xf')],'raw':!![]})[_0x4974('0x18')](function(_0x4ad15e){_0x13244a=_0x4ad15e;return db[_0x4974('0x3d')]['find']({'where':{'email':_0x12ed2e[_0x4974('0x38')][_0x4974('0x1f')]}});})['then'](function(_0x2a53ef){if(!_0x2a53ef){throw new Error(_0x4974('0x3e'));}if(_0x2a53ef[_0x4974('0x12')]){throw new Error(_0x4974('0x3f'));}if(_0x2a53ef[_0x4974('0x13')]){if(moment(_0x2a53ef[_0x4974('0x14')])['add'](_0x13244a[_0x4974('0xf')],'minutes')>moment()){throw new Error(_0x4974('0x40'));}else{_0x2a53ef[_0x4974('0x13')]=![];_0x2a53ef[_0x4974('0x14')]=null;}}_0x2a53ef[_0x4974('0x41')]=_0x272e41;_0x2a53ef[_0x4974('0x42')]=Date[_0x4974('0x43')]()+0x36ee80;return _0x2a53ef[_0x4974('0x44')]();})[_0x4974('0x18')](function(){return sendServiceMail({'to':_0x12ed2e['body'][_0x4974('0x1f')],'subject':_0x4974('0x45'),'text':_0x4974('0x46')+_0x4974('0x47')+_0x4974('0x48')+_0x12ed2e[_0x4974('0x49')]['host']+_0x4974('0x4a')+_0x272e41+'\x0a\x0a'+_0x4974('0x4b')});})[_0x4974('0x18')](function(){_0x2f815e[_0x4974('0x30')](0xc8)[_0x4974('0x4c')]({'message':_0x4974('0x4d')});})[_0x4974('0x1e')](function(_0x3190ca){return handleError(_0x2f815e,0x1f4,_0x3190ca);});};exports['reset']=function(_0x28453e,_0x40a50f,_0x511626){return db[_0x4974('0x3d')][_0x4974('0x4e')]({'where':{'resetPasswordToken':_0x28453e[_0x4974('0x4f')][_0x4974('0x50')],'resetPasswordExpires':{'$gt':Date[_0x4974('0x43')]()}}})[_0x4974('0x18')](function(_0x5975c6){if(!_0x5975c6){throw new Error(_0x4974('0x51'));}return db[_0x4974('0xc')]['findOne']({'attributes':['id',_0x4974('0x52'),_0x4974('0x53'),_0x4974('0x54')]})[_0x4974('0x18')](function(_0x1ac749){if(_0x1ac749[_0x4974('0x52')])authService[_0x4974('0x55')](_0x28453e[_0x4974('0x38')]['password']);if(!_0x1ac749[_0x4974('0x53')]||!_0x5975c6[_0x4974('0x56')])return _0x5975c6;authService[_0x4974('0x57')](_0x28453e[_0x4974('0x38')]['password'],_0x5975c6[_0x4974('0x56')],_0x1ac749[_0x4974('0x54')]);return _0x5975c6;})[_0x4974('0x18')](function(){_0x5975c6['password']=_0x28453e[_0x4974('0x38')]['password'];_0x5975c6['resetPasswordToken']=null;_0x5975c6['resetPasswordExpires']=null;return _0x5975c6[_0x4974('0x44')]();});})[_0x4974('0x18')](function(){_0x40a50f[_0x4974('0x30')](0xc8)[_0x4974('0x4c')]({'message':_0x4974('0x58')});})[_0x4974('0x1e')](function(_0x36f59f){return handleError(_0x40a50f,0x1f4,_0x36f59f);});};passport['use'](new LocalStrategy({'usernameField':_0x4974('0x10'),'passwordField':_0x4974('0x59')},function(_0x166302,_0x1d582d,_0x14a3d3){return localAuthenticate(db[_0x4974('0x3d')],_0x166302,_0x1d582d,_0x14a3d3);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a968d7a..a08d4b2 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 _0xfdd7=['login','post','/forgot','/reset/:token','reset','Router','./authLocal.controller'];(function(_0x263207,_0x38e050){var _0x15bbe8=function(_0x145d5e){while(--_0x145d5e){_0x263207['push'](_0x263207['shift']());}};_0x15bbe8(++_0x38e050);}(_0xfdd7,0x11d));var _0x7fdd=function(_0x24d08f,_0x53e96b){_0x24d08f=_0x24d08f-0x0;var _0x3c4318=_0xfdd7[_0x24d08f];return _0x3c4318;};'use strict';var express=require('express');var router=express[_0x7fdd('0x0')]();var controller=require(_0x7fdd('0x1'));router['post']('/',controller[_0x7fdd('0x2')]);router[_0x7fdd('0x3')](_0x7fdd('0x4'),controller['forgot']);router[_0x7fdd('0x3')](_0x7fdd('0x5'),controller[_0x7fdd('0x6')]);module['exports']=router; \ No newline at end of file +var _0x9c38=['/reset/:token','reset','Router','post','login','/forgot','forgot'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x9c38,0x183));var _0x89c3=function(_0x4655e2,_0x3b840a){_0x4655e2=_0x4655e2-0x0;var _0x5f291f=_0x9c38[_0x4655e2];return _0x5f291f;};'use strict';var express=require('express');var router=express[_0x89c3('0x0')]();var controller=require('./authLocal.controller');router[_0x89c3('0x1')]('/',controller[_0x89c3('0x2')]);router[_0x89c3('0x1')](_0x89c3('0x3'),controller[_0x89c3('0x4')]);router[_0x89c3('0x1')](_0x89c3('0x5'),controller[_0x89c3('0x6')]);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 226ee91..af391e4 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 _0x39d2=['exports','STRING','INTEGER','sequelize'];(function(_0x5c3f72,_0x54471d){var _0x926aee=function(_0x3b8170){while(--_0x3b8170){_0x5c3f72['push'](_0x5c3f72['shift']());}};_0x926aee(++_0x54471d);}(_0x39d2,0x16b));var _0x239d=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x39d2[_0x3f5dca];return _0x5b833a;};'use strict';var Sequelize=require(_0x239d('0x0'));module[_0x239d('0x1')]={'name':{'type':Sequelize[_0x239d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x239d('0x2')]},'description':{'type':Sequelize[_0x239d('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x239d('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xa10e=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4487bc,_0x1a3eed){var _0x4a0bd5=function(_0x4c86df){while(--_0x4c86df){_0x4487bc['push'](_0x4487bc['shift']());}};_0x4a0bd5(++_0x1a3eed);}(_0xa10e,0xb0));var _0xea10=function(_0x581dac,_0x449c99){_0x581dac=_0x581dac-0x0;var _0x17271b=_0xa10e[_0x581dac];return _0x17271b;};'use strict';var Sequelize=require(_0xea10('0x0'));module[_0xea10('0x1')]={'name':{'type':Sequelize[_0xea10('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xea10('0x2')]},'status':{'type':Sequelize[_0xea10('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index c04ec3c..e323fd3 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 _0x6766=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','create','body','find','addConditions','ids','getConditions','findOne','filter','addActions','getActions','Action','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6766,0x1e0));var _0x6676=function(_0x33d4a2,_0x2baaf4){_0x33d4a2=_0x33d4a2-0x0;var _0x2c793f=_0x6766[_0x33d4a2];return _0x2c793f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6676('0x0'));var jsonpatch=require(_0x6676('0x1'));var rp=require('request-promise');var moment=require(_0x6676('0x2'));var BPromise=require(_0x6676('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6676('0x4'));var sox=require('sox');var csv=require(_0x6676('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6676('0x6'));var _=require(_0x6676('0x7'));var squel=require(_0x6676('0x8'));var crypto=require(_0x6676('0x9'));var jsforce=require(_0x6676('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6676('0x5'));var querystring=require(_0x6676('0xb'));var Papa=require(_0x6676('0xc'));var Redis=require(_0x6676('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6676('0xe'));var as=require(_0x6676('0xf'));var hardwareService=require(_0x6676('0x10'));var logger=require(_0x6676('0x11'))(_0x6676('0x12'));var utils=require(_0x6676('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6676('0x14'));var db=require(_0x6676('0x15'))['db'];function respondWithStatusCode(_0x33a710,_0x11c500){_0x11c500=_0x11c500||0xcc;return function(_0x289537){if(_0x289537){return _0x33a710[_0x6676('0x16')](_0x11c500);}return _0x33a710[_0x6676('0x17')](_0x11c500)[_0x6676('0x18')]();};}function respondWithResult(_0x2ea88d,_0x41f44d){_0x41f44d=_0x41f44d||0xc8;return function(_0x5df545){if(_0x5df545){return _0x2ea88d[_0x6676('0x17')](_0x41f44d)[_0x6676('0x19')](_0x5df545);}};}function respondWithFilteredResult(_0x3509df,_0x530264){return function(_0x5dcc09){if(_0x5dcc09){var _0x4d7344=typeof _0x530264[_0x6676('0x1a')]===_0x6676('0x1b')&&typeof _0x530264[_0x6676('0x1c')]===_0x6676('0x1b');var _0x343130=_0x5dcc09[_0x6676('0x1d')];var _0x9e9211=_0x4d7344?0x0:_0x530264['offset'];var _0x3ddc5e=_0x4d7344?_0x5dcc09[_0x6676('0x1d')]:_0x530264[_0x6676('0x1a')]+_0x530264[_0x6676('0x1c')];var _0x365f73;if(_0x3ddc5e>=_0x343130){_0x3ddc5e=_0x343130;_0x365f73=0xc8;}else{_0x365f73=0xce;}_0x3509df[_0x6676('0x17')](_0x365f73);return _0x3509df[_0x6676('0x1e')](_0x6676('0x1f'),_0x9e9211+'-'+_0x3ddc5e+'/'+_0x343130)[_0x6676('0x19')](_0x5dcc09);}return null;};}function patchUpdates(_0x4a42b8){return function(_0x536c80){try{jsonpatch[_0x6676('0x20')](_0x536c80,_0x4a42b8,!![]);}catch(_0x237f07){return BPromise[_0x6676('0x21')](_0x237f07);}return _0x536c80[_0x6676('0x22')]();};}function saveUpdates(_0x34b3b5,_0x47952d){return function(_0x5bcae9){if(_0x5bcae9){return _0x5bcae9[_0x6676('0x23')](_0x34b3b5)[_0x6676('0x24')](function(_0x4c879b){return _0x4c879b;});}return null;};}function removeEntity(_0x18e62d,_0x2489f0){return function(_0x3d5682){if(_0x3d5682){return _0x3d5682[_0x6676('0x25')]()['then'](function(){_0x18e62d[_0x6676('0x17')](0xcc)[_0x6676('0x18')]();});}};}function handleEntityNotFound(_0xcedd8e,_0x1f0f6b){return function(_0x2d94a2){if(!_0x2d94a2){_0xcedd8e[_0x6676('0x16')](0x194);}return _0x2d94a2;};}function handleError(_0xb04108,_0x5e7d74){_0x5e7d74=_0x5e7d74||0x1f4;return function(_0x4c66cd){logger['error'](_0x4c66cd[_0x6676('0x26')]);if(_0x4c66cd[_0x6676('0x27')]){delete _0x4c66cd['name'];}_0xb04108[_0x6676('0x17')](_0x5e7d74)[_0x6676('0x28')](_0x4c66cd);};}exports[_0x6676('0x29')]=function(_0x42ac16,_0x350bbb){var _0x4edbf3={},_0x5aaaf8={},_0x197644={'count':0x0,'rows':[]};var _0x3fda82=_[_0x6676('0x2a')](db[_0x6676('0x2b')][_0x6676('0x2c')],function(_0x2cc371){return{'name':_0x2cc371[_0x6676('0x2d')],'type':_0x2cc371[_0x6676('0x2e')]['key']};});_0x5aaaf8[_0x6676('0x2f')]=_[_0x6676('0x2a')](_0x3fda82,_0x6676('0x27'));_0x5aaaf8['query']=_[_0x6676('0x30')](_0x42ac16['query']);_0x5aaaf8[_0x6676('0x31')]=_[_0x6676('0x32')](_0x5aaaf8[_0x6676('0x2f')],_0x5aaaf8[_0x6676('0x33')]);_0x4edbf3[_0x6676('0x34')]=_['intersection'](_0x5aaaf8[_0x6676('0x2f')],qs[_0x6676('0x35')](_0x42ac16[_0x6676('0x33')]['fields']));_0x4edbf3[_0x6676('0x34')]=_0x4edbf3[_0x6676('0x34')]['length']?_0x4edbf3['attributes']:_0x5aaaf8[_0x6676('0x2f')];if(!_0x42ac16[_0x6676('0x33')][_0x6676('0x36')](_0x6676('0x37'))){_0x4edbf3[_0x6676('0x1c')]=qs[_0x6676('0x1c')](_0x42ac16[_0x6676('0x33')][_0x6676('0x1c')]);_0x4edbf3[_0x6676('0x1a')]=qs[_0x6676('0x1a')](_0x42ac16[_0x6676('0x33')]['offset']);}_0x4edbf3[_0x6676('0x38')]=qs[_0x6676('0x39')](_0x42ac16[_0x6676('0x33')][_0x6676('0x39')]);_0x4edbf3[_0x6676('0x3a')]=qs[_0x6676('0x31')](_[_0x6676('0x3b')](_0x42ac16['query'],_0x5aaaf8[_0x6676('0x31')]),_0x3fda82);if(_0x42ac16[_0x6676('0x33')]['filter']){_0x4edbf3[_0x6676('0x3a')]=_[_0x6676('0x3c')](_0x4edbf3['where'],{'$or':_['map'](_0x3fda82,function(_0xc52612){if(_0xc52612[_0x6676('0x2e')]!==_0x6676('0x3d')){var _0x25affb={};_0x25affb[_0xc52612[_0x6676('0x27')]]={'$like':'%'+_0x42ac16[_0x6676('0x33')]['filter']+'%'};return _0x25affb;}})});}_0x4edbf3=_[_0x6676('0x3c')]({},_0x4edbf3,_0x42ac16['options']);var _0x38edf1={'where':_0x4edbf3[_0x6676('0x3a')]};return db[_0x6676('0x2b')][_0x6676('0x1d')](_0x38edf1)['then'](function(_0x15ca48){_0x197644[_0x6676('0x1d')]=_0x15ca48;if(_0x42ac16[_0x6676('0x33')][_0x6676('0x3e')]){_0x4edbf3['include']=[{'all':!![]}];}return db[_0x6676('0x2b')][_0x6676('0x3f')](_0x4edbf3);})[_0x6676('0x24')](function(_0x51b443){_0x197644[_0x6676('0x40')]=_0x51b443;return _0x197644;})[_0x6676('0x24')](respondWithFilteredResult(_0x350bbb,_0x4edbf3))[_0x6676('0x41')](handleError(_0x350bbb,null));};exports[_0x6676('0x42')]=function(_0xe4fdb,_0x4852d2){var _0x221174={'raw':![],'where':{'id':_0xe4fdb[_0x6676('0x43')]['id']}},_0x238d89={};_0x238d89[_0x6676('0x2f')]=_[_0x6676('0x30')](db['Automation']['rawAttributes']);_0x238d89[_0x6676('0x33')]=_[_0x6676('0x30')](_0xe4fdb[_0x6676('0x33')]);_0x238d89[_0x6676('0x31')]=_[_0x6676('0x32')](_0x238d89[_0x6676('0x2f')],_0x238d89['query']);_0x221174[_0x6676('0x34')]=_[_0x6676('0x32')](_0x238d89[_0x6676('0x2f')],qs['fields'](_0xe4fdb[_0x6676('0x33')][_0x6676('0x35')]));_0x221174[_0x6676('0x34')]=_0x221174[_0x6676('0x34')][_0x6676('0x44')]?_0x221174[_0x6676('0x34')]:_0x238d89[_0x6676('0x2f')];if(_0xe4fdb[_0x6676('0x33')]['includeAll']){_0x221174[_0x6676('0x45')]=[{'all':!![]}];}_0x221174=_[_0x6676('0x3c')]({},_0x221174,_0xe4fdb[_0x6676('0x46')]);return db[_0x6676('0x2b')]['find'](_0x221174)[_0x6676('0x24')](handleEntityNotFound(_0x4852d2,null))[_0x6676('0x24')](respondWithResult(_0x4852d2,null))[_0x6676('0x41')](handleError(_0x4852d2,null));};exports[_0x6676('0x47')]=function(_0x30b973,_0x194bab){return db[_0x6676('0x2b')][_0x6676('0x47')](_0x30b973[_0x6676('0x48')],{})[_0x6676('0x24')](respondWithResult(_0x194bab,0xc9))[_0x6676('0x41')](handleError(_0x194bab,null));};exports[_0x6676('0x23')]=function(_0x3be767,_0x360e0a){if(_0x3be767[_0x6676('0x48')]['id']){delete _0x3be767[_0x6676('0x48')]['id'];}return db[_0x6676('0x2b')][_0x6676('0x49')]({'where':{'id':_0x3be767['params']['id']}})[_0x6676('0x24')](handleEntityNotFound(_0x360e0a,null))[_0x6676('0x24')](saveUpdates(_0x3be767[_0x6676('0x48')],null))[_0x6676('0x24')](respondWithResult(_0x360e0a,null))[_0x6676('0x41')](handleError(_0x360e0a,null));};exports[_0x6676('0x25')]=function(_0x310b2c,_0x20bc7b){return db['Automation'][_0x6676('0x49')]({'where':{'id':_0x310b2c['params']['id']}})[_0x6676('0x24')](handleEntityNotFound(_0x20bc7b,null))['then'](removeEntity(_0x20bc7b,null))[_0x6676('0x41')](handleError(_0x20bc7b,null));};exports[_0x6676('0x4a')]=function(_0x29b630,_0x16c832,_0x8b07a1){return db['Condition']['find']({'where':{'id':_0x29b630['params']['id']}})[_0x6676('0x24')](handleEntityNotFound(_0x16c832,null))['then'](function(_0x233d9a){if(_0x233d9a){return _0x233d9a[_0x6676('0x4a')](_0x29b630['body'][_0x6676('0x4b')],_['omit'](_0x29b630[_0x6676('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x16c832,null))[_0x6676('0x41')](handleError(_0x16c832,null));};exports[_0x6676('0x4c')]=function(_0x3b7780,_0x15627b,_0x5d6589){var _0x17438e={};var _0x205063={};var _0x5068f2;var _0xb480cb;return db[_0x6676('0x2b')][_0x6676('0x4d')]({'where':{'id':_0x3b7780[_0x6676('0x43')]['id']}})[_0x6676('0x24')](handleEntityNotFound(_0x15627b,null))[_0x6676('0x24')](function(_0x36bf73){if(_0x36bf73){_0x5068f2=_0x36bf73;_0x205063[_0x6676('0x2f')]=_['keys'](db['Condition'][_0x6676('0x2c')]);_0x205063[_0x6676('0x33')]=_[_0x6676('0x30')](_0x3b7780[_0x6676('0x33')]);_0x205063[_0x6676('0x31')]=_[_0x6676('0x32')](_0x205063[_0x6676('0x2f')],_0x205063[_0x6676('0x33')]);_0x17438e['attributes']=_[_0x6676('0x32')](_0x205063['model'],qs[_0x6676('0x35')](_0x3b7780[_0x6676('0x33')][_0x6676('0x35')]));_0x17438e[_0x6676('0x34')]=_0x17438e[_0x6676('0x34')][_0x6676('0x44')]?_0x17438e[_0x6676('0x34')]:_0x205063['model'];_0x17438e[_0x6676('0x38')]=qs['sort'](_0x3b7780['query'][_0x6676('0x39')]);_0x17438e['where']=qs[_0x6676('0x31')](_[_0x6676('0x3b')](_0x3b7780['query'],_0x205063[_0x6676('0x31')]));if(_0x3b7780[_0x6676('0x33')]['filter']){_0x17438e[_0x6676('0x3a')]=_[_0x6676('0x3c')](_0x17438e[_0x6676('0x3a')],{'$or':_[_0x6676('0x2a')](_0x17438e[_0x6676('0x34')],function(_0x2e30f9){var _0x37d81c={};_0x37d81c[_0x2e30f9]={'$like':'%'+_0x3b7780[_0x6676('0x33')][_0x6676('0x4e')]+'%'};return _0x37d81c;})});}_0x17438e=_['merge']({},_0x17438e,_0x3b7780[_0x6676('0x46')]);return _0x5068f2['getConditions'](_0x17438e);}})[_0x6676('0x24')](function(_0x39d932){if(_0x39d932){_0xb480cb=_0x39d932[_0x6676('0x44')];if(!_0x3b7780[_0x6676('0x33')][_0x6676('0x36')]('nolimit')){_0x17438e[_0x6676('0x1c')]=qs[_0x6676('0x1c')](_0x3b7780[_0x6676('0x33')]['limit']);_0x17438e['offset']=qs['offset'](_0x3b7780[_0x6676('0x33')][_0x6676('0x1a')]);}return _0x5068f2[_0x6676('0x4c')](_0x17438e);}})[_0x6676('0x24')](function(_0x237e95){if(_0x237e95){return _0x237e95?{'count':_0xb480cb,'rows':_0x237e95}:null;}})[_0x6676('0x24')](respondWithResult(_0x15627b,null))['catch'](handleError(_0x15627b,null));};exports[_0x6676('0x4f')]=function(_0x38af17,_0x19bc17,_0x5e9bc5){return db['Action'][_0x6676('0x49')]({'where':{'id':_0x38af17[_0x6676('0x43')]['id']}})[_0x6676('0x24')](handleEntityNotFound(_0x19bc17,null))[_0x6676('0x24')](function(_0x53a81d){if(_0x53a81d){return _0x53a81d[_0x6676('0x4f')](_0x38af17['body']['ids'],_['omit'](_0x38af17[_0x6676('0x48')],[_0x6676('0x4b'),'id'])||{});}})[_0x6676('0x24')](respondWithResult(_0x19bc17,null))[_0x6676('0x41')](handleError(_0x19bc17,null));};exports[_0x6676('0x50')]=function(_0x3e8d5e,_0x5371f5,_0x3de993){var _0x49bb64={};var _0xd643b9={};var _0x4231b2;var _0x2d1160;return db['Automation'][_0x6676('0x4d')]({'where':{'id':_0x3e8d5e[_0x6676('0x43')]['id']}})['then'](handleEntityNotFound(_0x5371f5,null))[_0x6676('0x24')](function(_0x3d4054){if(_0x3d4054){_0x4231b2=_0x3d4054;_0xd643b9[_0x6676('0x2f')]=_[_0x6676('0x30')](db[_0x6676('0x51')]['rawAttributes']);_0xd643b9[_0x6676('0x33')]=_['keys'](_0x3e8d5e[_0x6676('0x33')]);_0xd643b9[_0x6676('0x31')]=_[_0x6676('0x32')](_0xd643b9[_0x6676('0x2f')],_0xd643b9[_0x6676('0x33')]);_0x49bb64[_0x6676('0x34')]=_['intersection'](_0xd643b9[_0x6676('0x2f')],qs[_0x6676('0x35')](_0x3e8d5e[_0x6676('0x33')]['fields']));_0x49bb64[_0x6676('0x34')]=_0x49bb64[_0x6676('0x34')][_0x6676('0x44')]?_0x49bb64['attributes']:_0xd643b9[_0x6676('0x2f')];_0x49bb64['order']=qs[_0x6676('0x39')](_0x3e8d5e['query'][_0x6676('0x39')]);_0x49bb64[_0x6676('0x3a')]=qs['filters'](_[_0x6676('0x3b')](_0x3e8d5e[_0x6676('0x33')],_0xd643b9['filters']));if(_0x3e8d5e[_0x6676('0x33')][_0x6676('0x4e')]){_0x49bb64[_0x6676('0x3a')]=_['merge'](_0x49bb64[_0x6676('0x3a')],{'$or':_[_0x6676('0x2a')](_0x49bb64[_0x6676('0x34')],function(_0x188c9c){var _0x43aa45={};_0x43aa45[_0x188c9c]={'$like':'%'+_0x3e8d5e['query'][_0x6676('0x4e')]+'%'};return _0x43aa45;})});}_0x49bb64=_[_0x6676('0x3c')]({},_0x49bb64,_0x3e8d5e['options']);return _0x4231b2['getActions'](_0x49bb64);}})['then'](function(_0xe5da2c){if(_0xe5da2c){_0x2d1160=_0xe5da2c[_0x6676('0x44')];if(!_0x3e8d5e[_0x6676('0x33')]['hasOwnProperty'](_0x6676('0x37'))){_0x49bb64[_0x6676('0x1c')]=qs[_0x6676('0x1c')](_0x3e8d5e['query']['limit']);_0x49bb64[_0x6676('0x1a')]=qs[_0x6676('0x1a')](_0x3e8d5e[_0x6676('0x33')]['offset']);}return _0x4231b2[_0x6676('0x50')](_0x49bb64);}})[_0x6676('0x24')](function(_0x30892f){if(_0x30892f){return _0x30892f?{'count':_0x2d1160,'rows':_0x30892f}:null;}})[_0x6676('0x24')](respondWithResult(_0x5371f5,null))[_0x6676('0x41')](handleError(_0x5371f5,null));}; \ No newline at end of file +var _0xa04f=['options','includeAll','include','Automation','findAll','rows','catch','show','keys','create','body','find','params','addConditions','Condition','ids','omit','getConditions','findOne','addActions','Action','getActions','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL'];(function(_0x29e4a6,_0x5e4103){var _0x513b50=function(_0x5ebede){while(--_0x5ebede){_0x29e4a6['push'](_0x29e4a6['shift']());}};_0x513b50(++_0x5e4103);}(_0xa04f,0x173));var _0xfa04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfa04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa04('0x1'));var jsonpatch=require(_0xfa04('0x2'));var rp=require(_0xfa04('0x3'));var moment=require(_0xfa04('0x4'));var BPromise=require(_0xfa04('0x5'));var Mustache=require(_0xfa04('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfa04('0x7'));var ejs=require(_0xfa04('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa04('0x9'));var squel=require(_0xfa04('0xa'));var crypto=require(_0xfa04('0xb'));var jsforce=require(_0xfa04('0xc'));var deskjs=require(_0xfa04('0xd'));var toCsv=require(_0xfa04('0x7'));var querystring=require(_0xfa04('0xe'));var Papa=require(_0xfa04('0xf'));var Redis=require(_0xfa04('0x10'));var authService=require(_0xfa04('0x11'));var qs=require(_0xfa04('0x12'));var as=require(_0xfa04('0x13'));var hardwareService=require(_0xfa04('0x14'));var logger=require(_0xfa04('0x15'))('api');var utils=require(_0xfa04('0x16'));var config=require(_0xfa04('0x17'));var licenseUtil=require(_0xfa04('0x18'));var db=require(_0xfa04('0x19'))['db'];function respondWithStatusCode(_0x2ee88a,_0x1714a0){_0x1714a0=_0x1714a0||0xcc;return function(_0x490d3c){if(_0x490d3c){return _0x2ee88a['sendStatus'](_0x1714a0);}return _0x2ee88a[_0xfa04('0x1a')](_0x1714a0)[_0xfa04('0x1b')]();};}function respondWithResult(_0x5d4727,_0x449c92){_0x449c92=_0x449c92||0xc8;return function(_0x14d5e9){if(_0x14d5e9){return _0x5d4727[_0xfa04('0x1a')](_0x449c92)['json'](_0x14d5e9);}};}function respondWithFilteredResult(_0x26dccf,_0x18d50a){return function(_0x5921f9){if(_0x5921f9){var _0x323d22=typeof _0x18d50a[_0xfa04('0x1c')]==='undefined'&&typeof _0x18d50a[_0xfa04('0x1d')]===_0xfa04('0x1e');var _0xd38821=_0x5921f9[_0xfa04('0x1f')];var _0x1128b5=_0x323d22?0x0:_0x18d50a[_0xfa04('0x1c')];var _0x2695c2=_0x323d22?_0x5921f9[_0xfa04('0x1f')]:_0x18d50a[_0xfa04('0x1c')]+_0x18d50a[_0xfa04('0x1d')];var _0x323723;if(_0x2695c2>=_0xd38821){_0x2695c2=_0xd38821;_0x323723=0xc8;}else{_0x323723=0xce;}_0x26dccf[_0xfa04('0x1a')](_0x323723);return _0x26dccf[_0xfa04('0x20')](_0xfa04('0x21'),_0x1128b5+'-'+_0x2695c2+'/'+_0xd38821)[_0xfa04('0x22')](_0x5921f9);}return null;};}function patchUpdates(_0x19bede){return function(_0x411c93){try{jsonpatch[_0xfa04('0x23')](_0x411c93,_0x19bede,!![]);}catch(_0x5bdc1c){return BPromise['reject'](_0x5bdc1c);}return _0x411c93['save']();};}function saveUpdates(_0x46ae3f,_0x4bc310){return function(_0x118091){if(_0x118091){return _0x118091[_0xfa04('0x24')](_0x46ae3f)[_0xfa04('0x25')](function(_0x35fb26){return _0x35fb26;});}return null;};}function removeEntity(_0x5287f3,_0x5f5302){return function(_0x3c31d6){if(_0x3c31d6){return _0x3c31d6[_0xfa04('0x26')]()[_0xfa04('0x25')](function(){_0x5287f3[_0xfa04('0x1a')](0xcc)[_0xfa04('0x1b')]();});}};}function handleEntityNotFound(_0xff79c,_0x2227c9){return function(_0x260667){if(!_0x260667){_0xff79c[_0xfa04('0x27')](0x194);}return _0x260667;};}function handleError(_0x145f48,_0x44f533){_0x44f533=_0x44f533||0x1f4;return function(_0x375e15){logger[_0xfa04('0x28')](_0x375e15['stack']);if(_0x375e15[_0xfa04('0x29')]){delete _0x375e15[_0xfa04('0x29')];}_0x145f48['status'](_0x44f533)[_0xfa04('0x2a')](_0x375e15);};}exports[_0xfa04('0x2b')]=function(_0x12ab23,_0x1dec75){var _0x2a0e3c={},_0x14d6c1={},_0x1fafa6={'count':0x0,'rows':[]};var _0x3b7d9a=_[_0xfa04('0x2c')](db['Automation'][_0xfa04('0x2d')],function(_0x203f0a){return{'name':_0x203f0a[_0xfa04('0x2e')],'type':_0x203f0a['type'][_0xfa04('0x2f')]};});_0x14d6c1[_0xfa04('0x30')]=_[_0xfa04('0x2c')](_0x3b7d9a,_0xfa04('0x29'));_0x14d6c1[_0xfa04('0x31')]=_['keys'](_0x12ab23[_0xfa04('0x31')]);_0x14d6c1[_0xfa04('0x32')]=_['intersection'](_0x14d6c1[_0xfa04('0x30')],_0x14d6c1[_0xfa04('0x31')]);_0x2a0e3c[_0xfa04('0x33')]=_[_0xfa04('0x34')](_0x14d6c1[_0xfa04('0x30')],qs[_0xfa04('0x35')](_0x12ab23['query'][_0xfa04('0x35')]));_0x2a0e3c[_0xfa04('0x33')]=_0x2a0e3c[_0xfa04('0x33')][_0xfa04('0x36')]?_0x2a0e3c[_0xfa04('0x33')]:_0x14d6c1['model'];if(!_0x12ab23[_0xfa04('0x31')][_0xfa04('0x37')](_0xfa04('0x38'))){_0x2a0e3c[_0xfa04('0x1d')]=qs['limit'](_0x12ab23[_0xfa04('0x31')][_0xfa04('0x1d')]);_0x2a0e3c[_0xfa04('0x1c')]=qs[_0xfa04('0x1c')](_0x12ab23['query']['offset']);}_0x2a0e3c['order']=qs[_0xfa04('0x39')](_0x12ab23[_0xfa04('0x31')]['sort']);_0x2a0e3c['where']=qs['filters'](_[_0xfa04('0x3a')](_0x12ab23[_0xfa04('0x31')],_0x14d6c1[_0xfa04('0x32')]),_0x3b7d9a);if(_0x12ab23[_0xfa04('0x31')][_0xfa04('0x3b')]){_0x2a0e3c[_0xfa04('0x3c')]=_[_0xfa04('0x3d')](_0x2a0e3c['where'],{'$or':_['map'](_0x3b7d9a,function(_0x3e38cb){if(_0x3e38cb[_0xfa04('0x3e')]!==_0xfa04('0x3f')){var _0x3be9c9={};_0x3be9c9[_0x3e38cb['name']]={'$like':'%'+_0x12ab23[_0xfa04('0x31')][_0xfa04('0x3b')]+'%'};return _0x3be9c9;}})});}_0x2a0e3c=_[_0xfa04('0x3d')]({},_0x2a0e3c,_0x12ab23[_0xfa04('0x40')]);var _0x39b9a6={'where':_0x2a0e3c[_0xfa04('0x3c')]};return db['Automation'][_0xfa04('0x1f')](_0x39b9a6)['then'](function(_0x599725){_0x1fafa6[_0xfa04('0x1f')]=_0x599725;if(_0x12ab23['query'][_0xfa04('0x41')]){_0x2a0e3c[_0xfa04('0x42')]=[{'all':!![]}];}return db[_0xfa04('0x43')][_0xfa04('0x44')](_0x2a0e3c);})[_0xfa04('0x25')](function(_0x39d4e3){_0x1fafa6[_0xfa04('0x45')]=_0x39d4e3;return _0x1fafa6;})[_0xfa04('0x25')](respondWithFilteredResult(_0x1dec75,_0x2a0e3c))[_0xfa04('0x46')](handleError(_0x1dec75,null));};exports[_0xfa04('0x47')]=function(_0x241fc8,_0x11ec9d){var _0x19ef24={'raw':![],'where':{'id':_0x241fc8['params']['id']}},_0x4c4896={};_0x4c4896['model']=_[_0xfa04('0x48')](db[_0xfa04('0x43')]['rawAttributes']);_0x4c4896['query']=_[_0xfa04('0x48')](_0x241fc8[_0xfa04('0x31')]);_0x4c4896['filters']=_[_0xfa04('0x34')](_0x4c4896[_0xfa04('0x30')],_0x4c4896['query']);_0x19ef24['attributes']=_['intersection'](_0x4c4896[_0xfa04('0x30')],qs[_0xfa04('0x35')](_0x241fc8[_0xfa04('0x31')][_0xfa04('0x35')]));_0x19ef24[_0xfa04('0x33')]=_0x19ef24[_0xfa04('0x33')][_0xfa04('0x36')]?_0x19ef24[_0xfa04('0x33')]:_0x4c4896[_0xfa04('0x30')];if(_0x241fc8[_0xfa04('0x31')][_0xfa04('0x41')]){_0x19ef24[_0xfa04('0x42')]=[{'all':!![]}];}_0x19ef24=_[_0xfa04('0x3d')]({},_0x19ef24,_0x241fc8[_0xfa04('0x40')]);return db['Automation']['find'](_0x19ef24)[_0xfa04('0x25')](handleEntityNotFound(_0x11ec9d,null))[_0xfa04('0x25')](respondWithResult(_0x11ec9d,null))['catch'](handleError(_0x11ec9d,null));};exports[_0xfa04('0x49')]=function(_0x56048f,_0x43486a){return db[_0xfa04('0x43')][_0xfa04('0x49')](_0x56048f[_0xfa04('0x4a')],{})[_0xfa04('0x25')](respondWithResult(_0x43486a,0xc9))[_0xfa04('0x46')](handleError(_0x43486a,null));};exports[_0xfa04('0x24')]=function(_0x9c9788,_0x46c9f5){if(_0x9c9788[_0xfa04('0x4a')]['id']){delete _0x9c9788['body']['id'];}return db[_0xfa04('0x43')][_0xfa04('0x4b')]({'where':{'id':_0x9c9788[_0xfa04('0x4c')]['id']}})[_0xfa04('0x25')](handleEntityNotFound(_0x46c9f5,null))[_0xfa04('0x25')](saveUpdates(_0x9c9788[_0xfa04('0x4a')],null))[_0xfa04('0x25')](respondWithResult(_0x46c9f5,null))[_0xfa04('0x46')](handleError(_0x46c9f5,null));};exports[_0xfa04('0x26')]=function(_0x22e9c3,_0xf8d4e7){return db[_0xfa04('0x43')]['find']({'where':{'id':_0x22e9c3['params']['id']}})['then'](handleEntityNotFound(_0xf8d4e7,null))[_0xfa04('0x25')](removeEntity(_0xf8d4e7,null))[_0xfa04('0x46')](handleError(_0xf8d4e7,null));};exports[_0xfa04('0x4d')]=function(_0x5e3fa6,_0x16d008,_0x4d5ee3){return db[_0xfa04('0x4e')][_0xfa04('0x4b')]({'where':{'id':_0x5e3fa6['params']['id']}})[_0xfa04('0x25')](handleEntityNotFound(_0x16d008,null))[_0xfa04('0x25')](function(_0x36f23f){if(_0x36f23f){return _0x36f23f[_0xfa04('0x4d')](_0x5e3fa6[_0xfa04('0x4a')][_0xfa04('0x4f')],_[_0xfa04('0x50')](_0x5e3fa6[_0xfa04('0x4a')],[_0xfa04('0x4f'),'id'])||{});}})[_0xfa04('0x25')](respondWithResult(_0x16d008,null))[_0xfa04('0x46')](handleError(_0x16d008,null));};exports[_0xfa04('0x51')]=function(_0x39d673,_0x1722b9,_0x34b48d){var _0x5eeee9={};var _0x33845e={};var _0x532dc6;var _0x5bddc8;return db[_0xfa04('0x43')][_0xfa04('0x52')]({'where':{'id':_0x39d673[_0xfa04('0x4c')]['id']}})[_0xfa04('0x25')](handleEntityNotFound(_0x1722b9,null))[_0xfa04('0x25')](function(_0x56a337){if(_0x56a337){_0x532dc6=_0x56a337;_0x33845e[_0xfa04('0x30')]=_[_0xfa04('0x48')](db[_0xfa04('0x4e')]['rawAttributes']);_0x33845e['query']=_['keys'](_0x39d673[_0xfa04('0x31')]);_0x33845e[_0xfa04('0x32')]=_[_0xfa04('0x34')](_0x33845e[_0xfa04('0x30')],_0x33845e[_0xfa04('0x31')]);_0x5eeee9[_0xfa04('0x33')]=_[_0xfa04('0x34')](_0x33845e['model'],qs[_0xfa04('0x35')](_0x39d673[_0xfa04('0x31')][_0xfa04('0x35')]));_0x5eeee9['attributes']=_0x5eeee9[_0xfa04('0x33')][_0xfa04('0x36')]?_0x5eeee9['attributes']:_0x33845e['model'];_0x5eeee9['order']=qs[_0xfa04('0x39')](_0x39d673[_0xfa04('0x31')][_0xfa04('0x39')]);_0x5eeee9['where']=qs[_0xfa04('0x32')](_['pick'](_0x39d673[_0xfa04('0x31')],_0x33845e[_0xfa04('0x32')]));if(_0x39d673[_0xfa04('0x31')][_0xfa04('0x3b')]){_0x5eeee9[_0xfa04('0x3c')]=_['merge'](_0x5eeee9['where'],{'$or':_[_0xfa04('0x2c')](_0x5eeee9[_0xfa04('0x33')],function(_0x2674d7){var _0xec67eb={};_0xec67eb[_0x2674d7]={'$like':'%'+_0x39d673['query'][_0xfa04('0x3b')]+'%'};return _0xec67eb;})});}_0x5eeee9=_[_0xfa04('0x3d')]({},_0x5eeee9,_0x39d673[_0xfa04('0x40')]);return _0x532dc6['getConditions'](_0x5eeee9);}})['then'](function(_0x28f009){if(_0x28f009){_0x5bddc8=_0x28f009[_0xfa04('0x36')];if(!_0x39d673['query'][_0xfa04('0x37')](_0xfa04('0x38'))){_0x5eeee9[_0xfa04('0x1d')]=qs[_0xfa04('0x1d')](_0x39d673['query']['limit']);_0x5eeee9[_0xfa04('0x1c')]=qs[_0xfa04('0x1c')](_0x39d673[_0xfa04('0x31')]['offset']);}return _0x532dc6[_0xfa04('0x51')](_0x5eeee9);}})['then'](function(_0x376d10){if(_0x376d10){return _0x376d10?{'count':_0x5bddc8,'rows':_0x376d10}:null;}})[_0xfa04('0x25')](respondWithResult(_0x1722b9,null))[_0xfa04('0x46')](handleError(_0x1722b9,null));};exports[_0xfa04('0x53')]=function(_0x4d48a4,_0x350964,_0x5b3407){return db[_0xfa04('0x54')][_0xfa04('0x4b')]({'where':{'id':_0x4d48a4[_0xfa04('0x4c')]['id']}})['then'](handleEntityNotFound(_0x350964,null))[_0xfa04('0x25')](function(_0x24a6dd){if(_0x24a6dd){return _0x24a6dd[_0xfa04('0x53')](_0x4d48a4['body'][_0xfa04('0x4f')],_['omit'](_0x4d48a4[_0xfa04('0x4a')],[_0xfa04('0x4f'),'id'])||{});}})[_0xfa04('0x25')](respondWithResult(_0x350964,null))[_0xfa04('0x46')](handleError(_0x350964,null));};exports[_0xfa04('0x55')]=function(_0x4db5df,_0x30794d,_0x1a0cdb){var _0x36723d={};var _0x2bf803={};var _0x370d4d;var _0x1d1439;return db[_0xfa04('0x43')][_0xfa04('0x52')]({'where':{'id':_0x4db5df[_0xfa04('0x4c')]['id']}})[_0xfa04('0x25')](handleEntityNotFound(_0x30794d,null))[_0xfa04('0x25')](function(_0x3a2fde){if(_0x3a2fde){_0x370d4d=_0x3a2fde;_0x2bf803[_0xfa04('0x30')]=_['keys'](db[_0xfa04('0x54')][_0xfa04('0x2d')]);_0x2bf803['query']=_[_0xfa04('0x48')](_0x4db5df[_0xfa04('0x31')]);_0x2bf803[_0xfa04('0x32')]=_[_0xfa04('0x34')](_0x2bf803[_0xfa04('0x30')],_0x2bf803[_0xfa04('0x31')]);_0x36723d['attributes']=_[_0xfa04('0x34')](_0x2bf803[_0xfa04('0x30')],qs['fields'](_0x4db5df[_0xfa04('0x31')][_0xfa04('0x35')]));_0x36723d[_0xfa04('0x33')]=_0x36723d[_0xfa04('0x33')][_0xfa04('0x36')]?_0x36723d[_0xfa04('0x33')]:_0x2bf803[_0xfa04('0x30')];_0x36723d[_0xfa04('0x56')]=qs['sort'](_0x4db5df[_0xfa04('0x31')][_0xfa04('0x39')]);_0x36723d[_0xfa04('0x3c')]=qs[_0xfa04('0x32')](_[_0xfa04('0x3a')](_0x4db5df['query'],_0x2bf803[_0xfa04('0x32')]));if(_0x4db5df[_0xfa04('0x31')][_0xfa04('0x3b')]){_0x36723d[_0xfa04('0x3c')]=_[_0xfa04('0x3d')](_0x36723d['where'],{'$or':_[_0xfa04('0x2c')](_0x36723d[_0xfa04('0x33')],function(_0x58c152){var _0x5e7e8b={};_0x5e7e8b[_0x58c152]={'$like':'%'+_0x4db5df[_0xfa04('0x31')][_0xfa04('0x3b')]+'%'};return _0x5e7e8b;})});}_0x36723d=_[_0xfa04('0x3d')]({},_0x36723d,_0x4db5df[_0xfa04('0x40')]);return _0x370d4d['getActions'](_0x36723d);}})[_0xfa04('0x25')](function(_0x18905d){if(_0x18905d){_0x1d1439=_0x18905d['length'];if(!_0x4db5df[_0xfa04('0x31')][_0xfa04('0x37')](_0xfa04('0x38'))){_0x36723d[_0xfa04('0x1d')]=qs[_0xfa04('0x1d')](_0x4db5df['query']['limit']);_0x36723d[_0xfa04('0x1c')]=qs[_0xfa04('0x1c')](_0x4db5df[_0xfa04('0x31')][_0xfa04('0x1c')]);}return _0x370d4d[_0xfa04('0x55')](_0x36723d);}})[_0xfa04('0x25')](function(_0x2fb185){if(_0x2fb185){return _0x2fb185?{'count':_0x1d1439,'rows':_0x2fb185}:null;}})['then'](respondWithResult(_0x30794d,null))['catch'](handleError(_0x30794d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 5feb8d9..1e91f45 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 _0x3bcd=['bluebird','request-promise','rimraf','../../config/environment','Automation','tools_automations','lodash','util','api','moment'];(function(_0x4c0101,_0x528dbe){var _0x2c731f=function(_0x311c84){while(--_0x311c84){_0x4c0101['push'](_0x4c0101['shift']());}};_0x2c731f(++_0x528dbe);}(_0x3bcd,0x13c));var _0xd3bc=function(_0x2a04,_0x434f07){_0x2a04=_0x2a04-0x0;var _0x2c7007=_0x3bcd[_0x2a04];return _0x2c7007;};'use strict';var _=require(_0xd3bc('0x0'));var util=require(_0xd3bc('0x1'));var logger=require('../../config/logger')(_0xd3bc('0x2'));var moment=require(_0xd3bc('0x3'));var BPromise=require(_0xd3bc('0x4'));var rp=require(_0xd3bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3bc('0x6'));var config=require(_0xd3bc('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x1e367c,_0x360bad){return _0x1e367c['define'](_0xd3bc('0x8'),attributes,{'tableName':_0xd3bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25c3=['define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x2581b7,_0x102897){var _0xa925f1=function(_0xcc5fbc){while(--_0xcc5fbc){_0x2581b7['push'](_0x2581b7['shift']());}};_0xa925f1(++_0x102897);}(_0x25c3,0x85));var _0x325c=function(_0x53a558,_0x5b25cf){_0x53a558=_0x53a558-0x0;var _0x40481f=_0x25c3[_0x53a558];return _0x40481f;};'use strict';var _=require(_0x325c('0x0'));var util=require(_0x325c('0x1'));var logger=require(_0x325c('0x2'))(_0x325c('0x3'));var moment=require(_0x325c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x325c('0x5'));var rimraf=require('rimraf');var config=require(_0x325c('0x6'));var attributes=require('./automation.attributes');module['exports']=function(_0x261d83,_0x5958a6){return _0x261d83[_0x325c('0x7')](_0x325c('0x8'),attributes,{'tableName':_0x325c('0x9'),'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 e2fbe7b..b983b15 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 _0xbc7a=['error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x17a71f,_0x5373a2){var _0x3bd012=function(_0x3db809){while(--_0x3db809){_0x17a71f['push'](_0x17a71f['shift']());}};_0x3bd012(++_0x5373a2);}(_0xbc7a,0xa4));var _0xabc7=function(_0xe67a7a,_0x52f187){_0xe67a7a=_0xe67a7a-0x0;var _0x1d096b=_0xbc7a[_0xe67a7a];return _0x1d096b;};'use strict';var _=require(_0xabc7('0x0'));var util=require(_0xabc7('0x1'));var moment=require(_0xabc7('0x2'));var BPromise=require('bluebird');var rs=require(_0xabc7('0x3'));var fs=require('fs');var Redis=require(_0xabc7('0x4'));var db=require(_0xabc7('0x5'))['db'];var utils=require(_0xabc7('0x6'));var logger=require(_0xabc7('0x7'))(_0xabc7('0x8'));var config=require('../../config/environment');var jayson=require(_0xabc7('0x9'));var client=jayson[_0xabc7('0xa')][_0xabc7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28396c,_0x54a7d4,_0x2536d1){return new BPromise(function(_0x5b6d13,_0x441642){return client['request'](_0x28396c,_0x2536d1)[_0xabc7('0xc')](function(_0x2d15b4){logger[_0xabc7('0xd')](_0xabc7('0xe'),_0x54a7d4,_0xabc7('0xf'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x54a7d4,_0xabc7('0xf'),JSON['stringify'](_0x2d15b4));if(_0x2d15b4[_0xabc7('0x10')]){if(_0x2d15b4[_0xabc7('0x10')][_0xabc7('0x11')]===0x1f4){logger['error'](_0xabc7('0xe'),_0x54a7d4,_0x2d15b4[_0xabc7('0x10')]['message']);return _0x441642(_0x2d15b4['error'][_0xabc7('0x12')]);}logger[_0xabc7('0x10')]('Automation,\x20%s,\x20%s',_0x54a7d4,_0x2d15b4[_0xabc7('0x10')]['message']);return _0x5b6d13(_0x2d15b4[_0xabc7('0x10')][_0xabc7('0x12')]);}else{logger[_0xabc7('0xd')](_0xabc7('0xe'),_0x54a7d4,'request\x20sent');_0x5b6d13(_0x2d15b4['result'][_0xabc7('0x12')]);}})[_0xabc7('0x13')](function(_0x4216a2){logger[_0xabc7('0x10')]('Automation,\x20%s,\x20%s',_0x54a7d4,_0x4216a2);_0x441642(_0x4216a2);});});} \ No newline at end of file +var _0xd027=['then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7d02('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7d02('0x1'));var fs=require('fs');var Redis=require(_0x7d02('0x2'));var db=require(_0x7d02('0x3'))['db'];var utils=require(_0x7d02('0x4'));var logger=require(_0x7d02('0x5'))(_0x7d02('0x6'));var config=require(_0x7d02('0x7'));var jayson=require(_0x7d02('0x8'));var client=jayson['client'][_0x7d02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19a3b4,_0x2f59e2,_0x4442c5){return new BPromise(function(_0x10647b,_0x310426){return client[_0x7d02('0xa')](_0x19a3b4,_0x4442c5)[_0x7d02('0xb')](function(_0x10af16){logger[_0x7d02('0xc')](_0x7d02('0xd'),_0x2f59e2,_0x7d02('0xe'));logger[_0x7d02('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x2f59e2,_0x7d02('0xe'),JSON[_0x7d02('0x10')](_0x10af16));if(_0x10af16['error']){if(_0x10af16[_0x7d02('0x11')][_0x7d02('0x12')]===0x1f4){logger[_0x7d02('0x11')](_0x7d02('0xd'),_0x2f59e2,_0x10af16['error'][_0x7d02('0x13')]);return _0x310426(_0x10af16['error'][_0x7d02('0x13')]);}logger[_0x7d02('0x11')]('Automation,\x20%s,\x20%s',_0x2f59e2,_0x10af16[_0x7d02('0x11')][_0x7d02('0x13')]);return _0x10647b(_0x10af16['error'][_0x7d02('0x13')]);}else{logger[_0x7d02('0xc')](_0x7d02('0xd'),_0x2f59e2,'request\x20sent');_0x10647b(_0x10af16[_0x7d02('0x14')][_0x7d02('0x13')]);}})[_0x7d02('0x15')](function(_0x2017f0){logger[_0x7d02('0x11')](_0x7d02('0xd'),_0x2f59e2,_0x2017f0);_0x310426(_0x2017f0);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c9b98a8..e758826 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 _0xabd8=['/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions'];(function(_0x35e9ad,_0x4c29a4){var _0x5b5e9c=function(_0x197fef){while(--_0x197fef){_0x35e9ad['push'](_0x35e9ad['shift']());}};_0x5b5e9c(++_0x4c29a4);}(_0xabd8,0x142));var _0x8abd=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0xabd8[_0x39cf70];return _0x580424;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8abd('0x0'));var express=require(_0x8abd('0x1'));var router=express[_0x8abd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8abd('0x3'));var interaction=require(_0x8abd('0x4'));var config=require(_0x8abd('0x5'));var controller=require(_0x8abd('0x6'));router[_0x8abd('0x7')]('/',auth[_0x8abd('0x8')](),controller[_0x8abd('0x9')]);router[_0x8abd('0x7')](_0x8abd('0xa'),auth[_0x8abd('0x8')](),controller[_0x8abd('0xb')]);router[_0x8abd('0x7')](_0x8abd('0xc'),auth['isAuthenticated'](),controller[_0x8abd('0xd')]);router[_0x8abd('0x7')](_0x8abd('0xe'),auth[_0x8abd('0x8')](),controller[_0x8abd('0xf')]);router[_0x8abd('0x10')]('/',auth[_0x8abd('0x8')](),controller[_0x8abd('0x11')]);router[_0x8abd('0x10')](_0x8abd('0xc'),auth['isAuthenticated'](),controller[_0x8abd('0x12')]);router[_0x8abd('0x10')](_0x8abd('0xe'),auth['isAuthenticated'](),controller[_0x8abd('0x13')]);router[_0x8abd('0x14')](_0x8abd('0xa'),auth[_0x8abd('0x8')](),controller[_0x8abd('0x15')]);router[_0x8abd('0x16')](_0x8abd('0xa'),auth[_0x8abd('0x8')](),controller['destroy']);module[_0x8abd('0x17')]=router; \ No newline at end of file +var _0x8d19=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConditions','/:id/actions','getActions','post','create','/:id/conditions','addConditions','put'];(function(_0x188edb,_0x19fed6){var _0x669a3d=function(_0x40b5d9){while(--_0x40b5d9){_0x188edb['push'](_0x188edb['shift']());}};_0x669a3d(++_0x19fed6);}(_0x8d19,0xd1));var _0x98d1=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x8d19[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x98d1('0x0'));var util=require(_0x98d1('0x1'));var path=require(_0x98d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x98d1('0x3'));var router=express[_0x98d1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x98d1('0x5'));var interaction=require(_0x98d1('0x6'));var config=require(_0x98d1('0x7'));var controller=require('./automation.controller');router['get']('/',auth[_0x98d1('0x8')](),controller[_0x98d1('0x9')]);router[_0x98d1('0xa')](_0x98d1('0xb'),auth[_0x98d1('0x8')](),controller[_0x98d1('0xc')]);router[_0x98d1('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x98d1('0xd')]);router[_0x98d1('0xa')](_0x98d1('0xe'),auth[_0x98d1('0x8')](),controller[_0x98d1('0xf')]);router[_0x98d1('0x10')]('/',auth['isAuthenticated'](),controller[_0x98d1('0x11')]);router[_0x98d1('0x10')](_0x98d1('0x12'),auth[_0x98d1('0x8')](),controller[_0x98d1('0x13')]);router[_0x98d1('0x10')]('/:id/actions',auth[_0x98d1('0x8')](),controller['addActions']);router[_0x98d1('0x14')]('/:id',auth[_0x98d1('0x8')](),controller['update']);router['delete'](_0x98d1('0xb'),auth['isAuthenticated'](),controller[_0x98d1('0x15')]);module[_0x98d1('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 2294fcc..72535a0 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 _0x2e25=['UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#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','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x344eb8,_0x12a8a5){var _0x3f197c=function(_0x21fa6e){while(--_0x21fa6e){_0x344eb8['push'](_0x344eb8['shift']());}};_0x3f197c(++_0x12a8a5);}(_0x2e25,0x8c));var _0x52e2=function(_0x42c3db,_0x4e6268){_0x42c3db=_0x42c3db-0x0;var _0x572868=_0x2e25[_0x42c3db];return _0x572868;};'use strict';var Sequelize=require(_0x52e2('0x0'));module[_0x52e2('0x1')]={'name':{'type':Sequelize[_0x52e2('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x52e2('0x3')](_0x52e2('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x52e2('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x52e2('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x52e2('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x52e2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52e2('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x52e2('0x5')](0x3)[_0x52e2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52e2('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x52e2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52e2('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x52e2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52e2('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x52e2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x52e2('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x52e2('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52e2('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x52e2('0x5')](0x3)[_0x52e2('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x52e2('0xe')},'dialTimezone':{'type':Sequelize[_0x52e2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x52e2('0x2')],'defaultValue':_0x52e2('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x52e2('0x3')](_0x52e2('0x10'),'never',_0x52e2('0x11')),'defaultValue':_0x52e2('0x10')},'dialAMDActive':{'type':Sequelize[_0x52e2('0x12')],'defaultValue':0x0,'comment':_0x52e2('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x52e2('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x52e2('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x52e2('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x52e2('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x52e2('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x52e2('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x52e2('0x5')](0x9)[_0x52e2('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x52e2('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x52e2('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x52e2('0x5')](0x9)[_0x52e2('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x52e2('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x52e2('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x52e2('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x52e2('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x52e2('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x52e2('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x52e2('0x3')](_0x52e2('0x1b'),_0x52e2('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x52e2('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x52e2('0x5')](0x3)[_0x52e2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x52e2('0x1d')},'dialCutDigit':{'type':Sequelize[_0x52e2('0x5')](0x3)[_0x52e2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x52e2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52e2('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x52e2('0x5')](0x5)[_0x52e2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52e2('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x52e2('0x5')](0x3)[_0x52e2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52e2('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x52e2('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52e2('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x52e2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x52e2('0x5')](0x5)[_0x52e2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52e2('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x52e2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x52e2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x52e2('0x5')](0x3)[_0x52e2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x52e2('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x52e2('0x5')](0x5)[_0x52e2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x52e2('0x24')}}; \ No newline at end of file +var _0x787a=['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)','#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','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x787a,0x1ce));var _0xa787=function(_0x5c34b8,_0x2e1efe){_0x5c34b8=_0x5c34b8-0x0;var _0x56de7b=_0x787a[_0x5c34b8];return _0x56de7b;};'use strict';var Sequelize=require(_0xa787('0x0'));module['exports']={'name':{'type':Sequelize[_0xa787('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa787('0x2')](_0xa787('0x3')),'allowNull':![],'defaultValue':_0xa787('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa787('0x4')],'defaultValue':0x0,'comment':_0xa787('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa787('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa787('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa787('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa787('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa787('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa787('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa787('0x9')](0x5)[_0xa787('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa787('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa787('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa787('0x9')](0x5)[_0xa787('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa787('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)[_0xa787('0x7')],'defaultValue':0x3,'comment':_0xa787('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa787('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa787('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa787('0x10')},'dialTimezone':{'type':Sequelize[_0xa787('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa787('0x1')],'defaultValue':_0xa787('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xa787('0x2')](_0xa787('0x12'),_0xa787('0x13'),_0xa787('0x14')),'defaultValue':_0xa787('0x12')},'dialAMDActive':{'type':Sequelize[_0xa787('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xa787('0x9')](0x9)[_0xa787('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xa787('0x9')](0x9)[_0xa787('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa787('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa787('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa787('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa787('0x9')](0x9)[_0xa787('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa787('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xa787('0x9')](0x9)[_0xa787('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa787('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa787('0x9')](0x9)[_0xa787('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa787('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa787('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa787('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa787('0x9')](0x5)[_0xa787('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa787('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa787('0x9')](0x9)[_0xa787('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xa787('0x2')]('DESC','ASC'),'defaultValue':_0xa787('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xa787('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa787('0x1d')},'dialCutDigit':{'type':Sequelize[_0xa787('0x9')](0x3)[_0xa787('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa787('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)[_0xa787('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa787('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa787('0x9')](0x5)[_0xa787('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa787('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)[_0xa787('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa787('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xa787('0x9')](0x5)[_0xa787('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa787('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)[_0xa787('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa787('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)[_0xa787('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa787('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa787('0x9')](0x5)[_0xa787('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa787('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa787('0x9')](0x3)[_0xa787('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa787('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa787('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2a9fb9f..4676184 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 _0xd17f=['phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','insert','fromQuery','cm_contacts','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','save','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','keys','query','attributes','fields','hasOwnProperty','where','pick','filters','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','intersection','length','include','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','createdAt','user','UserProfileSection','update','params','getHoppers','findOne','CmHopper','nolimit','order','sort','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','toString','NOW()','from','ListId\x20=\x20?','CmListId'];(function(_0x9848e7,_0xf2b1f0){var _0x537a1e=function(_0x270f0){while(--_0x270f0){_0x9848e7['push'](_0x9848e7['shift']());}};_0x537a1e(++_0xf2b1f0);}(_0xd17f,0x1a5));var _0xfd17=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xd17f[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xfd17('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd17('0x1'));var jsonpatch=require(_0xfd17('0x2'));var rp=require(_0xfd17('0x3'));var moment=require(_0xfd17('0x4'));var BPromise=require(_0xfd17('0x5'));var Mustache=require(_0xfd17('0x6'));var util=require(_0xfd17('0x7'));var path=require(_0xfd17('0x8'));var sox=require(_0xfd17('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd17('0xa'));var _=require(_0xfd17('0xb'));var squel=require(_0xfd17('0xc'));var crypto=require(_0xfd17('0xd'));var jsforce=require(_0xfd17('0xe'));var deskjs=require(_0xfd17('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfd17('0x10'));var Papa=require('papaparse');var Redis=require(_0xfd17('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfd17('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd17('0x13'));var logger=require(_0xfd17('0x14'))(_0xfd17('0x15'));var utils=require(_0xfd17('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfd17('0x17'));var db=require(_0xfd17('0x18'))['db'];function respondWithStatusCode(_0x5c7de7,_0x10371d){_0x10371d=_0x10371d||0xcc;return function(_0x38665e){if(_0x38665e){return _0x5c7de7[_0xfd17('0x19')](_0x10371d);}return _0x5c7de7[_0xfd17('0x1a')](_0x10371d)[_0xfd17('0x1b')]();};}function respondWithResult(_0x3fdd86,_0x42a53f){_0x42a53f=_0x42a53f||0xc8;return function(_0xaa0307){if(_0xaa0307){return _0x3fdd86['status'](_0x42a53f)[_0xfd17('0x1c')](_0xaa0307);}};}function respondWithFilteredResult(_0x18f752,_0x396052){return function(_0x19fa45){if(_0x19fa45){var _0xa3d2b6=typeof _0x396052[_0xfd17('0x1d')]===_0xfd17('0x1e')&&typeof _0x396052[_0xfd17('0x1f')]===_0xfd17('0x1e');var _0x39b283=_0x19fa45['count'];var _0x31f395=_0xa3d2b6?0x0:_0x396052[_0xfd17('0x1d')];var _0x497191=_0xa3d2b6?_0x19fa45['count']:_0x396052[_0xfd17('0x1d')]+_0x396052[_0xfd17('0x1f')];var _0x218513;if(_0x497191>=_0x39b283){_0x497191=_0x39b283;_0x218513=0xc8;}else{_0x218513=0xce;}_0x18f752['status'](_0x218513);return _0x18f752['set']('Content-Range',_0x31f395+'-'+_0x497191+'/'+_0x39b283)[_0xfd17('0x1c')](_0x19fa45);}return null;};}function patchUpdates(_0xdb0d0){return function(_0x36fa3d){try{jsonpatch['apply'](_0x36fa3d,_0xdb0d0,!![]);}catch(_0x2cd842){return BPromise['reject'](_0x2cd842);}return _0x36fa3d[_0xfd17('0x20')]();};}function saveUpdates(_0x4a08db,_0x4a4380){return function(_0x543e8a){if(_0x543e8a){return _0x543e8a['update'](_0x4a08db)[_0xfd17('0x21')](function(_0x3b88f7){return _0x3b88f7;});}return null;};}function removeEntity(_0x13d938,_0x38e2e7){return function(_0x583354){if(_0x583354){return _0x583354[_0xfd17('0x22')]()[_0xfd17('0x21')](function(){var _0x113f61=_0x583354[_0xfd17('0x23')]({'plain':!![]});var _0xad268c=_0xfd17('0x24');return db[_0xfd17('0x25')][_0xfd17('0x22')]({'where':{'type':_0xad268c,'resourceId':_0x113f61['id']}})[_0xfd17('0x21')](function(){return _0x583354;});})['then'](function(){_0x13d938[_0xfd17('0x1a')](0xcc)[_0xfd17('0x1b')]();});}};}function handleEntityNotFound(_0x2b48cf,_0x343f0f){return function(_0x5ad4c5){if(!_0x5ad4c5){_0x2b48cf[_0xfd17('0x19')](0x194);}return _0x5ad4c5;};}function handleError(_0x4b199d,_0x4f841b){_0x4f841b=_0x4f841b||0x1f4;return function(_0x41b7e7){logger['error'](_0x41b7e7[_0xfd17('0x26')]);if(_0x41b7e7['name']){delete _0x41b7e7[_0xfd17('0x27')];}_0x4b199d['status'](_0x4f841b)[_0xfd17('0x28')](_0x41b7e7);};}exports[_0xfd17('0x29')]=function(_0x22dff1,_0x56a1d4){var _0x36c339={},_0x393251={},_0x13eabe={'count':0x0,'rows':[]};var _0x174804=_[_0xfd17('0x2a')](db[_0xfd17('0x2b')][_0xfd17('0x2c')],function(_0x2067dc){return{'name':_0x2067dc['fieldName'],'type':_0x2067dc[_0xfd17('0x2d')][_0xfd17('0x2e')]};});_0x393251[_0xfd17('0x2f')]=_[_0xfd17('0x2a')](_0x174804,_0xfd17('0x27'));_0x393251['query']=_[_0xfd17('0x30')](_0x22dff1['query']);_0x393251['filters']=_['intersection'](_0x393251[_0xfd17('0x2f')],_0x393251[_0xfd17('0x31')]);_0x36c339[_0xfd17('0x32')]=_['intersection'](_0x393251['model'],qs[_0xfd17('0x33')](_0x22dff1[_0xfd17('0x31')][_0xfd17('0x33')]));_0x36c339[_0xfd17('0x32')]=_0x36c339['attributes']['length']?_0x36c339['attributes']:_0x393251['model'];if(!_0x22dff1['query'][_0xfd17('0x34')]('nolimit')){_0x36c339['limit']=qs['limit'](_0x22dff1[_0xfd17('0x31')]['limit']);_0x36c339['offset']=qs[_0xfd17('0x1d')](_0x22dff1['query'][_0xfd17('0x1d')]);}_0x36c339['order']=qs['sort'](_0x22dff1[_0xfd17('0x31')]['sort']);_0x36c339[_0xfd17('0x35')]=qs['filters'](_[_0xfd17('0x36')](_0x22dff1[_0xfd17('0x31')],_0x393251[_0xfd17('0x37')]),_0x174804);if(_0x22dff1['query'][_0xfd17('0x38')]){_0x36c339['where']=_[_0xfd17('0x39')](_0x36c339['where'],{'$or':_[_0xfd17('0x2a')](_0x174804,function(_0x26b155){if(_0x26b155[_0xfd17('0x2d')]!==_0xfd17('0x3a')){var _0x7ba6ca={};_0x7ba6ca[_0x26b155[_0xfd17('0x27')]]={'$like':'%'+_0x22dff1['query']['filter']+'%'};return _0x7ba6ca;}})});}_0x36c339=_[_0xfd17('0x39')]({},_0x36c339,_0x22dff1['options']);var _0x33da5c={'where':_0x36c339['where']};return db[_0xfd17('0x2b')][_0xfd17('0x3b')](_0x33da5c)['then'](function(_0x416044){_0x13eabe['count']=_0x416044;if(_0x22dff1['query'][_0xfd17('0x3c')]){_0x36c339['include']=[{'all':!![]}];}return db[_0xfd17('0x2b')][_0xfd17('0x3d')](_0x36c339);})[_0xfd17('0x21')](function(_0xeec59e){_0x13eabe[_0xfd17('0x3e')]=_0xeec59e;return _0x13eabe;})[_0xfd17('0x21')](respondWithFilteredResult(_0x56a1d4,_0x36c339))[_0xfd17('0x3f')](handleError(_0x56a1d4,null));};exports[_0xfd17('0x40')]=function(_0x1facb6,_0xb84dbf){var _0x340dd9={'raw':![],'where':{'id':_0x1facb6['params']['id']}},_0x22a083={};_0x22a083[_0xfd17('0x2f')]=_[_0xfd17('0x30')](db[_0xfd17('0x2b')]['rawAttributes']);_0x22a083['query']=_['keys'](_0x1facb6[_0xfd17('0x31')]);_0x22a083[_0xfd17('0x37')]=_[_0xfd17('0x41')](_0x22a083['model'],_0x22a083[_0xfd17('0x31')]);_0x340dd9['attributes']=_[_0xfd17('0x41')](_0x22a083[_0xfd17('0x2f')],qs[_0xfd17('0x33')](_0x1facb6[_0xfd17('0x31')]['fields']));_0x340dd9[_0xfd17('0x32')]=_0x340dd9['attributes'][_0xfd17('0x42')]?_0x340dd9['attributes']:_0x22a083[_0xfd17('0x2f')];if(_0x1facb6['query'][_0xfd17('0x3c')]){_0x340dd9[_0xfd17('0x43')]=[{'all':!![]}];}_0x340dd9=_['merge']({},_0x340dd9,_0x1facb6[_0xfd17('0x44')]);return db['Campaign'][_0xfd17('0x45')](_0x340dd9)[_0xfd17('0x21')](handleEntityNotFound(_0xb84dbf,null))[_0xfd17('0x21')](respondWithResult(_0xb84dbf,null))[_0xfd17('0x3f')](handleError(_0xb84dbf,null));};exports[_0xfd17('0x46')]=function(_0x57aa2f,_0x5e55a1){return db[_0xfd17('0x2b')]['create'](_0x57aa2f['body'],{})['then'](function(_0x32ac95){var _0x5666b9=_0x57aa2f['user'][_0xfd17('0x23')]({'plain':!![]});if(!_0x5666b9)throw new Error(_0xfd17('0x47'));if(_0x5666b9[_0xfd17('0x48')]==='user'){var _0xda263d=_0x32ac95['get']({'plain':!![]});var _0x39f8ae='IvrCampaigns';return db['UserProfileSection'][_0xfd17('0x45')]({'where':{'name':_0x39f8ae,'userProfileId':_0x5666b9[_0xfd17('0x49')]},'raw':!![]})[_0xfd17('0x21')](function(_0x119317){if(_0x119317&&_0x119317[_0xfd17('0x4a')]===0x0){return db['UserProfileResource'][_0xfd17('0x46')]({'name':_0xda263d['name'],'resourceId':_0xda263d['id'],'type':_0x119317[_0xfd17('0x27')],'sectionId':_0x119317['id']},{})['then'](function(){return _0x32ac95;});}else{return _0x32ac95;}})['catch'](function(_0x3feda3){logger[_0xfd17('0x4b')](_0xfd17('0x4c'),_0x3feda3);throw _0x3feda3;});}return _0x32ac95;})[_0xfd17('0x21')](respondWithResult(_0x5e55a1,0xc9))[_0xfd17('0x3f')](handleError(_0x5e55a1,null));};exports[_0xfd17('0x4d')]=function(_0x1cd6e5,_0xcf4f6e){var _0x807e14={'where':{'id':_0x1cd6e5['params']['id']}},_0x41d07a={};_0x41d07a[_0xfd17('0x2f')]=_[_0xfd17('0x30')](db[_0xfd17('0x2b')][_0xfd17('0x2c')]);_0x807e14[_0xfd17('0x32')]=_[_0xfd17('0x41')](_0x41d07a[_0xfd17('0x2f')],qs['fields'](_0x1cd6e5[_0xfd17('0x31')][_0xfd17('0x33')]));_0x807e14[_0xfd17('0x32')]=_0x807e14[_0xfd17('0x32')][_0xfd17('0x42')]?_0x807e14[_0xfd17('0x32')]:_0x41d07a[_0xfd17('0x2f')];if(_0x1cd6e5[_0xfd17('0x31')]['includeAll']){_0x807e14['include']=[{'all':!![]}];}_0x807e14=_[_0xfd17('0x39')]({},_0x807e14,_0x1cd6e5['options']);return db[_0xfd17('0x2b')][_0xfd17('0x45')](_0x807e14)[_0xfd17('0x21')](handleEntityNotFound(_0xcf4f6e,null))[_0xfd17('0x21')](function(_0x3563a6){if(_0x3563a6){var _0x2766c3=_0x3563a6[_0xfd17('0x23')]({'plain':!![]});_0x2766c3=qs['omit'](_0x2766c3,['id','createdAt',_0xfd17('0x4e')]);_0x1cd6e5[_0xfd17('0x4f')]=_[_0xfd17('0x50')](_0x1cd6e5['body'],['id',_0xfd17('0x51'),'updatedAt']);return db[_0xfd17('0x2b')]['create'](_['merge'](_0x2766c3,_0x1cd6e5[_0xfd17('0x4f')]),{'include':_0x1cd6e5['query'][_0xfd17('0x3c')]?[{'all':!![]}]:undefined})[_0xfd17('0x21')](function(_0x4f4143){var _0x2d4eec=_0x1cd6e5[_0xfd17('0x52')][_0xfd17('0x23')]({'plain':!![]});if(!_0x2d4eec)throw new Error(_0xfd17('0x47'));if(_0x2d4eec[_0xfd17('0x48')]===_0xfd17('0x52')){var _0x1bb31c=_0x4f4143[_0xfd17('0x23')]({'plain':!![]});var _0x2fc62c=_0xfd17('0x24');return db[_0xfd17('0x53')][_0xfd17('0x45')]({'where':{'name':_0x2fc62c,'userProfileId':_0x2d4eec[_0xfd17('0x49')]},'raw':!![]})[_0xfd17('0x21')](function(_0xfa6603){if(_0xfa6603&&_0xfa6603[_0xfd17('0x4a')]===0x0){return db['UserProfileResource'][_0xfd17('0x46')]({'name':_0x1bb31c[_0xfd17('0x27')],'resourceId':_0x1bb31c['id'],'type':_0xfa6603[_0xfd17('0x27')],'sectionId':_0xfa6603['id']},{})['then'](function(){return _0x4f4143;});}else{return _0x4f4143;}})[_0xfd17('0x3f')](function(_0x1d2e25){logger[_0xfd17('0x4b')](_0xfd17('0x4c'),_0x1d2e25);throw _0x1d2e25;});}return _0x4f4143;});}})[_0xfd17('0x21')](respondWithResult(_0xcf4f6e,0xc9))['catch'](handleError(_0xcf4f6e,null));};exports[_0xfd17('0x54')]=function(_0x305c11,_0x17275a){if(_0x305c11[_0xfd17('0x4f')]['id']){delete _0x305c11[_0xfd17('0x4f')]['id'];}return db['Campaign'][_0xfd17('0x45')]({'where':{'id':_0x305c11[_0xfd17('0x55')]['id']}})['then'](handleEntityNotFound(_0x17275a,null))[_0xfd17('0x21')](saveUpdates(_0x305c11['body'],null))[_0xfd17('0x21')](respondWithResult(_0x17275a,null))['catch'](handleError(_0x17275a,null));};exports[_0xfd17('0x22')]=function(_0x41a844,_0x3b0aeb){return db[_0xfd17('0x2b')][_0xfd17('0x45')]({'where':{'id':_0x41a844['params']['id']}})[_0xfd17('0x21')](handleEntityNotFound(_0x3b0aeb,null))[_0xfd17('0x21')](removeEntity(_0x3b0aeb,null))['catch'](handleError(_0x3b0aeb,null));};exports[_0xfd17('0x56')]=function(_0x2c83d1,_0x3259b1,_0x580e11){var _0x48f84b={'raw':!![],'where':{}};var _0xe91427={};var _0x2d287e={'count':0x0,'rows':[]};return db[_0xfd17('0x2b')][_0xfd17('0x57')]({'where':{'id':_0x2c83d1[_0xfd17('0x55')]['id']}})[_0xfd17('0x21')](handleEntityNotFound(_0x3259b1,null))[_0xfd17('0x21')](function(_0x4ac45a){if(_0x4ac45a){_0xe91427['model']=_[_0xfd17('0x30')](db[_0xfd17('0x58')]['rawAttributes']);_0xe91427[_0xfd17('0x31')]=_[_0xfd17('0x30')](_0x2c83d1[_0xfd17('0x31')]);_0xe91427[_0xfd17('0x37')]=_[_0xfd17('0x41')](_0xe91427[_0xfd17('0x2f')],_0xe91427['query']);_0x48f84b[_0xfd17('0x32')]=_[_0xfd17('0x41')](_0xe91427[_0xfd17('0x2f')],qs['fields'](_0x2c83d1['query']['fields']));_0x48f84b['attributes']=_0x48f84b[_0xfd17('0x32')][_0xfd17('0x42')]?_0x48f84b[_0xfd17('0x32')]:_0xe91427[_0xfd17('0x2f')];if(!_0x2c83d1[_0xfd17('0x31')][_0xfd17('0x34')](_0xfd17('0x59'))){_0x48f84b[_0xfd17('0x1f')]=qs['limit'](_0x2c83d1[_0xfd17('0x31')][_0xfd17('0x1f')]);_0x48f84b[_0xfd17('0x1d')]=qs['offset'](_0x2c83d1[_0xfd17('0x31')][_0xfd17('0x1d')]);}_0x48f84b[_0xfd17('0x5a')]=qs[_0xfd17('0x5b')](_0x2c83d1[_0xfd17('0x31')]['sort']);_0x48f84b[_0xfd17('0x35')]=qs[_0xfd17('0x37')](_['pick'](_0x2c83d1['query'],_0xe91427['filters']));_0x48f84b[_0xfd17('0x35')][_0xfd17('0x5c')]=_0x4ac45a['id'];if(_0x2c83d1['query'][_0xfd17('0x38')]){_0x48f84b[_0xfd17('0x35')]=_['merge'](_0x48f84b['where'],{'$or':_['map'](_0x48f84b[_0xfd17('0x32')],function(_0x467a57){var _0x108e58={};_0x108e58[_0x467a57]={'$like':'%'+_0x2c83d1[_0xfd17('0x31')][_0xfd17('0x38')]+'%'};return _0x108e58;})});}_0x48f84b=_['merge']({},_0x48f84b,_0x2c83d1['options']);return db[_0xfd17('0x58')][_0xfd17('0x3b')]({'where':_0x48f84b['where']})[_0xfd17('0x21')](function(_0x32503f){_0x2d287e[_0xfd17('0x3b')]=_0x32503f;if(_0x2c83d1[_0xfd17('0x31')][_0xfd17('0x3c')]){_0x48f84b[_0xfd17('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0xfd17('0x3d')](_0x48f84b);})['then'](function(_0x48be42){_0x2d287e['rows']=_0x48be42;return _0x2d287e;});}})['then'](respondWithFilteredResult(_0x3259b1,_0x48f84b))[_0xfd17('0x3f')](handleError(_0x3259b1,null));};exports[_0xfd17('0x5d')]=function(_0x53c188,_0x4a2634,_0x1a7f92){var _0x430cc4={'raw':!![],'where':{}};var _0x28b054={};var _0x530314={'count':0x0,'rows':[]};return db[_0xfd17('0x2b')][_0xfd17('0x57')]({'where':{'id':_0x53c188[_0xfd17('0x55')]['id']}})[_0xfd17('0x21')](handleEntityNotFound(_0x4a2634,null))[_0xfd17('0x21')](function(_0x5f2179){if(_0x5f2179){_0x28b054['model']=_[_0xfd17('0x30')](db['CmHopperHistory'][_0xfd17('0x2c')]);_0x28b054[_0xfd17('0x31')]=_['keys'](_0x53c188[_0xfd17('0x31')]);_0x28b054[_0xfd17('0x37')]=_[_0xfd17('0x41')](_0x28b054[_0xfd17('0x2f')],_0x28b054[_0xfd17('0x31')]);_0x430cc4[_0xfd17('0x32')]=_[_0xfd17('0x41')](_0x28b054[_0xfd17('0x2f')],qs[_0xfd17('0x33')](_0x53c188[_0xfd17('0x31')][_0xfd17('0x33')]));_0x430cc4[_0xfd17('0x32')]=_0x430cc4['attributes'][_0xfd17('0x42')]?_0x430cc4[_0xfd17('0x32')]:_0x28b054['model'];if(!_0x53c188['query']['hasOwnProperty'](_0xfd17('0x59'))){_0x430cc4[_0xfd17('0x1f')]=qs['limit'](_0x53c188[_0xfd17('0x31')]['limit']);_0x430cc4[_0xfd17('0x1d')]=qs[_0xfd17('0x1d')](_0x53c188[_0xfd17('0x31')][_0xfd17('0x1d')]);}_0x430cc4[_0xfd17('0x5a')]=qs['sort'](_0x53c188[_0xfd17('0x31')]['sort']);_0x430cc4[_0xfd17('0x35')]=qs[_0xfd17('0x37')](_[_0xfd17('0x36')](_0x53c188['query'],_0x28b054[_0xfd17('0x37')]));_0x430cc4[_0xfd17('0x35')]['CampaignId']=_0x5f2179['id'];if(_0x53c188[_0xfd17('0x31')][_0xfd17('0x38')]){_0x430cc4[_0xfd17('0x35')]=_[_0xfd17('0x39')](_0x430cc4[_0xfd17('0x35')],{'$or':_[_0xfd17('0x2a')](_0x430cc4[_0xfd17('0x32')],function(_0x477acd){var _0x1fc804={};_0x1fc804[_0x477acd]={'$like':'%'+_0x53c188[_0xfd17('0x31')]['filter']+'%'};return _0x1fc804;})});}_0x430cc4=_[_0xfd17('0x39')]({},_0x430cc4,_0x53c188['options']);return db[_0xfd17('0x5e')][_0xfd17('0x3b')]({'where':_0x430cc4[_0xfd17('0x35')]})[_0xfd17('0x21')](function(_0x5b17f1){_0x530314['count']=_0x5b17f1;if(_0x53c188['query'][_0xfd17('0x3c')]){_0x430cc4[_0xfd17('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xfd17('0x3d')](_0x430cc4);})[_0xfd17('0x21')](function(_0x575c95){_0x530314['rows']=_0x575c95;return _0x530314;});}})['then'](respondWithFilteredResult(_0x4a2634,_0x430cc4))[_0xfd17('0x3f')](handleError(_0x4a2634,null));};exports[_0xfd17('0x5f')]=function(_0x1b02b3,_0x5c3be5,_0x2479b9){var _0x24fee6={'raw':!![],'where':{}};var _0x164a10={};var _0x2418ae={'count':0x0,'rows':[]};return db[_0xfd17('0x2b')][_0xfd17('0x57')]({'where':{'id':_0x1b02b3[_0xfd17('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c3be5,null))[_0xfd17('0x21')](function(_0x9b7298){if(_0x9b7298){_0x164a10[_0xfd17('0x2f')]=_[_0xfd17('0x30')](db[_0xfd17('0x60')][_0xfd17('0x2c')]);_0x164a10[_0xfd17('0x31')]=_[_0xfd17('0x30')](_0x1b02b3['query']);_0x164a10['filters']=_[_0xfd17('0x41')](_0x164a10[_0xfd17('0x2f')],_0x164a10[_0xfd17('0x31')]);_0x24fee6[_0xfd17('0x32')]=_[_0xfd17('0x41')](_0x164a10[_0xfd17('0x2f')],qs[_0xfd17('0x33')](_0x1b02b3[_0xfd17('0x31')][_0xfd17('0x33')]));_0x24fee6[_0xfd17('0x32')]=_0x24fee6[_0xfd17('0x32')]['length']?_0x24fee6[_0xfd17('0x32')]:_0x164a10[_0xfd17('0x2f')];if(!_0x1b02b3[_0xfd17('0x31')]['hasOwnProperty'](_0xfd17('0x59'))){_0x24fee6[_0xfd17('0x1f')]=qs[_0xfd17('0x1f')](_0x1b02b3[_0xfd17('0x31')][_0xfd17('0x1f')]);_0x24fee6['offset']=qs[_0xfd17('0x1d')](_0x1b02b3[_0xfd17('0x31')]['offset']);}_0x24fee6['order']=qs[_0xfd17('0x5b')](_0x1b02b3[_0xfd17('0x31')][_0xfd17('0x5b')]);_0x24fee6[_0xfd17('0x35')]=qs[_0xfd17('0x37')](_[_0xfd17('0x36')](_0x1b02b3[_0xfd17('0x31')],_0x164a10[_0xfd17('0x37')]));_0x24fee6[_0xfd17('0x35')][_0xfd17('0x5c')]=_0x9b7298['id'];if(_0x1b02b3['query'][_0xfd17('0x38')]){_0x24fee6[_0xfd17('0x35')]=_[_0xfd17('0x39')](_0x24fee6['where'],{'$or':_[_0xfd17('0x2a')](_0x24fee6['attributes'],function(_0xb7341f){var _0x4643da={};_0x4643da[_0xb7341f]={'$like':'%'+_0x1b02b3['query'][_0xfd17('0x38')]+'%'};return _0x4643da;})});}_0x24fee6=_[_0xfd17('0x39')]({},_0x24fee6,_0x1b02b3[_0xfd17('0x44')]);return db[_0xfd17('0x60')][_0xfd17('0x3b')]({'where':_0x24fee6[_0xfd17('0x35')]})['then'](function(_0x31eefd){_0x2418ae['count']=_0x31eefd;if(_0x1b02b3[_0xfd17('0x31')][_0xfd17('0x3c')]){_0x24fee6[_0xfd17('0x43')]=[{'all':!![]}];}return db[_0xfd17('0x60')][_0xfd17('0x3d')](_0x24fee6);})[_0xfd17('0x21')](function(_0xb91832){_0x2418ae[_0xfd17('0x3e')]=_0xb91832;return _0x2418ae;});}})[_0xfd17('0x21')](respondWithFilteredResult(_0x5c3be5,_0x24fee6))['catch'](handleError(_0x5c3be5,null));};exports[_0xfd17('0x61')]=function(_0x59aa86,_0x1b8901,_0xe8f7b4){var _0x49ff07={'raw':!![],'where':{}};var _0x595f4f={};var _0x19f7ca={'count':0x0,'rows':[]};return db[_0xfd17('0x2b')][_0xfd17('0x57')]({'where':{'id':_0x59aa86[_0xfd17('0x55')]['id']}})[_0xfd17('0x21')](handleEntityNotFound(_0x1b8901,null))['then'](function(_0x3623c9){if(_0x3623c9){_0x595f4f[_0xfd17('0x2f')]=_[_0xfd17('0x30')](db['CmHopperBlack'][_0xfd17('0x2c')]);_0x595f4f[_0xfd17('0x31')]=_[_0xfd17('0x30')](_0x59aa86[_0xfd17('0x31')]);_0x595f4f['filters']=_[_0xfd17('0x41')](_0x595f4f[_0xfd17('0x2f')],_0x595f4f[_0xfd17('0x31')]);_0x49ff07[_0xfd17('0x32')]=_[_0xfd17('0x41')](_0x595f4f[_0xfd17('0x2f')],qs[_0xfd17('0x33')](_0x59aa86[_0xfd17('0x31')]['fields']));_0x49ff07[_0xfd17('0x32')]=_0x49ff07['attributes'][_0xfd17('0x42')]?_0x49ff07[_0xfd17('0x32')]:_0x595f4f[_0xfd17('0x2f')];if(!_0x59aa86[_0xfd17('0x31')][_0xfd17('0x34')]('nolimit')){_0x49ff07[_0xfd17('0x1f')]=qs[_0xfd17('0x1f')](_0x59aa86[_0xfd17('0x31')][_0xfd17('0x1f')]);_0x49ff07[_0xfd17('0x1d')]=qs[_0xfd17('0x1d')](_0x59aa86[_0xfd17('0x31')][_0xfd17('0x1d')]);}_0x49ff07[_0xfd17('0x5a')]=qs[_0xfd17('0x5b')](_0x59aa86['query'][_0xfd17('0x5b')]);_0x49ff07[_0xfd17('0x35')]=qs[_0xfd17('0x37')](_[_0xfd17('0x36')](_0x59aa86['query'],_0x595f4f[_0xfd17('0x37')]));_0x49ff07[_0xfd17('0x35')]['CampaignId']=_0x3623c9['id'];if(_0x59aa86['query'][_0xfd17('0x38')]){_0x49ff07[_0xfd17('0x35')]=_[_0xfd17('0x39')](_0x49ff07[_0xfd17('0x35')],{'$or':_[_0xfd17('0x2a')](_0x49ff07['attributes'],function(_0x550926){var _0x205e99={};_0x205e99[_0x550926]={'$like':'%'+_0x59aa86[_0xfd17('0x31')][_0xfd17('0x38')]+'%'};return _0x205e99;})});}_0x49ff07=_[_0xfd17('0x39')]({},_0x49ff07,_0x59aa86[_0xfd17('0x44')]);return db[_0xfd17('0x62')]['count']({'where':_0x49ff07[_0xfd17('0x35')]})[_0xfd17('0x21')](function(_0x170506){_0x19f7ca[_0xfd17('0x3b')]=_0x170506;if(_0x59aa86['query'][_0xfd17('0x3c')]){_0x49ff07[_0xfd17('0x43')]=[{'all':!![]}];}return db[_0xfd17('0x62')][_0xfd17('0x3d')](_0x49ff07);})[_0xfd17('0x21')](function(_0x30ab03){_0x19f7ca[_0xfd17('0x3e')]=_0x30ab03;return _0x19f7ca;});}})[_0xfd17('0x21')](respondWithFilteredResult(_0x1b8901,_0x49ff07))[_0xfd17('0x3f')](handleError(_0x1b8901,null));};exports[_0xfd17('0x63')]=function(_0x470652,_0x85fe8c,_0x25268a){var _0x1a6914={};var _0x945a55={};var _0x441fb4;var _0x815a7b;return db[_0xfd17('0x2b')][_0xfd17('0x57')]({'where':{'id':_0x470652[_0xfd17('0x55')]['id']}})['then'](handleEntityNotFound(_0x85fe8c,null))[_0xfd17('0x21')](function(_0x556870){if(_0x556870){_0x441fb4=_0x556870;_0x945a55[_0xfd17('0x2f')]=_['keys'](db[_0xfd17('0x64')]['rawAttributes']);_0x945a55[_0xfd17('0x31')]=_[_0xfd17('0x30')](_0x470652[_0xfd17('0x31')]);_0x945a55[_0xfd17('0x37')]=_[_0xfd17('0x41')](_0x945a55['model'],_0x945a55[_0xfd17('0x31')]);_0x1a6914[_0xfd17('0x32')]=_[_0xfd17('0x41')](_0x945a55['model'],qs[_0xfd17('0x33')](_0x470652[_0xfd17('0x31')][_0xfd17('0x33')]));_0x1a6914[_0xfd17('0x32')]=_0x1a6914[_0xfd17('0x32')]['length']?_0x1a6914['attributes']:_0x945a55[_0xfd17('0x2f')];_0x1a6914[_0xfd17('0x5a')]=qs[_0xfd17('0x5b')](_0x470652[_0xfd17('0x31')][_0xfd17('0x5b')]);_0x1a6914[_0xfd17('0x35')]=qs[_0xfd17('0x37')](_[_0xfd17('0x36')](_0x470652[_0xfd17('0x31')],_0x945a55[_0xfd17('0x37')]));if(_0x470652[_0xfd17('0x31')][_0xfd17('0x38')]){_0x1a6914[_0xfd17('0x35')]=_['merge'](_0x1a6914['where'],{'$or':_[_0xfd17('0x2a')](_0x1a6914[_0xfd17('0x32')],function(_0xf011d1){var _0x3773f9={};_0x3773f9[_0xf011d1]={'$like':'%'+_0x470652[_0xfd17('0x31')]['filter']+'%'};return _0x3773f9;})});}_0x1a6914=_[_0xfd17('0x39')]({},_0x1a6914,_0x470652[_0xfd17('0x44')]);return _0x441fb4[_0xfd17('0x63')](_0x1a6914);}})['then'](function(_0xc1ce63){if(_0xc1ce63){_0x815a7b=_0xc1ce63['length'];if(!_0x470652[_0xfd17('0x31')][_0xfd17('0x34')](_0xfd17('0x59'))){_0x1a6914[_0xfd17('0x1f')]=qs['limit'](_0x470652[_0xfd17('0x31')][_0xfd17('0x1f')]);_0x1a6914[_0xfd17('0x1d')]=qs[_0xfd17('0x1d')](_0x470652[_0xfd17('0x31')]['offset']);}return _0x441fb4[_0xfd17('0x63')](_0x1a6914);}})['then'](function(_0x106e37){if(_0x106e37){return _0x106e37?{'count':_0x815a7b,'rows':_0x106e37}:null;}})[_0xfd17('0x21')](respondWithResult(_0x85fe8c,null))[_0xfd17('0x3f')](handleError(_0x85fe8c,null));};exports['addLists']=function(_0x39a05d,_0x1d4aba,_0x1a2e5c){var _0x18b6ff,_0x335fce;return db[_0xfd17('0x2b')][_0xfd17('0x45')]({'where':{'id':_0x39a05d['params']['id']}})[_0xfd17('0x21')](handleEntityNotFound(_0x1d4aba,null))[_0xfd17('0x21')](function(_0x398438){if(_0x398438){_0x335fce=_0x398438;return _0x398438[_0xfd17('0x65')](_0x39a05d[_0xfd17('0x4f')]['ids'],_[_0xfd17('0x50')](_0x39a05d[_0xfd17('0x4f')],[_0xfd17('0x66'),'id'])||{});}return null;})[_0xfd17('0x67')](function(_0xea5820){var _0x5d60e0;_0x18b6ff=_0xea5820||[];var _0x77e17a=[];if(_0xea5820){for(var _0x311edf=0x0;_0x311edf<_0xea5820[_0xfd17('0x42')];_0x311edf+=0x1){var _0x2a93c8=_0xea5820[_0x311edf][_0xfd17('0x23')]({'plain':!![]});_0x335fce[_0xfd17('0x68')]=_0x39a05d[_0xfd17('0x4f')][_0xfd17('0x68')]?_0x39a05d['body'][_0xfd17('0x68')]:_0x335fce['dialCheckDuplicateType'];switch(_0x335fce[_0xfd17('0x68')]){case _0xfd17('0x69'):_0x5d60e0=squel['insert']()[_0xfd17('0x6a')](_0xfd17('0x6b'))['fromQuery']([_0xfd17('0x6c'),_0xfd17('0x6d'),_0xfd17('0x6e'),_0xfd17('0x6f'),_0xfd17('0x5c'),'createdAt',_0xfd17('0x4e')],squel[_0xfd17('0x70')]()[_0xfd17('0x71')](_0xfd17('0x6c'),_0xfd17('0x6c'))[_0xfd17('0x71')]('NOW()','scheduledAt')[_0xfd17('0x71')]('id',_0xfd17('0x6e'))[_0xfd17('0x71')](_0x2a93c8['CmListId']['toString'](),'ListId')['field'](_0x39a05d[_0xfd17('0x55')]['id'][_0xfd17('0x72')](),_0xfd17('0x5c'))[_0xfd17('0x71')]('NOW()',_0xfd17('0x51'))[_0xfd17('0x71')](_0xfd17('0x73'),_0xfd17('0x4e'))[_0xfd17('0x74')]('cm_contacts')[_0xfd17('0x35')]('deletedAt\x20IS\x20NULL')[_0xfd17('0x35')](_0xfd17('0x75'),_0x2a93c8[_0xfd17('0x76')]['toString']())[_0xfd17('0x35')]('phone\x20IS\x20NOT\x20NULL')[_0xfd17('0x35')](_0xfd17('0x77'),squel[_0xfd17('0x70')]()[_0xfd17('0x71')](_0xfd17('0x78'))[_0xfd17('0x74')]('cm_hopper_final')[_0xfd17('0x35')]('CampaignId\x20=\x20?',_0x39a05d[_0xfd17('0x55')]['id'][_0xfd17('0x72')]()))[_0xfd17('0x35')](_0xfd17('0x77'),squel[_0xfd17('0x70')]()[_0xfd17('0x71')](_0xfd17('0x79'))[_0xfd17('0x74')](_0xfd17('0x6b'))['where'](_0xfd17('0x7a'),_0x39a05d[_0xfd17('0x55')]['id'][_0xfd17('0x72')]())))[_0xfd17('0x72')]();break;case'onlyIfOpen':_0x5d60e0=squel[_0xfd17('0x7b')]()[_0xfd17('0x6a')](_0xfd17('0x6b'))[_0xfd17('0x7c')]([_0xfd17('0x6c'),_0xfd17('0x6d'),'ContactId','ListId',_0xfd17('0x5c'),'createdAt','updatedAt'],squel[_0xfd17('0x70')]()[_0xfd17('0x71')](_0xfd17('0x6c'),'phone')[_0xfd17('0x71')](_0xfd17('0x73'),_0xfd17('0x6d'))['field']('id',_0xfd17('0x6e'))[_0xfd17('0x71')](_0x2a93c8[_0xfd17('0x76')][_0xfd17('0x72')](),_0xfd17('0x6f'))[_0xfd17('0x71')](_0x39a05d[_0xfd17('0x55')]['id'][_0xfd17('0x72')](),_0xfd17('0x5c'))[_0xfd17('0x71')]('NOW()',_0xfd17('0x51'))[_0xfd17('0x71')](_0xfd17('0x73'),_0xfd17('0x4e'))[_0xfd17('0x74')](_0xfd17('0x7d'))[_0xfd17('0x35')]('deletedAt\x20IS\x20NULL')[_0xfd17('0x35')](_0xfd17('0x75'),_0x2a93c8[_0xfd17('0x76')][_0xfd17('0x72')]())['where'](_0xfd17('0x7e'))[_0xfd17('0x35')](_0xfd17('0x77'),squel['select']()[_0xfd17('0x71')](_0xfd17('0x79'))[_0xfd17('0x74')](_0xfd17('0x6b'))[_0xfd17('0x35')](_0xfd17('0x7a'),_0x39a05d[_0xfd17('0x55')]['id'][_0xfd17('0x72')]())))[_0xfd17('0x72')]();break;default:_0x5d60e0=squel['insert']()[_0xfd17('0x6a')]('cm_hopper')[_0xfd17('0x7c')]([_0xfd17('0x6c'),_0xfd17('0x6d'),'ContactId','ListId',_0xfd17('0x5c'),_0xfd17('0x51'),_0xfd17('0x4e')],squel[_0xfd17('0x70')]()[_0xfd17('0x71')](_0xfd17('0x6c'),_0xfd17('0x6c'))[_0xfd17('0x71')](_0xfd17('0x73'),_0xfd17('0x6d'))[_0xfd17('0x71')]('id',_0xfd17('0x6e'))['field'](_0x2a93c8[_0xfd17('0x76')][_0xfd17('0x72')](),'ListId')['field'](_0x39a05d[_0xfd17('0x55')]['id'][_0xfd17('0x72')](),_0xfd17('0x5c'))[_0xfd17('0x71')](_0xfd17('0x73'),_0xfd17('0x51'))[_0xfd17('0x71')](_0xfd17('0x73'),_0xfd17('0x4e'))[_0xfd17('0x74')]('cm_contacts')[_0xfd17('0x35')](_0xfd17('0x7f'))[_0xfd17('0x35')](_0xfd17('0x75'),_0x2a93c8[_0xfd17('0x76')][_0xfd17('0x72')]())[_0xfd17('0x35')]('phone\x20IS\x20NOT\x20NULL'))[_0xfd17('0x72')]();}_0x77e17a[_0xfd17('0x80')](db[_0xfd17('0x81')][_0xfd17('0x31')](_0x5d60e0));}return BPromise[_0xfd17('0x82')](_0x77e17a);}})[_0xfd17('0x21')](function(){return _0x18b6ff;})[_0xfd17('0x21')](respondWithResult(_0x1d4aba,null))[_0xfd17('0x3f')](handleError(_0x1d4aba,null));};exports['removeLists']=function(_0x3a9f34,_0x42599d,_0x4e545a){return db[_0xfd17('0x2b')][_0xfd17('0x45')]({'where':{'id':_0x3a9f34['params']['id']}})['then'](handleEntityNotFound(_0x42599d,null))[_0xfd17('0x21')](function(_0xd61388){if(_0xd61388){return _0xd61388[_0xfd17('0x83')](_0x3a9f34[_0xfd17('0x31')][_0xfd17('0x66')]);}})[_0xfd17('0x21')](function(_0x4c462e){if(_0x4c462e){return db[_0xfd17('0x58')][_0xfd17('0x22')]({'where':{'ListId':_0x3a9f34['query'][_0xfd17('0x66')],'CampaignId':_0x3a9f34[_0xfd17('0x55')]['id']}})['then'](function(){return _0x4c462e;});}})['then'](respondWithStatusCode(_0x42599d,null))[_0xfd17('0x3f')](handleError(_0x42599d,null));};exports[_0xfd17('0x84')]=function(_0xde37cb,_0x5b3cd8,_0x4de6f1){var _0x3883f7={};var _0x2351b7={};var _0x5844f9;var _0x26a33a;return db['Campaign'][_0xfd17('0x57')]({'where':{'id':_0xde37cb[_0xfd17('0x55')]['id']}})['then'](handleEntityNotFound(_0x5b3cd8,null))[_0xfd17('0x21')](function(_0x42bad7){if(_0x42bad7){_0x5844f9=_0x42bad7;_0x2351b7[_0xfd17('0x2f')]=_[_0xfd17('0x30')](db[_0xfd17('0x64')][_0xfd17('0x2c')]);_0x2351b7[_0xfd17('0x31')]=_[_0xfd17('0x30')](_0xde37cb[_0xfd17('0x31')]);_0x2351b7[_0xfd17('0x37')]=_[_0xfd17('0x41')](_0x2351b7[_0xfd17('0x2f')],_0x2351b7['query']);_0x3883f7['attributes']=_[_0xfd17('0x41')](_0x2351b7['model'],qs['fields'](_0xde37cb[_0xfd17('0x31')][_0xfd17('0x33')]));_0x3883f7[_0xfd17('0x32')]=_0x3883f7['attributes'][_0xfd17('0x42')]?_0x3883f7[_0xfd17('0x32')]:_0x2351b7[_0xfd17('0x2f')];_0x3883f7[_0xfd17('0x5a')]=qs['sort'](_0xde37cb[_0xfd17('0x31')]['sort']);_0x3883f7['where']=qs['filters'](_[_0xfd17('0x36')](_0xde37cb['query'],_0x2351b7[_0xfd17('0x37')]));if(_0xde37cb['query']['filter']){_0x3883f7['where']=_[_0xfd17('0x39')](_0x3883f7['where'],{'$or':_['map'](_0x3883f7['attributes'],function(_0x1fc5ed){var _0x36a686={};_0x36a686[_0x1fc5ed]={'$like':'%'+_0xde37cb['query']['filter']+'%'};return _0x36a686;})});}_0x3883f7=_[_0xfd17('0x39')]({},_0x3883f7,_0xde37cb[_0xfd17('0x44')]);return _0x5844f9[_0xfd17('0x84')](_0x3883f7);}})['then'](function(_0xff1f){if(_0xff1f){_0x26a33a=_0xff1f['length'];if(!_0xde37cb[_0xfd17('0x31')][_0xfd17('0x34')](_0xfd17('0x59'))){_0x3883f7[_0xfd17('0x1f')]=qs[_0xfd17('0x1f')](_0xde37cb['query'][_0xfd17('0x1f')]);_0x3883f7[_0xfd17('0x1d')]=qs[_0xfd17('0x1d')](_0xde37cb[_0xfd17('0x31')][_0xfd17('0x1d')]);}return _0x5844f9[_0xfd17('0x84')](_0x3883f7);}})[_0xfd17('0x21')](function(_0x2770bc){if(_0x2770bc){return _0x2770bc?{'count':_0x26a33a,'rows':_0x2770bc}:null;}})[_0xfd17('0x21')](respondWithResult(_0x5b3cd8,null))['catch'](handleError(_0x5b3cd8,null));};exports[_0xfd17('0x85')]=function(_0x40a79e,_0x2063df,_0x4dc5f3){var _0x5d0f6e,_0x3c9a91;return db[_0xfd17('0x2b')][_0xfd17('0x45')]({'where':{'id':_0x40a79e['params']['id']}})[_0xfd17('0x21')](handleEntityNotFound(_0x2063df,null))['then'](function(_0x3741df){if(_0x3741df){_0x3c9a91=_0x3741df;return _0x3741df[_0xfd17('0x85')](_0x40a79e[_0xfd17('0x4f')][_0xfd17('0x66')],_[_0xfd17('0x50')](_0x40a79e[_0xfd17('0x4f')],['ids','id'])||{});}return null;})['spread'](function(_0x3c5b30){var _0x1e7d18;_0x5d0f6e=_0x3c5b30||[];var _0x1d70a4=[];if(_0x3c5b30){for(var _0x13fd56=0x0;_0x13fd56<_0x3c5b30['length'];_0x13fd56+=0x1){var _0x2265bb=_0x3c5b30[_0x13fd56][_0xfd17('0x23')]({'plain':!![]});_0x1e7d18=squel[_0xfd17('0x7b')]()['into'](_0xfd17('0x86'))[_0xfd17('0x7c')](['phone',_0xfd17('0x6e'),_0xfd17('0x6f'),_0xfd17('0x5c'),'createdAt',_0xfd17('0x4e')],squel[_0xfd17('0x70')]()[_0xfd17('0x71')]('phone',_0xfd17('0x6c'))[_0xfd17('0x71')]('id',_0xfd17('0x6e'))[_0xfd17('0x71')](_0x2265bb[_0xfd17('0x76')]['toString'](),'ListId')[_0xfd17('0x71')](_0x40a79e['params']['id']['toString'](),_0xfd17('0x5c'))[_0xfd17('0x71')](_0xfd17('0x73'),_0xfd17('0x51'))[_0xfd17('0x71')](_0xfd17('0x73'),_0xfd17('0x4e'))[_0xfd17('0x74')]('cm_contacts')['where'](_0xfd17('0x7f'))[_0xfd17('0x35')](_0xfd17('0x75'),_0x2265bb['CmListId'][_0xfd17('0x72')]())[_0xfd17('0x35')]('phone\x20IS\x20NOT\x20NULL'))[_0xfd17('0x72')]();_0x1d70a4[_0xfd17('0x80')](db[_0xfd17('0x81')][_0xfd17('0x31')](_0x1e7d18));}return BPromise[_0xfd17('0x82')](_0x1d70a4);}})[_0xfd17('0x21')](function(){return _0x5d0f6e;})['then'](respondWithResult(_0x2063df,null))[_0xfd17('0x3f')](handleError(_0x2063df,null));};exports['removeBlackLists']=function(_0x15f3a5,_0x5d891f,_0x14e9f8){return db[_0xfd17('0x2b')][_0xfd17('0x45')]({'where':{'id':_0x15f3a5[_0xfd17('0x55')]['id']}})['then'](handleEntityNotFound(_0x5d891f,null))['then'](function(_0x3dc000){if(_0x3dc000){return _0x3dc000['removeBlackLists'](_0x15f3a5[_0xfd17('0x31')][_0xfd17('0x66')]);}})['then'](function(_0x42fd5b){if(_0x42fd5b){return db['CmHopperBlack'][_0xfd17('0x22')]({'where':{'ListId':_0x15f3a5['query']['ids'],'CampaignId':_0x15f3a5[_0xfd17('0x55')]['id']}})[_0xfd17('0x21')](function(){return _0x42fd5b;});}})['then'](respondWithStatusCode(_0x5d891f,null))[_0xfd17('0x3f')](handleError(_0x5d891f,null));}; \ No newline at end of file +var _0x6a74=['options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','pick','includeAll','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ListId','select','field','ContactId','toString','updatedAt','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','insert','NOW()','CmListId','cm_contacts','into','sequelize','all','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','UserProfileResource','error','name','index','map','Campaign','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','rawAttributes'];(function(_0x327496,_0x1e2077){var _0x2a875c=function(_0x2946ab){while(--_0x2946ab){_0x327496['push'](_0x327496['shift']());}};_0x2a875c(++_0x1e2077);}(_0x6a74,0x153));var _0x46a7=function(_0x5d226c,_0x45d836){_0x5d226c=_0x5d226c-0x0;var _0x1e3a7c=_0x6a74[_0x5d226c];return _0x1e3a7c;};'use strict';var emlformat=require(_0x46a7('0x0'));var rimraf=require(_0x46a7('0x1'));var zipdir=require(_0x46a7('0x2'));var jsonpatch=require(_0x46a7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x46a7('0x4'));var Mustache=require(_0x46a7('0x5'));var util=require(_0x46a7('0x6'));var path=require(_0x46a7('0x7'));var sox=require(_0x46a7('0x8'));var csv=require(_0x46a7('0x9'));var ejs=require(_0x46a7('0xa'));var fs=require('fs');var fs_extra=require(_0x46a7('0xb'));var _=require(_0x46a7('0xc'));var squel=require(_0x46a7('0xd'));var crypto=require(_0x46a7('0xe'));var jsforce=require(_0x46a7('0xf'));var deskjs=require(_0x46a7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x46a7('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46a7('0x12'));var logger=require(_0x46a7('0x13'))(_0x46a7('0x14'));var utils=require(_0x46a7('0x15'));var config=require(_0x46a7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x46a7('0x17'))['db'];function respondWithStatusCode(_0x1f9826,_0x544fd0){_0x544fd0=_0x544fd0||0xcc;return function(_0x492def){if(_0x492def){return _0x1f9826[_0x46a7('0x18')](_0x544fd0);}return _0x1f9826[_0x46a7('0x19')](_0x544fd0)[_0x46a7('0x1a')]();};}function respondWithResult(_0x109ab3,_0x40ba95){_0x40ba95=_0x40ba95||0xc8;return function(_0x55d04e){if(_0x55d04e){return _0x109ab3[_0x46a7('0x19')](_0x40ba95)[_0x46a7('0x1b')](_0x55d04e);}};}function respondWithFilteredResult(_0x1b09c5,_0x480424){return function(_0x4d959f){if(_0x4d959f){var _0x146cb7=typeof _0x480424[_0x46a7('0x1c')]===_0x46a7('0x1d')&&typeof _0x480424[_0x46a7('0x1e')]===_0x46a7('0x1d');var _0x412318=_0x4d959f[_0x46a7('0x1f')];var _0x376b92=_0x146cb7?0x0:_0x480424[_0x46a7('0x1c')];var _0xdcc478=_0x146cb7?_0x4d959f[_0x46a7('0x1f')]:_0x480424['offset']+_0x480424['limit'];var _0x785e3f;if(_0xdcc478>=_0x412318){_0xdcc478=_0x412318;_0x785e3f=0xc8;}else{_0x785e3f=0xce;}_0x1b09c5['status'](_0x785e3f);return _0x1b09c5[_0x46a7('0x20')](_0x46a7('0x21'),_0x376b92+'-'+_0xdcc478+'/'+_0x412318)[_0x46a7('0x1b')](_0x4d959f);}return null;};}function patchUpdates(_0x14d02d){return function(_0x1895c9){try{jsonpatch[_0x46a7('0x22')](_0x1895c9,_0x14d02d,!![]);}catch(_0x187c26){return BPromise['reject'](_0x187c26);}return _0x1895c9['save']();};}function saveUpdates(_0x2f322a,_0x3f7bfe){return function(_0x5a516e){if(_0x5a516e){return _0x5a516e[_0x46a7('0x23')](_0x2f322a)[_0x46a7('0x24')](function(_0x50a78a){return _0x50a78a;});}return null;};}function removeEntity(_0x521a38,_0x1f746d){return function(_0x4b21c7){if(_0x4b21c7){return _0x4b21c7[_0x46a7('0x25')]()['then'](function(){var _0x416db0=_0x4b21c7['get']({'plain':!![]});var _0x385610='IvrCampaigns';return db[_0x46a7('0x26')][_0x46a7('0x25')]({'where':{'type':_0x385610,'resourceId':_0x416db0['id']}})[_0x46a7('0x24')](function(){return _0x4b21c7;});})[_0x46a7('0x24')](function(){_0x521a38[_0x46a7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x439d8a,_0x4f3e52){return function(_0x165168){if(!_0x165168){_0x439d8a[_0x46a7('0x18')](0x194);}return _0x165168;};}function handleError(_0x2ed66c,_0x4af5f5){_0x4af5f5=_0x4af5f5||0x1f4;return function(_0x4aed9e){logger[_0x46a7('0x27')](_0x4aed9e['stack']);if(_0x4aed9e[_0x46a7('0x28')]){delete _0x4aed9e[_0x46a7('0x28')];}_0x2ed66c['status'](_0x4af5f5)['send'](_0x4aed9e);};}exports[_0x46a7('0x29')]=function(_0x23305d,_0x2ab694){var _0xa40d98={},_0x3180dc={},_0x22756c={'count':0x0,'rows':[]};var _0x378c19=_[_0x46a7('0x2a')](db[_0x46a7('0x2b')]['rawAttributes'],function(_0x22bb31){return{'name':_0x22bb31['fieldName'],'type':_0x22bb31[_0x46a7('0x2c')][_0x46a7('0x2d')]};});_0x3180dc[_0x46a7('0x2e')]=_[_0x46a7('0x2a')](_0x378c19,_0x46a7('0x28'));_0x3180dc[_0x46a7('0x2f')]=_[_0x46a7('0x30')](_0x23305d[_0x46a7('0x2f')]);_0x3180dc[_0x46a7('0x31')]=_[_0x46a7('0x32')](_0x3180dc[_0x46a7('0x2e')],_0x3180dc[_0x46a7('0x2f')]);_0xa40d98['attributes']=_[_0x46a7('0x32')](_0x3180dc['model'],qs[_0x46a7('0x33')](_0x23305d[_0x46a7('0x2f')][_0x46a7('0x33')]));_0xa40d98[_0x46a7('0x34')]=_0xa40d98['attributes'][_0x46a7('0x35')]?_0xa40d98[_0x46a7('0x34')]:_0x3180dc['model'];if(!_0x23305d[_0x46a7('0x2f')]['hasOwnProperty']('nolimit')){_0xa40d98[_0x46a7('0x1e')]=qs[_0x46a7('0x1e')](_0x23305d[_0x46a7('0x2f')]['limit']);_0xa40d98[_0x46a7('0x1c')]=qs['offset'](_0x23305d[_0x46a7('0x2f')][_0x46a7('0x1c')]);}_0xa40d98[_0x46a7('0x36')]=qs[_0x46a7('0x37')](_0x23305d['query'][_0x46a7('0x37')]);_0xa40d98[_0x46a7('0x38')]=qs[_0x46a7('0x31')](_['pick'](_0x23305d[_0x46a7('0x2f')],_0x3180dc[_0x46a7('0x31')]),_0x378c19);if(_0x23305d['query'][_0x46a7('0x39')]){_0xa40d98[_0x46a7('0x38')]=_[_0x46a7('0x3a')](_0xa40d98[_0x46a7('0x38')],{'$or':_[_0x46a7('0x2a')](_0x378c19,function(_0x42f2c6){if(_0x42f2c6['type']!==_0x46a7('0x3b')){var _0x14ab0a={};_0x14ab0a[_0x42f2c6[_0x46a7('0x28')]]={'$like':'%'+_0x23305d['query'][_0x46a7('0x39')]+'%'};return _0x14ab0a;}})});}_0xa40d98=_[_0x46a7('0x3a')]({},_0xa40d98,_0x23305d['options']);var _0x153de0={'where':_0xa40d98[_0x46a7('0x38')]};return db[_0x46a7('0x2b')][_0x46a7('0x1f')](_0x153de0)[_0x46a7('0x24')](function(_0x3f1a59){_0x22756c[_0x46a7('0x1f')]=_0x3f1a59;if(_0x23305d[_0x46a7('0x2f')]['includeAll']){_0xa40d98[_0x46a7('0x3c')]=[{'all':!![]}];}return db[_0x46a7('0x2b')][_0x46a7('0x3d')](_0xa40d98);})[_0x46a7('0x24')](function(_0x38e10a){_0x22756c[_0x46a7('0x3e')]=_0x38e10a;return _0x22756c;})[_0x46a7('0x24')](respondWithFilteredResult(_0x2ab694,_0xa40d98))[_0x46a7('0x3f')](handleError(_0x2ab694,null));};exports[_0x46a7('0x40')]=function(_0x503b62,_0x5763d2){var _0x34525c={'raw':![],'where':{'id':_0x503b62['params']['id']}},_0x51224f={};_0x51224f[_0x46a7('0x2e')]=_['keys'](db[_0x46a7('0x2b')][_0x46a7('0x41')]);_0x51224f['query']=_['keys'](_0x503b62[_0x46a7('0x2f')]);_0x51224f[_0x46a7('0x31')]=_[_0x46a7('0x32')](_0x51224f[_0x46a7('0x2e')],_0x51224f[_0x46a7('0x2f')]);_0x34525c['attributes']=_[_0x46a7('0x32')](_0x51224f[_0x46a7('0x2e')],qs[_0x46a7('0x33')](_0x503b62[_0x46a7('0x2f')]['fields']));_0x34525c[_0x46a7('0x34')]=_0x34525c[_0x46a7('0x34')][_0x46a7('0x35')]?_0x34525c[_0x46a7('0x34')]:_0x51224f[_0x46a7('0x2e')];if(_0x503b62['query']['includeAll']){_0x34525c[_0x46a7('0x3c')]=[{'all':!![]}];}_0x34525c=_[_0x46a7('0x3a')]({},_0x34525c,_0x503b62[_0x46a7('0x42')]);return db[_0x46a7('0x2b')][_0x46a7('0x43')](_0x34525c)[_0x46a7('0x24')](handleEntityNotFound(_0x5763d2,null))[_0x46a7('0x24')](respondWithResult(_0x5763d2,null))['catch'](handleError(_0x5763d2,null));};exports[_0x46a7('0x44')]=function(_0x363c36,_0x318978){return db[_0x46a7('0x2b')][_0x46a7('0x44')](_0x363c36[_0x46a7('0x45')],{})[_0x46a7('0x24')](function(_0xca4195){var _0x2f9fa2=_0x363c36[_0x46a7('0x46')][_0x46a7('0x47')]({'plain':!![]});if(!_0x2f9fa2)throw new Error(_0x46a7('0x48'));if(_0x2f9fa2[_0x46a7('0x49')]===_0x46a7('0x46')){var _0x2d8766=_0xca4195[_0x46a7('0x47')]({'plain':!![]});var _0x170e6c=_0x46a7('0x4a');return db[_0x46a7('0x4b')][_0x46a7('0x43')]({'where':{'name':_0x170e6c,'userProfileId':_0x2f9fa2[_0x46a7('0x4c')]},'raw':!![]})[_0x46a7('0x24')](function(_0xac63bb){if(_0xac63bb&&_0xac63bb[_0x46a7('0x4d')]===0x0){return db[_0x46a7('0x26')][_0x46a7('0x44')]({'name':_0x2d8766[_0x46a7('0x28')],'resourceId':_0x2d8766['id'],'type':_0xac63bb[_0x46a7('0x28')],'sectionId':_0xac63bb['id']},{})[_0x46a7('0x24')](function(){return _0xca4195;});}else{return _0xca4195;}})[_0x46a7('0x3f')](function(_0x391de7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x391de7);throw _0x391de7;});}return _0xca4195;})[_0x46a7('0x24')](respondWithResult(_0x318978,0xc9))[_0x46a7('0x3f')](handleError(_0x318978,null));};exports[_0x46a7('0x4e')]=function(_0x439ec5,_0x2c5b57){var _0x11c43f={'where':{'id':_0x439ec5['params']['id']}},_0x3234a0={};_0x3234a0[_0x46a7('0x2e')]=_['keys'](db[_0x46a7('0x2b')]['rawAttributes']);_0x11c43f[_0x46a7('0x34')]=_[_0x46a7('0x32')](_0x3234a0[_0x46a7('0x2e')],qs[_0x46a7('0x33')](_0x439ec5[_0x46a7('0x2f')]['fields']));_0x11c43f['attributes']=_0x11c43f[_0x46a7('0x34')]['length']?_0x11c43f['attributes']:_0x3234a0['model'];if(_0x439ec5['query']['includeAll']){_0x11c43f[_0x46a7('0x3c')]=[{'all':!![]}];}_0x11c43f=_['merge']({},_0x11c43f,_0x439ec5[_0x46a7('0x42')]);return db[_0x46a7('0x2b')][_0x46a7('0x43')](_0x11c43f)[_0x46a7('0x24')](handleEntityNotFound(_0x2c5b57,null))[_0x46a7('0x24')](function(_0x93e374){if(_0x93e374){var _0x4f4119=_0x93e374[_0x46a7('0x47')]({'plain':!![]});_0x4f4119=qs['omit'](_0x4f4119,['id',_0x46a7('0x4f'),'updatedAt']);_0x439ec5[_0x46a7('0x45')]=_[_0x46a7('0x50')](_0x439ec5[_0x46a7('0x45')],['id',_0x46a7('0x4f'),'updatedAt']);return db[_0x46a7('0x2b')][_0x46a7('0x44')](_['merge'](_0x4f4119,_0x439ec5[_0x46a7('0x45')]),{'include':_0x439ec5[_0x46a7('0x2f')]['includeAll']?[{'all':!![]}]:undefined})[_0x46a7('0x24')](function(_0x35f1b4){var _0x3e5a4c=_0x439ec5[_0x46a7('0x46')][_0x46a7('0x47')]({'plain':!![]});if(!_0x3e5a4c)throw new Error(_0x46a7('0x48'));if(_0x3e5a4c[_0x46a7('0x49')]==='user'){var _0x354dd6=_0x35f1b4[_0x46a7('0x47')]({'plain':!![]});var _0x732d16=_0x46a7('0x4a');return db[_0x46a7('0x4b')]['find']({'where':{'name':_0x732d16,'userProfileId':_0x3e5a4c[_0x46a7('0x4c')]},'raw':!![]})[_0x46a7('0x24')](function(_0x208146){if(_0x208146&&_0x208146[_0x46a7('0x4d')]===0x0){return db['UserProfileResource'][_0x46a7('0x44')]({'name':_0x354dd6[_0x46a7('0x28')],'resourceId':_0x354dd6['id'],'type':_0x208146['name'],'sectionId':_0x208146['id']},{})[_0x46a7('0x24')](function(){return _0x35f1b4;});}else{return _0x35f1b4;}})[_0x46a7('0x3f')](function(_0x4cbb6b){logger[_0x46a7('0x27')](_0x46a7('0x51'),_0x4cbb6b);throw _0x4cbb6b;});}return _0x35f1b4;});}})[_0x46a7('0x24')](respondWithResult(_0x2c5b57,0xc9))[_0x46a7('0x3f')](handleError(_0x2c5b57,null));};exports[_0x46a7('0x23')]=function(_0x5942a0,_0x522767){if(_0x5942a0[_0x46a7('0x45')]['id']){delete _0x5942a0['body']['id'];}return db['Campaign']['find']({'where':{'id':_0x5942a0['params']['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0x522767,null))[_0x46a7('0x24')](saveUpdates(_0x5942a0['body'],null))[_0x46a7('0x24')](respondWithResult(_0x522767,null))[_0x46a7('0x3f')](handleError(_0x522767,null));};exports[_0x46a7('0x25')]=function(_0x478dbd,_0x38a9b9){return db[_0x46a7('0x2b')][_0x46a7('0x43')]({'where':{'id':_0x478dbd[_0x46a7('0x52')]['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0x38a9b9,null))['then'](removeEntity(_0x38a9b9,null))[_0x46a7('0x3f')](handleError(_0x38a9b9,null));};exports[_0x46a7('0x53')]=function(_0x32c415,_0x2b6215,_0x8011ce){var _0xf4ed56={'raw':!![],'where':{}};var _0x47cfd9={};var _0x137d9d={'count':0x0,'rows':[]};return db[_0x46a7('0x2b')][_0x46a7('0x54')]({'where':{'id':_0x32c415[_0x46a7('0x52')]['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0x2b6215,null))[_0x46a7('0x24')](function(_0xd1892b){if(_0xd1892b){_0x47cfd9['model']=_[_0x46a7('0x30')](db[_0x46a7('0x55')][_0x46a7('0x41')]);_0x47cfd9[_0x46a7('0x2f')]=_['keys'](_0x32c415[_0x46a7('0x2f')]);_0x47cfd9[_0x46a7('0x31')]=_[_0x46a7('0x32')](_0x47cfd9['model'],_0x47cfd9[_0x46a7('0x2f')]);_0xf4ed56[_0x46a7('0x34')]=_[_0x46a7('0x32')](_0x47cfd9[_0x46a7('0x2e')],qs[_0x46a7('0x33')](_0x32c415['query'][_0x46a7('0x33')]));_0xf4ed56[_0x46a7('0x34')]=_0xf4ed56[_0x46a7('0x34')][_0x46a7('0x35')]?_0xf4ed56[_0x46a7('0x34')]:_0x47cfd9[_0x46a7('0x2e')];if(!_0x32c415[_0x46a7('0x2f')][_0x46a7('0x56')](_0x46a7('0x57'))){_0xf4ed56['limit']=qs[_0x46a7('0x1e')](_0x32c415['query'][_0x46a7('0x1e')]);_0xf4ed56[_0x46a7('0x1c')]=qs[_0x46a7('0x1c')](_0x32c415[_0x46a7('0x2f')]['offset']);}_0xf4ed56['order']=qs['sort'](_0x32c415[_0x46a7('0x2f')][_0x46a7('0x37')]);_0xf4ed56[_0x46a7('0x38')]=qs[_0x46a7('0x31')](_[_0x46a7('0x58')](_0x32c415[_0x46a7('0x2f')],_0x47cfd9[_0x46a7('0x31')]));_0xf4ed56[_0x46a7('0x38')]['CampaignId']=_0xd1892b['id'];if(_0x32c415['query'][_0x46a7('0x39')]){_0xf4ed56[_0x46a7('0x38')]=_[_0x46a7('0x3a')](_0xf4ed56[_0x46a7('0x38')],{'$or':_[_0x46a7('0x2a')](_0xf4ed56[_0x46a7('0x34')],function(_0x59cb5d){var _0x488a86={};_0x488a86[_0x59cb5d]={'$like':'%'+_0x32c415[_0x46a7('0x2f')][_0x46a7('0x39')]+'%'};return _0x488a86;})});}_0xf4ed56=_[_0x46a7('0x3a')]({},_0xf4ed56,_0x32c415[_0x46a7('0x42')]);return db[_0x46a7('0x55')][_0x46a7('0x1f')]({'where':_0xf4ed56[_0x46a7('0x38')]})[_0x46a7('0x24')](function(_0x57e6dc){_0x137d9d[_0x46a7('0x1f')]=_0x57e6dc;if(_0x32c415['query'][_0x46a7('0x59')]){_0xf4ed56['include']=[{'all':!![]}];}return db[_0x46a7('0x55')][_0x46a7('0x3d')](_0xf4ed56);})['then'](function(_0x525a1e){_0x137d9d[_0x46a7('0x3e')]=_0x525a1e;return _0x137d9d;});}})['then'](respondWithFilteredResult(_0x2b6215,_0xf4ed56))[_0x46a7('0x3f')](handleError(_0x2b6215,null));};exports[_0x46a7('0x5a')]=function(_0x22406c,_0xa34bfe,_0x1c6537){var _0x157d6b={'raw':!![],'where':{}};var _0x25ea4e={};var _0x3ce21e={'count':0x0,'rows':[]};return db[_0x46a7('0x2b')][_0x46a7('0x54')]({'where':{'id':_0x22406c['params']['id']}})['then'](handleEntityNotFound(_0xa34bfe,null))[_0x46a7('0x24')](function(_0x1f9565){if(_0x1f9565){_0x25ea4e[_0x46a7('0x2e')]=_[_0x46a7('0x30')](db[_0x46a7('0x5b')]['rawAttributes']);_0x25ea4e[_0x46a7('0x2f')]=_[_0x46a7('0x30')](_0x22406c['query']);_0x25ea4e['filters']=_[_0x46a7('0x32')](_0x25ea4e[_0x46a7('0x2e')],_0x25ea4e[_0x46a7('0x2f')]);_0x157d6b[_0x46a7('0x34')]=_[_0x46a7('0x32')](_0x25ea4e[_0x46a7('0x2e')],qs[_0x46a7('0x33')](_0x22406c[_0x46a7('0x2f')][_0x46a7('0x33')]));_0x157d6b[_0x46a7('0x34')]=_0x157d6b[_0x46a7('0x34')]['length']?_0x157d6b[_0x46a7('0x34')]:_0x25ea4e[_0x46a7('0x2e')];if(!_0x22406c['query'][_0x46a7('0x56')](_0x46a7('0x57'))){_0x157d6b[_0x46a7('0x1e')]=qs[_0x46a7('0x1e')](_0x22406c[_0x46a7('0x2f')][_0x46a7('0x1e')]);_0x157d6b[_0x46a7('0x1c')]=qs[_0x46a7('0x1c')](_0x22406c[_0x46a7('0x2f')][_0x46a7('0x1c')]);}_0x157d6b[_0x46a7('0x36')]=qs[_0x46a7('0x37')](_0x22406c['query'][_0x46a7('0x37')]);_0x157d6b['where']=qs['filters'](_[_0x46a7('0x58')](_0x22406c[_0x46a7('0x2f')],_0x25ea4e[_0x46a7('0x31')]));_0x157d6b[_0x46a7('0x38')][_0x46a7('0x5c')]=_0x1f9565['id'];if(_0x22406c['query']['filter']){_0x157d6b[_0x46a7('0x38')]=_[_0x46a7('0x3a')](_0x157d6b[_0x46a7('0x38')],{'$or':_[_0x46a7('0x2a')](_0x157d6b[_0x46a7('0x34')],function(_0x4dd9f0){var _0x1a7779={};_0x1a7779[_0x4dd9f0]={'$like':'%'+_0x22406c['query'][_0x46a7('0x39')]+'%'};return _0x1a7779;})});}_0x157d6b=_['merge']({},_0x157d6b,_0x22406c[_0x46a7('0x42')]);return db[_0x46a7('0x5b')][_0x46a7('0x1f')]({'where':_0x157d6b['where']})['then'](function(_0x403907){_0x3ce21e[_0x46a7('0x1f')]=_0x403907;if(_0x22406c['query'][_0x46a7('0x59')]){_0x157d6b[_0x46a7('0x3c')]=[{'all':!![]}];}return db[_0x46a7('0x5b')][_0x46a7('0x3d')](_0x157d6b);})['then'](function(_0x1f9008){_0x3ce21e['rows']=_0x1f9008;return _0x3ce21e;});}})['then'](respondWithFilteredResult(_0xa34bfe,_0x157d6b))[_0x46a7('0x3f')](handleError(_0xa34bfe,null));};exports[_0x46a7('0x5d')]=function(_0x3b34b6,_0x12c19d,_0x315fa4){var _0x52c118={'raw':!![],'where':{}};var _0x2d2e3e={};var _0x58a9fd={'count':0x0,'rows':[]};return db[_0x46a7('0x2b')][_0x46a7('0x54')]({'where':{'id':_0x3b34b6['params']['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0x12c19d,null))[_0x46a7('0x24')](function(_0xd23de2){if(_0xd23de2){_0x2d2e3e[_0x46a7('0x2e')]=_[_0x46a7('0x30')](db['CmHopperFinal']['rawAttributes']);_0x2d2e3e[_0x46a7('0x2f')]=_['keys'](_0x3b34b6[_0x46a7('0x2f')]);_0x2d2e3e[_0x46a7('0x31')]=_[_0x46a7('0x32')](_0x2d2e3e[_0x46a7('0x2e')],_0x2d2e3e[_0x46a7('0x2f')]);_0x52c118[_0x46a7('0x34')]=_['intersection'](_0x2d2e3e[_0x46a7('0x2e')],qs[_0x46a7('0x33')](_0x3b34b6['query']['fields']));_0x52c118[_0x46a7('0x34')]=_0x52c118[_0x46a7('0x34')][_0x46a7('0x35')]?_0x52c118[_0x46a7('0x34')]:_0x2d2e3e[_0x46a7('0x2e')];if(!_0x3b34b6[_0x46a7('0x2f')]['hasOwnProperty'](_0x46a7('0x57'))){_0x52c118[_0x46a7('0x1e')]=qs[_0x46a7('0x1e')](_0x3b34b6['query'][_0x46a7('0x1e')]);_0x52c118[_0x46a7('0x1c')]=qs[_0x46a7('0x1c')](_0x3b34b6[_0x46a7('0x2f')][_0x46a7('0x1c')]);}_0x52c118[_0x46a7('0x36')]=qs[_0x46a7('0x37')](_0x3b34b6[_0x46a7('0x2f')][_0x46a7('0x37')]);_0x52c118['where']=qs[_0x46a7('0x31')](_[_0x46a7('0x58')](_0x3b34b6[_0x46a7('0x2f')],_0x2d2e3e[_0x46a7('0x31')]));_0x52c118['where']['CampaignId']=_0xd23de2['id'];if(_0x3b34b6['query'][_0x46a7('0x39')]){_0x52c118[_0x46a7('0x38')]=_['merge'](_0x52c118[_0x46a7('0x38')],{'$or':_[_0x46a7('0x2a')](_0x52c118[_0x46a7('0x34')],function(_0x22dbdc){var _0x3b5396={};_0x3b5396[_0x22dbdc]={'$like':'%'+_0x3b34b6['query']['filter']+'%'};return _0x3b5396;})});}_0x52c118=_[_0x46a7('0x3a')]({},_0x52c118,_0x3b34b6[_0x46a7('0x42')]);return db[_0x46a7('0x5e')][_0x46a7('0x1f')]({'where':_0x52c118[_0x46a7('0x38')]})['then'](function(_0x23aa5b){_0x58a9fd[_0x46a7('0x1f')]=_0x23aa5b;if(_0x3b34b6[_0x46a7('0x2f')][_0x46a7('0x59')]){_0x52c118['include']=[{'all':!![]}];}return db[_0x46a7('0x5e')][_0x46a7('0x3d')](_0x52c118);})[_0x46a7('0x24')](function(_0x24a074){_0x58a9fd[_0x46a7('0x3e')]=_0x24a074;return _0x58a9fd;});}})[_0x46a7('0x24')](respondWithFilteredResult(_0x12c19d,_0x52c118))[_0x46a7('0x3f')](handleError(_0x12c19d,null));};exports[_0x46a7('0x5f')]=function(_0xca7c1c,_0x560196,_0x434add){var _0x54be08={'raw':!![],'where':{}};var _0x441632={};var _0x18aa72={'count':0x0,'rows':[]};return db[_0x46a7('0x2b')][_0x46a7('0x54')]({'where':{'id':_0xca7c1c[_0x46a7('0x52')]['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0x560196,null))['then'](function(_0x29cef1){if(_0x29cef1){_0x441632[_0x46a7('0x2e')]=_[_0x46a7('0x30')](db[_0x46a7('0x60')]['rawAttributes']);_0x441632[_0x46a7('0x2f')]=_['keys'](_0xca7c1c[_0x46a7('0x2f')]);_0x441632[_0x46a7('0x31')]=_['intersection'](_0x441632['model'],_0x441632['query']);_0x54be08[_0x46a7('0x34')]=_[_0x46a7('0x32')](_0x441632['model'],qs[_0x46a7('0x33')](_0xca7c1c[_0x46a7('0x2f')][_0x46a7('0x33')]));_0x54be08[_0x46a7('0x34')]=_0x54be08[_0x46a7('0x34')][_0x46a7('0x35')]?_0x54be08[_0x46a7('0x34')]:_0x441632[_0x46a7('0x2e')];if(!_0xca7c1c['query'][_0x46a7('0x56')](_0x46a7('0x57'))){_0x54be08['limit']=qs[_0x46a7('0x1e')](_0xca7c1c[_0x46a7('0x2f')][_0x46a7('0x1e')]);_0x54be08[_0x46a7('0x1c')]=qs[_0x46a7('0x1c')](_0xca7c1c[_0x46a7('0x2f')]['offset']);}_0x54be08[_0x46a7('0x36')]=qs[_0x46a7('0x37')](_0xca7c1c[_0x46a7('0x2f')]['sort']);_0x54be08[_0x46a7('0x38')]=qs['filters'](_[_0x46a7('0x58')](_0xca7c1c[_0x46a7('0x2f')],_0x441632[_0x46a7('0x31')]));_0x54be08[_0x46a7('0x38')][_0x46a7('0x5c')]=_0x29cef1['id'];if(_0xca7c1c[_0x46a7('0x2f')][_0x46a7('0x39')]){_0x54be08[_0x46a7('0x38')]=_['merge'](_0x54be08[_0x46a7('0x38')],{'$or':_[_0x46a7('0x2a')](_0x54be08['attributes'],function(_0x228e51){var _0x453793={};_0x453793[_0x228e51]={'$like':'%'+_0xca7c1c[_0x46a7('0x2f')][_0x46a7('0x39')]+'%'};return _0x453793;})});}_0x54be08=_['merge']({},_0x54be08,_0xca7c1c[_0x46a7('0x42')]);return db[_0x46a7('0x60')]['count']({'where':_0x54be08[_0x46a7('0x38')]})['then'](function(_0x50a325){_0x18aa72[_0x46a7('0x1f')]=_0x50a325;if(_0xca7c1c[_0x46a7('0x2f')][_0x46a7('0x59')]){_0x54be08[_0x46a7('0x3c')]=[{'all':!![]}];}return db[_0x46a7('0x60')][_0x46a7('0x3d')](_0x54be08);})[_0x46a7('0x24')](function(_0x18f5cf){_0x18aa72[_0x46a7('0x3e')]=_0x18f5cf;return _0x18aa72;});}})['then'](respondWithFilteredResult(_0x560196,_0x54be08))['catch'](handleError(_0x560196,null));};exports[_0x46a7('0x61')]=function(_0x3e9c5a,_0x5652c7,_0x4e73f5){var _0x2649ad={};var _0x42c30a={};var _0x499e81;var _0x5e061d;return db[_0x46a7('0x2b')][_0x46a7('0x54')]({'where':{'id':_0x3e9c5a[_0x46a7('0x52')]['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0x5652c7,null))[_0x46a7('0x24')](function(_0xda8a2f){if(_0xda8a2f){_0x499e81=_0xda8a2f;_0x42c30a[_0x46a7('0x2e')]=_[_0x46a7('0x30')](db[_0x46a7('0x62')][_0x46a7('0x41')]);_0x42c30a[_0x46a7('0x2f')]=_['keys'](_0x3e9c5a[_0x46a7('0x2f')]);_0x42c30a[_0x46a7('0x31')]=_['intersection'](_0x42c30a['model'],_0x42c30a[_0x46a7('0x2f')]);_0x2649ad[_0x46a7('0x34')]=_[_0x46a7('0x32')](_0x42c30a[_0x46a7('0x2e')],qs['fields'](_0x3e9c5a[_0x46a7('0x2f')][_0x46a7('0x33')]));_0x2649ad[_0x46a7('0x34')]=_0x2649ad['attributes'][_0x46a7('0x35')]?_0x2649ad[_0x46a7('0x34')]:_0x42c30a[_0x46a7('0x2e')];_0x2649ad[_0x46a7('0x36')]=qs[_0x46a7('0x37')](_0x3e9c5a['query']['sort']);_0x2649ad[_0x46a7('0x38')]=qs[_0x46a7('0x31')](_[_0x46a7('0x58')](_0x3e9c5a[_0x46a7('0x2f')],_0x42c30a[_0x46a7('0x31')]));if(_0x3e9c5a[_0x46a7('0x2f')][_0x46a7('0x39')]){_0x2649ad[_0x46a7('0x38')]=_['merge'](_0x2649ad[_0x46a7('0x38')],{'$or':_[_0x46a7('0x2a')](_0x2649ad['attributes'],function(_0x1120f8){var _0x252ef1={};_0x252ef1[_0x1120f8]={'$like':'%'+_0x3e9c5a[_0x46a7('0x2f')][_0x46a7('0x39')]+'%'};return _0x252ef1;})});}_0x2649ad=_[_0x46a7('0x3a')]({},_0x2649ad,_0x3e9c5a[_0x46a7('0x42')]);return _0x499e81['getLists'](_0x2649ad);}})[_0x46a7('0x24')](function(_0x4a211a){if(_0x4a211a){_0x5e061d=_0x4a211a['length'];if(!_0x3e9c5a['query'][_0x46a7('0x56')](_0x46a7('0x57'))){_0x2649ad['limit']=qs[_0x46a7('0x1e')](_0x3e9c5a[_0x46a7('0x2f')]['limit']);_0x2649ad[_0x46a7('0x1c')]=qs[_0x46a7('0x1c')](_0x3e9c5a[_0x46a7('0x2f')][_0x46a7('0x1c')]);}return _0x499e81[_0x46a7('0x61')](_0x2649ad);}})[_0x46a7('0x24')](function(_0xaeabcb){if(_0xaeabcb){return _0xaeabcb?{'count':_0x5e061d,'rows':_0xaeabcb}:null;}})[_0x46a7('0x24')](respondWithResult(_0x5652c7,null))[_0x46a7('0x3f')](handleError(_0x5652c7,null));};exports[_0x46a7('0x63')]=function(_0x4f7c61,_0xafb247,_0x5bf347){var _0x2e68e9,_0x5a3a03;return db['Campaign']['find']({'where':{'id':_0x4f7c61['params']['id']}})['then'](handleEntityNotFound(_0xafb247,null))[_0x46a7('0x24')](function(_0x47c381){if(_0x47c381){_0x5a3a03=_0x47c381;return _0x47c381['addLists'](_0x4f7c61[_0x46a7('0x45')]['ids'],_[_0x46a7('0x50')](_0x4f7c61[_0x46a7('0x45')],[_0x46a7('0x64'),'id'])||{});}return null;})[_0x46a7('0x65')](function(_0x434f50){var _0x302b8c;_0x2e68e9=_0x434f50||[];var _0x1edbe0=[];if(_0x434f50){for(var _0x2da648=0x0;_0x2da648<_0x434f50[_0x46a7('0x35')];_0x2da648+=0x1){var _0x5ca86e=_0x434f50[_0x2da648][_0x46a7('0x47')]({'plain':!![]});_0x5a3a03['dialCheckDuplicateType']=_0x4f7c61[_0x46a7('0x45')][_0x46a7('0x66')]?_0x4f7c61[_0x46a7('0x45')]['dialCheckDuplicateType']:_0x5a3a03[_0x46a7('0x66')];switch(_0x5a3a03[_0x46a7('0x66')]){case'always':_0x302b8c=squel['insert']()['into']('cm_hopper')[_0x46a7('0x67')]([_0x46a7('0x68'),_0x46a7('0x69'),'ContactId',_0x46a7('0x6a'),_0x46a7('0x5c'),_0x46a7('0x4f'),'updatedAt'],squel[_0x46a7('0x6b')]()[_0x46a7('0x6c')](_0x46a7('0x68'),_0x46a7('0x68'))['field']('NOW()','scheduledAt')['field']('id',_0x46a7('0x6d'))[_0x46a7('0x6c')](_0x5ca86e['CmListId'][_0x46a7('0x6e')](),'ListId')[_0x46a7('0x6c')](_0x4f7c61[_0x46a7('0x52')]['id']['toString'](),_0x46a7('0x5c'))[_0x46a7('0x6c')]('NOW()',_0x46a7('0x4f'))[_0x46a7('0x6c')]('NOW()',_0x46a7('0x6f'))[_0x46a7('0x70')]('cm_contacts')[_0x46a7('0x38')](_0x46a7('0x71'))[_0x46a7('0x38')](_0x46a7('0x72'),_0x5ca86e['CmListId'][_0x46a7('0x6e')]())[_0x46a7('0x38')](_0x46a7('0x73'))[_0x46a7('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x46a7('0x6b')]()[_0x46a7('0x6c')](_0x46a7('0x74'))[_0x46a7('0x70')](_0x46a7('0x75'))[_0x46a7('0x38')]('CampaignId\x20=\x20?',_0x4f7c61[_0x46a7('0x52')]['id'][_0x46a7('0x6e')]()))['where'](_0x46a7('0x76'),squel[_0x46a7('0x6b')]()['field'](_0x46a7('0x77'))[_0x46a7('0x70')](_0x46a7('0x78'))[_0x46a7('0x38')](_0x46a7('0x79'),_0x4f7c61['params']['id'][_0x46a7('0x6e')]())))[_0x46a7('0x6e')]();break;case _0x46a7('0x7a'):_0x302b8c=squel[_0x46a7('0x7b')]()['into'](_0x46a7('0x78'))[_0x46a7('0x67')]([_0x46a7('0x68'),_0x46a7('0x69'),'ContactId',_0x46a7('0x6a'),'CampaignId','createdAt',_0x46a7('0x6f')],squel[_0x46a7('0x6b')]()[_0x46a7('0x6c')](_0x46a7('0x68'),'phone')[_0x46a7('0x6c')](_0x46a7('0x7c'),_0x46a7('0x69'))[_0x46a7('0x6c')]('id',_0x46a7('0x6d'))[_0x46a7('0x6c')](_0x5ca86e[_0x46a7('0x7d')][_0x46a7('0x6e')](),_0x46a7('0x6a'))[_0x46a7('0x6c')](_0x4f7c61[_0x46a7('0x52')]['id']['toString'](),_0x46a7('0x5c'))[_0x46a7('0x6c')]('NOW()',_0x46a7('0x4f'))[_0x46a7('0x6c')](_0x46a7('0x7c'),'updatedAt')[_0x46a7('0x70')](_0x46a7('0x7e'))['where'](_0x46a7('0x71'))['where'](_0x46a7('0x72'),_0x5ca86e[_0x46a7('0x7d')][_0x46a7('0x6e')]())[_0x46a7('0x38')](_0x46a7('0x73'))[_0x46a7('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x46a7('0x6b')]()[_0x46a7('0x6c')](_0x46a7('0x77'))[_0x46a7('0x70')](_0x46a7('0x78'))['where'](_0x46a7('0x79'),_0x4f7c61[_0x46a7('0x52')]['id'][_0x46a7('0x6e')]())))[_0x46a7('0x6e')]();break;default:_0x302b8c=squel[_0x46a7('0x7b')]()[_0x46a7('0x7f')](_0x46a7('0x78'))[_0x46a7('0x67')]([_0x46a7('0x68'),_0x46a7('0x69'),'ContactId',_0x46a7('0x6a'),_0x46a7('0x5c'),_0x46a7('0x4f'),_0x46a7('0x6f')],squel[_0x46a7('0x6b')]()['field'](_0x46a7('0x68'),_0x46a7('0x68'))[_0x46a7('0x6c')](_0x46a7('0x7c'),_0x46a7('0x69'))[_0x46a7('0x6c')]('id','ContactId')[_0x46a7('0x6c')](_0x5ca86e[_0x46a7('0x7d')][_0x46a7('0x6e')](),'ListId')['field'](_0x4f7c61['params']['id'][_0x46a7('0x6e')](),_0x46a7('0x5c'))[_0x46a7('0x6c')]('NOW()',_0x46a7('0x4f'))[_0x46a7('0x6c')]('NOW()',_0x46a7('0x6f'))['from']('cm_contacts')[_0x46a7('0x38')](_0x46a7('0x71'))[_0x46a7('0x38')](_0x46a7('0x72'),_0x5ca86e[_0x46a7('0x7d')]['toString']())[_0x46a7('0x38')](_0x46a7('0x73')))[_0x46a7('0x6e')]();}_0x1edbe0['push'](db[_0x46a7('0x80')][_0x46a7('0x2f')](_0x302b8c));}return BPromise[_0x46a7('0x81')](_0x1edbe0);}})['then'](function(){return _0x2e68e9;})[_0x46a7('0x24')](respondWithResult(_0xafb247,null))[_0x46a7('0x3f')](handleError(_0xafb247,null));};exports[_0x46a7('0x82')]=function(_0x3a4b77,_0x57346f,_0x2c3ec5){return db[_0x46a7('0x2b')][_0x46a7('0x43')]({'where':{'id':_0x3a4b77[_0x46a7('0x52')]['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0x57346f,null))[_0x46a7('0x24')](function(_0x3385ef){if(_0x3385ef){return _0x3385ef['removeLists'](_0x3a4b77[_0x46a7('0x2f')][_0x46a7('0x64')]);}})[_0x46a7('0x24')](function(_0x294bc4){if(_0x294bc4){return db[_0x46a7('0x55')]['destroy']({'where':{'ListId':_0x3a4b77['query'][_0x46a7('0x64')],'CampaignId':_0x3a4b77['params']['id']}})[_0x46a7('0x24')](function(){return _0x294bc4;});}})[_0x46a7('0x24')](respondWithStatusCode(_0x57346f,null))[_0x46a7('0x3f')](handleError(_0x57346f,null));};exports['getBlackLists']=function(_0x40e58f,_0x25c66e,_0x3f485e){var _0x4bccd0={};var _0x2d0003={};var _0x477934;var _0x1841da;return db[_0x46a7('0x2b')][_0x46a7('0x54')]({'where':{'id':_0x40e58f[_0x46a7('0x52')]['id']}})['then'](handleEntityNotFound(_0x25c66e,null))[_0x46a7('0x24')](function(_0x3b2556){if(_0x3b2556){_0x477934=_0x3b2556;_0x2d0003[_0x46a7('0x2e')]=_[_0x46a7('0x30')](db[_0x46a7('0x62')][_0x46a7('0x41')]);_0x2d0003['query']=_[_0x46a7('0x30')](_0x40e58f['query']);_0x2d0003['filters']=_['intersection'](_0x2d0003['model'],_0x2d0003[_0x46a7('0x2f')]);_0x4bccd0[_0x46a7('0x34')]=_[_0x46a7('0x32')](_0x2d0003['model'],qs[_0x46a7('0x33')](_0x40e58f[_0x46a7('0x2f')]['fields']));_0x4bccd0[_0x46a7('0x34')]=_0x4bccd0[_0x46a7('0x34')][_0x46a7('0x35')]?_0x4bccd0['attributes']:_0x2d0003[_0x46a7('0x2e')];_0x4bccd0[_0x46a7('0x36')]=qs[_0x46a7('0x37')](_0x40e58f['query']['sort']);_0x4bccd0['where']=qs[_0x46a7('0x31')](_[_0x46a7('0x58')](_0x40e58f[_0x46a7('0x2f')],_0x2d0003['filters']));if(_0x40e58f['query'][_0x46a7('0x39')]){_0x4bccd0[_0x46a7('0x38')]=_[_0x46a7('0x3a')](_0x4bccd0[_0x46a7('0x38')],{'$or':_[_0x46a7('0x2a')](_0x4bccd0[_0x46a7('0x34')],function(_0x1018b5){var _0xf78160={};_0xf78160[_0x1018b5]={'$like':'%'+_0x40e58f[_0x46a7('0x2f')]['filter']+'%'};return _0xf78160;})});}_0x4bccd0=_[_0x46a7('0x3a')]({},_0x4bccd0,_0x40e58f[_0x46a7('0x42')]);return _0x477934['getBlackLists'](_0x4bccd0);}})[_0x46a7('0x24')](function(_0x110c92){if(_0x110c92){_0x1841da=_0x110c92[_0x46a7('0x35')];if(!_0x40e58f[_0x46a7('0x2f')][_0x46a7('0x56')](_0x46a7('0x57'))){_0x4bccd0[_0x46a7('0x1e')]=qs['limit'](_0x40e58f[_0x46a7('0x2f')][_0x46a7('0x1e')]);_0x4bccd0[_0x46a7('0x1c')]=qs[_0x46a7('0x1c')](_0x40e58f[_0x46a7('0x2f')][_0x46a7('0x1c')]);}return _0x477934[_0x46a7('0x83')](_0x4bccd0);}})['then'](function(_0x4b7f47){if(_0x4b7f47){return _0x4b7f47?{'count':_0x1841da,'rows':_0x4b7f47}:null;}})['then'](respondWithResult(_0x25c66e,null))[_0x46a7('0x3f')](handleError(_0x25c66e,null));};exports[_0x46a7('0x84')]=function(_0x2b35d8,_0x5a5d0d,_0x4aed14){var _0x33ca4f,_0x35ccae;return db[_0x46a7('0x2b')]['find']({'where':{'id':_0x2b35d8['params']['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0x5a5d0d,null))['then'](function(_0x5d4c77){if(_0x5d4c77){_0x35ccae=_0x5d4c77;return _0x5d4c77['addBlackLists'](_0x2b35d8[_0x46a7('0x45')][_0x46a7('0x64')],_[_0x46a7('0x50')](_0x2b35d8[_0x46a7('0x45')],[_0x46a7('0x64'),'id'])||{});}return null;})[_0x46a7('0x65')](function(_0xa7915a){var _0x441830;_0x33ca4f=_0xa7915a||[];var _0x9d79b7=[];if(_0xa7915a){for(var _0x1bb0ef=0x0;_0x1bb0ef<_0xa7915a['length'];_0x1bb0ef+=0x1){var _0x28949f=_0xa7915a[_0x1bb0ef][_0x46a7('0x47')]({'plain':!![]});_0x441830=squel[_0x46a7('0x7b')]()[_0x46a7('0x7f')]('cm_hopper_black')[_0x46a7('0x67')](['phone',_0x46a7('0x6d'),_0x46a7('0x6a'),_0x46a7('0x5c'),_0x46a7('0x4f'),_0x46a7('0x6f')],squel[_0x46a7('0x6b')]()[_0x46a7('0x6c')](_0x46a7('0x68'),_0x46a7('0x68'))[_0x46a7('0x6c')]('id','ContactId')[_0x46a7('0x6c')](_0x28949f[_0x46a7('0x7d')]['toString'](),_0x46a7('0x6a'))[_0x46a7('0x6c')](_0x2b35d8['params']['id'][_0x46a7('0x6e')](),_0x46a7('0x5c'))[_0x46a7('0x6c')]('NOW()',_0x46a7('0x4f'))['field']('NOW()',_0x46a7('0x6f'))['from'](_0x46a7('0x7e'))[_0x46a7('0x38')](_0x46a7('0x71'))[_0x46a7('0x38')](_0x46a7('0x72'),_0x28949f[_0x46a7('0x7d')]['toString']())[_0x46a7('0x38')](_0x46a7('0x73')))[_0x46a7('0x6e')]();_0x9d79b7[_0x46a7('0x85')](db[_0x46a7('0x80')][_0x46a7('0x2f')](_0x441830));}return BPromise[_0x46a7('0x81')](_0x9d79b7);}})['then'](function(){return _0x33ca4f;})[_0x46a7('0x24')](respondWithResult(_0x5a5d0d,null))[_0x46a7('0x3f')](handleError(_0x5a5d0d,null));};exports['removeBlackLists']=function(_0x962b82,_0xc695ce,_0x9b9a05){return db[_0x46a7('0x2b')][_0x46a7('0x43')]({'where':{'id':_0x962b82[_0x46a7('0x52')]['id']}})[_0x46a7('0x24')](handleEntityNotFound(_0xc695ce,null))[_0x46a7('0x24')](function(_0x293712){if(_0x293712){return _0x293712[_0x46a7('0x86')](_0x962b82[_0x46a7('0x2f')]['ids']);}})[_0x46a7('0x24')](function(_0x4f9b2f){if(_0x4f9b2f){return db[_0x46a7('0x60')][_0x46a7('0x25')]({'where':{'ListId':_0x962b82['query'][_0x46a7('0x64')],'CampaignId':_0x962b82[_0x46a7('0x52')]['id']}})[_0x46a7('0x24')](function(){return _0x4f9b2f;});}})['then'](respondWithStatusCode(_0xc695ce,null))[_0x46a7('0x3f')](handleError(_0xc695ce,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 180887a..49fb12d 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 bfc1c68..a289b9d 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 _0x4b1f=['GetCampaign','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','Campaign','findAll','options','raw','where','attributes','include','map','model'];(function(_0x10bb41,_0x10c4a5){var _0x25b1a3=function(_0xe48219){while(--_0xe48219){_0x10bb41['push'](_0x10bb41['shift']());}};_0x25b1a3(++_0x10c4a5);}(_0x4b1f,0x195));var _0xf4b1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4b1f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var moment=require('moment');var BPromise=require(_0xf4b1('0x2'));var rs=require(_0xf4b1('0x3'));var fs=require('fs');var Redis=require(_0xf4b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4b1('0x5'));var logger=require(_0xf4b1('0x6'))(_0xf4b1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4b1('0x8')][_0xf4b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310db5,_0x3b9c78,_0x1abfc7){return new BPromise(function(_0x50738c,_0x59cf77){return client['request'](_0x310db5,_0x1abfc7)[_0xf4b1('0xa')](function(_0x53a786){logger[_0xf4b1('0xb')]('Campaign,\x20%s,\x20%s',_0x3b9c78,'request\x20sent');logger[_0xf4b1('0xc')](_0xf4b1('0xd'),_0x3b9c78,_0xf4b1('0xe'),JSON[_0xf4b1('0xf')](_0x53a786));if(_0x53a786[_0xf4b1('0x10')]){if(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x11')]===0x1f4){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);return _0x59cf77(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x3b9c78,_0x53a786[_0xf4b1('0x10')]['message']);return _0x50738c(_0x53a786['error'][_0xf4b1('0x13')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x3b9c78,_0xf4b1('0xe'));_0x50738c(_0x53a786['result']['message']);}})['catch'](function(_0x5cb2a1){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x5cb2a1);_0x59cf77(_0x5cb2a1);});});}exports['GetCampaign']=function(_0x3b378e){var _0x420f9e=this;return new Promise(function(_0x322b38,_0x465da2){return db[_0xf4b1('0x14')][_0xf4b1('0x15')]({'raw':_0x3b378e['options']?_0x3b378e[_0xf4b1('0x16')][_0xf4b1('0x17')]===undefined?!![]:![]:!![],'where':_0x3b378e['options']?_0x3b378e[_0xf4b1('0x16')][_0xf4b1('0x18')]||null:null,'attributes':_0x3b378e['options']?_0x3b378e[_0xf4b1('0x16')][_0xf4b1('0x19')]||null:null,'limit':_0x3b378e[_0xf4b1('0x16')]?_0x3b378e[_0xf4b1('0x16')]['limit']||null:null,'include':_0x3b378e[_0xf4b1('0x16')]?_0x3b378e[_0xf4b1('0x16')][_0xf4b1('0x1a')]?_[_0xf4b1('0x1b')](_0x3b378e['options'][_0xf4b1('0x1a')],function(_0x474212){return{'model':db[_0x474212['model']],'as':_0x474212['as'],'attributes':_0x474212[_0xf4b1('0x19')],'include':_0x474212['include']?_[_0xf4b1('0x1b')](_0x474212['include'],function(_0x238fbe){return{'model':db[_0x238fbe[_0xf4b1('0x1c')]],'as':_0x238fbe['as'],'attributes':_0x238fbe[_0xf4b1('0x19')],'include':_0x238fbe['include']?_[_0xf4b1('0x1b')](_0x238fbe['include'],function(_0x2e3b90){return{'model':db[_0x2e3b90['model']],'as':_0x2e3b90['as'],'attributes':_0x2e3b90[_0xf4b1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf4b1('0xa')](function(_0x5d28af){logger[_0xf4b1('0xb')](_0xf4b1('0x1d'),_0x3b378e);logger['debug'](_0xf4b1('0x1d'),_0x3b378e,JSON[_0xf4b1('0xf')](_0x5d28af));_0x322b38(_0x5d28af);})[_0xf4b1('0x1e')](function(_0x11ffb3){logger[_0xf4b1('0x10')](_0xf4b1('0x1d'),_0x11ffb3[_0xf4b1('0x13')],_0x3b378e);_0x465da2(_0x420f9e['error'](0x1f4,_0x11ffb3['message']));});});}; \ No newline at end of file +var _0xbe31=['map','model','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Campaign,\x20%s,\x20%s','GetCampaign','Campaign','findAll','options','raw','limit','include'];(function(_0x44f347,_0x3be1a9){var _0x296219=function(_0x1dac7f){while(--_0x1dac7f){_0x44f347['push'](_0x44f347['shift']());}};_0x296219(++_0x3be1a9);}(_0xbe31,0x83));var _0x1be3=function(_0x162fe4,_0x23a8b1){_0x162fe4=_0x162fe4-0x0;var _0xa64438=_0xbe31[_0x162fe4];return _0xa64438;};'use strict';var _=require('lodash');var util=require(_0x1be3('0x0'));var moment=require(_0x1be3('0x1'));var BPromise=require(_0x1be3('0x2'));var rs=require(_0x1be3('0x3'));var fs=require('fs');var Redis=require(_0x1be3('0x4'));var db=require(_0x1be3('0x5'))['db'];var utils=require(_0x1be3('0x6'));var logger=require(_0x1be3('0x7'))(_0x1be3('0x8'));var config=require('../../config/environment');var jayson=require(_0x1be3('0x9'));var client=jayson['client'][_0x1be3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa757b9,_0x3c925a,_0x2c3965){return new BPromise(function(_0x2bb749,_0x2e4488){return client[_0x1be3('0xb')](_0xa757b9,_0x2c3965)[_0x1be3('0xc')](function(_0x359742){logger[_0x1be3('0xd')]('Campaign,\x20%s,\x20%s',_0x3c925a,_0x1be3('0xe'));logger[_0x1be3('0xf')](_0x1be3('0x10'),_0x3c925a,_0x1be3('0xe'),JSON[_0x1be3('0x11')](_0x359742));if(_0x359742[_0x1be3('0x12')]){if(_0x359742[_0x1be3('0x12')][_0x1be3('0x13')]===0x1f4){logger[_0x1be3('0x12')]('Campaign,\x20%s,\x20%s',_0x3c925a,_0x359742[_0x1be3('0x12')]['message']);return _0x2e4488(_0x359742[_0x1be3('0x12')][_0x1be3('0x14')]);}logger['error'](_0x1be3('0x15'),_0x3c925a,_0x359742['error'][_0x1be3('0x14')]);return _0x2bb749(_0x359742[_0x1be3('0x12')][_0x1be3('0x14')]);}else{logger[_0x1be3('0xd')](_0x1be3('0x15'),_0x3c925a,_0x1be3('0xe'));_0x2bb749(_0x359742['result']['message']);}})['catch'](function(_0x52d2f2){logger[_0x1be3('0x12')]('Campaign,\x20%s,\x20%s',_0x3c925a,_0x52d2f2);_0x2e4488(_0x52d2f2);});});}exports[_0x1be3('0x16')]=function(_0x6b7edf){var _0xaa1d7b=this;return new Promise(function(_0x1d0c2b,_0x21668a){return db[_0x1be3('0x17')][_0x1be3('0x18')]({'raw':_0x6b7edf[_0x1be3('0x19')]?_0x6b7edf[_0x1be3('0x19')][_0x1be3('0x1a')]===undefined?!![]:![]:!![],'where':_0x6b7edf[_0x1be3('0x19')]?_0x6b7edf[_0x1be3('0x19')]['where']||null:null,'attributes':_0x6b7edf['options']?_0x6b7edf[_0x1be3('0x19')]['attributes']||null:null,'limit':_0x6b7edf[_0x1be3('0x19')]?_0x6b7edf[_0x1be3('0x19')][_0x1be3('0x1b')]||null:null,'include':_0x6b7edf[_0x1be3('0x19')]?_0x6b7edf[_0x1be3('0x19')][_0x1be3('0x1c')]?_[_0x1be3('0x1d')](_0x6b7edf['options'][_0x1be3('0x1c')],function(_0x48862c){return{'model':db[_0x48862c[_0x1be3('0x1e')]],'as':_0x48862c['as'],'attributes':_0x48862c[_0x1be3('0x1f')],'include':_0x48862c['include']?_[_0x1be3('0x1d')](_0x48862c['include'],function(_0x134d79){return{'model':db[_0x134d79[_0x1be3('0x1e')]],'as':_0x134d79['as'],'attributes':_0x134d79[_0x1be3('0x1f')],'include':_0x134d79[_0x1be3('0x1c')]?_['map'](_0x134d79[_0x1be3('0x1c')],function(_0x8d1f58){return{'model':db[_0x8d1f58['model']],'as':_0x8d1f58['as'],'attributes':_0x8d1f58[_0x1be3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1be3('0xc')](function(_0x44da09){logger[_0x1be3('0xd')](_0x1be3('0x16'),_0x6b7edf);logger[_0x1be3('0xf')]('GetCampaign',_0x6b7edf,JSON[_0x1be3('0x11')](_0x44da09));_0x1d0c2b(_0x44da09);})['catch'](function(_0x25ed26){logger['error'](_0x1be3('0x16'),_0x25ed26[_0x1be3('0x14')],_0x6b7edf);_0x21668a(_0xaa1d7b['error'](0x1f4,_0x25ed26['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b8f2ab5..8f454d1 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 _0xbb1c=['getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black'];(function(_0x226b60,_0x4fac70){var _0x3d566e=function(_0x123cb9){while(--_0x123cb9){_0x226b60['push'](_0x226b60['shift']());}};_0x3d566e(++_0x4fac70);}(_0xbb1c,0x16e));var _0xcbb1=function(_0x17f5fc,_0xac1ffe){_0x17f5fc=_0x17f5fc-0x0;var _0x45b8fe=_0xbb1c[_0x17f5fc];return _0x45b8fe;};'use strict';var multer=require(_0xcbb1('0x0'));var util=require(_0xcbb1('0x1'));var path=require(_0xcbb1('0x2'));var timeout=require('connect-timeout');var express=require(_0xcbb1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcbb1('0x4'));var interaction=require(_0xcbb1('0x5'));var config=require(_0xcbb1('0x6'));var controller=require('./campaign.controller');router[_0xcbb1('0x7')]('/',auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x9')]);router['get'](_0xcbb1('0xa'),auth['isAuthenticated'](),controller[_0xcbb1('0xb')]);router[_0xcbb1('0x7')](_0xcbb1('0xc'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0xd')]);router[_0xcbb1('0x7')](_0xcbb1('0xe'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0xf')]);router[_0xcbb1('0x7')](_0xcbb1('0x10'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x11')]);router[_0xcbb1('0x7')](_0xcbb1('0x12'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x13')]);router[_0xcbb1('0x7')](_0xcbb1('0x14'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x15')]);router[_0xcbb1('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xcbb1('0x16')]);router[_0xcbb1('0x17')]('/',auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x18')]);router[_0xcbb1('0x17')](_0xcbb1('0x19'),auth['isAuthenticated'](),controller[_0xcbb1('0x1a')]);router['post'](_0xcbb1('0x14'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x1b')]);router[_0xcbb1('0x17')]('/:id/blacklists',auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x1c')]);router['put'](_0xcbb1('0xa'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x1d')]);router[_0xcbb1('0x1e')](_0xcbb1('0xa'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x1f')]);router['delete'](_0xcbb1('0x14'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x20')]);router[_0xcbb1('0x1e')](_0xcbb1('0x21'),auth[_0xcbb1('0x8')](),controller[_0xcbb1('0x22')]);module['exports']=router; \ No newline at end of file +var _0x75a9=['index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','create','/:id/clone','clone','addLists','post','put','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x75a9,0x136));var _0x975a=function(_0x2b3e9d,_0x3b534d){_0x2b3e9d=_0x2b3e9d-0x0;var _0x19a933=_0x75a9[_0x2b3e9d];return _0x19a933;};'use strict';var multer=require(_0x975a('0x0'));var util=require(_0x975a('0x1'));var path=require('path');var timeout=require(_0x975a('0x2'));var express=require(_0x975a('0x3'));var router=express['Router']();var fs_extra=require(_0x975a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x975a('0x5'));var config=require(_0x975a('0x6'));var controller=require(_0x975a('0x7'));router[_0x975a('0x8')]('/',auth[_0x975a('0x9')](),controller[_0x975a('0xa')]);router[_0x975a('0x8')](_0x975a('0xb'),auth['isAuthenticated'](),controller[_0x975a('0xc')]);router[_0x975a('0x8')](_0x975a('0xd'),auth[_0x975a('0x9')](),controller[_0x975a('0xe')]);router['get'](_0x975a('0xf'),auth[_0x975a('0x9')](),controller[_0x975a('0x10')]);router[_0x975a('0x8')](_0x975a('0x11'),auth[_0x975a('0x9')](),controller[_0x975a('0x12')]);router['get']('/:id/hopper_black',auth[_0x975a('0x9')](),controller['getHopperBlacks']);router[_0x975a('0x8')](_0x975a('0x13'),auth[_0x975a('0x9')](),controller[_0x975a('0x14')]);router[_0x975a('0x8')](_0x975a('0x15'),auth[_0x975a('0x9')](),controller['getBlackLists']);router['post']('/',auth[_0x975a('0x9')](),controller[_0x975a('0x16')]);router['post'](_0x975a('0x17'),auth[_0x975a('0x9')](),controller[_0x975a('0x18')]);router['post'](_0x975a('0x13'),auth['isAuthenticated'](),controller[_0x975a('0x19')]);router[_0x975a('0x1a')](_0x975a('0x15'),auth[_0x975a('0x9')](),controller['addBlackLists']);router[_0x975a('0x1b')](_0x975a('0xb'),auth[_0x975a('0x9')](),controller['update']);router['delete'](_0x975a('0xb'),auth[_0x975a('0x9')](),controller[_0x975a('0x1c')]);router['delete'](_0x975a('0x13'),auth['isAuthenticated'](),controller[_0x975a('0x1d')]);router['delete'](_0x975a('0x15'),auth['isAuthenticated'](),controller[_0x975a('0x1e')]);module[_0x975a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e4219a5..826bce6 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 _0xcf2a=['key','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x576b19,_0x49d2fe){var _0x2a63c0=function(_0x1087cd){while(--_0x1087cd){_0x576b19['push'](_0x576b19['shift']());}};_0x2a63c0(++_0x49d2fe);}(_0xcf2a,0xbb));var _0xacf2=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xcf2a[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require('sequelize');module[_0xacf2('0x0')]={'key':{'type':Sequelize[_0xacf2('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xacf2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xacf2('0x3')],'get':function(){return this[_0xacf2('0x4')](_0xacf2('0x5'));}}}; \ No newline at end of file +var _0xa2d8=['getDataValue','exports','STRING','TEXT','VIRTUAL'];(function(_0x4428f2,_0x5b0153){var _0x1fba84=function(_0x343ca9){while(--_0x343ca9){_0x4428f2['push'](_0x4428f2['shift']());}};_0x1fba84(++_0x5b0153);}(_0xa2d8,0x100));var _0x8a2d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa2d8[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0x8a2d('0x0')]={'key':{'type':Sequelize[_0x8a2d('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x8a2d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x8a2d('0x3')],'get':function(){return this[_0x8a2d('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 94aab3c..009bae6 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 _0x5a58=['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','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','CannedAnswers','end','sendStatus','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','show','params','includeAll','find','catch','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x27aa84,_0x5e54b7){var _0x2e0ac3=function(_0x331ea4){while(--_0x331ea4){_0x27aa84['push'](_0x27aa84['shift']());}};_0x2e0ac3(++_0x5e54b7);}(_0x5a58,0xab));var _0x85a5=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x5a58[_0x468b0f];return _0x3e74d9;};'use strict';var emlformat=require(_0x85a5('0x0'));var rimraf=require(_0x85a5('0x1'));var zipdir=require(_0x85a5('0x2'));var jsonpatch=require(_0x85a5('0x3'));var rp=require(_0x85a5('0x4'));var moment=require('moment');var BPromise=require(_0x85a5('0x5'));var Mustache=require(_0x85a5('0x6'));var util=require(_0x85a5('0x7'));var path=require(_0x85a5('0x8'));var sox=require(_0x85a5('0x9'));var csv=require('to-csv');var ejs=require(_0x85a5('0xa'));var fs=require('fs');var fs_extra=require(_0x85a5('0xb'));var _=require(_0x85a5('0xc'));var squel=require(_0x85a5('0xd'));var crypto=require('crypto');var jsforce=require(_0x85a5('0xe'));var deskjs=require(_0x85a5('0xf'));var toCsv=require(_0x85a5('0x10'));var querystring=require(_0x85a5('0x11'));var Papa=require(_0x85a5('0x12'));var Redis=require('ioredis');var authService=require(_0x85a5('0x13'));var qs=require(_0x85a5('0x14'));var as=require(_0x85a5('0x15'));var hardwareService=require(_0x85a5('0x16'));var logger=require(_0x85a5('0x17'))(_0x85a5('0x18'));var utils=require(_0x85a5('0x19'));var config=require(_0x85a5('0x1a'));var licenseUtil=require(_0x85a5('0x1b'));var db=require(_0x85a5('0x1c'))['db'];function respondWithStatusCode(_0x4fafd7,_0x4f3971){_0x4f3971=_0x4f3971||0xcc;return function(_0x5a7ed1){if(_0x5a7ed1){return _0x4fafd7['sendStatus'](_0x4f3971);}return _0x4fafd7[_0x85a5('0x1d')](_0x4f3971)['end']();};}function respondWithResult(_0x3cf866,_0x52239f){_0x52239f=_0x52239f||0xc8;return function(_0x52d490){if(_0x52d490){return _0x3cf866[_0x85a5('0x1d')](_0x52239f)['json'](_0x52d490);}};}function respondWithFilteredResult(_0x254c62,_0xf413e8){return function(_0x4d6edd){if(_0x4d6edd){var _0xd61907=typeof _0xf413e8[_0x85a5('0x1e')]===_0x85a5('0x1f')&&typeof _0xf413e8[_0x85a5('0x20')]===_0x85a5('0x1f');var _0x51dbd8=_0x4d6edd[_0x85a5('0x21')];var _0x23beb6=_0xd61907?0x0:_0xf413e8[_0x85a5('0x1e')];var _0x31c542=_0xd61907?_0x4d6edd['count']:_0xf413e8['offset']+_0xf413e8[_0x85a5('0x20')];var _0xba91c8;if(_0x31c542>=_0x51dbd8){_0x31c542=_0x51dbd8;_0xba91c8=0xc8;}else{_0xba91c8=0xce;}_0x254c62[_0x85a5('0x1d')](_0xba91c8);return _0x254c62[_0x85a5('0x22')](_0x85a5('0x23'),_0x23beb6+'-'+_0x31c542+'/'+_0x51dbd8)[_0x85a5('0x24')](_0x4d6edd);}return null;};}function patchUpdates(_0xe923ee){return function(_0x1dd543){try{jsonpatch[_0x85a5('0x25')](_0x1dd543,_0xe923ee,!![]);}catch(_0x375d35){return BPromise['reject'](_0x375d35);}return _0x1dd543['save']();};}function saveUpdates(_0x442f46,_0x235192){return function(_0x439167){if(_0x439167){return _0x439167[_0x85a5('0x26')](_0x442f46)[_0x85a5('0x27')](function(_0x387ebc){return _0x387ebc;});}return null;};}function removeEntity(_0x1b06ea,_0x39cb3b){return function(_0x5af998){if(_0x5af998){return _0x5af998[_0x85a5('0x28')]()[_0x85a5('0x27')](function(){var _0x3b966c=_0x5af998['get']({'plain':!![]});var _0x4cdb32=_0x85a5('0x29');return db['UserProfileResource'][_0x85a5('0x28')]({'where':{'type':_0x4cdb32,'resourceId':_0x3b966c['id']}})[_0x85a5('0x27')](function(){return _0x5af998;});})[_0x85a5('0x27')](function(){_0x1b06ea['status'](0xcc)[_0x85a5('0x2a')]();});}};}function handleEntityNotFound(_0x478d58,_0x5484f2){return function(_0x56b36d){if(!_0x56b36d){_0x478d58[_0x85a5('0x2b')](0x194);}return _0x56b36d;};}function handleError(_0x4cf778,_0x51310c){_0x51310c=_0x51310c||0x1f4;return function(_0x82006a){logger[_0x85a5('0x2c')](_0x82006a['stack']);if(_0x82006a[_0x85a5('0x2d')]){delete _0x82006a[_0x85a5('0x2d')];}_0x4cf778[_0x85a5('0x1d')](_0x51310c)[_0x85a5('0x2e')](_0x82006a);};}exports[_0x85a5('0x2f')]=function(_0x3b6de1,_0x10b27b){var _0xc6f0f8={},_0x11ba49={},_0x24b0a7={'count':0x0,'rows':[]};var _0x2e2785=_[_0x85a5('0x30')](db[_0x85a5('0x31')][_0x85a5('0x32')],function(_0x2ab8b5){return{'name':_0x2ab8b5[_0x85a5('0x33')],'type':_0x2ab8b5[_0x85a5('0x34')][_0x85a5('0x35')]};});_0x11ba49['model']=_[_0x85a5('0x30')](_0x2e2785,'name');_0x11ba49[_0x85a5('0x36')]=_[_0x85a5('0x37')](_0x3b6de1[_0x85a5('0x36')]);_0x11ba49[_0x85a5('0x38')]=_[_0x85a5('0x39')](_0x11ba49['model'],_0x11ba49[_0x85a5('0x36')]);_0xc6f0f8[_0x85a5('0x3a')]=_[_0x85a5('0x39')](_0x11ba49[_0x85a5('0x3b')],qs[_0x85a5('0x3c')](_0x3b6de1['query'][_0x85a5('0x3c')]));_0xc6f0f8[_0x85a5('0x3a')]=_0xc6f0f8[_0x85a5('0x3a')][_0x85a5('0x3d')]?_0xc6f0f8[_0x85a5('0x3a')]:_0x11ba49[_0x85a5('0x3b')];if(!_0x3b6de1[_0x85a5('0x36')][_0x85a5('0x3e')](_0x85a5('0x3f'))){_0xc6f0f8[_0x85a5('0x20')]=qs[_0x85a5('0x20')](_0x3b6de1[_0x85a5('0x36')][_0x85a5('0x20')]);_0xc6f0f8[_0x85a5('0x1e')]=qs[_0x85a5('0x1e')](_0x3b6de1['query'][_0x85a5('0x1e')]);}_0xc6f0f8[_0x85a5('0x40')]=qs['sort'](_0x3b6de1['query'][_0x85a5('0x41')]);_0xc6f0f8[_0x85a5('0x42')]=qs[_0x85a5('0x38')](_[_0x85a5('0x43')](_0x3b6de1[_0x85a5('0x36')],_0x11ba49[_0x85a5('0x38')]),_0x2e2785);if(_0x3b6de1['query'][_0x85a5('0x44')]){_0xc6f0f8['where']=_[_0x85a5('0x45')](_0xc6f0f8[_0x85a5('0x42')],{'$or':[{'key':{'$like':'%'+_0x3b6de1[_0x85a5('0x36')][_0x85a5('0x44')]+'%'}},{'value':{'$like':'%'+_0x3b6de1[_0x85a5('0x36')][_0x85a5('0x44')]+'%'}}]});}_0xc6f0f8=_[_0x85a5('0x45')]({},_0xc6f0f8,_0x3b6de1[_0x85a5('0x46')]);var _0x906fd0={'where':_0xc6f0f8[_0x85a5('0x42')]};return db[_0x85a5('0x31')]['count'](_0x906fd0)[_0x85a5('0x27')](function(_0x101172){_0x24b0a7[_0x85a5('0x21')]=_0x101172;if(_0x3b6de1[_0x85a5('0x36')]['includeAll']){_0xc6f0f8[_0x85a5('0x47')]=[{'all':!![]}];}return db[_0x85a5('0x31')]['findAll'](_0xc6f0f8);})[_0x85a5('0x27')](function(_0x375016){_0x24b0a7[_0x85a5('0x48')]=_0x375016;return _0x24b0a7;})['then'](respondWithFilteredResult(_0x10b27b,_0xc6f0f8))['catch'](handleError(_0x10b27b,null));};exports[_0x85a5('0x49')]=function(_0x1c7c50,_0x117006){var _0x136cda={'raw':!![],'where':{'id':_0x1c7c50[_0x85a5('0x4a')]['id']}},_0x6c0d43={};_0x6c0d43[_0x85a5('0x3b')]=_[_0x85a5('0x37')](db['CannedAnswer'][_0x85a5('0x32')]);_0x6c0d43[_0x85a5('0x36')]=_[_0x85a5('0x37')](_0x1c7c50[_0x85a5('0x36')]);_0x6c0d43[_0x85a5('0x38')]=_[_0x85a5('0x39')](_0x6c0d43[_0x85a5('0x3b')],_0x6c0d43[_0x85a5('0x36')]);_0x136cda[_0x85a5('0x3a')]=_[_0x85a5('0x39')](_0x6c0d43[_0x85a5('0x3b')],qs['fields'](_0x1c7c50[_0x85a5('0x36')][_0x85a5('0x3c')]));_0x136cda[_0x85a5('0x3a')]=_0x136cda['attributes']['length']?_0x136cda['attributes']:_0x6c0d43[_0x85a5('0x3b')];if(_0x1c7c50['query'][_0x85a5('0x4b')]){_0x136cda['include']=[{'all':!![]}];}_0x136cda=_['merge']({},_0x136cda,_0x1c7c50[_0x85a5('0x46')]);return db[_0x85a5('0x31')][_0x85a5('0x4c')](_0x136cda)[_0x85a5('0x27')](handleEntityNotFound(_0x117006,null))[_0x85a5('0x27')](respondWithResult(_0x117006,null))[_0x85a5('0x4d')](handleError(_0x117006,null));};exports[_0x85a5('0x26')]=function(_0x18a713,_0x59ac2a){if(_0x18a713[_0x85a5('0x4e')]['id']){delete _0x18a713[_0x85a5('0x4e')]['id'];}return db['CannedAnswer'][_0x85a5('0x4c')]({'where':{'id':_0x18a713['params']['id']}})[_0x85a5('0x27')](handleEntityNotFound(_0x59ac2a,null))[_0x85a5('0x27')](saveUpdates(_0x18a713[_0x85a5('0x4e')],null))['then'](respondWithResult(_0x59ac2a,null))['catch'](handleError(_0x59ac2a,null));};exports[_0x85a5('0x28')]=function(_0x57445d,_0x5eab99){return db[_0x85a5('0x31')][_0x85a5('0x4c')]({'where':{'id':_0x57445d['params']['id']}})[_0x85a5('0x27')](handleEntityNotFound(_0x5eab99,null))[_0x85a5('0x27')](removeEntity(_0x5eab99,null))['catch'](handleError(_0x5eab99,null));};exports['create']=function(_0xa71b65,_0x55fa4d){var _0x211e86={'key':_0xa71b65[_0x85a5('0x4e')][_0x85a5('0x35')]};if(_0xa71b65['body']['MailAccountId']){_0x211e86[_0x85a5('0x4f')]=_0xa71b65[_0x85a5('0x4e')][_0x85a5('0x4f')];}else if(_0xa71b65[_0x85a5('0x4e')]['SmsAccountId']){_0x211e86['SmsAccountId']=_0xa71b65[_0x85a5('0x4e')][_0x85a5('0x50')];}else if(_0xa71b65[_0x85a5('0x4e')][_0x85a5('0x51')]){_0x211e86['OpenchannelAccountId']=_0xa71b65['body']['OpenchannelAccountId'];}else if(_0xa71b65['body'][_0x85a5('0x52')]){_0x211e86[_0x85a5('0x52')]=_0xa71b65[_0x85a5('0x4e')][_0x85a5('0x52')];}return db[_0x85a5('0x31')][_0x85a5('0x4c')]({'where':_0x211e86})[_0x85a5('0x27')](function(_0x7337ad){if(_0x7337ad){throw new db[(_0x85a5('0x53'))][(_0x85a5('0x54'))](_0x85a5('0x55'));}return db['CannedAnswer'][_0x85a5('0x56')](_0xa71b65[_0x85a5('0x4e')]);})[_0x85a5('0x27')](function(_0x831404){var _0x571a00=_0xa71b65['user']['get']({'plain':!![]});if(!_0x571a00)throw new Error(_0x85a5('0x57'));if(_0x571a00['role']===_0x85a5('0x58')){var _0x4b9c41=_0x831404[_0x85a5('0x59')]({'plain':!![]});return db[_0x85a5('0x5a')][_0x85a5('0x4c')]({'where':{'name':_0x85a5('0x29'),'userProfileId':_0x571a00[_0x85a5('0x5b')]},'raw':!![]})[_0x85a5('0x27')](function(_0x264aec){if(_0x264aec&&_0x264aec['autoAssociation']===0x0){return db[_0x85a5('0x5c')][_0x85a5('0x56')]({'name':_0x4b9c41['name'],'resourceId':_0x4b9c41['id'],'type':_0x264aec[_0x85a5('0x2d')],'sectionId':_0x264aec['id']},{})['then'](function(){return _0x831404;});}else{return _0x831404;}})[_0x85a5('0x4d')](function(_0x46112e){logger[_0x85a5('0x2c')](_0x85a5('0x5d'),_0x46112e);throw _0x46112e;});}return _0x831404;})['then'](respondWithResult(_0x55fa4d,0xc9))[_0x85a5('0x4d')](handleError(_0x55fa4d,null));}; \ No newline at end of file +var _0x2e33=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','then','get','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','include','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js'];(function(_0x44fb83,_0x496f92){var _0x5b5d30=function(_0xca944d){while(--_0xca944d){_0x44fb83['push'](_0x44fb83['shift']());}};_0x5b5d30(++_0x496f92);}(_0x2e33,0x152));var _0x32e3=function(_0x1c53e8,_0x487058){_0x1c53e8=_0x1c53e8-0x0;var _0x400ab9=_0x2e33[_0x1c53e8];return _0x400ab9;};'use strict';var emlformat=require(_0x32e3('0x0'));var rimraf=require(_0x32e3('0x1'));var zipdir=require(_0x32e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32e3('0x3'));var moment=require(_0x32e3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x32e3('0x5'));var util=require(_0x32e3('0x6'));var path=require(_0x32e3('0x7'));var sox=require(_0x32e3('0x8'));var csv=require(_0x32e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32e3('0xa'));var _=require('lodash');var squel=require(_0x32e3('0xb'));var crypto=require(_0x32e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x32e3('0xd'));var toCsv=require(_0x32e3('0x9'));var querystring=require(_0x32e3('0xe'));var Papa=require('papaparse');var Redis=require(_0x32e3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x32e3('0x10'));var as=require(_0x32e3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32e3('0x12'))(_0x32e3('0x13'));var utils=require(_0x32e3('0x14'));var config=require(_0x32e3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x32e3('0x16'))['db'];function respondWithStatusCode(_0x72e41f,_0x3921af){_0x3921af=_0x3921af||0xcc;return function(_0x3fd8ef){if(_0x3fd8ef){return _0x72e41f[_0x32e3('0x17')](_0x3921af);}return _0x72e41f[_0x32e3('0x18')](_0x3921af)[_0x32e3('0x19')]();};}function respondWithResult(_0x13ef5a,_0x4641b2){_0x4641b2=_0x4641b2||0xc8;return function(_0x1d7ef7){if(_0x1d7ef7){return _0x13ef5a[_0x32e3('0x18')](_0x4641b2)[_0x32e3('0x1a')](_0x1d7ef7);}};}function respondWithFilteredResult(_0x172cd0,_0x3e04bd){return function(_0xc2f5b1){if(_0xc2f5b1){var _0x588f13=typeof _0x3e04bd[_0x32e3('0x1b')]==='undefined'&&typeof _0x3e04bd[_0x32e3('0x1c')]===_0x32e3('0x1d');var _0x29fd0f=_0xc2f5b1['count'];var _0x5c3977=_0x588f13?0x0:_0x3e04bd['offset'];var _0x139718=_0x588f13?_0xc2f5b1['count']:_0x3e04bd[_0x32e3('0x1b')]+_0x3e04bd[_0x32e3('0x1c')];var _0x447fa1;if(_0x139718>=_0x29fd0f){_0x139718=_0x29fd0f;_0x447fa1=0xc8;}else{_0x447fa1=0xce;}_0x172cd0[_0x32e3('0x18')](_0x447fa1);return _0x172cd0[_0x32e3('0x1e')](_0x32e3('0x1f'),_0x5c3977+'-'+_0x139718+'/'+_0x29fd0f)[_0x32e3('0x1a')](_0xc2f5b1);}return null;};}function patchUpdates(_0x36d670){return function(_0x359400){try{jsonpatch[_0x32e3('0x20')](_0x359400,_0x36d670,!![]);}catch(_0x207491){return BPromise[_0x32e3('0x21')](_0x207491);}return _0x359400[_0x32e3('0x22')]();};}function saveUpdates(_0x170b90,_0x2bdaff){return function(_0x2b6784){if(_0x2b6784){return _0x2b6784[_0x32e3('0x23')](_0x170b90)['then'](function(_0x58171f){return _0x58171f;});}return null;};}function removeEntity(_0x378f87,_0x46e09e){return function(_0x5c48b5){if(_0x5c48b5){return _0x5c48b5[_0x32e3('0x24')]()[_0x32e3('0x25')](function(){var _0xbcd850=_0x5c48b5[_0x32e3('0x26')]({'plain':!![]});var _0x3e9cf6=_0x32e3('0x27');return db[_0x32e3('0x28')][_0x32e3('0x24')]({'where':{'type':_0x3e9cf6,'resourceId':_0xbcd850['id']}})[_0x32e3('0x25')](function(){return _0x5c48b5;});})[_0x32e3('0x25')](function(){_0x378f87[_0x32e3('0x18')](0xcc)[_0x32e3('0x19')]();});}};}function handleEntityNotFound(_0xb4fe51,_0x807955){return function(_0x41f887){if(!_0x41f887){_0xb4fe51[_0x32e3('0x17')](0x194);}return _0x41f887;};}function handleError(_0x329845,_0x111e03){_0x111e03=_0x111e03||0x1f4;return function(_0x2a0145){logger[_0x32e3('0x29')](_0x2a0145['stack']);if(_0x2a0145[_0x32e3('0x2a')]){delete _0x2a0145[_0x32e3('0x2a')];}_0x329845[_0x32e3('0x18')](_0x111e03)[_0x32e3('0x2b')](_0x2a0145);};}exports[_0x32e3('0x2c')]=function(_0x12df73,_0x55ac99){var _0x2379d4={},_0x2bd160={},_0x435b89={'count':0x0,'rows':[]};var _0x1c91a1=_[_0x32e3('0x2d')](db[_0x32e3('0x2e')][_0x32e3('0x2f')],function(_0x1f0704){return{'name':_0x1f0704[_0x32e3('0x30')],'type':_0x1f0704[_0x32e3('0x31')][_0x32e3('0x32')]};});_0x2bd160[_0x32e3('0x33')]=_[_0x32e3('0x2d')](_0x1c91a1,'name');_0x2bd160['query']=_[_0x32e3('0x34')](_0x12df73[_0x32e3('0x35')]);_0x2bd160[_0x32e3('0x36')]=_[_0x32e3('0x37')](_0x2bd160[_0x32e3('0x33')],_0x2bd160[_0x32e3('0x35')]);_0x2379d4[_0x32e3('0x38')]=_['intersection'](_0x2bd160['model'],qs[_0x32e3('0x39')](_0x12df73['query'][_0x32e3('0x39')]));_0x2379d4[_0x32e3('0x38')]=_0x2379d4[_0x32e3('0x38')][_0x32e3('0x3a')]?_0x2379d4[_0x32e3('0x38')]:_0x2bd160['model'];if(!_0x12df73[_0x32e3('0x35')][_0x32e3('0x3b')](_0x32e3('0x3c'))){_0x2379d4[_0x32e3('0x1c')]=qs[_0x32e3('0x1c')](_0x12df73[_0x32e3('0x35')][_0x32e3('0x1c')]);_0x2379d4[_0x32e3('0x1b')]=qs[_0x32e3('0x1b')](_0x12df73[_0x32e3('0x35')][_0x32e3('0x1b')]);}_0x2379d4[_0x32e3('0x3d')]=qs[_0x32e3('0x3e')](_0x12df73[_0x32e3('0x35')][_0x32e3('0x3e')]);_0x2379d4[_0x32e3('0x3f')]=qs[_0x32e3('0x36')](_[_0x32e3('0x40')](_0x12df73['query'],_0x2bd160[_0x32e3('0x36')]),_0x1c91a1);if(_0x12df73[_0x32e3('0x35')][_0x32e3('0x41')]){_0x2379d4[_0x32e3('0x3f')]=_[_0x32e3('0x42')](_0x2379d4[_0x32e3('0x3f')],{'$or':[{'key':{'$like':'%'+_0x12df73[_0x32e3('0x35')][_0x32e3('0x41')]+'%'}},{'value':{'$like':'%'+_0x12df73['query'][_0x32e3('0x41')]+'%'}}]});}_0x2379d4=_['merge']({},_0x2379d4,_0x12df73[_0x32e3('0x43')]);var _0x4b3b94={'where':_0x2379d4['where']};return db['CannedAnswer'][_0x32e3('0x44')](_0x4b3b94)[_0x32e3('0x25')](function(_0x457db0){_0x435b89[_0x32e3('0x44')]=_0x457db0;if(_0x12df73[_0x32e3('0x35')][_0x32e3('0x45')]){_0x2379d4['include']=[{'all':!![]}];}return db[_0x32e3('0x2e')][_0x32e3('0x46')](_0x2379d4);})[_0x32e3('0x25')](function(_0x4a51b3){_0x435b89[_0x32e3('0x47')]=_0x4a51b3;return _0x435b89;})[_0x32e3('0x25')](respondWithFilteredResult(_0x55ac99,_0x2379d4))['catch'](handleError(_0x55ac99,null));};exports[_0x32e3('0x48')]=function(_0xeb7c5d,_0x1a82a0){var _0x429ae3={'raw':!![],'where':{'id':_0xeb7c5d[_0x32e3('0x49')]['id']}},_0x7d7928={};_0x7d7928[_0x32e3('0x33')]=_[_0x32e3('0x34')](db[_0x32e3('0x2e')][_0x32e3('0x2f')]);_0x7d7928[_0x32e3('0x35')]=_['keys'](_0xeb7c5d[_0x32e3('0x35')]);_0x7d7928[_0x32e3('0x36')]=_[_0x32e3('0x37')](_0x7d7928[_0x32e3('0x33')],_0x7d7928[_0x32e3('0x35')]);_0x429ae3[_0x32e3('0x38')]=_[_0x32e3('0x37')](_0x7d7928[_0x32e3('0x33')],qs[_0x32e3('0x39')](_0xeb7c5d[_0x32e3('0x35')][_0x32e3('0x39')]));_0x429ae3[_0x32e3('0x38')]=_0x429ae3[_0x32e3('0x38')]['length']?_0x429ae3[_0x32e3('0x38')]:_0x7d7928[_0x32e3('0x33')];if(_0xeb7c5d[_0x32e3('0x35')]['includeAll']){_0x429ae3[_0x32e3('0x4a')]=[{'all':!![]}];}_0x429ae3=_['merge']({},_0x429ae3,_0xeb7c5d[_0x32e3('0x43')]);return db[_0x32e3('0x2e')][_0x32e3('0x4b')](_0x429ae3)['then'](handleEntityNotFound(_0x1a82a0,null))[_0x32e3('0x25')](respondWithResult(_0x1a82a0,null))[_0x32e3('0x4c')](handleError(_0x1a82a0,null));};exports['update']=function(_0x374ed7,_0x47a63c){if(_0x374ed7['body']['id']){delete _0x374ed7[_0x32e3('0x4d')]['id'];}return db[_0x32e3('0x2e')][_0x32e3('0x4b')]({'where':{'id':_0x374ed7['params']['id']}})['then'](handleEntityNotFound(_0x47a63c,null))[_0x32e3('0x25')](saveUpdates(_0x374ed7[_0x32e3('0x4d')],null))[_0x32e3('0x25')](respondWithResult(_0x47a63c,null))[_0x32e3('0x4c')](handleError(_0x47a63c,null));};exports[_0x32e3('0x24')]=function(_0x146afd,_0x7a5d3c){return db[_0x32e3('0x2e')][_0x32e3('0x4b')]({'where':{'id':_0x146afd[_0x32e3('0x49')]['id']}})[_0x32e3('0x25')](handleEntityNotFound(_0x7a5d3c,null))[_0x32e3('0x25')](removeEntity(_0x7a5d3c,null))[_0x32e3('0x4c')](handleError(_0x7a5d3c,null));};exports[_0x32e3('0x4e')]=function(_0x2c864b,_0x468d83){var _0x1d4b9c={'key':_0x2c864b[_0x32e3('0x4d')][_0x32e3('0x32')]};if(_0x2c864b['body']['MailAccountId']){_0x1d4b9c[_0x32e3('0x4f')]=_0x2c864b[_0x32e3('0x4d')][_0x32e3('0x4f')];}else if(_0x2c864b[_0x32e3('0x4d')][_0x32e3('0x50')]){_0x1d4b9c[_0x32e3('0x50')]=_0x2c864b[_0x32e3('0x4d')][_0x32e3('0x50')];}else if(_0x2c864b[_0x32e3('0x4d')]['OpenchannelAccountId']){_0x1d4b9c[_0x32e3('0x51')]=_0x2c864b[_0x32e3('0x4d')][_0x32e3('0x51')];}else if(_0x2c864b['body'][_0x32e3('0x52')]){_0x1d4b9c['ChatWebsiteId']=_0x2c864b[_0x32e3('0x4d')][_0x32e3('0x52')];}return db['CannedAnswer']['find']({'where':_0x1d4b9c})[_0x32e3('0x25')](function(_0xeedfca){if(_0xeedfca){throw new db['Sequelize'][(_0x32e3('0x53'))](_0x32e3('0x54'));}return db[_0x32e3('0x2e')]['create'](_0x2c864b[_0x32e3('0x4d')]);})[_0x32e3('0x25')](function(_0x5f047e){var _0x32a586=_0x2c864b[_0x32e3('0x55')]['get']({'plain':!![]});if(!_0x32a586)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32a586['role']===_0x32e3('0x55')){var _0x4e39e9=_0x5f047e[_0x32e3('0x26')]({'plain':!![]});return db[_0x32e3('0x56')][_0x32e3('0x4b')]({'where':{'name':_0x32e3('0x27'),'userProfileId':_0x32a586['userProfileId']},'raw':!![]})[_0x32e3('0x25')](function(_0x1b15e8){if(_0x1b15e8&&_0x1b15e8['autoAssociation']===0x0){return db[_0x32e3('0x28')][_0x32e3('0x4e')]({'name':_0x4e39e9[_0x32e3('0x2a')],'resourceId':_0x4e39e9['id'],'type':_0x1b15e8[_0x32e3('0x2a')],'sectionId':_0x1b15e8['id']},{})[_0x32e3('0x25')](function(){return _0x5f047e;});}else{return _0x5f047e;}})[_0x32e3('0x4c')](function(_0x4ed7aa){logger[_0x32e3('0x29')](_0x32e3('0x57'),_0x4ed7aa);throw _0x4ed7aa;});}return _0x5f047e;})['then'](respondWithResult(_0x468d83,0xc9))['catch'](handleError(_0x468d83,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 4158db8..433f302 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 _0x9972=['utf8mb4_unicode_ci','util','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9972,0xeb));var _0x2997=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9972[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x2997('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2997('0x1'));var BPromise=require('bluebird');var rp=require(_0x2997('0x2'));var fs=require('fs');var path=require(_0x2997('0x3'));var rimraf=require(_0x2997('0x4'));var config=require(_0x2997('0x5'));var attributes=require(_0x2997('0x6'));module[_0x2997('0x7')]=function(_0x2f11b7,_0x259004){return _0x2f11b7[_0x2997('0x8')](_0x2997('0x9'),attributes,{'tableName':_0x2997('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2997('0xb'),'collate':_0x2997('0xc')});}; \ No newline at end of file +var _0xbc0a=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util'];(function(_0x16a39e,_0x461134){var _0x42eceb=function(_0x4ee3a0){while(--_0x4ee3a0){_0x16a39e['push'](_0x16a39e['shift']());}};_0x42eceb(++_0x461134);}(_0xbc0a,0xdb));var _0xabc0=function(_0x5c463b,_0x5e3387){_0x5c463b=_0x5c463b-0x0;var _0x3c696b=_0xbc0a[_0x5c463b];return _0x3c696b;};'use strict';var _=require(_0xabc0('0x0'));var util=require(_0xabc0('0x1'));var logger=require(_0xabc0('0x2'))(_0xabc0('0x3'));var moment=require(_0xabc0('0x4'));var BPromise=require(_0xabc0('0x5'));var rp=require(_0xabc0('0x6'));var fs=require('fs');var path=require(_0xabc0('0x7'));var rimraf=require('rimraf');var config=require(_0xabc0('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0xabc0('0x9')]=function(_0x198f4a,_0x1e2109){return _0x198f4a['define'](_0xabc0('0xa'),attributes,{'tableName':_0xabc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabc0('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index a7d9ab7..95f82f4 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(_0x33ccac,_0x486126){var _0x1a103f=function(_0x1fc991){while(--_0x1fc991){_0x33ccac['push'](_0x33ccac['shift']());}};_0x1a103f(++_0x486126);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x45c35a,_0x4dd1d3){var _0x257ebb=function(_0x537487){while(--_0x537487){_0x45c35a['push'](_0x45c35a['shift']());}};_0x257ebb(++_0x4dd1d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 695cea9..9c83ad0 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 _0x7345=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x519f0f,_0x33b0a3){var _0x4d3020=function(_0x4eb891){while(--_0x4eb891){_0x519f0f['push'](_0x519f0f['shift']());}};_0x4d3020(++_0x33b0a3);}(_0x7345,0xfd));var _0x5734=function(_0x5a7818,_0x5a5bc9){_0x5a7818=_0x5a7818-0x0;var _0x4e37ae=_0x7345[_0x5a7818];return _0x4e37ae;};'use strict';var multer=require(_0x5734('0x0'));var util=require(_0x5734('0x1'));var path=require('path');var timeout=require(_0x5734('0x2'));var express=require(_0x5734('0x3'));var router=express['Router']();var fs_extra=require(_0x5734('0x4'));var auth=require(_0x5734('0x5'));var interaction=require(_0x5734('0x6'));var config=require('../../config/environment');var controller=require(_0x5734('0x7'));router[_0x5734('0x8')]('/',auth[_0x5734('0x9')](),controller['index']);router['get'](_0x5734('0xa'),auth[_0x5734('0x9')](),controller['show']);router[_0x5734('0xb')]('/',auth[_0x5734('0x9')](),controller[_0x5734('0xc')]);router[_0x5734('0xd')](_0x5734('0xa'),auth[_0x5734('0x9')](),controller[_0x5734('0xe')]);router['delete'](_0x5734('0xa'),auth[_0x5734('0x9')](),controller[_0x5734('0xf')]);module[_0x5734('0x10')]=router; \ No newline at end of file +var _0xc392=['post','create','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xc392,0x198));var _0x2c39=function(_0x56bf15,_0x5cb0df){_0x56bf15=_0x56bf15-0x0;var _0x291bd5=_0xc392[_0x56bf15];return _0x291bd5;};'use strict';var multer=require(_0x2c39('0x0'));var util=require('util');var path=require(_0x2c39('0x1'));var timeout=require(_0x2c39('0x2'));var express=require(_0x2c39('0x3'));var router=express[_0x2c39('0x4')]();var fs_extra=require(_0x2c39('0x5'));var auth=require(_0x2c39('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2c39('0x7'));var controller=require('./cannedAnswer.controller');router[_0x2c39('0x8')]('/',auth[_0x2c39('0x9')](),controller[_0x2c39('0xa')]);router[_0x2c39('0x8')](_0x2c39('0xb'),auth[_0x2c39('0x9')](),controller['show']);router[_0x2c39('0xc')]('/',auth['isAuthenticated'](),controller[_0x2c39('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2c39('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 93a95c1..9368cd2 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 _0x0971=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x1dcbc6,_0x219d61){var _0x1a0893=function(_0x4fe96a){while(--_0x4fe96a){_0x1dcbc6['push'](_0x1dcbc6['shift']());}};_0x1a0893(++_0x219d61);}(_0x0971,0xc3));var _0x1097=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x0971[_0x241424];return _0x3da798;};'use strict';var Sequelize=require(_0x1097('0x0'));module[_0x1097('0x1')]={'calldate':{'type':Sequelize[_0x1097('0x2')],'allowNull':![],'defaultValue':_0x1097('0x3')},'clid':{'type':Sequelize[_0x1097('0x4')]},'src':{'type':Sequelize[_0x1097('0x4')]},'dst':{'type':Sequelize[_0x1097('0x4')]},'dcontext':{'type':Sequelize[_0x1097('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x1097('0x4')]},'lastdata':{'type':Sequelize[_0x1097('0x4')]},'duration':{'type':Sequelize[_0x1097('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1097('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1097('0x4')]},'amaflags':{'type':Sequelize[_0x1097('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1097('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1097('0x4')]},'linkedid':{'type':Sequelize[_0x1097('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x1097('0x4')]},'type':{'type':Sequelize[_0x1097('0x4')]},'tag':{'type':Sequelize[_0x1097('0x4')]}}; \ No newline at end of file +var _0xa1b9=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xa1b9,0x71));var _0x9a1b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa1b9[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x9a1b('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x9a1b('0x1')],'allowNull':![],'defaultValue':_0x9a1b('0x2')},'clid':{'type':Sequelize[_0x9a1b('0x3')]},'src':{'type':Sequelize[_0x9a1b('0x3')]},'dst':{'type':Sequelize[_0x9a1b('0x3')]},'dcontext':{'type':Sequelize[_0x9a1b('0x3')]},'channel':{'type':Sequelize[_0x9a1b('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x9a1b('0x3')]},'lastdata':{'type':Sequelize[_0x9a1b('0x3')]},'duration':{'type':Sequelize[_0x9a1b('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9a1b('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9a1b('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9a1b('0x3')]},'uniqueid':{'type':Sequelize[_0x9a1b('0x3')]},'linkedid':{'type':Sequelize[_0x9a1b('0x3')]},'sequence':{'type':Sequelize[_0x9a1b('0x3')]},'peeraccount':{'type':Sequelize[_0x9a1b('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9a1b('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7725377..968b2de 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 _0xe0c3=['request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','Cdr','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x22e4f9,_0x56e213){var _0x2eac12=function(_0x12fe10){while(--_0x12fe10){_0x22e4f9['push'](_0x22e4f9['shift']());}};_0x2eac12(++_0x56e213);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3e0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e0c('0x1'));var jsonpatch=require(_0x3e0c('0x2'));var rp=require(_0x3e0c('0x3'));var moment=require(_0x3e0c('0x4'));var BPromise=require(_0x3e0c('0x5'));var Mustache=require(_0x3e0c('0x6'));var util=require(_0x3e0c('0x7'));var path=require(_0x3e0c('0x8'));var sox=require(_0x3e0c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e0c('0xa'));var _=require(_0x3e0c('0xb'));var squel=require(_0x3e0c('0xc'));var crypto=require(_0x3e0c('0xd'));var jsforce=require(_0x3e0c('0xe'));var deskjs=require(_0x3e0c('0xf'));var toCsv=require(_0x3e0c('0x10'));var querystring=require(_0x3e0c('0x11'));var Papa=require(_0x3e0c('0x12'));var Redis=require(_0x3e0c('0x13'));var authService=require(_0x3e0c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e0c('0x15'));var logger=require(_0x3e0c('0x16'))(_0x3e0c('0x17'));var utils=require(_0x3e0c('0x18'));var config=require(_0x3e0c('0x19'));var licenseUtil=require(_0x3e0c('0x1a'));var db=require(_0x3e0c('0x1b'))['db'];function respondWithStatusCode(_0x5dc732,_0x38b416){_0x38b416=_0x38b416||0xcc;return function(_0x491432){if(_0x491432){return _0x5dc732[_0x3e0c('0x1c')](_0x38b416);}return _0x5dc732[_0x3e0c('0x1d')](_0x38b416)['end']();};}function respondWithResult(_0x5f2654,_0x6d9c61){_0x6d9c61=_0x6d9c61||0xc8;return function(_0x409b2c){if(_0x409b2c){return _0x5f2654[_0x3e0c('0x1d')](_0x6d9c61)[_0x3e0c('0x1e')](_0x409b2c);}};}function respondWithFilteredResult(_0x15a269,_0x24fcf9){return function(_0x1947c2){if(_0x1947c2){var _0x274d75=typeof _0x24fcf9[_0x3e0c('0x1f')]===_0x3e0c('0x20')&&typeof _0x24fcf9[_0x3e0c('0x21')]==='undefined';var _0x58c498=_0x1947c2[_0x3e0c('0x22')];var _0x216993=_0x274d75?0x0:_0x24fcf9[_0x3e0c('0x1f')];var _0x41b19f=_0x274d75?_0x1947c2[_0x3e0c('0x22')]:_0x24fcf9[_0x3e0c('0x1f')]+_0x24fcf9['limit'];var _0x2e4a4a;if(_0x41b19f>=_0x58c498){_0x41b19f=_0x58c498;_0x2e4a4a=0xc8;}else{_0x2e4a4a=0xce;}_0x15a269[_0x3e0c('0x1d')](_0x2e4a4a);return _0x15a269[_0x3e0c('0x23')]('Content-Range',_0x216993+'-'+_0x41b19f+'/'+_0x58c498)[_0x3e0c('0x1e')](_0x1947c2);}return null;};}function patchUpdates(_0x5e3a93){return function(_0x479265){try{jsonpatch[_0x3e0c('0x24')](_0x479265,_0x5e3a93,!![]);}catch(_0x1f3bad){return BPromise[_0x3e0c('0x25')](_0x1f3bad);}return _0x479265[_0x3e0c('0x26')]();};}function saveUpdates(_0x4f8d38,_0x4cd447){return function(_0x3320c6){if(_0x3320c6){return _0x3320c6['update'](_0x4f8d38)['then'](function(_0x3fd7de){return _0x3fd7de;});}return null;};}function removeEntity(_0x1769b1,_0x44ce68){return function(_0x5bb7aa){if(_0x5bb7aa){return _0x5bb7aa[_0x3e0c('0x27')]()[_0x3e0c('0x28')](function(){_0x1769b1['status'](0xcc)[_0x3e0c('0x29')]();});}};}function handleEntityNotFound(_0x3de58b,_0x308fd5){return function(_0x1db945){if(!_0x1db945){_0x3de58b['sendStatus'](0x194);}return _0x1db945;};}function handleError(_0x412960,_0xc2f3cc){_0xc2f3cc=_0xc2f3cc||0x1f4;return function(_0x2c5fba){logger[_0x3e0c('0x2a')](_0x2c5fba['stack']);if(_0x2c5fba[_0x3e0c('0x2b')]){delete _0x2c5fba['name'];}_0x412960['status'](_0xc2f3cc)[_0x3e0c('0x2c')](_0x2c5fba);};}exports[_0x3e0c('0x2d')]=function(_0x4d3ce2,_0x16fb92){var _0x3f22b1={},_0x21d7a0={},_0x59c22f={'count':0x0,'rows':[]};var _0x44ecad=_[_0x3e0c('0x2e')](db['Cdr'][_0x3e0c('0x2f')],function(_0x2f31ad){return{'name':_0x2f31ad[_0x3e0c('0x30')],'type':_0x2f31ad[_0x3e0c('0x31')]['key']};});_0x21d7a0[_0x3e0c('0x32')]=_[_0x3e0c('0x2e')](_0x44ecad,_0x3e0c('0x2b'));_0x21d7a0['query']=_[_0x3e0c('0x33')](_0x4d3ce2[_0x3e0c('0x34')]);_0x21d7a0[_0x3e0c('0x35')]=_['intersection'](_0x21d7a0[_0x3e0c('0x32')],_0x21d7a0[_0x3e0c('0x34')]);_0x3f22b1[_0x3e0c('0x36')]=_[_0x3e0c('0x37')](_0x21d7a0[_0x3e0c('0x32')],qs[_0x3e0c('0x38')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x38')]));_0x3f22b1[_0x3e0c('0x36')]=_0x3f22b1[_0x3e0c('0x36')][_0x3e0c('0x39')]?_0x3f22b1[_0x3e0c('0x36')]:_0x21d7a0[_0x3e0c('0x32')];if(!_0x4d3ce2[_0x3e0c('0x34')]['hasOwnProperty'](_0x3e0c('0x3a'))){_0x3f22b1[_0x3e0c('0x21')]=qs[_0x3e0c('0x21')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x21')]);_0x3f22b1[_0x3e0c('0x1f')]=qs[_0x3e0c('0x1f')](_0x4d3ce2[_0x3e0c('0x34')]['offset']);}_0x3f22b1['order']=qs[_0x3e0c('0x3b')](_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x3b')]);_0x3f22b1[_0x3e0c('0x3c')]=qs[_0x3e0c('0x35')](_[_0x3e0c('0x3d')](_0x4d3ce2['query'],_0x21d7a0[_0x3e0c('0x35')]),_0x44ecad);if(_0x4d3ce2[_0x3e0c('0x34')]['filter']){_0x3f22b1['where']=_['merge'](_0x3f22b1[_0x3e0c('0x3c')],{'$or':_[_0x3e0c('0x2e')](_0x44ecad,function(_0x3d6ed7){if(_0x3d6ed7[_0x3e0c('0x31')]!==_0x3e0c('0x3e')){var _0x45ec69={};_0x45ec69[_0x3d6ed7[_0x3e0c('0x2b')]]={'$like':'%'+_0x4d3ce2[_0x3e0c('0x34')][_0x3e0c('0x3f')]+'%'};return _0x45ec69;}})});}_0x3f22b1=_[_0x3e0c('0x40')]({},_0x3f22b1,_0x4d3ce2[_0x3e0c('0x41')]);var _0x20135d={'where':_0x3f22b1['where']};return db['Cdr']['count'](_0x20135d)[_0x3e0c('0x28')](function(_0x22fcd8){_0x59c22f['count']=_0x22fcd8;if(_0x4d3ce2['query'][_0x3e0c('0x42')]){_0x3f22b1[_0x3e0c('0x43')]=[{'all':!![]}];}return db[_0x3e0c('0x44')][_0x3e0c('0x45')](_0x3f22b1);})['then'](function(_0x2e562f){_0x59c22f[_0x3e0c('0x46')]=_0x2e562f;return _0x59c22f;})[_0x3e0c('0x28')](respondWithFilteredResult(_0x16fb92,_0x3f22b1))[_0x3e0c('0x47')](handleError(_0x16fb92,null));};exports[_0x3e0c('0x48')]=function(_0x4b5638,_0x1bc4b3){var _0x5f4274={'raw':!![],'where':{'id':_0x4b5638[_0x3e0c('0x49')]['id']}},_0x35111f={};_0x35111f['model']=_['keys'](db[_0x3e0c('0x44')][_0x3e0c('0x2f')]);_0x35111f['query']=_[_0x3e0c('0x33')](_0x4b5638[_0x3e0c('0x34')]);_0x35111f[_0x3e0c('0x35')]=_[_0x3e0c('0x37')](_0x35111f[_0x3e0c('0x32')],_0x35111f[_0x3e0c('0x34')]);_0x5f4274['attributes']=_[_0x3e0c('0x37')](_0x35111f[_0x3e0c('0x32')],qs[_0x3e0c('0x38')](_0x4b5638[_0x3e0c('0x34')][_0x3e0c('0x38')]));_0x5f4274[_0x3e0c('0x36')]=_0x5f4274['attributes'][_0x3e0c('0x39')]?_0x5f4274[_0x3e0c('0x36')]:_0x35111f[_0x3e0c('0x32')];if(_0x4b5638['query'][_0x3e0c('0x42')]){_0x5f4274[_0x3e0c('0x43')]=[{'all':!![]}];}_0x5f4274=_['merge']({},_0x5f4274,_0x4b5638[_0x3e0c('0x41')]);return db[_0x3e0c('0x44')][_0x3e0c('0x4a')](_0x5f4274)['then'](handleEntityNotFound(_0x1bc4b3,null))[_0x3e0c('0x28')](respondWithResult(_0x1bc4b3,null))[_0x3e0c('0x47')](handleError(_0x1bc4b3,null));};exports[_0x3e0c('0x4b')]=function(_0x2c7b8c,_0x109078){return db[_0x3e0c('0x44')][_0x3e0c('0x4b')](_0x2c7b8c[_0x3e0c('0x4c')],{})[_0x3e0c('0x28')](respondWithResult(_0x109078,0xc9))[_0x3e0c('0x47')](handleError(_0x109078,null));};exports[_0x3e0c('0x4d')]=function(_0x4efbf2,_0x20c9df){if(_0x4efbf2['body']['id']){delete _0x4efbf2['body']['id'];}return db[_0x3e0c('0x44')]['find']({'where':{'id':_0x4efbf2[_0x3e0c('0x49')]['id']}})[_0x3e0c('0x28')](handleEntityNotFound(_0x20c9df,null))['then'](saveUpdates(_0x4efbf2[_0x3e0c('0x4c')],null))[_0x3e0c('0x28')](respondWithResult(_0x20c9df,null))['catch'](handleError(_0x20c9df,null));};exports[_0x3e0c('0x27')]=function(_0x3e04c9,_0x166203){return db[_0x3e0c('0x44')][_0x3e0c('0x4a')]({'where':{'id':_0x3e04c9[_0x3e0c('0x49')]['id']}})[_0x3e0c('0x28')](handleEntityNotFound(_0x166203,null))[_0x3e0c('0x28')](removeEntity(_0x166203,null))[_0x3e0c('0x47')](handleError(_0x166203,null));};exports[_0x3e0c('0x4e')]=function(_0x4d0f77,_0x3743ae){return db[_0x3e0c('0x44')][_0x3e0c('0x4e')]()[_0x3e0c('0x28')](respondWithResult(_0x3743ae,null))[_0x3e0c('0x47')](handleError(_0x3743ae,null));}; \ No newline at end of file +var _0x8375=['attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','destroy','then','error','stack','name','send','map','Cdr','fieldName','type','model','query','keys'];(function(_0x5a91d9,_0x47cedb){var _0x5275e2=function(_0x15de79){while(--_0x15de79){_0x5a91d9['push'](_0x5a91d9['shift']());}};_0x5275e2(++_0x47cedb);}(_0x8375,0xa8));var _0x5837=function(_0x510821,_0x584445){_0x510821=_0x510821-0x0;var _0x2e31a7=_0x8375[_0x510821];return _0x2e31a7;};'use strict';var emlformat=require(_0x5837('0x0'));var rimraf=require(_0x5837('0x1'));var zipdir=require(_0x5837('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require(_0x5837('0x6'));var util=require(_0x5837('0x7'));var path=require(_0x5837('0x8'));var sox=require('sox');var csv=require(_0x5837('0x9'));var ejs=require(_0x5837('0xa'));var fs=require('fs');var fs_extra=require(_0x5837('0xb'));var _=require(_0x5837('0xc'));var squel=require(_0x5837('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x9'));var querystring=require('querystring');var Papa=require(_0x5837('0xf'));var Redis=require('ioredis');var authService=require(_0x5837('0x10'));var qs=require(_0x5837('0x11'));var as=require(_0x5837('0x12'));var hardwareService=require(_0x5837('0x13'));var logger=require(_0x5837('0x14'))(_0x5837('0x15'));var utils=require('../../config/utils');var config=require(_0x5837('0x16'));var licenseUtil=require(_0x5837('0x17'));var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x10c1a1,_0x143210){_0x143210=_0x143210||0xcc;return function(_0x485366){if(_0x485366){return _0x10c1a1['sendStatus'](_0x143210);}return _0x10c1a1['status'](_0x143210)[_0x5837('0x19')]();};}function respondWithResult(_0x111dbf,_0x469903){_0x469903=_0x469903||0xc8;return function(_0xa5718d){if(_0xa5718d){return _0x111dbf[_0x5837('0x1a')](_0x469903)[_0x5837('0x1b')](_0xa5718d);}};}function respondWithFilteredResult(_0x206f02,_0x754f39){return function(_0x10d882){if(_0x10d882){var _0x59a378=typeof _0x754f39[_0x5837('0x1c')]===_0x5837('0x1d')&&typeof _0x754f39['limit']===_0x5837('0x1d');var _0x2297b4=_0x10d882[_0x5837('0x1e')];var _0x49279d=_0x59a378?0x0:_0x754f39['offset'];var _0x4bee08=_0x59a378?_0x10d882[_0x5837('0x1e')]:_0x754f39[_0x5837('0x1c')]+_0x754f39[_0x5837('0x1f')];var _0x58e7f7;if(_0x4bee08>=_0x2297b4){_0x4bee08=_0x2297b4;_0x58e7f7=0xc8;}else{_0x58e7f7=0xce;}_0x206f02[_0x5837('0x1a')](_0x58e7f7);return _0x206f02[_0x5837('0x20')](_0x5837('0x21'),_0x49279d+'-'+_0x4bee08+'/'+_0x2297b4)[_0x5837('0x1b')](_0x10d882);}return null;};}function patchUpdates(_0x5881ff){return function(_0x4908c2){try{jsonpatch['apply'](_0x4908c2,_0x5881ff,!![]);}catch(_0x3d352f){return BPromise['reject'](_0x3d352f);}return _0x4908c2[_0x5837('0x22')]();};}function saveUpdates(_0x2bd103,_0x32733a){return function(_0x3a7efe){if(_0x3a7efe){return _0x3a7efe['update'](_0x2bd103)['then'](function(_0x1b80db){return _0x1b80db;});}return null;};}function removeEntity(_0x2262b9,_0x406506){return function(_0x5e8089){if(_0x5e8089){return _0x5e8089[_0x5837('0x23')]()[_0x5837('0x24')](function(){_0x2262b9[_0x5837('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41f86a,_0x2646ed){return function(_0x39babd){if(!_0x39babd){_0x41f86a['sendStatus'](0x194);}return _0x39babd;};}function handleError(_0x57baed,_0x1d545c){_0x1d545c=_0x1d545c||0x1f4;return function(_0x15655e){logger[_0x5837('0x25')](_0x15655e[_0x5837('0x26')]);if(_0x15655e[_0x5837('0x27')]){delete _0x15655e[_0x5837('0x27')];}_0x57baed[_0x5837('0x1a')](_0x1d545c)[_0x5837('0x28')](_0x15655e);};}exports['index']=function(_0x2f0c8d,_0x13830f){var _0x3cbd3f={},_0x3918ee={},_0x1c9f32={'count':0x0,'rows':[]};var _0x228f1=_[_0x5837('0x29')](db[_0x5837('0x2a')]['rawAttributes'],function(_0x4f7502){return{'name':_0x4f7502[_0x5837('0x2b')],'type':_0x4f7502[_0x5837('0x2c')]['key']};});_0x3918ee[_0x5837('0x2d')]=_[_0x5837('0x29')](_0x228f1,'name');_0x3918ee[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x2f0c8d[_0x5837('0x2e')]);_0x3918ee['filters']=_['intersection'](_0x3918ee['model'],_0x3918ee[_0x5837('0x2e')]);_0x3cbd3f[_0x5837('0x30')]=_[_0x5837('0x31')](_0x3918ee[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x2f0c8d['query']['fields']));_0x3cbd3f[_0x5837('0x30')]=_0x3cbd3f[_0x5837('0x30')]['length']?_0x3cbd3f['attributes']:_0x3918ee[_0x5837('0x2d')];if(!_0x2f0c8d['query']['hasOwnProperty'](_0x5837('0x33'))){_0x3cbd3f[_0x5837('0x1f')]=qs['limit'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1f')]);_0x3cbd3f[_0x5837('0x1c')]=qs['offset'](_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x1c')]);}_0x3cbd3f[_0x5837('0x34')]=qs[_0x5837('0x35')](_0x2f0c8d[_0x5837('0x2e')]['sort']);_0x3cbd3f[_0x5837('0x36')]=qs['filters'](_['pick'](_0x2f0c8d[_0x5837('0x2e')],_0x3918ee[_0x5837('0x37')]),_0x228f1);if(_0x2f0c8d['query'][_0x5837('0x38')]){_0x3cbd3f[_0x5837('0x36')]=_[_0x5837('0x39')](_0x3cbd3f[_0x5837('0x36')],{'$or':_['map'](_0x228f1,function(_0x2ed688){if(_0x2ed688[_0x5837('0x2c')]!==_0x5837('0x3a')){var _0x5dcd18={};_0x5dcd18[_0x2ed688[_0x5837('0x27')]]={'$like':'%'+_0x2f0c8d[_0x5837('0x2e')][_0x5837('0x38')]+'%'};return _0x5dcd18;}})});}_0x3cbd3f=_[_0x5837('0x39')]({},_0x3cbd3f,_0x2f0c8d[_0x5837('0x3b')]);var _0x76f00d={'where':_0x3cbd3f[_0x5837('0x36')]};return db[_0x5837('0x2a')][_0x5837('0x1e')](_0x76f00d)[_0x5837('0x24')](function(_0x1a5e2d){_0x1c9f32[_0x5837('0x1e')]=_0x1a5e2d;if(_0x2f0c8d['query']['includeAll']){_0x3cbd3f[_0x5837('0x3c')]=[{'all':!![]}];}return db[_0x5837('0x2a')]['findAll'](_0x3cbd3f);})[_0x5837('0x24')](function(_0x1ae168){_0x1c9f32[_0x5837('0x3d')]=_0x1ae168;return _0x1c9f32;})['then'](respondWithFilteredResult(_0x13830f,_0x3cbd3f))[_0x5837('0x3e')](handleError(_0x13830f,null));};exports[_0x5837('0x3f')]=function(_0x1c81ed,_0x3acdf5){var _0x4643e3={'raw':!![],'where':{'id':_0x1c81ed[_0x5837('0x40')]['id']}},_0xd443be={};_0xd443be[_0x5837('0x2d')]=_[_0x5837('0x2f')](db['Cdr'][_0x5837('0x41')]);_0xd443be[_0x5837('0x2e')]=_[_0x5837('0x2f')](_0x1c81ed['query']);_0xd443be['filters']=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],_0xd443be[_0x5837('0x2e')]);_0x4643e3[_0x5837('0x30')]=_[_0x5837('0x31')](_0xd443be[_0x5837('0x2d')],qs[_0x5837('0x32')](_0x1c81ed[_0x5837('0x2e')][_0x5837('0x32')]));_0x4643e3[_0x5837('0x30')]=_0x4643e3[_0x5837('0x30')][_0x5837('0x42')]?_0x4643e3['attributes']:_0xd443be[_0x5837('0x2d')];if(_0x1c81ed['query'][_0x5837('0x43')]){_0x4643e3[_0x5837('0x3c')]=[{'all':!![]}];}_0x4643e3=_['merge']({},_0x4643e3,_0x1c81ed[_0x5837('0x3b')]);return db[_0x5837('0x2a')]['find'](_0x4643e3)[_0x5837('0x24')](handleEntityNotFound(_0x3acdf5,null))[_0x5837('0x24')](respondWithResult(_0x3acdf5,null))[_0x5837('0x3e')](handleError(_0x3acdf5,null));};exports[_0x5837('0x44')]=function(_0x54a23b,_0x55cf2b){return db[_0x5837('0x2a')][_0x5837('0x44')](_0x54a23b['body'],{})['then'](respondWithResult(_0x55cf2b,0xc9))['catch'](handleError(_0x55cf2b,null));};exports['update']=function(_0x38e987,_0x6423f2){if(_0x38e987[_0x5837('0x45')]['id']){delete _0x38e987['body']['id'];}return db['Cdr'][_0x5837('0x46')]({'where':{'id':_0x38e987[_0x5837('0x40')]['id']}})[_0x5837('0x24')](handleEntityNotFound(_0x6423f2,null))[_0x5837('0x24')](saveUpdates(_0x38e987[_0x5837('0x45')],null))[_0x5837('0x24')](respondWithResult(_0x6423f2,null))[_0x5837('0x3e')](handleError(_0x6423f2,null));};exports[_0x5837('0x23')]=function(_0x27f7b9,_0x38743a){return db['Cdr'][_0x5837('0x46')]({'where':{'id':_0x27f7b9[_0x5837('0x40')]['id']}})['then'](handleEntityNotFound(_0x38743a,null))[_0x5837('0x24')](removeEntity(_0x38743a,null))[_0x5837('0x3e')](handleError(_0x38743a,null));};exports[_0x5837('0x47')]=function(_0x397cd9,_0x38e75d){return db['Cdr'][_0x5837('0x47')]()[_0x5837('0x24')](respondWithResult(_0x38e75d,null))[_0x5837('0x3e')](handleError(_0x38e75d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 34914b0..3bba3c3 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4994c8,_0x51445d){var _0x16d972=function(_0x10faf8){while(--_0x10faf8){_0x4994c8['push'](_0x4994c8['shift']());}};_0x16d972(++_0x51445d);}(_0x7a54,0x106));var _0x47a5=function(_0x1d36d5,_0x387beb){_0x1d36d5=_0x1d36d5-0x0;var _0x27db68=_0x7a54[_0x1d36d5];return _0x27db68;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1aa011,_0x16332d){var _0x4d66e4=function(_0x15a52b){while(--_0x15a52b){_0x1aa011['push'](_0x1aa011['shift']());}};_0x4d66e4(++_0x16332d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 4af2634..04141e7 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 _0x52ce=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x5a1dae,_0x266074){var _0x13334b=function(_0x74aff4){while(--_0x74aff4){_0x5a1dae['push'](_0x5a1dae['shift']());}};_0x13334b(++_0x266074);}(_0x52ce,0xb4));var _0xe52c=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x52ce[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0xe52c('0x0'));var util=require(_0xe52c('0x1'));var moment=require(_0xe52c('0x2'));var BPromise=require(_0xe52c('0x3'));var rs=require(_0xe52c('0x4'));var fs=require('fs');var Redis=require(_0xe52c('0x5'));var db=require(_0xe52c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe52c('0x7'));var config=require(_0xe52c('0x8'));var jayson=require(_0xe52c('0x9'));var client=jayson[_0xe52c('0xa')][_0xe52c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd941,_0x19e32e,_0x438b3){return new BPromise(function(_0x7a6e3a,_0x214a81){return client[_0xe52c('0xc')](_0x1bd941,_0x438b3)[_0xe52c('0xd')](function(_0x53180d){logger[_0xe52c('0xe')](_0xe52c('0xf'),_0x19e32e,_0xe52c('0x10'));logger[_0xe52c('0x11')]('Cdr,\x20%s,\x20%s,\x20%s',_0x19e32e,_0xe52c('0x10'),JSON[_0xe52c('0x12')](_0x53180d));if(_0x53180d[_0xe52c('0x13')]){if(_0x53180d[_0xe52c('0x13')][_0xe52c('0x14')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x19e32e,_0x53180d[_0xe52c('0x13')][_0xe52c('0x15')]);return _0x214a81(_0x53180d[_0xe52c('0x13')][_0xe52c('0x15')]);}logger[_0xe52c('0x13')](_0xe52c('0xf'),_0x19e32e,_0x53180d['error']['message']);return _0x7a6e3a(_0x53180d[_0xe52c('0x13')]['message']);}else{logger[_0xe52c('0xe')](_0xe52c('0xf'),_0x19e32e,_0xe52c('0x10'));_0x7a6e3a(_0x53180d[_0xe52c('0x16')][_0xe52c('0x15')]);}})['catch'](function(_0x5c8895){logger[_0xe52c('0x13')](_0xe52c('0xf'),_0x19e32e,_0x5c8895);_0x214a81(_0x5c8895);});});} \ No newline at end of file +var _0xc876=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x33dcfc,_0x3d18ef){var _0x341f7b=function(_0x3bf0ab){while(--_0x3bf0ab){_0x33dcfc['push'](_0x33dcfc['shift']());}};_0x341f7b(++_0x3d18ef);}(_0xc876,0x1b8));var _0x6c87=function(_0x36130a,_0x9336a0){_0x36130a=_0x36130a-0x0;var _0x5b9d43=_0xc876[_0x36130a];return _0x5b9d43;};'use strict';var _=require('lodash');var util=require(_0x6c87('0x0'));var moment=require(_0x6c87('0x1'));var BPromise=require(_0x6c87('0x2'));var rs=require(_0x6c87('0x3'));var fs=require('fs');var Redis=require(_0x6c87('0x4'));var db=require(_0x6c87('0x5'))['db'];var utils=require(_0x6c87('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6c87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57d8d9,_0x49af25,_0xd19cbf){return new BPromise(function(_0x2efdee,_0x5646fc){return client[_0x6c87('0x9')](_0x57d8d9,_0xd19cbf)['then'](function(_0x5e15c3){logger['info'](_0x6c87('0xa'),_0x49af25,_0x6c87('0xb'));logger['debug'](_0x6c87('0xc'),_0x49af25,_0x6c87('0xb'),JSON[_0x6c87('0xd')](_0x5e15c3));if(_0x5e15c3[_0x6c87('0xe')]){if(_0x5e15c3[_0x6c87('0xe')][_0x6c87('0xf')]===0x1f4){logger[_0x6c87('0xe')](_0x6c87('0xa'),_0x49af25,_0x5e15c3[_0x6c87('0xe')][_0x6c87('0x10')]);return _0x5646fc(_0x5e15c3[_0x6c87('0xe')][_0x6c87('0x10')]);}logger['error'](_0x6c87('0xa'),_0x49af25,_0x5e15c3[_0x6c87('0xe')][_0x6c87('0x10')]);return _0x2efdee(_0x5e15c3[_0x6c87('0xe')][_0x6c87('0x10')]);}else{logger['info'](_0x6c87('0xa'),_0x49af25,_0x6c87('0xb'));_0x2efdee(_0x5e15c3[_0x6c87('0x11')][_0x6c87('0x10')]);}})[_0x6c87('0x12')](function(_0x19f2a3){logger[_0x6c87('0xe')]('Cdr,\x20%s,\x20%s',_0x49af25,_0x19f2a3);_0x5646fc(_0x19f2a3);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e4f252c..ea004d0 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x4da7da,_0x17974b){var _0x30485d=function(_0x1d654e){while(--_0x1d654e){_0x4da7da['push'](_0x4da7da['shift']());}};_0x30485d(++_0x17974b);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 8c2ce3c..fc0428b 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 _0xd676=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x3360f3,_0x344f01){var _0x45e856=function(_0x588d0c){while(--_0x588d0c){_0x3360f3['push'](_0x3360f3['shift']());}};_0x45e856(++_0x344f01);}(_0xd676,0x1e6));var _0x6d67=function(_0x227fe7,_0x392329){_0x227fe7=_0x227fe7-0x0;var _0x4b98be=_0xd676[_0x227fe7];return _0x4b98be;};'use strict';var Sequelize=require(_0x6d67('0x0'));module[_0x6d67('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6d67('0x2')],'allowNull':![],'defaultValue':_0x6d67('0x3')},'appdata':{'type':Sequelize[_0x6d67('0x4')]()},'description':{'type':Sequelize[_0x6d67('0x2')]},'interval':{'type':Sequelize[_0x6d67('0x2')],'defaultValue':_0x6d67('0x5')}}; \ No newline at end of file +var _0xb900=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x195a38,_0x381837){var _0x2cb36d=function(_0x531c8b){while(--_0x531c8b){_0x195a38['push'](_0x195a38['shift']());}};_0x2cb36d(++_0x381837);}(_0xb900,0x18d));var _0x0b90=function(_0x58d0cc,_0x353a75){_0x58d0cc=_0x58d0cc-0x0;var _0x27ebde=_0xb900[_0x58d0cc];return _0x27ebde;};'use strict';var Sequelize=require(_0x0b90('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0b90('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0b90('0x2')],'allowNull':![],'defaultValue':_0x0b90('0x3')},'appdata':{'type':Sequelize[_0x0b90('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0b90('0x2')],'defaultValue':_0x0b90('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 0ff6b40..ea963ab 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 _0xee5b=['../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','includeAll','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xee5b,0x1f4));var _0xbee5=function(_0x288abe,_0x2feeb1){_0x288abe=_0x288abe-0x0;var _0x1e18f6=_0xee5b[_0x288abe];return _0x1e18f6;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];function respondWithStatusCode(_0xcef158,_0x48f771){_0x48f771=_0x48f771||0xcc;return function(_0x14e032){if(_0x14e032){return _0xcef158['sendStatus'](_0x48f771);}return _0xcef158[_0xbee5('0x17')](_0x48f771)[_0xbee5('0x18')]();};}function respondWithResult(_0x8a268f,_0x593ecb){_0x593ecb=_0x593ecb||0xc8;return function(_0x5092f2){if(_0x5092f2){return _0x8a268f[_0xbee5('0x17')](_0x593ecb)['json'](_0x5092f2);}};}function respondWithFilteredResult(_0x40afcb,_0x5426c9){return function(_0x1a24bd){if(_0x1a24bd){var _0x141878=typeof _0x5426c9[_0xbee5('0x19')]==='undefined'&&typeof _0x5426c9[_0xbee5('0x1a')]===_0xbee5('0x1b');var _0x5a0ae5=_0x1a24bd[_0xbee5('0x1c')];var _0x538460=_0x141878?0x0:_0x5426c9[_0xbee5('0x19')];var _0x3c3f4e=_0x141878?_0x1a24bd[_0xbee5('0x1c')]:_0x5426c9[_0xbee5('0x19')]+_0x5426c9[_0xbee5('0x1a')];var _0xa50ec9;if(_0x3c3f4e>=_0x5a0ae5){_0x3c3f4e=_0x5a0ae5;_0xa50ec9=0xc8;}else{_0xa50ec9=0xce;}_0x40afcb[_0xbee5('0x17')](_0xa50ec9);return _0x40afcb[_0xbee5('0x1d')](_0xbee5('0x1e'),_0x538460+'-'+_0x3c3f4e+'/'+_0x5a0ae5)[_0xbee5('0x1f')](_0x1a24bd);}return null;};}function patchUpdates(_0x35d7d3){return function(_0x40a06){try{jsonpatch[_0xbee5('0x20')](_0x40a06,_0x35d7d3,!![]);}catch(_0x47af8e){return BPromise['reject'](_0x47af8e);}return _0x40a06[_0xbee5('0x21')]();};}function saveUpdates(_0x48bfb5,_0x205491){return function(_0x117cb3){if(_0x117cb3){return _0x117cb3[_0xbee5('0x22')](_0x48bfb5)[_0xbee5('0x23')](function(_0x3f23c5){return _0x3f23c5;});}return null;};}function removeEntity(_0xb665df,_0x359ccf){return function(_0x3cfa8d){if(_0x3cfa8d){return _0x3cfa8d[_0xbee5('0x24')]()['then'](function(){_0xb665df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x519473,_0x50d774){return function(_0x1af3de){if(!_0x1af3de){_0x519473[_0xbee5('0x25')](0x194);}return _0x1af3de;};}function handleError(_0x3b84c8,_0x28c74d){_0x28c74d=_0x28c74d||0x1f4;return function(_0x169042){logger[_0xbee5('0x26')](_0x169042[_0xbee5('0x27')]);if(_0x169042['name']){delete _0x169042[_0xbee5('0x28')];}_0x3b84c8[_0xbee5('0x17')](_0x28c74d)[_0xbee5('0x29')](_0x169042);};}exports[_0xbee5('0x2a')]=function(_0x1a8bcc,_0x5f0419){var _0x21b993={'raw':!![],'where':{'id':_0x1a8bcc[_0xbee5('0x2b')]['id']}},_0x15ffb1={};_0x15ffb1[_0xbee5('0x2c')]=_[_0xbee5('0x2d')](db[_0xbee5('0x2e')][_0xbee5('0x2f')]);_0x15ffb1[_0xbee5('0x30')]=_[_0xbee5('0x2d')](_0x1a8bcc['query']);_0x15ffb1[_0xbee5('0x31')]=_['intersection'](_0x15ffb1[_0xbee5('0x2c')],_0x15ffb1['query']);_0x21b993[_0xbee5('0x32')]=_['intersection'](_0x15ffb1[_0xbee5('0x2c')],qs['fields'](_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x33')]));_0x21b993[_0xbee5('0x32')]=_0x21b993[_0xbee5('0x32')]['length']?_0x21b993[_0xbee5('0x32')]:_0x15ffb1[_0xbee5('0x2c')];if(_0x1a8bcc[_0xbee5('0x30')][_0xbee5('0x34')]){_0x21b993['include']=[{'all':!![]}];}_0x21b993=_[_0xbee5('0x35')]({},_0x21b993,_0x1a8bcc[_0xbee5('0x36')]);return db[_0xbee5('0x2e')][_0xbee5('0x37')](_0x21b993)['then'](handleEntityNotFound(_0x5f0419,null))[_0xbee5('0x23')](respondWithResult(_0x5f0419,null))[_0xbee5('0x38')](handleError(_0x5f0419,null));};exports[_0xbee5('0x22')]=function(_0x33aaba,_0x52ecf1){if(_0x33aaba[_0xbee5('0x39')]['id']){delete _0x33aaba['body']['id'];}return db[_0xbee5('0x2e')]['find']({'where':{'id':_0x33aaba['params']['id']}})['then'](handleEntityNotFound(_0x52ecf1,null))[_0xbee5('0x23')](saveUpdates(_0x33aaba[_0xbee5('0x39')],null))[_0xbee5('0x23')](respondWithResult(_0x52ecf1,null))[_0xbee5('0x38')](handleError(_0x52ecf1,null));};exports[_0xbee5('0x24')]=function(_0x2b83d5,_0x37dfd3){return db[_0xbee5('0x2e')]['find']({'where':{'id':_0x2b83d5[_0xbee5('0x2b')]['id']}})['then'](handleEntityNotFound(_0x37dfd3,null))[_0xbee5('0x23')](removeEntity(_0x37dfd3,null))[_0xbee5('0x38')](handleError(_0x37dfd3,null));}; \ No newline at end of file +var _0x0487=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','ChatApplication','rawAttributes','keys','intersection','query','attributes','model','fields','includeAll','merge','options','find','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4563ce,_0x23cd84){var _0x439e98=function(_0x202c89){while(--_0x202c89){_0x4563ce['push'](_0x4563ce['shift']());}};_0x439e98(++_0x23cd84);}(_0x0487,0x14f));var _0x7048=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x0487[_0x221ba2];return _0x47d08e;};'use strict';var emlformat=require(_0x7048('0x0'));var rimraf=require(_0x7048('0x1'));var zipdir=require(_0x7048('0x2'));var jsonpatch=require(_0x7048('0x3'));var rp=require(_0x7048('0x4'));var moment=require(_0x7048('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7048('0x6'));var util=require('util');var path=require(_0x7048('0x7'));var sox=require(_0x7048('0x8'));var csv=require(_0x7048('0x9'));var ejs=require(_0x7048('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7048('0xb'));var squel=require(_0x7048('0xc'));var crypto=require(_0x7048('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7048('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7048('0xf'));var Papa=require(_0x7048('0x10'));var Redis=require(_0x7048('0x11'));var authService=require(_0x7048('0x12'));var qs=require(_0x7048('0x13'));var as=require(_0x7048('0x14'));var hardwareService=require(_0x7048('0x15'));var logger=require('../../config/logger')(_0x7048('0x16'));var utils=require(_0x7048('0x17'));var config=require(_0x7048('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7048('0x19'))['db'];function respondWithStatusCode(_0x1ba215,_0x59542b){_0x59542b=_0x59542b||0xcc;return function(_0x116386){if(_0x116386){return _0x1ba215[_0x7048('0x1a')](_0x59542b);}return _0x1ba215[_0x7048('0x1b')](_0x59542b)[_0x7048('0x1c')]();};}function respondWithResult(_0xc9c508,_0x546c51){_0x546c51=_0x546c51||0xc8;return function(_0x1072d0){if(_0x1072d0){return _0xc9c508['status'](_0x546c51)[_0x7048('0x1d')](_0x1072d0);}};}function respondWithFilteredResult(_0x361cf8,_0x6a2a55){return function(_0x2b9800){if(_0x2b9800){var _0x4ec491=typeof _0x6a2a55[_0x7048('0x1e')]==='undefined'&&typeof _0x6a2a55[_0x7048('0x1f')]===_0x7048('0x20');var _0x4cff1c=_0x2b9800['count'];var _0x255d5d=_0x4ec491?0x0:_0x6a2a55[_0x7048('0x1e')];var _0x1db323=_0x4ec491?_0x2b9800[_0x7048('0x21')]:_0x6a2a55['offset']+_0x6a2a55[_0x7048('0x1f')];var _0x5b040b;if(_0x1db323>=_0x4cff1c){_0x1db323=_0x4cff1c;_0x5b040b=0xc8;}else{_0x5b040b=0xce;}_0x361cf8['status'](_0x5b040b);return _0x361cf8['set'](_0x7048('0x22'),_0x255d5d+'-'+_0x1db323+'/'+_0x4cff1c)[_0x7048('0x1d')](_0x2b9800);}return null;};}function patchUpdates(_0xa83230){return function(_0x4b9def){try{jsonpatch[_0x7048('0x23')](_0x4b9def,_0xa83230,!![]);}catch(_0x5de659){return BPromise[_0x7048('0x24')](_0x5de659);}return _0x4b9def['save']();};}function saveUpdates(_0x3d6ee7,_0x43a621){return function(_0x31c5dc){if(_0x31c5dc){return _0x31c5dc[_0x7048('0x25')](_0x3d6ee7)[_0x7048('0x26')](function(_0x171304){return _0x171304;});}return null;};}function removeEntity(_0x5a683d,_0x4c8709){return function(_0x519649){if(_0x519649){return _0x519649[_0x7048('0x27')]()['then'](function(){_0x5a683d[_0x7048('0x1b')](0xcc)[_0x7048('0x1c')]();});}};}function handleEntityNotFound(_0x3c7c96,_0x4fc143){return function(_0x1e0c61){if(!_0x1e0c61){_0x3c7c96['sendStatus'](0x194);}return _0x1e0c61;};}function handleError(_0x33a9f1,_0x4a0f3b){_0x4a0f3b=_0x4a0f3b||0x1f4;return function(_0xe3b552){logger[_0x7048('0x28')](_0xe3b552[_0x7048('0x29')]);if(_0xe3b552['name']){delete _0xe3b552[_0x7048('0x2a')];}_0x33a9f1['status'](_0x4a0f3b)[_0x7048('0x2b')](_0xe3b552);};}exports['show']=function(_0x228981,_0x5ee10a){var _0x30d90b={'raw':!![],'where':{'id':_0x228981['params']['id']}},_0x3ccc34={};_0x3ccc34['model']=_['keys'](db[_0x7048('0x2c')][_0x7048('0x2d')]);_0x3ccc34['query']=_[_0x7048('0x2e')](_0x228981['query']);_0x3ccc34['filters']=_[_0x7048('0x2f')](_0x3ccc34['model'],_0x3ccc34[_0x7048('0x30')]);_0x30d90b[_0x7048('0x31')]=_[_0x7048('0x2f')](_0x3ccc34[_0x7048('0x32')],qs[_0x7048('0x33')](_0x228981[_0x7048('0x30')][_0x7048('0x33')]));_0x30d90b[_0x7048('0x31')]=_0x30d90b[_0x7048('0x31')]['length']?_0x30d90b['attributes']:_0x3ccc34[_0x7048('0x32')];if(_0x228981[_0x7048('0x30')][_0x7048('0x34')]){_0x30d90b['include']=[{'all':!![]}];}_0x30d90b=_[_0x7048('0x35')]({},_0x30d90b,_0x228981[_0x7048('0x36')]);return db[_0x7048('0x2c')][_0x7048('0x37')](_0x30d90b)[_0x7048('0x26')](handleEntityNotFound(_0x5ee10a,null))[_0x7048('0x26')](respondWithResult(_0x5ee10a,null))[_0x7048('0x38')](handleError(_0x5ee10a,null));};exports[_0x7048('0x25')]=function(_0xdce055,_0x1251ae){if(_0xdce055[_0x7048('0x39')]['id']){delete _0xdce055['body']['id'];}return db['ChatApplication'][_0x7048('0x37')]({'where':{'id':_0xdce055['params']['id']}})[_0x7048('0x26')](handleEntityNotFound(_0x1251ae,null))['then'](saveUpdates(_0xdce055[_0x7048('0x39')],null))[_0x7048('0x26')](respondWithResult(_0x1251ae,null))[_0x7048('0x38')](handleError(_0x1251ae,null));};exports[_0x7048('0x27')]=function(_0x5ac439,_0x43a3d3){return db[_0x7048('0x2c')][_0x7048('0x37')]({'where':{'id':_0x5ac439[_0x7048('0x3a')]['id']}})['then'](handleEntityNotFound(_0x43a3d3,null))['then'](removeEntity(_0x43a3d3,null))[_0x7048('0x38')](handleError(_0x43a3d3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2bdbf19..aad26ea 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 _0xbada=['request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','util','../../config/logger','bluebird'];(function(_0x281ffb,_0x2c11a7){var _0x4b0b56=function(_0x135a07){while(--_0x135a07){_0x281ffb['push'](_0x281ffb['shift']());}};_0x4b0b56(++_0x2c11a7);}(_0xbada,0x190));var _0xabad=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xbada[_0xfa634c];return _0x73e478;};'use strict';var _=require('lodash');var util=require(_0xabad('0x0'));var logger=require(_0xabad('0x1'))('api');var moment=require('moment');var BPromise=require(_0xabad('0x2'));var rp=require(_0xabad('0x3'));var fs=require('fs');var path=require(_0xabad('0x4'));var rimraf=require(_0xabad('0x5'));var config=require(_0xabad('0x6'));var attributes=require(_0xabad('0x7'));module[_0xabad('0x8')]=function(_0x19a262,_0x2b5d62){return _0x19a262[_0xabad('0x9')](_0xabad('0xa'),attributes,{'tableName':_0xabad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabad('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5c73=['moment','bluebird','request-promise','path','rimraf','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x172a18,_0x4cba59){var _0x3770b6=function(_0x16113b){while(--_0x16113b){_0x172a18['push'](_0x172a18['shift']());}};_0x3770b6(++_0x4cba59);}(_0x5c73,0x135));var _0x35c7=function(_0x3e7bb6,_0x5aef30){_0x3e7bb6=_0x3e7bb6-0x0;var _0x57f939=_0x5c73[_0x3e7bb6];return _0x57f939;};'use strict';var _=require(_0x35c7('0x0'));var util=require('util');var logger=require(_0x35c7('0x1'))(_0x35c7('0x2'));var moment=require(_0x35c7('0x3'));var BPromise=require(_0x35c7('0x4'));var rp=require(_0x35c7('0x5'));var fs=require('fs');var path=require(_0x35c7('0x6'));var rimraf=require(_0x35c7('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x35c7('0x8')]=function(_0x56b5c0,_0x165030){return _0x56b5c0[_0x35c7('0x9')](_0x35c7('0xa'),attributes,{'tableName':_0x35c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x35c7('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 8b394a5..78ab439 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 _0x59a3=['result','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59a3,0x19f));var _0x359a=function(_0x275052,_0x198b39){_0x275052=_0x275052-0x0;var _0xc14d2e=_0x59a3[_0x275052];return _0xc14d2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x359a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x359a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x359a('0x2'));var logger=require('../../config/logger')(_0x359a('0x3'));var config=require(_0x359a('0x4'));var jayson=require(_0x359a('0x5'));var client=jayson['client'][_0x359a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4f1c18,_0xf83606,_0x1ee8b6){return new BPromise(function(_0xf387c8,_0x55a778){return client['request'](_0x4f1c18,_0x1ee8b6)[_0x359a('0x7')](function(_0x32aede){logger[_0x359a('0x8')](_0x359a('0x9'),_0xf83606,_0x359a('0xa'));logger[_0x359a('0xb')](_0x359a('0xc'),_0xf83606,_0x359a('0xa'),JSON[_0x359a('0xd')](_0x32aede));if(_0x32aede[_0x359a('0xe')]){if(_0x32aede[_0x359a('0xe')][_0x359a('0xf')]===0x1f4){logger['error'](_0x359a('0x9'),_0xf83606,_0x32aede[_0x359a('0xe')][_0x359a('0x10')]);return _0x55a778(_0x32aede[_0x359a('0xe')]['message']);}logger[_0x359a('0xe')](_0x359a('0x9'),_0xf83606,_0x32aede['error'][_0x359a('0x10')]);return _0xf387c8(_0x32aede[_0x359a('0xe')][_0x359a('0x10')]);}else{logger[_0x359a('0x8')](_0x359a('0x9'),_0xf83606,_0x359a('0xa'));_0xf387c8(_0x32aede[_0x359a('0x11')][_0x359a('0x10')]);}})['catch'](function(_0x55a845){logger[_0x359a('0xe')]('ChatApplication,\x20%s,\x20%s',_0xf83606,_0x55a845);_0x55a778(_0x55a845);});});} \ No newline at end of file +var _0x35ad=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x54aea3,_0xae7d81){var _0x21ae46=function(_0xe16dbc){while(--_0xe16dbc){_0x54aea3['push'](_0x54aea3['shift']());}};_0x21ae46(++_0xae7d81);}(_0x35ad,0x1b4));var _0xd35a=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x35ad[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xd35a('0x0'));var util=require(_0xd35a('0x1'));var moment=require(_0xd35a('0x2'));var BPromise=require(_0xd35a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd35a('0x4'));var db=require(_0xd35a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd35a('0x6'))(_0xd35a('0x7'));var config=require('../../config/environment');var jayson=require(_0xd35a('0x8'));var client=jayson[_0xd35a('0x9')][_0xd35a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f762,_0x32b2fb,_0xcbddab){return new BPromise(function(_0x582149,_0x4e178b){return client[_0xd35a('0xb')](_0xe5f762,_0xcbddab)[_0xd35a('0xc')](function(_0xc409fd){logger[_0xd35a('0xd')](_0xd35a('0xe'),_0x32b2fb,'request\x20sent');logger[_0xd35a('0xf')](_0xd35a('0x10'),_0x32b2fb,_0xd35a('0x11'),JSON[_0xd35a('0x12')](_0xc409fd));if(_0xc409fd[_0xd35a('0x13')]){if(_0xc409fd[_0xd35a('0x13')][_0xd35a('0x14')]===0x1f4){logger[_0xd35a('0x13')](_0xd35a('0xe'),_0x32b2fb,_0xc409fd[_0xd35a('0x13')][_0xd35a('0x15')]);return _0x4e178b(_0xc409fd[_0xd35a('0x13')][_0xd35a('0x15')]);}logger[_0xd35a('0x13')](_0xd35a('0xe'),_0x32b2fb,_0xc409fd[_0xd35a('0x13')]['message']);return _0x582149(_0xc409fd['error'][_0xd35a('0x15')]);}else{logger['info'](_0xd35a('0xe'),_0x32b2fb,_0xd35a('0x11'));_0x582149(_0xc409fd[_0xd35a('0x16')][_0xd35a('0x15')]);}})['catch'](function(_0x2d0018){logger['error'](_0xd35a('0xe'),_0x32b2fb,_0x2d0018);_0x4e178b(_0x2d0018);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 00e466b..6c6dcc6 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 _0xfc00=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','show','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4d10a0,_0x31bca3){var _0x2c45af=function(_0x33a7c4){while(--_0x33a7c4){_0x4d10a0['push'](_0x4d10a0['shift']());}};_0x2c45af(++_0x31bca3);}(_0xfc00,0x83));var _0x0fc0=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xfc00[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0fc0('0x0'));var util=require(_0x0fc0('0x1'));var path=require(_0x0fc0('0x2'));var timeout=require(_0x0fc0('0x3'));var express=require(_0x0fc0('0x4'));var router=express[_0x0fc0('0x5')]();var fs_extra=require(_0x0fc0('0x6'));var auth=require(_0x0fc0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0fc0('0x8'));var controller=require(_0x0fc0('0x9'));router[_0x0fc0('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0fc0('0xb')]);router['put'](_0x0fc0('0xc'),auth[_0x0fc0('0xd')](),controller[_0x0fc0('0xe')]);router['delete'](_0x0fc0('0xc'),auth['isAuthenticated'](),controller[_0x0fc0('0xf')]);module[_0x0fc0('0x10')]=router; \ No newline at end of file +var _0x9326=['delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x48eeab,_0xc3788){var _0x54f1eb=function(_0xcfc86a){while(--_0xcfc86a){_0x48eeab['push'](_0x48eeab['shift']());}};_0x54f1eb(++_0xc3788);}(_0x9326,0x167));var _0x6932=function(_0x50f112,_0xd38e53){_0x50f112=_0x50f112-0x0;var _0x4ecf28=_0x9326[_0x50f112];return _0x4ecf28;};'use strict';var multer=require('multer');var util=require(_0x6932('0x0'));var path=require(_0x6932('0x1'));var timeout=require(_0x6932('0x2'));var express=require(_0x6932('0x3'));var router=express['Router']();var fs_extra=require(_0x6932('0x4'));var auth=require(_0x6932('0x5'));var interaction=require(_0x6932('0x6'));var config=require(_0x6932('0x7'));var controller=require(_0x6932('0x8'));router[_0x6932('0x9')](_0x6932('0xa'),auth[_0x6932('0xb')](),controller[_0x6932('0xc')]);router[_0x6932('0xd')](_0x6932('0xa'),auth[_0x6932('0xb')](),controller[_0x6932('0xe')]);router[_0x6932('0xf')]('/:id',auth[_0x6932('0xb')](),controller['destroy']);module[_0x6932('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index ab5f71e..357a378 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 _0xcefd=['STRING','BOOLEAN','sequelize','exports'];(function(_0x453474,_0x1d85a4){var _0x3dd6eb=function(_0x56b371){while(--_0x56b371){_0x453474['push'](_0x453474['shift']());}};_0x3dd6eb(++_0x1d85a4);}(_0xcefd,0x126));var _0xdcef=function(_0xd71a75,_0x51afd3){_0xd71a75=_0xd71a75-0x0;var _0x278bf9=_0xcefd[_0xd71a75];return _0x278bf9;};'use strict';var Sequelize=require(_0xdcef('0x0'));module[_0xdcef('0x1')]={'name':{'type':Sequelize[_0xdcef('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xdcef('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3336=['BOOLEAN','sequelize','STRING'];(function(_0x1b30ef,_0x198a1c){var _0x3b33b1=function(_0x22e5c6){while(--_0x22e5c6){_0x1b30ef['push'](_0x1b30ef['shift']());}};_0x3b33b1(++_0x198a1c);}(_0x3336,0x106));var _0x6333=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0x3336[_0x2c27ed];return _0x597bd1;};'use strict';var Sequelize=require(_0x6333('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6333('0x1')]},'write':{'type':Sequelize[_0x6333('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 36a04ec..1ee2790 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 _0xf9f9=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x211f04,_0x828280){var _0x1eab0d=function(_0x36e9a3){while(--_0x36e9a3){_0x211f04['push'](_0x211f04['shift']());}};_0x1eab0d(++_0x828280);}(_0xf9f9,0x1e2));var _0x9f9f=function(_0x511b1d,_0x20f7b1){_0x511b1d=_0x511b1d-0x0;var _0x54f7cc=_0xf9f9[_0x511b1d];return _0x54f7cc;};'use strict';var emlformat=require(_0x9f9f('0x0'));var rimraf=require(_0x9f9f('0x1'));var zipdir=require(_0x9f9f('0x2'));var jsonpatch=require(_0x9f9f('0x3'));var rp=require(_0x9f9f('0x4'));var moment=require(_0x9f9f('0x5'));var BPromise=require(_0x9f9f('0x6'));var Mustache=require(_0x9f9f('0x7'));var util=require('util');var path=require(_0x9f9f('0x8'));var sox=require(_0x9f9f('0x9'));var csv=require('to-csv');var ejs=require(_0x9f9f('0xa'));var fs=require('fs');var fs_extra=require(_0x9f9f('0xb'));var _=require(_0x9f9f('0xc'));var squel=require(_0x9f9f('0xd'));var crypto=require(_0x9f9f('0xe'));var jsforce=require(_0x9f9f('0xf'));var deskjs=require(_0x9f9f('0x10'));var toCsv=require(_0x9f9f('0x11'));var querystring=require(_0x9f9f('0x12'));var Papa=require('papaparse');var Redis=require(_0x9f9f('0x13'));var authService=require(_0x9f9f('0x14'));var qs=require(_0x9f9f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9f9f('0x16'));var utils=require(_0x9f9f('0x17'));var config=require(_0x9f9f('0x18'));var licenseUtil=require(_0x9f9f('0x19'));var db=require(_0x9f9f('0x1a'))['db'];config[_0x9f9f('0x1b')]=_[_0x9f9f('0x1c')](config[_0x9f9f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f9f('0x1d'))(new Redis(config[_0x9f9f('0x1b')]));require(_0x9f9f('0x1e'))[_0x9f9f('0x1f')](socket);function respondWithStatusCode(_0x11aeed,_0x231ca4){_0x231ca4=_0x231ca4||0xcc;return function(_0x1ef48c){if(_0x1ef48c){return _0x11aeed[_0x9f9f('0x20')](_0x231ca4);}return _0x11aeed[_0x9f9f('0x21')](_0x231ca4)[_0x9f9f('0x22')]();};}function respondWithResult(_0x2d90f8,_0x564ad1){_0x564ad1=_0x564ad1||0xc8;return function(_0x1674ae){if(_0x1674ae){return _0x2d90f8[_0x9f9f('0x21')](_0x564ad1)[_0x9f9f('0x23')](_0x1674ae);}};}function respondWithFilteredResult(_0x2e3198,_0xf42b9a){return function(_0x593b11){if(_0x593b11){var _0x5e8243=typeof _0xf42b9a['offset']===_0x9f9f('0x24')&&typeof _0xf42b9a[_0x9f9f('0x25')]===_0x9f9f('0x24');var _0x4c8666=_0x593b11[_0x9f9f('0x26')];var _0x3b1eea=_0x5e8243?0x0:_0xf42b9a[_0x9f9f('0x27')];var _0x42a6f9=_0x5e8243?_0x593b11[_0x9f9f('0x26')]:_0xf42b9a[_0x9f9f('0x27')]+_0xf42b9a[_0x9f9f('0x25')];var _0x1f7611;if(_0x42a6f9>=_0x4c8666){_0x42a6f9=_0x4c8666;_0x1f7611=0xc8;}else{_0x1f7611=0xce;}_0x2e3198[_0x9f9f('0x21')](_0x1f7611);return _0x2e3198[_0x9f9f('0x28')](_0x9f9f('0x29'),_0x3b1eea+'-'+_0x42a6f9+'/'+_0x4c8666)[_0x9f9f('0x23')](_0x593b11);}return null;};}function patchUpdates(_0x2b2782){return function(_0x6fdccd){try{jsonpatch['apply'](_0x6fdccd,_0x2b2782,!![]);}catch(_0x571682){return BPromise['reject'](_0x571682);}return _0x6fdccd[_0x9f9f('0x2a')]();};}function saveUpdates(_0x337e10,_0x5b7e43){return function(_0x3852c6){if(_0x3852c6){return _0x3852c6[_0x9f9f('0x2b')](_0x337e10)[_0x9f9f('0x2c')](function(_0x129398){return _0x129398;});}return null;};}function removeEntity(_0x1d3308,_0x17e7e0){return function(_0x456569){if(_0x456569){return _0x456569[_0x9f9f('0x2d')]()[_0x9f9f('0x2c')](function(){_0x1d3308[_0x9f9f('0x21')](0xcc)[_0x9f9f('0x22')]();});}};}function handleEntityNotFound(_0x54fb30,_0x3f8de5){return function(_0x24cc7e){if(!_0x24cc7e){_0x54fb30[_0x9f9f('0x20')](0x194);}return _0x24cc7e;};}function handleError(_0xc8dba9,_0x1497ba){_0x1497ba=_0x1497ba||0x1f4;return function(_0x10265e){logger[_0x9f9f('0x2e')](_0x10265e[_0x9f9f('0x2f')]);if(_0x10265e[_0x9f9f('0x30')]){delete _0x10265e['name'];}_0xc8dba9['status'](_0x1497ba)[_0x9f9f('0x31')](_0x10265e);};}exports[_0x9f9f('0x32')]=function(_0x30c07b,_0xc1154f){var _0x1921e6={},_0x6c0f02={},_0xeb60d1={'count':0x0,'rows':[]};var _0x19d13b=_[_0x9f9f('0x33')](db[_0x9f9f('0x34')][_0x9f9f('0x35')],function(_0x2464d9){return{'name':_0x2464d9['fieldName'],'type':_0x2464d9['type'][_0x9f9f('0x36')]};});_0x6c0f02['model']=_[_0x9f9f('0x33')](_0x19d13b,'name');_0x6c0f02['query']=_[_0x9f9f('0x37')](_0x30c07b[_0x9f9f('0x38')]);_0x6c0f02[_0x9f9f('0x39')]=_[_0x9f9f('0x3a')](_0x6c0f02[_0x9f9f('0x3b')],_0x6c0f02[_0x9f9f('0x38')]);_0x1921e6[_0x9f9f('0x3c')]=_['intersection'](_0x6c0f02[_0x9f9f('0x3b')],qs[_0x9f9f('0x3d')](_0x30c07b[_0x9f9f('0x38')][_0x9f9f('0x3d')]));_0x1921e6['attributes']=_0x1921e6[_0x9f9f('0x3c')][_0x9f9f('0x3e')]?_0x1921e6[_0x9f9f('0x3c')]:_0x6c0f02[_0x9f9f('0x3b')];if(!_0x30c07b[_0x9f9f('0x38')][_0x9f9f('0x3f')](_0x9f9f('0x40'))){_0x1921e6[_0x9f9f('0x25')]=qs[_0x9f9f('0x25')](_0x30c07b['query'][_0x9f9f('0x25')]);_0x1921e6['offset']=qs[_0x9f9f('0x27')](_0x30c07b[_0x9f9f('0x38')][_0x9f9f('0x27')]);}_0x1921e6[_0x9f9f('0x41')]=qs[_0x9f9f('0x42')](_0x30c07b['query'][_0x9f9f('0x42')]);_0x1921e6[_0x9f9f('0x43')]=qs[_0x9f9f('0x39')](_[_0x9f9f('0x44')](_0x30c07b['query'],_0x6c0f02['filters']),_0x19d13b);if(_0x30c07b[_0x9f9f('0x38')][_0x9f9f('0x45')]){_0x1921e6[_0x9f9f('0x43')]=_[_0x9f9f('0x46')](_0x1921e6[_0x9f9f('0x43')],{'$or':_['map'](_0x19d13b,function(_0x4d9490){if(_0x4d9490[_0x9f9f('0x47')]!==_0x9f9f('0x48')){var _0x251171={};_0x251171[_0x4d9490[_0x9f9f('0x30')]]={'$like':'%'+_0x30c07b[_0x9f9f('0x38')][_0x9f9f('0x45')]+'%'};return _0x251171;}})});}_0x1921e6=_['merge']({},_0x1921e6,_0x30c07b[_0x9f9f('0x49')]);var _0x562777={'where':_0x1921e6[_0x9f9f('0x43')]};return db[_0x9f9f('0x34')]['count'](_0x562777)[_0x9f9f('0x2c')](function(_0x2a9c4e){_0xeb60d1[_0x9f9f('0x26')]=_0x2a9c4e;if(_0x30c07b[_0x9f9f('0x38')]['includeAll']){_0x1921e6[_0x9f9f('0x4a')]=[{'all':!![]}];}return db[_0x9f9f('0x34')][_0x9f9f('0x4b')](_0x1921e6);})['then'](function(_0x223050){_0xeb60d1[_0x9f9f('0x4c')]=_0x223050;return _0xeb60d1;})[_0x9f9f('0x2c')](respondWithFilteredResult(_0xc1154f,_0x1921e6))[_0x9f9f('0x4d')](handleError(_0xc1154f,null));};exports['show']=function(_0x20f22b,_0x2d0216){var _0x3c6534={'raw':!![],'where':{'id':_0x20f22b[_0x9f9f('0x4e')]['id']}},_0x27edad={};_0x27edad[_0x9f9f('0x3b')]=_[_0x9f9f('0x37')](db[_0x9f9f('0x34')][_0x9f9f('0x35')]);_0x27edad['query']=_[_0x9f9f('0x37')](_0x20f22b[_0x9f9f('0x38')]);_0x27edad[_0x9f9f('0x39')]=_[_0x9f9f('0x3a')](_0x27edad[_0x9f9f('0x3b')],_0x27edad[_0x9f9f('0x38')]);_0x3c6534['attributes']=_[_0x9f9f('0x3a')](_0x27edad[_0x9f9f('0x3b')],qs[_0x9f9f('0x3d')](_0x20f22b[_0x9f9f('0x38')][_0x9f9f('0x3d')]));_0x3c6534['attributes']=_0x3c6534[_0x9f9f('0x3c')]['length']?_0x3c6534[_0x9f9f('0x3c')]:_0x27edad[_0x9f9f('0x3b')];if(_0x20f22b['query'][_0x9f9f('0x4f')]){_0x3c6534['include']=[{'all':!![]}];}_0x3c6534=_[_0x9f9f('0x46')]({},_0x3c6534,_0x20f22b[_0x9f9f('0x49')]);return db[_0x9f9f('0x34')][_0x9f9f('0x50')](_0x3c6534)['then'](handleEntityNotFound(_0x2d0216,null))[_0x9f9f('0x2c')](respondWithResult(_0x2d0216,null))[_0x9f9f('0x4d')](handleError(_0x2d0216,null));};exports[_0x9f9f('0x51')]=function(_0x403248,_0x3a615e){return db[_0x9f9f('0x34')]['create'](_0x403248[_0x9f9f('0x52')],{})[_0x9f9f('0x2c')](respondWithResult(_0x3a615e,0xc9))[_0x9f9f('0x4d')](handleError(_0x3a615e,null));};exports['update']=function(_0x24aacc,_0x12f39a){if(_0x24aacc[_0x9f9f('0x52')]['id']){delete _0x24aacc[_0x9f9f('0x52')]['id'];}return db[_0x9f9f('0x34')][_0x9f9f('0x50')]({'where':{'id':_0x24aacc[_0x9f9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x12f39a,null))[_0x9f9f('0x2c')](saveUpdates(_0x24aacc['body'],null))[_0x9f9f('0x2c')](respondWithResult(_0x12f39a,null))[_0x9f9f('0x4d')](handleError(_0x12f39a,null));};exports[_0x9f9f('0x2d')]=function(_0x2b0e6d,_0x30b331){return db[_0x9f9f('0x34')][_0x9f9f('0x50')]({'where':{'id':_0x2b0e6d[_0x9f9f('0x4e')]['id']}})[_0x9f9f('0x2c')](handleEntityNotFound(_0x30b331,null))[_0x9f9f('0x2c')](removeEntity(_0x30b331,null))['catch'](handleError(_0x30b331,null));};exports[_0x9f9f('0x53')]=function(_0x4c2b7b,_0x590183){return db[_0x9f9f('0x34')]['describe']()[_0x9f9f('0x2c')](respondWithResult(_0x590183,null))[_0x9f9f('0x4d')](handleError(_0x590183,null));};exports[_0x9f9f('0x54')]=function(_0x5f1f22,_0x11b889,_0x83ae45){return db[_0x9f9f('0x55')][_0x9f9f('0x26')]({'where':{'ChatGroupId':_0x5f1f22[_0x9f9f('0x4e')]['id'],'ToId':_0x5f1f22[_0x9f9f('0x56')]['id'],'read':![]}})[_0x9f9f('0x2c')](function(_0x2e8401){return{'id':_[_0x9f9f('0x57')](_0x5f1f22[_0x9f9f('0x4e')]['id']),'count':_0x2e8401};})[_0x9f9f('0x2c')](respondWithResult(_0x11b889,null))[_0x9f9f('0x4d')](handleError(_0x11b889,null));};exports[_0x9f9f('0x58')]=function(_0x2d7ecb,_0x29d1e2,_0x36bf7){return db[_0x9f9f('0x34')][_0x9f9f('0x50')]({'where':{'id':_0x2d7ecb[_0x9f9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x29d1e2,null))[_0x9f9f('0x2c')](function(_0x30c6f7){if(_0x30c6f7){return _0x30c6f7[_0x9f9f('0x58')](_0x2d7ecb['body']['ids'],_[_0x9f9f('0x59')](_0x2d7ecb[_0x9f9f('0x52')],[_0x9f9f('0x5a'),'id'])||{});}})[_0x9f9f('0x2c')](respondWithResult(_0x29d1e2,null))[_0x9f9f('0x4d')](handleError(_0x29d1e2,null));};exports[_0x9f9f('0x5b')]=function(_0x5b3dac,_0x2a8eec,_0x297920){var _0x3e718a={};var _0x2e69eb={};var _0xb26e78;var _0x2c53d0;return db[_0x9f9f('0x34')][_0x9f9f('0x5c')]({'where':{'id':_0x5b3dac[_0x9f9f('0x4e')]['id']}})[_0x9f9f('0x2c')](handleEntityNotFound(_0x2a8eec,null))[_0x9f9f('0x2c')](function(_0x2409ab){if(_0x2409ab){_0xb26e78=_0x2409ab;_0x2e69eb[_0x9f9f('0x3b')]=_[_0x9f9f('0x37')](db[_0x9f9f('0x5d')][_0x9f9f('0x35')]);_0x2e69eb[_0x9f9f('0x38')]=_[_0x9f9f('0x37')](_0x5b3dac[_0x9f9f('0x38')]);_0x2e69eb[_0x9f9f('0x39')]=_[_0x9f9f('0x3a')](_0x2e69eb[_0x9f9f('0x3b')],_0x2e69eb[_0x9f9f('0x38')]);_0x3e718a[_0x9f9f('0x3c')]=_['intersection'](_0x2e69eb[_0x9f9f('0x3b')],qs[_0x9f9f('0x3d')](_0x5b3dac[_0x9f9f('0x38')][_0x9f9f('0x3d')]));_0x3e718a[_0x9f9f('0x3c')]=_0x3e718a[_0x9f9f('0x3c')][_0x9f9f('0x3e')]?_0x3e718a[_0x9f9f('0x3c')]:_0x2e69eb[_0x9f9f('0x3b')];_0x3e718a['order']=qs[_0x9f9f('0x42')](_0x5b3dac[_0x9f9f('0x38')][_0x9f9f('0x42')]);_0x3e718a[_0x9f9f('0x43')]=qs['filters'](_['pick'](_0x5b3dac[_0x9f9f('0x38')],_0x2e69eb[_0x9f9f('0x39')]));if(_0x5b3dac[_0x9f9f('0x38')][_0x9f9f('0x45')]){_0x3e718a['where']=_[_0x9f9f('0x46')](_0x3e718a[_0x9f9f('0x43')],{'$or':_[_0x9f9f('0x33')](_0x3e718a[_0x9f9f('0x3c')],function(_0x334fc5){var _0x5dab8f={};_0x5dab8f[_0x334fc5]={'$like':'%'+_0x5b3dac[_0x9f9f('0x38')][_0x9f9f('0x45')]+'%'};return _0x5dab8f;})});}_0x3e718a=_[_0x9f9f('0x46')]({},_0x3e718a,_0x5b3dac[_0x9f9f('0x49')]);return _0xb26e78['getMembers'](_0x3e718a);}})[_0x9f9f('0x2c')](function(_0x3ee787){if(_0x3ee787){_0x2c53d0=_0x3ee787[_0x9f9f('0x3e')];if(!_0x5b3dac['query'][_0x9f9f('0x3f')](_0x9f9f('0x40'))){_0x3e718a[_0x9f9f('0x25')]=qs[_0x9f9f('0x25')](_0x5b3dac['query'][_0x9f9f('0x25')]);_0x3e718a[_0x9f9f('0x27')]=qs[_0x9f9f('0x27')](_0x5b3dac[_0x9f9f('0x38')][_0x9f9f('0x27')]);}return _0xb26e78[_0x9f9f('0x5b')](_0x3e718a);}})[_0x9f9f('0x2c')](function(_0x5d55db){if(_0x5d55db){return _0x5d55db?{'count':_0x2c53d0,'rows':_0x5d55db}:null;}})['then'](respondWithResult(_0x2a8eec,null))[_0x9f9f('0x4d')](handleError(_0x2a8eec,null));};exports['removeMembers']=function(_0x4d91ef,_0xc3b5e6,_0x5ded6a){return db[_0x9f9f('0x34')][_0x9f9f('0x50')]({'where':{'id':_0x4d91ef[_0x9f9f('0x4e')]['id']}})['then'](handleEntityNotFound(_0xc3b5e6,null))[_0x9f9f('0x2c')](function(_0x51cb94){if(_0x51cb94){return _0x51cb94[_0x9f9f('0x5e')](_0x4d91ef[_0x9f9f('0x38')][_0x9f9f('0x5a')]);}})['then'](respondWithStatusCode(_0xc3b5e6,null))[_0x9f9f('0x4d')](handleError(_0xc3b5e6,null));};exports[_0x9f9f('0x5f')]=function(_0x4886b0,_0x338a74,_0x438b06){if(_0x4886b0[_0x9f9f('0x52')]['id']){delete _0x4886b0[_0x9f9f('0x52')]['id'];}return db['ChatGroup'][_0x9f9f('0x50')]({'where':{'id':_0x4886b0[_0x9f9f('0x4e')]['id']}})[_0x9f9f('0x2c')](handleEntityNotFound(_0x338a74,null))[_0x9f9f('0x2c')](function(_0x4aae64){if(_0x4aae64){_0x4886b0[_0x9f9f('0x52')][_0x9f9f('0x60')]=_0x4aae64['id'];return db[_0x9f9f('0x55')][_0x9f9f('0x51')](_0x4886b0[_0x9f9f('0x52')]);}})['then'](respondWithResult(_0x338a74,null))[_0x9f9f('0x4d')](handleError(_0x338a74,null));};exports[_0x9f9f('0x61')]=function(_0x5c1687,_0x621a33,_0x2719e2){var _0x55a064={};var _0x5be15d={};var _0x29471a;var _0x2a3af6;return db['ChatGroup'][_0x9f9f('0x5c')]({'where':{'id':_0x5c1687[_0x9f9f('0x4e')]['id']}})[_0x9f9f('0x2c')](handleEntityNotFound(_0x621a33,null))['then'](function(_0x1745b5){if(_0x1745b5){_0x29471a=_0x1745b5;_0x5be15d['model']=_[_0x9f9f('0x37')](db[_0x9f9f('0x55')][_0x9f9f('0x35')]);_0x5be15d[_0x9f9f('0x38')]=_[_0x9f9f('0x37')](_0x5c1687['query']);_0x5be15d[_0x9f9f('0x39')]=_['intersection'](_0x5be15d[_0x9f9f('0x3b')],_0x5be15d[_0x9f9f('0x38')]);_0x55a064['attributes']=_['intersection'](_0x5be15d['model'],qs[_0x9f9f('0x3d')](_0x5c1687['query'][_0x9f9f('0x3d')]));_0x55a064[_0x9f9f('0x3c')]=_0x55a064[_0x9f9f('0x3c')]['length']?_0x55a064[_0x9f9f('0x3c')]:_0x5be15d['model'];_0x55a064['order']=qs[_0x9f9f('0x42')](_0x5c1687[_0x9f9f('0x38')][_0x9f9f('0x42')]);_0x55a064['where']=qs[_0x9f9f('0x39')](_[_0x9f9f('0x44')](_0x5c1687[_0x9f9f('0x38')],_0x5be15d[_0x9f9f('0x39')]));if(_0x5c1687[_0x9f9f('0x38')]['filter']){_0x55a064[_0x9f9f('0x43')]=_[_0x9f9f('0x46')](_0x55a064[_0x9f9f('0x43')],{'$or':_[_0x9f9f('0x33')](_0x55a064[_0x9f9f('0x3c')],function(_0x5693bb){var _0x31c320={};_0x31c320[_0x5693bb]={'$like':'%'+_0x5c1687[_0x9f9f('0x38')][_0x9f9f('0x45')]+'%'};return _0x31c320;})});}if(_0x5c1687[_0x9f9f('0x38')][_0x9f9f('0x62')]){var _0x1c7751=_0x5c1687['query']['$gte']['split'](',');var _0x4fa5f5={};_0x4fa5f5[_0x1c7751[0x0]]={'$gte':moment(_0x1c7751[0x1])[_0x9f9f('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55a064['where']=_[_0x9f9f('0x46')](_0x55a064[_0x9f9f('0x43')],_0x4fa5f5);}_0x55a064=_['merge']({},_0x55a064,_0x5c1687['options']);return _0x29471a[_0x9f9f('0x61')](_0x55a064);}})['then'](function(_0x4f907b){if(_0x4f907b){_0x2a3af6=_0x4f907b[_0x9f9f('0x3e')];if(!_0x5c1687[_0x9f9f('0x38')]['hasOwnProperty'](_0x9f9f('0x40'))){_0x55a064[_0x9f9f('0x25')]=qs[_0x9f9f('0x25')](_0x5c1687[_0x9f9f('0x38')][_0x9f9f('0x25')]);_0x55a064['offset']=qs[_0x9f9f('0x27')](_0x5c1687[_0x9f9f('0x38')][_0x9f9f('0x27')]);}return _0x29471a[_0x9f9f('0x61')](_0x55a064);}})['then'](function(_0x558768){if(_0x558768){return _0x558768?{'count':_0x2a3af6,'rows':_0x558768}:null;}})[_0x9f9f('0x2c')](respondWithResult(_0x621a33,null))['catch'](handleError(_0x621a33,null));}; \ No newline at end of file +var _0x8879=['pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','ChatGroup','rawAttributes','length','includeAll','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','removeMembers','addMessage','getMessages','$gte','format','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','./chatGroup.socket','register','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','reject','update','then','destroy','stack','name','index','fieldName','type','model','map','query','keys','intersection','attributes','fields','order','sort','filters'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8879,0x126));var _0x9887=function(_0x70689a,_0x5ab73d){_0x70689a=_0x70689a-0x0;var _0x30ee81=_0x8879[_0x70689a];return _0x30ee81;};'use strict';var emlformat=require(_0x9887('0x0'));var rimraf=require(_0x9887('0x1'));var zipdir=require(_0x9887('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9887('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9887('0x4'));var util=require(_0x9887('0x5'));var path=require(_0x9887('0x6'));var sox=require(_0x9887('0x7'));var csv=require('to-csv');var ejs=require(_0x9887('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9887('0x9'));var jsforce=require(_0x9887('0xa'));var deskjs=require(_0x9887('0xb'));var toCsv=require(_0x9887('0xc'));var querystring=require(_0x9887('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9887('0xe'));var qs=require(_0x9887('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9887('0x10'));var logger=require(_0x9887('0x11'))(_0x9887('0x12'));var utils=require(_0x9887('0x13'));var config=require(_0x9887('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9887('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9887('0x16'))(new Redis(config[_0x9887('0x17')]));require(_0x9887('0x18'))[_0x9887('0x19')](socket);function respondWithStatusCode(_0x2f7723,_0x456565){_0x456565=_0x456565||0xcc;return function(_0x4acc58){if(_0x4acc58){return _0x2f7723[_0x9887('0x1a')](_0x456565);}return _0x2f7723['status'](_0x456565)[_0x9887('0x1b')]();};}function respondWithResult(_0x79569a,_0x2529cc){_0x2529cc=_0x2529cc||0xc8;return function(_0x41ee3b){if(_0x41ee3b){return _0x79569a['status'](_0x2529cc)['json'](_0x41ee3b);}};}function respondWithFilteredResult(_0x560428,_0x1cb66b){return function(_0xdfd15f){if(_0xdfd15f){var _0x11c2ce=typeof _0x1cb66b[_0x9887('0x1c')]===_0x9887('0x1d')&&typeof _0x1cb66b['limit']==='undefined';var _0x3d5655=_0xdfd15f[_0x9887('0x1e')];var _0x29e366=_0x11c2ce?0x0:_0x1cb66b['offset'];var _0x32b6c9=_0x11c2ce?_0xdfd15f[_0x9887('0x1e')]:_0x1cb66b['offset']+_0x1cb66b[_0x9887('0x1f')];var _0x42eed9;if(_0x32b6c9>=_0x3d5655){_0x32b6c9=_0x3d5655;_0x42eed9=0xc8;}else{_0x42eed9=0xce;}_0x560428[_0x9887('0x20')](_0x42eed9);return _0x560428[_0x9887('0x21')](_0x9887('0x22'),_0x29e366+'-'+_0x32b6c9+'/'+_0x3d5655)['json'](_0xdfd15f);}return null;};}function patchUpdates(_0xa1f249){return function(_0x2e0368){try{jsonpatch['apply'](_0x2e0368,_0xa1f249,!![]);}catch(_0x3570ae){return BPromise[_0x9887('0x23')](_0x3570ae);}return _0x2e0368['save']();};}function saveUpdates(_0x385262,_0x585be8){return function(_0x28375d){if(_0x28375d){return _0x28375d[_0x9887('0x24')](_0x385262)[_0x9887('0x25')](function(_0x551343){return _0x551343;});}return null;};}function removeEntity(_0x2ffdcb,_0x364935){return function(_0x19dd27){if(_0x19dd27){return _0x19dd27[_0x9887('0x26')]()['then'](function(){_0x2ffdcb[_0x9887('0x20')](0xcc)[_0x9887('0x1b')]();});}};}function handleEntityNotFound(_0x53de9c,_0x5405a6){return function(_0x14a589){if(!_0x14a589){_0x53de9c[_0x9887('0x1a')](0x194);}return _0x14a589;};}function handleError(_0x3b39e7,_0x5c4749){_0x5c4749=_0x5c4749||0x1f4;return function(_0x35bbbb){logger['error'](_0x35bbbb[_0x9887('0x27')]);if(_0x35bbbb[_0x9887('0x28')]){delete _0x35bbbb[_0x9887('0x28')];}_0x3b39e7[_0x9887('0x20')](_0x5c4749)['send'](_0x35bbbb);};}exports[_0x9887('0x29')]=function(_0x21e84f,_0x30c41b){var _0x5af7e8={},_0x2df053={},_0x5eb4d7={'count':0x0,'rows':[]};var _0x509383=_['map'](db['ChatGroup']['rawAttributes'],function(_0x179d42){return{'name':_0x179d42[_0x9887('0x2a')],'type':_0x179d42[_0x9887('0x2b')]['key']};});_0x2df053[_0x9887('0x2c')]=_[_0x9887('0x2d')](_0x509383,'name');_0x2df053[_0x9887('0x2e')]=_[_0x9887('0x2f')](_0x21e84f[_0x9887('0x2e')]);_0x2df053['filters']=_[_0x9887('0x30')](_0x2df053[_0x9887('0x2c')],_0x2df053[_0x9887('0x2e')]);_0x5af7e8[_0x9887('0x31')]=_[_0x9887('0x30')](_0x2df053[_0x9887('0x2c')],qs[_0x9887('0x32')](_0x21e84f[_0x9887('0x2e')]['fields']));_0x5af7e8[_0x9887('0x31')]=_0x5af7e8['attributes']['length']?_0x5af7e8[_0x9887('0x31')]:_0x2df053[_0x9887('0x2c')];if(!_0x21e84f[_0x9887('0x2e')]['hasOwnProperty']('nolimit')){_0x5af7e8[_0x9887('0x1f')]=qs[_0x9887('0x1f')](_0x21e84f['query'][_0x9887('0x1f')]);_0x5af7e8[_0x9887('0x1c')]=qs[_0x9887('0x1c')](_0x21e84f[_0x9887('0x2e')]['offset']);}_0x5af7e8[_0x9887('0x33')]=qs[_0x9887('0x34')](_0x21e84f[_0x9887('0x2e')][_0x9887('0x34')]);_0x5af7e8['where']=qs[_0x9887('0x35')](_[_0x9887('0x36')](_0x21e84f[_0x9887('0x2e')],_0x2df053[_0x9887('0x35')]),_0x509383);if(_0x21e84f['query'][_0x9887('0x37')]){_0x5af7e8[_0x9887('0x38')]=_[_0x9887('0x39')](_0x5af7e8[_0x9887('0x38')],{'$or':_[_0x9887('0x2d')](_0x509383,function(_0x346640){if(_0x346640[_0x9887('0x2b')]!==_0x9887('0x3a')){var _0x186584={};_0x186584[_0x346640[_0x9887('0x28')]]={'$like':'%'+_0x21e84f['query'][_0x9887('0x37')]+'%'};return _0x186584;}})});}_0x5af7e8=_[_0x9887('0x39')]({},_0x5af7e8,_0x21e84f[_0x9887('0x3b')]);var _0x25f552={'where':_0x5af7e8['where']};return db['ChatGroup']['count'](_0x25f552)[_0x9887('0x25')](function(_0x4eaf9e){_0x5eb4d7[_0x9887('0x1e')]=_0x4eaf9e;if(_0x21e84f[_0x9887('0x2e')]['includeAll']){_0x5af7e8[_0x9887('0x3c')]=[{'all':!![]}];}return db['ChatGroup'][_0x9887('0x3d')](_0x5af7e8);})[_0x9887('0x25')](function(_0x52e17d){_0x5eb4d7['rows']=_0x52e17d;return _0x5eb4d7;})['then'](respondWithFilteredResult(_0x30c41b,_0x5af7e8))['catch'](handleError(_0x30c41b,null));};exports[_0x9887('0x3e')]=function(_0x47675a,_0x2529b8){var _0x383373={'raw':!![],'where':{'id':_0x47675a[_0x9887('0x3f')]['id']}},_0x369d1c={};_0x369d1c[_0x9887('0x2c')]=_[_0x9887('0x2f')](db[_0x9887('0x40')][_0x9887('0x41')]);_0x369d1c[_0x9887('0x2e')]=_[_0x9887('0x2f')](_0x47675a['query']);_0x369d1c[_0x9887('0x35')]=_[_0x9887('0x30')](_0x369d1c['model'],_0x369d1c[_0x9887('0x2e')]);_0x383373[_0x9887('0x31')]=_[_0x9887('0x30')](_0x369d1c[_0x9887('0x2c')],qs[_0x9887('0x32')](_0x47675a['query'][_0x9887('0x32')]));_0x383373['attributes']=_0x383373['attributes'][_0x9887('0x42')]?_0x383373[_0x9887('0x31')]:_0x369d1c['model'];if(_0x47675a[_0x9887('0x2e')][_0x9887('0x43')]){_0x383373[_0x9887('0x3c')]=[{'all':!![]}];}_0x383373=_[_0x9887('0x39')]({},_0x383373,_0x47675a[_0x9887('0x3b')]);return db['ChatGroup'][_0x9887('0x44')](_0x383373)[_0x9887('0x25')](handleEntityNotFound(_0x2529b8,null))[_0x9887('0x25')](respondWithResult(_0x2529b8,null))[_0x9887('0x45')](handleError(_0x2529b8,null));};exports[_0x9887('0x46')]=function(_0x334b13,_0x4e14be){return db[_0x9887('0x40')][_0x9887('0x46')](_0x334b13[_0x9887('0x47')],{})[_0x9887('0x25')](respondWithResult(_0x4e14be,0xc9))[_0x9887('0x45')](handleError(_0x4e14be,null));};exports[_0x9887('0x24')]=function(_0x452dae,_0x1542f7){if(_0x452dae[_0x9887('0x47')]['id']){delete _0x452dae[_0x9887('0x47')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x452dae[_0x9887('0x3f')]['id']}})[_0x9887('0x25')](handleEntityNotFound(_0x1542f7,null))[_0x9887('0x25')](saveUpdates(_0x452dae[_0x9887('0x47')],null))['then'](respondWithResult(_0x1542f7,null))['catch'](handleError(_0x1542f7,null));};exports[_0x9887('0x26')]=function(_0xb1006d,_0x23d72e){return db[_0x9887('0x40')]['find']({'where':{'id':_0xb1006d[_0x9887('0x3f')]['id']}})[_0x9887('0x25')](handleEntityNotFound(_0x23d72e,null))[_0x9887('0x25')](removeEntity(_0x23d72e,null))[_0x9887('0x45')](handleError(_0x23d72e,null));};exports[_0x9887('0x48')]=function(_0x15b8a9,_0x9496fd){return db[_0x9887('0x40')][_0x9887('0x48')]()[_0x9887('0x25')](respondWithResult(_0x9496fd,null))['catch'](handleError(_0x9496fd,null));};exports[_0x9887('0x49')]=function(_0x346ec3,_0x4bd596,_0x303124){return db[_0x9887('0x4a')]['count']({'where':{'ChatGroupId':_0x346ec3[_0x9887('0x3f')]['id'],'ToId':_0x346ec3[_0x9887('0x4b')]['id'],'read':![]}})[_0x9887('0x25')](function(_0x599b64){return{'id':_[_0x9887('0x4c')](_0x346ec3['params']['id']),'count':_0x599b64};})[_0x9887('0x25')](respondWithResult(_0x4bd596,null))[_0x9887('0x45')](handleError(_0x4bd596,null));};exports[_0x9887('0x4d')]=function(_0x39b745,_0x1aac87,_0x595eab){return db['ChatGroup']['find']({'where':{'id':_0x39b745[_0x9887('0x3f')]['id']}})[_0x9887('0x25')](handleEntityNotFound(_0x1aac87,null))[_0x9887('0x25')](function(_0x4eaef1){if(_0x4eaef1){return _0x4eaef1[_0x9887('0x4d')](_0x39b745[_0x9887('0x47')]['ids'],_[_0x9887('0x4e')](_0x39b745['body'],[_0x9887('0x4f'),'id'])||{});}})[_0x9887('0x25')](respondWithResult(_0x1aac87,null))[_0x9887('0x45')](handleError(_0x1aac87,null));};exports[_0x9887('0x50')]=function(_0x45307c,_0x197b47,_0x186a7f){var _0x5a0119={};var _0x4c7f78={};var _0x483c67;var _0x3ba0c4;return db['ChatGroup'][_0x9887('0x51')]({'where':{'id':_0x45307c[_0x9887('0x3f')]['id']}})[_0x9887('0x25')](handleEntityNotFound(_0x197b47,null))[_0x9887('0x25')](function(_0x5ad1f1){if(_0x5ad1f1){_0x483c67=_0x5ad1f1;_0x4c7f78[_0x9887('0x2c')]=_[_0x9887('0x2f')](db['User'][_0x9887('0x41')]);_0x4c7f78['query']=_['keys'](_0x45307c[_0x9887('0x2e')]);_0x4c7f78[_0x9887('0x35')]=_[_0x9887('0x30')](_0x4c7f78[_0x9887('0x2c')],_0x4c7f78[_0x9887('0x2e')]);_0x5a0119[_0x9887('0x31')]=_[_0x9887('0x30')](_0x4c7f78[_0x9887('0x2c')],qs[_0x9887('0x32')](_0x45307c['query']['fields']));_0x5a0119[_0x9887('0x31')]=_0x5a0119[_0x9887('0x31')][_0x9887('0x42')]?_0x5a0119[_0x9887('0x31')]:_0x4c7f78[_0x9887('0x2c')];_0x5a0119[_0x9887('0x33')]=qs[_0x9887('0x34')](_0x45307c[_0x9887('0x2e')][_0x9887('0x34')]);_0x5a0119[_0x9887('0x38')]=qs[_0x9887('0x35')](_['pick'](_0x45307c[_0x9887('0x2e')],_0x4c7f78[_0x9887('0x35')]));if(_0x45307c['query'][_0x9887('0x37')]){_0x5a0119[_0x9887('0x38')]=_[_0x9887('0x39')](_0x5a0119[_0x9887('0x38')],{'$or':_['map'](_0x5a0119[_0x9887('0x31')],function(_0x54a332){var _0x4cb0c8={};_0x4cb0c8[_0x54a332]={'$like':'%'+_0x45307c[_0x9887('0x2e')][_0x9887('0x37')]+'%'};return _0x4cb0c8;})});}_0x5a0119=_[_0x9887('0x39')]({},_0x5a0119,_0x45307c[_0x9887('0x3b')]);return _0x483c67[_0x9887('0x50')](_0x5a0119);}})['then'](function(_0x2cf894){if(_0x2cf894){_0x3ba0c4=_0x2cf894['length'];if(!_0x45307c[_0x9887('0x2e')]['hasOwnProperty']('nolimit')){_0x5a0119[_0x9887('0x1f')]=qs[_0x9887('0x1f')](_0x45307c[_0x9887('0x2e')][_0x9887('0x1f')]);_0x5a0119[_0x9887('0x1c')]=qs[_0x9887('0x1c')](_0x45307c[_0x9887('0x2e')][_0x9887('0x1c')]);}return _0x483c67[_0x9887('0x50')](_0x5a0119);}})[_0x9887('0x25')](function(_0x3f6437){if(_0x3f6437){return _0x3f6437?{'count':_0x3ba0c4,'rows':_0x3f6437}:null;}})[_0x9887('0x25')](respondWithResult(_0x197b47,null))[_0x9887('0x45')](handleError(_0x197b47,null));};exports[_0x9887('0x52')]=function(_0xb181b0,_0x56c329,_0x56daf8){return db['ChatGroup'][_0x9887('0x44')]({'where':{'id':_0xb181b0[_0x9887('0x3f')]['id']}})[_0x9887('0x25')](handleEntityNotFound(_0x56c329,null))[_0x9887('0x25')](function(_0x70e600){if(_0x70e600){return _0x70e600[_0x9887('0x52')](_0xb181b0[_0x9887('0x2e')][_0x9887('0x4f')]);}})[_0x9887('0x25')](respondWithStatusCode(_0x56c329,null))[_0x9887('0x45')](handleError(_0x56c329,null));};exports[_0x9887('0x53')]=function(_0x502794,_0x5f364d,_0x50686d){if(_0x502794[_0x9887('0x47')]['id']){delete _0x502794[_0x9887('0x47')]['id'];}return db[_0x9887('0x40')][_0x9887('0x44')]({'where':{'id':_0x502794[_0x9887('0x3f')]['id']}})[_0x9887('0x25')](handleEntityNotFound(_0x5f364d,null))[_0x9887('0x25')](function(_0x4bfc6c){if(_0x4bfc6c){_0x502794[_0x9887('0x47')]['ChatGroupId']=_0x4bfc6c['id'];return db[_0x9887('0x4a')][_0x9887('0x46')](_0x502794[_0x9887('0x47')]);}})[_0x9887('0x25')](respondWithResult(_0x5f364d,null))[_0x9887('0x45')](handleError(_0x5f364d,null));};exports[_0x9887('0x54')]=function(_0x52212b,_0x2fa7f0,_0x91c8ef){var _0x15e507={};var _0x1cc465={};var _0x2d5314;var _0x5607b3;return db['ChatGroup'][_0x9887('0x51')]({'where':{'id':_0x52212b['params']['id']}})[_0x9887('0x25')](handleEntityNotFound(_0x2fa7f0,null))[_0x9887('0x25')](function(_0x3e2caf){if(_0x3e2caf){_0x2d5314=_0x3e2caf;_0x1cc465[_0x9887('0x2c')]=_[_0x9887('0x2f')](db[_0x9887('0x4a')][_0x9887('0x41')]);_0x1cc465['query']=_['keys'](_0x52212b[_0x9887('0x2e')]);_0x1cc465[_0x9887('0x35')]=_[_0x9887('0x30')](_0x1cc465[_0x9887('0x2c')],_0x1cc465[_0x9887('0x2e')]);_0x15e507[_0x9887('0x31')]=_[_0x9887('0x30')](_0x1cc465[_0x9887('0x2c')],qs[_0x9887('0x32')](_0x52212b['query'][_0x9887('0x32')]));_0x15e507[_0x9887('0x31')]=_0x15e507[_0x9887('0x31')][_0x9887('0x42')]?_0x15e507[_0x9887('0x31')]:_0x1cc465[_0x9887('0x2c')];_0x15e507[_0x9887('0x33')]=qs['sort'](_0x52212b[_0x9887('0x2e')][_0x9887('0x34')]);_0x15e507[_0x9887('0x38')]=qs['filters'](_[_0x9887('0x36')](_0x52212b[_0x9887('0x2e')],_0x1cc465[_0x9887('0x35')]));if(_0x52212b[_0x9887('0x2e')]['filter']){_0x15e507[_0x9887('0x38')]=_[_0x9887('0x39')](_0x15e507[_0x9887('0x38')],{'$or':_[_0x9887('0x2d')](_0x15e507[_0x9887('0x31')],function(_0x5453a4){var _0x468d6a={};_0x468d6a[_0x5453a4]={'$like':'%'+_0x52212b['query'][_0x9887('0x37')]+'%'};return _0x468d6a;})});}if(_0x52212b[_0x9887('0x2e')][_0x9887('0x55')]){var _0x198a09=_0x52212b[_0x9887('0x2e')][_0x9887('0x55')]['split'](',');var _0x5a4691={};_0x5a4691[_0x198a09[0x0]]={'$gte':moment(_0x198a09[0x1])[_0x9887('0x56')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15e507[_0x9887('0x38')]=_['merge'](_0x15e507[_0x9887('0x38')],_0x5a4691);}_0x15e507=_[_0x9887('0x39')]({},_0x15e507,_0x52212b[_0x9887('0x3b')]);return _0x2d5314[_0x9887('0x54')](_0x15e507);}})[_0x9887('0x25')](function(_0x3183d3){if(_0x3183d3){_0x5607b3=_0x3183d3[_0x9887('0x42')];if(!_0x52212b[_0x9887('0x2e')]['hasOwnProperty']('nolimit')){_0x15e507[_0x9887('0x1f')]=qs[_0x9887('0x1f')](_0x52212b[_0x9887('0x2e')]['limit']);_0x15e507['offset']=qs[_0x9887('0x1c')](_0x52212b[_0x9887('0x2e')]['offset']);}return _0x2d5314[_0x9887('0x54')](_0x15e507);}})[_0x9887('0x25')](function(_0x4d6cce){if(_0x4d6cce){return _0x4d6cce?{'count':_0x5607b3,'rows':_0x4d6cce}:null;}})[_0x9887('0x25')](respondWithResult(_0x2fa7f0,null))[_0x9887('0x45')](handleError(_0x2fa7f0,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fc326c9..24a2861 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 _0x133d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xd642dd,_0x769cc5){var _0x30c262=function(_0x43a1b7){while(--_0x43a1b7){_0xd642dd['push'](_0xd642dd['shift']());}};_0x30c262(++_0x769cc5);}(_0x133d,0x193));var _0xd133=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0x133d[_0x444e8b];return _0x35eb37;};'use strict';var EventEmitter=require(_0xd133('0x0'));var ChatGroup=require(_0xd133('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd133('0x2')](0x0);var events={'afterCreate':_0xd133('0x3'),'afterUpdate':'update','afterDestroy':_0xd133('0x4')};function emitEvent(_0x583539){return function(_0x455877,_0x837965,_0x177524){ChatGroupEvents[_0xd133('0x5')](_0x583539+':'+_0x455877['id'],_0x455877);ChatGroupEvents[_0xd133('0x5')](_0x583539,_0x455877);_0x177524(null);};}for(var e in events){if(events[_0xd133('0x6')](e)){var event=events[e];ChatGroup[_0xd133('0x7')](e,emitEvent(event));}}module[_0xd133('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x4186=['../../mysqldb','ChatGroup','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x384a72,_0x34ed13){var _0x1f0e2d=function(_0x464ac3){while(--_0x464ac3){_0x384a72['push'](_0x384a72['shift']());}};_0x1f0e2d(++_0x34ed13);}(_0x4186,0x11f));var _0x6418=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x4186[_0x2fc113];return _0x5144ce;};'use strict';var EventEmitter=require(_0x6418('0x0'));var ChatGroup=require(_0x6418('0x1'))['db'][_0x6418('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6418('0x3')](0x0);var events={'afterCreate':_0x6418('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xcdf6ce){return function(_0x30821c,_0x3b1670,_0x2bb490){ChatGroupEvents[_0x6418('0x5')](_0xcdf6ce+':'+_0x30821c['id'],_0x30821c);ChatGroupEvents['emit'](_0xcdf6ce,_0x30821c);_0x2bb490(null);};}for(var e in events){if(events[_0x6418('0x6')](e)){var event=events[e];ChatGroup[_0x6418('0x7')](e,emitEvent(event));}}module[_0x6418('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 0a1abe5..3f8f0b2 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 _0xb583=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4ea45c,_0x30f6ac){var _0x5b5a1c=function(_0x20f5d6){while(--_0x20f5d6){_0x4ea45c['push'](_0x4ea45c['shift']());}};_0x5b5a1c(++_0x30f6ac);}(_0xb583,0x95));var _0x3b58=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb583[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x3b58('0x0'));var util=require('util');var logger=require(_0x3b58('0x1'))(_0x3b58('0x2'));var moment=require(_0x3b58('0x3'));var BPromise=require(_0x3b58('0x4'));var rp=require(_0x3b58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b58('0x6'));var config=require(_0x3b58('0x7'));var attributes=require(_0x3b58('0x8'));module[_0x3b58('0x9')]=function(_0x3acfdb,_0x32042b){return _0x3acfdb[_0x3b58('0xa')](_0x3b58('0xb'),attributes,{'tableName':_0x3b58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0a2=['chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','ChatGroup'];(function(_0x230aa8,_0x114400){var _0x3b5d74=function(_0xfe287e){while(--_0xfe287e){_0x230aa8['push'](_0x230aa8['shift']());}};_0x3b5d74(++_0x114400);}(_0xe0a2,0xe8));var _0x2e0a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe0a2[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2e0a('0x0'));var logger=require(_0x2e0a('0x1'))(_0x2e0a('0x2'));var moment=require(_0x2e0a('0x3'));var BPromise=require(_0x2e0a('0x4'));var rp=require(_0x2e0a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2e0a('0x6'));var attributes=require('./chatGroup.attributes');module[_0x2e0a('0x7')]=function(_0x39c350,_0x52ddcf){return _0x39c350[_0x2e0a('0x8')](_0x2e0a('0x9'),attributes,{'tableName':_0x2e0a('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 e30e2e5..4137674 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 _0xf29c=['request','then','info','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatGroup.socket','register'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0xf29c,0xc7));var _0xcf29=function(_0xbc3fa5,_0x32c376){_0xbc3fa5=_0xbc3fa5-0x0;var _0x16be6e=_0xf29c[_0xbc3fa5];return _0x16be6e;};'use strict';var _=require('lodash');var util=require(_0xcf29('0x0'));var moment=require(_0xcf29('0x1'));var BPromise=require(_0xcf29('0x2'));var rs=require(_0xcf29('0x3'));var fs=require('fs');var Redis=require(_0xcf29('0x4'));var db=require(_0xcf29('0x5'))['db'];var utils=require(_0xcf29('0x6'));var logger=require(_0xcf29('0x7'))(_0xcf29('0x8'));var config=require(_0xcf29('0x9'));var jayson=require(_0xcf29('0xa'));var client=jayson[_0xcf29('0xb')][_0xcf29('0xc')]({'port':0x232a});config[_0xcf29('0xd')]=_[_0xcf29('0xe')](config[_0xcf29('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf29('0xd')]));require(_0xcf29('0xf'))[_0xcf29('0x10')](socket);function respondWithRpcPromise(_0x18bfa3,_0x4268c6,_0x2f3bd5){return new BPromise(function(_0x2ed7fa,_0x38b122){return client[_0xcf29('0x11')](_0x18bfa3,_0x2f3bd5)[_0xcf29('0x12')](function(_0xb13a72){logger[_0xcf29('0x13')]('ChatGroup,\x20%s,\x20%s',_0x4268c6,_0xcf29('0x14'));logger[_0xcf29('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4268c6,_0xcf29('0x14'),JSON['stringify'](_0xb13a72));if(_0xb13a72[_0xcf29('0x16')]){if(_0xb13a72[_0xcf29('0x16')][_0xcf29('0x17')]===0x1f4){logger[_0xcf29('0x16')](_0xcf29('0x18'),_0x4268c6,_0xb13a72[_0xcf29('0x16')][_0xcf29('0x19')]);return _0x38b122(_0xb13a72[_0xcf29('0x16')][_0xcf29('0x19')]);}logger['error'](_0xcf29('0x18'),_0x4268c6,_0xb13a72['error'][_0xcf29('0x19')]);return _0x2ed7fa(_0xb13a72['error'][_0xcf29('0x19')]);}else{logger['info'](_0xcf29('0x18'),_0x4268c6,'request\x20sent');_0x2ed7fa(_0xb13a72[_0xcf29('0x1a')][_0xcf29('0x19')]);}})['catch'](function(_0xe2b5b1){logger[_0xcf29('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4268c6,_0xe2b5b1);_0x38b122(_0xe2b5b1);});});} \ No newline at end of file +var _0xdf71=['redis','defaults','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1891c9,_0xf570b1){var _0x416a55=function(_0x48720c){while(--_0x48720c){_0x1891c9['push'](_0x1891c9['shift']());}};_0x416a55(++_0xf570b1);}(_0xdf71,0x1d2));var _0x1df7=function(_0x521378,_0x2f8004){_0x521378=_0x521378-0x0;var _0x4b2fc4=_0xdf71[_0x521378];return _0x4b2fc4;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var moment=require(_0x1df7('0x1'));var BPromise=require(_0x1df7('0x2'));var rs=require(_0x1df7('0x3'));var fs=require('fs');var Redis=require(_0x1df7('0x4'));var db=require(_0x1df7('0x5'))['db'];var utils=require(_0x1df7('0x6'));var logger=require(_0x1df7('0x7'))('rpc');var config=require(_0x1df7('0x8'));var jayson=require(_0x1df7('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1df7('0xa')]=_[_0x1df7('0xb')](config['redis'],{'host':_0x1df7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1df7('0xa')]));require(_0x1df7('0xd'))[_0x1df7('0xe')](socket);function respondWithRpcPromise(_0x319511,_0x589400,_0x3bc01a){return new BPromise(function(_0x3e44fd,_0x28585a){return client[_0x1df7('0xf')](_0x319511,_0x3bc01a)[_0x1df7('0x10')](function(_0x1a9882){logger['info'](_0x1df7('0x11'),_0x589400,'request\x20sent');logger[_0x1df7('0x12')](_0x1df7('0x13'),_0x589400,_0x1df7('0x14'),JSON[_0x1df7('0x15')](_0x1a9882));if(_0x1a9882[_0x1df7('0x16')]){if(_0x1a9882['error'][_0x1df7('0x17')]===0x1f4){logger[_0x1df7('0x16')](_0x1df7('0x11'),_0x589400,_0x1a9882['error']['message']);return _0x28585a(_0x1a9882[_0x1df7('0x16')]['message']);}logger[_0x1df7('0x16')]('ChatGroup,\x20%s,\x20%s',_0x589400,_0x1a9882[_0x1df7('0x16')][_0x1df7('0x18')]);return _0x3e44fd(_0x1a9882[_0x1df7('0x16')][_0x1df7('0x18')]);}else{logger[_0x1df7('0x19')]('ChatGroup,\x20%s,\x20%s',_0x589400,_0x1df7('0x14'));_0x3e44fd(_0x1a9882[_0x1df7('0x1a')][_0x1df7('0x18')]);}})[_0x1df7('0x1b')](function(_0x5af91){logger[_0x1df7('0x16')]('ChatGroup,\x20%s,\x20%s',_0x589400,_0x5af91);_0x28585a(_0x5af91);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 25043fc..447bcb5 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 _0x0fbd=['chatGroup:','./chatGroup.events','save','remove','emit','removeListener','length'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x0fbd,0x94));var _0xd0fb=function(_0x5ef449,_0xf72961){_0x5ef449=_0x5ef449-0x0;var _0x17a45f=_0x0fbd[_0x5ef449];return _0x17a45f;};'use strict';var ChatGroupEvents=require(_0xd0fb('0x0'));var events=[_0xd0fb('0x1'),_0xd0fb('0x2'),'update'];function createListener(_0x1f7468,_0x27d68a){return function(_0x5a0d43){_0x27d68a[_0xd0fb('0x3')](_0x1f7468,_0x5a0d43);};}function removeListener(_0x190125,_0x1745e8){return function(){ChatGroupEvents[_0xd0fb('0x4')](_0x190125,_0x1745e8);};}exports['register']=function(_0xc19662){for(var _0x504712=0x0,_0x224899=events[_0xd0fb('0x5')];_0x504712<_0x224899;_0x504712++){var _0x255f3b=events[_0x504712];var _0x28f4a2=createListener(_0xd0fb('0x6')+_0x255f3b,_0xc19662);ChatGroupEvents['on'](_0x255f3b,_0x28f4a2);}}; \ No newline at end of file +var _0x9af9=['save','remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9af9,0xbc));var _0x99af=function(_0x1bf854,_0x382429){_0x1bf854=_0x1bf854-0x0;var _0x2a5815=_0x9af9[_0x1bf854];return _0x2a5815;};'use strict';var ChatGroupEvents=require(_0x99af('0x0'));var events=[_0x99af('0x1'),_0x99af('0x2'),_0x99af('0x3')];function createListener(_0x58d49b,_0x219b97){return function(_0x2bdf89){_0x219b97[_0x99af('0x4')](_0x58d49b,_0x2bdf89);};}function removeListener(_0x48acbb,_0x326229){return function(){ChatGroupEvents[_0x99af('0x5')](_0x48acbb,_0x326229);};}exports[_0x99af('0x6')]=function(_0x12692a){for(var _0xc25441=0x0,_0x37041d=events[_0x99af('0x7')];_0xc25441<_0x37041d;_0xc25441++){var _0x990263=events[_0xc25441];var _0x30bdc8=createListener(_0x99af('0x8')+_0x990263,_0x12692a);ChatGroupEvents['on'](_0x990263,_0x30bdc8);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d0bcca8..b6b2481 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 _0x118d=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','/:id/members','/:id/messages','getMessages','post','create','addMembers','put','delete','removeMembers'];(function(_0x500c00,_0x2d6ca9){var _0x2ce95f=function(_0x268596){while(--_0x268596){_0x500c00['push'](_0x500c00['shift']());}};_0x2ce95f(++_0x2d6ca9);}(_0x118d,0xfd));var _0xd118=function(_0x2dba4b,_0x157663){_0x2dba4b=_0x2dba4b-0x0;var _0x98a485=_0x118d[_0x2dba4b];return _0x98a485;};'use strict';var multer=require(_0xd118('0x0'));var util=require(_0xd118('0x1'));var path=require(_0xd118('0x2'));var timeout=require(_0xd118('0x3'));var express=require(_0xd118('0x4'));var router=express[_0xd118('0x5')]();var fs_extra=require(_0xd118('0x6'));var auth=require(_0xd118('0x7'));var interaction=require(_0xd118('0x8'));var config=require(_0xd118('0x9'));var controller=require('./chatGroup.controller');router[_0xd118('0xa')]('/',auth['isAuthenticated'](),controller[_0xd118('0xb')]);router[_0xd118('0xa')](_0xd118('0xc'),auth[_0xd118('0xd')](),controller[_0xd118('0xe')]);router['get'](_0xd118('0xf'),auth[_0xd118('0xd')](),controller[_0xd118('0x10')]);router[_0xd118('0xa')](_0xd118('0x11'),auth[_0xd118('0xd')](),controller['getUnread']);router[_0xd118('0xa')](_0xd118('0x12'),auth[_0xd118('0xd')](),controller['getMembers']);router[_0xd118('0xa')](_0xd118('0x13'),auth[_0xd118('0xd')](),controller[_0xd118('0x14')]);router[_0xd118('0x15')]('/',auth[_0xd118('0xd')](),controller[_0xd118('0x16')]);router[_0xd118('0x15')](_0xd118('0x12'),auth[_0xd118('0xd')](),controller[_0xd118('0x17')]);router['post'](_0xd118('0x13'),auth[_0xd118('0xd')](),controller['addMessage']);router[_0xd118('0x18')](_0xd118('0xf'),auth[_0xd118('0xd')](),controller['update']);router[_0xd118('0x19')]('/:id',auth[_0xd118('0xd')](),controller['destroy']);router['delete'](_0xd118('0x12'),auth[_0xd118('0xd')](),controller[_0xd118('0x1a')]);module[_0xd118('0x1b')]=router; \ No newline at end of file +var _0xfc6f=['./chatGroup.controller','isAuthenticated','index','/describe','describe','/:id/unread','getUnread','/:id/members','getMembers','post','create','addMembers','/:id/messages','addMessage','put','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xfc6f,0xde));var _0xffc6=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xfc6f[_0x257642];return _0x3d813b;};'use strict';var multer=require(_0xffc6('0x0'));var util=require(_0xffc6('0x1'));var path=require(_0xffc6('0x2'));var timeout=require(_0xffc6('0x3'));var express=require(_0xffc6('0x4'));var router=express[_0xffc6('0x5')]();var fs_extra=require(_0xffc6('0x6'));var auth=require(_0xffc6('0x7'));var interaction=require(_0xffc6('0x8'));var config=require(_0xffc6('0x9'));var controller=require(_0xffc6('0xa'));router['get']('/',auth[_0xffc6('0xb')](),controller[_0xffc6('0xc')]);router['get'](_0xffc6('0xd'),auth[_0xffc6('0xb')](),controller[_0xffc6('0xe')]);router['get']('/:id',auth[_0xffc6('0xb')](),controller['show']);router['get'](_0xffc6('0xf'),auth['isAuthenticated'](),controller[_0xffc6('0x10')]);router['get'](_0xffc6('0x11'),auth[_0xffc6('0xb')](),controller[_0xffc6('0x12')]);router['get']('/:id/messages',auth[_0xffc6('0xb')](),controller['getMessages']);router[_0xffc6('0x13')]('/',auth['isAuthenticated'](),controller[_0xffc6('0x14')]);router[_0xffc6('0x13')](_0xffc6('0x11'),auth[_0xffc6('0xb')](),controller[_0xffc6('0x15')]);router[_0xffc6('0x13')](_0xffc6('0x16'),auth[_0xffc6('0xb')](),controller[_0xffc6('0x17')]);router[_0xffc6('0x18')]('/:id',auth[_0xffc6('0xb')](),controller['update']);router[_0xffc6('0x19')]('/:id',auth[_0xffc6('0xb')](),controller[_0xffc6('0x1a')]);router[_0xffc6('0x19')](_0xffc6('0x11'),auth[_0xffc6('0xb')](),controller[_0xffc6('0x1b')]);module[_0xffc6('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 56d64ac..10b06b8 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 _0x215d=['thumb','TEXT','DATE','STRING','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0x1460ab,_0x74d06e){var _0x1eeb5c=function(_0x28de38){while(--_0x28de38){_0x1460ab['push'](_0x1460ab['shift']());}};_0x1eeb5c(++_0x74d06e);}(_0x215d,0x187));var _0xd215=function(_0x5d89d4,_0x405d88){_0x5d89d4=_0x5d89d4-0x0;var _0x2419fb=_0x215d[_0x5d89d4];return _0x2419fb;};'use strict';var Sequelize=require(_0xd215('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd215('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd215('0x2')]},'ratingType':{'type':Sequelize[_0xd215('0x3')](_0xd215('0x4'),_0xd215('0x5')),'defaultValue':_0xd215('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xd215('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd215('0x7')]},'disposition':{'type':Sequelize[_0xd215('0x8')]},'secondDisposition':{'type':Sequelize[_0xd215('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd215('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xd215('0x8')]},'osName':{'type':Sequelize[_0xd215('0x8')]},'osVersion':{'type':Sequelize[_0xd215('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xd215('0x8')]},'deviceType':{'type':Sequelize[_0xd215('0x8')]},'referer':{'type':Sequelize[_0xd215('0x6')]},'customerIp':{'type':Sequelize[_0xd215('0x8')]},'formData':{'type':Sequelize[_0xd215('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xd215('0x7')]},'lastMsgAt':{'type':Sequelize[_0xd215('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xd215('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd215('0x8')]},'customerPort':{'type':Sequelize[_0xd215('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xd215('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xd215('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xfd6f=['thumb','star','TEXT','DATE','STRING','out','sequelize','exports','BOOLEAN','INTEGER','ENUM'];(function(_0x4ba024,_0x156702){var _0x553e63=function(_0x53f35d){while(--_0x53f35d){_0x4ba024['push'](_0x4ba024['shift']());}};_0x553e63(++_0x156702);}(_0xfd6f,0x19d));var _0xffd6=function(_0xf1b3d,_0x3f4ea5){_0xf1b3d=_0xf1b3d-0x0;var _0x440b8d=_0xfd6f[_0xf1b3d];return _0x440b8d;};'use strict';var Sequelize=require(_0xffd6('0x0'));module[_0xffd6('0x1')]={'closed':{'type':Sequelize[_0xffd6('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xffd6('0x3')]},'ratingType':{'type':Sequelize[_0xffd6('0x4')]('star',_0xffd6('0x5')),'defaultValue':_0xffd6('0x6')},'ratingMessage':{'type':Sequelize[_0xffd6('0x7')]},'pathTranscript':{'type':Sequelize[_0xffd6('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xffd6('0x8')]},'disposition':{'type':Sequelize[_0xffd6('0x9')]},'secondDisposition':{'type':Sequelize[_0xffd6('0x9')]},'thirdDisposition':{'type':Sequelize[_0xffd6('0x9')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xffd6('0x9')]},'browserVersion':{'type':Sequelize[_0xffd6('0x9')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xffd6('0x9')]},'deviceVendor':{'type':Sequelize[_0xffd6('0x9')]},'deviceType':{'type':Sequelize[_0xffd6('0x9')]},'referer':{'type':Sequelize[_0xffd6('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xffd6('0x7')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xffd6('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xffd6('0x4')]('in',_0xffd6('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xffd6('0x9')]},'vidaooSessionId':{'type':Sequelize[_0xffd6('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d5b515f..5c52d76 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 _0x955f=['CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','ChatInteraction','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','groupBy','ChatInteractionId','all','rows','includeAll','include','options','create','params','describe','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','isNull','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','update','disposition','AbandonInteraction','attachmentUpload','originalname','file','mimetype','attachmentDownload','findOne','closed','Unauthorized','Attachment','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','pick','includeAgent','findAll','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','direction','Account','get','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','YYYY-MM-DD\x20HH:mm:ss','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','stack','name','merge','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x2a7909,_0x50e5fa){var _0x3052b3=function(_0x5b5568){while(--_0x5b5568){_0x2a7909['push'](_0x2a7909['shift']());}};_0x3052b3(++_0x50e5fa);}(_0x955f,0x1eb));var _0xf955=function(_0x24842c,_0x232d3d){_0x24842c=_0x24842c-0x0;var _0x152f31=_0x955f[_0x24842c];return _0x152f31;};'use strict';var emlformat=require(_0xf955('0x0'));var rimraf=require(_0xf955('0x1'));var zipdir=require(_0xf955('0x2'));var jsonpatch=require(_0xf955('0x3'));var rp=require(_0xf955('0x4'));var moment=require('moment');var BPromise=require(_0xf955('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf955('0x6'));var sox=require('sox');var csv=require(_0xf955('0x7'));var ejs=require(_0xf955('0x8'));var fs=require('fs');var fs_extra=require(_0xf955('0x9'));var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x7'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var Redis=require(_0xf955('0xf'));var authService=require(_0xf955('0x10'));var qs=require(_0xf955('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf955('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf955('0x13'))(_0xf955('0x14'));var utils=require(_0xf955('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf955('0x16'));var db=require('../../mysqldb')['db'];config[_0xf955('0x17')]=_['defaults'](config[_0xf955('0x17')],{'host':_0xf955('0x18'),'port':0x18eb});var socket=require(_0xf955('0x19'))(new Redis(config[_0xf955('0x17')]));require(_0xf955('0x1a'))[_0xf955('0x1b')](socket);var jayson=require(_0xf955('0x1c'));var client=jayson[_0xf955('0x1d')][_0xf955('0x1e')]({'port':0x232b});var client9004=jayson[_0xf955('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0xc29b35,_0x54e60b,_0x3139d5,_0x3a814f){return new BPromise(function(_0x2f881b,_0x15c07c){var _0x50930d=_0x3a814f||client;return _0x50930d['request'](_0xc29b35,_0x3139d5)[_0xf955('0x1f')](function(_0xe6de5c){logger[_0xf955('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x54e60b,_0xf955('0x21'));logger[_0xf955('0x22')](_0xf955('0x23'),_0x54e60b,_0xf955('0x21'),JSON[_0xf955('0x24')](_0xe6de5c));if(_0xe6de5c['error']){if(_0xe6de5c[_0xf955('0x25')][_0xf955('0x26')]===0x1f4){logger[_0xf955('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x54e60b,_0xe6de5c[_0xf955('0x25')]['message']);return _0x15c07c(_0xe6de5c[_0xf955('0x25')][_0xf955('0x27')]);}logger[_0xf955('0x25')](_0xf955('0x28'),_0x54e60b,_0xe6de5c[_0xf955('0x25')]['message']);return _0x2f881b(_0xe6de5c[_0xf955('0x25')][_0xf955('0x27')]);}else{logger[_0xf955('0x20')](_0xf955('0x28'),_0x54e60b,_0xf955('0x21'));_0x2f881b(_0xe6de5c[_0xf955('0x29')][_0xf955('0x27')]);}})['catch'](function(_0x18f435){logger[_0xf955('0x25')](_0xf955('0x28'),_0x54e60b,_0x18f435);_0x15c07c(_0x18f435);});});}function respondWithStatusCode(_0x406632,_0x2dcd55){_0x2dcd55=_0x2dcd55||0xcc;return function(_0x13a86d){if(_0x13a86d){return _0x406632[_0xf955('0x2a')](_0x2dcd55);}return _0x406632['status'](_0x2dcd55)[_0xf955('0x2b')]();};}function respondWithResult(_0x145098,_0x41c9f6){_0x41c9f6=_0x41c9f6||0xc8;return function(_0xbd0b74){if(_0xbd0b74){return _0x145098[_0xf955('0x2c')](_0x41c9f6)[_0xf955('0x2d')](_0xbd0b74);}};}function respondWithFilteredResult(_0x4d4af0,_0x2232a7){return function(_0x1e5d37){if(_0x1e5d37){var _0x4ec3e8=typeof _0x2232a7[_0xf955('0x2e')]===_0xf955('0x2f')&&typeof _0x2232a7[_0xf955('0x30')]===_0xf955('0x2f');var _0x59bfb5=_0x1e5d37[_0xf955('0x31')];var _0x518fb3=_0x4ec3e8?0x0:_0x2232a7[_0xf955('0x2e')];var _0x2c222a=_0x4ec3e8?_0x1e5d37[_0xf955('0x31')]:_0x2232a7[_0xf955('0x2e')]+_0x2232a7[_0xf955('0x30')];var _0x32121b;if(_0x2c222a>=_0x59bfb5){_0x2c222a=_0x59bfb5;_0x32121b=0xc8;}else{_0x32121b=0xce;}_0x4d4af0[_0xf955('0x2c')](_0x32121b);return _0x4d4af0[_0xf955('0x32')]('Content-Range',_0x518fb3+'-'+_0x2c222a+'/'+_0x59bfb5)[_0xf955('0x2d')](_0x1e5d37);}return null;};}function patchUpdates(_0x165cc4){return function(_0x3964d3){try{jsonpatch[_0xf955('0x33')](_0x3964d3,_0x165cc4,!![]);}catch(_0x4fea0c){return BPromise[_0xf955('0x34')](_0x4fea0c);}return _0x3964d3[_0xf955('0x35')]();};}function saveUpdates(_0x3c81bc,_0xe1b436){return function(_0xdbc53e){if(_0xdbc53e){return _0xdbc53e['update'](_0x3c81bc)['then'](function(_0x5480db){return _0x5480db;});}return null;};}function removeEntity(_0x2626cb,_0x3783dc){return function(_0x374e95){if(_0x374e95){return _0x374e95[_0xf955('0x36')]()[_0xf955('0x1f')](function(){_0x2626cb[_0xf955('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3acc4b,_0x515dc6){return function(_0x8f842f){if(!_0x8f842f){_0x3acc4b[_0xf955('0x2a')](0x194);}return _0x8f842f;};}function handleError(_0xe33ef2,_0x51762d){_0x51762d=_0x51762d||0x1f4;return function(_0x60a421){logger['error'](_0x60a421[_0xf955('0x37')]);if(_0x60a421[_0xf955('0x38')]){delete _0x60a421[_0xf955('0x38')];}_0xe33ef2[_0xf955('0x2c')](_0x51762d)['send'](_0x60a421);};}function getMustacheRender(_0xf35170,_0x118c92){return Mustache['render'](_0xf35170,_[_0xf955('0x39')](_0x118c92[_0xf955('0x3a')],{'contact':_0x118c92[_0xf955('0x3b')],'message':_0x118c92['message'],'agent':_0x118c92[_0xf955('0x3c')],'interaction':_0x118c92[_0xf955('0x3d')],'account':_0x118c92[_0xf955('0x3e')]}))||'';}function getInteractionUsers(_0x488b6e,_0x97e8ff){return new BPromise(function(_0x195faa,_0x21e4a6){try{if(_0x97e8ff[_0x488b6e['id']]){_0x488b6e[_0xf955('0x3f')]=_[_0xf955('0x40')](_0x97e8ff[_0x488b6e['id']],function(_0x3c4b29){return{'id':_0x3c4b29['id'],'fullname':_0x3c4b29[_0xf955('0x41')]};});}}catch(_0x228dae){_0x21e4a6(_0x228dae);}_0x195faa(_0x488b6e);});}function getInteractionTags(_0x5671c7,_0x8fa41b){return new BPromise(function(_0x7123c1,_0x2aacdf){try{if(_0x5671c7[_0xf955('0x42')]){_0x5671c7[_0xf955('0x43')]=[];_0x5671c7[_0xf955('0x42')][_0xf955('0x44')](',')[_0xf955('0x45')](function(_0x47651b){_0x5671c7[_0xf955('0x43')][_0xf955('0x46')](_0x8fa41b[_0x47651b]);});}delete _0x5671c7[_0xf955('0x42')];}catch(_0x40d7e9){_0x2aacdf(_0x40d7e9);}_0x7123c1(_0x5671c7);});}function updateChatInteraction(_0x159ae3,_0x3557b5,_0x248f60){return new BPromise(function(_0x356ec2,_0x34f0f1){return getInteractionUsers(_0x159ae3,_0x248f60)[_0xf955('0x1f')](function(_0x5dd300){return getInteractionTags(_0x5dd300,_0x3557b5);})[_0xf955('0x1f')](function(_0x25d809){_0x356ec2(_0x25d809);})[_0xf955('0x47')](function(_0x5f0ef9){_0x34f0f1(_0x5f0ef9);});});}exports[_0xf955('0x48')]=function(_0x485e77,_0x398224){var _0x56a4ca={},_0x103ac2={},_0x24cb74={'count':0x0,'rows':[]};var _0x213136=_[_0xf955('0x40')](db['ChatInteraction'][_0xf955('0x49')],function(_0xdb1cc){return{'name':_0xdb1cc[_0xf955('0x4a')],'type':_0xdb1cc['type']['key']};});_0x103ac2[_0xf955('0x4b')]=_[_0xf955('0x40')](_0x213136,_0xf955('0x38'));_0x103ac2[_0xf955('0x4c')]=_['keys'](_0x485e77[_0xf955('0x4c')]);_0x103ac2[_0xf955('0x4d')]=_[_0xf955('0x4e')](_0x103ac2['model'],_0x103ac2[_0xf955('0x4c')]);_0x56a4ca['attributes']=_[_0xf955('0x4e')](_0x103ac2[_0xf955('0x4b')],qs[_0xf955('0x4f')](_0x485e77['query'][_0xf955('0x4f')]));_0x56a4ca[_0xf955('0x50')]=_0x56a4ca[_0xf955('0x50')][_0xf955('0x51')]?_0x56a4ca['attributes']:_0x103ac2[_0xf955('0x4b')];if(!_0x485e77[_0xf955('0x4c')][_0xf955('0x52')](_0xf955('0x53'))){_0x56a4ca[_0xf955('0x30')]=qs['limit'](_0x485e77[_0xf955('0x4c')]['limit']);_0x56a4ca[_0xf955('0x2e')]=qs['offset'](_0x485e77[_0xf955('0x4c')]['offset']);}_0x56a4ca['order']=qs[_0xf955('0x54')](_0x485e77[_0xf955('0x4c')]['sort']);_0x56a4ca[_0xf955('0x55')]=qs['filters'](_['pick'](_0x485e77['query'],_0x103ac2['filters']),_0x213136);var _0x3c37e2=[];var _0x1abe1c=squel['select']()['field']('id')[_0xf955('0x56')](_0xf955('0x38'))[_0xf955('0x56')](_0xf955('0x57'))[_0xf955('0x58')](_0xf955('0x59'));var _0x190500=squel[_0xf955('0x5a')]()[_0xf955('0x56')](_0xf955('0x5b'))[_0xf955('0x56')](_0xf955('0x5c'))['field'](_0xf955('0x5d'))[_0xf955('0x58')](_0xf955('0x5e'),'ui')[_0xf955('0x5f')](_0xf955('0x60'),'u','u.id\x20=\x20ui.UserId');var _0xf5d575=squel[_0xf955('0x5a')]()[_0xf955('0x58')](_0xf955('0x61'),'i')[_0xf955('0x5f')](_0xf955('0x62'),'c',_0xf955('0x63'))[_0xf955('0x5f')](_0xf955('0x60'),'o',_0xf955('0x64'))['left_join'](_0xf955('0x65'),'a',_0xf955('0x66'))[_0xf955('0x5f')](_0xf955('0x67'),'me',_0xf955('0x68'))[_0xf955('0x5f')](_0xf955('0x69'),'it',_0xf955('0x6a'))[_0xf955('0x5f')](_0xf955('0x59'),'t',_0xf955('0x6b'));var _0x2b8173=squel['expr']();var _0x1388a0=[];var _0x452de9=squel[_0xf955('0x6c')]();var _0x3eb727;if(_0x485e77[_0xf955('0x4c')][_0xf955('0x6d')]){_0x3eb727=as[_0xf955('0x6e')](_0x485e77['query']['search']);var _0x5e73ff=_0x3eb727[_0xf955('0x6f')];for(var _0x530ec7=0x0;_0x530ec7<_0x3eb727['conditions'][_0xf955('0x51')];_0x530ec7++){var _0x533e0f=_0x3eb727[_0xf955('0x70')][_0x530ec7];var _0x3fa5b5='i';var _0x158469=_[_0xf955('0x71')](_0x213136,['name',_0x533e0f[_0xf955('0x56')]]);if(!_0x158469){switch(_0x533e0f[_0xf955('0x56')]){case _0xf955('0x72'):if(_0x533e0f[_0xf955('0x73')]==0x1){_0xf5d575[_0xf955('0x74')]('`'+_0x533e0f['field']+_0xf955('0x75'));}else{_0xf5d575['having']('`'+_0x533e0f[_0xf955('0x56')]+_0xf955('0x76'));}break;case _0xf955('0x77'):if(_0x533e0f['operator']===_0xf955('0x78')){if(_0x533e0f[_0xf955('0x73')][_0xf955('0x44')]('\x20')[_0xf955('0x51')]>0x1){_0x2b8173[_0x5e73ff](_0xf955('0x79'),qs[_0xf955('0x7a')](_0x533e0f[_0xf955('0x73')]),null);}else{var _0x47e5de='%'+_0x533e0f['value']+'%';_0x2b8173[_0x5e73ff](_0xf955('0x7b'),_0x47e5de,_0x47e5de,_0x47e5de);}}else{_0x158469=_[_0xf955('0x71')](_0x213136,[_0xf955('0x38'),_0xf955('0x7c')]);_0x533e0f[_0xf955('0x56')]=_0xf955('0x7c');_0x4b85c2=as[_0xf955('0x7d')](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')][_0xf955('0x80')],_0x4b85c2['value'][_0xf955('0x2b')]);}break;case'Tag':var _0x431729=_0x533e0f['value']['split'](',')[_0xf955('0x40')](function(_0x20f11c){return Number(_0x20f11c);});_0x431729['forEach'](function(_0x1e95c3){_0x452de9['or'](_0xf955('0x81'),'%,'+_0x1e95c3+',%');});_0x1388a0=_['union'](_0x1388a0,_0x431729);break;case'User':if(_0x533e0f[_0xf955('0x82')]===_0xf955('0x78')){_0x2b8173[_0x5e73ff](_0xf955('0x83'),'%'+_0x533e0f['value']+'%',null);}else{_0x158469=_[_0xf955('0x71')](_0x213136,[_0xf955('0x38'),_0xf955('0x84')]);_0x533e0f[_0xf955('0x56')]=_0xf955('0x84');_0x4b85c2=as[_0xf955('0x7d')](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2['value'][_0xf955('0x80')],_0x4b85c2[_0xf955('0x73')]['end']);}break;case _0xf955('0x3a'):_0x4b85c2=as[_0xf955('0x7d')]('me',null,_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')]['start'],_0x4b85c2[_0xf955('0x73')][_0xf955('0x2b')]);break;}}else{var _0x4b85c2=as['buildExpression'](_0x3fa5b5,_0x158469[_0xf955('0x7e')],_0x533e0f);_0x2b8173[_0x5e73ff](_0x4b85c2[_0xf955('0x7f')],_0x4b85c2[_0xf955('0x73')][_0xf955('0x80')],_0x4b85c2['value'][_0xf955('0x2b')]);}}}else{var _0x430571=_(_0x485e77[_0xf955('0x4c')])[_0xf955('0x85')]()[_0xf955('0x40')](function(_0x3e9c6e){return _[_0xf955('0x86')](_0x213136,[_0xf955('0x38'),_0x3e9c6e])?_0x3e9c6e:undefined;})[_0xf955('0x87')]()[_0xf955('0x73')]();if(!_[_0xf955('0x88')](_0x430571)){_0x430571[_0xf955('0x45')](function(_0x4254a2){if(_0x4254a2==='ChatWebsiteId'){_0xf5d575[_0xf955('0x55')](_0xf955('0x89'),[][_0xf955('0x8a')](_0x485e77[_0xf955('0x4c')][_0x4254a2]));}else if(_0x4254a2==='createdAt'){var _0xcf6900=JSON[_0xf955('0x8b')](_0x485e77[_0xf955('0x4c')][_0x4254a2])[_0xf955('0x8c')];var _0x2b266d=JSON[_0xf955('0x8b')](_0x485e77[_0xf955('0x4c')][_0x4254a2])[_0xf955('0x8d')];_0xf5d575[_0xf955('0x55')](_0xf955('0x8e'),_0xcf6900,_0x2b266d);}else{if(_0x485e77[_0xf955('0x4c')][_0x4254a2]==='null'){_0xf5d575[_0xf955('0x55')]('i.'+_0x4254a2+_0xf955('0x8f'));}else{_0xf5d575[_0xf955('0x55')]('i.'+_0x4254a2+_0xf955('0x90'),_0x485e77[_0xf955('0x4c')][_0x4254a2]);}}});}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x91')]){if(_0x485e77['query'][_0xf955('0x91')]==0x1){_0xf5d575['having'](_0xf955('0x92'));}else{_0xf5d575['having'](_0xf955('0x93'));}}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x94')]){_0x1388a0=_[_0xf955('0x95')](_0x485e77[_0xf955('0x4c')][_0xf955('0x94')])?_0x485e77['query'][_0xf955('0x94')]:new Array(_0x485e77[_0xf955('0x4c')][_0xf955('0x94')]);_0x1388a0['forEach'](function(_0x526346){_0x452de9['or'](_0xf955('0x81'),'%,'+_0x526346+',%');});}if(_0x485e77[_0xf955('0x4c')][_0xf955('0x96')]){var _0x595d60=_0x485e77[_0xf955('0x4c')]['filter'][_0xf955('0x97')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf955('0x98')](_0x595d60)){_0x2b8173['or'](_0xf955('0x99'),_0x595d60+'%');}else{_0x2b8173['or'](_0xf955('0x9a'),qs['getFullTextValue'](_0x595d60))['or'](_0xf955('0x9b'),_0x595d60+'%');}}}_0xf5d575[_0xf955('0x55')](_0x2b8173);_0xf5d575[_0xf955('0x9c')]('i.id');var _0xba62d0={'type':db[_0xf955('0x9d')][_0xf955('0x9e')][_0xf955('0x9f')],'raw':!![]};var _0x419da5=_0xf5d575[_0xf955('0xa0')]();_0x419da5[_0xf955('0x56')]('i.id');_0x419da5[_0xf955('0x56')](_0xf955('0xa1'),_0xf955('0x72'));if(_0x56a4ca[_0xf955('0xa2')]){_0x56a4ca[_0xf955('0xa2')]['forEach'](function(_0x15c3e1){var _0x23f90c=_0x15c3e1[0x0]==='contactName'?_0x15c3e1[0x0]:'i.'+_0x15c3e1[0x0];_0xf5d575['order'](_0x23f90c,_0x15c3e1[0x1]===_0xf955('0xa3')?![]:!![]);});}if(!_[_0xf955('0x88')](_0x1388a0)){_0xf5d575[_0xf955('0x74')](_0x452de9);_0x419da5[_0xf955('0x55')]('t.id\x20IN\x20?',_0x1388a0);}BPromise[_0xf955('0xa4')]()['then'](function(){if(!_0x3eb727){if(_0x485e77['query'][_0xf955('0xa5')])return;_0x419da5[_0xf955('0x55')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0xf5d575['where'](_0xf955('0xa6'));return;}if(_0x485e77[_0xf955('0xa7')][_0xf955('0xa8')]!=='agent')return;return _0x485e77['user'][_0xf955('0xa9')]({'attributes':['id'],'raw':!![]})[_0xf955('0x1f')](function(_0x15fc7e){if(_['isEmpty'](_0x15fc7e)){_0x419da5['where']('i.ChatWebsiteId\x20IS\x20NULL');_0xf5d575['where'](_0xf955('0xaa'));}else{_0x419da5['where'](_0xf955('0x89'),_[_0xf955('0x40')](_0x15fc7e,'id'));_0xf5d575[_0xf955('0x55')](_0xf955('0x89'),_[_0xf955('0x40')](_0x15fc7e,'id'));}});})['then'](function(){if(_0x485e77[_0xf955('0xa7')][_0xf955('0xa8')]===_0xf955('0x3c')&&!_0x3eb727&&!_0x485e77[_0xf955('0x4c')]['ChatWebsiteId'])return[];return db[_0xf955('0xab')][_0xf955('0x4c')](_0x419da5['toString'](),_0xba62d0);})[_0xf955('0x1f')](function(_0x1819f6){_0x24cb74[_0xf955('0x31')]=_0x1819f6[_0xf955('0x51')];if(_0x24cb74[_0xf955('0x31')]===0x0)return[];return db[_0xf955('0xab')]['query'](_0x1abe1c['toString'](),_0xba62d0)[_0xf955('0x1f')](function(_0x545275){_0x3c37e2=_[_0xf955('0xac')](_0x545275,'id');_0xba62d0=_[_0xf955('0x39')](_0xba62d0,{'model':db[_0xf955('0xad')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x485e77[_0xf955('0x4c')]['fields']){_0x56a4ca['attributes'][_0xf955('0x45')](function(_0x12b9f8){_0xf5d575[_0xf955('0x56')]('i.'+_0x12b9f8);});}else{_0xf5d575[_0xf955('0x56')](_0xf955('0xa1'),'unreadMessages');_0xf5d575[_0xf955('0x56')](_0xf955('0xae'),_0xf955('0xaf'));_0xf5d575[_0xf955('0x56')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0xf5d575[_0xf955('0x56')](_0xf955('0xb0'),'contactName');_0xf5d575[_0xf955('0x56')](_0xf955('0xb1'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb2'),'Contact.firstName');_0xf5d575[_0xf955('0x56')](_0xf955('0xb3'),_0xf955('0xb4'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb5'),_0xf955('0xb6'));_0xf5d575[_0xf955('0x56')]('c.phone','Contact.phone');_0xf5d575['field'](_0xf955('0xb7'),_0xf955('0xb8'));_0xf5d575[_0xf955('0x56')](_0xf955('0xb9'),_0xf955('0xba'));_0xf5d575[_0xf955('0x56')](_0xf955('0xbb'),'Owner.fullname');_0xf5d575[_0xf955('0x56')](_0xf955('0xbc'),'Owner.internal');_0xf5d575[_0xf955('0x56')](_0xf955('0xbd'),_0xf955('0x42'));}if(_0x56a4ca[_0xf955('0x30')])_0xf5d575[_0xf955('0x30')](_0x56a4ca[_0xf955('0x30')]);if(_0x56a4ca[_0xf955('0x2e')])_0xf5d575[_0xf955('0x2e')](_0x56a4ca['offset']);return db['sequelize']['query'](_0xf5d575[_0xf955('0xbe')](),_0xba62d0);})[_0xf955('0x1f')](function(_0x210666){if(_0x210666[_0xf955('0x51')]>0x0)_0x190500[_0xf955('0x55')]('ui.ChatInteractionId\x20IN\x20?',_[_0xf955('0x40')](_0x210666,'id'));return db[_0xf955('0xab')][_0xf955('0x4c')](_0x190500[_0xf955('0xbe')](),_0xba62d0)[_0xf955('0x1f')](function(_0x36731b){var _0x11f6f8=_[_0xf955('0xbf')](_0x36731b,_0xf955('0xc0'));var _0x4a71e5=[];_0x210666[_0xf955('0x45')](function(_0x47daca){_0x4a71e5[_0xf955('0x46')](updateChatInteraction(_0x47daca,_0x3c37e2,_0x11f6f8));});return BPromise[_0xf955('0xc1')](_0x4a71e5);});});})[_0xf955('0x1f')](function(_0x427ab9){_0x24cb74[_0xf955('0xc2')]=_0x427ab9;return _0x24cb74;})[_0xf955('0x1f')](respondWithFilteredResult(_0x398224,_0x56a4ca))[_0xf955('0x47')](handleError(_0x398224,null));};exports['show']=function(_0x1ef189,_0x4bb590){var _0x222df2={'raw':![],'where':{'id':_0x1ef189['params']['id']}},_0x40d7c7={};_0x40d7c7[_0xf955('0x4b')]=_[_0xf955('0x85')](db[_0xf955('0xad')][_0xf955('0x49')]);_0x40d7c7[_0xf955('0x4c')]=_[_0xf955('0x85')](_0x1ef189[_0xf955('0x4c')]);_0x40d7c7['filters']=_[_0xf955('0x4e')](_0x40d7c7[_0xf955('0x4b')],_0x40d7c7['query']);_0x222df2[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x40d7c7['model'],qs['fields'](_0x1ef189[_0xf955('0x4c')][_0xf955('0x4f')]));_0x222df2[_0xf955('0x50')]=_0x222df2['attributes'][_0xf955('0x51')]?_0x222df2[_0xf955('0x50')]:_0x40d7c7[_0xf955('0x4b')];if(_0x1ef189[_0xf955('0x4c')][_0xf955('0xc3')]){_0x222df2[_0xf955('0xc4')]=[{'all':!![]}];}_0x222df2=_[_0xf955('0x39')]({},_0x222df2,_0x1ef189[_0xf955('0xc5')]);return db[_0xf955('0xad')][_0xf955('0x71')](_0x222df2)[_0xf955('0x1f')](handleEntityNotFound(_0x4bb590,null))[_0xf955('0x1f')](respondWithResult(_0x4bb590,null))[_0xf955('0x47')](handleError(_0x4bb590,null));};exports[_0xf955('0xc6')]=function(_0x490981,_0x58464d){return db[_0xf955('0xad')][_0xf955('0xc6')](_0x490981[_0xf955('0x3a')],{})[_0xf955('0x1f')](respondWithResult(_0x58464d,0xc9))[_0xf955('0x47')](handleError(_0x58464d,null));};exports['update']=function(_0x161d06,_0x3bab0d){if(_0x161d06['body']['id']){delete _0x161d06[_0xf955('0x3a')]['id'];}return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x161d06[_0xf955('0xc7')]['id']}})['then'](handleEntityNotFound(_0x3bab0d,null))[_0xf955('0x1f')](saveUpdates(_0x161d06['body'],null))[_0xf955('0x1f')](respondWithResult(_0x3bab0d,null))[_0xf955('0x47')](handleError(_0x3bab0d,null));};exports[_0xf955('0x36')]=function(_0xe9f9a8,_0x5aff59){return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0xe9f9a8[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x5aff59,null))[_0xf955('0x1f')](removeEntity(_0x5aff59,null))['catch'](handleError(_0x5aff59,null));};exports[_0xf955('0xc8')]=function(_0x1f38db,_0x395013){return db['ChatInteraction'][_0xf955('0xc8')]()[_0xf955('0x1f')](respondWithResult(_0x395013,null))[_0xf955('0x47')](handleError(_0x395013,null));};exports[_0xf955('0xc9')]=function(_0x19665c,_0x437020){var _0x12d158=_0x19665c['params']['id'];var _0x5a6abe;var _0x4e3013;var _0x345a7c;return db[_0xf955('0xad')]['findOne']({'where':{'id':_0x12d158}})[_0xf955('0x1f')](function(_0x42ba43){_0x5a6abe=_0x42ba43;return db[_0xf955('0xca')]['findOne']({'where':{'id':_0x42ba43[_0xf955('0xa5')]},'attributes':['id',_0xf955('0xcb'),'vidaooEscalation','vidaooTopic',_0xf955('0xcc'),_0xf955('0xcd')],'raw':!![]});})[_0xf955('0x1f')](function(_0x30baa1){if(_0x30baa1&&_0x30baa1[_0xf955('0xcb')]&&_0x30baa1['vidaooEscalation']){_0x4e3013=_0x30baa1;var _0xc881d4={'interaction':{'id':_0x12d158},'agent':{'id':_0x19665c[_0xf955('0xa7')]['id'],'name':_0x19665c[_0xf955('0xa7')][_0xf955('0x38')],'fullname':_0x19665c[_0xf955('0xa7')]['fullname'],'email':_0x19665c[_0xf955('0xa7')][_0xf955('0xce')]},'contact':_0x19665c[_0xf955('0x3a')][_0xf955('0x3b')],'account':_0x19665c['body'][_0xf955('0x3e')]};var _0x410d1f={'rejectUnauthorized':![],'method':_0xf955('0xcf'),'url':_0xf955('0xd0'),'headers':{'X-APIKEY':_0x30baa1[_0xf955('0xcb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x19665c['user'][_0xf955('0xce')]],'buttons':null,'topic':_0x4e3013[_0xf955('0xd1')],'note':_['isNull'](_0x4e3013[_0xf955('0xcc')])?null:getMustacheRender(_0x4e3013[_0xf955('0xcc')],_0xc881d4),'metadata':null},'redirect':_0xf955('0xd2'),'json':!![]};try{if(!_[_0xf955('0xd3')](_0x4e3013[_0xf955('0xcd')])){var _0x38e031=getMustacheRender(_0x4e3013[_0xf955('0xcd')],_0xc881d4);var _0x4f53ef=JSON[_0xf955('0x8b')](_0x38e031);_0x410d1f[_0xf955('0x3a')]['metadata']=_0x4f53ef;}}catch(_0x5395aa){throw new db[(_0xf955('0x9d'))][(_0xf955('0xd4'))](_0xf955('0xd5'));}return rp(_0x410d1f);}else{throw new db[(_0xf955('0x9d'))]['ValidationError'](_0xf955('0xd6'));}})[_0xf955('0x1f')](function(_0x57e0d7){_0x345a7c=_0x57e0d7;if(_0x345a7c['id']){var _0x54903a={'body':_0x345a7c[_0xf955('0xd7')],'ChatWebsiteId':_0x4e3013['id'],'ChatInteractionId':_0x5a6abe['id'],'direction':_0xf955('0xd8'),'UserId':_0x19665c[_0xf955('0xa7')]['id']};return db[_0xf955('0xd9')]['create'](_0x54903a,{});}else{throw new db[(_0xf955('0x9d'))][(_0xf955('0xd4'))](_0xf955('0xda'));}})[_0xf955('0x1f')](function(){return _0x5a6abe[_0xf955('0xdb')]({'vidaooSessionId':_0x345a7c['id']});})[_0xf955('0x1f')](respondWithResult(_0x437020,null))[_0xf955('0x47')](handleError(_0x437020,null));};exports[_0xf955('0xdc')]=function(_0x4c7a54,_0xde084e){if(_0x4c7a54[_0xf955('0x3a')]['id']){delete _0x4c7a54[_0xf955('0x3a')]['id'];}return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x4c7a54[_0xf955('0xc7')]['id']},'include':[{'model':db[_0xf955('0xdd')],'as':_0xf955('0x77')}]})[_0xf955('0x1f')](handleEntityNotFound(_0xde084e,null))[_0xf955('0x1f')](saveUpdates(_0x4c7a54['body'],null))[_0xf955('0x1f')](respondWithResult(_0xde084e,null))[_0xf955('0x47')](handleError(_0xde084e,null));};exports[_0xf955('0xde')]=function(_0x27391f,_0x269ae2,_0x3250df){if(_0x27391f[_0xf955('0x3a')]['id']){delete _0x27391f['body']['id'];}return db[_0xf955('0xad')]['find']({'where':{'id':_0x27391f[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](function(_0x14cde9){if(!_0x14cde9){logger[_0xf955('0x25')](_0xf955('0xdf'),_0xf955('0xde'),0x194,_0xf955('0xe0'));_0x269ae2[_0xf955('0x2a')](0x194);}else{if(_0x14cde9[_0xf955('0x84')]){throw new db['Sequelize'][(_0xf955('0xd4'))](_0xf955('0xe1'));}}return _0x14cde9;})[_0xf955('0x1f')](function(_0x3d5c15){if(_0x3d5c15){return _0x3d5c15[_0xf955('0xe2')]({'closed':_0x27391f[_0xf955('0x3a')]['closed'],'disposition':_0x27391f[_0xf955('0x3a')][_0xf955('0xe3')]})[_0xf955('0x1f')](function(_0x5c8a3f){return _0x5c8a3f;});}})[_0xf955('0x1f')](function(_0x471223){return respondWithRpcPromise(_0xf955('0xe4'),_0xf955('0xde'),_0x27391f[_0xf955('0x3a')],client9004);})[_0xf955('0x1f')](respondWithResult(_0x269ae2,null))['catch'](handleError(_0x269ae2,null));};exports[_0xf955('0xe5')]=function(_0x4775bd,_0x2a862f,_0x42e3eb){_0x4775bd[_0xf955('0x3a')][_0xf955('0x38')]=_0x4775bd['file'][_0xf955('0xe6')];_0x4775bd['body']['basename']=_0x4775bd['file']['filename'];_0x4775bd[_0xf955('0x3a')]['type']=_0x4775bd[_0xf955('0xe7')][_0xf955('0xe8')];return db['Attachment'][_0xf955('0xc6')](_0x4775bd['body'])[_0xf955('0x1f')](respondWithResult(_0x2a862f,0xc9))['catch'](handleError(_0x2a862f,null));};exports[_0xf955('0xe9')]=function(_0x267963,_0x28ce39,_0x43a5c3){return db['ChatInteraction'][_0xf955('0xea')]({'where':{'id':_0x267963['params']['id']},'raw':!![]})[_0xf955('0x1f')](handleEntityNotFound(_0x28ce39,null))[_0xf955('0x1f')](function(_0x30fd01){if(_0x30fd01){if(_0x30fd01[_0xf955('0xeb')]){return _0x28ce39[_0xf955('0x2c')](0x193)[_0xf955('0x2d')]({'status':0x193,'message':_0xf955('0xec')});}return db[_0xf955('0xed')][_0xf955('0xea')]({'where':{'id':_0x267963[_0xf955('0x4c')]['attachId']},'raw':!![]})[_0xf955('0x1f')](handleEntityNotFound(_0x28ce39,null));}})[_0xf955('0x1f')](function(_0x444e24){if(_0x444e24){var _0x2fb11a=_0x444e24[_0xf955('0xee')]!==null;var _0x2ce35c=path[_0xf955('0xef')](config['root'],_0xf955('0xf0'));if(_0x2fb11a){_0x2ce35c=path[_0xf955('0xef')](_0x2ce35c,_0xf955('0xf1'));}var _0x1e35d7=path[_0xf955('0xef')](_0x2ce35c,_0x444e24[_0xf955('0xf2')]);return _0x28ce39[_0xf955('0xf3')](_0x1e35d7);}})[_0xf955('0x47')](handleError(_0x28ce39,null));};exports[_0xf955('0xf4')]=function(_0x38016a,_0x52ad4d){var _0x1620ec=null;var _0x2c8e49=null;var _0x2b3deb=null;var _0x1ae12a=null;if(_0x38016a[_0xf955('0x3a')]['id']){delete _0x38016a[_0xf955('0x3a')]['id'];}if(_0x38016a[_0xf955('0x3a')][_0xf955('0xf5')]){_0x1ae12a=path['join'](config[_0xf955('0xf6')],_0xf955('0xf7'),util[_0xf955('0xf8')](_0xf955('0xf9'),Date[_0xf955('0xfa')]()));_0x38016a[_0xf955('0x3a')][_0xf955('0xfb')]=_0x1ae12a;}return db[_0xf955('0xad')]['find']({'where':{'id':_0x38016a['params']['id']},'include':[{'model':db[_0xf955('0xd9')],'as':_0xf955('0xfc'),'include':[{'model':db[_0xf955('0xfd')],'as':_0xf955('0xfd')}]}]})['then'](handleEntityNotFound(_0x52ad4d,null))['then'](saveUpdates(_0x38016a[_0xf955('0x3a')],null))[_0xf955('0x1f')](function(_0x4860ad){if(_0x4860ad){_0x1620ec=_0x4860ad;return db[_0xf955('0xca')][_0xf955('0x71')]({'where':{'id':_0x1620ec[_0xf955('0xa5')]}});}})[_0xf955('0x1f')](function(_0x1c0211){if(_0x1c0211){_0x2b3deb=_0x1c0211;return db['CmContact'][_0xf955('0x71')]({'where':{'id':_0x1620ec[_0xf955('0x7c')]}});}})[_0xf955('0x1f')](function(_0x106640){if(_0x106640){_0x2c8e49=_0x106640;if(_0x1ae12a){var _0x101722=null;for(var _0x479dc0=0x1;_0x479dc0<_0x1620ec[_0xf955('0xfc')]['length'];++_0x479dc0){_0x101722=_0x1620ec[_0xf955('0xfc')][_0x479dc0];var _0x570005=_0x101722[_0xf955('0x84')]?util[_0xf955('0xf8')](_0xf955('0xfe'),_0x2b3deb[_0xf955('0xff')],_0x101722[_0xf955('0x84')]):_0xf955('0x100');var _0x85661f=_0x38016a[_0xf955('0x3a')][_0xf955('0x101')]||util[_0xf955('0xf8')]('%s%d','Visitor',_0x101722[_0xf955('0x7c')]);switch(_0x2b3deb[_0xf955('0x102')]){case _0xf955('0x103'):_0x570005=_0x101722[_0xf955('0x84')]?util['format']('%s%d',_0x2b3deb[_0xf955('0xff')],_0x101722['UserId']):'System';break;case _0xf955('0x104'):_0x570005=_0x101722['UserId']?_0x101722[_0xf955('0xfd')][_0xf955('0x105')]||_0x101722['User']['fullname']:_0xf955('0x100');break;case _0xf955('0x106'):_0x570005=_0x101722[_0xf955('0x84')]?_0x101722[_0xf955('0xfd')][_0xf955('0x41')]:'System';break;default:_0x570005=_0x101722[_0xf955('0x84')]?util['format']('%s%d',_0x2b3deb['agentAlias'],_0x101722[_0xf955('0x84')]):_0xf955('0x100');}var _0x23d382=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x101722[_0xf955('0x107')])['format'](_0xf955('0x108')),_0x101722['direction']==='in'?_0x85661f:_0x570005,_0x101722[_0xf955('0x3a')]);if(!_0x101722[_0xf955('0x109')]){fs['appendFileSync'](_0x1ae12a,_0x23d382);}}return db[_0xf955('0x10a')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xf955('0x10b')],'as':_0xf955('0x10c'),'raw':!![]}]});}}})[_0xf955('0x1f')](function(_0x1e6165){if(_0x1e6165&&_0x1e6165[_0xf955('0x10c')]&&_0x38016a['body']){var _0x4a6338={'tls':{'rejectUnauthorized':![]}};if(_0x1e6165[_0xf955('0x10c')][_0xf955('0x10d')]){_0x4a6338[_0xf955('0x10d')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x10d')];}else{_0x4a6338[_0xf955('0x10e')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x10e')];_0x4a6338[_0xf955('0x10f')]=_0x1e6165['Smtp'][_0xf955('0x10f')];_0x4a6338[_0xf955('0x110')]=_0x1e6165[_0xf955('0x10c')][_0xf955('0x110')];}if(_0x1e6165[_0xf955('0x10c')]['authentication']){_0x4a6338[_0xf955('0x111')]={'user':_0x1e6165[_0xf955('0x10c')]['user'],'pass':_0x1e6165[_0xf955('0x10c')]['pass']};}return respondWithRpcPromise('SendMail',_0xf955('0x112'),{'account':_0x4a6338,'message':{'from':util[_0xf955('0xf8')](_0xf955('0x113'),_0x1e6165[_0xf955('0x38')],_0x1e6165['email']||_0x1e6165[_0xf955('0x10c')][_0xf955('0xa7')]),'to':_0x38016a[_0xf955('0x3a')][_0xf955('0xf5')],'subject':'Mail\x20Transcript','text':util[_0xf955('0xf8')](_0xf955('0x114'),_0x38016a['body'][_0xf955('0xf5')]),'attachments':[{'path':_0x1ae12a}]}})[_0xf955('0x1f')](function(){return _0x1620ec;})[_0xf955('0x47')](function(_0x50502a){console[_0xf955('0x25')](_0x50502a);});}else{return _0x1620ec;}})[_0xf955('0x1f')](respondWithStatusCode(_0x52ad4d,0xc8))[_0xf955('0x47')](handleError(_0x52ad4d,null));};exports['addMessage']=function(_0x1d2e9c,_0x49718e,_0x5aeba7){return db['ChatMessage'][_0xf955('0x71')]({'where':{'id':_0x1d2e9c[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x49718e,null))[_0xf955('0x1f')](function(_0x10cd8e){if(_0x10cd8e){return _0x10cd8e[_0xf955('0x115')](_0x1d2e9c['body'][_0xf955('0x116')],_[_0xf955('0x117')](_0x1d2e9c[_0xf955('0x3a')],[_0xf955('0x116'),'id'])||{});}})[_0xf955('0x1f')](respondWithResult(_0x49718e,null))[_0xf955('0x47')](handleError(_0x49718e,null));};exports[_0xf955('0x118')]=function(_0x287adf,_0x38177d,_0x56a307){var _0x49c6ca={'raw':![],'where':{}};var _0x36f3b3={};var _0x252118={'count':0x0,'rows':[]};return db[_0xf955('0xad')]['findOne']({'where':{'id':_0x287adf['params']['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x38177d,null))['then'](function(_0x1dd4b4){if(_0x1dd4b4){_0x36f3b3[_0xf955('0x4b')]=_[_0xf955('0x85')](db[_0xf955('0xd9')]['rawAttributes']);_0x36f3b3[_0xf955('0x4c')]=_[_0xf955('0x85')](_0x287adf[_0xf955('0x4c')]);_0x36f3b3['filters']=_[_0xf955('0x4e')](_0x36f3b3['model'],_0x36f3b3[_0xf955('0x4c')]);_0x49c6ca[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x36f3b3[_0xf955('0x4b')],qs['fields'](_0x287adf[_0xf955('0x4c')][_0xf955('0x4f')]));_0x49c6ca[_0xf955('0x50')]=_0x49c6ca['attributes'][_0xf955('0x51')]?_0x49c6ca['attributes']:_0x36f3b3[_0xf955('0x4b')];if(!_0x287adf['query'][_0xf955('0x52')]('nolimit')){_0x49c6ca[_0xf955('0x30')]=qs['limit'](_0x287adf['query']['limit']);_0x49c6ca[_0xf955('0x2e')]=qs['offset'](_0x287adf['query'][_0xf955('0x2e')]);}_0x49c6ca[_0xf955('0xa2')]=qs[_0xf955('0x54')](_0x287adf[_0xf955('0x4c')][_0xf955('0x54')]);_0x49c6ca[_0xf955('0x55')]=qs[_0xf955('0x4d')](_[_0xf955('0x119')](_0x287adf['query'],_0x36f3b3[_0xf955('0x4d')]));_0x49c6ca[_0xf955('0x55')][_0xf955('0xc0')]=_0x1dd4b4['id'];if(_0x287adf[_0xf955('0x4c')][_0xf955('0x96')]){_0x49c6ca[_0xf955('0x55')]=_[_0xf955('0x39')](_0x49c6ca[_0xf955('0x55')],{'$or':_[_0xf955('0x40')](_0x49c6ca['attributes'],function(_0x1d1df4){var _0x1b7a62={};_0x1b7a62[_0x1d1df4]={'$like':'%'+_0x287adf[_0xf955('0x4c')][_0xf955('0x96')]+'%'};return _0x1b7a62;})});}if(_0x287adf[_0xf955('0x4c')][_0xf955('0x8c')]){var _0x547464=_0x287adf[_0xf955('0x4c')][_0xf955('0x8c')][_0xf955('0x44')](',');var _0x280d1c={};_0x280d1c[_0x547464[0x0]]={'$gte':moment(_0x547464[0x1])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49c6ca[_0xf955('0x55')]=_[_0xf955('0x39')](_0x49c6ca['where'],_0x280d1c);}_0x49c6ca=_['merge']({},_0x49c6ca,_0x287adf['options']);return db[_0xf955('0xd9')][_0xf955('0x31')]({'where':_0x49c6ca[_0xf955('0x55')]})[_0xf955('0x1f')](function(_0x14bed6){_0x252118[_0xf955('0x31')]=_0x14bed6;if(_0x287adf[_0xf955('0x4c')][_0xf955('0xc3')]){_0x49c6ca[_0xf955('0xc4')]=[{'all':!![]}];}return db[_0xf955('0xd9')]['findAll'](_0x49c6ca);})[_0xf955('0x1f')](function(_0x7996b8){_0x252118[_0xf955('0xc2')]=_0x7996b8;return _0x252118;});}})[_0xf955('0x1f')](respondWithFilteredResult(_0x38177d,_0x49c6ca))[_0xf955('0x47')](handleError(_0x38177d,null));};exports['getMyMessages']=function(_0xac8cdf,_0x70fa9f,_0x5e650f){var _0x39d911={'where':{}},_0x2fbf0c={},_0x1612e4={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf955('0xea')]({'where':{'id':_0xac8cdf[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x70fa9f,null))[_0xf955('0x1f')](function(_0x1a7da8){if(_0x1a7da8){_0x2fbf0c[_0xf955('0x4b')]=_[_0xf955('0x85')](db['ChatMessage'][_0xf955('0x49')]);_0x2fbf0c['query']=_['keys'](_0xac8cdf['query']);_0x2fbf0c[_0xf955('0x4d')]=_[_0xf955('0x4e')](_0x2fbf0c[_0xf955('0x4b')],_0x2fbf0c[_0xf955('0x4c')]);_0x39d911[_0xf955('0x50')]=_[_0xf955('0x4e')](_0x2fbf0c[_0xf955('0x4b')],qs['fields'](_0xac8cdf['query'][_0xf955('0x4f')]));_0x39d911[_0xf955('0x50')]=_0x39d911['attributes']['length']?_0x39d911[_0xf955('0x50')]:_0x2fbf0c[_0xf955('0x4b')];if(!_0xac8cdf[_0xf955('0x4c')]['hasOwnProperty']('nolimit')){_0x39d911[_0xf955('0x30')]=qs[_0xf955('0x30')](_0xac8cdf[_0xf955('0x4c')][_0xf955('0x30')]);_0x39d911[_0xf955('0x2e')]=qs['offset'](_0xac8cdf['query'][_0xf955('0x2e')]);}_0x39d911[_0xf955('0xa2')]=qs[_0xf955('0x54')](_0xac8cdf[_0xf955('0x4c')]['sort']);_0x39d911[_0xf955('0x55')]=qs[_0xf955('0x4d')](_[_0xf955('0x119')](_0xac8cdf[_0xf955('0x4c')],_0x2fbf0c[_0xf955('0x4d')]));_0x39d911[_0xf955('0x55')]['ChatInteractionId']=_0x1a7da8['id'];if(_0xac8cdf['query'][_0xf955('0x96')]){_0x39d911['where']=_[_0xf955('0x39')](_0x39d911[_0xf955('0x55')],{'$or':_['map'](_0x39d911['attributes'],function(_0x4a3d8c){var _0x170ea7={};_0x170ea7[_0x4a3d8c]={'$like':'%'+_0xac8cdf[_0xf955('0x4c')][_0xf955('0x96')]+'%'};return _0x170ea7;})});}_0x39d911[_0xf955('0x55')][_0xf955('0x109')]=![];if(_0xac8cdf[_0xf955('0x4c')]['id']){_0x39d911[_0xf955('0x55')]['id']={'$gt':_0xac8cdf[_0xf955('0x4c')]['id']};}_0x39d911=_[_0xf955('0x39')]({},_0x39d911,_0xac8cdf['options']);return db[_0xf955('0xd9')]['count']({'where':_0x39d911['where']})[_0xf955('0x1f')](function(_0x36327c){_0x1612e4[_0xf955('0x31')]=_0x36327c;_0x39d911[_0xf955('0xc4')]=[];if(_0xac8cdf['query'][_0xf955('0x11a')]){_0x39d911['include'][_0xf955('0x46')]({'model':db[_0xf955('0xfd')],'as':_0xf955('0xfd'),'attributes':['id',_0xf955('0x41'),'alias']});}if(_0xac8cdf[_0xf955('0x4c')][_0xf955('0xc3')]){_0x39d911[_0xf955('0xc4')]=[{'all':!![]}];}return db[_0xf955('0xd9')][_0xf955('0x11b')](_0x39d911);})[_0xf955('0x1f')](function(_0x3e4239){_0x1612e4[_0xf955('0xc2')]=_0x3e4239;return _0x1612e4;});}})[_0xf955('0x1f')](respondWithFilteredResult(_0x70fa9f,_0x39d911))['catch'](handleError(_0x70fa9f,null));};exports[_0xf955('0x11c')]=function(_0x11a228,_0x2d37c2,_0x932b98){return db[_0xf955('0xad')]['find']({'where':{'id':_0x11a228[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x2d37c2,null))[_0xf955('0x1f')](function(_0x147f3c){if(_0x147f3c){return _0x147f3c[_0xf955('0x11d')](_0x11a228[_0xf955('0x3a')]['ids'],_[_0xf955('0x117')](_0x11a228[_0xf955('0x3a')],[_0xf955('0x116'),'id'])||{})[_0xf955('0x11e')](function(){return db[_0xf955('0x11f')]['findAll']({'attributes':['id',_0xf955('0x38'),_0xf955('0x57')],'where':{'id':_0x11a228[_0xf955('0x3a')]['ids']}});})[_0xf955('0x1f')](function(_0xfcaf21){socket['emit'](_0xf955('0x120'),{'id':Number(_0x11a228[_0xf955('0xc7')]['id']),'tags':_0xfcaf21||[]});return{'id':Number(_0x11a228[_0xf955('0xc7')]['id']),'tags':_0xfcaf21||[]};});}})[_0xf955('0x1f')](respondWithResult(_0x2d37c2,null))[_0xf955('0x47')](handleError(_0x2d37c2,null));};exports['removeTags']=function(_0x572efd,_0x357dbc,_0x2b9880){return db[_0xf955('0xad')][_0xf955('0x71')]({'where':{'id':_0x572efd[_0xf955('0xc7')]['id']}})[_0xf955('0x1f')](handleEntityNotFound(_0x357dbc,null))['then'](function(_0x23968f){if(_0x23968f){return _0x23968f[_0xf955('0x121')](_0x572efd[_0xf955('0x4c')][_0xf955('0x116')]);}})['then'](respondWithStatusCode(_0x357dbc,null))[_0xf955('0x47')](handleError(_0x357dbc,null));};exports[_0xf955('0xf3')]=function(_0x3842e1,_0x204e4e){var _0x47b877=moment()[_0xf955('0x122')]()[_0xf955('0xbe')]();var _0x1624e9=path[_0xf955('0xef')](config[_0xf955('0xf6')],_0xf955('0x123'),_0xf955('0x124'),'tmp');var _0x3ccc35=path[_0xf955('0xef')](config[_0xf955('0xf6')],_0xf955('0x123'),_0xf955('0x124'),_0xf955('0x125'));var _0x72b500=path[_0xf955('0xef')](_0x1624e9,_0x47b877);var _0x1d4aa6=util[_0xf955('0xf8')](_0xf955('0x126'),_0x3842e1[_0xf955('0xc7')]['id'],_0x47b877);var _0x4896ae=path[_0xf955('0xef')](_0x1624e9,_0x1d4aa6);var _0x3b67e3=[];_0x3b67e3[_0xf955('0x46')]({'model':db['User'],'as':_0xf955('0xfd'),'attributes':['id','fullname'],'raw':!![]});_0x3b67e3[_0xf955('0x46')]({'model':db[_0xf955('0xdd')],'as':_0xf955('0x77'),'attributes':['id',_0xf955('0x127'),'lastName'],'raw':!![]});if(_0x3842e1['query']['attachments']){_0x3b67e3[_0xf955('0x46')]({'model':db[_0xf955('0xed')],'as':_0xf955('0xed'),'raw':!![]});}var _0x21b589=[{'model':db[_0xf955('0xd9')],'as':'Messages','attributes':['id',_0xf955('0x3a'),_0xf955('0x107'),_0xf955('0x128'),_0xf955('0x109'),'read'],'include':_0x3b67e3}];_0x21b589[_0xf955('0x46')]({'model':db[_0xf955('0xca')],'as':_0xf955('0x129'),'attributes':['id',_0xf955('0x38')]});_0x21b589[_0xf955('0x46')]({'model':db[_0xf955('0xfd')],'as':'Owner','attributes':['id',_0xf955('0x41')]});return db['ChatInteraction'][_0xf955('0x71')]({'where':{'id':_0x3842e1['params']['id']},'include':_0x21b589})[_0xf955('0x1f')](handleEntityNotFound(_0x204e4e,null))[_0xf955('0x1f')](function(_0x1ed31c){if(_0x1ed31c){var _0x2e8dc2=_0x1ed31c[_0xf955('0x12a')]({'plain':!![]});fs[_0xf955('0x12b')](_0x72b500);var _0x58b727={'channel':_0xf955('0x12c'),'account':_0x2e8dc2[_0xf955('0x129')][_0xf955('0x38')],'agent':_0x2e8dc2[_0xf955('0x12d')]?_0x2e8dc2[_0xf955('0x12d')][_0xf955('0x41')]:_0xf955('0x12e'),'createdAt':moment(_0x2e8dc2['createdAt'])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf955('0xbe')](),'closedAt':_0x2e8dc2['closed']?moment(_0x2e8dc2[_0xf955('0x12f')])[_0xf955('0xf8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf955('0xbe')]():'','disposition':_0x2e8dc2['disposition'],'chatInfo':{'browser':_0x2e8dc2[_0xf955('0x130')],'os':_0x2e8dc2['osName'],'referer':_0x2e8dc2[_0xf955('0x131')],'customerIp':_0x2e8dc2[_0xf955('0x132')],'customerPort':_0x2e8dc2[_0xf955('0x133')]?_0x2e8dc2[_0xf955('0x133')]:'N.A.'},'messages':_(_0x2e8dc2[_0xf955('0xfc')])[_0xf955('0x134')]()[_0xf955('0x96')]({'secret':![]})[_0xf955('0x40')](function(_0x1307a6){if(_0x1307a6[_0xf955('0xed')]){var _0x3328b9=path[_0xf955('0xef')](_0x3ccc35,_0x1307a6['Attachment'][_0xf955('0xf2')]);if(fs[_0xf955('0x135')](_0x3328b9)){fs[_0xf955('0x136')](_0x3328b9)[_0xf955('0x137')](fs['createWriteStream'](path[_0xf955('0xef')](_0x72b500,_0x1307a6[_0xf955('0xed')][_0xf955('0xf2')])));}}return{'date':moment(_0x1307a6[_0xf955('0x107')])[_0xf955('0xf8')](_0xf955('0x138'))['toString'](),'sender':_0x1307a6[_0xf955('0x128')]===_0xf955('0xd8')?_0x1307a6['User']?_0x1307a6[_0xf955('0xfd')][_0xf955('0x41')]:_0xf955('0x100'):_0x1307a6[_0xf955('0x77')][_0xf955('0x127')]+(_0x1307a6[_0xf955('0x77')][_0xf955('0x139')]?'\x20'+_0x1307a6['Contact'][_0xf955('0x139')]:''),'body':_0x1307a6[_0xf955('0xed')]?_0x1307a6[_0xf955('0xed')][_0xf955('0xf2')]:_0x1307a6[_0xf955('0x3a')],'direction':_0x1307a6[_0xf955('0x128')]===_0xf955('0xd8')?'A':'C','secret':_0x1307a6['secret'],'read':_0x1307a6[_0xf955('0x91')],'attachment':_0x1307a6[_0xf955('0xed')]};})[_0xf955('0x73')]()};return ejs[_0xf955('0x13a')](path[_0xf955('0xef')](config[_0xf955('0xf6')],'server',_0xf955('0x13b'),_0xf955('0x13c')),{'interaction':_0x58b727})[_0xf955('0x1f')](function(_0x385676){var _0x5a9193=path['join'](_0x72b500,_0xf955('0x13d')+_0x2e8dc2['id']+'-'+_0x47b877+_0xf955('0x13e'));var _0x157508={'path':_0x5a9193,'channel':'Chat','interactionId':_0x2e8dc2['id']};return pdf[_0xf955('0x13f')](_0x385676,_0x157508);})['then'](function(){return new BPromise(function(_0x37bdd4,_0x4f8fc8){zipdir(_0x72b500,{'saveTo':_0x4896ae},function(_0x5f3e0f,_0x4ad147){if(_0x5f3e0f)return _0x4f8fc8(_0x5f3e0f);return _0x37bdd4(_0x4ad147);});})[_0xf955('0x1f')](function(){return new BPromise(function(_0x2dc607,_0x355871){rimraf(_0x72b500,function(_0x1c5b1d){if(_0x1c5b1d)_0x355871(_0x1c5b1d);return _0x2dc607();});});})[_0xf955('0x1f')](function(){return _0x204e4e[_0xf955('0xf3')](_0x4896ae,_0x1d4aa6,function(_0x5eac2b){if(_0x5eac2b){console[_0xf955('0x140')](_0xf955('0x141'),_0x5eac2b);}else{fs[_0xf955('0x142')](_0x4896ae);}});});});}else{return _0x204e4e[_0xf955('0x2a')](0xc8);}})[_0xf955('0x47')](handleError(_0x204e4e,null));}; \ No newline at end of file +var _0x5f66=['email','isNull','vidaooNote','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','file','originalname','filename','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','%s%d','agentAlias','System','customer','agentIdentifier','agent_alias','alias','agent_fullname','createdAt','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filter','findAll','getMyMessages','includeAgent','addTags','setTags','spread','emit','removeTags','unix','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Account','Owner','get','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','views','transcript-','.pdf','log','err','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','name','merge','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','includeAll','include','options','create','body','destroy','describe','createVidaooSession','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooApiKey','https://api-vidaoo.xcally.com/api/v1/meetings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var pdf=require(_0x65f6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65f6('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x65f6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x65f6('0x14'))['db'];config['redis']=_[_0x65f6('0x15')](config[_0x65f6('0x16')],{'host':_0x65f6('0x17'),'port':0x18eb});var socket=require(_0x65f6('0x18'))(new Redis(config[_0x65f6('0x16')]));require(_0x65f6('0x19'))[_0x65f6('0x1a')](socket);var jayson=require(_0x65f6('0x1b'));var client=jayson[_0x65f6('0x1c')][_0x65f6('0x1d')]({'port':0x232b});var client9004=jayson['client'][_0x65f6('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x49a913,_0x5dd324,_0x1693e6,_0x5c69f8){return new BPromise(function(_0x37330d,_0x1c955c){var _0x1b1cbb=_0x5c69f8||client;return _0x1b1cbb[_0x65f6('0x1e')](_0x49a913,_0x1693e6)[_0x65f6('0x1f')](function(_0x18380e){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5dd324,_0x65f6('0x20'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5dd324,'request\x20sent',JSON[_0x65f6('0x21')](_0x18380e));if(_0x18380e[_0x65f6('0x22')]){if(_0x18380e['error'][_0x65f6('0x23')]===0x1f4){logger[_0x65f6('0x22')](_0x65f6('0x24'),_0x5dd324,_0x18380e[_0x65f6('0x22')][_0x65f6('0x25')]);return _0x1c955c(_0x18380e[_0x65f6('0x22')]['message']);}logger[_0x65f6('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x5dd324,_0x18380e['error'][_0x65f6('0x25')]);return _0x37330d(_0x18380e[_0x65f6('0x22')]['message']);}else{logger[_0x65f6('0x26')](_0x65f6('0x24'),_0x5dd324,_0x65f6('0x20'));_0x37330d(_0x18380e[_0x65f6('0x27')]['message']);}})[_0x65f6('0x28')](function(_0x59ea32){logger[_0x65f6('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x5dd324,_0x59ea32);_0x1c955c(_0x59ea32);});});}function respondWithStatusCode(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0xcc;return function(_0x29abdb){if(_0x29abdb){return _0x5cb131[_0x65f6('0x29')](_0x4fde2f);}return _0x5cb131['status'](_0x4fde2f)[_0x65f6('0x2a')]();};}function respondWithResult(_0x28f710,_0x52277c){_0x52277c=_0x52277c||0xc8;return function(_0x325cb4){if(_0x325cb4){return _0x28f710[_0x65f6('0x2b')](_0x52277c)[_0x65f6('0x2c')](_0x325cb4);}};}function respondWithFilteredResult(_0x559330,_0x4ac04b){return function(_0x488d36){if(_0x488d36){var _0x266cfe=typeof _0x4ac04b[_0x65f6('0x2d')]===_0x65f6('0x2e')&&typeof _0x4ac04b[_0x65f6('0x2f')]===_0x65f6('0x2e');var _0x14a387=_0x488d36[_0x65f6('0x30')];var _0x4ace4c=_0x266cfe?0x0:_0x4ac04b['offset'];var _0x154cbd=_0x266cfe?_0x488d36[_0x65f6('0x30')]:_0x4ac04b['offset']+_0x4ac04b['limit'];var _0x10b368;if(_0x154cbd>=_0x14a387){_0x154cbd=_0x14a387;_0x10b368=0xc8;}else{_0x10b368=0xce;}_0x559330[_0x65f6('0x2b')](_0x10b368);return _0x559330[_0x65f6('0x31')](_0x65f6('0x32'),_0x4ace4c+'-'+_0x154cbd+'/'+_0x14a387)[_0x65f6('0x2c')](_0x488d36);}return null;};}function patchUpdates(_0x2d32be){return function(_0x5792a0){try{jsonpatch[_0x65f6('0x33')](_0x5792a0,_0x2d32be,!![]);}catch(_0x38f3c6){return BPromise[_0x65f6('0x34')](_0x38f3c6);}return _0x5792a0['save']();};}function saveUpdates(_0x217f35,_0x2a7aa8){return function(_0xbaed3c){if(_0xbaed3c){return _0xbaed3c[_0x65f6('0x35')](_0x217f35)[_0x65f6('0x1f')](function(_0x2f054c){return _0x2f054c;});}return null;};}function removeEntity(_0x4d4d84,_0x3c7c58){return function(_0x1b24ea){if(_0x1b24ea){return _0x1b24ea['destroy']()[_0x65f6('0x1f')](function(){_0x4d4d84['status'](0xcc)[_0x65f6('0x2a')]();});}};}function handleEntityNotFound(_0x50494b,_0x2b9fb6){return function(_0x24f7fd){if(!_0x24f7fd){_0x50494b['sendStatus'](0x194);}return _0x24f7fd;};}function handleError(_0x12dee6,_0x13e41a){_0x13e41a=_0x13e41a||0x1f4;return function(_0x3b261d){logger['error'](_0x3b261d['stack']);if(_0x3b261d[_0x65f6('0x36')]){delete _0x3b261d['name'];}_0x12dee6[_0x65f6('0x2b')](_0x13e41a)['send'](_0x3b261d);};}function getMustacheRender(_0x22d760,_0x2b9675){return Mustache['render'](_0x22d760,_[_0x65f6('0x37')](_0x2b9675['body'],{'contact':_0x2b9675['contact'],'message':_0x2b9675[_0x65f6('0x25')],'agent':_0x2b9675[_0x65f6('0x38')],'interaction':_0x2b9675[_0x65f6('0x39')],'account':_0x2b9675[_0x65f6('0x3a')]}))||'';}function getInteractionUsers(_0xbe54fe,_0x28845a){return new BPromise(function(_0x1a55da,_0x1153f1){try{if(_0x28845a[_0xbe54fe['id']]){_0xbe54fe['Users']=_[_0x65f6('0x3b')](_0x28845a[_0xbe54fe['id']],function(_0x49d8ee){return{'id':_0x49d8ee['id'],'fullname':_0x49d8ee[_0x65f6('0x3c')]};});}}catch(_0xa4394a){_0x1153f1(_0xa4394a);}_0x1a55da(_0xbe54fe);});}function getInteractionTags(_0x4ba7db,_0x2ea7f7){return new BPromise(function(_0x5ef5c2,_0x32148f){try{if(_0x4ba7db[_0x65f6('0x3d')]){_0x4ba7db[_0x65f6('0x3e')]=[];_0x4ba7db[_0x65f6('0x3d')][_0x65f6('0x3f')](',')[_0x65f6('0x40')](function(_0xed4c96){_0x4ba7db[_0x65f6('0x3e')][_0x65f6('0x41')](_0x2ea7f7[_0xed4c96]);});}delete _0x4ba7db['TagIds'];}catch(_0x170d3e){_0x32148f(_0x170d3e);}_0x5ef5c2(_0x4ba7db);});}function updateChatInteraction(_0x400ed2,_0x377ae5,_0x181798){return new BPromise(function(_0x83e2d9,_0x1ac040){return getInteractionUsers(_0x400ed2,_0x181798)[_0x65f6('0x1f')](function(_0x2e91e8){return getInteractionTags(_0x2e91e8,_0x377ae5);})[_0x65f6('0x1f')](function(_0x2abbed){_0x83e2d9(_0x2abbed);})[_0x65f6('0x28')](function(_0x2c008a){_0x1ac040(_0x2c008a);});});}exports[_0x65f6('0x42')]=function(_0x27157d,_0xb1a132){var _0x2cb38d={},_0x5119ee={},_0x2dd16c={'count':0x0,'rows':[]};var _0x37cd36=_[_0x65f6('0x3b')](db[_0x65f6('0x43')]['rawAttributes'],function(_0x1bf5bf){return{'name':_0x1bf5bf[_0x65f6('0x44')],'type':_0x1bf5bf[_0x65f6('0x45')]['key']};});_0x5119ee[_0x65f6('0x46')]=_[_0x65f6('0x3b')](_0x37cd36,_0x65f6('0x36'));_0x5119ee[_0x65f6('0x47')]=_['keys'](_0x27157d[_0x65f6('0x47')]);_0x5119ee['filters']=_[_0x65f6('0x48')](_0x5119ee[_0x65f6('0x46')],_0x5119ee['query']);_0x2cb38d[_0x65f6('0x49')]=_['intersection'](_0x5119ee[_0x65f6('0x46')],qs[_0x65f6('0x4a')](_0x27157d[_0x65f6('0x47')][_0x65f6('0x4a')]));_0x2cb38d[_0x65f6('0x49')]=_0x2cb38d[_0x65f6('0x49')]['length']?_0x2cb38d['attributes']:_0x5119ee[_0x65f6('0x46')];if(!_0x27157d[_0x65f6('0x47')][_0x65f6('0x4b')](_0x65f6('0x4c'))){_0x2cb38d[_0x65f6('0x2f')]=qs[_0x65f6('0x2f')](_0x27157d[_0x65f6('0x47')][_0x65f6('0x2f')]);_0x2cb38d[_0x65f6('0x2d')]=qs['offset'](_0x27157d[_0x65f6('0x47')][_0x65f6('0x2d')]);}_0x2cb38d[_0x65f6('0x4d')]=qs['sort'](_0x27157d[_0x65f6('0x47')][_0x65f6('0x4e')]);_0x2cb38d['where']=qs[_0x65f6('0x4f')](_[_0x65f6('0x50')](_0x27157d['query'],_0x5119ee[_0x65f6('0x4f')]),_0x37cd36);var _0x4f96c4=[];var _0x247be3=squel[_0x65f6('0x51')]()[_0x65f6('0x52')]('id')['field'](_0x65f6('0x36'))[_0x65f6('0x52')]('color')[_0x65f6('0x53')](_0x65f6('0x54'));var _0x48a2ed=squel[_0x65f6('0x51')]()[_0x65f6('0x52')](_0x65f6('0x55'))[_0x65f6('0x52')](_0x65f6('0x56'))[_0x65f6('0x52')](_0x65f6('0x57'))[_0x65f6('0x53')]('user_has_chat_interactions','ui')['left_join']('users','u',_0x65f6('0x58'));var _0x2091f1=squel[_0x65f6('0x51')]()[_0x65f6('0x53')]('chat_interactions','i')[_0x65f6('0x59')](_0x65f6('0x5a'),'c',_0x65f6('0x5b'))['left_join'](_0x65f6('0x5c'),'o',_0x65f6('0x5d'))[_0x65f6('0x59')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x65f6('0x59')](_0x65f6('0x5e'),'me',_0x65f6('0x5f'))[_0x65f6('0x59')](_0x65f6('0x60'),'it',_0x65f6('0x61'))[_0x65f6('0x59')](_0x65f6('0x54'),'t',_0x65f6('0x62'));var _0xddbd90=squel[_0x65f6('0x63')]();var _0x141fcc=[];var _0x30adee=squel[_0x65f6('0x63')]();var _0x5ba9c6;if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x64')]){_0x5ba9c6=as[_0x65f6('0x65')](_0x27157d['query'][_0x65f6('0x64')]);var _0x16dec0=_0x5ba9c6[_0x65f6('0x66')];for(var _0x3096b8=0x0;_0x3096b8<_0x5ba9c6['conditions'][_0x65f6('0x67')];_0x3096b8++){var _0x4227f5=_0x5ba9c6[_0x65f6('0x68')][_0x3096b8];var _0x3e0d8b='i';var _0x553ff0=_[_0x65f6('0x69')](_0x37cd36,[_0x65f6('0x36'),_0x4227f5['field']]);if(!_0x553ff0){switch(_0x4227f5[_0x65f6('0x52')]){case _0x65f6('0x6a'):if(_0x4227f5[_0x65f6('0x6b')]==0x1){_0x2091f1['having']('`'+_0x4227f5[_0x65f6('0x52')]+_0x65f6('0x6c'));}else{_0x2091f1[_0x65f6('0x6d')]('`'+_0x4227f5[_0x65f6('0x52')]+_0x65f6('0x6e'));}break;case _0x65f6('0x6f'):if(_0x4227f5['operator']==='$substring'){if(_0x4227f5['value'][_0x65f6('0x3f')]('\x20')[_0x65f6('0x67')]>0x1){_0xddbd90[_0x16dec0](_0x65f6('0x70'),qs[_0x65f6('0x71')](_0x4227f5[_0x65f6('0x6b')]),null);}else{var _0x304cf9='%'+_0x4227f5['value']+'%';_0xddbd90[_0x16dec0](_0x65f6('0x72'),_0x304cf9,_0x304cf9,_0x304cf9);}}else{_0x553ff0=_[_0x65f6('0x69')](_0x37cd36,['name',_0x65f6('0x73')]);_0x4227f5[_0x65f6('0x52')]=_0x65f6('0x73');_0xf69bf6=as['buildExpression'](_0x3e0d8b,_0x553ff0[_0x65f6('0x45')],_0x4227f5);_0xddbd90[_0x16dec0](_0xf69bf6[_0x65f6('0x74')],_0xf69bf6['value'][_0x65f6('0x75')],_0xf69bf6[_0x65f6('0x6b')][_0x65f6('0x2a')]);}break;case _0x65f6('0x76'):var _0x3d55f7=_0x4227f5[_0x65f6('0x6b')][_0x65f6('0x3f')](',')['map'](function(_0x4e5e94){return Number(_0x4e5e94);});_0x3d55f7[_0x65f6('0x40')](function(_0x3da139){_0x30adee['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3da139+',%');});_0x141fcc=_[_0x65f6('0x77')](_0x141fcc,_0x3d55f7);break;case'User':if(_0x4227f5[_0x65f6('0x78')]==='$substring'){_0xddbd90[_0x16dec0](_0x65f6('0x79'),'%'+_0x4227f5[_0x65f6('0x6b')]+'%',null);}else{_0x553ff0=_[_0x65f6('0x69')](_0x37cd36,[_0x65f6('0x36'),_0x65f6('0x7a')]);_0x4227f5[_0x65f6('0x52')]=_0x65f6('0x7a');_0xf69bf6=as[_0x65f6('0x7b')](_0x3e0d8b,_0x553ff0[_0x65f6('0x45')],_0x4227f5);_0xddbd90[_0x16dec0](_0xf69bf6['text'],_0xf69bf6['value'][_0x65f6('0x75')],_0xf69bf6[_0x65f6('0x6b')][_0x65f6('0x2a')]);}break;case'body':_0xf69bf6=as['buildExpression']('me',null,_0x4227f5);_0xddbd90[_0x16dec0](_0xf69bf6[_0x65f6('0x74')],_0xf69bf6[_0x65f6('0x6b')][_0x65f6('0x75')],_0xf69bf6[_0x65f6('0x6b')][_0x65f6('0x2a')]);break;}}else{var _0xf69bf6=as['buildExpression'](_0x3e0d8b,_0x553ff0['type'],_0x4227f5);_0xddbd90[_0x16dec0](_0xf69bf6[_0x65f6('0x74')],_0xf69bf6[_0x65f6('0x6b')]['start'],_0xf69bf6[_0x65f6('0x6b')]['end']);}}}else{var _0x254e9f=_(_0x27157d[_0x65f6('0x47')])[_0x65f6('0x7c')]()[_0x65f6('0x3b')](function(_0x558888){return _[_0x65f6('0x7d')](_0x37cd36,[_0x65f6('0x36'),_0x558888])?_0x558888:undefined;})[_0x65f6('0x7e')]()['value']();if(!_['isEmpty'](_0x254e9f)){_0x254e9f[_0x65f6('0x40')](function(_0x583a01){if(_0x583a01===_0x65f6('0x7f')){_0x2091f1[_0x65f6('0x80')](_0x65f6('0x81'),[][_0x65f6('0x82')](_0x27157d['query'][_0x583a01]));}else if(_0x583a01==='createdAt'){var _0x56f7f1=JSON[_0x65f6('0x83')](_0x27157d[_0x65f6('0x47')][_0x583a01])[_0x65f6('0x84')];var _0x57464e=JSON[_0x65f6('0x83')](_0x27157d[_0x65f6('0x47')][_0x583a01])[_0x65f6('0x85')];_0x2091f1['where'](_0x65f6('0x86'),_0x56f7f1,_0x57464e);}else{if(_0x27157d[_0x65f6('0x47')][_0x583a01]==='null'){_0x2091f1[_0x65f6('0x80')]('i.'+_0x583a01+_0x65f6('0x87'));}else{_0x2091f1['where']('i.'+_0x583a01+_0x65f6('0x88'),_0x27157d['query'][_0x583a01]);}}});}if(_0x27157d[_0x65f6('0x47')]['read']){if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x89')]==0x1){_0x2091f1['having'](_0x65f6('0x8a'));}else{_0x2091f1[_0x65f6('0x6d')](_0x65f6('0x8b'));}}if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x8c')]){_0x141fcc=_[_0x65f6('0x8d')](_0x27157d[_0x65f6('0x47')][_0x65f6('0x8c')])?_0x27157d[_0x65f6('0x47')][_0x65f6('0x8c')]:new Array(_0x27157d[_0x65f6('0x47')]['tag']);_0x141fcc[_0x65f6('0x40')](function(_0x1cf1bd){_0x30adee['or'](_0x65f6('0x8e'),'%,'+_0x1cf1bd+',%');});}if(_0x27157d[_0x65f6('0x47')]['filter']){var _0x453080=_0x27157d[_0x65f6('0x47')]['filter'][_0x65f6('0x8f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x65f6('0x90')](_0x453080)){_0xddbd90['or']('i.id\x20LIKE\x20?',_0x453080+'%');}else{_0xddbd90['or'](_0x65f6('0x91'),qs[_0x65f6('0x71')](_0x453080))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x453080+'%');}}}_0x2091f1['where'](_0xddbd90);_0x2091f1[_0x65f6('0x92')](_0x65f6('0x93'));var _0x5158c9={'type':db[_0x65f6('0x94')][_0x65f6('0x95')][_0x65f6('0x96')],'raw':!![]};var _0x4edba0=_0x2091f1[_0x65f6('0x97')]();_0x4edba0[_0x65f6('0x52')]('i.id');_0x4edba0[_0x65f6('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x65f6('0x6a'));if(_0x2cb38d['order']){_0x2cb38d['order'][_0x65f6('0x40')](function(_0x1cf4ed){var _0x199d63=_0x1cf4ed[0x0]===_0x65f6('0x98')?_0x1cf4ed[0x0]:'i.'+_0x1cf4ed[0x0];_0x2091f1[_0x65f6('0x4d')](_0x199d63,_0x1cf4ed[0x1]===_0x65f6('0x99')?![]:!![]);});}if(!_[_0x65f6('0x9a')](_0x141fcc)){_0x2091f1[_0x65f6('0x6d')](_0x30adee);_0x4edba0['where']('t.id\x20IN\x20?',_0x141fcc);}BPromise[_0x65f6('0x9b')]()['then'](function(){if(!_0x5ba9c6){if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x7f')])return;_0x4edba0[_0x65f6('0x80')](_0x65f6('0x9c'));_0x2091f1[_0x65f6('0x80')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x27157d[_0x65f6('0x9d')][_0x65f6('0x9e')]!==_0x65f6('0x38'))return;return _0x27157d['user'][_0x65f6('0x9f')]({'attributes':['id'],'raw':!![]})[_0x65f6('0x1f')](function(_0x4254c2){if(_[_0x65f6('0x9a')](_0x4254c2)){_0x4edba0[_0x65f6('0x80')](_0x65f6('0xa0'));_0x2091f1['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x4edba0[_0x65f6('0x80')](_0x65f6('0x81'),_[_0x65f6('0x3b')](_0x4254c2,'id'));_0x2091f1[_0x65f6('0x80')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x4254c2,'id'));}});})[_0x65f6('0x1f')](function(){if(_0x27157d[_0x65f6('0x9d')][_0x65f6('0x9e')]===_0x65f6('0x38')&&!_0x5ba9c6&&!_0x27157d[_0x65f6('0x47')][_0x65f6('0x7f')])return[];return db['sequelize']['query'](_0x4edba0['toString'](),_0x5158c9);})[_0x65f6('0x1f')](function(_0x2e63bb){_0x2dd16c[_0x65f6('0x30')]=_0x2e63bb[_0x65f6('0x67')];if(_0x2dd16c['count']===0x0)return[];return db['sequelize'][_0x65f6('0x47')](_0x247be3[_0x65f6('0xa1')](),_0x5158c9)['then'](function(_0x346fa9){_0x4f96c4=_['keyBy'](_0x346fa9,'id');_0x5158c9=_[_0x65f6('0x37')](_0x5158c9,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27157d[_0x65f6('0x47')][_0x65f6('0x4a')]){_0x2cb38d['attributes'][_0x65f6('0x40')](function(_0x330e18){_0x2091f1[_0x65f6('0x52')]('i.'+_0x330e18);});}else{_0x2091f1[_0x65f6('0x52')](_0x65f6('0xa2'),_0x65f6('0x6a'));_0x2091f1['field'](_0x65f6('0xa3'),'Account.key');_0x2091f1[_0x65f6('0x52')]('a.mandatoryDisposition',_0x65f6('0xa4'));_0x2091f1[_0x65f6('0x52')](_0x65f6('0xa5'),_0x65f6('0x98'));_0x2091f1['field'](_0x65f6('0xa6'));_0x2091f1[_0x65f6('0x52')](_0x65f6('0xa7'),'Contact.firstName');_0x2091f1['field'](_0x65f6('0xa8'),_0x65f6('0xa9'));_0x2091f1['field'](_0x65f6('0xaa'),_0x65f6('0xab'));_0x2091f1[_0x65f6('0x52')]('c.phone',_0x65f6('0xac'));_0x2091f1[_0x65f6('0x52')]('c.mobile',_0x65f6('0xad'));_0x2091f1[_0x65f6('0x52')](_0x65f6('0xae'),'Contact.fax');_0x2091f1[_0x65f6('0x52')](_0x65f6('0xaf'),_0x65f6('0xb0'));_0x2091f1['field'](_0x65f6('0xb1'),'Owner.internal');_0x2091f1[_0x65f6('0x52')](_0x65f6('0xb2'),_0x65f6('0x3d'));}if(_0x2cb38d[_0x65f6('0x2f')])_0x2091f1[_0x65f6('0x2f')](_0x2cb38d[_0x65f6('0x2f')]);if(_0x2cb38d['offset'])_0x2091f1[_0x65f6('0x2d')](_0x2cb38d[_0x65f6('0x2d')]);return db[_0x65f6('0xb3')][_0x65f6('0x47')](_0x2091f1[_0x65f6('0xa1')](),_0x5158c9);})['then'](function(_0x59f421){if(_0x59f421['length']>0x0)_0x48a2ed[_0x65f6('0x80')](_0x65f6('0xb4'),_[_0x65f6('0x3b')](_0x59f421,'id'));return db['sequelize'][_0x65f6('0x47')](_0x48a2ed['toString'](),_0x5158c9)['then'](function(_0x3133f4){var _0x41b58b=_['groupBy'](_0x3133f4,_0x65f6('0xb5'));var _0x3c5053=[];_0x59f421[_0x65f6('0x40')](function(_0x2ba1f7){_0x3c5053[_0x65f6('0x41')](updateChatInteraction(_0x2ba1f7,_0x4f96c4,_0x41b58b));});return BPromise[_0x65f6('0xb6')](_0x3c5053);});});})[_0x65f6('0x1f')](function(_0x3291ac){_0x2dd16c[_0x65f6('0xb7')]=_0x3291ac;return _0x2dd16c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0xb1a132,_0x2cb38d))[_0x65f6('0x28')](handleError(_0xb1a132,null));};exports[_0x65f6('0xb8')]=function(_0x5c9cc0,_0x349af7){var _0x52dc75={'raw':![],'where':{'id':_0x5c9cc0[_0x65f6('0xb9')]['id']}},_0x55355f={};_0x55355f[_0x65f6('0x46')]=_[_0x65f6('0x7c')](db[_0x65f6('0x43')]['rawAttributes']);_0x55355f[_0x65f6('0x47')]=_['keys'](_0x5c9cc0['query']);_0x55355f[_0x65f6('0x4f')]=_[_0x65f6('0x48')](_0x55355f[_0x65f6('0x46')],_0x55355f[_0x65f6('0x47')]);_0x52dc75[_0x65f6('0x49')]=_[_0x65f6('0x48')](_0x55355f['model'],qs[_0x65f6('0x4a')](_0x5c9cc0['query'][_0x65f6('0x4a')]));_0x52dc75[_0x65f6('0x49')]=_0x52dc75[_0x65f6('0x49')]['length']?_0x52dc75[_0x65f6('0x49')]:_0x55355f['model'];if(_0x5c9cc0['query'][_0x65f6('0xba')]){_0x52dc75[_0x65f6('0xbb')]=[{'all':!![]}];}_0x52dc75=_[_0x65f6('0x37')]({},_0x52dc75,_0x5c9cc0[_0x65f6('0xbc')]);return db[_0x65f6('0x43')]['find'](_0x52dc75)[_0x65f6('0x1f')](handleEntityNotFound(_0x349af7,null))[_0x65f6('0x1f')](respondWithResult(_0x349af7,null))[_0x65f6('0x28')](handleError(_0x349af7,null));};exports[_0x65f6('0xbd')]=function(_0x51f1e5,_0x3cd4c1){return db[_0x65f6('0x43')][_0x65f6('0xbd')](_0x51f1e5[_0x65f6('0xbe')],{})[_0x65f6('0x1f')](respondWithResult(_0x3cd4c1,0xc9))[_0x65f6('0x28')](handleError(_0x3cd4c1,null));};exports[_0x65f6('0x35')]=function(_0x8aab06,_0x558410){if(_0x8aab06[_0x65f6('0xbe')]['id']){delete _0x8aab06[_0x65f6('0xbe')]['id'];}return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x8aab06[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x558410,null))['then'](saveUpdates(_0x8aab06[_0x65f6('0xbe')],null))[_0x65f6('0x1f')](respondWithResult(_0x558410,null))['catch'](handleError(_0x558410,null));};exports[_0x65f6('0xbf')]=function(_0x547275,_0x24ff7c){return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x547275[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x24ff7c,null))['then'](removeEntity(_0x24ff7c,null))[_0x65f6('0x28')](handleError(_0x24ff7c,null));};exports[_0x65f6('0xc0')]=function(_0x2394eb,_0x31870f){return db[_0x65f6('0x43')]['describe']()['then'](respondWithResult(_0x31870f,null))[_0x65f6('0x28')](handleError(_0x31870f,null));};exports[_0x65f6('0xc1')]=function(_0x2993ee,_0x3cf2d9){var _0x4c070f=_0x2993ee['params']['id'];var _0x534004;var _0x42a2f6;var _0x3b0a97;return db[_0x65f6('0x43')]['findOne']({'where':{'id':_0x4c070f}})[_0x65f6('0x1f')](function(_0x3b5592){_0x534004=_0x3b5592;return db[_0x65f6('0xc2')][_0x65f6('0xc3')]({'where':{'id':_0x3b5592[_0x65f6('0x7f')]},'attributes':['id','vidaooApiKey',_0x65f6('0xc4'),_0x65f6('0xc5'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x65f6('0x1f')](function(_0x173b54){if(_0x173b54&&_0x173b54[_0x65f6('0xc6')]&&_0x173b54[_0x65f6('0xc4')]){_0x42a2f6=_0x173b54;var _0x17bbc9={'interaction':{'id':_0x4c070f},'agent':{'id':_0x2993ee['user']['id'],'name':_0x2993ee[_0x65f6('0x9d')]['name'],'fullname':_0x2993ee[_0x65f6('0x9d')]['fullname'],'email':_0x2993ee[_0x65f6('0x9d')]['email']},'contact':_0x2993ee[_0x65f6('0xbe')]['contact'],'account':_0x2993ee[_0x65f6('0xbe')][_0x65f6('0x3a')]};var _0x494f9c={'rejectUnauthorized':![],'method':'POST','url':_0x65f6('0xc7'),'headers':{'X-APIKEY':_0x173b54[_0x65f6('0xc6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2993ee[_0x65f6('0x9d')][_0x65f6('0xc8')]],'buttons':null,'topic':_0x42a2f6[_0x65f6('0xc5')],'note':_[_0x65f6('0xc9')](_0x42a2f6[_0x65f6('0xca')])?null:getMustacheRender(_0x42a2f6[_0x65f6('0xca')],_0x17bbc9),'metadata':null},'redirect':_0x65f6('0xcb'),'json':!![]};try{if(!_[_0x65f6('0xc9')](_0x42a2f6[_0x65f6('0xcc')])){var _0x6babec=getMustacheRender(_0x42a2f6[_0x65f6('0xcc')],_0x17bbc9);var _0x42177e=JSON[_0x65f6('0x83')](_0x6babec);_0x494f9c[_0x65f6('0xbe')][_0x65f6('0xcd')]=_0x42177e;}}catch(_0x5efe82){throw new db[(_0x65f6('0x94'))][(_0x65f6('0xce'))](_0x65f6('0xcf'));}return rp(_0x494f9c);}else{throw new db[(_0x65f6('0x94'))][(_0x65f6('0xce'))](_0x65f6('0xd0'));}})[_0x65f6('0x1f')](function(_0x2b3415){_0x3b0a97=_0x2b3415;if(_0x3b0a97['id']){var _0x3c9d49={'body':_0x3b0a97['join_url'],'ChatWebsiteId':_0x42a2f6['id'],'ChatInteractionId':_0x534004['id'],'direction':_0x65f6('0xd1'),'UserId':_0x2993ee[_0x65f6('0x9d')]['id']};return db[_0x65f6('0xd2')][_0x65f6('0xbd')](_0x3c9d49,{});}else{throw new db['Sequelize'][(_0x65f6('0xce'))](_0x65f6('0xd3'));}})['then'](function(){return _0x534004[_0x65f6('0xd4')]({'vidaooSessionId':_0x3b0a97['id']});})[_0x65f6('0x1f')](respondWithResult(_0x3cf2d9,null))[_0x65f6('0x28')](handleError(_0x3cf2d9,null));};exports[_0x65f6('0xd5')]=function(_0x2b89d5,_0x409dd7){if(_0x2b89d5['body']['id']){delete _0x2b89d5[_0x65f6('0xbe')]['id'];}return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x2b89d5[_0x65f6('0xb9')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x409dd7,null))[_0x65f6('0x1f')](saveUpdates(_0x2b89d5[_0x65f6('0xbe')],null))[_0x65f6('0x1f')](respondWithResult(_0x409dd7,null))[_0x65f6('0x28')](handleError(_0x409dd7,null));};exports[_0x65f6('0xd6')]=function(_0x5515a4,_0x542805,_0x2281d5){if(_0x5515a4[_0x65f6('0xbe')]['id']){delete _0x5515a4[_0x65f6('0xbe')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5515a4[_0x65f6('0xb9')]['id']}})['then'](function(_0x10a218){if(!_0x10a218){logger[_0x65f6('0x22')](_0x65f6('0xd7'),_0x65f6('0xd6'),0x194,_0x65f6('0xd8'));_0x542805[_0x65f6('0x29')](0x194);}else{if(_0x10a218[_0x65f6('0x7a')]){throw new db[(_0x65f6('0x94'))][(_0x65f6('0xce'))]('Interaction\x20already\x20assigned');}}return _0x10a218;})[_0x65f6('0x1f')](function(_0x129ae0){if(_0x129ae0){return _0x129ae0['update']({'closed':_0x5515a4[_0x65f6('0xbe')]['closed'],'disposition':_0x5515a4[_0x65f6('0xbe')][_0x65f6('0xd9')]})[_0x65f6('0x1f')](function(_0x579d52){return _0x579d52;});}})[_0x65f6('0x1f')](function(_0x5745e8){return respondWithRpcPromise('AbandonInteraction',_0x65f6('0xd6'),_0x5515a4[_0x65f6('0xbe')],client9004);})['then'](respondWithResult(_0x542805,null))[_0x65f6('0x28')](handleError(_0x542805,null));};exports['attachmentUpload']=function(_0x2b8edf,_0x28b9f4,_0x24e7f7){_0x2b8edf[_0x65f6('0xbe')][_0x65f6('0x36')]=_0x2b8edf[_0x65f6('0xda')][_0x65f6('0xdb')];_0x2b8edf[_0x65f6('0xbe')]['basename']=_0x2b8edf[_0x65f6('0xda')][_0x65f6('0xdc')];_0x2b8edf[_0x65f6('0xbe')][_0x65f6('0x45')]=_0x2b8edf[_0x65f6('0xda')]['mimetype'];return db[_0x65f6('0xdd')]['create'](_0x2b8edf[_0x65f6('0xbe')])['then'](respondWithResult(_0x28b9f4,0xc9))[_0x65f6('0x28')](handleError(_0x28b9f4,null));};exports[_0x65f6('0xde')]=function(_0x83ec2e,_0x3f61c4,_0x230eb9){return db[_0x65f6('0x43')][_0x65f6('0xc3')]({'where':{'id':_0x83ec2e[_0x65f6('0xb9')]['id']},'raw':!![]})[_0x65f6('0x1f')](handleEntityNotFound(_0x3f61c4,null))[_0x65f6('0x1f')](function(_0x72a333){if(_0x72a333){if(_0x72a333[_0x65f6('0xdf')]){return _0x3f61c4[_0x65f6('0x2b')](0x193)[_0x65f6('0x2c')]({'status':0x193,'message':_0x65f6('0xe0')});}return db[_0x65f6('0xdd')][_0x65f6('0xc3')]({'where':{'id':_0x83ec2e['query'][_0x65f6('0xe1')]},'raw':!![]})['then'](handleEntityNotFound(_0x3f61c4,null));}})[_0x65f6('0x1f')](function(_0x34f1cf){if(_0x34f1cf){var _0x431691=_0x34f1cf[_0x65f6('0xe2')]!==null;var _0x17f1f6=path[_0x65f6('0xe3')](config['root'],_0x65f6('0xe4'));if(_0x431691){_0x17f1f6=path[_0x65f6('0xe3')](_0x17f1f6,_0x65f6('0xe5'));}var _0x359734=path[_0x65f6('0xe3')](_0x17f1f6,_0x34f1cf[_0x65f6('0xe6')]);return _0x3f61c4[_0x65f6('0xe7')](_0x359734);}})[_0x65f6('0x28')](handleError(_0x3f61c4,null));};exports[_0x65f6('0xe8')]=function(_0x53da3a,_0x33831f){var _0x4ecd83=null;var _0x5e4778=null;var _0x4427bf=null;var _0x927c22=null;if(_0x53da3a[_0x65f6('0xbe')]['id']){delete _0x53da3a[_0x65f6('0xbe')]['id'];}if(_0x53da3a[_0x65f6('0xbe')][_0x65f6('0xe9')]){_0x927c22=path[_0x65f6('0xe3')](config['root'],_0x65f6('0xea'),util[_0x65f6('0xeb')](_0x65f6('0xec'),Date[_0x65f6('0xed')]()));_0x53da3a[_0x65f6('0xbe')][_0x65f6('0xee')]=_0x927c22;}return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x53da3a[_0x65f6('0xb9')]['id']},'include':[{'model':db[_0x65f6('0xd2')],'as':_0x65f6('0xef'),'include':[{'model':db[_0x65f6('0xf0')],'as':_0x65f6('0xf0')}]}]})['then'](handleEntityNotFound(_0x33831f,null))['then'](saveUpdates(_0x53da3a['body'],null))[_0x65f6('0x1f')](function(_0x3edd09){if(_0x3edd09){_0x4ecd83=_0x3edd09;return db[_0x65f6('0xc2')]['find']({'where':{'id':_0x4ecd83[_0x65f6('0x7f')]}});}})[_0x65f6('0x1f')](function(_0x10d421){if(_0x10d421){_0x4427bf=_0x10d421;return db['CmContact'][_0x65f6('0x69')]({'where':{'id':_0x4ecd83[_0x65f6('0x73')]}});}})['then'](function(_0x346aa3){if(_0x346aa3){_0x5e4778=_0x346aa3;if(_0x927c22){var _0x1f4a0d=null;for(var _0x3369b6=0x1;_0x3369b6<_0x4ecd83['Messages'][_0x65f6('0x67')];++_0x3369b6){_0x1f4a0d=_0x4ecd83[_0x65f6('0xef')][_0x3369b6];var _0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?util[_0x65f6('0xeb')](_0x65f6('0xf1'),_0x4427bf[_0x65f6('0xf2')],_0x1f4a0d[_0x65f6('0x7a')]):_0x65f6('0xf3');var _0x128304=_0x53da3a['body'][_0x65f6('0xf4')]||util[_0x65f6('0xeb')](_0x65f6('0xf1'),'Visitor',_0x1f4a0d['ContactId']);switch(_0x4427bf[_0x65f6('0xf5')]){case'website_alias':_0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?util[_0x65f6('0xeb')](_0x65f6('0xf1'),_0x4427bf[_0x65f6('0xf2')],_0x1f4a0d[_0x65f6('0x7a')]):'System';break;case _0x65f6('0xf6'):_0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?_0x1f4a0d[_0x65f6('0xf0')][_0x65f6('0xf7')]||_0x1f4a0d['User'][_0x65f6('0x3c')]:_0x65f6('0xf3');break;case _0x65f6('0xf8'):_0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?_0x1f4a0d[_0x65f6('0xf0')][_0x65f6('0x3c')]:_0x65f6('0xf3');break;default:_0x29656f=_0x1f4a0d[_0x65f6('0x7a')]?util[_0x65f6('0xeb')](_0x65f6('0xf1'),_0x4427bf[_0x65f6('0xf2')],_0x1f4a0d[_0x65f6('0x7a')]):_0x65f6('0xf3');}var _0x31e87d=util[_0x65f6('0xeb')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1f4a0d[_0x65f6('0xf9')])[_0x65f6('0xeb')]('MM/DD/YYYY\x20HH:mm:ss'),_0x1f4a0d['direction']==='in'?_0x128304:_0x29656f,_0x1f4a0d[_0x65f6('0xbe')]);if(!_0x1f4a0d[_0x65f6('0xfa')]){fs[_0x65f6('0xfb')](_0x927c22,_0x31e87d);}}return db[_0x65f6('0xfc')][_0x65f6('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0x65f6('0xfd')],'as':_0x65f6('0xfe'),'raw':!![]}]});}}})['then'](function(_0x2922b9){if(_0x2922b9&&_0x2922b9['Smtp']&&_0x53da3a['body']){var _0x35062f={'tls':{'rejectUnauthorized':![]}};if(_0x2922b9[_0x65f6('0xfe')][_0x65f6('0xff')]){_0x35062f[_0x65f6('0xff')]=_0x2922b9['Smtp']['service'];}else{_0x35062f[_0x65f6('0x100')]=_0x2922b9[_0x65f6('0xfe')]['host'];_0x35062f['port']=_0x2922b9['Smtp'][_0x65f6('0x101')];_0x35062f[_0x65f6('0x102')]=_0x2922b9[_0x65f6('0xfe')][_0x65f6('0x102')];}if(_0x2922b9[_0x65f6('0xfe')]['authentication']){_0x35062f['auth']={'user':_0x2922b9[_0x65f6('0xfe')][_0x65f6('0x9d')],'pass':_0x2922b9[_0x65f6('0xfe')]['pass']};}return respondWithRpcPromise('SendMail',_0x65f6('0x103'),{'account':_0x35062f,'message':{'from':util[_0x65f6('0xeb')]('\x22%s\x22\x20<%s>',_0x2922b9[_0x65f6('0x36')],_0x2922b9[_0x65f6('0xc8')]||_0x2922b9['Smtp'][_0x65f6('0x9d')]),'to':_0x53da3a['body'][_0x65f6('0xe9')],'subject':_0x65f6('0x104'),'text':util[_0x65f6('0xeb')](_0x65f6('0x105'),_0x53da3a[_0x65f6('0xbe')][_0x65f6('0xe9')]),'attachments':[{'path':_0x927c22}]}})['then'](function(){return _0x4ecd83;})[_0x65f6('0x28')](function(_0x31f4ae){console['error'](_0x31f4ae);});}else{return _0x4ecd83;}})[_0x65f6('0x1f')](respondWithStatusCode(_0x33831f,0xc8))[_0x65f6('0x28')](handleError(_0x33831f,null));};exports[_0x65f6('0x106')]=function(_0x4b2f42,_0x491533,_0x322df1){return db[_0x65f6('0xd2')][_0x65f6('0x69')]({'where':{'id':_0x4b2f42[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x491533,null))[_0x65f6('0x1f')](function(_0x5e4078){if(_0x5e4078){return _0x5e4078['addMessage'](_0x4b2f42[_0x65f6('0xbe')][_0x65f6('0x107')],_[_0x65f6('0x108')](_0x4b2f42[_0x65f6('0xbe')],[_0x65f6('0x107'),'id'])||{});}})[_0x65f6('0x1f')](respondWithResult(_0x491533,null))[_0x65f6('0x28')](handleError(_0x491533,null));};exports[_0x65f6('0x109')]=function(_0x201edb,_0x42c4b8,_0x169632){var _0x32f5d5={'raw':![],'where':{}};var _0x594789={};var _0x624c21={'count':0x0,'rows':[]};return db[_0x65f6('0x43')][_0x65f6('0xc3')]({'where':{'id':_0x201edb[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x42c4b8,null))[_0x65f6('0x1f')](function(_0xd00f2f){if(_0xd00f2f){_0x594789[_0x65f6('0x46')]=_[_0x65f6('0x7c')](db[_0x65f6('0xd2')]['rawAttributes']);_0x594789[_0x65f6('0x47')]=_[_0x65f6('0x7c')](_0x201edb[_0x65f6('0x47')]);_0x594789['filters']=_[_0x65f6('0x48')](_0x594789[_0x65f6('0x46')],_0x594789[_0x65f6('0x47')]);_0x32f5d5['attributes']=_['intersection'](_0x594789[_0x65f6('0x46')],qs[_0x65f6('0x4a')](_0x201edb[_0x65f6('0x47')][_0x65f6('0x4a')]));_0x32f5d5[_0x65f6('0x49')]=_0x32f5d5[_0x65f6('0x49')][_0x65f6('0x67')]?_0x32f5d5[_0x65f6('0x49')]:_0x594789[_0x65f6('0x46')];if(!_0x201edb[_0x65f6('0x47')][_0x65f6('0x4b')](_0x65f6('0x4c'))){_0x32f5d5[_0x65f6('0x2f')]=qs[_0x65f6('0x2f')](_0x201edb[_0x65f6('0x47')][_0x65f6('0x2f')]);_0x32f5d5[_0x65f6('0x2d')]=qs[_0x65f6('0x2d')](_0x201edb['query'][_0x65f6('0x2d')]);}_0x32f5d5[_0x65f6('0x4d')]=qs[_0x65f6('0x4e')](_0x201edb[_0x65f6('0x47')]['sort']);_0x32f5d5[_0x65f6('0x80')]=qs['filters'](_[_0x65f6('0x50')](_0x201edb[_0x65f6('0x47')],_0x594789[_0x65f6('0x4f')]));_0x32f5d5[_0x65f6('0x80')][_0x65f6('0xb5')]=_0xd00f2f['id'];if(_0x201edb['query'][_0x65f6('0x10a')]){_0x32f5d5['where']=_['merge'](_0x32f5d5['where'],{'$or':_[_0x65f6('0x3b')](_0x32f5d5['attributes'],function(_0x28caab){var _0x3db2fd={};_0x3db2fd[_0x28caab]={'$like':'%'+_0x201edb[_0x65f6('0x47')][_0x65f6('0x10a')]+'%'};return _0x3db2fd;})});}if(_0x201edb[_0x65f6('0x47')][_0x65f6('0x84')]){var _0x18461c=_0x201edb[_0x65f6('0x47')]['$gte']['split'](',');var _0x13af41={};_0x13af41[_0x18461c[0x0]]={'$gte':moment(_0x18461c[0x1])[_0x65f6('0xeb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x32f5d5[_0x65f6('0x80')]=_['merge'](_0x32f5d5['where'],_0x13af41);}_0x32f5d5=_[_0x65f6('0x37')]({},_0x32f5d5,_0x201edb[_0x65f6('0xbc')]);return db[_0x65f6('0xd2')][_0x65f6('0x30')]({'where':_0x32f5d5[_0x65f6('0x80')]})['then'](function(_0x1bc75c){_0x624c21['count']=_0x1bc75c;if(_0x201edb[_0x65f6('0x47')]['includeAll']){_0x32f5d5['include']=[{'all':!![]}];}return db[_0x65f6('0xd2')][_0x65f6('0x10b')](_0x32f5d5);})[_0x65f6('0x1f')](function(_0x27e5fa){_0x624c21[_0x65f6('0xb7')]=_0x27e5fa;return _0x624c21;});}})[_0x65f6('0x1f')](respondWithFilteredResult(_0x42c4b8,_0x32f5d5))[_0x65f6('0x28')](handleError(_0x42c4b8,null));};exports[_0x65f6('0x10c')]=function(_0x504520,_0xe8f14f,_0x494de7){var _0x13e006={'where':{}},_0x186cf6={},_0x21ce60={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x65f6('0xc3')]({'where':{'id':_0x504520[_0x65f6('0xb9')]['id']}})['then'](handleEntityNotFound(_0xe8f14f,null))[_0x65f6('0x1f')](function(_0x3e1f7c){if(_0x3e1f7c){_0x186cf6[_0x65f6('0x46')]=_[_0x65f6('0x7c')](db[_0x65f6('0xd2')]['rawAttributes']);_0x186cf6[_0x65f6('0x47')]=_[_0x65f6('0x7c')](_0x504520[_0x65f6('0x47')]);_0x186cf6['filters']=_['intersection'](_0x186cf6[_0x65f6('0x46')],_0x186cf6[_0x65f6('0x47')]);_0x13e006[_0x65f6('0x49')]=_[_0x65f6('0x48')](_0x186cf6[_0x65f6('0x46')],qs['fields'](_0x504520['query']['fields']));_0x13e006[_0x65f6('0x49')]=_0x13e006[_0x65f6('0x49')]['length']?_0x13e006['attributes']:_0x186cf6['model'];if(!_0x504520[_0x65f6('0x47')][_0x65f6('0x4b')](_0x65f6('0x4c'))){_0x13e006[_0x65f6('0x2f')]=qs[_0x65f6('0x2f')](_0x504520[_0x65f6('0x47')][_0x65f6('0x2f')]);_0x13e006[_0x65f6('0x2d')]=qs[_0x65f6('0x2d')](_0x504520[_0x65f6('0x47')][_0x65f6('0x2d')]);}_0x13e006[_0x65f6('0x4d')]=qs[_0x65f6('0x4e')](_0x504520[_0x65f6('0x47')][_0x65f6('0x4e')]);_0x13e006['where']=qs[_0x65f6('0x4f')](_[_0x65f6('0x50')](_0x504520[_0x65f6('0x47')],_0x186cf6[_0x65f6('0x4f')]));_0x13e006[_0x65f6('0x80')][_0x65f6('0xb5')]=_0x3e1f7c['id'];if(_0x504520['query'][_0x65f6('0x10a')]){_0x13e006[_0x65f6('0x80')]=_['merge'](_0x13e006['where'],{'$or':_[_0x65f6('0x3b')](_0x13e006['attributes'],function(_0x4fd7ca){var _0x343d7b={};_0x343d7b[_0x4fd7ca]={'$like':'%'+_0x504520[_0x65f6('0x47')]['filter']+'%'};return _0x343d7b;})});}_0x13e006[_0x65f6('0x80')][_0x65f6('0xfa')]=![];if(_0x504520['query']['id']){_0x13e006[_0x65f6('0x80')]['id']={'$gt':_0x504520[_0x65f6('0x47')]['id']};}_0x13e006=_[_0x65f6('0x37')]({},_0x13e006,_0x504520[_0x65f6('0xbc')]);return db[_0x65f6('0xd2')][_0x65f6('0x30')]({'where':_0x13e006[_0x65f6('0x80')]})[_0x65f6('0x1f')](function(_0x443f1f){_0x21ce60['count']=_0x443f1f;_0x13e006[_0x65f6('0xbb')]=[];if(_0x504520[_0x65f6('0x47')][_0x65f6('0x10d')]){_0x13e006[_0x65f6('0xbb')][_0x65f6('0x41')]({'model':db[_0x65f6('0xf0')],'as':'User','attributes':['id',_0x65f6('0x3c'),'alias']});}if(_0x504520['query']['includeAll']){_0x13e006[_0x65f6('0xbb')]=[{'all':!![]}];}return db['ChatMessage'][_0x65f6('0x10b')](_0x13e006);})[_0x65f6('0x1f')](function(_0x285cef){_0x21ce60[_0x65f6('0xb7')]=_0x285cef;return _0x21ce60;});}})[_0x65f6('0x1f')](respondWithFilteredResult(_0xe8f14f,_0x13e006))[_0x65f6('0x28')](handleError(_0xe8f14f,null));};exports[_0x65f6('0x10e')]=function(_0x5a4c42,_0x5db63d,_0x352012){return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x5a4c42['params']['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x5db63d,null))['then'](function(_0x1188a2){if(_0x1188a2){return _0x1188a2[_0x65f6('0x10f')](_0x5a4c42[_0x65f6('0xbe')]['ids'],_[_0x65f6('0x108')](_0x5a4c42[_0x65f6('0xbe')],[_0x65f6('0x107'),'id'])||{})[_0x65f6('0x110')](function(){return db['Tag']['findAll']({'attributes':['id',_0x65f6('0x36'),'color'],'where':{'id':_0x5a4c42[_0x65f6('0xbe')]['ids']}});})[_0x65f6('0x1f')](function(_0x38b1ed){socket[_0x65f6('0x111')]('chatInteractionTags:save',{'id':Number(_0x5a4c42[_0x65f6('0xb9')]['id']),'tags':_0x38b1ed||[]});return{'id':Number(_0x5a4c42[_0x65f6('0xb9')]['id']),'tags':_0x38b1ed||[]};});}})[_0x65f6('0x1f')](respondWithResult(_0x5db63d,null))[_0x65f6('0x28')](handleError(_0x5db63d,null));};exports[_0x65f6('0x112')]=function(_0x5fb1fa,_0x19c8d4,_0x4e40d4){return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0x5fb1fa[_0x65f6('0xb9')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x19c8d4,null))[_0x65f6('0x1f')](function(_0x41da12){if(_0x41da12){return _0x41da12[_0x65f6('0x112')](_0x5fb1fa[_0x65f6('0x47')][_0x65f6('0x107')]);}})['then'](respondWithStatusCode(_0x19c8d4,null))[_0x65f6('0x28')](handleError(_0x19c8d4,null));};exports['download']=function(_0xa3fb44,_0x459924){var _0x286c97=moment()[_0x65f6('0x113')]()[_0x65f6('0xa1')]();var _0x36f46f=path[_0x65f6('0xe3')](config[_0x65f6('0x114')],_0x65f6('0x115'),_0x65f6('0x116'),_0x65f6('0x117'));var _0x38e6ff=path[_0x65f6('0xe3')](config[_0x65f6('0x114')],_0x65f6('0x115'),_0x65f6('0x116'),_0x65f6('0x118'));var _0x560dbb=path[_0x65f6('0xe3')](_0x36f46f,_0x286c97);var _0x2315bc=util['format'](_0x65f6('0x119'),_0xa3fb44[_0x65f6('0xb9')]['id'],_0x286c97);var _0x2eda77=path[_0x65f6('0xe3')](_0x36f46f,_0x2315bc);var _0x2a163e=[];_0x2a163e[_0x65f6('0x41')]({'model':db['User'],'as':'User','attributes':['id',_0x65f6('0x3c')],'raw':!![]});_0x2a163e[_0x65f6('0x41')]({'model':db[_0x65f6('0x11a')],'as':'Contact','attributes':['id',_0x65f6('0x11b'),'lastName'],'raw':!![]});if(_0xa3fb44[_0x65f6('0x47')][_0x65f6('0x118')]){_0x2a163e[_0x65f6('0x41')]({'model':db[_0x65f6('0xdd')],'as':'Attachment','raw':!![]});}var _0x41156f=[{'model':db['ChatMessage'],'as':_0x65f6('0xef'),'attributes':['id',_0x65f6('0xbe'),_0x65f6('0xf9'),'direction',_0x65f6('0xfa'),'read'],'include':_0x2a163e}];_0x41156f['push']({'model':db[_0x65f6('0xc2')],'as':_0x65f6('0x11c'),'attributes':['id',_0x65f6('0x36')]});_0x41156f[_0x65f6('0x41')]({'model':db[_0x65f6('0xf0')],'as':_0x65f6('0x11d'),'attributes':['id',_0x65f6('0x3c')]});return db[_0x65f6('0x43')][_0x65f6('0x69')]({'where':{'id':_0xa3fb44[_0x65f6('0xb9')]['id']},'include':_0x41156f})[_0x65f6('0x1f')](handleEntityNotFound(_0x459924,null))['then'](function(_0x168cac){if(_0x168cac){var _0x5d4415=_0x168cac[_0x65f6('0x11e')]({'plain':!![]});fs[_0x65f6('0x11f')](_0x560dbb);var _0x4943cd={'channel':_0x65f6('0x120'),'account':_0x5d4415[_0x65f6('0x11c')]['name'],'agent':_0x5d4415['Owner']?_0x5d4415[_0x65f6('0x11d')]['fullname']:'N.A.','createdAt':moment(_0x5d4415[_0x65f6('0xf9')])[_0x65f6('0xeb')](_0x65f6('0x121'))[_0x65f6('0xa1')](),'closedAt':_0x5d4415[_0x65f6('0xdf')]?moment(_0x5d4415[_0x65f6('0x122')])[_0x65f6('0xeb')](_0x65f6('0x121'))[_0x65f6('0xa1')]():'','disposition':_0x5d4415['disposition'],'chatInfo':{'browser':_0x5d4415[_0x65f6('0x123')],'os':_0x5d4415[_0x65f6('0x124')],'referer':_0x5d4415['referer'],'customerIp':_0x5d4415[_0x65f6('0x125')],'customerPort':_0x5d4415[_0x65f6('0x126')]?_0x5d4415[_0x65f6('0x126')]:_0x65f6('0x127')},'messages':_(_0x5d4415[_0x65f6('0xef')])[_0x65f6('0x128')]()['filter']({'secret':![]})['map'](function(_0x9d51e3){if(_0x9d51e3[_0x65f6('0xdd')]){var _0x22aac6=path[_0x65f6('0xe3')](_0x38e6ff,_0x9d51e3[_0x65f6('0xdd')]['basename']);if(fs[_0x65f6('0x129')](_0x22aac6)){fs[_0x65f6('0x12a')](_0x22aac6)[_0x65f6('0x12b')](fs[_0x65f6('0x12c')](path[_0x65f6('0xe3')](_0x560dbb,_0x9d51e3[_0x65f6('0xdd')][_0x65f6('0xe6')])));}}return{'date':moment(_0x9d51e3[_0x65f6('0xf9')])[_0x65f6('0xeb')](_0x65f6('0x121'))[_0x65f6('0xa1')](),'sender':_0x9d51e3['direction']===_0x65f6('0xd1')?_0x9d51e3[_0x65f6('0xf0')]?_0x9d51e3['User']['fullname']:_0x65f6('0xf3'):_0x9d51e3[_0x65f6('0x6f')][_0x65f6('0x11b')]+(_0x9d51e3['Contact'][_0x65f6('0x12d')]?'\x20'+_0x9d51e3[_0x65f6('0x6f')][_0x65f6('0x12d')]:''),'body':_0x9d51e3[_0x65f6('0xdd')]?_0x9d51e3[_0x65f6('0xdd')][_0x65f6('0xe6')]:_0x9d51e3[_0x65f6('0xbe')],'direction':_0x9d51e3['direction']===_0x65f6('0xd1')?'A':'C','secret':_0x9d51e3['secret'],'read':_0x9d51e3[_0x65f6('0x89')],'attachment':_0x9d51e3[_0x65f6('0xdd')]};})[_0x65f6('0x6b')]()};return ejs[_0x65f6('0x12e')](path[_0x65f6('0xe3')](config[_0x65f6('0x114')],'server',_0x65f6('0x12f'),'downloadInteraction.ejs'),{'interaction':_0x4943cd})[_0x65f6('0x1f')](function(_0x5081ad){var _0x32829e=path['join'](_0x560dbb,_0x65f6('0x130')+_0x5d4415['id']+'-'+_0x286c97+_0x65f6('0x131'));var _0x3f421f={'path':_0x32829e,'channel':_0x65f6('0x120'),'interactionId':_0x5d4415['id']};return pdf['createPdfFromHTML'](_0x5081ad,_0x3f421f);})[_0x65f6('0x1f')](function(){return new BPromise(function(_0xbf09f6,_0x3d6e08){zipdir(_0x560dbb,{'saveTo':_0x2eda77},function(_0x2c4af8,_0x71483f){if(_0x2c4af8)return _0x3d6e08(_0x2c4af8);return _0xbf09f6(_0x71483f);});})[_0x65f6('0x1f')](function(){return new BPromise(function(_0xd06566,_0x21bf41){rimraf(_0x560dbb,function(_0x538dae){if(_0x538dae)_0x21bf41(_0x538dae);return _0xd06566();});});})['then'](function(){return _0x459924[_0x65f6('0xe7')](_0x2eda77,_0x2315bc,function(_0x121e5b){if(_0x121e5b){console[_0x65f6('0x132')](_0x65f6('0x133'),_0x121e5b);}else{fs['unlinkSync'](_0x2eda77);}});});});}else{return _0x459924[_0x65f6('0x29')](0xc8);}})[_0x65f6('0x28')](handleError(_0x459924,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index b66f2f2..b34ec20 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 _0x1286=['catch','hasOwnProperty','hook','exports','ChatInteraction','../../mysqldb','setMaxListeners','save','then','setDataValue','Users','map','unreadMessages','length','emit'];(function(_0x22187d,_0x1a3192){var _0x4595df=function(_0x5ec0ed){while(--_0x5ec0ed){_0x22187d['push'](_0x22187d['shift']());}};_0x4595df(++_0x1a3192);}(_0x1286,0xa9));var _0x6128=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x1286[_0x581af1];return _0x54c22e;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x6128('0x0')];var ChatMessage=require(_0x6128('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6128('0x2')](0x0);var events={'afterCreate':_0x6128('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x270d00){return function(_0x5ec365,_0x1ed6d3,_0x327c4e){_0x5ec365['getUsers']({'attributes':['id'],'raw':!![]})[_0x6128('0x4')](function(_0x1a4515){_0x5ec365[_0x6128('0x5')](_0x6128('0x6'),_0x1a4515[_0x6128('0x7')](function(_0x1b417a){return{'id':_0x1b417a['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5ec365['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6128('0x4')](function(_0x16adbc){_0x5ec365[_0x6128('0x5')](_0x6128('0x8'),_0x16adbc[_0x6128('0x9')]);ChatInteractionEvents['emit'](_0x270d00+':'+_0x5ec365['id'],_0x5ec365);ChatInteractionEvents[_0x6128('0xa')](_0x270d00,_0x5ec365);_0x327c4e(null);})[_0x6128('0xb')](_0x327c4e(null));};}for(var e in events){if(events[_0x6128('0xc')](e)){var event=events[e];ChatInteraction[_0x6128('0xd')](e,emitEvent(event));}}module[_0x6128('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xb190=['setDataValue','Users','findAll','unreadMessages','length','emit','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then'];(function(_0x5183a1,_0xea76ab){var _0x20919d=function(_0x52f355){while(--_0x52f355){_0x5183a1['push'](_0x5183a1['shift']());}};_0x20919d(++_0xea76ab);}(_0xb190,0x17d));var _0x0b19=function(_0x2eea6f,_0x3690cf){_0x2eea6f=_0x2eea6f-0x0;var _0x2bcabb=_0xb190[_0x2eea6f];return _0x2bcabb;};'use strict';var EventEmitter=require(_0x0b19('0x0'));var ChatInteraction=require(_0x0b19('0x1'))['db'][_0x0b19('0x2')];var ChatMessage=require(_0x0b19('0x1'))['db'][_0x0b19('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0b19('0x4')](0x0);var events={'afterCreate':_0x0b19('0x5'),'afterUpdate':'update','afterDestroy':_0x0b19('0x6')};function emitEvent(_0x42a509){return function(_0x570784,_0x5b08ac,_0x365320){_0x570784[_0x0b19('0x7')]({'attributes':['id'],'raw':!![]})[_0x0b19('0x8')](function(_0xb73cdc){_0x570784[_0x0b19('0x9')](_0x0b19('0xa'),_0xb73cdc['map'](function(_0x154ee9){return{'id':_0x154ee9['id']};}));return ChatMessage[_0x0b19('0xb')]({'where':{'ChatInteractionId':_0x570784['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0b19('0x8')](function(_0x4e1ee3){_0x570784[_0x0b19('0x9')](_0x0b19('0xc'),_0x4e1ee3[_0x0b19('0xd')]);ChatInteractionEvents[_0x0b19('0xe')](_0x42a509+':'+_0x570784['id'],_0x570784);ChatInteractionEvents['emit'](_0x42a509,_0x570784);_0x365320(null);})['catch'](_0x365320(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](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 83d7b25..aba675f 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 _0x29b0=['path','rimraf','./chatInteraction.attributes','exports','define','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x57d7f7,_0x335c81){var _0x1a6800=function(_0x251345){while(--_0x251345){_0x57d7f7['push'](_0x57d7f7['shift']());}};_0x1a6800(++_0x335c81);}(_0x29b0,0x82));var _0x029b=function(_0x555038,_0x159b73){_0x555038=_0x555038-0x0;var _0x4455a0=_0x29b0[_0x555038];return _0x4455a0;};'use strict';var _=require(_0x029b('0x0'));var util=require(_0x029b('0x1'));var logger=require('../../config/logger')(_0x029b('0x2'));var moment=require(_0x029b('0x3'));var BPromise=require(_0x029b('0x4'));var rp=require(_0x029b('0x5'));var fs=require('fs');var path=require(_0x029b('0x6'));var rimraf=require(_0x029b('0x7'));var config=require('../../config/environment');var attributes=require(_0x029b('0x8'));module[_0x029b('0x9')]=function(_0x84c6a9,_0x16468e){return _0x84c6a9[_0x029b('0xa')]('ChatInteraction',attributes,{'tableName':_0x029b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x402f50,_0xdc97b8,_0x181472){if(_0x402f50['changed'](_0x029b('0xc'))){_0x402f50['closedAt']=moment()[_0x029b('0xd')](_0x029b('0xe'));}_0x181472(null,_0x402f50);}},'charset':_0x029b('0xf'),'collate':_0x029b('0x10')});}; \ No newline at end of file +var _0xced7=['utf8mb4','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','closedAt','format'];(function(_0x3520b8,_0x2d2034){var _0x262768=function(_0xd3aab){while(--_0xd3aab){_0x3520b8['push'](_0x3520b8['shift']());}};_0x262768(++_0x2d2034);}(_0xced7,0xaa));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ced('0x0'));var util=require(_0x7ced('0x1'));var logger=require(_0x7ced('0x2'))('api');var moment=require(_0x7ced('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7ced('0x4'));var config=require(_0x7ced('0x5'));var attributes=require(_0x7ced('0x6'));module[_0x7ced('0x7')]=function(_0x4f404a,_0x37b814){return _0x4f404a[_0x7ced('0x8')]('ChatInteraction',attributes,{'tableName':_0x7ced('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38b7ba,_0xdb7297,_0xcfc591){if(_0x38b7ba['changed']('closed')){_0x38b7ba[_0x7ced('0xa')]=moment()[_0x7ced('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0xcfc591(null,_0x38b7ba);}},'charset':_0x7ced('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 010cc91..f9b6170 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 _0x12a0=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./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','stringify','AddTagsToChatInteraction','find','addTags','ids'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x12a0,0x115));var _0x012a=function(_0x545168,_0x215698){_0x545168=_0x545168-0x0;var _0x3d20c8=_0x12a0[_0x545168];return _0x3d20c8;};'use strict';var _=require(_0x012a('0x0'));var util=require(_0x012a('0x1'));var moment=require(_0x012a('0x2'));var BPromise=require(_0x012a('0x3'));var rs=require(_0x012a('0x4'));var fs=require('fs');var Redis=require(_0x012a('0x5'));var db=require(_0x012a('0x6'))['db'];var utils=require(_0x012a('0x7'));var logger=require(_0x012a('0x8'))(_0x012a('0x9'));var config=require(_0x012a('0xa'));var jayson=require(_0x012a('0xb'));var client=jayson[_0x012a('0xc')][_0x012a('0xd')]({'port':0x232a});config[_0x012a('0xe')]=_[_0x012a('0xf')](config['redis'],{'host':_0x012a('0x10'),'port':0x18eb});var socket=require(_0x012a('0x11'))(new Redis(config[_0x012a('0xe')]));require(_0x012a('0x12'))[_0x012a('0x13')](socket);function respondWithRpcPromise(_0x5a1743,_0x3fb68b,_0x3574d5){return new BPromise(function(_0x2bd955,_0x2fca8c){return client[_0x012a('0x14')](_0x5a1743,_0x3574d5)[_0x012a('0x15')](function(_0x306647){logger[_0x012a('0x16')](_0x012a('0x17'),_0x3fb68b,_0x012a('0x18'));logger['debug'](_0x012a('0x19'),_0x3fb68b,_0x012a('0x18'),JSON['stringify'](_0x306647));if(_0x306647['error']){if(_0x306647[_0x012a('0x1a')][_0x012a('0x1b')]===0x1f4){logger[_0x012a('0x1a')](_0x012a('0x17'),_0x3fb68b,_0x306647['error'][_0x012a('0x1c')]);return _0x2fca8c(_0x306647['error']['message']);}logger[_0x012a('0x1a')](_0x012a('0x17'),_0x3fb68b,_0x306647['error']['message']);return _0x2bd955(_0x306647[_0x012a('0x1a')][_0x012a('0x1c')]);}else{logger[_0x012a('0x16')](_0x012a('0x17'),_0x3fb68b,_0x012a('0x18'));_0x2bd955(_0x306647[_0x012a('0x1d')][_0x012a('0x1c')]);}})[_0x012a('0x1e')](function(_0x5ad775){logger[_0x012a('0x1a')](_0x012a('0x17'),_0x3fb68b,_0x5ad775);_0x2fca8c(_0x5ad775);});});}exports[_0x012a('0x1f')]=function(_0x1461a2){var _0x3901f0=this;return new Promise(function(_0x583995,_0x2fc4c3){return db[_0x012a('0x20')][_0x012a('0x21')](_0x1461a2[_0x012a('0x22')],{'raw':_0x1461a2['options']?_0x1461a2[_0x012a('0x23')][_0x012a('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1461a2[_0x012a('0x23')]?_0x1461a2['options'][_0x012a('0x25')]||null:null,'attributes':_0x1461a2['options']?_0x1461a2[_0x012a('0x23')][_0x012a('0x26')]||null:null,'limit':_0x1461a2['options']?_0x1461a2['options']['limit']||null:null})[_0x012a('0x15')](function(_0x52ffb5){logger['info'](_0x012a('0x1f'),_0x1461a2);logger[_0x012a('0x27')](_0x012a('0x1f'),_0x1461a2,JSON[_0x012a('0x28')](_0x52ffb5));_0x583995(_0x52ffb5);})['catch'](function(_0x46fb17){logger[_0x012a('0x1a')](_0x012a('0x1f'),_0x46fb17['message'],_0x1461a2);_0x2fc4c3(_0x3901f0[_0x012a('0x1a')](0x1f4,_0x46fb17[_0x012a('0x1c')]));});});};exports[_0x012a('0x29')]=function(_0x3a2d0b){return new Promise(function(_0x5aa4b0,_0x47db36){return db['ChatInteraction'][_0x012a('0x2a')]({'where':_0x3a2d0b[_0x012a('0x23')]?_0x3a2d0b['options'][_0x012a('0x25')]||null:null})[_0x012a('0x15')](function(_0x468d5a){if(_0x468d5a){return _0x468d5a[_0x012a('0x2b')](_0x3a2d0b[_0x012a('0x22')][_0x012a('0x2c')],_['omit'](_0x3a2d0b[_0x012a('0x22')],['ids','id'])||{});}})['spread'](function(_0x3db439){logger[_0x012a('0x16')](_0x012a('0x2d'),_0x3a2d0b);logger['debug']('AddTags',_0x3a2d0b,JSON[_0x012a('0x28')](_0x3db439));_0x5aa4b0(_0x3db439);})[_0x012a('0x1e')](function(_0x11489c){logger[_0x012a('0x1a')](_0x012a('0x2d'),_0x11489c[_0x012a('0x1c')],_0x3a2d0b);_0x47db36(_this[_0x012a('0x1a')](0x1f4,_0x11489c[_0x012a('0x1c')]));});});}; \ No newline at end of file +var _0x2a31=['limit','AddTagsToChatInteraction','find','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2a31,0x1d4));var _0x12a3=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2a31[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x12a3('0x0'));var util=require('util');var moment=require(_0x12a3('0x1'));var BPromise=require(_0x12a3('0x2'));var rs=require(_0x12a3('0x3'));var fs=require('fs');var Redis=require(_0x12a3('0x4'));var db=require(_0x12a3('0x5'))['db'];var utils=require(_0x12a3('0x6'));var logger=require(_0x12a3('0x7'))(_0x12a3('0x8'));var config=require(_0x12a3('0x9'));var jayson=require(_0x12a3('0xa'));var client=jayson[_0x12a3('0xb')][_0x12a3('0xc')]({'port':0x232a});config[_0x12a3('0xd')]=_['defaults'](config[_0x12a3('0xd')],{'host':_0x12a3('0xe'),'port':0x18eb});var socket=require(_0x12a3('0xf'))(new Redis(config[_0x12a3('0xd')]));require(_0x12a3('0x10'))[_0x12a3('0x11')](socket);function respondWithRpcPromise(_0x1fe705,_0x269573,_0x52aa7e){return new BPromise(function(_0x28bb41,_0x4cc99a){return client[_0x12a3('0x12')](_0x1fe705,_0x52aa7e)[_0x12a3('0x13')](function(_0x29ae26){logger[_0x12a3('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x269573,_0x12a3('0x15'));logger[_0x12a3('0x16')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x269573,'request\x20sent',JSON[_0x12a3('0x17')](_0x29ae26));if(_0x29ae26[_0x12a3('0x18')]){if(_0x29ae26[_0x12a3('0x18')][_0x12a3('0x19')]===0x1f4){logger['error'](_0x12a3('0x1a'),_0x269573,_0x29ae26[_0x12a3('0x18')]['message']);return _0x4cc99a(_0x29ae26[_0x12a3('0x18')][_0x12a3('0x1b')]);}logger['error'](_0x12a3('0x1a'),_0x269573,_0x29ae26['error'][_0x12a3('0x1b')]);return _0x28bb41(_0x29ae26[_0x12a3('0x18')]['message']);}else{logger[_0x12a3('0x14')](_0x12a3('0x1a'),_0x269573,_0x12a3('0x15'));_0x28bb41(_0x29ae26[_0x12a3('0x1c')]['message']);}})[_0x12a3('0x1d')](function(_0x36ac73){logger[_0x12a3('0x18')](_0x12a3('0x1a'),_0x269573,_0x36ac73);_0x4cc99a(_0x36ac73);});});}exports[_0x12a3('0x1e')]=function(_0x34786b){var _0x4e6e8f=this;return new Promise(function(_0x5b8d1b,_0x15978d){return db[_0x12a3('0x1f')][_0x12a3('0x20')](_0x34786b[_0x12a3('0x21')],{'raw':_0x34786b['options']?_0x34786b[_0x12a3('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34786b['options']?_0x34786b[_0x12a3('0x22')][_0x12a3('0x23')]||null:null,'attributes':_0x34786b[_0x12a3('0x22')]?_0x34786b[_0x12a3('0x22')]['attributes']||null:null,'limit':_0x34786b[_0x12a3('0x22')]?_0x34786b[_0x12a3('0x22')][_0x12a3('0x24')]||null:null})[_0x12a3('0x13')](function(_0x38ec8f){logger[_0x12a3('0x14')](_0x12a3('0x1e'),_0x34786b);logger[_0x12a3('0x16')](_0x12a3('0x1e'),_0x34786b,JSON['stringify'](_0x38ec8f));_0x5b8d1b(_0x38ec8f);})[_0x12a3('0x1d')](function(_0x4a0328){logger[_0x12a3('0x18')](_0x12a3('0x1e'),_0x4a0328[_0x12a3('0x1b')],_0x34786b);_0x15978d(_0x4e6e8f[_0x12a3('0x18')](0x1f4,_0x4a0328[_0x12a3('0x1b')]));});});};exports[_0x12a3('0x25')]=function(_0x293933){return new Promise(function(_0x28a475,_0x4df5d2){return db['ChatInteraction'][_0x12a3('0x26')]({'where':_0x293933['options']?_0x293933[_0x12a3('0x22')][_0x12a3('0x23')]||null:null})[_0x12a3('0x13')](function(_0x2c3ea8){if(_0x2c3ea8){return _0x2c3ea8['addTags'](_0x293933['body'][_0x12a3('0x27')],_[_0x12a3('0x28')](_0x293933[_0x12a3('0x21')],['ids','id'])||{});}})['spread'](function(_0x92ec55){logger[_0x12a3('0x14')]('AddTags',_0x293933);logger[_0x12a3('0x16')](_0x12a3('0x29'),_0x293933,JSON[_0x12a3('0x17')](_0x92ec55));_0x28a475(_0x92ec55);})[_0x12a3('0x1d')](function(_0x4cbdff){logger[_0x12a3('0x18')]('AddTags',_0x4cbdff[_0x12a3('0x1b')],_0x293933);_0x4df5d2(_this[_0x12a3('0x18')](0x1f4,_0x4cbdff['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 6e0531a..131952b 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 _0x84f2=['emit','removeListener','register','length','./chatInteraction.events','update'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x84f2,0xe8));var _0x284f=function(_0x349ac1,_0x443243){_0x349ac1=_0x349ac1-0x0;var _0x77840a=_0x84f2[_0x349ac1];return _0x77840a;};'use strict';var ChatInteractionEvents=require(_0x284f('0x0'));var events=['save','remove',_0x284f('0x1')];function createListener(_0x322996,_0x4e2524){return function(_0x43d3b1){_0x4e2524[_0x284f('0x2')](_0x322996,_0x43d3b1);};}function removeListener(_0x467570,_0x5bf7e8){return function(){ChatInteractionEvents[_0x284f('0x3')](_0x467570,_0x5bf7e8);};}exports[_0x284f('0x4')]=function(_0x21d272){for(var _0x2a34bb=0x0,_0x9b1795=events[_0x284f('0x5')];_0x2a34bb<_0x9b1795;_0x2a34bb++){var _0x1245c8=events[_0x2a34bb];var _0x2c0d88=createListener('chatInteraction:'+_0x1245c8,_0x21d272);ChatInteractionEvents['on'](_0x1245c8,_0x2c0d88);}}; \ No newline at end of file +var _0xe35c=['update','removeListener','register','length','./chatInteraction.events','save','remove'];(function(_0x1d9fb2,_0x5ad61a){var _0x1bb0f5=function(_0x4ca2d0){while(--_0x4ca2d0){_0x1d9fb2['push'](_0x1d9fb2['shift']());}};_0x1bb0f5(++_0x5ad61a);}(_0xe35c,0x146));var _0xce35=function(_0x48615d,_0x21e9ee){_0x48615d=_0x48615d-0x0;var _0x3ef212=_0xe35c[_0x48615d];return _0x3ef212;};'use strict';var ChatInteractionEvents=require(_0xce35('0x0'));var events=[_0xce35('0x1'),_0xce35('0x2'),_0xce35('0x3')];function createListener(_0x1ace65,_0x21eade){return function(_0x4f48a7){_0x21eade['emit'](_0x1ace65,_0x4f48a7);};}function removeListener(_0x17648a,_0x4a005b){return function(){ChatInteractionEvents[_0xce35('0x4')](_0x17648a,_0x4a005b);};}exports[_0xce35('0x5')]=function(_0x3a4bb){for(var _0x47e53c=0x0,_0x270b81=events[_0xce35('0x6')];_0x47e53c<_0x270b81;_0x47e53c++){var _0x2b4a82=events[_0x47e53c];var _0x74ae5e=createListener('chatInteraction:'+_0x2b4a82,_0x3a4bb);ChatInteractionEvents['on'](_0x2b4a82,_0x74ae5e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 85e58de..77aa3c0 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 _0xed7a=['removeTags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','create','post','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','delete'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0xed7a,0x115));var _0xaed7=function(_0x565f1f,_0x53a9df){_0x565f1f=_0x565f1f-0x0;var _0x1daf05=_0xed7a[_0x565f1f];return _0x1daf05;};'use strict';var multer=require(_0xaed7('0x0'));var util=require(_0xaed7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaed7('0x2'));var router=express[_0xaed7('0x3')]();var fs_extra=require(_0xaed7('0x4'));var auth=require(_0xaed7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaed7('0x6'));var controller=require(_0xaed7('0x7'));router[_0xaed7('0x8')]('/',auth[_0xaed7('0x9')](),controller[_0xaed7('0xa')]);router['get'](_0xaed7('0xb'),auth['isAuthenticated'](),controller[_0xaed7('0xc')]);router[_0xaed7('0x8')]('/:id',auth[_0xaed7('0xd')](),controller[_0xaed7('0xe')]);router[_0xaed7('0x8')](_0xaed7('0xf'),auth[_0xaed7('0xd')](),controller[_0xaed7('0x10')]);router[_0xaed7('0x8')](_0xaed7('0x11'),auth[_0xaed7('0x9')](),controller[_0xaed7('0x12')]);router[_0xaed7('0x8')](_0xaed7('0x13'),auth[_0xaed7('0xd')](),controller['getMyMessages']);router[_0xaed7('0x8')](_0xaed7('0x14'),auth['isAuthenticated'](),controller[_0xaed7('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaed7('0x16')]);router[_0xaed7('0x17')]('/:id/vidaoo',auth[_0xaed7('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xaed7('0x18')]({'destination':function(_0x4e60a8,_0x15c83c,_0x4bfb5c){_0x4bfb5c(null,path[_0xaed7('0x19')](config[_0xaed7('0x1a')],_0xaed7('0x1b')));},'filename':function(_0x6d7442,_0x1c887c,_0x26a286){_0x26a286(null,util[_0xaed7('0x1c')](_0xaed7('0x1d'),Date[_0xaed7('0x1e')](),_0x1c887c[_0xaed7('0x1f')][_0xaed7('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xaed7('0x17')]('/:id/attachment_upload',upload[_0xaed7('0x21')](_0xaed7('0x22')),controller['attachmentUpload']);router[_0xaed7('0x17')](_0xaed7('0x11'),auth[_0xaed7('0xd')](),controller[_0xaed7('0x23')]);router[_0xaed7('0x17')](_0xaed7('0x24'),auth[_0xaed7('0x9')](),interaction[_0xaed7('0x25')](_0xaed7('0x26'),_0xaed7('0x27')),controller[_0xaed7('0x28')]);router[_0xaed7('0x29')](_0xaed7('0x2a'),auth['isAuthenticated'](),interaction[_0xaed7('0x25')](_0xaed7('0x26'),_0xaed7('0x2b')),controller[_0xaed7('0x2c')]);router[_0xaed7('0x29')](_0xaed7('0x2d'),controller[_0xaed7('0x2e')]);router[_0xaed7('0x29')](_0xaed7('0x2f'),auth[_0xaed7('0xd')](),controller[_0xaed7('0x30')]);router[_0xaed7('0x29')](_0xaed7('0x31'),controller[_0xaed7('0x32')]);router['delete']('/:id',auth[_0xaed7('0x9')](),interaction[_0xaed7('0x25')](_0xaed7('0x26'),_0xaed7('0x33')),controller['destroy']);router[_0xaed7('0x34')](_0xaed7('0x24'),auth['isAuthenticated'](),controller[_0xaed7('0x35')]);module[_0xaed7('0x36')]=router; \ No newline at end of file +var _0xacaf=['isAuthenticated','/:id/my_messages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','put','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xacaf,0x16e));var _0xfaca=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0xacaf[_0x3c487b];return _0x1d65f6;};'use strict';var multer=require('multer');var util=require(_0xfaca('0x0'));var path=require(_0xfaca('0x1'));var timeout=require(_0xfaca('0x2'));var express=require(_0xfaca('0x3'));var router=express[_0xfaca('0x4')]();var fs_extra=require(_0xfaca('0x5'));var auth=require(_0xfaca('0x6'));var interaction=require(_0xfaca('0x7'));var config=require(_0xfaca('0x8'));var controller=require(_0xfaca('0x9'));router[_0xfaca('0xa')]('/',auth['isAuthenticated'](),controller[_0xfaca('0xb')]);router[_0xfaca('0xa')](_0xfaca('0xc'),auth['isAuthenticated'](),controller[_0xfaca('0xd')]);router[_0xfaca('0xa')](_0xfaca('0xe'),auth[_0xfaca('0xf')](),controller[_0xfaca('0x10')]);router[_0xfaca('0xa')](_0xfaca('0x11'),auth[_0xfaca('0xf')](),controller['attachmentDownload']);router[_0xfaca('0xa')](_0xfaca('0x12'),auth[_0xfaca('0x13')](),controller['getMessages']);router[_0xfaca('0xa')](_0xfaca('0x14'),auth[_0xfaca('0xf')](),controller[_0xfaca('0x15')]);router[_0xfaca('0xa')](_0xfaca('0x16'),auth[_0xfaca('0x13')](),controller[_0xfaca('0x17')]);router[_0xfaca('0x18')]('/',auth[_0xfaca('0x13')](),controller['create']);router['post']('/:id/vidaoo',auth[_0xfaca('0x13')](),controller[_0xfaca('0x19')]);var upload=multer({'storage':multer[_0xfaca('0x1a')]({'destination':function(_0x5df611,_0x5a2bd3,_0x4d8696){_0x4d8696(null,path[_0xfaca('0x1b')](config[_0xfaca('0x1c')],_0xfaca('0x1d')));},'filename':function(_0x1ffcac,_0x310151,_0x2f735a){_0x2f735a(null,util['format']('%s-%s',Date[_0xfaca('0x1e')](),_0x310151[_0xfaca('0x1f')][_0xfaca('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfaca('0x18')](_0xfaca('0x21'),upload[_0xfaca('0x22')](_0xfaca('0x23')),controller[_0xfaca('0x24')]);router[_0xfaca('0x18')](_0xfaca('0x12'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0xfaca('0x25'),auth[_0xfaca('0x13')](),interaction[_0xfaca('0x26')](_0xfaca('0x27'),_0xfaca('0x28')),controller[_0xfaca('0x29')]);router['put'](_0xfaca('0xe'),auth[_0xfaca('0x13')](),interaction[_0xfaca('0x26')](_0xfaca('0x27'),_0xfaca('0x2a')),controller[_0xfaca('0x2b')]);router['put'](_0xfaca('0x2c'),controller[_0xfaca('0x2d')]);router[_0xfaca('0x2e')](_0xfaca('0x2f'),auth[_0xfaca('0xf')](),controller[_0xfaca('0x30')]);router[_0xfaca('0x2e')]('/:id/close',controller[_0xfaca('0x31')]);router[_0xfaca('0x32')](_0xfaca('0xe'),auth['isAuthenticated'](),interaction[_0xfaca('0x26')](_0xfaca('0x27'),_0xfaca('0x33')),controller[_0xfaca('0x34')]);router[_0xfaca('0x32')](_0xfaca('0x25'),auth[_0xfaca('0x13')](),controller[_0xfaca('0x35')]);module[_0xfaca('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4a0fb44..c1e3078 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 _0x5571=['medium','BOOLEAN','sequelize','exports','TEXT'];(function(_0x424a4d,_0x2cfc94){var _0x2b043a=function(_0x3b64a4){while(--_0x3b64a4){_0x424a4d['push'](_0x424a4d['shift']());}};_0x2b043a(++_0x2cfc94);}(_0x5571,0x19c));var _0x1557=function(_0x59fc33,_0x2e182d){_0x59fc33=_0x59fc33-0x0;var _0x39066f=_0x5571[_0x59fc33];return _0x39066f;};'use strict';var Sequelize=require(_0x1557('0x0'));module[_0x1557('0x1')]={'body':{'type':Sequelize[_0x1557('0x2')](_0x1557('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1557('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbc7a=['sequelize','exports','BOOLEAN','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbc7a,0xc4));var _0xabc7=function(_0x237f35,_0xb6aa50){_0x237f35=_0x237f35-0x0;var _0x45ea01=_0xbc7a[_0x237f35];return _0x45ea01;};'use strict';var Sequelize=require(_0xabc7('0x0'));module[_0xabc7('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xabc7('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xabc7('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1d0aabb..75e1c8e 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 _0xe635=['lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','ChatInternalMessage','include','findAll','rows','catch','show','params','length','includeAll','create','body','find','describe','get','messages','lastMessageAt','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe635,0x92));var _0x5e63=function(_0x3bf8ac,_0x358931){_0x3bf8ac=_0x3bf8ac-0x0;var _0x2cc39b=_0xe635[_0x3bf8ac];return _0x2cc39b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5e63('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e63('0x1'));var moment=require(_0x5e63('0x2'));var BPromise=require(_0x5e63('0x3'));var Mustache=require(_0x5e63('0x4'));var util=require(_0x5e63('0x5'));var path=require(_0x5e63('0x6'));var sox=require(_0x5e63('0x7'));var csv=require(_0x5e63('0x8'));var ejs=require(_0x5e63('0x9'));var fs=require('fs');var fs_extra=require(_0x5e63('0xa'));var _=require(_0x5e63('0xb'));var squel=require('squel');var crypto=require(_0x5e63('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e63('0x8'));var querystring=require(_0x5e63('0xd'));var Papa=require(_0x5e63('0xe'));var Redis=require(_0x5e63('0xf'));var authService=require(_0x5e63('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5e63('0x11'));var hardwareService=require(_0x5e63('0x12'));var logger=require('../../config/logger')(_0x5e63('0x13'));var utils=require(_0x5e63('0x14'));var config=require(_0x5e63('0x15'));var licenseUtil=require(_0x5e63('0x16'));var db=require(_0x5e63('0x17'))['db'];config[_0x5e63('0x18')]=_[_0x5e63('0x19')](config[_0x5e63('0x18')],{'host':_0x5e63('0x1a'),'port':0x18eb});var socket=require(_0x5e63('0x1b'))(new Redis(config[_0x5e63('0x18')]));require(_0x5e63('0x1c'))[_0x5e63('0x1d')](socket);function respondWithStatusCode(_0xedb8a6,_0x8b3d47){_0x8b3d47=_0x8b3d47||0xcc;return function(_0x375260){if(_0x375260){return _0xedb8a6[_0x5e63('0x1e')](_0x8b3d47);}return _0xedb8a6[_0x5e63('0x1f')](_0x8b3d47)[_0x5e63('0x20')]();};}function respondWithResult(_0x4aa747,_0x29b7da){_0x29b7da=_0x29b7da||0xc8;return function(_0x10a874){if(_0x10a874){return _0x4aa747[_0x5e63('0x1f')](_0x29b7da)[_0x5e63('0x21')](_0x10a874);}};}function respondWithFilteredResult(_0x55f513,_0x5b959e){return function(_0x3b81c2){if(_0x3b81c2){var _0x56ad3a=typeof _0x5b959e[_0x5e63('0x22')]===_0x5e63('0x23')&&typeof _0x5b959e[_0x5e63('0x24')]===_0x5e63('0x23');var _0x27591b=_0x3b81c2[_0x5e63('0x25')];var _0x3cbc17=_0x56ad3a?0x0:_0x5b959e[_0x5e63('0x22')];var _0x2e02ed=_0x56ad3a?_0x3b81c2['count']:_0x5b959e[_0x5e63('0x22')]+_0x5b959e[_0x5e63('0x24')];var _0x4a0103;if(_0x2e02ed>=_0x27591b){_0x2e02ed=_0x27591b;_0x4a0103=0xc8;}else{_0x4a0103=0xce;}_0x55f513[_0x5e63('0x1f')](_0x4a0103);return _0x55f513[_0x5e63('0x26')](_0x5e63('0x27'),_0x3cbc17+'-'+_0x2e02ed+'/'+_0x27591b)[_0x5e63('0x21')](_0x3b81c2);}return null;};}function patchUpdates(_0x1f8113){return function(_0x2d26a5){try{jsonpatch[_0x5e63('0x28')](_0x2d26a5,_0x1f8113,!![]);}catch(_0x2d67c9){return BPromise[_0x5e63('0x29')](_0x2d67c9);}return _0x2d26a5[_0x5e63('0x2a')]();};}function saveUpdates(_0x50a646,_0x4fa277){return function(_0x25a755){if(_0x25a755){return _0x25a755[_0x5e63('0x2b')](_0x50a646)[_0x5e63('0x2c')](function(_0x46ef61){return _0x46ef61;});}return null;};}function removeEntity(_0x27ac58,_0x2c6a4a){return function(_0x3f2d57){if(_0x3f2d57){return _0x3f2d57[_0x5e63('0x2d')]()['then'](function(){_0x27ac58['status'](0xcc)[_0x5e63('0x20')]();});}};}function handleEntityNotFound(_0x2dec4d,_0x5e676c){return function(_0x2914bf){if(!_0x2914bf){_0x2dec4d[_0x5e63('0x1e')](0x194);}return _0x2914bf;};}function handleError(_0x1e55a8,_0x4b2a3b){_0x4b2a3b=_0x4b2a3b||0x1f4;return function(_0xc88538){logger['error'](_0xc88538['stack']);if(_0xc88538[_0x5e63('0x2e')]){delete _0xc88538[_0x5e63('0x2e')];}_0x1e55a8[_0x5e63('0x1f')](_0x4b2a3b)[_0x5e63('0x2f')](_0xc88538);};}exports[_0x5e63('0x30')]=function(_0x291422,_0x264e9c){var _0x168693={},_0xd33173={},_0x485ccc={'count':0x0,'rows':[]};var _0x1ec6c0=_[_0x5e63('0x31')](db['ChatInternalMessage'][_0x5e63('0x32')],function(_0x397f75){return{'name':_0x397f75['fieldName'],'type':_0x397f75[_0x5e63('0x33')][_0x5e63('0x34')]};});_0xd33173[_0x5e63('0x35')]=_[_0x5e63('0x31')](_0x1ec6c0,_0x5e63('0x2e'));_0xd33173[_0x5e63('0x36')]=_[_0x5e63('0x37')](_0x291422[_0x5e63('0x36')]);_0xd33173[_0x5e63('0x38')]=_[_0x5e63('0x39')](_0xd33173['model'],_0xd33173['query']);_0x168693[_0x5e63('0x3a')]=_['intersection'](_0xd33173['model'],qs[_0x5e63('0x3b')](_0x291422[_0x5e63('0x36')][_0x5e63('0x3b')]));_0x168693['attributes']=_0x168693[_0x5e63('0x3a')]['length']?_0x168693[_0x5e63('0x3a')]:_0xd33173[_0x5e63('0x35')];if(!_0x291422['query'][_0x5e63('0x3c')](_0x5e63('0x3d'))){_0x168693['limit']=qs['limit'](_0x291422[_0x5e63('0x36')][_0x5e63('0x24')]);_0x168693[_0x5e63('0x22')]=qs[_0x5e63('0x22')](_0x291422[_0x5e63('0x36')][_0x5e63('0x22')]);}_0x168693['order']=qs[_0x5e63('0x3e')](_0x291422[_0x5e63('0x36')]['sort']);_0x168693[_0x5e63('0x3f')]=qs[_0x5e63('0x38')](_[_0x5e63('0x40')](_0x291422[_0x5e63('0x36')],_0xd33173[_0x5e63('0x38')]),_0x1ec6c0);if(_0x291422['query']['filter']){_0x168693[_0x5e63('0x3f')]=_[_0x5e63('0x41')](_0x168693[_0x5e63('0x3f')],{'$or':_[_0x5e63('0x31')](_0x1ec6c0,function(_0x27f5ee){if(_0x27f5ee[_0x5e63('0x33')]!==_0x5e63('0x42')){var _0xb92873={};_0xb92873[_0x27f5ee[_0x5e63('0x2e')]]={'$like':'%'+_0x291422['query'][_0x5e63('0x43')]+'%'};return _0xb92873;}})});}_0x168693=_[_0x5e63('0x41')]({},_0x168693,_0x291422[_0x5e63('0x44')]);var _0x1daca0={'where':_0x168693[_0x5e63('0x3f')]};return db[_0x5e63('0x45')][_0x5e63('0x25')](_0x1daca0)['then'](function(_0x561b32){_0x485ccc[_0x5e63('0x25')]=_0x561b32;if(_0x291422[_0x5e63('0x36')]['includeAll']){_0x168693[_0x5e63('0x46')]=[{'all':!![]}];}return db[_0x5e63('0x45')][_0x5e63('0x47')](_0x168693);})[_0x5e63('0x2c')](function(_0x195e5f){_0x485ccc[_0x5e63('0x48')]=_0x195e5f;return _0x485ccc;})[_0x5e63('0x2c')](respondWithFilteredResult(_0x264e9c,_0x168693))[_0x5e63('0x49')](handleError(_0x264e9c,null));};exports[_0x5e63('0x4a')]=function(_0xe01bf6,_0x390f93){var _0x2f050a={'raw':!![],'where':{'id':_0xe01bf6[_0x5e63('0x4b')]['id']}},_0x5279fd={};_0x5279fd[_0x5e63('0x35')]=_[_0x5e63('0x37')](db[_0x5e63('0x45')][_0x5e63('0x32')]);_0x5279fd[_0x5e63('0x36')]=_[_0x5e63('0x37')](_0xe01bf6[_0x5e63('0x36')]);_0x5279fd['filters']=_[_0x5e63('0x39')](_0x5279fd[_0x5e63('0x35')],_0x5279fd['query']);_0x2f050a[_0x5e63('0x3a')]=_[_0x5e63('0x39')](_0x5279fd['model'],qs[_0x5e63('0x3b')](_0xe01bf6[_0x5e63('0x36')][_0x5e63('0x3b')]));_0x2f050a[_0x5e63('0x3a')]=_0x2f050a[_0x5e63('0x3a')][_0x5e63('0x4c')]?_0x2f050a[_0x5e63('0x3a')]:_0x5279fd[_0x5e63('0x35')];if(_0xe01bf6[_0x5e63('0x36')][_0x5e63('0x4d')]){_0x2f050a['include']=[{'all':!![]}];}_0x2f050a=_['merge']({},_0x2f050a,_0xe01bf6[_0x5e63('0x44')]);return db[_0x5e63('0x45')]['find'](_0x2f050a)['then'](handleEntityNotFound(_0x390f93,null))[_0x5e63('0x2c')](respondWithResult(_0x390f93,null))[_0x5e63('0x49')](handleError(_0x390f93,null));};exports[_0x5e63('0x4e')]=function(_0x34290f,_0x315015){return db[_0x5e63('0x45')][_0x5e63('0x4e')](_0x34290f[_0x5e63('0x4f')],{})[_0x5e63('0x2c')](respondWithResult(_0x315015,0xc9))[_0x5e63('0x49')](handleError(_0x315015,null));};exports['update']=function(_0x3d2ef5,_0x366c95){if(_0x3d2ef5[_0x5e63('0x4f')]['id']){delete _0x3d2ef5['body']['id'];}return db[_0x5e63('0x45')][_0x5e63('0x50')]({'where':{'id':_0x3d2ef5[_0x5e63('0x4b')]['id']}})[_0x5e63('0x2c')](handleEntityNotFound(_0x366c95,null))[_0x5e63('0x2c')](saveUpdates(_0x3d2ef5[_0x5e63('0x4f')],null))[_0x5e63('0x2c')](respondWithResult(_0x366c95,null))[_0x5e63('0x49')](handleError(_0x366c95,null));};exports['destroy']=function(_0x3650b6,_0x9dd966){return db[_0x5e63('0x45')][_0x5e63('0x50')]({'where':{'id':_0x3650b6[_0x5e63('0x4b')]['id']}})[_0x5e63('0x2c')](handleEntityNotFound(_0x9dd966,null))['then'](removeEntity(_0x9dd966,null))[_0x5e63('0x49')](handleError(_0x9dd966,null));};exports[_0x5e63('0x51')]=function(_0x4463d3,_0x2cdb4c){return db[_0x5e63('0x45')][_0x5e63('0x51')]()[_0x5e63('0x2c')](respondWithResult(_0x2cdb4c,null))[_0x5e63('0x49')](handleError(_0x2cdb4c,null));};function wrapUser(_0xeab5af){return function(_0x2bcd1a){var _0x5118f6=_0xeab5af[_0x5e63('0x52')]({'plain':!![]});_0x5118f6[_0x5e63('0x53')]=[];if(_0x2bcd1a){_0x5118f6[_0x5e63('0x54')]=_0x2bcd1a[_0x5e63('0x55')];_0x5118f6[_0x5e63('0x56')]=_0x2bcd1a;}else{_0x5118f6[_0x5e63('0x54')]=moment(0x0)[_0x5e63('0x57')](_0x5e63('0x58'));_0x5118f6[_0x5e63('0x56')]={};}return _0x5118f6;};}exports[_0x5e63('0x59')]=function(_0x148b8c,_0x378f04,_0x545d61){var _0x427c11=[];return db[_0x5e63('0x5a')]['findAll']({'where':{'role':[_0x5e63('0x5b'),_0x5e63('0x5c'),_0x5e63('0x5d')]},'attributes':['id','fullname',_0x5e63('0x2e'),_0x5e63('0x5e'),_0x5e63('0x5f'),'internal',_0x5e63('0x60'),_0x5e63('0x61'),_0x5e63('0x62'),_0x5e63('0x63')],'order':qs[_0x5e63('0x3e')](_0x5e63('0x64')),'include':[{'model':db[_0x5e63('0x65')],'as':_0x5e63('0x66'),'attributes':['id',_0x5e63('0x2e'),_0x5e63('0x33')],'through':{'attributes':[]}}]})[_0x5e63('0x2c')](function(_0x3a0eb8){if(_0x3a0eb8){var _0x46314b=_0x148b8c[_0x5e63('0x5d')][_0x5e63('0x52')]({'plain':!![]});if(!_0x46314b)throw new Error(_0x5e63('0x67'));if(_0x46314b['role']===_0x5e63('0x5d')){return db[_0x5e63('0x68')]['find']({'where':{'name':_0x5e63('0x69'),'userProfileId':_0x46314b['userProfileId']},'raw':!![]})[_0x5e63('0x2c')](function(_0x51c23c){if(_0x51c23c){if(_0x51c23c[_0x5e63('0x6a')]===0x0){return db[_0x5e63('0x6b')]['findAll']({'where':{'sectionId':_0x51c23c['id']},'raw':!![]})['then'](function(_0xf46a59){var _0x195aa0=[];if(_[_0x5e63('0x6c')](_0xf46a59)){_0x195aa0=_['filter'](_0x3a0eb8,function(_0x4b5f18){if(_0x4b5f18[_0x5e63('0x5e')]!==_0x5e63('0x5b')){return _0x4b5f18;}});return _0x195aa0;}else{for(var _0x2c075b=0x0;_0x2c075b<_0x3a0eb8[_0x5e63('0x4c')];_0x2c075b++){var _0x4d5369=_0x3a0eb8[_0x2c075b];if(_0x4d5369[_0x5e63('0x5e')]===_0x5e63('0x5b')){var _0x4a6d0c=_[_0x5e63('0x50')](_0xf46a59,function(_0x2e1aa9){return _0x2e1aa9[_0x5e63('0x6d')]===_0x4d5369['id'];});if(_0x4a6d0c)_0x195aa0[_0x5e63('0x6e')](_0x4d5369);}else{_0x195aa0[_0x5e63('0x6e')](_0x4d5369);}}return _0x195aa0;}});}else{return _0x3a0eb8;}}else{var _0x4243e6=_[_0x5e63('0x43')](_0x3a0eb8,function(_0x7bd452){if(_0x7bd452[_0x5e63('0x5e')]!=='agent'){return _0x7bd452;}});return _0x4243e6;}});}else{return _0x3a0eb8;}}})['then'](function(_0x57bd46){var _0x57ba41=[];if(_0x57bd46){_0x427c11=_0x57bd46;for(var _0x293158=0x0;_0x293158<_0x57bd46['length'];_0x293158+=0x1){_0x427c11[_0x293158][_0x5e63('0x53')]=[];_0x57ba41[_0x5e63('0x6e')](db[_0x5e63('0x45')][_0x5e63('0x50')]({'where':{'FromId':[_0x148b8c[_0x5e63('0x5d')]['id'],_0x57bd46[_0x293158]['id']],'ToId':[_0x148b8c[_0x5e63('0x5d')]['id'],_0x57bd46[_0x293158]['id']],'ChatGroupId':null},'attributes':['id',_0x5e63('0x55'),_0x5e63('0x6f'),_0x5e63('0x70'),_0x5e63('0x71'),'body'],'order':qs[_0x5e63('0x3e')](_0x5e63('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5e63('0x2c')](wrapUser(_0x57bd46[_0x293158])));}return BPromise[_0x5e63('0x73')](_0x57ba41);}return[];})[_0x5e63('0x2c')](function(_0x10ff41){return{'rows':_0x10ff41,'count':_0x10ff41[_0x5e63('0x4c')]};})[_0x5e63('0x2c')](respondWithResult(_0x378f04,null))[_0x5e63('0x49')](handleError(_0x378f04,null));}; \ No newline at end of file +var _0x791e=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','name','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','ChatInternalMessage','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','UserProfileResource','isEmpty','agent','resourceId','push','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x35341c,_0xeaa63c){var _0x5d6c26=function(_0x3e6d95){while(--_0x3e6d95){_0x35341c['push'](_0x35341c['shift']());}};_0x5d6c26(++_0xeaa63c);}(_0x791e,0x12c));var _0xe791=function(_0x7b3852,_0x45b5ab){_0x7b3852=_0x7b3852-0x0;var _0x453416=_0x791e[_0x7b3852];return _0x453416;};'use strict';var emlformat=require(_0xe791('0x0'));var rimraf=require(_0xe791('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe791('0x2'));var rp=require('request-promise');var moment=require(_0xe791('0x3'));var BPromise=require(_0xe791('0x4'));var Mustache=require(_0xe791('0x5'));var util=require(_0xe791('0x6'));var path=require(_0xe791('0x7'));var sox=require(_0xe791('0x8'));var csv=require(_0xe791('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe791('0xa'));var crypto=require(_0xe791('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe791('0xc'));var toCsv=require(_0xe791('0x9'));var querystring=require(_0xe791('0xd'));var Papa=require(_0xe791('0xe'));var Redis=require(_0xe791('0xf'));var authService=require(_0xe791('0x10'));var qs=require(_0xe791('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe791('0x12'));var logger=require('../../config/logger')(_0xe791('0x13'));var utils=require(_0xe791('0x14'));var config=require(_0xe791('0x15'));var licenseUtil=require(_0xe791('0x16'));var db=require(_0xe791('0x17'))['db'];config[_0xe791('0x18')]=_[_0xe791('0x19')](config[_0xe791('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe791('0x1a'))(new Redis(config[_0xe791('0x18')]));require(_0xe791('0x1b'))['register'](socket);function respondWithStatusCode(_0x5cb2ac,_0x2fd267){_0x2fd267=_0x2fd267||0xcc;return function(_0x187ba8){if(_0x187ba8){return _0x5cb2ac[_0xe791('0x1c')](_0x2fd267);}return _0x5cb2ac[_0xe791('0x1d')](_0x2fd267)[_0xe791('0x1e')]();};}function respondWithResult(_0xfa2f3b,_0x151f8c){_0x151f8c=_0x151f8c||0xc8;return function(_0x49b233){if(_0x49b233){return _0xfa2f3b[_0xe791('0x1d')](_0x151f8c)[_0xe791('0x1f')](_0x49b233);}};}function respondWithFilteredResult(_0x28cbf2,_0x54649b){return function(_0x105143){if(_0x105143){var _0x40e0b4=typeof _0x54649b[_0xe791('0x20')]===_0xe791('0x21')&&typeof _0x54649b[_0xe791('0x22')]===_0xe791('0x21');var _0xdcf77b=_0x105143[_0xe791('0x23')];var _0xd7c44a=_0x40e0b4?0x0:_0x54649b[_0xe791('0x20')];var _0x4e398c=_0x40e0b4?_0x105143[_0xe791('0x23')]:_0x54649b[_0xe791('0x20')]+_0x54649b[_0xe791('0x22')];var _0x2c92cb;if(_0x4e398c>=_0xdcf77b){_0x4e398c=_0xdcf77b;_0x2c92cb=0xc8;}else{_0x2c92cb=0xce;}_0x28cbf2[_0xe791('0x1d')](_0x2c92cb);return _0x28cbf2[_0xe791('0x24')](_0xe791('0x25'),_0xd7c44a+'-'+_0x4e398c+'/'+_0xdcf77b)['json'](_0x105143);}return null;};}function patchUpdates(_0x2df581){return function(_0x286d32){try{jsonpatch['apply'](_0x286d32,_0x2df581,!![]);}catch(_0x314173){return BPromise['reject'](_0x314173);}return _0x286d32['save']();};}function saveUpdates(_0xb1af00,_0x1b0ae2){return function(_0x5258a0){if(_0x5258a0){return _0x5258a0[_0xe791('0x26')](_0xb1af00)[_0xe791('0x27')](function(_0x56df3){return _0x56df3;});}return null;};}function removeEntity(_0x2d8063,_0x13ddeb){return function(_0x4cdf70){if(_0x4cdf70){return _0x4cdf70['destroy']()[_0xe791('0x27')](function(){_0x2d8063[_0xe791('0x1d')](0xcc)[_0xe791('0x1e')]();});}};}function handleEntityNotFound(_0x4eff12,_0x2d7cd7){return function(_0x4a0e16){if(!_0x4a0e16){_0x4eff12[_0xe791('0x1c')](0x194);}return _0x4a0e16;};}function handleError(_0x4426c5,_0xd19178){_0xd19178=_0xd19178||0x1f4;return function(_0x476703){logger['error'](_0x476703['stack']);if(_0x476703[_0xe791('0x28')]){delete _0x476703[_0xe791('0x28')];}_0x4426c5['status'](_0xd19178)['send'](_0x476703);};}exports['index']=function(_0x1b208d,_0x461f4f){var _0x5d2e6a={},_0x530d38={},_0x233b6a={'count':0x0,'rows':[]};var _0x424949=_[_0xe791('0x29')](db['ChatInternalMessage'][_0xe791('0x2a')],function(_0x563cf9){return{'name':_0x563cf9['fieldName'],'type':_0x563cf9['type'][_0xe791('0x2b')]};});_0x530d38[_0xe791('0x2c')]=_[_0xe791('0x29')](_0x424949,'name');_0x530d38[_0xe791('0x2d')]=_[_0xe791('0x2e')](_0x1b208d['query']);_0x530d38[_0xe791('0x2f')]=_[_0xe791('0x30')](_0x530d38[_0xe791('0x2c')],_0x530d38[_0xe791('0x2d')]);_0x5d2e6a[_0xe791('0x31')]=_['intersection'](_0x530d38[_0xe791('0x2c')],qs[_0xe791('0x32')](_0x1b208d[_0xe791('0x2d')][_0xe791('0x32')]));_0x5d2e6a[_0xe791('0x31')]=_0x5d2e6a[_0xe791('0x31')][_0xe791('0x33')]?_0x5d2e6a[_0xe791('0x31')]:_0x530d38['model'];if(!_0x1b208d[_0xe791('0x2d')]['hasOwnProperty'](_0xe791('0x34'))){_0x5d2e6a[_0xe791('0x22')]=qs[_0xe791('0x22')](_0x1b208d[_0xe791('0x2d')][_0xe791('0x22')]);_0x5d2e6a['offset']=qs[_0xe791('0x20')](_0x1b208d[_0xe791('0x2d')]['offset']);}_0x5d2e6a['order']=qs['sort'](_0x1b208d[_0xe791('0x2d')][_0xe791('0x35')]);_0x5d2e6a[_0xe791('0x36')]=qs[_0xe791('0x2f')](_[_0xe791('0x37')](_0x1b208d[_0xe791('0x2d')],_0x530d38[_0xe791('0x2f')]),_0x424949);if(_0x1b208d[_0xe791('0x2d')]['filter']){_0x5d2e6a[_0xe791('0x36')]=_[_0xe791('0x38')](_0x5d2e6a['where'],{'$or':_[_0xe791('0x29')](_0x424949,function(_0x5cbaaa){if(_0x5cbaaa['type']!==_0xe791('0x39')){var _0x106251={};_0x106251[_0x5cbaaa[_0xe791('0x28')]]={'$like':'%'+_0x1b208d[_0xe791('0x2d')][_0xe791('0x3a')]+'%'};return _0x106251;}})});}_0x5d2e6a=_[_0xe791('0x38')]({},_0x5d2e6a,_0x1b208d['options']);var _0x436b0d={'where':_0x5d2e6a[_0xe791('0x36')]};return db[_0xe791('0x3b')]['count'](_0x436b0d)[_0xe791('0x27')](function(_0x1744bb){_0x233b6a['count']=_0x1744bb;if(_0x1b208d['query'][_0xe791('0x3c')]){_0x5d2e6a[_0xe791('0x3d')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xe791('0x3e')](_0x5d2e6a);})[_0xe791('0x27')](function(_0x345e8f){_0x233b6a[_0xe791('0x3f')]=_0x345e8f;return _0x233b6a;})[_0xe791('0x27')](respondWithFilteredResult(_0x461f4f,_0x5d2e6a))['catch'](handleError(_0x461f4f,null));};exports[_0xe791('0x40')]=function(_0x21b5fa,_0x4cf39b){var _0x570b4b={'raw':!![],'where':{'id':_0x21b5fa[_0xe791('0x41')]['id']}},_0x5d980d={};_0x5d980d[_0xe791('0x2c')]=_[_0xe791('0x2e')](db[_0xe791('0x3b')][_0xe791('0x2a')]);_0x5d980d[_0xe791('0x2d')]=_[_0xe791('0x2e')](_0x21b5fa['query']);_0x5d980d[_0xe791('0x2f')]=_[_0xe791('0x30')](_0x5d980d[_0xe791('0x2c')],_0x5d980d['query']);_0x570b4b['attributes']=_[_0xe791('0x30')](_0x5d980d[_0xe791('0x2c')],qs[_0xe791('0x32')](_0x21b5fa[_0xe791('0x2d')]['fields']));_0x570b4b[_0xe791('0x31')]=_0x570b4b[_0xe791('0x31')][_0xe791('0x33')]?_0x570b4b[_0xe791('0x31')]:_0x5d980d[_0xe791('0x2c')];if(_0x21b5fa[_0xe791('0x2d')][_0xe791('0x3c')]){_0x570b4b[_0xe791('0x3d')]=[{'all':!![]}];}_0x570b4b=_[_0xe791('0x38')]({},_0x570b4b,_0x21b5fa[_0xe791('0x42')]);return db[_0xe791('0x3b')][_0xe791('0x43')](_0x570b4b)[_0xe791('0x27')](handleEntityNotFound(_0x4cf39b,null))[_0xe791('0x27')](respondWithResult(_0x4cf39b,null))[_0xe791('0x44')](handleError(_0x4cf39b,null));};exports[_0xe791('0x45')]=function(_0x189dd9,_0xd19aeb){return db[_0xe791('0x3b')][_0xe791('0x45')](_0x189dd9['body'],{})[_0xe791('0x27')](respondWithResult(_0xd19aeb,0xc9))[_0xe791('0x44')](handleError(_0xd19aeb,null));};exports['update']=function(_0x484403,_0x5ef391){if(_0x484403[_0xe791('0x46')]['id']){delete _0x484403[_0xe791('0x46')]['id'];}return db['ChatInternalMessage'][_0xe791('0x43')]({'where':{'id':_0x484403['params']['id']}})[_0xe791('0x27')](handleEntityNotFound(_0x5ef391,null))[_0xe791('0x27')](saveUpdates(_0x484403[_0xe791('0x46')],null))['then'](respondWithResult(_0x5ef391,null))[_0xe791('0x44')](handleError(_0x5ef391,null));};exports['destroy']=function(_0x139489,_0x575b14){return db[_0xe791('0x3b')][_0xe791('0x43')]({'where':{'id':_0x139489[_0xe791('0x41')]['id']}})['then'](handleEntityNotFound(_0x575b14,null))['then'](removeEntity(_0x575b14,null))[_0xe791('0x44')](handleError(_0x575b14,null));};exports['describe']=function(_0x2e2dfb,_0x10d247){return db[_0xe791('0x3b')][_0xe791('0x47')]()['then'](respondWithResult(_0x10d247,null))[_0xe791('0x44')](handleError(_0x10d247,null));};function wrapUser(_0x1cedad){return function(_0x2abd97){var _0x233023=_0x1cedad['get']({'plain':!![]});_0x233023[_0xe791('0x48')]=[];if(_0x2abd97){_0x233023[_0xe791('0x49')]=_0x2abd97['createdAt'];_0x233023[_0xe791('0x4a')]=_0x2abd97;}else{_0x233023[_0xe791('0x49')]=moment(0x0)[_0xe791('0x4b')](_0xe791('0x4c'));_0x233023[_0xe791('0x4a')]={};}return _0x233023;};}exports[_0xe791('0x4d')]=function(_0x496e53,_0x550b45,_0x5b8758){var _0x29f99e=[];return db[_0xe791('0x4e')][_0xe791('0x3e')]({'where':{'role':['agent',_0xe791('0x4f'),_0xe791('0x50')]},'attributes':['id',_0xe791('0x51'),_0xe791('0x28'),_0xe791('0x52'),_0xe791('0x53'),_0xe791('0x54'),_0xe791('0x55'),_0xe791('0x56'),_0xe791('0x57'),_0xe791('0x58')],'order':qs['sort'](_0xe791('0x59')),'include':[{'model':db[_0xe791('0x5a')],'as':_0xe791('0x5b'),'attributes':['id',_0xe791('0x28'),_0xe791('0x5c')],'through':{'attributes':[]}}]})[_0xe791('0x27')](function(_0x4c80b8){if(_0x4c80b8){var _0x5bb581=_0x496e53['user'][_0xe791('0x5d')]({'plain':!![]});if(!_0x5bb581)throw new Error(_0xe791('0x5e'));if(_0x5bb581[_0xe791('0x52')]==='user'){return db[_0xe791('0x5f')][_0xe791('0x43')]({'where':{'name':_0xe791('0x60'),'userProfileId':_0x5bb581['userProfileId']},'raw':!![]})[_0xe791('0x27')](function(_0x25558c){if(_0x25558c){if(_0x25558c['autoAssociation']===0x0){return db[_0xe791('0x61')]['findAll']({'where':{'sectionId':_0x25558c['id']},'raw':!![]})[_0xe791('0x27')](function(_0x56dbbc){var _0x1a0d2f=[];if(_[_0xe791('0x62')](_0x56dbbc)){_0x1a0d2f=_['filter'](_0x4c80b8,function(_0x16eb5f){if(_0x16eb5f[_0xe791('0x52')]!==_0xe791('0x63')){return _0x16eb5f;}});return _0x1a0d2f;}else{for(var _0x324bf0=0x0;_0x324bf0<_0x4c80b8['length'];_0x324bf0++){var _0xbcc645=_0x4c80b8[_0x324bf0];if(_0xbcc645['role']===_0xe791('0x63')){var _0x5c59ac=_[_0xe791('0x43')](_0x56dbbc,function(_0xcaf62b){return _0xcaf62b[_0xe791('0x64')]===_0xbcc645['id'];});if(_0x5c59ac)_0x1a0d2f['push'](_0xbcc645);}else{_0x1a0d2f[_0xe791('0x65')](_0xbcc645);}}return _0x1a0d2f;}});}else{return _0x4c80b8;}}else{var _0xdbf914=_['filter'](_0x4c80b8,function(_0x5c9574){if(_0x5c9574[_0xe791('0x52')]!==_0xe791('0x63')){return _0x5c9574;}});return _0xdbf914;}});}else{return _0x4c80b8;}}})[_0xe791('0x27')](function(_0xbc1537){var _0x2d21ed=[];if(_0xbc1537){_0x29f99e=_0xbc1537;for(var _0x389781=0x0;_0x389781<_0xbc1537[_0xe791('0x33')];_0x389781+=0x1){_0x29f99e[_0x389781][_0xe791('0x48')]=[];_0x2d21ed[_0xe791('0x65')](db[_0xe791('0x3b')]['find']({'where':{'FromId':[_0x496e53[_0xe791('0x50')]['id'],_0xbc1537[_0x389781]['id']],'ToId':[_0x496e53[_0xe791('0x50')]['id'],_0xbc1537[_0x389781]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0xe791('0x66'),_0xe791('0x67'),_0xe791('0x46')],'order':qs[_0xe791('0x35')](_0xe791('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe791('0x27')](wrapUser(_0xbc1537[_0x389781])));}return BPromise[_0xe791('0x69')](_0x2d21ed);}return[];})[_0xe791('0x27')](function(_0x4bdeec){return{'rows':_0x4bdeec,'count':_0x4bdeec[_0xe791('0x33')]};})['then'](respondWithResult(_0x550b45,null))[_0xe791('0x44')](handleError(_0x550b45,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1f46ff9..f5e5217 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 _0xbe81=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove','emit'];(function(_0x404e3f,_0x16fe94){var _0x2883f2=function(_0x202c10){while(--_0x202c10){_0x404e3f['push'](_0x404e3f['shift']());}};_0x2883f2(++_0x16fe94);}(_0xbe81,0x1a9));var _0x1be8=function(_0x284885,_0x34b143){_0x284885=_0x284885-0x0;var _0x3a9710=_0xbe81[_0x284885];return _0x3a9710;};'use strict';var EventEmitter=require(_0x1be8('0x0'));var ChatInternalMessage=require(_0x1be8('0x1'))['db'][_0x1be8('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1be8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1be8('0x4'),'afterDestroy':_0x1be8('0x5')};function emitEvent(_0x146ae4){return function(_0x538d76,_0x112f0a,_0xf0a849){ChatInternalMessageEvents[_0x1be8('0x6')](_0x146ae4+':'+_0x538d76['id'],_0x538d76);ChatInternalMessageEvents['emit'](_0x146ae4,_0x538d76);_0xf0a849(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x1be8('0x7')](e,emitEvent(event));}}module[_0x1be8('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xd92e=['../../mysqldb','ChatInternalMessage','save','remove','emit','exports'];(function(_0x58383f,_0x3ec27a){var _0x339915=function(_0x58e57d){while(--_0x58e57d){_0x58383f['push'](_0x58383f['shift']());}};_0x339915(++_0x3ec27a);}(_0xd92e,0x1bc));var _0xed92=function(_0x57d91a,_0x3b2dc4){_0x57d91a=_0x57d91a-0x0;var _0x2a6c8d=_0xd92e[_0x57d91a];return _0x2a6c8d;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xed92('0x0'))['db'][_0xed92('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed92('0x2'),'afterUpdate':'update','afterDestroy':_0xed92('0x3')};function emitEvent(_0x462df3){return function(_0xdae6d9,_0x5b26fe,_0x3473b8){ChatInternalMessageEvents[_0xed92('0x4')](_0x462df3+':'+_0xdae6d9['id'],_0xdae6d9);ChatInternalMessageEvents['emit'](_0x462df3,_0xdae6d9);_0x3473b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xed92('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8dc27a2..4978d35 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 _0xcf64=['bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x2af235,_0x45f664){var _0x593c0e=function(_0x1b12d4){while(--_0x1b12d4){_0x2af235['push'](_0x2af235['shift']());}};_0x593c0e(++_0x45f664);}(_0xcf64,0x15d));var _0x4cf6=function(_0x532c48,_0x50da8d){_0x532c48=_0x532c48-0x0;var _0x40e965=_0xcf64[_0x532c48];return _0x40e965;};'use strict';var _=require(_0x4cf6('0x0'));var util=require(_0x4cf6('0x1'));var logger=require('../../config/logger')(_0x4cf6('0x2'));var moment=require('moment');var BPromise=require(_0x4cf6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4cf6('0x4'));var config=require(_0x4cf6('0x5'));var attributes=require(_0x4cf6('0x6'));module[_0x4cf6('0x7')]=function(_0x270e31,_0x1360cf){return _0x270e31[_0x4cf6('0x8')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4cf6('0x9'),'collate':_0x4cf6('0xa')});}; \ No newline at end of file +var _0x1bd8=['request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1bd8,0x101));var _0x81bd=function(_0x458072,_0x10113f){_0x458072=_0x458072-0x0;var _0x2ad34b=_0x1bd8[_0x458072];return _0x2ad34b;};'use strict';var _=require('lodash');var util=require(_0x81bd('0x0'));var logger=require(_0x81bd('0x1'))(_0x81bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x81bd('0x3'));var fs=require('fs');var path=require(_0x81bd('0x4'));var rimraf=require('rimraf');var config=require(_0x81bd('0x5'));var attributes=require(_0x81bd('0x6'));module[_0x81bd('0x7')]=function(_0x19a7eb,_0x318d9f){return _0x19a7eb[_0x81bd('0x8')](_0x81bd('0x9'),attributes,{'tableName':_0x81bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x81bd('0xb'),'collate':_0x81bd('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9150169..d8b90a3 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 _0x309d=['rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x309d,0x1ed));var _0xd309=function(_0x1230b2,_0x21e0f1){_0x1230b2=_0x1230b2-0x0;var _0x1902f5=_0x309d[_0x1230b2];return _0x1902f5;};'use strict';var _=require(_0xd309('0x0'));var util=require(_0xd309('0x1'));var moment=require(_0xd309('0x2'));var BPromise=require(_0xd309('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd309('0x4'));var db=require(_0xd309('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd309('0x6'))(_0xd309('0x7'));var config=require(_0xd309('0x8'));var jayson=require(_0xd309('0x9'));var client=jayson[_0xd309('0xa')][_0xd309('0xb')]({'port':0x232a});config[_0xd309('0xc')]=_['defaults'](config[_0xd309('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd309('0xd'))(new Redis(config[_0xd309('0xc')]));require(_0xd309('0xe'))['register'](socket);function respondWithRpcPromise(_0x148422,_0x4a3a5a,_0x46d643){return new BPromise(function(_0x125aae,_0x22197a){return client[_0xd309('0xf')](_0x148422,_0x46d643)[_0xd309('0x10')](function(_0x346b47){logger[_0xd309('0x11')](_0xd309('0x12'),_0x4a3a5a,_0xd309('0x13'));logger[_0xd309('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4a3a5a,_0xd309('0x13'),JSON['stringify'](_0x346b47));if(_0x346b47[_0xd309('0x15')]){if(_0x346b47[_0xd309('0x15')]['code']===0x1f4){logger[_0xd309('0x15')](_0xd309('0x12'),_0x4a3a5a,_0x346b47[_0xd309('0x15')][_0xd309('0x16')]);return _0x22197a(_0x346b47[_0xd309('0x15')][_0xd309('0x16')]);}logger[_0xd309('0x15')](_0xd309('0x12'),_0x4a3a5a,_0x346b47[_0xd309('0x15')][_0xd309('0x16')]);return _0x125aae(_0x346b47[_0xd309('0x15')][_0xd309('0x16')]);}else{logger['info'](_0xd309('0x12'),_0x4a3a5a,'request\x20sent');_0x125aae(_0x346b47[_0xd309('0x17')]['message']);}})[_0xd309('0x18')](function(_0x4d856a){logger[_0xd309('0x15')](_0xd309('0x12'),_0x4a3a5a,_0x4d856a);_0x22197a(_0x4d856a);});});} \ No newline at end of file +var _0x7fc4=['result','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x30f97a,_0x3aaa1d){var _0x33a768=function(_0x2fe70e){while(--_0x2fe70e){_0x30f97a['push'](_0x30f97a['shift']());}};_0x33a768(++_0x3aaa1d);}(_0x7fc4,0x1cf));var _0x47fc=function(_0x45c039,_0x34e2ff){_0x45c039=_0x45c039-0x0;var _0x3e020c=_0x7fc4[_0x45c039];return _0x3e020c;};'use strict';var _=require('lodash');var util=require(_0x47fc('0x0'));var moment=require('moment');var BPromise=require(_0x47fc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47fc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x47fc('0x3'));var logger=require(_0x47fc('0x4'))(_0x47fc('0x5'));var config=require('../../config/environment');var jayson=require(_0x47fc('0x6'));var client=jayson[_0x47fc('0x7')][_0x47fc('0x8')]({'port':0x232a});config[_0x47fc('0x9')]=_['defaults'](config[_0x47fc('0x9')],{'host':_0x47fc('0xa'),'port':0x18eb});var socket=require(_0x47fc('0xb'))(new Redis(config[_0x47fc('0x9')]));require(_0x47fc('0xc'))[_0x47fc('0xd')](socket);function respondWithRpcPromise(_0x40cfc5,_0x12b117,_0x538a74){return new BPromise(function(_0x4c9e4c,_0x2b25e1){return client['request'](_0x40cfc5,_0x538a74)[_0x47fc('0xe')](function(_0x12880e){logger['info'](_0x47fc('0xf'),_0x12b117,_0x47fc('0x10'));logger['debug'](_0x47fc('0x11'),_0x12b117,_0x47fc('0x10'),JSON['stringify'](_0x12880e));if(_0x12880e['error']){if(_0x12880e['error']['code']===0x1f4){logger[_0x47fc('0x12')](_0x47fc('0xf'),_0x12b117,_0x12880e['error'][_0x47fc('0x13')]);return _0x2b25e1(_0x12880e[_0x47fc('0x12')][_0x47fc('0x13')]);}logger[_0x47fc('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x12b117,_0x12880e[_0x47fc('0x12')][_0x47fc('0x13')]);return _0x4c9e4c(_0x12880e[_0x47fc('0x12')]['message']);}else{logger[_0x47fc('0x14')](_0x47fc('0xf'),_0x12b117,_0x47fc('0x10'));_0x4c9e4c(_0x12880e[_0x47fc('0x15')][_0x47fc('0x13')]);}})['catch'](function(_0x38885f){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x12b117,_0x38885f);_0x2b25e1(_0x38885f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 42147db..230f8cd 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 _0xd3ed=['removeListener','register','chatInternalMessage:','remove','update','emit'];(function(_0x31b070,_0x1d3e08){var _0x3308fa=function(_0x3cbcd7){while(--_0x3cbcd7){_0x31b070['push'](_0x31b070['shift']());}};_0x3308fa(++_0x1d3e08);}(_0xd3ed,0x195));var _0xdd3e=function(_0x4bb6b8,_0x1fb197){_0x4bb6b8=_0x4bb6b8-0x0;var _0x524a57=_0xd3ed[_0x4bb6b8];return _0x524a57;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0xdd3e('0x0'),_0xdd3e('0x1')];function createListener(_0x198fb7,_0x40d37e){return function(_0x3b52bc){_0x40d37e[_0xdd3e('0x2')](_0x198fb7,_0x3b52bc);};}function removeListener(_0x31e2a8,_0x211348){return function(){ChatInternalMessageEvents[_0xdd3e('0x3')](_0x31e2a8,_0x211348);};}exports[_0xdd3e('0x4')]=function(_0x2e1285){for(var _0x13e724=0x0,_0x30b9dc=events['length'];_0x13e724<_0x30b9dc;_0x13e724++){var _0xc25b26=events[_0x13e724];var _0x276143=createListener(_0xdd3e('0x5')+_0xc25b26,_0x2e1285);ChatInternalMessageEvents['on'](_0xc25b26,_0x276143);}}; \ No newline at end of file +var _0xd5d5=['chatInternalMessage:','./chatInternalMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x52245c,_0x28e3a2){var _0x4ab58b=function(_0x3bfffe){while(--_0x3bfffe){_0x52245c['push'](_0x52245c['shift']());}};_0x4ab58b(++_0x28e3a2);}(_0xd5d5,0xe1));var _0x5d5d=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0xd5d5[_0x242a98];return _0x580999;};'use strict';var ChatInternalMessageEvents=require(_0x5d5d('0x0'));var events=[_0x5d5d('0x1'),_0x5d5d('0x2'),'update'];function createListener(_0x3b717f,_0xc73324){return function(_0x56e9bb){_0xc73324[_0x5d5d('0x3')](_0x3b717f,_0x56e9bb);};}function removeListener(_0x4f57c3,_0x35f562){return function(){ChatInternalMessageEvents[_0x5d5d('0x4')](_0x4f57c3,_0x35f562);};}exports[_0x5d5d('0x5')]=function(_0x23e9e6){for(var _0x5c6054=0x0,_0x2c4000=events[_0x5d5d('0x6')];_0x5c6054<_0x2c4000;_0x5c6054++){var _0x136962=events[_0x5c6054];var _0x578ac1=createListener(_0x5d5d('0x7')+_0x136962,_0x23e9e6);ChatInternalMessageEvents['on'](_0x136962,_0x578ac1);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d0ed5e2..a1b4dfa 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 _0x6f90=['/users','getUsers','show','create','put','delete','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x6f90,0x198));var _0x06f9=function(_0x122949,_0x3592b1){_0x122949=_0x122949-0x0;var _0x369d1f=_0x6f90[_0x122949];return _0x369d1f;};'use strict';var multer=require('multer');var util=require(_0x06f9('0x0'));var path=require('path');var timeout=require(_0x06f9('0x1'));var express=require(_0x06f9('0x2'));var router=express[_0x06f9('0x3')]();var fs_extra=require(_0x06f9('0x4'));var auth=require(_0x06f9('0x5'));var interaction=require(_0x06f9('0x6'));var config=require(_0x06f9('0x7'));var controller=require('./chatInternalMessage.controller');router[_0x06f9('0x8')]('/',auth[_0x06f9('0x9')](),controller[_0x06f9('0xa')]);router[_0x06f9('0x8')]('/describe',auth[_0x06f9('0x9')](),controller[_0x06f9('0xb')]);router[_0x06f9('0x8')](_0x06f9('0xc'),auth[_0x06f9('0x9')](),controller[_0x06f9('0xd')]);router[_0x06f9('0x8')]('/:id',auth[_0x06f9('0x9')](),controller[_0x06f9('0xe')]);router['post']('/',auth[_0x06f9('0x9')](),controller[_0x06f9('0xf')]);router[_0x06f9('0x10')]('/:id',controller['update']);router[_0x06f9('0x11')](_0x06f9('0x12'),auth[_0x06f9('0x9')](),controller[_0x06f9('0x13')]);module[_0x06f9('0x14')]=router; \ No newline at end of file +var _0xa3ad=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','create','put','delete','destroy','multer','path'];(function(_0x2845ea,_0x221cbe){var _0x41f5da=function(_0x12e302){while(--_0x12e302){_0x2845ea['push'](_0x2845ea['shift']());}};_0x41f5da(++_0x221cbe);}(_0xa3ad,0xd0));var _0xda3a=function(_0x2239da,_0xc447db){_0x2239da=_0x2239da-0x0;var _0x5d5062=_0xa3ad[_0x2239da];return _0x5d5062;};'use strict';var multer=require(_0xda3a('0x0'));var util=require('util');var path=require(_0xda3a('0x1'));var timeout=require(_0xda3a('0x2'));var express=require('express');var router=express[_0xda3a('0x3')]();var fs_extra=require(_0xda3a('0x4'));var auth=require(_0xda3a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda3a('0x6'));var controller=require(_0xda3a('0x7'));router[_0xda3a('0x8')]('/',auth[_0xda3a('0x9')](),controller[_0xda3a('0xa')]);router[_0xda3a('0x8')](_0xda3a('0xb'),auth[_0xda3a('0x9')](),controller[_0xda3a('0xc')]);router[_0xda3a('0x8')](_0xda3a('0xd'),auth[_0xda3a('0x9')](),controller[_0xda3a('0xe')]);router[_0xda3a('0x8')](_0xda3a('0xf'),auth['isAuthenticated'](),controller[_0xda3a('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xda3a('0x11')]);router[_0xda3a('0x12')]('/:id',controller['update']);router[_0xda3a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xda3a('0x14')]);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 19b45c6..77116b7 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 _0xa30a=['exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x55fe01,_0x12ed37){var _0x5b42f0=function(_0x461191){while(--_0x461191){_0x55fe01['push'](_0x55fe01['shift']());}};_0x5b42f0(++_0x12ed37);}(_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')]={'body':{'type':Sequelize[_0xaa30('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xaa30('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xaa30('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa30('0x4')]('in',_0xaa30('0x5')),'defaultValue':_0xaa30('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xaa30('0x6')]},'providerName':{'type':Sequelize[_0xaa30('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8d05=['sequelize','exports','TEXT','medium','BOOLEAN','out','DATE','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8d05,0xe8));var _0x58d0=function(_0x21f3f8,_0x566bab){_0x21f3f8=_0x21f3f8-0x0;var _0x558255=_0x8d05[_0x21f3f8];return _0x558255;};'use strict';var Sequelize=require(_0x58d0('0x0'));module[_0x58d0('0x1')]={'body':{'type':Sequelize[_0x58d0('0x2')](_0x58d0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x58d0('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x58d0('0x5')),'defaultValue':_0x58d0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x58d0('0x6')]},'providerName':{'type':Sequelize[_0x58d0('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a5a9ab7..488eaa1 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 _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x2beb70,_0x264e7a){var _0x4975b9=function(_0x3dbce7){while(--_0x3dbce7){_0x2beb70['push'](_0x2beb70['shift']());}};_0x4975b9(++_0x264e7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x1f8f53,_0x160903){var _0x3c5e7f=function(_0x359956){while(--_0x359956){_0x1f8f53['push'](_0x1f8f53['shift']());}};_0x3c5e7f(++_0x160903);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 2cb7f71..6225c44 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 _0xe2a6=['emit','hook','exports','events','../../mysqldb','ChatMessage','save','update','remove'];(function(_0x251421,_0x34bf49){var _0xe9bbff=function(_0x522759){while(--_0x522759){_0x251421['push'](_0x251421['shift']());}};_0xe9bbff(++_0x34bf49);}(_0xe2a6,0x1d7));var _0x6e2a=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xe2a6[_0x512f81];return _0xa15099;};'use strict';var EventEmitter=require(_0x6e2a('0x0'));var ChatMessage=require(_0x6e2a('0x1'))['db'][_0x6e2a('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e2a('0x3'),'afterUpdate':_0x6e2a('0x4'),'afterDestroy':_0x6e2a('0x5')};function emitEvent(_0x2a138e){return function(_0x3115c7,_0x371275,_0x3aab8d){ChatMessageEvents['emit'](_0x2a138e+':'+_0x3115c7['id'],_0x3115c7);ChatMessageEvents[_0x6e2a('0x6')](_0x2a138e,_0x3115c7);_0x3aab8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x6e2a('0x7')](e,emitEvent(event));}}module[_0x6e2a('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xb43e=['exports','events','../../mysqldb','ChatMessage','save','update','emit','hook'];(function(_0x16fd68,_0x3d394d){var _0x12cf8e=function(_0x4728c1){while(--_0x4728c1){_0x16fd68['push'](_0x16fd68['shift']());}};_0x12cf8e(++_0x3d394d);}(_0xb43e,0x1f1));var _0xeb43=function(_0x9d885d,_0x3cb2db){_0x9d885d=_0x9d885d-0x0;var _0x272063=_0xb43e[_0x9d885d];return _0x272063;};'use strict';var EventEmitter=require(_0xeb43('0x0'));var ChatMessage=require(_0xeb43('0x1'))['db'][_0xeb43('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb43('0x3'),'afterUpdate':_0xeb43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1fa2b7){return function(_0x48e2ad,_0x1b2380,_0x5659a2){ChatMessageEvents[_0xeb43('0x5')](_0x1fa2b7+':'+_0x48e2ad['id'],_0x48e2ad);ChatMessageEvents['emit'](_0x1fa2b7,_0x48e2ad);_0x5659a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xeb43('0x6')](e,emitEvent(event));}}module[_0xeb43('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f701a37..39bf1d0 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 _0xf37f=['exports','ChatMessage','chat_messages','fti_chat_messages','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xf37f,0x11a));var _0xff37=function(_0x5134b8,_0x37e616){_0x5134b8=_0x5134b8-0x0;var _0xc07056=_0xf37f[_0x5134b8];return _0xc07056;};'use strict';var _=require('lodash');var util=require(_0xff37('0x0'));var logger=require('../../config/logger')(_0xff37('0x1'));var moment=require(_0xff37('0x2'));var BPromise=require('bluebird');var rp=require(_0xff37('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff37('0x4'));var config=require(_0xff37('0x5'));var attributes=require('./chatMessage.attributes');module[_0xff37('0x6')]=function(_0x414b47,_0x10ed1d){return _0x414b47['define'](_0xff37('0x7'),attributes,{'tableName':_0xff37('0x8'),'paranoid':![],'indexes':[{'name':_0xff37('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13a209,_0x317937,_0x115deb){var _0x2ee7a8=_0x414b47['models'];var _0x1ed7a9=_0x13a209[_0xff37('0xa')]({'plain':!![]});if(_0x1ed7a9[_0xff37('0xb')][_0xff37('0xc')]()==='in'||_0x1ed7a9['direction'][_0xff37('0xc')]()===_0xff37('0xd')&&!_0x1ed7a9[_0xff37('0xe')]&&!_['isNil'](_0x1ed7a9[_0xff37('0xf')])){_0x2ee7a8[_0xff37('0x10')][_0xff37('0x11')]({'where':{'id':_0x1ed7a9['ChatInteractionId']}})[_0xff37('0x12')](function(_0x2777b8){if(_0x2777b8){_0x2777b8[_0xff37('0x13')]({'lastMsgAt':_0x1ed7a9['createdAt'],'lastMsgDirection':_0x1ed7a9[_0xff37('0xb')][_0xff37('0xc')]()});}})[_0xff37('0x14')](function(_0x16641c){console[_0xff37('0x15')](_0x16641c);});}_0x115deb();}},'charset':_0xff37('0x16'),'collate':_0xff37('0x17')});}; \ No newline at end of file +var _0x9017=['ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','ChatInteraction','findOne','ChatInteractionId','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x376195,_0x401af2){var _0x5733ef=function(_0x512e97){while(--_0x512e97){_0x376195['push'](_0x376195['shift']());}};_0x5733ef(++_0x401af2);}(_0x9017,0x123));var _0x7901=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9017[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7901('0x0'));var util=require('util');var logger=require(_0x7901('0x1'))(_0x7901('0x2'));var moment=require('moment');var BPromise=require(_0x7901('0x3'));var rp=require(_0x7901('0x4'));var fs=require('fs');var path=require(_0x7901('0x5'));var rimraf=require(_0x7901('0x6'));var config=require(_0x7901('0x7'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x13a205,_0x2d19e2){return _0x13a205[_0x7901('0x8')](_0x7901('0x9'),attributes,{'tableName':_0x7901('0xa'),'paranoid':![],'indexes':[{'name':_0x7901('0xb'),'fields':[_0x7901('0xc')],'type':_0x7901('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x159629,_0x5ab170,_0x287d16){var _0x23d111=_0x13a205['models'];var _0x474da8=_0x159629['get']({'plain':!![]});if(_0x474da8[_0x7901('0xe')][_0x7901('0xf')]()==='in'||_0x474da8[_0x7901('0xe')][_0x7901('0xf')]()===_0x7901('0x10')&&!_0x474da8[_0x7901('0x11')]&&!_['isNil'](_0x474da8['UserId'])){_0x23d111[_0x7901('0x12')][_0x7901('0x13')]({'where':{'id':_0x474da8[_0x7901('0x14')]}})['then'](function(_0x4e9542){if(_0x4e9542){_0x4e9542[_0x7901('0x15')]({'lastMsgAt':_0x474da8['createdAt'],'lastMsgDirection':_0x474da8[_0x7901('0xe')][_0x7901('0xf')]()});}})['catch'](function(_0x2a5848){console[_0x7901('0x16')](_0x2a5848);});}_0x287d16();}},'charset':_0x7901('0x17'),'collate':_0x7901('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 74b46fb..c19cc05 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 _0x123b=['message','result','CreateChatMessage','create','options','raw','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4d1965,_0x43152e){var _0xdcfade=function(_0x3d3b8a){while(--_0x3d3b8a){_0x4d1965['push'](_0x4d1965['shift']());}};_0xdcfade(++_0x43152e);}(_0x123b,0xef));var _0xb123=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x123b[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xb123('0x0'));var util=require(_0xb123('0x1'));var moment=require(_0xb123('0x2'));var BPromise=require('bluebird');var rs=require(_0xb123('0x3'));var fs=require('fs');var Redis=require(_0xb123('0x4'));var db=require(_0xb123('0x5'))['db'];var utils=require(_0xb123('0x6'));var logger=require(_0xb123('0x7'))(_0xb123('0x8'));var config=require(_0xb123('0x9'));var jayson=require(_0xb123('0xa'));var client=jayson[_0xb123('0xb')][_0xb123('0xc')]({'port':0x232a});config['redis']=_[_0xb123('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb123('0xe')]));require(_0xb123('0xf'))[_0xb123('0x10')](socket);function respondWithRpcPromise(_0x14fc31,_0x2f4629,_0x3b594a){return new BPromise(function(_0x4f7d40,_0x3ad095){return client[_0xb123('0x11')](_0x14fc31,_0x3b594a)[_0xb123('0x12')](function(_0x1a09c8){logger[_0xb123('0x13')](_0xb123('0x14'),_0x2f4629,_0xb123('0x15'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2f4629,_0xb123('0x15'),JSON[_0xb123('0x16')](_0x1a09c8));if(_0x1a09c8[_0xb123('0x17')]){if(_0x1a09c8['error'][_0xb123('0x18')]===0x1f4){logger[_0xb123('0x17')](_0xb123('0x14'),_0x2f4629,_0x1a09c8[_0xb123('0x17')]['message']);return _0x3ad095(_0x1a09c8[_0xb123('0x17')]['message']);}logger['error'](_0xb123('0x14'),_0x2f4629,_0x1a09c8[_0xb123('0x17')][_0xb123('0x19')]);return _0x4f7d40(_0x1a09c8[_0xb123('0x17')][_0xb123('0x19')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x2f4629,'request\x20sent');_0x4f7d40(_0x1a09c8[_0xb123('0x1a')][_0xb123('0x19')]);}})['catch'](function(_0x43871d){logger[_0xb123('0x17')](_0xb123('0x14'),_0x2f4629,_0x43871d);_0x3ad095(_0x43871d);});});}exports[_0xb123('0x1b')]=function(_0x494a0f){var _0x4daea3=this;return new Promise(function(_0x50c642,_0x280529){return db['ChatMessage'][_0xb123('0x1c')](_0x494a0f['body'],{'raw':_0x494a0f[_0xb123('0x1d')]?_0x494a0f[_0xb123('0x1d')][_0xb123('0x1e')]===undefined?!![]:![]:!![]})[_0xb123('0x12')](function(_0x347846){logger['info'](_0xb123('0x1b'),_0x494a0f);logger[_0xb123('0x1f')](_0xb123('0x1b'),_0x494a0f,JSON[_0xb123('0x16')](_0x347846));_0x50c642(_0x347846);})[_0xb123('0x20')](function(_0x3b469a){logger[_0xb123('0x17')](_0xb123('0x1b'),_0x3b469a[_0xb123('0x19')],_0x494a0f);_0x280529(_0x4daea3[_0xb123('0x17')](0x1f4,_0x3b469a[_0xb123('0x19')]));});});}; \ No newline at end of file +var _0xbd8e=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','CreateChatMessage','create','options','stringify','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd8e,0x1de));var _0xebd8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd8e[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xebd8('0x0'));var util=require('util');var moment=require(_0xebd8('0x1'));var BPromise=require(_0xebd8('0x2'));var rs=require(_0xebd8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xebd8('0x4'));var logger=require('../../config/logger')(_0xebd8('0x5'));var config=require('../../config/environment');var jayson=require(_0xebd8('0x6'));var client=jayson[_0xebd8('0x7')][_0xebd8('0x8')]({'port':0x232a});config[_0xebd8('0x9')]=_[_0xebd8('0xa')](config['redis'],{'host':_0xebd8('0xb'),'port':0x18eb});var socket=require(_0xebd8('0xc'))(new Redis(config[_0xebd8('0x9')]));require('./chatMessage.socket')[_0xebd8('0xd')](socket);function respondWithRpcPromise(_0x2be34e,_0x4e769d,_0x521756){return new BPromise(function(_0x4ff789,_0x10a5b5){return client[_0xebd8('0xe')](_0x2be34e,_0x521756)['then'](function(_0x560a69){logger[_0xebd8('0xf')](_0xebd8('0x10'),_0x4e769d,_0xebd8('0x11'));logger[_0xebd8('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4e769d,_0xebd8('0x11'),JSON['stringify'](_0x560a69));if(_0x560a69[_0xebd8('0x13')]){if(_0x560a69[_0xebd8('0x13')]['code']===0x1f4){logger[_0xebd8('0x13')](_0xebd8('0x10'),_0x4e769d,_0x560a69[_0xebd8('0x13')][_0xebd8('0x14')]);return _0x10a5b5(_0x560a69[_0xebd8('0x13')][_0xebd8('0x14')]);}logger[_0xebd8('0x13')](_0xebd8('0x10'),_0x4e769d,_0x560a69[_0xebd8('0x13')]['message']);return _0x4ff789(_0x560a69[_0xebd8('0x13')][_0xebd8('0x14')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x4e769d,_0xebd8('0x11'));_0x4ff789(_0x560a69['result'][_0xebd8('0x14')]);}})['catch'](function(_0xb78d0f){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4e769d,_0xb78d0f);_0x10a5b5(_0xb78d0f);});});}exports[_0xebd8('0x15')]=function(_0x5066b6){var _0x9a284=this;return new Promise(function(_0x45d9d3,_0x409fa9){return db['ChatMessage'][_0xebd8('0x16')](_0x5066b6['body'],{'raw':_0x5066b6[_0xebd8('0x17')]?_0x5066b6['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b62d4){logger[_0xebd8('0xf')](_0xebd8('0x15'),_0x5066b6);logger[_0xebd8('0x12')]('CreateChatMessage',_0x5066b6,JSON[_0xebd8('0x18')](_0x4b62d4));_0x45d9d3(_0x4b62d4);})[_0xebd8('0x19')](function(_0x130596){logger[_0xebd8('0x13')](_0xebd8('0x15'),_0x130596[_0xebd8('0x14')],_0x5066b6);_0x409fa9(_0x9a284['error'](0x1f4,_0x130596[_0xebd8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 22214e4..7ecc13c 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 _0x24ca=['./chatMessage.events','update','emit','removeListener','register','length','chatMessage:'];(function(_0x34155d,_0x5895cd){var _0x982507=function(_0x1bad95){while(--_0x1bad95){_0x34155d['push'](_0x34155d['shift']());}};_0x982507(++_0x5895cd);}(_0x24ca,0x8c));var _0xa24c=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x24ca[_0x3e182f];return _0x23edc9;};'use strict';var ChatMessageEvents=require(_0xa24c('0x0'));var events=['save','remove',_0xa24c('0x1')];function createListener(_0x4e90b0,_0x155c49){return function(_0x1efd39){_0x155c49[_0xa24c('0x2')](_0x4e90b0,_0x1efd39);};}function removeListener(_0x49f276,_0x2fbcfa){return function(){ChatMessageEvents[_0xa24c('0x3')](_0x49f276,_0x2fbcfa);};}exports[_0xa24c('0x4')]=function(_0x5a37ae){for(var _0x5377ed=0x0,_0x52147a=events[_0xa24c('0x5')];_0x5377ed<_0x52147a;_0x5377ed++){var _0x3c10d9=events[_0x5377ed];var _0x1218ea=createListener(_0xa24c('0x6')+_0x3c10d9,_0x5a37ae);ChatMessageEvents['on'](_0x3c10d9,_0x1218ea);}}; \ No newline at end of file +var _0x29d4=['removeListener','register','length','./chatMessage.events','remove','update'];(function(_0x3c03a9,_0x4caa7e){var _0x557acf=function(_0x344038){while(--_0x344038){_0x3c03a9['push'](_0x3c03a9['shift']());}};_0x557acf(++_0x4caa7e);}(_0x29d4,0x1a1));var _0x429d=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x29d4[_0x1b349a];return _0x5d1f7c;};'use strict';var ChatMessageEvents=require(_0x429d('0x0'));var events=['save',_0x429d('0x1'),_0x429d('0x2')];function createListener(_0x16ce75,_0x472fc9){return function(_0x45df1c){_0x472fc9['emit'](_0x16ce75,_0x45df1c);};}function removeListener(_0xc3989d,_0x3f43f5){return function(){ChatMessageEvents[_0x429d('0x3')](_0xc3989d,_0x3f43f5);};}exports[_0x429d('0x4')]=function(_0x1c55aa){for(var _0xa71445=0x0,_0x56aa2f=events[_0x429d('0x5')];_0xa71445<_0x56aa2f;_0xa71445++){var _0x4befb9=events[_0xa71445];var _0x9fc337=createListener('chatMessage:'+_0x4befb9,_0x1c55aa);ChatMessageEvents['on'](_0x4befb9,_0x9fc337);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index d93b230..76418e6 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 _0x01df=['/:id','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe'];(function(_0x187ee1,_0x486fdd){var _0x174752=function(_0xd96a00){while(--_0xd96a00){_0x187ee1['push'](_0x187ee1['shift']());}};_0x174752(++_0x486fdd);}(_0x01df,0x16c));var _0xf01d=function(_0xeb56e0,_0x565544){_0xeb56e0=_0xeb56e0-0x0;var _0x16642f=_0x01df[_0xeb56e0];return _0x16642f;};'use strict';var multer=require('multer');var util=require(_0xf01d('0x0'));var path=require(_0xf01d('0x1'));var timeout=require(_0xf01d('0x2'));var express=require('express');var router=express[_0xf01d('0x3')]();var fs_extra=require(_0xf01d('0x4'));var auth=require(_0xf01d('0x5'));var interaction=require(_0xf01d('0x6'));var config=require('../../config/environment');var controller=require(_0xf01d('0x7'));router[_0xf01d('0x8')]('/',auth[_0xf01d('0x9')](),controller['index']);router[_0xf01d('0x8')](_0xf01d('0xa'),auth[_0xf01d('0x9')](),controller['describe']);router[_0xf01d('0x8')](_0xf01d('0xb'),auth[_0xf01d('0x9')](),controller['show']);router['post']('/',auth[_0xf01d('0x9')](),interaction[_0xf01d('0xc')](_0xf01d('0xd'),_0xf01d('0xe')),controller[_0xf01d('0xf')]);router[_0xf01d('0x10')](_0xf01d('0xb'),controller[_0xf01d('0x11')]);router['put'](_0xf01d('0x12'),auth['isAuthenticated'](),controller[_0xf01d('0x13')]);router[_0xf01d('0x10')](_0xf01d('0x14'),auth[_0xf01d('0x9')](),controller[_0xf01d('0x15')]);router[_0xf01d('0x16')](_0xf01d('0xb'),auth[_0xf01d('0x9')](),controller[_0xf01d('0x17')]);module[_0xf01d('0x18')]=router; \ No newline at end of file +var _0x84ea=['post','tracked','chat','chatmessage:create','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x84ea,0x13f));var _0xa84e=function(_0x5a2583,_0x502e6a){_0x5a2583=_0x5a2583-0x0;var _0x2b1825=_0x84ea[_0x5a2583];return _0x2b1825;};'use strict';var multer=require(_0xa84e('0x0'));var util=require(_0xa84e('0x1'));var path=require(_0xa84e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa84e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa84e('0x4'));var controller=require(_0xa84e('0x5'));router[_0xa84e('0x6')]('/',auth[_0xa84e('0x7')](),controller[_0xa84e('0x8')]);router[_0xa84e('0x6')](_0xa84e('0x9'),auth[_0xa84e('0x7')](),controller['describe']);router[_0xa84e('0x6')](_0xa84e('0xa'),auth[_0xa84e('0x7')](),controller['show']);router[_0xa84e('0xb')]('/',auth[_0xa84e('0x7')](),interaction[_0xa84e('0xc')](_0xa84e('0xd'),_0xa84e('0xe')),controller['create']);router['put']('/:id',controller[_0xa84e('0xf')]);router['put'](_0xa84e('0x10'),auth[_0xa84e('0x7')](),controller['accept']);router['put'](_0xa84e('0x11'),auth[_0xa84e('0x7')](),controller[_0xa84e('0x12')]);router[_0xa84e('0x13')](_0xa84e('0xa'),auth['isAuthenticated'](),controller[_0xa84e('0x14')]);module[_0xa84e('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 96be6f0..3da267f 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 _0x6c00=['exports','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c00,0x1a9));var _0x06c0=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0x6c00[_0x2a5b3b];return _0xae665a;};'use strict';var Sequelize=require(_0x06c0('0x0'));module[_0x06c0('0x1')]={'body':{'type':Sequelize[_0x06c0('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x85bb=['exports','medium'];(function(_0x5c4703,_0x26d11d){var _0x59e7e5=function(_0x3eddfe){while(--_0x3eddfe){_0x5c4703['push'](_0x5c4703['shift']());}};_0x59e7e5(++_0x26d11d);}(_0x85bb,0x94));var _0xb85b=function(_0x4ea966,_0x532385){_0x4ea966=_0x4ea966-0x0;var _0x164ab4=_0x85bb[_0x4ea966];return _0x164ab4;};'use strict';var Sequelize=require('sequelize');module[_0xb85b('0x0')]={'body':{'type':Sequelize['TEXT'](_0xb85b('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 39903ce..4d4beb2 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(_0xddf621,_0x4ac1ea){var _0x212964=function(_0x2c03e7){while(--_0x2c03e7){_0xddf621['push'](_0xddf621['shift']());}};_0x212964(++_0x4ac1ea);}(_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 _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(_0x364f63,_0x5c8790){var _0x2fff70=function(_0x3c1582){while(--_0x3c1582){_0x364f63['push'](_0x364f63['shift']());}};_0x2fff70(++_0x5c8790);}(_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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 98ec120..1f6cc1b 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 _0x48e5=['moment','bluebird','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x493720,_0x2e7724){var _0x3cfc8e=function(_0x1ceb74){while(--_0x1ceb74){_0x493720['push'](_0x493720['shift']());}};_0x3cfc8e(++_0x2e7724);}(_0x48e5,0x15d));var _0x548e=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x48e5[_0x4e5552];return _0x60a338;};'use strict';var _=require('lodash');var util=require(_0x548e('0x0'));var logger=require(_0x548e('0x1'))('api');var moment=require(_0x548e('0x2'));var BPromise=require(_0x548e('0x3'));var rp=require(_0x548e('0x4'));var fs=require('fs');var path=require(_0x548e('0x5'));var rimraf=require(_0x548e('0x6'));var config=require('../../config/environment');var attributes=require(_0x548e('0x7'));module[_0x548e('0x8')]=function(_0x9c6055,_0x586519){return _0x9c6055[_0x548e('0x9')](_0x548e('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x548e('0xb'),'collate':_0x548e('0xc')});}; \ No newline at end of file +var _0x36d0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x36d0,0x19f));var _0x036d=function(_0x42cdf1,_0x3efe9d){_0x42cdf1=_0x42cdf1-0x0;var _0x2526f9=_0x36d0[_0x42cdf1];return _0x2526f9;};'use strict';var _=require(_0x036d('0x0'));var util=require(_0x036d('0x1'));var logger=require(_0x036d('0x2'))(_0x036d('0x3'));var moment=require(_0x036d('0x4'));var BPromise=require(_0x036d('0x5'));var rp=require(_0x036d('0x6'));var fs=require('fs');var path=require(_0x036d('0x7'));var rimraf=require(_0x036d('0x8'));var config=require(_0x036d('0x9'));var attributes=require(_0x036d('0xa'));module[_0x036d('0xb')]=function(_0x4ad41f,_0x57c442){return _0x4ad41f[_0x036d('0xc')](_0x036d('0xd'),attributes,{'tableName':_0x036d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x036d('0xf')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 76fb02b..58cf053 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 _0xb4a0=['code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x427885,_0x493711){var _0x3a6c06=function(_0x2336b1){while(--_0x2336b1){_0x427885['push'](_0x427885['shift']());}};_0x3a6c06(++_0x493711);}(_0xb4a0,0x1e8));var _0x0b4a=function(_0x50e066,_0x29a43a){_0x50e066=_0x50e066-0x0;var _0x3b31e3=_0xb4a0[_0x50e066];return _0x3b31e3;};'use strict';var _=require(_0x0b4a('0x0'));var util=require('util');var moment=require(_0x0b4a('0x1'));var BPromise=require(_0x0b4a('0x2'));var rs=require(_0x0b4a('0x3'));var fs=require('fs');var Redis=require(_0x0b4a('0x4'));var db=require(_0x0b4a('0x5'))['db'];var utils=require(_0x0b4a('0x6'));var logger=require(_0x0b4a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0b4a('0x8'));var client=jayson[_0x0b4a('0x9')][_0x0b4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bd469,_0x59389c,_0x351dec){return new BPromise(function(_0x513c6c,_0x3225f6){return client['request'](_0x1bd469,_0x351dec)[_0x0b4a('0xb')](function(_0x324102){logger[_0x0b4a('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x59389c,_0x0b4a('0xd'));logger[_0x0b4a('0xe')](_0x0b4a('0xf'),_0x59389c,'request\x20sent',JSON[_0x0b4a('0x10')](_0x324102));if(_0x324102[_0x0b4a('0x11')]){if(_0x324102[_0x0b4a('0x11')][_0x0b4a('0x12')]===0x1f4){logger[_0x0b4a('0x11')](_0x0b4a('0x13'),_0x59389c,_0x324102[_0x0b4a('0x11')]['message']);return _0x3225f6(_0x324102['error'][_0x0b4a('0x14')]);}logger[_0x0b4a('0x11')](_0x0b4a('0x13'),_0x59389c,_0x324102['error'][_0x0b4a('0x14')]);return _0x513c6c(_0x324102[_0x0b4a('0x11')][_0x0b4a('0x14')]);}else{logger[_0x0b4a('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x59389c,_0x0b4a('0xd'));_0x513c6c(_0x324102[_0x0b4a('0x15')]['message']);}})[_0x0b4a('0x16')](function(_0x59d4b0){logger[_0x0b4a('0x11')](_0x0b4a('0x13'),_0x59389c,_0x59d4b0);_0x3225f6(_0x59d4b0);});});} \ No newline at end of file +var _0xefe2=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x9be80d,_0x13f55){var _0x562e90=function(_0x2ac04a){while(--_0x2ac04a){_0x9be80d['push'](_0x9be80d['shift']());}};_0x562e90(++_0x13f55);}(_0xefe2,0x178));var _0x2efe=function(_0x5238aa,_0x3f82a9){_0x5238aa=_0x5238aa-0x0;var _0x2ca18a=_0xefe2[_0x5238aa];return _0x2ca18a;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require('moment');var BPromise=require(_0x2efe('0x2'));var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require(_0x2efe('0x4'));var db=require(_0x2efe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2efe('0x6'))(_0x2efe('0x7'));var config=require(_0x2efe('0x8'));var jayson=require(_0x2efe('0x9'));var client=jayson[_0x2efe('0xa')][_0x2efe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cb899,_0x4afa51,_0x1447f1){return new BPromise(function(_0x3916c3,_0x5a1147){return client[_0x2efe('0xc')](_0x2cb899,_0x1447f1)[_0x2efe('0xd')](function(_0x1f12de){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x4afa51,_0x2efe('0xe'));logger[_0x2efe('0xf')](_0x2efe('0x10'),_0x4afa51,'request\x20sent',JSON[_0x2efe('0x11')](_0x1f12de));if(_0x1f12de[_0x2efe('0x12')]){if(_0x1f12de[_0x2efe('0x12')][_0x2efe('0x13')]===0x1f4){logger['error'](_0x2efe('0x14'),_0x4afa51,_0x1f12de[_0x2efe('0x12')]['message']);return _0x5a1147(_0x1f12de[_0x2efe('0x12')]['message']);}logger['error'](_0x2efe('0x14'),_0x4afa51,_0x1f12de['error'][_0x2efe('0x15')]);return _0x3916c3(_0x1f12de[_0x2efe('0x12')][_0x2efe('0x15')]);}else{logger[_0x2efe('0x16')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4afa51,_0x2efe('0xe'));_0x3916c3(_0x1f12de['result'][_0x2efe('0x15')]);}})['catch'](function(_0x4950e5){logger[_0x2efe('0x12')](_0x2efe('0x14'),_0x4afa51,_0x4950e5);_0x5a1147(_0x4950e5);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d1543c7..1861b8f 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 _0xae90=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','create','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x43424a,_0x5b7fb7){var _0x5cd9f2=function(_0x3ca07a){while(--_0x3ca07a){_0x43424a['push'](_0x43424a['shift']());}};_0x5cd9f2(++_0x5b7fb7);}(_0xae90,0x1c8));var _0x0ae9=function(_0x4d1c4a,_0x663403){_0x4d1c4a=_0x4d1c4a-0x0;var _0xf7bc3c=_0xae90[_0x4d1c4a];return _0xf7bc3c;};'use strict';var multer=require(_0x0ae9('0x0'));var util=require(_0x0ae9('0x1'));var path=require('path');var timeout=require(_0x0ae9('0x2'));var express=require(_0x0ae9('0x3'));var router=express[_0x0ae9('0x4')]();var fs_extra=require(_0x0ae9('0x5'));var auth=require(_0x0ae9('0x6'));var interaction=require(_0x0ae9('0x7'));var config=require(_0x0ae9('0x8'));var controller=require(_0x0ae9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0ae9('0xa')]);router[_0x0ae9('0xb')](_0x0ae9('0xc'),auth[_0x0ae9('0xd')](),controller[_0x0ae9('0xe')]);router[_0x0ae9('0xb')](_0x0ae9('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0ae9('0xd')](),controller[_0x0ae9('0x10')]);router['put'](_0x0ae9('0xf'),auth[_0x0ae9('0xd')](),controller[_0x0ae9('0x11')]);router['delete'](_0x0ae9('0xf'),auth[_0x0ae9('0xd')](),controller[_0x0ae9('0x12')]);module[_0x0ae9('0x13')]=router; \ No newline at end of file +var _0xf4e5=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','describe'];(function(_0x5b0fd6,_0x596cab){var _0xa5b678=function(_0x49a337){while(--_0x49a337){_0x5b0fd6['push'](_0x5b0fd6['shift']());}};_0xa5b678(++_0x596cab);}(_0xf4e5,0x1d7));var _0x5f4e=function(_0x400fa2,_0x18bb9e){_0x400fa2=_0x400fa2-0x0;var _0x2a55fc=_0xf4e5[_0x400fa2];return _0x2a55fc;};'use strict';var multer=require(_0x5f4e('0x0'));var util=require('util');var path=require(_0x5f4e('0x1'));var timeout=require(_0x5f4e('0x2'));var express=require(_0x5f4e('0x3'));var router=express[_0x5f4e('0x4')]();var fs_extra=require(_0x5f4e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5f4e('0x6'));var config=require(_0x5f4e('0x7'));var controller=require(_0x5f4e('0x8'));router[_0x5f4e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5f4e('0xa'),auth['isAuthenticated'](),controller[_0x5f4e('0xb')]);router[_0x5f4e('0x9')](_0x5f4e('0xc'),auth[_0x5f4e('0xd')](),controller[_0x5f4e('0xe')]);router[_0x5f4e('0xf')]('/',auth[_0x5f4e('0xd')](),controller[_0x5f4e('0x10')]);router[_0x5f4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5f4e('0x12')]);router['delete'](_0x5f4e('0xc'),auth['isAuthenticated'](),controller[_0x5f4e('0x13')]);module[_0x5f4e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4e77896..4134742 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 _0xf2e4=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x1789f3,_0x4672f3){var _0x59f242=function(_0x3e263d){while(--_0x3e263d){_0x1789f3['push'](_0x1789f3['shift']());}};_0x59f242(++_0x4672f3);}(_0xf2e4,0xc8));var _0x4f2e=function(_0x358968,_0x523037){_0x358968=_0x358968-0x0;var _0x4f58d2=_0xf2e4[_0x358968];return _0x4f58d2;};'use strict';var Sequelize=require(_0x4f2e('0x0'));module[_0x4f2e('0x1')]={'name':{'type':Sequelize[_0x4f2e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4f2e('0x3')](_0x4f2e('0x4'),'timeout'),'defaultValue':_0x4f2e('0x4')},'selector':{'type':Sequelize[_0x4f2e('0x2')]},'timeout':{'type':Sequelize[_0x4f2e('0x5')]}}; \ No newline at end of file +var _0x4667=['timeout','mouseOver','STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4667,0x1ba));var _0x7466=function(_0x89aedf,_0x3f9fe3){_0x89aedf=_0x89aedf-0x0;var _0x53e5cb=_0x4667[_0x89aedf];return _0x53e5cb;};'use strict';var Sequelize=require(_0x7466('0x0'));module[_0x7466('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x7466('0x2')),'defaultValue':_0x7466('0x3')},'selector':{'type':Sequelize[_0x7466('0x4')]},'timeout':{'type':Sequelize[_0x7466('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c26daf3..96ea8b7 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 _0x0a9f=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','rawAttributes','query','keys','filters','model','intersection','fields','attributes','include','merge','options','ChatProactiveAction','find','catch','create','body','params','rimraf','zip-dir','moment','mustache','ejs','fs-extra','squel','jsforce','desk.js','querystring'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x0a9f,0x64));var _0xf0a9=function(_0x24c178,_0x2e588b){_0x24c178=_0x24c178-0x0;var _0x35a2d8=_0x0a9f[_0x24c178];return _0x35a2d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0a9('0x0'));var zipdir=require(_0xf0a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0a9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf0a9('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf0a9('0x4'));var fs=require('fs');var fs_extra=require(_0xf0a9('0x5'));var _=require('lodash');var squel=require(_0xf0a9('0x6'));var crypto=require('crypto');var jsforce=require(_0xf0a9('0x7'));var deskjs=require(_0xf0a9('0x8'));var toCsv=require('to-csv');var querystring=require(_0xf0a9('0x9'));var Papa=require(_0xf0a9('0xa'));var Redis=require(_0xf0a9('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xf0a9('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0a9('0xd'));var logger=require(_0xf0a9('0xe'))(_0xf0a9('0xf'));var utils=require(_0xf0a9('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xf0a9('0x11'));var db=require(_0xf0a9('0x12'))['db'];function respondWithStatusCode(_0x6a469e,_0xde853){_0xde853=_0xde853||0xcc;return function(_0x4c8877){if(_0x4c8877){return _0x6a469e['sendStatus'](_0xde853);}return _0x6a469e[_0xf0a9('0x13')](_0xde853)[_0xf0a9('0x14')]();};}function respondWithResult(_0xe27d7e,_0x24c3c9){_0x24c3c9=_0x24c3c9||0xc8;return function(_0x437a3b){if(_0x437a3b){return _0xe27d7e[_0xf0a9('0x13')](_0x24c3c9)[_0xf0a9('0x15')](_0x437a3b);}};}function respondWithFilteredResult(_0x48cffd,_0x18e6ce){return function(_0x4bb2f2){if(_0x4bb2f2){var _0x373ba8=typeof _0x18e6ce['offset']===_0xf0a9('0x16')&&typeof _0x18e6ce['limit']===_0xf0a9('0x16');var _0x43b7f3=_0x4bb2f2[_0xf0a9('0x17')];var _0xf9f800=_0x373ba8?0x0:_0x18e6ce[_0xf0a9('0x18')];var _0x37ddab=_0x373ba8?_0x4bb2f2[_0xf0a9('0x17')]:_0x18e6ce[_0xf0a9('0x18')]+_0x18e6ce[_0xf0a9('0x19')];var _0x4ecb10;if(_0x37ddab>=_0x43b7f3){_0x37ddab=_0x43b7f3;_0x4ecb10=0xc8;}else{_0x4ecb10=0xce;}_0x48cffd[_0xf0a9('0x13')](_0x4ecb10);return _0x48cffd[_0xf0a9('0x1a')](_0xf0a9('0x1b'),_0xf9f800+'-'+_0x37ddab+'/'+_0x43b7f3)['json'](_0x4bb2f2);}return null;};}function patchUpdates(_0x42e7f3){return function(_0x5c26c1){try{jsonpatch[_0xf0a9('0x1c')](_0x5c26c1,_0x42e7f3,!![]);}catch(_0x2f57e7){return BPromise['reject'](_0x2f57e7);}return _0x5c26c1[_0xf0a9('0x1d')]();};}function saveUpdates(_0x1707c2,_0xad2291){return function(_0x52b3cf){if(_0x52b3cf){return _0x52b3cf[_0xf0a9('0x1e')](_0x1707c2)[_0xf0a9('0x1f')](function(_0x132203){return _0x132203;});}return null;};}function removeEntity(_0x453307,_0x3f1013){return function(_0x41c958){if(_0x41c958){return _0x41c958[_0xf0a9('0x20')]()['then'](function(){_0x453307['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f39a3,_0x23ed63){return function(_0x1064cf){if(!_0x1064cf){_0x3f39a3['sendStatus'](0x194);}return _0x1064cf;};}function handleError(_0x3b1377,_0x12133f){_0x12133f=_0x12133f||0x1f4;return function(_0x1d93d2){logger[_0xf0a9('0x21')](_0x1d93d2[_0xf0a9('0x22')]);if(_0x1d93d2[_0xf0a9('0x23')]){delete _0x1d93d2['name'];}_0x3b1377[_0xf0a9('0x13')](_0x12133f)[_0xf0a9('0x24')](_0x1d93d2);};}exports[_0xf0a9('0x25')]=function(_0x1f24a2,_0x153a4e){var _0x4834e0={'raw':!![],'where':{'id':_0x1f24a2['params']['id']}},_0x1c2fef={};_0x1c2fef['model']=_['keys'](db['ChatProactiveAction'][_0xf0a9('0x26')]);_0x1c2fef[_0xf0a9('0x27')]=_[_0xf0a9('0x28')](_0x1f24a2['query']);_0x1c2fef[_0xf0a9('0x29')]=_['intersection'](_0x1c2fef[_0xf0a9('0x2a')],_0x1c2fef[_0xf0a9('0x27')]);_0x4834e0['attributes']=_[_0xf0a9('0x2b')](_0x1c2fef[_0xf0a9('0x2a')],qs[_0xf0a9('0x2c')](_0x1f24a2[_0xf0a9('0x27')][_0xf0a9('0x2c')]));_0x4834e0[_0xf0a9('0x2d')]=_0x4834e0['attributes']['length']?_0x4834e0['attributes']:_0x1c2fef['model'];if(_0x1f24a2[_0xf0a9('0x27')]['includeAll']){_0x4834e0[_0xf0a9('0x2e')]=[{'all':!![]}];}_0x4834e0=_[_0xf0a9('0x2f')]({},_0x4834e0,_0x1f24a2[_0xf0a9('0x30')]);return db[_0xf0a9('0x31')][_0xf0a9('0x32')](_0x4834e0)['then'](handleEntityNotFound(_0x153a4e,null))[_0xf0a9('0x1f')](respondWithResult(_0x153a4e,null))[_0xf0a9('0x33')](handleError(_0x153a4e,null));};exports[_0xf0a9('0x34')]=function(_0x573d27,_0x19e297){return db['ChatProactiveAction'][_0xf0a9('0x34')](_0x573d27[_0xf0a9('0x35')],{})[_0xf0a9('0x1f')](respondWithResult(_0x19e297,0xc9))[_0xf0a9('0x33')](handleError(_0x19e297,null));};exports[_0xf0a9('0x1e')]=function(_0x12e4ba,_0x538ebe){if(_0x12e4ba[_0xf0a9('0x35')]['id']){delete _0x12e4ba['body']['id'];}return db[_0xf0a9('0x31')][_0xf0a9('0x32')]({'where':{'id':_0x12e4ba[_0xf0a9('0x36')]['id']}})[_0xf0a9('0x1f')](handleEntityNotFound(_0x538ebe,null))[_0xf0a9('0x1f')](saveUpdates(_0x12e4ba[_0xf0a9('0x35')],null))[_0xf0a9('0x1f')](respondWithResult(_0x538ebe,null))[_0xf0a9('0x33')](handleError(_0x538ebe,null));};exports['destroy']=function(_0x5826c2,_0x42c072){return db['ChatProactiveAction'][_0xf0a9('0x32')]({'where':{'id':_0x5826c2[_0xf0a9('0x36')]['id']}})[_0xf0a9('0x1f')](handleEntityNotFound(_0x42c072,null))['then'](removeEntity(_0x42c072,null))[_0xf0a9('0x33')](handleError(_0x42c072,null));}; \ No newline at end of file +var _0x4f29=['includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length'];(function(_0x314dff,_0x13a2ad){var _0x4fa92c=function(_0xa14f02){while(--_0xa14f02){_0x314dff['push'](_0x314dff['shift']());}};_0x4fa92c(++_0x13a2ad);}(_0x4f29,0xfd));var _0x94f2=function(_0xd9c0ae,_0x247de7){_0xd9c0ae=_0xd9c0ae-0x0;var _0xa161fd=_0x4f29[_0xd9c0ae];return _0xa161fd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94f2('0x0'));var zipdir=require(_0x94f2('0x1'));var jsonpatch=require(_0x94f2('0x2'));var rp=require(_0x94f2('0x3'));var moment=require(_0x94f2('0x4'));var BPromise=require(_0x94f2('0x5'));var Mustache=require(_0x94f2('0x6'));var util=require(_0x94f2('0x7'));var path=require(_0x94f2('0x8'));var sox=require(_0x94f2('0x9'));var csv=require(_0x94f2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94f2('0xb'));var squel=require(_0x94f2('0xc'));var crypto=require(_0x94f2('0xd'));var jsforce=require(_0x94f2('0xe'));var deskjs=require(_0x94f2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94f2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x94f2('0x11'));var as=require(_0x94f2('0x12'));var hardwareService=require(_0x94f2('0x13'));var logger=require(_0x94f2('0x14'))('api');var utils=require(_0x94f2('0x15'));var config=require(_0x94f2('0x16'));var licenseUtil=require(_0x94f2('0x17'));var db=require(_0x94f2('0x18'))['db'];function respondWithStatusCode(_0xda205f,_0x376b04){_0x376b04=_0x376b04||0xcc;return function(_0x39a8c5){if(_0x39a8c5){return _0xda205f['sendStatus'](_0x376b04);}return _0xda205f[_0x94f2('0x19')](_0x376b04)['end']();};}function respondWithResult(_0x1f84c3,_0x7a3dc0){_0x7a3dc0=_0x7a3dc0||0xc8;return function(_0x47440c){if(_0x47440c){return _0x1f84c3['status'](_0x7a3dc0)['json'](_0x47440c);}};}function respondWithFilteredResult(_0x292953,_0x1ae29d){return function(_0x28d8a7){if(_0x28d8a7){var _0x5db427=typeof _0x1ae29d[_0x94f2('0x1a')]===_0x94f2('0x1b')&&typeof _0x1ae29d['limit']==='undefined';var _0x423aa8=_0x28d8a7[_0x94f2('0x1c')];var _0x32100c=_0x5db427?0x0:_0x1ae29d['offset'];var _0x302c00=_0x5db427?_0x28d8a7[_0x94f2('0x1c')]:_0x1ae29d[_0x94f2('0x1a')]+_0x1ae29d[_0x94f2('0x1d')];var _0x4ceba8;if(_0x302c00>=_0x423aa8){_0x302c00=_0x423aa8;_0x4ceba8=0xc8;}else{_0x4ceba8=0xce;}_0x292953[_0x94f2('0x19')](_0x4ceba8);return _0x292953[_0x94f2('0x1e')]('Content-Range',_0x32100c+'-'+_0x302c00+'/'+_0x423aa8)[_0x94f2('0x1f')](_0x28d8a7);}return null;};}function patchUpdates(_0x25bd7f){return function(_0x238983){try{jsonpatch[_0x94f2('0x20')](_0x238983,_0x25bd7f,!![]);}catch(_0x6858ba){return BPromise[_0x94f2('0x21')](_0x6858ba);}return _0x238983[_0x94f2('0x22')]();};}function saveUpdates(_0x45adbb,_0x3da505){return function(_0xed0b88){if(_0xed0b88){return _0xed0b88[_0x94f2('0x23')](_0x45adbb)[_0x94f2('0x24')](function(_0x34f7a3){return _0x34f7a3;});}return null;};}function removeEntity(_0x35b31d,_0x5057ef){return function(_0x4fec54){if(_0x4fec54){return _0x4fec54[_0x94f2('0x25')]()['then'](function(){_0x35b31d[_0x94f2('0x19')](0xcc)[_0x94f2('0x26')]();});}};}function handleEntityNotFound(_0x5955ce,_0x5f1a6a){return function(_0x497291){if(!_0x497291){_0x5955ce['sendStatus'](0x194);}return _0x497291;};}function handleError(_0x4b0cee,_0x2792bc){_0x2792bc=_0x2792bc||0x1f4;return function(_0x1252eb){logger[_0x94f2('0x27')](_0x1252eb[_0x94f2('0x28')]);if(_0x1252eb[_0x94f2('0x29')]){delete _0x1252eb['name'];}_0x4b0cee[_0x94f2('0x19')](_0x2792bc)['send'](_0x1252eb);};}exports[_0x94f2('0x2a')]=function(_0xd5b804,_0x274659){var _0x2c6463={'raw':!![],'where':{'id':_0xd5b804[_0x94f2('0x2b')]['id']}},_0x361920={};_0x361920[_0x94f2('0x2c')]=_[_0x94f2('0x2d')](db['ChatProactiveAction'][_0x94f2('0x2e')]);_0x361920[_0x94f2('0x2f')]=_[_0x94f2('0x2d')](_0xd5b804[_0x94f2('0x2f')]);_0x361920['filters']=_[_0x94f2('0x30')](_0x361920['model'],_0x361920[_0x94f2('0x2f')]);_0x2c6463[_0x94f2('0x31')]=_[_0x94f2('0x30')](_0x361920['model'],qs[_0x94f2('0x32')](_0xd5b804[_0x94f2('0x2f')][_0x94f2('0x32')]));_0x2c6463[_0x94f2('0x31')]=_0x2c6463[_0x94f2('0x31')][_0x94f2('0x33')]?_0x2c6463[_0x94f2('0x31')]:_0x361920[_0x94f2('0x2c')];if(_0xd5b804['query'][_0x94f2('0x34')]){_0x2c6463[_0x94f2('0x35')]=[{'all':!![]}];}_0x2c6463=_[_0x94f2('0x36')]({},_0x2c6463,_0xd5b804[_0x94f2('0x37')]);return db[_0x94f2('0x38')][_0x94f2('0x39')](_0x2c6463)['then'](handleEntityNotFound(_0x274659,null))[_0x94f2('0x24')](respondWithResult(_0x274659,null))[_0x94f2('0x3a')](handleError(_0x274659,null));};exports[_0x94f2('0x3b')]=function(_0x19c378,_0x206bbd){return db[_0x94f2('0x38')][_0x94f2('0x3b')](_0x19c378[_0x94f2('0x3c')],{})[_0x94f2('0x24')](respondWithResult(_0x206bbd,0xc9))['catch'](handleError(_0x206bbd,null));};exports[_0x94f2('0x23')]=function(_0x568dce,_0x2822b5){if(_0x568dce[_0x94f2('0x3c')]['id']){delete _0x568dce['body']['id'];}return db[_0x94f2('0x38')][_0x94f2('0x39')]({'where':{'id':_0x568dce[_0x94f2('0x2b')]['id']}})[_0x94f2('0x24')](handleEntityNotFound(_0x2822b5,null))[_0x94f2('0x24')](saveUpdates(_0x568dce[_0x94f2('0x3c')],null))[_0x94f2('0x24')](respondWithResult(_0x2822b5,null))[_0x94f2('0x3a')](handleError(_0x2822b5,null));};exports['destroy']=function(_0x64055e,_0x5130db){return db['ChatProactiveAction'][_0x94f2('0x39')]({'where':{'id':_0x64055e['params']['id']}})[_0x94f2('0x24')](handleEntityNotFound(_0x5130db,null))['then'](removeEntity(_0x5130db,null))['catch'](handleError(_0x5130db,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 505bfbb..1aeeb22 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 _0xd178=['./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util','api','moment','bluebird','path','../../config/environment'];(function(_0x4f5535,_0x517bac){var _0x4e3d4b=function(_0x11133e){while(--_0x11133e){_0x4f5535['push'](_0x4f5535['shift']());}};_0x4e3d4b(++_0x517bac);}(_0xd178,0xbf));var _0x8d17=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xd178[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x8d17('0x0'));var util=require(_0x8d17('0x1'));var logger=require('../../config/logger')(_0x8d17('0x2'));var moment=require(_0x8d17('0x3'));var BPromise=require(_0x8d17('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d17('0x5'));var rimraf=require('rimraf');var config=require(_0x8d17('0x6'));var attributes=require(_0x8d17('0x7'));module[_0x8d17('0x8')]=function(_0x484fa0,_0x29f509){return _0x484fa0[_0x8d17('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x8d17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b82=['api','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util'];(function(_0x2520f9,_0x14310d){var _0x431455=function(_0xdb60dd){while(--_0xdb60dd){_0x2520f9['push'](_0x2520f9['shift']());}};_0x431455(++_0x14310d);}(_0x4b82,0x169));var _0x24b8=function(_0x2f21c6,_0x51de35){_0x2f21c6=_0x2f21c6-0x0;var _0x32cbd5=_0x4b82[_0x2f21c6];return _0x32cbd5;};'use strict';var _=require(_0x24b8('0x0'));var util=require(_0x24b8('0x1'));var logger=require('../../config/logger')(_0x24b8('0x2'));var moment=require('moment');var BPromise=require(_0x24b8('0x3'));var rp=require(_0x24b8('0x4'));var fs=require('fs');var path=require(_0x24b8('0x5'));var rimraf=require(_0x24b8('0x6'));var config=require('../../config/environment');var attributes=require(_0x24b8('0x7'));module[_0x24b8('0x8')]=function(_0x3d2073,_0x34b886){return _0x3d2073[_0x24b8('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x24b8('0xa'),'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 b3eff47..1df9d5d 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 _0x7134=['lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x4b91c4,_0x2d0a87){var _0x18e187=function(_0x4d71dc){while(--_0x4d71dc){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x18e187(++_0x2d0a87);}(_0x7134,0x85));var _0x4713=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7134[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4713('0x0'));var util=require(_0x4713('0x1'));var moment=require(_0x4713('0x2'));var BPromise=require('bluebird');var rs=require(_0x4713('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4713('0x4'))(_0x4713('0x5'));var config=require(_0x4713('0x6'));var jayson=require(_0x4713('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a219a,_0x444c5d,_0x54a842){return new BPromise(function(_0x505886,_0x37d58c){return client[_0x4713('0x8')](_0x5a219a,_0x54a842)['then'](function(_0x1482c0){logger[_0x4713('0x9')](_0x4713('0xa'),_0x444c5d,_0x4713('0xb'));logger[_0x4713('0xc')](_0x4713('0xd'),_0x444c5d,_0x4713('0xb'),JSON[_0x4713('0xe')](_0x1482c0));if(_0x1482c0[_0x4713('0xf')]){if(_0x1482c0['error'][_0x4713('0x10')]===0x1f4){logger[_0x4713('0xf')](_0x4713('0xa'),_0x444c5d,_0x1482c0['error'][_0x4713('0x11')]);return _0x37d58c(_0x1482c0[_0x4713('0xf')]['message']);}logger[_0x4713('0xf')](_0x4713('0xa'),_0x444c5d,_0x1482c0['error'][_0x4713('0x11')]);return _0x505886(_0x1482c0[_0x4713('0xf')][_0x4713('0x11')]);}else{logger[_0x4713('0x9')](_0x4713('0xa'),_0x444c5d,_0x4713('0xb'));_0x505886(_0x1482c0['result'][_0x4713('0x11')]);}})[_0x4713('0x12')](function(_0x4b9df2){logger['error'](_0x4713('0xa'),_0x444c5d,_0x4b9df2);_0x37d58c(_0x4b9df2);});});} \ No newline at end of file +var _0xe4bb=['../../config/utils','rpc','../../config/environment','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','bluebird','randomstring','../../mysqldb'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe4bb,0x8f));var _0xbe4b=function(_0x50305c,_0xaab63c){_0x50305c=_0x50305c-0x0;var _0x50f058=_0xe4bb[_0x50305c];return _0x50f058;};'use strict';var _=require('lodash');var util=require(_0xbe4b('0x0'));var moment=require('moment');var BPromise=require(_0xbe4b('0x1'));var rs=require(_0xbe4b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe4b('0x3'))['db'];var utils=require(_0xbe4b('0x4'));var logger=require('../../config/logger')(_0xbe4b('0x5'));var config=require(_0xbe4b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbe4b('0x7')][_0xbe4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21691b,_0x50c96d,_0x198c69){return new BPromise(function(_0x1439b9,_0x44d4b8){return client[_0xbe4b('0x9')](_0x21691b,_0x198c69)[_0xbe4b('0xa')](function(_0x338a69){logger['info'](_0xbe4b('0xb'),_0x50c96d,_0xbe4b('0xc'));logger[_0xbe4b('0xd')](_0xbe4b('0xe'),_0x50c96d,'request\x20sent',JSON['stringify'](_0x338a69));if(_0x338a69[_0xbe4b('0xf')]){if(_0x338a69['error'][_0xbe4b('0x10')]===0x1f4){logger[_0xbe4b('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x50c96d,_0x338a69[_0xbe4b('0xf')][_0xbe4b('0x11')]);return _0x44d4b8(_0x338a69[_0xbe4b('0xf')][_0xbe4b('0x11')]);}logger['error'](_0xbe4b('0xb'),_0x50c96d,_0x338a69[_0xbe4b('0xf')][_0xbe4b('0x11')]);return _0x1439b9(_0x338a69[_0xbe4b('0xf')]['message']);}else{logger[_0xbe4b('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x50c96d,_0xbe4b('0xc'));_0x1439b9(_0x338a69[_0xbe4b('0x13')][_0xbe4b('0x11')]);}})[_0xbe4b('0x14')](function(_0x23ca37){logger['error'](_0xbe4b('0xb'),_0x50c96d,_0x23ca37);_0x44d4b8(_0x23ca37);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2f45ae4..b117189 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 _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x250ce7,_0x502ad3){var _0x416428=function(_0x46564d){while(--_0x46564d){_0x250ce7['push'](_0x250ce7['shift']());}};_0x416428(++_0x502ad3);}(_0x7da7,0x10d));var _0x77da=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x7da7[_0x6ca7f4];return _0x494fa6;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file +var _0x31f0=['fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x45d80c,_0x35c0ff){var _0x449a98=function(_0x1b5ab7){while(--_0x1b5ab7){_0x45d80c['push'](_0x45d80c['shift']());}};_0x449a98(++_0x35c0ff);}(_0x31f0,0xb7));var _0x031f=function(_0x199c61,_0xa5681){_0x199c61=_0x199c61-0x0;var _0x196766=_0x31f0[_0x199c61];return _0x196766;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x031f('0x8')]);router['post']('/',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0xb')](_0x031f('0xc'),auth['isAuthenticated'](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0xc'),auth[_0x031f('0x9')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 207e19d..ec8fa9b 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 _0x5738=['STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5738,0x91));var _0x8573=function(_0x1aed01,_0x3b59f3){_0x1aed01=_0x1aed01-0x0;var _0x34ccb8=_0x5738[_0x1aed01];return _0x34ccb8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8573('0x0')],'unique':_0x8573('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8573('0x0')]},'timeout':{'type':Sequelize[_0x8573('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8573('0x3'),'beepall',_0x8573('0x4'))}}; \ No newline at end of file +var _0x7c5f=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2c0a00,_0x3548e4){var _0x119901=function(_0x2a3f40){while(--_0x2a3f40){_0x2c0a00['push'](_0x2c0a00['shift']());}};_0x119901(++_0x3548e4);}(_0x7c5f,0x1e8));var _0xf7c5=function(_0x5e0c66,_0x12ca8e){_0x5e0c66=_0x5e0c66-0x0;var _0x223c99=_0x7c5f[_0x5e0c66];return _0x223c99;};'use strict';var Sequelize=require(_0xf7c5('0x0'));module[_0xf7c5('0x1')]={'name':{'type':Sequelize[_0xf7c5('0x2')],'unique':_0xf7c5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf7c5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf7c5('0x5')](_0xf7c5('0x6'),_0xf7c5('0x7'),_0xf7c5('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 06ce054..57b1a8a 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 _0x324b=['jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','destroy','UserProfileResource','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','ChatQueue','includeAll','include','rows','show','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','getTeams','Team','addTeams','findAll','User','Agents','online','voicePause','interface','sequelize','each','findOrCreate','emit','removeTeams','ids','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','value','transaction','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0x4a5c92,_0x23dfae){var _0x561e54=function(_0x3bf38c){while(--_0x3bf38c){_0x4a5c92['push'](_0x4a5c92['shift']());}};_0x561e54(++_0x23dfae);}(_0x324b,0x1a5));var _0xb324=function(_0x2c936a,_0x3e3797){_0x2c936a=_0x2c936a-0x0;var _0x53caa0=_0x324b[_0x2c936a];return _0x53caa0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb324('0x0'));var zipdir=require(_0xb324('0x1'));var jsonpatch=require(_0xb324('0x2'));var rp=require(_0xb324('0x3'));var moment=require(_0xb324('0x4'));var BPromise=require(_0xb324('0x5'));var Mustache=require(_0xb324('0x6'));var util=require(_0xb324('0x7'));var path=require('path');var sox=require(_0xb324('0x8'));var csv=require(_0xb324('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb324('0xa'));var _=require('lodash');var squel=require(_0xb324('0xb'));var crypto=require(_0xb324('0xc'));var jsforce=require(_0xb324('0xd'));var deskjs=require(_0xb324('0xe'));var toCsv=require(_0xb324('0x9'));var querystring=require(_0xb324('0xf'));var Papa=require(_0xb324('0x10'));var Redis=require(_0xb324('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb324('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb324('0x13'));var logger=require(_0xb324('0x14'))(_0xb324('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb324('0x16'));var db=require(_0xb324('0x17'))['db'];config[_0xb324('0x18')]=_[_0xb324('0x19')](config[_0xb324('0x18')],{'host':_0xb324('0x1a'),'port':0x18eb});var socket=require(_0xb324('0x1b'))(new Redis(config[_0xb324('0x18')]));require(_0xb324('0x1c'))['register'](socket);var jayson=require(_0xb324('0x1d'));var client=jayson[_0xb324('0x1e')][_0xb324('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x44b819,_0x2c55cd,_0x480793,_0x3bb4c0){return new BPromise(function(_0x90c78f,_0x4e7adf){var _0x3ecf6d=_0x3bb4c0||client;return _0x3ecf6d[_0xb324('0x20')](_0x44b819,_0x480793)[_0xb324('0x21')](function(_0x164486){logger['info'](_0xb324('0x22'),_0x2c55cd,_0xb324('0x23'));logger[_0xb324('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2c55cd,_0xb324('0x23'),JSON[_0xb324('0x25')](_0x164486));if(_0x164486[_0xb324('0x26')]){if(_0x164486[_0xb324('0x26')][_0xb324('0x27')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2c55cd,_0x164486['error'][_0xb324('0x28')]);return _0x4e7adf(_0x164486['error'][_0xb324('0x28')]);}logger[_0xb324('0x26')](_0xb324('0x22'),_0x2c55cd,_0x164486[_0xb324('0x26')]['message']);return _0x90c78f(_0x164486[_0xb324('0x26')]['message']);}else{logger[_0xb324('0x29')](_0xb324('0x22'),_0x2c55cd,_0xb324('0x23'));_0x90c78f(_0x164486[_0xb324('0x2a')][_0xb324('0x28')]);}})[_0xb324('0x2b')](function(_0x48ed1b){logger[_0xb324('0x26')](_0xb324('0x22'),_0x2c55cd,_0x48ed1b);_0x4e7adf(_0x48ed1b);});});}function respondWithStatusCode(_0x48703f,_0x45f107){_0x45f107=_0x45f107||0xcc;return function(_0x43bd50){if(_0x43bd50){return _0x48703f[_0xb324('0x2c')](_0x45f107);}return _0x48703f[_0xb324('0x2d')](_0x45f107)[_0xb324('0x2e')]();};}function respondWithResult(_0x56d28b,_0x43510b){_0x43510b=_0x43510b||0xc8;return function(_0x25162e){if(_0x25162e){return _0x56d28b[_0xb324('0x2d')](_0x43510b)[_0xb324('0x2f')](_0x25162e);}};}function respondWithFilteredResult(_0x1b6062,_0x2091c6){return function(_0x35f2b5){if(_0x35f2b5){var _0xd9df48=typeof _0x2091c6[_0xb324('0x30')]==='undefined'&&typeof _0x2091c6['limit']===_0xb324('0x31');var _0x187087=_0x35f2b5[_0xb324('0x32')];var _0x233e1c=_0xd9df48?0x0:_0x2091c6[_0xb324('0x30')];var _0x214fb1=_0xd9df48?_0x35f2b5['count']:_0x2091c6[_0xb324('0x30')]+_0x2091c6[_0xb324('0x33')];var _0x5c3b5a;if(_0x214fb1>=_0x187087){_0x214fb1=_0x187087;_0x5c3b5a=0xc8;}else{_0x5c3b5a=0xce;}_0x1b6062[_0xb324('0x2d')](_0x5c3b5a);return _0x1b6062['set'](_0xb324('0x34'),_0x233e1c+'-'+_0x214fb1+'/'+_0x187087)[_0xb324('0x2f')](_0x35f2b5);}return null;};}function patchUpdates(_0x4ae187){return function(_0x51464a){try{jsonpatch['apply'](_0x51464a,_0x4ae187,!![]);}catch(_0x1efffc){return BPromise['reject'](_0x1efffc);}return _0x51464a[_0xb324('0x35')]();};}function saveUpdates(_0xa6629e,_0x327527){return function(_0x2aa3d5){if(_0x2aa3d5){return _0x2aa3d5['update'](_0xa6629e)['then'](function(_0x427c86){return _0x427c86;});}return null;};}function removeEntity(_0x24c9c4,_0x528cab){return function(_0x4e10e1){if(_0x4e10e1){return _0x4e10e1[_0xb324('0x36')]()[_0xb324('0x21')](function(){var _0x3e1f36=_0x4e10e1['get']({'plain':!![]});var _0x25b375='ChatQueues';return db[_0xb324('0x37')][_0xb324('0x36')]({'where':{'type':_0x25b375,'resourceId':_0x3e1f36['id']}})[_0xb324('0x21')](function(){return _0x4e10e1;});})[_0xb324('0x21')](function(){_0x24c9c4[_0xb324('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6734,_0x1bac2e){return function(_0x17e2be){if(!_0x17e2be){_0x2c6734[_0xb324('0x2c')](0x194);}return _0x17e2be;};}function handleError(_0x2b0822,_0x3d9705){_0x3d9705=_0x3d9705||0x1f4;return function(_0xb08ee7){logger['error'](_0xb08ee7[_0xb324('0x38')]);if(_0xb08ee7['name']){delete _0xb08ee7['name'];}_0x2b0822[_0xb324('0x2d')](_0x3d9705)[_0xb324('0x39')](_0xb08ee7);};}exports[_0xb324('0x3a')]=function(_0x549228,_0x1ec8f4){var _0x4876f1={},_0x4c4923={},_0x15f298={'count':0x0,'rows':[]};var _0x57d925=_[_0xb324('0x3b')](db['ChatQueue'][_0xb324('0x3c')],function(_0x1c1467){return{'name':_0x1c1467[_0xb324('0x3d')],'type':_0x1c1467[_0xb324('0x3e')][_0xb324('0x3f')]};});_0x4c4923[_0xb324('0x40')]=_[_0xb324('0x3b')](_0x57d925,_0xb324('0x41'));_0x4c4923['query']=_[_0xb324('0x42')](_0x549228[_0xb324('0x43')]);_0x4c4923[_0xb324('0x44')]=_[_0xb324('0x45')](_0x4c4923[_0xb324('0x40')],_0x4c4923[_0xb324('0x43')]);_0x4876f1[_0xb324('0x46')]=_[_0xb324('0x45')](_0x4c4923[_0xb324('0x40')],qs[_0xb324('0x47')](_0x549228['query'][_0xb324('0x47')]));_0x4876f1[_0xb324('0x46')]=_0x4876f1[_0xb324('0x46')][_0xb324('0x48')]?_0x4876f1[_0xb324('0x46')]:_0x4c4923[_0xb324('0x40')];if(!_0x549228[_0xb324('0x43')]['hasOwnProperty'](_0xb324('0x49'))){_0x4876f1[_0xb324('0x33')]=qs['limit'](_0x549228[_0xb324('0x43')][_0xb324('0x33')]);_0x4876f1['offset']=qs[_0xb324('0x30')](_0x549228[_0xb324('0x43')][_0xb324('0x30')]);}_0x4876f1[_0xb324('0x4a')]=qs[_0xb324('0x4b')](_0x549228[_0xb324('0x43')][_0xb324('0x4b')]);_0x4876f1[_0xb324('0x4c')]=qs['filters'](_[_0xb324('0x4d')](_0x549228[_0xb324('0x43')],_0x4c4923[_0xb324('0x44')]),_0x57d925);if(_0x549228[_0xb324('0x43')][_0xb324('0x4e')]){_0x4876f1[_0xb324('0x4c')]=_[_0xb324('0x4f')](_0x4876f1[_0xb324('0x4c')],{'$or':_[_0xb324('0x3b')](_0x57d925,function(_0x525657){if(_0x525657['type']!=='VIRTUAL'){var _0x1b29e8={};_0x1b29e8[_0x525657['name']]={'$like':'%'+_0x549228['query'][_0xb324('0x4e')]+'%'};return _0x1b29e8;}})});}_0x4876f1=_['merge']({},_0x4876f1,_0x549228['options']);var _0xbf3221={'where':_0x4876f1[_0xb324('0x4c')]};return db[_0xb324('0x50')]['count'](_0xbf3221)[_0xb324('0x21')](function(_0x2ef424){_0x15f298[_0xb324('0x32')]=_0x2ef424;if(_0x549228['query'][_0xb324('0x51')]){_0x4876f1[_0xb324('0x52')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x4876f1);})[_0xb324('0x21')](function(_0x4d593c){_0x15f298[_0xb324('0x53')]=_0x4d593c;return _0x15f298;})[_0xb324('0x21')](respondWithFilteredResult(_0x1ec8f4,_0x4876f1))[_0xb324('0x2b')](handleError(_0x1ec8f4,null));};exports[_0xb324('0x54')]=function(_0x1b9f84,_0xe559b0){var _0x5d1272={'raw':!![],'where':{'id':_0x1b9f84[_0xb324('0x55')]['id']}},_0x1fdf65={};_0x1fdf65[_0xb324('0x40')]=_[_0xb324('0x42')](db['ChatQueue'][_0xb324('0x3c')]);_0x1fdf65[_0xb324('0x43')]=_['keys'](_0x1b9f84[_0xb324('0x43')]);_0x1fdf65['filters']=_['intersection'](_0x1fdf65[_0xb324('0x40')],_0x1fdf65[_0xb324('0x43')]);_0x5d1272[_0xb324('0x46')]=_[_0xb324('0x45')](_0x1fdf65[_0xb324('0x40')],qs[_0xb324('0x47')](_0x1b9f84['query'][_0xb324('0x47')]));_0x5d1272[_0xb324('0x46')]=_0x5d1272[_0xb324('0x46')][_0xb324('0x48')]?_0x5d1272[_0xb324('0x46')]:_0x1fdf65['model'];if(_0x1b9f84[_0xb324('0x43')][_0xb324('0x51')]){_0x5d1272['include']=[{'all':!![]}];}_0x5d1272=_[_0xb324('0x4f')]({},_0x5d1272,_0x1b9f84[_0xb324('0x56')]);return db[_0xb324('0x50')][_0xb324('0x57')](_0x5d1272)[_0xb324('0x21')](handleEntityNotFound(_0xe559b0,null))[_0xb324('0x21')](respondWithResult(_0xe559b0,null))[_0xb324('0x2b')](handleError(_0xe559b0,null));};exports[_0xb324('0x58')]=function(_0x5e16ac,_0x2272ab){return db[_0xb324('0x50')][_0xb324('0x58')](_0x5e16ac['body'],{})[_0xb324('0x21')](function(_0xd12e9c){var _0x4ee45e=_0x5e16ac[_0xb324('0x59')][_0xb324('0x5a')]({'plain':!![]});if(!_0x4ee45e)throw new Error(_0xb324('0x5b'));if(_0x4ee45e['role']===_0xb324('0x59')){var _0x33842a=_0xd12e9c[_0xb324('0x5a')]({'plain':!![]});var _0x1dca3b=_0xb324('0x5c');return db[_0xb324('0x5d')][_0xb324('0x57')]({'where':{'name':_0x1dca3b,'userProfileId':_0x4ee45e[_0xb324('0x5e')]},'raw':!![]})[_0xb324('0x21')](function(_0x3d17bb){if(_0x3d17bb&&_0x3d17bb['autoAssociation']===0x0){return db[_0xb324('0x37')][_0xb324('0x58')]({'name':_0x33842a['name'],'resourceId':_0x33842a['id'],'type':_0x3d17bb[_0xb324('0x41')],'sectionId':_0x3d17bb['id']},{})[_0xb324('0x21')](function(){return _0xd12e9c;});}else{return _0xd12e9c;}})[_0xb324('0x2b')](function(_0x561f0d){logger['error'](_0xb324('0x5f'),_0x561f0d);throw _0x561f0d;});}return _0xd12e9c;})[_0xb324('0x21')](respondWithResult(_0x2272ab,0xc9))[_0xb324('0x2b')](handleError(_0x2272ab,null));};exports['update']=function(_0x3f726d,_0x821c6e){if(_0x3f726d[_0xb324('0x60')]['id']){delete _0x3f726d[_0xb324('0x60')]['id'];}return db[_0xb324('0x50')]['find']({'where':{'id':_0x3f726d['params']['id']}})['then'](handleEntityNotFound(_0x821c6e,null))[_0xb324('0x21')](saveUpdates(_0x3f726d[_0xb324('0x60')],null))[_0xb324('0x21')](respondWithResult(_0x821c6e,null))[_0xb324('0x2b')](handleError(_0x821c6e,null));};exports[_0xb324('0x36')]=function(_0x50ec43,_0x2d4cee){return db[_0xb324('0x50')][_0xb324('0x57')]({'where':{'id':_0x50ec43[_0xb324('0x55')]['id']}})[_0xb324('0x21')](handleEntityNotFound(_0x2d4cee,null))['then'](removeEntity(_0x2d4cee,null))[_0xb324('0x2b')](handleError(_0x2d4cee,null));};exports['describe']=function(_0x540641,_0x1372e4){return db[_0xb324('0x50')]['describe']()[_0xb324('0x21')](respondWithResult(_0x1372e4,null))[_0xb324('0x2b')](handleError(_0x1372e4,null));};exports[_0xb324('0x61')]=function(_0x1638c0,_0x38a039,_0x2a8d0d){var _0x2de304={'raw':!![],'where':{}},_0x5d99cd={},_0x4ab954;return db['ChatQueue'][_0xb324('0x62')]({'where':{'id':_0x1638c0[_0xb324('0x55')]['id']}})['then'](handleEntityNotFound(_0x38a039,null))[_0xb324('0x21')](function(_0x5b7acb){if(_0x5b7acb){_0x4ab954=_0x5b7acb['get']({'plain':!![]});_0x5d99cd[_0xb324('0x40')]=_[_0xb324('0x42')](db[_0xb324('0x63')][_0xb324('0x3c')]);_0x5d99cd[_0xb324('0x43')]=_[_0xb324('0x42')](_0x1638c0['query']);_0x5d99cd[_0xb324('0x44')]=_[_0xb324('0x45')](_0x5d99cd[_0xb324('0x40')],_0x5d99cd[_0xb324('0x43')]);_0x2de304['attributes']=_['intersection'](_0x5d99cd[_0xb324('0x40')],qs['fields'](_0x1638c0[_0xb324('0x43')][_0xb324('0x47')]));_0x2de304[_0xb324('0x46')]=_0x2de304[_0xb324('0x46')]['length']?_0x2de304[_0xb324('0x46')]:_0x5d99cd['model'];if(!_0x1638c0[_0xb324('0x43')][_0xb324('0x64')](_0xb324('0x49'))){_0x2de304[_0xb324('0x33')]=qs[_0xb324('0x33')](_0x1638c0[_0xb324('0x43')]['limit']);_0x2de304[_0xb324('0x30')]=qs[_0xb324('0x30')](_0x1638c0[_0xb324('0x43')][_0xb324('0x30')]);}_0x2de304['order']=qs[_0xb324('0x4b')](_0x1638c0[_0xb324('0x43')][_0xb324('0x4b')]);_0x2de304[_0xb324('0x4c')]=qs[_0xb324('0x44')](_[_0xb324('0x4d')](_0x1638c0['query'],_0x5d99cd[_0xb324('0x44')]));_0x2de304[_0xb324('0x4c')][_0xb324('0x65')]=_0x5b7acb['id'];if(_0x1638c0[_0xb324('0x43')]['filter']){_0x2de304[_0xb324('0x4c')]=_['merge'](_0x2de304[_0xb324('0x4c')],{'$or':_['map'](_0x2de304[_0xb324('0x46')],function(_0x32263c){var _0x1eb1e8={};_0x1eb1e8[_0x32263c]={'$like':'%'+_0x1638c0[_0xb324('0x43')][_0xb324('0x4e')]+'%'};return _0x1eb1e8;})});}_0x2de304=_[_0xb324('0x4f')]({},_0x2de304,_0x1638c0[_0xb324('0x56')]);return db[_0xb324('0x63')]['findAll'](_0x2de304);}})[_0xb324('0x21')](function(_0x17507e){if(_0x17507e){return db['User'][_0xb324('0x66')]({'where':{'id':_['map'](_0x17507e,_0xb324('0x67')),'role':_0xb324('0x68')},'attributes':['id',_0xb324('0x41'),_0xb324('0x69'),_0xb324('0x6a'),_0xb324('0x6b')]});}})['then'](function(_0x2058c8){if(_0x2058c8){return{'count':_0x2058c8[_0xb324('0x32')],'rows':_[_0xb324('0x3b')](_0x2058c8[_0xb324('0x53')],function(_0x4684d4){return{'membername':_0x4684d4[_0xb324('0x41')],'UserId':_0x4684d4['id'],'queue_name':_0x4ab954[_0xb324('0x41')],'ChatQueueId':_0x4ab954['id'],'interface':util[_0xb324('0x6c')]('%s/%s','SIP',_0x4684d4[_0xb324('0x41')]),'penalty':0x0,'paused':_0x4684d4[_0xb324('0x69')],'createdAt':_0x4684d4['createdAt'],'updatedAt':_0x4684d4[_0xb324('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x38a039,_0x2de304))['catch'](handleError(_0x38a039,null));};exports[_0xb324('0x6d')]=function(_0x2fe627,_0x4a7c3a,_0x96affd){var _0x25f5f3={};var _0x411162={};var _0xf71b12;var _0x5b6a68;return db[_0xb324('0x50')]['findOne']({'where':{'id':_0x2fe627[_0xb324('0x55')]['id']}})['then'](handleEntityNotFound(_0x4a7c3a,null))['then'](function(_0xa8ada7){if(_0xa8ada7){_0xf71b12=_0xa8ada7;_0x411162[_0xb324('0x40')]=_[_0xb324('0x42')](db[_0xb324('0x6e')][_0xb324('0x3c')]);_0x411162[_0xb324('0x43')]=_[_0xb324('0x42')](_0x2fe627[_0xb324('0x43')]);_0x411162[_0xb324('0x44')]=_[_0xb324('0x45')](_0x411162['model'],_0x411162[_0xb324('0x43')]);_0x25f5f3[_0xb324('0x46')]=_['intersection'](_0x411162['model'],qs[_0xb324('0x47')](_0x2fe627[_0xb324('0x43')][_0xb324('0x47')]));_0x25f5f3[_0xb324('0x46')]=_0x25f5f3[_0xb324('0x46')]['length']?_0x25f5f3[_0xb324('0x46')]:_0x411162[_0xb324('0x40')];_0x25f5f3[_0xb324('0x4a')]=qs['sort'](_0x2fe627[_0xb324('0x43')][_0xb324('0x4b')]);_0x25f5f3[_0xb324('0x4c')]=qs[_0xb324('0x44')](_['pick'](_0x2fe627['query'],_0x411162[_0xb324('0x44')]));if(_0x2fe627[_0xb324('0x43')][_0xb324('0x4e')]){_0x25f5f3['where']=_[_0xb324('0x4f')](_0x25f5f3[_0xb324('0x4c')],{'$or':_[_0xb324('0x3b')](_0x25f5f3[_0xb324('0x46')],function(_0x3d34d8){var _0x568895={};_0x568895[_0x3d34d8]={'$like':'%'+_0x2fe627[_0xb324('0x43')][_0xb324('0x4e')]+'%'};return _0x568895;})});}_0x25f5f3=_[_0xb324('0x4f')]({},_0x25f5f3,_0x2fe627['options']);return _0xf71b12['getTeams'](_0x25f5f3);}})['then'](function(_0x187673){if(_0x187673){_0x5b6a68=_0x187673[_0xb324('0x48')];if(!_0x2fe627[_0xb324('0x43')]['hasOwnProperty'](_0xb324('0x49'))){_0x25f5f3['limit']=qs[_0xb324('0x33')](_0x2fe627[_0xb324('0x43')][_0xb324('0x33')]);_0x25f5f3['offset']=qs[_0xb324('0x30')](_0x2fe627[_0xb324('0x43')][_0xb324('0x30')]);}return _0xf71b12['getTeams'](_0x25f5f3);}})[_0xb324('0x21')](function(_0x3ceaec){if(_0x3ceaec){return _0x3ceaec?{'count':_0x5b6a68,'rows':_0x3ceaec}:null;}})[_0xb324('0x21')](respondWithResult(_0x4a7c3a,null))[_0xb324('0x2b')](handleError(_0x4a7c3a,null));};exports[_0xb324('0x6f')]=function(_0x3a28de,_0x8cb9f8,_0x1bdfab){var _0x43874e=_0x3a28de[_0xb324('0x60')]['ids'];return db[_0xb324('0x6e')][_0xb324('0x70')]({'where':{'id':_0x43874e},'attributes':['id'],'include':[{'model':db[_0xb324('0x71')],'as':_0xb324('0x72'),'attributes':['id','name',_0xb324('0x73'),_0xb324('0x74'),_0xb324('0x75')],'raw':!![]}]})['then'](function(_0x32061c){if(_0x32061c){var _0x3a2a8f=_['flatMap'](_0x32061c,function(_0x819900){var _0x4aaea3=_0x819900['get']({'plain':!![]});return _0x4aaea3[_0xb324('0x72')];});return db[_0xb324('0x50')][_0xb324('0x57')]({'where':{'id':_0x3a28de[_0xb324('0x55')]['id']}})[_0xb324('0x21')](function(_0x99f5fd){return db[_0xb324('0x76')]['transaction'](function(_0x5a0b8e){return _0x99f5fd[_0xb324('0x6f')](_0x43874e,{'transaction':_0x5a0b8e})['then'](function(){return BPromise[_0xb324('0x77')](_0x3a2a8f,function(_0x12ac67){return db[_0xb324('0x63')][_0xb324('0x78')]({'where':{'UserId':_0x12ac67['id'],'ChatQueueId':_0x3a28de[_0xb324('0x55')]['id']},'transaction':_0x5a0b8e});});})[_0xb324('0x21')](function(){_0x3a2a8f['forEach'](function(_0x4e4094){socket[_0xb324('0x79')]('userChatQueue:save',{'UserId':_0x4e4094['id'],'ChatQueueId':_0x99f5fd['id']});});});});});}})['then'](respondWithStatusCode(_0x8cb9f8,null))[_0xb324('0x2b')](handleError(_0x8cb9f8,null));};exports[_0xb324('0x7a')]=function(_0x460762,_0x52d89b,_0x5b6d6a){return db['Team'][_0xb324('0x70')]({'where':{'id':_0x460762[_0xb324('0x43')][_0xb324('0x7b')]},'attributes':['id'],'include':[{'model':db[_0xb324('0x71')],'as':_0xb324('0x72'),'attributes':['id'],'raw':!![]}]})[_0xb324('0x21')](handleEntityNotFound(_0x52d89b,null))[_0xb324('0x21')](function(_0x4eb8fa){var _0x32da50=_[_0xb324('0x3b')](_0x4eb8fa,'id');var _0x79db15=[];var _0x4143d3=[];var _0x522a72=squel['select']();_0x522a72['field'](_0xb324('0x7c'))[_0xb324('0x7d')](_0xb324('0x7e'),'tq')[_0xb324('0x7f')](_0xb324('0x80'),'ut',_0xb324('0x81'))['where'](_0xb324('0x82'),_0x460762['params']['id']);for(var _0x50ab81=0x0;_0x50ab81<_0x4eb8fa[_0xb324('0x48')];_0x50ab81+=0x1){let _0x73ec39=_0x4eb8fa[_0x50ab81];for(var _0x482ba2=0x0;_0x482ba2<_0x73ec39[_0xb324('0x72')][_0xb324('0x48')];_0x482ba2+=0x1){let _0x1c8c89=_0x73ec39[_0xb324('0x72')][_0x482ba2];var _0x23418a=_0x522a72['clone']();_0x23418a[_0xb324('0x4c')](_0xb324('0x83'),_0x1c8c89['id']);_0x4143d3['push'](db[_0xb324('0x76')][_0xb324('0x43')](_0x23418a[_0xb324('0x84')](),{'type':db['sequelize']['QueryTypes'][_0xb324('0x85')]})['then'](function(_0x3013db){if(_0x3013db[_0xb324('0x48')]===0x1){return _0x1c8c89['id'];}else{var _0x1181de=_[_0xb324('0x86')](_[_0xb324('0x3b')](_0x3013db,_0xb324('0x87')),function(_0x5f9154){return _[_0xb324('0x88')](_0x32da50,_0x5f9154);});if(_0x1181de){return _0x1c8c89['id'];}}}));}}return BPromise[_0xb324('0x89')](_0x4143d3)[_0xb324('0x21')](function(_0x218344){_0x79db15=_(_0x79db15)[_0xb324('0x8a')](_0x218344)['compact']()[_0xb324('0x8b')]();return db[_0xb324('0x50')][_0xb324('0x57')]({'where':{'id':_0x460762['params']['id']}})[_0xb324('0x21')](function(_0x2dc8f3){return db[_0xb324('0x76')][_0xb324('0x8c')](function(_0x4fc396){return _0x2dc8f3[_0xb324('0x7a')](_0x460762['query'][_0xb324('0x7b')],{'transaction':_0x4fc396})[_0xb324('0x21')](function(){if(!_['isEmpty'](_0x79db15)){return _0x2dc8f3[_0xb324('0x8d')](_0x79db15,{'transaction':_0x4fc396});}})[_0xb324('0x21')](function(){_0x79db15[_0xb324('0x8e')](function(_0x3d8f50){socket[_0xb324('0x79')](_0xb324('0x8f'),{'UserId':_0x3d8f50,'ChatQueueId':_0x2dc8f3['id']});});});});});});})[_0xb324('0x21')](respondWithStatusCode(_0x52d89b,null))[_0xb324('0x2b')](handleError(_0x52d89b,null));};exports[_0xb324('0x90')]=function(_0x457210,_0x5f0e46,_0x43ac6c){return db[_0xb324('0x50')][_0xb324('0x57')]({'where':{'id':_0x457210[_0xb324('0x55')]['id']}})[_0xb324('0x21')](handleEntityNotFound(_0x5f0e46,null))[_0xb324('0x21')](function(_0x1a5dc0){if(_0x1a5dc0){return _0x1a5dc0[_0xb324('0x90')](_0x457210[_0xb324('0x60')][_0xb324('0x7b')],_[_0xb324('0x91')](_0x457210['body'],['ids','id'])||{})[_0xb324('0x92')](function(_0x506161){for(var _0x242856=0x0;_0x242856<_0x457210[_0xb324('0x60')][_0xb324('0x7b')][_0xb324('0x48')];_0x242856+=0x1){socket[_0xb324('0x79')](_0xb324('0x93'),{'UserId':Number(_0x457210[_0xb324('0x60')][_0xb324('0x7b')][_0x242856]),'ChatQueueId':Number(_0x457210[_0xb324('0x55')]['id'])});}return _0x506161;});}})['then'](respondWithResult(_0x5f0e46,null))[_0xb324('0x2b')](handleError(_0x5f0e46,null));};exports[_0xb324('0x8d')]=function(_0xef4b4a,_0x263daa,_0x2cf777){return db[_0xb324('0x50')][_0xb324('0x57')]({'where':{'id':_0xef4b4a[_0xb324('0x55')]['id']}})[_0xb324('0x21')](handleEntityNotFound(_0x263daa,null))['then'](function(_0x4f2a06){if(_0x4f2a06){return _0x4f2a06['removeAgents'](_0xef4b4a[_0xb324('0x43')][_0xb324('0x7b')])[_0xb324('0x21')](function(){if(_[_0xb324('0x94')](_0xef4b4a['query']['ids'])){for(var _0xa3295b=0x0;_0xa3295b<_0xef4b4a[_0xb324('0x43')][_0xb324('0x7b')][_0xb324('0x48')];_0xa3295b+=0x1){socket['emit'](_0xb324('0x8f'),{'UserId':Number(_0xef4b4a[_0xb324('0x43')][_0xb324('0x7b')][_0xa3295b]),'ChatQueueId':Number(_0xef4b4a[_0xb324('0x55')]['id'])});}}else{socket[_0xb324('0x79')](_0xb324('0x8f'),{'UserId':Number(_0xef4b4a['query'][_0xb324('0x7b')]),'ChatQueueId':Number(_0xef4b4a[_0xb324('0x55')]['id'])});}});}})[_0xb324('0x21')](respondWithStatusCode(_0x263daa,null))[_0xb324('0x2b')](handleError(_0x263daa,null));};exports[_0xb324('0x95')]=function(_0x294ede,_0xf1dc9,_0x105205){var _0x726128={};var _0x9dd867={};var _0xc9b7bc;var _0xab84dd;return db['ChatQueue'][_0xb324('0x62')]({'where':{'id':_0x294ede[_0xb324('0x55')]['id']}})[_0xb324('0x21')](handleEntityNotFound(_0xf1dc9,null))[_0xb324('0x21')](function(_0x19bad1){if(_0x19bad1){_0xc9b7bc=_0x19bad1;_0x9dd867['model']=_[_0xb324('0x42')](db['User'][_0xb324('0x3c')]);_0x9dd867['query']=_[_0xb324('0x42')](_0x294ede[_0xb324('0x43')]);_0x9dd867['filters']=_[_0xb324('0x45')](_0x9dd867[_0xb324('0x40')],_0x9dd867[_0xb324('0x43')]);_0x726128[_0xb324('0x46')]=_[_0xb324('0x45')](_0x9dd867[_0xb324('0x40')],qs[_0xb324('0x47')](_0x294ede[_0xb324('0x43')][_0xb324('0x47')]));_0x726128[_0xb324('0x46')]=_0x726128[_0xb324('0x46')][_0xb324('0x48')]?_0x726128[_0xb324('0x46')]:_0x9dd867[_0xb324('0x40')];_0x726128[_0xb324('0x4a')]=qs['sort'](_0x294ede[_0xb324('0x43')][_0xb324('0x4b')]);_0x726128['where']=qs[_0xb324('0x44')](_[_0xb324('0x4d')](_0x294ede[_0xb324('0x43')],_0x9dd867[_0xb324('0x44')]));if(_0x294ede['query'][_0xb324('0x4e')]){_0x726128[_0xb324('0x4c')]=_['merge'](_0x726128['where'],{'$or':_[_0xb324('0x3b')](_0x726128[_0xb324('0x46')],function(_0xec190b){var _0x1025ec={};_0x1025ec[_0xec190b]={'$like':'%'+_0x294ede[_0xb324('0x43')]['filter']+'%'};return _0x1025ec;})});}_0x726128=_[_0xb324('0x4f')]({},_0x726128,_0x294ede[_0xb324('0x56')]);return _0xc9b7bc[_0xb324('0x95')](_0x726128);}})[_0xb324('0x21')](function(_0x5aa977){if(_0x5aa977){_0xab84dd=_0x5aa977[_0xb324('0x48')];if(!_0x294ede[_0xb324('0x43')][_0xb324('0x64')]('nolimit')){_0x726128['limit']=qs[_0xb324('0x33')](_0x294ede[_0xb324('0x43')][_0xb324('0x33')]);_0x726128[_0xb324('0x30')]=qs[_0xb324('0x30')](_0x294ede[_0xb324('0x43')][_0xb324('0x30')]);}return _0xc9b7bc[_0xb324('0x95')](_0x726128);}})[_0xb324('0x21')](function(_0x59c0cf){if(_0x59c0cf){return _0x59c0cf?{'count':_0xab84dd,'rows':_0x59c0cf}:null;}})[_0xb324('0x21')](respondWithResult(_0xf1dc9,null))[_0xb324('0x2b')](handleError(_0xf1dc9,null));}; \ No newline at end of file +var _0x8212=['flatMap','sequelize','addTeams','findOrCreate','forEach','userChatQueue:save','removeTeams','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','push','QueryTypes','includes','all','union','compact','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','emit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','send','index','map','ChatQueue','rawAttributes','fieldName','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','count','include','findAll','rows','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','order','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','ids','Team','User','Agents','online','voicePause','interface'];(function(_0x252782,_0x5b7839){var _0x5123ea=function(_0xbace4b){while(--_0xbace4b){_0x252782['push'](_0x252782['shift']());}};_0x5123ea(++_0x5b7839);}(_0x8212,0xb3));var _0x2821=function(_0x4bb32f,_0x2217e){_0x4bb32f=_0x4bb32f-0x0;var _0x2dd6e6=_0x8212[_0x4bb32f];return _0x2dd6e6;};'use strict';var emlformat=require(_0x2821('0x0'));var rimraf=require(_0x2821('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2821('0x2'));var rp=require(_0x2821('0x3'));var moment=require(_0x2821('0x4'));var BPromise=require(_0x2821('0x5'));var Mustache=require(_0x2821('0x6'));var util=require(_0x2821('0x7'));var path=require(_0x2821('0x8'));var sox=require(_0x2821('0x9'));var csv=require('to-csv');var ejs=require(_0x2821('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2821('0xb'));var squel=require(_0x2821('0xc'));var crypto=require('crypto');var jsforce=require(_0x2821('0xd'));var deskjs=require(_0x2821('0xe'));var toCsv=require(_0x2821('0xf'));var querystring=require(_0x2821('0x10'));var Papa=require(_0x2821('0x11'));var Redis=require(_0x2821('0x12'));var authService=require(_0x2821('0x13'));var qs=require(_0x2821('0x14'));var as=require(_0x2821('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2821('0x16'))(_0x2821('0x17'));var utils=require(_0x2821('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2821('0x19')](config[_0x2821('0x1a')],{'host':_0x2821('0x1b'),'port':0x18eb});var socket=require(_0x2821('0x1c'))(new Redis(config[_0x2821('0x1a')]));require(_0x2821('0x1d'))['register'](socket);var jayson=require(_0x2821('0x1e'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4142f1,_0xe30acf,_0x243c46,_0x472238){return new BPromise(function(_0x4bba07,_0x155811){var _0x5c2aa7=_0x472238||client;return _0x5c2aa7[_0x2821('0x1f')](_0x4142f1,_0x243c46)[_0x2821('0x20')](function(_0x41f30b){logger[_0x2821('0x21')](_0x2821('0x22'),_0xe30acf,_0x2821('0x23'));logger[_0x2821('0x24')](_0x2821('0x25'),_0xe30acf,'request\x20sent',JSON[_0x2821('0x26')](_0x41f30b));if(_0x41f30b['error']){if(_0x41f30b[_0x2821('0x27')][_0x2821('0x28')]===0x1f4){logger[_0x2821('0x27')](_0x2821('0x22'),_0xe30acf,_0x41f30b[_0x2821('0x27')][_0x2821('0x29')]);return _0x155811(_0x41f30b[_0x2821('0x27')][_0x2821('0x29')]);}logger[_0x2821('0x27')](_0x2821('0x22'),_0xe30acf,_0x41f30b[_0x2821('0x27')]['message']);return _0x4bba07(_0x41f30b['error'][_0x2821('0x29')]);}else{logger[_0x2821('0x21')](_0x2821('0x22'),_0xe30acf,_0x2821('0x23'));_0x4bba07(_0x41f30b[_0x2821('0x2a')][_0x2821('0x29')]);}})[_0x2821('0x2b')](function(_0x3f032d){logger[_0x2821('0x27')](_0x2821('0x22'),_0xe30acf,_0x3f032d);_0x155811(_0x3f032d);});});}function respondWithStatusCode(_0x7a49da,_0x1d2c8f){_0x1d2c8f=_0x1d2c8f||0xcc;return function(_0x1cf0d9){if(_0x1cf0d9){return _0x7a49da[_0x2821('0x2c')](_0x1d2c8f);}return _0x7a49da[_0x2821('0x2d')](_0x1d2c8f)[_0x2821('0x2e')]();};}function respondWithResult(_0xf9161d,_0x3db876){_0x3db876=_0x3db876||0xc8;return function(_0x340741){if(_0x340741){return _0xf9161d[_0x2821('0x2d')](_0x3db876)['json'](_0x340741);}};}function respondWithFilteredResult(_0x13a5c7,_0x4d2b42){return function(_0x109262){if(_0x109262){var _0x4402ea=typeof _0x4d2b42[_0x2821('0x2f')]===_0x2821('0x30')&&typeof _0x4d2b42['limit']===_0x2821('0x30');var _0x265894=_0x109262['count'];var _0x13447a=_0x4402ea?0x0:_0x4d2b42[_0x2821('0x2f')];var _0x3d2d07=_0x4402ea?_0x109262['count']:_0x4d2b42[_0x2821('0x2f')]+_0x4d2b42[_0x2821('0x31')];var _0x36dd8a;if(_0x3d2d07>=_0x265894){_0x3d2d07=_0x265894;_0x36dd8a=0xc8;}else{_0x36dd8a=0xce;}_0x13a5c7[_0x2821('0x2d')](_0x36dd8a);return _0x13a5c7[_0x2821('0x32')](_0x2821('0x33'),_0x13447a+'-'+_0x3d2d07+'/'+_0x265894)[_0x2821('0x34')](_0x109262);}return null;};}function patchUpdates(_0x4fd3b4){return function(_0x427c0a){try{jsonpatch[_0x2821('0x35')](_0x427c0a,_0x4fd3b4,!![]);}catch(_0x30203e){return BPromise[_0x2821('0x36')](_0x30203e);}return _0x427c0a[_0x2821('0x37')]();};}function saveUpdates(_0x31d9e3,_0x1cb61a){return function(_0x2c3846){if(_0x2c3846){return _0x2c3846[_0x2821('0x38')](_0x31d9e3)[_0x2821('0x20')](function(_0x352e27){return _0x352e27;});}return null;};}function removeEntity(_0x5e9194,_0x1880f6){return function(_0x132893){if(_0x132893){return _0x132893[_0x2821('0x39')]()[_0x2821('0x20')](function(){var _0x5df104=_0x132893[_0x2821('0x3a')]({'plain':!![]});var _0x3a0df7=_0x2821('0x3b');return db[_0x2821('0x3c')][_0x2821('0x39')]({'where':{'type':_0x3a0df7,'resourceId':_0x5df104['id']}})[_0x2821('0x20')](function(){return _0x132893;});})[_0x2821('0x20')](function(){_0x5e9194[_0x2821('0x2d')](0xcc)[_0x2821('0x2e')]();});}};}function handleEntityNotFound(_0x369bd1,_0x4bc4d9){return function(_0x45d70c){if(!_0x45d70c){_0x369bd1[_0x2821('0x2c')](0x194);}return _0x45d70c;};}function handleError(_0x36e868,_0x347d57){_0x347d57=_0x347d57||0x1f4;return function(_0x357953){logger['error'](_0x357953[_0x2821('0x3d')]);if(_0x357953['name']){delete _0x357953['name'];}_0x36e868[_0x2821('0x2d')](_0x347d57)[_0x2821('0x3e')](_0x357953);};}exports[_0x2821('0x3f')]=function(_0x276edc,_0x9d77eb){var _0x12cace={},_0x210c60={},_0x58ad7f={'count':0x0,'rows':[]};var _0x559517=_[_0x2821('0x40')](db[_0x2821('0x41')][_0x2821('0x42')],function(_0x2737a7){return{'name':_0x2737a7[_0x2821('0x43')],'type':_0x2737a7['type']['key']};});_0x210c60[_0x2821('0x44')]=_[_0x2821('0x40')](_0x559517,_0x2821('0x45'));_0x210c60[_0x2821('0x46')]=_[_0x2821('0x47')](_0x276edc[_0x2821('0x46')]);_0x210c60['filters']=_[_0x2821('0x48')](_0x210c60[_0x2821('0x44')],_0x210c60['query']);_0x12cace[_0x2821('0x49')]=_[_0x2821('0x48')](_0x210c60[_0x2821('0x44')],qs[_0x2821('0x4a')](_0x276edc[_0x2821('0x46')]['fields']));_0x12cace[_0x2821('0x49')]=_0x12cace[_0x2821('0x49')][_0x2821('0x4b')]?_0x12cace[_0x2821('0x49')]:_0x210c60['model'];if(!_0x276edc['query'][_0x2821('0x4c')](_0x2821('0x4d'))){_0x12cace[_0x2821('0x31')]=qs[_0x2821('0x31')](_0x276edc[_0x2821('0x46')][_0x2821('0x31')]);_0x12cace[_0x2821('0x2f')]=qs['offset'](_0x276edc['query'][_0x2821('0x2f')]);}_0x12cace['order']=qs[_0x2821('0x4e')](_0x276edc[_0x2821('0x46')][_0x2821('0x4e')]);_0x12cace[_0x2821('0x4f')]=qs[_0x2821('0x50')](_[_0x2821('0x51')](_0x276edc[_0x2821('0x46')],_0x210c60['filters']),_0x559517);if(_0x276edc[_0x2821('0x46')][_0x2821('0x52')]){_0x12cace[_0x2821('0x4f')]=_[_0x2821('0x53')](_0x12cace[_0x2821('0x4f')],{'$or':_[_0x2821('0x40')](_0x559517,function(_0x2b5b97){if(_0x2b5b97[_0x2821('0x54')]!=='VIRTUAL'){var _0x191ae2={};_0x191ae2[_0x2b5b97[_0x2821('0x45')]]={'$like':'%'+_0x276edc[_0x2821('0x46')][_0x2821('0x52')]+'%'};return _0x191ae2;}})});}_0x12cace=_['merge']({},_0x12cace,_0x276edc[_0x2821('0x55')]);var _0x125e41={'where':_0x12cace[_0x2821('0x4f')]};return db['ChatQueue']['count'](_0x125e41)['then'](function(_0x9721){_0x58ad7f[_0x2821('0x56')]=_0x9721;if(_0x276edc[_0x2821('0x46')]['includeAll']){_0x12cace[_0x2821('0x57')]=[{'all':!![]}];}return db[_0x2821('0x41')][_0x2821('0x58')](_0x12cace);})[_0x2821('0x20')](function(_0x228906){_0x58ad7f[_0x2821('0x59')]=_0x228906;return _0x58ad7f;})['then'](respondWithFilteredResult(_0x9d77eb,_0x12cace))['catch'](handleError(_0x9d77eb,null));};exports[_0x2821('0x5a')]=function(_0x39fcc9,_0x482c89){var _0x4177ec={'raw':!![],'where':{'id':_0x39fcc9[_0x2821('0x5b')]['id']}},_0x4421c5={};_0x4421c5[_0x2821('0x44')]=_[_0x2821('0x47')](db[_0x2821('0x41')][_0x2821('0x42')]);_0x4421c5[_0x2821('0x46')]=_[_0x2821('0x47')](_0x39fcc9['query']);_0x4421c5['filters']=_['intersection'](_0x4421c5['model'],_0x4421c5['query']);_0x4177ec['attributes']=_[_0x2821('0x48')](_0x4421c5[_0x2821('0x44')],qs[_0x2821('0x4a')](_0x39fcc9[_0x2821('0x46')][_0x2821('0x4a')]));_0x4177ec[_0x2821('0x49')]=_0x4177ec[_0x2821('0x49')]['length']?_0x4177ec[_0x2821('0x49')]:_0x4421c5[_0x2821('0x44')];if(_0x39fcc9['query'][_0x2821('0x5c')]){_0x4177ec[_0x2821('0x57')]=[{'all':!![]}];}_0x4177ec=_[_0x2821('0x53')]({},_0x4177ec,_0x39fcc9['options']);return db['ChatQueue'][_0x2821('0x5d')](_0x4177ec)[_0x2821('0x20')](handleEntityNotFound(_0x482c89,null))[_0x2821('0x20')](respondWithResult(_0x482c89,null))[_0x2821('0x2b')](handleError(_0x482c89,null));};exports[_0x2821('0x5e')]=function(_0x277e7f,_0x538bb8){return db[_0x2821('0x41')][_0x2821('0x5e')](_0x277e7f[_0x2821('0x5f')],{})[_0x2821('0x20')](function(_0x31d5f6){var _0x218c65=_0x277e7f[_0x2821('0x60')][_0x2821('0x3a')]({'plain':!![]});if(!_0x218c65)throw new Error(_0x2821('0x61'));if(_0x218c65[_0x2821('0x62')]===_0x2821('0x60')){var _0x4e6042=_0x31d5f6[_0x2821('0x3a')]({'plain':!![]});var _0x1b2301=_0x2821('0x3b');return db['UserProfileSection'][_0x2821('0x5d')]({'where':{'name':_0x1b2301,'userProfileId':_0x218c65['userProfileId']},'raw':!![]})[_0x2821('0x20')](function(_0x3d21ee){if(_0x3d21ee&&_0x3d21ee[_0x2821('0x63')]===0x0){return db[_0x2821('0x3c')][_0x2821('0x5e')]({'name':_0x4e6042[_0x2821('0x45')],'resourceId':_0x4e6042['id'],'type':_0x3d21ee['name'],'sectionId':_0x3d21ee['id']},{})[_0x2821('0x20')](function(){return _0x31d5f6;});}else{return _0x31d5f6;}})[_0x2821('0x2b')](function(_0x1ff709){logger[_0x2821('0x27')](_0x2821('0x64'),_0x1ff709);throw _0x1ff709;});}return _0x31d5f6;})[_0x2821('0x20')](respondWithResult(_0x538bb8,0xc9))['catch'](handleError(_0x538bb8,null));};exports[_0x2821('0x38')]=function(_0x37384d,_0x45f5d3){if(_0x37384d['body']['id']){delete _0x37384d[_0x2821('0x5f')]['id'];}return db[_0x2821('0x41')][_0x2821('0x5d')]({'where':{'id':_0x37384d[_0x2821('0x5b')]['id']}})[_0x2821('0x20')](handleEntityNotFound(_0x45f5d3,null))[_0x2821('0x20')](saveUpdates(_0x37384d[_0x2821('0x5f')],null))[_0x2821('0x20')](respondWithResult(_0x45f5d3,null))['catch'](handleError(_0x45f5d3,null));};exports[_0x2821('0x39')]=function(_0x3c114a,_0x4783e7){return db[_0x2821('0x41')][_0x2821('0x5d')]({'where':{'id':_0x3c114a[_0x2821('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4783e7,null))['then'](removeEntity(_0x4783e7,null))[_0x2821('0x2b')](handleError(_0x4783e7,null));};exports[_0x2821('0x65')]=function(_0x24e488,_0xcc4f07){return db['ChatQueue'][_0x2821('0x65')]()[_0x2821('0x20')](respondWithResult(_0xcc4f07,null))[_0x2821('0x2b')](handleError(_0xcc4f07,null));};exports['getMembers']=function(_0x576354,_0x314418,_0x22e093){var _0x5bb173={'raw':!![],'where':{}},_0x2ee54b={},_0x294712;return db[_0x2821('0x41')][_0x2821('0x66')]({'where':{'id':_0x576354['params']['id']}})[_0x2821('0x20')](handleEntityNotFound(_0x314418,null))[_0x2821('0x20')](function(_0x44761e){if(_0x44761e){_0x294712=_0x44761e[_0x2821('0x3a')]({'plain':!![]});_0x2ee54b['model']=_['keys'](db[_0x2821('0x67')]['rawAttributes']);_0x2ee54b[_0x2821('0x46')]=_['keys'](_0x576354[_0x2821('0x46')]);_0x2ee54b['filters']=_[_0x2821('0x48')](_0x2ee54b[_0x2821('0x44')],_0x2ee54b[_0x2821('0x46')]);_0x5bb173[_0x2821('0x49')]=_[_0x2821('0x48')](_0x2ee54b[_0x2821('0x44')],qs[_0x2821('0x4a')](_0x576354['query'][_0x2821('0x4a')]));_0x5bb173[_0x2821('0x49')]=_0x5bb173[_0x2821('0x49')][_0x2821('0x4b')]?_0x5bb173[_0x2821('0x49')]:_0x2ee54b['model'];if(!_0x576354['query'][_0x2821('0x4c')](_0x2821('0x4d'))){_0x5bb173[_0x2821('0x31')]=qs[_0x2821('0x31')](_0x576354[_0x2821('0x46')][_0x2821('0x31')]);_0x5bb173['offset']=qs[_0x2821('0x2f')](_0x576354['query'][_0x2821('0x2f')]);}_0x5bb173[_0x2821('0x68')]=qs['sort'](_0x576354[_0x2821('0x46')][_0x2821('0x4e')]);_0x5bb173['where']=qs[_0x2821('0x50')](_[_0x2821('0x51')](_0x576354[_0x2821('0x46')],_0x2ee54b['filters']));_0x5bb173[_0x2821('0x4f')][_0x2821('0x69')]=_0x44761e['id'];if(_0x576354[_0x2821('0x46')][_0x2821('0x52')]){_0x5bb173['where']=_[_0x2821('0x53')](_0x5bb173['where'],{'$or':_[_0x2821('0x40')](_0x5bb173['attributes'],function(_0x5b3d31){var _0x285d0a={};_0x285d0a[_0x5b3d31]={'$like':'%'+_0x576354[_0x2821('0x46')]['filter']+'%'};return _0x285d0a;})});}_0x5bb173=_[_0x2821('0x53')]({},_0x5bb173,_0x576354['options']);return db[_0x2821('0x67')][_0x2821('0x58')](_0x5bb173);}})[_0x2821('0x20')](function(_0xc58687){if(_0xc58687){return db['User'][_0x2821('0x6a')]({'where':{'id':_[_0x2821('0x40')](_0xc58687,_0x2821('0x6b')),'role':_0x2821('0x6c')},'attributes':['id',_0x2821('0x45'),_0x2821('0x6d'),_0x2821('0x6e'),'createdAt']});}})[_0x2821('0x20')](function(_0x4c79a8){if(_0x4c79a8){return{'count':_0x4c79a8[_0x2821('0x56')],'rows':_[_0x2821('0x40')](_0x4c79a8[_0x2821('0x59')],function(_0x4eb9ad){return{'membername':_0x4eb9ad['name'],'UserId':_0x4eb9ad['id'],'queue_name':_0x294712[_0x2821('0x45')],'ChatQueueId':_0x294712['id'],'interface':util[_0x2821('0x6f')](_0x2821('0x70'),_0x2821('0x71'),_0x4eb9ad['name']),'penalty':0x0,'paused':_0x4eb9ad['chatPause'],'createdAt':_0x4eb9ad[_0x2821('0x72')],'updatedAt':_0x4eb9ad['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x314418,_0x5bb173))['catch'](handleError(_0x314418,null));};exports['getTeams']=function(_0x583b91,_0x4cffc4,_0x139942){var _0x2c316d={};var _0x36ec34={};var _0x2502b4;var _0x2d1ee4;return db[_0x2821('0x41')]['findOne']({'where':{'id':_0x583b91[_0x2821('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4cffc4,null))[_0x2821('0x20')](function(_0x492f87){if(_0x492f87){_0x2502b4=_0x492f87;_0x36ec34['model']=_[_0x2821('0x47')](db['Team']['rawAttributes']);_0x36ec34['query']=_[_0x2821('0x47')](_0x583b91['query']);_0x36ec34['filters']=_[_0x2821('0x48')](_0x36ec34['model'],_0x36ec34[_0x2821('0x46')]);_0x2c316d[_0x2821('0x49')]=_['intersection'](_0x36ec34['model'],qs[_0x2821('0x4a')](_0x583b91[_0x2821('0x46')][_0x2821('0x4a')]));_0x2c316d[_0x2821('0x49')]=_0x2c316d[_0x2821('0x49')][_0x2821('0x4b')]?_0x2c316d[_0x2821('0x49')]:_0x36ec34[_0x2821('0x44')];_0x2c316d['order']=qs['sort'](_0x583b91['query'][_0x2821('0x4e')]);_0x2c316d[_0x2821('0x4f')]=qs['filters'](_[_0x2821('0x51')](_0x583b91[_0x2821('0x46')],_0x36ec34[_0x2821('0x50')]));if(_0x583b91[_0x2821('0x46')][_0x2821('0x52')]){_0x2c316d['where']=_['merge'](_0x2c316d[_0x2821('0x4f')],{'$or':_['map'](_0x2c316d['attributes'],function(_0x42e370){var _0x225cbf={};_0x225cbf[_0x42e370]={'$like':'%'+_0x583b91[_0x2821('0x46')][_0x2821('0x52')]+'%'};return _0x225cbf;})});}_0x2c316d=_['merge']({},_0x2c316d,_0x583b91[_0x2821('0x55')]);return _0x2502b4[_0x2821('0x73')](_0x2c316d);}})[_0x2821('0x20')](function(_0x897ce1){if(_0x897ce1){_0x2d1ee4=_0x897ce1[_0x2821('0x4b')];if(!_0x583b91[_0x2821('0x46')][_0x2821('0x4c')](_0x2821('0x4d'))){_0x2c316d[_0x2821('0x31')]=qs[_0x2821('0x31')](_0x583b91[_0x2821('0x46')][_0x2821('0x31')]);_0x2c316d[_0x2821('0x2f')]=qs['offset'](_0x583b91[_0x2821('0x46')][_0x2821('0x2f')]);}return _0x2502b4[_0x2821('0x73')](_0x2c316d);}})[_0x2821('0x20')](function(_0x56bb9e){if(_0x56bb9e){return _0x56bb9e?{'count':_0x2d1ee4,'rows':_0x56bb9e}:null;}})[_0x2821('0x20')](respondWithResult(_0x4cffc4,null))['catch'](handleError(_0x4cffc4,null));};exports['addTeams']=function(_0x20b3e7,_0x54b4f5,_0x52c400){var _0x42d52a=_0x20b3e7[_0x2821('0x5f')][_0x2821('0x74')];return db[_0x2821('0x75')][_0x2821('0x58')]({'where':{'id':_0x42d52a},'attributes':['id'],'include':[{'model':db[_0x2821('0x76')],'as':_0x2821('0x77'),'attributes':['id',_0x2821('0x45'),_0x2821('0x78'),_0x2821('0x79'),_0x2821('0x7a')],'raw':!![]}]})[_0x2821('0x20')](function(_0x48b9c0){if(_0x48b9c0){var _0x141623=_[_0x2821('0x7b')](_0x48b9c0,function(_0x1a174b){var _0x4d668d=_0x1a174b[_0x2821('0x3a')]({'plain':!![]});return _0x4d668d[_0x2821('0x77')];});return db[_0x2821('0x41')][_0x2821('0x5d')]({'where':{'id':_0x20b3e7[_0x2821('0x5b')]['id']}})[_0x2821('0x20')](function(_0x241d36){return db[_0x2821('0x7c')]['transaction'](function(_0x1fa7d2){return _0x241d36[_0x2821('0x7d')](_0x42d52a,{'transaction':_0x1fa7d2})['then'](function(){return BPromise['each'](_0x141623,function(_0x3a9e14){return db[_0x2821('0x67')][_0x2821('0x7e')]({'where':{'UserId':_0x3a9e14['id'],'ChatQueueId':_0x20b3e7[_0x2821('0x5b')]['id']},'transaction':_0x1fa7d2});});})[_0x2821('0x20')](function(){_0x141623[_0x2821('0x7f')](function(_0x3faff6){socket['emit'](_0x2821('0x80'),{'UserId':_0x3faff6['id'],'ChatQueueId':_0x241d36['id']});});});});});}})[_0x2821('0x20')](respondWithStatusCode(_0x54b4f5,null))[_0x2821('0x2b')](handleError(_0x54b4f5,null));};exports[_0x2821('0x81')]=function(_0x2fb663,_0x1e94cf,_0x3c9a8a){return db[_0x2821('0x75')]['findAll']({'where':{'id':_0x2fb663[_0x2821('0x46')][_0x2821('0x74')]},'attributes':['id'],'include':[{'model':db[_0x2821('0x76')],'as':_0x2821('0x77'),'attributes':['id'],'raw':!![]}]})[_0x2821('0x20')](handleEntityNotFound(_0x1e94cf,null))[_0x2821('0x20')](function(_0x43073c){var _0x1dc05b=_['map'](_0x43073c,'id');var _0x17c7a7=[];var _0x1794f0=[];var _0x5dad4a=squel[_0x2821('0x82')]();_0x5dad4a['field'](_0x2821('0x83'))['from'](_0x2821('0x84'),'tq')[_0x2821('0x85')](_0x2821('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2821('0x4f')](_0x2821('0x87'),_0x2fb663[_0x2821('0x5b')]['id']);for(var _0x42d4b7=0x0;_0x42d4b7<_0x43073c[_0x2821('0x4b')];_0x42d4b7+=0x1){let _0x5d2c32=_0x43073c[_0x42d4b7];for(var _0x37b0f4=0x0;_0x37b0f4<_0x5d2c32[_0x2821('0x77')]['length'];_0x37b0f4+=0x1){let _0x37b62e=_0x5d2c32[_0x2821('0x77')][_0x37b0f4];var _0x4759c7=_0x5dad4a[_0x2821('0x88')]();_0x4759c7[_0x2821('0x4f')]('ut.UserId\x20=\x20?',_0x37b62e['id']);_0x1794f0[_0x2821('0x89')](db[_0x2821('0x7c')][_0x2821('0x46')](_0x4759c7['toString'](),{'type':db['sequelize'][_0x2821('0x8a')]['SELECT']})[_0x2821('0x20')](function(_0x7f6291){if(_0x7f6291[_0x2821('0x4b')]===0x1){return _0x37b62e['id'];}else{var _0xf4c549=_['every'](_[_0x2821('0x40')](_0x7f6291,'TeamId'),function(_0x3204bd){return _[_0x2821('0x8b')](_0x1dc05b,_0x3204bd);});if(_0xf4c549){return _0x37b62e['id'];}}}));}}return BPromise[_0x2821('0x8c')](_0x1794f0)[_0x2821('0x20')](function(_0x122681){_0x17c7a7=_(_0x17c7a7)[_0x2821('0x8d')](_0x122681)[_0x2821('0x8e')]()['value']();return db[_0x2821('0x41')][_0x2821('0x5d')]({'where':{'id':_0x2fb663[_0x2821('0x5b')]['id']}})[_0x2821('0x20')](function(_0x153875){return db['sequelize'][_0x2821('0x8f')](function(_0x2693ce){return _0x153875['removeTeams'](_0x2fb663[_0x2821('0x46')][_0x2821('0x74')],{'transaction':_0x2693ce})['then'](function(){if(!_[_0x2821('0x90')](_0x17c7a7)){return _0x153875[_0x2821('0x91')](_0x17c7a7,{'transaction':_0x2693ce});}})[_0x2821('0x20')](function(){_0x17c7a7[_0x2821('0x7f')](function(_0x51c467){socket['emit'](_0x2821('0x92'),{'UserId':_0x51c467,'ChatQueueId':_0x153875['id']});});});});});});})['then'](respondWithStatusCode(_0x1e94cf,null))[_0x2821('0x2b')](handleError(_0x1e94cf,null));};exports['addAgents']=function(_0x6db532,_0x2a934f,_0x24eea7){return db['ChatQueue']['find']({'where':{'id':_0x6db532['params']['id']}})['then'](handleEntityNotFound(_0x2a934f,null))['then'](function(_0x181d58){if(_0x181d58){return _0x181d58[_0x2821('0x93')](_0x6db532['body'][_0x2821('0x74')],_[_0x2821('0x94')](_0x6db532[_0x2821('0x5f')],[_0x2821('0x74'),'id'])||{})['spread'](function(_0x53bef6){for(var _0x4a9cc0=0x0;_0x4a9cc0<_0x6db532['body'][_0x2821('0x74')][_0x2821('0x4b')];_0x4a9cc0+=0x1){socket[_0x2821('0x95')](_0x2821('0x80'),{'UserId':Number(_0x6db532[_0x2821('0x5f')][_0x2821('0x74')][_0x4a9cc0]),'ChatQueueId':Number(_0x6db532[_0x2821('0x5b')]['id'])});}return _0x53bef6;});}})[_0x2821('0x20')](respondWithResult(_0x2a934f,null))['catch'](handleError(_0x2a934f,null));};exports[_0x2821('0x91')]=function(_0x22110a,_0x3e7176,_0x102e9f){return db[_0x2821('0x41')][_0x2821('0x5d')]({'where':{'id':_0x22110a[_0x2821('0x5b')]['id']}})[_0x2821('0x20')](handleEntityNotFound(_0x3e7176,null))[_0x2821('0x20')](function(_0x4ffcae){if(_0x4ffcae){return _0x4ffcae[_0x2821('0x91')](_0x22110a['query'][_0x2821('0x74')])[_0x2821('0x20')](function(){if(_['isArray'](_0x22110a[_0x2821('0x46')]['ids'])){for(var _0x36c4e9=0x0;_0x36c4e9<_0x22110a[_0x2821('0x46')][_0x2821('0x74')]['length'];_0x36c4e9+=0x1){socket[_0x2821('0x95')]('userChatQueue:remove',{'UserId':Number(_0x22110a[_0x2821('0x46')]['ids'][_0x36c4e9]),'ChatQueueId':Number(_0x22110a[_0x2821('0x5b')]['id'])});}}else{socket[_0x2821('0x95')]('userChatQueue:remove',{'UserId':Number(_0x22110a['query'][_0x2821('0x74')]),'ChatQueueId':Number(_0x22110a[_0x2821('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e7176,null))[_0x2821('0x2b')](handleError(_0x3e7176,null));};exports[_0x2821('0x96')]=function(_0x227e94,_0x1c50c3,_0x122a7b){var _0x33e972={};var _0x2c6dc6={};var _0x4cabb3;var _0x10993d;return db[_0x2821('0x41')][_0x2821('0x66')]({'where':{'id':_0x227e94[_0x2821('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1c50c3,null))[_0x2821('0x20')](function(_0x19e0b4){if(_0x19e0b4){_0x4cabb3=_0x19e0b4;_0x2c6dc6[_0x2821('0x44')]=_['keys'](db['User'][_0x2821('0x42')]);_0x2c6dc6[_0x2821('0x46')]=_[_0x2821('0x47')](_0x227e94[_0x2821('0x46')]);_0x2c6dc6[_0x2821('0x50')]=_['intersection'](_0x2c6dc6['model'],_0x2c6dc6[_0x2821('0x46')]);_0x33e972[_0x2821('0x49')]=_['intersection'](_0x2c6dc6[_0x2821('0x44')],qs['fields'](_0x227e94[_0x2821('0x46')][_0x2821('0x4a')]));_0x33e972[_0x2821('0x49')]=_0x33e972[_0x2821('0x49')][_0x2821('0x4b')]?_0x33e972[_0x2821('0x49')]:_0x2c6dc6[_0x2821('0x44')];_0x33e972['order']=qs[_0x2821('0x4e')](_0x227e94[_0x2821('0x46')][_0x2821('0x4e')]);_0x33e972[_0x2821('0x4f')]=qs['filters'](_['pick'](_0x227e94[_0x2821('0x46')],_0x2c6dc6[_0x2821('0x50')]));if(_0x227e94['query'][_0x2821('0x52')]){_0x33e972[_0x2821('0x4f')]=_[_0x2821('0x53')](_0x33e972[_0x2821('0x4f')],{'$or':_['map'](_0x33e972[_0x2821('0x49')],function(_0x18f900){var _0x14a788={};_0x14a788[_0x18f900]={'$like':'%'+_0x227e94[_0x2821('0x46')]['filter']+'%'};return _0x14a788;})});}_0x33e972=_['merge']({},_0x33e972,_0x227e94[_0x2821('0x55')]);return _0x4cabb3[_0x2821('0x96')](_0x33e972);}})[_0x2821('0x20')](function(_0x42fc14){if(_0x42fc14){_0x10993d=_0x42fc14['length'];if(!_0x227e94['query']['hasOwnProperty'](_0x2821('0x4d'))){_0x33e972[_0x2821('0x31')]=qs[_0x2821('0x31')](_0x227e94[_0x2821('0x46')][_0x2821('0x31')]);_0x33e972[_0x2821('0x2f')]=qs[_0x2821('0x2f')](_0x227e94['query']['offset']);}return _0x4cabb3['getAgents'](_0x33e972);}})[_0x2821('0x20')](function(_0x299b7c){if(_0x299b7c){return _0x299b7c?{'count':_0x10993d,'rows':_0x299b7c}:null;}})['then'](respondWithResult(_0x1c50c3,null))['catch'](handleError(_0x1c50c3,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 62c8754..4f49ebc 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 _0x6dd0=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x6dd0,0xae));var _0x06dd=function(_0x3a5856,_0xaefeff){_0x3a5856=_0x3a5856-0x0;var _0x267816=_0x6dd0[_0x3a5856];return _0x267816;};'use strict';var EventEmitter=require(_0x06dd('0x0'));var ChatQueue=require(_0x06dd('0x1'))['db'][_0x06dd('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x06dd('0x3')](0x0);var events={'afterCreate':_0x06dd('0x4'),'afterUpdate':_0x06dd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x53f3da){return function(_0x1e9379,_0x41b4d5,_0x10bfb5){ChatQueueEvents[_0x06dd('0x6')](_0x53f3da+':'+_0x1e9379['id'],_0x1e9379);ChatQueueEvents[_0x06dd('0x6')](_0x53f3da,_0x1e9379);_0x10bfb5(null);};}for(var e in events){if(events[_0x06dd('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x06dd('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xe49f=['hook','events','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x103c4c,_0x285348){var _0x3fc15e=function(_0x40e0e6){while(--_0x40e0e6){_0x103c4c['push'](_0x103c4c['shift']());}};_0x3fc15e(++_0x285348);}(_0xe49f,0x17b));var _0xfe49=function(_0x5dedf3,_0x20f0df){_0x5dedf3=_0x5dedf3-0x0;var _0x275b39=_0xe49f[_0x5dedf3];return _0x275b39;};'use strict';var EventEmitter=require(_0xfe49('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xfe49('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xfe49('0x2')](0x0);var events={'afterCreate':_0xfe49('0x3'),'afterUpdate':_0xfe49('0x4'),'afterDestroy':_0xfe49('0x5')};function emitEvent(_0x267126){return function(_0x36713e,_0x1b4862,_0xa378b9){ChatQueueEvents['emit'](_0x267126+':'+_0x36713e['id'],_0x36713e);ChatQueueEvents[_0xfe49('0x6')](_0x267126,_0x36713e);_0xa378b9(null);};}for(var e in events){if(events[_0xfe49('0x7')](e)){var event=events[e];ChatQueue[_0xfe49('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 2367bf6..4c5c357 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 _0x8da2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger'];(function(_0x1b7add,_0x4a67cb){var _0x5ad180=function(_0x5556ae){while(--_0x5556ae){_0x1b7add['push'](_0x1b7add['shift']());}};_0x5ad180(++_0x4a67cb);}(_0x8da2,0x75));var _0x28da=function(_0x316ba4,_0x19d4cb){_0x316ba4=_0x316ba4-0x0;var _0x129152=_0x8da2[_0x316ba4];return _0x129152;};'use strict';var _=require(_0x28da('0x0'));var util=require(_0x28da('0x1'));var logger=require(_0x28da('0x2'))(_0x28da('0x3'));var moment=require(_0x28da('0x4'));var BPromise=require(_0x28da('0x5'));var rp=require(_0x28da('0x6'));var fs=require('fs');var path=require(_0x28da('0x7'));var rimraf=require(_0x28da('0x8'));var config=require(_0x28da('0x9'));var attributes=require(_0x28da('0xa'));module[_0x28da('0xb')]=function(_0x4292fd,_0x45844b){return _0x4292fd[_0x28da('0xc')](_0x28da('0xd'),attributes,{'tableName':_0x28da('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe518=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','ChatQueue'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe518,0x168));var _0x8e51=function(_0x3e81c1,_0x4969a9){_0x3e81c1=_0x3e81c1-0x0;var _0x1edc3f=_0xe518[_0x3e81c1];return _0x1edc3f;};'use strict';var _=require(_0x8e51('0x0'));var util=require(_0x8e51('0x1'));var logger=require(_0x8e51('0x2'))('api');var moment=require(_0x8e51('0x3'));var BPromise=require(_0x8e51('0x4'));var rp=require(_0x8e51('0x5'));var fs=require('fs');var path=require(_0x8e51('0x6'));var rimraf=require(_0x8e51('0x7'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x8e51('0x8')]=function(_0x47ce46,_0x1dc798){return _0x47ce46['define'](_0x8e51('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 40bd6dd..2e5fd47 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 _0xbc87=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowChatQueue','find','then','lodash'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0xbc87,0x1cd));var _0x7bc8=function(_0x226b60,_0x4fac70){_0x226b60=_0x226b60-0x0;var _0x3d566e=_0xbc87[_0x226b60];return _0x3d566e;};'use strict';var _=require(_0x7bc8('0x0'));var util=require(_0x7bc8('0x1'));var moment=require('moment');var BPromise=require(_0x7bc8('0x2'));var rs=require(_0x7bc8('0x3'));var fs=require('fs');var Redis=require(_0x7bc8('0x4'));var db=require(_0x7bc8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bc8('0x6'))(_0x7bc8('0x7'));var config=require(_0x7bc8('0x8'));var jayson=require(_0x7bc8('0x9'));var client=jayson[_0x7bc8('0xa')]['http']({'port':0x232a});config['redis']=_[_0x7bc8('0xb')](config[_0x7bc8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bc8('0xd'))(new Redis(config['redis']));require(_0x7bc8('0xe'))[_0x7bc8('0xf')](socket);function respondWithRpcPromise(_0x4898d1,_0x451288,_0x25456a){return new BPromise(function(_0x331fde,_0x1b6b16){return client[_0x7bc8('0x10')](_0x4898d1,_0x25456a)['then'](function(_0xb08fdc){logger[_0x7bc8('0x11')](_0x7bc8('0x12'),_0x451288,_0x7bc8('0x13'));logger[_0x7bc8('0x14')](_0x7bc8('0x15'),_0x451288,_0x7bc8('0x13'),JSON[_0x7bc8('0x16')](_0xb08fdc));if(_0xb08fdc[_0x7bc8('0x17')]){if(_0xb08fdc[_0x7bc8('0x17')][_0x7bc8('0x18')]===0x1f4){logger['error'](_0x7bc8('0x12'),_0x451288,_0xb08fdc[_0x7bc8('0x17')][_0x7bc8('0x19')]);return _0x1b6b16(_0xb08fdc[_0x7bc8('0x17')]['message']);}logger[_0x7bc8('0x17')]('ChatQueue,\x20%s,\x20%s',_0x451288,_0xb08fdc[_0x7bc8('0x17')][_0x7bc8('0x19')]);return _0x331fde(_0xb08fdc[_0x7bc8('0x17')][_0x7bc8('0x19')]);}else{logger[_0x7bc8('0x11')]('ChatQueue,\x20%s,\x20%s',_0x451288,_0x7bc8('0x13'));_0x331fde(_0xb08fdc[_0x7bc8('0x1a')][_0x7bc8('0x19')]);}})[_0x7bc8('0x1b')](function(_0x28fbf8){logger[_0x7bc8('0x17')](_0x7bc8('0x12'),_0x451288,_0x28fbf8);_0x1b6b16(_0x28fbf8);});});}exports[_0x7bc8('0x1c')]=function(_0x5cc4af){var _0x1f4329=this;return new Promise(function(_0x5d0791,_0x3a3e51){return db[_0x7bc8('0x1d')][_0x7bc8('0x1e')]({'raw':_0x5cc4af[_0x7bc8('0x1f')]?_0x5cc4af[_0x7bc8('0x1f')][_0x7bc8('0x20')]===undefined?!![]:![]:!![],'where':_0x5cc4af['options']?_0x5cc4af[_0x7bc8('0x1f')][_0x7bc8('0x21')]||null:null,'attributes':_0x5cc4af[_0x7bc8('0x1f')]?_0x5cc4af[_0x7bc8('0x1f')][_0x7bc8('0x22')]||null:null,'limit':_0x5cc4af[_0x7bc8('0x1f')]?_0x5cc4af[_0x7bc8('0x1f')][_0x7bc8('0x23')]||null:null,'include':_0x5cc4af[_0x7bc8('0x1f')]?_0x5cc4af[_0x7bc8('0x1f')][_0x7bc8('0x24')]?_['map'](_0x5cc4af[_0x7bc8('0x1f')][_0x7bc8('0x24')],function(_0x2133eb){return{'model':db[_0x2133eb[_0x7bc8('0x25')]],'as':_0x2133eb['as'],'attributes':_0x2133eb['attributes'],'include':_0x2133eb['include']?_['map'](_0x2133eb[_0x7bc8('0x24')],function(_0x402f17){return{'model':db[_0x402f17[_0x7bc8('0x25')]],'as':_0x402f17['as'],'attributes':_0x402f17[_0x7bc8('0x22')],'include':_0x402f17['include']?_[_0x7bc8('0x26')](_0x402f17[_0x7bc8('0x24')],function(_0x212515){return{'model':db[_0x212515['model']],'as':_0x212515['as'],'attributes':_0x212515[_0x7bc8('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x104a2f){logger[_0x7bc8('0x11')](_0x7bc8('0x1c'),_0x5cc4af);logger[_0x7bc8('0x14')](_0x7bc8('0x1c'),_0x5cc4af,JSON[_0x7bc8('0x16')](_0x104a2f));_0x5d0791(_0x104a2f);})[_0x7bc8('0x1b')](function(_0xbe46e2){logger[_0x7bc8('0x17')](_0x7bc8('0x1c'),_0xbe46e2[_0x7bc8('0x19')],_0x5cc4af);_0x3a3e51(_0x1f4329[_0x7bc8('0x17')](0x1f4,_0xbe46e2[_0x7bc8('0x19')]));});});};exports[_0x7bc8('0x27')]=function(_0x56496d){var _0x27cd9f=this;return new Promise(function(_0xca3acd,_0x29c709){return db['ChatQueue'][_0x7bc8('0x28')]({'raw':_0x56496d['options']?_0x56496d[_0x7bc8('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x56496d[_0x7bc8('0x1f')]?_0x56496d[_0x7bc8('0x1f')][_0x7bc8('0x21')]||null:null,'attributes':_0x56496d[_0x7bc8('0x1f')]?_0x56496d[_0x7bc8('0x1f')]['attributes']||null:null,'include':_0x56496d[_0x7bc8('0x1f')]?_0x56496d[_0x7bc8('0x1f')][_0x7bc8('0x24')]?_[_0x7bc8('0x26')](_0x56496d[_0x7bc8('0x1f')][_0x7bc8('0x24')],function(_0x2fa4db){return{'model':db[_0x2fa4db[_0x7bc8('0x25')]],'as':_0x2fa4db['as'],'attributes':_0x2fa4db[_0x7bc8('0x22')],'include':_0x2fa4db[_0x7bc8('0x24')]?_[_0x7bc8('0x26')](_0x2fa4db[_0x7bc8('0x24')],function(_0x16b5eb){return{'model':db[_0x16b5eb[_0x7bc8('0x25')]],'as':_0x16b5eb['as'],'attributes':_0x16b5eb['attributes'],'include':_0x16b5eb[_0x7bc8('0x24')]?_[_0x7bc8('0x26')](_0x16b5eb[_0x7bc8('0x24')],function(_0x359b5c){return{'model':db[_0x359b5c[_0x7bc8('0x25')]],'as':_0x359b5c['as'],'attributes':_0x359b5c[_0x7bc8('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7bc8('0x29')](function(_0x188721){logger[_0x7bc8('0x11')](_0x7bc8('0x27'),_0x56496d);logger[_0x7bc8('0x14')](_0x7bc8('0x27'),_0x56496d,JSON[_0x7bc8('0x16')](_0x188721));_0xca3acd(_0x188721);})[_0x7bc8('0x1b')](function(_0x191a5e){logger[_0x7bc8('0x17')]('ShowChatQueue',_0x191a5e['message'],_0x56496d);_0x29c709(_0x27cd9f[_0x7bc8('0x17')](0x1f4,_0x191a5e[_0x7bc8('0x19')]));});});}; \ No newline at end of file +var _0x0d74=['jayson/promise','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','find','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x417a46,_0xb6327a){var _0xa3b9=function(_0x33a0e3){while(--_0x33a0e3){_0x417a46['push'](_0x417a46['shift']());}};_0xa3b9(++_0xb6327a);}(_0x0d74,0x146));var _0x40d7=function(_0x411758,_0x1ed7a3){_0x411758=_0x411758-0x0;var _0x283ea2=_0x0d74[_0x411758];return _0x283ea2;};'use strict';var _=require(_0x40d7('0x0'));var util=require(_0x40d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x40d7('0x2'));var fs=require('fs');var Redis=require(_0x40d7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x40d7('0x4'))(_0x40d7('0x5'));var config=require(_0x40d7('0x6'));var jayson=require(_0x40d7('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x40d7('0x8')](config['redis'],{'host':_0x40d7('0x9'),'port':0x18eb});var socket=require(_0x40d7('0xa'))(new Redis(config['redis']));require(_0x40d7('0xb'))[_0x40d7('0xc')](socket);function respondWithRpcPromise(_0x354f80,_0x2bae78,_0xcb37e3){return new BPromise(function(_0x517d88,_0x5208be){return client[_0x40d7('0xd')](_0x354f80,_0xcb37e3)[_0x40d7('0xe')](function(_0x229937){logger[_0x40d7('0xf')](_0x40d7('0x10'),_0x2bae78,'request\x20sent');logger[_0x40d7('0x11')](_0x40d7('0x12'),_0x2bae78,_0x40d7('0x13'),JSON[_0x40d7('0x14')](_0x229937));if(_0x229937['error']){if(_0x229937[_0x40d7('0x15')][_0x40d7('0x16')]===0x1f4){logger[_0x40d7('0x15')](_0x40d7('0x10'),_0x2bae78,_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);return _0x5208be(_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);}logger[_0x40d7('0x15')]('ChatQueue,\x20%s,\x20%s',_0x2bae78,_0x229937['error']['message']);return _0x517d88(_0x229937[_0x40d7('0x15')][_0x40d7('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2bae78,_0x40d7('0x13'));_0x517d88(_0x229937['result']['message']);}})[_0x40d7('0x18')](function(_0x22de5a){logger[_0x40d7('0x15')](_0x40d7('0x10'),_0x2bae78,_0x22de5a);_0x5208be(_0x22de5a);});});}exports[_0x40d7('0x19')]=function(_0x28bbc0){var _0x3d2afa=this;return new Promise(function(_0x3ec437,_0x5eb3c1){return db['ChatQueue']['findAll']({'raw':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0['options'][_0x40d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1c')]||null:null,'attributes':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1d')]||null:null,'limit':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1e')]||null:null,'include':_0x28bbc0[_0x40d7('0x1a')]?_0x28bbc0['options'][_0x40d7('0x1f')]?_[_0x40d7('0x20')](_0x28bbc0[_0x40d7('0x1a')][_0x40d7('0x1f')],function(_0x528ab5){return{'model':db[_0x528ab5['model']],'as':_0x528ab5['as'],'attributes':_0x528ab5[_0x40d7('0x1d')],'include':_0x528ab5['include']?_['map'](_0x528ab5[_0x40d7('0x1f')],function(_0x1ef074){return{'model':db[_0x1ef074[_0x40d7('0x21')]],'as':_0x1ef074['as'],'attributes':_0x1ef074[_0x40d7('0x1d')],'include':_0x1ef074['include']?_['map'](_0x1ef074[_0x40d7('0x1f')],function(_0x2b5f11){return{'model':db[_0x2b5f11[_0x40d7('0x21')]],'as':_0x2b5f11['as'],'attributes':_0x2b5f11['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1102d3){logger[_0x40d7('0xf')]('GetChatQueue',_0x28bbc0);logger[_0x40d7('0x11')](_0x40d7('0x19'),_0x28bbc0,JSON[_0x40d7('0x14')](_0x1102d3));_0x3ec437(_0x1102d3);})[_0x40d7('0x18')](function(_0x555a3b){logger['error'](_0x40d7('0x19'),_0x555a3b[_0x40d7('0x17')],_0x28bbc0);_0x5eb3c1(_0x3d2afa[_0x40d7('0x15')](0x1f4,_0x555a3b[_0x40d7('0x17')]));});});};exports[_0x40d7('0x22')]=function(_0x4a2bc2){var _0x23e560=this;return new Promise(function(_0x5af456,_0x22edd1){return db[_0x40d7('0x23')][_0x40d7('0x24')]({'raw':_0x4a2bc2['options']?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1c')]||null:null,'attributes':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')]['attributes']||null:null,'include':_0x4a2bc2[_0x40d7('0x1a')]?_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1f')]?_[_0x40d7('0x20')](_0x4a2bc2[_0x40d7('0x1a')][_0x40d7('0x1f')],function(_0x1e6f08){return{'model':db[_0x1e6f08[_0x40d7('0x21')]],'as':_0x1e6f08['as'],'attributes':_0x1e6f08['attributes'],'include':_0x1e6f08['include']?_[_0x40d7('0x20')](_0x1e6f08[_0x40d7('0x1f')],function(_0x4902a1){return{'model':db[_0x4902a1['model']],'as':_0x4902a1['as'],'attributes':_0x4902a1['attributes'],'include':_0x4902a1[_0x40d7('0x1f')]?_['map'](_0x4902a1[_0x40d7('0x1f')],function(_0x56b17c){return{'model':db[_0x56b17c[_0x40d7('0x21')]],'as':_0x56b17c['as'],'attributes':_0x56b17c[_0x40d7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x40d7('0xe')](function(_0x2e4ccb){logger[_0x40d7('0xf')]('ShowChatQueue',_0x4a2bc2);logger[_0x40d7('0x11')](_0x40d7('0x22'),_0x4a2bc2,JSON[_0x40d7('0x14')](_0x2e4ccb));_0x5af456(_0x2e4ccb);})[_0x40d7('0x18')](function(_0x21a675){logger['error']('ShowChatQueue',_0x21a675['message'],_0x4a2bc2);_0x22edd1(_0x23e560[_0x40d7('0x15')](0x1f4,_0x21a675['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 1dc5ec0..a4b1f7f 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x72b1,0x16e));var _0x172b=function(_0x102b25,_0x2e752a){_0x102b25=_0x102b25-0x0;var _0x13fe61=_0x72b1[_0x102b25];return _0x13fe61;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file +var _0xd6d6=['chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5b4271,_0x2f1e5d){var _0x10127e=function(_0x29ea27){while(--_0x29ea27){_0x5b4271['push'](_0x5b4271['shift']());}};_0x10127e(++_0x2f1e5d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4036b1,_0x1ee915){_0x4036b1=_0x4036b1-0x0;var _0x16260f=_0xd6d6[_0x4036b1];return _0x16260f;};'use strict';var ChatQueueEvents=require(_0x6d6d('0x0'));var events=[_0x6d6d('0x1'),_0x6d6d('0x2'),_0x6d6d('0x3')];function createListener(_0x536523,_0x2e1aed){return function(_0x3b743d){_0x2e1aed[_0x6d6d('0x4')](_0x536523,_0x3b743d);};}function removeListener(_0x2a838a,_0x5207c9){return function(){ChatQueueEvents[_0x6d6d('0x5')](_0x2a838a,_0x5207c9);};}exports[_0x6d6d('0x6')]=function(_0x5702dc){for(var _0x210ff7=0x0,_0x1bf731=events[_0x6d6d('0x7')];_0x210ff7<_0x1bf731;_0x210ff7++){var _0x18f824=events[_0x210ff7];var _0xd49f57=createListener(_0x6d6d('0x8')+_0x18f824,_0x5702dc);ChatQueueEvents['on'](_0x18f824,_0xd49f57);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 718ca7c..cd772e1 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5a5216,_0x58f544){var _0x1aa577=function(_0x1e0781){while(--_0x1e0781){_0x5a5216['push'](_0x5a5216['shift']());}};_0x1aa577(++_0x58f544);}(_0xe14b,0x93));var _0xbe14=function(_0x5eee08,_0x301c49){_0x5eee08=_0x5eee08-0x0;var _0xe7e906=_0xe14b[_0x5eee08];return _0xe7e906;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x585554,_0x1413db){var _0x4eabed=function(_0x42cd75){while(--_0x42cd75){_0x585554['push'](_0x585554['shift']());}};_0x4eabed(++_0x1413db);}(_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')]('/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 0bd7f8d..8c2a5e6 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 _0xed66=['STRING','DATE'];(function(_0x331cad,_0x50aec0){var _0x55db9e=function(_0x5e3459){while(--_0x5e3459){_0x331cad['push'](_0x331cad['shift']());}};_0x55db9e(++_0x50aec0);}(_0xed66,0xf2));var _0x6ed6=function(_0x50abc4,_0x558d64){_0x50abc4=_0x50abc4-0x0;var _0x5a745d=_0xed66[_0x50abc4];return _0x5a745d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6ed6('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x6ed6('0x0')]},'joinAt':{'type':Sequelize[_0x6ed6('0x1')]},'leaveAt':{'type':Sequelize[_0x6ed6('0x1')]},'acceptAt':{'type':Sequelize[_0x6ed6('0x1')]},'exitAt':{'type':Sequelize[_0x6ed6('0x1')]},'reason':{'type':Sequelize[_0x6ed6('0x0')]}}; \ No newline at end of file +var _0x167a=['exports','STRING','DATE','sequelize'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x167a,0x1ab));var _0xa167=function(_0x28bf2c,_0x248fa0){_0x28bf2c=_0x28bf2c-0x0;var _0x69dac6=_0x167a[_0x28bf2c];return _0x69dac6;};'use strict';var moment=require('moment');var Sequelize=require(_0xa167('0x0'));module[_0xa167('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa167('0x2')]},'joinAt':{'type':Sequelize[_0xa167('0x3')]},'leaveAt':{'type':Sequelize[_0xa167('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa167('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 708fe4c..4c4b71e 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 _0xef66=['pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','merge','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2d4b41,_0x268fbe){var _0x19470b=function(_0x2dcdea){while(--_0x2dcdea){_0x2d4b41['push'](_0x2d4b41['shift']());}};_0x19470b(++_0x268fbe);}(_0xef66,0x1db));var _0x6ef6=function(_0xcfd35b,_0xa94bd2){_0xcfd35b=_0xcfd35b-0x0;var _0x1867bf=_0xef66[_0xcfd35b];return _0x1867bf;};'use strict';var emlformat=require(_0x6ef6('0x0'));var rimraf=require(_0x6ef6('0x1'));var zipdir=require(_0x6ef6('0x2'));var jsonpatch=require(_0x6ef6('0x3'));var rp=require(_0x6ef6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ef6('0x5'));var util=require(_0x6ef6('0x6'));var path=require(_0x6ef6('0x7'));var sox=require(_0x6ef6('0x8'));var csv=require(_0x6ef6('0x9'));var ejs=require(_0x6ef6('0xa'));var fs=require('fs');var fs_extra=require(_0x6ef6('0xb'));var _=require(_0x6ef6('0xc'));var squel=require(_0x6ef6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ef6('0xe'));var toCsv=require(_0x6ef6('0x9'));var querystring=require(_0x6ef6('0xf'));var Papa=require(_0x6ef6('0x10'));var Redis=require(_0x6ef6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ef6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ef6('0x13'))('api');var utils=require(_0x6ef6('0x14'));var config=require(_0x6ef6('0x15'));var licenseUtil=require(_0x6ef6('0x16'));var db=require(_0x6ef6('0x17'))['db'];function respondWithStatusCode(_0x596b91,_0x3aa045){_0x3aa045=_0x3aa045||0xcc;return function(_0x22b44e){if(_0x22b44e){return _0x596b91[_0x6ef6('0x18')](_0x3aa045);}return _0x596b91[_0x6ef6('0x19')](_0x3aa045)['end']();};}function respondWithResult(_0x265583,_0x5845b7){_0x5845b7=_0x5845b7||0xc8;return function(_0x40d198){if(_0x40d198){return _0x265583[_0x6ef6('0x19')](_0x5845b7)['json'](_0x40d198);}};}function respondWithFilteredResult(_0x248ab3,_0x1f4c3d){return function(_0x453aa3){if(_0x453aa3){var _0x3f0a84=typeof _0x1f4c3d[_0x6ef6('0x1a')]===_0x6ef6('0x1b')&&typeof _0x1f4c3d[_0x6ef6('0x1c')]===_0x6ef6('0x1b');var _0x1ed381=_0x453aa3[_0x6ef6('0x1d')];var _0x53586d=_0x3f0a84?0x0:_0x1f4c3d[_0x6ef6('0x1a')];var _0x2510be=_0x3f0a84?_0x453aa3[_0x6ef6('0x1d')]:_0x1f4c3d[_0x6ef6('0x1a')]+_0x1f4c3d[_0x6ef6('0x1c')];var _0x2e6e52;if(_0x2510be>=_0x1ed381){_0x2510be=_0x1ed381;_0x2e6e52=0xc8;}else{_0x2e6e52=0xce;}_0x248ab3[_0x6ef6('0x19')](_0x2e6e52);return _0x248ab3['set'](_0x6ef6('0x1e'),_0x53586d+'-'+_0x2510be+'/'+_0x1ed381)[_0x6ef6('0x1f')](_0x453aa3);}return null;};}function patchUpdates(_0x2903ea){return function(_0x11ade5){try{jsonpatch['apply'](_0x11ade5,_0x2903ea,!![]);}catch(_0x164ed9){return BPromise[_0x6ef6('0x20')](_0x164ed9);}return _0x11ade5[_0x6ef6('0x21')]();};}function saveUpdates(_0x4f6df6,_0x4257d8){return function(_0x1096de){if(_0x1096de){return _0x1096de['update'](_0x4f6df6)[_0x6ef6('0x22')](function(_0x3c225f){return _0x3c225f;});}return null;};}function removeEntity(_0x4d7f90,_0x366f2c){return function(_0xb1c6b0){if(_0xb1c6b0){return _0xb1c6b0[_0x6ef6('0x23')]()[_0x6ef6('0x22')](function(){_0x4d7f90[_0x6ef6('0x19')](0xcc)[_0x6ef6('0x24')]();});}};}function handleEntityNotFound(_0x1cd549,_0x499d4f){return function(_0x2e5059){if(!_0x2e5059){_0x1cd549['sendStatus'](0x194);}return _0x2e5059;};}function handleError(_0x39d3cc,_0x692c3d){_0x692c3d=_0x692c3d||0x1f4;return function(_0x443ded){logger[_0x6ef6('0x25')](_0x443ded[_0x6ef6('0x26')]);if(_0x443ded[_0x6ef6('0x27')]){delete _0x443ded[_0x6ef6('0x27')];}_0x39d3cc[_0x6ef6('0x19')](_0x692c3d)[_0x6ef6('0x28')](_0x443ded);};}exports[_0x6ef6('0x29')]=function(_0x136d20,_0x2d87a8){var _0x483f4d={},_0x40f9f6={},_0x295616={'count':0x0,'rows':[]};var _0x2e4bed=_[_0x6ef6('0x2a')](db[_0x6ef6('0x2b')][_0x6ef6('0x2c')],function(_0x23f979){return{'name':_0x23f979['fieldName'],'type':_0x23f979[_0x6ef6('0x2d')]['key']};});_0x40f9f6[_0x6ef6('0x2e')]=_[_0x6ef6('0x2a')](_0x2e4bed,_0x6ef6('0x27'));_0x40f9f6['query']=_['keys'](_0x136d20[_0x6ef6('0x2f')]);_0x40f9f6[_0x6ef6('0x30')]=_[_0x6ef6('0x31')](_0x40f9f6['model'],_0x40f9f6[_0x6ef6('0x2f')]);_0x483f4d['attributes']=_[_0x6ef6('0x31')](_0x40f9f6[_0x6ef6('0x2e')],qs['fields'](_0x136d20['query'][_0x6ef6('0x32')]));_0x483f4d['attributes']=_0x483f4d[_0x6ef6('0x33')]['length']?_0x483f4d[_0x6ef6('0x33')]:_0x40f9f6['model'];if(!_0x136d20['query'][_0x6ef6('0x34')](_0x6ef6('0x35'))){_0x483f4d['limit']=qs[_0x6ef6('0x1c')](_0x136d20['query'][_0x6ef6('0x1c')]);_0x483f4d['offset']=qs[_0x6ef6('0x1a')](_0x136d20['query'][_0x6ef6('0x1a')]);}_0x483f4d[_0x6ef6('0x36')]=qs[_0x6ef6('0x37')](_0x136d20['query']['sort']);_0x483f4d[_0x6ef6('0x38')]=qs[_0x6ef6('0x30')](_[_0x6ef6('0x39')](_0x136d20[_0x6ef6('0x2f')],_0x40f9f6['filters']),_0x2e4bed);if(_0x136d20['query'][_0x6ef6('0x3a')]){_0x483f4d['where']=_['merge'](_0x483f4d[_0x6ef6('0x38')],{'$or':_['map'](_0x2e4bed,function(_0x38969c){if(_0x38969c[_0x6ef6('0x2d')]!==_0x6ef6('0x3b')){var _0x31facc={};_0x31facc[_0x38969c[_0x6ef6('0x27')]]={'$like':'%'+_0x136d20[_0x6ef6('0x2f')][_0x6ef6('0x3a')]+'%'};return _0x31facc;}})});}_0x483f4d=_['merge']({},_0x483f4d,_0x136d20[_0x6ef6('0x3c')]);var _0x58fed8={'where':_0x483f4d['where']};return db[_0x6ef6('0x2b')][_0x6ef6('0x1d')](_0x58fed8)[_0x6ef6('0x22')](function(_0x4da800){_0x295616[_0x6ef6('0x1d')]=_0x4da800;if(_0x136d20[_0x6ef6('0x2f')][_0x6ef6('0x3d')]){_0x483f4d['include']=[{'all':!![]}];}return db[_0x6ef6('0x2b')][_0x6ef6('0x3e')](_0x483f4d);})[_0x6ef6('0x22')](function(_0x1bf2af){_0x295616[_0x6ef6('0x3f')]=_0x1bf2af;return _0x295616;})[_0x6ef6('0x22')](respondWithFilteredResult(_0x2d87a8,_0x483f4d))[_0x6ef6('0x40')](handleError(_0x2d87a8,null));};exports[_0x6ef6('0x41')]=function(_0x2c03a7,_0x230f30){var _0x51b0a1={'raw':!![],'where':{'id':_0x2c03a7[_0x6ef6('0x42')]['id']}},_0xf46913={};_0xf46913[_0x6ef6('0x2e')]=_[_0x6ef6('0x43')](db[_0x6ef6('0x2b')][_0x6ef6('0x2c')]);_0xf46913[_0x6ef6('0x2f')]=_[_0x6ef6('0x43')](_0x2c03a7[_0x6ef6('0x2f')]);_0xf46913[_0x6ef6('0x30')]=_[_0x6ef6('0x31')](_0xf46913['model'],_0xf46913[_0x6ef6('0x2f')]);_0x51b0a1['attributes']=_[_0x6ef6('0x31')](_0xf46913['model'],qs[_0x6ef6('0x32')](_0x2c03a7[_0x6ef6('0x2f')]['fields']));_0x51b0a1[_0x6ef6('0x33')]=_0x51b0a1[_0x6ef6('0x33')][_0x6ef6('0x44')]?_0x51b0a1[_0x6ef6('0x33')]:_0xf46913[_0x6ef6('0x2e')];if(_0x2c03a7['query'][_0x6ef6('0x3d')]){_0x51b0a1[_0x6ef6('0x45')]=[{'all':!![]}];}_0x51b0a1=_[_0x6ef6('0x46')]({},_0x51b0a1,_0x2c03a7[_0x6ef6('0x3c')]);return db[_0x6ef6('0x2b')][_0x6ef6('0x47')](_0x51b0a1)[_0x6ef6('0x22')](handleEntityNotFound(_0x230f30,null))[_0x6ef6('0x22')](respondWithResult(_0x230f30,null))['catch'](handleError(_0x230f30,null));};exports[_0x6ef6('0x48')]=function(_0x2d54c0,_0x52e93f){return db['ChatQueueReport'][_0x6ef6('0x48')](_0x2d54c0['body'],{})[_0x6ef6('0x22')](respondWithResult(_0x52e93f,0xc9))['catch'](handleError(_0x52e93f,null));};exports[_0x6ef6('0x49')]=function(_0x712015,_0x23edde){if(_0x712015[_0x6ef6('0x4a')]['id']){delete _0x712015['body']['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x712015['params']['id']}})[_0x6ef6('0x22')](handleEntityNotFound(_0x23edde,null))[_0x6ef6('0x22')](saveUpdates(_0x712015[_0x6ef6('0x4a')],null))['then'](respondWithResult(_0x23edde,null))[_0x6ef6('0x40')](handleError(_0x23edde,null));};exports[_0x6ef6('0x23')]=function(_0x30a2a5,_0x43fda4){return db[_0x6ef6('0x2b')][_0x6ef6('0x47')]({'where':{'id':_0x30a2a5[_0x6ef6('0x42')]['id']}})['then'](handleEntityNotFound(_0x43fda4,null))[_0x6ef6('0x22')](removeEntity(_0x43fda4,null))['catch'](handleError(_0x43fda4,null));};exports[_0x6ef6('0x4b')]=function(_0x3549e9,_0x511a43){return db['ChatQueueReport'][_0x6ef6('0x4b')]()[_0x6ef6('0x22')](respondWithResult(_0x511a43,null))[_0x6ef6('0x40')](handleError(_0x511a43,null));}; \ No newline at end of file +var _0x44ff=['show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch'];(function(_0xc691d8,_0x69a50a){var _0x307e60=function(_0x40c734){while(--_0x40c734){_0xc691d8['push'](_0xc691d8['shift']());}};_0x307e60(++_0x69a50a);}(_0x44ff,0x1c3));var _0xf44f=function(_0x46121a,_0xd44bc0){_0x46121a=_0x46121a-0x0;var _0x126d1c=_0x44ff[_0x46121a];return _0x126d1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf44f('0x0'));var zipdir=require(_0xf44f('0x1'));var jsonpatch=require(_0xf44f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf44f('0x3'));var path=require(_0xf44f('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf44f('0x5'));var fs=require('fs');var fs_extra=require(_0xf44f('0x6'));var _=require(_0xf44f('0x7'));var squel=require('squel');var crypto=require(_0xf44f('0x8'));var jsforce=require(_0xf44f('0x9'));var deskjs=require(_0xf44f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf44f('0xb'));var Papa=require(_0xf44f('0xc'));var Redis=require(_0xf44f('0xd'));var authService=require(_0xf44f('0xe'));var qs=require(_0xf44f('0xf'));var as=require(_0xf44f('0x10'));var hardwareService=require(_0xf44f('0x11'));var logger=require(_0xf44f('0x12'))(_0xf44f('0x13'));var utils=require(_0xf44f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf44f('0x15'));var db=require(_0xf44f('0x16'))['db'];function respondWithStatusCode(_0x23b73a,_0x34d3da){_0x34d3da=_0x34d3da||0xcc;return function(_0x10176f){if(_0x10176f){return _0x23b73a[_0xf44f('0x17')](_0x34d3da);}return _0x23b73a[_0xf44f('0x18')](_0x34d3da)['end']();};}function respondWithResult(_0x5d2b86,_0x17e828){_0x17e828=_0x17e828||0xc8;return function(_0x5f20aa){if(_0x5f20aa){return _0x5d2b86['status'](_0x17e828)['json'](_0x5f20aa);}};}function respondWithFilteredResult(_0x3aa2b8,_0x1d2d77){return function(_0x409907){if(_0x409907){var _0x1a5ce4=typeof _0x1d2d77['offset']===_0xf44f('0x19')&&typeof _0x1d2d77['limit']===_0xf44f('0x19');var _0x40e414=_0x409907[_0xf44f('0x1a')];var _0x15e5b6=_0x1a5ce4?0x0:_0x1d2d77['offset'];var _0x4f0338=_0x1a5ce4?_0x409907['count']:_0x1d2d77['offset']+_0x1d2d77[_0xf44f('0x1b')];var _0x4f0292;if(_0x4f0338>=_0x40e414){_0x4f0338=_0x40e414;_0x4f0292=0xc8;}else{_0x4f0292=0xce;}_0x3aa2b8['status'](_0x4f0292);return _0x3aa2b8[_0xf44f('0x1c')](_0xf44f('0x1d'),_0x15e5b6+'-'+_0x4f0338+'/'+_0x40e414)[_0xf44f('0x1e')](_0x409907);}return null;};}function patchUpdates(_0x515ea6){return function(_0x1c317e){try{jsonpatch[_0xf44f('0x1f')](_0x1c317e,_0x515ea6,!![]);}catch(_0x5eb768){return BPromise[_0xf44f('0x20')](_0x5eb768);}return _0x1c317e['save']();};}function saveUpdates(_0x1cc24e,_0x166acd){return function(_0x3e0b9c){if(_0x3e0b9c){return _0x3e0b9c['update'](_0x1cc24e)[_0xf44f('0x21')](function(_0x1b9dc9){return _0x1b9dc9;});}return null;};}function removeEntity(_0x329ed3,_0x58d4af){return function(_0x1ba9c0){if(_0x1ba9c0){return _0x1ba9c0[_0xf44f('0x22')]()[_0xf44f('0x21')](function(){_0x329ed3[_0xf44f('0x18')](0xcc)[_0xf44f('0x23')]();});}};}function handleEntityNotFound(_0x5313f5,_0x3c04fe){return function(_0x2a17e0){if(!_0x2a17e0){_0x5313f5[_0xf44f('0x17')](0x194);}return _0x2a17e0;};}function handleError(_0x2fe533,_0x5b9c45){_0x5b9c45=_0x5b9c45||0x1f4;return function(_0x1af2a2){logger[_0xf44f('0x24')](_0x1af2a2[_0xf44f('0x25')]);if(_0x1af2a2[_0xf44f('0x26')]){delete _0x1af2a2[_0xf44f('0x26')];}_0x2fe533[_0xf44f('0x18')](_0x5b9c45)['send'](_0x1af2a2);};}exports[_0xf44f('0x27')]=function(_0x5255eb,_0x2f5075){var _0x14e6cf={},_0x5a5a83={},_0x544f32={'count':0x0,'rows':[]};var _0x11d199=_[_0xf44f('0x28')](db[_0xf44f('0x29')][_0xf44f('0x2a')],function(_0x549fdd){return{'name':_0x549fdd[_0xf44f('0x2b')],'type':_0x549fdd[_0xf44f('0x2c')]['key']};});_0x5a5a83[_0xf44f('0x2d')]=_[_0xf44f('0x28')](_0x11d199,_0xf44f('0x26'));_0x5a5a83[_0xf44f('0x2e')]=_[_0xf44f('0x2f')](_0x5255eb[_0xf44f('0x2e')]);_0x5a5a83[_0xf44f('0x30')]=_[_0xf44f('0x31')](_0x5a5a83[_0xf44f('0x2d')],_0x5a5a83[_0xf44f('0x2e')]);_0x14e6cf['attributes']=_[_0xf44f('0x31')](_0x5a5a83[_0xf44f('0x2d')],qs['fields'](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x32')]));_0x14e6cf[_0xf44f('0x33')]=_0x14e6cf[_0xf44f('0x33')][_0xf44f('0x34')]?_0x14e6cf['attributes']:_0x5a5a83[_0xf44f('0x2d')];if(!_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x35')](_0xf44f('0x36'))){_0x14e6cf[_0xf44f('0x1b')]=qs[_0xf44f('0x1b')](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x1b')]);_0x14e6cf[_0xf44f('0x37')]=qs['offset'](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x37')]);}_0x14e6cf[_0xf44f('0x38')]=qs[_0xf44f('0x39')](_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x39')]);_0x14e6cf[_0xf44f('0x3a')]=qs[_0xf44f('0x30')](_[_0xf44f('0x3b')](_0x5255eb[_0xf44f('0x2e')],_0x5a5a83[_0xf44f('0x30')]),_0x11d199);if(_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x3c')]){_0x14e6cf[_0xf44f('0x3a')]=_[_0xf44f('0x3d')](_0x14e6cf[_0xf44f('0x3a')],{'$or':_[_0xf44f('0x28')](_0x11d199,function(_0x37f274){if(_0x37f274[_0xf44f('0x2c')]!==_0xf44f('0x3e')){var _0x460308={};_0x460308[_0x37f274[_0xf44f('0x26')]]={'$like':'%'+_0x5255eb[_0xf44f('0x2e')]['filter']+'%'};return _0x460308;}})});}_0x14e6cf=_[_0xf44f('0x3d')]({},_0x14e6cf,_0x5255eb[_0xf44f('0x3f')]);var _0x1df436={'where':_0x14e6cf[_0xf44f('0x3a')]};return db['ChatQueueReport'][_0xf44f('0x1a')](_0x1df436)['then'](function(_0x54fd2f){_0x544f32[_0xf44f('0x1a')]=_0x54fd2f;if(_0x5255eb[_0xf44f('0x2e')][_0xf44f('0x40')]){_0x14e6cf[_0xf44f('0x41')]=[{'all':!![]}];}return db[_0xf44f('0x29')]['findAll'](_0x14e6cf);})[_0xf44f('0x21')](function(_0x32e8e0){_0x544f32['rows']=_0x32e8e0;return _0x544f32;})[_0xf44f('0x21')](respondWithFilteredResult(_0x2f5075,_0x14e6cf))[_0xf44f('0x42')](handleError(_0x2f5075,null));};exports[_0xf44f('0x43')]=function(_0x524d57,_0x11c508){var _0x502a21={'raw':!![],'where':{'id':_0x524d57[_0xf44f('0x44')]['id']}},_0x28717a={};_0x28717a['model']=_[_0xf44f('0x2f')](db[_0xf44f('0x29')][_0xf44f('0x2a')]);_0x28717a[_0xf44f('0x2e')]=_[_0xf44f('0x2f')](_0x524d57[_0xf44f('0x2e')]);_0x28717a[_0xf44f('0x30')]=_[_0xf44f('0x31')](_0x28717a['model'],_0x28717a[_0xf44f('0x2e')]);_0x502a21[_0xf44f('0x33')]=_[_0xf44f('0x31')](_0x28717a[_0xf44f('0x2d')],qs[_0xf44f('0x32')](_0x524d57[_0xf44f('0x2e')]['fields']));_0x502a21[_0xf44f('0x33')]=_0x502a21[_0xf44f('0x33')][_0xf44f('0x34')]?_0x502a21['attributes']:_0x28717a[_0xf44f('0x2d')];if(_0x524d57['query'][_0xf44f('0x40')]){_0x502a21[_0xf44f('0x41')]=[{'all':!![]}];}_0x502a21=_[_0xf44f('0x3d')]({},_0x502a21,_0x524d57['options']);return db[_0xf44f('0x29')][_0xf44f('0x45')](_0x502a21)[_0xf44f('0x21')](handleEntityNotFound(_0x11c508,null))['then'](respondWithResult(_0x11c508,null))['catch'](handleError(_0x11c508,null));};exports[_0xf44f('0x46')]=function(_0x2cb20c,_0x193dbd){return db[_0xf44f('0x29')][_0xf44f('0x46')](_0x2cb20c[_0xf44f('0x47')],{})[_0xf44f('0x21')](respondWithResult(_0x193dbd,0xc9))['catch'](handleError(_0x193dbd,null));};exports[_0xf44f('0x48')]=function(_0x30e382,_0x5a80fc){if(_0x30e382['body']['id']){delete _0x30e382['body']['id'];}return db[_0xf44f('0x29')][_0xf44f('0x45')]({'where':{'id':_0x30e382[_0xf44f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a80fc,null))['then'](saveUpdates(_0x30e382[_0xf44f('0x47')],null))[_0xf44f('0x21')](respondWithResult(_0x5a80fc,null))[_0xf44f('0x42')](handleError(_0x5a80fc,null));};exports[_0xf44f('0x22')]=function(_0x1ecff0,_0x55a038){return db[_0xf44f('0x29')][_0xf44f('0x45')]({'where':{'id':_0x1ecff0['params']['id']}})[_0xf44f('0x21')](handleEntityNotFound(_0x55a038,null))['then'](removeEntity(_0x55a038,null))[_0xf44f('0x42')](handleError(_0x55a038,null));};exports[_0xf44f('0x49')]=function(_0x300fe0,_0x26ea85){return db[_0xf44f('0x29')][_0xf44f('0x49')]()[_0xf44f('0x21')](respondWithResult(_0x26ea85,null))['catch'](handleError(_0x26ea85,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 0acbcfe..ab3f945 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x414b13,_0x378308){var _0x2ec68a=function(_0x25a872){while(--_0x25a872){_0x414b13['push'](_0x414b13['shift']());}};_0x2ec68a(++_0x378308);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5edbfc,_0x47c0aa){var _0x3911d2=function(_0x33cdcc){while(--_0x33cdcc){_0x5edbfc['push'](_0x5edbfc['shift']());}};_0x3911d2(++_0x47c0aa);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1a45a7c..6d67994 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 _0x5b78=['UpdateChatQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug'];(function(_0x29d082,_0x9da22c){var _0x5e5f78=function(_0x1dec27){while(--_0x1dec27){_0x29d082['push'](_0x29d082['shift']());}};_0x5e5f78(++_0x9da22c);}(_0x5b78,0x18f));var _0x85b7=function(_0x28f648,_0x5a4140){_0x28f648=_0x28f648-0x0;var _0x223692=_0x5b78[_0x28f648];return _0x223692;};'use strict';var _=require(_0x85b7('0x0'));var util=require(_0x85b7('0x1'));var moment=require(_0x85b7('0x2'));var BPromise=require(_0x85b7('0x3'));var rs=require(_0x85b7('0x4'));var fs=require('fs');var Redis=require(_0x85b7('0x5'));var db=require(_0x85b7('0x6'))['db'];var utils=require(_0x85b7('0x7'));var logger=require('../../config/logger')(_0x85b7('0x8'));var config=require(_0x85b7('0x9'));var jayson=require(_0x85b7('0xa'));var client=jayson['client'][_0x85b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x585614,_0x166b72,_0xcdf1bf){return new BPromise(function(_0xfc94c3,_0x5858f1){return client[_0x85b7('0xc')](_0x585614,_0xcdf1bf)[_0x85b7('0xd')](function(_0x19372e){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x166b72,_0x85b7('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x166b72,'request\x20sent',JSON[_0x85b7('0xf')](_0x19372e));if(_0x19372e[_0x85b7('0x10')]){if(_0x19372e[_0x85b7('0x10')][_0x85b7('0x11')]===0x1f4){logger[_0x85b7('0x10')](_0x85b7('0x12'),_0x166b72,_0x19372e['error'][_0x85b7('0x13')]);return _0x5858f1(_0x19372e[_0x85b7('0x10')][_0x85b7('0x13')]);}logger[_0x85b7('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x166b72,_0x19372e['error'][_0x85b7('0x13')]);return _0xfc94c3(_0x19372e['error'][_0x85b7('0x13')]);}else{logger[_0x85b7('0x14')](_0x85b7('0x12'),_0x166b72,_0x85b7('0xe'));_0xfc94c3(_0x19372e[_0x85b7('0x15')][_0x85b7('0x13')]);}})[_0x85b7('0x16')](function(_0x248c86){logger[_0x85b7('0x10')](_0x85b7('0x12'),_0x166b72,_0x248c86);_0x5858f1(_0x248c86);});});}exports[_0x85b7('0x17')]=function(_0x3d6662){var _0x59ac61=this;return new Promise(function(_0x1744b7,_0x4b12c9){return db[_0x85b7('0x18')][_0x85b7('0x19')](_0x3d6662[_0x85b7('0x1a')],{'raw':_0x3d6662[_0x85b7('0x1b')]?_0x3d6662[_0x85b7('0x1b')][_0x85b7('0x1c')]===undefined?!![]:![]:!![]})[_0x85b7('0xd')](function(_0x315841){logger[_0x85b7('0x14')](_0x85b7('0x17'),_0x3d6662);logger[_0x85b7('0x1d')](_0x85b7('0x17'),_0x3d6662,JSON[_0x85b7('0xf')](_0x315841));_0x1744b7(_0x315841);})[_0x85b7('0x16')](function(_0x549aca){logger[_0x85b7('0x10')]('CreateChatQueueReport',_0x549aca[_0x85b7('0x13')],_0x3d6662);_0x4b12c9(_0x59ac61['error'](0x1f4,_0x549aca[_0x85b7('0x13')]));});});};exports[_0x85b7('0x1e')]=function(_0x5ec1d0){var _0x34328b=this;return new Promise(function(_0x2990dc,_0x40d3e6){return db['ChatQueueReport'][_0x85b7('0x1f')](_0x5ec1d0['body'],{'raw':_0x5ec1d0[_0x85b7('0x1b')]?_0x5ec1d0[_0x85b7('0x1b')][_0x85b7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ec1d0[_0x85b7('0x1b')]?_0x5ec1d0[_0x85b7('0x1b')]['where']||null:null,'attributes':_0x5ec1d0[_0x85b7('0x1b')]?_0x5ec1d0['options']['attributes']||null:null,'limit':_0x5ec1d0[_0x85b7('0x1b')]?_0x5ec1d0[_0x85b7('0x1b')][_0x85b7('0x20')]||null:null})[_0x85b7('0xd')](function(_0x4b01c0){logger[_0x85b7('0x14')](_0x85b7('0x1e'),_0x5ec1d0);logger[_0x85b7('0x1d')](_0x85b7('0x1e'),_0x5ec1d0,JSON[_0x85b7('0xf')](_0x4b01c0));_0x2990dc(_0x4b01c0);})['catch'](function(_0x142e15){logger[_0x85b7('0x10')]('UpdateChatQueueReport',_0x142e15['message'],_0x5ec1d0);_0x40d3e6(_0x34328b['error'](0x1f4,_0x142e15[_0x85b7('0x13')]));});});}; \ No newline at end of file +var _0xd233=['request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dc2ac,_0xe92856){var _0x424d79=function(_0x416d89){while(--_0x416d89){_0x3dc2ac['push'](_0x3dc2ac['shift']());}};_0x424d79(++_0xe92856);}(_0xd233,0xdc));var _0x3d23=function(_0x4f8434,_0x562ed5){_0x4f8434=_0x4f8434-0x0;var _0x5bd5e4=_0xd233[_0x4f8434];return _0x5bd5e4;};'use strict';var _=require(_0x3d23('0x0'));var util=require(_0x3d23('0x1'));var moment=require(_0x3d23('0x2'));var BPromise=require(_0x3d23('0x3'));var rs=require(_0x3d23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d23('0x6'))(_0x3d23('0x7'));var config=require(_0x3d23('0x8'));var jayson=require(_0x3d23('0x9'));var client=jayson['client'][_0x3d23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e3a30,_0x4323f1,_0xb65d83){return new BPromise(function(_0x1a8220,_0xf1886){return client[_0x3d23('0xb')](_0x3e3a30,_0xb65d83)[_0x3d23('0xc')](function(_0x2a8181){logger['info'](_0x3d23('0xd'),_0x4323f1,_0x3d23('0xe'));logger[_0x3d23('0xf')](_0x3d23('0x10'),_0x4323f1,'request\x20sent',JSON[_0x3d23('0x11')](_0x2a8181));if(_0x2a8181[_0x3d23('0x12')]){if(_0x2a8181[_0x3d23('0x12')][_0x3d23('0x13')]===0x1f4){logger[_0x3d23('0x12')](_0x3d23('0xd'),_0x4323f1,_0x2a8181['error'][_0x3d23('0x14')]);return _0xf1886(_0x2a8181['error'][_0x3d23('0x14')]);}logger['error'](_0x3d23('0xd'),_0x4323f1,_0x2a8181[_0x3d23('0x12')][_0x3d23('0x14')]);return _0x1a8220(_0x2a8181[_0x3d23('0x12')][_0x3d23('0x14')]);}else{logger[_0x3d23('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x4323f1,'request\x20sent');_0x1a8220(_0x2a8181[_0x3d23('0x16')][_0x3d23('0x14')]);}})[_0x3d23('0x17')](function(_0x2b8b10){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4323f1,_0x2b8b10);_0xf1886(_0x2b8b10);});});}exports[_0x3d23('0x18')]=function(_0x407e61){var _0x585fad=this;return new Promise(function(_0xc73536,_0x1b5c1e){return db[_0x3d23('0x19')][_0x3d23('0x1a')](_0x407e61[_0x3d23('0x1b')],{'raw':_0x407e61[_0x3d23('0x1c')]?_0x407e61[_0x3d23('0x1c')][_0x3d23('0x1d')]===undefined?!![]:![]:!![]})[_0x3d23('0xc')](function(_0x35e740){logger[_0x3d23('0x15')](_0x3d23('0x18'),_0x407e61);logger[_0x3d23('0xf')](_0x3d23('0x18'),_0x407e61,JSON[_0x3d23('0x11')](_0x35e740));_0xc73536(_0x35e740);})['catch'](function(_0x42a98c){logger[_0x3d23('0x12')](_0x3d23('0x18'),_0x42a98c[_0x3d23('0x14')],_0x407e61);_0x1b5c1e(_0x585fad[_0x3d23('0x12')](0x1f4,_0x42a98c[_0x3d23('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x2a5077){var _0x2a2214=this;return new Promise(function(_0x3fe7e5,_0x2f8ad6){return db['ChatQueueReport'][_0x3d23('0x1e')](_0x2a5077[_0x3d23('0x1b')],{'raw':_0x2a5077['options']?_0x2a5077[_0x3d23('0x1c')][_0x3d23('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a5077['options']?_0x2a5077[_0x3d23('0x1c')][_0x3d23('0x1f')]||null:null,'attributes':_0x2a5077['options']?_0x2a5077[_0x3d23('0x1c')]['attributes']||null:null,'limit':_0x2a5077[_0x3d23('0x1c')]?_0x2a5077[_0x3d23('0x1c')]['limit']||null:null})['then'](function(_0x43ef32){logger[_0x3d23('0x15')](_0x3d23('0x20'),_0x2a5077);logger[_0x3d23('0xf')](_0x3d23('0x20'),_0x2a5077,JSON['stringify'](_0x43ef32));_0x3fe7e5(_0x43ef32);})[_0x3d23('0x17')](function(_0x4233ff){logger[_0x3d23('0x12')](_0x3d23('0x20'),_0x4233ff[_0x3d23('0x14')],_0x2a5077);_0x2f8ad6(_0x2a2214[_0x3d23('0x12')](0x1f4,_0x4233ff[_0x3d23('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 711e67e..f853647 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 _0x05b9=['connect-timeout','Router','fs-extra','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x503e25,_0xb8a860){var _0x47c27a=function(_0x5e4449){while(--_0x5e4449){_0x503e25['push'](_0x503e25['shift']());}};_0x47c27a(++_0xb8a860);}(_0x05b9,0x9f));var _0x905b=function(_0x20463f,_0x4cc37a){_0x20463f=_0x20463f-0x0;var _0x143ee4=_0x05b9[_0x20463f];return _0x143ee4;};'use strict';var multer=require(_0x905b('0x0'));var util=require(_0x905b('0x1'));var path=require(_0x905b('0x2'));var timeout=require(_0x905b('0x3'));var express=require('express');var router=express[_0x905b('0x4')]();var fs_extra=require(_0x905b('0x5'));var auth=require(_0x905b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x905b('0x7'));router[_0x905b('0x8')]('/',auth[_0x905b('0x9')](),controller[_0x905b('0xa')]);router['get'](_0x905b('0xb'),auth[_0x905b('0x9')](),controller['describe']);router[_0x905b('0x8')]('/:id',auth[_0x905b('0x9')](),controller[_0x905b('0xc')]);router[_0x905b('0xd')]('/',auth[_0x905b('0x9')](),controller[_0x905b('0xe')]);router['put']('/:id',auth[_0x905b('0x9')](),controller[_0x905b('0xf')]);router[_0x905b('0x10')]('/:id',auth[_0x905b('0x9')](),controller[_0x905b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0b29=['/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x0b29,0x19b));var _0x90b2=function(_0x286e14,_0x4ec12e){_0x286e14=_0x286e14-0x0;var _0x51c558=_0x0b29[_0x286e14];return _0x51c558;};'use strict';var multer=require('multer');var util=require(_0x90b2('0x0'));var path=require('path');var timeout=require(_0x90b2('0x1'));var express=require(_0x90b2('0x2'));var router=express[_0x90b2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x90b2('0x4'));var config=require(_0x90b2('0x5'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x90b2('0x6')](),controller['index']);router[_0x90b2('0x7')]('/describe',auth[_0x90b2('0x6')](),controller[_0x90b2('0x8')]);router[_0x90b2('0x7')](_0x90b2('0x9'),auth[_0x90b2('0x6')](),controller[_0x90b2('0xa')]);router['post']('/',auth[_0x90b2('0x6')](),controller[_0x90b2('0xb')]);router[_0x90b2('0xc')](_0x90b2('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x90b2('0xd')]('/:id',auth[_0x90b2('0x6')](),controller[_0x90b2('0xe')]);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 274b6c3..a2afc63 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9bde,0xe1));var _0xe9bd=function(_0x387ff4,_0x3f2ce4){_0x387ff4=_0x387ff4-0x0;var _0x5cf83a=_0x9bde[_0x387ff4];return _0x5cf83a;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x210c3b,_0x48e64f){var _0x544f02=function(_0x2f7394){while(--_0x2f7394){_0x210c3b['push'](_0x210c3b['shift']());}};_0x544f02(++_0x48e64f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'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 34afcf8..4bf3bc6 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 _0x716e=['send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','create','body','params','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name'];(function(_0x336e44,_0x3fb0ef){var _0x44c0db=function(_0x214c14){while(--_0x214c14){_0x336e44['push'](_0x336e44['shift']());}};_0x44c0db(++_0x3fb0ef);}(_0x716e,0x14b));var _0xe716=function(_0x12859f,_0x79de98){_0x12859f=_0x12859f-0x0;var _0x168184=_0x716e[_0x12859f];return _0x168184;};'use strict';var emlformat=require(_0xe716('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe716('0x1'));var jsonpatch=require(_0xe716('0x2'));var rp=require(_0xe716('0x3'));var moment=require(_0xe716('0x4'));var BPromise=require(_0xe716('0x5'));var Mustache=require(_0xe716('0x6'));var util=require(_0xe716('0x7'));var path=require('path');var sox=require(_0xe716('0x8'));var csv=require(_0xe716('0x9'));var ejs=require(_0xe716('0xa'));var fs=require('fs');var fs_extra=require(_0xe716('0xb'));var _=require(_0xe716('0xc'));var squel=require(_0xe716('0xd'));var crypto=require('crypto');var jsforce=require(_0xe716('0xe'));var deskjs=require(_0xe716('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe716('0x10'));var authService=require(_0xe716('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe716('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe716('0x13'));var config=require(_0xe716('0x14'));var licenseUtil=require(_0xe716('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2887d5,_0x291759){_0x291759=_0x291759||0xcc;return function(_0x105c90){if(_0x105c90){return _0x2887d5[_0xe716('0x16')](_0x291759);}return _0x2887d5[_0xe716('0x17')](_0x291759)[_0xe716('0x18')]();};}function respondWithResult(_0x8c7536,_0x1dca4c){_0x1dca4c=_0x1dca4c||0xc8;return function(_0x10e908){if(_0x10e908){return _0x8c7536[_0xe716('0x17')](_0x1dca4c)[_0xe716('0x19')](_0x10e908);}};}function respondWithFilteredResult(_0x546bc9,_0x60d3ab){return function(_0x1630a3){if(_0x1630a3){var _0x2c0f8f=typeof _0x60d3ab['offset']==='undefined'&&typeof _0x60d3ab['limit']===_0xe716('0x1a');var _0x3b619d=_0x1630a3[_0xe716('0x1b')];var _0x12a8d1=_0x2c0f8f?0x0:_0x60d3ab[_0xe716('0x1c')];var _0x48db91=_0x2c0f8f?_0x1630a3[_0xe716('0x1b')]:_0x60d3ab[_0xe716('0x1c')]+_0x60d3ab[_0xe716('0x1d')];var _0x53a52b;if(_0x48db91>=_0x3b619d){_0x48db91=_0x3b619d;_0x53a52b=0xc8;}else{_0x53a52b=0xce;}_0x546bc9[_0xe716('0x17')](_0x53a52b);return _0x546bc9[_0xe716('0x1e')]('Content-Range',_0x12a8d1+'-'+_0x48db91+'/'+_0x3b619d)[_0xe716('0x19')](_0x1630a3);}return null;};}function patchUpdates(_0x296cca){return function(_0x2a15a3){try{jsonpatch['apply'](_0x2a15a3,_0x296cca,!![]);}catch(_0x3d9308){return BPromise[_0xe716('0x1f')](_0x3d9308);}return _0x2a15a3[_0xe716('0x20')]();};}function saveUpdates(_0x17bf7a,_0x1e1a19){return function(_0x4fbadf){if(_0x4fbadf){return _0x4fbadf[_0xe716('0x21')](_0x17bf7a)[_0xe716('0x22')](function(_0x5268cc){return _0x5268cc;});}return null;};}function removeEntity(_0x5c4284,_0x5b92de){return function(_0x1d3f0c){if(_0x1d3f0c){return _0x1d3f0c[_0xe716('0x23')]()[_0xe716('0x22')](function(){_0x5c4284['status'](0xcc)[_0xe716('0x18')]();});}};}function handleEntityNotFound(_0x478489,_0x40b89f){return function(_0x21ffb8){if(!_0x21ffb8){_0x478489[_0xe716('0x16')](0x194);}return _0x21ffb8;};}function handleError(_0x44c7ff,_0x5b405f){_0x5b405f=_0x5b405f||0x1f4;return function(_0x238603){logger[_0xe716('0x24')](_0x238603[_0xe716('0x25')]);if(_0x238603[_0xe716('0x26')]){delete _0x238603[_0xe716('0x26')];}_0x44c7ff[_0xe716('0x17')](_0x5b405f)[_0xe716('0x27')](_0x238603);};}exports[_0xe716('0x28')]=function(_0xe001c8,_0x425e65){var _0x20c613={},_0x430cca={},_0x354235={'count':0x0,'rows':[]};var _0x12335d=_[_0xe716('0x29')](db[_0xe716('0x2a')][_0xe716('0x2b')],function(_0x409de2){return{'name':_0x409de2[_0xe716('0x2c')],'type':_0x409de2['type'][_0xe716('0x2d')]};});_0x430cca[_0xe716('0x2e')]=_[_0xe716('0x29')](_0x12335d,_0xe716('0x26'));_0x430cca['query']=_[_0xe716('0x2f')](_0xe001c8[_0xe716('0x30')]);_0x430cca[_0xe716('0x31')]=_[_0xe716('0x32')](_0x430cca['model'],_0x430cca['query']);_0x20c613[_0xe716('0x33')]=_[_0xe716('0x32')](_0x430cca[_0xe716('0x2e')],qs[_0xe716('0x34')](_0xe001c8[_0xe716('0x30')]['fields']));_0x20c613[_0xe716('0x33')]=_0x20c613[_0xe716('0x33')][_0xe716('0x35')]?_0x20c613[_0xe716('0x33')]:_0x430cca[_0xe716('0x2e')];if(!_0xe001c8[_0xe716('0x30')]['hasOwnProperty'](_0xe716('0x36'))){_0x20c613[_0xe716('0x1d')]=qs[_0xe716('0x1d')](_0xe001c8[_0xe716('0x30')]['limit']);_0x20c613[_0xe716('0x1c')]=qs[_0xe716('0x1c')](_0xe001c8[_0xe716('0x30')][_0xe716('0x1c')]);}_0x20c613[_0xe716('0x37')]=qs['sort'](_0xe001c8[_0xe716('0x30')][_0xe716('0x38')]);_0x20c613[_0xe716('0x39')]=qs[_0xe716('0x31')](_[_0xe716('0x3a')](_0xe001c8['query'],_0x430cca[_0xe716('0x31')]),_0x12335d);if(_0xe001c8[_0xe716('0x30')]['filter']){_0x20c613['where']=_[_0xe716('0x3b')](_0x20c613[_0xe716('0x39')],{'$or':_['map'](_0x12335d,function(_0x4a6079){if(_0x4a6079[_0xe716('0x3c')]!==_0xe716('0x3d')){var _0x41c63a={};_0x41c63a[_0x4a6079[_0xe716('0x26')]]={'$like':'%'+_0xe001c8[_0xe716('0x30')][_0xe716('0x3e')]+'%'};return _0x41c63a;}})});}_0x20c613=_[_0xe716('0x3b')]({},_0x20c613,_0xe001c8[_0xe716('0x3f')]);var _0x2941a0={'where':_0x20c613['where']};return db[_0xe716('0x2a')][_0xe716('0x1b')](_0x2941a0)[_0xe716('0x22')](function(_0x27afc5){_0x354235[_0xe716('0x1b')]=_0x27afc5;if(_0xe001c8[_0xe716('0x30')][_0xe716('0x40')]){_0x20c613[_0xe716('0x41')]=[{'all':!![]}];}return db[_0xe716('0x2a')][_0xe716('0x42')](_0x20c613);})['then'](function(_0x2dfd36){_0x354235[_0xe716('0x43')]=_0x2dfd36;return _0x354235;})[_0xe716('0x22')](respondWithFilteredResult(_0x425e65,_0x20c613))['catch'](handleError(_0x425e65,null));};exports['show']=function(_0x4c5674,_0x2f77e4){var _0xd3c5d5={'raw':!![],'where':{'id':_0x4c5674['params']['id']}},_0x44a70a={};_0x44a70a[_0xe716('0x2e')]=_['keys'](db[_0xe716('0x2a')][_0xe716('0x2b')]);_0x44a70a[_0xe716('0x30')]=_[_0xe716('0x2f')](_0x4c5674[_0xe716('0x30')]);_0x44a70a[_0xe716('0x31')]=_['intersection'](_0x44a70a['model'],_0x44a70a[_0xe716('0x30')]);_0xd3c5d5['attributes']=_[_0xe716('0x32')](_0x44a70a[_0xe716('0x2e')],qs[_0xe716('0x34')](_0x4c5674[_0xe716('0x30')][_0xe716('0x34')]));_0xd3c5d5[_0xe716('0x33')]=_0xd3c5d5[_0xe716('0x33')][_0xe716('0x35')]?_0xd3c5d5[_0xe716('0x33')]:_0x44a70a['model'];if(_0x4c5674[_0xe716('0x30')][_0xe716('0x40')]){_0xd3c5d5['include']=[{'all':!![]}];}_0xd3c5d5=_[_0xe716('0x3b')]({},_0xd3c5d5,_0x4c5674[_0xe716('0x3f')]);return db[_0xe716('0x2a')]['find'](_0xd3c5d5)[_0xe716('0x22')](handleEntityNotFound(_0x2f77e4,null))[_0xe716('0x22')](respondWithResult(_0x2f77e4,null))[_0xe716('0x44')](handleError(_0x2f77e4,null));};exports[_0xe716('0x45')]=function(_0x5d59b9,_0x17e2ea){return db[_0xe716('0x2a')][_0xe716('0x45')](_0x5d59b9['body'],{})[_0xe716('0x22')](respondWithResult(_0x17e2ea,0xc9))[_0xe716('0x44')](handleError(_0x17e2ea,null));};exports['update']=function(_0x27e0e6,_0x31923e){if(_0x27e0e6[_0xe716('0x46')]['id']){delete _0x27e0e6['body']['id'];}return db[_0xe716('0x2a')]['find']({'where':{'id':_0x27e0e6[_0xe716('0x47')]['id']}})['then'](handleEntityNotFound(_0x31923e,null))[_0xe716('0x22')](saveUpdates(_0x27e0e6[_0xe716('0x46')],null))[_0xe716('0x22')](respondWithResult(_0x31923e,null))[_0xe716('0x44')](handleError(_0x31923e,null));};exports[_0xe716('0x23')]=function(_0x3ecd93,_0x1cc8c8){return db[_0xe716('0x2a')][_0xe716('0x48')]({'where':{'id':_0x3ecd93[_0xe716('0x47')]['id']}})['then'](handleEntityNotFound(_0x1cc8c8,null))[_0xe716('0x22')](removeEntity(_0x1cc8c8,null))[_0xe716('0x44')](handleError(_0x1cc8c8,null));};exports[_0xe716('0x49')]=function(_0x5d7e60,_0x4201bc){return db['ChatTransferReport'][_0xe716('0x49')]()[_0xe716('0x22')](respondWithResult(_0x4201bc,null))[_0xe716('0x44')](handleError(_0x4201bc,null));}; \ No newline at end of file +var _0xd287=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','status','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','include','find','catch','create','body','params'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xd287,0xe8));var _0x7d28=function(_0x5bda41,_0x2ae00e){_0x5bda41=_0x5bda41-0x0;var _0x5a85d9=_0xd287[_0x5bda41];return _0x5a85d9;};'use strict';var emlformat=require(_0x7d28('0x0'));var rimraf=require(_0x7d28('0x1'));var zipdir=require(_0x7d28('0x2'));var jsonpatch=require(_0x7d28('0x3'));var rp=require(_0x7d28('0x4'));var moment=require('moment');var BPromise=require(_0x7d28('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d28('0x6'));var sox=require(_0x7d28('0x7'));var csv=require(_0x7d28('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d28('0x9'));var _=require(_0x7d28('0xa'));var squel=require(_0x7d28('0xb'));var crypto=require(_0x7d28('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d28('0xd'));var toCsv=require(_0x7d28('0x8'));var querystring=require(_0x7d28('0xe'));var Papa=require(_0x7d28('0xf'));var Redis=require('ioredis');var authService=require(_0x7d28('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7d28('0x11'));var hardwareService=require(_0x7d28('0x12'));var logger=require(_0x7d28('0x13'))(_0x7d28('0x14'));var utils=require(_0x7d28('0x15'));var config=require(_0x7d28('0x16'));var licenseUtil=require(_0x7d28('0x17'));var db=require(_0x7d28('0x18'))['db'];function respondWithStatusCode(_0x581ddd,_0x459459){_0x459459=_0x459459||0xcc;return function(_0x56df4d){if(_0x56df4d){return _0x581ddd[_0x7d28('0x19')](_0x459459);}return _0x581ddd['status'](_0x459459)[_0x7d28('0x1a')]();};}function respondWithResult(_0x24d43a,_0x4016f9){_0x4016f9=_0x4016f9||0xc8;return function(_0x52ed89){if(_0x52ed89){return _0x24d43a['status'](_0x4016f9)[_0x7d28('0x1b')](_0x52ed89);}};}function respondWithFilteredResult(_0x11f8b4,_0x4d7cb7){return function(_0x2cb022){if(_0x2cb022){var _0x44d3a6=typeof _0x4d7cb7[_0x7d28('0x1c')]==='undefined'&&typeof _0x4d7cb7['limit']==='undefined';var _0x36b124=_0x2cb022[_0x7d28('0x1d')];var _0x157a20=_0x44d3a6?0x0:_0x4d7cb7[_0x7d28('0x1c')];var _0x2e4eae=_0x44d3a6?_0x2cb022[_0x7d28('0x1d')]:_0x4d7cb7[_0x7d28('0x1c')]+_0x4d7cb7[_0x7d28('0x1e')];var _0x45d27b;if(_0x2e4eae>=_0x36b124){_0x2e4eae=_0x36b124;_0x45d27b=0xc8;}else{_0x45d27b=0xce;}_0x11f8b4['status'](_0x45d27b);return _0x11f8b4[_0x7d28('0x1f')](_0x7d28('0x20'),_0x157a20+'-'+_0x2e4eae+'/'+_0x36b124)[_0x7d28('0x1b')](_0x2cb022);}return null;};}function patchUpdates(_0x20d8b7){return function(_0x539424){try{jsonpatch[_0x7d28('0x21')](_0x539424,_0x20d8b7,!![]);}catch(_0xef284a){return BPromise[_0x7d28('0x22')](_0xef284a);}return _0x539424['save']();};}function saveUpdates(_0x15250e,_0x13d388){return function(_0x26d0a0){if(_0x26d0a0){return _0x26d0a0[_0x7d28('0x23')](_0x15250e)[_0x7d28('0x24')](function(_0x47da39){return _0x47da39;});}return null;};}function removeEntity(_0x3f4184,_0x13c060){return function(_0x4007d2){if(_0x4007d2){return _0x4007d2[_0x7d28('0x25')]()[_0x7d28('0x24')](function(){_0x3f4184[_0x7d28('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7a76,_0x29e0ed){return function(_0x45026b){if(!_0x45026b){_0x1f7a76[_0x7d28('0x19')](0x194);}return _0x45026b;};}function handleError(_0x4b1445,_0x3bdb9d){_0x3bdb9d=_0x3bdb9d||0x1f4;return function(_0x24d04e){logger[_0x7d28('0x27')](_0x24d04e[_0x7d28('0x28')]);if(_0x24d04e[_0x7d28('0x29')]){delete _0x24d04e[_0x7d28('0x29')];}_0x4b1445[_0x7d28('0x26')](_0x3bdb9d)[_0x7d28('0x2a')](_0x24d04e);};}exports[_0x7d28('0x2b')]=function(_0x5d3b5b,_0x4d18a6){var _0x5e352c={},_0x3a519f={},_0x240fc5={'count':0x0,'rows':[]};var _0x32525e=_[_0x7d28('0x2c')](db[_0x7d28('0x2d')][_0x7d28('0x2e')],function(_0x223b3c){return{'name':_0x223b3c[_0x7d28('0x2f')],'type':_0x223b3c[_0x7d28('0x30')][_0x7d28('0x31')]};});_0x3a519f[_0x7d28('0x32')]=_[_0x7d28('0x2c')](_0x32525e,'name');_0x3a519f[_0x7d28('0x33')]=_[_0x7d28('0x34')](_0x5d3b5b[_0x7d28('0x33')]);_0x3a519f[_0x7d28('0x35')]=_[_0x7d28('0x36')](_0x3a519f[_0x7d28('0x32')],_0x3a519f['query']);_0x5e352c[_0x7d28('0x37')]=_[_0x7d28('0x36')](_0x3a519f[_0x7d28('0x32')],qs[_0x7d28('0x38')](_0x5d3b5b[_0x7d28('0x33')][_0x7d28('0x38')]));_0x5e352c['attributes']=_0x5e352c[_0x7d28('0x37')][_0x7d28('0x39')]?_0x5e352c['attributes']:_0x3a519f[_0x7d28('0x32')];if(!_0x5d3b5b[_0x7d28('0x33')][_0x7d28('0x3a')](_0x7d28('0x3b'))){_0x5e352c[_0x7d28('0x1e')]=qs[_0x7d28('0x1e')](_0x5d3b5b['query'][_0x7d28('0x1e')]);_0x5e352c[_0x7d28('0x1c')]=qs[_0x7d28('0x1c')](_0x5d3b5b[_0x7d28('0x33')][_0x7d28('0x1c')]);}_0x5e352c[_0x7d28('0x3c')]=qs[_0x7d28('0x3d')](_0x5d3b5b['query'][_0x7d28('0x3d')]);_0x5e352c[_0x7d28('0x3e')]=qs['filters'](_[_0x7d28('0x3f')](_0x5d3b5b[_0x7d28('0x33')],_0x3a519f[_0x7d28('0x35')]),_0x32525e);if(_0x5d3b5b[_0x7d28('0x33')]['filter']){_0x5e352c['where']=_[_0x7d28('0x40')](_0x5e352c[_0x7d28('0x3e')],{'$or':_[_0x7d28('0x2c')](_0x32525e,function(_0x41b272){if(_0x41b272['type']!==_0x7d28('0x41')){var _0x26055b={};_0x26055b[_0x41b272['name']]={'$like':'%'+_0x5d3b5b[_0x7d28('0x33')]['filter']+'%'};return _0x26055b;}})});}_0x5e352c=_[_0x7d28('0x40')]({},_0x5e352c,_0x5d3b5b[_0x7d28('0x42')]);var _0x202080={'where':_0x5e352c[_0x7d28('0x3e')]};return db[_0x7d28('0x2d')][_0x7d28('0x1d')](_0x202080)[_0x7d28('0x24')](function(_0x173346){_0x240fc5[_0x7d28('0x1d')]=_0x173346;if(_0x5d3b5b['query'][_0x7d28('0x43')]){_0x5e352c['include']=[{'all':!![]}];}return db[_0x7d28('0x2d')][_0x7d28('0x44')](_0x5e352c);})[_0x7d28('0x24')](function(_0xaff340){_0x240fc5[_0x7d28('0x45')]=_0xaff340;return _0x240fc5;})[_0x7d28('0x24')](respondWithFilteredResult(_0x4d18a6,_0x5e352c))['catch'](handleError(_0x4d18a6,null));};exports['show']=function(_0x30b602,_0x5e08bf){var _0x5229b5={'raw':!![],'where':{'id':_0x30b602['params']['id']}},_0x44c46a={};_0x44c46a[_0x7d28('0x32')]=_['keys'](db[_0x7d28('0x2d')]['rawAttributes']);_0x44c46a[_0x7d28('0x33')]=_[_0x7d28('0x34')](_0x30b602[_0x7d28('0x33')]);_0x44c46a[_0x7d28('0x35')]=_[_0x7d28('0x36')](_0x44c46a[_0x7d28('0x32')],_0x44c46a[_0x7d28('0x33')]);_0x5229b5['attributes']=_[_0x7d28('0x36')](_0x44c46a['model'],qs[_0x7d28('0x38')](_0x30b602['query']['fields']));_0x5229b5['attributes']=_0x5229b5[_0x7d28('0x37')][_0x7d28('0x39')]?_0x5229b5[_0x7d28('0x37')]:_0x44c46a['model'];if(_0x30b602['query'][_0x7d28('0x43')]){_0x5229b5[_0x7d28('0x46')]=[{'all':!![]}];}_0x5229b5=_[_0x7d28('0x40')]({},_0x5229b5,_0x30b602['options']);return db[_0x7d28('0x2d')][_0x7d28('0x47')](_0x5229b5)['then'](handleEntityNotFound(_0x5e08bf,null))[_0x7d28('0x24')](respondWithResult(_0x5e08bf,null))[_0x7d28('0x48')](handleError(_0x5e08bf,null));};exports[_0x7d28('0x49')]=function(_0x2c1073,_0xc4c056){return db['ChatTransferReport']['create'](_0x2c1073[_0x7d28('0x4a')],{})[_0x7d28('0x24')](respondWithResult(_0xc4c056,0xc9))[_0x7d28('0x48')](handleError(_0xc4c056,null));};exports['update']=function(_0x12d127,_0x21faaf){if(_0x12d127[_0x7d28('0x4a')]['id']){delete _0x12d127[_0x7d28('0x4a')]['id'];}return db[_0x7d28('0x2d')][_0x7d28('0x47')]({'where':{'id':_0x12d127[_0x7d28('0x4b')]['id']}})[_0x7d28('0x24')](handleEntityNotFound(_0x21faaf,null))[_0x7d28('0x24')](saveUpdates(_0x12d127[_0x7d28('0x4a')],null))[_0x7d28('0x24')](respondWithResult(_0x21faaf,null))['catch'](handleError(_0x21faaf,null));};exports[_0x7d28('0x25')]=function(_0x4e4780,_0x1c569f){return db[_0x7d28('0x2d')]['find']({'where':{'id':_0x4e4780[_0x7d28('0x4b')]['id']}})[_0x7d28('0x24')](handleEntityNotFound(_0x1c569f,null))['then'](removeEntity(_0x1c569f,null))[_0x7d28('0x48')](handleError(_0x1c569f,null));};exports[_0x7d28('0x4c')]=function(_0x31a20f,_0x1bb91d){return db[_0x7d28('0x2d')][_0x7d28('0x4c')]()[_0x7d28('0x24')](respondWithResult(_0x1bb91d,null))[_0x7d28('0x48')](handleError(_0x1bb91d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 648594e..91eee6d 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 _0x4817=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger'];(function(_0x28dcef,_0x3664be){var _0x56c687=function(_0x2a98f5){while(--_0x2a98f5){_0x28dcef['push'](_0x28dcef['shift']());}};_0x56c687(++_0x3664be);}(_0x4817,0x136));var _0x7481=function(_0x128f3b,_0x582556){_0x128f3b=_0x128f3b-0x0;var _0x25ed6a=_0x4817[_0x128f3b];return _0x25ed6a;};'use strict';var _=require('lodash');var util=require(_0x7481('0x0'));var logger=require(_0x7481('0x1'))(_0x7481('0x2'));var moment=require(_0x7481('0x3'));var BPromise=require(_0x7481('0x4'));var rp=require(_0x7481('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7481('0x6'));var config=require(_0x7481('0x7'));var attributes=require(_0x7481('0x8'));module[_0x7481('0x9')]=function(_0x41c951,_0x4fec93){return _0x41c951['define'](_0x7481('0xa'),attributes,{'tableName':_0x7481('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7481('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed9f=['./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','path','rimraf','../../config/environment'];(function(_0x297b4e,_0x139e0f){var _0x37882a=function(_0x25f7f4){while(--_0x25f7f4){_0x297b4e['push'](_0x297b4e['shift']());}};_0x37882a(++_0x139e0f);}(_0xed9f,0x118));var _0xfed9=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0xed9f[_0x5f0501];return _0x3c2c45;};'use strict';var _=require(_0xfed9('0x0'));var util=require(_0xfed9('0x1'));var logger=require(_0xfed9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfed9('0x3'));var rimraf=require(_0xfed9('0x4'));var config=require(_0xfed9('0x5'));var attributes=require(_0xfed9('0x6'));module[_0xfed9('0x7')]=function(_0x32376a,_0x1249d9){return _0x32376a[_0xfed9('0x8')](_0xfed9('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfed9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 62ed873..d7d468c 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 _0x4ec8=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x4ec8,0x119));var _0x84ec=function(_0x3c1f22,_0x479ed1){_0x3c1f22=_0x3c1f22-0x0;var _0x22f5f2=_0x4ec8[_0x3c1f22];return _0x22f5f2;};'use strict';var _=require('lodash');var util=require(_0x84ec('0x0'));var moment=require(_0x84ec('0x1'));var BPromise=require(_0x84ec('0x2'));var rs=require(_0x84ec('0x3'));var fs=require('fs');var Redis=require(_0x84ec('0x4'));var db=require(_0x84ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x84ec('0x6'))(_0x84ec('0x7'));var config=require(_0x84ec('0x8'));var jayson=require(_0x84ec('0x9'));var client=jayson[_0x84ec('0xa')][_0x84ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c944,_0x5d65b8,_0x2a3fa6){return new BPromise(function(_0x36818e,_0x449c78){return client[_0x84ec('0xc')](_0x29c944,_0x2a3fa6)[_0x84ec('0xd')](function(_0x133e11){logger[_0x84ec('0xe')](_0x84ec('0xf'),_0x5d65b8,_0x84ec('0x10'));logger[_0x84ec('0x11')](_0x84ec('0x12'),_0x5d65b8,'request\x20sent',JSON[_0x84ec('0x13')](_0x133e11));if(_0x133e11[_0x84ec('0x14')]){if(_0x133e11[_0x84ec('0x14')][_0x84ec('0x15')]===0x1f4){logger['error'](_0x84ec('0xf'),_0x5d65b8,_0x133e11[_0x84ec('0x14')]['message']);return _0x449c78(_0x133e11[_0x84ec('0x14')][_0x84ec('0x16')]);}logger[_0x84ec('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x5d65b8,_0x133e11['error'][_0x84ec('0x16')]);return _0x36818e(_0x133e11['error']['message']);}else{logger[_0x84ec('0xe')](_0x84ec('0xf'),_0x5d65b8,_0x84ec('0x10'));_0x36818e(_0x133e11[_0x84ec('0x17')]['message']);}})[_0x84ec('0x18')](function(_0x463810){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5d65b8,_0x463810);_0x449c78(_0x463810);});});} \ No newline at end of file +var _0x1582=['request','ChatTransferReport,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch','util','bluebird','ioredis','../../config/logger','jayson/promise','client','http'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x1582,0x12b));var _0x2158=function(_0x4b33d1,_0x2414e1){_0x4b33d1=_0x4b33d1-0x0;var _0x9e7221=_0x1582[_0x4b33d1];return _0x9e7221;};'use strict';var _=require('lodash');var util=require(_0x2158('0x0'));var moment=require('moment');var BPromise=require(_0x2158('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2158('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2158('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2158('0x4'));var client=jayson[_0x2158('0x5')][_0x2158('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x187e59,_0x755b30,_0x5da59f){return new BPromise(function(_0x437461,_0x15fc6b){return client[_0x2158('0x7')](_0x187e59,_0x5da59f)['then'](function(_0x212f6f){logger['info'](_0x2158('0x8'),_0x755b30,'request\x20sent');logger[_0x2158('0x9')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x755b30,'request\x20sent',JSON[_0x2158('0xa')](_0x212f6f));if(_0x212f6f[_0x2158('0xb')]){if(_0x212f6f[_0x2158('0xb')]['code']===0x1f4){logger[_0x2158('0xb')](_0x2158('0x8'),_0x755b30,_0x212f6f['error']['message']);return _0x15fc6b(_0x212f6f[_0x2158('0xb')][_0x2158('0xc')]);}logger[_0x2158('0xb')](_0x2158('0x8'),_0x755b30,_0x212f6f[_0x2158('0xb')][_0x2158('0xc')]);return _0x437461(_0x212f6f['error']['message']);}else{logger[_0x2158('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x755b30,_0x2158('0xe'));_0x437461(_0x212f6f[_0x2158('0xf')][_0x2158('0xc')]);}})[_0x2158('0x10')](function(_0x4eb27d){logger['error'](_0x2158('0x8'),_0x755b30,_0x4eb27d);_0x15fc6b(_0x4eb27d);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c953e4b..abf078d 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 _0x98b7=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','update','delete','/:id','destroy','exports'];(function(_0xe7fc2d,_0x9e4b85){var _0x150c7a=function(_0x3ea47e){while(--_0x3ea47e){_0xe7fc2d['push'](_0xe7fc2d['shift']());}};_0x150c7a(++_0x9e4b85);}(_0x98b7,0x1a4));var _0x798b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x98b7[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var path=require(_0x798b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x798b('0x3')]();var fs_extra=require(_0x798b('0x4'));var auth=require(_0x798b('0x5'));var interaction=require(_0x798b('0x6'));var config=require(_0x798b('0x7'));var controller=require(_0x798b('0x8'));router[_0x798b('0x9')]('/',auth[_0x798b('0xa')](),controller[_0x798b('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x798b('0xc')]);router[_0x798b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x798b('0xd')]);router[_0x798b('0xe')]('/',auth['isAuthenticated'](),controller[_0x798b('0xf')]);router['put']('/:id',auth[_0x798b('0xa')](),controller[_0x798b('0x10')]);router[_0x798b('0x11')](_0x798b('0x12'),auth[_0x798b('0xa')](),controller[_0x798b('0x13')]);module[_0x798b('0x14')]=router; \ No newline at end of file +var _0x8aff=['get','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x8aff,0x11c));var _0xf8af=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8aff[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xf8af('0x0'));var util=require(_0xf8af('0x1'));var path=require(_0xf8af('0x2'));var timeout=require(_0xf8af('0x3'));var express=require(_0xf8af('0x4'));var router=express['Router']();var fs_extra=require(_0xf8af('0x5'));var auth=require(_0xf8af('0x6'));var interaction=require(_0xf8af('0x7'));var config=require(_0xf8af('0x8'));var controller=require(_0xf8af('0x9'));router[_0xf8af('0xa')]('/',auth['isAuthenticated'](),controller[_0xf8af('0xb')]);router[_0xf8af('0xa')](_0xf8af('0xc'),auth['isAuthenticated'](),controller[_0xf8af('0xd')]);router[_0xf8af('0xa')](_0xf8af('0xe'),auth['isAuthenticated'](),controller[_0xf8af('0xf')]);router[_0xf8af('0x10')]('/',auth['isAuthenticated'](),controller[_0xf8af('0x11')]);router[_0xf8af('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf8af('0x13')](_0xf8af('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xf8af('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 19222a8..52ed1ab 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 _0x6545=['Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','stringify','input','name','text','onlineForm','parse','setDataValue','textarea','Comments','getDataValue','offlineForm','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','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','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x6545,0x17e));var _0x5654=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6545[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x5654('0x0')],'allowNull':![]},'address':{'type':Sequelize[_0x5654('0x0')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x5654('0x1')},'mapKeyOffline':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x1')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5654('0x0')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x5654('0x0')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5654('0x0')],'allowNull':![],'defaultValue':_0x5654('0x2'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5654('0x0')],'allowNull':![],'defaultValue':_0x5654('0x2'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5654('0x0')],'allowNull':![],'defaultValue':_0x5654('0x3'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5654('0x4')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5654('0x0')]},'animation':{'type':Sequelize[_0x5654('0x5')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5654('0x6')](_0x5654('0x7'),_0x5654('0x8')),'defaultValue':_0x5654('0x7')},'header_online':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x9')},'start_chat_button':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0xa')},'offline_chat_button':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0xb')},'header_offline':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5654('0x0')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5654('0xd')]},'closingQuestion':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x10')},'noteTitle':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x11')},'placeholderMessage':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x12')},'closingMessage':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x13')},'closingMessageButton':{'type':Sequelize[_0x5654('0x0')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x5654('0x0')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM']('star','thumb'),'defaultValue':_0x5654('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x5654('0x4')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5654('0x15')]({'items':[{'type':_0x5654('0x16'),'variable':null,'config':{'placeholder':_0x5654('0x17'),'type':_0x5654('0x18'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5654('0x16'),'props':{'title':_0x5654('0x1'),'helpText':''},'config':{'required':!![],'placeholder':_0x5654('0x1'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x5654('0x19'))?JSON[_0x5654('0x1a')](this['getDataValue']('onlineForm')):{};},'set':function(_0x5740a0){return this[_0x5654('0x1b')](_0x5654('0x19'),JSON[_0x5654('0x15')](_0x5740a0));}},'offlineForm':{'type':Sequelize[_0x5654('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x5654('0x1'),'helpText':''},'config':{'required':!![],'placeholder':_0x5654('0x1'),'type':_0x5654('0x1')},'variable':null},{'type':_0x5654('0x1c'),'config':{'placeholder':_0x5654('0x1d')},'props':{'title':_0x5654('0x1d'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5654('0x1e')](_0x5654('0x1f'))?JSON['parse'](this[_0x5654('0x1e')](_0x5654('0x1f'))):{};},'set':function(_0x2ecd79){return this[_0x5654('0x1b')](_0x5654('0x1f'),JSON[_0x5654('0x15')](_0x2ecd79));}},'token':{'type':Sequelize[_0x5654('0x0')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x5654('0x5')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x5654('0x0')]},'forwardOffline':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5654('0x0')]},'waitingTitle':{'type':Sequelize[_0x5654('0x0')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x5654('0x0')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x20')},'offlineMessageBody':{'type':Sequelize[_0x5654('0x0')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x5654('0x5')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x21')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x5654('0x22')},'sendUnmanaged':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5654('0x0')]},'notificationTemplate':{'type':Sequelize[_0x5654('0xd')],'defaultValue':function(){return _0x5654('0x23');}},'notificationSound':{'type':Sequelize[_0x5654('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x24')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5654('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x25')},'verticalAlignment':{'type':Sequelize[_0x5654('0x4')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x26')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x5654('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5654('0x4')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5654('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5654('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5654('0x0')],'defaultValue':_0x5654('0x28')},'systemAvatar':{'type':Sequelize[_0x5654('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5654('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x22b267){if(!_0x22b267)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x5654('0x1b')](_0x5654('0x2a'),_0x22b267);}},'vidaooEscalation':{'type':Sequelize[_0x5654('0x5')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5654('0x0')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x5654('0x0')],'defaultValue':function(){return _0x5654('0x2b');}},'vidaooMetadata':{'type':Sequelize[_0x5654('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5654('0xd')]}}; \ No newline at end of file +var _0xa6c6=['BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','star','stringify','input','name','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','randomstring','exports','address','STRING','email','Agent','#011F6A','INTEGER'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa6c6,0x87));var _0x6a6c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa6c6[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x6a6c('0x0'));var rs=require(_0x6a6c('0x1'));module[_0x6a6c('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6a6c('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x5')},'mapKeyOffline':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x5')},'key':{'type':Sequelize[_0x6a6c('0x4')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6a6c('0x4')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6a6c('0x4')],'allowNull':![],'defaultValue':_0x6a6c('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6a6c('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6a6c('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6a6c('0xa')](_0x6a6c('0xb'),'squared'),'defaultValue':_0x6a6c('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6a6c('0xc')},'start_chat_button':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x6a6c('0xe')},'header_offline':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6a6c('0x10')]},'closingQuestion':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6a6c('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x13')},'noteTitle':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x14')},'placeholderMessage':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6a6c('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x6a6c('0x17'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x6a6c('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6a6c('0x10')],'defaultValue':function(){return JSON[_0x6a6c('0x18')]({'items':[{'type':_0x6a6c('0x19'),'variable':null,'config':{'placeholder':_0x6a6c('0x1a'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6a6c('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6a6c('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6a6c('0x1b')]('onlineForm')?JSON[_0x6a6c('0x1c')](this['getDataValue'](_0x6a6c('0x1d'))):{};},'set':function(_0x4f861e){return this[_0x6a6c('0x1e')]('onlineForm',JSON[_0x6a6c('0x18')](_0x4f861e));}},'offlineForm':{'type':Sequelize[_0x6a6c('0x10')],'defaultValue':function(){return JSON[_0x6a6c('0x18')]({'items':[{'type':_0x6a6c('0x19'),'props':{'title':_0x6a6c('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6a6c('0x5'),'type':'email'},'variable':null},{'type':_0x6a6c('0x1f'),'config':{'placeholder':_0x6a6c('0x20')},'props':{'title':_0x6a6c('0x20'),'helpText':_0x6a6c('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x6a6c('0x1b')](_0x6a6c('0x22'))?JSON[_0x6a6c('0x1c')](this[_0x6a6c('0x1b')]('offlineForm')):{};},'set':function(_0xab2f6e){return this[_0x6a6c('0x1e')](_0x6a6c('0x22'),JSON[_0x6a6c('0x18')](_0xab2f6e));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6a6c('0x23')]();}},'autoclose':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6a6c('0x4')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6a6c('0x4')]},'waitingTitle':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x24')},'waitingMessage':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6a6c('0x27')},'skipUnmanaged':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x28')},'sendUnmanaged':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6a6c('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6a6c('0x4')]},'notificationTemplate':{'type':Sequelize[_0x6a6c('0x10')],'defaultValue':function(){return _0x6a6c('0x29');}},'notificationSound':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x6a6c('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x2b')},'defaultTitle':{'type':Sequelize[_0x6a6c('0x4')]},'customerAvatar':{'type':Sequelize[_0x6a6c('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6a6c('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6a6c('0x4')],'allowNull':![],'defaultValue':_0x6a6c('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6a6c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':_0x6a6c('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6a6c('0x8')],'comment':_0x6a6c('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x7437aa){if(!_0x7437aa)this[_0x6a6c('0x1e')]('mandatoryDispositionPauseId',null);this[_0x6a6c('0x1e')](_0x6a6c('0x2f'),_0x7437aa);}},'vidaooEscalation':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6a6c('0x4')]},'vidaooTopic':{'type':Sequelize[_0x6a6c('0x4')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x6a6c('0x4')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x6a6c('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6a6c('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6a6c('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 47837c5..76878b4 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 _0xa4a6=['List','account','list','applications','orderBy','asc','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','ChatMessage','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','difference','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','all','remote','remoteAddress','replace','alignment','verticalAlignment','color','color_button','addApplications','findAndCountAll','priority','getApplications','chatProactiveAction','getProactiveActions','getFields','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','get','ChatWebsites','destroy','stack','name','send','index','ChatWebsite','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','VIRTUAL','filter','options','findAll','rows','catch','show','params','Pause','mandatoryDispositionPause','include','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','nolimit','includeAll','CannedAnswer','removeAnswers','ids','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','CmContact','Contacts','ChatApplication','Applications'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0xa4a6,0x8b));var _0x6a4a=function(_0x10e896,_0x4136d9){_0x10e896=_0x10e896-0x0;var _0x33cda4=_0xa4a6[_0x10e896];return _0x33cda4;};'use strict';var emlformat=require(_0x6a4a('0x0'));var rimraf=require(_0x6a4a('0x1'));var zipdir=require(_0x6a4a('0x2'));var jsonpatch=require(_0x6a4a('0x3'));var rp=require('request-promise');var moment=require(_0x6a4a('0x4'));var BPromise=require(_0x6a4a('0x5'));var Mustache=require(_0x6a4a('0x6'));var util=require(_0x6a4a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6a4a('0x8'));var ejs=require(_0x6a4a('0x9'));var fs=require('fs');var fs_extra=require(_0x6a4a('0xa'));var _=require(_0x6a4a('0xb'));var squel=require(_0x6a4a('0xc'));var crypto=require(_0x6a4a('0xd'));var jsforce=require(_0x6a4a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6a4a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a4a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6a4a('0x10'));var hardwareService=require(_0x6a4a('0x11'));var logger=require(_0x6a4a('0x12'))(_0x6a4a('0x13'));var utils=require(_0x6a4a('0x14'));var config=require(_0x6a4a('0x15'));var licenseUtil=require(_0x6a4a('0x16'));var db=require(_0x6a4a('0x17'))['db'];config[_0x6a4a('0x18')]=_['defaults'](config['redis'],{'host':_0x6a4a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0x6a4a('0x1a'));var client=jayson[_0x6a4a('0x1b')][_0x6a4a('0x1c')]({'port':0x232c});var client9002=jayson[_0x6a4a('0x1b')][_0x6a4a('0x1c')]({'port':0x232a});var client9003=jayson['client'][_0x6a4a('0x1c')]({'port':0x232b});var client9001=jayson[_0x6a4a('0x1b')][_0x6a4a('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x1ce87a,_0x48959b,_0x32d151,_0x14a1d3){return new BPromise(function(_0x97b251,_0x3b6002){var _0x5a68ea=_0x14a1d3||client;return _0x5a68ea['request'](_0x1ce87a,_0x32d151)[_0x6a4a('0x1d')](function(_0x314b39){logger[_0x6a4a('0x1e')](_0x6a4a('0x1f'),_0x48959b,_0x6a4a('0x20'));logger[_0x6a4a('0x21')](_0x6a4a('0x22'),_0x48959b,_0x6a4a('0x20'),JSON[_0x6a4a('0x23')](_0x314b39));if(_0x314b39[_0x6a4a('0x24')]){if(_0x314b39[_0x6a4a('0x24')][_0x6a4a('0x25')]===0x1f4){logger[_0x6a4a('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x48959b,_0x314b39['error'][_0x6a4a('0x26')]);return _0x3b6002(_0x314b39[_0x6a4a('0x24')][_0x6a4a('0x26')]);}logger[_0x6a4a('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x48959b,_0x314b39[_0x6a4a('0x24')][_0x6a4a('0x26')]);return _0x97b251(_0x314b39[_0x6a4a('0x24')][_0x6a4a('0x26')]);}else{logger[_0x6a4a('0x1e')](_0x6a4a('0x1f'),_0x48959b,'request\x20sent');_0x97b251(_0x314b39['result'][_0x6a4a('0x26')]);}})['catch'](function(_0x8b5542){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x48959b,_0x8b5542);_0x3b6002(_0x8b5542);});});}function respondWithStatusCode(_0x4d43eb,_0x42b678){_0x42b678=_0x42b678||0xcc;return function(_0x1cf262){if(_0x1cf262){return _0x4d43eb[_0x6a4a('0x27')](_0x42b678);}return _0x4d43eb[_0x6a4a('0x28')](_0x42b678)[_0x6a4a('0x29')]();};}function respondWithResult(_0x1701ac,_0x1139ab){_0x1139ab=_0x1139ab||0xc8;return function(_0x1098ea){if(_0x1098ea){return _0x1701ac['status'](_0x1139ab)[_0x6a4a('0x2a')](_0x1098ea);}};}function respondWithFilteredResult(_0x5274f1,_0x2ccfa6){return function(_0x289aa7){if(_0x289aa7){var _0x214241=typeof _0x2ccfa6['offset']===_0x6a4a('0x2b')&&typeof _0x2ccfa6[_0x6a4a('0x2c')]===_0x6a4a('0x2b');var _0x17bb1b=_0x289aa7[_0x6a4a('0x2d')];var _0x17b988=_0x214241?0x0:_0x2ccfa6['offset'];var _0x424c88=_0x214241?_0x289aa7['count']:_0x2ccfa6[_0x6a4a('0x2e')]+_0x2ccfa6[_0x6a4a('0x2c')];var _0x51f095;if(_0x424c88>=_0x17bb1b){_0x424c88=_0x17bb1b;_0x51f095=0xc8;}else{_0x51f095=0xce;}_0x5274f1['status'](_0x51f095);return _0x5274f1[_0x6a4a('0x2f')](_0x6a4a('0x30'),_0x17b988+'-'+_0x424c88+'/'+_0x17bb1b)[_0x6a4a('0x2a')](_0x289aa7);}return null;};}function patchUpdates(_0x15e7f9){return function(_0x3c3cc4){try{jsonpatch[_0x6a4a('0x31')](_0x3c3cc4,_0x15e7f9,!![]);}catch(_0x52ca3f){return BPromise['reject'](_0x52ca3f);}return _0x3c3cc4[_0x6a4a('0x32')]();};}function saveUpdates(_0x1d0352,_0x5ec1e8){return function(_0x5f4dea){if(_0x5f4dea){return _0x5f4dea['update'](_0x1d0352)['then'](function(_0x12a028){return _0x12a028;});}return null;};}function removeEntity(_0x4b6562,_0x533760){return function(_0x126d49){if(_0x126d49){return _0x126d49['destroy']()[_0x6a4a('0x1d')](function(){var _0x300500=_0x126d49[_0x6a4a('0x33')]({'plain':!![]});var _0x47b3fc=_0x6a4a('0x34');return db['UserProfileResource'][_0x6a4a('0x35')]({'where':{'type':_0x47b3fc,'resourceId':_0x300500['id']}})['then'](function(){return _0x126d49;});})['then'](function(){_0x4b6562[_0x6a4a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x199d6c,_0x24a9c1){return function(_0x597297){if(!_0x597297){_0x199d6c[_0x6a4a('0x27')](0x194);}return _0x597297;};}function handleError(_0x2fb28,_0xfb007c){_0xfb007c=_0xfb007c||0x1f4;return function(_0x520e6e){logger[_0x6a4a('0x24')](_0x520e6e[_0x6a4a('0x36')]);if(_0x520e6e[_0x6a4a('0x37')]){delete _0x520e6e[_0x6a4a('0x37')];}_0x2fb28[_0x6a4a('0x28')](_0xfb007c)[_0x6a4a('0x38')](_0x520e6e);};}exports[_0x6a4a('0x39')]=function(_0xa6abf8,_0x54ea7d){var _0x5705b={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x10e5ba={},_0x402135={'count':0x0,'rows':[]};var _0x2fd0a5=_['map'](db[_0x6a4a('0x3a')][_0x6a4a('0x3b')],function(_0x4143ae){return{'name':_0x4143ae['fieldName'],'type':_0x4143ae[_0x6a4a('0x3c')][_0x6a4a('0x3d')]};});_0x10e5ba[_0x6a4a('0x3e')]=_['map'](_0x2fd0a5,_0x6a4a('0x37'));_0x10e5ba[_0x6a4a('0x3f')]=_[_0x6a4a('0x40')](_0xa6abf8['query']);_0x10e5ba[_0x6a4a('0x41')]=_[_0x6a4a('0x42')](_0x10e5ba[_0x6a4a('0x3e')],_0x10e5ba[_0x6a4a('0x3f')]);_0x5705b[_0x6a4a('0x43')]=_[_0x6a4a('0x42')](_0x10e5ba['model'],qs[_0x6a4a('0x44')](_0xa6abf8[_0x6a4a('0x3f')][_0x6a4a('0x44')]));_0x5705b[_0x6a4a('0x43')]=_0x5705b['attributes'][_0x6a4a('0x45')]?_0x5705b[_0x6a4a('0x43')]:_0x10e5ba[_0x6a4a('0x3e')];if(!_0xa6abf8['query'][_0x6a4a('0x46')]('nolimit')){_0x5705b[_0x6a4a('0x2c')]=qs[_0x6a4a('0x2c')](_0xa6abf8[_0x6a4a('0x3f')][_0x6a4a('0x2c')]);_0x5705b[_0x6a4a('0x2e')]=qs[_0x6a4a('0x2e')](_0xa6abf8[_0x6a4a('0x3f')][_0x6a4a('0x2e')]);}_0x5705b[_0x6a4a('0x47')]=qs['sort'](_0xa6abf8[_0x6a4a('0x3f')][_0x6a4a('0x48')]);_0x5705b[_0x6a4a('0x49')]=qs[_0x6a4a('0x41')](_[_0x6a4a('0x4a')](_0xa6abf8['query'],_0x10e5ba[_0x6a4a('0x41')]),_0x2fd0a5);if(_0xa6abf8[_0x6a4a('0x3f')]['filter']){_0x5705b[_0x6a4a('0x49')]=_['merge'](_0x5705b[_0x6a4a('0x49')],{'$or':_[_0x6a4a('0x4b')](_0x2fd0a5,function(_0x5b7fc3){if(_0x5b7fc3[_0x6a4a('0x3c')]!==_0x6a4a('0x4c')){var _0x20b5ec={};_0x20b5ec[_0x5b7fc3[_0x6a4a('0x37')]]={'$like':'%'+_0xa6abf8['query'][_0x6a4a('0x4d')]+'%'};return _0x20b5ec;}})});}_0x5705b=_['merge']({},_0x5705b,_0xa6abf8[_0x6a4a('0x4e')]);var _0x773e57={'where':_0x5705b['where']};return db[_0x6a4a('0x3a')][_0x6a4a('0x2d')](_0x773e57)[_0x6a4a('0x1d')](function(_0x2fad92){_0x402135['count']=_0x2fad92;if(_0xa6abf8[_0x6a4a('0x3f')]['includeAll']){_0x5705b['include']=[{'all':!![]}];}return db[_0x6a4a('0x3a')][_0x6a4a('0x4f')](_0x5705b);})[_0x6a4a('0x1d')](function(_0x2da668){_0x402135[_0x6a4a('0x50')]=_0x2da668;return _0x402135;})[_0x6a4a('0x1d')](respondWithFilteredResult(_0x54ea7d,_0x5705b))[_0x6a4a('0x51')](handleError(_0x54ea7d,null));};exports[_0x6a4a('0x52')]=function(_0x2336f7,_0x25b6ce){var _0x14c75f={'raw':![],'where':{'id':_0x2336f7[_0x6a4a('0x53')]['id']},'include':[{'model':db[_0x6a4a('0x54')],'as':_0x6a4a('0x55')}]},_0x3a9361={};_0x3a9361[_0x6a4a('0x3e')]=_[_0x6a4a('0x40')](db['ChatWebsite'][_0x6a4a('0x3b')]);_0x3a9361[_0x6a4a('0x3f')]=_[_0x6a4a('0x40')](_0x2336f7[_0x6a4a('0x3f')]);_0x3a9361[_0x6a4a('0x41')]=_[_0x6a4a('0x42')](_0x3a9361[_0x6a4a('0x3e')],_0x3a9361[_0x6a4a('0x3f')]);_0x14c75f[_0x6a4a('0x43')]=_['intersection'](_0x3a9361[_0x6a4a('0x3e')],qs[_0x6a4a('0x44')](_0x2336f7['query'][_0x6a4a('0x44')]));_0x14c75f[_0x6a4a('0x43')]=_0x14c75f[_0x6a4a('0x43')][_0x6a4a('0x45')]?_0x14c75f[_0x6a4a('0x43')]:_0x3a9361['model'];if(_0x2336f7['query']['includeAll']){_0x14c75f[_0x6a4a('0x56')]=[{'all':!![]}];}_0x14c75f=_[_0x6a4a('0x57')]({},_0x14c75f,_0x2336f7[_0x6a4a('0x4e')]);return db[_0x6a4a('0x3a')][_0x6a4a('0x58')](_0x14c75f)['then'](handleEntityNotFound(_0x25b6ce,null))[_0x6a4a('0x1d')](respondWithResult(_0x25b6ce,null))[_0x6a4a('0x51')](handleError(_0x25b6ce,null));};exports[_0x6a4a('0x59')]=function(_0x2c8dc6,_0x3792de){return db[_0x6a4a('0x3a')][_0x6a4a('0x59')](_0x2c8dc6[_0x6a4a('0x5a')],{})['then'](function(_0x59c3b4){var _0x1b461e=_0x2c8dc6['user'][_0x6a4a('0x33')]({'plain':!![]});if(!_0x1b461e)throw new Error(_0x6a4a('0x5b'));if(_0x1b461e[_0x6a4a('0x5c')]===_0x6a4a('0x5d')){var _0x2dfeb7=_0x59c3b4[_0x6a4a('0x33')]({'plain':!![]});var _0x14a850=_0x6a4a('0x34');return db[_0x6a4a('0x5e')][_0x6a4a('0x58')]({'where':{'name':_0x14a850,'userProfileId':_0x1b461e[_0x6a4a('0x5f')]},'raw':!![]})[_0x6a4a('0x1d')](function(_0x40411c){if(_0x40411c&&_0x40411c[_0x6a4a('0x60')]===0x0){return db[_0x6a4a('0x61')][_0x6a4a('0x59')]({'name':_0x2dfeb7[_0x6a4a('0x37')],'resourceId':_0x2dfeb7['id'],'type':_0x40411c[_0x6a4a('0x37')],'sectionId':_0x40411c['id']},{})[_0x6a4a('0x1d')](function(){return _0x59c3b4;});}else{return _0x59c3b4;}})['catch'](function(_0x57f60e){logger[_0x6a4a('0x24')](_0x6a4a('0x62'),_0x57f60e);throw _0x57f60e;});}return _0x59c3b4;})['then'](respondWithResult(_0x3792de,0xc9))[_0x6a4a('0x51')](handleError(_0x3792de,null));};exports[_0x6a4a('0x63')]=function(_0x4e6f11,_0x5afbe2){if(_0x4e6f11[_0x6a4a('0x5a')]['id']){delete _0x4e6f11['body']['id'];}return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x4e6f11[_0x6a4a('0x53')]['id']},'include':[{'model':db[_0x6a4a('0x54')],'as':'mandatoryDispositionPause'}]})[_0x6a4a('0x1d')](handleEntityNotFound(_0x5afbe2,null))['then'](saveUpdates(_0x4e6f11[_0x6a4a('0x5a')],null))[_0x6a4a('0x1d')](respondWithResult(_0x5afbe2,null))[_0x6a4a('0x51')](handleError(_0x5afbe2,null));};exports['destroy']=function(_0xc2677d,_0x515df2){return db[_0x6a4a('0x3a')]['find']({'where':{'id':_0xc2677d[_0x6a4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x515df2,null))['then'](removeEntity(_0x515df2,null))[_0x6a4a('0x51')](handleError(_0x515df2,null));};exports[_0x6a4a('0x64')]=function(_0x4cb2c6,_0x29c931){return db[_0x6a4a('0x3a')][_0x6a4a('0x64')]()['then'](respondWithResult(_0x29c931,null))[_0x6a4a('0x51')](handleError(_0x29c931,null));};exports['addDisposition']=function(_0x110cb7,_0x436842,_0x39c886){if(_0x110cb7[_0x6a4a('0x5a')]['id']){delete _0x110cb7['body']['id'];}return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x110cb7[_0x6a4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x436842,null))['then'](function(_0x534d8c){if(_0x534d8c){_0x110cb7[_0x6a4a('0x5a')][_0x6a4a('0x65')]=_0x534d8c['id'];return db[_0x6a4a('0x66')][_0x6a4a('0x59')](_0x110cb7[_0x6a4a('0x5a')]);}})[_0x6a4a('0x1d')](respondWithResult(_0x436842,null))[_0x6a4a('0x51')](handleError(_0x436842,null));};exports[_0x6a4a('0x67')]=function(_0x384583,_0x14f02c,_0x8edd0e){var _0x2282ae={'raw':![],'where':{}};var _0x55ed45={};var _0x52d5f7={'count':0x0,'rows':[]};return db[_0x6a4a('0x3a')][_0x6a4a('0x68')]({'where':{'id':_0x384583[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x14f02c,null))[_0x6a4a('0x1d')](function(_0x6885b2){if(_0x6885b2){_0x55ed45[_0x6a4a('0x3e')]=_[_0x6a4a('0x40')](db[_0x6a4a('0x66')][_0x6a4a('0x3b')]);_0x55ed45['query']=_['keys'](_0x384583[_0x6a4a('0x3f')]);_0x55ed45[_0x6a4a('0x41')]=_[_0x6a4a('0x42')](_0x55ed45['model'],_0x55ed45[_0x6a4a('0x3f')]);_0x2282ae[_0x6a4a('0x43')]=_['intersection'](_0x55ed45[_0x6a4a('0x3e')],qs[_0x6a4a('0x44')](_0x384583['query'][_0x6a4a('0x44')]));_0x2282ae[_0x6a4a('0x43')]=_0x2282ae[_0x6a4a('0x43')][_0x6a4a('0x45')]?_0x2282ae[_0x6a4a('0x43')]:_0x55ed45[_0x6a4a('0x3e')];if(!_0x384583[_0x6a4a('0x3f')][_0x6a4a('0x46')]('nolimit')){_0x2282ae[_0x6a4a('0x2c')]=qs[_0x6a4a('0x2c')](_0x384583['query'][_0x6a4a('0x2c')]);_0x2282ae['offset']=qs[_0x6a4a('0x2e')](_0x384583[_0x6a4a('0x3f')][_0x6a4a('0x2e')]);}_0x2282ae['order']=qs[_0x6a4a('0x48')](_0x384583['query'][_0x6a4a('0x48')]);_0x2282ae[_0x6a4a('0x49')]=qs[_0x6a4a('0x41')](_[_0x6a4a('0x4a')](_0x384583[_0x6a4a('0x3f')],_0x55ed45['filters']));_0x2282ae[_0x6a4a('0x49')][_0x6a4a('0x65')]=_0x6885b2['id'];if(_0x384583[_0x6a4a('0x3f')][_0x6a4a('0x4d')]){_0x2282ae['where']=_[_0x6a4a('0x57')](_0x2282ae['where'],{'$or':_['map'](_0x2282ae[_0x6a4a('0x43')],function(_0x184412){var _0xe320ee={};_0xe320ee[_0x184412]={'$like':'%'+_0x384583['query'][_0x6a4a('0x4d')]+'%'};return _0xe320ee;})});}_0x2282ae=_[_0x6a4a('0x57')]({},_0x2282ae,_0x384583[_0x6a4a('0x4e')]);return db[_0x6a4a('0x66')][_0x6a4a('0x2d')]({'where':_0x2282ae[_0x6a4a('0x49')]})['then'](function(_0x381135){_0x52d5f7[_0x6a4a('0x2d')]=_0x381135;if(_0x384583['query']['includeAll']){_0x2282ae['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2282ae);})[_0x6a4a('0x1d')](function(_0x62d575){_0x52d5f7[_0x6a4a('0x50')]=_0x62d575;return _0x52d5f7;});}})[_0x6a4a('0x1d')](respondWithFilteredResult(_0x14f02c,_0x2282ae))['catch'](handleError(_0x14f02c,null));};exports[_0x6a4a('0x69')]=function(_0x455901,_0x31e566,_0x335c75){return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x455901['params']['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x31e566,null))[_0x6a4a('0x1d')](function(_0x355ab9){if(_0x355ab9){return _0x355ab9[_0x6a4a('0x69')](_0x455901[_0x6a4a('0x3f')]['ids']);}})[_0x6a4a('0x1d')](respondWithStatusCode(_0x31e566,null))[_0x6a4a('0x51')](handleError(_0x31e566,null));};exports[_0x6a4a('0x6a')]=function(_0x2e506b,_0x54e540,_0x41cad3){if(_0x2e506b[_0x6a4a('0x5a')]['id']){delete _0x2e506b[_0x6a4a('0x5a')]['id'];}return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x2e506b[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x54e540,null))[_0x6a4a('0x1d')](function(_0x3a55a3){if(_0x3a55a3){_0x2e506b[_0x6a4a('0x5a')]['ChatWebsiteId']=_0x3a55a3['id'];return db['CannedAnswer']['create'](_0x2e506b[_0x6a4a('0x5a')]);}})[_0x6a4a('0x1d')](respondWithResult(_0x54e540,null))['catch'](handleError(_0x54e540,null));};exports['getAnswers']=function(_0x16d0d,_0x17b9e8,_0x51785e){var _0x318109={'raw':![],'where':{}};var _0x27c068={};var _0x403841={'count':0x0,'rows':[]};return db[_0x6a4a('0x3a')][_0x6a4a('0x68')]({'where':{'id':_0x16d0d[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x17b9e8,null))[_0x6a4a('0x1d')](function(_0x26af77){if(_0x26af77){_0x27c068[_0x6a4a('0x3e')]=_[_0x6a4a('0x40')](db['CannedAnswer'][_0x6a4a('0x3b')]);_0x27c068['query']=_['keys'](_0x16d0d[_0x6a4a('0x3f')]);_0x27c068['filters']=_['intersection'](_0x27c068[_0x6a4a('0x3e')],_0x27c068[_0x6a4a('0x3f')]);_0x318109[_0x6a4a('0x43')]=_[_0x6a4a('0x42')](_0x27c068[_0x6a4a('0x3e')],qs[_0x6a4a('0x44')](_0x16d0d['query'][_0x6a4a('0x44')]));_0x318109[_0x6a4a('0x43')]=_0x318109[_0x6a4a('0x43')][_0x6a4a('0x45')]?_0x318109[_0x6a4a('0x43')]:_0x27c068['model'];if(!_0x16d0d[_0x6a4a('0x3f')][_0x6a4a('0x46')](_0x6a4a('0x6b'))){_0x318109[_0x6a4a('0x2c')]=qs[_0x6a4a('0x2c')](_0x16d0d[_0x6a4a('0x3f')][_0x6a4a('0x2c')]);_0x318109[_0x6a4a('0x2e')]=qs['offset'](_0x16d0d[_0x6a4a('0x3f')][_0x6a4a('0x2e')]);}_0x318109[_0x6a4a('0x47')]=qs[_0x6a4a('0x48')](_0x16d0d[_0x6a4a('0x3f')][_0x6a4a('0x48')]);_0x318109['where']=qs['filters'](_[_0x6a4a('0x4a')](_0x16d0d[_0x6a4a('0x3f')],_0x27c068[_0x6a4a('0x41')]));_0x318109[_0x6a4a('0x49')][_0x6a4a('0x65')]=_0x26af77['id'];if(_0x16d0d[_0x6a4a('0x3f')][_0x6a4a('0x4d')]){_0x318109[_0x6a4a('0x49')]=_[_0x6a4a('0x57')](_0x318109[_0x6a4a('0x49')],{'$or':_[_0x6a4a('0x4b')](_0x318109[_0x6a4a('0x43')],function(_0x5e4d90){var _0x3f464a={};_0x3f464a[_0x5e4d90]={'$like':'%'+_0x16d0d[_0x6a4a('0x3f')][_0x6a4a('0x4d')]+'%'};return _0x3f464a;})});}_0x318109=_['merge']({},_0x318109,_0x16d0d[_0x6a4a('0x4e')]);return db['CannedAnswer'][_0x6a4a('0x2d')]({'where':_0x318109[_0x6a4a('0x49')]})['then'](function(_0x449882){_0x403841[_0x6a4a('0x2d')]=_0x449882;if(_0x16d0d['query'][_0x6a4a('0x6c')]){_0x318109[_0x6a4a('0x56')]=[{'all':!![]}];}return db[_0x6a4a('0x6d')][_0x6a4a('0x4f')](_0x318109);})[_0x6a4a('0x1d')](function(_0x1ec814){_0x403841[_0x6a4a('0x50')]=_0x1ec814;return _0x403841;});}})['then'](respondWithFilteredResult(_0x17b9e8,_0x318109))[_0x6a4a('0x51')](handleError(_0x17b9e8,null));};exports[_0x6a4a('0x6e')]=function(_0x470858,_0x22077f,_0x94f52a){return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x470858[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x22077f,null))[_0x6a4a('0x1d')](function(_0x161c1e){if(_0x161c1e){return _0x161c1e['removeAnswers'](_0x470858[_0x6a4a('0x3f')][_0x6a4a('0x6f')]);}})['then'](respondWithStatusCode(_0x22077f,null))['catch'](handleError(_0x22077f,null));};exports[_0x6a4a('0x70')]=function(_0x3583ee,_0x45fdfb,_0xb42f50){_0x3583ee['body'][_0x6a4a('0x71')]=_0x3583ee[_0x6a4a('0x72')][_0x6a4a('0x73')];return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x3583ee[_0x6a4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x45fdfb,null))[_0x6a4a('0x1d')](saveUpdates(_0x3583ee['body'],null))['then'](respondWithResult(_0x45fdfb,null))[_0x6a4a('0x51')](handleError(_0x45fdfb,null));};exports['addAvatar']=function(_0x49824e,_0x394235,_0x308c29){_0x49824e[_0x6a4a('0x5a')][_0x6a4a('0x74')]=_0x49824e[_0x6a4a('0x72')][_0x6a4a('0x73')];return db[_0x6a4a('0x3a')]['find']({'where':{'id':_0x49824e[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x394235,null))[_0x6a4a('0x1d')](saveUpdates(_0x49824e[_0x6a4a('0x5a')],null))[_0x6a4a('0x1d')](respondWithResult(_0x394235,null))['catch'](handleError(_0x394235,null));};exports[_0x6a4a('0x75')]=function(_0x711299,_0x7e8be4,_0x387ed5){_0x711299[_0x6a4a('0x5a')][_0x6a4a('0x76')]=_0x711299['file']['filename'];return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x711299[_0x6a4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x7e8be4,null))[_0x6a4a('0x1d')](saveUpdates(_0x711299['body'],null))[_0x6a4a('0x1d')](respondWithResult(_0x7e8be4,null))[_0x6a4a('0x51')](handleError(_0x7e8be4,null));};exports[_0x6a4a('0x77')]=function(_0x52bba1,_0x23ea85,_0x3941d2){_0x52bba1[_0x6a4a('0x5a')][_0x6a4a('0x78')]=_0x52bba1[_0x6a4a('0x72')]['filename'];return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x52bba1[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x23ea85,null))[_0x6a4a('0x1d')](saveUpdates(_0x52bba1[_0x6a4a('0x5a')],null))[_0x6a4a('0x1d')](respondWithResult(_0x23ea85,null))[_0x6a4a('0x51')](handleError(_0x23ea85,null));};exports[_0x6a4a('0x79')]=function(_0x30b42c,_0x4326d0,_0x1348cc){var _0x6262ff=path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],_0x6a4a('0x7c'));var _0x51e6ae={'where':{'id':_0x30b42c['params']['id']},'attributes':['id',_0x6a4a('0x71')],'raw':!![]};var _0x115650=![];return require(_0x6a4a('0x16'))[_0x6a4a('0x7d')]()['then'](function(_0x5e6c8f){if(_0x5e6c8f){_0x115650=_0x5e6c8f[_0x6a4a('0x7e')];}})[_0x6a4a('0x1d')](function(){return db[_0x6a4a('0x3a')]['find'](_0x51e6ae);})[_0x6a4a('0x1d')](handleEntityNotFound(_0x4326d0,null))[_0x6a4a('0x1d')](function(_0x5bc7a6){if(_0x5bc7a6){if(!_[_0x6a4a('0x7f')](_0x5bc7a6[_0x6a4a('0x71')])){if(fs['existsSync'](path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],_0x6a4a('0x80'),_0x5bc7a6[_0x6a4a('0x71')]))&&_0x115650){_0x6262ff=path[_0x6a4a('0x7a')](config['root'],_0x6a4a('0x80'),_0x5bc7a6[_0x6a4a('0x71')]);}}return _0x4326d0[_0x6a4a('0x81')](_0x6262ff);}})[_0x6a4a('0x51')](handleError(_0x4326d0,null));};exports[_0x6a4a('0x82')]=function(_0xfa164f,_0x2883cf,_0x1f1676){var _0x78e586=path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],_0x6a4a('0x83'));var _0x6c2721={'where':{'id':_0xfa164f[_0x6a4a('0x53')]['id']},'attributes':['id',_0x6a4a('0x74')],'raw':!![]};return db[_0x6a4a('0x3a')][_0x6a4a('0x58')](_0x6c2721)[_0x6a4a('0x1d')](handleEntityNotFound(_0x2883cf,null))[_0x6a4a('0x1d')](function(_0x1a5f5a){if(_0x1a5f5a){if(!_[_0x6a4a('0x7f')](_0x1a5f5a[_0x6a4a('0x74')])){if(fs['existsSync'](path[_0x6a4a('0x7a')](config['root'],_0x6a4a('0x84'),_0x1a5f5a[_0x6a4a('0x74')]))){_0x78e586=path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],'server/files/images/avatars/',_0x1a5f5a['agentAvatar']);}}return _0x2883cf[_0x6a4a('0x81')](_0x78e586);}})[_0x6a4a('0x51')](handleError(_0x2883cf,null));};exports[_0x6a4a('0x85')]=function(_0x5f8d13,_0x1590f4,_0x4c34ee){var _0x1d1d23=path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],'server/files/images/avatars/customer_avatar.png');var _0x38ce10={'where':{'id':_0x5f8d13[_0x6a4a('0x53')]['id']},'attributes':['id',_0x6a4a('0x76'),_0x6a4a('0x86')],'raw':!![]};return db[_0x6a4a('0x3a')]['find'](_0x38ce10)['then'](handleEntityNotFound(_0x1590f4,null))[_0x6a4a('0x1d')](function(_0x33dd36){if(_0x33dd36){if(!_[_0x6a4a('0x7f')](_0x33dd36[_0x6a4a('0x76')])){if(fs[_0x6a4a('0x87')](path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],_0x6a4a('0x84'),_0x33dd36[_0x6a4a('0x76')]))&&_0x33dd36[_0x6a4a('0x86')]){_0x1d1d23=path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],_0x6a4a('0x84'),_0x33dd36['customerAvatar']);}}return _0x1590f4[_0x6a4a('0x81')](_0x1d1d23);}})[_0x6a4a('0x51')](handleError(_0x1590f4,null));};exports[_0x6a4a('0x88')]=function(_0x5b2aba,_0x2a308c,_0x3a6879){var _0x231ce5=path['join'](config['root'],_0x6a4a('0x89'));var _0x16248a={'where':{'id':_0x5b2aba['params']['id']},'attributes':['id',_0x6a4a('0x78')],'raw':!![]};return db['ChatWebsite']['find'](_0x16248a)[_0x6a4a('0x1d')](handleEntityNotFound(_0x2a308c,null))['then'](function(_0x15c3d3){if(_0x15c3d3){if(!_[_0x6a4a('0x7f')](_0x15c3d3['systemAvatar'])){if(fs['existsSync'](path['join'](config[_0x6a4a('0x7b')],_0x6a4a('0x84'),_0x15c3d3[_0x6a4a('0x78')]))){_0x231ce5=path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],'server/files/images/avatars/',_0x15c3d3[_0x6a4a('0x78')]);}}return _0x2a308c['download'](_0x231ce5);}})[_0x6a4a('0x51')](handleError(_0x2a308c,null));};exports[_0x6a4a('0x8a')]=function(_0x39cc1d,_0x29570f,_0x4fe2d3){var _0x71ec80=require(_0x6a4a('0x8b'));var _0x55d18c=new _0x71ec80();var _0x1d3b99=_0x55d18c[_0x6a4a('0x8c')](_0x39cc1d[_0x6a4a('0x8d')]['user-agent'])['getResult']();var _0x18bcd7={'body':_0x39cc1d[_0x6a4a('0x5a')],'channel':'chat'};var _0x3ae017=[];var _0x456430=[];var _0x17bac9={};var _0x1eb4f3=![];return db['CmContact'][_0x6a4a('0x64')]()['then'](function(_0x26694c){if(!_0x26694c){throw new db[(_0x6a4a('0x8e'))][(_0x6a4a('0x8f'))](_0x6a4a('0x90'));}_0x3ae017=_['difference'](_[_0x6a4a('0x40')](_0x26694c),[_0x6a4a('0x91'),_0x6a4a('0x92')]);_0x456430=_['difference'](_[_0x6a4a('0x40')](_0x26694c),[_0x6a4a('0x91'),'updatedAt',_0x6a4a('0x93'),_0x6a4a('0x94')]);if(_0x39cc1d['body']['id']){delete _0x39cc1d[_0x6a4a('0x5a')]['id'];}if(_['isNil'](_0x39cc1d['body']['from'])){throw new db[(_0x6a4a('0x8e'))][(_0x6a4a('0x8f'))](_0x6a4a('0x95'));}if(_[_0x6a4a('0x7f')](_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0x5a')])||_0x39cc1d[_0x6a4a('0x5a')]['body']===''){throw new db[(_0x6a4a('0x8e'))]['ValidationError'](_0x6a4a('0x96'));}if(_['isNil'](_0x39cc1d[_0x6a4a('0x5a')]['mapKey'])){throw new db[(_0x6a4a('0x8e'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x456430);}if(!_['includes'](_0x456430,_0x39cc1d['body'][_0x6a4a('0x97')])){throw new db[(_0x6a4a('0x8e'))][(_0x6a4a('0x8f'))](_0x6a4a('0x98')+_0x456430);}_0x17bac9[_0x39cc1d[_0x6a4a('0x5a')]['mapKey']]=_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0x99')];})[_0x6a4a('0x1d')](function(){return db['ChatWebsite'][_0x6a4a('0x58')]({'where':{'id':_0x39cc1d[_0x6a4a('0x53')]['id']},'include':[{'model':db[_0x6a4a('0x9a')],'as':'List','include':[{'model':db[_0x6a4a('0x9b')],'as':_0x6a4a('0x9c'),'where':_0x17bac9,'limit':0x1,'order':[[_0x6a4a('0x92'),'DESC']]}]},{'model':db[_0x6a4a('0x9d')],'as':_0x6a4a('0x9e')}]});})[_0x6a4a('0x1d')](handleEntityNotFound(_0x29570f,null))[_0x6a4a('0x1d')](function(_0x3e47a2){if(_0x3e47a2&&_0x3e47a2[_0x6a4a('0x9f')]){_0x18bcd7[_0x6a4a('0xa0')]=_0x3e47a2;_0x18bcd7['applications']=_0x3e47a2['Applications'];_0x18bcd7[_0x6a4a('0xa1')]=_0x3e47a2[_0x6a4a('0x9f')];_0x18bcd7[_0x6a4a('0xa2')]=_[_0x6a4a('0xa3')](_0x18bcd7[_0x6a4a('0xa2')],['priority'],[_0x6a4a('0xa4')]);if(_0x18bcd7['account'][_0x6a4a('0x9e')]){delete _0x18bcd7['account'][_0x6a4a('0x9e')];}if(_0x18bcd7[_0x6a4a('0xa0')][_0x6a4a('0x9f')]&&_0x18bcd7[_0x6a4a('0xa0')][_0x6a4a('0x9f')][_0x6a4a('0x9c')][_0x6a4a('0x45')]){return _0x18bcd7['account'][_0x6a4a('0x9f')][_0x6a4a('0x9c')][0x0];}var _0x22a405=_[_0x6a4a('0xa5')](_0x39cc1d[_0x6a4a('0x5a')],{'firstName':_0x39cc1d['body'][_0x6a4a('0x99')],'ListId':_0x3e47a2[_0x6a4a('0x94')]});_0x22a405[_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0x97')]]=_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0x99')];return db[_0x6a4a('0x9b')]['create'](_0x22a405,{'fields':_0x3ae017,'raw':!![]});}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x29570f,null))[_0x6a4a('0x1d')](function(_0x4daef3){_0x18bcd7[_0x6a4a('0xa6')]=_0x4daef3;var _0x5882ad=_0x39cc1d['body'][_0x6a4a('0xa7')];if(_0x39cc1d[_0x6a4a('0x8d')]['cf-connecting-ip']){_0x5882ad=_0x39cc1d[_0x6a4a('0x8d')][_0x6a4a('0xa8')];}else if(_0x39cc1d[_0x6a4a('0x8d')][_0x6a4a('0xa9')]){_0x5882ad=_[_0x6a4a('0xaa')](_0x39cc1d[_0x6a4a('0x8d')][_0x6a4a('0xa9')][_0x6a4a('0xab')](','));}if(_0x4daef3){var _0x5e3257={'ContactId':_0x4daef3['id'],'ChatWebsiteId':_0x39cc1d[_0x6a4a('0x53')]['id'],'from':(_0x4daef3[_0x6a4a('0xac')]||'')+'\x20'+(_0x4daef3[_0x6a4a('0xad')]||''),'customerIp':_0x5882ad,'customerPort':_0x39cc1d[_0x6a4a('0x8d')][_0x6a4a('0xae')]?_0x39cc1d[_0x6a4a('0x8d')][_0x6a4a('0xae')]:null,'referer':_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0xaf')],'browserName':_0x1d3b99[_0x6a4a('0xb0')][_0x6a4a('0x37')]&&_0x1d3b99['browser']['version']?util[_0x6a4a('0xb1')](_0x6a4a('0xb2'),_0x1d3b99[_0x6a4a('0xb0')][_0x6a4a('0x37')],_0x1d3b99[_0x6a4a('0xb0')][_0x6a4a('0xb3')]):_0x6a4a('0xb4'),'browserVersion':_0x1d3b99[_0x6a4a('0xb0')]['version']||_0x6a4a('0xb4'),'osName':util[_0x6a4a('0xb1')]('%s\x20%s',_0x1d3b99['os']['name'],_0x1d3b99['os'][_0x6a4a('0xb3')]),'osVersion':_0x1d3b99['os'][_0x6a4a('0xb3')],'deviceModel':_0x1d3b99['device'][_0x6a4a('0x3e')]&&_0x1d3b99[_0x6a4a('0xb5')][_0x6a4a('0xb6')]?util[_0x6a4a('0xb1')](_0x6a4a('0xb7'),_0x1d3b99[_0x6a4a('0xb5')][_0x6a4a('0x3e')],_0x1d3b99[_0x6a4a('0xb5')][_0x6a4a('0xb6')],_0x1d3b99[_0x6a4a('0xb5')][_0x6a4a('0x3c')]):null,'deviceVendor':_0x1d3b99[_0x6a4a('0xb5')][_0x6a4a('0xb6')],'deviceType':_0x1d3b99[_0x6a4a('0xb5')][_0x6a4a('0x3c')],'formData':JSON[_0x6a4a('0x23')](_0x39cc1d[_0x6a4a('0x5a')])};var _0x58d41d={'ChatWebsiteId':_0x39cc1d['params']['id'],'closed':![]};if(_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0xb8')]){_0x58d41d[_0x6a4a('0xb8')]=_0x39cc1d['body'][_0x6a4a('0xb8')];return db['ChatInteraction'][_0x6a4a('0x58')]({'where':_0x58d41d})['then'](function(_0x15265e){if(_0x15265e){return[_0x15265e,![]];}_0x5e3257['threadId']=_0x39cc1d[_0x6a4a('0x5a')]['threadId'];_0x5e3257['externalUrl']=_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0xb9')];return db[_0x6a4a('0xba')][_0x6a4a('0x59')](_0x5e3257)[_0x6a4a('0x1d')](function(_0x1970cd){return[_0x1970cd,!![]];});});}_0x58d41d[_0x6a4a('0xbb')]=_0x4daef3['id'];if(_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0xbc')]&&_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0xbc')]['id']){_0x58d41d['id']=_0x39cc1d[_0x6a4a('0x5a')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x58d41d})[_0x6a4a('0x1d')](function(_0x38675d){if(_0x38675d){return[_0x38675d,![]];}return db[_0x6a4a('0xba')][_0x6a4a('0x59')](_0x5e3257)[_0x6a4a('0x1d')](function(_0x2c27b0){return[_0x2c27b0,!![]];});});}return db[_0x6a4a('0xba')][_0x6a4a('0x59')](_0x5e3257)[_0x6a4a('0x1d')](function(_0x2e5e84){return[_0x2e5e84,!![]];});}})[_0x6a4a('0xbd')](function(_0x59ca75,_0x18ff0a){if(_0x59ca75){_0x1eb4f3=_0x18ff0a;if(!_0x18ff0a){var _0x48e7ac={'from':(_0x18bcd7[_0x6a4a('0xa6')]['firstName']||'')+'\x20'+(_0x18bcd7[_0x6a4a('0xa6')][_0x6a4a('0xad')]||'')};if(_0x39cc1d[_0x6a4a('0x5a')]['threadId']&&_0x39cc1d[_0x6a4a('0x5a')]['messageId']&&_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0xb8')]!=_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0xbe')]){_0x48e7ac['threadId']=_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0xbe')];}return _0x59ca75['update'](_0x48e7ac);}else{return _0x59ca75;}}})[_0x6a4a('0x1d')](function(_0x510bcc){_0x18bcd7[_0x6a4a('0xbc')]=_0x510bcc[_0x6a4a('0x33')]({'plain':!![]});_0x18bcd7['interaction'][_0x6a4a('0xbf')]=_0x1eb4f3;if(_0x18bcd7[_0x6a4a('0xbc')]['created']){if(_0x18bcd7[_0x6a4a('0xa0')][_0x6a4a('0xc0')]){_0x18bcd7[_0x6a4a('0xa2')]['push']({'id':0x0,'priority':_0x18bcd7[_0x6a4a('0xa2')]['length']+0x1,'app':_0x6a4a('0xc1'),'appdata':_0x6a4a('0xc2'),'interval':'*,*,*,*'});}}return db[_0x6a4a('0xc3')][_0x6a4a('0x59')]({'body':_0x39cc1d[_0x6a4a('0x5a')][_0x6a4a('0x5a')],'ChatWebsiteId':_0x39cc1d[_0x6a4a('0x53')]['id'],'ChatInteractionId':_0x510bcc['id'],'direction':'in','ContactId':_0x18bcd7['contact']['id'],'AttachmentId':_0x39cc1d['body']['AttachmentId']});})[_0x6a4a('0x1d')](function(_0x31447e){_0x18bcd7['message']=_0x31447e;if(_0x18bcd7[_0x6a4a('0xbc')][_0x6a4a('0xc4')]){return db['User'][_0x6a4a('0x58')]({'attributes':['id',_0x6a4a('0x37')],'where':{'id':_0x18bcd7['interaction'][_0x6a4a('0xc4')]}})['then'](function(_0x25a22f){if(_0x25a22f){_0x18bcd7[_0x6a4a('0xa2')][_0x6a4a('0xc5')]({'id':0x0,'priority':0x0,'app':_0x6a4a('0xc6'),'appdata':_0x25a22f['name']+','+(_0x18bcd7[_0x6a4a('0xa0')][_0x6a4a('0xc7')]||0xa),'interval':'*,*,*,*'});_0x18bcd7[_0x6a4a('0xc8')]=!![];}return respondWithRpcPromise(_0x6a4a('0xc9'),'startRouting',_0x18bcd7);});}return respondWithRpcPromise('Start',_0x6a4a('0xca'),_0x18bcd7);})[_0x6a4a('0x1d')](function(_0x48f8e3){respondWithRpcPromise('EventManager',_0x6a4a('0xcb'),{'event':'notify','message':_0x48f8e3},client9002);return _0x48f8e3;})[_0x6a4a('0x1d')](respondWithResult(_0x29570f,null))['catch'](handleError(_0x29570f,null));};exports['offline']=function(_0x15f2ed,_0x32edb5,_0x261bf5){var _0x52bbf5,_0x246844,_0x20f6e3;var _0x2324f8=[];var _0x1d5691=[];var _0x399460={};var _0x5bd247=_0x15f2ed[_0x6a4a('0xcc')]||[];var _0x336bb4=[];var _0x5d9ee0;return db[_0x6a4a('0x9b')][_0x6a4a('0x64')]()[_0x6a4a('0x1d')](function(_0x1ecca2){if(!_0x1ecca2){throw new db[(_0x6a4a('0x8e'))][(_0x6a4a('0x8f'))]('no\x20available\x20attributes');}_0x1d5691=_['difference'](_[_0x6a4a('0x40')](_0x1ecca2),[_0x6a4a('0x91'),_0x6a4a('0x92')]);_0x2324f8=_[_0x6a4a('0xcd')](_[_0x6a4a('0x40')](_0x1ecca2),[_0x6a4a('0x91'),_0x6a4a('0x92'),'CompanyId','ListId']);if(_0x15f2ed[_0x6a4a('0x5a')]['id']){delete _0x15f2ed[_0x6a4a('0x5a')]['id'];}if(_[_0x6a4a('0x7f')](_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0x99')])){throw _0x32edb5[_0x6a4a('0x28')](0x1f4)[_0x6a4a('0x38')](new db['Sequelize']['ValidationError'](_0x6a4a('0x95')));}if(_[_0x6a4a('0x7f')](_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0x5a')])||_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0x5a')]===''){throw _0x32edb5['status'](0x1f4)[_0x6a4a('0x38')](new db[(_0x6a4a('0x8e'))][(_0x6a4a('0x8f'))](_0x6a4a('0x96')));}if(_[_0x6a4a('0x7f')](_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0xce')])){throw _0x32edb5[_0x6a4a('0x28')](0x1f4)[_0x6a4a('0x38')](new db[(_0x6a4a('0x8e'))][(_0x6a4a('0x8f'))](_0x6a4a('0xcf')+_0x2324f8));}if(!_[_0x6a4a('0xd0')](_0x2324f8,_0x15f2ed['body'][_0x6a4a('0xce')])){throw _0x32edb5[_0x6a4a('0x28')](0x1f4)['send'](new db[(_0x6a4a('0x8e'))][(_0x6a4a('0x8f'))](_0x6a4a('0xd1')+_0x2324f8));}_0x399460[_0x15f2ed['body'][_0x6a4a('0xce')]]=_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0x99')];})[_0x6a4a('0x1d')](function(){return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x15f2ed[_0x6a4a('0x53')]['id']},'include':[{'model':db[_0x6a4a('0x9a')],'as':_0x6a4a('0x9f')},{'model':db[_0x6a4a('0xd2')],'as':_0x6a4a('0xd2')}]});})[_0x6a4a('0x1d')](handleEntityNotFound(_0x32edb5,null))[_0x6a4a('0x1d')](function(_0x4a3893){if(_0x4a3893&&_0x4a3893[_0x6a4a('0x9f')]){_0x246844=_0x4a3893;var _0x26ae8e=_[_0x6a4a('0xa5')](_0x15f2ed['body'],{'firstName':_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0x99')],'phone':_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0x99')],'ListId':_0x4a3893['ListId']});_0x26ae8e[_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0xce')]]=_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0x99')];return db['CmContact']['findOrCreate']({'where':_0x399460,'defaults':_0x26ae8e});}})[_0x6a4a('0xbd')](function(_0x17f24e){if(_0x17f24e){_0x20f6e3=_0x17f24e;var _0x500fde=fs[_0x6a4a('0xd3')](path[_0x6a4a('0x7a')](config[_0x6a4a('0x7b')],'server/files/templates/chatOfflineMessage.ejs'),_0x6a4a('0xd4'));var _0x1d11e2=ejs[_0x6a4a('0xd5')](_0x500fde,{'body':_[_0x6a4a('0xd6')](_0x15f2ed[_0x6a4a('0x5a')][_0x6a4a('0x5a')]),'bodyTitle':_0x246844[_0x6a4a('0xd7')]});return db[_0x6a4a('0xd8')][_0x6a4a('0x59')]({'body':_0x1d11e2,'ContactId':_0x17f24e['id'],'ChatWebsiteId':_0x246844['id']});}})[_0x6a4a('0x1d')](function(_0x46c31e){_0x5d9ee0=_0x46c31e;if(_0x5bd247[_0x6a4a('0x45')]){var _0x270716=_0x5bd247[_0x6a4a('0x4b')](function(_0x37882d){return{'name':_0x37882d[_0x6a4a('0xd9')],'basename':_0x37882d[_0x6a4a('0x73')],'type':_0x37882d[_0x6a4a('0xda')],'ChatOfflineMessageId':_0x46c31e['id']};});_0x336bb4=_0x270716['map'](_0x52fe6a=>{var _0x5cba45={'filename':_0x52fe6a['name'],'path':path[_0x6a4a('0x7a')](config['root'],'server','files',_0x6a4a('0xdb'),_0x6a4a('0xdc'),_0x52fe6a[_0x6a4a('0xdd')])};return _0x5cba45;});if(!_0x246844[_0x6a4a('0xde')]){return db[_0x6a4a('0xdf')][_0x6a4a('0xe0')](function(_0x1784ba){return db['Attachment'][_0x6a4a('0xe1')](_0x270716,{'transaction':_0x1784ba});});}}})['then'](function(){if(_0x5d9ee0){_0x52bbf5=_0x5d9ee0;return db[_0x6a4a('0xd2')][_0x6a4a('0x68')]({'where':{'active':!![]},'include':[{'model':db[_0x6a4a('0xe2')],'as':_0x6a4a('0xe3'),'raw':!![]}]});}})[_0x6a4a('0x1d')](function(_0x5984c5){if(_0x5984c5&&_0x5984c5['Smtp']&&_0x246844[_0x6a4a('0xe4')]&&_0x246844[_0x6a4a('0xe5')]){var _0x23c31c={'tls':{'rejectUnauthorized':![]}};if(_0x5984c5[_0x6a4a('0xe3')][_0x6a4a('0xe6')]){_0x23c31c[_0x6a4a('0xe6')]=_0x5984c5[_0x6a4a('0xe3')][_0x6a4a('0xe6')];}else{_0x23c31c[_0x6a4a('0xe7')]=_0x5984c5[_0x6a4a('0xe3')][_0x6a4a('0xe7')];_0x23c31c[_0x6a4a('0xe8')]=_0x5984c5[_0x6a4a('0xe3')][_0x6a4a('0xe8')];_0x23c31c[_0x6a4a('0xe9')]=_0x5984c5[_0x6a4a('0xe3')][_0x6a4a('0xe9')];}if(_0x5984c5[_0x6a4a('0xe3')][_0x6a4a('0xea')]){_0x23c31c[_0x6a4a('0xeb')]={'user':_0x5984c5['Smtp']['user'],'pass':_0x5984c5['Smtp']['pass']};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x23c31c,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x5984c5[_0x6a4a('0x37')],_0x5984c5[_0x6a4a('0xec')]||_0x5984c5[_0x6a4a('0xe3')]['user']),'to':_0x246844[_0x6a4a('0xe5')],'subject':_0x246844[_0x6a4a('0xed')],'html':_0x52bbf5['body'],'attachments':_0x336bb4}},client9003)[_0x6a4a('0x1d')](function(){return _0x52bbf5;})[_0x6a4a('0x51')](function(_0x355620){console['error'](_0x355620);});}})['then'](function(){if(_0x246844&&_0x246844[_0x6a4a('0xde')]&&_0x246844[_0x6a4a('0xee')]){var _0x4e8bf3=[];if(_0x5bd247[_0x6a4a('0x45')]){_0x4e8bf3=_0x5bd247['map'](function(_0x395691){return{'name':_0x395691[_0x6a4a('0xd9')],'basename':_0x395691[_0x6a4a('0x73')],'type':_0x395691[_0x6a4a('0xda')],'ChatOfflineMessageId':_0x5d9ee0['id']};});}var _0x3e775a;if(!_[_0x6a4a('0x7f')](_0x246844[_0x6a4a('0xef')])){var _0x2659ee=_['map'](_0x15f2ed[_0x6a4a('0x5a')],function(_0x3f437f){return _0x3f437f;});var _0x286b0b=_['toPairsIn'](_0x2659ee)[0x0];var _0x23b4a5=_[_0x6a4a('0xf0')](_0x286b0b,function(_0xa93ae4){return _0xa93ae4;});_0x3e775a=_0x23b4a5[0x1][_0x246844['subjectOffline']];}var _0x1f7d22={'from':_0x20f6e3[_0x6a4a('0xec')],'firstName':_0x20f6e3[_0x6a4a('0xac')],'lastName':_0x20f6e3[_0x6a4a('0xad')],'mapKey':'email','message':{'from':_0x20f6e3[_0x6a4a('0xec')],'to':_0x246844['MailAccount'][_0x6a4a('0xec')],'cc':'','subject':_[_0x6a4a('0x7f')](_0x3e775a)?_0x246844[_0x6a4a('0xed')]:_0x3e775a,'messageId':'','sentAt':new Date(),'attach':_0x4e8bf3[_0x6a4a('0x45')],'attachments':_0x4e8bf3,'originChannel':_0x6a4a('0xf1'),'ChatWebsiteId':_0x246844['id'],'ChatOfflineMessageId':_0x52bbf5['id'],'originTo':_0x246844[_0x6a4a('0xd2')][_0x6a4a('0xec')]},'body':_0x52bbf5[_0x6a4a('0x5a')]};var _0x136b81={'account':{'id':_0x246844[_0x6a4a('0xee')]},'body':_0x1f7d22,'log':_0x6a4a('0xf2')};return respondWithRpcPromise(_0x6a4a('0xf2'),'notifyMail',_0x136b81,client9001)[_0x6a4a('0x1d')](function(){return _0x52bbf5;})[_0x6a4a('0x51')](function(_0x5787a9){console[_0x6a4a('0x24')](_0x5787a9);});}return;})[_0x6a4a('0x1d')](function(){if(_0x52bbf5){return _0x52bbf5;}})[_0x6a4a('0x1d')](respondWithResult(_0x32edb5,null))[_0x6a4a('0x51')](function(_0x3fb66b){console[_0x6a4a('0x24')](_0x6a4a('0x51'),_0x3fb66b);for(var _0x4aa35b of _0x5bd247){var _0x54be4b=path['join'](config[_0x6a4a('0x7b')],_0x6a4a('0xf3'),_0x6a4a('0xcc'),_0x6a4a('0xdb'),_0x6a4a('0xdc'),_0x4aa35b[_0x6a4a('0x73')]);fs_extra[_0x6a4a('0xf4')](_0x54be4b)['catch'](function(_0x50229e){console['error'](_0x6a4a('0xf5'),_0x54be4b,_0x50229e);});}});};exports['addInteraction']=function(_0x48150e,_0x229aa8,_0x58cde3){return db['ChatInteraction'][_0x6a4a('0x58')]({'where':{'id':_0x48150e[_0x6a4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x229aa8,null))[_0x6a4a('0x1d')](function(_0x48c104){if(_0x48c104){return _0x48c104[_0x6a4a('0xf6')](_0x48150e[_0x6a4a('0x5a')][_0x6a4a('0x6f')],_[_0x6a4a('0xf7')](_0x48150e[_0x6a4a('0x5a')],[_0x6a4a('0x6f'),'id'])||{});}})[_0x6a4a('0x1d')](respondWithResult(_0x229aa8,null))[_0x6a4a('0x51')](handleError(_0x229aa8,null));};exports[_0x6a4a('0xf8')]=function(_0x4b0759,_0x29261b,_0x146625){var _0x303a58={'raw':![],'where':{}};var _0x1b8ab4={};var _0x5d4925={'count':0x0,'rows':[]};return db[_0x6a4a('0x3a')]['findOne']({'where':{'id':_0x4b0759['params']['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x29261b,null))[_0x6a4a('0x1d')](function(_0x5155c2){if(_0x5155c2){_0x1b8ab4[_0x6a4a('0x3e')]=_[_0x6a4a('0x40')](db['ChatInteraction'][_0x6a4a('0x3b')]);_0x1b8ab4[_0x6a4a('0x3f')]=_['keys'](_0x4b0759[_0x6a4a('0x3f')]);_0x1b8ab4['filters']=_[_0x6a4a('0x42')](_0x1b8ab4[_0x6a4a('0x3e')],_0x1b8ab4['query']);_0x303a58[_0x6a4a('0x43')]=_[_0x6a4a('0x42')](_0x1b8ab4['model'],qs[_0x6a4a('0x44')](_0x4b0759[_0x6a4a('0x3f')]['fields']));_0x303a58[_0x6a4a('0x43')]=_0x303a58[_0x6a4a('0x43')]['length']?_0x303a58[_0x6a4a('0x43')]:_0x1b8ab4[_0x6a4a('0x3e')];if(!_0x4b0759[_0x6a4a('0x3f')][_0x6a4a('0x46')](_0x6a4a('0x6b'))){_0x303a58[_0x6a4a('0x2c')]=qs['limit'](_0x4b0759[_0x6a4a('0x3f')][_0x6a4a('0x2c')]);_0x303a58[_0x6a4a('0x2e')]=qs[_0x6a4a('0x2e')](_0x4b0759['query'][_0x6a4a('0x2e')]);}_0x303a58[_0x6a4a('0x47')]=qs['sort'](_0x4b0759['query']['sort']);_0x303a58[_0x6a4a('0x49')]=qs[_0x6a4a('0x41')](_[_0x6a4a('0x4a')](_0x4b0759[_0x6a4a('0x3f')],_0x1b8ab4[_0x6a4a('0x41')]));_0x303a58[_0x6a4a('0x49')][_0x6a4a('0x65')]=_0x5155c2['id'];if(_0x4b0759['query'][_0x6a4a('0x4d')]){_0x303a58['where']=_[_0x6a4a('0x57')](_0x303a58[_0x6a4a('0x49')],{'$or':_['map'](_0x303a58[_0x6a4a('0x43')],function(_0x11555b){var _0x35e3c6={};_0x35e3c6[_0x11555b]={'$like':'%'+_0x4b0759[_0x6a4a('0x3f')]['filter']+'%'};return _0x35e3c6;})});}_0x303a58=_[_0x6a4a('0x57')]({},_0x303a58,_0x4b0759[_0x6a4a('0x4e')]);return db['ChatInteraction'][_0x6a4a('0x2d')]({'where':_0x303a58['where']})[_0x6a4a('0x1d')](function(_0x2cac66){_0x5d4925['count']=_0x2cac66;if(_0x4b0759[_0x6a4a('0x3f')][_0x6a4a('0x6c')]){_0x303a58[_0x6a4a('0x56')]=[{'model':db[_0x6a4a('0x9b')],'as':_0x6a4a('0xf9'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x6a4a('0x37'),'fullname',_0x6a4a('0xfa')],'required':![]},{'model':db[_0x6a4a('0xfb')],'as':_0x6a4a('0xfc'),'attributes':['id',_0x6a4a('0x37'),'color'],'where':_0x4b0759[_0x6a4a('0x3f')]['tag']?{'id':_0x4b0759[_0x6a4a('0x3f')]['tag']}:undefined,'required':_0x4b0759[_0x6a4a('0x3f')][_0x6a4a('0xfd')]?!![]:![]}];}return db[_0x6a4a('0xba')][_0x6a4a('0x4f')](_0x303a58);})['then'](function(_0x4758fb){_0x5d4925['rows']=_0x4758fb;return _0x5d4925;});}})['then'](respondWithFilteredResult(_0x29261b,_0x303a58))[_0x6a4a('0x51')](handleError(_0x29261b,null));};function iftimePromise(_0x5e3ab3,_0x3692c7){return respondWithRpcPromise(_0x6a4a('0xfe'),_0x6a4a('0xff'),{'command':_0x3692c7[_0x6a4a('0x100')]?util[_0x6a4a('0xb1')](_0x6a4a('0x101'),_0x5e3ab3[_0x6a4a('0x102')],_0x3692c7[_0x6a4a('0x100')]):util['format'](_0x6a4a('0x103'),_0x5e3ab3['interval'])},client9002)[_0x6a4a('0x1d')](function(_0x17838a){var _0x4832bc=_0x17838a&&_0x17838a[_0x6a4a('0x104')]('true')>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3692c7['id'],_0x5e3ab3['id'],_0x5e3ab3[_0x6a4a('0x102')],_0x4832bc?'ONLINE':_0x6a4a('0x105'),_0x3692c7[_0x6a4a('0x100')]?_0x3692c7['timezone']:'No\x20timezone');return _0x4832bc;})[_0x6a4a('0x51')](function(_0x4f2129){logger[_0x6a4a('0x24')](_0x6a4a('0x106'),_0x3692c7['id'],_0x5e3ab3['id'],_0x5e3ab3[_0x6a4a('0x102')],util[_0x6a4a('0x107')](_0x4f2129,{'showHidden':![],'depth':null}),_0x3692c7[_0x6a4a('0x100')]?_0x3692c7['timezone']:_0x6a4a('0x108'));return![];});}exports['getSnippet']=function(_0x9a38c2,_0x1b4568,_0x39eac4){var _0x276f3d=0x0;var _0x482ac2=0x0;var _0x25aca7=![];var _0x1642b7;var _0x219699;return db[_0x6a4a('0x3a')]['find']({'where':{'id':_0x9a38c2[_0x6a4a('0x53')]['id']},'include':[{'model':db[_0x6a4a('0x109')],'as':_0x6a4a('0x109'),'include':[{'model':db[_0x6a4a('0x109')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1b4568,null))['then'](function(_0x14783d){if(_0x14783d){_0x1642b7=_0x14783d;return _0x14783d['getProactiveActions']({'raw':!![]});}})['then'](function(_0x5f5cc0){if(_0x1642b7){if(_0x5f5cc0){_0x219699=_0x5f5cc0;}}return require('../../config/license/util')[_0x6a4a('0x7d')]();})[_0x6a4a('0x1d')](function(_0x46f827){if(_0x46f827){_0x482ac2=_0x46f827[_0x6a4a('0x10a')];_0x25aca7=_0x46f827[_0x6a4a('0x7e')];}})[_0x6a4a('0x1d')](function(){return db[_0x6a4a('0xba')][_0x6a4a('0x2d')]({'where':{'closed':![]}});})[_0x6a4a('0x1d')](function(_0x4e7b84){_0x276f3d=_0x4e7b84;if(_0x482ac2&&_0x4e7b84>_0x482ac2){return db[_0x6a4a('0x10b')][_0x6a4a('0x68')]({'where':{'id':0x1}})[_0x6a4a('0x1d')](function(_0x1fc6eb){if(_0x1fc6eb){_0x1fc6eb[_0x6a4a('0x10c')](_0x6a4a('0x10d'));}});}})[_0x6a4a('0x1d')](function(){if(_0x1642b7[_0x6a4a('0x109')]&&_0x1642b7[_0x6a4a('0x109')][_0x6a4a('0x10e')]){var _0x2e6d93=[];for(var _0x31cbe4=0x0;_0x31cbe4<_0x1642b7[_0x6a4a('0x109')]['Intervals'][_0x6a4a('0x45')];_0x31cbe4++){var _0x2a71ed=_0x1642b7[_0x6a4a('0x109')][_0x6a4a('0x10e')][_0x31cbe4][_0x6a4a('0x33')]({'plain':!![]});_0x2e6d93['push'](iftimePromise(_0x2a71ed,_0x1642b7));}return BPromise[_0x6a4a('0x10f')](_0x2e6d93)['then'](function(_0x161a31){return _['some'](_0x161a31);});}else{return!![];}})[_0x6a4a('0x1d')](function(_0x66b0bc){var _0x15e8aa=fs['readFileSync'](path[_0x6a4a('0x7a')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x2d1fdc={'remote':_0x1642b7[_0x6a4a('0x110')],'query':querystring[_0x6a4a('0x23')](_['merge'](_0x1642b7['get']({'plain':!![]}),{'customerIp':_0x9a38c2[_0x6a4a('0x8d')][_0x6a4a('0xa9')]||_0x9a38c2[_0x6a4a('0x8d')]['x-real-ip']||_0x9a38c2['connection'][_0x6a4a('0x111')]||_0x9a38c2['ip'],'referer':_0x9a38c2[_0x6a4a('0x8d')][_0x6a4a('0xaf')],'openedInteractions':_0x276f3d,'maxInteractions':_0x482ac2,'virtual':_0x25aca7[_0x6a4a('0x10a')],'online':_0x66b0bc,'custom':_0x25aca7}))[_0x6a4a('0x112')](/'/g,'\x5c\x27')};_0x1b4568[_0x6a4a('0x38')](ejs[_0x6a4a('0xd5')](Mustache[_0x6a4a('0xd5')](_0x15e8aa,_0x2d1fdc),{'proactiveActions':_0x219699,'alignment':_0x1642b7[_0x6a4a('0x113')],'verticalAlignment':_0x1642b7[_0x6a4a('0x114')],'div_color':_0x1642b7[_0x6a4a('0x115')],'text_color':_0x1642b7['textColor'],'button_color':_0x1642b7[_0x6a4a('0x116')],'background_color':_0x1642b7['backgroundColor']}));})[_0x6a4a('0x51')](handleError(_0x1b4568,null));};exports[_0x6a4a('0x117')]=function(_0x98cbd1,_0x1e2c6e,_0x2640f1){return db['ChatWebsite'][_0x6a4a('0x68')]({'where':{'id':_0x98cbd1[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x1e2c6e,null))[_0x6a4a('0x1d')](function(_0x56dbbb){if(_0x56dbbb){return db['sequelize'][_0x6a4a('0xe0')](function(_0x3dadaf){return db['ChatApplication'][_0x6a4a('0x35')]({'where':{'ChatWebsiteId':_0x98cbd1[_0x6a4a('0x53')]['id']},'transaction':_0x3dadaf})[_0x6a4a('0x1d')](function(_0x4737de){var _0x45ec8e=_[_0x6a4a('0x4b')](_0x98cbd1[_0x6a4a('0x5a')],function(_0x5502d7){_0x5502d7[_0x6a4a('0x65')]=_0x98cbd1[_0x6a4a('0x53')]['id'];return _0x5502d7;});return db[_0x6a4a('0x9d')][_0x6a4a('0xe1')](_0x45ec8e,{'transaction':_0x3dadaf});});})[_0x6a4a('0x1d')](function(){return db[_0x6a4a('0x9d')][_0x6a4a('0x118')]({'where':{'ChatWebsiteId':_0x98cbd1[_0x6a4a('0x53')]['id']},'order':_0x6a4a('0x119')});});}})[_0x6a4a('0x1d')](respondWithResult(_0x1e2c6e,null))['catch'](handleError(_0x1e2c6e,null));};exports[_0x6a4a('0x11a')]=function(_0x44e6d6,_0x5a31eb,_0x1420e4){var _0x15d235={};var _0x2e9820={};var _0x40ea5f;var _0x2c4e82;return db[_0x6a4a('0x3a')][_0x6a4a('0x68')]({'where':{'id':_0x44e6d6['params']['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x5a31eb,null))['then'](function(_0x3db622){if(_0x3db622){_0x40ea5f=_0x3db622;_0x2e9820[_0x6a4a('0x3e')]=_[_0x6a4a('0x40')](db[_0x6a4a('0x9d')][_0x6a4a('0x3b')]);_0x2e9820[_0x6a4a('0x3f')]=_[_0x6a4a('0x40')](_0x44e6d6[_0x6a4a('0x3f')]);_0x2e9820[_0x6a4a('0x41')]=_['intersection'](_0x2e9820[_0x6a4a('0x3e')],_0x2e9820[_0x6a4a('0x3f')]);_0x15d235['attributes']=_[_0x6a4a('0x42')](_0x2e9820[_0x6a4a('0x3e')],qs[_0x6a4a('0x44')](_0x44e6d6[_0x6a4a('0x3f')]['fields']));_0x15d235[_0x6a4a('0x43')]=_0x15d235['attributes'][_0x6a4a('0x45')]?_0x15d235[_0x6a4a('0x43')]:_0x2e9820[_0x6a4a('0x3e')];_0x15d235[_0x6a4a('0x47')]=qs['sort'](_0x44e6d6[_0x6a4a('0x3f')][_0x6a4a('0x48')]);_0x15d235[_0x6a4a('0x49')]=qs[_0x6a4a('0x41')](_['pick'](_0x44e6d6[_0x6a4a('0x3f')],_0x2e9820['filters']));if(_0x44e6d6[_0x6a4a('0x3f')][_0x6a4a('0x4d')]){_0x15d235[_0x6a4a('0x49')]=_[_0x6a4a('0x57')](_0x15d235[_0x6a4a('0x49')],{'$or':_[_0x6a4a('0x4b')](_0x15d235[_0x6a4a('0x43')],function(_0x5b7844){var _0x309f20={};_0x309f20[_0x5b7844]={'$like':'%'+_0x44e6d6[_0x6a4a('0x3f')][_0x6a4a('0x4d')]+'%'};return _0x309f20;})});}_0x15d235=_['merge']({},_0x15d235,_0x44e6d6[_0x6a4a('0x4e')]);return _0x40ea5f[_0x6a4a('0x11a')](_0x15d235);}})[_0x6a4a('0x1d')](function(_0x5ac606){if(_0x5ac606){_0x2c4e82=_0x5ac606[_0x6a4a('0x45')];if(!_0x44e6d6[_0x6a4a('0x3f')][_0x6a4a('0x46')]('nolimit')){_0x15d235[_0x6a4a('0x2c')]=qs[_0x6a4a('0x2c')](_0x44e6d6['query'][_0x6a4a('0x2c')]);_0x15d235[_0x6a4a('0x2e')]=qs['offset'](_0x44e6d6['query'][_0x6a4a('0x2e')]);}return _0x40ea5f[_0x6a4a('0x11a')](_0x15d235);}})[_0x6a4a('0x1d')](function(_0x445085){if(_0x445085){return _0x445085?{'count':_0x2c4e82,'rows':_0x445085}:null;}})['then'](respondWithResult(_0x5a31eb,null))[_0x6a4a('0x51')](handleError(_0x5a31eb,null));};exports['addProactiveActions']=function(_0x181889,_0x57e4f2,_0x1ddf6e){return db[_0x6a4a('0x11b')]['find']({'where':{'id':_0x181889['params']['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x57e4f2,null))[_0x6a4a('0x1d')](function(_0x5f4406){if(_0x5f4406){return _0x5f4406['addProactiveActions'](_0x181889[_0x6a4a('0x5a')][_0x6a4a('0x6f')],_[_0x6a4a('0xf7')](_0x181889[_0x6a4a('0x5a')],[_0x6a4a('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x57e4f2,null))[_0x6a4a('0x51')](handleError(_0x57e4f2,null));};exports['getProactiveActions']=function(_0x18f861,_0x524cc0,_0x964158){var _0x48b3fd={};var _0x52adac={};var _0x49aebd;var _0x447d44;return db[_0x6a4a('0x3a')][_0x6a4a('0x68')]({'where':{'id':_0x18f861[_0x6a4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x524cc0,null))[_0x6a4a('0x1d')](function(_0x2ccc54){if(_0x2ccc54){_0x49aebd=_0x2ccc54;_0x52adac[_0x6a4a('0x3e')]=_[_0x6a4a('0x40')](db['ChatProactiveAction']['rawAttributes']);_0x52adac[_0x6a4a('0x3f')]=_['keys'](_0x18f861[_0x6a4a('0x3f')]);_0x52adac[_0x6a4a('0x41')]=_[_0x6a4a('0x42')](_0x52adac[_0x6a4a('0x3e')],_0x52adac[_0x6a4a('0x3f')]);_0x48b3fd[_0x6a4a('0x43')]=_[_0x6a4a('0x42')](_0x52adac[_0x6a4a('0x3e')],qs['fields'](_0x18f861[_0x6a4a('0x3f')][_0x6a4a('0x44')]));_0x48b3fd[_0x6a4a('0x43')]=_0x48b3fd[_0x6a4a('0x43')]['length']?_0x48b3fd[_0x6a4a('0x43')]:_0x52adac['model'];_0x48b3fd['order']=qs[_0x6a4a('0x48')](_0x18f861[_0x6a4a('0x3f')]['sort']);_0x48b3fd[_0x6a4a('0x49')]=qs['filters'](_['pick'](_0x18f861[_0x6a4a('0x3f')],_0x52adac['filters']));if(_0x18f861['query'][_0x6a4a('0x4d')]){_0x48b3fd['where']=_[_0x6a4a('0x57')](_0x48b3fd['where'],{'$or':_[_0x6a4a('0x4b')](_0x48b3fd['attributes'],function(_0x15b094){var _0x395c0a={};_0x395c0a[_0x15b094]={'$like':'%'+_0x18f861[_0x6a4a('0x3f')]['filter']+'%'};return _0x395c0a;})});}_0x48b3fd=_[_0x6a4a('0x57')]({},_0x48b3fd,_0x18f861[_0x6a4a('0x4e')]);return _0x49aebd[_0x6a4a('0x11c')](_0x48b3fd);}})[_0x6a4a('0x1d')](function(_0x4f4515){if(_0x4f4515){_0x447d44=_0x4f4515['length'];if(!_0x18f861['query'][_0x6a4a('0x46')]('nolimit')){_0x48b3fd[_0x6a4a('0x2c')]=qs[_0x6a4a('0x2c')](_0x18f861[_0x6a4a('0x3f')][_0x6a4a('0x2c')]);_0x48b3fd[_0x6a4a('0x2e')]=qs['offset'](_0x18f861[_0x6a4a('0x3f')][_0x6a4a('0x2e')]);}return _0x49aebd[_0x6a4a('0x11c')](_0x48b3fd);}})[_0x6a4a('0x1d')](function(_0x388220){if(_0x388220){return _0x388220?{'count':_0x447d44,'rows':_0x388220}:null;}})[_0x6a4a('0x1d')](respondWithResult(_0x524cc0,null))['catch'](handleError(_0x524cc0,null));};exports[_0x6a4a('0x11d')]=function(_0x3fdd73,_0x559843,_0x303dcf){var _0x7c27c3=_0x3fdd73[_0x6a4a('0x3f')]['online']==='false'?_0x6a4a('0x11e'):_0x6a4a('0x11f');return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'attributes':['id',_0x7c27c3],'where':{'id':_0x3fdd73['params']['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x559843,null))[_0x6a4a('0x1d')](function(_0xbd76a8){if(_0xbd76a8){var _0x273497=_0xbd76a8[_0x7c27c3];var _0x19bd52=_0x273497&&_0x273497[_0x6a4a('0x120')]?_0x273497[_0x6a4a('0x120')]:[];_0x559843[_0x6a4a('0x38')]({'fromKey':_[_0x6a4a('0x7f')](_0x273497['fromKey'])?undefined:_0x273497[_0x6a4a('0x121')],'count':_0x19bd52[_0x6a4a('0x45')],'rows':_0x19bd52});}})['catch'](handleError(_0x559843,null));};exports['getOfflineMessages']=function(_0x59bc97,_0x31b4e3,_0x4688c5){var _0x5b958f={'raw':![],'where':{}};var _0x2593c0={};var _0x36a1d9={'count':0x0,'rows':[]};return db[_0x6a4a('0x3a')][_0x6a4a('0x68')]({'where':{'id':_0x59bc97[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x31b4e3,null))['then'](function(_0x3c77de){if(_0x3c77de){_0x2593c0[_0x6a4a('0x3e')]=_[_0x6a4a('0x40')](db[_0x6a4a('0xd8')]['rawAttributes']);_0x2593c0['query']=_[_0x6a4a('0x40')](_0x59bc97[_0x6a4a('0x3f')]);_0x2593c0[_0x6a4a('0x41')]=_[_0x6a4a('0x42')](_0x2593c0[_0x6a4a('0x3e')],_0x2593c0[_0x6a4a('0x3f')]);_0x5b958f[_0x6a4a('0x43')]=_[_0x6a4a('0x42')](_0x2593c0['model'],qs[_0x6a4a('0x44')](_0x59bc97['query'][_0x6a4a('0x44')]));_0x5b958f['attributes']=_0x5b958f[_0x6a4a('0x43')][_0x6a4a('0x45')]?_0x5b958f['attributes']:_0x2593c0[_0x6a4a('0x3e')];if(!_0x59bc97[_0x6a4a('0x3f')][_0x6a4a('0x46')](_0x6a4a('0x6b'))){_0x5b958f[_0x6a4a('0x2c')]=qs[_0x6a4a('0x2c')](_0x59bc97[_0x6a4a('0x3f')][_0x6a4a('0x2c')]);_0x5b958f[_0x6a4a('0x2e')]=qs[_0x6a4a('0x2e')](_0x59bc97[_0x6a4a('0x3f')][_0x6a4a('0x2e')]);}_0x5b958f[_0x6a4a('0x47')]=qs[_0x6a4a('0x48')](_0x59bc97[_0x6a4a('0x3f')][_0x6a4a('0x48')]);_0x5b958f[_0x6a4a('0x49')]=qs['filters'](_[_0x6a4a('0x4a')](_0x59bc97[_0x6a4a('0x3f')],_0x2593c0['filters']));_0x5b958f['where']['ChatWebsiteId']=_0x3c77de['id'];if(_0x59bc97[_0x6a4a('0x3f')][_0x6a4a('0x4d')]){_0x5b958f[_0x6a4a('0x49')]=_['merge'](_0x5b958f[_0x6a4a('0x49')],{'$or':_[_0x6a4a('0x4b')](_0x5b958f[_0x6a4a('0x43')],function(_0x52b8e2){var _0x41f7d9={};_0x41f7d9[_0x52b8e2]={'$like':'%'+_0x59bc97['query'][_0x6a4a('0x4d')]+'%'};return _0x41f7d9;})});}_0x5b958f=_[_0x6a4a('0x57')]({},_0x5b958f,_0x59bc97[_0x6a4a('0x4e')]);return db['ChatOfflineMessage']['count']({'where':_0x5b958f[_0x6a4a('0x49')]})['then'](function(_0x497166){_0x36a1d9[_0x6a4a('0x2d')]=_0x497166;if(_0x59bc97[_0x6a4a('0x3f')][_0x6a4a('0x6c')]){_0x5b958f[_0x6a4a('0x56')]=[{'all':!![]}];}else{_0x5b958f[_0x6a4a('0x56')]=[{'model':db[_0x6a4a('0x9b')],'as':_0x6a4a('0xf9'),'required':![]},{'model':db['Attachment'],'as':_0x6a4a('0x122'),'required':![]}];}return db[_0x6a4a('0xd8')][_0x6a4a('0x4f')](_0x5b958f);})['then'](function(_0x910a9d){_0x36a1d9[_0x6a4a('0x50')]=_0x910a9d;return _0x36a1d9;});}})[_0x6a4a('0x1d')](respondWithFilteredResult(_0x31b4e3,_0x5b958f))[_0x6a4a('0x51')](handleError(_0x31b4e3,null));};exports['addAgents']=function(_0x4d78b7,_0x14ca5a,_0x41eb7d){return db['ChatWebsite'][_0x6a4a('0x58')]({'where':{'id':_0x4d78b7[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x14ca5a,null))[_0x6a4a('0x1d')](function(_0x143716){if(_0x143716){return _0x143716[_0x6a4a('0x123')](_0x4d78b7[_0x6a4a('0x5a')]['ids'],_['omit'](_0x4d78b7[_0x6a4a('0x5a')],[_0x6a4a('0x6f'),'id'])||{})[_0x6a4a('0xbd')](function(_0x59d700){for(var _0x5d5bdb=0x0;_0x5d5bdb<_0x4d78b7[_0x6a4a('0x5a')][_0x6a4a('0x6f')][_0x6a4a('0x45')];_0x5d5bdb+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x4d78b7[_0x6a4a('0x5a')][_0x6a4a('0x6f')][_0x5d5bdb]),'ChatWebsiteId':Number(_0x4d78b7[_0x6a4a('0x53')]['id'])});}return _0x59d700;});}})[_0x6a4a('0x1d')](respondWithResult(_0x14ca5a,null))[_0x6a4a('0x51')](handleError(_0x14ca5a,null));};exports[_0x6a4a('0x124')]=function(_0x27f4b2,_0x5b4bdf,_0x424ebf){return db[_0x6a4a('0x3a')][_0x6a4a('0x58')]({'where':{'id':_0x27f4b2[_0x6a4a('0x53')]['id']}})[_0x6a4a('0x1d')](handleEntityNotFound(_0x5b4bdf,null))[_0x6a4a('0x1d')](function(_0x217c3b){if(_0x217c3b){return _0x217c3b['removeAgents'](_0x27f4b2[_0x6a4a('0x3f')][_0x6a4a('0x6f')])['then'](function(){if(_[_0x6a4a('0x125')](_0x27f4b2[_0x6a4a('0x3f')][_0x6a4a('0x6f')])){for(var _0x466571=0x0;_0x466571<_0x27f4b2[_0x6a4a('0x3f')]['ids'][_0x6a4a('0x45')];_0x466571+=0x1){socket[_0x6a4a('0x126')](_0x6a4a('0x127'),{'UserId':Number(_0x27f4b2[_0x6a4a('0x3f')][_0x6a4a('0x6f')][_0x466571]),'ChatWebsiteId':Number(_0x27f4b2[_0x6a4a('0x53')]['id'])});}}else{socket['emit'](_0x6a4a('0x127'),{'UserId':Number(_0x27f4b2[_0x6a4a('0x3f')][_0x6a4a('0x6f')]),'ChatWebsiteId':Number(_0x27f4b2[_0x6a4a('0x53')]['id'])});}});}})[_0x6a4a('0x1d')](respondWithStatusCode(_0x5b4bdf,null))[_0x6a4a('0x51')](handleError(_0x5b4bdf,null));};exports['getAgents']=function(_0x17db2b,_0x3b80aa,_0xfc27ec){var _0x15bd74={};var _0x361d8f={};var _0x1c1ecd;var _0x457d83;return db['ChatWebsite'][_0x6a4a('0x68')]({'where':{'id':_0x17db2b[_0x6a4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b80aa,null))[_0x6a4a('0x1d')](function(_0xdeb1cc){if(_0xdeb1cc){_0x1c1ecd=_0xdeb1cc;_0x361d8f[_0x6a4a('0x3e')]=_[_0x6a4a('0x40')](db[_0x6a4a('0x128')][_0x6a4a('0x3b')]);_0x361d8f[_0x6a4a('0x3f')]=_[_0x6a4a('0x40')](_0x17db2b[_0x6a4a('0x3f')]);_0x361d8f[_0x6a4a('0x41')]=_[_0x6a4a('0x42')](_0x361d8f[_0x6a4a('0x3e')],_0x361d8f['query']);_0x15bd74[_0x6a4a('0x43')]=_[_0x6a4a('0x42')](_0x361d8f[_0x6a4a('0x3e')],qs[_0x6a4a('0x44')](_0x17db2b[_0x6a4a('0x3f')][_0x6a4a('0x44')]));_0x15bd74[_0x6a4a('0x43')]=_0x15bd74['attributes']['length']?_0x15bd74[_0x6a4a('0x43')]:_0x361d8f[_0x6a4a('0x3e')];_0x15bd74[_0x6a4a('0x47')]=qs['sort'](_0x17db2b[_0x6a4a('0x3f')][_0x6a4a('0x48')]);_0x15bd74[_0x6a4a('0x49')]=qs[_0x6a4a('0x41')](_[_0x6a4a('0x4a')](_0x17db2b['query'],_0x361d8f[_0x6a4a('0x41')]));if(_0x17db2b[_0x6a4a('0x3f')][_0x6a4a('0x4d')]){_0x15bd74[_0x6a4a('0x49')]=_[_0x6a4a('0x57')](_0x15bd74['where'],{'$or':_['map'](_0x15bd74[_0x6a4a('0x43')],function(_0x262cb3){var _0x12ac9c={};_0x12ac9c[_0x262cb3]={'$like':'%'+_0x17db2b[_0x6a4a('0x3f')][_0x6a4a('0x4d')]+'%'};return _0x12ac9c;})});}_0x15bd74=_[_0x6a4a('0x57')]({},_0x15bd74,_0x17db2b[_0x6a4a('0x4e')]);return _0x1c1ecd[_0x6a4a('0x129')](_0x15bd74);}})[_0x6a4a('0x1d')](function(_0x1f9b35){if(_0x1f9b35){_0x457d83=_0x1f9b35['length'];if(!_0x17db2b[_0x6a4a('0x3f')][_0x6a4a('0x46')]('nolimit')){_0x15bd74[_0x6a4a('0x2c')]=qs['limit'](_0x17db2b[_0x6a4a('0x3f')]['limit']);_0x15bd74[_0x6a4a('0x2e')]=qs[_0x6a4a('0x2e')](_0x17db2b[_0x6a4a('0x3f')][_0x6a4a('0x2e')]);}return _0x1c1ecd[_0x6a4a('0x129')](_0x15bd74);}})['then'](function(_0x345e75){if(_0x345e75){return _0x345e75?{'count':_0x457d83,'rows':_0x345e75}:null;}})['then'](respondWithResult(_0x3b80aa,null))[_0x6a4a('0x51')](handleError(_0x3b80aa,null));}; \ No newline at end of file +var _0x8c72=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','ChatWebsiteId','Disposition','rows','removeDispositions','CannedAnswer','findOne','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','chat','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','list','applications','orderBy','priority','asc','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','MailAccountId','originalname','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','custom','License','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','alignment','textColor','color_button','addApplications','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','get','ChatWebsites','destroy','end','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','params','length','find','create','body','user'];(function(_0x2e76e3,_0x2ea7f4){var _0x37a119=function(_0x4f8827){while(--_0x4f8827){_0x2e76e3['push'](_0x2e76e3['shift']());}};_0x37a119(++_0x2ea7f4);}(_0x8c72,0xd5));var _0x28c7=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x8c72[_0x286bfb];return _0x52b683;};'use strict';var emlformat=require(_0x28c7('0x0'));var rimraf=require(_0x28c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x28c7('0x2'));var moment=require(_0x28c7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x28c7('0x4'));var util=require('util');var path=require(_0x28c7('0x5'));var sox=require('sox');var csv=require(_0x28c7('0x6'));var ejs=require(_0x28c7('0x7'));var fs=require('fs');var fs_extra=require(_0x28c7('0x8'));var _=require(_0x28c7('0x9'));var squel=require(_0x28c7('0xa'));var crypto=require(_0x28c7('0xb'));var jsforce=require(_0x28c7('0xc'));var deskjs=require(_0x28c7('0xd'));var toCsv=require(_0x28c7('0x6'));var querystring=require('querystring');var Papa=require(_0x28c7('0xe'));var Redis=require(_0x28c7('0xf'));var authService=require(_0x28c7('0x10'));var qs=require(_0x28c7('0x11'));var as=require(_0x28c7('0x12'));var hardwareService=require(_0x28c7('0x13'));var logger=require(_0x28c7('0x14'))(_0x28c7('0x15'));var utils=require(_0x28c7('0x16'));var config=require(_0x28c7('0x17'));var licenseUtil=require(_0x28c7('0x18'));var db=require('../../mysqldb')['db'];config[_0x28c7('0x19')]=_[_0x28c7('0x1a')](config[_0x28c7('0x19')],{'host':_0x28c7('0x1b'),'port':0x18eb});var socket=require(_0x28c7('0x1c'))(new Redis(config['redis']));require(_0x28c7('0x1d'))[_0x28c7('0x1e')](socket);var jayson=require(_0x28c7('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x28c7('0x20')]['http']({'port':0x232a});var client9003=jayson[_0x28c7('0x20')][_0x28c7('0x21')]({'port':0x232b});var client9001=jayson[_0x28c7('0x20')]['http']({'port':0x2329});function respondWithRpcPromise(_0x58e8a1,_0x442d7f,_0x2f48f8,_0x47109e){return new BPromise(function(_0x2f3346,_0xe16381){var _0x3fd134=_0x47109e||client;return _0x3fd134[_0x28c7('0x22')](_0x58e8a1,_0x2f48f8)[_0x28c7('0x23')](function(_0x419f27){logger[_0x28c7('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x442d7f,_0x28c7('0x25'));logger[_0x28c7('0x26')](_0x28c7('0x27'),_0x442d7f,'request\x20sent',JSON['stringify'](_0x419f27));if(_0x419f27[_0x28c7('0x28')]){if(_0x419f27[_0x28c7('0x28')][_0x28c7('0x29')]===0x1f4){logger[_0x28c7('0x28')](_0x28c7('0x2a'),_0x442d7f,_0x419f27['error']['message']);return _0xe16381(_0x419f27[_0x28c7('0x28')][_0x28c7('0x2b')]);}logger[_0x28c7('0x28')](_0x28c7('0x2a'),_0x442d7f,_0x419f27[_0x28c7('0x28')]['message']);return _0x2f3346(_0x419f27['error'][_0x28c7('0x2b')]);}else{logger['info'](_0x28c7('0x2a'),_0x442d7f,_0x28c7('0x25'));_0x2f3346(_0x419f27[_0x28c7('0x2c')][_0x28c7('0x2b')]);}})[_0x28c7('0x2d')](function(_0x4ecd19){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x442d7f,_0x4ecd19);_0xe16381(_0x4ecd19);});});}function respondWithStatusCode(_0x57fa91,_0x30c0aa){_0x30c0aa=_0x30c0aa||0xcc;return function(_0x42377f){if(_0x42377f){return _0x57fa91[_0x28c7('0x2e')](_0x30c0aa);}return _0x57fa91[_0x28c7('0x2f')](_0x30c0aa)['end']();};}function respondWithResult(_0xaafc13,_0x16c70b){_0x16c70b=_0x16c70b||0xc8;return function(_0x10a3c2){if(_0x10a3c2){return _0xaafc13[_0x28c7('0x2f')](_0x16c70b)[_0x28c7('0x30')](_0x10a3c2);}};}function respondWithFilteredResult(_0x159202,_0x1dc049){return function(_0x12e097){if(_0x12e097){var _0xacaea2=typeof _0x1dc049[_0x28c7('0x31')]===_0x28c7('0x32')&&typeof _0x1dc049[_0x28c7('0x33')]==='undefined';var _0x1763ca=_0x12e097[_0x28c7('0x34')];var _0x5b6bbb=_0xacaea2?0x0:_0x1dc049['offset'];var _0x3a2d63=_0xacaea2?_0x12e097[_0x28c7('0x34')]:_0x1dc049[_0x28c7('0x31')]+_0x1dc049['limit'];var _0x2d16b5;if(_0x3a2d63>=_0x1763ca){_0x3a2d63=_0x1763ca;_0x2d16b5=0xc8;}else{_0x2d16b5=0xce;}_0x159202[_0x28c7('0x2f')](_0x2d16b5);return _0x159202['set']('Content-Range',_0x5b6bbb+'-'+_0x3a2d63+'/'+_0x1763ca)[_0x28c7('0x30')](_0x12e097);}return null;};}function patchUpdates(_0x50e2fd){return function(_0x17e7c9){try{jsonpatch[_0x28c7('0x35')](_0x17e7c9,_0x50e2fd,!![]);}catch(_0x5e8802){return BPromise['reject'](_0x5e8802);}return _0x17e7c9[_0x28c7('0x36')]();};}function saveUpdates(_0x27ad2c,_0xce2738){return function(_0x3792d3){if(_0x3792d3){return _0x3792d3[_0x28c7('0x37')](_0x27ad2c)['then'](function(_0x4c9753){return _0x4c9753;});}return null;};}function removeEntity(_0x56c9f0,_0x289ab9){return function(_0x379aa4){if(_0x379aa4){return _0x379aa4['destroy']()[_0x28c7('0x23')](function(){var _0x414a6e=_0x379aa4[_0x28c7('0x38')]({'plain':!![]});var _0xd90180=_0x28c7('0x39');return db['UserProfileResource'][_0x28c7('0x3a')]({'where':{'type':_0xd90180,'resourceId':_0x414a6e['id']}})['then'](function(){return _0x379aa4;});})[_0x28c7('0x23')](function(){_0x56c9f0['status'](0xcc)[_0x28c7('0x3b')]();});}};}function handleEntityNotFound(_0x201baf,_0x18eaac){return function(_0xad0b3f){if(!_0xad0b3f){_0x201baf[_0x28c7('0x2e')](0x194);}return _0xad0b3f;};}function handleError(_0x419d4d,_0x4438d2){_0x4438d2=_0x4438d2||0x1f4;return function(_0x2ecebe){logger[_0x28c7('0x28')](_0x2ecebe[_0x28c7('0x3c')]);if(_0x2ecebe[_0x28c7('0x3d')]){delete _0x2ecebe[_0x28c7('0x3d')];}_0x419d4d['status'](_0x4438d2)[_0x28c7('0x3e')](_0x2ecebe);};}exports[_0x28c7('0x3f')]=function(_0x3523da,_0x4bfa22){var _0x1da00a={'include':[{'model':db[_0x28c7('0x40')],'as':'mandatoryDispositionPause'}]},_0x51f907={},_0x394307={'count':0x0,'rows':[]};var _0x59d5fa=_[_0x28c7('0x41')](db[_0x28c7('0x42')][_0x28c7('0x43')],function(_0x5011a5){return{'name':_0x5011a5[_0x28c7('0x44')],'type':_0x5011a5['type'][_0x28c7('0x45')]};});_0x51f907[_0x28c7('0x46')]=_[_0x28c7('0x41')](_0x59d5fa,_0x28c7('0x3d'));_0x51f907[_0x28c7('0x47')]=_[_0x28c7('0x48')](_0x3523da['query']);_0x51f907[_0x28c7('0x49')]=_[_0x28c7('0x4a')](_0x51f907[_0x28c7('0x46')],_0x51f907['query']);_0x1da00a[_0x28c7('0x4b')]=_[_0x28c7('0x4a')](_0x51f907[_0x28c7('0x46')],qs['fields'](_0x3523da[_0x28c7('0x47')][_0x28c7('0x4c')]));_0x1da00a[_0x28c7('0x4b')]=_0x1da00a[_0x28c7('0x4b')]['length']?_0x1da00a[_0x28c7('0x4b')]:_0x51f907[_0x28c7('0x46')];if(!_0x3523da[_0x28c7('0x47')][_0x28c7('0x4d')](_0x28c7('0x4e'))){_0x1da00a[_0x28c7('0x33')]=qs[_0x28c7('0x33')](_0x3523da[_0x28c7('0x47')]['limit']);_0x1da00a['offset']=qs['offset'](_0x3523da[_0x28c7('0x47')]['offset']);}_0x1da00a[_0x28c7('0x4f')]=qs[_0x28c7('0x50')](_0x3523da[_0x28c7('0x47')]['sort']);_0x1da00a[_0x28c7('0x51')]=qs[_0x28c7('0x49')](_[_0x28c7('0x52')](_0x3523da[_0x28c7('0x47')],_0x51f907[_0x28c7('0x49')]),_0x59d5fa);if(_0x3523da[_0x28c7('0x47')]['filter']){_0x1da00a['where']=_[_0x28c7('0x53')](_0x1da00a[_0x28c7('0x51')],{'$or':_[_0x28c7('0x41')](_0x59d5fa,function(_0xd308dd){if(_0xd308dd[_0x28c7('0x54')]!==_0x28c7('0x55')){var _0x20033a={};_0x20033a[_0xd308dd[_0x28c7('0x3d')]]={'$like':'%'+_0x3523da[_0x28c7('0x47')][_0x28c7('0x56')]+'%'};return _0x20033a;}})});}_0x1da00a=_[_0x28c7('0x53')]({},_0x1da00a,_0x3523da[_0x28c7('0x57')]);var _0x2a5e18={'where':_0x1da00a[_0x28c7('0x51')]};return db['ChatWebsite']['count'](_0x2a5e18)['then'](function(_0x3ea9a9){_0x394307[_0x28c7('0x34')]=_0x3ea9a9;if(_0x3523da[_0x28c7('0x47')][_0x28c7('0x58')]){_0x1da00a[_0x28c7('0x59')]=[{'all':!![]}];}return db[_0x28c7('0x42')][_0x28c7('0x5a')](_0x1da00a);})[_0x28c7('0x23')](function(_0x3dbe47){_0x394307['rows']=_0x3dbe47;return _0x394307;})['then'](respondWithFilteredResult(_0x4bfa22,_0x1da00a))['catch'](handleError(_0x4bfa22,null));};exports['show']=function(_0x31a44a,_0x1987d8){var _0x14ff60={'raw':![],'where':{'id':_0x31a44a[_0x28c7('0x5b')]['id']},'include':[{'model':db[_0x28c7('0x40')],'as':'mandatoryDispositionPause'}]},_0x301061={};_0x301061[_0x28c7('0x46')]=_[_0x28c7('0x48')](db[_0x28c7('0x42')]['rawAttributes']);_0x301061[_0x28c7('0x47')]=_[_0x28c7('0x48')](_0x31a44a[_0x28c7('0x47')]);_0x301061[_0x28c7('0x49')]=_['intersection'](_0x301061['model'],_0x301061[_0x28c7('0x47')]);_0x14ff60[_0x28c7('0x4b')]=_['intersection'](_0x301061[_0x28c7('0x46')],qs[_0x28c7('0x4c')](_0x31a44a[_0x28c7('0x47')][_0x28c7('0x4c')]));_0x14ff60['attributes']=_0x14ff60[_0x28c7('0x4b')][_0x28c7('0x5c')]?_0x14ff60[_0x28c7('0x4b')]:_0x301061[_0x28c7('0x46')];if(_0x31a44a[_0x28c7('0x47')][_0x28c7('0x58')]){_0x14ff60[_0x28c7('0x59')]=[{'all':!![]}];}_0x14ff60=_[_0x28c7('0x53')]({},_0x14ff60,_0x31a44a['options']);return db[_0x28c7('0x42')][_0x28c7('0x5d')](_0x14ff60)['then'](handleEntityNotFound(_0x1987d8,null))['then'](respondWithResult(_0x1987d8,null))['catch'](handleError(_0x1987d8,null));};exports['create']=function(_0x4e21f2,_0x2b7167){return db['ChatWebsite'][_0x28c7('0x5e')](_0x4e21f2[_0x28c7('0x5f')],{})[_0x28c7('0x23')](function(_0x5edd13){var _0xf0f5d0=_0x4e21f2[_0x28c7('0x60')]['get']({'plain':!![]});if(!_0xf0f5d0)throw new Error(_0x28c7('0x61'));if(_0xf0f5d0[_0x28c7('0x62')]===_0x28c7('0x60')){var _0x4ff964=_0x5edd13[_0x28c7('0x38')]({'plain':!![]});var _0x113686=_0x28c7('0x39');return db['UserProfileSection'][_0x28c7('0x5d')]({'where':{'name':_0x113686,'userProfileId':_0xf0f5d0[_0x28c7('0x63')]},'raw':!![]})[_0x28c7('0x23')](function(_0x1d1e17){if(_0x1d1e17&&_0x1d1e17[_0x28c7('0x64')]===0x0){return db[_0x28c7('0x65')][_0x28c7('0x5e')]({'name':_0x4ff964['name'],'resourceId':_0x4ff964['id'],'type':_0x1d1e17[_0x28c7('0x3d')],'sectionId':_0x1d1e17['id']},{})[_0x28c7('0x23')](function(){return _0x5edd13;});}else{return _0x5edd13;}})[_0x28c7('0x2d')](function(_0x4110d9){logger['error'](_0x28c7('0x66'),_0x4110d9);throw _0x4110d9;});}return _0x5edd13;})['then'](respondWithResult(_0x2b7167,0xc9))[_0x28c7('0x2d')](handleError(_0x2b7167,null));};exports[_0x28c7('0x37')]=function(_0x1a482d,_0x1cad7e){if(_0x1a482d['body']['id']){delete _0x1a482d[_0x28c7('0x5f')]['id'];}return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x1a482d[_0x28c7('0x5b')]['id']},'include':[{'model':db[_0x28c7('0x40')],'as':_0x28c7('0x67')}]})['then'](handleEntityNotFound(_0x1cad7e,null))['then'](saveUpdates(_0x1a482d['body'],null))[_0x28c7('0x23')](respondWithResult(_0x1cad7e,null))[_0x28c7('0x2d')](handleError(_0x1cad7e,null));};exports[_0x28c7('0x3a')]=function(_0x2db69b,_0x67674b){return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x2db69b[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x67674b,null))[_0x28c7('0x23')](removeEntity(_0x67674b,null))[_0x28c7('0x2d')](handleError(_0x67674b,null));};exports[_0x28c7('0x68')]=function(_0x38421a,_0x431418){return db[_0x28c7('0x42')][_0x28c7('0x68')]()[_0x28c7('0x23')](respondWithResult(_0x431418,null))[_0x28c7('0x2d')](handleError(_0x431418,null));};exports['addDisposition']=function(_0x3675e8,_0x2741e4,_0x2a5cdb){if(_0x3675e8[_0x28c7('0x5f')]['id']){delete _0x3675e8[_0x28c7('0x5f')]['id'];}return db['ChatWebsite'][_0x28c7('0x5d')]({'where':{'id':_0x3675e8[_0x28c7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2741e4,null))['then'](function(_0x4721de){if(_0x4721de){_0x3675e8[_0x28c7('0x5f')][_0x28c7('0x69')]=_0x4721de['id'];return db[_0x28c7('0x6a')][_0x28c7('0x5e')](_0x3675e8['body']);}})[_0x28c7('0x23')](respondWithResult(_0x2741e4,null))[_0x28c7('0x2d')](handleError(_0x2741e4,null));};exports['getDispositions']=function(_0xc1a6f7,_0x2716a2,_0x487291){var _0x252ed0={'raw':![],'where':{}};var _0x2b78e3={};var _0x167b72={'count':0x0,'rows':[]};return db[_0x28c7('0x42')]['findOne']({'where':{'id':_0xc1a6f7[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x2716a2,null))['then'](function(_0x4d1305){if(_0x4d1305){_0x2b78e3[_0x28c7('0x46')]=_[_0x28c7('0x48')](db[_0x28c7('0x6a')][_0x28c7('0x43')]);_0x2b78e3[_0x28c7('0x47')]=_[_0x28c7('0x48')](_0xc1a6f7[_0x28c7('0x47')]);_0x2b78e3[_0x28c7('0x49')]=_['intersection'](_0x2b78e3[_0x28c7('0x46')],_0x2b78e3[_0x28c7('0x47')]);_0x252ed0[_0x28c7('0x4b')]=_[_0x28c7('0x4a')](_0x2b78e3['model'],qs[_0x28c7('0x4c')](_0xc1a6f7['query']['fields']));_0x252ed0[_0x28c7('0x4b')]=_0x252ed0[_0x28c7('0x4b')][_0x28c7('0x5c')]?_0x252ed0[_0x28c7('0x4b')]:_0x2b78e3['model'];if(!_0xc1a6f7['query'][_0x28c7('0x4d')](_0x28c7('0x4e'))){_0x252ed0[_0x28c7('0x33')]=qs[_0x28c7('0x33')](_0xc1a6f7[_0x28c7('0x47')][_0x28c7('0x33')]);_0x252ed0[_0x28c7('0x31')]=qs[_0x28c7('0x31')](_0xc1a6f7[_0x28c7('0x47')]['offset']);}_0x252ed0[_0x28c7('0x4f')]=qs[_0x28c7('0x50')](_0xc1a6f7[_0x28c7('0x47')][_0x28c7('0x50')]);_0x252ed0[_0x28c7('0x51')]=qs[_0x28c7('0x49')](_[_0x28c7('0x52')](_0xc1a6f7[_0x28c7('0x47')],_0x2b78e3[_0x28c7('0x49')]));_0x252ed0[_0x28c7('0x51')][_0x28c7('0x69')]=_0x4d1305['id'];if(_0xc1a6f7[_0x28c7('0x47')]['filter']){_0x252ed0['where']=_['merge'](_0x252ed0[_0x28c7('0x51')],{'$or':_[_0x28c7('0x41')](_0x252ed0[_0x28c7('0x4b')],function(_0x9ec6d2){var _0x1c1062={};_0x1c1062[_0x9ec6d2]={'$like':'%'+_0xc1a6f7[_0x28c7('0x47')][_0x28c7('0x56')]+'%'};return _0x1c1062;})});}_0x252ed0=_[_0x28c7('0x53')]({},_0x252ed0,_0xc1a6f7['options']);return db[_0x28c7('0x6a')][_0x28c7('0x34')]({'where':_0x252ed0[_0x28c7('0x51')]})['then'](function(_0x19243e){_0x167b72[_0x28c7('0x34')]=_0x19243e;if(_0xc1a6f7[_0x28c7('0x47')][_0x28c7('0x58')]){_0x252ed0['include']=[{'all':!![]}];}return db[_0x28c7('0x6a')][_0x28c7('0x5a')](_0x252ed0);})['then'](function(_0x5e7c9b){_0x167b72[_0x28c7('0x6b')]=_0x5e7c9b;return _0x167b72;});}})[_0x28c7('0x23')](respondWithFilteredResult(_0x2716a2,_0x252ed0))['catch'](handleError(_0x2716a2,null));};exports[_0x28c7('0x6c')]=function(_0x5266da,_0x3ab8c7,_0x2aa105){return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x5266da[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x3ab8c7,null))[_0x28c7('0x23')](function(_0x40ae0d){if(_0x40ae0d){return _0x40ae0d[_0x28c7('0x6c')](_0x5266da[_0x28c7('0x47')]['ids']);}})[_0x28c7('0x23')](respondWithStatusCode(_0x3ab8c7,null))[_0x28c7('0x2d')](handleError(_0x3ab8c7,null));};exports['addAnswer']=function(_0x3d44d0,_0x4ba03f,_0x3dd140){if(_0x3d44d0['body']['id']){delete _0x3d44d0[_0x28c7('0x5f')]['id'];}return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x3d44d0['params']['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x4ba03f,null))[_0x28c7('0x23')](function(_0x4ba5cd){if(_0x4ba5cd){_0x3d44d0['body'][_0x28c7('0x69')]=_0x4ba5cd['id'];return db[_0x28c7('0x6d')][_0x28c7('0x5e')](_0x3d44d0[_0x28c7('0x5f')]);}})[_0x28c7('0x23')](respondWithResult(_0x4ba03f,null))[_0x28c7('0x2d')](handleError(_0x4ba03f,null));};exports['getAnswers']=function(_0xdff11,_0x2e8afa,_0xf1d494){var _0x2994c6={'raw':![],'where':{}};var _0x332716={};var _0x1d3c3d={'count':0x0,'rows':[]};return db[_0x28c7('0x42')][_0x28c7('0x6e')]({'where':{'id':_0xdff11[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x2e8afa,null))[_0x28c7('0x23')](function(_0x446696){if(_0x446696){_0x332716[_0x28c7('0x46')]=_['keys'](db[_0x28c7('0x6d')][_0x28c7('0x43')]);_0x332716[_0x28c7('0x47')]=_[_0x28c7('0x48')](_0xdff11[_0x28c7('0x47')]);_0x332716['filters']=_[_0x28c7('0x4a')](_0x332716[_0x28c7('0x46')],_0x332716[_0x28c7('0x47')]);_0x2994c6[_0x28c7('0x4b')]=_[_0x28c7('0x4a')](_0x332716[_0x28c7('0x46')],qs[_0x28c7('0x4c')](_0xdff11['query'][_0x28c7('0x4c')]));_0x2994c6[_0x28c7('0x4b')]=_0x2994c6[_0x28c7('0x4b')][_0x28c7('0x5c')]?_0x2994c6[_0x28c7('0x4b')]:_0x332716[_0x28c7('0x46')];if(!_0xdff11[_0x28c7('0x47')][_0x28c7('0x4d')](_0x28c7('0x4e'))){_0x2994c6[_0x28c7('0x33')]=qs[_0x28c7('0x33')](_0xdff11[_0x28c7('0x47')][_0x28c7('0x33')]);_0x2994c6[_0x28c7('0x31')]=qs[_0x28c7('0x31')](_0xdff11[_0x28c7('0x47')][_0x28c7('0x31')]);}_0x2994c6[_0x28c7('0x4f')]=qs[_0x28c7('0x50')](_0xdff11[_0x28c7('0x47')][_0x28c7('0x50')]);_0x2994c6['where']=qs[_0x28c7('0x49')](_['pick'](_0xdff11['query'],_0x332716[_0x28c7('0x49')]));_0x2994c6[_0x28c7('0x51')][_0x28c7('0x69')]=_0x446696['id'];if(_0xdff11[_0x28c7('0x47')][_0x28c7('0x56')]){_0x2994c6[_0x28c7('0x51')]=_[_0x28c7('0x53')](_0x2994c6['where'],{'$or':_['map'](_0x2994c6[_0x28c7('0x4b')],function(_0x24646a){var _0x149f81={};_0x149f81[_0x24646a]={'$like':'%'+_0xdff11[_0x28c7('0x47')][_0x28c7('0x56')]+'%'};return _0x149f81;})});}_0x2994c6=_[_0x28c7('0x53')]({},_0x2994c6,_0xdff11[_0x28c7('0x57')]);return db['CannedAnswer'][_0x28c7('0x34')]({'where':_0x2994c6[_0x28c7('0x51')]})[_0x28c7('0x23')](function(_0x2b3735){_0x1d3c3d[_0x28c7('0x34')]=_0x2b3735;if(_0xdff11[_0x28c7('0x47')][_0x28c7('0x58')]){_0x2994c6[_0x28c7('0x59')]=[{'all':!![]}];}return db[_0x28c7('0x6d')][_0x28c7('0x5a')](_0x2994c6);})[_0x28c7('0x23')](function(_0x3f980f){_0x1d3c3d['rows']=_0x3f980f;return _0x1d3c3d;});}})['then'](respondWithFilteredResult(_0x2e8afa,_0x2994c6))['catch'](handleError(_0x2e8afa,null));};exports['removeAnswers']=function(_0x512cc4,_0x349e7c,_0x169ca0){return db['ChatWebsite'][_0x28c7('0x5d')]({'where':{'id':_0x512cc4[_0x28c7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x349e7c,null))['then'](function(_0x45b4e4){if(_0x45b4e4){return _0x45b4e4[_0x28c7('0x6f')](_0x512cc4[_0x28c7('0x47')][_0x28c7('0x70')]);}})[_0x28c7('0x23')](respondWithStatusCode(_0x349e7c,null))['catch'](handleError(_0x349e7c,null));};exports[_0x28c7('0x71')]=function(_0x80e2fb,_0xfdab7d,_0x25c705){_0x80e2fb[_0x28c7('0x5f')][_0x28c7('0x72')]=_0x80e2fb[_0x28c7('0x73')][_0x28c7('0x74')];return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x80e2fb['params']['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0xfdab7d,null))[_0x28c7('0x23')](saveUpdates(_0x80e2fb[_0x28c7('0x5f')],null))[_0x28c7('0x23')](respondWithResult(_0xfdab7d,null))[_0x28c7('0x2d')](handleError(_0xfdab7d,null));};exports[_0x28c7('0x75')]=function(_0x41eaff,_0x193995,_0x26c6bb){_0x41eaff[_0x28c7('0x5f')][_0x28c7('0x76')]=_0x41eaff[_0x28c7('0x73')][_0x28c7('0x74')];return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x41eaff[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x193995,null))[_0x28c7('0x23')](saveUpdates(_0x41eaff[_0x28c7('0x5f')],null))[_0x28c7('0x23')](respondWithResult(_0x193995,null))[_0x28c7('0x2d')](handleError(_0x193995,null));};exports[_0x28c7('0x77')]=function(_0x413791,_0x5b24f1,_0x6838cd){_0x413791['body'][_0x28c7('0x78')]=_0x413791[_0x28c7('0x73')][_0x28c7('0x74')];return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x413791[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x5b24f1,null))['then'](saveUpdates(_0x413791[_0x28c7('0x5f')],null))[_0x28c7('0x23')](respondWithResult(_0x5b24f1,null))[_0x28c7('0x2d')](handleError(_0x5b24f1,null));};exports[_0x28c7('0x79')]=function(_0x2f8dd5,_0x1e9ba3,_0x17c453){_0x2f8dd5['body'][_0x28c7('0x7a')]=_0x2f8dd5[_0x28c7('0x73')][_0x28c7('0x74')];return db['ChatWebsite'][_0x28c7('0x5d')]({'where':{'id':_0x2f8dd5[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x1e9ba3,null))[_0x28c7('0x23')](saveUpdates(_0x2f8dd5[_0x28c7('0x5f')],null))['then'](respondWithResult(_0x1e9ba3,null))[_0x28c7('0x2d')](handleError(_0x1e9ba3,null));};exports['getLogo']=function(_0x47ce45,_0x486745,_0x516f69){var _0x448475=path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0x7d'));var _0x22aced={'where':{'id':_0x47ce45[_0x28c7('0x5b')]['id']},'attributes':['id',_0x28c7('0x72')],'raw':!![]};var _0x5a083c=![];return require(_0x28c7('0x18'))[_0x28c7('0x7e')]()[_0x28c7('0x23')](function(_0x5e2951){if(_0x5e2951){_0x5a083c=_0x5e2951['custom'];}})[_0x28c7('0x23')](function(){return db['ChatWebsite']['find'](_0x22aced);})[_0x28c7('0x23')](handleEntityNotFound(_0x486745,null))[_0x28c7('0x23')](function(_0x1fde4f){if(_0x1fde4f){if(!_[_0x28c7('0x7f')](_0x1fde4f[_0x28c7('0x72')])){if(fs[_0x28c7('0x80')](path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0x81'),_0x1fde4f[_0x28c7('0x72')]))&&_0x5a083c){_0x448475=path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],'server/files/images/logos/',_0x1fde4f['sitepic']);}}return _0x486745[_0x28c7('0x82')](_0x448475);}})[_0x28c7('0x2d')](handleError(_0x486745,null));};exports[_0x28c7('0x83')]=function(_0x374ac8,_0xcdbaf5,_0x486844){var _0x5dc468=path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],'server/files/images/avatars/default_avatar.png');var _0x5f0261={'where':{'id':_0x374ac8[_0x28c7('0x5b')]['id']},'attributes':['id',_0x28c7('0x76')],'raw':!![]};return db[_0x28c7('0x42')][_0x28c7('0x5d')](_0x5f0261)['then'](handleEntityNotFound(_0xcdbaf5,null))[_0x28c7('0x23')](function(_0x49fc55){if(_0x49fc55){if(!_[_0x28c7('0x7f')](_0x49fc55['agentAvatar'])){if(fs['existsSync'](path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],'server/files/images/avatars/',_0x49fc55['agentAvatar']))){_0x5dc468=path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],'server/files/images/avatars/',_0x49fc55['agentAvatar']);}}return _0xcdbaf5[_0x28c7('0x82')](_0x5dc468);}})[_0x28c7('0x2d')](handleError(_0xcdbaf5,null));};exports[_0x28c7('0x84')]=function(_0x2b2333,_0xc03bcb,_0x2e16b9){var _0x1fd5ba=path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0x85'));var _0x174a17={'where':{'id':_0x2b2333[_0x28c7('0x5b')]['id']},'attributes':['id',_0x28c7('0x78'),_0x28c7('0x86')],'raw':!![]};return db[_0x28c7('0x42')]['find'](_0x174a17)[_0x28c7('0x23')](handleEntityNotFound(_0xc03bcb,null))[_0x28c7('0x23')](function(_0x4d32e0){if(_0x4d32e0){if(!_[_0x28c7('0x7f')](_0x4d32e0[_0x28c7('0x78')])){if(fs[_0x28c7('0x80')](path['join'](config[_0x28c7('0x7c')],_0x28c7('0x87'),_0x4d32e0['customerAvatar']))&&_0x4d32e0[_0x28c7('0x86')]){_0x1fd5ba=path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0x87'),_0x4d32e0[_0x28c7('0x78')]);}}return _0xc03bcb[_0x28c7('0x82')](_0x1fd5ba);}})[_0x28c7('0x2d')](handleError(_0xc03bcb,null));};exports[_0x28c7('0x88')]=function(_0x45e1e5,_0x189f96,_0xb3a97a){var _0x19003f=path['join'](config[_0x28c7('0x7c')],_0x28c7('0x89'));var _0x3b725e={'where':{'id':_0x45e1e5[_0x28c7('0x5b')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x28c7('0x42')][_0x28c7('0x5d')](_0x3b725e)[_0x28c7('0x23')](handleEntityNotFound(_0x189f96,null))[_0x28c7('0x23')](function(_0x37dc00){if(_0x37dc00){if(!_[_0x28c7('0x7f')](_0x37dc00[_0x28c7('0x7a')])){if(fs[_0x28c7('0x80')](path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0x87'),_0x37dc00['systemAvatar']))){_0x19003f=path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0x87'),_0x37dc00[_0x28c7('0x7a')]);}}return _0x189f96[_0x28c7('0x82')](_0x19003f);}})[_0x28c7('0x2d')](handleError(_0x189f96,null));};exports[_0x28c7('0x8a')]=function(_0x4b3804,_0x4a3f94,_0x3d9ab3){var _0x4ee991=require('user-agent-parser');var _0x3a4b52=new _0x4ee991();var _0x24c654=_0x3a4b52[_0x28c7('0x8b')](_0x4b3804[_0x28c7('0x8c')]['user-agent'])['getResult']();var _0x154f7a={'body':_0x4b3804[_0x28c7('0x5f')],'channel':_0x28c7('0x8d')};var _0x428ef5=[];var _0x25a201=[];var _0x4f8ea0={};var _0x205620=![];return db['CmContact'][_0x28c7('0x68')]()[_0x28c7('0x23')](function(_0x2960fc){if(!_0x2960fc){throw new db[(_0x28c7('0x8e'))]['ValidationError'](_0x28c7('0x8f'));}_0x428ef5=_[_0x28c7('0x90')](_['keys'](_0x2960fc),[_0x28c7('0x91'),_0x28c7('0x92')]);_0x25a201=_[_0x28c7('0x90')](_['keys'](_0x2960fc),[_0x28c7('0x91'),_0x28c7('0x92'),'CompanyId',_0x28c7('0x93')]);if(_0x4b3804[_0x28c7('0x5f')]['id']){delete _0x4b3804[_0x28c7('0x5f')]['id'];}if(_[_0x28c7('0x7f')](_0x4b3804[_0x28c7('0x5f')][_0x28c7('0x94')])){throw new db[(_0x28c7('0x8e'))][(_0x28c7('0x95'))](_0x28c7('0x96'));}if(_[_0x28c7('0x7f')](_0x4b3804[_0x28c7('0x5f')]['body'])||_0x4b3804[_0x28c7('0x5f')][_0x28c7('0x5f')]===''){throw new db[(_0x28c7('0x8e'))]['ValidationError'](_0x28c7('0x97'));}if(_[_0x28c7('0x7f')](_0x4b3804['body'][_0x28c7('0x98')])){throw new db['Sequelize'][(_0x28c7('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25a201);}if(!_[_0x28c7('0x99')](_0x25a201,_0x4b3804['body'][_0x28c7('0x98')])){throw new db[(_0x28c7('0x8e'))][(_0x28c7('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25a201);}_0x4f8ea0[_0x4b3804['body']['mapKey']]=_0x4b3804[_0x28c7('0x5f')][_0x28c7('0x94')];})[_0x28c7('0x23')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4b3804[_0x28c7('0x5b')]['id']},'include':[{'model':db[_0x28c7('0x9a')],'as':_0x28c7('0x9b'),'include':[{'model':db[_0x28c7('0x9c')],'as':_0x28c7('0x9d'),'where':_0x4f8ea0,'limit':0x1,'order':[['updatedAt',_0x28c7('0x9e')]]}]},{'model':db[_0x28c7('0x9f')],'as':_0x28c7('0xa0')}]});})[_0x28c7('0x23')](handleEntityNotFound(_0x4a3f94,null))[_0x28c7('0x23')](function(_0x283733){if(_0x283733&&_0x283733[_0x28c7('0x9b')]){_0x154f7a[_0x28c7('0xa1')]=_0x283733;_0x154f7a['applications']=_0x283733[_0x28c7('0xa0')];_0x154f7a[_0x28c7('0xa2')]=_0x283733['List'];_0x154f7a[_0x28c7('0xa3')]=_[_0x28c7('0xa4')](_0x154f7a[_0x28c7('0xa3')],[_0x28c7('0xa5')],[_0x28c7('0xa6')]);if(_0x154f7a[_0x28c7('0xa1')][_0x28c7('0xa0')]){delete _0x154f7a['account'][_0x28c7('0xa0')];}if(_0x154f7a['account']['List']&&_0x154f7a[_0x28c7('0xa1')][_0x28c7('0x9b')][_0x28c7('0x9d')][_0x28c7('0x5c')]){return _0x154f7a[_0x28c7('0xa1')][_0x28c7('0x9b')]['Contacts'][0x0];}var _0x2db437=_['defaults'](_0x4b3804[_0x28c7('0x5f')],{'firstName':_0x4b3804[_0x28c7('0x5f')][_0x28c7('0x94')],'ListId':_0x283733[_0x28c7('0x93')]});_0x2db437[_0x4b3804[_0x28c7('0x5f')]['mapKey']]=_0x4b3804[_0x28c7('0x5f')][_0x28c7('0x94')];return db[_0x28c7('0x9c')][_0x28c7('0x5e')](_0x2db437,{'fields':_0x428ef5,'raw':!![]});}})[_0x28c7('0x23')](handleEntityNotFound(_0x4a3f94,null))[_0x28c7('0x23')](function(_0x1e6de4){_0x154f7a['contact']=_0x1e6de4;var _0x3c0ed6=_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xa7')];if(_0x4b3804[_0x28c7('0x8c')][_0x28c7('0xa8')]){_0x3c0ed6=_0x4b3804[_0x28c7('0x8c')][_0x28c7('0xa8')];}else if(_0x4b3804[_0x28c7('0x8c')][_0x28c7('0xa9')]){_0x3c0ed6=_[_0x28c7('0xaa')](_0x4b3804[_0x28c7('0x8c')][_0x28c7('0xa9')]['split'](','));}if(_0x1e6de4){var _0x48412f={'ContactId':_0x1e6de4['id'],'ChatWebsiteId':_0x4b3804[_0x28c7('0x5b')]['id'],'from':(_0x1e6de4[_0x28c7('0xab')]||'')+'\x20'+(_0x1e6de4[_0x28c7('0xac')]||''),'customerIp':_0x3c0ed6,'customerPort':_0x4b3804[_0x28c7('0x8c')][_0x28c7('0xad')]?_0x4b3804['headers'][_0x28c7('0xad')]:null,'referer':_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xae')],'browserName':_0x24c654[_0x28c7('0xaf')][_0x28c7('0x3d')]&&_0x24c654[_0x28c7('0xaf')][_0x28c7('0xb0')]?util[_0x28c7('0xb1')](_0x28c7('0xb2'),_0x24c654[_0x28c7('0xaf')][_0x28c7('0x3d')],_0x24c654[_0x28c7('0xaf')][_0x28c7('0xb0')]):_0x28c7('0xb3'),'browserVersion':_0x24c654[_0x28c7('0xaf')]['version']||'unknown','osName':util[_0x28c7('0xb1')](_0x28c7('0xb2'),_0x24c654['os'][_0x28c7('0x3d')],_0x24c654['os'][_0x28c7('0xb0')]),'osVersion':_0x24c654['os'][_0x28c7('0xb0')],'deviceModel':_0x24c654[_0x28c7('0xb4')][_0x28c7('0x46')]&&_0x24c654[_0x28c7('0xb4')][_0x28c7('0xb5')]?util[_0x28c7('0xb1')](_0x28c7('0xb6'),_0x24c654[_0x28c7('0xb4')][_0x28c7('0x46')],_0x24c654['device'][_0x28c7('0xb5')],_0x24c654[_0x28c7('0xb4')]['type']):null,'deviceVendor':_0x24c654['device']['vendor'],'deviceType':_0x24c654[_0x28c7('0xb4')]['type'],'formData':JSON['stringify'](_0x4b3804[_0x28c7('0x5f')])};var _0x505c35={'ChatWebsiteId':_0x4b3804[_0x28c7('0x5b')]['id'],'closed':![]};if(_0x4b3804[_0x28c7('0x5f')]['threadId']){_0x505c35[_0x28c7('0xb7')]=_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xb7')];return db[_0x28c7('0xb8')][_0x28c7('0x5d')]({'where':_0x505c35})[_0x28c7('0x23')](function(_0x2a3d5d){if(_0x2a3d5d){return[_0x2a3d5d,![]];}_0x48412f['threadId']=_0x4b3804[_0x28c7('0x5f')]['threadId'];_0x48412f[_0x28c7('0xb9')]=_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xb9')];return db['ChatInteraction']['create'](_0x48412f)[_0x28c7('0x23')](function(_0x1398de){return[_0x1398de,!![]];});});}_0x505c35[_0x28c7('0xba')]=_0x1e6de4['id'];if(_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xbb')]&&_0x4b3804[_0x28c7('0x5f')]['interaction']['id']){_0x505c35['id']=_0x4b3804['body'][_0x28c7('0xbb')]['id'];return db[_0x28c7('0xb8')]['find']({'where':_0x505c35})['then'](function(_0x4d4cb9){if(_0x4d4cb9){return[_0x4d4cb9,![]];}return db[_0x28c7('0xb8')][_0x28c7('0x5e')](_0x48412f)[_0x28c7('0x23')](function(_0x32c079){return[_0x32c079,!![]];});});}return db[_0x28c7('0xb8')][_0x28c7('0x5e')](_0x48412f)[_0x28c7('0x23')](function(_0x1946e0){return[_0x1946e0,!![]];});}})[_0x28c7('0xbc')](function(_0x285bff,_0xf94a02){if(_0x285bff){_0x205620=_0xf94a02;if(!_0xf94a02){var _0x3c3fbf={'from':(_0x154f7a[_0x28c7('0xbd')]['firstName']||'')+'\x20'+(_0x154f7a['contact'][_0x28c7('0xac')]||'')};if(_0x4b3804['body']['threadId']&&_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xbe')]&&_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xb7')]!=_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xbe')]){_0x3c3fbf[_0x28c7('0xb7')]=_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xbe')];}return _0x285bff[_0x28c7('0x37')](_0x3c3fbf);}else{return _0x285bff;}}})[_0x28c7('0x23')](function(_0x2cc673){_0x154f7a[_0x28c7('0xbb')]=_0x2cc673[_0x28c7('0x38')]({'plain':!![]});_0x154f7a[_0x28c7('0xbb')]['created']=_0x205620;if(_0x154f7a[_0x28c7('0xbb')][_0x28c7('0xbf')]){if(_0x154f7a[_0x28c7('0xa1')][_0x28c7('0xc0')]){_0x154f7a[_0x28c7('0xa3')][_0x28c7('0xc1')]({'id':0x0,'priority':_0x154f7a[_0x28c7('0xa3')][_0x28c7('0x5c')]+0x1,'app':_0x28c7('0xc2'),'appdata':_0x28c7('0xc3'),'interval':_0x28c7('0xc4')});}}return db['ChatMessage'][_0x28c7('0x5e')]({'body':_0x4b3804[_0x28c7('0x5f')][_0x28c7('0x5f')],'ChatWebsiteId':_0x4b3804[_0x28c7('0x5b')]['id'],'ChatInteractionId':_0x2cc673['id'],'direction':'in','ContactId':_0x154f7a[_0x28c7('0xbd')]['id'],'AttachmentId':_0x4b3804[_0x28c7('0x5f')][_0x28c7('0xc5')]});})[_0x28c7('0x23')](function(_0x1b976e){_0x154f7a['message']=_0x1b976e;if(_0x154f7a[_0x28c7('0xbb')][_0x28c7('0xc6')]){return db[_0x28c7('0xc7')][_0x28c7('0x5d')]({'attributes':['id',_0x28c7('0x3d')],'where':{'id':_0x154f7a[_0x28c7('0xbb')][_0x28c7('0xc6')]}})[_0x28c7('0x23')](function(_0x20002b){if(_0x20002b){_0x154f7a['applications'][_0x28c7('0xc8')]({'id':0x0,'priority':0x0,'app':_0x28c7('0xc9'),'appdata':_0x20002b['name']+','+(_0x154f7a['account'][_0x28c7('0xca')]||0xa),'interval':'*,*,*,*'});_0x154f7a['forcedOwnership']=!![];}return respondWithRpcPromise(_0x28c7('0xcb'),_0x28c7('0xcc'),_0x154f7a);});}return respondWithRpcPromise(_0x28c7('0xcb'),_0x28c7('0xcc'),_0x154f7a);})[_0x28c7('0x23')](function(_0x488264){respondWithRpcPromise(_0x28c7('0xcd'),_0x28c7('0xcd'),{'event':'notify','message':_0x488264},client9002);return _0x488264;})[_0x28c7('0x23')](respondWithResult(_0x4a3f94,null))[_0x28c7('0x2d')](handleError(_0x4a3f94,null));};exports[_0x28c7('0xce')]=function(_0xf7165a,_0x374596,_0x4d23f7){var _0x1cdcfe,_0x55398f,_0x48bfc1;var _0x163871=[];var _0x513c20=[];var _0x12a000={};var _0x8bf061=_0xf7165a[_0x28c7('0xcf')]||[];var _0x2fd4da=[];var _0xb18d22;return db['CmContact'][_0x28c7('0x68')]()[_0x28c7('0x23')](function(_0x45cd61){if(!_0x45cd61){throw new db['Sequelize']['ValidationError'](_0x28c7('0x8f'));}_0x513c20=_[_0x28c7('0x90')](_[_0x28c7('0x48')](_0x45cd61),[_0x28c7('0x91'),'updatedAt']);_0x163871=_['difference'](_[_0x28c7('0x48')](_0x45cd61),[_0x28c7('0x91'),'updatedAt',_0x28c7('0xd0'),_0x28c7('0x93')]);if(_0xf7165a[_0x28c7('0x5f')]['id']){delete _0xf7165a[_0x28c7('0x5f')]['id'];}if(_[_0x28c7('0x7f')](_0xf7165a[_0x28c7('0x5f')]['from'])){throw _0x374596[_0x28c7('0x2f')](0x1f4)['send'](new db[(_0x28c7('0x8e'))]['ValidationError'](_0x28c7('0x96')));}if(_[_0x28c7('0x7f')](_0xf7165a[_0x28c7('0x5f')][_0x28c7('0x5f')])||_0xf7165a[_0x28c7('0x5f')]['body']===''){throw _0x374596['status'](0x1f4)[_0x28c7('0x3e')](new db[(_0x28c7('0x8e'))][(_0x28c7('0x95'))](_0x28c7('0x97')));}if(_[_0x28c7('0x7f')](_0xf7165a[_0x28c7('0x5f')][_0x28c7('0xd1')])){throw _0x374596[_0x28c7('0x2f')](0x1f4)[_0x28c7('0x3e')](new db[(_0x28c7('0x8e'))][(_0x28c7('0x95'))](_0x28c7('0xd2')+_0x163871));}if(!_['includes'](_0x163871,_0xf7165a[_0x28c7('0x5f')][_0x28c7('0xd1')])){throw _0x374596[_0x28c7('0x2f')](0x1f4)['send'](new db[(_0x28c7('0x8e'))][(_0x28c7('0x95'))](_0x28c7('0xd3')+_0x163871));}_0x12a000[_0xf7165a[_0x28c7('0x5f')][_0x28c7('0xd1')]]=_0xf7165a[_0x28c7('0x5f')][_0x28c7('0x94')];})[_0x28c7('0x23')](function(){return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0xf7165a[_0x28c7('0x5b')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0x28c7('0xd4')}]});})[_0x28c7('0x23')](handleEntityNotFound(_0x374596,null))[_0x28c7('0x23')](function(_0x461a7c){if(_0x461a7c&&_0x461a7c[_0x28c7('0x9b')]){_0x55398f=_0x461a7c;var _0x3cbf3c=_[_0x28c7('0x1a')](_0xf7165a[_0x28c7('0x5f')],{'firstName':_0xf7165a[_0x28c7('0x5f')][_0x28c7('0x94')],'phone':_0xf7165a[_0x28c7('0x5f')][_0x28c7('0x94')],'ListId':_0x461a7c[_0x28c7('0x93')]});_0x3cbf3c[_0xf7165a[_0x28c7('0x5f')][_0x28c7('0xd1')]]=_0xf7165a['body'][_0x28c7('0x94')];return db[_0x28c7('0x9c')][_0x28c7('0xd5')]({'where':_0x12a000,'defaults':_0x3cbf3c});}})[_0x28c7('0xbc')](function(_0x4e0aca){if(_0x4e0aca){_0x48bfc1=_0x4e0aca;var _0x5e3589=fs['readFileSync'](path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0xd6')),_0x28c7('0xd7'));var _0x4c4a9d=ejs[_0x28c7('0xd8')](_0x5e3589,{'body':_['toPairs'](_0xf7165a['body'][_0x28c7('0x5f')]),'bodyTitle':_0x55398f[_0x28c7('0xd9')]});return db['ChatOfflineMessage']['create']({'body':_0x4c4a9d,'ContactId':_0x4e0aca['id'],'ChatWebsiteId':_0x55398f['id']});}})[_0x28c7('0x23')](function(_0x5042bb){_0xb18d22=_0x5042bb;if(_0x8bf061[_0x28c7('0x5c')]){var _0x568710=_0x8bf061[_0x28c7('0x41')](function(_0x53b3b5){return{'name':_0x53b3b5['originalname'],'basename':_0x53b3b5[_0x28c7('0x74')],'type':_0x53b3b5[_0x28c7('0xda')],'ChatOfflineMessageId':_0x5042bb['id']};});_0x2fd4da=_0x568710[_0x28c7('0x41')](_0x4f6950=>{var _0xbca2e9={'filename':_0x4f6950[_0x28c7('0x3d')],'path':path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0xdb'),_0x28c7('0xcf'),_0x28c7('0xdc'),'offline-chat',_0x4f6950[_0x28c7('0xdd')])};return _0xbca2e9;});if(!_0x55398f[_0x28c7('0xde')]){return db[_0x28c7('0xdf')][_0x28c7('0xe0')](function(_0x4f8726){return db[_0x28c7('0xe1')]['bulkCreate'](_0x568710,{'transaction':_0x4f8726});});}}})[_0x28c7('0x23')](function(){if(_0xb18d22){_0x1cdcfe=_0xb18d22;return db['MailAccount'][_0x28c7('0x6e')]({'where':{'active':!![]},'include':[{'model':db[_0x28c7('0xe2')],'as':_0x28c7('0xe3'),'raw':!![]}]});}})[_0x28c7('0x23')](function(_0x35b3eb){if(_0x35b3eb&&_0x35b3eb['Smtp']&&_0x55398f[_0x28c7('0xe4')]&&_0x55398f[_0x28c7('0xe5')]){var _0x2ccecd={'tls':{'rejectUnauthorized':![]}};if(_0x35b3eb[_0x28c7('0xe3')]['service']){_0x2ccecd[_0x28c7('0xe6')]=_0x35b3eb[_0x28c7('0xe3')]['service'];}else{_0x2ccecd[_0x28c7('0xe7')]=_0x35b3eb[_0x28c7('0xe3')][_0x28c7('0xe7')];_0x2ccecd[_0x28c7('0xe8')]=_0x35b3eb[_0x28c7('0xe3')]['port'];_0x2ccecd[_0x28c7('0xe9')]=_0x35b3eb['Smtp'][_0x28c7('0xe9')];}if(_0x35b3eb[_0x28c7('0xe3')][_0x28c7('0xea')]){_0x2ccecd[_0x28c7('0xeb')]={'user':_0x35b3eb['Smtp'][_0x28c7('0x60')],'pass':_0x35b3eb['Smtp'][_0x28c7('0xec')]};}return respondWithRpcPromise(_0x28c7('0xed'),'sendMail',{'account':_0x2ccecd,'message':{'from':util[_0x28c7('0xb1')](_0x28c7('0xee'),_0x35b3eb[_0x28c7('0x3d')],_0x35b3eb[_0x28c7('0xef')]||_0x35b3eb[_0x28c7('0xe3')][_0x28c7('0x60')]),'to':_0x55398f[_0x28c7('0xe5')],'subject':_0x55398f['offlineMessageSubject'],'html':_0x1cdcfe['body'],'attachments':_0x2fd4da}},client9003)['then'](function(){return _0x1cdcfe;})[_0x28c7('0x2d')](function(_0x98cfbf){console[_0x28c7('0x28')](_0x98cfbf);});}})[_0x28c7('0x23')](function(){if(_0x55398f&&_0x55398f[_0x28c7('0xde')]&&_0x55398f[_0x28c7('0xf0')]){var _0xf96550=[];if(_0x8bf061['length']){_0xf96550=_0x8bf061[_0x28c7('0x41')](function(_0x4d884e){return{'name':_0x4d884e[_0x28c7('0xf1')],'basename':_0x4d884e[_0x28c7('0x74')],'type':_0x4d884e[_0x28c7('0xda')],'ChatOfflineMessageId':_0xb18d22['id']};});}var _0x1b033b;if(!_[_0x28c7('0x7f')](_0x55398f[_0x28c7('0xf2')])){var _0x3c0919=_[_0x28c7('0x41')](_0xf7165a[_0x28c7('0x5f')],function(_0x5efbea){return _0x5efbea;});var _0x3b97d5=_['toPairsIn'](_0x3c0919)[0x0];var _0x5baa8a=_[_0x28c7('0xf3')](_0x3b97d5,function(_0x11ad3f){return _0x11ad3f;});_0x1b033b=_0x5baa8a[0x1][_0x55398f['subjectOffline']];}var _0x293188={'from':_0x48bfc1['email'],'firstName':_0x48bfc1[_0x28c7('0xab')],'lastName':_0x48bfc1[_0x28c7('0xac')],'mapKey':'email','message':{'from':_0x48bfc1[_0x28c7('0xef')],'to':_0x55398f['MailAccount'][_0x28c7('0xef')],'cc':'','subject':_['isNil'](_0x1b033b)?_0x55398f['offlineMessageSubject']:_0x1b033b,'messageId':'','sentAt':new Date(),'attach':_0xf96550[_0x28c7('0x5c')],'attachments':_0xf96550,'originChannel':_0x28c7('0xf4'),'ChatWebsiteId':_0x55398f['id'],'ChatOfflineMessageId':_0x1cdcfe['id'],'originTo':_0x55398f[_0x28c7('0xd4')][_0x28c7('0xef')]},'body':_0x1cdcfe[_0x28c7('0x5f')]};var _0x189152={'account':{'id':_0x55398f[_0x28c7('0xf0')]},'body':_0x293188,'log':_0x28c7('0xf5')};return respondWithRpcPromise(_0x28c7('0xf5'),_0x28c7('0xf6'),_0x189152,client9001)[_0x28c7('0x23')](function(){return _0x1cdcfe;})['catch'](function(_0x28e01b){console[_0x28c7('0x28')](_0x28e01b);});}return;})[_0x28c7('0x23')](function(){if(_0x1cdcfe){return _0x1cdcfe;}})['then'](respondWithResult(_0x374596,null))['catch'](function(_0x3fb352){console[_0x28c7('0x28')]('catch',_0x3fb352);for(var _0x5bfdfb of _0x8bf061){var _0xf2cc46=path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0xdb'),_0x28c7('0xcf'),_0x28c7('0xdc'),_0x28c7('0xf7'),_0x5bfdfb['filename']);fs_extra[_0x28c7('0xf8')](_0xf2cc46)[_0x28c7('0x2d')](function(_0x1c9329){console[_0x28c7('0x28')](_0x28c7('0xf9'),_0xf2cc46,_0x1c9329);});}});};exports[_0x28c7('0xfa')]=function(_0x35d268,_0x190b90,_0xe6eaea){return db[_0x28c7('0xb8')][_0x28c7('0x5d')]({'where':{'id':_0x35d268[_0x28c7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x190b90,null))[_0x28c7('0x23')](function(_0x191350){if(_0x191350){return _0x191350[_0x28c7('0xfa')](_0x35d268[_0x28c7('0x5f')][_0x28c7('0x70')],_[_0x28c7('0xfb')](_0x35d268[_0x28c7('0x5f')],['ids','id'])||{});}})[_0x28c7('0x23')](respondWithResult(_0x190b90,null))[_0x28c7('0x2d')](handleError(_0x190b90,null));};exports[_0x28c7('0xfc')]=function(_0x1db580,_0x469f5c,_0x103eaf){var _0x21505b={'raw':![],'where':{}};var _0x3aeb93={};var _0x12dfc8={'count':0x0,'rows':[]};return db[_0x28c7('0x42')][_0x28c7('0x6e')]({'where':{'id':_0x1db580['params']['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x469f5c,null))[_0x28c7('0x23')](function(_0x17cfd4){if(_0x17cfd4){_0x3aeb93[_0x28c7('0x46')]=_[_0x28c7('0x48')](db['ChatInteraction'][_0x28c7('0x43')]);_0x3aeb93['query']=_[_0x28c7('0x48')](_0x1db580['query']);_0x3aeb93[_0x28c7('0x49')]=_[_0x28c7('0x4a')](_0x3aeb93[_0x28c7('0x46')],_0x3aeb93[_0x28c7('0x47')]);_0x21505b[_0x28c7('0x4b')]=_['intersection'](_0x3aeb93[_0x28c7('0x46')],qs[_0x28c7('0x4c')](_0x1db580[_0x28c7('0x47')][_0x28c7('0x4c')]));_0x21505b[_0x28c7('0x4b')]=_0x21505b[_0x28c7('0x4b')][_0x28c7('0x5c')]?_0x21505b[_0x28c7('0x4b')]:_0x3aeb93[_0x28c7('0x46')];if(!_0x1db580['query'][_0x28c7('0x4d')](_0x28c7('0x4e'))){_0x21505b[_0x28c7('0x33')]=qs[_0x28c7('0x33')](_0x1db580[_0x28c7('0x47')][_0x28c7('0x33')]);_0x21505b[_0x28c7('0x31')]=qs['offset'](_0x1db580[_0x28c7('0x47')][_0x28c7('0x31')]);}_0x21505b[_0x28c7('0x4f')]=qs[_0x28c7('0x50')](_0x1db580[_0x28c7('0x47')][_0x28c7('0x50')]);_0x21505b[_0x28c7('0x51')]=qs[_0x28c7('0x49')](_[_0x28c7('0x52')](_0x1db580[_0x28c7('0x47')],_0x3aeb93[_0x28c7('0x49')]));_0x21505b['where'][_0x28c7('0x69')]=_0x17cfd4['id'];if(_0x1db580[_0x28c7('0x47')]['filter']){_0x21505b[_0x28c7('0x51')]=_[_0x28c7('0x53')](_0x21505b['where'],{'$or':_[_0x28c7('0x41')](_0x21505b[_0x28c7('0x4b')],function(_0x41814c){var _0x1881f2={};_0x1881f2[_0x41814c]={'$like':'%'+_0x1db580[_0x28c7('0x47')]['filter']+'%'};return _0x1881f2;})});}_0x21505b=_['merge']({},_0x21505b,_0x1db580[_0x28c7('0x57')]);return db[_0x28c7('0xb8')][_0x28c7('0x34')]({'where':_0x21505b[_0x28c7('0x51')]})['then'](function(_0x3388f5){_0x12dfc8[_0x28c7('0x34')]=_0x3388f5;if(_0x1db580[_0x28c7('0x47')]['includeAll']){_0x21505b['include']=[{'model':db[_0x28c7('0x9c')],'as':_0x28c7('0xfd'),'required':![]},{'model':db[_0x28c7('0xc7')],'as':'Owner','attributes':[_0x28c7('0x3d'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x28c7('0xfe'),'attributes':['id',_0x28c7('0x3d'),_0x28c7('0xff')],'where':_0x1db580['query'][_0x28c7('0x100')]?{'id':_0x1db580[_0x28c7('0x47')]['tag']}:undefined,'required':_0x1db580[_0x28c7('0x47')][_0x28c7('0x100')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x21505b);})[_0x28c7('0x23')](function(_0x10c656){_0x12dfc8[_0x28c7('0x6b')]=_0x10c656;return _0x12dfc8;});}})[_0x28c7('0x23')](respondWithFilteredResult(_0x469f5c,_0x21505b))[_0x28c7('0x2d')](handleError(_0x469f5c,null));};function iftimePromise(_0x4c62c6,_0xd0fb8d){return respondWithRpcPromise(_0x28c7('0x101'),_0x28c7('0x102'),{'command':_0xd0fb8d[_0x28c7('0x103')]?util[_0x28c7('0xb1')](_0x28c7('0x104'),_0x4c62c6[_0x28c7('0x105')],_0xd0fb8d[_0x28c7('0x103')]):util[_0x28c7('0xb1')](_0x28c7('0x106'),_0x4c62c6[_0x28c7('0x105')])},client9002)[_0x28c7('0x23')](function(_0x5df1b7){var _0x1c4db2=_0x5df1b7&&_0x5df1b7['indexOf'](_0x28c7('0x107'))>=0x0?!![]:![];logger[_0x28c7('0x24')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xd0fb8d['id'],_0x4c62c6['id'],_0x4c62c6[_0x28c7('0x105')],_0x1c4db2?_0x28c7('0x108'):_0x28c7('0x109'),_0xd0fb8d[_0x28c7('0x103')]?_0xd0fb8d[_0x28c7('0x103')]:_0x28c7('0x10a'));return _0x1c4db2;})['catch'](function(_0x1943b6){logger['error'](_0x28c7('0x10b'),_0xd0fb8d['id'],_0x4c62c6['id'],_0x4c62c6[_0x28c7('0x105')],util[_0x28c7('0x10c')](_0x1943b6,{'showHidden':![],'depth':null}),_0xd0fb8d[_0x28c7('0x103')]?_0xd0fb8d[_0x28c7('0x103')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x20b8c4,_0xcd5eb6,_0x2318fc){var _0x508048=0x0;var _0x55b6fb=0x0;var _0x539304=![];var _0x29940e;var _0x3ac2b7;return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x20b8c4['params']['id']},'include':[{'model':db['Interval'],'as':_0x28c7('0x10d'),'include':[{'model':db[_0x28c7('0x10d')],'as':_0x28c7('0x10e'),'attributes':['id',_0x28c7('0x105')],'raw':!![]}]}]})[_0x28c7('0x23')](handleEntityNotFound(_0xcd5eb6,null))[_0x28c7('0x23')](function(_0x40ae8d){if(_0x40ae8d){_0x29940e=_0x40ae8d;return _0x40ae8d[_0x28c7('0x10f')]({'raw':!![]});}})[_0x28c7('0x23')](function(_0xa3bd82){if(_0x29940e){if(_0xa3bd82){_0x3ac2b7=_0xa3bd82;}}return require(_0x28c7('0x18'))['getLicense']();})[_0x28c7('0x23')](function(_0x2e0d4a){if(_0x2e0d4a){_0x55b6fb=_0x2e0d4a[_0x28c7('0x110')];_0x539304=_0x2e0d4a[_0x28c7('0x111')];}})[_0x28c7('0x23')](function(){return db[_0x28c7('0xb8')][_0x28c7('0x34')]({'where':{'closed':![]}});})[_0x28c7('0x23')](function(_0x378091){_0x508048=_0x378091;if(_0x55b6fb&&_0x378091>_0x55b6fb){return db[_0x28c7('0x112')][_0x28c7('0x6e')]({'where':{'id':0x1}})[_0x28c7('0x23')](function(_0x1cc516){if(_0x1cc516){_0x1cc516['increment'](_0x28c7('0x113'));}});}})[_0x28c7('0x23')](function(){if(_0x29940e['Interval']&&_0x29940e['Interval'][_0x28c7('0x10e')]){var _0x4d4ea9=[];for(var _0x366fd8=0x0;_0x366fd8<_0x29940e[_0x28c7('0x10d')]['Intervals'][_0x28c7('0x5c')];_0x366fd8++){var _0x5ae0aa=_0x29940e[_0x28c7('0x10d')]['Intervals'][_0x366fd8][_0x28c7('0x38')]({'plain':!![]});_0x4d4ea9[_0x28c7('0xc1')](iftimePromise(_0x5ae0aa,_0x29940e));}return BPromise[_0x28c7('0x114')](_0x4d4ea9)[_0x28c7('0x23')](function(_0x13b7c8){return _[_0x28c7('0x115')](_0x13b7c8);});}else{return!![];}})[_0x28c7('0x23')](function(_0x130bad){var _0x5252fc=fs[_0x28c7('0x116')](path[_0x28c7('0x7b')](config[_0x28c7('0x7c')],_0x28c7('0x117')),_0x28c7('0xd7'));var _0x1f0bdd={'remote':_0x29940e[_0x28c7('0x118')],'query':querystring['stringify'](_['merge'](_0x29940e['get']({'plain':!![]}),{'customerIp':_0x20b8c4['headers'][_0x28c7('0xa9')]||_0x20b8c4[_0x28c7('0x8c')][_0x28c7('0x119')]||_0x20b8c4[_0x28c7('0x11a')][_0x28c7('0x11b')]||_0x20b8c4['ip'],'referer':_0x20b8c4[_0x28c7('0x8c')][_0x28c7('0xae')],'openedInteractions':_0x508048,'maxInteractions':_0x55b6fb,'virtual':_0x539304[_0x28c7('0x110')],'online':_0x130bad,'custom':_0x539304}))[_0x28c7('0x11c')](/'/g,'\x5c\x27')};_0xcd5eb6[_0x28c7('0x3e')](ejs[_0x28c7('0xd8')](Mustache[_0x28c7('0xd8')](_0x5252fc,_0x1f0bdd),{'proactiveActions':_0x3ac2b7,'alignment':_0x29940e[_0x28c7('0x11d')],'verticalAlignment':_0x29940e['verticalAlignment'],'div_color':_0x29940e['color'],'text_color':_0x29940e[_0x28c7('0x11e')],'button_color':_0x29940e[_0x28c7('0x11f')],'background_color':_0x29940e['backgroundColor']}));})['catch'](handleError(_0xcd5eb6,null));};exports[_0x28c7('0x120')]=function(_0x5e9137,_0x3fe098,_0x4d5923){return db[_0x28c7('0x42')][_0x28c7('0x6e')]({'where':{'id':_0x5e9137[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x3fe098,null))[_0x28c7('0x23')](function(_0x3753c3){if(_0x3753c3){return db[_0x28c7('0xdf')][_0x28c7('0xe0')](function(_0x511b5b){return db[_0x28c7('0x9f')][_0x28c7('0x3a')]({'where':{'ChatWebsiteId':_0x5e9137['params']['id']},'transaction':_0x511b5b})[_0x28c7('0x23')](function(_0x3148ed){var _0x45e5b1=_['map'](_0x5e9137[_0x28c7('0x5f')],function(_0x17e968){_0x17e968[_0x28c7('0x69')]=_0x5e9137[_0x28c7('0x5b')]['id'];return _0x17e968;});return db['ChatApplication'][_0x28c7('0x121')](_0x45e5b1,{'transaction':_0x511b5b});});})[_0x28c7('0x23')](function(){return db[_0x28c7('0x9f')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x5e9137[_0x28c7('0x5b')]['id']},'order':_0x28c7('0xa5')});});}})[_0x28c7('0x23')](respondWithResult(_0x3fe098,null))[_0x28c7('0x2d')](handleError(_0x3fe098,null));};exports[_0x28c7('0x122')]=function(_0x56c32f,_0x34c262,_0x48ead0){var _0xb105d6={};var _0x255288={};var _0x1dfabc;var _0x20205f;return db['ChatWebsite'][_0x28c7('0x6e')]({'where':{'id':_0x56c32f[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x34c262,null))[_0x28c7('0x23')](function(_0x2694b0){if(_0x2694b0){_0x1dfabc=_0x2694b0;_0x255288[_0x28c7('0x46')]=_[_0x28c7('0x48')](db[_0x28c7('0x9f')][_0x28c7('0x43')]);_0x255288[_0x28c7('0x47')]=_[_0x28c7('0x48')](_0x56c32f[_0x28c7('0x47')]);_0x255288[_0x28c7('0x49')]=_[_0x28c7('0x4a')](_0x255288[_0x28c7('0x46')],_0x255288[_0x28c7('0x47')]);_0xb105d6[_0x28c7('0x4b')]=_[_0x28c7('0x4a')](_0x255288['model'],qs['fields'](_0x56c32f['query'][_0x28c7('0x4c')]));_0xb105d6[_0x28c7('0x4b')]=_0xb105d6[_0x28c7('0x4b')][_0x28c7('0x5c')]?_0xb105d6[_0x28c7('0x4b')]:_0x255288['model'];_0xb105d6['order']=qs[_0x28c7('0x50')](_0x56c32f[_0x28c7('0x47')]['sort']);_0xb105d6[_0x28c7('0x51')]=qs['filters'](_['pick'](_0x56c32f[_0x28c7('0x47')],_0x255288[_0x28c7('0x49')]));if(_0x56c32f['query'][_0x28c7('0x56')]){_0xb105d6[_0x28c7('0x51')]=_['merge'](_0xb105d6[_0x28c7('0x51')],{'$or':_[_0x28c7('0x41')](_0xb105d6[_0x28c7('0x4b')],function(_0x26f2d7){var _0x5f0c59={};_0x5f0c59[_0x26f2d7]={'$like':'%'+_0x56c32f[_0x28c7('0x47')][_0x28c7('0x56')]+'%'};return _0x5f0c59;})});}_0xb105d6=_[_0x28c7('0x53')]({},_0xb105d6,_0x56c32f[_0x28c7('0x57')]);return _0x1dfabc[_0x28c7('0x122')](_0xb105d6);}})[_0x28c7('0x23')](function(_0x239519){if(_0x239519){_0x20205f=_0x239519[_0x28c7('0x5c')];if(!_0x56c32f[_0x28c7('0x47')]['hasOwnProperty'](_0x28c7('0x4e'))){_0xb105d6[_0x28c7('0x33')]=qs[_0x28c7('0x33')](_0x56c32f[_0x28c7('0x47')][_0x28c7('0x33')]);_0xb105d6[_0x28c7('0x31')]=qs['offset'](_0x56c32f[_0x28c7('0x47')][_0x28c7('0x31')]);}return _0x1dfabc[_0x28c7('0x122')](_0xb105d6);}})[_0x28c7('0x23')](function(_0x55d21b){if(_0x55d21b){return _0x55d21b?{'count':_0x20205f,'rows':_0x55d21b}:null;}})[_0x28c7('0x23')](respondWithResult(_0x34c262,null))[_0x28c7('0x2d')](handleError(_0x34c262,null));};exports[_0x28c7('0x123')]=function(_0x4cd111,_0x50cfd7,_0x3d95c2){return db[_0x28c7('0x124')][_0x28c7('0x5d')]({'where':{'id':_0x4cd111[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x50cfd7,null))[_0x28c7('0x23')](function(_0x314148){if(_0x314148){return _0x314148[_0x28c7('0x123')](_0x4cd111[_0x28c7('0x5f')][_0x28c7('0x70')],_['omit'](_0x4cd111[_0x28c7('0x5f')],[_0x28c7('0x70'),'id'])||{});}})[_0x28c7('0x23')](respondWithResult(_0x50cfd7,null))[_0x28c7('0x2d')](handleError(_0x50cfd7,null));};exports['getProactiveActions']=function(_0x501e63,_0x22632e,_0x97cd36){var _0x428772={};var _0x24067a={};var _0x21261a;var _0xa12402;return db[_0x28c7('0x42')][_0x28c7('0x6e')]({'where':{'id':_0x501e63[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x22632e,null))['then'](function(_0x32b44c){if(_0x32b44c){_0x21261a=_0x32b44c;_0x24067a[_0x28c7('0x46')]=_[_0x28c7('0x48')](db[_0x28c7('0x125')][_0x28c7('0x43')]);_0x24067a[_0x28c7('0x47')]=_[_0x28c7('0x48')](_0x501e63[_0x28c7('0x47')]);_0x24067a[_0x28c7('0x49')]=_[_0x28c7('0x4a')](_0x24067a['model'],_0x24067a['query']);_0x428772['attributes']=_[_0x28c7('0x4a')](_0x24067a[_0x28c7('0x46')],qs[_0x28c7('0x4c')](_0x501e63[_0x28c7('0x47')][_0x28c7('0x4c')]));_0x428772[_0x28c7('0x4b')]=_0x428772['attributes'][_0x28c7('0x5c')]?_0x428772[_0x28c7('0x4b')]:_0x24067a[_0x28c7('0x46')];_0x428772[_0x28c7('0x4f')]=qs[_0x28c7('0x50')](_0x501e63[_0x28c7('0x47')]['sort']);_0x428772[_0x28c7('0x51')]=qs[_0x28c7('0x49')](_[_0x28c7('0x52')](_0x501e63[_0x28c7('0x47')],_0x24067a[_0x28c7('0x49')]));if(_0x501e63[_0x28c7('0x47')]['filter']){_0x428772[_0x28c7('0x51')]=_[_0x28c7('0x53')](_0x428772[_0x28c7('0x51')],{'$or':_['map'](_0x428772[_0x28c7('0x4b')],function(_0x3d0811){var _0x45b624={};_0x45b624[_0x3d0811]={'$like':'%'+_0x501e63['query'][_0x28c7('0x56')]+'%'};return _0x45b624;})});}_0x428772=_[_0x28c7('0x53')]({},_0x428772,_0x501e63['options']);return _0x21261a['getProactiveActions'](_0x428772);}})['then'](function(_0xe1b6c4){if(_0xe1b6c4){_0xa12402=_0xe1b6c4[_0x28c7('0x5c')];if(!_0x501e63[_0x28c7('0x47')][_0x28c7('0x4d')](_0x28c7('0x4e'))){_0x428772[_0x28c7('0x33')]=qs[_0x28c7('0x33')](_0x501e63[_0x28c7('0x47')][_0x28c7('0x33')]);_0x428772[_0x28c7('0x31')]=qs['offset'](_0x501e63[_0x28c7('0x47')][_0x28c7('0x31')]);}return _0x21261a[_0x28c7('0x10f')](_0x428772);}})['then'](function(_0x26c583){if(_0x26c583){return _0x26c583?{'count':_0xa12402,'rows':_0x26c583}:null;}})[_0x28c7('0x23')](respondWithResult(_0x22632e,null))[_0x28c7('0x2d')](handleError(_0x22632e,null));};exports['getFields']=function(_0x184d51,_0x1c0c7f,_0x47e094){var _0x4ad54d=_0x184d51[_0x28c7('0x47')][_0x28c7('0x126')]===_0x28c7('0x127')?_0x28c7('0x128'):_0x28c7('0x129');return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'attributes':['id',_0x4ad54d],'where':{'id':_0x184d51['params']['id']}})['then'](handleEntityNotFound(_0x1c0c7f,null))[_0x28c7('0x23')](function(_0x54d24a){if(_0x54d24a){var _0x242e3d=_0x54d24a[_0x4ad54d];var _0x2af019=_0x242e3d&&_0x242e3d[_0x28c7('0x12a')]?_0x242e3d[_0x28c7('0x12a')]:[];_0x1c0c7f[_0x28c7('0x3e')]({'fromKey':_['isNil'](_0x242e3d['fromKey'])?undefined:_0x242e3d[_0x28c7('0x12b')],'count':_0x2af019[_0x28c7('0x5c')],'rows':_0x2af019});}})[_0x28c7('0x2d')](handleError(_0x1c0c7f,null));};exports[_0x28c7('0x12c')]=function(_0x25023a,_0x40a4c8,_0x16078f){var _0x5ec008={'raw':![],'where':{}};var _0x193fad={};var _0x508ea0={'count':0x0,'rows':[]};return db[_0x28c7('0x42')]['findOne']({'where':{'id':_0x25023a[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x40a4c8,null))[_0x28c7('0x23')](function(_0x78bf93){if(_0x78bf93){_0x193fad['model']=_[_0x28c7('0x48')](db[_0x28c7('0x12d')][_0x28c7('0x43')]);_0x193fad['query']=_[_0x28c7('0x48')](_0x25023a[_0x28c7('0x47')]);_0x193fad[_0x28c7('0x49')]=_[_0x28c7('0x4a')](_0x193fad[_0x28c7('0x46')],_0x193fad[_0x28c7('0x47')]);_0x5ec008[_0x28c7('0x4b')]=_[_0x28c7('0x4a')](_0x193fad[_0x28c7('0x46')],qs[_0x28c7('0x4c')](_0x25023a[_0x28c7('0x47')]['fields']));_0x5ec008[_0x28c7('0x4b')]=_0x5ec008[_0x28c7('0x4b')][_0x28c7('0x5c')]?_0x5ec008['attributes']:_0x193fad[_0x28c7('0x46')];if(!_0x25023a[_0x28c7('0x47')][_0x28c7('0x4d')](_0x28c7('0x4e'))){_0x5ec008[_0x28c7('0x33')]=qs[_0x28c7('0x33')](_0x25023a[_0x28c7('0x47')]['limit']);_0x5ec008[_0x28c7('0x31')]=qs[_0x28c7('0x31')](_0x25023a[_0x28c7('0x47')][_0x28c7('0x31')]);}_0x5ec008['order']=qs[_0x28c7('0x50')](_0x25023a[_0x28c7('0x47')][_0x28c7('0x50')]);_0x5ec008[_0x28c7('0x51')]=qs[_0x28c7('0x49')](_[_0x28c7('0x52')](_0x25023a[_0x28c7('0x47')],_0x193fad[_0x28c7('0x49')]));_0x5ec008[_0x28c7('0x51')]['ChatWebsiteId']=_0x78bf93['id'];if(_0x25023a[_0x28c7('0x47')]['filter']){_0x5ec008[_0x28c7('0x51')]=_[_0x28c7('0x53')](_0x5ec008[_0x28c7('0x51')],{'$or':_[_0x28c7('0x41')](_0x5ec008[_0x28c7('0x4b')],function(_0x13fd3e){var _0x5b61d6={};_0x5b61d6[_0x13fd3e]={'$like':'%'+_0x25023a['query'][_0x28c7('0x56')]+'%'};return _0x5b61d6;})});}_0x5ec008=_[_0x28c7('0x53')]({},_0x5ec008,_0x25023a[_0x28c7('0x57')]);return db[_0x28c7('0x12d')]['count']({'where':_0x5ec008[_0x28c7('0x51')]})[_0x28c7('0x23')](function(_0x2244a7){_0x508ea0[_0x28c7('0x34')]=_0x2244a7;if(_0x25023a[_0x28c7('0x47')][_0x28c7('0x58')]){_0x5ec008[_0x28c7('0x59')]=[{'all':!![]}];}else{_0x5ec008[_0x28c7('0x59')]=[{'model':db['CmContact'],'as':_0x28c7('0xfd'),'required':![]},{'model':db[_0x28c7('0xe1')],'as':_0x28c7('0x12e'),'required':![]}];}return db[_0x28c7('0x12d')][_0x28c7('0x5a')](_0x5ec008);})['then'](function(_0x37c42d){_0x508ea0[_0x28c7('0x6b')]=_0x37c42d;return _0x508ea0;});}})['then'](respondWithFilteredResult(_0x40a4c8,_0x5ec008))[_0x28c7('0x2d')](handleError(_0x40a4c8,null));};exports[_0x28c7('0x12f')]=function(_0x36f356,_0x1ed030,_0x264746){return db[_0x28c7('0x42')][_0x28c7('0x5d')]({'where':{'id':_0x36f356[_0x28c7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1ed030,null))['then'](function(_0x3d27ac){if(_0x3d27ac){return _0x3d27ac[_0x28c7('0x12f')](_0x36f356[_0x28c7('0x5f')][_0x28c7('0x70')],_['omit'](_0x36f356[_0x28c7('0x5f')],['ids','id'])||{})[_0x28c7('0xbc')](function(_0x5f26dc){for(var _0x31ba37=0x0;_0x31ba37<_0x36f356[_0x28c7('0x5f')][_0x28c7('0x70')][_0x28c7('0x5c')];_0x31ba37+=0x1){socket['emit'](_0x28c7('0x130'),{'UserId':Number(_0x36f356[_0x28c7('0x5f')][_0x28c7('0x70')][_0x31ba37]),'ChatWebsiteId':Number(_0x36f356[_0x28c7('0x5b')]['id'])});}return _0x5f26dc;});}})[_0x28c7('0x23')](respondWithResult(_0x1ed030,null))[_0x28c7('0x2d')](handleError(_0x1ed030,null));};exports[_0x28c7('0x131')]=function(_0x43420b,_0x5f510a,_0x22d912){return db['ChatWebsite']['find']({'where':{'id':_0x43420b[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x5f510a,null))[_0x28c7('0x23')](function(_0x452515){if(_0x452515){return _0x452515[_0x28c7('0x131')](_0x43420b['query']['ids'])[_0x28c7('0x23')](function(){if(_[_0x28c7('0x132')](_0x43420b[_0x28c7('0x47')][_0x28c7('0x70')])){for(var _0x2d881c=0x0;_0x2d881c<_0x43420b['query'][_0x28c7('0x70')]['length'];_0x2d881c+=0x1){socket[_0x28c7('0x133')](_0x28c7('0x134'),{'UserId':Number(_0x43420b['query'][_0x28c7('0x70')][_0x2d881c]),'ChatWebsiteId':Number(_0x43420b['params']['id'])});}}else{socket[_0x28c7('0x133')](_0x28c7('0x134'),{'UserId':Number(_0x43420b[_0x28c7('0x47')][_0x28c7('0x70')]),'ChatWebsiteId':Number(_0x43420b[_0x28c7('0x5b')]['id'])});}});}})[_0x28c7('0x23')](respondWithStatusCode(_0x5f510a,null))[_0x28c7('0x2d')](handleError(_0x5f510a,null));};exports[_0x28c7('0x135')]=function(_0x28fc64,_0x4c1492,_0x309af0){var _0x2ce2f6={};var _0x1bb6e5={};var _0x983277;var _0x593df0;return db['ChatWebsite'][_0x28c7('0x6e')]({'where':{'id':_0x28fc64[_0x28c7('0x5b')]['id']}})[_0x28c7('0x23')](handleEntityNotFound(_0x4c1492,null))[_0x28c7('0x23')](function(_0x49247f){if(_0x49247f){_0x983277=_0x49247f;_0x1bb6e5[_0x28c7('0x46')]=_[_0x28c7('0x48')](db['User'][_0x28c7('0x43')]);_0x1bb6e5[_0x28c7('0x47')]=_[_0x28c7('0x48')](_0x28fc64[_0x28c7('0x47')]);_0x1bb6e5[_0x28c7('0x49')]=_['intersection'](_0x1bb6e5[_0x28c7('0x46')],_0x1bb6e5[_0x28c7('0x47')]);_0x2ce2f6['attributes']=_['intersection'](_0x1bb6e5[_0x28c7('0x46')],qs['fields'](_0x28fc64[_0x28c7('0x47')][_0x28c7('0x4c')]));_0x2ce2f6[_0x28c7('0x4b')]=_0x2ce2f6[_0x28c7('0x4b')][_0x28c7('0x5c')]?_0x2ce2f6[_0x28c7('0x4b')]:_0x1bb6e5['model'];_0x2ce2f6[_0x28c7('0x4f')]=qs['sort'](_0x28fc64[_0x28c7('0x47')][_0x28c7('0x50')]);_0x2ce2f6[_0x28c7('0x51')]=qs[_0x28c7('0x49')](_['pick'](_0x28fc64[_0x28c7('0x47')],_0x1bb6e5[_0x28c7('0x49')]));if(_0x28fc64[_0x28c7('0x47')]['filter']){_0x2ce2f6[_0x28c7('0x51')]=_[_0x28c7('0x53')](_0x2ce2f6[_0x28c7('0x51')],{'$or':_[_0x28c7('0x41')](_0x2ce2f6[_0x28c7('0x4b')],function(_0x537892){var _0x5d528d={};_0x5d528d[_0x537892]={'$like':'%'+_0x28fc64[_0x28c7('0x47')][_0x28c7('0x56')]+'%'};return _0x5d528d;})});}_0x2ce2f6=_['merge']({},_0x2ce2f6,_0x28fc64[_0x28c7('0x57')]);return _0x983277[_0x28c7('0x135')](_0x2ce2f6);}})[_0x28c7('0x23')](function(_0x291250){if(_0x291250){_0x593df0=_0x291250[_0x28c7('0x5c')];if(!_0x28fc64[_0x28c7('0x47')][_0x28c7('0x4d')](_0x28c7('0x4e'))){_0x2ce2f6[_0x28c7('0x33')]=qs['limit'](_0x28fc64[_0x28c7('0x47')]['limit']);_0x2ce2f6[_0x28c7('0x31')]=qs[_0x28c7('0x31')](_0x28fc64[_0x28c7('0x47')][_0x28c7('0x31')]);}return _0x983277[_0x28c7('0x135')](_0x2ce2f6);}})[_0x28c7('0x23')](function(_0x2410ed){if(_0x2410ed){return _0x2410ed?{'count':_0x593df0,'rows':_0x2410ed}:null;}})[_0x28c7('0x23')](respondWithResult(_0x4c1492,null))[_0x28c7('0x2d')](handleError(_0x4c1492,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e430c66..a696434 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 _0x26cf=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','save'];(function(_0x5835c1,_0x23d9b4){var _0x3ea4a6=function(_0x40e08c){while(--_0x40e08c){_0x5835c1['push'](_0x5835c1['shift']());}};_0x3ea4a6(++_0x23d9b4);}(_0x26cf,0x135));var _0xf26c=function(_0x2320be,_0x18678b){_0x2320be=_0x2320be-0x0;var _0x2fcaf7=_0x26cf[_0x2320be];return _0x2fcaf7;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xf26c('0x0'))['db'][_0xf26c('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf26c('0x2'),'afterUpdate':'update','afterDestroy':_0xf26c('0x3')};function emitEvent(_0x4c414f){return function(_0x314cdf,_0xf4a93f,_0x58d7b7){ChatWebsiteEvents[_0xf26c('0x4')](_0x4c414f+':'+_0x314cdf['id'],_0x314cdf);ChatWebsiteEvents[_0xf26c('0x4')](_0x4c414f,_0x314cdf);_0x58d7b7(null);};}for(var e in events){if(events[_0xf26c('0x5')](e)){var event=events[e];ChatWebsite[_0xf26c('0x6')](e,emitEvent(event));}}module[_0xf26c('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xceae=['hasOwnProperty','hook','exports','events','../../mysqldb','update','emit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xceae,0x122));var _0xecea=function(_0x36de53,_0x4a0679){_0x36de53=_0x36de53-0x0;var _0x2b04cb=_0xceae[_0x36de53];return _0x2b04cb;};'use strict';var EventEmitter=require(_0xecea('0x0'));var ChatWebsite=require(_0xecea('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xecea('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5bba59){return function(_0x28b2cf,_0x457d37,_0x39d285){ChatWebsiteEvents[_0xecea('0x3')](_0x5bba59+':'+_0x28b2cf['id'],_0x28b2cf);ChatWebsiteEvents[_0xecea('0x3')](_0x5bba59,_0x28b2cf);_0x39d285(null);};}for(var e in events){if(events[_0xecea('0x4')](e)){var event=events[e];ChatWebsite[_0xecea('0x5')](e,emitEvent(event));}}module[_0xecea('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 7aa5414..2610e74 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 _0x9402=['exports','define','ChatWebsite','chat_websites','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x1d21a8,_0x75aef7){var _0x2f0d24=function(_0xb6614e){while(--_0xb6614e){_0x1d21a8['push'](_0x1d21a8['shift']());}};_0x2f0d24(++_0x75aef7);}(_0x9402,0x185));var _0x2940=function(_0x47db65,_0x4510af){_0x47db65=_0x47db65-0x0;var _0x44a4b7=_0x9402[_0x47db65];return _0x44a4b7;};'use strict';var _=require(_0x2940('0x0'));var util=require(_0x2940('0x1'));var logger=require('../../config/logger')(_0x2940('0x2'));var moment=require(_0x2940('0x3'));var BPromise=require('bluebird');var rp=require(_0x2940('0x4'));var fs=require('fs');var path=require(_0x2940('0x5'));var rimraf=require(_0x2940('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x2940('0x7')]=function(_0x51d7c1,_0x3a4553){return _0x51d7c1[_0x2940('0x8')](_0x2940('0x9'),attributes,{'tableName':_0x2940('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb49d=['./chatWebsite.attributes','exports','ChatWebsite','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xf04b83,_0x399c28){var _0x3d15eb=function(_0x3b554d){while(--_0x3b554d){_0xf04b83['push'](_0xf04b83['shift']());}};_0x3d15eb(++_0x399c28);}(_0xb49d,0x7b));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb49('0x0'));var util=require('util');var logger=require(_0xdb49('0x1'))(_0xdb49('0x2'));var moment=require(_0xdb49('0x3'));var BPromise=require(_0xdb49('0x4'));var rp=require(_0xdb49('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdb49('0x6'));var attributes=require(_0xdb49('0x7'));module[_0xdb49('0x8')]=function(_0x5507db,_0x57c6ff){return _0x5507db['define'](_0xdb49('0x9'),attributes,{'tableName':'chat_websites','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 1072b53..edf2531 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 _0xb314=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./chatWebsite.socket','register','request','then','info','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','request\x20sent','result','catch'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0xb314,0x1a4));var _0x4b31=function(_0x3ac379,_0xdb25fc){_0x3ac379=_0x3ac379-0x0;var _0x1d9f92=_0xb314[_0x3ac379];return _0x1d9f92;};'use strict';var _=require(_0x4b31('0x0'));var util=require(_0x4b31('0x1'));var moment=require(_0x4b31('0x2'));var BPromise=require(_0x4b31('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b31('0x4'))['db'];var utils=require(_0x4b31('0x5'));var logger=require(_0x4b31('0x6'))(_0x4b31('0x7'));var config=require(_0x4b31('0x8'));var jayson=require(_0x4b31('0x9'));var client=jayson['client'][_0x4b31('0xa')]({'port':0x232a});config['redis']=_[_0x4b31('0xb')](config[_0x4b31('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b31('0xd'))(new Redis(config[_0x4b31('0xc')]));require(_0x4b31('0xe'))[_0x4b31('0xf')](socket);function respondWithRpcPromise(_0x1bc113,_0x5715ef,_0x596ff6){return new BPromise(function(_0x54fb96,_0x1bdb28){return client[_0x4b31('0x10')](_0x1bc113,_0x596ff6)[_0x4b31('0x11')](function(_0x149b27){logger[_0x4b31('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x5715ef,'request\x20sent');logger[_0x4b31('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5715ef,'request\x20sent',JSON[_0x4b31('0x14')](_0x149b27));if(_0x149b27['error']){if(_0x149b27[_0x4b31('0x15')][_0x4b31('0x16')]===0x1f4){logger[_0x4b31('0x15')](_0x4b31('0x17'),_0x5715ef,_0x149b27[_0x4b31('0x15')][_0x4b31('0x18')]);return _0x1bdb28(_0x149b27[_0x4b31('0x15')]['message']);}logger[_0x4b31('0x15')](_0x4b31('0x17'),_0x5715ef,_0x149b27[_0x4b31('0x15')]['message']);return _0x54fb96(_0x149b27[_0x4b31('0x15')][_0x4b31('0x18')]);}else{logger[_0x4b31('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x5715ef,_0x4b31('0x19'));_0x54fb96(_0x149b27[_0x4b31('0x1a')][_0x4b31('0x18')]);}})[_0x4b31('0x1b')](function(_0x4b1a72){logger[_0x4b31('0x15')](_0x4b31('0x17'),_0x5715ef,_0x4b1a72);_0x1bdb28(_0x4b1a72);});});} \ No newline at end of file +var _0x0251=['catch','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x11452c,_0xc363f4){var _0x547698=function(_0x2d6c8b){while(--_0x2d6c8b){_0x11452c['push'](_0x11452c['shift']());}};_0x547698(++_0xc363f4);}(_0x0251,0x109));var _0x1025=function(_0x2b254f,_0x3df8ff){_0x2b254f=_0x2b254f-0x0;var _0xcc593f=_0x0251[_0x2b254f];return _0xcc593f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1025('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1025('0x1'));var db=require(_0x1025('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x1025('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1025('0x4'));var client=jayson[_0x1025('0x5')][_0x1025('0x6')]({'port':0x232a});config[_0x1025('0x7')]=_[_0x1025('0x8')](config[_0x1025('0x7')],{'host':_0x1025('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1025('0x7')]));require(_0x1025('0xa'))[_0x1025('0xb')](socket);function respondWithRpcPromise(_0x1afbb7,_0x2ec8b3,_0x136531){return new BPromise(function(_0x9196d2,_0x8c87ce){return client[_0x1025('0xc')](_0x1afbb7,_0x136531)[_0x1025('0xd')](function(_0x2b545b){logger[_0x1025('0xe')](_0x1025('0xf'),_0x2ec8b3,_0x1025('0x10'));logger[_0x1025('0x11')](_0x1025('0x12'),_0x2ec8b3,'request\x20sent',JSON['stringify'](_0x2b545b));if(_0x2b545b[_0x1025('0x13')]){if(_0x2b545b['error'][_0x1025('0x14')]===0x1f4){logger[_0x1025('0x13')](_0x1025('0xf'),_0x2ec8b3,_0x2b545b['error'][_0x1025('0x15')]);return _0x8c87ce(_0x2b545b['error']['message']);}logger[_0x1025('0x13')](_0x1025('0xf'),_0x2ec8b3,_0x2b545b[_0x1025('0x13')][_0x1025('0x15')]);return _0x9196d2(_0x2b545b[_0x1025('0x13')][_0x1025('0x15')]);}else{logger[_0x1025('0xe')]('ChatWebsite,\x20%s,\x20%s',_0x2ec8b3,_0x1025('0x10'));_0x9196d2(_0x2b545b[_0x1025('0x16')]['message']);}})[_0x1025('0x17')](function(_0x50aff3){logger[_0x1025('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x2ec8b3,_0x50aff3);_0x8c87ce(_0x50aff3);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 866f8e0..0233caf 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 _0x5479=['chatWebsite:','save','update','emit','removeListener','register'];(function(_0x418e6b,_0x262a9e){var _0x85e208=function(_0x4d02a4){while(--_0x4d02a4){_0x418e6b['push'](_0x418e6b['shift']());}};_0x85e208(++_0x262a9e);}(_0x5479,0x1cf));var _0x9547=function(_0x4859bc,_0x11cbcb){_0x4859bc=_0x4859bc-0x0;var _0x5e20a8=_0x5479[_0x4859bc];return _0x5e20a8;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x9547('0x0'),'remove',_0x9547('0x1')];function createListener(_0x14ccbe,_0x1ad843){return function(_0x5551b5){_0x1ad843[_0x9547('0x2')](_0x14ccbe,_0x5551b5);};}function removeListener(_0x56f8a7,_0xbdd3b4){return function(){ChatWebsiteEvents[_0x9547('0x3')](_0x56f8a7,_0xbdd3b4);};}exports[_0x9547('0x4')]=function(_0x5ef6fa){for(var _0x1b84d7=0x0,_0x37dd9c=events['length'];_0x1b84d7<_0x37dd9c;_0x1b84d7++){var _0x2e2f9a=events[_0x1b84d7];var _0x3f723a=createListener(_0x9547('0x5')+_0x2e2f9a,_0x5ef6fa);ChatWebsiteEvents['on'](_0x2e2f9a,_0x3f723a);}}; \ No newline at end of file +var _0x88e4=['save','remove','emit','removeListener','register','length','./chatWebsite.events'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x88e4,0xd1));var _0x488e=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x88e4[_0x487ab4];return _0x3bef77;};'use strict';var ChatWebsiteEvents=require(_0x488e('0x0'));var events=[_0x488e('0x1'),_0x488e('0x2'),'update'];function createListener(_0x1e2306,_0x25d3bb){return function(_0x2065ac){_0x25d3bb[_0x488e('0x3')](_0x1e2306,_0x2065ac);};}function removeListener(_0x131da4,_0x4e1dab){return function(){ChatWebsiteEvents[_0x488e('0x4')](_0x131da4,_0x4e1dab);};}exports[_0x488e('0x5')]=function(_0x401195){for(var _0x1a9329=0x0,_0x56a4fe=events[_0x488e('0x6')];_0x1a9329<_0x56a4fe;_0x1a9329++){var _0xf94626=events[_0x1a9329];var _0x1eaddb=createListener('chatWebsite:'+_0xf94626,_0x401195);ChatWebsiteEvents['on'](_0xf94626,_0x1eaddb);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 3a99ac4..b6b43be 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 _0xd136=['delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','format','now','originalname','single','addLogo','server/files/images/avatars/','%s-%s','/:id/avatar','file','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction','addApplications','put','update'];(function(_0x31e891,_0x2ca1ec){var _0x21aa5b=function(_0x5f43ec){while(--_0x5f43ec){_0x31e891['push'](_0x31e891['shift']());}};_0x21aa5b(++_0x2ca1ec);}(_0xd136,0x158));var _0x6d13=function(_0x392c80,_0x140fdd){_0x392c80=_0x392c80-0x0;var _0x692cf6=_0xd136[_0x392c80];return _0x692cf6;};'use strict';var multer=require(_0x6d13('0x0'));var util=require(_0x6d13('0x1'));var path=require('path');var timeout=require(_0x6d13('0x2'));var express=require(_0x6d13('0x3'));var router=express['Router']();var fs_extra=require(_0x6d13('0x4'));var auth=require(_0x6d13('0x5'));var interaction=require(_0x6d13('0x6'));var config=require(_0x6d13('0x7'));var controller=require('./chatWebsite.controller');router[_0x6d13('0x8')]('/',auth[_0x6d13('0x9')](),controller['index']);router['get'](_0x6d13('0xa'),auth[_0x6d13('0x9')](),controller['describe']);router[_0x6d13('0x8')](_0x6d13('0xb'),auth[_0x6d13('0x9')](),controller[_0x6d13('0xc')]);router['get'](_0x6d13('0xd'),auth['isAuthenticated'](),controller[_0x6d13('0xe')]);router['get'](_0x6d13('0xf'),auth[_0x6d13('0x9')](),controller[_0x6d13('0x10')]);router['get'](_0x6d13('0x11'),controller['getLogo']);router[_0x6d13('0x8')]('/:id/avatar',controller['getAvatar']);router['get'](_0x6d13('0x12'),controller[_0x6d13('0x13')]);router[_0x6d13('0x8')](_0x6d13('0x14'),controller[_0x6d13('0x15')]);router[_0x6d13('0x8')](_0x6d13('0x16'),auth[_0x6d13('0x9')](),controller[_0x6d13('0x17')]);router[_0x6d13('0x8')](_0x6d13('0x18'),controller[_0x6d13('0x19')]);router[_0x6d13('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6d13('0x1a')]);router['get'](_0x6d13('0x1b'),auth[_0x6d13('0x9')](),controller[_0x6d13('0x1c')]);router[_0x6d13('0x8')]('/:id/fields',controller[_0x6d13('0x1d')]);router[_0x6d13('0x8')](_0x6d13('0x1e'),auth[_0x6d13('0x9')](),controller['getOfflineMessages']);router[_0x6d13('0x8')](_0x6d13('0x1f'),auth[_0x6d13('0x9')](),controller[_0x6d13('0x20')]);router[_0x6d13('0x21')]('/',auth[_0x6d13('0x9')](),controller['create']);router['post'](_0x6d13('0xd'),auth[_0x6d13('0x9')](),controller[_0x6d13('0x22')]);router[_0x6d13('0x21')](_0x6d13('0xf'),auth['isAuthenticated'](),controller[_0x6d13('0x23')]);var upload=multer({'storage':multer[_0x6d13('0x24')]({'destination':function(_0x29d6b5,_0x36986c,_0x418ce3){_0x418ce3(null,path[_0x6d13('0x25')](config[_0x6d13('0x26')],'server/files/images/logos/'));},'filename':function(_0x185893,_0x17b097,_0x525fa0){_0x525fa0(null,util[_0x6d13('0x27')]('%s-%s',Date[_0x6d13('0x28')](),_0x17b097[_0x6d13('0x29')]));}})});router[_0x6d13('0x21')]('/:id/logo',upload[_0x6d13('0x2a')]('file'),controller[_0x6d13('0x2b')]);var upload=multer({'storage':multer[_0x6d13('0x24')]({'destination':function(_0x31407a,_0x1aa44b,_0x2e0b38){_0x2e0b38(null,path['join'](config['root'],_0x6d13('0x2c')));},'filename':function(_0x2f07e8,_0x1b54eb,_0x4a2465){_0x4a2465(null,util[_0x6d13('0x27')](_0x6d13('0x2d'),Date['now'](),_0x1b54eb[_0x6d13('0x29')]));}})});router['post'](_0x6d13('0x2e'),upload[_0x6d13('0x2a')](_0x6d13('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3be747,_0x44fcf7,_0x29b528){_0x29b528(null,path[_0x6d13('0x25')](config['root'],_0x6d13('0x2c')));},'filename':function(_0x49482f,_0x7f7758,_0x6d520e){_0x6d520e(null,util[_0x6d13('0x27')](_0x6d13('0x2d'),Date[_0x6d13('0x28')](),_0x7f7758[_0x6d13('0x29')]));}})});router[_0x6d13('0x21')](_0x6d13('0x12'),upload[_0x6d13('0x2a')](_0x6d13('0x2f')),controller[_0x6d13('0x30')]);var upload=multer({'storage':multer[_0x6d13('0x24')]({'destination':function(_0x13b32c,_0x826ef2,_0xcf0d96){_0xcf0d96(null,path['join'](config[_0x6d13('0x26')],'server/files/images/avatars/'));},'filename':function(_0x6d7b20,_0x3b9b18,_0x361c57){_0x361c57(null,util[_0x6d13('0x27')](_0x6d13('0x2d'),Date[_0x6d13('0x28')](),_0x3b9b18[_0x6d13('0x29')]));}})});router[_0x6d13('0x21')]('/:id/system_avatar',upload['single']('file'),controller[_0x6d13('0x31')]);router[_0x6d13('0x21')](_0x6d13('0x32'),controller[_0x6d13('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x6d13('0x24')]({'destination':function(_0x2c8970,_0x3527e6,_0x175654){const _0x2a7024=path[_0x6d13('0x25')](config[_0x6d13('0x26')],_0x6d13('0x34'),_0x6d13('0x35'),_0x6d13('0x36'));fs_extra[_0x6d13('0x37')](_0x2a7024,function(){_0x175654(null,_0x2a7024);});},'filename':function(_0x3eb111,_0x7640ac,_0x4ce26c){const _0x2f293d=_0x7640ac[_0x6d13('0x29')][_0x6d13('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2d1d11=path['extname'](_0x2f293d);const _0x1579c9=Date[_0x6d13('0x28')]()+'-'+_0x2f293d[_0x6d13('0x38')](_0x2d1d11,'')+_0x2d1d11;_0x4ce26c(null,_0x1579c9);}})});router[_0x6d13('0x21')](_0x6d13('0x39'),offlineUploadMulter[_0x6d13('0x3a')](),controller[_0x6d13('0x3b')]);router[_0x6d13('0x21')](_0x6d13('0x16'),auth[_0x6d13('0x9')](),controller[_0x6d13('0x3c')]);router[_0x6d13('0x21')]('/:id/applications',auth[_0x6d13('0x9')](),controller[_0x6d13('0x3d')]);router[_0x6d13('0x21')](_0x6d13('0x1b'),auth[_0x6d13('0x9')](),controller['addProactiveActions']);router[_0x6d13('0x21')](_0x6d13('0x1f'),auth[_0x6d13('0x9')](),controller['addAgents']);router[_0x6d13('0x3e')](_0x6d13('0xb'),auth[_0x6d13('0x9')](),controller[_0x6d13('0x3f')]);router[_0x6d13('0x40')](_0x6d13('0xb'),auth[_0x6d13('0x9')](),controller['destroy']);router[_0x6d13('0x40')]('/:id/dispositions',auth[_0x6d13('0x9')](),controller[_0x6d13('0x41')]);router[_0x6d13('0x40')](_0x6d13('0xf'),auth[_0x6d13('0x9')](),controller['removeAnswers']);router[_0x6d13('0x40')](_0x6d13('0x1f'),auth[_0x6d13('0x9')](),controller[_0x6d13('0x42')]);module[_0x6d13('0x43')]=router; \ No newline at end of file +var _0x76ab=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','join','root','format','now','originalname','single','file','server/files/images/avatars/','%s-%s','addAvatar','/:id/customer_avatar','addCustomerAvatar','diskStorage','server/files','offline-chat','replace','any','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x5d1441,_0x12f002){var _0x4228c5=function(_0xdc8a94){while(--_0xdc8a94){_0x5d1441['push'](_0x5d1441['shift']());}};_0x4228c5(++_0x12f002);}(_0x76ab,0xcf));var _0xb76a=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x76ab[_0x1b02bb];return _0x131245;};'use strict';var multer=require('multer');var util=require(_0xb76a('0x0'));var path=require(_0xb76a('0x1'));var timeout=require(_0xb76a('0x2'));var express=require('express');var router=express[_0xb76a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb76a('0x4'));var interaction=require(_0xb76a('0x5'));var config=require('../../config/environment');var controller=require(_0xb76a('0x6'));router['get']('/',auth[_0xb76a('0x7')](),controller[_0xb76a('0x8')]);router[_0xb76a('0x9')](_0xb76a('0xa'),auth[_0xb76a('0x7')](),controller[_0xb76a('0xb')]);router[_0xb76a('0x9')](_0xb76a('0xc'),auth[_0xb76a('0x7')](),controller[_0xb76a('0xd')]);router['get'](_0xb76a('0xe'),auth[_0xb76a('0x7')](),controller[_0xb76a('0xf')]);router[_0xb76a('0x9')](_0xb76a('0x10'),auth[_0xb76a('0x7')](),controller[_0xb76a('0x11')]);router[_0xb76a('0x9')](_0xb76a('0x12'),controller[_0xb76a('0x13')]);router[_0xb76a('0x9')](_0xb76a('0x14'),controller[_0xb76a('0x15')]);router['get']('/:id/customer_avatar',controller[_0xb76a('0x16')]);router[_0xb76a('0x9')](_0xb76a('0x17'),controller['getSystemAvatar']);router[_0xb76a('0x9')]('/:id/interactions',auth[_0xb76a('0x7')](),controller[_0xb76a('0x18')]);router[_0xb76a('0x9')](_0xb76a('0x19'),controller[_0xb76a('0x1a')]);router[_0xb76a('0x9')](_0xb76a('0x1b'),auth['isAuthenticated'](),controller[_0xb76a('0x1c')]);router[_0xb76a('0x9')](_0xb76a('0x1d'),auth[_0xb76a('0x7')](),controller[_0xb76a('0x1e')]);router['get'](_0xb76a('0x1f'),controller[_0xb76a('0x20')]);router[_0xb76a('0x9')]('/:id/offline_messages',auth[_0xb76a('0x7')](),controller[_0xb76a('0x21')]);router[_0xb76a('0x9')](_0xb76a('0x22'),auth[_0xb76a('0x7')](),controller[_0xb76a('0x23')]);router[_0xb76a('0x24')]('/',auth[_0xb76a('0x7')](),controller[_0xb76a('0x25')]);router[_0xb76a('0x24')](_0xb76a('0xe'),auth[_0xb76a('0x7')](),controller[_0xb76a('0x26')]);router[_0xb76a('0x24')](_0xb76a('0x10'),auth[_0xb76a('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x390e21,_0x4e6a26,_0x52655c){_0x52655c(null,path[_0xb76a('0x27')](config[_0xb76a('0x28')],'server/files/images/logos/'));},'filename':function(_0x5dcca4,_0x36a7c7,_0x228c24){_0x228c24(null,util[_0xb76a('0x29')]('%s-%s',Date[_0xb76a('0x2a')](),_0x36a7c7[_0xb76a('0x2b')]));}})});router[_0xb76a('0x24')](_0xb76a('0x12'),upload[_0xb76a('0x2c')](_0xb76a('0x2d')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x38af25,_0x2420c3,_0x5d9520){_0x5d9520(null,path['join'](config[_0xb76a('0x28')],_0xb76a('0x2e')));},'filename':function(_0x4dbeab,_0x5208b7,_0x43d2fa){_0x43d2fa(null,util[_0xb76a('0x29')](_0xb76a('0x2f'),Date[_0xb76a('0x2a')](),_0x5208b7[_0xb76a('0x2b')]));}})});router[_0xb76a('0x24')](_0xb76a('0x14'),upload[_0xb76a('0x2c')](_0xb76a('0x2d')),controller[_0xb76a('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39a213,_0xe5461f,_0x5de9d2){_0x5de9d2(null,path[_0xb76a('0x27')](config[_0xb76a('0x28')],'server/files/images/avatars/'));},'filename':function(_0x454e3d,_0x252425,_0x49eda5){_0x49eda5(null,util[_0xb76a('0x29')](_0xb76a('0x2f'),Date['now'](),_0x252425[_0xb76a('0x2b')]));}})});router[_0xb76a('0x24')](_0xb76a('0x31'),upload['single'](_0xb76a('0x2d')),controller[_0xb76a('0x32')]);var upload=multer({'storage':multer[_0xb76a('0x33')]({'destination':function(_0x1ad034,_0x2bd7e6,_0x4397bf){_0x4397bf(null,path['join'](config[_0xb76a('0x28')],'server/files/images/avatars/'));},'filename':function(_0x5b4d36,_0x13e8a6,_0x32aebf){_0x32aebf(null,util['format'](_0xb76a('0x2f'),Date['now'](),_0x13e8a6[_0xb76a('0x2b')]));}})});router['post'](_0xb76a('0x17'),upload[_0xb76a('0x2c')]('file'),controller['addSystemAvatar']);router[_0xb76a('0x24')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xb76a('0x33')]({'destination':function(_0x403f32,_0x38dd4b,_0x13312d){const _0x588046=path[_0xb76a('0x27')](config[_0xb76a('0x28')],_0xb76a('0x34'),'attachments',_0xb76a('0x35'));fs_extra['ensureDir'](_0x588046,function(){_0x13312d(null,_0x588046);});},'filename':function(_0xfa9173,_0x16281a,_0x49781d){const _0x5d8a68=_0x16281a[_0xb76a('0x2b')][_0xb76a('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x59a87f=path['extname'](_0x5d8a68);const _0xfa7545=Date['now']()+'-'+_0x5d8a68['replace'](_0x59a87f,'')+_0x59a87f;_0x49781d(null,_0xfa7545);}})});router[_0xb76a('0x24')]('/:id/offline',offlineUploadMulter[_0xb76a('0x37')](),controller['offline']);router[_0xb76a('0x24')](_0xb76a('0x38'),auth['isAuthenticated'](),controller[_0xb76a('0x39')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xb76a('0x3a')]);router['post'](_0xb76a('0x1d'),auth['isAuthenticated'](),controller[_0xb76a('0x3b')]);router[_0xb76a('0x24')](_0xb76a('0x22'),auth['isAuthenticated'](),controller[_0xb76a('0x3c')]);router[_0xb76a('0x3d')](_0xb76a('0xc'),auth['isAuthenticated'](),controller[_0xb76a('0x3e')]);router[_0xb76a('0x3f')](_0xb76a('0xc'),auth[_0xb76a('0x7')](),controller[_0xb76a('0x40')]);router['delete'](_0xb76a('0xe'),auth[_0xb76a('0x7')](),controller[_0xb76a('0x41')]);router['delete'](_0xb76a('0x10'),auth[_0xb76a('0x7')](),controller[_0xb76a('0x42')]);router[_0xb76a('0x3f')](_0xb76a('0x22'),auth[_0xb76a('0x7')](),controller[_0xb76a('0x43')]);module[_0xb76a('0x44')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c9083ae..f09e921 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 _0xc7a3=['STRING','ENUM','AmazonAWS','Google','exports'];(function(_0xe906a5,_0x3bfd31){var _0x4fb701=function(_0x18c9f1){while(--_0x18c9f1){_0xe906a5['push'](_0xe906a5['shift']());}};_0x4fb701(++_0x3bfd31);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x87ef72,_0x570105){_0x87ef72=_0x87ef72-0x0;var _0x22ba0f=_0xc7a3[_0x87ef72];return _0x22ba0f;};'use strict';var Sequelize=require('sequelize');module[_0x3c7a('0x0')]={'name':{'type':Sequelize[_0x3c7a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3c7a('0x2')](_0x3c7a('0x3'),_0x3c7a('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3c7a('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5c91=['exports','STRING','AmazonAWS','Google','sequelize'];(function(_0x33cf66,_0x30e414){var _0x3a400b=function(_0x29130b){while(--_0x29130b){_0x33cf66['push'](_0x33cf66['shift']());}};_0x3a400b(++_0x30e414);}(_0x5c91,0x1e9));var _0x15c9=function(_0x1c01d6,_0x4ceb21){_0x1c01d6=_0x1c01d6-0x0;var _0x56f5f0=_0x5c91[_0x1c01d6];return _0x56f5f0;};'use strict';var Sequelize=require(_0x15c9('0x0'));module[_0x15c9('0x1')]={'name':{'type':Sequelize[_0x15c9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x15c9('0x3'),_0x15c9('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x15c9('0x2')]},'data2':{'type':Sequelize[_0x15c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e222230..7e471fc 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 _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x1bf56f,_0xe09640){var _0x4aa20b=function(_0x32e7c4){while(--_0x32e7c4){_0x1bf56f['push'](_0x1bf56f['shift']());}};_0x4aa20b(++_0xe09640);}(_0xdb28,0x106));var _0x8db2=function(_0x325388,_0x4ec7de){_0x325388=_0x325388-0x0;var _0x30c413=_0xdb28[_0x325388];return _0x30c413;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CloudProvider','fieldName','type','key'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xadb5,0xad));var _0x5adb=function(_0x24f4e5,_0x297856){_0x24f4e5=_0x24f4e5-0x0;var _0x2e00c5=_0xadb5[_0x24f4e5];return _0x2e00c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CloudProvider']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 720aa2f..db26c12 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 _0xaf76=['exports','define','CloudProvider','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3cf884,_0x2274c8){var _0xc5b0ca=function(_0x520d32){while(--_0x520d32){_0x3cf884['push'](_0x3cf884['shift']());}};_0xc5b0ca(++_0x2274c8);}(_0xaf76,0x19d));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6af7('0x0'));var util=require('util');var logger=require(_0x6af7('0x1'))(_0x6af7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6af7('0x3'));var fs=require('fs');var path=require(_0x6af7('0x4'));var rimraf=require(_0x6af7('0x5'));var config=require(_0x6af7('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x6af7('0x7')]=function(_0x41ba91,_0x22e434){return _0x41ba91[_0x6af7('0x8')](_0x6af7('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e0b=['exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7e0b,0x163));var _0xb7e0=function(_0x5f2cb4,_0x36be8f){_0x5f2cb4=_0x5f2cb4-0x0;var _0x52184e=_0x7e0b[_0x5f2cb4];return _0x52184e;};'use strict';var _=require(_0xb7e0('0x0'));var util=require(_0xb7e0('0x1'));var logger=require(_0xb7e0('0x2'))(_0xb7e0('0x3'));var moment=require('moment');var BPromise=require(_0xb7e0('0x4'));var rp=require(_0xb7e0('0x5'));var fs=require('fs');var path=require(_0xb7e0('0x6'));var rimraf=require('rimraf');var config=require(_0xb7e0('0x7'));var attributes=require(_0xb7e0('0x8'));module[_0xb7e0('0x9')]=function(_0xd94a1e,_0x48f088){return _0xd94a1e[_0xb7e0('0xa')](_0xb7e0('0xb'),attributes,{'tableName':_0xb7e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 07f9191..0dae96b 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 _0xf9e5=['info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0xec25eb,_0x184e0d){var _0x5a5059=function(_0x4022f2){while(--_0x4022f2){_0xec25eb['push'](_0xec25eb['shift']());}};_0x5a5059(++_0x184e0d);}(_0xf9e5,0x89));var _0x5f9e=function(_0x59ce00,_0x204d43){_0x59ce00=_0x59ce00-0x0;var _0x36774e=_0xf9e5[_0x59ce00];return _0x36774e;};'use strict';var _=require(_0x5f9e('0x0'));var util=require(_0x5f9e('0x1'));var moment=require(_0x5f9e('0x2'));var BPromise=require(_0x5f9e('0x3'));var rs=require(_0x5f9e('0x4'));var fs=require('fs');var Redis=require(_0x5f9e('0x5'));var db=require(_0x5f9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f9e('0x7'))(_0x5f9e('0x8'));var config=require('../../config/environment');var jayson=require(_0x5f9e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8bb75c,_0x35fcc8,_0x4ee331){return new BPromise(function(_0x13de1c,_0x3cebf5){return client['request'](_0x8bb75c,_0x4ee331)['then'](function(_0x549a00){logger[_0x5f9e('0xa')](_0x5f9e('0xb'),_0x35fcc8,'request\x20sent');logger[_0x5f9e('0xc')](_0x5f9e('0xd'),_0x35fcc8,_0x5f9e('0xe'),JSON[_0x5f9e('0xf')](_0x549a00));if(_0x549a00[_0x5f9e('0x10')]){if(_0x549a00['error'][_0x5f9e('0x11')]===0x1f4){logger[_0x5f9e('0x10')](_0x5f9e('0xb'),_0x35fcc8,_0x549a00[_0x5f9e('0x10')]['message']);return _0x3cebf5(_0x549a00[_0x5f9e('0x10')][_0x5f9e('0x12')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x35fcc8,_0x549a00[_0x5f9e('0x10')][_0x5f9e('0x12')]);return _0x13de1c(_0x549a00[_0x5f9e('0x10')]['message']);}else{logger[_0x5f9e('0xa')](_0x5f9e('0xb'),_0x35fcc8,_0x5f9e('0xe'));_0x13de1c(_0x549a00[_0x5f9e('0x13')]['message']);}})[_0x5f9e('0x14')](function(_0x293fe2){logger['error']('CloudProvider,\x20%s,\x20%s',_0x35fcc8,_0x293fe2);_0x3cebf5(_0x293fe2);});});} \ No newline at end of file +var _0x1ab1=['client','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xee436a,_0x23daad){var _0x2e6f12=function(_0x5bddfa){while(--_0x5bddfa){_0xee436a['push'](_0xee436a['shift']());}};_0x2e6f12(++_0x23daad);}(_0x1ab1,0x12c));var _0x11ab=function(_0x83993b,_0x16e7aa){_0x83993b=_0x83993b-0x0;var _0x1cf6cc=_0x1ab1[_0x83993b];return _0x1cf6cc;};'use strict';var _=require(_0x11ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x11ab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11ab('0x2'));var logger=require('../../config/logger')(_0x11ab('0x3'));var config=require(_0x11ab('0x4'));var jayson=require(_0x11ab('0x5'));var client=jayson[_0x11ab('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eaf8b,_0xaf0223,_0x2788a0){return new BPromise(function(_0x441aca,_0x4b89b9){return client[_0x11ab('0x7')](_0x3eaf8b,_0x2788a0)['then'](function(_0x1abc4e){logger['info'](_0x11ab('0x8'),_0xaf0223,_0x11ab('0x9'));logger[_0x11ab('0xa')](_0x11ab('0xb'),_0xaf0223,'request\x20sent',JSON[_0x11ab('0xc')](_0x1abc4e));if(_0x1abc4e[_0x11ab('0xd')]){if(_0x1abc4e[_0x11ab('0xd')][_0x11ab('0xe')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0xaf0223,_0x1abc4e[_0x11ab('0xd')][_0x11ab('0xf')]);return _0x4b89b9(_0x1abc4e[_0x11ab('0xd')][_0x11ab('0xf')]);}logger[_0x11ab('0xd')]('CloudProvider,\x20%s,\x20%s',_0xaf0223,_0x1abc4e[_0x11ab('0xd')][_0x11ab('0xf')]);return _0x441aca(_0x1abc4e[_0x11ab('0xd')][_0x11ab('0xf')]);}else{logger['info'](_0x11ab('0x8'),_0xaf0223,_0x11ab('0x9'));_0x441aca(_0x1abc4e[_0x11ab('0x10')][_0x11ab('0xf')]);}})[_0x11ab('0x11')](function(_0x3a500b){logger[_0x11ab('0xd')]('CloudProvider,\x20%s,\x20%s',_0xaf0223,_0x3a500b);_0x4b89b9(_0x3a500b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 085c37c..c84a2e5 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 _0x28e2=['../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f808f,_0x2de01c){var _0x58a7aa=function(_0x1a81f9){while(--_0x1a81f9){_0x2f808f['push'](_0x2f808f['shift']());}};_0x58a7aa(++_0x2de01c);}(_0x28e2,0xf2));var _0x228e=function(_0x306c61,_0x292d64){_0x306c61=_0x306c61-0x0;var _0x2fff0b=_0x28e2[_0x306c61];return _0x2fff0b;};'use strict';var multer=require(_0x228e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x228e('0x1'));var router=express[_0x228e('0x2')]();var fs_extra=require(_0x228e('0x3'));var auth=require(_0x228e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x228e('0x5'));var controller=require(_0x228e('0x6'));router[_0x228e('0x7')]('/',auth[_0x228e('0x8')](),controller[_0x228e('0x9')]);router[_0x228e('0x7')](_0x228e('0xa'),auth[_0x228e('0x8')](),controller[_0x228e('0xb')]);router[_0x228e('0xc')]('/',auth[_0x228e('0x8')](),controller[_0x228e('0xd')]);router[_0x228e('0xe')](_0x228e('0xa'),auth[_0x228e('0x8')](),controller[_0x228e('0xf')]);router[_0x228e('0x10')](_0x228e('0xa'),auth['isAuthenticated'](),controller[_0x228e('0x11')]);module[_0x228e('0x12')]=router; \ No newline at end of file +var _0xade9=['create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x496c30,_0x4f32cf){var _0x168fbb=function(_0x26a112){while(--_0x26a112){_0x496c30['push'](_0x496c30['shift']());}};_0x168fbb(++_0x4f32cf);}(_0xade9,0x194));var _0x9ade=function(_0xd344ef,_0x132b5f){_0xd344ef=_0xd344ef-0x0;var _0x50a171=_0xade9[_0xd344ef];return _0x50a171;};'use strict';var multer=require(_0x9ade('0x0'));var util=require(_0x9ade('0x1'));var path=require(_0x9ade('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ade('0x3'));var router=express[_0x9ade('0x4')]();var fs_extra=require(_0x9ade('0x5'));var auth=require(_0x9ade('0x6'));var interaction=require(_0x9ade('0x7'));var config=require(_0x9ade('0x8'));var controller=require(_0x9ade('0x9'));router[_0x9ade('0xa')]('/',auth[_0x9ade('0xb')](),controller[_0x9ade('0xc')]);router['get'](_0x9ade('0xd'),auth[_0x9ade('0xb')](),controller[_0x9ade('0xe')]);router[_0x9ade('0xf')]('/',auth[_0x9ade('0xb')](),controller[_0x9ade('0x10')]);router[_0x9ade('0x11')](_0x9ade('0xd'),auth[_0x9ade('0xb')](),controller[_0x9ade('0x12')]);router['delete'](_0x9ade('0xd'),auth['isAuthenticated'](),controller[_0x9ade('0x13')]);module[_0x9ade('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index da64fa4..6a92407 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 _0xcefe=['name','sequelize','STRING'];(function(_0x56ffb0,_0x1e619b){var _0x4a4f2c=function(_0x21d16a){while(--_0x21d16a){_0x56ffb0['push'](_0x56ffb0['shift']());}};_0x4a4f2c(++_0x1e619b);}(_0xcefe,0x15a));var _0xecef=function(_0x42d40a,_0x3128eb){_0x42d40a=_0x42d40a-0x0;var _0x37803b=_0xcefe[_0x42d40a];return _0x37803b;};'use strict';var Sequelize=require(_0xecef('0x0'));module['exports']={'name':{'type':Sequelize[_0xecef('0x1')],'unique':_0xecef('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xecef('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xecef('0x1')]},'phone':{'type':Sequelize[_0xecef('0x1')]},'fax':{'type':Sequelize[_0xecef('0x1')]},'type':{'type':Sequelize[_0xecef('0x1')]},'street':{'type':Sequelize[_0xecef('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xecef('0x1')]},'email':{'type':Sequelize[_0xecef('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xecef('0x1')]},'sPostalCode':{'type':Sequelize[_0xecef('0x1')]},'sCity':{'type':Sequelize[_0xecef('0x1')]},'sCountry':{'type':Sequelize[_0xecef('0x1')]},'description':{'type':Sequelize[_0xecef('0x1')]}}; \ No newline at end of file +var _0x295e=['sequelize','exports','STRING'];(function(_0x4717b8,_0x331c49){var _0x42a536=function(_0x580b33){while(--_0x580b33){_0x4717b8['push'](_0x4717b8['shift']());}};_0x42a536(++_0x331c49);}(_0x295e,0x14a));var _0xe295=function(_0x3c6ce7,_0x212875){_0x3c6ce7=_0x3c6ce7-0x0;var _0xb0aa37=_0x295e[_0x3c6ce7];return _0xb0aa37;};'use strict';var Sequelize=require(_0xe295('0x0'));module[_0xe295('0x1')]={'name':{'type':Sequelize[_0xe295('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xe295('0x2')]},'companyId':{'type':Sequelize[_0xe295('0x2')]},'website':{'type':Sequelize[_0xe295('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xe295('0x2')]},'type':{'type':Sequelize[_0xe295('0x2')]},'street':{'type':Sequelize[_0xe295('0x2')]},'postalCode':{'type':Sequelize[_0xe295('0x2')]},'city':{'type':Sequelize[_0xe295('0x2')]},'country':{'type':Sequelize[_0xe295('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xe295('0x2')]},'sStreet':{'type':Sequelize[_0xe295('0x2')]},'sPostalCode':{'type':Sequelize[_0xe295('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xe295('0x2')]},'description':{'type':Sequelize[_0xe295('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e58e683..4723a79 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 _0xd998=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','CmCompany','includeAll','include','rows','catch','show','params','rawAttributes','find','create','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','omit','ids','getContacts','order','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5025ae,_0xba29c2){var _0xa26dac=function(_0x1dfd34){while(--_0x1dfd34){_0x5025ae['push'](_0x5025ae['shift']());}};_0xa26dac(++_0xba29c2);}(_0xd998,0x1a4));var _0x8d99=function(_0x2365db,_0x4ea500){_0x2365db=_0x2365db-0x0;var _0x2bee41=_0xd998[_0x2365db];return _0x2bee41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d99('0x0'));var zipdir=require(_0x8d99('0x1'));var jsonpatch=require(_0x8d99('0x2'));var rp=require(_0x8d99('0x3'));var moment=require(_0x8d99('0x4'));var BPromise=require(_0x8d99('0x5'));var Mustache=require(_0x8d99('0x6'));var util=require(_0x8d99('0x7'));var path=require(_0x8d99('0x8'));var sox=require(_0x8d99('0x9'));var csv=require(_0x8d99('0xa'));var ejs=require(_0x8d99('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d99('0xc'));var squel=require(_0x8d99('0xd'));var crypto=require(_0x8d99('0xe'));var jsforce=require(_0x8d99('0xf'));var deskjs=require(_0x8d99('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8d99('0x11'));var Papa=require(_0x8d99('0x12'));var Redis=require(_0x8d99('0x13'));var authService=require(_0x8d99('0x14'));var qs=require(_0x8d99('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d99('0x16'));var logger=require(_0x8d99('0x17'))(_0x8d99('0x18'));var utils=require(_0x8d99('0x19'));var config=require(_0x8d99('0x1a'));var licenseUtil=require(_0x8d99('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8d2213,_0x341847){_0x341847=_0x341847||0xcc;return function(_0x39cdf6){if(_0x39cdf6){return _0x8d2213[_0x8d99('0x1c')](_0x341847);}return _0x8d2213[_0x8d99('0x1d')](_0x341847)[_0x8d99('0x1e')]();};}function respondWithResult(_0xd85472,_0x5e5755){_0x5e5755=_0x5e5755||0xc8;return function(_0x17f24e){if(_0x17f24e){return _0xd85472[_0x8d99('0x1d')](_0x5e5755)[_0x8d99('0x1f')](_0x17f24e);}};}function respondWithFilteredResult(_0x4b4193,_0x354ad3){return function(_0x3cbe27){if(_0x3cbe27){var _0x5d444f=typeof _0x354ad3[_0x8d99('0x20')]===_0x8d99('0x21')&&typeof _0x354ad3['limit']===_0x8d99('0x21');var _0x518065=_0x3cbe27['count'];var _0x5b3f17=_0x5d444f?0x0:_0x354ad3[_0x8d99('0x20')];var _0x313018=_0x5d444f?_0x3cbe27[_0x8d99('0x22')]:_0x354ad3[_0x8d99('0x20')]+_0x354ad3[_0x8d99('0x23')];var _0xbfd503;if(_0x313018>=_0x518065){_0x313018=_0x518065;_0xbfd503=0xc8;}else{_0xbfd503=0xce;}_0x4b4193[_0x8d99('0x1d')](_0xbfd503);return _0x4b4193[_0x8d99('0x24')](_0x8d99('0x25'),_0x5b3f17+'-'+_0x313018+'/'+_0x518065)['json'](_0x3cbe27);}return null;};}function patchUpdates(_0x135e2f){return function(_0x2eba1e){try{jsonpatch[_0x8d99('0x26')](_0x2eba1e,_0x135e2f,!![]);}catch(_0x9dd589){return BPromise[_0x8d99('0x27')](_0x9dd589);}return _0x2eba1e[_0x8d99('0x28')]();};}function saveUpdates(_0x3cdf2c,_0x1437a7){return function(_0x173765){if(_0x173765){return _0x173765['update'](_0x3cdf2c)[_0x8d99('0x29')](function(_0x3c708f){return _0x3c708f;});}return null;};}function removeEntity(_0x27b840,_0x280d4a){return function(_0x13e564){if(_0x13e564){return _0x13e564['destroy']()['then'](function(){var _0x5ce40f=_0x13e564[_0x8d99('0x2a')]({'plain':!![]});var _0x54597f='Companies';return db[_0x8d99('0x2b')][_0x8d99('0x2c')]({'where':{'type':_0x54597f,'resourceId':_0x5ce40f['id']}})[_0x8d99('0x29')](function(){return _0x13e564;});})['then'](function(){_0x27b840[_0x8d99('0x1d')](0xcc)[_0x8d99('0x1e')]();});}};}function handleEntityNotFound(_0x1d0c47,_0x2c3ee4){return function(_0xb94fa){if(!_0xb94fa){_0x1d0c47[_0x8d99('0x1c')](0x194);}return _0xb94fa;};}function handleError(_0x48308e,_0x48bb4b){_0x48bb4b=_0x48bb4b||0x1f4;return function(_0x15fbd3){logger[_0x8d99('0x2d')](_0x15fbd3[_0x8d99('0x2e')]);if(_0x15fbd3[_0x8d99('0x2f')]){delete _0x15fbd3[_0x8d99('0x2f')];}_0x48308e['status'](_0x48bb4b)[_0x8d99('0x30')](_0x15fbd3);};}exports[_0x8d99('0x31')]=function(_0x5cf5c7,_0x53b9eb){var _0x74c05c={},_0x612713={},_0x5ab155={'count':0x0,'rows':[]};return db['CmCompany'][_0x8d99('0x32')]()['then'](function(_0x70fff){_0x612713[_0x8d99('0x33')]=_[_0x8d99('0x34')](_0x70fff);_0x612713[_0x8d99('0x35')]=_[_0x8d99('0x34')](_0x5cf5c7[_0x8d99('0x35')]);_0x612713[_0x8d99('0x36')]=_[_0x8d99('0x37')](_0x612713[_0x8d99('0x33')],_0x612713['query']);_0x74c05c[_0x8d99('0x38')]=_[_0x8d99('0x37')](_0x612713[_0x8d99('0x33')],qs[_0x8d99('0x39')](_0x5cf5c7[_0x8d99('0x35')][_0x8d99('0x39')]));_0x74c05c[_0x8d99('0x38')]=_0x74c05c[_0x8d99('0x38')][_0x8d99('0x3a')]?_0x74c05c[_0x8d99('0x38')]:_0x612713[_0x8d99('0x33')];if(!_0x5cf5c7[_0x8d99('0x35')][_0x8d99('0x3b')](_0x8d99('0x3c'))){_0x74c05c['limit']=qs[_0x8d99('0x23')](_0x5cf5c7[_0x8d99('0x35')][_0x8d99('0x23')]);_0x74c05c[_0x8d99('0x20')]=qs[_0x8d99('0x20')](_0x5cf5c7[_0x8d99('0x35')][_0x8d99('0x20')]);}_0x74c05c['order']=qs[_0x8d99('0x3d')](_0x5cf5c7[_0x8d99('0x35')][_0x8d99('0x3d')]);_0x74c05c[_0x8d99('0x3e')]=qs['filters'](_[_0x8d99('0x3f')](_0x5cf5c7['query'],_0x612713[_0x8d99('0x36')]),_0x70fff);if(_0x5cf5c7[_0x8d99('0x35')][_0x8d99('0x40')]){_0x74c05c[_0x8d99('0x3e')]=_[_0x8d99('0x41')](_0x74c05c[_0x8d99('0x3e')],{'$or':_['map'](_0x74c05c[_0x8d99('0x38')],function(_0x4aa517){var _0x400103={};_0x400103[_0x4aa517]={'$like':'%'+_0x5cf5c7['query']['filter']+'%'};return _0x400103;})});}_0x74c05c=_[_0x8d99('0x41')]({},_0x74c05c,_0x5cf5c7[_0x8d99('0x42')]);var _0x2c15c0={'where':_0x74c05c['where']};return db[_0x8d99('0x43')][_0x8d99('0x22')](_0x2c15c0)['then'](function(_0x1b90ed){_0x5ab155['count']=_0x1b90ed;if(_0x5cf5c7[_0x8d99('0x35')][_0x8d99('0x44')]){_0x74c05c[_0x8d99('0x45')]=[{'all':!![]}];}return db[_0x8d99('0x43')]['findAll'](_0x74c05c);})[_0x8d99('0x29')](function(_0x1289f8){_0x5ab155[_0x8d99('0x46')]=_0x1289f8;return _0x5ab155;})[_0x8d99('0x29')](respondWithFilteredResult(_0x53b9eb,_0x74c05c))[_0x8d99('0x47')](handleError(_0x53b9eb,null));})[_0x8d99('0x47')](handleError(_0x53b9eb,null));};exports[_0x8d99('0x48')]=function(_0x33da08,_0x16f597){var _0x5d51e7={'raw':![],'where':{'id':_0x33da08[_0x8d99('0x49')]['id']}},_0x4f93ff={};_0x4f93ff[_0x8d99('0x33')]=_[_0x8d99('0x34')](db[_0x8d99('0x43')][_0x8d99('0x4a')]);_0x4f93ff[_0x8d99('0x35')]=_[_0x8d99('0x34')](_0x33da08['query']);_0x4f93ff[_0x8d99('0x36')]=_[_0x8d99('0x37')](_0x4f93ff[_0x8d99('0x33')],_0x4f93ff[_0x8d99('0x35')]);_0x5d51e7[_0x8d99('0x38')]=_[_0x8d99('0x37')](_0x4f93ff[_0x8d99('0x33')],qs[_0x8d99('0x39')](_0x33da08['query'][_0x8d99('0x39')]));_0x5d51e7[_0x8d99('0x38')]=_0x5d51e7['attributes']['length']?_0x5d51e7[_0x8d99('0x38')]:_0x4f93ff[_0x8d99('0x33')];if(_0x33da08[_0x8d99('0x35')][_0x8d99('0x44')]){_0x5d51e7[_0x8d99('0x45')]=[{'all':!![]}];}_0x5d51e7=_[_0x8d99('0x41')]({},_0x5d51e7,_0x33da08[_0x8d99('0x42')]);return db[_0x8d99('0x43')][_0x8d99('0x4b')](_0x5d51e7)[_0x8d99('0x29')](handleEntityNotFound(_0x16f597,null))[_0x8d99('0x29')](respondWithResult(_0x16f597,null))[_0x8d99('0x47')](handleError(_0x16f597,null));};exports[_0x8d99('0x4c')]=function(_0x5a53b9,_0x3c735a){return db[_0x8d99('0x43')][_0x8d99('0x4c')](_0x5a53b9['body'],{})[_0x8d99('0x29')](function(_0x9a901){var _0x26ae94=_0x5a53b9['user']['get']({'plain':!![]});if(!_0x26ae94)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26ae94['role']==='user'){var _0x346ad2=_0x9a901['get']({'plain':!![]});var _0x4ec283='Companies';return db[_0x8d99('0x4d')][_0x8d99('0x4b')]({'where':{'name':_0x4ec283,'userProfileId':_0x26ae94[_0x8d99('0x4e')]},'raw':!![]})['then'](function(_0x1ad510){if(_0x1ad510&&_0x1ad510[_0x8d99('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x346ad2[_0x8d99('0x2f')],'resourceId':_0x346ad2['id'],'type':_0x1ad510[_0x8d99('0x2f')],'sectionId':_0x1ad510['id']},{})[_0x8d99('0x29')](function(){return _0x9a901;});}else{return _0x9a901;}})[_0x8d99('0x47')](function(_0x1a0cf8){logger[_0x8d99('0x2d')](_0x8d99('0x50'),_0x1a0cf8);throw _0x1a0cf8;});}return _0x9a901;})[_0x8d99('0x29')](respondWithResult(_0x3c735a,0xc9))[_0x8d99('0x47')](handleError(_0x3c735a,null));};exports['update']=function(_0xdd9b2,_0x401a35){if(_0xdd9b2[_0x8d99('0x51')]['id']){delete _0xdd9b2[_0x8d99('0x51')]['id'];}return db['CmCompany'][_0x8d99('0x4b')]({'where':{'id':_0xdd9b2['params']['id']}})[_0x8d99('0x29')](handleEntityNotFound(_0x401a35,null))[_0x8d99('0x29')](saveUpdates(_0xdd9b2['body'],null))[_0x8d99('0x29')](respondWithResult(_0x401a35,null))['catch'](handleError(_0x401a35,null));};exports['destroy']=function(_0xfa5f6c,_0x30f159){return db[_0x8d99('0x43')][_0x8d99('0x4b')]({'where':{'id':_0xfa5f6c['params']['id']}})[_0x8d99('0x29')](handleEntityNotFound(_0x30f159,null))[_0x8d99('0x29')](removeEntity(_0x30f159,null))[_0x8d99('0x47')](handleError(_0x30f159,null));};exports[_0x8d99('0x32')]=function(_0x1548cb,_0x52bc42){return db['CmCompany'][_0x8d99('0x32')]()[_0x8d99('0x29')](respondWithResult(_0x52bc42,null))['catch'](handleError(_0x52bc42,null));};exports[_0x8d99('0x52')]=function(_0x1176e0,_0x2a256d,_0x2a34f8){return db['CmContact'][_0x8d99('0x4b')]({'where':{'id':_0x1176e0[_0x8d99('0x49')]['id']}})[_0x8d99('0x29')](handleEntityNotFound(_0x2a256d,null))[_0x8d99('0x29')](function(_0x4f4051){if(_0x4f4051){return _0x4f4051[_0x8d99('0x52')](_0x1176e0['body']['ids'],_[_0x8d99('0x53')](_0x1176e0[_0x8d99('0x51')],[_0x8d99('0x54'),'id'])||{});}})[_0x8d99('0x29')](respondWithResult(_0x2a256d,null))[_0x8d99('0x47')](handleError(_0x2a256d,null));};exports[_0x8d99('0x55')]=function(_0x3993ab,_0x149a93,_0x401027){var _0x4b4da4={};var _0x105eba={};var _0x4b35b6;var _0x474e8a;return db[_0x8d99('0x43')]['findOne']({'where':{'id':_0x3993ab[_0x8d99('0x49')]['id']}})[_0x8d99('0x29')](handleEntityNotFound(_0x149a93,null))[_0x8d99('0x29')](function(_0x5601b9){if(_0x5601b9){_0x4b35b6=_0x5601b9;_0x105eba[_0x8d99('0x33')]=_[_0x8d99('0x34')](db['CmContact'][_0x8d99('0x4a')]);_0x105eba['query']=_[_0x8d99('0x34')](_0x3993ab[_0x8d99('0x35')]);_0x105eba['filters']=_[_0x8d99('0x37')](_0x105eba[_0x8d99('0x33')],_0x105eba[_0x8d99('0x35')]);_0x4b4da4['attributes']=_[_0x8d99('0x37')](_0x105eba[_0x8d99('0x33')],qs[_0x8d99('0x39')](_0x3993ab[_0x8d99('0x35')][_0x8d99('0x39')]));_0x4b4da4[_0x8d99('0x38')]=_0x4b4da4[_0x8d99('0x38')][_0x8d99('0x3a')]?_0x4b4da4[_0x8d99('0x38')]:_0x105eba[_0x8d99('0x33')];_0x4b4da4[_0x8d99('0x56')]=qs[_0x8d99('0x3d')](_0x3993ab[_0x8d99('0x35')][_0x8d99('0x3d')]);_0x4b4da4[_0x8d99('0x3e')]=qs[_0x8d99('0x36')](_[_0x8d99('0x3f')](_0x3993ab[_0x8d99('0x35')],_0x105eba[_0x8d99('0x36')]));if(_0x3993ab['query'][_0x8d99('0x40')]){_0x4b4da4['where']=_[_0x8d99('0x41')](_0x4b4da4[_0x8d99('0x3e')],{'$or':_[_0x8d99('0x57')](_0x4b4da4['attributes'],function(_0x5dbdbe){var _0x11a82b={};_0x11a82b[_0x5dbdbe]={'$like':'%'+_0x3993ab[_0x8d99('0x35')][_0x8d99('0x40')]+'%'};return _0x11a82b;})});}_0x4b4da4=_['merge']({},_0x4b4da4,_0x3993ab[_0x8d99('0x42')]);return _0x4b35b6[_0x8d99('0x55')](_0x4b4da4);}})['then'](function(_0x50b029){if(_0x50b029){_0x474e8a=_0x50b029['length'];if(!_0x3993ab[_0x8d99('0x35')][_0x8d99('0x3b')](_0x8d99('0x3c'))){_0x4b4da4['limit']=qs[_0x8d99('0x23')](_0x3993ab[_0x8d99('0x35')][_0x8d99('0x23')]);_0x4b4da4[_0x8d99('0x20')]=qs['offset'](_0x3993ab[_0x8d99('0x35')][_0x8d99('0x20')]);}return _0x4b35b6['getContacts'](_0x4b4da4);}})[_0x8d99('0x29')](function(_0xa08bbb){if(_0xa08bbb){return _0xa08bbb?{'count':_0x474e8a,'rows':_0xa08bbb}:null;}})[_0x8d99('0x29')](respondWithResult(_0x149a93,null))[_0x8d99('0x47')](handleError(_0x149a93,null));}; \ No newline at end of file +var _0x6ecf=['getContacts','findOne','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Companies','UserProfileResource','end','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','map','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','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','update','CmContact','addContacts','ids','omit'];(function(_0x37635e,_0x21b6f5){var _0x3c0965=function(_0xe9864c){while(--_0xe9864c){_0x37635e['push'](_0x37635e['shift']());}};_0x3c0965(++_0x21b6f5);}(_0x6ecf,0x120));var _0xf6ec=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x6ecf[_0x102e37];return _0x35a07c;};'use strict';var emlformat=require(_0xf6ec('0x0'));var rimraf=require(_0xf6ec('0x1'));var zipdir=require(_0xf6ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6ec('0x3'));var moment=require(_0xf6ec('0x4'));var BPromise=require(_0xf6ec('0x5'));var Mustache=require(_0xf6ec('0x6'));var util=require(_0xf6ec('0x7'));var path=require(_0xf6ec('0x8'));var sox=require('sox');var csv=require(_0xf6ec('0x9'));var ejs=require(_0xf6ec('0xa'));var fs=require('fs');var fs_extra=require(_0xf6ec('0xb'));var _=require('lodash');var squel=require(_0xf6ec('0xc'));var crypto=require(_0xf6ec('0xd'));var jsforce=require(_0xf6ec('0xe'));var deskjs=require(_0xf6ec('0xf'));var toCsv=require(_0xf6ec('0x9'));var querystring=require(_0xf6ec('0x10'));var Papa=require(_0xf6ec('0x11'));var Redis=require(_0xf6ec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf6ec('0x13'));var as=require(_0xf6ec('0x14'));var hardwareService=require(_0xf6ec('0x15'));var logger=require(_0xf6ec('0x16'))(_0xf6ec('0x17'));var utils=require(_0xf6ec('0x18'));var config=require(_0xf6ec('0x19'));var licenseUtil=require(_0xf6ec('0x1a'));var db=require(_0xf6ec('0x1b'))['db'];function respondWithStatusCode(_0xd786ec,_0x23689b){_0x23689b=_0x23689b||0xcc;return function(_0x5e3884){if(_0x5e3884){return _0xd786ec[_0xf6ec('0x1c')](_0x23689b);}return _0xd786ec['status'](_0x23689b)['end']();};}function respondWithResult(_0x303978,_0xa0db2c){_0xa0db2c=_0xa0db2c||0xc8;return function(_0x2ccf93){if(_0x2ccf93){return _0x303978[_0xf6ec('0x1d')](_0xa0db2c)[_0xf6ec('0x1e')](_0x2ccf93);}};}function respondWithFilteredResult(_0xa26a45,_0x352486){return function(_0x704ec1){if(_0x704ec1){var _0x2e8f32=typeof _0x352486[_0xf6ec('0x1f')]===_0xf6ec('0x20')&&typeof _0x352486[_0xf6ec('0x21')]===_0xf6ec('0x20');var _0xb25d4f=_0x704ec1[_0xf6ec('0x22')];var _0x22f015=_0x2e8f32?0x0:_0x352486['offset'];var _0x185954=_0x2e8f32?_0x704ec1[_0xf6ec('0x22')]:_0x352486[_0xf6ec('0x1f')]+_0x352486[_0xf6ec('0x21')];var _0xc94bb9;if(_0x185954>=_0xb25d4f){_0x185954=_0xb25d4f;_0xc94bb9=0xc8;}else{_0xc94bb9=0xce;}_0xa26a45[_0xf6ec('0x1d')](_0xc94bb9);return _0xa26a45[_0xf6ec('0x23')](_0xf6ec('0x24'),_0x22f015+'-'+_0x185954+'/'+_0xb25d4f)[_0xf6ec('0x1e')](_0x704ec1);}return null;};}function patchUpdates(_0x476f50){return function(_0x17ff75){try{jsonpatch[_0xf6ec('0x25')](_0x17ff75,_0x476f50,!![]);}catch(_0x38067e){return BPromise[_0xf6ec('0x26')](_0x38067e);}return _0x17ff75[_0xf6ec('0x27')]();};}function saveUpdates(_0x2ad3b9,_0x4b30bb){return function(_0x19687b){if(_0x19687b){return _0x19687b['update'](_0x2ad3b9)['then'](function(_0x5813b7){return _0x5813b7;});}return null;};}function removeEntity(_0x568948,_0x1175d1){return function(_0x3f6b2b){if(_0x3f6b2b){return _0x3f6b2b[_0xf6ec('0x28')]()[_0xf6ec('0x29')](function(){var _0x52270b=_0x3f6b2b[_0xf6ec('0x2a')]({'plain':!![]});var _0x175a4d=_0xf6ec('0x2b');return db[_0xf6ec('0x2c')][_0xf6ec('0x28')]({'where':{'type':_0x175a4d,'resourceId':_0x52270b['id']}})[_0xf6ec('0x29')](function(){return _0x3f6b2b;});})[_0xf6ec('0x29')](function(){_0x568948['status'](0xcc)[_0xf6ec('0x2d')]();});}};}function handleEntityNotFound(_0x1f8f5d,_0x2f4d82){return function(_0x38275a){if(!_0x38275a){_0x1f8f5d[_0xf6ec('0x1c')](0x194);}return _0x38275a;};}function handleError(_0xf05b78,_0x3e8d09){_0x3e8d09=_0x3e8d09||0x1f4;return function(_0x5bc1b1){logger['error'](_0x5bc1b1[_0xf6ec('0x2e')]);if(_0x5bc1b1[_0xf6ec('0x2f')]){delete _0x5bc1b1[_0xf6ec('0x2f')];}_0xf05b78[_0xf6ec('0x1d')](_0x3e8d09)[_0xf6ec('0x30')](_0x5bc1b1);};}exports[_0xf6ec('0x31')]=function(_0xa19aa2,_0x181402){var _0x270405={},_0x2f7fd3={},_0x2f808f={'count':0x0,'rows':[]};return db[_0xf6ec('0x32')][_0xf6ec('0x33')]()[_0xf6ec('0x29')](function(_0x5c8098){_0x2f7fd3[_0xf6ec('0x34')]=_['keys'](_0x5c8098);_0x2f7fd3[_0xf6ec('0x35')]=_[_0xf6ec('0x36')](_0xa19aa2[_0xf6ec('0x35')]);_0x2f7fd3[_0xf6ec('0x37')]=_[_0xf6ec('0x38')](_0x2f7fd3['model'],_0x2f7fd3[_0xf6ec('0x35')]);_0x270405[_0xf6ec('0x39')]=_[_0xf6ec('0x38')](_0x2f7fd3[_0xf6ec('0x34')],qs[_0xf6ec('0x3a')](_0xa19aa2[_0xf6ec('0x35')]['fields']));_0x270405['attributes']=_0x270405[_0xf6ec('0x39')][_0xf6ec('0x3b')]?_0x270405[_0xf6ec('0x39')]:_0x2f7fd3[_0xf6ec('0x34')];if(!_0xa19aa2[_0xf6ec('0x35')][_0xf6ec('0x3c')]('nolimit')){_0x270405[_0xf6ec('0x21')]=qs[_0xf6ec('0x21')](_0xa19aa2['query'][_0xf6ec('0x21')]);_0x270405[_0xf6ec('0x1f')]=qs[_0xf6ec('0x1f')](_0xa19aa2[_0xf6ec('0x35')][_0xf6ec('0x1f')]);}_0x270405[_0xf6ec('0x3d')]=qs['sort'](_0xa19aa2[_0xf6ec('0x35')][_0xf6ec('0x3e')]);_0x270405['where']=qs[_0xf6ec('0x37')](_[_0xf6ec('0x3f')](_0xa19aa2[_0xf6ec('0x35')],_0x2f7fd3['filters']),_0x5c8098);if(_0xa19aa2[_0xf6ec('0x35')]['filter']){_0x270405[_0xf6ec('0x40')]=_[_0xf6ec('0x41')](_0x270405[_0xf6ec('0x40')],{'$or':_[_0xf6ec('0x42')](_0x270405[_0xf6ec('0x39')],function(_0x54d7fb){var _0x2106a5={};_0x2106a5[_0x54d7fb]={'$like':'%'+_0xa19aa2[_0xf6ec('0x35')][_0xf6ec('0x43')]+'%'};return _0x2106a5;})});}_0x270405=_[_0xf6ec('0x41')]({},_0x270405,_0xa19aa2['options']);var _0x5b261d={'where':_0x270405[_0xf6ec('0x40')]};return db['CmCompany'][_0xf6ec('0x22')](_0x5b261d)['then'](function(_0x5aa02e){_0x2f808f[_0xf6ec('0x22')]=_0x5aa02e;if(_0xa19aa2[_0xf6ec('0x35')][_0xf6ec('0x44')]){_0x270405[_0xf6ec('0x45')]=[{'all':!![]}];}return db['CmCompany'][_0xf6ec('0x46')](_0x270405);})[_0xf6ec('0x29')](function(_0x3558f4){_0x2f808f[_0xf6ec('0x47')]=_0x3558f4;return _0x2f808f;})[_0xf6ec('0x29')](respondWithFilteredResult(_0x181402,_0x270405))[_0xf6ec('0x48')](handleError(_0x181402,null));})[_0xf6ec('0x48')](handleError(_0x181402,null));};exports[_0xf6ec('0x49')]=function(_0x38a309,_0x851be1){var _0x1f82a6={'raw':![],'where':{'id':_0x38a309[_0xf6ec('0x4a')]['id']}},_0x5d6e73={};_0x5d6e73[_0xf6ec('0x34')]=_[_0xf6ec('0x36')](db[_0xf6ec('0x32')][_0xf6ec('0x4b')]);_0x5d6e73[_0xf6ec('0x35')]=_[_0xf6ec('0x36')](_0x38a309[_0xf6ec('0x35')]);_0x5d6e73[_0xf6ec('0x37')]=_['intersection'](_0x5d6e73['model'],_0x5d6e73[_0xf6ec('0x35')]);_0x1f82a6[_0xf6ec('0x39')]=_['intersection'](_0x5d6e73[_0xf6ec('0x34')],qs['fields'](_0x38a309['query'][_0xf6ec('0x3a')]));_0x1f82a6['attributes']=_0x1f82a6[_0xf6ec('0x39')][_0xf6ec('0x3b')]?_0x1f82a6[_0xf6ec('0x39')]:_0x5d6e73[_0xf6ec('0x34')];if(_0x38a309[_0xf6ec('0x35')]['includeAll']){_0x1f82a6['include']=[{'all':!![]}];}_0x1f82a6=_[_0xf6ec('0x41')]({},_0x1f82a6,_0x38a309[_0xf6ec('0x4c')]);return db['CmCompany']['find'](_0x1f82a6)[_0xf6ec('0x29')](handleEntityNotFound(_0x851be1,null))['then'](respondWithResult(_0x851be1,null))[_0xf6ec('0x48')](handleError(_0x851be1,null));};exports[_0xf6ec('0x4d')]=function(_0x3a0abd,_0x3edcdf){return db[_0xf6ec('0x32')]['create'](_0x3a0abd[_0xf6ec('0x4e')],{})['then'](function(_0x36f3e6){var _0x41d492=_0x3a0abd[_0xf6ec('0x4f')]['get']({'plain':!![]});if(!_0x41d492)throw new Error(_0xf6ec('0x50'));if(_0x41d492[_0xf6ec('0x51')]===_0xf6ec('0x4f')){var _0x5dea7c=_0x36f3e6[_0xf6ec('0x2a')]({'plain':!![]});var _0x840087=_0xf6ec('0x2b');return db['UserProfileSection'][_0xf6ec('0x52')]({'where':{'name':_0x840087,'userProfileId':_0x41d492[_0xf6ec('0x53')]},'raw':!![]})[_0xf6ec('0x29')](function(_0x23b6ad){if(_0x23b6ad&&_0x23b6ad[_0xf6ec('0x54')]===0x0){return db[_0xf6ec('0x2c')][_0xf6ec('0x4d')]({'name':_0x5dea7c['name'],'resourceId':_0x5dea7c['id'],'type':_0x23b6ad[_0xf6ec('0x2f')],'sectionId':_0x23b6ad['id']},{})[_0xf6ec('0x29')](function(){return _0x36f3e6;});}else{return _0x36f3e6;}})[_0xf6ec('0x48')](function(_0x38cdd3){logger[_0xf6ec('0x55')](_0xf6ec('0x56'),_0x38cdd3);throw _0x38cdd3;});}return _0x36f3e6;})[_0xf6ec('0x29')](respondWithResult(_0x3edcdf,0xc9))[_0xf6ec('0x48')](handleError(_0x3edcdf,null));};exports[_0xf6ec('0x57')]=function(_0x32e74e,_0x5aceb6){if(_0x32e74e['body']['id']){delete _0x32e74e['body']['id'];}return db[_0xf6ec('0x32')][_0xf6ec('0x52')]({'where':{'id':_0x32e74e[_0xf6ec('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5aceb6,null))['then'](saveUpdates(_0x32e74e[_0xf6ec('0x4e')],null))[_0xf6ec('0x29')](respondWithResult(_0x5aceb6,null))[_0xf6ec('0x48')](handleError(_0x5aceb6,null));};exports[_0xf6ec('0x28')]=function(_0x4489ac,_0x508ad7){return db[_0xf6ec('0x32')][_0xf6ec('0x52')]({'where':{'id':_0x4489ac[_0xf6ec('0x4a')]['id']}})[_0xf6ec('0x29')](handleEntityNotFound(_0x508ad7,null))[_0xf6ec('0x29')](removeEntity(_0x508ad7,null))['catch'](handleError(_0x508ad7,null));};exports[_0xf6ec('0x33')]=function(_0x480f26,_0x4cef1d){return db[_0xf6ec('0x32')][_0xf6ec('0x33')]()['then'](respondWithResult(_0x4cef1d,null))[_0xf6ec('0x48')](handleError(_0x4cef1d,null));};exports['addContacts']=function(_0x535440,_0x3371d2,_0x58c2c2){return db[_0xf6ec('0x58')][_0xf6ec('0x52')]({'where':{'id':_0x535440[_0xf6ec('0x4a')]['id']}})[_0xf6ec('0x29')](handleEntityNotFound(_0x3371d2,null))[_0xf6ec('0x29')](function(_0x34ce50){if(_0x34ce50){return _0x34ce50[_0xf6ec('0x59')](_0x535440[_0xf6ec('0x4e')][_0xf6ec('0x5a')],_[_0xf6ec('0x5b')](_0x535440['body'],[_0xf6ec('0x5a'),'id'])||{});}})[_0xf6ec('0x29')](respondWithResult(_0x3371d2,null))[_0xf6ec('0x48')](handleError(_0x3371d2,null));};exports[_0xf6ec('0x5c')]=function(_0x411401,_0x2088d7,_0x3b8236){var _0x21e133={};var _0xcd8aac={};var _0x19d124;var _0x331362;return db[_0xf6ec('0x32')][_0xf6ec('0x5d')]({'where':{'id':_0x411401['params']['id']}})[_0xf6ec('0x29')](handleEntityNotFound(_0x2088d7,null))[_0xf6ec('0x29')](function(_0x49d5a5){if(_0x49d5a5){_0x19d124=_0x49d5a5;_0xcd8aac[_0xf6ec('0x34')]=_['keys'](db[_0xf6ec('0x58')][_0xf6ec('0x4b')]);_0xcd8aac['query']=_[_0xf6ec('0x36')](_0x411401['query']);_0xcd8aac[_0xf6ec('0x37')]=_[_0xf6ec('0x38')](_0xcd8aac[_0xf6ec('0x34')],_0xcd8aac[_0xf6ec('0x35')]);_0x21e133[_0xf6ec('0x39')]=_[_0xf6ec('0x38')](_0xcd8aac[_0xf6ec('0x34')],qs['fields'](_0x411401[_0xf6ec('0x35')][_0xf6ec('0x3a')]));_0x21e133[_0xf6ec('0x39')]=_0x21e133['attributes'][_0xf6ec('0x3b')]?_0x21e133[_0xf6ec('0x39')]:_0xcd8aac['model'];_0x21e133[_0xf6ec('0x3d')]=qs[_0xf6ec('0x3e')](_0x411401[_0xf6ec('0x35')][_0xf6ec('0x3e')]);_0x21e133[_0xf6ec('0x40')]=qs['filters'](_['pick'](_0x411401[_0xf6ec('0x35')],_0xcd8aac[_0xf6ec('0x37')]));if(_0x411401['query'][_0xf6ec('0x43')]){_0x21e133[_0xf6ec('0x40')]=_['merge'](_0x21e133[_0xf6ec('0x40')],{'$or':_[_0xf6ec('0x42')](_0x21e133[_0xf6ec('0x39')],function(_0x42e62b){var _0x16730c={};_0x16730c[_0x42e62b]={'$like':'%'+_0x411401[_0xf6ec('0x35')]['filter']+'%'};return _0x16730c;})});}_0x21e133=_[_0xf6ec('0x41')]({},_0x21e133,_0x411401[_0xf6ec('0x4c')]);return _0x19d124['getContacts'](_0x21e133);}})[_0xf6ec('0x29')](function(_0x29f373){if(_0x29f373){_0x331362=_0x29f373['length'];if(!_0x411401['query'][_0xf6ec('0x3c')](_0xf6ec('0x5e'))){_0x21e133['limit']=qs[_0xf6ec('0x21')](_0x411401[_0xf6ec('0x35')][_0xf6ec('0x21')]);_0x21e133['offset']=qs[_0xf6ec('0x1f')](_0x411401[_0xf6ec('0x35')][_0xf6ec('0x1f')]);}return _0x19d124[_0xf6ec('0x5c')](_0x21e133);}})[_0xf6ec('0x29')](function(_0x15fcde){if(_0x15fcde){return _0x15fcde?{'count':_0x331362,'rows':_0x15fcde}:null;}})[_0xf6ec('0x29')](respondWithResult(_0x2088d7,null))[_0xf6ec('0x48')](handleError(_0x2088d7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ae9cc59..5b46c73 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 _0xaa23=['define','CmCompany','cm_companies','util','../../config/logger','api','moment','path','../../config/environment','./cmCompany.attributes'];(function(_0x1605a0,_0x11d5a2){var _0x1c279f=function(_0x520e69){while(--_0x520e69){_0x1605a0['push'](_0x1605a0['shift']());}};_0x1c279f(++_0x11d5a2);}(_0xaa23,0x157));var _0x3aa2=function(_0x3d368b,_0xbbc5db){_0x3d368b=_0x3d368b-0x0;var _0x579af1=_0xaa23[_0x3d368b];return _0x579af1;};'use strict';var _=require('lodash');var util=require(_0x3aa2('0x0'));var logger=require(_0x3aa2('0x1'))(_0x3aa2('0x2'));var moment=require(_0x3aa2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3aa2('0x4'));var rimraf=require('rimraf');var config=require(_0x3aa2('0x5'));var attributes=require(_0x3aa2('0x6'));module['exports']=function(_0x5a42f0,_0x5fac46){return _0x5a42f0[_0x3aa2('0x7')](_0x3aa2('0x8'),attributes,{'tableName':_0x3aa2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa2c=['cm_companies','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','CmCompany'];(function(_0x3941e6,_0x8f277f){var _0x3b363d=function(_0x4bffa4){while(--_0x4bffa4){_0x3941e6['push'](_0x3941e6['shift']());}};_0x3b363d(++_0x8f277f);}(_0xaa2c,0x9d));var _0xcaa2=function(_0x9a9f46,_0x1d1e25){_0x9a9f46=_0x9a9f46-0x0;var _0x5dc8be=_0xaa2c[_0x9a9f46];return _0x5dc8be;};'use strict';var _=require(_0xcaa2('0x0'));var util=require(_0xcaa2('0x1'));var logger=require('../../config/logger')(_0xcaa2('0x2'));var moment=require(_0xcaa2('0x3'));var BPromise=require(_0xcaa2('0x4'));var rp=require(_0xcaa2('0x5'));var fs=require('fs');var path=require(_0xcaa2('0x6'));var rimraf=require('rimraf');var config=require(_0xcaa2('0x7'));var attributes=require(_0xcaa2('0x8'));module[_0xcaa2('0x9')]=function(_0x57f517,_0x4ba08e){return _0x57f517['define'](_0xcaa2('0xa'),attributes,{'tableName':_0xcaa2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 016eda4..5a65160 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 _0x314d=['jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1fe705,_0x2ed051){var _0x41e937=function(_0x3cc23e){while(--_0x3cc23e){_0x1fe705['push'](_0x1fe705['shift']());}};_0x41e937(++_0x2ed051);}(_0x314d,0x186));var _0xd314=function(_0x59fc4d,_0x1187f5){_0x59fc4d=_0x59fc4d-0x0;var _0x253646=_0x314d[_0x59fc4d];return _0x253646;};'use strict';var _=require('lodash');var util=require(_0xd314('0x0'));var moment=require(_0xd314('0x1'));var BPromise=require(_0xd314('0x2'));var rs=require(_0xd314('0x3'));var fs=require('fs');var Redis=require(_0xd314('0x4'));var db=require(_0xd314('0x5'))['db'];var utils=require(_0xd314('0x6'));var logger=require(_0xd314('0x7'))(_0xd314('0x8'));var config=require(_0xd314('0x9'));var jayson=require(_0xd314('0xa'));var client=jayson[_0xd314('0xb')][_0xd314('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x47db98,_0x2c736d,_0x4f2a02){return new BPromise(function(_0x422bfd,_0x55e525){return client[_0xd314('0xd')](_0x47db98,_0x4f2a02)[_0xd314('0xe')](function(_0x172e2b){logger['info'](_0xd314('0xf'),_0x2c736d,_0xd314('0x10'));logger[_0xd314('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2c736d,_0xd314('0x10'),JSON[_0xd314('0x12')](_0x172e2b));if(_0x172e2b['error']){if(_0x172e2b[_0xd314('0x13')][_0xd314('0x14')]===0x1f4){logger[_0xd314('0x13')]('CmCompany,\x20%s,\x20%s',_0x2c736d,_0x172e2b['error'][_0xd314('0x15')]);return _0x55e525(_0x172e2b[_0xd314('0x13')][_0xd314('0x15')]);}logger[_0xd314('0x13')](_0xd314('0xf'),_0x2c736d,_0x172e2b[_0xd314('0x13')][_0xd314('0x15')]);return _0x422bfd(_0x172e2b['error'][_0xd314('0x15')]);}else{logger[_0xd314('0x16')](_0xd314('0xf'),_0x2c736d,_0xd314('0x10'));_0x422bfd(_0x172e2b[_0xd314('0x17')][_0xd314('0x15')]);}})[_0xd314('0x18')](function(_0x48211b){logger[_0xd314('0x13')]('CmCompany,\x20%s,\x20%s',_0x2c736d,_0x48211b);_0x55e525(_0x48211b);});});} \ No newline at end of file +var _0x5c28=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x37f212,_0x3b31a0){var _0x5dcd8d=function(_0x1e2fc6){while(--_0x1e2fc6){_0x37f212['push'](_0x37f212['shift']());}};_0x5dcd8d(++_0x3b31a0);}(_0x5c28,0xb4));var _0x85c2=function(_0x1c4306,_0x45117e){_0x1c4306=_0x1c4306-0x0;var _0x3b233a=_0x5c28[_0x1c4306];return _0x3b233a;};'use strict';var _=require(_0x85c2('0x0'));var util=require(_0x85c2('0x1'));var moment=require(_0x85c2('0x2'));var BPromise=require(_0x85c2('0x3'));var rs=require(_0x85c2('0x4'));var fs=require('fs');var Redis=require(_0x85c2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x85c2('0x6'));var logger=require(_0x85c2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x85c2('0x8'));var client=jayson[_0x85c2('0x9')][_0x85c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x504949,_0xd9d362,_0xff3a72){return new BPromise(function(_0x141eb3,_0x3c7639){return client[_0x85c2('0xb')](_0x504949,_0xff3a72)['then'](function(_0x55fa24){logger['info'](_0x85c2('0xc'),_0xd9d362,_0x85c2('0xd'));logger[_0x85c2('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xd9d362,_0x85c2('0xd'),JSON[_0x85c2('0xf')](_0x55fa24));if(_0x55fa24[_0x85c2('0x10')]){if(_0x55fa24[_0x85c2('0x10')]['code']===0x1f4){logger['error'](_0x85c2('0xc'),_0xd9d362,_0x55fa24[_0x85c2('0x10')]['message']);return _0x3c7639(_0x55fa24[_0x85c2('0x10')]['message']);}logger['error'](_0x85c2('0xc'),_0xd9d362,_0x55fa24[_0x85c2('0x10')][_0x85c2('0x11')]);return _0x141eb3(_0x55fa24[_0x85c2('0x10')]['message']);}else{logger['info'](_0x85c2('0xc'),_0xd9d362,'request\x20sent');_0x141eb3(_0x55fa24[_0x85c2('0x12')][_0x85c2('0x11')]);}})[_0x85c2('0x13')](function(_0x310e28){logger[_0x85c2('0x10')]('CmCompany,\x20%s,\x20%s',_0xd9d362,_0x310e28);_0x3c7639(_0x310e28);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 28af114..04c56d0 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 _0xf0d2=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','isAuthenticated','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','destroy','multer','util','path'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xf0d2,0x14d));var _0x2f0d=function(_0x21bf17,_0x166806){_0x21bf17=_0x21bf17-0x0;var _0x35bd98=_0xf0d2[_0x21bf17];return _0x35bd98;};'use strict';var multer=require(_0x2f0d('0x0'));var util=require(_0x2f0d('0x1'));var path=require(_0x2f0d('0x2'));var timeout=require(_0x2f0d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f0d('0x4'));var auth=require(_0x2f0d('0x5'));var interaction=require(_0x2f0d('0x6'));var config=require(_0x2f0d('0x7'));var controller=require(_0x2f0d('0x8'));router[_0x2f0d('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f0d('0xa')]);router[_0x2f0d('0x9')]('/describe',auth[_0x2f0d('0xb')](),controller['describe']);router['get'](_0x2f0d('0xc'),auth[_0x2f0d('0xb')](),controller[_0x2f0d('0xd')]);router[_0x2f0d('0x9')](_0x2f0d('0xe'),auth[_0x2f0d('0xb')](),controller[_0x2f0d('0xf')]);router[_0x2f0d('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2f0d('0x10')](_0x2f0d('0xe'),auth[_0x2f0d('0xb')](),controller[_0x2f0d('0x11')]);router[_0x2f0d('0x12')](_0x2f0d('0xc'),auth[_0x2f0d('0xb')](),controller[_0x2f0d('0x13')]);router['delete'](_0x2f0d('0xc'),auth['isAuthenticated'](),controller[_0x2f0d('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc29f=['addContacts','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','/describe','/:id','show','get','getContacts','post','create','/:id/contacts'];(function(_0x2de92b,_0x4cc32e){var _0x240333=function(_0x58e274){while(--_0x58e274){_0x2de92b['push'](_0x2de92b['shift']());}};_0x240333(++_0x4cc32e);}(_0xc29f,0xac));var _0xfc29=function(_0x3fc306,_0x5a571f){_0x3fc306=_0x3fc306-0x0;var _0xba4556=_0xc29f[_0x3fc306];return _0xba4556;};'use strict';var multer=require(_0xfc29('0x0'));var util=require(_0xfc29('0x1'));var path=require(_0xfc29('0x2'));var timeout=require(_0xfc29('0x3'));var express=require(_0xfc29('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc29('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfc29('0x6'));var controller=require(_0xfc29('0x7'));router['get']('/',auth[_0xfc29('0x8')](),controller['index']);router['get'](_0xfc29('0x9'),auth[_0xfc29('0x8')](),controller['describe']);router['get'](_0xfc29('0xa'),auth[_0xfc29('0x8')](),controller[_0xfc29('0xb')]);router[_0xfc29('0xc')]('/:id/contacts',auth[_0xfc29('0x8')](),controller[_0xfc29('0xd')]);router[_0xfc29('0xe')]('/',auth['isAuthenticated'](),controller[_0xfc29('0xf')]);router['post'](_0xfc29('0x10'),auth[_0xfc29('0x8')](),controller[_0xfc29('0x11')]);router[_0xfc29('0x12')](_0xfc29('0xa'),auth['isAuthenticated'](),controller[_0xfc29('0x13')]);router['delete']('/:id',auth[_0xfc29('0x8')](),controller[_0xfc29('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c9a8fdd..25b7c2a 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 _0xdcdf=['exports','STRING','TEXT','INTEGER','UNSIGNED','NOW','lodash'];(function(_0xd839e7,_0x4209e9){var _0xc3cf23=function(_0x16ace2){while(--_0x16ace2){_0xd839e7['push'](_0xd839e7['shift']());}};_0xc3cf23(++_0x4209e9);}(_0xdcdf,0xe6));var _0xfdcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcdf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfdcd('0x0'));var Sequelize=require('sequelize');module[_0xfdcd('0x1')]={'firstName':{'type':Sequelize[_0xfdcd('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xfdcd('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfdcd('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xfdcd('0x2')]},'description':{'type':Sequelize[_0xfdcd('0x3')]},'phone':{'type':Sequelize[_0xfdcd('0x2')]},'mobile':{'type':Sequelize[_0xfdcd('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xfdcd('0x2')]},'url':{'type':Sequelize[_0xfdcd('0x2')]},'facebook':{'type':Sequelize[_0xfdcd('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xfdcd('0x2')]},'line':{'type':Sequelize[_0xfdcd('0x2')]},'wechat':{'type':Sequelize[_0xfdcd('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xfdcd('0x4')](0x2)[_0xfdcd('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xfdcd('0x6')]}}; \ No newline at end of file +var _0x1c73=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x2766b4,_0xb9c42c){var _0x3c72ba=function(_0x3c4117){while(--_0x3c4117){_0x2766b4['push'](_0x2766b4['shift']());}};_0x3c72ba(++_0xb9c42c);}(_0x1c73,0xde));var _0x31c7=function(_0x126c2f,_0x19a958){_0x126c2f=_0x126c2f-0x0;var _0x421c3a=_0x1c73[_0x126c2f];return _0x421c3a;};'use strict';var _=require(_0x31c7('0x0'));var Sequelize=require(_0x31c7('0x1'));module[_0x31c7('0x2')]={'firstName':{'type':Sequelize[_0x31c7('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x31c7('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x31c7('0x3')]},'country':{'type':Sequelize[_0x31c7('0x3')]},'dateOfBirth':{'type':Sequelize[_0x31c7('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x31c7('0x3')]},'mobile':{'type':Sequelize[_0x31c7('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x31c7('0x3')]},'facebook':{'type':Sequelize[_0x31c7('0x3')]},'fb_data':{'type':Sequelize[_0x31c7('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x31c7('0x3')]},'teams':{'type':Sequelize[_0x31c7('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x31c7('0x3')]},'telegram':{'type':Sequelize[_0x31c7('0x3')]},'UserId':{'type':Sequelize[_0x31c7('0x4')]},'priority':{'type':Sequelize[_0x31c7('0x4')](0x2)[_0x31c7('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x31c7('0x6')],'defaultValue':Sequelize[_0x31c7('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1f707fd..ab6c52f 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 _0xe04b=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./cmContact.socket','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','describe','length','keys','cf_','push','CmCustomField','findOne','all','type','query','filters','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','field','color','from','select','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','expr','search','parseSearch','sqlOperator','conditions','find','value','map','forEach','union','User','and','uc.UserId\x20=\x20?','fieldType','datetime','castTo','DATE','buildExpression','text','start','isNil','Contact','isEmpty','ListId','concat','\x20=\x20?','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','fields','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','destroy','CmContact','params','tags','startsWith','columnName','displayName','findAll','custom','catch','merge','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','bulkCreate','each','duplicates','findOrCreate','spread','show','Tag','omit','cf_%d','$and','pickBy','table','cm_contacts','setFields','id\x20=\x20?','values','phone','getTags','rawAttributes','pick','setTags','ids','getHoppers','options','includeAll','include','rows','ContactId','getHopperFinals','getJscriptySessions','uploadCsv','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!','zipObject','firstName','join','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','parse','meta','No\x20ListId\x20specified','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','mail','chat','openchannel','fax','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','UserId','fullname','createdAt','findAndCountAll','alias','startCase','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','referer','substatus','externalUrl','Interaction','sortBy','reverse','slice','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x428618,_0x993295){var _0x3e9d26=function(_0x3e2975){while(--_0x3e2975){_0x428618['push'](_0x428618['shift']());}};_0x3e9d26(++_0x993295);}(_0xe04b,0x112));var _0xbe04=function(_0x5e7f62,_0x5ba327){_0x5e7f62=_0x5e7f62-0x0;var _0x4626ab=_0xe04b[_0x5e7f62];return _0x4626ab;};'use strict';var emlformat=require(_0xbe04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe04('0x1'));var jsonpatch=require(_0xbe04('0x2'));var rp=require(_0xbe04('0x3'));var moment=require(_0xbe04('0x4'));var BPromise=require(_0xbe04('0x5'));var Mustache=require(_0xbe04('0x6'));var util=require(_0xbe04('0x7'));var path=require(_0xbe04('0x8'));var sox=require(_0xbe04('0x9'));var csv=require(_0xbe04('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe04('0xb'));var _=require(_0xbe04('0xc'));var squel=require(_0xbe04('0xd'));var crypto=require(_0xbe04('0xe'));var jsforce=require(_0xbe04('0xf'));var deskjs=require(_0xbe04('0x10'));var toCsv=require(_0xbe04('0xa'));var querystring=require(_0xbe04('0x11'));var Papa=require(_0xbe04('0x12'));var Redis=require(_0xbe04('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbe04('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe04('0x15'));var logger=require(_0xbe04('0x16'))('api');var utils=require(_0xbe04('0x17'));var config=require(_0xbe04('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbe04('0x19')](config['redis'],{'host':_0xbe04('0x1a'),'port':0x18eb});var socket=require(_0xbe04('0x1b'))(new Redis(config[_0xbe04('0x1c')]));require(_0xbe04('0x1d'))['register'](socket);function respondWithStatusCode(_0x488a45,_0x59e21d){_0x59e21d=_0x59e21d||0xcc;return function(_0x153e76){if(_0x153e76){return _0x488a45[_0xbe04('0x1e')](_0x59e21d);}return _0x488a45[_0xbe04('0x1f')](_0x59e21d)['end']();};}function respondWithResult(_0x3d7cdc,_0x11e237){_0x11e237=_0x11e237||0xc8;return function(_0x3d8f64){if(_0x3d8f64){return _0x3d7cdc[_0xbe04('0x1f')](_0x11e237)[_0xbe04('0x20')](_0x3d8f64);}};}function respondWithFilteredResult(_0x4ba96f,_0xc14403){return function(_0x466efd){if(_0x466efd){var _0x4df6b5=typeof _0xc14403[_0xbe04('0x21')]==='undefined'&&typeof _0xc14403[_0xbe04('0x22')]===_0xbe04('0x23');var _0x87bff5=_0x466efd[_0xbe04('0x24')];var _0x1c3563=_0x4df6b5?0x0:_0xc14403['offset'];var _0x691809=_0x4df6b5?_0x466efd[_0xbe04('0x24')]:_0xc14403[_0xbe04('0x21')]+_0xc14403[_0xbe04('0x22')];var _0x1dfd1d;if(_0x691809>=_0x87bff5){_0x691809=_0x87bff5;_0x1dfd1d=0xc8;}else{_0x1dfd1d=0xce;}_0x4ba96f[_0xbe04('0x1f')](_0x1dfd1d);return _0x4ba96f['set'](_0xbe04('0x25'),_0x1c3563+'-'+_0x691809+'/'+_0x87bff5)[_0xbe04('0x20')](_0x466efd);}return null;};}function patchUpdates(_0x5d08c6){return function(_0x4d9229){try{jsonpatch[_0xbe04('0x26')](_0x4d9229,_0x5d08c6,!![]);}catch(_0x3c00e5){return BPromise[_0xbe04('0x27')](_0x3c00e5);}return _0x4d9229[_0xbe04('0x28')]();};}function saveUpdates(_0x48d411,_0x504773){return function(_0x9f9223){if(_0x9f9223){return _0x9f9223[_0xbe04('0x29')](_0x48d411)[_0xbe04('0x2a')](function(_0x15bedb){return _0x15bedb;});}return null;};}function removeEntity(_0x3c94ba,_0x4f9514){return function(_0x12ebc1){if(_0x12ebc1){return _0x12ebc1['destroy']()[_0xbe04('0x2a')](function(){_0x3c94ba['status'](0xcc)[_0xbe04('0x2b')]();});}};}function handleEntityNotFound(_0x4ccb90,_0x33c380){return function(_0x481b14){if(!_0x481b14){_0x4ccb90[_0xbe04('0x1e')](0x194);}return _0x481b14;};}function handleError(_0x10ff8f,_0x2bcf45){_0x2bcf45=_0x2bcf45||0x1f4;return function(_0x27f4c3){logger[_0xbe04('0x2c')](_0x27f4c3[_0xbe04('0x2d')]);if(_0x27f4c3[_0xbe04('0x2e')]){delete _0x27f4c3[_0xbe04('0x2e')];}_0x10ff8f[_0xbe04('0x1f')](_0x2bcf45)[_0xbe04('0x2f')](_0x27f4c3);};}exports[_0xbe04('0x30')]=function(_0x258d84,_0x29197f){var _0xf4f753={},_0x48d9c3={},_0x2f5815={'count':0x0,'rows':[]};return db['CmContact'][_0xbe04('0x31')]()[_0xbe04('0x2a')](function(_0x50e5e8){var _0x41fc8b=[];for(var _0x5e4e7e=0x0;_0x5e4e7e0x1){_0x12fcec['or'](_0xbe04('0x6b'),qs['getFullTextValue'](_0x3696c4),null);}else{if(qs[_0xbe04('0x6c')](_0x3696c4)){_0x12fcec['or'](_0xbe04('0x6d'),_0x3696c4+'%');_0x12fcec['or'](_0xbe04('0x6e'),_0x3696c4+'%');_0x12fcec['or'](_0xbe04('0x6f'),_0x3696c4+'%');_0x12fcec['or'](_0xbe04('0x70'),_0x3696c4+'%');}else if(qs[_0xbe04('0x71')](_0x3696c4)){_0x12fcec['or'](_0xbe04('0x72'),_0x3696c4+'%');}else{_0x12fcec['or']('c.firstName\x20LIKE\x20?','%'+_0x3696c4+'%');_0x12fcec['or'](_0xbe04('0x73'),'%'+_0x3696c4+'%');_0x12fcec['or']('c.email\x20LIKE\x20?','%'+_0x3696c4+'%');}}}}_0x49b416[_0xbe04('0x43')](_0x12fcec);_0x49b416['group'](_0xbe04('0x74'));var _0x2d104e={'type':db['Sequelize']['QueryTypes'][_0xbe04('0x75')],'raw':!![]};var _0x455fac=_0x49b416[_0xbe04('0x76')]()[_0xbe04('0x44')](_0xbe04('0x74'));if(_0xf4f753[_0xbe04('0x41')]){_0xf4f753[_0xbe04('0x41')][_0xbe04('0x54')](function(_0x30663b){_0x49b416[_0xbe04('0x41')]('c.'+_0x30663b[0x0],_0x30663b[0x1]===_0xbe04('0x77')?![]:!![]);});}if(!_[_0xbe04('0x62')](_0x1fd13e)){_0x49b416[_0xbe04('0x78')](_0x30cc68);_0x455fac[_0xbe04('0x43')](_0xbe04('0x79'),_0x1fd13e);}BPromise[_0xbe04('0x7a')]()['then'](function(){if(!_0x3349c7)return;if(_0x258d84[_0xbe04('0x7b')][_0xbe04('0x7c')]!==_0xbe04('0x7d'))return;if(!_[_0xbe04('0x7e')](_0x3349c7['conditions'],[_0xbe04('0x44'),_0xbe04('0x56')])){return _0x258d84[_0xbe04('0x7b')][_0xbe04('0x7f')]({'attributes':['id'],'raw':!![]})[_0xbe04('0x2a')](function(_0x6d0c32){if(_['isEmpty'](_0x6d0c32)){_0x455fac[_0xbe04('0x43')](_0xbe04('0x80'));_0x49b416[_0xbe04('0x43')]('c.ListId\x20IS\x20NULL');}else{_0x455fac[_0xbe04('0x43')]('c.ListId\x20IN\x20?',_[_0xbe04('0x53')](_0x6d0c32,'id'));_0x49b416['where'](_0xbe04('0x81'),_[_0xbe04('0x53')](_0x6d0c32,'id'));}});}})[_0xbe04('0x2a')](function(){if(_0x258d84[_0xbe04('0x7b')][_0xbe04('0x7c')]==='agent'&&!_0x3349c7&&!_0x258d84['query']['ListId'])return[];return db[_0xbe04('0x82')]['query'](_0x455fac[_0xbe04('0x83')](),_0x2d104e);})[_0xbe04('0x2a')](function(_0x304e7d){_0x2f5815[_0xbe04('0x24')]=_0x304e7d['length'];if(_0x2f5815[_0xbe04('0x24')]===0x0)return[];return db[_0xbe04('0x82')]['query'](_0x169a9b[_0xbe04('0x83')](),_0x2d104e)[_0xbe04('0x2a')](function(_0x3aa6fc){_0xe22d28=_[_0xbe04('0x84')](_0x3aa6fc,'id');_0x2d104e=_['merge'](_0x2d104e,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x258d84['query'][_0xbe04('0x85')]){_0xf4f753[_0xbe04('0x3d')][_0xbe04('0x54')](function(_0x5e5659){_0x49b416['field']('c.'+_0x5e5659);});}else{_0x49b416[_0xbe04('0x44')]('c.id');_0x49b416[_0xbe04('0x44')](_0xbe04('0x86'));_0x49b416[_0xbe04('0x44')](_0xbe04('0x87'));_0x49b416[_0xbe04('0x44')](_0xbe04('0x88'));_0x49b416[_0xbe04('0x44')](_0xbe04('0x89'));_0x49b416[_0xbe04('0x44')](_0xbe04('0x8a'));_0x49b416[_0xbe04('0x44')](_0xbe04('0x8b'));_0x49b416['field']('c.ListId');_0x49b416[_0xbe04('0x44')]('c.createdAt');_0x49b416[_0xbe04('0x44')]('c.deletedAt');_0x49b416[_0xbe04('0x44')](_0xbe04('0x8c'));_0x49b416[_0xbe04('0x44')](_0xbe04('0x8d'),'TagIds');}if(_0xf4f753[_0xbe04('0x22')])_0x49b416[_0xbe04('0x22')](_0xf4f753[_0xbe04('0x22')]);if(_0xf4f753[_0xbe04('0x21')])_0x49b416['offset'](_0xf4f753[_0xbe04('0x21')]);return db['sequelize'][_0xbe04('0x3a')](_0x49b416['toString'](),_0x2d104e);});})[_0xbe04('0x2a')](function(_0x382e38){_0x382e38['forEach'](function(_0x46dff2){if(_0x46dff2[_0xbe04('0x8e')]){_0x46dff2[_0xbe04('0x8f')]=[];_0x46dff2['TagIds'][_0xbe04('0x90')](',')['forEach'](function(_0x947967){_0x46dff2[_0xbe04('0x8f')][_0xbe04('0x35')](_0xe22d28[_0x947967]);});}delete _0x46dff2['TagIds'];});_0x2f5815['rows']=_0x382e38;return _0x2f5815;})[_0xbe04('0x2a')](respondWithFilteredResult(_0x29197f,_0xf4f753));})['catch'](handleError(_0x29197f,null));};exports[_0xbe04('0x91')]=function(_0x428ba3,_0x219577){return db[_0xbe04('0x92')][_0xbe04('0x51')]({'where':{'id':_0x428ba3[_0xbe04('0x93')]['id']}})[_0xbe04('0x2a')](handleEntityNotFound(_0x219577,null))[_0xbe04('0x2a')](removeEntity(_0x219577,null))['catch'](handleError(_0x219577,null));};exports[_0xbe04('0x31')]=function(_0x3ac889,_0x46a48b){return db['CmContact'][_0xbe04('0x31')]()[_0xbe04('0x2a')](function(_0x5469af){delete _0x5469af[_0xbe04('0x94')];for(var _0x3d9ff0=0x0;_0x3d9ff0=_0x162007){_0x19f027=_0x162007;_0x5b79f9=0xc8;}else{_0x5b79f9=0xce;}_0x3c6cb8[_0x78e7('0x1e')](_0x5b79f9);return _0x3c6cb8[_0x78e7('0x22')](_0x78e7('0x23'),_0x4e202c+'-'+_0x19f027+'/'+_0x162007)['json'](_0x64c5d3);}return null;};}function patchUpdates(_0x379ed1){return function(_0x36cfd1){try{jsonpatch[_0x78e7('0x24')](_0x36cfd1,_0x379ed1,!![]);}catch(_0x5ec620){return BPromise['reject'](_0x5ec620);}return _0x36cfd1[_0x78e7('0x25')]();};}function saveUpdates(_0x1daa14,_0x144116){return function(_0x1429e7){if(_0x1429e7){return _0x1429e7[_0x78e7('0x26')](_0x1daa14)[_0x78e7('0x27')](function(_0x29f7cb){return _0x29f7cb;});}return null;};}function removeEntity(_0x3dc3b5,_0x147f8a){return function(_0x36f298){if(_0x36f298){return _0x36f298[_0x78e7('0x28')]()[_0x78e7('0x27')](function(){_0x3dc3b5[_0x78e7('0x1e')](0xcc)[_0x78e7('0x1d')]();});}};}function handleEntityNotFound(_0x5757ba,_0x421004){return function(_0x4b931c){if(!_0x4b931c){_0x5757ba[_0x78e7('0x29')](0x194);}return _0x4b931c;};}function handleError(_0x465daf,_0x180d5f){_0x180d5f=_0x180d5f||0x1f4;return function(_0x621820){logger[_0x78e7('0x2a')](_0x621820['stack']);if(_0x621820[_0x78e7('0x2b')]){delete _0x621820[_0x78e7('0x2b')];}_0x465daf[_0x78e7('0x1e')](_0x180d5f)[_0x78e7('0x2c')](_0x621820);};}exports[_0x78e7('0x2d')]=function(_0x313656,_0x48167d){var _0x5555e8={},_0x44b71d={},_0x294dc5={'count':0x0,'rows':[]};return db['CmContact'][_0x78e7('0x2e')]()['then'](function(_0x20078d){var _0x270302=[];for(var _0x530ea7=0x0;_0x530ea70x1){_0x324886['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4d47aa),null);}else{if(qs['isNumeric'](_0x4d47aa)){_0x324886['or'](_0x78e7('0x66'),_0x4d47aa+'%');_0x324886['or'](_0x78e7('0x67'),_0x4d47aa+'%');_0x324886['or'](_0x78e7('0x68'),_0x4d47aa+'%');_0x324886['or'](_0x78e7('0x69'),_0x4d47aa+'%');}else if(qs[_0x78e7('0x6a')](_0x4d47aa)){_0x324886['or'](_0x78e7('0x6b'),_0x4d47aa+'%');}else{_0x324886['or'](_0x78e7('0x6c'),'%'+_0x4d47aa+'%');_0x324886['or']('c.lastName\x20LIKE\x20?','%'+_0x4d47aa+'%');_0x324886['or'](_0x78e7('0x6b'),'%'+_0x4d47aa+'%');}}}}_0x5bb3dd[_0x78e7('0x40')](_0x324886);_0x5bb3dd[_0x78e7('0x6d')]('c.id');var _0x78b9fa={'type':db[_0x78e7('0x6e')][_0x78e7('0x6f')]['SELECT'],'raw':!![]};var _0x58b83b=_0x5bb3dd[_0x78e7('0x70')]()['field']('c.id');if(_0x5555e8[_0x78e7('0x3e')]){_0x5555e8[_0x78e7('0x3e')][_0x78e7('0x61')](function(_0xe0c106){_0x5bb3dd[_0x78e7('0x3e')]('c.'+_0xe0c106[0x0],_0xe0c106[0x1]===_0x78e7('0x71')?![]:!![]);});}if(!_[_0x78e7('0x60')](_0x498624)){_0x5bb3dd[_0x78e7('0x72')](_0x18cc97);_0x58b83b[_0x78e7('0x40')](_0x78e7('0x73'),_0x498624);}BPromise['resolve']()[_0x78e7('0x27')](function(){if(!_0x5aab33)return;if(_0x313656['user'][_0x78e7('0x74')]!=='agent')return;if(!_[_0x78e7('0x75')](_0x5aab33[_0x78e7('0x50')],[_0x78e7('0x43'),_0x78e7('0x56')])){return _0x313656['user'][_0x78e7('0x76')]({'attributes':['id'],'raw':!![]})[_0x78e7('0x27')](function(_0x597bad){if(_[_0x78e7('0x60')](_0x597bad)){_0x58b83b[_0x78e7('0x40')](_0x78e7('0x77'));_0x5bb3dd[_0x78e7('0x40')](_0x78e7('0x77'));}else{_0x58b83b['where'](_0x78e7('0x78'),_[_0x78e7('0x53')](_0x597bad,'id'));_0x5bb3dd[_0x78e7('0x40')]('c.ListId\x20IN\x20?',_['map'](_0x597bad,'id'));}});}})[_0x78e7('0x27')](function(){if(_0x313656[_0x78e7('0x79')][_0x78e7('0x74')]===_0x78e7('0x7a')&&!_0x5aab33&&!_0x313656[_0x78e7('0x38')][_0x78e7('0x62')])return[];return db[_0x78e7('0x7b')][_0x78e7('0x38')](_0x58b83b[_0x78e7('0x7c')](),_0x78b9fa);})[_0x78e7('0x27')](function(_0x222925){_0x294dc5['count']=_0x222925[_0x78e7('0x33')];if(_0x294dc5[_0x78e7('0x7d')]===0x0)return[];return db[_0x78e7('0x7b')][_0x78e7('0x38')](_0x347760[_0x78e7('0x7c')](),_0x78b9fa)[_0x78e7('0x27')](function(_0x22c0ba){_0x43a4d5=_[_0x78e7('0x7e')](_0x22c0ba,'id');_0x78b9fa=_[_0x78e7('0x7f')](_0x78b9fa,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x313656[_0x78e7('0x38')][_0x78e7('0x3c')]){_0x5555e8[_0x78e7('0x3b')][_0x78e7('0x61')](function(_0x2236de){_0x5bb3dd[_0x78e7('0x43')]('c.'+_0x2236de);});}else{_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x80'));_0x5bb3dd[_0x78e7('0x43')]('c.firstName');_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x81'));_0x5bb3dd['field'](_0x78e7('0x82'));_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x83'));_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x84'));_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x85'));_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x86'));_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x87'));_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x88'));_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x89'));_0x5bb3dd[_0x78e7('0x43')](_0x78e7('0x8a'),_0x78e7('0x8b'));}if(_0x5555e8[_0x78e7('0x21')])_0x5bb3dd['limit'](_0x5555e8[_0x78e7('0x21')]);if(_0x5555e8[_0x78e7('0x1f')])_0x5bb3dd[_0x78e7('0x1f')](_0x5555e8['offset']);return db[_0x78e7('0x7b')][_0x78e7('0x38')](_0x5bb3dd[_0x78e7('0x7c')](),_0x78b9fa);});})[_0x78e7('0x27')](function(_0x5011f3){_0x5011f3[_0x78e7('0x61')](function(_0x127e4d){if(_0x127e4d[_0x78e7('0x8b')]){_0x127e4d[_0x78e7('0x8c')]=[];_0x127e4d[_0x78e7('0x8b')][_0x78e7('0x8d')](',')[_0x78e7('0x61')](function(_0x19a5c3){_0x127e4d[_0x78e7('0x8c')][_0x78e7('0x5f')](_0x43a4d5[_0x19a5c3]);});}delete _0x127e4d[_0x78e7('0x8b')];});_0x294dc5[_0x78e7('0x8e')]=_0x5011f3;return _0x294dc5;})[_0x78e7('0x27')](respondWithFilteredResult(_0x48167d,_0x5555e8));})['catch'](handleError(_0x48167d,null));};exports[_0x78e7('0x28')]=function(_0x160768,_0x13d04f){return db['CmContact']['find']({'where':{'id':_0x160768[_0x78e7('0x8f')]['id']}})[_0x78e7('0x27')](handleEntityNotFound(_0x13d04f,null))[_0x78e7('0x27')](removeEntity(_0x13d04f,null))[_0x78e7('0x90')](handleError(_0x13d04f,null));};exports[_0x78e7('0x2e')]=function(_0x412308,_0x1ddd6b){return db['CmContact'][_0x78e7('0x2e')]()[_0x78e7('0x27')](function(_0x24f3b7){delete _0x24f3b7['tags'];for(var _0x34bc96=0x0;_0x34bc96{}\s\\|]/g,'-');_0x56fe2d(null,util[_0xc0b1('0x23')]('%s-%s%s',path['basename'](_0xf95acb[_0xc0b1('0x22')],path['extname'](_0xf95acb[_0xc0b1('0x22')])),Date[_0xc0b1('0x24')](),path[_0xc0b1('0x25')](_0xf95acb[_0xc0b1('0x22')])));}})});router['post'](_0xc0b1('0x26'),upload[_0xc0b1('0x27')]('file'),controller[_0xc0b1('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d3d31,_0x5ce21e,_0x8c12f5){_0x8c12f5(null,path[_0xc0b1('0x1f')](config[_0xc0b1('0x20')],'server/files/tmp'));},'filename':function(_0x3ab6d0,_0x3f0806,_0x3a34a9){_0x3f0806[_0xc0b1('0x22')]=_0x3f0806[_0xc0b1('0x22')][_0xc0b1('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a34a9(null,util[_0xc0b1('0x23')](_0xc0b1('0x2a'),path[_0xc0b1('0x2b')](_0x3f0806['originalname'],path[_0xc0b1('0x25')](_0x3f0806[_0xc0b1('0x22')])),Date['now'](),path[_0xc0b1('0x25')](_0x3f0806[_0xc0b1('0x22')])));}})});router['post']('/upload',upload[_0xc0b1('0x27')]('file'),controller[_0xc0b1('0x2c')]);router[_0xc0b1('0x18')]('/upload/:id',auth[_0xc0b1('0xb')](),controller['import']);router[_0xc0b1('0x2d')](_0xc0b1('0xd'),auth[_0xc0b1('0xb')](),controller[_0xc0b1('0x2e')]);router[_0xc0b1('0x2f')](_0xc0b1('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc0b1('0x30')]=router; \ No newline at end of file +var _0x5c99=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContact.controller','isAuthenticated','get','/describe','describe','/:id/tags','getTags','/:id/hoppers','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','/:id/journey','getJourney','post','merge','create','/create_many','bulkCreate','setTags','diskStorage','root','server/files/tmp','replace','format','%s-%s%s','originalname','extname','now','/csv','single','file','join','basename','/upload','upload','/upload/:id','put','/:id','update','delete','destroy','exports'];(function(_0x35e524,_0x418c45){var _0x1e3020=function(_0x451466){while(--_0x451466){_0x35e524['push'](_0x35e524['shift']());}};_0x1e3020(++_0x418c45);}(_0x5c99,0x190));var _0x95c9=function(_0x278949,_0x3502cc){_0x278949=_0x278949-0x0;var _0x273699=_0x5c99[_0x278949];return _0x273699;};'use strict';var multer=require('multer');var util=require(_0x95c9('0x0'));var path=require(_0x95c9('0x1'));var timeout=require(_0x95c9('0x2'));var express=require(_0x95c9('0x3'));var router=express[_0x95c9('0x4')]();var fs_extra=require(_0x95c9('0x5'));var auth=require(_0x95c9('0x6'));var interaction=require(_0x95c9('0x7'));var config=require('../../config/environment');var controller=require(_0x95c9('0x8'));router['get']('/',auth[_0x95c9('0x9')](),controller['index']);router[_0x95c9('0xa')](_0x95c9('0xb'),auth['isAuthenticated'](),controller[_0x95c9('0xc')]);router['get']('/:id',auth[_0x95c9('0x9')](),controller['show']);router[_0x95c9('0xa')](_0x95c9('0xd'),auth[_0x95c9('0x9')](),controller[_0x95c9('0xe')]);router['get'](_0x95c9('0xf'),auth[_0x95c9('0x9')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x95c9('0x9')](),controller[_0x95c9('0x10')]);router[_0x95c9('0xa')]('/:id/hopper_finals',auth[_0x95c9('0x9')](),controller[_0x95c9('0x11')]);router[_0x95c9('0xa')](_0x95c9('0x12'),auth[_0x95c9('0x9')](),controller['getJscriptySessions']);router[_0x95c9('0xa')](_0x95c9('0x13'),auth['isAuthenticated'](),controller[_0x95c9('0x14')]);router[_0x95c9('0x15')]('/merge',auth[_0x95c9('0x9')](),controller[_0x95c9('0x16')]);router[_0x95c9('0x15')]('/',auth[_0x95c9('0x9')](),controller[_0x95c9('0x17')]);router[_0x95c9('0x15')](_0x95c9('0x18'),auth[_0x95c9('0x9')](),controller[_0x95c9('0x19')]);router[_0x95c9('0x15')](_0x95c9('0xd'),auth[_0x95c9('0x9')](),controller[_0x95c9('0x1a')]);var upload=multer({'storage':multer[_0x95c9('0x1b')]({'destination':function(_0x11aa45,_0x4e2002,_0x7fd163){_0x7fd163(null,path['join'](config[_0x95c9('0x1c')],_0x95c9('0x1d')));},'filename':function(_0x39eb72,_0x365b5b,_0x5421d4){_0x365b5b['originalname']=_0x365b5b['originalname'][_0x95c9('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5421d4(null,util[_0x95c9('0x1f')](_0x95c9('0x20'),path['basename'](_0x365b5b[_0x95c9('0x21')],path[_0x95c9('0x22')](_0x365b5b[_0x95c9('0x21')])),Date[_0x95c9('0x23')](),path[_0x95c9('0x22')](_0x365b5b['originalname'])));}})});router[_0x95c9('0x15')](_0x95c9('0x24'),upload[_0x95c9('0x25')](_0x95c9('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x95c9('0x1b')]({'destination':function(_0xea22a3,_0x55b2cf,_0xba312f){_0xba312f(null,path[_0x95c9('0x27')](config[_0x95c9('0x1c')],_0x95c9('0x1d')));},'filename':function(_0x360f13,_0x1af6e6,_0x46abb6){_0x1af6e6[_0x95c9('0x21')]=_0x1af6e6[_0x95c9('0x21')][_0x95c9('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x46abb6(null,util[_0x95c9('0x1f')](_0x95c9('0x20'),path[_0x95c9('0x28')](_0x1af6e6[_0x95c9('0x21')],path[_0x95c9('0x22')](_0x1af6e6[_0x95c9('0x21')])),Date['now'](),path['extname'](_0x1af6e6['originalname'])));}})});router[_0x95c9('0x15')](_0x95c9('0x29'),upload[_0x95c9('0x25')]('file'),controller[_0x95c9('0x2a')]);router[_0x95c9('0x15')](_0x95c9('0x2b'),auth[_0x95c9('0x9')](),controller['import']);router[_0x95c9('0x2c')](_0x95c9('0x2d'),auth[_0x95c9('0x9')](),controller[_0x95c9('0x2e')]);router[_0x95c9('0x2f')](_0x95c9('0x2d'),auth[_0x95c9('0x9')](),controller[_0x95c9('0x30')]);module[_0x95c9('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3b453d7..c7575a8 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 _0x45b0=['STRING','name','TEXT','long','type','select','values','isArray','setDataValue','BOOLEAN','exports','getDataValue','alias'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x45b0,0x72));var _0x045b=function(_0x52bb8c,_0x36ccb8){_0x52bb8c=_0x52bb8c-0x0;var _0x478be5=_0x45b0[_0x52bb8c];return _0x478be5;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x045b('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x22cf66){return this[_0x045b('0x1')](_0x045b('0x2'));}},'alias':{'type':Sequelize[_0x045b('0x3')],'allowNull':![],'set':function(_0x3dcce9){this['setDataValue']('alias',_0x3dcce9?_0x3dcce9:this['getDataValue'](_0x045b('0x4')));}},'type':{'type':Sequelize[_0x045b('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x045b('0x5')](_0x045b('0x6')),'get':function(){if(this['getDataValue'](_0x045b('0x7'))===_0x045b('0x8')){return JSON['parse'](this[_0x045b('0x1')](_0x045b('0x9')));}else{return this[_0x045b('0x1')]('values');}},'set':function(_0x2a3a76){if(Array[_0x045b('0xa')](_0x2a3a76)){this[_0x045b('0xb')](_0x045b('0x9'),JSON['stringify'](_0x2a3a76));}else{this[_0x045b('0xb')](_0x045b('0x9'),_0x2a3a76);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x045b('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x21f9=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','STRING','setDataValue','alias','name','long','type','select','parse','values','stringify'];(function(_0x46a77b,_0x4d4071){var _0x1eb694=function(_0x291860){while(--_0x291860){_0x46a77b['push'](_0x46a77b['shift']());}};_0x1eb694(++_0x4d4071);}(_0x21f9,0x135));var _0x921f=function(_0x4f02b8,_0x594500){_0x4f02b8=_0x4f02b8-0x0;var _0x39ad19=_0x21f9[_0x4f02b8];return _0x39ad19;};'use strict';var Sequelize=require(_0x921f('0x0'));var _=require(_0x921f('0x1'));module[_0x921f('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3840ac){return this[_0x921f('0x3')]('alias');}},'alias':{'type':Sequelize[_0x921f('0x4')],'allowNull':![],'set':function(_0x41eb75){this[_0x921f('0x5')](_0x921f('0x6'),_0x41eb75?_0x41eb75:this[_0x921f('0x3')](_0x921f('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x921f('0x8')),'get':function(){if(this[_0x921f('0x3')](_0x921f('0x9'))===_0x921f('0xa')){return JSON[_0x921f('0xb')](this[_0x921f('0x3')](_0x921f('0xc')));}else{return this[_0x921f('0x3')](_0x921f('0xc'));}},'set':function(_0x5b0f69){if(Array['isArray'](_0x5b0f69)){this['setDataValue'](_0x921f('0xc'),JSON[_0x921f('0xd')](_0x5b0f69));}else{this[_0x921f('0x5')]('values',_0x5b0f69);}}},'required':{'type':Sequelize[_0x921f('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x921f('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x921f('0xf')](_0x921f('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a0c93e1..ebfc58d 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 _0x254d=['VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','update','body','find','create','transaction','Sequelize','TEXT','number','INTEGER','switch','defaultValue','sequelize','queryInterface','cm_contacts','cf_%d','eml-format','rimraf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','reject','destroy','then','sendStatus','error','name','send','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','map'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x254d,0xc8));var _0xd254=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x254d[_0x55ff79];return _0x579067;};'use strict';var emlformat=require(_0xd254('0x0'));var rimraf=require(_0xd254('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd254('0x2'));var rp=require(_0xd254('0x3'));var moment=require(_0xd254('0x4'));var BPromise=require(_0xd254('0x5'));var Mustache=require(_0xd254('0x6'));var util=require(_0xd254('0x7'));var path=require(_0xd254('0x8'));var sox=require(_0xd254('0x9'));var csv=require('to-csv');var ejs=require(_0xd254('0xa'));var fs=require('fs');var fs_extra=require(_0xd254('0xb'));var _=require(_0xd254('0xc'));var squel=require(_0xd254('0xd'));var crypto=require(_0xd254('0xe'));var jsforce=require(_0xd254('0xf'));var deskjs=require(_0xd254('0x10'));var toCsv=require(_0xd254('0x11'));var querystring=require(_0xd254('0x12'));var Papa=require(_0xd254('0x13'));var Redis=require(_0xd254('0x14'));var authService=require(_0xd254('0x15'));var qs=require(_0xd254('0x16'));var as=require(_0xd254('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd254('0x18'))(_0xd254('0x19'));var utils=require('../../config/utils');var config=require(_0xd254('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd254('0x1b'))['db'];function respondWithStatusCode(_0x1280f3,_0x152041){_0x152041=_0x152041||0xcc;return function(_0x5ba814){if(_0x5ba814){return _0x1280f3['sendStatus'](_0x152041);}return _0x1280f3[_0xd254('0x1c')](_0x152041)[_0xd254('0x1d')]();};}function respondWithResult(_0x52fad0,_0x532641){_0x532641=_0x532641||0xc8;return function(_0x53bf7b){if(_0x53bf7b){return _0x52fad0[_0xd254('0x1c')](_0x532641)[_0xd254('0x1e')](_0x53bf7b);}};}function respondWithFilteredResult(_0x3b2762,_0x1724a1){return function(_0x122ede){if(_0x122ede){var _0x4e53b7=typeof _0x1724a1[_0xd254('0x1f')]==='undefined'&&typeof _0x1724a1[_0xd254('0x20')]==='undefined';var _0x35d078=_0x122ede[_0xd254('0x21')];var _0x5a2ac1=_0x4e53b7?0x0:_0x1724a1[_0xd254('0x1f')];var _0x340286=_0x4e53b7?_0x122ede[_0xd254('0x21')]:_0x1724a1[_0xd254('0x1f')]+_0x1724a1['limit'];var _0x25a8a5;if(_0x340286>=_0x35d078){_0x340286=_0x35d078;_0x25a8a5=0xc8;}else{_0x25a8a5=0xce;}_0x3b2762[_0xd254('0x1c')](_0x25a8a5);return _0x3b2762['set'](_0xd254('0x22'),_0x5a2ac1+'-'+_0x340286+'/'+_0x35d078)[_0xd254('0x1e')](_0x122ede);}return null;};}function patchUpdates(_0x2add33){return function(_0x4dda63){try{jsonpatch[_0xd254('0x23')](_0x4dda63,_0x2add33,!![]);}catch(_0x14eb36){return BPromise[_0xd254('0x24')](_0x14eb36);}return _0x4dda63['save']();};}function saveUpdates(_0x3b9079,_0x559241){return function(_0x511cba){if(_0x511cba){return _0x511cba['update'](_0x3b9079)['then'](function(_0x44bd62){return _0x44bd62;});}return null;};}function removeEntity(_0x84919e,_0x268bb2){return function(_0x4c9f4f){if(_0x4c9f4f){return _0x4c9f4f[_0xd254('0x25')]()[_0xd254('0x26')](function(){_0x84919e[_0xd254('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2180e2,_0x1b9116){return function(_0x47cd94){if(!_0x47cd94){_0x2180e2[_0xd254('0x27')](0x194);}return _0x47cd94;};}function handleError(_0x11061b,_0xb294d5){_0xb294d5=_0xb294d5||0x1f4;return function(_0x4aaf02){logger[_0xd254('0x28')](_0x4aaf02['stack']);if(_0x4aaf02[_0xd254('0x29')]){delete _0x4aaf02[_0xd254('0x29')];}_0x11061b['status'](_0xb294d5)[_0xd254('0x2a')](_0x4aaf02);};}exports['index']=function(_0xb4f3c9,_0x4ba2d6){var _0x68d095={},_0x51d591={},_0x38dda1={'count':0x0,'rows':[]};var _0x3c5942=_['map'](db[_0xd254('0x2b')][_0xd254('0x2c')],function(_0x569b18){return{'name':_0x569b18[_0xd254('0x2d')],'type':_0x569b18[_0xd254('0x2e')][_0xd254('0x2f')]};});_0x51d591[_0xd254('0x30')]=_[_0xd254('0x31')](_['map'](_0x3c5942,_0xd254('0x29')),['name']);_0x51d591['query']=_[_0xd254('0x32')](_0xb4f3c9['query']);_0x51d591[_0xd254('0x33')]=_[_0xd254('0x34')](_0x51d591[_0xd254('0x30')],_0x51d591[_0xd254('0x35')]);_0x68d095[_0xd254('0x36')]=_['intersection'](_0x51d591[_0xd254('0x30')],qs['fields'](_0xb4f3c9[_0xd254('0x35')][_0xd254('0x37')]));_0x68d095[_0xd254('0x36')]=_0x68d095['attributes']['length']?_0x68d095[_0xd254('0x36')]:_0x51d591[_0xd254('0x30')];if(!_0xb4f3c9[_0xd254('0x35')][_0xd254('0x38')]('nolimit')){_0x68d095[_0xd254('0x20')]=qs[_0xd254('0x20')](_0xb4f3c9['query'][_0xd254('0x20')]);_0x68d095[_0xd254('0x1f')]=qs[_0xd254('0x1f')](_0xb4f3c9[_0xd254('0x35')][_0xd254('0x1f')]);}_0x68d095[_0xd254('0x39')]=qs[_0xd254('0x3a')](_0xb4f3c9[_0xd254('0x35')]['sort']);_0x68d095['where']=qs[_0xd254('0x33')](_[_0xd254('0x3b')](_0xb4f3c9[_0xd254('0x35')],_0x51d591[_0xd254('0x33')]),_0x3c5942);if(_0xb4f3c9[_0xd254('0x35')][_0xd254('0x3c')]){_0x68d095['where']=_[_0xd254('0x3d')](_0x68d095[_0xd254('0x3e')],{'$or':_[_0xd254('0x3f')](_0x3c5942,function(_0x34459a){if(_0x34459a[_0xd254('0x2e')]!==_0xd254('0x40')){var _0x3ed2e7={};_0x3ed2e7[_0x34459a[_0xd254('0x29')]]={'$like':'%'+_0xb4f3c9['query']['filter']+'%'};return _0x3ed2e7;}})});}_0x68d095=_['merge']({},_0x68d095,_0xb4f3c9[_0xd254('0x41')]);var _0x2aa22c={'where':_0x68d095[_0xd254('0x3e')]};return db[_0xd254('0x2b')][_0xd254('0x21')](_0x2aa22c)[_0xd254('0x26')](function(_0xd5f4b5){_0x38dda1[_0xd254('0x21')]=_0xd5f4b5;if(_0xb4f3c9[_0xd254('0x35')][_0xd254('0x42')]){_0x68d095['include']=[{'all':!![]}];}return db['CmCustomField'][_0xd254('0x43')](_0x68d095);})[_0xd254('0x26')](function(_0x3c7535){_0x38dda1[_0xd254('0x44')]=_0x3c7535;return _0x38dda1;})[_0xd254('0x26')](respondWithFilteredResult(_0x4ba2d6,_0x68d095))[_0xd254('0x45')](handleError(_0x4ba2d6,null));};exports['show']=function(_0x48818b,_0x332b17){var _0x5a9bf2={'raw':!![],'where':{'id':_0x48818b[_0xd254('0x46')]['id']}},_0xaa0d1b={};_0xaa0d1b[_0xd254('0x30')]=_[_0xd254('0x32')](db[_0xd254('0x2b')]['rawAttributes']);_0xaa0d1b[_0xd254('0x35')]=_[_0xd254('0x32')](_0x48818b[_0xd254('0x35')]);_0xaa0d1b[_0xd254('0x33')]=_['intersection'](_0xaa0d1b[_0xd254('0x30')],_0xaa0d1b[_0xd254('0x35')]);_0x5a9bf2[_0xd254('0x36')]=_['intersection'](_0xaa0d1b[_0xd254('0x30')],qs[_0xd254('0x37')](_0x48818b['query'][_0xd254('0x37')]));_0x5a9bf2['attributes']=_0x5a9bf2[_0xd254('0x36')][_0xd254('0x47')]?_0x5a9bf2[_0xd254('0x36')]:_0xaa0d1b[_0xd254('0x30')];if(_0x48818b['query'][_0xd254('0x42')]){_0x5a9bf2[_0xd254('0x48')]=[{'all':!![]}];}_0x5a9bf2=_[_0xd254('0x3d')]({},_0x5a9bf2,_0x48818b[_0xd254('0x41')]);return db['CmCustomField']['find'](_0x5a9bf2)[_0xd254('0x26')](handleEntityNotFound(_0x332b17,null))['then'](respondWithResult(_0x332b17,null))[_0xd254('0x45')](handleError(_0x332b17,null));};exports[_0xd254('0x49')]=function(_0x293b5e,_0x41702c){if(_0x293b5e[_0xd254('0x4a')]['id']){delete _0x293b5e[_0xd254('0x4a')]['id'];}return db[_0xd254('0x2b')][_0xd254('0x4b')]({'where':{'id':_0x293b5e[_0xd254('0x46')]['id']}})[_0xd254('0x26')](handleEntityNotFound(_0x41702c,null))[_0xd254('0x26')](saveUpdates(_0x293b5e[_0xd254('0x4a')],null))[_0xd254('0x26')](respondWithResult(_0x41702c,null))[_0xd254('0x45')](handleError(_0x41702c,null));};exports['destroy']=function(_0x4e7c80,_0x5319e0){return db['CmCustomField']['find']({'where':{'id':_0x4e7c80[_0xd254('0x46')]['id']}})[_0xd254('0x26')](handleEntityNotFound(_0x5319e0,null))[_0xd254('0x26')](removeEntity(_0x5319e0,null))['catch'](handleError(_0x5319e0,null));};exports[_0xd254('0x4c')]=function(_0x5cf356,_0xbe7931){var _0xbf1244;return db['sequelize'][_0xd254('0x4d')](function(_0x30d565){return db[_0xd254('0x2b')][_0xd254('0x4c')](_0x5cf356['body'],{'transaction':_0x30d565})[_0xd254('0x26')](function(_0x403c86){_0xbf1244=_0x403c86;var _0x3f00c9={'type':db[_0xd254('0x4e')][_0xd254('0x4f')],'transaction':_0x30d565};switch(_0x5cf356['body'][_0xd254('0x2e')]){case'text':_0x3f00c9[_0xd254('0x2e')]=db[_0xd254('0x4e')][_0xd254('0x4f')];break;case _0xd254('0x50'):_0x3f00c9[_0xd254('0x2e')]=db['Sequelize'][_0xd254('0x51')];break;case _0xd254('0x52'):_0x3f00c9['type']=db[_0xd254('0x4e')]['BOOLEAN'];_0x3f00c9[_0xd254('0x53')]=![];break;default:}return db[_0xd254('0x54')][_0xd254('0x55')]['addColumn'](_0xd254('0x56'),util['format'](_0xd254('0x57'),_0xbf1244['id']),_0x3f00c9);})['then'](function(){return _0xbf1244;});})[_0xd254('0x26')](respondWithResult(_0xbe7931,0xc9))[_0xd254('0x45')](handleError(_0xbe7931,null));}; \ No newline at end of file +var _0x54d6=['merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','CmCustomField','fieldName','key','differenceBy','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x349863,_0xbc5b95){var _0x580f11=function(_0x21eb0b){while(--_0x21eb0b){_0x349863['push'](_0x349863['shift']());}};_0x580f11(++_0xbc5b95);}(_0x54d6,0x70));var _0x654d=function(_0x1a4078,_0x26498f){_0x1a4078=_0x1a4078-0x0;var _0x2f7321=_0x54d6[_0x1a4078];return _0x2f7321;};'use strict';var emlformat=require(_0x654d('0x0'));var rimraf=require(_0x654d('0x1'));var zipdir=require(_0x654d('0x2'));var jsonpatch=require(_0x654d('0x3'));var rp=require('request-promise');var moment=require(_0x654d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x654d('0x5'));var path=require(_0x654d('0x6'));var sox=require(_0x654d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x654d('0x8'));var _=require(_0x654d('0x9'));var squel=require(_0x654d('0xa'));var crypto=require('crypto');var jsforce=require(_0x654d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x654d('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x654d('0xd'));var as=require(_0x654d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x654d('0xf'))(_0x654d('0x10'));var utils=require(_0x654d('0x11'));var config=require(_0x654d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x654d('0x13'))['db'];function respondWithStatusCode(_0x609331,_0x5395bb){_0x5395bb=_0x5395bb||0xcc;return function(_0x5ec765){if(_0x5ec765){return _0x609331[_0x654d('0x14')](_0x5395bb);}return _0x609331[_0x654d('0x15')](_0x5395bb)['end']();};}function respondWithResult(_0x54e059,_0x47b36c){_0x47b36c=_0x47b36c||0xc8;return function(_0x501a5d){if(_0x501a5d){return _0x54e059[_0x654d('0x15')](_0x47b36c)[_0x654d('0x16')](_0x501a5d);}};}function respondWithFilteredResult(_0x2eea39,_0x178c68){return function(_0xbc226d){if(_0xbc226d){var _0x2c9b1f=typeof _0x178c68[_0x654d('0x17')]===_0x654d('0x18')&&typeof _0x178c68[_0x654d('0x19')]==='undefined';var _0x5337c1=_0xbc226d[_0x654d('0x1a')];var _0x58eab3=_0x2c9b1f?0x0:_0x178c68['offset'];var _0x428a48=_0x2c9b1f?_0xbc226d[_0x654d('0x1a')]:_0x178c68[_0x654d('0x17')]+_0x178c68['limit'];var _0x5c6c54;if(_0x428a48>=_0x5337c1){_0x428a48=_0x5337c1;_0x5c6c54=0xc8;}else{_0x5c6c54=0xce;}_0x2eea39['status'](_0x5c6c54);return _0x2eea39[_0x654d('0x1b')](_0x654d('0x1c'),_0x58eab3+'-'+_0x428a48+'/'+_0x5337c1)[_0x654d('0x16')](_0xbc226d);}return null;};}function patchUpdates(_0x5a075f){return function(_0x585fae){try{jsonpatch[_0x654d('0x1d')](_0x585fae,_0x5a075f,!![]);}catch(_0x9cc86c){return BPromise[_0x654d('0x1e')](_0x9cc86c);}return _0x585fae[_0x654d('0x1f')]();};}function saveUpdates(_0x1bbe8c,_0x41671d){return function(_0x122570){if(_0x122570){return _0x122570['update'](_0x1bbe8c)[_0x654d('0x20')](function(_0xfec87){return _0xfec87;});}return null;};}function removeEntity(_0xf55d1b,_0x241c04){return function(_0x1444e3){if(_0x1444e3){return _0x1444e3[_0x654d('0x21')]()[_0x654d('0x20')](function(){_0xf55d1b[_0x654d('0x15')](0xcc)[_0x654d('0x22')]();});}};}function handleEntityNotFound(_0x573255,_0x32c274){return function(_0x1203fb){if(!_0x1203fb){_0x573255[_0x654d('0x14')](0x194);}return _0x1203fb;};}function handleError(_0x441baa,_0x2cb630){_0x2cb630=_0x2cb630||0x1f4;return function(_0x31b564){logger['error'](_0x31b564[_0x654d('0x23')]);if(_0x31b564[_0x654d('0x24')]){delete _0x31b564[_0x654d('0x24')];}_0x441baa[_0x654d('0x15')](_0x2cb630)[_0x654d('0x25')](_0x31b564);};}exports[_0x654d('0x26')]=function(_0x4a65d0,_0x5caecc){var _0x3a7033={},_0x305b29={},_0x49c6b7={'count':0x0,'rows':[]};var _0x841aaa=_[_0x654d('0x27')](db[_0x654d('0x28')]['rawAttributes'],function(_0x4c30a6){return{'name':_0x4c30a6[_0x654d('0x29')],'type':_0x4c30a6['type'][_0x654d('0x2a')]};});_0x305b29['model']=_[_0x654d('0x2b')](_[_0x654d('0x27')](_0x841aaa,_0x654d('0x24')),['name']);_0x305b29[_0x654d('0x2c')]=_['keys'](_0x4a65d0[_0x654d('0x2c')]);_0x305b29[_0x654d('0x2d')]=_[_0x654d('0x2e')](_0x305b29['model'],_0x305b29['query']);_0x3a7033[_0x654d('0x2f')]=_[_0x654d('0x2e')](_0x305b29[_0x654d('0x30')],qs['fields'](_0x4a65d0[_0x654d('0x2c')][_0x654d('0x31')]));_0x3a7033['attributes']=_0x3a7033[_0x654d('0x2f')]['length']?_0x3a7033[_0x654d('0x2f')]:_0x305b29[_0x654d('0x30')];if(!_0x4a65d0['query'][_0x654d('0x32')](_0x654d('0x33'))){_0x3a7033[_0x654d('0x19')]=qs[_0x654d('0x19')](_0x4a65d0[_0x654d('0x2c')][_0x654d('0x19')]);_0x3a7033['offset']=qs[_0x654d('0x17')](_0x4a65d0[_0x654d('0x2c')][_0x654d('0x17')]);}_0x3a7033[_0x654d('0x34')]=qs['sort'](_0x4a65d0[_0x654d('0x2c')][_0x654d('0x35')]);_0x3a7033[_0x654d('0x36')]=qs[_0x654d('0x2d')](_['pick'](_0x4a65d0[_0x654d('0x2c')],_0x305b29[_0x654d('0x2d')]),_0x841aaa);if(_0x4a65d0[_0x654d('0x2c')][_0x654d('0x37')]){_0x3a7033[_0x654d('0x36')]=_[_0x654d('0x38')](_0x3a7033[_0x654d('0x36')],{'$or':_['map'](_0x841aaa,function(_0x59d57a){if(_0x59d57a[_0x654d('0x39')]!==_0x654d('0x3a')){var _0x1cce6c={};_0x1cce6c[_0x59d57a['name']]={'$like':'%'+_0x4a65d0[_0x654d('0x2c')][_0x654d('0x37')]+'%'};return _0x1cce6c;}})});}_0x3a7033=_[_0x654d('0x38')]({},_0x3a7033,_0x4a65d0[_0x654d('0x3b')]);var _0x498bf9={'where':_0x3a7033[_0x654d('0x36')]};return db['CmCustomField'][_0x654d('0x1a')](_0x498bf9)[_0x654d('0x20')](function(_0x2c905a){_0x49c6b7['count']=_0x2c905a;if(_0x4a65d0['query'][_0x654d('0x3c')]){_0x3a7033[_0x654d('0x3d')]=[{'all':!![]}];}return db[_0x654d('0x28')]['findAll'](_0x3a7033);})[_0x654d('0x20')](function(_0x2a6906){_0x49c6b7[_0x654d('0x3e')]=_0x2a6906;return _0x49c6b7;})[_0x654d('0x20')](respondWithFilteredResult(_0x5caecc,_0x3a7033))[_0x654d('0x3f')](handleError(_0x5caecc,null));};exports[_0x654d('0x40')]=function(_0x58c786,_0xa20d86){var _0x45509c={'raw':!![],'where':{'id':_0x58c786[_0x654d('0x41')]['id']}},_0x2a43a9={};_0x2a43a9[_0x654d('0x30')]=_[_0x654d('0x42')](db[_0x654d('0x28')][_0x654d('0x43')]);_0x2a43a9[_0x654d('0x2c')]=_[_0x654d('0x42')](_0x58c786[_0x654d('0x2c')]);_0x2a43a9[_0x654d('0x2d')]=_[_0x654d('0x2e')](_0x2a43a9[_0x654d('0x30')],_0x2a43a9['query']);_0x45509c['attributes']=_[_0x654d('0x2e')](_0x2a43a9[_0x654d('0x30')],qs['fields'](_0x58c786[_0x654d('0x2c')][_0x654d('0x31')]));_0x45509c['attributes']=_0x45509c['attributes'][_0x654d('0x44')]?_0x45509c['attributes']:_0x2a43a9[_0x654d('0x30')];if(_0x58c786['query']['includeAll']){_0x45509c[_0x654d('0x3d')]=[{'all':!![]}];}_0x45509c=_[_0x654d('0x38')]({},_0x45509c,_0x58c786[_0x654d('0x3b')]);return db[_0x654d('0x28')]['find'](_0x45509c)[_0x654d('0x20')](handleEntityNotFound(_0xa20d86,null))['then'](respondWithResult(_0xa20d86,null))[_0x654d('0x3f')](handleError(_0xa20d86,null));};exports['update']=function(_0x386fd6,_0x2b1be2){if(_0x386fd6['body']['id']){delete _0x386fd6[_0x654d('0x45')]['id'];}return db[_0x654d('0x28')][_0x654d('0x46')]({'where':{'id':_0x386fd6['params']['id']}})['then'](handleEntityNotFound(_0x2b1be2,null))[_0x654d('0x20')](saveUpdates(_0x386fd6[_0x654d('0x45')],null))[_0x654d('0x20')](respondWithResult(_0x2b1be2,null))['catch'](handleError(_0x2b1be2,null));};exports[_0x654d('0x21')]=function(_0xfd5158,_0x25b499){return db[_0x654d('0x28')][_0x654d('0x46')]({'where':{'id':_0xfd5158[_0x654d('0x41')]['id']}})[_0x654d('0x20')](handleEntityNotFound(_0x25b499,null))[_0x654d('0x20')](removeEntity(_0x25b499,null))[_0x654d('0x3f')](handleError(_0x25b499,null));};exports[_0x654d('0x47')]=function(_0x5053fa,_0x3bfa45){var _0x5d6875;return db[_0x654d('0x48')][_0x654d('0x49')](function(_0x4f5220){return db['CmCustomField'][_0x654d('0x47')](_0x5053fa['body'],{'transaction':_0x4f5220})['then'](function(_0x2fa9f5){_0x5d6875=_0x2fa9f5;var _0x57b688={'type':db[_0x654d('0x4a')][_0x654d('0x4b')],'transaction':_0x4f5220};switch(_0x5053fa[_0x654d('0x45')][_0x654d('0x39')]){case _0x654d('0x4c'):_0x57b688['type']=db['Sequelize']['TEXT'];break;case _0x654d('0x4d'):_0x57b688[_0x654d('0x39')]=db[_0x654d('0x4a')][_0x654d('0x4e')];break;case _0x654d('0x4f'):_0x57b688[_0x654d('0x39')]=db[_0x654d('0x4a')]['BOOLEAN'];_0x57b688[_0x654d('0x50')]=![];break;default:}return db[_0x654d('0x48')][_0x654d('0x51')][_0x654d('0x52')](_0x654d('0x53'),util['format']('cf_%d',_0x5d6875['id']),_0x57b688);})[_0x654d('0x20')](function(){return _0x5d6875;});})['then'](respondWithResult(_0x3bfa45,0xc9))['catch'](handleError(_0x3bfa45,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8449a38..baddb85 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 _0xf037=['bluebird','request-promise','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','util','../../config/logger','api','moment'];(function(_0xa06841,_0x446844){var _0x260f86=function(_0x2a3ccc){while(--_0x2a3ccc){_0xa06841['push'](_0xa06841['shift']());}};_0x260f86(++_0x446844);}(_0xf037,0x188));var _0x7f03=function(_0x3bc3b4,_0x5acff4){_0x3bc3b4=_0x3bc3b4-0x0;var _0x4c546b=_0xf037[_0x3bc3b4];return _0x4c546b;};'use strict';var _=require('lodash');var util=require(_0x7f03('0x0'));var logger=require(_0x7f03('0x1'))(_0x7f03('0x2'));var moment=require(_0x7f03('0x3'));var BPromise=require(_0x7f03('0x4'));var rp=require(_0x7f03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f03('0x6'));var config=require('../../config/environment');var attributes=require(_0x7f03('0x7'));module[_0x7f03('0x8')]=function(_0x889c89,_0x2f4dfd){return _0x889c89[_0x7f03('0x9')](_0x7f03('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x804e=['CmCustomField','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x4fc071,_0x4e7ba2){var _0x177d84=function(_0x3673cd){while(--_0x3673cd){_0x4fc071['push'](_0x4fc071['shift']());}};_0x177d84(++_0x4e7ba2);}(_0x804e,0x64));var _0xe804=function(_0xc8f9b4,_0x36700f){_0xc8f9b4=_0xc8f9b4-0x0;var _0x177e41=_0x804e[_0xc8f9b4];return _0x177e41;};'use strict';var _=require(_0xe804('0x0'));var util=require(_0xe804('0x1'));var logger=require(_0xe804('0x2'))(_0xe804('0x3'));var moment=require(_0xe804('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe804('0x5'));var rimraf=require(_0xe804('0x6'));var config=require(_0xe804('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xe804('0x8')]=function(_0x37ec58,_0xf73b9e){return _0x37ec58[_0xe804('0x9')](_0xe804('0xa'),attributes,{'tableName':'cm_custom_fields','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 53d70d2..a17b845 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 _0x9156=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x2f072e,_0x2587fd){var _0x5a7bdc=function(_0x1b5f21){while(--_0x1b5f21){_0x2f072e['push'](_0x2f072e['shift']());}};_0x5a7bdc(++_0x2587fd);}(_0x9156,0xa9));var _0x6915=function(_0x17fe10,_0x3f37a6){_0x17fe10=_0x17fe10-0x0;var _0x4c9519=_0x9156[_0x17fe10];return _0x4c9519;};'use strict';var _=require(_0x6915('0x0'));var util=require(_0x6915('0x1'));var moment=require(_0x6915('0x2'));var BPromise=require('bluebird');var rs=require(_0x6915('0x3'));var fs=require('fs');var Redis=require(_0x6915('0x4'));var db=require(_0x6915('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6915('0x6'))(_0x6915('0x7'));var config=require(_0x6915('0x8'));var jayson=require(_0x6915('0x9'));var client=jayson[_0x6915('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1347aa,_0x466e41,_0x5a6e10){return new BPromise(function(_0x5e88e8,_0x2a7834){return client[_0x6915('0xb')](_0x1347aa,_0x5a6e10)[_0x6915('0xc')](function(_0x31666d){logger['info'](_0x6915('0xd'),_0x466e41,_0x6915('0xe'));logger[_0x6915('0xf')](_0x6915('0x10'),_0x466e41,_0x6915('0xe'),JSON['stringify'](_0x31666d));if(_0x31666d['error']){if(_0x31666d[_0x6915('0x11')][_0x6915('0x12')]===0x1f4){logger[_0x6915('0x11')](_0x6915('0xd'),_0x466e41,_0x31666d[_0x6915('0x11')][_0x6915('0x13')]);return _0x2a7834(_0x31666d[_0x6915('0x11')][_0x6915('0x13')]);}logger[_0x6915('0x11')](_0x6915('0xd'),_0x466e41,_0x31666d[_0x6915('0x11')][_0x6915('0x13')]);return _0x5e88e8(_0x31666d[_0x6915('0x11')][_0x6915('0x13')]);}else{logger[_0x6915('0x14')](_0x6915('0xd'),_0x466e41,_0x6915('0xe'));_0x5e88e8(_0x31666d[_0x6915('0x15')][_0x6915('0x13')]);}})[_0x6915('0x16')](function(_0x1c1912){logger[_0x6915('0x11')](_0x6915('0xd'),_0x466e41,_0x1c1912);_0x2a7834(_0x1c1912);});});} \ No newline at end of file +var _0x6656=['jayson/promise','request','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x6656,0x1c0));var _0x6665=function(_0x15ef2e,_0x4f24d2){_0x15ef2e=_0x15ef2e-0x0;var _0xfa936=_0x6656[_0x15ef2e];return _0xfa936;};'use strict';var _=require(_0x6665('0x0'));var util=require('util');var moment=require(_0x6665('0x1'));var BPromise=require(_0x6665('0x2'));var rs=require(_0x6665('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6665('0x4'))['db'];var utils=require(_0x6665('0x5'));var logger=require(_0x6665('0x6'))(_0x6665('0x7'));var config=require('../../config/environment');var jayson=require(_0x6665('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebe08,_0x226ab3,_0x533c85){return new BPromise(function(_0x42dd9b,_0x3fbf3e){return client[_0x6665('0x9')](_0x4ebe08,_0x533c85)['then'](function(_0x59113e){logger['info'](_0x6665('0xa'),_0x226ab3,_0x6665('0xb'));logger['debug'](_0x6665('0xc'),_0x226ab3,_0x6665('0xb'),JSON[_0x6665('0xd')](_0x59113e));if(_0x59113e[_0x6665('0xe')]){if(_0x59113e['error'][_0x6665('0xf')]===0x1f4){logger['error'](_0x6665('0xa'),_0x226ab3,_0x59113e[_0x6665('0xe')]['message']);return _0x3fbf3e(_0x59113e[_0x6665('0xe')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x226ab3,_0x59113e[_0x6665('0xe')][_0x6665('0x10')]);return _0x42dd9b(_0x59113e[_0x6665('0xe')]['message']);}else{logger[_0x6665('0x11')](_0x6665('0xa'),_0x226ab3,_0x6665('0xb'));_0x42dd9b(_0x59113e['result'][_0x6665('0x10')]);}})[_0x6665('0x12')](function(_0x50b05){logger['error']('CmCustomField,\x20%s,\x20%s',_0x226ab3,_0x50b05);_0x3fbf3e(_0x50b05);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 28ab1fc..cbca80b 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 _0x0a52=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x4c087a,_0x4fa60e){var _0x3452e2=function(_0x161269){while(--_0x161269){_0x4c087a['push'](_0x4c087a['shift']());}};_0x3452e2(++_0x4fa60e);}(_0x0a52,0xe4));var _0x20a5=function(_0x2ddd5d,_0x35f964){_0x2ddd5d=_0x2ddd5d-0x0;var _0x24af97=_0x0a52[_0x2ddd5d];return _0x24af97;};'use strict';var multer=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var path=require('path');var timeout=require(_0x20a5('0x2'));var express=require(_0x20a5('0x3'));var router=express[_0x20a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x20a5('0x5'));var interaction=require(_0x20a5('0x6'));var config=require(_0x20a5('0x7'));var controller=require(_0x20a5('0x8'));router[_0x20a5('0x9')]('/',auth[_0x20a5('0xa')](),controller['index']);router['get'](_0x20a5('0xb'),auth[_0x20a5('0xa')](),controller['show']);router[_0x20a5('0xc')]('/',auth[_0x20a5('0xa')](),controller[_0x20a5('0xd')]);router[_0x20a5('0xe')]('/:id',auth[_0x20a5('0xa')](),controller[_0x20a5('0xf')]);router[_0x20a5('0x10')](_0x20a5('0xb'),auth[_0x20a5('0xa')](),controller[_0x20a5('0x11')]);module[_0x20a5('0x12')]=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(_0x53f917,_0x26a9c4){var _0x4b328d=function(_0x569c2e){while(--_0x569c2e){_0x53f917['push'](_0x53f917['shift']());}};_0x4b328d(++_0x26a9c4);}(_0x723e,0x179));var _0xe723=function(_0x79e316,_0x38e778){_0x79e316=_0x79e316-0x0;var _0xb8b436=_0x723e[_0x79e316];return _0xb8b436;};'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 edffbd1..0cd2f45 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 _0xcc91=['exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x48144d,_0xd73501){var _0x4afcc9=function(_0x21d5d8){while(--_0x21d5d8){_0x48144d['push'](_0x48144d['shift']());}};_0x4afcc9(++_0xd73501);}(_0xcc91,0x131));var _0x1cc9=function(_0x5ec453,_0x30b0ba){_0x5ec453=_0x5ec453-0x0;var _0x25548f=_0xcc91[_0x5ec453];return _0x25548f;};'use strict';var moment=require(_0x1cc9('0x0'));var Sequelize=require('sequelize');module[_0x1cc9('0x1')]={'phone':{'type':Sequelize[_0x1cc9('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1cc9('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1cc9('0x4')],'defaultValue':moment()['format'](_0x1cc9('0x5'))},'countbusyretry':{'type':Sequelize[_0x1cc9('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1cc9('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1cc9('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x1cc9('0x6')](0x2)[_0x1cc9('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1cc9('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1cc9('0x8')},'ListId':{'type':Sequelize[_0x1cc9('0x6')],'unique':_0x1cc9('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x1cc9('0x6')],'unique':_0x1cc9('0x8')},'CampaignId':{'type':Sequelize[_0x1cc9('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x1cc9('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1cc9('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1cc9('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1cc9('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0754=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x84b740,_0x2db6e8){var _0x12adf7=function(_0x47e4c2){while(--_0x47e4c2){_0x84b740['push'](_0x84b740['shift']());}};_0x12adf7(++_0x2db6e8);}(_0x0754,0xab));var _0x4075=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x0754[_0x16de68];return _0x1c277e;};'use strict';var moment=require(_0x4075('0x0'));var Sequelize=require(_0x4075('0x1'));module[_0x4075('0x2')]={'phone':{'type':Sequelize[_0x4075('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x4075('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4075('0x5')],'defaultValue':moment()['format'](_0x4075('0x6'))},'countbusyretry':{'type':Sequelize[_0x4075('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4075('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4075('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4075('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x4075('0x7')](0x2)[_0x4075('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4075('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4075('0x7')],'unique':_0x4075('0x9')},'UserId':{'type':Sequelize[_0x4075('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4075('0x7')],'unique':_0x4075('0x9')},'CampaignId':{'type':Sequelize[_0x4075('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4075('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4075('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4075('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4075('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 7cba85a..639633c 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 _0xdc0d=['statedesc','deleted','campaign','membername','user','UserId','format','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopper','key','model','keys','query','intersection','filters','concat','$and','$gte','$lt','$lte','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','include','findAll','rows','show','params','options','find','catch','create','body','describe','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt'];(function(_0x536919,_0x2d0c68){var _0x3694d9=function(_0xf21223){while(--_0xf21223){_0x536919['push'](_0x536919['shift']());}};_0x3694d9(++_0x2d0c68);}(_0xdc0d,0xc4));var _0xddc0=function(_0x3a1151,_0x56fdaf){_0x3a1151=_0x3a1151-0x0;var _0x1465e0=_0xdc0d[_0x3a1151];return _0x1465e0;};'use strict';var emlformat=require(_0xddc0('0x0'));var rimraf=require(_0xddc0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xddc0('0x2'));var BPromise=require(_0xddc0('0x3'));var Mustache=require('mustache');var util=require(_0xddc0('0x4'));var path=require(_0xddc0('0x5'));var sox=require(_0xddc0('0x6'));var csv=require(_0xddc0('0x7'));var ejs=require(_0xddc0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xddc0('0x9'));var squel=require(_0xddc0('0xa'));var crypto=require('crypto');var jsforce=require(_0xddc0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xddc0('0x7'));var querystring=require('querystring');var Papa=require(_0xddc0('0xc'));var Redis=require(_0xddc0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xddc0('0xe'));var as=require(_0xddc0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddc0('0x10'))(_0xddc0('0x11'));var utils=require(_0xddc0('0x12'));var config=require(_0xddc0('0x13'));var licenseUtil=require(_0xddc0('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1341d2,_0x17e59a){_0x17e59a=_0x17e59a||0xcc;return function(_0xbe437d){if(_0xbe437d){return _0x1341d2[_0xddc0('0x15')](_0x17e59a);}return _0x1341d2[_0xddc0('0x16')](_0x17e59a)[_0xddc0('0x17')]();};}function respondWithResult(_0x2ba87b,_0x50422e){_0x50422e=_0x50422e||0xc8;return function(_0x34fce9){if(_0x34fce9){return _0x2ba87b[_0xddc0('0x16')](_0x50422e)['json'](_0x34fce9);}};}function respondWithFilteredResult(_0x2c79d4,_0x60b89c){return function(_0x5aee9){if(_0x5aee9){var _0x345297=typeof _0x60b89c[_0xddc0('0x18')]===_0xddc0('0x19')&&typeof _0x60b89c[_0xddc0('0x1a')]===_0xddc0('0x19');var _0x13f62c=_0x5aee9['count'];var _0x343ddf=_0x345297?0x0:_0x60b89c['offset'];var _0x4565c2=_0x345297?_0x5aee9[_0xddc0('0x1b')]:_0x60b89c[_0xddc0('0x18')]+_0x60b89c[_0xddc0('0x1a')];var _0x10dce9;if(_0x4565c2>=_0x13f62c){_0x4565c2=_0x13f62c;_0x10dce9=0xc8;}else{_0x10dce9=0xce;}_0x2c79d4['status'](_0x10dce9);return _0x2c79d4[_0xddc0('0x1c')](_0xddc0('0x1d'),_0x343ddf+'-'+_0x4565c2+'/'+_0x13f62c)[_0xddc0('0x1e')](_0x5aee9);}return null;};}function patchUpdates(_0xecae76){return function(_0x34c48d){try{jsonpatch[_0xddc0('0x1f')](_0x34c48d,_0xecae76,!![]);}catch(_0x14bbf5){return BPromise[_0xddc0('0x20')](_0x14bbf5);}return _0x34c48d[_0xddc0('0x21')]();};}function saveUpdates(_0x2bbc60,_0x27ea81){return function(_0x552ad1){if(_0x552ad1){return _0x552ad1[_0xddc0('0x22')](_0x2bbc60)[_0xddc0('0x23')](function(_0x59ca1b){return _0x59ca1b;});}return null;};}function removeEntity(_0x10faa4,_0x1a7686){return function(_0x13d52c){if(_0x13d52c){return _0x13d52c[_0xddc0('0x24')]()[_0xddc0('0x23')](function(){_0x10faa4['status'](0xcc)[_0xddc0('0x17')]();});}};}function handleEntityNotFound(_0x5f4b24,_0xc0c7ff){return function(_0x2001aa){if(!_0x2001aa){_0x5f4b24[_0xddc0('0x15')](0x194);}return _0x2001aa;};}function handleError(_0x44c980,_0x1d15d3){_0x1d15d3=_0x1d15d3||0x1f4;return function(_0x4963e7){logger[_0xddc0('0x25')](_0x4963e7[_0xddc0('0x26')]);if(_0x4963e7[_0xddc0('0x27')]){delete _0x4963e7[_0xddc0('0x27')];}_0x44c980[_0xddc0('0x16')](_0x1d15d3)['send'](_0x4963e7);};}exports[_0xddc0('0x28')]=function(_0x5150a1,_0x1bdace){var _0x137465={},_0x5ed34d={},_0x548bcc={'count':0x0,'rows':[]};var _0x30a677=_[_0xddc0('0x29')](db[_0xddc0('0x2a')]['rawAttributes'],function(_0xfe97ba){return{'name':_0xfe97ba['fieldName'],'type':_0xfe97ba['type'][_0xddc0('0x2b')]};});_0x5ed34d[_0xddc0('0x2c')]=_[_0xddc0('0x29')](_0x30a677,_0xddc0('0x27'));_0x5ed34d['query']=_[_0xddc0('0x2d')](_0x5150a1[_0xddc0('0x2e')]);_0x5ed34d['filters']=_[_0xddc0('0x2f')](_0x5ed34d[_0xddc0('0x2c')],_0x5ed34d[_0xddc0('0x2e')]);_0x5ed34d[_0xddc0('0x30')]=_[_0xddc0('0x31')](_0x5ed34d[_0xddc0('0x30')],[_0xddc0('0x32'),'$or','$gt',_0xddc0('0x33'),_0xddc0('0x34'),_0xddc0('0x35'),'$ne','$eq',_0xddc0('0x36'),_0xddc0('0x37'),_0xddc0('0x38'),_0xddc0('0x39'),'$notIn',_0xddc0('0x3a'),_0xddc0('0x3b'),_0xddc0('0x3c'),_0xddc0('0x3d'),_0xddc0('0x3a'),_0xddc0('0x3e'),_0xddc0('0x3f'),'$contained','$any']);_0x137465[_0xddc0('0x40')]=_[_0xddc0('0x2f')](_0x5ed34d['model'],qs[_0xddc0('0x41')](_0x5150a1[_0xddc0('0x2e')][_0xddc0('0x41')]));_0x137465['attributes']=_0x137465[_0xddc0('0x40')][_0xddc0('0x42')]?_0x137465[_0xddc0('0x40')]:_0x5ed34d[_0xddc0('0x2c')];if(!_0x5150a1[_0xddc0('0x2e')][_0xddc0('0x43')](_0xddc0('0x44'))){_0x137465[_0xddc0('0x1a')]=qs['limit'](_0x5150a1[_0xddc0('0x2e')][_0xddc0('0x1a')]);_0x137465['offset']=qs[_0xddc0('0x18')](_0x5150a1[_0xddc0('0x2e')]['offset']);}_0x137465[_0xddc0('0x45')]=qs['sort'](_0x5150a1[_0xddc0('0x2e')][_0xddc0('0x46')]);_0x137465['where']=qs[_0xddc0('0x30')](_['pick'](_0x5150a1[_0xddc0('0x2e')],_0x5ed34d[_0xddc0('0x30')]),_0x30a677);if(_0x5150a1[_0xddc0('0x2e')][_0xddc0('0x47')]){_0x137465[_0xddc0('0x48')]=_[_0xddc0('0x49')](_0x137465[_0xddc0('0x48')],{'$or':_[_0xddc0('0x29')](_0x30a677,function(_0x441a6f){if(_0x441a6f[_0xddc0('0x4a')]!==_0xddc0('0x4b')){var _0x3ce325={};_0x3ce325[_0x441a6f[_0xddc0('0x27')]]={'$like':'%'+_0x5150a1[_0xddc0('0x2e')][_0xddc0('0x47')]+'%'};return _0x3ce325;}})});}_0x137465=_[_0xddc0('0x49')]({},_0x137465,_0x5150a1['options']);var _0x918b7f={'where':_0x137465['where']};return db[_0xddc0('0x2a')][_0xddc0('0x1b')](_0x918b7f)['then'](function(_0x2f499d){_0x548bcc[_0xddc0('0x1b')]=_0x2f499d;if(_0x5150a1[_0xddc0('0x2e')]['includeAll']){_0x137465[_0xddc0('0x4c')]=[{'all':!![]}];}return db[_0xddc0('0x2a')][_0xddc0('0x4d')](_0x137465);})['then'](function(_0x333ea3){_0x548bcc[_0xddc0('0x4e')]=_0x333ea3;return _0x548bcc;})[_0xddc0('0x23')](respondWithFilteredResult(_0x1bdace,_0x137465))['catch'](handleError(_0x1bdace,null));};exports[_0xddc0('0x4f')]=function(_0x1d22ae,_0x3e7858){var _0x3646bb={'raw':!![],'where':{'id':_0x1d22ae[_0xddc0('0x50')]['id']}},_0x4427dd={};_0x4427dd[_0xddc0('0x2c')]=_[_0xddc0('0x2d')](db[_0xddc0('0x2a')]['rawAttributes']);_0x4427dd[_0xddc0('0x2e')]=_[_0xddc0('0x2d')](_0x1d22ae[_0xddc0('0x2e')]);_0x4427dd['filters']=_[_0xddc0('0x2f')](_0x4427dd[_0xddc0('0x2c')],_0x4427dd[_0xddc0('0x2e')]);_0x3646bb[_0xddc0('0x40')]=_['intersection'](_0x4427dd['model'],qs['fields'](_0x1d22ae['query'][_0xddc0('0x41')]));_0x3646bb[_0xddc0('0x40')]=_0x3646bb[_0xddc0('0x40')][_0xddc0('0x42')]?_0x3646bb[_0xddc0('0x40')]:_0x4427dd[_0xddc0('0x2c')];if(_0x1d22ae['query']['includeAll']){_0x3646bb[_0xddc0('0x4c')]=[{'all':!![]}];}_0x3646bb=_[_0xddc0('0x49')]({},_0x3646bb,_0x1d22ae[_0xddc0('0x51')]);return db['CmHopper'][_0xddc0('0x52')](_0x3646bb)['then'](handleEntityNotFound(_0x3e7858,null))[_0xddc0('0x23')](respondWithResult(_0x3e7858,null))[_0xddc0('0x53')](handleError(_0x3e7858,null));};exports[_0xddc0('0x54')]=function(_0x35a80e,_0xe50358){return db[_0xddc0('0x2a')][_0xddc0('0x54')](_0x35a80e[_0xddc0('0x55')],{})[_0xddc0('0x23')](respondWithResult(_0xe50358,0xc9))[_0xddc0('0x53')](handleError(_0xe50358,null));};exports[_0xddc0('0x22')]=function(_0x523ab4,_0x30d793){if(_0x523ab4['body']['id']){delete _0x523ab4[_0xddc0('0x55')]['id'];}return db[_0xddc0('0x2a')][_0xddc0('0x52')]({'where':{'id':_0x523ab4['params']['id']}})['then'](handleEntityNotFound(_0x30d793,null))[_0xddc0('0x23')](saveUpdates(_0x523ab4[_0xddc0('0x55')],null))[_0xddc0('0x23')](respondWithResult(_0x30d793,null))['catch'](handleError(_0x30d793,null));};exports[_0xddc0('0x56')]=function(_0x333110,_0x3999a0){return db['CmHopper'][_0xddc0('0x56')]()[_0xddc0('0x23')](respondWithResult(_0x3999a0,null))[_0xddc0('0x53')](handleError(_0x3999a0,null));};exports[_0xddc0('0x24')]=function(_0x2659dc,_0x52e2a4){var _0x1e46b6;return db[_0xddc0('0x2a')][_0xddc0('0x52')]({'where':{'id':_0x2659dc['params']['id']}})[_0xddc0('0x23')](handleEntityNotFound(_0x52e2a4,null))[_0xddc0('0x23')](function(_0x2e991f){if(_0x2e991f){return _0x2e991f[_0xddc0('0x24')]()[_0xddc0('0x23')](function(_0x56b5b1){return _0x56b5b1;});}})['then'](function(_0x211560){_0x1e46b6=_0x211560;if(_0x211560){if(_0x211560[_0xddc0('0x57')]||_0x211560[_0xddc0('0x58')]){return db[_0x211560[_0xddc0('0x57')]?'VoiceQueue':_0xddc0('0x59')][_0xddc0('0x52')]({'where':{'id':_0x211560['VoiceQueueId']?_0x211560[_0xddc0('0x57')]:_0x211560[_0xddc0('0x58')]},'attributes':['id','name'],'raw':!![]});}}})[_0xddc0('0x23')](function(_0x2c5db0){var _0x5059d6={};if(_0x2c5db0){_[_0xddc0('0x49')](_0x5059d6,_[_0xddc0('0x5a')](_0x1e46b6[_0xddc0('0x5b')],[_0xddc0('0x5c'),_0xddc0('0x5d'),'id']));_0x5059d6['state']=0x15;_0x5059d6[_0xddc0('0x5e')]=_0xddc0('0x5f');_0x5059d6[_0xddc0('0x60')]=_0x2c5db0[_0xddc0('0x27')];_0x5059d6[_0xddc0('0x61')]=_0x2659dc[_0xddc0('0x62')][_0xddc0('0x27')];_0x5059d6[_0xddc0('0x63')]=_0x2659dc[_0xddc0('0x62')]['id'];_0x5059d6['deleted']=!![];_0x5059d6['deletedat']=moment()[_0xddc0('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x5059d6['calleridnum']=_0x1e46b6['phone'];_0x5059d6[_0xddc0('0x65')]=_0x1e46b6['VoiceQueueId']?_0xddc0('0x66'):_0xddc0('0x67');return db[_0xddc0('0x68')]['find']({'where':{'id':_0x5059d6[_0xddc0('0x69')]},'attributes':[_0xddc0('0x6a'),_0xddc0('0x6b')]})['then'](function(_0x591476){if(!_[_0xddc0('0x6c')](_0x52e2a4)&&!_[_0xddc0('0x6c')](_0x591476['firstName'])){_0x5059d6[_0xddc0('0x6d')]=_0x591476[_0xddc0('0x6a')];if(!_[_0xddc0('0x6c')](_0x591476[_0xddc0('0x6b')])){_0x5059d6['calleridname']+='\x20'+_0x591476[_0xddc0('0x6b')];}}})[_0xddc0('0x6e')](function(){return db[_0xddc0('0x6f')]['create'](_0x5059d6);});}})[_0xddc0('0x23')](function(){return _0x52e2a4['status'](0xcc)[_0xddc0('0x17')]();})[_0xddc0('0x53')](handleError(_0x52e2a4,null));};exports[_0xddc0('0x70')]=function(_0x312070,_0x5bbe4c,_0x543dd3){var _0x2dfbd0=[];return db[_0xddc0('0x68')][_0xddc0('0x56')]()[_0xddc0('0x23')](function(_0x1aa937){_0x2dfbd0=_[_0xddc0('0x2d')](_0x1aa937);return _0x312070['user'][_0xddc0('0x71')]({'where':{'type':_0xddc0('0x72'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xddc0('0x73')],'raw':!![]});})[_0xddc0('0x23')](function(_0x2be217){if(_0x2be217&&_0x2be217['length']){return db[_0xddc0('0x74')][_0xddc0('0x75')](function(_0x109047){var _0x26bbad={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xddc0('0x76'))},'VoiceQueueId':{'$in':_[_0xddc0('0x29')](_0x2be217,'id')},'$or':[{'UserId':null},{'UserId':_0x312070[_0xddc0('0x62')]['id']}]};var _0x490d0e=[];if(_0x312070[_0xddc0('0x55')]['direction']&&_0x312070['body']['direction']===_0xddc0('0x77')){if(!_[_0xddc0('0x78')](_0x312070['body'][_0xddc0('0x79')])){_0x26bbad['id']={'$in':_0x312070[_0xddc0('0x55')][_0xddc0('0x79')]};}_0x490d0e=[[_0xddc0('0x7a'),_0xddc0('0x7b')],[_0xddc0('0x7c'),_0x2be217[0x0][_0xddc0('0x73')]===_0xddc0('0x7b')?'DESC':_0xddc0('0x7b')],db[_0xddc0('0x74')][_0xddc0('0x7d')](_0xddc0('0x7e')),['id',_0xddc0('0x7f')]];}else{if(!_[_0xddc0('0x78')](_0x312070[_0xddc0('0x55')][_0xddc0('0x79')])){_0x26bbad['id']={'$notIn':_0x312070[_0xddc0('0x55')][_0xddc0('0x79')]};}_0x490d0e=[['priority',_0xddc0('0x7f')],[_0xddc0('0x7c'),_0x2be217[0x0][_0xddc0('0x73')]],db[_0xddc0('0x74')][_0xddc0('0x7d')](_0xddc0('0x80')),['id',_0xddc0('0x7b')]];}return db['CmHopper'][_0xddc0('0x81')]({'attributes':['id',_0xddc0('0x82')],'where':_0x26bbad,'order':_0x490d0e,'transaction':_0x109047,'lock':_0x109047[_0xddc0('0x83')][_0xddc0('0x84')],'include':[{'model':db[_0xddc0('0x68')],'as':_0xddc0('0x85'),'attributes':_0x2dfbd0,'include':[{'model':db['CmCompany'],'as':_0xddc0('0x86'),'attributes':['id',_0xddc0('0x27')]}]},{'model':db[_0xddc0('0x87')],'as':_0xddc0('0x88'),'attributes':['id','name']},{'model':db[_0xddc0('0x89')],'as':_0xddc0('0x8a'),'attributes':['id',_0xddc0('0x27'),_0xddc0('0x8b')]}]})['then'](function(_0x502f27){if(_0x502f27){return _0x502f27[_0xddc0('0x22')]({'UserId':_0x312070[_0xddc0('0x62')]['id']},{'transaction':_0x109047});}});});}})[_0xddc0('0x23')](handleEntityNotFound(_0x5bbe4c,null))['then'](respondWithResult(_0x5bbe4c,null))[_0xddc0('0x53')](handleError(_0x5bbe4c,null));};exports[_0xddc0('0x8c')]=function(_0x120189,_0x2036fd,_0x4930e6){return _0x120189[_0xddc0('0x62')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xddc0('0x8d')},'attributes':['id'],'raw':!![]})[_0xddc0('0x23')](function(_0x15672a){if(_0x15672a&&_0x15672a['length']){return db[_0xddc0('0x2a')][_0xddc0('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xddc0('0x64')](_0xddc0('0x76'))},'VoiceQueueId':{'$in':_[_0xddc0('0x29')](_0x15672a,'id')},'$or':[{'UserId':null},{'UserId':_0x120189[_0xddc0('0x62')]['id']}]}});}return 0x0;})[_0xddc0('0x23')](function(_0x5c493c){if(!_['isNil'](_0x5c493c)&&_[_0xddc0('0x8e')](_0x5c493c)){return _0x2036fd[_0xddc0('0x16')](0xc8)[_0xddc0('0x1e')]({'contacts':_0x5c493c});}else{logger[_0xddc0('0x25')](_0xddc0('0x8f'),_0xddc0('0x8c'),0x194,_0xddc0('0x90'));_0x2036fd[_0xddc0('0x15')](0x194);}})[_0xddc0('0x53')](handleError(_0x2036fd,null));}; \ No newline at end of file +var _0x377e=['isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','then','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$lt','$not','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','format','direction','prev'];(function(_0x1d2246,_0x466be3){var _0x188c40=function(_0x38171f){while(--_0x38171f){_0x1d2246['push'](_0x1d2246['shift']());}};_0x188c40(++_0x466be3);}(_0x377e,0x1d8));var _0xe377=function(_0x32fa1f,_0x3735be){_0x32fa1f=_0x32fa1f-0x0;var _0x51a8ca=_0x377e[_0x32fa1f];return _0x51a8ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe377('0x0'));var jsonpatch=require(_0xe377('0x1'));var rp=require(_0xe377('0x2'));var moment=require(_0xe377('0x3'));var BPromise=require(_0xe377('0x4'));var Mustache=require(_0xe377('0x5'));var util=require(_0xe377('0x6'));var path=require(_0xe377('0x7'));var sox=require(_0xe377('0x8'));var csv=require(_0xe377('0x9'));var ejs=require(_0xe377('0xa'));var fs=require('fs');var fs_extra=require(_0xe377('0xb'));var _=require(_0xe377('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe377('0xd'));var deskjs=require(_0xe377('0xe'));var toCsv=require(_0xe377('0x9'));var querystring=require(_0xe377('0xf'));var Papa=require('papaparse');var Redis=require(_0xe377('0x10'));var authService=require(_0xe377('0x11'));var qs=require(_0xe377('0x12'));var as=require(_0xe377('0x13'));var hardwareService=require(_0xe377('0x14'));var logger=require(_0xe377('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xe377('0x16'));var licenseUtil=require(_0xe377('0x17'));var db=require(_0xe377('0x18'))['db'];function respondWithStatusCode(_0x3ae058,_0x393e72){_0x393e72=_0x393e72||0xcc;return function(_0x498134){if(_0x498134){return _0x3ae058[_0xe377('0x19')](_0x393e72);}return _0x3ae058[_0xe377('0x1a')](_0x393e72)[_0xe377('0x1b')]();};}function respondWithResult(_0x22c4dc,_0x3d64fb){_0x3d64fb=_0x3d64fb||0xc8;return function(_0x4a90bb){if(_0x4a90bb){return _0x22c4dc[_0xe377('0x1a')](_0x3d64fb)[_0xe377('0x1c')](_0x4a90bb);}};}function respondWithFilteredResult(_0x2cb29c,_0x523c5e){return function(_0x53ce50){if(_0x53ce50){var _0x145283=typeof _0x523c5e[_0xe377('0x1d')]===_0xe377('0x1e')&&typeof _0x523c5e['limit']===_0xe377('0x1e');var _0x675657=_0x53ce50[_0xe377('0x1f')];var _0x1deac9=_0x145283?0x0:_0x523c5e['offset'];var _0x17af3a=_0x145283?_0x53ce50[_0xe377('0x1f')]:_0x523c5e[_0xe377('0x1d')]+_0x523c5e['limit'];var _0x2a17da;if(_0x17af3a>=_0x675657){_0x17af3a=_0x675657;_0x2a17da=0xc8;}else{_0x2a17da=0xce;}_0x2cb29c[_0xe377('0x1a')](_0x2a17da);return _0x2cb29c[_0xe377('0x20')](_0xe377('0x21'),_0x1deac9+'-'+_0x17af3a+'/'+_0x675657)['json'](_0x53ce50);}return null;};}function patchUpdates(_0x36ac65){return function(_0x1635e0){try{jsonpatch[_0xe377('0x22')](_0x1635e0,_0x36ac65,!![]);}catch(_0x4e3a3d){return BPromise['reject'](_0x4e3a3d);}return _0x1635e0['save']();};}function saveUpdates(_0x1dc156,_0x44f75d){return function(_0x38b750){if(_0x38b750){return _0x38b750['update'](_0x1dc156)['then'](function(_0xd67ceb){return _0xd67ceb;});}return null;};}function removeEntity(_0x4a2a51,_0x599539){return function(_0x18ec1b){if(_0x18ec1b){return _0x18ec1b['destroy']()[_0xe377('0x23')](function(){_0x4a2a51[_0xe377('0x1a')](0xcc)[_0xe377('0x1b')]();});}};}function handleEntityNotFound(_0x413349,_0x193dce){return function(_0x4ae72c){if(!_0x4ae72c){_0x413349[_0xe377('0x19')](0x194);}return _0x4ae72c;};}function handleError(_0x5d670a,_0x41b647){_0x41b647=_0x41b647||0x1f4;return function(_0x5ca21a){logger[_0xe377('0x24')](_0x5ca21a[_0xe377('0x25')]);if(_0x5ca21a[_0xe377('0x26')]){delete _0x5ca21a['name'];}_0x5d670a[_0xe377('0x1a')](_0x41b647)['send'](_0x5ca21a);};}exports[_0xe377('0x27')]=function(_0x4973dd,_0x453efe){var _0x15dd39={},_0x46e1a1={},_0x4315af={'count':0x0,'rows':[]};var _0x3b3eb5=_[_0xe377('0x28')](db[_0xe377('0x29')][_0xe377('0x2a')],function(_0x256511){return{'name':_0x256511[_0xe377('0x2b')],'type':_0x256511[_0xe377('0x2c')][_0xe377('0x2d')]};});_0x46e1a1[_0xe377('0x2e')]=_[_0xe377('0x28')](_0x3b3eb5,'name');_0x46e1a1[_0xe377('0x2f')]=_[_0xe377('0x30')](_0x4973dd[_0xe377('0x2f')]);_0x46e1a1[_0xe377('0x31')]=_[_0xe377('0x32')](_0x46e1a1[_0xe377('0x2e')],_0x46e1a1[_0xe377('0x2f')]);_0x46e1a1['filters']=_[_0xe377('0x33')](_0x46e1a1['filters'],[_0xe377('0x34'),_0xe377('0x35'),_0xe377('0x36'),'$gte',_0xe377('0x37'),'$lte','$ne','$eq',_0xe377('0x38'),'$between',_0xe377('0x39'),_0xe377('0x3a'),'$notIn',_0xe377('0x3b'),'$notLike',_0xe377('0x3c'),_0xe377('0x3d'),_0xe377('0x3b'),_0xe377('0x3e'),_0xe377('0x3f'),_0xe377('0x40'),_0xe377('0x41')]);_0x15dd39['attributes']=_[_0xe377('0x32')](_0x46e1a1['model'],qs[_0xe377('0x42')](_0x4973dd['query']['fields']));_0x15dd39[_0xe377('0x43')]=_0x15dd39[_0xe377('0x43')][_0xe377('0x44')]?_0x15dd39['attributes']:_0x46e1a1[_0xe377('0x2e')];if(!_0x4973dd[_0xe377('0x2f')][_0xe377('0x45')](_0xe377('0x46'))){_0x15dd39[_0xe377('0x47')]=qs[_0xe377('0x47')](_0x4973dd[_0xe377('0x2f')]['limit']);_0x15dd39[_0xe377('0x1d')]=qs[_0xe377('0x1d')](_0x4973dd['query']['offset']);}_0x15dd39[_0xe377('0x48')]=qs[_0xe377('0x49')](_0x4973dd[_0xe377('0x2f')][_0xe377('0x49')]);_0x15dd39['where']=qs[_0xe377('0x31')](_[_0xe377('0x4a')](_0x4973dd[_0xe377('0x2f')],_0x46e1a1[_0xe377('0x31')]),_0x3b3eb5);if(_0x4973dd['query'][_0xe377('0x4b')]){_0x15dd39[_0xe377('0x4c')]=_[_0xe377('0x4d')](_0x15dd39[_0xe377('0x4c')],{'$or':_[_0xe377('0x28')](_0x3b3eb5,function(_0x302a46){if(_0x302a46[_0xe377('0x2c')]!==_0xe377('0x4e')){var _0x2cd72c={};_0x2cd72c[_0x302a46[_0xe377('0x26')]]={'$like':'%'+_0x4973dd[_0xe377('0x2f')][_0xe377('0x4b')]+'%'};return _0x2cd72c;}})});}_0x15dd39=_['merge']({},_0x15dd39,_0x4973dd[_0xe377('0x4f')]);var _0x5a5ed5={'where':_0x15dd39['where']};return db[_0xe377('0x29')][_0xe377('0x1f')](_0x5a5ed5)[_0xe377('0x23')](function(_0x1a9ea7){_0x4315af[_0xe377('0x1f')]=_0x1a9ea7;if(_0x4973dd['query'][_0xe377('0x50')]){_0x15dd39[_0xe377('0x51')]=[{'all':!![]}];}return db[_0xe377('0x29')][_0xe377('0x52')](_0x15dd39);})[_0xe377('0x23')](function(_0x3d6e40){_0x4315af[_0xe377('0x53')]=_0x3d6e40;return _0x4315af;})[_0xe377('0x23')](respondWithFilteredResult(_0x453efe,_0x15dd39))[_0xe377('0x54')](handleError(_0x453efe,null));};exports[_0xe377('0x55')]=function(_0x4cf3d5,_0x24bf57){var _0x3bcfab={'raw':!![],'where':{'id':_0x4cf3d5[_0xe377('0x56')]['id']}},_0x5e121f={};_0x5e121f[_0xe377('0x2e')]=_['keys'](db['CmHopper'][_0xe377('0x2a')]);_0x5e121f[_0xe377('0x2f')]=_[_0xe377('0x30')](_0x4cf3d5['query']);_0x5e121f[_0xe377('0x31')]=_[_0xe377('0x32')](_0x5e121f[_0xe377('0x2e')],_0x5e121f['query']);_0x3bcfab['attributes']=_['intersection'](_0x5e121f[_0xe377('0x2e')],qs[_0xe377('0x42')](_0x4cf3d5[_0xe377('0x2f')]['fields']));_0x3bcfab[_0xe377('0x43')]=_0x3bcfab['attributes'][_0xe377('0x44')]?_0x3bcfab[_0xe377('0x43')]:_0x5e121f[_0xe377('0x2e')];if(_0x4cf3d5[_0xe377('0x2f')][_0xe377('0x50')]){_0x3bcfab['include']=[{'all':!![]}];}_0x3bcfab=_['merge']({},_0x3bcfab,_0x4cf3d5['options']);return db[_0xe377('0x29')][_0xe377('0x57')](_0x3bcfab)['then'](handleEntityNotFound(_0x24bf57,null))[_0xe377('0x23')](respondWithResult(_0x24bf57,null))['catch'](handleError(_0x24bf57,null));};exports[_0xe377('0x58')]=function(_0x4acb21,_0x3d7187){return db[_0xe377('0x29')][_0xe377('0x58')](_0x4acb21[_0xe377('0x59')],{})['then'](respondWithResult(_0x3d7187,0xc9))['catch'](handleError(_0x3d7187,null));};exports[_0xe377('0x5a')]=function(_0xf85ce7,_0x3f9b3a){if(_0xf85ce7['body']['id']){delete _0xf85ce7[_0xe377('0x59')]['id'];}return db[_0xe377('0x29')][_0xe377('0x57')]({'where':{'id':_0xf85ce7[_0xe377('0x56')]['id']}})[_0xe377('0x23')](handleEntityNotFound(_0x3f9b3a,null))[_0xe377('0x23')](saveUpdates(_0xf85ce7[_0xe377('0x59')],null))['then'](respondWithResult(_0x3f9b3a,null))[_0xe377('0x54')](handleError(_0x3f9b3a,null));};exports[_0xe377('0x5b')]=function(_0x106280,_0x1293ee){return db[_0xe377('0x29')]['describe']()[_0xe377('0x23')](respondWithResult(_0x1293ee,null))[_0xe377('0x54')](handleError(_0x1293ee,null));};exports[_0xe377('0x5c')]=function(_0x2fd059,_0x3689c5){var _0x1ffea9;return db[_0xe377('0x29')][_0xe377('0x57')]({'where':{'id':_0x2fd059[_0xe377('0x56')]['id']}})[_0xe377('0x23')](handleEntityNotFound(_0x3689c5,null))[_0xe377('0x23')](function(_0x1cf870){if(_0x1cf870){return _0x1cf870['destroy']()[_0xe377('0x23')](function(_0x2e145d){return _0x2e145d;});}})[_0xe377('0x23')](function(_0x43e4f0){_0x1ffea9=_0x43e4f0;if(_0x43e4f0){if(_0x43e4f0[_0xe377('0x5d')]||_0x43e4f0[_0xe377('0x5e')]){return db[_0x43e4f0[_0xe377('0x5d')]?_0xe377('0x5f'):_0xe377('0x60')]['find']({'where':{'id':_0x43e4f0[_0xe377('0x5d')]?_0x43e4f0[_0xe377('0x5d')]:_0x43e4f0[_0xe377('0x5e')]},'attributes':['id',_0xe377('0x26')],'raw':!![]});}}})[_0xe377('0x23')](function(_0x5f3c13){var _0x14a363={};if(_0x5f3c13){_[_0xe377('0x4d')](_0x14a363,_['omit'](_0x1ffea9[_0xe377('0x61')],[_0xe377('0x62'),_0xe377('0x63'),'id']));_0x14a363[_0xe377('0x64')]=0x15;_0x14a363[_0xe377('0x65')]=_0xe377('0x66');_0x14a363[_0xe377('0x67')]=_0x5f3c13[_0xe377('0x26')];_0x14a363['membername']=_0x2fd059[_0xe377('0x68')][_0xe377('0x26')];_0x14a363[_0xe377('0x69')]=_0x2fd059[_0xe377('0x68')]['id'];_0x14a363[_0xe377('0x66')]=!![];_0x14a363[_0xe377('0x6a')]=moment()['format'](_0xe377('0x6b'));_0x14a363[_0xe377('0x6c')]=_0x1ffea9[_0xe377('0x6d')];_0x14a363[_0xe377('0x6e')]=_0x1ffea9[_0xe377('0x5d')]?'queue':_0xe377('0x6f');return db[_0xe377('0x70')][_0xe377('0x57')]({'where':{'id':_0x14a363[_0xe377('0x71')]},'attributes':['firstName',_0xe377('0x72')]})[_0xe377('0x23')](function(_0x5e3a28){if(!_[_0xe377('0x73')](_0x3689c5)&&!_['isNil'](_0x5e3a28[_0xe377('0x74')])){_0x14a363['calleridname']=_0x5e3a28[_0xe377('0x74')];if(!_['isNil'](_0x5e3a28[_0xe377('0x72')])){_0x14a363[_0xe377('0x75')]+='\x20'+_0x5e3a28[_0xe377('0x72')];}}})[_0xe377('0x76')](function(){return db[_0xe377('0x77')]['create'](_0x14a363);});}})[_0xe377('0x23')](function(){return _0x3689c5[_0xe377('0x1a')](0xcc)[_0xe377('0x1b')]();})[_0xe377('0x54')](handleError(_0x3689c5,null));};exports[_0xe377('0x78')]=function(_0x42e28a,_0x16f39a,_0x35e520){var _0x3b5d19=[];return db[_0xe377('0x70')][_0xe377('0x5b')]()[_0xe377('0x23')](function(_0x33aa6d){_0x3b5d19=_['keys'](_0x33aa6d);return _0x42e28a['user'][_0xe377('0x79')]({'where':{'type':_0xe377('0x7a'),'dialActive':!![],'dialMethod':_0xe377('0x7b')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0xe377('0x23')](function(_0x759dfa){if(_0x759dfa&&_0x759dfa['length']){return db[_0xe377('0x7c')]['transaction'](function(_0x54bd84){var _0x5bd7b9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe377('0x7d')](_0xe377('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x759dfa,'id')},'$or':[{'UserId':null},{'UserId':_0x42e28a[_0xe377('0x68')]['id']}]};var _0x509275=[];if(_0x42e28a[_0xe377('0x59')][_0xe377('0x7e')]&&_0x42e28a[_0xe377('0x59')]['direction']===_0xe377('0x7f')){if(!_[_0xe377('0x80')](_0x42e28a[_0xe377('0x59')][_0xe377('0x81')])){_0x5bd7b9['id']={'$in':_0x42e28a[_0xe377('0x59')]['hopperIds']};}_0x509275=[[_0xe377('0x82'),_0xe377('0x83')],[_0xe377('0x84'),_0x759dfa[0x0][_0xe377('0x85')]===_0xe377('0x83')?'DESC':_0xe377('0x83')],db[_0xe377('0x7c')][_0xe377('0x86')](_0xe377('0x87')),['id',_0xe377('0x88')]];}else{if(!_[_0xe377('0x80')](_0x42e28a['body'][_0xe377('0x81')])){_0x5bd7b9['id']={'$notIn':_0x42e28a[_0xe377('0x59')][_0xe377('0x81')]};}_0x509275=[['priority',_0xe377('0x88')],[_0xe377('0x84'),_0x759dfa[0x0][_0xe377('0x85')]],db[_0xe377('0x7c')][_0xe377('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xe377('0x83')]];}return db[_0xe377('0x29')]['findOne']({'attributes':['id',_0xe377('0x89')],'where':_0x5bd7b9,'order':_0x509275,'transaction':_0x54bd84,'lock':_0x54bd84[_0xe377('0x8a')][_0xe377('0x8b')],'include':[{'model':db['CmContact'],'as':_0xe377('0x8c'),'attributes':_0x3b5d19,'include':[{'model':db['CmCompany'],'as':_0xe377('0x8d'),'attributes':['id',_0xe377('0x26')]}]},{'model':db[_0xe377('0x8e')],'as':_0xe377('0x8f'),'attributes':['id','name']},{'model':db[_0xe377('0x5f')],'as':_0xe377('0x90'),'attributes':['id',_0xe377('0x26'),_0xe377('0x91')]}]})[_0xe377('0x23')](function(_0x1d1b1e){if(_0x1d1b1e){return _0x1d1b1e['update']({'UserId':_0x42e28a[_0xe377('0x68')]['id']},{'transaction':_0x54bd84});}});});}})['then'](handleEntityNotFound(_0x16f39a,null))['then'](respondWithResult(_0x16f39a,null))[_0xe377('0x54')](handleError(_0x16f39a,null));};exports['getOpenContacts']=function(_0xcee830,_0x39910e,_0x2d47aa){return _0xcee830[_0xe377('0x68')][_0xe377('0x79')]({'where':{'type':_0xe377('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xe377('0x23')](function(_0x1ca0e6){if(_0x1ca0e6&&_0x1ca0e6[_0xe377('0x44')]){return db['CmHopper'][_0xe377('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe377('0x7d')](_0xe377('0x6b'))},'VoiceQueueId':{'$in':_[_0xe377('0x28')](_0x1ca0e6,'id')},'$or':[{'UserId':null},{'UserId':_0xcee830[_0xe377('0x68')]['id']}]}});}return 0x0;})['then'](function(_0xb2914a){if(!_['isNil'](_0xb2914a)&&_[_0xe377('0x92')](_0xb2914a)){return _0x39910e[_0xe377('0x1a')](0xc8)[_0xe377('0x1c')]({'contacts':_0xb2914a});}else{logger[_0xe377('0x24')](_0xe377('0x93'),_0xe377('0x94'),0x194,_0xe377('0x95'));_0x39910e[_0xe377('0x19')](0x194);}})['catch'](handleError(_0x39910e,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index be4ec3f..d428ee8 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 _0x71ab=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xc')]},{'name':_0xb71a('0xd'),'fields':[_0xb71a('0xd')]},{'name':_0xb71a('0xe'),'fields':[_0xb71a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd117=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0xd117,0x182));var _0x7d11=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xd117[_0x3712e2];return _0x1faff4;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));module[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return _0x27d7e8[_0x7d11('0xc')](_0x7d11('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7d11('0xe'),'fields':[_0x7d11('0xe')]},{'name':_0x7d11('0xf'),'fields':['phone']},{'name':_0x7d11('0x10'),'fields':[_0x7d11('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index bbb54ff..81e7535 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 _0x204a=['code','message','result','catch','GetCmHopper','findAll','options','raw','attributes','limit','include','map','model','ShowCmHopper','CmHopper','where','CreateCmHopper','create','UpdateCmHopper','body','DestroyCmHopper','destroy','GetContactDialer','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','Agent','name','UserId','push','update','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','CmContact','describe','length','GetCmHopperPreview','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x204a,0x73));var _0xa204=function(_0x4e3056,_0x3d3a0c){_0x4e3056=_0x4e3056-0x0;var _0x41a463=_0x204a[_0x4e3056];return _0x41a463;};'use strict';var _=require(_0xa204('0x0'));var util=require(_0xa204('0x1'));var moment=require(_0xa204('0x2'));var BPromise=require('bluebird');var rs=require(_0xa204('0x3'));var fs=require('fs');var Redis=require(_0xa204('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa204('0x5'));var logger=require('../../config/logger')(_0xa204('0x6'));var config=require(_0xa204('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa204('0x8')][_0xa204('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x428078,_0x330928,_0x483d29){return new BPromise(function(_0x5d25fb,_0x36637d){return client['request'](_0x428078,_0x483d29)[_0xa204('0xa')](function(_0x1f074c){logger[_0xa204('0xb')](_0xa204('0xc'),_0x330928,_0xa204('0xd'));logger[_0xa204('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x330928,'request\x20sent',JSON[_0xa204('0xf')](_0x1f074c));if(_0x1f074c[_0xa204('0x10')]){if(_0x1f074c[_0xa204('0x10')][_0xa204('0x11')]===0x1f4){logger[_0xa204('0x10')](_0xa204('0xc'),_0x330928,_0x1f074c['error'][_0xa204('0x12')]);return _0x36637d(_0x1f074c[_0xa204('0x10')][_0xa204('0x12')]);}logger[_0xa204('0x10')](_0xa204('0xc'),_0x330928,_0x1f074c[_0xa204('0x10')][_0xa204('0x12')]);return _0x5d25fb(_0x1f074c[_0xa204('0x10')][_0xa204('0x12')]);}else{logger[_0xa204('0xb')](_0xa204('0xc'),_0x330928,_0xa204('0xd'));_0x5d25fb(_0x1f074c[_0xa204('0x13')][_0xa204('0x12')]);}})[_0xa204('0x14')](function(_0x467709){logger['error'](_0xa204('0xc'),_0x330928,_0x467709);_0x36637d(_0x467709);});});}exports[_0xa204('0x15')]=function(_0x286896){var _0x491e88=this;return new Promise(function(_0x3775e3,_0x43ac27){return db['CmHopper'][_0xa204('0x16')]({'raw':_0x286896[_0xa204('0x17')]?_0x286896[_0xa204('0x17')][_0xa204('0x18')]===undefined?!![]:![]:!![],'where':_0x286896['options']?_0x286896['options']['where']||null:null,'attributes':_0x286896['options']?_0x286896['options'][_0xa204('0x19')]||null:null,'limit':_0x286896['options']?_0x286896[_0xa204('0x17')][_0xa204('0x1a')]||null:null,'include':_0x286896[_0xa204('0x17')]?_0x286896[_0xa204('0x17')][_0xa204('0x1b')]?_[_0xa204('0x1c')](_0x286896['options']['include'],function(_0xc24af8){return{'model':db[_0xc24af8['model']],'as':_0xc24af8['as'],'attributes':_0xc24af8[_0xa204('0x19')],'include':_0xc24af8[_0xa204('0x1b')]?_[_0xa204('0x1c')](_0xc24af8['include'],function(_0x3c5f04){return{'model':db[_0x3c5f04[_0xa204('0x1d')]],'as':_0x3c5f04['as'],'attributes':_0x3c5f04['attributes'],'include':_0x3c5f04[_0xa204('0x1b')]?_[_0xa204('0x1c')](_0x3c5f04['include'],function(_0x486577){return{'model':db[_0x486577[_0xa204('0x1d')]],'as':_0x486577['as'],'attributes':_0x486577[_0xa204('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa204('0xa')](function(_0x20a268){logger[_0xa204('0xb')](_0xa204('0x15'),_0x286896);logger[_0xa204('0xe')]('GetCmHopper',_0x286896,JSON[_0xa204('0xf')](_0x20a268));_0x3775e3(_0x20a268);})[_0xa204('0x14')](function(_0x2a860e){logger[_0xa204('0x10')](_0xa204('0x15'),_0x2a860e[_0xa204('0x12')],_0x286896);_0x43ac27(_0x491e88[_0xa204('0x10')](0x1f4,_0x2a860e['message']));});});};exports[_0xa204('0x1e')]=function(_0x441bbb){var _0xbc33ca=this;return new Promise(function(_0x904f9e,_0x17755c){return db[_0xa204('0x1f')]['find']({'raw':_0x441bbb[_0xa204('0x17')]?_0x441bbb[_0xa204('0x17')][_0xa204('0x18')]===undefined?!![]:![]:!![],'where':_0x441bbb['options']?_0x441bbb[_0xa204('0x17')][_0xa204('0x20')]||null:null,'attributes':_0x441bbb[_0xa204('0x17')]?_0x441bbb['options'][_0xa204('0x19')]||null:null,'include':_0x441bbb[_0xa204('0x17')]?_0x441bbb[_0xa204('0x17')][_0xa204('0x1b')]?_['map'](_0x441bbb[_0xa204('0x17')][_0xa204('0x1b')],function(_0x50f77c){return{'model':db[_0x50f77c[_0xa204('0x1d')]],'as':_0x50f77c['as'],'attributes':_0x50f77c['attributes'],'include':_0x50f77c[_0xa204('0x1b')]?_[_0xa204('0x1c')](_0x50f77c[_0xa204('0x1b')],function(_0x4c3b2a){return{'model':db[_0x4c3b2a['model']],'as':_0x4c3b2a['as'],'attributes':_0x4c3b2a[_0xa204('0x19')],'include':_0x4c3b2a[_0xa204('0x1b')]?_[_0xa204('0x1c')](_0x4c3b2a[_0xa204('0x1b')],function(_0xd1cdad){return{'model':db[_0xd1cdad['model']],'as':_0xd1cdad['as'],'attributes':_0xd1cdad[_0xa204('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa204('0xa')](function(_0x51e78a){logger[_0xa204('0xb')](_0xa204('0x1e'),_0x441bbb);logger[_0xa204('0xe')](_0xa204('0x1e'),_0x441bbb,JSON[_0xa204('0xf')](_0x51e78a));_0x904f9e(_0x51e78a);})['catch'](function(_0xc738aa){logger[_0xa204('0x10')](_0xa204('0x1e'),_0xc738aa[_0xa204('0x12')],_0x441bbb);_0x17755c(_0xbc33ca['error'](0x1f4,_0xc738aa[_0xa204('0x12')]));});});};exports[_0xa204('0x21')]=function(_0x2578ce){var _0x3791cd=this;return new Promise(function(_0x1ca47a,_0x444a25){return db[_0xa204('0x1f')][_0xa204('0x22')](_0x2578ce['body'],{'raw':_0x2578ce[_0xa204('0x17')]?_0x2578ce[_0xa204('0x17')][_0xa204('0x18')]===undefined?!![]:![]:!![]})[_0xa204('0xa')](function(_0x229427){logger[_0xa204('0xb')](_0xa204('0x21'),_0x2578ce);logger[_0xa204('0xe')](_0xa204('0x21'),_0x2578ce,JSON[_0xa204('0xf')](_0x229427));_0x1ca47a(_0x229427);})[_0xa204('0x14')](function(_0x45ec78){logger[_0xa204('0x10')](_0xa204('0x21'),_0x45ec78[_0xa204('0x12')],_0x2578ce);_0x444a25(_0x3791cd['error'](0x1f4,_0x45ec78[_0xa204('0x12')]));});});};exports[_0xa204('0x23')]=function(_0x1fb5ce){var _0x1dad10=this;return new Promise(function(_0x45b23d,_0x366c0f){return db['CmHopper']['update'](_0x1fb5ce[_0xa204('0x24')],{'raw':_0x1fb5ce[_0xa204('0x17')]?_0x1fb5ce[_0xa204('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fb5ce[_0xa204('0x17')]?_0x1fb5ce[_0xa204('0x17')]['where']||null:null,'attributes':_0x1fb5ce['options']?_0x1fb5ce['options']['attributes']||null:null,'limit':_0x1fb5ce[_0xa204('0x17')]?_0x1fb5ce['options']['limit']||null:null})[_0xa204('0xa')](function(_0x418757){logger[_0xa204('0xb')](_0xa204('0x23'),_0x1fb5ce);logger[_0xa204('0xe')](_0xa204('0x23'),_0x1fb5ce,JSON[_0xa204('0xf')](_0x418757));_0x45b23d(_0x418757);})[_0xa204('0x14')](function(_0x1b2ee3){logger[_0xa204('0x10')]('UpdateCmHopper',_0x1b2ee3[_0xa204('0x12')],_0x1fb5ce);_0x366c0f(_0x1dad10[_0xa204('0x10')](0x1f4,_0x1b2ee3[_0xa204('0x12')]));});});};exports[_0xa204('0x25')]=function(_0x5845e4){var _0x2889da=this;return new Promise(function(_0x73eca1,_0xa50ab){return db['CmHopper'][_0xa204('0x26')]({'where':_0x5845e4[_0xa204('0x17')]?_0x5845e4[_0xa204('0x17')][_0xa204('0x20')]||null:null})[_0xa204('0xa')](function(_0x2b7cc8){logger[_0xa204('0xb')](_0xa204('0x25'),_0x5845e4);logger['debug'](_0xa204('0x25'),_0x5845e4,JSON[_0xa204('0xf')](_0x2b7cc8));_0x73eca1(_0x2b7cc8);})['catch'](function(_0x295cad){logger['error'](_0xa204('0x25'),_0x295cad[_0xa204('0x12')],_0x5845e4);_0xa50ab(_0x2889da[_0xa204('0x10')](0x1f4,_0x295cad[_0xa204('0x12')]));});});};exports[_0xa204('0x27')]=function(_0x2a1825){var _0x430369=this;return new Promise(function(_0x9b3b69,_0x454a6f){return db['CmContact']['describe']()[_0xa204('0xa')](function(_0x505ced){return db[_0xa204('0x28')][_0xa204('0x29')](function(_0x14f0b3){return db[_0xa204('0x1f')][_0xa204('0x16')]({'where':_0x2a1825[_0xa204('0x17')]?_0x2a1825[_0xa204('0x17')][_0xa204('0x20')]||null:null,'attributes':_0x2a1825[_0xa204('0x17')]?_0x2a1825[_0xa204('0x17')]['attributes']||null:null,'limit':_0x2a1825['options']?_0x2a1825['options']['limit']||null:null,'order':_0x2a1825['options']?_0x2a1825['options'][_0xa204('0x2a')]||null:null,'transaction':_0x14f0b3,'lock':_0x14f0b3[_0xa204('0x2b')][_0xa204('0x2c')],'include':[{'model':db['CmContact'],'as':_0xa204('0x2d'),'attributes':_[_0xa204('0x2e')](_0x505ced)},{'model':db['User'],'as':_0xa204('0x2f'),'attributes':['id',_0xa204('0x30'),'voicePause']}]})[_0xa204('0xa')](function(_0x404cec){var _0x1b0727=[];var _0x1a5d29=[];for(var _0x5be7bb=0x0;_0x5be7bb<_0x404cec['length'];_0x5be7bb+=0x1){var _0x14ae83=_0x404cec[_0x5be7bb][_0xa204('0x31')];if(_0x14ae83===null){_0x1b0727[_0xa204('0x32')](_0x404cec[_0x5be7bb][_0xa204('0x33')](_0x2a1825[_0xa204('0x24')],{'transaction':_0x14f0b3}));}else if(!_0x1a5d29['includes'](_0x14ae83)){_0x1a5d29[_0xa204('0x32')](_0x14ae83);_0x1b0727[_0xa204('0x32')](_0x404cec[_0x5be7bb][_0xa204('0x33')](_0x2a1825[_0xa204('0x24')],{'transaction':_0x14f0b3}));}}return BPromise[_0xa204('0x34')](_0x1b0727);});})['then'](function(_0x524759){logger[_0xa204('0xb')](_0xa204('0x27'),_0x2a1825);logger['debug']('GetContactDialer',_0x2a1825,JSON[_0xa204('0xf')](_0x524759));_0x9b3b69(_0x524759);})[_0xa204('0x14')](function(_0xad8932){logger[_0xa204('0x10')](_0xa204('0x27'),_0xad8932[_0xa204('0x12')],_0x2a1825);_0x454a6f(_0x430369[_0xa204('0x10')](0x1f4,_0xad8932[_0xa204('0x12')]));});});});};exports[_0xa204('0x35')]=function(_0x57e94d){var _0x378cf6=this;return new Promise(function(_0x54b9c7,_0x145047){return db[_0xa204('0x28')][_0xa204('0x29')](function(_0xe50e5d){return db[_0xa204('0x36')][_0xa204('0x22')](_0x57e94d[_0xa204('0x24')],{'raw':_0x57e94d[_0xa204('0x17')]?_0x57e94d[_0xa204('0x17')][_0xa204('0x18')]===undefined?!![]:![]:!![],'transaction':_0xe50e5d})[_0xa204('0xa')](function(){return db['CmHopper']['destroy']({'where':_0x57e94d[_0xa204('0x17')]?_0x57e94d[_0xa204('0x17')][_0xa204('0x20')]||null:null,'transaction':_0xe50e5d});});})[_0xa204('0xa')](function(_0xc0bd11){logger[_0xa204('0xb')]('MoveContactManagedDialer',_0x57e94d);logger[_0xa204('0xe')](_0xa204('0x35'),_0x57e94d,JSON[_0xa204('0xf')](_0xc0bd11));_0x54b9c7(_0xc0bd11);})[_0xa204('0x14')](function(_0x1b39ff){logger[_0xa204('0x10')](_0xa204('0x35'),_0x1b39ff['message'],_0x57e94d);_0x145047(_0x378cf6[_0xa204('0x10')](0x1f4,_0x1b39ff[_0xa204('0x12')]));});});};exports[_0xa204('0x37')]=function(_0x509519){var _0x247e98=this;return new Promise(function(_0x7e326b,_0x2b8c57){return db[_0xa204('0x1f')][_0xa204('0x16')]({'raw':_0x509519[_0xa204('0x17')]?_0x509519['options'][_0xa204('0x18')]===undefined?!![]:![]:!![],'where':_0x509519[_0xa204('0x17')]?_0x509519[_0xa204('0x17')][_0xa204('0x20')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xa204('0x28')]['fn']('IF',db[_0xa204('0x28')]['literal'](_0xa204('0x38')+util[_0xa204('0x39')](_0xa204('0x3a'),moment()[_0xa204('0x39')](_0xa204('0x3b')))+_0xa204('0x3c')))),'contactsRescheduled']]})['then'](function(_0x3c2d2d){logger['info']('CountReScheduled',_0x509519);logger[_0xa204('0xe')]('CountReScheduled',_0x509519,JSON['stringify'](_0x3c2d2d));_0x7e326b(_0x3c2d2d);})[_0xa204('0x14')](function(_0x4ffc92){logger['error']('CountReScheduled',_0x4ffc92[_0xa204('0x12')],_0x509519);_0x2b8c57(_0x247e98[_0xa204('0x10')](0x1f4,_0x4ffc92[_0xa204('0x12')]));});});};exports[_0xa204('0x3d')]=function(_0x3700a6){var _0x32c8ef=this;return new Promise(function(_0x323462,_0x3953df){return db[_0xa204('0x3e')][_0xa204('0x3f')]()['then'](function(_0x12b152){return db[_0xa204('0x28')][_0xa204('0x29')](function(_0x4845ab){return db['CmHopper']['findAll']({'where':_0x3700a6[_0xa204('0x17')]?_0x3700a6[_0xa204('0x17')]['where']||null:null,'attributes':_0x3700a6[_0xa204('0x17')]?_0x3700a6[_0xa204('0x17')]['attributes']||null:null,'limit':0x1,'order':_0x3700a6['options']?_0x3700a6[_0xa204('0x17')][_0xa204('0x2a')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x4845ab,'lock':_0x4845ab[_0xa204('0x2b')]['UPDATE'],'include':_0x3700a6[_0xa204('0x17')]?_0x3700a6[_0xa204('0x17')]['include']?_[_0xa204('0x1c')](_0x3700a6[_0xa204('0x17')][_0xa204('0x1b')],function(_0x15934d){return{'model':db[_0x15934d['model']],'as':_0x15934d['as'],'attributes':_0x15934d[_0xa204('0x19')],'include':_0x15934d[_0xa204('0x1b')]?_['map'](_0x15934d['include'],function(_0x2b29ea){return{'model':db[_0x2b29ea['model']],'as':_0x2b29ea['as'],'attributes':_0x2b29ea[_0xa204('0x19')],'include':_0x2b29ea[_0xa204('0x1b')]?_[_0xa204('0x1c')](_0x2b29ea[_0xa204('0x1b')],function(_0x3f5ed9){return{'model':db[_0x3f5ed9[_0xa204('0x1d')]],'as':_0x3f5ed9['as'],'attributes':_0x3f5ed9['attributes']};}):[]};}):[]};}):[]:[]})[_0xa204('0xa')](function(_0x4ea510){var _0x2c5f3e=[];for(var _0x29a78a=0x0;_0x29a78a<_0x4ea510[_0xa204('0x40')];_0x29a78a+=0x1){_0x2c5f3e['push'](_0x4ea510[_0x29a78a]['update'](_0x3700a6['body'],{'transaction':_0x4845ab}));}return BPromise['all'](_0x2c5f3e);});})[_0xa204('0xa')](function(_0x2294dd){logger['info'](_0xa204('0x3d'),_0x3700a6);logger[_0xa204('0xe')]('GetContactRecallMe',_0x3700a6,JSON['stringify'](_0x2294dd));_0x323462(_0x2294dd);})['catch'](function(_0x4bdc49){logger[_0xa204('0x10')]('GetContactRecallMe',_0x4bdc49[_0xa204('0x12')],_0x3700a6);_0x3953df(_0x32c8ef[_0xa204('0x10')](0x1f4,_0x4bdc49['message']));});});});};exports[_0xa204('0x41')]=function(_0x46cf87){var _0x471357=this;return new Promise(function(_0x95cdfb,_0x478330){db[_0xa204('0x3e')][_0xa204('0x3f')]()[_0xa204('0xa')](function(_0xf94682){return db[_0xa204('0x1f')][_0xa204('0x16')]({'raw':_0x46cf87['options']?_0x46cf87[_0xa204('0x17')][_0xa204('0x18')]===undefined?!![]:![]:!![],'where':_0x46cf87[_0xa204('0x17')]?_0x46cf87[_0xa204('0x17')][_0xa204('0x20')]||null:null,'attributes':_0x46cf87[_0xa204('0x17')]?_0x46cf87[_0xa204('0x17')]['attributes']||null:null,'limit':_0x46cf87['options']?_0x46cf87['options']['limit']||null:null,'include':_0x46cf87[_0xa204('0x17')]?_0x46cf87['options'][_0xa204('0x1b')]?_['map'](_0x46cf87[_0xa204('0x17')][_0xa204('0x1b')],function(_0x372041){return{'model':db[_0x372041[_0xa204('0x1d')]],'as':_0x372041['as'],'attributes':_0x372041['as']===_0xa204('0x2d')?_['keys'](_0xf94682):_0x372041['attributes'],'include':_0x372041[_0xa204('0x1b')]?_[_0xa204('0x1c')](_0x372041[_0xa204('0x1b')],function(_0x1600b6){return{'model':db[_0x1600b6[_0xa204('0x1d')]],'as':_0x1600b6['as'],'attributes':_0x1600b6[_0xa204('0x19')],'include':_0x1600b6['include']?_[_0xa204('0x1c')](_0x1600b6['include'],function(_0x4ef926){return{'model':db[_0x4ef926['model']],'as':_0x4ef926['as'],'attributes':_0x4ef926[_0xa204('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cbf59){logger['info']('GetCmHopper',_0x46cf87);logger[_0xa204('0xe')](_0xa204('0x15'),_0x46cf87,JSON['stringify'](_0x2cbf59));_0x95cdfb(_0x2cbf59);})[_0xa204('0x14')](function(_0x312e8){logger[_0xa204('0x10')]('GetCmHopper',_0x312e8[_0xa204('0x12')],_0x46cf87);_0x478330(_0x471357[_0xa204('0x10')](0x1f4,_0x312e8[_0xa204('0x12')]));});});});}; \ No newline at end of file +var _0x32fb=['jayson/promise','http','request','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','then','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','Contact','keys','User','Agent','voicePause','push','includes','all','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','length','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32fb,0x119));var _0xb32f=function(_0x1aa408,_0x1e337d){_0x1aa408=_0x1aa408-0x0;var _0x4c7273=_0x32fb[_0x1aa408];return _0x4c7273;};'use strict';var _=require(_0xb32f('0x0'));var util=require(_0xb32f('0x1'));var moment=require(_0xb32f('0x2'));var BPromise=require(_0xb32f('0x3'));var rs=require(_0xb32f('0x4'));var fs=require('fs');var Redis=require(_0xb32f('0x5'));var db=require(_0xb32f('0x6'))['db'];var utils=require(_0xb32f('0x7'));var logger=require(_0xb32f('0x8'))(_0xb32f('0x9'));var config=require(_0xb32f('0xa'));var jayson=require(_0xb32f('0xb'));var client=jayson['client'][_0xb32f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13c701,_0xb83097,_0x3240c0){return new BPromise(function(_0x118bc5,_0x55d5c8){return client[_0xb32f('0xd')](_0x13c701,_0x3240c0)['then'](function(_0xde407f){logger['info'](_0xb32f('0xe'),_0xb83097,_0xb32f('0xf'));logger[_0xb32f('0x10')](_0xb32f('0x11'),_0xb83097,_0xb32f('0xf'),JSON[_0xb32f('0x12')](_0xde407f));if(_0xde407f[_0xb32f('0x13')]){if(_0xde407f[_0xb32f('0x13')][_0xb32f('0x14')]===0x1f4){logger[_0xb32f('0x13')]('CmHopper,\x20%s,\x20%s',_0xb83097,_0xde407f[_0xb32f('0x13')][_0xb32f('0x15')]);return _0x55d5c8(_0xde407f['error'][_0xb32f('0x15')]);}logger[_0xb32f('0x13')]('CmHopper,\x20%s,\x20%s',_0xb83097,_0xde407f[_0xb32f('0x13')]['message']);return _0x118bc5(_0xde407f['error'][_0xb32f('0x15')]);}else{logger[_0xb32f('0x16')]('CmHopper,\x20%s,\x20%s',_0xb83097,'request\x20sent');_0x118bc5(_0xde407f['result'][_0xb32f('0x15')]);}})[_0xb32f('0x17')](function(_0x32d912){logger['error'](_0xb32f('0xe'),_0xb83097,_0x32d912);_0x55d5c8(_0x32d912);});});}exports[_0xb32f('0x18')]=function(_0x5b86c7){var _0x5a0bb2=this;return new Promise(function(_0x286c88,_0x4df51c){return db[_0xb32f('0x19')][_0xb32f('0x1a')]({'raw':_0x5b86c7['options']?_0x5b86c7[_0xb32f('0x1b')][_0xb32f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b86c7[_0xb32f('0x1b')]?_0x5b86c7[_0xb32f('0x1b')][_0xb32f('0x1d')]||null:null,'attributes':_0x5b86c7[_0xb32f('0x1b')]?_0x5b86c7[_0xb32f('0x1b')][_0xb32f('0x1e')]||null:null,'limit':_0x5b86c7[_0xb32f('0x1b')]?_0x5b86c7[_0xb32f('0x1b')][_0xb32f('0x1f')]||null:null,'include':_0x5b86c7[_0xb32f('0x1b')]?_0x5b86c7['options'][_0xb32f('0x20')]?_[_0xb32f('0x21')](_0x5b86c7[_0xb32f('0x1b')][_0xb32f('0x20')],function(_0x3f4e64){return{'model':db[_0x3f4e64[_0xb32f('0x22')]],'as':_0x3f4e64['as'],'attributes':_0x3f4e64[_0xb32f('0x1e')],'include':_0x3f4e64[_0xb32f('0x20')]?_[_0xb32f('0x21')](_0x3f4e64[_0xb32f('0x20')],function(_0x151463){return{'model':db[_0x151463[_0xb32f('0x22')]],'as':_0x151463['as'],'attributes':_0x151463[_0xb32f('0x1e')],'include':_0x151463[_0xb32f('0x20')]?_[_0xb32f('0x21')](_0x151463[_0xb32f('0x20')],function(_0x441b41){return{'model':db[_0x441b41[_0xb32f('0x22')]],'as':_0x441b41['as'],'attributes':_0x441b41[_0xb32f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c971d){logger[_0xb32f('0x16')](_0xb32f('0x18'),_0x5b86c7);logger['debug'](_0xb32f('0x18'),_0x5b86c7,JSON[_0xb32f('0x12')](_0x3c971d));_0x286c88(_0x3c971d);})['catch'](function(_0x492061){logger[_0xb32f('0x13')](_0xb32f('0x18'),_0x492061[_0xb32f('0x15')],_0x5b86c7);_0x4df51c(_0x5a0bb2[_0xb32f('0x13')](0x1f4,_0x492061['message']));});});};exports[_0xb32f('0x23')]=function(_0x536ff4){var _0x122258=this;return new Promise(function(_0x4a4631,_0xb5e12e){return db[_0xb32f('0x19')]['find']({'raw':_0x536ff4[_0xb32f('0x1b')]?_0x536ff4[_0xb32f('0x1b')][_0xb32f('0x1c')]===undefined?!![]:![]:!![],'where':_0x536ff4[_0xb32f('0x1b')]?_0x536ff4['options'][_0xb32f('0x1d')]||null:null,'attributes':_0x536ff4[_0xb32f('0x1b')]?_0x536ff4[_0xb32f('0x1b')]['attributes']||null:null,'include':_0x536ff4[_0xb32f('0x1b')]?_0x536ff4[_0xb32f('0x1b')][_0xb32f('0x20')]?_['map'](_0x536ff4['options'][_0xb32f('0x20')],function(_0xb55c31){return{'model':db[_0xb55c31[_0xb32f('0x22')]],'as':_0xb55c31['as'],'attributes':_0xb55c31[_0xb32f('0x1e')],'include':_0xb55c31[_0xb32f('0x20')]?_[_0xb32f('0x21')](_0xb55c31[_0xb32f('0x20')],function(_0x54dea){return{'model':db[_0x54dea[_0xb32f('0x22')]],'as':_0x54dea['as'],'attributes':_0x54dea[_0xb32f('0x1e')],'include':_0x54dea[_0xb32f('0x20')]?_['map'](_0x54dea[_0xb32f('0x20')],function(_0x37f1e5){return{'model':db[_0x37f1e5[_0xb32f('0x22')]],'as':_0x37f1e5['as'],'attributes':_0x37f1e5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb32f('0x24')](function(_0xa61963){logger[_0xb32f('0x16')](_0xb32f('0x23'),_0x536ff4);logger[_0xb32f('0x10')]('ShowCmHopper',_0x536ff4,JSON[_0xb32f('0x12')](_0xa61963));_0x4a4631(_0xa61963);})[_0xb32f('0x17')](function(_0x276c37){logger[_0xb32f('0x13')](_0xb32f('0x23'),_0x276c37[_0xb32f('0x15')],_0x536ff4);_0xb5e12e(_0x122258[_0xb32f('0x13')](0x1f4,_0x276c37['message']));});});};exports[_0xb32f('0x25')]=function(_0x2b78b5){var _0x4f9b40=this;return new Promise(function(_0x25b3c8,_0x525c1b){return db[_0xb32f('0x19')][_0xb32f('0x26')](_0x2b78b5[_0xb32f('0x27')],{'raw':_0x2b78b5[_0xb32f('0x1b')]?_0x2b78b5[_0xb32f('0x1b')][_0xb32f('0x1c')]===undefined?!![]:![]:!![]})[_0xb32f('0x24')](function(_0x25d091){logger[_0xb32f('0x16')](_0xb32f('0x25'),_0x2b78b5);logger[_0xb32f('0x10')](_0xb32f('0x25'),_0x2b78b5,JSON[_0xb32f('0x12')](_0x25d091));_0x25b3c8(_0x25d091);})[_0xb32f('0x17')](function(_0x37a97c){logger[_0xb32f('0x13')](_0xb32f('0x25'),_0x37a97c[_0xb32f('0x15')],_0x2b78b5);_0x525c1b(_0x4f9b40[_0xb32f('0x13')](0x1f4,_0x37a97c[_0xb32f('0x15')]));});});};exports[_0xb32f('0x28')]=function(_0x2d520b){var _0xbe546a=this;return new Promise(function(_0x4edbcf,_0x17ca1b){return db[_0xb32f('0x19')][_0xb32f('0x29')](_0x2d520b[_0xb32f('0x27')],{'raw':_0x2d520b[_0xb32f('0x1b')]?_0x2d520b[_0xb32f('0x1b')][_0xb32f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d520b[_0xb32f('0x1b')]?_0x2d520b[_0xb32f('0x1b')][_0xb32f('0x1d')]||null:null,'attributes':_0x2d520b[_0xb32f('0x1b')]?_0x2d520b[_0xb32f('0x1b')][_0xb32f('0x1e')]||null:null,'limit':_0x2d520b[_0xb32f('0x1b')]?_0x2d520b[_0xb32f('0x1b')][_0xb32f('0x1f')]||null:null})['then'](function(_0xe03639){logger[_0xb32f('0x16')](_0xb32f('0x28'),_0x2d520b);logger['debug'](_0xb32f('0x28'),_0x2d520b,JSON[_0xb32f('0x12')](_0xe03639));_0x4edbcf(_0xe03639);})[_0xb32f('0x17')](function(_0x32db39){logger[_0xb32f('0x13')](_0xb32f('0x28'),_0x32db39[_0xb32f('0x15')],_0x2d520b);_0x17ca1b(_0xbe546a[_0xb32f('0x13')](0x1f4,_0x32db39['message']));});});};exports[_0xb32f('0x2a')]=function(_0x2af085){var _0x25cabd=this;return new Promise(function(_0x40b1c4,_0x5b38e7){return db[_0xb32f('0x19')][_0xb32f('0x2b')]({'where':_0x2af085[_0xb32f('0x1b')]?_0x2af085[_0xb32f('0x1b')][_0xb32f('0x1d')]||null:null})['then'](function(_0x2d5804){logger[_0xb32f('0x16')](_0xb32f('0x2a'),_0x2af085);logger[_0xb32f('0x10')](_0xb32f('0x2a'),_0x2af085,JSON[_0xb32f('0x12')](_0x2d5804));_0x40b1c4(_0x2d5804);})[_0xb32f('0x17')](function(_0x3421e3){logger[_0xb32f('0x13')](_0xb32f('0x2a'),_0x3421e3[_0xb32f('0x15')],_0x2af085);_0x5b38e7(_0x25cabd[_0xb32f('0x13')](0x1f4,_0x3421e3[_0xb32f('0x15')]));});});};exports[_0xb32f('0x2c')]=function(_0x551272){var _0x597050=this;return new Promise(function(_0x4f0a28,_0x4113b6){return db[_0xb32f('0x2d')][_0xb32f('0x2e')]()[_0xb32f('0x24')](function(_0x42825c){return db[_0xb32f('0x2f')]['transaction'](function(_0x13bcab){return db[_0xb32f('0x19')][_0xb32f('0x1a')]({'where':_0x551272[_0xb32f('0x1b')]?_0x551272['options']['where']||null:null,'attributes':_0x551272[_0xb32f('0x1b')]?_0x551272[_0xb32f('0x1b')]['attributes']||null:null,'limit':_0x551272[_0xb32f('0x1b')]?_0x551272[_0xb32f('0x1b')][_0xb32f('0x1f')]||null:null,'order':_0x551272[_0xb32f('0x1b')]?_0x551272[_0xb32f('0x1b')][_0xb32f('0x30')]||null:null,'transaction':_0x13bcab,'lock':_0x13bcab[_0xb32f('0x31')]['UPDATE'],'include':[{'model':db[_0xb32f('0x2d')],'as':_0xb32f('0x32'),'attributes':_[_0xb32f('0x33')](_0x42825c)},{'model':db[_0xb32f('0x34')],'as':_0xb32f('0x35'),'attributes':['id','name',_0xb32f('0x36')]}]})[_0xb32f('0x24')](function(_0x415b51){var _0x247ee4=[];var _0xf217e6=[];for(var _0x42e1cd=0x0;_0x42e1cd<_0x415b51['length'];_0x42e1cd+=0x1){var _0x56774a=_0x415b51[_0x42e1cd]['UserId'];if(_0x56774a===null){_0x247ee4[_0xb32f('0x37')](_0x415b51[_0x42e1cd]['update'](_0x551272[_0xb32f('0x27')],{'transaction':_0x13bcab}));}else if(!_0xf217e6[_0xb32f('0x38')](_0x56774a)){_0xf217e6[_0xb32f('0x37')](_0x56774a);_0x247ee4[_0xb32f('0x37')](_0x415b51[_0x42e1cd][_0xb32f('0x29')](_0x551272[_0xb32f('0x27')],{'transaction':_0x13bcab}));}}return BPromise[_0xb32f('0x39')](_0x247ee4);});})['then'](function(_0x13f7df){logger[_0xb32f('0x16')](_0xb32f('0x2c'),_0x551272);logger[_0xb32f('0x10')](_0xb32f('0x2c'),_0x551272,JSON[_0xb32f('0x12')](_0x13f7df));_0x4f0a28(_0x13f7df);})[_0xb32f('0x17')](function(_0x4be030){logger['error'](_0xb32f('0x2c'),_0x4be030[_0xb32f('0x15')],_0x551272);_0x4113b6(_0x597050[_0xb32f('0x13')](0x1f4,_0x4be030[_0xb32f('0x15')]));});});});};exports[_0xb32f('0x3a')]=function(_0x5a7a5c){var _0x539e5e=this;return new Promise(function(_0x2376fb,_0x253d7a){return db[_0xb32f('0x2f')][_0xb32f('0x3b')](function(_0x15bc75){return db[_0xb32f('0x3c')][_0xb32f('0x26')](_0x5a7a5c[_0xb32f('0x27')],{'raw':_0x5a7a5c[_0xb32f('0x1b')]?_0x5a7a5c[_0xb32f('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x15bc75})['then'](function(){return db['CmHopper'][_0xb32f('0x2b')]({'where':_0x5a7a5c[_0xb32f('0x1b')]?_0x5a7a5c[_0xb32f('0x1b')][_0xb32f('0x1d')]||null:null,'transaction':_0x15bc75});});})['then'](function(_0x5ebfb2){logger[_0xb32f('0x16')](_0xb32f('0x3a'),_0x5a7a5c);logger['debug'](_0xb32f('0x3a'),_0x5a7a5c,JSON[_0xb32f('0x12')](_0x5ebfb2));_0x2376fb(_0x5ebfb2);})['catch'](function(_0x49d7e4){logger[_0xb32f('0x13')](_0xb32f('0x3a'),_0x49d7e4[_0xb32f('0x15')],_0x5a7a5c);_0x253d7a(_0x539e5e[_0xb32f('0x13')](0x1f4,_0x49d7e4[_0xb32f('0x15')]));});});};exports[_0xb32f('0x3d')]=function(_0xf573a2){var _0x4955c0=this;return new Promise(function(_0xf773e5,_0x113568){return db['CmHopper']['findAll']({'raw':_0xf573a2[_0xb32f('0x1b')]?_0xf573a2[_0xb32f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xf573a2[_0xb32f('0x1b')]?_0xf573a2['options'][_0xb32f('0x1d')]||null:null,'attributes':[[db[_0xb32f('0x2f')]['fn'](_0xb32f('0x3e'),db[_0xb32f('0x2f')]['fn']('IF',db[_0xb32f('0x2f')][_0xb32f('0x3f')](_0xb32f('0x40')+util[_0xb32f('0x41')](_0xb32f('0x42'),moment()[_0xb32f('0x41')](_0xb32f('0x43')))+'\x20,\x201,\x20null'))),_0xb32f('0x44')]]})[_0xb32f('0x24')](function(_0x474a85){logger[_0xb32f('0x16')](_0xb32f('0x3d'),_0xf573a2);logger[_0xb32f('0x10')]('CountReScheduled',_0xf573a2,JSON[_0xb32f('0x12')](_0x474a85));_0xf773e5(_0x474a85);})['catch'](function(_0x547774){logger[_0xb32f('0x13')]('CountReScheduled',_0x547774[_0xb32f('0x15')],_0xf573a2);_0x113568(_0x4955c0['error'](0x1f4,_0x547774[_0xb32f('0x15')]));});});};exports[_0xb32f('0x45')]=function(_0x24fbdf){var _0x668ce3=this;return new Promise(function(_0x2241e4,_0x5e4a85){return db[_0xb32f('0x2d')]['describe']()['then'](function(_0x49a5c9){return db['sequelize'][_0xb32f('0x3b')](function(_0x226a20){return db[_0xb32f('0x19')][_0xb32f('0x1a')]({'where':_0x24fbdf[_0xb32f('0x1b')]?_0x24fbdf[_0xb32f('0x1b')][_0xb32f('0x1d')]||null:null,'attributes':_0x24fbdf[_0xb32f('0x1b')]?_0x24fbdf[_0xb32f('0x1b')][_0xb32f('0x1e')]||null:null,'limit':0x1,'order':_0x24fbdf[_0xb32f('0x1b')]?_0x24fbdf['options'][_0xb32f('0x30')]||null:null,'group':db['CmHopper'][_0xb32f('0x46')],'transaction':_0x226a20,'lock':_0x226a20['LOCK']['UPDATE'],'include':_0x24fbdf[_0xb32f('0x1b')]?_0x24fbdf[_0xb32f('0x1b')][_0xb32f('0x20')]?_[_0xb32f('0x21')](_0x24fbdf['options'][_0xb32f('0x20')],function(_0x1b15a3){return{'model':db[_0x1b15a3['model']],'as':_0x1b15a3['as'],'attributes':_0x1b15a3[_0xb32f('0x1e')],'include':_0x1b15a3[_0xb32f('0x20')]?_[_0xb32f('0x21')](_0x1b15a3[_0xb32f('0x20')],function(_0x2ebedc){return{'model':db[_0x2ebedc[_0xb32f('0x22')]],'as':_0x2ebedc['as'],'attributes':_0x2ebedc[_0xb32f('0x1e')],'include':_0x2ebedc[_0xb32f('0x20')]?_[_0xb32f('0x21')](_0x2ebedc[_0xb32f('0x20')],function(_0x3fd525){return{'model':db[_0x3fd525[_0xb32f('0x22')]],'as':_0x3fd525['as'],'attributes':_0x3fd525[_0xb32f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb32f('0x24')](function(_0xafdba7){var _0xf51b74=[];for(var _0x403d36=0x0;_0x403d36<_0xafdba7[_0xb32f('0x47')];_0x403d36+=0x1){_0xf51b74[_0xb32f('0x37')](_0xafdba7[_0x403d36]['update'](_0x24fbdf[_0xb32f('0x27')],{'transaction':_0x226a20}));}return BPromise[_0xb32f('0x39')](_0xf51b74);});})[_0xb32f('0x24')](function(_0x286dfc){logger[_0xb32f('0x16')]('GetContactRecallMe',_0x24fbdf);logger[_0xb32f('0x10')]('GetContactRecallMe',_0x24fbdf,JSON[_0xb32f('0x12')](_0x286dfc));_0x2241e4(_0x286dfc);})[_0xb32f('0x17')](function(_0x6b0ddb){logger[_0xb32f('0x13')]('GetContactRecallMe',_0x6b0ddb[_0xb32f('0x15')],_0x24fbdf);_0x5e4a85(_0x668ce3[_0xb32f('0x13')](0x1f4,_0x6b0ddb[_0xb32f('0x15')]));});});});};exports[_0xb32f('0x48')]=function(_0x40c4c6){var _0x6c10ef=this;return new Promise(function(_0x5c3612,_0x6ba4f3){db[_0xb32f('0x2d')]['describe']()[_0xb32f('0x24')](function(_0xab8a2){return db[_0xb32f('0x19')][_0xb32f('0x1a')]({'raw':_0x40c4c6[_0xb32f('0x1b')]?_0x40c4c6['options'][_0xb32f('0x1c')]===undefined?!![]:![]:!![],'where':_0x40c4c6[_0xb32f('0x1b')]?_0x40c4c6['options']['where']||null:null,'attributes':_0x40c4c6[_0xb32f('0x1b')]?_0x40c4c6[_0xb32f('0x1b')][_0xb32f('0x1e')]||null:null,'limit':_0x40c4c6[_0xb32f('0x1b')]?_0x40c4c6[_0xb32f('0x1b')]['limit']||null:null,'include':_0x40c4c6[_0xb32f('0x1b')]?_0x40c4c6['options'][_0xb32f('0x20')]?_['map'](_0x40c4c6[_0xb32f('0x1b')]['include'],function(_0xfb7c89){return{'model':db[_0xfb7c89[_0xb32f('0x22')]],'as':_0xfb7c89['as'],'attributes':_0xfb7c89['as']==='Contact'?_['keys'](_0xab8a2):_0xfb7c89[_0xb32f('0x1e')],'include':_0xfb7c89[_0xb32f('0x20')]?_['map'](_0xfb7c89[_0xb32f('0x20')],function(_0x463416){return{'model':db[_0x463416[_0xb32f('0x22')]],'as':_0x463416['as'],'attributes':_0x463416['attributes'],'include':_0x463416['include']?_[_0xb32f('0x21')](_0x463416[_0xb32f('0x20')],function(_0x29e19b){return{'model':db[_0x29e19b[_0xb32f('0x22')]],'as':_0x29e19b['as'],'attributes':_0x29e19b[_0xb32f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b4f0a){logger[_0xb32f('0x16')](_0xb32f('0x18'),_0x40c4c6);logger[_0xb32f('0x10')](_0xb32f('0x18'),_0x40c4c6,JSON[_0xb32f('0x12')](_0x4b4f0a));_0x5c3612(_0x4b4f0a);})[_0xb32f('0x17')](function(_0x45b4a7){logger[_0xb32f('0x13')]('GetCmHopper',_0x45b4a7[_0xb32f('0x15')],_0x40c4c6);_0x6ba4f3(_0x6c10ef['error'](0x1f4,_0x45b4a7[_0xb32f('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f191025..e243e68 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 _0x6b2a=['show','post','/preview','getPreview','update','delete','exports','multer','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/:id'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6b2a,0xeb));var _0xa6b2=function(_0x1e2d54,_0x295ef1){_0x1e2d54=_0x1e2d54-0x0;var _0x457203=_0x6b2a[_0x1e2d54];return _0x457203;};'use strict';var multer=require(_0xa6b2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa6b2('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xa6b2('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa6b2('0x3'));var controller=require(_0xa6b2('0x4'));router[_0xa6b2('0x5')]('/',auth[_0xa6b2('0x6')](),controller['index']);router[_0xa6b2('0x5')](_0xa6b2('0x7'),auth[_0xa6b2('0x6')](),controller[_0xa6b2('0x8')]);router[_0xa6b2('0x5')](_0xa6b2('0x9'),auth[_0xa6b2('0x6')](),controller[_0xa6b2('0xa')]);router[_0xa6b2('0x5')](_0xa6b2('0xb'),auth[_0xa6b2('0x6')](),controller[_0xa6b2('0xc')]);router[_0xa6b2('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6b2('0xd')](_0xa6b2('0xe'),auth[_0xa6b2('0x6')](),controller[_0xa6b2('0xf')]);router['put'](_0xa6b2('0xb'),auth[_0xa6b2('0x6')](),controller[_0xa6b2('0x10')]);router[_0xa6b2('0x11')](_0xa6b2('0xb'),auth[_0xa6b2('0x6')](),controller['destroy']);module[_0xa6b2('0x12')]=router; \ No newline at end of file +var _0x1835=['get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','show','post','/preview','getPreview','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopper.controller'];(function(_0x22f91d,_0x139cc0){var _0x37360c=function(_0x44fe76){while(--_0x44fe76){_0x22f91d['push'](_0x22f91d['shift']());}};_0x37360c(++_0x139cc0);}(_0x1835,0x196));var _0x5183=function(_0x3a032b,_0x59610e){_0x3a032b=_0x3a032b-0x0;var _0x49a77f=_0x1835[_0x3a032b];return _0x49a77f;};'use strict';var multer=require(_0x5183('0x0'));var util=require(_0x5183('0x1'));var path=require('path');var timeout=require(_0x5183('0x2'));var express=require(_0x5183('0x3'));var router=express[_0x5183('0x4')]();var fs_extra=require(_0x5183('0x5'));var auth=require(_0x5183('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5183('0x7'));router[_0x5183('0x8')]('/',auth[_0x5183('0x9')](),controller['index']);router['get'](_0x5183('0xa'),auth['isAuthenticated'](),controller[_0x5183('0xb')]);router[_0x5183('0x8')](_0x5183('0xc'),auth['isAuthenticated'](),controller[_0x5183('0xd')]);router[_0x5183('0x8')]('/:id',auth[_0x5183('0x9')](),controller[_0x5183('0xe')]);router[_0x5183('0xf')]('/',auth[_0x5183('0x9')](),controller['create']);router['post'](_0x5183('0x10'),auth[_0x5183('0x9')](),controller[_0x5183('0x11')]);router['put'](_0x5183('0x12'),auth[_0x5183('0x9')](),controller[_0x5183('0x13')]);router[_0x5183('0x14')](_0x5183('0x12'),auth[_0x5183('0x9')](),controller[_0x5183('0x15')]);module[_0x5183('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c9bab8e..9b480a6 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 _0xa29a=['INTEGER','contactListQueue','moment','STRING'];(function(_0x3e12fe,_0x21cfdb){var _0x4211e4=function(_0x29b0f9){while(--_0x29b0f9){_0x3e12fe['push'](_0x3e12fe['shift']());}};_0x4211e4(++_0x21cfdb);}(_0xa29a,0x1ee));var _0xaa29=function(_0x5485a,_0x357d97){_0x5485a=_0x5485a-0x0;var _0x6e60ba=_0xa29a[_0x5485a];return _0x6e60ba;};'use strict';var moment=require(_0xaa29('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xaa29('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xaa29('0x2')],'unique':_0xaa29('0x3')},'ListId':{'type':Sequelize[_0xaa29('0x2')],'unique':_0xaa29('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x3912=['sequelize','STRING','INTEGER','contactListQueue','moment'];(function(_0x4953c4,_0x319911){var _0x1f5b35=function(_0x1df404){while(--_0x1df404){_0x4953c4['push'](_0x4953c4['shift']());}};_0x1f5b35(++_0x319911);}(_0x3912,0xa9));var _0x2391=function(_0x59a5aa,_0x19b0fc){_0x59a5aa=_0x59a5aa-0x0;var _0x392329=_0x3912[_0x59a5aa];return _0x392329;};'use strict';var moment=require(_0x2391('0x0'));var Sequelize=require(_0x2391('0x1'));module['exports']={'phone':{'type':Sequelize[_0x2391('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2391('0x3')],'unique':_0x2391('0x4')},'ListId':{'type':Sequelize[_0x2391('0x3')],'unique':_0x2391('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2391('0x3')],'unique':_0x2391('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 12cbab3..140316f 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 _0xc75f=['save','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperBlack','catch','includeAll','find','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc75f,0xb8));var _0xfc75=function(_0x3d881c,_0x1e9bbe){_0x3d881c=_0x3d881c-0x0;var _0x2b0676=_0xc75f[_0x3d881c];return _0x2b0676;};'use strict';var emlformat=require(_0xfc75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc75('0x1'));var jsonpatch=require(_0xfc75('0x2'));var rp=require('request-promise');var moment=require(_0xfc75('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfc75('0x4'));var util=require(_0xfc75('0x5'));var path=require(_0xfc75('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfc75('0x7'));var fs=require('fs');var fs_extra=require(_0xfc75('0x8'));var _=require('lodash');var squel=require(_0xfc75('0x9'));var crypto=require(_0xfc75('0xa'));var jsforce=require(_0xfc75('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc75('0xc'));var Papa=require(_0xfc75('0xd'));var Redis=require(_0xfc75('0xe'));var authService=require(_0xfc75('0xf'));var qs=require(_0xfc75('0x10'));var as=require(_0xfc75('0x11'));var hardwareService=require(_0xfc75('0x12'));var logger=require(_0xfc75('0x13'))('api');var utils=require(_0xfc75('0x14'));var config=require(_0xfc75('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc75('0x16'))['db'];function respondWithStatusCode(_0x5bdd6d,_0x5eb497){_0x5eb497=_0x5eb497||0xcc;return function(_0x41beed){if(_0x41beed){return _0x5bdd6d[_0xfc75('0x17')](_0x5eb497);}return _0x5bdd6d[_0xfc75('0x18')](_0x5eb497)[_0xfc75('0x19')]();};}function respondWithResult(_0xc426,_0x1ff5a7){_0x1ff5a7=_0x1ff5a7||0xc8;return function(_0xd7aff9){if(_0xd7aff9){return _0xc426[_0xfc75('0x18')](_0x1ff5a7)[_0xfc75('0x1a')](_0xd7aff9);}};}function respondWithFilteredResult(_0x2a10dc,_0x3cdac5){return function(_0x432ad5){if(_0x432ad5){var _0xb2d034=typeof _0x3cdac5[_0xfc75('0x1b')]===_0xfc75('0x1c')&&typeof _0x3cdac5[_0xfc75('0x1d')]===_0xfc75('0x1c');var _0x330c6a=_0x432ad5[_0xfc75('0x1e')];var _0x3e27bf=_0xb2d034?0x0:_0x3cdac5['offset'];var _0x1bd7e5=_0xb2d034?_0x432ad5[_0xfc75('0x1e')]:_0x3cdac5[_0xfc75('0x1b')]+_0x3cdac5[_0xfc75('0x1d')];var _0x51bd1a;if(_0x1bd7e5>=_0x330c6a){_0x1bd7e5=_0x330c6a;_0x51bd1a=0xc8;}else{_0x51bd1a=0xce;}_0x2a10dc['status'](_0x51bd1a);return _0x2a10dc[_0xfc75('0x1f')](_0xfc75('0x20'),_0x3e27bf+'-'+_0x1bd7e5+'/'+_0x330c6a)[_0xfc75('0x1a')](_0x432ad5);}return null;};}function patchUpdates(_0x4d1c75){return function(_0x22527d){try{jsonpatch[_0xfc75('0x21')](_0x22527d,_0x4d1c75,!![]);}catch(_0x477a84){return BPromise[_0xfc75('0x22')](_0x477a84);}return _0x22527d[_0xfc75('0x23')]();};}function saveUpdates(_0x4b7eaf,_0x31d266){return function(_0x358907){if(_0x358907){return _0x358907[_0xfc75('0x24')](_0x4b7eaf)['then'](function(_0x239d29){return _0x239d29;});}return null;};}function removeEntity(_0x139991,_0x4a4aea){return function(_0x49c282){if(_0x49c282){return _0x49c282[_0xfc75('0x25')]()[_0xfc75('0x26')](function(){_0x139991[_0xfc75('0x18')](0xcc)[_0xfc75('0x19')]();});}};}function handleEntityNotFound(_0x3ff682,_0x2d78c9){return function(_0x1c5709){if(!_0x1c5709){_0x3ff682[_0xfc75('0x17')](0x194);}return _0x1c5709;};}function handleError(_0x3530d6,_0x319b6a){_0x319b6a=_0x319b6a||0x1f4;return function(_0x4128f7){logger[_0xfc75('0x27')](_0x4128f7['stack']);if(_0x4128f7[_0xfc75('0x28')]){delete _0x4128f7['name'];}_0x3530d6[_0xfc75('0x18')](_0x319b6a)[_0xfc75('0x29')](_0x4128f7);};}exports[_0xfc75('0x2a')]=function(_0x24b044,_0x2ae0fe){var _0x2d5944={},_0x3d25f8={},_0x5619ac={'count':0x0,'rows':[]};var _0x327f11=_[_0xfc75('0x2b')](db['CmHopperBlack'][_0xfc75('0x2c')],function(_0x5ef725){return{'name':_0x5ef725[_0xfc75('0x2d')],'type':_0x5ef725[_0xfc75('0x2e')][_0xfc75('0x2f')]};});_0x3d25f8[_0xfc75('0x30')]=_[_0xfc75('0x2b')](_0x327f11,_0xfc75('0x28'));_0x3d25f8[_0xfc75('0x31')]=_[_0xfc75('0x32')](_0x24b044[_0xfc75('0x31')]);_0x3d25f8[_0xfc75('0x33')]=_['intersection'](_0x3d25f8[_0xfc75('0x30')],_0x3d25f8[_0xfc75('0x31')]);_0x2d5944[_0xfc75('0x34')]=_[_0xfc75('0x35')](_0x3d25f8[_0xfc75('0x30')],qs[_0xfc75('0x36')](_0x24b044[_0xfc75('0x31')]['fields']));_0x2d5944['attributes']=_0x2d5944['attributes'][_0xfc75('0x37')]?_0x2d5944[_0xfc75('0x34')]:_0x3d25f8[_0xfc75('0x30')];if(!_0x24b044[_0xfc75('0x31')][_0xfc75('0x38')](_0xfc75('0x39'))){_0x2d5944['limit']=qs[_0xfc75('0x1d')](_0x24b044[_0xfc75('0x31')][_0xfc75('0x1d')]);_0x2d5944[_0xfc75('0x1b')]=qs[_0xfc75('0x1b')](_0x24b044[_0xfc75('0x31')][_0xfc75('0x1b')]);}_0x2d5944[_0xfc75('0x3a')]=qs[_0xfc75('0x3b')](_0x24b044[_0xfc75('0x31')][_0xfc75('0x3b')]);_0x2d5944[_0xfc75('0x3c')]=qs['filters'](_[_0xfc75('0x3d')](_0x24b044[_0xfc75('0x31')],_0x3d25f8[_0xfc75('0x33')]),_0x327f11);if(_0x24b044[_0xfc75('0x31')]['filter']){_0x2d5944['where']=_[_0xfc75('0x3e')](_0x2d5944[_0xfc75('0x3c')],{'$or':_[_0xfc75('0x2b')](_0x327f11,function(_0x30525b){if(_0x30525b['type']!==_0xfc75('0x3f')){var _0x53a951={};_0x53a951[_0x30525b[_0xfc75('0x28')]]={'$like':'%'+_0x24b044[_0xfc75('0x31')][_0xfc75('0x40')]+'%'};return _0x53a951;}})});}_0x2d5944=_['merge']({},_0x2d5944,_0x24b044[_0xfc75('0x41')]);var _0xcf0379={'where':_0x2d5944['where']};return db[_0xfc75('0x42')]['count'](_0xcf0379)['then'](function(_0x1e5729){_0x5619ac[_0xfc75('0x1e')]=_0x1e5729;if(_0x24b044['query']['includeAll']){_0x2d5944['include']=[{'all':!![]}];}return db[_0xfc75('0x42')]['findAll'](_0x2d5944);})['then'](function(_0x40897c){_0x5619ac['rows']=_0x40897c;return _0x5619ac;})[_0xfc75('0x26')](respondWithFilteredResult(_0x2ae0fe,_0x2d5944))[_0xfc75('0x43')](handleError(_0x2ae0fe,null));};exports['show']=function(_0x3a5752,_0x5c31a1){var _0xe7b42c={'raw':!![],'where':{'id':_0x3a5752['params']['id']}},_0x1c85b0={};_0x1c85b0[_0xfc75('0x30')]=_[_0xfc75('0x32')](db['CmHopperBlack'][_0xfc75('0x2c')]);_0x1c85b0['query']=_['keys'](_0x3a5752[_0xfc75('0x31')]);_0x1c85b0['filters']=_[_0xfc75('0x35')](_0x1c85b0[_0xfc75('0x30')],_0x1c85b0[_0xfc75('0x31')]);_0xe7b42c[_0xfc75('0x34')]=_['intersection'](_0x1c85b0[_0xfc75('0x30')],qs['fields'](_0x3a5752[_0xfc75('0x31')][_0xfc75('0x36')]));_0xe7b42c[_0xfc75('0x34')]=_0xe7b42c[_0xfc75('0x34')]['length']?_0xe7b42c[_0xfc75('0x34')]:_0x1c85b0['model'];if(_0x3a5752[_0xfc75('0x31')][_0xfc75('0x44')]){_0xe7b42c['include']=[{'all':!![]}];}_0xe7b42c=_[_0xfc75('0x3e')]({},_0xe7b42c,_0x3a5752['options']);return db['CmHopperBlack'][_0xfc75('0x45')](_0xe7b42c)['then'](handleEntityNotFound(_0x5c31a1,null))['then'](respondWithResult(_0x5c31a1,null))[_0xfc75('0x43')](handleError(_0x5c31a1,null));};exports[_0xfc75('0x24')]=function(_0x3d4e5d,_0x4b31f7){if(_0x3d4e5d[_0xfc75('0x46')]['id']){delete _0x3d4e5d['body']['id'];}return db[_0xfc75('0x42')]['find']({'where':{'id':_0x3d4e5d[_0xfc75('0x47')]['id']}})[_0xfc75('0x26')](handleEntityNotFound(_0x4b31f7,null))['then'](saveUpdates(_0x3d4e5d['body'],null))[_0xfc75('0x26')](respondWithResult(_0x4b31f7,null))['catch'](handleError(_0x4b31f7,null));};exports[_0xfc75('0x25')]=function(_0x236f7c,_0x3c58c1){return db[_0xfc75('0x42')][_0xfc75('0x45')]({'where':{'id':_0x236f7c[_0xfc75('0x47')]['id']}})[_0xfc75('0x26')](handleEntityNotFound(_0x3c58c1,null))[_0xfc75('0x26')](removeEntity(_0x3c58c1,null))[_0xfc75('0x43')](handleError(_0x3c58c1,null));};exports[_0xfc75('0x48')]=function(_0x3d8ef5,_0xff09da){return db[_0xfc75('0x42')][_0xfc75('0x48')]()[_0xfc75('0x26')](respondWithResult(_0xff09da,null))[_0xfc75('0x43')](handleError(_0xff09da,null));}; \ No newline at end of file +var _0x85d0=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','CmHopperBlack','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','find','body','params','destroy','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','Content-Range','json','apply','reject','save','update','then','name','index','map','fieldName','model','query','keys','filters','attributes','intersection'];(function(_0x241cd4,_0xa30993){var _0x192414=function(_0x51d584){while(--_0x51d584){_0x241cd4['push'](_0x241cd4['shift']());}};_0x192414(++_0xa30993);}(_0x85d0,0x145));var _0x085d=function(_0x1ae960,_0x2d86e0){_0x1ae960=_0x1ae960-0x0;var _0x51a77d=_0x85d0[_0x1ae960];return _0x51a77d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x085d('0x0'));var jsonpatch=require(_0x085d('0x1'));var rp=require('request-promise');var moment=require(_0x085d('0x2'));var BPromise=require(_0x085d('0x3'));var Mustache=require(_0x085d('0x4'));var util=require('util');var path=require(_0x085d('0x5'));var sox=require(_0x085d('0x6'));var csv=require(_0x085d('0x7'));var ejs=require(_0x085d('0x8'));var fs=require('fs');var fs_extra=require(_0x085d('0x9'));var _=require('lodash');var squel=require(_0x085d('0xa'));var crypto=require(_0x085d('0xb'));var jsforce=require(_0x085d('0xc'));var deskjs=require(_0x085d('0xd'));var toCsv=require(_0x085d('0x7'));var querystring=require(_0x085d('0xe'));var Papa=require(_0x085d('0xf'));var Redis=require(_0x085d('0x10'));var authService=require(_0x085d('0x11'));var qs=require(_0x085d('0x12'));var as=require(_0x085d('0x13'));var hardwareService=require(_0x085d('0x14'));var logger=require(_0x085d('0x15'))(_0x085d('0x16'));var utils=require(_0x085d('0x17'));var config=require(_0x085d('0x18'));var licenseUtil=require(_0x085d('0x19'));var db=require(_0x085d('0x1a'))['db'];function respondWithStatusCode(_0x7f8361,_0x5e1af0){_0x5e1af0=_0x5e1af0||0xcc;return function(_0x46e921){if(_0x46e921){return _0x7f8361[_0x085d('0x1b')](_0x5e1af0);}return _0x7f8361[_0x085d('0x1c')](_0x5e1af0)[_0x085d('0x1d')]();};}function respondWithResult(_0x2b2e62,_0x353573){_0x353573=_0x353573||0xc8;return function(_0x5eae07){if(_0x5eae07){return _0x2b2e62[_0x085d('0x1c')](_0x353573)['json'](_0x5eae07);}};}function respondWithFilteredResult(_0x5b4776,_0x47eeb5){return function(_0x4a5334){if(_0x4a5334){var _0x2a3c48=typeof _0x47eeb5[_0x085d('0x1e')]==='undefined'&&typeof _0x47eeb5['limit']==='undefined';var _0xd2d17e=_0x4a5334['count'];var _0x14719a=_0x2a3c48?0x0:_0x47eeb5['offset'];var _0xef813b=_0x2a3c48?_0x4a5334[_0x085d('0x1f')]:_0x47eeb5['offset']+_0x47eeb5[_0x085d('0x20')];var _0x362205;if(_0xef813b>=_0xd2d17e){_0xef813b=_0xd2d17e;_0x362205=0xc8;}else{_0x362205=0xce;}_0x5b4776[_0x085d('0x1c')](_0x362205);return _0x5b4776['set'](_0x085d('0x21'),_0x14719a+'-'+_0xef813b+'/'+_0xd2d17e)[_0x085d('0x22')](_0x4a5334);}return null;};}function patchUpdates(_0x583315){return function(_0x4ea01b){try{jsonpatch[_0x085d('0x23')](_0x4ea01b,_0x583315,!![]);}catch(_0x3921ee){return BPromise[_0x085d('0x24')](_0x3921ee);}return _0x4ea01b[_0x085d('0x25')]();};}function saveUpdates(_0x426e38,_0x3214d2){return function(_0x580ca5){if(_0x580ca5){return _0x580ca5[_0x085d('0x26')](_0x426e38)[_0x085d('0x27')](function(_0x4faf73){return _0x4faf73;});}return null;};}function removeEntity(_0x5f01dc,_0x1b50cb){return function(_0x56408e){if(_0x56408e){return _0x56408e['destroy']()[_0x085d('0x27')](function(){_0x5f01dc[_0x085d('0x1c')](0xcc)[_0x085d('0x1d')]();});}};}function handleEntityNotFound(_0xd35320,_0x5d38b8){return function(_0x3330c9){if(!_0x3330c9){_0xd35320[_0x085d('0x1b')](0x194);}return _0x3330c9;};}function handleError(_0x3726a2,_0x5eb32c){_0x5eb32c=_0x5eb32c||0x1f4;return function(_0x215d32){logger['error'](_0x215d32['stack']);if(_0x215d32[_0x085d('0x28')]){delete _0x215d32['name'];}_0x3726a2[_0x085d('0x1c')](_0x5eb32c)['send'](_0x215d32);};}exports[_0x085d('0x29')]=function(_0x2ab7bd,_0x3cfbe4){var _0x5b5682={},_0x409efa={},_0x356ada={'count':0x0,'rows':[]};var _0x4f876a=_[_0x085d('0x2a')](db['CmHopperBlack']['rawAttributes'],function(_0x5c1466){return{'name':_0x5c1466[_0x085d('0x2b')],'type':_0x5c1466['type']['key']};});_0x409efa[_0x085d('0x2c')]=_[_0x085d('0x2a')](_0x4f876a,_0x085d('0x28'));_0x409efa[_0x085d('0x2d')]=_[_0x085d('0x2e')](_0x2ab7bd[_0x085d('0x2d')]);_0x409efa[_0x085d('0x2f')]=_['intersection'](_0x409efa[_0x085d('0x2c')],_0x409efa['query']);_0x5b5682[_0x085d('0x30')]=_[_0x085d('0x31')](_0x409efa[_0x085d('0x2c')],qs['fields'](_0x2ab7bd['query']['fields']));_0x5b5682[_0x085d('0x30')]=_0x5b5682['attributes'][_0x085d('0x32')]?_0x5b5682[_0x085d('0x30')]:_0x409efa[_0x085d('0x2c')];if(!_0x2ab7bd[_0x085d('0x2d')][_0x085d('0x33')](_0x085d('0x34'))){_0x5b5682[_0x085d('0x20')]=qs['limit'](_0x2ab7bd['query'][_0x085d('0x20')]);_0x5b5682[_0x085d('0x1e')]=qs[_0x085d('0x1e')](_0x2ab7bd['query'][_0x085d('0x1e')]);}_0x5b5682[_0x085d('0x35')]=qs[_0x085d('0x36')](_0x2ab7bd[_0x085d('0x2d')][_0x085d('0x36')]);_0x5b5682[_0x085d('0x37')]=qs[_0x085d('0x2f')](_[_0x085d('0x38')](_0x2ab7bd[_0x085d('0x2d')],_0x409efa['filters']),_0x4f876a);if(_0x2ab7bd[_0x085d('0x2d')][_0x085d('0x39')]){_0x5b5682[_0x085d('0x37')]=_[_0x085d('0x3a')](_0x5b5682['where'],{'$or':_[_0x085d('0x2a')](_0x4f876a,function(_0x331c0a){if(_0x331c0a[_0x085d('0x3b')]!=='VIRTUAL'){var _0x92bfed={};_0x92bfed[_0x331c0a[_0x085d('0x28')]]={'$like':'%'+_0x2ab7bd['query'][_0x085d('0x39')]+'%'};return _0x92bfed;}})});}_0x5b5682=_[_0x085d('0x3a')]({},_0x5b5682,_0x2ab7bd[_0x085d('0x3c')]);var _0x4f7145={'where':_0x5b5682[_0x085d('0x37')]};return db[_0x085d('0x3d')]['count'](_0x4f7145)['then'](function(_0x10c8b9){_0x356ada[_0x085d('0x1f')]=_0x10c8b9;if(_0x2ab7bd[_0x085d('0x2d')]['includeAll']){_0x5b5682['include']=[{'all':!![]}];}return db[_0x085d('0x3d')][_0x085d('0x3e')](_0x5b5682);})[_0x085d('0x27')](function(_0x3e9843){_0x356ada[_0x085d('0x3f')]=_0x3e9843;return _0x356ada;})[_0x085d('0x27')](respondWithFilteredResult(_0x3cfbe4,_0x5b5682))[_0x085d('0x40')](handleError(_0x3cfbe4,null));};exports[_0x085d('0x41')]=function(_0x250a49,_0x26aa22){var _0x380b8e={'raw':!![],'where':{'id':_0x250a49['params']['id']}},_0x585f49={};_0x585f49[_0x085d('0x2c')]=_[_0x085d('0x2e')](db[_0x085d('0x3d')][_0x085d('0x42')]);_0x585f49[_0x085d('0x2d')]=_['keys'](_0x250a49[_0x085d('0x2d')]);_0x585f49['filters']=_[_0x085d('0x31')](_0x585f49[_0x085d('0x2c')],_0x585f49[_0x085d('0x2d')]);_0x380b8e[_0x085d('0x30')]=_[_0x085d('0x31')](_0x585f49[_0x085d('0x2c')],qs[_0x085d('0x43')](_0x250a49[_0x085d('0x2d')][_0x085d('0x43')]));_0x380b8e[_0x085d('0x30')]=_0x380b8e[_0x085d('0x30')][_0x085d('0x32')]?_0x380b8e[_0x085d('0x30')]:_0x585f49[_0x085d('0x2c')];if(_0x250a49[_0x085d('0x2d')][_0x085d('0x44')]){_0x380b8e[_0x085d('0x45')]=[{'all':!![]}];}_0x380b8e=_[_0x085d('0x3a')]({},_0x380b8e,_0x250a49[_0x085d('0x3c')]);return db[_0x085d('0x3d')][_0x085d('0x46')](_0x380b8e)[_0x085d('0x27')](handleEntityNotFound(_0x26aa22,null))[_0x085d('0x27')](respondWithResult(_0x26aa22,null))['catch'](handleError(_0x26aa22,null));};exports[_0x085d('0x26')]=function(_0x5a5fd7,_0x4f35cc){if(_0x5a5fd7[_0x085d('0x47')]['id']){delete _0x5a5fd7['body']['id'];}return db[_0x085d('0x3d')][_0x085d('0x46')]({'where':{'id':_0x5a5fd7[_0x085d('0x48')]['id']}})[_0x085d('0x27')](handleEntityNotFound(_0x4f35cc,null))['then'](saveUpdates(_0x5a5fd7[_0x085d('0x47')],null))['then'](respondWithResult(_0x4f35cc,null))[_0x085d('0x40')](handleError(_0x4f35cc,null));};exports[_0x085d('0x49')]=function(_0x3c3e03,_0x16c0d5){return db[_0x085d('0x3d')][_0x085d('0x46')]({'where':{'id':_0x3c3e03[_0x085d('0x48')]['id']}})[_0x085d('0x27')](handleEntityNotFound(_0x16c0d5,null))[_0x085d('0x27')](removeEntity(_0x16c0d5,null))[_0x085d('0x40')](handleError(_0x16c0d5,null));};exports[_0x085d('0x4a')]=function(_0x41c2ae,_0x3b4258){return db[_0x085d('0x3d')][_0x085d('0x4a')]()[_0x085d('0x27')](respondWithResult(_0x3b4258,null))['catch'](handleError(_0x3b4258,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 8195fd7..b2644c5 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 _0xdde4=['moment','path','../../config/environment','exports','CmHopperBlack','util','../../config/logger'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xdde4,0xad));var _0x4dde=function(_0x406025,_0x2c946c){_0x406025=_0x406025-0x0;var _0x23f3c8=_0xdde4[_0x406025];return _0x23f3c8;};'use strict';var _=require('lodash');var util=require(_0x4dde('0x0'));var logger=require(_0x4dde('0x1'))('api');var moment=require(_0x4dde('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dde('0x3'));var rimraf=require('rimraf');var config=require(_0x4dde('0x4'));var attributes=require('./cmHopperBlack.attributes');module[_0x4dde('0x5')]=function(_0x48ed49,_0x48bd91){return _0x48ed49['define'](_0x4dde('0x6'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdabb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdabb,0x1dc));var _0xbdab=function(_0x179a45,_0x4ab8fe){_0x179a45=_0x179a45-0x0;var _0x55685=_0xdabb[_0x179a45];return _0x55685;};'use strict';var _=require(_0xbdab('0x0'));var util=require(_0xbdab('0x1'));var logger=require(_0xbdab('0x2'))(_0xbdab('0x3'));var moment=require(_0xbdab('0x4'));var BPromise=require(_0xbdab('0x5'));var rp=require(_0xbdab('0x6'));var fs=require('fs');var path=require(_0xbdab('0x7'));var rimraf=require(_0xbdab('0x8'));var config=require(_0xbdab('0x9'));var attributes=require(_0xbdab('0xa'));module['exports']=function(_0x4b494e,_0xf0d8d5){return _0x4b494e[_0xbdab('0xb')](_0xbdab('0xc'),attributes,{'tableName':_0xbdab('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 3a11169..a01047b 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 _0xe756=['../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CmHopperBlack','findAll','raw','options','where','limit','include','model','attributes','map','GetCmHopperBlack','UpdateCmHopperBlack','update','body','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x23651b,_0x5741ae){var _0xd5c714=function(_0x1d5b0d){while(--_0x1d5b0d){_0x23651b['push'](_0x23651b['shift']());}};_0xd5c714(++_0x5741ae);}(_0xe756,0x1e7));var _0x6e75=function(_0x3b3f90,_0x388364){_0x3b3f90=_0x3b3f90-0x0;var _0x52522e=_0xe756[_0x3b3f90];return _0x52522e;};'use strict';var _=require(_0x6e75('0x0'));var util=require(_0x6e75('0x1'));var moment=require(_0x6e75('0x2'));var BPromise=require(_0x6e75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e75('0x4'))['db'];var utils=require(_0x6e75('0x5'));var logger=require('../../config/logger')(_0x6e75('0x6'));var config=require(_0x6e75('0x7'));var jayson=require(_0x6e75('0x8'));var client=jayson[_0x6e75('0x9')][_0x6e75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe95b34,_0x2a82e0,_0x486dd7){return new BPromise(function(_0x48e43a,_0x1a02af){return client[_0x6e75('0xb')](_0xe95b34,_0x486dd7)[_0x6e75('0xc')](function(_0x553fbe){logger['info'](_0x6e75('0xd'),_0x2a82e0,_0x6e75('0xe'));logger[_0x6e75('0xf')](_0x6e75('0x10'),_0x2a82e0,_0x6e75('0xe'),JSON[_0x6e75('0x11')](_0x553fbe));if(_0x553fbe[_0x6e75('0x12')]){if(_0x553fbe[_0x6e75('0x12')]['code']===0x1f4){logger[_0x6e75('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2a82e0,_0x553fbe[_0x6e75('0x12')]['message']);return _0x1a02af(_0x553fbe[_0x6e75('0x12')]['message']);}logger['error'](_0x6e75('0xd'),_0x2a82e0,_0x553fbe[_0x6e75('0x12')][_0x6e75('0x13')]);return _0x48e43a(_0x553fbe[_0x6e75('0x12')][_0x6e75('0x13')]);}else{logger[_0x6e75('0x14')](_0x6e75('0xd'),_0x2a82e0,_0x6e75('0xe'));_0x48e43a(_0x553fbe['result'][_0x6e75('0x13')]);}})[_0x6e75('0x15')](function(_0x4624ef){logger[_0x6e75('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2a82e0,_0x4624ef);_0x1a02af(_0x4624ef);});});}exports['GetCmHopperBlack']=function(_0x50b734){var _0x3c1ebe=this;return new Promise(function(_0x967b94,_0x4325b2){return db[_0x6e75('0x16')][_0x6e75('0x17')]({'raw':_0x50b734['options']?_0x50b734['options'][_0x6e75('0x18')]===undefined?!![]:![]:!![],'where':_0x50b734[_0x6e75('0x19')]?_0x50b734[_0x6e75('0x19')][_0x6e75('0x1a')]||null:null,'attributes':_0x50b734[_0x6e75('0x19')]?_0x50b734[_0x6e75('0x19')]['attributes']||null:null,'limit':_0x50b734['options']?_0x50b734[_0x6e75('0x19')][_0x6e75('0x1b')]||null:null,'include':_0x50b734[_0x6e75('0x19')]?_0x50b734[_0x6e75('0x19')][_0x6e75('0x1c')]?_['map'](_0x50b734[_0x6e75('0x19')][_0x6e75('0x1c')],function(_0x459ccd){return{'model':db[_0x459ccd[_0x6e75('0x1d')]],'as':_0x459ccd['as'],'attributes':_0x459ccd[_0x6e75('0x1e')],'include':_0x459ccd[_0x6e75('0x1c')]?_[_0x6e75('0x1f')](_0x459ccd[_0x6e75('0x1c')],function(_0x98d240){return{'model':db[_0x98d240[_0x6e75('0x1d')]],'as':_0x98d240['as'],'attributes':_0x98d240[_0x6e75('0x1e')],'include':_0x98d240[_0x6e75('0x1c')]?_[_0x6e75('0x1f')](_0x98d240[_0x6e75('0x1c')],function(_0x414101){return{'model':db[_0x414101[_0x6e75('0x1d')]],'as':_0x414101['as'],'attributes':_0x414101['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e75('0xc')](function(_0x4cabed){logger['info'](_0x6e75('0x20'),_0x50b734);logger['debug'](_0x6e75('0x20'),_0x50b734,JSON[_0x6e75('0x11')](_0x4cabed));_0x967b94(_0x4cabed);})[_0x6e75('0x15')](function(_0x40fd7f){logger[_0x6e75('0x12')](_0x6e75('0x20'),_0x40fd7f[_0x6e75('0x13')],_0x50b734);_0x4325b2(_0x3c1ebe[_0x6e75('0x12')](0x1f4,_0x40fd7f[_0x6e75('0x13')]));});});};exports[_0x6e75('0x21')]=function(_0x5082be){var _0x1afe01=this;return new Promise(function(_0x4e860,_0x1a8eff){return db[_0x6e75('0x16')][_0x6e75('0x22')](_0x5082be[_0x6e75('0x23')],{'raw':_0x5082be[_0x6e75('0x19')]?_0x5082be[_0x6e75('0x19')][_0x6e75('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5082be['options']?_0x5082be[_0x6e75('0x19')][_0x6e75('0x1a')]||null:null,'attributes':_0x5082be[_0x6e75('0x19')]?_0x5082be['options'][_0x6e75('0x1e')]||null:null,'limit':_0x5082be[_0x6e75('0x19')]?_0x5082be[_0x6e75('0x19')][_0x6e75('0x1b')]||null:null})['then'](function(_0x3273a7){logger[_0x6e75('0x14')](_0x6e75('0x21'),_0x5082be);logger[_0x6e75('0xf')](_0x6e75('0x21'),_0x5082be,JSON['stringify'](_0x3273a7));_0x4e860(_0x3273a7);})[_0x6e75('0x15')](function(_0x5a69b5){logger['error']('UpdateCmHopperBlack',_0x5a69b5['message'],_0x5082be);_0x1a8eff(_0x1afe01[_0x6e75('0x12')](0x1f4,_0x5a69b5[_0x6e75('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x3a45ed){var _0x55d20d=this;return new Promise(function(_0x1b3357,_0x56d209){return db[_0x6e75('0x16')][_0x6e75('0x24')]({'where':_0x3a45ed[_0x6e75('0x19')]?_0x3a45ed['options'][_0x6e75('0x1a')]||null:null})[_0x6e75('0xc')](function(_0x50a76d){logger[_0x6e75('0x14')](_0x6e75('0x25'),_0x3a45ed);logger[_0x6e75('0xf')](_0x6e75('0x25'),_0x3a45ed,JSON[_0x6e75('0x11')](_0x50a76d));_0x1b3357(_0x50a76d);})[_0x6e75('0x15')](function(_0x15aec3){logger[_0x6e75('0x12')](_0x6e75('0x25'),_0x15aec3['message'],_0x3a45ed);_0x56d209(_0x55d20d[_0x6e75('0x12')](0x1f4,_0x15aec3['message']));});});}; \ No newline at end of file +var _0xf552=['request','then','request\x20sent','debug','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','raw','limit','include','map','attributes','info','stringify','UpdateCmHopperBlack','CmHopperBlack','update','where','destroy','DestroyCmHopperBlack','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0xc33db7,_0x59d048){var _0x3bf1ed=function(_0x2804cc){while(--_0x2804cc){_0xc33db7['push'](_0xc33db7['shift']());}};_0x3bf1ed(++_0x59d048);}(_0xf552,0x14b));var _0x2f55=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0xf552[_0x3f94f9];return _0x46f84f;};'use strict';var _=require(_0x2f55('0x0'));var util=require(_0x2f55('0x1'));var moment=require(_0x2f55('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f55('0x4'))['db'];var utils=require(_0x2f55('0x5'));var logger=require('../../config/logger')(_0x2f55('0x6'));var config=require(_0x2f55('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2f55('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aba43,_0x1366c3,_0x262e7e){return new BPromise(function(_0x3f6288,_0x12fad8){return client[_0x2f55('0x9')](_0x3aba43,_0x262e7e)[_0x2f55('0xa')](function(_0x4a51d4){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x1366c3,_0x2f55('0xb'));logger[_0x2f55('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1366c3,_0x2f55('0xb'),JSON['stringify'](_0x4a51d4));if(_0x4a51d4[_0x2f55('0xd')]){if(_0x4a51d4[_0x2f55('0xd')]['code']===0x1f4){logger[_0x2f55('0xd')](_0x2f55('0xe'),_0x1366c3,_0x4a51d4[_0x2f55('0xd')]['message']);return _0x12fad8(_0x4a51d4[_0x2f55('0xd')][_0x2f55('0xf')]);}logger[_0x2f55('0xd')](_0x2f55('0xe'),_0x1366c3,_0x4a51d4[_0x2f55('0xd')][_0x2f55('0xf')]);return _0x3f6288(_0x4a51d4[_0x2f55('0xd')][_0x2f55('0xf')]);}else{logger['info'](_0x2f55('0xe'),_0x1366c3,_0x2f55('0xb'));_0x3f6288(_0x4a51d4[_0x2f55('0x10')][_0x2f55('0xf')]);}})[_0x2f55('0x11')](function(_0x3f21d2){logger[_0x2f55('0xd')](_0x2f55('0xe'),_0x1366c3,_0x3f21d2);_0x12fad8(_0x3f21d2);});});}exports[_0x2f55('0x12')]=function(_0x5689c4){var _0xb0e9ca=this;return new Promise(function(_0x41c949,_0x497a9c){return db['CmHopperBlack'][_0x2f55('0x13')]({'raw':_0x5689c4[_0x2f55('0x14')]?_0x5689c4['options'][_0x2f55('0x15')]===undefined?!![]:![]:!![],'where':_0x5689c4['options']?_0x5689c4[_0x2f55('0x14')]['where']||null:null,'attributes':_0x5689c4[_0x2f55('0x14')]?_0x5689c4[_0x2f55('0x14')]['attributes']||null:null,'limit':_0x5689c4['options']?_0x5689c4[_0x2f55('0x14')][_0x2f55('0x16')]||null:null,'include':_0x5689c4[_0x2f55('0x14')]?_0x5689c4[_0x2f55('0x14')][_0x2f55('0x17')]?_[_0x2f55('0x18')](_0x5689c4[_0x2f55('0x14')]['include'],function(_0x1efacb){return{'model':db[_0x1efacb['model']],'as':_0x1efacb['as'],'attributes':_0x1efacb[_0x2f55('0x19')],'include':_0x1efacb[_0x2f55('0x17')]?_[_0x2f55('0x18')](_0x1efacb[_0x2f55('0x17')],function(_0x867d8e){return{'model':db[_0x867d8e['model']],'as':_0x867d8e['as'],'attributes':_0x867d8e[_0x2f55('0x19')],'include':_0x867d8e[_0x2f55('0x17')]?_[_0x2f55('0x18')](_0x867d8e[_0x2f55('0x17')],function(_0x145832){return{'model':db[_0x145832['model']],'as':_0x145832['as'],'attributes':_0x145832[_0x2f55('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24b625){logger[_0x2f55('0x1a')](_0x2f55('0x12'),_0x5689c4);logger['debug']('GetCmHopperBlack',_0x5689c4,JSON[_0x2f55('0x1b')](_0x24b625));_0x41c949(_0x24b625);})['catch'](function(_0x241ef4){logger[_0x2f55('0xd')](_0x2f55('0x12'),_0x241ef4[_0x2f55('0xf')],_0x5689c4);_0x497a9c(_0xb0e9ca[_0x2f55('0xd')](0x1f4,_0x241ef4['message']));});});};exports[_0x2f55('0x1c')]=function(_0x50b978){var _0x14a2d2=this;return new Promise(function(_0x2c14ea,_0x59218a){return db[_0x2f55('0x1d')][_0x2f55('0x1e')](_0x50b978['body'],{'raw':_0x50b978[_0x2f55('0x14')]?_0x50b978['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50b978[_0x2f55('0x14')]?_0x50b978[_0x2f55('0x14')][_0x2f55('0x1f')]||null:null,'attributes':_0x50b978[_0x2f55('0x14')]?_0x50b978[_0x2f55('0x14')][_0x2f55('0x19')]||null:null,'limit':_0x50b978[_0x2f55('0x14')]?_0x50b978['options'][_0x2f55('0x16')]||null:null})[_0x2f55('0xa')](function(_0x1ddda2){logger['info'](_0x2f55('0x1c'),_0x50b978);logger['debug']('UpdateCmHopperBlack',_0x50b978,JSON[_0x2f55('0x1b')](_0x1ddda2));_0x2c14ea(_0x1ddda2);})['catch'](function(_0x44d40e){logger[_0x2f55('0xd')](_0x2f55('0x1c'),_0x44d40e[_0x2f55('0xf')],_0x50b978);_0x59218a(_0x14a2d2['error'](0x1f4,_0x44d40e[_0x2f55('0xf')]));});});};exports['DestroyCmHopperBlack']=function(_0x1e143f){var _0x35d02e=this;return new Promise(function(_0x27cdb8,_0x28d357){return db[_0x2f55('0x1d')][_0x2f55('0x20')]({'where':_0x1e143f[_0x2f55('0x14')]?_0x1e143f['options'][_0x2f55('0x1f')]||null:null})[_0x2f55('0xa')](function(_0x2e9ee9){logger['info'](_0x2f55('0x21'),_0x1e143f);logger[_0x2f55('0xc')](_0x2f55('0x21'),_0x1e143f,JSON[_0x2f55('0x1b')](_0x2e9ee9));_0x27cdb8(_0x2e9ee9);})[_0x2f55('0x11')](function(_0x5cc167){logger[_0x2f55('0xd')](_0x2f55('0x21'),_0x5cc167[_0x2f55('0xf')],_0x1e143f);_0x28d357(_0x35d02e['error'](0x1f4,_0x5cc167[_0x2f55('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index eade4b2..3b08ab9 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 _0x687b=['isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x26ac67,_0x1626d9){var _0x2240af=function(_0x180c62){while(--_0x180c62){_0x26ac67['push'](_0x26ac67['shift']());}};_0x2240af(++_0x1626d9);}(_0x687b,0x14a));var _0xb687=function(_0x29d530,_0x5da0d7){_0x29d530=_0x29d530-0x0;var _0x242905=_0x687b[_0x29d530];return _0x242905;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller[_0xb687('0x11')]);router[_0xb687('0x12')](_0xb687('0x10'),auth[_0xb687('0xa')](),controller['destroy']);module[_0xb687('0x13')]=router; \ No newline at end of file +var _0x5496=['../../config/environment','./cmHopperBlack.controller','index','get','isAuthenticated','describe','show','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x4bbbf1,_0x1b5b25){var _0x20ee84=function(_0x42b9ba){while(--_0x42b9ba){_0x4bbbf1['push'](_0x4bbbf1['shift']());}};_0x20ee84(++_0x1b5b25);}(_0x5496,0x175));var _0x6549=function(_0x5378f2,_0x2810eb){_0x5378f2=_0x5378f2-0x0;var _0x4f2044=_0x5496[_0x5378f2];return _0x4f2044;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/describe',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')](_0x6549('0xf'),auth[_0x6549('0xb')](),controller[_0x6549('0x10')]);router['delete']('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0x11')]);module[_0x6549('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 94dbbd1..d0722d2 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 _0xeb35=['setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff'];(function(_0x115ce4,_0x1cf310){var _0x3f0a54=function(_0x2f7584){while(--_0x2f7584){_0x115ce4['push'](_0x115ce4['shift']());}};_0x3f0a54(++_0x1cf310);}(_0xeb35,0x1f1));var _0x5eb3=function(_0x89381e,_0x1cd321){_0x89381e=_0x89381e-0x0;var _0xcac9d=_0xeb35[_0x89381e];return _0xcac9d;};'use strict';var Sequelize=require(_0x5eb3('0x0'));var moment=require(_0x5eb3('0x1'));module[_0x5eb3('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5eb3('0x4')]},'originatecalleridname':{'type':Sequelize[_0x5eb3('0x4')]},'calleridnum':{'type':Sequelize[_0x5eb3('0x4')]},'calleridname':{'type':Sequelize[_0x5eb3('0x4')]},'starttime':{'type':Sequelize[_0x5eb3('0x5')]},'responsetime':{'type':Sequelize[_0x5eb3('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5eb3('0x4')]},'campaign':{'type':Sequelize[_0x5eb3('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5eb3('0x4')]},'reason':{'type':Sequelize[_0x5eb3('0x4')]},'disposition':{'type':Sequelize[_0x5eb3('0x4')]},'secondDisposition':{'type':Sequelize[_0x5eb3('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5eb3('0x4')]},'dispositionat':{'type':Sequelize[_0x5eb3('0x5')],'set':function(_0x155623){var _0xcbe785=this[_0x5eb3('0x6')](_0x5eb3('0x7'));if(_0xcbe785&&_0x155623){this['setDataValue'](_0x5eb3('0x8'),moment(_0x155623)[_0x5eb3('0x9')](moment(_0xcbe785),'seconds'));}return this[_0x5eb3('0xa')](_0x5eb3('0xb'),_0x155623);}},'amd':{'type':Sequelize[_0x5eb3('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5eb3('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5eb3('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5eb3('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5eb3('0x5')]},'callback':{'type':Sequelize[_0x5eb3('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5eb3('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5eb3('0x5')]},'deleted':{'type':Sequelize[_0x5eb3('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5eb3('0x5')]},'recallme':{'type':Sequelize[_0x5eb3('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5eb3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4d7e=['getDataValue','setDataValue','diff','seconds','dispositionat','BOOLEAN','moment','STRING','DATE','INTEGER'];(function(_0x19c2bf,_0x4a819f){var _0x3525c8=function(_0x1736f7){while(--_0x1736f7){_0x19c2bf['push'](_0x19c2bf['shift']());}};_0x3525c8(++_0x4a819f);}(_0x4d7e,0xba));var _0xe4d7=function(_0x39346a,_0x5c3ed1){_0x39346a=_0x39346a-0x0;var _0x335564=_0x4d7e[_0x39346a];return _0x335564;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe4d7('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xe4d7('0x1')]},'scheduledat':{'type':Sequelize[_0xe4d7('0x2')]},'countbusyretry':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe4d7('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xe4d7('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe4d7('0x1')]},'starttime':{'type':Sequelize[_0xe4d7('0x2')]},'responsetime':{'type':Sequelize[_0xe4d7('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe4d7('0x2')]},'endtime':{'type':Sequelize[_0xe4d7('0x2')]},'ringtime':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe4d7('0x1')]},'campaign':{'type':Sequelize[_0xe4d7('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe4d7('0x1')]},'reason':{'type':Sequelize[_0xe4d7('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe4d7('0x1')]},'thirdDisposition':{'type':Sequelize[_0xe4d7('0x1')]},'dispositionat':{'type':Sequelize[_0xe4d7('0x2')],'set':function(_0x3e2c23){var _0x2f3483=this[_0xe4d7('0x4')]('endtime');if(_0x2f3483&&_0x3e2c23){this[_0xe4d7('0x5')]('followuptime',moment(_0x3e2c23)[_0xe4d7('0x6')](moment(_0x2f3483),_0xe4d7('0x7')));}return this[_0xe4d7('0x5')](_0xe4d7('0x8'),_0x3e2c23);}},'amd':{'type':Sequelize[_0xe4d7('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe4d7('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe4d7('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe4d7('0x2')]},'callback':{'type':Sequelize[_0xe4d7('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe4d7('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe4d7('0x2')]},'deleted':{'type':Sequelize[_0xe4d7('0x1')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe4d7('0x2')]},'recallme':{'type':Sequelize[_0xe4d7('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe4d7('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe4d7('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 397df04..b18d8d1 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 _0x90b1=['uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','CmHopperFinal','includeAll','rows','include','find','catch','update','body'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0x90b1,0x1bb));var _0x190b=function(_0x4366e1,_0x312378){_0x4366e1=_0x4366e1-0x0;var _0x265f9b=_0x90b1[_0x4366e1];return _0x265f9b;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['CmHopperFinal'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['describe']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['describe']()[_0x190b('0x22')](respondWithResult(_0xadc789,null))[_0x190b('0x42')](handleError(_0xadc789,null));};exports[_0x190b('0x43')]=function(_0x505e52,_0x4cb561){if(_0x505e52[_0x190b('0x44')][_0x190b('0x45')]){delete _0x505e52[_0x190b('0x44')][_0x190b('0x45')];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'uniqueid':_0x505e52['params']['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x4cb561,null))[_0x190b('0x22')](saveUpdates(_0x505e52[_0x190b('0x44')],null))['then'](respondWithResult(_0x4cb561,null))[_0x190b('0x42')](handleError(_0x4cb561,null));};exports[_0x190b('0x46')]=function(_0x215ab6,_0x503700,_0xbc6757){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x215ab6[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db['sequelize']['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),_0x190b('0x50')],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0x503700,null))[_0x190b('0x22')](respondWithResult(_0x503700,null))['catch'](handleError(_0x503700,null));};exports[_0x190b('0x58')]=function(_0x270b59,_0xffe7cb,_0x405e04){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'CampaignId':_0x270b59[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x59')))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),'busyContacts'],[db[_0x190b('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x190b('0x5a')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x5b')))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0xffe7cb,null))['then'](respondWithResult(_0xffe7cb,null))[_0x190b('0x42')](handleError(_0xffe7cb,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2495c9,_0x348beb,_0x360d39){return db[_0x190b('0x5c')]['find']({'where':{'id':_0x2495c9[_0x190b('0x48')]['id']}})['then'](handleEntityNotFound(_0x348beb,null))[_0x190b('0x22')](function(_0x5073d2){var _0x49b60c;if(_0x5073d2){_0x49b60c=squel[_0x190b('0x5d')]()['into'](_0x190b('0x5e'))[_0x190b('0x5f')]([_0x190b('0x60'),_0x190b('0x61'),_0x190b('0x62'),'ListId',_0x190b('0x63'),_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),'phone')[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))['field'](_0x190b('0x69'),_0x190b('0x62'))[_0x190b('0x66')](_0x190b('0x6a'),'ListId')[_0x190b('0x66')](_0x190b('0x6b'),_0x190b('0x63'))['field'](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')]('NOW()',_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']())[_0x190b('0x3a')](_0x190b('0x6f'),_0x2495c9['body'][_0x190b('0x70')][_0x190b('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x190b('0x3a')](_0x190b('0x72'),squel['select']()['field'](_0x190b('0x60'))[_0x190b('0x6c')](_0x190b('0x5e'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']()))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9[_0x190b('0x48')]['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')]['query'](_0x49b60c);}return[];})['then'](respondWithResult(_0x348beb,null))[_0x190b('0x42')](handleError(_0x348beb,null));};exports[_0x190b('0x76')]=function(_0x4b988d,_0x40ac95,_0x18c5f4){return db[_0x190b('0x77')]['find']({'where':{'id':_0x4b988d[_0x190b('0x48')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x40ac95,null))['then'](function(_0x23298e){var _0x2ba27b;if(_0x23298e){_0x2ba27b=squel['insert']()[_0x190b('0x78')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x190b('0x62'),_0x190b('0x79'),'CampaignId',_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),_0x190b('0x60'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))[_0x190b('0x66')](_0x190b('0x69'),_0x190b('0x62'))['field'](_0x190b('0x6a'),'ListId')['field'](_0x190b('0x7a'),_0x190b('0x7b'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x6f'),_0x4b988d[_0x190b('0x44')][_0x190b('0x70')][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x7d'))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x60'))['from'](_0x190b('0x5e'))[_0x190b('0x3a')]('CampaignId\x20=\x20?',_0x4b988d['params']['id'][_0x190b('0x71')]()))[_0x190b('0x3a')](_0x190b('0x72'),squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')][_0x190b('0x2d')](_0x2ba27b);}return[];})[_0x190b('0x22')](respondWithResult(_0x40ac95,null))[_0x190b('0x42')](handleError(_0x40ac95,null));};exports['checkContactHopper']=function(_0x476c86,_0x298824,_0x5e7c76){return db[_0x190b('0x7e')][_0x190b('0x7f')]({'where':{'VoiceQueueId':_0x476c86[_0x190b('0x44')][_0x190b('0x63')],'CampaignId':_0x476c86[_0x190b('0x44')][_0x190b('0x7b')],'ContactId':_0x476c86[_0x190b('0x44')][_0x190b('0x62')]}})['then'](handleEntityNotFound(_0x298824,null))[_0x190b('0x22')](function(_0x1b3168){if(_0x1b3168){return _0x1b3168;}return null;})[_0x190b('0x22')](respondWithResult(_0x298824,null))[_0x190b('0x42')](handleError(_0x298824,null));}; \ No newline at end of file +var _0xafc4=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','CmHopperFinal','includeAll','catch','show','params','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ContactId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','Campaign','fromQuery','CampaignId','CampaignId\x20=\x20?','group','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x35f249,_0x13144d){var _0x42e29a=function(_0x395c1f){while(--_0x395c1f){_0x35f249['push'](_0x35f249['shift']());}};_0x42e29a(++_0x13144d);}(_0xafc4,0x69));var _0x4afc=function(_0x2c47e6,_0x5aba0){_0x2c47e6=_0x2c47e6-0x0;var _0x4022b3=_0xafc4[_0x2c47e6];return _0x4022b3;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['CmHopperFinal'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':!![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x19a0ac,null))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x42e274,_0x269c24){if(_0x42e274[_0x4afc('0x43')][_0x4afc('0x44')]){delete _0x42e274[_0x4afc('0x43')][_0x4afc('0x44')];}return db[_0x4afc('0x3d')][_0x4afc('0x45')]({'where':{'uniqueid':_0x42e274['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x269c24,null))['then'](saveUpdates(_0x42e274['body'],null))[_0x4afc('0x25')](respondWithResult(_0x269c24,null))['catch'](handleError(_0x269c24,null));};exports[_0x4afc('0x46')]=function(_0x355198,_0x2fe2ae,_0x2cafc3){return db['CmHopperFinal'][_0x4afc('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x355198['params']['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x4afc('0x4d')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x4afc('0x50')],[db['sequelize']['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x51')))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x53')))),_0x4afc('0x54')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})[_0x4afc('0x25')](handleEntityNotFound(_0x2fe2ae,null))[_0x4afc('0x25')](respondWithResult(_0x2fe2ae,null))[_0x4afc('0x3f')](handleError(_0x2fe2ae,null));};exports[_0x4afc('0x57')]=function(_0x4985c6,_0x1771e8,_0x323c65){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x4985c6[_0x4afc('0x41')]['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x58')))),'noAnswerContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db['sequelize']['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x59')))),_0x4afc('0x50')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x5a')))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})['then'](handleEntityNotFound(_0x1771e8,null))[_0x4afc('0x25')](respondWithResult(_0x1771e8,null))[_0x4afc('0x3f')](handleError(_0x1771e8,null));};exports[_0x4afc('0x5b')]=function(_0x392252,_0x1f652a,_0x481263){return db['VoiceQueue'][_0x4afc('0x45')]({'where':{'id':_0x392252[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x1f652a,null))['then'](function(_0x380c56){var _0x14a216;if(_0x380c56){_0x14a216=squel[_0x4afc('0x5c')]()[_0x4afc('0x5d')](_0x4afc('0x5e'))['fromQuery']([_0x4afc('0x5f'),_0x4afc('0x60'),'ContactId',_0x4afc('0x61'),_0x4afc('0x62'),_0x4afc('0x63'),'updatedAt'],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))['field']('ANY_VALUE(ListId)',_0x4afc('0x61'))[_0x4afc('0x65')](_0x4afc('0x69'),'VoiceQueueId')['field'](_0x4afc('0x67'),_0x4afc('0x63'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x6a'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x392252[_0x4afc('0x43')][_0x4afc('0x70')][_0x4afc('0x6e')]())['where'](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))[_0x4afc('0x37')]('VoiceQueueId\x20=\x20?',_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x74')))['group'](_0x4afc('0x68')))[_0x4afc('0x6e')]();return db['sequelize'][_0x4afc('0x2d')](_0x14a216);}return[];})[_0x4afc('0x25')](respondWithResult(_0x1f652a,null))[_0x4afc('0x3f')](handleError(_0x1f652a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1c3d20,_0x3478aa,_0x24553b){return db[_0x4afc('0x75')]['find']({'where':{'id':_0x1c3d20[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x3478aa,null))['then'](function(_0x2dc8a1){var _0x36f3ea;if(_0x2dc8a1){_0x36f3ea=squel[_0x4afc('0x5c')]()['into']('cm_hopper')[_0x4afc('0x76')]([_0x4afc('0x5f'),_0x4afc('0x60'),_0x4afc('0x68'),_0x4afc('0x61'),_0x4afc('0x77'),_0x4afc('0x63'),_0x4afc('0x6a')],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))[_0x4afc('0x65')]('ANY_VALUE(ListId)',_0x4afc('0x61'))['field']('ANY_VALUE(CampaignId)',_0x4afc('0x77'))['field']('NOW()',_0x4afc('0x63'))['field'](_0x4afc('0x67'),'updatedAt')[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x1c3d20['body']['state'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))['where'](_0x4afc('0x78'),_0x1c3d20['params']['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')]('state\x20=\x204'))[_0x4afc('0x79')]('ContactId'))['toString']();return db[_0x4afc('0x48')]['query'](_0x36f3ea);}return[];})['then'](respondWithResult(_0x3478aa,null))[_0x4afc('0x3f')](handleError(_0x3478aa,null));};exports['checkContactHopper']=function(_0x272e36,_0x24bf53,_0x5b1421){return db[_0x4afc('0x7a')][_0x4afc('0x7b')]({'where':{'VoiceQueueId':_0x272e36['body'][_0x4afc('0x62')],'CampaignId':_0x272e36[_0x4afc('0x43')][_0x4afc('0x77')],'ContactId':_0x272e36['body'][_0x4afc('0x68')]}})[_0x4afc('0x25')](handleEntityNotFound(_0x24bf53,null))[_0x4afc('0x25')](function(_0x16eb6d){if(_0x16eb6d){return _0x16eb6d;}return null;})[_0x4afc('0x25')](respondWithResult(_0x24bf53,null))[_0x4afc('0x3f')](handleError(_0x24bf53,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 820e66a..5436aa0 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 _0x221e=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x451f45,_0x26ade3){var _0x2a7888=function(_0x1f545b){while(--_0x1f545b){_0x451f45['push'](_0x451f45['shift']());}};_0x2a7888(++_0x26ade3);}(_0x221e,0xb2));var _0xe221=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x221e[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xe221('0x0'));var util=require(_0xe221('0x1'));var logger=require(_0xe221('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe221('0x3'));var rp=require(_0xe221('0x4'));var fs=require('fs');var path=require(_0xe221('0x5'));var rimraf=require(_0xe221('0x6'));var config=require(_0xe221('0x7'));var attributes=require(_0xe221('0x8'));module['exports']=function(_0x44a2ab,_0x2dd8f5){return _0x44a2ab[_0xe221('0x9')](_0xe221('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xe221('0xb'),'fields':[_0xe221('0xb')]},{'name':_0xe221('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a10=['path','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55cf7a,_0x3e6bc5){var _0x3b79f2=function(_0x509215){while(--_0x509215){_0x55cf7a['push'](_0x55cf7a['shift']());}};_0x3b79f2(++_0x3e6bc5);}(_0x9a10,0x86));var _0x09a1=function(_0x3d22e6,_0x18f2b4){_0x3d22e6=_0x3d22e6-0x0;var _0x569ef1=_0x9a10[_0x3d22e6];return _0x569ef1;};'use strict';var _=require(_0x09a1('0x0'));var util=require(_0x09a1('0x1'));var logger=require(_0x09a1('0x2'))(_0x09a1('0x3'));var moment=require(_0x09a1('0x4'));var BPromise=require(_0x09a1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09a1('0x6'));var rimraf=require(_0x09a1('0x7'));var config=require('../../config/environment');var attributes=require(_0x09a1('0x8'));module[_0x09a1('0x9')]=function(_0x3ad352,_0x32491c){return _0x3ad352['define'](_0x09a1('0xa'),attributes,{'tableName':_0x09a1('0xb'),'paranoid':![],'indexes':[{'name':_0x09a1('0xc'),'fields':['calleridnum']},{'name':_0x09a1('0xd'),'fields':[_0x09a1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b7ee9e5..10d0837 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4532ca,_0x425445){var _0x5007a5=function(_0x13b69a){while(--_0x13b69a){_0x4532ca['push'](_0x4532ca['shift']());}};_0x5007a5(++_0x425445);}(_0x7a54,0x106));var _0x47a5=function(_0xbb0a4f,_0x41d6f2){_0xbb0a4f=_0xbb0a4f-0x0;var _0x111ec5=_0x7a54[_0xbb0a4f];return _0x111ec5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x40dd17,_0x17cf4f){var _0x26aae4=function(_0x485c38){while(--_0x485c38){_0x40dd17['push'](_0x40dd17['shift']());}};_0x26aae4(++_0x17cf4f);}(_0x7a54,0x106));var _0x47a5=function(_0xa8566b,_0x251f46){_0xa8566b=_0xa8566b-0x0;var _0x4a32fd=_0x7a54[_0xa8566b];return _0x4a32fd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 007269c..98ed0c3 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 _0xfb8a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x12d4d5,_0x26d337){var _0xb10788=function(_0x491a62){while(--_0x491a62){_0x12d4d5['push'](_0x12d4d5['shift']());}};_0xb10788(++_0x26d337);}(_0xfb8a,0x109));var _0xafb8=function(_0x312ff8,_0x5d7167){_0x312ff8=_0x312ff8-0x0;var _0x4e144b=_0xfb8a[_0x312ff8];return _0x4e144b;};'use strict';var multer=require(_0xafb8('0x0'));var util=require(_0xafb8('0x1'));var path=require(_0xafb8('0x2'));var timeout=require(_0xafb8('0x3'));var express=require('express');var router=express[_0xafb8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xafb8('0x5'));var interaction=require(_0xafb8('0x6'));var config=require(_0xafb8('0x7'));var controller=require(_0xafb8('0x8'));router[_0xafb8('0x9')]('/',auth[_0xafb8('0xa')](),controller[_0xafb8('0xb')]);router[_0xafb8('0x9')](_0xafb8('0xc'),auth[_0xafb8('0xa')](),controller[_0xafb8('0xd')]);router[_0xafb8('0x9')](_0xafb8('0xe'),auth[_0xafb8('0xa')](),controller['show']);router[_0xafb8('0x9')]('/voice/queue/countAttributes/:id',auth[_0xafb8('0xa')](),controller[_0xafb8('0xf')]);router['get']('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xafb8('0x10')]);router[_0xafb8('0x11')](_0xafb8('0x12'),auth['isAuthenticated'](),controller[_0xafb8('0x13')]);router['post'](_0xafb8('0x14'),auth[_0xafb8('0xa')](),controller[_0xafb8('0x15')]);router['post'](_0xafb8('0x16'),auth['isAuthenticated'](),controller[_0xafb8('0x17')]);router[_0xafb8('0x18')](_0xafb8('0xe'),auth[_0xafb8('0xa')](),controller[_0xafb8('0x19')]);module[_0xafb8('0x1a')]=router; \ No newline at end of file +var _0xdc61=['/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id'];(function(_0x4f71b5,_0x2e7a08){var _0x164959=function(_0x5ae707){while(--_0x5ae707){_0x4f71b5['push'](_0x4f71b5['shift']());}};_0x164959(++_0x2e7a08);}(_0xdc61,0x168));var _0x1dc6=function(_0x18321f,_0x4c4bcf){_0x18321f=_0x18321f-0x0;var _0x5ca30e=_0xdc61[_0x18321f];return _0x5ca30e;};'use strict';var multer=require('multer');var util=require(_0x1dc6('0x0'));var path=require('path');var timeout=require(_0x1dc6('0x1'));var express=require(_0x1dc6('0x2'));var router=express[_0x1dc6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1dc6('0x4'));var interaction=require(_0x1dc6('0x5'));var config=require(_0x1dc6('0x6'));var controller=require(_0x1dc6('0x7'));router[_0x1dc6('0x8')]('/',auth[_0x1dc6('0x9')](),controller[_0x1dc6('0xa')]);router['get']('/describe',auth[_0x1dc6('0x9')](),controller[_0x1dc6('0xb')]);router[_0x1dc6('0x8')](_0x1dc6('0xc'),auth['isAuthenticated'](),controller[_0x1dc6('0xd')]);router[_0x1dc6('0x8')](_0x1dc6('0xe'),auth[_0x1dc6('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x1dc6('0x8')](_0x1dc6('0xf'),auth['isAuthenticated'](),controller[_0x1dc6('0x10')]);router['post'](_0x1dc6('0x11'),auth[_0x1dc6('0x9')](),controller[_0x1dc6('0x12')]);router[_0x1dc6('0x13')](_0x1dc6('0x14'),auth['isAuthenticated'](),controller[_0x1dc6('0x15')]);router[_0x1dc6('0x13')](_0x1dc6('0x16'),auth[_0x1dc6('0x9')](),controller[_0x1dc6('0x17')]);router['put'](_0x1dc6('0xc'),auth[_0x1dc6('0x9')](),controller[_0x1dc6('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 9411c38..2ffac6e 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 _0x29f8=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x2819c0,_0x1ae941){var _0x520749=function(_0x531197){while(--_0x531197){_0x2819c0['push'](_0x2819c0['shift']());}};_0x520749(++_0x1ae941);}(_0x29f8,0x116));var _0x829f=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x29f8[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x829f('0x0'));module[_0x829f('0x1')]={'state':{'type':Sequelize[_0x829f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x829f('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x829f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x829f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x829f('0x4')]},'starttime':{'type':Sequelize[_0x829f('0x3')]},'responsetime':{'type':Sequelize[_0x829f('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x829f('0x3')]},'endtime':{'type':Sequelize[_0x829f('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x829f('0x4')]},'campaign':{'type':Sequelize[_0x829f('0x4')]},'campaigntype':{'type':Sequelize[_0x829f('0x4')]},'membername':{'type':Sequelize[_0x829f('0x4')]},'reason':{'type':Sequelize[_0x829f('0x4')]},'amd':{'type':Sequelize[_0x829f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x829f('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x829f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x829f('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x829f('0x3')]},'edited':{'type':Sequelize[_0x829f('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x829f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xba45=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x49cdc4,_0x4b33bf){var _0x257ee3=function(_0x555127){while(--_0x555127){_0x49cdc4['push'](_0x49cdc4['shift']());}};_0x257ee3(++_0x4b33bf);}(_0xba45,0x14a));var _0x5ba4=function(_0x26d3d9,_0x92326){_0x26d3d9=_0x26d3d9-0x0;var _0x4c6c2b=_0xba45[_0x26d3d9];return _0x4c6c2b;};'use strict';var Sequelize=require(_0x5ba4('0x0'));module[_0x5ba4('0x1')]={'state':{'type':Sequelize[_0x5ba4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5ba4('0x3')]},'scheduledat':{'type':Sequelize[_0x5ba4('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5ba4('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5ba4('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5ba4('0x3')]},'starttime':{'type':Sequelize[_0x5ba4('0x4')]},'responsetime':{'type':Sequelize[_0x5ba4('0x4')]},'answertime':{'type':Sequelize[_0x5ba4('0x4')]},'droptime':{'type':Sequelize[_0x5ba4('0x4')]},'endtime':{'type':Sequelize[_0x5ba4('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5ba4('0x3')]},'campaign':{'type':Sequelize[_0x5ba4('0x3')]},'campaigntype':{'type':Sequelize[_0x5ba4('0x3')]},'membername':{'type':Sequelize[_0x5ba4('0x3')]},'reason':{'type':Sequelize[_0x5ba4('0x3')]},'amd':{'type':Sequelize[_0x5ba4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5ba4('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5ba4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5ba4('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5ba4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5ba4('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5ba4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index cc5bfe4..2eef9de 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 _0x4f01=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','uniqueid','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','index','CmHopperHistory','fieldName','type','model','map','query','filters','intersection','attributes'];(function(_0x4bf482,_0xbc26d0){var _0x5bf36e=function(_0x2678ad){while(--_0x2678ad){_0x4bf482['push'](_0x4bf482['shift']());}};_0x5bf36e(++_0xbc26d0);}(_0x4f01,0x1e0));var _0x14f0=function(_0x1dad80,_0x8c40e1){_0x1dad80=_0x1dad80-0x0;var _0x26fc90=_0x4f01[_0x1dad80];return _0x26fc90;};'use strict';var emlformat=require(_0x14f0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x14f0('0x1'));var moment=require(_0x14f0('0x2'));var BPromise=require(_0x14f0('0x3'));var Mustache=require(_0x14f0('0x4'));var util=require(_0x14f0('0x5'));var path=require(_0x14f0('0x6'));var sox=require(_0x14f0('0x7'));var csv=require(_0x14f0('0x8'));var ejs=require(_0x14f0('0x9'));var fs=require('fs');var fs_extra=require(_0x14f0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x14f0('0xb'));var jsforce=require(_0x14f0('0xc'));var deskjs=require(_0x14f0('0xd'));var toCsv=require(_0x14f0('0x8'));var querystring=require(_0x14f0('0xe'));var Papa=require(_0x14f0('0xf'));var Redis=require(_0x14f0('0x10'));var authService=require(_0x14f0('0x11'));var qs=require(_0x14f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14f0('0x13'));var logger=require(_0x14f0('0x14'))('api');var utils=require(_0x14f0('0x15'));var config=require(_0x14f0('0x16'));var licenseUtil=require(_0x14f0('0x17'));var db=require(_0x14f0('0x18'))['db'];function respondWithStatusCode(_0x381f31,_0x11f894){_0x11f894=_0x11f894||0xcc;return function(_0x257dae){if(_0x257dae){return _0x381f31[_0x14f0('0x19')](_0x11f894);}return _0x381f31[_0x14f0('0x1a')](_0x11f894)[_0x14f0('0x1b')]();};}function respondWithResult(_0x1a9f63,_0x295d1b){_0x295d1b=_0x295d1b||0xc8;return function(_0x4c0c0b){if(_0x4c0c0b){return _0x1a9f63[_0x14f0('0x1a')](_0x295d1b)[_0x14f0('0x1c')](_0x4c0c0b);}};}function respondWithFilteredResult(_0x5034d4,_0x142076){return function(_0x200a0d){if(_0x200a0d){var _0x19ebfe=typeof _0x142076[_0x14f0('0x1d')]===_0x14f0('0x1e')&&typeof _0x142076[_0x14f0('0x1f')]===_0x14f0('0x1e');var _0x5216d3=_0x200a0d[_0x14f0('0x20')];var _0x12f312=_0x19ebfe?0x0:_0x142076['offset'];var _0xefed32=_0x19ebfe?_0x200a0d['count']:_0x142076[_0x14f0('0x1d')]+_0x142076[_0x14f0('0x1f')];var _0x55b340;if(_0xefed32>=_0x5216d3){_0xefed32=_0x5216d3;_0x55b340=0xc8;}else{_0x55b340=0xce;}_0x5034d4[_0x14f0('0x1a')](_0x55b340);return _0x5034d4['set']('Content-Range',_0x12f312+'-'+_0xefed32+'/'+_0x5216d3)[_0x14f0('0x1c')](_0x200a0d);}return null;};}function patchUpdates(_0x3412fc){return function(_0x2e67e4){try{jsonpatch[_0x14f0('0x21')](_0x2e67e4,_0x3412fc,!![]);}catch(_0xd310d9){return BPromise[_0x14f0('0x22')](_0xd310d9);}return _0x2e67e4[_0x14f0('0x23')]();};}function saveUpdates(_0x1ffd7f,_0x299c00){return function(_0x5afef4){if(_0x5afef4){return _0x5afef4[_0x14f0('0x24')](_0x1ffd7f)[_0x14f0('0x25')](function(_0x21f086){return _0x21f086;});}return null;};}function removeEntity(_0x321b25,_0x312d20){return function(_0x567da8){if(_0x567da8){return _0x567da8['destroy']()[_0x14f0('0x25')](function(){_0x321b25['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27b692,_0x2c49c3){return function(_0x2a8a25){if(!_0x2a8a25){_0x27b692[_0x14f0('0x19')](0x194);}return _0x2a8a25;};}function handleError(_0x292cc6,_0x364cbd){_0x364cbd=_0x364cbd||0x1f4;return function(_0x5843a5){logger[_0x14f0('0x26')](_0x5843a5[_0x14f0('0x27')]);if(_0x5843a5[_0x14f0('0x28')]){delete _0x5843a5[_0x14f0('0x28')];}_0x292cc6[_0x14f0('0x1a')](_0x364cbd)[_0x14f0('0x29')](_0x5843a5);};}exports[_0x14f0('0x2a')]=function(_0x194847,_0x542085){var _0x101bb8={},_0x2f6d78={},_0x16a451={'count':0x0,'rows':[]};var _0x530443=_['map'](db[_0x14f0('0x2b')]['rawAttributes'],function(_0x49d1bf){return{'name':_0x49d1bf[_0x14f0('0x2c')],'type':_0x49d1bf[_0x14f0('0x2d')]['key']};});_0x2f6d78[_0x14f0('0x2e')]=_[_0x14f0('0x2f')](_0x530443,_0x14f0('0x28'));_0x2f6d78[_0x14f0('0x30')]=_['keys'](_0x194847[_0x14f0('0x30')]);_0x2f6d78[_0x14f0('0x31')]=_[_0x14f0('0x32')](_0x2f6d78[_0x14f0('0x2e')],_0x2f6d78[_0x14f0('0x30')]);_0x101bb8[_0x14f0('0x33')]=_[_0x14f0('0x32')](_0x2f6d78['model'],qs[_0x14f0('0x34')](_0x194847['query'][_0x14f0('0x34')]));_0x101bb8[_0x14f0('0x33')]=_0x101bb8[_0x14f0('0x33')][_0x14f0('0x35')]?_0x101bb8[_0x14f0('0x33')]:_0x2f6d78[_0x14f0('0x2e')];if(!_0x194847['query'][_0x14f0('0x36')](_0x14f0('0x37'))){_0x101bb8['limit']=qs[_0x14f0('0x1f')](_0x194847[_0x14f0('0x30')][_0x14f0('0x1f')]);_0x101bb8[_0x14f0('0x1d')]=qs['offset'](_0x194847[_0x14f0('0x30')][_0x14f0('0x1d')]);}_0x101bb8[_0x14f0('0x38')]=qs[_0x14f0('0x39')](_0x194847['query']['sort']);_0x101bb8[_0x14f0('0x3a')]=qs['filters'](_['pick'](_0x194847[_0x14f0('0x30')],_0x2f6d78[_0x14f0('0x31')]),_0x530443);if(_0x194847['query']['filter']){_0x101bb8[_0x14f0('0x3a')]=_[_0x14f0('0x3b')](_0x101bb8[_0x14f0('0x3a')],{'$or':_[_0x14f0('0x2f')](_0x530443,function(_0x31deca){if(_0x31deca['type']!==_0x14f0('0x3c')){var _0x4890b6={};_0x4890b6[_0x31deca[_0x14f0('0x28')]]={'$like':'%'+_0x194847[_0x14f0('0x30')][_0x14f0('0x3d')]+'%'};return _0x4890b6;}})});}_0x101bb8=_[_0x14f0('0x3b')]({},_0x101bb8,_0x194847[_0x14f0('0x3e')]);var _0x59487f={'where':_0x101bb8['where']};return db[_0x14f0('0x2b')][_0x14f0('0x20')](_0x59487f)[_0x14f0('0x25')](function(_0x266974){_0x16a451[_0x14f0('0x20')]=_0x266974;if(_0x194847[_0x14f0('0x30')][_0x14f0('0x3f')]){_0x101bb8[_0x14f0('0x40')]=[{'all':!![]}];}return db[_0x14f0('0x2b')]['findAll'](_0x101bb8);})['then'](function(_0x51f691){_0x16a451[_0x14f0('0x41')]=_0x51f691;return _0x16a451;})[_0x14f0('0x25')](respondWithFilteredResult(_0x542085,_0x101bb8))[_0x14f0('0x42')](handleError(_0x542085,null));};exports[_0x14f0('0x43')]=function(_0x1bc23a,_0x27c31a){var _0x418023={'raw':!![],'where':{'id':_0x1bc23a[_0x14f0('0x44')]['id']}},_0x142a0d={};_0x142a0d['model']=_[_0x14f0('0x45')](db['CmHopperHistory'][_0x14f0('0x46')]);_0x142a0d['query']=_[_0x14f0('0x45')](_0x1bc23a['query']);_0x142a0d[_0x14f0('0x31')]=_[_0x14f0('0x32')](_0x142a0d[_0x14f0('0x2e')],_0x142a0d[_0x14f0('0x30')]);_0x418023[_0x14f0('0x33')]=_[_0x14f0('0x32')](_0x142a0d[_0x14f0('0x2e')],qs[_0x14f0('0x34')](_0x1bc23a['query']['fields']));_0x418023[_0x14f0('0x33')]=_0x418023['attributes'][_0x14f0('0x35')]?_0x418023['attributes']:_0x142a0d[_0x14f0('0x2e')];if(_0x1bc23a[_0x14f0('0x30')][_0x14f0('0x3f')]){_0x418023[_0x14f0('0x40')]=[{'all':!![]}];}_0x418023=_[_0x14f0('0x3b')]({},_0x418023,_0x1bc23a[_0x14f0('0x3e')]);return db['CmHopperHistory'][_0x14f0('0x47')](_0x418023)[_0x14f0('0x25')](handleEntityNotFound(_0x27c31a,null))['then'](respondWithResult(_0x27c31a,null))[_0x14f0('0x42')](handleError(_0x27c31a,null));};exports[_0x14f0('0x48')]=function(_0x501ac5,_0x456bef){return db['CmHopperHistory'][_0x14f0('0x48')](_0x501ac5[_0x14f0('0x49')],{})[_0x14f0('0x25')](respondWithResult(_0x456bef,0xc9))['catch'](handleError(_0x456bef,null));};exports['describe']=function(_0x45f5f3,_0x569eab){return db[_0x14f0('0x2b')][_0x14f0('0x4a')]()[_0x14f0('0x25')](respondWithResult(_0x569eab,null))['catch'](handleError(_0x569eab,null));};exports[_0x14f0('0x24')]=function(_0x2d2870,_0x5c1c41){if(_0x2d2870[_0x14f0('0x49')][_0x14f0('0x4b')]){delete _0x2d2870[_0x14f0('0x49')][_0x14f0('0x4b')];}return db[_0x14f0('0x2b')][_0x14f0('0x47')]({'where':{'uniqueid':_0x2d2870[_0x14f0('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c1c41,null))[_0x14f0('0x25')](saveUpdates(_0x2d2870[_0x14f0('0x49')],null))[_0x14f0('0x25')](respondWithResult(_0x5c1c41,null))[_0x14f0('0x42')](handleError(_0x5c1c41,null));}; \ No newline at end of file +var _0xdb8b=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','catch','options','find','create','body','update','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x53ea89,_0x215312){var _0x425b91=function(_0x20c730){while(--_0x20c730){_0x53ea89['push'](_0x53ea89['shift']());}};_0x425b91(++_0x215312);}(_0xdb8b,0x8c));var _0xbdb8=function(_0x1c6979,_0x3f527c){_0x1c6979=_0x1c6979-0x0;var _0xb84add=_0xdb8b[_0x1c6979];return _0xb84add;};'use strict';var emlformat=require(_0xbdb8('0x0'));var rimraf=require(_0xbdb8('0x1'));var zipdir=require(_0xbdb8('0x2'));var jsonpatch=require(_0xbdb8('0x3'));var rp=require(_0xbdb8('0x4'));var moment=require(_0xbdb8('0x5'));var BPromise=require(_0xbdb8('0x6'));var Mustache=require('mustache');var util=require(_0xbdb8('0x7'));var path=require(_0xbdb8('0x8'));var sox=require(_0xbdb8('0x9'));var csv=require('to-csv');var ejs=require(_0xbdb8('0xa'));var fs=require('fs');var fs_extra=require(_0xbdb8('0xb'));var _=require(_0xbdb8('0xc'));var squel=require(_0xbdb8('0xd'));var crypto=require(_0xbdb8('0xe'));var jsforce=require(_0xbdb8('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbdb8('0x10'));var Papa=require(_0xbdb8('0x11'));var Redis=require(_0xbdb8('0x12'));var authService=require(_0xbdb8('0x13'));var qs=require(_0xbdb8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdb8('0x15'));var logger=require(_0xbdb8('0x16'))(_0xbdb8('0x17'));var utils=require('../../config/utils');var config=require(_0xbdb8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdb8('0x19'))['db'];function respondWithStatusCode(_0x2d4304,_0x57c943){_0x57c943=_0x57c943||0xcc;return function(_0x42c20f){if(_0x42c20f){return _0x2d4304[_0xbdb8('0x1a')](_0x57c943);}return _0x2d4304[_0xbdb8('0x1b')](_0x57c943)[_0xbdb8('0x1c')]();};}function respondWithResult(_0x1a59b3,_0x1fc247){_0x1fc247=_0x1fc247||0xc8;return function(_0x250ff7){if(_0x250ff7){return _0x1a59b3[_0xbdb8('0x1b')](_0x1fc247)[_0xbdb8('0x1d')](_0x250ff7);}};}function respondWithFilteredResult(_0x35a26e,_0x104635){return function(_0x44ac68){if(_0x44ac68){var _0x482b0f=typeof _0x104635[_0xbdb8('0x1e')]==='undefined'&&typeof _0x104635[_0xbdb8('0x1f')]===_0xbdb8('0x20');var _0x12c111=_0x44ac68[_0xbdb8('0x21')];var _0x2717cd=_0x482b0f?0x0:_0x104635[_0xbdb8('0x1e')];var _0x2e809e=_0x482b0f?_0x44ac68[_0xbdb8('0x21')]:_0x104635[_0xbdb8('0x1e')]+_0x104635[_0xbdb8('0x1f')];var _0x3658d0;if(_0x2e809e>=_0x12c111){_0x2e809e=_0x12c111;_0x3658d0=0xc8;}else{_0x3658d0=0xce;}_0x35a26e[_0xbdb8('0x1b')](_0x3658d0);return _0x35a26e[_0xbdb8('0x22')](_0xbdb8('0x23'),_0x2717cd+'-'+_0x2e809e+'/'+_0x12c111)['json'](_0x44ac68);}return null;};}function patchUpdates(_0x41399f){return function(_0x460fb0){try{jsonpatch[_0xbdb8('0x24')](_0x460fb0,_0x41399f,!![]);}catch(_0x350ab8){return BPromise[_0xbdb8('0x25')](_0x350ab8);}return _0x460fb0[_0xbdb8('0x26')]();};}function saveUpdates(_0x227634,_0x429a19){return function(_0x284d16){if(_0x284d16){return _0x284d16['update'](_0x227634)[_0xbdb8('0x27')](function(_0x37d593){return _0x37d593;});}return null;};}function removeEntity(_0x4b14d0,_0x3df743){return function(_0x1f82d0){if(_0x1f82d0){return _0x1f82d0[_0xbdb8('0x28')]()[_0xbdb8('0x27')](function(){_0x4b14d0[_0xbdb8('0x1b')](0xcc)[_0xbdb8('0x1c')]();});}};}function handleEntityNotFound(_0x541455,_0x3f38eb){return function(_0x18649a){if(!_0x18649a){_0x541455[_0xbdb8('0x1a')](0x194);}return _0x18649a;};}function handleError(_0x583c3d,_0x29aa6c){_0x29aa6c=_0x29aa6c||0x1f4;return function(_0x4f2c79){logger[_0xbdb8('0x29')](_0x4f2c79['stack']);if(_0x4f2c79[_0xbdb8('0x2a')]){delete _0x4f2c79[_0xbdb8('0x2a')];}_0x583c3d[_0xbdb8('0x1b')](_0x29aa6c)[_0xbdb8('0x2b')](_0x4f2c79);};}exports[_0xbdb8('0x2c')]=function(_0x157108,_0x2cac16){var _0x1e4740={},_0x252346={},_0x46d8a9={'count':0x0,'rows':[]};var _0x20f5f6=_[_0xbdb8('0x2d')](db[_0xbdb8('0x2e')][_0xbdb8('0x2f')],function(_0x391050){return{'name':_0x391050['fieldName'],'type':_0x391050[_0xbdb8('0x30')][_0xbdb8('0x31')]};});_0x252346['model']=_[_0xbdb8('0x2d')](_0x20f5f6,_0xbdb8('0x2a'));_0x252346[_0xbdb8('0x32')]=_[_0xbdb8('0x33')](_0x157108[_0xbdb8('0x32')]);_0x252346['filters']=_[_0xbdb8('0x34')](_0x252346[_0xbdb8('0x35')],_0x252346[_0xbdb8('0x32')]);_0x1e4740[_0xbdb8('0x36')]=_[_0xbdb8('0x34')](_0x252346['model'],qs['fields'](_0x157108['query'][_0xbdb8('0x37')]));_0x1e4740[_0xbdb8('0x36')]=_0x1e4740[_0xbdb8('0x36')][_0xbdb8('0x38')]?_0x1e4740['attributes']:_0x252346[_0xbdb8('0x35')];if(!_0x157108[_0xbdb8('0x32')][_0xbdb8('0x39')]('nolimit')){_0x1e4740[_0xbdb8('0x1f')]=qs['limit'](_0x157108[_0xbdb8('0x32')][_0xbdb8('0x1f')]);_0x1e4740[_0xbdb8('0x1e')]=qs['offset'](_0x157108['query'][_0xbdb8('0x1e')]);}_0x1e4740[_0xbdb8('0x3a')]=qs[_0xbdb8('0x3b')](_0x157108[_0xbdb8('0x32')][_0xbdb8('0x3b')]);_0x1e4740[_0xbdb8('0x3c')]=qs[_0xbdb8('0x3d')](_[_0xbdb8('0x3e')](_0x157108[_0xbdb8('0x32')],_0x252346[_0xbdb8('0x3d')]),_0x20f5f6);if(_0x157108[_0xbdb8('0x32')]['filter']){_0x1e4740[_0xbdb8('0x3c')]=_[_0xbdb8('0x3f')](_0x1e4740['where'],{'$or':_[_0xbdb8('0x2d')](_0x20f5f6,function(_0x3e8e16){if(_0x3e8e16[_0xbdb8('0x30')]!=='VIRTUAL'){var _0x224cba={};_0x224cba[_0x3e8e16[_0xbdb8('0x2a')]]={'$like':'%'+_0x157108[_0xbdb8('0x32')][_0xbdb8('0x40')]+'%'};return _0x224cba;}})});}_0x1e4740=_[_0xbdb8('0x3f')]({},_0x1e4740,_0x157108['options']);var _0x84b79a={'where':_0x1e4740['where']};return db[_0xbdb8('0x2e')][_0xbdb8('0x21')](_0x84b79a)[_0xbdb8('0x27')](function(_0x25cb93){_0x46d8a9[_0xbdb8('0x21')]=_0x25cb93;if(_0x157108[_0xbdb8('0x32')][_0xbdb8('0x41')]){_0x1e4740[_0xbdb8('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xbdb8('0x43')](_0x1e4740);})[_0xbdb8('0x27')](function(_0x6bbfdf){_0x46d8a9[_0xbdb8('0x44')]=_0x6bbfdf;return _0x46d8a9;})[_0xbdb8('0x27')](respondWithFilteredResult(_0x2cac16,_0x1e4740))[_0xbdb8('0x45')](handleError(_0x2cac16,null));};exports['show']=function(_0x4ee384,_0x2b8718){var _0x150c92={'raw':!![],'where':{'id':_0x4ee384['params']['id']}},_0x388b6e={};_0x388b6e[_0xbdb8('0x35')]=_[_0xbdb8('0x33')](db[_0xbdb8('0x2e')][_0xbdb8('0x2f')]);_0x388b6e[_0xbdb8('0x32')]=_['keys'](_0x4ee384[_0xbdb8('0x32')]);_0x388b6e[_0xbdb8('0x3d')]=_[_0xbdb8('0x34')](_0x388b6e[_0xbdb8('0x35')],_0x388b6e[_0xbdb8('0x32')]);_0x150c92['attributes']=_[_0xbdb8('0x34')](_0x388b6e['model'],qs['fields'](_0x4ee384[_0xbdb8('0x32')][_0xbdb8('0x37')]));_0x150c92[_0xbdb8('0x36')]=_0x150c92['attributes'][_0xbdb8('0x38')]?_0x150c92['attributes']:_0x388b6e[_0xbdb8('0x35')];if(_0x4ee384[_0xbdb8('0x32')][_0xbdb8('0x41')]){_0x150c92[_0xbdb8('0x42')]=[{'all':!![]}];}_0x150c92=_[_0xbdb8('0x3f')]({},_0x150c92,_0x4ee384[_0xbdb8('0x46')]);return db[_0xbdb8('0x2e')][_0xbdb8('0x47')](_0x150c92)['then'](handleEntityNotFound(_0x2b8718,null))[_0xbdb8('0x27')](respondWithResult(_0x2b8718,null))[_0xbdb8('0x45')](handleError(_0x2b8718,null));};exports[_0xbdb8('0x48')]=function(_0x425ee9,_0x4adfa4){return db[_0xbdb8('0x2e')][_0xbdb8('0x48')](_0x425ee9[_0xbdb8('0x49')],{})[_0xbdb8('0x27')](respondWithResult(_0x4adfa4,0xc9))[_0xbdb8('0x45')](handleError(_0x4adfa4,null));};exports['describe']=function(_0x1db87,_0x362b1b){return db[_0xbdb8('0x2e')]['describe']()['then'](respondWithResult(_0x362b1b,null))[_0xbdb8('0x45')](handleError(_0x362b1b,null));};exports[_0xbdb8('0x4a')]=function(_0x52f851,_0x376f3d){if(_0x52f851['body'][_0xbdb8('0x4b')]){delete _0x52f851[_0xbdb8('0x49')][_0xbdb8('0x4b')];}return db['CmHopperHistory'][_0xbdb8('0x47')]({'where':{'uniqueid':_0x52f851[_0xbdb8('0x4c')]['id']}})[_0xbdb8('0x27')](handleEntityNotFound(_0x376f3d,null))[_0xbdb8('0x27')](saveUpdates(_0x52f851[_0xbdb8('0x49')],null))['then'](respondWithResult(_0x376f3d,null))['catch'](handleError(_0x376f3d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d481fe2..28877b0 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 _0xf34f=['uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','./cmHopperHistory.attributes','define','cm_hopper_history','endtime'];(function(_0x4639e4,_0x244ecf){var _0x5d129e=function(_0x5e4198){while(--_0x5e4198){_0x4639e4['push'](_0x4639e4['shift']());}};_0x5d129e(++_0x244ecf);}(_0xf34f,0x64));var _0xff34=function(_0x492a85,_0x3d8f49){_0x492a85=_0x492a85-0x0;var _0xb29da=_0xf34f[_0x492a85];return _0xb29da;};'use strict';var _=require(_0xff34('0x0'));var util=require('util');var logger=require(_0xff34('0x1'))('api');var moment=require(_0xff34('0x2'));var BPromise=require('bluebird');var rp=require(_0xff34('0x3'));var fs=require('fs');var path=require(_0xff34('0x4'));var rimraf=require(_0xff34('0x5'));var config=require('../../config/environment');var attributes=require(_0xff34('0x6'));module['exports']=function(_0x1f436c,_0x5ba057){return _0x1f436c[_0xff34('0x7')]('CmHopperHistory',attributes,{'tableName':_0xff34('0x8'),'paranoid':![],'indexes':[{'name':_0xff34('0x9'),'fields':['endtime']},{'name':'uniqueid','fields':[_0xff34('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a0=['api','bluebird','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger'];(function(_0x433588,_0x2a2f51){var _0x35e6b7=function(_0x4b0d3d){while(--_0x4b0d3d){_0x433588['push'](_0x433588['shift']());}};_0x35e6b7(++_0x2a2f51);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x512b27,_0x4e50fa){_0x512b27=_0x512b27-0x0;var _0x4a43bf=_0xb8a0[_0x512b27];return _0x4a43bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b8a('0x0'))(_0x0b8a('0x1'));var moment=require('moment');var BPromise=require(_0x0b8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b8a('0x3'));module[_0x0b8a('0x4')]=function(_0x381b17,_0x165710){return _0x381b17[_0x0b8a('0x5')](_0x0b8a('0x6'),attributes,{'tableName':_0x0b8a('0x7'),'paranoid':![],'indexes':[{'name':_0x0b8a('0x8'),'fields':[_0x0b8a('0x8')]},{'name':_0x0b8a('0x9'),'fields':[_0x0b8a('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 68a1e12..0c31344 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 _0xee4e=['outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','name','GetCampaignHopperHistory','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','CmHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x33e114,_0x77cc5a){var _0x17e9b6=function(_0xd1cb2f){while(--_0xd1cb2f){_0x33e114['push'](_0x33e114['shift']());}};_0x17e9b6(++_0x77cc5a);}(_0xee4e,0x122));var _0xeee4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xee4e[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0xeee4('0x0'));var util=require(_0xeee4('0x1'));var moment=require(_0xeee4('0x2'));var BPromise=require('bluebird');var rs=require(_0xeee4('0x3'));var fs=require('fs');var Redis=require(_0xeee4('0x4'));var db=require(_0xeee4('0x5'))['db'];var utils=require(_0xeee4('0x6'));var logger=require(_0xeee4('0x7'))(_0xeee4('0x8'));var config=require(_0xeee4('0x9'));var jayson=require(_0xeee4('0xa'));var client=jayson['client'][_0xeee4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x148296,_0x14c3d2,_0x593262){return new BPromise(function(_0x25f0ed,_0xe75ab8){return client[_0xeee4('0xc')](_0x148296,_0x593262)['then'](function(_0x45ea79){logger[_0xeee4('0xd')](_0xeee4('0xe'),_0x14c3d2,'request\x20sent');logger[_0xeee4('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x14c3d2,_0xeee4('0x10'),JSON[_0xeee4('0x11')](_0x45ea79));if(_0x45ea79[_0xeee4('0x12')]){if(_0x45ea79['error'][_0xeee4('0x13')]===0x1f4){logger[_0xeee4('0x12')](_0xeee4('0xe'),_0x14c3d2,_0x45ea79[_0xeee4('0x12')]['message']);return _0xe75ab8(_0x45ea79['error'][_0xeee4('0x14')]);}logger[_0xeee4('0x12')](_0xeee4('0xe'),_0x14c3d2,_0x45ea79[_0xeee4('0x12')][_0xeee4('0x14')]);return _0x25f0ed(_0x45ea79['error']['message']);}else{logger[_0xeee4('0xd')](_0xeee4('0xe'),_0x14c3d2,_0xeee4('0x10'));_0x25f0ed(_0x45ea79[_0xeee4('0x15')][_0xeee4('0x14')]);}})[_0xeee4('0x16')](function(_0x55fcb7){logger[_0xeee4('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x14c3d2,_0x55fcb7);_0xe75ab8(_0x55fcb7);});});}exports[_0xeee4('0x17')]=function(_0x4e3c53){var _0x227daa=this;return new Promise(function(_0x3bce3f,_0x2b37dd){return db['CmHopperHistory'][_0xeee4('0x18')](_0x4e3c53[_0xeee4('0x19')],{'raw':_0x4e3c53[_0xeee4('0x1a')]?_0x4e3c53['options'][_0xeee4('0x1b')]===undefined?!![]:![]:!![]})[_0xeee4('0x1c')](function(_0x3a981c){logger[_0xeee4('0xd')]('CreateCmHopperHistory',_0x4e3c53);logger[_0xeee4('0xf')](_0xeee4('0x17'),_0x4e3c53,JSON['stringify'](_0x3a981c));_0x3bce3f(_0x3a981c);})[_0xeee4('0x16')](function(_0x414a14){logger[_0xeee4('0x12')](_0xeee4('0x17'),_0x414a14['message'],_0x4e3c53);_0x2b37dd(_0x227daa[_0xeee4('0x12')](0x1f4,_0x414a14[_0xeee4('0x14')]));});});};exports[_0xeee4('0x1d')]=function(_0x5623e6){var _0x497833=this;return new Promise(function(_0x2c27e0,_0x414644){return db['CmHopperHistory'][_0xeee4('0x1e')]({'raw':_0x5623e6['options']?_0x5623e6[_0xeee4('0x1a')][_0xeee4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5623e6[_0xeee4('0x1a')]?_0x5623e6[_0xeee4('0x1a')][_0xeee4('0x1f')]||null:null,'attributes':[[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')][_0xeee4('0x22')]('id')),_0xeee4('0x23')],[db['sequelize']['fn']('COUNT',db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xeee4('0x24')],[db[_0xeee4('0x20')]['fn']('COUNT',db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x26')))),_0xeee4('0x27')],[db[_0xeee4('0x20')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize'][_0xeee4('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xeee4('0x28')],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x29'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x2a')))),'predictiveIntervalAvgTalktime']]})[_0xeee4('0x1c')](function(_0x47849e){logger['info']('AvgHandleTime',_0x5623e6);logger[_0xeee4('0xf')]('AvgHandleTime',_0x5623e6,JSON[_0xeee4('0x11')](_0x47849e));_0x2c27e0(_0x47849e);})[_0xeee4('0x16')](function(_0x2f00a2){logger[_0xeee4('0x12')]('AvgHandleTime',_0x2f00a2['message'],_0x5623e6);_0x414644(_0x497833[_0xeee4('0x12')](0x1f4,_0x2f00a2['message']));});});};exports[_0xeee4('0x2b')]=function(_0x1dba34){var _0x1c3f98=this;return new Promise(function(_0x382f64,_0x4536e4){return db[_0xeee4('0x2c')]['findAll']({'raw':_0x1dba34[_0xeee4('0x1a')]?_0x1dba34[_0xeee4('0x1a')][_0xeee4('0x1b')]===undefined?!![]:![]:!![],'where':_0x1dba34[_0xeee4('0x1a')]?_0x1dba34[_0xeee4('0x1a')][_0xeee4('0x1f')]||null:null,'attributes':[[_0xeee4('0x2d'),'name'],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x2e')))),'outboundNoSuchCallsDay'],[db[_0xeee4('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xeee4('0x25')](_0xeee4('0x2f')))),'outboundNoAnswerCallsDay'],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x30')))),_0xeee4('0x31')],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x32')))),_0xeee4('0x33')],[db[_0xeee4('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x34')))),_0xeee4('0x35')],[db['sequelize']['fn']('COUNT',db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x36')))),_0xeee4('0x37')],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x38')))),_0xeee4('0x39')],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')](_0xeee4('0x3a')))),'outboundBlacklistCallsDay'],[db[_0xeee4('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xeee4('0x25')](_0xeee4('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0xeee4('0x20')]['fn']('COUNT',db[_0xeee4('0x20')]['fn']('IF',db['sequelize'][_0xeee4('0x25')](_0xeee4('0x3c')))),_0xeee4('0x3d')],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db['sequelize'][_0xeee4('0x25')](_0xeee4('0x3e')))),_0xeee4('0x3f')],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db['sequelize'][_0xeee4('0x25')](_0xeee4('0x40')))),'outboundRejectCallsDay'],[db[_0xeee4('0x20')]['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')]['literal'](_0xeee4('0x41')))),_0xeee4('0x42')]],'group':[_0xeee4('0x2d')]})['then'](function(_0x28eef2){logger[_0xeee4('0xd')](_0xeee4('0x2b'),_0x1dba34);logger['debug'](_0xeee4('0x2b'),_0x1dba34,JSON[_0xeee4('0x11')](_0x28eef2));_0x382f64(_0x28eef2);})[_0xeee4('0x16')](function(_0x1ae1cb){logger[_0xeee4('0x12')](_0xeee4('0x2b'),_0x1ae1cb[_0xeee4('0x14')],_0x1dba34);_0x4536e4(_0x1c3f98['error'](0x1f4,_0x1ae1cb[_0xeee4('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x133e3e){var _0xd08d9c=this;return new Promise(function(_0x5ba422,_0xd306dd){return db['CmHopperHistory'][_0xeee4('0x1e')]({'raw':_0x133e3e[_0xeee4('0x1a')]?_0x133e3e['options'][_0xeee4('0x1b')]===undefined?!![]:![]:!![],'where':_0x133e3e[_0xeee4('0x1a')]?_0x133e3e[_0xeee4('0x1a')][_0xeee4('0x1f')]||null:null,'attributes':[[_0xeee4('0x2d'),_0xeee4('0x43')],[db['sequelize']['fn'](_0xeee4('0x21'),db[_0xeee4('0x20')]['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0xeee4('0x20')]['fn']('IF',db[_0xeee4('0x20')][_0xeee4('0x25')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xeee4('0x2d')]})[_0xeee4('0x1c')](function(_0x2672fc){logger[_0xeee4('0xd')]('GetCampaignHopperHistory',_0x133e3e);logger[_0xeee4('0xf')]('GetCampaignHopperHistory',_0x133e3e,JSON[_0xeee4('0x11')](_0x2672fc));_0x5ba422(_0x2672fc);})[_0xeee4('0x16')](function(_0x1a6506){logger[_0xeee4('0x12')](_0xeee4('0x44'),_0x1a6506[_0xeee4('0x14')],_0x133e3e);_0xd306dd(_0xd08d9c[_0xeee4('0x12')](0x1f4,_0x1a6506[_0xeee4('0x14')]));});});}; \ No newline at end of file +var _0x5bb7=['options','debug','stringify','AvgHandleTime','raw','where','sequelize','col','COUNT','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body'];(function(_0x134e14,_0x1007ef){var _0x3af2ce=function(_0x3382c6){while(--_0x3382c6){_0x134e14['push'](_0x134e14['shift']());}};_0x3af2ce(++_0x1007ef);}(_0x5bb7,0x104));var _0x75bb=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x5bb7[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x75bb('0x0'));var util=require('util');var moment=require(_0x75bb('0x1'));var BPromise=require(_0x75bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75bb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x75bb('0x4'))(_0x75bb('0x5'));var config=require(_0x75bb('0x6'));var jayson=require(_0x75bb('0x7'));var client=jayson[_0x75bb('0x8')][_0x75bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4144d6,_0x4a1030,_0xa8897b){return new BPromise(function(_0x674de,_0x104bf0){return client[_0x75bb('0xa')](_0x4144d6,_0xa8897b)[_0x75bb('0xb')](function(_0x2887b2){logger[_0x75bb('0xc')](_0x75bb('0xd'),_0x4a1030,_0x75bb('0xe'));logger['debug'](_0x75bb('0xf'),_0x4a1030,_0x75bb('0xe'),JSON['stringify'](_0x2887b2));if(_0x2887b2[_0x75bb('0x10')]){if(_0x2887b2[_0x75bb('0x10')][_0x75bb('0x11')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4a1030,_0x2887b2[_0x75bb('0x10')][_0x75bb('0x12')]);return _0x104bf0(_0x2887b2[_0x75bb('0x10')][_0x75bb('0x12')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4a1030,_0x2887b2[_0x75bb('0x10')][_0x75bb('0x12')]);return _0x674de(_0x2887b2['error'][_0x75bb('0x12')]);}else{logger['info'](_0x75bb('0xd'),_0x4a1030,'request\x20sent');_0x674de(_0x2887b2[_0x75bb('0x13')][_0x75bb('0x12')]);}})['catch'](function(_0x1b56e1){logger[_0x75bb('0x10')](_0x75bb('0xd'),_0x4a1030,_0x1b56e1);_0x104bf0(_0x1b56e1);});});}exports[_0x75bb('0x14')]=function(_0x2f9499){var _0x2aa895=this;return new Promise(function(_0x1f9658,_0x3d5de5){return db[_0x75bb('0x15')][_0x75bb('0x16')](_0x2f9499[_0x75bb('0x17')],{'raw':_0x2f9499[_0x75bb('0x18')]?_0x2f9499[_0x75bb('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x75bb('0xb')](function(_0x4f145a){logger['info']('CreateCmHopperHistory',_0x2f9499);logger[_0x75bb('0x19')]('CreateCmHopperHistory',_0x2f9499,JSON[_0x75bb('0x1a')](_0x4f145a));_0x1f9658(_0x4f145a);})['catch'](function(_0x395c4b){logger['error'](_0x75bb('0x14'),_0x395c4b[_0x75bb('0x12')],_0x2f9499);_0x3d5de5(_0x2aa895[_0x75bb('0x10')](0x1f4,_0x395c4b[_0x75bb('0x12')]));});});};exports[_0x75bb('0x1b')]=function(_0x4ca494){var _0x17e60c=this;return new Promise(function(_0x4a8db4,_0x391f54){return db[_0x75bb('0x15')]['findAll']({'raw':_0x4ca494[_0x75bb('0x18')]?_0x4ca494[_0x75bb('0x18')][_0x75bb('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ca494[_0x75bb('0x18')]?_0x4ca494['options'][_0x75bb('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x75bb('0x1e')][_0x75bb('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x75bb('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x75bb('0x1e')]['fn']('COUNT',db[_0x75bb('0x1e')]['fn']('IF',db[_0x75bb('0x1e')][_0x75bb('0x21')](_0x75bb('0x22')))),_0x75bb('0x23')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x24'),db['sequelize']['fn']('IF',db['sequelize'][_0x75bb('0x21')](_0x75bb('0x25')))),_0x75bb('0x26')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x24'),db['sequelize']['fn']('IF',db[_0x75bb('0x1e')][_0x75bb('0x21')](_0x75bb('0x27')))),_0x75bb('0x28')]]})[_0x75bb('0xb')](function(_0x52c7ff){logger[_0x75bb('0xc')]('AvgHandleTime',_0x4ca494);logger[_0x75bb('0x19')]('AvgHandleTime',_0x4ca494,JSON['stringify'](_0x52c7ff));_0x4a8db4(_0x52c7ff);})['catch'](function(_0x3b2142){logger[_0x75bb('0x10')]('AvgHandleTime',_0x3b2142['message'],_0x4ca494);_0x391f54(_0x17e60c[_0x75bb('0x10')](0x1f4,_0x3b2142['message']));});});};exports[_0x75bb('0x29')]=function(_0x2a22bf){var _0x5267f6=this;return new Promise(function(_0x3b0fcd,_0x18f7bb){return db[_0x75bb('0x15')][_0x75bb('0x2a')]({'raw':_0x2a22bf[_0x75bb('0x18')]?_0x2a22bf[_0x75bb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2a22bf[_0x75bb('0x18')]?_0x2a22bf[_0x75bb('0x18')][_0x75bb('0x1d')]||null:null,'attributes':[[_0x75bb('0x2b'),_0x75bb('0x2c')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x75bb('0x2d')))),_0x75bb('0x2e')],[db['sequelize']['fn']('COUNT',db[_0x75bb('0x1e')]['fn']('IF',db[_0x75bb('0x1e')][_0x75bb('0x21')](_0x75bb('0x2f')))),_0x75bb('0x30')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db[_0x75bb('0x1e')]['literal'](_0x75bb('0x31')))),_0x75bb('0x32')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db[_0x75bb('0x1e')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x75bb('0x33')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db['sequelize'][_0x75bb('0x21')](_0x75bb('0x34')))),_0x75bb('0x35')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db[_0x75bb('0x1e')][_0x75bb('0x21')](_0x75bb('0x36')))),'outboundDropCallsDayTimeout'],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db[_0x75bb('0x1e')][_0x75bb('0x21')](_0x75bb('0x37')))),_0x75bb('0x38')],[db['sequelize']['fn'](_0x75bb('0x20'),db['sequelize']['fn']('IF',db[_0x75bb('0x1e')]['literal'](_0x75bb('0x39')))),'outboundUnknownCallsDay'],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db['sequelize']['fn']('IF',db[_0x75bb('0x1e')][_0x75bb('0x21')](_0x75bb('0x3a')))),_0x75bb('0x3b')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x75bb('0x3c')))),_0x75bb('0x3d')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x75bb('0x21')](_0x75bb('0x3e')))),_0x75bb('0x3f')],[db['sequelize']['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db['sequelize'][_0x75bb('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x75bb('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x75bb('0x1e')]['literal'](_0x75bb('0x41')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db[_0x75bb('0x1e')][_0x75bb('0x21')](_0x75bb('0x42')))),_0x75bb('0x43')]],'group':[_0x75bb('0x2b')]})[_0x75bb('0xb')](function(_0x15472d){logger[_0x75bb('0xc')](_0x75bb('0x29'),_0x2a22bf);logger[_0x75bb('0x19')](_0x75bb('0x29'),_0x2a22bf,JSON[_0x75bb('0x1a')](_0x15472d));_0x3b0fcd(_0x15472d);})['catch'](function(_0x13d016){logger[_0x75bb('0x10')](_0x75bb('0x29'),_0x13d016['message'],_0x2a22bf);_0x18f7bb(_0x5267f6['error'](0x1f4,_0x13d016[_0x75bb('0x12')]));});});};exports[_0x75bb('0x44')]=function(_0x57b8f3){var _0x11de64=this;return new Promise(function(_0x4e13b3,_0x311fb6){return db[_0x75bb('0x15')]['findAll']({'raw':_0x57b8f3['options']?_0x57b8f3['options'][_0x75bb('0x1c')]===undefined?!![]:![]:!![],'where':_0x57b8f3[_0x75bb('0x18')]?_0x57b8f3['options']['where']||null:null,'attributes':[[_0x75bb('0x2b'),_0x75bb('0x2c')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')][_0x75bb('0x1f')]('id')),_0x75bb('0x45')],[db[_0x75bb('0x1e')]['fn'](_0x75bb('0x20'),db[_0x75bb('0x1e')]['fn']('IF',db['sequelize'][_0x75bb('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x75bb('0x46')]],'group':[_0x75bb('0x2b')]})['then'](function(_0x2b5d65){logger[_0x75bb('0xc')](_0x75bb('0x44'),_0x57b8f3);logger[_0x75bb('0x19')](_0x75bb('0x44'),_0x57b8f3,JSON[_0x75bb('0x1a')](_0x2b5d65));_0x4e13b3(_0x2b5d65);})['catch'](function(_0x3d463e){logger[_0x75bb('0x10')](_0x75bb('0x44'),_0x3d463e[_0x75bb('0x12')],_0x57b8f3);_0x311fb6(_0x11de64[_0x75bb('0x10')](0x1f4,_0x3d463e[_0x75bb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c5d684a..e979c26 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 _0x41e7=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','multer','path','connect-timeout','express','Router'];(function(_0x37a0ce,_0x28dc04){var _0x569f4e=function(_0x1671c0){while(--_0x1671c0){_0x37a0ce['push'](_0x37a0ce['shift']());}};_0x569f4e(++_0x28dc04);}(_0x41e7,0x11c));var _0x741e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x41e7[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x741e('0x0'));var util=require('util');var path=require(_0x741e('0x1'));var timeout=require(_0x741e('0x2'));var express=require(_0x741e('0x3'));var router=express[_0x741e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x741e('0x5'));var config=require(_0x741e('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x741e('0x7')]('/',auth[_0x741e('0x8')](),controller['index']);router[_0x741e('0x7')](_0x741e('0x9'),auth[_0x741e('0x8')](),controller[_0x741e('0xa')]);router[_0x741e('0x7')](_0x741e('0xb'),auth[_0x741e('0x8')](),controller[_0x741e('0xc')]);router[_0x741e('0xd')]('/',auth[_0x741e('0x8')](),controller[_0x741e('0xe')]);router[_0x741e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x741e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc938=['create','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x29dfa5,_0xd3078e){var _0x41c15a=function(_0x10802b){while(--_0x10802b){_0x29dfa5['push'](_0x29dfa5['shift']());}};_0x41c15a(++_0xd3078e);}(_0xc938,0xe7));var _0x8c93=function(_0x648c86,_0x907f62){_0x648c86=_0x648c86-0x0;var _0x4e2cfa=_0xc938[_0x648c86];return _0x4e2cfa;};'use strict';var multer=require('multer');var util=require(_0x8c93('0x0'));var path=require(_0x8c93('0x1'));var timeout=require(_0x8c93('0x2'));var express=require(_0x8c93('0x3'));var router=express[_0x8c93('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c93('0x5'));var interaction=require(_0x8c93('0x6'));var config=require(_0x8c93('0x7'));var controller=require(_0x8c93('0x8'));router[_0x8c93('0x9')]('/',auth[_0x8c93('0xa')](),controller[_0x8c93('0xb')]);router['get'](_0x8c93('0xc'),auth[_0x8c93('0xa')](),controller['describe']);router[_0x8c93('0x9')](_0x8c93('0xd'),auth[_0x8c93('0xa')](),controller[_0x8c93('0xe')]);router[_0x8c93('0xf')]('/',auth[_0x8c93('0xa')](),controller[_0x8c93('0x10')]);router['put']('/:id',auth[_0x8c93('0xa')](),controller[_0x8c93('0x11')]);module[_0x8c93('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 05b243c..11757ee 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 _0xbe48=['name','sequelize','exports','STRING'];(function(_0x3b6aa5,_0x140467){var _0x4f7866=function(_0x21c1e3){while(--_0x21c1e3){_0x3b6aa5['push'](_0x3b6aa5['shift']());}};_0x4f7866(++_0x140467);}(_0xbe48,0x121));var _0x8be4=function(_0x182396,_0x4bfd89){_0x182396=_0x182396-0x0;var _0x6daadd=_0xbe48[_0x182396];return _0x6daadd;};'use strict';var Sequelize=require(_0x8be4('0x0'));module[_0x8be4('0x1')]={'name':{'type':Sequelize[_0x8be4('0x2')],'unique':_0x8be4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8be4('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x32c0=['exports','name','STRING','sequelize'];(function(_0x3df1e9,_0x3cd30e){var _0xd6b371=function(_0x4b5457){while(--_0x4b5457){_0x3df1e9['push'](_0x3df1e9['shift']());}};_0xd6b371(++_0x3cd30e);}(_0x32c0,0x1f3));var _0x032c=function(_0x3e1d24,_0x111778){_0x3e1d24=_0x3e1d24-0x0;var _0xfe6342=_0x32c0[_0x3e1d24];return _0xfe6342;};'use strict';var Sequelize=require(_0x032c('0x0'));module[_0x032c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x032c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x032c('0x3')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index aee414e..aabec9c 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 _0xf2f6=['include','rows','catch','show','params','keys','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','getDispositions','findOne','Disposition','pick','findAll','removeDispositions','ids','CmContact','tags','isArray','join','ListId','push','dataValues','message','CmCustomField','CustomFields','format','raw','getContactsCsv','concat','cf_%d','getContacts','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','text/csv','download','addCustomField','sequelize','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','zip-dir','request-promise','moment','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./cmList.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get','Lists','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options'];(function(_0x8317b7,_0x3bfa15){var _0x4e1bc9=function(_0x456ea1){while(--_0x456ea1){_0x8317b7['push'](_0x8317b7['shift']());}};_0x4e1bc9(++_0x3bfa15);}(_0xf2f6,0x165));var _0x6f2f=function(_0x4a53a5,_0x397fdb){_0x4a53a5=_0x4a53a5-0x0;var _0x485dcb=_0xf2f6[_0x4a53a5];return _0x485dcb;};'use strict';var emlformat=require(_0x6f2f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f2f('0x2'));var moment=require(_0x6f2f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6f2f('0x4'));var path=require(_0x6f2f('0x5'));var sox=require(_0x6f2f('0x6'));var csv=require('to-csv');var ejs=require(_0x6f2f('0x7'));var fs=require('fs');var fs_extra=require(_0x6f2f('0x8'));var _=require('lodash');var squel=require(_0x6f2f('0x9'));var crypto=require(_0x6f2f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6f2f('0xb'));var toCsv=require(_0x6f2f('0xc'));var querystring=require(_0x6f2f('0xd'));var Papa=require(_0x6f2f('0xe'));var Redis=require(_0x6f2f('0xf'));var authService=require(_0x6f2f('0x10'));var qs=require(_0x6f2f('0x11'));var as=require(_0x6f2f('0x12'));var hardwareService=require(_0x6f2f('0x13'));var logger=require(_0x6f2f('0x14'))(_0x6f2f('0x15'));var utils=require('../../config/utils');var config=require(_0x6f2f('0x16'));var licenseUtil=require(_0x6f2f('0x17'));var db=require(_0x6f2f('0x18'))['db'];config[_0x6f2f('0x19')]=_[_0x6f2f('0x1a')](config[_0x6f2f('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f2f('0x19')]));require(_0x6f2f('0x1b'))['register'](socket);function respondWithStatusCode(_0x50d599,_0x257822){_0x257822=_0x257822||0xcc;return function(_0x25e827){if(_0x25e827){return _0x50d599[_0x6f2f('0x1c')](_0x257822);}return _0x50d599[_0x6f2f('0x1d')](_0x257822)[_0x6f2f('0x1e')]();};}function respondWithResult(_0xafda6b,_0x2bd4fd){_0x2bd4fd=_0x2bd4fd||0xc8;return function(_0x445251){if(_0x445251){return _0xafda6b[_0x6f2f('0x1d')](_0x2bd4fd)[_0x6f2f('0x1f')](_0x445251);}};}function respondWithFilteredResult(_0x1fe2b1,_0x11bd9d){return function(_0x59299f){if(_0x59299f){var _0x309f76=typeof _0x11bd9d['offset']===_0x6f2f('0x20')&&typeof _0x11bd9d[_0x6f2f('0x21')]==='undefined';var _0xf79451=_0x59299f[_0x6f2f('0x22')];var _0x22e94d=_0x309f76?0x0:_0x11bd9d[_0x6f2f('0x23')];var _0x397f8a=_0x309f76?_0x59299f[_0x6f2f('0x22')]:_0x11bd9d[_0x6f2f('0x23')]+_0x11bd9d['limit'];var _0x1e3b59;if(_0x397f8a>=_0xf79451){_0x397f8a=_0xf79451;_0x1e3b59=0xc8;}else{_0x1e3b59=0xce;}_0x1fe2b1[_0x6f2f('0x1d')](_0x1e3b59);return _0x1fe2b1[_0x6f2f('0x24')](_0x6f2f('0x25'),_0x22e94d+'-'+_0x397f8a+'/'+_0xf79451)[_0x6f2f('0x1f')](_0x59299f);}return null;};}function patchUpdates(_0x225116){return function(_0x4568e1){try{jsonpatch['apply'](_0x4568e1,_0x225116,!![]);}catch(_0x2f4f91){return BPromise[_0x6f2f('0x26')](_0x2f4f91);}return _0x4568e1['save']();};}function saveUpdates(_0x1d4db8,_0x33538d){return function(_0x1eae65){if(_0x1eae65){return _0x1eae65[_0x6f2f('0x27')](_0x1d4db8)[_0x6f2f('0x28')](function(_0x188d9e){return _0x188d9e;});}return null;};}function removeEntity(_0x9a4385,_0x1165d2){return function(_0x43f5cb){if(_0x43f5cb){return _0x43f5cb[_0x6f2f('0x29')]()['then'](function(){var _0x530de0=_0x43f5cb[_0x6f2f('0x2a')]({'plain':!![]});var _0x1419ae=_0x6f2f('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x1419ae,'resourceId':_0x530de0['id']}})[_0x6f2f('0x28')](function(){return _0x43f5cb;});})[_0x6f2f('0x28')](function(){_0x9a4385[_0x6f2f('0x1d')](0xcc)[_0x6f2f('0x1e')]();});}};}function handleEntityNotFound(_0x5f2cf3,_0x3b7a0f){return function(_0x122e54){if(!_0x122e54){_0x5f2cf3[_0x6f2f('0x1c')](0x194);}return _0x122e54;};}function handleError(_0x3bc911,_0x2bf323){_0x2bf323=_0x2bf323||0x1f4;return function(_0x492a5c){logger['error'](_0x492a5c[_0x6f2f('0x2c')]);if(_0x492a5c['name']){delete _0x492a5c[_0x6f2f('0x2d')];}_0x3bc911[_0x6f2f('0x1d')](_0x2bf323)[_0x6f2f('0x2e')](_0x492a5c);};}exports[_0x6f2f('0x2f')]=function(_0x5c7366,_0xf7830b){var _0x54d6b6={},_0x445a11={},_0x519185={'count':0x0,'rows':[]};var _0x53512d=_[_0x6f2f('0x30')](db[_0x6f2f('0x31')][_0x6f2f('0x32')],function(_0x103a69){return{'name':_0x103a69[_0x6f2f('0x33')],'type':_0x103a69[_0x6f2f('0x34')][_0x6f2f('0x35')]};});_0x445a11['model']=_['map'](_0x53512d,_0x6f2f('0x2d'));_0x445a11[_0x6f2f('0x36')]=_['keys'](_0x5c7366['query']);_0x445a11['filters']=_[_0x6f2f('0x37')](_0x445a11['model'],_0x445a11[_0x6f2f('0x36')]);_0x54d6b6[_0x6f2f('0x38')]=_[_0x6f2f('0x37')](_0x445a11[_0x6f2f('0x39')],qs[_0x6f2f('0x3a')](_0x5c7366[_0x6f2f('0x36')][_0x6f2f('0x3a')]));_0x54d6b6['attributes']=_0x54d6b6[_0x6f2f('0x38')]['length']?_0x54d6b6[_0x6f2f('0x38')]:_0x445a11['model'];if(!_0x5c7366[_0x6f2f('0x36')][_0x6f2f('0x3b')](_0x6f2f('0x3c'))){_0x54d6b6['limit']=qs[_0x6f2f('0x21')](_0x5c7366[_0x6f2f('0x36')][_0x6f2f('0x21')]);_0x54d6b6['offset']=qs[_0x6f2f('0x23')](_0x5c7366['query']['offset']);}_0x54d6b6[_0x6f2f('0x3d')]=qs[_0x6f2f('0x3e')](_0x5c7366['query'][_0x6f2f('0x3e')]);_0x54d6b6[_0x6f2f('0x3f')]=qs[_0x6f2f('0x40')](_['pick'](_0x5c7366[_0x6f2f('0x36')],_0x445a11[_0x6f2f('0x40')]),_0x53512d);if(_0x5c7366[_0x6f2f('0x36')][_0x6f2f('0x41')]){_0x54d6b6[_0x6f2f('0x3f')]=_[_0x6f2f('0x42')](_0x54d6b6[_0x6f2f('0x3f')],{'$or':_['map'](_0x53512d,function(_0x37f916){if(_0x37f916[_0x6f2f('0x34')]!==_0x6f2f('0x43')){var _0x3bf8c6={};_0x3bf8c6[_0x37f916[_0x6f2f('0x2d')]]={'$like':'%'+_0x5c7366[_0x6f2f('0x36')]['filter']+'%'};return _0x3bf8c6;}})});}_0x54d6b6=_[_0x6f2f('0x42')]({},_0x54d6b6,_0x5c7366[_0x6f2f('0x44')]);var _0x4c105c={'where':_0x54d6b6[_0x6f2f('0x3f')]};return db['CmList']['count'](_0x4c105c)[_0x6f2f('0x28')](function(_0x501f90){_0x519185['count']=_0x501f90;if(_0x5c7366[_0x6f2f('0x36')]['includeAll']){_0x54d6b6[_0x6f2f('0x45')]=[{'all':!![]}];}return db[_0x6f2f('0x31')]['findAll'](_0x54d6b6);})[_0x6f2f('0x28')](function(_0x4b4fff){_0x519185[_0x6f2f('0x46')]=_0x4b4fff;return _0x519185;})[_0x6f2f('0x28')](respondWithFilteredResult(_0xf7830b,_0x54d6b6))[_0x6f2f('0x47')](handleError(_0xf7830b,null));};exports[_0x6f2f('0x48')]=function(_0xa88ac8,_0x1e9492){var _0x377417={'raw':![],'where':{'id':_0xa88ac8[_0x6f2f('0x49')]['id']}},_0x75908a={};_0x75908a['model']=_[_0x6f2f('0x4a')](db[_0x6f2f('0x31')][_0x6f2f('0x32')]);_0x75908a[_0x6f2f('0x36')]=_[_0x6f2f('0x4a')](_0xa88ac8[_0x6f2f('0x36')]);_0x75908a[_0x6f2f('0x40')]=_[_0x6f2f('0x37')](_0x75908a[_0x6f2f('0x39')],_0x75908a[_0x6f2f('0x36')]);_0x377417[_0x6f2f('0x38')]=_[_0x6f2f('0x37')](_0x75908a[_0x6f2f('0x39')],qs['fields'](_0xa88ac8['query'][_0x6f2f('0x3a')]));_0x377417['attributes']=_0x377417[_0x6f2f('0x38')][_0x6f2f('0x4b')]?_0x377417[_0x6f2f('0x38')]:_0x75908a[_0x6f2f('0x39')];if(_0xa88ac8[_0x6f2f('0x36')][_0x6f2f('0x4c')]){_0x377417[_0x6f2f('0x45')]=[{'all':!![]}];}_0x377417=_['merge']({},_0x377417,_0xa88ac8[_0x6f2f('0x44')]);return db[_0x6f2f('0x31')]['find'](_0x377417)[_0x6f2f('0x28')](handleEntityNotFound(_0x1e9492,null))[_0x6f2f('0x28')](respondWithResult(_0x1e9492,null))['catch'](handleError(_0x1e9492,null));};exports[_0x6f2f('0x4d')]=function(_0x4bf876,_0xc6b4d4){return db[_0x6f2f('0x31')][_0x6f2f('0x4d')](_0x4bf876['body'],{})[_0x6f2f('0x28')](function(_0x55fbfa){var _0x5a36f7=_0x4bf876[_0x6f2f('0x4e')][_0x6f2f('0x2a')]({'plain':!![]});if(!_0x5a36f7)throw new Error(_0x6f2f('0x4f'));if(_0x5a36f7[_0x6f2f('0x50')]===_0x6f2f('0x4e')){var _0x306665=_0x55fbfa[_0x6f2f('0x2a')]({'plain':!![]});var _0x3dee1a=_0x6f2f('0x2b');return db['UserProfileSection'][_0x6f2f('0x51')]({'where':{'name':_0x3dee1a,'userProfileId':_0x5a36f7[_0x6f2f('0x52')]},'raw':!![]})[_0x6f2f('0x28')](function(_0x2fe68c){if(_0x2fe68c&&_0x2fe68c['autoAssociation']===0x0){return db[_0x6f2f('0x53')][_0x6f2f('0x4d')]({'name':_0x306665[_0x6f2f('0x2d')],'resourceId':_0x306665['id'],'type':_0x2fe68c[_0x6f2f('0x2d')],'sectionId':_0x2fe68c['id']},{})[_0x6f2f('0x28')](function(){return _0x55fbfa;});}else{return _0x55fbfa;}})['catch'](function(_0x2d3150){logger[_0x6f2f('0x54')](_0x6f2f('0x55'),_0x2d3150);throw _0x2d3150;});}return _0x55fbfa;})['then'](respondWithResult(_0xc6b4d4,0xc9))[_0x6f2f('0x47')](handleError(_0xc6b4d4,null));};exports['update']=function(_0x3f6317,_0x2bad05){if(_0x3f6317[_0x6f2f('0x56')]['id']){delete _0x3f6317[_0x6f2f('0x56')]['id'];}return db[_0x6f2f('0x31')][_0x6f2f('0x51')]({'where':{'id':_0x3f6317[_0x6f2f('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bad05,null))[_0x6f2f('0x28')](saveUpdates(_0x3f6317[_0x6f2f('0x56')],null))[_0x6f2f('0x28')](respondWithResult(_0x2bad05,null))[_0x6f2f('0x47')](handleError(_0x2bad05,null));};exports[_0x6f2f('0x29')]=function(_0x4dcf6c,_0x3ae5cc){return db[_0x6f2f('0x31')][_0x6f2f('0x51')]({'where':{'id':_0x4dcf6c['params']['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x3ae5cc,null))[_0x6f2f('0x28')](removeEntity(_0x3ae5cc,null))[_0x6f2f('0x47')](handleError(_0x3ae5cc,null));};exports[_0x6f2f('0x57')]=function(_0x1e1942,_0x44c97d){return db[_0x6f2f('0x31')][_0x6f2f('0x57')]()[_0x6f2f('0x28')](respondWithResult(_0x44c97d,null))[_0x6f2f('0x47')](handleError(_0x44c97d,null));};exports[_0x6f2f('0x58')]=function(_0x164e2e,_0x2a738a,_0x1e06d0){if(_0x164e2e[_0x6f2f('0x56')]['id']){delete _0x164e2e[_0x6f2f('0x56')]['id'];}return db[_0x6f2f('0x31')][_0x6f2f('0x51')]({'where':{'id':_0x164e2e[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x2a738a,null))[_0x6f2f('0x28')](function(_0xe90c2d){if(_0xe90c2d){_0x164e2e[_0x6f2f('0x56')]['ListId']=_0xe90c2d['id'];return db['Disposition'][_0x6f2f('0x4d')](_0x164e2e[_0x6f2f('0x56')]);}})[_0x6f2f('0x28')](respondWithResult(_0x2a738a,null))[_0x6f2f('0x47')](handleError(_0x2a738a,null));};exports[_0x6f2f('0x59')]=function(_0x2c4968,_0x473d28,_0x279803){var _0x457eaf={'raw':![],'where':{}};var _0x37b5c1={};var _0x1878fa={'count':0x0,'rows':[]};return db[_0x6f2f('0x31')][_0x6f2f('0x5a')]({'where':{'id':_0x2c4968[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x473d28,null))[_0x6f2f('0x28')](function(_0x47496d){if(_0x47496d){_0x37b5c1[_0x6f2f('0x39')]=_[_0x6f2f('0x4a')](db[_0x6f2f('0x5b')][_0x6f2f('0x32')]);_0x37b5c1[_0x6f2f('0x36')]=_['keys'](_0x2c4968['query']);_0x37b5c1[_0x6f2f('0x40')]=_[_0x6f2f('0x37')](_0x37b5c1['model'],_0x37b5c1[_0x6f2f('0x36')]);_0x457eaf[_0x6f2f('0x38')]=_[_0x6f2f('0x37')](_0x37b5c1[_0x6f2f('0x39')],qs['fields'](_0x2c4968[_0x6f2f('0x36')][_0x6f2f('0x3a')]));_0x457eaf['attributes']=_0x457eaf[_0x6f2f('0x38')][_0x6f2f('0x4b')]?_0x457eaf[_0x6f2f('0x38')]:_0x37b5c1[_0x6f2f('0x39')];if(!_0x2c4968['query']['hasOwnProperty'](_0x6f2f('0x3c'))){_0x457eaf[_0x6f2f('0x21')]=qs['limit'](_0x2c4968['query'][_0x6f2f('0x21')]);_0x457eaf['offset']=qs[_0x6f2f('0x23')](_0x2c4968[_0x6f2f('0x36')][_0x6f2f('0x23')]);}_0x457eaf[_0x6f2f('0x3d')]=qs[_0x6f2f('0x3e')](_0x2c4968[_0x6f2f('0x36')][_0x6f2f('0x3e')]);_0x457eaf[_0x6f2f('0x3f')]=qs[_0x6f2f('0x40')](_[_0x6f2f('0x5c')](_0x2c4968[_0x6f2f('0x36')],_0x37b5c1[_0x6f2f('0x40')]));_0x457eaf[_0x6f2f('0x3f')]['ListId']=_0x47496d['id'];if(_0x2c4968['query'][_0x6f2f('0x41')]){_0x457eaf[_0x6f2f('0x3f')]=_['merge'](_0x457eaf[_0x6f2f('0x3f')],{'$or':_[_0x6f2f('0x30')](_0x457eaf[_0x6f2f('0x38')],function(_0x50037a){var _0x22b201={};_0x22b201[_0x50037a]={'$like':'%'+_0x2c4968[_0x6f2f('0x36')][_0x6f2f('0x41')]+'%'};return _0x22b201;})});}_0x457eaf=_['merge']({},_0x457eaf,_0x2c4968[_0x6f2f('0x44')]);return db[_0x6f2f('0x5b')]['count']({'where':_0x457eaf[_0x6f2f('0x3f')]})['then'](function(_0x41d9b3){_0x1878fa[_0x6f2f('0x22')]=_0x41d9b3;if(_0x2c4968[_0x6f2f('0x36')][_0x6f2f('0x4c')]){_0x457eaf[_0x6f2f('0x45')]=[{'all':!![]}];}return db[_0x6f2f('0x5b')][_0x6f2f('0x5d')](_0x457eaf);})[_0x6f2f('0x28')](function(_0x1d441d){_0x1878fa['rows']=_0x1d441d;return _0x1878fa;});}})[_0x6f2f('0x28')](respondWithFilteredResult(_0x473d28,_0x457eaf))[_0x6f2f('0x47')](handleError(_0x473d28,null));};exports[_0x6f2f('0x5e')]=function(_0x2a3b1c,_0x2052ef,_0x117bdc){return db[_0x6f2f('0x31')][_0x6f2f('0x51')]({'where':{'id':_0x2a3b1c[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x2052ef,null))[_0x6f2f('0x28')](function(_0x50ac68){if(_0x50ac68){return _0x50ac68[_0x6f2f('0x5e')](_0x2a3b1c['query'][_0x6f2f('0x5f')]);}})[_0x6f2f('0x28')](respondWithStatusCode(_0x2052ef,null))['catch'](handleError(_0x2052ef,null));};exports['addContacts']=function(_0xb3bc50,_0x204e00,_0x363add){return db[_0x6f2f('0x31')][_0x6f2f('0x51')]({'where':{'id':_0xb3bc50[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x204e00,null))[_0x6f2f('0x28')](function(_0x3adfca){if(_0x3adfca){var _0x3baf92=[];var _0x631f40={'success':[],'errors':[]};return db[_0x6f2f('0x60')]['describe']()['then'](function(_0x12a833){if(_0xb3bc50[_0x6f2f('0x56')][_0x6f2f('0x61')]&&_[_0x6f2f('0x62')](_0xb3bc50[_0x6f2f('0x56')]['tags'])){if(_0xb3bc50[_0x6f2f('0x56')][_0x6f2f('0x61')]['length']){_0xb3bc50[_0x6f2f('0x56')][_0x6f2f('0x61')]=_0xb3bc50[_0x6f2f('0x56')][_0x6f2f('0x61')][_0x6f2f('0x63')](';')+';';}else{_0xb3bc50[_0x6f2f('0x56')][_0x6f2f('0x61')]=null;}}else{_0xb3bc50[_0x6f2f('0x56')][_0x6f2f('0x61')]=null;}if(_0xb3bc50['body']&&_['isArray'](_0xb3bc50[_0x6f2f('0x56')])){for(var _0x183d93=0x0;_0x183d93<_0xb3bc50['body'][_0x6f2f('0x4b')];_0x183d93+=0x1){_0xb3bc50[_0x6f2f('0x56')][_0x183d93][_0x6f2f('0x64')]=_0xb3bc50[_0x6f2f('0x49')]['id'];_0x3baf92['push'](_0xb3bc50['body'][_0x183d93]);}return BPromise['each'](_0x3baf92,function(_0x5a95df){return db[_0x6f2f('0x60')][_0x6f2f('0x4d')](_['omit'](_0x5a95df,[_0x6f2f('0x5f'),'id'])||{},{'fields':_[_0x6f2f('0x4a')](_0x12a833),'raw':!![]})[_0x6f2f('0x28')](function(_0x210db0){_0x631f40['success'][_0x6f2f('0x65')](_0x210db0[_0x6f2f('0x66')]);})[_0x6f2f('0x47')](function(_0x2f9805){_0x631f40['errors'][_0x6f2f('0x65')]({'data':_0x5a95df,'error':_0x2f9805[_0x6f2f('0x67')]});});})[_0x6f2f('0x28')](function(_0x297a08){return _0x631f40;})['catch'](function(_0x1930d2){return _0x1930d2;});}else{_0x204e00['status'](0x190)[_0x6f2f('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x6f2f('0x28')](respondWithResult(_0x204e00,null))[_0x6f2f('0x47')](handleError(_0x204e00,null));};exports['getContacts']=function(_0x3bfb32,_0x1e8c11,_0x59b07c){var _0x336f09;return db[_0x6f2f('0x31')][_0x6f2f('0x51')]({'where':{'id':_0x3bfb32['params']['id']},'include':[{'model':db[_0x6f2f('0x68')],'as':_0x6f2f('0x69')}]})['then'](handleEntityNotFound(_0x1e8c11,null))[_0x6f2f('0x28')](function(_0x5ea3ee){if(_0x5ea3ee){_0x336f09=_0x5ea3ee;return db[_0x6f2f('0x60')][_0x6f2f('0x32')];}})[_0x6f2f('0x28')](function(_0x208c5c){if(_0x208c5c){var _0x2c2187={};var _0x519cb3={};_0x519cb3[_0x6f2f('0x39')]=_['concat'](_[_0x6f2f('0x4a')](_0x208c5c),_[_0x6f2f('0x30')](_0x336f09[_0x6f2f('0x69')],function(_0x23745a){return util[_0x6f2f('0x6a')]('cf_%d',_0x23745a['id']);}));_0x519cb3['query']=_[_0x6f2f('0x4a')](_0x3bfb32[_0x6f2f('0x36')]);_0x519cb3[_0x6f2f('0x40')]=_[_0x6f2f('0x37')](_0x519cb3['model'],_0x519cb3[_0x6f2f('0x36')]);_0x2c2187[_0x6f2f('0x38')]=_['intersection'](_0x519cb3[_0x6f2f('0x39')],qs[_0x6f2f('0x3a')](_0x3bfb32[_0x6f2f('0x36')][_0x6f2f('0x3a')]));_0x2c2187[_0x6f2f('0x38')]=_0x2c2187[_0x6f2f('0x38')][_0x6f2f('0x4b')]?_0x2c2187[_0x6f2f('0x38')]:_0x519cb3[_0x6f2f('0x39')];if(!_0x3bfb32[_0x6f2f('0x36')]['hasOwnProperty']('nolimit')){_0x2c2187[_0x6f2f('0x21')]=qs[_0x6f2f('0x21')](_0x3bfb32['query'][_0x6f2f('0x21')]);_0x2c2187[_0x6f2f('0x23')]=qs[_0x6f2f('0x23')](_0x3bfb32[_0x6f2f('0x36')][_0x6f2f('0x23')]);}_0x2c2187[_0x6f2f('0x3d')]=qs[_0x6f2f('0x3e')](_0x3bfb32[_0x6f2f('0x36')][_0x6f2f('0x3e')]);_0x2c2187[_0x6f2f('0x3f')]=qs['filters'](_[_0x6f2f('0x5c')](_0x3bfb32['query'],_0x519cb3[_0x6f2f('0x40')]));_0x2c2187[_0x6f2f('0x6b')]=!![];if(_0x3bfb32[_0x6f2f('0x36')][_0x6f2f('0x41')]){_0x2c2187[_0x6f2f('0x3f')]=_[_0x6f2f('0x42')](_0x2c2187['where'],{'$or':_[_0x6f2f('0x30')](_0x2c2187['attributes'],function(_0x5dcd7e){var _0x228e28={};_0x228e28[_0x5dcd7e]={'$like':'%'+_0x3bfb32['query'][_0x6f2f('0x41')]+'%'};return _0x228e28;})});}_0x2c2187=_['merge']({},_0x2c2187,_0x3bfb32[_0x6f2f('0x44')]);return _0x336f09['getContacts'](_0x2c2187);}})['then'](respondWithResult(_0x1e8c11,null))[_0x6f2f('0x47')](handleError(_0x1e8c11,null));};exports[_0x6f2f('0x6c')]=function(_0x687828,_0x34ff69,_0x4eec6c){var _0x25cfc3;return db[_0x6f2f('0x31')]['find']({'where':{'id':_0x687828['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x6f2f('0x69')}]})['then'](handleEntityNotFound(_0x34ff69,null))[_0x6f2f('0x28')](function(_0x3c383d){if(_0x3c383d){_0x25cfc3=_0x3c383d;return db[_0x6f2f('0x60')][_0x6f2f('0x32')];}})['then'](function(_0x41271d){if(_0x41271d){var _0x49f0b8={};var _0x4d659c={};_0x4d659c[_0x6f2f('0x39')]=_[_0x6f2f('0x6d')](_[_0x6f2f('0x4a')](_0x41271d),_[_0x6f2f('0x30')](_0x25cfc3[_0x6f2f('0x69')],function(_0x2e2c86){return util['format'](_0x6f2f('0x6e'),_0x2e2c86['id']);}));_0x4d659c[_0x6f2f('0x36')]=_[_0x6f2f('0x4a')](_0x687828[_0x6f2f('0x36')]);_0x4d659c['filters']=_['intersection'](_0x4d659c[_0x6f2f('0x39')],_0x4d659c[_0x6f2f('0x36')]);_0x49f0b8[_0x6f2f('0x38')]=_[_0x6f2f('0x37')](_0x4d659c['model'],qs[_0x6f2f('0x3a')](_0x687828[_0x6f2f('0x36')]['fields']));_0x49f0b8['attributes']=_0x49f0b8[_0x6f2f('0x38')][_0x6f2f('0x4b')]?_0x49f0b8[_0x6f2f('0x38')]:_0x4d659c['model'];if(!_0x687828[_0x6f2f('0x36')][_0x6f2f('0x3b')](_0x6f2f('0x3c'))){_0x49f0b8[_0x6f2f('0x21')]=qs[_0x6f2f('0x21')](_0x687828['query'][_0x6f2f('0x21')]);_0x49f0b8[_0x6f2f('0x23')]=qs['offset'](_0x687828['query'][_0x6f2f('0x23')]);}_0x49f0b8['order']=qs[_0x6f2f('0x3e')](_0x687828[_0x6f2f('0x36')][_0x6f2f('0x3e')]);_0x49f0b8[_0x6f2f('0x3f')]=qs[_0x6f2f('0x40')](_['pick'](_0x687828[_0x6f2f('0x36')],_0x4d659c['filters']));_0x49f0b8[_0x6f2f('0x6b')]=!![];if(_0x687828[_0x6f2f('0x36')][_0x6f2f('0x41')]){_0x49f0b8[_0x6f2f('0x3f')]=_[_0x6f2f('0x42')](_0x49f0b8[_0x6f2f('0x3f')],{'$or':_[_0x6f2f('0x30')](_0x49f0b8[_0x6f2f('0x38')],function(_0x2de706){var _0x5d93fb={};_0x5d93fb[_0x2de706]={'$like':'%'+_0x687828['query'][_0x6f2f('0x41')]+'%'};return _0x5d93fb;})});}_0x49f0b8=_['merge']({},_0x49f0b8,_0x687828['options']);return _0x25cfc3[_0x6f2f('0x6f')](_0x49f0b8);}})['then'](function(_0x2afafd){if(!_['isEmpty'](_0x2afafd)){var _0x17a087=toCsv(_0x2afafd);var _0x3c9f45=Date[_0x6f2f('0x70')]();fs[_0x6f2f('0x71')](util['format'](_0x6f2f('0x72'),_0x25cfc3['id'],_0x3c9f45),_0x17a087);_0x34ff69['setHeader'](_0x6f2f('0x73'),_0x6f2f('0x74')+util[_0x6f2f('0x6a')]('list_%d_%s.csv',_0x25cfc3['id'],_0x3c9f45));_0x34ff69[_0x6f2f('0x75')]('Content-type',_0x6f2f('0x76'));return _0x34ff69[_0x6f2f('0x77')](util[_0x6f2f('0x6a')](_0x6f2f('0x72'),_0x25cfc3['id'],_0x3c9f45));}else{return _0x34ff69[_0x6f2f('0x1c')](0xcc);}})[_0x6f2f('0x47')](handleError(_0x34ff69,null));};exports[_0x6f2f('0x78')]=function(_0x2bf21d,_0x3a2e42,_0x44d3b9){var _0x5e96ce;delete _0x2bf21d[_0x6f2f('0x56')]['id'];return db[_0x6f2f('0x31')][_0x6f2f('0x5a')]({'where':{'id':_0x2bf21d[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x3a2e42,null))['then'](function(_0x1b2dcc){if(_0x1b2dcc){return db[_0x6f2f('0x79')]['transaction'](function(_0x31da8b){return db[_0x6f2f('0x68')][_0x6f2f('0x4d')](_0x2bf21d['body'],{'transaction':_0x31da8b})[_0x6f2f('0x28')](function(_0x189040){_0x5e96ce=_0x189040;return _0x1b2dcc['addCustomFields'](_0x189040,{'transaction':_0x31da8b});})['then'](function(){var _0x1bdc76={'type':db[_0x6f2f('0x7a')][_0x6f2f('0x7b')],'transaction':_0x31da8b};switch(_0x2bf21d[_0x6f2f('0x56')][_0x6f2f('0x34')]){case _0x6f2f('0x7c'):_0x1bdc76[_0x6f2f('0x34')]=db[_0x6f2f('0x7a')][_0x6f2f('0x7b')];break;case _0x6f2f('0x7d'):_0x1bdc76[_0x6f2f('0x34')]=db[_0x6f2f('0x7a')][_0x6f2f('0x7e')];break;case'switch':_0x1bdc76[_0x6f2f('0x34')]=db[_0x6f2f('0x7a')][_0x6f2f('0x7f')];_0x1bdc76[_0x6f2f('0x80')]=![];break;default:}return db[_0x6f2f('0x79')][_0x6f2f('0x81')][_0x6f2f('0x82')](_0x6f2f('0x83'),util['format']('cf_%s',_0x5e96ce['id']),_0x1bdc76);})['then'](function(){return _0x5e96ce;});});}})[_0x6f2f('0x28')](respondWithResult(_0x3a2e42,null))['catch'](handleError(_0x3a2e42,null));};exports['getCustomFields']=function(_0x5a8208,_0x1a52bf,_0x4f5e69){var _0x475ecf={};var _0x5b54c6={};var _0xcdc995;var _0x385063;return db[_0x6f2f('0x31')][_0x6f2f('0x5a')]({'where':{'id':_0x5a8208[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x1a52bf,null))['then'](function(_0x1d20cc){if(_0x1d20cc){_0xcdc995=_0x1d20cc;_0x5b54c6[_0x6f2f('0x39')]=_[_0x6f2f('0x4a')](db[_0x6f2f('0x68')]['rawAttributes']);_0x5b54c6[_0x6f2f('0x36')]=_['keys'](_0x5a8208[_0x6f2f('0x36')]);_0x5b54c6[_0x6f2f('0x40')]=_[_0x6f2f('0x37')](_0x5b54c6[_0x6f2f('0x39')],_0x5b54c6[_0x6f2f('0x36')]);_0x475ecf['attributes']=_[_0x6f2f('0x37')](_0x5b54c6['model'],qs[_0x6f2f('0x3a')](_0x5a8208[_0x6f2f('0x36')][_0x6f2f('0x3a')]));_0x475ecf[_0x6f2f('0x38')]=_0x475ecf[_0x6f2f('0x38')][_0x6f2f('0x4b')]?_0x475ecf[_0x6f2f('0x38')]:_0x5b54c6[_0x6f2f('0x39')];_0x475ecf[_0x6f2f('0x3d')]=qs['sort'](_0x5a8208[_0x6f2f('0x36')][_0x6f2f('0x3e')]);_0x475ecf['where']=qs[_0x6f2f('0x40')](_[_0x6f2f('0x5c')](_0x5a8208['query'],_0x5b54c6[_0x6f2f('0x40')]));_0x475ecf[_0x6f2f('0x3f')]=_[_0x6f2f('0x42')](_0x475ecf['where'],{'$or':[{'ListId':_0x1d20cc['id']},{'ListId':null}]});if(_0x5a8208[_0x6f2f('0x36')][_0x6f2f('0x41')]){_0x475ecf['where']=_[_0x6f2f('0x42')](_0x475ecf[_0x6f2f('0x3f')],{'$or':_['map'](_0x475ecf['attributes'],function(_0x5268b4){var _0x20a1eb={};_0x20a1eb[_0x5268b4]={'$like':'%'+_0x5a8208[_0x6f2f('0x36')]['filter']+'%'};return _0x20a1eb;})});}_0x475ecf=_[_0x6f2f('0x42')]({},_0x475ecf,_0x5a8208[_0x6f2f('0x44')]);return db[_0x6f2f('0x68')][_0x6f2f('0x84')](_0x475ecf);}})[_0x6f2f('0x28')](respondWithResult(_0x1a52bf,null))['catch'](handleError(_0x1a52bf,null));};exports[_0x6f2f('0x85')]=function(_0x2767dd,_0x22c3a9,_0x2cb4ae){return db[_0x6f2f('0x31')]['find']({'where':{'id':_0x2767dd[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x22c3a9,null))[_0x6f2f('0x28')](function(_0x372ea9){if(_0x372ea9){return _0x372ea9[_0x6f2f('0x85')](_0x2767dd[_0x6f2f('0x56')][_0x6f2f('0x5f')],_[_0x6f2f('0x86')](_0x2767dd[_0x6f2f('0x56')],['ids','id'])||{})[_0x6f2f('0x87')](function(_0x24dd57){for(var _0x1512eb=0x0;_0x1512eb<_0x2767dd[_0x6f2f('0x56')][_0x6f2f('0x5f')][_0x6f2f('0x4b')];_0x1512eb+=0x1){socket['emit'](_0x6f2f('0x88'),{'UserId':Number(_0x2767dd[_0x6f2f('0x56')][_0x6f2f('0x5f')][_0x1512eb]),'CmListId':Number(_0x2767dd['params']['id'])});}return _0x24dd57;});}})[_0x6f2f('0x28')](respondWithResult(_0x22c3a9,null))['catch'](handleError(_0x22c3a9,null));};exports[_0x6f2f('0x89')]=function(_0xd6e4ef,_0x494f4b,_0x45909b){return db[_0x6f2f('0x31')][_0x6f2f('0x51')]({'where':{'id':_0xd6e4ef[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x494f4b,null))[_0x6f2f('0x28')](function(_0x414405){if(_0x414405){return _0x414405['removeAgents'](_0xd6e4ef['query'][_0x6f2f('0x5f')])['then'](function(){if(_[_0x6f2f('0x62')](_0xd6e4ef[_0x6f2f('0x36')][_0x6f2f('0x5f')])){for(var _0x5b4d92=0x0;_0x5b4d92<_0xd6e4ef[_0x6f2f('0x36')][_0x6f2f('0x5f')][_0x6f2f('0x4b')];_0x5b4d92+=0x1){socket[_0x6f2f('0x8a')](_0x6f2f('0x8b'),{'UserId':Number(_0xd6e4ef['query'][_0x6f2f('0x5f')][_0x5b4d92]),'CmListId':Number(_0xd6e4ef[_0x6f2f('0x49')]['id'])});}}else{socket[_0x6f2f('0x8a')](_0x6f2f('0x8b'),{'UserId':Number(_0xd6e4ef[_0x6f2f('0x36')]['ids']),'CmListId':Number(_0xd6e4ef[_0x6f2f('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x494f4b,null))[_0x6f2f('0x47')](handleError(_0x494f4b,null));};exports[_0x6f2f('0x8c')]=function(_0x46ad8e,_0x54e944,_0x3ffd20){var _0x2db3f1={};var _0x53569d={};var _0x421a8b;var _0x5b244b;return db[_0x6f2f('0x31')][_0x6f2f('0x5a')]({'where':{'id':_0x46ad8e[_0x6f2f('0x49')]['id']}})[_0x6f2f('0x28')](handleEntityNotFound(_0x54e944,null))[_0x6f2f('0x28')](function(_0x472f56){if(_0x472f56){_0x421a8b=_0x472f56;_0x53569d[_0x6f2f('0x39')]=_[_0x6f2f('0x4a')](db[_0x6f2f('0x8d')][_0x6f2f('0x32')]);_0x53569d[_0x6f2f('0x36')]=_[_0x6f2f('0x4a')](_0x46ad8e[_0x6f2f('0x36')]);_0x53569d[_0x6f2f('0x40')]=_['intersection'](_0x53569d[_0x6f2f('0x39')],_0x53569d['query']);_0x2db3f1[_0x6f2f('0x38')]=_[_0x6f2f('0x37')](_0x53569d[_0x6f2f('0x39')],qs[_0x6f2f('0x3a')](_0x46ad8e[_0x6f2f('0x36')][_0x6f2f('0x3a')]));_0x2db3f1[_0x6f2f('0x38')]=_0x2db3f1['attributes'][_0x6f2f('0x4b')]?_0x2db3f1[_0x6f2f('0x38')]:_0x53569d[_0x6f2f('0x39')];_0x2db3f1['order']=qs[_0x6f2f('0x3e')](_0x46ad8e[_0x6f2f('0x36')][_0x6f2f('0x3e')]);_0x2db3f1['where']=qs[_0x6f2f('0x40')](_[_0x6f2f('0x5c')](_0x46ad8e[_0x6f2f('0x36')],_0x53569d[_0x6f2f('0x40')]));if(_0x46ad8e[_0x6f2f('0x36')]['filter']){_0x2db3f1[_0x6f2f('0x3f')]=_['merge'](_0x2db3f1['where'],{'$or':_[_0x6f2f('0x30')](_0x2db3f1[_0x6f2f('0x38')],function(_0x300029){var _0x4e9c23={};_0x4e9c23[_0x300029]={'$like':'%'+_0x46ad8e[_0x6f2f('0x36')][_0x6f2f('0x41')]+'%'};return _0x4e9c23;})});}_0x2db3f1=_['merge']({},_0x2db3f1,_0x46ad8e[_0x6f2f('0x44')]);return _0x421a8b['getAgents'](_0x2db3f1);}})[_0x6f2f('0x28')](function(_0x51ee83){if(_0x51ee83){_0x5b244b=_0x51ee83[_0x6f2f('0x4b')];if(!_0x46ad8e['query']['hasOwnProperty'](_0x6f2f('0x3c'))){_0x2db3f1['limit']=qs[_0x6f2f('0x21')](_0x46ad8e['query'][_0x6f2f('0x21')]);_0x2db3f1['offset']=qs['offset'](_0x46ad8e[_0x6f2f('0x36')][_0x6f2f('0x23')]);}return _0x421a8b[_0x6f2f('0x8c')](_0x2db3f1);}})[_0x6f2f('0x28')](function(_0x3a0cb7){if(_0x3a0cb7){return _0x3a0cb7?{'count':_0x5b244b,'rows':_0x3a0cb7}:null;}})[_0x6f2f('0x28')](respondWithResult(_0x54e944,null))['catch'](handleError(_0x54e944,null));}; \ No newline at end of file +var _0x835c=['length','hasOwnProperty','nolimit','limit','filter','where','VIRTUAL','merge','options','includeAll','include','CmList','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','sort','pick','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','addCustomFields','TEXT','text','Sequelize','number','INTEGER','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./cmList.socket','register','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x527dcb,_0x3661b9){var _0x4f5a70=function(_0x4495f6){while(--_0x4495f6){_0x527dcb['push'](_0x527dcb['shift']());}};_0x4f5a70(++_0x3661b9);}(_0x835c,0x177));var _0xc835=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x835c[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xc835('0x0'));var rimraf=require(_0xc835('0x1'));var zipdir=require(_0xc835('0x2'));var jsonpatch=require(_0xc835('0x3'));var rp=require(_0xc835('0x4'));var moment=require(_0xc835('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc835('0x6'));var util=require(_0xc835('0x7'));var path=require(_0xc835('0x8'));var sox=require(_0xc835('0x9'));var csv=require(_0xc835('0xa'));var ejs=require(_0xc835('0xb'));var fs=require('fs');var fs_extra=require(_0xc835('0xc'));var _=require(_0xc835('0xd'));var squel=require(_0xc835('0xe'));var crypto=require(_0xc835('0xf'));var jsforce=require(_0xc835('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc835('0xa'));var querystring=require(_0xc835('0x11'));var Papa=require(_0xc835('0x12'));var Redis=require(_0xc835('0x13'));var authService=require(_0xc835('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc835('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc835('0x16'))('api');var utils=require(_0xc835('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc835('0x18'));var db=require(_0xc835('0x19'))['db'];config['redis']=_[_0xc835('0x1a')](config['redis'],{'host':_0xc835('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc835('0x1c')]));require(_0xc835('0x1d'))[_0xc835('0x1e')](socket);function respondWithStatusCode(_0x375fd5,_0xbdf21){_0xbdf21=_0xbdf21||0xcc;return function(_0x4212d3){if(_0x4212d3){return _0x375fd5[_0xc835('0x1f')](_0xbdf21);}return _0x375fd5['status'](_0xbdf21)[_0xc835('0x20')]();};}function respondWithResult(_0x4a818c,_0x33c5fa){_0x33c5fa=_0x33c5fa||0xc8;return function(_0x24cd4f){if(_0x24cd4f){return _0x4a818c['status'](_0x33c5fa)[_0xc835('0x21')](_0x24cd4f);}};}function respondWithFilteredResult(_0x4ec2bd,_0x722709){return function(_0x2a7f22){if(_0x2a7f22){var _0x33ceef=typeof _0x722709[_0xc835('0x22')]===_0xc835('0x23')&&typeof _0x722709['limit']===_0xc835('0x23');var _0x1ce19a=_0x2a7f22[_0xc835('0x24')];var _0x57c511=_0x33ceef?0x0:_0x722709[_0xc835('0x22')];var _0x2a14e0=_0x33ceef?_0x2a7f22[_0xc835('0x24')]:_0x722709['offset']+_0x722709['limit'];var _0x646ae8;if(_0x2a14e0>=_0x1ce19a){_0x2a14e0=_0x1ce19a;_0x646ae8=0xc8;}else{_0x646ae8=0xce;}_0x4ec2bd[_0xc835('0x25')](_0x646ae8);return _0x4ec2bd[_0xc835('0x26')](_0xc835('0x27'),_0x57c511+'-'+_0x2a14e0+'/'+_0x1ce19a)[_0xc835('0x21')](_0x2a7f22);}return null;};}function patchUpdates(_0x1c96a2){return function(_0x5b3763){try{jsonpatch[_0xc835('0x28')](_0x5b3763,_0x1c96a2,!![]);}catch(_0x16a7c3){return BPromise[_0xc835('0x29')](_0x16a7c3);}return _0x5b3763[_0xc835('0x2a')]();};}function saveUpdates(_0x2fd177,_0x3a6060){return function(_0x24d568){if(_0x24d568){return _0x24d568[_0xc835('0x2b')](_0x2fd177)[_0xc835('0x2c')](function(_0x1b18f8){return _0x1b18f8;});}return null;};}function removeEntity(_0x5005ad,_0x241dff){return function(_0x275307){if(_0x275307){return _0x275307[_0xc835('0x2d')]()[_0xc835('0x2c')](function(){var _0x188e18=_0x275307[_0xc835('0x2e')]({'plain':!![]});var _0x5ceeb0='Lists';return db[_0xc835('0x2f')][_0xc835('0x2d')]({'where':{'type':_0x5ceeb0,'resourceId':_0x188e18['id']}})['then'](function(){return _0x275307;});})[_0xc835('0x2c')](function(){_0x5005ad['status'](0xcc)[_0xc835('0x20')]();});}};}function handleEntityNotFound(_0x5e85d2,_0x482453){return function(_0x35a473){if(!_0x35a473){_0x5e85d2[_0xc835('0x1f')](0x194);}return _0x35a473;};}function handleError(_0x180231,_0x2921e6){_0x2921e6=_0x2921e6||0x1f4;return function(_0x564a79){logger[_0xc835('0x30')](_0x564a79['stack']);if(_0x564a79['name']){delete _0x564a79[_0xc835('0x31')];}_0x180231[_0xc835('0x25')](_0x2921e6)['send'](_0x564a79);};}exports[_0xc835('0x32')]=function(_0x58a94c,_0x2e266d){var _0x20df78={},_0x542a23={},_0x9b9e3a={'count':0x0,'rows':[]};var _0x5c581d=_[_0xc835('0x33')](db['CmList'][_0xc835('0x34')],function(_0x515364){return{'name':_0x515364[_0xc835('0x35')],'type':_0x515364[_0xc835('0x36')][_0xc835('0x37')]};});_0x542a23[_0xc835('0x38')]=_[_0xc835('0x33')](_0x5c581d,_0xc835('0x31'));_0x542a23[_0xc835('0x39')]=_[_0xc835('0x3a')](_0x58a94c[_0xc835('0x39')]);_0x542a23[_0xc835('0x3b')]=_[_0xc835('0x3c')](_0x542a23[_0xc835('0x38')],_0x542a23['query']);_0x20df78[_0xc835('0x3d')]=_[_0xc835('0x3c')](_0x542a23[_0xc835('0x38')],qs[_0xc835('0x3e')](_0x58a94c[_0xc835('0x39')]['fields']));_0x20df78[_0xc835('0x3d')]=_0x20df78[_0xc835('0x3d')][_0xc835('0x3f')]?_0x20df78['attributes']:_0x542a23[_0xc835('0x38')];if(!_0x58a94c[_0xc835('0x39')][_0xc835('0x40')](_0xc835('0x41'))){_0x20df78[_0xc835('0x42')]=qs[_0xc835('0x42')](_0x58a94c[_0xc835('0x39')][_0xc835('0x42')]);_0x20df78[_0xc835('0x22')]=qs[_0xc835('0x22')](_0x58a94c[_0xc835('0x39')][_0xc835('0x22')]);}_0x20df78['order']=qs['sort'](_0x58a94c[_0xc835('0x39')]['sort']);_0x20df78['where']=qs[_0xc835('0x3b')](_['pick'](_0x58a94c[_0xc835('0x39')],_0x542a23[_0xc835('0x3b')]),_0x5c581d);if(_0x58a94c[_0xc835('0x39')][_0xc835('0x43')]){_0x20df78[_0xc835('0x44')]=_['merge'](_0x20df78['where'],{'$or':_[_0xc835('0x33')](_0x5c581d,function(_0x398084){if(_0x398084['type']!==_0xc835('0x45')){var _0x3a32ac={};_0x3a32ac[_0x398084[_0xc835('0x31')]]={'$like':'%'+_0x58a94c[_0xc835('0x39')][_0xc835('0x43')]+'%'};return _0x3a32ac;}})});}_0x20df78=_[_0xc835('0x46')]({},_0x20df78,_0x58a94c[_0xc835('0x47')]);var _0xc6e384={'where':_0x20df78[_0xc835('0x44')]};return db['CmList'][_0xc835('0x24')](_0xc6e384)[_0xc835('0x2c')](function(_0x3ddeab){_0x9b9e3a[_0xc835('0x24')]=_0x3ddeab;if(_0x58a94c[_0xc835('0x39')][_0xc835('0x48')]){_0x20df78[_0xc835('0x49')]=[{'all':!![]}];}return db[_0xc835('0x4a')][_0xc835('0x4b')](_0x20df78);})[_0xc835('0x2c')](function(_0x3e9666){_0x9b9e3a[_0xc835('0x4c')]=_0x3e9666;return _0x9b9e3a;})[_0xc835('0x2c')](respondWithFilteredResult(_0x2e266d,_0x20df78))[_0xc835('0x4d')](handleError(_0x2e266d,null));};exports[_0xc835('0x4e')]=function(_0x1bf1b7,_0x45cd18){var _0x1a99a2={'raw':![],'where':{'id':_0x1bf1b7[_0xc835('0x4f')]['id']}},_0x3e53d8={};_0x3e53d8[_0xc835('0x38')]=_[_0xc835('0x3a')](db[_0xc835('0x4a')][_0xc835('0x34')]);_0x3e53d8['query']=_['keys'](_0x1bf1b7[_0xc835('0x39')]);_0x3e53d8[_0xc835('0x3b')]=_[_0xc835('0x3c')](_0x3e53d8[_0xc835('0x38')],_0x3e53d8[_0xc835('0x39')]);_0x1a99a2[_0xc835('0x3d')]=_[_0xc835('0x3c')](_0x3e53d8[_0xc835('0x38')],qs['fields'](_0x1bf1b7[_0xc835('0x39')][_0xc835('0x3e')]));_0x1a99a2['attributes']=_0x1a99a2[_0xc835('0x3d')][_0xc835('0x3f')]?_0x1a99a2[_0xc835('0x3d')]:_0x3e53d8[_0xc835('0x38')];if(_0x1bf1b7[_0xc835('0x39')][_0xc835('0x48')]){_0x1a99a2[_0xc835('0x49')]=[{'all':!![]}];}_0x1a99a2=_[_0xc835('0x46')]({},_0x1a99a2,_0x1bf1b7[_0xc835('0x47')]);return db['CmList'][_0xc835('0x50')](_0x1a99a2)['then'](handleEntityNotFound(_0x45cd18,null))['then'](respondWithResult(_0x45cd18,null))[_0xc835('0x4d')](handleError(_0x45cd18,null));};exports[_0xc835('0x51')]=function(_0x5a134f,_0x2e121a){return db[_0xc835('0x4a')][_0xc835('0x51')](_0x5a134f[_0xc835('0x52')],{})[_0xc835('0x2c')](function(_0x538882){var _0x5914ff=_0x5a134f['user'][_0xc835('0x2e')]({'plain':!![]});if(!_0x5914ff)throw new Error(_0xc835('0x53'));if(_0x5914ff[_0xc835('0x54')]===_0xc835('0x55')){var _0x4be5f8=_0x538882['get']({'plain':!![]});var _0x55ccc2='Lists';return db[_0xc835('0x56')][_0xc835('0x50')]({'where':{'name':_0x55ccc2,'userProfileId':_0x5914ff['userProfileId']},'raw':!![]})[_0xc835('0x2c')](function(_0xd85b94){if(_0xd85b94&&_0xd85b94[_0xc835('0x57')]===0x0){return db[_0xc835('0x2f')][_0xc835('0x51')]({'name':_0x4be5f8[_0xc835('0x31')],'resourceId':_0x4be5f8['id'],'type':_0xd85b94[_0xc835('0x31')],'sectionId':_0xd85b94['id']},{})[_0xc835('0x2c')](function(){return _0x538882;});}else{return _0x538882;}})[_0xc835('0x4d')](function(_0x105460){logger[_0xc835('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x105460);throw _0x105460;});}return _0x538882;})[_0xc835('0x2c')](respondWithResult(_0x2e121a,0xc9))[_0xc835('0x4d')](handleError(_0x2e121a,null));};exports[_0xc835('0x2b')]=function(_0x30bc85,_0xaa6ed3){if(_0x30bc85[_0xc835('0x52')]['id']){delete _0x30bc85[_0xc835('0x52')]['id'];}return db[_0xc835('0x4a')][_0xc835('0x50')]({'where':{'id':_0x30bc85['params']['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0xaa6ed3,null))[_0xc835('0x2c')](saveUpdates(_0x30bc85[_0xc835('0x52')],null))[_0xc835('0x2c')](respondWithResult(_0xaa6ed3,null))['catch'](handleError(_0xaa6ed3,null));};exports[_0xc835('0x2d')]=function(_0x1267cb,_0x50d675){return db['CmList'][_0xc835('0x50')]({'where':{'id':_0x1267cb[_0xc835('0x4f')]['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x50d675,null))['then'](removeEntity(_0x50d675,null))[_0xc835('0x4d')](handleError(_0x50d675,null));};exports['describe']=function(_0x4f0000,_0x508db6){return db[_0xc835('0x4a')][_0xc835('0x58')]()['then'](respondWithResult(_0x508db6,null))[_0xc835('0x4d')](handleError(_0x508db6,null));};exports[_0xc835('0x59')]=function(_0x60384d,_0x3d7487,_0xe95ba8){if(_0x60384d[_0xc835('0x52')]['id']){delete _0x60384d[_0xc835('0x52')]['id'];}return db[_0xc835('0x4a')]['find']({'where':{'id':_0x60384d['params']['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x3d7487,null))[_0xc835('0x2c')](function(_0x4ccd3d){if(_0x4ccd3d){_0x60384d['body'][_0xc835('0x5a')]=_0x4ccd3d['id'];return db[_0xc835('0x5b')][_0xc835('0x51')](_0x60384d[_0xc835('0x52')]);}})[_0xc835('0x2c')](respondWithResult(_0x3d7487,null))['catch'](handleError(_0x3d7487,null));};exports[_0xc835('0x5c')]=function(_0x49cd8d,_0x1f7530,_0x3a6997){var _0xa068c2={'raw':![],'where':{}};var _0xe1e006={};var _0x1086db={'count':0x0,'rows':[]};return db[_0xc835('0x4a')][_0xc835('0x5d')]({'where':{'id':_0x49cd8d[_0xc835('0x4f')]['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x1f7530,null))[_0xc835('0x2c')](function(_0x59febe){if(_0x59febe){_0xe1e006[_0xc835('0x38')]=_[_0xc835('0x3a')](db['Disposition'][_0xc835('0x34')]);_0xe1e006['query']=_['keys'](_0x49cd8d[_0xc835('0x39')]);_0xe1e006[_0xc835('0x3b')]=_['intersection'](_0xe1e006[_0xc835('0x38')],_0xe1e006[_0xc835('0x39')]);_0xa068c2[_0xc835('0x3d')]=_[_0xc835('0x3c')](_0xe1e006['model'],qs['fields'](_0x49cd8d[_0xc835('0x39')][_0xc835('0x3e')]));_0xa068c2[_0xc835('0x3d')]=_0xa068c2[_0xc835('0x3d')]['length']?_0xa068c2['attributes']:_0xe1e006['model'];if(!_0x49cd8d[_0xc835('0x39')][_0xc835('0x40')](_0xc835('0x41'))){_0xa068c2[_0xc835('0x42')]=qs['limit'](_0x49cd8d['query']['limit']);_0xa068c2[_0xc835('0x22')]=qs[_0xc835('0x22')](_0x49cd8d[_0xc835('0x39')][_0xc835('0x22')]);}_0xa068c2[_0xc835('0x5e')]=qs['sort'](_0x49cd8d[_0xc835('0x39')][_0xc835('0x5f')]);_0xa068c2[_0xc835('0x44')]=qs[_0xc835('0x3b')](_[_0xc835('0x60')](_0x49cd8d[_0xc835('0x39')],_0xe1e006['filters']));_0xa068c2[_0xc835('0x44')][_0xc835('0x5a')]=_0x59febe['id'];if(_0x49cd8d[_0xc835('0x39')][_0xc835('0x43')]){_0xa068c2[_0xc835('0x44')]=_[_0xc835('0x46')](_0xa068c2['where'],{'$or':_[_0xc835('0x33')](_0xa068c2[_0xc835('0x3d')],function(_0x361c36){var _0x575622={};_0x575622[_0x361c36]={'$like':'%'+_0x49cd8d[_0xc835('0x39')][_0xc835('0x43')]+'%'};return _0x575622;})});}_0xa068c2=_[_0xc835('0x46')]({},_0xa068c2,_0x49cd8d[_0xc835('0x47')]);return db[_0xc835('0x5b')][_0xc835('0x24')]({'where':_0xa068c2[_0xc835('0x44')]})[_0xc835('0x2c')](function(_0x4d4684){_0x1086db[_0xc835('0x24')]=_0x4d4684;if(_0x49cd8d[_0xc835('0x39')][_0xc835('0x48')]){_0xa068c2[_0xc835('0x49')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xa068c2);})[_0xc835('0x2c')](function(_0x221e14){_0x1086db['rows']=_0x221e14;return _0x1086db;});}})[_0xc835('0x2c')](respondWithFilteredResult(_0x1f7530,_0xa068c2))[_0xc835('0x4d')](handleError(_0x1f7530,null));};exports[_0xc835('0x61')]=function(_0x2a6c2b,_0x1d33e6,_0x217843){return db[_0xc835('0x4a')][_0xc835('0x50')]({'where':{'id':_0x2a6c2b['params']['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x1d33e6,null))[_0xc835('0x2c')](function(_0x519084){if(_0x519084){return _0x519084[_0xc835('0x61')](_0x2a6c2b[_0xc835('0x39')][_0xc835('0x62')]);}})['then'](respondWithStatusCode(_0x1d33e6,null))[_0xc835('0x4d')](handleError(_0x1d33e6,null));};exports[_0xc835('0x63')]=function(_0x1c8059,_0x17d403,_0x249653){return db[_0xc835('0x4a')][_0xc835('0x50')]({'where':{'id':_0x1c8059['params']['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x17d403,null))[_0xc835('0x2c')](function(_0x49a9a7){if(_0x49a9a7){var _0x2bda0c=[];var _0x16e08a={'success':[],'errors':[]};return db[_0xc835('0x64')][_0xc835('0x58')]()[_0xc835('0x2c')](function(_0x2bcf33){if(_0x1c8059['body']['tags']&&_['isArray'](_0x1c8059[_0xc835('0x52')][_0xc835('0x65')])){if(_0x1c8059[_0xc835('0x52')]['tags'][_0xc835('0x3f')]){_0x1c8059[_0xc835('0x52')][_0xc835('0x65')]=_0x1c8059[_0xc835('0x52')]['tags'][_0xc835('0x66')](';')+';';}else{_0x1c8059[_0xc835('0x52')][_0xc835('0x65')]=null;}}else{_0x1c8059[_0xc835('0x52')][_0xc835('0x65')]=null;}if(_0x1c8059[_0xc835('0x52')]&&_[_0xc835('0x67')](_0x1c8059[_0xc835('0x52')])){for(var _0x3119ea=0x0;_0x3119ea<_0x1c8059['body'][_0xc835('0x3f')];_0x3119ea+=0x1){_0x1c8059[_0xc835('0x52')][_0x3119ea]['ListId']=_0x1c8059[_0xc835('0x4f')]['id'];_0x2bda0c[_0xc835('0x68')](_0x1c8059[_0xc835('0x52')][_0x3119ea]);}return BPromise[_0xc835('0x69')](_0x2bda0c,function(_0xe94769){return db[_0xc835('0x64')][_0xc835('0x51')](_[_0xc835('0x6a')](_0xe94769,[_0xc835('0x62'),'id'])||{},{'fields':_['keys'](_0x2bcf33),'raw':!![]})['then'](function(_0x1c482e){_0x16e08a[_0xc835('0x6b')]['push'](_0x1c482e[_0xc835('0x6c')]);})[_0xc835('0x4d')](function(_0x3212de){_0x16e08a['errors'][_0xc835('0x68')]({'data':_0xe94769,'error':_0x3212de[_0xc835('0x6d')]});});})[_0xc835('0x2c')](function(_0x37fb06){return _0x16e08a;})[_0xc835('0x4d')](function(_0x4bcd57){return _0x4bcd57;});}else{_0x17d403['status'](0x190)[_0xc835('0x21')]({'message':_0xc835('0x6e')});}});}})['then'](respondWithResult(_0x17d403,null))[_0xc835('0x4d')](handleError(_0x17d403,null));};exports[_0xc835('0x6f')]=function(_0x12d012,_0x5b7a96,_0x21de70){var _0x483b9b;return db[_0xc835('0x4a')][_0xc835('0x50')]({'where':{'id':_0x12d012['params']['id']},'include':[{'model':db[_0xc835('0x70')],'as':_0xc835('0x71')}]})[_0xc835('0x2c')](handleEntityNotFound(_0x5b7a96,null))[_0xc835('0x2c')](function(_0x2cb914){if(_0x2cb914){_0x483b9b=_0x2cb914;return db[_0xc835('0x64')][_0xc835('0x34')];}})['then'](function(_0x2806d2){if(_0x2806d2){var _0x39e180={};var _0x5cd8dd={};_0x5cd8dd[_0xc835('0x38')]=_[_0xc835('0x72')](_[_0xc835('0x3a')](_0x2806d2),_[_0xc835('0x33')](_0x483b9b[_0xc835('0x71')],function(_0x596231){return util[_0xc835('0x73')](_0xc835('0x74'),_0x596231['id']);}));_0x5cd8dd[_0xc835('0x39')]=_[_0xc835('0x3a')](_0x12d012[_0xc835('0x39')]);_0x5cd8dd[_0xc835('0x3b')]=_['intersection'](_0x5cd8dd[_0xc835('0x38')],_0x5cd8dd[_0xc835('0x39')]);_0x39e180[_0xc835('0x3d')]=_['intersection'](_0x5cd8dd[_0xc835('0x38')],qs[_0xc835('0x3e')](_0x12d012[_0xc835('0x39')]['fields']));_0x39e180['attributes']=_0x39e180[_0xc835('0x3d')][_0xc835('0x3f')]?_0x39e180[_0xc835('0x3d')]:_0x5cd8dd[_0xc835('0x38')];if(!_0x12d012[_0xc835('0x39')][_0xc835('0x40')](_0xc835('0x41'))){_0x39e180[_0xc835('0x42')]=qs[_0xc835('0x42')](_0x12d012[_0xc835('0x39')][_0xc835('0x42')]);_0x39e180[_0xc835('0x22')]=qs[_0xc835('0x22')](_0x12d012[_0xc835('0x39')][_0xc835('0x22')]);}_0x39e180['order']=qs[_0xc835('0x5f')](_0x12d012['query']['sort']);_0x39e180[_0xc835('0x44')]=qs['filters'](_['pick'](_0x12d012[_0xc835('0x39')],_0x5cd8dd['filters']));_0x39e180[_0xc835('0x75')]=!![];if(_0x12d012[_0xc835('0x39')]['filter']){_0x39e180[_0xc835('0x44')]=_['merge'](_0x39e180[_0xc835('0x44')],{'$or':_[_0xc835('0x33')](_0x39e180[_0xc835('0x3d')],function(_0x596d60){var _0x1391d3={};_0x1391d3[_0x596d60]={'$like':'%'+_0x12d012[_0xc835('0x39')][_0xc835('0x43')]+'%'};return _0x1391d3;})});}_0x39e180=_[_0xc835('0x46')]({},_0x39e180,_0x12d012[_0xc835('0x47')]);return _0x483b9b[_0xc835('0x6f')](_0x39e180);}})['then'](respondWithResult(_0x5b7a96,null))[_0xc835('0x4d')](handleError(_0x5b7a96,null));};exports['getContactsCsv']=function(_0x7698fd,_0x1e0b0d,_0x2cd20a){var _0x1b6fca;return db[_0xc835('0x4a')][_0xc835('0x50')]({'where':{'id':_0x7698fd[_0xc835('0x4f')]['id']},'include':[{'model':db[_0xc835('0x70')],'as':_0xc835('0x71')}]})['then'](handleEntityNotFound(_0x1e0b0d,null))['then'](function(_0x38c684){if(_0x38c684){_0x1b6fca=_0x38c684;return db[_0xc835('0x64')][_0xc835('0x34')];}})[_0xc835('0x2c')](function(_0x22d312){if(_0x22d312){var _0x53f80a={};var _0x2cab0e={};_0x2cab0e[_0xc835('0x38')]=_[_0xc835('0x72')](_[_0xc835('0x3a')](_0x22d312),_[_0xc835('0x33')](_0x1b6fca[_0xc835('0x71')],function(_0x5ae804){return util[_0xc835('0x73')](_0xc835('0x74'),_0x5ae804['id']);}));_0x2cab0e[_0xc835('0x39')]=_[_0xc835('0x3a')](_0x7698fd[_0xc835('0x39')]);_0x2cab0e[_0xc835('0x3b')]=_[_0xc835('0x3c')](_0x2cab0e['model'],_0x2cab0e[_0xc835('0x39')]);_0x53f80a[_0xc835('0x3d')]=_[_0xc835('0x3c')](_0x2cab0e['model'],qs[_0xc835('0x3e')](_0x7698fd[_0xc835('0x39')][_0xc835('0x3e')]));_0x53f80a[_0xc835('0x3d')]=_0x53f80a[_0xc835('0x3d')][_0xc835('0x3f')]?_0x53f80a[_0xc835('0x3d')]:_0x2cab0e['model'];if(!_0x7698fd[_0xc835('0x39')][_0xc835('0x40')](_0xc835('0x41'))){_0x53f80a[_0xc835('0x42')]=qs[_0xc835('0x42')](_0x7698fd[_0xc835('0x39')]['limit']);_0x53f80a[_0xc835('0x22')]=qs[_0xc835('0x22')](_0x7698fd[_0xc835('0x39')][_0xc835('0x22')]);}_0x53f80a[_0xc835('0x5e')]=qs[_0xc835('0x5f')](_0x7698fd[_0xc835('0x39')][_0xc835('0x5f')]);_0x53f80a[_0xc835('0x44')]=qs['filters'](_['pick'](_0x7698fd[_0xc835('0x39')],_0x2cab0e['filters']));_0x53f80a['raw']=!![];if(_0x7698fd['query'][_0xc835('0x43')]){_0x53f80a[_0xc835('0x44')]=_[_0xc835('0x46')](_0x53f80a[_0xc835('0x44')],{'$or':_[_0xc835('0x33')](_0x53f80a['attributes'],function(_0x2c2394){var _0x41e25a={};_0x41e25a[_0x2c2394]={'$like':'%'+_0x7698fd[_0xc835('0x39')][_0xc835('0x43')]+'%'};return _0x41e25a;})});}_0x53f80a=_[_0xc835('0x46')]({},_0x53f80a,_0x7698fd[_0xc835('0x47')]);return _0x1b6fca[_0xc835('0x6f')](_0x53f80a);}})[_0xc835('0x2c')](function(_0x3808bb){if(!_[_0xc835('0x76')](_0x3808bb)){var _0x3ee82a=toCsv(_0x3808bb);var _0xcb8d08=Date['now']();fs[_0xc835('0x77')](util[_0xc835('0x73')](_0xc835('0x78'),_0x1b6fca['id'],_0xcb8d08),_0x3ee82a);_0x1e0b0d[_0xc835('0x79')]('Content-disposition','attachment;\x20filename='+util[_0xc835('0x73')](_0xc835('0x7a'),_0x1b6fca['id'],_0xcb8d08));_0x1e0b0d[_0xc835('0x79')](_0xc835('0x7b'),'text/csv');return _0x1e0b0d[_0xc835('0x7c')](util[_0xc835('0x73')](_0xc835('0x78'),_0x1b6fca['id'],_0xcb8d08));}else{return _0x1e0b0d['sendStatus'](0xcc);}})[_0xc835('0x4d')](handleError(_0x1e0b0d,null));};exports[_0xc835('0x7d')]=function(_0x55b4d1,_0x1635ab,_0x32b133){var _0x306312;delete _0x55b4d1['body']['id'];return db[_0xc835('0x4a')][_0xc835('0x5d')]({'where':{'id':_0x55b4d1[_0xc835('0x4f')]['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x1635ab,null))[_0xc835('0x2c')](function(_0xd31f1){if(_0xd31f1){return db[_0xc835('0x7e')]['transaction'](function(_0x302948){return db[_0xc835('0x70')]['create'](_0x55b4d1[_0xc835('0x52')],{'transaction':_0x302948})[_0xc835('0x2c')](function(_0x4f1121){_0x306312=_0x4f1121;return _0xd31f1[_0xc835('0x7f')](_0x4f1121,{'transaction':_0x302948});})[_0xc835('0x2c')](function(){var _0x2d92fa={'type':db['Sequelize'][_0xc835('0x80')],'transaction':_0x302948};switch(_0x55b4d1['body'][_0xc835('0x36')]){case _0xc835('0x81'):_0x2d92fa[_0xc835('0x36')]=db[_0xc835('0x82')][_0xc835('0x80')];break;case _0xc835('0x83'):_0x2d92fa[_0xc835('0x36')]=db['Sequelize'][_0xc835('0x84')];break;case'switch':_0x2d92fa[_0xc835('0x36')]=db[_0xc835('0x82')]['BOOLEAN'];_0x2d92fa[_0xc835('0x85')]=![];break;default:}return db['sequelize'][_0xc835('0x86')][_0xc835('0x87')]('cm_contacts',util[_0xc835('0x73')](_0xc835('0x88'),_0x306312['id']),_0x2d92fa);})[_0xc835('0x2c')](function(){return _0x306312;});});}})['then'](respondWithResult(_0x1635ab,null))['catch'](handleError(_0x1635ab,null));};exports[_0xc835('0x89')]=function(_0x4b5845,_0x881458,_0x973db4){var _0x19237e={};var _0x170a48={};var _0x5e8464;var _0x4cfdf6;return db['CmList'][_0xc835('0x5d')]({'where':{'id':_0x4b5845['params']['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x881458,null))[_0xc835('0x2c')](function(_0x2c65d0){if(_0x2c65d0){_0x5e8464=_0x2c65d0;_0x170a48['model']=_[_0xc835('0x3a')](db[_0xc835('0x70')][_0xc835('0x34')]);_0x170a48[_0xc835('0x39')]=_[_0xc835('0x3a')](_0x4b5845[_0xc835('0x39')]);_0x170a48[_0xc835('0x3b')]=_['intersection'](_0x170a48[_0xc835('0x38')],_0x170a48[_0xc835('0x39')]);_0x19237e[_0xc835('0x3d')]=_[_0xc835('0x3c')](_0x170a48[_0xc835('0x38')],qs['fields'](_0x4b5845['query']['fields']));_0x19237e[_0xc835('0x3d')]=_0x19237e[_0xc835('0x3d')]['length']?_0x19237e['attributes']:_0x170a48[_0xc835('0x38')];_0x19237e[_0xc835('0x5e')]=qs[_0xc835('0x5f')](_0x4b5845[_0xc835('0x39')][_0xc835('0x5f')]);_0x19237e[_0xc835('0x44')]=qs['filters'](_[_0xc835('0x60')](_0x4b5845[_0xc835('0x39')],_0x170a48[_0xc835('0x3b')]));_0x19237e[_0xc835('0x44')]=_[_0xc835('0x46')](_0x19237e[_0xc835('0x44')],{'$or':[{'ListId':_0x2c65d0['id']},{'ListId':null}]});if(_0x4b5845[_0xc835('0x39')]['filter']){_0x19237e[_0xc835('0x44')]=_[_0xc835('0x46')](_0x19237e['where'],{'$or':_[_0xc835('0x33')](_0x19237e[_0xc835('0x3d')],function(_0x11f69e){var _0x13cd71={};_0x13cd71[_0x11f69e]={'$like':'%'+_0x4b5845[_0xc835('0x39')][_0xc835('0x43')]+'%'};return _0x13cd71;})});}_0x19237e=_[_0xc835('0x46')]({},_0x19237e,_0x4b5845[_0xc835('0x47')]);return db[_0xc835('0x70')][_0xc835('0x8a')](_0x19237e);}})[_0xc835('0x2c')](respondWithResult(_0x881458,null))[_0xc835('0x4d')](handleError(_0x881458,null));};exports['addAgents']=function(_0x4b4f08,_0x5b057e,_0x48c260){return db[_0xc835('0x4a')]['find']({'where':{'id':_0x4b4f08[_0xc835('0x4f')]['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x5b057e,null))[_0xc835('0x2c')](function(_0x3b9871){if(_0x3b9871){return _0x3b9871[_0xc835('0x8b')](_0x4b4f08[_0xc835('0x52')]['ids'],_[_0xc835('0x6a')](_0x4b4f08[_0xc835('0x52')],['ids','id'])||{})[_0xc835('0x8c')](function(_0x1901b5){for(var _0xa15c44=0x0;_0xa15c44<_0x4b4f08['body'][_0xc835('0x62')]['length'];_0xa15c44+=0x1){socket[_0xc835('0x8d')](_0xc835('0x8e'),{'UserId':Number(_0x4b4f08[_0xc835('0x52')]['ids'][_0xa15c44]),'CmListId':Number(_0x4b4f08[_0xc835('0x4f')]['id'])});}return _0x1901b5;});}})[_0xc835('0x2c')](respondWithResult(_0x5b057e,null))['catch'](handleError(_0x5b057e,null));};exports[_0xc835('0x8f')]=function(_0x5ef3a0,_0x221bc3,_0x2d2ed9){return db[_0xc835('0x4a')][_0xc835('0x50')]({'where':{'id':_0x5ef3a0[_0xc835('0x4f')]['id']}})[_0xc835('0x2c')](handleEntityNotFound(_0x221bc3,null))[_0xc835('0x2c')](function(_0x335f41){if(_0x335f41){return _0x335f41['removeAgents'](_0x5ef3a0[_0xc835('0x39')][_0xc835('0x62')])[_0xc835('0x2c')](function(){if(_['isArray'](_0x5ef3a0[_0xc835('0x39')][_0xc835('0x62')])){for(var _0x2a65ff=0x0;_0x2a65ff<_0x5ef3a0[_0xc835('0x39')][_0xc835('0x62')][_0xc835('0x3f')];_0x2a65ff+=0x1){socket[_0xc835('0x8d')](_0xc835('0x90'),{'UserId':Number(_0x5ef3a0[_0xc835('0x39')]['ids'][_0x2a65ff]),'CmListId':Number(_0x5ef3a0[_0xc835('0x4f')]['id'])});}}else{socket[_0xc835('0x8d')](_0xc835('0x90'),{'UserId':Number(_0x5ef3a0['query'][_0xc835('0x62')]),'CmListId':Number(_0x5ef3a0[_0xc835('0x4f')]['id'])});}});}})[_0xc835('0x2c')](respondWithStatusCode(_0x221bc3,null))[_0xc835('0x4d')](handleError(_0x221bc3,null));};exports['getAgents']=function(_0xe5fc52,_0x613895,_0x87b66e){var _0x4efbb1={};var _0x54a085={};var _0x2f38b2;var _0x4f8c66;return db[_0xc835('0x4a')][_0xc835('0x5d')]({'where':{'id':_0xe5fc52[_0xc835('0x4f')]['id']}})['then'](handleEntityNotFound(_0x613895,null))[_0xc835('0x2c')](function(_0x3d015f){if(_0x3d015f){_0x2f38b2=_0x3d015f;_0x54a085[_0xc835('0x38')]=_['keys'](db['User'][_0xc835('0x34')]);_0x54a085[_0xc835('0x39')]=_[_0xc835('0x3a')](_0xe5fc52[_0xc835('0x39')]);_0x54a085[_0xc835('0x3b')]=_[_0xc835('0x3c')](_0x54a085[_0xc835('0x38')],_0x54a085['query']);_0x4efbb1['attributes']=_['intersection'](_0x54a085[_0xc835('0x38')],qs['fields'](_0xe5fc52[_0xc835('0x39')][_0xc835('0x3e')]));_0x4efbb1[_0xc835('0x3d')]=_0x4efbb1[_0xc835('0x3d')][_0xc835('0x3f')]?_0x4efbb1['attributes']:_0x54a085['model'];_0x4efbb1[_0xc835('0x5e')]=qs[_0xc835('0x5f')](_0xe5fc52[_0xc835('0x39')][_0xc835('0x5f')]);_0x4efbb1[_0xc835('0x44')]=qs['filters'](_[_0xc835('0x60')](_0xe5fc52[_0xc835('0x39')],_0x54a085[_0xc835('0x3b')]));if(_0xe5fc52['query'][_0xc835('0x43')]){_0x4efbb1['where']=_['merge'](_0x4efbb1[_0xc835('0x44')],{'$or':_['map'](_0x4efbb1['attributes'],function(_0x536d6b){var _0x34aac8={};_0x34aac8[_0x536d6b]={'$like':'%'+_0xe5fc52[_0xc835('0x39')][_0xc835('0x43')]+'%'};return _0x34aac8;})});}_0x4efbb1=_[_0xc835('0x46')]({},_0x4efbb1,_0xe5fc52[_0xc835('0x47')]);return _0x2f38b2[_0xc835('0x91')](_0x4efbb1);}})['then'](function(_0x473e1b){if(_0x473e1b){_0x4f8c66=_0x473e1b[_0xc835('0x3f')];if(!_0xe5fc52[_0xc835('0x39')][_0xc835('0x40')](_0xc835('0x41'))){_0x4efbb1['limit']=qs['limit'](_0xe5fc52[_0xc835('0x39')]['limit']);_0x4efbb1[_0xc835('0x22')]=qs[_0xc835('0x22')](_0xe5fc52[_0xc835('0x39')][_0xc835('0x22')]);}return _0x2f38b2['getAgents'](_0x4efbb1);}})[_0xc835('0x2c')](function(_0x1c388b){if(_0x1c388b){return _0x1c388b?{'count':_0x4f8c66,'rows':_0x1c388b}:null;}})[_0xc835('0x2c')](respondWithResult(_0x613895,null))['catch'](handleError(_0x613895,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 77cdea4..6d20e37 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x326f,0xd1));var _0xf326=function(_0x789b43,_0x47ee4d){_0x789b43=_0x789b43-0x0;var _0x3a06cb=_0x326f[_0x789b43];return _0x3a06cb;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe14b,0x93));var _0xbe14=function(_0x21f19a,_0x12adef){_0x21f19a=_0x21f19a-0x0;var _0x14edb2=_0xe14b[_0x21f19a];return _0x14edb2;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a671d0c..25be4b0 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 _0x6f7a=['CmList','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x596262,_0x48d8b3){_0x596262=_0x596262-0x0;var _0x4a9d8d=_0x6f7a[_0x596262];return _0x4a9d8d;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0x46746a,_0xed8606){var _0x334af3=function(_0x7c953b){while(--_0x7c953b){_0x46746a['push'](_0x46746a['shift']());}};_0x334af3(++_0xed8606);}(_0xbec5,0xe5));var _0x5bec=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xbec5[_0x2f48cd];return _0x193ae2;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'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 831ec2f..1ce0f73 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 _0x714c=['debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','defaults','localhost','redis','./cmList.socket','request','info','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x1fb64c,_0x145f87){var _0x47c7b8=function(_0x1234fb){while(--_0x1234fb){_0x1fb64c['push'](_0x1fb64c['shift']());}};_0x47c7b8(++_0x145f87);}(_0x714c,0xec));var _0xc714=function(_0x52eb16,_0x89c3d8){_0x52eb16=_0x52eb16-0x0;var _0x382d3f=_0x714c[_0x52eb16];return _0x382d3f;};'use strict';var _=require('lodash');var util=require(_0xc714('0x0'));var moment=require(_0xc714('0x1'));var BPromise=require(_0xc714('0x2'));var rs=require(_0xc714('0x3'));var fs=require('fs');var Redis=require(_0xc714('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc714('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc714('0x6'));var jayson=require(_0xc714('0x7'));var client=jayson[_0xc714('0x8')]['http']({'port':0x232a});config['redis']=_[_0xc714('0x9')](config['redis'],{'host':_0xc714('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc714('0xb')]));require(_0xc714('0xc'))['register'](socket);function respondWithRpcPromise(_0x21f87e,_0x3effe1,_0x3e88fa){return new BPromise(function(_0x20058a,_0x11437a){return client[_0xc714('0xd')](_0x21f87e,_0x3e88fa)['then'](function(_0x47b3a1){logger[_0xc714('0xe')](_0xc714('0xf'),_0x3effe1,_0xc714('0x10'));logger[_0xc714('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x3effe1,_0xc714('0x10'),JSON['stringify'](_0x47b3a1));if(_0x47b3a1[_0xc714('0x12')]){if(_0x47b3a1[_0xc714('0x12')][_0xc714('0x13')]===0x1f4){logger[_0xc714('0x12')]('CmList,\x20%s,\x20%s',_0x3effe1,_0x47b3a1[_0xc714('0x12')][_0xc714('0x14')]);return _0x11437a(_0x47b3a1[_0xc714('0x12')][_0xc714('0x14')]);}logger[_0xc714('0x12')](_0xc714('0xf'),_0x3effe1,_0x47b3a1['error'][_0xc714('0x14')]);return _0x20058a(_0x47b3a1[_0xc714('0x12')]['message']);}else{logger[_0xc714('0xe')](_0xc714('0xf'),_0x3effe1,_0xc714('0x10'));_0x20058a(_0x47b3a1[_0xc714('0x15')][_0xc714('0x14')]);}})[_0xc714('0x16')](function(_0x55904c){logger['error'](_0xc714('0xf'),_0x3effe1,_0x55904c);_0x11437a(_0x55904c);});});} \ No newline at end of file +var _0x8645=['defaults','localhost','socket.io-emitter','./cmList.socket','request','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8645,0xb8));var _0x5864=function(_0x4e7f42,_0x1d8502){_0x4e7f42=_0x4e7f42-0x0;var _0x4902ed=_0x8645[_0x4e7f42];return _0x4902ed;};'use strict';var _=require(_0x5864('0x0'));var util=require(_0x5864('0x1'));var moment=require(_0x5864('0x2'));var BPromise=require('bluebird');var rs=require(_0x5864('0x3'));var fs=require('fs');var Redis=require(_0x5864('0x4'));var db=require(_0x5864('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5864('0x6'))(_0x5864('0x7'));var config=require(_0x5864('0x8'));var jayson=require(_0x5864('0x9'));var client=jayson[_0x5864('0xa')]['http']({'port':0x232a});config[_0x5864('0xb')]=_[_0x5864('0xc')](config[_0x5864('0xb')],{'host':_0x5864('0xd'),'port':0x18eb});var socket=require(_0x5864('0xe'))(new Redis(config['redis']));require(_0x5864('0xf'))['register'](socket);function respondWithRpcPromise(_0x1a1ab3,_0x26f45f,_0xf6f82c){return new BPromise(function(_0x58db57,_0x270b66){return client[_0x5864('0x10')](_0x1a1ab3,_0xf6f82c)['then'](function(_0x4fd1c7){logger['info'](_0x5864('0x11'),_0x26f45f,_0x5864('0x12'));logger[_0x5864('0x13')](_0x5864('0x14'),_0x26f45f,'request\x20sent',JSON[_0x5864('0x15')](_0x4fd1c7));if(_0x4fd1c7[_0x5864('0x16')]){if(_0x4fd1c7[_0x5864('0x16')][_0x5864('0x17')]===0x1f4){logger[_0x5864('0x16')](_0x5864('0x11'),_0x26f45f,_0x4fd1c7['error'][_0x5864('0x18')]);return _0x270b66(_0x4fd1c7['error'][_0x5864('0x18')]);}logger['error'](_0x5864('0x11'),_0x26f45f,_0x4fd1c7[_0x5864('0x16')]['message']);return _0x58db57(_0x4fd1c7['error'][_0x5864('0x18')]);}else{logger[_0x5864('0x19')](_0x5864('0x11'),_0x26f45f,_0x5864('0x12'));_0x58db57(_0x4fd1c7[_0x5864('0x1a')][_0x5864('0x18')]);}})[_0x5864('0x1b')](function(_0x5a94e1){logger[_0x5864('0x16')](_0x5864('0x11'),_0x26f45f,_0x5a94e1);_0x270b66(_0x5a94e1);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6e93484..9383cca 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 _0x91a9=['removeListener','save','remove','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x91a9,0x15a));var _0x991a=function(_0x5009a4,_0xec00d2){_0x5009a4=_0x5009a4-0x0;var _0x42161e=_0x91a9[_0x5009a4];return _0x42161e;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x991a('0x0'),_0x991a('0x1'),_0x991a('0x2')];function createListener(_0x4764d9,_0x34e310){return function(_0x4d8f55){_0x34e310[_0x991a('0x3')](_0x4764d9,_0x4d8f55);};}function removeListener(_0x420838,_0x495479){return function(){CmListEvents[_0x991a('0x4')](_0x420838,_0x495479);};}exports['register']=function(_0x3b09aa){for(var _0x21b5d=0x0,_0x2d459=events['length'];_0x21b5d<_0x2d459;_0x21b5d++){var _0x165e69=events[_0x21b5d];var _0xaf683b=createListener('cmList:'+_0x165e69,_0x3b09aa);CmListEvents['on'](_0x165e69,_0xaf683b);}}; \ No newline at end of file +var _0x6253=['removeListener','length','cmList:','./cmList.events','remove','update','emit'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x6253,0xff));var _0x3625=function(_0x3197c4,_0x2cbb9d){_0x3197c4=_0x3197c4-0x0;var _0x36c00e=_0x6253[_0x3197c4];return _0x36c00e;};'use strict';var CmListEvents=require(_0x3625('0x0'));var events=['save',_0x3625('0x1'),_0x3625('0x2')];function createListener(_0x1a5c3c,_0x44549d){return function(_0x4ce1ce){_0x44549d[_0x3625('0x3')](_0x1a5c3c,_0x4ce1ce);};}function removeListener(_0x6fd367,_0x50f279){return function(){CmListEvents[_0x3625('0x4')](_0x6fd367,_0x50f279);};}exports['register']=function(_0x35b6a9){for(var _0x14776d=0x0,_0x4ab30a=events[_0x3625('0x5')];_0x14776d<_0x4ab30a;_0x14776d++){var _0x4fd03e=events[_0x14776d];var _0x4cc872=createListener(_0x3625('0x6')+_0x4fd03e,_0x35b6a9);CmListEvents['on'](_0x4fd03e,_0x4cc872);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 64739d0..6e602e4 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 _0x7f44=['index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getCustomFields','post','create','addContacts','/:id/fields','addCustomField','/:id/users','put','update','delete','destroy','removeAgents','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x478d22,_0x37a162){var _0xc76a68=function(_0x22285b){while(--_0x22285b){_0x478d22['push'](_0x478d22['shift']());}};_0xc76a68(++_0x37a162);}(_0x7f44,0xa5));var _0x47f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x47f4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x47f4('0x1'));var router=express[_0x47f4('0x2')]();var fs_extra=require(_0x47f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x47f4('0x4'));var config=require(_0x47f4('0x5'));var controller=require(_0x47f4('0x6'));router[_0x47f4('0x7')]('/',auth[_0x47f4('0x8')](),controller[_0x47f4('0x9')]);router[_0x47f4('0x7')](_0x47f4('0xa'),auth[_0x47f4('0x8')](),controller[_0x47f4('0xb')]);router[_0x47f4('0x7')](_0x47f4('0xc'),auth['isAuthenticated'](),controller[_0x47f4('0xd')]);router[_0x47f4('0x7')](_0x47f4('0xe'),auth['isAuthenticated'](),controller[_0x47f4('0xf')]);router[_0x47f4('0x7')](_0x47f4('0x10'),auth[_0x47f4('0x8')](),controller['getContacts']);router[_0x47f4('0x7')]('/:id/contacts/csv',auth[_0x47f4('0x8')](),controller['getContactsCsv']);router[_0x47f4('0x7')]('/:id/fields',auth[_0x47f4('0x8')](),controller[_0x47f4('0x11')]);router['get']('/:id/users',auth[_0x47f4('0x8')](),controller['getAgents']);router[_0x47f4('0x12')]('/',auth['isAuthenticated'](),controller[_0x47f4('0x13')]);router['post']('/:id/dispositions',auth[_0x47f4('0x8')](),controller['addDisposition']);router[_0x47f4('0x12')](_0x47f4('0x10'),auth[_0x47f4('0x8')](),controller[_0x47f4('0x14')]);router['post'](_0x47f4('0x15'),auth[_0x47f4('0x8')](),controller[_0x47f4('0x16')]);router[_0x47f4('0x12')](_0x47f4('0x17'),auth['isAuthenticated'](),controller['addAgents']);router[_0x47f4('0x18')](_0x47f4('0xc'),auth[_0x47f4('0x8')](),controller[_0x47f4('0x19')]);router[_0x47f4('0x1a')]('/:id',auth[_0x47f4('0x8')](),controller[_0x47f4('0x1b')]);router[_0x47f4('0x1a')]('/:id/dispositions',auth[_0x47f4('0x8')](),controller['removeDispositions']);router[_0x47f4('0x1a')](_0x47f4('0x17'),auth[_0x47f4('0x8')](),controller[_0x47f4('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7bc9=['show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','isAuthenticated','getCustomFields','post','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','/:id'];(function(_0x4ebfeb,_0x1daf80){var _0x4ee28b=function(_0x14d7a5){while(--_0x14d7a5){_0x4ebfeb['push'](_0x4ebfeb['shift']());}};_0x4ee28b(++_0x1daf80);}(_0x7bc9,0x122));var _0x97bc=function(_0x56e8aa,_0x5b2f88){_0x56e8aa=_0x56e8aa-0x0;var _0x67e0a6=_0x7bc9[_0x56e8aa];return _0x67e0a6;};'use strict';var multer=require('multer');var util=require(_0x97bc('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x97bc('0x1'));var router=express['Router']();var fs_extra=require(_0x97bc('0x2'));var auth=require(_0x97bc('0x3'));var interaction=require(_0x97bc('0x4'));var config=require('../../config/environment');var controller=require(_0x97bc('0x5'));router[_0x97bc('0x6')]('/',auth['isAuthenticated'](),controller[_0x97bc('0x7')]);router[_0x97bc('0x6')](_0x97bc('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x97bc('0x6')](_0x97bc('0x9'),auth['isAuthenticated'](),controller[_0x97bc('0xa')]);router[_0x97bc('0x6')](_0x97bc('0xb'),auth['isAuthenticated'](),controller[_0x97bc('0xc')]);router[_0x97bc('0x6')](_0x97bc('0xd'),auth['isAuthenticated'](),controller['getContacts']);router[_0x97bc('0x6')](_0x97bc('0xe'),auth['isAuthenticated'](),controller[_0x97bc('0xf')]);router[_0x97bc('0x6')](_0x97bc('0x10'),auth[_0x97bc('0x11')](),controller[_0x97bc('0x12')]);router[_0x97bc('0x6')]('/:id/users',auth[_0x97bc('0x11')](),controller['getAgents']);router[_0x97bc('0x13')]('/',auth[_0x97bc('0x11')](),controller['create']);router[_0x97bc('0x13')](_0x97bc('0xb'),auth['isAuthenticated'](),controller[_0x97bc('0x14')]);router[_0x97bc('0x13')](_0x97bc('0xd'),auth[_0x97bc('0x11')](),controller['addContacts']);router[_0x97bc('0x13')](_0x97bc('0x10'),auth[_0x97bc('0x11')](),controller[_0x97bc('0x15')]);router[_0x97bc('0x13')]('/:id/users',auth[_0x97bc('0x11')](),controller[_0x97bc('0x16')]);router[_0x97bc('0x17')](_0x97bc('0x9'),auth[_0x97bc('0x11')](),controller[_0x97bc('0x18')]);router[_0x97bc('0x19')](_0x97bc('0x9'),auth[_0x97bc('0x11')](),controller[_0x97bc('0x1a')]);router[_0x97bc('0x19')](_0x97bc('0xb'),auth[_0x97bc('0x11')](),controller[_0x97bc('0x1b')]);router[_0x97bc('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x97bc('0x1c')]);module[_0x97bc('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 458b90c..ae869d3 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 _0x1096=['VIRTUAL','STRING','sequelize','exports'];(function(_0x9738ce,_0x29fe8f){var _0x4b8e35=function(_0xb56a90){while(--_0xb56a90){_0x9738ce['push'](_0x9738ce['shift']());}};_0x4b8e35(++_0x29fe8f);}(_0x1096,0x172));var _0x6109=function(_0x48f066,_0x41c960){_0x48f066=_0x48f066-0x0;var _0x9d8c=_0x1096[_0x48f066];return _0x9d8c;};'use strict';var Sequelize=require(_0x6109('0x0'));module[_0x6109('0x1')]={'name':{'type':Sequelize[_0x6109('0x2')],'get':function(_0x17f3f4){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x6109('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x6109('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x6109('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x795e=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x795e,0xdc));var _0xe795=function(_0x52fa00,_0x29964e){_0x52fa00=_0x52fa00-0x0;var _0x34aa5f=_0x795e[_0x52fa00];return _0x34aa5f;};'use strict';var Sequelize=require(_0xe795('0x0'));module[_0xe795('0x1')]={'name':{'type':Sequelize[_0xe795('0x2')],'get':function(_0x37bd32){return this[_0xe795('0x3')](_0xe795('0x4'));}},'field':{'type':Sequelize[_0xe795('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xe795('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xe795('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 1728019..e208dba 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x53517b,_0x554cc7){var _0x14a936=function(_0x322869){while(--_0x322869){_0x53517b['push'](_0x53517b['shift']());}};_0x14a936(++_0x554cc7);}(_0x7a54,0x106));var _0x47a5=function(_0x1db5d9,_0x358ad6){_0x1db5d9=_0x1db5d9-0x0;var _0x2158f9=_0x7a54[_0x1db5d9];return _0x2158f9;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1a8122,_0x2f57c1){var _0xf0aa20=function(_0x1359e5){while(--_0x1359e5){_0x1a8122['push'](_0x1a8122['shift']());}};_0xf0aa20(++_0x2f57c1);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 a3a9229..a812a19 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 _0xa75b=['path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','util','moment','bluebird'];(function(_0x53f867,_0x137084){var _0x4feb5e=function(_0x2acdfa){while(--_0x2acdfa){_0x53f867['push'](_0x53f867['shift']());}};_0x4feb5e(++_0x137084);}(_0xa75b,0xb1));var _0xba75=function(_0x61463c,_0x140a9a){_0x61463c=_0x61463c-0x0;var _0x21820f=_0xa75b[_0x61463c];return _0x21820f;};'use strict';var _=require('lodash');var util=require(_0xba75('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xba75('0x1'));var BPromise=require(_0xba75('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba75('0x3'));var rimraf=require(_0xba75('0x4'));var config=require(_0xba75('0x5'));var attributes=require(_0xba75('0x6'));module[_0xba75('0x7')]=function(_0x301f77,_0x51f195){return _0x301f77[_0xba75('0x8')]('Condition',attributes,{'tableName':_0xba75('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7eb=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Condition','tools_conditions','util','../../config/logger','api'];(function(_0x2f0022,_0x435713){var _0x2427c4=function(_0x3516de){while(--_0x3516de){_0x2f0022['push'](_0x2f0022['shift']());}};_0x2427c4(++_0x435713);}(_0xe7eb,0xd5));var _0xbe7e=function(_0x249b2f,_0x36dcc8){_0x249b2f=_0x249b2f-0x0;var _0x87c753=_0xe7eb[_0x249b2f];return _0x87c753;};'use strict';var _=require('lodash');var util=require(_0xbe7e('0x0'));var logger=require(_0xbe7e('0x1'))(_0xbe7e('0x2'));var moment=require(_0xbe7e('0x3'));var BPromise=require(_0xbe7e('0x4'));var rp=require(_0xbe7e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe7e('0x6'));var config=require(_0xbe7e('0x7'));var attributes=require('./condition.attributes');module[_0xbe7e('0x8')]=function(_0x1aa37f,_0x3bddfb){return _0x1aa37f[_0xbe7e('0x9')](_0xbe7e('0xa'),attributes,{'tableName':_0xbe7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 7b6e673..32ca9de 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 _0x211d=['client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x416010,_0x454edf){var _0x30adc3=function(_0x44366f){while(--_0x44366f){_0x416010['push'](_0x416010['shift']());}};_0x30adc3(++_0x454edf);}(_0x211d,0x65));var _0xd211=function(_0x818624,_0x31b367){_0x818624=_0x818624-0x0;var _0x36d65b=_0x211d[_0x818624];return _0x36d65b;};'use strict';var _=require(_0xd211('0x0'));var util=require(_0xd211('0x1'));var moment=require(_0xd211('0x2'));var BPromise=require(_0xd211('0x3'));var rs=require(_0xd211('0x4'));var fs=require('fs');var Redis=require(_0xd211('0x5'));var db=require(_0xd211('0x6'))['db'];var utils=require(_0xd211('0x7'));var logger=require('../../config/logger')(_0xd211('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd211('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43b16b,_0x33195a,_0x3fce8f){return new BPromise(function(_0x236c52,_0x3315a0){return client[_0xd211('0xa')](_0x43b16b,_0x3fce8f)[_0xd211('0xb')](function(_0x54ca32){logger[_0xd211('0xc')](_0xd211('0xd'),_0x33195a,_0xd211('0xe'));logger[_0xd211('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x33195a,_0xd211('0xe'),JSON[_0xd211('0x10')](_0x54ca32));if(_0x54ca32[_0xd211('0x11')]){if(_0x54ca32[_0xd211('0x11')][_0xd211('0x12')]===0x1f4){logger['error'](_0xd211('0xd'),_0x33195a,_0x54ca32[_0xd211('0x11')][_0xd211('0x13')]);return _0x3315a0(_0x54ca32[_0xd211('0x11')][_0xd211('0x13')]);}logger[_0xd211('0x11')](_0xd211('0xd'),_0x33195a,_0x54ca32[_0xd211('0x11')]['message']);return _0x236c52(_0x54ca32[_0xd211('0x11')][_0xd211('0x13')]);}else{logger[_0xd211('0xc')](_0xd211('0xd'),_0x33195a,_0xd211('0xe'));_0x236c52(_0x54ca32[_0xd211('0x14')][_0xd211('0x13')]);}})[_0xd211('0x15')](function(_0x4ce62f){logger['error'](_0xd211('0xd'),_0x33195a,_0x4ce62f);_0x3315a0(_0x4ce62f);});});} \ No newline at end of file +var _0xf970=['then','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1890e4,_0x2b8af3){var _0x866c62=function(_0x1cf3ff){while(--_0x1cf3ff){_0x1890e4['push'](_0x1890e4['shift']());}};_0x866c62(++_0x2b8af3);}(_0xf970,0x1e5));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0f97('0x0'));var util=require(_0x0f97('0x1'));var moment=require('moment');var BPromise=require(_0x0f97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f97('0x3'))(_0x0f97('0x4'));var config=require(_0x0f97('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0f97('0x6')][_0x0f97('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x13c8f9,_0x24f2dd,_0x296536){return new BPromise(function(_0x3eaced,_0x36e359){return client[_0x0f97('0x8')](_0x13c8f9,_0x296536)[_0x0f97('0x9')](function(_0x767c30){logger['info'](_0x0f97('0xa'),_0x24f2dd,_0x0f97('0xb'));logger[_0x0f97('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x24f2dd,'request\x20sent',JSON[_0x0f97('0xd')](_0x767c30));if(_0x767c30['error']){if(_0x767c30[_0x0f97('0xe')][_0x0f97('0xf')]===0x1f4){logger[_0x0f97('0xe')]('Condition,\x20%s,\x20%s',_0x24f2dd,_0x767c30[_0x0f97('0xe')][_0x0f97('0x10')]);return _0x36e359(_0x767c30[_0x0f97('0xe')][_0x0f97('0x10')]);}logger['error'](_0x0f97('0xa'),_0x24f2dd,_0x767c30['error'][_0x0f97('0x10')]);return _0x3eaced(_0x767c30[_0x0f97('0xe')]['message']);}else{logger[_0x0f97('0x11')]('Condition,\x20%s,\x20%s',_0x24f2dd,_0x0f97('0xb'));_0x3eaced(_0x767c30[_0x0f97('0x12')][_0x0f97('0x10')]);}})['catch'](function(_0x20de9e){logger['error']('Condition,\x20%s,\x20%s',_0x24f2dd,_0x20de9e);_0x36e359(_0x20de9e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index dcb12dc..1df4ba5 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 _0xc0a8=['isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','/:id'];(function(_0x40f1e2,_0x561e8f){var _0x17215f=function(_0xdc3398){while(--_0xdc3398){_0x40f1e2['push'](_0x40f1e2['shift']());}};_0x17215f(++_0x561e8f);}(_0xc0a8,0x147));var _0x8c0a=function(_0x1e1e27,_0x127376){_0x1e1e27=_0x1e1e27-0x0;var _0x457e01=_0xc0a8[_0x1e1e27];return _0x457e01;};'use strict';var multer=require('multer');var util=require(_0x8c0a('0x0'));var path=require(_0x8c0a('0x1'));var timeout=require(_0x8c0a('0x2'));var express=require(_0x8c0a('0x3'));var router=express[_0x8c0a('0x4')]();var fs_extra=require(_0x8c0a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8c0a('0x6'));var config=require(_0x8c0a('0x7'));var controller=require('./condition.controller');router['put'](_0x8c0a('0x8'),auth[_0x8c0a('0x9')](),controller[_0x8c0a('0xa')]);router[_0x8c0a('0xb')](_0x8c0a('0x8'),auth['isAuthenticated'](),controller[_0x8c0a('0xc')]);module[_0x8c0a('0xd')]=router; \ No newline at end of file +var _0x396b=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated','update','/:id','destroy'];(function(_0xa56b53,_0x53dbb7){var _0x19849f=function(_0x503946){while(--_0x503946){_0xa56b53['push'](_0xa56b53['shift']());}};_0x19849f(++_0x53dbb7);}(_0x396b,0x1c1));var _0xb396=function(_0x39ed94,_0x4296f1){_0x39ed94=_0x39ed94-0x0;var _0x50be6a=_0x396b[_0x39ed94];return _0x50be6a;};'use strict';var multer=require(_0xb396('0x0'));var util=require('util');var path=require(_0xb396('0x1'));var timeout=require(_0xb396('0x2'));var express=require('express');var router=express[_0xb396('0x3')]();var fs_extra=require(_0xb396('0x4'));var auth=require(_0xb396('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb396('0x6'));var controller=require(_0xb396('0x7'));router[_0xb396('0x8')]('/:id',auth[_0xb396('0x9')](),controller[_0xb396('0xa')]);router['delete'](_0xb396('0xb'),auth[_0xb396('0x9')](),controller[_0xb396('0xc')]);module[_0xb396('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9ec96c7..3023fdb 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x52d770,_0x5d807c){var _0x444c2e=function(_0x556c54){while(--_0x556c54){_0x52d770['push'](_0x52d770['shift']());}};_0x444c2e(++_0x5d807c);}(_0xb10b,0x12a));var _0xbb10=function(_0xe7a99e,_0x4902a1){_0xe7a99e=_0xe7a99e-0x0;var _0x3bef5c=_0xb10b[_0xe7a99e];return _0x3bef5c;};'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 _0xb10b=['name','sequelize','STRING'];(function(_0x2eaebf,_0x49b4b9){var _0x245d39=function(_0x52cd7a){while(--_0x52cd7a){_0x2eaebf['push'](_0x2eaebf['shift']());}};_0x245d39(++_0x49b4b9);}(_0xb10b,0x12a));var _0xbb10=function(_0x45413a,_0x281b1c){_0x45413a=_0x45413a-0x0;var _0x27fe7f=_0xb10b[_0x45413a];return _0x27fe7f;};'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 99e785e..c405248 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 _0x6ad0=['Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','get','role','UserProfileSection','autoAssociation','omit','updatedAt','createdAt','user'];(function(_0x555ec0,_0x3898cc){var _0x1b5944=function(_0x1a7d14){while(--_0x1a7d14){_0x555ec0['push'](_0x555ec0['shift']());}};_0x1b5944(++_0x3898cc);}(_0x6ad0,0x9b));var _0x06ad=function(_0x80c8fc,_0x28d155){_0x80c8fc=_0x80c8fc-0x0;var _0x3fa2f1=_0x6ad0[_0x80c8fc];return _0x3fa2f1;};'use strict';var emlformat=require(_0x06ad('0x0'));var rimraf=require(_0x06ad('0x1'));var zipdir=require(_0x06ad('0x2'));var jsonpatch=require(_0x06ad('0x3'));var rp=require('request-promise');var moment=require(_0x06ad('0x4'));var BPromise=require(_0x06ad('0x5'));var Mustache=require(_0x06ad('0x6'));var util=require('util');var path=require(_0x06ad('0x7'));var sox=require(_0x06ad('0x8'));var csv=require(_0x06ad('0x9'));var ejs=require(_0x06ad('0xa'));var fs=require('fs');var fs_extra=require(_0x06ad('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x06ad('0xc'));var jsforce=require(_0x06ad('0xd'));var deskjs=require(_0x06ad('0xe'));var toCsv=require(_0x06ad('0x9'));var querystring=require(_0x06ad('0xf'));var Papa=require('papaparse');var Redis=require(_0x06ad('0x10'));var authService=require(_0x06ad('0x11'));var qs=require(_0x06ad('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x06ad('0x13'));var utils=require(_0x06ad('0x14'));var config=require(_0x06ad('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x06ad('0x16'))['db'];config[_0x06ad('0x17')]=_[_0x06ad('0x18')](config[_0x06ad('0x17')],{'host':_0x06ad('0x19'),'port':0x18eb});var socket=require(_0x06ad('0x1a'))(new Redis(config[_0x06ad('0x17')]));require(_0x06ad('0x1b'))[_0x06ad('0x1c')](socket);function respondWithStatusCode(_0x4005b4,_0xcefb29){_0xcefb29=_0xcefb29||0xcc;return function(_0x5c4cec){if(_0x5c4cec){return _0x4005b4[_0x06ad('0x1d')](_0xcefb29);}return _0x4005b4[_0x06ad('0x1e')](_0xcefb29)[_0x06ad('0x1f')]();};}function respondWithResult(_0x5f060e,_0x53d4ab){_0x53d4ab=_0x53d4ab||0xc8;return function(_0x1c61fa){if(_0x1c61fa){return _0x5f060e['status'](_0x53d4ab)['json'](_0x1c61fa);}};}function respondWithFilteredResult(_0x5dd2b5,_0x14ef2c){return function(_0x31166e){if(_0x31166e){var _0x21a991=typeof _0x14ef2c[_0x06ad('0x20')]==='undefined'&&typeof _0x14ef2c['limit']===_0x06ad('0x21');var _0x52b59f=_0x31166e['count'];var _0x306e55=_0x21a991?0x0:_0x14ef2c[_0x06ad('0x20')];var _0x4d0f8e=_0x21a991?_0x31166e[_0x06ad('0x22')]:_0x14ef2c['offset']+_0x14ef2c['limit'];var _0x1ace7d;if(_0x4d0f8e>=_0x52b59f){_0x4d0f8e=_0x52b59f;_0x1ace7d=0xc8;}else{_0x1ace7d=0xce;}_0x5dd2b5[_0x06ad('0x1e')](_0x1ace7d);return _0x5dd2b5[_0x06ad('0x23')](_0x06ad('0x24'),_0x306e55+'-'+_0x4d0f8e+'/'+_0x52b59f)[_0x06ad('0x25')](_0x31166e);}return null;};}function patchUpdates(_0x33e94d){return function(_0x423b7e){try{jsonpatch[_0x06ad('0x26')](_0x423b7e,_0x33e94d,!![]);}catch(_0x58104d){return BPromise[_0x06ad('0x27')](_0x58104d);}return _0x423b7e[_0x06ad('0x28')]();};}function saveUpdates(_0x2e69c4,_0x325017){return function(_0x2a4b17){if(_0x2a4b17){return _0x2a4b17[_0x06ad('0x29')](_0x2e69c4)[_0x06ad('0x2a')](function(_0xfcd983){return _0xfcd983;});}return null;};}function removeEntity(_0x4b97f9,_0x8b63a6){return function(_0x1fb553){if(_0x1fb553){return _0x1fb553[_0x06ad('0x2b')]()[_0x06ad('0x2a')](function(){var _0xb279f8=_0x1fb553['get']({'plain':!![]});var _0x4a1cc4=_0x06ad('0x2c');return db[_0x06ad('0x2d')][_0x06ad('0x2b')]({'where':{'type':_0x4a1cc4,'resourceId':_0xb279f8['id']}})[_0x06ad('0x2a')](function(){return _0x1fb553;});})[_0x06ad('0x2a')](function(){_0x4b97f9[_0x06ad('0x1e')](0xcc)[_0x06ad('0x1f')]();});}};}function handleEntityNotFound(_0x576486,_0x88bb6b){return function(_0x1e098a){if(!_0x1e098a){_0x576486[_0x06ad('0x1d')](0x194);}return _0x1e098a;};}function handleError(_0x4e7c14,_0xd55ffc){_0xd55ffc=_0xd55ffc||0x1f4;return function(_0x1024e2){logger['error'](_0x1024e2[_0x06ad('0x2e')]);if(_0x1024e2[_0x06ad('0x2f')]){delete _0x1024e2[_0x06ad('0x2f')];}_0x4e7c14[_0x06ad('0x1e')](_0xd55ffc)[_0x06ad('0x30')](_0x1024e2);};}exports[_0x06ad('0x31')]=function(_0x2dba3d,_0x43195d){var _0x100687={},_0xd18592={},_0x3d5d62={'count':0x0,'rows':[]};var _0x3f05e3=_[_0x06ad('0x32')](db[_0x06ad('0x33')][_0x06ad('0x34')],function(_0x357011){return{'name':_0x357011[_0x06ad('0x35')],'type':_0x357011[_0x06ad('0x36')][_0x06ad('0x37')]};});_0xd18592['model']=_[_0x06ad('0x32')](_0x3f05e3,_0x06ad('0x2f'));_0xd18592[_0x06ad('0x38')]=_['keys'](_0x2dba3d['query']);_0xd18592[_0x06ad('0x39')]=_[_0x06ad('0x3a')](_0xd18592['model'],_0xd18592[_0x06ad('0x38')]);_0x100687[_0x06ad('0x3b')]=_[_0x06ad('0x3a')](_0xd18592[_0x06ad('0x3c')],qs[_0x06ad('0x3d')](_0x2dba3d[_0x06ad('0x38')][_0x06ad('0x3d')]));_0x100687[_0x06ad('0x3b')]=_0x100687[_0x06ad('0x3b')][_0x06ad('0x3e')]?_0x100687[_0x06ad('0x3b')]:_0xd18592[_0x06ad('0x3c')];if(!_0x2dba3d[_0x06ad('0x38')][_0x06ad('0x3f')](_0x06ad('0x40'))){_0x100687[_0x06ad('0x41')]=qs[_0x06ad('0x41')](_0x2dba3d['query'][_0x06ad('0x41')]);_0x100687[_0x06ad('0x20')]=qs[_0x06ad('0x20')](_0x2dba3d['query']['offset']);}_0x100687[_0x06ad('0x42')]=qs['sort'](_0x2dba3d[_0x06ad('0x38')][_0x06ad('0x43')]);_0x100687[_0x06ad('0x44')]=qs[_0x06ad('0x39')](_[_0x06ad('0x45')](_0x2dba3d[_0x06ad('0x38')],_0xd18592[_0x06ad('0x39')]),_0x3f05e3);if(_0x2dba3d[_0x06ad('0x38')][_0x06ad('0x46')]){_0x100687['where']=_[_0x06ad('0x47')](_0x100687[_0x06ad('0x44')],{'$or':_[_0x06ad('0x32')](_0x3f05e3,function(_0x2525f9){if(_0x2525f9[_0x06ad('0x36')]!==_0x06ad('0x48')){var _0x414152={};_0x414152[_0x2525f9[_0x06ad('0x2f')]]={'$like':'%'+_0x2dba3d[_0x06ad('0x38')]['filter']+'%'};return _0x414152;}})});}_0x100687=_[_0x06ad('0x47')]({},_0x100687,_0x2dba3d['options']);var _0x16a57e={'where':_0x100687['where']};return db[_0x06ad('0x33')][_0x06ad('0x22')](_0x16a57e)[_0x06ad('0x2a')](function(_0x3d68ea){_0x3d5d62[_0x06ad('0x22')]=_0x3d68ea;if(_0x2dba3d[_0x06ad('0x38')][_0x06ad('0x49')]){_0x100687[_0x06ad('0x4a')]=[{'all':!![]}];}return db[_0x06ad('0x33')][_0x06ad('0x4b')](_0x100687);})[_0x06ad('0x2a')](function(_0x29b847){_0x3d5d62[_0x06ad('0x4c')]=_0x29b847;return _0x3d5d62;})['then'](respondWithFilteredResult(_0x43195d,_0x100687))[_0x06ad('0x4d')](handleError(_0x43195d,null));};exports[_0x06ad('0x4e')]=function(_0x55e154,_0x3d71a3){var _0x575a70={'raw':![],'where':{'id':_0x55e154[_0x06ad('0x4f')]['id']}},_0x1829e2={};_0x1829e2['model']=_[_0x06ad('0x50')](db['Dashboard']['rawAttributes']);_0x1829e2[_0x06ad('0x38')]=_['keys'](_0x55e154[_0x06ad('0x38')]);_0x1829e2[_0x06ad('0x39')]=_[_0x06ad('0x3a')](_0x1829e2[_0x06ad('0x3c')],_0x1829e2[_0x06ad('0x38')]);_0x575a70[_0x06ad('0x3b')]=_['intersection'](_0x1829e2[_0x06ad('0x3c')],qs[_0x06ad('0x3d')](_0x55e154['query'][_0x06ad('0x3d')]));_0x575a70[_0x06ad('0x3b')]=_0x575a70[_0x06ad('0x3b')][_0x06ad('0x3e')]?_0x575a70[_0x06ad('0x3b')]:_0x1829e2[_0x06ad('0x3c')];if(_0x55e154[_0x06ad('0x38')]['includeAll']){_0x575a70[_0x06ad('0x4a')]=[{'all':!![]}];}_0x575a70=_[_0x06ad('0x47')]({},_0x575a70,_0x55e154[_0x06ad('0x51')]);return db['Dashboard'][_0x06ad('0x52')](_0x575a70)[_0x06ad('0x2a')](handleEntityNotFound(_0x3d71a3,null))[_0x06ad('0x2a')](respondWithResult(_0x3d71a3,null))[_0x06ad('0x4d')](handleError(_0x3d71a3,null));};exports[_0x06ad('0x53')]=function(_0x322b75,_0x21b761){return db[_0x06ad('0x33')]['create'](_0x322b75[_0x06ad('0x54')],{})['then'](function(_0x3e73af){var _0x346b93=_0x322b75['user'][_0x06ad('0x55')]({'plain':!![]});if(!_0x346b93)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x346b93[_0x06ad('0x56')]==='user'){var _0x218df0=_0x3e73af['get']({'plain':!![]});var _0xd2f02d=_0x06ad('0x2c');return db[_0x06ad('0x57')][_0x06ad('0x52')]({'where':{'name':_0xd2f02d,'userProfileId':_0x346b93['userProfileId']},'raw':!![]})[_0x06ad('0x2a')](function(_0x565344){if(_0x565344&&_0x565344[_0x06ad('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x218df0[_0x06ad('0x2f')],'resourceId':_0x218df0['id'],'type':_0x565344['name'],'sectionId':_0x565344['id']},{})[_0x06ad('0x2a')](function(){return _0x3e73af;});}else{return _0x3e73af;}})[_0x06ad('0x4d')](function(_0x54051f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54051f);throw _0x54051f;});}return _0x3e73af;})['then'](respondWithResult(_0x21b761,0xc9))[_0x06ad('0x4d')](handleError(_0x21b761,null));};exports['clone']=function(_0x4f30e0,_0x8534f9){var _0x1e282b={'where':{'id':_0x4f30e0[_0x06ad('0x4f')]['id']}},_0x10fd9e={};_0x10fd9e[_0x06ad('0x3c')]=_['keys'](db[_0x06ad('0x33')][_0x06ad('0x34')]);_0x1e282b[_0x06ad('0x3b')]=_[_0x06ad('0x3a')](_0x10fd9e[_0x06ad('0x3c')],qs[_0x06ad('0x3d')](_0x4f30e0[_0x06ad('0x38')][_0x06ad('0x3d')]));_0x1e282b['attributes']=_0x1e282b[_0x06ad('0x3b')]['length']?_0x1e282b[_0x06ad('0x3b')]:_0x10fd9e[_0x06ad('0x3c')];if(_0x4f30e0[_0x06ad('0x38')][_0x06ad('0x49')]){_0x1e282b[_0x06ad('0x4a')]=[{'all':!![]}];}_0x1e282b=_[_0x06ad('0x47')]({},_0x1e282b,_0x4f30e0[_0x06ad('0x51')]);return db[_0x06ad('0x33')][_0x06ad('0x52')](_0x1e282b)['then'](handleEntityNotFound(_0x8534f9,null))[_0x06ad('0x2a')](function(_0x182f8f){if(_0x182f8f){var _0xd89fa0=_0x182f8f['get']({'plain':!![]});_0xd89fa0=qs[_0x06ad('0x59')](_0xd89fa0,['id','createdAt',_0x06ad('0x5a')]);_0x4f30e0[_0x06ad('0x54')]=_[_0x06ad('0x59')](_0x4f30e0[_0x06ad('0x54')],['id',_0x06ad('0x5b'),'updatedAt']);return db[_0x06ad('0x33')]['create'](_[_0x06ad('0x47')](_0xd89fa0,_0x4f30e0[_0x06ad('0x54')]),{'include':_0x4f30e0[_0x06ad('0x38')][_0x06ad('0x49')]?[{'all':!![]}]:undefined})[_0x06ad('0x2a')](function(_0x4b85ec){var _0x2cdf8a=_0x4f30e0[_0x06ad('0x5c')][_0x06ad('0x55')]({'plain':!![]});if(!_0x2cdf8a)throw new Error(_0x06ad('0x5d'));if(_0x2cdf8a['role']==='user'){var _0x9692c0=_0x4b85ec[_0x06ad('0x55')]({'plain':!![]});var _0x230878=_0x06ad('0x2c');return db[_0x06ad('0x57')]['find']({'where':{'name':_0x230878,'userProfileId':_0x2cdf8a[_0x06ad('0x5e')]},'raw':!![]})[_0x06ad('0x2a')](function(_0x25b4c0){if(_0x25b4c0&&_0x25b4c0[_0x06ad('0x58')]===0x0){return db['UserProfileResource'][_0x06ad('0x53')]({'name':_0x9692c0[_0x06ad('0x2f')],'resourceId':_0x9692c0['id'],'type':_0x25b4c0[_0x06ad('0x2f')],'sectionId':_0x25b4c0['id']},{})[_0x06ad('0x2a')](function(){return _0x4b85ec;});}else{return _0x4b85ec;}})[_0x06ad('0x4d')](function(_0x3b7682){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b7682);throw _0x3b7682;});}return _0x4b85ec;});}})[_0x06ad('0x2a')](respondWithResult(_0x8534f9,0xc9))['catch'](handleError(_0x8534f9,null));};exports[_0x06ad('0x29')]=function(_0x5869c9,_0x3fa677){if(_0x5869c9[_0x06ad('0x54')]['id']){delete _0x5869c9[_0x06ad('0x54')]['id'];}return db['Dashboard'][_0x06ad('0x52')]({'where':{'id':_0x5869c9[_0x06ad('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3fa677,null))[_0x06ad('0x2a')](saveUpdates(_0x5869c9['body'],null))['then'](respondWithResult(_0x3fa677,null))[_0x06ad('0x4d')](handleError(_0x3fa677,null));};exports[_0x06ad('0x2b')]=function(_0x425b8f,_0x26d06a){return db['Dashboard'][_0x06ad('0x52')]({'where':{'id':_0x425b8f[_0x06ad('0x4f')]['id']}})[_0x06ad('0x2a')](handleEntityNotFound(_0x26d06a,null))[_0x06ad('0x2a')](removeEntity(_0x26d06a,null))[_0x06ad('0x4d')](handleError(_0x26d06a,null));};function widgetAttributes(_0x748dcb){try{switch(_0x748dcb[_0x06ad('0x36')]){case _0x06ad('0x5f'):return[{'name':_0x06ad('0x60'),'value':_0x748dcb[_0x06ad('0x60')]||(_0x748dcb['attrs']&&_0x748dcb[_0x06ad('0x61')][0x0]?_0x748dcb[_0x06ad('0x61')][0x0][_0x06ad('0x62')]:undefined)||_0x06ad('0x63')}];case'custom':return[{'name':'attrPath','value':_0x748dcb[_0x06ad('0x64')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb['attrs'][0x0]?_0x748dcb[_0x06ad('0x61')][0x0][_0x06ad('0x62')]:undefined)||''}];case _0x06ad('0x65'):return[{'name':_0x06ad('0x66'),'value':_0x748dcb[_0x06ad('0x66')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb['attrs'][0x0]?_0x748dcb[_0x06ad('0x61')][0x0]['value']:undefined)||_0x06ad('0x67')},{'name':_0x06ad('0x68'),'value':_0x748dcb[_0x06ad('0x68')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb['attrs'][0x1]?_0x748dcb['attrs'][0x1][_0x06ad('0x62')]:undefined)||'0.00'},{'name':_0x06ad('0x69'),'value':_0x748dcb[_0x06ad('0x69')]||(_0x748dcb['attrs']&&_0x748dcb[_0x06ad('0x61')][0x2]?_0x748dcb[_0x06ad('0x61')][0x2][_0x06ad('0x62')]:undefined)||0xc}];case _0x06ad('0x6a'):return[{'name':_0x06ad('0x6b'),'value':_0x748dcb[_0x06ad('0x6b')]||(_0x748dcb['attrs']&&_0x748dcb[_0x06ad('0x61')][0x0]?_0x748dcb[_0x06ad('0x61')][0x0][_0x06ad('0x62')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x748dcb['attrVoiceQueues']||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb['attrs'][0x1]?_0x748dcb['attrs'][0x1][_0x06ad('0x62')]:undefined)||[]},{'name':_0x06ad('0x69'),'value':_0x748dcb[_0x06ad('0x69')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb[_0x06ad('0x61')][0x2]?_0x748dcb['attrs'][0x2][_0x06ad('0x62')]:undefined)||0x14}];case _0x06ad('0x6c'):case'pie-chart':return[{'name':_0x06ad('0x6d'),'value':_0x748dcb[_0x06ad('0x6d')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb[_0x06ad('0x61')][0x0]?_0x748dcb[_0x06ad('0x61')][0x0][_0x06ad('0x62')]:undefined)||_0x06ad('0x6e')},{'name':_0x06ad('0x6f'),'value':_0x748dcb[_0x06ad('0x6f')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb[_0x06ad('0x61')][0x1]?_0x748dcb[_0x06ad('0x61')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x748dcb[_0x06ad('0x70')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb['attrs'][0x2]?_0x748dcb[_0x06ad('0x61')][0x2][_0x06ad('0x62')]:undefined)||null},{'name':_0x06ad('0x71'),'value':_0x748dcb[_0x06ad('0x71')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb[_0x06ad('0x61')][0x3]?_0x748dcb[_0x06ad('0x61')][0x3]['value']:undefined)||[]}];case _0x06ad('0x72'):return[{'name':_0x06ad('0x73'),'type':_0x748dcb[_0x06ad('0x74')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb[_0x06ad('0x61')][0x0]?_0x748dcb['attrs'][0x0][_0x06ad('0x36')]:undefined)||null,'value':_0x748dcb[_0x06ad('0x73')]||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb['attrs'][0x0]?_0x748dcb[_0x06ad('0x61')][0x0][_0x06ad('0x62')]:undefined)||null},{'name':_0x06ad('0x75'),'value':_0x748dcb['attrRefresh']||(_0x748dcb[_0x06ad('0x61')]&&_0x748dcb[_0x06ad('0x61')][0x1]?_0x748dcb[_0x06ad('0x61')][0x1][_0x06ad('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x459fd2){logger[_0x06ad('0x76')](_0x06ad('0x77'),JSON[_0x06ad('0x78')](_0x459fd2));return[];}}exports['addItem']=function(_0x2ae27a,_0x51fdd6,_0x5dda7b){if(_0x2ae27a[_0x06ad('0x54')]['id']){delete _0x2ae27a[_0x06ad('0x54')]['id'];}return db[_0x06ad('0x33')][_0x06ad('0x52')]({'where':{'id':_0x2ae27a['params']['id']}})[_0x06ad('0x2a')](handleEntityNotFound(_0x51fdd6,null))['then'](function(_0x572799){if(_0x572799){_0x2ae27a[_0x06ad('0x54')][_0x06ad('0x79')]=_0x572799['id'];_0x2ae27a['body'][_0x06ad('0x61')]=widgetAttributes(_0x2ae27a[_0x06ad('0x54')]);return db[_0x06ad('0x7a')][_0x06ad('0x53')](_0x2ae27a['body']);}})['then'](respondWithResult(_0x51fdd6,null))[_0x06ad('0x4d')](handleError(_0x51fdd6,null));};exports[_0x06ad('0x7b')]=function(_0x41d9d3,_0x344695,_0x1263b1){var _0x2b77e8={};var _0x3f7068={};var _0x2ff183;var _0x40ae51;return db[_0x06ad('0x33')]['findOne']({'where':{'id':_0x41d9d3[_0x06ad('0x4f')]['id']}})[_0x06ad('0x2a')](handleEntityNotFound(_0x344695,null))['then'](function(_0x446c29){if(_0x446c29){_0x2ff183=_0x446c29;_0x3f7068[_0x06ad('0x3c')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x3f7068[_0x06ad('0x38')]=_[_0x06ad('0x50')](_0x41d9d3[_0x06ad('0x38')]);_0x3f7068['filters']=_[_0x06ad('0x3a')](_0x3f7068['model'],_0x3f7068[_0x06ad('0x38')]);_0x2b77e8[_0x06ad('0x3b')]=_[_0x06ad('0x3a')](_0x3f7068[_0x06ad('0x3c')],qs[_0x06ad('0x3d')](_0x41d9d3[_0x06ad('0x38')][_0x06ad('0x3d')]));_0x2b77e8[_0x06ad('0x3b')]=_0x2b77e8[_0x06ad('0x3b')]['length']?_0x2b77e8[_0x06ad('0x3b')]:_0x3f7068[_0x06ad('0x3c')];_0x2b77e8[_0x06ad('0x42')]=qs[_0x06ad('0x43')](_0x41d9d3[_0x06ad('0x38')][_0x06ad('0x43')]);_0x2b77e8['where']=qs['filters'](_[_0x06ad('0x45')](_0x41d9d3[_0x06ad('0x38')],_0x3f7068[_0x06ad('0x39')]));if(_0x41d9d3[_0x06ad('0x38')][_0x06ad('0x46')]){_0x2b77e8[_0x06ad('0x44')]=_[_0x06ad('0x47')](_0x2b77e8[_0x06ad('0x44')],{'$or':_[_0x06ad('0x32')](_0x2b77e8['attributes'],function(_0x1c3910){var _0x480625={};_0x480625[_0x1c3910]={'$like':'%'+_0x41d9d3[_0x06ad('0x38')]['filter']+'%'};return _0x480625;})});}_0x2b77e8=_['merge']({},_0x2b77e8,_0x41d9d3['options']);return _0x2ff183[_0x06ad('0x7b')](_0x2b77e8);}})['then'](function(_0xda73f7){if(_0xda73f7){_0x40ae51=_0xda73f7['length'];if(!_0x41d9d3[_0x06ad('0x38')][_0x06ad('0x3f')]('nolimit')){_0x2b77e8['limit']=qs[_0x06ad('0x41')](_0x41d9d3[_0x06ad('0x38')][_0x06ad('0x41')]);_0x2b77e8[_0x06ad('0x20')]=qs['offset'](_0x41d9d3[_0x06ad('0x38')]['offset']);}return _0x2ff183[_0x06ad('0x7b')](_0x2b77e8);}})['then'](function(_0x3dcc20){if(_0x3dcc20){return _0x3dcc20?{'count':_0x40ae51,'rows':_0x3dcc20}:null;}})[_0x06ad('0x2a')](respondWithResult(_0x344695,null))[_0x06ad('0x4d')](handleError(_0x344695,null));}; \ No newline at end of file +var _0xf8b9=['getItems','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./dashboard.socket','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','index','Dashboard','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','body','omit','updatedAt','UserProfileSection','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne'];(function(_0x3005c7,_0x39d5a5){var _0x17d49c=function(_0x485108){while(--_0x485108){_0x3005c7['push'](_0x3005c7['shift']());}};_0x17d49c(++_0x39d5a5);}(_0xf8b9,0x1e5));var _0x9f8b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8b9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9f8b('0x0'));var rimraf=require(_0x9f8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f8b('0x2'));var rp=require(_0x9f8b('0x3'));var moment=require(_0x9f8b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9f8b('0x5'));var util=require(_0x9f8b('0x6'));var path=require('path');var sox=require(_0x9f8b('0x7'));var csv=require(_0x9f8b('0x8'));var ejs=require(_0x9f8b('0x9'));var fs=require('fs');var fs_extra=require(_0x9f8b('0xa'));var _=require(_0x9f8b('0xb'));var squel=require(_0x9f8b('0xc'));var crypto=require(_0x9f8b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9f8b('0xe'));var toCsv=require(_0x9f8b('0x8'));var querystring=require(_0x9f8b('0xf'));var Papa=require(_0x9f8b('0x10'));var Redis=require(_0x9f8b('0x11'));var authService=require(_0x9f8b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f8b('0x13'));var logger=require(_0x9f8b('0x14'))(_0x9f8b('0x15'));var utils=require(_0x9f8b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9f8b('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9f8b('0x18')],{'host':_0x9f8b('0x19'),'port':0x18eb});var socket=require(_0x9f8b('0x1a'))(new Redis(config[_0x9f8b('0x18')]));require(_0x9f8b('0x1b'))['register'](socket);function respondWithStatusCode(_0x47495b,_0x237e68){_0x237e68=_0x237e68||0xcc;return function(_0x23405b){if(_0x23405b){return _0x47495b['sendStatus'](_0x237e68);}return _0x47495b['status'](_0x237e68)[_0x9f8b('0x1c')]();};}function respondWithResult(_0x49350d,_0x3f4fea){_0x3f4fea=_0x3f4fea||0xc8;return function(_0x425d16){if(_0x425d16){return _0x49350d['status'](_0x3f4fea)[_0x9f8b('0x1d')](_0x425d16);}};}function respondWithFilteredResult(_0x13fd52,_0x3b91fa){return function(_0x8711ab){if(_0x8711ab){var _0x35edb9=typeof _0x3b91fa[_0x9f8b('0x1e')]===_0x9f8b('0x1f')&&typeof _0x3b91fa[_0x9f8b('0x20')]==='undefined';var _0x15a058=_0x8711ab[_0x9f8b('0x21')];var _0x48ec07=_0x35edb9?0x0:_0x3b91fa[_0x9f8b('0x1e')];var _0x400736=_0x35edb9?_0x8711ab[_0x9f8b('0x21')]:_0x3b91fa[_0x9f8b('0x1e')]+_0x3b91fa['limit'];var _0x573876;if(_0x400736>=_0x15a058){_0x400736=_0x15a058;_0x573876=0xc8;}else{_0x573876=0xce;}_0x13fd52[_0x9f8b('0x22')](_0x573876);return _0x13fd52[_0x9f8b('0x23')]('Content-Range',_0x48ec07+'-'+_0x400736+'/'+_0x15a058)[_0x9f8b('0x1d')](_0x8711ab);}return null;};}function patchUpdates(_0x2ce116){return function(_0x2df23f){try{jsonpatch[_0x9f8b('0x24')](_0x2df23f,_0x2ce116,!![]);}catch(_0x27d713){return BPromise[_0x9f8b('0x25')](_0x27d713);}return _0x2df23f[_0x9f8b('0x26')]();};}function saveUpdates(_0x2703d5,_0x3ec3b2){return function(_0x5c328d){if(_0x5c328d){return _0x5c328d[_0x9f8b('0x27')](_0x2703d5)[_0x9f8b('0x28')](function(_0x172be8){return _0x172be8;});}return null;};}function removeEntity(_0x48add6,_0x3496bd){return function(_0x482be9){if(_0x482be9){return _0x482be9[_0x9f8b('0x29')]()['then'](function(){var _0x1e9c9b=_0x482be9[_0x9f8b('0x2a')]({'plain':!![]});var _0x4e5232=_0x9f8b('0x2b');return db[_0x9f8b('0x2c')][_0x9f8b('0x29')]({'where':{'type':_0x4e5232,'resourceId':_0x1e9c9b['id']}})[_0x9f8b('0x28')](function(){return _0x482be9;});})[_0x9f8b('0x28')](function(){_0x48add6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fc85e,_0x2025ca){return function(_0x15b9b1){if(!_0x15b9b1){_0x9fc85e['sendStatus'](0x194);}return _0x15b9b1;};}function handleError(_0x5ee4c8,_0x16e9ec){_0x16e9ec=_0x16e9ec||0x1f4;return function(_0x3aa439){logger['error'](_0x3aa439[_0x9f8b('0x2d')]);if(_0x3aa439[_0x9f8b('0x2e')]){delete _0x3aa439[_0x9f8b('0x2e')];}_0x5ee4c8[_0x9f8b('0x22')](_0x16e9ec)['send'](_0x3aa439);};}exports[_0x9f8b('0x2f')]=function(_0x438b65,_0x53366b){var _0x9f1c64={},_0x428184={},_0xf408b7={'count':0x0,'rows':[]};var _0x281b89=_['map'](db[_0x9f8b('0x30')][_0x9f8b('0x31')],function(_0x1a4ac2){return{'name':_0x1a4ac2[_0x9f8b('0x32')],'type':_0x1a4ac2[_0x9f8b('0x33')]['key']};});_0x428184[_0x9f8b('0x34')]=_[_0x9f8b('0x35')](_0x281b89,_0x9f8b('0x2e'));_0x428184[_0x9f8b('0x36')]=_['keys'](_0x438b65[_0x9f8b('0x36')]);_0x428184[_0x9f8b('0x37')]=_[_0x9f8b('0x38')](_0x428184[_0x9f8b('0x34')],_0x428184[_0x9f8b('0x36')]);_0x9f1c64[_0x9f8b('0x39')]=_[_0x9f8b('0x38')](_0x428184[_0x9f8b('0x34')],qs[_0x9f8b('0x3a')](_0x438b65[_0x9f8b('0x36')][_0x9f8b('0x3a')]));_0x9f1c64[_0x9f8b('0x39')]=_0x9f1c64[_0x9f8b('0x39')][_0x9f8b('0x3b')]?_0x9f1c64[_0x9f8b('0x39')]:_0x428184[_0x9f8b('0x34')];if(!_0x438b65['query'][_0x9f8b('0x3c')](_0x9f8b('0x3d'))){_0x9f1c64['limit']=qs['limit'](_0x438b65[_0x9f8b('0x36')]['limit']);_0x9f1c64['offset']=qs['offset'](_0x438b65[_0x9f8b('0x36')][_0x9f8b('0x1e')]);}_0x9f1c64[_0x9f8b('0x3e')]=qs[_0x9f8b('0x3f')](_0x438b65[_0x9f8b('0x36')][_0x9f8b('0x3f')]);_0x9f1c64[_0x9f8b('0x40')]=qs[_0x9f8b('0x37')](_[_0x9f8b('0x41')](_0x438b65[_0x9f8b('0x36')],_0x428184[_0x9f8b('0x37')]),_0x281b89);if(_0x438b65[_0x9f8b('0x36')][_0x9f8b('0x42')]){_0x9f1c64[_0x9f8b('0x40')]=_['merge'](_0x9f1c64[_0x9f8b('0x40')],{'$or':_[_0x9f8b('0x35')](_0x281b89,function(_0x519de1){if(_0x519de1[_0x9f8b('0x33')]!==_0x9f8b('0x43')){var _0x38d767={};_0x38d767[_0x519de1[_0x9f8b('0x2e')]]={'$like':'%'+_0x438b65[_0x9f8b('0x36')]['filter']+'%'};return _0x38d767;}})});}_0x9f1c64=_[_0x9f8b('0x44')]({},_0x9f1c64,_0x438b65[_0x9f8b('0x45')]);var _0x15a2a1={'where':_0x9f1c64['where']};return db['Dashboard'][_0x9f8b('0x21')](_0x15a2a1)['then'](function(_0x85fecb){_0xf408b7['count']=_0x85fecb;if(_0x438b65[_0x9f8b('0x36')][_0x9f8b('0x46')]){_0x9f1c64[_0x9f8b('0x47')]=[{'all':!![]}];}return db[_0x9f8b('0x30')][_0x9f8b('0x48')](_0x9f1c64);})[_0x9f8b('0x28')](function(_0x350fae){_0xf408b7['rows']=_0x350fae;return _0xf408b7;})['then'](respondWithFilteredResult(_0x53366b,_0x9f1c64))['catch'](handleError(_0x53366b,null));};exports['show']=function(_0x5523fb,_0x24ee54){var _0x53e5d2={'raw':![],'where':{'id':_0x5523fb['params']['id']}},_0x4b1cd6={};_0x4b1cd6['model']=_[_0x9f8b('0x49')](db['Dashboard'][_0x9f8b('0x31')]);_0x4b1cd6[_0x9f8b('0x36')]=_['keys'](_0x5523fb[_0x9f8b('0x36')]);_0x4b1cd6[_0x9f8b('0x37')]=_[_0x9f8b('0x38')](_0x4b1cd6[_0x9f8b('0x34')],_0x4b1cd6[_0x9f8b('0x36')]);_0x53e5d2[_0x9f8b('0x39')]=_[_0x9f8b('0x38')](_0x4b1cd6[_0x9f8b('0x34')],qs['fields'](_0x5523fb['query']['fields']));_0x53e5d2[_0x9f8b('0x39')]=_0x53e5d2[_0x9f8b('0x39')]['length']?_0x53e5d2[_0x9f8b('0x39')]:_0x4b1cd6[_0x9f8b('0x34')];if(_0x5523fb[_0x9f8b('0x36')][_0x9f8b('0x46')]){_0x53e5d2[_0x9f8b('0x47')]=[{'all':!![]}];}_0x53e5d2=_[_0x9f8b('0x44')]({},_0x53e5d2,_0x5523fb[_0x9f8b('0x45')]);return db[_0x9f8b('0x30')][_0x9f8b('0x4a')](_0x53e5d2)['then'](handleEntityNotFound(_0x24ee54,null))[_0x9f8b('0x28')](respondWithResult(_0x24ee54,null))['catch'](handleError(_0x24ee54,null));};exports[_0x9f8b('0x4b')]=function(_0x3a8b8f,_0x6e66fd){return db[_0x9f8b('0x30')][_0x9f8b('0x4b')](_0x3a8b8f['body'],{})['then'](function(_0x3d51f5){var _0x2b291f=_0x3a8b8f['user'][_0x9f8b('0x2a')]({'plain':!![]});if(!_0x2b291f)throw new Error(_0x9f8b('0x4c'));if(_0x2b291f[_0x9f8b('0x4d')]===_0x9f8b('0x4e')){var _0x3879ea=_0x3d51f5[_0x9f8b('0x2a')]({'plain':!![]});var _0x52ce19=_0x9f8b('0x2b');return db['UserProfileSection'][_0x9f8b('0x4a')]({'where':{'name':_0x52ce19,'userProfileId':_0x2b291f[_0x9f8b('0x4f')]},'raw':!![]})[_0x9f8b('0x28')](function(_0x579914){if(_0x579914&&_0x579914[_0x9f8b('0x50')]===0x0){return db['UserProfileResource'][_0x9f8b('0x4b')]({'name':_0x3879ea[_0x9f8b('0x2e')],'resourceId':_0x3879ea['id'],'type':_0x579914[_0x9f8b('0x2e')],'sectionId':_0x579914['id']},{})[_0x9f8b('0x28')](function(){return _0x3d51f5;});}else{return _0x3d51f5;}})[_0x9f8b('0x51')](function(_0x71614c){logger[_0x9f8b('0x52')](_0x9f8b('0x53'),_0x71614c);throw _0x71614c;});}return _0x3d51f5;})[_0x9f8b('0x28')](respondWithResult(_0x6e66fd,0xc9))[_0x9f8b('0x51')](handleError(_0x6e66fd,null));};exports[_0x9f8b('0x54')]=function(_0x2f8d90,_0x4554ce){var _0x3fd28a={'where':{'id':_0x2f8d90[_0x9f8b('0x55')]['id']}},_0x4e2671={};_0x4e2671['model']=_[_0x9f8b('0x49')](db[_0x9f8b('0x30')]['rawAttributes']);_0x3fd28a[_0x9f8b('0x39')]=_[_0x9f8b('0x38')](_0x4e2671[_0x9f8b('0x34')],qs[_0x9f8b('0x3a')](_0x2f8d90[_0x9f8b('0x36')][_0x9f8b('0x3a')]));_0x3fd28a[_0x9f8b('0x39')]=_0x3fd28a['attributes'][_0x9f8b('0x3b')]?_0x3fd28a[_0x9f8b('0x39')]:_0x4e2671['model'];if(_0x2f8d90['query'][_0x9f8b('0x46')]){_0x3fd28a[_0x9f8b('0x47')]=[{'all':!![]}];}_0x3fd28a=_[_0x9f8b('0x44')]({},_0x3fd28a,_0x2f8d90[_0x9f8b('0x45')]);return db[_0x9f8b('0x30')][_0x9f8b('0x4a')](_0x3fd28a)[_0x9f8b('0x28')](handleEntityNotFound(_0x4554ce,null))[_0x9f8b('0x28')](function(_0x3475e3){if(_0x3475e3){var _0x536e91=_0x3475e3[_0x9f8b('0x2a')]({'plain':!![]});_0x536e91=qs['omit'](_0x536e91,['id',_0x9f8b('0x56'),'updatedAt']);_0x2f8d90[_0x9f8b('0x57')]=_[_0x9f8b('0x58')](_0x2f8d90[_0x9f8b('0x57')],['id',_0x9f8b('0x56'),_0x9f8b('0x59')]);return db[_0x9f8b('0x30')][_0x9f8b('0x4b')](_[_0x9f8b('0x44')](_0x536e91,_0x2f8d90[_0x9f8b('0x57')]),{'include':_0x2f8d90[_0x9f8b('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1e58a4){var _0x333389=_0x2f8d90[_0x9f8b('0x4e')]['get']({'plain':!![]});if(!_0x333389)throw new Error(_0x9f8b('0x4c'));if(_0x333389['role']===_0x9f8b('0x4e')){var _0x3c3ef5=_0x1e58a4[_0x9f8b('0x2a')]({'plain':!![]});var _0xfee68c=_0x9f8b('0x2b');return db[_0x9f8b('0x5a')][_0x9f8b('0x4a')]({'where':{'name':_0xfee68c,'userProfileId':_0x333389[_0x9f8b('0x4f')]},'raw':!![]})[_0x9f8b('0x28')](function(_0x4119d1){if(_0x4119d1&&_0x4119d1[_0x9f8b('0x50')]===0x0){return db[_0x9f8b('0x2c')][_0x9f8b('0x4b')]({'name':_0x3c3ef5[_0x9f8b('0x2e')],'resourceId':_0x3c3ef5['id'],'type':_0x4119d1[_0x9f8b('0x2e')],'sectionId':_0x4119d1['id']},{})[_0x9f8b('0x28')](function(){return _0x1e58a4;});}else{return _0x1e58a4;}})[_0x9f8b('0x51')](function(_0x1bd0b8){logger[_0x9f8b('0x52')](_0x9f8b('0x53'),_0x1bd0b8);throw _0x1bd0b8;});}return _0x1e58a4;});}})[_0x9f8b('0x28')](respondWithResult(_0x4554ce,0xc9))[_0x9f8b('0x51')](handleError(_0x4554ce,null));};exports['update']=function(_0x30c4b9,_0x49c25a){if(_0x30c4b9[_0x9f8b('0x57')]['id']){delete _0x30c4b9['body']['id'];}return db[_0x9f8b('0x30')][_0x9f8b('0x4a')]({'where':{'id':_0x30c4b9['params']['id']}})[_0x9f8b('0x28')](handleEntityNotFound(_0x49c25a,null))['then'](saveUpdates(_0x30c4b9['body'],null))[_0x9f8b('0x28')](respondWithResult(_0x49c25a,null))[_0x9f8b('0x51')](handleError(_0x49c25a,null));};exports[_0x9f8b('0x29')]=function(_0x5a77fd,_0x9cfd2c){return db[_0x9f8b('0x30')][_0x9f8b('0x4a')]({'where':{'id':_0x5a77fd[_0x9f8b('0x55')]['id']}})['then'](handleEntityNotFound(_0x9cfd2c,null))[_0x9f8b('0x28')](removeEntity(_0x9cfd2c,null))[_0x9f8b('0x51')](handleError(_0x9cfd2c,null));};function widgetAttributes(_0x3a5d4b){try{switch(_0x3a5d4b[_0x9f8b('0x33')]){case'iframe':return[{'name':_0x9f8b('0x5b'),'value':_0x3a5d4b['attrUrl']||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b[_0x9f8b('0x5c')][0x0]?_0x3a5d4b[_0x9f8b('0x5c')][0x0][_0x9f8b('0x5d')]:undefined)||_0x9f8b('0x5e')}];case'custom':return[{'name':_0x9f8b('0x5f'),'value':_0x3a5d4b[_0x9f8b('0x5f')]||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b['attrs'][0x0]?_0x3a5d4b[_0x9f8b('0x5c')][0x0][_0x9f8b('0x5d')]:undefined)||''}];case _0x9f8b('0x60'):return[{'name':_0x9f8b('0x61'),'value':_0x3a5d4b[_0x9f8b('0x61')]||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b[_0x9f8b('0x5c')][0x0]?_0x3a5d4b['attrs'][0x0][_0x9f8b('0x5d')]:undefined)||_0x9f8b('0x62')},{'name':'attrTimezone','value':_0x3a5d4b[_0x9f8b('0x63')]||(_0x3a5d4b['attrs']&&_0x3a5d4b[_0x9f8b('0x5c')][0x1]?_0x3a5d4b[_0x9f8b('0x5c')][0x1][_0x9f8b('0x5d')]:undefined)||_0x9f8b('0x64')},{'name':'attrFontSize','value':_0x3a5d4b[_0x9f8b('0x65')]||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b[_0x9f8b('0x5c')][0x2]?_0x3a5d4b[_0x9f8b('0x5c')][0x2][_0x9f8b('0x5d')]:undefined)||0xc}];case _0x9f8b('0x66'):return[{'name':_0x9f8b('0x67'),'value':_0x3a5d4b[_0x9f8b('0x67')]||(_0x3a5d4b['attrs']&&_0x3a5d4b[_0x9f8b('0x5c')][0x0]?_0x3a5d4b[_0x9f8b('0x5c')][0x0]['value']:undefined)||_0x9f8b('0x68')},{'name':'attrVoiceQueues','value':_0x3a5d4b['attrVoiceQueues']||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b[_0x9f8b('0x5c')][0x1]?_0x3a5d4b[_0x9f8b('0x5c')][0x1][_0x9f8b('0x5d')]:undefined)||[]},{'name':_0x9f8b('0x65'),'value':_0x3a5d4b['attrFontSize']||(_0x3a5d4b['attrs']&&_0x3a5d4b[_0x9f8b('0x5c')][0x2]?_0x3a5d4b[_0x9f8b('0x5c')][0x2][_0x9f8b('0x5d')]:undefined)||0x14}];case _0x9f8b('0x69'):case _0x9f8b('0x6a'):return[{'name':'attrSerie1','value':_0x3a5d4b[_0x9f8b('0x6b')]||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b['attrs'][0x0]?_0x3a5d4b[_0x9f8b('0x5c')][0x0][_0x9f8b('0x5d')]:undefined)||_0x9f8b('0x68')},{'name':'attrSerie2','value':_0x3a5d4b[_0x9f8b('0x6c')]||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b[_0x9f8b('0x5c')][0x1]?_0x3a5d4b['attrs'][0x1][_0x9f8b('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x3a5d4b[_0x9f8b('0x6d')]||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b[_0x9f8b('0x5c')][0x2]?_0x3a5d4b[_0x9f8b('0x5c')][0x2][_0x9f8b('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3a5d4b[_0x9f8b('0x6e')]||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b[_0x9f8b('0x5c')][0x3]?_0x3a5d4b[_0x9f8b('0x5c')][0x3][_0x9f8b('0x5d')]:undefined)||[]}];case'web-report':return[{'name':_0x9f8b('0x6f'),'type':_0x3a5d4b[_0x9f8b('0x70')]||(_0x3a5d4b[_0x9f8b('0x5c')]&&_0x3a5d4b[_0x9f8b('0x5c')][0x0]?_0x3a5d4b[_0x9f8b('0x5c')][0x0][_0x9f8b('0x33')]:undefined)||null,'value':_0x3a5d4b[_0x9f8b('0x6f')]||(_0x3a5d4b['attrs']&&_0x3a5d4b[_0x9f8b('0x5c')][0x0]?_0x3a5d4b[_0x9f8b('0x5c')][0x0][_0x9f8b('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0x3a5d4b[_0x9f8b('0x71')]||(_0x3a5d4b['attrs']&&_0x3a5d4b['attrs'][0x1]?_0x3a5d4b['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1e9d9e){logger[_0x9f8b('0x52')](_0x9f8b('0x72'),JSON[_0x9f8b('0x73')](_0x1e9d9e));return[];}}exports[_0x9f8b('0x74')]=function(_0x860ac,_0x3ff1d1,_0x9aa04){if(_0x860ac[_0x9f8b('0x57')]['id']){delete _0x860ac['body']['id'];}return db[_0x9f8b('0x30')][_0x9f8b('0x4a')]({'where':{'id':_0x860ac[_0x9f8b('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ff1d1,null))[_0x9f8b('0x28')](function(_0xd22bfe){if(_0xd22bfe){_0x860ac[_0x9f8b('0x57')][_0x9f8b('0x75')]=_0xd22bfe['id'];_0x860ac[_0x9f8b('0x57')][_0x9f8b('0x5c')]=widgetAttributes(_0x860ac[_0x9f8b('0x57')]);return db[_0x9f8b('0x76')][_0x9f8b('0x4b')](_0x860ac['body']);}})[_0x9f8b('0x28')](respondWithResult(_0x3ff1d1,null))['catch'](handleError(_0x3ff1d1,null));};exports['getItems']=function(_0x3bb876,_0x46596a,_0x4d633c){var _0x4d4f95={};var _0xfee59={};var _0x1d3978;var _0x2abdec;return db[_0x9f8b('0x30')][_0x9f8b('0x77')]({'where':{'id':_0x3bb876[_0x9f8b('0x55')]['id']}})[_0x9f8b('0x28')](handleEntityNotFound(_0x46596a,null))[_0x9f8b('0x28')](function(_0xd7a4de){if(_0xd7a4de){_0x1d3978=_0xd7a4de;_0xfee59[_0x9f8b('0x34')]=_[_0x9f8b('0x49')](db['DashboardItem'][_0x9f8b('0x31')]);_0xfee59[_0x9f8b('0x36')]=_[_0x9f8b('0x49')](_0x3bb876['query']);_0xfee59[_0x9f8b('0x37')]=_['intersection'](_0xfee59[_0x9f8b('0x34')],_0xfee59['query']);_0x4d4f95[_0x9f8b('0x39')]=_[_0x9f8b('0x38')](_0xfee59['model'],qs[_0x9f8b('0x3a')](_0x3bb876[_0x9f8b('0x36')][_0x9f8b('0x3a')]));_0x4d4f95[_0x9f8b('0x39')]=_0x4d4f95[_0x9f8b('0x39')][_0x9f8b('0x3b')]?_0x4d4f95['attributes']:_0xfee59[_0x9f8b('0x34')];_0x4d4f95['order']=qs[_0x9f8b('0x3f')](_0x3bb876[_0x9f8b('0x36')][_0x9f8b('0x3f')]);_0x4d4f95[_0x9f8b('0x40')]=qs[_0x9f8b('0x37')](_[_0x9f8b('0x41')](_0x3bb876[_0x9f8b('0x36')],_0xfee59[_0x9f8b('0x37')]));if(_0x3bb876[_0x9f8b('0x36')][_0x9f8b('0x42')]){_0x4d4f95[_0x9f8b('0x40')]=_['merge'](_0x4d4f95['where'],{'$or':_[_0x9f8b('0x35')](_0x4d4f95['attributes'],function(_0x2916d4){var _0xc1a8d2={};_0xc1a8d2[_0x2916d4]={'$like':'%'+_0x3bb876['query']['filter']+'%'};return _0xc1a8d2;})});}_0x4d4f95=_['merge']({},_0x4d4f95,_0x3bb876[_0x9f8b('0x45')]);return _0x1d3978[_0x9f8b('0x78')](_0x4d4f95);}})[_0x9f8b('0x28')](function(_0x1069ba){if(_0x1069ba){_0x2abdec=_0x1069ba['length'];if(!_0x3bb876[_0x9f8b('0x36')]['hasOwnProperty'](_0x9f8b('0x3d'))){_0x4d4f95[_0x9f8b('0x20')]=qs[_0x9f8b('0x20')](_0x3bb876[_0x9f8b('0x36')][_0x9f8b('0x20')]);_0x4d4f95[_0x9f8b('0x1e')]=qs['offset'](_0x3bb876['query'][_0x9f8b('0x1e')]);}return _0x1d3978[_0x9f8b('0x78')](_0x4d4f95);}})['then'](function(_0x2024a9){if(_0x2024a9){return _0x2024a9?{'count':_0x2abdec,'rows':_0x2024a9}:null;}})[_0x9f8b('0x28')](respondWithResult(_0x46596a,null))[_0x9f8b('0x51')](handleError(_0x46596a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7b971b4..40d3371 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 _0xf229=['emit','hasOwnProperty','setMaxListeners','save','remove'];(function(_0x578b52,_0x566fc6){var _0x43068c=function(_0x5eb0d0){while(--_0x5eb0d0){_0x578b52['push'](_0x578b52['shift']());}};_0x43068c(++_0x566fc6);}(_0xf229,0xb1));var _0x9f22=function(_0x1c7d66,_0x24cb19){_0x1c7d66=_0x1c7d66-0x0;var _0x50c973=_0xf229[_0x1c7d66];return _0x50c973;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9f22('0x0')](0x0);var events={'afterCreate':_0x9f22('0x1'),'afterUpdate':'update','afterDestroy':_0x9f22('0x2')};function emitEvent(_0x1b4a62){return function(_0x1aa25e,_0x12f033,_0x59dd42){DashboardEvents[_0x9f22('0x3')](_0x1b4a62+':'+_0x1aa25e['id'],_0x1aa25e);DashboardEvents[_0x9f22('0x3')](_0x1b4a62,_0x1aa25e);_0x59dd42(null);};}for(var e in events){if(events[_0x9f22('0x4')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x0d55=['Dashboard','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x528bb5,_0x119c5b){var _0x58e8ca=function(_0x5a8077){while(--_0x5a8077){_0x528bb5['push'](_0x528bb5['shift']());}};_0x58e8ca(++_0x119c5b);}(_0x0d55,0x179));var _0x50d5=function(_0x56702d,_0x14b2e9){_0x56702d=_0x56702d-0x0;var _0x107a02=_0x0d55[_0x56702d];return _0x107a02;};'use strict';var EventEmitter=require(_0x50d5('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x50d5('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50d5('0x2'),'afterUpdate':'update','afterDestroy':_0x50d5('0x3')};function emitEvent(_0x417a0d){return function(_0x1d4fb6,_0x16d217,_0x3320fc){DashboardEvents[_0x50d5('0x4')](_0x417a0d+':'+_0x1d4fb6['id'],_0x1d4fb6);DashboardEvents[_0x50d5('0x4')](_0x417a0d,_0x1d4fb6);_0x3320fc(null);};}for(var e in events){if(events[_0x50d5('0x5')](e)){var event=events[e];Dashboard[_0x50d5('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index d74c70a..0abb79c 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 _0xcd07=['moment','bluebird','path','rimraf','../../config/environment','define','dashboards','lodash','../../config/logger','api'];(function(_0x635d57,_0x45a185){var _0x2f96ff=function(_0x5f3e0f){while(--_0x5f3e0f){_0x635d57['push'](_0x635d57['shift']());}};_0x2f96ff(++_0x45a185);}(_0xcd07,0x1d3));var _0x7cd0=function(_0x2145d1,_0x140c60){_0x2145d1=_0x2145d1-0x0;var _0x2c29b2=_0xcd07[_0x2145d1];return _0x2c29b2;};'use strict';var _=require(_0x7cd0('0x0'));var util=require('util');var logger=require(_0x7cd0('0x1'))(_0x7cd0('0x2'));var moment=require(_0x7cd0('0x3'));var BPromise=require(_0x7cd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cd0('0x5'));var rimraf=require(_0x7cd0('0x6'));var config=require(_0x7cd0('0x7'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x2bbff7,_0x3e9167){return _0x2bbff7[_0x7cd0('0x8')]('Dashboard',attributes,{'tableName':_0x7cd0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe51d=['bluebird','request-promise','rimraf','exports','Dashboard','dashboards','lodash','util','api','moment'];(function(_0x5ba3fd,_0x5cb454){var _0x124b8f=function(_0xcb12f9){while(--_0xcb12f9){_0x5ba3fd['push'](_0x5ba3fd['shift']());}};_0x124b8f(++_0x5cb454);}(_0xe51d,0x9c));var _0xde51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde51('0x0'));var util=require(_0xde51('0x1'));var logger=require('../../config/logger')(_0xde51('0x2'));var moment=require(_0xde51('0x3'));var BPromise=require(_0xde51('0x4'));var rp=require(_0xde51('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde51('0x6'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xde51('0x7')]=function(_0x559039,_0x1f2b0a){return _0x559039['define'](_0xde51('0x8'),attributes,{'tableName':_0xde51('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index a938b5b..9fd081f 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 _0xd69b=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x313d95,_0x361968){var _0x39071c=function(_0x32c919){while(--_0x32c919){_0x313d95['push'](_0x313d95['shift']());}};_0x39071c(++_0x361968);}(_0xd69b,0x137));var _0xbd69=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xd69b[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var util=require(_0xbd69('0x0'));var moment=require(_0xbd69('0x1'));var BPromise=require(_0xbd69('0x2'));var rs=require(_0xbd69('0x3'));var fs=require('fs');var Redis=require(_0xbd69('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd69('0x5'));var logger=require(_0xbd69('0x6'))(_0xbd69('0x7'));var config=require(_0xbd69('0x8'));var jayson=require(_0xbd69('0x9'));var client=jayson[_0xbd69('0xa')][_0xbd69('0xb')]({'port':0x232a});config[_0xbd69('0xc')]=_[_0xbd69('0xd')](config['redis'],{'host':_0xbd69('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbd69('0xf'))[_0xbd69('0x10')](socket);function respondWithRpcPromise(_0x2bd04d,_0x968fca,_0x3b9ec3){return new BPromise(function(_0x450c2c,_0x58bf0b){return client[_0xbd69('0x11')](_0x2bd04d,_0x3b9ec3)[_0xbd69('0x12')](function(_0x18533c){logger[_0xbd69('0x13')](_0xbd69('0x14'),_0x968fca,_0xbd69('0x15'));logger[_0xbd69('0x16')](_0xbd69('0x17'),_0x968fca,_0xbd69('0x15'),JSON[_0xbd69('0x18')](_0x18533c));if(_0x18533c['error']){if(_0x18533c[_0xbd69('0x19')]['code']===0x1f4){logger[_0xbd69('0x19')](_0xbd69('0x14'),_0x968fca,_0x18533c[_0xbd69('0x19')]['message']);return _0x58bf0b(_0x18533c['error']['message']);}logger[_0xbd69('0x19')](_0xbd69('0x14'),_0x968fca,_0x18533c['error'][_0xbd69('0x1a')]);return _0x450c2c(_0x18533c[_0xbd69('0x19')][_0xbd69('0x1a')]);}else{logger['info'](_0xbd69('0x14'),_0x968fca,'request\x20sent');_0x450c2c(_0x18533c[_0xbd69('0x1b')][_0xbd69('0x1a')]);}})[_0xbd69('0x1c')](function(_0x4da6f7){logger[_0xbd69('0x19')](_0xbd69('0x14'),_0x968fca,_0x4da6f7);_0x58bf0b(_0x4da6f7);});});} \ No newline at end of file +var _0x1c7f=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment'];(function(_0x4c5bb5,_0x27e3f3){var _0x5f361e=function(_0x164e6a){while(--_0x164e6a){_0x4c5bb5['push'](_0x4c5bb5['shift']());}};_0x5f361e(++_0x27e3f3);}(_0x1c7f,0x95));var _0xf1c7=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x1c7f[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf1c7('0x0'));var BPromise=require(_0xf1c7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1c7('0x2'));var db=require(_0xf1c7('0x3'))['db'];var utils=require(_0xf1c7('0x4'));var logger=require(_0xf1c7('0x5'))('rpc');var config=require(_0xf1c7('0x6'));var jayson=require(_0xf1c7('0x7'));var client=jayson[_0xf1c7('0x8')][_0xf1c7('0x9')]({'port':0x232a});config[_0xf1c7('0xa')]=_['defaults'](config[_0xf1c7('0xa')],{'host':_0xf1c7('0xb'),'port':0x18eb});var socket=require(_0xf1c7('0xc'))(new Redis(config[_0xf1c7('0xa')]));require(_0xf1c7('0xd'))[_0xf1c7('0xe')](socket);function respondWithRpcPromise(_0x46e441,_0x5b9d6b,_0x8e1ea2){return new BPromise(function(_0x2e1f7a,_0x5a8dbe){return client['request'](_0x46e441,_0x8e1ea2)[_0xf1c7('0xf')](function(_0x38af28){logger[_0xf1c7('0x10')](_0xf1c7('0x11'),_0x5b9d6b,'request\x20sent');logger['debug'](_0xf1c7('0x12'),_0x5b9d6b,_0xf1c7('0x13'),JSON['stringify'](_0x38af28));if(_0x38af28[_0xf1c7('0x14')]){if(_0x38af28[_0xf1c7('0x14')][_0xf1c7('0x15')]===0x1f4){logger[_0xf1c7('0x14')]('Dashboard,\x20%s,\x20%s',_0x5b9d6b,_0x38af28[_0xf1c7('0x14')][_0xf1c7('0x16')]);return _0x5a8dbe(_0x38af28[_0xf1c7('0x14')][_0xf1c7('0x16')]);}logger['error'](_0xf1c7('0x11'),_0x5b9d6b,_0x38af28[_0xf1c7('0x14')]['message']);return _0x2e1f7a(_0x38af28[_0xf1c7('0x14')][_0xf1c7('0x16')]);}else{logger['info'](_0xf1c7('0x11'),_0x5b9d6b,_0xf1c7('0x13'));_0x2e1f7a(_0x38af28[_0xf1c7('0x17')][_0xf1c7('0x16')]);}})[_0xf1c7('0x18')](function(_0xfe178e){logger[_0xf1c7('0x14')](_0xf1c7('0x11'),_0x5b9d6b,_0xfe178e);_0x5a8dbe(_0xfe178e);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 03ae4f7..30d3cb1 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 _0x21e5=['register','dashboard:','./dashboard.events','update','emit','removeListener'];(function(_0x15a718,_0x3c951f){var _0x19f4a4=function(_0x3d0c56){while(--_0x3d0c56){_0x15a718['push'](_0x15a718['shift']());}};_0x19f4a4(++_0x3c951f);}(_0x21e5,0xf8));var _0x521e=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x21e5[_0x2c0dc0];return _0x4c0990;};'use strict';var DashboardEvents=require(_0x521e('0x0'));var events=['save','remove',_0x521e('0x1')];function createListener(_0x2d3496,_0x5d4c60){return function(_0x172510){_0x5d4c60[_0x521e('0x2')](_0x2d3496,_0x172510);};}function removeListener(_0x10872b,_0x1383f8){return function(){DashboardEvents[_0x521e('0x3')](_0x10872b,_0x1383f8);};}exports[_0x521e('0x4')]=function(_0xe8105e){for(var _0x3a5931=0x0,_0x5f16eb=events['length'];_0x3a5931<_0x5f16eb;_0x3a5931++){var _0x2b02c0=events[_0x3a5931];var _0x102498=createListener(_0x521e('0x5')+_0x2b02c0,_0xe8105e);DashboardEvents['on'](_0x2b02c0,_0x102498);}}; \ No newline at end of file +var _0xfed1=['dashboard:','./dashboard.events','save','remove','register'];(function(_0x1fa3b2,_0x42bff4){var _0x23de18=function(_0x7d751d){while(--_0x7d751d){_0x1fa3b2['push'](_0x1fa3b2['shift']());}};_0x23de18(++_0x42bff4);}(_0xfed1,0x150));var _0x1fed=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xfed1[_0x5c2e3e];return _0x53f64a;};'use strict';var DashboardEvents=require(_0x1fed('0x0'));var events=[_0x1fed('0x1'),_0x1fed('0x2'),'update'];function createListener(_0x3ba58a,_0x18b8c0){return function(_0xa4b764){_0x18b8c0['emit'](_0x3ba58a,_0xa4b764);};}function removeListener(_0x35a0a7,_0x498300){return function(){DashboardEvents['removeListener'](_0x35a0a7,_0x498300);};}exports[_0x1fed('0x3')]=function(_0x28ad3e){for(var _0x3029d3=0x0,_0x2fa667=events['length'];_0x3029d3<_0x2fa667;_0x3029d3++){var _0x37df1d=events[_0x3029d3];var _0x5b0da3=createListener(_0x1fed('0x4')+_0x37df1d,_0x28ad3e);DashboardEvents['on'](_0x37df1d,_0x5b0da3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index db0fc6f..a91fe2d 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 _0xd37c=['delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/:id','/:id/items','post','create','/:id/clone','clone','addItem'];(function(_0x4d2f4,_0x226fd3){var _0x17ff99=function(_0xcffaa0){while(--_0xcffaa0){_0x4d2f4['push'](_0x4d2f4['shift']());}};_0x17ff99(++_0x226fd3);}(_0xd37c,0x1df));var _0xcd37=function(_0x2daa65,_0x150edd){_0x2daa65=_0x2daa65-0x0;var _0x3560d1=_0xd37c[_0x2daa65];return _0x3560d1;};'use strict';var multer=require(_0xcd37('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcd37('0x1'));var express=require(_0xcd37('0x2'));var router=express['Router']();var fs_extra=require(_0xcd37('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd37('0x4'));var controller=require('./dashboard.controller');router[_0xcd37('0x5')]('/',auth[_0xcd37('0x6')](),controller['index']);router[_0xcd37('0x5')](_0xcd37('0x7'),auth[_0xcd37('0x6')](),controller['show']);router[_0xcd37('0x5')](_0xcd37('0x8'),auth['isAuthenticated'](),controller['getItems']);router[_0xcd37('0x9')]('/',auth[_0xcd37('0x6')](),controller[_0xcd37('0xa')]);router['post'](_0xcd37('0xb'),auth[_0xcd37('0x6')](),controller[_0xcd37('0xc')]);router[_0xcd37('0x9')]('/:id/items',auth[_0xcd37('0x6')](),controller[_0xcd37('0xd')]);router['put'](_0xcd37('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xcd37('0xe')]('/:id',auth[_0xcd37('0x6')](),controller[_0xcd37('0xf')]);module[_0xcd37('0x10')]=router; \ No newline at end of file +var _0x542c=['delete','exports','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/items','post','create','/:id/clone','clone','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x542c,0x19a));var _0xc542=function(_0x316f28,_0x306e7b){_0x316f28=_0x316f28-0x0;var _0x44c18f=_0x542c[_0x316f28];return _0x44c18f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc542('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc542('0x1'));var auth=require(_0xc542('0x2'));var interaction=require(_0xc542('0x3'));var config=require(_0xc542('0x4'));var controller=require('./dashboard.controller');router[_0xc542('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xc542('0x6')](),controller[_0xc542('0x7')]);router[_0xc542('0x5')](_0xc542('0x8'),auth['isAuthenticated'](),controller['getItems']);router[_0xc542('0x9')]('/',auth[_0xc542('0x6')](),controller[_0xc542('0xa')]);router[_0xc542('0x9')](_0xc542('0xb'),auth[_0xc542('0x6')](),controller[_0xc542('0xc')]);router[_0xc542('0x9')](_0xc542('0x8'),auth[_0xc542('0x6')](),controller['addItem']);router[_0xc542('0xd')](_0xc542('0xe'),auth[_0xc542('0x6')](),controller['update']);router[_0xc542('0xf')](_0xc542('0xe'),auth[_0xc542('0x6')](),controller['destroy']);module[_0xc542('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 492ec88..c9bca0e 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 _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x1261,0x144));var _0x1126=function(_0x56ca61,_0x187321){_0x56ca61=_0x56ca61-0x0;var _0x1e7bee=_0x1261[_0x56ca61];return _0x1e7bee;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1261,0x144));var _0x1126=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0x1261[_0x53417c];return _0x49407d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 6b907ce..eccda3b 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 _0x1a5c=['total','attrVoiceQueues','attrFontSize','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','name','send','show','model','keys','DashboardItem','rawAttributes','intersection','fields','query','attributes','includeAll','include','merge','find','catch','params','type','iframe','attrUrl','attrs','https://','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrMetric'];(function(_0x38b100,_0x177901){var _0x2bece2=function(_0x39b7d3){while(--_0x39b7d3){_0x38b100['push'](_0x38b100['shift']());}};_0x2bece2(++_0x177901);}(_0x1a5c,0x6a));var _0xc1a5=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x1a5c[_0x5c9307];return _0x373e29;};'use strict';var emlformat=require(_0xc1a5('0x0'));var rimraf=require(_0xc1a5('0x1'));var zipdir=require(_0xc1a5('0x2'));var jsonpatch=require(_0xc1a5('0x3'));var rp=require(_0xc1a5('0x4'));var moment=require(_0xc1a5('0x5'));var BPromise=require(_0xc1a5('0x6'));var Mustache=require(_0xc1a5('0x7'));var util=require(_0xc1a5('0x8'));var path=require(_0xc1a5('0x9'));var sox=require(_0xc1a5('0xa'));var csv=require(_0xc1a5('0xb'));var ejs=require(_0xc1a5('0xc'));var fs=require('fs');var fs_extra=require(_0xc1a5('0xd'));var _=require(_0xc1a5('0xe'));var squel=require('squel');var crypto=require(_0xc1a5('0xf'));var jsforce=require(_0xc1a5('0x10'));var deskjs=require(_0xc1a5('0x11'));var toCsv=require(_0xc1a5('0xb'));var querystring=require('querystring');var Papa=require(_0xc1a5('0x12'));var Redis=require(_0xc1a5('0x13'));var authService=require(_0xc1a5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1a5('0x15'));var hardwareService=require(_0xc1a5('0x16'));var logger=require(_0xc1a5('0x17'))(_0xc1a5('0x18'));var utils=require(_0xc1a5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc1a5('0x1a'));var db=require(_0xc1a5('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc1a5('0x1c'))(new Redis(config['redis']));require(_0xc1a5('0x1d'))[_0xc1a5('0x1e')](socket);function respondWithStatusCode(_0x3cbbb3,_0x4fbbb3){_0x4fbbb3=_0x4fbbb3||0xcc;return function(_0x1d220a){if(_0x1d220a){return _0x3cbbb3[_0xc1a5('0x1f')](_0x4fbbb3);}return _0x3cbbb3[_0xc1a5('0x20')](_0x4fbbb3)[_0xc1a5('0x21')]();};}function respondWithResult(_0x4c8a50,_0x11f960){_0x11f960=_0x11f960||0xc8;return function(_0x101466){if(_0x101466){return _0x4c8a50['status'](_0x11f960)[_0xc1a5('0x22')](_0x101466);}};}function respondWithFilteredResult(_0x30c72f,_0x4a8080){return function(_0x3cd220){if(_0x3cd220){var _0xdde87d=typeof _0x4a8080[_0xc1a5('0x23')]===_0xc1a5('0x24')&&typeof _0x4a8080[_0xc1a5('0x25')]==='undefined';var _0x54a5c5=_0x3cd220['count'];var _0x4b735e=_0xdde87d?0x0:_0x4a8080[_0xc1a5('0x23')];var _0x4cbecf=_0xdde87d?_0x3cd220[_0xc1a5('0x26')]:_0x4a8080[_0xc1a5('0x23')]+_0x4a8080[_0xc1a5('0x25')];var _0x1e26f5;if(_0x4cbecf>=_0x54a5c5){_0x4cbecf=_0x54a5c5;_0x1e26f5=0xc8;}else{_0x1e26f5=0xce;}_0x30c72f[_0xc1a5('0x20')](_0x1e26f5);return _0x30c72f['set'](_0xc1a5('0x27'),_0x4b735e+'-'+_0x4cbecf+'/'+_0x54a5c5)[_0xc1a5('0x22')](_0x3cd220);}return null;};}function patchUpdates(_0x4610fb){return function(_0x3d8782){try{jsonpatch['apply'](_0x3d8782,_0x4610fb,!![]);}catch(_0x21eb02){return BPromise['reject'](_0x21eb02);}return _0x3d8782[_0xc1a5('0x28')]();};}function saveUpdates(_0x1540b2,_0x224d8c){return function(_0x282c7a){if(_0x282c7a){return _0x282c7a[_0xc1a5('0x29')](_0x1540b2)[_0xc1a5('0x2a')](function(_0x5b8b94){return _0x5b8b94;});}return null;};}function removeEntity(_0x883e51,_0x3abdc1){return function(_0x11a24d){if(_0x11a24d){return _0x11a24d[_0xc1a5('0x2b')]()[_0xc1a5('0x2a')](function(){_0x883e51['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x215a7b,_0x2ccb77){return function(_0x5baed7){if(!_0x5baed7){_0x215a7b[_0xc1a5('0x1f')](0x194);}return _0x5baed7;};}function handleError(_0x20ecd4,_0x3d4992){_0x3d4992=_0x3d4992||0x1f4;return function(_0x1c3942){logger[_0xc1a5('0x2c')](_0x1c3942['stack']);if(_0x1c3942[_0xc1a5('0x2d')]){delete _0x1c3942['name'];}_0x20ecd4[_0xc1a5('0x20')](_0x3d4992)[_0xc1a5('0x2e')](_0x1c3942);};}exports[_0xc1a5('0x2f')]=function(_0x4df385,_0x1c5391){var _0x18d6d3={'raw':![],'where':{'id':_0x4df385['params']['id']}},_0x5e9a18={};_0x5e9a18[_0xc1a5('0x30')]=_[_0xc1a5('0x31')](db[_0xc1a5('0x32')][_0xc1a5('0x33')]);_0x5e9a18['query']=_['keys'](_0x4df385['query']);_0x5e9a18['filters']=_[_0xc1a5('0x34')](_0x5e9a18['model'],_0x5e9a18['query']);_0x18d6d3['attributes']=_[_0xc1a5('0x34')](_0x5e9a18[_0xc1a5('0x30')],qs[_0xc1a5('0x35')](_0x4df385[_0xc1a5('0x36')][_0xc1a5('0x35')]));_0x18d6d3[_0xc1a5('0x37')]=_0x18d6d3[_0xc1a5('0x37')]['length']?_0x18d6d3[_0xc1a5('0x37')]:_0x5e9a18[_0xc1a5('0x30')];if(_0x4df385[_0xc1a5('0x36')][_0xc1a5('0x38')]){_0x18d6d3[_0xc1a5('0x39')]=[{'all':!![]}];}_0x18d6d3=_[_0xc1a5('0x3a')]({},_0x18d6d3,_0x4df385['options']);return db[_0xc1a5('0x32')][_0xc1a5('0x3b')](_0x18d6d3)['then'](handleEntityNotFound(_0x1c5391,null))[_0xc1a5('0x2a')](respondWithResult(_0x1c5391,null))[_0xc1a5('0x3c')](handleError(_0x1c5391,null));};exports['destroy']=function(_0x58c66f,_0x225a2a){return db[_0xc1a5('0x32')][_0xc1a5('0x3b')]({'where':{'id':_0x58c66f[_0xc1a5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x225a2a,null))[_0xc1a5('0x2a')](removeEntity(_0x225a2a,null))['catch'](handleError(_0x225a2a,null));};function widgetAttributes(_0x3546fd){try{switch(_0x3546fd[_0xc1a5('0x3e')]){case _0xc1a5('0x3f'):return[{'name':_0xc1a5('0x40'),'value':_0x3546fd[_0xc1a5('0x40')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x0]?_0x3546fd[_0xc1a5('0x41')][0x0]['value']:undefined)||_0xc1a5('0x42')}];case'custom':return[{'name':'attrPath','value':_0x3546fd[_0xc1a5('0x43')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x0]?_0x3546fd[_0xc1a5('0x41')][0x0][_0xc1a5('0x44')]:undefined)||''}];case'clock':return[{'name':_0xc1a5('0x45'),'value':_0x3546fd[_0xc1a5('0x45')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x0]?_0x3546fd['attrs'][0x0]['value']:undefined)||_0xc1a5('0x46')},{'name':_0xc1a5('0x47'),'value':_0x3546fd[_0xc1a5('0x47')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x1]?_0x3546fd['attrs'][0x1][_0xc1a5('0x44')]:undefined)||_0xc1a5('0x48')},{'name':'attrFontSize','value':_0x3546fd['attrFontSize']||(_0x3546fd['attrs']&&_0x3546fd[_0xc1a5('0x41')][0x2]?_0x3546fd[_0xc1a5('0x41')][0x2][_0xc1a5('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xc1a5('0x49'),'value':_0x3546fd[_0xc1a5('0x49')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x0]?_0x3546fd[_0xc1a5('0x41')][0x0][_0xc1a5('0x44')]:undefined)||_0xc1a5('0x4a')},{'name':'attrVoiceQueues','value':_0x3546fd[_0xc1a5('0x4b')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x1]?_0x3546fd[_0xc1a5('0x41')][0x1]['value']:undefined)||[]},{'name':_0xc1a5('0x4c'),'value':_0x3546fd[_0xc1a5('0x4c')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x2]?_0x3546fd[_0xc1a5('0x41')][0x2]['value']:undefined)||0x14}];case _0xc1a5('0x4d'):case _0xc1a5('0x4e'):return[{'name':_0xc1a5('0x4f'),'value':_0x3546fd['attrSerie1']||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x0]?_0x3546fd['attrs'][0x0][_0xc1a5('0x44')]:undefined)||_0xc1a5('0x4a')},{'name':_0xc1a5('0x50'),'value':_0x3546fd[_0xc1a5('0x50')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd['attrs'][0x1]?_0x3546fd['attrs'][0x1]['value']:undefined)||null},{'name':_0xc1a5('0x51'),'value':_0x3546fd[_0xc1a5('0x51')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x2]?_0x3546fd['attrs'][0x2]['value']:undefined)||null},{'name':_0xc1a5('0x4b'),'value':_0x3546fd[_0xc1a5('0x4b')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x3]?_0x3546fd[_0xc1a5('0x41')][0x3]['value']:undefined)||[]}];case _0xc1a5('0x52'):return[{'name':_0xc1a5('0x53'),'type':_0x3546fd[_0xc1a5('0x54')]||(_0x3546fd['attrs']&&_0x3546fd[_0xc1a5('0x41')][0x0]?_0x3546fd[_0xc1a5('0x41')][0x0]['type']:undefined)||null,'value':_0x3546fd[_0xc1a5('0x53')]||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x0]?_0x3546fd[_0xc1a5('0x41')][0x0][_0xc1a5('0x44')]:undefined)||null},{'name':_0xc1a5('0x55'),'value':_0x3546fd['attrRefresh']||(_0x3546fd[_0xc1a5('0x41')]&&_0x3546fd[_0xc1a5('0x41')][0x1]?_0x3546fd[_0xc1a5('0x41')][0x1][_0xc1a5('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x4cc9a5){logger[_0xc1a5('0x2c')](_0xc1a5('0x56'),JSON[_0xc1a5('0x57')](_0x4cc9a5));return[];}}exports[_0xc1a5('0x58')]=function(_0x48e10d,_0x2603fe){if(_0x48e10d[_0xc1a5('0x59')]){_0x48e10d[_0xc1a5('0x59')][_0xc1a5('0x41')]=widgetAttributes(_0x48e10d['body']);}return db[_0xc1a5('0x32')]['create'](_0x48e10d['body'],{})[_0xc1a5('0x2a')](respondWithResult(_0x2603fe,0xc9))['catch'](handleError(_0x2603fe,null));};exports[_0xc1a5('0x29')]=function(_0xfb18,_0x18ff9f){if(_0xfb18[_0xc1a5('0x59')]['id']){delete _0xfb18[_0xc1a5('0x59')]['id'];}_0xfb18['body'][_0xc1a5('0x41')]=widgetAttributes(_0xfb18[_0xc1a5('0x59')]);return db['DashboardItem']['find']({'where':{'id':_0xfb18[_0xc1a5('0x3d')]['id']}})[_0xc1a5('0x2a')](handleEntityNotFound(_0x18ff9f,null))[_0xc1a5('0x2a')](saveUpdates(_0xfb18['body'],null))[_0xc1a5('0x2a')](respondWithResult(_0x18ff9f,null))['catch'](handleError(_0x18ff9f,null));}; \ No newline at end of file +var _0x08ce=['stack','name','model','DashboardItem','rawAttributes','keys','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','type','iframe','attrUrl','attrs','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','json','offset','undefined','count','status','set','reject','save','update','then','destroy'];(function(_0x25b430,_0x342119){var _0x32d9e3=function(_0x5960bd){while(--_0x5960bd){_0x25b430['push'](_0x25b430['shift']());}};_0x32d9e3(++_0x342119);}(_0x08ce,0x86));var _0xe08c=function(_0x348882,_0x5f5b30){_0x348882=_0x348882-0x0;var _0x3c39fd=_0x08ce[_0x348882];return _0x3c39fd;};'use strict';var emlformat=require(_0xe08c('0x0'));var rimraf=require(_0xe08c('0x1'));var zipdir=require(_0xe08c('0x2'));var jsonpatch=require(_0xe08c('0x3'));var rp=require(_0xe08c('0x4'));var moment=require(_0xe08c('0x5'));var BPromise=require(_0xe08c('0x6'));var Mustache=require(_0xe08c('0x7'));var util=require(_0xe08c('0x8'));var path=require('path');var sox=require(_0xe08c('0x9'));var csv=require('to-csv');var ejs=require(_0xe08c('0xa'));var fs=require('fs');var fs_extra=require(_0xe08c('0xb'));var _=require(_0xe08c('0xc'));var squel=require('squel');var crypto=require(_0xe08c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe08c('0xe'));var toCsv=require(_0xe08c('0xf'));var querystring=require(_0xe08c('0x10'));var Papa=require('papaparse');var Redis=require(_0xe08c('0x11'));var authService=require(_0xe08c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe08c('0x13'));var logger=require(_0xe08c('0x14'))(_0xe08c('0x15'));var utils=require(_0xe08c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe08c('0x17'));var db=require(_0xe08c('0x18'))['db'];config['redis']=_[_0xe08c('0x19')](config[_0xe08c('0x1a')],{'host':_0xe08c('0x1b'),'port':0x18eb});var socket=require(_0xe08c('0x1c'))(new Redis(config['redis']));require(_0xe08c('0x1d'))[_0xe08c('0x1e')](socket);function respondWithStatusCode(_0x53a306,_0x5ce1b1){_0x5ce1b1=_0x5ce1b1||0xcc;return function(_0x303e3b){if(_0x303e3b){return _0x53a306[_0xe08c('0x1f')](_0x5ce1b1);}return _0x53a306['status'](_0x5ce1b1)[_0xe08c('0x20')]();};}function respondWithResult(_0x969580,_0xb840c0){_0xb840c0=_0xb840c0||0xc8;return function(_0x4b0ffe){if(_0x4b0ffe){return _0x969580['status'](_0xb840c0)[_0xe08c('0x21')](_0x4b0ffe);}};}function respondWithFilteredResult(_0x8fc71f,_0x5e5d8b){return function(_0x280c34){if(_0x280c34){var _0x64e4df=typeof _0x5e5d8b[_0xe08c('0x22')]===_0xe08c('0x23')&&typeof _0x5e5d8b['limit']==='undefined';var _0x5a3d4a=_0x280c34[_0xe08c('0x24')];var _0x331de2=_0x64e4df?0x0:_0x5e5d8b['offset'];var _0x89998e=_0x64e4df?_0x280c34[_0xe08c('0x24')]:_0x5e5d8b[_0xe08c('0x22')]+_0x5e5d8b['limit'];var _0x468b03;if(_0x89998e>=_0x5a3d4a){_0x89998e=_0x5a3d4a;_0x468b03=0xc8;}else{_0x468b03=0xce;}_0x8fc71f[_0xe08c('0x25')](_0x468b03);return _0x8fc71f[_0xe08c('0x26')]('Content-Range',_0x331de2+'-'+_0x89998e+'/'+_0x5a3d4a)[_0xe08c('0x21')](_0x280c34);}return null;};}function patchUpdates(_0x70017e){return function(_0x307719){try{jsonpatch['apply'](_0x307719,_0x70017e,!![]);}catch(_0x18d03c){return BPromise[_0xe08c('0x27')](_0x18d03c);}return _0x307719[_0xe08c('0x28')]();};}function saveUpdates(_0x532356,_0x19a7a9){return function(_0x3c9a7b){if(_0x3c9a7b){return _0x3c9a7b[_0xe08c('0x29')](_0x532356)[_0xe08c('0x2a')](function(_0x2b3ead){return _0x2b3ead;});}return null;};}function removeEntity(_0x2a65fd,_0x136806){return function(_0xde5a79){if(_0xde5a79){return _0xde5a79[_0xe08c('0x2b')]()[_0xe08c('0x2a')](function(){_0x2a65fd[_0xe08c('0x25')](0xcc)[_0xe08c('0x20')]();});}};}function handleEntityNotFound(_0x52fcd5,_0x376a64){return function(_0x29a0d7){if(!_0x29a0d7){_0x52fcd5[_0xe08c('0x1f')](0x194);}return _0x29a0d7;};}function handleError(_0x3958d4,_0x4d6d52){_0x4d6d52=_0x4d6d52||0x1f4;return function(_0xdd71a8){logger['error'](_0xdd71a8[_0xe08c('0x2c')]);if(_0xdd71a8[_0xe08c('0x2d')]){delete _0xdd71a8[_0xe08c('0x2d')];}_0x3958d4['status'](_0x4d6d52)['send'](_0xdd71a8);};}exports['show']=function(_0x354b3a,_0x4b7681){var _0x27d30e={'raw':![],'where':{'id':_0x354b3a['params']['id']}},_0x449cd2={};_0x449cd2[_0xe08c('0x2e')]=_['keys'](db[_0xe08c('0x2f')][_0xe08c('0x30')]);_0x449cd2['query']=_[_0xe08c('0x31')](_0x354b3a[_0xe08c('0x32')]);_0x449cd2[_0xe08c('0x33')]=_[_0xe08c('0x34')](_0x449cd2[_0xe08c('0x2e')],_0x449cd2[_0xe08c('0x32')]);_0x27d30e[_0xe08c('0x35')]=_[_0xe08c('0x34')](_0x449cd2[_0xe08c('0x2e')],qs[_0xe08c('0x36')](_0x354b3a['query'][_0xe08c('0x36')]));_0x27d30e[_0xe08c('0x35')]=_0x27d30e['attributes'][_0xe08c('0x37')]?_0x27d30e[_0xe08c('0x35')]:_0x449cd2[_0xe08c('0x2e')];if(_0x354b3a[_0xe08c('0x32')][_0xe08c('0x38')]){_0x27d30e[_0xe08c('0x39')]=[{'all':!![]}];}_0x27d30e=_['merge']({},_0x27d30e,_0x354b3a[_0xe08c('0x3a')]);return db[_0xe08c('0x2f')][_0xe08c('0x3b')](_0x27d30e)[_0xe08c('0x2a')](handleEntityNotFound(_0x4b7681,null))['then'](respondWithResult(_0x4b7681,null))[_0xe08c('0x3c')](handleError(_0x4b7681,null));};exports[_0xe08c('0x2b')]=function(_0x15ef2a,_0x2719c6){return db[_0xe08c('0x2f')][_0xe08c('0x3b')]({'where':{'id':_0x15ef2a['params']['id']}})[_0xe08c('0x2a')](handleEntityNotFound(_0x2719c6,null))[_0xe08c('0x2a')](removeEntity(_0x2719c6,null))[_0xe08c('0x3c')](handleError(_0x2719c6,null));};function widgetAttributes(_0x2f2bdb){try{switch(_0x2f2bdb[_0xe08c('0x3d')]){case _0xe08c('0x3e'):return[{'name':_0xe08c('0x3f'),'value':_0x2f2bdb[_0xe08c('0x3f')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb['attrs'][0x0]?_0x2f2bdb['attrs'][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0xe08c('0x41'),'value':_0x2f2bdb[_0xe08c('0x41')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb['attrs'][0x0]?_0x2f2bdb[_0xe08c('0x40')][0x0]['value']:undefined)||''}];case _0xe08c('0x42'):return[{'name':_0xe08c('0x43'),'value':_0x2f2bdb[_0xe08c('0x43')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb['attrs'][0x0]?_0x2f2bdb[_0xe08c('0x40')][0x0][_0xe08c('0x44')]:undefined)||_0xe08c('0x45')},{'name':'attrTimezone','value':_0x2f2bdb[_0xe08c('0x46')]||(_0x2f2bdb['attrs']&&_0x2f2bdb[_0xe08c('0x40')][0x1]?_0x2f2bdb[_0xe08c('0x40')][0x1]['value']:undefined)||_0xe08c('0x47')},{'name':_0xe08c('0x48'),'value':_0x2f2bdb['attrFontSize']||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb[_0xe08c('0x40')][0x2]?_0x2f2bdb[_0xe08c('0x40')][0x2][_0xe08c('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xe08c('0x49'),'value':_0x2f2bdb[_0xe08c('0x49')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb[_0xe08c('0x40')][0x0]?_0x2f2bdb[_0xe08c('0x40')][0x0][_0xe08c('0x44')]:undefined)||'total'},{'name':_0xe08c('0x4a'),'value':_0x2f2bdb[_0xe08c('0x4a')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb[_0xe08c('0x40')][0x1]?_0x2f2bdb[_0xe08c('0x40')][0x1][_0xe08c('0x44')]:undefined)||[]},{'name':_0xe08c('0x48'),'value':_0x2f2bdb[_0xe08c('0x48')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb['attrs'][0x2]?_0x2f2bdb[_0xe08c('0x40')][0x2][_0xe08c('0x44')]:undefined)||0x14}];case _0xe08c('0x4b'):case _0xe08c('0x4c'):return[{'name':_0xe08c('0x4d'),'value':_0x2f2bdb[_0xe08c('0x4d')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb[_0xe08c('0x40')][0x0]?_0x2f2bdb[_0xe08c('0x40')][0x0][_0xe08c('0x44')]:undefined)||_0xe08c('0x4e')},{'name':_0xe08c('0x4f'),'value':_0x2f2bdb[_0xe08c('0x4f')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb[_0xe08c('0x40')][0x1]?_0x2f2bdb[_0xe08c('0x40')][0x1][_0xe08c('0x44')]:undefined)||null},{'name':_0xe08c('0x50'),'value':_0x2f2bdb['attrSerie3']||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb[_0xe08c('0x40')][0x2]?_0x2f2bdb[_0xe08c('0x40')][0x2][_0xe08c('0x44')]:undefined)||null},{'name':_0xe08c('0x4a'),'value':_0x2f2bdb[_0xe08c('0x4a')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb['attrs'][0x3]?_0x2f2bdb[_0xe08c('0x40')][0x3][_0xe08c('0x44')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x2f2bdb[_0xe08c('0x51')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb[_0xe08c('0x40')][0x0]?_0x2f2bdb['attrs'][0x0]['type']:undefined)||null,'value':_0x2f2bdb['attrReport']||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb['attrs'][0x0]?_0x2f2bdb[_0xe08c('0x40')][0x0][_0xe08c('0x44')]:undefined)||null},{'name':_0xe08c('0x52'),'value':_0x2f2bdb[_0xe08c('0x52')]||(_0x2f2bdb[_0xe08c('0x40')]&&_0x2f2bdb[_0xe08c('0x40')][0x1]?_0x2f2bdb[_0xe08c('0x40')][0x1][_0xe08c('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x4f16de){logger[_0xe08c('0x53')](_0xe08c('0x54'),JSON[_0xe08c('0x55')](_0x4f16de));return[];}}exports[_0xe08c('0x56')]=function(_0xb716e2,_0x3e573b){if(_0xb716e2[_0xe08c('0x57')]){_0xb716e2[_0xe08c('0x57')][_0xe08c('0x40')]=widgetAttributes(_0xb716e2[_0xe08c('0x57')]);}return db[_0xe08c('0x2f')]['create'](_0xb716e2[_0xe08c('0x57')],{})[_0xe08c('0x2a')](respondWithResult(_0x3e573b,0xc9))['catch'](handleError(_0x3e573b,null));};exports[_0xe08c('0x29')]=function(_0x51430c,_0x780781){if(_0x51430c[_0xe08c('0x57')]['id']){delete _0x51430c[_0xe08c('0x57')]['id'];}_0x51430c['body']['attrs']=widgetAttributes(_0x51430c[_0xe08c('0x57')]);return db[_0xe08c('0x2f')]['find']({'where':{'id':_0x51430c[_0xe08c('0x58')]['id']}})[_0xe08c('0x2a')](handleEntityNotFound(_0x780781,null))['then'](saveUpdates(_0x51430c['body'],null))[_0xe08c('0x2a')](respondWithResult(_0x780781,null))['catch'](handleError(_0x780781,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 08e7d18..e4b7a62 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 _0xd03b=['events','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xd03b,0x172));var _0xbd03=function(_0x502cf1,_0x2f7e6d){_0x502cf1=_0x502cf1-0x0;var _0x2b0676=_0xd03b[_0x502cf1];return _0x2b0676;};'use strict';var EventEmitter=require(_0xbd03('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xbd03('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbd03('0x2')](0x0);var events={'afterCreate':_0xbd03('0x3'),'afterUpdate':_0xbd03('0x4'),'afterDestroy':_0xbd03('0x5')};function emitEvent(_0x413190){return function(_0xd5b80b,_0x223d3f,_0x5a2d8b){DashboardItemEvents[_0xbd03('0x6')](_0x413190+':'+_0xd5b80b['id'],_0xd5b80b);DashboardItemEvents[_0xbd03('0x6')](_0x413190,_0xd5b80b);_0x5a2d8b(null);};}for(var e in events){if(events[_0xbd03('0x7')](e)){var event=events[e];DashboardItem[_0xbd03('0x8')](e,emitEvent(event));}}module[_0xbd03('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x78e7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0x78e7,0xb1));var _0x778e=function(_0x45b978,_0x3b26a7){_0x45b978=_0x45b978-0x0;var _0x5e9d46=_0x78e7[_0x45b978];return _0x5e9d46;};'use strict';var EventEmitter=require(_0x778e('0x0'));var DashboardItem=require(_0x778e('0x1'))['db'][_0x778e('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x778e('0x3')](0x0);var events={'afterCreate':_0x778e('0x4'),'afterUpdate':_0x778e('0x5'),'afterDestroy':_0x778e('0x6')};function emitEvent(_0x16c06e){return function(_0x21986f,_0x26bfa1,_0x4ff453){DashboardItemEvents[_0x778e('0x7')](_0x16c06e+':'+_0x21986f['id'],_0x21986f);DashboardItemEvents[_0x778e('0x7')](_0x16c06e,_0x21986f);_0x4ff453(null);};}for(var e in events){if(events[_0x778e('0x8')](e)){var event=events[e];DashboardItem[_0x778e('0x9')](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 98ad49a..e2d9920 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 _0x42c9=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment'];(function(_0x31c097,_0x8aef31){var _0x28cbae=function(_0x1db3e7){while(--_0x1db3e7){_0x31c097['push'](_0x31c097['shift']());}};_0x28cbae(++_0x8aef31);}(_0x42c9,0x1ae));var _0x942c=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x42c9[_0x4fe19c];return _0x952ac7;};'use strict';var _=require(_0x942c('0x0'));var util=require('util');var logger=require(_0x942c('0x1'))(_0x942c('0x2'));var moment=require(_0x942c('0x3'));var BPromise=require(_0x942c('0x4'));var rp=require(_0x942c('0x5'));var fs=require('fs');var path=require(_0x942c('0x6'));var rimraf=require(_0x942c('0x7'));var config=require(_0x942c('0x8'));var attributes=require(_0x942c('0x9'));module[_0x942c('0xa')]=function(_0x26c8fa,_0x173d7e){return _0x26c8fa[_0x942c('0xb')](_0x942c('0xc'),attributes,{'tableName':_0x942c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b24=['../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8b24,0x109));var _0x48b2=function(_0x587adb,_0x3fb95d){_0x587adb=_0x587adb-0x0;var _0x2f8d9e=_0x8b24[_0x587adb];return _0x2f8d9e;};'use strict';var _=require(_0x48b2('0x0'));var util=require(_0x48b2('0x1'));var logger=require(_0x48b2('0x2'))(_0x48b2('0x3'));var moment=require(_0x48b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x48b2('0x5'));var fs=require('fs');var path=require(_0x48b2('0x6'));var rimraf=require(_0x48b2('0x7'));var config=require(_0x48b2('0x8'));var attributes=require(_0x48b2('0x9'));module[_0x48b2('0xa')]=function(_0x5a2a31,_0xe72a11){return _0x5a2a31[_0x48b2('0xb')]('DashboardItem',attributes,{'tableName':_0x48b2('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 5509a3f..43033a6 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 _0x2371=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','util','moment'];(function(_0x3d448b,_0x35a5e7){var _0x3e9476=function(_0x505ee8){while(--_0x505ee8){_0x3d448b['push'](_0x3d448b['shift']());}};_0x3e9476(++_0x35a5e7);}(_0x2371,0x17d));var _0x1237=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x2371[_0x2ff739];return _0x12dc13;};'use strict';var _=require(_0x1237('0x0'));var util=require(_0x1237('0x1'));var moment=require(_0x1237('0x2'));var BPromise=require(_0x1237('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1237('0x4'))['db'];var utils=require(_0x1237('0x5'));var logger=require(_0x1237('0x6'))('rpc');var config=require(_0x1237('0x7'));var jayson=require(_0x1237('0x8'));var client=jayson[_0x1237('0x9')][_0x1237('0xa')]({'port':0x232a});config[_0x1237('0xb')]=_['defaults'](config[_0x1237('0xb')],{'host':_0x1237('0xc'),'port':0x18eb});var socket=require(_0x1237('0xd'))(new Redis(config[_0x1237('0xb')]));require(_0x1237('0xe'))['register'](socket);function respondWithRpcPromise(_0x4d4741,_0xab489d,_0x3d2324){return new BPromise(function(_0x1ed0f0,_0x2ebcd2){return client['request'](_0x4d4741,_0x3d2324)[_0x1237('0xf')](function(_0x48a059){logger['info'](_0x1237('0x10'),_0xab489d,_0x1237('0x11'));logger[_0x1237('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xab489d,_0x1237('0x11'),JSON[_0x1237('0x13')](_0x48a059));if(_0x48a059[_0x1237('0x14')]){if(_0x48a059[_0x1237('0x14')][_0x1237('0x15')]===0x1f4){logger['error'](_0x1237('0x10'),_0xab489d,_0x48a059[_0x1237('0x14')][_0x1237('0x16')]);return _0x2ebcd2(_0x48a059['error']['message']);}logger[_0x1237('0x14')](_0x1237('0x10'),_0xab489d,_0x48a059[_0x1237('0x14')]['message']);return _0x1ed0f0(_0x48a059['error'][_0x1237('0x16')]);}else{logger[_0x1237('0x17')](_0x1237('0x10'),_0xab489d,_0x1237('0x11'));_0x1ed0f0(_0x48a059['result'][_0x1237('0x16')]);}})['catch'](function(_0x2fcbd1){logger[_0x1237('0x14')](_0x1237('0x10'),_0xab489d,_0x2fcbd1);_0x2ebcd2(_0x2fcbd1);});});} \ No newline at end of file +var _0x0692=['jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4c335b,_0x2a4a5d){var _0x329df7=function(_0x9f8830){while(--_0x9f8830){_0x4c335b['push'](_0x4c335b['shift']());}};_0x329df7(++_0x2a4a5d);}(_0x0692,0xc1));var _0x2069=function(_0x1833b6,_0x31937c){_0x1833b6=_0x1833b6-0x0;var _0x4576c9=_0x0692[_0x1833b6];return _0x4576c9;};'use strict';var _=require(_0x2069('0x0'));var util=require(_0x2069('0x1'));var moment=require(_0x2069('0x2'));var BPromise=require(_0x2069('0x3'));var rs=require(_0x2069('0x4'));var fs=require('fs');var Redis=require(_0x2069('0x5'));var db=require(_0x2069('0x6'))['db'];var utils=require(_0x2069('0x7'));var logger=require(_0x2069('0x8'))('rpc');var config=require(_0x2069('0x9'));var jayson=require(_0x2069('0xa'));var client=jayson[_0x2069('0xb')]['http']({'port':0x232a});config[_0x2069('0xc')]=_['defaults'](config[_0x2069('0xc')],{'host':_0x2069('0xd'),'port':0x18eb});var socket=require(_0x2069('0xe'))(new Redis(config[_0x2069('0xc')]));require(_0x2069('0xf'))[_0x2069('0x10')](socket);function respondWithRpcPromise(_0x7a8b76,_0x165f66,_0x21ddef){return new BPromise(function(_0x58a832,_0x2ec924){return client[_0x2069('0x11')](_0x7a8b76,_0x21ddef)['then'](function(_0x288f59){logger[_0x2069('0x12')]('DashboardItem,\x20%s,\x20%s',_0x165f66,'request\x20sent');logger[_0x2069('0x13')](_0x2069('0x14'),_0x165f66,_0x2069('0x15'),JSON[_0x2069('0x16')](_0x288f59));if(_0x288f59[_0x2069('0x17')]){if(_0x288f59[_0x2069('0x17')][_0x2069('0x18')]===0x1f4){logger['error'](_0x2069('0x19'),_0x165f66,_0x288f59[_0x2069('0x17')]['message']);return _0x2ec924(_0x288f59['error'][_0x2069('0x1a')]);}logger[_0x2069('0x17')](_0x2069('0x19'),_0x165f66,_0x288f59[_0x2069('0x17')][_0x2069('0x1a')]);return _0x58a832(_0x288f59['error'][_0x2069('0x1a')]);}else{logger[_0x2069('0x12')]('DashboardItem,\x20%s,\x20%s',_0x165f66,_0x2069('0x15'));_0x58a832(_0x288f59[_0x2069('0x1b')][_0x2069('0x1a')]);}})[_0x2069('0x1c')](function(_0x4413aa){logger['error'](_0x2069('0x19'),_0x165f66,_0x4413aa);_0x2ec924(_0x4413aa);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index e15159c..9276eb7 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 _0x4b95=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','update'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x4b95,0x83));var _0x54b9=function(_0x491139,_0x4cf4e4){_0x491139=_0x491139-0x0;var _0x4334cf=_0x4b95[_0x491139];return _0x4334cf;};'use strict';var DashboardItemEvents=require(_0x54b9('0x0'));var events=['save','remove',_0x54b9('0x1')];function createListener(_0x32ced3,_0x35c548){return function(_0x77e95a){_0x35c548[_0x54b9('0x2')](_0x32ced3,_0x77e95a);};}function removeListener(_0x95f2d9,_0x5365a8){return function(){DashboardItemEvents[_0x54b9('0x3')](_0x95f2d9,_0x5365a8);};}exports[_0x54b9('0x4')]=function(_0x1439e6){for(var _0x5a6e64=0x0,_0x5d488e=events[_0x54b9('0x5')];_0x5a6e64<_0x5d488e;_0x5a6e64++){var _0x42383c=events[_0x5a6e64];var _0x222784=createListener(_0x54b9('0x6')+_0x42383c,_0x1439e6);DashboardItemEvents['on'](_0x42383c,_0x222784);}}; \ No newline at end of file +var _0x5148=['save','update','emit','register','length','./dashboardItem.events'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5148,0x89));var _0x8514=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0x5148[_0x2a5b3b];return _0xae665a;};'use strict';var DashboardItemEvents=require(_0x8514('0x0'));var events=[_0x8514('0x1'),'remove',_0x8514('0x2')];function createListener(_0x1a0954,_0xdb39c9){return function(_0x9fc3df){_0xdb39c9[_0x8514('0x3')](_0x1a0954,_0x9fc3df);};}function removeListener(_0x33e7b0,_0x3f01b5){return function(){DashboardItemEvents['removeListener'](_0x33e7b0,_0x3f01b5);};}exports[_0x8514('0x4')]=function(_0x1fe5a4){for(var _0x2de0da=0x0,_0x35ed73=events[_0x8514('0x5')];_0x2de0da<_0x35ed73;_0x2de0da++){var _0xb0b4fa=events[_0x2de0da];var _0x3b692=createListener('dashboardItem:'+_0xb0b4fa,_0x1fe5a4);DashboardItemEvents['on'](_0xb0b4fa,_0x3b692);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5bfdb8d..c9dc2f7 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 _0xbf64=['/:id','isAuthenticated','show','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xbf64,0xe7));var _0x4bf6=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xbf64[_0x2601b4];return _0x3e3661;};'use strict';var multer=require(_0x4bf6('0x0'));var util=require(_0x4bf6('0x1'));var path=require(_0x4bf6('0x2'));var timeout=require(_0x4bf6('0x3'));var express=require(_0x4bf6('0x4'));var router=express[_0x4bf6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4bf6('0x6'));var config=require(_0x4bf6('0x7'));var controller=require('./dashboardItem.controller');router[_0x4bf6('0x8')](_0x4bf6('0x9'),auth[_0x4bf6('0xa')](),controller[_0x4bf6('0xb')]);router[_0x4bf6('0xc')]('/',auth[_0x4bf6('0xa')](),controller['create']);router['put']('/:id',auth[_0x4bf6('0xa')](),controller[_0x4bf6('0xd')]);router['delete'](_0x4bf6('0x9'),auth['isAuthenticated'](),controller[_0x4bf6('0xe')]);module[_0x4bf6('0xf')]=router; \ No newline at end of file +var _0x73fd=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','create','put','/:id','delete','destroy','exports','multer'];(function(_0x2061de,_0x32a259){var _0x5cdca7=function(_0x572a4d){while(--_0x572a4d){_0x2061de['push'](_0x2061de['shift']());}};_0x5cdca7(++_0x32a259);}(_0x73fd,0x155));var _0xd73f=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0x73fd[_0x4ef734];return _0x33a7cb;};'use strict';var multer=require(_0xd73f('0x0'));var util=require(_0xd73f('0x1'));var path=require(_0xd73f('0x2'));var timeout=require(_0xd73f('0x3'));var express=require('express');var router=express[_0xd73f('0x4')]();var fs_extra=require(_0xd73f('0x5'));var auth=require(_0xd73f('0x6'));var interaction=require(_0xd73f('0x7'));var config=require(_0xd73f('0x8'));var controller=require(_0xd73f('0x9'));router[_0xd73f('0xa')]('/:id',auth[_0xd73f('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd73f('0xc')]);router[_0xd73f('0xd')](_0xd73f('0xe'),auth[_0xd73f('0xb')](),controller['update']);router[_0xd73f('0xf')](_0xd73f('0xe'),auth['isAuthenticated'](),controller[_0xd73f('0x10')]);module[_0xd73f('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 102d189..08c2e6f 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 _0xec34=['sequelize','exports','STRING','ENUM','first','second','third'];(function(_0x5397c6,_0x9c8dc6){var _0x1c6425=function(_0x5a3018){while(--_0x5a3018){_0x5397c6['push'](_0x5397c6['shift']());}};_0x1c6425(++_0x9c8dc6);}(_0xec34,0x157));var _0x4ec3=function(_0x55433e,_0x4e2525){_0x55433e=_0x55433e-0x0;var _0x36cf22=_0xec34[_0x55433e];return _0x36cf22;};'use strict';var Sequelize=require(_0x4ec3('0x0'));module[_0x4ec3('0x1')]={'name':{'type':Sequelize[_0x4ec3('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x4ec3('0x3')](_0x4ec3('0x4'),_0x4ec3('0x5'),_0x4ec3('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x4ec3('0x2')]}}; \ No newline at end of file +var _0x9a6b=['sequelize','exports','ENUM','second','first','STRING'];(function(_0x2377f2,_0x4ed9c2){var _0x4e51f6=function(_0xd863fe){while(--_0xd863fe){_0x2377f2['push'](_0x2377f2['shift']());}};_0x4e51f6(++_0x4ed9c2);}(_0x9a6b,0x1c2));var _0xb9a6=function(_0x5db8e6,_0xf2595c){_0x5db8e6=_0x5db8e6-0x0;var _0x598598=_0x9a6b[_0x5db8e6];return _0x598598;};'use strict';var Sequelize=require(_0xb9a6('0x0'));module[_0xb9a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xb9a6('0x2')]('first',_0xb9a6('0x3'),'third'),'allowNull':![],'defaultValue':_0xb9a6('0x4')},'description':{'type':Sequelize[_0xb9a6('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index bb2aad5..8de4cca 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 _0x2d66=['set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x43ebb8,_0x838a8d){var _0x2a09c3=function(_0x3b61aa){while(--_0x3b61aa){_0x43ebb8['push'](_0x43ebb8['shift']());}};_0x2a09c3(++_0x838a8d);}(_0x2d66,0x18c));var _0x62d6=function(_0x75d633,_0x517cb8){_0x75d633=_0x75d633-0x0;var _0x166ebc=_0x2d66[_0x75d633];return _0x166ebc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62d6('0x0'));var zipdir=require(_0x62d6('0x1'));var jsonpatch=require(_0x62d6('0x2'));var rp=require('request-promise');var moment=require(_0x62d6('0x3'));var BPromise=require(_0x62d6('0x4'));var Mustache=require('mustache');var util=require(_0x62d6('0x5'));var path=require(_0x62d6('0x6'));var sox=require(_0x62d6('0x7'));var csv=require(_0x62d6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62d6('0x9'));var _=require('lodash');var squel=require(_0x62d6('0xa'));var crypto=require(_0x62d6('0xb'));var jsforce=require(_0x62d6('0xc'));var deskjs=require(_0x62d6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x62d6('0xe'));var Papa=require(_0x62d6('0xf'));var Redis=require(_0x62d6('0x10'));var authService=require(_0x62d6('0x11'));var qs=require(_0x62d6('0x12'));var as=require(_0x62d6('0x13'));var hardwareService=require(_0x62d6('0x14'));var logger=require(_0x62d6('0x15'))(_0x62d6('0x16'));var utils=require('../../config/utils');var config=require(_0x62d6('0x17'));var licenseUtil=require(_0x62d6('0x18'));var db=require(_0x62d6('0x19'))['db'];function respondWithStatusCode(_0x393ee6,_0x18bb95){_0x18bb95=_0x18bb95||0xcc;return function(_0x316684){if(_0x316684){return _0x393ee6[_0x62d6('0x1a')](_0x18bb95);}return _0x393ee6[_0x62d6('0x1b')](_0x18bb95)[_0x62d6('0x1c')]();};}function respondWithResult(_0x44fa8b,_0x207f67){_0x207f67=_0x207f67||0xc8;return function(_0x5420a3){if(_0x5420a3){return _0x44fa8b[_0x62d6('0x1b')](_0x207f67)[_0x62d6('0x1d')](_0x5420a3);}};}function respondWithFilteredResult(_0x7eb493,_0x309ccb){return function(_0x1e7ff4){if(_0x1e7ff4){var _0x1af65a=typeof _0x309ccb[_0x62d6('0x1e')]===_0x62d6('0x1f')&&typeof _0x309ccb['limit']===_0x62d6('0x1f');var _0x293366=_0x1e7ff4[_0x62d6('0x20')];var _0x4d5135=_0x1af65a?0x0:_0x309ccb[_0x62d6('0x1e')];var _0x53c804=_0x1af65a?_0x1e7ff4[_0x62d6('0x20')]:_0x309ccb[_0x62d6('0x1e')]+_0x309ccb[_0x62d6('0x21')];var _0x4c3f4f;if(_0x53c804>=_0x293366){_0x53c804=_0x293366;_0x4c3f4f=0xc8;}else{_0x4c3f4f=0xce;}_0x7eb493[_0x62d6('0x1b')](_0x4c3f4f);return _0x7eb493[_0x62d6('0x22')](_0x62d6('0x23'),_0x4d5135+'-'+_0x53c804+'/'+_0x293366)['json'](_0x1e7ff4);}return null;};}function patchUpdates(_0x10a6da){return function(_0xb4653f){try{jsonpatch[_0x62d6('0x24')](_0xb4653f,_0x10a6da,!![]);}catch(_0x59b0bd){return BPromise[_0x62d6('0x25')](_0x59b0bd);}return _0xb4653f[_0x62d6('0x26')]();};}function saveUpdates(_0x287aa5,_0x25897a){return function(_0x1ee373){if(_0x1ee373){return _0x1ee373['update'](_0x287aa5)[_0x62d6('0x27')](function(_0x39034d){return _0x39034d;});}return null;};}function removeEntity(_0x1fb0b2,_0x26f80c){return function(_0x292309){if(_0x292309){return _0x292309[_0x62d6('0x28')]()[_0x62d6('0x27')](function(){var _0x3eb850=_0x292309[_0x62d6('0x29')]({'plain':!![]});var _0x5c60e9='Dispositions';return db[_0x62d6('0x2a')][_0x62d6('0x28')]({'where':{'type':_0x5c60e9,'resourceId':_0x3eb850['id']}})[_0x62d6('0x27')](function(){return _0x292309;});})[_0x62d6('0x27')](function(){_0x1fb0b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x116a23,_0x54d873){return function(_0x31f715){if(!_0x31f715){_0x116a23[_0x62d6('0x1a')](0x194);}return _0x31f715;};}function handleError(_0x45f596,_0x1f3941){_0x1f3941=_0x1f3941||0x1f4;return function(_0x26ecee){logger[_0x62d6('0x2b')](_0x26ecee[_0x62d6('0x2c')]);if(_0x26ecee[_0x62d6('0x2d')]){delete _0x26ecee['name'];}_0x45f596['status'](_0x1f3941)[_0x62d6('0x2e')](_0x26ecee);};}exports[_0x62d6('0x2f')]=function(_0xecf7a8,_0x3565b7){var _0x5b2e91={},_0x2b399d={},_0x5246b4={'count':0x0,'rows':[]};var _0x378cab=_['map'](db['Disposition']['rawAttributes'],function(_0x2716d6){return{'name':_0x2716d6['fieldName'],'type':_0x2716d6[_0x62d6('0x30')]['key']};});_0x2b399d[_0x62d6('0x31')]=_[_0x62d6('0x32')](_0x378cab,'name');_0x2b399d['query']=_[_0x62d6('0x33')](_0xecf7a8[_0x62d6('0x34')]);_0x2b399d[_0x62d6('0x35')]=_[_0x62d6('0x36')](_0x2b399d[_0x62d6('0x31')],_0x2b399d['query']);_0x5b2e91[_0x62d6('0x37')]=_[_0x62d6('0x36')](_0x2b399d[_0x62d6('0x31')],qs[_0x62d6('0x38')](_0xecf7a8[_0x62d6('0x34')][_0x62d6('0x38')]));_0x5b2e91['attributes']=_0x5b2e91[_0x62d6('0x37')][_0x62d6('0x39')]?_0x5b2e91[_0x62d6('0x37')]:_0x2b399d[_0x62d6('0x31')];if(!_0xecf7a8['query'][_0x62d6('0x3a')]('nolimit')){_0x5b2e91[_0x62d6('0x21')]=qs['limit'](_0xecf7a8[_0x62d6('0x34')][_0x62d6('0x21')]);_0x5b2e91[_0x62d6('0x1e')]=qs[_0x62d6('0x1e')](_0xecf7a8[_0x62d6('0x34')][_0x62d6('0x1e')]);}_0x5b2e91[_0x62d6('0x3b')]=qs['sort'](_0xecf7a8[_0x62d6('0x34')][_0x62d6('0x3c')]);_0x5b2e91[_0x62d6('0x3d')]=qs[_0x62d6('0x35')](_[_0x62d6('0x3e')](_0xecf7a8[_0x62d6('0x34')],_0x2b399d['filters']),_0x378cab);if(_0xecf7a8[_0x62d6('0x34')][_0x62d6('0x3f')]){_0x5b2e91[_0x62d6('0x3d')]=_[_0x62d6('0x40')](_0x5b2e91[_0x62d6('0x3d')],{'$or':_[_0x62d6('0x32')](_0x378cab,function(_0x1b0664){if(_0x1b0664['type']!==_0x62d6('0x41')){var _0xf1c5c7={};_0xf1c5c7[_0x1b0664[_0x62d6('0x2d')]]={'$like':'%'+_0xecf7a8[_0x62d6('0x34')][_0x62d6('0x3f')]+'%'};return _0xf1c5c7;}})});}_0x5b2e91=_[_0x62d6('0x40')]({},_0x5b2e91,_0xecf7a8[_0x62d6('0x42')]);var _0x467dd3={'where':_0x5b2e91[_0x62d6('0x3d')]};return db[_0x62d6('0x43')][_0x62d6('0x20')](_0x467dd3)[_0x62d6('0x27')](function(_0x46f5b2){_0x5246b4[_0x62d6('0x20')]=_0x46f5b2;if(_0xecf7a8[_0x62d6('0x34')][_0x62d6('0x44')]){_0x5b2e91[_0x62d6('0x45')]=[{'all':!![]}];}return db[_0x62d6('0x43')][_0x62d6('0x46')](_0x5b2e91);})[_0x62d6('0x27')](function(_0x58d93d){_0x5246b4['rows']=_0x58d93d;return _0x5246b4;})[_0x62d6('0x27')](respondWithFilteredResult(_0x3565b7,_0x5b2e91))['catch'](handleError(_0x3565b7,null));};exports[_0x62d6('0x47')]=function(_0x478fd9,_0xc8eac8){var _0x4e74a3={'raw':!![],'where':{'id':_0x478fd9[_0x62d6('0x48')]['id']}},_0x2393ff={};_0x2393ff['model']=_[_0x62d6('0x33')](db[_0x62d6('0x43')][_0x62d6('0x49')]);_0x2393ff['query']=_['keys'](_0x478fd9[_0x62d6('0x34')]);_0x2393ff['filters']=_[_0x62d6('0x36')](_0x2393ff['model'],_0x2393ff['query']);_0x4e74a3[_0x62d6('0x37')]=_['intersection'](_0x2393ff[_0x62d6('0x31')],qs['fields'](_0x478fd9[_0x62d6('0x34')][_0x62d6('0x38')]));_0x4e74a3[_0x62d6('0x37')]=_0x4e74a3[_0x62d6('0x37')]['length']?_0x4e74a3[_0x62d6('0x37')]:_0x2393ff[_0x62d6('0x31')];if(_0x478fd9[_0x62d6('0x34')][_0x62d6('0x44')]){_0x4e74a3[_0x62d6('0x45')]=[{'all':!![]}];}_0x4e74a3=_['merge']({},_0x4e74a3,_0x478fd9[_0x62d6('0x42')]);return db[_0x62d6('0x43')][_0x62d6('0x4a')](_0x4e74a3)[_0x62d6('0x27')](handleEntityNotFound(_0xc8eac8,null))['then'](respondWithResult(_0xc8eac8,null))['catch'](handleError(_0xc8eac8,null));};exports['create']=function(_0xbfc3f,_0x73e8b5){return db['Disposition'][_0x62d6('0x4b')](_0xbfc3f[_0x62d6('0x4c')],{})[_0x62d6('0x27')](function(_0xc1076a){var _0x345dbe=_0xbfc3f[_0x62d6('0x4d')][_0x62d6('0x29')]({'plain':!![]});if(!_0x345dbe)throw new Error(_0x62d6('0x4e'));if(_0x345dbe[_0x62d6('0x4f')]===_0x62d6('0x4d')){var _0x31c64c=_0xc1076a['get']({'plain':!![]});var _0x48faaa=_0x62d6('0x50');return db[_0x62d6('0x51')][_0x62d6('0x4a')]({'where':{'name':_0x48faaa,'userProfileId':_0x345dbe[_0x62d6('0x52')]},'raw':!![]})[_0x62d6('0x27')](function(_0x523d84){if(_0x523d84&&_0x523d84[_0x62d6('0x53')]===0x0){return db[_0x62d6('0x2a')][_0x62d6('0x4b')]({'name':_0x31c64c[_0x62d6('0x2d')],'resourceId':_0x31c64c['id'],'type':_0x523d84[_0x62d6('0x2d')],'sectionId':_0x523d84['id']},{})['then'](function(){return _0xc1076a;});}else{return _0xc1076a;}})[_0x62d6('0x54')](function(_0x100715){logger['error'](_0x62d6('0x55'),_0x100715);throw _0x100715;});}return _0xc1076a;})[_0x62d6('0x27')](respondWithResult(_0x73e8b5,0xc9))[_0x62d6('0x54')](handleError(_0x73e8b5,null));};exports['update']=function(_0x327d44,_0x3bd4dc){if(_0x327d44['body']['id']){delete _0x327d44['body']['id'];}return db[_0x62d6('0x43')]['find']({'where':{'id':_0x327d44[_0x62d6('0x48')]['id']}})['then'](handleEntityNotFound(_0x3bd4dc,null))[_0x62d6('0x27')](saveUpdates(_0x327d44[_0x62d6('0x4c')],null))[_0x62d6('0x27')](respondWithResult(_0x3bd4dc,null))[_0x62d6('0x54')](handleError(_0x3bd4dc,null));};exports['destroy']=function(_0x1d7b14,_0xb4ee72){return db[_0x62d6('0x43')][_0x62d6('0x4a')]({'where':{'id':_0x1d7b14[_0x62d6('0x48')]['id']}})[_0x62d6('0x27')](handleEntityNotFound(_0xb4ee72,null))[_0x62d6('0x27')](removeEntity(_0xb4ee72,null))[_0x62d6('0x54')](handleError(_0xb4ee72,null));}; \ No newline at end of file +var _0xd89f=['set','Content-Range','json','apply','reject','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status'];(function(_0xfdb185,_0x4d9b2c){var _0x2e0b5f=function(_0x199603){while(--_0x199603){_0xfdb185['push'](_0xfdb185['shift']());}};_0x2e0b5f(++_0x4d9b2c);}(_0xd89f,0x191));var _0xfd89=function(_0x3be1f7,_0x5dc50c){_0x3be1f7=_0x3be1f7-0x0;var _0xbabdee=_0xd89f[_0x3be1f7];return _0xbabdee;};'use strict';var emlformat=require(_0xfd89('0x0'));var rimraf=require(_0xfd89('0x1'));var zipdir=require(_0xfd89('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd89('0x3'));var moment=require(_0xfd89('0x4'));var BPromise=require(_0xfd89('0x5'));var Mustache=require(_0xfd89('0x6'));var util=require(_0xfd89('0x7'));var path=require(_0xfd89('0x8'));var sox=require('sox');var csv=require(_0xfd89('0x9'));var ejs=require(_0xfd89('0xa'));var fs=require('fs');var fs_extra=require(_0xfd89('0xb'));var _=require(_0xfd89('0xc'));var squel=require(_0xfd89('0xd'));var crypto=require(_0xfd89('0xe'));var jsforce=require(_0xfd89('0xf'));var deskjs=require(_0xfd89('0x10'));var toCsv=require(_0xfd89('0x9'));var querystring=require(_0xfd89('0x11'));var Papa=require(_0xfd89('0x12'));var Redis=require(_0xfd89('0x13'));var authService=require(_0xfd89('0x14'));var qs=require(_0xfd89('0x15'));var as=require(_0xfd89('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd89('0x17'))(_0xfd89('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfd89('0x19'));var db=require(_0xfd89('0x1a'))['db'];function respondWithStatusCode(_0x177f7d,_0x2fdd62){_0x2fdd62=_0x2fdd62||0xcc;return function(_0x502c63){if(_0x502c63){return _0x177f7d[_0xfd89('0x1b')](_0x2fdd62);}return _0x177f7d['status'](_0x2fdd62)[_0xfd89('0x1c')]();};}function respondWithResult(_0x78c745,_0x2c3eb4){_0x2c3eb4=_0x2c3eb4||0xc8;return function(_0x4f473c){if(_0x4f473c){return _0x78c745['status'](_0x2c3eb4)['json'](_0x4f473c);}};}function respondWithFilteredResult(_0x13c754,_0x3c0285){return function(_0x5b341b){if(_0x5b341b){var _0x48a64b=typeof _0x3c0285[_0xfd89('0x1d')]===_0xfd89('0x1e')&&typeof _0x3c0285[_0xfd89('0x1f')]==='undefined';var _0x5e8cac=_0x5b341b[_0xfd89('0x20')];var _0x2f64b7=_0x48a64b?0x0:_0x3c0285[_0xfd89('0x1d')];var _0x32054d=_0x48a64b?_0x5b341b[_0xfd89('0x20')]:_0x3c0285[_0xfd89('0x1d')]+_0x3c0285[_0xfd89('0x1f')];var _0x1a1554;if(_0x32054d>=_0x5e8cac){_0x32054d=_0x5e8cac;_0x1a1554=0xc8;}else{_0x1a1554=0xce;}_0x13c754[_0xfd89('0x21')](_0x1a1554);return _0x13c754[_0xfd89('0x22')](_0xfd89('0x23'),_0x2f64b7+'-'+_0x32054d+'/'+_0x5e8cac)[_0xfd89('0x24')](_0x5b341b);}return null;};}function patchUpdates(_0x2eec32){return function(_0x1e9cb3){try{jsonpatch[_0xfd89('0x25')](_0x1e9cb3,_0x2eec32,!![]);}catch(_0x37069c){return BPromise[_0xfd89('0x26')](_0x37069c);}return _0x1e9cb3['save']();};}function saveUpdates(_0x1d09cb,_0x4f74ac){return function(_0x11f1cb){if(_0x11f1cb){return _0x11f1cb['update'](_0x1d09cb)[_0xfd89('0x27')](function(_0x304338){return _0x304338;});}return null;};}function removeEntity(_0x44a82f,_0x30a537){return function(_0x1737b6){if(_0x1737b6){return _0x1737b6[_0xfd89('0x28')]()[_0xfd89('0x27')](function(){var _0x99bf2e=_0x1737b6[_0xfd89('0x29')]({'plain':!![]});var _0xb615fb=_0xfd89('0x2a');return db[_0xfd89('0x2b')][_0xfd89('0x28')]({'where':{'type':_0xb615fb,'resourceId':_0x99bf2e['id']}})[_0xfd89('0x27')](function(){return _0x1737b6;});})['then'](function(){_0x44a82f[_0xfd89('0x21')](0xcc)[_0xfd89('0x1c')]();});}};}function handleEntityNotFound(_0x302094,_0x430983){return function(_0x12abc4){if(!_0x12abc4){_0x302094[_0xfd89('0x1b')](0x194);}return _0x12abc4;};}function handleError(_0x46524b,_0x26a980){_0x26a980=_0x26a980||0x1f4;return function(_0x51a632){logger['error'](_0x51a632[_0xfd89('0x2c')]);if(_0x51a632['name']){delete _0x51a632[_0xfd89('0x2d')];}_0x46524b['status'](_0x26a980)[_0xfd89('0x2e')](_0x51a632);};}exports[_0xfd89('0x2f')]=function(_0x11c21d,_0x5028f9){var _0x1f8d26={},_0x41d6b8={},_0x1f4855={'count':0x0,'rows':[]};var _0x1fe2e5=_[_0xfd89('0x30')](db[_0xfd89('0x31')][_0xfd89('0x32')],function(_0x4d0e3f){return{'name':_0x4d0e3f[_0xfd89('0x33')],'type':_0x4d0e3f['type'][_0xfd89('0x34')]};});_0x41d6b8[_0xfd89('0x35')]=_[_0xfd89('0x30')](_0x1fe2e5,_0xfd89('0x2d'));_0x41d6b8[_0xfd89('0x36')]=_[_0xfd89('0x37')](_0x11c21d[_0xfd89('0x36')]);_0x41d6b8[_0xfd89('0x38')]=_[_0xfd89('0x39')](_0x41d6b8[_0xfd89('0x35')],_0x41d6b8[_0xfd89('0x36')]);_0x1f8d26[_0xfd89('0x3a')]=_['intersection'](_0x41d6b8[_0xfd89('0x35')],qs[_0xfd89('0x3b')](_0x11c21d[_0xfd89('0x36')][_0xfd89('0x3b')]));_0x1f8d26['attributes']=_0x1f8d26[_0xfd89('0x3a')][_0xfd89('0x3c')]?_0x1f8d26[_0xfd89('0x3a')]:_0x41d6b8[_0xfd89('0x35')];if(!_0x11c21d[_0xfd89('0x36')][_0xfd89('0x3d')](_0xfd89('0x3e'))){_0x1f8d26['limit']=qs['limit'](_0x11c21d['query'][_0xfd89('0x1f')]);_0x1f8d26['offset']=qs['offset'](_0x11c21d['query'][_0xfd89('0x1d')]);}_0x1f8d26['order']=qs[_0xfd89('0x3f')](_0x11c21d[_0xfd89('0x36')][_0xfd89('0x3f')]);_0x1f8d26[_0xfd89('0x40')]=qs[_0xfd89('0x38')](_[_0xfd89('0x41')](_0x11c21d[_0xfd89('0x36')],_0x41d6b8['filters']),_0x1fe2e5);if(_0x11c21d[_0xfd89('0x36')][_0xfd89('0x42')]){_0x1f8d26[_0xfd89('0x40')]=_[_0xfd89('0x43')](_0x1f8d26[_0xfd89('0x40')],{'$or':_[_0xfd89('0x30')](_0x1fe2e5,function(_0x268c47){if(_0x268c47[_0xfd89('0x44')]!==_0xfd89('0x45')){var _0x58014c={};_0x58014c[_0x268c47[_0xfd89('0x2d')]]={'$like':'%'+_0x11c21d['query'][_0xfd89('0x42')]+'%'};return _0x58014c;}})});}_0x1f8d26=_[_0xfd89('0x43')]({},_0x1f8d26,_0x11c21d['options']);var _0x14bb39={'where':_0x1f8d26[_0xfd89('0x40')]};return db[_0xfd89('0x31')]['count'](_0x14bb39)[_0xfd89('0x27')](function(_0x552f41){_0x1f4855[_0xfd89('0x20')]=_0x552f41;if(_0x11c21d[_0xfd89('0x36')][_0xfd89('0x46')]){_0x1f8d26[_0xfd89('0x47')]=[{'all':!![]}];}return db[_0xfd89('0x31')][_0xfd89('0x48')](_0x1f8d26);})[_0xfd89('0x27')](function(_0x1f64cf){_0x1f4855[_0xfd89('0x49')]=_0x1f64cf;return _0x1f4855;})[_0xfd89('0x27')](respondWithFilteredResult(_0x5028f9,_0x1f8d26))[_0xfd89('0x4a')](handleError(_0x5028f9,null));};exports[_0xfd89('0x4b')]=function(_0x2e8842,_0x29b5b9){var _0xe2d69f={'raw':!![],'where':{'id':_0x2e8842[_0xfd89('0x4c')]['id']}},_0x7528a3={};_0x7528a3[_0xfd89('0x35')]=_[_0xfd89('0x37')](db[_0xfd89('0x31')][_0xfd89('0x32')]);_0x7528a3['query']=_['keys'](_0x2e8842[_0xfd89('0x36')]);_0x7528a3['filters']=_[_0xfd89('0x39')](_0x7528a3['model'],_0x7528a3['query']);_0xe2d69f[_0xfd89('0x3a')]=_['intersection'](_0x7528a3[_0xfd89('0x35')],qs[_0xfd89('0x3b')](_0x2e8842['query'][_0xfd89('0x3b')]));_0xe2d69f[_0xfd89('0x3a')]=_0xe2d69f[_0xfd89('0x3a')][_0xfd89('0x3c')]?_0xe2d69f['attributes']:_0x7528a3[_0xfd89('0x35')];if(_0x2e8842[_0xfd89('0x36')][_0xfd89('0x46')]){_0xe2d69f[_0xfd89('0x47')]=[{'all':!![]}];}_0xe2d69f=_['merge']({},_0xe2d69f,_0x2e8842[_0xfd89('0x4d')]);return db[_0xfd89('0x31')]['find'](_0xe2d69f)[_0xfd89('0x27')](handleEntityNotFound(_0x29b5b9,null))[_0xfd89('0x27')](respondWithResult(_0x29b5b9,null))['catch'](handleError(_0x29b5b9,null));};exports[_0xfd89('0x4e')]=function(_0x127ad0,_0xb61dd){return db[_0xfd89('0x31')][_0xfd89('0x4e')](_0x127ad0[_0xfd89('0x4f')],{})['then'](function(_0x18889f){var _0x93780=_0x127ad0[_0xfd89('0x50')][_0xfd89('0x29')]({'plain':!![]});if(!_0x93780)throw new Error(_0xfd89('0x51'));if(_0x93780['role']==='user'){var _0xc07487=_0x18889f[_0xfd89('0x29')]({'plain':!![]});var _0x3fc899=_0xfd89('0x2a');return db[_0xfd89('0x52')][_0xfd89('0x53')]({'where':{'name':_0x3fc899,'userProfileId':_0x93780['userProfileId']},'raw':!![]})[_0xfd89('0x27')](function(_0x344541){if(_0x344541&&_0x344541[_0xfd89('0x54')]===0x0){return db['UserProfileResource'][_0xfd89('0x4e')]({'name':_0xc07487[_0xfd89('0x2d')],'resourceId':_0xc07487['id'],'type':_0x344541[_0xfd89('0x2d')],'sectionId':_0x344541['id']},{})[_0xfd89('0x27')](function(){return _0x18889f;});}else{return _0x18889f;}})[_0xfd89('0x4a')](function(_0x4219fd){logger['error'](_0xfd89('0x55'),_0x4219fd);throw _0x4219fd;});}return _0x18889f;})['then'](respondWithResult(_0xb61dd,0xc9))[_0xfd89('0x4a')](handleError(_0xb61dd,null));};exports[_0xfd89('0x56')]=function(_0x485daf,_0x3a7e0f){if(_0x485daf['body']['id']){delete _0x485daf['body']['id'];}return db[_0xfd89('0x31')]['find']({'where':{'id':_0x485daf[_0xfd89('0x4c')]['id']}})[_0xfd89('0x27')](handleEntityNotFound(_0x3a7e0f,null))[_0xfd89('0x27')](saveUpdates(_0x485daf['body'],null))['then'](respondWithResult(_0x3a7e0f,null))['catch'](handleError(_0x3a7e0f,null));};exports[_0xfd89('0x28')]=function(_0x2ea08c,_0x253613){return db[_0xfd89('0x31')]['find']({'where':{'id':_0x2ea08c['params']['id']}})[_0xfd89('0x27')](handleEntityNotFound(_0x253613,null))['then'](removeEntity(_0x253613,null))[_0xfd89('0x4a')](handleError(_0x253613,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 27c2fd0..851e417 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 _0x9f15=['bluebird','path','rimraf','./disposition.attributes','exports','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','api','moment'];(function(_0x5d121e,_0x2063c6){var _0x2b777e=function(_0x10d230){while(--_0x10d230){_0x5d121e['push'](_0x5d121e['shift']());}};_0x2b777e(++_0x2063c6);}(_0x9f15,0x6e));var _0x59f1=function(_0x451959,_0x18c7a5){_0x451959=_0x451959-0x0;var _0x490269=_0x9f15[_0x451959];return _0x490269;};'use strict';var _=require(_0x59f1('0x0'));var util=require(_0x59f1('0x1'));var logger=require('../../config/logger')(_0x59f1('0x2'));var moment=require(_0x59f1('0x3'));var BPromise=require(_0x59f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59f1('0x5'));var rimraf=require(_0x59f1('0x6'));var config=require('../../config/environment');var attributes=require(_0x59f1('0x7'));module[_0x59f1('0x8')]=function(_0x6ca29e,_0x5294ae){return _0x6ca29e['define'](_0x59f1('0x9'),attributes,{'tableName':_0x59f1('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x59f1('0xb'),_0x59f1('0xc')]},{'unique':!![],'name':_0x59f1('0xd'),'fields':[_0x59f1('0xb'),_0x59f1('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0x59f1('0xb'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x59f1('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x59f1('0xf'),'fields':[_0x59f1('0xb'),'FaxAccountId']},{'unique':!![],'name':_0x59f1('0x10'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x59f1('0x11'),'fields':[_0x59f1('0xb'),_0x59f1('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa4bc=['moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api'];(function(_0x3cea19,_0x58b02a){var _0x51b1b9=function(_0x2ff4ac){while(--_0x2ff4ac){_0x3cea19['push'](_0x3cea19['shift']());}};_0x51b1b9(++_0x58b02a);}(_0xa4bc,0xcd));var _0xca4b=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa4bc[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0xca4b('0x0'));var util=require('util');var logger=require(_0xca4b('0x1'))(_0xca4b('0x2'));var moment=require(_0xca4b('0x3'));var BPromise=require(_0xca4b('0x4'));var rp=require(_0xca4b('0x5'));var fs=require('fs');var path=require(_0xca4b('0x6'));var rimraf=require('rimraf');var config=require(_0xca4b('0x7'));var attributes=require(_0xca4b('0x8'));module[_0xca4b('0x9')]=function(_0x43bd1d,_0x53ae0f){return _0x43bd1d[_0xca4b('0xa')](_0xca4b('0xb'),attributes,{'tableName':_0xca4b('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xca4b('0xd'),_0xca4b('0xe')]},{'unique':!![],'name':_0xca4b('0xf'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xca4b('0x10'),'fields':['name',_0xca4b('0x11')]},{'unique':!![],'name':_0xca4b('0x12'),'fields':[_0xca4b('0xd'),_0xca4b('0x13')]},{'unique':!![],'name':_0xca4b('0x14'),'fields':['name',_0xca4b('0x15')]},{'unique':!![],'name':_0xca4b('0x16'),'fields':[_0xca4b('0xd'),_0xca4b('0x17')]},{'unique':!![],'name':_0xca4b('0x18'),'fields':[_0xca4b('0xd'),_0xca4b('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7242cef..2b8d46b 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(_0x3f92fa,_0x558ac2){var _0x4cc4cc=function(_0x3c41f2){while(--_0x3c41f2){_0x3f92fa['push'](_0x3f92fa['shift']());}};_0x4cc4cc(++_0x558ac2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x53d0a7,_0x1e4f61){var _0x2a9e23=function(_0x12e907){while(--_0x12e907){_0x53d0a7['push'](_0x53d0a7['shift']());}};_0x2a9e23(++_0x1e4f61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 79d1603..032a7cd 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 _0x2635=['post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0x2635,0x126));var _0x5263=function(_0x523dc0,_0x2305a1){_0x523dc0=_0x523dc0-0x0;var _0x26af07=_0x2635[_0x523dc0];return _0x26af07;};'use strict';var multer=require(_0x5263('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5263('0x1'));var express=require(_0x5263('0x2'));var router=express[_0x5263('0x3')]();var fs_extra=require(_0x5263('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5263('0x5'));var config=require(_0x5263('0x6'));var controller=require(_0x5263('0x7'));router[_0x5263('0x8')]('/',auth[_0x5263('0x9')](),controller[_0x5263('0xa')]);router[_0x5263('0x8')]('/:id',auth[_0x5263('0x9')](),controller[_0x5263('0xb')]);router[_0x5263('0xc')]('/',auth[_0x5263('0x9')](),controller[_0x5263('0xd')]);router[_0x5263('0xe')]('/:id',auth[_0x5263('0x9')](),controller[_0x5263('0xf')]);router[_0x5263('0x10')]('/:id',auth[_0x5263('0x9')](),controller[_0x5263('0x11')]);module['exports']=router; \ No newline at end of file +var _0x413a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x413a,0x1a1));var _0xa413=function(_0x4d07cb,_0x9539b7){_0x4d07cb=_0x4d07cb-0x0;var _0x5272fd=_0x413a[_0x4d07cb];return _0x5272fd;};'use strict';var multer=require(_0xa413('0x0'));var util=require(_0xa413('0x1'));var path=require(_0xa413('0x2'));var timeout=require(_0xa413('0x3'));var express=require(_0xa413('0x4'));var router=express[_0xa413('0x5')]();var fs_extra=require(_0xa413('0x6'));var auth=require(_0xa413('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa413('0x8'));var controller=require(_0xa413('0x9'));router[_0xa413('0xa')]('/',auth[_0xa413('0xb')](),controller[_0xa413('0xc')]);router[_0xa413('0xa')](_0xa413('0xd'),auth[_0xa413('0xb')](),controller[_0xa413('0xe')]);router[_0xa413('0xf')]('/',auth[_0xa413('0xb')](),controller['create']);router[_0xa413('0x10')]('/:id',auth[_0xa413('0xb')](),controller[_0xa413('0x11')]);router[_0xa413('0x12')](_0xa413('0xd'),auth[_0xa413('0xb')](),controller['destroy']);module[_0xa413('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index e7cd8d4..54bb7f4 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 _0xa7c8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','9600','12000','14400','4800','7200','INTEGER','SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x5e2613,_0x5d7a19){var _0x45d076=function(_0x103e5c){while(--_0x103e5c){_0x5e2613['push'](_0x5e2613['shift']());}};_0x45d076(++_0x5d7a19);}(_0xa7c8,0x77));var _0x8a7c=function(_0x5b2665,_0xe4e5d5){_0x5b2665=_0x5b2665-0x0;var _0x5e3fb9=_0xa7c8[_0x5b2665];return _0x5e3fb9;};'use strict';var Sequelize=require(_0x8a7c('0x0'));module[_0x8a7c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8a7c('0x2')]},'ecm':{'type':Sequelize[_0x8a7c('0x3')](_0x8a7c('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x8a7c('0x2')],'defaultValue':_0x8a7c('0x5')},'localstationid':{'type':Sequelize[_0x8a7c('0x2')],'unique':_0x8a7c('0x6')},'minrate':{'type':Sequelize[_0x8a7c('0x3')](_0x8a7c('0x7'),'4800','7200',_0x8a7c('0x8'),_0x8a7c('0x9'),_0x8a7c('0xa')),'defaultValue':_0x8a7c('0xb')},'maxrate':{'type':Sequelize['ENUM'](_0x8a7c('0x7'),_0x8a7c('0xb'),_0x8a7c('0xc'),_0x8a7c('0x8'),_0x8a7c('0x9'),'14400'),'defaultValue':_0x8a7c('0xa')},'modem':{'type':Sequelize[_0x8a7c('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8a7c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8a7c('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x8a7c('0xe'),_0x8a7c('0xf'),'DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x8a7c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8a7c('0x10')],'defaultValue':function(){return _0x8a7c('0x11');}},'notificationSound':{'type':Sequelize[_0x8a7c('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8a7c('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8a7c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8a7c('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x35e41a){if(!_0x35e41a)this['setDataValue'](_0x8a7c('0x14'),null);this[_0x8a7c('0x15')](_0x8a7c('0x16'),_0x35e41a);}}}; \ No newline at end of file +var _0x9f15=['ENUM','14400','v17,v27,v29','INTEGER','SIP','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000'];(function(_0x59ab60,_0x1a7ddf){var _0x53e90c=function(_0x14121a){while(--_0x14121a){_0x59ab60['push'](_0x59ab60['shift']());}};_0x53e90c(++_0x1a7ddf);}(_0x9f15,0x146));var _0x59f1=function(_0x2f23c6,_0x8eacbc){_0x2f23c6=_0x2f23c6-0x0;var _0x12e26a=_0x9f15[_0x2f23c6];return _0x12e26a;};'use strict';var Sequelize=require('sequelize');module[_0x59f1('0x0')]={'name':{'type':Sequelize[_0x59f1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x59f1('0x2'),'no'),'defaultValue':_0x59f1('0x2')},'headerinfo':{'type':Sequelize[_0x59f1('0x1')],'defaultValue':_0x59f1('0x3')},'localstationid':{'type':Sequelize[_0x59f1('0x1')],'unique':_0x59f1('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x59f1('0x5'),_0x59f1('0x6'),_0x59f1('0x7'),_0x59f1('0x8'),_0x59f1('0x9'),'14400'),'defaultValue':_0x59f1('0x6')},'maxrate':{'type':Sequelize[_0x59f1('0xa')](_0x59f1('0x5'),_0x59f1('0x6'),'7200',_0x59f1('0x8'),_0x59f1('0x9'),_0x59f1('0xb')),'defaultValue':_0x59f1('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x59f1('0xc')},'gateway':{'type':Sequelize[_0x59f1('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x59f1('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x59f1('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x59f1('0xe'),'IAX',_0x59f1('0xf'),'KHOMP'),'defaultValue':_0x59f1('0xe')},'key':{'type':Sequelize[_0x59f1('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x59f1('0x10')],'defaultValue':function(){return _0x59f1('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x59f1('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x59f1('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x59f1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x59f1('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x59f1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x59f1('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x59f1('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x59f1('0x14'),'set':function(_0x327bcf){if(!_0x327bcf)this[_0x59f1('0x15')](_0x59f1('0x16'),null);this[_0x59f1('0x15')](_0x59f1('0x17'),_0x327bcf);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 04db604..b452343 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 _0x88a2=['apply','reject','update','destroy','get','FaxAccounts','stack','name','send','index','Pause','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','options','includeAll','include','FaxAccount','show','params','mandatoryDispositionPause','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','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','fullname','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','push','Set','ecm','faxdetect','headerinfo','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','fax','defaults','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x541856,_0x5a1a2c){var _0x51bceb=function(_0x38080a){while(--_0x38080a){_0x541856['push'](_0x541856['shift']());}};_0x51bceb(++_0x5a1a2c);}(_0x88a2,0x148));var _0x288a=function(_0x61df12,_0x248233){_0x61df12=_0x61df12-0x0;var _0xec518c=_0x88a2[_0x61df12];return _0xec518c;};'use strict';var emlformat=require(_0x288a('0x0'));var rimraf=require(_0x288a('0x1'));var zipdir=require(_0x288a('0x2'));var jsonpatch=require(_0x288a('0x3'));var rp=require('request-promise');var moment=require(_0x288a('0x4'));var BPromise=require(_0x288a('0x5'));var Mustache=require(_0x288a('0x6'));var util=require(_0x288a('0x7'));var path=require(_0x288a('0x8'));var sox=require('sox');var csv=require(_0x288a('0x9'));var ejs=require(_0x288a('0xa'));var fs=require('fs');var fs_extra=require(_0x288a('0xb'));var _=require(_0x288a('0xc'));var squel=require('squel');var crypto=require(_0x288a('0xd'));var jsforce=require(_0x288a('0xe'));var deskjs=require(_0x288a('0xf'));var toCsv=require(_0x288a('0x9'));var querystring=require(_0x288a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x288a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x288a('0x12'));var hardwareService=require(_0x288a('0x13'));var logger=require('../../config/logger')(_0x288a('0x14'));var utils=require(_0x288a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x288a('0x16'));var db=require(_0x288a('0x17'))['db'];config[_0x288a('0x18')]=_['defaults'](config[_0x288a('0x18')],{'host':_0x288a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x288a('0x18')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x288a('0x1a'));var client=jayson[_0x288a('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x288a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x20c1e2,_0x46e38e,_0x5c9603,_0x3197df){return new BPromise(function(_0x2eee15,_0x976cfd){var _0x13aed1=_0x3197df||client;return _0x13aed1[_0x288a('0x1d')](_0x20c1e2,_0x5c9603)[_0x288a('0x1e')](function(_0x15318a){logger['info'](_0x288a('0x1f'),_0x46e38e,'request\x20sent');logger[_0x288a('0x20')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x46e38e,_0x288a('0x21'),JSON[_0x288a('0x22')](_0x15318a));if(_0x15318a[_0x288a('0x23')]){if(_0x15318a[_0x288a('0x23')]['code']===0x1f4){logger[_0x288a('0x23')](_0x288a('0x1f'),_0x46e38e,_0x15318a['error'][_0x288a('0x24')]);return _0x976cfd(_0x15318a['error']['message']);}logger[_0x288a('0x23')](_0x288a('0x1f'),_0x46e38e,_0x15318a[_0x288a('0x23')]['message']);return _0x2eee15(_0x15318a[_0x288a('0x23')][_0x288a('0x24')]);}else{logger[_0x288a('0x25')](_0x288a('0x1f'),_0x46e38e,_0x288a('0x21'));_0x2eee15(_0x15318a[_0x288a('0x26')]['message']);}})[_0x288a('0x27')](function(_0x3dab93){logger[_0x288a('0x23')](_0x288a('0x1f'),_0x46e38e,_0x3dab93);_0x976cfd(_0x3dab93);});});}function respondWithStatusCode(_0x3b585e,_0x1a5aa6){_0x1a5aa6=_0x1a5aa6||0xcc;return function(_0xccf426){if(_0xccf426){return _0x3b585e[_0x288a('0x28')](_0x1a5aa6);}return _0x3b585e['status'](_0x1a5aa6)[_0x288a('0x29')]();};}function respondWithResult(_0x2a7aa4,_0x4098e1){_0x4098e1=_0x4098e1||0xc8;return function(_0x1eb770){if(_0x1eb770){return _0x2a7aa4['status'](_0x4098e1)[_0x288a('0x2a')](_0x1eb770);}};}function respondWithFilteredResult(_0x4c4a66,_0x503965){return function(_0x348f27){if(_0x348f27){var _0xde699c=typeof _0x503965[_0x288a('0x2b')]===_0x288a('0x2c')&&typeof _0x503965[_0x288a('0x2d')]===_0x288a('0x2c');var _0x597746=_0x348f27[_0x288a('0x2e')];var _0x4903a6=_0xde699c?0x0:_0x503965[_0x288a('0x2b')];var _0x1f5c93=_0xde699c?_0x348f27['count']:_0x503965['offset']+_0x503965[_0x288a('0x2d')];var _0x4f8008;if(_0x1f5c93>=_0x597746){_0x1f5c93=_0x597746;_0x4f8008=0xc8;}else{_0x4f8008=0xce;}_0x4c4a66[_0x288a('0x2f')](_0x4f8008);return _0x4c4a66[_0x288a('0x30')](_0x288a('0x31'),_0x4903a6+'-'+_0x1f5c93+'/'+_0x597746)['json'](_0x348f27);}return null;};}function patchUpdates(_0x48b892){return function(_0x21acdc){try{jsonpatch[_0x288a('0x32')](_0x21acdc,_0x48b892,!![]);}catch(_0xac7e12){return BPromise[_0x288a('0x33')](_0xac7e12);}return _0x21acdc['save']();};}function saveUpdates(_0x33775f,_0x3991b6){return function(_0x181fff){if(_0x181fff){return _0x181fff[_0x288a('0x34')](_0x33775f)[_0x288a('0x1e')](function(_0x380ba4){return _0x380ba4;});}return null;};}function removeEntity(_0x8ef8ac,_0x1a6989){return function(_0x528315){if(_0x528315){return _0x528315[_0x288a('0x35')]()[_0x288a('0x1e')](function(){var _0x1b175c=_0x528315[_0x288a('0x36')]({'plain':!![]});var _0x3f43d1=_0x288a('0x37');return db['UserProfileResource'][_0x288a('0x35')]({'where':{'type':_0x3f43d1,'resourceId':_0x1b175c['id']}})[_0x288a('0x1e')](function(){return _0x528315;});})[_0x288a('0x1e')](function(){_0x8ef8ac[_0x288a('0x2f')](0xcc)[_0x288a('0x29')]();});}};}function handleEntityNotFound(_0xa59a98,_0x4dc08f){return function(_0xe8bd37){if(!_0xe8bd37){_0xa59a98[_0x288a('0x28')](0x194);}return _0xe8bd37;};}function handleError(_0x452241,_0x4bb2fb){_0x4bb2fb=_0x4bb2fb||0x1f4;return function(_0x312292){logger[_0x288a('0x23')](_0x312292[_0x288a('0x38')]);if(_0x312292[_0x288a('0x39')]){delete _0x312292['name'];}_0x452241[_0x288a('0x2f')](_0x4bb2fb)[_0x288a('0x3a')](_0x312292);};}exports[_0x288a('0x3b')]=function(_0x1a16ea,_0x130928){var _0x1d4e2d={'include':[{'model':db[_0x288a('0x3c')],'as':'mandatoryDispositionPause'}]},_0xe50288={},_0x2bf43e={'count':0x0,'rows':[]};var _0x140e71=_[_0x288a('0x3d')](db['FaxAccount'][_0x288a('0x3e')],function(_0x34333a){return{'name':_0x34333a['fieldName'],'type':_0x34333a[_0x288a('0x3f')][_0x288a('0x40')]};});_0xe50288[_0x288a('0x41')]=_[_0x288a('0x3d')](_0x140e71,'name');_0xe50288[_0x288a('0x42')]=_[_0x288a('0x43')](_0x1a16ea[_0x288a('0x42')]);_0xe50288['filters']=_[_0x288a('0x44')](_0xe50288[_0x288a('0x41')],_0xe50288[_0x288a('0x42')]);_0x1d4e2d[_0x288a('0x45')]=_[_0x288a('0x44')](_0xe50288['model'],qs[_0x288a('0x46')](_0x1a16ea['query'][_0x288a('0x46')]));_0x1d4e2d[_0x288a('0x45')]=_0x1d4e2d[_0x288a('0x45')][_0x288a('0x47')]?_0x1d4e2d[_0x288a('0x45')]:_0xe50288[_0x288a('0x41')];if(!_0x1a16ea[_0x288a('0x42')][_0x288a('0x48')]('nolimit')){_0x1d4e2d[_0x288a('0x2d')]=qs[_0x288a('0x2d')](_0x1a16ea[_0x288a('0x42')][_0x288a('0x2d')]);_0x1d4e2d['offset']=qs[_0x288a('0x2b')](_0x1a16ea[_0x288a('0x42')]['offset']);}_0x1d4e2d[_0x288a('0x49')]=qs[_0x288a('0x4a')](_0x1a16ea[_0x288a('0x42')][_0x288a('0x4a')]);_0x1d4e2d['where']=qs[_0x288a('0x4b')](_[_0x288a('0x4c')](_0x1a16ea[_0x288a('0x42')],_0xe50288[_0x288a('0x4b')]),_0x140e71);if(_0x1a16ea[_0x288a('0x42')][_0x288a('0x4d')]){_0x1d4e2d['where']=_[_0x288a('0x4e')](_0x1d4e2d[_0x288a('0x4f')],{'$or':_['map'](_0x140e71,function(_0x197761){if(_0x197761[_0x288a('0x3f')]!=='VIRTUAL'){var _0x131e90={};_0x131e90[_0x197761['name']]={'$like':'%'+_0x1a16ea[_0x288a('0x42')][_0x288a('0x4d')]+'%'};return _0x131e90;}})});}_0x1d4e2d=_[_0x288a('0x4e')]({},_0x1d4e2d,_0x1a16ea[_0x288a('0x50')]);var _0x193318={'where':_0x1d4e2d[_0x288a('0x4f')]};return db['FaxAccount'][_0x288a('0x2e')](_0x193318)[_0x288a('0x1e')](function(_0x573f44){_0x2bf43e['count']=_0x573f44;if(_0x1a16ea[_0x288a('0x42')][_0x288a('0x51')]){_0x1d4e2d[_0x288a('0x52')]=[{'all':!![]}];}return db[_0x288a('0x53')]['findAll'](_0x1d4e2d);})['then'](function(_0x1d5719){_0x2bf43e['rows']=_0x1d5719;return _0x2bf43e;})[_0x288a('0x1e')](respondWithFilteredResult(_0x130928,_0x1d4e2d))[_0x288a('0x27')](handleError(_0x130928,null));};exports[_0x288a('0x54')]=function(_0x158bb2,_0x2b8f79){var _0x2509db={'raw':![],'where':{'id':_0x158bb2[_0x288a('0x55')]['id']},'include':[{'model':db[_0x288a('0x3c')],'as':_0x288a('0x56')}]},_0x631fbf={};_0x631fbf[_0x288a('0x41')]=_[_0x288a('0x43')](db['FaxAccount']['rawAttributes']);_0x631fbf[_0x288a('0x42')]=_[_0x288a('0x43')](_0x158bb2[_0x288a('0x42')]);_0x631fbf[_0x288a('0x4b')]=_[_0x288a('0x44')](_0x631fbf[_0x288a('0x41')],_0x631fbf[_0x288a('0x42')]);_0x2509db[_0x288a('0x45')]=_[_0x288a('0x44')](_0x631fbf[_0x288a('0x41')],qs[_0x288a('0x46')](_0x158bb2[_0x288a('0x42')][_0x288a('0x46')]));_0x2509db[_0x288a('0x45')]=_0x2509db[_0x288a('0x45')][_0x288a('0x47')]?_0x2509db[_0x288a('0x45')]:_0x631fbf[_0x288a('0x41')];if(_0x158bb2[_0x288a('0x42')]['includeAll']){_0x2509db[_0x288a('0x52')]=[{'all':!![]}];}_0x2509db=_[_0x288a('0x4e')]({},_0x2509db,_0x158bb2[_0x288a('0x50')]);return db[_0x288a('0x53')][_0x288a('0x57')](_0x2509db)['then'](handleEntityNotFound(_0x2b8f79,null))[_0x288a('0x1e')](respondWithResult(_0x2b8f79,null))[_0x288a('0x27')](handleError(_0x2b8f79,null));};exports['create']=function(_0x411014,_0x57c3c0){return db[_0x288a('0x53')][_0x288a('0x58')](_0x411014[_0x288a('0x59')],{})['then'](function(_0x3b5ecc){var _0x7923d0=_0x411014[_0x288a('0x5a')][_0x288a('0x36')]({'plain':!![]});if(!_0x7923d0)throw new Error(_0x288a('0x5b'));if(_0x7923d0[_0x288a('0x5c')]===_0x288a('0x5a')){var _0x49d3da=_0x3b5ecc[_0x288a('0x36')]({'plain':!![]});var _0x1dbff7=_0x288a('0x37');return db[_0x288a('0x5d')]['find']({'where':{'name':_0x1dbff7,'userProfileId':_0x7923d0['userProfileId']},'raw':!![]})[_0x288a('0x1e')](function(_0x26532a){if(_0x26532a&&_0x26532a[_0x288a('0x5e')]===0x0){return db[_0x288a('0x5f')]['create']({'name':_0x49d3da[_0x288a('0x39')],'resourceId':_0x49d3da['id'],'type':_0x26532a[_0x288a('0x39')],'sectionId':_0x26532a['id']},{})['then'](function(){return _0x3b5ecc;});}else{return _0x3b5ecc;}})[_0x288a('0x27')](function(_0x44e2b9){logger['error'](_0x288a('0x60'),_0x44e2b9);throw _0x44e2b9;});}return _0x3b5ecc;})['then'](respondWithResult(_0x57c3c0,0xc9))[_0x288a('0x27')](handleError(_0x57c3c0,null));};exports['update']=function(_0x44e621,_0x3d6420){if(_0x44e621['body']['id']){delete _0x44e621[_0x288a('0x59')]['id'];}return db[_0x288a('0x53')][_0x288a('0x57')]({'where':{'id':_0x44e621[_0x288a('0x55')]['id']},'include':[{'model':db[_0x288a('0x3c')],'as':_0x288a('0x56')}]})['then'](handleEntityNotFound(_0x3d6420,null))[_0x288a('0x1e')](saveUpdates(_0x44e621['body'],null))[_0x288a('0x1e')](respondWithResult(_0x3d6420,null))[_0x288a('0x27')](handleError(_0x3d6420,null));};exports[_0x288a('0x35')]=function(_0x336b14,_0x4f0b23){return db[_0x288a('0x53')][_0x288a('0x57')]({'where':{'id':_0x336b14[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x4f0b23,null))[_0x288a('0x1e')](removeEntity(_0x4f0b23,null))['catch'](handleError(_0x4f0b23,null));};exports[_0x288a('0x61')]=function(_0x37a068,_0x45b3b1){return db[_0x288a('0x53')][_0x288a('0x61')]()['then'](respondWithResult(_0x45b3b1,null))[_0x288a('0x27')](handleError(_0x45b3b1,null));};exports[_0x288a('0x62')]=function(_0x504ea3,_0x5869ca,_0x3c636e){if(_0x504ea3[_0x288a('0x59')]['id']){delete _0x504ea3['body']['id'];}return db[_0x288a('0x53')][_0x288a('0x57')]({'where':{'id':_0x504ea3[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x5869ca,null))[_0x288a('0x1e')](function(_0x15d36a){if(_0x15d36a){_0x504ea3[_0x288a('0x59')][_0x288a('0x63')]=_0x15d36a['id'];return db[_0x288a('0x64')][_0x288a('0x58')](_0x504ea3[_0x288a('0x59')]);}})[_0x288a('0x1e')](respondWithResult(_0x5869ca,null))[_0x288a('0x27')](handleError(_0x5869ca,null));};exports[_0x288a('0x65')]=function(_0x490519,_0x440ed0,_0x3775a7){var _0x33144c={'raw':![],'where':{}};var _0x2fe036={};var _0x5b4237={'count':0x0,'rows':[]};return db[_0x288a('0x53')][_0x288a('0x66')]({'where':{'id':_0x490519['params']['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x440ed0,null))[_0x288a('0x1e')](function(_0xd29140){if(_0xd29140){_0x2fe036[_0x288a('0x41')]=_['keys'](db[_0x288a('0x64')]['rawAttributes']);_0x2fe036[_0x288a('0x42')]=_[_0x288a('0x43')](_0x490519[_0x288a('0x42')]);_0x2fe036[_0x288a('0x4b')]=_[_0x288a('0x44')](_0x2fe036[_0x288a('0x41')],_0x2fe036[_0x288a('0x42')]);_0x33144c[_0x288a('0x45')]=_[_0x288a('0x44')](_0x2fe036[_0x288a('0x41')],qs[_0x288a('0x46')](_0x490519[_0x288a('0x42')][_0x288a('0x46')]));_0x33144c[_0x288a('0x45')]=_0x33144c['attributes'][_0x288a('0x47')]?_0x33144c['attributes']:_0x2fe036[_0x288a('0x41')];if(!_0x490519[_0x288a('0x42')][_0x288a('0x48')](_0x288a('0x67'))){_0x33144c[_0x288a('0x2d')]=qs['limit'](_0x490519[_0x288a('0x42')][_0x288a('0x2d')]);_0x33144c[_0x288a('0x2b')]=qs[_0x288a('0x2b')](_0x490519[_0x288a('0x42')][_0x288a('0x2b')]);}_0x33144c['order']=qs['sort'](_0x490519['query'][_0x288a('0x4a')]);_0x33144c['where']=qs[_0x288a('0x4b')](_[_0x288a('0x4c')](_0x490519[_0x288a('0x42')],_0x2fe036[_0x288a('0x4b')]));_0x33144c[_0x288a('0x4f')][_0x288a('0x63')]=_0xd29140['id'];if(_0x490519['query']['filter']){_0x33144c['where']=_[_0x288a('0x4e')](_0x33144c[_0x288a('0x4f')],{'$or':_[_0x288a('0x3d')](_0x33144c['attributes'],function(_0x4f0477){var _0x33e116={};_0x33e116[_0x4f0477]={'$like':'%'+_0x490519[_0x288a('0x42')][_0x288a('0x4d')]+'%'};return _0x33e116;})});}_0x33144c=_[_0x288a('0x4e')]({},_0x33144c,_0x490519[_0x288a('0x50')]);return db[_0x288a('0x64')][_0x288a('0x2e')]({'where':_0x33144c[_0x288a('0x4f')]})['then'](function(_0x32152a){_0x5b4237['count']=_0x32152a;if(_0x490519[_0x288a('0x42')]['includeAll']){_0x33144c['include']=[{'all':!![]}];}return db[_0x288a('0x64')]['findAll'](_0x33144c);})[_0x288a('0x1e')](function(_0x163256){_0x5b4237[_0x288a('0x68')]=_0x163256;return _0x5b4237;});}})[_0x288a('0x1e')](respondWithFilteredResult(_0x440ed0,_0x33144c))[_0x288a('0x27')](handleError(_0x440ed0,null));};exports[_0x288a('0x69')]=function(_0x557e51,_0x1c9e12,_0xb3acd7){return db[_0x288a('0x53')]['find']({'where':{'id':_0x557e51[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x1c9e12,null))[_0x288a('0x1e')](function(_0x567a24){if(_0x567a24){return _0x567a24['removeDispositions'](_0x557e51[_0x288a('0x42')][_0x288a('0x6a')]);}})[_0x288a('0x1e')](respondWithStatusCode(_0x1c9e12,null))[_0x288a('0x27')](handleError(_0x1c9e12,null));};exports[_0x288a('0x6b')]=function(_0x588c50,_0x3f23a7,_0x4cc39a){if(_0x588c50[_0x288a('0x59')]['id']){delete _0x588c50['body']['id'];}return db[_0x288a('0x53')][_0x288a('0x57')]({'where':{'id':_0x588c50[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x3f23a7,null))[_0x288a('0x1e')](function(_0x5452fd){if(_0x5452fd){_0x588c50['body']['FaxAccountId']=_0x5452fd['id'];return db['CannedAnswer'][_0x288a('0x58')](_0x588c50[_0x288a('0x59')]);}})['then'](respondWithResult(_0x3f23a7,null))[_0x288a('0x27')](handleError(_0x3f23a7,null));};exports[_0x288a('0x6c')]=function(_0x50a967,_0x22ede4,_0x4e7b7c){var _0x266f68={'raw':![],'where':{}};var _0x5ef4a1={};var _0x30fa37={'count':0x0,'rows':[]};return db[_0x288a('0x53')]['findOne']({'where':{'id':_0x50a967[_0x288a('0x55')]['id']}})['then'](handleEntityNotFound(_0x22ede4,null))['then'](function(_0x59ec35){if(_0x59ec35){_0x5ef4a1[_0x288a('0x41')]=_[_0x288a('0x43')](db[_0x288a('0x6d')][_0x288a('0x3e')]);_0x5ef4a1['query']=_[_0x288a('0x43')](_0x50a967[_0x288a('0x42')]);_0x5ef4a1[_0x288a('0x4b')]=_[_0x288a('0x44')](_0x5ef4a1[_0x288a('0x41')],_0x5ef4a1[_0x288a('0x42')]);_0x266f68[_0x288a('0x45')]=_[_0x288a('0x44')](_0x5ef4a1[_0x288a('0x41')],qs[_0x288a('0x46')](_0x50a967[_0x288a('0x42')][_0x288a('0x46')]));_0x266f68[_0x288a('0x45')]=_0x266f68[_0x288a('0x45')][_0x288a('0x47')]?_0x266f68[_0x288a('0x45')]:_0x5ef4a1[_0x288a('0x41')];if(!_0x50a967[_0x288a('0x42')][_0x288a('0x48')](_0x288a('0x67'))){_0x266f68[_0x288a('0x2d')]=qs[_0x288a('0x2d')](_0x50a967[_0x288a('0x42')]['limit']);_0x266f68[_0x288a('0x2b')]=qs[_0x288a('0x2b')](_0x50a967[_0x288a('0x42')][_0x288a('0x2b')]);}_0x266f68[_0x288a('0x49')]=qs[_0x288a('0x4a')](_0x50a967[_0x288a('0x42')]['sort']);_0x266f68[_0x288a('0x4f')]=qs[_0x288a('0x4b')](_[_0x288a('0x4c')](_0x50a967['query'],_0x5ef4a1[_0x288a('0x4b')]));_0x266f68[_0x288a('0x4f')]['FaxAccountId']=_0x59ec35['id'];if(_0x50a967[_0x288a('0x42')]['filter']){_0x266f68[_0x288a('0x4f')]=_[_0x288a('0x4e')](_0x266f68[_0x288a('0x4f')],{'$or':_[_0x288a('0x3d')](_0x266f68[_0x288a('0x45')],function(_0x43fab7){var _0x3af584={};_0x3af584[_0x43fab7]={'$like':'%'+_0x50a967['query'][_0x288a('0x4d')]+'%'};return _0x3af584;})});}_0x266f68=_[_0x288a('0x4e')]({},_0x266f68,_0x50a967[_0x288a('0x50')]);return db[_0x288a('0x6d')]['count']({'where':_0x266f68['where']})[_0x288a('0x1e')](function(_0x502da1){_0x30fa37[_0x288a('0x2e')]=_0x502da1;if(_0x50a967[_0x288a('0x42')][_0x288a('0x51')]){_0x266f68[_0x288a('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0x288a('0x6e')](_0x266f68);})['then'](function(_0x36411c){_0x30fa37[_0x288a('0x68')]=_0x36411c;return _0x30fa37;});}})[_0x288a('0x1e')](respondWithFilteredResult(_0x22ede4,_0x266f68))[_0x288a('0x27')](handleError(_0x22ede4,null));};exports['removeAnswers']=function(_0x5882ad,_0x6dc444,_0x1eb06c){return db[_0x288a('0x53')]['find']({'where':{'id':_0x5882ad[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x6dc444,null))[_0x288a('0x1e')](function(_0x59d8d2){if(_0x59d8d2){return _0x59d8d2[_0x288a('0x6f')](_0x5882ad[_0x288a('0x42')][_0x288a('0x6a')]);}})['then'](respondWithStatusCode(_0x6dc444,null))[_0x288a('0x27')](handleError(_0x6dc444,null));};exports[_0x288a('0x70')]=function(_0x1d5883,_0x1d46f8,_0x1c14dd){return db[_0x288a('0x71')][_0x288a('0x57')]({'where':{'id':_0x1d5883[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x1d46f8,null))[_0x288a('0x1e')](function(_0x41efde){if(_0x41efde){return _0x41efde[_0x288a('0x70')](_0x1d5883['body'][_0x288a('0x6a')],_['omit'](_0x1d5883[_0x288a('0x59')],[_0x288a('0x6a'),'id'])||{});}})[_0x288a('0x1e')](respondWithResult(_0x1d46f8,null))['catch'](handleError(_0x1d46f8,null));};exports[_0x288a('0x72')]=function(_0x969fa6,_0x5bd6aa,_0x25ed8d){var _0x447ef1={'raw':![],'where':{}};var _0x28494f={};var _0x4965f7={'count':0x0,'rows':[]};return db[_0x288a('0x53')][_0x288a('0x66')]({'where':{'id':_0x969fa6[_0x288a('0x55')]['id']}})['then'](handleEntityNotFound(_0x5bd6aa,null))[_0x288a('0x1e')](function(_0x4414f1){if(_0x4414f1){_0x28494f['model']=_[_0x288a('0x43')](db['FaxInteraction'][_0x288a('0x3e')]);_0x28494f['query']=_[_0x288a('0x43')](_0x969fa6[_0x288a('0x42')]);_0x28494f[_0x288a('0x4b')]=_['intersection'](_0x28494f['model'],_0x28494f[_0x288a('0x42')]);_0x447ef1[_0x288a('0x45')]=_[_0x288a('0x44')](_0x28494f[_0x288a('0x41')],qs[_0x288a('0x46')](_0x969fa6[_0x288a('0x42')][_0x288a('0x46')]));_0x447ef1['attributes']=_0x447ef1['attributes'][_0x288a('0x47')]?_0x447ef1[_0x288a('0x45')]:_0x28494f[_0x288a('0x41')];if(!_0x969fa6[_0x288a('0x42')][_0x288a('0x48')](_0x288a('0x67'))){_0x447ef1[_0x288a('0x2d')]=qs[_0x288a('0x2d')](_0x969fa6[_0x288a('0x42')][_0x288a('0x2d')]);_0x447ef1[_0x288a('0x2b')]=qs['offset'](_0x969fa6['query']['offset']);}_0x447ef1['order']=qs[_0x288a('0x4a')](_0x969fa6['query'][_0x288a('0x4a')]);_0x447ef1[_0x288a('0x4f')]=qs[_0x288a('0x4b')](_[_0x288a('0x4c')](_0x969fa6[_0x288a('0x42')],_0x28494f[_0x288a('0x4b')]));_0x447ef1[_0x288a('0x4f')][_0x288a('0x63')]=_0x4414f1['id'];if(_0x969fa6[_0x288a('0x42')][_0x288a('0x4d')]){_0x447ef1['where']=_[_0x288a('0x4e')](_0x447ef1[_0x288a('0x4f')],{'$or':_[_0x288a('0x3d')](_0x447ef1[_0x288a('0x45')],function(_0x3480b8){var _0x1c1e1f={};_0x1c1e1f[_0x3480b8]={'$like':'%'+_0x969fa6[_0x288a('0x42')][_0x288a('0x4d')]+'%'};return _0x1c1e1f;})});}_0x447ef1=_[_0x288a('0x4e')]({},_0x447ef1,_0x969fa6['options']);return db['FaxInteraction']['count']({'where':_0x447ef1[_0x288a('0x4f')]})[_0x288a('0x1e')](function(_0x21691){_0x4965f7[_0x288a('0x2e')]=_0x21691;if(_0x969fa6[_0x288a('0x42')][_0x288a('0x51')]){_0x447ef1[_0x288a('0x52')]=[{'model':db[_0x288a('0x73')],'as':_0x288a('0x74'),'required':![]},{'model':db[_0x288a('0x75')],'as':'Owner','attributes':[_0x288a('0x39'),_0x288a('0x76'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x288a('0x77'),'attributes':['id',_0x288a('0x39'),'color'],'where':_0x969fa6[_0x288a('0x42')][_0x288a('0x78')]?{'id':_0x969fa6[_0x288a('0x42')][_0x288a('0x78')]}:undefined,'required':_0x969fa6[_0x288a('0x42')][_0x288a('0x78')]?!![]:![]}];}return db[_0x288a('0x71')][_0x288a('0x6e')](_0x447ef1);})[_0x288a('0x1e')](function(_0x1e7874){_0x4965f7['rows']=_0x1e7874;return _0x4965f7;});}})[_0x288a('0x1e')](respondWithFilteredResult(_0x5bd6aa,_0x447ef1))[_0x288a('0x27')](handleError(_0x5bd6aa,null));};exports[_0x288a('0x79')]=function(_0x319282,_0x200725,_0x452109){return db[_0x288a('0x53')][_0x288a('0x66')]({'where':{'id':_0x319282[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x200725,null))[_0x288a('0x1e')](function(_0x1a3449){if(_0x1a3449){return db[_0x288a('0x7a')][_0x288a('0x7b')](function(_0xfa5547){return db[_0x288a('0x7c')]['destroy']({'where':{'FaxAccountId':_0x319282[_0x288a('0x55')]['id']},'transaction':_0xfa5547})[_0x288a('0x1e')](function(_0x174ca9){var _0x4f1fa1=_['map'](_0x319282[_0x288a('0x59')],function(_0x38cc5b){_0x38cc5b[_0x288a('0x63')]=_0x319282[_0x288a('0x55')]['id'];return _0x38cc5b;});return db['FaxApplication'][_0x288a('0x7d')](_0x4f1fa1,{'transaction':_0xfa5547});});})[_0x288a('0x1e')](function(){return db[_0x288a('0x7c')][_0x288a('0x7e')]({'where':{'FaxAccountId':_0x319282['params']['id']},'order':_0x288a('0x7f')});});}})[_0x288a('0x1e')](respondWithResult(_0x200725,null))[_0x288a('0x27')](handleError(_0x200725,null));};exports[_0x288a('0x80')]=function(_0xd9e619,_0x1526c5,_0x36d9a9){var _0x5ee8cc={};var _0x52f03e={};var _0x3fe789;var _0x1ee296;return db['FaxAccount'][_0x288a('0x66')]({'where':{'id':_0xd9e619[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x1526c5,null))[_0x288a('0x1e')](function(_0x40dd53){if(_0x40dd53){_0x3fe789=_0x40dd53;_0x52f03e[_0x288a('0x41')]=_[_0x288a('0x43')](db[_0x288a('0x7c')][_0x288a('0x3e')]);_0x52f03e[_0x288a('0x42')]=_[_0x288a('0x43')](_0xd9e619['query']);_0x52f03e[_0x288a('0x4b')]=_[_0x288a('0x44')](_0x52f03e[_0x288a('0x41')],_0x52f03e['query']);_0x5ee8cc[_0x288a('0x45')]=_['intersection'](_0x52f03e[_0x288a('0x41')],qs[_0x288a('0x46')](_0xd9e619['query'][_0x288a('0x46')]));_0x5ee8cc[_0x288a('0x45')]=_0x5ee8cc[_0x288a('0x45')][_0x288a('0x47')]?_0x5ee8cc[_0x288a('0x45')]:_0x52f03e['model'];_0x5ee8cc['order']=qs[_0x288a('0x4a')](_0xd9e619[_0x288a('0x42')][_0x288a('0x4a')]);_0x5ee8cc[_0x288a('0x4f')]=qs[_0x288a('0x4b')](_[_0x288a('0x4c')](_0xd9e619[_0x288a('0x42')],_0x52f03e[_0x288a('0x4b')]));if(_0xd9e619[_0x288a('0x42')][_0x288a('0x4d')]){_0x5ee8cc[_0x288a('0x4f')]=_['merge'](_0x5ee8cc[_0x288a('0x4f')],{'$or':_['map'](_0x5ee8cc['attributes'],function(_0x3205fe){var _0x42c6ce={};_0x42c6ce[_0x3205fe]={'$like':'%'+_0xd9e619[_0x288a('0x42')][_0x288a('0x4d')]+'%'};return _0x42c6ce;})});}_0x5ee8cc=_[_0x288a('0x4e')]({},_0x5ee8cc,_0xd9e619['options']);return _0x3fe789[_0x288a('0x80')](_0x5ee8cc);}})[_0x288a('0x1e')](function(_0x4614f0){if(_0x4614f0){_0x1ee296=_0x4614f0['length'];if(!_0xd9e619[_0x288a('0x42')]['hasOwnProperty'](_0x288a('0x67'))){_0x5ee8cc[_0x288a('0x2d')]=qs[_0x288a('0x2d')](_0xd9e619['query'][_0x288a('0x2d')]);_0x5ee8cc[_0x288a('0x2b')]=qs[_0x288a('0x2b')](_0xd9e619[_0x288a('0x42')][_0x288a('0x2b')]);}return _0x3fe789[_0x288a('0x80')](_0x5ee8cc);}})[_0x288a('0x1e')](function(_0x14758d){if(_0x14758d){return _0x14758d?{'count':_0x1ee296,'rows':_0x14758d}:null;}})['then'](respondWithResult(_0x1526c5,null))[_0x288a('0x27')](handleError(_0x1526c5,null));};function Extension(_0x1739ce,_0x2ae2c5,_0x21903e,_0x19ac4e){this['context']=_0x288a('0x81');this[_0x288a('0x82')]=_0x1739ce[_0x288a('0x83')];this[_0x288a('0x84')]=_0x19ac4e;this[_0x288a('0x3f')]=_0x288a('0x85');this[_0x288a('0x86')]='Fax\x20Extension';this[_0x288a('0x63')]=_0x1739ce['id'];this[_0x288a('0x7f')]=_0x2ae2c5;this['appdata']=_0x21903e;}function createExtensionsReciveFax(_0x29e715){var _0x1fe622=0x1;var _0x11c8d3=[];_0x11c8d3[_0x288a('0x87')](new Extension(_0x29e715,_0x1fe622,'','Answer'));_0x1fe622+=0x1;_0x11c8d3[_0x288a('0x87')](new Extension(_0x29e715,_0x1fe622,'CDR(type)=inbound-fax',_0x288a('0x88')));_0x1fe622+=0x1;for(var _0x20e785 in _0x29e715){if(_0x29e715[_0x288a('0x48')](_0x20e785)&&(_0x20e785===_0x288a('0x89')||_0x20e785===_0x288a('0x83')||_0x20e785==='gateway'||_0x20e785===_0x288a('0x8a')||_0x20e785===_0x288a('0x8b')||_0x20e785==='maxrate'||_0x20e785===_0x288a('0x8c')||_0x20e785===_0x288a('0x8d')||_0x20e785==='t38timeout')){_0x11c8d3[_0x288a('0x87')](new Extension(_0x29e715,_0x1fe622,_0x288a('0x8e')+_0x20e785+')='+_0x29e715[_0x20e785],'Set'));_0x1fe622+=0x1;}}_0x11c8d3[_0x288a('0x87')](new Extension(_0x29e715,_0x1fe622,'6',_0x288a('0x8f')));_0x1fe622+=0x1;_0x11c8d3['push'](new Extension(_0x29e715,_0x1fe622,_0x288a('0x90'),_0x288a('0x91')));_0x1fe622=0x0;return _0x11c8d3;}exports[_0x288a('0x92')]=function(_0xbd0891,_0x49b384,_0x312458){var _0x23cfff;return db['sequelize'][_0x288a('0x7b')](function(_0x3211e8){return db[_0x288a('0x53')][_0x288a('0x58')](_0xbd0891[_0x288a('0x59')],{'transaction':_0x3211e8})['then'](function(_0x15b3cb){_0x23cfff=_0x15b3cb['get']({'plain':!![]});return db[_0x288a('0x93')]['bulkCreate'](createExtensionsReciveFax(_0x23cfff),{'transaction':_0x3211e8});});})[_0x288a('0x1e')](function(){return _0x23cfff;})['then'](respondWithResult(_0x49b384,null))['catch'](handleError(_0x49b384,null));};exports[_0x288a('0x94')]=function(_0x411570,_0x59ee53,_0x3ea7ea){var _0x163d93;return db[_0x288a('0x7a')][_0x288a('0x7b')](function(_0x3a41aa){return db[_0x288a('0x53')][_0x288a('0x34')](_0x411570[_0x288a('0x59')],{'where':{'id':_0x411570[_0x288a('0x59')]['id']},'transaction':_0x3a41aa})[_0x288a('0x1e')](function(_0x5720b0){return db[_0x288a('0x93')][_0x288a('0x35')]({'where':{'FaxAccountId':_0x411570[_0x288a('0x59')]['id']},'transaction':_0x3a41aa})['then'](function(_0x2700e8){return db[_0x288a('0x93')][_0x288a('0x7d')](createExtensionsReciveFax(_[_0x288a('0x95')](_0x411570['body'],['tech',_0x288a('0x40'),_0x288a('0x96'),_0x288a('0x97'),_0x288a('0x98'),'ListId'])),{'transaction':_0x3a41aa});});});})['then'](function(){return db[_0x288a('0x53')][_0x288a('0x99')](_0x411570['body']['id']);})[_0x288a('0x1e')](respondWithResult(_0x59ee53,null))['catch'](handleError(_0x59ee53,null));};exports[_0x288a('0x9a')]=function(_0x3f836b,_0x2e8251,_0x380703){var _0x246d7f={'raw':!![],'where':{}};var _0x3a155d={};var _0x5eaecc={'count':0x0,'rows':[]};return db[_0x288a('0x53')]['findOne']({'where':{'id':_0x3f836b[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x2e8251,null))[_0x288a('0x1e')](function(_0x270b7b){if(_0x270b7b){_0x3a155d['model']=_[_0x288a('0x43')](db[_0x288a('0x9b')][_0x288a('0x3e')]);_0x3a155d[_0x288a('0x42')]=_['keys'](_0x3f836b['query']);_0x3a155d[_0x288a('0x4b')]=_[_0x288a('0x44')](_0x3a155d[_0x288a('0x41')],_0x3a155d[_0x288a('0x42')]);_0x246d7f[_0x288a('0x45')]=_['intersection'](_0x3a155d['model'],qs[_0x288a('0x46')](_0x3f836b[_0x288a('0x42')][_0x288a('0x46')]));_0x246d7f[_0x288a('0x45')]=_0x246d7f[_0x288a('0x45')][_0x288a('0x47')]?_0x246d7f[_0x288a('0x45')]:_0x3a155d[_0x288a('0x41')];if(!_0x3f836b['query']['hasOwnProperty'](_0x288a('0x67'))){_0x246d7f[_0x288a('0x2d')]=qs[_0x288a('0x2d')](_0x3f836b[_0x288a('0x42')]['limit']);_0x246d7f['offset']=qs[_0x288a('0x2b')](_0x3f836b[_0x288a('0x42')][_0x288a('0x2b')]);}_0x246d7f[_0x288a('0x49')]=qs[_0x288a('0x4a')](_0x3f836b[_0x288a('0x42')][_0x288a('0x4a')]);_0x246d7f[_0x288a('0x4f')]=qs[_0x288a('0x4b')](_['pick'](_0x3f836b[_0x288a('0x42')],_0x3a155d['filters']));_0x246d7f['where'][_0x288a('0x63')]=_0x270b7b['id'];if(_0x3f836b['query']['filter']){_0x246d7f[_0x288a('0x4f')]=_[_0x288a('0x4e')](_0x246d7f['where'],{'$or':_['map'](_0x246d7f[_0x288a('0x45')],function(_0x5d2323){var _0x465857={};_0x465857[_0x5d2323]={'$like':'%'+_0x3f836b[_0x288a('0x42')][_0x288a('0x4d')]+'%'};return _0x465857;})});}if(_0x3f836b[_0x288a('0x42')][_0x288a('0x9c')]){var _0x4c4da3=_0x3f836b[_0x288a('0x42')][_0x288a('0x9c')][_0x288a('0x9d')](',');var _0x28791f={};_0x28791f[_0x4c4da3[0x0]]={'$gte':moment(_0x4c4da3[0x1])[_0x288a('0x9e')](_0x288a('0x9f'))};_0x246d7f[_0x288a('0x4f')]=_[_0x288a('0x4e')](_0x246d7f[_0x288a('0x4f')],_0x28791f);}_0x246d7f=_['merge']({},_0x246d7f,_0x3f836b[_0x288a('0x50')]);return db['FaxMessage'][_0x288a('0x2e')]({'where':_0x246d7f[_0x288a('0x4f')]})[_0x288a('0x1e')](function(_0x4dd16f){_0x5eaecc['count']=_0x4dd16f;if(_0x3f836b['query'][_0x288a('0x51')]){_0x246d7f[_0x288a('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x246d7f);})[_0x288a('0x1e')](function(_0x16bcc1){_0x5eaecc[_0x288a('0x68')]=_0x16bcc1;return _0x5eaecc;});}})[_0x288a('0x1e')](respondWithFilteredResult(_0x2e8251,_0x246d7f))['catch'](handleError(_0x2e8251,null));};exports[_0x288a('0x3a')]=function(_0x1248dd,_0x2855b2,_0x1767bf){var _0x737d22,_0x3109f7={},_0x3e1bba;if(_0x1248dd['body']['to']){_0x3e1bba=_0x1248dd[_0x288a('0x59')]['to'][0x0];}return db['FaxAccount'][_0x288a('0x57')]({'where':{'id':_0x1248dd[_0x288a('0x55')]['id']},'include':[{'model':db[_0x288a('0xa0')],'as':_0x288a('0xa1'),'include':[{'model':db[_0x288a('0x73')],'as':_0x288a('0xa2'),'where':{'fax':_0x3e1bba},'limit':0x1,'order':[[_0x288a('0x97'),_0x288a('0xa3')]]}]}]})[_0x288a('0x1e')](handleEntityNotFound(_0x2855b2,null))[_0x288a('0x1e')](function(_0x370e4){_0x737d22=_0x370e4;if(_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')]&&_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][_0x288a('0x47')]){for(var _0x462b0b=0x0;_0x462b0b<_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][_0x288a('0x47')];_0x462b0b+=0x1){_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][_0x462b0b]={'filename':_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][_0x462b0b][_0x288a('0x39')],'id':_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][_0x462b0b]['id'],'path':path[_0x288a('0xa5')](config[_0x288a('0xa6')],'server/files/attachments',_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][_0x462b0b][_0x288a('0xa7')])};}}return respondWithRpcPromise(_0x288a('0xa8'),'CheckAfterSend',{'FaxAccountId':_[_0x288a('0xa9')](_0x1248dd['params']['id'])?undefined:_0x1248dd[_0x288a('0x55')]['id'],'path':_[_0x288a('0xa9')](_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][0x0]['path'])?undefined:_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][0x0]['path'],'fax':_[_0x288a('0xa9')](_0x1248dd[_0x288a('0x59')]['to'][0x0])?undefined:_0x1248dd[_0x288a('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0x737d22){if(_[_0x288a('0xa9')](_0x1248dd[_0x288a('0x59')][_0x288a('0xaa')])){_0x1248dd[_0x288a('0x59')][_0x288a('0xaa')]=util[_0x288a('0x9e')]('\x22%s\x22\x20<%s>',_0x737d22['name'],_0x737d22[_0x288a('0xab')]);}if(_0x737d22[_0x288a('0xa1')]){if(_0x737d22[_0x288a('0xa1')]['Contacts'][_0x288a('0x47')]){return _0x737d22[_0x288a('0xa1')][_0x288a('0xa2')][0x0];}else{return db[_0x288a('0x73')][_0x288a('0x58')](_[_0x288a('0xac')](_0x1248dd['body'],{'firstName':_0x1248dd[_0x288a('0x59')]['to'][0x0],'phone':_0x1248dd[_0x288a('0x59')]['to'][0x0],'fax':_0x1248dd['body']['to'][0x0],'ListId':_0x737d22[_0x288a('0xad')]}));}}else{throw new Error(_0x288a('0xae'));}}else{throw new Error(_0x288a('0xaf'));}})[_0x288a('0x1e')](function(_0x3fcba7){if(_0x3fcba7){return db[_0x288a('0x71')][_0x288a('0x57')]({'where':{'ContactId':_0x3fcba7['id'],'closed':![],'FaxAccountId':_0x737d22['id']}})['then'](function(_0x1a02bf){if(_0x1a02bf){return[_0x1a02bf,![]];}return db[_0x288a('0x71')][_0x288a('0x58')]({'UserId':_0x1248dd[_0x288a('0x5a')]['id'],'ContactId':_0x3fcba7['id'],'FaxAccountId':_0x737d22['id'],'fax':_0x1248dd[_0x288a('0x59')]['to'][0x0],'firstMsgDirection':_0x288a('0xb0'),'Messages':[_[_0x288a('0x4e')](_0x1248dd[_0x288a('0x59')],{'read':![],'body':_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][0x0][_0x288a('0xb1')],'FaxAccountId':_0x737d22['id'],'UserId':_0x1248dd['user']['id'],'ContactId':_0x3fcba7['id'],'AttachmentId':_0x1248dd['body'][_0x288a('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0x288a('0x9b')],'as':'Messages'}]})[_0x288a('0x1e')](function(_0x336d8a){return[_0x336d8a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x288a('0xb2')](function(_0x4ec709,_0x58ef90){if(_0x58ef90){return _0x4ec709;}return db[_0x288a('0x9b')][_0x288a('0x58')]({'direction':_0x288a('0xb0'),'read':![],'body':_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][0x0][_0x288a('0xb1')],'FaxAccountId':_0x737d22['id'],'FaxInteractionId':_0x4ec709['id'],'UserId':_0x1248dd[_0x288a('0x5a')]['id'],'ContactId':_0x4ec709[_0x288a('0xb3')],'AttachmentId':_0x1248dd[_0x288a('0x59')]['attachments'][0x0]['id']})[_0x288a('0x1e')](function(_0x53a1b7){_0x4ec709[_0x288a('0xb4')][_0x288a('0xb5')]=[];_0x4ec709[_0x288a('0xb4')][_0x288a('0xb5')][_0x288a('0x87')](_0x53a1b7[_0x288a('0xb4')]);return _0x4ec709;});})[_0x288a('0x1e')](function(_0x5dacdc){respondWithRpcPromise(_0x288a('0xb6'),_0x288a('0xb6'),{'FaxAccountId':_[_0x288a('0xa9')](_0x1248dd[_0x288a('0x55')]['id'])?undefined:_0x1248dd[_0x288a('0x55')]['id'],'path':_[_0x288a('0xa9')](_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][0x0]['path'])?undefined:_0x1248dd['body'][_0x288a('0xa4')][0x0][_0x288a('0x8')],'fax':_[_0x288a('0xa9')](_0x1248dd[_0x288a('0x59')]['to'][0x0])?undefined:_0x1248dd[_0x288a('0x59')]['to'][0x0],'AttachmentId':_0x1248dd[_0x288a('0x59')][_0x288a('0xa4')][0x0]['id']},client9002)[_0x288a('0x1e')](function(_0x908c23){logger[_0x288a('0x25')](_0x288a('0xb7'),_0x908c23);})[_0x288a('0x27')](function(_0x8b2e4){logger['info'](_0x288a('0xb7'),_0x8b2e4);});return _0x5dacdc;})[_0x288a('0x1e')](respondWithResult(_0x2855b2,null))[_0x288a('0x27')](handleError(_0x2855b2,null));};exports['addAgents']=function(_0x15cc82,_0x1395ad,_0x4cb476){return db[_0x288a('0x53')][_0x288a('0x57')]({'where':{'id':_0x15cc82[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x1395ad,null))[_0x288a('0x1e')](function(_0x198f58){if(_0x198f58){return _0x198f58[_0x288a('0xb8')](_0x15cc82[_0x288a('0x59')][_0x288a('0x6a')],_[_0x288a('0x95')](_0x15cc82[_0x288a('0x59')],[_0x288a('0x6a'),'id'])||{})[_0x288a('0xb2')](function(_0x283828){for(var _0xc835c2=0x0;_0xc835c2<_0x15cc82[_0x288a('0x59')][_0x288a('0x6a')][_0x288a('0x47')];_0xc835c2+=0x1){socket[_0x288a('0xb9')]('userFaxAccount:save',{'UserId':Number(_0x15cc82[_0x288a('0x59')][_0x288a('0x6a')][_0xc835c2]),'FaxAccountId':Number(_0x15cc82[_0x288a('0x55')]['id'])});}return _0x283828;});}})['then'](respondWithResult(_0x1395ad,null))[_0x288a('0x27')](handleError(_0x1395ad,null));};exports[_0x288a('0xba')]=function(_0x3bf53d,_0x1cc071,_0x5a3090){return db[_0x288a('0x53')][_0x288a('0x57')]({'where':{'id':_0x3bf53d['params']['id']}})['then'](handleEntityNotFound(_0x1cc071,null))[_0x288a('0x1e')](function(_0x13e453){if(_0x13e453){return _0x13e453[_0x288a('0xba')](_0x3bf53d[_0x288a('0x42')][_0x288a('0x6a')])[_0x288a('0x1e')](function(){if(_['isArray'](_0x3bf53d[_0x288a('0x42')]['ids'])){for(var _0x232583=0x0;_0x232583<_0x3bf53d[_0x288a('0x42')][_0x288a('0x6a')][_0x288a('0x47')];_0x232583+=0x1){socket[_0x288a('0xb9')](_0x288a('0xbb'),{'UserId':Number(_0x3bf53d[_0x288a('0x42')][_0x288a('0x6a')][_0x232583]),'FaxAccountId':Number(_0x3bf53d['params']['id'])});}}else{socket[_0x288a('0xb9')](_0x288a('0xbb'),{'UserId':Number(_0x3bf53d['query']['ids']),'FaxAccountId':Number(_0x3bf53d[_0x288a('0x55')]['id'])});}});}})[_0x288a('0x1e')](respondWithStatusCode(_0x1cc071,null))[_0x288a('0x27')](handleError(_0x1cc071,null));};exports[_0x288a('0xbc')]=function(_0x1649b9,_0x14f8ed,_0x1dab34){var _0x2e8a55={};var _0x494c67={};var _0x487a94;var _0x22ea9a;return db[_0x288a('0x53')][_0x288a('0x66')]({'where':{'id':_0x1649b9[_0x288a('0x55')]['id']}})[_0x288a('0x1e')](handleEntityNotFound(_0x14f8ed,null))[_0x288a('0x1e')](function(_0x5efabe){if(_0x5efabe){_0x487a94=_0x5efabe;_0x494c67[_0x288a('0x41')]=_[_0x288a('0x43')](db[_0x288a('0x75')][_0x288a('0x3e')]);_0x494c67[_0x288a('0x42')]=_[_0x288a('0x43')](_0x1649b9[_0x288a('0x42')]);_0x494c67[_0x288a('0x4b')]=_[_0x288a('0x44')](_0x494c67['model'],_0x494c67[_0x288a('0x42')]);_0x2e8a55[_0x288a('0x45')]=_[_0x288a('0x44')](_0x494c67[_0x288a('0x41')],qs[_0x288a('0x46')](_0x1649b9['query']['fields']));_0x2e8a55[_0x288a('0x45')]=_0x2e8a55['attributes'][_0x288a('0x47')]?_0x2e8a55[_0x288a('0x45')]:_0x494c67[_0x288a('0x41')];_0x2e8a55['order']=qs[_0x288a('0x4a')](_0x1649b9[_0x288a('0x42')][_0x288a('0x4a')]);_0x2e8a55[_0x288a('0x4f')]=qs[_0x288a('0x4b')](_[_0x288a('0x4c')](_0x1649b9[_0x288a('0x42')],_0x494c67['filters']));if(_0x1649b9[_0x288a('0x42')][_0x288a('0x4d')]){_0x2e8a55[_0x288a('0x4f')]=_[_0x288a('0x4e')](_0x2e8a55['where'],{'$or':_[_0x288a('0x3d')](_0x2e8a55[_0x288a('0x45')],function(_0x9400a1){var _0x55e2a4={};_0x55e2a4[_0x9400a1]={'$like':'%'+_0x1649b9[_0x288a('0x42')][_0x288a('0x4d')]+'%'};return _0x55e2a4;})});}_0x2e8a55=_[_0x288a('0x4e')]({},_0x2e8a55,_0x1649b9['options']);return _0x487a94[_0x288a('0xbc')](_0x2e8a55);}})[_0x288a('0x1e')](function(_0xc0f018){if(_0xc0f018){_0x22ea9a=_0xc0f018['length'];if(!_0x1649b9[_0x288a('0x42')]['hasOwnProperty']('nolimit')){_0x2e8a55[_0x288a('0x2d')]=qs['limit'](_0x1649b9['query'][_0x288a('0x2d')]);_0x2e8a55['offset']=qs[_0x288a('0x2b')](_0x1649b9['query']['offset']);}return _0x487a94[_0x288a('0xbc')](_0x2e8a55);}})[_0x288a('0x1e')](function(_0x2c5fb5){if(_0x2c5fb5){return _0x2c5fb5?{'count':_0x22ea9a,'rows':_0x2c5fb5}:null;}})[_0x288a('0x1e')](respondWithResult(_0x14f8ed,null))['catch'](handleError(_0x14f8ed,null));}; \ No newline at end of file +var _0xea62=['isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','then','stack','name','Pause','map','FaxAccount','rawAttributes','type','key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','find','describe','Disposition','findOne','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','createdAt','TrunkId','ListId','findById','FaxMessage','$gte','format','send','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','out','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents'];(function(_0x166e49,_0x2146f8){var _0x55521b=function(_0x4162f0){while(--_0x4162f0){_0x166e49['push'](_0x166e49['shift']());}};_0x55521b(++_0x2146f8);}(_0xea62,0xbc));var _0x2ea6=function(_0x252ef1,_0x2e0041){_0x252ef1=_0x252ef1-0x0;var _0x25817c=_0xea62[_0x252ef1];return _0x25817c;};'use strict';var emlformat=require(_0x2ea6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ea6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ea6('0x2'));var moment=require(_0x2ea6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2ea6('0x4'));var path=require(_0x2ea6('0x5'));var sox=require(_0x2ea6('0x6'));var csv=require(_0x2ea6('0x7'));var ejs=require(_0x2ea6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ea6('0x9'));var squel=require(_0x2ea6('0xa'));var crypto=require('crypto');var jsforce=require(_0x2ea6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2ea6('0x7'));var querystring=require(_0x2ea6('0xc'));var Papa=require(_0x2ea6('0xd'));var Redis=require(_0x2ea6('0xe'));var authService=require(_0x2ea6('0xf'));var qs=require(_0x2ea6('0x10'));var as=require(_0x2ea6('0x11'));var hardwareService=require(_0x2ea6('0x12'));var logger=require('../../config/logger')(_0x2ea6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2ea6('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x2ea6('0x15'),'port':0x18eb});var socket=require(_0x2ea6('0x16'))(new Redis(config['redis']));require(_0x2ea6('0x17'))[_0x2ea6('0x18')](socket);var jayson=require(_0x2ea6('0x19'));var client=jayson[_0x2ea6('0x1a')][_0x2ea6('0x1b')]({'port':0x232c});var client9002=jayson[_0x2ea6('0x1a')][_0x2ea6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e49,_0x39666e,_0x488cd1,_0xff724){return new BPromise(function(_0x58233f,_0x4734cd){var _0x45c2f6=_0xff724||client;return _0x45c2f6[_0x2ea6('0x1c')](_0x4c6e49,_0x488cd1)['then'](function(_0x348342){logger[_0x2ea6('0x1d')](_0x2ea6('0x1e'),_0x39666e,_0x2ea6('0x1f'));logger[_0x2ea6('0x20')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x39666e,'request\x20sent',JSON[_0x2ea6('0x21')](_0x348342));if(_0x348342['error']){if(_0x348342[_0x2ea6('0x22')][_0x2ea6('0x23')]===0x1f4){logger['error'](_0x2ea6('0x1e'),_0x39666e,_0x348342[_0x2ea6('0x22')][_0x2ea6('0x24')]);return _0x4734cd(_0x348342[_0x2ea6('0x22')]['message']);}logger[_0x2ea6('0x22')](_0x2ea6('0x1e'),_0x39666e,_0x348342[_0x2ea6('0x22')][_0x2ea6('0x24')]);return _0x58233f(_0x348342[_0x2ea6('0x22')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x39666e,_0x2ea6('0x1f'));_0x58233f(_0x348342[_0x2ea6('0x25')][_0x2ea6('0x24')]);}})[_0x2ea6('0x26')](function(_0x40f1b0){logger[_0x2ea6('0x22')](_0x2ea6('0x1e'),_0x39666e,_0x40f1b0);_0x4734cd(_0x40f1b0);});});}function respondWithStatusCode(_0x50c8f6,_0x96ad1c){_0x96ad1c=_0x96ad1c||0xcc;return function(_0x16432a){if(_0x16432a){return _0x50c8f6[_0x2ea6('0x27')](_0x96ad1c);}return _0x50c8f6[_0x2ea6('0x28')](_0x96ad1c)[_0x2ea6('0x29')]();};}function respondWithResult(_0x2fff1b,_0x4292a2){_0x4292a2=_0x4292a2||0xc8;return function(_0x501129){if(_0x501129){return _0x2fff1b[_0x2ea6('0x28')](_0x4292a2)[_0x2ea6('0x2a')](_0x501129);}};}function respondWithFilteredResult(_0x570a9c,_0x1568ae){return function(_0x13dfea){if(_0x13dfea){var _0x5e6d85=typeof _0x1568ae['offset']==='undefined'&&typeof _0x1568ae[_0x2ea6('0x2b')]===_0x2ea6('0x2c');var _0x5751b4=_0x13dfea['count'];var _0x39d505=_0x5e6d85?0x0:_0x1568ae[_0x2ea6('0x2d')];var _0x5d5845=_0x5e6d85?_0x13dfea[_0x2ea6('0x2e')]:_0x1568ae[_0x2ea6('0x2d')]+_0x1568ae['limit'];var _0x1ab914;if(_0x5d5845>=_0x5751b4){_0x5d5845=_0x5751b4;_0x1ab914=0xc8;}else{_0x1ab914=0xce;}_0x570a9c[_0x2ea6('0x28')](_0x1ab914);return _0x570a9c['set'](_0x2ea6('0x2f'),_0x39d505+'-'+_0x5d5845+'/'+_0x5751b4)['json'](_0x13dfea);}return null;};}function patchUpdates(_0x24504d){return function(_0x3b11cf){try{jsonpatch[_0x2ea6('0x30')](_0x3b11cf,_0x24504d,!![]);}catch(_0x1e20a4){return BPromise[_0x2ea6('0x31')](_0x1e20a4);}return _0x3b11cf[_0x2ea6('0x32')]();};}function saveUpdates(_0xb443bf,_0x30d0b8){return function(_0x155474){if(_0x155474){return _0x155474['update'](_0xb443bf)['then'](function(_0x114904){return _0x114904;});}return null;};}function removeEntity(_0x11807b,_0x5ee66a){return function(_0x567360){if(_0x567360){return _0x567360[_0x2ea6('0x33')]()['then'](function(){var _0x41d254=_0x567360[_0x2ea6('0x34')]({'plain':!![]});var _0x3da4f5=_0x2ea6('0x35');return db[_0x2ea6('0x36')]['destroy']({'where':{'type':_0x3da4f5,'resourceId':_0x41d254['id']}})[_0x2ea6('0x37')](function(){return _0x567360;});})[_0x2ea6('0x37')](function(){_0x11807b[_0x2ea6('0x28')](0xcc)[_0x2ea6('0x29')]();});}};}function handleEntityNotFound(_0x3db8a8,_0xddabeb){return function(_0x49dcb7){if(!_0x49dcb7){_0x3db8a8[_0x2ea6('0x27')](0x194);}return _0x49dcb7;};}function handleError(_0x5afce9,_0x167051){_0x167051=_0x167051||0x1f4;return function(_0x2df9a5){logger['error'](_0x2df9a5[_0x2ea6('0x38')]);if(_0x2df9a5[_0x2ea6('0x39')]){delete _0x2df9a5[_0x2ea6('0x39')];}_0x5afce9[_0x2ea6('0x28')](_0x167051)['send'](_0x2df9a5);};}exports['index']=function(_0x31f2ee,_0xea41cb){var _0x30bee3={'include':[{'model':db[_0x2ea6('0x3a')],'as':'mandatoryDispositionPause'}]},_0x3f25f8={},_0x48e0ea={'count':0x0,'rows':[]};var _0x1f52c3=_[_0x2ea6('0x3b')](db[_0x2ea6('0x3c')][_0x2ea6('0x3d')],function(_0xf2734b){return{'name':_0xf2734b['fieldName'],'type':_0xf2734b[_0x2ea6('0x3e')][_0x2ea6('0x3f')]};});_0x3f25f8[_0x2ea6('0x40')]=_[_0x2ea6('0x3b')](_0x1f52c3,_0x2ea6('0x39'));_0x3f25f8['query']=_[_0x2ea6('0x41')](_0x31f2ee[_0x2ea6('0x42')]);_0x3f25f8['filters']=_[_0x2ea6('0x43')](_0x3f25f8['model'],_0x3f25f8[_0x2ea6('0x42')]);_0x30bee3['attributes']=_[_0x2ea6('0x43')](_0x3f25f8[_0x2ea6('0x40')],qs[_0x2ea6('0x44')](_0x31f2ee['query']['fields']));_0x30bee3['attributes']=_0x30bee3['attributes'][_0x2ea6('0x45')]?_0x30bee3[_0x2ea6('0x46')]:_0x3f25f8[_0x2ea6('0x40')];if(!_0x31f2ee['query'][_0x2ea6('0x47')](_0x2ea6('0x48'))){_0x30bee3[_0x2ea6('0x2b')]=qs[_0x2ea6('0x2b')](_0x31f2ee['query'][_0x2ea6('0x2b')]);_0x30bee3[_0x2ea6('0x2d')]=qs[_0x2ea6('0x2d')](_0x31f2ee[_0x2ea6('0x42')][_0x2ea6('0x2d')]);}_0x30bee3[_0x2ea6('0x49')]=qs[_0x2ea6('0x4a')](_0x31f2ee[_0x2ea6('0x42')][_0x2ea6('0x4a')]);_0x30bee3[_0x2ea6('0x4b')]=qs[_0x2ea6('0x4c')](_[_0x2ea6('0x4d')](_0x31f2ee[_0x2ea6('0x42')],_0x3f25f8[_0x2ea6('0x4c')]),_0x1f52c3);if(_0x31f2ee[_0x2ea6('0x42')][_0x2ea6('0x4e')]){_0x30bee3['where']=_['merge'](_0x30bee3[_0x2ea6('0x4b')],{'$or':_[_0x2ea6('0x3b')](_0x1f52c3,function(_0x108644){if(_0x108644['type']!==_0x2ea6('0x4f')){var _0x46af9d={};_0x46af9d[_0x108644[_0x2ea6('0x39')]]={'$like':'%'+_0x31f2ee[_0x2ea6('0x42')][_0x2ea6('0x4e')]+'%'};return _0x46af9d;}})});}_0x30bee3=_[_0x2ea6('0x50')]({},_0x30bee3,_0x31f2ee[_0x2ea6('0x51')]);var _0x39fb18={'where':_0x30bee3[_0x2ea6('0x4b')]};return db[_0x2ea6('0x3c')]['count'](_0x39fb18)[_0x2ea6('0x37')](function(_0xd8bcdf){_0x48e0ea[_0x2ea6('0x2e')]=_0xd8bcdf;if(_0x31f2ee[_0x2ea6('0x42')][_0x2ea6('0x52')]){_0x30bee3[_0x2ea6('0x53')]=[{'all':!![]}];}return db[_0x2ea6('0x3c')][_0x2ea6('0x54')](_0x30bee3);})[_0x2ea6('0x37')](function(_0x44a64d){_0x48e0ea[_0x2ea6('0x55')]=_0x44a64d;return _0x48e0ea;})[_0x2ea6('0x37')](respondWithFilteredResult(_0xea41cb,_0x30bee3))[_0x2ea6('0x26')](handleError(_0xea41cb,null));};exports[_0x2ea6('0x56')]=function(_0x41ec75,_0x107cf7){var _0x169496={'raw':![],'where':{'id':_0x41ec75['params']['id']},'include':[{'model':db[_0x2ea6('0x3a')],'as':_0x2ea6('0x57')}]},_0x5ef911={};_0x5ef911['model']=_[_0x2ea6('0x41')](db[_0x2ea6('0x3c')][_0x2ea6('0x3d')]);_0x5ef911['query']=_['keys'](_0x41ec75[_0x2ea6('0x42')]);_0x5ef911[_0x2ea6('0x4c')]=_[_0x2ea6('0x43')](_0x5ef911[_0x2ea6('0x40')],_0x5ef911[_0x2ea6('0x42')]);_0x169496[_0x2ea6('0x46')]=_[_0x2ea6('0x43')](_0x5ef911[_0x2ea6('0x40')],qs['fields'](_0x41ec75[_0x2ea6('0x42')][_0x2ea6('0x44')]));_0x169496['attributes']=_0x169496[_0x2ea6('0x46')][_0x2ea6('0x45')]?_0x169496['attributes']:_0x5ef911['model'];if(_0x41ec75['query']['includeAll']){_0x169496[_0x2ea6('0x53')]=[{'all':!![]}];}_0x169496=_[_0x2ea6('0x50')]({},_0x169496,_0x41ec75[_0x2ea6('0x51')]);return db[_0x2ea6('0x3c')]['find'](_0x169496)[_0x2ea6('0x37')](handleEntityNotFound(_0x107cf7,null))[_0x2ea6('0x37')](respondWithResult(_0x107cf7,null))[_0x2ea6('0x26')](handleError(_0x107cf7,null));};exports['create']=function(_0xdaa5e0,_0x15a64f){return db[_0x2ea6('0x3c')][_0x2ea6('0x58')](_0xdaa5e0['body'],{})[_0x2ea6('0x37')](function(_0x5cf6f8){var _0xa1cc52=_0xdaa5e0['user'][_0x2ea6('0x34')]({'plain':!![]});if(!_0xa1cc52)throw new Error(_0x2ea6('0x59'));if(_0xa1cc52[_0x2ea6('0x5a')]===_0x2ea6('0x5b')){var _0x5b9631=_0x5cf6f8[_0x2ea6('0x34')]({'plain':!![]});var _0xb33b5d='FaxAccounts';return db['UserProfileSection']['find']({'where':{'name':_0xb33b5d,'userProfileId':_0xa1cc52[_0x2ea6('0x5c')]},'raw':!![]})[_0x2ea6('0x37')](function(_0x4541b0){if(_0x4541b0&&_0x4541b0['autoAssociation']===0x0){return db[_0x2ea6('0x36')]['create']({'name':_0x5b9631[_0x2ea6('0x39')],'resourceId':_0x5b9631['id'],'type':_0x4541b0[_0x2ea6('0x39')],'sectionId':_0x4541b0['id']},{})['then'](function(){return _0x5cf6f8;});}else{return _0x5cf6f8;}})[_0x2ea6('0x26')](function(_0x40202b){logger['error'](_0x2ea6('0x5d'),_0x40202b);throw _0x40202b;});}return _0x5cf6f8;})[_0x2ea6('0x37')](respondWithResult(_0x15a64f,0xc9))[_0x2ea6('0x26')](handleError(_0x15a64f,null));};exports[_0x2ea6('0x5e')]=function(_0x55486e,_0x5e36d0){if(_0x55486e[_0x2ea6('0x5f')]['id']){delete _0x55486e[_0x2ea6('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x55486e[_0x2ea6('0x60')]['id']},'include':[{'model':db[_0x2ea6('0x3a')],'as':_0x2ea6('0x57')}]})[_0x2ea6('0x37')](handleEntityNotFound(_0x5e36d0,null))[_0x2ea6('0x37')](saveUpdates(_0x55486e['body'],null))[_0x2ea6('0x37')](respondWithResult(_0x5e36d0,null))[_0x2ea6('0x26')](handleError(_0x5e36d0,null));};exports[_0x2ea6('0x33')]=function(_0x94fab8,_0x55c10a){return db[_0x2ea6('0x3c')][_0x2ea6('0x61')]({'where':{'id':_0x94fab8[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x55c10a,null))[_0x2ea6('0x37')](removeEntity(_0x55c10a,null))[_0x2ea6('0x26')](handleError(_0x55c10a,null));};exports[_0x2ea6('0x62')]=function(_0x3d87c4,_0x3763f5){return db[_0x2ea6('0x3c')][_0x2ea6('0x62')]()[_0x2ea6('0x37')](respondWithResult(_0x3763f5,null))[_0x2ea6('0x26')](handleError(_0x3763f5,null));};exports['addDisposition']=function(_0x1b3f83,_0x10fecc,_0xbbd9c0){if(_0x1b3f83['body']['id']){delete _0x1b3f83[_0x2ea6('0x5f')]['id'];}return db[_0x2ea6('0x3c')][_0x2ea6('0x61')]({'where':{'id':_0x1b3f83[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x10fecc,null))[_0x2ea6('0x37')](function(_0xd04da2){if(_0xd04da2){_0x1b3f83[_0x2ea6('0x5f')]['FaxAccountId']=_0xd04da2['id'];return db[_0x2ea6('0x63')][_0x2ea6('0x58')](_0x1b3f83[_0x2ea6('0x5f')]);}})[_0x2ea6('0x37')](respondWithResult(_0x10fecc,null))[_0x2ea6('0x26')](handleError(_0x10fecc,null));};exports['getDispositions']=function(_0x35066b,_0xf2299c,_0x5c1a29){var _0x1a2856={'raw':![],'where':{}};var _0x1a4574={};var _0xc2d0a7={'count':0x0,'rows':[]};return db[_0x2ea6('0x3c')][_0x2ea6('0x64')]({'where':{'id':_0x35066b[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0xf2299c,null))[_0x2ea6('0x37')](function(_0x2eea0a){if(_0x2eea0a){_0x1a4574[_0x2ea6('0x40')]=_[_0x2ea6('0x41')](db[_0x2ea6('0x63')][_0x2ea6('0x3d')]);_0x1a4574[_0x2ea6('0x42')]=_[_0x2ea6('0x41')](_0x35066b[_0x2ea6('0x42')]);_0x1a4574[_0x2ea6('0x4c')]=_[_0x2ea6('0x43')](_0x1a4574[_0x2ea6('0x40')],_0x1a4574[_0x2ea6('0x42')]);_0x1a2856['attributes']=_[_0x2ea6('0x43')](_0x1a4574[_0x2ea6('0x40')],qs[_0x2ea6('0x44')](_0x35066b[_0x2ea6('0x42')][_0x2ea6('0x44')]));_0x1a2856[_0x2ea6('0x46')]=_0x1a2856['attributes'][_0x2ea6('0x45')]?_0x1a2856[_0x2ea6('0x46')]:_0x1a4574[_0x2ea6('0x40')];if(!_0x35066b[_0x2ea6('0x42')]['hasOwnProperty'](_0x2ea6('0x48'))){_0x1a2856[_0x2ea6('0x2b')]=qs['limit'](_0x35066b['query'][_0x2ea6('0x2b')]);_0x1a2856[_0x2ea6('0x2d')]=qs[_0x2ea6('0x2d')](_0x35066b['query'][_0x2ea6('0x2d')]);}_0x1a2856[_0x2ea6('0x49')]=qs[_0x2ea6('0x4a')](_0x35066b[_0x2ea6('0x42')][_0x2ea6('0x4a')]);_0x1a2856[_0x2ea6('0x4b')]=qs[_0x2ea6('0x4c')](_['pick'](_0x35066b[_0x2ea6('0x42')],_0x1a4574[_0x2ea6('0x4c')]));_0x1a2856['where'][_0x2ea6('0x65')]=_0x2eea0a['id'];if(_0x35066b['query']['filter']){_0x1a2856['where']=_[_0x2ea6('0x50')](_0x1a2856[_0x2ea6('0x4b')],{'$or':_[_0x2ea6('0x3b')](_0x1a2856['attributes'],function(_0x533b5b){var _0x379f78={};_0x379f78[_0x533b5b]={'$like':'%'+_0x35066b[_0x2ea6('0x42')][_0x2ea6('0x4e')]+'%'};return _0x379f78;})});}_0x1a2856=_[_0x2ea6('0x50')]({},_0x1a2856,_0x35066b['options']);return db[_0x2ea6('0x63')][_0x2ea6('0x2e')]({'where':_0x1a2856['where']})[_0x2ea6('0x37')](function(_0x16b474){_0xc2d0a7['count']=_0x16b474;if(_0x35066b[_0x2ea6('0x42')][_0x2ea6('0x52')]){_0x1a2856[_0x2ea6('0x53')]=[{'all':!![]}];}return db[_0x2ea6('0x63')][_0x2ea6('0x54')](_0x1a2856);})[_0x2ea6('0x37')](function(_0x48c822){_0xc2d0a7[_0x2ea6('0x55')]=_0x48c822;return _0xc2d0a7;});}})[_0x2ea6('0x37')](respondWithFilteredResult(_0xf2299c,_0x1a2856))[_0x2ea6('0x26')](handleError(_0xf2299c,null));};exports[_0x2ea6('0x66')]=function(_0x5125b6,_0x2cd425,_0x2b3c6b){return db[_0x2ea6('0x3c')][_0x2ea6('0x61')]({'where':{'id':_0x5125b6[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x2cd425,null))[_0x2ea6('0x37')](function(_0x8f56ab){if(_0x8f56ab){return _0x8f56ab[_0x2ea6('0x66')](_0x5125b6[_0x2ea6('0x42')][_0x2ea6('0x67')]);}})[_0x2ea6('0x37')](respondWithStatusCode(_0x2cd425,null))[_0x2ea6('0x26')](handleError(_0x2cd425,null));};exports[_0x2ea6('0x68')]=function(_0x2c3608,_0x11ae4d,_0x235550){if(_0x2c3608[_0x2ea6('0x5f')]['id']){delete _0x2c3608['body']['id'];}return db[_0x2ea6('0x3c')]['find']({'where':{'id':_0x2c3608[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x11ae4d,null))['then'](function(_0x2b6f39){if(_0x2b6f39){_0x2c3608[_0x2ea6('0x5f')][_0x2ea6('0x65')]=_0x2b6f39['id'];return db[_0x2ea6('0x69')][_0x2ea6('0x58')](_0x2c3608[_0x2ea6('0x5f')]);}})[_0x2ea6('0x37')](respondWithResult(_0x11ae4d,null))['catch'](handleError(_0x11ae4d,null));};exports[_0x2ea6('0x6a')]=function(_0x28408f,_0x45747c,_0x2dc712){var _0x14b919={'raw':![],'where':{}};var _0x4495fe={};var _0x47c4d1={'count':0x0,'rows':[]};return db[_0x2ea6('0x3c')][_0x2ea6('0x64')]({'where':{'id':_0x28408f[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x45747c,null))[_0x2ea6('0x37')](function(_0x1006f8){if(_0x1006f8){_0x4495fe[_0x2ea6('0x40')]=_[_0x2ea6('0x41')](db[_0x2ea6('0x69')][_0x2ea6('0x3d')]);_0x4495fe[_0x2ea6('0x42')]=_['keys'](_0x28408f[_0x2ea6('0x42')]);_0x4495fe['filters']=_[_0x2ea6('0x43')](_0x4495fe[_0x2ea6('0x40')],_0x4495fe['query']);_0x14b919[_0x2ea6('0x46')]=_['intersection'](_0x4495fe['model'],qs[_0x2ea6('0x44')](_0x28408f[_0x2ea6('0x42')][_0x2ea6('0x44')]));_0x14b919[_0x2ea6('0x46')]=_0x14b919['attributes']['length']?_0x14b919[_0x2ea6('0x46')]:_0x4495fe[_0x2ea6('0x40')];if(!_0x28408f[_0x2ea6('0x42')][_0x2ea6('0x47')](_0x2ea6('0x48'))){_0x14b919[_0x2ea6('0x2b')]=qs['limit'](_0x28408f[_0x2ea6('0x42')][_0x2ea6('0x2b')]);_0x14b919['offset']=qs['offset'](_0x28408f[_0x2ea6('0x42')][_0x2ea6('0x2d')]);}_0x14b919[_0x2ea6('0x49')]=qs[_0x2ea6('0x4a')](_0x28408f['query'][_0x2ea6('0x4a')]);_0x14b919[_0x2ea6('0x4b')]=qs[_0x2ea6('0x4c')](_[_0x2ea6('0x4d')](_0x28408f['query'],_0x4495fe[_0x2ea6('0x4c')]));_0x14b919[_0x2ea6('0x4b')][_0x2ea6('0x65')]=_0x1006f8['id'];if(_0x28408f[_0x2ea6('0x42')]['filter']){_0x14b919['where']=_[_0x2ea6('0x50')](_0x14b919[_0x2ea6('0x4b')],{'$or':_[_0x2ea6('0x3b')](_0x14b919[_0x2ea6('0x46')],function(_0x4967af){var _0x105d57={};_0x105d57[_0x4967af]={'$like':'%'+_0x28408f[_0x2ea6('0x42')][_0x2ea6('0x4e')]+'%'};return _0x105d57;})});}_0x14b919=_[_0x2ea6('0x50')]({},_0x14b919,_0x28408f[_0x2ea6('0x51')]);return db[_0x2ea6('0x69')][_0x2ea6('0x2e')]({'where':_0x14b919[_0x2ea6('0x4b')]})['then'](function(_0x18cb5b){_0x47c4d1[_0x2ea6('0x2e')]=_0x18cb5b;if(_0x28408f[_0x2ea6('0x42')][_0x2ea6('0x52')]){_0x14b919[_0x2ea6('0x53')]=[{'all':!![]}];}return db[_0x2ea6('0x69')]['findAll'](_0x14b919);})['then'](function(_0x28a672){_0x47c4d1['rows']=_0x28a672;return _0x47c4d1;});}})[_0x2ea6('0x37')](respondWithFilteredResult(_0x45747c,_0x14b919))[_0x2ea6('0x26')](handleError(_0x45747c,null));};exports['removeAnswers']=function(_0x1d1ba7,_0xb94a46,_0x496e87){return db[_0x2ea6('0x3c')][_0x2ea6('0x61')]({'where':{'id':_0x1d1ba7['params']['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0xb94a46,null))[_0x2ea6('0x37')](function(_0x285372){if(_0x285372){return _0x285372[_0x2ea6('0x6b')](_0x1d1ba7[_0x2ea6('0x42')][_0x2ea6('0x67')]);}})[_0x2ea6('0x37')](respondWithStatusCode(_0xb94a46,null))[_0x2ea6('0x26')](handleError(_0xb94a46,null));};exports[_0x2ea6('0x6c')]=function(_0x230ab9,_0x44f09b,_0x1324ff){return db[_0x2ea6('0x6d')][_0x2ea6('0x61')]({'where':{'id':_0x230ab9[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x44f09b,null))[_0x2ea6('0x37')](function(_0x461ec9){if(_0x461ec9){return _0x461ec9['addInteraction'](_0x230ab9[_0x2ea6('0x5f')]['ids'],_[_0x2ea6('0x6e')](_0x230ab9[_0x2ea6('0x5f')],[_0x2ea6('0x67'),'id'])||{});}})[_0x2ea6('0x37')](respondWithResult(_0x44f09b,null))['catch'](handleError(_0x44f09b,null));};exports[_0x2ea6('0x6f')]=function(_0x47de46,_0x331aca,_0x2b1f2c){var _0x38a459={'raw':![],'where':{}};var _0x478e02={};var _0x4a240={'count':0x0,'rows':[]};return db[_0x2ea6('0x3c')][_0x2ea6('0x64')]({'where':{'id':_0x47de46[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x331aca,null))[_0x2ea6('0x37')](function(_0x38609f){if(_0x38609f){_0x478e02[_0x2ea6('0x40')]=_[_0x2ea6('0x41')](db[_0x2ea6('0x6d')][_0x2ea6('0x3d')]);_0x478e02['query']=_[_0x2ea6('0x41')](_0x47de46[_0x2ea6('0x42')]);_0x478e02[_0x2ea6('0x4c')]=_['intersection'](_0x478e02[_0x2ea6('0x40')],_0x478e02['query']);_0x38a459[_0x2ea6('0x46')]=_[_0x2ea6('0x43')](_0x478e02['model'],qs['fields'](_0x47de46[_0x2ea6('0x42')]['fields']));_0x38a459[_0x2ea6('0x46')]=_0x38a459['attributes'][_0x2ea6('0x45')]?_0x38a459[_0x2ea6('0x46')]:_0x478e02['model'];if(!_0x47de46[_0x2ea6('0x42')][_0x2ea6('0x47')]('nolimit')){_0x38a459['limit']=qs[_0x2ea6('0x2b')](_0x47de46['query'][_0x2ea6('0x2b')]);_0x38a459['offset']=qs['offset'](_0x47de46['query'][_0x2ea6('0x2d')]);}_0x38a459[_0x2ea6('0x49')]=qs[_0x2ea6('0x4a')](_0x47de46[_0x2ea6('0x42')]['sort']);_0x38a459[_0x2ea6('0x4b')]=qs[_0x2ea6('0x4c')](_[_0x2ea6('0x4d')](_0x47de46[_0x2ea6('0x42')],_0x478e02[_0x2ea6('0x4c')]));_0x38a459[_0x2ea6('0x4b')][_0x2ea6('0x65')]=_0x38609f['id'];if(_0x47de46[_0x2ea6('0x42')]['filter']){_0x38a459['where']=_[_0x2ea6('0x50')](_0x38a459[_0x2ea6('0x4b')],{'$or':_[_0x2ea6('0x3b')](_0x38a459[_0x2ea6('0x46')],function(_0x2d020d){var _0x2de993={};_0x2de993[_0x2d020d]={'$like':'%'+_0x47de46[_0x2ea6('0x42')]['filter']+'%'};return _0x2de993;})});}_0x38a459=_[_0x2ea6('0x50')]({},_0x38a459,_0x47de46[_0x2ea6('0x51')]);return db[_0x2ea6('0x6d')]['count']({'where':_0x38a459['where']})['then'](function(_0x27ee9c){_0x4a240['count']=_0x27ee9c;if(_0x47de46[_0x2ea6('0x42')][_0x2ea6('0x52')]){_0x38a459[_0x2ea6('0x53')]=[{'model':db[_0x2ea6('0x70')],'as':_0x2ea6('0x71'),'required':![]},{'model':db[_0x2ea6('0x72')],'as':_0x2ea6('0x73'),'attributes':['name',_0x2ea6('0x74'),_0x2ea6('0x75')],'required':![]},{'model':db[_0x2ea6('0x76')],'as':_0x2ea6('0x77'),'attributes':['id',_0x2ea6('0x39'),'color'],'where':_0x47de46['query']['tag']?{'id':_0x47de46[_0x2ea6('0x42')][_0x2ea6('0x78')]}:undefined,'required':_0x47de46[_0x2ea6('0x42')][_0x2ea6('0x78')]?!![]:![]}];}return db[_0x2ea6('0x6d')][_0x2ea6('0x54')](_0x38a459);})['then'](function(_0x15b273){_0x4a240[_0x2ea6('0x55')]=_0x15b273;return _0x4a240;});}})['then'](respondWithFilteredResult(_0x331aca,_0x38a459))[_0x2ea6('0x26')](handleError(_0x331aca,null));};exports[_0x2ea6('0x79')]=function(_0x15e37f,_0x19dd24,_0x258377){return db[_0x2ea6('0x3c')][_0x2ea6('0x64')]({'where':{'id':_0x15e37f[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x19dd24,null))['then'](function(_0x4c9871){if(_0x4c9871){return db[_0x2ea6('0x7a')][_0x2ea6('0x7b')](function(_0x53f3da){return db['FaxApplication'][_0x2ea6('0x33')]({'where':{'FaxAccountId':_0x15e37f[_0x2ea6('0x60')]['id']},'transaction':_0x53f3da})[_0x2ea6('0x37')](function(_0x50b3c9){var _0x49733a=_[_0x2ea6('0x3b')](_0x15e37f[_0x2ea6('0x5f')],function(_0x260d8e){_0x260d8e[_0x2ea6('0x65')]=_0x15e37f[_0x2ea6('0x60')]['id'];return _0x260d8e;});return db[_0x2ea6('0x7c')][_0x2ea6('0x7d')](_0x49733a,{'transaction':_0x53f3da});});})[_0x2ea6('0x37')](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x15e37f['params']['id']},'order':_0x2ea6('0x7e')});});}})[_0x2ea6('0x37')](respondWithResult(_0x19dd24,null))[_0x2ea6('0x26')](handleError(_0x19dd24,null));};exports[_0x2ea6('0x7f')]=function(_0x44a630,_0x20d0ba,_0x2e556c){var _0x2979d2={};var _0x36f823={};var _0xc8f3ee;var _0x52c998;return db[_0x2ea6('0x3c')]['findOne']({'where':{'id':_0x44a630[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x20d0ba,null))[_0x2ea6('0x37')](function(_0xc11d15){if(_0xc11d15){_0xc8f3ee=_0xc11d15;_0x36f823[_0x2ea6('0x40')]=_[_0x2ea6('0x41')](db[_0x2ea6('0x7c')][_0x2ea6('0x3d')]);_0x36f823[_0x2ea6('0x42')]=_[_0x2ea6('0x41')](_0x44a630[_0x2ea6('0x42')]);_0x36f823[_0x2ea6('0x4c')]=_['intersection'](_0x36f823['model'],_0x36f823[_0x2ea6('0x42')]);_0x2979d2[_0x2ea6('0x46')]=_['intersection'](_0x36f823[_0x2ea6('0x40')],qs[_0x2ea6('0x44')](_0x44a630[_0x2ea6('0x42')][_0x2ea6('0x44')]));_0x2979d2[_0x2ea6('0x46')]=_0x2979d2[_0x2ea6('0x46')][_0x2ea6('0x45')]?_0x2979d2[_0x2ea6('0x46')]:_0x36f823[_0x2ea6('0x40')];_0x2979d2[_0x2ea6('0x49')]=qs[_0x2ea6('0x4a')](_0x44a630[_0x2ea6('0x42')][_0x2ea6('0x4a')]);_0x2979d2[_0x2ea6('0x4b')]=qs[_0x2ea6('0x4c')](_[_0x2ea6('0x4d')](_0x44a630[_0x2ea6('0x42')],_0x36f823['filters']));if(_0x44a630[_0x2ea6('0x42')][_0x2ea6('0x4e')]){_0x2979d2[_0x2ea6('0x4b')]=_[_0x2ea6('0x50')](_0x2979d2['where'],{'$or':_[_0x2ea6('0x3b')](_0x2979d2[_0x2ea6('0x46')],function(_0x318dbe){var _0x85abee={};_0x85abee[_0x318dbe]={'$like':'%'+_0x44a630[_0x2ea6('0x42')][_0x2ea6('0x4e')]+'%'};return _0x85abee;})});}_0x2979d2=_['merge']({},_0x2979d2,_0x44a630['options']);return _0xc8f3ee[_0x2ea6('0x7f')](_0x2979d2);}})[_0x2ea6('0x37')](function(_0x58c2c8){if(_0x58c2c8){_0x52c998=_0x58c2c8[_0x2ea6('0x45')];if(!_0x44a630[_0x2ea6('0x42')][_0x2ea6('0x47')]('nolimit')){_0x2979d2[_0x2ea6('0x2b')]=qs[_0x2ea6('0x2b')](_0x44a630[_0x2ea6('0x42')][_0x2ea6('0x2b')]);_0x2979d2[_0x2ea6('0x2d')]=qs[_0x2ea6('0x2d')](_0x44a630[_0x2ea6('0x42')][_0x2ea6('0x2d')]);}return _0xc8f3ee['getApplications'](_0x2979d2);}})['then'](function(_0x37b51d){if(_0x37b51d){return _0x37b51d?{'count':_0x52c998,'rows':_0x37b51d}:null;}})['then'](respondWithResult(_0x20d0ba,null))[_0x2ea6('0x26')](handleError(_0x20d0ba,null));};function Extension(_0x32d1e8,_0x54ec85,_0x4cf16a,_0x5bd8b9){this[_0x2ea6('0x80')]=_0x2ea6('0x81');this[_0x2ea6('0x82')]=_0x32d1e8[_0x2ea6('0x83')];this[_0x2ea6('0x84')]=_0x5bd8b9;this[_0x2ea6('0x3e')]=_0x2ea6('0x85');this[_0x2ea6('0x86')]=_0x2ea6('0x87');this[_0x2ea6('0x65')]=_0x32d1e8['id'];this['priority']=_0x54ec85;this[_0x2ea6('0x88')]=_0x4cf16a;}function createExtensionsReciveFax(_0x5e070e){var _0xbc6638=0x1;var _0x1c44a0=[];_0x1c44a0[_0x2ea6('0x89')](new Extension(_0x5e070e,_0xbc6638,'',_0x2ea6('0x8a')));_0xbc6638+=0x1;_0x1c44a0[_0x2ea6('0x89')](new Extension(_0x5e070e,_0xbc6638,_0x2ea6('0x8b'),_0x2ea6('0x8c')));_0xbc6638+=0x1;for(var _0x54e675 in _0x5e070e){if(_0x5e070e[_0x2ea6('0x47')](_0x54e675)&&(_0x54e675===_0x2ea6('0x8d')||_0x54e675===_0x2ea6('0x83')||_0x54e675==='gateway'||_0x54e675===_0x2ea6('0x8e')||_0x54e675===_0x2ea6('0x8f')||_0x54e675==='maxrate'||_0x54e675===_0x2ea6('0x90')||_0x54e675===_0x2ea6('0x91')||_0x54e675===_0x2ea6('0x92'))){_0x1c44a0[_0x2ea6('0x89')](new Extension(_0x5e070e,_0xbc6638,'FAXOPT('+_0x54e675+')='+_0x5e070e[_0x54e675],_0x2ea6('0x8c')));_0xbc6638+=0x1;}}_0x1c44a0[_0x2ea6('0x89')](new Extension(_0x5e070e,_0xbc6638,'6',_0x2ea6('0x93')));_0xbc6638+=0x1;_0x1c44a0['push'](new Extension(_0x5e070e,_0xbc6638,_0x2ea6('0x94'),'ReceiveFax'));_0xbc6638=0x0;return _0x1c44a0;}exports['addAccountApplications']=function(_0x3e4bc4,_0x1777da,_0x20a288){var _0x19945e;return db[_0x2ea6('0x7a')][_0x2ea6('0x7b')](function(_0x527037){return db[_0x2ea6('0x3c')][_0x2ea6('0x58')](_0x3e4bc4[_0x2ea6('0x5f')],{'transaction':_0x527037})[_0x2ea6('0x37')](function(_0x64d271){_0x19945e=_0x64d271['get']({'plain':!![]});return db[_0x2ea6('0x95')][_0x2ea6('0x7d')](createExtensionsReciveFax(_0x19945e),{'transaction':_0x527037});});})[_0x2ea6('0x37')](function(){return _0x19945e;})[_0x2ea6('0x37')](respondWithResult(_0x1777da,null))[_0x2ea6('0x26')](handleError(_0x1777da,null));};exports[_0x2ea6('0x96')]=function(_0x5ee24b,_0x1683d8,_0x262780){var _0x54b94c;return db[_0x2ea6('0x7a')]['transaction'](function(_0x13a27d){return db[_0x2ea6('0x3c')][_0x2ea6('0x5e')](_0x5ee24b['body'],{'where':{'id':_0x5ee24b[_0x2ea6('0x5f')]['id']},'transaction':_0x13a27d})['then'](function(_0x444a00){return db[_0x2ea6('0x95')][_0x2ea6('0x33')]({'where':{'FaxAccountId':_0x5ee24b[_0x2ea6('0x5f')]['id']},'transaction':_0x13a27d})[_0x2ea6('0x37')](function(_0x5a4cab){return db[_0x2ea6('0x95')][_0x2ea6('0x7d')](createExtensionsReciveFax(_[_0x2ea6('0x6e')](_0x5ee24b[_0x2ea6('0x5f')],['tech',_0x2ea6('0x3f'),_0x2ea6('0x97'),'updatedAt',_0x2ea6('0x98'),_0x2ea6('0x99')])),{'transaction':_0x13a27d});});});})[_0x2ea6('0x37')](function(){return db[_0x2ea6('0x3c')][_0x2ea6('0x9a')](_0x5ee24b['body']['id']);})[_0x2ea6('0x37')](respondWithResult(_0x1683d8,null))[_0x2ea6('0x26')](handleError(_0x1683d8,null));};exports['getMessages']=function(_0x1fa569,_0xa01861,_0x2e9bdd){var _0x211667={'raw':!![],'where':{}};var _0x33c0ec={};var _0x178398={'count':0x0,'rows':[]};return db[_0x2ea6('0x3c')]['findOne']({'where':{'id':_0x1fa569[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0xa01861,null))['then'](function(_0x4affff){if(_0x4affff){_0x33c0ec[_0x2ea6('0x40')]=_['keys'](db[_0x2ea6('0x9b')][_0x2ea6('0x3d')]);_0x33c0ec[_0x2ea6('0x42')]=_[_0x2ea6('0x41')](_0x1fa569[_0x2ea6('0x42')]);_0x33c0ec[_0x2ea6('0x4c')]=_[_0x2ea6('0x43')](_0x33c0ec[_0x2ea6('0x40')],_0x33c0ec[_0x2ea6('0x42')]);_0x211667['attributes']=_['intersection'](_0x33c0ec['model'],qs[_0x2ea6('0x44')](_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x44')]));_0x211667[_0x2ea6('0x46')]=_0x211667[_0x2ea6('0x46')][_0x2ea6('0x45')]?_0x211667[_0x2ea6('0x46')]:_0x33c0ec[_0x2ea6('0x40')];if(!_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x47')](_0x2ea6('0x48'))){_0x211667[_0x2ea6('0x2b')]=qs[_0x2ea6('0x2b')](_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x2b')]);_0x211667[_0x2ea6('0x2d')]=qs[_0x2ea6('0x2d')](_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x2d')]);}_0x211667[_0x2ea6('0x49')]=qs[_0x2ea6('0x4a')](_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x4a')]);_0x211667[_0x2ea6('0x4b')]=qs[_0x2ea6('0x4c')](_[_0x2ea6('0x4d')](_0x1fa569[_0x2ea6('0x42')],_0x33c0ec[_0x2ea6('0x4c')]));_0x211667[_0x2ea6('0x4b')][_0x2ea6('0x65')]=_0x4affff['id'];if(_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x4e')]){_0x211667[_0x2ea6('0x4b')]=_[_0x2ea6('0x50')](_0x211667[_0x2ea6('0x4b')],{'$or':_[_0x2ea6('0x3b')](_0x211667[_0x2ea6('0x46')],function(_0x4b94b4){var _0x2460bd={};_0x2460bd[_0x4b94b4]={'$like':'%'+_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x4e')]+'%'};return _0x2460bd;})});}if(_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x9c')]){var _0x55603b=_0x1fa569['query'][_0x2ea6('0x9c')]['split'](',');var _0x210674={};_0x210674[_0x55603b[0x0]]={'$gte':moment(_0x55603b[0x1])[_0x2ea6('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')};_0x211667[_0x2ea6('0x4b')]=_[_0x2ea6('0x50')](_0x211667[_0x2ea6('0x4b')],_0x210674);}_0x211667=_[_0x2ea6('0x50')]({},_0x211667,_0x1fa569[_0x2ea6('0x51')]);return db[_0x2ea6('0x9b')][_0x2ea6('0x2e')]({'where':_0x211667[_0x2ea6('0x4b')]})[_0x2ea6('0x37')](function(_0x40d1ce){_0x178398[_0x2ea6('0x2e')]=_0x40d1ce;if(_0x1fa569[_0x2ea6('0x42')][_0x2ea6('0x52')]){_0x211667[_0x2ea6('0x53')]=[{'all':!![]}];}return db[_0x2ea6('0x9b')][_0x2ea6('0x54')](_0x211667);})[_0x2ea6('0x37')](function(_0x4cc4b1){_0x178398[_0x2ea6('0x55')]=_0x4cc4b1;return _0x178398;});}})[_0x2ea6('0x37')](respondWithFilteredResult(_0xa01861,_0x211667))[_0x2ea6('0x26')](handleError(_0xa01861,null));};exports[_0x2ea6('0x9e')]=function(_0x1d8c95,_0x2f7f85,_0x3c79fb){var _0x3ef9c1,_0x300e08={},_0x58d87c;if(_0x1d8c95['body']['to']){_0x58d87c=_0x1d8c95[_0x2ea6('0x5f')]['to'][0x0];}return db[_0x2ea6('0x3c')][_0x2ea6('0x61')]({'where':{'id':_0x1d8c95['params']['id']},'include':[{'model':db[_0x2ea6('0x9f')],'as':_0x2ea6('0xa0'),'include':[{'model':db[_0x2ea6('0x70')],'as':_0x2ea6('0xa1'),'where':{'fax':_0x58d87c},'limit':0x1,'order':[[_0x2ea6('0xa2'),_0x2ea6('0xa3')]]}]}]})[_0x2ea6('0x37')](handleEntityNotFound(_0x2f7f85,null))[_0x2ea6('0x37')](function(_0x14fecc){_0x3ef9c1=_0x14fecc;if(_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xa4')]&&_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xa4')]['length']){for(var _0xe13ffb=0x0;_0xe13ffb<_0x1d8c95[_0x2ea6('0x5f')]['attachments'][_0x2ea6('0x45')];_0xe13ffb+=0x1){_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xa4')][_0xe13ffb]={'filename':_0x1d8c95[_0x2ea6('0x5f')]['attachments'][_0xe13ffb]['name'],'id':_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xa4')][_0xe13ffb]['id'],'path':path[_0x2ea6('0xa5')](config[_0x2ea6('0xa6')],_0x2ea6('0xa7'),_0x1d8c95[_0x2ea6('0x5f')]['attachments'][_0xe13ffb]['basename'])};}}return respondWithRpcPromise(_0x2ea6('0xa8'),_0x2ea6('0xa8'),{'FaxAccountId':_[_0x2ea6('0xa9')](_0x1d8c95[_0x2ea6('0x60')]['id'])?undefined:_0x1d8c95[_0x2ea6('0x60')]['id'],'path':_[_0x2ea6('0xa9')](_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xa4')][0x0][_0x2ea6('0x5')])?undefined:_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xa4')][0x0][_0x2ea6('0x5')],'fax':_[_0x2ea6('0xa9')](_0x1d8c95['body']['to'][0x0])?undefined:_0x1d8c95[_0x2ea6('0x5f')]['to'][0x0]},client9002);})[_0x2ea6('0x37')](function(){if(_0x3ef9c1){if(_['isNil'](_0x1d8c95['body'][_0x2ea6('0xaa')])){_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xaa')]=util['format'](_0x2ea6('0xab'),_0x3ef9c1[_0x2ea6('0x39')],_0x3ef9c1['fax']);}if(_0x3ef9c1[_0x2ea6('0xa0')]){if(_0x3ef9c1[_0x2ea6('0xa0')]['Contacts'][_0x2ea6('0x45')]){return _0x3ef9c1['List']['Contacts'][0x0];}else{return db[_0x2ea6('0x70')][_0x2ea6('0x58')](_[_0x2ea6('0xac')](_0x1d8c95['body'],{'firstName':_0x1d8c95['body']['to'][0x0],'phone':_0x1d8c95[_0x2ea6('0x5f')]['to'][0x0],'fax':_0x1d8c95[_0x2ea6('0x5f')]['to'][0x0],'ListId':_0x3ef9c1['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x2ea6('0x37')](function(_0x1def40){if(_0x1def40){return db[_0x2ea6('0x6d')][_0x2ea6('0x61')]({'where':{'ContactId':_0x1def40['id'],'closed':![],'FaxAccountId':_0x3ef9c1['id']}})[_0x2ea6('0x37')](function(_0x1c7aa7){if(_0x1c7aa7){return[_0x1c7aa7,![]];}return db['FaxInteraction'][_0x2ea6('0x58')]({'UserId':_0x1d8c95['user']['id'],'ContactId':_0x1def40['id'],'FaxAccountId':_0x3ef9c1['id'],'fax':_0x1d8c95['body']['to'][0x0],'firstMsgDirection':_0x2ea6('0xad'),'Messages':[_[_0x2ea6('0x50')](_0x1d8c95['body'],{'read':![],'body':_0x1d8c95['body'][_0x2ea6('0xa4')][0x0]['filename'],'FaxAccountId':_0x3ef9c1['id'],'UserId':_0x1d8c95[_0x2ea6('0x5b')]['id'],'ContactId':_0x1def40['id'],'AttachmentId':_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xa4')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x2ea6('0x37')](function(_0x1a4b86){return[_0x1a4b86,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x2ea6('0xae')](function(_0x3f5f57,_0x554cc4){if(_0x554cc4){return _0x3f5f57;}return db[_0x2ea6('0x9b')]['create']({'direction':_0x2ea6('0xad'),'read':![],'body':_0x1d8c95['body']['attachments'][0x0]['filename'],'FaxAccountId':_0x3ef9c1['id'],'FaxInteractionId':_0x3f5f57['id'],'UserId':_0x1d8c95[_0x2ea6('0x5b')]['id'],'ContactId':_0x3f5f57[_0x2ea6('0xaf')],'AttachmentId':_0x1d8c95['body'][_0x2ea6('0xa4')][0x0]['id']})[_0x2ea6('0x37')](function(_0x17ba0f){_0x3f5f57[_0x2ea6('0xb0')][_0x2ea6('0xb1')]=[];_0x3f5f57[_0x2ea6('0xb0')][_0x2ea6('0xb1')][_0x2ea6('0x89')](_0x17ba0f['dataValues']);return _0x3f5f57;});})[_0x2ea6('0x37')](function(_0xb0188c){respondWithRpcPromise('SendFax',_0x2ea6('0xb2'),{'FaxAccountId':_[_0x2ea6('0xa9')](_0x1d8c95[_0x2ea6('0x60')]['id'])?undefined:_0x1d8c95[_0x2ea6('0x60')]['id'],'path':_[_0x2ea6('0xa9')](_0x1d8c95[_0x2ea6('0x5f')]['attachments'][0x0][_0x2ea6('0x5')])?undefined:_0x1d8c95[_0x2ea6('0x5f')][_0x2ea6('0xa4')][0x0][_0x2ea6('0x5')],'fax':_[_0x2ea6('0xa9')](_0x1d8c95[_0x2ea6('0x5f')]['to'][0x0])?undefined:_0x1d8c95['body']['to'][0x0],'AttachmentId':_0x1d8c95[_0x2ea6('0x5f')]['attachments'][0x0]['id']},client9002)[_0x2ea6('0x37')](function(_0x26bdb4){logger[_0x2ea6('0x1d')](_0x2ea6('0xb3'),_0x26bdb4);})[_0x2ea6('0x26')](function(_0x48c2bb){logger['info']('SendFaxRpc,\x20%s',_0x48c2bb);});return _0xb0188c;})[_0x2ea6('0x37')](respondWithResult(_0x2f7f85,null))[_0x2ea6('0x26')](handleError(_0x2f7f85,null));};exports[_0x2ea6('0xb4')]=function(_0x46b6eb,_0x407804,_0x397c03){return db['FaxAccount']['find']({'where':{'id':_0x46b6eb['params']['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x407804,null))[_0x2ea6('0x37')](function(_0x9ec19a){if(_0x9ec19a){return _0x9ec19a[_0x2ea6('0xb4')](_0x46b6eb[_0x2ea6('0x5f')][_0x2ea6('0x67')],_[_0x2ea6('0x6e')](_0x46b6eb[_0x2ea6('0x5f')],['ids','id'])||{})[_0x2ea6('0xae')](function(_0x5f496d){for(var _0xa908cd=0x0;_0xa908cd<_0x46b6eb['body'][_0x2ea6('0x67')][_0x2ea6('0x45')];_0xa908cd+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x46b6eb[_0x2ea6('0x5f')][_0x2ea6('0x67')][_0xa908cd]),'FaxAccountId':Number(_0x46b6eb[_0x2ea6('0x60')]['id'])});}return _0x5f496d;});}})[_0x2ea6('0x37')](respondWithResult(_0x407804,null))[_0x2ea6('0x26')](handleError(_0x407804,null));};exports[_0x2ea6('0xb5')]=function(_0x6f1e18,_0x326035,_0x1bf4a4){return db['FaxAccount'][_0x2ea6('0x61')]({'where':{'id':_0x6f1e18[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x326035,null))[_0x2ea6('0x37')](function(_0x7679d1){if(_0x7679d1){return _0x7679d1['removeAgents'](_0x6f1e18[_0x2ea6('0x42')][_0x2ea6('0x67')])[_0x2ea6('0x37')](function(){if(_[_0x2ea6('0xb6')](_0x6f1e18[_0x2ea6('0x42')][_0x2ea6('0x67')])){for(var _0x2eee9f=0x0;_0x2eee9f<_0x6f1e18[_0x2ea6('0x42')]['ids'][_0x2ea6('0x45')];_0x2eee9f+=0x1){socket['emit'](_0x2ea6('0xb7'),{'UserId':Number(_0x6f1e18[_0x2ea6('0x42')][_0x2ea6('0x67')][_0x2eee9f]),'FaxAccountId':Number(_0x6f1e18[_0x2ea6('0x60')]['id'])});}}else{socket['emit'](_0x2ea6('0xb7'),{'UserId':Number(_0x6f1e18[_0x2ea6('0x42')]['ids']),'FaxAccountId':Number(_0x6f1e18['params']['id'])});}});}})['then'](respondWithStatusCode(_0x326035,null))[_0x2ea6('0x26')](handleError(_0x326035,null));};exports[_0x2ea6('0xb8')]=function(_0x2e9330,_0x5bc0f7,_0x55ce99){var _0x2f0dde={};var _0xaf1be6={};var _0x1586d7;var _0x13009b;return db[_0x2ea6('0x3c')][_0x2ea6('0x64')]({'where':{'id':_0x2e9330[_0x2ea6('0x60')]['id']}})[_0x2ea6('0x37')](handleEntityNotFound(_0x5bc0f7,null))[_0x2ea6('0x37')](function(_0xd3e5fc){if(_0xd3e5fc){_0x1586d7=_0xd3e5fc;_0xaf1be6[_0x2ea6('0x40')]=_['keys'](db[_0x2ea6('0x72')][_0x2ea6('0x3d')]);_0xaf1be6[_0x2ea6('0x42')]=_['keys'](_0x2e9330[_0x2ea6('0x42')]);_0xaf1be6['filters']=_[_0x2ea6('0x43')](_0xaf1be6['model'],_0xaf1be6[_0x2ea6('0x42')]);_0x2f0dde[_0x2ea6('0x46')]=_[_0x2ea6('0x43')](_0xaf1be6[_0x2ea6('0x40')],qs[_0x2ea6('0x44')](_0x2e9330['query'][_0x2ea6('0x44')]));_0x2f0dde['attributes']=_0x2f0dde[_0x2ea6('0x46')]['length']?_0x2f0dde['attributes']:_0xaf1be6[_0x2ea6('0x40')];_0x2f0dde['order']=qs[_0x2ea6('0x4a')](_0x2e9330['query']['sort']);_0x2f0dde[_0x2ea6('0x4b')]=qs['filters'](_[_0x2ea6('0x4d')](_0x2e9330['query'],_0xaf1be6[_0x2ea6('0x4c')]));if(_0x2e9330[_0x2ea6('0x42')][_0x2ea6('0x4e')]){_0x2f0dde[_0x2ea6('0x4b')]=_[_0x2ea6('0x50')](_0x2f0dde[_0x2ea6('0x4b')],{'$or':_[_0x2ea6('0x3b')](_0x2f0dde[_0x2ea6('0x46')],function(_0x5b0b00){var _0xf40672={};_0xf40672[_0x5b0b00]={'$like':'%'+_0x2e9330['query'][_0x2ea6('0x4e')]+'%'};return _0xf40672;})});}_0x2f0dde=_['merge']({},_0x2f0dde,_0x2e9330['options']);return _0x1586d7['getAgents'](_0x2f0dde);}})[_0x2ea6('0x37')](function(_0x10d4d3){if(_0x10d4d3){_0x13009b=_0x10d4d3['length'];if(!_0x2e9330[_0x2ea6('0x42')][_0x2ea6('0x47')](_0x2ea6('0x48'))){_0x2f0dde[_0x2ea6('0x2b')]=qs['limit'](_0x2e9330[_0x2ea6('0x42')][_0x2ea6('0x2b')]);_0x2f0dde[_0x2ea6('0x2d')]=qs[_0x2ea6('0x2d')](_0x2e9330[_0x2ea6('0x42')][_0x2ea6('0x2d')]);}return _0x1586d7['getAgents'](_0x2f0dde);}})[_0x2ea6('0x37')](function(_0x2bf74f){if(_0x2bf74f){return _0x2bf74f?{'count':_0x13009b,'rows':_0x2bf74f}:null;}})[_0x2ea6('0x37')](respondWithResult(_0x5bc0f7,null))['catch'](handleError(_0x5bc0f7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3f05fac..e1ec592 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 _0xecb9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0xecb9,0x90));var _0x9ecb=function(_0x574de7,_0x24ce60){_0x574de7=_0x574de7-0x0;var _0x568f46=_0xecb9[_0x574de7];return _0x568f46;};'use strict';var EventEmitter=require(_0x9ecb('0x0'));var FaxAccount=require(_0x9ecb('0x1'))['db'][_0x9ecb('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9ecb('0x3')](0x0);var events={'afterCreate':_0x9ecb('0x4'),'afterUpdate':_0x9ecb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3050dc){return function(_0x2c36f8,_0xe7342d,_0x1110ac){FaxAccountEvents[_0x9ecb('0x6')](_0x3050dc+':'+_0x2c36f8['id'],_0x2c36f8);FaxAccountEvents[_0x9ecb('0x6')](_0x3050dc,_0x2c36f8);_0x1110ac(null);};}for(var e in events){if(events[_0x9ecb('0x7')](e)){var event=events[e];FaxAccount[_0x9ecb('0x8')](e,emitEvent(event));}}module[_0x9ecb('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x6dd3=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','update','remove'];(function(_0x44c10f,_0x19603d){var _0x59989a=function(_0x24000d){while(--_0x24000d){_0x44c10f['push'](_0x44c10f['shift']());}};_0x59989a(++_0x19603d);}(_0x6dd3,0x16b));var _0x36dd=function(_0x5641dd,_0x3560b5){_0x5641dd=_0x5641dd-0x0;var _0x5767ba=_0x6dd3[_0x5641dd];return _0x5767ba;};'use strict';var EventEmitter=require(_0x36dd('0x0'));var FaxAccount=require(_0x36dd('0x1'))['db'][_0x36dd('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x36dd('0x3'),'afterDestroy':_0x36dd('0x4')};function emitEvent(_0x43d36a){return function(_0x202cb1,_0x561f46,_0x51f2e4){FaxAccountEvents[_0x36dd('0x5')](_0x43d36a+':'+_0x202cb1['id'],_0x202cb1);FaxAccountEvents[_0x36dd('0x5')](_0x43d36a,_0x202cb1);_0x51f2e4(null);};}for(var e in events){if(events[_0x36dd('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x36dd('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 062473b..1c79112 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 _0xe04d=['bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util','../../config/logger','moment'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xe04d,0x14d));var _0xde04=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0xe04d[_0x1d211b];return _0x47c88b;};'use strict';var _=require('lodash');var util=require(_0xde04('0x0'));var logger=require(_0xde04('0x1'))('api');var moment=require(_0xde04('0x2'));var BPromise=require(_0xde04('0x3'));var rp=require(_0xde04('0x4'));var fs=require('fs');var path=require(_0xde04('0x5'));var rimraf=require('rimraf');var config=require(_0xde04('0x6'));var attributes=require(_0xde04('0x7'));module[_0xde04('0x8')]=function(_0x3c8a50,_0x17dee1){return _0x3c8a50[_0xde04('0x9')](_0xde04('0xa'),attributes,{'tableName':_0xde04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa118=['api','bluebird','request-promise','path','rimraf','exports','FaxAccount','lodash','util','../../config/logger'];(function(_0x106aa5,_0x24b2c8){var _0x3f8d81=function(_0x1f6703){while(--_0x1f6703){_0x106aa5['push'](_0x106aa5['shift']());}};_0x3f8d81(++_0x24b2c8);}(_0xa118,0xed));var _0x8a11=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xa118[_0x3cea78];return _0x33b66b;};'use strict';var _=require(_0x8a11('0x0'));var util=require(_0x8a11('0x1'));var logger=require(_0x8a11('0x2'))(_0x8a11('0x3'));var moment=require('moment');var BPromise=require(_0x8a11('0x4'));var rp=require(_0x8a11('0x5'));var fs=require('fs');var path=require(_0x8a11('0x6'));var rimraf=require(_0x8a11('0x7'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x8a11('0x8')]=function(_0x347e22,_0x4422e4){return _0x347e22['define'](_0x8a11('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index e8f872e..d6f7974 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 _0x47b0=['interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','catch','findAll','options','raw','attributes','limit','map','include','model','GetFaxAccount','debug','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','ListId','body','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','account','CmList','List','Contacts','updatedAt','DESC','FaxApplication','Applications','get','list','applications','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*'];(function(_0x49c3ce,_0x565806){var _0x5be1af=function(_0x13061b){while(--_0x13061b){_0x49c3ce['push'](_0x49c3ce['shift']());}};_0x5be1af(++_0x565806);}(_0x47b0,0xbd));var _0x047b=function(_0x4f138b,_0x51c514){_0x4f138b=_0x4f138b-0x0;var _0x380eeb=_0x47b0[_0x4f138b];return _0x380eeb;};'use strict';var _=require('lodash');var util=require(_0x047b('0x0'));var moment=require(_0x047b('0x1'));var BPromise=require(_0x047b('0x2'));var rs=require(_0x047b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x047b('0x4'))['db'];var utils=require(_0x047b('0x5'));var logger=require('../../config/logger')(_0x047b('0x6'));var config=require(_0x047b('0x7'));var jayson=require(_0x047b('0x8'));var client=jayson['client'][_0x047b('0x9')]({'port':0x232c});config[_0x047b('0xa')]=_[_0x047b('0xb')](config[_0x047b('0xa')],{'host':_0x047b('0xc'),'port':0x18eb});var socket=require(_0x047b('0xd'))(new Redis(config[_0x047b('0xa')]));require(_0x047b('0xe'))[_0x047b('0xf')](socket);function respondWithRpcPromise(_0x258ad2,_0x5da5ff,_0x4e0d08){return new BPromise(function(_0x182fbd,_0x15ba0b){return client['request'](_0x258ad2,_0x4e0d08)[_0x047b('0x10')](function(_0x55744a){logger['info']('FaxAccount,\x20%s,\x20%s',_0x5da5ff,_0x047b('0x11'));logger['debug'](_0x047b('0x12'),_0x5da5ff,_0x047b('0x11'),JSON[_0x047b('0x13')](_0x55744a));if(_0x55744a[_0x047b('0x14')]){if(_0x55744a[_0x047b('0x14')][_0x047b('0x15')]===0x1f4){logger[_0x047b('0x14')](_0x047b('0x16'),_0x5da5ff,_0x55744a['error'][_0x047b('0x17')]);return _0x15ba0b(_0x55744a[_0x047b('0x14')][_0x047b('0x17')]);}logger[_0x047b('0x14')](_0x047b('0x16'),_0x5da5ff,_0x55744a[_0x047b('0x14')][_0x047b('0x17')]);return _0x182fbd(_0x55744a['error']['message']);}else{logger[_0x047b('0x18')]('FaxAccount,\x20%s,\x20%s',_0x5da5ff,_0x047b('0x11'));_0x182fbd(_0x55744a['result'][_0x047b('0x17')]);}})[_0x047b('0x19')](function(_0x13474a){logger[_0x047b('0x14')](_0x047b('0x16'),_0x5da5ff,_0x13474a);_0x15ba0b(_0x13474a);});});}exports['GetFaxAccount']=function(_0x3806ea){var _0x40c620=this;return new Promise(function(_0x127e6e,_0x40fe70){return db['FaxAccount'][_0x047b('0x1a')]({'raw':_0x3806ea[_0x047b('0x1b')]?_0x3806ea[_0x047b('0x1b')][_0x047b('0x1c')]===undefined?!![]:![]:!![],'where':_0x3806ea['options']?_0x3806ea[_0x047b('0x1b')]['where']||null:null,'attributes':_0x3806ea[_0x047b('0x1b')]?_0x3806ea[_0x047b('0x1b')][_0x047b('0x1d')]||null:null,'limit':_0x3806ea[_0x047b('0x1b')]?_0x3806ea[_0x047b('0x1b')][_0x047b('0x1e')]||null:null,'include':_0x3806ea[_0x047b('0x1b')]?_0x3806ea[_0x047b('0x1b')]['include']?_[_0x047b('0x1f')](_0x3806ea[_0x047b('0x1b')][_0x047b('0x20')],function(_0x58ad67){return{'model':db[_0x58ad67['model']],'as':_0x58ad67['as'],'attributes':_0x58ad67[_0x047b('0x1d')],'include':_0x58ad67[_0x047b('0x20')]?_['map'](_0x58ad67[_0x047b('0x20')],function(_0x1e6718){return{'model':db[_0x1e6718[_0x047b('0x21')]],'as':_0x1e6718['as'],'attributes':_0x1e6718['attributes'],'include':_0x1e6718[_0x047b('0x20')]?_[_0x047b('0x1f')](_0x1e6718['include'],function(_0x3993c3){return{'model':db[_0x3993c3[_0x047b('0x21')]],'as':_0x3993c3['as'],'attributes':_0x3993c3[_0x047b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x047b('0x10')](function(_0x97de71){logger[_0x047b('0x18')](_0x047b('0x22'),_0x3806ea);logger[_0x047b('0x23')](_0x047b('0x22'),_0x3806ea,JSON[_0x047b('0x13')](_0x97de71));_0x127e6e(_0x97de71);})[_0x047b('0x19')](function(_0x4a3bd1){logger[_0x047b('0x14')](_0x047b('0x22'),_0x4a3bd1[_0x047b('0x17')],_0x3806ea);_0x40fe70(_0x40c620['error'](0x1f4,_0x4a3bd1[_0x047b('0x17')]));});});};exports[_0x047b('0x24')]=function(_0x1b1bec,_0x9fbf11,_0x551a8e){var _0x4df1dd=this;return new Promise(function(_0x5a8c9b,_0x516981){var _0x580ebd={'body':_0x1b1bec['body'],'channel':_0x047b('0x25')};var _0x384505=[];var _0x1fdb13=[];var _0x2b76f6={};return db[_0x047b('0x26')][_0x047b('0x27')]()['then'](function(_0x47ee29){if(!_0x47ee29){throw new db[(_0x047b('0x28'))][(_0x047b('0x29'))](_0x047b('0x2a'));}_0x384505=_[_0x047b('0x2b')](_[_0x047b('0x2c')](_0x47ee29),[_0x047b('0x2d'),'updatedAt']);_0x1fdb13=_[_0x047b('0x2b')](_[_0x047b('0x2c')](_0x47ee29),['createdAt','updatedAt',_0x047b('0x2e'),_0x047b('0x2f')]);if(_0x1b1bec['body']['id']){delete _0x1b1bec[_0x047b('0x30')]['id'];}if(_[_0x047b('0x31')](_0x1b1bec[_0x047b('0x30')]['from'])){throw new db[(_0x047b('0x28'))][(_0x047b('0x29'))]('from\x20is\x20mandatory');}if(_[_0x047b('0x31')](_0x1b1bec[_0x047b('0x30')]['body'])||_0x1b1bec[_0x047b('0x30')][_0x047b('0x30')]===''){throw new db[(_0x047b('0x28'))][(_0x047b('0x29'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1b1bec[_0x047b('0x30')][_0x047b('0x32')])){throw new db[(_0x047b('0x28'))]['ValidationError'](_0x047b('0x33')+_0x1fdb13);}if(!_['includes'](_0x1fdb13,_0x1b1bec[_0x047b('0x30')][_0x047b('0x32')])){throw new db[(_0x047b('0x28'))][(_0x047b('0x29'))](_0x047b('0x34')+_0x1fdb13);}_0x2b76f6[_0x1b1bec[_0x047b('0x30')]['mapKey']]=_0x1b1bec[_0x047b('0x30')][_0x047b('0x35')];})['then'](function(){return db[_0x047b('0x36')][_0x047b('0x37')]({'where':{'id':_0x1b1bec[_0x047b('0x38')]['id']},'include':[{'model':db[_0x047b('0x39')],'as':_0x047b('0x3a'),'include':[{'model':db[_0x047b('0x26')],'as':_0x047b('0x3b'),'where':_0x2b76f6,'limit':0x1,'order':[[_0x047b('0x3c'),_0x047b('0x3d')]]}]},{'model':db[_0x047b('0x3e')],'as':_0x047b('0x3f')}]});})[_0x047b('0x10')](function(_0x3ce68f){if(_0x3ce68f&&_0x3ce68f[_0x047b('0x3a')]){var _0x378838=_0x3ce68f[_0x047b('0x40')]({'plain':!![]});_0x580ebd['account']=_0x378838;_0x580ebd['applications']=_0x378838[_0x047b('0x3f')];_0x580ebd[_0x047b('0x41')]=_0x378838[_0x047b('0x3a')];_0x580ebd[_0x047b('0x42')]=_['orderBy'](_0x580ebd[_0x047b('0x42')],['priority'],[_0x047b('0x43')]);if(_0x580ebd[_0x047b('0x38')][_0x047b('0x3f')]){delete _0x580ebd[_0x047b('0x38')][_0x047b('0x3f')];}if(_0x580ebd[_0x047b('0x38')][_0x047b('0x3a')]&&_0x580ebd[_0x047b('0x38')][_0x047b('0x3a')][_0x047b('0x3b')][_0x047b('0x44')]){return _0x580ebd[_0x047b('0x38')][_0x047b('0x3a')][_0x047b('0x3b')][0x0];}var _0x4ca06c=_[_0x047b('0xb')](_0x1b1bec['body'],{'firstName':_0x1b1bec['body'][_0x047b('0x35')],'ListId':_0x378838['ListId']});_0x4ca06c[_0x1b1bec[_0x047b('0x30')][_0x047b('0x32')]]=_0x1b1bec[_0x047b('0x30')][_0x047b('0x35')];return db[_0x047b('0x26')][_0x047b('0x45')](_0x4ca06c,{'fields':_0x384505,'raw':!![]});}})[_0x047b('0x10')](function(_0x11fb7a){_0x580ebd[_0x047b('0x46')]=_0x11fb7a;if(_0x11fb7a){var _0x21a57b={'ContactId':_0x11fb7a['id'],'FaxAccountId':_0x1b1bec[_0x047b('0x38')]['id'],'fax':_0x11fb7a[_0x047b('0x25')]};return db[_0x047b('0x47')][_0x047b('0x37')]({'where':{'ContactId':_0x11fb7a['id'],'closed':![],'FaxAccountId':_0x1b1bec[_0x047b('0x38')]['id']}})[_0x047b('0x10')](function(_0x1fe900){if(_0x1fe900){return[_0x1fe900,![]];}return db[_0x047b('0x47')][_0x047b('0x45')](_0x21a57b)[_0x047b('0x10')](function(_0x170abe){return[_0x170abe,!![]];});});}else{throw new Error(_0x047b('0x48'));}})[_0x047b('0x49')](function(_0x5891a8,_0x488d09){var _0x17a47a=_0x5891a8[_0x047b('0x40')]({'plain':!![]});if(_0x488d09){if(_0x580ebd[_0x047b('0x38')][_0x047b('0x4a')]){_0x580ebd[_0x047b('0x42')][_0x047b('0x4b')]({'id':0x0,'priority':_0x580ebd[_0x047b('0x42')][_0x047b('0x44')]+0x1,'app':_0x047b('0x4c'),'appdata':'unmanaged','interval':_0x047b('0x4d')});}_0x17a47a['created']=!![];}else{_0x17a47a['created']=![];}_0x580ebd[_0x047b('0x4e')]=_0x17a47a;return db[_0x047b('0x4f')][_0x047b('0x45')]({'body':_0x1b1bec['body']['body'],'FaxAccountId':_0x1b1bec[_0x047b('0x38')]['id'],'FaxInteractionId':_0x5891a8['id'],'direction':'in','ContactId':_0x5891a8[_0x047b('0x50')],'AttachmentId':_0x1b1bec['body']['AttachmentId']});})['then'](function(_0x45e38c){_0x580ebd[_0x047b('0x17')]=_0x45e38c;if(_0x580ebd[_0x047b('0x4e')][_0x047b('0x51')]){return db[_0x047b('0x52')][_0x047b('0x37')]({'attributes':['id',_0x047b('0x53')],'where':{'id':_0x580ebd[_0x047b('0x4e')][_0x047b('0x51')]}})[_0x047b('0x10')](function(_0x1ac08a){if(_0x1ac08a){_0x580ebd[_0x047b('0x42')][_0x047b('0x54')]({'id':0x0,'priority':0x0,'app':_0x047b('0x55'),'appdata':_0x1ac08a[_0x047b('0x53')]+','+(_0x580ebd[_0x047b('0x38')][_0x047b('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x047b('0x57'),_0x047b('0x58'),_0x580ebd);});}return respondWithRpcPromise(_0x047b('0x57'),_0x047b('0x58'),_0x580ebd);})[_0x047b('0x10')](function(_0x3519c1){_0x5a8c9b(_0x3519c1);})['catch'](function(_0x2d9910){_0x516981(_0x4df1dd['error'](0x1f4,_0x2d9910[_0x047b('0x17')]));});});}; \ No newline at end of file +var _0xe089=['from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','find','account','List','DESC','Applications','get','applications','orderBy','priority','asc','Contacts','create','contact','fax','FaxInteraction','then','Contact\x20not\x20found','push','length','unmanaged','*,*,*,*','created','interaction','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','options','raw','where','attributes','include','map','model','NotifyFaxAccount','body','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil'];(function(_0x29f46e,_0x5e41b8){var _0x44b931=function(_0x2f79e9){while(--_0x2f79e9){_0x29f46e['push'](_0x29f46e['shift']());}};_0x44b931(++_0x5e41b8);}(_0xe089,0x17e));var _0x9e08=function(_0x3d3ed0,_0xebd766){_0x3d3ed0=_0x3d3ed0-0x0;var _0x4a2aff=_0xe089[_0x3d3ed0];return _0x4a2aff;};'use strict';var _=require(_0x9e08('0x0'));var util=require(_0x9e08('0x1'));var moment=require('moment');var BPromise=require(_0x9e08('0x2'));var rs=require(_0x9e08('0x3'));var fs=require('fs');var Redis=require(_0x9e08('0x4'));var db=require(_0x9e08('0x5'))['db'];var utils=require(_0x9e08('0x6'));var logger=require(_0x9e08('0x7'))(_0x9e08('0x8'));var config=require('../../config/environment');var jayson=require(_0x9e08('0x9'));var client=jayson['client'][_0x9e08('0xa')]({'port':0x232c});config[_0x9e08('0xb')]=_[_0x9e08('0xc')](config[_0x9e08('0xb')],{'host':_0x9e08('0xd'),'port':0x18eb});var socket=require(_0x9e08('0xe'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x9e08('0xf')](socket);function respondWithRpcPromise(_0x157971,_0x216f7f,_0x108612){return new BPromise(function(_0x1f862c,_0x98e76f){return client['request'](_0x157971,_0x108612)['then'](function(_0x3daa1a){logger[_0x9e08('0x10')](_0x9e08('0x11'),_0x216f7f,_0x9e08('0x12'));logger[_0x9e08('0x13')](_0x9e08('0x14'),_0x216f7f,_0x9e08('0x12'),JSON[_0x9e08('0x15')](_0x3daa1a));if(_0x3daa1a[_0x9e08('0x16')]){if(_0x3daa1a[_0x9e08('0x16')][_0x9e08('0x17')]===0x1f4){logger[_0x9e08('0x16')](_0x9e08('0x11'),_0x216f7f,_0x3daa1a[_0x9e08('0x16')][_0x9e08('0x18')]);return _0x98e76f(_0x3daa1a[_0x9e08('0x16')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x216f7f,_0x3daa1a['error'][_0x9e08('0x18')]);return _0x1f862c(_0x3daa1a[_0x9e08('0x16')][_0x9e08('0x18')]);}else{logger[_0x9e08('0x10')](_0x9e08('0x11'),_0x216f7f,_0x9e08('0x12'));_0x1f862c(_0x3daa1a[_0x9e08('0x19')][_0x9e08('0x18')]);}})[_0x9e08('0x1a')](function(_0x114845){logger[_0x9e08('0x16')]('FaxAccount,\x20%s,\x20%s',_0x216f7f,_0x114845);_0x98e76f(_0x114845);});});}exports[_0x9e08('0x1b')]=function(_0x3c3b27){var _0x15664b=this;return new Promise(function(_0x20fe10,_0x31b02b){return db['FaxAccount']['findAll']({'raw':_0x3c3b27['options']?_0x3c3b27[_0x9e08('0x1c')][_0x9e08('0x1d')]===undefined?!![]:![]:!![],'where':_0x3c3b27['options']?_0x3c3b27[_0x9e08('0x1c')][_0x9e08('0x1e')]||null:null,'attributes':_0x3c3b27['options']?_0x3c3b27[_0x9e08('0x1c')][_0x9e08('0x1f')]||null:null,'limit':_0x3c3b27[_0x9e08('0x1c')]?_0x3c3b27[_0x9e08('0x1c')]['limit']||null:null,'include':_0x3c3b27[_0x9e08('0x1c')]?_0x3c3b27[_0x9e08('0x1c')][_0x9e08('0x20')]?_[_0x9e08('0x21')](_0x3c3b27['options'][_0x9e08('0x20')],function(_0x39a803){return{'model':db[_0x39a803[_0x9e08('0x22')]],'as':_0x39a803['as'],'attributes':_0x39a803[_0x9e08('0x1f')],'include':_0x39a803['include']?_['map'](_0x39a803['include'],function(_0x597c2d){return{'model':db[_0x597c2d['model']],'as':_0x597c2d['as'],'attributes':_0x597c2d[_0x9e08('0x1f')],'include':_0x597c2d['include']?_['map'](_0x597c2d[_0x9e08('0x20')],function(_0xa7dcbe){return{'model':db[_0xa7dcbe[_0x9e08('0x22')]],'as':_0xa7dcbe['as'],'attributes':_0xa7dcbe[_0x9e08('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a2ebb){logger[_0x9e08('0x10')]('GetFaxAccount',_0x3c3b27);logger[_0x9e08('0x13')]('GetFaxAccount',_0x3c3b27,JSON[_0x9e08('0x15')](_0x1a2ebb));_0x20fe10(_0x1a2ebb);})[_0x9e08('0x1a')](function(_0x1b20c7){logger[_0x9e08('0x16')]('GetFaxAccount',_0x1b20c7[_0x9e08('0x18')],_0x3c3b27);_0x31b02b(_0x15664b[_0x9e08('0x16')](0x1f4,_0x1b20c7['message']));});});};exports[_0x9e08('0x23')]=function(_0x55c5ad,_0x4201c6,_0x374072){var _0x1f2cad=this;return new Promise(function(_0x1b330e,_0x24ed8f){var _0x17f457={'body':_0x55c5ad[_0x9e08('0x24')],'channel':'fax'};var _0x9bdfd3=[];var _0x3f11c6=[];var _0x5d5e16={};return db[_0x9e08('0x25')][_0x9e08('0x26')]()['then'](function(_0x588e67){if(!_0x588e67){throw new db['Sequelize'][(_0x9e08('0x27'))](_0x9e08('0x28'));}_0x9bdfd3=_[_0x9e08('0x29')](_[_0x9e08('0x2a')](_0x588e67),[_0x9e08('0x2b'),_0x9e08('0x2c')]);_0x3f11c6=_['difference'](_['keys'](_0x588e67),['createdAt',_0x9e08('0x2c'),_0x9e08('0x2d'),_0x9e08('0x2e')]);if(_0x55c5ad[_0x9e08('0x24')]['id']){delete _0x55c5ad[_0x9e08('0x24')]['id'];}if(_[_0x9e08('0x2f')](_0x55c5ad[_0x9e08('0x24')][_0x9e08('0x30')])){throw new db[(_0x9e08('0x31'))]['ValidationError'](_0x9e08('0x32'));}if(_[_0x9e08('0x2f')](_0x55c5ad[_0x9e08('0x24')][_0x9e08('0x24')])||_0x55c5ad['body'][_0x9e08('0x24')]===''){throw new db[(_0x9e08('0x31'))]['ValidationError'](_0x9e08('0x33'));}if(_['isNil'](_0x55c5ad[_0x9e08('0x24')]['mapKey'])){throw new db[(_0x9e08('0x31'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f11c6);}if(!_[_0x9e08('0x34')](_0x3f11c6,_0x55c5ad[_0x9e08('0x24')]['mapKey'])){throw new db[(_0x9e08('0x31'))]['ValidationError'](_0x9e08('0x35')+_0x3f11c6);}_0x5d5e16[_0x55c5ad[_0x9e08('0x24')][_0x9e08('0x36')]]=_0x55c5ad['body'][_0x9e08('0x30')];})['then'](function(){return db[_0x9e08('0x37')][_0x9e08('0x38')]({'where':{'id':_0x55c5ad[_0x9e08('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x9e08('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5d5e16,'limit':0x1,'order':[[_0x9e08('0x2c'),_0x9e08('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0x9e08('0x3c')}]});})['then'](function(_0x31a6db){if(_0x31a6db&&_0x31a6db[_0x9e08('0x3a')]){var _0x144df4=_0x31a6db[_0x9e08('0x3d')]({'plain':!![]});_0x17f457['account']=_0x144df4;_0x17f457['applications']=_0x144df4[_0x9e08('0x3c')];_0x17f457['list']=_0x144df4[_0x9e08('0x3a')];_0x17f457[_0x9e08('0x3e')]=_[_0x9e08('0x3f')](_0x17f457['applications'],[_0x9e08('0x40')],[_0x9e08('0x41')]);if(_0x17f457['account'][_0x9e08('0x3c')]){delete _0x17f457['account'][_0x9e08('0x3c')];}if(_0x17f457[_0x9e08('0x39')][_0x9e08('0x3a')]&&_0x17f457[_0x9e08('0x39')][_0x9e08('0x3a')][_0x9e08('0x42')]['length']){return _0x17f457[_0x9e08('0x39')]['List'][_0x9e08('0x42')][0x0];}var _0x2baa0a=_[_0x9e08('0xc')](_0x55c5ad[_0x9e08('0x24')],{'firstName':_0x55c5ad[_0x9e08('0x24')][_0x9e08('0x30')],'ListId':_0x144df4[_0x9e08('0x2e')]});_0x2baa0a[_0x55c5ad[_0x9e08('0x24')][_0x9e08('0x36')]]=_0x55c5ad['body']['from'];return db[_0x9e08('0x25')][_0x9e08('0x43')](_0x2baa0a,{'fields':_0x9bdfd3,'raw':!![]});}})['then'](function(_0x2d9e89){_0x17f457[_0x9e08('0x44')]=_0x2d9e89;if(_0x2d9e89){var _0x5dda31={'ContactId':_0x2d9e89['id'],'FaxAccountId':_0x55c5ad[_0x9e08('0x39')]['id'],'fax':_0x2d9e89[_0x9e08('0x45')]};return db[_0x9e08('0x46')]['find']({'where':{'ContactId':_0x2d9e89['id'],'closed':![],'FaxAccountId':_0x55c5ad[_0x9e08('0x39')]['id']}})[_0x9e08('0x47')](function(_0x158a85){if(_0x158a85){return[_0x158a85,![]];}return db[_0x9e08('0x46')][_0x9e08('0x43')](_0x5dda31)[_0x9e08('0x47')](function(_0x10e7c3){return[_0x10e7c3,!![]];});});}else{throw new Error(_0x9e08('0x48'));}})['spread'](function(_0x28895a,_0x96fb22){var _0x1da302=_0x28895a[_0x9e08('0x3d')]({'plain':!![]});if(_0x96fb22){if(_0x17f457[_0x9e08('0x39')]['autoclose']){_0x17f457[_0x9e08('0x3e')][_0x9e08('0x49')]({'id':0x0,'priority':_0x17f457[_0x9e08('0x3e')][_0x9e08('0x4a')]+0x1,'app':'close','appdata':_0x9e08('0x4b'),'interval':_0x9e08('0x4c')});}_0x1da302[_0x9e08('0x4d')]=!![];}else{_0x1da302['created']=![];}_0x17f457[_0x9e08('0x4e')]=_0x1da302;return db['FaxMessage'][_0x9e08('0x43')]({'body':_0x55c5ad['body'][_0x9e08('0x24')],'FaxAccountId':_0x55c5ad['account']['id'],'FaxInteractionId':_0x28895a['id'],'direction':'in','ContactId':_0x28895a['ContactId'],'AttachmentId':_0x55c5ad['body']['AttachmentId']});})[_0x9e08('0x47')](function(_0x49e5dc){_0x17f457[_0x9e08('0x18')]=_0x49e5dc;if(_0x17f457['interaction'][_0x9e08('0x4f')]){return db['User'][_0x9e08('0x38')]({'attributes':['id',_0x9e08('0x50')],'where':{'id':_0x17f457[_0x9e08('0x4e')][_0x9e08('0x4f')]}})[_0x9e08('0x47')](function(_0x28302e){if(_0x28302e){_0x17f457[_0x9e08('0x3e')][_0x9e08('0x51')]({'id':0x0,'priority':0x0,'app':_0x9e08('0x52'),'appdata':_0x28302e[_0x9e08('0x50')]+','+(_0x17f457['account'][_0x9e08('0x53')]||0xa),'interval':_0x9e08('0x4c')});}return respondWithRpcPromise(_0x9e08('0x54'),'startRouting',_0x17f457);});}return respondWithRpcPromise(_0x9e08('0x54'),_0x9e08('0x55'),_0x17f457);})[_0x9e08('0x47')](function(_0x535b96){_0x1b330e(_0x535b96);})[_0x9e08('0x1a')](function(_0x17bca7){_0x24ed8f(_0x1f2cad[_0x9e08('0x16')](0x1f4,_0x17bca7['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 8faeda0..d957d7d 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 _0x93de=['faxAccount:','./faxAccount.events','save','remove','update','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93de,0x182));var _0xe93d=function(_0x3a1d09,_0x2efce7){_0x3a1d09=_0x3a1d09-0x0;var _0x525fc7=_0x93de[_0x3a1d09];return _0x525fc7;};'use strict';var FaxAccountEvents=require(_0xe93d('0x0'));var events=[_0xe93d('0x1'),_0xe93d('0x2'),_0xe93d('0x3')];function createListener(_0x81945e,_0x2de6f8){return function(_0x5089f0){_0x2de6f8['emit'](_0x81945e,_0x5089f0);};}function removeListener(_0xf8281b,_0x3fc97f){return function(){FaxAccountEvents[_0xe93d('0x4')](_0xf8281b,_0x3fc97f);};}exports[_0xe93d('0x5')]=function(_0x23d192){for(var _0xf342fd=0x0,_0x3a044c=events['length'];_0xf342fd<_0x3a044c;_0xf342fd++){var _0xb73920=events[_0xf342fd];var _0x1bd39a=createListener(_0xe93d('0x6')+_0xb73920,_0x23d192);FaxAccountEvents['on'](_0xb73920,_0x1bd39a);}}; \ No newline at end of file +var _0x3105=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x566155,_0x275b7a){var _0x326b28=function(_0x5b41e0){while(--_0x5b41e0){_0x566155['push'](_0x566155['shift']());}};_0x326b28(++_0x275b7a);}(_0x3105,0x74));var _0x5310=function(_0x3deecd,_0x5de8a9){_0x3deecd=_0x3deecd-0x0;var _0x33b0bb=_0x3105[_0x3deecd];return _0x33b0bb;};'use strict';var FaxAccountEvents=require(_0x5310('0x0'));var events=[_0x5310('0x1'),_0x5310('0x2'),_0x5310('0x3')];function createListener(_0x3b4938,_0x363713){return function(_0x5630c5){_0x363713[_0x5310('0x4')](_0x3b4938,_0x5630c5);};}function removeListener(_0x49c73d,_0x32a01c){return function(){FaxAccountEvents[_0x5310('0x5')](_0x49c73d,_0x32a01c);};}exports[_0x5310('0x6')]=function(_0x435094){for(var _0x511ead=0x0,_0x4a5fbd=events[_0x5310('0x7')];_0x511ead<_0x4a5fbd;_0x511ead++){var _0xf63c89=events[_0x511ead];var _0x1089bc=createListener(_0x5310('0x8')+_0xf63c89,_0x435094);FaxAccountEvents['on'](_0xf63c89,_0x1089bc);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 03561a9..da0e598 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xe15c8f,_0xc520e8){var _0x6fffcf=function(_0xfdfa99){while(--_0xfdfa99){_0xe15c8f['push'](_0xe15c8f['shift']());}};_0x6fffcf(++_0xc520e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x1f6a5b,_0x5d46c3){var _0x1b2ba8=function(_0x1e2030){while(--_0x1e2030){_0x1f6a5b['push'](_0x1f6a5b['shift']());}};_0x1b2ba8(++_0x5d46c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b930440..9a801d7 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 _0x1807=['STRING','noop','*,*,*,*','sequelize'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x1807,0xdb));var _0x7180=function(_0x4664f2,_0x2b0027){_0x4664f2=_0x4664f2-0x0;var _0x12e5f6=_0x1807[_0x4664f2];return _0x12e5f6;};'use strict';var Sequelize=require(_0x7180('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7180('0x1')],'allowNull':![],'defaultValue':_0x7180('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7180('0x1')]},'interval':{'type':Sequelize[_0x7180('0x1')],'defaultValue':_0x7180('0x3')}}; \ No newline at end of file +var _0xd658=['*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x578045,_0xdbd932){var _0x18e9d1=function(_0x222eaa){while(--_0x222eaa){_0x578045['push'](_0x578045['shift']());}};_0x18e9d1(++_0xdbd932);}(_0xd658,0x132));var _0x8d65=function(_0x4ce668,_0x50a851){_0x4ce668=_0x4ce668-0x0;var _0x47d313=_0xd658[_0x4ce668];return _0x47d313;};'use strict';var Sequelize=require('sequelize');module[_0x8d65('0x0')]={'priority':{'type':Sequelize[_0x8d65('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8d65('0x2')],'allowNull':![],'defaultValue':_0x8d65('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8d65('0x2')]},'interval':{'type':Sequelize[_0x8d65('0x2')],'defaultValue':_0x8d65('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 1e8f05e..d3df5f1 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 _0x054f=['index','map','FaxApplication','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send'];(function(_0x15e99d,_0x234768){var _0x5bd347=function(_0x26da4b){while(--_0x26da4b){_0x15e99d['push'](_0x15e99d['shift']());}};_0x5bd347(++_0x234768);}(_0x054f,0x6d));var _0xf054=function(_0x16c306,_0x1e8e7d){_0x16c306=_0x16c306-0x0;var _0x3f19de=_0x054f[_0x16c306];return _0x3f19de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf054('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf054('0x1'));var rp=require(_0xf054('0x2'));var moment=require(_0xf054('0x3'));var BPromise=require(_0xf054('0x4'));var Mustache=require(_0xf054('0x5'));var util=require('util');var path=require(_0xf054('0x6'));var sox=require('sox');var csv=require(_0xf054('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf054('0x8'));var _=require(_0xf054('0x9'));var squel=require('squel');var crypto=require(_0xf054('0xa'));var jsforce=require(_0xf054('0xb'));var deskjs=require(_0xf054('0xc'));var toCsv=require(_0xf054('0x7'));var querystring=require(_0xf054('0xd'));var Papa=require(_0xf054('0xe'));var Redis=require('ioredis');var authService=require(_0xf054('0xf'));var qs=require(_0xf054('0x10'));var as=require(_0xf054('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf054('0x12'))(_0xf054('0x13'));var utils=require(_0xf054('0x14'));var config=require(_0xf054('0x15'));var licenseUtil=require(_0xf054('0x16'));var db=require(_0xf054('0x17'))['db'];function respondWithStatusCode(_0x1148e4,_0x1fd633){_0x1fd633=_0x1fd633||0xcc;return function(_0xe08e2){if(_0xe08e2){return _0x1148e4['sendStatus'](_0x1fd633);}return _0x1148e4[_0xf054('0x18')](_0x1fd633)[_0xf054('0x19')]();};}function respondWithResult(_0x4a01c1,_0x306eee){_0x306eee=_0x306eee||0xc8;return function(_0x2f8af2){if(_0x2f8af2){return _0x4a01c1[_0xf054('0x18')](_0x306eee)['json'](_0x2f8af2);}};}function respondWithFilteredResult(_0x1d3909,_0x417204){return function(_0x4c3494){if(_0x4c3494){var _0x5b7a5c=typeof _0x417204['offset']===_0xf054('0x1a')&&typeof _0x417204[_0xf054('0x1b')]===_0xf054('0x1a');var _0x55564e=_0x4c3494[_0xf054('0x1c')];var _0x5b5d13=_0x5b7a5c?0x0:_0x417204['offset'];var _0x38dfe4=_0x5b7a5c?_0x4c3494[_0xf054('0x1c')]:_0x417204[_0xf054('0x1d')]+_0x417204['limit'];var _0x44d5b7;if(_0x38dfe4>=_0x55564e){_0x38dfe4=_0x55564e;_0x44d5b7=0xc8;}else{_0x44d5b7=0xce;}_0x1d3909['status'](_0x44d5b7);return _0x1d3909[_0xf054('0x1e')](_0xf054('0x1f'),_0x5b5d13+'-'+_0x38dfe4+'/'+_0x55564e)[_0xf054('0x20')](_0x4c3494);}return null;};}function patchUpdates(_0x440dbe){return function(_0x114ade){try{jsonpatch[_0xf054('0x21')](_0x114ade,_0x440dbe,!![]);}catch(_0x56809a){return BPromise[_0xf054('0x22')](_0x56809a);}return _0x114ade[_0xf054('0x23')]();};}function saveUpdates(_0x7a8243,_0x194086){return function(_0x594f74){if(_0x594f74){return _0x594f74[_0xf054('0x24')](_0x7a8243)[_0xf054('0x25')](function(_0x1ea850){return _0x1ea850;});}return null;};}function removeEntity(_0x5d490a,_0xb31b6c){return function(_0x1cbf2a){if(_0x1cbf2a){return _0x1cbf2a[_0xf054('0x26')]()[_0xf054('0x25')](function(){_0x5d490a[_0xf054('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5725f6,_0x19c747){return function(_0x4e8cc5){if(!_0x4e8cc5){_0x5725f6[_0xf054('0x27')](0x194);}return _0x4e8cc5;};}function handleError(_0x248229,_0x3eae2e){_0x3eae2e=_0x3eae2e||0x1f4;return function(_0xdfce7e){logger[_0xf054('0x28')](_0xdfce7e['stack']);if(_0xdfce7e[_0xf054('0x29')]){delete _0xdfce7e[_0xf054('0x29')];}_0x248229[_0xf054('0x18')](_0x3eae2e)[_0xf054('0x2a')](_0xdfce7e);};}exports[_0xf054('0x2b')]=function(_0x371e46,_0x172254){var _0x4649c5={},_0x4f8eda={},_0x36b895={'count':0x0,'rows':[]};var _0x465e68=_[_0xf054('0x2c')](db[_0xf054('0x2d')]['rawAttributes'],function(_0x486395){return{'name':_0x486395['fieldName'],'type':_0x486395[_0xf054('0x2e')][_0xf054('0x2f')]};});_0x4f8eda[_0xf054('0x30')]=_['map'](_0x465e68,_0xf054('0x29'));_0x4f8eda[_0xf054('0x31')]=_[_0xf054('0x32')](_0x371e46[_0xf054('0x31')]);_0x4f8eda[_0xf054('0x33')]=_[_0xf054('0x34')](_0x4f8eda[_0xf054('0x30')],_0x4f8eda[_0xf054('0x31')]);_0x4649c5[_0xf054('0x35')]=_['intersection'](_0x4f8eda[_0xf054('0x30')],qs[_0xf054('0x36')](_0x371e46['query'][_0xf054('0x36')]));_0x4649c5[_0xf054('0x35')]=_0x4649c5[_0xf054('0x35')]['length']?_0x4649c5[_0xf054('0x35')]:_0x4f8eda['model'];if(!_0x371e46['query'][_0xf054('0x37')](_0xf054('0x38'))){_0x4649c5[_0xf054('0x1b')]=qs[_0xf054('0x1b')](_0x371e46[_0xf054('0x31')][_0xf054('0x1b')]);_0x4649c5[_0xf054('0x1d')]=qs['offset'](_0x371e46[_0xf054('0x31')][_0xf054('0x1d')]);}_0x4649c5[_0xf054('0x39')]=qs[_0xf054('0x3a')](_0x371e46[_0xf054('0x31')][_0xf054('0x3a')]);_0x4649c5[_0xf054('0x3b')]=qs[_0xf054('0x33')](_[_0xf054('0x3c')](_0x371e46[_0xf054('0x31')],_0x4f8eda['filters']),_0x465e68);if(_0x371e46['query']['filter']){_0x4649c5[_0xf054('0x3b')]=_[_0xf054('0x3d')](_0x4649c5['where'],{'$or':_['map'](_0x465e68,function(_0x2d28bb){if(_0x2d28bb[_0xf054('0x2e')]!==_0xf054('0x3e')){var _0x152d22={};_0x152d22[_0x2d28bb[_0xf054('0x29')]]={'$like':'%'+_0x371e46[_0xf054('0x31')][_0xf054('0x3f')]+'%'};return _0x152d22;}})});}_0x4649c5=_['merge']({},_0x4649c5,_0x371e46['options']);var _0x24601b={'where':_0x4649c5[_0xf054('0x3b')]};return db[_0xf054('0x2d')][_0xf054('0x1c')](_0x24601b)['then'](function(_0x34abcc){_0x36b895['count']=_0x34abcc;if(_0x371e46[_0xf054('0x31')][_0xf054('0x40')]){_0x4649c5[_0xf054('0x41')]=[{'all':!![]}];}return db[_0xf054('0x2d')][_0xf054('0x42')](_0x4649c5);})[_0xf054('0x25')](function(_0x2bfaaf){_0x36b895[_0xf054('0x43')]=_0x2bfaaf;return _0x36b895;})[_0xf054('0x25')](respondWithFilteredResult(_0x172254,_0x4649c5))[_0xf054('0x44')](handleError(_0x172254,null));};exports[_0xf054('0x45')]=function(_0x3c22df,_0x2769bd){var _0x426d01={'raw':!![],'where':{'id':_0x3c22df[_0xf054('0x46')]['id']}},_0x4657c5={};_0x4657c5[_0xf054('0x30')]=_[_0xf054('0x32')](db[_0xf054('0x2d')][_0xf054('0x47')]);_0x4657c5[_0xf054('0x31')]=_[_0xf054('0x32')](_0x3c22df['query']);_0x4657c5[_0xf054('0x33')]=_[_0xf054('0x34')](_0x4657c5[_0xf054('0x30')],_0x4657c5[_0xf054('0x31')]);_0x426d01[_0xf054('0x35')]=_['intersection'](_0x4657c5['model'],qs['fields'](_0x3c22df[_0xf054('0x31')]['fields']));_0x426d01['attributes']=_0x426d01[_0xf054('0x35')]['length']?_0x426d01[_0xf054('0x35')]:_0x4657c5['model'];if(_0x3c22df[_0xf054('0x31')][_0xf054('0x40')]){_0x426d01[_0xf054('0x41')]=[{'all':!![]}];}_0x426d01=_[_0xf054('0x3d')]({},_0x426d01,_0x3c22df[_0xf054('0x48')]);return db[_0xf054('0x2d')][_0xf054('0x49')](_0x426d01)[_0xf054('0x25')](handleEntityNotFound(_0x2769bd,null))[_0xf054('0x25')](respondWithResult(_0x2769bd,null))[_0xf054('0x44')](handleError(_0x2769bd,null));};exports[_0xf054('0x4a')]=function(_0x4412e0,_0xbe65f3){return db['FaxApplication'][_0xf054('0x4a')](_0x4412e0[_0xf054('0x4b')],{})[_0xf054('0x25')](respondWithResult(_0xbe65f3,0xc9))[_0xf054('0x44')](handleError(_0xbe65f3,null));};exports['update']=function(_0x228d7c,_0x45b757){if(_0x228d7c[_0xf054('0x4b')]['id']){delete _0x228d7c[_0xf054('0x4b')]['id'];}return db[_0xf054('0x2d')]['find']({'where':{'id':_0x228d7c[_0xf054('0x46')]['id']}})[_0xf054('0x25')](handleEntityNotFound(_0x45b757,null))['then'](saveUpdates(_0x228d7c[_0xf054('0x4b')],null))[_0xf054('0x25')](respondWithResult(_0x45b757,null))[_0xf054('0x44')](handleError(_0x45b757,null));};exports[_0xf054('0x26')]=function(_0x1dd786,_0x3c5492){return db[_0xf054('0x2d')][_0xf054('0x49')]({'where':{'id':_0x1dd786[_0xf054('0x46')]['id']}})[_0xf054('0x25')](handleEntityNotFound(_0x3c5492,null))[_0xf054('0x25')](removeEntity(_0x3c5492,null))[_0xf054('0x44')](handleError(_0x3c5492,null));}; \ No newline at end of file +var _0xe4e4=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv'];(function(_0x145b93,_0x4cf77a){var _0x596ac2=function(_0x2c418d){while(--_0x2c418d){_0x145b93['push'](_0x145b93['shift']());}};_0x596ac2(++_0x4cf77a);}(_0xe4e4,0x127));var _0x4e4e=function(_0x244ebd,_0x2ccba0){_0x244ebd=_0x244ebd-0x0;var _0x36336f=_0xe4e4[_0x244ebd];return _0x36336f;};'use strict';var emlformat=require(_0x4e4e('0x0'));var rimraf=require(_0x4e4e('0x1'));var zipdir=require(_0x4e4e('0x2'));var jsonpatch=require(_0x4e4e('0x3'));var rp=require(_0x4e4e('0x4'));var moment=require('moment');var BPromise=require(_0x4e4e('0x5'));var Mustache=require('mustache');var util=require(_0x4e4e('0x6'));var path=require('path');var sox=require(_0x4e4e('0x7'));var csv=require(_0x4e4e('0x8'));var ejs=require(_0x4e4e('0x9'));var fs=require('fs');var fs_extra=require(_0x4e4e('0xa'));var _=require(_0x4e4e('0xb'));var squel=require(_0x4e4e('0xc'));var crypto=require(_0x4e4e('0xd'));var jsforce=require(_0x4e4e('0xe'));var deskjs=require(_0x4e4e('0xf'));var toCsv=require(_0x4e4e('0x8'));var querystring=require(_0x4e4e('0x10'));var Papa=require(_0x4e4e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4e4e('0x12'));var hardwareService=require(_0x4e4e('0x13'));var logger=require(_0x4e4e('0x14'))(_0x4e4e('0x15'));var utils=require('../../config/utils');var config=require(_0x4e4e('0x16'));var licenseUtil=require(_0x4e4e('0x17'));var db=require(_0x4e4e('0x18'))['db'];function respondWithStatusCode(_0x30a429,_0xa080ab){_0xa080ab=_0xa080ab||0xcc;return function(_0x592551){if(_0x592551){return _0x30a429['sendStatus'](_0xa080ab);}return _0x30a429[_0x4e4e('0x19')](_0xa080ab)[_0x4e4e('0x1a')]();};}function respondWithResult(_0x167dfd,_0x2ed2a4){_0x2ed2a4=_0x2ed2a4||0xc8;return function(_0x4d5694){if(_0x4d5694){return _0x167dfd[_0x4e4e('0x19')](_0x2ed2a4)['json'](_0x4d5694);}};}function respondWithFilteredResult(_0x2a3ae2,_0x190f40){return function(_0x3eacd3){if(_0x3eacd3){var _0x524779=typeof _0x190f40[_0x4e4e('0x1b')]==='undefined'&&typeof _0x190f40[_0x4e4e('0x1c')]===_0x4e4e('0x1d');var _0x51d717=_0x3eacd3[_0x4e4e('0x1e')];var _0x37e45d=_0x524779?0x0:_0x190f40['offset'];var _0x4f9f99=_0x524779?_0x3eacd3[_0x4e4e('0x1e')]:_0x190f40['offset']+_0x190f40[_0x4e4e('0x1c')];var _0x17c4bc;if(_0x4f9f99>=_0x51d717){_0x4f9f99=_0x51d717;_0x17c4bc=0xc8;}else{_0x17c4bc=0xce;}_0x2a3ae2[_0x4e4e('0x19')](_0x17c4bc);return _0x2a3ae2[_0x4e4e('0x1f')](_0x4e4e('0x20'),_0x37e45d+'-'+_0x4f9f99+'/'+_0x51d717)[_0x4e4e('0x21')](_0x3eacd3);}return null;};}function patchUpdates(_0x11ab2d){return function(_0x3e44fd){try{jsonpatch['apply'](_0x3e44fd,_0x11ab2d,!![]);}catch(_0x3a01ee){return BPromise[_0x4e4e('0x22')](_0x3a01ee);}return _0x3e44fd[_0x4e4e('0x23')]();};}function saveUpdates(_0x482cd6,_0xf3d42c){return function(_0xa677f2){if(_0xa677f2){return _0xa677f2[_0x4e4e('0x24')](_0x482cd6)[_0x4e4e('0x25')](function(_0x44306c){return _0x44306c;});}return null;};}function removeEntity(_0x5f3e01,_0x227b4c){return function(_0x349316){if(_0x349316){return _0x349316[_0x4e4e('0x26')]()[_0x4e4e('0x25')](function(){_0x5f3e01['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x532d2e,_0x4d0fd7){return function(_0x5dd30e){if(!_0x5dd30e){_0x532d2e['sendStatus'](0x194);}return _0x5dd30e;};}function handleError(_0x1ecf6b,_0x5e4d89){_0x5e4d89=_0x5e4d89||0x1f4;return function(_0x29114b){logger[_0x4e4e('0x27')](_0x29114b[_0x4e4e('0x28')]);if(_0x29114b[_0x4e4e('0x29')]){delete _0x29114b['name'];}_0x1ecf6b['status'](_0x5e4d89)[_0x4e4e('0x2a')](_0x29114b);};}exports[_0x4e4e('0x2b')]=function(_0x35fd88,_0x129c71){var _0x32c566={},_0x234da7={},_0xed24cd={'count':0x0,'rows':[]};var _0x45da7f=_[_0x4e4e('0x2c')](db[_0x4e4e('0x2d')][_0x4e4e('0x2e')],function(_0x1d1fea){return{'name':_0x1d1fea[_0x4e4e('0x2f')],'type':_0x1d1fea[_0x4e4e('0x30')][_0x4e4e('0x31')]};});_0x234da7[_0x4e4e('0x32')]=_[_0x4e4e('0x2c')](_0x45da7f,'name');_0x234da7[_0x4e4e('0x33')]=_[_0x4e4e('0x34')](_0x35fd88[_0x4e4e('0x33')]);_0x234da7['filters']=_[_0x4e4e('0x35')](_0x234da7[_0x4e4e('0x32')],_0x234da7[_0x4e4e('0x33')]);_0x32c566['attributes']=_[_0x4e4e('0x35')](_0x234da7[_0x4e4e('0x32')],qs[_0x4e4e('0x36')](_0x35fd88[_0x4e4e('0x33')][_0x4e4e('0x36')]));_0x32c566[_0x4e4e('0x37')]=_0x32c566[_0x4e4e('0x37')][_0x4e4e('0x38')]?_0x32c566[_0x4e4e('0x37')]:_0x234da7[_0x4e4e('0x32')];if(!_0x35fd88[_0x4e4e('0x33')]['hasOwnProperty'](_0x4e4e('0x39'))){_0x32c566[_0x4e4e('0x1c')]=qs[_0x4e4e('0x1c')](_0x35fd88[_0x4e4e('0x33')]['limit']);_0x32c566[_0x4e4e('0x1b')]=qs[_0x4e4e('0x1b')](_0x35fd88[_0x4e4e('0x33')]['offset']);}_0x32c566[_0x4e4e('0x3a')]=qs[_0x4e4e('0x3b')](_0x35fd88[_0x4e4e('0x33')][_0x4e4e('0x3b')]);_0x32c566[_0x4e4e('0x3c')]=qs[_0x4e4e('0x3d')](_[_0x4e4e('0x3e')](_0x35fd88['query'],_0x234da7[_0x4e4e('0x3d')]),_0x45da7f);if(_0x35fd88[_0x4e4e('0x33')]['filter']){_0x32c566[_0x4e4e('0x3c')]=_[_0x4e4e('0x3f')](_0x32c566[_0x4e4e('0x3c')],{'$or':_[_0x4e4e('0x2c')](_0x45da7f,function(_0xe3be21){if(_0xe3be21[_0x4e4e('0x30')]!==_0x4e4e('0x40')){var _0x44d44e={};_0x44d44e[_0xe3be21[_0x4e4e('0x29')]]={'$like':'%'+_0x35fd88[_0x4e4e('0x33')][_0x4e4e('0x41')]+'%'};return _0x44d44e;}})});}_0x32c566=_[_0x4e4e('0x3f')]({},_0x32c566,_0x35fd88[_0x4e4e('0x42')]);var _0x41aa0e={'where':_0x32c566['where']};return db['FaxApplication'][_0x4e4e('0x1e')](_0x41aa0e)['then'](function(_0x46dd40){_0xed24cd['count']=_0x46dd40;if(_0x35fd88[_0x4e4e('0x33')][_0x4e4e('0x43')]){_0x32c566['include']=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x32c566);})[_0x4e4e('0x25')](function(_0x5987ab){_0xed24cd[_0x4e4e('0x44')]=_0x5987ab;return _0xed24cd;})[_0x4e4e('0x25')](respondWithFilteredResult(_0x129c71,_0x32c566))[_0x4e4e('0x45')](handleError(_0x129c71,null));};exports[_0x4e4e('0x46')]=function(_0x1edf65,_0x229f0d){var _0x4f882e={'raw':!![],'where':{'id':_0x1edf65[_0x4e4e('0x47')]['id']}},_0x51d1b9={};_0x51d1b9[_0x4e4e('0x32')]=_[_0x4e4e('0x34')](db['FaxApplication'][_0x4e4e('0x2e')]);_0x51d1b9[_0x4e4e('0x33')]=_[_0x4e4e('0x34')](_0x1edf65[_0x4e4e('0x33')]);_0x51d1b9['filters']=_[_0x4e4e('0x35')](_0x51d1b9[_0x4e4e('0x32')],_0x51d1b9['query']);_0x4f882e['attributes']=_[_0x4e4e('0x35')](_0x51d1b9['model'],qs[_0x4e4e('0x36')](_0x1edf65[_0x4e4e('0x33')][_0x4e4e('0x36')]));_0x4f882e[_0x4e4e('0x37')]=_0x4f882e['attributes'][_0x4e4e('0x38')]?_0x4f882e[_0x4e4e('0x37')]:_0x51d1b9[_0x4e4e('0x32')];if(_0x1edf65['query'][_0x4e4e('0x43')]){_0x4f882e[_0x4e4e('0x48')]=[{'all':!![]}];}_0x4f882e=_[_0x4e4e('0x3f')]({},_0x4f882e,_0x1edf65[_0x4e4e('0x42')]);return db[_0x4e4e('0x2d')][_0x4e4e('0x49')](_0x4f882e)[_0x4e4e('0x25')](handleEntityNotFound(_0x229f0d,null))[_0x4e4e('0x25')](respondWithResult(_0x229f0d,null))[_0x4e4e('0x45')](handleError(_0x229f0d,null));};exports[_0x4e4e('0x4a')]=function(_0x657db4,_0x58d96b){return db[_0x4e4e('0x2d')]['create'](_0x657db4[_0x4e4e('0x4b')],{})[_0x4e4e('0x25')](respondWithResult(_0x58d96b,0xc9))[_0x4e4e('0x45')](handleError(_0x58d96b,null));};exports[_0x4e4e('0x24')]=function(_0x4055b3,_0x178c3c){if(_0x4055b3[_0x4e4e('0x4b')]['id']){delete _0x4055b3[_0x4e4e('0x4b')]['id'];}return db['FaxApplication'][_0x4e4e('0x49')]({'where':{'id':_0x4055b3[_0x4e4e('0x47')]['id']}})['then'](handleEntityNotFound(_0x178c3c,null))['then'](saveUpdates(_0x4055b3[_0x4e4e('0x4b')],null))[_0x4e4e('0x25')](respondWithResult(_0x178c3c,null))['catch'](handleError(_0x178c3c,null));};exports['destroy']=function(_0x47eba7,_0x258a6c){return db[_0x4e4e('0x2d')][_0x4e4e('0x49')]({'where':{'id':_0x47eba7[_0x4e4e('0x47')]['id']}})[_0x4e4e('0x25')](handleEntityNotFound(_0x258a6c,null))[_0x4e4e('0x25')](removeEntity(_0x258a6c,null))[_0x4e4e('0x45')](handleError(_0x258a6c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d40d02d..31d47cf 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 _0x2bc9=['../../config/logger','api','moment','request-promise','./faxApplication.attributes','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x7cc9b5,_0x3ea246){var _0x4457f1=function(_0x8178de){while(--_0x8178de){_0x7cc9b5['push'](_0x7cc9b5['shift']());}};_0x4457f1(++_0x3ea246);}(_0x2bc9,0xfb));var _0x92bc=function(_0x4ad493,_0x421d2a){_0x4ad493=_0x4ad493-0x0;var _0x45cf27=_0x2bc9[_0x4ad493];return _0x45cf27;};'use strict';var _=require(_0x92bc('0x0'));var util=require(_0x92bc('0x1'));var logger=require(_0x92bc('0x2'))(_0x92bc('0x3'));var moment=require(_0x92bc('0x4'));var BPromise=require('bluebird');var rp=require(_0x92bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x92bc('0x6'));module[_0x92bc('0x7')]=function(_0x3b3d47,_0x3e50dd){return _0x3b3d47['define'](_0x92bc('0x8'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x92bc('0x9'),'collate':_0x92bc('0xa')});}; \ No newline at end of file +var _0x2622=['api','bluebird','request-promise','path','rimraf','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2622,0x81));var _0x2262=function(_0x4843c5,_0x10cfa4){_0x4843c5=_0x4843c5-0x0;var _0x49087b=_0x2622[_0x4843c5];return _0x49087b;};'use strict';var _=require(_0x2262('0x0'));var util=require(_0x2262('0x1'));var logger=require(_0x2262('0x2'))(_0x2262('0x3'));var moment=require('moment');var BPromise=require(_0x2262('0x4'));var rp=require(_0x2262('0x5'));var fs=require('fs');var path=require(_0x2262('0x6'));var rimraf=require(_0x2262('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module['exports']=function(_0x21c80e,_0x4e33ed){return _0x21c80e[_0x2262('0x8')](_0x2262('0x9'),attributes,{'tableName':_0x2262('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2262('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0ef8497..6cc314b 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 _0x6061=['request\x20sent','catch','FaxApplication','update','body','raw','options','where','limit','UpdateFaxApplication','debug','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6061,0x110));var _0x1606=function(_0x403605,_0x19cf54){_0x403605=_0x403605-0x0;var _0x3fbae7=_0x6061[_0x403605];return _0x3fbae7;};'use strict';var _=require('lodash');var util=require(_0x1606('0x0'));var moment=require(_0x1606('0x1'));var BPromise=require(_0x1606('0x2'));var rs=require(_0x1606('0x3'));var fs=require('fs');var Redis=require(_0x1606('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1606('0x5'))(_0x1606('0x6'));var config=require(_0x1606('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1606('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x526289,_0x52528c,_0x1dae05){return new BPromise(function(_0xafe3dd,_0x5b2db9){return client[_0x1606('0x9')](_0x526289,_0x1dae05)[_0x1606('0xa')](function(_0xd7ceb6){logger[_0x1606('0xb')]('FaxApplication,\x20%s,\x20%s',_0x52528c,'request\x20sent');logger['debug'](_0x1606('0xc'),_0x52528c,'request\x20sent',JSON[_0x1606('0xd')](_0xd7ceb6));if(_0xd7ceb6[_0x1606('0xe')]){if(_0xd7ceb6[_0x1606('0xe')][_0x1606('0xf')]===0x1f4){logger[_0x1606('0xe')](_0x1606('0x10'),_0x52528c,_0xd7ceb6[_0x1606('0xe')][_0x1606('0x11')]);return _0x5b2db9(_0xd7ceb6[_0x1606('0xe')][_0x1606('0x11')]);}logger[_0x1606('0xe')](_0x1606('0x10'),_0x52528c,_0xd7ceb6[_0x1606('0xe')][_0x1606('0x11')]);return _0xafe3dd(_0xd7ceb6[_0x1606('0xe')]['message']);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x52528c,_0x1606('0x12'));_0xafe3dd(_0xd7ceb6['result'][_0x1606('0x11')]);}})[_0x1606('0x13')](function(_0x10973a){logger[_0x1606('0xe')]('FaxApplication,\x20%s,\x20%s',_0x52528c,_0x10973a);_0x5b2db9(_0x10973a);});});}exports['UpdateFaxApplication']=function(_0x510ba){var _0x47b61c=this;return new Promise(function(_0x1c5219,_0x4500a8){return db[_0x1606('0x14')][_0x1606('0x15')](_0x510ba[_0x1606('0x16')],{'raw':_0x510ba['options']?_0x510ba['options'][_0x1606('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x510ba[_0x1606('0x18')]?_0x510ba['options'][_0x1606('0x19')]||null:null,'attributes':_0x510ba[_0x1606('0x18')]?_0x510ba['options']['attributes']||null:null,'limit':_0x510ba[_0x1606('0x18')]?_0x510ba[_0x1606('0x18')][_0x1606('0x1a')]||null:null})[_0x1606('0xa')](function(_0x4762bb){logger[_0x1606('0xb')](_0x1606('0x1b'),_0x510ba);logger[_0x1606('0x1c')](_0x1606('0x1b'),_0x510ba,JSON[_0x1606('0xd')](_0x4762bb));_0x1c5219(_0x4762bb);})[_0x1606('0x13')](function(_0x3db8d8){logger['error'](_0x1606('0x1b'),_0x3db8d8['message'],_0x510ba);_0x4500a8(_0x47b61c[_0x1606('0xe')](0x1f4,_0x3db8d8[_0x1606('0x11')]));});});}; \ No newline at end of file +var _0x46e8=['then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','body','options','where','attributes','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x46e8,0x1c5));var _0x846e=function(_0xfd42fa,_0x1ede6e){_0xfd42fa=_0xfd42fa-0x0;var _0x450569=_0x46e8[_0xfd42fa];return _0x450569;};'use strict';var _=require(_0x846e('0x0'));var util=require(_0x846e('0x1'));var moment=require(_0x846e('0x2'));var BPromise=require(_0x846e('0x3'));var rs=require(_0x846e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x846e('0x5'))(_0x846e('0x6'));var config=require(_0x846e('0x7'));var jayson=require(_0x846e('0x8'));var client=jayson[_0x846e('0x9')][_0x846e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x273985,_0x40ef64,_0x497218){return new BPromise(function(_0x45aa8c,_0x3996f4){return client[_0x846e('0xb')](_0x273985,_0x497218)[_0x846e('0xc')](function(_0x5a855d){logger[_0x846e('0xd')](_0x846e('0xe'),_0x40ef64,_0x846e('0xf'));logger[_0x846e('0x10')](_0x846e('0x11'),_0x40ef64,_0x846e('0xf'),JSON[_0x846e('0x12')](_0x5a855d));if(_0x5a855d[_0x846e('0x13')]){if(_0x5a855d['error'][_0x846e('0x14')]===0x1f4){logger[_0x846e('0x13')](_0x846e('0xe'),_0x40ef64,_0x5a855d['error']['message']);return _0x3996f4(_0x5a855d[_0x846e('0x13')][_0x846e('0x15')]);}logger[_0x846e('0x13')]('FaxApplication,\x20%s,\x20%s',_0x40ef64,_0x5a855d[_0x846e('0x13')][_0x846e('0x15')]);return _0x45aa8c(_0x5a855d[_0x846e('0x13')]['message']);}else{logger[_0x846e('0xd')](_0x846e('0xe'),_0x40ef64,'request\x20sent');_0x45aa8c(_0x5a855d[_0x846e('0x16')][_0x846e('0x15')]);}})[_0x846e('0x17')](function(_0x55bbf9){logger[_0x846e('0x13')](_0x846e('0xe'),_0x40ef64,_0x55bbf9);_0x3996f4(_0x55bbf9);});});}exports['UpdateFaxApplication']=function(_0x371e04){var _0x483fa3=this;return new Promise(function(_0x199f03,_0x4656f9){return db[_0x846e('0x18')][_0x846e('0x19')](_0x371e04[_0x846e('0x1a')],{'raw':_0x371e04[_0x846e('0x1b')]?_0x371e04[_0x846e('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x371e04[_0x846e('0x1b')]?_0x371e04[_0x846e('0x1b')][_0x846e('0x1c')]||null:null,'attributes':_0x371e04[_0x846e('0x1b')]?_0x371e04[_0x846e('0x1b')][_0x846e('0x1d')]||null:null,'limit':_0x371e04['options']?_0x371e04[_0x846e('0x1b')]['limit']||null:null})['then'](function(_0xe3eada){logger[_0x846e('0xd')](_0x846e('0x1e'),_0x371e04);logger[_0x846e('0x10')](_0x846e('0x1e'),_0x371e04,JSON[_0x846e('0x12')](_0xe3eada));_0x199f03(_0xe3eada);})[_0x846e('0x17')](function(_0x554fd9){logger['error']('UpdateFaxApplication',_0x554fd9[_0x846e('0x15')],_0x371e04);_0x4656f9(_0x483fa3[_0x846e('0x13')](0x1f4,_0x554fd9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d602e37..8bd319f 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 _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x50479e,_0x5323a3){var _0x3f66ad=function(_0x384d7d){while(--_0x384d7d){_0x50479e['push'](_0x50479e['shift']());}};_0x3f66ad(++_0x5323a3);}(_0x5c00,0x17e));var _0x05c0=function(_0x3849ff,_0x4ae25e){_0x3849ff=_0x3849ff-0x0;var _0x3ab676=_0x5c00[_0x3849ff];return _0x3ab676;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./faxApplication.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0abf=['isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x0abf,0xe8));var _0xf0ab=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0abf[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0xb')]('/',auth[_0xf0ab('0x8')](),controller['create']);router[_0xf0ab('0xc')](_0xf0ab('0xd'),auth[_0xf0ab('0x8')](),controller['update']);router['delete'](_0xf0ab('0xd'),auth['isAuthenticated'](),controller[_0xf0ab('0xe')]);module[_0xf0ab('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index f7dcc09..4d56fc0 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 _0x7367=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x7367,0x83));var _0x7736=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7367[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7736('0x0'));module[_0x7736('0x1')]={'closed':{'type':Sequelize[_0x7736('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7736('0x3')]},'disposition':{'type':Sequelize[_0x7736('0x4')]},'secondDisposition':{'type':Sequelize[_0x7736('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7736('0x4')]},'note':{'type':Sequelize[_0x7736('0x4')]},'read1stAt':{'type':Sequelize[_0x7736('0x3')]},'fax':{'type':Sequelize[_0x7736('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7736('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7736('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7736('0x5')]('in',_0x7736('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x1eba=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x1eba[_0x16de68];return _0x1c277e;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'closed':{'type':Sequelize[_0xa1eb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa1eb('0x3')]},'disposition':{'type':Sequelize[_0xa1eb('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa1eb('0x4')]},'read1stAt':{'type':Sequelize[_0xa1eb('0x3')]},'fax':{'type':Sequelize[_0xa1eb('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa1eb('0x5')]('in',_0xa1eb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa1eb('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa1eb('0x5')]('in',_0xa1eb('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index efb8014..f7d1ad7 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 _0xf4b8=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','TagIds','Tags','FaxInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','role','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','push','all','rows','catch','params','includeAll','options','create','describe','addMessage','ids','omit','getMessages','findOne','filter','merge','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','include','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','download','unix','join','root','server','files','tmp','format','transcript-%d-%s.zip','Messages','get','mkdirSync','Attachment','basename','existsSync','createWriteStream','resolve','err','unlinkSync','eml-format','zip-dir'];(function(_0x351b11,_0x4b66cc){var _0x206b53=function(_0x179c45){while(--_0x179c45){_0x351b11['push'](_0x351b11['shift']());}};_0x206b53(++_0x4b66cc);}(_0xf4b8,0x1b8));var _0x8f4b=function(_0x2f9940,_0x1f0ed7){_0x2f9940=_0x2f9940-0x0;var _0x4f751a=_0xf4b8[_0x2f9940];return _0x4f751a;};'use strict';var emlformat=require(_0x8f4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f4b('0x1'));var jsonpatch=require(_0x8f4b('0x2'));var rp=require(_0x8f4b('0x3'));var moment=require(_0x8f4b('0x4'));var BPromise=require(_0x8f4b('0x5'));var Mustache=require(_0x8f4b('0x6'));var util=require(_0x8f4b('0x7'));var path=require(_0x8f4b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8f4b('0x9'));var fs=require('fs');var fs_extra=require(_0x8f4b('0xa'));var _=require(_0x8f4b('0xb'));var squel=require(_0x8f4b('0xc'));var crypto=require(_0x8f4b('0xd'));var jsforce=require(_0x8f4b('0xe'));var deskjs=require(_0x8f4b('0xf'));var toCsv=require(_0x8f4b('0x10'));var querystring=require('querystring');var Papa=require(_0x8f4b('0x11'));var Redis=require(_0x8f4b('0x12'));var authService=require(_0x8f4b('0x13'));var qs=require(_0x8f4b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f4b('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8f4b('0x16'));var config=require(_0x8f4b('0x17'));var licenseUtil=require(_0x8f4b('0x18'));var db=require(_0x8f4b('0x19'))['db'];config[_0x8f4b('0x1a')]=_[_0x8f4b('0x1b')](config[_0x8f4b('0x1a')],{'host':_0x8f4b('0x1c'),'port':0x18eb});var socket=require(_0x8f4b('0x1d'))(new Redis(config[_0x8f4b('0x1a')]));require(_0x8f4b('0x1e'))[_0x8f4b('0x1f')](socket);function respondWithStatusCode(_0x260e9a,_0x3c152f){_0x3c152f=_0x3c152f||0xcc;return function(_0x5bb592){if(_0x5bb592){return _0x260e9a['sendStatus'](_0x3c152f);}return _0x260e9a[_0x8f4b('0x20')](_0x3c152f)[_0x8f4b('0x21')]();};}function respondWithResult(_0x5e5ae7,_0x5374d5){_0x5374d5=_0x5374d5||0xc8;return function(_0xc31c95){if(_0xc31c95){return _0x5e5ae7[_0x8f4b('0x20')](_0x5374d5)['json'](_0xc31c95);}};}function respondWithFilteredResult(_0x3a4021,_0x53391d){return function(_0x15555e){if(_0x15555e){var _0x190761=typeof _0x53391d['offset']===_0x8f4b('0x22')&&typeof _0x53391d[_0x8f4b('0x23')]===_0x8f4b('0x22');var _0xdbf9dc=_0x15555e[_0x8f4b('0x24')];var _0x2e077f=_0x190761?0x0:_0x53391d[_0x8f4b('0x25')];var _0x5b5af4=_0x190761?_0x15555e['count']:_0x53391d['offset']+_0x53391d[_0x8f4b('0x23')];var _0x326c97;if(_0x5b5af4>=_0xdbf9dc){_0x5b5af4=_0xdbf9dc;_0x326c97=0xc8;}else{_0x326c97=0xce;}_0x3a4021['status'](_0x326c97);return _0x3a4021[_0x8f4b('0x26')](_0x8f4b('0x27'),_0x2e077f+'-'+_0x5b5af4+'/'+_0xdbf9dc)['json'](_0x15555e);}return null;};}function patchUpdates(_0x2b1a19){return function(_0x3ef9e0){try{jsonpatch[_0x8f4b('0x28')](_0x3ef9e0,_0x2b1a19,!![]);}catch(_0x2a8dc4){return BPromise[_0x8f4b('0x29')](_0x2a8dc4);}return _0x3ef9e0[_0x8f4b('0x2a')]();};}function saveUpdates(_0x46400c,_0x23cb40){return function(_0x11d57d){if(_0x11d57d){return _0x11d57d[_0x8f4b('0x2b')](_0x46400c)[_0x8f4b('0x2c')](function(_0x357b7a){return _0x357b7a;});}return null;};}function removeEntity(_0x53b96c,_0x2999bd){return function(_0x28fd10){if(_0x28fd10){return _0x28fd10[_0x8f4b('0x2d')]()[_0x8f4b('0x2c')](function(){_0x53b96c[_0x8f4b('0x20')](0xcc)[_0x8f4b('0x21')]();});}};}function handleEntityNotFound(_0x48e39d,_0x251a19){return function(_0xab837c){if(!_0xab837c){_0x48e39d[_0x8f4b('0x2e')](0x194);}return _0xab837c;};}function handleError(_0x5369cd,_0x3357db){_0x3357db=_0x3357db||0x1f4;return function(_0x3f09fa){logger[_0x8f4b('0x2f')](_0x3f09fa[_0x8f4b('0x30')]);if(_0x3f09fa[_0x8f4b('0x31')]){delete _0x3f09fa[_0x8f4b('0x31')];}_0x5369cd[_0x8f4b('0x20')](_0x3357db)[_0x8f4b('0x32')](_0x3f09fa);};}function getInteractionUsers(_0x165255,_0x34350f){return new BPromise(function(_0x5f14e2,_0x3110ba){try{if(_0x34350f[_0x165255['id']]){_0x165255[_0x8f4b('0x33')]=_[_0x8f4b('0x34')](_0x34350f[_0x165255['id']],function(_0x29b90b){return{'id':_0x29b90b['id'],'fullname':_0x29b90b['fullname']};});}}catch(_0x40542d){_0x3110ba(_0x40542d);}_0x5f14e2(_0x165255);});}function getInteractionTags(_0x576c0c,_0x548fbf){return new BPromise(function(_0x4b341e,_0x4665a9){try{if(_0x576c0c[_0x8f4b('0x35')]){_0x576c0c[_0x8f4b('0x36')]=[];_0x576c0c[_0x8f4b('0x35')]['split'](',')['forEach'](function(_0x490c37){_0x576c0c[_0x8f4b('0x36')]['push'](_0x548fbf[_0x490c37]);});}delete _0x576c0c[_0x8f4b('0x35')];}catch(_0x484843){_0x4665a9(_0x484843);}_0x4b341e(_0x576c0c);});}function updateFaxInteraction(_0x3a11ca,_0x574e9f,_0x4c1562){return new BPromise(function(_0xb72a3b,_0x4461db){return getInteractionUsers(_0x3a11ca,_0x4c1562)[_0x8f4b('0x2c')](function(_0x28c0c1){return getInteractionTags(_0x28c0c1,_0x574e9f);})[_0x8f4b('0x2c')](function(_0x11b7f5){_0xb72a3b(_0x11b7f5);})['catch'](function(_0x5722d7){_0x4461db(_0x5722d7);});});}exports['index']=function(_0xd09c64,_0x3b9237){var _0x10953e={},_0x37e124={},_0x5cad51={'count':0x0,'rows':[]};var _0x444bf9=_[_0x8f4b('0x34')](db[_0x8f4b('0x37')][_0x8f4b('0x38')],function(_0x575406){return{'name':_0x575406[_0x8f4b('0x39')],'type':_0x575406['type'][_0x8f4b('0x3a')]};});_0x37e124[_0x8f4b('0x3b')]=_[_0x8f4b('0x34')](_0x444bf9,_0x8f4b('0x31'));_0x37e124['query']=_[_0x8f4b('0x3c')](_0xd09c64[_0x8f4b('0x3d')]);_0x37e124[_0x8f4b('0x3e')]=_[_0x8f4b('0x3f')](_0x37e124[_0x8f4b('0x3b')],_0x37e124[_0x8f4b('0x3d')]);_0x10953e['attributes']=_[_0x8f4b('0x3f')](_0x37e124[_0x8f4b('0x3b')],qs[_0x8f4b('0x40')](_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x40')]));_0x10953e[_0x8f4b('0x41')]=_0x10953e[_0x8f4b('0x41')][_0x8f4b('0x42')]?_0x10953e['attributes']:_0x37e124[_0x8f4b('0x3b')];if(!_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x43')](_0x8f4b('0x44'))){_0x10953e[_0x8f4b('0x23')]=qs[_0x8f4b('0x23')](_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x23')]);_0x10953e['offset']=qs[_0x8f4b('0x25')](_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x25')]);}_0x10953e[_0x8f4b('0x45')]=qs[_0x8f4b('0x46')](_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x46')]);_0x10953e[_0x8f4b('0x47')]=qs[_0x8f4b('0x3e')](_[_0x8f4b('0x48')](_0xd09c64[_0x8f4b('0x3d')],_0x37e124['filters']),_0x444bf9);var _0xbf9cc9=[];var _0x29cc85=squel[_0x8f4b('0x49')]()[_0x8f4b('0x4a')]('id')[_0x8f4b('0x4a')](_0x8f4b('0x31'))[_0x8f4b('0x4a')](_0x8f4b('0x4b'))[_0x8f4b('0x4c')](_0x8f4b('0x4d'));var _0x937052=squel[_0x8f4b('0x49')]()[_0x8f4b('0x4a')](_0x8f4b('0x4e'))[_0x8f4b('0x4a')](_0x8f4b('0x4f'))[_0x8f4b('0x4a')]('ui.FaxInteractionId')[_0x8f4b('0x4c')](_0x8f4b('0x50'),'ui')[_0x8f4b('0x51')](_0x8f4b('0x52'),'u',_0x8f4b('0x53'));var _0x49bab6=squel[_0x8f4b('0x49')]()[_0x8f4b('0x4c')](_0x8f4b('0x54'),'i')[_0x8f4b('0x51')](_0x8f4b('0x55'),'c',_0x8f4b('0x56'))[_0x8f4b('0x51')](_0x8f4b('0x52'),'o',_0x8f4b('0x57'))[_0x8f4b('0x51')](_0x8f4b('0x58'),'a','a.id\x20=\x20i.FaxAccountId')[_0x8f4b('0x51')](_0x8f4b('0x59'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x8f4b('0x5a'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x8f4b('0x51')](_0x8f4b('0x4d'),'t',_0x8f4b('0x5b'));var _0x940bf=squel[_0x8f4b('0x5c')]();var _0x34aba0=[];var _0x4d81a2=squel[_0x8f4b('0x5c')]();var _0x1f0ff2;if(_0xd09c64[_0x8f4b('0x3d')]['search']){_0x1f0ff2=as[_0x8f4b('0x5d')](_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x5e')]);var _0x52d912=_0x1f0ff2['sqlOperator'];for(var _0x578651=0x0;_0x578651<_0x1f0ff2['conditions'][_0x8f4b('0x42')];_0x578651++){var _0x364bb5=_0x1f0ff2['conditions'][_0x578651];var _0x5f894f='i';var _0x996851=_[_0x8f4b('0x5f')](_0x444bf9,['name',_0x364bb5['field']]);if(!_0x996851){switch(_0x364bb5[_0x8f4b('0x4a')]){case _0x8f4b('0x60'):if(_0x364bb5[_0x8f4b('0x61')]==0x1){_0x49bab6[_0x8f4b('0x62')]('`'+_0x364bb5[_0x8f4b('0x4a')]+_0x8f4b('0x63'));}else{_0x49bab6['having']('`'+_0x364bb5[_0x8f4b('0x4a')]+_0x8f4b('0x64'));}break;case _0x8f4b('0x65'):if(_0x364bb5[_0x8f4b('0x66')]===_0x8f4b('0x67')){if(_0x364bb5[_0x8f4b('0x61')]['split']('\x20')[_0x8f4b('0x42')]>0x1){_0x940bf[_0x52d912](_0x8f4b('0x68'),qs['getFullTextValue'](_0x364bb5[_0x8f4b('0x61')]),null);}else{var _0x4eb190='%'+_0x364bb5['value']+'%';_0x940bf[_0x52d912](_0x8f4b('0x69'),_0x4eb190,_0x4eb190,_0x4eb190);}}else{_0x996851=_[_0x8f4b('0x5f')](_0x444bf9,[_0x8f4b('0x31'),_0x8f4b('0x6a')]);_0x364bb5[_0x8f4b('0x4a')]=_0x8f4b('0x6a');_0x48a67c=as[_0x8f4b('0x6b')](_0x5f894f,_0x996851[_0x8f4b('0x6c')],_0x364bb5);_0x940bf[_0x52d912](_0x48a67c[_0x8f4b('0x6d')],_0x48a67c[_0x8f4b('0x61')]['start'],_0x48a67c[_0x8f4b('0x61')][_0x8f4b('0x21')]);}break;case _0x8f4b('0x6e'):var _0x6b1b01=_0x364bb5[_0x8f4b('0x61')]['split'](',')['map'](function(_0x4dd6b2){return Number(_0x4dd6b2);});_0x6b1b01[_0x8f4b('0x6f')](function(_0x532fd2){_0x4d81a2['or'](_0x8f4b('0x70'),'%,'+_0x532fd2+',%');});_0x34aba0=_['union'](_0x34aba0,_0x6b1b01);break;case'User':if(_0x364bb5[_0x8f4b('0x66')]===_0x8f4b('0x67')){_0x940bf[_0x52d912](_0x8f4b('0x71'),'%'+_0x364bb5[_0x8f4b('0x61')]+'%',null);}else{_0x996851=_['find'](_0x444bf9,[_0x8f4b('0x31'),'UserId']);_0x364bb5['field']=_0x8f4b('0x72');_0x48a67c=as[_0x8f4b('0x6b')](_0x5f894f,_0x996851[_0x8f4b('0x6c')],_0x364bb5);_0x940bf[_0x52d912](_0x48a67c[_0x8f4b('0x6d')],_0x48a67c[_0x8f4b('0x61')][_0x8f4b('0x73')],_0x48a67c[_0x8f4b('0x61')][_0x8f4b('0x21')]);}break;case _0x8f4b('0x74'):_0x48a67c=as[_0x8f4b('0x6b')]('me',null,_0x364bb5);_0x940bf[_0x52d912](_0x48a67c['text'],_0x48a67c[_0x8f4b('0x61')][_0x8f4b('0x73')],_0x48a67c['value']['end']);break;}}else{var _0x48a67c=as[_0x8f4b('0x6b')](_0x5f894f,_0x996851['type'],_0x364bb5);_0x940bf[_0x52d912](_0x48a67c[_0x8f4b('0x6d')],_0x48a67c[_0x8f4b('0x61')][_0x8f4b('0x73')],_0x48a67c['value']['end']);}}}else{var _0x35763c=_(_0xd09c64[_0x8f4b('0x3d')])[_0x8f4b('0x3c')]()[_0x8f4b('0x34')](function(_0x21b4ad){return _[_0x8f4b('0x75')](_0x444bf9,[_0x8f4b('0x31'),_0x21b4ad])?_0x21b4ad:undefined;})['compact']()[_0x8f4b('0x61')]();if(!_[_0x8f4b('0x76')](_0x35763c)){_0x35763c['forEach'](function(_0x268b35){if(_0x268b35===_0x8f4b('0x77')){_0x49bab6['where'](_0x8f4b('0x78'),[]['concat'](_0xd09c64['query'][_0x268b35]));}else if(_0x268b35===_0x8f4b('0x79')){var _0x2c95da=JSON[_0x8f4b('0x7a')](_0xd09c64[_0x8f4b('0x3d')][_0x268b35])[_0x8f4b('0x7b')];var _0x2e9c97=JSON[_0x8f4b('0x7a')](_0xd09c64[_0x8f4b('0x3d')][_0x268b35])[_0x8f4b('0x7c')];_0x49bab6[_0x8f4b('0x47')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2c95da,_0x2e9c97);}else{if(_0xd09c64[_0x8f4b('0x3d')][_0x268b35]===_0x8f4b('0x7d')){_0x49bab6[_0x8f4b('0x47')]('i.'+_0x268b35+_0x8f4b('0x7e'));}else{_0x49bab6[_0x8f4b('0x47')]('i.'+_0x268b35+_0x8f4b('0x7f'),_0xd09c64[_0x8f4b('0x3d')][_0x268b35]);}}});}if(_0xd09c64[_0x8f4b('0x3d')]['read']){if(_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x80')]==0x1){_0x49bab6[_0x8f4b('0x62')](_0x8f4b('0x81'));}else{_0x49bab6[_0x8f4b('0x62')](_0x8f4b('0x82'));}}if(_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x83')]){_0x34aba0=_[_0x8f4b('0x84')](_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x83')])?_0xd09c64['query'][_0x8f4b('0x83')]:new Array(_0xd09c64[_0x8f4b('0x3d')]['tag']);_0x34aba0[_0x8f4b('0x6f')](function(_0x336d39){_0x4d81a2['or'](_0x8f4b('0x70'),'%,'+_0x336d39+',%');});}if(_0xd09c64[_0x8f4b('0x3d')]['filter']){var _0x449e47=_0xd09c64['query']['filter'][_0x8f4b('0x85')]('\x5c','\x5c\x5c')[_0x8f4b('0x85')](/'/g,'\x27\x27');if(qs[_0x8f4b('0x86')](_0x449e47)){_0x940bf['or']('i.id\x20LIKE\x20?',_0x449e47+'%')['or'](_0x8f4b('0x87'),_0x449e47+'%');}_0x940bf['or'](_0x8f4b('0x88'),_0x449e47+'%');}}_0x49bab6[_0x8f4b('0x47')](_0x940bf);_0x49bab6[_0x8f4b('0x89')]('i.id');var _0x2d2e7d={'type':db[_0x8f4b('0x8a')][_0x8f4b('0x8b')]['SELECT'],'raw':!![]};var _0x3328ac=_0x49bab6[_0x8f4b('0x8c')]();_0x3328ac['field'](_0x8f4b('0x8d'));_0x3328ac[_0x8f4b('0x4a')](_0x8f4b('0x8e'),_0x8f4b('0x60'));if(_0x10953e[_0x8f4b('0x45')]){_0x10953e['order'][_0x8f4b('0x6f')](function(_0x35aa6b){var _0x16dec2=_0x35aa6b[0x0]===_0x8f4b('0x8f')?_0x35aa6b[0x0]:'i.'+_0x35aa6b[0x0];_0x49bab6[_0x8f4b('0x45')](_0x16dec2,_0x35aa6b[0x1]===_0x8f4b('0x90')?![]:!![]);});}if(!_[_0x8f4b('0x76')](_0x34aba0)){_0x49bab6['having'](_0x4d81a2);_0x3328ac['where'](_0x8f4b('0x91'),_0x34aba0);}BPromise['resolve']()[_0x8f4b('0x2c')](function(){if(!_0x1f0ff2){if(_0xd09c64['query'][_0x8f4b('0x77')])return;_0x3328ac[_0x8f4b('0x47')](_0x8f4b('0x92'));_0x49bab6['where'](_0x8f4b('0x92'));return;}if(_0xd09c64[_0x8f4b('0x93')]['role']!==_0x8f4b('0x94'))return;return _0xd09c64['user'][_0x8f4b('0x95')]({'attributes':['id'],'raw':!![]})[_0x8f4b('0x2c')](function(_0x1f4b75){if(_[_0x8f4b('0x76')](_0x1f4b75)){_0x3328ac['where']('i.FaxAccountId\x20IS\x20NULL');_0x49bab6[_0x8f4b('0x47')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x3328ac[_0x8f4b('0x47')](_0x8f4b('0x78'),_[_0x8f4b('0x34')](_0x1f4b75,'id'));_0x49bab6[_0x8f4b('0x47')](_0x8f4b('0x78'),_[_0x8f4b('0x34')](_0x1f4b75,'id'));}});})[_0x8f4b('0x2c')](function(){if(_0xd09c64[_0x8f4b('0x93')][_0x8f4b('0x96')]===_0x8f4b('0x94')&&!_0x1f0ff2&&!_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x77')])return[];return db[_0x8f4b('0x97')][_0x8f4b('0x3d')](_0x3328ac['toString'](),_0x2d2e7d);})[_0x8f4b('0x2c')](function(_0x3b2c12){_0x5cad51[_0x8f4b('0x24')]=_0x3b2c12[_0x8f4b('0x42')];if(_0x5cad51[_0x8f4b('0x24')]===0x0)return[];return db[_0x8f4b('0x97')]['query'](_0x29cc85[_0x8f4b('0x98')](),_0x2d2e7d)['then'](function(_0x36104b){_0xbf9cc9=_[_0x8f4b('0x99')](_0x36104b,'id');_0x2d2e7d=_['merge'](_0x2d2e7d,{'model':db[_0x8f4b('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd09c64[_0x8f4b('0x3d')][_0x8f4b('0x40')]){_0x10953e[_0x8f4b('0x41')][_0x8f4b('0x6f')](function(_0x1f31c4){_0x49bab6[_0x8f4b('0x4a')]('i.'+_0x1f31c4);});}else{_0x49bab6['field'](_0x8f4b('0x8e'),_0x8f4b('0x60'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0x9a'),_0x8f4b('0x9b'));_0x49bab6['field']('a.mandatoryDisposition',_0x8f4b('0x9c'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0x9d'),_0x8f4b('0x8f'));_0x49bab6['field'](_0x8f4b('0x9e'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0x9f'),_0x8f4b('0xa0'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0xa1'),_0x8f4b('0xa2'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0xa3'),_0x8f4b('0xa4'));_0x49bab6['field']('c.phone',_0x8f4b('0xa5'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0xa6'),_0x8f4b('0xa7'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0xa8'),_0x8f4b('0xa9'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0xaa'),_0x8f4b('0xab'));_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0xac'),'Owner.internal');_0x49bab6[_0x8f4b('0x4a')](_0x8f4b('0xad'),_0x8f4b('0x35'));}if(_0x10953e['limit'])_0x49bab6[_0x8f4b('0x23')](_0x10953e[_0x8f4b('0x23')]);if(_0x10953e[_0x8f4b('0x25')])_0x49bab6['offset'](_0x10953e[_0x8f4b('0x25')]);return db[_0x8f4b('0x97')]['query'](_0x49bab6['toString'](),_0x2d2e7d);})[_0x8f4b('0x2c')](function(_0x1f0530){if(_0x1f0530[_0x8f4b('0x42')]>0x0)_0x937052['where']('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x1f0530,'id'));return db['sequelize'][_0x8f4b('0x3d')](_0x937052[_0x8f4b('0x98')](),_0x2d2e7d)[_0x8f4b('0x2c')](function(_0x233be3){var _0x3bd2cb=_[_0x8f4b('0xae')](_0x233be3,_0x8f4b('0xaf'));var _0x3f976c=[];_0x1f0530[_0x8f4b('0x6f')](function(_0x1038a1){_0x3f976c[_0x8f4b('0xb0')](updateFaxInteraction(_0x1038a1,_0xbf9cc9,_0x3bd2cb));});return BPromise[_0x8f4b('0xb1')](_0x3f976c);});});})['then'](function(_0x631ef){_0x5cad51[_0x8f4b('0xb2')]=_0x631ef;return _0x5cad51;})[_0x8f4b('0x2c')](respondWithFilteredResult(_0x3b9237,_0x10953e))[_0x8f4b('0xb3')](handleError(_0x3b9237,null));};exports['show']=function(_0x436996,_0x278653){var _0x4b94af={'raw':![],'where':{'id':_0x436996[_0x8f4b('0xb4')]['id']}},_0x2834aa={};_0x2834aa[_0x8f4b('0x3b')]=_['keys'](db[_0x8f4b('0x37')][_0x8f4b('0x38')]);_0x2834aa[_0x8f4b('0x3d')]=_[_0x8f4b('0x3c')](_0x436996[_0x8f4b('0x3d')]);_0x2834aa[_0x8f4b('0x3e')]=_['intersection'](_0x2834aa[_0x8f4b('0x3b')],_0x2834aa[_0x8f4b('0x3d')]);_0x4b94af[_0x8f4b('0x41')]=_[_0x8f4b('0x3f')](_0x2834aa[_0x8f4b('0x3b')],qs[_0x8f4b('0x40')](_0x436996['query'][_0x8f4b('0x40')]));_0x4b94af[_0x8f4b('0x41')]=_0x4b94af['attributes'][_0x8f4b('0x42')]?_0x4b94af[_0x8f4b('0x41')]:_0x2834aa[_0x8f4b('0x3b')];if(_0x436996[_0x8f4b('0x3d')][_0x8f4b('0xb5')]){_0x4b94af['include']=[{'all':!![]}];}_0x4b94af=_['merge']({},_0x4b94af,_0x436996[_0x8f4b('0xb6')]);return db[_0x8f4b('0x37')]['find'](_0x4b94af)[_0x8f4b('0x2c')](handleEntityNotFound(_0x278653,null))['then'](respondWithResult(_0x278653,null))['catch'](handleError(_0x278653,null));};exports[_0x8f4b('0xb7')]=function(_0x2c7d27,_0x80ecfd){return db['FaxInteraction'][_0x8f4b('0xb7')](_0x2c7d27[_0x8f4b('0x74')],{})[_0x8f4b('0x2c')](respondWithResult(_0x80ecfd,0xc9))[_0x8f4b('0xb3')](handleError(_0x80ecfd,null));};exports[_0x8f4b('0x2b')]=function(_0x34098f,_0x15ebbb){if(_0x34098f[_0x8f4b('0x74')]['id']){delete _0x34098f[_0x8f4b('0x74')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x34098f[_0x8f4b('0xb4')]['id']}})[_0x8f4b('0x2c')](handleEntityNotFound(_0x15ebbb,null))[_0x8f4b('0x2c')](saveUpdates(_0x34098f[_0x8f4b('0x74')],null))[_0x8f4b('0x2c')](respondWithResult(_0x15ebbb,null))[_0x8f4b('0xb3')](handleError(_0x15ebbb,null));};exports[_0x8f4b('0x2d')]=function(_0x292f68,_0x53df30){return db['FaxInteraction'][_0x8f4b('0x5f')]({'where':{'id':_0x292f68['params']['id']}})[_0x8f4b('0x2c')](handleEntityNotFound(_0x53df30,null))[_0x8f4b('0x2c')](removeEntity(_0x53df30,null))['catch'](handleError(_0x53df30,null));};exports['describe']=function(_0x3f0f88,_0x174ca0){return db[_0x8f4b('0x37')][_0x8f4b('0xb8')]()[_0x8f4b('0x2c')](respondWithResult(_0x174ca0,null))[_0x8f4b('0xb3')](handleError(_0x174ca0,null));};exports[_0x8f4b('0xb9')]=function(_0x59820b,_0x447dc4,_0x39b2b2){return db['FaxMessage'][_0x8f4b('0x5f')]({'where':{'id':_0x59820b['params']['id']}})['then'](handleEntityNotFound(_0x447dc4,null))[_0x8f4b('0x2c')](function(_0x1783b5){if(_0x1783b5){return _0x1783b5[_0x8f4b('0xb9')](_0x59820b[_0x8f4b('0x74')][_0x8f4b('0xba')],_[_0x8f4b('0xbb')](_0x59820b['body'],[_0x8f4b('0xba'),'id'])||{});}})[_0x8f4b('0x2c')](respondWithResult(_0x447dc4,null))['catch'](handleError(_0x447dc4,null));};exports[_0x8f4b('0xbc')]=function(_0x47a9bd,_0x1a655c,_0x12685b){var _0x4fe65a={'raw':![],'where':{}};var _0x1ddd2b={};var _0x30c92a={'count':0x0,'rows':[]};return db[_0x8f4b('0x37')][_0x8f4b('0xbd')]({'where':{'id':_0x47a9bd[_0x8f4b('0xb4')]['id']}})[_0x8f4b('0x2c')](handleEntityNotFound(_0x1a655c,null))[_0x8f4b('0x2c')](function(_0x24391c){if(_0x24391c){_0x1ddd2b['model']=_[_0x8f4b('0x3c')](db['FaxMessage'][_0x8f4b('0x38')]);_0x1ddd2b[_0x8f4b('0x3d')]=_[_0x8f4b('0x3c')](_0x47a9bd[_0x8f4b('0x3d')]);_0x1ddd2b['filters']=_[_0x8f4b('0x3f')](_0x1ddd2b[_0x8f4b('0x3b')],_0x1ddd2b[_0x8f4b('0x3d')]);_0x4fe65a[_0x8f4b('0x41')]=_[_0x8f4b('0x3f')](_0x1ddd2b['model'],qs[_0x8f4b('0x40')](_0x47a9bd[_0x8f4b('0x3d')][_0x8f4b('0x40')]));_0x4fe65a[_0x8f4b('0x41')]=_0x4fe65a[_0x8f4b('0x41')]['length']?_0x4fe65a['attributes']:_0x1ddd2b[_0x8f4b('0x3b')];if(!_0x47a9bd[_0x8f4b('0x3d')][_0x8f4b('0x43')](_0x8f4b('0x44'))){_0x4fe65a[_0x8f4b('0x23')]=qs[_0x8f4b('0x23')](_0x47a9bd[_0x8f4b('0x3d')]['limit']);_0x4fe65a['offset']=qs[_0x8f4b('0x25')](_0x47a9bd[_0x8f4b('0x3d')][_0x8f4b('0x25')]);}_0x4fe65a['order']=qs[_0x8f4b('0x46')](_0x47a9bd[_0x8f4b('0x3d')][_0x8f4b('0x46')]);_0x4fe65a[_0x8f4b('0x47')]=qs['filters'](_[_0x8f4b('0x48')](_0x47a9bd[_0x8f4b('0x3d')],_0x1ddd2b[_0x8f4b('0x3e')]));_0x4fe65a[_0x8f4b('0x47')][_0x8f4b('0xaf')]=_0x24391c['id'];if(_0x47a9bd[_0x8f4b('0x3d')][_0x8f4b('0xbe')]){_0x4fe65a[_0x8f4b('0x47')]=_[_0x8f4b('0xbf')](_0x4fe65a[_0x8f4b('0x47')],{'$or':_[_0x8f4b('0x34')](_0x4fe65a['attributes'],function(_0x57dc1b){var _0xe4b5a1={};_0xe4b5a1[_0x57dc1b]={'$like':'%'+_0x47a9bd[_0x8f4b('0x3d')]['filter']+'%'};return _0xe4b5a1;})});}if(_0x47a9bd[_0x8f4b('0x3d')][_0x8f4b('0x7b')]){var _0x7b3b9e=_0x47a9bd[_0x8f4b('0x3d')][_0x8f4b('0x7b')][_0x8f4b('0xc0')](',');var _0x5a47a7={};_0x5a47a7[_0x7b3b9e[0x0]]={'$gte':moment(_0x7b3b9e[0x1])['format'](_0x8f4b('0xc1'))};_0x4fe65a[_0x8f4b('0x47')]=_[_0x8f4b('0xbf')](_0x4fe65a['where'],_0x5a47a7);}_0x4fe65a=_[_0x8f4b('0xbf')]({},_0x4fe65a,_0x47a9bd[_0x8f4b('0xb6')]);return db[_0x8f4b('0xc2')][_0x8f4b('0x24')]({'where':_0x4fe65a['where']})[_0x8f4b('0x2c')](function(_0x4f9e3c){_0x30c92a[_0x8f4b('0x24')]=_0x4f9e3c;if(_0x47a9bd['query'][_0x8f4b('0xb5')]){_0x4fe65a[_0x8f4b('0xc3')]=[{'all':!![]}];}return db[_0x8f4b('0xc2')][_0x8f4b('0xc4')](_0x4fe65a);})[_0x8f4b('0x2c')](function(_0x42333b){_0x30c92a[_0x8f4b('0xb2')]=_0x42333b;return _0x30c92a;});}})[_0x8f4b('0x2c')](respondWithFilteredResult(_0x1a655c,_0x4fe65a))['catch'](handleError(_0x1a655c,null));};exports[_0x8f4b('0xc5')]=function(_0xc3c85b,_0x2542fc,_0x3b4c53){return db[_0x8f4b('0x37')][_0x8f4b('0x5f')]({'where':{'id':_0xc3c85b[_0x8f4b('0xb4')]['id']}})[_0x8f4b('0x2c')](handleEntityNotFound(_0x2542fc,null))[_0x8f4b('0x2c')](function(_0x31a825){if(_0x31a825){return _0x31a825[_0x8f4b('0xc6')](_0xc3c85b[_0x8f4b('0x74')][_0x8f4b('0xba')],_[_0x8f4b('0xbb')](_0xc3c85b[_0x8f4b('0x74')],[_0x8f4b('0xba'),'id'])||{})[_0x8f4b('0xc7')](function(){return db[_0x8f4b('0x6e')][_0x8f4b('0xc4')]({'attributes':['id',_0x8f4b('0x31'),_0x8f4b('0x4b')],'where':{'id':_0xc3c85b[_0x8f4b('0x74')][_0x8f4b('0xba')]}});})[_0x8f4b('0x2c')](function(_0x270ee3){socket[_0x8f4b('0xc8')](_0x8f4b('0xc9'),{'id':Number(_0xc3c85b[_0x8f4b('0xb4')]['id']),'tags':_0x270ee3||[]});return{'id':Number(_0xc3c85b[_0x8f4b('0xb4')]['id']),'tags':_0x270ee3||[]};});}})[_0x8f4b('0x2c')](respondWithResult(_0x2542fc,null))[_0x8f4b('0xb3')](handleError(_0x2542fc,null));};exports['removeTags']=function(_0x32df51,_0x3578e9,_0x45b0e7){return db['FaxInteraction'][_0x8f4b('0x5f')]({'where':{'id':_0x32df51['params']['id']}})[_0x8f4b('0x2c')](handleEntityNotFound(_0x3578e9,null))[_0x8f4b('0x2c')](function(_0x2396df){if(_0x2396df){return _0x2396df['removeTags'](_0x32df51[_0x8f4b('0x3d')][_0x8f4b('0xba')]);}})[_0x8f4b('0x2c')](respondWithStatusCode(_0x3578e9,null))[_0x8f4b('0xb3')](handleError(_0x3578e9,null));};exports[_0x8f4b('0xca')]=function(_0x2570fe,_0x29d023){var _0x2c3b3c=moment()[_0x8f4b('0xcb')]()[_0x8f4b('0x98')]();var _0x340115=path[_0x8f4b('0xcc')](config[_0x8f4b('0xcd')],_0x8f4b('0xce'),_0x8f4b('0xcf'),_0x8f4b('0xd0'));var _0x25bc3a=path[_0x8f4b('0xcc')](config['root'],_0x8f4b('0xce'),_0x8f4b('0xcf'),'attachments');var _0x41668f=path['join'](_0x340115,_0x2c3b3c);var _0x1eb789=util[_0x8f4b('0xd1')](_0x8f4b('0xd2'),_0x2570fe['params']['id'],_0x2c3b3c);var _0x4cda52=path['join'](_0x340115,_0x1eb789);var _0x3d2409=[];_0x3d2409[_0x8f4b('0xb0')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x2d86ed=[{'model':db[_0x8f4b('0xc2')],'as':_0x8f4b('0xd3'),'attributes':['id','body',_0x8f4b('0x79')],'include':_0x3d2409}];return db[_0x8f4b('0x37')][_0x8f4b('0x5f')]({'where':{'id':_0x2570fe[_0x8f4b('0xb4')]['id']},'include':_0x2d86ed})['then'](handleEntityNotFound(_0x29d023,null))[_0x8f4b('0x2c')](function(_0x59e73f){if(_0x59e73f&&_0x59e73f[_0x8f4b('0xd3')]){var _0x5c3a32=_0x59e73f[_0x8f4b('0xd4')]({'plain':!![]});fs[_0x8f4b('0xd5')](_0x41668f);for(var _0x272d39=0x0;_0x272d39<_0x5c3a32[_0x8f4b('0xd3')][_0x8f4b('0x42')];_0x272d39++){var _0x4948f1=_0x5c3a32[_0x8f4b('0xd3')][_0x272d39][_0x8f4b('0xd6')];if(_0x4948f1){var _0x3a9aab=path['join'](_0x25bc3a,_0x4948f1[_0x8f4b('0xd7')]);if(fs[_0x8f4b('0xd8')](_0x3a9aab)){fs['createReadStream'](_0x3a9aab)['pipe'](fs[_0x8f4b('0xd9')](path['join'](_0x41668f,_0x4948f1['basename'])));}}}return BPromise[_0x8f4b('0xda')]()[_0x8f4b('0x2c')](function(){return new BPromise(function(_0x189c04,_0x1aee39){zipdir(_0x41668f,{'saveTo':_0x4cda52},function(_0x20c1b1,_0x1a0bd2){if(_0x20c1b1)return _0x1aee39(_0x20c1b1);return _0x189c04(_0x1a0bd2);});})[_0x8f4b('0x2c')](function(){return new BPromise(function(_0x4cc8c8,_0x4e64ed){rimraf(_0x41668f,function(_0x1d6c65){if(_0x1d6c65)_0x4e64ed(_0x1d6c65);return _0x4cc8c8();});});})[_0x8f4b('0x2c')](function(){return _0x29d023[_0x8f4b('0xca')](_0x4cda52,_0x1eb789,function(_0x1acf2e){if(_0x1acf2e){console['log'](_0x8f4b('0xdb'),_0x1acf2e);}else{fs[_0x8f4b('0xdc')](_0x4cda52);}});});});}else{return _0x29d023[_0x8f4b('0x2e')](0xc8);}})['catch'](handleError(_0x29d023,null));}; \ No newline at end of file +var _0x1179=['Contact.lastName','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','params','includeAll','include','create','describe','addMessage','FaxMessage','ids','omit','getMessages','rawAttributes','pick','format','addTags','setTags','spread','emit','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','log','err','unlinkSync','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','set','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','length','find','unreadMessages','having','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','keys','some','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1179,0x106));var _0x9117=function(_0x3cbbe7,_0x3a1d33){_0x3cbbe7=_0x3cbbe7-0x0;var _0x39cfa2=_0x1179[_0x3cbbe7];return _0x39cfa2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9117('0x0'));var jsonpatch=require(_0x9117('0x1'));var rp=require('request-promise');var moment=require(_0x9117('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9117('0x3'));var util=require(_0x9117('0x4'));var path=require(_0x9117('0x5'));var sox=require(_0x9117('0x6'));var csv=require(_0x9117('0x7'));var ejs=require(_0x9117('0x8'));var fs=require('fs');var fs_extra=require(_0x9117('0x9'));var _=require(_0x9117('0xa'));var squel=require(_0x9117('0xb'));var crypto=require(_0x9117('0xc'));var jsforce=require(_0x9117('0xd'));var deskjs=require(_0x9117('0xe'));var toCsv=require(_0x9117('0x7'));var querystring=require(_0x9117('0xf'));var Papa=require(_0x9117('0x10'));var Redis=require('ioredis');var authService=require(_0x9117('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9117('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9117('0x13'))(_0x9117('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9117('0x15'));var db=require(_0x9117('0x16'))['db'];config['redis']=_[_0x9117('0x17')](config[_0x9117('0x18')],{'host':_0x9117('0x19'),'port':0x18eb});var socket=require(_0x9117('0x1a'))(new Redis(config[_0x9117('0x18')]));require(_0x9117('0x1b'))['register'](socket);function respondWithStatusCode(_0x3b4ed1,_0x2191bf){_0x2191bf=_0x2191bf||0xcc;return function(_0x4e001d){if(_0x4e001d){return _0x3b4ed1[_0x9117('0x1c')](_0x2191bf);}return _0x3b4ed1[_0x9117('0x1d')](_0x2191bf)['end']();};}function respondWithResult(_0x1f7214,_0x506326){_0x506326=_0x506326||0xc8;return function(_0x5b9e71){if(_0x5b9e71){return _0x1f7214[_0x9117('0x1d')](_0x506326)[_0x9117('0x1e')](_0x5b9e71);}};}function respondWithFilteredResult(_0x33cbc1,_0x5aa61c){return function(_0x1de691){if(_0x1de691){var _0x4d572e=typeof _0x5aa61c[_0x9117('0x1f')]===_0x9117('0x20')&&typeof _0x5aa61c['limit']===_0x9117('0x20');var _0x68f2d5=_0x1de691[_0x9117('0x21')];var _0x18943a=_0x4d572e?0x0:_0x5aa61c[_0x9117('0x1f')];var _0x1b50c4=_0x4d572e?_0x1de691[_0x9117('0x21')]:_0x5aa61c[_0x9117('0x1f')]+_0x5aa61c[_0x9117('0x22')];var _0x3cbb91;if(_0x1b50c4>=_0x68f2d5){_0x1b50c4=_0x68f2d5;_0x3cbb91=0xc8;}else{_0x3cbb91=0xce;}_0x33cbc1[_0x9117('0x1d')](_0x3cbb91);return _0x33cbc1[_0x9117('0x23')]('Content-Range',_0x18943a+'-'+_0x1b50c4+'/'+_0x68f2d5)[_0x9117('0x1e')](_0x1de691);}return null;};}function patchUpdates(_0xd8651f){return function(_0x474a04){try{jsonpatch['apply'](_0x474a04,_0xd8651f,!![]);}catch(_0x4a9ad1){return BPromise['reject'](_0x4a9ad1);}return _0x474a04['save']();};}function saveUpdates(_0x34e602,_0x4a047e){return function(_0x5b7102){if(_0x5b7102){return _0x5b7102[_0x9117('0x24')](_0x34e602)[_0x9117('0x25')](function(_0x39ec5){return _0x39ec5;});}return null;};}function removeEntity(_0x114428,_0x177d96){return function(_0x29f3ae){if(_0x29f3ae){return _0x29f3ae[_0x9117('0x26')]()[_0x9117('0x25')](function(){_0x114428[_0x9117('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b5d9,_0x141b8e){return function(_0x71638c){if(!_0x71638c){_0x36b5d9[_0x9117('0x1c')](0x194);}return _0x71638c;};}function handleError(_0x275acc,_0x4570ad){_0x4570ad=_0x4570ad||0x1f4;return function(_0x4f1f49){logger[_0x9117('0x27')](_0x4f1f49[_0x9117('0x28')]);if(_0x4f1f49['name']){delete _0x4f1f49[_0x9117('0x29')];}_0x275acc[_0x9117('0x1d')](_0x4570ad)[_0x9117('0x2a')](_0x4f1f49);};}function getInteractionUsers(_0xc804ef,_0x13c223){return new BPromise(function(_0x5748de,_0x58623d){try{if(_0x13c223[_0xc804ef['id']]){_0xc804ef[_0x9117('0x2b')]=_[_0x9117('0x2c')](_0x13c223[_0xc804ef['id']],function(_0x40fdf1){return{'id':_0x40fdf1['id'],'fullname':_0x40fdf1[_0x9117('0x2d')]};});}}catch(_0x4cdfaf){_0x58623d(_0x4cdfaf);}_0x5748de(_0xc804ef);});}function getInteractionTags(_0x53730d,_0x2ee0a7){return new BPromise(function(_0x4ebbb5,_0x54295a){try{if(_0x53730d[_0x9117('0x2e')]){_0x53730d[_0x9117('0x2f')]=[];_0x53730d['TagIds'][_0x9117('0x30')](',')[_0x9117('0x31')](function(_0x5b4c0c){_0x53730d[_0x9117('0x2f')][_0x9117('0x32')](_0x2ee0a7[_0x5b4c0c]);});}delete _0x53730d[_0x9117('0x2e')];}catch(_0x5859fa){_0x54295a(_0x5859fa);}_0x4ebbb5(_0x53730d);});}function updateFaxInteraction(_0x1d1f06,_0x1f7f5f,_0x492d1b){return new BPromise(function(_0x5002cd,_0x5227d1){return getInteractionUsers(_0x1d1f06,_0x492d1b)[_0x9117('0x25')](function(_0x2c32b1){return getInteractionTags(_0x2c32b1,_0x1f7f5f);})[_0x9117('0x25')](function(_0x50f015){_0x5002cd(_0x50f015);})[_0x9117('0x33')](function(_0x378b61){_0x5227d1(_0x378b61);});});}exports[_0x9117('0x34')]=function(_0x2f8680,_0x490b53){var _0x351cbc={},_0x26c089={},_0x234220={'count':0x0,'rows':[]};var _0xf869b6=_['map'](db[_0x9117('0x35')]['rawAttributes'],function(_0x5aaddf){return{'name':_0x5aaddf[_0x9117('0x36')],'type':_0x5aaddf[_0x9117('0x37')][_0x9117('0x38')]};});_0x26c089[_0x9117('0x39')]=_[_0x9117('0x2c')](_0xf869b6,'name');_0x26c089[_0x9117('0x3a')]=_['keys'](_0x2f8680[_0x9117('0x3a')]);_0x26c089[_0x9117('0x3b')]=_['intersection'](_0x26c089[_0x9117('0x39')],_0x26c089['query']);_0x351cbc[_0x9117('0x3c')]=_[_0x9117('0x3d')](_0x26c089[_0x9117('0x39')],qs['fields'](_0x2f8680[_0x9117('0x3a')][_0x9117('0x3e')]));_0x351cbc[_0x9117('0x3c')]=_0x351cbc[_0x9117('0x3c')]['length']?_0x351cbc[_0x9117('0x3c')]:_0x26c089[_0x9117('0x39')];if(!_0x2f8680[_0x9117('0x3a')][_0x9117('0x3f')]('nolimit')){_0x351cbc[_0x9117('0x22')]=qs[_0x9117('0x22')](_0x2f8680['query'][_0x9117('0x22')]);_0x351cbc[_0x9117('0x1f')]=qs[_0x9117('0x1f')](_0x2f8680['query'][_0x9117('0x1f')]);}_0x351cbc[_0x9117('0x40')]=qs[_0x9117('0x41')](_0x2f8680['query'][_0x9117('0x41')]);_0x351cbc[_0x9117('0x42')]=qs[_0x9117('0x3b')](_['pick'](_0x2f8680[_0x9117('0x3a')],_0x26c089[_0x9117('0x3b')]),_0xf869b6);var _0x14aaaf=[];var _0x4eb51d=squel[_0x9117('0x43')]()[_0x9117('0x44')]('id')[_0x9117('0x44')](_0x9117('0x29'))[_0x9117('0x44')](_0x9117('0x45'))[_0x9117('0x46')](_0x9117('0x47'));var _0x2022f0=squel[_0x9117('0x43')]()['field'](_0x9117('0x48'))['field'](_0x9117('0x49'))[_0x9117('0x44')]('ui.FaxInteractionId')[_0x9117('0x46')](_0x9117('0x4a'),'ui')[_0x9117('0x4b')]('users','u',_0x9117('0x4c'));var _0x222fd5=squel[_0x9117('0x43')]()[_0x9117('0x46')](_0x9117('0x4d'),'i')[_0x9117('0x4b')](_0x9117('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x9117('0x4f'),'o',_0x9117('0x50'))[_0x9117('0x4b')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')[_0x9117('0x4b')](_0x9117('0x51'),'me',_0x9117('0x52'))['left_join'](_0x9117('0x53'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x9117('0x4b')](_0x9117('0x47'),'t',_0x9117('0x54'));var _0x40ab2c=squel['expr']();var _0x214528=[];var _0x4bd9e0=squel[_0x9117('0x55')]();var _0x1932b1;if(_0x2f8680[_0x9117('0x3a')][_0x9117('0x56')]){_0x1932b1=as['parseSearch'](_0x2f8680['query']['search']);var _0x341824=_0x1932b1['sqlOperator'];for(var _0x1b949=0x0;_0x1b949<_0x1932b1[_0x9117('0x57')][_0x9117('0x58')];_0x1b949++){var _0x4a987c=_0x1932b1[_0x9117('0x57')][_0x1b949];var _0x3e67db='i';var _0x1f01b7=_[_0x9117('0x59')](_0xf869b6,['name',_0x4a987c['field']]);if(!_0x1f01b7){switch(_0x4a987c['field']){case _0x9117('0x5a'):if(_0x4a987c['value']==0x1){_0x222fd5[_0x9117('0x5b')]('`'+_0x4a987c[_0x9117('0x44')]+'`\x20=\x200');}else{_0x222fd5['having']('`'+_0x4a987c['field']+'`\x20>\x200');}break;case _0x9117('0x5c'):if(_0x4a987c[_0x9117('0x5d')]===_0x9117('0x5e')){if(_0x4a987c['value']['split']('\x20')['length']>0x1){_0x40ab2c[_0x341824]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4a987c[_0x9117('0x5f')]),null);}else{var _0xebd2db='%'+_0x4a987c[_0x9117('0x5f')]+'%';_0x40ab2c[_0x341824](_0x9117('0x60'),_0xebd2db,_0xebd2db,_0xebd2db);}}else{_0x1f01b7=_['find'](_0xf869b6,[_0x9117('0x29'),_0x9117('0x61')]);_0x4a987c['field']=_0x9117('0x61');_0x4e3c18=as['buildExpression'](_0x3e67db,_0x1f01b7[_0x9117('0x37')],_0x4a987c);_0x40ab2c[_0x341824](_0x4e3c18[_0x9117('0x62')],_0x4e3c18[_0x9117('0x5f')]['start'],_0x4e3c18['value'][_0x9117('0x63')]);}break;case _0x9117('0x64'):var _0xcbc6b1=_0x4a987c['value'][_0x9117('0x30')](',')['map'](function(_0x2eba92){return Number(_0x2eba92);});_0xcbc6b1[_0x9117('0x31')](function(_0x3fb7b3){_0x4bd9e0['or'](_0x9117('0x65'),'%,'+_0x3fb7b3+',%');});_0x214528=_[_0x9117('0x66')](_0x214528,_0xcbc6b1);break;case'User':if(_0x4a987c[_0x9117('0x5d')]==='$substring'){_0x40ab2c[_0x341824]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4a987c[_0x9117('0x5f')]+'%',null);}else{_0x1f01b7=_['find'](_0xf869b6,['name',_0x9117('0x67')]);_0x4a987c['field']='UserId';_0x4e3c18=as[_0x9117('0x68')](_0x3e67db,_0x1f01b7['type'],_0x4a987c);_0x40ab2c[_0x341824](_0x4e3c18[_0x9117('0x62')],_0x4e3c18[_0x9117('0x5f')][_0x9117('0x69')],_0x4e3c18[_0x9117('0x5f')][_0x9117('0x63')]);}break;case _0x9117('0x6a'):_0x4e3c18=as[_0x9117('0x68')]('me',null,_0x4a987c);_0x40ab2c[_0x341824](_0x4e3c18['text'],_0x4e3c18[_0x9117('0x5f')][_0x9117('0x69')],_0x4e3c18['value'][_0x9117('0x63')]);break;}}else{var _0x4e3c18=as[_0x9117('0x68')](_0x3e67db,_0x1f01b7['type'],_0x4a987c);_0x40ab2c[_0x341824](_0x4e3c18[_0x9117('0x62')],_0x4e3c18[_0x9117('0x5f')]['start'],_0x4e3c18[_0x9117('0x5f')][_0x9117('0x63')]);}}}else{var _0x32ec1a=_(_0x2f8680[_0x9117('0x3a')])[_0x9117('0x6b')]()[_0x9117('0x2c')](function(_0x27a6d0){return _[_0x9117('0x6c')](_0xf869b6,['name',_0x27a6d0])?_0x27a6d0:undefined;})['compact']()[_0x9117('0x5f')]();if(!_['isEmpty'](_0x32ec1a)){_0x32ec1a['forEach'](function(_0x41f71a){if(_0x41f71a===_0x9117('0x6d')){_0x222fd5['where'](_0x9117('0x6e'),[][_0x9117('0x6f')](_0x2f8680[_0x9117('0x3a')][_0x41f71a]));}else if(_0x41f71a===_0x9117('0x70')){var _0x50dd32=JSON[_0x9117('0x71')](_0x2f8680[_0x9117('0x3a')][_0x41f71a])[_0x9117('0x72')];var _0x3c90d1=JSON['parse'](_0x2f8680[_0x9117('0x3a')][_0x41f71a])[_0x9117('0x73')];_0x222fd5[_0x9117('0x42')](_0x9117('0x74'),_0x50dd32,_0x3c90d1);}else{if(_0x2f8680[_0x9117('0x3a')][_0x41f71a]==='null'){_0x222fd5['where']('i.'+_0x41f71a+_0x9117('0x75'));}else{_0x222fd5['where']('i.'+_0x41f71a+_0x9117('0x76'),_0x2f8680[_0x9117('0x3a')][_0x41f71a]);}}});}if(_0x2f8680[_0x9117('0x3a')][_0x9117('0x77')]){if(_0x2f8680['query'][_0x9117('0x77')]==0x1){_0x222fd5[_0x9117('0x5b')](_0x9117('0x78'));}else{_0x222fd5[_0x9117('0x5b')](_0x9117('0x79'));}}if(_0x2f8680[_0x9117('0x3a')][_0x9117('0x7a')]){_0x214528=_[_0x9117('0x7b')](_0x2f8680[_0x9117('0x3a')][_0x9117('0x7a')])?_0x2f8680[_0x9117('0x3a')]['tag']:new Array(_0x2f8680[_0x9117('0x3a')][_0x9117('0x7a')]);_0x214528[_0x9117('0x31')](function(_0x264eeb){_0x4bd9e0['or'](_0x9117('0x65'),'%,'+_0x264eeb+',%');});}if(_0x2f8680[_0x9117('0x3a')]['filter']){var _0x19ea37=_0x2f8680[_0x9117('0x3a')][_0x9117('0x7c')][_0x9117('0x7d')]('\x5c','\x5c\x5c')[_0x9117('0x7d')](/'/g,'\x27\x27');if(qs[_0x9117('0x7e')](_0x19ea37)){_0x40ab2c['or'](_0x9117('0x7f'),_0x19ea37+'%')['or'](_0x9117('0x80'),_0x19ea37+'%');}_0x40ab2c['or'](_0x9117('0x81'),_0x19ea37+'%');}}_0x222fd5['where'](_0x40ab2c);_0x222fd5[_0x9117('0x82')](_0x9117('0x83'));var _0x463948={'type':db[_0x9117('0x84')]['QueryTypes']['SELECT'],'raw':!![]};var _0x34b28f=_0x222fd5[_0x9117('0x85')]();_0x34b28f[_0x9117('0x44')]('i.id');_0x34b28f[_0x9117('0x44')](_0x9117('0x86'),_0x9117('0x5a'));if(_0x351cbc[_0x9117('0x40')]){_0x351cbc[_0x9117('0x40')]['forEach'](function(_0x5595dc){var _0x58f246=_0x5595dc[0x0]===_0x9117('0x87')?_0x5595dc[0x0]:'i.'+_0x5595dc[0x0];_0x222fd5[_0x9117('0x40')](_0x58f246,_0x5595dc[0x1]===_0x9117('0x88')?![]:!![]);});}if(!_[_0x9117('0x89')](_0x214528)){_0x222fd5['having'](_0x4bd9e0);_0x34b28f[_0x9117('0x42')](_0x9117('0x8a'),_0x214528);}BPromise[_0x9117('0x8b')]()[_0x9117('0x25')](function(){if(!_0x1932b1){if(_0x2f8680[_0x9117('0x3a')][_0x9117('0x6d')])return;_0x34b28f['where'](_0x9117('0x8c'));_0x222fd5[_0x9117('0x42')](_0x9117('0x8c'));return;}if(_0x2f8680['user'][_0x9117('0x8d')]!==_0x9117('0x8e'))return;return _0x2f8680['user'][_0x9117('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10fc38){if(_['isEmpty'](_0x10fc38)){_0x34b28f[_0x9117('0x42')](_0x9117('0x90'));_0x222fd5[_0x9117('0x42')](_0x9117('0x90'));}else{_0x34b28f[_0x9117('0x42')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x10fc38,'id'));_0x222fd5['where'](_0x9117('0x6e'),_['map'](_0x10fc38,'id'));}});})[_0x9117('0x25')](function(){if(_0x2f8680[_0x9117('0x91')]['role']==='agent'&&!_0x1932b1&&!_0x2f8680['query'][_0x9117('0x6d')])return[];return db[_0x9117('0x92')][_0x9117('0x3a')](_0x34b28f[_0x9117('0x93')](),_0x463948);})[_0x9117('0x25')](function(_0x5934ed){_0x234220['count']=_0x5934ed['length'];if(_0x234220[_0x9117('0x21')]===0x0)return[];return db[_0x9117('0x92')][_0x9117('0x3a')](_0x4eb51d[_0x9117('0x93')](),_0x463948)[_0x9117('0x25')](function(_0x4dd169){_0x14aaaf=_['keyBy'](_0x4dd169,'id');_0x463948=_[_0x9117('0x94')](_0x463948,{'model':db[_0x9117('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f8680['query'][_0x9117('0x3e')]){_0x351cbc[_0x9117('0x3c')]['forEach'](function(_0x10e8eb){_0x222fd5[_0x9117('0x44')]('i.'+_0x10e8eb);});}else{_0x222fd5['field'](_0x9117('0x86'),'unreadMessages');_0x222fd5['field'](_0x9117('0x95'),_0x9117('0x96'));_0x222fd5['field'](_0x9117('0x97'),_0x9117('0x98'));_0x222fd5[_0x9117('0x44')](_0x9117('0x99'),_0x9117('0x87'));_0x222fd5[_0x9117('0x44')](_0x9117('0x9a'));_0x222fd5[_0x9117('0x44')](_0x9117('0x9b'),_0x9117('0x9c'));_0x222fd5['field'](_0x9117('0x9d'),_0x9117('0x9e'));_0x222fd5['field']('c.email',_0x9117('0x9f'));_0x222fd5[_0x9117('0x44')](_0x9117('0xa0'),_0x9117('0xa1'));_0x222fd5[_0x9117('0x44')]('c.mobile','Contact.mobile');_0x222fd5[_0x9117('0x44')](_0x9117('0xa2'),_0x9117('0xa3'));_0x222fd5[_0x9117('0x44')](_0x9117('0xa4'),_0x9117('0xa5'));_0x222fd5['field'](_0x9117('0xa6'),'Owner.internal');_0x222fd5[_0x9117('0x44')](_0x9117('0xa7'),'TagIds');}if(_0x351cbc[_0x9117('0x22')])_0x222fd5[_0x9117('0x22')](_0x351cbc['limit']);if(_0x351cbc[_0x9117('0x1f')])_0x222fd5['offset'](_0x351cbc[_0x9117('0x1f')]);return db['sequelize'][_0x9117('0x3a')](_0x222fd5[_0x9117('0x93')](),_0x463948);})['then'](function(_0x1dc638){if(_0x1dc638[_0x9117('0x58')]>0x0)_0x2022f0[_0x9117('0x42')](_0x9117('0xa8'),_[_0x9117('0x2c')](_0x1dc638,'id'));return db['sequelize'][_0x9117('0x3a')](_0x2022f0[_0x9117('0x93')](),_0x463948)[_0x9117('0x25')](function(_0x2996cf){var _0x5f141f=_[_0x9117('0xa9')](_0x2996cf,_0x9117('0xaa'));var _0x39dadf=[];_0x1dc638[_0x9117('0x31')](function(_0x2cdd5c){_0x39dadf[_0x9117('0x32')](updateFaxInteraction(_0x2cdd5c,_0x14aaaf,_0x5f141f));});return BPromise['all'](_0x39dadf);});});})[_0x9117('0x25')](function(_0x3125e0){_0x234220[_0x9117('0xab')]=_0x3125e0;return _0x234220;})[_0x9117('0x25')](respondWithFilteredResult(_0x490b53,_0x351cbc))[_0x9117('0x33')](handleError(_0x490b53,null));};exports[_0x9117('0xac')]=function(_0x28ead4,_0x4a0e57){var _0x9ffda4={'raw':![],'where':{'id':_0x28ead4[_0x9117('0xad')]['id']}},_0x4befcc={};_0x4befcc['model']=_[_0x9117('0x6b')](db[_0x9117('0x35')]['rawAttributes']);_0x4befcc[_0x9117('0x3a')]=_[_0x9117('0x6b')](_0x28ead4[_0x9117('0x3a')]);_0x4befcc[_0x9117('0x3b')]=_[_0x9117('0x3d')](_0x4befcc[_0x9117('0x39')],_0x4befcc[_0x9117('0x3a')]);_0x9ffda4[_0x9117('0x3c')]=_[_0x9117('0x3d')](_0x4befcc[_0x9117('0x39')],qs[_0x9117('0x3e')](_0x28ead4[_0x9117('0x3a')][_0x9117('0x3e')]));_0x9ffda4[_0x9117('0x3c')]=_0x9ffda4[_0x9117('0x3c')][_0x9117('0x58')]?_0x9ffda4['attributes']:_0x4befcc[_0x9117('0x39')];if(_0x28ead4[_0x9117('0x3a')][_0x9117('0xae')]){_0x9ffda4[_0x9117('0xaf')]=[{'all':!![]}];}_0x9ffda4=_[_0x9117('0x94')]({},_0x9ffda4,_0x28ead4['options']);return db['FaxInteraction'][_0x9117('0x59')](_0x9ffda4)[_0x9117('0x25')](handleEntityNotFound(_0x4a0e57,null))[_0x9117('0x25')](respondWithResult(_0x4a0e57,null))['catch'](handleError(_0x4a0e57,null));};exports['create']=function(_0x2a1894,_0x142f5f){return db['FaxInteraction'][_0x9117('0xb0')](_0x2a1894['body'],{})[_0x9117('0x25')](respondWithResult(_0x142f5f,0xc9))[_0x9117('0x33')](handleError(_0x142f5f,null));};exports[_0x9117('0x24')]=function(_0x5c7434,_0x59bbb3){if(_0x5c7434['body']['id']){delete _0x5c7434[_0x9117('0x6a')]['id'];}return db['FaxInteraction'][_0x9117('0x59')]({'where':{'id':_0x5c7434[_0x9117('0xad')]['id']}})[_0x9117('0x25')](handleEntityNotFound(_0x59bbb3,null))['then'](saveUpdates(_0x5c7434[_0x9117('0x6a')],null))[_0x9117('0x25')](respondWithResult(_0x59bbb3,null))['catch'](handleError(_0x59bbb3,null));};exports[_0x9117('0x26')]=function(_0x1a2a05,_0x538af3){return db['FaxInteraction'][_0x9117('0x59')]({'where':{'id':_0x1a2a05[_0x9117('0xad')]['id']}})['then'](handleEntityNotFound(_0x538af3,null))['then'](removeEntity(_0x538af3,null))[_0x9117('0x33')](handleError(_0x538af3,null));};exports['describe']=function(_0x4177e6,_0x340e38){return db[_0x9117('0x35')][_0x9117('0xb1')]()[_0x9117('0x25')](respondWithResult(_0x340e38,null))[_0x9117('0x33')](handleError(_0x340e38,null));};exports[_0x9117('0xb2')]=function(_0x571af0,_0x264792,_0x588d9a){return db[_0x9117('0xb3')][_0x9117('0x59')]({'where':{'id':_0x571af0[_0x9117('0xad')]['id']}})[_0x9117('0x25')](handleEntityNotFound(_0x264792,null))[_0x9117('0x25')](function(_0x30db24){if(_0x30db24){return _0x30db24['addMessage'](_0x571af0['body'][_0x9117('0xb4')],_[_0x9117('0xb5')](_0x571af0[_0x9117('0x6a')],[_0x9117('0xb4'),'id'])||{});}})[_0x9117('0x25')](respondWithResult(_0x264792,null))[_0x9117('0x33')](handleError(_0x264792,null));};exports[_0x9117('0xb6')]=function(_0x4f8870,_0xefd4ee,_0x307957){var _0x8cdfd0={'raw':![],'where':{}};var _0x368a96={};var _0x7bf9e0={'count':0x0,'rows':[]};return db[_0x9117('0x35')]['findOne']({'where':{'id':_0x4f8870['params']['id']}})[_0x9117('0x25')](handleEntityNotFound(_0xefd4ee,null))[_0x9117('0x25')](function(_0x33d950){if(_0x33d950){_0x368a96[_0x9117('0x39')]=_[_0x9117('0x6b')](db['FaxMessage'][_0x9117('0xb7')]);_0x368a96[_0x9117('0x3a')]=_[_0x9117('0x6b')](_0x4f8870['query']);_0x368a96[_0x9117('0x3b')]=_[_0x9117('0x3d')](_0x368a96[_0x9117('0x39')],_0x368a96['query']);_0x8cdfd0[_0x9117('0x3c')]=_[_0x9117('0x3d')](_0x368a96[_0x9117('0x39')],qs[_0x9117('0x3e')](_0x4f8870[_0x9117('0x3a')][_0x9117('0x3e')]));_0x8cdfd0['attributes']=_0x8cdfd0['attributes'][_0x9117('0x58')]?_0x8cdfd0[_0x9117('0x3c')]:_0x368a96['model'];if(!_0x4f8870[_0x9117('0x3a')]['hasOwnProperty']('nolimit')){_0x8cdfd0['limit']=qs[_0x9117('0x22')](_0x4f8870['query'][_0x9117('0x22')]);_0x8cdfd0[_0x9117('0x1f')]=qs[_0x9117('0x1f')](_0x4f8870['query'][_0x9117('0x1f')]);}_0x8cdfd0[_0x9117('0x40')]=qs[_0x9117('0x41')](_0x4f8870[_0x9117('0x3a')][_0x9117('0x41')]);_0x8cdfd0['where']=qs['filters'](_[_0x9117('0xb8')](_0x4f8870[_0x9117('0x3a')],_0x368a96[_0x9117('0x3b')]));_0x8cdfd0['where'][_0x9117('0xaa')]=_0x33d950['id'];if(_0x4f8870[_0x9117('0x3a')][_0x9117('0x7c')]){_0x8cdfd0[_0x9117('0x42')]=_[_0x9117('0x94')](_0x8cdfd0[_0x9117('0x42')],{'$or':_[_0x9117('0x2c')](_0x8cdfd0[_0x9117('0x3c')],function(_0x16fb51){var _0x5c9071={};_0x5c9071[_0x16fb51]={'$like':'%'+_0x4f8870['query']['filter']+'%'};return _0x5c9071;})});}if(_0x4f8870['query'][_0x9117('0x72')]){var _0x546246=_0x4f8870[_0x9117('0x3a')][_0x9117('0x72')]['split'](',');var _0xecbd49={};_0xecbd49[_0x546246[0x0]]={'$gte':moment(_0x546246[0x1])[_0x9117('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x8cdfd0['where']=_['merge'](_0x8cdfd0['where'],_0xecbd49);}_0x8cdfd0=_[_0x9117('0x94')]({},_0x8cdfd0,_0x4f8870['options']);return db[_0x9117('0xb3')][_0x9117('0x21')]({'where':_0x8cdfd0['where']})[_0x9117('0x25')](function(_0x159e27){_0x7bf9e0[_0x9117('0x21')]=_0x159e27;if(_0x4f8870[_0x9117('0x3a')][_0x9117('0xae')]){_0x8cdfd0['include']=[{'all':!![]}];}return db[_0x9117('0xb3')]['findAll'](_0x8cdfd0);})[_0x9117('0x25')](function(_0x1b0628){_0x7bf9e0['rows']=_0x1b0628;return _0x7bf9e0;});}})[_0x9117('0x25')](respondWithFilteredResult(_0xefd4ee,_0x8cdfd0))['catch'](handleError(_0xefd4ee,null));};exports[_0x9117('0xba')]=function(_0x5c3f3d,_0x2001cd,_0x23af58){return db['FaxInteraction']['find']({'where':{'id':_0x5c3f3d[_0x9117('0xad')]['id']}})[_0x9117('0x25')](handleEntityNotFound(_0x2001cd,null))[_0x9117('0x25')](function(_0x50940b){if(_0x50940b){return _0x50940b[_0x9117('0xbb')](_0x5c3f3d[_0x9117('0x6a')]['ids'],_[_0x9117('0xb5')](_0x5c3f3d[_0x9117('0x6a')],[_0x9117('0xb4'),'id'])||{})[_0x9117('0xbc')](function(){return db[_0x9117('0x64')]['findAll']({'attributes':['id',_0x9117('0x29'),_0x9117('0x45')],'where':{'id':_0x5c3f3d['body'][_0x9117('0xb4')]}});})['then'](function(_0x58e66e){socket[_0x9117('0xbd')]('faxInteractionTags:save',{'id':Number(_0x5c3f3d[_0x9117('0xad')]['id']),'tags':_0x58e66e||[]});return{'id':Number(_0x5c3f3d[_0x9117('0xad')]['id']),'tags':_0x58e66e||[]};});}})[_0x9117('0x25')](respondWithResult(_0x2001cd,null))[_0x9117('0x33')](handleError(_0x2001cd,null));};exports[_0x9117('0xbe')]=function(_0x20da2a,_0x2788ea,_0x3c85ac){return db['FaxInteraction'][_0x9117('0x59')]({'where':{'id':_0x20da2a[_0x9117('0xad')]['id']}})[_0x9117('0x25')](handleEntityNotFound(_0x2788ea,null))['then'](function(_0x13951f){if(_0x13951f){return _0x13951f['removeTags'](_0x20da2a['query'][_0x9117('0xb4')]);}})[_0x9117('0x25')](respondWithStatusCode(_0x2788ea,null))[_0x9117('0x33')](handleError(_0x2788ea,null));};exports[_0x9117('0xbf')]=function(_0x2330fe,_0x29d83d){var _0x408ac0=moment()[_0x9117('0xc0')]()[_0x9117('0x93')]();var _0x3927fe=path[_0x9117('0xc1')](config['root'],_0x9117('0xc2'),_0x9117('0xc3'),_0x9117('0xc4'));var _0x237e8f=path[_0x9117('0xc1')](config[_0x9117('0xc5')],_0x9117('0xc2'),'files','attachments');var _0x369f72=path[_0x9117('0xc1')](_0x3927fe,_0x408ac0);var _0xddc34d=util[_0x9117('0xb9')](_0x9117('0xc6'),_0x2330fe[_0x9117('0xad')]['id'],_0x408ac0);var _0x52e325=path[_0x9117('0xc1')](_0x3927fe,_0xddc34d);var _0x4d9df0=[];_0x4d9df0['push']({'model':db[_0x9117('0xc7')],'as':'Attachment','raw':!![]});var _0x2a2fbc=[{'model':db[_0x9117('0xb3')],'as':'Messages','attributes':['id',_0x9117('0x6a'),_0x9117('0x70')],'include':_0x4d9df0}];return db['FaxInteraction'][_0x9117('0x59')]({'where':{'id':_0x2330fe[_0x9117('0xad')]['id']},'include':_0x2a2fbc})[_0x9117('0x25')](handleEntityNotFound(_0x29d83d,null))[_0x9117('0x25')](function(_0x42354e){if(_0x42354e&&_0x42354e[_0x9117('0xc8')]){var _0x1d86f6=_0x42354e[_0x9117('0xc9')]({'plain':!![]});fs[_0x9117('0xca')](_0x369f72);for(var _0x36b6fb=0x0;_0x36b6fb<_0x1d86f6[_0x9117('0xc8')]['length'];_0x36b6fb++){var _0x3924e3=_0x1d86f6['Messages'][_0x36b6fb][_0x9117('0xc7')];if(_0x3924e3){var _0x43bafd=path['join'](_0x237e8f,_0x3924e3[_0x9117('0xcb')]);if(fs[_0x9117('0xcc')](_0x43bafd)){fs[_0x9117('0xcd')](_0x43bafd)[_0x9117('0xce')](fs['createWriteStream'](path['join'](_0x369f72,_0x3924e3[_0x9117('0xcb')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x464200,_0x57c32c){zipdir(_0x369f72,{'saveTo':_0x52e325},function(_0x105469,_0x3dcdef){if(_0x105469)return _0x57c32c(_0x105469);return _0x464200(_0x3dcdef);});})[_0x9117('0x25')](function(){return new BPromise(function(_0x4933bf,_0x50400d){rimraf(_0x369f72,function(_0x839ed7){if(_0x839ed7)_0x50400d(_0x839ed7);return _0x4933bf();});});})[_0x9117('0x25')](function(){return _0x29d83d[_0x9117('0xbf')](_0x52e325,_0xddc34d,function(_0x297498){if(_0x297498){console[_0x9117('0xcf')](_0x9117('0xd0'),_0x297498);}else{fs[_0x9117('0xd1')](_0x52e325);}});});});}else{return _0x29d83d[_0x9117('0x1c')](0xc8);}})['catch'](handleError(_0x29d83d,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a91cb45..5ff0bfc 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 _0x7277=['map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7277,0x138));var _0x7727=function(_0x5c0368,_0x423cf2){_0x5c0368=_0x5c0368-0x0;var _0x5b31b9=_0x7277[_0x5c0368];return _0x5b31b9;};'use strict';var EventEmitter=require(_0x7727('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x7727('0x1')];var FaxMessage=require(_0x7727('0x2'))['db'][_0x7727('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7727('0x4')](0x0);var events={'afterCreate':_0x7727('0x5'),'afterUpdate':_0x7727('0x6'),'afterDestroy':'remove'};function emitEvent(_0x5e9bb7){return function(_0x29b0f4,_0x5b119b,_0x58f61b){_0x29b0f4[_0x7727('0x7')]({'attributes':['id'],'raw':!![]})[_0x7727('0x8')](function(_0x312633){_0x29b0f4[_0x7727('0x9')](_0x7727('0xa'),_0x312633[_0x7727('0xb')](function(_0x444f32){return{'id':_0x444f32['id']};}));return FaxMessage[_0x7727('0xc')]({'where':{'FaxInteractionId':_0x29b0f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7727('0x8')](function(_0x5585bd){_0x29b0f4[_0x7727('0x9')](_0x7727('0xd'),_0x5585bd[_0x7727('0xe')]);FaxInteractionEvents[_0x7727('0xf')](_0x5e9bb7+':'+_0x29b0f4['id'],_0x29b0f4);FaxInteractionEvents[_0x7727('0xf')](_0x5e9bb7,_0x29b0f4);_0x58f61b(null);})['catch'](_0x58f61b(null));};}for(var e in events){if(events[_0x7727('0x10')](e)){var event=events[e];FaxInteraction[_0x7727('0x11')](e,emitEvent(event));}}module[_0x7727('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0xfcfd=['FaxInteraction','../../mysqldb','FaxMessage','update','remove','getUsers','then','setDataValue','Users','findAll','emit','hook'];(function(_0x35cabb,_0x5407cb){var _0x20943b=function(_0x491948){while(--_0x491948){_0x35cabb['push'](_0x35cabb['shift']());}};_0x20943b(++_0x5407cb);}(_0xfcfd,0x78));var _0xdfcf=function(_0x311b0c,_0x526166){_0x311b0c=_0x311b0c-0x0;var _0x4af3af=_0xfcfd[_0x311b0c];return _0x4af3af;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0xdfcf('0x0')];var FaxMessage=require(_0xdfcf('0x1'))['db'][_0xdfcf('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdfcf('0x3'),'afterDestroy':_0xdfcf('0x4')};function emitEvent(_0x4da7d2){return function(_0x4c5f00,_0x115ff6,_0x4a6a57){_0x4c5f00[_0xdfcf('0x5')]({'attributes':['id'],'raw':!![]})[_0xdfcf('0x6')](function(_0x27144e){_0x4c5f00[_0xdfcf('0x7')](_0xdfcf('0x8'),_0x27144e['map'](function(_0x98d46d){return{'id':_0x98d46d['id']};}));return FaxMessage[_0xdfcf('0x9')]({'where':{'FaxInteractionId':_0x4c5f00['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdfcf('0x6')](function(_0x527388){_0x4c5f00['setDataValue']('unreadMessages',_0x527388['length']);FaxInteractionEvents[_0xdfcf('0xa')](_0x4da7d2+':'+_0x4c5f00['id'],_0x4c5f00);FaxInteractionEvents[_0xdfcf('0xa')](_0x4da7d2,_0x4c5f00);_0x4a6a57(null);})['catch'](_0x4a6a57(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xdfcf('0xb')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index a2b2658..6b8a09a 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 _0x38b8=['closed','closedAt','format','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed'];(function(_0x947d35,_0x1fb612){var _0x16631c=function(_0xe0269c){while(--_0xe0269c){_0x947d35['push'](_0x947d35['shift']());}};_0x16631c(++_0x1fb612);}(_0x38b8,0x7b));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x838b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x838b('0x1'));var BPromise=require(_0x838b('0x2'));var rp=require(_0x838b('0x3'));var fs=require('fs');var path=require(_0x838b('0x4'));var rimraf=require(_0x838b('0x5'));var config=require(_0x838b('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x838b('0x7')]=function(_0x45a625,_0x5b589c){return _0x45a625[_0x838b('0x8')](_0x838b('0x9'),attributes,{'tableName':_0x838b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x457f07,_0x2063c9,_0x5687a4){if(_0x457f07[_0x838b('0xb')](_0x838b('0xc'))){_0x457f07[_0x838b('0xd')]=moment()[_0x838b('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5687a4(null,_0x457f07);}}});}; \ No newline at end of file +var _0x0fe0=['closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0x0fe0,0x6f));var _0x00fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fe0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x00fe('0x0'));var util=require(_0x00fe('0x1'));var logger=require(_0x00fe('0x2'))(_0x00fe('0x3'));var moment=require(_0x00fe('0x4'));var BPromise=require(_0x00fe('0x5'));var rp=require(_0x00fe('0x6'));var fs=require('fs');var path=require(_0x00fe('0x7'));var rimraf=require(_0x00fe('0x8'));var config=require(_0x00fe('0x9'));var attributes=require(_0x00fe('0xa'));module[_0x00fe('0xb')]=function(_0x43d758,_0x666e19){return _0x43d758[_0x00fe('0xc')](_0x00fe('0xd'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5239d5,_0x5b11ae,_0x4ca3b6){if(_0x5239d5[_0x00fe('0xe')](_0x00fe('0xf'))){_0x5239d5[_0x00fe('0x10')]=moment()[_0x00fe('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4ca3b6(null,_0x5239d5);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e66566f..116f3f8 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 _0xb5bb=['catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToFaxInteraction','where','addTags','omit','ids','spread','AddTags','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x34de23,_0x1234c0){var _0x5f3826=function(_0x3ec332){while(--_0x3ec332){_0x34de23['push'](_0x34de23['shift']());}};_0x5f3826(++_0x1234c0);}(_0xb5bb,0xba));var _0xbb5b=function(_0x976e3e,_0x13d6f0){_0x976e3e=_0x976e3e-0x0;var _0x1612dd=_0xb5bb[_0x976e3e];return _0x1612dd;};'use strict';var _=require(_0xbb5b('0x0'));var util=require(_0xbb5b('0x1'));var moment=require('moment');var BPromise=require(_0xbb5b('0x2'));var rs=require(_0xbb5b('0x3'));var fs=require('fs');var Redis=require(_0xbb5b('0x4'));var db=require(_0xbb5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb5b('0x6'))(_0xbb5b('0x7'));var config=require(_0xbb5b('0x8'));var jayson=require(_0xbb5b('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xbb5b('0xa')]=_[_0xbb5b('0xb')](config[_0xbb5b('0xa')],{'host':_0xbb5b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb5b('0xa')]));require(_0xbb5b('0xd'))[_0xbb5b('0xe')](socket);function respondWithRpcPromise(_0x47e19a,_0x2e6e0f,_0x10d565){return new BPromise(function(_0x3819af,_0x17d798){return client['request'](_0x47e19a,_0x10d565)[_0xbb5b('0xf')](function(_0x2910b4){logger[_0xbb5b('0x10')](_0xbb5b('0x11'),_0x2e6e0f,'request\x20sent');logger['debug'](_0xbb5b('0x12'),_0x2e6e0f,_0xbb5b('0x13'),JSON['stringify'](_0x2910b4));if(_0x2910b4[_0xbb5b('0x14')]){if(_0x2910b4[_0xbb5b('0x14')][_0xbb5b('0x15')]===0x1f4){logger[_0xbb5b('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x2e6e0f,_0x2910b4[_0xbb5b('0x14')]['message']);return _0x17d798(_0x2910b4[_0xbb5b('0x14')][_0xbb5b('0x16')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2e6e0f,_0x2910b4[_0xbb5b('0x14')][_0xbb5b('0x16')]);return _0x3819af(_0x2910b4['error']['message']);}else{logger['info'](_0xbb5b('0x11'),_0x2e6e0f,_0xbb5b('0x13'));_0x3819af(_0x2910b4[_0xbb5b('0x17')][_0xbb5b('0x16')]);}})[_0xbb5b('0x18')](function(_0x22c558){logger[_0xbb5b('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x2e6e0f,_0x22c558);_0x17d798(_0x22c558);});});}exports[_0xbb5b('0x19')]=function(_0x1ac88a){var _0x329edb=this;return new Promise(function(_0x247e94,_0xfb285){return db[_0xbb5b('0x1a')][_0xbb5b('0x1b')](_0x1ac88a[_0xbb5b('0x1c')],{'raw':_0x1ac88a[_0xbb5b('0x1d')]?_0x1ac88a['options'][_0xbb5b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac88a[_0xbb5b('0x1d')]?_0x1ac88a[_0xbb5b('0x1d')]['where']||null:null,'attributes':_0x1ac88a[_0xbb5b('0x1d')]?_0x1ac88a[_0xbb5b('0x1d')][_0xbb5b('0x1f')]||null:null,'limit':_0x1ac88a[_0xbb5b('0x1d')]?_0x1ac88a[_0xbb5b('0x1d')][_0xbb5b('0x20')]||null:null})['then'](function(_0x4bdec3){logger[_0xbb5b('0x10')](_0xbb5b('0x19'),_0x1ac88a);logger[_0xbb5b('0x21')](_0xbb5b('0x19'),_0x1ac88a,JSON['stringify'](_0x4bdec3));_0x247e94(_0x4bdec3);})['catch'](function(_0x312f28){logger[_0xbb5b('0x14')](_0xbb5b('0x19'),_0x312f28[_0xbb5b('0x16')],_0x1ac88a);_0xfb285(_0x329edb['error'](0x1f4,_0x312f28[_0xbb5b('0x16')]));});});};exports[_0xbb5b('0x22')]=function(_0x2fbbc6){return new Promise(function(_0x40ca2d,_0x1b6896){return db[_0xbb5b('0x1a')]['find']({'where':_0x2fbbc6[_0xbb5b('0x1d')]?_0x2fbbc6[_0xbb5b('0x1d')][_0xbb5b('0x23')]||null:null})[_0xbb5b('0xf')](function(_0x1203f6){if(_0x1203f6){return _0x1203f6[_0xbb5b('0x24')](_0x2fbbc6[_0xbb5b('0x1c')]['ids'],_[_0xbb5b('0x25')](_0x2fbbc6[_0xbb5b('0x1c')],[_0xbb5b('0x26'),'id'])||{});}})[_0xbb5b('0x27')](function(_0x2695a5){logger[_0xbb5b('0x10')](_0xbb5b('0x28'),_0x2fbbc6);logger['debug'](_0xbb5b('0x28'),_0x2fbbc6,JSON[_0xbb5b('0x29')](_0x2695a5));_0x40ca2d(_0x2695a5);})[_0xbb5b('0x18')](function(_0x3bb081){logger[_0xbb5b('0x14')](_0xbb5b('0x28'),_0x3bb081[_0xbb5b('0x16')],_0x2fbbc6);_0x1b6896(_this[_0xbb5b('0x14')](0x1f4,_0x3bb081[_0xbb5b('0x16')]));});});}; \ No newline at end of file +var _0x1490=['stringify','error','code','message','info','result','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','then','find','addTags','body','ids','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2e9842,_0x514356){var _0x44e929=function(_0x1fa5e1){while(--_0x1fa5e1){_0x2e9842['push'](_0x2e9842['shift']());}};_0x44e929(++_0x514356);}(_0x1490,0x64));var _0x0149=function(_0x8262f2,_0x34af75){_0x8262f2=_0x8262f2-0x0;var _0x2f2338=_0x1490[_0x8262f2];return _0x2f2338;};'use strict';var _=require(_0x0149('0x0'));var util=require(_0x0149('0x1'));var moment=require(_0x0149('0x2'));var BPromise=require(_0x0149('0x3'));var rs=require(_0x0149('0x4'));var fs=require('fs');var Redis=require(_0x0149('0x5'));var db=require(_0x0149('0x6'))['db'];var utils=require(_0x0149('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0149('0x8'));var jayson=require(_0x0149('0x9'));var client=jayson[_0x0149('0xa')]['http']({'port':0x232a});config[_0x0149('0xb')]=_[_0x0149('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0149('0xd'))(new Redis(config[_0x0149('0xb')]));require(_0x0149('0xe'))[_0x0149('0xf')](socket);function respondWithRpcPromise(_0x34aeba,_0xa59ac8,_0x3b270b){return new BPromise(function(_0x47a046,_0x4eeee9){return client['request'](_0x34aeba,_0x3b270b)['then'](function(_0x4f86c9){logger['info'](_0x0149('0x10'),_0xa59ac8,_0x0149('0x11'));logger[_0x0149('0x12')](_0x0149('0x13'),_0xa59ac8,_0x0149('0x11'),JSON[_0x0149('0x14')](_0x4f86c9));if(_0x4f86c9[_0x0149('0x15')]){if(_0x4f86c9[_0x0149('0x15')][_0x0149('0x16')]===0x1f4){logger['error'](_0x0149('0x10'),_0xa59ac8,_0x4f86c9['error'][_0x0149('0x17')]);return _0x4eeee9(_0x4f86c9[_0x0149('0x15')][_0x0149('0x17')]);}logger['error'](_0x0149('0x10'),_0xa59ac8,_0x4f86c9[_0x0149('0x15')][_0x0149('0x17')]);return _0x47a046(_0x4f86c9[_0x0149('0x15')][_0x0149('0x17')]);}else{logger[_0x0149('0x18')]('FaxInteraction,\x20%s,\x20%s',_0xa59ac8,_0x0149('0x11'));_0x47a046(_0x4f86c9[_0x0149('0x19')][_0x0149('0x17')]);}})['catch'](function(_0x4afc63){logger[_0x0149('0x15')](_0x0149('0x10'),_0xa59ac8,_0x4afc63);_0x4eeee9(_0x4afc63);});});}exports[_0x0149('0x1a')]=function(_0x2b7ec8){var _0x9592a3=this;return new Promise(function(_0x221453,_0x1949b0){return db[_0x0149('0x1b')]['update'](_0x2b7ec8['body'],{'raw':_0x2b7ec8[_0x0149('0x1c')]?_0x2b7ec8['options'][_0x0149('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b7ec8[_0x0149('0x1c')]?_0x2b7ec8[_0x0149('0x1c')][_0x0149('0x1e')]||null:null,'attributes':_0x2b7ec8['options']?_0x2b7ec8[_0x0149('0x1c')][_0x0149('0x1f')]||null:null,'limit':_0x2b7ec8[_0x0149('0x1c')]?_0x2b7ec8['options'][_0x0149('0x20')]||null:null})[_0x0149('0x21')](function(_0x1d81a9){logger[_0x0149('0x18')]('UpdateFaxInteraction',_0x2b7ec8);logger[_0x0149('0x12')]('UpdateFaxInteraction',_0x2b7ec8,JSON[_0x0149('0x14')](_0x1d81a9));_0x221453(_0x1d81a9);})['catch'](function(_0x42e62b){logger[_0x0149('0x15')](_0x0149('0x1a'),_0x42e62b[_0x0149('0x17')],_0x2b7ec8);_0x1949b0(_0x9592a3[_0x0149('0x15')](0x1f4,_0x42e62b[_0x0149('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x314110){return new Promise(function(_0x1fd642,_0x3fe2f3){return db[_0x0149('0x1b')][_0x0149('0x22')]({'where':_0x314110[_0x0149('0x1c')]?_0x314110[_0x0149('0x1c')]['where']||null:null})[_0x0149('0x21')](function(_0x511828){if(_0x511828){return _0x511828[_0x0149('0x23')](_0x314110[_0x0149('0x24')][_0x0149('0x25')],_['omit'](_0x314110[_0x0149('0x24')],[_0x0149('0x25'),'id'])||{});}})['spread'](function(_0x5315a7){logger[_0x0149('0x18')](_0x0149('0x26'),_0x314110);logger[_0x0149('0x12')](_0x0149('0x26'),_0x314110,JSON['stringify'](_0x5315a7));_0x1fd642(_0x5315a7);})[_0x0149('0x27')](function(_0x1298ce){logger[_0x0149('0x15')](_0x0149('0x26'),_0x1298ce[_0x0149('0x17')],_0x314110);_0x3fe2f3(_this[_0x0149('0x15')](0x1f4,_0x1298ce[_0x0149('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2959942..9c79e02 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 _0xaac4=['remove','faxInteraction:','./faxInteraction.events','save'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0xaac4,0x186));var _0x4aac=function(_0x46eb0e,_0x296d16){_0x46eb0e=_0x46eb0e-0x0;var _0x523297=_0xaac4[_0x46eb0e];return _0x523297;};'use strict';var FaxInteractionEvents=require(_0x4aac('0x0'));var events=[_0x4aac('0x1'),_0x4aac('0x2'),'update'];function createListener(_0x3ff558,_0x5ac98c){return function(_0x33f698){_0x5ac98c['emit'](_0x3ff558,_0x33f698);};}function removeListener(_0x514558,_0x5e68bc){return function(){FaxInteractionEvents['removeListener'](_0x514558,_0x5e68bc);};}exports['register']=function(_0x446cbe){for(var _0x28ae38=0x0,_0x4acc00=events['length'];_0x28ae38<_0x4acc00;_0x28ae38++){var _0x18b598=events[_0x28ae38];var _0x26c28f=createListener(_0x4aac('0x3')+_0x18b598,_0x446cbe);FaxInteractionEvents['on'](_0x18b598,_0x26c28f);}}; \ No newline at end of file +var _0x37e5=['faxInteraction:','./faxInteraction.events','save','emit','removeListener','register','length'];(function(_0x2c4cf0,_0x141c1b){var _0x3f6d61=function(_0x3d8136){while(--_0x3d8136){_0x2c4cf0['push'](_0x2c4cf0['shift']());}};_0x3f6d61(++_0x141c1b);}(_0x37e5,0x1b3));var _0x537e=function(_0x1ab357,_0x2319c1){_0x1ab357=_0x1ab357-0x0;var _0x3975eb=_0x37e5[_0x1ab357];return _0x3975eb;};'use strict';var FaxInteractionEvents=require(_0x537e('0x0'));var events=[_0x537e('0x1'),'remove','update'];function createListener(_0x1c33e6,_0x18cabf){return function(_0x53a291){_0x18cabf[_0x537e('0x2')](_0x1c33e6,_0x53a291);};}function removeListener(_0x36d4bf,_0x15018b){return function(){FaxInteractionEvents[_0x537e('0x3')](_0x36d4bf,_0x15018b);};}exports[_0x537e('0x4')]=function(_0x230fcb){for(var _0x38a4ea=0x0,_0x1635e7=events[_0x537e('0x5')];_0x38a4ea<_0x1635e7;_0x38a4ea++){var _0x24fea1=events[_0x38a4ea];var _0x221cc7=createListener(_0x537e('0x6')+_0x24fea1,_0x230fcb);FaxInteractionEvents['on'](_0x24fea1,_0x221cc7);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 06a906e..b304b94 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 _0x0845=['./faxInteraction.controller','get','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','fax','addTags','put','/:id','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x0845,0x125));var _0x5084=function(_0x403099,_0x563de3){_0x403099=_0x403099-0x0;var _0xeb101a=_0x0845[_0x403099];return _0xeb101a;};'use strict';var multer=require(_0x5084('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5084('0x1'));var express=require(_0x5084('0x2'));var router=express[_0x5084('0x3')]();var fs_extra=require(_0x5084('0x4'));var auth=require(_0x5084('0x5'));var interaction=require(_0x5084('0x6'));var config=require('../../config/environment');var controller=require(_0x5084('0x7'));router[_0x5084('0x8')]('/',auth[_0x5084('0x9')](),controller['index']);router['get']('/describe',auth[_0x5084('0x9')](),controller[_0x5084('0xa')]);router[_0x5084('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5084('0xb')]);router[_0x5084('0x8')](_0x5084('0xc'),auth['isAuthenticated'](),controller[_0x5084('0xd')]);router[_0x5084('0x8')](_0x5084('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x5084('0xf')]('/',auth[_0x5084('0x9')](),controller[_0x5084('0x10')]);router[_0x5084('0xf')](_0x5084('0xc'),auth[_0x5084('0x9')](),controller[_0x5084('0x11')]);router[_0x5084('0xf')]('/:id/tags',auth[_0x5084('0x9')](),interaction[_0x5084('0x12')](_0x5084('0x13'),'faxinteraction:addtags'),controller[_0x5084('0x14')]);router[_0x5084('0x15')](_0x5084('0x16'),auth[_0x5084('0x9')](),interaction['tracked'](_0x5084('0x13'),'faxinteraction:update'),controller[_0x5084('0x17')]);router[_0x5084('0x18')](_0x5084('0x16'),auth[_0x5084('0x9')](),interaction[_0x5084('0x12')](_0x5084('0x13'),_0x5084('0x19')),controller[_0x5084('0x1a')]);router[_0x5084('0x18')](_0x5084('0x1b'),auth[_0x5084('0x9')](),controller[_0x5084('0x1c')]);module[_0x5084('0x1d')]=router; \ No newline at end of file +var _0xb492=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','create','/:id/messages','addMessage','tracked','fax','faxinteraction:addtags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x47e840,_0x39dc3e){var _0x3847ed=function(_0x13304d){while(--_0x13304d){_0x47e840['push'](_0x47e840['shift']());}};_0x3847ed(++_0x39dc3e);}(_0xb492,0x105));var _0x2b49=function(_0x3fd2c4,_0x2bd354){_0x3fd2c4=_0x3fd2c4-0x0;var _0xf1dfe1=_0xb492[_0x3fd2c4];return _0xf1dfe1;};'use strict';var multer=require(_0x2b49('0x0'));var util=require(_0x2b49('0x1'));var path=require(_0x2b49('0x2'));var timeout=require(_0x2b49('0x3'));var express=require(_0x2b49('0x4'));var router=express['Router']();var fs_extra=require(_0x2b49('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2b49('0x6'));var config=require('../../config/environment');var controller=require(_0x2b49('0x7'));router[_0x2b49('0x8')]('/',auth[_0x2b49('0x9')](),controller['index']);router[_0x2b49('0x8')](_0x2b49('0xa'),auth[_0x2b49('0x9')](),controller[_0x2b49('0xb')]);router[_0x2b49('0x8')](_0x2b49('0xc'),auth[_0x2b49('0x9')](),controller[_0x2b49('0xd')]);router[_0x2b49('0x8')]('/:id/messages',auth[_0x2b49('0x9')](),controller['getMessages']);router[_0x2b49('0x8')](_0x2b49('0xe'),auth[_0x2b49('0x9')](),controller['download']);router[_0x2b49('0xf')]('/',auth['isAuthenticated'](),controller[_0x2b49('0x10')]);router[_0x2b49('0xf')](_0x2b49('0x11'),auth[_0x2b49('0x9')](),controller[_0x2b49('0x12')]);router[_0x2b49('0xf')]('/:id/tags',auth[_0x2b49('0x9')](),interaction[_0x2b49('0x13')](_0x2b49('0x14'),_0x2b49('0x15')),controller['addTags']);router['put'](_0x2b49('0xc'),auth[_0x2b49('0x9')](),interaction[_0x2b49('0x13')]('fax',_0x2b49('0x16')),controller[_0x2b49('0x17')]);router[_0x2b49('0x18')](_0x2b49('0xc'),auth[_0x2b49('0x9')](),interaction['tracked'](_0x2b49('0x14'),_0x2b49('0x19')),controller[_0x2b49('0x1a')]);router['delete'](_0x2b49('0x1b'),auth[_0x2b49('0x9')](),controller[_0x2b49('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7b59ccc..0d0bd88 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 _0x0624=['DATE','BOOLEAN','ENUM','out','TEXT'];(function(_0x54992a,_0x5ecf95){var _0x269423=function(_0x23bb50){while(--_0x23bb50){_0x54992a['push'](_0x54992a['shift']());}};_0x269423(++_0x5ecf95);}(_0x0624,0x132));var _0x4062=function(_0x1b867e,_0xee3b92){_0x1b867e=_0x1b867e-0x0;var _0x2b05f3=_0x0624[_0x1b867e];return _0x2b05f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4062('0x0')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4062('0x1')]('in',_0x4062('0x2')),'defaultValue':_0x4062('0x2'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x4062('0x3')],'defaultValue':null},'readAt':{'type':Sequelize[_0x4062('0x4')]}}; \ No newline at end of file +var _0x4d46=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x2fa9f1,_0x447409){var _0x57f4d1=function(_0x4f49cd){while(--_0x4f49cd){_0x2fa9f1['push'](_0x2fa9f1['shift']());}};_0x57f4d1(++_0x447409);}(_0x4d46,0x197));var _0x64d4=function(_0x2660e7,_0x56abef){_0x2660e7=_0x2660e7-0x0;var _0x17507c=_0x4d46[_0x2660e7];return _0x17507c;};'use strict';var Sequelize=require(_0x64d4('0x0'));module[_0x64d4('0x1')]={'body':{'type':Sequelize[_0x64d4('0x2')](_0x64d4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x64d4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x64d4('0x5')]('in','out'),'defaultValue':_0x64d4('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x64d4('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x64d4('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c032d8a..2a8484c 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 _0x182d=['FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','agent','manual','interface','format','SIP/%s','channel','event','EventManager','fax-interactions','reject','fax','info','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','params','length','includeAll','find','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get'];(function(_0x4dcaea,_0x4b88d0){var _0x5137cd=function(_0x2abeb1){while(--_0x2abeb1){_0x4dcaea['push'](_0x4dcaea['shift']());}};_0x5137cd(++_0x4b88d0);}(_0x182d,0x1ec));var _0xd182=function(_0x1fb330,_0x14fd9e){_0x1fb330=_0x1fb330-0x0;var _0x2fdad1=_0x182d[_0x1fb330];return _0x2fdad1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd182('0x0'));var zipdir=require(_0xd182('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd182('0x2'));var moment=require(_0xd182('0x3'));var BPromise=require(_0xd182('0x4'));var Mustache=require(_0xd182('0x5'));var util=require(_0xd182('0x6'));var path=require(_0xd182('0x7'));var sox=require(_0xd182('0x8'));var csv=require(_0xd182('0x9'));var ejs=require(_0xd182('0xa'));var fs=require('fs');var fs_extra=require(_0xd182('0xb'));var _=require(_0xd182('0xc'));var squel=require(_0xd182('0xd'));var crypto=require(_0xd182('0xe'));var jsforce=require(_0xd182('0xf'));var deskjs=require(_0xd182('0x10'));var toCsv=require(_0xd182('0x9'));var querystring=require(_0xd182('0x11'));var Papa=require(_0xd182('0x12'));var Redis=require('ioredis');var authService=require(_0xd182('0x13'));var qs=require(_0xd182('0x14'));var as=require(_0xd182('0x15'));var hardwareService=require(_0xd182('0x16'));var logger=require(_0xd182('0x17'))(_0xd182('0x18'));var utils=require(_0xd182('0x19'));var config=require(_0xd182('0x1a'));var licenseUtil=require(_0xd182('0x1b'));var db=require('../../mysqldb')['db'];config[_0xd182('0x1c')]=_[_0xd182('0x1d')](config[_0xd182('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xd182('0x1e'))(new Redis(config[_0xd182('0x1c')]));require(_0xd182('0x1f'))[_0xd182('0x20')](socket);var jayson=require(_0xd182('0x21'));var client=jayson['client'][_0xd182('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xd182('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3a9840,_0x65c23a,_0x56d455,_0x326f76){return new BPromise(function(_0x22d44b,_0x3cbab2){var _0x9e084a=_0x326f76||client;return _0x9e084a[_0xd182('0x23')](_0x3a9840,_0x56d455)[_0xd182('0x24')](function(_0x579afd){logger['info'](_0xd182('0x25'),_0x65c23a,_0xd182('0x26'));logger[_0xd182('0x27')](_0xd182('0x28'),_0x65c23a,_0xd182('0x26'),JSON['stringify'](_0x579afd));if(_0x579afd[_0xd182('0x29')]){if(_0x579afd[_0xd182('0x29')]['code']===0x1f4){logger[_0xd182('0x29')](_0xd182('0x25'),_0x65c23a,_0x579afd['error']['message']);return _0x3cbab2(_0x579afd[_0xd182('0x29')]['message']);}logger[_0xd182('0x29')]('FaxMessage,\x20%s,\x20%s',_0x65c23a,_0x579afd[_0xd182('0x29')]['message']);return _0x22d44b(_0x579afd['error'][_0xd182('0x2a')]);}else{logger['info'](_0xd182('0x25'),_0x65c23a,_0xd182('0x26'));_0x22d44b(_0x579afd[_0xd182('0x2b')][_0xd182('0x2a')]);}})[_0xd182('0x2c')](function(_0xd92019){logger[_0xd182('0x29')](_0xd182('0x25'),_0x65c23a,_0xd92019);_0x3cbab2(_0xd92019);});});}function respondWithStatusCode(_0x2d0870,_0x4c44e0){_0x4c44e0=_0x4c44e0||0xcc;return function(_0xf2b3b9){if(_0xf2b3b9){return _0x2d0870[_0xd182('0x2d')](_0x4c44e0);}return _0x2d0870['status'](_0x4c44e0)[_0xd182('0x2e')]();};}function respondWithResult(_0x437bfb,_0x34d77a){_0x34d77a=_0x34d77a||0xc8;return function(_0x406b60){if(_0x406b60){return _0x437bfb[_0xd182('0x2f')](_0x34d77a)[_0xd182('0x30')](_0x406b60);}};}function respondWithFilteredResult(_0x2a0d2f,_0x318edd){return function(_0x470ad8){if(_0x470ad8){var _0x388e67=typeof _0x318edd[_0xd182('0x31')]===_0xd182('0x32')&&typeof _0x318edd[_0xd182('0x33')]===_0xd182('0x32');var _0x5bb1c3=_0x470ad8[_0xd182('0x34')];var _0x149366=_0x388e67?0x0:_0x318edd['offset'];var _0x20f186=_0x388e67?_0x470ad8[_0xd182('0x34')]:_0x318edd[_0xd182('0x31')]+_0x318edd[_0xd182('0x33')];var _0x250a9d;if(_0x20f186>=_0x5bb1c3){_0x20f186=_0x5bb1c3;_0x250a9d=0xc8;}else{_0x250a9d=0xce;}_0x2a0d2f[_0xd182('0x2f')](_0x250a9d);return _0x2a0d2f[_0xd182('0x35')](_0xd182('0x36'),_0x149366+'-'+_0x20f186+'/'+_0x5bb1c3)[_0xd182('0x30')](_0x470ad8);}return null;};}function patchUpdates(_0x24ed9b){return function(_0x3e9d35){try{jsonpatch[_0xd182('0x37')](_0x3e9d35,_0x24ed9b,!![]);}catch(_0xc1d0e){return BPromise['reject'](_0xc1d0e);}return _0x3e9d35['save']();};}function saveUpdates(_0x56b531,_0x39e40d){return function(_0x1ddc0a){if(_0x1ddc0a){return _0x1ddc0a[_0xd182('0x38')](_0x56b531)[_0xd182('0x24')](function(_0x2730bf){return _0x2730bf;});}return null;};}function removeEntity(_0x2252c0,_0x41fc97){return function(_0x1df36f){if(_0x1df36f){return _0x1df36f[_0xd182('0x39')]()[_0xd182('0x24')](function(){_0x2252c0[_0xd182('0x2f')](0xcc)[_0xd182('0x2e')]();});}};}function handleEntityNotFound(_0x35beff,_0x33c97b){return function(_0xaa7352){if(!_0xaa7352){_0x35beff[_0xd182('0x2d')](0x194);}return _0xaa7352;};}function handleError(_0x41e29c,_0x5dbeca){_0x5dbeca=_0x5dbeca||0x1f4;return function(_0x21bc5f){logger[_0xd182('0x29')](_0x21bc5f[_0xd182('0x3a')]);if(_0x21bc5f[_0xd182('0x3b')]){delete _0x21bc5f[_0xd182('0x3b')];}_0x41e29c[_0xd182('0x2f')](_0x5dbeca)[_0xd182('0x3c')](_0x21bc5f);};}exports[_0xd182('0x3d')]=function(_0x2a468a,_0x4a963f){var _0x254f61={},_0x521daa={},_0xf9f8c2={'count':0x0,'rows':[]};var _0x1d0151=_[_0xd182('0x3e')](db[_0xd182('0x3f')][_0xd182('0x40')],function(_0x18907f){return{'name':_0x18907f[_0xd182('0x41')],'type':_0x18907f['type'][_0xd182('0x42')]};});_0x521daa[_0xd182('0x43')]=_[_0xd182('0x3e')](_0x1d0151,'name');_0x521daa[_0xd182('0x44')]=_[_0xd182('0x45')](_0x2a468a[_0xd182('0x44')]);_0x521daa[_0xd182('0x46')]=_[_0xd182('0x47')](_0x521daa['model'],_0x521daa[_0xd182('0x44')]);_0x254f61[_0xd182('0x48')]=_[_0xd182('0x47')](_0x521daa[_0xd182('0x43')],qs['fields'](_0x2a468a[_0xd182('0x44')][_0xd182('0x49')]));_0x254f61['attributes']=_0x254f61['attributes']['length']?_0x254f61['attributes']:_0x521daa[_0xd182('0x43')];if(!_0x2a468a['query']['hasOwnProperty'](_0xd182('0x4a'))){_0x254f61['limit']=qs[_0xd182('0x33')](_0x2a468a['query']['limit']);_0x254f61[_0xd182('0x31')]=qs[_0xd182('0x31')](_0x2a468a[_0xd182('0x44')][_0xd182('0x31')]);}_0x254f61[_0xd182('0x4b')]=qs[_0xd182('0x4c')](_0x2a468a[_0xd182('0x44')]['sort']);_0x254f61['where']=qs[_0xd182('0x46')](_[_0xd182('0x4d')](_0x2a468a[_0xd182('0x44')],_0x521daa[_0xd182('0x46')]),_0x1d0151);if(_0x2a468a['query'][_0xd182('0x4e')]){_0x254f61[_0xd182('0x4f')]=_[_0xd182('0x50')](_0x254f61['where'],{'$or':_['map'](_0x1d0151,function(_0x1c1f9b){if(_0x1c1f9b[_0xd182('0x51')]!==_0xd182('0x52')){var _0x5e5e34={};_0x5e5e34[_0x1c1f9b[_0xd182('0x3b')]]={'$like':'%'+_0x2a468a[_0xd182('0x44')][_0xd182('0x4e')]+'%'};return _0x5e5e34;}})});}_0x254f61=_[_0xd182('0x50')]({},_0x254f61,_0x2a468a[_0xd182('0x53')]);var _0x125dc4={'where':_0x254f61['where']};return db[_0xd182('0x3f')][_0xd182('0x34')](_0x125dc4)[_0xd182('0x24')](function(_0x22173b){_0xf9f8c2[_0xd182('0x34')]=_0x22173b;if(_0x2a468a['query']['includeAll']){_0x254f61[_0xd182('0x54')]=[{'all':!![]}];}return db[_0xd182('0x3f')][_0xd182('0x55')](_0x254f61);})[_0xd182('0x24')](function(_0x217b67){_0xf9f8c2[_0xd182('0x56')]=_0x217b67;return _0xf9f8c2;})[_0xd182('0x24')](respondWithFilteredResult(_0x4a963f,_0x254f61))[_0xd182('0x2c')](handleError(_0x4a963f,null));};exports['show']=function(_0x2fcf87,_0x4b842a){var _0x8797cf={'raw':!![],'where':{'id':_0x2fcf87[_0xd182('0x57')]['id']}},_0x1a684f={};_0x1a684f[_0xd182('0x43')]=_[_0xd182('0x45')](db[_0xd182('0x3f')][_0xd182('0x40')]);_0x1a684f[_0xd182('0x44')]=_['keys'](_0x2fcf87[_0xd182('0x44')]);_0x1a684f['filters']=_[_0xd182('0x47')](_0x1a684f['model'],_0x1a684f[_0xd182('0x44')]);_0x8797cf[_0xd182('0x48')]=_[_0xd182('0x47')](_0x1a684f['model'],qs[_0xd182('0x49')](_0x2fcf87[_0xd182('0x44')]['fields']));_0x8797cf[_0xd182('0x48')]=_0x8797cf[_0xd182('0x48')][_0xd182('0x58')]?_0x8797cf[_0xd182('0x48')]:_0x1a684f[_0xd182('0x43')];if(_0x2fcf87[_0xd182('0x44')][_0xd182('0x59')]){_0x8797cf[_0xd182('0x54')]=[{'all':!![]}];}_0x8797cf=_[_0xd182('0x50')]({},_0x8797cf,_0x2fcf87['options']);return db[_0xd182('0x3f')][_0xd182('0x5a')](_0x8797cf)[_0xd182('0x24')](handleEntityNotFound(_0x4b842a,null))[_0xd182('0x24')](respondWithResult(_0x4b842a,null))[_0xd182('0x2c')](handleError(_0x4b842a,null));};exports[_0xd182('0x38')]=function(_0x5b339f,_0x4b8d79){if(_0x5b339f[_0xd182('0x5b')]['id']){delete _0x5b339f[_0xd182('0x5b')]['id'];}return db['FaxMessage'][_0xd182('0x5a')]({'where':{'id':_0x5b339f['params']['id']}})[_0xd182('0x24')](handleEntityNotFound(_0x4b8d79,null))[_0xd182('0x24')](saveUpdates(_0x5b339f[_0xd182('0x5b')],null))[_0xd182('0x24')](respondWithResult(_0x4b8d79,null))[_0xd182('0x2c')](handleError(_0x4b8d79,null));};exports[_0xd182('0x39')]=function(_0x333e42,_0x48dab9){return db[_0xd182('0x3f')][_0xd182('0x5a')]({'where':{'id':_0x333e42['params']['id']}})[_0xd182('0x24')](handleEntityNotFound(_0x48dab9,null))[_0xd182('0x24')](removeEntity(_0x48dab9,null))[_0xd182('0x2c')](handleError(_0x48dab9,null));};exports['describe']=function(_0x532080,_0x3ff6e){return db['FaxMessage'][_0xd182('0x5c')]()[_0xd182('0x24')](respondWithResult(_0x3ff6e,null))[_0xd182('0x2c')](handleError(_0x3ff6e,null));};var interaction_log=require(_0xd182('0x17'))('fax-interactions');exports[_0xd182('0x5d')]=function(_0x467d4a,_0x377fa3,_0x55d95c){var _0x44f0da={'agent':{},'channel':'fax'};if(_0x467d4a[_0xd182('0x5b')]['id']){delete _0x467d4a[_0xd182('0x5b')]['id'];}_0x467d4a[_0xd182('0x5b')][_0xd182('0x5e')]=!![];_0x467d4a[_0xd182('0x5b')][_0xd182('0x5f')]=moment()['format'](_0xd182('0x60'));_0x467d4a[_0xd182('0x5b')][_0xd182('0x61')]=_0x467d4a[_0xd182('0x5b')][_0xd182('0x61')]||_0x467d4a[_0xd182('0x62')]['id'];_0x44f0da['agent']['id']=_0x467d4a[_0xd182('0x5b')]['UserId'];return db[_0xd182('0x3f')][_0xd182('0x5a')]({'where':{'id':_0x467d4a[_0xd182('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x377fa3,null))['then'](saveUpdates(_0x467d4a[_0xd182('0x5b')],null))[_0xd182('0x24')](function(_0x87234c){if(_0x87234c){_0x44f0da[_0xd182('0x2a')]=_0x87234c[_0xd182('0x63')]({'plain':!![]});return db[_0xd182('0x64')][_0xd182('0x5a')]({'where':{'id':_0x87234c[_0xd182('0x65')]}});}return null;})[_0xd182('0x24')](handleEntityNotFound(_0x377fa3,null))[_0xd182('0x24')](function(_0x28d645){if(_0x28d645){return _0x28d645[_0xd182('0x38')]({'UserId':_0x467d4a[_0xd182('0x5b')][_0xd182('0x61')],'read1stAt':_[_0xd182('0x66')](_0x28d645[_0xd182('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd182('0x24')](function(_0x21c2bb){if(_0x21c2bb){_0x44f0da[_0xd182('0x68')]=_0x21c2bb[_0xd182('0x63')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x467d4a[_0xd182('0x62')]['id'],_0x467d4a[_0xd182('0x62')][_0xd182('0x3b')],_0x467d4a[_0xd182('0x62')][_0xd182('0x69')],_0x44f0da[_0xd182('0x68')]['id'],_0x467d4a[_0xd182('0x5b')]?JSON[_0xd182('0x6a')](_0x467d4a[_0xd182('0x5b')]):'null');return respondWithRpcPromise('AcceptMessage',_0xd182('0x6b'),_0x44f0da);}return null;})[_0xd182('0x24')](function(_0x179914){var _0x316fe0=_0xd182('0x6c')+_0x179914[_0xd182('0x2a')][_0xd182('0x6d')];return db[_0xd182('0x6e')][_0xd182('0x44')](_0x316fe0,{'type':db[_0xd182('0x6f')][_0xd182('0x70')][_0xd182('0x71')],'raw':!![]})[_0xd182('0x24')](function(_0x2d005f){return _0x2d005f;});})[_0xd182('0x24')](function(_0x2ea583){if(_0x2ea583){_0x44f0da['message']['contact']=_0x2ea583[0x0];if(!_0x467d4a['body'][_0xd182('0x61')])return;return db[_0xd182('0x72')]['find']({'where':{'id':_0x467d4a[_0xd182('0x5b')][_0xd182('0x61')],'role':'agent'},'attributes':['id',_0xd182('0x3b'),_0xd182('0x73'),_0xd182('0x74'),_0xd182('0x75')],'raw':!![]});}return null;})[_0xd182('0x24')](function(_0x2294bb){if(!_0x2294bb)return null;_0x44f0da[_0xd182('0x2a')][_0xd182('0x76')]=_0x2294bb;return _0x44f0da;})[_0xd182('0x24')](function(_0x14e960){if(_0x14e960){if(_0x467d4a[_0xd182('0x5b')][_0xd182('0x77')]){_0x44f0da[_0xd182('0x2a')][_0xd182('0x78')]=util[_0xd182('0x79')](_0xd182('0x7a'),_0x467d4a[_0xd182('0x62')][_0xd182('0x3b')]);_0x44f0da['message'][_0xd182('0x7b')]=_0x44f0da[_0xd182('0x7b')];_0x44f0da[_0xd182('0x2a')][_0xd182('0x7c')]=_0xd182('0x5d');return respondWithRpcPromise(_0xd182('0x7d'),_0xd182('0x7d'),{'event':'acceptmessage','message':_0x44f0da[_0xd182('0x2a')]},client9002)[_0xd182('0x24')](function(){return _0x44f0da;});}return _0x44f0da;}return null;})[_0xd182('0x24')](respondWithResult(_0x377fa3,null))[_0xd182('0x2c')](handleError(_0x377fa3,null));};var interaction_log=require(_0xd182('0x17'))(_0xd182('0x7e'));exports[_0xd182('0x7f')]=function(_0xbee2c6,_0x5296fd,_0x5d958e){var _0x47a565={'agent':{},'channel':_0xd182('0x80')};if(_0xbee2c6[_0xd182('0x5b')]['id']){delete _0xbee2c6[_0xd182('0x5b')]['id'];}_0xbee2c6[_0xd182('0x5b')][_0xd182('0x61')]=_0xbee2c6[_0xd182('0x5b')][_0xd182('0x61')]||_0xbee2c6['user']['id'];_0x47a565['agent']['id']=_0xbee2c6[_0xd182('0x5b')][_0xd182('0x61')];return db[_0xd182('0x3f')][_0xd182('0x5a')]({'where':{'id':_0xbee2c6[_0xd182('0x57')]['id'],'UserId':null}})[_0xd182('0x24')](handleEntityNotFound(_0x5296fd,null))[_0xd182('0x24')](function(_0x16a9e6){if(_0x16a9e6){_0x47a565[_0xd182('0x2a')]=_0x16a9e6['get']({'plain':!![]});return db[_0xd182('0x64')][_0xd182('0x5a')]({'where':{'id':_0x16a9e6[_0xd182('0x65')]}});}return null;})[_0xd182('0x24')](handleEntityNotFound(_0x5296fd,null))[_0xd182('0x24')](function(_0x27ae4c){if(_0x27ae4c){_0x47a565[_0xd182('0x68')]=_0x27ae4c[_0xd182('0x63')]({'plain':!![]});interaction_log[_0xd182('0x81')](_0xd182('0x82'),_0xbee2c6[_0xd182('0x62')]['id'],_0xbee2c6[_0xd182('0x62')][_0xd182('0x3b')],_0xbee2c6[_0xd182('0x62')]['role'],_0x47a565[_0xd182('0x68')]['id'],_0xbee2c6['body']?JSON[_0xd182('0x6a')](_0xbee2c6['body']):_0xd182('0x83'));return respondWithRpcPromise('RejectMessage',_0xd182('0x84'),_0x47a565);}return null;})[_0xd182('0x24')](function(_0x2b97ce){var _0x372f58=_0xd182('0x6c')+_0x2b97ce['message'][_0xd182('0x6d')];return db[_0xd182('0x6e')][_0xd182('0x44')](_0x372f58,{'type':db[_0xd182('0x6f')][_0xd182('0x70')][_0xd182('0x71')],'raw':!![]})[_0xd182('0x24')](function(_0x3e45f9){return _0x3e45f9;});})['then'](function(_0x1f73c9){if(_0x1f73c9){_0x47a565[_0xd182('0x2a')]['contact']=_0x1f73c9[0x0];if(!_0xbee2c6[_0xd182('0x5b')][_0xd182('0x61')])return;return db[_0xd182('0x72')][_0xd182('0x5a')]({'where':{'id':_0xbee2c6[_0xd182('0x5b')][_0xd182('0x61')],'role':'agent'},'attributes':['id','name','fullname',_0xd182('0x74'),'internal'],'raw':!![]});}return null;})[_0xd182('0x24')](function(_0x3d4ef5){if(!_0x3d4ef5)return null;_0x47a565['message'][_0xd182('0x76')]=_0x3d4ef5;return _0x47a565;})[_0xd182('0x24')](function(_0x292a42){if(_0x292a42){_0x292a42[_0xd182('0x2a')][_0xd182('0x78')]=util['format'](_0xd182('0x7a'),_0xbee2c6['user'][_0xd182('0x3b')]);_0x292a42['message'][_0xd182('0x7b')]=_0x47a565[_0xd182('0x7b')];_0x292a42[_0xd182('0x2a')][_0xd182('0x7c')]='reject';respondWithRpcPromise(_0xd182('0x7d'),'EventManager',{'event':_0xd182('0x85'),'message':_0x292a42[_0xd182('0x2a')]},client9002);return _0x47a565;}return null;})[_0xd182('0x24')](respondWithResult(_0x5296fd,null))[_0xd182('0x2c')](handleError(_0x5296fd,null));};exports['create']=function(_0x212a4f,_0x3144fa){var _0x2d7809;return db['FaxMessage']['create'](_0x212a4f[_0xd182('0x5b')],{})['then'](function(_0x11f582){_0x2d7809=_0x11f582;return db[_0xd182('0x86')][_0xd182('0x87')]({'where':{'id':_0x2d7809[_0xd182('0x6d')]}});})[_0xd182('0x24')](function(_0x57fb54){if(_[_0xd182('0x66')](_0x57fb54)){return;}else{_0x2d7809[_0xd182('0x80')]=_0x57fb54['fax'];return db['Attachment'][_0xd182('0x87')]({'where':{'id':_0x2d7809[_0xd182('0x88')]}});}})['then'](function(_0x19b80c){return respondWithRpcPromise('SendFax',_0xd182('0x89'),{'FaxAccountId':_['isNil'](_0x212a4f['body'])?undefined:_0x212a4f[_0xd182('0x5b')][_0xd182('0x8a')],'path':_[_0xd182('0x66')](_0x19b80c)?undefined:util[_0xd182('0x79')](_0xd182('0x8b'),_0x19b80c[_0xd182('0x8c')]),'fax':_[_0xd182('0x66')](_0x2d7809[_0xd182('0x80')])?undefined:_0x2d7809[_0xd182('0x80')],'AttachmentId':_0x2d7809[_0xd182('0x88')]},client9002);})[_0xd182('0x24')](respondWithResult(_0x3144fa,0xc9))[_0xd182('0x2c')](handleError(_0x3144fa,null));};exports[_0xd182('0x8d')]=function(_0x43df71,_0x23d852){var _0x3b4408=path[_0xd182('0x8e')](config[_0xd182('0x8f')],_0xd182('0x90'),_0xd182('0x91'),_0xd182('0x92'));return db[_0xd182('0x3f')][_0xd182('0x5a')]({'where':{'id':_0x43df71[_0xd182('0x57')]['id']},'include':[{'model':db['Attachment'],'as':_0xd182('0x93')}]})['then'](handleEntityNotFound(_0x23d852,null))[_0xd182('0x24')](function(_0xec13d6){if(_0xec13d6){return _0x23d852['download'](path[_0xd182('0x8e')](_0x3b4408,_0xec13d6[_0xd182('0x93')][_0xd182('0x8c')]));}})[_0xd182('0x2c')](handleError(_0x23d852,null));}; \ No newline at end of file +var _0x1ee3=['set','Content-Range','apply','reject','update','then','destroy','name','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','show','params','intersection','length','include','find','body','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','isNil','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','QueryTypes','contact','User','agent','email','manual','interface','SIP/%s','channel','event','EventManager','fax','RejectMessage','rejectMessage','sequelize','Sequelize','SELECT','fullname','internal','create','CmContact','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','register','jayson/promise','http','client','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ee3,0x17a));var _0x31ee=function(_0x359585,_0x52adf5){_0x359585=_0x359585-0x0;var _0x5b4e4f=_0x1ee3[_0x359585];return _0x5b4e4f;};'use strict';var emlformat=require(_0x31ee('0x0'));var rimraf=require(_0x31ee('0x1'));var zipdir=require(_0x31ee('0x2'));var jsonpatch=require(_0x31ee('0x3'));var rp=require(_0x31ee('0x4'));var moment=require(_0x31ee('0x5'));var BPromise=require(_0x31ee('0x6'));var Mustache=require(_0x31ee('0x7'));var util=require(_0x31ee('0x8'));var path=require(_0x31ee('0x9'));var sox=require(_0x31ee('0xa'));var csv=require('to-csv');var ejs=require(_0x31ee('0xb'));var fs=require('fs');var fs_extra=require(_0x31ee('0xc'));var _=require(_0x31ee('0xd'));var squel=require(_0x31ee('0xe'));var crypto=require(_0x31ee('0xf'));var jsforce=require(_0x31ee('0x10'));var deskjs=require(_0x31ee('0x11'));var toCsv=require(_0x31ee('0x12'));var querystring=require(_0x31ee('0x13'));var Papa=require(_0x31ee('0x14'));var Redis=require(_0x31ee('0x15'));var authService=require(_0x31ee('0x16'));var qs=require(_0x31ee('0x17'));var as=require(_0x31ee('0x18'));var hardwareService=require(_0x31ee('0x19'));var logger=require(_0x31ee('0x1a'))('api');var utils=require(_0x31ee('0x1b'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x31ee('0x1c')]=_[_0x31ee('0x1d')](config[_0x31ee('0x1c')],{'host':_0x31ee('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x31ee('0x1c')]));require('./faxMessage.socket')[_0x31ee('0x1f')](socket);var jayson=require(_0x31ee('0x20'));var client=jayson['client'][_0x31ee('0x21')]({'port':0x232c});var client9002=jayson[_0x31ee('0x22')][_0x31ee('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1de004,_0x402fa4,_0xbf8a8e,_0xe3c376){return new BPromise(function(_0x43193f,_0x3fe977){var _0x4d5d04=_0xe3c376||client;return _0x4d5d04[_0x31ee('0x23')](_0x1de004,_0xbf8a8e)['then'](function(_0x7ec8ae){logger[_0x31ee('0x24')](_0x31ee('0x25'),_0x402fa4,'request\x20sent');logger[_0x31ee('0x26')](_0x31ee('0x27'),_0x402fa4,'request\x20sent',JSON[_0x31ee('0x28')](_0x7ec8ae));if(_0x7ec8ae[_0x31ee('0x29')]){if(_0x7ec8ae[_0x31ee('0x29')]['code']===0x1f4){logger['error'](_0x31ee('0x25'),_0x402fa4,_0x7ec8ae[_0x31ee('0x29')]['message']);return _0x3fe977(_0x7ec8ae[_0x31ee('0x29')][_0x31ee('0x2a')]);}logger[_0x31ee('0x29')](_0x31ee('0x25'),_0x402fa4,_0x7ec8ae[_0x31ee('0x29')][_0x31ee('0x2a')]);return _0x43193f(_0x7ec8ae[_0x31ee('0x29')][_0x31ee('0x2a')]);}else{logger['info'](_0x31ee('0x25'),_0x402fa4,_0x31ee('0x2b'));_0x43193f(_0x7ec8ae[_0x31ee('0x2c')][_0x31ee('0x2a')]);}})[_0x31ee('0x2d')](function(_0x1ff435){logger[_0x31ee('0x29')](_0x31ee('0x25'),_0x402fa4,_0x1ff435);_0x3fe977(_0x1ff435);});});}function respondWithStatusCode(_0x4ee9ea,_0x55f90e){_0x55f90e=_0x55f90e||0xcc;return function(_0x4c4d7f){if(_0x4c4d7f){return _0x4ee9ea[_0x31ee('0x2e')](_0x55f90e);}return _0x4ee9ea[_0x31ee('0x2f')](_0x55f90e)[_0x31ee('0x30')]();};}function respondWithResult(_0x3ecf09,_0x513904){_0x513904=_0x513904||0xc8;return function(_0xc0f728){if(_0xc0f728){return _0x3ecf09[_0x31ee('0x2f')](_0x513904)[_0x31ee('0x31')](_0xc0f728);}};}function respondWithFilteredResult(_0x3e0686,_0x3fff20){return function(_0x1dde9d){if(_0x1dde9d){var _0x9fa282=typeof _0x3fff20[_0x31ee('0x32')]===_0x31ee('0x33')&&typeof _0x3fff20[_0x31ee('0x34')]===_0x31ee('0x33');var _0x2e4985=_0x1dde9d[_0x31ee('0x35')];var _0x58f049=_0x9fa282?0x0:_0x3fff20[_0x31ee('0x32')];var _0x13dc77=_0x9fa282?_0x1dde9d['count']:_0x3fff20[_0x31ee('0x32')]+_0x3fff20[_0x31ee('0x34')];var _0x3a62df;if(_0x13dc77>=_0x2e4985){_0x13dc77=_0x2e4985;_0x3a62df=0xc8;}else{_0x3a62df=0xce;}_0x3e0686[_0x31ee('0x2f')](_0x3a62df);return _0x3e0686[_0x31ee('0x36')](_0x31ee('0x37'),_0x58f049+'-'+_0x13dc77+'/'+_0x2e4985)['json'](_0x1dde9d);}return null;};}function patchUpdates(_0x28d952){return function(_0x3d0c6f){try{jsonpatch[_0x31ee('0x38')](_0x3d0c6f,_0x28d952,!![]);}catch(_0xb23f95){return BPromise[_0x31ee('0x39')](_0xb23f95);}return _0x3d0c6f['save']();};}function saveUpdates(_0x529c5e,_0x4e8667){return function(_0x257df9){if(_0x257df9){return _0x257df9[_0x31ee('0x3a')](_0x529c5e)[_0x31ee('0x3b')](function(_0x1dad39){return _0x1dad39;});}return null;};}function removeEntity(_0x22e507,_0x1c43cf){return function(_0x2ac8f0){if(_0x2ac8f0){return _0x2ac8f0[_0x31ee('0x3c')]()[_0x31ee('0x3b')](function(){_0x22e507['status'](0xcc)[_0x31ee('0x30')]();});}};}function handleEntityNotFound(_0x2b615d,_0x52addb){return function(_0x4592cb){if(!_0x4592cb){_0x2b615d[_0x31ee('0x2e')](0x194);}return _0x4592cb;};}function handleError(_0x4e4c71,_0x346a83){_0x346a83=_0x346a83||0x1f4;return function(_0x138da5){logger[_0x31ee('0x29')](_0x138da5['stack']);if(_0x138da5[_0x31ee('0x3d')]){delete _0x138da5['name'];}_0x4e4c71[_0x31ee('0x2f')](_0x346a83)['send'](_0x138da5);};}exports[_0x31ee('0x3e')]=function(_0x34d80c,_0x458ad5){var _0x2796f1={},_0x2724b6={},_0x1f5256={'count':0x0,'rows':[]};var _0x2ef1f3=_[_0x31ee('0x3f')](db[_0x31ee('0x40')][_0x31ee('0x41')],function(_0x404613){return{'name':_0x404613['fieldName'],'type':_0x404613[_0x31ee('0x42')][_0x31ee('0x43')]};});_0x2724b6[_0x31ee('0x44')]=_['map'](_0x2ef1f3,_0x31ee('0x3d'));_0x2724b6[_0x31ee('0x45')]=_[_0x31ee('0x46')](_0x34d80c[_0x31ee('0x45')]);_0x2724b6['filters']=_['intersection'](_0x2724b6[_0x31ee('0x44')],_0x2724b6[_0x31ee('0x45')]);_0x2796f1[_0x31ee('0x47')]=_['intersection'](_0x2724b6[_0x31ee('0x44')],qs[_0x31ee('0x48')](_0x34d80c[_0x31ee('0x45')][_0x31ee('0x48')]));_0x2796f1[_0x31ee('0x47')]=_0x2796f1[_0x31ee('0x47')]['length']?_0x2796f1[_0x31ee('0x47')]:_0x2724b6['model'];if(!_0x34d80c[_0x31ee('0x45')][_0x31ee('0x49')]('nolimit')){_0x2796f1[_0x31ee('0x34')]=qs[_0x31ee('0x34')](_0x34d80c[_0x31ee('0x45')][_0x31ee('0x34')]);_0x2796f1[_0x31ee('0x32')]=qs[_0x31ee('0x32')](_0x34d80c[_0x31ee('0x45')][_0x31ee('0x32')]);}_0x2796f1[_0x31ee('0x4a')]=qs[_0x31ee('0x4b')](_0x34d80c[_0x31ee('0x45')][_0x31ee('0x4b')]);_0x2796f1['where']=qs[_0x31ee('0x4c')](_[_0x31ee('0x4d')](_0x34d80c['query'],_0x2724b6[_0x31ee('0x4c')]),_0x2ef1f3);if(_0x34d80c[_0x31ee('0x45')]['filter']){_0x2796f1[_0x31ee('0x4e')]=_[_0x31ee('0x4f')](_0x2796f1[_0x31ee('0x4e')],{'$or':_['map'](_0x2ef1f3,function(_0x4da098){if(_0x4da098[_0x31ee('0x42')]!==_0x31ee('0x50')){var _0x188614={};_0x188614[_0x4da098['name']]={'$like':'%'+_0x34d80c['query'][_0x31ee('0x51')]+'%'};return _0x188614;}})});}_0x2796f1=_[_0x31ee('0x4f')]({},_0x2796f1,_0x34d80c[_0x31ee('0x52')]);var _0x10c091={'where':_0x2796f1[_0x31ee('0x4e')]};return db[_0x31ee('0x40')]['count'](_0x10c091)[_0x31ee('0x3b')](function(_0x5ca839){_0x1f5256[_0x31ee('0x35')]=_0x5ca839;if(_0x34d80c[_0x31ee('0x45')][_0x31ee('0x53')]){_0x2796f1['include']=[{'all':!![]}];}return db[_0x31ee('0x40')]['findAll'](_0x2796f1);})['then'](function(_0x50c335){_0x1f5256[_0x31ee('0x54')]=_0x50c335;return _0x1f5256;})[_0x31ee('0x3b')](respondWithFilteredResult(_0x458ad5,_0x2796f1))[_0x31ee('0x2d')](handleError(_0x458ad5,null));};exports[_0x31ee('0x55')]=function(_0x4af2d0,_0xffd3a1){var _0x17eb9e={'raw':!![],'where':{'id':_0x4af2d0[_0x31ee('0x56')]['id']}},_0x2fbbc6={};_0x2fbbc6[_0x31ee('0x44')]=_[_0x31ee('0x46')](db[_0x31ee('0x40')][_0x31ee('0x41')]);_0x2fbbc6[_0x31ee('0x45')]=_[_0x31ee('0x46')](_0x4af2d0[_0x31ee('0x45')]);_0x2fbbc6[_0x31ee('0x4c')]=_[_0x31ee('0x57')](_0x2fbbc6[_0x31ee('0x44')],_0x2fbbc6[_0x31ee('0x45')]);_0x17eb9e[_0x31ee('0x47')]=_[_0x31ee('0x57')](_0x2fbbc6[_0x31ee('0x44')],qs[_0x31ee('0x48')](_0x4af2d0[_0x31ee('0x45')]['fields']));_0x17eb9e[_0x31ee('0x47')]=_0x17eb9e[_0x31ee('0x47')][_0x31ee('0x58')]?_0x17eb9e[_0x31ee('0x47')]:_0x2fbbc6[_0x31ee('0x44')];if(_0x4af2d0[_0x31ee('0x45')][_0x31ee('0x53')]){_0x17eb9e[_0x31ee('0x59')]=[{'all':!![]}];}_0x17eb9e=_[_0x31ee('0x4f')]({},_0x17eb9e,_0x4af2d0[_0x31ee('0x52')]);return db[_0x31ee('0x40')][_0x31ee('0x5a')](_0x17eb9e)[_0x31ee('0x3b')](handleEntityNotFound(_0xffd3a1,null))[_0x31ee('0x3b')](respondWithResult(_0xffd3a1,null))[_0x31ee('0x2d')](handleError(_0xffd3a1,null));};exports[_0x31ee('0x3a')]=function(_0x3d3689,_0x2b7afd){if(_0x3d3689[_0x31ee('0x5b')]['id']){delete _0x3d3689[_0x31ee('0x5b')]['id'];}return db[_0x31ee('0x40')][_0x31ee('0x5a')]({'where':{'id':_0x3d3689[_0x31ee('0x56')]['id']}})[_0x31ee('0x3b')](handleEntityNotFound(_0x2b7afd,null))[_0x31ee('0x3b')](saveUpdates(_0x3d3689[_0x31ee('0x5b')],null))['then'](respondWithResult(_0x2b7afd,null))[_0x31ee('0x2d')](handleError(_0x2b7afd,null));};exports[_0x31ee('0x3c')]=function(_0x27db88,_0x2b0557){return db[_0x31ee('0x40')][_0x31ee('0x5a')]({'where':{'id':_0x27db88[_0x31ee('0x56')]['id']}})['then'](handleEntityNotFound(_0x2b0557,null))['then'](removeEntity(_0x2b0557,null))[_0x31ee('0x2d')](handleError(_0x2b0557,null));};exports[_0x31ee('0x5c')]=function(_0x52ddc3,_0x1904c6){return db[_0x31ee('0x40')]['describe']()[_0x31ee('0x3b')](respondWithResult(_0x1904c6,null))[_0x31ee('0x2d')](handleError(_0x1904c6,null));};var interaction_log=require(_0x31ee('0x1a'))(_0x31ee('0x5d'));exports[_0x31ee('0x5e')]=function(_0x1765cf,_0x65849b,_0x28adbd){var _0x141de9={'agent':{},'channel':'fax'};if(_0x1765cf[_0x31ee('0x5b')]['id']){delete _0x1765cf['body']['id'];}_0x1765cf[_0x31ee('0x5b')][_0x31ee('0x5f')]=!![];_0x1765cf['body'][_0x31ee('0x60')]=moment()[_0x31ee('0x61')](_0x31ee('0x62'));_0x1765cf[_0x31ee('0x5b')][_0x31ee('0x63')]=_0x1765cf[_0x31ee('0x5b')][_0x31ee('0x63')]||_0x1765cf['user']['id'];_0x141de9['agent']['id']=_0x1765cf[_0x31ee('0x5b')][_0x31ee('0x63')];return db[_0x31ee('0x40')][_0x31ee('0x5a')]({'where':{'id':_0x1765cf[_0x31ee('0x56')]['id'],'UserId':null}})[_0x31ee('0x3b')](handleEntityNotFound(_0x65849b,null))[_0x31ee('0x3b')](saveUpdates(_0x1765cf[_0x31ee('0x5b')],null))['then'](function(_0xc4d37a){if(_0xc4d37a){_0x141de9[_0x31ee('0x2a')]=_0xc4d37a[_0x31ee('0x64')]({'plain':!![]});return db[_0x31ee('0x65')][_0x31ee('0x5a')]({'where':{'id':_0xc4d37a[_0x31ee('0x66')]}});}return null;})[_0x31ee('0x3b')](handleEntityNotFound(_0x65849b,null))['then'](function(_0x42f45a){if(_0x42f45a){return _0x42f45a['update']({'UserId':_0x1765cf[_0x31ee('0x5b')][_0x31ee('0x63')],'read1stAt':_[_0x31ee('0x67')](_0x42f45a['read1stAt'])?moment()[_0x31ee('0x61')](_0x31ee('0x62')):undefined});}return null;})[_0x31ee('0x3b')](function(_0x167055){if(_0x167055){_0x141de9[_0x31ee('0x68')]=_0x167055['get']({'plain':!![]});interaction_log[_0x31ee('0x24')](_0x31ee('0x69'),_0x1765cf[_0x31ee('0x6a')]['id'],_0x1765cf[_0x31ee('0x6a')][_0x31ee('0x3d')],_0x1765cf['user'][_0x31ee('0x6b')],_0x141de9[_0x31ee('0x68')]['id'],_0x1765cf['body']?JSON[_0x31ee('0x28')](_0x1765cf['body']):_0x31ee('0x6c'));return respondWithRpcPromise(_0x31ee('0x6d'),_0x31ee('0x6e'),_0x141de9);}return null;})['then'](function(_0x203cd1){var _0x4600df=_0x31ee('0x6f')+_0x203cd1[_0x31ee('0x2a')][_0x31ee('0x70')];return db['sequelize'][_0x31ee('0x45')](_0x4600df,{'type':db['Sequelize'][_0x31ee('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x45eb83){return _0x45eb83;});})[_0x31ee('0x3b')](function(_0x530e9f){if(_0x530e9f){_0x141de9[_0x31ee('0x2a')][_0x31ee('0x72')]=_0x530e9f[0x0];if(!_0x1765cf[_0x31ee('0x5b')]['UserId'])return;return db[_0x31ee('0x73')]['find']({'where':{'id':_0x1765cf[_0x31ee('0x5b')][_0x31ee('0x63')],'role':_0x31ee('0x74')},'attributes':['id',_0x31ee('0x3d'),'fullname',_0x31ee('0x75'),'internal'],'raw':!![]});}return null;})[_0x31ee('0x3b')](function(_0x1b5dfa){if(!_0x1b5dfa)return null;_0x141de9[_0x31ee('0x2a')]['agent']=_0x1b5dfa;return _0x141de9;})[_0x31ee('0x3b')](function(_0x8b5bcd){if(_0x8b5bcd){if(_0x1765cf[_0x31ee('0x5b')][_0x31ee('0x76')]){_0x141de9['message'][_0x31ee('0x77')]=util['format'](_0x31ee('0x78'),_0x1765cf[_0x31ee('0x6a')][_0x31ee('0x3d')]);_0x141de9[_0x31ee('0x2a')][_0x31ee('0x79')]=_0x141de9[_0x31ee('0x79')];_0x141de9[_0x31ee('0x2a')][_0x31ee('0x7a')]='accept';return respondWithRpcPromise(_0x31ee('0x7b'),_0x31ee('0x7b'),{'event':'acceptmessage','message':_0x141de9[_0x31ee('0x2a')]},client9002)[_0x31ee('0x3b')](function(){return _0x141de9;});}return _0x141de9;}return null;})['then'](respondWithResult(_0x65849b,null))['catch'](handleError(_0x65849b,null));};var interaction_log=require('../../config/logger')(_0x31ee('0x5d'));exports[_0x31ee('0x39')]=function(_0x55c6b4,_0x1bf3a2,_0x3dd20d){var _0x3cdebb={'agent':{},'channel':_0x31ee('0x7c')};if(_0x55c6b4['body']['id']){delete _0x55c6b4[_0x31ee('0x5b')]['id'];}_0x55c6b4[_0x31ee('0x5b')]['UserId']=_0x55c6b4[_0x31ee('0x5b')][_0x31ee('0x63')]||_0x55c6b4[_0x31ee('0x6a')]['id'];_0x3cdebb['agent']['id']=_0x55c6b4[_0x31ee('0x5b')][_0x31ee('0x63')];return db[_0x31ee('0x40')][_0x31ee('0x5a')]({'where':{'id':_0x55c6b4['params']['id'],'UserId':null}})[_0x31ee('0x3b')](handleEntityNotFound(_0x1bf3a2,null))[_0x31ee('0x3b')](function(_0x1b9868){if(_0x1b9868){_0x3cdebb[_0x31ee('0x2a')]=_0x1b9868['get']({'plain':!![]});return db[_0x31ee('0x65')]['find']({'where':{'id':_0x1b9868[_0x31ee('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x1bf3a2,null))[_0x31ee('0x3b')](function(_0x33904a){if(_0x33904a){_0x3cdebb['interaction']=_0x33904a[_0x31ee('0x64')]({'plain':!![]});interaction_log[_0x31ee('0x24')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x55c6b4[_0x31ee('0x6a')]['id'],_0x55c6b4['user']['name'],_0x55c6b4['user'][_0x31ee('0x6b')],_0x3cdebb[_0x31ee('0x68')]['id'],_0x55c6b4['body']?JSON[_0x31ee('0x28')](_0x55c6b4[_0x31ee('0x5b')]):'null');return respondWithRpcPromise(_0x31ee('0x7d'),_0x31ee('0x7e'),_0x3cdebb);}return null;})[_0x31ee('0x3b')](function(_0x4bc869){var _0x495557=_0x31ee('0x6f')+_0x4bc869[_0x31ee('0x2a')][_0x31ee('0x70')];return db[_0x31ee('0x7f')][_0x31ee('0x45')](_0x495557,{'type':db[_0x31ee('0x80')][_0x31ee('0x71')][_0x31ee('0x81')],'raw':!![]})[_0x31ee('0x3b')](function(_0x31e90c){return _0x31e90c;});})[_0x31ee('0x3b')](function(_0x5014c2){if(_0x5014c2){_0x3cdebb[_0x31ee('0x2a')][_0x31ee('0x72')]=_0x5014c2[0x0];if(!_0x55c6b4[_0x31ee('0x5b')][_0x31ee('0x63')])return;return db['User'][_0x31ee('0x5a')]({'where':{'id':_0x55c6b4[_0x31ee('0x5b')][_0x31ee('0x63')],'role':_0x31ee('0x74')},'attributes':['id',_0x31ee('0x3d'),_0x31ee('0x82'),_0x31ee('0x75'),_0x31ee('0x83')],'raw':!![]});}return null;})[_0x31ee('0x3b')](function(_0x46facd){if(!_0x46facd)return null;_0x3cdebb[_0x31ee('0x2a')]['agent']=_0x46facd;return _0x3cdebb;})[_0x31ee('0x3b')](function(_0x408e06){if(_0x408e06){_0x408e06[_0x31ee('0x2a')]['interface']=util['format'](_0x31ee('0x78'),_0x55c6b4['user']['name']);_0x408e06[_0x31ee('0x2a')][_0x31ee('0x79')]=_0x3cdebb[_0x31ee('0x79')];_0x408e06['message'][_0x31ee('0x7a')]=_0x31ee('0x39');respondWithRpcPromise('EventManager',_0x31ee('0x7b'),{'event':'rejectmessage','message':_0x408e06[_0x31ee('0x2a')]},client9002);return _0x3cdebb;}return null;})[_0x31ee('0x3b')](respondWithResult(_0x1bf3a2,null))[_0x31ee('0x2d')](handleError(_0x1bf3a2,null));};exports[_0x31ee('0x84')]=function(_0x5a5b80,_0x441e76){var _0x53f91b;return db[_0x31ee('0x40')][_0x31ee('0x84')](_0x5a5b80['body'],{})['then'](function(_0x3a9783){_0x53f91b=_0x3a9783;return db[_0x31ee('0x85')]['findOne']({'where':{'id':_0x53f91b[_0x31ee('0x70')]}});})[_0x31ee('0x3b')](function(_0x169485){if(_[_0x31ee('0x67')](_0x169485)){return;}else{_0x53f91b['fax']=_0x169485[_0x31ee('0x7c')];return db[_0x31ee('0x86')]['findOne']({'where':{'id':_0x53f91b[_0x31ee('0x87')]}});}})['then'](function(_0x43c17d){return respondWithRpcPromise('SendFax',_0x31ee('0x88'),{'FaxAccountId':_['isNil'](_0x5a5b80['body'])?undefined:_0x5a5b80[_0x31ee('0x5b')]['FaxAccountId'],'path':_[_0x31ee('0x67')](_0x43c17d)?undefined:util[_0x31ee('0x61')](_0x31ee('0x89'),_0x43c17d[_0x31ee('0x8a')]),'fax':_[_0x31ee('0x67')](_0x53f91b[_0x31ee('0x7c')])?undefined:_0x53f91b[_0x31ee('0x7c')],'AttachmentId':_0x53f91b['AttachmentId']},client9002);})['then'](respondWithResult(_0x441e76,0xc9))[_0x31ee('0x2d')](handleError(_0x441e76,null));};exports['download']=function(_0x67fe85,_0x4af1a5){var _0x45c85c=path[_0x31ee('0x8b')](config[_0x31ee('0x8c')],'server',_0x31ee('0x8d'),_0x31ee('0x8e'));return db[_0x31ee('0x40')][_0x31ee('0x5a')]({'where':{'id':_0x67fe85[_0x31ee('0x56')]['id']},'include':[{'model':db[_0x31ee('0x86')],'as':'Attachment'}]})[_0x31ee('0x3b')](handleEntityNotFound(_0x4af1a5,null))[_0x31ee('0x3b')](function(_0x1564f9){if(_0x1564f9){return _0x4af1a5[_0x31ee('0x8f')](path['join'](_0x45c85c,_0x1564f9['Attachment'][_0x31ee('0x8a')]));}})['catch'](handleError(_0x4af1a5,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index de146a8..cc21399 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 _0xfc9b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xfc9b,0x74));var _0xbfc9=function(_0x50d122,_0x3ac498){_0x50d122=_0x50d122-0x0;var _0x527773=_0xfc9b[_0x50d122];return _0x527773;};'use strict';var EventEmitter=require(_0xbfc9('0x0'));var FaxMessage=require(_0xbfc9('0x1'))['db'][_0xbfc9('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbfc9('0x3')](0x0);var events={'afterCreate':_0xbfc9('0x4'),'afterUpdate':_0xbfc9('0x5'),'afterDestroy':_0xbfc9('0x6')};function emitEvent(_0x5b30b2){return function(_0x2eedb4,_0x49e470,_0x12beb4){FaxMessageEvents[_0xbfc9('0x7')](_0x5b30b2+':'+_0x2eedb4['id'],_0x2eedb4);FaxMessageEvents['emit'](_0x5b30b2,_0x2eedb4);_0x12beb4(null);};}for(var e in events){if(events[_0xbfc9('0x8')](e)){var event=events[e];FaxMessage[_0xbfc9('0x9')](e,emitEvent(event));}}module[_0xbfc9('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x1c75=['emit','hasOwnProperty','hook','events','save','update','remove'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0x1c75,0xce));var _0x51c7=function(_0x5d5f03,_0x4d8cfc){_0x5d5f03=_0x5d5f03-0x0;var _0x4e1cb8=_0x1c75[_0x5d5f03];return _0x4e1cb8;};'use strict';var EventEmitter=require(_0x51c7('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x51c7('0x1'),'afterUpdate':_0x51c7('0x2'),'afterDestroy':_0x51c7('0x3')};function emitEvent(_0x1760f6){return function(_0xf1dc95,_0x1fc6c4,_0x17e359){FaxMessageEvents[_0x51c7('0x4')](_0x1760f6+':'+_0xf1dc95['id'],_0xf1dc95);FaxMessageEvents[_0x51c7('0x4')](_0x1760f6,_0xf1dc95);_0x17e359(null);};}for(var e in events){if(events[_0x51c7('0x5')](e)){var event=events[e];FaxMessage[_0x51c7('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d6cb5c9..fe3b1c8 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 _0xd71c=['fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x889ee7,_0xb996b0){var _0x4aa6a2=function(_0x16968b){while(--_0x16968b){_0x889ee7['push'](_0x889ee7['shift']());}};_0x4aa6a2(++_0xb996b0);}(_0xd71c,0x67));var _0xcd71=function(_0x1d4a39,_0x213f29){_0x1d4a39=_0x1d4a39-0x0;var _0x408a6d=_0xd71c[_0x1d4a39];return _0x408a6d;};'use strict';var _=require(_0xcd71('0x0'));var util=require(_0xcd71('0x1'));var logger=require(_0xcd71('0x2'))('api');var moment=require(_0xcd71('0x3'));var BPromise=require(_0xcd71('0x4'));var rp=require(_0xcd71('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd71('0x6'));var config=require(_0xcd71('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x17e32a,_0x4a0b17){return _0x17e32a[_0xcd71('0x8')]('FaxMessage',attributes,{'tableName':_0xcd71('0x9'),'paranoid':![],'indexes':[{'name':_0xcd71('0xa'),'fields':[_0xcd71('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59f6f7,_0x5a7acc,_0x4ccbb2){var _0x5eef68=_0x17e32a[_0xcd71('0xc')];var _0x44b399=_0x59f6f7[_0xcd71('0xd')]({'plain':!![]});if(_0x44b399[_0xcd71('0xe')]['toLowerCase']()==='in'||_0x44b399['direction'][_0xcd71('0xf')]()==='out'&&!_0x44b399[_0xcd71('0x10')]&&!_['isNil'](_0x44b399[_0xcd71('0x11')])){_0x5eef68[_0xcd71('0x12')][_0xcd71('0x13')]({'where':{'id':_0x44b399[_0xcd71('0x14')]}})[_0xcd71('0x15')](function(_0x57a6cc){if(_0x57a6cc){_0x57a6cc[_0xcd71('0x16')]({'lastMsgAt':_0x44b399[_0xcd71('0x17')],'lastMsgDirection':_0x44b399['direction'][_0xcd71('0xf')]()});}})[_0xcd71('0x18')](function(_0x2955f8){console[_0xcd71('0x19')](_0x2955f8);});}_0x4ccbb2();}},'charset':_0xcd71('0x1a'),'collate':_0xcd71('0x1b')});}; \ No newline at end of file +var _0x4e54=['UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0x4e54,0x183));var _0x44e5=function(_0x5a83ba,_0x22224b){_0x5a83ba=_0x5a83ba-0x0;var _0x5ea143=_0x4e54[_0x5a83ba];return _0x5ea143;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x44e5('0x0'))(_0x44e5('0x1'));var moment=require(_0x44e5('0x2'));var BPromise=require(_0x44e5('0x3'));var rp=require(_0x44e5('0x4'));var fs=require('fs');var path=require(_0x44e5('0x5'));var rimraf=require(_0x44e5('0x6'));var config=require(_0x44e5('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x593bc5,_0x201011){return _0x593bc5[_0x44e5('0x8')](_0x44e5('0x9'),attributes,{'tableName':_0x44e5('0xa'),'paranoid':![],'indexes':[{'name':_0x44e5('0xb'),'fields':[_0x44e5('0xc')],'type':_0x44e5('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32ace9,_0x26560e,_0x424967){var _0x148830=_0x593bc5[_0x44e5('0xe')];var _0xb20267=_0x32ace9[_0x44e5('0xf')]({'plain':!![]});if(_0xb20267[_0x44e5('0x10')][_0x44e5('0x11')]()==='in'||_0xb20267[_0x44e5('0x10')][_0x44e5('0x11')]()==='out'&&!_0xb20267[_0x44e5('0x12')]&&!_['isNil'](_0xb20267[_0x44e5('0x13')])){_0x148830[_0x44e5('0x14')][_0x44e5('0x15')]({'where':{'id':_0xb20267[_0x44e5('0x16')]}})['then'](function(_0x35b4e3){if(_0x35b4e3){_0x35b4e3[_0x44e5('0x17')]({'lastMsgAt':_0xb20267[_0x44e5('0x18')],'lastMsgDirection':_0xb20267[_0x44e5('0x10')][_0x44e5('0x11')]()});}})[_0x44e5('0x19')](function(_0x4a4214){console[_0x44e5('0x1a')](_0x4a4214);});}_0x424967();}},'charset':_0x44e5('0x1b'),'collate':_0x44e5('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index df20389..6d89a5c 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 _0x9c44=['code','message','info','catch','FaxMessage','create','body','options','CreateFaxMessage','stringify','UpdateFaxMessage','update','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});config[_0x49c4('0x9')]=_[_0x49c4('0xa')](config[_0x49c4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0xb'))(new Redis(config[_0x49c4('0x9')]));require(_0x49c4('0xc'))[_0x49c4('0xd')](socket);function respondWithRpcPromise(_0x4c7d3a,_0x5ab4a3,_0x451ea6){return new BPromise(function(_0x313e73,_0x58cad7){return client[_0x49c4('0xe')](_0x4c7d3a,_0x451ea6)[_0x49c4('0xf')](function(_0x4adb3c){logger['info'](_0x49c4('0x10'),_0x5ab4a3,_0x49c4('0x11'));logger['debug'](_0x49c4('0x12'),_0x5ab4a3,_0x49c4('0x11'),JSON['stringify'](_0x4adb3c));if(_0x4adb3c[_0x49c4('0x13')]){if(_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x14')]===0x1f4){logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x58cad7(_0x4adb3c[_0x49c4('0x13')]['message']);}logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x313e73(_0x4adb3c[_0x49c4('0x13')]['message']);}else{logger[_0x49c4('0x16')](_0x49c4('0x10'),_0x5ab4a3,'request\x20sent');_0x313e73(_0x4adb3c['result'][_0x49c4('0x15')]);}})[_0x49c4('0x17')](function(_0x3addb2){logger['error'](_0x49c4('0x10'),_0x5ab4a3,_0x3addb2);_0x58cad7(_0x3addb2);});});}exports['CreateFaxMessage']=function(_0x2cbd50){var _0x1806c2=this;return new Promise(function(_0xe31fcc,_0x291526){return db[_0x49c4('0x18')][_0x49c4('0x19')](_0x2cbd50[_0x49c4('0x1a')],{'raw':_0x2cbd50[_0x49c4('0x1b')]?_0x2cbd50[_0x49c4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57f502){logger[_0x49c4('0x16')]('CreateFaxMessage',_0x2cbd50);logger['debug'](_0x49c4('0x1c'),_0x2cbd50,JSON[_0x49c4('0x1d')](_0x57f502));_0xe31fcc(_0x57f502);})[_0x49c4('0x17')](function(_0xd335e4){logger['error']('CreateFaxMessage',_0xd335e4[_0x49c4('0x15')],_0x2cbd50);_0x291526(_0x1806c2[_0x49c4('0x13')](0x1f4,_0xd335e4['message']));});});};exports[_0x49c4('0x1e')]=function(_0x43e014){var _0x210159=this;return new Promise(function(_0xa7a826,_0x531d92){return db['FaxMessage'][_0x49c4('0x1f')](_0x43e014['body'],{'raw':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e014[_0x49c4('0x1b')]?_0x43e014['options'][_0x49c4('0x21')]||null:null,'attributes':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x22')]||null:null,'limit':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x23')]||null:null})[_0x49c4('0xf')](function(_0x17b50f){logger[_0x49c4('0x16')](_0x49c4('0x1e'),_0x43e014);logger['debug']('UpdateFaxMessage',_0x43e014,JSON['stringify'](_0x17b50f));_0xa7a826(_0x17b50f);})[_0x49c4('0x17')](function(_0x7ee704){logger[_0x49c4('0x13')](_0x49c4('0x1e'),_0x7ee704[_0x49c4('0x15')],_0x43e014);_0x531d92(_0x210159['error'](0x1f4,_0x7ee704[_0x49c4('0x15')]));});});}; \ No newline at end of file +var _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xed1f,0x6a));var _0xfed1=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xed1f[_0x4ae6ef];return _0x3cbb4e;};'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});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 9c53d2f..f5b2966 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 _0x20dd=['update','removeListener','register','faxMessage:','./faxMessage.events','save'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x20dd,0x17e));var _0xd20d=function(_0x19a7f1,_0x1b18d4){_0x19a7f1=_0x19a7f1-0x0;var _0x1493e0=_0x20dd[_0x19a7f1];return _0x1493e0;};'use strict';var FaxMessageEvents=require(_0xd20d('0x0'));var events=[_0xd20d('0x1'),'remove',_0xd20d('0x2')];function createListener(_0x3f4797,_0x19eda4){return function(_0x1ed62d){_0x19eda4['emit'](_0x3f4797,_0x1ed62d);};}function removeListener(_0x33c37b,_0x47d91b){return function(){FaxMessageEvents[_0xd20d('0x3')](_0x33c37b,_0x47d91b);};}exports[_0xd20d('0x4')]=function(_0x5a4dcb){for(var _0xfbc9c1=0x0,_0x1f8e6f=events['length'];_0xfbc9c1<_0x1f8e6f;_0xfbc9c1++){var _0x40ac88=events[_0xfbc9c1];var _0xa7050f=createListener(_0xd20d('0x5')+_0x40ac88,_0x5a4dcb);FaxMessageEvents['on'](_0x40ac88,_0xa7050f);}}; \ No newline at end of file +var _0xc217=['remove','update','removeListener','register','faxMessage:','save'];(function(_0x6da7fd,_0x194362){var _0x4a37cc=function(_0x54bb65){while(--_0x54bb65){_0x6da7fd['push'](_0x6da7fd['shift']());}};_0x4a37cc(++_0x194362);}(_0xc217,0x1eb));var _0x7c21=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0xc217[_0x514c15];return _0x16283e;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x7c21('0x0'),_0x7c21('0x1'),_0x7c21('0x2')];function createListener(_0x19a53f,_0x36b98f){return function(_0xf29e64){_0x36b98f['emit'](_0x19a53f,_0xf29e64);};}function removeListener(_0x156589,_0x466d74){return function(){FaxMessageEvents[_0x7c21('0x3')](_0x156589,_0x466d74);};}exports[_0x7c21('0x4')]=function(_0x3a60f4){for(var _0x2e88a3=0x0,_0x461816=events['length'];_0x2e88a3<_0x461816;_0x2e88a3++){var _0xc9feb4=events[_0x2e88a3];var _0x545038=createListener(_0x7c21('0x5')+_0xc9feb4,_0x3a60f4);FaxMessageEvents['on'](_0xc9feb4,_0x545038);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 8858dc1..05cf470 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 _0xb469=['reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb469,0x13b));var _0x9b46=function(_0x595acb,_0x105d70){_0x595acb=_0x595acb-0x0;var _0x510a74=_0xb469[_0x595acb];return _0x510a74;};'use strict';var multer=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var timeout=require(_0x9b46('0x3'));var express=require(_0x9b46('0x4'));var router=express[_0x9b46('0x5')]();var fs_extra=require(_0x9b46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var controller=require('./faxMessage.controller');router[_0x9b46('0x9')]('/',auth[_0x9b46('0xa')](),controller['index']);router[_0x9b46('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9b46('0xb')]);router['get'](_0x9b46('0xc'),auth[_0x9b46('0xa')](),controller[_0x9b46('0xd')]);router['get'](_0x9b46('0xe'),auth['isAuthenticated'](),controller[_0x9b46('0xf')]);router['post']('/',auth[_0x9b46('0xa')](),interaction['tracked'](_0x9b46('0x10'),_0x9b46('0x11')),controller['create']);router[_0x9b46('0x12')](_0x9b46('0xc'),auth['isAuthenticated'](),controller[_0x9b46('0x13')]);router[_0x9b46('0x12')](_0x9b46('0x14'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x15')]);router[_0x9b46('0x12')](_0x9b46('0x16'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x17')]);router[_0x9b46('0x18')](_0x9b46('0xc'),auth[_0x9b46('0xa')](),controller[_0x9b46('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd404=['/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0x50ac7a,_0x236e14){var _0x1050ef=function(_0x47ac33){while(--_0x47ac33){_0x50ac7a['push'](_0x50ac7a['shift']());}};_0x1050ef(++_0x236e14);}(_0xd404,0x15b));var _0x4d40=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xd404[_0x425716];return _0x2d39af;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),interaction[_0x4d40('0x11')](_0x4d40('0x12'),_0x4d40('0x13')),controller[_0x4d40('0x14')]);router[_0x4d40('0x15')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);router['put'](_0x4d40('0x17'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x18')]);router[_0x4d40('0x15')](_0x4d40('0x19'),auth['isAuthenticated'](),controller[_0x4d40('0x1a')]);router[_0x4d40('0x1b')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1c')]);module[_0x4d40('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2469ce1..8b60d05 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 _0x9ab8=['INTEGER','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x276bb9,_0x5cb763){var _0x593d01=function(_0x5a3499){while(--_0x5a3499){_0x276bb9['push'](_0x276bb9['shift']());}};_0x593d01(++_0x5cb763);}(_0x9ab8,0x81));var _0x89ab=function(_0x5e3e85,_0x13f62d){_0x5e3e85=_0x5e3e85-0x0;var _0xa3c83=_0x9ab8[_0x5e3e85];return _0xa3c83;};'use strict';var Sequelize=require(_0x89ab('0x0'));module[_0x89ab('0x1')]={'name':{'type':Sequelize[_0x89ab('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x89ab('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x89ab('0x4'),_0x89ab('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x89ab('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc12c=['name','STRING','ENUM','rrmemory','sequelize','exports'];(function(_0x3738df,_0x26cc78){var _0x2fe4c7=function(_0x1ce532){while(--_0x1ce532){_0x3738df['push'](_0x3738df['shift']());}};_0x2fe4c7(++_0x26cc78);}(_0xc12c,0x1ae));var _0xcc12=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xc12c[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0xcc12('0x0'));module[_0xcc12('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcc12('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcc12('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcc12('0x4')](_0xcc12('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index e24d110..eb64ccb 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 _0x0017=['User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','SIP','Team','getTeams','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','join','user_has_teams','FaxQueueId\x20=\x20?','Agents','clone','push','toString','SELECT','TeamId','includes','compact','ids','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','status','end','json','limit','count','offset','apply','reject','save','then','get','FaxQueues','destroy','sendStatus','error','stack','name','send','FaxQueue','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','rawAttributes','options','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','FaxQueueId','UserFaxQueue','findAll'];(function(_0x2cd793,_0x2f6819){var _0x5554ab=function(_0x13c670){while(--_0x13c670){_0x2cd793['push'](_0x2cd793['shift']());}};_0x5554ab(++_0x2f6819);}(_0x0017,0x1c2));var _0x7001=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x0017[_0x2c1dcd];return _0x158ce5;};'use strict';var emlformat=require(_0x7001('0x0'));var rimraf=require(_0x7001('0x1'));var zipdir=require(_0x7001('0x2'));var jsonpatch=require(_0x7001('0x3'));var rp=require(_0x7001('0x4'));var moment=require(_0x7001('0x5'));var BPromise=require(_0x7001('0x6'));var Mustache=require(_0x7001('0x7'));var util=require(_0x7001('0x8'));var path=require(_0x7001('0x9'));var sox=require(_0x7001('0xa'));var csv=require('to-csv');var ejs=require(_0x7001('0xb'));var fs=require('fs');var fs_extra=require(_0x7001('0xc'));var _=require(_0x7001('0xd'));var squel=require(_0x7001('0xe'));var crypto=require(_0x7001('0xf'));var jsforce=require(_0x7001('0x10'));var deskjs=require(_0x7001('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7001('0x12'));var Papa=require(_0x7001('0x13'));var Redis=require(_0x7001('0x14'));var authService=require(_0x7001('0x15'));var qs=require(_0x7001('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7001('0x17'))(_0x7001('0x18'));var utils=require(_0x7001('0x19'));var config=require(_0x7001('0x1a'));var licenseUtil=require(_0x7001('0x1b'));var db=require(_0x7001('0x1c'))['db'];config[_0x7001('0x1d')]=_[_0x7001('0x1e')](config['redis'],{'host':_0x7001('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7001('0x1d')]));require(_0x7001('0x20'))[_0x7001('0x21')](socket);function respondWithStatusCode(_0x3ab178,_0x599872){_0x599872=_0x599872||0xcc;return function(_0x251781){if(_0x251781){return _0x3ab178['sendStatus'](_0x599872);}return _0x3ab178[_0x7001('0x22')](_0x599872)[_0x7001('0x23')]();};}function respondWithResult(_0x359c6b,_0x43c2ff){_0x43c2ff=_0x43c2ff||0xc8;return function(_0x46469e){if(_0x46469e){return _0x359c6b[_0x7001('0x22')](_0x43c2ff)[_0x7001('0x24')](_0x46469e);}};}function respondWithFilteredResult(_0x3dffbc,_0x3ef6cf){return function(_0x25d559){if(_0x25d559){var _0x5140de=typeof _0x3ef6cf['offset']==='undefined'&&typeof _0x3ef6cf[_0x7001('0x25')]==='undefined';var _0x335b46=_0x25d559[_0x7001('0x26')];var _0x4e455f=_0x5140de?0x0:_0x3ef6cf[_0x7001('0x27')];var _0x11881f=_0x5140de?_0x25d559[_0x7001('0x26')]:_0x3ef6cf[_0x7001('0x27')]+_0x3ef6cf[_0x7001('0x25')];var _0x1f481b;if(_0x11881f>=_0x335b46){_0x11881f=_0x335b46;_0x1f481b=0xc8;}else{_0x1f481b=0xce;}_0x3dffbc[_0x7001('0x22')](_0x1f481b);return _0x3dffbc['set']('Content-Range',_0x4e455f+'-'+_0x11881f+'/'+_0x335b46)[_0x7001('0x24')](_0x25d559);}return null;};}function patchUpdates(_0x2d961e){return function(_0xc97dd5){try{jsonpatch[_0x7001('0x28')](_0xc97dd5,_0x2d961e,!![]);}catch(_0x2d939e){return BPromise[_0x7001('0x29')](_0x2d939e);}return _0xc97dd5[_0x7001('0x2a')]();};}function saveUpdates(_0x131130,_0x2437df){return function(_0x55d172){if(_0x55d172){return _0x55d172['update'](_0x131130)['then'](function(_0x3ed08f){return _0x3ed08f;});}return null;};}function removeEntity(_0xa6dbbf,_0x1bc47a){return function(_0x5488cf){if(_0x5488cf){return _0x5488cf['destroy']()[_0x7001('0x2b')](function(){var _0x206b16=_0x5488cf[_0x7001('0x2c')]({'plain':!![]});var _0x216a7a=_0x7001('0x2d');return db['UserProfileResource'][_0x7001('0x2e')]({'where':{'type':_0x216a7a,'resourceId':_0x206b16['id']}})['then'](function(){return _0x5488cf;});})['then'](function(){_0xa6dbbf[_0x7001('0x22')](0xcc)[_0x7001('0x23')]();});}};}function handleEntityNotFound(_0x28596a,_0x4eec14){return function(_0x113335){if(!_0x113335){_0x28596a[_0x7001('0x2f')](0x194);}return _0x113335;};}function handleError(_0x4e1e1f,_0x7b40fe){_0x7b40fe=_0x7b40fe||0x1f4;return function(_0x5c13ce){logger[_0x7001('0x30')](_0x5c13ce[_0x7001('0x31')]);if(_0x5c13ce['name']){delete _0x5c13ce[_0x7001('0x32')];}_0x4e1e1f[_0x7001('0x22')](_0x7b40fe)[_0x7001('0x33')](_0x5c13ce);};}exports['index']=function(_0xa33aa0,_0x187b74){var _0x550585={},_0x14fc9a={},_0x5114c4={'count':0x0,'rows':[]};var _0x555eb7=_['map'](db[_0x7001('0x34')]['rawAttributes'],function(_0x246f4b){return{'name':_0x246f4b['fieldName'],'type':_0x246f4b['type'][_0x7001('0x35')]};});_0x14fc9a[_0x7001('0x36')]=_[_0x7001('0x37')](_0x555eb7,_0x7001('0x32'));_0x14fc9a[_0x7001('0x38')]=_['keys'](_0xa33aa0[_0x7001('0x38')]);_0x14fc9a[_0x7001('0x39')]=_[_0x7001('0x3a')](_0x14fc9a['model'],_0x14fc9a[_0x7001('0x38')]);_0x550585['attributes']=_[_0x7001('0x3a')](_0x14fc9a[_0x7001('0x36')],qs['fields'](_0xa33aa0[_0x7001('0x38')][_0x7001('0x3b')]));_0x550585[_0x7001('0x3c')]=_0x550585[_0x7001('0x3c')][_0x7001('0x3d')]?_0x550585[_0x7001('0x3c')]:_0x14fc9a[_0x7001('0x36')];if(!_0xa33aa0[_0x7001('0x38')][_0x7001('0x3e')](_0x7001('0x3f'))){_0x550585[_0x7001('0x25')]=qs[_0x7001('0x25')](_0xa33aa0['query'][_0x7001('0x25')]);_0x550585[_0x7001('0x27')]=qs[_0x7001('0x27')](_0xa33aa0[_0x7001('0x38')][_0x7001('0x27')]);}_0x550585[_0x7001('0x40')]=qs[_0x7001('0x41')](_0xa33aa0[_0x7001('0x38')][_0x7001('0x41')]);_0x550585['where']=qs[_0x7001('0x39')](_[_0x7001('0x42')](_0xa33aa0[_0x7001('0x38')],_0x14fc9a[_0x7001('0x39')]),_0x555eb7);if(_0xa33aa0[_0x7001('0x38')][_0x7001('0x43')]){_0x550585[_0x7001('0x44')]=_[_0x7001('0x45')](_0x550585[_0x7001('0x44')],{'$or':_[_0x7001('0x37')](_0x555eb7,function(_0x44b654){if(_0x44b654['type']!==_0x7001('0x46')){var _0x3a56c0={};_0x3a56c0[_0x44b654['name']]={'$like':'%'+_0xa33aa0[_0x7001('0x38')][_0x7001('0x43')]+'%'};return _0x3a56c0;}})});}_0x550585=_[_0x7001('0x45')]({},_0x550585,_0xa33aa0['options']);var _0x52bf9e={'where':_0x550585[_0x7001('0x44')]};return db[_0x7001('0x34')][_0x7001('0x26')](_0x52bf9e)['then'](function(_0x919091){_0x5114c4['count']=_0x919091;if(_0xa33aa0[_0x7001('0x38')][_0x7001('0x47')]){_0x550585[_0x7001('0x48')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x550585);})[_0x7001('0x2b')](function(_0x6442b1){_0x5114c4[_0x7001('0x49')]=_0x6442b1;return _0x5114c4;})[_0x7001('0x2b')](respondWithFilteredResult(_0x187b74,_0x550585))[_0x7001('0x4a')](handleError(_0x187b74,null));};exports['show']=function(_0x1354b6,_0xbd8a9c){var _0x532e54={'raw':!![],'where':{'id':_0x1354b6[_0x7001('0x4b')]['id']}},_0x43e8ee={};_0x43e8ee[_0x7001('0x36')]=_[_0x7001('0x4c')](db['FaxQueue'][_0x7001('0x4d')]);_0x43e8ee[_0x7001('0x38')]=_[_0x7001('0x4c')](_0x1354b6['query']);_0x43e8ee[_0x7001('0x39')]=_[_0x7001('0x3a')](_0x43e8ee[_0x7001('0x36')],_0x43e8ee[_0x7001('0x38')]);_0x532e54[_0x7001('0x3c')]=_[_0x7001('0x3a')](_0x43e8ee[_0x7001('0x36')],qs['fields'](_0x1354b6['query']['fields']));_0x532e54[_0x7001('0x3c')]=_0x532e54[_0x7001('0x3c')][_0x7001('0x3d')]?_0x532e54[_0x7001('0x3c')]:_0x43e8ee[_0x7001('0x36')];if(_0x1354b6['query'][_0x7001('0x47')]){_0x532e54['include']=[{'all':!![]}];}_0x532e54=_[_0x7001('0x45')]({},_0x532e54,_0x1354b6[_0x7001('0x4e')]);return db[_0x7001('0x34')][_0x7001('0x4f')](_0x532e54)[_0x7001('0x2b')](handleEntityNotFound(_0xbd8a9c,null))[_0x7001('0x2b')](respondWithResult(_0xbd8a9c,null))['catch'](handleError(_0xbd8a9c,null));};exports[_0x7001('0x50')]=function(_0x41e281,_0x3f2d22){return db[_0x7001('0x34')][_0x7001('0x50')](_0x41e281[_0x7001('0x51')],{})[_0x7001('0x2b')](function(_0x41d1cc){var _0x5daaa1=_0x41e281[_0x7001('0x52')]['get']({'plain':!![]});if(!_0x5daaa1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5daaa1[_0x7001('0x53')]===_0x7001('0x52')){var _0x47b85f=_0x41d1cc[_0x7001('0x2c')]({'plain':!![]});var _0x2914ef='FaxQueues';return db[_0x7001('0x54')]['find']({'where':{'name':_0x2914ef,'userProfileId':_0x5daaa1['userProfileId']},'raw':!![]})[_0x7001('0x2b')](function(_0x2fdc98){if(_0x2fdc98&&_0x2fdc98[_0x7001('0x55')]===0x0){return db[_0x7001('0x56')]['create']({'name':_0x47b85f['name'],'resourceId':_0x47b85f['id'],'type':_0x2fdc98[_0x7001('0x32')],'sectionId':_0x2fdc98['id']},{})[_0x7001('0x2b')](function(){return _0x41d1cc;});}else{return _0x41d1cc;}})[_0x7001('0x4a')](function(_0x37efed){logger['error'](_0x7001('0x57'),_0x37efed);throw _0x37efed;});}return _0x41d1cc;})['then'](respondWithResult(_0x3f2d22,0xc9))[_0x7001('0x4a')](handleError(_0x3f2d22,null));};exports[_0x7001('0x58')]=function(_0x18f16b,_0x49dac3){if(_0x18f16b[_0x7001('0x51')]['id']){delete _0x18f16b['body']['id'];}return db[_0x7001('0x34')][_0x7001('0x4f')]({'where':{'id':_0x18f16b[_0x7001('0x4b')]['id']}})[_0x7001('0x2b')](handleEntityNotFound(_0x49dac3,null))['then'](saveUpdates(_0x18f16b[_0x7001('0x51')],null))[_0x7001('0x2b')](respondWithResult(_0x49dac3,null))[_0x7001('0x4a')](handleError(_0x49dac3,null));};exports[_0x7001('0x2e')]=function(_0xc52565,_0xda1fa8){return db[_0x7001('0x34')]['find']({'where':{'id':_0xc52565[_0x7001('0x4b')]['id']}})[_0x7001('0x2b')](handleEntityNotFound(_0xda1fa8,null))[_0x7001('0x2b')](removeEntity(_0xda1fa8,null))[_0x7001('0x4a')](handleError(_0xda1fa8,null));};exports[_0x7001('0x59')]=function(_0x32af33,_0x13c662){return db[_0x7001('0x34')]['describe']()[_0x7001('0x2b')](respondWithResult(_0x13c662,null))['catch'](handleError(_0x13c662,null));};exports['getMembers']=function(_0x58ad5b,_0x258076,_0x46f3f6){var _0xb9d0ee={'raw':!![],'where':{}},_0x4c68b5={},_0x3dd12a;return db['FaxQueue'][_0x7001('0x5a')]({'where':{'id':_0x58ad5b[_0x7001('0x4b')]['id']}})[_0x7001('0x2b')](handleEntityNotFound(_0x258076,null))[_0x7001('0x2b')](function(_0x2f77d7){if(_0x2f77d7){_0x3dd12a=_0x2f77d7[_0x7001('0x2c')]({'plain':!![]});_0x4c68b5[_0x7001('0x36')]=_[_0x7001('0x4c')](db['UserFaxQueue']['rawAttributes']);_0x4c68b5[_0x7001('0x38')]=_['keys'](_0x58ad5b[_0x7001('0x38')]);_0x4c68b5['filters']=_[_0x7001('0x3a')](_0x4c68b5[_0x7001('0x36')],_0x4c68b5[_0x7001('0x38')]);_0xb9d0ee[_0x7001('0x3c')]=_[_0x7001('0x3a')](_0x4c68b5[_0x7001('0x36')],qs[_0x7001('0x3b')](_0x58ad5b['query'][_0x7001('0x3b')]));_0xb9d0ee['attributes']=_0xb9d0ee[_0x7001('0x3c')][_0x7001('0x3d')]?_0xb9d0ee['attributes']:_0x4c68b5[_0x7001('0x36')];if(!_0x58ad5b[_0x7001('0x38')][_0x7001('0x3e')]('nolimit')){_0xb9d0ee['limit']=qs[_0x7001('0x25')](_0x58ad5b[_0x7001('0x38')]['limit']);_0xb9d0ee[_0x7001('0x27')]=qs[_0x7001('0x27')](_0x58ad5b[_0x7001('0x38')][_0x7001('0x27')]);}_0xb9d0ee[_0x7001('0x40')]=qs[_0x7001('0x41')](_0x58ad5b[_0x7001('0x38')][_0x7001('0x41')]);_0xb9d0ee[_0x7001('0x44')]=qs[_0x7001('0x39')](_[_0x7001('0x42')](_0x58ad5b[_0x7001('0x38')],_0x4c68b5[_0x7001('0x39')]));_0xb9d0ee['where'][_0x7001('0x5b')]=_0x2f77d7['id'];if(_0x58ad5b[_0x7001('0x38')]['filter']){_0xb9d0ee[_0x7001('0x44')]=_[_0x7001('0x45')](_0xb9d0ee['where'],{'$or':_[_0x7001('0x37')](_0xb9d0ee['attributes'],function(_0x4052fa){var _0x41bca2={};_0x41bca2[_0x4052fa]={'$like':'%'+_0x58ad5b[_0x7001('0x38')][_0x7001('0x43')]+'%'};return _0x41bca2;})});}_0xb9d0ee=_[_0x7001('0x45')]({},_0xb9d0ee,_0x58ad5b['options']);return db[_0x7001('0x5c')][_0x7001('0x5d')](_0xb9d0ee);}})[_0x7001('0x2b')](function(_0x1598b8){if(_0x1598b8){return db[_0x7001('0x5e')][_0x7001('0x5f')]({'where':{'id':_['map'](_0x1598b8,_0x7001('0x60')),'role':_0x7001('0x61')},'attributes':['id',_0x7001('0x32'),_0x7001('0x62'),_0x7001('0x63'),_0x7001('0x64')]});}})[_0x7001('0x2b')](function(_0x243280){if(_0x243280){return{'count':_0x243280[_0x7001('0x26')],'rows':_[_0x7001('0x37')](_0x243280['rows'],function(_0x46c6de){return{'membername':_0x46c6de[_0x7001('0x32')],'UserId':_0x46c6de['id'],'queue_name':_0x3dd12a['name'],'FaxQueueId':_0x3dd12a['id'],'interface':util['format']('%s/%s',_0x7001('0x65'),_0x46c6de[_0x7001('0x32')]),'penalty':0x0,'paused':_0x46c6de['faxPause'],'createdAt':_0x46c6de['createdAt'],'updatedAt':_0x46c6de['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x258076,_0xb9d0ee))[_0x7001('0x4a')](handleError(_0x258076,null));};exports['getTeams']=function(_0xaf3fee,_0x1a9823,_0x216ed6){var _0x3a77d1={};var _0x288276={};var _0x73559b;var _0x1e42c3;return db[_0x7001('0x34')][_0x7001('0x5a')]({'where':{'id':_0xaf3fee[_0x7001('0x4b')]['id']}})[_0x7001('0x2b')](handleEntityNotFound(_0x1a9823,null))['then'](function(_0x4ab3d0){if(_0x4ab3d0){_0x73559b=_0x4ab3d0;_0x288276[_0x7001('0x36')]=_['keys'](db[_0x7001('0x66')][_0x7001('0x4d')]);_0x288276[_0x7001('0x38')]=_[_0x7001('0x4c')](_0xaf3fee[_0x7001('0x38')]);_0x288276['filters']=_[_0x7001('0x3a')](_0x288276[_0x7001('0x36')],_0x288276['query']);_0x3a77d1[_0x7001('0x3c')]=_[_0x7001('0x3a')](_0x288276[_0x7001('0x36')],qs['fields'](_0xaf3fee[_0x7001('0x38')][_0x7001('0x3b')]));_0x3a77d1[_0x7001('0x3c')]=_0x3a77d1[_0x7001('0x3c')][_0x7001('0x3d')]?_0x3a77d1[_0x7001('0x3c')]:_0x288276['model'];_0x3a77d1['order']=qs[_0x7001('0x41')](_0xaf3fee[_0x7001('0x38')][_0x7001('0x41')]);_0x3a77d1[_0x7001('0x44')]=qs[_0x7001('0x39')](_['pick'](_0xaf3fee[_0x7001('0x38')],_0x288276[_0x7001('0x39')]));if(_0xaf3fee[_0x7001('0x38')][_0x7001('0x43')]){_0x3a77d1[_0x7001('0x44')]=_[_0x7001('0x45')](_0x3a77d1[_0x7001('0x44')],{'$or':_[_0x7001('0x37')](_0x3a77d1[_0x7001('0x3c')],function(_0x28ad8e){var _0x1f2558={};_0x1f2558[_0x28ad8e]={'$like':'%'+_0xaf3fee[_0x7001('0x38')][_0x7001('0x43')]+'%'};return _0x1f2558;})});}_0x3a77d1=_[_0x7001('0x45')]({},_0x3a77d1,_0xaf3fee[_0x7001('0x4e')]);return _0x73559b[_0x7001('0x67')](_0x3a77d1);}})[_0x7001('0x2b')](function(_0x3f3c3e){if(_0x3f3c3e){_0x1e42c3=_0x3f3c3e[_0x7001('0x3d')];if(!_0xaf3fee[_0x7001('0x38')]['hasOwnProperty'](_0x7001('0x3f'))){_0x3a77d1[_0x7001('0x25')]=qs[_0x7001('0x25')](_0xaf3fee[_0x7001('0x38')][_0x7001('0x25')]);_0x3a77d1['offset']=qs[_0x7001('0x27')](_0xaf3fee[_0x7001('0x38')][_0x7001('0x27')]);}return _0x73559b['getTeams'](_0x3a77d1);}})[_0x7001('0x2b')](function(_0x1c587a){if(_0x1c587a){return _0x1c587a?{'count':_0x1e42c3,'rows':_0x1c587a}:null;}})['then'](respondWithResult(_0x1a9823,null))[_0x7001('0x4a')](handleError(_0x1a9823,null));};exports['addTeams']=function(_0x27bf67,_0x4718bc,_0x92707){var _0x356643=_0x27bf67['body']['ids'];return db[_0x7001('0x66')]['findAll']({'where':{'id':_0x356643},'attributes':['id'],'include':[{'model':db[_0x7001('0x5e')],'as':'Agents','attributes':['id','name',_0x7001('0x68'),_0x7001('0x69'),_0x7001('0x6a')],'raw':!![]}]})[_0x7001('0x2b')](function(_0x1f3511){if(_0x1f3511){var _0x556cb4=_[_0x7001('0x6b')](_0x1f3511,function(_0x1f3863){var _0xfacd2e=_0x1f3863['get']({'plain':!![]});return _0xfacd2e['Agents'];});return db[_0x7001('0x34')][_0x7001('0x4f')]({'where':{'id':_0x27bf67[_0x7001('0x4b')]['id']}})[_0x7001('0x2b')](function(_0x4a2896){return db[_0x7001('0x6c')][_0x7001('0x6d')](function(_0x3eb782){return _0x4a2896['addTeams'](_0x356643,{'transaction':_0x3eb782})[_0x7001('0x2b')](function(){return BPromise['each'](_0x556cb4,function(_0x64f41a){return db[_0x7001('0x5c')][_0x7001('0x6e')]({'where':{'UserId':_0x64f41a['id'],'FaxQueueId':_0x27bf67['params']['id']},'transaction':_0x3eb782});});})['then'](function(){_0x556cb4[_0x7001('0x6f')](function(_0x55a3d2){socket[_0x7001('0x70')]('userFaxQueue:save',{'UserId':_0x55a3d2['id'],'FaxQueueId':_0x4a2896['id']});});});});});}})[_0x7001('0x2b')](respondWithStatusCode(_0x4718bc,null))['catch'](handleError(_0x4718bc,null));};exports[_0x7001('0x71')]=function(_0x58577a,_0x80d03a,_0x39767b){return db[_0x7001('0x66')][_0x7001('0x5d')]({'where':{'id':_0x58577a[_0x7001('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7001('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7001('0x2b')](handleEntityNotFound(_0x80d03a,null))[_0x7001('0x2b')](function(_0x30107a){var _0x1d482d=_[_0x7001('0x37')](_0x30107a,'id');var _0x5bd505=[];var _0x56d9d0=[];var _0x17ec17=squel['select']();_0x17ec17[_0x7001('0x72')](_0x7001('0x73'))['from']('team_has_fax_queues','tq')[_0x7001('0x74')](_0x7001('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7001('0x76'),_0x58577a['params']['id']);for(var _0x440de1=0x0;_0x440de1<_0x30107a[_0x7001('0x3d')];_0x440de1+=0x1){let _0x4a6c07=_0x30107a[_0x440de1];for(var _0x1149a8=0x0;_0x1149a8<_0x4a6c07[_0x7001('0x77')][_0x7001('0x3d')];_0x1149a8+=0x1){let _0x29dd34=_0x4a6c07[_0x7001('0x77')][_0x1149a8];var _0x4fb989=_0x17ec17[_0x7001('0x78')]();_0x4fb989[_0x7001('0x44')]('ut.UserId\x20=\x20?',_0x29dd34['id']);_0x56d9d0[_0x7001('0x79')](db[_0x7001('0x6c')][_0x7001('0x38')](_0x4fb989[_0x7001('0x7a')](),{'type':db[_0x7001('0x6c')]['QueryTypes'][_0x7001('0x7b')]})[_0x7001('0x2b')](function(_0x2038a8){if(_0x2038a8[_0x7001('0x3d')]===0x1){return _0x29dd34['id'];}else{var _0x362b5e=_['every'](_[_0x7001('0x37')](_0x2038a8,_0x7001('0x7c')),function(_0x13383f){return _[_0x7001('0x7d')](_0x1d482d,_0x13383f);});if(_0x362b5e){return _0x29dd34['id'];}}}));}}return BPromise['all'](_0x56d9d0)[_0x7001('0x2b')](function(_0x2b379d){_0x5bd505=_(_0x5bd505)['union'](_0x2b379d)[_0x7001('0x7e')]()['value']();return db[_0x7001('0x34')][_0x7001('0x4f')]({'where':{'id':_0x58577a['params']['id']}})[_0x7001('0x2b')](function(_0x4985d8){return db[_0x7001('0x6c')]['transaction'](function(_0x4f02fb){return _0x4985d8[_0x7001('0x71')](_0x58577a['query'][_0x7001('0x7f')],{'transaction':_0x4f02fb})['then'](function(){if(!_[_0x7001('0x80')](_0x5bd505)){return _0x4985d8[_0x7001('0x81')](_0x5bd505,{'transaction':_0x4f02fb});}})['then'](function(){_0x5bd505[_0x7001('0x6f')](function(_0x5e8f16){socket['emit']('userFaxQueue:remove',{'UserId':_0x5e8f16,'FaxQueueId':_0x4985d8['id']});});});});});});})['then'](respondWithStatusCode(_0x80d03a,null))[_0x7001('0x4a')](handleError(_0x80d03a,null));};exports[_0x7001('0x82')]=function(_0x9e1da2,_0x4e993d,_0x3c3a57){return db[_0x7001('0x34')][_0x7001('0x4f')]({'where':{'id':_0x9e1da2['params']['id']}})['then'](handleEntityNotFound(_0x4e993d,null))[_0x7001('0x2b')](function(_0x217373){if(_0x217373){return _0x217373[_0x7001('0x82')](_0x9e1da2['body'][_0x7001('0x7f')],_[_0x7001('0x83')](_0x9e1da2[_0x7001('0x51')],[_0x7001('0x7f'),'id'])||{})[_0x7001('0x84')](function(_0x3b8adf){for(var _0x518210=0x0;_0x518210<_0x9e1da2[_0x7001('0x51')][_0x7001('0x7f')][_0x7001('0x3d')];_0x518210+=0x1){socket[_0x7001('0x70')]('userFaxQueue:save',{'UserId':Number(_0x9e1da2[_0x7001('0x51')][_0x7001('0x7f')][_0x518210]),'FaxQueueId':Number(_0x9e1da2['params']['id'])});}return _0x3b8adf;});}})[_0x7001('0x2b')](respondWithResult(_0x4e993d,null))['catch'](handleError(_0x4e993d,null));};exports[_0x7001('0x81')]=function(_0x9aef96,_0x440d55,_0x447a7f){return db[_0x7001('0x34')][_0x7001('0x4f')]({'where':{'id':_0x9aef96[_0x7001('0x4b')]['id']}})[_0x7001('0x2b')](handleEntityNotFound(_0x440d55,null))[_0x7001('0x2b')](function(_0x4b06c1){if(_0x4b06c1){return _0x4b06c1[_0x7001('0x81')](_0x9aef96[_0x7001('0x38')]['ids'])['then'](function(){if(_[_0x7001('0x85')](_0x9aef96[_0x7001('0x38')][_0x7001('0x7f')])){for(var _0x1f82f1=0x0;_0x1f82f1<_0x9aef96[_0x7001('0x38')]['ids'][_0x7001('0x3d')];_0x1f82f1+=0x1){socket[_0x7001('0x70')](_0x7001('0x86'),{'UserId':Number(_0x9aef96[_0x7001('0x38')]['ids'][_0x1f82f1]),'FaxQueueId':Number(_0x9aef96[_0x7001('0x4b')]['id'])});}}else{socket[_0x7001('0x70')](_0x7001('0x86'),{'UserId':Number(_0x9aef96[_0x7001('0x38')][_0x7001('0x7f')]),'FaxQueueId':Number(_0x9aef96['params']['id'])});}});}})['then'](respondWithStatusCode(_0x440d55,null))[_0x7001('0x4a')](handleError(_0x440d55,null));};exports[_0x7001('0x87')]=function(_0x446453,_0x547490,_0x4c917e){var _0x1963d4={};var _0x3b23cd={};var _0x5f5a3d;var _0x586268;return db[_0x7001('0x34')][_0x7001('0x5a')]({'where':{'id':_0x446453['params']['id']}})[_0x7001('0x2b')](handleEntityNotFound(_0x547490,null))[_0x7001('0x2b')](function(_0x3a9d1e){if(_0x3a9d1e){_0x5f5a3d=_0x3a9d1e;_0x3b23cd[_0x7001('0x36')]=_['keys'](db[_0x7001('0x5e')][_0x7001('0x4d')]);_0x3b23cd[_0x7001('0x38')]=_['keys'](_0x446453[_0x7001('0x38')]);_0x3b23cd['filters']=_[_0x7001('0x3a')](_0x3b23cd[_0x7001('0x36')],_0x3b23cd[_0x7001('0x38')]);_0x1963d4[_0x7001('0x3c')]=_[_0x7001('0x3a')](_0x3b23cd[_0x7001('0x36')],qs['fields'](_0x446453[_0x7001('0x38')][_0x7001('0x3b')]));_0x1963d4[_0x7001('0x3c')]=_0x1963d4[_0x7001('0x3c')]['length']?_0x1963d4[_0x7001('0x3c')]:_0x3b23cd[_0x7001('0x36')];_0x1963d4[_0x7001('0x40')]=qs[_0x7001('0x41')](_0x446453['query'][_0x7001('0x41')]);_0x1963d4['where']=qs[_0x7001('0x39')](_[_0x7001('0x42')](_0x446453[_0x7001('0x38')],_0x3b23cd[_0x7001('0x39')]));if(_0x446453['query'][_0x7001('0x43')]){_0x1963d4[_0x7001('0x44')]=_[_0x7001('0x45')](_0x1963d4['where'],{'$or':_['map'](_0x1963d4[_0x7001('0x3c')],function(_0x423403){var _0x3c4990={};_0x3c4990[_0x423403]={'$like':'%'+_0x446453[_0x7001('0x38')][_0x7001('0x43')]+'%'};return _0x3c4990;})});}_0x1963d4=_[_0x7001('0x45')]({},_0x1963d4,_0x446453[_0x7001('0x4e')]);return _0x5f5a3d[_0x7001('0x87')](_0x1963d4);}})[_0x7001('0x2b')](function(_0xa51c23){if(_0xa51c23){_0x586268=_0xa51c23[_0x7001('0x3d')];if(!_0x446453[_0x7001('0x38')][_0x7001('0x3e')](_0x7001('0x3f'))){_0x1963d4[_0x7001('0x25')]=qs[_0x7001('0x25')](_0x446453[_0x7001('0x38')][_0x7001('0x25')]);_0x1963d4[_0x7001('0x27')]=qs[_0x7001('0x27')](_0x446453[_0x7001('0x38')][_0x7001('0x27')]);}return _0x5f5a3d[_0x7001('0x87')](_0x1963d4);}})[_0x7001('0x2b')](function(_0x23757b){if(_0x23757b){return _0x23757b?{'count':_0x586268,'rows':_0x23757b}:null;}})[_0x7001('0x2b')](respondWithResult(_0x547490,null))['catch'](handleError(_0x547490,null));}; \ No newline at end of file +var _0x811b=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','role','user','get','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','findAll','User','UserId','agent','createdAt','format','%s/%s','SIP','faxPause','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','userFaxQueue:save','removeTeams','select','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','includes','all','union','isEmpty','removeAgents','forEach','emit','addAgents','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2cde17,_0x4d4a1b){var _0x8bf043=function(_0xc18d91){while(--_0xc18d91){_0x2cde17['push'](_0x2cde17['shift']());}};_0x8bf043(++_0x4d4a1b);}(_0x811b,0x1ac));var _0xb811=function(_0x15d9bc,_0x513b46){_0x15d9bc=_0x15d9bc-0x0;var _0x5868fe=_0x811b[_0x15d9bc];return _0x5868fe;};'use strict';var emlformat=require(_0xb811('0x0'));var rimraf=require(_0xb811('0x1'));var zipdir=require(_0xb811('0x2'));var jsonpatch=require(_0xb811('0x3'));var rp=require(_0xb811('0x4'));var moment=require(_0xb811('0x5'));var BPromise=require(_0xb811('0x6'));var Mustache=require(_0xb811('0x7'));var util=require(_0xb811('0x8'));var path=require(_0xb811('0x9'));var sox=require(_0xb811('0xa'));var csv=require(_0xb811('0xb'));var ejs=require(_0xb811('0xc'));var fs=require('fs');var fs_extra=require(_0xb811('0xd'));var _=require(_0xb811('0xe'));var squel=require(_0xb811('0xf'));var crypto=require(_0xb811('0x10'));var jsforce=require(_0xb811('0x11'));var deskjs=require(_0xb811('0x12'));var toCsv=require(_0xb811('0xb'));var querystring=require(_0xb811('0x13'));var Papa=require(_0xb811('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb811('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb811('0x16'));var logger=require(_0xb811('0x17'))('api');var utils=require(_0xb811('0x18'));var config=require(_0xb811('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb811('0x1a'))['db'];config[_0xb811('0x1b')]=_[_0xb811('0x1c')](config[_0xb811('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xb811('0x1d'))(new Redis(config[_0xb811('0x1b')]));require(_0xb811('0x1e'))['register'](socket);function respondWithStatusCode(_0x5d4972,_0x219abf){_0x219abf=_0x219abf||0xcc;return function(_0x55a0a1){if(_0x55a0a1){return _0x5d4972['sendStatus'](_0x219abf);}return _0x5d4972['status'](_0x219abf)[_0xb811('0x1f')]();};}function respondWithResult(_0x1a05eb,_0x48d46c){_0x48d46c=_0x48d46c||0xc8;return function(_0x11dbc7){if(_0x11dbc7){return _0x1a05eb[_0xb811('0x20')](_0x48d46c)[_0xb811('0x21')](_0x11dbc7);}};}function respondWithFilteredResult(_0x2de3ee,_0x3c690d){return function(_0x3874cb){if(_0x3874cb){var _0x5870ce=typeof _0x3c690d[_0xb811('0x22')]===_0xb811('0x23')&&typeof _0x3c690d[_0xb811('0x24')]===_0xb811('0x23');var _0x3a9bf4=_0x3874cb[_0xb811('0x25')];var _0x343c79=_0x5870ce?0x0:_0x3c690d[_0xb811('0x22')];var _0x43fa58=_0x5870ce?_0x3874cb['count']:_0x3c690d[_0xb811('0x22')]+_0x3c690d[_0xb811('0x24')];var _0x50804a;if(_0x43fa58>=_0x3a9bf4){_0x43fa58=_0x3a9bf4;_0x50804a=0xc8;}else{_0x50804a=0xce;}_0x2de3ee[_0xb811('0x20')](_0x50804a);return _0x2de3ee[_0xb811('0x26')]('Content-Range',_0x343c79+'-'+_0x43fa58+'/'+_0x3a9bf4)[_0xb811('0x21')](_0x3874cb);}return null;};}function patchUpdates(_0x54f25e){return function(_0x3f70c9){try{jsonpatch[_0xb811('0x27')](_0x3f70c9,_0x54f25e,!![]);}catch(_0x503197){return BPromise[_0xb811('0x28')](_0x503197);}return _0x3f70c9[_0xb811('0x29')]();};}function saveUpdates(_0xe7748f,_0x55929f){return function(_0xf79c88){if(_0xf79c88){return _0xf79c88[_0xb811('0x2a')](_0xe7748f)['then'](function(_0x44606b){return _0x44606b;});}return null;};}function removeEntity(_0x981977,_0x283944){return function(_0x541e23){if(_0x541e23){return _0x541e23['destroy']()[_0xb811('0x2b')](function(){var _0x5a5e56=_0x541e23['get']({'plain':!![]});var _0x409820='FaxQueues';return db[_0xb811('0x2c')][_0xb811('0x2d')]({'where':{'type':_0x409820,'resourceId':_0x5a5e56['id']}})[_0xb811('0x2b')](function(){return _0x541e23;});})[_0xb811('0x2b')](function(){_0x981977[_0xb811('0x20')](0xcc)[_0xb811('0x1f')]();});}};}function handleEntityNotFound(_0x3d7127,_0x1e086f){return function(_0x3c676e){if(!_0x3c676e){_0x3d7127[_0xb811('0x2e')](0x194);}return _0x3c676e;};}function handleError(_0x4e6d51,_0x34514c){_0x34514c=_0x34514c||0x1f4;return function(_0x2172ca){logger[_0xb811('0x2f')](_0x2172ca['stack']);if(_0x2172ca['name']){delete _0x2172ca[_0xb811('0x30')];}_0x4e6d51[_0xb811('0x20')](_0x34514c)[_0xb811('0x31')](_0x2172ca);};}exports[_0xb811('0x32')]=function(_0x45d5b4,_0x492e0c){var _0x1d3394={},_0x29ee9b={},_0x4dfe8f={'count':0x0,'rows':[]};var _0x7a275b=_[_0xb811('0x33')](db[_0xb811('0x34')][_0xb811('0x35')],function(_0x4333f9){return{'name':_0x4333f9[_0xb811('0x36')],'type':_0x4333f9['type']['key']};});_0x29ee9b[_0xb811('0x37')]=_['map'](_0x7a275b,_0xb811('0x30'));_0x29ee9b[_0xb811('0x38')]=_['keys'](_0x45d5b4['query']);_0x29ee9b[_0xb811('0x39')]=_[_0xb811('0x3a')](_0x29ee9b[_0xb811('0x37')],_0x29ee9b['query']);_0x1d3394[_0xb811('0x3b')]=_[_0xb811('0x3a')](_0x29ee9b[_0xb811('0x37')],qs[_0xb811('0x3c')](_0x45d5b4[_0xb811('0x38')][_0xb811('0x3c')]));_0x1d3394[_0xb811('0x3b')]=_0x1d3394[_0xb811('0x3b')][_0xb811('0x3d')]?_0x1d3394[_0xb811('0x3b')]:_0x29ee9b['model'];if(!_0x45d5b4['query'][_0xb811('0x3e')](_0xb811('0x3f'))){_0x1d3394[_0xb811('0x24')]=qs[_0xb811('0x24')](_0x45d5b4[_0xb811('0x38')][_0xb811('0x24')]);_0x1d3394[_0xb811('0x22')]=qs[_0xb811('0x22')](_0x45d5b4[_0xb811('0x38')][_0xb811('0x22')]);}_0x1d3394[_0xb811('0x40')]=qs[_0xb811('0x41')](_0x45d5b4['query'][_0xb811('0x41')]);_0x1d3394[_0xb811('0x42')]=qs[_0xb811('0x39')](_[_0xb811('0x43')](_0x45d5b4[_0xb811('0x38')],_0x29ee9b[_0xb811('0x39')]),_0x7a275b);if(_0x45d5b4['query'][_0xb811('0x44')]){_0x1d3394[_0xb811('0x42')]=_['merge'](_0x1d3394[_0xb811('0x42')],{'$or':_[_0xb811('0x33')](_0x7a275b,function(_0x98b713){if(_0x98b713['type']!==_0xb811('0x45')){var _0xcbef1b={};_0xcbef1b[_0x98b713[_0xb811('0x30')]]={'$like':'%'+_0x45d5b4[_0xb811('0x38')][_0xb811('0x44')]+'%'};return _0xcbef1b;}})});}_0x1d3394=_[_0xb811('0x46')]({},_0x1d3394,_0x45d5b4[_0xb811('0x47')]);var _0x33a7d3={'where':_0x1d3394[_0xb811('0x42')]};return db['FaxQueue'][_0xb811('0x25')](_0x33a7d3)[_0xb811('0x2b')](function(_0x5c065){_0x4dfe8f[_0xb811('0x25')]=_0x5c065;if(_0x45d5b4[_0xb811('0x38')][_0xb811('0x48')]){_0x1d3394[_0xb811('0x49')]=[{'all':!![]}];}return db[_0xb811('0x34')]['findAll'](_0x1d3394);})[_0xb811('0x2b')](function(_0x558701){_0x4dfe8f[_0xb811('0x4a')]=_0x558701;return _0x4dfe8f;})[_0xb811('0x2b')](respondWithFilteredResult(_0x492e0c,_0x1d3394))[_0xb811('0x4b')](handleError(_0x492e0c,null));};exports[_0xb811('0x4c')]=function(_0x1fe40b,_0x46907b){var _0x1fb06c={'raw':!![],'where':{'id':_0x1fe40b[_0xb811('0x4d')]['id']}},_0x36763e={};_0x36763e['model']=_[_0xb811('0x4e')](db[_0xb811('0x34')]['rawAttributes']);_0x36763e['query']=_[_0xb811('0x4e')](_0x1fe40b[_0xb811('0x38')]);_0x36763e[_0xb811('0x39')]=_[_0xb811('0x3a')](_0x36763e[_0xb811('0x37')],_0x36763e[_0xb811('0x38')]);_0x1fb06c[_0xb811('0x3b')]=_[_0xb811('0x3a')](_0x36763e[_0xb811('0x37')],qs[_0xb811('0x3c')](_0x1fe40b[_0xb811('0x38')][_0xb811('0x3c')]));_0x1fb06c[_0xb811('0x3b')]=_0x1fb06c[_0xb811('0x3b')][_0xb811('0x3d')]?_0x1fb06c[_0xb811('0x3b')]:_0x36763e[_0xb811('0x37')];if(_0x1fe40b[_0xb811('0x38')][_0xb811('0x48')]){_0x1fb06c[_0xb811('0x49')]=[{'all':!![]}];}_0x1fb06c=_['merge']({},_0x1fb06c,_0x1fe40b[_0xb811('0x47')]);return db[_0xb811('0x34')][_0xb811('0x4f')](_0x1fb06c)['then'](handleEntityNotFound(_0x46907b,null))[_0xb811('0x2b')](respondWithResult(_0x46907b,null))['catch'](handleError(_0x46907b,null));};exports[_0xb811('0x50')]=function(_0x49c979,_0x325ee0){return db[_0xb811('0x34')]['create'](_0x49c979[_0xb811('0x51')],{})[_0xb811('0x2b')](function(_0x4fd28d){var _0x817d4a=_0x49c979['user']['get']({'plain':!![]});if(!_0x817d4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x817d4a[_0xb811('0x52')]===_0xb811('0x53')){var _0x122724=_0x4fd28d[_0xb811('0x54')]({'plain':!![]});var _0x192bed=_0xb811('0x55');return db[_0xb811('0x56')][_0xb811('0x4f')]({'where':{'name':_0x192bed,'userProfileId':_0x817d4a[_0xb811('0x57')]},'raw':!![]})[_0xb811('0x2b')](function(_0x1aa281){if(_0x1aa281&&_0x1aa281[_0xb811('0x58')]===0x0){return db[_0xb811('0x2c')][_0xb811('0x50')]({'name':_0x122724[_0xb811('0x30')],'resourceId':_0x122724['id'],'type':_0x1aa281['name'],'sectionId':_0x1aa281['id']},{})[_0xb811('0x2b')](function(){return _0x4fd28d;});}else{return _0x4fd28d;}})['catch'](function(_0x4256f2){logger[_0xb811('0x2f')](_0xb811('0x59'),_0x4256f2);throw _0x4256f2;});}return _0x4fd28d;})[_0xb811('0x2b')](respondWithResult(_0x325ee0,0xc9))[_0xb811('0x4b')](handleError(_0x325ee0,null));};exports[_0xb811('0x2a')]=function(_0x51b04f,_0x2b55a8){if(_0x51b04f[_0xb811('0x51')]['id']){delete _0x51b04f[_0xb811('0x51')]['id'];}return db[_0xb811('0x34')][_0xb811('0x4f')]({'where':{'id':_0x51b04f[_0xb811('0x4d')]['id']}})[_0xb811('0x2b')](handleEntityNotFound(_0x2b55a8,null))[_0xb811('0x2b')](saveUpdates(_0x51b04f['body'],null))[_0xb811('0x2b')](respondWithResult(_0x2b55a8,null))[_0xb811('0x4b')](handleError(_0x2b55a8,null));};exports[_0xb811('0x2d')]=function(_0x29014b,_0x423844){return db['FaxQueue'][_0xb811('0x4f')]({'where':{'id':_0x29014b[_0xb811('0x4d')]['id']}})['then'](handleEntityNotFound(_0x423844,null))[_0xb811('0x2b')](removeEntity(_0x423844,null))[_0xb811('0x4b')](handleError(_0x423844,null));};exports[_0xb811('0x5a')]=function(_0x52709c,_0x455e38){return db[_0xb811('0x34')][_0xb811('0x5a')]()[_0xb811('0x2b')](respondWithResult(_0x455e38,null))['catch'](handleError(_0x455e38,null));};exports[_0xb811('0x5b')]=function(_0x1a6aaa,_0x80dac1,_0x133ef0){var _0x281344={'raw':!![],'where':{}},_0x550400={},_0x1da2ac;return db[_0xb811('0x34')][_0xb811('0x5c')]({'where':{'id':_0x1a6aaa[_0xb811('0x4d')]['id']}})[_0xb811('0x2b')](handleEntityNotFound(_0x80dac1,null))[_0xb811('0x2b')](function(_0x1d1780){if(_0x1d1780){_0x1da2ac=_0x1d1780['get']({'plain':!![]});_0x550400['model']=_[_0xb811('0x4e')](db['UserFaxQueue'][_0xb811('0x35')]);_0x550400[_0xb811('0x38')]=_[_0xb811('0x4e')](_0x1a6aaa[_0xb811('0x38')]);_0x550400[_0xb811('0x39')]=_['intersection'](_0x550400[_0xb811('0x37')],_0x550400[_0xb811('0x38')]);_0x281344[_0xb811('0x3b')]=_[_0xb811('0x3a')](_0x550400[_0xb811('0x37')],qs[_0xb811('0x3c')](_0x1a6aaa[_0xb811('0x38')][_0xb811('0x3c')]));_0x281344['attributes']=_0x281344[_0xb811('0x3b')]['length']?_0x281344[_0xb811('0x3b')]:_0x550400[_0xb811('0x37')];if(!_0x1a6aaa[_0xb811('0x38')][_0xb811('0x3e')](_0xb811('0x3f'))){_0x281344[_0xb811('0x24')]=qs[_0xb811('0x24')](_0x1a6aaa[_0xb811('0x38')][_0xb811('0x24')]);_0x281344[_0xb811('0x22')]=qs[_0xb811('0x22')](_0x1a6aaa[_0xb811('0x38')]['offset']);}_0x281344[_0xb811('0x40')]=qs['sort'](_0x1a6aaa[_0xb811('0x38')][_0xb811('0x41')]);_0x281344[_0xb811('0x42')]=qs[_0xb811('0x39')](_['pick'](_0x1a6aaa[_0xb811('0x38')],_0x550400[_0xb811('0x39')]));_0x281344[_0xb811('0x42')]['FaxQueueId']=_0x1d1780['id'];if(_0x1a6aaa[_0xb811('0x38')]['filter']){_0x281344[_0xb811('0x42')]=_['merge'](_0x281344[_0xb811('0x42')],{'$or':_['map'](_0x281344[_0xb811('0x3b')],function(_0x2f00){var _0x8c6010={};_0x8c6010[_0x2f00]={'$like':'%'+_0x1a6aaa[_0xb811('0x38')][_0xb811('0x44')]+'%'};return _0x8c6010;})});}_0x281344=_[_0xb811('0x46')]({},_0x281344,_0x1a6aaa[_0xb811('0x47')]);return db[_0xb811('0x5d')][_0xb811('0x5e')](_0x281344);}})[_0xb811('0x2b')](function(_0xb31d3d){if(_0xb31d3d){return db[_0xb811('0x5f')]['findAndCountAll']({'where':{'id':_[_0xb811('0x33')](_0xb31d3d,_0xb811('0x60')),'role':_0xb811('0x61')},'attributes':['id','name','faxPause','updatedAt',_0xb811('0x62')]});}})[_0xb811('0x2b')](function(_0x43ff0f){if(_0x43ff0f){return{'count':_0x43ff0f[_0xb811('0x25')],'rows':_[_0xb811('0x33')](_0x43ff0f[_0xb811('0x4a')],function(_0x591961){return{'membername':_0x591961[_0xb811('0x30')],'UserId':_0x591961['id'],'queue_name':_0x1da2ac['name'],'FaxQueueId':_0x1da2ac['id'],'interface':util[_0xb811('0x63')](_0xb811('0x64'),_0xb811('0x65'),_0x591961[_0xb811('0x30')]),'penalty':0x0,'paused':_0x591961[_0xb811('0x66')],'createdAt':_0x591961[_0xb811('0x62')],'updatedAt':_0x591961[_0xb811('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb811('0x2b')](respondWithFilteredResult(_0x80dac1,_0x281344))['catch'](handleError(_0x80dac1,null));};exports[_0xb811('0x68')]=function(_0x40bc1c,_0xcc6b3c,_0x5bc5a5){var _0x41d2a9={};var _0x3b21b6={};var _0x5ce9ca;var _0x5daccf;return db[_0xb811('0x34')][_0xb811('0x5c')]({'where':{'id':_0x40bc1c[_0xb811('0x4d')]['id']}})[_0xb811('0x2b')](handleEntityNotFound(_0xcc6b3c,null))[_0xb811('0x2b')](function(_0x199840){if(_0x199840){_0x5ce9ca=_0x199840;_0x3b21b6[_0xb811('0x37')]=_[_0xb811('0x4e')](db[_0xb811('0x69')]['rawAttributes']);_0x3b21b6[_0xb811('0x38')]=_[_0xb811('0x4e')](_0x40bc1c[_0xb811('0x38')]);_0x3b21b6[_0xb811('0x39')]=_[_0xb811('0x3a')](_0x3b21b6[_0xb811('0x37')],_0x3b21b6['query']);_0x41d2a9[_0xb811('0x3b')]=_['intersection'](_0x3b21b6['model'],qs[_0xb811('0x3c')](_0x40bc1c[_0xb811('0x38')][_0xb811('0x3c')]));_0x41d2a9['attributes']=_0x41d2a9[_0xb811('0x3b')][_0xb811('0x3d')]?_0x41d2a9[_0xb811('0x3b')]:_0x3b21b6['model'];_0x41d2a9[_0xb811('0x40')]=qs[_0xb811('0x41')](_0x40bc1c[_0xb811('0x38')][_0xb811('0x41')]);_0x41d2a9['where']=qs['filters'](_[_0xb811('0x43')](_0x40bc1c[_0xb811('0x38')],_0x3b21b6[_0xb811('0x39')]));if(_0x40bc1c[_0xb811('0x38')][_0xb811('0x44')]){_0x41d2a9['where']=_['merge'](_0x41d2a9['where'],{'$or':_[_0xb811('0x33')](_0x41d2a9[_0xb811('0x3b')],function(_0x24d812){var _0x33971c={};_0x33971c[_0x24d812]={'$like':'%'+_0x40bc1c['query'][_0xb811('0x44')]+'%'};return _0x33971c;})});}_0x41d2a9=_[_0xb811('0x46')]({},_0x41d2a9,_0x40bc1c['options']);return _0x5ce9ca[_0xb811('0x68')](_0x41d2a9);}})['then'](function(_0x415df2){if(_0x415df2){_0x5daccf=_0x415df2[_0xb811('0x3d')];if(!_0x40bc1c[_0xb811('0x38')][_0xb811('0x3e')](_0xb811('0x3f'))){_0x41d2a9[_0xb811('0x24')]=qs[_0xb811('0x24')](_0x40bc1c[_0xb811('0x38')][_0xb811('0x24')]);_0x41d2a9[_0xb811('0x22')]=qs[_0xb811('0x22')](_0x40bc1c['query']['offset']);}return _0x5ce9ca['getTeams'](_0x41d2a9);}})[_0xb811('0x2b')](function(_0x1eb318){if(_0x1eb318){return _0x1eb318?{'count':_0x5daccf,'rows':_0x1eb318}:null;}})[_0xb811('0x2b')](respondWithResult(_0xcc6b3c,null))[_0xb811('0x4b')](handleError(_0xcc6b3c,null));};exports[_0xb811('0x6a')]=function(_0x103039,_0x5e0174,_0x71d7f1){var _0x1953b7=_0x103039[_0xb811('0x51')][_0xb811('0x6b')];return db[_0xb811('0x69')][_0xb811('0x5e')]({'where':{'id':_0x1953b7},'attributes':['id'],'include':[{'model':db[_0xb811('0x5f')],'as':_0xb811('0x6c'),'attributes':['id',_0xb811('0x30'),_0xb811('0x6d'),_0xb811('0x6e'),'interface'],'raw':!![]}]})[_0xb811('0x2b')](function(_0x3291d6){if(_0x3291d6){var _0x3d35a4=_[_0xb811('0x6f')](_0x3291d6,function(_0x59fb90){var _0x31bd88=_0x59fb90[_0xb811('0x54')]({'plain':!![]});return _0x31bd88[_0xb811('0x6c')];});return db[_0xb811('0x34')][_0xb811('0x4f')]({'where':{'id':_0x103039[_0xb811('0x4d')]['id']}})[_0xb811('0x2b')](function(_0x36c53c){return db[_0xb811('0x70')][_0xb811('0x71')](function(_0x306f3d){return _0x36c53c[_0xb811('0x6a')](_0x1953b7,{'transaction':_0x306f3d})['then'](function(){return BPromise[_0xb811('0x72')](_0x3d35a4,function(_0x198d84){return db['UserFaxQueue'][_0xb811('0x73')]({'where':{'UserId':_0x198d84['id'],'FaxQueueId':_0x103039[_0xb811('0x4d')]['id']},'transaction':_0x306f3d});});})[_0xb811('0x2b')](function(){_0x3d35a4['forEach'](function(_0x1d2f8d){socket['emit'](_0xb811('0x74'),{'UserId':_0x1d2f8d['id'],'FaxQueueId':_0x36c53c['id']});});});});});}})[_0xb811('0x2b')](respondWithStatusCode(_0x5e0174,null))[_0xb811('0x4b')](handleError(_0x5e0174,null));};exports[_0xb811('0x75')]=function(_0x2380dc,_0x55bb2c,_0x27c0f7){return db[_0xb811('0x69')][_0xb811('0x5e')]({'where':{'id':_0x2380dc[_0xb811('0x38')][_0xb811('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xb811('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb811('0x2b')](handleEntityNotFound(_0x55bb2c,null))[_0xb811('0x2b')](function(_0x6b0e09){var _0x2a9a0e=_[_0xb811('0x33')](_0x6b0e09,'id');var _0xade6de=[];var _0x3c5f45=[];var _0x3db8d9=squel[_0xb811('0x76')]();_0x3db8d9['field'](_0xb811('0x77'))[_0xb811('0x78')](_0xb811('0x79'),'tq')[_0xb811('0x7a')](_0xb811('0x7b'),'ut',_0xb811('0x7c'))[_0xb811('0x42')]('FaxQueueId\x20=\x20?',_0x2380dc[_0xb811('0x4d')]['id']);for(var _0x5f1607=0x0;_0x5f1607<_0x6b0e09[_0xb811('0x3d')];_0x5f1607+=0x1){let _0x1de13f=_0x6b0e09[_0x5f1607];for(var _0x5a7bef=0x0;_0x5a7bef<_0x1de13f['Agents']['length'];_0x5a7bef+=0x1){let _0x1e4f4a=_0x1de13f[_0xb811('0x6c')][_0x5a7bef];var _0x23e604=_0x3db8d9[_0xb811('0x7d')]();_0x23e604[_0xb811('0x42')](_0xb811('0x7e'),_0x1e4f4a['id']);_0x3c5f45[_0xb811('0x7f')](db['sequelize']['query'](_0x23e604[_0xb811('0x80')](),{'type':db[_0xb811('0x70')][_0xb811('0x81')][_0xb811('0x82')]})[_0xb811('0x2b')](function(_0x3fb9e3){if(_0x3fb9e3[_0xb811('0x3d')]===0x1){return _0x1e4f4a['id'];}else{var _0x58f1f8=_[_0xb811('0x83')](_[_0xb811('0x33')](_0x3fb9e3,_0xb811('0x84')),function(_0x2f5460){return _[_0xb811('0x85')](_0x2a9a0e,_0x2f5460);});if(_0x58f1f8){return _0x1e4f4a['id'];}}}));}}return BPromise[_0xb811('0x86')](_0x3c5f45)[_0xb811('0x2b')](function(_0x304b5e){_0xade6de=_(_0xade6de)[_0xb811('0x87')](_0x304b5e)['compact']()['value']();return db[_0xb811('0x34')][_0xb811('0x4f')]({'where':{'id':_0x2380dc[_0xb811('0x4d')]['id']}})[_0xb811('0x2b')](function(_0x3a8671){return db['sequelize'][_0xb811('0x71')](function(_0x50c1ff){return _0x3a8671[_0xb811('0x75')](_0x2380dc[_0xb811('0x38')][_0xb811('0x6b')],{'transaction':_0x50c1ff})[_0xb811('0x2b')](function(){if(!_[_0xb811('0x88')](_0xade6de)){return _0x3a8671[_0xb811('0x89')](_0xade6de,{'transaction':_0x50c1ff});}})[_0xb811('0x2b')](function(){_0xade6de[_0xb811('0x8a')](function(_0x3c2ff7){socket[_0xb811('0x8b')]('userFaxQueue:remove',{'UserId':_0x3c2ff7,'FaxQueueId':_0x3a8671['id']});});});});});});})[_0xb811('0x2b')](respondWithStatusCode(_0x55bb2c,null))[_0xb811('0x4b')](handleError(_0x55bb2c,null));};exports['addAgents']=function(_0x68c819,_0x13843d,_0x6730bd){return db[_0xb811('0x34')]['find']({'where':{'id':_0x68c819[_0xb811('0x4d')]['id']}})[_0xb811('0x2b')](handleEntityNotFound(_0x13843d,null))['then'](function(_0x432384){if(_0x432384){return _0x432384[_0xb811('0x8c')](_0x68c819['body'][_0xb811('0x6b')],_['omit'](_0x68c819[_0xb811('0x51')],['ids','id'])||{})[_0xb811('0x8d')](function(_0x2ee05d){for(var _0x11f9ea=0x0;_0x11f9ea<_0x68c819[_0xb811('0x51')][_0xb811('0x6b')][_0xb811('0x3d')];_0x11f9ea+=0x1){socket[_0xb811('0x8b')]('userFaxQueue:save',{'UserId':Number(_0x68c819['body'][_0xb811('0x6b')][_0x11f9ea]),'FaxQueueId':Number(_0x68c819[_0xb811('0x4d')]['id'])});}return _0x2ee05d;});}})['then'](respondWithResult(_0x13843d,null))[_0xb811('0x4b')](handleError(_0x13843d,null));};exports[_0xb811('0x89')]=function(_0x36b994,_0x4eb30f,_0x151e14){return db[_0xb811('0x34')]['find']({'where':{'id':_0x36b994[_0xb811('0x4d')]['id']}})[_0xb811('0x2b')](handleEntityNotFound(_0x4eb30f,null))[_0xb811('0x2b')](function(_0x3e100c){if(_0x3e100c){return _0x3e100c[_0xb811('0x89')](_0x36b994[_0xb811('0x38')][_0xb811('0x6b')])[_0xb811('0x2b')](function(){if(_[_0xb811('0x8e')](_0x36b994[_0xb811('0x38')][_0xb811('0x6b')])){for(var _0x322ea9=0x0;_0x322ea9<_0x36b994[_0xb811('0x38')]['ids'][_0xb811('0x3d')];_0x322ea9+=0x1){socket[_0xb811('0x8b')](_0xb811('0x8f'),{'UserId':Number(_0x36b994['query']['ids'][_0x322ea9]),'FaxQueueId':Number(_0x36b994[_0xb811('0x4d')]['id'])});}}else{socket[_0xb811('0x8b')](_0xb811('0x8f'),{'UserId':Number(_0x36b994[_0xb811('0x38')][_0xb811('0x6b')]),'FaxQueueId':Number(_0x36b994[_0xb811('0x4d')]['id'])});}});}})[_0xb811('0x2b')](respondWithStatusCode(_0x4eb30f,null))[_0xb811('0x4b')](handleError(_0x4eb30f,null));};exports[_0xb811('0x90')]=function(_0x4768e9,_0x58c370,_0xca759b){var _0x5975ce={};var _0x2b97fb={};var _0x3f8e94;var _0x3e194c;return db[_0xb811('0x34')][_0xb811('0x5c')]({'where':{'id':_0x4768e9[_0xb811('0x4d')]['id']}})[_0xb811('0x2b')](handleEntityNotFound(_0x58c370,null))[_0xb811('0x2b')](function(_0x214250){if(_0x214250){_0x3f8e94=_0x214250;_0x2b97fb[_0xb811('0x37')]=_[_0xb811('0x4e')](db[_0xb811('0x5f')][_0xb811('0x35')]);_0x2b97fb['query']=_[_0xb811('0x4e')](_0x4768e9['query']);_0x2b97fb['filters']=_['intersection'](_0x2b97fb[_0xb811('0x37')],_0x2b97fb[_0xb811('0x38')]);_0x5975ce[_0xb811('0x3b')]=_[_0xb811('0x3a')](_0x2b97fb[_0xb811('0x37')],qs[_0xb811('0x3c')](_0x4768e9[_0xb811('0x38')][_0xb811('0x3c')]));_0x5975ce['attributes']=_0x5975ce[_0xb811('0x3b')]['length']?_0x5975ce['attributes']:_0x2b97fb[_0xb811('0x37')];_0x5975ce[_0xb811('0x40')]=qs[_0xb811('0x41')](_0x4768e9[_0xb811('0x38')][_0xb811('0x41')]);_0x5975ce[_0xb811('0x42')]=qs[_0xb811('0x39')](_[_0xb811('0x43')](_0x4768e9['query'],_0x2b97fb[_0xb811('0x39')]));if(_0x4768e9[_0xb811('0x38')][_0xb811('0x44')]){_0x5975ce[_0xb811('0x42')]=_[_0xb811('0x46')](_0x5975ce[_0xb811('0x42')],{'$or':_[_0xb811('0x33')](_0x5975ce[_0xb811('0x3b')],function(_0x160835){var _0x560efa={};_0x560efa[_0x160835]={'$like':'%'+_0x4768e9[_0xb811('0x38')][_0xb811('0x44')]+'%'};return _0x560efa;})});}_0x5975ce=_[_0xb811('0x46')]({},_0x5975ce,_0x4768e9[_0xb811('0x47')]);return _0x3f8e94['getAgents'](_0x5975ce);}})[_0xb811('0x2b')](function(_0x4ff323){if(_0x4ff323){_0x3e194c=_0x4ff323[_0xb811('0x3d')];if(!_0x4768e9[_0xb811('0x38')][_0xb811('0x3e')](_0xb811('0x3f'))){_0x5975ce[_0xb811('0x24')]=qs[_0xb811('0x24')](_0x4768e9[_0xb811('0x38')][_0xb811('0x24')]);_0x5975ce[_0xb811('0x22')]=qs[_0xb811('0x22')](_0x4768e9[_0xb811('0x38')][_0xb811('0x22')]);}return _0x3f8e94[_0xb811('0x90')](_0x5975ce);}})[_0xb811('0x2b')](function(_0x4f82de){if(_0x4f82de){return _0x4f82de?{'count':_0x3e194c,'rows':_0x4f82de}:null;}})[_0xb811('0x2b')](respondWithResult(_0x58c370,null))[_0xb811('0x4b')](handleError(_0x58c370,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f8d27f5..3e7c478 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 _0x31b6=['FaxQueue','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x20e375,_0x31f080){var _0x5b426f=function(_0x54ac24){while(--_0x54ac24){_0x20e375['push'](_0x20e375['shift']());}};_0x5b426f(++_0x31f080);}(_0x31b6,0x17a));var _0x631b=function(_0x26fdb5,_0x47f4b9){_0x26fdb5=_0x26fdb5-0x0;var _0x5bc218=_0x31b6[_0x26fdb5];return _0x5bc218;};'use strict';var EventEmitter=require(_0x631b('0x0'));var FaxQueue=require(_0x631b('0x1'))['db'][_0x631b('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x631b('0x3')](0x0);var events={'afterCreate':_0x631b('0x4'),'afterUpdate':_0x631b('0x5'),'afterDestroy':_0x631b('0x6')};function emitEvent(_0x4ee8f2){return function(_0x2bcc35,_0x2c7925,_0xfceb8d){FaxQueueEvents[_0x631b('0x7')](_0x4ee8f2+':'+_0x2bcc35['id'],_0x2bcc35);FaxQueueEvents['emit'](_0x4ee8f2,_0x2bcc35);_0xfceb8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x631b('0x8')](e,emitEvent(event));}}module[_0x631b('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x39b9=['FaxQueue','setMaxListeners','save','remove','hook','events','../../mysqldb'];(function(_0xa856f0,_0x3ebdd8){var _0x52da0e=function(_0x15265d){while(--_0x15265d){_0xa856f0['push'](_0xa856f0['shift']());}};_0x52da0e(++_0x3ebdd8);}(_0x39b9,0x139));var _0x939b=function(_0x3f3e97,_0x2a03bc){_0x3f3e97=_0x3f3e97-0x0;var _0xcbbec=_0x39b9[_0x3f3e97];return _0xcbbec;};'use strict';var EventEmitter=require(_0x939b('0x0'));var FaxQueue=require(_0x939b('0x1'))['db'][_0x939b('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x939b('0x3')](0x0);var events={'afterCreate':_0x939b('0x4'),'afterUpdate':'update','afterDestroy':_0x939b('0x5')};function emitEvent(_0x15483b){return function(_0x185b05,_0x303bfe,_0x442d1d){FaxQueueEvents['emit'](_0x15483b+':'+_0x185b05['id'],_0x185b05);FaxQueueEvents['emit'](_0x15483b,_0x185b05);_0x442d1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x939b('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f8b01e3..814ec4d 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 _0x0612=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x4b36a0,_0x3e59f6){var _0x3bd2bc=function(_0x2af381){while(--_0x2af381){_0x4b36a0['push'](_0x4b36a0['shift']());}};_0x3bd2bc(++_0x3e59f6);}(_0x0612,0x173));var _0x2061=function(_0x22bb89,_0x15fbbd){_0x22bb89=_0x22bb89-0x0;var _0x481750=_0x0612[_0x22bb89];return _0x481750;};'use strict';var _=require(_0x2061('0x0'));var util=require('util');var logger=require(_0x2061('0x1'))(_0x2061('0x2'));var moment=require(_0x2061('0x3'));var BPromise=require('bluebird');var rp=require(_0x2061('0x4'));var fs=require('fs');var path=require(_0x2061('0x5'));var rimraf=require(_0x2061('0x6'));var config=require(_0x2061('0x7'));var attributes=require('./faxQueue.attributes');module[_0x2061('0x8')]=function(_0xf9ea4c,_0x21f3ca){return _0xf9ea4c[_0x2061('0x9')](_0x2061('0xa'),attributes,{'tableName':_0x2061('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x589d=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x231dd2,_0x40671c){var _0x5672e5=function(_0x35d3cf){while(--_0x35d3cf){_0x231dd2['push'](_0x231dd2['shift']());}};_0x5672e5(++_0x40671c);}(_0x589d,0xac));var _0xd589=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x589d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd589('0x0'));var util=require(_0xd589('0x1'));var logger=require(_0xd589('0x2'))(_0xd589('0x3'));var moment=require(_0xd589('0x4'));var BPromise=require(_0xd589('0x5'));var rp=require(_0xd589('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd589('0x7'));var config=require(_0xd589('0x8'));var attributes=require(_0xd589('0x9'));module['exports']=function(_0x41d333,_0x10aa0c){return _0x41d333[_0xd589('0xa')](_0xd589('0xb'),attributes,{'tableName':_0xd589('0xc'),'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 c9f89cb..8fbf966 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 _0x1c3b=['catch','GetFaxQueue','FaxQueue','options','attributes','include','map','model','ShowFaxQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result'];(function(_0x25104c,_0x20b687){var _0x24dd98=function(_0x621d94){while(--_0x621d94){_0x25104c['push'](_0x25104c['shift']());}};_0x24dd98(++_0x20b687);}(_0x1c3b,0xd3));var _0xb1c3=function(_0x9b0190,_0x3df5da){_0x9b0190=_0x9b0190-0x0;var _0xb9970d=_0x1c3b[_0x9b0190];return _0xb9970d;};'use strict';var _=require(_0xb1c3('0x0'));var util=require(_0xb1c3('0x1'));var moment=require(_0xb1c3('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1c3('0x3'));var fs=require('fs');var Redis=require(_0xb1c3('0x4'));var db=require(_0xb1c3('0x5'))['db'];var utils=require(_0xb1c3('0x6'));var logger=require('../../config/logger')(_0xb1c3('0x7'));var config=require(_0xb1c3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb1c3('0x9')][_0xb1c3('0xa')]({'port':0x232a});config[_0xb1c3('0xb')]=_[_0xb1c3('0xc')](config[_0xb1c3('0xb')],{'host':_0xb1c3('0xd'),'port':0x18eb});var socket=require(_0xb1c3('0xe'))(new Redis(config[_0xb1c3('0xb')]));require(_0xb1c3('0xf'))[_0xb1c3('0x10')](socket);function respondWithRpcPromise(_0x34ecc7,_0x437724,_0x574b26){return new BPromise(function(_0x44b443,_0x2d77de){return client[_0xb1c3('0x11')](_0x34ecc7,_0x574b26)[_0xb1c3('0x12')](function(_0x292f17){logger[_0xb1c3('0x13')]('FaxQueue,\x20%s,\x20%s',_0x437724,_0xb1c3('0x14'));logger[_0xb1c3('0x15')](_0xb1c3('0x16'),_0x437724,_0xb1c3('0x14'),JSON[_0xb1c3('0x17')](_0x292f17));if(_0x292f17[_0xb1c3('0x18')]){if(_0x292f17[_0xb1c3('0x18')][_0xb1c3('0x19')]===0x1f4){logger[_0xb1c3('0x18')](_0xb1c3('0x1a'),_0x437724,_0x292f17[_0xb1c3('0x18')][_0xb1c3('0x1b')]);return _0x2d77de(_0x292f17[_0xb1c3('0x18')][_0xb1c3('0x1b')]);}logger[_0xb1c3('0x18')](_0xb1c3('0x1a'),_0x437724,_0x292f17[_0xb1c3('0x18')][_0xb1c3('0x1b')]);return _0x44b443(_0x292f17['error']['message']);}else{logger[_0xb1c3('0x13')](_0xb1c3('0x1a'),_0x437724,'request\x20sent');_0x44b443(_0x292f17[_0xb1c3('0x1c')][_0xb1c3('0x1b')]);}})[_0xb1c3('0x1d')](function(_0x2184c6){logger['error'](_0xb1c3('0x1a'),_0x437724,_0x2184c6);_0x2d77de(_0x2184c6);});});}exports[_0xb1c3('0x1e')]=function(_0x327d4e){var _0x1a16a0=this;return new Promise(function(_0x193ed5,_0x3d0559){return db[_0xb1c3('0x1f')]['findAll']({'raw':_0x327d4e[_0xb1c3('0x20')]?_0x327d4e[_0xb1c3('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x327d4e[_0xb1c3('0x20')]?_0x327d4e[_0xb1c3('0x20')]['where']||null:null,'attributes':_0x327d4e['options']?_0x327d4e[_0xb1c3('0x20')][_0xb1c3('0x21')]||null:null,'limit':_0x327d4e['options']?_0x327d4e[_0xb1c3('0x20')]['limit']||null:null,'include':_0x327d4e['options']?_0x327d4e[_0xb1c3('0x20')][_0xb1c3('0x22')]?_[_0xb1c3('0x23')](_0x327d4e[_0xb1c3('0x20')]['include'],function(_0x1e8a99){return{'model':db[_0x1e8a99['model']],'as':_0x1e8a99['as'],'attributes':_0x1e8a99['attributes'],'include':_0x1e8a99[_0xb1c3('0x22')]?_['map'](_0x1e8a99[_0xb1c3('0x22')],function(_0x47b99f){return{'model':db[_0x47b99f[_0xb1c3('0x24')]],'as':_0x47b99f['as'],'attributes':_0x47b99f[_0xb1c3('0x21')],'include':_0x47b99f[_0xb1c3('0x22')]?_[_0xb1c3('0x23')](_0x47b99f[_0xb1c3('0x22')],function(_0x28aede){return{'model':db[_0x28aede[_0xb1c3('0x24')]],'as':_0x28aede['as'],'attributes':_0x28aede['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1c3('0x12')](function(_0x3d40dc){logger[_0xb1c3('0x13')]('GetFaxQueue',_0x327d4e);logger[_0xb1c3('0x15')](_0xb1c3('0x1e'),_0x327d4e,JSON[_0xb1c3('0x17')](_0x3d40dc));_0x193ed5(_0x3d40dc);})[_0xb1c3('0x1d')](function(_0x343ea2){logger[_0xb1c3('0x18')]('GetFaxQueue',_0x343ea2[_0xb1c3('0x1b')],_0x327d4e);_0x3d0559(_0x1a16a0[_0xb1c3('0x18')](0x1f4,_0x343ea2[_0xb1c3('0x1b')]));});});};exports[_0xb1c3('0x25')]=function(_0x1983cb){var _0x4a9610=this;return new Promise(function(_0x349e6d,_0x432619){return db[_0xb1c3('0x1f')][_0xb1c3('0x26')]({'raw':_0x1983cb[_0xb1c3('0x20')]?_0x1983cb[_0xb1c3('0x20')][_0xb1c3('0x27')]===undefined?!![]:![]:!![],'where':_0x1983cb[_0xb1c3('0x20')]?_0x1983cb[_0xb1c3('0x20')]['where']||null:null,'attributes':_0x1983cb['options']?_0x1983cb[_0xb1c3('0x20')][_0xb1c3('0x21')]||null:null,'include':_0x1983cb['options']?_0x1983cb[_0xb1c3('0x20')][_0xb1c3('0x22')]?_[_0xb1c3('0x23')](_0x1983cb[_0xb1c3('0x20')]['include'],function(_0x3ed882){return{'model':db[_0x3ed882[_0xb1c3('0x24')]],'as':_0x3ed882['as'],'attributes':_0x3ed882['attributes'],'include':_0x3ed882[_0xb1c3('0x22')]?_[_0xb1c3('0x23')](_0x3ed882[_0xb1c3('0x22')],function(_0x13887c){return{'model':db[_0x13887c['model']],'as':_0x13887c['as'],'attributes':_0x13887c[_0xb1c3('0x21')],'include':_0x13887c[_0xb1c3('0x22')]?_['map'](_0x13887c[_0xb1c3('0x22')],function(_0x1fe968){return{'model':db[_0x1fe968[_0xb1c3('0x24')]],'as':_0x1fe968['as'],'attributes':_0x1fe968[_0xb1c3('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb1c3('0x12')](function(_0x37b9d6){logger[_0xb1c3('0x13')](_0xb1c3('0x25'),_0x1983cb);logger['debug'](_0xb1c3('0x25'),_0x1983cb,JSON[_0xb1c3('0x17')](_0x37b9d6));_0x349e6d(_0x37b9d6);})['catch'](function(_0xd4aee8){logger['error'](_0xb1c3('0x25'),_0xd4aee8[_0xb1c3('0x1b')],_0x1983cb);_0x432619(_0x4a9610['error'](0x1f4,_0xd4aee8[_0xb1c3('0x1b')]));});});}; \ No newline at end of file +var _0x9f55=['find','where','ShowFaxQueue','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxQueue','findAll','options','raw','attributes','map','include','model','GetFaxQueue','catch'];(function(_0x431ff6,_0x5a2266){var _0x4baa7e=function(_0x4fe56f){while(--_0x4fe56f){_0x431ff6['push'](_0x431ff6['shift']());}};_0x4baa7e(++_0x5a2266);}(_0x9f55,0x106));var _0x59f5=function(_0x4907a2,_0x5da408){_0x4907a2=_0x4907a2-0x0;var _0x5b9e2f=_0x9f55[_0x4907a2];return _0x5b9e2f;};'use strict';var _=require(_0x59f5('0x0'));var util=require('util');var moment=require(_0x59f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x59f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59f5('0x3'))['db'];var utils=require(_0x59f5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x59f5('0x5'));var jayson=require(_0x59f5('0x6'));var client=jayson['client'][_0x59f5('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x59f5('0x8')],{'host':_0x59f5('0x9'),'port':0x18eb});var socket=require(_0x59f5('0xa'))(new Redis(config[_0x59f5('0x8')]));require('./faxQueue.socket')[_0x59f5('0xb')](socket);function respondWithRpcPromise(_0x9cc024,_0x1aacd9,_0x25ca2a){return new BPromise(function(_0x284a3e,_0x3734fa){return client[_0x59f5('0xc')](_0x9cc024,_0x25ca2a)[_0x59f5('0xd')](function(_0x113f3a){logger[_0x59f5('0xe')](_0x59f5('0xf'),_0x1aacd9,_0x59f5('0x10'));logger[_0x59f5('0x11')](_0x59f5('0x12'),_0x1aacd9,_0x59f5('0x10'),JSON[_0x59f5('0x13')](_0x113f3a));if(_0x113f3a[_0x59f5('0x14')]){if(_0x113f3a[_0x59f5('0x14')][_0x59f5('0x15')]===0x1f4){logger[_0x59f5('0x14')](_0x59f5('0xf'),_0x1aacd9,_0x113f3a[_0x59f5('0x14')][_0x59f5('0x16')]);return _0x3734fa(_0x113f3a[_0x59f5('0x14')][_0x59f5('0x16')]);}logger[_0x59f5('0x14')](_0x59f5('0xf'),_0x1aacd9,_0x113f3a[_0x59f5('0x14')]['message']);return _0x284a3e(_0x113f3a[_0x59f5('0x14')][_0x59f5('0x16')]);}else{logger[_0x59f5('0xe')](_0x59f5('0xf'),_0x1aacd9,_0x59f5('0x10'));_0x284a3e(_0x113f3a[_0x59f5('0x17')]['message']);}})['catch'](function(_0x50fdcf){logger[_0x59f5('0x14')]('FaxQueue,\x20%s,\x20%s',_0x1aacd9,_0x50fdcf);_0x3734fa(_0x50fdcf);});});}exports['GetFaxQueue']=function(_0xf7d4b3){var _0x3b5fe0=this;return new Promise(function(_0x15d159,_0x5705eb){return db[_0x59f5('0x18')][_0x59f5('0x19')]({'raw':_0xf7d4b3[_0x59f5('0x1a')]?_0xf7d4b3[_0x59f5('0x1a')][_0x59f5('0x1b')]===undefined?!![]:![]:!![],'where':_0xf7d4b3['options']?_0xf7d4b3[_0x59f5('0x1a')]['where']||null:null,'attributes':_0xf7d4b3[_0x59f5('0x1a')]?_0xf7d4b3['options'][_0x59f5('0x1c')]||null:null,'limit':_0xf7d4b3['options']?_0xf7d4b3[_0x59f5('0x1a')]['limit']||null:null,'include':_0xf7d4b3[_0x59f5('0x1a')]?_0xf7d4b3['options']['include']?_[_0x59f5('0x1d')](_0xf7d4b3['options'][_0x59f5('0x1e')],function(_0x2ef803){return{'model':db[_0x2ef803[_0x59f5('0x1f')]],'as':_0x2ef803['as'],'attributes':_0x2ef803[_0x59f5('0x1c')],'include':_0x2ef803['include']?_['map'](_0x2ef803[_0x59f5('0x1e')],function(_0x2d0463){return{'model':db[_0x2d0463['model']],'as':_0x2d0463['as'],'attributes':_0x2d0463['attributes'],'include':_0x2d0463['include']?_[_0x59f5('0x1d')](_0x2d0463['include'],function(_0x424880){return{'model':db[_0x424880[_0x59f5('0x1f')]],'as':_0x424880['as'],'attributes':_0x424880[_0x59f5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x59f5('0xd')](function(_0x2a9931){logger['info'](_0x59f5('0x20'),_0xf7d4b3);logger[_0x59f5('0x11')](_0x59f5('0x20'),_0xf7d4b3,JSON['stringify'](_0x2a9931));_0x15d159(_0x2a9931);})[_0x59f5('0x21')](function(_0x4e0b8d){logger['error']('GetFaxQueue',_0x4e0b8d[_0x59f5('0x16')],_0xf7d4b3);_0x5705eb(_0x3b5fe0[_0x59f5('0x14')](0x1f4,_0x4e0b8d[_0x59f5('0x16')]));});});};exports['ShowFaxQueue']=function(_0x5aa0b0){var _0x201d66=this;return new Promise(function(_0x4f4185,_0x1919de){return db[_0x59f5('0x18')][_0x59f5('0x22')]({'raw':_0x5aa0b0[_0x59f5('0x1a')]?_0x5aa0b0[_0x59f5('0x1a')][_0x59f5('0x1b')]===undefined?!![]:![]:!![],'where':_0x5aa0b0['options']?_0x5aa0b0[_0x59f5('0x1a')][_0x59f5('0x23')]||null:null,'attributes':_0x5aa0b0[_0x59f5('0x1a')]?_0x5aa0b0[_0x59f5('0x1a')][_0x59f5('0x1c')]||null:null,'include':_0x5aa0b0[_0x59f5('0x1a')]?_0x5aa0b0[_0x59f5('0x1a')][_0x59f5('0x1e')]?_[_0x59f5('0x1d')](_0x5aa0b0[_0x59f5('0x1a')]['include'],function(_0xc8a13b){return{'model':db[_0xc8a13b['model']],'as':_0xc8a13b['as'],'attributes':_0xc8a13b['attributes'],'include':_0xc8a13b[_0x59f5('0x1e')]?_[_0x59f5('0x1d')](_0xc8a13b[_0x59f5('0x1e')],function(_0x205ee5){return{'model':db[_0x205ee5[_0x59f5('0x1f')]],'as':_0x205ee5['as'],'attributes':_0x205ee5['attributes'],'include':_0x205ee5[_0x59f5('0x1e')]?_['map'](_0x205ee5[_0x59f5('0x1e')],function(_0x41fb2c){return{'model':db[_0x41fb2c[_0x59f5('0x1f')]],'as':_0x41fb2c['as'],'attributes':_0x41fb2c[_0x59f5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40d55b){logger[_0x59f5('0xe')]('ShowFaxQueue',_0x5aa0b0);logger[_0x59f5('0x11')](_0x59f5('0x24'),_0x5aa0b0,JSON[_0x59f5('0x13')](_0x40d55b));_0x4f4185(_0x40d55b);})['catch'](function(_0x915b89){logger[_0x59f5('0x14')](_0x59f5('0x24'),_0x915b89[_0x59f5('0x16')],_0x5aa0b0);_0x1919de(_0x201d66['error'](0x1f4,_0x915b89['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index db1f08b..b8ad1e1 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 _0x2954=['length','faxQueue:','save','remove','update','removeListener','register'];(function(_0x2f1b6a,_0xa7dc34){var _0xf52396=function(_0xc0b056){while(--_0xc0b056){_0x2f1b6a['push'](_0x2f1b6a['shift']());}};_0xf52396(++_0xa7dc34);}(_0x2954,0x1de));var _0x4295=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x2954[_0x219d87];return _0x22823d;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x4295('0x0'),_0x4295('0x1'),_0x4295('0x2')];function createListener(_0x34c08a,_0x38bc9a){return function(_0x534756){_0x38bc9a['emit'](_0x34c08a,_0x534756);};}function removeListener(_0x2a32cb,_0x361b54){return function(){FaxQueueEvents[_0x4295('0x3')](_0x2a32cb,_0x361b54);};}exports[_0x4295('0x4')]=function(_0x5543e4){for(var _0x3a4390=0x0,_0x258911=events[_0x4295('0x5')];_0x3a4390<_0x258911;_0x3a4390++){var _0x5e4db1=events[_0x3a4390];var _0x7296ec=createListener(_0x4295('0x6')+_0x5e4db1,_0x5543e4);FaxQueueEvents['on'](_0x5e4db1,_0x7296ec);}}; \ No newline at end of file +var _0x465b=['removeListener','register','length','faxQueue:','./faxQueue.events','save','update','emit'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0x465b,0x1dc));var _0xb465=function(_0x21e6c5,_0x25767f){_0x21e6c5=_0x21e6c5-0x0;var _0x304344=_0x465b[_0x21e6c5];return _0x304344;};'use strict';var FaxQueueEvents=require(_0xb465('0x0'));var events=[_0xb465('0x1'),'remove',_0xb465('0x2')];function createListener(_0x2b593f,_0x465574){return function(_0x2d6948){_0x465574[_0xb465('0x3')](_0x2b593f,_0x2d6948);};}function removeListener(_0x5946de,_0x41d3be){return function(){FaxQueueEvents[_0xb465('0x4')](_0x5946de,_0x41d3be);};}exports[_0xb465('0x5')]=function(_0x96948b){for(var _0x48c5f5=0x0,_0x3a692e=events[_0xb465('0x6')];_0x48c5f5<_0x3a692e;_0x48c5f5++){var _0x234c20=events[_0x48c5f5];var _0x1b894d=createListener(_0xb465('0x7')+_0x234c20,_0x96948b);FaxQueueEvents['on'](_0x234c20,_0x1b894d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 0220cf3..c8a9425 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 _0xf072=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','multer'];(function(_0x165194,_0x31a93e){var _0x2975f0=function(_0x49ae22){while(--_0x49ae22){_0x165194['push'](_0x165194['shift']());}};_0x2975f0(++_0x31a93e);}(_0xf072,0x1cf));var _0x2f07=function(_0x5a369d,_0x140b74){_0x5a369d=_0x5a369d-0x0;var _0x22cfba=_0xf072[_0x5a369d];return _0x22cfba;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0x8')](_0x2f07('0xf'),auth[_0x2f07('0x9')](),controller['getMembers']);router[_0x2f07('0x8')](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router['get']('/:id/users',auth[_0x2f07('0x9')](),controller[_0x2f07('0x12')]);router['post']('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0x13')]);router[_0x2f07('0x14')]('/:id/teams',auth[_0x2f07('0x9')](),controller[_0x2f07('0x15')]);router[_0x2f07('0x14')](_0x2f07('0x16'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x17')]);router['put'](_0x2f07('0xd'),auth['isAuthenticated'](),controller[_0x2f07('0x18')]);router[_0x2f07('0x19')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x1a')]);router[_0x2f07('0x19')](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller['removeTeams']);router[_0x2f07('0x19')]('/:id/users',auth[_0x2f07('0x9')](),controller[_0x2f07('0x1b')]);module[_0x2f07('0x1c')]=router; \ No newline at end of file +var _0x4317=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','destroy','delete','removeTeams','removeAgents','exports'];(function(_0x3b9c9b,_0x53ccb1){var _0x5f0c7b=function(_0x4a447b){while(--_0x4a447b){_0x3b9c9b['push'](_0x3b9c9b['shift']());}};_0x5f0c7b(++_0x53ccb1);}(_0x4317,0x7c));var _0x7431=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4317[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var fs_extra=require(_0x7431('0x4'));var auth=require(_0x7431('0x5'));var interaction=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var controller=require(_0x7431('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7431('0x9')]);router[_0x7431('0xa')](_0x7431('0xb'),auth[_0x7431('0xc')](),controller[_0x7431('0xd')]);router[_0x7431('0xa')](_0x7431('0xe'),auth[_0x7431('0xc')](),controller[_0x7431('0xf')]);router[_0x7431('0xa')](_0x7431('0x10'),auth[_0x7431('0xc')](),controller[_0x7431('0x11')]);router[_0x7431('0xa')](_0x7431('0x12'),auth[_0x7431('0xc')](),controller[_0x7431('0x13')]);router[_0x7431('0xa')](_0x7431('0x14'),auth[_0x7431('0xc')](),controller[_0x7431('0x15')]);router[_0x7431('0x16')]('/',auth[_0x7431('0xc')](),controller[_0x7431('0x17')]);router['post'](_0x7431('0x12'),auth[_0x7431('0xc')](),controller[_0x7431('0x18')]);router['post'](_0x7431('0x14'),auth[_0x7431('0xc')](),controller[_0x7431('0x19')]);router['put'](_0x7431('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7431('0xe'),auth[_0x7431('0xc')](),controller[_0x7431('0x1a')]);router[_0x7431('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7431('0x1c')]);router[_0x7431('0x1b')](_0x7431('0x14'),auth[_0x7431('0xc')](),controller[_0x7431('0x1d')]);module[_0x7431('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 41a9a7c..055c776 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 _0x643e=['exports','STRING','DATE','moment'];(function(_0x5e7990,_0x20fcbe){var _0x5d5b2e=function(_0x1cce14){while(--_0x1cce14){_0x5e7990['push'](_0x5e7990['shift']());}};_0x5d5b2e(++_0x20fcbe);}(_0x643e,0x193));var _0xe643=function(_0x384262,_0x1f84f3){_0x384262=_0x384262-0x0;var _0x5086cf=_0x643e[_0x384262];return _0x5086cf;};'use strict';var moment=require(_0xe643('0x0'));var Sequelize=require('sequelize');module[_0xe643('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe643('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe643('0x3')]},'exitAt':{'type':Sequelize[_0xe643('0x3')]},'reason':{'type':Sequelize[_0xe643('0x2')]}}; \ No newline at end of file +var _0xc918=['DATE','moment','sequelize','exports','STRING'];(function(_0xa3a88,_0x425fb2){var _0x1f3e40=function(_0x40a498){while(--_0x40a498){_0xa3a88['push'](_0xa3a88['shift']());}};_0x1f3e40(++_0x425fb2);}(_0xc918,0x15a));var _0x8c91=function(_0x1e6dd7,_0x275cb){_0x1e6dd7=_0x1e6dd7-0x0;var _0x405461=_0xc918[_0x1e6dd7];return _0x405461;};'use strict';var moment=require(_0x8c91('0x0'));var Sequelize=require(_0x8c91('0x1'));module[_0x8c91('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8c91('0x3')]},'joinAt':{'type':Sequelize[_0x8c91('0x4')]},'leaveAt':{'type':Sequelize[_0x8c91('0x4')]},'acceptAt':{'type':Sequelize[_0x8c91('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8c91('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 997d75b..d125314 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 _0x50c1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','destroy','then','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','FaxQueueReport','findAll','rows','show','params','rawAttributes','includeAll','include','options','catch','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1b37c6,_0x409002){var _0x3c5ca8=function(_0x408f2b){while(--_0x408f2b){_0x1b37c6['push'](_0x1b37c6['shift']());}};_0x3c5ca8(++_0x409002);}(_0x50c1,0x1a5));var _0x150c=function(_0x22b8c3,_0x59faa0){_0x22b8c3=_0x22b8c3-0x0;var _0x19d03b=_0x50c1[_0x22b8c3];return _0x19d03b;};'use strict';var emlformat=require(_0x150c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x150c('0x1'));var rp=require(_0x150c('0x2'));var moment=require(_0x150c('0x3'));var BPromise=require(_0x150c('0x4'));var Mustache=require(_0x150c('0x5'));var util=require(_0x150c('0x6'));var path=require(_0x150c('0x7'));var sox=require(_0x150c('0x8'));var csv=require(_0x150c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x150c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x150c('0xb'));var deskjs=require(_0x150c('0xc'));var toCsv=require(_0x150c('0x9'));var querystring=require(_0x150c('0xd'));var Papa=require(_0x150c('0xe'));var Redis=require(_0x150c('0xf'));var authService=require(_0x150c('0x10'));var qs=require(_0x150c('0x11'));var as=require(_0x150c('0x12'));var hardwareService=require(_0x150c('0x13'));var logger=require('../../config/logger')(_0x150c('0x14'));var utils=require(_0x150c('0x15'));var config=require(_0x150c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x150c('0x17'))['db'];function respondWithStatusCode(_0x4e2f73,_0x4c513d){_0x4c513d=_0x4c513d||0xcc;return function(_0x2c9a8a){if(_0x2c9a8a){return _0x4e2f73[_0x150c('0x18')](_0x4c513d);}return _0x4e2f73[_0x150c('0x19')](_0x4c513d)[_0x150c('0x1a')]();};}function respondWithResult(_0x293b98,_0x17205c){_0x17205c=_0x17205c||0xc8;return function(_0x333600){if(_0x333600){return _0x293b98[_0x150c('0x19')](_0x17205c)[_0x150c('0x1b')](_0x333600);}};}function respondWithFilteredResult(_0x3c6772,_0x11bc9e){return function(_0x2c0626){if(_0x2c0626){var _0x5c657f=typeof _0x11bc9e[_0x150c('0x1c')]==='undefined'&&typeof _0x11bc9e[_0x150c('0x1d')]==='undefined';var _0x59ae9e=_0x2c0626[_0x150c('0x1e')];var _0x40c0d0=_0x5c657f?0x0:_0x11bc9e[_0x150c('0x1c')];var _0x3c5a84=_0x5c657f?_0x2c0626['count']:_0x11bc9e[_0x150c('0x1c')]+_0x11bc9e[_0x150c('0x1d')];var _0x9a9d64;if(_0x3c5a84>=_0x59ae9e){_0x3c5a84=_0x59ae9e;_0x9a9d64=0xc8;}else{_0x9a9d64=0xce;}_0x3c6772[_0x150c('0x19')](_0x9a9d64);return _0x3c6772[_0x150c('0x1f')](_0x150c('0x20'),_0x40c0d0+'-'+_0x3c5a84+'/'+_0x59ae9e)['json'](_0x2c0626);}return null;};}function patchUpdates(_0x220c15){return function(_0x365de8){try{jsonpatch['apply'](_0x365de8,_0x220c15,!![]);}catch(_0x12e158){return BPromise['reject'](_0x12e158);}return _0x365de8[_0x150c('0x21')]();};}function saveUpdates(_0x25503b,_0x29a2f){return function(_0x1c41f4){if(_0x1c41f4){return _0x1c41f4[_0x150c('0x22')](_0x25503b)['then'](function(_0x68b03b){return _0x68b03b;});}return null;};}function removeEntity(_0x3f9044,_0x332173){return function(_0x188536){if(_0x188536){return _0x188536[_0x150c('0x23')]()[_0x150c('0x24')](function(){_0x3f9044[_0x150c('0x19')](0xcc)[_0x150c('0x1a')]();});}};}function handleEntityNotFound(_0x3b1ce6,_0x54d11c){return function(_0x54b8dd){if(!_0x54b8dd){_0x3b1ce6[_0x150c('0x18')](0x194);}return _0x54b8dd;};}function handleError(_0x27aba8,_0x29a87c){_0x29a87c=_0x29a87c||0x1f4;return function(_0x5daf46){logger['error'](_0x5daf46[_0x150c('0x25')]);if(_0x5daf46[_0x150c('0x26')]){delete _0x5daf46[_0x150c('0x26')];}_0x27aba8[_0x150c('0x19')](_0x29a87c)[_0x150c('0x27')](_0x5daf46);};}exports[_0x150c('0x28')]=function(_0x420628,_0x522c2e){var _0x4b345f={},_0xbf4922={},_0x4021ea={'count':0x0,'rows':[]};var _0x3234ea=_[_0x150c('0x29')](db['FaxQueueReport']['rawAttributes'],function(_0x3acbc8){return{'name':_0x3acbc8[_0x150c('0x2a')],'type':_0x3acbc8[_0x150c('0x2b')]['key']};});_0xbf4922[_0x150c('0x2c')]=_['map'](_0x3234ea,_0x150c('0x26'));_0xbf4922[_0x150c('0x2d')]=_[_0x150c('0x2e')](_0x420628['query']);_0xbf4922['filters']=_[_0x150c('0x2f')](_0xbf4922['model'],_0xbf4922[_0x150c('0x2d')]);_0x4b345f[_0x150c('0x30')]=_[_0x150c('0x2f')](_0xbf4922[_0x150c('0x2c')],qs[_0x150c('0x31')](_0x420628[_0x150c('0x2d')][_0x150c('0x31')]));_0x4b345f['attributes']=_0x4b345f[_0x150c('0x30')][_0x150c('0x32')]?_0x4b345f['attributes']:_0xbf4922[_0x150c('0x2c')];if(!_0x420628[_0x150c('0x2d')][_0x150c('0x33')]('nolimit')){_0x4b345f[_0x150c('0x1d')]=qs[_0x150c('0x1d')](_0x420628[_0x150c('0x2d')]['limit']);_0x4b345f[_0x150c('0x1c')]=qs['offset'](_0x420628['query'][_0x150c('0x1c')]);}_0x4b345f['order']=qs['sort'](_0x420628[_0x150c('0x2d')][_0x150c('0x34')]);_0x4b345f[_0x150c('0x35')]=qs[_0x150c('0x36')](_[_0x150c('0x37')](_0x420628[_0x150c('0x2d')],_0xbf4922[_0x150c('0x36')]),_0x3234ea);if(_0x420628['query'][_0x150c('0x38')]){_0x4b345f[_0x150c('0x35')]=_[_0x150c('0x39')](_0x4b345f['where'],{'$or':_[_0x150c('0x29')](_0x3234ea,function(_0x401f9c){if(_0x401f9c[_0x150c('0x2b')]!==_0x150c('0x3a')){var _0x36afad={};_0x36afad[_0x401f9c['name']]={'$like':'%'+_0x420628[_0x150c('0x2d')][_0x150c('0x38')]+'%'};return _0x36afad;}})});}_0x4b345f=_[_0x150c('0x39')]({},_0x4b345f,_0x420628['options']);var _0x172787={'where':_0x4b345f[_0x150c('0x35')]};return db[_0x150c('0x3b')][_0x150c('0x1e')](_0x172787)[_0x150c('0x24')](function(_0x534d75){_0x4021ea[_0x150c('0x1e')]=_0x534d75;if(_0x420628['query']['includeAll']){_0x4b345f['include']=[{'all':!![]}];}return db[_0x150c('0x3b')][_0x150c('0x3c')](_0x4b345f);})[_0x150c('0x24')](function(_0x4503d8){_0x4021ea[_0x150c('0x3d')]=_0x4503d8;return _0x4021ea;})[_0x150c('0x24')](respondWithFilteredResult(_0x522c2e,_0x4b345f))['catch'](handleError(_0x522c2e,null));};exports[_0x150c('0x3e')]=function(_0x5c897a,_0x36f85c){var _0x16bc55={'raw':!![],'where':{'id':_0x5c897a[_0x150c('0x3f')]['id']}},_0x2a9ce4={};_0x2a9ce4[_0x150c('0x2c')]=_[_0x150c('0x2e')](db[_0x150c('0x3b')][_0x150c('0x40')]);_0x2a9ce4[_0x150c('0x2d')]=_[_0x150c('0x2e')](_0x5c897a['query']);_0x2a9ce4['filters']=_['intersection'](_0x2a9ce4['model'],_0x2a9ce4['query']);_0x16bc55[_0x150c('0x30')]=_[_0x150c('0x2f')](_0x2a9ce4[_0x150c('0x2c')],qs['fields'](_0x5c897a[_0x150c('0x2d')]['fields']));_0x16bc55[_0x150c('0x30')]=_0x16bc55[_0x150c('0x30')][_0x150c('0x32')]?_0x16bc55[_0x150c('0x30')]:_0x2a9ce4[_0x150c('0x2c')];if(_0x5c897a[_0x150c('0x2d')][_0x150c('0x41')]){_0x16bc55[_0x150c('0x42')]=[{'all':!![]}];}_0x16bc55=_[_0x150c('0x39')]({},_0x16bc55,_0x5c897a[_0x150c('0x43')]);return db[_0x150c('0x3b')]['find'](_0x16bc55)['then'](handleEntityNotFound(_0x36f85c,null))['then'](respondWithResult(_0x36f85c,null))[_0x150c('0x44')](handleError(_0x36f85c,null));};exports[_0x150c('0x45')]=function(_0xdd0bb,_0x68a748){return db[_0x150c('0x3b')][_0x150c('0x45')](_0xdd0bb[_0x150c('0x46')],{})[_0x150c('0x24')](respondWithResult(_0x68a748,0xc9))[_0x150c('0x44')](handleError(_0x68a748,null));};exports['update']=function(_0x61eaaf,_0x5e5c5d){if(_0x61eaaf[_0x150c('0x46')]['id']){delete _0x61eaaf['body']['id'];}return db[_0x150c('0x3b')][_0x150c('0x47')]({'where':{'id':_0x61eaaf[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x5e5c5d,null))['then'](saveUpdates(_0x61eaaf[_0x150c('0x46')],null))[_0x150c('0x24')](respondWithResult(_0x5e5c5d,null))[_0x150c('0x44')](handleError(_0x5e5c5d,null));};exports[_0x150c('0x23')]=function(_0x22f54d,_0x610f61){return db[_0x150c('0x3b')][_0x150c('0x47')]({'where':{'id':_0x22f54d[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x610f61,null))[_0x150c('0x24')](removeEntity(_0x610f61,null))[_0x150c('0x44')](handleError(_0x610f61,null));};exports[_0x150c('0x48')]=function(_0x5c9062,_0x5961a5){return db['FaxQueueReport'][_0x150c('0x48')]()[_0x150c('0x24')](respondWithResult(_0x5961a5,null))['catch'](handleError(_0x5961a5,null));}; \ No newline at end of file +var _0x2333=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','index','map','FaxQueueReport','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','then','rows','catch','params','keys','intersection','find','create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xb54e72,_0x50f6de){var _0x1e21a8=function(_0x4fb115){while(--_0x4fb115){_0xb54e72['push'](_0xb54e72['shift']());}};_0x1e21a8(++_0x50f6de);}(_0x2333,0x11a));var _0x3233=function(_0x3ae5ff,_0x58cbe6){_0x3ae5ff=_0x3ae5ff-0x0;var _0x467582=_0x2333[_0x3ae5ff];return _0x467582;};'use strict';var emlformat=require(_0x3233('0x0'));var rimraf=require(_0x3233('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3233('0x2'));var moment=require(_0x3233('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3233('0x4'));var util=require(_0x3233('0x5'));var path=require(_0x3233('0x6'));var sox=require(_0x3233('0x7'));var csv=require(_0x3233('0x8'));var ejs=require(_0x3233('0x9'));var fs=require('fs');var fs_extra=require(_0x3233('0xa'));var _=require(_0x3233('0xb'));var squel=require(_0x3233('0xc'));var crypto=require(_0x3233('0xd'));var jsforce=require(_0x3233('0xe'));var deskjs=require(_0x3233('0xf'));var toCsv=require(_0x3233('0x8'));var querystring=require(_0x3233('0x10'));var Papa=require(_0x3233('0x11'));var Redis=require(_0x3233('0x12'));var authService=require(_0x3233('0x13'));var qs=require(_0x3233('0x14'));var as=require(_0x3233('0x15'));var hardwareService=require(_0x3233('0x16'));var logger=require(_0x3233('0x17'))('api');var utils=require(_0x3233('0x18'));var config=require(_0x3233('0x19'));var licenseUtil=require(_0x3233('0x1a'));var db=require(_0x3233('0x1b'))['db'];function respondWithStatusCode(_0xd59689,_0x18166d){_0x18166d=_0x18166d||0xcc;return function(_0x44ef5f){if(_0x44ef5f){return _0xd59689[_0x3233('0x1c')](_0x18166d);}return _0xd59689[_0x3233('0x1d')](_0x18166d)[_0x3233('0x1e')]();};}function respondWithResult(_0x428b44,_0x27e9fd){_0x27e9fd=_0x27e9fd||0xc8;return function(_0x7f5e07){if(_0x7f5e07){return _0x428b44['status'](_0x27e9fd)['json'](_0x7f5e07);}};}function respondWithFilteredResult(_0xc71f65,_0x26a41e){return function(_0x45fc24){if(_0x45fc24){var _0x5885a5=typeof _0x26a41e[_0x3233('0x1f')]===_0x3233('0x20')&&typeof _0x26a41e[_0x3233('0x21')]==='undefined';var _0x33f2e5=_0x45fc24[_0x3233('0x22')];var _0x55fa30=_0x5885a5?0x0:_0x26a41e[_0x3233('0x1f')];var _0x58420c=_0x5885a5?_0x45fc24[_0x3233('0x22')]:_0x26a41e['offset']+_0x26a41e['limit'];var _0x5a6f13;if(_0x58420c>=_0x33f2e5){_0x58420c=_0x33f2e5;_0x5a6f13=0xc8;}else{_0x5a6f13=0xce;}_0xc71f65[_0x3233('0x1d')](_0x5a6f13);return _0xc71f65['set'](_0x3233('0x23'),_0x55fa30+'-'+_0x58420c+'/'+_0x33f2e5)['json'](_0x45fc24);}return null;};}function patchUpdates(_0x305227){return function(_0x161855){try{jsonpatch[_0x3233('0x24')](_0x161855,_0x305227,!![]);}catch(_0x42d311){return BPromise['reject'](_0x42d311);}return _0x161855[_0x3233('0x25')]();};}function saveUpdates(_0x2a9dd9,_0x56fa5a){return function(_0x531cd8){if(_0x531cd8){return _0x531cd8[_0x3233('0x26')](_0x2a9dd9)['then'](function(_0x199c37){return _0x199c37;});}return null;};}function removeEntity(_0xa73f3e,_0x43227e){return function(_0x4c3875){if(_0x4c3875){return _0x4c3875[_0x3233('0x27')]()['then'](function(){_0xa73f3e[_0x3233('0x1d')](0xcc)[_0x3233('0x1e')]();});}};}function handleEntityNotFound(_0x56f216,_0x3351d3){return function(_0x49a421){if(!_0x49a421){_0x56f216['sendStatus'](0x194);}return _0x49a421;};}function handleError(_0x430e8e,_0x39a345){_0x39a345=_0x39a345||0x1f4;return function(_0x5d8e63){logger[_0x3233('0x28')](_0x5d8e63[_0x3233('0x29')]);if(_0x5d8e63[_0x3233('0x2a')]){delete _0x5d8e63[_0x3233('0x2a')];}_0x430e8e[_0x3233('0x1d')](_0x39a345)['send'](_0x5d8e63);};}exports[_0x3233('0x2b')]=function(_0xd4171b,_0xabcf54){var _0xc87d63={},_0x233f6b={},_0x211f9b={'count':0x0,'rows':[]};var _0x31f0d6=_[_0x3233('0x2c')](db[_0x3233('0x2d')]['rawAttributes'],function(_0x392e56){return{'name':_0x392e56[_0x3233('0x2e')],'type':_0x392e56['type'][_0x3233('0x2f')]};});_0x233f6b[_0x3233('0x30')]=_['map'](_0x31f0d6,_0x3233('0x2a'));_0x233f6b[_0x3233('0x31')]=_['keys'](_0xd4171b[_0x3233('0x31')]);_0x233f6b[_0x3233('0x32')]=_['intersection'](_0x233f6b[_0x3233('0x30')],_0x233f6b[_0x3233('0x31')]);_0xc87d63['attributes']=_['intersection'](_0x233f6b[_0x3233('0x30')],qs['fields'](_0xd4171b[_0x3233('0x31')][_0x3233('0x33')]));_0xc87d63['attributes']=_0xc87d63[_0x3233('0x34')][_0x3233('0x35')]?_0xc87d63[_0x3233('0x34')]:_0x233f6b[_0x3233('0x30')];if(!_0xd4171b[_0x3233('0x31')][_0x3233('0x36')]('nolimit')){_0xc87d63['limit']=qs[_0x3233('0x21')](_0xd4171b[_0x3233('0x31')]['limit']);_0xc87d63[_0x3233('0x1f')]=qs['offset'](_0xd4171b[_0x3233('0x31')][_0x3233('0x1f')]);}_0xc87d63[_0x3233('0x37')]=qs['sort'](_0xd4171b[_0x3233('0x31')][_0x3233('0x38')]);_0xc87d63[_0x3233('0x39')]=qs['filters'](_[_0x3233('0x3a')](_0xd4171b[_0x3233('0x31')],_0x233f6b[_0x3233('0x32')]),_0x31f0d6);if(_0xd4171b[_0x3233('0x31')][_0x3233('0x3b')]){_0xc87d63[_0x3233('0x39')]=_[_0x3233('0x3c')](_0xc87d63[_0x3233('0x39')],{'$or':_['map'](_0x31f0d6,function(_0xfcc3e4){if(_0xfcc3e4[_0x3233('0x3d')]!=='VIRTUAL'){var _0x199c32={};_0x199c32[_0xfcc3e4['name']]={'$like':'%'+_0xd4171b[_0x3233('0x31')]['filter']+'%'};return _0x199c32;}})});}_0xc87d63=_[_0x3233('0x3c')]({},_0xc87d63,_0xd4171b[_0x3233('0x3e')]);var _0x2c6a49={'where':_0xc87d63[_0x3233('0x39')]};return db[_0x3233('0x2d')]['count'](_0x2c6a49)['then'](function(_0xe7970){_0x211f9b['count']=_0xe7970;if(_0xd4171b[_0x3233('0x31')][_0x3233('0x3f')]){_0xc87d63[_0x3233('0x40')]=[{'all':!![]}];}return db[_0x3233('0x2d')][_0x3233('0x41')](_0xc87d63);})[_0x3233('0x42')](function(_0x49e8c8){_0x211f9b[_0x3233('0x43')]=_0x49e8c8;return _0x211f9b;})[_0x3233('0x42')](respondWithFilteredResult(_0xabcf54,_0xc87d63))[_0x3233('0x44')](handleError(_0xabcf54,null));};exports['show']=function(_0x537c6f,_0x5633e8){var _0x1bfb73={'raw':!![],'where':{'id':_0x537c6f[_0x3233('0x45')]['id']}},_0x7ed58b={};_0x7ed58b[_0x3233('0x30')]=_['keys'](db[_0x3233('0x2d')]['rawAttributes']);_0x7ed58b[_0x3233('0x31')]=_[_0x3233('0x46')](_0x537c6f['query']);_0x7ed58b[_0x3233('0x32')]=_[_0x3233('0x47')](_0x7ed58b[_0x3233('0x30')],_0x7ed58b[_0x3233('0x31')]);_0x1bfb73[_0x3233('0x34')]=_[_0x3233('0x47')](_0x7ed58b[_0x3233('0x30')],qs[_0x3233('0x33')](_0x537c6f[_0x3233('0x31')]['fields']));_0x1bfb73[_0x3233('0x34')]=_0x1bfb73[_0x3233('0x34')][_0x3233('0x35')]?_0x1bfb73[_0x3233('0x34')]:_0x7ed58b[_0x3233('0x30')];if(_0x537c6f[_0x3233('0x31')][_0x3233('0x3f')]){_0x1bfb73[_0x3233('0x40')]=[{'all':!![]}];}_0x1bfb73=_[_0x3233('0x3c')]({},_0x1bfb73,_0x537c6f['options']);return db[_0x3233('0x2d')][_0x3233('0x48')](_0x1bfb73)[_0x3233('0x42')](handleEntityNotFound(_0x5633e8,null))['then'](respondWithResult(_0x5633e8,null))['catch'](handleError(_0x5633e8,null));};exports[_0x3233('0x49')]=function(_0x1a16f7,_0x34f30d){return db[_0x3233('0x2d')][_0x3233('0x49')](_0x1a16f7[_0x3233('0x4a')],{})[_0x3233('0x42')](respondWithResult(_0x34f30d,0xc9))[_0x3233('0x44')](handleError(_0x34f30d,null));};exports[_0x3233('0x26')]=function(_0x59deb1,_0x4aa692){if(_0x59deb1[_0x3233('0x4a')]['id']){delete _0x59deb1['body']['id'];}return db[_0x3233('0x2d')][_0x3233('0x48')]({'where':{'id':_0x59deb1[_0x3233('0x45')]['id']}})['then'](handleEntityNotFound(_0x4aa692,null))[_0x3233('0x42')](saveUpdates(_0x59deb1[_0x3233('0x4a')],null))[_0x3233('0x42')](respondWithResult(_0x4aa692,null))[_0x3233('0x44')](handleError(_0x4aa692,null));};exports['destroy']=function(_0x42f333,_0x43bd6e){return db[_0x3233('0x2d')][_0x3233('0x48')]({'where':{'id':_0x42f333['params']['id']}})['then'](handleEntityNotFound(_0x43bd6e,null))[_0x3233('0x42')](removeEntity(_0x43bd6e,null))[_0x3233('0x44')](handleError(_0x43bd6e,null));};exports[_0x3233('0x4b')]=function(_0x1171b2,_0x5f5965){return db[_0x3233('0x2d')]['describe']()[_0x3233('0x42')](respondWithResult(_0x5f5965,null))[_0x3233('0x44')](handleError(_0x5f5965,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f147e49..1dccf9e 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5d2187,_0x3a0c1f){_0x5d2187=_0x5d2187-0x0;var _0x306c4c=_0x1cb9[_0x5d2187];return _0x306c4c;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x14180c,_0x174fb8){var _0x332420=function(_0x53d8c5){while(--_0x53d8c5){_0x14180c['push'](_0x14180c['shift']());}};_0x332420(++_0x174fb8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index a069acb..b9ae474 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 _0xbfe5=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','debug','update','body','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x253476,_0x16b31a){var _0x134271=function(_0x20623c){while(--_0x20623c){_0x253476['push'](_0x253476['shift']());}};_0x134271(++_0x16b31a);}(_0xbfe5,0x1d3));var _0x5bfe=function(_0x5db126,_0x488835){_0x5db126=_0x5db126-0x0;var _0x209760=_0xbfe5[_0x5db126];return _0x209760;};'use strict';var _=require(_0x5bfe('0x0'));var util=require(_0x5bfe('0x1'));var moment=require(_0x5bfe('0x2'));var BPromise=require(_0x5bfe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bfe('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5bfe('0x5'))(_0x5bfe('0x6'));var config=require(_0x5bfe('0x7'));var jayson=require(_0x5bfe('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e62e4,_0x3e1bb3,_0x254bf7){return new BPromise(function(_0xa38c8,_0x432e5e){return client['request'](_0x2e62e4,_0x254bf7)[_0x5bfe('0x9')](function(_0x535f95){logger[_0x5bfe('0xa')](_0x5bfe('0xb'),_0x3e1bb3,_0x5bfe('0xc'));logger['debug'](_0x5bfe('0xd'),_0x3e1bb3,'request\x20sent',JSON[_0x5bfe('0xe')](_0x535f95));if(_0x535f95[_0x5bfe('0xf')]){if(_0x535f95[_0x5bfe('0xf')][_0x5bfe('0x10')]===0x1f4){logger['error'](_0x5bfe('0xb'),_0x3e1bb3,_0x535f95[_0x5bfe('0xf')][_0x5bfe('0x11')]);return _0x432e5e(_0x535f95[_0x5bfe('0xf')][_0x5bfe('0x11')]);}logger[_0x5bfe('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x3e1bb3,_0x535f95[_0x5bfe('0xf')]['message']);return _0xa38c8(_0x535f95['error'][_0x5bfe('0x11')]);}else{logger[_0x5bfe('0xa')](_0x5bfe('0xb'),_0x3e1bb3,_0x5bfe('0xc'));_0xa38c8(_0x535f95[_0x5bfe('0x12')]['message']);}})[_0x5bfe('0x13')](function(_0x388e27){logger[_0x5bfe('0xf')](_0x5bfe('0xb'),_0x3e1bb3,_0x388e27);_0x432e5e(_0x388e27);});});}exports[_0x5bfe('0x14')]=function(_0x94947d){var _0x436680=this;return new Promise(function(_0x593beb,_0x4de669){return db[_0x5bfe('0x15')][_0x5bfe('0x16')](_0x94947d['body'],{'raw':_0x94947d[_0x5bfe('0x17')]?_0x94947d[_0x5bfe('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x5bfe('0x9')](function(_0x48bef3){logger['info'](_0x5bfe('0x14'),_0x94947d);logger[_0x5bfe('0x18')](_0x5bfe('0x14'),_0x94947d,JSON[_0x5bfe('0xe')](_0x48bef3));_0x593beb(_0x48bef3);})['catch'](function(_0x3638f1){logger[_0x5bfe('0xf')](_0x5bfe('0x14'),_0x3638f1['message'],_0x94947d);_0x4de669(_0x436680[_0x5bfe('0xf')](0x1f4,_0x3638f1[_0x5bfe('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x320521){var _0xb4c044=this;return new Promise(function(_0x4d4b24,_0x519884){return db[_0x5bfe('0x15')][_0x5bfe('0x19')](_0x320521[_0x5bfe('0x1a')],{'raw':_0x320521['options']?_0x320521['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x320521[_0x5bfe('0x17')]?_0x320521[_0x5bfe('0x17')][_0x5bfe('0x1b')]||null:null,'attributes':_0x320521[_0x5bfe('0x17')]?_0x320521[_0x5bfe('0x17')][_0x5bfe('0x1c')]||null:null,'limit':_0x320521[_0x5bfe('0x17')]?_0x320521[_0x5bfe('0x17')][_0x5bfe('0x1d')]||null:null})[_0x5bfe('0x9')](function(_0x424dec){logger[_0x5bfe('0xa')]('UpdateFaxQueueReport',_0x320521);logger[_0x5bfe('0x18')]('UpdateFaxQueueReport',_0x320521,JSON[_0x5bfe('0xe')](_0x424dec));_0x4d4b24(_0x424dec);})['catch'](function(_0x2a0bc5){logger['error']('UpdateFaxQueueReport',_0x2a0bc5[_0x5bfe('0x11')],_0x320521);_0x519884(_0xb4c044['error'](0x1f4,_0x2a0bc5[_0x5bfe('0x11')]));});});}; \ No newline at end of file +var _0x9ab7=['raw','then','UpdateFaxQueueReport','FaxQueueReport','where','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateFaxQueueReport','create','body','options'];(function(_0x4956f1,_0xdbc6d){var _0x57a6c8=function(_0x121052){while(--_0x121052){_0x4956f1['push'](_0x4956f1['shift']());}};_0x57a6c8(++_0xdbc6d);}(_0x9ab7,0x167));var _0x79ab=function(_0x4e876c,_0x566ce1){_0x4e876c=_0x4e876c-0x0;var _0x41b4a2=_0x9ab7[_0x4e876c];return _0x41b4a2;};'use strict';var _=require('lodash');var util=require(_0x79ab('0x0'));var moment=require(_0x79ab('0x1'));var BPromise=require('bluebird');var rs=require(_0x79ab('0x2'));var fs=require('fs');var Redis=require(_0x79ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x79ab('0x4'));var logger=require(_0x79ab('0x5'))(_0x79ab('0x6'));var config=require(_0x79ab('0x7'));var jayson=require(_0x79ab('0x8'));var client=jayson[_0x79ab('0x9')][_0x79ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39e2b9,_0x4c5e95,_0x184014){return new BPromise(function(_0x28e549,_0x2c0bf1){return client['request'](_0x39e2b9,_0x184014)['then'](function(_0x10524f){logger[_0x79ab('0xb')](_0x79ab('0xc'),_0x4c5e95,'request\x20sent');logger[_0x79ab('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4c5e95,'request\x20sent',JSON[_0x79ab('0xe')](_0x10524f));if(_0x10524f[_0x79ab('0xf')]){if(_0x10524f[_0x79ab('0xf')][_0x79ab('0x10')]===0x1f4){logger[_0x79ab('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x4c5e95,_0x10524f[_0x79ab('0xf')][_0x79ab('0x11')]);return _0x2c0bf1(_0x10524f[_0x79ab('0xf')]['message']);}logger[_0x79ab('0xf')](_0x79ab('0xc'),_0x4c5e95,_0x10524f[_0x79ab('0xf')][_0x79ab('0x11')]);return _0x28e549(_0x10524f[_0x79ab('0xf')][_0x79ab('0x11')]);}else{logger[_0x79ab('0xb')](_0x79ab('0xc'),_0x4c5e95,_0x79ab('0x12'));_0x28e549(_0x10524f[_0x79ab('0x13')]['message']);}})[_0x79ab('0x14')](function(_0x81be3c){logger['error'](_0x79ab('0xc'),_0x4c5e95,_0x81be3c);_0x2c0bf1(_0x81be3c);});});}exports[_0x79ab('0x15')]=function(_0x5ebadc){var _0x2746c1=this;return new Promise(function(_0x3e1bf0,_0x5b346d){return db['FaxQueueReport'][_0x79ab('0x16')](_0x5ebadc[_0x79ab('0x17')],{'raw':_0x5ebadc[_0x79ab('0x18')]?_0x5ebadc[_0x79ab('0x18')][_0x79ab('0x19')]===undefined?!![]:![]:!![]})[_0x79ab('0x1a')](function(_0x553c95){logger['info']('CreateFaxQueueReport',_0x5ebadc);logger[_0x79ab('0xd')](_0x79ab('0x15'),_0x5ebadc,JSON[_0x79ab('0xe')](_0x553c95));_0x3e1bf0(_0x553c95);})['catch'](function(_0x32bffb){logger['error'](_0x79ab('0x15'),_0x32bffb[_0x79ab('0x11')],_0x5ebadc);_0x5b346d(_0x2746c1['error'](0x1f4,_0x32bffb[_0x79ab('0x11')]));});});};exports[_0x79ab('0x1b')]=function(_0x4486ea){var _0x5bc054=this;return new Promise(function(_0xf9ab6a,_0x470c00){return db[_0x79ab('0x1c')]['update'](_0x4486ea[_0x79ab('0x17')],{'raw':_0x4486ea[_0x79ab('0x18')]?_0x4486ea['options'][_0x79ab('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4486ea[_0x79ab('0x18')]?_0x4486ea[_0x79ab('0x18')][_0x79ab('0x1d')]||null:null,'attributes':_0x4486ea[_0x79ab('0x18')]?_0x4486ea[_0x79ab('0x18')][_0x79ab('0x1e')]||null:null,'limit':_0x4486ea[_0x79ab('0x18')]?_0x4486ea[_0x79ab('0x18')][_0x79ab('0x1f')]||null:null})[_0x79ab('0x1a')](function(_0x16823b){logger['info']('UpdateFaxQueueReport',_0x4486ea);logger[_0x79ab('0xd')](_0x79ab('0x1b'),_0x4486ea,JSON['stringify'](_0x16823b));_0xf9ab6a(_0x16823b);})[_0x79ab('0x14')](function(_0x35dbf0){logger[_0x79ab('0xf')](_0x79ab('0x1b'),_0x35dbf0[_0x79ab('0x11')],_0x4486ea);_0x470c00(_0x5bc054['error'](0x1f4,_0x35dbf0['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 561ef1a..9d798fb 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 _0x4249=['update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','show','post','put'];(function(_0x38877f,_0x1b937d){var _0xce786e=function(_0x3caf5f){while(--_0x3caf5f){_0x38877f['push'](_0x38877f['shift']());}};_0xce786e(++_0x1b937d);}(_0x4249,0xae));var _0x9424=function(_0x55977d,_0x5eea5f){_0x55977d=_0x55977d-0x0;var _0x5847ce=_0x4249[_0x55977d];return _0x5847ce;};'use strict';var multer=require(_0x9424('0x0'));var util=require(_0x9424('0x1'));var path=require(_0x9424('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9424('0x3')]();var fs_extra=require(_0x9424('0x4'));var auth=require(_0x9424('0x5'));var interaction=require(_0x9424('0x6'));var config=require(_0x9424('0x7'));var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9424('0x8')]);router[_0x9424('0x9')](_0x9424('0xa'),auth[_0x9424('0xb')](),controller[_0x9424('0xc')]);router[_0x9424('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9424('0xd')]);router[_0x9424('0xe')]('/',auth[_0x9424('0xb')](),controller['create']);router[_0x9424('0xf')]('/:id',auth[_0x9424('0xb')](),controller[_0x9424('0x10')]);router[_0x9424('0x11')]('/:id',auth[_0x9424('0xb')](),controller[_0x9424('0x12')]);module['exports']=router; \ No newline at end of file +var _0x37f3=['/describe','describe','/:id','show','post','create','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get'];(function(_0x3d9390,_0x4e6d7b){var _0x4e4cb4=function(_0x2cc215){while(--_0x2cc215){_0x3d9390['push'](_0x3d9390['shift']());}};_0x4e4cb4(++_0x4e6d7b);}(_0x37f3,0xd3));var _0x337f=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x37f3[_0x1ed116];return _0x574066;};'use strict';var multer=require(_0x337f('0x0'));var util=require('util');var path=require(_0x337f('0x1'));var timeout=require(_0x337f('0x2'));var express=require('express');var router=express[_0x337f('0x3')]();var fs_extra=require(_0x337f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x337f('0x5'));var config=require(_0x337f('0x6'));var controller=require(_0x337f('0x7'));router['get']('/',auth[_0x337f('0x8')](),controller['index']);router[_0x337f('0x9')](_0x337f('0xa'),auth[_0x337f('0x8')](),controller[_0x337f('0xb')]);router[_0x337f('0x9')](_0x337f('0xc'),auth[_0x337f('0x8')](),controller[_0x337f('0xd')]);router[_0x337f('0xe')]('/',auth[_0x337f('0x8')](),controller[_0x337f('0xf')]);router['put']('/:id',auth[_0x337f('0x8')](),controller['update']);router['delete'](_0x337f('0xc'),auth['isAuthenticated'](),controller[_0x337f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e601a46..8c7cbcc 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x9844c2,_0x4a6e0a){var _0x425407=function(_0x36141d){while(--_0x36141d){_0x9844c2['push'](_0x9844c2['shift']());}};_0x425407(++_0x4a6e0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x118d39,_0x43be87){var _0x47958b=function(_0x5aaceb){while(--_0x5aaceb){_0x118d39['push'](_0x118d39['shift']());}};_0x47958b(++_0x43be87);}(_0x54ef,0x112));var _0xf54e=function(_0x29ba5b,_0x578573){_0x29ba5b=_0x29ba5b-0x0;var _0x1c07ce=_0x54ef[_0x29ba5b];return _0x1c07ce;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 3e25ded..8f06897 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 _0x6963=['order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','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','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','sendStatus','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x30558d,_0x53dfdb){var _0x3ab37d=function(_0x3ed430){while(--_0x3ed430){_0x30558d['push'](_0x30558d['shift']());}};_0x3ab37d(++_0x53dfdb);}(_0x6963,0x137));var _0x3696=function(_0x2359e6,_0x3fc714){_0x2359e6=_0x2359e6-0x0;var _0x5a2823=_0x6963[_0x2359e6];return _0x5a2823;};'use strict';var emlformat=require(_0x3696('0x0'));var rimraf=require(_0x3696('0x1'));var zipdir=require(_0x3696('0x2'));var jsonpatch=require(_0x3696('0x3'));var rp=require(_0x3696('0x4'));var moment=require(_0x3696('0x5'));var BPromise=require(_0x3696('0x6'));var Mustache=require(_0x3696('0x7'));var util=require(_0x3696('0x8'));var path=require(_0x3696('0x9'));var sox=require(_0x3696('0xa'));var csv=require(_0x3696('0xb'));var ejs=require(_0x3696('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3696('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3696('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3696('0xf'));var Papa=require(_0x3696('0x10'));var Redis=require(_0x3696('0x11'));var authService=require(_0x3696('0x12'));var qs=require(_0x3696('0x13'));var as=require(_0x3696('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3696('0x15'));var utils=require('../../config/utils');var config=require(_0x3696('0x16'));var licenseUtil=require(_0x3696('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27d395,_0x54b12a){_0x54b12a=_0x54b12a||0xcc;return function(_0x2b011e){if(_0x2b011e){return _0x27d395['sendStatus'](_0x54b12a);}return _0x27d395[_0x3696('0x18')](_0x54b12a)[_0x3696('0x19')]();};}function respondWithResult(_0x19b881,_0x562be4){_0x562be4=_0x562be4||0xc8;return function(_0x1911bc){if(_0x1911bc){return _0x19b881[_0x3696('0x18')](_0x562be4)[_0x3696('0x1a')](_0x1911bc);}};}function respondWithFilteredResult(_0x43b112,_0x5195ba){return function(_0x4ae772){if(_0x4ae772){var _0x239fb5=typeof _0x5195ba[_0x3696('0x1b')]===_0x3696('0x1c')&&typeof _0x5195ba[_0x3696('0x1d')]==='undefined';var _0x905c75=_0x4ae772[_0x3696('0x1e')];var _0xa65ecb=_0x239fb5?0x0:_0x5195ba[_0x3696('0x1b')];var _0x1f12da=_0x239fb5?_0x4ae772[_0x3696('0x1e')]:_0x5195ba[_0x3696('0x1b')]+_0x5195ba[_0x3696('0x1d')];var _0x1e91d0;if(_0x1f12da>=_0x905c75){_0x1f12da=_0x905c75;_0x1e91d0=0xc8;}else{_0x1e91d0=0xce;}_0x43b112[_0x3696('0x18')](_0x1e91d0);return _0x43b112['set'](_0x3696('0x1f'),_0xa65ecb+'-'+_0x1f12da+'/'+_0x905c75)['json'](_0x4ae772);}return null;};}function patchUpdates(_0x5c0004){return function(_0x5b112e){try{jsonpatch[_0x3696('0x20')](_0x5b112e,_0x5c0004,!![]);}catch(_0x4dec1c){return BPromise['reject'](_0x4dec1c);}return _0x5b112e[_0x3696('0x21')]();};}function saveUpdates(_0x385a15,_0x40a399){return function(_0x1da979){if(_0x1da979){return _0x1da979['update'](_0x385a15)[_0x3696('0x22')](function(_0xb564c3){return _0xb564c3;});}return null;};}function removeEntity(_0x11fefd,_0x2c7104){return function(_0x4edf15){if(_0x4edf15){return _0x4edf15[_0x3696('0x23')]()[_0x3696('0x22')](function(){_0x11fefd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb64e,_0x55c4c0){return function(_0x4ef0f6){if(!_0x4ef0f6){_0x4bb64e[_0x3696('0x24')](0x194);}return _0x4ef0f6;};}function handleError(_0x2ccc6e,_0x54e0ba){_0x54e0ba=_0x54e0ba||0x1f4;return function(_0x5b0339){logger['error'](_0x5b0339[_0x3696('0x25')]);if(_0x5b0339['name']){delete _0x5b0339[_0x3696('0x26')];}_0x2ccc6e[_0x3696('0x18')](_0x54e0ba)[_0x3696('0x27')](_0x5b0339);};}exports[_0x3696('0x28')]=function(_0x3b5bc5,_0x37ddce){var _0x549670={},_0x48d614={},_0x2da031={'count':0x0,'rows':[]};var _0x330225=_['map'](db[_0x3696('0x29')][_0x3696('0x2a')],function(_0x20ff4c){return{'name':_0x20ff4c[_0x3696('0x2b')],'type':_0x20ff4c[_0x3696('0x2c')]['key']};});_0x48d614[_0x3696('0x2d')]=_['map'](_0x330225,_0x3696('0x26'));_0x48d614['query']=_[_0x3696('0x2e')](_0x3b5bc5[_0x3696('0x2f')]);_0x48d614[_0x3696('0x30')]=_[_0x3696('0x31')](_0x48d614[_0x3696('0x2d')],_0x48d614[_0x3696('0x2f')]);_0x549670['attributes']=_[_0x3696('0x31')](_0x48d614[_0x3696('0x2d')],qs[_0x3696('0x32')](_0x3b5bc5[_0x3696('0x2f')][_0x3696('0x32')]));_0x549670[_0x3696('0x33')]=_0x549670['attributes']['length']?_0x549670['attributes']:_0x48d614['model'];if(!_0x3b5bc5[_0x3696('0x2f')][_0x3696('0x34')](_0x3696('0x35'))){_0x549670[_0x3696('0x1d')]=qs['limit'](_0x3b5bc5[_0x3696('0x2f')][_0x3696('0x1d')]);_0x549670[_0x3696('0x1b')]=qs[_0x3696('0x1b')](_0x3b5bc5['query'][_0x3696('0x1b')]);}_0x549670[_0x3696('0x36')]=qs[_0x3696('0x37')](_0x3b5bc5[_0x3696('0x2f')][_0x3696('0x37')]);_0x549670[_0x3696('0x38')]=qs[_0x3696('0x30')](_[_0x3696('0x39')](_0x3b5bc5[_0x3696('0x2f')],_0x48d614[_0x3696('0x30')]),_0x330225);if(_0x3b5bc5[_0x3696('0x2f')]['filter']){_0x549670[_0x3696('0x38')]=_[_0x3696('0x3a')](_0x549670['where'],{'$or':_['map'](_0x330225,function(_0xaacebd){if(_0xaacebd['type']!==_0x3696('0x3b')){var _0x25024d={};_0x25024d[_0xaacebd['name']]={'$like':'%'+_0x3b5bc5[_0x3696('0x2f')][_0x3696('0x3c')]+'%'};return _0x25024d;}})});}_0x549670=_[_0x3696('0x3a')]({},_0x549670,_0x3b5bc5[_0x3696('0x3d')]);var _0x339dca={'where':_0x549670[_0x3696('0x38')]};return db['FaxTransferReport'][_0x3696('0x1e')](_0x339dca)['then'](function(_0x2892a2){_0x2da031[_0x3696('0x1e')]=_0x2892a2;if(_0x3b5bc5['query'][_0x3696('0x3e')]){_0x549670[_0x3696('0x3f')]=[{'all':!![]}];}return db[_0x3696('0x29')]['findAll'](_0x549670);})['then'](function(_0x5c3157){_0x2da031[_0x3696('0x40')]=_0x5c3157;return _0x2da031;})[_0x3696('0x22')](respondWithFilteredResult(_0x37ddce,_0x549670))['catch'](handleError(_0x37ddce,null));};exports[_0x3696('0x41')]=function(_0xba39c,_0x129b61){var _0x3408e1={'raw':!![],'where':{'id':_0xba39c[_0x3696('0x42')]['id']}},_0xd0978a={};_0xd0978a['model']=_[_0x3696('0x2e')](db[_0x3696('0x29')][_0x3696('0x2a')]);_0xd0978a[_0x3696('0x2f')]=_[_0x3696('0x2e')](_0xba39c[_0x3696('0x2f')]);_0xd0978a[_0x3696('0x30')]=_[_0x3696('0x31')](_0xd0978a[_0x3696('0x2d')],_0xd0978a[_0x3696('0x2f')]);_0x3408e1[_0x3696('0x33')]=_[_0x3696('0x31')](_0xd0978a['model'],qs[_0x3696('0x32')](_0xba39c[_0x3696('0x2f')][_0x3696('0x32')]));_0x3408e1[_0x3696('0x33')]=_0x3408e1[_0x3696('0x33')][_0x3696('0x43')]?_0x3408e1['attributes']:_0xd0978a[_0x3696('0x2d')];if(_0xba39c[_0x3696('0x2f')]['includeAll']){_0x3408e1['include']=[{'all':!![]}];}_0x3408e1=_[_0x3696('0x3a')]({},_0x3408e1,_0xba39c[_0x3696('0x3d')]);return db[_0x3696('0x29')]['find'](_0x3408e1)[_0x3696('0x22')](handleEntityNotFound(_0x129b61,null))[_0x3696('0x22')](respondWithResult(_0x129b61,null))[_0x3696('0x44')](handleError(_0x129b61,null));};exports[_0x3696('0x45')]=function(_0x1d165c,_0x22715b){return db[_0x3696('0x29')][_0x3696('0x45')](_0x1d165c[_0x3696('0x46')],{})[_0x3696('0x22')](respondWithResult(_0x22715b,0xc9))['catch'](handleError(_0x22715b,null));};exports['update']=function(_0x194dd7,_0xd9c681){if(_0x194dd7[_0x3696('0x46')]['id']){delete _0x194dd7[_0x3696('0x46')]['id'];}return db[_0x3696('0x29')][_0x3696('0x47')]({'where':{'id':_0x194dd7[_0x3696('0x42')]['id']}})[_0x3696('0x22')](handleEntityNotFound(_0xd9c681,null))[_0x3696('0x22')](saveUpdates(_0x194dd7[_0x3696('0x46')],null))[_0x3696('0x22')](respondWithResult(_0xd9c681,null))[_0x3696('0x44')](handleError(_0xd9c681,null));};exports[_0x3696('0x23')]=function(_0x5582b2,_0x202f9e){return db['FaxTransferReport']['find']({'where':{'id':_0x5582b2[_0x3696('0x42')]['id']}})[_0x3696('0x22')](handleEntityNotFound(_0x202f9e,null))[_0x3696('0x22')](removeEntity(_0x202f9e,null))[_0x3696('0x44')](handleError(_0x202f9e,null));};exports[_0x3696('0x48')]=function(_0x3874d4,_0xb9fc3){return db[_0x3696('0x29')][_0x3696('0x48')]()[_0x3696('0x22')](respondWithResult(_0xb9fc3,null))[_0x3696('0x44')](handleError(_0xb9fc3,null));}; \ No newline at end of file +var _0x08a6=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','update','then','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FaxTransferReport','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3c1d21,_0xcd663c){var _0x45c168=function(_0x1bc010){while(--_0x1bc010){_0x3c1d21['push'](_0x3c1d21['shift']());}};_0x45c168(++_0xcd663c);}(_0x08a6,0x1c1));var _0x608a=function(_0x3c222b,_0x5d2eb7){_0x3c222b=_0x3c222b-0x0;var _0xd9fdbb=_0x08a6[_0x3c222b];return _0xd9fdbb;};'use strict';var emlformat=require(_0x608a('0x0'));var rimraf=require(_0x608a('0x1'));var zipdir=require(_0x608a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x608a('0x3'));var moment=require(_0x608a('0x4'));var BPromise=require(_0x608a('0x5'));var Mustache=require(_0x608a('0x6'));var util=require('util');var path=require(_0x608a('0x7'));var sox=require(_0x608a('0x8'));var csv=require('to-csv');var ejs=require(_0x608a('0x9'));var fs=require('fs');var fs_extra=require(_0x608a('0xa'));var _=require(_0x608a('0xb'));var squel=require(_0x608a('0xc'));var crypto=require(_0x608a('0xd'));var jsforce=require(_0x608a('0xe'));var deskjs=require(_0x608a('0xf'));var toCsv=require(_0x608a('0x10'));var querystring=require(_0x608a('0x11'));var Papa=require('papaparse');var Redis=require(_0x608a('0x12'));var authService=require(_0x608a('0x13'));var qs=require(_0x608a('0x14'));var as=require(_0x608a('0x15'));var hardwareService=require(_0x608a('0x16'));var logger=require(_0x608a('0x17'))(_0x608a('0x18'));var utils=require(_0x608a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x608a('0x1a'));var db=require(_0x608a('0x1b'))['db'];function respondWithStatusCode(_0x11e4e1,_0x121672){_0x121672=_0x121672||0xcc;return function(_0x50a8f5){if(_0x50a8f5){return _0x11e4e1[_0x608a('0x1c')](_0x121672);}return _0x11e4e1[_0x608a('0x1d')](_0x121672)[_0x608a('0x1e')]();};}function respondWithResult(_0x268228,_0x31be73){_0x31be73=_0x31be73||0xc8;return function(_0x4bab05){if(_0x4bab05){return _0x268228[_0x608a('0x1d')](_0x31be73)[_0x608a('0x1f')](_0x4bab05);}};}function respondWithFilteredResult(_0x1236c1,_0xe28169){return function(_0x534fb4){if(_0x534fb4){var _0x3b1098=typeof _0xe28169['offset']==='undefined'&&typeof _0xe28169[_0x608a('0x20')]===_0x608a('0x21');var _0x1722e9=_0x534fb4[_0x608a('0x22')];var _0x5cf84a=_0x3b1098?0x0:_0xe28169[_0x608a('0x23')];var _0x292a60=_0x3b1098?_0x534fb4['count']:_0xe28169[_0x608a('0x23')]+_0xe28169[_0x608a('0x20')];var _0x3fbb58;if(_0x292a60>=_0x1722e9){_0x292a60=_0x1722e9;_0x3fbb58=0xc8;}else{_0x3fbb58=0xce;}_0x1236c1[_0x608a('0x1d')](_0x3fbb58);return _0x1236c1[_0x608a('0x24')]('Content-Range',_0x5cf84a+'-'+_0x292a60+'/'+_0x1722e9)[_0x608a('0x1f')](_0x534fb4);}return null;};}function patchUpdates(_0x4d38bd){return function(_0x2558c5){try{jsonpatch[_0x608a('0x25')](_0x2558c5,_0x4d38bd,!![]);}catch(_0x48e4d6){return BPromise['reject'](_0x48e4d6);}return _0x2558c5['save']();};}function saveUpdates(_0x5e9901,_0x14911a){return function(_0x3b8075){if(_0x3b8075){return _0x3b8075[_0x608a('0x26')](_0x5e9901)[_0x608a('0x27')](function(_0x38c1bb){return _0x38c1bb;});}return null;};}function removeEntity(_0x11d5c4,_0x15fbcd){return function(_0xf9f3a0){if(_0xf9f3a0){return _0xf9f3a0['destroy']()[_0x608a('0x27')](function(){_0x11d5c4['status'](0xcc)[_0x608a('0x1e')]();});}};}function handleEntityNotFound(_0x34b6d4,_0x4eb3d9){return function(_0x42d403){if(!_0x42d403){_0x34b6d4[_0x608a('0x1c')](0x194);}return _0x42d403;};}function handleError(_0xeec8ce,_0x5ebc30){_0x5ebc30=_0x5ebc30||0x1f4;return function(_0x2a6f03){logger['error'](_0x2a6f03[_0x608a('0x28')]);if(_0x2a6f03[_0x608a('0x29')]){delete _0x2a6f03['name'];}_0xeec8ce['status'](_0x5ebc30)[_0x608a('0x2a')](_0x2a6f03);};}exports[_0x608a('0x2b')]=function(_0x4f2a5c,_0x193878){var _0x36ff22={},_0x3728fa={},_0x33aca6={'count':0x0,'rows':[]};var _0x2a07a7=_[_0x608a('0x2c')](db['FaxTransferReport']['rawAttributes'],function(_0x320ce4){return{'name':_0x320ce4[_0x608a('0x2d')],'type':_0x320ce4[_0x608a('0x2e')][_0x608a('0x2f')]};});_0x3728fa['model']=_[_0x608a('0x2c')](_0x2a07a7,_0x608a('0x29'));_0x3728fa[_0x608a('0x30')]=_[_0x608a('0x31')](_0x4f2a5c[_0x608a('0x30')]);_0x3728fa[_0x608a('0x32')]=_[_0x608a('0x33')](_0x3728fa[_0x608a('0x34')],_0x3728fa[_0x608a('0x30')]);_0x36ff22[_0x608a('0x35')]=_[_0x608a('0x33')](_0x3728fa[_0x608a('0x34')],qs[_0x608a('0x36')](_0x4f2a5c[_0x608a('0x30')][_0x608a('0x36')]));_0x36ff22[_0x608a('0x35')]=_0x36ff22[_0x608a('0x35')]['length']?_0x36ff22[_0x608a('0x35')]:_0x3728fa['model'];if(!_0x4f2a5c[_0x608a('0x30')][_0x608a('0x37')](_0x608a('0x38'))){_0x36ff22[_0x608a('0x20')]=qs[_0x608a('0x20')](_0x4f2a5c[_0x608a('0x30')][_0x608a('0x20')]);_0x36ff22['offset']=qs[_0x608a('0x23')](_0x4f2a5c[_0x608a('0x30')][_0x608a('0x23')]);}_0x36ff22[_0x608a('0x39')]=qs[_0x608a('0x3a')](_0x4f2a5c[_0x608a('0x30')][_0x608a('0x3a')]);_0x36ff22[_0x608a('0x3b')]=qs[_0x608a('0x32')](_[_0x608a('0x3c')](_0x4f2a5c[_0x608a('0x30')],_0x3728fa[_0x608a('0x32')]),_0x2a07a7);if(_0x4f2a5c[_0x608a('0x30')][_0x608a('0x3d')]){_0x36ff22['where']=_['merge'](_0x36ff22[_0x608a('0x3b')],{'$or':_[_0x608a('0x2c')](_0x2a07a7,function(_0x2fbdf8){if(_0x2fbdf8[_0x608a('0x2e')]!==_0x608a('0x3e')){var _0x1bac82={};_0x1bac82[_0x2fbdf8[_0x608a('0x29')]]={'$like':'%'+_0x4f2a5c[_0x608a('0x30')][_0x608a('0x3d')]+'%'};return _0x1bac82;}})});}_0x36ff22=_[_0x608a('0x3f')]({},_0x36ff22,_0x4f2a5c[_0x608a('0x40')]);var _0x522a14={'where':_0x36ff22[_0x608a('0x3b')]};return db[_0x608a('0x41')][_0x608a('0x22')](_0x522a14)[_0x608a('0x27')](function(_0x526745){_0x33aca6[_0x608a('0x22')]=_0x526745;if(_0x4f2a5c[_0x608a('0x30')][_0x608a('0x42')]){_0x36ff22[_0x608a('0x43')]=[{'all':!![]}];}return db[_0x608a('0x41')]['findAll'](_0x36ff22);})[_0x608a('0x27')](function(_0x3416f2){_0x33aca6[_0x608a('0x44')]=_0x3416f2;return _0x33aca6;})[_0x608a('0x27')](respondWithFilteredResult(_0x193878,_0x36ff22))['catch'](handleError(_0x193878,null));};exports[_0x608a('0x45')]=function(_0x50d941,_0x5bd235){var _0x18e8d4={'raw':!![],'where':{'id':_0x50d941[_0x608a('0x46')]['id']}},_0x2ed84={};_0x2ed84['model']=_[_0x608a('0x31')](db['FaxTransferReport'][_0x608a('0x47')]);_0x2ed84[_0x608a('0x30')]=_['keys'](_0x50d941[_0x608a('0x30')]);_0x2ed84[_0x608a('0x32')]=_[_0x608a('0x33')](_0x2ed84[_0x608a('0x34')],_0x2ed84[_0x608a('0x30')]);_0x18e8d4[_0x608a('0x35')]=_[_0x608a('0x33')](_0x2ed84[_0x608a('0x34')],qs[_0x608a('0x36')](_0x50d941[_0x608a('0x30')][_0x608a('0x36')]));_0x18e8d4[_0x608a('0x35')]=_0x18e8d4[_0x608a('0x35')][_0x608a('0x48')]?_0x18e8d4['attributes']:_0x2ed84[_0x608a('0x34')];if(_0x50d941[_0x608a('0x30')]['includeAll']){_0x18e8d4[_0x608a('0x43')]=[{'all':!![]}];}_0x18e8d4=_['merge']({},_0x18e8d4,_0x50d941[_0x608a('0x40')]);return db[_0x608a('0x41')][_0x608a('0x49')](_0x18e8d4)[_0x608a('0x27')](handleEntityNotFound(_0x5bd235,null))[_0x608a('0x27')](respondWithResult(_0x5bd235,null))[_0x608a('0x4a')](handleError(_0x5bd235,null));};exports['create']=function(_0x4d4cf7,_0x44fe03){return db[_0x608a('0x41')][_0x608a('0x4b')](_0x4d4cf7[_0x608a('0x4c')],{})[_0x608a('0x27')](respondWithResult(_0x44fe03,0xc9))[_0x608a('0x4a')](handleError(_0x44fe03,null));};exports[_0x608a('0x26')]=function(_0xca9f2d,_0x5be8bf){if(_0xca9f2d['body']['id']){delete _0xca9f2d['body']['id'];}return db[_0x608a('0x41')]['find']({'where':{'id':_0xca9f2d[_0x608a('0x46')]['id']}})[_0x608a('0x27')](handleEntityNotFound(_0x5be8bf,null))['then'](saveUpdates(_0xca9f2d[_0x608a('0x4c')],null))[_0x608a('0x27')](respondWithResult(_0x5be8bf,null))[_0x608a('0x4a')](handleError(_0x5be8bf,null));};exports[_0x608a('0x4d')]=function(_0x597a85,_0x1a9e4b){return db[_0x608a('0x41')][_0x608a('0x49')]({'where':{'id':_0x597a85['params']['id']}})[_0x608a('0x27')](handleEntityNotFound(_0x1a9e4b,null))[_0x608a('0x27')](removeEntity(_0x1a9e4b,null))['catch'](handleError(_0x1a9e4b,null));};exports[_0x608a('0x4e')]=function(_0x26f60d,_0x2d5620){return db[_0x608a('0x41')][_0x608a('0x4e')]()[_0x608a('0x27')](respondWithResult(_0x2d5620,null))['catch'](handleError(_0x2d5620,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index b086d9e..3764a17 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 _0x1d3a=['util','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','FaxTransferReport','uniqueid','lodash'];(function(_0x200183,_0x30f2c7){var _0x36c53c=function(_0x184156){while(--_0x184156){_0x200183['push'](_0x200183['shift']());}};_0x36c53c(++_0x30f2c7);}(_0x1d3a,0x18f));var _0xa1d3=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x1d3a[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xa1d3('0x0'));var util=require(_0xa1d3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa1d3('0x2'));var BPromise=require(_0xa1d3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1d3('0x4'));var rimraf=require(_0xa1d3('0x5'));var config=require(_0xa1d3('0x6'));var attributes=require(_0xa1d3('0x7'));module['exports']=function(_0x548a04,_0x223c8d){return _0x548a04['define'](_0xa1d3('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xa1d3('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ba3=['path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x5ba3,0x140));var _0x35ba=function(_0x3434b0,_0x3c45e0){_0x3434b0=_0x3434b0-0x0;var _0x3f3f9e=_0x5ba3[_0x3434b0];return _0x3f3f9e;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var logger=require(_0x35ba('0x1'))(_0x35ba('0x2'));var moment=require('moment');var BPromise=require(_0x35ba('0x3'));var rp=require(_0x35ba('0x4'));var fs=require('fs');var path=require(_0x35ba('0x5'));var rimraf=require('rimraf');var config=require(_0x35ba('0x6'));var attributes=require(_0x35ba('0x7'));module[_0x35ba('0x8')]=function(_0x596785,_0x54c722){return _0x596785[_0x35ba('0x9')](_0x35ba('0xa'),attributes,{'tableName':_0x35ba('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x35ba('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 142787d..2b2ead6 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 _0x1ea0=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xcde425,_0x179c47){var _0x588ff5=function(_0x1f8ed2){while(--_0x1f8ed2){_0xcde425['push'](_0xcde425['shift']());}};_0x588ff5(++_0x179c47);}(_0x1ea0,0x142));var _0x01ea=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1ea0[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x01ea('0x0'));var moment=require(_0x01ea('0x1'));var BPromise=require(_0x01ea('0x2'));var rs=require(_0x01ea('0x3'));var fs=require('fs');var Redis=require(_0x01ea('0x4'));var db=require(_0x01ea('0x5'))['db'];var utils=require(_0x01ea('0x6'));var logger=require(_0x01ea('0x7'))(_0x01ea('0x8'));var config=require('../../config/environment');var jayson=require(_0x01ea('0x9'));var client=jayson[_0x01ea('0xa')][_0x01ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ef82c,_0x575810,_0x4d93df){return new BPromise(function(_0x2ca65,_0x1285b3){return client['request'](_0x1ef82c,_0x4d93df)[_0x01ea('0xc')](function(_0x2c7a78){logger[_0x01ea('0xd')](_0x01ea('0xe'),_0x575810,_0x01ea('0xf'));logger[_0x01ea('0x10')](_0x01ea('0x11'),_0x575810,'request\x20sent',JSON[_0x01ea('0x12')](_0x2c7a78));if(_0x2c7a78[_0x01ea('0x13')]){if(_0x2c7a78[_0x01ea('0x13')][_0x01ea('0x14')]===0x1f4){logger[_0x01ea('0x13')](_0x01ea('0xe'),_0x575810,_0x2c7a78[_0x01ea('0x13')][_0x01ea('0x15')]);return _0x1285b3(_0x2c7a78[_0x01ea('0x13')][_0x01ea('0x15')]);}logger[_0x01ea('0x13')](_0x01ea('0xe'),_0x575810,_0x2c7a78[_0x01ea('0x13')][_0x01ea('0x15')]);return _0x2ca65(_0x2c7a78[_0x01ea('0x13')][_0x01ea('0x15')]);}else{logger[_0x01ea('0xd')](_0x01ea('0xe'),_0x575810,_0x01ea('0xf'));_0x2ca65(_0x2c7a78[_0x01ea('0x16')][_0x01ea('0x15')]);}})['catch'](function(_0x19a3f1){logger[_0x01ea('0x13')](_0x01ea('0xe'),_0x575810,_0x19a3f1);_0x1285b3(_0x19a3f1);});});} \ No newline at end of file +var _0x4690=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x12bcd4,_0x383ccc){var _0x44d6df=function(_0x32046b){while(--_0x32046b){_0x12bcd4['push'](_0x12bcd4['shift']());}};_0x44d6df(++_0x383ccc);}(_0x4690,0x15b));var _0x0469=function(_0x510499,_0x3d5ca7){_0x510499=_0x510499-0x0;var _0x2323e6=_0x4690[_0x510499];return _0x2323e6;};'use strict';var _=require(_0x0469('0x0'));var util=require(_0x0469('0x1'));var moment=require('moment');var BPromise=require(_0x0469('0x2'));var rs=require(_0x0469('0x3'));var fs=require('fs');var Redis=require(_0x0469('0x4'));var db=require(_0x0469('0x5'))['db'];var utils=require(_0x0469('0x6'));var logger=require(_0x0469('0x7'))(_0x0469('0x8'));var config=require(_0x0469('0x9'));var jayson=require(_0x0469('0xa'));var client=jayson[_0x0469('0xb')][_0x0469('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34404f,_0x59aea2,_0x232631){return new BPromise(function(_0x5b91a9,_0x40bfdb){return client[_0x0469('0xd')](_0x34404f,_0x232631)[_0x0469('0xe')](function(_0xdcc464){logger[_0x0469('0xf')](_0x0469('0x10'),_0x59aea2,_0x0469('0x11'));logger[_0x0469('0x12')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x59aea2,_0x0469('0x11'),JSON[_0x0469('0x13')](_0xdcc464));if(_0xdcc464[_0x0469('0x14')]){if(_0xdcc464['error'][_0x0469('0x15')]===0x1f4){logger[_0x0469('0x14')](_0x0469('0x10'),_0x59aea2,_0xdcc464[_0x0469('0x14')]['message']);return _0x40bfdb(_0xdcc464[_0x0469('0x14')][_0x0469('0x16')]);}logger[_0x0469('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x59aea2,_0xdcc464[_0x0469('0x14')][_0x0469('0x16')]);return _0x5b91a9(_0xdcc464[_0x0469('0x14')][_0x0469('0x16')]);}else{logger[_0x0469('0xf')](_0x0469('0x10'),_0x59aea2,'request\x20sent');_0x5b91a9(_0xdcc464[_0x0469('0x17')][_0x0469('0x16')]);}})[_0x0469('0x18')](function(_0x473610){logger[_0x0469('0x14')](_0x0469('0x10'),_0x59aea2,_0x473610);_0x40bfdb(_0x473610);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 36aacf7..8ecdaa4 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 _0x1361=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x6d7eb5,_0x5f1287){var _0x42bae1=function(_0x58f161){while(--_0x58f161){_0x6d7eb5['push'](_0x6d7eb5['shift']());}};_0x42bae1(++_0x5f1287);}(_0x1361,0x163));var _0x1136=function(_0x542759,_0x1de942){_0x542759=_0x542759-0x0;var _0x59b562=_0x1361[_0x542759];return _0x59b562;};'use strict';var multer=require(_0x1136('0x0'));var util=require(_0x1136('0x1'));var path=require('path');var timeout=require(_0x1136('0x2'));var express=require(_0x1136('0x3'));var router=express[_0x1136('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1136('0x5'));var interaction=require(_0x1136('0x6'));var config=require(_0x1136('0x7'));var controller=require('./faxTransferReport.controller');router[_0x1136('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1136('0x8')](_0x1136('0x9'),auth[_0x1136('0xa')](),controller[_0x1136('0xb')]);router[_0x1136('0x8')](_0x1136('0xc'),auth['isAuthenticated'](),controller[_0x1136('0xd')]);router[_0x1136('0xe')]('/',auth[_0x1136('0xa')](),controller[_0x1136('0xf')]);router[_0x1136('0x10')](_0x1136('0xc'),auth[_0x1136('0xa')](),controller[_0x1136('0x11')]);router[_0x1136('0x12')](_0x1136('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1136('0x13')]=router; \ No newline at end of file +var _0x4522=['destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','get','/describe','show','post','create','put','/:id','delete'];(function(_0x174471,_0x123e1f){var _0xbfe530=function(_0x2fa7f6){while(--_0x2fa7f6){_0x174471['push'](_0x174471['shift']());}};_0xbfe530(++_0x123e1f);}(_0x4522,0x123));var _0x2452=function(_0x4a7864,_0x4ae8b6){_0x4a7864=_0x4a7864-0x0;var _0x5c3537=_0x4522[_0x4a7864];return _0x5c3537;};'use strict';var multer=require(_0x2452('0x0'));var util=require('util');var path=require(_0x2452('0x1'));var timeout=require('connect-timeout');var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2452('0x3'));var config=require(_0x2452('0x4'));var controller=require(_0x2452('0x5'));router['get']('/',auth[_0x2452('0x6')](),controller['index']);router[_0x2452('0x7')](_0x2452('0x8'),auth[_0x2452('0x6')](),controller['describe']);router[_0x2452('0x7')]('/:id',auth[_0x2452('0x6')](),controller[_0x2452('0x9')]);router[_0x2452('0xa')]('/',auth[_0x2452('0x6')](),controller[_0x2452('0xb')]);router[_0x2452('0xc')](_0x2452('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2452('0xe')](_0x2452('0xd'),auth[_0x2452('0x6')](),controller[_0x2452('0xf')]);module[_0x2452('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c6908b7..8fc45ea 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 _0xc8bc=['show','/:id/configurations','getConfigurations','getFields','post','put','update','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated'];(function(_0x54a09d,_0x5b14fb){var _0x1bd962=function(_0x48f426){while(--_0x48f426){_0x54a09d['push'](_0x54a09d['shift']());}};_0x1bd962(++_0x5b14fb);}(_0xc8bc,0x8d));var _0xcc8b=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xc8bc[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0xcc8b('0x0'));var util=require('util');var path=require(_0xcc8b('0x1'));var timeout=require(_0xcc8b('0x2'));var express=require(_0xcc8b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcc8b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcc8b('0x5'));var controller=require(_0xcc8b('0x6'));router[_0xcc8b('0x7')]('/',auth['isAuthenticated'](),controller[_0xcc8b('0x8')]);router['get'](_0xcc8b('0x9'),auth[_0xcc8b('0xa')](),controller[_0xcc8b('0xb')]);router[_0xcc8b('0x7')](_0xcc8b('0xc'),auth[_0xcc8b('0xa')](),controller[_0xcc8b('0xd')]);router[_0xcc8b('0x7')]('/:id/fields',auth[_0xcc8b('0xa')](),controller[_0xcc8b('0xe')]);router[_0xcc8b('0xf')]('/',auth[_0xcc8b('0xa')](),controller['create']);router['post'](_0xcc8b('0xc'),auth[_0xcc8b('0xa')](),controller['addConfiguration']);router[_0xcc8b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcc8b('0x11')]);router['delete'](_0xcc8b('0x9'),auth['isAuthenticated'](),controller[_0xcc8b('0x12')]);module['exports']=router; \ No newline at end of file +var _0x63cb=['addConfiguration','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x827d61,_0x127d23){var _0x3d2398=function(_0x57aaf6){while(--_0x57aaf6){_0x827d61['push'](_0x827d61['shift']());}};_0x3d2398(++_0x127d23);}(_0x63cb,0x147));var _0xb63c=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x63cb[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require(_0xb63c('0x0'));var util=require(_0xb63c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb63c('0x2'));var router=express[_0xb63c('0x3')]();var fs_extra=require(_0xb63c('0x4'));var auth=require(_0xb63c('0x5'));var interaction=require(_0xb63c('0x6'));var config=require(_0xb63c('0x7'));var controller=require(_0xb63c('0x8'));router['get']('/',auth[_0xb63c('0x9')](),controller[_0xb63c('0xa')]);router[_0xb63c('0xb')](_0xb63c('0xc'),auth[_0xb63c('0x9')](),controller[_0xb63c('0xd')]);router['get'](_0xb63c('0xe'),auth[_0xb63c('0x9')](),controller[_0xb63c('0xf')]);router[_0xb63c('0xb')](_0xb63c('0x10'),auth[_0xb63c('0x9')](),controller['getFields']);router['post']('/',auth[_0xb63c('0x9')](),controller['create']);router[_0xb63c('0x11')](_0xb63c('0xe'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x12')]);router[_0xb63c('0x13')](_0xb63c('0xc'),auth[_0xb63c('0x9')](),controller[_0xb63c('0x14')]);router[_0xb63c('0x15')](_0xb63c('0xc'),auth[_0xb63c('0x9')](),controller['destroy']);module[_0xb63c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index bb6d377..ecdc498 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 _0xe2c3=['integrationTab','newTab','exports','STRING','ENUM','basic'];(function(_0x2949a9,_0x26b51d){var _0x156baf=function(_0x265d90){while(--_0x265d90){_0x2949a9['push'](_0x2949a9['shift']());}};_0x156baf(++_0x26b51d);}(_0xe2c3,0xf2));var _0x3e2c=function(_0x248afa,_0xc057df){_0x248afa=_0x248afa-0x0;var _0x26d2d2=_0xe2c3[_0x248afa];return _0x26d2d2;};'use strict';var Sequelize=require('sequelize');module[_0x3e2c('0x0')]={'name':{'type':Sequelize[_0x3e2c('0x1')]},'description':{'type':Sequelize[_0x3e2c('0x1')]},'username':{'type':Sequelize[_0x3e2c('0x1')]},'remoteUri':{'type':Sequelize[_0x3e2c('0x1')]},'authType':{'type':Sequelize[_0x3e2c('0x2')](_0x3e2c('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x3e2c('0x1')]},'consumerKey':{'type':Sequelize[_0x3e2c('0x1')]},'consumerSecret':{'type':Sequelize[_0x3e2c('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3e2c('0x2')](_0x3e2c('0x4'),_0x3e2c('0x5')),'defaultValue':_0x3e2c('0x4')}}; \ No newline at end of file +var _0x0569=['basic','newTab','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x5e6d9a,_0x1bedf7){var _0x8ce839=function(_0x3cf79c){while(--_0x3cf79c){_0x5e6d9a['push'](_0x5e6d9a['shift']());}};_0x8ce839(++_0x1bedf7);}(_0x0569,0xf8));var _0x9056=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0569[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0x9056('0x0'));module[_0x9056('0x1')]={'name':{'type':Sequelize[_0x9056('0x2')]},'description':{'type':Sequelize[_0x9056('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9056('0x2')]},'authType':{'type':Sequelize[_0x9056('0x3')]('basic'),'defaultValue':_0x9056('0x4')},'password':{'type':Sequelize[_0x9056('0x2')]},'consumerKey':{'type':Sequelize[_0x9056('0x2')]},'consumerSecret':{'type':Sequelize[_0x9056('0x2')]},'token':{'type':Sequelize[_0x9056('0x2')]},'tokenSecret':{'type':Sequelize[_0x9056('0x2')]},'serverUrl':{'type':Sequelize[_0x9056('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9056('0x3')]('integrationTab',_0x9056('0x5')),'defaultValue':_0x9056('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6dcf7af..7d26dc1 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 _0x49e4=['sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','getConfigurations','findOne','DeskConfiguration','nolimit','AccountId','Subjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','password','consumerSecret','slice','substring','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','map','DeskAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order'];(function(_0x4c45b1,_0x1dd3cc){var _0x50f1ad=function(_0x115f84){while(--_0x115f84){_0x4c45b1['push'](_0x4c45b1['shift']());}};_0x50f1ad(++_0x1dd3cc);}(_0x49e4,0x113));var _0x449e=function(_0x2444d0,_0x5baeed){_0x2444d0=_0x2444d0-0x0;var _0x3a7a82=_0x49e4[_0x2444d0];return _0x3a7a82;};'use strict';var emlformat=require(_0x449e('0x0'));var rimraf=require(_0x449e('0x1'));var zipdir=require(_0x449e('0x2'));var jsonpatch=require(_0x449e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x449e('0x4'));var path=require(_0x449e('0x5'));var sox=require(_0x449e('0x6'));var csv=require(_0x449e('0x7'));var ejs=require(_0x449e('0x8'));var fs=require('fs');var fs_extra=require(_0x449e('0x9'));var _=require(_0x449e('0xa'));var squel=require(_0x449e('0xb'));var crypto=require(_0x449e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x449e('0x7'));var querystring=require(_0x449e('0xd'));var Papa=require(_0x449e('0xe'));var Redis=require(_0x449e('0xf'));var authService=require(_0x449e('0x10'));var qs=require(_0x449e('0x11'));var as=require(_0x449e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x449e('0x13'));var utils=require(_0x449e('0x14'));var config=require(_0x449e('0x15'));var licenseUtil=require(_0x449e('0x16'));var db=require(_0x449e('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x29a1cb,_0x4af7ac){_0x4af7ac=_0x4af7ac||0xcc;return function(_0x5199aa){if(_0x5199aa){return _0x29a1cb[_0x449e('0x18')](_0x4af7ac);}return _0x29a1cb[_0x449e('0x19')](_0x4af7ac)[_0x449e('0x1a')]();};}function respondWithResult(_0x1f1f1a,_0xbf03cf){_0xbf03cf=_0xbf03cf||0xc8;return function(_0x48ada0){if(_0x48ada0){return _0x1f1f1a[_0x449e('0x19')](_0xbf03cf)['json'](_0x48ada0);}};}function respondWithFilteredResult(_0x37c6c4,_0x516d44){return function(_0x1476d8){if(_0x1476d8){var _0x465abb=typeof _0x516d44[_0x449e('0x1b')]===_0x449e('0x1c')&&typeof _0x516d44[_0x449e('0x1d')]==='undefined';var _0x360f13=_0x1476d8[_0x449e('0x1e')];var _0x502100=_0x465abb?0x0:_0x516d44[_0x449e('0x1b')];var _0x564066=_0x465abb?_0x1476d8[_0x449e('0x1e')]:_0x516d44[_0x449e('0x1b')]+_0x516d44[_0x449e('0x1d')];var _0x1ff52d;if(_0x564066>=_0x360f13){_0x564066=_0x360f13;_0x1ff52d=0xc8;}else{_0x1ff52d=0xce;}_0x37c6c4[_0x449e('0x19')](_0x1ff52d);return _0x37c6c4[_0x449e('0x1f')](_0x449e('0x20'),_0x502100+'-'+_0x564066+'/'+_0x360f13)[_0x449e('0x21')](_0x1476d8);}return null;};}function patchUpdates(_0x58ee3f){return function(_0x595b82){try{jsonpatch['apply'](_0x595b82,_0x58ee3f,!![]);}catch(_0x164d4e){return BPromise[_0x449e('0x22')](_0x164d4e);}return _0x595b82[_0x449e('0x23')]();};}function saveUpdates(_0x6979ba,_0x1511a0){return function(_0x55f726){if(_0x55f726){return _0x55f726[_0x449e('0x24')](_0x6979ba)[_0x449e('0x25')](function(_0xfb5c69){return _0xfb5c69;});}return null;};}function removeEntity(_0x278426,_0x3d95f4){return function(_0x19b23e){if(_0x19b23e){return _0x19b23e[_0x449e('0x26')]()['then'](function(){_0x278426[_0x449e('0x19')](0xcc)[_0x449e('0x1a')]();});}};}function handleEntityNotFound(_0x13a7cb,_0x51ea2e){return function(_0x24c901){if(!_0x24c901){_0x13a7cb[_0x449e('0x18')](0x194);}return _0x24c901;};}function handleError(_0x41f898,_0x75fd14){_0x75fd14=_0x75fd14||0x1f4;return function(_0x1bc1e3){logger['error'](_0x1bc1e3[_0x449e('0x27')]);if(_0x1bc1e3[_0x449e('0x28')]){delete _0x1bc1e3[_0x449e('0x28')];}_0x41f898['status'](_0x75fd14)[_0x449e('0x29')](_0x1bc1e3);};}exports['index']=function(_0x883c44,_0x78e7b2){var _0x18ea85={},_0x414c2a={},_0x5158a7={'count':0x0,'rows':[]};var _0x11070=_[_0x449e('0x2a')](db[_0x449e('0x2b')][_0x449e('0x2c')],function(_0x25a45f){return{'name':_0x25a45f[_0x449e('0x2d')],'type':_0x25a45f['type']['key']};});_0x414c2a[_0x449e('0x2e')]=_[_0x449e('0x2a')](_0x11070,'name');_0x414c2a[_0x449e('0x2f')]=_[_0x449e('0x30')](_0x883c44[_0x449e('0x2f')]);_0x414c2a[_0x449e('0x31')]=_[_0x449e('0x32')](_0x414c2a[_0x449e('0x2e')],_0x414c2a[_0x449e('0x2f')]);_0x18ea85['attributes']=_[_0x449e('0x32')](_0x414c2a[_0x449e('0x2e')],qs[_0x449e('0x33')](_0x883c44[_0x449e('0x2f')][_0x449e('0x33')]));_0x18ea85[_0x449e('0x34')]=_0x18ea85[_0x449e('0x34')]['length']?_0x18ea85[_0x449e('0x34')]:_0x414c2a['model'];if(!_0x883c44[_0x449e('0x2f')][_0x449e('0x35')]('nolimit')){_0x18ea85[_0x449e('0x1d')]=qs['limit'](_0x883c44[_0x449e('0x2f')][_0x449e('0x1d')]);_0x18ea85[_0x449e('0x1b')]=qs[_0x449e('0x1b')](_0x883c44['query'][_0x449e('0x1b')]);}_0x18ea85[_0x449e('0x36')]=qs[_0x449e('0x37')](_0x883c44['query']['sort']);_0x18ea85[_0x449e('0x38')]=qs[_0x449e('0x31')](_[_0x449e('0x39')](_0x883c44[_0x449e('0x2f')],_0x414c2a[_0x449e('0x31')]),_0x11070);if(_0x883c44['query'][_0x449e('0x3a')]){_0x18ea85[_0x449e('0x38')]=_['merge'](_0x18ea85[_0x449e('0x38')],{'$or':_['map'](_0x11070,function(_0x5c166c){if(_0x5c166c[_0x449e('0x3b')]!==_0x449e('0x3c')){var _0x4bfab2={};_0x4bfab2[_0x5c166c[_0x449e('0x28')]]={'$like':'%'+_0x883c44['query']['filter']+'%'};return _0x4bfab2;}})});}_0x18ea85=_[_0x449e('0x3d')]({},_0x18ea85,_0x883c44[_0x449e('0x3e')]);var _0x31c07e={'where':_0x18ea85[_0x449e('0x38')]};return db[_0x449e('0x2b')][_0x449e('0x1e')](_0x31c07e)[_0x449e('0x25')](function(_0x1760df){_0x5158a7[_0x449e('0x1e')]=_0x1760df;if(_0x883c44[_0x449e('0x2f')][_0x449e('0x3f')]){_0x18ea85[_0x449e('0x40')]=[{'all':!![]}];}return db[_0x449e('0x2b')][_0x449e('0x41')](_0x18ea85);})[_0x449e('0x25')](function(_0x28e781){_0x5158a7['rows']=_0x28e781;return _0x5158a7;})[_0x449e('0x25')](respondWithFilteredResult(_0x78e7b2,_0x18ea85))[_0x449e('0x42')](handleError(_0x78e7b2,null));};exports[_0x449e('0x43')]=function(_0x7b9026,_0x3222fd){var _0x441588={'raw':![],'where':{'id':_0x7b9026[_0x449e('0x44')]['id']}},_0x5bb1f5={};_0x5bb1f5[_0x449e('0x2e')]=_[_0x449e('0x30')](db[_0x449e('0x2b')][_0x449e('0x2c')]);_0x5bb1f5[_0x449e('0x2f')]=_[_0x449e('0x30')](_0x7b9026['query']);_0x5bb1f5[_0x449e('0x31')]=_[_0x449e('0x32')](_0x5bb1f5[_0x449e('0x2e')],_0x5bb1f5[_0x449e('0x2f')]);_0x441588[_0x449e('0x34')]=_[_0x449e('0x32')](_0x5bb1f5[_0x449e('0x2e')],qs[_0x449e('0x33')](_0x7b9026[_0x449e('0x2f')][_0x449e('0x33')]));_0x441588[_0x449e('0x34')]=_0x441588['attributes'][_0x449e('0x45')]?_0x441588[_0x449e('0x34')]:_0x5bb1f5[_0x449e('0x2e')];if(_0x7b9026[_0x449e('0x2f')][_0x449e('0x3f')]){_0x441588[_0x449e('0x40')]=[{'all':!![]}];}_0x441588=_[_0x449e('0x3d')]({},_0x441588,_0x7b9026[_0x449e('0x3e')]);return db[_0x449e('0x2b')][_0x449e('0x46')](_0x441588)['then'](handleEntityNotFound(_0x3222fd,null))[_0x449e('0x25')](respondWithResult(_0x3222fd,null))[_0x449e('0x42')](handleError(_0x3222fd,null));};exports[_0x449e('0x47')]=function(_0x57958c,_0x572aa5){return db[_0x449e('0x2b')][_0x449e('0x47')](_0x57958c[_0x449e('0x48')],{})[_0x449e('0x25')](respondWithResult(_0x572aa5,0xc9))['catch'](handleError(_0x572aa5,null));};exports[_0x449e('0x24')]=function(_0x3b8bdc,_0x324adc){if(_0x3b8bdc[_0x449e('0x48')]['id']){delete _0x3b8bdc['body']['id'];}return db['DeskAccount'][_0x449e('0x46')]({'where':{'id':_0x3b8bdc[_0x449e('0x44')]['id']}})['then'](handleEntityNotFound(_0x324adc,null))[_0x449e('0x25')](saveUpdates(_0x3b8bdc[_0x449e('0x48')],null))[_0x449e('0x25')](respondWithResult(_0x324adc,null))[_0x449e('0x42')](handleError(_0x324adc,null));};exports[_0x449e('0x26')]=function(_0x5bf29b,_0x2ac000){return db[_0x449e('0x2b')][_0x449e('0x46')]({'where':{'id':_0x5bf29b[_0x449e('0x44')]['id']}})[_0x449e('0x25')](handleEntityNotFound(_0x2ac000,null))[_0x449e('0x25')](removeEntity(_0x2ac000,null))[_0x449e('0x42')](handleError(_0x2ac000,null));};exports[_0x449e('0x49')]=function(_0x3baf3f,_0x426d3f,_0x5320d7){var _0x557372={};var _0x19981a={};var _0x5f05e5;var _0x220c77;return db[_0x449e('0x2b')][_0x449e('0x4a')]({'where':{'id':_0x3baf3f[_0x449e('0x44')]['id']}})[_0x449e('0x25')](handleEntityNotFound(_0x426d3f,null))[_0x449e('0x25')](function(_0x145a0b){if(_0x145a0b){_0x5f05e5=_0x145a0b;_0x19981a[_0x449e('0x2e')]=_['keys'](db[_0x449e('0x4b')][_0x449e('0x2c')]);_0x19981a[_0x449e('0x2f')]=_[_0x449e('0x30')](_0x3baf3f[_0x449e('0x2f')]);_0x19981a[_0x449e('0x31')]=_[_0x449e('0x32')](_0x19981a['model'],_0x19981a[_0x449e('0x2f')]);_0x557372['attributes']=_['intersection'](_0x19981a['model'],qs[_0x449e('0x33')](_0x3baf3f[_0x449e('0x2f')][_0x449e('0x33')]));_0x557372[_0x449e('0x34')]=_0x557372[_0x449e('0x34')][_0x449e('0x45')]?_0x557372[_0x449e('0x34')]:_0x19981a['model'];_0x557372[_0x449e('0x36')]=qs[_0x449e('0x37')](_0x3baf3f[_0x449e('0x2f')][_0x449e('0x37')]);_0x557372[_0x449e('0x38')]=qs[_0x449e('0x31')](_['pick'](_0x3baf3f[_0x449e('0x2f')],_0x19981a[_0x449e('0x31')]));if(_0x3baf3f[_0x449e('0x2f')][_0x449e('0x3a')]){_0x557372['where']=_[_0x449e('0x3d')](_0x557372[_0x449e('0x38')],{'$or':_[_0x449e('0x2a')](_0x557372[_0x449e('0x34')],function(_0x3844ec){var _0x415d36={};_0x415d36[_0x3844ec]={'$like':'%'+_0x3baf3f['query'][_0x449e('0x3a')]+'%'};return _0x415d36;})});}_0x557372=_['merge']({},_0x557372,_0x3baf3f[_0x449e('0x3e')]);return _0x5f05e5['getConfigurations'](_0x557372);}})[_0x449e('0x25')](function(_0x5e707d){if(_0x5e707d){_0x220c77=_0x5e707d[_0x449e('0x45')];if(!_0x3baf3f[_0x449e('0x2f')][_0x449e('0x35')](_0x449e('0x4c'))){_0x557372['limit']=qs['limit'](_0x3baf3f[_0x449e('0x2f')]['limit']);_0x557372[_0x449e('0x1b')]=qs[_0x449e('0x1b')](_0x3baf3f[_0x449e('0x2f')][_0x449e('0x1b')]);}return _0x5f05e5[_0x449e('0x49')](_0x557372);}})[_0x449e('0x25')](function(_0x239e13){if(_0x239e13){return _0x239e13?{'count':_0x220c77,'rows':_0x239e13}:null;}})[_0x449e('0x25')](respondWithResult(_0x426d3f,null))[_0x449e('0x42')](handleError(_0x426d3f,null));};exports['addConfiguration']=function(_0x39e62e,_0x320dcc,_0x5b7d12){if(_0x39e62e['body']['id']){delete _0x39e62e[_0x449e('0x48')]['id'];}return db[_0x449e('0x2b')][_0x449e('0x4a')]({'where':{'id':_0x39e62e['params']['id']}})[_0x449e('0x25')](handleEntityNotFound(_0x320dcc,null))[_0x449e('0x25')](function(_0x582b3e){if(_0x582b3e){_0x39e62e[_0x449e('0x48')][_0x449e('0x4d')]=_0x582b3e['id'];_0x39e62e[_0x449e('0x48')][_0x449e('0x4e')]=integrations['getSubjects'](_0x39e62e[_0x449e('0x48')][_0x449e('0x4f')],_0x39e62e[_0x449e('0x48')]['type']);_0x39e62e['body'][_0x449e('0x50')]=integrations['getDescriptions'](_0x39e62e[_0x449e('0x48')]['channel'],_0x39e62e[_0x449e('0x48')]['type']);return db['DeskConfiguration'][_0x449e('0x47')](_0x39e62e[_0x449e('0x48')],{'include':[{'model':db[_0x449e('0x51')],'as':_0x449e('0x4e')},{'model':db[_0x449e('0x51')],'as':_0x449e('0x50')}]});}return null;})['then'](respondWithResult(_0x320dcc,null))[_0x449e('0x42')](handleError(_0x320dcc,null));};exports[_0x449e('0x52')]=function(_0x20c86b,_0x5ea651,_0x281b89){var _0x1cff52=[{'name':_0x449e('0x53'),'label':_0x449e('0x53'),'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 _0x48a8ff='';return db[_0x449e('0x2b')][_0x449e('0x4a')]({'where':{'id':_0x20c86b[_0x449e('0x44')]['id']},'attributes':['id',_0x449e('0x54'),'authType','username',_0x449e('0x55'),'consumerKey',_0x449e('0x56'),'token','tokenSecret']})['then'](handleEntityNotFound(_0x5ea651,null))[_0x449e('0x25')](function(_0x2beae9){if(_0x2beae9){_0x48a8ff=_0x2beae9[_0x449e('0x54')];var _0x318af0=_0x48a8ff[_0x449e('0x57')](-0x1);if(_0x318af0==='/'){_0x48a8ff=_0x48a8ff[_0x449e('0x58')](0x0,_0x48a8ff['lastIndexOf'](_0x318af0));}var _0x58c70a={'method':'GET','uri':util['format'](_0x449e('0x59'),_0x48a8ff),'headers':{'Content-Type':'application/json','Accept':_0x449e('0x5a')},'json':!![]};if(_0x2beae9['authType']===_0x449e('0x5b')){_0x58c70a[_0x449e('0x5c')]['Authorization']=util[_0x449e('0x5d')](_0x449e('0x5e'),new Buffer(util[_0x449e('0x5d')](_0x449e('0x5f'),_0x2beae9[_0x449e('0x60')],_0x2beae9[_0x449e('0x55')]))[_0x449e('0x61')](_0x449e('0x62')));}return rp(_0x58c70a)['then'](function(_0x1dd773){return _0x1cff52[_0x449e('0x63')](_['map'](_0x1dd773[_0x449e('0x64')][_0x449e('0x65')],function(_0x19055d){return{'id':_0x19055d[_0x449e('0x28')],'name':_0x19055d[_0x449e('0x28')],'type':_0x19055d[_0x449e('0x3b')],'active':_0x19055d[_0x449e('0x66')],'label':_0x19055d[_0x449e('0x67')],'custom':!![]};}));});}})[_0x449e('0x25')](function(_0x25b1a4){return{'count':_0x25b1a4[_0x449e('0x45')],'rows':_0x25b1a4};})[_0x449e('0x25')](respondWithResult(_0x5ea651,null))[_0x449e('0x42')](function(_0xe2fff){var _0x94d261=_0x20c86b[_0x449e('0x2f')]['test']?0x1f4:_0xe2fff[_0x449e('0x68')]||0x1f4;logger[_0x449e('0x69')](_0x449e('0x6a'),_0x449e('0x52'),_0x94d261,JSON[_0x449e('0x6b')](_0xe2fff));delete _0xe2fff['name'];if(_0x94d261===0x191){_0x94d261=0x190;}_0x5ea651[_0x449e('0x19')](_0x94d261)[_0x449e('0x29')](_0x20c86b['query'][_0x449e('0x6c')]?{'message':_0x449e('0x6d'),'statusCode':_0xe2fff[_0x449e('0x68')]}:_0xe2fff);});}; \ No newline at end of file +var _0x63db=['DeskField','getFields','priority','remoteUri','username','consumerKey','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','headers','Authorization','%s:%s','toString','base64','concat','entries','active','test','statusCode','error','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','DeskAccount','includeAll','include','rows','catch','params','intersection','find','create','body','getConfigurations','DeskConfiguration','order','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects'];(function(_0x311650,_0x43025d){var _0x16711a=function(_0x35ecfc){while(--_0x35ecfc){_0x311650['push'](_0x311650['shift']());}};_0x16711a(++_0x43025d);}(_0x63db,0xf4));var _0xb63d=function(_0x27567e,_0x2f60b0){_0x27567e=_0x27567e-0x0;var _0xb71bfe=_0x63db[_0x27567e];return _0xb71bfe;};'use strict';var emlformat=require(_0xb63d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb63d('0x1'));var jsonpatch=require(_0xb63d('0x2'));var rp=require(_0xb63d('0x3'));var moment=require(_0xb63d('0x4'));var BPromise=require(_0xb63d('0x5'));var Mustache=require(_0xb63d('0x6'));var util=require(_0xb63d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb63d('0x8'));var ejs=require(_0xb63d('0x9'));var fs=require('fs');var fs_extra=require(_0xb63d('0xa'));var _=require(_0xb63d('0xb'));var squel=require(_0xb63d('0xc'));var crypto=require(_0xb63d('0xd'));var jsforce=require(_0xb63d('0xe'));var deskjs=require(_0xb63d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb63d('0x10'));var Papa=require(_0xb63d('0x11'));var Redis=require(_0xb63d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb63d('0x13'));var as=require(_0xb63d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb63d('0x15'))(_0xb63d('0x16'));var utils=require(_0xb63d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb63d('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xf38d2a,_0x3e9a0b){_0x3e9a0b=_0x3e9a0b||0xcc;return function(_0x5601a4){if(_0x5601a4){return _0xf38d2a['sendStatus'](_0x3e9a0b);}return _0xf38d2a[_0xb63d('0x19')](_0x3e9a0b)[_0xb63d('0x1a')]();};}function respondWithResult(_0x48fcb2,_0x348810){_0x348810=_0x348810||0xc8;return function(_0x4730b9){if(_0x4730b9){return _0x48fcb2[_0xb63d('0x19')](_0x348810)[_0xb63d('0x1b')](_0x4730b9);}};}function respondWithFilteredResult(_0x4be452,_0x2ff15b){return function(_0x250215){if(_0x250215){var _0x160a84=typeof _0x2ff15b[_0xb63d('0x1c')]===_0xb63d('0x1d')&&typeof _0x2ff15b[_0xb63d('0x1e')]===_0xb63d('0x1d');var _0x93c7a9=_0x250215['count'];var _0x2f9de8=_0x160a84?0x0:_0x2ff15b[_0xb63d('0x1c')];var _0x4bb935=_0x160a84?_0x250215[_0xb63d('0x1f')]:_0x2ff15b[_0xb63d('0x1c')]+_0x2ff15b['limit'];var _0x75ba9b;if(_0x4bb935>=_0x93c7a9){_0x4bb935=_0x93c7a9;_0x75ba9b=0xc8;}else{_0x75ba9b=0xce;}_0x4be452[_0xb63d('0x19')](_0x75ba9b);return _0x4be452['set'](_0xb63d('0x20'),_0x2f9de8+'-'+_0x4bb935+'/'+_0x93c7a9)['json'](_0x250215);}return null;};}function patchUpdates(_0x2211ca){return function(_0x2509f){try{jsonpatch[_0xb63d('0x21')](_0x2509f,_0x2211ca,!![]);}catch(_0x5e10a9){return BPromise[_0xb63d('0x22')](_0x5e10a9);}return _0x2509f[_0xb63d('0x23')]();};}function saveUpdates(_0x13284b,_0x4f4378){return function(_0x563b3c){if(_0x563b3c){return _0x563b3c[_0xb63d('0x24')](_0x13284b)[_0xb63d('0x25')](function(_0x36206f){return _0x36206f;});}return null;};}function removeEntity(_0x3278e3,_0x1423b2){return function(_0x55f4c6){if(_0x55f4c6){return _0x55f4c6[_0xb63d('0x26')]()[_0xb63d('0x25')](function(){_0x3278e3[_0xb63d('0x19')](0xcc)[_0xb63d('0x1a')]();});}};}function handleEntityNotFound(_0x4ce1db,_0x140dcd){return function(_0x472ac6){if(!_0x472ac6){_0x4ce1db[_0xb63d('0x27')](0x194);}return _0x472ac6;};}function handleError(_0x4ec279,_0x284d5f){_0x284d5f=_0x284d5f||0x1f4;return function(_0x444ad1){logger['error'](_0x444ad1[_0xb63d('0x28')]);if(_0x444ad1[_0xb63d('0x29')]){delete _0x444ad1['name'];}_0x4ec279[_0xb63d('0x19')](_0x284d5f)['send'](_0x444ad1);};}exports['index']=function(_0x4bbeef,_0x39c1d2){var _0x532bc6={},_0x2a9996={},_0x4668e0={'count':0x0,'rows':[]};var _0x3c4f12=_[_0xb63d('0x2a')](db['DeskAccount'][_0xb63d('0x2b')],function(_0x3b2fec){return{'name':_0x3b2fec[_0xb63d('0x2c')],'type':_0x3b2fec[_0xb63d('0x2d')][_0xb63d('0x2e')]};});_0x2a9996[_0xb63d('0x2f')]=_['map'](_0x3c4f12,_0xb63d('0x29'));_0x2a9996[_0xb63d('0x30')]=_[_0xb63d('0x31')](_0x4bbeef[_0xb63d('0x30')]);_0x2a9996[_0xb63d('0x32')]=_['intersection'](_0x2a9996[_0xb63d('0x2f')],_0x2a9996['query']);_0x532bc6[_0xb63d('0x33')]=_['intersection'](_0x2a9996[_0xb63d('0x2f')],qs[_0xb63d('0x34')](_0x4bbeef[_0xb63d('0x30')][_0xb63d('0x34')]));_0x532bc6['attributes']=_0x532bc6[_0xb63d('0x33')][_0xb63d('0x35')]?_0x532bc6[_0xb63d('0x33')]:_0x2a9996[_0xb63d('0x2f')];if(!_0x4bbeef[_0xb63d('0x30')][_0xb63d('0x36')](_0xb63d('0x37'))){_0x532bc6[_0xb63d('0x1e')]=qs[_0xb63d('0x1e')](_0x4bbeef[_0xb63d('0x30')][_0xb63d('0x1e')]);_0x532bc6['offset']=qs[_0xb63d('0x1c')](_0x4bbeef[_0xb63d('0x30')][_0xb63d('0x1c')]);}_0x532bc6['order']=qs[_0xb63d('0x38')](_0x4bbeef[_0xb63d('0x30')]['sort']);_0x532bc6['where']=qs['filters'](_[_0xb63d('0x39')](_0x4bbeef[_0xb63d('0x30')],_0x2a9996['filters']),_0x3c4f12);if(_0x4bbeef[_0xb63d('0x30')][_0xb63d('0x3a')]){_0x532bc6[_0xb63d('0x3b')]=_[_0xb63d('0x3c')](_0x532bc6[_0xb63d('0x3b')],{'$or':_[_0xb63d('0x2a')](_0x3c4f12,function(_0xaeb675){if(_0xaeb675['type']!==_0xb63d('0x3d')){var _0x1ba3b7={};_0x1ba3b7[_0xaeb675[_0xb63d('0x29')]]={'$like':'%'+_0x4bbeef[_0xb63d('0x30')][_0xb63d('0x3a')]+'%'};return _0x1ba3b7;}})});}_0x532bc6=_['merge']({},_0x532bc6,_0x4bbeef[_0xb63d('0x3e')]);var _0x5c53cf={'where':_0x532bc6['where']};return db[_0xb63d('0x3f')]['count'](_0x5c53cf)[_0xb63d('0x25')](function(_0x5f4b76){_0x4668e0[_0xb63d('0x1f')]=_0x5f4b76;if(_0x4bbeef[_0xb63d('0x30')][_0xb63d('0x40')]){_0x532bc6[_0xb63d('0x41')]=[{'all':!![]}];}return db[_0xb63d('0x3f')]['findAll'](_0x532bc6);})[_0xb63d('0x25')](function(_0x4b38be){_0x4668e0[_0xb63d('0x42')]=_0x4b38be;return _0x4668e0;})[_0xb63d('0x25')](respondWithFilteredResult(_0x39c1d2,_0x532bc6))[_0xb63d('0x43')](handleError(_0x39c1d2,null));};exports['show']=function(_0x3bd094,_0x29abcd){var _0x11d48e={'raw':![],'where':{'id':_0x3bd094[_0xb63d('0x44')]['id']}},_0x16905={};_0x16905[_0xb63d('0x2f')]=_['keys'](db['DeskAccount'][_0xb63d('0x2b')]);_0x16905['query']=_['keys'](_0x3bd094[_0xb63d('0x30')]);_0x16905['filters']=_[_0xb63d('0x45')](_0x16905[_0xb63d('0x2f')],_0x16905[_0xb63d('0x30')]);_0x11d48e['attributes']=_[_0xb63d('0x45')](_0x16905['model'],qs[_0xb63d('0x34')](_0x3bd094[_0xb63d('0x30')][_0xb63d('0x34')]));_0x11d48e[_0xb63d('0x33')]=_0x11d48e[_0xb63d('0x33')][_0xb63d('0x35')]?_0x11d48e[_0xb63d('0x33')]:_0x16905[_0xb63d('0x2f')];if(_0x3bd094[_0xb63d('0x30')][_0xb63d('0x40')]){_0x11d48e[_0xb63d('0x41')]=[{'all':!![]}];}_0x11d48e=_[_0xb63d('0x3c')]({},_0x11d48e,_0x3bd094[_0xb63d('0x3e')]);return db[_0xb63d('0x3f')][_0xb63d('0x46')](_0x11d48e)[_0xb63d('0x25')](handleEntityNotFound(_0x29abcd,null))['then'](respondWithResult(_0x29abcd,null))['catch'](handleError(_0x29abcd,null));};exports[_0xb63d('0x47')]=function(_0x1ec9d7,_0x43eec4){return db[_0xb63d('0x3f')][_0xb63d('0x47')](_0x1ec9d7[_0xb63d('0x48')],{})[_0xb63d('0x25')](respondWithResult(_0x43eec4,0xc9))[_0xb63d('0x43')](handleError(_0x43eec4,null));};exports[_0xb63d('0x24')]=function(_0x509511,_0x5dabec){if(_0x509511[_0xb63d('0x48')]['id']){delete _0x509511[_0xb63d('0x48')]['id'];}return db[_0xb63d('0x3f')][_0xb63d('0x46')]({'where':{'id':_0x509511[_0xb63d('0x44')]['id']}})[_0xb63d('0x25')](handleEntityNotFound(_0x5dabec,null))[_0xb63d('0x25')](saveUpdates(_0x509511[_0xb63d('0x48')],null))[_0xb63d('0x25')](respondWithResult(_0x5dabec,null))[_0xb63d('0x43')](handleError(_0x5dabec,null));};exports[_0xb63d('0x26')]=function(_0x2e0419,_0x3b802b){return db[_0xb63d('0x3f')][_0xb63d('0x46')]({'where':{'id':_0x2e0419[_0xb63d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b802b,null))[_0xb63d('0x25')](removeEntity(_0x3b802b,null))[_0xb63d('0x43')](handleError(_0x3b802b,null));};exports[_0xb63d('0x49')]=function(_0x52d40c,_0x2a7894,_0x15b10f){var _0x37ae71={};var _0xb56b1c={};var _0xcd95f6;var _0x5c4d1a;return db[_0xb63d('0x3f')]['findOne']({'where':{'id':_0x52d40c[_0xb63d('0x44')]['id']}})[_0xb63d('0x25')](handleEntityNotFound(_0x2a7894,null))[_0xb63d('0x25')](function(_0x133d07){if(_0x133d07){_0xcd95f6=_0x133d07;_0xb56b1c[_0xb63d('0x2f')]=_[_0xb63d('0x31')](db[_0xb63d('0x4a')][_0xb63d('0x2b')]);_0xb56b1c[_0xb63d('0x30')]=_[_0xb63d('0x31')](_0x52d40c['query']);_0xb56b1c['filters']=_['intersection'](_0xb56b1c[_0xb63d('0x2f')],_0xb56b1c['query']);_0x37ae71[_0xb63d('0x33')]=_[_0xb63d('0x45')](_0xb56b1c[_0xb63d('0x2f')],qs[_0xb63d('0x34')](_0x52d40c[_0xb63d('0x30')][_0xb63d('0x34')]));_0x37ae71[_0xb63d('0x33')]=_0x37ae71[_0xb63d('0x33')][_0xb63d('0x35')]?_0x37ae71[_0xb63d('0x33')]:_0xb56b1c[_0xb63d('0x2f')];_0x37ae71[_0xb63d('0x4b')]=qs[_0xb63d('0x38')](_0x52d40c[_0xb63d('0x30')][_0xb63d('0x38')]);_0x37ae71[_0xb63d('0x3b')]=qs[_0xb63d('0x32')](_['pick'](_0x52d40c[_0xb63d('0x30')],_0xb56b1c['filters']));if(_0x52d40c[_0xb63d('0x30')]['filter']){_0x37ae71[_0xb63d('0x3b')]=_['merge'](_0x37ae71[_0xb63d('0x3b')],{'$or':_['map'](_0x37ae71[_0xb63d('0x33')],function(_0x201787){var _0x2beef3={};_0x2beef3[_0x201787]={'$like':'%'+_0x52d40c[_0xb63d('0x30')][_0xb63d('0x3a')]+'%'};return _0x2beef3;})});}_0x37ae71=_[_0xb63d('0x3c')]({},_0x37ae71,_0x52d40c[_0xb63d('0x3e')]);return _0xcd95f6['getConfigurations'](_0x37ae71);}})[_0xb63d('0x25')](function(_0x1b561c){if(_0x1b561c){_0x5c4d1a=_0x1b561c['length'];if(!_0x52d40c['query'][_0xb63d('0x36')](_0xb63d('0x37'))){_0x37ae71[_0xb63d('0x1e')]=qs['limit'](_0x52d40c[_0xb63d('0x30')][_0xb63d('0x1e')]);_0x37ae71[_0xb63d('0x1c')]=qs['offset'](_0x52d40c[_0xb63d('0x30')][_0xb63d('0x1c')]);}return _0xcd95f6[_0xb63d('0x49')](_0x37ae71);}})[_0xb63d('0x25')](function(_0x47adac){if(_0x47adac){return _0x47adac?{'count':_0x5c4d1a,'rows':_0x47adac}:null;}})[_0xb63d('0x25')](respondWithResult(_0x2a7894,null))[_0xb63d('0x43')](handleError(_0x2a7894,null));};exports['addConfiguration']=function(_0x1e340b,_0x45dd49,_0x31db27){if(_0x1e340b[_0xb63d('0x48')]['id']){delete _0x1e340b[_0xb63d('0x48')]['id'];}return db[_0xb63d('0x3f')][_0xb63d('0x4c')]({'where':{'id':_0x1e340b['params']['id']}})['then'](handleEntityNotFound(_0x45dd49,null))[_0xb63d('0x25')](function(_0x10491e){if(_0x10491e){_0x1e340b['body'][_0xb63d('0x4d')]=_0x10491e['id'];_0x1e340b[_0xb63d('0x48')]['Subjects']=integrations[_0xb63d('0x4e')](_0x1e340b[_0xb63d('0x48')][_0xb63d('0x4f')],_0x1e340b[_0xb63d('0x48')][_0xb63d('0x2d')]);_0x1e340b[_0xb63d('0x48')][_0xb63d('0x50')]=integrations[_0xb63d('0x51')](_0x1e340b[_0xb63d('0x48')][_0xb63d('0x4f')],_0x1e340b[_0xb63d('0x48')]['type']);return db[_0xb63d('0x4a')][_0xb63d('0x47')](_0x1e340b[_0xb63d('0x48')],{'include':[{'model':db['DeskField'],'as':_0xb63d('0x52')},{'model':db[_0xb63d('0x53')],'as':_0xb63d('0x50')}]});}return null;})[_0xb63d('0x25')](respondWithResult(_0x45dd49,null))[_0xb63d('0x43')](handleError(_0x45dd49,null));};exports[_0xb63d('0x54')]=function(_0x59554e,_0x6f81f5,_0xaf2037){var _0x509968=[{'name':_0xb63d('0x55'),'label':_0xb63d('0x55'),'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 _0x220d4d='';return db[_0xb63d('0x3f')][_0xb63d('0x4c')]({'where':{'id':_0x59554e['params']['id']},'attributes':['id',_0xb63d('0x56'),'authType',_0xb63d('0x57'),'password',_0xb63d('0x58'),'consumerSecret','token',_0xb63d('0x59')]})[_0xb63d('0x25')](handleEntityNotFound(_0x6f81f5,null))[_0xb63d('0x25')](function(_0x1d9a36){if(_0x1d9a36){_0x220d4d=_0x1d9a36[_0xb63d('0x56')];var _0x3a952d=_0x220d4d[_0xb63d('0x5a')](-0x1);if(_0x3a952d==='/'){_0x220d4d=_0x220d4d['substring'](0x0,_0x220d4d[_0xb63d('0x5b')](_0x3a952d));}var _0x1a175c={'method':_0xb63d('0x5c'),'uri':util[_0xb63d('0x5d')](_0xb63d('0x5e'),_0x220d4d),'headers':{'Content-Type':_0xb63d('0x5f'),'Accept':'application/json'},'json':!![]};if(_0x1d9a36[_0xb63d('0x60')]==='basic'){_0x1a175c[_0xb63d('0x61')][_0xb63d('0x62')]=util[_0xb63d('0x5d')]('Basic\x20%s',new Buffer(util[_0xb63d('0x5d')](_0xb63d('0x63'),_0x1d9a36[_0xb63d('0x57')],_0x1d9a36['password']))[_0xb63d('0x64')](_0xb63d('0x65')));}return rp(_0x1a175c)[_0xb63d('0x25')](function(_0x3ce794){return _0x509968[_0xb63d('0x66')](_[_0xb63d('0x2a')](_0x3ce794['_embedded'][_0xb63d('0x67')],function(_0x51b50e){return{'id':_0x51b50e[_0xb63d('0x29')],'name':_0x51b50e[_0xb63d('0x29')],'type':_0x51b50e[_0xb63d('0x2d')],'active':_0x51b50e[_0xb63d('0x68')],'label':_0x51b50e['label'],'custom':!![]};}));});}})[_0xb63d('0x25')](function(_0xc6cb94){return{'count':_0xc6cb94[_0xb63d('0x35')],'rows':_0xc6cb94};})[_0xb63d('0x25')](respondWithResult(_0x6f81f5,null))[_0xb63d('0x43')](function(_0x4e43be){var _0xe66038=_0x59554e[_0xb63d('0x30')][_0xb63d('0x69')]?0x1f4:_0x4e43be[_0xb63d('0x6a')]||0x1f4;logger[_0xb63d('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0xb63d('0x54'),_0xe66038,JSON['stringify'](_0x4e43be));delete _0x4e43be[_0xb63d('0x29')];if(_0xe66038===0x191){_0xe66038=0x190;}_0x6f81f5[_0xb63d('0x19')](_0xe66038)[_0xb63d('0x6c')](_0x59554e[_0xb63d('0x30')][_0xb63d('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x4e43be[_0xb63d('0x6a')]}:_0x4e43be);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index eb89e4d..2bf693a 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 _0x0ed9=['path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3f0155,_0x357cb1){var _0xa5d98e=function(_0x123b36){while(--_0x123b36){_0x3f0155['push'](_0x3f0155['shift']());}};_0xa5d98e(++_0x357cb1);}(_0x0ed9,0x10e));var _0x90ed=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x0ed9[_0x406e46];return _0x4a3742;};'use strict';var _=require(_0x90ed('0x0'));var util=require(_0x90ed('0x1'));var logger=require(_0x90ed('0x2'))('api');var moment=require(_0x90ed('0x3'));var BPromise=require(_0x90ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90ed('0x5'));var rimraf=require(_0x90ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x90ed('0x7'));var integrations=require(_0x90ed('0x8'));module[_0x90ed('0x9')]=function(_0x2fb6f1,_0x20c2e3){return _0x2fb6f1[_0x90ed('0xa')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ecd=['rimraf','../../config/environment','../../components/integrations/configuration','define','int_desk_accounts','lodash','../../config/logger','api','bluebird','path'];(function(_0x413ff0,_0x1e782d){var _0x3826d4=function(_0x46c7ae){while(--_0x46c7ae){_0x413ff0['push'](_0x413ff0['shift']());}};_0x3826d4(++_0x1e782d);}(_0x0ecd,0xff));var _0xd0ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ecd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd0ec('0x0'));var util=require('util');var logger=require(_0xd0ec('0x1'))(_0xd0ec('0x2'));var moment=require('moment');var BPromise=require(_0xd0ec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0ec('0x4'));var rimraf=require(_0xd0ec('0x5'));var config=require(_0xd0ec('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xd0ec('0x7'));module['exports']=function(_0x55790e,_0x2cddd){return _0x55790e[_0xd0ec('0x8')]('DeskAccount',attributes,{'tableName':_0xd0ec('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 1c824df..e48cd11 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 _0xebb6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0xebb6,0xf0));var _0x6ebb=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xebb6[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x6ebb('0x0'));var util=require(_0x6ebb('0x1'));var moment=require(_0x6ebb('0x2'));var BPromise=require(_0x6ebb('0x3'));var rs=require(_0x6ebb('0x4'));var fs=require('fs');var Redis=require(_0x6ebb('0x5'));var db=require(_0x6ebb('0x6'))['db'];var utils=require(_0x6ebb('0x7'));var logger=require(_0x6ebb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ebb('0x9')][_0x6ebb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f807b,_0x3961b8,_0x31b607){return new BPromise(function(_0x2de50a,_0x2c3107){return client[_0x6ebb('0xb')](_0x1f807b,_0x31b607)[_0x6ebb('0xc')](function(_0x22a24f){logger[_0x6ebb('0xd')](_0x6ebb('0xe'),_0x3961b8,_0x6ebb('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3961b8,_0x6ebb('0xf'),JSON[_0x6ebb('0x10')](_0x22a24f));if(_0x22a24f['error']){if(_0x22a24f['error']['code']===0x1f4){logger[_0x6ebb('0x11')](_0x6ebb('0xe'),_0x3961b8,_0x22a24f['error'][_0x6ebb('0x12')]);return _0x2c3107(_0x22a24f[_0x6ebb('0x11')]['message']);}logger['error'](_0x6ebb('0xe'),_0x3961b8,_0x22a24f[_0x6ebb('0x11')]['message']);return _0x2de50a(_0x22a24f[_0x6ebb('0x11')][_0x6ebb('0x12')]);}else{logger[_0x6ebb('0xd')](_0x6ebb('0xe'),_0x3961b8,'request\x20sent');_0x2de50a(_0x22a24f[_0x6ebb('0x13')][_0x6ebb('0x12')]);}})['catch'](function(_0x3c0aeb){logger['error'](_0x6ebb('0xe'),_0x3961b8,_0x3c0aeb);_0x2c3107(_0x3c0aeb);});});}exports[_0x6ebb('0x14')]=function(_0x1d9b85){var _0xf6f26a=this;return new Promise(function(_0x419c6e,_0x4d583c){return db[_0x6ebb('0x15')][_0x6ebb('0x16')]({'raw':_0x1d9b85[_0x6ebb('0x17')]?_0x1d9b85[_0x6ebb('0x17')][_0x6ebb('0x18')]===undefined?!![]:![]:!![],'where':_0x1d9b85[_0x6ebb('0x17')]?_0x1d9b85[_0x6ebb('0x17')][_0x6ebb('0x19')]||null:null,'attributes':_0x1d9b85[_0x6ebb('0x17')]?_0x1d9b85[_0x6ebb('0x17')][_0x6ebb('0x1a')]||null:null,'limit':_0x1d9b85[_0x6ebb('0x17')]?_0x1d9b85['options'][_0x6ebb('0x1b')]||null:null,'include':_0x1d9b85[_0x6ebb('0x17')]?_0x1d9b85[_0x6ebb('0x17')][_0x6ebb('0x1c')]?_[_0x6ebb('0x1d')](_0x1d9b85[_0x6ebb('0x17')]['include'],function(_0x2b90de){return{'model':db[_0x2b90de[_0x6ebb('0x1e')]],'as':_0x2b90de['as'],'attributes':_0x2b90de[_0x6ebb('0x1a')],'include':_0x2b90de[_0x6ebb('0x1c')]?_[_0x6ebb('0x1d')](_0x2b90de[_0x6ebb('0x1c')],function(_0x5aed03){return{'model':db[_0x5aed03[_0x6ebb('0x1e')]],'as':_0x5aed03['as'],'attributes':_0x5aed03['attributes'],'include':_0x5aed03[_0x6ebb('0x1c')]?_[_0x6ebb('0x1d')](_0x5aed03[_0x6ebb('0x1c')],function(_0x42e90c){return{'model':db[_0x42e90c[_0x6ebb('0x1e')]],'as':_0x42e90c['as'],'attributes':_0x42e90c[_0x6ebb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6ebb('0xc')](function(_0x1fd5b4){logger[_0x6ebb('0xd')](_0x6ebb('0x14'),_0x1d9b85);logger[_0x6ebb('0x1f')](_0x6ebb('0x14'),_0x1d9b85,JSON[_0x6ebb('0x10')](_0x1fd5b4));_0x419c6e(_0x1fd5b4);})[_0x6ebb('0x20')](function(_0xf3b33b){logger[_0x6ebb('0x11')]('GetDeskAccount',_0xf3b33b[_0x6ebb('0x12')],_0x1d9b85);_0x4d583c(_0xf6f26a[_0x6ebb('0x11')](0x1f4,_0xf3b33b[_0x6ebb('0x12')]));});});};exports[_0x6ebb('0x21')]=function(_0x13bdb3){var _0x266858=this;return new Promise(function(_0x18e3e6,_0x89534a){return db[_0x6ebb('0x15')][_0x6ebb('0x22')]({'raw':_0x13bdb3['options']?_0x13bdb3['options'][_0x6ebb('0x18')]===undefined?!![]:![]:!![],'where':_0x13bdb3[_0x6ebb('0x17')]?_0x13bdb3['options']['where']||null:null,'attributes':_0x13bdb3[_0x6ebb('0x17')]?_0x13bdb3[_0x6ebb('0x17')][_0x6ebb('0x1a')]||null:null,'include':_0x13bdb3[_0x6ebb('0x17')]?_0x13bdb3[_0x6ebb('0x17')][_0x6ebb('0x1c')]?_['map'](_0x13bdb3[_0x6ebb('0x17')][_0x6ebb('0x1c')],function(_0x535a8d){return{'model':db[_0x535a8d[_0x6ebb('0x1e')]],'as':_0x535a8d['as'],'attributes':_0x535a8d[_0x6ebb('0x1a')],'include':_0x535a8d[_0x6ebb('0x1c')]?_[_0x6ebb('0x1d')](_0x535a8d[_0x6ebb('0x1c')],function(_0x317b9d){return{'model':db[_0x317b9d[_0x6ebb('0x1e')]],'as':_0x317b9d['as'],'attributes':_0x317b9d[_0x6ebb('0x1a')],'include':_0x317b9d[_0x6ebb('0x1c')]?_[_0x6ebb('0x1d')](_0x317b9d[_0x6ebb('0x1c')],function(_0x3c16a5){return{'model':db[_0x3c16a5['model']],'as':_0x3c16a5['as'],'attributes':_0x3c16a5[_0x6ebb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6ebb('0xc')](function(_0x4bce04){logger[_0x6ebb('0xd')]('ShowDeskAccount',_0x13bdb3);logger[_0x6ebb('0x1f')](_0x6ebb('0x21'),_0x13bdb3,JSON[_0x6ebb('0x10')](_0x4bce04));_0x18e3e6(_0x4bce04);})[_0x6ebb('0x20')](function(_0x3085d2){logger[_0x6ebb('0x11')](_0x6ebb('0x21'),_0x3085d2[_0x6ebb('0x12')],_0x13bdb3);_0x89534a(_0x266858['error'](0x1f4,_0x3085d2['message']));});});}; \ No newline at end of file +var _0x5545=['code','message','result','GetDeskAccount','findAll','options','where','attributes','limit','map','include','model','catch','ShowDeskAccount','DeskAccount','find','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5e2510,_0x4d15a6){var _0x504d62=function(_0x1efd3c){while(--_0x1efd3c){_0x5e2510['push'](_0x5e2510['shift']());}};_0x504d62(++_0x4d15a6);}(_0x5545,0xc4));var _0x5554=function(_0x1e167a,_0x53f0fa){_0x1e167a=_0x1e167a-0x0;var _0x1766d2=_0x5545[_0x1e167a];return _0x1766d2;};'use strict';var _=require(_0x5554('0x0'));var util=require(_0x5554('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5554('0x2'))['db'];var utils=require(_0x5554('0x3'));var logger=require(_0x5554('0x4'))(_0x5554('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5554('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x7a816c,_0x1b8aff,_0x10e157){return new BPromise(function(_0x2fd469,_0x3f1851){return client['request'](_0x7a816c,_0x10e157)['then'](function(_0x4a40ea){logger[_0x5554('0x7')](_0x5554('0x8'),_0x1b8aff,_0x5554('0x9'));logger[_0x5554('0xa')](_0x5554('0xb'),_0x1b8aff,_0x5554('0x9'),JSON[_0x5554('0xc')](_0x4a40ea));if(_0x4a40ea[_0x5554('0xd')]){if(_0x4a40ea['error'][_0x5554('0xe')]===0x1f4){logger[_0x5554('0xd')](_0x5554('0x8'),_0x1b8aff,_0x4a40ea[_0x5554('0xd')][_0x5554('0xf')]);return _0x3f1851(_0x4a40ea[_0x5554('0xd')][_0x5554('0xf')]);}logger[_0x5554('0xd')](_0x5554('0x8'),_0x1b8aff,_0x4a40ea['error'][_0x5554('0xf')]);return _0x2fd469(_0x4a40ea[_0x5554('0xd')]['message']);}else{logger[_0x5554('0x7')](_0x5554('0x8'),_0x1b8aff,_0x5554('0x9'));_0x2fd469(_0x4a40ea[_0x5554('0x10')][_0x5554('0xf')]);}})['catch'](function(_0xbc7df9){logger[_0x5554('0xd')]('DeskAccount,\x20%s,\x20%s',_0x1b8aff,_0xbc7df9);_0x3f1851(_0xbc7df9);});});}exports[_0x5554('0x11')]=function(_0x5439f3){var _0x1f9041=this;return new Promise(function(_0x11fbf5,_0x41cea3){return db['DeskAccount'][_0x5554('0x12')]({'raw':_0x5439f3[_0x5554('0x13')]?_0x5439f3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5439f3['options']?_0x5439f3['options'][_0x5554('0x14')]||null:null,'attributes':_0x5439f3['options']?_0x5439f3[_0x5554('0x13')][_0x5554('0x15')]||null:null,'limit':_0x5439f3[_0x5554('0x13')]?_0x5439f3[_0x5554('0x13')][_0x5554('0x16')]||null:null,'include':_0x5439f3[_0x5554('0x13')]?_0x5439f3[_0x5554('0x13')]['include']?_[_0x5554('0x17')](_0x5439f3['options'][_0x5554('0x18')],function(_0x3aaaeb){return{'model':db[_0x3aaaeb['model']],'as':_0x3aaaeb['as'],'attributes':_0x3aaaeb['attributes'],'include':_0x3aaaeb[_0x5554('0x18')]?_[_0x5554('0x17')](_0x3aaaeb[_0x5554('0x18')],function(_0x123a95){return{'model':db[_0x123a95[_0x5554('0x19')]],'as':_0x123a95['as'],'attributes':_0x123a95['attributes'],'include':_0x123a95['include']?_[_0x5554('0x17')](_0x123a95['include'],function(_0x44f4a4){return{'model':db[_0x44f4a4[_0x5554('0x19')]],'as':_0x44f4a4['as'],'attributes':_0x44f4a4[_0x5554('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x318d59){logger[_0x5554('0x7')](_0x5554('0x11'),_0x5439f3);logger['debug'](_0x5554('0x11'),_0x5439f3,JSON['stringify'](_0x318d59));_0x11fbf5(_0x318d59);})[_0x5554('0x1a')](function(_0x224078){logger[_0x5554('0xd')]('GetDeskAccount',_0x224078[_0x5554('0xf')],_0x5439f3);_0x41cea3(_0x1f9041[_0x5554('0xd')](0x1f4,_0x224078['message']));});});};exports[_0x5554('0x1b')]=function(_0x20f03b){var _0x136431=this;return new Promise(function(_0x5f37cc,_0x38af52){return db[_0x5554('0x1c')][_0x5554('0x1d')]({'raw':_0x20f03b['options']?_0x20f03b[_0x5554('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x20f03b[_0x5554('0x13')]?_0x20f03b[_0x5554('0x13')][_0x5554('0x14')]||null:null,'attributes':_0x20f03b[_0x5554('0x13')]?_0x20f03b[_0x5554('0x13')][_0x5554('0x15')]||null:null,'include':_0x20f03b[_0x5554('0x13')]?_0x20f03b[_0x5554('0x13')][_0x5554('0x18')]?_[_0x5554('0x17')](_0x20f03b[_0x5554('0x13')][_0x5554('0x18')],function(_0x317a06){return{'model':db[_0x317a06[_0x5554('0x19')]],'as':_0x317a06['as'],'attributes':_0x317a06['attributes'],'include':_0x317a06[_0x5554('0x18')]?_[_0x5554('0x17')](_0x317a06['include'],function(_0x16cc52){return{'model':db[_0x16cc52[_0x5554('0x19')]],'as':_0x16cc52['as'],'attributes':_0x16cc52[_0x5554('0x15')],'include':_0x16cc52[_0x5554('0x18')]?_[_0x5554('0x17')](_0x16cc52[_0x5554('0x18')],function(_0x50a71f){return{'model':db[_0x50a71f[_0x5554('0x19')]],'as':_0x50a71f['as'],'attributes':_0x50a71f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44f893){logger[_0x5554('0x7')]('ShowDeskAccount',_0x20f03b);logger[_0x5554('0xa')](_0x5554('0x1b'),_0x20f03b,JSON[_0x5554('0xc')](_0x44f893));_0x5f37cc(_0x44f893);})[_0x5554('0x1a')](function(_0x4fe348){logger[_0x5554('0xd')]('ShowDeskAccount',_0x4fe348[_0x5554('0xf')],_0x20f03b);_0x38af52(_0x136431['error'](0x1f4,_0x4fe348[_0x5554('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 386b6b9..e0f9114 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x49e3a1,_0x287108){var _0x539478=function(_0x2799b2){while(--_0x2799b2){_0x49e3a1['push'](_0x49e3a1['shift']());}};_0x539478(++_0x287108);}(_0x008c,0x188));var _0xc008=function(_0x282ccc,_0x5d66a1){_0x282ccc=_0x282ccc-0x0;var _0x27c2dd=_0x008c[_0x282ccc];return _0x27c2dd;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x45bc07,_0x28380d){var _0x4b438c=function(_0x28a492){while(--_0x28a492){_0x45bc07['push'](_0x45bc07['shift']());}};_0x4b438c(++_0x28380d);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 64133e1..fd0f9bf 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 _0x9802=['STRING','exports'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x9802,0x1b7));var _0x2980=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9802[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require('sequelize');module[_0x2980('0x0')]={'name':{'type':Sequelize[_0x2980('0x1')]},'description':{'type':Sequelize[_0x2980('0x1')]}}; \ No newline at end of file +var _0x97be=['exports','STRING','sequelize'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x97be,0x104));var _0xe97b=function(_0x534612,_0x293832){_0x534612=_0x534612-0x0;var _0x15e21a=_0x97be[_0x534612];return _0x15e21a;};'use strict';var Sequelize=require(_0xe97b('0x0'));module[_0xe97b('0x1')]={'name':{'type':Sequelize[_0xe97b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 5a5f366..3ebc595 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 _0x0cee=['nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','then','catch','params','find','create','body','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','end','error','stack','send','index','map','DeskConfiguration','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length'];(function(_0x469d07,_0x1da668){var _0x3bb8ca=function(_0x3672e3){while(--_0x3672e3){_0x469d07['push'](_0x469d07['shift']());}};_0x3bb8ca(++_0x1da668);}(_0x0cee,0x1ba));var _0xe0ce=function(_0x342aac,_0x49e51f){_0x342aac=_0x342aac-0x0;var _0x50238e=_0x0cee[_0x342aac];return _0x50238e;};'use strict';var emlformat=require(_0xe0ce('0x0'));var rimraf=require(_0xe0ce('0x1'));var zipdir=require(_0xe0ce('0x2'));var jsonpatch=require(_0xe0ce('0x3'));var rp=require(_0xe0ce('0x4'));var moment=require(_0xe0ce('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe0ce('0x6'));var util=require(_0xe0ce('0x7'));var path=require(_0xe0ce('0x8'));var sox=require(_0xe0ce('0x9'));var csv=require(_0xe0ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0ce('0xb'));var squel=require(_0xe0ce('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe0ce('0xd'));var toCsv=require(_0xe0ce('0xa'));var querystring=require('querystring');var Papa=require(_0xe0ce('0xe'));var Redis=require(_0xe0ce('0xf'));var authService=require(_0xe0ce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe0ce('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0ce('0x12'))(_0xe0ce('0x13'));var utils=require(_0xe0ce('0x14'));var config=require(_0xe0ce('0x15'));var licenseUtil=require(_0xe0ce('0x16'));var db=require(_0xe0ce('0x17'))['db'];function respondWithStatusCode(_0x4fb9dd,_0x4780c3){_0x4780c3=_0x4780c3||0xcc;return function(_0x5584ab){if(_0x5584ab){return _0x4fb9dd[_0xe0ce('0x18')](_0x4780c3);}return _0x4fb9dd['status'](_0x4780c3)['end']();};}function respondWithResult(_0x339a6e,_0x4e9506){_0x4e9506=_0x4e9506||0xc8;return function(_0x2ff824){if(_0x2ff824){return _0x339a6e[_0xe0ce('0x19')](_0x4e9506)[_0xe0ce('0x1a')](_0x2ff824);}};}function respondWithFilteredResult(_0x2e5945,_0x6f0031){return function(_0x31ec4f){if(_0x31ec4f){var _0x24f308=typeof _0x6f0031[_0xe0ce('0x1b')]===_0xe0ce('0x1c')&&typeof _0x6f0031['limit']===_0xe0ce('0x1c');var _0x24b1ea=_0x31ec4f[_0xe0ce('0x1d')];var _0x1a7f08=_0x24f308?0x0:_0x6f0031[_0xe0ce('0x1b')];var _0x44dc64=_0x24f308?_0x31ec4f[_0xe0ce('0x1d')]:_0x6f0031['offset']+_0x6f0031[_0xe0ce('0x1e')];var _0x29655a;if(_0x44dc64>=_0x24b1ea){_0x44dc64=_0x24b1ea;_0x29655a=0xc8;}else{_0x29655a=0xce;}_0x2e5945['status'](_0x29655a);return _0x2e5945[_0xe0ce('0x1f')](_0xe0ce('0x20'),_0x1a7f08+'-'+_0x44dc64+'/'+_0x24b1ea)[_0xe0ce('0x1a')](_0x31ec4f);}return null;};}function patchUpdates(_0x3c538e){return function(_0x3885c1){try{jsonpatch[_0xe0ce('0x21')](_0x3885c1,_0x3c538e,!![]);}catch(_0x2463e9){return BPromise['reject'](_0x2463e9);}return _0x3885c1[_0xe0ce('0x22')]();};}function saveUpdates(_0x4789a5,_0x37488d){return function(_0x5c7d11){if(_0x5c7d11){return _0x5c7d11[_0xe0ce('0x23')](_0x4789a5)['then'](function(_0x55bfde){return _0x55bfde;});}return null;};}function removeEntity(_0x711252,_0x3871df){return function(_0x2f0d5f){if(_0x2f0d5f){return _0x2f0d5f[_0xe0ce('0x24')]()['then'](function(){_0x711252[_0xe0ce('0x19')](0xcc)[_0xe0ce('0x25')]();});}};}function handleEntityNotFound(_0x49fc3f,_0x6af40b){return function(_0x569169){if(!_0x569169){_0x49fc3f[_0xe0ce('0x18')](0x194);}return _0x569169;};}function handleError(_0x216738,_0x4059c1){_0x4059c1=_0x4059c1||0x1f4;return function(_0x48514f){logger[_0xe0ce('0x26')](_0x48514f[_0xe0ce('0x27')]);if(_0x48514f['name']){delete _0x48514f['name'];}_0x216738[_0xe0ce('0x19')](_0x4059c1)[_0xe0ce('0x28')](_0x48514f);};}exports[_0xe0ce('0x29')]=function(_0x2678f0,_0x223c34){var _0x3a9b4e={},_0x2194c2={},_0x54d16d={'count':0x0,'rows':[]};var _0x584d2b=_[_0xe0ce('0x2a')](db[_0xe0ce('0x2b')][_0xe0ce('0x2c')],function(_0x3919b4){return{'name':_0x3919b4['fieldName'],'type':_0x3919b4[_0xe0ce('0x2d')][_0xe0ce('0x2e')]};});_0x2194c2[_0xe0ce('0x2f')]=_[_0xe0ce('0x2a')](_0x584d2b,_0xe0ce('0x30'));_0x2194c2[_0xe0ce('0x31')]=_[_0xe0ce('0x32')](_0x2678f0[_0xe0ce('0x31')]);_0x2194c2[_0xe0ce('0x33')]=_[_0xe0ce('0x34')](_0x2194c2[_0xe0ce('0x2f')],_0x2194c2['query']);_0x3a9b4e[_0xe0ce('0x35')]=_[_0xe0ce('0x34')](_0x2194c2[_0xe0ce('0x2f')],qs['fields'](_0x2678f0[_0xe0ce('0x31')][_0xe0ce('0x36')]));_0x3a9b4e[_0xe0ce('0x35')]=_0x3a9b4e[_0xe0ce('0x35')][_0xe0ce('0x37')]?_0x3a9b4e['attributes']:_0x2194c2[_0xe0ce('0x2f')];if(!_0x2678f0[_0xe0ce('0x31')]['hasOwnProperty'](_0xe0ce('0x38'))){_0x3a9b4e[_0xe0ce('0x1e')]=qs[_0xe0ce('0x1e')](_0x2678f0[_0xe0ce('0x31')][_0xe0ce('0x1e')]);_0x3a9b4e[_0xe0ce('0x1b')]=qs[_0xe0ce('0x1b')](_0x2678f0[_0xe0ce('0x31')][_0xe0ce('0x1b')]);}_0x3a9b4e[_0xe0ce('0x39')]=qs[_0xe0ce('0x3a')](_0x2678f0[_0xe0ce('0x31')][_0xe0ce('0x3a')]);_0x3a9b4e[_0xe0ce('0x3b')]=qs[_0xe0ce('0x33')](_[_0xe0ce('0x3c')](_0x2678f0[_0xe0ce('0x31')],_0x2194c2[_0xe0ce('0x33')]),_0x584d2b);if(_0x2678f0[_0xe0ce('0x31')][_0xe0ce('0x3d')]){_0x3a9b4e['where']=_['merge'](_0x3a9b4e[_0xe0ce('0x3b')],{'$or':_[_0xe0ce('0x2a')](_0x584d2b,function(_0x28c453){if(_0x28c453['type']!==_0xe0ce('0x3e')){var _0x33305c={};_0x33305c[_0x28c453[_0xe0ce('0x30')]]={'$like':'%'+_0x2678f0[_0xe0ce('0x31')][_0xe0ce('0x3d')]+'%'};return _0x33305c;}})});}_0x3a9b4e=_[_0xe0ce('0x3f')]({},_0x3a9b4e,_0x2678f0[_0xe0ce('0x40')]);var _0x16adee={'where':_0x3a9b4e[_0xe0ce('0x3b')]};return db[_0xe0ce('0x2b')]['count'](_0x16adee)['then'](function(_0x511fb4){_0x54d16d[_0xe0ce('0x1d')]=_0x511fb4;if(_0x2678f0[_0xe0ce('0x31')][_0xe0ce('0x41')]){_0x3a9b4e[_0xe0ce('0x42')]=[{'all':!![]}];}return db[_0xe0ce('0x2b')][_0xe0ce('0x43')](_0x3a9b4e);})['then'](function(_0x2a52ed){_0x54d16d[_0xe0ce('0x44')]=_0x2a52ed;return _0x54d16d;})[_0xe0ce('0x45')](respondWithFilteredResult(_0x223c34,_0x3a9b4e))[_0xe0ce('0x46')](handleError(_0x223c34,null));};exports['show']=function(_0x1d7695,_0x30dc6d){var _0x372b73={'raw':![],'where':{'id':_0x1d7695[_0xe0ce('0x47')]['id']}},_0x2d540e={};_0x2d540e[_0xe0ce('0x2f')]=_[_0xe0ce('0x32')](db[_0xe0ce('0x2b')][_0xe0ce('0x2c')]);_0x2d540e[_0xe0ce('0x31')]=_['keys'](_0x1d7695['query']);_0x2d540e['filters']=_['intersection'](_0x2d540e[_0xe0ce('0x2f')],_0x2d540e[_0xe0ce('0x31')]);_0x372b73[_0xe0ce('0x35')]=_[_0xe0ce('0x34')](_0x2d540e[_0xe0ce('0x2f')],qs[_0xe0ce('0x36')](_0x1d7695[_0xe0ce('0x31')]['fields']));_0x372b73['attributes']=_0x372b73[_0xe0ce('0x35')][_0xe0ce('0x37')]?_0x372b73[_0xe0ce('0x35')]:_0x2d540e[_0xe0ce('0x2f')];if(_0x1d7695[_0xe0ce('0x31')][_0xe0ce('0x41')]){_0x372b73[_0xe0ce('0x42')]=[{'all':!![]}];}_0x372b73=_[_0xe0ce('0x3f')]({},_0x372b73,_0x1d7695[_0xe0ce('0x40')]);return db[_0xe0ce('0x2b')][_0xe0ce('0x48')](_0x372b73)[_0xe0ce('0x45')](handleEntityNotFound(_0x30dc6d,null))['then'](respondWithResult(_0x30dc6d,null))['catch'](handleError(_0x30dc6d,null));};exports[_0xe0ce('0x49')]=function(_0x4b955e,_0x278637){return db[_0xe0ce('0x2b')][_0xe0ce('0x49')](_0x4b955e[_0xe0ce('0x4a')],{})[_0xe0ce('0x45')](respondWithResult(_0x278637,0xc9))[_0xe0ce('0x46')](handleError(_0x278637,null));};exports[_0xe0ce('0x23')]=function(_0x50a5e4,_0x13d95a){if(_0x50a5e4['body']['id']){delete _0x50a5e4[_0xe0ce('0x4a')]['id'];}return db[_0xe0ce('0x2b')][_0xe0ce('0x48')]({'where':{'id':_0x50a5e4[_0xe0ce('0x47')]['id']}})[_0xe0ce('0x45')](handleEntityNotFound(_0x13d95a,null))[_0xe0ce('0x45')](saveUpdates(_0x50a5e4[_0xe0ce('0x4a')],null))['then'](respondWithResult(_0x13d95a,null))[_0xe0ce('0x46')](handleError(_0x13d95a,null));};exports[_0xe0ce('0x24')]=function(_0x17c552,_0x2b7357){return db['DeskConfiguration']['find']({'where':{'id':_0x17c552[_0xe0ce('0x47')]['id']}})[_0xe0ce('0x45')](handleEntityNotFound(_0x2b7357,null))[_0xe0ce('0x45')](removeEntity(_0x2b7357,null))[_0xe0ce('0x46')](handleError(_0x2b7357,null));};exports[_0xe0ce('0x4b')]=function(_0x5ed1b5,_0xa7703c,_0x221edf){var _0x3fff06={};var _0x26fa6e={};var _0x4a4bd8;var _0x451500;return db['DeskConfiguration'][_0xe0ce('0x4c')]({'where':{'id':_0x5ed1b5[_0xe0ce('0x47')]['id']}})[_0xe0ce('0x45')](handleEntityNotFound(_0xa7703c,null))['then'](function(_0x1a8e9b){if(_0x1a8e9b){_0x4a4bd8=_0x1a8e9b;_0x26fa6e['model']=_[_0xe0ce('0x32')](db[_0xe0ce('0x4d')][_0xe0ce('0x2c')]);_0x26fa6e['query']=_[_0xe0ce('0x32')](_0x5ed1b5[_0xe0ce('0x31')]);_0x26fa6e[_0xe0ce('0x33')]=_['intersection'](_0x26fa6e[_0xe0ce('0x2f')],_0x26fa6e[_0xe0ce('0x31')]);_0x3fff06[_0xe0ce('0x35')]=_[_0xe0ce('0x34')](_0x26fa6e[_0xe0ce('0x2f')],qs['fields'](_0x5ed1b5[_0xe0ce('0x31')][_0xe0ce('0x36')]));_0x3fff06[_0xe0ce('0x35')]=_0x3fff06[_0xe0ce('0x35')]['length']?_0x3fff06[_0xe0ce('0x35')]:_0x26fa6e[_0xe0ce('0x2f')];_0x3fff06[_0xe0ce('0x39')]=qs['sort'](_0x5ed1b5['query'][_0xe0ce('0x3a')]);_0x3fff06[_0xe0ce('0x3b')]=qs[_0xe0ce('0x33')](_[_0xe0ce('0x3c')](_0x5ed1b5['query'],_0x26fa6e['filters']));if(_0x5ed1b5['query'][_0xe0ce('0x3d')]){_0x3fff06[_0xe0ce('0x3b')]=_[_0xe0ce('0x3f')](_0x3fff06[_0xe0ce('0x3b')],{'$or':_[_0xe0ce('0x2a')](_0x3fff06[_0xe0ce('0x35')],function(_0xc81798){var _0x4d99d2={};_0x4d99d2[_0xc81798]={'$like':'%'+_0x5ed1b5[_0xe0ce('0x31')][_0xe0ce('0x3d')]+'%'};return _0x4d99d2;})});}_0x3fff06=_[_0xe0ce('0x3f')]({},_0x3fff06,_0x5ed1b5[_0xe0ce('0x40')]);return _0x4a4bd8[_0xe0ce('0x4b')](_0x3fff06);}})[_0xe0ce('0x45')](function(_0x114616){if(_0x114616){_0x451500=_0x114616[_0xe0ce('0x37')];if(!_0x5ed1b5[_0xe0ce('0x31')][_0xe0ce('0x4e')](_0xe0ce('0x38'))){_0x3fff06['limit']=qs[_0xe0ce('0x1e')](_0x5ed1b5['query'][_0xe0ce('0x1e')]);_0x3fff06[_0xe0ce('0x1b')]=qs['offset'](_0x5ed1b5['query'][_0xe0ce('0x1b')]);}return _0x4a4bd8['getFields'](_0x3fff06);}})[_0xe0ce('0x45')](function(_0x487002){if(_0x487002){return _0x487002?{'count':_0x451500,'rows':_0x487002}:null;}})['then'](respondWithResult(_0xa7703c,null))['catch'](handleError(_0xa7703c,null));};exports[_0xe0ce('0x4f')]=function(_0x418ad0,_0xcd4b73,_0x332873){var _0xf9d102={};var _0x19a2cc={};var _0x32e901;var _0x38fa4f;return db[_0xe0ce('0x2b')]['findOne']({'where':{'id':_0x418ad0[_0xe0ce('0x47')]['id']}})['then'](handleEntityNotFound(_0xcd4b73,null))['then'](function(_0x54cf75){if(_0x54cf75){_0x32e901=_0x54cf75;_0x19a2cc[_0xe0ce('0x2f')]=_[_0xe0ce('0x32')](db[_0xe0ce('0x4d')][_0xe0ce('0x2c')]);_0x19a2cc[_0xe0ce('0x31')]=_[_0xe0ce('0x32')](_0x418ad0[_0xe0ce('0x31')]);_0x19a2cc[_0xe0ce('0x33')]=_[_0xe0ce('0x34')](_0x19a2cc[_0xe0ce('0x2f')],_0x19a2cc[_0xe0ce('0x31')]);_0xf9d102[_0xe0ce('0x35')]=_[_0xe0ce('0x34')](_0x19a2cc[_0xe0ce('0x2f')],qs['fields'](_0x418ad0[_0xe0ce('0x31')][_0xe0ce('0x36')]));_0xf9d102['attributes']=_0xf9d102[_0xe0ce('0x35')][_0xe0ce('0x37')]?_0xf9d102[_0xe0ce('0x35')]:_0x19a2cc[_0xe0ce('0x2f')];_0xf9d102[_0xe0ce('0x39')]=qs[_0xe0ce('0x3a')](_0x418ad0[_0xe0ce('0x31')][_0xe0ce('0x3a')]);_0xf9d102[_0xe0ce('0x3b')]=qs[_0xe0ce('0x33')](_[_0xe0ce('0x3c')](_0x418ad0[_0xe0ce('0x31')],_0x19a2cc[_0xe0ce('0x33')]));if(_0x418ad0[_0xe0ce('0x31')]['filter']){_0xf9d102[_0xe0ce('0x3b')]=_[_0xe0ce('0x3f')](_0xf9d102[_0xe0ce('0x3b')],{'$or':_['map'](_0xf9d102[_0xe0ce('0x35')],function(_0x2d1058){var _0x77693f={};_0x77693f[_0x2d1058]={'$like':'%'+_0x418ad0[_0xe0ce('0x31')][_0xe0ce('0x3d')]+'%'};return _0x77693f;})});}_0xf9d102=_[_0xe0ce('0x3f')]({},_0xf9d102,_0x418ad0[_0xe0ce('0x40')]);return _0x32e901[_0xe0ce('0x4f')](_0xf9d102);}})[_0xe0ce('0x45')](function(_0x4ebd75){if(_0x4ebd75){_0x38fa4f=_0x4ebd75[_0xe0ce('0x37')];if(!_0x418ad0[_0xe0ce('0x31')][_0xe0ce('0x4e')](_0xe0ce('0x38'))){_0xf9d102[_0xe0ce('0x1e')]=qs['limit'](_0x418ad0[_0xe0ce('0x31')]['limit']);_0xf9d102[_0xe0ce('0x1b')]=qs[_0xe0ce('0x1b')](_0x418ad0[_0xe0ce('0x31')][_0xe0ce('0x1b')]);}return _0x32e901[_0xe0ce('0x4f')](_0xf9d102);}})[_0xe0ce('0x45')](function(_0x1d29fd){if(_0x1d29fd){return _0x1d29fd?{'count':_0x38fa4f,'rows':_0x1d29fd}:null;}})[_0xe0ce('0x45')](respondWithResult(_0xcd4b73,null))[_0xe0ce('0x46')](handleError(_0xcd4b73,null));};exports[_0xe0ce('0x50')]=function(_0x42c146,_0x3ab847,_0x1772a7){var _0x424627={};var _0x39261e={};var _0x177803;var _0x20d8a0;return db['DeskConfiguration'][_0xe0ce('0x4c')]({'where':{'id':_0x42c146[_0xe0ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ab847,null))[_0xe0ce('0x45')](function(_0x3182f1){if(_0x3182f1){_0x177803=_0x3182f1;_0x39261e[_0xe0ce('0x2f')]=_[_0xe0ce('0x32')](db['DeskField']['rawAttributes']);_0x39261e[_0xe0ce('0x31')]=_[_0xe0ce('0x32')](_0x42c146[_0xe0ce('0x31')]);_0x39261e[_0xe0ce('0x33')]=_['intersection'](_0x39261e[_0xe0ce('0x2f')],_0x39261e['query']);_0x424627[_0xe0ce('0x35')]=_[_0xe0ce('0x34')](_0x39261e['model'],qs[_0xe0ce('0x36')](_0x42c146[_0xe0ce('0x31')]['fields']));_0x424627[_0xe0ce('0x35')]=_0x424627[_0xe0ce('0x35')][_0xe0ce('0x37')]?_0x424627[_0xe0ce('0x35')]:_0x39261e[_0xe0ce('0x2f')];_0x424627['order']=qs[_0xe0ce('0x3a')](_0x42c146[_0xe0ce('0x31')][_0xe0ce('0x3a')]);_0x424627[_0xe0ce('0x3b')]=qs[_0xe0ce('0x33')](_[_0xe0ce('0x3c')](_0x42c146['query'],_0x39261e[_0xe0ce('0x33')]));if(_0x42c146[_0xe0ce('0x31')][_0xe0ce('0x3d')]){_0x424627[_0xe0ce('0x3b')]=_[_0xe0ce('0x3f')](_0x424627[_0xe0ce('0x3b')],{'$or':_['map'](_0x424627['attributes'],function(_0x380042){var _0x56e1f3={};_0x56e1f3[_0x380042]={'$like':'%'+_0x42c146['query'][_0xe0ce('0x3d')]+'%'};return _0x56e1f3;})});}_0x424627=_[_0xe0ce('0x3f')]({},_0x424627,_0x42c146[_0xe0ce('0x40')]);return _0x177803['getDescriptions'](_0x424627);}})['then'](function(_0x147ee9){if(_0x147ee9){_0x20d8a0=_0x147ee9[_0xe0ce('0x37')];if(!_0x42c146[_0xe0ce('0x31')][_0xe0ce('0x4e')](_0xe0ce('0x38'))){_0x424627[_0xe0ce('0x1e')]=qs[_0xe0ce('0x1e')](_0x42c146[_0xe0ce('0x31')][_0xe0ce('0x1e')]);_0x424627[_0xe0ce('0x1b')]=qs[_0xe0ce('0x1b')](_0x42c146[_0xe0ce('0x31')][_0xe0ce('0x1b')]);}return _0x177803[_0xe0ce('0x50')](_0x424627);}})[_0xe0ce('0x45')](function(_0x41260b){if(_0x41260b){return _0x41260b?{'count':_0x20d8a0,'rows':_0x41260b}:null;}})[_0xe0ce('0x45')](respondWithResult(_0x3ab847,null))[_0xe0ce('0x46')](handleError(_0x3ab847,null));};exports[_0xe0ce('0x51')]=function(_0x58f218,_0x1256e0,_0x5715ea){var _0x5b6b30={};var _0x4c94da={};var _0x3e3cc2;var _0x31b036;return db[_0xe0ce('0x2b')][_0xe0ce('0x4c')]({'where':{'id':_0x58f218[_0xe0ce('0x47')]['id']}})[_0xe0ce('0x45')](handleEntityNotFound(_0x1256e0,null))[_0xe0ce('0x45')](function(_0x53e222){if(_0x53e222){_0x3e3cc2=_0x53e222;_0x4c94da[_0xe0ce('0x2f')]=_[_0xe0ce('0x32')](db['Tag'][_0xe0ce('0x2c')]);_0x4c94da[_0xe0ce('0x31')]=_[_0xe0ce('0x32')](_0x58f218['query']);_0x4c94da[_0xe0ce('0x33')]=_[_0xe0ce('0x34')](_0x4c94da['model'],_0x4c94da[_0xe0ce('0x31')]);_0x5b6b30[_0xe0ce('0x35')]=_[_0xe0ce('0x34')](_0x4c94da[_0xe0ce('0x2f')],qs[_0xe0ce('0x36')](_0x58f218['query'][_0xe0ce('0x36')]));_0x5b6b30[_0xe0ce('0x35')]=_0x5b6b30[_0xe0ce('0x35')][_0xe0ce('0x37')]?_0x5b6b30[_0xe0ce('0x35')]:_0x4c94da[_0xe0ce('0x2f')];_0x5b6b30[_0xe0ce('0x39')]=qs[_0xe0ce('0x3a')](_0x58f218[_0xe0ce('0x31')]['sort']);_0x5b6b30['where']=qs[_0xe0ce('0x33')](_['pick'](_0x58f218[_0xe0ce('0x31')],_0x4c94da[_0xe0ce('0x33')]));if(_0x58f218['query'][_0xe0ce('0x3d')]){_0x5b6b30[_0xe0ce('0x3b')]=_[_0xe0ce('0x3f')](_0x5b6b30[_0xe0ce('0x3b')],{'$or':_[_0xe0ce('0x2a')](_0x5b6b30['attributes'],function(_0x1f1915){var _0x1afba8={};_0x1afba8[_0x1f1915]={'$like':'%'+_0x58f218[_0xe0ce('0x31')]['filter']+'%'};return _0x1afba8;})});}_0x5b6b30=_[_0xe0ce('0x3f')]({},_0x5b6b30,_0x58f218['options']);return _0x3e3cc2[_0xe0ce('0x51')](_0x5b6b30);}})[_0xe0ce('0x45')](function(_0x40d131){if(_0x40d131){_0x31b036=_0x40d131[_0xe0ce('0x37')];if(!_0x58f218[_0xe0ce('0x31')][_0xe0ce('0x4e')](_0xe0ce('0x38'))){_0x5b6b30[_0xe0ce('0x1e')]=qs[_0xe0ce('0x1e')](_0x58f218[_0xe0ce('0x31')][_0xe0ce('0x1e')]);_0x5b6b30[_0xe0ce('0x1b')]=qs[_0xe0ce('0x1b')](_0x58f218['query']['offset']);}return _0x3e3cc2['getTags'](_0x5b6b30);}})[_0xe0ce('0x45')](function(_0x311c9d){if(_0x311c9d){return _0x311c9d?{'count':_0x31b036,'rows':_0x311c9d}:null;}})['then'](respondWithResult(_0x1256e0,null))[_0xe0ce('0x46')](handleError(_0x1256e0,null));};exports[_0xe0ce('0x52')]=function(_0x10ffc6,_0x4d5ade,_0x5e76b8){if(_0x10ffc6[_0xe0ce('0x4a')]['id']){delete _0x10ffc6[_0xe0ce('0x4a')]['id'];}return db[_0xe0ce('0x2b')]['findOne']({'where':{'id':_0x10ffc6[_0xe0ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d5ade,null))[_0xe0ce('0x45')](function(_0x4295bb){if(_0x4295bb){return _0x4295bb[_0xe0ce('0x52')](_0x10ffc6['body']['ids']||[]);}return null;})[_0xe0ce('0x45')](respondWithResult(_0x4d5ade,null))[_0xe0ce('0x46')](handleError(_0x4d5ade,null));}; \ No newline at end of file +var _0x92a0=['find','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','DeskConfiguration','include','show','params','includeAll','options','catch','create','body'];(function(_0x581d10,_0x15beba){var _0x3ab17f=function(_0x332e40){while(--_0x332e40){_0x581d10['push'](_0x581d10['shift']());}};_0x3ab17f(++_0x15beba);}(_0x92a0,0x151));var _0x092a=function(_0x149db1,_0x25f28b){_0x149db1=_0x149db1-0x0;var _0x2059a8=_0x92a0[_0x149db1];return _0x2059a8;};'use strict';var emlformat=require(_0x092a('0x0'));var rimraf=require(_0x092a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x092a('0x2'));var rp=require('request-promise');var moment=require(_0x092a('0x3'));var BPromise=require(_0x092a('0x4'));var Mustache=require(_0x092a('0x5'));var util=require(_0x092a('0x6'));var path=require(_0x092a('0x7'));var sox=require(_0x092a('0x8'));var csv=require(_0x092a('0x9'));var ejs=require(_0x092a('0xa'));var fs=require('fs');var fs_extra=require(_0x092a('0xb'));var _=require(_0x092a('0xc'));var squel=require(_0x092a('0xd'));var crypto=require(_0x092a('0xe'));var jsforce=require(_0x092a('0xf'));var deskjs=require(_0x092a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x092a('0x11'));var authService=require(_0x092a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x092a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x092a('0x14'))(_0x092a('0x15'));var utils=require(_0x092a('0x16'));var config=require(_0x092a('0x17'));var licenseUtil=require(_0x092a('0x18'));var db=require(_0x092a('0x19'))['db'];function respondWithStatusCode(_0x1eb640,_0x6f3b35){_0x6f3b35=_0x6f3b35||0xcc;return function(_0x51895b){if(_0x51895b){return _0x1eb640['sendStatus'](_0x6f3b35);}return _0x1eb640[_0x092a('0x1a')](_0x6f3b35)[_0x092a('0x1b')]();};}function respondWithResult(_0x5f3175,_0x419530){_0x419530=_0x419530||0xc8;return function(_0x1eaed6){if(_0x1eaed6){return _0x5f3175[_0x092a('0x1a')](_0x419530)['json'](_0x1eaed6);}};}function respondWithFilteredResult(_0x505dbc,_0x46d106){return function(_0x1e2a21){if(_0x1e2a21){var _0x2dc8f0=typeof _0x46d106[_0x092a('0x1c')]==='undefined'&&typeof _0x46d106[_0x092a('0x1d')]===_0x092a('0x1e');var _0x3b1766=_0x1e2a21[_0x092a('0x1f')];var _0x2f2c6e=_0x2dc8f0?0x0:_0x46d106[_0x092a('0x1c')];var _0x411fb6=_0x2dc8f0?_0x1e2a21[_0x092a('0x1f')]:_0x46d106[_0x092a('0x1c')]+_0x46d106[_0x092a('0x1d')];var _0x2aab4a;if(_0x411fb6>=_0x3b1766){_0x411fb6=_0x3b1766;_0x2aab4a=0xc8;}else{_0x2aab4a=0xce;}_0x505dbc['status'](_0x2aab4a);return _0x505dbc[_0x092a('0x20')](_0x092a('0x21'),_0x2f2c6e+'-'+_0x411fb6+'/'+_0x3b1766)[_0x092a('0x22')](_0x1e2a21);}return null;};}function patchUpdates(_0x55b9fd){return function(_0x247145){try{jsonpatch[_0x092a('0x23')](_0x247145,_0x55b9fd,!![]);}catch(_0x261877){return BPromise[_0x092a('0x24')](_0x261877);}return _0x247145['save']();};}function saveUpdates(_0x286aa2,_0x416ed4){return function(_0x2a8fc0){if(_0x2a8fc0){return _0x2a8fc0[_0x092a('0x25')](_0x286aa2)[_0x092a('0x26')](function(_0x5d563e){return _0x5d563e;});}return null;};}function removeEntity(_0x58331e,_0x3967fa){return function(_0x2183e){if(_0x2183e){return _0x2183e[_0x092a('0x27')]()[_0x092a('0x26')](function(){_0x58331e['status'](0xcc)[_0x092a('0x1b')]();});}};}function handleEntityNotFound(_0x4e4b77,_0x21d619){return function(_0x1be19b){if(!_0x1be19b){_0x4e4b77[_0x092a('0x28')](0x194);}return _0x1be19b;};}function handleError(_0x113411,_0x27792b){_0x27792b=_0x27792b||0x1f4;return function(_0x15c3b3){logger[_0x092a('0x29')](_0x15c3b3['stack']);if(_0x15c3b3[_0x092a('0x2a')]){delete _0x15c3b3[_0x092a('0x2a')];}_0x113411[_0x092a('0x1a')](_0x27792b)[_0x092a('0x2b')](_0x15c3b3);};}exports['index']=function(_0x2fe7d0,_0x447050){var _0x2ae412={},_0x3d9604={},_0x28a3c4={'count':0x0,'rows':[]};var _0x15943c=_[_0x092a('0x2c')](db['DeskConfiguration'][_0x092a('0x2d')],function(_0x1d3612){return{'name':_0x1d3612['fieldName'],'type':_0x1d3612['type'][_0x092a('0x2e')]};});_0x3d9604[_0x092a('0x2f')]=_[_0x092a('0x2c')](_0x15943c,_0x092a('0x2a'));_0x3d9604[_0x092a('0x30')]=_[_0x092a('0x31')](_0x2fe7d0[_0x092a('0x30')]);_0x3d9604[_0x092a('0x32')]=_[_0x092a('0x33')](_0x3d9604[_0x092a('0x2f')],_0x3d9604[_0x092a('0x30')]);_0x2ae412[_0x092a('0x34')]=_['intersection'](_0x3d9604[_0x092a('0x2f')],qs[_0x092a('0x35')](_0x2fe7d0['query']['fields']));_0x2ae412[_0x092a('0x34')]=_0x2ae412[_0x092a('0x34')][_0x092a('0x36')]?_0x2ae412[_0x092a('0x34')]:_0x3d9604[_0x092a('0x2f')];if(!_0x2fe7d0[_0x092a('0x30')][_0x092a('0x37')](_0x092a('0x38'))){_0x2ae412['limit']=qs[_0x092a('0x1d')](_0x2fe7d0[_0x092a('0x30')][_0x092a('0x1d')]);_0x2ae412[_0x092a('0x1c')]=qs[_0x092a('0x1c')](_0x2fe7d0[_0x092a('0x30')][_0x092a('0x1c')]);}_0x2ae412[_0x092a('0x39')]=qs[_0x092a('0x3a')](_0x2fe7d0[_0x092a('0x30')][_0x092a('0x3a')]);_0x2ae412['where']=qs[_0x092a('0x32')](_[_0x092a('0x3b')](_0x2fe7d0['query'],_0x3d9604[_0x092a('0x32')]),_0x15943c);if(_0x2fe7d0[_0x092a('0x30')]['filter']){_0x2ae412[_0x092a('0x3c')]=_[_0x092a('0x3d')](_0x2ae412['where'],{'$or':_[_0x092a('0x2c')](_0x15943c,function(_0x8328a0){if(_0x8328a0[_0x092a('0x3e')]!=='VIRTUAL'){var _0x533bb0={};_0x533bb0[_0x8328a0['name']]={'$like':'%'+_0x2fe7d0['query'][_0x092a('0x3f')]+'%'};return _0x533bb0;}})});}_0x2ae412=_['merge']({},_0x2ae412,_0x2fe7d0['options']);var _0x15b321={'where':_0x2ae412[_0x092a('0x3c')]};return db[_0x092a('0x40')][_0x092a('0x1f')](_0x15b321)[_0x092a('0x26')](function(_0x4143a6){_0x28a3c4['count']=_0x4143a6;if(_0x2fe7d0[_0x092a('0x30')]['includeAll']){_0x2ae412[_0x092a('0x41')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x2ae412);})['then'](function(_0x24e54a){_0x28a3c4['rows']=_0x24e54a;return _0x28a3c4;})[_0x092a('0x26')](respondWithFilteredResult(_0x447050,_0x2ae412))['catch'](handleError(_0x447050,null));};exports[_0x092a('0x42')]=function(_0x2d6400,_0x575a26){var _0x19bbed={'raw':![],'where':{'id':_0x2d6400[_0x092a('0x43')]['id']}},_0x1b5dad={};_0x1b5dad[_0x092a('0x2f')]=_['keys'](db[_0x092a('0x40')][_0x092a('0x2d')]);_0x1b5dad[_0x092a('0x30')]=_[_0x092a('0x31')](_0x2d6400['query']);_0x1b5dad[_0x092a('0x32')]=_[_0x092a('0x33')](_0x1b5dad[_0x092a('0x2f')],_0x1b5dad['query']);_0x19bbed[_0x092a('0x34')]=_['intersection'](_0x1b5dad['model'],qs[_0x092a('0x35')](_0x2d6400[_0x092a('0x30')][_0x092a('0x35')]));_0x19bbed[_0x092a('0x34')]=_0x19bbed[_0x092a('0x34')][_0x092a('0x36')]?_0x19bbed[_0x092a('0x34')]:_0x1b5dad[_0x092a('0x2f')];if(_0x2d6400[_0x092a('0x30')][_0x092a('0x44')]){_0x19bbed[_0x092a('0x41')]=[{'all':!![]}];}_0x19bbed=_[_0x092a('0x3d')]({},_0x19bbed,_0x2d6400[_0x092a('0x45')]);return db[_0x092a('0x40')]['find'](_0x19bbed)[_0x092a('0x26')](handleEntityNotFound(_0x575a26,null))[_0x092a('0x26')](respondWithResult(_0x575a26,null))[_0x092a('0x46')](handleError(_0x575a26,null));};exports[_0x092a('0x47')]=function(_0x39f885,_0x253cfe){return db[_0x092a('0x40')][_0x092a('0x47')](_0x39f885[_0x092a('0x48')],{})['then'](respondWithResult(_0x253cfe,0xc9))[_0x092a('0x46')](handleError(_0x253cfe,null));};exports[_0x092a('0x25')]=function(_0x2fcef2,_0x37015d){if(_0x2fcef2[_0x092a('0x48')]['id']){delete _0x2fcef2['body']['id'];}return db[_0x092a('0x40')][_0x092a('0x49')]({'where':{'id':_0x2fcef2['params']['id']}})['then'](handleEntityNotFound(_0x37015d,null))[_0x092a('0x26')](saveUpdates(_0x2fcef2[_0x092a('0x48')],null))[_0x092a('0x26')](respondWithResult(_0x37015d,null))[_0x092a('0x46')](handleError(_0x37015d,null));};exports['destroy']=function(_0x182c01,_0x243f90){return db[_0x092a('0x40')][_0x092a('0x49')]({'where':{'id':_0x182c01[_0x092a('0x43')]['id']}})[_0x092a('0x26')](handleEntityNotFound(_0x243f90,null))[_0x092a('0x26')](removeEntity(_0x243f90,null))[_0x092a('0x46')](handleError(_0x243f90,null));};exports[_0x092a('0x4a')]=function(_0x233d65,_0x39ed8a,_0x1a34f2){var _0x298269={};var _0xf87538={};var _0x5a7dd5;var _0x3de486;return db[_0x092a('0x40')]['findOne']({'where':{'id':_0x233d65[_0x092a('0x43')]['id']}})[_0x092a('0x26')](handleEntityNotFound(_0x39ed8a,null))[_0x092a('0x26')](function(_0x5099f1){if(_0x5099f1){_0x5a7dd5=_0x5099f1;_0xf87538[_0x092a('0x2f')]=_[_0x092a('0x31')](db[_0x092a('0x4b')][_0x092a('0x2d')]);_0xf87538[_0x092a('0x30')]=_['keys'](_0x233d65[_0x092a('0x30')]);_0xf87538['filters']=_[_0x092a('0x33')](_0xf87538['model'],_0xf87538['query']);_0x298269['attributes']=_[_0x092a('0x33')](_0xf87538[_0x092a('0x2f')],qs['fields'](_0x233d65[_0x092a('0x30')][_0x092a('0x35')]));_0x298269[_0x092a('0x34')]=_0x298269[_0x092a('0x34')][_0x092a('0x36')]?_0x298269[_0x092a('0x34')]:_0xf87538[_0x092a('0x2f')];_0x298269['order']=qs[_0x092a('0x3a')](_0x233d65[_0x092a('0x30')]['sort']);_0x298269['where']=qs[_0x092a('0x32')](_[_0x092a('0x3b')](_0x233d65[_0x092a('0x30')],_0xf87538[_0x092a('0x32')]));if(_0x233d65['query'][_0x092a('0x3f')]){_0x298269[_0x092a('0x3c')]=_['merge'](_0x298269[_0x092a('0x3c')],{'$or':_[_0x092a('0x2c')](_0x298269[_0x092a('0x34')],function(_0x20b07f){var _0x23b651={};_0x23b651[_0x20b07f]={'$like':'%'+_0x233d65[_0x092a('0x30')][_0x092a('0x3f')]+'%'};return _0x23b651;})});}_0x298269=_[_0x092a('0x3d')]({},_0x298269,_0x233d65['options']);return _0x5a7dd5[_0x092a('0x4a')](_0x298269);}})[_0x092a('0x26')](function(_0x58b759){if(_0x58b759){_0x3de486=_0x58b759['length'];if(!_0x233d65[_0x092a('0x30')][_0x092a('0x37')](_0x092a('0x38'))){_0x298269[_0x092a('0x1d')]=qs['limit'](_0x233d65[_0x092a('0x30')]['limit']);_0x298269['offset']=qs['offset'](_0x233d65['query'][_0x092a('0x1c')]);}return _0x5a7dd5[_0x092a('0x4a')](_0x298269);}})['then'](function(_0x160bc1){if(_0x160bc1){return _0x160bc1?{'count':_0x3de486,'rows':_0x160bc1}:null;}})[_0x092a('0x26')](respondWithResult(_0x39ed8a,null))[_0x092a('0x46')](handleError(_0x39ed8a,null));};exports[_0x092a('0x4c')]=function(_0xc8814f,_0x4af173,_0x355b10){var _0x6b69d9={};var _0x2d78d6={};var _0x83f012;var _0x2e901d;return db['DeskConfiguration'][_0x092a('0x4d')]({'where':{'id':_0xc8814f['params']['id']}})['then'](handleEntityNotFound(_0x4af173,null))[_0x092a('0x26')](function(_0x3a19b4){if(_0x3a19b4){_0x83f012=_0x3a19b4;_0x2d78d6[_0x092a('0x2f')]=_[_0x092a('0x31')](db['DeskField'][_0x092a('0x2d')]);_0x2d78d6[_0x092a('0x30')]=_['keys'](_0xc8814f[_0x092a('0x30')]);_0x2d78d6[_0x092a('0x32')]=_[_0x092a('0x33')](_0x2d78d6[_0x092a('0x2f')],_0x2d78d6[_0x092a('0x30')]);_0x6b69d9[_0x092a('0x34')]=_['intersection'](_0x2d78d6[_0x092a('0x2f')],qs[_0x092a('0x35')](_0xc8814f['query']['fields']));_0x6b69d9[_0x092a('0x34')]=_0x6b69d9[_0x092a('0x34')][_0x092a('0x36')]?_0x6b69d9[_0x092a('0x34')]:_0x2d78d6[_0x092a('0x2f')];_0x6b69d9[_0x092a('0x39')]=qs[_0x092a('0x3a')](_0xc8814f[_0x092a('0x30')][_0x092a('0x3a')]);_0x6b69d9[_0x092a('0x3c')]=qs[_0x092a('0x32')](_[_0x092a('0x3b')](_0xc8814f[_0x092a('0x30')],_0x2d78d6[_0x092a('0x32')]));if(_0xc8814f[_0x092a('0x30')]['filter']){_0x6b69d9[_0x092a('0x3c')]=_[_0x092a('0x3d')](_0x6b69d9[_0x092a('0x3c')],{'$or':_[_0x092a('0x2c')](_0x6b69d9[_0x092a('0x34')],function(_0x5e4ef7){var _0x357174={};_0x357174[_0x5e4ef7]={'$like':'%'+_0xc8814f['query'][_0x092a('0x3f')]+'%'};return _0x357174;})});}_0x6b69d9=_[_0x092a('0x3d')]({},_0x6b69d9,_0xc8814f[_0x092a('0x45')]);return _0x83f012[_0x092a('0x4c')](_0x6b69d9);}})['then'](function(_0x156ef7){if(_0x156ef7){_0x2e901d=_0x156ef7[_0x092a('0x36')];if(!_0xc8814f[_0x092a('0x30')][_0x092a('0x37')](_0x092a('0x38'))){_0x6b69d9[_0x092a('0x1d')]=qs['limit'](_0xc8814f[_0x092a('0x30')][_0x092a('0x1d')]);_0x6b69d9[_0x092a('0x1c')]=qs[_0x092a('0x1c')](_0xc8814f['query'][_0x092a('0x1c')]);}return _0x83f012[_0x092a('0x4c')](_0x6b69d9);}})[_0x092a('0x26')](function(_0x5dda98){if(_0x5dda98){return _0x5dda98?{'count':_0x2e901d,'rows':_0x5dda98}:null;}})[_0x092a('0x26')](respondWithResult(_0x4af173,null))[_0x092a('0x46')](handleError(_0x4af173,null));};exports['getDescriptions']=function(_0x4c808f,_0x55ef83,_0x5b445d){var _0x34f7e0={};var _0xc94a38={};var _0x15bb26;var _0xa5acd4;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4c808f[_0x092a('0x43')]['id']}})[_0x092a('0x26')](handleEntityNotFound(_0x55ef83,null))[_0x092a('0x26')](function(_0x4e6c35){if(_0x4e6c35){_0x15bb26=_0x4e6c35;_0xc94a38[_0x092a('0x2f')]=_[_0x092a('0x31')](db[_0x092a('0x4b')][_0x092a('0x2d')]);_0xc94a38[_0x092a('0x30')]=_[_0x092a('0x31')](_0x4c808f[_0x092a('0x30')]);_0xc94a38[_0x092a('0x32')]=_[_0x092a('0x33')](_0xc94a38[_0x092a('0x2f')],_0xc94a38[_0x092a('0x30')]);_0x34f7e0[_0x092a('0x34')]=_[_0x092a('0x33')](_0xc94a38[_0x092a('0x2f')],qs[_0x092a('0x35')](_0x4c808f[_0x092a('0x30')][_0x092a('0x35')]));_0x34f7e0[_0x092a('0x34')]=_0x34f7e0['attributes'][_0x092a('0x36')]?_0x34f7e0[_0x092a('0x34')]:_0xc94a38[_0x092a('0x2f')];_0x34f7e0['order']=qs['sort'](_0x4c808f[_0x092a('0x30')][_0x092a('0x3a')]);_0x34f7e0['where']=qs[_0x092a('0x32')](_[_0x092a('0x3b')](_0x4c808f[_0x092a('0x30')],_0xc94a38[_0x092a('0x32')]));if(_0x4c808f['query'][_0x092a('0x3f')]){_0x34f7e0[_0x092a('0x3c')]=_['merge'](_0x34f7e0['where'],{'$or':_[_0x092a('0x2c')](_0x34f7e0['attributes'],function(_0x229c14){var _0x3698f0={};_0x3698f0[_0x229c14]={'$like':'%'+_0x4c808f[_0x092a('0x30')][_0x092a('0x3f')]+'%'};return _0x3698f0;})});}_0x34f7e0=_['merge']({},_0x34f7e0,_0x4c808f[_0x092a('0x45')]);return _0x15bb26['getDescriptions'](_0x34f7e0);}})['then'](function(_0x10b0d5){if(_0x10b0d5){_0xa5acd4=_0x10b0d5['length'];if(!_0x4c808f[_0x092a('0x30')][_0x092a('0x37')](_0x092a('0x38'))){_0x34f7e0[_0x092a('0x1d')]=qs[_0x092a('0x1d')](_0x4c808f[_0x092a('0x30')][_0x092a('0x1d')]);_0x34f7e0[_0x092a('0x1c')]=qs[_0x092a('0x1c')](_0x4c808f[_0x092a('0x30')][_0x092a('0x1c')]);}return _0x15bb26[_0x092a('0x4e')](_0x34f7e0);}})[_0x092a('0x26')](function(_0x5b9d73){if(_0x5b9d73){return _0x5b9d73?{'count':_0xa5acd4,'rows':_0x5b9d73}:null;}})[_0x092a('0x26')](respondWithResult(_0x55ef83,null))[_0x092a('0x46')](handleError(_0x55ef83,null));};exports[_0x092a('0x4f')]=function(_0x4305eb,_0x28373f,_0x1b7e25){var _0x20fd7f={};var _0x20fbac={};var _0x11e6df;var _0x183821;return db[_0x092a('0x40')]['findOne']({'where':{'id':_0x4305eb[_0x092a('0x43')]['id']}})[_0x092a('0x26')](handleEntityNotFound(_0x28373f,null))[_0x092a('0x26')](function(_0x528d5e){if(_0x528d5e){_0x11e6df=_0x528d5e;_0x20fbac[_0x092a('0x2f')]=_[_0x092a('0x31')](db[_0x092a('0x50')][_0x092a('0x2d')]);_0x20fbac[_0x092a('0x30')]=_['keys'](_0x4305eb[_0x092a('0x30')]);_0x20fbac[_0x092a('0x32')]=_[_0x092a('0x33')](_0x20fbac['model'],_0x20fbac[_0x092a('0x30')]);_0x20fd7f['attributes']=_['intersection'](_0x20fbac[_0x092a('0x2f')],qs[_0x092a('0x35')](_0x4305eb['query'][_0x092a('0x35')]));_0x20fd7f[_0x092a('0x34')]=_0x20fd7f[_0x092a('0x34')][_0x092a('0x36')]?_0x20fd7f[_0x092a('0x34')]:_0x20fbac[_0x092a('0x2f')];_0x20fd7f['order']=qs[_0x092a('0x3a')](_0x4305eb[_0x092a('0x30')]['sort']);_0x20fd7f[_0x092a('0x3c')]=qs[_0x092a('0x32')](_[_0x092a('0x3b')](_0x4305eb[_0x092a('0x30')],_0x20fbac[_0x092a('0x32')]));if(_0x4305eb['query'][_0x092a('0x3f')]){_0x20fd7f[_0x092a('0x3c')]=_[_0x092a('0x3d')](_0x20fd7f[_0x092a('0x3c')],{'$or':_[_0x092a('0x2c')](_0x20fd7f[_0x092a('0x34')],function(_0x39fbf1){var _0x40556f={};_0x40556f[_0x39fbf1]={'$like':'%'+_0x4305eb[_0x092a('0x30')][_0x092a('0x3f')]+'%'};return _0x40556f;})});}_0x20fd7f=_[_0x092a('0x3d')]({},_0x20fd7f,_0x4305eb[_0x092a('0x45')]);return _0x11e6df[_0x092a('0x4f')](_0x20fd7f);}})[_0x092a('0x26')](function(_0x43da85){if(_0x43da85){_0x183821=_0x43da85['length'];if(!_0x4305eb['query']['hasOwnProperty'](_0x092a('0x38'))){_0x20fd7f[_0x092a('0x1d')]=qs[_0x092a('0x1d')](_0x4305eb['query'][_0x092a('0x1d')]);_0x20fd7f[_0x092a('0x1c')]=qs['offset'](_0x4305eb[_0x092a('0x30')]['offset']);}return _0x11e6df[_0x092a('0x4f')](_0x20fd7f);}})[_0x092a('0x26')](function(_0x2a1e33){if(_0x2a1e33){return _0x2a1e33?{'count':_0x183821,'rows':_0x2a1e33}:null;}})[_0x092a('0x26')](respondWithResult(_0x28373f,null))[_0x092a('0x46')](handleError(_0x28373f,null));};exports[_0x092a('0x51')]=function(_0x485b90,_0x349b8,_0x483438){if(_0x485b90['body']['id']){delete _0x485b90[_0x092a('0x48')]['id'];}return db['DeskConfiguration'][_0x092a('0x4d')]({'where':{'id':_0x485b90['params']['id']}})[_0x092a('0x26')](handleEntityNotFound(_0x349b8,null))['then'](function(_0x22c5dc){if(_0x22c5dc){return _0x22c5dc['setTags'](_0x485b90[_0x092a('0x48')]['ids']||[]);}return null;})[_0x092a('0x26')](respondWithResult(_0x349b8,null))[_0x092a('0x46')](handleError(_0x349b8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 78987ed..22c1402 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 _0x7a4a=['rimraf','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','util','moment','bluebird','request-promise','path'];(function(_0x406626,_0x10928e){var _0x4dc453=function(_0x35b495){while(--_0x35b495){_0x406626['push'](_0x406626['shift']());}};_0x4dc453(++_0x10928e);}(_0x7a4a,0x1c7));var _0xa7a4=function(_0x28d231,_0x55888a){_0x28d231=_0x28d231-0x0;var _0x3814c5=_0x7a4a[_0x28d231];return _0x3814c5;};'use strict';var _=require('lodash');var util=require(_0xa7a4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa7a4('0x1'));var BPromise=require(_0xa7a4('0x2'));var rp=require(_0xa7a4('0x3'));var fs=require('fs');var path=require(_0xa7a4('0x4'));var rimraf=require(_0xa7a4('0x5'));var config=require('../../config/environment');var attributes=require(_0xa7a4('0x6'));module['exports']=function(_0x458894,_0xd0b44e){return _0x458894[_0xa7a4('0x7')](_0xa7a4('0x8'),attributes,{'tableName':_0xa7a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc33e=['define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x962edb,_0x5dd356){var _0x359dcf=function(_0x978f40){while(--_0x978f40){_0x962edb['push'](_0x962edb['shift']());}};_0x359dcf(++_0x5dd356);}(_0xc33e,0x9e));var _0xec33=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc33e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xec33('0x0'));var util=require(_0xec33('0x1'));var logger=require(_0xec33('0x2'))(_0xec33('0x3'));var moment=require(_0xec33('0x4'));var BPromise=require(_0xec33('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec33('0x6'));var rimraf=require(_0xec33('0x7'));var config=require(_0xec33('0x8'));var attributes=require(_0xec33('0x9'));module[_0xec33('0xa')]=function(_0x2f2071,_0x50e51c){return _0x2f2071[_0xec33('0xb')]('DeskConfiguration',attributes,{'tableName':_0xec33('0xc'),'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 bc8651b..6be66cf 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 _0x56e7=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info'];(function(_0x284689,_0x55c246){var _0x22e03e=function(_0x5297e7){while(--_0x5297e7){_0x284689['push'](_0x284689['shift']());}};_0x22e03e(++_0x55c246);}(_0x56e7,0x93));var _0x756e=function(_0x4d4e7c,_0x1a8689){_0x4d4e7c=_0x4d4e7c-0x0;var _0x408125=_0x56e7[_0x4d4e7c];return _0x408125;};'use strict';var _=require(_0x756e('0x0'));var util=require(_0x756e('0x1'));var moment=require(_0x756e('0x2'));var BPromise=require(_0x756e('0x3'));var rs=require(_0x756e('0x4'));var fs=require('fs');var Redis=require(_0x756e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x756e('0x6'));var logger=require(_0x756e('0x7'))(_0x756e('0x8'));var config=require('../../config/environment');var jayson=require(_0x756e('0x9'));var client=jayson[_0x756e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53077b,_0x167f6,_0x2676c8){return new BPromise(function(_0x4fb27a,_0x516581){return client['request'](_0x53077b,_0x2676c8)[_0x756e('0xb')](function(_0x833ba7){logger[_0x756e('0xc')](_0x756e('0xd'),_0x167f6,_0x756e('0xe'));logger['debug'](_0x756e('0xf'),_0x167f6,'request\x20sent',JSON[_0x756e('0x10')](_0x833ba7));if(_0x833ba7[_0x756e('0x11')]){if(_0x833ba7[_0x756e('0x11')]['code']===0x1f4){logger[_0x756e('0x11')](_0x756e('0xd'),_0x167f6,_0x833ba7[_0x756e('0x11')]['message']);return _0x516581(_0x833ba7[_0x756e('0x11')][_0x756e('0x12')]);}logger[_0x756e('0x11')](_0x756e('0xd'),_0x167f6,_0x833ba7[_0x756e('0x11')][_0x756e('0x12')]);return _0x4fb27a(_0x833ba7['error'][_0x756e('0x12')]);}else{logger[_0x756e('0xc')](_0x756e('0xd'),_0x167f6,_0x756e('0xe'));_0x4fb27a(_0x833ba7[_0x756e('0x13')]['message']);}})['catch'](function(_0x5916aa){logger[_0x756e('0x11')](_0x756e('0xd'),_0x167f6,_0x5916aa);_0x516581(_0x5916aa);});});} \ No newline at end of file +var _0x3274=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3274,0x134));var _0x4327=function(_0x5c40d4,_0x22f627){_0x5c40d4=_0x5c40d4-0x0;var _0x1043b8=_0x3274[_0x5c40d4];return _0x1043b8;};'use strict';var _=require(_0x4327('0x0'));var util=require('util');var moment=require(_0x4327('0x1'));var BPromise=require(_0x4327('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4327('0x3'));var db=require(_0x4327('0x4'))['db'];var utils=require(_0x4327('0x5'));var logger=require(_0x4327('0x6'))(_0x4327('0x7'));var config=require(_0x4327('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4327('0x9')][_0x4327('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5377d4,_0x37c8fa,_0x22c50a){return new BPromise(function(_0x502e7f,_0x43b30b){return client[_0x4327('0xb')](_0x5377d4,_0x22c50a)['then'](function(_0x231e76){logger['info'](_0x4327('0xc'),_0x37c8fa,_0x4327('0xd'));logger['debug'](_0x4327('0xe'),_0x37c8fa,'request\x20sent',JSON[_0x4327('0xf')](_0x231e76));if(_0x231e76[_0x4327('0x10')]){if(_0x231e76[_0x4327('0x10')]['code']===0x1f4){logger[_0x4327('0x10')](_0x4327('0xc'),_0x37c8fa,_0x231e76[_0x4327('0x10')]['message']);return _0x43b30b(_0x231e76[_0x4327('0x10')][_0x4327('0x11')]);}logger[_0x4327('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x37c8fa,_0x231e76[_0x4327('0x10')][_0x4327('0x11')]);return _0x502e7f(_0x231e76[_0x4327('0x10')][_0x4327('0x11')]);}else{logger['info'](_0x4327('0xc'),_0x37c8fa,_0x4327('0xd'));_0x502e7f(_0x231e76[_0x4327('0x12')][_0x4327('0x11')]);}})[_0x4327('0x13')](function(_0xe86ae3){logger[_0x4327('0x10')](_0x4327('0xc'),_0x37c8fa,_0xe86ae3);_0x43b30b(_0xe86ae3);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3a7532a..7269f64 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 _0x4ff9=['exports','util','path','express','Router','fs-extra','./intDeskField.controller','get','isAuthenticated','/:id','create','update','delete','destroy'];(function(_0x56975f,_0x5405b2){var _0x514940=function(_0x3e6be6){while(--_0x3e6be6){_0x56975f['push'](_0x56975f['shift']());}};_0x514940(++_0x5405b2);}(_0x4ff9,0xe1));var _0x94ff=function(_0x174072,_0x15c8d0){_0x174072=_0x174072-0x0;var _0xbe3e5e=_0x4ff9[_0x174072];return _0xbe3e5e;};'use strict';var multer=require('multer');var util=require(_0x94ff('0x0'));var path=require(_0x94ff('0x1'));var timeout=require('connect-timeout');var express=require(_0x94ff('0x2'));var router=express[_0x94ff('0x3')]();var fs_extra=require(_0x94ff('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x94ff('0x5'));router[_0x94ff('0x6')]('/',auth[_0x94ff('0x7')](),controller['index']);router[_0x94ff('0x6')](_0x94ff('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x94ff('0x9')]);router['put'](_0x94ff('0x8'),auth[_0x94ff('0x7')](),controller[_0x94ff('0xa')]);router[_0x94ff('0xb')](_0x94ff('0x8'),auth[_0x94ff('0x7')](),controller[_0x94ff('0xc')]);module[_0x94ff('0xd')]=router; \ No newline at end of file +var _0x172c=['index','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller'];(function(_0x5f8276,_0x6d29d){var _0x32af6d=function(_0x1e76a8){while(--_0x1e76a8){_0x5f8276['push'](_0x5f8276['shift']());}};_0x32af6d(++_0x6d29d);}(_0x172c,0x1ad));var _0xc172=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x172c[_0x74892f];return _0x10ee61;};'use strict';var multer=require('multer');var util=require(_0xc172('0x0'));var path=require('path');var timeout=require(_0xc172('0x1'));var express=require(_0xc172('0x2'));var router=express[_0xc172('0x3')]();var fs_extra=require(_0xc172('0x4'));var auth=require(_0xc172('0x5'));var interaction=require(_0xc172('0x6'));var config=require('../../config/environment');var controller=require(_0xc172('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc172('0x8')]);router[_0xc172('0x9')](_0xc172('0xa'),auth[_0xc172('0xb')](),controller[_0xc172('0xc')]);router['post']('/',auth[_0xc172('0xb')](),controller[_0xc172('0xd')]);router[_0xc172('0xe')](_0xc172('0xa'),auth[_0xc172('0xb')](),controller[_0xc172('0xf')]);router[_0xc172('0x10')](_0xc172('0xa'),auth[_0xc172('0xb')](),controller[_0xc172('0x11')]);module[_0xc172('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2530719..fc6fac6 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 _0x517a=['string','STRING','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x517a,0x1c3));var _0xa517=function(_0x4c4293,_0x2ad119){_0x4c4293=_0x4c4293-0x0;var _0x4e2402=_0x517a[_0x4c4293];return _0x4e2402;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xa517('0x0'),_0xa517('0x1'),_0xa517('0x2'),_0xa517('0x3')),'defaultValue':_0xa517('0x4')},'content':{'type':Sequelize[_0xa517('0x5')]},'key':{'type':Sequelize[_0xa517('0x5')]},'keyType':{'type':Sequelize[_0xa517('0x6')](_0xa517('0x4'),_0xa517('0x0'),'customVariable')},'keyContent':{'type':Sequelize[_0xa517('0x5')]},'idField':{'type':Sequelize[_0xa517('0x5')]},'nameField':{'type':Sequelize[_0xa517('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa517('0x5')]}}; \ No newline at end of file +var _0xb328=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports'];(function(_0x1dfc13,_0x22b796){var _0x8c3391=function(_0x596496){while(--_0x596496){_0x1dfc13['push'](_0x1dfc13['shift']());}};_0x8c3391(++_0x22b796);}(_0xb328,0x1d3));var _0x8b32=function(_0x5d8e1e,_0x1f3603){_0x5d8e1e=_0x5d8e1e-0x0;var _0x21788b=_0xb328[_0x5d8e1e];return _0x21788b;};'use strict';var Sequelize=require('sequelize');module[_0x8b32('0x0')]={'type':{'type':Sequelize[_0x8b32('0x1')]('string',_0x8b32('0x2'),_0x8b32('0x3'),_0x8b32('0x4'),_0x8b32('0x5')),'defaultValue':_0x8b32('0x6')},'content':{'type':Sequelize[_0x8b32('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8b32('0x6'),_0x8b32('0x2'),_0x8b32('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8b32('0x7')]},'customField':{'type':Sequelize[_0x8b32('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b32('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 42b6542..f6edc62 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 _0x59f2=['limit','count','set','apply','then','destroy','sendStatus','error','name','send','map','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','undefined'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x59f2,0xb3));var _0x259f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x59f2[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x259f('0x0'));var rp=require('request-promise');var moment=require(_0x259f('0x1'));var BPromise=require(_0x259f('0x2'));var Mustache=require(_0x259f('0x3'));var util=require(_0x259f('0x4'));var path=require('path');var sox=require(_0x259f('0x5'));var csv=require(_0x259f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x259f('0x7'));var squel=require(_0x259f('0x8'));var crypto=require(_0x259f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x259f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x259f('0xb'));var Papa=require(_0x259f('0xc'));var Redis=require(_0x259f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x259f('0xe'));var as=require(_0x259f('0xf'));var hardwareService=require(_0x259f('0x10'));var logger=require('../../config/logger')(_0x259f('0x11'));var utils=require(_0x259f('0x12'));var config=require(_0x259f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314e55,_0x31a57f){_0x31a57f=_0x31a57f||0xcc;return function(_0x4d130f){if(_0x4d130f){return _0x314e55['sendStatus'](_0x31a57f);}return _0x314e55[_0x259f('0x14')](_0x31a57f)[_0x259f('0x15')]();};}function respondWithResult(_0x4007d9,_0xea5fa){_0xea5fa=_0xea5fa||0xc8;return function(_0x12a6ef){if(_0x12a6ef){return _0x4007d9[_0x259f('0x14')](_0xea5fa)[_0x259f('0x16')](_0x12a6ef);}};}function respondWithFilteredResult(_0x421c66,_0x4cb8a3){return function(_0x333c38){if(_0x333c38){var _0x447145=typeof _0x4cb8a3[_0x259f('0x17')]===_0x259f('0x18')&&typeof _0x4cb8a3[_0x259f('0x19')]===_0x259f('0x18');var _0x3303ca=_0x333c38[_0x259f('0x1a')];var _0x6daf07=_0x447145?0x0:_0x4cb8a3[_0x259f('0x17')];var _0x39e4ab=_0x447145?_0x333c38[_0x259f('0x1a')]:_0x4cb8a3['offset']+_0x4cb8a3[_0x259f('0x19')];var _0x4343b5;if(_0x39e4ab>=_0x3303ca){_0x39e4ab=_0x3303ca;_0x4343b5=0xc8;}else{_0x4343b5=0xce;}_0x421c66['status'](_0x4343b5);return _0x421c66[_0x259f('0x1b')]('Content-Range',_0x6daf07+'-'+_0x39e4ab+'/'+_0x3303ca)[_0x259f('0x16')](_0x333c38);}return null;};}function patchUpdates(_0x225d21){return function(_0x4d69c4){try{jsonpatch[_0x259f('0x1c')](_0x4d69c4,_0x225d21,!![]);}catch(_0x395a9e){return BPromise['reject'](_0x395a9e);}return _0x4d69c4['save']();};}function saveUpdates(_0x33b646,_0x3832b0){return function(_0x163d83){if(_0x163d83){return _0x163d83['update'](_0x33b646)[_0x259f('0x1d')](function(_0x55a58e){return _0x55a58e;});}return null;};}function removeEntity(_0xb78775,_0x55a9e0){return function(_0x42b578){if(_0x42b578){return _0x42b578[_0x259f('0x1e')]()[_0x259f('0x1d')](function(){_0xb78775[_0x259f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23079d,_0x4e3413){return function(_0x24de04){if(!_0x24de04){_0x23079d[_0x259f('0x1f')](0x194);}return _0x24de04;};}function handleError(_0x549d37,_0x47bf4b){_0x47bf4b=_0x47bf4b||0x1f4;return function(_0x208698){logger[_0x259f('0x20')](_0x208698['stack']);if(_0x208698[_0x259f('0x21')]){delete _0x208698[_0x259f('0x21')];}_0x549d37[_0x259f('0x14')](_0x47bf4b)[_0x259f('0x22')](_0x208698);};}exports['index']=function(_0x4c339b,_0x341635){var _0x47bf1e={},_0xc32493={},_0x14aef7={'count':0x0,'rows':[]};var _0x535b48=_[_0x259f('0x23')](db[_0x259f('0x24')][_0x259f('0x25')],function(_0x22ef0a){return{'name':_0x22ef0a[_0x259f('0x26')],'type':_0x22ef0a['type'][_0x259f('0x27')]};});_0xc32493[_0x259f('0x28')]=_[_0x259f('0x23')](_0x535b48,_0x259f('0x21'));_0xc32493[_0x259f('0x29')]=_[_0x259f('0x2a')](_0x4c339b[_0x259f('0x29')]);_0xc32493[_0x259f('0x2b')]=_[_0x259f('0x2c')](_0xc32493[_0x259f('0x28')],_0xc32493['query']);_0x47bf1e[_0x259f('0x2d')]=_[_0x259f('0x2c')](_0xc32493['model'],qs[_0x259f('0x2e')](_0x4c339b[_0x259f('0x29')][_0x259f('0x2e')]));_0x47bf1e[_0x259f('0x2d')]=_0x47bf1e[_0x259f('0x2d')][_0x259f('0x2f')]?_0x47bf1e[_0x259f('0x2d')]:_0xc32493[_0x259f('0x28')];if(!_0x4c339b[_0x259f('0x29')][_0x259f('0x30')](_0x259f('0x31'))){_0x47bf1e[_0x259f('0x19')]=qs[_0x259f('0x19')](_0x4c339b[_0x259f('0x29')][_0x259f('0x19')]);_0x47bf1e['offset']=qs[_0x259f('0x17')](_0x4c339b[_0x259f('0x29')][_0x259f('0x17')]);}_0x47bf1e[_0x259f('0x32')]=qs['sort'](_0x4c339b[_0x259f('0x29')][_0x259f('0x33')]);_0x47bf1e['where']=qs[_0x259f('0x2b')](_['pick'](_0x4c339b[_0x259f('0x29')],_0xc32493['filters']),_0x535b48);if(_0x4c339b['query']['filter']){_0x47bf1e[_0x259f('0x34')]=_['merge'](_0x47bf1e[_0x259f('0x34')],{'$or':_['map'](_0x535b48,function(_0x2732ea){if(_0x2732ea[_0x259f('0x35')]!==_0x259f('0x36')){var _0x1cd5c5={};_0x1cd5c5[_0x2732ea[_0x259f('0x21')]]={'$like':'%'+_0x4c339b[_0x259f('0x29')][_0x259f('0x37')]+'%'};return _0x1cd5c5;}})});}_0x47bf1e=_[_0x259f('0x38')]({},_0x47bf1e,_0x4c339b[_0x259f('0x39')]);var _0x122026={'where':_0x47bf1e[_0x259f('0x34')]};return db['DeskField']['count'](_0x122026)['then'](function(_0x3d402a){_0x14aef7[_0x259f('0x1a')]=_0x3d402a;if(_0x4c339b[_0x259f('0x29')][_0x259f('0x3a')]){_0x47bf1e[_0x259f('0x3b')]=[{'all':!![]}];}return db['DeskField'][_0x259f('0x3c')](_0x47bf1e);})[_0x259f('0x1d')](function(_0x5542a1){_0x14aef7[_0x259f('0x3d')]=_0x5542a1;return _0x14aef7;})[_0x259f('0x1d')](respondWithFilteredResult(_0x341635,_0x47bf1e))[_0x259f('0x3e')](handleError(_0x341635,null));};exports[_0x259f('0x3f')]=function(_0x4a01a8,_0xdc25a4){var _0x5ea1e3={'raw':!![],'where':{'id':_0x4a01a8['params']['id']}},_0x45774b={};_0x45774b[_0x259f('0x28')]=_['keys'](db[_0x259f('0x24')][_0x259f('0x25')]);_0x45774b[_0x259f('0x29')]=_[_0x259f('0x2a')](_0x4a01a8[_0x259f('0x29')]);_0x45774b[_0x259f('0x2b')]=_[_0x259f('0x2c')](_0x45774b['model'],_0x45774b[_0x259f('0x29')]);_0x5ea1e3[_0x259f('0x2d')]=_[_0x259f('0x2c')](_0x45774b[_0x259f('0x28')],qs[_0x259f('0x2e')](_0x4a01a8[_0x259f('0x29')]['fields']));_0x5ea1e3[_0x259f('0x2d')]=_0x5ea1e3[_0x259f('0x2d')][_0x259f('0x2f')]?_0x5ea1e3[_0x259f('0x2d')]:_0x45774b[_0x259f('0x28')];if(_0x4a01a8['query'][_0x259f('0x3a')]){_0x5ea1e3[_0x259f('0x3b')]=[{'all':!![]}];}_0x5ea1e3=_['merge']({},_0x5ea1e3,_0x4a01a8[_0x259f('0x39')]);return db[_0x259f('0x24')][_0x259f('0x40')](_0x5ea1e3)['then'](handleEntityNotFound(_0xdc25a4,null))[_0x259f('0x1d')](respondWithResult(_0xdc25a4,null))['catch'](handleError(_0xdc25a4,null));};exports['create']=function(_0xe4ff,_0x114461){return db[_0x259f('0x24')][_0x259f('0x41')](_0xe4ff[_0x259f('0x42')],{})['then'](respondWithResult(_0x114461,0xc9))[_0x259f('0x3e')](handleError(_0x114461,null));};exports['update']=function(_0x4f8446,_0x12bef4){if(_0x4f8446[_0x259f('0x42')]['id']){delete _0x4f8446[_0x259f('0x42')]['id'];}return db[_0x259f('0x24')][_0x259f('0x40')]({'where':{'id':_0x4f8446[_0x259f('0x43')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0x12bef4,null))[_0x259f('0x1d')](saveUpdates(_0x4f8446[_0x259f('0x42')],null))[_0x259f('0x1d')](respondWithResult(_0x12bef4,null))[_0x259f('0x3e')](handleError(_0x12bef4,null));};exports['destroy']=function(_0x111ba5,_0x521a42){return db['DeskField']['find']({'where':{'id':_0x111ba5[_0x259f('0x43')]['id']}})[_0x259f('0x1d')](handleEntityNotFound(_0x521a42,null))[_0x259f('0x1d')](removeEntity(_0x521a42,null))[_0x259f('0x3e')](handleError(_0x521a42,null));}; \ No newline at end of file +var _0xdc03=['key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','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','limit','set','Content-Range','apply','save','then','destroy','end','stack','name','index','DeskField','rawAttributes','type'];(function(_0x1ce6fc,_0x59b15f){var _0xf2358a=function(_0x45bfeb){while(--_0x45bfeb){_0x1ce6fc['push'](_0x1ce6fc['shift']());}};_0xf2358a(++_0x59b15f);}(_0xdc03,0x65));var _0x3dc0=function(_0x493260,_0x5b7d50){_0x493260=_0x493260-0x0;var _0x4b2724=_0xdc03[_0x493260];return _0x4b2724;};'use strict';var emlformat=require(_0x3dc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dc0('0x1'));var jsonpatch=require(_0x3dc0('0x2'));var rp=require('request-promise');var moment=require(_0x3dc0('0x3'));var BPromise=require(_0x3dc0('0x4'));var Mustache=require(_0x3dc0('0x5'));var util=require(_0x3dc0('0x6'));var path=require(_0x3dc0('0x7'));var sox=require(_0x3dc0('0x8'));var csv=require('to-csv');var ejs=require(_0x3dc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3dc0('0xa'));var _=require(_0x3dc0('0xb'));var squel=require('squel');var crypto=require(_0x3dc0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3dc0('0xd'));var Papa=require(_0x3dc0('0xe'));var Redis=require(_0x3dc0('0xf'));var authService=require(_0x3dc0('0x10'));var qs=require(_0x3dc0('0x11'));var as=require(_0x3dc0('0x12'));var hardwareService=require(_0x3dc0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3dc0('0x14'));var config=require(_0x3dc0('0x15'));var licenseUtil=require(_0x3dc0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9e01,_0x9ddaff){_0x9ddaff=_0x9ddaff||0xcc;return function(_0x4938d1){if(_0x4938d1){return _0x5e9e01[_0x3dc0('0x17')](_0x9ddaff);}return _0x5e9e01['status'](_0x9ddaff)['end']();};}function respondWithResult(_0x297de8,_0x40b361){_0x40b361=_0x40b361||0xc8;return function(_0x1d250c){if(_0x1d250c){return _0x297de8[_0x3dc0('0x18')](_0x40b361)[_0x3dc0('0x19')](_0x1d250c);}};}function respondWithFilteredResult(_0x309423,_0x1c9d01){return function(_0x21d8f7){if(_0x21d8f7){var _0x4e449a=typeof _0x1c9d01[_0x3dc0('0x1a')]===_0x3dc0('0x1b')&&typeof _0x1c9d01['limit']===_0x3dc0('0x1b');var _0xd5b9f1=_0x21d8f7[_0x3dc0('0x1c')];var _0x5d45ee=_0x4e449a?0x0:_0x1c9d01[_0x3dc0('0x1a')];var _0x2e7771=_0x4e449a?_0x21d8f7[_0x3dc0('0x1c')]:_0x1c9d01['offset']+_0x1c9d01[_0x3dc0('0x1d')];var _0x3776f4;if(_0x2e7771>=_0xd5b9f1){_0x2e7771=_0xd5b9f1;_0x3776f4=0xc8;}else{_0x3776f4=0xce;}_0x309423[_0x3dc0('0x18')](_0x3776f4);return _0x309423[_0x3dc0('0x1e')](_0x3dc0('0x1f'),_0x5d45ee+'-'+_0x2e7771+'/'+_0xd5b9f1)[_0x3dc0('0x19')](_0x21d8f7);}return null;};}function patchUpdates(_0x379fff){return function(_0x257696){try{jsonpatch[_0x3dc0('0x20')](_0x257696,_0x379fff,!![]);}catch(_0xbef495){return BPromise['reject'](_0xbef495);}return _0x257696[_0x3dc0('0x21')]();};}function saveUpdates(_0x1927a0,_0x273ea2){return function(_0x5ee6b3){if(_0x5ee6b3){return _0x5ee6b3['update'](_0x1927a0)[_0x3dc0('0x22')](function(_0x3843bb){return _0x3843bb;});}return null;};}function removeEntity(_0x32f3a2,_0x410f96){return function(_0x503332){if(_0x503332){return _0x503332[_0x3dc0('0x23')]()['then'](function(){_0x32f3a2['status'](0xcc)[_0x3dc0('0x24')]();});}};}function handleEntityNotFound(_0x25b492,_0x3db379){return function(_0x346d17){if(!_0x346d17){_0x25b492[_0x3dc0('0x17')](0x194);}return _0x346d17;};}function handleError(_0x59f083,_0x51e7d7){_0x51e7d7=_0x51e7d7||0x1f4;return function(_0x105e55){logger['error'](_0x105e55[_0x3dc0('0x25')]);if(_0x105e55[_0x3dc0('0x26')]){delete _0x105e55['name'];}_0x59f083[_0x3dc0('0x18')](_0x51e7d7)['send'](_0x105e55);};}exports[_0x3dc0('0x27')]=function(_0xf1f3e6,_0x59593c){var _0x4c9486={},_0x2e6bbf={},_0x527252={'count':0x0,'rows':[]};var _0x58add0=_['map'](db[_0x3dc0('0x28')][_0x3dc0('0x29')],function(_0x195560){return{'name':_0x195560['fieldName'],'type':_0x195560[_0x3dc0('0x2a')][_0x3dc0('0x2b')]};});_0x2e6bbf[_0x3dc0('0x2c')]=_['map'](_0x58add0,_0x3dc0('0x26'));_0x2e6bbf['query']=_[_0x3dc0('0x2d')](_0xf1f3e6[_0x3dc0('0x2e')]);_0x2e6bbf[_0x3dc0('0x2f')]=_[_0x3dc0('0x30')](_0x2e6bbf[_0x3dc0('0x2c')],_0x2e6bbf['query']);_0x4c9486['attributes']=_[_0x3dc0('0x30')](_0x2e6bbf[_0x3dc0('0x2c')],qs[_0x3dc0('0x31')](_0xf1f3e6[_0x3dc0('0x2e')][_0x3dc0('0x31')]));_0x4c9486[_0x3dc0('0x32')]=_0x4c9486['attributes']['length']?_0x4c9486['attributes']:_0x2e6bbf[_0x3dc0('0x2c')];if(!_0xf1f3e6[_0x3dc0('0x2e')][_0x3dc0('0x33')]('nolimit')){_0x4c9486['limit']=qs[_0x3dc0('0x1d')](_0xf1f3e6[_0x3dc0('0x2e')][_0x3dc0('0x1d')]);_0x4c9486['offset']=qs[_0x3dc0('0x1a')](_0xf1f3e6[_0x3dc0('0x2e')][_0x3dc0('0x1a')]);}_0x4c9486['order']=qs[_0x3dc0('0x34')](_0xf1f3e6[_0x3dc0('0x2e')][_0x3dc0('0x34')]);_0x4c9486[_0x3dc0('0x35')]=qs[_0x3dc0('0x2f')](_[_0x3dc0('0x36')](_0xf1f3e6[_0x3dc0('0x2e')],_0x2e6bbf['filters']),_0x58add0);if(_0xf1f3e6[_0x3dc0('0x2e')]['filter']){_0x4c9486[_0x3dc0('0x35')]=_[_0x3dc0('0x37')](_0x4c9486[_0x3dc0('0x35')],{'$or':_[_0x3dc0('0x38')](_0x58add0,function(_0xdee816){if(_0xdee816[_0x3dc0('0x2a')]!==_0x3dc0('0x39')){var _0x4eb5e9={};_0x4eb5e9[_0xdee816['name']]={'$like':'%'+_0xf1f3e6['query'][_0x3dc0('0x3a')]+'%'};return _0x4eb5e9;}})});}_0x4c9486=_[_0x3dc0('0x37')]({},_0x4c9486,_0xf1f3e6[_0x3dc0('0x3b')]);var _0x4ca01f={'where':_0x4c9486[_0x3dc0('0x35')]};return db['DeskField'][_0x3dc0('0x1c')](_0x4ca01f)[_0x3dc0('0x22')](function(_0xb25903){_0x527252['count']=_0xb25903;if(_0xf1f3e6[_0x3dc0('0x2e')][_0x3dc0('0x3c')]){_0x4c9486[_0x3dc0('0x3d')]=[{'all':!![]}];}return db[_0x3dc0('0x28')][_0x3dc0('0x3e')](_0x4c9486);})['then'](function(_0x8c4b14){_0x527252[_0x3dc0('0x3f')]=_0x8c4b14;return _0x527252;})[_0x3dc0('0x22')](respondWithFilteredResult(_0x59593c,_0x4c9486))['catch'](handleError(_0x59593c,null));};exports[_0x3dc0('0x40')]=function(_0x4c5e13,_0x3881b2){var _0x164749={'raw':!![],'where':{'id':_0x4c5e13[_0x3dc0('0x41')]['id']}},_0x2715f8={};_0x2715f8[_0x3dc0('0x2c')]=_[_0x3dc0('0x2d')](db['DeskField'][_0x3dc0('0x29')]);_0x2715f8['query']=_[_0x3dc0('0x2d')](_0x4c5e13[_0x3dc0('0x2e')]);_0x2715f8[_0x3dc0('0x2f')]=_['intersection'](_0x2715f8[_0x3dc0('0x2c')],_0x2715f8[_0x3dc0('0x2e')]);_0x164749[_0x3dc0('0x32')]=_[_0x3dc0('0x30')](_0x2715f8[_0x3dc0('0x2c')],qs[_0x3dc0('0x31')](_0x4c5e13[_0x3dc0('0x2e')]['fields']));_0x164749[_0x3dc0('0x32')]=_0x164749[_0x3dc0('0x32')][_0x3dc0('0x42')]?_0x164749[_0x3dc0('0x32')]:_0x2715f8[_0x3dc0('0x2c')];if(_0x4c5e13['query'][_0x3dc0('0x3c')]){_0x164749[_0x3dc0('0x3d')]=[{'all':!![]}];}_0x164749=_[_0x3dc0('0x37')]({},_0x164749,_0x4c5e13[_0x3dc0('0x3b')]);return db['DeskField'][_0x3dc0('0x43')](_0x164749)[_0x3dc0('0x22')](handleEntityNotFound(_0x3881b2,null))[_0x3dc0('0x22')](respondWithResult(_0x3881b2,null))[_0x3dc0('0x44')](handleError(_0x3881b2,null));};exports[_0x3dc0('0x45')]=function(_0x3d9e5d,_0x495a0b){return db['DeskField'][_0x3dc0('0x45')](_0x3d9e5d['body'],{})[_0x3dc0('0x22')](respondWithResult(_0x495a0b,0xc9))[_0x3dc0('0x44')](handleError(_0x495a0b,null));};exports[_0x3dc0('0x46')]=function(_0x3829b1,_0x1b84e6){if(_0x3829b1[_0x3dc0('0x47')]['id']){delete _0x3829b1[_0x3dc0('0x47')]['id'];}return db[_0x3dc0('0x28')][_0x3dc0('0x43')]({'where':{'id':_0x3829b1[_0x3dc0('0x41')]['id']}})[_0x3dc0('0x22')](handleEntityNotFound(_0x1b84e6,null))[_0x3dc0('0x22')](saveUpdates(_0x3829b1[_0x3dc0('0x47')],null))[_0x3dc0('0x22')](respondWithResult(_0x1b84e6,null))[_0x3dc0('0x44')](handleError(_0x1b84e6,null));};exports[_0x3dc0('0x23')]=function(_0x2897c7,_0x25c205){return db[_0x3dc0('0x28')]['find']({'where':{'id':_0x2897c7['params']['id']}})[_0x3dc0('0x22')](handleEntityNotFound(_0x25c205,null))[_0x3dc0('0x22')](removeEntity(_0x25c205,null))[_0x3dc0('0x44')](handleError(_0x25c205,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4a55f70..2af276f 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 _0x446a=['desk_unique_index','idField','FieldId','util','api','moment','bluebird','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x446a,0x1d7));var _0xa446=function(_0x10c94c,_0x60aa4b){_0x10c94c=_0x10c94c-0x0;var _0x10d2ca=_0x446a[_0x10c94c];return _0x10d2ca;};'use strict';var _=require('lodash');var util=require(_0xa446('0x0'));var logger=require('../../config/logger')(_0xa446('0x1'));var moment=require(_0xa446('0x2'));var BPromise=require(_0xa446('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa446('0x4'));var attributes=require(_0xa446('0x5'));module[_0xa446('0x6')]=function(_0xbd8a3f,_0x1a3747){return _0xbd8a3f[_0xa446('0x7')](_0xa446('0x8'),attributes,{'tableName':_0xa446('0x9'),'paranoid':![],'indexes':[{'name':_0xa446('0xa'),'fields':[_0xa446('0xb'),_0xa446('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x039b=['path','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2fac7c,_0xe127cb){var _0x240e1e=function(_0xca46cb){while(--_0xca46cb){_0x2fac7c['push'](_0x2fac7c['shift']());}};_0x240e1e(++_0xe127cb);}(_0x039b,0x1e4));var _0xb039=function(_0x2486eb,_0x737b04){_0x2486eb=_0x2486eb-0x0;var _0x1f3c21=_0x039b[_0x2486eb];return _0x1f3c21;};'use strict';var _=require('lodash');var util=require(_0xb039('0x0'));var logger=require(_0xb039('0x1'))(_0xb039('0x2'));var moment=require(_0xb039('0x3'));var BPromise=require(_0xb039('0x4'));var rp=require(_0xb039('0x5'));var fs=require('fs');var path=require(_0xb039('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb039('0x7'));module[_0xb039('0x8')]=function(_0x44f457,_0x13c24a){return _0x44f457['define'](_0xb039('0x9'),attributes,{'tableName':_0xb039('0xa'),'paranoid':![],'indexes':[{'name':_0xb039('0xb'),'fields':[_0xb039('0xc'),_0xb039('0xd')],'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 f424553..8675c0d 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 _0x31dc=['catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x33e61d,_0x182628){var _0x185b31=function(_0x32ce31){while(--_0x32ce31){_0x33e61d['push'](_0x33e61d['shift']());}};_0x185b31(++_0x182628);}(_0x31dc,0x6f));var _0xc31d=function(_0x3ebaed,_0xb704a9){_0x3ebaed=_0x3ebaed-0x0;var _0x421e07=_0x31dc[_0x3ebaed];return _0x421e07;};'use strict';var _=require('lodash');var util=require(_0xc31d('0x0'));var moment=require(_0xc31d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc31d('0x2'));var db=require(_0xc31d('0x3'))['db'];var utils=require(_0xc31d('0x4'));var logger=require('../../config/logger')(_0xc31d('0x5'));var config=require(_0xc31d('0x6'));var jayson=require(_0xc31d('0x7'));var client=jayson[_0xc31d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b27fd,_0xe90f0e,_0x2efee0){return new BPromise(function(_0x218d1d,_0x53817b){return client[_0xc31d('0x9')](_0x1b27fd,_0x2efee0)[_0xc31d('0xa')](function(_0x5136be){logger[_0xc31d('0xb')](_0xc31d('0xc'),_0xe90f0e,'request\x20sent');logger[_0xc31d('0xd')](_0xc31d('0xe'),_0xe90f0e,_0xc31d('0xf'),JSON[_0xc31d('0x10')](_0x5136be));if(_0x5136be['error']){if(_0x5136be[_0xc31d('0x11')][_0xc31d('0x12')]===0x1f4){logger['error'](_0xc31d('0xc'),_0xe90f0e,_0x5136be[_0xc31d('0x11')][_0xc31d('0x13')]);return _0x53817b(_0x5136be[_0xc31d('0x11')]['message']);}logger[_0xc31d('0x11')]('DeskField,\x20%s,\x20%s',_0xe90f0e,_0x5136be[_0xc31d('0x11')][_0xc31d('0x13')]);return _0x218d1d(_0x5136be['error'][_0xc31d('0x13')]);}else{logger[_0xc31d('0xb')](_0xc31d('0xc'),_0xe90f0e,_0xc31d('0xf'));_0x218d1d(_0x5136be[_0xc31d('0x14')][_0xc31d('0x13')]);}})[_0xc31d('0x15')](function(_0xbb3705){logger[_0xc31d('0x11')](_0xc31d('0xc'),_0xe90f0e,_0xbb3705);_0x53817b(_0xbb3705);});});} \ No newline at end of file +var _0xff7f=['DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x5d5de8,_0x1e7f83){var _0x1cb7ac=function(_0x2b9dc5){while(--_0x2b9dc5){_0x5d5de8['push'](_0x5d5de8['shift']());}};_0x1cb7ac(++_0x1e7f83);}(_0xff7f,0x125));var _0xfff7=function(_0x2ae31a,_0x478c53){_0x2ae31a=_0x2ae31a-0x0;var _0x7c4dc4=_0xff7f[_0x2ae31a];return _0x7c4dc4;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfff7('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfff7('0x1'));var db=require(_0xfff7('0x2'))['db'];var utils=require(_0xfff7('0x3'));var logger=require(_0xfff7('0x4'))(_0xfff7('0x5'));var config=require(_0xfff7('0x6'));var jayson=require(_0xfff7('0x7'));var client=jayson['client'][_0xfff7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdf9eb9,_0x34392d,_0x182002){return new BPromise(function(_0x399069,_0x3700b1){return client[_0xfff7('0x9')](_0xdf9eb9,_0x182002)['then'](function(_0x4993e8){logger[_0xfff7('0xa')](_0xfff7('0xb'),_0x34392d,_0xfff7('0xc'));logger['debug'](_0xfff7('0xd'),_0x34392d,_0xfff7('0xc'),JSON['stringify'](_0x4993e8));if(_0x4993e8[_0xfff7('0xe')]){if(_0x4993e8['error'][_0xfff7('0xf')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x34392d,_0x4993e8[_0xfff7('0xe')][_0xfff7('0x10')]);return _0x3700b1(_0x4993e8[_0xfff7('0xe')][_0xfff7('0x10')]);}logger['error'](_0xfff7('0xb'),_0x34392d,_0x4993e8[_0xfff7('0xe')][_0xfff7('0x10')]);return _0x399069(_0x4993e8[_0xfff7('0xe')][_0xfff7('0x10')]);}else{logger[_0xfff7('0xa')](_0xfff7('0xb'),_0x34392d,_0xfff7('0xc'));_0x399069(_0x4993e8[_0xfff7('0x11')][_0xfff7('0x10')]);}})[_0xfff7('0x12')](function(_0x4e46a9){logger[_0xfff7('0xe')](_0xfff7('0xb'),_0x34392d,_0x4e46a9);_0x3700b1(_0x4e46a9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4e5dc37..0a422f2 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 _0x016b=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x4ae487,_0x452e02){var _0x336358=function(_0x21ba83){while(--_0x21ba83){_0x4ae487['push'](_0x4ae487['shift']());}};_0x336358(++_0x452e02);}(_0x016b,0xbf));var _0xb016=function(_0x2b757f,_0x4b8c91){_0x2b757f=_0x2b757f-0x0;var _0x1ee53d=_0x016b[_0x2b757f];return _0x1ee53d;};'use strict';var multer=require(_0xb016('0x0'));var util=require(_0xb016('0x1'));var path=require(_0xb016('0x2'));var timeout=require('connect-timeout');var express=require(_0xb016('0x3'));var router=express[_0xb016('0x4')]();var fs_extra=require(_0xb016('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb016('0x6'));var config=require(_0xb016('0x7'));var controller=require(_0xb016('0x8'));router[_0xb016('0x9')]('/',auth[_0xb016('0xa')](),controller['index']);router['get'](_0xb016('0xb'),auth['isAuthenticated'](),controller[_0xb016('0xc')]);router[_0xb016('0x9')](_0xb016('0xd'),auth[_0xb016('0xa')](),controller[_0xb016('0xe')]);router[_0xb016('0x9')](_0xb016('0xf'),auth['isAuthenticated'](),controller[_0xb016('0x10')]);router['post']('/',auth[_0xb016('0xa')](),controller[_0xb016('0x11')]);router[_0xb016('0x12')](_0xb016('0xd'),auth['isAuthenticated'](),controller[_0xb016('0x13')]);router[_0xb016('0x14')](_0xb016('0xb'),auth[_0xb016('0xa')](),controller[_0xb016('0x15')]);router[_0xb016('0x16')](_0xb016('0xb'),auth['isAuthenticated'](),controller[_0xb016('0x17')]);module[_0xb016('0x18')]=router; \ No newline at end of file +var _0x93eb=['create','/:id/configurations','addConfiguration','put','update','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post'];(function(_0x12d6e0,_0x2b8b6b){var _0x62360c=function(_0x226a56){while(--_0x226a56){_0x12d6e0['push'](_0x12d6e0['shift']());}};_0x62360c(++_0x2b8b6b);}(_0x93eb,0x6b));var _0xb93e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x93eb[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb93e('0x0'));var timeout=require(_0xb93e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb93e('0x2'));var auth=require(_0xb93e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb93e('0x4'));var controller=require(_0xb93e('0x5'));router[_0xb93e('0x6')]('/',auth[_0xb93e('0x7')](),controller['index']);router[_0xb93e('0x6')](_0xb93e('0x8'),auth[_0xb93e('0x7')](),controller[_0xb93e('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb93e('0x6')](_0xb93e('0xa'),auth[_0xb93e('0x7')](),controller[_0xb93e('0xb')]);router[_0xb93e('0xc')]('/',auth[_0xb93e('0x7')](),controller[_0xb93e('0xd')]);router[_0xb93e('0xc')](_0xb93e('0xe'),auth[_0xb93e('0x7')](),controller[_0xb93e('0xf')]);router[_0xb93e('0x10')](_0xb93e('0x8'),auth[_0xb93e('0x7')](),controller[_0xb93e('0x11')]);router[_0xb93e('0x12')](_0xb93e('0x8'),auth['isAuthenticated'](),controller[_0xb93e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d0ce388..434ca68 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 _0xb45e=['exports','STRING','sequelize'];(function(_0x59b01a,_0x362d1a){var _0x1722d5=function(_0x162bc0){while(--_0x162bc0){_0x59b01a['push'](_0x59b01a['shift']());}};_0x1722d5(++_0x362d1a);}(_0xb45e,0xe6));var _0xeb45=function(_0x41333d,_0x423c8d){_0x41333d=_0x41333d-0x0;var _0x261369=_0xb45e[_0x41333d];return _0x261369;};'use strict';var Sequelize=require(_0xeb45('0x0'));module[_0xeb45('0x1')]={'name':{'type':Sequelize[_0xeb45('0x2')]},'username':{'type':Sequelize[_0xeb45('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xeb45('0x2')]},'tenantId':{'type':Sequelize[_0xeb45('0x2')]},'clientId':{'type':Sequelize[_0xeb45('0x2')]},'clientSecret':{'type':Sequelize[_0xeb45('0x2')]},'serverUrl':{'type':Sequelize[_0xeb45('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeb45('0x2')]}}; \ No newline at end of file +var _0x22ef=['exports','STRING'];(function(_0x5cca36,_0x343481){var _0x412b3b=function(_0x51fd7d){while(--_0x51fd7d){_0x5cca36['push'](_0x5cca36['shift']());}};_0x412b3b(++_0x343481);}(_0x22ef,0x9c));var _0xf22e=function(_0xc7ad31,_0x311878){_0xc7ad31=_0xc7ad31-0x0;var _0x21806=_0x22ef[_0xc7ad31];return _0x21806;};'use strict';var Sequelize=require('sequelize');module[_0xf22e('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf22e('0x1')]},'password':{'type':Sequelize[_0xf22e('0x1')]},'remoteUri':{'type':Sequelize[_0xf22e('0x1')]},'tenantId':{'type':Sequelize[_0xf22e('0x1')]},'clientId':{'type':Sequelize[_0xf22e('0x1')]},'clientSecret':{'type':Sequelize[_0xf22e('0x1')]},'serverUrl':{'type':Sequelize[_0xf22e('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 0b014db..634de35 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 _0xaf5a=['regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statecode','statuscode','subjectidname','traversedpath','utcconversiontimezonecode','versionnumber','username','remoteUri','clientId','clientSecret','slice','substring','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','password','access_token','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','?$select=DisplayName,LogicalName','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber'];(function(_0x5e0407,_0x384843){var _0x10a4b8=function(_0x5b2f32){while(--_0x5b2f32){_0x5e0407['push'](_0x5e0407['shift']());}};_0x10a4b8(++_0x384843);}(_0xaf5a,0x144));var _0xaaf5=function(_0x8cb470,_0x2b9757){_0x8cb470=_0x8cb470-0x0;var _0x2ca139=_0xaf5a[_0x8cb470];return _0x2ca139;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaaf5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaaf5('0x1'));var rp=require(_0xaaf5('0x2'));var moment=require(_0xaaf5('0x3'));var BPromise=require(_0xaaf5('0x4'));var Mustache=require(_0xaaf5('0x5'));var util=require(_0xaaf5('0x6'));var path=require(_0xaaf5('0x7'));var sox=require(_0xaaf5('0x8'));var csv=require('to-csv');var ejs=require(_0xaaf5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaaf5('0xa'));var squel=require(_0xaaf5('0xb'));var crypto=require(_0xaaf5('0xc'));var jsforce=require(_0xaaf5('0xd'));var deskjs=require(_0xaaf5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaaf5('0xf'));var Papa=require(_0xaaf5('0x10'));var Redis=require(_0xaaf5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaaf5('0x12'));var as=require(_0xaaf5('0x13'));var hardwareService=require(_0xaaf5('0x14'));var logger=require(_0xaaf5('0x15'))(_0xaaf5('0x16'));var utils=require(_0xaaf5('0x17'));var config=require(_0xaaf5('0x18'));var licenseUtil=require(_0xaaf5('0x19'));var db=require(_0xaaf5('0x1a'))['db'];var integrations=require(_0xaaf5('0x1b'));function respondWithStatusCode(_0x55794e,_0x200236){_0x200236=_0x200236||0xcc;return function(_0x268051){if(_0x268051){return _0x55794e[_0xaaf5('0x1c')](_0x200236);}return _0x55794e[_0xaaf5('0x1d')](_0x200236)[_0xaaf5('0x1e')]();};}function respondWithResult(_0x33647b,_0x39bf16){_0x39bf16=_0x39bf16||0xc8;return function(_0x2e45ad){if(_0x2e45ad){return _0x33647b['status'](_0x39bf16)['json'](_0x2e45ad);}};}function respondWithFilteredResult(_0x4f6721,_0x3e5981){return function(_0x3a58e6){if(_0x3a58e6){var _0x55f8f3=typeof _0x3e5981[_0xaaf5('0x1f')]===_0xaaf5('0x20')&&typeof _0x3e5981[_0xaaf5('0x21')]==='undefined';var _0x56e709=_0x3a58e6[_0xaaf5('0x22')];var _0x29d42a=_0x55f8f3?0x0:_0x3e5981[_0xaaf5('0x1f')];var _0x37b34a=_0x55f8f3?_0x3a58e6[_0xaaf5('0x22')]:_0x3e5981['offset']+_0x3e5981[_0xaaf5('0x21')];var _0x4643a2;if(_0x37b34a>=_0x56e709){_0x37b34a=_0x56e709;_0x4643a2=0xc8;}else{_0x4643a2=0xce;}_0x4f6721[_0xaaf5('0x1d')](_0x4643a2);return _0x4f6721[_0xaaf5('0x23')](_0xaaf5('0x24'),_0x29d42a+'-'+_0x37b34a+'/'+_0x56e709)[_0xaaf5('0x25')](_0x3a58e6);}return null;};}function patchUpdates(_0x35d940){return function(_0x278fb5){try{jsonpatch[_0xaaf5('0x26')](_0x278fb5,_0x35d940,!![]);}catch(_0x51abf3){return BPromise[_0xaaf5('0x27')](_0x51abf3);}return _0x278fb5[_0xaaf5('0x28')]();};}function saveUpdates(_0x232a5d,_0x2ac3cf){return function(_0x8c129){if(_0x8c129){return _0x8c129[_0xaaf5('0x29')](_0x232a5d)[_0xaaf5('0x2a')](function(_0x16a1d0){return _0x16a1d0;});}return null;};}function removeEntity(_0x577761,_0x290d68){return function(_0x30f383){if(_0x30f383){return _0x30f383[_0xaaf5('0x2b')]()[_0xaaf5('0x2a')](function(){_0x577761[_0xaaf5('0x1d')](0xcc)[_0xaaf5('0x1e')]();});}};}function handleEntityNotFound(_0x115800,_0x433041){return function(_0x187285){if(!_0x187285){_0x115800[_0xaaf5('0x1c')](0x194);}return _0x187285;};}function handleError(_0x53cf4e,_0x8b417e){_0x8b417e=_0x8b417e||0x1f4;return function(_0x3355ef){logger[_0xaaf5('0x2c')](_0x3355ef[_0xaaf5('0x2d')]);if(_0x3355ef[_0xaaf5('0x2e')]){delete _0x3355ef[_0xaaf5('0x2e')];}_0x53cf4e[_0xaaf5('0x1d')](_0x8b417e)['send'](_0x3355ef);};}exports[_0xaaf5('0x2f')]=function(_0x34177a,_0x325ab9){var _0x49c7f2={},_0x5e9b31={},_0x4265e5={'count':0x0,'rows':[]};var _0x5b8030=_[_0xaaf5('0x30')](db['Dynamics365Account'][_0xaaf5('0x31')],function(_0x1951ae){return{'name':_0x1951ae['fieldName'],'type':_0x1951ae['type']['key']};});_0x5e9b31['model']=_[_0xaaf5('0x30')](_0x5b8030,_0xaaf5('0x2e'));_0x5e9b31[_0xaaf5('0x32')]=_[_0xaaf5('0x33')](_0x34177a[_0xaaf5('0x32')]);_0x5e9b31[_0xaaf5('0x34')]=_[_0xaaf5('0x35')](_0x5e9b31['model'],_0x5e9b31[_0xaaf5('0x32')]);_0x49c7f2[_0xaaf5('0x36')]=_[_0xaaf5('0x35')](_0x5e9b31[_0xaaf5('0x37')],qs['fields'](_0x34177a['query'][_0xaaf5('0x38')]));_0x49c7f2[_0xaaf5('0x36')]=_0x49c7f2['attributes'][_0xaaf5('0x39')]?_0x49c7f2[_0xaaf5('0x36')]:_0x5e9b31['model'];if(!_0x34177a[_0xaaf5('0x32')][_0xaaf5('0x3a')](_0xaaf5('0x3b'))){_0x49c7f2['limit']=qs[_0xaaf5('0x21')](_0x34177a[_0xaaf5('0x32')]['limit']);_0x49c7f2[_0xaaf5('0x1f')]=qs['offset'](_0x34177a[_0xaaf5('0x32')][_0xaaf5('0x1f')]);}_0x49c7f2[_0xaaf5('0x3c')]=qs[_0xaaf5('0x3d')](_0x34177a[_0xaaf5('0x32')]['sort']);_0x49c7f2[_0xaaf5('0x3e')]=qs['filters'](_[_0xaaf5('0x3f')](_0x34177a[_0xaaf5('0x32')],_0x5e9b31['filters']),_0x5b8030);if(_0x34177a[_0xaaf5('0x32')][_0xaaf5('0x40')]){_0x49c7f2[_0xaaf5('0x3e')]=_[_0xaaf5('0x41')](_0x49c7f2['where'],{'$or':_['map'](_0x5b8030,function(_0x2a1a93){if(_0x2a1a93['type']!==_0xaaf5('0x42')){var _0x5c5a40={};_0x5c5a40[_0x2a1a93['name']]={'$like':'%'+_0x34177a['query']['filter']+'%'};return _0x5c5a40;}})});}_0x49c7f2=_['merge']({},_0x49c7f2,_0x34177a[_0xaaf5('0x43')]);var _0x5b5cac={'where':_0x49c7f2[_0xaaf5('0x3e')]};return db[_0xaaf5('0x44')][_0xaaf5('0x22')](_0x5b5cac)['then'](function(_0x21d173){_0x4265e5[_0xaaf5('0x22')]=_0x21d173;if(_0x34177a['query'][_0xaaf5('0x45')]){_0x49c7f2['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0xaaf5('0x46')](_0x49c7f2);})[_0xaaf5('0x2a')](function(_0x42ba6d){_0x4265e5[_0xaaf5('0x47')]=_0x42ba6d;return _0x4265e5;})[_0xaaf5('0x2a')](respondWithFilteredResult(_0x325ab9,_0x49c7f2))['catch'](handleError(_0x325ab9,null));};exports['show']=function(_0x353e76,_0x3d0978){var _0x240118={'raw':![],'where':{'id':_0x353e76[_0xaaf5('0x48')]['id']}},_0x7df7bc={};_0x7df7bc[_0xaaf5('0x37')]=_[_0xaaf5('0x33')](db['Dynamics365Account'][_0xaaf5('0x31')]);_0x7df7bc[_0xaaf5('0x32')]=_[_0xaaf5('0x33')](_0x353e76[_0xaaf5('0x32')]);_0x7df7bc['filters']=_[_0xaaf5('0x35')](_0x7df7bc['model'],_0x7df7bc[_0xaaf5('0x32')]);_0x240118['attributes']=_[_0xaaf5('0x35')](_0x7df7bc['model'],qs['fields'](_0x353e76['query']['fields']));_0x240118[_0xaaf5('0x36')]=_0x240118[_0xaaf5('0x36')][_0xaaf5('0x39')]?_0x240118[_0xaaf5('0x36')]:_0x7df7bc[_0xaaf5('0x37')];if(_0x353e76[_0xaaf5('0x32')][_0xaaf5('0x45')]){_0x240118['include']=[{'all':!![]}];}_0x240118=_[_0xaaf5('0x41')]({},_0x240118,_0x353e76[_0xaaf5('0x43')]);return db['Dynamics365Account'][_0xaaf5('0x49')](_0x240118)[_0xaaf5('0x2a')](handleEntityNotFound(_0x3d0978,null))[_0xaaf5('0x2a')](respondWithResult(_0x3d0978,null))[_0xaaf5('0x4a')](handleError(_0x3d0978,null));};exports[_0xaaf5('0x4b')]=function(_0x1f9925,_0x56de90){return db['Dynamics365Account'][_0xaaf5('0x4b')](_0x1f9925[_0xaaf5('0x4c')],{})[_0xaaf5('0x2a')](respondWithResult(_0x56de90,0xc9))['catch'](handleError(_0x56de90,null));};exports[_0xaaf5('0x29')]=function(_0x584cce,_0x116ab9){if(_0x584cce[_0xaaf5('0x4c')]['id']){delete _0x584cce[_0xaaf5('0x4c')]['id'];}return db[_0xaaf5('0x44')][_0xaaf5('0x49')]({'where':{'id':_0x584cce[_0xaaf5('0x48')]['id']}})[_0xaaf5('0x2a')](handleEntityNotFound(_0x116ab9,null))['then'](saveUpdates(_0x584cce['body'],null))[_0xaaf5('0x2a')](respondWithResult(_0x116ab9,null))[_0xaaf5('0x4a')](handleError(_0x116ab9,null));};exports[_0xaaf5('0x2b')]=function(_0x41528a,_0x46ddfa){return db['Dynamics365Account'][_0xaaf5('0x49')]({'where':{'id':_0x41528a[_0xaaf5('0x48')]['id']}})['then'](handleEntityNotFound(_0x46ddfa,null))[_0xaaf5('0x2a')](removeEntity(_0x46ddfa,null))[_0xaaf5('0x4a')](handleError(_0x46ddfa,null));};exports[_0xaaf5('0x4d')]=function(_0x4b7b23,_0x9d6c6b,_0x5d3325){var _0x498af2={};var _0x4a18be={};var _0x2fa4c9;var _0x5b1318;return db[_0xaaf5('0x44')][_0xaaf5('0x4e')]({'where':{'id':_0x4b7b23[_0xaaf5('0x48')]['id']}})[_0xaaf5('0x2a')](handleEntityNotFound(_0x9d6c6b,null))[_0xaaf5('0x2a')](function(_0x528d4f){if(_0x528d4f){_0x2fa4c9=_0x528d4f;_0x4a18be[_0xaaf5('0x37')]=_[_0xaaf5('0x33')](db[_0xaaf5('0x4f')][_0xaaf5('0x31')]);_0x4a18be['query']=_[_0xaaf5('0x33')](_0x4b7b23[_0xaaf5('0x32')]);_0x4a18be[_0xaaf5('0x34')]=_['intersection'](_0x4a18be['model'],_0x4a18be[_0xaaf5('0x32')]);_0x498af2[_0xaaf5('0x36')]=_[_0xaaf5('0x35')](_0x4a18be[_0xaaf5('0x37')],qs['fields'](_0x4b7b23[_0xaaf5('0x32')][_0xaaf5('0x38')]));_0x498af2['attributes']=_0x498af2[_0xaaf5('0x36')][_0xaaf5('0x39')]?_0x498af2[_0xaaf5('0x36')]:_0x4a18be[_0xaaf5('0x37')];_0x498af2[_0xaaf5('0x3c')]=qs[_0xaaf5('0x3d')](_0x4b7b23[_0xaaf5('0x32')][_0xaaf5('0x3d')]);_0x498af2[_0xaaf5('0x3e')]=qs[_0xaaf5('0x34')](_[_0xaaf5('0x3f')](_0x4b7b23['query'],_0x4a18be[_0xaaf5('0x34')]));if(_0x4b7b23[_0xaaf5('0x32')]['filter']){_0x498af2['where']=_[_0xaaf5('0x41')](_0x498af2['where'],{'$or':_[_0xaaf5('0x30')](_0x498af2[_0xaaf5('0x36')],function(_0xff3339){var _0x310c55={};_0x310c55[_0xff3339]={'$like':'%'+_0x4b7b23[_0xaaf5('0x32')][_0xaaf5('0x40')]+'%'};return _0x310c55;})});}_0x498af2=_[_0xaaf5('0x41')]({},_0x498af2,_0x4b7b23[_0xaaf5('0x43')]);return _0x2fa4c9['getConfigurations'](_0x498af2);}})[_0xaaf5('0x2a')](function(_0x15f198){if(_0x15f198){_0x5b1318=_0x15f198['length'];if(!_0x4b7b23[_0xaaf5('0x32')][_0xaaf5('0x3a')]('nolimit')){_0x498af2[_0xaaf5('0x21')]=qs[_0xaaf5('0x21')](_0x4b7b23[_0xaaf5('0x32')][_0xaaf5('0x21')]);_0x498af2[_0xaaf5('0x1f')]=qs[_0xaaf5('0x1f')](_0x4b7b23[_0xaaf5('0x32')][_0xaaf5('0x1f')]);}return _0x2fa4c9[_0xaaf5('0x4d')](_0x498af2);}})[_0xaaf5('0x2a')](function(_0x373853){if(_0x373853){return _0x373853?{'count':_0x5b1318,'rows':_0x373853}:null;}})[_0xaaf5('0x2a')](respondWithResult(_0x9d6c6b,null))['catch'](handleError(_0x9d6c6b,null));};exports['addConfiguration']=function(_0xbb0a44,_0x99e094,_0x1de9da){if(_0xbb0a44[_0xaaf5('0x4c')]['id']){delete _0xbb0a44[_0xaaf5('0x4c')]['id'];}return db[_0xaaf5('0x44')][_0xaaf5('0x4e')]({'where':{'id':_0xbb0a44[_0xaaf5('0x48')]['id']}})['then'](handleEntityNotFound(_0x99e094,null))[_0xaaf5('0x2a')](function(_0x51c372){if(_0x51c372){_0xbb0a44[_0xaaf5('0x4c')][_0xaaf5('0x50')]=_0x51c372['id'];_0xbb0a44[_0xaaf5('0x4c')][_0xaaf5('0x51')]=integrations[_0xaaf5('0x52')](_0xbb0a44[_0xaaf5('0x4c')][_0xaaf5('0x53')],_0xbb0a44[_0xaaf5('0x4c')][_0xaaf5('0x54')]);_0xbb0a44['body'][_0xaaf5('0x55')]=integrations[_0xaaf5('0x56')](_0xbb0a44[_0xaaf5('0x4c')][_0xaaf5('0x53')],_0xbb0a44[_0xaaf5('0x4c')][_0xaaf5('0x54')]);return db['Dynamics365Configuration'][_0xaaf5('0x4b')](_0xbb0a44[_0xaaf5('0x4c')],{'include':[{'model':db[_0xaaf5('0x57')],'as':_0xaaf5('0x51')},{'model':db[_0xaaf5('0x57')],'as':'Descriptions'}]});}return null;})[_0xaaf5('0x2a')](respondWithResult(_0x99e094,null))[_0xaaf5('0x4a')](handleError(_0x99e094,null));};exports[_0xaaf5('0x58')]=function(_0x389873,_0x31dbc3,_0x68c7a5){var _0xe0a8ff=_0x389873[_0xaaf5('0x32')][_0xaaf5('0x59')];var _0x277ff3=_0xe0a8ff===_0xaaf5('0x5a')?_0xaaf5('0x5b'):_0xaaf5('0x5c');var _0x3e0ae8='';var _0x6cb658='';var _0x416d73='';var _0x46336b='';var _0x19dddc='';var _0x1e18f3='';var _0x8e3f21='';var _0x417e93='';var _0x21aa9c=[_0xaaf5('0x5d'),_0xaaf5('0x5e'),_0xaaf5('0x5f'),_0xaaf5('0x60'),_0xaaf5('0x61'),_0xaaf5('0x62'),_0xaaf5('0x63'),_0xaaf5('0x64'),'directioncode',_0xaaf5('0x65')];var _0x28eb40=[_0xaaf5('0x66'),_0xaaf5('0x67'),'actualserviceunits',_0xaaf5('0x68'),_0xaaf5('0x69'),_0xaaf5('0x6a'),_0xaaf5('0x6b'),_0xaaf5('0x6c'),_0xaaf5('0x6d'),_0xaaf5('0x6e'),_0xaaf5('0x6f'),_0xaaf5('0x70'),'createdon',_0xaaf5('0x71'),_0xaaf5('0x72'),_0xaaf5('0x73'),_0xaaf5('0x74'),_0xaaf5('0x75'),_0xaaf5('0x76'),_0xaaf5('0x77'),_0xaaf5('0x78'),_0xaaf5('0x79'),'escalatedon',_0xaaf5('0x7a'),'firstresponsebykpiidname',_0xaaf5('0x7b'),_0xaaf5('0x7c'),_0xaaf5('0x7d'),_0xaaf5('0x7e'),'lastonholdtime','masteridname',_0xaaf5('0x7f'),'modifiedbyexternalpartyyominame',_0xaaf5('0x80'),'modifiedbyyominame',_0xaaf5('0x81'),_0xaaf5('0x82'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xaaf5('0x83'),_0xaaf5('0x84'),_0xaaf5('0x85'),_0xaaf5('0x86'),_0xaaf5('0x87'),_0xaaf5('0x88'),_0xaaf5('0x89'),_0xaaf5('0x8a'),'primarycontactidname',_0xaaf5('0x8b'),_0xaaf5('0x8c'),_0xaaf5('0x8d'),_0xaaf5('0x8e'),'resolveby',_0xaaf5('0x8f'),'responseby',_0xaaf5('0x90'),_0xaaf5('0x91'),'sentimentvalue',_0xaaf5('0x92'),_0xaaf5('0x93'),'socialprofileidname',_0xaaf5('0x94'),_0xaaf5('0x95'),_0xaaf5('0x96'),'ticketnumber','timezoneruleversionnumber','transactioncurrencyidname',_0xaaf5('0x97'),_0xaaf5('0x98'),_0xaaf5('0x99')];var _0x4a0d11=_0x21aa9c['concat'](_0x28eb40);return db[_0xaaf5('0x44')][_0xaaf5('0x4e')]({'where':{'id':_0x389873[_0xaaf5('0x48')]['id']},'attributes':['id',_0xaaf5('0x9a'),'password',_0xaaf5('0x9b'),'tenantId',_0xaaf5('0x9c'),_0xaaf5('0x9d')]})[_0xaaf5('0x2a')](handleEntityNotFound(_0x31dbc3,null))[_0xaaf5('0x2a')](function(_0x261793){if(_0x261793){_0x417e93=_0x261793[_0xaaf5('0x9b')];var _0xbc1a4=_0x417e93[_0xaaf5('0x9e')](-0x1);if(_0xbc1a4==='/'){_0x417e93=_0x417e93[_0xaaf5('0x9f')](0x0,_0x417e93['lastIndexOf'](_0xbc1a4));}_0x8e3f21=util['format'](_0xaaf5('0xa0'),_0x417e93);var _0x30ad29={'method':_0xaaf5('0xa1'),'uri':_0xaaf5('0xa2')+_0x261793[_0xaaf5('0xa3')]+_0xaaf5('0xa4'),'form':{'client_id':_0x261793[_0xaaf5('0x9c')],'resource':_0x417e93,'username':_0x261793[_0xaaf5('0x9a')],'password':_0x261793[_0xaaf5('0xa5')],'grant_type':_0xaaf5('0xa5'),'client_secret':_0x261793['clientSecret']},'json':!![]};return rp(_0x30ad29);}})[_0xaaf5('0x2a')](function(_0x24c5b3){_0x1e18f3=_0x24c5b3[_0xaaf5('0xa6')];var _0x54aaeb={'method':_0xaaf5('0xa7'),'uri':encodeURI(_0x8e3f21+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x277ff3+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1e18f3,'If-None-Match':null,'OData-Version':_0xaaf5('0xa8')},'json':!![]};return rp(_0x54aaeb);})[_0xaaf5('0x2a')](function(_0x16a7ef){var _0x1478db=_0x16a7ef[_0xaaf5('0xa9')][0x0];var _0x21d736=_0x1478db[_0xaaf5('0xaa')];var _0x471531={'method':_0xaaf5('0xa7'),'uri':_0x8e3f21+_0xaaf5('0xab')+_0x21d736+_0xaaf5('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x1e18f3,'If-None-Match':null,'OData-Version':_0xaaf5('0xa8')},'json':!![]};return rp(_0x471531);})['then'](function(_0x4b7af4){_0x3e0ae8=_0x4b7af4;_0x6cb658=_0x3e0ae8[_0xaaf5('0xad')];_0x6cb658=_[_0xaaf5('0xae')](_0x6cb658,function(_0x12f86f){return!_0x4a0d11[_0xaaf5('0xaf')](_0x12f86f[_0xaaf5('0xb0')]);});var _0x112b0d=[];var _0x19f37c=[];_0x6cb658[_0xaaf5('0xb1')](function(_0x243f52){if(_0x243f52[_0xaaf5('0xb2')]){var _0x3881f1=_0x243f52[_0xaaf5('0xb2')]['substring'](_0x243f52[_0xaaf5('0xb2')][_0xaaf5('0xb3')]('.')+0x1);if(_0x3881f1===_0xaaf5('0xb4')){_0x112b0d[_0xaaf5('0xb5')](getSelectList(_0x8e3f21,_0xe0a8ff,_0x19f37c,_0x3e0ae8[_0xaaf5('0xaa')],_0x243f52['MetadataId'],_0x1e18f3));}}});return Promise[_0xaaf5('0xb6')](_0x112b0d);})['then'](function(_0x15b016){_0x416d73=_0x15b016[0x0];var _0x978a97=[];var _0x564178=[];_0x6cb658['forEach'](function(_0x2283cc){if(!_['isNil'](_0x2283cc[_0xaaf5('0xb2')])){var _0x535e5b=_0x2283cc[_0xaaf5('0xb2')]['substring'](_0x2283cc[_0xaaf5('0xb2')][_0xaaf5('0xb3')]('.')+0x1);if(_0x535e5b===_0xaaf5('0xb7')){_0x978a97['push'](getBooleanList(_0x8e3f21,_0xe0a8ff,_0x564178,_0x3e0ae8[_0xaaf5('0xaa')],_0x2283cc[_0xaaf5('0xaa')],_0x1e18f3));}}});return Promise[_0xaaf5('0xb6')](_0x978a97);})[_0xaaf5('0x2a')](function(_0x18dedf){_0x46336b=_0x18dedf[0x0];var _0x59ab3b=[];var _0x3a6415=[];_0x6cb658[_0xaaf5('0xb1')](function(_0x3732bb){if(_0x3732bb['@odata.type']){var _0x4e7329=_0x3732bb['@odata.type']['substring'](_0x3732bb['@odata.type'][_0xaaf5('0xb3')]('.')+0x1);if(_0x4e7329===_0xaaf5('0xb8')||_0x4e7329===_0xaaf5('0xb9')||_0x4e7329==='BigIntAttributeMetadata'||_0x4e7329===_0xaaf5('0xba')||_0x4e7329===_0xaaf5('0xbb')||_0x4e7329===_0xaaf5('0xbc')||_0x4e7329===_0xaaf5('0xbd')||_0x4e7329===_0xaaf5('0xbe')||_0x4e7329===_0xaaf5('0xbf')||_0x4e7329===_0xaaf5('0xc0')){_0x59ab3b['push'](getInputList(_0x8e3f21,_0xe0a8ff,_0x4e7329,_0x3a6415,_0x3e0ae8[_0xaaf5('0xaa')],_0x3732bb['MetadataId'],_0x1e18f3));}}});return Promise[_0xaaf5('0xb6')](_0x59ab3b);})['then'](function(_0x5e4f58){_0x19dddc=_0x5e4f58[0x0];var _0x5a06a2=_0x416d73[_0xaaf5('0xc1')](_0x46336b)['concat'](_0x19dddc);var _0x167b2c={'count':_0x5a06a2[_0xaaf5('0x39')],'rows':_0x5a06a2};return _0x167b2c;})['then'](respondWithResult(_0x31dbc3,null))[_0xaaf5('0x4a')](function(_0x5aebe0){var _0x575f77=_0x389873[_0xaaf5('0x32')][_0xaaf5('0xc2')]?0x1f4:_0x5aebe0['statusCode']||0x1f4;logger[_0xaaf5('0x2c')](_0x5aebe0[_0xaaf5('0x2d')]);delete _0x5aebe0[_0xaaf5('0x2e')];if(_0x575f77===0x191){_0x575f77=0x190;}_0x31dbc3[_0xaaf5('0x1d')](_0x575f77)[_0xaaf5('0xc3')](_0x389873[_0xaaf5('0x32')][_0xaaf5('0xc2')]?{'message':_0xaaf5('0xc4'),'statusCode':_0x5aebe0['statusCode']}:_0x5aebe0);});};function getSelectList(_0x840bde,_0x5dbb39,_0x1d032c,_0x1c9cc0,_0x1fd4b2,_0x14aac2){var _0x4bbdce={'method':_0xaaf5('0xa7'),'uri':_0x840bde+_0xaaf5('0xab')+_0x1c9cc0+_0xaaf5('0xc5')+_0x1fd4b2+_0xaaf5('0xc6')+_0xaaf5('0xc7'),'headers':{'Authorization':_0xaaf5('0xc8')+_0x14aac2,'If-None-Match':null,'OData-Version':_0xaaf5('0xa8')},'json':!![]};return rp(_0x4bbdce)[_0xaaf5('0x2a')](function(_0x2ce875){var _0x2d4e3a=[];var _0x43e679=_0x2ce875[_0xaaf5('0xc9')][_0xaaf5('0xca')];_0x43e679[_0xaaf5('0xb1')](function(_0x40e193){_0x2d4e3a[_0xaaf5('0xb5')]({'name':_0x40e193[_0xaaf5('0xcb')][_0xaaf5('0xcc')][_0xaaf5('0xcb')],'value':String(_0x40e193[_0xaaf5('0xcd')])});});var _0x41a327={'id':_0x5dbb39+'_'+_0x2ce875[_0xaaf5('0xb0')],'name':_0x2ce875[_0xaaf5('0xce')][_0xaaf5('0xcc')][_0xaaf5('0xcb')],'custom':![],'options':_0x2d4e3a};_0x1d032c['push'](_0x41a327);return _0x1d032c;});}function getBooleanList(_0x49bb3b,_0x2c9328,_0x913e88,_0x2d5b55,_0x4f1bdb,_0x5ba0b8){var _0x5f05c6={'method':_0xaaf5('0xa7'),'uri':_0x49bb3b+_0xaaf5('0xab')+_0x2d5b55+_0xaaf5('0xc5')+_0x4f1bdb+_0xaaf5('0xcf'),'headers':{'Authorization':_0xaaf5('0xc8')+_0x5ba0b8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5f05c6)[_0xaaf5('0x2a')](function(_0x23b501){var _0x242ca7=[];_0x242ca7['push']({'name':_0x23b501[_0xaaf5('0xc9')][_0xaaf5('0xd0')][_0xaaf5('0xcb')][_0xaaf5('0xcc')][_0xaaf5('0xcb')],'value':_0xaaf5('0xd1')},{'name':_0x23b501[_0xaaf5('0xc9')]['FalseOption']['Label']['UserLocalizedLabel']['Label'],'value':_0xaaf5('0xd2')});var _0x8e8193={'id':_0x2c9328+'_'+_0x23b501[_0xaaf5('0xb0')],'name':_0x23b501[_0xaaf5('0xce')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x242ca7};_0x913e88[_0xaaf5('0xb5')](_0x8e8193);return _0x913e88;});}function getInputList(_0x179ba7,_0x5e6d46,_0x5ea13e,_0x1c6bba,_0x4af225,_0xa202b5,_0x362033){var _0x41d060={'method':_0xaaf5('0xa7'),'uri':_0x179ba7+_0xaaf5('0xab')+_0x4af225+_0xaaf5('0xc5')+_0xa202b5+')/Microsoft.Dynamics.CRM.'+_0x5ea13e+_0xaaf5('0xd3'),'headers':{'Authorization':_0xaaf5('0xc8')+_0x362033,'If-None-Match':null,'OData-Version':_0xaaf5('0xa8')},'json':!![]};return rp(_0x41d060)[_0xaaf5('0x2a')](function(_0x497f55){var _0x2a7c10={'id':_0x5e6d46+'_'+_0x497f55[_0xaaf5('0xb0')],'name':_0x497f55['DisplayName'][_0xaaf5('0xcc')]?_0x497f55[_0xaaf5('0xce')][_0xaaf5('0xcc')][_0xaaf5('0xcb')]:_0x497f55[_0xaaf5('0xb0')],'custom':![],'options':[]};_0x1c6bba[_0xaaf5('0xb5')](_0x2a7c10);return _0x1c6bba;});} \ No newline at end of file +var _0xd2ea=['model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','Dynamics365Configuration','pick','getConfigurations','AccountId','Descriptions','getDescriptions','channel','Dynamics365Field','Subjects','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','statusCode','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5d0f40,_0x3f3b61){_0x5d0f40=_0x5d0f40-0x0;var _0x25cf34=_0xd2ea[_0x5d0f40];return _0x25cf34;};'use strict';var emlformat=require(_0xad2e('0x0'));var rimraf=require(_0xad2e('0x1'));var zipdir=require(_0xad2e('0x2'));var jsonpatch=require(_0xad2e('0x3'));var rp=require(_0xad2e('0x4'));var moment=require('moment');var BPromise=require(_0xad2e('0x5'));var Mustache=require(_0xad2e('0x6'));var util=require(_0xad2e('0x7'));var path=require(_0xad2e('0x8'));var sox=require(_0xad2e('0x9'));var csv=require(_0xad2e('0xa'));var ejs=require(_0xad2e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad2e('0xc'));var squel=require(_0xad2e('0xd'));var crypto=require(_0xad2e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xad2e('0xf'));var toCsv=require(_0xad2e('0xa'));var querystring=require('querystring');var Papa=require(_0xad2e('0x10'));var Redis=require('ioredis');var authService=require(_0xad2e('0x11'));var qs=require(_0xad2e('0x12'));var as=require(_0xad2e('0x13'));var hardwareService=require(_0xad2e('0x14'));var logger=require('../../config/logger')(_0xad2e('0x15'));var utils=require('../../config/utils');var config=require(_0xad2e('0x16'));var licenseUtil=require(_0xad2e('0x17'));var db=require(_0xad2e('0x18'))['db'];var integrations=require(_0xad2e('0x19'));function respondWithStatusCode(_0x59a342,_0x27fb5a){_0x27fb5a=_0x27fb5a||0xcc;return function(_0x59201f){if(_0x59201f){return _0x59a342[_0xad2e('0x1a')](_0x27fb5a);}return _0x59a342['status'](_0x27fb5a)['end']();};}function respondWithResult(_0x4a812b,_0x5c96a7){_0x5c96a7=_0x5c96a7||0xc8;return function(_0xae17ab){if(_0xae17ab){return _0x4a812b[_0xad2e('0x1b')](_0x5c96a7)[_0xad2e('0x1c')](_0xae17ab);}};}function respondWithFilteredResult(_0x2b6945,_0x17e6ac){return function(_0x4180aa){if(_0x4180aa){var _0x2546e2=typeof _0x17e6ac[_0xad2e('0x1d')]===_0xad2e('0x1e')&&typeof _0x17e6ac[_0xad2e('0x1f')]===_0xad2e('0x1e');var _0x39c5e4=_0x4180aa[_0xad2e('0x20')];var _0x1b4889=_0x2546e2?0x0:_0x17e6ac[_0xad2e('0x1d')];var _0x4ef16f=_0x2546e2?_0x4180aa[_0xad2e('0x20')]:_0x17e6ac[_0xad2e('0x1d')]+_0x17e6ac['limit'];var _0x50eb1a;if(_0x4ef16f>=_0x39c5e4){_0x4ef16f=_0x39c5e4;_0x50eb1a=0xc8;}else{_0x50eb1a=0xce;}_0x2b6945['status'](_0x50eb1a);return _0x2b6945['set'](_0xad2e('0x21'),_0x1b4889+'-'+_0x4ef16f+'/'+_0x39c5e4)[_0xad2e('0x1c')](_0x4180aa);}return null;};}function patchUpdates(_0x5549db){return function(_0x208991){try{jsonpatch[_0xad2e('0x22')](_0x208991,_0x5549db,!![]);}catch(_0x41109a){return BPromise[_0xad2e('0x23')](_0x41109a);}return _0x208991[_0xad2e('0x24')]();};}function saveUpdates(_0x102169,_0x154d54){return function(_0x40e1e4){if(_0x40e1e4){return _0x40e1e4[_0xad2e('0x25')](_0x102169)[_0xad2e('0x26')](function(_0x20e664){return _0x20e664;});}return null;};}function removeEntity(_0x207517,_0x2e1c95){return function(_0x59630b){if(_0x59630b){return _0x59630b[_0xad2e('0x27')]()[_0xad2e('0x26')](function(){_0x207517[_0xad2e('0x1b')](0xcc)[_0xad2e('0x28')]();});}};}function handleEntityNotFound(_0x2f9370,_0x58acc8){return function(_0x1161d5){if(!_0x1161d5){_0x2f9370[_0xad2e('0x1a')](0x194);}return _0x1161d5;};}function handleError(_0xfd90a4,_0x50d446){_0x50d446=_0x50d446||0x1f4;return function(_0x356a19){logger['error'](_0x356a19[_0xad2e('0x29')]);if(_0x356a19[_0xad2e('0x2a')]){delete _0x356a19[_0xad2e('0x2a')];}_0xfd90a4[_0xad2e('0x1b')](_0x50d446)[_0xad2e('0x2b')](_0x356a19);};}exports[_0xad2e('0x2c')]=function(_0xb3171a,_0x454c04){var _0x52fdda={},_0x31857f={},_0x4ffa15={'count':0x0,'rows':[]};var _0x434934=_[_0xad2e('0x2d')](db[_0xad2e('0x2e')][_0xad2e('0x2f')],function(_0x42fe6c){return{'name':_0x42fe6c[_0xad2e('0x30')],'type':_0x42fe6c[_0xad2e('0x31')][_0xad2e('0x32')]};});_0x31857f[_0xad2e('0x33')]=_[_0xad2e('0x2d')](_0x434934,_0xad2e('0x2a'));_0x31857f['query']=_[_0xad2e('0x34')](_0xb3171a['query']);_0x31857f[_0xad2e('0x35')]=_[_0xad2e('0x36')](_0x31857f[_0xad2e('0x33')],_0x31857f[_0xad2e('0x37')]);_0x52fdda[_0xad2e('0x38')]=_['intersection'](_0x31857f[_0xad2e('0x33')],qs[_0xad2e('0x39')](_0xb3171a['query'][_0xad2e('0x39')]));_0x52fdda[_0xad2e('0x38')]=_0x52fdda['attributes'][_0xad2e('0x3a')]?_0x52fdda[_0xad2e('0x38')]:_0x31857f[_0xad2e('0x33')];if(!_0xb3171a[_0xad2e('0x37')][_0xad2e('0x3b')](_0xad2e('0x3c'))){_0x52fdda[_0xad2e('0x1f')]=qs['limit'](_0xb3171a[_0xad2e('0x37')][_0xad2e('0x1f')]);_0x52fdda['offset']=qs[_0xad2e('0x1d')](_0xb3171a[_0xad2e('0x37')][_0xad2e('0x1d')]);}_0x52fdda[_0xad2e('0x3d')]=qs[_0xad2e('0x3e')](_0xb3171a[_0xad2e('0x37')]['sort']);_0x52fdda['where']=qs[_0xad2e('0x35')](_['pick'](_0xb3171a[_0xad2e('0x37')],_0x31857f[_0xad2e('0x35')]),_0x434934);if(_0xb3171a[_0xad2e('0x37')][_0xad2e('0x3f')]){_0x52fdda[_0xad2e('0x40')]=_['merge'](_0x52fdda[_0xad2e('0x40')],{'$or':_[_0xad2e('0x2d')](_0x434934,function(_0x4cc81e){if(_0x4cc81e['type']!=='VIRTUAL'){var _0x274fd8={};_0x274fd8[_0x4cc81e['name']]={'$like':'%'+_0xb3171a['query'][_0xad2e('0x3f')]+'%'};return _0x274fd8;}})});}_0x52fdda=_[_0xad2e('0x41')]({},_0x52fdda,_0xb3171a[_0xad2e('0x42')]);var _0x3a7954={'where':_0x52fdda[_0xad2e('0x40')]};return db[_0xad2e('0x2e')][_0xad2e('0x20')](_0x3a7954)['then'](function(_0xec9e1a){_0x4ffa15[_0xad2e('0x20')]=_0xec9e1a;if(_0xb3171a[_0xad2e('0x37')][_0xad2e('0x43')]){_0x52fdda[_0xad2e('0x44')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xad2e('0x45')](_0x52fdda);})['then'](function(_0x2c1bd9){_0x4ffa15[_0xad2e('0x46')]=_0x2c1bd9;return _0x4ffa15;})[_0xad2e('0x26')](respondWithFilteredResult(_0x454c04,_0x52fdda))[_0xad2e('0x47')](handleError(_0x454c04,null));};exports[_0xad2e('0x48')]=function(_0x397348,_0x1abcea){var _0x27a0d3={'raw':![],'where':{'id':_0x397348[_0xad2e('0x49')]['id']}},_0x1d69d1={};_0x1d69d1[_0xad2e('0x33')]=_[_0xad2e('0x34')](db[_0xad2e('0x2e')][_0xad2e('0x2f')]);_0x1d69d1[_0xad2e('0x37')]=_[_0xad2e('0x34')](_0x397348[_0xad2e('0x37')]);_0x1d69d1[_0xad2e('0x35')]=_[_0xad2e('0x36')](_0x1d69d1[_0xad2e('0x33')],_0x1d69d1['query']);_0x27a0d3[_0xad2e('0x38')]=_[_0xad2e('0x36')](_0x1d69d1[_0xad2e('0x33')],qs[_0xad2e('0x39')](_0x397348[_0xad2e('0x37')][_0xad2e('0x39')]));_0x27a0d3[_0xad2e('0x38')]=_0x27a0d3['attributes'][_0xad2e('0x3a')]?_0x27a0d3['attributes']:_0x1d69d1[_0xad2e('0x33')];if(_0x397348[_0xad2e('0x37')][_0xad2e('0x43')]){_0x27a0d3[_0xad2e('0x44')]=[{'all':!![]}];}_0x27a0d3=_[_0xad2e('0x41')]({},_0x27a0d3,_0x397348['options']);return db[_0xad2e('0x2e')][_0xad2e('0x4a')](_0x27a0d3)[_0xad2e('0x26')](handleEntityNotFound(_0x1abcea,null))[_0xad2e('0x26')](respondWithResult(_0x1abcea,null))[_0xad2e('0x47')](handleError(_0x1abcea,null));};exports['create']=function(_0x18ef1e,_0x120069){return db[_0xad2e('0x2e')][_0xad2e('0x4b')](_0x18ef1e['body'],{})['then'](respondWithResult(_0x120069,0xc9))[_0xad2e('0x47')](handleError(_0x120069,null));};exports[_0xad2e('0x25')]=function(_0x4d2c66,_0x4ec64c){if(_0x4d2c66[_0xad2e('0x4c')]['id']){delete _0x4d2c66['body']['id'];}return db[_0xad2e('0x2e')][_0xad2e('0x4a')]({'where':{'id':_0x4d2c66['params']['id']}})[_0xad2e('0x26')](handleEntityNotFound(_0x4ec64c,null))[_0xad2e('0x26')](saveUpdates(_0x4d2c66[_0xad2e('0x4c')],null))[_0xad2e('0x26')](respondWithResult(_0x4ec64c,null))['catch'](handleError(_0x4ec64c,null));};exports['destroy']=function(_0x42d999,_0x2d2af3){return db[_0xad2e('0x2e')][_0xad2e('0x4a')]({'where':{'id':_0x42d999[_0xad2e('0x49')]['id']}})[_0xad2e('0x26')](handleEntityNotFound(_0x2d2af3,null))[_0xad2e('0x26')](removeEntity(_0x2d2af3,null))[_0xad2e('0x47')](handleError(_0x2d2af3,null));};exports['getConfigurations']=function(_0x2a06f2,_0x508812,_0x36ba65){var _0xf5640={};var _0x438c7f={};var _0x336c2f;var _0x450448;return db[_0xad2e('0x2e')][_0xad2e('0x4d')]({'where':{'id':_0x2a06f2['params']['id']}})[_0xad2e('0x26')](handleEntityNotFound(_0x508812,null))['then'](function(_0x2d2dc2){if(_0x2d2dc2){_0x336c2f=_0x2d2dc2;_0x438c7f[_0xad2e('0x33')]=_[_0xad2e('0x34')](db[_0xad2e('0x4e')]['rawAttributes']);_0x438c7f[_0xad2e('0x37')]=_[_0xad2e('0x34')](_0x2a06f2['query']);_0x438c7f[_0xad2e('0x35')]=_['intersection'](_0x438c7f[_0xad2e('0x33')],_0x438c7f[_0xad2e('0x37')]);_0xf5640[_0xad2e('0x38')]=_[_0xad2e('0x36')](_0x438c7f[_0xad2e('0x33')],qs[_0xad2e('0x39')](_0x2a06f2[_0xad2e('0x37')][_0xad2e('0x39')]));_0xf5640[_0xad2e('0x38')]=_0xf5640['attributes'][_0xad2e('0x3a')]?_0xf5640[_0xad2e('0x38')]:_0x438c7f[_0xad2e('0x33')];_0xf5640[_0xad2e('0x3d')]=qs['sort'](_0x2a06f2['query'][_0xad2e('0x3e')]);_0xf5640[_0xad2e('0x40')]=qs[_0xad2e('0x35')](_[_0xad2e('0x4f')](_0x2a06f2[_0xad2e('0x37')],_0x438c7f[_0xad2e('0x35')]));if(_0x2a06f2['query'][_0xad2e('0x3f')]){_0xf5640[_0xad2e('0x40')]=_['merge'](_0xf5640[_0xad2e('0x40')],{'$or':_[_0xad2e('0x2d')](_0xf5640[_0xad2e('0x38')],function(_0x3f6894){var _0xd9c11c={};_0xd9c11c[_0x3f6894]={'$like':'%'+_0x2a06f2[_0xad2e('0x37')][_0xad2e('0x3f')]+'%'};return _0xd9c11c;})});}_0xf5640=_[_0xad2e('0x41')]({},_0xf5640,_0x2a06f2[_0xad2e('0x42')]);return _0x336c2f[_0xad2e('0x50')](_0xf5640);}})['then'](function(_0x583c12){if(_0x583c12){_0x450448=_0x583c12[_0xad2e('0x3a')];if(!_0x2a06f2['query']['hasOwnProperty'](_0xad2e('0x3c'))){_0xf5640[_0xad2e('0x1f')]=qs[_0xad2e('0x1f')](_0x2a06f2['query'][_0xad2e('0x1f')]);_0xf5640[_0xad2e('0x1d')]=qs[_0xad2e('0x1d')](_0x2a06f2[_0xad2e('0x37')][_0xad2e('0x1d')]);}return _0x336c2f['getConfigurations'](_0xf5640);}})[_0xad2e('0x26')](function(_0x574351){if(_0x574351){return _0x574351?{'count':_0x450448,'rows':_0x574351}:null;}})['then'](respondWithResult(_0x508812,null))['catch'](handleError(_0x508812,null));};exports['addConfiguration']=function(_0x28ab70,_0x41d0c7,_0x4033ef){if(_0x28ab70[_0xad2e('0x4c')]['id']){delete _0x28ab70[_0xad2e('0x4c')]['id'];}return db[_0xad2e('0x2e')][_0xad2e('0x4d')]({'where':{'id':_0x28ab70[_0xad2e('0x49')]['id']}})[_0xad2e('0x26')](handleEntityNotFound(_0x41d0c7,null))[_0xad2e('0x26')](function(_0x4fbc78){if(_0x4fbc78){_0x28ab70['body'][_0xad2e('0x51')]=_0x4fbc78['id'];_0x28ab70[_0xad2e('0x4c')]['Subjects']=integrations['getSubjects'](_0x28ab70[_0xad2e('0x4c')]['channel'],_0x28ab70[_0xad2e('0x4c')][_0xad2e('0x31')]);_0x28ab70[_0xad2e('0x4c')][_0xad2e('0x52')]=integrations[_0xad2e('0x53')](_0x28ab70[_0xad2e('0x4c')][_0xad2e('0x54')],_0x28ab70[_0xad2e('0x4c')]['type']);return db[_0xad2e('0x4e')]['create'](_0x28ab70['body'],{'include':[{'model':db[_0xad2e('0x55')],'as':_0xad2e('0x56')},{'model':db['Dynamics365Field'],'as':_0xad2e('0x52')}]});}return null;})[_0xad2e('0x26')](respondWithResult(_0x41d0c7,null))[_0xad2e('0x47')](handleError(_0x41d0c7,null));};exports['getFields']=function(_0x1e5f05,_0x56aa36,_0x1469a2){var _0x4ee202=_0x1e5f05[_0xad2e('0x37')][_0xad2e('0x57')];var _0x38b136=_0x4ee202===_0xad2e('0x58')?_0xad2e('0x59'):_0xad2e('0x5a');var _0x59981c='';var _0x49e39c='';var _0xc8c4fa='';var _0xf2c1d0='';var _0x33a3e8='';var _0x3d293a='';var _0x57e1a9='';var _0x34cada='';var _0x3ec9f9=[_0xad2e('0x5b'),_0xad2e('0x5c'),_0xad2e('0x5d'),_0xad2e('0x5e'),_0xad2e('0x5f'),_0xad2e('0x60'),_0xad2e('0x61'),'regardingobjectid',_0xad2e('0x62'),_0xad2e('0x63')];var _0x46bf5e=['accountidname',_0xad2e('0x64'),_0xad2e('0x65'),_0xad2e('0x66'),_0xad2e('0x67'),_0xad2e('0x68'),_0xad2e('0x69'),'contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname',_0xad2e('0x6a'),_0xad2e('0x6b'),'createdonbehalfbyname',_0xad2e('0x6c'),_0xad2e('0x6d'),_0xad2e('0x6e'),_0xad2e('0x6f'),_0xad2e('0x70'),_0xad2e('0x71'),_0xad2e('0x72'),_0xad2e('0x73'),'escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber',_0xad2e('0x74'),'kbarticleidname',_0xad2e('0x75'),_0xad2e('0x76'),_0xad2e('0x77'),'modifiedbyexternalpartyyominame','modifiedbyname',_0xad2e('0x78'),'modifiedon','modifiedonbehalfbyname',_0xad2e('0x79'),_0xad2e('0x7a'),_0xad2e('0x7b'),_0xad2e('0x7c'),_0xad2e('0x7d'),_0xad2e('0x7e'),_0xad2e('0x7f'),_0xad2e('0x80'),_0xad2e('0x81'),_0xad2e('0x82'),'primarycontactidname','primarycontactidyominame',_0xad2e('0x83'),_0xad2e('0x84'),'productserialnumber',_0xad2e('0x85'),_0xad2e('0x86'),'responseby','responsiblecontactidname',_0xad2e('0x87'),_0xad2e('0x88'),_0xad2e('0x89'),_0xad2e('0x8a'),_0xad2e('0x8b'),'statecode',_0xad2e('0x8c'),'subjectidname',_0xad2e('0x8d'),_0xad2e('0x8e'),'transactioncurrencyidname',_0xad2e('0x8f'),_0xad2e('0x90'),_0xad2e('0x91')];var _0x47f679=_0x3ec9f9[_0xad2e('0x92')](_0x46bf5e);return db[_0xad2e('0x2e')][_0xad2e('0x4d')]({'where':{'id':_0x1e5f05[_0xad2e('0x49')]['id']},'attributes':['id',_0xad2e('0x93'),'password',_0xad2e('0x94'),'tenantId',_0xad2e('0x95'),_0xad2e('0x96')]})[_0xad2e('0x26')](handleEntityNotFound(_0x56aa36,null))[_0xad2e('0x26')](function(_0x1bf6b6){if(_0x1bf6b6){_0x34cada=_0x1bf6b6[_0xad2e('0x94')];var _0xb44d39=_0x34cada[_0xad2e('0x97')](-0x1);if(_0xb44d39==='/'){_0x34cada=_0x34cada[_0xad2e('0x98')](0x0,_0x34cada[_0xad2e('0x99')](_0xb44d39));}_0x57e1a9=util[_0xad2e('0x9a')](_0xad2e('0x9b'),_0x34cada);var _0x4a7a2e={'method':_0xad2e('0x9c'),'uri':_0xad2e('0x9d')+_0x1bf6b6[_0xad2e('0x9e')]+_0xad2e('0x9f'),'form':{'client_id':_0x1bf6b6['clientId'],'resource':_0x34cada,'username':_0x1bf6b6[_0xad2e('0x93')],'password':_0x1bf6b6[_0xad2e('0xa0')],'grant_type':_0xad2e('0xa0'),'client_secret':_0x1bf6b6[_0xad2e('0x96')]},'json':!![]};return rp(_0x4a7a2e);}})['then'](function(_0x3167b0){_0x3d293a=_0x3167b0[_0xad2e('0xa1')];var _0x2c622e={'method':'GET','uri':encodeURI(_0x57e1a9+_0xad2e('0xa2')+_0x38b136+'\x27'),'headers':{'Authorization':_0xad2e('0xa3')+_0x3d293a,'If-None-Match':null,'OData-Version':_0xad2e('0xa4')},'json':!![]};return rp(_0x2c622e);})[_0xad2e('0x26')](function(_0x535844){var _0x3cd824=_0x535844[_0xad2e('0xa5')][0x0];var _0x212e6d=_0x3cd824[_0xad2e('0xa6')];var _0x265ad5={'method':_0xad2e('0xa7'),'uri':_0x57e1a9+_0xad2e('0xa8')+_0x212e6d+_0xad2e('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0x3d293a,'If-None-Match':null,'OData-Version':_0xad2e('0xa4')},'json':!![]};return rp(_0x265ad5);})['then'](function(_0x4b3d54){_0x59981c=_0x4b3d54;_0x49e39c=_0x59981c[_0xad2e('0xaa')];_0x49e39c=_[_0xad2e('0xab')](_0x49e39c,function(_0x2dac6f){return!_0x47f679[_0xad2e('0xac')](_0x2dac6f[_0xad2e('0xad')]);});var _0x2932c9=[];var _0x29a841=[];_0x49e39c[_0xad2e('0xae')](function(_0xbf03ad){if(_0xbf03ad[_0xad2e('0xaf')]){var _0x212991=_0xbf03ad[_0xad2e('0xaf')]['substring'](_0xbf03ad[_0xad2e('0xaf')][_0xad2e('0x99')]('.')+0x1);if(_0x212991===_0xad2e('0xb0')){_0x2932c9[_0xad2e('0xb1')](getSelectList(_0x57e1a9,_0x4ee202,_0x29a841,_0x59981c[_0xad2e('0xa6')],_0xbf03ad[_0xad2e('0xa6')],_0x3d293a));}}});return Promise[_0xad2e('0xb2')](_0x2932c9);})[_0xad2e('0x26')](function(_0x35d060){_0xc8c4fa=_0x35d060[0x0];var _0x3236ca=[];var _0x551a80=[];_0x49e39c[_0xad2e('0xae')](function(_0x21efdf){if(!_[_0xad2e('0xb3')](_0x21efdf[_0xad2e('0xaf')])){var _0x5a1ad3=_0x21efdf[_0xad2e('0xaf')]['substring'](_0x21efdf[_0xad2e('0xaf')][_0xad2e('0x99')]('.')+0x1);if(_0x5a1ad3===_0xad2e('0xb4')){_0x3236ca[_0xad2e('0xb1')](getBooleanList(_0x57e1a9,_0x4ee202,_0x551a80,_0x59981c[_0xad2e('0xa6')],_0x21efdf[_0xad2e('0xa6')],_0x3d293a));}}});return Promise[_0xad2e('0xb2')](_0x3236ca);})['then'](function(_0x37be08){_0xf2c1d0=_0x37be08[0x0];var _0x17a0e5=[];var _0x4d3e47=[];_0x49e39c['forEach'](function(_0x3c3d5b){if(_0x3c3d5b['@odata.type']){var _0x42909c=_0x3c3d5b[_0xad2e('0xaf')]['substring'](_0x3c3d5b['@odata.type'][_0xad2e('0x99')]('.')+0x1);if(_0x42909c==='StringAttributeMetadata'||_0x42909c===_0xad2e('0xb5')||_0x42909c===_0xad2e('0xb6')||_0x42909c==='IntegerAttributeMetadata'||_0x42909c===_0xad2e('0xb7')||_0x42909c==='DateTimeAttributeMetadata'||_0x42909c===_0xad2e('0xb8')||_0x42909c===_0xad2e('0xb9')||_0x42909c==='StateAttributeMetadata'||_0x42909c==='DecimalAttributeMetadata'){_0x17a0e5[_0xad2e('0xb1')](getInputList(_0x57e1a9,_0x4ee202,_0x42909c,_0x4d3e47,_0x59981c[_0xad2e('0xa6')],_0x3c3d5b['MetadataId'],_0x3d293a));}}});return Promise[_0xad2e('0xb2')](_0x17a0e5);})[_0xad2e('0x26')](function(_0x4e6c8f){_0x33a3e8=_0x4e6c8f[0x0];var _0x3ffc2a=_0xc8c4fa[_0xad2e('0x92')](_0xf2c1d0)[_0xad2e('0x92')](_0x33a3e8);var _0x1d2814={'count':_0x3ffc2a[_0xad2e('0x3a')],'rows':_0x3ffc2a};return _0x1d2814;})['then'](respondWithResult(_0x56aa36,null))[_0xad2e('0x47')](function(_0x1fda13){var _0x26519d=_0x1e5f05[_0xad2e('0x37')]['test']?0x1f4:_0x1fda13[_0xad2e('0xba')]||0x1f4;logger['error'](_0x1fda13[_0xad2e('0x29')]);delete _0x1fda13['name'];if(_0x26519d===0x191){_0x26519d=0x190;}_0x56aa36[_0xad2e('0x1b')](_0x26519d)[_0xad2e('0x2b')](_0x1e5f05[_0xad2e('0x37')][_0xad2e('0xbb')]?{'message':'Wrong\x20credentials','statusCode':_0x1fda13[_0xad2e('0xba')]}:_0x1fda13);});};function getSelectList(_0x310007,_0x1b2ac6,_0x2c9d92,_0x5abc7d,_0x6a83f7,_0x23f261){var _0x3ff00a={'method':'GET','uri':_0x310007+_0xad2e('0xa8')+_0x5abc7d+_0xad2e('0xbc')+_0x6a83f7+_0xad2e('0xbd')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xad2e('0xa3')+_0x23f261,'If-None-Match':null,'OData-Version':_0xad2e('0xa4')},'json':!![]};return rp(_0x3ff00a)[_0xad2e('0x26')](function(_0x39fe50){var _0x29f1ec=[];var _0x350bc=_0x39fe50['OptionSet']['Options'];_0x350bc[_0xad2e('0xae')](function(_0x114ff1){_0x29f1ec[_0xad2e('0xb1')]({'name':_0x114ff1['Label'][_0xad2e('0xbe')][_0xad2e('0xbf')],'value':String(_0x114ff1[_0xad2e('0xc0')])});});var _0x31e8da={'id':_0x1b2ac6+'_'+_0x39fe50[_0xad2e('0xad')],'name':_0x39fe50[_0xad2e('0xc1')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x29f1ec};_0x2c9d92[_0xad2e('0xb1')](_0x31e8da);return _0x2c9d92;});}function getBooleanList(_0xb85fe5,_0xa196ad,_0x5d9202,_0x148a33,_0x2216c0,_0x223358){var _0x57f57c={'method':_0xad2e('0xa7'),'uri':_0xb85fe5+'EntityDefinitions('+_0x148a33+_0xad2e('0xbc')+_0x2216c0+_0xad2e('0xc2'),'headers':{'Authorization':_0xad2e('0xa3')+_0x223358,'If-None-Match':null,'OData-Version':_0xad2e('0xa4')},'json':!![]};return rp(_0x57f57c)[_0xad2e('0x26')](function(_0x5e3afd){var _0x5af6b1=[];_0x5af6b1['push']({'name':_0x5e3afd[_0xad2e('0xc3')][_0xad2e('0xc4')][_0xad2e('0xbf')][_0xad2e('0xbe')]['Label'],'value':_0xad2e('0xc5')},{'name':_0x5e3afd[_0xad2e('0xc3')][_0xad2e('0xc6')][_0xad2e('0xbf')][_0xad2e('0xbe')]['Label'],'value':_0xad2e('0xc7')});var _0x3f7ad9={'id':_0xa196ad+'_'+_0x5e3afd[_0xad2e('0xad')],'name':_0x5e3afd[_0xad2e('0xc1')][_0xad2e('0xbe')][_0xad2e('0xbf')],'custom':![],'options':_0x5af6b1};_0x5d9202[_0xad2e('0xb1')](_0x3f7ad9);return _0x5d9202;});}function getInputList(_0x313628,_0x417c6d,_0x4510b2,_0x242792,_0x1031ce,_0xaeb51e,_0x469da4){var _0x1d5f8e={'method':_0xad2e('0xa7'),'uri':_0x313628+'EntityDefinitions('+_0x1031ce+_0xad2e('0xbc')+_0xaeb51e+_0xad2e('0xc8')+_0x4510b2+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xad2e('0xa3')+_0x469da4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1d5f8e)[_0xad2e('0x26')](function(_0x3a6ec6){var _0x23758f={'id':_0x417c6d+'_'+_0x3a6ec6['LogicalName'],'name':_0x3a6ec6['DisplayName'][_0xad2e('0xbe')]?_0x3a6ec6['DisplayName'][_0xad2e('0xbe')][_0xad2e('0xbf')]:_0x3a6ec6['LogicalName'],'custom':![],'options':[]};_0x242792[_0xad2e('0xb1')](_0x23758f);return _0x242792;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e6a8510..22e9c27 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x50700a,_0x4ac6e5){var _0x285621=function(_0x560d6d){while(--_0x560d6d){_0x50700a['push'](_0x50700a['shift']());}};_0x285621(++_0x4ac6e5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb7e7[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x495c28,_0x443e23){var _0x4ccd3f=function(_0x2c0ffb){while(--_0x2c0ffb){_0x495c28['push'](_0x495c28['shift']());}};_0x4ccd3f(++_0x443e23);}(_0x757a,0xde));var _0xa757=function(_0x359ed2,_0x4f2563){_0x359ed2=_0x359ed2-0x0;var _0x52b507=_0x757a[_0x359ed2];return _0x52b507;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ce977af..0ffc02c 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 _0x7a40=['catch','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','debug','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x535250,_0x1127f7){var _0x16ffe8=function(_0x3062dc){while(--_0x3062dc){_0x535250['push'](_0x535250['shift']());}};_0x16ffe8(++_0x1127f7);}(_0x7a40,0x1b2));var _0x07a4=function(_0x2fec82,_0x307370){_0x2fec82=_0x2fec82-0x0;var _0xdd7d21=_0x7a40[_0x2fec82];return _0xdd7d21;};'use strict';var _=require(_0x07a4('0x0'));var util=require(_0x07a4('0x1'));var moment=require(_0x07a4('0x2'));var BPromise=require(_0x07a4('0x3'));var rs=require(_0x07a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07a4('0x5'))['db'];var utils=require(_0x07a4('0x6'));var logger=require('../../config/logger')(_0x07a4('0x7'));var config=require(_0x07a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x07a4('0x9')][_0x07a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ec7b,_0x1def9b,_0x44fb5c){return new BPromise(function(_0x2aa109,_0x483876){return client[_0x07a4('0xb')](_0x21ec7b,_0x44fb5c)['then'](function(_0x2af91f){logger[_0x07a4('0xc')](_0x07a4('0xd'),_0x1def9b,'request\x20sent');logger['debug'](_0x07a4('0xe'),_0x1def9b,_0x07a4('0xf'),JSON[_0x07a4('0x10')](_0x2af91f));if(_0x2af91f[_0x07a4('0x11')]){if(_0x2af91f['error'][_0x07a4('0x12')]===0x1f4){logger[_0x07a4('0x11')](_0x07a4('0xd'),_0x1def9b,_0x2af91f[_0x07a4('0x11')]['message']);return _0x483876(_0x2af91f[_0x07a4('0x11')][_0x07a4('0x13')]);}logger[_0x07a4('0x11')](_0x07a4('0xd'),_0x1def9b,_0x2af91f['error'][_0x07a4('0x13')]);return _0x2aa109(_0x2af91f[_0x07a4('0x11')][_0x07a4('0x13')]);}else{logger[_0x07a4('0xc')](_0x07a4('0xd'),_0x1def9b,_0x07a4('0xf'));_0x2aa109(_0x2af91f[_0x07a4('0x14')][_0x07a4('0x13')]);}})[_0x07a4('0x15')](function(_0x5e4c88){logger['error'](_0x07a4('0xd'),_0x1def9b,_0x5e4c88);_0x483876(_0x5e4c88);});});}exports['GetDynamics365Account']=function(_0x2a9398){var _0x593b79=this;return new Promise(function(_0x134439,_0x173b40){return db[_0x07a4('0x16')]['findAll']({'raw':_0x2a9398[_0x07a4('0x17')]?_0x2a9398['options'][_0x07a4('0x18')]===undefined?!![]:![]:!![],'where':_0x2a9398['options']?_0x2a9398[_0x07a4('0x17')][_0x07a4('0x19')]||null:null,'attributes':_0x2a9398[_0x07a4('0x17')]?_0x2a9398[_0x07a4('0x17')][_0x07a4('0x1a')]||null:null,'limit':_0x2a9398[_0x07a4('0x17')]?_0x2a9398[_0x07a4('0x17')][_0x07a4('0x1b')]||null:null,'include':_0x2a9398[_0x07a4('0x17')]?_0x2a9398[_0x07a4('0x17')][_0x07a4('0x1c')]?_[_0x07a4('0x1d')](_0x2a9398['options'][_0x07a4('0x1c')],function(_0x357d98){return{'model':db[_0x357d98['model']],'as':_0x357d98['as'],'attributes':_0x357d98[_0x07a4('0x1a')],'include':_0x357d98['include']?_[_0x07a4('0x1d')](_0x357d98[_0x07a4('0x1c')],function(_0x559164){return{'model':db[_0x559164[_0x07a4('0x1e')]],'as':_0x559164['as'],'attributes':_0x559164[_0x07a4('0x1a')],'include':_0x559164[_0x07a4('0x1c')]?_[_0x07a4('0x1d')](_0x559164[_0x07a4('0x1c')],function(_0x340452){return{'model':db[_0x340452['model']],'as':_0x340452['as'],'attributes':_0x340452['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49e4d5){logger[_0x07a4('0xc')](_0x07a4('0x1f'),_0x2a9398);logger[_0x07a4('0x20')](_0x07a4('0x1f'),_0x2a9398,JSON[_0x07a4('0x10')](_0x49e4d5));_0x134439(_0x49e4d5);})[_0x07a4('0x15')](function(_0x38741e){logger[_0x07a4('0x11')](_0x07a4('0x1f'),_0x38741e[_0x07a4('0x13')],_0x2a9398);_0x173b40(_0x593b79[_0x07a4('0x11')](0x1f4,_0x38741e[_0x07a4('0x13')]));});});};exports[_0x07a4('0x21')]=function(_0x57688e){var _0x96160c=this;return new Promise(function(_0x2be03b,_0x171d1e){return db[_0x07a4('0x16')][_0x07a4('0x22')]({'raw':_0x57688e[_0x07a4('0x17')]?_0x57688e[_0x07a4('0x17')][_0x07a4('0x18')]===undefined?!![]:![]:!![],'where':_0x57688e[_0x07a4('0x17')]?_0x57688e['options'][_0x07a4('0x19')]||null:null,'attributes':_0x57688e[_0x07a4('0x17')]?_0x57688e[_0x07a4('0x17')]['attributes']||null:null,'include':_0x57688e[_0x07a4('0x17')]?_0x57688e[_0x07a4('0x17')][_0x07a4('0x1c')]?_['map'](_0x57688e[_0x07a4('0x17')][_0x07a4('0x1c')],function(_0x252ca3){return{'model':db[_0x252ca3['model']],'as':_0x252ca3['as'],'attributes':_0x252ca3[_0x07a4('0x1a')],'include':_0x252ca3[_0x07a4('0x1c')]?_[_0x07a4('0x1d')](_0x252ca3[_0x07a4('0x1c')],function(_0x51c749){return{'model':db[_0x51c749[_0x07a4('0x1e')]],'as':_0x51c749['as'],'attributes':_0x51c749[_0x07a4('0x1a')],'include':_0x51c749[_0x07a4('0x1c')]?_[_0x07a4('0x1d')](_0x51c749[_0x07a4('0x1c')],function(_0x8104ab){return{'model':db[_0x8104ab[_0x07a4('0x1e')]],'as':_0x8104ab['as'],'attributes':_0x8104ab[_0x07a4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11c273){logger['info'](_0x07a4('0x21'),_0x57688e);logger[_0x07a4('0x20')](_0x07a4('0x21'),_0x57688e,JSON['stringify'](_0x11c273));_0x2be03b(_0x11c273);})[_0x07a4('0x15')](function(_0x2a527a){logger[_0x07a4('0x11')](_0x07a4('0x21'),_0x2a527a[_0x07a4('0x13')],_0x57688e);_0x171d1e(_0x96160c[_0x07a4('0x11')](0x1f4,_0x2a527a[_0x07a4('0x13')]));});});}; \ No newline at end of file +var _0xdfa0=['jayson/promise','http','request','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','map','include','model','attributes','then','info','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x10bbd1,_0x4a57fe){var _0x200332=function(_0x551723){while(--_0x551723){_0x10bbd1['push'](_0x10bbd1['shift']());}};_0x200332(++_0x4a57fe);}(_0xdfa0,0xf9));var _0x0dfa=function(_0x73ce62,_0x2f7f88){_0x73ce62=_0x73ce62-0x0;var _0x45467e=_0xdfa0[_0x73ce62];return _0x45467e;};'use strict';var _=require(_0x0dfa('0x0'));var util=require(_0x0dfa('0x1'));var moment=require(_0x0dfa('0x2'));var BPromise=require(_0x0dfa('0x3'));var rs=require(_0x0dfa('0x4'));var fs=require('fs');var Redis=require(_0x0dfa('0x5'));var db=require(_0x0dfa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0dfa('0x7'))(_0x0dfa('0x8'));var config=require(_0x0dfa('0x9'));var jayson=require(_0x0dfa('0xa'));var client=jayson['client'][_0x0dfa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa74f63,_0x4a031e,_0x2b5556){return new BPromise(function(_0x411c53,_0x2bd38e){return client[_0x0dfa('0xc')](_0xa74f63,_0x2b5556)['then'](function(_0x4bf313){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4a031e,'request\x20sent');logger[_0x0dfa('0xd')](_0x0dfa('0xe'),_0x4a031e,_0x0dfa('0xf'),JSON['stringify'](_0x4bf313));if(_0x4bf313[_0x0dfa('0x10')]){if(_0x4bf313['error'][_0x0dfa('0x11')]===0x1f4){logger[_0x0dfa('0x10')](_0x0dfa('0x12'),_0x4a031e,_0x4bf313[_0x0dfa('0x10')][_0x0dfa('0x13')]);return _0x2bd38e(_0x4bf313[_0x0dfa('0x10')][_0x0dfa('0x13')]);}logger[_0x0dfa('0x10')](_0x0dfa('0x12'),_0x4a031e,_0x4bf313[_0x0dfa('0x10')][_0x0dfa('0x13')]);return _0x411c53(_0x4bf313[_0x0dfa('0x10')][_0x0dfa('0x13')]);}else{logger['info'](_0x0dfa('0x12'),_0x4a031e,_0x0dfa('0xf'));_0x411c53(_0x4bf313[_0x0dfa('0x14')]['message']);}})[_0x0dfa('0x15')](function(_0x476984){logger[_0x0dfa('0x10')](_0x0dfa('0x12'),_0x4a031e,_0x476984);_0x2bd38e(_0x476984);});});}exports[_0x0dfa('0x16')]=function(_0x10eda){var _0x489e7d=this;return new Promise(function(_0x4cca2a,_0x534c9f){return db[_0x0dfa('0x17')]['findAll']({'raw':_0x10eda[_0x0dfa('0x18')]?_0x10eda['options'][_0x0dfa('0x19')]===undefined?!![]:![]:!![],'where':_0x10eda['options']?_0x10eda[_0x0dfa('0x18')][_0x0dfa('0x1a')]||null:null,'attributes':_0x10eda[_0x0dfa('0x18')]?_0x10eda[_0x0dfa('0x18')]['attributes']||null:null,'limit':_0x10eda['options']?_0x10eda[_0x0dfa('0x18')][_0x0dfa('0x1b')]||null:null,'include':_0x10eda[_0x0dfa('0x18')]?_0x10eda[_0x0dfa('0x18')]['include']?_[_0x0dfa('0x1c')](_0x10eda[_0x0dfa('0x18')][_0x0dfa('0x1d')],function(_0x5ea717){return{'model':db[_0x5ea717[_0x0dfa('0x1e')]],'as':_0x5ea717['as'],'attributes':_0x5ea717[_0x0dfa('0x1f')],'include':_0x5ea717[_0x0dfa('0x1d')]?_[_0x0dfa('0x1c')](_0x5ea717[_0x0dfa('0x1d')],function(_0x55f0fa){return{'model':db[_0x55f0fa[_0x0dfa('0x1e')]],'as':_0x55f0fa['as'],'attributes':_0x55f0fa['attributes'],'include':_0x55f0fa[_0x0dfa('0x1d')]?_[_0x0dfa('0x1c')](_0x55f0fa[_0x0dfa('0x1d')],function(_0x16e104){return{'model':db[_0x16e104[_0x0dfa('0x1e')]],'as':_0x16e104['as'],'attributes':_0x16e104['attributes']};}):[]};}):[]};}):[]:[]})[_0x0dfa('0x20')](function(_0x464f6d){logger[_0x0dfa('0x21')](_0x0dfa('0x16'),_0x10eda);logger[_0x0dfa('0xd')](_0x0dfa('0x16'),_0x10eda,JSON[_0x0dfa('0x22')](_0x464f6d));_0x4cca2a(_0x464f6d);})[_0x0dfa('0x15')](function(_0x533cd8){logger['error'](_0x0dfa('0x16'),_0x533cd8[_0x0dfa('0x13')],_0x10eda);_0x534c9f(_0x489e7d['error'](0x1f4,_0x533cd8[_0x0dfa('0x13')]));});});};exports[_0x0dfa('0x23')]=function(_0x4f059b){var _0x223252=this;return new Promise(function(_0x1c99bf,_0x333882){return db['Dynamics365Account'][_0x0dfa('0x24')]({'raw':_0x4f059b[_0x0dfa('0x18')]?_0x4f059b['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f059b[_0x0dfa('0x18')]?_0x4f059b['options'][_0x0dfa('0x1a')]||null:null,'attributes':_0x4f059b[_0x0dfa('0x18')]?_0x4f059b['options'][_0x0dfa('0x1f')]||null:null,'include':_0x4f059b[_0x0dfa('0x18')]?_0x4f059b['options']['include']?_[_0x0dfa('0x1c')](_0x4f059b['options'][_0x0dfa('0x1d')],function(_0x783d04){return{'model':db[_0x783d04['model']],'as':_0x783d04['as'],'attributes':_0x783d04[_0x0dfa('0x1f')],'include':_0x783d04['include']?_['map'](_0x783d04[_0x0dfa('0x1d')],function(_0x16182e){return{'model':db[_0x16182e[_0x0dfa('0x1e')]],'as':_0x16182e['as'],'attributes':_0x16182e[_0x0dfa('0x1f')],'include':_0x16182e['include']?_[_0x0dfa('0x1c')](_0x16182e[_0x0dfa('0x1d')],function(_0x375bd2){return{'model':db[_0x375bd2['model']],'as':_0x375bd2['as'],'attributes':_0x375bd2[_0x0dfa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0dfa('0x20')](function(_0x1a515d){logger['info']('ShowDynamics365Account',_0x4f059b);logger[_0x0dfa('0xd')]('ShowDynamics365Account',_0x4f059b,JSON['stringify'](_0x1a515d));_0x1c99bf(_0x1a515d);})[_0x0dfa('0x15')](function(_0x54ef82){logger[_0x0dfa('0x10')](_0x0dfa('0x23'),_0x54ef82[_0x0dfa('0x13')],_0x4f059b);_0x333882(_0x223252[_0x0dfa('0x10')](0x1f4,_0x54ef82['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ef9e6e6..ff17546 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 _0x9ba6=['isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./intDynamics365Configuration.controller','get'];(function(_0x453f0c,_0x5f1d53){var _0x204e8f=function(_0x48c6a5){while(--_0x48c6a5){_0x453f0c['push'](_0x453f0c['shift']());}};_0x204e8f(++_0x5f1d53);}(_0x9ba6,0x13b));var _0x69ba=function(_0x2497b1,_0x1920dd){_0x2497b1=_0x2497b1-0x0;var _0x33c111=_0x9ba6[_0x2497b1];return _0x33c111;};'use strict';var multer=require(_0x69ba('0x0'));var util=require('util');var path=require(_0x69ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x69ba('0x2'));var router=express['Router']();var fs_extra=require(_0x69ba('0x3'));var auth=require(_0x69ba('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x69ba('0x5'));router[_0x69ba('0x6')]('/',auth[_0x69ba('0x7')](),controller[_0x69ba('0x8')]);router[_0x69ba('0x6')](_0x69ba('0x9'),auth[_0x69ba('0x7')](),controller[_0x69ba('0xa')]);router['get'](_0x69ba('0xb'),auth[_0x69ba('0x7')](),controller['getFields']);router['get'](_0x69ba('0xc'),auth[_0x69ba('0x7')](),controller[_0x69ba('0xd')]);router['get'](_0x69ba('0xe'),auth[_0x69ba('0x7')](),controller[_0x69ba('0xf')]);router[_0x69ba('0x10')]('/',auth['isAuthenticated'](),controller[_0x69ba('0x11')]);router[_0x69ba('0x12')](_0x69ba('0x9'),auth[_0x69ba('0x7')](),controller[_0x69ba('0x13')]);router[_0x69ba('0x14')]('/:id',auth[_0x69ba('0x7')](),controller[_0x69ba('0x15')]);module[_0x69ba('0x16')]=router; \ No newline at end of file +var _0x8b38=['../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x77eff9,_0xb87810){var _0x23b5b4=function(_0x2c116b){while(--_0x2c116b){_0x77eff9['push'](_0x77eff9['shift']());}};_0x23b5b4(++_0xb87810);}(_0x8b38,0x159));var _0x88b3=function(_0x18d29b,_0x3034d2){_0x18d29b=_0x18d29b-0x0;var _0x3c354f=_0x8b38[_0x18d29b];return _0x3c354f;};'use strict';var multer=require(_0x88b3('0x0'));var util=require(_0x88b3('0x1'));var path=require(_0x88b3('0x2'));var timeout=require(_0x88b3('0x3'));var express=require(_0x88b3('0x4'));var router=express['Router']();var fs_extra=require(_0x88b3('0x5'));var auth=require(_0x88b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x88b3('0x7'));var controller=require(_0x88b3('0x8'));router[_0x88b3('0x9')]('/',auth[_0x88b3('0xa')](),controller[_0x88b3('0xb')]);router[_0x88b3('0x9')](_0x88b3('0xc'),auth[_0x88b3('0xa')](),controller[_0x88b3('0xd')]);router['get'](_0x88b3('0xe'),auth[_0x88b3('0xa')](),controller[_0x88b3('0xf')]);router[_0x88b3('0x9')](_0x88b3('0x10'),auth[_0x88b3('0xa')](),controller['getSubjects']);router[_0x88b3('0x9')]('/:id/descriptions',auth[_0x88b3('0xa')](),controller[_0x88b3('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x88b3('0x12')]);router['put'](_0x88b3('0xc'),auth['isAuthenticated'](),controller[_0x88b3('0x13')]);router[_0x88b3('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x88b3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c293b00..b6e6cdb 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 _0x69dc=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x193e72,_0x366193){var _0x5f1f76=function(_0x24f7fb){while(--_0x24f7fb){_0x193e72['push'](_0x193e72['shift']());}};_0x5f1f76(++_0x366193);}(_0x69dc,0x165));var _0xc69d=function(_0x594b61,_0xffafb4){_0x594b61=_0x594b61-0x0;var _0x540617=_0x69dc[_0x594b61];return _0x540617;};'use strict';var Sequelize=require(_0xc69d('0x0'));module[_0xc69d('0x1')]={'name':{'type':Sequelize[_0xc69d('0x2')]},'description':{'type':Sequelize[_0xc69d('0x2')]},'ticketType':{'type':Sequelize[_0xc69d('0x3')](_0xc69d('0x4'),_0xc69d('0x5')),'defaultValue':_0xc69d('0x4')}}; \ No newline at end of file +var _0x1798=['STRING','ENUM','phonecall','incident','sequelize','exports'];(function(_0x1ffff7,_0x2f9ff6){var _0x49d017=function(_0x1d2483){while(--_0x1d2483){_0x1ffff7['push'](_0x1ffff7['shift']());}};_0x49d017(++_0x2f9ff6);}(_0x1798,0xd6));var _0x8179=function(_0x1773b2,_0x1c7f52){_0x1773b2=_0x1773b2-0x0;var _0xd01012=_0x1798[_0x1773b2];return _0xd01012;};'use strict';var Sequelize=require(_0x8179('0x0'));module[_0x8179('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8179('0x2')]},'ticketType':{'type':Sequelize[_0x8179('0x3')]('incident',_0x8179('0x4')),'defaultValue':_0x8179('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8a412c2..b9db76a 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 _0x1f18=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','Dynamics365Configuration','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','getFields','findOne','options','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f18,0x124));var _0x81f1=function(_0x5e4dfe,_0x5da9b1){_0x5e4dfe=_0x5e4dfe-0x0;var _0x1bf26d=_0x1f18[_0x5e4dfe];return _0x1bf26d;};'use strict';var emlformat=require(_0x81f1('0x0'));var rimraf=require(_0x81f1('0x1'));var zipdir=require(_0x81f1('0x2'));var jsonpatch=require(_0x81f1('0x3'));var rp=require(_0x81f1('0x4'));var moment=require(_0x81f1('0x5'));var BPromise=require(_0x81f1('0x6'));var Mustache=require(_0x81f1('0x7'));var util=require(_0x81f1('0x8'));var path=require(_0x81f1('0x9'));var sox=require(_0x81f1('0xa'));var csv=require(_0x81f1('0xb'));var ejs=require(_0x81f1('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81f1('0xd'));var squel=require(_0x81f1('0xe'));var crypto=require(_0x81f1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x81f1('0x10'));var toCsv=require(_0x81f1('0xb'));var querystring=require('querystring');var Papa=require(_0x81f1('0x11'));var Redis=require(_0x81f1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x81f1('0x13'));var as=require(_0x81f1('0x14'));var hardwareService=require(_0x81f1('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x81f1('0x16'));var config=require(_0x81f1('0x17'));var licenseUtil=require(_0x81f1('0x18'));var db=require(_0x81f1('0x19'))['db'];function respondWithStatusCode(_0x27c10b,_0x5ed016){_0x5ed016=_0x5ed016||0xcc;return function(_0x18a3cf){if(_0x18a3cf){return _0x27c10b[_0x81f1('0x1a')](_0x5ed016);}return _0x27c10b[_0x81f1('0x1b')](_0x5ed016)[_0x81f1('0x1c')]();};}function respondWithResult(_0x4797ff,_0x3f5321){_0x3f5321=_0x3f5321||0xc8;return function(_0x3f09c0){if(_0x3f09c0){return _0x4797ff[_0x81f1('0x1b')](_0x3f5321)[_0x81f1('0x1d')](_0x3f09c0);}};}function respondWithFilteredResult(_0x3d30a8,_0x30a9b1){return function(_0x5f22a9){if(_0x5f22a9){var _0x9f6b5d=typeof _0x30a9b1[_0x81f1('0x1e')]===_0x81f1('0x1f')&&typeof _0x30a9b1['limit']===_0x81f1('0x1f');var _0x76b832=_0x5f22a9[_0x81f1('0x20')];var _0x3277ec=_0x9f6b5d?0x0:_0x30a9b1[_0x81f1('0x1e')];var _0x3c567e=_0x9f6b5d?_0x5f22a9[_0x81f1('0x20')]:_0x30a9b1['offset']+_0x30a9b1[_0x81f1('0x21')];var _0x5a4786;if(_0x3c567e>=_0x76b832){_0x3c567e=_0x76b832;_0x5a4786=0xc8;}else{_0x5a4786=0xce;}_0x3d30a8[_0x81f1('0x1b')](_0x5a4786);return _0x3d30a8[_0x81f1('0x22')](_0x81f1('0x23'),_0x3277ec+'-'+_0x3c567e+'/'+_0x76b832)[_0x81f1('0x1d')](_0x5f22a9);}return null;};}function patchUpdates(_0x59af1f){return function(_0x5bf985){try{jsonpatch[_0x81f1('0x24')](_0x5bf985,_0x59af1f,!![]);}catch(_0x33602b){return BPromise[_0x81f1('0x25')](_0x33602b);}return _0x5bf985[_0x81f1('0x26')]();};}function saveUpdates(_0x522783,_0xf3c28b){return function(_0x3803c7){if(_0x3803c7){return _0x3803c7[_0x81f1('0x27')](_0x522783)[_0x81f1('0x28')](function(_0x29eaf0){return _0x29eaf0;});}return null;};}function removeEntity(_0x5e17db,_0x544b34){return function(_0x4b583a){if(_0x4b583a){return _0x4b583a[_0x81f1('0x29')]()['then'](function(){_0x5e17db[_0x81f1('0x1b')](0xcc)[_0x81f1('0x1c')]();});}};}function handleEntityNotFound(_0x19f302,_0x505a99){return function(_0x1b9c21){if(!_0x1b9c21){_0x19f302[_0x81f1('0x1a')](0x194);}return _0x1b9c21;};}function handleError(_0x5cd6f9,_0x50c8c5){_0x50c8c5=_0x50c8c5||0x1f4;return function(_0x7c4e40){logger['error'](_0x7c4e40[_0x81f1('0x2a')]);if(_0x7c4e40[_0x81f1('0x2b')]){delete _0x7c4e40[_0x81f1('0x2b')];}_0x5cd6f9[_0x81f1('0x1b')](_0x50c8c5)[_0x81f1('0x2c')](_0x7c4e40);};}exports[_0x81f1('0x2d')]=function(_0x28c7a3,_0x196394){var _0x5402cf={},_0x816a0c={},_0x195cc3={'count':0x0,'rows':[]};var _0x500cf1=_[_0x81f1('0x2e')](db['Dynamics365Configuration'][_0x81f1('0x2f')],function(_0x4a4e74){return{'name':_0x4a4e74[_0x81f1('0x30')],'type':_0x4a4e74['type'][_0x81f1('0x31')]};});_0x816a0c[_0x81f1('0x32')]=_[_0x81f1('0x2e')](_0x500cf1,_0x81f1('0x2b'));_0x816a0c[_0x81f1('0x33')]=_[_0x81f1('0x34')](_0x28c7a3[_0x81f1('0x33')]);_0x816a0c[_0x81f1('0x35')]=_[_0x81f1('0x36')](_0x816a0c[_0x81f1('0x32')],_0x816a0c[_0x81f1('0x33')]);_0x5402cf[_0x81f1('0x37')]=_[_0x81f1('0x36')](_0x816a0c[_0x81f1('0x32')],qs['fields'](_0x28c7a3[_0x81f1('0x33')][_0x81f1('0x38')]));_0x5402cf[_0x81f1('0x37')]=_0x5402cf[_0x81f1('0x37')]['length']?_0x5402cf[_0x81f1('0x37')]:_0x816a0c['model'];if(!_0x28c7a3[_0x81f1('0x33')][_0x81f1('0x39')](_0x81f1('0x3a'))){_0x5402cf['limit']=qs[_0x81f1('0x21')](_0x28c7a3['query'][_0x81f1('0x21')]);_0x5402cf[_0x81f1('0x1e')]=qs[_0x81f1('0x1e')](_0x28c7a3[_0x81f1('0x33')][_0x81f1('0x1e')]);}_0x5402cf[_0x81f1('0x3b')]=qs[_0x81f1('0x3c')](_0x28c7a3[_0x81f1('0x33')][_0x81f1('0x3c')]);_0x5402cf[_0x81f1('0x3d')]=qs[_0x81f1('0x35')](_[_0x81f1('0x3e')](_0x28c7a3['query'],_0x816a0c[_0x81f1('0x35')]),_0x500cf1);if(_0x28c7a3[_0x81f1('0x33')][_0x81f1('0x3f')]){_0x5402cf[_0x81f1('0x3d')]=_[_0x81f1('0x40')](_0x5402cf[_0x81f1('0x3d')],{'$or':_['map'](_0x500cf1,function(_0x1da9c9){if(_0x1da9c9[_0x81f1('0x41')]!==_0x81f1('0x42')){var _0x1e66db={};_0x1e66db[_0x1da9c9['name']]={'$like':'%'+_0x28c7a3[_0x81f1('0x33')]['filter']+'%'};return _0x1e66db;}})});}_0x5402cf=_[_0x81f1('0x40')]({},_0x5402cf,_0x28c7a3['options']);var _0x2e2ddd={'where':_0x5402cf[_0x81f1('0x3d')]};return db[_0x81f1('0x43')][_0x81f1('0x20')](_0x2e2ddd)[_0x81f1('0x28')](function(_0x46e72f){_0x195cc3['count']=_0x46e72f;if(_0x28c7a3[_0x81f1('0x33')][_0x81f1('0x44')]){_0x5402cf[_0x81f1('0x45')]=[{'all':!![]}];}return db[_0x81f1('0x43')][_0x81f1('0x46')](_0x5402cf);})[_0x81f1('0x28')](function(_0x3a0b81){_0x195cc3[_0x81f1('0x47')]=_0x3a0b81;return _0x195cc3;})[_0x81f1('0x28')](respondWithFilteredResult(_0x196394,_0x5402cf))['catch'](handleError(_0x196394,null));};exports[_0x81f1('0x48')]=function(_0x54b6da,_0x6114a){var _0x4f6d2f={'raw':![],'where':{'id':_0x54b6da['params']['id']}},_0x37c50b={};_0x37c50b[_0x81f1('0x32')]=_['keys'](db[_0x81f1('0x43')]['rawAttributes']);_0x37c50b[_0x81f1('0x33')]=_[_0x81f1('0x34')](_0x54b6da[_0x81f1('0x33')]);_0x37c50b[_0x81f1('0x35')]=_[_0x81f1('0x36')](_0x37c50b['model'],_0x37c50b['query']);_0x4f6d2f[_0x81f1('0x37')]=_[_0x81f1('0x36')](_0x37c50b[_0x81f1('0x32')],qs[_0x81f1('0x38')](_0x54b6da[_0x81f1('0x33')][_0x81f1('0x38')]));_0x4f6d2f['attributes']=_0x4f6d2f[_0x81f1('0x37')][_0x81f1('0x49')]?_0x4f6d2f[_0x81f1('0x37')]:_0x37c50b[_0x81f1('0x32')];if(_0x54b6da[_0x81f1('0x33')][_0x81f1('0x44')]){_0x4f6d2f[_0x81f1('0x45')]=[{'all':!![]}];}_0x4f6d2f=_['merge']({},_0x4f6d2f,_0x54b6da['options']);return db[_0x81f1('0x43')][_0x81f1('0x4a')](_0x4f6d2f)[_0x81f1('0x28')](handleEntityNotFound(_0x6114a,null))[_0x81f1('0x28')](respondWithResult(_0x6114a,null))[_0x81f1('0x4b')](handleError(_0x6114a,null));};exports[_0x81f1('0x4c')]=function(_0x36e8f0,_0x40b741){return db['Dynamics365Configuration']['create'](_0x36e8f0[_0x81f1('0x4d')],{})[_0x81f1('0x28')](respondWithResult(_0x40b741,0xc9))['catch'](handleError(_0x40b741,null));};exports[_0x81f1('0x27')]=function(_0x1a4390,_0x214ae9){if(_0x1a4390[_0x81f1('0x4d')]['id']){delete _0x1a4390['body']['id'];}return db[_0x81f1('0x43')]['find']({'where':{'id':_0x1a4390[_0x81f1('0x4e')]['id']}})[_0x81f1('0x28')](handleEntityNotFound(_0x214ae9,null))[_0x81f1('0x28')](saveUpdates(_0x1a4390[_0x81f1('0x4d')],null))[_0x81f1('0x28')](respondWithResult(_0x214ae9,null))[_0x81f1('0x4b')](handleError(_0x214ae9,null));};exports[_0x81f1('0x29')]=function(_0x27da92,_0x4b7b27){return db[_0x81f1('0x43')]['find']({'where':{'id':_0x27da92[_0x81f1('0x4e')]['id']}})[_0x81f1('0x28')](handleEntityNotFound(_0x4b7b27,null))[_0x81f1('0x28')](removeEntity(_0x4b7b27,null))[_0x81f1('0x4b')](handleError(_0x4b7b27,null));};exports[_0x81f1('0x4f')]=function(_0x196989,_0xf778ba,_0x410df5){var _0x69d666={};var _0x1c34f8={};var _0x1d5b5c;var _0x599677;return db['Dynamics365Configuration'][_0x81f1('0x50')]({'where':{'id':_0x196989[_0x81f1('0x4e')]['id']}})[_0x81f1('0x28')](handleEntityNotFound(_0xf778ba,null))[_0x81f1('0x28')](function(_0x223c01){if(_0x223c01){_0x1d5b5c=_0x223c01;_0x1c34f8[_0x81f1('0x32')]=_['keys'](db['Dynamics365Field'][_0x81f1('0x2f')]);_0x1c34f8[_0x81f1('0x33')]=_['keys'](_0x196989[_0x81f1('0x33')]);_0x1c34f8['filters']=_[_0x81f1('0x36')](_0x1c34f8[_0x81f1('0x32')],_0x1c34f8[_0x81f1('0x33')]);_0x69d666[_0x81f1('0x37')]=_[_0x81f1('0x36')](_0x1c34f8[_0x81f1('0x32')],qs[_0x81f1('0x38')](_0x196989['query'][_0x81f1('0x38')]));_0x69d666['attributes']=_0x69d666[_0x81f1('0x37')][_0x81f1('0x49')]?_0x69d666['attributes']:_0x1c34f8[_0x81f1('0x32')];_0x69d666[_0x81f1('0x3b')]=qs[_0x81f1('0x3c')](_0x196989['query'][_0x81f1('0x3c')]);_0x69d666[_0x81f1('0x3d')]=qs['filters'](_[_0x81f1('0x3e')](_0x196989[_0x81f1('0x33')],_0x1c34f8['filters']));if(_0x196989[_0x81f1('0x33')][_0x81f1('0x3f')]){_0x69d666[_0x81f1('0x3d')]=_[_0x81f1('0x40')](_0x69d666[_0x81f1('0x3d')],{'$or':_[_0x81f1('0x2e')](_0x69d666['attributes'],function(_0x391929){var _0x5f1a78={};_0x5f1a78[_0x391929]={'$like':'%'+_0x196989[_0x81f1('0x33')][_0x81f1('0x3f')]+'%'};return _0x5f1a78;})});}_0x69d666=_[_0x81f1('0x40')]({},_0x69d666,_0x196989[_0x81f1('0x51')]);return _0x1d5b5c[_0x81f1('0x4f')](_0x69d666);}})[_0x81f1('0x28')](function(_0x36841b){if(_0x36841b){_0x599677=_0x36841b[_0x81f1('0x49')];if(!_0x196989[_0x81f1('0x33')][_0x81f1('0x39')]('nolimit')){_0x69d666['limit']=qs[_0x81f1('0x21')](_0x196989['query'][_0x81f1('0x21')]);_0x69d666[_0x81f1('0x1e')]=qs[_0x81f1('0x1e')](_0x196989[_0x81f1('0x33')]['offset']);}return _0x1d5b5c[_0x81f1('0x4f')](_0x69d666);}})[_0x81f1('0x28')](function(_0x5a6214){if(_0x5a6214){return _0x5a6214?{'count':_0x599677,'rows':_0x5a6214}:null;}})[_0x81f1('0x28')](respondWithResult(_0xf778ba,null))[_0x81f1('0x4b')](handleError(_0xf778ba,null));};exports[_0x81f1('0x52')]=function(_0x5e6115,_0x4a9f60,_0x2b878b){var _0x3669a3={};var _0x3919dd={};var _0x3f0fdd;var _0xab6583;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5e6115[_0x81f1('0x4e')]['id']}})[_0x81f1('0x28')](handleEntityNotFound(_0x4a9f60,null))[_0x81f1('0x28')](function(_0x233818){if(_0x233818){_0x3f0fdd=_0x233818;_0x3919dd['model']=_[_0x81f1('0x34')](db[_0x81f1('0x53')][_0x81f1('0x2f')]);_0x3919dd[_0x81f1('0x33')]=_['keys'](_0x5e6115['query']);_0x3919dd[_0x81f1('0x35')]=_[_0x81f1('0x36')](_0x3919dd[_0x81f1('0x32')],_0x3919dd['query']);_0x3669a3[_0x81f1('0x37')]=_[_0x81f1('0x36')](_0x3919dd['model'],qs[_0x81f1('0x38')](_0x5e6115['query'][_0x81f1('0x38')]));_0x3669a3[_0x81f1('0x37')]=_0x3669a3[_0x81f1('0x37')][_0x81f1('0x49')]?_0x3669a3[_0x81f1('0x37')]:_0x3919dd[_0x81f1('0x32')];_0x3669a3[_0x81f1('0x3b')]=qs[_0x81f1('0x3c')](_0x5e6115[_0x81f1('0x33')][_0x81f1('0x3c')]);_0x3669a3[_0x81f1('0x3d')]=qs[_0x81f1('0x35')](_[_0x81f1('0x3e')](_0x5e6115[_0x81f1('0x33')],_0x3919dd[_0x81f1('0x35')]));if(_0x5e6115[_0x81f1('0x33')]['filter']){_0x3669a3[_0x81f1('0x3d')]=_[_0x81f1('0x40')](_0x3669a3['where'],{'$or':_[_0x81f1('0x2e')](_0x3669a3['attributes'],function(_0x550531){var _0x5731e8={};_0x5731e8[_0x550531]={'$like':'%'+_0x5e6115[_0x81f1('0x33')][_0x81f1('0x3f')]+'%'};return _0x5731e8;})});}_0x3669a3=_[_0x81f1('0x40')]({},_0x3669a3,_0x5e6115['options']);return _0x3f0fdd[_0x81f1('0x52')](_0x3669a3);}})['then'](function(_0x3ddfd8){if(_0x3ddfd8){_0xab6583=_0x3ddfd8[_0x81f1('0x49')];if(!_0x5e6115[_0x81f1('0x33')][_0x81f1('0x39')](_0x81f1('0x3a'))){_0x3669a3[_0x81f1('0x21')]=qs['limit'](_0x5e6115[_0x81f1('0x33')][_0x81f1('0x21')]);_0x3669a3[_0x81f1('0x1e')]=qs[_0x81f1('0x1e')](_0x5e6115['query'][_0x81f1('0x1e')]);}return _0x3f0fdd[_0x81f1('0x52')](_0x3669a3);}})['then'](function(_0x341c54){if(_0x341c54){return _0x341c54?{'count':_0xab6583,'rows':_0x341c54}:null;}})[_0x81f1('0x28')](respondWithResult(_0x4a9f60,null))['catch'](handleError(_0x4a9f60,null));};exports[_0x81f1('0x54')]=function(_0x438013,_0x365900,_0x3c92fa){var _0x4e667c={};var _0x2b3920={};var _0x1b05e9;var _0x3fc275;return db[_0x81f1('0x43')][_0x81f1('0x50')]({'where':{'id':_0x438013[_0x81f1('0x4e')]['id']}})[_0x81f1('0x28')](handleEntityNotFound(_0x365900,null))[_0x81f1('0x28')](function(_0x644e58){if(_0x644e58){_0x1b05e9=_0x644e58;_0x2b3920[_0x81f1('0x32')]=_[_0x81f1('0x34')](db['Dynamics365Field']['rawAttributes']);_0x2b3920['query']=_['keys'](_0x438013['query']);_0x2b3920['filters']=_[_0x81f1('0x36')](_0x2b3920[_0x81f1('0x32')],_0x2b3920[_0x81f1('0x33')]);_0x4e667c[_0x81f1('0x37')]=_[_0x81f1('0x36')](_0x2b3920['model'],qs[_0x81f1('0x38')](_0x438013['query'][_0x81f1('0x38')]));_0x4e667c[_0x81f1('0x37')]=_0x4e667c[_0x81f1('0x37')][_0x81f1('0x49')]?_0x4e667c[_0x81f1('0x37')]:_0x2b3920[_0x81f1('0x32')];_0x4e667c[_0x81f1('0x3b')]=qs['sort'](_0x438013['query'][_0x81f1('0x3c')]);_0x4e667c[_0x81f1('0x3d')]=qs[_0x81f1('0x35')](_[_0x81f1('0x3e')](_0x438013['query'],_0x2b3920[_0x81f1('0x35')]));if(_0x438013[_0x81f1('0x33')][_0x81f1('0x3f')]){_0x4e667c['where']=_[_0x81f1('0x40')](_0x4e667c[_0x81f1('0x3d')],{'$or':_[_0x81f1('0x2e')](_0x4e667c['attributes'],function(_0x31cd0c){var _0x5170d9={};_0x5170d9[_0x31cd0c]={'$like':'%'+_0x438013[_0x81f1('0x33')][_0x81f1('0x3f')]+'%'};return _0x5170d9;})});}_0x4e667c=_[_0x81f1('0x40')]({},_0x4e667c,_0x438013[_0x81f1('0x51')]);return _0x1b05e9[_0x81f1('0x54')](_0x4e667c);}})['then'](function(_0x5e51b1){if(_0x5e51b1){_0x3fc275=_0x5e51b1[_0x81f1('0x49')];if(!_0x438013[_0x81f1('0x33')][_0x81f1('0x39')]('nolimit')){_0x4e667c['limit']=qs[_0x81f1('0x21')](_0x438013[_0x81f1('0x33')][_0x81f1('0x21')]);_0x4e667c[_0x81f1('0x1e')]=qs['offset'](_0x438013[_0x81f1('0x33')]['offset']);}return _0x1b05e9['getDescriptions'](_0x4e667c);}})[_0x81f1('0x28')](function(_0x33dcb6){if(_0x33dcb6){return _0x33dcb6?{'count':_0x3fc275,'rows':_0x33dcb6}:null;}})['then'](respondWithResult(_0x365900,null))['catch'](handleError(_0x365900,null));}; \ No newline at end of file +var _0x0c04=['filter','findOne','pick','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','apply','reject','update','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','options','then','includeAll','rows','params','Dynamics365Configuration','filters','include','find','catch','create','body','getFields','Dynamics365Field'];(function(_0x5c4af3,_0x19bad6){var _0x47a332=function(_0x439d75){while(--_0x439d75){_0x5c4af3['push'](_0x5c4af3['shift']());}};_0x47a332(++_0x19bad6);}(_0x0c04,0x178));var _0x40c0=function(_0x39d8b3,_0x5956b5){_0x39d8b3=_0x39d8b3-0x0;var _0x4c34ab=_0x0c04[_0x39d8b3];return _0x4c34ab;};'use strict';var emlformat=require(_0x40c0('0x0'));var rimraf=require(_0x40c0('0x1'));var zipdir=require(_0x40c0('0x2'));var jsonpatch=require(_0x40c0('0x3'));var rp=require(_0x40c0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x40c0('0x5'));var sox=require(_0x40c0('0x6'));var csv=require('to-csv');var ejs=require(_0x40c0('0x7'));var fs=require('fs');var fs_extra=require(_0x40c0('0x8'));var _=require(_0x40c0('0x9'));var squel=require(_0x40c0('0xa'));var crypto=require(_0x40c0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x40c0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x40c0('0xd'));var Papa=require('papaparse');var Redis=require(_0x40c0('0xe'));var authService=require(_0x40c0('0xf'));var qs=require(_0x40c0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40c0('0x11'));var logger=require(_0x40c0('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x40c0('0x13'));var db=require(_0x40c0('0x14'))['db'];function respondWithStatusCode(_0x3a9103,_0x428fc4){_0x428fc4=_0x428fc4||0xcc;return function(_0xd0bfe2){if(_0xd0bfe2){return _0x3a9103[_0x40c0('0x15')](_0x428fc4);}return _0x3a9103['status'](_0x428fc4)[_0x40c0('0x16')]();};}function respondWithResult(_0x4c6890,_0x45957b){_0x45957b=_0x45957b||0xc8;return function(_0x58855e){if(_0x58855e){return _0x4c6890['status'](_0x45957b)[_0x40c0('0x17')](_0x58855e);}};}function respondWithFilteredResult(_0x4442a5,_0x33033b){return function(_0x5b3eba){if(_0x5b3eba){var _0x2ac487=typeof _0x33033b['offset']===_0x40c0('0x18')&&typeof _0x33033b[_0x40c0('0x19')]===_0x40c0('0x18');var _0x5df38f=_0x5b3eba[_0x40c0('0x1a')];var _0x316fde=_0x2ac487?0x0:_0x33033b[_0x40c0('0x1b')];var _0xb7b96=_0x2ac487?_0x5b3eba[_0x40c0('0x1a')]:_0x33033b['offset']+_0x33033b['limit'];var _0x2f34c9;if(_0xb7b96>=_0x5df38f){_0xb7b96=_0x5df38f;_0x2f34c9=0xc8;}else{_0x2f34c9=0xce;}_0x4442a5[_0x40c0('0x1c')](_0x2f34c9);return _0x4442a5['set'](_0x40c0('0x1d'),_0x316fde+'-'+_0xb7b96+'/'+_0x5df38f)[_0x40c0('0x17')](_0x5b3eba);}return null;};}function patchUpdates(_0x392bcc){return function(_0x20048d){try{jsonpatch[_0x40c0('0x1e')](_0x20048d,_0x392bcc,!![]);}catch(_0x5161bd){return BPromise[_0x40c0('0x1f')](_0x5161bd);}return _0x20048d['save']();};}function saveUpdates(_0x91a48f,_0x57be58){return function(_0x435022){if(_0x435022){return _0x435022[_0x40c0('0x20')](_0x91a48f)['then'](function(_0x3dc7e5){return _0x3dc7e5;});}return null;};}function removeEntity(_0x383926,_0xbb71e8){return function(_0x38b0ff){if(_0x38b0ff){return _0x38b0ff['destroy']()['then'](function(){_0x383926['status'](0xcc)[_0x40c0('0x16')]();});}};}function handleEntityNotFound(_0x18b24c,_0x2e6a38){return function(_0x2650b7){if(!_0x2650b7){_0x18b24c['sendStatus'](0x194);}return _0x2650b7;};}function handleError(_0x1daa6f,_0xb17089){_0xb17089=_0xb17089||0x1f4;return function(_0x19ad36){logger[_0x40c0('0x21')](_0x19ad36[_0x40c0('0x22')]);if(_0x19ad36[_0x40c0('0x23')]){delete _0x19ad36[_0x40c0('0x23')];}_0x1daa6f['status'](_0xb17089)[_0x40c0('0x24')](_0x19ad36);};}exports['index']=function(_0x191f40,_0x39f14b){var _0x5b2e19={},_0x19201d={},_0x2a5667={'count':0x0,'rows':[]};var _0x57a6b8=_[_0x40c0('0x25')](db['Dynamics365Configuration'][_0x40c0('0x26')],function(_0x2070e8){return{'name':_0x2070e8[_0x40c0('0x27')],'type':_0x2070e8['type']['key']};});_0x19201d[_0x40c0('0x28')]=_[_0x40c0('0x25')](_0x57a6b8,'name');_0x19201d[_0x40c0('0x29')]=_[_0x40c0('0x2a')](_0x191f40[_0x40c0('0x29')]);_0x19201d['filters']=_[_0x40c0('0x2b')](_0x19201d[_0x40c0('0x28')],_0x19201d['query']);_0x5b2e19[_0x40c0('0x2c')]=_[_0x40c0('0x2b')](_0x19201d['model'],qs[_0x40c0('0x2d')](_0x191f40[_0x40c0('0x29')][_0x40c0('0x2d')]));_0x5b2e19['attributes']=_0x5b2e19[_0x40c0('0x2c')][_0x40c0('0x2e')]?_0x5b2e19[_0x40c0('0x2c')]:_0x19201d[_0x40c0('0x28')];if(!_0x191f40[_0x40c0('0x29')][_0x40c0('0x2f')]('nolimit')){_0x5b2e19[_0x40c0('0x19')]=qs[_0x40c0('0x19')](_0x191f40[_0x40c0('0x29')][_0x40c0('0x19')]);_0x5b2e19[_0x40c0('0x1b')]=qs[_0x40c0('0x1b')](_0x191f40['query']['offset']);}_0x5b2e19[_0x40c0('0x30')]=qs[_0x40c0('0x31')](_0x191f40[_0x40c0('0x29')][_0x40c0('0x31')]);_0x5b2e19['where']=qs['filters'](_['pick'](_0x191f40[_0x40c0('0x29')],_0x19201d['filters']),_0x57a6b8);if(_0x191f40['query']['filter']){_0x5b2e19[_0x40c0('0x32')]=_[_0x40c0('0x33')](_0x5b2e19[_0x40c0('0x32')],{'$or':_[_0x40c0('0x25')](_0x57a6b8,function(_0x5e0a86){if(_0x5e0a86[_0x40c0('0x34')]!==_0x40c0('0x35')){var _0x4faef9={};_0x4faef9[_0x5e0a86[_0x40c0('0x23')]]={'$like':'%'+_0x191f40['query']['filter']+'%'};return _0x4faef9;}})});}_0x5b2e19=_[_0x40c0('0x33')]({},_0x5b2e19,_0x191f40[_0x40c0('0x36')]);var _0x15389c={'where':_0x5b2e19[_0x40c0('0x32')]};return db['Dynamics365Configuration'][_0x40c0('0x1a')](_0x15389c)[_0x40c0('0x37')](function(_0x39c2c8){_0x2a5667[_0x40c0('0x1a')]=_0x39c2c8;if(_0x191f40[_0x40c0('0x29')][_0x40c0('0x38')]){_0x5b2e19['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x5b2e19);})[_0x40c0('0x37')](function(_0x2317e4){_0x2a5667[_0x40c0('0x39')]=_0x2317e4;return _0x2a5667;})[_0x40c0('0x37')](respondWithFilteredResult(_0x39f14b,_0x5b2e19))['catch'](handleError(_0x39f14b,null));};exports['show']=function(_0x14ce24,_0x16826c){var _0x3c2268={'raw':![],'where':{'id':_0x14ce24[_0x40c0('0x3a')]['id']}},_0x23593a={};_0x23593a['model']=_['keys'](db[_0x40c0('0x3b')]['rawAttributes']);_0x23593a[_0x40c0('0x29')]=_[_0x40c0('0x2a')](_0x14ce24[_0x40c0('0x29')]);_0x23593a[_0x40c0('0x3c')]=_['intersection'](_0x23593a[_0x40c0('0x28')],_0x23593a[_0x40c0('0x29')]);_0x3c2268[_0x40c0('0x2c')]=_[_0x40c0('0x2b')](_0x23593a[_0x40c0('0x28')],qs[_0x40c0('0x2d')](_0x14ce24[_0x40c0('0x29')][_0x40c0('0x2d')]));_0x3c2268[_0x40c0('0x2c')]=_0x3c2268['attributes'][_0x40c0('0x2e')]?_0x3c2268[_0x40c0('0x2c')]:_0x23593a['model'];if(_0x14ce24['query']['includeAll']){_0x3c2268[_0x40c0('0x3d')]=[{'all':!![]}];}_0x3c2268=_[_0x40c0('0x33')]({},_0x3c2268,_0x14ce24[_0x40c0('0x36')]);return db['Dynamics365Configuration'][_0x40c0('0x3e')](_0x3c2268)['then'](handleEntityNotFound(_0x16826c,null))[_0x40c0('0x37')](respondWithResult(_0x16826c,null))[_0x40c0('0x3f')](handleError(_0x16826c,null));};exports[_0x40c0('0x40')]=function(_0x4e821c,_0x249ab6){return db['Dynamics365Configuration']['create'](_0x4e821c['body'],{})[_0x40c0('0x37')](respondWithResult(_0x249ab6,0xc9))[_0x40c0('0x3f')](handleError(_0x249ab6,null));};exports[_0x40c0('0x20')]=function(_0x47c231,_0x439de6){if(_0x47c231['body']['id']){delete _0x47c231[_0x40c0('0x41')]['id'];}return db[_0x40c0('0x3b')][_0x40c0('0x3e')]({'where':{'id':_0x47c231[_0x40c0('0x3a')]['id']}})[_0x40c0('0x37')](handleEntityNotFound(_0x439de6,null))[_0x40c0('0x37')](saveUpdates(_0x47c231[_0x40c0('0x41')],null))['then'](respondWithResult(_0x439de6,null))[_0x40c0('0x3f')](handleError(_0x439de6,null));};exports['destroy']=function(_0x40c702,_0x5e12c5){return db[_0x40c0('0x3b')][_0x40c0('0x3e')]({'where':{'id':_0x40c702[_0x40c0('0x3a')]['id']}})[_0x40c0('0x37')](handleEntityNotFound(_0x5e12c5,null))[_0x40c0('0x37')](removeEntity(_0x5e12c5,null))['catch'](handleError(_0x5e12c5,null));};exports[_0x40c0('0x42')]=function(_0x3f7904,_0x2506de,_0x5d724a){var _0x18bfed={};var _0x5d3cd6={};var _0x28c40f;var _0x3bc071;return db[_0x40c0('0x3b')]['findOne']({'where':{'id':_0x3f7904['params']['id']}})['then'](handleEntityNotFound(_0x2506de,null))[_0x40c0('0x37')](function(_0x46d6f8){if(_0x46d6f8){_0x28c40f=_0x46d6f8;_0x5d3cd6['model']=_['keys'](db[_0x40c0('0x43')][_0x40c0('0x26')]);_0x5d3cd6[_0x40c0('0x29')]=_['keys'](_0x3f7904[_0x40c0('0x29')]);_0x5d3cd6['filters']=_['intersection'](_0x5d3cd6[_0x40c0('0x28')],_0x5d3cd6[_0x40c0('0x29')]);_0x18bfed[_0x40c0('0x2c')]=_[_0x40c0('0x2b')](_0x5d3cd6['model'],qs[_0x40c0('0x2d')](_0x3f7904[_0x40c0('0x29')]['fields']));_0x18bfed[_0x40c0('0x2c')]=_0x18bfed[_0x40c0('0x2c')][_0x40c0('0x2e')]?_0x18bfed[_0x40c0('0x2c')]:_0x5d3cd6['model'];_0x18bfed[_0x40c0('0x30')]=qs[_0x40c0('0x31')](_0x3f7904[_0x40c0('0x29')][_0x40c0('0x31')]);_0x18bfed[_0x40c0('0x32')]=qs['filters'](_['pick'](_0x3f7904[_0x40c0('0x29')],_0x5d3cd6[_0x40c0('0x3c')]));if(_0x3f7904[_0x40c0('0x29')][_0x40c0('0x44')]){_0x18bfed['where']=_[_0x40c0('0x33')](_0x18bfed[_0x40c0('0x32')],{'$or':_[_0x40c0('0x25')](_0x18bfed['attributes'],function(_0x3a8de9){var _0x438285={};_0x438285[_0x3a8de9]={'$like':'%'+_0x3f7904[_0x40c0('0x29')][_0x40c0('0x44')]+'%'};return _0x438285;})});}_0x18bfed=_[_0x40c0('0x33')]({},_0x18bfed,_0x3f7904[_0x40c0('0x36')]);return _0x28c40f[_0x40c0('0x42')](_0x18bfed);}})['then'](function(_0xaada50){if(_0xaada50){_0x3bc071=_0xaada50[_0x40c0('0x2e')];if(!_0x3f7904['query'][_0x40c0('0x2f')]('nolimit')){_0x18bfed[_0x40c0('0x19')]=qs[_0x40c0('0x19')](_0x3f7904[_0x40c0('0x29')][_0x40c0('0x19')]);_0x18bfed[_0x40c0('0x1b')]=qs['offset'](_0x3f7904[_0x40c0('0x29')][_0x40c0('0x1b')]);}return _0x28c40f[_0x40c0('0x42')](_0x18bfed);}})[_0x40c0('0x37')](function(_0x10d1a2){if(_0x10d1a2){return _0x10d1a2?{'count':_0x3bc071,'rows':_0x10d1a2}:null;}})[_0x40c0('0x37')](respondWithResult(_0x2506de,null))[_0x40c0('0x3f')](handleError(_0x2506de,null));};exports['getSubjects']=function(_0x4c3353,_0x2f52da,_0x5d5950){var _0x2b6ee1={};var _0x36f2d8={};var _0x3e09e2;var _0x5aac80;return db[_0x40c0('0x3b')][_0x40c0('0x45')]({'where':{'id':_0x4c3353[_0x40c0('0x3a')]['id']}})[_0x40c0('0x37')](handleEntityNotFound(_0x2f52da,null))[_0x40c0('0x37')](function(_0x12b2ae){if(_0x12b2ae){_0x3e09e2=_0x12b2ae;_0x36f2d8[_0x40c0('0x28')]=_['keys'](db[_0x40c0('0x43')]['rawAttributes']);_0x36f2d8[_0x40c0('0x29')]=_[_0x40c0('0x2a')](_0x4c3353[_0x40c0('0x29')]);_0x36f2d8[_0x40c0('0x3c')]=_[_0x40c0('0x2b')](_0x36f2d8[_0x40c0('0x28')],_0x36f2d8[_0x40c0('0x29')]);_0x2b6ee1[_0x40c0('0x2c')]=_[_0x40c0('0x2b')](_0x36f2d8[_0x40c0('0x28')],qs['fields'](_0x4c3353[_0x40c0('0x29')][_0x40c0('0x2d')]));_0x2b6ee1[_0x40c0('0x2c')]=_0x2b6ee1['attributes'][_0x40c0('0x2e')]?_0x2b6ee1[_0x40c0('0x2c')]:_0x36f2d8['model'];_0x2b6ee1[_0x40c0('0x30')]=qs[_0x40c0('0x31')](_0x4c3353[_0x40c0('0x29')]['sort']);_0x2b6ee1['where']=qs[_0x40c0('0x3c')](_[_0x40c0('0x46')](_0x4c3353[_0x40c0('0x29')],_0x36f2d8[_0x40c0('0x3c')]));if(_0x4c3353[_0x40c0('0x29')]['filter']){_0x2b6ee1['where']=_[_0x40c0('0x33')](_0x2b6ee1[_0x40c0('0x32')],{'$or':_[_0x40c0('0x25')](_0x2b6ee1['attributes'],function(_0x43b6d7){var _0x2f6043={};_0x2f6043[_0x43b6d7]={'$like':'%'+_0x4c3353[_0x40c0('0x29')]['filter']+'%'};return _0x2f6043;})});}_0x2b6ee1=_['merge']({},_0x2b6ee1,_0x4c3353['options']);return _0x3e09e2[_0x40c0('0x47')](_0x2b6ee1);}})[_0x40c0('0x37')](function(_0x161189){if(_0x161189){_0x5aac80=_0x161189['length'];if(!_0x4c3353[_0x40c0('0x29')]['hasOwnProperty'](_0x40c0('0x48'))){_0x2b6ee1[_0x40c0('0x19')]=qs[_0x40c0('0x19')](_0x4c3353[_0x40c0('0x29')]['limit']);_0x2b6ee1[_0x40c0('0x1b')]=qs['offset'](_0x4c3353[_0x40c0('0x29')]['offset']);}return _0x3e09e2[_0x40c0('0x47')](_0x2b6ee1);}})[_0x40c0('0x37')](function(_0x71c667){if(_0x71c667){return _0x71c667?{'count':_0x5aac80,'rows':_0x71c667}:null;}})[_0x40c0('0x37')](respondWithResult(_0x2f52da,null))[_0x40c0('0x3f')](handleError(_0x2f52da,null));};exports[_0x40c0('0x49')]=function(_0x2f8b7e,_0x443ef0,_0x5f1576){var _0x2da5b6={};var _0x3a5510={};var _0x3d37d7;var _0x126b22;return db[_0x40c0('0x3b')][_0x40c0('0x45')]({'where':{'id':_0x2f8b7e['params']['id']}})['then'](handleEntityNotFound(_0x443ef0,null))[_0x40c0('0x37')](function(_0x3864e1){if(_0x3864e1){_0x3d37d7=_0x3864e1;_0x3a5510[_0x40c0('0x28')]=_[_0x40c0('0x2a')](db[_0x40c0('0x43')]['rawAttributes']);_0x3a5510['query']=_[_0x40c0('0x2a')](_0x2f8b7e['query']);_0x3a5510['filters']=_['intersection'](_0x3a5510[_0x40c0('0x28')],_0x3a5510[_0x40c0('0x29')]);_0x2da5b6['attributes']=_[_0x40c0('0x2b')](_0x3a5510['model'],qs['fields'](_0x2f8b7e[_0x40c0('0x29')]['fields']));_0x2da5b6[_0x40c0('0x2c')]=_0x2da5b6[_0x40c0('0x2c')][_0x40c0('0x2e')]?_0x2da5b6['attributes']:_0x3a5510['model'];_0x2da5b6[_0x40c0('0x30')]=qs[_0x40c0('0x31')](_0x2f8b7e['query'][_0x40c0('0x31')]);_0x2da5b6[_0x40c0('0x32')]=qs[_0x40c0('0x3c')](_[_0x40c0('0x46')](_0x2f8b7e[_0x40c0('0x29')],_0x3a5510[_0x40c0('0x3c')]));if(_0x2f8b7e['query']['filter']){_0x2da5b6[_0x40c0('0x32')]=_[_0x40c0('0x33')](_0x2da5b6[_0x40c0('0x32')],{'$or':_[_0x40c0('0x25')](_0x2da5b6[_0x40c0('0x2c')],function(_0x5456e9){var _0x1bba02={};_0x1bba02[_0x5456e9]={'$like':'%'+_0x2f8b7e['query']['filter']+'%'};return _0x1bba02;})});}_0x2da5b6=_[_0x40c0('0x33')]({},_0x2da5b6,_0x2f8b7e[_0x40c0('0x36')]);return _0x3d37d7['getDescriptions'](_0x2da5b6);}})[_0x40c0('0x37')](function(_0x599b05){if(_0x599b05){_0x126b22=_0x599b05['length'];if(!_0x2f8b7e[_0x40c0('0x29')][_0x40c0('0x2f')]('nolimit')){_0x2da5b6[_0x40c0('0x19')]=qs['limit'](_0x2f8b7e[_0x40c0('0x29')][_0x40c0('0x19')]);_0x2da5b6[_0x40c0('0x1b')]=qs[_0x40c0('0x1b')](_0x2f8b7e[_0x40c0('0x29')][_0x40c0('0x1b')]);}return _0x3d37d7[_0x40c0('0x49')](_0x2da5b6);}})['then'](function(_0x5c4403){if(_0x5c4403){return _0x5c4403?{'count':_0x126b22,'rows':_0x5c4403}:null;}})[_0x40c0('0x37')](respondWithResult(_0x443ef0,null))['catch'](handleError(_0x443ef0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 75fe8c6..d9421f0 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 _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x5884ed,_0x461291){var _0x3a9138=function(_0x419355){while(--_0x419355){_0x5884ed['push'](_0x5884ed['shift']());}};_0x3a9138(++_0x461291);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5b3229,_0x223fe9){var _0x2e5047=function(_0x439838){while(--_0x439838){_0x5b3229['push'](_0x5b3229['shift']());}};_0x2e5047(++_0x223fe9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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':'int_dynamics365_configurations','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 86b91b6..50face9 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 _0x94bc=['error','message','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x94bc,0xc0));var _0xc94b=function(_0x397d61,_0x1f2002){_0x397d61=_0x397d61-0x0;var _0x270833=_0x94bc[_0x397d61];return _0x270833;};'use strict';var _=require('lodash');var util=require(_0xc94b('0x0'));var moment=require(_0xc94b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc94b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc94b('0x3'))['db'];var utils=require(_0xc94b('0x4'));var logger=require('../../config/logger')(_0xc94b('0x5'));var config=require(_0xc94b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc94b('0x7')][_0xc94b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3cf34d,_0x754ab,_0x5f57a2){return new BPromise(function(_0x305335,_0x5ac379){return client[_0xc94b('0x9')](_0x3cf34d,_0x5f57a2)[_0xc94b('0xa')](function(_0x8025a3){logger[_0xc94b('0xb')](_0xc94b('0xc'),_0x754ab,_0xc94b('0xd'));logger[_0xc94b('0xe')](_0xc94b('0xf'),_0x754ab,_0xc94b('0xd'),JSON[_0xc94b('0x10')](_0x8025a3));if(_0x8025a3[_0xc94b('0x11')]){if(_0x8025a3['error']['code']===0x1f4){logger[_0xc94b('0x11')](_0xc94b('0xc'),_0x754ab,_0x8025a3[_0xc94b('0x11')][_0xc94b('0x12')]);return _0x5ac379(_0x8025a3[_0xc94b('0x11')]['message']);}logger[_0xc94b('0x11')](_0xc94b('0xc'),_0x754ab,_0x8025a3['error']['message']);return _0x305335(_0x8025a3['error']['message']);}else{logger[_0xc94b('0xb')](_0xc94b('0xc'),_0x754ab,_0xc94b('0xd'));_0x305335(_0x8025a3['result'][_0xc94b('0x12')]);}})['catch'](function(_0x5b732a){logger[_0xc94b('0x11')](_0xc94b('0xc'),_0x754ab,_0x5b732a);_0x5ac379(_0x5b732a);});});} \ No newline at end of file +var _0x66c3=['../../config/logger','../../config/environment','client','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x66c3,0x8c));var _0x366c=function(_0x5d3f99,_0x10cd50){_0x5d3f99=_0x5d3f99-0x0;var _0x1c8ed7=_0x66c3[_0x5d3f99];return _0x1c8ed7;};'use strict';var _=require(_0x366c('0x0'));var util=require(_0x366c('0x1'));var moment=require(_0x366c('0x2'));var BPromise=require(_0x366c('0x3'));var rs=require(_0x366c('0x4'));var fs=require('fs');var Redis=require(_0x366c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x366c('0x6'));var logger=require(_0x366c('0x7'))('rpc');var config=require(_0x366c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x366c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d17e,_0x5854e3,_0x27c524){return new BPromise(function(_0x3bdc87,_0x667f28){return client['request'](_0x35d17e,_0x27c524)['then'](function(_0x16435a){logger['info'](_0x366c('0xa'),_0x5854e3,_0x366c('0xb'));logger[_0x366c('0xc')](_0x366c('0xd'),_0x5854e3,'request\x20sent',JSON[_0x366c('0xe')](_0x16435a));if(_0x16435a[_0x366c('0xf')]){if(_0x16435a['error'][_0x366c('0x10')]===0x1f4){logger['error'](_0x366c('0xa'),_0x5854e3,_0x16435a['error']['message']);return _0x667f28(_0x16435a['error']['message']);}logger[_0x366c('0xf')](_0x366c('0xa'),_0x5854e3,_0x16435a[_0x366c('0xf')][_0x366c('0x11')]);return _0x3bdc87(_0x16435a['error']['message']);}else{logger[_0x366c('0x12')](_0x366c('0xa'),_0x5854e3,'request\x20sent');_0x3bdc87(_0x16435a[_0x366c('0x13')][_0x366c('0x11')]);}})[_0x366c('0x14')](function(_0x4d8026){logger[_0x366c('0xf')](_0x366c('0xa'),_0x5854e3,_0x4d8026);_0x667f28(_0x4d8026);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c760227..139e991 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 _0x4555=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','create','put','update','delete','exports'];(function(_0x14b29a,_0x227b22){var _0x49b040=function(_0x9d51fa){while(--_0x9d51fa){_0x14b29a['push'](_0x14b29a['shift']());}};_0x49b040(++_0x227b22);}(_0x4555,0xea));var _0x5455=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4555[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x5455('0x0'));var util=require('util');var path=require(_0x5455('0x1'));var timeout=require(_0x5455('0x2'));var express=require(_0x5455('0x3'));var router=express['Router']();var fs_extra=require(_0x5455('0x4'));var auth=require(_0x5455('0x5'));var interaction=require(_0x5455('0x6'));var config=require(_0x5455('0x7'));var controller=require(_0x5455('0x8'));router[_0x5455('0x9')]('/',auth[_0x5455('0xa')](),controller[_0x5455('0xb')]);router[_0x5455('0x9')](_0x5455('0xc'),auth[_0x5455('0xa')](),controller['show']);router['post']('/',auth[_0x5455('0xa')](),controller[_0x5455('0xd')]);router[_0x5455('0xe')](_0x5455('0xc'),auth[_0x5455('0xa')](),controller[_0x5455('0xf')]);router[_0x5455('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5455('0x11')]=router; \ No newline at end of file +var _0x504b=['index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2dc294,_0x4df0bc){var _0x244365=function(_0xe1e978){while(--_0xe1e978){_0x2dc294['push'](_0x2dc294['shift']());}};_0x244365(++_0x4df0bc);}(_0x504b,0x8e));var _0xb504=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x504b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb504('0x0'));var util=require(_0xb504('0x1'));var path=require(_0xb504('0x2'));var timeout=require(_0xb504('0x3'));var express=require('express');var router=express[_0xb504('0x4')]();var fs_extra=require(_0xb504('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb504('0x6'));var config=require(_0xb504('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xb504('0x8')]('/',auth[_0xb504('0x9')](),controller[_0xb504('0xa')]);router[_0xb504('0x8')](_0xb504('0xb'),auth[_0xb504('0x9')](),controller[_0xb504('0xc')]);router[_0xb504('0xd')]('/',auth[_0xb504('0x9')](),controller['create']);router[_0xb504('0xe')]('/:id',auth[_0xb504('0x9')](),controller[_0xb504('0xf')]);router[_0xb504('0x10')](_0xb504('0xb'),auth[_0xb504('0x9')](),controller[_0xb504('0x11')]);module[_0xb504('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 11c1474..cb833e0 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 _0x2a4f=['customVariable','BOOLEAN','sequelize','exports','string','keyValue','picklist','STRING','variable'];(function(_0x5d92c2,_0x26d815){var _0x415601=function(_0x507e8f){while(--_0x507e8f){_0x5d92c2['push'](_0x5d92c2['shift']());}};_0x415601(++_0x26d815);}(_0x2a4f,0x1a0));var _0xf2a4=function(_0x3fbeb7,_0x316335){_0x3fbeb7=_0x3fbeb7-0x0;var _0x4dcb89=_0x2a4f[_0x3fbeb7];return _0x4dcb89;};'use strict';var Sequelize=require(_0xf2a4('0x0'));module[_0xf2a4('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf2a4('0x2'),'variable','customVariable',_0xf2a4('0x3'),_0xf2a4('0x4')),'defaultValue':_0xf2a4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf2a4('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xf2a4('0x2'),_0xf2a4('0x6'),_0xf2a4('0x7'))},'keyContent':{'type':Sequelize[_0xf2a4('0x5')]},'idField':{'type':Sequelize[_0xf2a4('0x5')]},'nameField':{'type':Sequelize[_0xf2a4('0x5')]},'customField':{'type':Sequelize[_0xf2a4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf2a4('0x5')]}}; \ No newline at end of file +var _0x77ce=['picklist','STRING','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x1863be,_0x3fb18f){var _0x5835e1=function(_0xaa0e92){while(--_0xaa0e92){_0x1863be['push'](_0x1863be['shift']());}};_0x5835e1(++_0x3fb18f);}(_0x77ce,0x153));var _0xe77c=function(_0x33a28b,_0x8e6dff){_0x33a28b=_0x33a28b-0x0;var _0x5e622a=_0x77ce[_0x33a28b];return _0x5e622a;};'use strict';var Sequelize=require(_0xe77c('0x0'));module[_0xe77c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe77c('0x2'),'variable',_0xe77c('0x3'),_0xe77c('0x4'),_0xe77c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe77c('0x6')]},'key':{'type':Sequelize[_0xe77c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xe77c('0x2'),'variable',_0xe77c('0x3'))},'keyContent':{'type':Sequelize[_0xe77c('0x6')]},'idField':{'type':Sequelize[_0xe77c('0x6')]},'nameField':{'type':Sequelize[_0xe77c('0x6')]},'customField':{'type':Sequelize[_0xe77c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe77c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b45efac..3140c65 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 _0x2088=['apply','update','then','destroy','stack','name','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x2a2c53,_0x3ea47e){var _0x3ba7e9=function(_0x3a3337){while(--_0x3a3337){_0x2a2c53['push'](_0x2a2c53['shift']());}};_0x3ba7e9(++_0x3ea47e);}(_0x2088,0x147));var _0x8208=function(_0x49a57f,_0x405f38){_0x49a57f=_0x49a57f-0x0;var _0x2fa2a5=_0x2088[_0x49a57f];return _0x2fa2a5;};'use strict';var emlformat=require(_0x8208('0x0'));var rimraf=require(_0x8208('0x1'));var zipdir=require(_0x8208('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8208('0x3'));var moment=require(_0x8208('0x4'));var BPromise=require(_0x8208('0x5'));var Mustache=require(_0x8208('0x6'));var util=require('util');var path=require(_0x8208('0x7'));var sox=require('sox');var csv=require(_0x8208('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8208('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8208('0xa'));var deskjs=require(_0x8208('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8208('0xc'));var Papa=require('papaparse');var Redis=require(_0x8208('0xd'));var authService=require(_0x8208('0xe'));var qs=require(_0x8208('0xf'));var as=require(_0x8208('0x10'));var hardwareService=require(_0x8208('0x11'));var logger=require(_0x8208('0x12'))('api');var utils=require(_0x8208('0x13'));var config=require(_0x8208('0x14'));var licenseUtil=require(_0x8208('0x15'));var db=require(_0x8208('0x16'))['db'];function respondWithStatusCode(_0x4993ba,_0x1ce5bf){_0x1ce5bf=_0x1ce5bf||0xcc;return function(_0x67d0ce){if(_0x67d0ce){return _0x4993ba[_0x8208('0x17')](_0x1ce5bf);}return _0x4993ba[_0x8208('0x18')](_0x1ce5bf)[_0x8208('0x19')]();};}function respondWithResult(_0x57d801,_0x5c5c6f){_0x5c5c6f=_0x5c5c6f||0xc8;return function(_0x637e23){if(_0x637e23){return _0x57d801[_0x8208('0x18')](_0x5c5c6f)[_0x8208('0x1a')](_0x637e23);}};}function respondWithFilteredResult(_0x14694e,_0x23320e){return function(_0x235f6a){if(_0x235f6a){var _0x58baa1=typeof _0x23320e['offset']===_0x8208('0x1b')&&typeof _0x23320e[_0x8208('0x1c')]===_0x8208('0x1b');var _0x180bfa=_0x235f6a[_0x8208('0x1d')];var _0x367269=_0x58baa1?0x0:_0x23320e[_0x8208('0x1e')];var _0x86a3b6=_0x58baa1?_0x235f6a[_0x8208('0x1d')]:_0x23320e[_0x8208('0x1e')]+_0x23320e[_0x8208('0x1c')];var _0x458fa9;if(_0x86a3b6>=_0x180bfa){_0x86a3b6=_0x180bfa;_0x458fa9=0xc8;}else{_0x458fa9=0xce;}_0x14694e['status'](_0x458fa9);return _0x14694e[_0x8208('0x1f')](_0x8208('0x20'),_0x367269+'-'+_0x86a3b6+'/'+_0x180bfa)[_0x8208('0x1a')](_0x235f6a);}return null;};}function patchUpdates(_0x25bfdd){return function(_0x485c13){try{jsonpatch[_0x8208('0x21')](_0x485c13,_0x25bfdd,!![]);}catch(_0x4a52bb){return BPromise['reject'](_0x4a52bb);}return _0x485c13['save']();};}function saveUpdates(_0x3a990b,_0x1185c8){return function(_0x5e91e5){if(_0x5e91e5){return _0x5e91e5[_0x8208('0x22')](_0x3a990b)[_0x8208('0x23')](function(_0x4824fd){return _0x4824fd;});}return null;};}function removeEntity(_0x1317d4,_0x41190f){return function(_0x55589c){if(_0x55589c){return _0x55589c[_0x8208('0x24')]()[_0x8208('0x23')](function(){_0x1317d4['status'](0xcc)[_0x8208('0x19')]();});}};}function handleEntityNotFound(_0xc00444,_0x532220){return function(_0x621de5){if(!_0x621de5){_0xc00444[_0x8208('0x17')](0x194);}return _0x621de5;};}function handleError(_0x1b4283,_0x4e674a){_0x4e674a=_0x4e674a||0x1f4;return function(_0x3bfafe){logger['error'](_0x3bfafe[_0x8208('0x25')]);if(_0x3bfafe[_0x8208('0x26')]){delete _0x3bfafe[_0x8208('0x26')];}_0x1b4283[_0x8208('0x18')](_0x4e674a)['send'](_0x3bfafe);};}exports[_0x8208('0x27')]=function(_0x1c3778,_0x5c0983){var _0x2e0622={},_0x125266={},_0x36c94c={'count':0x0,'rows':[]};var _0x27935c=_['map'](db[_0x8208('0x28')][_0x8208('0x29')],function(_0x4c7f8f){return{'name':_0x4c7f8f[_0x8208('0x2a')],'type':_0x4c7f8f[_0x8208('0x2b')]['key']};});_0x125266[_0x8208('0x2c')]=_[_0x8208('0x2d')](_0x27935c,_0x8208('0x26'));_0x125266[_0x8208('0x2e')]=_[_0x8208('0x2f')](_0x1c3778[_0x8208('0x2e')]);_0x125266[_0x8208('0x30')]=_[_0x8208('0x31')](_0x125266['model'],_0x125266[_0x8208('0x2e')]);_0x2e0622[_0x8208('0x32')]=_[_0x8208('0x31')](_0x125266[_0x8208('0x2c')],qs[_0x8208('0x33')](_0x1c3778[_0x8208('0x2e')][_0x8208('0x33')]));_0x2e0622[_0x8208('0x32')]=_0x2e0622[_0x8208('0x32')]['length']?_0x2e0622[_0x8208('0x32')]:_0x125266[_0x8208('0x2c')];if(!_0x1c3778[_0x8208('0x2e')][_0x8208('0x34')](_0x8208('0x35'))){_0x2e0622[_0x8208('0x1c')]=qs[_0x8208('0x1c')](_0x1c3778[_0x8208('0x2e')][_0x8208('0x1c')]);_0x2e0622[_0x8208('0x1e')]=qs['offset'](_0x1c3778[_0x8208('0x2e')][_0x8208('0x1e')]);}_0x2e0622[_0x8208('0x36')]=qs[_0x8208('0x37')](_0x1c3778[_0x8208('0x2e')][_0x8208('0x37')]);_0x2e0622['where']=qs[_0x8208('0x30')](_[_0x8208('0x38')](_0x1c3778[_0x8208('0x2e')],_0x125266[_0x8208('0x30')]),_0x27935c);if(_0x1c3778[_0x8208('0x2e')][_0x8208('0x39')]){_0x2e0622['where']=_[_0x8208('0x3a')](_0x2e0622['where'],{'$or':_[_0x8208('0x2d')](_0x27935c,function(_0x488831){if(_0x488831[_0x8208('0x2b')]!==_0x8208('0x3b')){var _0x496755={};_0x496755[_0x488831[_0x8208('0x26')]]={'$like':'%'+_0x1c3778[_0x8208('0x2e')]['filter']+'%'};return _0x496755;}})});}_0x2e0622=_[_0x8208('0x3a')]({},_0x2e0622,_0x1c3778[_0x8208('0x3c')]);var _0x4122f9={'where':_0x2e0622['where']};return db[_0x8208('0x28')]['count'](_0x4122f9)[_0x8208('0x23')](function(_0x483783){_0x36c94c[_0x8208('0x1d')]=_0x483783;if(_0x1c3778['query'][_0x8208('0x3d')]){_0x2e0622[_0x8208('0x3e')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x8208('0x3f')](_0x2e0622);})[_0x8208('0x23')](function(_0x186d57){_0x36c94c[_0x8208('0x40')]=_0x186d57;return _0x36c94c;})[_0x8208('0x23')](respondWithFilteredResult(_0x5c0983,_0x2e0622))[_0x8208('0x41')](handleError(_0x5c0983,null));};exports[_0x8208('0x42')]=function(_0x329906,_0x9c8382){var _0x1fcc13={'raw':!![],'where':{'id':_0x329906[_0x8208('0x43')]['id']}},_0x1950e5={};_0x1950e5[_0x8208('0x2c')]=_[_0x8208('0x2f')](db[_0x8208('0x28')]['rawAttributes']);_0x1950e5[_0x8208('0x2e')]=_[_0x8208('0x2f')](_0x329906[_0x8208('0x2e')]);_0x1950e5[_0x8208('0x30')]=_[_0x8208('0x31')](_0x1950e5[_0x8208('0x2c')],_0x1950e5[_0x8208('0x2e')]);_0x1fcc13[_0x8208('0x32')]=_[_0x8208('0x31')](_0x1950e5[_0x8208('0x2c')],qs[_0x8208('0x33')](_0x329906[_0x8208('0x2e')]['fields']));_0x1fcc13[_0x8208('0x32')]=_0x1fcc13['attributes'][_0x8208('0x44')]?_0x1fcc13[_0x8208('0x32')]:_0x1950e5[_0x8208('0x2c')];if(_0x329906[_0x8208('0x2e')]['includeAll']){_0x1fcc13[_0x8208('0x3e')]=[{'all':!![]}];}_0x1fcc13=_[_0x8208('0x3a')]({},_0x1fcc13,_0x329906[_0x8208('0x3c')]);return db[_0x8208('0x28')][_0x8208('0x45')](_0x1fcc13)[_0x8208('0x23')](handleEntityNotFound(_0x9c8382,null))['then'](respondWithResult(_0x9c8382,null))[_0x8208('0x41')](handleError(_0x9c8382,null));};exports[_0x8208('0x46')]=function(_0x4982ff,_0x24e974){return db[_0x8208('0x28')][_0x8208('0x46')](_0x4982ff['body'],{})['then'](respondWithResult(_0x24e974,0xc9))[_0x8208('0x41')](handleError(_0x24e974,null));};exports['update']=function(_0x2e2343,_0xadcc1f){if(_0x2e2343[_0x8208('0x47')]['id']){delete _0x2e2343[_0x8208('0x47')]['id'];}return db[_0x8208('0x28')][_0x8208('0x45')]({'where':{'id':_0x2e2343[_0x8208('0x43')]['id']}})[_0x8208('0x23')](handleEntityNotFound(_0xadcc1f,null))[_0x8208('0x23')](saveUpdates(_0x2e2343[_0x8208('0x47')],null))[_0x8208('0x23')](respondWithResult(_0xadcc1f,null))[_0x8208('0x41')](handleError(_0xadcc1f,null));};exports[_0x8208('0x24')]=function(_0x19b4bf,_0x3d1a3b){return db[_0x8208('0x28')][_0x8208('0x45')]({'where':{'id':_0x19b4bf[_0x8208('0x43')]['id']}})[_0x8208('0x23')](handleEntityNotFound(_0x3d1a3b,null))[_0x8208('0x23')](removeEntity(_0x3d1a3b,null))[_0x8208('0x41')](handleError(_0x3d1a3b,null));}; \ No newline at end of file +var _0xac0d=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','then','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','show','length','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xac0d,0x19b));var _0xdac0=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xac0d[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0xdac0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdac0('0x1'));var jsonpatch=require(_0xdac0('0x2'));var rp=require(_0xdac0('0x3'));var moment=require(_0xdac0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdac0('0x5'));var path=require(_0xdac0('0x6'));var sox=require(_0xdac0('0x7'));var csv=require('to-csv');var ejs=require(_0xdac0('0x8'));var fs=require('fs');var fs_extra=require(_0xdac0('0x9'));var _=require('lodash');var squel=require(_0xdac0('0xa'));var crypto=require(_0xdac0('0xb'));var jsforce=require(_0xdac0('0xc'));var deskjs=require(_0xdac0('0xd'));var toCsv=require(_0xdac0('0xe'));var querystring=require('querystring');var Papa=require(_0xdac0('0xf'));var Redis=require(_0xdac0('0x10'));var authService=require(_0xdac0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdac0('0x12'));var hardwareService=require(_0xdac0('0x13'));var logger=require(_0xdac0('0x14'))('api');var utils=require(_0xdac0('0x15'));var config=require(_0xdac0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdac0('0x17'))['db'];function respondWithStatusCode(_0x1f3dd0,_0x317840){_0x317840=_0x317840||0xcc;return function(_0x10b7f7){if(_0x10b7f7){return _0x1f3dd0[_0xdac0('0x18')](_0x317840);}return _0x1f3dd0[_0xdac0('0x19')](_0x317840)[_0xdac0('0x1a')]();};}function respondWithResult(_0x205088,_0x164ce9){_0x164ce9=_0x164ce9||0xc8;return function(_0x3cfd14){if(_0x3cfd14){return _0x205088['status'](_0x164ce9)[_0xdac0('0x1b')](_0x3cfd14);}};}function respondWithFilteredResult(_0x3264ae,_0x3a7953){return function(_0x307c2a){if(_0x307c2a){var _0x177424=typeof _0x3a7953[_0xdac0('0x1c')]===_0xdac0('0x1d')&&typeof _0x3a7953[_0xdac0('0x1e')]==='undefined';var _0x318dd9=_0x307c2a['count'];var _0x342e9b=_0x177424?0x0:_0x3a7953[_0xdac0('0x1c')];var _0x37bf89=_0x177424?_0x307c2a['count']:_0x3a7953[_0xdac0('0x1c')]+_0x3a7953[_0xdac0('0x1e')];var _0x3aa629;if(_0x37bf89>=_0x318dd9){_0x37bf89=_0x318dd9;_0x3aa629=0xc8;}else{_0x3aa629=0xce;}_0x3264ae[_0xdac0('0x19')](_0x3aa629);return _0x3264ae['set']('Content-Range',_0x342e9b+'-'+_0x37bf89+'/'+_0x318dd9)[_0xdac0('0x1b')](_0x307c2a);}return null;};}function patchUpdates(_0x5ee438){return function(_0x2620e6){try{jsonpatch[_0xdac0('0x1f')](_0x2620e6,_0x5ee438,!![]);}catch(_0x34efe6){return BPromise[_0xdac0('0x20')](_0x34efe6);}return _0x2620e6[_0xdac0('0x21')]();};}function saveUpdates(_0x124aaa,_0x2e6b4f){return function(_0x3ebf84){if(_0x3ebf84){return _0x3ebf84[_0xdac0('0x22')](_0x124aaa)[_0xdac0('0x23')](function(_0x47e7ea){return _0x47e7ea;});}return null;};}function removeEntity(_0x1cb4a3,_0x2235ad){return function(_0x237638){if(_0x237638){return _0x237638['destroy']()[_0xdac0('0x23')](function(){_0x1cb4a3[_0xdac0('0x19')](0xcc)[_0xdac0('0x1a')]();});}};}function handleEntityNotFound(_0x22bc41,_0x437318){return function(_0x3a14de){if(!_0x3a14de){_0x22bc41[_0xdac0('0x18')](0x194);}return _0x3a14de;};}function handleError(_0x3a19a9,_0xacd437){_0xacd437=_0xacd437||0x1f4;return function(_0x286020){logger[_0xdac0('0x24')](_0x286020[_0xdac0('0x25')]);if(_0x286020[_0xdac0('0x26')]){delete _0x286020[_0xdac0('0x26')];}_0x3a19a9[_0xdac0('0x19')](_0xacd437)[_0xdac0('0x27')](_0x286020);};}exports['index']=function(_0x2354cd,_0xd103d1){var _0x245cd0={},_0x196647={},_0x265dca={'count':0x0,'rows':[]};var _0x3d39ad=_[_0xdac0('0x28')](db[_0xdac0('0x29')][_0xdac0('0x2a')],function(_0x41d6ae){return{'name':_0x41d6ae[_0xdac0('0x2b')],'type':_0x41d6ae[_0xdac0('0x2c')][_0xdac0('0x2d')]};});_0x196647['model']=_[_0xdac0('0x28')](_0x3d39ad,_0xdac0('0x26'));_0x196647[_0xdac0('0x2e')]=_[_0xdac0('0x2f')](_0x2354cd['query']);_0x196647[_0xdac0('0x30')]=_['intersection'](_0x196647[_0xdac0('0x31')],_0x196647[_0xdac0('0x2e')]);_0x245cd0['attributes']=_[_0xdac0('0x32')](_0x196647[_0xdac0('0x31')],qs[_0xdac0('0x33')](_0x2354cd[_0xdac0('0x2e')][_0xdac0('0x33')]));_0x245cd0[_0xdac0('0x34')]=_0x245cd0[_0xdac0('0x34')]['length']?_0x245cd0[_0xdac0('0x34')]:_0x196647[_0xdac0('0x31')];if(!_0x2354cd['query'][_0xdac0('0x35')]('nolimit')){_0x245cd0[_0xdac0('0x1e')]=qs[_0xdac0('0x1e')](_0x2354cd['query'][_0xdac0('0x1e')]);_0x245cd0[_0xdac0('0x1c')]=qs[_0xdac0('0x1c')](_0x2354cd[_0xdac0('0x2e')][_0xdac0('0x1c')]);}_0x245cd0[_0xdac0('0x36')]=qs[_0xdac0('0x37')](_0x2354cd[_0xdac0('0x2e')][_0xdac0('0x37')]);_0x245cd0[_0xdac0('0x38')]=qs[_0xdac0('0x30')](_[_0xdac0('0x39')](_0x2354cd[_0xdac0('0x2e')],_0x196647['filters']),_0x3d39ad);if(_0x2354cd[_0xdac0('0x2e')][_0xdac0('0x3a')]){_0x245cd0[_0xdac0('0x38')]=_['merge'](_0x245cd0['where'],{'$or':_[_0xdac0('0x28')](_0x3d39ad,function(_0x38214d){if(_0x38214d[_0xdac0('0x2c')]!=='VIRTUAL'){var _0xea7f3b={};_0xea7f3b[_0x38214d['name']]={'$like':'%'+_0x2354cd[_0xdac0('0x2e')][_0xdac0('0x3a')]+'%'};return _0xea7f3b;}})});}_0x245cd0=_[_0xdac0('0x3b')]({},_0x245cd0,_0x2354cd[_0xdac0('0x3c')]);var _0x2a4df4={'where':_0x245cd0[_0xdac0('0x38')]};return db[_0xdac0('0x29')]['count'](_0x2a4df4)[_0xdac0('0x23')](function(_0x179f22){_0x265dca[_0xdac0('0x3d')]=_0x179f22;if(_0x2354cd[_0xdac0('0x2e')]['includeAll']){_0x245cd0[_0xdac0('0x3e')]=[{'all':!![]}];}return db[_0xdac0('0x29')][_0xdac0('0x3f')](_0x245cd0);})[_0xdac0('0x23')](function(_0x270f61){_0x265dca[_0xdac0('0x40')]=_0x270f61;return _0x265dca;})[_0xdac0('0x23')](respondWithFilteredResult(_0xd103d1,_0x245cd0))['catch'](handleError(_0xd103d1,null));};exports[_0xdac0('0x41')]=function(_0x27263c,_0x3c761a){var _0x3b69fc={'raw':!![],'where':{'id':_0x27263c['params']['id']}},_0x324aa7={};_0x324aa7[_0xdac0('0x31')]=_[_0xdac0('0x2f')](db[_0xdac0('0x29')][_0xdac0('0x2a')]);_0x324aa7['query']=_[_0xdac0('0x2f')](_0x27263c[_0xdac0('0x2e')]);_0x324aa7['filters']=_[_0xdac0('0x32')](_0x324aa7['model'],_0x324aa7[_0xdac0('0x2e')]);_0x3b69fc['attributes']=_['intersection'](_0x324aa7[_0xdac0('0x31')],qs[_0xdac0('0x33')](_0x27263c[_0xdac0('0x2e')]['fields']));_0x3b69fc[_0xdac0('0x34')]=_0x3b69fc[_0xdac0('0x34')][_0xdac0('0x42')]?_0x3b69fc[_0xdac0('0x34')]:_0x324aa7[_0xdac0('0x31')];if(_0x27263c[_0xdac0('0x2e')]['includeAll']){_0x3b69fc[_0xdac0('0x3e')]=[{'all':!![]}];}_0x3b69fc=_['merge']({},_0x3b69fc,_0x27263c[_0xdac0('0x3c')]);return db[_0xdac0('0x29')]['find'](_0x3b69fc)[_0xdac0('0x23')](handleEntityNotFound(_0x3c761a,null))[_0xdac0('0x23')](respondWithResult(_0x3c761a,null))[_0xdac0('0x43')](handleError(_0x3c761a,null));};exports['create']=function(_0x28799b,_0x5d745c){return db[_0xdac0('0x29')][_0xdac0('0x44')](_0x28799b[_0xdac0('0x45')],{})[_0xdac0('0x23')](respondWithResult(_0x5d745c,0xc9))[_0xdac0('0x43')](handleError(_0x5d745c,null));};exports[_0xdac0('0x22')]=function(_0x2308ad,_0x4f7d68){if(_0x2308ad[_0xdac0('0x45')]['id']){delete _0x2308ad[_0xdac0('0x45')]['id'];}return db[_0xdac0('0x29')]['find']({'where':{'id':_0x2308ad[_0xdac0('0x46')]['id']}})[_0xdac0('0x23')](handleEntityNotFound(_0x4f7d68,null))[_0xdac0('0x23')](saveUpdates(_0x2308ad[_0xdac0('0x45')],null))[_0xdac0('0x23')](respondWithResult(_0x4f7d68,null))[_0xdac0('0x43')](handleError(_0x4f7d68,null));};exports['destroy']=function(_0x85c6f0,_0x40b02f){return db[_0xdac0('0x29')]['find']({'where':{'id':_0x85c6f0[_0xdac0('0x46')]['id']}})[_0xdac0('0x23')](handleEntityNotFound(_0x40b02f,null))['then'](removeEntity(_0x40b02f,null))[_0xdac0('0x43')](handleError(_0x40b02f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b449eaf..e3cbd77 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 _0x04de=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util'];(function(_0x3999a0,_0x5befea){var _0x3e8d91=function(_0x1ac09e){while(--_0x1ac09e){_0x3999a0['push'](_0x3999a0['shift']());}};_0x3e8d91(++_0x5befea);}(_0x04de,0x19e));var _0xe04d=function(_0x5e269c,_0x1f22dc){_0x5e269c=_0x5e269c-0x0;var _0xefd44e=_0x04de[_0x5e269c];return _0xefd44e;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var logger=require(_0xe04d('0x2'))(_0xe04d('0x3'));var moment=require(_0xe04d('0x4'));var BPromise=require(_0xe04d('0x5'));var rp=require(_0xe04d('0x6'));var fs=require('fs');var path=require(_0xe04d('0x7'));var rimraf=require(_0xe04d('0x8'));var config=require('../../config/environment');var attributes=require(_0xe04d('0x9'));module[_0xe04d('0xa')]=function(_0x265ede,_0x2d652a){return _0x265ede[_0xe04d('0xb')](_0xe04d('0xc'),attributes,{'tableName':_0xe04d('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xe04d('0xe'),_0xe04d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3034=['./intDynamics365Field.attributes','exports','Dynamics365Field','dynamics365_unique_index','idField','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x3034,0x123));var _0x4303=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3034[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x4303('0x0'));var logger=require(_0x4303('0x1'))(_0x4303('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4303('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4303('0x4'));var config=require(_0x4303('0x5'));var attributes=require(_0x4303('0x6'));module[_0x4303('0x7')]=function(_0x210ec0,_0xd8f235){return _0x210ec0['define'](_0x4303('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x4303('0x9'),'fields':[_0x4303('0xa'),'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 3ef3cb5..39199da 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 _0x6bc6=['randomstring','ioredis','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','Dynamics365Field,\x20%s,\x20%s','catch','lodash','moment','bluebird'];(function(_0x5c244b,_0x3eab94){var _0x52f7cb=function(_0x28a24f){while(--_0x28a24f){_0x5c244b['push'](_0x5c244b['shift']());}};_0x52f7cb(++_0x3eab94);}(_0x6bc6,0xd9));var _0x66bc=function(_0x33f1f1,_0x3f2a10){_0x33f1f1=_0x33f1f1-0x0;var _0x3052d4=_0x6bc6[_0x33f1f1];return _0x3052d4;};'use strict';var _=require(_0x66bc('0x0'));var util=require('util');var moment=require(_0x66bc('0x1'));var BPromise=require(_0x66bc('0x2'));var rs=require(_0x66bc('0x3'));var fs=require('fs');var Redis=require(_0x66bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66bc('0x5'))(_0x66bc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x66bc('0x7')][_0x66bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51ab0a,_0x3e5e2f,_0x9b2bc){return new BPromise(function(_0x1e975b,_0x59a7e6){return client[_0x66bc('0x9')](_0x51ab0a,_0x9b2bc)[_0x66bc('0xa')](function(_0x2a696e){logger[_0x66bc('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x3e5e2f,_0x66bc('0xc'));logger[_0x66bc('0xd')](_0x66bc('0xe'),_0x3e5e2f,_0x66bc('0xc'),JSON['stringify'](_0x2a696e));if(_0x2a696e[_0x66bc('0xf')]){if(_0x2a696e[_0x66bc('0xf')][_0x66bc('0x10')]===0x1f4){logger[_0x66bc('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3e5e2f,_0x2a696e[_0x66bc('0xf')]['message']);return _0x59a7e6(_0x2a696e[_0x66bc('0xf')][_0x66bc('0x11')]);}logger[_0x66bc('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3e5e2f,_0x2a696e[_0x66bc('0xf')]['message']);return _0x1e975b(_0x2a696e['error'][_0x66bc('0x11')]);}else{logger[_0x66bc('0xb')](_0x66bc('0x12'),_0x3e5e2f,_0x66bc('0xc'));_0x1e975b(_0x2a696e['result']['message']);}})[_0x66bc('0x13')](function(_0x21f7ed){logger['error'](_0x66bc('0x12'),_0x3e5e2f,_0x21f7ed);_0x59a7e6(_0x21f7ed);});});} \ No newline at end of file +var _0x39d4=['message','info','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x39d4,0x17c));var _0x439d=function(_0x3c54f8,_0x5a6aaf){_0x3c54f8=_0x3c54f8-0x0;var _0x137b6c=_0x39d4[_0x3c54f8];return _0x137b6c;};'use strict';var _=require('lodash');var util=require(_0x439d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x439d('0x1'));var fs=require('fs');var Redis=require(_0x439d('0x2'));var db=require(_0x439d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x439d('0x4'))(_0x439d('0x5'));var config=require(_0x439d('0x6'));var jayson=require(_0x439d('0x7'));var client=jayson[_0x439d('0x8')][_0x439d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29f549,_0x3ec075,_0x37321e){return new BPromise(function(_0x51410a,_0x5cdf94){return client[_0x439d('0xa')](_0x29f549,_0x37321e)[_0x439d('0xb')](function(_0x22fa9a){logger['info'](_0x439d('0xc'),_0x3ec075,'request\x20sent');logger[_0x439d('0xd')](_0x439d('0xe'),_0x3ec075,_0x439d('0xf'),JSON[_0x439d('0x10')](_0x22fa9a));if(_0x22fa9a[_0x439d('0x11')]){if(_0x22fa9a['error'][_0x439d('0x12')]===0x1f4){logger[_0x439d('0x11')](_0x439d('0xc'),_0x3ec075,_0x22fa9a[_0x439d('0x11')][_0x439d('0x13')]);return _0x5cdf94(_0x22fa9a[_0x439d('0x11')][_0x439d('0x13')]);}logger[_0x439d('0x11')](_0x439d('0xc'),_0x3ec075,_0x22fa9a[_0x439d('0x11')]['message']);return _0x51410a(_0x22fa9a[_0x439d('0x11')][_0x439d('0x13')]);}else{logger[_0x439d('0x14')](_0x439d('0xc'),_0x3ec075,'request\x20sent');_0x51410a(_0x22fa9a['result']['message']);}})['catch'](function(_0x456fad){logger[_0x439d('0x11')](_0x439d('0xc'),_0x3ec075,_0x456fad);_0x5cdf94(_0x456fad);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b292dc7..a12b113 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 _0x27f8=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x27f8,0xa4));var _0x827f=function(_0x76faa4,_0x4a8b9c){_0x76faa4=_0x76faa4-0x0;var _0x5cab58=_0x27f8[_0x76faa4];return _0x5cab58;};'use strict';var multer=require(_0x827f('0x0'));var util=require('util');var path=require(_0x827f('0x1'));var timeout=require(_0x827f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x827f('0x3'));var auth=require(_0x827f('0x4'));var interaction=require(_0x827f('0x5'));var config=require(_0x827f('0x6'));var controller=require(_0x827f('0x7'));router[_0x827f('0x8')]('/',auth['isAuthenticated'](),controller[_0x827f('0x9')]);router[_0x827f('0x8')](_0x827f('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x827f('0xb')](),controller[_0x827f('0xc')]);router['get'](_0x827f('0xd'),auth[_0x827f('0xb')](),controller[_0x827f('0xe')]);router[_0x827f('0xf')]('/',auth[_0x827f('0xb')](),controller[_0x827f('0x10')]);router[_0x827f('0xf')](_0x827f('0x11'),auth[_0x827f('0xb')](),controller[_0x827f('0x12')]);router[_0x827f('0x13')]('/:id',auth[_0x827f('0xb')](),controller[_0x827f('0x14')]);router[_0x827f('0x15')](_0x827f('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0c1d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c1d,0x16d));var _0xd0c1=function(_0x204d2d,_0x179a6f){_0x204d2d=_0x204d2d-0x0;var _0x2760dd=_0x0c1d[_0x204d2d];return _0x2760dd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd0c1('0x0'));var timeout=require(_0xd0c1('0x1'));var express=require(_0xd0c1('0x2'));var router=express['Router']();var fs_extra=require(_0xd0c1('0x3'));var auth=require(_0xd0c1('0x4'));var interaction=require(_0xd0c1('0x5'));var config=require(_0xd0c1('0x6'));var controller=require(_0xd0c1('0x7'));router[_0xd0c1('0x8')]('/',auth['isAuthenticated'](),controller[_0xd0c1('0x9')]);router[_0xd0c1('0x8')]('/:id',auth[_0xd0c1('0xa')](),controller[_0xd0c1('0xb')]);router['get'](_0xd0c1('0xc'),auth[_0xd0c1('0xa')](),controller['getConfigurations']);router['get'](_0xd0c1('0xd'),auth['isAuthenticated'](),controller[_0xd0c1('0xe')]);router[_0xd0c1('0xf')]('/',auth[_0xd0c1('0xa')](),controller[_0xd0c1('0x10')]);router[_0xd0c1('0xf')](_0xd0c1('0xc'),auth[_0xd0c1('0xa')](),controller[_0xd0c1('0x11')]);router[_0xd0c1('0x12')]('/:id',auth[_0xd0c1('0xa')](),controller[_0xd0c1('0x13')]);router[_0xd0c1('0x14')]('/:id',auth[_0xd0c1('0xa')](),controller[_0xd0c1('0x15')]);module[_0xd0c1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2b885d7..1af9372 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 _0x160f=['sequelize','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'name':{'type':Sequelize[_0xf160('0x2')]},'description':{'type':Sequelize[_0xf160('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf160('0x3')},'apiKey':{'type':Sequelize[_0xf160('0x2')]},'remoteUri':{'type':Sequelize[_0xf160('0x2')],'unique':_0xf160('0x4')},'serverUrl':{'type':Sequelize[_0xf160('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2ef3=['remoteUri','sequelize','exports','STRING','username'];(function(_0x36b45b,_0x2e9016){var _0x218618=function(_0x3a40e3){while(--_0x3a40e3){_0x36b45b['push'](_0x36b45b['shift']());}};_0x218618(++_0x2e9016);}(_0x2ef3,0xba));var _0x32ef=function(_0x480e60,_0x557a33){_0x480e60=_0x480e60-0x0;var _0x3bfc1a=_0x2ef3[_0x480e60];return _0x3bfc1a;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'name':{'type':Sequelize[_0x32ef('0x2')]},'description':{'type':Sequelize[_0x32ef('0x2')]},'username':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index a367403..864ec00 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 _0x220b=['intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','filters','length','include','catch','create','body','find','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','Basic\x20%s','format','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','key','model','keys','query','attributes'];(function(_0x64fd8d,_0xc0c66e){var _0x50dd0e=function(_0x1197d2){while(--_0x1197d2){_0x64fd8d['push'](_0x64fd8d['shift']());}};_0x50dd0e(++_0xc0c66e);}(_0x220b,0x1a2));var _0xb220=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x220b[_0x54d4a8];return _0x3b321b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb220('0x0'));var zipdir=require(_0xb220('0x1'));var jsonpatch=require(_0xb220('0x2'));var rp=require(_0xb220('0x3'));var moment=require('moment');var BPromise=require(_0xb220('0x4'));var Mustache=require('mustache');var util=require(_0xb220('0x5'));var path=require('path');var sox=require(_0xb220('0x6'));var csv=require(_0xb220('0x7'));var ejs=require(_0xb220('0x8'));var fs=require('fs');var fs_extra=require(_0xb220('0x9'));var _=require('lodash');var squel=require(_0xb220('0xa'));var crypto=require(_0xb220('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb220('0xc'));var toCsv=require(_0xb220('0x7'));var querystring=require(_0xb220('0xd'));var Papa=require(_0xb220('0xe'));var Redis=require(_0xb220('0xf'));var authService=require(_0xb220('0x10'));var qs=require(_0xb220('0x11'));var as=require(_0xb220('0x12'));var hardwareService=require(_0xb220('0x13'));var logger=require('../../config/logger')(_0xb220('0x14'));var utils=require(_0xb220('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59ef3e,_0x11229c){_0x11229c=_0x11229c||0xcc;return function(_0x573971){if(_0x573971){return _0x59ef3e[_0xb220('0x16')](_0x11229c);}return _0x59ef3e[_0xb220('0x17')](_0x11229c)[_0xb220('0x18')]();};}function respondWithResult(_0x312c59,_0x576649){_0x576649=_0x576649||0xc8;return function(_0x5af78d){if(_0x5af78d){return _0x312c59[_0xb220('0x17')](_0x576649)[_0xb220('0x19')](_0x5af78d);}};}function respondWithFilteredResult(_0x159eb7,_0x2ee3d2){return function(_0x16a34b){if(_0x16a34b){var _0x2458a8=typeof _0x2ee3d2[_0xb220('0x1a')]===_0xb220('0x1b')&&typeof _0x2ee3d2[_0xb220('0x1c')]===_0xb220('0x1b');var _0x33201a=_0x16a34b[_0xb220('0x1d')];var _0x3fe419=_0x2458a8?0x0:_0x2ee3d2[_0xb220('0x1a')];var _0x87c879=_0x2458a8?_0x16a34b[_0xb220('0x1d')]:_0x2ee3d2[_0xb220('0x1a')]+_0x2ee3d2[_0xb220('0x1c')];var _0x242aee;if(_0x87c879>=_0x33201a){_0x87c879=_0x33201a;_0x242aee=0xc8;}else{_0x242aee=0xce;}_0x159eb7[_0xb220('0x17')](_0x242aee);return _0x159eb7[_0xb220('0x1e')](_0xb220('0x1f'),_0x3fe419+'-'+_0x87c879+'/'+_0x33201a)[_0xb220('0x19')](_0x16a34b);}return null;};}function patchUpdates(_0x358035){return function(_0x5d38ad){try{jsonpatch[_0xb220('0x20')](_0x5d38ad,_0x358035,!![]);}catch(_0x5ddebe){return BPromise[_0xb220('0x21')](_0x5ddebe);}return _0x5d38ad['save']();};}function saveUpdates(_0x3a1ad7,_0x501f0f){return function(_0x15ca2f){if(_0x15ca2f){return _0x15ca2f[_0xb220('0x22')](_0x3a1ad7)[_0xb220('0x23')](function(_0x2f5a0d){return _0x2f5a0d;});}return null;};}function removeEntity(_0x396c72,_0x2975ff){return function(_0x5bb719){if(_0x5bb719){return _0x5bb719[_0xb220('0x24')]()[_0xb220('0x23')](function(){_0x396c72[_0xb220('0x17')](0xcc)[_0xb220('0x18')]();});}};}function handleEntityNotFound(_0x180b94,_0x4d83aa){return function(_0x19f13a){if(!_0x19f13a){_0x180b94[_0xb220('0x16')](0x194);}return _0x19f13a;};}function handleError(_0x57768e,_0x2b9b1a){_0x2b9b1a=_0x2b9b1a||0x1f4;return function(_0x277601){logger[_0xb220('0x25')](_0x277601[_0xb220('0x26')]);if(_0x277601[_0xb220('0x27')]){delete _0x277601[_0xb220('0x27')];}_0x57768e['status'](_0x2b9b1a)[_0xb220('0x28')](_0x277601);};}exports['index']=function(_0x589e07,_0x181b14){var _0x1a9b82={},_0x2d66a3={},_0x389a4d={'count':0x0,'rows':[]};var _0x2c016e=_[_0xb220('0x29')](db[_0xb220('0x2a')][_0xb220('0x2b')],function(_0x44da01){return{'name':_0x44da01[_0xb220('0x2c')],'type':_0x44da01['type'][_0xb220('0x2d')]};});_0x2d66a3[_0xb220('0x2e')]=_[_0xb220('0x29')](_0x2c016e,'name');_0x2d66a3['query']=_[_0xb220('0x2f')](_0x589e07['query']);_0x2d66a3['filters']=_['intersection'](_0x2d66a3[_0xb220('0x2e')],_0x2d66a3[_0xb220('0x30')]);_0x1a9b82[_0xb220('0x31')]=_[_0xb220('0x32')](_0x2d66a3[_0xb220('0x2e')],qs[_0xb220('0x33')](_0x589e07['query']['fields']));_0x1a9b82[_0xb220('0x31')]=_0x1a9b82[_0xb220('0x31')]['length']?_0x1a9b82[_0xb220('0x31')]:_0x2d66a3['model'];if(!_0x589e07[_0xb220('0x30')][_0xb220('0x34')](_0xb220('0x35'))){_0x1a9b82[_0xb220('0x1c')]=qs[_0xb220('0x1c')](_0x589e07['query']['limit']);_0x1a9b82['offset']=qs[_0xb220('0x1a')](_0x589e07['query'][_0xb220('0x1a')]);}_0x1a9b82[_0xb220('0x36')]=qs[_0xb220('0x37')](_0x589e07['query']['sort']);_0x1a9b82[_0xb220('0x38')]=qs['filters'](_[_0xb220('0x39')](_0x589e07[_0xb220('0x30')],_0x2d66a3['filters']),_0x2c016e);if(_0x589e07[_0xb220('0x30')][_0xb220('0x3a')]){_0x1a9b82[_0xb220('0x38')]=_[_0xb220('0x3b')](_0x1a9b82[_0xb220('0x38')],{'$or':_[_0xb220('0x29')](_0x2c016e,function(_0x725e18){if(_0x725e18[_0xb220('0x3c')]!==_0xb220('0x3d')){var _0x8b394={};_0x8b394[_0x725e18[_0xb220('0x27')]]={'$like':'%'+_0x589e07[_0xb220('0x30')][_0xb220('0x3a')]+'%'};return _0x8b394;}})});}_0x1a9b82=_['merge']({},_0x1a9b82,_0x589e07[_0xb220('0x3e')]);var _0x211568={'where':_0x1a9b82[_0xb220('0x38')]};return db[_0xb220('0x2a')][_0xb220('0x1d')](_0x211568)['then'](function(_0x27f116){_0x389a4d[_0xb220('0x1d')]=_0x27f116;if(_0x589e07[_0xb220('0x30')][_0xb220('0x3f')]){_0x1a9b82['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0xb220('0x40')](_0x1a9b82);})['then'](function(_0x4ed027){_0x389a4d[_0xb220('0x41')]=_0x4ed027;return _0x389a4d;})['then'](respondWithFilteredResult(_0x181b14,_0x1a9b82))['catch'](handleError(_0x181b14,null));};exports[_0xb220('0x42')]=function(_0x14c6fd,_0x3f357a){var _0x24d75c={'raw':![],'where':{'id':_0x14c6fd['params']['id']}},_0x447bf7={};_0x447bf7[_0xb220('0x2e')]=_[_0xb220('0x2f')](db[_0xb220('0x2a')][_0xb220('0x2b')]);_0x447bf7[_0xb220('0x30')]=_[_0xb220('0x2f')](_0x14c6fd[_0xb220('0x30')]);_0x447bf7[_0xb220('0x43')]=_[_0xb220('0x32')](_0x447bf7['model'],_0x447bf7['query']);_0x24d75c['attributes']=_[_0xb220('0x32')](_0x447bf7[_0xb220('0x2e')],qs[_0xb220('0x33')](_0x14c6fd[_0xb220('0x30')][_0xb220('0x33')]));_0x24d75c[_0xb220('0x31')]=_0x24d75c[_0xb220('0x31')][_0xb220('0x44')]?_0x24d75c[_0xb220('0x31')]:_0x447bf7[_0xb220('0x2e')];if(_0x14c6fd[_0xb220('0x30')][_0xb220('0x3f')]){_0x24d75c[_0xb220('0x45')]=[{'all':!![]}];}_0x24d75c=_['merge']({},_0x24d75c,_0x14c6fd[_0xb220('0x3e')]);return db[_0xb220('0x2a')]['find'](_0x24d75c)[_0xb220('0x23')](handleEntityNotFound(_0x3f357a,null))[_0xb220('0x23')](respondWithResult(_0x3f357a,null))[_0xb220('0x46')](handleError(_0x3f357a,null));};exports[_0xb220('0x47')]=function(_0x3d084d,_0x42906d){return db[_0xb220('0x2a')][_0xb220('0x47')](_0x3d084d[_0xb220('0x48')],{})[_0xb220('0x23')](respondWithResult(_0x42906d,0xc9))['catch'](handleError(_0x42906d,null));};exports['update']=function(_0x4d80f6,_0x4172ed){if(_0x4d80f6[_0xb220('0x48')]['id']){delete _0x4d80f6[_0xb220('0x48')]['id'];}return db[_0xb220('0x2a')]['find']({'where':{'id':_0x4d80f6['params']['id']}})[_0xb220('0x23')](handleEntityNotFound(_0x4172ed,null))[_0xb220('0x23')](saveUpdates(_0x4d80f6['body'],null))['then'](respondWithResult(_0x4172ed,null))[_0xb220('0x46')](handleError(_0x4172ed,null));};exports['destroy']=function(_0x427dd8,_0xa4ce65){return db[_0xb220('0x2a')][_0xb220('0x49')]({'where':{'id':_0x427dd8[_0xb220('0x4a')]['id']}})[_0xb220('0x23')](handleEntityNotFound(_0xa4ce65,null))['then'](removeEntity(_0xa4ce65,null))[_0xb220('0x46')](handleError(_0xa4ce65,null));};exports[_0xb220('0x4b')]=function(_0x3f1f9b,_0x1bb899,_0x366519){var _0x2fdbe8={};var _0x5bc519={};var _0x5218e3;var _0x179cc5;return db[_0xb220('0x2a')][_0xb220('0x4c')]({'where':{'id':_0x3f1f9b[_0xb220('0x4a')]['id']}})[_0xb220('0x23')](handleEntityNotFound(_0x1bb899,null))[_0xb220('0x23')](function(_0x255b7b){if(_0x255b7b){_0x5218e3=_0x255b7b;_0x5bc519[_0xb220('0x2e')]=_[_0xb220('0x2f')](db[_0xb220('0x4d')]['rawAttributes']);_0x5bc519[_0xb220('0x30')]=_['keys'](_0x3f1f9b[_0xb220('0x30')]);_0x5bc519[_0xb220('0x43')]=_[_0xb220('0x32')](_0x5bc519[_0xb220('0x2e')],_0x5bc519[_0xb220('0x30')]);_0x2fdbe8[_0xb220('0x31')]=_[_0xb220('0x32')](_0x5bc519['model'],qs['fields'](_0x3f1f9b[_0xb220('0x30')][_0xb220('0x33')]));_0x2fdbe8['attributes']=_0x2fdbe8[_0xb220('0x31')]['length']?_0x2fdbe8[_0xb220('0x31')]:_0x5bc519['model'];_0x2fdbe8[_0xb220('0x36')]=qs[_0xb220('0x37')](_0x3f1f9b[_0xb220('0x30')]['sort']);_0x2fdbe8['where']=qs[_0xb220('0x43')](_[_0xb220('0x39')](_0x3f1f9b[_0xb220('0x30')],_0x5bc519['filters']));if(_0x3f1f9b[_0xb220('0x30')][_0xb220('0x3a')]){_0x2fdbe8[_0xb220('0x38')]=_[_0xb220('0x3b')](_0x2fdbe8[_0xb220('0x38')],{'$or':_[_0xb220('0x29')](_0x2fdbe8[_0xb220('0x31')],function(_0x1812fd){var _0x186951={};_0x186951[_0x1812fd]={'$like':'%'+_0x3f1f9b[_0xb220('0x30')][_0xb220('0x3a')]+'%'};return _0x186951;})});}_0x2fdbe8=_[_0xb220('0x3b')]({},_0x2fdbe8,_0x3f1f9b[_0xb220('0x3e')]);return _0x5218e3['getConfigurations'](_0x2fdbe8);}})['then'](function(_0x56bf00){if(_0x56bf00){_0x179cc5=_0x56bf00[_0xb220('0x44')];if(!_0x3f1f9b[_0xb220('0x30')][_0xb220('0x34')](_0xb220('0x35'))){_0x2fdbe8[_0xb220('0x1c')]=qs[_0xb220('0x1c')](_0x3f1f9b[_0xb220('0x30')][_0xb220('0x1c')]);_0x2fdbe8['offset']=qs[_0xb220('0x1a')](_0x3f1f9b[_0xb220('0x30')]['offset']);}return _0x5218e3[_0xb220('0x4b')](_0x2fdbe8);}})['then'](function(_0x147c2c){if(_0x147c2c){return _0x147c2c?{'count':_0x179cc5,'rows':_0x147c2c}:null;}})[_0xb220('0x23')](respondWithResult(_0x1bb899,null))[_0xb220('0x46')](handleError(_0x1bb899,null));};exports[_0xb220('0x4e')]=function(_0x2b8dea,_0x218c5f,_0x13f0b7){if(_0x2b8dea['body']['id']){delete _0x2b8dea[_0xb220('0x48')]['id'];}return db[_0xb220('0x2a')]['findOne']({'where':{'id':_0x2b8dea[_0xb220('0x4a')]['id']}})[_0xb220('0x23')](handleEntityNotFound(_0x218c5f,null))['then'](function(_0x17c2b6){if(_0x17c2b6){_0x2b8dea[_0xb220('0x48')][_0xb220('0x4f')]=_0x17c2b6['id'];_0x2b8dea[_0xb220('0x48')][_0xb220('0x50')]=integrations[_0xb220('0x51')](_0x2b8dea[_0xb220('0x48')][_0xb220('0x52')],_0x2b8dea['body'][_0xb220('0x3c')]);_0x2b8dea['body'][_0xb220('0x53')]=integrations['getDescriptions'](_0x2b8dea[_0xb220('0x48')][_0xb220('0x52')],_0x2b8dea[_0xb220('0x48')][_0xb220('0x3c')]);return db[_0xb220('0x4d')][_0xb220('0x47')](_0x2b8dea[_0xb220('0x48')],{'include':[{'model':db[_0xb220('0x54')],'as':_0xb220('0x50')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0xb220('0x23')](respondWithResult(_0x218c5f,null))[_0xb220('0x46')](handleError(_0x218c5f,null));};exports[_0xb220('0x55')]=function(_0x56a8af,_0x4e392c,_0x37e21c){var _0x5adb7a='';return db[_0xb220('0x2a')][_0xb220('0x4c')]({'where':{'id':_0x56a8af[_0xb220('0x4a')]['id']},'attributes':['id',_0xb220('0x56'),'apiKey']})[_0xb220('0x23')](handleEntityNotFound(_0x4e392c,null))[_0xb220('0x23')](function(_0x5c86c0){if(_0x5c86c0){_0x5adb7a=_0x5c86c0[_0xb220('0x56')];var _0x4c2f80=_0x5adb7a[_0xb220('0x57')](-0x1);if(_0x4c2f80==='/'){_0x5adb7a=_0x5adb7a[_0xb220('0x58')](0x0,_0x5adb7a[_0xb220('0x59')](_0x4c2f80));}return rp({'method':_0xb220('0x5a'),'uri':util['format'](_0xb220('0x5b'),_0x5adb7a,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0xb220('0x5c'),new Buffer(util[_0xb220('0x5d')](_0xb220('0x5e'),_0x5c86c0['apiKey']))[_0xb220('0x5f')](_0xb220('0x60')))},'json':!![]});}})['then'](function(_0x2741cb){if(_0x2741cb){var _0x3ecafc=[_0xb220('0x61'),_0xb220('0x62'),_0xb220('0x63'),_0xb220('0x64'),_0xb220('0x17'),_0xb220('0x65'),_0xb220('0x66'),_0xb220('0x67'),'ticket_type','group',_0xb220('0x68')];_[_0xb220('0x69')](_0x2741cb,function(_0x498f98){return _0x3ecafc[_0xb220('0x6a')](_0x498f98[_0xb220('0x27')])||!_0x498f98[_0xb220('0x6b')]&&_0x498f98[_0xb220('0x3c')]!==_0xb220('0x6c')&&_0x498f98[_0xb220('0x3c')]!=='custom_dropdown';});return{'count':_0x2741cb[_0xb220('0x44')],'rows':_[_0xb220('0x29')](_0x2741cb,function(_0x1a4bbf){return{'id':_0x1a4bbf[_0xb220('0x27')],'name':_0x1a4bbf[_0xb220('0x6d')],'custom':!_0x1a4bbf['default'],'options':_0x1a4bbf[_0xb220('0x6e')]?_[_0xb220('0x29')](_0x1a4bbf[_0xb220('0x6e')],function(_0x43e280){return{'name':_[_0xb220('0x6f')](_0x43e280),'value':_0x43e280};}):[]};})};}})['then'](respondWithResult(_0x4e392c,null))[_0xb220('0x46')](function(_0x57c5ee){var _0x5679f0=_0x56a8af[_0xb220('0x30')][_0xb220('0x70')]?0x1f4:_0x57c5ee[_0xb220('0x71')]||0x1f4;logger[_0xb220('0x25')](_0xb220('0x72'),_0xb220('0x55'),_0x5679f0,JSON[_0xb220('0x73')](_0x57c5ee));delete _0x57c5ee[_0xb220('0x27')];if(_0x5679f0===0x191){_0x5679f0=0x190;}_0x4e392c[_0xb220('0x17')](_0x5679f0)[_0xb220('0x28')](_0x56a8af[_0xb220('0x30')][_0xb220('0x70')]?{'message':_0xb220('0x74'),'statusCode':_0x57c5ee['statusCode']}:_0x57c5ee);});}; \ No newline at end of file +var _0xfb5d=['fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskAccount','length','find','catch','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','sort','AccountId','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','requester','subject','agent','description','group','source','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x463802,_0x26f078){var _0x28325e=function(_0x58cd49){while(--_0x58cd49){_0x463802['push'](_0x463802['shift']());}};_0x28325e(++_0x26f078);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfb5d[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xdfb5('0x0'));var rimraf=require(_0xdfb5('0x1'));var zipdir=require(_0xdfb5('0x2'));var jsonpatch=require(_0xdfb5('0x3'));var rp=require('request-promise');var moment=require(_0xdfb5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdfb5('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfb5('0x6'));var squel=require(_0xdfb5('0x7'));var crypto=require(_0xdfb5('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xdfb5('0x9'));var toCsv=require(_0xdfb5('0x5'));var querystring=require(_0xdfb5('0xa'));var Papa=require(_0xdfb5('0xb'));var Redis=require(_0xdfb5('0xc'));var authService=require(_0xdfb5('0xd'));var qs=require(_0xdfb5('0xe'));var as=require(_0xdfb5('0xf'));var hardwareService=require(_0xdfb5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xdfb5('0x11'));var config=require(_0xdfb5('0x12'));var licenseUtil=require(_0xdfb5('0x13'));var db=require(_0xdfb5('0x14'))['db'];var integrations=require(_0xdfb5('0x15'));function respondWithStatusCode(_0x57d233,_0x2b3683){_0x2b3683=_0x2b3683||0xcc;return function(_0x2b55eb){if(_0x2b55eb){return _0x57d233['sendStatus'](_0x2b3683);}return _0x57d233[_0xdfb5('0x16')](_0x2b3683)[_0xdfb5('0x17')]();};}function respondWithResult(_0x44c4a3,_0x11adb7){_0x11adb7=_0x11adb7||0xc8;return function(_0x130672){if(_0x130672){return _0x44c4a3['status'](_0x11adb7)['json'](_0x130672);}};}function respondWithFilteredResult(_0x15fd53,_0x4e863d){return function(_0xbd0bd6){if(_0xbd0bd6){var _0x39fbe2=typeof _0x4e863d[_0xdfb5('0x18')]===_0xdfb5('0x19')&&typeof _0x4e863d[_0xdfb5('0x1a')]===_0xdfb5('0x19');var _0x403a7e=_0xbd0bd6['count'];var _0x125d46=_0x39fbe2?0x0:_0x4e863d[_0xdfb5('0x18')];var _0xaf0d5f=_0x39fbe2?_0xbd0bd6[_0xdfb5('0x1b')]:_0x4e863d[_0xdfb5('0x18')]+_0x4e863d['limit'];var _0x73a580;if(_0xaf0d5f>=_0x403a7e){_0xaf0d5f=_0x403a7e;_0x73a580=0xc8;}else{_0x73a580=0xce;}_0x15fd53[_0xdfb5('0x16')](_0x73a580);return _0x15fd53['set'](_0xdfb5('0x1c'),_0x125d46+'-'+_0xaf0d5f+'/'+_0x403a7e)['json'](_0xbd0bd6);}return null;};}function patchUpdates(_0x3a0908){return function(_0x2cae3b){try{jsonpatch[_0xdfb5('0x1d')](_0x2cae3b,_0x3a0908,!![]);}catch(_0x38d67c){return BPromise['reject'](_0x38d67c);}return _0x2cae3b[_0xdfb5('0x1e')]();};}function saveUpdates(_0x2fbf03,_0xe08d19){return function(_0x4a672d){if(_0x4a672d){return _0x4a672d[_0xdfb5('0x1f')](_0x2fbf03)[_0xdfb5('0x20')](function(_0x401b08){return _0x401b08;});}return null;};}function removeEntity(_0x495c34,_0x51784c){return function(_0x5a39bb){if(_0x5a39bb){return _0x5a39bb[_0xdfb5('0x21')]()[_0xdfb5('0x20')](function(){_0x495c34[_0xdfb5('0x16')](0xcc)[_0xdfb5('0x17')]();});}};}function handleEntityNotFound(_0x5cc41c,_0x195a7f){return function(_0x4a9ce6){if(!_0x4a9ce6){_0x5cc41c[_0xdfb5('0x22')](0x194);}return _0x4a9ce6;};}function handleError(_0x3fbd65,_0x53667d){_0x53667d=_0x53667d||0x1f4;return function(_0x46f6d8){logger[_0xdfb5('0x23')](_0x46f6d8[_0xdfb5('0x24')]);if(_0x46f6d8['name']){delete _0x46f6d8[_0xdfb5('0x25')];}_0x3fbd65['status'](_0x53667d)[_0xdfb5('0x26')](_0x46f6d8);};}exports[_0xdfb5('0x27')]=function(_0x29f131,_0x2f1459){var _0x41b159={},_0x320aec={},_0x267e69={'count':0x0,'rows':[]};var _0x3b7312=_[_0xdfb5('0x28')](db['FreshdeskAccount'][_0xdfb5('0x29')],function(_0xa61e4d){return{'name':_0xa61e4d[_0xdfb5('0x2a')],'type':_0xa61e4d[_0xdfb5('0x2b')][_0xdfb5('0x2c')]};});_0x320aec[_0xdfb5('0x2d')]=_['map'](_0x3b7312,_0xdfb5('0x25'));_0x320aec['query']=_[_0xdfb5('0x2e')](_0x29f131[_0xdfb5('0x2f')]);_0x320aec[_0xdfb5('0x30')]=_[_0xdfb5('0x31')](_0x320aec[_0xdfb5('0x2d')],_0x320aec[_0xdfb5('0x2f')]);_0x41b159[_0xdfb5('0x32')]=_[_0xdfb5('0x31')](_0x320aec[_0xdfb5('0x2d')],qs[_0xdfb5('0x33')](_0x29f131['query'][_0xdfb5('0x33')]));_0x41b159[_0xdfb5('0x32')]=_0x41b159[_0xdfb5('0x32')]['length']?_0x41b159[_0xdfb5('0x32')]:_0x320aec[_0xdfb5('0x2d')];if(!_0x29f131[_0xdfb5('0x2f')][_0xdfb5('0x34')](_0xdfb5('0x35'))){_0x41b159[_0xdfb5('0x1a')]=qs[_0xdfb5('0x1a')](_0x29f131[_0xdfb5('0x2f')][_0xdfb5('0x1a')]);_0x41b159[_0xdfb5('0x18')]=qs[_0xdfb5('0x18')](_0x29f131[_0xdfb5('0x2f')]['offset']);}_0x41b159[_0xdfb5('0x36')]=qs['sort'](_0x29f131[_0xdfb5('0x2f')]['sort']);_0x41b159[_0xdfb5('0x37')]=qs[_0xdfb5('0x30')](_[_0xdfb5('0x38')](_0x29f131[_0xdfb5('0x2f')],_0x320aec[_0xdfb5('0x30')]),_0x3b7312);if(_0x29f131[_0xdfb5('0x2f')][_0xdfb5('0x39')]){_0x41b159['where']=_[_0xdfb5('0x3a')](_0x41b159[_0xdfb5('0x37')],{'$or':_[_0xdfb5('0x28')](_0x3b7312,function(_0x481c0b){if(_0x481c0b[_0xdfb5('0x2b')]!==_0xdfb5('0x3b')){var _0x34689a={};_0x34689a[_0x481c0b['name']]={'$like':'%'+_0x29f131[_0xdfb5('0x2f')][_0xdfb5('0x39')]+'%'};return _0x34689a;}})});}_0x41b159=_['merge']({},_0x41b159,_0x29f131[_0xdfb5('0x3c')]);var _0x552721={'where':_0x41b159[_0xdfb5('0x37')]};return db['FreshdeskAccount'][_0xdfb5('0x1b')](_0x552721)[_0xdfb5('0x20')](function(_0x1e3c9e){_0x267e69[_0xdfb5('0x1b')]=_0x1e3c9e;if(_0x29f131[_0xdfb5('0x2f')][_0xdfb5('0x3d')]){_0x41b159[_0xdfb5('0x3e')]=[{'all':!![]}];}return db[_0xdfb5('0x3f')]['findAll'](_0x41b159);})[_0xdfb5('0x20')](function(_0x34de27){_0x267e69['rows']=_0x34de27;return _0x267e69;})[_0xdfb5('0x20')](respondWithFilteredResult(_0x2f1459,_0x41b159))['catch'](handleError(_0x2f1459,null));};exports['show']=function(_0x333412,_0x266705){var _0x2b3b97={'raw':![],'where':{'id':_0x333412['params']['id']}},_0x39eee0={};_0x39eee0[_0xdfb5('0x2d')]=_[_0xdfb5('0x2e')](db[_0xdfb5('0x3f')][_0xdfb5('0x29')]);_0x39eee0[_0xdfb5('0x2f')]=_[_0xdfb5('0x2e')](_0x333412[_0xdfb5('0x2f')]);_0x39eee0[_0xdfb5('0x30')]=_['intersection'](_0x39eee0[_0xdfb5('0x2d')],_0x39eee0[_0xdfb5('0x2f')]);_0x2b3b97[_0xdfb5('0x32')]=_[_0xdfb5('0x31')](_0x39eee0[_0xdfb5('0x2d')],qs[_0xdfb5('0x33')](_0x333412[_0xdfb5('0x2f')][_0xdfb5('0x33')]));_0x2b3b97[_0xdfb5('0x32')]=_0x2b3b97['attributes'][_0xdfb5('0x40')]?_0x2b3b97[_0xdfb5('0x32')]:_0x39eee0[_0xdfb5('0x2d')];if(_0x333412[_0xdfb5('0x2f')]['includeAll']){_0x2b3b97['include']=[{'all':!![]}];}_0x2b3b97=_[_0xdfb5('0x3a')]({},_0x2b3b97,_0x333412[_0xdfb5('0x3c')]);return db['FreshdeskAccount'][_0xdfb5('0x41')](_0x2b3b97)['then'](handleEntityNotFound(_0x266705,null))['then'](respondWithResult(_0x266705,null))[_0xdfb5('0x42')](handleError(_0x266705,null));};exports[_0xdfb5('0x43')]=function(_0x4533e0,_0x5736e3){return db[_0xdfb5('0x3f')][_0xdfb5('0x43')](_0x4533e0[_0xdfb5('0x44')],{})[_0xdfb5('0x20')](respondWithResult(_0x5736e3,0xc9))[_0xdfb5('0x42')](handleError(_0x5736e3,null));};exports[_0xdfb5('0x1f')]=function(_0x1fdbcf,_0xf9c693){if(_0x1fdbcf['body']['id']){delete _0x1fdbcf['body']['id'];}return db[_0xdfb5('0x3f')]['find']({'where':{'id':_0x1fdbcf[_0xdfb5('0x45')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0xf9c693,null))[_0xdfb5('0x20')](saveUpdates(_0x1fdbcf['body'],null))['then'](respondWithResult(_0xf9c693,null))[_0xdfb5('0x42')](handleError(_0xf9c693,null));};exports[_0xdfb5('0x21')]=function(_0xccddab,_0x365335){return db[_0xdfb5('0x3f')][_0xdfb5('0x41')]({'where':{'id':_0xccddab['params']['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x365335,null))['then'](removeEntity(_0x365335,null))[_0xdfb5('0x42')](handleError(_0x365335,null));};exports[_0xdfb5('0x46')]=function(_0x5673f0,_0x363f43,_0x12ed0a){var _0x524138={};var _0x540c2a={};var _0x5448c6;var _0x1a04ce;return db[_0xdfb5('0x3f')][_0xdfb5('0x47')]({'where':{'id':_0x5673f0[_0xdfb5('0x45')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x363f43,null))['then'](function(_0x63b35c){if(_0x63b35c){_0x5448c6=_0x63b35c;_0x540c2a['model']=_[_0xdfb5('0x2e')](db[_0xdfb5('0x48')]['rawAttributes']);_0x540c2a[_0xdfb5('0x2f')]=_['keys'](_0x5673f0[_0xdfb5('0x2f')]);_0x540c2a['filters']=_[_0xdfb5('0x31')](_0x540c2a[_0xdfb5('0x2d')],_0x540c2a[_0xdfb5('0x2f')]);_0x524138[_0xdfb5('0x32')]=_[_0xdfb5('0x31')](_0x540c2a[_0xdfb5('0x2d')],qs[_0xdfb5('0x33')](_0x5673f0[_0xdfb5('0x2f')][_0xdfb5('0x33')]));_0x524138[_0xdfb5('0x32')]=_0x524138['attributes'][_0xdfb5('0x40')]?_0x524138[_0xdfb5('0x32')]:_0x540c2a[_0xdfb5('0x2d')];_0x524138['order']=qs[_0xdfb5('0x49')](_0x5673f0[_0xdfb5('0x2f')]['sort']);_0x524138[_0xdfb5('0x37')]=qs[_0xdfb5('0x30')](_['pick'](_0x5673f0[_0xdfb5('0x2f')],_0x540c2a[_0xdfb5('0x30')]));if(_0x5673f0['query'][_0xdfb5('0x39')]){_0x524138['where']=_[_0xdfb5('0x3a')](_0x524138['where'],{'$or':_['map'](_0x524138['attributes'],function(_0x542374){var _0x38174a={};_0x38174a[_0x542374]={'$like':'%'+_0x5673f0[_0xdfb5('0x2f')][_0xdfb5('0x39')]+'%'};return _0x38174a;})});}_0x524138=_[_0xdfb5('0x3a')]({},_0x524138,_0x5673f0[_0xdfb5('0x3c')]);return _0x5448c6[_0xdfb5('0x46')](_0x524138);}})[_0xdfb5('0x20')](function(_0x397b8e){if(_0x397b8e){_0x1a04ce=_0x397b8e[_0xdfb5('0x40')];if(!_0x5673f0[_0xdfb5('0x2f')][_0xdfb5('0x34')](_0xdfb5('0x35'))){_0x524138[_0xdfb5('0x1a')]=qs[_0xdfb5('0x1a')](_0x5673f0[_0xdfb5('0x2f')]['limit']);_0x524138['offset']=qs['offset'](_0x5673f0[_0xdfb5('0x2f')][_0xdfb5('0x18')]);}return _0x5448c6[_0xdfb5('0x46')](_0x524138);}})[_0xdfb5('0x20')](function(_0x284ee3){if(_0x284ee3){return _0x284ee3?{'count':_0x1a04ce,'rows':_0x284ee3}:null;}})[_0xdfb5('0x20')](respondWithResult(_0x363f43,null))[_0xdfb5('0x42')](handleError(_0x363f43,null));};exports['addConfiguration']=function(_0x4872ad,_0x3718c0,_0x15edd2){if(_0x4872ad[_0xdfb5('0x44')]['id']){delete _0x4872ad[_0xdfb5('0x44')]['id'];}return db['FreshdeskAccount'][_0xdfb5('0x47')]({'where':{'id':_0x4872ad[_0xdfb5('0x45')]['id']}})[_0xdfb5('0x20')](handleEntityNotFound(_0x3718c0,null))['then'](function(_0x5622ff){if(_0x5622ff){_0x4872ad[_0xdfb5('0x44')][_0xdfb5('0x4a')]=_0x5622ff['id'];_0x4872ad[_0xdfb5('0x44')]['Subjects']=integrations['getSubjects'](_0x4872ad[_0xdfb5('0x44')][_0xdfb5('0x4b')],_0x4872ad[_0xdfb5('0x44')]['type']);_0x4872ad['body'][_0xdfb5('0x4c')]=integrations[_0xdfb5('0x4d')](_0x4872ad[_0xdfb5('0x44')]['channel'],_0x4872ad['body'][_0xdfb5('0x2b')]);return db[_0xdfb5('0x48')][_0xdfb5('0x43')](_0x4872ad['body'],{'include':[{'model':db[_0xdfb5('0x4e')],'as':_0xdfb5('0x4f')},{'model':db[_0xdfb5('0x4e')],'as':_0xdfb5('0x4c')}]});}return null;})[_0xdfb5('0x20')](respondWithResult(_0x3718c0,null))[_0xdfb5('0x42')](handleError(_0x3718c0,null));};exports[_0xdfb5('0x50')]=function(_0x3ad536,_0x6a37e2,_0x2212a5){var _0x7e00d0='';return db[_0xdfb5('0x3f')][_0xdfb5('0x47')]({'where':{'id':_0x3ad536[_0xdfb5('0x45')]['id']},'attributes':['id',_0xdfb5('0x51'),'apiKey']})[_0xdfb5('0x20')](handleEntityNotFound(_0x6a37e2,null))[_0xdfb5('0x20')](function(_0x353f70){if(_0x353f70){_0x7e00d0=_0x353f70[_0xdfb5('0x51')];var _0x1fb28b=_0x7e00d0['slice'](-0x1);if(_0x1fb28b==='/'){_0x7e00d0=_0x7e00d0[_0xdfb5('0x52')](0x0,_0x7e00d0[_0xdfb5('0x53')](_0x1fb28b));}return rp({'method':'GET','uri':util[_0xdfb5('0x54')](_0xdfb5('0x55'),_0x7e00d0,_0xdfb5('0x56')),'headers':{'Authorization':util[_0xdfb5('0x54')](_0xdfb5('0x57'),new Buffer(util['format'](_0xdfb5('0x58'),_0x353f70[_0xdfb5('0x59')]))[_0xdfb5('0x5a')]('base64'))},'json':!![]});}})[_0xdfb5('0x20')](function(_0x523eb7){if(_0x523eb7){var _0x334607=[_0xdfb5('0x5b'),_0xdfb5('0x5c'),_0xdfb5('0x5d'),_0xdfb5('0x5e'),'status','priority',_0xdfb5('0x5f'),_0xdfb5('0x60'),_0xdfb5('0x61'),_0xdfb5('0x5f'),_0xdfb5('0x62')];_[_0xdfb5('0x63')](_0x523eb7,function(_0x4ab71d){return _0x334607[_0xdfb5('0x64')](_0x4ab71d[_0xdfb5('0x25')])||!_0x4ab71d[_0xdfb5('0x65')]&&_0x4ab71d['type']!==_0xdfb5('0x66')&&_0x4ab71d[_0xdfb5('0x2b')]!=='custom_dropdown';});return{'count':_0x523eb7[_0xdfb5('0x40')],'rows':_['map'](_0x523eb7,function(_0x48dba4){return{'id':_0x48dba4[_0xdfb5('0x25')],'name':_0x48dba4[_0xdfb5('0x67')],'custom':!_0x48dba4[_0xdfb5('0x65')],'options':_0x48dba4['choices']?_[_0xdfb5('0x28')](_0x48dba4[_0xdfb5('0x68')],function(_0x360363){return{'name':_[_0xdfb5('0x69')](_0x360363),'value':_0x360363};}):[]};})};}})['then'](respondWithResult(_0x6a37e2,null))[_0xdfb5('0x42')](function(_0x2e9024){var _0xf26134=_0x3ad536['query'][_0xdfb5('0x6a')]?0x1f4:_0x2e9024[_0xdfb5('0x6b')]||0x1f4;logger[_0xdfb5('0x23')](_0xdfb5('0x6c'),_0xdfb5('0x50'),_0xf26134,JSON[_0xdfb5('0x6d')](_0x2e9024));delete _0x2e9024['name'];if(_0xf26134===0x191){_0xf26134=0x190;}_0x6a37e2['status'](_0xf26134)[_0xdfb5('0x26')](_0x3ad536[_0xdfb5('0x2f')][_0xdfb5('0x6a')]?{'message':_0xdfb5('0x6e'),'statusCode':_0x2e9024[_0xdfb5('0x6b')]}:_0x2e9024);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 20b7652..251928e 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 _0x3981=['request-promise','path','rimraf','./intFreshdeskAccount.attributes','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','bluebird'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3981,0x151));var _0x1398=function(_0x52cb89,_0x42fca1){_0x52cb89=_0x52cb89-0x0;var _0x4ab7be=_0x3981[_0x52cb89];return _0x4ab7be;};'use strict';var _=require(_0x1398('0x0'));var util=require(_0x1398('0x1'));var logger=require('../../config/logger')(_0x1398('0x2'));var moment=require('moment');var BPromise=require(_0x1398('0x3'));var rp=require(_0x1398('0x4'));var fs=require('fs');var path=require(_0x1398('0x5'));var rimraf=require(_0x1398('0x6'));var config=require('../../config/environment');var attributes=require(_0x1398('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xb185de,_0x312854){return _0xb185de[_0x1398('0x8')](_0x1398('0x9'),attributes,{'tableName':_0x1398('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6f2=['../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes'];(function(_0x1213be,_0x272272){var _0x35f36d=function(_0x226279){while(--_0x226279){_0x1213be['push'](_0x1213be['shift']());}};_0x35f36d(++_0x272272);}(_0xe6f2,0x74));var _0x2e6f=function(_0x192918,_0x388e37){_0x192918=_0x192918-0x0;var _0x3280a9=_0xe6f2[_0x192918];return _0x3280a9;};'use strict';var _=require(_0x2e6f('0x0'));var util=require(_0x2e6f('0x1'));var logger=require(_0x2e6f('0x2'))(_0x2e6f('0x3'));var moment=require(_0x2e6f('0x4'));var BPromise=require(_0x2e6f('0x5'));var rp=require(_0x2e6f('0x6'));var fs=require('fs');var path=require(_0x2e6f('0x7'));var rimraf=require(_0x2e6f('0x8'));var config=require('../../config/environment');var attributes=require(_0x2e6f('0x9'));var integrations=require(_0x2e6f('0xa'));module[_0x2e6f('0xb')]=function(_0x230984,_0x5d5037){return _0x230984['define'](_0x2e6f('0xc'),attributes,{'tableName':_0x2e6f('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 0507bb5..d7c0cf3 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 _0x0060=['catch','FreshdeskAccount','options','raw','where','limit','include','map','attributes','model','then','GetFreshdeskAccount','ShowFreshdeskAccount','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x8f7c80,_0x18d080){var _0x4a9e7b=function(_0x10562d){while(--_0x10562d){_0x8f7c80['push'](_0x8f7c80['shift']());}};_0x4a9e7b(++_0x18d080);}(_0x0060,0x124));var _0x0006=function(_0xcf22a8,_0x35d51c){_0xcf22a8=_0xcf22a8-0x0;var _0x1137eb=_0x0060[_0xcf22a8];return _0x1137eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0006('0x0'));var rs=require(_0x0006('0x1'));var fs=require('fs');var Redis=require(_0x0006('0x2'));var db=require(_0x0006('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0006('0x4'))(_0x0006('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0006('0x6')][_0x0006('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c26ab,_0x3f7261,_0x5449ea){return new BPromise(function(_0x1e9b43,_0x45a457){return client[_0x0006('0x8')](_0x1c26ab,_0x5449ea)['then'](function(_0x39c9a9){logger[_0x0006('0x9')](_0x0006('0xa'),_0x3f7261,_0x0006('0xb'));logger[_0x0006('0xc')](_0x0006('0xd'),_0x3f7261,_0x0006('0xb'),JSON[_0x0006('0xe')](_0x39c9a9));if(_0x39c9a9[_0x0006('0xf')]){if(_0x39c9a9[_0x0006('0xf')]['code']===0x1f4){logger[_0x0006('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x3f7261,_0x39c9a9[_0x0006('0xf')]['message']);return _0x45a457(_0x39c9a9[_0x0006('0xf')]['message']);}logger[_0x0006('0xf')](_0x0006('0xa'),_0x3f7261,_0x39c9a9[_0x0006('0xf')][_0x0006('0x10')]);return _0x1e9b43(_0x39c9a9['error']['message']);}else{logger[_0x0006('0x9')](_0x0006('0xa'),_0x3f7261,'request\x20sent');_0x1e9b43(_0x39c9a9[_0x0006('0x11')][_0x0006('0x10')]);}})[_0x0006('0x12')](function(_0x1de017){logger[_0x0006('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x3f7261,_0x1de017);_0x45a457(_0x1de017);});});}exports['GetFreshdeskAccount']=function(_0x2fc144){var _0x1174e6=this;return new Promise(function(_0x1a092c,_0x1253bf){return db[_0x0006('0x13')]['findAll']({'raw':_0x2fc144[_0x0006('0x14')]?_0x2fc144[_0x0006('0x14')][_0x0006('0x15')]===undefined?!![]:![]:!![],'where':_0x2fc144[_0x0006('0x14')]?_0x2fc144[_0x0006('0x14')][_0x0006('0x16')]||null:null,'attributes':_0x2fc144['options']?_0x2fc144[_0x0006('0x14')]['attributes']||null:null,'limit':_0x2fc144[_0x0006('0x14')]?_0x2fc144[_0x0006('0x14')][_0x0006('0x17')]||null:null,'include':_0x2fc144[_0x0006('0x14')]?_0x2fc144[_0x0006('0x14')][_0x0006('0x18')]?_[_0x0006('0x19')](_0x2fc144[_0x0006('0x14')][_0x0006('0x18')],function(_0x4e5ee6){return{'model':db[_0x4e5ee6['model']],'as':_0x4e5ee6['as'],'attributes':_0x4e5ee6[_0x0006('0x1a')],'include':_0x4e5ee6[_0x0006('0x18')]?_['map'](_0x4e5ee6['include'],function(_0x3bb16b){return{'model':db[_0x3bb16b[_0x0006('0x1b')]],'as':_0x3bb16b['as'],'attributes':_0x3bb16b['attributes'],'include':_0x3bb16b['include']?_[_0x0006('0x19')](_0x3bb16b[_0x0006('0x18')],function(_0x5c4e27){return{'model':db[_0x5c4e27[_0x0006('0x1b')]],'as':_0x5c4e27['as'],'attributes':_0x5c4e27[_0x0006('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0006('0x1c')](function(_0x3ddd09){logger[_0x0006('0x9')](_0x0006('0x1d'),_0x2fc144);logger['debug']('GetFreshdeskAccount',_0x2fc144,JSON[_0x0006('0xe')](_0x3ddd09));_0x1a092c(_0x3ddd09);})[_0x0006('0x12')](function(_0x4b955e){logger[_0x0006('0xf')](_0x0006('0x1d'),_0x4b955e[_0x0006('0x10')],_0x2fc144);_0x1253bf(_0x1174e6[_0x0006('0xf')](0x1f4,_0x4b955e[_0x0006('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0x27be48){var _0x5332ef=this;return new Promise(function(_0x46b336,_0x34a049){return db[_0x0006('0x13')]['find']({'raw':_0x27be48[_0x0006('0x14')]?_0x27be48[_0x0006('0x14')][_0x0006('0x15')]===undefined?!![]:![]:!![],'where':_0x27be48[_0x0006('0x14')]?_0x27be48[_0x0006('0x14')][_0x0006('0x16')]||null:null,'attributes':_0x27be48[_0x0006('0x14')]?_0x27be48['options']['attributes']||null:null,'include':_0x27be48[_0x0006('0x14')]?_0x27be48['options']['include']?_[_0x0006('0x19')](_0x27be48['options'][_0x0006('0x18')],function(_0x25b184){return{'model':db[_0x25b184['model']],'as':_0x25b184['as'],'attributes':_0x25b184[_0x0006('0x1a')],'include':_0x25b184[_0x0006('0x18')]?_[_0x0006('0x19')](_0x25b184['include'],function(_0x40854f){return{'model':db[_0x40854f['model']],'as':_0x40854f['as'],'attributes':_0x40854f[_0x0006('0x1a')],'include':_0x40854f['include']?_[_0x0006('0x19')](_0x40854f[_0x0006('0x18')],function(_0x321797){return{'model':db[_0x321797[_0x0006('0x1b')]],'as':_0x321797['as'],'attributes':_0x321797[_0x0006('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0006('0x1c')](function(_0x15efae){logger['info']('ShowFreshdeskAccount',_0x27be48);logger[_0x0006('0xc')](_0x0006('0x1e'),_0x27be48,JSON[_0x0006('0xe')](_0x15efae));_0x46b336(_0x15efae);})[_0x0006('0x12')](function(_0x36662f){logger[_0x0006('0xf')](_0x0006('0x1e'),_0x36662f[_0x0006('0x10')],_0x27be48);_0x34a049(_0x5332ef[_0x0006('0xf')](0x1f4,_0x36662f[_0x0006('0x10')]));});});}; \ No newline at end of file +var _0xf2cc=['jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowFreshdeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5a98bb,_0xda2793){var _0x4c1e76=function(_0x5a1b5a){while(--_0x5a1b5a){_0x5a98bb['push'](_0x5a98bb['shift']());}};_0x4c1e76(++_0xda2793);}(_0xf2cc,0x1a8));var _0xcf2c=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf2cc[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xcf2c('0x0'));var util=require('util');var moment=require(_0xcf2c('0x1'));var BPromise=require(_0xcf2c('0x2'));var rs=require(_0xcf2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf2c('0x4'))['db'];var utils=require(_0xcf2c('0x5'));var logger=require(_0xcf2c('0x6'))(_0xcf2c('0x7'));var config=require('../../config/environment');var jayson=require(_0xcf2c('0x8'));var client=jayson['client'][_0xcf2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x213bef,_0x53b471,_0x152068){return new BPromise(function(_0x3ce89b,_0x1a468e){return client[_0xcf2c('0xa')](_0x213bef,_0x152068)[_0xcf2c('0xb')](function(_0x476bc4){logger['info'](_0xcf2c('0xc'),_0x53b471,_0xcf2c('0xd'));logger[_0xcf2c('0xe')](_0xcf2c('0xf'),_0x53b471,'request\x20sent',JSON[_0xcf2c('0x10')](_0x476bc4));if(_0x476bc4['error']){if(_0x476bc4[_0xcf2c('0x11')][_0xcf2c('0x12')]===0x1f4){logger[_0xcf2c('0x11')](_0xcf2c('0xc'),_0x53b471,_0x476bc4[_0xcf2c('0x11')][_0xcf2c('0x13')]);return _0x1a468e(_0x476bc4[_0xcf2c('0x11')][_0xcf2c('0x13')]);}logger['error'](_0xcf2c('0xc'),_0x53b471,_0x476bc4[_0xcf2c('0x11')][_0xcf2c('0x13')]);return _0x3ce89b(_0x476bc4['error'][_0xcf2c('0x13')]);}else{logger[_0xcf2c('0x14')](_0xcf2c('0xc'),_0x53b471,'request\x20sent');_0x3ce89b(_0x476bc4[_0xcf2c('0x15')][_0xcf2c('0x13')]);}})[_0xcf2c('0x16')](function(_0x46eeb6){logger[_0xcf2c('0x11')](_0xcf2c('0xc'),_0x53b471,_0x46eeb6);_0x1a468e(_0x46eeb6);});});}exports[_0xcf2c('0x17')]=function(_0x3b1e5b){var _0xbc6f63=this;return new Promise(function(_0x394aa1,_0x211618){return db[_0xcf2c('0x18')][_0xcf2c('0x19')]({'raw':_0x3b1e5b[_0xcf2c('0x1a')]?_0x3b1e5b[_0xcf2c('0x1a')][_0xcf2c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3b1e5b[_0xcf2c('0x1a')]?_0x3b1e5b[_0xcf2c('0x1a')][_0xcf2c('0x1c')]||null:null,'attributes':_0x3b1e5b[_0xcf2c('0x1a')]?_0x3b1e5b[_0xcf2c('0x1a')]['attributes']||null:null,'limit':_0x3b1e5b[_0xcf2c('0x1a')]?_0x3b1e5b[_0xcf2c('0x1a')][_0xcf2c('0x1d')]||null:null,'include':_0x3b1e5b[_0xcf2c('0x1a')]?_0x3b1e5b[_0xcf2c('0x1a')][_0xcf2c('0x1e')]?_[_0xcf2c('0x1f')](_0x3b1e5b['options'][_0xcf2c('0x1e')],function(_0x3ef082){return{'model':db[_0x3ef082['model']],'as':_0x3ef082['as'],'attributes':_0x3ef082['attributes'],'include':_0x3ef082[_0xcf2c('0x1e')]?_[_0xcf2c('0x1f')](_0x3ef082[_0xcf2c('0x1e')],function(_0x592e37){return{'model':db[_0x592e37[_0xcf2c('0x20')]],'as':_0x592e37['as'],'attributes':_0x592e37[_0xcf2c('0x21')],'include':_0x592e37[_0xcf2c('0x1e')]?_[_0xcf2c('0x1f')](_0x592e37[_0xcf2c('0x1e')],function(_0x58ebc0){return{'model':db[_0x58ebc0['model']],'as':_0x58ebc0['as'],'attributes':_0x58ebc0['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf2c('0xb')](function(_0x320238){logger[_0xcf2c('0x14')]('GetFreshdeskAccount',_0x3b1e5b);logger['debug'](_0xcf2c('0x17'),_0x3b1e5b,JSON['stringify'](_0x320238));_0x394aa1(_0x320238);})[_0xcf2c('0x16')](function(_0x936704){logger[_0xcf2c('0x11')](_0xcf2c('0x17'),_0x936704[_0xcf2c('0x13')],_0x3b1e5b);_0x211618(_0xbc6f63[_0xcf2c('0x11')](0x1f4,_0x936704[_0xcf2c('0x13')]));});});};exports[_0xcf2c('0x22')]=function(_0x12d9cd){var _0x584560=this;return new Promise(function(_0x44b6eb,_0x371b8b){return db[_0xcf2c('0x18')][_0xcf2c('0x23')]({'raw':_0x12d9cd['options']?_0x12d9cd['options'][_0xcf2c('0x1b')]===undefined?!![]:![]:!![],'where':_0x12d9cd['options']?_0x12d9cd[_0xcf2c('0x1a')][_0xcf2c('0x1c')]||null:null,'attributes':_0x12d9cd[_0xcf2c('0x1a')]?_0x12d9cd[_0xcf2c('0x1a')][_0xcf2c('0x21')]||null:null,'include':_0x12d9cd[_0xcf2c('0x1a')]?_0x12d9cd[_0xcf2c('0x1a')]['include']?_[_0xcf2c('0x1f')](_0x12d9cd[_0xcf2c('0x1a')][_0xcf2c('0x1e')],function(_0x29afb2){return{'model':db[_0x29afb2[_0xcf2c('0x20')]],'as':_0x29afb2['as'],'attributes':_0x29afb2[_0xcf2c('0x21')],'include':_0x29afb2[_0xcf2c('0x1e')]?_[_0xcf2c('0x1f')](_0x29afb2[_0xcf2c('0x1e')],function(_0x1b67ac){return{'model':db[_0x1b67ac[_0xcf2c('0x20')]],'as':_0x1b67ac['as'],'attributes':_0x1b67ac[_0xcf2c('0x21')],'include':_0x1b67ac[_0xcf2c('0x1e')]?_[_0xcf2c('0x1f')](_0x1b67ac[_0xcf2c('0x1e')],function(_0x32a1bf){return{'model':db[_0x32a1bf['model']],'as':_0x32a1bf['as'],'attributes':_0x32a1bf[_0xcf2c('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcf2c('0xb')](function(_0x289901){logger[_0xcf2c('0x14')](_0xcf2c('0x22'),_0x12d9cd);logger[_0xcf2c('0xe')](_0xcf2c('0x22'),_0x12d9cd,JSON[_0xcf2c('0x10')](_0x289901));_0x44b6eb(_0x289901);})[_0xcf2c('0x16')](function(_0x9cdf4d){logger[_0xcf2c('0x11')](_0xcf2c('0x22'),_0x9cdf4d[_0xcf2c('0x13')],_0x12d9cd);_0x371b8b(_0x584560[_0xcf2c('0x11')](0x1f4,_0x9cdf4d[_0xcf2c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 464d9f4..54028ce 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 _0x3211=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields'];(function(_0x111293,_0x10ff45){var _0x69e613=function(_0x4c89f4){while(--_0x4c89f4){_0x111293['push'](_0x111293['shift']());}};_0x69e613(++_0x10ff45);}(_0x3211,0x1a2));var _0x1321=function(_0x49b38f,_0x1828f1){_0x49b38f=_0x49b38f-0x0;var _0x3fa66d=_0x3211[_0x49b38f];return _0x3fa66d;};'use strict';var multer=require('multer');var util=require(_0x1321('0x0'));var path=require(_0x1321('0x1'));var timeout=require(_0x1321('0x2'));var express=require(_0x1321('0x3'));var router=express[_0x1321('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1321('0x5'));var interaction=require(_0x1321('0x6'));var config=require(_0x1321('0x7'));var controller=require(_0x1321('0x8'));router['get']('/',auth[_0x1321('0x9')](),controller[_0x1321('0xa')]);router[_0x1321('0xb')](_0x1321('0xc'),auth[_0x1321('0x9')](),controller['show']);router[_0x1321('0xb')](_0x1321('0xd'),auth[_0x1321('0x9')](),controller[_0x1321('0xe')]);router[_0x1321('0xb')](_0x1321('0xf'),auth[_0x1321('0x9')](),controller['getSubjects']);router['get'](_0x1321('0x10'),auth['isAuthenticated'](),controller[_0x1321('0x11')]);router[_0x1321('0xb')]('/:id/tags',auth[_0x1321('0x9')](),controller[_0x1321('0x12')]);router[_0x1321('0x13')]('/',auth[_0x1321('0x9')](),controller[_0x1321('0x14')]);router[_0x1321('0x13')](_0x1321('0x15'),auth[_0x1321('0x9')](),controller['setTags']);router[_0x1321('0x16')](_0x1321('0xc'),auth['isAuthenticated'](),controller[_0x1321('0x17')]);router[_0x1321('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x1321('0x19')]);module[_0x1321('0x1a')]=router; \ No newline at end of file +var _0x30a1=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x3e611b,_0x4c05e6){var _0x133be9=function(_0x2c0b80){while(--_0x2c0b80){_0x3e611b['push'](_0x3e611b['shift']());}};_0x133be9(++_0x4c05e6);}(_0x30a1,0x89));var _0x130a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x130a('0x0'));var util=require(_0x130a('0x1'));var path=require(_0x130a('0x2'));var timeout=require(_0x130a('0x3'));var express=require(_0x130a('0x4'));var router=express[_0x130a('0x5')]();var fs_extra=require(_0x130a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x130a('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x130a('0x8')]('/',auth[_0x130a('0x9')](),controller['index']);router[_0x130a('0x8')](_0x130a('0xa'),auth[_0x130a('0x9')](),controller[_0x130a('0xb')]);router[_0x130a('0x8')](_0x130a('0xc'),auth[_0x130a('0x9')](),controller[_0x130a('0xd')]);router['get'](_0x130a('0xe'),auth['isAuthenticated'](),controller[_0x130a('0xf')]);router[_0x130a('0x8')](_0x130a('0x10'),auth[_0x130a('0x9')](),controller[_0x130a('0x11')]);router['get'](_0x130a('0x12'),auth[_0x130a('0x9')](),controller[_0x130a('0x13')]);router[_0x130a('0x14')]('/',auth[_0x130a('0x9')](),controller['create']);router['post'](_0x130a('0x12'),auth[_0x130a('0x9')](),controller[_0x130a('0x15')]);router['put'](_0x130a('0xa'),auth['isAuthenticated'](),controller[_0x130a('0x16')]);router[_0x130a('0x17')](_0x130a('0xa'),auth['isAuthenticated'](),controller[_0x130a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 0ce4814..c87da9d 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 _0x24be=['exports','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x24be,0xfc));var _0xe24b=function(_0x56790a,_0x39e8ed){_0x56790a=_0x56790a-0x0;var _0x145e9b=_0x24be[_0x56790a];return _0x145e9b;};'use strict';var Sequelize=require('sequelize');module[_0xe24b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe24b('0x1')]}}; \ No newline at end of file +var _0xe7b7=['sequelize','exports','STRING'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0xe7b7,0x6f));var _0x7e7b=function(_0x5bf020,_0x31bb4e){_0x5bf020=_0x5bf020-0x0;var _0x51c18f=_0xe7b7[_0x5bf020];return _0x51c18f;};'use strict';var Sequelize=require(_0x7e7b('0x0'));module[_0x7e7b('0x1')]={'name':{'type':Sequelize[_0x7e7b('0x2')]},'description':{'type':Sequelize[_0x7e7b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index b5769c8..04636c1 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 _0x9b57=['ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','rows','catch','show','params','create','body','find','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x9b57,0x1de));var _0x79b5=function(_0x3741eb,_0x4aad25){_0x3741eb=_0x3741eb-0x0;var _0x499286=_0x9b57[_0x3741eb];return _0x499286;};'use strict';var emlformat=require(_0x79b5('0x0'));var rimraf=require(_0x79b5('0x1'));var zipdir=require(_0x79b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79b5('0x3'));var moment=require('moment');var BPromise=require(_0x79b5('0x4'));var Mustache=require(_0x79b5('0x5'));var util=require('util');var path=require(_0x79b5('0x6'));var sox=require(_0x79b5('0x7'));var csv=require('to-csv');var ejs=require(_0x79b5('0x8'));var fs=require('fs');var fs_extra=require(_0x79b5('0x9'));var _=require(_0x79b5('0xa'));var squel=require('squel');var crypto=require(_0x79b5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x79b5('0xc'));var toCsv=require(_0x79b5('0xd'));var querystring=require('querystring');var Papa=require(_0x79b5('0xe'));var Redis=require(_0x79b5('0xf'));var authService=require(_0x79b5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x79b5('0x11'));var hardwareService=require(_0x79b5('0x12'));var logger=require(_0x79b5('0x13'))(_0x79b5('0x14'));var utils=require('../../config/utils');var config=require(_0x79b5('0x15'));var licenseUtil=require(_0x79b5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53bd26,_0x1365d8){_0x1365d8=_0x1365d8||0xcc;return function(_0xdc445f){if(_0xdc445f){return _0x53bd26['sendStatus'](_0x1365d8);}return _0x53bd26[_0x79b5('0x17')](_0x1365d8)[_0x79b5('0x18')]();};}function respondWithResult(_0x34dd3f,_0x53edcf){_0x53edcf=_0x53edcf||0xc8;return function(_0x320d7e){if(_0x320d7e){return _0x34dd3f[_0x79b5('0x17')](_0x53edcf)[_0x79b5('0x19')](_0x320d7e);}};}function respondWithFilteredResult(_0x1514e6,_0x3c8b6d){return function(_0x17e215){if(_0x17e215){var _0x3dc348=typeof _0x3c8b6d[_0x79b5('0x1a')]===_0x79b5('0x1b')&&typeof _0x3c8b6d[_0x79b5('0x1c')]===_0x79b5('0x1b');var _0x8a7059=_0x17e215[_0x79b5('0x1d')];var _0x11dbd7=_0x3dc348?0x0:_0x3c8b6d['offset'];var _0x472967=_0x3dc348?_0x17e215['count']:_0x3c8b6d[_0x79b5('0x1a')]+_0x3c8b6d[_0x79b5('0x1c')];var _0x5124d7;if(_0x472967>=_0x8a7059){_0x472967=_0x8a7059;_0x5124d7=0xc8;}else{_0x5124d7=0xce;}_0x1514e6[_0x79b5('0x17')](_0x5124d7);return _0x1514e6['set'](_0x79b5('0x1e'),_0x11dbd7+'-'+_0x472967+'/'+_0x8a7059)[_0x79b5('0x19')](_0x17e215);}return null;};}function patchUpdates(_0x1a1a9a){return function(_0x150a09){try{jsonpatch['apply'](_0x150a09,_0x1a1a9a,!![]);}catch(_0x23c8bd){return BPromise[_0x79b5('0x1f')](_0x23c8bd);}return _0x150a09[_0x79b5('0x20')]();};}function saveUpdates(_0x56acaa,_0x4b0e8e){return function(_0x2c79ec){if(_0x2c79ec){return _0x2c79ec[_0x79b5('0x21')](_0x56acaa)[_0x79b5('0x22')](function(_0x4b65c5){return _0x4b65c5;});}return null;};}function removeEntity(_0x255a41,_0x58e514){return function(_0x4dfe33){if(_0x4dfe33){return _0x4dfe33[_0x79b5('0x23')]()[_0x79b5('0x22')](function(){_0x255a41[_0x79b5('0x17')](0xcc)[_0x79b5('0x18')]();});}};}function handleEntityNotFound(_0x16ec63,_0x1eca80){return function(_0x34615d){if(!_0x34615d){_0x16ec63[_0x79b5('0x24')](0x194);}return _0x34615d;};}function handleError(_0x26fd20,_0xc82c){_0xc82c=_0xc82c||0x1f4;return function(_0x13b8f1){logger[_0x79b5('0x25')](_0x13b8f1['stack']);if(_0x13b8f1['name']){delete _0x13b8f1[_0x79b5('0x26')];}_0x26fd20[_0x79b5('0x17')](_0xc82c)[_0x79b5('0x27')](_0x13b8f1);};}exports['index']=function(_0xf66c23,_0x3f59a8){var _0x5c1177={},_0x57a543={},_0x5ac6bf={'count':0x0,'rows':[]};var _0x32ebc2=_[_0x79b5('0x28')](db['FreshdeskConfiguration'][_0x79b5('0x29')],function(_0x54fb11){return{'name':_0x54fb11['fieldName'],'type':_0x54fb11[_0x79b5('0x2a')][_0x79b5('0x2b')]};});_0x57a543[_0x79b5('0x2c')]=_[_0x79b5('0x28')](_0x32ebc2,_0x79b5('0x26'));_0x57a543[_0x79b5('0x2d')]=_[_0x79b5('0x2e')](_0xf66c23[_0x79b5('0x2d')]);_0x57a543[_0x79b5('0x2f')]=_[_0x79b5('0x30')](_0x57a543['model'],_0x57a543[_0x79b5('0x2d')]);_0x5c1177[_0x79b5('0x31')]=_[_0x79b5('0x30')](_0x57a543[_0x79b5('0x2c')],qs[_0x79b5('0x32')](_0xf66c23[_0x79b5('0x2d')][_0x79b5('0x32')]));_0x5c1177['attributes']=_0x5c1177[_0x79b5('0x31')][_0x79b5('0x33')]?_0x5c1177[_0x79b5('0x31')]:_0x57a543[_0x79b5('0x2c')];if(!_0xf66c23[_0x79b5('0x2d')][_0x79b5('0x34')](_0x79b5('0x35'))){_0x5c1177[_0x79b5('0x1c')]=qs[_0x79b5('0x1c')](_0xf66c23['query'][_0x79b5('0x1c')]);_0x5c1177[_0x79b5('0x1a')]=qs[_0x79b5('0x1a')](_0xf66c23['query'][_0x79b5('0x1a')]);}_0x5c1177['order']=qs[_0x79b5('0x36')](_0xf66c23['query'][_0x79b5('0x36')]);_0x5c1177[_0x79b5('0x37')]=qs['filters'](_[_0x79b5('0x38')](_0xf66c23[_0x79b5('0x2d')],_0x57a543['filters']),_0x32ebc2);if(_0xf66c23['query'][_0x79b5('0x39')]){_0x5c1177[_0x79b5('0x37')]=_[_0x79b5('0x3a')](_0x5c1177[_0x79b5('0x37')],{'$or':_[_0x79b5('0x28')](_0x32ebc2,function(_0x2792be){if(_0x2792be[_0x79b5('0x2a')]!==_0x79b5('0x3b')){var _0x332b7e={};_0x332b7e[_0x2792be[_0x79b5('0x26')]]={'$like':'%'+_0xf66c23[_0x79b5('0x2d')][_0x79b5('0x39')]+'%'};return _0x332b7e;}})});}_0x5c1177=_['merge']({},_0x5c1177,_0xf66c23[_0x79b5('0x3c')]);var _0x1d49ac={'where':_0x5c1177[_0x79b5('0x37')]};return db[_0x79b5('0x3d')][_0x79b5('0x1d')](_0x1d49ac)[_0x79b5('0x22')](function(_0x2577d3){_0x5ac6bf['count']=_0x2577d3;if(_0xf66c23[_0x79b5('0x2d')][_0x79b5('0x3e')]){_0x5c1177[_0x79b5('0x3f')]=[{'all':!![]}];}return db[_0x79b5('0x3d')]['findAll'](_0x5c1177);})[_0x79b5('0x22')](function(_0x5e601b){_0x5ac6bf[_0x79b5('0x40')]=_0x5e601b;return _0x5ac6bf;})[_0x79b5('0x22')](respondWithFilteredResult(_0x3f59a8,_0x5c1177))[_0x79b5('0x41')](handleError(_0x3f59a8,null));};exports[_0x79b5('0x42')]=function(_0x434431,_0x46f681){var _0x51d2a5={'raw':![],'where':{'id':_0x434431[_0x79b5('0x43')]['id']}},_0x23b286={};_0x23b286[_0x79b5('0x2c')]=_[_0x79b5('0x2e')](db['FreshdeskConfiguration'][_0x79b5('0x29')]);_0x23b286['query']=_[_0x79b5('0x2e')](_0x434431['query']);_0x23b286[_0x79b5('0x2f')]=_[_0x79b5('0x30')](_0x23b286[_0x79b5('0x2c')],_0x23b286[_0x79b5('0x2d')]);_0x51d2a5[_0x79b5('0x31')]=_[_0x79b5('0x30')](_0x23b286[_0x79b5('0x2c')],qs[_0x79b5('0x32')](_0x434431[_0x79b5('0x2d')]['fields']));_0x51d2a5[_0x79b5('0x31')]=_0x51d2a5['attributes'][_0x79b5('0x33')]?_0x51d2a5[_0x79b5('0x31')]:_0x23b286[_0x79b5('0x2c')];if(_0x434431['query'][_0x79b5('0x3e')]){_0x51d2a5[_0x79b5('0x3f')]=[{'all':!![]}];}_0x51d2a5=_[_0x79b5('0x3a')]({},_0x51d2a5,_0x434431[_0x79b5('0x3c')]);return db[_0x79b5('0x3d')]['find'](_0x51d2a5)[_0x79b5('0x22')](handleEntityNotFound(_0x46f681,null))[_0x79b5('0x22')](respondWithResult(_0x46f681,null))['catch'](handleError(_0x46f681,null));};exports['create']=function(_0x3627e8,_0x287249){return db[_0x79b5('0x3d')][_0x79b5('0x44')](_0x3627e8[_0x79b5('0x45')],{})[_0x79b5('0x22')](respondWithResult(_0x287249,0xc9))[_0x79b5('0x41')](handleError(_0x287249,null));};exports['update']=function(_0x14483f,_0x1ad801){if(_0x14483f[_0x79b5('0x45')]['id']){delete _0x14483f['body']['id'];}return db[_0x79b5('0x3d')]['find']({'where':{'id':_0x14483f['params']['id']}})[_0x79b5('0x22')](handleEntityNotFound(_0x1ad801,null))[_0x79b5('0x22')](saveUpdates(_0x14483f[_0x79b5('0x45')],null))[_0x79b5('0x22')](respondWithResult(_0x1ad801,null))[_0x79b5('0x41')](handleError(_0x1ad801,null));};exports[_0x79b5('0x23')]=function(_0x5b2a96,_0x433810){return db[_0x79b5('0x3d')][_0x79b5('0x46')]({'where':{'id':_0x5b2a96['params']['id']}})[_0x79b5('0x22')](handleEntityNotFound(_0x433810,null))[_0x79b5('0x22')](removeEntity(_0x433810,null))[_0x79b5('0x41')](handleError(_0x433810,null));};exports[_0x79b5('0x47')]=function(_0x1ea294,_0x17ca60,_0x2566f8){var _0xfc196f={};var _0x1a607d={};var _0x3cd644;var _0x4e7ad7;return db[_0x79b5('0x3d')][_0x79b5('0x48')]({'where':{'id':_0x1ea294['params']['id']}})[_0x79b5('0x22')](handleEntityNotFound(_0x17ca60,null))[_0x79b5('0x22')](function(_0x134bca){if(_0x134bca){_0x3cd644=_0x134bca;_0x1a607d[_0x79b5('0x2c')]=_['keys'](db[_0x79b5('0x49')][_0x79b5('0x29')]);_0x1a607d[_0x79b5('0x2d')]=_[_0x79b5('0x2e')](_0x1ea294[_0x79b5('0x2d')]);_0x1a607d[_0x79b5('0x2f')]=_[_0x79b5('0x30')](_0x1a607d['model'],_0x1a607d[_0x79b5('0x2d')]);_0xfc196f['attributes']=_['intersection'](_0x1a607d['model'],qs['fields'](_0x1ea294[_0x79b5('0x2d')][_0x79b5('0x32')]));_0xfc196f[_0x79b5('0x31')]=_0xfc196f[_0x79b5('0x31')][_0x79b5('0x33')]?_0xfc196f[_0x79b5('0x31')]:_0x1a607d[_0x79b5('0x2c')];_0xfc196f[_0x79b5('0x4a')]=qs['sort'](_0x1ea294[_0x79b5('0x2d')][_0x79b5('0x36')]);_0xfc196f[_0x79b5('0x37')]=qs[_0x79b5('0x2f')](_[_0x79b5('0x38')](_0x1ea294['query'],_0x1a607d['filters']));if(_0x1ea294[_0x79b5('0x2d')][_0x79b5('0x39')]){_0xfc196f[_0x79b5('0x37')]=_['merge'](_0xfc196f['where'],{'$or':_['map'](_0xfc196f[_0x79b5('0x31')],function(_0x4ac287){var _0x50070b={};_0x50070b[_0x4ac287]={'$like':'%'+_0x1ea294['query']['filter']+'%'};return _0x50070b;})});}_0xfc196f=_['merge']({},_0xfc196f,_0x1ea294['options']);return _0x3cd644[_0x79b5('0x47')](_0xfc196f);}})['then'](function(_0x2bd997){if(_0x2bd997){_0x4e7ad7=_0x2bd997[_0x79b5('0x33')];if(!_0x1ea294[_0x79b5('0x2d')][_0x79b5('0x34')]('nolimit')){_0xfc196f['limit']=qs[_0x79b5('0x1c')](_0x1ea294['query']['limit']);_0xfc196f[_0x79b5('0x1a')]=qs[_0x79b5('0x1a')](_0x1ea294['query'][_0x79b5('0x1a')]);}return _0x3cd644[_0x79b5('0x47')](_0xfc196f);}})[_0x79b5('0x22')](function(_0x4e5f08){if(_0x4e5f08){return _0x4e5f08?{'count':_0x4e7ad7,'rows':_0x4e5f08}:null;}})[_0x79b5('0x22')](respondWithResult(_0x17ca60,null))[_0x79b5('0x41')](handleError(_0x17ca60,null));};exports[_0x79b5('0x4b')]=function(_0x5b24b6,_0x302f73,_0x5031e4){var _0x37ff7a={};var _0x871b45={};var _0x1d7dff;var _0xf3ea2c;return db[_0x79b5('0x3d')][_0x79b5('0x48')]({'where':{'id':_0x5b24b6['params']['id']}})[_0x79b5('0x22')](handleEntityNotFound(_0x302f73,null))[_0x79b5('0x22')](function(_0x37169a){if(_0x37169a){_0x1d7dff=_0x37169a;_0x871b45[_0x79b5('0x2c')]=_['keys'](db[_0x79b5('0x49')][_0x79b5('0x29')]);_0x871b45[_0x79b5('0x2d')]=_[_0x79b5('0x2e')](_0x5b24b6[_0x79b5('0x2d')]);_0x871b45[_0x79b5('0x2f')]=_[_0x79b5('0x30')](_0x871b45[_0x79b5('0x2c')],_0x871b45[_0x79b5('0x2d')]);_0x37ff7a[_0x79b5('0x31')]=_['intersection'](_0x871b45[_0x79b5('0x2c')],qs[_0x79b5('0x32')](_0x5b24b6[_0x79b5('0x2d')][_0x79b5('0x32')]));_0x37ff7a[_0x79b5('0x31')]=_0x37ff7a[_0x79b5('0x31')][_0x79b5('0x33')]?_0x37ff7a['attributes']:_0x871b45[_0x79b5('0x2c')];_0x37ff7a[_0x79b5('0x4a')]=qs[_0x79b5('0x36')](_0x5b24b6[_0x79b5('0x2d')][_0x79b5('0x36')]);_0x37ff7a[_0x79b5('0x37')]=qs[_0x79b5('0x2f')](_[_0x79b5('0x38')](_0x5b24b6['query'],_0x871b45[_0x79b5('0x2f')]));if(_0x5b24b6['query'][_0x79b5('0x39')]){_0x37ff7a[_0x79b5('0x37')]=_['merge'](_0x37ff7a[_0x79b5('0x37')],{'$or':_[_0x79b5('0x28')](_0x37ff7a[_0x79b5('0x31')],function(_0x5a7adb){var _0x4268f5={};_0x4268f5[_0x5a7adb]={'$like':'%'+_0x5b24b6[_0x79b5('0x2d')]['filter']+'%'};return _0x4268f5;})});}_0x37ff7a=_[_0x79b5('0x3a')]({},_0x37ff7a,_0x5b24b6[_0x79b5('0x3c')]);return _0x1d7dff[_0x79b5('0x4b')](_0x37ff7a);}})['then'](function(_0x57665a){if(_0x57665a){_0xf3ea2c=_0x57665a[_0x79b5('0x33')];if(!_0x5b24b6[_0x79b5('0x2d')][_0x79b5('0x34')]('nolimit')){_0x37ff7a[_0x79b5('0x1c')]=qs[_0x79b5('0x1c')](_0x5b24b6[_0x79b5('0x2d')][_0x79b5('0x1c')]);_0x37ff7a[_0x79b5('0x1a')]=qs[_0x79b5('0x1a')](_0x5b24b6[_0x79b5('0x2d')][_0x79b5('0x1a')]);}return _0x1d7dff[_0x79b5('0x4b')](_0x37ff7a);}})['then'](function(_0x281c17){if(_0x281c17){return _0x281c17?{'count':_0xf3ea2c,'rows':_0x281c17}:null;}})['then'](respondWithResult(_0x302f73,null))[_0x79b5('0x41')](handleError(_0x302f73,null));};exports[_0x79b5('0x4c')]=function(_0x30b8b2,_0x4da260,_0x5cfeac){var _0x512ec6={};var _0x187c08={};var _0x1f6841;var _0x557863;return db[_0x79b5('0x3d')][_0x79b5('0x48')]({'where':{'id':_0x30b8b2[_0x79b5('0x43')]['id']}})[_0x79b5('0x22')](handleEntityNotFound(_0x4da260,null))[_0x79b5('0x22')](function(_0x54208d){if(_0x54208d){_0x1f6841=_0x54208d;_0x187c08[_0x79b5('0x2c')]=_[_0x79b5('0x2e')](db[_0x79b5('0x49')]['rawAttributes']);_0x187c08[_0x79b5('0x2d')]=_['keys'](_0x30b8b2[_0x79b5('0x2d')]);_0x187c08[_0x79b5('0x2f')]=_[_0x79b5('0x30')](_0x187c08[_0x79b5('0x2c')],_0x187c08[_0x79b5('0x2d')]);_0x512ec6[_0x79b5('0x31')]=_[_0x79b5('0x30')](_0x187c08[_0x79b5('0x2c')],qs[_0x79b5('0x32')](_0x30b8b2[_0x79b5('0x2d')][_0x79b5('0x32')]));_0x512ec6[_0x79b5('0x31')]=_0x512ec6[_0x79b5('0x31')][_0x79b5('0x33')]?_0x512ec6[_0x79b5('0x31')]:_0x187c08[_0x79b5('0x2c')];_0x512ec6[_0x79b5('0x4a')]=qs['sort'](_0x30b8b2[_0x79b5('0x2d')][_0x79b5('0x36')]);_0x512ec6[_0x79b5('0x37')]=qs[_0x79b5('0x2f')](_[_0x79b5('0x38')](_0x30b8b2[_0x79b5('0x2d')],_0x187c08[_0x79b5('0x2f')]));if(_0x30b8b2[_0x79b5('0x2d')][_0x79b5('0x39')]){_0x512ec6[_0x79b5('0x37')]=_['merge'](_0x512ec6[_0x79b5('0x37')],{'$or':_[_0x79b5('0x28')](_0x512ec6[_0x79b5('0x31')],function(_0x19cacc){var _0x13c884={};_0x13c884[_0x19cacc]={'$like':'%'+_0x30b8b2['query'][_0x79b5('0x39')]+'%'};return _0x13c884;})});}_0x512ec6=_[_0x79b5('0x3a')]({},_0x512ec6,_0x30b8b2[_0x79b5('0x3c')]);return _0x1f6841[_0x79b5('0x4c')](_0x512ec6);}})['then'](function(_0x263397){if(_0x263397){_0x557863=_0x263397[_0x79b5('0x33')];if(!_0x30b8b2[_0x79b5('0x2d')]['hasOwnProperty'](_0x79b5('0x35'))){_0x512ec6['limit']=qs[_0x79b5('0x1c')](_0x30b8b2['query']['limit']);_0x512ec6['offset']=qs[_0x79b5('0x1a')](_0x30b8b2[_0x79b5('0x2d')]['offset']);}return _0x1f6841['getDescriptions'](_0x512ec6);}})['then'](function(_0x37c27b){if(_0x37c27b){return _0x37c27b?{'count':_0x557863,'rows':_0x37c27b}:null;}})['then'](respondWithResult(_0x4da260,null))['catch'](handleError(_0x4da260,null));};exports[_0x79b5('0x4d')]=function(_0x1b9339,_0x1749bb,_0x56166b){var _0x1155d6={};var _0x47e9fe={};var _0x5bfa73;var _0x55ff1c;return db['FreshdeskConfiguration'][_0x79b5('0x48')]({'where':{'id':_0x1b9339[_0x79b5('0x43')]['id']}})[_0x79b5('0x22')](handleEntityNotFound(_0x1749bb,null))[_0x79b5('0x22')](function(_0x28d8c2){if(_0x28d8c2){_0x5bfa73=_0x28d8c2;_0x47e9fe['model']=_[_0x79b5('0x2e')](db[_0x79b5('0x4e')][_0x79b5('0x29')]);_0x47e9fe[_0x79b5('0x2d')]=_[_0x79b5('0x2e')](_0x1b9339['query']);_0x47e9fe['filters']=_[_0x79b5('0x30')](_0x47e9fe[_0x79b5('0x2c')],_0x47e9fe[_0x79b5('0x2d')]);_0x1155d6[_0x79b5('0x31')]=_['intersection'](_0x47e9fe[_0x79b5('0x2c')],qs['fields'](_0x1b9339[_0x79b5('0x2d')]['fields']));_0x1155d6['attributes']=_0x1155d6[_0x79b5('0x31')][_0x79b5('0x33')]?_0x1155d6['attributes']:_0x47e9fe['model'];_0x1155d6[_0x79b5('0x4a')]=qs[_0x79b5('0x36')](_0x1b9339[_0x79b5('0x2d')][_0x79b5('0x36')]);_0x1155d6[_0x79b5('0x37')]=qs[_0x79b5('0x2f')](_[_0x79b5('0x38')](_0x1b9339[_0x79b5('0x2d')],_0x47e9fe[_0x79b5('0x2f')]));if(_0x1b9339[_0x79b5('0x2d')][_0x79b5('0x39')]){_0x1155d6[_0x79b5('0x37')]=_[_0x79b5('0x3a')](_0x1155d6['where'],{'$or':_[_0x79b5('0x28')](_0x1155d6[_0x79b5('0x31')],function(_0x38557f){var _0x4d0d9e={};_0x4d0d9e[_0x38557f]={'$like':'%'+_0x1b9339['query'][_0x79b5('0x39')]+'%'};return _0x4d0d9e;})});}_0x1155d6=_[_0x79b5('0x3a')]({},_0x1155d6,_0x1b9339[_0x79b5('0x3c')]);return _0x5bfa73['getTags'](_0x1155d6);}})[_0x79b5('0x22')](function(_0x2d1174){if(_0x2d1174){_0x55ff1c=_0x2d1174[_0x79b5('0x33')];if(!_0x1b9339[_0x79b5('0x2d')]['hasOwnProperty'](_0x79b5('0x35'))){_0x1155d6['limit']=qs['limit'](_0x1b9339[_0x79b5('0x2d')]['limit']);_0x1155d6[_0x79b5('0x1a')]=qs[_0x79b5('0x1a')](_0x1b9339['query'][_0x79b5('0x1a')]);}return _0x5bfa73[_0x79b5('0x4d')](_0x1155d6);}})['then'](function(_0x9a3ca8){if(_0x9a3ca8){return _0x9a3ca8?{'count':_0x55ff1c,'rows':_0x9a3ca8}:null;}})[_0x79b5('0x22')](respondWithResult(_0x1749bb,null))[_0x79b5('0x41')](handleError(_0x1749bb,null));};exports[_0x79b5('0x4f')]=function(_0x433591,_0x3f1af8,_0x4537f5){if(_0x433591[_0x79b5('0x45')]['id']){delete _0x433591[_0x79b5('0x45')]['id'];}return db[_0x79b5('0x3d')][_0x79b5('0x48')]({'where':{'id':_0x433591[_0x79b5('0x43')]['id']}})[_0x79b5('0x22')](handleEntityNotFound(_0x3f1af8,null))['then'](function(_0x4b6ba5){if(_0x4b6ba5){return _0x4b6ba5[_0x79b5('0x4f')](_0x433591[_0x79b5('0x45')][_0x79b5('0x50')]||[]);}return null;})[_0x79b5('0x22')](respondWithResult(_0x3f1af8,null))[_0x79b5('0x41')](handleError(_0x3f1af8,null));}; \ No newline at end of file +var _0xab64=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','FreshdeskConfiguration','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','findOne','length','filter','getFields','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2aef8b,_0x2c9aca){var _0xc199a3=function(_0xa875d2){while(--_0xa875d2){_0x2aef8b['push'](_0x2aef8b['shift']());}};_0xc199a3(++_0x2c9aca);}(_0xab64,0x13a));var _0x4ab6=function(_0x33bb05,_0x2d23aa){_0x33bb05=_0x33bb05-0x0;var _0x191ea2=_0xab64[_0x33bb05];return _0x191ea2;};'use strict';var emlformat=require(_0x4ab6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ab6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ab6('0x2'));var moment=require(_0x4ab6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4ab6('0x4'));var util=require(_0x4ab6('0x5'));var path=require(_0x4ab6('0x6'));var sox=require(_0x4ab6('0x7'));var csv=require(_0x4ab6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ab6('0x9'));var squel=require(_0x4ab6('0xa'));var crypto=require(_0x4ab6('0xb'));var jsforce=require(_0x4ab6('0xc'));var deskjs=require(_0x4ab6('0xd'));var toCsv=require(_0x4ab6('0x8'));var querystring=require(_0x4ab6('0xe'));var Papa=require('papaparse');var Redis=require(_0x4ab6('0xf'));var authService=require(_0x4ab6('0x10'));var qs=require(_0x4ab6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ab6('0x12'));var logger=require(_0x4ab6('0x13'))('api');var utils=require(_0x4ab6('0x14'));var config=require(_0x4ab6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4ab6('0x16'))['db'];function respondWithStatusCode(_0x10cf40,_0x59539f){_0x59539f=_0x59539f||0xcc;return function(_0x418cc6){if(_0x418cc6){return _0x10cf40[_0x4ab6('0x17')](_0x59539f);}return _0x10cf40[_0x4ab6('0x18')](_0x59539f)['end']();};}function respondWithResult(_0x59bd3a,_0x3bc812){_0x3bc812=_0x3bc812||0xc8;return function(_0x285ef2){if(_0x285ef2){return _0x59bd3a[_0x4ab6('0x18')](_0x3bc812)[_0x4ab6('0x19')](_0x285ef2);}};}function respondWithFilteredResult(_0x4a9715,_0x644267){return function(_0x28d2d8){if(_0x28d2d8){var _0x3cc6da=typeof _0x644267[_0x4ab6('0x1a')]===_0x4ab6('0x1b')&&typeof _0x644267['limit']===_0x4ab6('0x1b');var _0x8ac424=_0x28d2d8[_0x4ab6('0x1c')];var _0x191b05=_0x3cc6da?0x0:_0x644267['offset'];var _0x222217=_0x3cc6da?_0x28d2d8[_0x4ab6('0x1c')]:_0x644267[_0x4ab6('0x1a')]+_0x644267['limit'];var _0x157609;if(_0x222217>=_0x8ac424){_0x222217=_0x8ac424;_0x157609=0xc8;}else{_0x157609=0xce;}_0x4a9715[_0x4ab6('0x18')](_0x157609);return _0x4a9715[_0x4ab6('0x1d')](_0x4ab6('0x1e'),_0x191b05+'-'+_0x222217+'/'+_0x8ac424)[_0x4ab6('0x19')](_0x28d2d8);}return null;};}function patchUpdates(_0x155d60){return function(_0xaa44be){try{jsonpatch[_0x4ab6('0x1f')](_0xaa44be,_0x155d60,!![]);}catch(_0x5b2a8f){return BPromise[_0x4ab6('0x20')](_0x5b2a8f);}return _0xaa44be[_0x4ab6('0x21')]();};}function saveUpdates(_0x3831b5,_0x31b8be){return function(_0x443776){if(_0x443776){return _0x443776[_0x4ab6('0x22')](_0x3831b5)[_0x4ab6('0x23')](function(_0x1d4722){return _0x1d4722;});}return null;};}function removeEntity(_0x3d1065,_0x355221){return function(_0x547863){if(_0x547863){return _0x547863[_0x4ab6('0x24')]()[_0x4ab6('0x23')](function(){_0x3d1065[_0x4ab6('0x18')](0xcc)[_0x4ab6('0x25')]();});}};}function handleEntityNotFound(_0xd14280,_0x4ef189){return function(_0x24ffb7){if(!_0x24ffb7){_0xd14280[_0x4ab6('0x17')](0x194);}return _0x24ffb7;};}function handleError(_0x447e5b,_0x91c01c){_0x91c01c=_0x91c01c||0x1f4;return function(_0x16dd1f){logger['error'](_0x16dd1f[_0x4ab6('0x26')]);if(_0x16dd1f[_0x4ab6('0x27')]){delete _0x16dd1f[_0x4ab6('0x27')];}_0x447e5b['status'](_0x91c01c)[_0x4ab6('0x28')](_0x16dd1f);};}exports[_0x4ab6('0x29')]=function(_0x85de71,_0x5e6fd3){var _0x2a9ee5={},_0x40ec89={},_0x4653db={'count':0x0,'rows':[]};var _0x464a22=_[_0x4ab6('0x2a')](db[_0x4ab6('0x2b')]['rawAttributes'],function(_0x8f9d73){return{'name':_0x8f9d73['fieldName'],'type':_0x8f9d73[_0x4ab6('0x2c')][_0x4ab6('0x2d')]};});_0x40ec89[_0x4ab6('0x2e')]=_['map'](_0x464a22,_0x4ab6('0x27'));_0x40ec89[_0x4ab6('0x2f')]=_[_0x4ab6('0x30')](_0x85de71['query']);_0x40ec89['filters']=_[_0x4ab6('0x31')](_0x40ec89[_0x4ab6('0x2e')],_0x40ec89[_0x4ab6('0x2f')]);_0x2a9ee5['attributes']=_['intersection'](_0x40ec89[_0x4ab6('0x2e')],qs[_0x4ab6('0x32')](_0x85de71[_0x4ab6('0x2f')][_0x4ab6('0x32')]));_0x2a9ee5[_0x4ab6('0x33')]=_0x2a9ee5[_0x4ab6('0x33')]['length']?_0x2a9ee5[_0x4ab6('0x33')]:_0x40ec89[_0x4ab6('0x2e')];if(!_0x85de71[_0x4ab6('0x2f')][_0x4ab6('0x34')](_0x4ab6('0x35'))){_0x2a9ee5[_0x4ab6('0x36')]=qs['limit'](_0x85de71[_0x4ab6('0x2f')][_0x4ab6('0x36')]);_0x2a9ee5['offset']=qs[_0x4ab6('0x1a')](_0x85de71[_0x4ab6('0x2f')][_0x4ab6('0x1a')]);}_0x2a9ee5[_0x4ab6('0x37')]=qs[_0x4ab6('0x38')](_0x85de71['query'][_0x4ab6('0x38')]);_0x2a9ee5[_0x4ab6('0x39')]=qs[_0x4ab6('0x3a')](_[_0x4ab6('0x3b')](_0x85de71['query'],_0x40ec89[_0x4ab6('0x3a')]),_0x464a22);if(_0x85de71[_0x4ab6('0x2f')]['filter']){_0x2a9ee5[_0x4ab6('0x39')]=_[_0x4ab6('0x3c')](_0x2a9ee5[_0x4ab6('0x39')],{'$or':_[_0x4ab6('0x2a')](_0x464a22,function(_0x3f5b88){if(_0x3f5b88[_0x4ab6('0x2c')]!=='VIRTUAL'){var _0x1862b2={};_0x1862b2[_0x3f5b88['name']]={'$like':'%'+_0x85de71[_0x4ab6('0x2f')]['filter']+'%'};return _0x1862b2;}})});}_0x2a9ee5=_[_0x4ab6('0x3c')]({},_0x2a9ee5,_0x85de71[_0x4ab6('0x3d')]);var _0x471f89={'where':_0x2a9ee5[_0x4ab6('0x39')]};return db[_0x4ab6('0x2b')][_0x4ab6('0x1c')](_0x471f89)[_0x4ab6('0x23')](function(_0x4a9cc6){_0x4653db[_0x4ab6('0x1c')]=_0x4a9cc6;if(_0x85de71['query'][_0x4ab6('0x3e')]){_0x2a9ee5[_0x4ab6('0x3f')]=[{'all':!![]}];}return db[_0x4ab6('0x2b')]['findAll'](_0x2a9ee5);})[_0x4ab6('0x23')](function(_0x47f18e){_0x4653db[_0x4ab6('0x40')]=_0x47f18e;return _0x4653db;})[_0x4ab6('0x23')](respondWithFilteredResult(_0x5e6fd3,_0x2a9ee5))[_0x4ab6('0x41')](handleError(_0x5e6fd3,null));};exports[_0x4ab6('0x42')]=function(_0x17c08b,_0x4997fc){var _0x378483={'raw':![],'where':{'id':_0x17c08b[_0x4ab6('0x43')]['id']}},_0x3d6a6c={};_0x3d6a6c[_0x4ab6('0x2e')]=_['keys'](db[_0x4ab6('0x2b')][_0x4ab6('0x44')]);_0x3d6a6c['query']=_[_0x4ab6('0x30')](_0x17c08b[_0x4ab6('0x2f')]);_0x3d6a6c['filters']=_[_0x4ab6('0x31')](_0x3d6a6c[_0x4ab6('0x2e')],_0x3d6a6c[_0x4ab6('0x2f')]);_0x378483[_0x4ab6('0x33')]=_['intersection'](_0x3d6a6c[_0x4ab6('0x2e')],qs[_0x4ab6('0x32')](_0x17c08b[_0x4ab6('0x2f')][_0x4ab6('0x32')]));_0x378483[_0x4ab6('0x33')]=_0x378483[_0x4ab6('0x33')]['length']?_0x378483[_0x4ab6('0x33')]:_0x3d6a6c['model'];if(_0x17c08b['query'][_0x4ab6('0x3e')]){_0x378483[_0x4ab6('0x3f')]=[{'all':!![]}];}_0x378483=_[_0x4ab6('0x3c')]({},_0x378483,_0x17c08b['options']);return db[_0x4ab6('0x2b')][_0x4ab6('0x45')](_0x378483)[_0x4ab6('0x23')](handleEntityNotFound(_0x4997fc,null))[_0x4ab6('0x23')](respondWithResult(_0x4997fc,null))[_0x4ab6('0x41')](handleError(_0x4997fc,null));};exports[_0x4ab6('0x46')]=function(_0x90ea02,_0x157fe6){return db[_0x4ab6('0x2b')]['create'](_0x90ea02['body'],{})[_0x4ab6('0x23')](respondWithResult(_0x157fe6,0xc9))[_0x4ab6('0x41')](handleError(_0x157fe6,null));};exports[_0x4ab6('0x22')]=function(_0x517ed0,_0x1ecc3d){if(_0x517ed0['body']['id']){delete _0x517ed0[_0x4ab6('0x47')]['id'];}return db['FreshdeskConfiguration'][_0x4ab6('0x45')]({'where':{'id':_0x517ed0[_0x4ab6('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ecc3d,null))[_0x4ab6('0x23')](saveUpdates(_0x517ed0[_0x4ab6('0x47')],null))['then'](respondWithResult(_0x1ecc3d,null))['catch'](handleError(_0x1ecc3d,null));};exports[_0x4ab6('0x24')]=function(_0x1c411b,_0x1fe84e){return db[_0x4ab6('0x2b')][_0x4ab6('0x45')]({'where':{'id':_0x1c411b[_0x4ab6('0x43')]['id']}})[_0x4ab6('0x23')](handleEntityNotFound(_0x1fe84e,null))[_0x4ab6('0x23')](removeEntity(_0x1fe84e,null))[_0x4ab6('0x41')](handleError(_0x1fe84e,null));};exports['getFields']=function(_0xc3df96,_0x4ba246,_0xce962f){var _0x4f6d3a={};var _0x58cda6={};var _0x53b504;var _0x2bb860;return db[_0x4ab6('0x2b')][_0x4ab6('0x48')]({'where':{'id':_0xc3df96['params']['id']}})['then'](handleEntityNotFound(_0x4ba246,null))[_0x4ab6('0x23')](function(_0x5bf856){if(_0x5bf856){_0x53b504=_0x5bf856;_0x58cda6[_0x4ab6('0x2e')]=_[_0x4ab6('0x30')](db['FreshdeskField'][_0x4ab6('0x44')]);_0x58cda6[_0x4ab6('0x2f')]=_[_0x4ab6('0x30')](_0xc3df96[_0x4ab6('0x2f')]);_0x58cda6[_0x4ab6('0x3a')]=_[_0x4ab6('0x31')](_0x58cda6[_0x4ab6('0x2e')],_0x58cda6[_0x4ab6('0x2f')]);_0x4f6d3a[_0x4ab6('0x33')]=_[_0x4ab6('0x31')](_0x58cda6['model'],qs['fields'](_0xc3df96[_0x4ab6('0x2f')][_0x4ab6('0x32')]));_0x4f6d3a[_0x4ab6('0x33')]=_0x4f6d3a[_0x4ab6('0x33')][_0x4ab6('0x49')]?_0x4f6d3a['attributes']:_0x58cda6[_0x4ab6('0x2e')];_0x4f6d3a[_0x4ab6('0x37')]=qs['sort'](_0xc3df96['query'][_0x4ab6('0x38')]);_0x4f6d3a[_0x4ab6('0x39')]=qs[_0x4ab6('0x3a')](_[_0x4ab6('0x3b')](_0xc3df96[_0x4ab6('0x2f')],_0x58cda6['filters']));if(_0xc3df96[_0x4ab6('0x2f')][_0x4ab6('0x4a')]){_0x4f6d3a[_0x4ab6('0x39')]=_['merge'](_0x4f6d3a['where'],{'$or':_[_0x4ab6('0x2a')](_0x4f6d3a[_0x4ab6('0x33')],function(_0x3dc25c){var _0x456c67={};_0x456c67[_0x3dc25c]={'$like':'%'+_0xc3df96['query'][_0x4ab6('0x4a')]+'%'};return _0x456c67;})});}_0x4f6d3a=_[_0x4ab6('0x3c')]({},_0x4f6d3a,_0xc3df96[_0x4ab6('0x3d')]);return _0x53b504[_0x4ab6('0x4b')](_0x4f6d3a);}})[_0x4ab6('0x23')](function(_0x4447d6){if(_0x4447d6){_0x2bb860=_0x4447d6[_0x4ab6('0x49')];if(!_0xc3df96[_0x4ab6('0x2f')]['hasOwnProperty'](_0x4ab6('0x35'))){_0x4f6d3a['limit']=qs['limit'](_0xc3df96['query'][_0x4ab6('0x36')]);_0x4f6d3a[_0x4ab6('0x1a')]=qs['offset'](_0xc3df96['query']['offset']);}return _0x53b504[_0x4ab6('0x4b')](_0x4f6d3a);}})['then'](function(_0x113160){if(_0x113160){return _0x113160?{'count':_0x2bb860,'rows':_0x113160}:null;}})[_0x4ab6('0x23')](respondWithResult(_0x4ba246,null))['catch'](handleError(_0x4ba246,null));};exports[_0x4ab6('0x4c')]=function(_0x152990,_0x5d2530,_0x68fbf){var _0x30e0d7={};var _0x51545c={};var _0x3b2dd9;var _0x4b69af;return db[_0x4ab6('0x2b')][_0x4ab6('0x48')]({'where':{'id':_0x152990[_0x4ab6('0x43')]['id']}})[_0x4ab6('0x23')](handleEntityNotFound(_0x5d2530,null))[_0x4ab6('0x23')](function(_0x5c7804){if(_0x5c7804){_0x3b2dd9=_0x5c7804;_0x51545c[_0x4ab6('0x2e')]=_[_0x4ab6('0x30')](db[_0x4ab6('0x4d')][_0x4ab6('0x44')]);_0x51545c[_0x4ab6('0x2f')]=_[_0x4ab6('0x30')](_0x152990[_0x4ab6('0x2f')]);_0x51545c['filters']=_[_0x4ab6('0x31')](_0x51545c[_0x4ab6('0x2e')],_0x51545c['query']);_0x30e0d7[_0x4ab6('0x33')]=_[_0x4ab6('0x31')](_0x51545c[_0x4ab6('0x2e')],qs[_0x4ab6('0x32')](_0x152990[_0x4ab6('0x2f')][_0x4ab6('0x32')]));_0x30e0d7[_0x4ab6('0x33')]=_0x30e0d7[_0x4ab6('0x33')][_0x4ab6('0x49')]?_0x30e0d7[_0x4ab6('0x33')]:_0x51545c[_0x4ab6('0x2e')];_0x30e0d7[_0x4ab6('0x37')]=qs['sort'](_0x152990[_0x4ab6('0x2f')][_0x4ab6('0x38')]);_0x30e0d7[_0x4ab6('0x39')]=qs['filters'](_[_0x4ab6('0x3b')](_0x152990['query'],_0x51545c[_0x4ab6('0x3a')]));if(_0x152990[_0x4ab6('0x2f')][_0x4ab6('0x4a')]){_0x30e0d7[_0x4ab6('0x39')]=_[_0x4ab6('0x3c')](_0x30e0d7[_0x4ab6('0x39')],{'$or':_[_0x4ab6('0x2a')](_0x30e0d7[_0x4ab6('0x33')],function(_0x39c314){var _0x48e942={};_0x48e942[_0x39c314]={'$like':'%'+_0x152990[_0x4ab6('0x2f')][_0x4ab6('0x4a')]+'%'};return _0x48e942;})});}_0x30e0d7=_['merge']({},_0x30e0d7,_0x152990[_0x4ab6('0x3d')]);return _0x3b2dd9[_0x4ab6('0x4c')](_0x30e0d7);}})[_0x4ab6('0x23')](function(_0x54f241){if(_0x54f241){_0x4b69af=_0x54f241[_0x4ab6('0x49')];if(!_0x152990[_0x4ab6('0x2f')][_0x4ab6('0x34')](_0x4ab6('0x35'))){_0x30e0d7['limit']=qs[_0x4ab6('0x36')](_0x152990[_0x4ab6('0x2f')]['limit']);_0x30e0d7[_0x4ab6('0x1a')]=qs[_0x4ab6('0x1a')](_0x152990[_0x4ab6('0x2f')]['offset']);}return _0x3b2dd9[_0x4ab6('0x4c')](_0x30e0d7);}})[_0x4ab6('0x23')](function(_0x12ef73){if(_0x12ef73){return _0x12ef73?{'count':_0x4b69af,'rows':_0x12ef73}:null;}})[_0x4ab6('0x23')](respondWithResult(_0x5d2530,null))[_0x4ab6('0x41')](handleError(_0x5d2530,null));};exports[_0x4ab6('0x4e')]=function(_0x1bb67e,_0x34e9fd,_0xd1eb02){var _0x260e58={};var _0x283b92={};var _0x4102a5;var _0x358b6d;return db[_0x4ab6('0x2b')][_0x4ab6('0x48')]({'where':{'id':_0x1bb67e[_0x4ab6('0x43')]['id']}})['then'](handleEntityNotFound(_0x34e9fd,null))[_0x4ab6('0x23')](function(_0x554741){if(_0x554741){_0x4102a5=_0x554741;_0x283b92[_0x4ab6('0x2e')]=_[_0x4ab6('0x30')](db[_0x4ab6('0x4d')]['rawAttributes']);_0x283b92[_0x4ab6('0x2f')]=_[_0x4ab6('0x30')](_0x1bb67e['query']);_0x283b92[_0x4ab6('0x3a')]=_[_0x4ab6('0x31')](_0x283b92[_0x4ab6('0x2e')],_0x283b92['query']);_0x260e58['attributes']=_[_0x4ab6('0x31')](_0x283b92[_0x4ab6('0x2e')],qs[_0x4ab6('0x32')](_0x1bb67e['query'][_0x4ab6('0x32')]));_0x260e58['attributes']=_0x260e58['attributes'][_0x4ab6('0x49')]?_0x260e58[_0x4ab6('0x33')]:_0x283b92[_0x4ab6('0x2e')];_0x260e58[_0x4ab6('0x37')]=qs['sort'](_0x1bb67e[_0x4ab6('0x2f')]['sort']);_0x260e58['where']=qs['filters'](_['pick'](_0x1bb67e[_0x4ab6('0x2f')],_0x283b92[_0x4ab6('0x3a')]));if(_0x1bb67e[_0x4ab6('0x2f')][_0x4ab6('0x4a')]){_0x260e58[_0x4ab6('0x39')]=_['merge'](_0x260e58['where'],{'$or':_[_0x4ab6('0x2a')](_0x260e58[_0x4ab6('0x33')],function(_0x29b7ff){var _0x410f97={};_0x410f97[_0x29b7ff]={'$like':'%'+_0x1bb67e[_0x4ab6('0x2f')]['filter']+'%'};return _0x410f97;})});}_0x260e58=_[_0x4ab6('0x3c')]({},_0x260e58,_0x1bb67e[_0x4ab6('0x3d')]);return _0x4102a5['getDescriptions'](_0x260e58);}})['then'](function(_0x3ad9e6){if(_0x3ad9e6){_0x358b6d=_0x3ad9e6['length'];if(!_0x1bb67e[_0x4ab6('0x2f')]['hasOwnProperty'](_0x4ab6('0x35'))){_0x260e58[_0x4ab6('0x36')]=qs[_0x4ab6('0x36')](_0x1bb67e[_0x4ab6('0x2f')][_0x4ab6('0x36')]);_0x260e58[_0x4ab6('0x1a')]=qs[_0x4ab6('0x1a')](_0x1bb67e[_0x4ab6('0x2f')][_0x4ab6('0x1a')]);}return _0x4102a5[_0x4ab6('0x4e')](_0x260e58);}})[_0x4ab6('0x23')](function(_0x115579){if(_0x115579){return _0x115579?{'count':_0x358b6d,'rows':_0x115579}:null;}})[_0x4ab6('0x23')](respondWithResult(_0x34e9fd,null))[_0x4ab6('0x41')](handleError(_0x34e9fd,null));};exports[_0x4ab6('0x4f')]=function(_0x2f7373,_0x21e15f,_0x7814e5){var _0x67fd6={};var _0x3a248c={};var _0x5a5946;var _0x21220e;return db[_0x4ab6('0x2b')][_0x4ab6('0x48')]({'where':{'id':_0x2f7373['params']['id']}})['then'](handleEntityNotFound(_0x21e15f,null))[_0x4ab6('0x23')](function(_0x276174){if(_0x276174){_0x5a5946=_0x276174;_0x3a248c[_0x4ab6('0x2e')]=_[_0x4ab6('0x30')](db[_0x4ab6('0x50')][_0x4ab6('0x44')]);_0x3a248c[_0x4ab6('0x2f')]=_[_0x4ab6('0x30')](_0x2f7373[_0x4ab6('0x2f')]);_0x3a248c[_0x4ab6('0x3a')]=_['intersection'](_0x3a248c[_0x4ab6('0x2e')],_0x3a248c[_0x4ab6('0x2f')]);_0x67fd6[_0x4ab6('0x33')]=_[_0x4ab6('0x31')](_0x3a248c[_0x4ab6('0x2e')],qs[_0x4ab6('0x32')](_0x2f7373[_0x4ab6('0x2f')][_0x4ab6('0x32')]));_0x67fd6[_0x4ab6('0x33')]=_0x67fd6[_0x4ab6('0x33')][_0x4ab6('0x49')]?_0x67fd6[_0x4ab6('0x33')]:_0x3a248c[_0x4ab6('0x2e')];_0x67fd6[_0x4ab6('0x37')]=qs['sort'](_0x2f7373[_0x4ab6('0x2f')]['sort']);_0x67fd6['where']=qs[_0x4ab6('0x3a')](_[_0x4ab6('0x3b')](_0x2f7373['query'],_0x3a248c['filters']));if(_0x2f7373[_0x4ab6('0x2f')][_0x4ab6('0x4a')]){_0x67fd6[_0x4ab6('0x39')]=_[_0x4ab6('0x3c')](_0x67fd6['where'],{'$or':_['map'](_0x67fd6[_0x4ab6('0x33')],function(_0x493ba0){var _0x289beb={};_0x289beb[_0x493ba0]={'$like':'%'+_0x2f7373[_0x4ab6('0x2f')][_0x4ab6('0x4a')]+'%'};return _0x289beb;})});}_0x67fd6=_['merge']({},_0x67fd6,_0x2f7373[_0x4ab6('0x3d')]);return _0x5a5946[_0x4ab6('0x4f')](_0x67fd6);}})[_0x4ab6('0x23')](function(_0x574737){if(_0x574737){_0x21220e=_0x574737[_0x4ab6('0x49')];if(!_0x2f7373[_0x4ab6('0x2f')]['hasOwnProperty']('nolimit')){_0x67fd6[_0x4ab6('0x36')]=qs[_0x4ab6('0x36')](_0x2f7373['query']['limit']);_0x67fd6['offset']=qs[_0x4ab6('0x1a')](_0x2f7373['query'][_0x4ab6('0x1a')]);}return _0x5a5946[_0x4ab6('0x4f')](_0x67fd6);}})[_0x4ab6('0x23')](function(_0x1877fa){if(_0x1877fa){return _0x1877fa?{'count':_0x21220e,'rows':_0x1877fa}:null;}})[_0x4ab6('0x23')](respondWithResult(_0x21e15f,null))[_0x4ab6('0x41')](handleError(_0x21e15f,null));};exports[_0x4ab6('0x51')]=function(_0x1bb78d,_0x29c7a7,_0x362e0e){if(_0x1bb78d[_0x4ab6('0x47')]['id']){delete _0x1bb78d[_0x4ab6('0x47')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1bb78d['params']['id']}})[_0x4ab6('0x23')](handleEntityNotFound(_0x29c7a7,null))[_0x4ab6('0x23')](function(_0x31b737){if(_0x31b737){return _0x31b737[_0x4ab6('0x51')](_0x1bb78d[_0x4ab6('0x47')][_0x4ab6('0x52')]||[]);}return null;})['then'](respondWithResult(_0x29c7a7,null))[_0x4ab6('0x41')](handleError(_0x29c7a7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 6774f94..dba81b9 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 _0xbd40=['util','api','moment','bluebird','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbd40,0xd7));var _0x0bd4=function(_0x51b216,_0x58154b){_0x51b216=_0x51b216-0x0;var _0x684ff6=_0xbd40[_0x51b216];return _0x684ff6;};'use strict';var _=require(_0x0bd4('0x0'));var util=require(_0x0bd4('0x1'));var logger=require('../../config/logger')(_0x0bd4('0x2'));var moment=require(_0x0bd4('0x3'));var BPromise=require(_0x0bd4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bd4('0x5'));var rimraf=require(_0x0bd4('0x6'));var config=require('../../config/environment');var attributes=require(_0x0bd4('0x7'));module[_0x0bd4('0x8')]=function(_0x8109aa,_0x378099){return _0x8109aa[_0x0bd4('0x9')](_0x0bd4('0xa'),attributes,{'tableName':_0x0bd4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1985=['./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','bluebird','request-promise','../../config/environment'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x1985,0xfe));var _0x5198=function(_0x3469b2,_0x13ec0a){_0x3469b2=_0x3469b2-0x0;var _0x3ba99c=_0x1985[_0x3469b2];return _0x3ba99c;};'use strict';var _=require('lodash');var util=require(_0x5198('0x0'));var logger=require(_0x5198('0x1'))(_0x5198('0x2'));var moment=require('moment');var BPromise=require(_0x5198('0x3'));var rp=require(_0x5198('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5198('0x5'));var attributes=require(_0x5198('0x6'));module[_0x5198('0x7')]=function(_0x21eee3,_0x3fa5bc){return _0x21eee3['define'](_0x5198('0x8'),attributes,{'tableName':_0x5198('0x9'),'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 7b1a4ef..55daf74 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 _0xe426=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1ba5f9,_0x2b6ca8){var _0x491c5f=function(_0x586af8){while(--_0x586af8){_0x1ba5f9['push'](_0x1ba5f9['shift']());}};_0x491c5f(++_0x2b6ca8);}(_0xe426,0xda));var _0x6e42=function(_0x2aa1a7,_0x4b59d8){_0x2aa1a7=_0x2aa1a7-0x0;var _0x1a1221=_0xe426[_0x2aa1a7];return _0x1a1221;};'use strict';var _=require(_0x6e42('0x0'));var util=require(_0x6e42('0x1'));var moment=require(_0x6e42('0x2'));var BPromise=require(_0x6e42('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e42('0x4'));var db=require(_0x6e42('0x5'))['db'];var utils=require(_0x6e42('0x6'));var logger=require('../../config/logger')(_0x6e42('0x7'));var config=require(_0x6e42('0x8'));var jayson=require(_0x6e42('0x9'));var client=jayson['client'][_0x6e42('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e90f1,_0x4b2f23,_0x202723){return new BPromise(function(_0x4ba65b,_0x3a2028){return client[_0x6e42('0xb')](_0x5e90f1,_0x202723)[_0x6e42('0xc')](function(_0x4efb3d){logger['info'](_0x6e42('0xd'),_0x4b2f23,_0x6e42('0xe'));logger[_0x6e42('0xf')](_0x6e42('0x10'),_0x4b2f23,_0x6e42('0xe'),JSON[_0x6e42('0x11')](_0x4efb3d));if(_0x4efb3d[_0x6e42('0x12')]){if(_0x4efb3d[_0x6e42('0x12')][_0x6e42('0x13')]===0x1f4){logger[_0x6e42('0x12')](_0x6e42('0xd'),_0x4b2f23,_0x4efb3d[_0x6e42('0x12')][_0x6e42('0x14')]);return _0x3a2028(_0x4efb3d['error'][_0x6e42('0x14')]);}logger[_0x6e42('0x12')](_0x6e42('0xd'),_0x4b2f23,_0x4efb3d[_0x6e42('0x12')]['message']);return _0x4ba65b(_0x4efb3d[_0x6e42('0x12')][_0x6e42('0x14')]);}else{logger[_0x6e42('0x15')](_0x6e42('0xd'),_0x4b2f23,_0x6e42('0xe'));_0x4ba65b(_0x4efb3d[_0x6e42('0x16')][_0x6e42('0x14')]);}})[_0x6e42('0x17')](function(_0x257956){logger[_0x6e42('0x12')](_0x6e42('0xd'),_0x4b2f23,_0x257956);_0x3a2028(_0x257956);});});} \ No newline at end of file +var _0xb16c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb16c,0x1c7));var _0xcb16=function(_0x2d4a35,_0x2e2002){_0x2d4a35=_0x2d4a35-0x0;var _0x416f93=_0xb16c[_0x2d4a35];return _0x416f93;};'use strict';var _=require('lodash');var util=require(_0xcb16('0x0'));var moment=require(_0xcb16('0x1'));var BPromise=require(_0xcb16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb16('0x3'));var db=require(_0xcb16('0x4'))['db'];var utils=require(_0xcb16('0x5'));var logger=require(_0xcb16('0x6'))(_0xcb16('0x7'));var config=require(_0xcb16('0x8'));var jayson=require(_0xcb16('0x9'));var client=jayson[_0xcb16('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x580d01,_0xac7838,_0x42712d){return new BPromise(function(_0x502935,_0x5db151){return client[_0xcb16('0xb')](_0x580d01,_0x42712d)[_0xcb16('0xc')](function(_0xd925bc){logger[_0xcb16('0xd')](_0xcb16('0xe'),_0xac7838,_0xcb16('0xf'));logger[_0xcb16('0x10')](_0xcb16('0x11'),_0xac7838,'request\x20sent',JSON[_0xcb16('0x12')](_0xd925bc));if(_0xd925bc[_0xcb16('0x13')]){if(_0xd925bc[_0xcb16('0x13')][_0xcb16('0x14')]===0x1f4){logger[_0xcb16('0x13')](_0xcb16('0xe'),_0xac7838,_0xd925bc[_0xcb16('0x13')][_0xcb16('0x15')]);return _0x5db151(_0xd925bc['error'][_0xcb16('0x15')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xac7838,_0xd925bc[_0xcb16('0x13')][_0xcb16('0x15')]);return _0x502935(_0xd925bc[_0xcb16('0x13')][_0xcb16('0x15')]);}else{logger['info'](_0xcb16('0xe'),_0xac7838,_0xcb16('0xf'));_0x502935(_0xd925bc[_0xcb16('0x16')][_0xcb16('0x15')]);}})[_0xcb16('0x17')](function(_0x474cde){logger[_0xcb16('0x13')](_0xcb16('0xe'),_0xac7838,_0x474cde);_0x5db151(_0x474cde);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 1189408..f93ac47 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 _0x59c0=['Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','put','destroy','multer','path','connect-timeout','express'];(function(_0x5e88c3,_0x3fbc3e){var _0x4045a3=function(_0x5c63c4){while(--_0x5c63c4){_0x5e88c3['push'](_0x5e88c3['shift']());}};_0x4045a3(++_0x3fbc3e);}(_0x59c0,0x155));var _0x059c=function(_0xb929d1,_0x1320f5){_0xb929d1=_0xb929d1-0x0;var _0xc6265e=_0x59c0[_0xb929d1];return _0xc6265e;};'use strict';var multer=require(_0x059c('0x0'));var util=require('util');var path=require(_0x059c('0x1'));var timeout=require(_0x059c('0x2'));var express=require(_0x059c('0x3'));var router=express[_0x059c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x059c('0x5'));var config=require(_0x059c('0x6'));var controller=require(_0x059c('0x7'));router[_0x059c('0x8')]('/',auth[_0x059c('0x9')](),controller[_0x059c('0xa')]);router[_0x059c('0x8')](_0x059c('0xb'),auth[_0x059c('0x9')](),controller['show']);router[_0x059c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x059c('0xd')](_0x059c('0xb'),auth[_0x059c('0x9')](),controller['update']);router['delete'](_0x059c('0xb'),auth[_0x059c('0x9')](),controller[_0x059c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb5ee=['fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id','show','post','isAuthenticated','create','multer','path','connect-timeout','express'];(function(_0x4cd2aa,_0x19a600){var _0x2c2c7e=function(_0x4ebfc5){while(--_0x4ebfc5){_0x4cd2aa['push'](_0x4cd2aa['shift']());}};_0x2c2c7e(++_0x19a600);}(_0xb5ee,0x15a));var _0xeb5e=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0xb5ee[_0x4e93a9];return _0x43013c;};'use strict';var multer=require(_0xeb5e('0x0'));var util=require('util');var path=require(_0xeb5e('0x1'));var timeout=require(_0xeb5e('0x2'));var express=require(_0xeb5e('0x3'));var router=express['Router']();var fs_extra=require(_0xeb5e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeb5e('0x5'));var config=require(_0xeb5e('0x6'));var controller=require(_0xeb5e('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xeb5e('0x8')](_0xeb5e('0x9'),auth['isAuthenticated'](),controller[_0xeb5e('0xa')]);router[_0xeb5e('0xb')]('/',auth[_0xeb5e('0xc')](),controller[_0xeb5e('0xd')]);router['put'](_0xeb5e('0x9'),auth[_0xeb5e('0xc')](),controller['update']);router['delete'](_0xeb5e('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d30a63f..fda023c 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 _0x4d0d=['customVariable','keyValue','string','STRING','sequelize','exports','ENUM','variable'];(function(_0x1bffd0,_0x5c57f3){var _0x15893a=function(_0x11cd75){while(--_0x11cd75){_0x1bffd0['push'](_0x1bffd0['shift']());}};_0x15893a(++_0x5c57f3);}(_0x4d0d,0xec));var _0xd4d0=function(_0x1ff6ec,_0x2b6b66){_0x1ff6ec=_0x1ff6ec-0x0;var _0x18259e=_0x4d0d[_0x1ff6ec];return _0x18259e;};'use strict';var Sequelize=require(_0xd4d0('0x0'));module[_0xd4d0('0x1')]={'type':{'type':Sequelize[_0xd4d0('0x2')]('string',_0xd4d0('0x3'),_0xd4d0('0x4'),_0xd4d0('0x5'),'picklist'),'defaultValue':_0xd4d0('0x6')},'content':{'type':Sequelize[_0xd4d0('0x7')]},'key':{'type':Sequelize[_0xd4d0('0x7')]},'keyType':{'type':Sequelize[_0xd4d0('0x2')]('string',_0xd4d0('0x3'),_0xd4d0('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd4d0('0x7')]},'nameField':{'type':Sequelize[_0xd4d0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd4d0('0x7')]}}; \ No newline at end of file +var _0x54e9=['exports','string','keyValue','picklist','STRING','ENUM','variable','customVariable','BOOLEAN','sequelize'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x54e9,0x17b));var _0x954e=function(_0x1a2e85,_0x3d1ad3){_0x1a2e85=_0x1a2e85-0x0;var _0x46895a=_0x54e9[_0x1a2e85];return _0x46895a;};'use strict';var Sequelize=require(_0x954e('0x0'));module[_0x954e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x954e('0x2'),'variable','customVariable',_0x954e('0x3'),_0x954e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x954e('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x954e('0x6')](_0x954e('0x2'),_0x954e('0x7'),_0x954e('0x8'))},'keyContent':{'type':Sequelize[_0x954e('0x5')]},'idField':{'type':Sequelize[_0x954e('0x5')]},'nameField':{'type':Sequelize[_0x954e('0x5')]},'customField':{'type':Sequelize[_0x954e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x954e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 31bd9d1..e02a4c5 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 _0xcffe=['apply','reject','save','then','error','name','send','FreshdeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range'];(function(_0x5831c7,_0x4abd6a){var _0x1b1074=function(_0x54f800){while(--_0x54f800){_0x5831c7['push'](_0x5831c7['shift']());}};_0x1b1074(++_0x4abd6a);}(_0xcffe,0x1a1));var _0xecff=function(_0x54691e,_0x28b041){_0x54691e=_0x54691e-0x0;var _0x5520b2=_0xcffe[_0x54691e];return _0x5520b2;};'use strict';var emlformat=require(_0xecff('0x0'));var rimraf=require(_0xecff('0x1'));var zipdir=require(_0xecff('0x2'));var jsonpatch=require(_0xecff('0x3'));var rp=require(_0xecff('0x4'));var moment=require(_0xecff('0x5'));var BPromise=require(_0xecff('0x6'));var Mustache=require(_0xecff('0x7'));var util=require(_0xecff('0x8'));var path=require(_0xecff('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xecff('0xa'));var fs=require('fs');var fs_extra=require(_0xecff('0xb'));var _=require(_0xecff('0xc'));var squel=require(_0xecff('0xd'));var crypto=require(_0xecff('0xe'));var jsforce=require(_0xecff('0xf'));var deskjs=require(_0xecff('0x10'));var toCsv=require('to-csv');var querystring=require(_0xecff('0x11'));var Papa=require(_0xecff('0x12'));var Redis=require(_0xecff('0x13'));var authService=require(_0xecff('0x14'));var qs=require(_0xecff('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecff('0x16'));var logger=require(_0xecff('0x17'))(_0xecff('0x18'));var utils=require(_0xecff('0x19'));var config=require(_0xecff('0x1a'));var licenseUtil=require(_0xecff('0x1b'));var db=require(_0xecff('0x1c'))['db'];function respondWithStatusCode(_0x32627c,_0x3e907d){_0x3e907d=_0x3e907d||0xcc;return function(_0x151a79){if(_0x151a79){return _0x32627c[_0xecff('0x1d')](_0x3e907d);}return _0x32627c[_0xecff('0x1e')](_0x3e907d)[_0xecff('0x1f')]();};}function respondWithResult(_0xb8745f,_0x5495f9){_0x5495f9=_0x5495f9||0xc8;return function(_0x4b1893){if(_0x4b1893){return _0xb8745f[_0xecff('0x1e')](_0x5495f9)[_0xecff('0x20')](_0x4b1893);}};}function respondWithFilteredResult(_0x558ecd,_0x35ce1f){return function(_0x362ed0){if(_0x362ed0){var _0x3a7623=typeof _0x35ce1f['offset']==='undefined'&&typeof _0x35ce1f[_0xecff('0x21')]===_0xecff('0x22');var _0x53ff8e=_0x362ed0[_0xecff('0x23')];var _0x3adc81=_0x3a7623?0x0:_0x35ce1f[_0xecff('0x24')];var _0x2393db=_0x3a7623?_0x362ed0[_0xecff('0x23')]:_0x35ce1f[_0xecff('0x24')]+_0x35ce1f['limit'];var _0x229728;if(_0x2393db>=_0x53ff8e){_0x2393db=_0x53ff8e;_0x229728=0xc8;}else{_0x229728=0xce;}_0x558ecd[_0xecff('0x1e')](_0x229728);return _0x558ecd[_0xecff('0x25')](_0xecff('0x26'),_0x3adc81+'-'+_0x2393db+'/'+_0x53ff8e)['json'](_0x362ed0);}return null;};}function patchUpdates(_0x4bb94e){return function(_0x2e2bdd){try{jsonpatch[_0xecff('0x27')](_0x2e2bdd,_0x4bb94e,!![]);}catch(_0x333eb7){return BPromise[_0xecff('0x28')](_0x333eb7);}return _0x2e2bdd[_0xecff('0x29')]();};}function saveUpdates(_0x494754,_0x14378d){return function(_0x520d6d){if(_0x520d6d){return _0x520d6d['update'](_0x494754)[_0xecff('0x2a')](function(_0x4fdc8e){return _0x4fdc8e;});}return null;};}function removeEntity(_0x2447da,_0x49c0cd){return function(_0x389281){if(_0x389281){return _0x389281['destroy']()[_0xecff('0x2a')](function(){_0x2447da[_0xecff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f173d,_0x18f4d4){return function(_0x393312){if(!_0x393312){_0x9f173d[_0xecff('0x1d')](0x194);}return _0x393312;};}function handleError(_0x19202e,_0x493465){_0x493465=_0x493465||0x1f4;return function(_0x4f987b){logger[_0xecff('0x2b')](_0x4f987b['stack']);if(_0x4f987b[_0xecff('0x2c')]){delete _0x4f987b[_0xecff('0x2c')];}_0x19202e[_0xecff('0x1e')](_0x493465)[_0xecff('0x2d')](_0x4f987b);};}exports['index']=function(_0x4e7afa,_0x55502f){var _0x202ee0={},_0xabe5da={},_0x230d04={'count':0x0,'rows':[]};var _0x1e3175=_['map'](db[_0xecff('0x2e')][_0xecff('0x2f')],function(_0x1926a5){return{'name':_0x1926a5['fieldName'],'type':_0x1926a5[_0xecff('0x30')][_0xecff('0x31')]};});_0xabe5da[_0xecff('0x32')]=_[_0xecff('0x33')](_0x1e3175,'name');_0xabe5da[_0xecff('0x34')]=_[_0xecff('0x35')](_0x4e7afa['query']);_0xabe5da[_0xecff('0x36')]=_[_0xecff('0x37')](_0xabe5da[_0xecff('0x32')],_0xabe5da[_0xecff('0x34')]);_0x202ee0['attributes']=_[_0xecff('0x37')](_0xabe5da[_0xecff('0x32')],qs[_0xecff('0x38')](_0x4e7afa['query'][_0xecff('0x38')]));_0x202ee0[_0xecff('0x39')]=_0x202ee0[_0xecff('0x39')][_0xecff('0x3a')]?_0x202ee0[_0xecff('0x39')]:_0xabe5da[_0xecff('0x32')];if(!_0x4e7afa['query']['hasOwnProperty']('nolimit')){_0x202ee0[_0xecff('0x21')]=qs['limit'](_0x4e7afa[_0xecff('0x34')][_0xecff('0x21')]);_0x202ee0['offset']=qs[_0xecff('0x24')](_0x4e7afa[_0xecff('0x34')][_0xecff('0x24')]);}_0x202ee0['order']=qs[_0xecff('0x3b')](_0x4e7afa[_0xecff('0x34')][_0xecff('0x3b')]);_0x202ee0['where']=qs[_0xecff('0x36')](_[_0xecff('0x3c')](_0x4e7afa[_0xecff('0x34')],_0xabe5da[_0xecff('0x36')]),_0x1e3175);if(_0x4e7afa[_0xecff('0x34')][_0xecff('0x3d')]){_0x202ee0[_0xecff('0x3e')]=_[_0xecff('0x3f')](_0x202ee0[_0xecff('0x3e')],{'$or':_[_0xecff('0x33')](_0x1e3175,function(_0xb9a367){if(_0xb9a367['type']!==_0xecff('0x40')){var _0x23c8f1={};_0x23c8f1[_0xb9a367[_0xecff('0x2c')]]={'$like':'%'+_0x4e7afa[_0xecff('0x34')][_0xecff('0x3d')]+'%'};return _0x23c8f1;}})});}_0x202ee0=_[_0xecff('0x3f')]({},_0x202ee0,_0x4e7afa[_0xecff('0x41')]);var _0x2ed2ab={'where':_0x202ee0['where']};return db[_0xecff('0x2e')]['count'](_0x2ed2ab)[_0xecff('0x2a')](function(_0x344108){_0x230d04[_0xecff('0x23')]=_0x344108;if(_0x4e7afa[_0xecff('0x34')][_0xecff('0x42')]){_0x202ee0[_0xecff('0x43')]=[{'all':!![]}];}return db[_0xecff('0x2e')]['findAll'](_0x202ee0);})[_0xecff('0x2a')](function(_0x3dc857){_0x230d04['rows']=_0x3dc857;return _0x230d04;})['then'](respondWithFilteredResult(_0x55502f,_0x202ee0))[_0xecff('0x44')](handleError(_0x55502f,null));};exports[_0xecff('0x45')]=function(_0x27f0dd,_0x1f095e){var _0x47084b={'raw':!![],'where':{'id':_0x27f0dd['params']['id']}},_0xb9117c={};_0xb9117c[_0xecff('0x32')]=_[_0xecff('0x35')](db['FreshdeskField'][_0xecff('0x2f')]);_0xb9117c[_0xecff('0x34')]=_[_0xecff('0x35')](_0x27f0dd[_0xecff('0x34')]);_0xb9117c[_0xecff('0x36')]=_[_0xecff('0x37')](_0xb9117c['model'],_0xb9117c[_0xecff('0x34')]);_0x47084b[_0xecff('0x39')]=_[_0xecff('0x37')](_0xb9117c['model'],qs[_0xecff('0x38')](_0x27f0dd[_0xecff('0x34')][_0xecff('0x38')]));_0x47084b[_0xecff('0x39')]=_0x47084b['attributes'][_0xecff('0x3a')]?_0x47084b[_0xecff('0x39')]:_0xb9117c['model'];if(_0x27f0dd[_0xecff('0x34')][_0xecff('0x42')]){_0x47084b['include']=[{'all':!![]}];}_0x47084b=_[_0xecff('0x3f')]({},_0x47084b,_0x27f0dd['options']);return db[_0xecff('0x2e')][_0xecff('0x46')](_0x47084b)[_0xecff('0x2a')](handleEntityNotFound(_0x1f095e,null))[_0xecff('0x2a')](respondWithResult(_0x1f095e,null))[_0xecff('0x44')](handleError(_0x1f095e,null));};exports[_0xecff('0x47')]=function(_0x563f68,_0x596eb8){return db[_0xecff('0x2e')][_0xecff('0x47')](_0x563f68[_0xecff('0x48')],{})[_0xecff('0x2a')](respondWithResult(_0x596eb8,0xc9))[_0xecff('0x44')](handleError(_0x596eb8,null));};exports[_0xecff('0x49')]=function(_0x36c50f,_0x3ac749){if(_0x36c50f['body']['id']){delete _0x36c50f[_0xecff('0x48')]['id'];}return db[_0xecff('0x2e')]['find']({'where':{'id':_0x36c50f[_0xecff('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ac749,null))[_0xecff('0x2a')](saveUpdates(_0x36c50f[_0xecff('0x48')],null))['then'](respondWithResult(_0x3ac749,null))[_0xecff('0x44')](handleError(_0x3ac749,null));};exports[_0xecff('0x4b')]=function(_0x3e79f9,_0x188d08){return db[_0xecff('0x2e')]['find']({'where':{'id':_0x3e79f9['params']['id']}})[_0xecff('0x2a')](handleEntityNotFound(_0x188d08,null))[_0xecff('0x2a')](removeEntity(_0x188d08,null))[_0xecff('0x44')](handleError(_0x188d08,null));}; \ No newline at end of file +var _0x80df=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','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'];(function(_0x25ae3e,_0x3f2919){var _0xedda0d=function(_0x13ba5a){while(--_0x13ba5a){_0x25ae3e['push'](_0x25ae3e['shift']());}};_0xedda0d(++_0x3f2919);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x29')]();});}};}function handleEntityNotFound(_0x323540,_0x947bb){return function(_0x4986ad){if(!_0x4986ad){_0x323540[_0xf80d('0x2a')](0x194);}return _0x4986ad;};}function handleError(_0x14399e,_0xf4c3af){_0xf4c3af=_0xf4c3af||0x1f4;return function(_0x2a4597){logger[_0xf80d('0x2b')](_0x2a4597[_0xf80d('0x2c')]);if(_0x2a4597[_0xf80d('0x2d')]){delete _0x2a4597[_0xf80d('0x2d')];}_0x14399e[_0xf80d('0x1c')](_0xf4c3af)['send'](_0x2a4597);};}exports[_0xf80d('0x2e')]=function(_0x1603a4,_0x3e2c8c){var _0x368865={},_0x3ce924={},_0x5eab42={'count':0x0,'rows':[]};var _0x401cfb=_['map'](db[_0xf80d('0x2f')][_0xf80d('0x30')],function(_0x214bff){return{'name':_0x214bff[_0xf80d('0x31')],'type':_0x214bff['type']['key']};});_0x3ce924[_0xf80d('0x32')]=_['map'](_0x401cfb,_0xf80d('0x2d'));_0x3ce924[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x1603a4['query']);_0x3ce924[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x3ce924['model'],_0x3ce924[_0xf80d('0x33')]);_0x368865[_0xf80d('0x37')]=_[_0xf80d('0x36')](_0x3ce924['model'],qs[_0xf80d('0x38')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x38')]));_0x368865[_0xf80d('0x37')]=_0x368865[_0xf80d('0x37')]['length']?_0x368865[_0xf80d('0x37')]:_0x3ce924['model'];if(!_0x1603a4[_0xf80d('0x33')][_0xf80d('0x39')](_0xf80d('0x3a'))){_0x368865[_0xf80d('0x20')]=qs['limit'](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x20')]);_0x368865[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x1603a4['query'][_0xf80d('0x1e')]);}_0x368865[_0xf80d('0x3b')]=qs[_0xf80d('0x3c')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3c')]);_0x368865[_0xf80d('0x3d')]=qs[_0xf80d('0x35')](_[_0xf80d('0x3e')](_0x1603a4['query'],_0x3ce924[_0xf80d('0x35')]),_0x401cfb);if(_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3f')]){_0x368865['where']=_[_0xf80d('0x40')](_0x368865['where'],{'$or':_[_0xf80d('0x41')](_0x401cfb,function(_0x1a4ab7){if(_0x1a4ab7[_0xf80d('0x42')]!==_0xf80d('0x43')){var _0x4a3c5e={};_0x4a3c5e[_0x1a4ab7['name']]={'$like':'%'+_0x1603a4['query'][_0xf80d('0x3f')]+'%'};return _0x4a3c5e;}})});}_0x368865=_[_0xf80d('0x40')]({},_0x368865,_0x1603a4[_0xf80d('0x44')]);var _0x4b9f1d={'where':_0x368865[_0xf80d('0x3d')]};return db[_0xf80d('0x2f')]['count'](_0x4b9f1d)[_0xf80d('0x27')](function(_0x511310){_0x5eab42[_0xf80d('0x21')]=_0x511310;if(_0x1603a4['query'][_0xf80d('0x45')]){_0x368865['include']=[{'all':!![]}];}return db[_0xf80d('0x2f')][_0xf80d('0x46')](_0x368865);})[_0xf80d('0x27')](function(_0x2cd371){_0x5eab42[_0xf80d('0x47')]=_0x2cd371;return _0x5eab42;})[_0xf80d('0x27')](respondWithFilteredResult(_0x3e2c8c,_0x368865))[_0xf80d('0x48')](handleError(_0x3e2c8c,null));};exports[_0xf80d('0x49')]=function(_0x99e531,_0x80f24a){var _0x1fcbad={'raw':!![],'where':{'id':_0x99e531[_0xf80d('0x4a')]['id']}},_0x437e44={};_0x437e44[_0xf80d('0x32')]=_[_0xf80d('0x34')](db[_0xf80d('0x2f')][_0xf80d('0x30')]);_0x437e44[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x99e531[_0xf80d('0x33')]);_0x437e44[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x437e44[_0xf80d('0x32')],_0x437e44[_0xf80d('0x33')]);_0x1fcbad[_0xf80d('0x37')]=_['intersection'](_0x437e44[_0xf80d('0x32')],qs[_0xf80d('0x38')](_0x99e531[_0xf80d('0x33')][_0xf80d('0x38')]));_0x1fcbad[_0xf80d('0x37')]=_0x1fcbad['attributes'][_0xf80d('0x4b')]?_0x1fcbad[_0xf80d('0x37')]:_0x437e44[_0xf80d('0x32')];if(_0x99e531[_0xf80d('0x33')][_0xf80d('0x45')]){_0x1fcbad[_0xf80d('0x4c')]=[{'all':!![]}];}_0x1fcbad=_[_0xf80d('0x40')]({},_0x1fcbad,_0x99e531[_0xf80d('0x44')]);return db[_0xf80d('0x2f')][_0xf80d('0x4d')](_0x1fcbad)[_0xf80d('0x27')](handleEntityNotFound(_0x80f24a,null))[_0xf80d('0x27')](respondWithResult(_0x80f24a,null))[_0xf80d('0x48')](handleError(_0x80f24a,null));};exports[_0xf80d('0x4e')]=function(_0x3a420d,_0x10d5b5){return db[_0xf80d('0x2f')]['create'](_0x3a420d[_0xf80d('0x4f')],{})[_0xf80d('0x27')](respondWithResult(_0x10d5b5,0xc9))[_0xf80d('0x48')](handleError(_0x10d5b5,null));};exports['update']=function(_0x3e5cf6,_0x1088ca){if(_0x3e5cf6['body']['id']){delete _0x3e5cf6['body']['id'];}return db[_0xf80d('0x2f')]['find']({'where':{'id':_0x3e5cf6[_0xf80d('0x4a')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1088ca,null))[_0xf80d('0x27')](saveUpdates(_0x3e5cf6[_0xf80d('0x4f')],null))[_0xf80d('0x27')](respondWithResult(_0x1088ca,null))[_0xf80d('0x48')](handleError(_0x1088ca,null));};exports[_0xf80d('0x28')]=function(_0x114132,_0x115d1f){return db[_0xf80d('0x2f')][_0xf80d('0x4d')]({'where':{'id':_0x114132[_0xf80d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x115d1f,null))[_0xf80d('0x27')](removeEntity(_0x115d1f,null))[_0xf80d('0x48')](handleError(_0x115d1f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5fcf9bc..718527b 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 _0x6904=['FieldId','lodash','../../config/logger','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x3fe469,_0x40058a){var _0x78e9ae=function(_0xe474eb){while(--_0xe474eb){_0x3fe469['push'](_0x3fe469['shift']());}};_0x78e9ae(++_0x40058a);}(_0x6904,0xd9));var _0x4690=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x6904[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x4690('0x0'));var util=require('util');var logger=require(_0x4690('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4690('0x2'));var fs=require('fs');var path=require(_0x4690('0x3'));var rimraf=require(_0x4690('0x4'));var config=require('../../config/environment');var attributes=require(_0x4690('0x5'));module[_0x4690('0x6')]=function(_0x50f994,_0x3cae20){return _0x50f994[_0x4690('0x7')]('FreshdeskField',attributes,{'tableName':_0x4690('0x8'),'paranoid':![],'indexes':[{'name':_0x4690('0x9'),'fields':[_0x4690('0xa'),_0x4690('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc192=['exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x2ecd91,_0x1f21e8){var _0x3bf737=function(_0x1563d7){while(--_0x1563d7){_0x2ecd91['push'](_0x2ecd91['shift']());}};_0x3bf737(++_0x1f21e8);}(_0xc192,0xd6));var _0x2c19=function(_0x35d4a7,_0x1f25e9){_0x35d4a7=_0x35d4a7-0x0;var _0x3e5961=_0xc192[_0x35d4a7];return _0x3e5961;};'use strict';var _=require(_0x2c19('0x0'));var util=require('util');var logger=require(_0x2c19('0x1'))(_0x2c19('0x2'));var moment=require(_0x2c19('0x3'));var BPromise=require(_0x2c19('0x4'));var rp=require(_0x2c19('0x5'));var fs=require('fs');var path=require(_0x2c19('0x6'));var rimraf=require(_0x2c19('0x7'));var config=require(_0x2c19('0x8'));var attributes=require(_0x2c19('0x9'));module[_0x2c19('0xa')]=function(_0xb167a6,_0x3fbe25){return _0xb167a6[_0x2c19('0xb')]('FreshdeskField',attributes,{'tableName':_0x2c19('0xc'),'paranoid':![],'indexes':[{'name':_0x2c19('0xd'),'fields':[_0x2c19('0xe'),_0x2c19('0xf')],'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 4fc96d9..86affd4 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 _0xd4f1=['client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5b8ac0,_0x111e9d){var _0x370099=function(_0x558edb){while(--_0x558edb){_0x5b8ac0['push'](_0x5b8ac0['shift']());}};_0x370099(++_0x111e9d);}(_0xd4f1,0x6a));var _0x1d4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4f1[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1d4f('0x0'));var BPromise=require(_0x1d4f('0x1'));var rs=require(_0x1d4f('0x2'));var fs=require('fs');var Redis=require(_0x1d4f('0x3'));var db=require(_0x1d4f('0x4'))['db'];var utils=require(_0x1d4f('0x5'));var logger=require(_0x1d4f('0x6'))('rpc');var config=require(_0x1d4f('0x7'));var jayson=require(_0x1d4f('0x8'));var client=jayson[_0x1d4f('0x9')][_0x1d4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f5976,_0x2e9d4f,_0x41b52f){return new BPromise(function(_0x23e0f8,_0x4eb5da){return client[_0x1d4f('0xb')](_0x5f5976,_0x41b52f)[_0x1d4f('0xc')](function(_0x48a41a){logger[_0x1d4f('0xd')](_0x1d4f('0xe'),_0x2e9d4f,_0x1d4f('0xf'));logger['debug'](_0x1d4f('0x10'),_0x2e9d4f,_0x1d4f('0xf'),JSON[_0x1d4f('0x11')](_0x48a41a));if(_0x48a41a[_0x1d4f('0x12')]){if(_0x48a41a[_0x1d4f('0x12')][_0x1d4f('0x13')]===0x1f4){logger[_0x1d4f('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x2e9d4f,_0x48a41a[_0x1d4f('0x12')][_0x1d4f('0x14')]);return _0x4eb5da(_0x48a41a[_0x1d4f('0x12')][_0x1d4f('0x14')]);}logger[_0x1d4f('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x2e9d4f,_0x48a41a[_0x1d4f('0x12')][_0x1d4f('0x14')]);return _0x23e0f8(_0x48a41a[_0x1d4f('0x12')][_0x1d4f('0x14')]);}else{logger[_0x1d4f('0xd')](_0x1d4f('0xe'),_0x2e9d4f,'request\x20sent');_0x23e0f8(_0x48a41a[_0x1d4f('0x15')]['message']);}})[_0x1d4f('0x16')](function(_0x225ec9){logger[_0x1d4f('0x12')](_0x1d4f('0xe'),_0x2e9d4f,_0x225ec9);_0x4eb5da(_0x225ec9);});});} \ No newline at end of file +var _0x2d38=['error','FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cc65e,_0x4b5b42){var _0x132f01=function(_0x2a9352){while(--_0x2a9352){_0x4cc65e['push'](_0x4cc65e['shift']());}};_0x132f01(++_0x4b5b42);}(_0x2d38,0x65));var _0x82d3=function(_0x81d7c0,_0x11ac68){_0x81d7c0=_0x81d7c0-0x0;var _0x3d8ff5=_0x2d38[_0x81d7c0];return _0x3d8ff5;};'use strict';var _=require(_0x82d3('0x0'));var util=require(_0x82d3('0x1'));var moment=require(_0x82d3('0x2'));var BPromise=require(_0x82d3('0x3'));var rs=require(_0x82d3('0x4'));var fs=require('fs');var Redis=require(_0x82d3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x82d3('0x6'));var logger=require(_0x82d3('0x7'))('rpc');var config=require(_0x82d3('0x8'));var jayson=require(_0x82d3('0x9'));var client=jayson[_0x82d3('0xa')][_0x82d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e19f0,_0x3012ff,_0x42bea8){return new BPromise(function(_0x4cd11f,_0x19fd37){return client[_0x82d3('0xc')](_0x3e19f0,_0x42bea8)[_0x82d3('0xd')](function(_0x1e8c55){logger[_0x82d3('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x3012ff,_0x82d3('0xf'));logger[_0x82d3('0x10')](_0x82d3('0x11'),_0x3012ff,_0x82d3('0xf'),JSON[_0x82d3('0x12')](_0x1e8c55));if(_0x1e8c55[_0x82d3('0x13')]){if(_0x1e8c55[_0x82d3('0x13')]['code']===0x1f4){logger['error'](_0x82d3('0x14'),_0x3012ff,_0x1e8c55[_0x82d3('0x13')][_0x82d3('0x15')]);return _0x19fd37(_0x1e8c55[_0x82d3('0x13')][_0x82d3('0x15')]);}logger[_0x82d3('0x13')](_0x82d3('0x14'),_0x3012ff,_0x1e8c55[_0x82d3('0x13')][_0x82d3('0x15')]);return _0x4cd11f(_0x1e8c55[_0x82d3('0x13')][_0x82d3('0x15')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3012ff,_0x82d3('0xf'));_0x4cd11f(_0x1e8c55[_0x82d3('0x16')][_0x82d3('0x15')]);}})[_0x82d3('0x17')](function(_0x2a6643){logger[_0x82d3('0x13')](_0x82d3('0x14'),_0x3012ff,_0x2a6643);_0x19fd37(_0x2a6643);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d6e8896..80e2258 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 _0x0bb5=['./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d9674,_0x39a161){var _0x4f6a63=function(_0x3df05c){while(--_0x3df05c){_0x2d9674['push'](_0x2d9674['shift']());}};_0x4f6a63(++_0x39a161);}(_0x0bb5,0x148));var _0x50bb=function(_0x5c98be,_0xb590de){_0x5c98be=_0x5c98be-0x0;var _0x33b65f=_0x0bb5[_0x5c98be];return _0x33b65f;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/configurations',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x10')]('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x10')](_0x50bb('0x12'),auth[_0x50bb('0xb')](),controller['addConfiguration']);router[_0x50bb('0x13')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);module[_0x50bb('0x17')]=router; \ No newline at end of file +var _0x757a=['destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','/:id','delete'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x757a,0xde));var _0xa757=function(_0x433847,_0x2edab8){_0x433847=_0x433847-0x0;var _0x287505=_0x757a[_0x433847];return _0x287505;};'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')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getConfigurations']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xa757('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xa757('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa757('0x12')]);module[_0xa757('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 204e72a..472b3ed 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 _0x0b0e=['STRING','username','remoteUri','sequelize'];(function(_0x2ef5e0,_0x42af1c){var _0x18f392=function(_0x4840cc){while(--_0x4840cc){_0x2ef5e0['push'](_0x2ef5e0['shift']());}};_0x18f392(++_0x42af1c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3e99cb,_0x1d2fe0){_0x3e99cb=_0x3e99cb-0x0;var _0x1bc729=_0x0b0e[_0x3e99cb];return _0x1bc729;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x2')},'apiKey':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')],'unique':_0xe0b0('0x3')},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8f4c=['sequelize','exports','STRING','username','remoteUri'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x8f4c,0x113));var _0xc8f4=function(_0x16ef9c,_0x55568f){_0x16ef9c=_0x16ef9c-0x0;var _0x38ad91=_0x8f4c[_0x16ef9c];return _0x38ad91;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')]},'description':{'type':Sequelize[_0xc8f4('0x2')]},'username':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x4')},'serverUrl':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 51981e3..76cb396 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 _0xfe66=['attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','find','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','create','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','%s%s','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','name','index','map','FreshsalesAccount','fieldName','type','model','query','filters','intersection'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xfe66,0xfa));var _0x6fe6=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0xfe66[_0x356127];return _0x5d4c75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fe6('0x0'));var zipdir=require(_0x6fe6('0x1'));var jsonpatch=require(_0x6fe6('0x2'));var rp=require(_0x6fe6('0x3'));var moment=require(_0x6fe6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6fe6('0x5'));var util=require(_0x6fe6('0x6'));var path=require(_0x6fe6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6fe6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6fe6('0x9'));var squel=require(_0x6fe6('0xa'));var crypto=require(_0x6fe6('0xb'));var jsforce=require(_0x6fe6('0xc'));var deskjs=require(_0x6fe6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6fe6('0xe'));var Papa=require(_0x6fe6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6fe6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fe6('0x11'));var logger=require(_0x6fe6('0x12'))(_0x6fe6('0x13'));var utils=require(_0x6fe6('0x14'));var config=require(_0x6fe6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fe6('0x16'))['db'];var integrations=require(_0x6fe6('0x17'));function respondWithStatusCode(_0x50dfaa,_0x5634c9){_0x5634c9=_0x5634c9||0xcc;return function(_0x28cf72){if(_0x28cf72){return _0x50dfaa[_0x6fe6('0x18')](_0x5634c9);}return _0x50dfaa[_0x6fe6('0x19')](_0x5634c9)[_0x6fe6('0x1a')]();};}function respondWithResult(_0x1db0cc,_0x427fd5){_0x427fd5=_0x427fd5||0xc8;return function(_0x11dc81){if(_0x11dc81){return _0x1db0cc[_0x6fe6('0x19')](_0x427fd5)[_0x6fe6('0x1b')](_0x11dc81);}};}function respondWithFilteredResult(_0x19ae59,_0x30f787){return function(_0x416a3a){if(_0x416a3a){var _0x24be91=typeof _0x30f787[_0x6fe6('0x1c')]===_0x6fe6('0x1d')&&typeof _0x30f787[_0x6fe6('0x1e')]===_0x6fe6('0x1d');var _0x76d36e=_0x416a3a[_0x6fe6('0x1f')];var _0x3cae4c=_0x24be91?0x0:_0x30f787[_0x6fe6('0x1c')];var _0x1060d8=_0x24be91?_0x416a3a['count']:_0x30f787[_0x6fe6('0x1c')]+_0x30f787[_0x6fe6('0x1e')];var _0x3c1de8;if(_0x1060d8>=_0x76d36e){_0x1060d8=_0x76d36e;_0x3c1de8=0xc8;}else{_0x3c1de8=0xce;}_0x19ae59[_0x6fe6('0x19')](_0x3c1de8);return _0x19ae59[_0x6fe6('0x20')]('Content-Range',_0x3cae4c+'-'+_0x1060d8+'/'+_0x76d36e)[_0x6fe6('0x1b')](_0x416a3a);}return null;};}function patchUpdates(_0x5ec1f6){return function(_0x4c2ebf){try{jsonpatch[_0x6fe6('0x21')](_0x4c2ebf,_0x5ec1f6,!![]);}catch(_0x33ad08){return BPromise[_0x6fe6('0x22')](_0x33ad08);}return _0x4c2ebf['save']();};}function saveUpdates(_0x2c8a44,_0x3074a7){return function(_0x104bd9){if(_0x104bd9){return _0x104bd9[_0x6fe6('0x23')](_0x2c8a44)['then'](function(_0x15d1f5){return _0x15d1f5;});}return null;};}function removeEntity(_0xc3b563,_0x590575){return function(_0x20d26b){if(_0x20d26b){return _0x20d26b['destroy']()[_0x6fe6('0x24')](function(){_0xc3b563[_0x6fe6('0x19')](0xcc)[_0x6fe6('0x1a')]();});}};}function handleEntityNotFound(_0x351947,_0x1074e4){return function(_0x695120){if(!_0x695120){_0x351947[_0x6fe6('0x18')](0x194);}return _0x695120;};}function handleError(_0x423b7b,_0x4a6e69){_0x4a6e69=_0x4a6e69||0x1f4;return function(_0x14d178){logger['error'](_0x14d178['stack']);if(_0x14d178['name']){delete _0x14d178[_0x6fe6('0x25')];}_0x423b7b['status'](_0x4a6e69)['send'](_0x14d178);};}exports[_0x6fe6('0x26')]=function(_0x52b952,_0x13a30f){var _0x5e70e7={},_0x1ff979={},_0x2621d1={'count':0x0,'rows':[]};var _0x30de60=_[_0x6fe6('0x27')](db[_0x6fe6('0x28')]['rawAttributes'],function(_0x2b7b82){return{'name':_0x2b7b82[_0x6fe6('0x29')],'type':_0x2b7b82[_0x6fe6('0x2a')]['key']};});_0x1ff979[_0x6fe6('0x2b')]=_['map'](_0x30de60,_0x6fe6('0x25'));_0x1ff979['query']=_['keys'](_0x52b952[_0x6fe6('0x2c')]);_0x1ff979[_0x6fe6('0x2d')]=_[_0x6fe6('0x2e')](_0x1ff979[_0x6fe6('0x2b')],_0x1ff979[_0x6fe6('0x2c')]);_0x5e70e7[_0x6fe6('0x2f')]=_[_0x6fe6('0x2e')](_0x1ff979[_0x6fe6('0x2b')],qs[_0x6fe6('0x30')](_0x52b952[_0x6fe6('0x2c')][_0x6fe6('0x30')]));_0x5e70e7[_0x6fe6('0x2f')]=_0x5e70e7[_0x6fe6('0x2f')]['length']?_0x5e70e7[_0x6fe6('0x2f')]:_0x1ff979[_0x6fe6('0x2b')];if(!_0x52b952[_0x6fe6('0x2c')][_0x6fe6('0x31')](_0x6fe6('0x32'))){_0x5e70e7['limit']=qs['limit'](_0x52b952[_0x6fe6('0x2c')][_0x6fe6('0x1e')]);_0x5e70e7[_0x6fe6('0x1c')]=qs[_0x6fe6('0x1c')](_0x52b952[_0x6fe6('0x2c')][_0x6fe6('0x1c')]);}_0x5e70e7[_0x6fe6('0x33')]=qs[_0x6fe6('0x34')](_0x52b952[_0x6fe6('0x2c')][_0x6fe6('0x34')]);_0x5e70e7['where']=qs[_0x6fe6('0x2d')](_[_0x6fe6('0x35')](_0x52b952[_0x6fe6('0x2c')],_0x1ff979['filters']),_0x30de60);if(_0x52b952[_0x6fe6('0x2c')]['filter']){_0x5e70e7[_0x6fe6('0x36')]=_['merge'](_0x5e70e7[_0x6fe6('0x36')],{'$or':_[_0x6fe6('0x27')](_0x30de60,function(_0xb52f40){if(_0xb52f40[_0x6fe6('0x2a')]!==_0x6fe6('0x37')){var _0x483b55={};_0x483b55[_0xb52f40[_0x6fe6('0x25')]]={'$like':'%'+_0x52b952[_0x6fe6('0x2c')][_0x6fe6('0x38')]+'%'};return _0x483b55;}})});}_0x5e70e7=_['merge']({},_0x5e70e7,_0x52b952[_0x6fe6('0x39')]);var _0x1cf235={'where':_0x5e70e7['where']};return db[_0x6fe6('0x28')][_0x6fe6('0x1f')](_0x1cf235)[_0x6fe6('0x24')](function(_0x32c0e8){_0x2621d1[_0x6fe6('0x1f')]=_0x32c0e8;if(_0x52b952['query'][_0x6fe6('0x3a')]){_0x5e70e7[_0x6fe6('0x3b')]=[{'all':!![]}];}return db[_0x6fe6('0x28')][_0x6fe6('0x3c')](_0x5e70e7);})[_0x6fe6('0x24')](function(_0xc7e5b5){_0x2621d1[_0x6fe6('0x3d')]=_0xc7e5b5;return _0x2621d1;})[_0x6fe6('0x24')](respondWithFilteredResult(_0x13a30f,_0x5e70e7))[_0x6fe6('0x3e')](handleError(_0x13a30f,null));};exports[_0x6fe6('0x3f')]=function(_0x110a16,_0xb3aa0b){var _0x2645c5={'raw':![],'where':{'id':_0x110a16[_0x6fe6('0x40')]['id']}},_0x503c69={};_0x503c69['model']=_[_0x6fe6('0x41')](db[_0x6fe6('0x28')]['rawAttributes']);_0x503c69[_0x6fe6('0x2c')]=_[_0x6fe6('0x41')](_0x110a16[_0x6fe6('0x2c')]);_0x503c69[_0x6fe6('0x2d')]=_[_0x6fe6('0x2e')](_0x503c69[_0x6fe6('0x2b')],_0x503c69[_0x6fe6('0x2c')]);_0x2645c5['attributes']=_[_0x6fe6('0x2e')](_0x503c69[_0x6fe6('0x2b')],qs['fields'](_0x110a16['query'][_0x6fe6('0x30')]));_0x2645c5[_0x6fe6('0x2f')]=_0x2645c5['attributes'][_0x6fe6('0x42')]?_0x2645c5[_0x6fe6('0x2f')]:_0x503c69[_0x6fe6('0x2b')];if(_0x110a16[_0x6fe6('0x2c')][_0x6fe6('0x3a')]){_0x2645c5[_0x6fe6('0x3b')]=[{'all':!![]}];}_0x2645c5=_[_0x6fe6('0x43')]({},_0x2645c5,_0x110a16['options']);return db[_0x6fe6('0x28')][_0x6fe6('0x44')](_0x2645c5)[_0x6fe6('0x24')](handleEntityNotFound(_0xb3aa0b,null))[_0x6fe6('0x24')](respondWithResult(_0xb3aa0b,null))[_0x6fe6('0x3e')](handleError(_0xb3aa0b,null));};exports['create']=function(_0x3f4359,_0x2cc53b){return db[_0x6fe6('0x28')]['create'](_0x3f4359['body'],{})[_0x6fe6('0x24')](respondWithResult(_0x2cc53b,0xc9))['catch'](handleError(_0x2cc53b,null));};exports[_0x6fe6('0x23')]=function(_0x16b75f,_0x406a6a){if(_0x16b75f['body']['id']){delete _0x16b75f[_0x6fe6('0x45')]['id'];}return db[_0x6fe6('0x28')][_0x6fe6('0x44')]({'where':{'id':_0x16b75f[_0x6fe6('0x40')]['id']}})['then'](handleEntityNotFound(_0x406a6a,null))[_0x6fe6('0x24')](saveUpdates(_0x16b75f[_0x6fe6('0x45')],null))[_0x6fe6('0x24')](respondWithResult(_0x406a6a,null))['catch'](handleError(_0x406a6a,null));};exports[_0x6fe6('0x46')]=function(_0x5b9581,_0x297113){return db[_0x6fe6('0x28')][_0x6fe6('0x44')]({'where':{'id':_0x5b9581[_0x6fe6('0x40')]['id']}})[_0x6fe6('0x24')](handleEntityNotFound(_0x297113,null))['then'](removeEntity(_0x297113,null))[_0x6fe6('0x3e')](handleError(_0x297113,null));};exports[_0x6fe6('0x47')]=function(_0x52679a,_0x26b7b8,_0x4378b9){var _0x558ade={};var _0xd2e597={};var _0x10b7a2;var _0x128e3e;return db[_0x6fe6('0x28')][_0x6fe6('0x48')]({'where':{'id':_0x52679a['params']['id']}})[_0x6fe6('0x24')](handleEntityNotFound(_0x26b7b8,null))[_0x6fe6('0x24')](function(_0x1acd06){if(_0x1acd06){_0x10b7a2=_0x1acd06;_0xd2e597[_0x6fe6('0x2b')]=_[_0x6fe6('0x41')](db[_0x6fe6('0x49')][_0x6fe6('0x4a')]);_0xd2e597[_0x6fe6('0x2c')]=_['keys'](_0x52679a[_0x6fe6('0x2c')]);_0xd2e597[_0x6fe6('0x2d')]=_[_0x6fe6('0x2e')](_0xd2e597['model'],_0xd2e597['query']);_0x558ade[_0x6fe6('0x2f')]=_[_0x6fe6('0x2e')](_0xd2e597['model'],qs[_0x6fe6('0x30')](_0x52679a[_0x6fe6('0x2c')]['fields']));_0x558ade[_0x6fe6('0x2f')]=_0x558ade[_0x6fe6('0x2f')][_0x6fe6('0x42')]?_0x558ade[_0x6fe6('0x2f')]:_0xd2e597[_0x6fe6('0x2b')];_0x558ade[_0x6fe6('0x33')]=qs[_0x6fe6('0x34')](_0x52679a[_0x6fe6('0x2c')][_0x6fe6('0x34')]);_0x558ade[_0x6fe6('0x36')]=qs[_0x6fe6('0x2d')](_['pick'](_0x52679a[_0x6fe6('0x2c')],_0xd2e597['filters']));if(_0x52679a[_0x6fe6('0x2c')][_0x6fe6('0x38')]){_0x558ade['where']=_[_0x6fe6('0x43')](_0x558ade[_0x6fe6('0x36')],{'$or':_['map'](_0x558ade['attributes'],function(_0x417e93){var _0x773471={};_0x773471[_0x417e93]={'$like':'%'+_0x52679a[_0x6fe6('0x2c')][_0x6fe6('0x38')]+'%'};return _0x773471;})});}_0x558ade=_[_0x6fe6('0x43')]({},_0x558ade,_0x52679a['options']);return _0x10b7a2[_0x6fe6('0x47')](_0x558ade);}})[_0x6fe6('0x24')](function(_0x48fb07){if(_0x48fb07){_0x128e3e=_0x48fb07[_0x6fe6('0x42')];if(!_0x52679a[_0x6fe6('0x2c')]['hasOwnProperty'](_0x6fe6('0x32'))){_0x558ade[_0x6fe6('0x1e')]=qs['limit'](_0x52679a['query'][_0x6fe6('0x1e')]);_0x558ade['offset']=qs[_0x6fe6('0x1c')](_0x52679a[_0x6fe6('0x2c')][_0x6fe6('0x1c')]);}return _0x10b7a2[_0x6fe6('0x47')](_0x558ade);}})[_0x6fe6('0x24')](function(_0x5adcfb){if(_0x5adcfb){return _0x5adcfb?{'count':_0x128e3e,'rows':_0x5adcfb}:null;}})['then'](respondWithResult(_0x26b7b8,null))[_0x6fe6('0x3e')](handleError(_0x26b7b8,null));};exports[_0x6fe6('0x4b')]=function(_0x1758f9,_0x48d6cd,_0x5aca34){if(_0x1758f9[_0x6fe6('0x45')]['id']){delete _0x1758f9[_0x6fe6('0x45')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x1758f9[_0x6fe6('0x40')]['id']}})[_0x6fe6('0x24')](handleEntityNotFound(_0x48d6cd,null))[_0x6fe6('0x24')](function(_0x58fc3b){if(_0x58fc3b){_0x1758f9[_0x6fe6('0x45')][_0x6fe6('0x4c')]=_0x58fc3b['id'];_0x1758f9[_0x6fe6('0x45')][_0x6fe6('0x4d')]=integrations['getSubjects'](_0x1758f9[_0x6fe6('0x45')][_0x6fe6('0x4e')],_0x1758f9[_0x6fe6('0x45')][_0x6fe6('0x2a')]);_0x1758f9[_0x6fe6('0x45')][_0x6fe6('0x4f')]=integrations[_0x6fe6('0x50')](_0x1758f9['body'][_0x6fe6('0x4e')],_0x1758f9['body'][_0x6fe6('0x2a')]);return db[_0x6fe6('0x49')][_0x6fe6('0x51')](_0x1758f9[_0x6fe6('0x45')],{'include':[{'model':db[_0x6fe6('0x52')],'as':_0x6fe6('0x4d')},{'model':db[_0x6fe6('0x52')],'as':_0x6fe6('0x4f')}]});}return null;})[_0x6fe6('0x24')](respondWithResult(_0x48d6cd,null))[_0x6fe6('0x3e')](handleError(_0x48d6cd,null));};exports[_0x6fe6('0x53')]=function(_0x1617e6,_0x14ec5e,_0x3cfaba){var _0x12a998='';var _0xad576f='';return db[_0x6fe6('0x28')][_0x6fe6('0x48')]({'where':{'id':_0x1617e6['params']['id']},'attributes':['id',_0x6fe6('0x54'),_0x6fe6('0x55'),_0x6fe6('0x56')]})[_0x6fe6('0x24')](handleEntityNotFound(_0x14ec5e,null))['then'](function(_0x43ddb5){if(_0x43ddb5){_0xad576f=_0x43ddb5[_0x6fe6('0x54')];_0x12a998=_0x43ddb5[_0x6fe6('0x55')];var _0x5df022=_0x43ddb5['remoteUri'][_0x6fe6('0x57')](-0x1);if(_0x5df022==='/'){_0x12a998=_0x12a998['substring'](0x0,_0x12a998[_0x6fe6('0x58')](_0x5df022));}return rp({'method':'GET','uri':util[_0x6fe6('0x59')](_0x6fe6('0x5a'),_0x12a998,'/api/selector/owners'),'headers':{'Authorization':_0x6fe6('0x5b')+_0x43ddb5[_0x6fe6('0x56')]},'json':!![]});}})[_0x6fe6('0x24')](function(_0x415b65){if(_0x415b65){var _0x2ca1f4=_0x415b65[_0x6fe6('0x5c')];var _0x25eded=![];var _0x59f1da=null;for(_0x59f1da=0x0;_0x59f1da<_0x2ca1f4['length'];_0x59f1da++){if(_0x2ca1f4[_0x59f1da]['email']===_0xad576f){_0x25eded=!![];}}if(_0x25eded){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6fe6('0x5d')});}}})[_0x6fe6('0x24')](respondWithResult(_0x14ec5e,null))[_0x6fe6('0x3e')](function(_0x2dc8c4){var _0x17f807=_0x1617e6[_0x6fe6('0x2c')][_0x6fe6('0x5e')]?0x1f4:_0x2dc8c4['statusCode']||0x1f4;logger['error'](_0x6fe6('0x5f'),_0x6fe6('0x53'),_0x17f807,JSON['stringify'](_0x2dc8c4));delete _0x2dc8c4['name'];if(_0x17f807===0x191){_0x17f807=0x190;}_0x14ec5e[_0x6fe6('0x19')](_0x17f807)[_0x6fe6('0x60')](_0x1617e6[_0x6fe6('0x2c')][_0x6fe6('0x5e')]?{'message':_0x6fe6('0x61'),'statusCode':_0x2dc8c4[_0x6fe6('0x62')]}:_0x2dc8c4);});}; \ No newline at end of file +var _0x9a8c=['FreshsalesConfiguration','order','addConfiguration','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','create','update','body','find','getConfigurations','findOne'];(function(_0x319e7b,_0x51126e){var _0x321e45=function(_0x16d5c7){while(--_0x16d5c7){_0x319e7b['push'](_0x319e7b['shift']());}};_0x321e45(++_0x51126e);}(_0x9a8c,0x83));var _0xc9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc9a8('0x0'));var rimraf=require(_0xc9a8('0x1'));var zipdir=require(_0xc9a8('0x2'));var jsonpatch=require(_0xc9a8('0x3'));var rp=require(_0xc9a8('0x4'));var moment=require(_0xc9a8('0x5'));var BPromise=require(_0xc9a8('0x6'));var Mustache=require('mustache');var util=require(_0xc9a8('0x7'));var path=require(_0xc9a8('0x8'));var sox=require(_0xc9a8('0x9'));var csv=require(_0xc9a8('0xa'));var ejs=require(_0xc9a8('0xb'));var fs=require('fs');var fs_extra=require(_0xc9a8('0xc'));var _=require(_0xc9a8('0xd'));var squel=require('squel');var crypto=require(_0xc9a8('0xe'));var jsforce=require(_0xc9a8('0xf'));var deskjs=require(_0xc9a8('0x10'));var toCsv=require(_0xc9a8('0xa'));var querystring=require(_0xc9a8('0x11'));var Papa=require('papaparse');var Redis=require(_0xc9a8('0x12'));var authService=require(_0xc9a8('0x13'));var qs=require(_0xc9a8('0x14'));var as=require(_0xc9a8('0x15'));var hardwareService=require(_0xc9a8('0x16'));var logger=require(_0xc9a8('0x17'))(_0xc9a8('0x18'));var utils=require(_0xc9a8('0x19'));var config=require(_0xc9a8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9a8('0x1b'))['db'];var integrations=require(_0xc9a8('0x1c'));function respondWithStatusCode(_0x488a4b,_0x4cdd0d){_0x4cdd0d=_0x4cdd0d||0xcc;return function(_0x5d688f){if(_0x5d688f){return _0x488a4b['sendStatus'](_0x4cdd0d);}return _0x488a4b[_0xc9a8('0x1d')](_0x4cdd0d)[_0xc9a8('0x1e')]();};}function respondWithResult(_0x359f68,_0x165b3b){_0x165b3b=_0x165b3b||0xc8;return function(_0x498265){if(_0x498265){return _0x359f68[_0xc9a8('0x1d')](_0x165b3b)[_0xc9a8('0x1f')](_0x498265);}};}function respondWithFilteredResult(_0x5bafdf,_0x22539d){return function(_0x42d20e){if(_0x42d20e){var _0x1ae2e8=typeof _0x22539d[_0xc9a8('0x20')]===_0xc9a8('0x21')&&typeof _0x22539d[_0xc9a8('0x22')]===_0xc9a8('0x21');var _0x2d5a8f=_0x42d20e['count'];var _0x4341a6=_0x1ae2e8?0x0:_0x22539d[_0xc9a8('0x20')];var _0x5cc018=_0x1ae2e8?_0x42d20e[_0xc9a8('0x23')]:_0x22539d['offset']+_0x22539d[_0xc9a8('0x22')];var _0x77e07b;if(_0x5cc018>=_0x2d5a8f){_0x5cc018=_0x2d5a8f;_0x77e07b=0xc8;}else{_0x77e07b=0xce;}_0x5bafdf[_0xc9a8('0x1d')](_0x77e07b);return _0x5bafdf['set'](_0xc9a8('0x24'),_0x4341a6+'-'+_0x5cc018+'/'+_0x2d5a8f)['json'](_0x42d20e);}return null;};}function patchUpdates(_0x591323){return function(_0x5043f0){try{jsonpatch['apply'](_0x5043f0,_0x591323,!![]);}catch(_0x39304e){return BPromise[_0xc9a8('0x25')](_0x39304e);}return _0x5043f0[_0xc9a8('0x26')]();};}function saveUpdates(_0x27d373,_0x56ecc8){return function(_0x3688d8){if(_0x3688d8){return _0x3688d8['update'](_0x27d373)[_0xc9a8('0x27')](function(_0x30ce8d){return _0x30ce8d;});}return null;};}function removeEntity(_0xfbaba5,_0x301c9f){return function(_0x2361b8){if(_0x2361b8){return _0x2361b8[_0xc9a8('0x28')]()[_0xc9a8('0x27')](function(){_0xfbaba5[_0xc9a8('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb19ca6,_0x585f20){return function(_0x4c849a){if(!_0x4c849a){_0xb19ca6['sendStatus'](0x194);}return _0x4c849a;};}function handleError(_0x4f44b9,_0x35991f){_0x35991f=_0x35991f||0x1f4;return function(_0xe89191){logger[_0xc9a8('0x29')](_0xe89191[_0xc9a8('0x2a')]);if(_0xe89191['name']){delete _0xe89191[_0xc9a8('0x2b')];}_0x4f44b9[_0xc9a8('0x1d')](_0x35991f)[_0xc9a8('0x2c')](_0xe89191);};}exports['index']=function(_0x586d9f,_0x4900d1){var _0x4de6c3={},_0x3ec29f={},_0x291685={'count':0x0,'rows':[]};var _0x10907e=_['map'](db[_0xc9a8('0x2d')][_0xc9a8('0x2e')],function(_0x27f469){return{'name':_0x27f469[_0xc9a8('0x2f')],'type':_0x27f469['type'][_0xc9a8('0x30')]};});_0x3ec29f[_0xc9a8('0x31')]=_[_0xc9a8('0x32')](_0x10907e,'name');_0x3ec29f[_0xc9a8('0x33')]=_[_0xc9a8('0x34')](_0x586d9f['query']);_0x3ec29f['filters']=_[_0xc9a8('0x35')](_0x3ec29f[_0xc9a8('0x31')],_0x3ec29f[_0xc9a8('0x33')]);_0x4de6c3['attributes']=_[_0xc9a8('0x35')](_0x3ec29f['model'],qs['fields'](_0x586d9f['query'][_0xc9a8('0x36')]));_0x4de6c3['attributes']=_0x4de6c3['attributes'][_0xc9a8('0x37')]?_0x4de6c3[_0xc9a8('0x38')]:_0x3ec29f['model'];if(!_0x586d9f[_0xc9a8('0x33')][_0xc9a8('0x39')](_0xc9a8('0x3a'))){_0x4de6c3[_0xc9a8('0x22')]=qs[_0xc9a8('0x22')](_0x586d9f['query']['limit']);_0x4de6c3['offset']=qs[_0xc9a8('0x20')](_0x586d9f[_0xc9a8('0x33')][_0xc9a8('0x20')]);}_0x4de6c3['order']=qs['sort'](_0x586d9f['query'][_0xc9a8('0x3b')]);_0x4de6c3[_0xc9a8('0x3c')]=qs[_0xc9a8('0x3d')](_[_0xc9a8('0x3e')](_0x586d9f[_0xc9a8('0x33')],_0x3ec29f[_0xc9a8('0x3d')]),_0x10907e);if(_0x586d9f[_0xc9a8('0x33')][_0xc9a8('0x3f')]){_0x4de6c3['where']=_['merge'](_0x4de6c3[_0xc9a8('0x3c')],{'$or':_[_0xc9a8('0x32')](_0x10907e,function(_0xfb6a41){if(_0xfb6a41[_0xc9a8('0x40')]!==_0xc9a8('0x41')){var _0x750c8={};_0x750c8[_0xfb6a41['name']]={'$like':'%'+_0x586d9f[_0xc9a8('0x33')][_0xc9a8('0x3f')]+'%'};return _0x750c8;}})});}_0x4de6c3=_[_0xc9a8('0x42')]({},_0x4de6c3,_0x586d9f['options']);var _0x357d60={'where':_0x4de6c3[_0xc9a8('0x3c')]};return db[_0xc9a8('0x2d')][_0xc9a8('0x23')](_0x357d60)['then'](function(_0x57e11d){_0x291685['count']=_0x57e11d;if(_0x586d9f['query'][_0xc9a8('0x43')]){_0x4de6c3[_0xc9a8('0x44')]=[{'all':!![]}];}return db[_0xc9a8('0x2d')][_0xc9a8('0x45')](_0x4de6c3);})[_0xc9a8('0x27')](function(_0xe8bc7c){_0x291685[_0xc9a8('0x46')]=_0xe8bc7c;return _0x291685;})['then'](respondWithFilteredResult(_0x4900d1,_0x4de6c3))[_0xc9a8('0x47')](handleError(_0x4900d1,null));};exports[_0xc9a8('0x48')]=function(_0x287e25,_0x37d436){var _0x4a18a7={'raw':![],'where':{'id':_0x287e25[_0xc9a8('0x49')]['id']}},_0x13f2fb={};_0x13f2fb['model']=_[_0xc9a8('0x34')](db[_0xc9a8('0x2d')]['rawAttributes']);_0x13f2fb[_0xc9a8('0x33')]=_[_0xc9a8('0x34')](_0x287e25[_0xc9a8('0x33')]);_0x13f2fb[_0xc9a8('0x3d')]=_[_0xc9a8('0x35')](_0x13f2fb[_0xc9a8('0x31')],_0x13f2fb['query']);_0x4a18a7[_0xc9a8('0x38')]=_[_0xc9a8('0x35')](_0x13f2fb[_0xc9a8('0x31')],qs[_0xc9a8('0x36')](_0x287e25['query'][_0xc9a8('0x36')]));_0x4a18a7[_0xc9a8('0x38')]=_0x4a18a7[_0xc9a8('0x38')]['length']?_0x4a18a7[_0xc9a8('0x38')]:_0x13f2fb[_0xc9a8('0x31')];if(_0x287e25[_0xc9a8('0x33')][_0xc9a8('0x43')]){_0x4a18a7['include']=[{'all':!![]}];}_0x4a18a7=_[_0xc9a8('0x42')]({},_0x4a18a7,_0x287e25[_0xc9a8('0x4a')]);return db['FreshsalesAccount']['find'](_0x4a18a7)['then'](handleEntityNotFound(_0x37d436,null))['then'](respondWithResult(_0x37d436,null))[_0xc9a8('0x47')](handleError(_0x37d436,null));};exports[_0xc9a8('0x4b')]=function(_0x4d56b3,_0x49ae92){return db['FreshsalesAccount'][_0xc9a8('0x4b')](_0x4d56b3['body'],{})[_0xc9a8('0x27')](respondWithResult(_0x49ae92,0xc9))[_0xc9a8('0x47')](handleError(_0x49ae92,null));};exports[_0xc9a8('0x4c')]=function(_0x2ea98d,_0x355a53){if(_0x2ea98d[_0xc9a8('0x4d')]['id']){delete _0x2ea98d['body']['id'];}return db[_0xc9a8('0x2d')][_0xc9a8('0x4e')]({'where':{'id':_0x2ea98d[_0xc9a8('0x49')]['id']}})[_0xc9a8('0x27')](handleEntityNotFound(_0x355a53,null))['then'](saveUpdates(_0x2ea98d[_0xc9a8('0x4d')],null))['then'](respondWithResult(_0x355a53,null))['catch'](handleError(_0x355a53,null));};exports[_0xc9a8('0x28')]=function(_0x1b9dab,_0x49230f){return db[_0xc9a8('0x2d')]['find']({'where':{'id':_0x1b9dab[_0xc9a8('0x49')]['id']}})[_0xc9a8('0x27')](handleEntityNotFound(_0x49230f,null))[_0xc9a8('0x27')](removeEntity(_0x49230f,null))['catch'](handleError(_0x49230f,null));};exports[_0xc9a8('0x4f')]=function(_0x515838,_0x9b1b5b,_0x1188dd){var _0x4ac821={};var _0x558176={};var _0x2faa08;var _0x353b04;return db[_0xc9a8('0x2d')][_0xc9a8('0x50')]({'where':{'id':_0x515838[_0xc9a8('0x49')]['id']}})[_0xc9a8('0x27')](handleEntityNotFound(_0x9b1b5b,null))[_0xc9a8('0x27')](function(_0x4d5181){if(_0x4d5181){_0x2faa08=_0x4d5181;_0x558176[_0xc9a8('0x31')]=_[_0xc9a8('0x34')](db[_0xc9a8('0x51')][_0xc9a8('0x2e')]);_0x558176[_0xc9a8('0x33')]=_[_0xc9a8('0x34')](_0x515838['query']);_0x558176[_0xc9a8('0x3d')]=_['intersection'](_0x558176[_0xc9a8('0x31')],_0x558176['query']);_0x4ac821['attributes']=_[_0xc9a8('0x35')](_0x558176[_0xc9a8('0x31')],qs[_0xc9a8('0x36')](_0x515838[_0xc9a8('0x33')][_0xc9a8('0x36')]));_0x4ac821[_0xc9a8('0x38')]=_0x4ac821[_0xc9a8('0x38')][_0xc9a8('0x37')]?_0x4ac821[_0xc9a8('0x38')]:_0x558176['model'];_0x4ac821[_0xc9a8('0x52')]=qs[_0xc9a8('0x3b')](_0x515838[_0xc9a8('0x33')][_0xc9a8('0x3b')]);_0x4ac821['where']=qs[_0xc9a8('0x3d')](_[_0xc9a8('0x3e')](_0x515838[_0xc9a8('0x33')],_0x558176[_0xc9a8('0x3d')]));if(_0x515838['query'][_0xc9a8('0x3f')]){_0x4ac821[_0xc9a8('0x3c')]=_['merge'](_0x4ac821[_0xc9a8('0x3c')],{'$or':_[_0xc9a8('0x32')](_0x4ac821[_0xc9a8('0x38')],function(_0x24bdb0){var _0x6c8392={};_0x6c8392[_0x24bdb0]={'$like':'%'+_0x515838[_0xc9a8('0x33')][_0xc9a8('0x3f')]+'%'};return _0x6c8392;})});}_0x4ac821=_[_0xc9a8('0x42')]({},_0x4ac821,_0x515838[_0xc9a8('0x4a')]);return _0x2faa08[_0xc9a8('0x4f')](_0x4ac821);}})[_0xc9a8('0x27')](function(_0x46d870){if(_0x46d870){_0x353b04=_0x46d870['length'];if(!_0x515838[_0xc9a8('0x33')]['hasOwnProperty'](_0xc9a8('0x3a'))){_0x4ac821['limit']=qs[_0xc9a8('0x22')](_0x515838[_0xc9a8('0x33')][_0xc9a8('0x22')]);_0x4ac821[_0xc9a8('0x20')]=qs[_0xc9a8('0x20')](_0x515838[_0xc9a8('0x33')][_0xc9a8('0x20')]);}return _0x2faa08[_0xc9a8('0x4f')](_0x4ac821);}})[_0xc9a8('0x27')](function(_0x35eda4){if(_0x35eda4){return _0x35eda4?{'count':_0x353b04,'rows':_0x35eda4}:null;}})[_0xc9a8('0x27')](respondWithResult(_0x9b1b5b,null))[_0xc9a8('0x47')](handleError(_0x9b1b5b,null));};exports[_0xc9a8('0x53')]=function(_0x43a107,_0x455f01,_0x233308){if(_0x43a107[_0xc9a8('0x4d')]['id']){delete _0x43a107['body']['id'];}return db[_0xc9a8('0x2d')]['findOne']({'where':{'id':_0x43a107[_0xc9a8('0x49')]['id']}})['then'](handleEntityNotFound(_0x455f01,null))[_0xc9a8('0x27')](function(_0x376842){if(_0x376842){_0x43a107[_0xc9a8('0x4d')]['AccountId']=_0x376842['id'];_0x43a107[_0xc9a8('0x4d')][_0xc9a8('0x54')]=integrations['getSubjects'](_0x43a107[_0xc9a8('0x4d')][_0xc9a8('0x55')],_0x43a107['body'][_0xc9a8('0x40')]);_0x43a107[_0xc9a8('0x4d')][_0xc9a8('0x56')]=integrations[_0xc9a8('0x57')](_0x43a107[_0xc9a8('0x4d')][_0xc9a8('0x55')],_0x43a107[_0xc9a8('0x4d')][_0xc9a8('0x40')]);return db['FreshsalesConfiguration']['create'](_0x43a107['body'],{'include':[{'model':db[_0xc9a8('0x58')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0xc9a8('0x56')}]});}return null;})[_0xc9a8('0x27')](respondWithResult(_0x455f01,null))[_0xc9a8('0x47')](handleError(_0x455f01,null));};exports[_0xc9a8('0x59')]=function(_0x231e44,_0x2aaf40,_0x31ccfe){var _0x318799='';var _0x24b5e5='';return db[_0xc9a8('0x2d')][_0xc9a8('0x50')]({'where':{'id':_0x231e44[_0xc9a8('0x49')]['id']},'attributes':['id',_0xc9a8('0x5a'),_0xc9a8('0x5b'),'apiKey']})['then'](handleEntityNotFound(_0x2aaf40,null))[_0xc9a8('0x27')](function(_0x49483f){if(_0x49483f){_0x24b5e5=_0x49483f[_0xc9a8('0x5a')];_0x318799=_0x49483f[_0xc9a8('0x5b')];var _0x243ce2=_0x49483f[_0xc9a8('0x5b')][_0xc9a8('0x5c')](-0x1);if(_0x243ce2==='/'){_0x318799=_0x318799[_0xc9a8('0x5d')](0x0,_0x318799['lastIndexOf'](_0x243ce2));}return rp({'method':_0xc9a8('0x5e'),'uri':util[_0xc9a8('0x5f')](_0xc9a8('0x60'),_0x318799,_0xc9a8('0x61')),'headers':{'Authorization':'Token\x20token='+_0x49483f[_0xc9a8('0x62')]},'json':!![]});}})[_0xc9a8('0x27')](function(_0x26fc8b){if(_0x26fc8b){var _0x4fe33b=_0x26fc8b[_0xc9a8('0x63')];var _0x254e84=![];var _0x3ebdc9=null;for(_0x3ebdc9=0x0;_0x3ebdc9<_0x4fe33b['length'];_0x3ebdc9++){if(_0x4fe33b[_0x3ebdc9][_0xc9a8('0x64')]===_0x24b5e5){_0x254e84=!![];}}if(_0x254e84){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc9a8('0x65')});}}})[_0xc9a8('0x27')](respondWithResult(_0x2aaf40,null))[_0xc9a8('0x47')](function(_0x25279f){var _0x2a6dd6=_0x231e44[_0xc9a8('0x33')][_0xc9a8('0x66')]?0x1f4:_0x25279f['statusCode']||0x1f4;logger[_0xc9a8('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xc9a8('0x59'),_0x2a6dd6,JSON[_0xc9a8('0x67')](_0x25279f));delete _0x25279f[_0xc9a8('0x2b')];if(_0x2a6dd6===0x191){_0x2a6dd6=0x190;}_0x2aaf40[_0xc9a8('0x1d')](_0x2a6dd6)['send'](_0x231e44[_0xc9a8('0x33')][_0xc9a8('0x66')]?{'message':_0xc9a8('0x68'),'statusCode':_0x25279f[_0xc9a8('0x69')]}:_0x25279f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 341dc83..e446b87 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 _0x9f0e=['define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x153f69,_0x4bd921){var _0x528235=function(_0x3780f2){while(--_0x3780f2){_0x153f69['push'](_0x153f69['shift']());}};_0x528235(++_0x4bd921);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1007cd,_0x158405){_0x1007cd=_0x1007cd-0x0;var _0x58551e=_0x9f0e[_0x1007cd];return _0x58551e;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));var integrations=require(_0xe9f0('0x9'));module['exports']=function(_0x5b87c1,_0x3a17b3){return _0x5b87c1[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x291bcf,_0x155b22){var _0x534c13=function(_0x131050){while(--_0x131050){_0x291bcf['push'](_0x291bcf['shift']());}};_0x534c13(++_0x155b22);}(_0xb016,0x159));var _0x6b01=function(_0x3a7bdb,_0x4840d9){_0x3a7bdb=_0x3a7bdb-0x0;var _0x3d15bd=_0xb016[_0x3a7bdb];return _0x3d15bd;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6b01('0x7'));module[_0x6b01('0x8')]=function(_0x192b2d,_0x5759a1){return _0x192b2d['define'](_0x6b01('0x9'),attributes,{'tableName':_0x6b01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index bb4c685..08323aa 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 _0xacf4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowFreshsalesAccount'];(function(_0x85673f,_0x534e81){var _0x539e99=function(_0xc40926){while(--_0xc40926){_0x85673f['push'](_0x85673f['shift']());}};_0x539e99(++_0x534e81);}(_0xacf4,0xe7));var _0x4acf=function(_0x133c35,_0x2226ae){_0x133c35=_0x133c35-0x0;var _0x1e93fa=_0xacf4[_0x133c35];return _0x1e93fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});}exports[_0x4acf('0x13')]=function(_0x240c00){var _0x4b1d93=this;return new Promise(function(_0x2a678b,_0x137302){return db[_0x4acf('0x14')][_0x4acf('0x15')]({'raw':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x18')]||null:null,'attributes':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x19')]||null:null,'limit':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1a')]||null:null,'include':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x240c00[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x53885f){return{'model':db[_0x53885f[_0x4acf('0x1d')]],'as':_0x53885f['as'],'attributes':_0x53885f[_0x4acf('0x19')],'include':_0x53885f['include']?_[_0x4acf('0x1c')](_0x53885f[_0x4acf('0x1b')],function(_0x52a84a){return{'model':db[_0x52a84a[_0x4acf('0x1d')]],'as':_0x52a84a['as'],'attributes':_0x52a84a[_0x4acf('0x19')],'include':_0x52a84a[_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x52a84a['include'],function(_0x50236d){return{'model':db[_0x50236d[_0x4acf('0x1d')]],'as':_0x50236d['as'],'attributes':_0x50236d[_0x4acf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0x42c90c){logger[_0x4acf('0xb')](_0x4acf('0x13'),_0x240c00);logger[_0x4acf('0x1e')](_0x4acf('0x13'),_0x240c00,JSON[_0x4acf('0x1f')](_0x42c90c));_0x2a678b(_0x42c90c);})[_0x4acf('0x12')](function(_0x57989e){logger[_0x4acf('0xf')](_0x4acf('0x13'),_0x57989e[_0x4acf('0x10')],_0x240c00);_0x137302(_0x4b1d93[_0x4acf('0xf')](0x1f4,_0x57989e[_0x4acf('0x10')]));});});};exports[_0x4acf('0x20')]=function(_0x27384c){var _0x5d862f=this;return new Promise(function(_0x337b3c,_0x1d221b){return db[_0x4acf('0x14')]['find']({'raw':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x27384c[_0x4acf('0x16')]?_0x27384c['options'][_0x4acf('0x18')]||null:null,'attributes':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')]['attributes']||null:null,'include':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x27384c[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x490880){return{'model':db[_0x490880[_0x4acf('0x1d')]],'as':_0x490880['as'],'attributes':_0x490880[_0x4acf('0x19')],'include':_0x490880['include']?_[_0x4acf('0x1c')](_0x490880['include'],function(_0x4cd020){return{'model':db[_0x4cd020['model']],'as':_0x4cd020['as'],'attributes':_0x4cd020['attributes'],'include':_0x4cd020['include']?_['map'](_0x4cd020['include'],function(_0x3364dd){return{'model':db[_0x3364dd[_0x4acf('0x1d')]],'as':_0x3364dd['as'],'attributes':_0x3364dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0xbd0f92){logger[_0x4acf('0xb')](_0x4acf('0x20'),_0x27384c);logger[_0x4acf('0x1e')](_0x4acf('0x20'),_0x27384c,JSON[_0x4acf('0x1f')](_0xbd0f92));_0x337b3c(_0xbd0f92);})[_0x4acf('0x12')](function(_0x24465b){logger[_0x4acf('0xf')]('ShowFreshsalesAccount',_0x24465b['message'],_0x27384c);_0x1d221b(_0x5d862f[_0x4acf('0xf')](0x1f4,_0x24465b[_0x4acf('0x10')]));});});}; \ No newline at end of file +var _0xd117=['message','request\x20sent','catch','FreshsalesAccount','options','raw','where','attributes','limit','map','include','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','code','error'];(function(_0x5977d9,_0x32d713){var _0x1fd94c=function(_0xa351eb){while(--_0xa351eb){_0x5977d9['push'](_0x5977d9['shift']());}};_0x1fd94c(++_0x32d713);}(_0xd117,0x182));var _0x7d11=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xd117[_0xf73c09];return _0xa8923c;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});}exports['GetFreshsalesAccount']=function(_0x456cb9){var _0x49a34b=this;return new Promise(function(_0x4d1306,_0x5459df){return db[_0x7d11('0x18')]['findAll']({'raw':_0x456cb9[_0x7d11('0x19')]?_0x456cb9['options'][_0x7d11('0x1a')]===undefined?!![]:![]:!![],'where':_0x456cb9[_0x7d11('0x19')]?_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1b')]||null:null,'attributes':_0x456cb9[_0x7d11('0x19')]?_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1c')]||null:null,'limit':_0x456cb9[_0x7d11('0x19')]?_0x456cb9['options'][_0x7d11('0x1d')]||null:null,'include':_0x456cb9['options']?_0x456cb9['options']['include']?_[_0x7d11('0x1e')](_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1f')],function(_0x1a7853){return{'model':db[_0x1a7853[_0x7d11('0x20')]],'as':_0x1a7853['as'],'attributes':_0x1a7853[_0x7d11('0x1c')],'include':_0x1a7853[_0x7d11('0x1f')]?_[_0x7d11('0x1e')](_0x1a7853['include'],function(_0x36c2b4){return{'model':db[_0x36c2b4['model']],'as':_0x36c2b4['as'],'attributes':_0x36c2b4['attributes'],'include':_0x36c2b4['include']?_[_0x7d11('0x1e')](_0x36c2b4['include'],function(_0x180e1e){return{'model':db[_0x180e1e[_0x7d11('0x20')]],'as':_0x180e1e['as'],'attributes':_0x180e1e[_0x7d11('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46f76a){logger[_0x7d11('0xf')](_0x7d11('0x21'),_0x456cb9);logger['debug'](_0x7d11('0x21'),_0x456cb9,JSON[_0x7d11('0x12')](_0x46f76a));_0x4d1306(_0x46f76a);})[_0x7d11('0x17')](function(_0x38f1be){logger['error'](_0x7d11('0x21'),_0x38f1be['message'],_0x456cb9);_0x5459df(_0x49a34b[_0x7d11('0x14')](0x1f4,_0x38f1be['message']));});});};exports[_0x7d11('0x22')]=function(_0xba4e80){var _0x1e32f6=this;return new Promise(function(_0x4831ed,_0x5e721f){return db[_0x7d11('0x18')][_0x7d11('0x23')]({'raw':_0xba4e80['options']?_0xba4e80[_0x7d11('0x19')][_0x7d11('0x1a')]===undefined?!![]:![]:!![],'where':_0xba4e80[_0x7d11('0x19')]?_0xba4e80['options'][_0x7d11('0x1b')]||null:null,'attributes':_0xba4e80['options']?_0xba4e80['options'][_0x7d11('0x1c')]||null:null,'include':_0xba4e80['options']?_0xba4e80[_0x7d11('0x19')][_0x7d11('0x1f')]?_[_0x7d11('0x1e')](_0xba4e80[_0x7d11('0x19')]['include'],function(_0x11d9e2){return{'model':db[_0x11d9e2[_0x7d11('0x20')]],'as':_0x11d9e2['as'],'attributes':_0x11d9e2['attributes'],'include':_0x11d9e2['include']?_[_0x7d11('0x1e')](_0x11d9e2[_0x7d11('0x1f')],function(_0x5b7d3a){return{'model':db[_0x5b7d3a[_0x7d11('0x20')]],'as':_0x5b7d3a['as'],'attributes':_0x5b7d3a['attributes'],'include':_0x5b7d3a['include']?_[_0x7d11('0x1e')](_0x5b7d3a['include'],function(_0x4e53be){return{'model':db[_0x4e53be[_0x7d11('0x20')]],'as':_0x4e53be['as'],'attributes':_0x4e53be[_0x7d11('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7d11('0x24')](function(_0x2e426b){logger[_0x7d11('0xf')](_0x7d11('0x22'),_0xba4e80);logger[_0x7d11('0x11')](_0x7d11('0x22'),_0xba4e80,JSON[_0x7d11('0x12')](_0x2e426b));_0x4831ed(_0x2e426b);})[_0x7d11('0x17')](function(_0x1a9f18){logger[_0x7d11('0x14')]('ShowFreshsalesAccount',_0x1a9f18[_0x7d11('0x15')],_0xba4e80);_0x5e721f(_0x1e32f6['error'](0x1f4,_0x1a9f18[_0x7d11('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 87071b1..77e4428 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 _0x77b7=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','destroy','multer'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x77b7,0x1b7));var _0x777b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x77b7[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x777b('0x0'));var util=require(_0x777b('0x1'));var path=require('path');var timeout=require(_0x777b('0x2'));var express=require(_0x777b('0x3'));var router=express[_0x777b('0x4')]();var fs_extra=require(_0x777b('0x5'));var auth=require(_0x777b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x777b('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x777b('0x8')]('/',auth[_0x777b('0x9')](),controller[_0x777b('0xa')]);router[_0x777b('0x8')](_0x777b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x777b('0x8')](_0x777b('0xc'),auth['isAuthenticated'](),controller[_0x777b('0xd')]);router['get'](_0x777b('0xe'),auth[_0x777b('0x9')](),controller['getDescriptions']);router[_0x777b('0x8')](_0x777b('0xf'),auth[_0x777b('0x9')](),controller[_0x777b('0x10')]);router[_0x777b('0x11')]('/',auth[_0x777b('0x9')](),controller[_0x777b('0x12')]);router[_0x777b('0x13')](_0x777b('0xb'),auth[_0x777b('0x9')](),controller[_0x777b('0x14')]);router['delete'](_0x777b('0xb'),auth[_0x777b('0x9')](),controller[_0x777b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x12e6=['/:id/fields','getFields','post','create','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x53ee43,_0x2a63ec){var _0x58b2ca=function(_0x35e8a0){while(--_0x35e8a0){_0x53ee43['push'](_0x53ee43['shift']());}};_0x58b2ca(++_0x2a63ec);}(_0x12e6,0x14a));var _0x612e=function(_0x30d56a,_0x212f28){_0x30d56a=_0x30d56a-0x0;var _0x1985ca=_0x12e6[_0x30d56a];return _0x1985ca;};'use strict';var multer=require(_0x612e('0x0'));var util=require(_0x612e('0x1'));var path=require('path');var timeout=require(_0x612e('0x2'));var express=require(_0x612e('0x3'));var router=express[_0x612e('0x4')]();var fs_extra=require(_0x612e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x612e('0x6'));var config=require(_0x612e('0x7'));var controller=require(_0x612e('0x8'));router['get']('/',auth[_0x612e('0x9')](),controller['index']);router[_0x612e('0xa')]('/:id',auth[_0x612e('0x9')](),controller[_0x612e('0xb')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x612e('0xc')]);router[_0x612e('0xa')](_0x612e('0xd'),auth[_0x612e('0x9')](),controller[_0x612e('0xe')]);router[_0x612e('0xa')](_0x612e('0xf'),auth[_0x612e('0x9')](),controller[_0x612e('0x10')]);router[_0x612e('0x11')]('/',auth[_0x612e('0x9')](),controller[_0x612e('0x12')]);router['put'](_0x612e('0x13'),auth['isAuthenticated'](),controller[_0x612e('0x14')]);router['delete'](_0x612e('0x13'),auth[_0x612e('0x9')](),controller[_0x612e('0x15')]);module[_0x612e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c12354a..73312e1 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 _0xf2eb=['exports','STRING','sequelize'];(function(_0xf2d1c5,_0xf5e2a1){var _0x3d7adb=function(_0x550a86){while(--_0x550a86){_0xf2d1c5['push'](_0xf2d1c5['shift']());}};_0x3d7adb(++_0xf5e2a1);}(_0xf2eb,0x167));var _0xbf2e=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf2eb[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xbf2e('0x0'));module[_0xbf2e('0x1')]={'name':{'type':Sequelize[_0xbf2e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x88d0=['sequelize'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x88d0,0xa1));var _0x088d=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x88d0[_0xd22d95];return _0x15d7a3;};'use strict';var Sequelize=require(_0x088d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b6a1296..67f4f11 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 _0xffb7=['end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','getSubjects','hasOwnProperty','nolimit','getDescriptions','findOne','FreshsalesField','getFields','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0xde9059,_0x750aab){var _0x23197d=function(_0x457724){while(--_0x457724){_0xde9059['push'](_0xde9059['shift']());}};_0x23197d(++_0x750aab);}(_0xffb7,0x86));var _0x7ffb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xffb7[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7ffb('0x0'));var rimraf=require(_0x7ffb('0x1'));var zipdir=require(_0x7ffb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ffb('0x3'));var moment=require('moment');var BPromise=require(_0x7ffb('0x4'));var Mustache=require('mustache');var util=require(_0x7ffb('0x5'));var path=require(_0x7ffb('0x6'));var sox=require(_0x7ffb('0x7'));var csv=require(_0x7ffb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ffb('0x9'));var _=require(_0x7ffb('0xa'));var squel=require(_0x7ffb('0xb'));var crypto=require(_0x7ffb('0xc'));var jsforce=require(_0x7ffb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7ffb('0x8'));var querystring=require(_0x7ffb('0xe'));var Papa=require(_0x7ffb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ffb('0x10'));var logger=require(_0x7ffb('0x11'))(_0x7ffb('0x12'));var utils=require(_0x7ffb('0x13'));var config=require(_0x7ffb('0x14'));var licenseUtil=require(_0x7ffb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259386,_0x12ea1c){_0x12ea1c=_0x12ea1c||0xcc;return function(_0x241895){if(_0x241895){return _0x259386[_0x7ffb('0x16')](_0x12ea1c);}return _0x259386[_0x7ffb('0x17')](_0x12ea1c)[_0x7ffb('0x18')]();};}function respondWithResult(_0x443bdf,_0x4e4eb7){_0x4e4eb7=_0x4e4eb7||0xc8;return function(_0x285348){if(_0x285348){return _0x443bdf[_0x7ffb('0x17')](_0x4e4eb7)[_0x7ffb('0x19')](_0x285348);}};}function respondWithFilteredResult(_0x550b43,_0x1b0c5b){return function(_0x2a1a61){if(_0x2a1a61){var _0x205b5e=typeof _0x1b0c5b['offset']===_0x7ffb('0x1a')&&typeof _0x1b0c5b['limit']===_0x7ffb('0x1a');var _0xa11364=_0x2a1a61[_0x7ffb('0x1b')];var _0x3c233c=_0x205b5e?0x0:_0x1b0c5b[_0x7ffb('0x1c')];var _0x4e57dc=_0x205b5e?_0x2a1a61[_0x7ffb('0x1b')]:_0x1b0c5b[_0x7ffb('0x1c')]+_0x1b0c5b[_0x7ffb('0x1d')];var _0x2f1575;if(_0x4e57dc>=_0xa11364){_0x4e57dc=_0xa11364;_0x2f1575=0xc8;}else{_0x2f1575=0xce;}_0x550b43[_0x7ffb('0x17')](_0x2f1575);return _0x550b43['set'](_0x7ffb('0x1e'),_0x3c233c+'-'+_0x4e57dc+'/'+_0xa11364)['json'](_0x2a1a61);}return null;};}function patchUpdates(_0x50ed3a){return function(_0x4e6d15){try{jsonpatch[_0x7ffb('0x1f')](_0x4e6d15,_0x50ed3a,!![]);}catch(_0x3de03a){return BPromise[_0x7ffb('0x20')](_0x3de03a);}return _0x4e6d15['save']();};}function saveUpdates(_0x40bc5e,_0x1a71a0){return function(_0x33f81b){if(_0x33f81b){return _0x33f81b[_0x7ffb('0x21')](_0x40bc5e)['then'](function(_0x57d38c){return _0x57d38c;});}return null;};}function removeEntity(_0x3cbbfa,_0x471772){return function(_0x17895d){if(_0x17895d){return _0x17895d[_0x7ffb('0x22')]()['then'](function(){_0x3cbbfa['status'](0xcc)[_0x7ffb('0x18')]();});}};}function handleEntityNotFound(_0x21e928,_0x131c28){return function(_0x5d8618){if(!_0x5d8618){_0x21e928[_0x7ffb('0x16')](0x194);}return _0x5d8618;};}function handleError(_0x27e6b5,_0x50a622){_0x50a622=_0x50a622||0x1f4;return function(_0x3e125e){logger[_0x7ffb('0x23')](_0x3e125e[_0x7ffb('0x24')]);if(_0x3e125e[_0x7ffb('0x25')]){delete _0x3e125e[_0x7ffb('0x25')];}_0x27e6b5[_0x7ffb('0x17')](_0x50a622)['send'](_0x3e125e);};}exports[_0x7ffb('0x26')]=function(_0xc5211d,_0x15b72a){var _0x43572a={},_0x52fae0={},_0x64cde1={'count':0x0,'rows':[]};var _0x52a1bf=_[_0x7ffb('0x27')](db[_0x7ffb('0x28')][_0x7ffb('0x29')],function(_0x21b9b4){return{'name':_0x21b9b4[_0x7ffb('0x2a')],'type':_0x21b9b4[_0x7ffb('0x2b')][_0x7ffb('0x2c')]};});_0x52fae0[_0x7ffb('0x2d')]=_[_0x7ffb('0x27')](_0x52a1bf,_0x7ffb('0x25'));_0x52fae0[_0x7ffb('0x2e')]=_[_0x7ffb('0x2f')](_0xc5211d[_0x7ffb('0x2e')]);_0x52fae0[_0x7ffb('0x30')]=_[_0x7ffb('0x31')](_0x52fae0['model'],_0x52fae0[_0x7ffb('0x2e')]);_0x43572a[_0x7ffb('0x32')]=_[_0x7ffb('0x31')](_0x52fae0[_0x7ffb('0x2d')],qs['fields'](_0xc5211d[_0x7ffb('0x2e')]['fields']));_0x43572a[_0x7ffb('0x32')]=_0x43572a[_0x7ffb('0x32')][_0x7ffb('0x33')]?_0x43572a[_0x7ffb('0x32')]:_0x52fae0[_0x7ffb('0x2d')];if(!_0xc5211d[_0x7ffb('0x2e')]['hasOwnProperty']('nolimit')){_0x43572a[_0x7ffb('0x1d')]=qs[_0x7ffb('0x1d')](_0xc5211d[_0x7ffb('0x2e')][_0x7ffb('0x1d')]);_0x43572a[_0x7ffb('0x1c')]=qs[_0x7ffb('0x1c')](_0xc5211d[_0x7ffb('0x2e')][_0x7ffb('0x1c')]);}_0x43572a[_0x7ffb('0x34')]=qs[_0x7ffb('0x35')](_0xc5211d[_0x7ffb('0x2e')][_0x7ffb('0x35')]);_0x43572a[_0x7ffb('0x36')]=qs[_0x7ffb('0x30')](_[_0x7ffb('0x37')](_0xc5211d[_0x7ffb('0x2e')],_0x52fae0[_0x7ffb('0x30')]),_0x52a1bf);if(_0xc5211d[_0x7ffb('0x2e')]['filter']){_0x43572a[_0x7ffb('0x36')]=_['merge'](_0x43572a[_0x7ffb('0x36')],{'$or':_[_0x7ffb('0x27')](_0x52a1bf,function(_0x26cc1){if(_0x26cc1[_0x7ffb('0x2b')]!==_0x7ffb('0x38')){var _0x7df05d={};_0x7df05d[_0x26cc1['name']]={'$like':'%'+_0xc5211d[_0x7ffb('0x2e')][_0x7ffb('0x39')]+'%'};return _0x7df05d;}})});}_0x43572a=_[_0x7ffb('0x3a')]({},_0x43572a,_0xc5211d[_0x7ffb('0x3b')]);var _0x4961d5={'where':_0x43572a[_0x7ffb('0x36')]};return db[_0x7ffb('0x28')][_0x7ffb('0x1b')](_0x4961d5)[_0x7ffb('0x3c')](function(_0xf0aa27){_0x64cde1[_0x7ffb('0x1b')]=_0xf0aa27;if(_0xc5211d['query'][_0x7ffb('0x3d')]){_0x43572a[_0x7ffb('0x3e')]=[{'all':!![]}];}return db[_0x7ffb('0x28')][_0x7ffb('0x3f')](_0x43572a);})[_0x7ffb('0x3c')](function(_0x1105b1){_0x64cde1[_0x7ffb('0x40')]=_0x1105b1;return _0x64cde1;})[_0x7ffb('0x3c')](respondWithFilteredResult(_0x15b72a,_0x43572a))['catch'](handleError(_0x15b72a,null));};exports[_0x7ffb('0x41')]=function(_0x1fdf8a,_0x3b9f29){var _0x2c098d={'raw':![],'where':{'id':_0x1fdf8a[_0x7ffb('0x42')]['id']}},_0x23aa04={};_0x23aa04['model']=_[_0x7ffb('0x2f')](db['FreshsalesConfiguration'][_0x7ffb('0x29')]);_0x23aa04[_0x7ffb('0x2e')]=_['keys'](_0x1fdf8a[_0x7ffb('0x2e')]);_0x23aa04[_0x7ffb('0x30')]=_[_0x7ffb('0x31')](_0x23aa04[_0x7ffb('0x2d')],_0x23aa04['query']);_0x2c098d[_0x7ffb('0x32')]=_[_0x7ffb('0x31')](_0x23aa04[_0x7ffb('0x2d')],qs[_0x7ffb('0x43')](_0x1fdf8a[_0x7ffb('0x2e')]['fields']));_0x2c098d['attributes']=_0x2c098d[_0x7ffb('0x32')][_0x7ffb('0x33')]?_0x2c098d['attributes']:_0x23aa04[_0x7ffb('0x2d')];if(_0x1fdf8a[_0x7ffb('0x2e')][_0x7ffb('0x3d')]){_0x2c098d['include']=[{'all':!![]}];}_0x2c098d=_[_0x7ffb('0x3a')]({},_0x2c098d,_0x1fdf8a[_0x7ffb('0x3b')]);return db[_0x7ffb('0x28')][_0x7ffb('0x44')](_0x2c098d)[_0x7ffb('0x3c')](handleEntityNotFound(_0x3b9f29,null))[_0x7ffb('0x3c')](respondWithResult(_0x3b9f29,null))[_0x7ffb('0x45')](handleError(_0x3b9f29,null));};exports[_0x7ffb('0x46')]=function(_0x37af75,_0x1267ee){return db[_0x7ffb('0x28')][_0x7ffb('0x46')](_0x37af75['body'],{})[_0x7ffb('0x3c')](respondWithResult(_0x1267ee,0xc9))[_0x7ffb('0x45')](handleError(_0x1267ee,null));};exports[_0x7ffb('0x21')]=function(_0x41ceac,_0x184bba){if(_0x41ceac['body']['id']){delete _0x41ceac[_0x7ffb('0x47')]['id'];}return db[_0x7ffb('0x28')][_0x7ffb('0x44')]({'where':{'id':_0x41ceac[_0x7ffb('0x42')]['id']}})[_0x7ffb('0x3c')](handleEntityNotFound(_0x184bba,null))[_0x7ffb('0x3c')](saveUpdates(_0x41ceac[_0x7ffb('0x47')],null))[_0x7ffb('0x3c')](respondWithResult(_0x184bba,null))[_0x7ffb('0x45')](handleError(_0x184bba,null));};exports[_0x7ffb('0x22')]=function(_0x50e740,_0x116432){return db[_0x7ffb('0x28')][_0x7ffb('0x44')]({'where':{'id':_0x50e740[_0x7ffb('0x42')]['id']}})['then'](handleEntityNotFound(_0x116432,null))['then'](removeEntity(_0x116432,null))[_0x7ffb('0x45')](handleError(_0x116432,null));};exports[_0x7ffb('0x48')]=function(_0x3266a0,_0x381b13,_0x26b1ed){var _0x120d6e={};var _0x27b9e5={};var _0xf7bc43;var _0x13863a;return db[_0x7ffb('0x28')]['findOne']({'where':{'id':_0x3266a0[_0x7ffb('0x42')]['id']}})['then'](handleEntityNotFound(_0x381b13,null))[_0x7ffb('0x3c')](function(_0xdf5ca7){if(_0xdf5ca7){_0xf7bc43=_0xdf5ca7;_0x27b9e5[_0x7ffb('0x2d')]=_[_0x7ffb('0x2f')](db['FreshsalesField'][_0x7ffb('0x29')]);_0x27b9e5[_0x7ffb('0x2e')]=_['keys'](_0x3266a0[_0x7ffb('0x2e')]);_0x27b9e5['filters']=_[_0x7ffb('0x31')](_0x27b9e5[_0x7ffb('0x2d')],_0x27b9e5['query']);_0x120d6e[_0x7ffb('0x32')]=_[_0x7ffb('0x31')](_0x27b9e5[_0x7ffb('0x2d')],qs[_0x7ffb('0x43')](_0x3266a0[_0x7ffb('0x2e')][_0x7ffb('0x43')]));_0x120d6e['attributes']=_0x120d6e['attributes']['length']?_0x120d6e[_0x7ffb('0x32')]:_0x27b9e5[_0x7ffb('0x2d')];_0x120d6e[_0x7ffb('0x34')]=qs[_0x7ffb('0x35')](_0x3266a0['query'][_0x7ffb('0x35')]);_0x120d6e[_0x7ffb('0x36')]=qs[_0x7ffb('0x30')](_[_0x7ffb('0x37')](_0x3266a0[_0x7ffb('0x2e')],_0x27b9e5[_0x7ffb('0x30')]));if(_0x3266a0['query'][_0x7ffb('0x39')]){_0x120d6e[_0x7ffb('0x36')]=_['merge'](_0x120d6e['where'],{'$or':_['map'](_0x120d6e[_0x7ffb('0x32')],function(_0x2107d9){var _0x503a05={};_0x503a05[_0x2107d9]={'$like':'%'+_0x3266a0[_0x7ffb('0x2e')][_0x7ffb('0x39')]+'%'};return _0x503a05;})});}_0x120d6e=_[_0x7ffb('0x3a')]({},_0x120d6e,_0x3266a0['options']);return _0xf7bc43[_0x7ffb('0x48')](_0x120d6e);}})[_0x7ffb('0x3c')](function(_0x5462c1){if(_0x5462c1){_0x13863a=_0x5462c1[_0x7ffb('0x33')];if(!_0x3266a0[_0x7ffb('0x2e')][_0x7ffb('0x49')](_0x7ffb('0x4a'))){_0x120d6e['limit']=qs[_0x7ffb('0x1d')](_0x3266a0[_0x7ffb('0x2e')][_0x7ffb('0x1d')]);_0x120d6e['offset']=qs[_0x7ffb('0x1c')](_0x3266a0[_0x7ffb('0x2e')]['offset']);}return _0xf7bc43[_0x7ffb('0x48')](_0x120d6e);}})[_0x7ffb('0x3c')](function(_0x5b93cb){if(_0x5b93cb){return _0x5b93cb?{'count':_0x13863a,'rows':_0x5b93cb}:null;}})['then'](respondWithResult(_0x381b13,null))[_0x7ffb('0x45')](handleError(_0x381b13,null));};exports[_0x7ffb('0x4b')]=function(_0xbdb081,_0x2c052f,_0x222f59){var _0xa1d09f={};var _0x204406={};var _0x4558f9;var _0x114b4a;return db['FreshsalesConfiguration'][_0x7ffb('0x4c')]({'where':{'id':_0xbdb081[_0x7ffb('0x42')]['id']}})[_0x7ffb('0x3c')](handleEntityNotFound(_0x2c052f,null))['then'](function(_0xa41d64){if(_0xa41d64){_0x4558f9=_0xa41d64;_0x204406['model']=_[_0x7ffb('0x2f')](db[_0x7ffb('0x4d')][_0x7ffb('0x29')]);_0x204406[_0x7ffb('0x2e')]=_[_0x7ffb('0x2f')](_0xbdb081[_0x7ffb('0x2e')]);_0x204406[_0x7ffb('0x30')]=_[_0x7ffb('0x31')](_0x204406[_0x7ffb('0x2d')],_0x204406[_0x7ffb('0x2e')]);_0xa1d09f[_0x7ffb('0x32')]=_[_0x7ffb('0x31')](_0x204406['model'],qs[_0x7ffb('0x43')](_0xbdb081[_0x7ffb('0x2e')][_0x7ffb('0x43')]));_0xa1d09f[_0x7ffb('0x32')]=_0xa1d09f[_0x7ffb('0x32')][_0x7ffb('0x33')]?_0xa1d09f['attributes']:_0x204406[_0x7ffb('0x2d')];_0xa1d09f[_0x7ffb('0x34')]=qs[_0x7ffb('0x35')](_0xbdb081[_0x7ffb('0x2e')][_0x7ffb('0x35')]);_0xa1d09f[_0x7ffb('0x36')]=qs[_0x7ffb('0x30')](_[_0x7ffb('0x37')](_0xbdb081[_0x7ffb('0x2e')],_0x204406[_0x7ffb('0x30')]));if(_0xbdb081['query'][_0x7ffb('0x39')]){_0xa1d09f['where']=_['merge'](_0xa1d09f[_0x7ffb('0x36')],{'$or':_[_0x7ffb('0x27')](_0xa1d09f[_0x7ffb('0x32')],function(_0x19b476){var _0x43098b={};_0x43098b[_0x19b476]={'$like':'%'+_0xbdb081[_0x7ffb('0x2e')][_0x7ffb('0x39')]+'%'};return _0x43098b;})});}_0xa1d09f=_[_0x7ffb('0x3a')]({},_0xa1d09f,_0xbdb081[_0x7ffb('0x3b')]);return _0x4558f9[_0x7ffb('0x4b')](_0xa1d09f);}})[_0x7ffb('0x3c')](function(_0x236cfa){if(_0x236cfa){_0x114b4a=_0x236cfa[_0x7ffb('0x33')];if(!_0xbdb081[_0x7ffb('0x2e')][_0x7ffb('0x49')](_0x7ffb('0x4a'))){_0xa1d09f[_0x7ffb('0x1d')]=qs[_0x7ffb('0x1d')](_0xbdb081['query'][_0x7ffb('0x1d')]);_0xa1d09f['offset']=qs[_0x7ffb('0x1c')](_0xbdb081['query']['offset']);}return _0x4558f9[_0x7ffb('0x4b')](_0xa1d09f);}})[_0x7ffb('0x3c')](function(_0x129c8b){if(_0x129c8b){return _0x129c8b?{'count':_0x114b4a,'rows':_0x129c8b}:null;}})['then'](respondWithResult(_0x2c052f,null))[_0x7ffb('0x45')](handleError(_0x2c052f,null));};exports['getFields']=function(_0x17aecd,_0x3aa42,_0x317ff1){var _0x3f7d93={};var _0x5e699a={};var _0xa4c0d0;var _0x4a3421;return db[_0x7ffb('0x28')][_0x7ffb('0x4c')]({'where':{'id':_0x17aecd[_0x7ffb('0x42')]['id']}})['then'](handleEntityNotFound(_0x3aa42,null))['then'](function(_0x52e522){if(_0x52e522){_0xa4c0d0=_0x52e522;_0x5e699a[_0x7ffb('0x2d')]=_[_0x7ffb('0x2f')](db['FreshsalesField'][_0x7ffb('0x29')]);_0x5e699a[_0x7ffb('0x2e')]=_['keys'](_0x17aecd[_0x7ffb('0x2e')]);_0x5e699a['filters']=_[_0x7ffb('0x31')](_0x5e699a[_0x7ffb('0x2d')],_0x5e699a[_0x7ffb('0x2e')]);_0x3f7d93[_0x7ffb('0x32')]=_[_0x7ffb('0x31')](_0x5e699a[_0x7ffb('0x2d')],qs['fields'](_0x17aecd[_0x7ffb('0x2e')][_0x7ffb('0x43')]));_0x3f7d93['attributes']=_0x3f7d93['attributes'][_0x7ffb('0x33')]?_0x3f7d93['attributes']:_0x5e699a[_0x7ffb('0x2d')];_0x3f7d93[_0x7ffb('0x34')]=qs[_0x7ffb('0x35')](_0x17aecd[_0x7ffb('0x2e')][_0x7ffb('0x35')]);_0x3f7d93['where']=qs['filters'](_[_0x7ffb('0x37')](_0x17aecd[_0x7ffb('0x2e')],_0x5e699a[_0x7ffb('0x30')]));if(_0x17aecd[_0x7ffb('0x2e')]['filter']){_0x3f7d93[_0x7ffb('0x36')]=_['merge'](_0x3f7d93[_0x7ffb('0x36')],{'$or':_[_0x7ffb('0x27')](_0x3f7d93[_0x7ffb('0x32')],function(_0x4f5f0b){var _0x354229={};_0x354229[_0x4f5f0b]={'$like':'%'+_0x17aecd[_0x7ffb('0x2e')][_0x7ffb('0x39')]+'%'};return _0x354229;})});}_0x3f7d93=_[_0x7ffb('0x3a')]({},_0x3f7d93,_0x17aecd[_0x7ffb('0x3b')]);return _0xa4c0d0[_0x7ffb('0x4e')](_0x3f7d93);}})['then'](function(_0x3f7217){if(_0x3f7217){_0x4a3421=_0x3f7217[_0x7ffb('0x33')];if(!_0x17aecd['query'][_0x7ffb('0x49')](_0x7ffb('0x4a'))){_0x3f7d93[_0x7ffb('0x1d')]=qs['limit'](_0x17aecd['query']['limit']);_0x3f7d93['offset']=qs[_0x7ffb('0x1c')](_0x17aecd['query']['offset']);}return _0xa4c0d0[_0x7ffb('0x4e')](_0x3f7d93);}})[_0x7ffb('0x3c')](function(_0x7b1504){if(_0x7b1504){return _0x7b1504?{'count':_0x4a3421,'rows':_0x7b1504}:null;}})['then'](respondWithResult(_0x3aa42,null))[_0x7ffb('0x45')](handleError(_0x3aa42,null));}; \ No newline at end of file +var _0xa2c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getSubjects','FreshsalesField','findOne','order','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','end','error','stack','name','send','index','map','FreshsalesConfiguration'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0xa2c5,0xce));var _0x5a2c=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xa2c5[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require(_0x5a2c('0x0'));var rimraf=require(_0x5a2c('0x1'));var zipdir=require(_0x5a2c('0x2'));var jsonpatch=require(_0x5a2c('0x3'));var rp=require(_0x5a2c('0x4'));var moment=require('moment');var BPromise=require(_0x5a2c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5a2c('0x6'));var sox=require('sox');var csv=require(_0x5a2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a2c('0x8'));var _=require(_0x5a2c('0x9'));var squel=require(_0x5a2c('0xa'));var crypto=require(_0x5a2c('0xb'));var jsforce=require(_0x5a2c('0xc'));var deskjs=require(_0x5a2c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5a2c('0xe'));var Papa=require('papaparse');var Redis=require(_0x5a2c('0xf'));var authService=require(_0x5a2c('0x10'));var qs=require(_0x5a2c('0x11'));var as=require(_0x5a2c('0x12'));var hardwareService=require(_0x5a2c('0x13'));var logger=require(_0x5a2c('0x14'))(_0x5a2c('0x15'));var utils=require(_0x5a2c('0x16'));var config=require(_0x5a2c('0x17'));var licenseUtil=require(_0x5a2c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165d0d,_0x4a703d){_0x4a703d=_0x4a703d||0xcc;return function(_0x32328f){if(_0x32328f){return _0x165d0d[_0x5a2c('0x19')](_0x4a703d);}return _0x165d0d[_0x5a2c('0x1a')](_0x4a703d)['end']();};}function respondWithResult(_0x1a3728,_0x2056aa){_0x2056aa=_0x2056aa||0xc8;return function(_0x11f621){if(_0x11f621){return _0x1a3728[_0x5a2c('0x1a')](_0x2056aa)['json'](_0x11f621);}};}function respondWithFilteredResult(_0x304402,_0x5837aa){return function(_0x439f6f){if(_0x439f6f){var _0x218d84=typeof _0x5837aa[_0x5a2c('0x1b')]===_0x5a2c('0x1c')&&typeof _0x5837aa[_0x5a2c('0x1d')]===_0x5a2c('0x1c');var _0x2f054d=_0x439f6f[_0x5a2c('0x1e')];var _0x246d99=_0x218d84?0x0:_0x5837aa[_0x5a2c('0x1b')];var _0x51a50a=_0x218d84?_0x439f6f[_0x5a2c('0x1e')]:_0x5837aa[_0x5a2c('0x1b')]+_0x5837aa['limit'];var _0x590a40;if(_0x51a50a>=_0x2f054d){_0x51a50a=_0x2f054d;_0x590a40=0xc8;}else{_0x590a40=0xce;}_0x304402[_0x5a2c('0x1a')](_0x590a40);return _0x304402[_0x5a2c('0x1f')](_0x5a2c('0x20'),_0x246d99+'-'+_0x51a50a+'/'+_0x2f054d)[_0x5a2c('0x21')](_0x439f6f);}return null;};}function patchUpdates(_0x2c133f){return function(_0xbe3f86){try{jsonpatch[_0x5a2c('0x22')](_0xbe3f86,_0x2c133f,!![]);}catch(_0x45a896){return BPromise['reject'](_0x45a896);}return _0xbe3f86[_0x5a2c('0x23')]();};}function saveUpdates(_0x4ef1f6,_0x2efa7e){return function(_0x49b670){if(_0x49b670){return _0x49b670[_0x5a2c('0x24')](_0x4ef1f6)['then'](function(_0x36cf3b){return _0x36cf3b;});}return null;};}function removeEntity(_0x30ff23,_0x2be4e6){return function(_0x55d3e3){if(_0x55d3e3){return _0x55d3e3[_0x5a2c('0x25')]()['then'](function(){_0x30ff23[_0x5a2c('0x1a')](0xcc)[_0x5a2c('0x26')]();});}};}function handleEntityNotFound(_0x22e5be,_0x5b4a22){return function(_0x52a41c){if(!_0x52a41c){_0x22e5be[_0x5a2c('0x19')](0x194);}return _0x52a41c;};}function handleError(_0x26e1c8,_0x534a56){_0x534a56=_0x534a56||0x1f4;return function(_0x6ee48b){logger[_0x5a2c('0x27')](_0x6ee48b[_0x5a2c('0x28')]);if(_0x6ee48b[_0x5a2c('0x29')]){delete _0x6ee48b['name'];}_0x26e1c8[_0x5a2c('0x1a')](_0x534a56)[_0x5a2c('0x2a')](_0x6ee48b);};}exports[_0x5a2c('0x2b')]=function(_0x20e84a,_0x5547e6){var _0xc65d44={},_0x81ef2c={},_0x200b2c={'count':0x0,'rows':[]};var _0x49b113=_[_0x5a2c('0x2c')](db[_0x5a2c('0x2d')][_0x5a2c('0x2e')],function(_0x4d3716){return{'name':_0x4d3716[_0x5a2c('0x2f')],'type':_0x4d3716[_0x5a2c('0x30')][_0x5a2c('0x31')]};});_0x81ef2c[_0x5a2c('0x32')]=_[_0x5a2c('0x2c')](_0x49b113,_0x5a2c('0x29'));_0x81ef2c[_0x5a2c('0x33')]=_[_0x5a2c('0x34')](_0x20e84a[_0x5a2c('0x33')]);_0x81ef2c[_0x5a2c('0x35')]=_[_0x5a2c('0x36')](_0x81ef2c[_0x5a2c('0x32')],_0x81ef2c['query']);_0xc65d44[_0x5a2c('0x37')]=_['intersection'](_0x81ef2c[_0x5a2c('0x32')],qs[_0x5a2c('0x38')](_0x20e84a['query'][_0x5a2c('0x38')]));_0xc65d44[_0x5a2c('0x37')]=_0xc65d44[_0x5a2c('0x37')]['length']?_0xc65d44[_0x5a2c('0x37')]:_0x81ef2c['model'];if(!_0x20e84a[_0x5a2c('0x33')][_0x5a2c('0x39')](_0x5a2c('0x3a'))){_0xc65d44[_0x5a2c('0x1d')]=qs['limit'](_0x20e84a[_0x5a2c('0x33')][_0x5a2c('0x1d')]);_0xc65d44[_0x5a2c('0x1b')]=qs[_0x5a2c('0x1b')](_0x20e84a[_0x5a2c('0x33')]['offset']);}_0xc65d44['order']=qs['sort'](_0x20e84a[_0x5a2c('0x33')][_0x5a2c('0x3b')]);_0xc65d44[_0x5a2c('0x3c')]=qs[_0x5a2c('0x35')](_[_0x5a2c('0x3d')](_0x20e84a[_0x5a2c('0x33')],_0x81ef2c[_0x5a2c('0x35')]),_0x49b113);if(_0x20e84a[_0x5a2c('0x33')][_0x5a2c('0x3e')]){_0xc65d44[_0x5a2c('0x3c')]=_[_0x5a2c('0x3f')](_0xc65d44['where'],{'$or':_['map'](_0x49b113,function(_0x4ed624){if(_0x4ed624[_0x5a2c('0x30')]!==_0x5a2c('0x40')){var _0x5e61c0={};_0x5e61c0[_0x4ed624[_0x5a2c('0x29')]]={'$like':'%'+_0x20e84a[_0x5a2c('0x33')][_0x5a2c('0x3e')]+'%'};return _0x5e61c0;}})});}_0xc65d44=_['merge']({},_0xc65d44,_0x20e84a[_0x5a2c('0x41')]);var _0xda47a1={'where':_0xc65d44['where']};return db[_0x5a2c('0x2d')]['count'](_0xda47a1)[_0x5a2c('0x42')](function(_0x4dcfcb){_0x200b2c['count']=_0x4dcfcb;if(_0x20e84a[_0x5a2c('0x33')][_0x5a2c('0x43')]){_0xc65d44[_0x5a2c('0x44')]=[{'all':!![]}];}return db[_0x5a2c('0x2d')][_0x5a2c('0x45')](_0xc65d44);})[_0x5a2c('0x42')](function(_0xe9aef){_0x200b2c[_0x5a2c('0x46')]=_0xe9aef;return _0x200b2c;})['then'](respondWithFilteredResult(_0x5547e6,_0xc65d44))[_0x5a2c('0x47')](handleError(_0x5547e6,null));};exports[_0x5a2c('0x48')]=function(_0x3d91ac,_0x2a02f3){var _0xa6753c={'raw':![],'where':{'id':_0x3d91ac[_0x5a2c('0x49')]['id']}},_0x351904={};_0x351904[_0x5a2c('0x32')]=_[_0x5a2c('0x34')](db[_0x5a2c('0x2d')]['rawAttributes']);_0x351904['query']=_[_0x5a2c('0x34')](_0x3d91ac[_0x5a2c('0x33')]);_0x351904[_0x5a2c('0x35')]=_[_0x5a2c('0x36')](_0x351904[_0x5a2c('0x32')],_0x351904['query']);_0xa6753c[_0x5a2c('0x37')]=_[_0x5a2c('0x36')](_0x351904['model'],qs['fields'](_0x3d91ac[_0x5a2c('0x33')][_0x5a2c('0x38')]));_0xa6753c[_0x5a2c('0x37')]=_0xa6753c[_0x5a2c('0x37')][_0x5a2c('0x4a')]?_0xa6753c[_0x5a2c('0x37')]:_0x351904[_0x5a2c('0x32')];if(_0x3d91ac[_0x5a2c('0x33')][_0x5a2c('0x43')]){_0xa6753c[_0x5a2c('0x44')]=[{'all':!![]}];}_0xa6753c=_['merge']({},_0xa6753c,_0x3d91ac['options']);return db[_0x5a2c('0x2d')][_0x5a2c('0x4b')](_0xa6753c)[_0x5a2c('0x42')](handleEntityNotFound(_0x2a02f3,null))[_0x5a2c('0x42')](respondWithResult(_0x2a02f3,null))[_0x5a2c('0x47')](handleError(_0x2a02f3,null));};exports[_0x5a2c('0x4c')]=function(_0xb7301,_0x26e90e){return db[_0x5a2c('0x2d')][_0x5a2c('0x4c')](_0xb7301[_0x5a2c('0x4d')],{})['then'](respondWithResult(_0x26e90e,0xc9))[_0x5a2c('0x47')](handleError(_0x26e90e,null));};exports[_0x5a2c('0x24')]=function(_0x4b93ea,_0xa626b6){if(_0x4b93ea[_0x5a2c('0x4d')]['id']){delete _0x4b93ea[_0x5a2c('0x4d')]['id'];}return db[_0x5a2c('0x2d')]['find']({'where':{'id':_0x4b93ea[_0x5a2c('0x49')]['id']}})['then'](handleEntityNotFound(_0xa626b6,null))[_0x5a2c('0x42')](saveUpdates(_0x4b93ea[_0x5a2c('0x4d')],null))[_0x5a2c('0x42')](respondWithResult(_0xa626b6,null))[_0x5a2c('0x47')](handleError(_0xa626b6,null));};exports['destroy']=function(_0x4cf977,_0x22805c){return db[_0x5a2c('0x2d')][_0x5a2c('0x4b')]({'where':{'id':_0x4cf977[_0x5a2c('0x49')]['id']}})[_0x5a2c('0x42')](handleEntityNotFound(_0x22805c,null))[_0x5a2c('0x42')](removeEntity(_0x22805c,null))[_0x5a2c('0x47')](handleError(_0x22805c,null));};exports[_0x5a2c('0x4e')]=function(_0x4b75f3,_0x170e94,_0x1344ed){var _0x1d6571={};var _0x16f778={};var _0x5574c2;var _0x3eaaf5;return db[_0x5a2c('0x2d')]['findOne']({'where':{'id':_0x4b75f3['params']['id']}})[_0x5a2c('0x42')](handleEntityNotFound(_0x170e94,null))['then'](function(_0x8adac3){if(_0x8adac3){_0x5574c2=_0x8adac3;_0x16f778[_0x5a2c('0x32')]=_['keys'](db[_0x5a2c('0x4f')]['rawAttributes']);_0x16f778['query']=_[_0x5a2c('0x34')](_0x4b75f3[_0x5a2c('0x33')]);_0x16f778[_0x5a2c('0x35')]=_[_0x5a2c('0x36')](_0x16f778[_0x5a2c('0x32')],_0x16f778[_0x5a2c('0x33')]);_0x1d6571[_0x5a2c('0x37')]=_[_0x5a2c('0x36')](_0x16f778[_0x5a2c('0x32')],qs[_0x5a2c('0x38')](_0x4b75f3[_0x5a2c('0x33')][_0x5a2c('0x38')]));_0x1d6571[_0x5a2c('0x37')]=_0x1d6571['attributes'][_0x5a2c('0x4a')]?_0x1d6571[_0x5a2c('0x37')]:_0x16f778[_0x5a2c('0x32')];_0x1d6571['order']=qs[_0x5a2c('0x3b')](_0x4b75f3[_0x5a2c('0x33')][_0x5a2c('0x3b')]);_0x1d6571[_0x5a2c('0x3c')]=qs[_0x5a2c('0x35')](_[_0x5a2c('0x3d')](_0x4b75f3[_0x5a2c('0x33')],_0x16f778[_0x5a2c('0x35')]));if(_0x4b75f3[_0x5a2c('0x33')][_0x5a2c('0x3e')]){_0x1d6571[_0x5a2c('0x3c')]=_[_0x5a2c('0x3f')](_0x1d6571['where'],{'$or':_[_0x5a2c('0x2c')](_0x1d6571[_0x5a2c('0x37')],function(_0x5b4b93){var _0x4c153a={};_0x4c153a[_0x5b4b93]={'$like':'%'+_0x4b75f3[_0x5a2c('0x33')][_0x5a2c('0x3e')]+'%'};return _0x4c153a;})});}_0x1d6571=_[_0x5a2c('0x3f')]({},_0x1d6571,_0x4b75f3[_0x5a2c('0x41')]);return _0x5574c2[_0x5a2c('0x4e')](_0x1d6571);}})['then'](function(_0x224561){if(_0x224561){_0x3eaaf5=_0x224561['length'];if(!_0x4b75f3[_0x5a2c('0x33')][_0x5a2c('0x39')]('nolimit')){_0x1d6571[_0x5a2c('0x1d')]=qs[_0x5a2c('0x1d')](_0x4b75f3[_0x5a2c('0x33')][_0x5a2c('0x1d')]);_0x1d6571[_0x5a2c('0x1b')]=qs[_0x5a2c('0x1b')](_0x4b75f3[_0x5a2c('0x33')][_0x5a2c('0x1b')]);}return _0x5574c2[_0x5a2c('0x4e')](_0x1d6571);}})['then'](function(_0xf6c7ca){if(_0xf6c7ca){return _0xf6c7ca?{'count':_0x3eaaf5,'rows':_0xf6c7ca}:null;}})[_0x5a2c('0x42')](respondWithResult(_0x170e94,null))[_0x5a2c('0x47')](handleError(_0x170e94,null));};exports['getDescriptions']=function(_0x5c5d6b,_0x447be2,_0x431179){var _0xbf380={};var _0x15b370={};var _0x87a05;var _0x37a002;return db[_0x5a2c('0x2d')][_0x5a2c('0x50')]({'where':{'id':_0x5c5d6b[_0x5a2c('0x49')]['id']}})[_0x5a2c('0x42')](handleEntityNotFound(_0x447be2,null))[_0x5a2c('0x42')](function(_0x4f7248){if(_0x4f7248){_0x87a05=_0x4f7248;_0x15b370[_0x5a2c('0x32')]=_[_0x5a2c('0x34')](db[_0x5a2c('0x4f')][_0x5a2c('0x2e')]);_0x15b370['query']=_[_0x5a2c('0x34')](_0x5c5d6b[_0x5a2c('0x33')]);_0x15b370['filters']=_[_0x5a2c('0x36')](_0x15b370[_0x5a2c('0x32')],_0x15b370[_0x5a2c('0x33')]);_0xbf380[_0x5a2c('0x37')]=_[_0x5a2c('0x36')](_0x15b370[_0x5a2c('0x32')],qs[_0x5a2c('0x38')](_0x5c5d6b[_0x5a2c('0x33')][_0x5a2c('0x38')]));_0xbf380['attributes']=_0xbf380[_0x5a2c('0x37')]['length']?_0xbf380['attributes']:_0x15b370[_0x5a2c('0x32')];_0xbf380[_0x5a2c('0x51')]=qs[_0x5a2c('0x3b')](_0x5c5d6b[_0x5a2c('0x33')][_0x5a2c('0x3b')]);_0xbf380['where']=qs['filters'](_[_0x5a2c('0x3d')](_0x5c5d6b[_0x5a2c('0x33')],_0x15b370[_0x5a2c('0x35')]));if(_0x5c5d6b[_0x5a2c('0x33')]['filter']){_0xbf380[_0x5a2c('0x3c')]=_[_0x5a2c('0x3f')](_0xbf380['where'],{'$or':_[_0x5a2c('0x2c')](_0xbf380['attributes'],function(_0x405597){var _0x41f5a0={};_0x41f5a0[_0x405597]={'$like':'%'+_0x5c5d6b['query'][_0x5a2c('0x3e')]+'%'};return _0x41f5a0;})});}_0xbf380=_[_0x5a2c('0x3f')]({},_0xbf380,_0x5c5d6b[_0x5a2c('0x41')]);return _0x87a05['getDescriptions'](_0xbf380);}})[_0x5a2c('0x42')](function(_0x472eb4){if(_0x472eb4){_0x37a002=_0x472eb4[_0x5a2c('0x4a')];if(!_0x5c5d6b[_0x5a2c('0x33')][_0x5a2c('0x39')](_0x5a2c('0x3a'))){_0xbf380[_0x5a2c('0x1d')]=qs[_0x5a2c('0x1d')](_0x5c5d6b[_0x5a2c('0x33')][_0x5a2c('0x1d')]);_0xbf380['offset']=qs[_0x5a2c('0x1b')](_0x5c5d6b[_0x5a2c('0x33')][_0x5a2c('0x1b')]);}return _0x87a05[_0x5a2c('0x52')](_0xbf380);}})['then'](function(_0x141973){if(_0x141973){return _0x141973?{'count':_0x37a002,'rows':_0x141973}:null;}})[_0x5a2c('0x42')](respondWithResult(_0x447be2,null))['catch'](handleError(_0x447be2,null));};exports['getFields']=function(_0x10fcd0,_0x37dc87,_0x8c8a1){var _0x194352={};var _0x17fc36={};var _0x1170cd;var _0x5ba7b0;return db[_0x5a2c('0x2d')]['findOne']({'where':{'id':_0x10fcd0[_0x5a2c('0x49')]['id']}})[_0x5a2c('0x42')](handleEntityNotFound(_0x37dc87,null))[_0x5a2c('0x42')](function(_0x11602a){if(_0x11602a){_0x1170cd=_0x11602a;_0x17fc36[_0x5a2c('0x32')]=_[_0x5a2c('0x34')](db[_0x5a2c('0x4f')][_0x5a2c('0x2e')]);_0x17fc36[_0x5a2c('0x33')]=_[_0x5a2c('0x34')](_0x10fcd0[_0x5a2c('0x33')]);_0x17fc36[_0x5a2c('0x35')]=_[_0x5a2c('0x36')](_0x17fc36[_0x5a2c('0x32')],_0x17fc36[_0x5a2c('0x33')]);_0x194352['attributes']=_['intersection'](_0x17fc36[_0x5a2c('0x32')],qs[_0x5a2c('0x38')](_0x10fcd0[_0x5a2c('0x33')][_0x5a2c('0x38')]));_0x194352['attributes']=_0x194352[_0x5a2c('0x37')][_0x5a2c('0x4a')]?_0x194352['attributes']:_0x17fc36[_0x5a2c('0x32')];_0x194352[_0x5a2c('0x51')]=qs[_0x5a2c('0x3b')](_0x10fcd0['query'][_0x5a2c('0x3b')]);_0x194352[_0x5a2c('0x3c')]=qs[_0x5a2c('0x35')](_[_0x5a2c('0x3d')](_0x10fcd0[_0x5a2c('0x33')],_0x17fc36[_0x5a2c('0x35')]));if(_0x10fcd0[_0x5a2c('0x33')][_0x5a2c('0x3e')]){_0x194352['where']=_[_0x5a2c('0x3f')](_0x194352[_0x5a2c('0x3c')],{'$or':_[_0x5a2c('0x2c')](_0x194352['attributes'],function(_0x42a144){var _0x50f212={};_0x50f212[_0x42a144]={'$like':'%'+_0x10fcd0[_0x5a2c('0x33')][_0x5a2c('0x3e')]+'%'};return _0x50f212;})});}_0x194352=_[_0x5a2c('0x3f')]({},_0x194352,_0x10fcd0[_0x5a2c('0x41')]);return _0x1170cd['getFields'](_0x194352);}})['then'](function(_0x374264){if(_0x374264){_0x5ba7b0=_0x374264['length'];if(!_0x10fcd0['query'][_0x5a2c('0x39')](_0x5a2c('0x3a'))){_0x194352[_0x5a2c('0x1d')]=qs[_0x5a2c('0x1d')](_0x10fcd0['query'][_0x5a2c('0x1d')]);_0x194352[_0x5a2c('0x1b')]=qs[_0x5a2c('0x1b')](_0x10fcd0[_0x5a2c('0x33')][_0x5a2c('0x1b')]);}return _0x1170cd[_0x5a2c('0x53')](_0x194352);}})['then'](function(_0x4af99d){if(_0x4af99d){return _0x4af99d?{'count':_0x5ba7b0,'rows':_0x4af99d}:null;}})[_0x5a2c('0x42')](respondWithResult(_0x37dc87,null))[_0x5a2c('0x47')](handleError(_0x37dc87,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 067d8e9..335282f 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 _0x4c5c=['int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x4c5c,0x199));var _0xc4c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc4c5('0x0'));var logger=require(_0xc4c5('0x1'))(_0xc4c5('0x2'));var moment=require(_0xc4c5('0x3'));var BPromise=require(_0xc4c5('0x4'));var rp=require(_0xc4c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4c5('0x6'));var config=require(_0xc4c5('0x7'));var attributes=require(_0xc4c5('0x8'));module['exports']=function(_0x482533,_0x8f42af){return _0x482533[_0xc4c5('0x9')](_0xc4c5('0xa'),attributes,{'tableName':_0xc4c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48a4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x18137b,_0x512d65){var _0x5c0abd=function(_0xc758b3){while(--_0xc758b3){_0x18137b['push'](_0x18137b['shift']());}};_0x5c0abd(++_0x512d65);}(_0x48a4,0x178));var _0x448a=function(_0x5af0d8,_0x458434){_0x5af0d8=_0x5af0d8-0x0;var _0x4db230=_0x48a4[_0x5af0d8];return _0x4db230;};'use strict';var _=require(_0x448a('0x0'));var util=require(_0x448a('0x1'));var logger=require(_0x448a('0x2'))(_0x448a('0x3'));var moment=require(_0x448a('0x4'));var BPromise=require(_0x448a('0x5'));var rp=require(_0x448a('0x6'));var fs=require('fs');var path=require(_0x448a('0x7'));var rimraf=require(_0x448a('0x8'));var config=require(_0x448a('0x9'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x5f3d8d,_0x1bb389){return _0x5f3d8d[_0x448a('0xa')](_0x448a('0xb'),attributes,{'tableName':_0x448a('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 4c2d9f1..faa2075 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 _0x78ea=['FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x18c929,_0x212835){var _0x509845=function(_0x6294b6){while(--_0x6294b6){_0x18c929['push'](_0x18c929['shift']());}};_0x509845(++_0x212835);}(_0x78ea,0x76));var _0xa78e=function(_0x1ed388,_0x4c1474){_0x1ed388=_0x1ed388-0x0;var _0x356c7f=_0x78ea[_0x1ed388];return _0x356c7f;};'use strict';var _=require(_0xa78e('0x0'));var util=require(_0xa78e('0x1'));var moment=require(_0xa78e('0x2'));var BPromise=require(_0xa78e('0x3'));var rs=require(_0xa78e('0x4'));var fs=require('fs');var Redis=require(_0xa78e('0x5'));var db=require(_0xa78e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa78e('0x7'))('rpc');var config=require(_0xa78e('0x8'));var jayson=require(_0xa78e('0x9'));var client=jayson[_0xa78e('0xa')][_0xa78e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36db57,_0x42f15b,_0x13d39a){return new BPromise(function(_0x34d76b,_0xeaf6f9){return client['request'](_0x36db57,_0x13d39a)[_0xa78e('0xc')](function(_0x53a2c3){logger[_0xa78e('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x42f15b,_0xa78e('0xe'));logger['debug'](_0xa78e('0xf'),_0x42f15b,_0xa78e('0xe'),JSON[_0xa78e('0x10')](_0x53a2c3));if(_0x53a2c3[_0xa78e('0x11')]){if(_0x53a2c3[_0xa78e('0x11')][_0xa78e('0x12')]===0x1f4){logger[_0xa78e('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x42f15b,_0x53a2c3[_0xa78e('0x11')][_0xa78e('0x13')]);return _0xeaf6f9(_0x53a2c3['error'][_0xa78e('0x13')]);}logger['error'](_0xa78e('0x14'),_0x42f15b,_0x53a2c3[_0xa78e('0x11')][_0xa78e('0x13')]);return _0x34d76b(_0x53a2c3[_0xa78e('0x11')][_0xa78e('0x13')]);}else{logger['info'](_0xa78e('0x14'),_0x42f15b,_0xa78e('0xe'));_0x34d76b(_0x53a2c3[_0xa78e('0x15')][_0xa78e('0x13')]);}})[_0xa78e('0x16')](function(_0x44b9c5){logger['error'](_0xa78e('0x14'),_0x42f15b,_0x44b9c5);_0xeaf6f9(_0x44b9c5);});});} \ No newline at end of file +var _0x0b5b=['code','error','message','info','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x311e77,_0x49a459){var _0x559c54=function(_0x283a97){while(--_0x283a97){_0x311e77['push'](_0x311e77['shift']());}};_0x559c54(++_0x49a459);}(_0x0b5b,0x1d3));var _0xb0b5=function(_0x40c3e4,_0x455773){_0x40c3e4=_0x40c3e4-0x0;var _0x23a374=_0x0b5b[_0x40c3e4];return _0x23a374;};'use strict';var _=require(_0xb0b5('0x0'));var util=require(_0xb0b5('0x1'));var moment=require('moment');var BPromise=require(_0xb0b5('0x2'));var rs=require(_0xb0b5('0x3'));var fs=require('fs');var Redis=require(_0xb0b5('0x4'));var db=require(_0xb0b5('0x5'))['db'];var utils=require(_0xb0b5('0x6'));var logger=require(_0xb0b5('0x7'))(_0xb0b5('0x8'));var config=require(_0xb0b5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb0b5('0xa')][_0xb0b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21fa12,_0x564057,_0x188997){return new BPromise(function(_0x490abd,_0x4f9243){return client[_0xb0b5('0xc')](_0x21fa12,_0x188997)['then'](function(_0x5def69){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x564057,'request\x20sent');logger[_0xb0b5('0xd')](_0xb0b5('0xe'),_0x564057,_0xb0b5('0xf'),JSON['stringify'](_0x5def69));if(_0x5def69['error']){if(_0x5def69['error'][_0xb0b5('0x10')]===0x1f4){logger[_0xb0b5('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x564057,_0x5def69['error']['message']);return _0x4f9243(_0x5def69['error']['message']);}logger[_0xb0b5('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x564057,_0x5def69[_0xb0b5('0x11')][_0xb0b5('0x12')]);return _0x490abd(_0x5def69[_0xb0b5('0x11')][_0xb0b5('0x12')]);}else{logger[_0xb0b5('0x13')](_0xb0b5('0x14'),_0x564057,_0xb0b5('0xf'));_0x490abd(_0x5def69[_0xb0b5('0x15')][_0xb0b5('0x12')]);}})[_0xb0b5('0x16')](function(_0x335c6e){logger[_0xb0b5('0x11')](_0xb0b5('0x14'),_0x564057,_0x335c6e);_0x4f9243(_0x335c6e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8665e01..7e8905c 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 _0x18e0=['get','isAuthenticated','/:id','post','create','put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesField.controller'];(function(_0x29c706,_0x328244){var _0x3ca004=function(_0x1fd177){while(--_0x1fd177){_0x29c706['push'](_0x29c706['shift']());}};_0x3ca004(++_0x328244);}(_0x18e0,0xa2));var _0x018e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x18e0[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0x018e('0x0'));var path=require('path');var timeout=require(_0x018e('0x1'));var express=require(_0x018e('0x2'));var router=express[_0x018e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x018e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x018e('0x5'));router[_0x018e('0x6')]('/',auth[_0x018e('0x7')](),controller['index']);router['get'](_0x018e('0x8'),auth[_0x018e('0x7')](),controller['show']);router[_0x018e('0x9')]('/',auth[_0x018e('0x7')](),controller[_0x018e('0xa')]);router[_0x018e('0xb')](_0x018e('0x8'),auth[_0x018e('0x7')](),controller['update']);router[_0x018e('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x018e('0xd')]=router; \ No newline at end of file +var _0x98e5=['fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','put','update','exports','connect-timeout','express'];(function(_0x2acc16,_0x17ed11){var _0x3006d1=function(_0xd19e1f){while(--_0xd19e1f){_0x2acc16['push'](_0x2acc16['shift']());}};_0x3006d1(++_0x17ed11);}(_0x98e5,0x8a));var _0x598e=function(_0x246975,_0x3d67c6){_0x246975=_0x246975-0x0;var _0x2bf78c=_0x98e5[_0x246975];return _0x2bf78c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x598e('0x0'));var express=require(_0x598e('0x1'));var router=express['Router']();var fs_extra=require(_0x598e('0x2'));var auth=require(_0x598e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x598e('0x4'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x598e('0x5')](),controller['index']);router[_0x598e('0x6')](_0x598e('0x7'),auth[_0x598e('0x5')](),controller[_0x598e('0x8')]);router[_0x598e('0x9')]('/',auth[_0x598e('0x5')](),controller[_0x598e('0xa')]);router[_0x598e('0xb')](_0x598e('0x7'),auth[_0x598e('0x5')](),controller[_0x598e('0xc')]);router['delete'](_0x598e('0x7'),auth[_0x598e('0x5')](),controller['destroy']);module[_0x598e('0xd')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f75763b..ff17c7c 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 _0xe150=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x55697f,_0x314fb6){var _0x1fc10c=function(_0x280a80){while(--_0x280a80){_0x55697f['push'](_0x55697f['shift']());}};_0x1fc10c(++_0x314fb6);}(_0xe150,0x131));var _0x0e15=function(_0xc3db1e,_0x50d9cc){_0xc3db1e=_0xc3db1e-0x0;var _0x56db8a=_0xe150[_0xc3db1e];return _0x56db8a;};'use strict';var Sequelize=require(_0x0e15('0x0'));module[_0x0e15('0x1')]={'type':{'type':Sequelize[_0x0e15('0x2')](_0x0e15('0x3'),_0x0e15('0x4'),_0x0e15('0x5'),_0x0e15('0x6'),_0x0e15('0x7')),'defaultValue':_0x0e15('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0e15('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x0e15('0x3'),_0x0e15('0x4'),_0x0e15('0x5'))},'keyContent':{'type':Sequelize[_0x0e15('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0e15('0x8')]},'customField':{'type':Sequelize[_0x0e15('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e15('0x8')]}}; \ No newline at end of file +var _0x3a33=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x1ef8ae,_0x4bf747){var _0x20d8eb=function(_0x4cd16d){while(--_0x4cd16d){_0x1ef8ae['push'](_0x1ef8ae['shift']());}};_0x20d8eb(++_0x4bf747);}(_0x3a33,0xd8));var _0x33a3=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3a33[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x33a3('0x0'));module[_0x33a3('0x1')]={'type':{'type':Sequelize[_0x33a3('0x2')](_0x33a3('0x3'),'variable',_0x33a3('0x4'),_0x33a3('0x5'),'picklist'),'defaultValue':_0x33a3('0x3')},'content':{'type':Sequelize[_0x33a3('0x6')]},'key':{'type':Sequelize[_0x33a3('0x6')]},'keyType':{'type':Sequelize[_0x33a3('0x2')](_0x33a3('0x3'),_0x33a3('0x7'),_0x33a3('0x4'))},'keyContent':{'type':Sequelize[_0x33a3('0x6')]},'idField':{'type':Sequelize[_0x33a3('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x33a3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d17dd72..06bddc4 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 _0x738a=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','reject','save','then','destroy','sendStatus','error','stack','name','send','index','FreshsalesField','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x5684d7,_0x188b18){var _0x25570d=function(_0x1e0fd3){while(--_0x1e0fd3){_0x5684d7['push'](_0x5684d7['shift']());}};_0x25570d(++_0x188b18);}(_0x738a,0x172));var _0xa738=function(_0x21a1a6,_0x1474bf){_0x21a1a6=_0x21a1a6-0x0;var _0x5cec0e=_0x738a[_0x21a1a6];return _0x5cec0e;};'use strict';var emlformat=require(_0xa738('0x0'));var rimraf=require(_0xa738('0x1'));var zipdir=require(_0xa738('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa738('0x3'));var moment=require(_0xa738('0x4'));var BPromise=require(_0xa738('0x5'));var Mustache=require(_0xa738('0x6'));var util=require(_0xa738('0x7'));var path=require(_0xa738('0x8'));var sox=require(_0xa738('0x9'));var csv=require(_0xa738('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa738('0xb'));var squel=require(_0xa738('0xc'));var crypto=require(_0xa738('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa738('0xa'));var querystring=require(_0xa738('0xe'));var Papa=require(_0xa738('0xf'));var Redis=require(_0xa738('0x10'));var authService=require(_0xa738('0x11'));var qs=require(_0xa738('0x12'));var as=require(_0xa738('0x13'));var hardwareService=require(_0xa738('0x14'));var logger=require(_0xa738('0x15'))(_0xa738('0x16'));var utils=require(_0xa738('0x17'));var config=require(_0xa738('0x18'));var licenseUtil=require(_0xa738('0x19'));var db=require(_0xa738('0x1a'))['db'];function respondWithStatusCode(_0x1358c5,_0x2d1ec2){_0x2d1ec2=_0x2d1ec2||0xcc;return function(_0x476356){if(_0x476356){return _0x1358c5['sendStatus'](_0x2d1ec2);}return _0x1358c5[_0xa738('0x1b')](_0x2d1ec2)[_0xa738('0x1c')]();};}function respondWithResult(_0x19e58f,_0x16ffd3){_0x16ffd3=_0x16ffd3||0xc8;return function(_0x45b9f6){if(_0x45b9f6){return _0x19e58f['status'](_0x16ffd3)[_0xa738('0x1d')](_0x45b9f6);}};}function respondWithFilteredResult(_0x3c4881,_0x39180e){return function(_0x5b4c5c){if(_0x5b4c5c){var _0x25b7b8=typeof _0x39180e['offset']==='undefined'&&typeof _0x39180e[_0xa738('0x1e')]==='undefined';var _0x47f16e=_0x5b4c5c[_0xa738('0x1f')];var _0xee3e62=_0x25b7b8?0x0:_0x39180e[_0xa738('0x20')];var _0x440770=_0x25b7b8?_0x5b4c5c['count']:_0x39180e[_0xa738('0x20')]+_0x39180e[_0xa738('0x1e')];var _0x408725;if(_0x440770>=_0x47f16e){_0x440770=_0x47f16e;_0x408725=0xc8;}else{_0x408725=0xce;}_0x3c4881[_0xa738('0x1b')](_0x408725);return _0x3c4881[_0xa738('0x21')]('Content-Range',_0xee3e62+'-'+_0x440770+'/'+_0x47f16e)['json'](_0x5b4c5c);}return null;};}function patchUpdates(_0x310699){return function(_0x1ec5a5){try{jsonpatch['apply'](_0x1ec5a5,_0x310699,!![]);}catch(_0x46d64b){return BPromise[_0xa738('0x22')](_0x46d64b);}return _0x1ec5a5[_0xa738('0x23')]();};}function saveUpdates(_0x4f1c58,_0x447457){return function(_0x559efd){if(_0x559efd){return _0x559efd['update'](_0x4f1c58)[_0xa738('0x24')](function(_0x405734){return _0x405734;});}return null;};}function removeEntity(_0x303a43,_0x29317c){return function(_0x2c4d4c){if(_0x2c4d4c){return _0x2c4d4c[_0xa738('0x25')]()[_0xa738('0x24')](function(){_0x303a43['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x379007,_0x3b12a9){return function(_0xd423ee){if(!_0xd423ee){_0x379007[_0xa738('0x26')](0x194);}return _0xd423ee;};}function handleError(_0x29c09c,_0x24fd24){_0x24fd24=_0x24fd24||0x1f4;return function(_0x39c27c){logger[_0xa738('0x27')](_0x39c27c[_0xa738('0x28')]);if(_0x39c27c[_0xa738('0x29')]){delete _0x39c27c[_0xa738('0x29')];}_0x29c09c[_0xa738('0x1b')](_0x24fd24)[_0xa738('0x2a')](_0x39c27c);};}exports[_0xa738('0x2b')]=function(_0x4dd062,_0x23406c){var _0x5b6ba3={},_0x32ab31={},_0x1def59={'count':0x0,'rows':[]};var _0x211264=_['map'](db[_0xa738('0x2c')]['rawAttributes'],function(_0x426bf2){return{'name':_0x426bf2[_0xa738('0x2d')],'type':_0x426bf2['type']['key']};});_0x32ab31[_0xa738('0x2e')]=_[_0xa738('0x2f')](_0x211264,_0xa738('0x29'));_0x32ab31['query']=_[_0xa738('0x30')](_0x4dd062[_0xa738('0x31')]);_0x32ab31[_0xa738('0x32')]=_[_0xa738('0x33')](_0x32ab31[_0xa738('0x2e')],_0x32ab31[_0xa738('0x31')]);_0x5b6ba3[_0xa738('0x34')]=_[_0xa738('0x33')](_0x32ab31[_0xa738('0x2e')],qs[_0xa738('0x35')](_0x4dd062['query'][_0xa738('0x35')]));_0x5b6ba3['attributes']=_0x5b6ba3['attributes'][_0xa738('0x36')]?_0x5b6ba3[_0xa738('0x34')]:_0x32ab31[_0xa738('0x2e')];if(!_0x4dd062[_0xa738('0x31')]['hasOwnProperty'](_0xa738('0x37'))){_0x5b6ba3[_0xa738('0x1e')]=qs[_0xa738('0x1e')](_0x4dd062[_0xa738('0x31')]['limit']);_0x5b6ba3[_0xa738('0x20')]=qs[_0xa738('0x20')](_0x4dd062['query'][_0xa738('0x20')]);}_0x5b6ba3[_0xa738('0x38')]=qs[_0xa738('0x39')](_0x4dd062[_0xa738('0x31')][_0xa738('0x39')]);_0x5b6ba3['where']=qs[_0xa738('0x32')](_['pick'](_0x4dd062['query'],_0x32ab31[_0xa738('0x32')]),_0x211264);if(_0x4dd062[_0xa738('0x31')][_0xa738('0x3a')]){_0x5b6ba3[_0xa738('0x3b')]=_['merge'](_0x5b6ba3[_0xa738('0x3b')],{'$or':_[_0xa738('0x2f')](_0x211264,function(_0x162cf4){if(_0x162cf4[_0xa738('0x3c')]!==_0xa738('0x3d')){var _0x4b6e8f={};_0x4b6e8f[_0x162cf4[_0xa738('0x29')]]={'$like':'%'+_0x4dd062[_0xa738('0x31')][_0xa738('0x3a')]+'%'};return _0x4b6e8f;}})});}_0x5b6ba3=_['merge']({},_0x5b6ba3,_0x4dd062[_0xa738('0x3e')]);var _0x1a8469={'where':_0x5b6ba3['where']};return db['FreshsalesField'][_0xa738('0x1f')](_0x1a8469)[_0xa738('0x24')](function(_0x42edf0){_0x1def59[_0xa738('0x1f')]=_0x42edf0;if(_0x4dd062['query'][_0xa738('0x3f')]){_0x5b6ba3[_0xa738('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0xa738('0x41')](_0x5b6ba3);})['then'](function(_0x35b87b){_0x1def59['rows']=_0x35b87b;return _0x1def59;})[_0xa738('0x24')](respondWithFilteredResult(_0x23406c,_0x5b6ba3))[_0xa738('0x42')](handleError(_0x23406c,null));};exports[_0xa738('0x43')]=function(_0x2a2085,_0x27a081){var _0x104d75={'raw':!![],'where':{'id':_0x2a2085[_0xa738('0x44')]['id']}},_0x172e8f={};_0x172e8f[_0xa738('0x2e')]=_['keys'](db['FreshsalesField'][_0xa738('0x45')]);_0x172e8f[_0xa738('0x31')]=_[_0xa738('0x30')](_0x2a2085['query']);_0x172e8f[_0xa738('0x32')]=_[_0xa738('0x33')](_0x172e8f[_0xa738('0x2e')],_0x172e8f[_0xa738('0x31')]);_0x104d75[_0xa738('0x34')]=_['intersection'](_0x172e8f['model'],qs[_0xa738('0x35')](_0x2a2085[_0xa738('0x31')][_0xa738('0x35')]));_0x104d75['attributes']=_0x104d75['attributes'][_0xa738('0x36')]?_0x104d75['attributes']:_0x172e8f['model'];if(_0x2a2085['query'][_0xa738('0x3f')]){_0x104d75[_0xa738('0x40')]=[{'all':!![]}];}_0x104d75=_[_0xa738('0x46')]({},_0x104d75,_0x2a2085[_0xa738('0x3e')]);return db[_0xa738('0x2c')][_0xa738('0x47')](_0x104d75)[_0xa738('0x24')](handleEntityNotFound(_0x27a081,null))[_0xa738('0x24')](respondWithResult(_0x27a081,null))[_0xa738('0x42')](handleError(_0x27a081,null));};exports[_0xa738('0x48')]=function(_0xb11a44,_0x4a19c9){return db[_0xa738('0x2c')]['create'](_0xb11a44['body'],{})[_0xa738('0x24')](respondWithResult(_0x4a19c9,0xc9))[_0xa738('0x42')](handleError(_0x4a19c9,null));};exports[_0xa738('0x49')]=function(_0x590492,_0x5d3408){if(_0x590492[_0xa738('0x4a')]['id']){delete _0x590492[_0xa738('0x4a')]['id'];}return db[_0xa738('0x2c')][_0xa738('0x47')]({'where':{'id':_0x590492[_0xa738('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d3408,null))[_0xa738('0x24')](saveUpdates(_0x590492['body'],null))[_0xa738('0x24')](respondWithResult(_0x5d3408,null))[_0xa738('0x42')](handleError(_0x5d3408,null));};exports[_0xa738('0x25')]=function(_0x3f3599,_0x52fefc){return db[_0xa738('0x2c')][_0xa738('0x47')]({'where':{'id':_0x3f3599[_0xa738('0x44')]['id']}})[_0xa738('0x24')](handleEntityNotFound(_0x52fefc,null))['then'](removeEntity(_0x52fefc,null))[_0xa738('0x42')](handleError(_0x52fefc,null));}; \ No newline at end of file +var _0x6a4c=['request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','rimraf','zip-dir','fast-json-patch'];(function(_0x38441d,_0x12e5f5){var _0x23c0a0=function(_0xa360c8){while(--_0xa360c8){_0x38441d['push'](_0x38441d['shift']());}};_0x23c0a0(++_0x12e5f5);}(_0x6a4c,0x91));var _0xc6a4=function(_0x1ffa9a,_0x2ad861){_0x1ffa9a=_0x1ffa9a-0x0;var _0x51d786=_0x6a4c[_0x1ffa9a];return _0x51d786;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6a4('0x0'));var zipdir=require(_0xc6a4('0x1'));var jsonpatch=require(_0xc6a4('0x2'));var rp=require(_0xc6a4('0x3'));var moment=require(_0xc6a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc6a4('0x5'));var util=require(_0xc6a4('0x6'));var path=require(_0xc6a4('0x7'));var sox=require('sox');var csv=require(_0xc6a4('0x8'));var ejs=require(_0xc6a4('0x9'));var fs=require('fs');var fs_extra=require(_0xc6a4('0xa'));var _=require('lodash');var squel=require(_0xc6a4('0xb'));var crypto=require(_0xc6a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc6a4('0xd'));var toCsv=require(_0xc6a4('0x8'));var querystring=require(_0xc6a4('0xe'));var Papa=require(_0xc6a4('0xf'));var Redis=require(_0xc6a4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc6a4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6a4('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc6a4('0x13'));var config=require(_0xc6a4('0x14'));var licenseUtil=require(_0xc6a4('0x15'));var db=require(_0xc6a4('0x16'))['db'];function respondWithStatusCode(_0x2f3047,_0x3dd657){_0x3dd657=_0x3dd657||0xcc;return function(_0x1a4a6a){if(_0x1a4a6a){return _0x2f3047[_0xc6a4('0x17')](_0x3dd657);}return _0x2f3047[_0xc6a4('0x18')](_0x3dd657)[_0xc6a4('0x19')]();};}function respondWithResult(_0x2a9955,_0x50e4c2){_0x50e4c2=_0x50e4c2||0xc8;return function(_0x148e25){if(_0x148e25){return _0x2a9955[_0xc6a4('0x18')](_0x50e4c2)[_0xc6a4('0x1a')](_0x148e25);}};}function respondWithFilteredResult(_0xdd74e1,_0x16feb8){return function(_0x4a4869){if(_0x4a4869){var _0x3030bb=typeof _0x16feb8['offset']===_0xc6a4('0x1b')&&typeof _0x16feb8[_0xc6a4('0x1c')]===_0xc6a4('0x1b');var _0xc89b8e=_0x4a4869[_0xc6a4('0x1d')];var _0x46dd71=_0x3030bb?0x0:_0x16feb8[_0xc6a4('0x1e')];var _0x3815bc=_0x3030bb?_0x4a4869['count']:_0x16feb8['offset']+_0x16feb8['limit'];var _0x35c26c;if(_0x3815bc>=_0xc89b8e){_0x3815bc=_0xc89b8e;_0x35c26c=0xc8;}else{_0x35c26c=0xce;}_0xdd74e1[_0xc6a4('0x18')](_0x35c26c);return _0xdd74e1[_0xc6a4('0x1f')](_0xc6a4('0x20'),_0x46dd71+'-'+_0x3815bc+'/'+_0xc89b8e)['json'](_0x4a4869);}return null;};}function patchUpdates(_0x1c5f26){return function(_0x39ceba){try{jsonpatch[_0xc6a4('0x21')](_0x39ceba,_0x1c5f26,!![]);}catch(_0x543d85){return BPromise['reject'](_0x543d85);}return _0x39ceba[_0xc6a4('0x22')]();};}function saveUpdates(_0x3fb676,_0x289e61){return function(_0x2843ec){if(_0x2843ec){return _0x2843ec['update'](_0x3fb676)['then'](function(_0x4d56d1){return _0x4d56d1;});}return null;};}function removeEntity(_0x440382,_0x506452){return function(_0x150254){if(_0x150254){return _0x150254[_0xc6a4('0x23')]()[_0xc6a4('0x24')](function(){_0x440382[_0xc6a4('0x18')](0xcc)[_0xc6a4('0x19')]();});}};}function handleEntityNotFound(_0x4fb390,_0x4d12cd){return function(_0x1355a5){if(!_0x1355a5){_0x4fb390[_0xc6a4('0x17')](0x194);}return _0x1355a5;};}function handleError(_0x5161e7,_0x1cd72e){_0x1cd72e=_0x1cd72e||0x1f4;return function(_0x59ec0d){logger[_0xc6a4('0x25')](_0x59ec0d[_0xc6a4('0x26')]);if(_0x59ec0d[_0xc6a4('0x27')]){delete _0x59ec0d['name'];}_0x5161e7[_0xc6a4('0x18')](_0x1cd72e)[_0xc6a4('0x28')](_0x59ec0d);};}exports['index']=function(_0xfb9c13,_0x4c9c78){var _0x548517={},_0x48bdc4={},_0x4a09a8={'count':0x0,'rows':[]};var _0x5870fa=_[_0xc6a4('0x29')](db['FreshsalesField'][_0xc6a4('0x2a')],function(_0x55919f){return{'name':_0x55919f[_0xc6a4('0x2b')],'type':_0x55919f[_0xc6a4('0x2c')]['key']};});_0x48bdc4[_0xc6a4('0x2d')]=_[_0xc6a4('0x29')](_0x5870fa,_0xc6a4('0x27'));_0x48bdc4[_0xc6a4('0x2e')]=_[_0xc6a4('0x2f')](_0xfb9c13[_0xc6a4('0x2e')]);_0x48bdc4['filters']=_[_0xc6a4('0x30')](_0x48bdc4[_0xc6a4('0x2d')],_0x48bdc4['query']);_0x548517[_0xc6a4('0x31')]=_[_0xc6a4('0x30')](_0x48bdc4[_0xc6a4('0x2d')],qs['fields'](_0xfb9c13[_0xc6a4('0x2e')][_0xc6a4('0x32')]));_0x548517[_0xc6a4('0x31')]=_0x548517['attributes']['length']?_0x548517['attributes']:_0x48bdc4[_0xc6a4('0x2d')];if(!_0xfb9c13[_0xc6a4('0x2e')][_0xc6a4('0x33')](_0xc6a4('0x34'))){_0x548517[_0xc6a4('0x1c')]=qs[_0xc6a4('0x1c')](_0xfb9c13['query'][_0xc6a4('0x1c')]);_0x548517[_0xc6a4('0x1e')]=qs[_0xc6a4('0x1e')](_0xfb9c13['query'][_0xc6a4('0x1e')]);}_0x548517['order']=qs[_0xc6a4('0x35')](_0xfb9c13['query'][_0xc6a4('0x35')]);_0x548517[_0xc6a4('0x36')]=qs[_0xc6a4('0x37')](_[_0xc6a4('0x38')](_0xfb9c13[_0xc6a4('0x2e')],_0x48bdc4[_0xc6a4('0x37')]),_0x5870fa);if(_0xfb9c13[_0xc6a4('0x2e')]['filter']){_0x548517[_0xc6a4('0x36')]=_[_0xc6a4('0x39')](_0x548517['where'],{'$or':_[_0xc6a4('0x29')](_0x5870fa,function(_0x47730e){if(_0x47730e[_0xc6a4('0x2c')]!==_0xc6a4('0x3a')){var _0x111643={};_0x111643[_0x47730e[_0xc6a4('0x27')]]={'$like':'%'+_0xfb9c13[_0xc6a4('0x2e')][_0xc6a4('0x3b')]+'%'};return _0x111643;}})});}_0x548517=_[_0xc6a4('0x39')]({},_0x548517,_0xfb9c13[_0xc6a4('0x3c')]);var _0x2e5b85={'where':_0x548517[_0xc6a4('0x36')]};return db[_0xc6a4('0x3d')][_0xc6a4('0x1d')](_0x2e5b85)[_0xc6a4('0x24')](function(_0x33eb25){_0x4a09a8[_0xc6a4('0x1d')]=_0x33eb25;if(_0xfb9c13[_0xc6a4('0x2e')][_0xc6a4('0x3e')]){_0x548517[_0xc6a4('0x3f')]=[{'all':!![]}];}return db[_0xc6a4('0x3d')][_0xc6a4('0x40')](_0x548517);})[_0xc6a4('0x24')](function(_0x152145){_0x4a09a8[_0xc6a4('0x41')]=_0x152145;return _0x4a09a8;})[_0xc6a4('0x24')](respondWithFilteredResult(_0x4c9c78,_0x548517))[_0xc6a4('0x42')](handleError(_0x4c9c78,null));};exports[_0xc6a4('0x43')]=function(_0x54d3ee,_0x42915d){var _0x48fd0a={'raw':!![],'where':{'id':_0x54d3ee['params']['id']}},_0x4a7542={};_0x4a7542[_0xc6a4('0x2d')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x4a7542[_0xc6a4('0x2e')]=_[_0xc6a4('0x2f')](_0x54d3ee[_0xc6a4('0x2e')]);_0x4a7542[_0xc6a4('0x37')]=_[_0xc6a4('0x30')](_0x4a7542['model'],_0x4a7542[_0xc6a4('0x2e')]);_0x48fd0a['attributes']=_[_0xc6a4('0x30')](_0x4a7542[_0xc6a4('0x2d')],qs[_0xc6a4('0x32')](_0x54d3ee[_0xc6a4('0x2e')][_0xc6a4('0x32')]));_0x48fd0a[_0xc6a4('0x31')]=_0x48fd0a[_0xc6a4('0x31')][_0xc6a4('0x44')]?_0x48fd0a[_0xc6a4('0x31')]:_0x4a7542[_0xc6a4('0x2d')];if(_0x54d3ee[_0xc6a4('0x2e')][_0xc6a4('0x3e')]){_0x48fd0a[_0xc6a4('0x3f')]=[{'all':!![]}];}_0x48fd0a=_[_0xc6a4('0x39')]({},_0x48fd0a,_0x54d3ee[_0xc6a4('0x3c')]);return db['FreshsalesField'][_0xc6a4('0x45')](_0x48fd0a)[_0xc6a4('0x24')](handleEntityNotFound(_0x42915d,null))[_0xc6a4('0x24')](respondWithResult(_0x42915d,null))[_0xc6a4('0x42')](handleError(_0x42915d,null));};exports[_0xc6a4('0x46')]=function(_0x11c7cc,_0x29430b){return db[_0xc6a4('0x3d')][_0xc6a4('0x46')](_0x11c7cc[_0xc6a4('0x47')],{})[_0xc6a4('0x24')](respondWithResult(_0x29430b,0xc9))[_0xc6a4('0x42')](handleError(_0x29430b,null));};exports[_0xc6a4('0x48')]=function(_0x30f7ea,_0x18e83a){if(_0x30f7ea[_0xc6a4('0x47')]['id']){delete _0x30f7ea[_0xc6a4('0x47')]['id'];}return db[_0xc6a4('0x3d')][_0xc6a4('0x45')]({'where':{'id':_0x30f7ea[_0xc6a4('0x49')]['id']}})[_0xc6a4('0x24')](handleEntityNotFound(_0x18e83a,null))[_0xc6a4('0x24')](saveUpdates(_0x30f7ea[_0xc6a4('0x47')],null))['then'](respondWithResult(_0x18e83a,null))[_0xc6a4('0x42')](handleError(_0x18e83a,null));};exports['destroy']=function(_0x2ccd57,_0x49d77b){return db[_0xc6a4('0x3d')][_0xc6a4('0x45')]({'where':{'id':_0x2ccd57['params']['id']}})[_0xc6a4('0x24')](handleEntityNotFound(_0x49d77b,null))['then'](removeEntity(_0x49d77b,null))['catch'](handleError(_0x49d77b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index c504ea5..77e51c3 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 _0xa2cb=['request-promise','path','FreshsalesField','freshsales_unique_index','idField','lodash','util','api','moment','bluebird'];(function(_0x231b49,_0x328160){var _0x24dbbd=function(_0x1b636b){while(--_0x1b636b){_0x231b49['push'](_0x231b49['shift']());}};_0x24dbbd(++_0x328160);}(_0xa2cb,0x7d));var _0xba2c=function(_0x4f74a4,_0x38d51b){_0x4f74a4=_0x4f74a4-0x0;var _0x1b938f=_0xa2cb[_0x4f74a4];return _0x1b938f;};'use strict';var _=require(_0xba2c('0x0'));var util=require(_0xba2c('0x1'));var logger=require('../../config/logger')(_0xba2c('0x2'));var moment=require(_0xba2c('0x3'));var BPromise=require(_0xba2c('0x4'));var rp=require(_0xba2c('0x5'));var fs=require('fs');var path=require(_0xba2c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x55034c,_0x21acc2){return _0x55034c['define'](_0xba2c('0x7'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xba2c('0x8'),'fields':[_0xba2c('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda2d=['api','moment','bluebird','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xda2d,0x102));var _0xdda2=function(_0x195a84,_0x37a11b){_0x195a84=_0x195a84-0x0;var _0x35fa94=_0xda2d[_0x195a84];return _0x35fa94;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'paranoid':![],'indexes':[{'name':_0xdda2('0xb'),'fields':[_0xdda2('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index ee739f7..6312921 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x29f25c,_0x29f951){var _0x422bd3=function(_0x4e847f){while(--_0x4e847f){_0x29f25c['push'](_0x29f25c['shift']());}};_0x422bd3(++_0x29f951);}(_0x9536,0x179));var _0x6953=function(_0x19691f,_0x159737){_0x19691f=_0x19691f-0x0;var _0x5677b6=_0x9536[_0x19691f];return _0x5677b6;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file +var _0x5d17=['request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1cfcff,_0x3ffcc3){var _0x4af22f=function(_0x201682){while(--_0x201682){_0x1cfcff['push'](_0x1cfcff['shift']());}};_0x4af22f(++_0x3ffcc3);}(_0x5d17,0x114));var _0x75d1=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x5d17[_0x43c8b8];return _0x413be3;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 1ae1dd6..4363591 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x23533e,_0x2fb328){var _0x5a9db1=function(_0x116276){while(--_0x116276){_0x23533e['push'](_0x23533e['shift']());}};_0x5a9db1(++_0x2fb328);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xb48460,_0x5eeca6){var _0x2f4b74=function(_0x309bc1){while(--_0x309bc1){_0xb48460['push'](_0xb48460['shift']());}};_0x2f4b74(++_0x5eeca6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 ce09586..b095dd9 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 _0x62cf=['ENUM','integrationTab','newTab','sequelize','STRING','username'];(function(_0xc0bbe3,_0x23573e){var _0x2289eb=function(_0x24519d){while(--_0x24519d){_0xc0bbe3['push'](_0xc0bbe3['shift']());}};_0x2289eb(++_0x23573e);}(_0x62cf,0x81));var _0xf62c=function(_0x380d4f,_0x4025c4){_0x380d4f=_0x380d4f-0x0;var _0x4c3562=_0x62cf[_0x380d4f];return _0x4c3562;};'use strict';var Sequelize=require(_0xf62c('0x0'));module['exports']={'name':{'type':Sequelize[_0xf62c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf62c('0x1')],'unique':_0xf62c('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xf62c('0x1')]},'clientSecret':{'type':Sequelize[_0xf62c('0x1')]},'securityToken':{'type':Sequelize[_0xf62c('0x1')]},'serverUrl':{'type':Sequelize[_0xf62c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf62c('0x3')](_0xf62c('0x4'),_0xf62c('0x5')),'defaultValue':_0xf62c('0x4')}}; \ No newline at end of file +var _0xcc97=['STRING','username','ENUM','integrationTab','sequelize','exports'];(function(_0x19d714,_0xd4d58f){var _0x1e7f59=function(_0xf85526){while(--_0xf85526){_0x19d714['push'](_0x19d714['shift']());}};_0x1e7f59(++_0xd4d58f);}(_0xcc97,0x1a8));var _0x7cc9=function(_0x435948,_0x3deed2){_0x435948=_0x435948-0x0;var _0x32ee0a=_0xcc97[_0x435948];return _0x32ee0a;};'use strict';var Sequelize=require(_0x7cc9('0x0'));module[_0x7cc9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7cc9('0x2')]},'username':{'type':Sequelize[_0x7cc9('0x2')],'unique':_0x7cc9('0x3')},'remoteUri':{'type':Sequelize[_0x7cc9('0x2')]},'password':{'type':Sequelize[_0x7cc9('0x2')]},'clientId':{'type':Sequelize[_0x7cc9('0x2')]},'clientSecret':{'type':Sequelize[_0x7cc9('0x2')]},'securityToken':{'type':Sequelize[_0x7cc9('0x2')]},'serverUrl':{'type':Sequelize[_0x7cc9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7cc9('0x4')](_0x7cc9('0x5'),'newTab'),'defaultValue':_0x7cc9('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 45a39bf..d026908 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 _0x9ce4=['offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','body','findOne','SalesforceConfiguration','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','type','channel','SalesforceField','Descriptions','getFields','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','boolean','textarea','phone','remove','includes','label','picklistValues','value','True','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json'];(function(_0x546d5a,_0x538f87){var _0x10e405=function(_0x5cb86c){while(--_0x5cb86c){_0x546d5a['push'](_0x546d5a['shift']());}};_0x10e405(++_0x538f87);}(_0x9ce4,0x140));var _0x49ce=function(_0x8806a6,_0x686e06){_0x8806a6=_0x8806a6-0x0;var _0x49cdd3=_0x9ce4[_0x8806a6];return _0x49cdd3;};'use strict';var emlformat=require(_0x49ce('0x0'));var rimraf=require(_0x49ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49ce('0x2'));var rp=require(_0x49ce('0x3'));var moment=require('moment');var BPromise=require(_0x49ce('0x4'));var Mustache=require(_0x49ce('0x5'));var util=require('util');var path=require(_0x49ce('0x6'));var sox=require('sox');var csv=require(_0x49ce('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49ce('0x8'));var _=require('lodash');var squel=require(_0x49ce('0x9'));var crypto=require(_0x49ce('0xa'));var jsforce=require(_0x49ce('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49ce('0xc'));var Papa=require(_0x49ce('0xd'));var Redis=require('ioredis');var authService=require(_0x49ce('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x49ce('0xf'));var hardwareService=require(_0x49ce('0x10'));var logger=require('../../config/logger')(_0x49ce('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49ce('0x12'));var db=require(_0x49ce('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2486e6,_0x6c39c){_0x6c39c=_0x6c39c||0xcc;return function(_0x2985cc){if(_0x2985cc){return _0x2486e6['sendStatus'](_0x6c39c);}return _0x2486e6[_0x49ce('0x14')](_0x6c39c)['end']();};}function respondWithResult(_0xc3861b,_0x71388d){_0x71388d=_0x71388d||0xc8;return function(_0x385daa){if(_0x385daa){return _0xc3861b['status'](_0x71388d)[_0x49ce('0x15')](_0x385daa);}};}function respondWithFilteredResult(_0x273144,_0x566f3a){return function(_0x5301ac){if(_0x5301ac){var _0x36ebce=typeof _0x566f3a[_0x49ce('0x16')]===_0x49ce('0x17')&&typeof _0x566f3a[_0x49ce('0x18')]===_0x49ce('0x17');var _0x5c0ba3=_0x5301ac[_0x49ce('0x19')];var _0x5b44a4=_0x36ebce?0x0:_0x566f3a['offset'];var _0x2f4053=_0x36ebce?_0x5301ac['count']:_0x566f3a[_0x49ce('0x16')]+_0x566f3a[_0x49ce('0x18')];var _0x2f3755;if(_0x2f4053>=_0x5c0ba3){_0x2f4053=_0x5c0ba3;_0x2f3755=0xc8;}else{_0x2f3755=0xce;}_0x273144['status'](_0x2f3755);return _0x273144[_0x49ce('0x1a')](_0x49ce('0x1b'),_0x5b44a4+'-'+_0x2f4053+'/'+_0x5c0ba3)['json'](_0x5301ac);}return null;};}function patchUpdates(_0x1994f8){return function(_0x370923){try{jsonpatch['apply'](_0x370923,_0x1994f8,!![]);}catch(_0x173e04){return BPromise[_0x49ce('0x1c')](_0x173e04);}return _0x370923[_0x49ce('0x1d')]();};}function saveUpdates(_0x454f79,_0xb8a7f1){return function(_0x46160c){if(_0x46160c){return _0x46160c[_0x49ce('0x1e')](_0x454f79)[_0x49ce('0x1f')](function(_0x4d7932){return _0x4d7932;});}return null;};}function removeEntity(_0x5153a3,_0x5b260d){return function(_0x2f7c49){if(_0x2f7c49){return _0x2f7c49[_0x49ce('0x20')]()[_0x49ce('0x1f')](function(){_0x5153a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa75e2a,_0xcf4505){return function(_0x5a8aab){if(!_0x5a8aab){_0xa75e2a[_0x49ce('0x21')](0x194);}return _0x5a8aab;};}function handleError(_0x3c9bc0,_0x1983d2){_0x1983d2=_0x1983d2||0x1f4;return function(_0x51c59b){logger[_0x49ce('0x22')](_0x51c59b['stack']);if(_0x51c59b[_0x49ce('0x23')]){delete _0x51c59b[_0x49ce('0x23')];}_0x3c9bc0['status'](_0x1983d2)['send'](_0x51c59b);};}exports[_0x49ce('0x24')]=function(_0x1d17b5,_0x25bb92){var _0x4b15ff={},_0x3af22e={},_0x100e57={'count':0x0,'rows':[]};var _0x5e463d=_[_0x49ce('0x25')](db[_0x49ce('0x26')][_0x49ce('0x27')],function(_0x34f8a5){return{'name':_0x34f8a5[_0x49ce('0x28')],'type':_0x34f8a5['type'][_0x49ce('0x29')]};});_0x3af22e[_0x49ce('0x2a')]=_[_0x49ce('0x25')](_0x5e463d,_0x49ce('0x23'));_0x3af22e['query']=_[_0x49ce('0x2b')](_0x1d17b5[_0x49ce('0x2c')]);_0x3af22e['filters']=_['intersection'](_0x3af22e[_0x49ce('0x2a')],_0x3af22e[_0x49ce('0x2c')]);_0x4b15ff[_0x49ce('0x2d')]=_[_0x49ce('0x2e')](_0x3af22e[_0x49ce('0x2a')],qs[_0x49ce('0x2f')](_0x1d17b5[_0x49ce('0x2c')]['fields']));_0x4b15ff[_0x49ce('0x2d')]=_0x4b15ff[_0x49ce('0x2d')][_0x49ce('0x30')]?_0x4b15ff[_0x49ce('0x2d')]:_0x3af22e[_0x49ce('0x2a')];if(!_0x1d17b5[_0x49ce('0x2c')][_0x49ce('0x31')]('nolimit')){_0x4b15ff[_0x49ce('0x18')]=qs['limit'](_0x1d17b5[_0x49ce('0x2c')][_0x49ce('0x18')]);_0x4b15ff[_0x49ce('0x16')]=qs[_0x49ce('0x16')](_0x1d17b5[_0x49ce('0x2c')][_0x49ce('0x16')]);}_0x4b15ff['order']=qs['sort'](_0x1d17b5[_0x49ce('0x2c')][_0x49ce('0x32')]);_0x4b15ff[_0x49ce('0x33')]=qs[_0x49ce('0x34')](_[_0x49ce('0x35')](_0x1d17b5['query'],_0x3af22e[_0x49ce('0x34')]),_0x5e463d);if(_0x1d17b5[_0x49ce('0x2c')][_0x49ce('0x36')]){_0x4b15ff[_0x49ce('0x33')]=_[_0x49ce('0x37')](_0x4b15ff[_0x49ce('0x33')],{'$or':_[_0x49ce('0x25')](_0x5e463d,function(_0x3cd551){if(_0x3cd551['type']!==_0x49ce('0x38')){var _0x51d53c={};_0x51d53c[_0x3cd551['name']]={'$like':'%'+_0x1d17b5[_0x49ce('0x2c')][_0x49ce('0x36')]+'%'};return _0x51d53c;}})});}_0x4b15ff=_[_0x49ce('0x37')]({},_0x4b15ff,_0x1d17b5[_0x49ce('0x39')]);var _0x204211={'where':_0x4b15ff[_0x49ce('0x33')]};return db[_0x49ce('0x26')][_0x49ce('0x19')](_0x204211)[_0x49ce('0x1f')](function(_0x5bf15b){_0x100e57[_0x49ce('0x19')]=_0x5bf15b;if(_0x1d17b5[_0x49ce('0x2c')][_0x49ce('0x3a')]){_0x4b15ff['include']=[{'all':!![]}];}return db[_0x49ce('0x26')]['findAll'](_0x4b15ff);})[_0x49ce('0x1f')](function(_0x5366eb){_0x100e57[_0x49ce('0x3b')]=_0x5366eb;return _0x100e57;})[_0x49ce('0x1f')](respondWithFilteredResult(_0x25bb92,_0x4b15ff))[_0x49ce('0x3c')](handleError(_0x25bb92,null));};exports[_0x49ce('0x3d')]=function(_0x2471ab,_0x27bb06){var _0x3ddffe={'raw':![],'where':{'id':_0x2471ab[_0x49ce('0x3e')]['id']}},_0x108fe4={};_0x108fe4[_0x49ce('0x2a')]=_['keys'](db['SalesforceAccount'][_0x49ce('0x27')]);_0x108fe4[_0x49ce('0x2c')]=_[_0x49ce('0x2b')](_0x2471ab[_0x49ce('0x2c')]);_0x108fe4[_0x49ce('0x34')]=_[_0x49ce('0x2e')](_0x108fe4[_0x49ce('0x2a')],_0x108fe4[_0x49ce('0x2c')]);_0x3ddffe[_0x49ce('0x2d')]=_['intersection'](_0x108fe4['model'],qs[_0x49ce('0x2f')](_0x2471ab[_0x49ce('0x2c')][_0x49ce('0x2f')]));_0x3ddffe[_0x49ce('0x2d')]=_0x3ddffe['attributes'][_0x49ce('0x30')]?_0x3ddffe[_0x49ce('0x2d')]:_0x108fe4['model'];if(_0x2471ab[_0x49ce('0x2c')][_0x49ce('0x3a')]){_0x3ddffe['include']=[{'all':!![]}];}_0x3ddffe=_['merge']({},_0x3ddffe,_0x2471ab['options']);return db['SalesforceAccount'][_0x49ce('0x3f')](_0x3ddffe)[_0x49ce('0x1f')](handleEntityNotFound(_0x27bb06,null))[_0x49ce('0x1f')](respondWithResult(_0x27bb06,null))[_0x49ce('0x3c')](handleError(_0x27bb06,null));};exports[_0x49ce('0x40')]=function(_0x572346,_0xe9c53c){return db[_0x49ce('0x26')][_0x49ce('0x40')](_0x572346[_0x49ce('0x41')],{})[_0x49ce('0x1f')](respondWithResult(_0xe9c53c,0xc9))[_0x49ce('0x3c')](handleError(_0xe9c53c,null));};exports[_0x49ce('0x1e')]=function(_0x29bd2d,_0x1992ef){if(_0x29bd2d[_0x49ce('0x41')]['id']){delete _0x29bd2d[_0x49ce('0x41')]['id'];}return db[_0x49ce('0x26')][_0x49ce('0x3f')]({'where':{'id':_0x29bd2d[_0x49ce('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1992ef,null))[_0x49ce('0x1f')](saveUpdates(_0x29bd2d['body'],null))[_0x49ce('0x1f')](respondWithResult(_0x1992ef,null))['catch'](handleError(_0x1992ef,null));};exports['destroy']=function(_0x39abcf,_0x46fd72){return db['SalesforceAccount'][_0x49ce('0x3f')]({'where':{'id':_0x39abcf['params']['id']}})[_0x49ce('0x1f')](handleEntityNotFound(_0x46fd72,null))[_0x49ce('0x1f')](removeEntity(_0x46fd72,null))[_0x49ce('0x3c')](handleError(_0x46fd72,null));};exports['getConfigurations']=function(_0x3c452c,_0x52f95d,_0x30d38f){var _0x2cc5cb={};var _0xb70a1={};var _0x493917;var _0xd5385c;return db['SalesforceAccount'][_0x49ce('0x42')]({'where':{'id':_0x3c452c['params']['id']}})[_0x49ce('0x1f')](handleEntityNotFound(_0x52f95d,null))[_0x49ce('0x1f')](function(_0x4d4b8b){if(_0x4d4b8b){_0x493917=_0x4d4b8b;_0xb70a1['model']=_[_0x49ce('0x2b')](db[_0x49ce('0x43')][_0x49ce('0x27')]);_0xb70a1[_0x49ce('0x2c')]=_[_0x49ce('0x2b')](_0x3c452c[_0x49ce('0x2c')]);_0xb70a1[_0x49ce('0x34')]=_['intersection'](_0xb70a1[_0x49ce('0x2a')],_0xb70a1['query']);_0x2cc5cb[_0x49ce('0x2d')]=_[_0x49ce('0x2e')](_0xb70a1[_0x49ce('0x2a')],qs['fields'](_0x3c452c[_0x49ce('0x2c')]['fields']));_0x2cc5cb[_0x49ce('0x2d')]=_0x2cc5cb[_0x49ce('0x2d')][_0x49ce('0x30')]?_0x2cc5cb[_0x49ce('0x2d')]:_0xb70a1[_0x49ce('0x2a')];_0x2cc5cb['order']=qs[_0x49ce('0x32')](_0x3c452c['query'][_0x49ce('0x32')]);_0x2cc5cb[_0x49ce('0x33')]=qs[_0x49ce('0x34')](_[_0x49ce('0x35')](_0x3c452c[_0x49ce('0x2c')],_0xb70a1[_0x49ce('0x34')]));if(_0x3c452c[_0x49ce('0x2c')][_0x49ce('0x36')]){_0x2cc5cb[_0x49ce('0x33')]=_[_0x49ce('0x37')](_0x2cc5cb[_0x49ce('0x33')],{'$or':_[_0x49ce('0x25')](_0x2cc5cb[_0x49ce('0x2d')],function(_0x1a999d){var _0x5d3f59={};_0x5d3f59[_0x1a999d]={'$like':'%'+_0x3c452c[_0x49ce('0x2c')][_0x49ce('0x36')]+'%'};return _0x5d3f59;})});}_0x2cc5cb=_[_0x49ce('0x37')]({},_0x2cc5cb,_0x3c452c[_0x49ce('0x39')]);return _0x493917[_0x49ce('0x44')](_0x2cc5cb);}})[_0x49ce('0x1f')](function(_0x18a304){if(_0x18a304){_0xd5385c=_0x18a304['length'];if(!_0x3c452c['query'][_0x49ce('0x31')](_0x49ce('0x45'))){_0x2cc5cb[_0x49ce('0x18')]=qs[_0x49ce('0x18')](_0x3c452c[_0x49ce('0x2c')][_0x49ce('0x18')]);_0x2cc5cb['offset']=qs[_0x49ce('0x16')](_0x3c452c[_0x49ce('0x2c')][_0x49ce('0x16')]);}return _0x493917[_0x49ce('0x44')](_0x2cc5cb);}})['then'](function(_0x19dc4e){if(_0x19dc4e){return _0x19dc4e?{'count':_0xd5385c,'rows':_0x19dc4e}:null;}})['then'](respondWithResult(_0x52f95d,null))['catch'](handleError(_0x52f95d,null));};exports[_0x49ce('0x46')]=function(_0xdc7af9,_0x2ee931,_0xa907a4){if(_0xdc7af9[_0x49ce('0x41')]['id']){delete _0xdc7af9[_0x49ce('0x41')]['id'];}return db['SalesforceAccount'][_0x49ce('0x42')]({'where':{'id':_0xdc7af9[_0x49ce('0x3e')]['id']}})[_0x49ce('0x1f')](handleEntityNotFound(_0x2ee931,null))[_0x49ce('0x1f')](function(_0x284a19){if(_0x284a19){_0xdc7af9[_0x49ce('0x41')]['AccountId']=_0x284a19['id'];_0xdc7af9['body'][_0x49ce('0x47')]=integrations[_0x49ce('0x48')](_0xdc7af9[_0x49ce('0x41')]['channel'],_0xdc7af9[_0x49ce('0x41')][_0x49ce('0x49')]);_0xdc7af9[_0x49ce('0x41')]['Descriptions']=integrations['getDescriptions'](_0xdc7af9['body'][_0x49ce('0x4a')],_0xdc7af9[_0x49ce('0x41')]['type']);return db[_0x49ce('0x43')]['create'](_0xdc7af9[_0x49ce('0x41')],{'include':[{'model':db[_0x49ce('0x4b')],'as':'Subjects'},{'model':db[_0x49ce('0x4b')],'as':_0x49ce('0x4c')}]});}return null;})['then'](respondWithResult(_0x2ee931,null))[_0x49ce('0x3c')](handleError(_0x2ee931,null));};exports[_0x49ce('0x4d')]=function(_0x59811c,_0x181f89,_0x46979f){var _0x5a5b53;var _0x493623='';var _0x49ac14='Task';return db['SalesforceAccount'][_0x49ce('0x42')]({'where':{'id':_0x59811c[_0x49ce('0x3e')]['id']},'attributes':['id',_0x49ce('0x4e'),'clientId',_0x49ce('0x4f'),_0x49ce('0x50'),_0x49ce('0x51'),_0x49ce('0x52')]})[_0x49ce('0x1f')](handleEntityNotFound(_0x181f89,null))[_0x49ce('0x1f')](function(_0xd2c1b8){if(_0xd2c1b8){_0x493623=_0xd2c1b8['remoteUri'];var _0x13a9e1=_0x493623[_0x49ce('0x53')](-0x1);if(_0x13a9e1==='/'){_0x493623=_0x493623[_0x49ce('0x54')](0x0,_0x493623[_0x49ce('0x55')](_0x13a9e1));}_0x5a5b53=new jsforce[(_0x49ce('0x56'))]({'oauth2':{'loginUrl':_0x493623,'clientId':_0xd2c1b8[_0x49ce('0x57')],'clientSecret':_0xd2c1b8[_0x49ce('0x4f')]}});return _0x5a5b53[_0x49ce('0x58')](_0xd2c1b8[_0x49ce('0x50')],_0xd2c1b8[_0x49ce('0x51')][_0x49ce('0x59')](_0xd2c1b8[_0x49ce('0x52')]));}})[_0x49ce('0x1f')](function(_0x1e4e67){if(_0x1e4e67){if(!_[_0x49ce('0x5a')](_0x59811c['query']['ticketType'])){_0x49ac14=_0x59811c[_0x49ce('0x2c')][_0x49ce('0x5b')];}return _0x5a5b53[_0x49ce('0x5c')](_0x49ac14)['describe']();}})[_0x49ce('0x1f')](function(_0x681cf7){var _0x3a507c=['OwnerId',_0x49ce('0x5d'),_0x49ce('0x5e'),_0x49ce('0x5f'),_0x49ce('0x60'),_0x49ce('0x61')];var _0x49c3e3=['string','int','picklist',_0x49ce('0x62'),'email',_0x49ce('0x63'),_0x49ce('0x64')];if(_0x681cf7){_[_0x49ce('0x65')](_0x681cf7[_0x49ce('0x2f')],function(_0x2fef5d){return _0x3a507c[_0x49ce('0x66')](_0x2fef5d[_0x49ce('0x23')])||!_0x49c3e3['includes'](_0x2fef5d[_0x49ce('0x49')]);});return{'count':_0x681cf7[_0x49ce('0x2f')]['length'],'rows':_[_0x49ce('0x25')](_0x681cf7[_0x49ce('0x2f')],function(_0x5dd5f4){return{'id':_0x5dd5f4[_0x49ce('0x23')],'name':_0x5dd5f4[_0x49ce('0x67')],'custom':_0x5dd5f4['custom'],'options':_0x5dd5f4['picklistValues'][_0x49ce('0x30')]>0x0?_[_0x49ce('0x25')](_0x5dd5f4[_0x49ce('0x68')],function(_0x46fdad){return{'name':_0x46fdad[_0x49ce('0x67')],'value':_0x46fdad[_0x49ce('0x69')]};}):_0x5dd5f4['type']==_0x49ce('0x62')?[{'name':_0x49ce('0x6a'),'value':'true'},{'name':_0x49ce('0x6b'),'value':'false'}]:[]};})};}})[_0x49ce('0x1f')](respondWithResult(_0x181f89,null))['catch'](function(_0x5158f0){var _0x42e5e5=_0x59811c['query'][_0x49ce('0x6c')]?0x1f4:_0x5158f0[_0x49ce('0x6d')]||0x1f4;logger[_0x49ce('0x22')](_0x49ce('0x6e'),_0x49ce('0x4d'),_0x42e5e5,JSON[_0x49ce('0x6f')](_0x5158f0));delete _0x5158f0[_0x49ce('0x23')];if(_0x42e5e5===0x191){_0x42e5e5=0x190;}_0x181f89['status'](_0x42e5e5)[_0x49ce('0x70')](_0x59811c['query'][_0x49ce('0x6c')]?{'message':_0x49ce('0x71'),'statusCode':_0x5158f0['statusCode']}:_0x5158f0);});}; \ No newline at end of file +var _0xfc6c=['clientId','clientSecret','username','password','remoteUri','slice','substring','lastIndexOf','login','concat','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','params','catch','body','find','findOne','getConfigurations','AccountId','Subjects','getSubjects','channel','SalesforceConfiguration','create','SalesforceField','Task'];(function(_0xa39b7,_0x2e1da3){var _0x2bb6d0=function(_0x110f64){while(--_0x110f64){_0xa39b7['push'](_0xa39b7['shift']());}};_0x2bb6d0(++_0x2e1da3);}(_0xfc6c,0x127));var _0xcfc6=function(_0x247941,_0x209aca){_0x247941=_0x247941-0x0;var _0x486914=_0xfc6c[_0x247941];return _0x486914;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfc6('0x0'));var zipdir=require(_0xcfc6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcfc6('0x2'));var BPromise=require(_0xcfc6('0x3'));var Mustache=require(_0xcfc6('0x4'));var util=require(_0xcfc6('0x5'));var path=require(_0xcfc6('0x6'));var sox=require(_0xcfc6('0x7'));var csv=require(_0xcfc6('0x8'));var ejs=require(_0xcfc6('0x9'));var fs=require('fs');var fs_extra=require(_0xcfc6('0xa'));var _=require(_0xcfc6('0xb'));var squel=require(_0xcfc6('0xc'));var crypto=require(_0xcfc6('0xd'));var jsforce=require(_0xcfc6('0xe'));var deskjs=require(_0xcfc6('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcfc6('0x10'));var Papa=require(_0xcfc6('0x11'));var Redis=require(_0xcfc6('0x12'));var authService=require(_0xcfc6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcfc6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfc6('0x15'))(_0xcfc6('0x16'));var utils=require(_0xcfc6('0x17'));var config=require(_0xcfc6('0x18'));var licenseUtil=require(_0xcfc6('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x32bdf3,_0x41b15b){_0x41b15b=_0x41b15b||0xcc;return function(_0x3e8028){if(_0x3e8028){return _0x32bdf3[_0xcfc6('0x1a')](_0x41b15b);}return _0x32bdf3[_0xcfc6('0x1b')](_0x41b15b)[_0xcfc6('0x1c')]();};}function respondWithResult(_0x46bc4f,_0x268535){_0x268535=_0x268535||0xc8;return function(_0x308430){if(_0x308430){return _0x46bc4f[_0xcfc6('0x1b')](_0x268535)['json'](_0x308430);}};}function respondWithFilteredResult(_0x24afba,_0x138271){return function(_0xb9484c){if(_0xb9484c){var _0x29eb85=typeof _0x138271[_0xcfc6('0x1d')]===_0xcfc6('0x1e')&&typeof _0x138271[_0xcfc6('0x1f')]===_0xcfc6('0x1e');var _0x3e859e=_0xb9484c[_0xcfc6('0x20')];var _0x1b05ea=_0x29eb85?0x0:_0x138271[_0xcfc6('0x1d')];var _0x138b4f=_0x29eb85?_0xb9484c[_0xcfc6('0x20')]:_0x138271[_0xcfc6('0x1d')]+_0x138271[_0xcfc6('0x1f')];var _0x4d14b8;if(_0x138b4f>=_0x3e859e){_0x138b4f=_0x3e859e;_0x4d14b8=0xc8;}else{_0x4d14b8=0xce;}_0x24afba[_0xcfc6('0x1b')](_0x4d14b8);return _0x24afba['set'](_0xcfc6('0x21'),_0x1b05ea+'-'+_0x138b4f+'/'+_0x3e859e)[_0xcfc6('0x22')](_0xb9484c);}return null;};}function patchUpdates(_0x50ed94){return function(_0xf55ca8){try{jsonpatch[_0xcfc6('0x23')](_0xf55ca8,_0x50ed94,!![]);}catch(_0x363aa0){return BPromise[_0xcfc6('0x24')](_0x363aa0);}return _0xf55ca8[_0xcfc6('0x25')]();};}function saveUpdates(_0x2c7469,_0xa3a888){return function(_0x49ae12){if(_0x49ae12){return _0x49ae12[_0xcfc6('0x26')](_0x2c7469)[_0xcfc6('0x27')](function(_0x1a18b9){return _0x1a18b9;});}return null;};}function removeEntity(_0x2d67ae,_0x2c960f){return function(_0x5ae2da){if(_0x5ae2da){return _0x5ae2da[_0xcfc6('0x28')]()[_0xcfc6('0x27')](function(){_0x2d67ae['status'](0xcc)[_0xcfc6('0x1c')]();});}};}function handleEntityNotFound(_0x1fec94,_0x3813f2){return function(_0x2775af){if(!_0x2775af){_0x1fec94[_0xcfc6('0x1a')](0x194);}return _0x2775af;};}function handleError(_0x38c590,_0x194d81){_0x194d81=_0x194d81||0x1f4;return function(_0x5e8f2a){logger[_0xcfc6('0x29')](_0x5e8f2a[_0xcfc6('0x2a')]);if(_0x5e8f2a[_0xcfc6('0x2b')]){delete _0x5e8f2a[_0xcfc6('0x2b')];}_0x38c590['status'](_0x194d81)['send'](_0x5e8f2a);};}exports[_0xcfc6('0x2c')]=function(_0x3df524,_0x259737){var _0x24d2c0={},_0x95cc62={},_0xe211cb={'count':0x0,'rows':[]};var _0x5f01fe=_[_0xcfc6('0x2d')](db['SalesforceAccount'][_0xcfc6('0x2e')],function(_0x5b1bbf){return{'name':_0x5b1bbf[_0xcfc6('0x2f')],'type':_0x5b1bbf[_0xcfc6('0x30')][_0xcfc6('0x31')]};});_0x95cc62[_0xcfc6('0x32')]=_[_0xcfc6('0x2d')](_0x5f01fe,'name');_0x95cc62[_0xcfc6('0x33')]=_[_0xcfc6('0x34')](_0x3df524['query']);_0x95cc62['filters']=_[_0xcfc6('0x35')](_0x95cc62[_0xcfc6('0x32')],_0x95cc62[_0xcfc6('0x33')]);_0x24d2c0[_0xcfc6('0x36')]=_['intersection'](_0x95cc62[_0xcfc6('0x32')],qs[_0xcfc6('0x37')](_0x3df524['query'][_0xcfc6('0x37')]));_0x24d2c0['attributes']=_0x24d2c0[_0xcfc6('0x36')][_0xcfc6('0x38')]?_0x24d2c0[_0xcfc6('0x36')]:_0x95cc62[_0xcfc6('0x32')];if(!_0x3df524['query'][_0xcfc6('0x39')](_0xcfc6('0x3a'))){_0x24d2c0[_0xcfc6('0x1f')]=qs[_0xcfc6('0x1f')](_0x3df524['query'][_0xcfc6('0x1f')]);_0x24d2c0['offset']=qs[_0xcfc6('0x1d')](_0x3df524[_0xcfc6('0x33')]['offset']);}_0x24d2c0[_0xcfc6('0x3b')]=qs['sort'](_0x3df524[_0xcfc6('0x33')][_0xcfc6('0x3c')]);_0x24d2c0[_0xcfc6('0x3d')]=qs[_0xcfc6('0x3e')](_[_0xcfc6('0x3f')](_0x3df524[_0xcfc6('0x33')],_0x95cc62[_0xcfc6('0x3e')]),_0x5f01fe);if(_0x3df524[_0xcfc6('0x33')][_0xcfc6('0x40')]){_0x24d2c0[_0xcfc6('0x3d')]=_[_0xcfc6('0x41')](_0x24d2c0[_0xcfc6('0x3d')],{'$or':_[_0xcfc6('0x2d')](_0x5f01fe,function(_0x212c32){if(_0x212c32['type']!==_0xcfc6('0x42')){var _0xeea740={};_0xeea740[_0x212c32[_0xcfc6('0x2b')]]={'$like':'%'+_0x3df524[_0xcfc6('0x33')][_0xcfc6('0x40')]+'%'};return _0xeea740;}})});}_0x24d2c0=_[_0xcfc6('0x41')]({},_0x24d2c0,_0x3df524[_0xcfc6('0x43')]);var _0x49340f={'where':_0x24d2c0['where']};return db[_0xcfc6('0x44')][_0xcfc6('0x20')](_0x49340f)[_0xcfc6('0x27')](function(_0x233992){_0xe211cb[_0xcfc6('0x20')]=_0x233992;if(_0x3df524[_0xcfc6('0x33')][_0xcfc6('0x45')]){_0x24d2c0[_0xcfc6('0x46')]=[{'all':!![]}];}return db[_0xcfc6('0x44')][_0xcfc6('0x47')](_0x24d2c0);})[_0xcfc6('0x27')](function(_0x2475af){_0xe211cb['rows']=_0x2475af;return _0xe211cb;})['then'](respondWithFilteredResult(_0x259737,_0x24d2c0))['catch'](handleError(_0x259737,null));};exports['show']=function(_0x45ae7e,_0x555756){var _0x423ec9={'raw':![],'where':{'id':_0x45ae7e[_0xcfc6('0x48')]['id']}},_0x18a416={};_0x18a416[_0xcfc6('0x32')]=_[_0xcfc6('0x34')](db['SalesforceAccount'][_0xcfc6('0x2e')]);_0x18a416[_0xcfc6('0x33')]=_[_0xcfc6('0x34')](_0x45ae7e[_0xcfc6('0x33')]);_0x18a416[_0xcfc6('0x3e')]=_[_0xcfc6('0x35')](_0x18a416['model'],_0x18a416[_0xcfc6('0x33')]);_0x423ec9['attributes']=_[_0xcfc6('0x35')](_0x18a416['model'],qs[_0xcfc6('0x37')](_0x45ae7e[_0xcfc6('0x33')][_0xcfc6('0x37')]));_0x423ec9[_0xcfc6('0x36')]=_0x423ec9['attributes'][_0xcfc6('0x38')]?_0x423ec9['attributes']:_0x18a416[_0xcfc6('0x32')];if(_0x45ae7e[_0xcfc6('0x33')][_0xcfc6('0x45')]){_0x423ec9[_0xcfc6('0x46')]=[{'all':!![]}];}_0x423ec9=_[_0xcfc6('0x41')]({},_0x423ec9,_0x45ae7e[_0xcfc6('0x43')]);return db[_0xcfc6('0x44')]['find'](_0x423ec9)['then'](handleEntityNotFound(_0x555756,null))[_0xcfc6('0x27')](respondWithResult(_0x555756,null))[_0xcfc6('0x49')](handleError(_0x555756,null));};exports['create']=function(_0x5a3d33,_0x3fcf19){return db[_0xcfc6('0x44')]['create'](_0x5a3d33[_0xcfc6('0x4a')],{})['then'](respondWithResult(_0x3fcf19,0xc9))[_0xcfc6('0x49')](handleError(_0x3fcf19,null));};exports[_0xcfc6('0x26')]=function(_0x409cca,_0x17b517){if(_0x409cca[_0xcfc6('0x4a')]['id']){delete _0x409cca[_0xcfc6('0x4a')]['id'];}return db[_0xcfc6('0x44')]['find']({'where':{'id':_0x409cca[_0xcfc6('0x48')]['id']}})[_0xcfc6('0x27')](handleEntityNotFound(_0x17b517,null))[_0xcfc6('0x27')](saveUpdates(_0x409cca[_0xcfc6('0x4a')],null))[_0xcfc6('0x27')](respondWithResult(_0x17b517,null))[_0xcfc6('0x49')](handleError(_0x17b517,null));};exports[_0xcfc6('0x28')]=function(_0x497fc9,_0x4acd74){return db['SalesforceAccount'][_0xcfc6('0x4b')]({'where':{'id':_0x497fc9['params']['id']}})[_0xcfc6('0x27')](handleEntityNotFound(_0x4acd74,null))[_0xcfc6('0x27')](removeEntity(_0x4acd74,null))['catch'](handleError(_0x4acd74,null));};exports['getConfigurations']=function(_0x25760f,_0x13d07a,_0x59edc6){var _0x54a709={};var _0x4b76a8={};var _0x5e98f0;var _0x16ebd2;return db[_0xcfc6('0x44')][_0xcfc6('0x4c')]({'where':{'id':_0x25760f['params']['id']}})['then'](handleEntityNotFound(_0x13d07a,null))[_0xcfc6('0x27')](function(_0x16c19a){if(_0x16c19a){_0x5e98f0=_0x16c19a;_0x4b76a8['model']=_[_0xcfc6('0x34')](db['SalesforceConfiguration'][_0xcfc6('0x2e')]);_0x4b76a8[_0xcfc6('0x33')]=_[_0xcfc6('0x34')](_0x25760f[_0xcfc6('0x33')]);_0x4b76a8[_0xcfc6('0x3e')]=_[_0xcfc6('0x35')](_0x4b76a8[_0xcfc6('0x32')],_0x4b76a8[_0xcfc6('0x33')]);_0x54a709[_0xcfc6('0x36')]=_[_0xcfc6('0x35')](_0x4b76a8[_0xcfc6('0x32')],qs[_0xcfc6('0x37')](_0x25760f[_0xcfc6('0x33')][_0xcfc6('0x37')]));_0x54a709[_0xcfc6('0x36')]=_0x54a709[_0xcfc6('0x36')][_0xcfc6('0x38')]?_0x54a709[_0xcfc6('0x36')]:_0x4b76a8[_0xcfc6('0x32')];_0x54a709[_0xcfc6('0x3b')]=qs[_0xcfc6('0x3c')](_0x25760f[_0xcfc6('0x33')][_0xcfc6('0x3c')]);_0x54a709['where']=qs[_0xcfc6('0x3e')](_[_0xcfc6('0x3f')](_0x25760f['query'],_0x4b76a8[_0xcfc6('0x3e')]));if(_0x25760f['query'][_0xcfc6('0x40')]){_0x54a709['where']=_[_0xcfc6('0x41')](_0x54a709[_0xcfc6('0x3d')],{'$or':_[_0xcfc6('0x2d')](_0x54a709[_0xcfc6('0x36')],function(_0x502cd1){var _0x17ef2c={};_0x17ef2c[_0x502cd1]={'$like':'%'+_0x25760f[_0xcfc6('0x33')]['filter']+'%'};return _0x17ef2c;})});}_0x54a709=_[_0xcfc6('0x41')]({},_0x54a709,_0x25760f[_0xcfc6('0x43')]);return _0x5e98f0[_0xcfc6('0x4d')](_0x54a709);}})[_0xcfc6('0x27')](function(_0x4f1e3e){if(_0x4f1e3e){_0x16ebd2=_0x4f1e3e[_0xcfc6('0x38')];if(!_0x25760f[_0xcfc6('0x33')][_0xcfc6('0x39')]('nolimit')){_0x54a709[_0xcfc6('0x1f')]=qs[_0xcfc6('0x1f')](_0x25760f[_0xcfc6('0x33')]['limit']);_0x54a709[_0xcfc6('0x1d')]=qs[_0xcfc6('0x1d')](_0x25760f[_0xcfc6('0x33')][_0xcfc6('0x1d')]);}return _0x5e98f0[_0xcfc6('0x4d')](_0x54a709);}})[_0xcfc6('0x27')](function(_0x49477e){if(_0x49477e){return _0x49477e?{'count':_0x16ebd2,'rows':_0x49477e}:null;}})[_0xcfc6('0x27')](respondWithResult(_0x13d07a,null))[_0xcfc6('0x49')](handleError(_0x13d07a,null));};exports['addConfiguration']=function(_0x2adf56,_0x4ddcea,_0x47b036){if(_0x2adf56[_0xcfc6('0x4a')]['id']){delete _0x2adf56[_0xcfc6('0x4a')]['id'];}return db['SalesforceAccount'][_0xcfc6('0x4c')]({'where':{'id':_0x2adf56[_0xcfc6('0x48')]['id']}})[_0xcfc6('0x27')](handleEntityNotFound(_0x4ddcea,null))[_0xcfc6('0x27')](function(_0x1b362b){if(_0x1b362b){_0x2adf56[_0xcfc6('0x4a')][_0xcfc6('0x4e')]=_0x1b362b['id'];_0x2adf56[_0xcfc6('0x4a')][_0xcfc6('0x4f')]=integrations[_0xcfc6('0x50')](_0x2adf56[_0xcfc6('0x4a')]['channel'],_0x2adf56[_0xcfc6('0x4a')]['type']);_0x2adf56[_0xcfc6('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x2adf56[_0xcfc6('0x4a')][_0xcfc6('0x51')],_0x2adf56['body']['type']);return db[_0xcfc6('0x52')][_0xcfc6('0x53')](_0x2adf56['body'],{'include':[{'model':db[_0xcfc6('0x54')],'as':_0xcfc6('0x4f')},{'model':db[_0xcfc6('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4ddcea,null))[_0xcfc6('0x49')](handleError(_0x4ddcea,null));};exports['getFields']=function(_0xd889e1,_0x459f03,_0x2f4815){var _0x31e51c;var _0x27d4c9='';var _0x4d4b3c=_0xcfc6('0x55');return db['SalesforceAccount']['findOne']({'where':{'id':_0xd889e1['params']['id']},'attributes':['id','remoteUri',_0xcfc6('0x56'),_0xcfc6('0x57'),_0xcfc6('0x58'),_0xcfc6('0x59'),'securityToken']})[_0xcfc6('0x27')](handleEntityNotFound(_0x459f03,null))[_0xcfc6('0x27')](function(_0x543c9f){if(_0x543c9f){_0x27d4c9=_0x543c9f[_0xcfc6('0x5a')];var _0xf12e92=_0x27d4c9[_0xcfc6('0x5b')](-0x1);if(_0xf12e92==='/'){_0x27d4c9=_0x27d4c9[_0xcfc6('0x5c')](0x0,_0x27d4c9[_0xcfc6('0x5d')](_0xf12e92));}_0x31e51c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x27d4c9,'clientId':_0x543c9f[_0xcfc6('0x56')],'clientSecret':_0x543c9f[_0xcfc6('0x57')]}});return _0x31e51c[_0xcfc6('0x5e')](_0x543c9f[_0xcfc6('0x58')],_0x543c9f[_0xcfc6('0x59')][_0xcfc6('0x5f')](_0x543c9f[_0xcfc6('0x60')]));}})[_0xcfc6('0x27')](function(_0x18fe95){if(_0x18fe95){if(!_[_0xcfc6('0x61')](_0xd889e1[_0xcfc6('0x33')][_0xcfc6('0x62')])){_0x4d4b3c=_0xd889e1[_0xcfc6('0x33')]['ticketType'];}return _0x31e51c['sobject'](_0x4d4b3c)[_0xcfc6('0x63')]();}})['then'](function(_0x4d787b){var _0x2f0a0a=[_0xcfc6('0x64'),_0xcfc6('0x65'),_0xcfc6('0x66'),_0xcfc6('0x67'),_0xcfc6('0x68'),'Description'];var _0x780cad=[_0xcfc6('0x69'),_0xcfc6('0x6a'),'picklist',_0xcfc6('0x6b'),_0xcfc6('0x6c'),_0xcfc6('0x6d'),_0xcfc6('0x6e')];if(_0x4d787b){_[_0xcfc6('0x6f')](_0x4d787b[_0xcfc6('0x37')],function(_0x10b723){return _0x2f0a0a[_0xcfc6('0x70')](_0x10b723[_0xcfc6('0x2b')])||!_0x780cad['includes'](_0x10b723[_0xcfc6('0x30')]);});return{'count':_0x4d787b[_0xcfc6('0x37')]['length'],'rows':_['map'](_0x4d787b['fields'],function(_0x324a25){return{'id':_0x324a25['name'],'name':_0x324a25[_0xcfc6('0x71')],'custom':_0x324a25[_0xcfc6('0x72')],'options':_0x324a25[_0xcfc6('0x73')][_0xcfc6('0x38')]>0x0?_[_0xcfc6('0x2d')](_0x324a25[_0xcfc6('0x73')],function(_0x436d0f){return{'name':_0x436d0f['label'],'value':_0x436d0f[_0xcfc6('0x74')]};}):_0x324a25[_0xcfc6('0x30')]==_0xcfc6('0x6b')?[{'name':_0xcfc6('0x75'),'value':_0xcfc6('0x76')},{'name':_0xcfc6('0x77'),'value':_0xcfc6('0x78')}]:[]};})};}})['then'](respondWithResult(_0x459f03,null))['catch'](function(_0x13fde9){var _0xf97c5c=_0xd889e1['query']['test']?0x1f4:_0x13fde9[_0xcfc6('0x79')]||0x1f4;logger['error'](_0xcfc6('0x7a'),'getFields',_0xf97c5c,JSON[_0xcfc6('0x7b')](_0x13fde9));delete _0x13fde9[_0xcfc6('0x2b')];if(_0xf97c5c===0x191){_0xf97c5c=0x190;}_0x459f03[_0xcfc6('0x1b')](_0xf97c5c)[_0xcfc6('0x7c')](_0xd889e1[_0xcfc6('0x33')][_0xcfc6('0x7d')]?{'message':_0xcfc6('0x7e'),'statusCode':_0x13fde9[_0xcfc6('0x79')]}:_0x13fde9);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index be82e8f..00c31d2 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 _0x80fb=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x282fc8,_0x50b4b5){var _0xf69939=function(_0x537cfc){while(--_0x537cfc){_0x282fc8['push'](_0x282fc8['shift']());}};_0xf69939(++_0x50b4b5);}(_0x80fb,0x11e));var _0xb80f=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x80fb[_0xf71120];return _0xbe2fd3;};'use strict';var _=require('lodash');var util=require(_0xb80f('0x0'));var logger=require(_0xb80f('0x1'))('api');var moment=require(_0xb80f('0x2'));var BPromise=require(_0xb80f('0x3'));var rp=require(_0xb80f('0x4'));var fs=require('fs');var path=require(_0xb80f('0x5'));var rimraf=require(_0xb80f('0x6'));var config=require(_0xb80f('0x7'));var attributes=require(_0xb80f('0x8'));var integrations=require(_0xb80f('0x9'));module['exports']=function(_0x1676a9,_0x251de5){return _0x1676a9[_0xb80f('0xa')](_0xb80f('0xb'),attributes,{'tableName':_0xb80f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3039=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','util'];(function(_0xdcc31f,_0x398e63){var _0x4be9e3=function(_0x49ddef){while(--_0x49ddef){_0xdcc31f['push'](_0xdcc31f['shift']());}};_0x4be9e3(++_0x398e63);}(_0x3039,0x18b));var _0x9303=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3039[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x9303('0x0'));var logger=require(_0x9303('0x1'))(_0x9303('0x2'));var moment=require(_0x9303('0x3'));var BPromise=require('bluebird');var rp=require(_0x9303('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9303('0x5'));var config=require(_0x9303('0x6'));var attributes=require(_0x9303('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x9303('0x8')]=function(_0x5b77f3,_0x3652a1){return _0x5b77f3[_0x9303('0x9')](_0x9303('0xa'),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 08de0eb..63605e1 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 _0x6c72=['../../config/environment','client','then','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','include','map','model','debug','ShowSalesforceAccount','find','raw','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x6c72,0xf9));var _0x26c7=function(_0x537bb5,_0x151c8b){_0x537bb5=_0x537bb5-0x0;var _0x505c21=_0x6c72[_0x537bb5];return _0x505c21;};'use strict';var _=require('lodash');var util=require(_0x26c7('0x0'));var moment=require(_0x26c7('0x1'));var BPromise=require(_0x26c7('0x2'));var rs=require(_0x26c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26c7('0x4'))['db'];var utils=require(_0x26c7('0x5'));var logger=require(_0x26c7('0x6'))('rpc');var config=require(_0x26c7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x26c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33db03,_0x26ac2f,_0x51fd47){return new BPromise(function(_0x1567f1,_0x54b46e){return client['request'](_0x33db03,_0x51fd47)[_0x26c7('0x9')](function(_0x1f3dc6){logger['info'](_0x26c7('0xa'),_0x26ac2f,'request\x20sent');logger['debug'](_0x26c7('0xb'),_0x26ac2f,_0x26c7('0xc'),JSON['stringify'](_0x1f3dc6));if(_0x1f3dc6[_0x26c7('0xd')]){if(_0x1f3dc6[_0x26c7('0xd')][_0x26c7('0xe')]===0x1f4){logger[_0x26c7('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x26ac2f,_0x1f3dc6[_0x26c7('0xd')][_0x26c7('0xf')]);return _0x54b46e(_0x1f3dc6[_0x26c7('0xd')][_0x26c7('0xf')]);}logger[_0x26c7('0xd')](_0x26c7('0xa'),_0x26ac2f,_0x1f3dc6[_0x26c7('0xd')]['message']);return _0x1567f1(_0x1f3dc6[_0x26c7('0xd')][_0x26c7('0xf')]);}else{logger[_0x26c7('0x10')](_0x26c7('0xa'),_0x26ac2f,_0x26c7('0xc'));_0x1567f1(_0x1f3dc6[_0x26c7('0x11')][_0x26c7('0xf')]);}})['catch'](function(_0xfc085){logger[_0x26c7('0xd')](_0x26c7('0xa'),_0x26ac2f,_0xfc085);_0x54b46e(_0xfc085);});});}exports[_0x26c7('0x12')]=function(_0x413f1e){var _0x5c45da=this;return new Promise(function(_0xaa0d4,_0x2b0c13){return db[_0x26c7('0x13')][_0x26c7('0x14')]({'raw':_0x413f1e['options']?_0x413f1e[_0x26c7('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x413f1e[_0x26c7('0x15')]?_0x413f1e[_0x26c7('0x15')][_0x26c7('0x16')]||null:null,'attributes':_0x413f1e['options']?_0x413f1e['options'][_0x26c7('0x17')]||null:null,'limit':_0x413f1e[_0x26c7('0x15')]?_0x413f1e[_0x26c7('0x15')]['limit']||null:null,'include':_0x413f1e[_0x26c7('0x15')]?_0x413f1e[_0x26c7('0x15')][_0x26c7('0x18')]?_[_0x26c7('0x19')](_0x413f1e[_0x26c7('0x15')][_0x26c7('0x18')],function(_0x103cba){return{'model':db[_0x103cba[_0x26c7('0x1a')]],'as':_0x103cba['as'],'attributes':_0x103cba['attributes'],'include':_0x103cba[_0x26c7('0x18')]?_[_0x26c7('0x19')](_0x103cba[_0x26c7('0x18')],function(_0x24be7a){return{'model':db[_0x24be7a[_0x26c7('0x1a')]],'as':_0x24be7a['as'],'attributes':_0x24be7a[_0x26c7('0x17')],'include':_0x24be7a[_0x26c7('0x18')]?_[_0x26c7('0x19')](_0x24be7a[_0x26c7('0x18')],function(_0x23e82d){return{'model':db[_0x23e82d['model']],'as':_0x23e82d['as'],'attributes':_0x23e82d['attributes']};}):[]};}):[]};}):[]:[]})[_0x26c7('0x9')](function(_0x1f6f11){logger['info'](_0x26c7('0x12'),_0x413f1e);logger[_0x26c7('0x1b')]('GetSalesforceAccount',_0x413f1e,JSON['stringify'](_0x1f6f11));_0xaa0d4(_0x1f6f11);})['catch'](function(_0x1a4ddb){logger['error']('GetSalesforceAccount',_0x1a4ddb[_0x26c7('0xf')],_0x413f1e);_0x2b0c13(_0x5c45da[_0x26c7('0xd')](0x1f4,_0x1a4ddb['message']));});});};exports[_0x26c7('0x1c')]=function(_0x549b25){var _0x2ace37=this;return new Promise(function(_0x2c5240,_0x1922fe){return db[_0x26c7('0x13')][_0x26c7('0x1d')]({'raw':_0x549b25[_0x26c7('0x15')]?_0x549b25[_0x26c7('0x15')][_0x26c7('0x1e')]===undefined?!![]:![]:!![],'where':_0x549b25[_0x26c7('0x15')]?_0x549b25[_0x26c7('0x15')][_0x26c7('0x16')]||null:null,'attributes':_0x549b25[_0x26c7('0x15')]?_0x549b25['options'][_0x26c7('0x17')]||null:null,'include':_0x549b25[_0x26c7('0x15')]?_0x549b25[_0x26c7('0x15')][_0x26c7('0x18')]?_['map'](_0x549b25[_0x26c7('0x15')][_0x26c7('0x18')],function(_0x664d06){return{'model':db[_0x664d06[_0x26c7('0x1a')]],'as':_0x664d06['as'],'attributes':_0x664d06[_0x26c7('0x17')],'include':_0x664d06['include']?_['map'](_0x664d06[_0x26c7('0x18')],function(_0x35a008){return{'model':db[_0x35a008[_0x26c7('0x1a')]],'as':_0x35a008['as'],'attributes':_0x35a008[_0x26c7('0x17')],'include':_0x35a008['include']?_[_0x26c7('0x19')](_0x35a008[_0x26c7('0x18')],function(_0x50344e){return{'model':db[_0x50344e[_0x26c7('0x1a')]],'as':_0x50344e['as'],'attributes':_0x50344e[_0x26c7('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dca45){logger[_0x26c7('0x10')](_0x26c7('0x1c'),_0x549b25);logger['debug'](_0x26c7('0x1c'),_0x549b25,JSON['stringify'](_0x4dca45));_0x2c5240(_0x4dca45);})[_0x26c7('0x1f')](function(_0x558c6c){logger['error']('ShowSalesforceAccount',_0x558c6c[_0x26c7('0xf')],_0x549b25);_0x1922fe(_0x2ace37['error'](0x1f4,_0x558c6c[_0x26c7('0xf')]));});});}; \ No newline at end of file +var _0x228a=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetSalesforceAccount','options','raw','where','include','map','model','attributes','stringify','ShowSalesforceAccount','SalesforceAccount','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1ab88f,_0x14a0e5){var _0x5710a6=function(_0x1ccc6a){while(--_0x1ccc6a){_0x1ab88f['push'](_0x1ab88f['shift']());}};_0x5710a6(++_0x14a0e5);}(_0x228a,0xef));var _0xa228=function(_0x4641cb,_0x5dec84){_0x4641cb=_0x4641cb-0x0;var _0x24f723=_0x228a[_0x4641cb];return _0x24f723;};'use strict';var _=require(_0xa228('0x0'));var util=require(_0xa228('0x1'));var moment=require(_0xa228('0x2'));var BPromise=require(_0xa228('0x3'));var rs=require(_0xa228('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa228('0x5'))['db'];var utils=require(_0xa228('0x6'));var logger=require('../../config/logger')(_0xa228('0x7'));var config=require(_0xa228('0x8'));var jayson=require(_0xa228('0x9'));var client=jayson[_0xa228('0xa')][_0xa228('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x459b0b,_0x383119,_0x3292d3){return new BPromise(function(_0x2ddede,_0x53a59a){return client[_0xa228('0xc')](_0x459b0b,_0x3292d3)[_0xa228('0xd')](function(_0x4e890b){logger[_0xa228('0xe')](_0xa228('0xf'),_0x383119,'request\x20sent');logger[_0xa228('0x10')](_0xa228('0x11'),_0x383119,_0xa228('0x12'),JSON['stringify'](_0x4e890b));if(_0x4e890b[_0xa228('0x13')]){if(_0x4e890b[_0xa228('0x13')][_0xa228('0x14')]===0x1f4){logger['error'](_0xa228('0xf'),_0x383119,_0x4e890b['error']['message']);return _0x53a59a(_0x4e890b[_0xa228('0x13')][_0xa228('0x15')]);}logger[_0xa228('0x13')](_0xa228('0xf'),_0x383119,_0x4e890b['error'][_0xa228('0x15')]);return _0x2ddede(_0x4e890b['error'][_0xa228('0x15')]);}else{logger[_0xa228('0xe')](_0xa228('0xf'),_0x383119,'request\x20sent');_0x2ddede(_0x4e890b[_0xa228('0x16')]['message']);}})['catch'](function(_0x4c07fd){logger[_0xa228('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x383119,_0x4c07fd);_0x53a59a(_0x4c07fd);});});}exports[_0xa228('0x17')]=function(_0x1989b6){var _0x11ff54=this;return new Promise(function(_0x23e3c9,_0x2e14cc){return db['SalesforceAccount']['findAll']({'raw':_0x1989b6[_0xa228('0x18')]?_0x1989b6['options'][_0xa228('0x19')]===undefined?!![]:![]:!![],'where':_0x1989b6[_0xa228('0x18')]?_0x1989b6[_0xa228('0x18')][_0xa228('0x1a')]||null:null,'attributes':_0x1989b6['options']?_0x1989b6[_0xa228('0x18')]['attributes']||null:null,'limit':_0x1989b6[_0xa228('0x18')]?_0x1989b6[_0xa228('0x18')]['limit']||null:null,'include':_0x1989b6[_0xa228('0x18')]?_0x1989b6[_0xa228('0x18')][_0xa228('0x1b')]?_[_0xa228('0x1c')](_0x1989b6['options'][_0xa228('0x1b')],function(_0x17b039){return{'model':db[_0x17b039[_0xa228('0x1d')]],'as':_0x17b039['as'],'attributes':_0x17b039['attributes'],'include':_0x17b039[_0xa228('0x1b')]?_['map'](_0x17b039[_0xa228('0x1b')],function(_0x23bebc){return{'model':db[_0x23bebc['model']],'as':_0x23bebc['as'],'attributes':_0x23bebc[_0xa228('0x1e')],'include':_0x23bebc[_0xa228('0x1b')]?_[_0xa228('0x1c')](_0x23bebc[_0xa228('0x1b')],function(_0x26b5e6){return{'model':db[_0x26b5e6[_0xa228('0x1d')]],'as':_0x26b5e6['as'],'attributes':_0x26b5e6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31f771){logger[_0xa228('0xe')]('GetSalesforceAccount',_0x1989b6);logger[_0xa228('0x10')](_0xa228('0x17'),_0x1989b6,JSON[_0xa228('0x1f')](_0x31f771));_0x23e3c9(_0x31f771);})['catch'](function(_0x161a15){logger[_0xa228('0x13')]('GetSalesforceAccount',_0x161a15[_0xa228('0x15')],_0x1989b6);_0x2e14cc(_0x11ff54[_0xa228('0x13')](0x1f4,_0x161a15[_0xa228('0x15')]));});});};exports[_0xa228('0x20')]=function(_0x3c77bf){var _0x394d07=this;return new Promise(function(_0x38142f,_0x1c9a2c){return db[_0xa228('0x21')]['find']({'raw':_0x3c77bf[_0xa228('0x18')]?_0x3c77bf[_0xa228('0x18')][_0xa228('0x19')]===undefined?!![]:![]:!![],'where':_0x3c77bf[_0xa228('0x18')]?_0x3c77bf[_0xa228('0x18')][_0xa228('0x1a')]||null:null,'attributes':_0x3c77bf[_0xa228('0x18')]?_0x3c77bf['options']['attributes']||null:null,'include':_0x3c77bf[_0xa228('0x18')]?_0x3c77bf[_0xa228('0x18')]['include']?_[_0xa228('0x1c')](_0x3c77bf[_0xa228('0x18')]['include'],function(_0x432922){return{'model':db[_0x432922[_0xa228('0x1d')]],'as':_0x432922['as'],'attributes':_0x432922[_0xa228('0x1e')],'include':_0x432922[_0xa228('0x1b')]?_[_0xa228('0x1c')](_0x432922[_0xa228('0x1b')],function(_0x46b146){return{'model':db[_0x46b146[_0xa228('0x1d')]],'as':_0x46b146['as'],'attributes':_0x46b146[_0xa228('0x1e')],'include':_0x46b146[_0xa228('0x1b')]?_[_0xa228('0x1c')](_0x46b146[_0xa228('0x1b')],function(_0x366d87){return{'model':db[_0x366d87[_0xa228('0x1d')]],'as':_0x366d87['as'],'attributes':_0x366d87['attributes']};}):[]};}):[]};}):[]:[]})[_0xa228('0xd')](function(_0x559a01){logger[_0xa228('0xe')]('ShowSalesforceAccount',_0x3c77bf);logger['debug'](_0xa228('0x20'),_0x3c77bf,JSON[_0xa228('0x1f')](_0x559a01));_0x38142f(_0x559a01);})[_0xa228('0x22')](function(_0x18392c){logger[_0xa228('0x13')](_0xa228('0x20'),_0x18392c[_0xa228('0x15')],_0x3c77bf);_0x1c9a2c(_0x394d07[_0xa228('0x13')](0x1f4,_0x18392c[_0xa228('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 81c15c8..47f779c 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdb28,0x106));var _0x8db2=function(_0x4cd695,_0x24a204){_0x4cd695=_0x4cd695-0x0;var _0x3d4946=_0xdb28[_0x4cd695];return _0x3d4946;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2e5c79,_0x40b6e8){var _0x5af2ea=function(_0x318abc){while(--_0x318abc){_0x2e5c79['push'](_0x2e5c79['shift']());}};_0x5af2ea(++_0x40b6e8);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ee2fa,_0x6e7679){_0x4ee2fa=_0x4ee2fa-0x0;var _0x286c15=_0x2ef3[_0x4ee2fa];return _0x286c15;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9b36d83..9c490ac 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 _0xfdc9=['Task','Case','ENUM','contact_lead','contact','lead','account','nothing','STRING'];(function(_0xb63a4f,_0x6d00fa){var _0x27ce23=function(_0x411460){while(--_0x411460){_0xb63a4f['push'](_0xb63a4f['shift']());}};_0x27ce23(++_0x6d00fa);}(_0xfdc9,0xe9));var _0x9fdc=function(_0x31eddb,_0x2c3ee5){_0x31eddb=_0x31eddb-0x0;var _0x123e0d=_0xfdc9[_0x31eddb];return _0x123e0d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9fdc('0x0')]},'description':{'type':Sequelize[_0x9fdc('0x0')]},'ticketType':{'type':Sequelize['ENUM'](_0x9fdc('0x1'),_0x9fdc('0x2')),'defaultValue':_0x9fdc('0x1')},'moduleSearch':{'type':Sequelize[_0x9fdc('0x3')](_0x9fdc('0x4'),_0x9fdc('0x5'),_0x9fdc('0x6'),'account_contact_lead',_0x9fdc('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x9fdc('0x3')](_0x9fdc('0x8'),'contact',_0x9fdc('0x6'),_0x9fdc('0x7')),'defaultValue':_0x9fdc('0x6')},'leadId':{'type':Sequelize[_0x9fdc('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0x9fdc('0x0')]},'additionalSearchContact':{'type':Sequelize[_0x9fdc('0x0')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7b4b=['ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x7b4b,0x141));var _0xb7b4=function(_0x5d9ceb,_0x1a49f5){_0x5d9ceb=_0x5d9ceb-0x0;var _0x33ce82=_0x7b4b[_0x5d9ceb];return _0x33ce82;};'use strict';var Sequelize=require(_0xb7b4('0x0'));module[_0xb7b4('0x1')]={'name':{'type':Sequelize[_0xb7b4('0x2')]},'description':{'type':Sequelize[_0xb7b4('0x2')]},'ticketType':{'type':Sequelize[_0xb7b4('0x3')](_0xb7b4('0x4'),_0xb7b4('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xb7b4('0x3')](_0xb7b4('0x6'),_0xb7b4('0x7'),_0xb7b4('0x8'),_0xb7b4('0x9'),_0xb7b4('0xa')),'defaultValue':_0xb7b4('0x6')},'moduleCreate':{'type':Sequelize[_0xb7b4('0x3')](_0xb7b4('0xb'),_0xb7b4('0x7'),_0xb7b4('0x8'),'account'),'defaultValue':_0xb7b4('0x8')},'leadId':{'type':Sequelize[_0xb7b4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xb7b4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xb7b4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xb7b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index c6932fd..6259e29 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 _0x38e2=['type','VIRTUAL','options','SalesforceConfiguration','includeAll','include','findAll','catch','show','params','keys','rawAttributes','create','body','find','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1dc879,_0x27fce9){var _0x4c881f=function(_0x496bf1){while(--_0x496bf1){_0x1dc879['push'](_0x1dc879['shift']());}};_0x4c881f(++_0x27fce9);}(_0x38e2,0xff));var _0x238e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x38e2[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x238e('0x0'));var zipdir=require(_0x238e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x238e('0x2'));var BPromise=require(_0x238e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x238e('0x4'));var sox=require(_0x238e('0x5'));var csv=require(_0x238e('0x6'));var ejs=require(_0x238e('0x7'));var fs=require('fs');var fs_extra=require(_0x238e('0x8'));var _=require('lodash');var squel=require(_0x238e('0x9'));var crypto=require(_0x238e('0xa'));var jsforce=require(_0x238e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x238e('0x6'));var querystring=require('querystring');var Papa=require(_0x238e('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x238e('0xd'));var as=require(_0x238e('0xe'));var hardwareService=require(_0x238e('0xf'));var logger=require('../../config/logger')(_0x238e('0x10'));var utils=require(_0x238e('0x11'));var config=require(_0x238e('0x12'));var licenseUtil=require(_0x238e('0x13'));var db=require(_0x238e('0x14'))['db'];function respondWithStatusCode(_0x4adc80,_0x848387){_0x848387=_0x848387||0xcc;return function(_0x5d4ee2){if(_0x5d4ee2){return _0x4adc80[_0x238e('0x15')](_0x848387);}return _0x4adc80[_0x238e('0x16')](_0x848387)[_0x238e('0x17')]();};}function respondWithResult(_0x164131,_0x3d1079){_0x3d1079=_0x3d1079||0xc8;return function(_0x5efda9){if(_0x5efda9){return _0x164131[_0x238e('0x16')](_0x3d1079)[_0x238e('0x18')](_0x5efda9);}};}function respondWithFilteredResult(_0x5be8b9,_0x52c321){return function(_0x12a96c){if(_0x12a96c){var _0x1016d9=typeof _0x52c321['offset']===_0x238e('0x19')&&typeof _0x52c321[_0x238e('0x1a')]===_0x238e('0x19');var _0x2c5abe=_0x12a96c[_0x238e('0x1b')];var _0x2127da=_0x1016d9?0x0:_0x52c321[_0x238e('0x1c')];var _0x350ca8=_0x1016d9?_0x12a96c['count']:_0x52c321[_0x238e('0x1c')]+_0x52c321[_0x238e('0x1a')];var _0x24f70a;if(_0x350ca8>=_0x2c5abe){_0x350ca8=_0x2c5abe;_0x24f70a=0xc8;}else{_0x24f70a=0xce;}_0x5be8b9[_0x238e('0x16')](_0x24f70a);return _0x5be8b9[_0x238e('0x1d')](_0x238e('0x1e'),_0x2127da+'-'+_0x350ca8+'/'+_0x2c5abe)[_0x238e('0x18')](_0x12a96c);}return null;};}function patchUpdates(_0x16ce46){return function(_0x492c5c){try{jsonpatch['apply'](_0x492c5c,_0x16ce46,!![]);}catch(_0x34dd67){return BPromise[_0x238e('0x1f')](_0x34dd67);}return _0x492c5c[_0x238e('0x20')]();};}function saveUpdates(_0x56cefa,_0x2b040e){return function(_0x175fe9){if(_0x175fe9){return _0x175fe9[_0x238e('0x21')](_0x56cefa)[_0x238e('0x22')](function(_0x1bbfc2){return _0x1bbfc2;});}return null;};}function removeEntity(_0x606443,_0x344726){return function(_0x27123d){if(_0x27123d){return _0x27123d[_0x238e('0x23')]()[_0x238e('0x22')](function(){_0x606443['status'](0xcc)[_0x238e('0x17')]();});}};}function handleEntityNotFound(_0x4055f5,_0x2c77fd){return function(_0x50e406){if(!_0x50e406){_0x4055f5[_0x238e('0x15')](0x194);}return _0x50e406;};}function handleError(_0x3a2b2d,_0x46b95b){_0x46b95b=_0x46b95b||0x1f4;return function(_0x1ad6a7){logger['error'](_0x1ad6a7[_0x238e('0x24')]);if(_0x1ad6a7['name']){delete _0x1ad6a7[_0x238e('0x25')];}_0x3a2b2d[_0x238e('0x16')](_0x46b95b)[_0x238e('0x26')](_0x1ad6a7);};}exports[_0x238e('0x27')]=function(_0x517c29,_0x570f32){var _0x5c7370={},_0xe9f680={},_0x2f0c6b={'count':0x0,'rows':[]};var _0x460706=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x3c773c){return{'name':_0x3c773c[_0x238e('0x28')],'type':_0x3c773c['type'][_0x238e('0x29')]};});_0xe9f680['model']=_[_0x238e('0x2a')](_0x460706,_0x238e('0x25'));_0xe9f680[_0x238e('0x2b')]=_['keys'](_0x517c29[_0x238e('0x2b')]);_0xe9f680[_0x238e('0x2c')]=_[_0x238e('0x2d')](_0xe9f680[_0x238e('0x2e')],_0xe9f680[_0x238e('0x2b')]);_0x5c7370[_0x238e('0x2f')]=_[_0x238e('0x2d')](_0xe9f680[_0x238e('0x2e')],qs[_0x238e('0x30')](_0x517c29['query'][_0x238e('0x30')]));_0x5c7370['attributes']=_0x5c7370[_0x238e('0x2f')][_0x238e('0x31')]?_0x5c7370[_0x238e('0x2f')]:_0xe9f680[_0x238e('0x2e')];if(!_0x517c29[_0x238e('0x2b')]['hasOwnProperty'](_0x238e('0x32'))){_0x5c7370[_0x238e('0x1a')]=qs['limit'](_0x517c29[_0x238e('0x2b')][_0x238e('0x1a')]);_0x5c7370['offset']=qs[_0x238e('0x1c')](_0x517c29[_0x238e('0x2b')][_0x238e('0x1c')]);}_0x5c7370[_0x238e('0x33')]=qs[_0x238e('0x34')](_0x517c29[_0x238e('0x2b')][_0x238e('0x34')]);_0x5c7370[_0x238e('0x35')]=qs[_0x238e('0x2c')](_[_0x238e('0x36')](_0x517c29['query'],_0xe9f680[_0x238e('0x2c')]),_0x460706);if(_0x517c29[_0x238e('0x2b')][_0x238e('0x37')]){_0x5c7370[_0x238e('0x35')]=_[_0x238e('0x38')](_0x5c7370[_0x238e('0x35')],{'$or':_['map'](_0x460706,function(_0x40c3a4){if(_0x40c3a4[_0x238e('0x39')]!==_0x238e('0x3a')){var _0x2af5c0={};_0x2af5c0[_0x40c3a4[_0x238e('0x25')]]={'$like':'%'+_0x517c29[_0x238e('0x2b')]['filter']+'%'};return _0x2af5c0;}})});}_0x5c7370=_[_0x238e('0x38')]({},_0x5c7370,_0x517c29[_0x238e('0x3b')]);var _0x89d96c={'where':_0x5c7370[_0x238e('0x35')]};return db[_0x238e('0x3c')]['count'](_0x89d96c)[_0x238e('0x22')](function(_0x57844e){_0x2f0c6b[_0x238e('0x1b')]=_0x57844e;if(_0x517c29['query'][_0x238e('0x3d')]){_0x5c7370[_0x238e('0x3e')]=[{'all':!![]}];}return db[_0x238e('0x3c')][_0x238e('0x3f')](_0x5c7370);})['then'](function(_0x11bba2){_0x2f0c6b['rows']=_0x11bba2;return _0x2f0c6b;})[_0x238e('0x22')](respondWithFilteredResult(_0x570f32,_0x5c7370))[_0x238e('0x40')](handleError(_0x570f32,null));};exports[_0x238e('0x41')]=function(_0x31e637,_0x11f7e8){var _0x580db1={'raw':![],'where':{'id':_0x31e637[_0x238e('0x42')]['id']}},_0x389a7e={};_0x389a7e['model']=_[_0x238e('0x43')](db[_0x238e('0x3c')][_0x238e('0x44')]);_0x389a7e['query']=_[_0x238e('0x43')](_0x31e637[_0x238e('0x2b')]);_0x389a7e[_0x238e('0x2c')]=_['intersection'](_0x389a7e['model'],_0x389a7e[_0x238e('0x2b')]);_0x580db1[_0x238e('0x2f')]=_[_0x238e('0x2d')](_0x389a7e[_0x238e('0x2e')],qs[_0x238e('0x30')](_0x31e637[_0x238e('0x2b')][_0x238e('0x30')]));_0x580db1['attributes']=_0x580db1[_0x238e('0x2f')][_0x238e('0x31')]?_0x580db1[_0x238e('0x2f')]:_0x389a7e[_0x238e('0x2e')];if(_0x31e637[_0x238e('0x2b')][_0x238e('0x3d')]){_0x580db1[_0x238e('0x3e')]=[{'all':!![]}];}_0x580db1=_[_0x238e('0x38')]({},_0x580db1,_0x31e637[_0x238e('0x3b')]);return db[_0x238e('0x3c')]['find'](_0x580db1)[_0x238e('0x22')](handleEntityNotFound(_0x11f7e8,null))[_0x238e('0x22')](respondWithResult(_0x11f7e8,null))[_0x238e('0x40')](handleError(_0x11f7e8,null));};exports[_0x238e('0x45')]=function(_0x1d074e,_0x3f7db0){return db[_0x238e('0x3c')][_0x238e('0x45')](_0x1d074e[_0x238e('0x46')],{})['then'](respondWithResult(_0x3f7db0,0xc9))[_0x238e('0x40')](handleError(_0x3f7db0,null));};exports[_0x238e('0x21')]=function(_0x250666,_0x37dd29){if(_0x250666[_0x238e('0x46')]['id']){delete _0x250666[_0x238e('0x46')]['id'];}return db[_0x238e('0x3c')][_0x238e('0x47')]({'where':{'id':_0x250666[_0x238e('0x42')]['id']}})[_0x238e('0x22')](handleEntityNotFound(_0x37dd29,null))['then'](saveUpdates(_0x250666[_0x238e('0x46')],null))[_0x238e('0x22')](respondWithResult(_0x37dd29,null))[_0x238e('0x40')](handleError(_0x37dd29,null));};exports['destroy']=function(_0xe3784c,_0x6492f8){return db[_0x238e('0x3c')][_0x238e('0x47')]({'where':{'id':_0xe3784c[_0x238e('0x42')]['id']}})[_0x238e('0x22')](handleEntityNotFound(_0x6492f8,null))[_0x238e('0x22')](removeEntity(_0x6492f8,null))[_0x238e('0x40')](handleError(_0x6492f8,null));};exports[_0x238e('0x48')]=function(_0x2e5a54,_0x389c80,_0x5b17e8){var _0x467db7={};var _0x15599b={};var _0x5a4a52;var _0x16b08e;return db[_0x238e('0x3c')][_0x238e('0x49')]({'where':{'id':_0x2e5a54[_0x238e('0x42')]['id']}})[_0x238e('0x22')](handleEntityNotFound(_0x389c80,null))['then'](function(_0x3d519d){if(_0x3d519d){_0x5a4a52=_0x3d519d;_0x15599b[_0x238e('0x2e')]=_[_0x238e('0x43')](db[_0x238e('0x4a')][_0x238e('0x44')]);_0x15599b['query']=_[_0x238e('0x43')](_0x2e5a54[_0x238e('0x2b')]);_0x15599b[_0x238e('0x2c')]=_[_0x238e('0x2d')](_0x15599b['model'],_0x15599b['query']);_0x467db7[_0x238e('0x2f')]=_['intersection'](_0x15599b[_0x238e('0x2e')],qs[_0x238e('0x30')](_0x2e5a54['query'][_0x238e('0x30')]));_0x467db7[_0x238e('0x2f')]=_0x467db7['attributes']['length']?_0x467db7[_0x238e('0x2f')]:_0x15599b[_0x238e('0x2e')];_0x467db7[_0x238e('0x33')]=qs['sort'](_0x2e5a54[_0x238e('0x2b')][_0x238e('0x34')]);_0x467db7['where']=qs[_0x238e('0x2c')](_[_0x238e('0x36')](_0x2e5a54[_0x238e('0x2b')],_0x15599b[_0x238e('0x2c')]));if(_0x2e5a54['query'][_0x238e('0x37')]){_0x467db7['where']=_[_0x238e('0x38')](_0x467db7[_0x238e('0x35')],{'$or':_['map'](_0x467db7['attributes'],function(_0x542763){var _0x155461={};_0x155461[_0x542763]={'$like':'%'+_0x2e5a54['query'][_0x238e('0x37')]+'%'};return _0x155461;})});}_0x467db7=_[_0x238e('0x38')]({},_0x467db7,_0x2e5a54[_0x238e('0x3b')]);return _0x5a4a52[_0x238e('0x48')](_0x467db7);}})[_0x238e('0x22')](function(_0x117f51){if(_0x117f51){_0x16b08e=_0x117f51[_0x238e('0x31')];if(!_0x2e5a54[_0x238e('0x2b')][_0x238e('0x4b')]('nolimit')){_0x467db7[_0x238e('0x1a')]=qs[_0x238e('0x1a')](_0x2e5a54[_0x238e('0x2b')][_0x238e('0x1a')]);_0x467db7[_0x238e('0x1c')]=qs[_0x238e('0x1c')](_0x2e5a54[_0x238e('0x2b')][_0x238e('0x1c')]);}return _0x5a4a52[_0x238e('0x48')](_0x467db7);}})['then'](function(_0xdcad7b){if(_0xdcad7b){return _0xdcad7b?{'count':_0x16b08e,'rows':_0xdcad7b}:null;}})['then'](respondWithResult(_0x389c80,null))[_0x238e('0x40')](handleError(_0x389c80,null));};exports[_0x238e('0x4c')]=function(_0x403224,_0x545110,_0x52545d){var _0x41d5db={};var _0x594e1d={};var _0x145397;var _0x66ded1;return db[_0x238e('0x3c')][_0x238e('0x49')]({'where':{'id':_0x403224[_0x238e('0x42')]['id']}})['then'](handleEntityNotFound(_0x545110,null))['then'](function(_0xaafccc){if(_0xaafccc){_0x145397=_0xaafccc;_0x594e1d['model']=_[_0x238e('0x43')](db[_0x238e('0x4a')]['rawAttributes']);_0x594e1d[_0x238e('0x2b')]=_[_0x238e('0x43')](_0x403224[_0x238e('0x2b')]);_0x594e1d['filters']=_[_0x238e('0x2d')](_0x594e1d[_0x238e('0x2e')],_0x594e1d[_0x238e('0x2b')]);_0x41d5db[_0x238e('0x2f')]=_[_0x238e('0x2d')](_0x594e1d[_0x238e('0x2e')],qs[_0x238e('0x30')](_0x403224['query']['fields']));_0x41d5db[_0x238e('0x2f')]=_0x41d5db[_0x238e('0x2f')][_0x238e('0x31')]?_0x41d5db['attributes']:_0x594e1d[_0x238e('0x2e')];_0x41d5db[_0x238e('0x33')]=qs[_0x238e('0x34')](_0x403224[_0x238e('0x2b')][_0x238e('0x34')]);_0x41d5db[_0x238e('0x35')]=qs['filters'](_['pick'](_0x403224[_0x238e('0x2b')],_0x594e1d['filters']));if(_0x403224[_0x238e('0x2b')][_0x238e('0x37')]){_0x41d5db[_0x238e('0x35')]=_['merge'](_0x41d5db[_0x238e('0x35')],{'$or':_[_0x238e('0x2a')](_0x41d5db[_0x238e('0x2f')],function(_0x8535e1){var _0x11336a={};_0x11336a[_0x8535e1]={'$like':'%'+_0x403224[_0x238e('0x2b')][_0x238e('0x37')]+'%'};return _0x11336a;})});}_0x41d5db=_[_0x238e('0x38')]({},_0x41d5db,_0x403224[_0x238e('0x3b')]);return _0x145397[_0x238e('0x4c')](_0x41d5db);}})[_0x238e('0x22')](function(_0x365237){if(_0x365237){_0x66ded1=_0x365237['length'];if(!_0x403224[_0x238e('0x2b')]['hasOwnProperty'](_0x238e('0x32'))){_0x41d5db[_0x238e('0x1a')]=qs[_0x238e('0x1a')](_0x403224['query'][_0x238e('0x1a')]);_0x41d5db[_0x238e('0x1c')]=qs[_0x238e('0x1c')](_0x403224[_0x238e('0x2b')][_0x238e('0x1c')]);}return _0x145397['getSubjects'](_0x41d5db);}})[_0x238e('0x22')](function(_0x5f0472){if(_0x5f0472){return _0x5f0472?{'count':_0x66ded1,'rows':_0x5f0472}:null;}})[_0x238e('0x22')](respondWithResult(_0x545110,null))[_0x238e('0x40')](handleError(_0x545110,null));};exports[_0x238e('0x4d')]=function(_0x3c0c09,_0xe27016,_0x57a382){var _0x5c2afc={};var _0x3a8e2a={};var _0xa9678d;var _0x512985;return db[_0x238e('0x3c')]['findOne']({'where':{'id':_0x3c0c09[_0x238e('0x42')]['id']}})[_0x238e('0x22')](handleEntityNotFound(_0xe27016,null))['then'](function(_0x2f96f9){if(_0x2f96f9){_0xa9678d=_0x2f96f9;_0x3a8e2a[_0x238e('0x2e')]=_[_0x238e('0x43')](db[_0x238e('0x4a')][_0x238e('0x44')]);_0x3a8e2a[_0x238e('0x2b')]=_[_0x238e('0x43')](_0x3c0c09['query']);_0x3a8e2a[_0x238e('0x2c')]=_[_0x238e('0x2d')](_0x3a8e2a['model'],_0x3a8e2a[_0x238e('0x2b')]);_0x5c2afc[_0x238e('0x2f')]=_['intersection'](_0x3a8e2a['model'],qs[_0x238e('0x30')](_0x3c0c09[_0x238e('0x2b')]['fields']));_0x5c2afc[_0x238e('0x2f')]=_0x5c2afc[_0x238e('0x2f')][_0x238e('0x31')]?_0x5c2afc[_0x238e('0x2f')]:_0x3a8e2a[_0x238e('0x2e')];_0x5c2afc[_0x238e('0x33')]=qs[_0x238e('0x34')](_0x3c0c09[_0x238e('0x2b')][_0x238e('0x34')]);_0x5c2afc[_0x238e('0x35')]=qs['filters'](_[_0x238e('0x36')](_0x3c0c09[_0x238e('0x2b')],_0x3a8e2a[_0x238e('0x2c')]));if(_0x3c0c09['query'][_0x238e('0x37')]){_0x5c2afc['where']=_[_0x238e('0x38')](_0x5c2afc['where'],{'$or':_[_0x238e('0x2a')](_0x5c2afc['attributes'],function(_0x311407){var _0x3d9ba7={};_0x3d9ba7[_0x311407]={'$like':'%'+_0x3c0c09[_0x238e('0x2b')][_0x238e('0x37')]+'%'};return _0x3d9ba7;})});}_0x5c2afc=_[_0x238e('0x38')]({},_0x5c2afc,_0x3c0c09[_0x238e('0x3b')]);return _0xa9678d[_0x238e('0x4d')](_0x5c2afc);}})['then'](function(_0x560d07){if(_0x560d07){_0x512985=_0x560d07[_0x238e('0x31')];if(!_0x3c0c09['query']['hasOwnProperty'](_0x238e('0x32'))){_0x5c2afc[_0x238e('0x1a')]=qs[_0x238e('0x1a')](_0x3c0c09[_0x238e('0x2b')][_0x238e('0x1a')]);_0x5c2afc[_0x238e('0x1c')]=qs[_0x238e('0x1c')](_0x3c0c09[_0x238e('0x2b')][_0x238e('0x1c')]);}return _0xa9678d[_0x238e('0x4d')](_0x5c2afc);}})[_0x238e('0x22')](function(_0x14cf26){if(_0x14cf26){return _0x14cf26?{'count':_0x512985,'rows':_0x14cf26}:null;}})['then'](respondWithResult(_0xe27016,null))[_0x238e('0x40')](handleError(_0xe27016,null));}; \ No newline at end of file +var _0xe59a=['catch','create','body','find','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length'];(function(_0x5e3ec0,_0x431765){var _0x201153=function(_0x4a80df){while(--_0x4a80df){_0x5e3ec0['push'](_0x5e3ec0['shift']());}};_0x201153(++_0x431765);}(_0xe59a,0x19f));var _0xae59=function(_0x24b4ba,_0x4373b8){_0x24b4ba=_0x24b4ba-0x0;var _0x2558a2=_0xe59a[_0x24b4ba];return _0x2558a2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae59('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae59('0x1'));var moment=require(_0xae59('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xae59('0x3'));var util=require(_0xae59('0x4'));var path=require(_0xae59('0x5'));var sox=require('sox');var csv=require(_0xae59('0x6'));var ejs=require(_0xae59('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae59('0x8'));var squel=require(_0xae59('0x9'));var crypto=require(_0xae59('0xa'));var jsforce=require(_0xae59('0xb'));var deskjs=require(_0xae59('0xc'));var toCsv=require(_0xae59('0x6'));var querystring=require(_0xae59('0xd'));var Papa=require(_0xae59('0xe'));var Redis=require(_0xae59('0xf'));var authService=require(_0xae59('0x10'));var qs=require(_0xae59('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae59('0x12'));var logger=require(_0xae59('0x13'))('api');var utils=require(_0xae59('0x14'));var config=require(_0xae59('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xae59('0x16'))['db'];function respondWithStatusCode(_0x580a56,_0x37834c){_0x37834c=_0x37834c||0xcc;return function(_0x175e9e){if(_0x175e9e){return _0x580a56[_0xae59('0x17')](_0x37834c);}return _0x580a56[_0xae59('0x18')](_0x37834c)[_0xae59('0x19')]();};}function respondWithResult(_0x5bb177,_0x78c798){_0x78c798=_0x78c798||0xc8;return function(_0x266dfb){if(_0x266dfb){return _0x5bb177['status'](_0x78c798)[_0xae59('0x1a')](_0x266dfb);}};}function respondWithFilteredResult(_0x37df80,_0x340447){return function(_0x17dce6){if(_0x17dce6){var _0x4f9cde=typeof _0x340447['offset']===_0xae59('0x1b')&&typeof _0x340447[_0xae59('0x1c')]===_0xae59('0x1b');var _0x17d105=_0x17dce6[_0xae59('0x1d')];var _0x55c512=_0x4f9cde?0x0:_0x340447[_0xae59('0x1e')];var _0x1afb13=_0x4f9cde?_0x17dce6[_0xae59('0x1d')]:_0x340447[_0xae59('0x1e')]+_0x340447[_0xae59('0x1c')];var _0x247fc7;if(_0x1afb13>=_0x17d105){_0x1afb13=_0x17d105;_0x247fc7=0xc8;}else{_0x247fc7=0xce;}_0x37df80[_0xae59('0x18')](_0x247fc7);return _0x37df80['set'](_0xae59('0x1f'),_0x55c512+'-'+_0x1afb13+'/'+_0x17d105)[_0xae59('0x1a')](_0x17dce6);}return null;};}function patchUpdates(_0x244f36){return function(_0x4cecc2){try{jsonpatch[_0xae59('0x20')](_0x4cecc2,_0x244f36,!![]);}catch(_0x43617a){return BPromise[_0xae59('0x21')](_0x43617a);}return _0x4cecc2['save']();};}function saveUpdates(_0x395f00,_0x2e9a3d){return function(_0x229530){if(_0x229530){return _0x229530[_0xae59('0x22')](_0x395f00)[_0xae59('0x23')](function(_0xde809a){return _0xde809a;});}return null;};}function removeEntity(_0x42b928,_0x420848){return function(_0x376511){if(_0x376511){return _0x376511[_0xae59('0x24')]()[_0xae59('0x23')](function(){_0x42b928[_0xae59('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d8a1,_0x30925d){return function(_0xd9d6ad){if(!_0xd9d6ad){_0x19d8a1[_0xae59('0x17')](0x194);}return _0xd9d6ad;};}function handleError(_0x14cf6a,_0x3063ce){_0x3063ce=_0x3063ce||0x1f4;return function(_0x4f8b9c){logger[_0xae59('0x25')](_0x4f8b9c[_0xae59('0x26')]);if(_0x4f8b9c[_0xae59('0x27')]){delete _0x4f8b9c[_0xae59('0x27')];}_0x14cf6a['status'](_0x3063ce)[_0xae59('0x28')](_0x4f8b9c);};}exports[_0xae59('0x29')]=function(_0x44ae17,_0x3127cb){var _0xddc205={},_0x32d78b={},_0x2b56b1={'count':0x0,'rows':[]};var _0x270253=_[_0xae59('0x2a')](db[_0xae59('0x2b')][_0xae59('0x2c')],function(_0x44e4cc){return{'name':_0x44e4cc[_0xae59('0x2d')],'type':_0x44e4cc['type'][_0xae59('0x2e')]};});_0x32d78b[_0xae59('0x2f')]=_[_0xae59('0x2a')](_0x270253,_0xae59('0x27'));_0x32d78b[_0xae59('0x30')]=_[_0xae59('0x31')](_0x44ae17[_0xae59('0x30')]);_0x32d78b[_0xae59('0x32')]=_[_0xae59('0x33')](_0x32d78b[_0xae59('0x2f')],_0x32d78b['query']);_0xddc205['attributes']=_[_0xae59('0x33')](_0x32d78b[_0xae59('0x2f')],qs[_0xae59('0x34')](_0x44ae17['query'][_0xae59('0x34')]));_0xddc205[_0xae59('0x35')]=_0xddc205[_0xae59('0x35')]['length']?_0xddc205[_0xae59('0x35')]:_0x32d78b['model'];if(!_0x44ae17[_0xae59('0x30')][_0xae59('0x36')](_0xae59('0x37'))){_0xddc205[_0xae59('0x1c')]=qs[_0xae59('0x1c')](_0x44ae17['query'][_0xae59('0x1c')]);_0xddc205[_0xae59('0x1e')]=qs['offset'](_0x44ae17[_0xae59('0x30')]['offset']);}_0xddc205['order']=qs[_0xae59('0x38')](_0x44ae17[_0xae59('0x30')][_0xae59('0x38')]);_0xddc205['where']=qs[_0xae59('0x32')](_[_0xae59('0x39')](_0x44ae17[_0xae59('0x30')],_0x32d78b[_0xae59('0x32')]),_0x270253);if(_0x44ae17[_0xae59('0x30')][_0xae59('0x3a')]){_0xddc205[_0xae59('0x3b')]=_[_0xae59('0x3c')](_0xddc205[_0xae59('0x3b')],{'$or':_[_0xae59('0x2a')](_0x270253,function(_0x57a068){if(_0x57a068[_0xae59('0x3d')]!==_0xae59('0x3e')){var _0x1a6e5a={};_0x1a6e5a[_0x57a068[_0xae59('0x27')]]={'$like':'%'+_0x44ae17[_0xae59('0x30')]['filter']+'%'};return _0x1a6e5a;}})});}_0xddc205=_[_0xae59('0x3c')]({},_0xddc205,_0x44ae17[_0xae59('0x3f')]);var _0x4a997e={'where':_0xddc205['where']};return db['SalesforceConfiguration'][_0xae59('0x1d')](_0x4a997e)[_0xae59('0x23')](function(_0xa04794){_0x2b56b1[_0xae59('0x1d')]=_0xa04794;if(_0x44ae17[_0xae59('0x30')][_0xae59('0x40')]){_0xddc205[_0xae59('0x41')]=[{'all':!![]}];}return db[_0xae59('0x2b')][_0xae59('0x42')](_0xddc205);})[_0xae59('0x23')](function(_0x420926){_0x2b56b1[_0xae59('0x43')]=_0x420926;return _0x2b56b1;})[_0xae59('0x23')](respondWithFilteredResult(_0x3127cb,_0xddc205))['catch'](handleError(_0x3127cb,null));};exports[_0xae59('0x44')]=function(_0x72a153,_0x511010){var _0x2884d4={'raw':![],'where':{'id':_0x72a153[_0xae59('0x45')]['id']}},_0x216216={};_0x216216[_0xae59('0x2f')]=_[_0xae59('0x31')](db[_0xae59('0x2b')][_0xae59('0x2c')]);_0x216216[_0xae59('0x30')]=_[_0xae59('0x31')](_0x72a153['query']);_0x216216[_0xae59('0x32')]=_['intersection'](_0x216216['model'],_0x216216[_0xae59('0x30')]);_0x2884d4[_0xae59('0x35')]=_[_0xae59('0x33')](_0x216216[_0xae59('0x2f')],qs[_0xae59('0x34')](_0x72a153['query']['fields']));_0x2884d4[_0xae59('0x35')]=_0x2884d4[_0xae59('0x35')][_0xae59('0x46')]?_0x2884d4[_0xae59('0x35')]:_0x216216[_0xae59('0x2f')];if(_0x72a153['query'][_0xae59('0x40')]){_0x2884d4[_0xae59('0x41')]=[{'all':!![]}];}_0x2884d4=_['merge']({},_0x2884d4,_0x72a153[_0xae59('0x3f')]);return db[_0xae59('0x2b')]['find'](_0x2884d4)[_0xae59('0x23')](handleEntityNotFound(_0x511010,null))['then'](respondWithResult(_0x511010,null))[_0xae59('0x47')](handleError(_0x511010,null));};exports[_0xae59('0x48')]=function(_0x417e01,_0x5ebe8b){return db[_0xae59('0x2b')]['create'](_0x417e01[_0xae59('0x49')],{})['then'](respondWithResult(_0x5ebe8b,0xc9))[_0xae59('0x47')](handleError(_0x5ebe8b,null));};exports['update']=function(_0x45841f,_0x17c2f5){if(_0x45841f[_0xae59('0x49')]['id']){delete _0x45841f[_0xae59('0x49')]['id'];}return db[_0xae59('0x2b')][_0xae59('0x4a')]({'where':{'id':_0x45841f[_0xae59('0x45')]['id']}})['then'](handleEntityNotFound(_0x17c2f5,null))[_0xae59('0x23')](saveUpdates(_0x45841f[_0xae59('0x49')],null))['then'](respondWithResult(_0x17c2f5,null))['catch'](handleError(_0x17c2f5,null));};exports[_0xae59('0x24')]=function(_0x19241e,_0x331d8c){return db[_0xae59('0x2b')]['find']({'where':{'id':_0x19241e['params']['id']}})[_0xae59('0x23')](handleEntityNotFound(_0x331d8c,null))[_0xae59('0x23')](removeEntity(_0x331d8c,null))[_0xae59('0x47')](handleError(_0x331d8c,null));};exports[_0xae59('0x4b')]=function(_0x4f61c4,_0x4e8912,_0x54d960){var _0x1e58e8={};var _0x3c91a={};var _0x4dfb61;var _0x1b7a7f;return db[_0xae59('0x2b')][_0xae59('0x4c')]({'where':{'id':_0x4f61c4['params']['id']}})['then'](handleEntityNotFound(_0x4e8912,null))[_0xae59('0x23')](function(_0x59af3e){if(_0x59af3e){_0x4dfb61=_0x59af3e;_0x3c91a['model']=_['keys'](db[_0xae59('0x4d')][_0xae59('0x2c')]);_0x3c91a['query']=_['keys'](_0x4f61c4[_0xae59('0x30')]);_0x3c91a[_0xae59('0x32')]=_['intersection'](_0x3c91a[_0xae59('0x2f')],_0x3c91a[_0xae59('0x30')]);_0x1e58e8['attributes']=_[_0xae59('0x33')](_0x3c91a[_0xae59('0x2f')],qs[_0xae59('0x34')](_0x4f61c4[_0xae59('0x30')][_0xae59('0x34')]));_0x1e58e8[_0xae59('0x35')]=_0x1e58e8['attributes']['length']?_0x1e58e8[_0xae59('0x35')]:_0x3c91a[_0xae59('0x2f')];_0x1e58e8[_0xae59('0x4e')]=qs[_0xae59('0x38')](_0x4f61c4['query'][_0xae59('0x38')]);_0x1e58e8[_0xae59('0x3b')]=qs[_0xae59('0x32')](_['pick'](_0x4f61c4[_0xae59('0x30')],_0x3c91a[_0xae59('0x32')]));if(_0x4f61c4['query']['filter']){_0x1e58e8['where']=_[_0xae59('0x3c')](_0x1e58e8['where'],{'$or':_[_0xae59('0x2a')](_0x1e58e8[_0xae59('0x35')],function(_0x4534fd){var _0x327d28={};_0x327d28[_0x4534fd]={'$like':'%'+_0x4f61c4[_0xae59('0x30')][_0xae59('0x3a')]+'%'};return _0x327d28;})});}_0x1e58e8=_[_0xae59('0x3c')]({},_0x1e58e8,_0x4f61c4[_0xae59('0x3f')]);return _0x4dfb61[_0xae59('0x4b')](_0x1e58e8);}})['then'](function(_0x458119){if(_0x458119){_0x1b7a7f=_0x458119['length'];if(!_0x4f61c4[_0xae59('0x30')][_0xae59('0x36')](_0xae59('0x37'))){_0x1e58e8[_0xae59('0x1c')]=qs[_0xae59('0x1c')](_0x4f61c4[_0xae59('0x30')][_0xae59('0x1c')]);_0x1e58e8[_0xae59('0x1e')]=qs[_0xae59('0x1e')](_0x4f61c4['query'][_0xae59('0x1e')]);}return _0x4dfb61[_0xae59('0x4b')](_0x1e58e8);}})['then'](function(_0x5ed46d){if(_0x5ed46d){return _0x5ed46d?{'count':_0x1b7a7f,'rows':_0x5ed46d}:null;}})[_0xae59('0x23')](respondWithResult(_0x4e8912,null))[_0xae59('0x47')](handleError(_0x4e8912,null));};exports[_0xae59('0x4f')]=function(_0x50bc22,_0x20115d,_0x3bc127){var _0x4b64db={};var _0x3d3916={};var _0x248844;var _0x367d91;return db[_0xae59('0x2b')]['findOne']({'where':{'id':_0x50bc22[_0xae59('0x45')]['id']}})[_0xae59('0x23')](handleEntityNotFound(_0x20115d,null))[_0xae59('0x23')](function(_0x7e3dde){if(_0x7e3dde){_0x248844=_0x7e3dde;_0x3d3916[_0xae59('0x2f')]=_['keys'](db[_0xae59('0x4d')]['rawAttributes']);_0x3d3916[_0xae59('0x30')]=_[_0xae59('0x31')](_0x50bc22[_0xae59('0x30')]);_0x3d3916[_0xae59('0x32')]=_['intersection'](_0x3d3916[_0xae59('0x2f')],_0x3d3916[_0xae59('0x30')]);_0x4b64db[_0xae59('0x35')]=_[_0xae59('0x33')](_0x3d3916[_0xae59('0x2f')],qs['fields'](_0x50bc22[_0xae59('0x30')][_0xae59('0x34')]));_0x4b64db['attributes']=_0x4b64db[_0xae59('0x35')][_0xae59('0x46')]?_0x4b64db[_0xae59('0x35')]:_0x3d3916[_0xae59('0x2f')];_0x4b64db[_0xae59('0x4e')]=qs[_0xae59('0x38')](_0x50bc22[_0xae59('0x30')][_0xae59('0x38')]);_0x4b64db[_0xae59('0x3b')]=qs['filters'](_[_0xae59('0x39')](_0x50bc22[_0xae59('0x30')],_0x3d3916[_0xae59('0x32')]));if(_0x50bc22['query']['filter']){_0x4b64db[_0xae59('0x3b')]=_[_0xae59('0x3c')](_0x4b64db[_0xae59('0x3b')],{'$or':_[_0xae59('0x2a')](_0x4b64db[_0xae59('0x35')],function(_0x1b8499){var _0x409581={};_0x409581[_0x1b8499]={'$like':'%'+_0x50bc22[_0xae59('0x30')][_0xae59('0x3a')]+'%'};return _0x409581;})});}_0x4b64db=_[_0xae59('0x3c')]({},_0x4b64db,_0x50bc22[_0xae59('0x3f')]);return _0x248844[_0xae59('0x4f')](_0x4b64db);}})['then'](function(_0x10679b){if(_0x10679b){_0x367d91=_0x10679b[_0xae59('0x46')];if(!_0x50bc22[_0xae59('0x30')][_0xae59('0x36')](_0xae59('0x37'))){_0x4b64db['limit']=qs[_0xae59('0x1c')](_0x50bc22[_0xae59('0x30')][_0xae59('0x1c')]);_0x4b64db[_0xae59('0x1e')]=qs[_0xae59('0x1e')](_0x50bc22['query'][_0xae59('0x1e')]);}return _0x248844[_0xae59('0x4f')](_0x4b64db);}})['then'](function(_0x1fbae3){if(_0x1fbae3){return _0x1fbae3?{'count':_0x367d91,'rows':_0x1fbae3}:null;}})[_0xae59('0x23')](respondWithResult(_0x20115d,null))['catch'](handleError(_0x20115d,null));};exports[_0xae59('0x50')]=function(_0xec7056,_0x1506c8,_0x41fc1f){var _0x22f7bd={};var _0x23965c={};var _0x368dd0;var _0x1055bc;return db[_0xae59('0x2b')][_0xae59('0x4c')]({'where':{'id':_0xec7056[_0xae59('0x45')]['id']}})[_0xae59('0x23')](handleEntityNotFound(_0x1506c8,null))[_0xae59('0x23')](function(_0x1610e7){if(_0x1610e7){_0x368dd0=_0x1610e7;_0x23965c['model']=_[_0xae59('0x31')](db[_0xae59('0x4d')][_0xae59('0x2c')]);_0x23965c[_0xae59('0x30')]=_[_0xae59('0x31')](_0xec7056['query']);_0x23965c[_0xae59('0x32')]=_['intersection'](_0x23965c[_0xae59('0x2f')],_0x23965c[_0xae59('0x30')]);_0x22f7bd[_0xae59('0x35')]=_[_0xae59('0x33')](_0x23965c[_0xae59('0x2f')],qs[_0xae59('0x34')](_0xec7056[_0xae59('0x30')][_0xae59('0x34')]));_0x22f7bd[_0xae59('0x35')]=_0x22f7bd[_0xae59('0x35')][_0xae59('0x46')]?_0x22f7bd['attributes']:_0x23965c[_0xae59('0x2f')];_0x22f7bd['order']=qs[_0xae59('0x38')](_0xec7056[_0xae59('0x30')][_0xae59('0x38')]);_0x22f7bd[_0xae59('0x3b')]=qs[_0xae59('0x32')](_['pick'](_0xec7056[_0xae59('0x30')],_0x23965c[_0xae59('0x32')]));if(_0xec7056['query'][_0xae59('0x3a')]){_0x22f7bd['where']=_['merge'](_0x22f7bd[_0xae59('0x3b')],{'$or':_[_0xae59('0x2a')](_0x22f7bd[_0xae59('0x35')],function(_0x36cd3d){var _0x35c2b0={};_0x35c2b0[_0x36cd3d]={'$like':'%'+_0xec7056[_0xae59('0x30')][_0xae59('0x3a')]+'%'};return _0x35c2b0;})});}_0x22f7bd=_['merge']({},_0x22f7bd,_0xec7056[_0xae59('0x3f')]);return _0x368dd0[_0xae59('0x50')](_0x22f7bd);}})[_0xae59('0x23')](function(_0x49f29c){if(_0x49f29c){_0x1055bc=_0x49f29c[_0xae59('0x46')];if(!_0xec7056[_0xae59('0x30')][_0xae59('0x36')](_0xae59('0x37'))){_0x22f7bd[_0xae59('0x1c')]=qs[_0xae59('0x1c')](_0xec7056[_0xae59('0x30')][_0xae59('0x1c')]);_0x22f7bd['offset']=qs[_0xae59('0x1e')](_0xec7056['query']['offset']);}return _0x368dd0['getDescriptions'](_0x22f7bd);}})[_0xae59('0x23')](function(_0x6be452){if(_0x6be452){return _0x6be452?{'count':_0x1055bc,'rows':_0x6be452}:null;}})[_0xae59('0x23')](respondWithResult(_0x1506c8,null))[_0xae59('0x47')](handleError(_0x1506c8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f4a1000..8c0e533 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 _0xd30a=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','bluebird','request-promise','path'];(function(_0x556e5f,_0x215af8){var _0xd3d83d=function(_0x5d99b3){while(--_0x5d99b3){_0x556e5f['push'](_0x556e5f['shift']());}};_0xd3d83d(++_0x215af8);}(_0xd30a,0x16e));var _0xad30=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xd30a[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xad30('0x0'));var util=require(_0xad30('0x1'));var logger=require('../../config/logger')(_0xad30('0x2'));var moment=require('moment');var BPromise=require(_0xad30('0x3'));var rp=require(_0xad30('0x4'));var fs=require('fs');var path=require(_0xad30('0x5'));var rimraf=require(_0xad30('0x6'));var config=require(_0xad30('0x7'));var attributes=require(_0xad30('0x8'));module['exports']=function(_0x25e7ae,_0x17db63){return _0x25e7ae[_0xad30('0x9')](_0xad30('0xa'),attributes,{'tableName':_0xad30('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fd=['./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5122f7,_0x1090ec){var _0x173a3f=function(_0x2dfa53){while(--_0x2dfa53){_0x5122f7['push'](_0x5122f7['shift']());}};_0x173a3f(++_0x1090ec);}(_0xf6fd,0x6c));var _0xdf6f=function(_0x255c4b,_0x140578){_0x255c4b=_0x255c4b-0x0;var _0x453553=_0xf6fd[_0x255c4b];return _0x453553;};'use strict';var _=require(_0xdf6f('0x0'));var util=require(_0xdf6f('0x1'));var logger=require('../../config/logger')(_0xdf6f('0x2'));var moment=require(_0xdf6f('0x3'));var BPromise=require(_0xdf6f('0x4'));var rp=require(_0xdf6f('0x5'));var fs=require('fs');var path=require(_0xdf6f('0x6'));var rimraf=require(_0xdf6f('0x7'));var config=require(_0xdf6f('0x8'));var attributes=require(_0xdf6f('0x9'));module['exports']=function(_0x7303b7,_0x3ca3a9){return _0x7303b7[_0xdf6f('0xa')](_0xdf6f('0xb'),attributes,{'tableName':_0xdf6f('0xc'),'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 421f0a3..52618d7 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 _0xe856=['stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x590da5,_0x298084){var _0x54d4c4=function(_0xf67551){while(--_0xf67551){_0x590da5['push'](_0x590da5['shift']());}};_0x54d4c4(++_0x298084);}(_0xe856,0xc2));var _0x6e85=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe856[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x6e85('0x0'));var util=require('util');var moment=require(_0x6e85('0x1'));var BPromise=require(_0x6e85('0x2'));var rs=require(_0x6e85('0x3'));var fs=require('fs');var Redis=require(_0x6e85('0x4'));var db=require(_0x6e85('0x5'))['db'];var utils=require(_0x6e85('0x6'));var logger=require(_0x6e85('0x7'))('rpc');var config=require(_0x6e85('0x8'));var jayson=require(_0x6e85('0x9'));var client=jayson[_0x6e85('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b21a9,_0x3bfca4,_0x4c636b){return new BPromise(function(_0x4100ca,_0x302ffe){return client[_0x6e85('0xb')](_0x2b21a9,_0x4c636b)['then'](function(_0x2daf0d){logger['info'](_0x6e85('0xc'),_0x3bfca4,_0x6e85('0xd'));logger[_0x6e85('0xe')](_0x6e85('0xf'),_0x3bfca4,_0x6e85('0xd'),JSON[_0x6e85('0x10')](_0x2daf0d));if(_0x2daf0d[_0x6e85('0x11')]){if(_0x2daf0d[_0x6e85('0x11')]['code']===0x1f4){logger[_0x6e85('0x11')](_0x6e85('0xc'),_0x3bfca4,_0x2daf0d[_0x6e85('0x11')][_0x6e85('0x12')]);return _0x302ffe(_0x2daf0d[_0x6e85('0x11')][_0x6e85('0x12')]);}logger[_0x6e85('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3bfca4,_0x2daf0d[_0x6e85('0x11')][_0x6e85('0x12')]);return _0x4100ca(_0x2daf0d[_0x6e85('0x11')][_0x6e85('0x12')]);}else{logger[_0x6e85('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3bfca4,'request\x20sent');_0x4100ca(_0x2daf0d['result'][_0x6e85('0x12')]);}})[_0x6e85('0x14')](function(_0x49ce41){logger[_0x6e85('0x11')](_0x6e85('0xc'),_0x3bfca4,_0x49ce41);_0x302ffe(_0x49ce41);});});} \ No newline at end of file +var _0x8e87=['request','then','info','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xab2865,_0x32e71e){var _0x31f344=function(_0x2a3762){while(--_0x2a3762){_0xab2865['push'](_0xab2865['shift']());}};_0x31f344(++_0x32e71e);}(_0x8e87,0xc2));var _0x78e8=function(_0x4fafcf,_0x2ef75e){_0x4fafcf=_0x4fafcf-0x0;var _0x8080ff=_0x8e87[_0x4fafcf];return _0x8080ff;};'use strict';var _=require(_0x78e8('0x0'));var util=require(_0x78e8('0x1'));var moment=require(_0x78e8('0x2'));var BPromise=require(_0x78e8('0x3'));var rs=require(_0x78e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78e8('0x5'))['db'];var utils=require(_0x78e8('0x6'));var logger=require(_0x78e8('0x7'))(_0x78e8('0x8'));var config=require(_0x78e8('0x9'));var jayson=require(_0x78e8('0xa'));var client=jayson[_0x78e8('0xb')][_0x78e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x268d93,_0x5e7862,_0x2a1c6b){return new BPromise(function(_0x5534a6,_0x1060dd){return client[_0x78e8('0xd')](_0x268d93,_0x2a1c6b)[_0x78e8('0xe')](function(_0x4903b0){logger[_0x78e8('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5e7862,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5e7862,_0x78e8('0x10'),JSON[_0x78e8('0x11')](_0x4903b0));if(_0x4903b0[_0x78e8('0x12')]){if(_0x4903b0[_0x78e8('0x12')][_0x78e8('0x13')]===0x1f4){logger[_0x78e8('0x12')](_0x78e8('0x14'),_0x5e7862,_0x4903b0[_0x78e8('0x12')][_0x78e8('0x15')]);return _0x1060dd(_0x4903b0['error'][_0x78e8('0x15')]);}logger[_0x78e8('0x12')](_0x78e8('0x14'),_0x5e7862,_0x4903b0[_0x78e8('0x12')]['message']);return _0x5534a6(_0x4903b0[_0x78e8('0x12')][_0x78e8('0x15')]);}else{logger[_0x78e8('0xf')](_0x78e8('0x14'),_0x5e7862,'request\x20sent');_0x5534a6(_0x4903b0['result'][_0x78e8('0x15')]);}})[_0x78e8('0x16')](function(_0x406e1d){logger[_0x78e8('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5e7862,_0x406e1d);_0x1060dd(_0x406e1d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index f3505db..a337475 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 _0x8286=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','/:id','update','delete','destroy','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8286,0xf0));var _0x6828=function(_0x899dae,_0x4e7f56){_0x899dae=_0x899dae-0x0;var _0x34e018=_0x8286[_0x899dae];return _0x34e018;};'use strict';var multer=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var path=require(_0x6828('0x2'));var timeout=require('connect-timeout');var express=require(_0x6828('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6828('0x4'));var interaction=require(_0x6828('0x5'));var config=require(_0x6828('0x6'));var controller=require('./intSalesforceField.controller');router[_0x6828('0x7')]('/',auth[_0x6828('0x8')](),controller[_0x6828('0x9')]);router[_0x6828('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x6828('0xa')]);router['put'](_0x6828('0xb'),auth[_0x6828('0x8')](),controller[_0x6828('0xc')]);router[_0x6828('0xd')](_0x6828('0xb'),auth[_0x6828('0x8')](),controller[_0x6828('0xe')]);module[_0x6828('0xf')]=router; \ No newline at end of file +var _0x3804=['isAuthenticated','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post'];(function(_0x5eb281,_0x2a46c1){var _0xde0b5d=function(_0xb87630){while(--_0xb87630){_0x5eb281['push'](_0x5eb281['shift']());}};_0xde0b5d(++_0x2a46c1);}(_0x3804,0x197));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4380('0x0'));var util=require(_0x4380('0x1'));var path=require(_0x4380('0x2'));var timeout=require(_0x4380('0x3'));var express=require('express');var router=express[_0x4380('0x4')]();var fs_extra=require(_0x4380('0x5'));var auth=require(_0x4380('0x6'));var interaction=require(_0x4380('0x7'));var config=require(_0x4380('0x8'));var controller=require('./intSalesforceField.controller');router[_0x4380('0x9')]('/',auth['isAuthenticated'](),controller[_0x4380('0xa')]);router[_0x4380('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4380('0xb')]);router[_0x4380('0xc')]('/',auth[_0x4380('0xd')](),controller[_0x4380('0xe')]);router[_0x4380('0xf')](_0x4380('0x10'),auth[_0x4380('0xd')](),controller[_0x4380('0x11')]);router[_0x4380('0x12')](_0x4380('0x10'),auth[_0x4380('0xd')](),controller['destroy']);module[_0x4380('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 00a14ed..931db3b 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 _0xca93=['picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0xca93,0x8a));var _0x3ca9=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xca93[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x3ca9('0x0'));module[_0x3ca9('0x1')]={'type':{'type':Sequelize[_0x3ca9('0x2')]('string',_0x3ca9('0x3'),_0x3ca9('0x4'),_0x3ca9('0x5'),_0x3ca9('0x6')),'defaultValue':_0x3ca9('0x7')},'content':{'type':Sequelize[_0x3ca9('0x8')]},'key':{'type':Sequelize[_0x3ca9('0x8')]},'keyType':{'type':Sequelize[_0x3ca9('0x2')](_0x3ca9('0x7'),_0x3ca9('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3ca9('0x8')]},'idField':{'type':Sequelize[_0x3ca9('0x8')]},'variableName':{'type':Sequelize[_0x3ca9('0x8')]}}; \ No newline at end of file +var _0xe05a=['keyValue','picklist','STRING','string','exports','variable','customVariable'];(function(_0x8200b7,_0xae02b7){var _0x57cd60=function(_0x3932f9){while(--_0x3932f9){_0x8200b7['push'](_0x8200b7['shift']());}};_0x57cd60(++_0xae02b7);}(_0xe05a,0x6d));var _0xae05=function(_0x1eb272,_0x21dd80){_0x1eb272=_0x1eb272-0x0;var _0x5cfdc9=_0xe05a[_0x1eb272];return _0x5cfdc9;};'use strict';var Sequelize=require('sequelize');module[_0xae05('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xae05('0x1'),_0xae05('0x2'),_0xae05('0x3'),_0xae05('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xae05('0x5')]},'key':{'type':Sequelize[_0xae05('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xae05('0x6'),_0xae05('0x1'),_0xae05('0x2'))},'keyContent':{'type':Sequelize[_0xae05('0x5')]},'idField':{'type':Sequelize[_0xae05('0x5')]},'variableName':{'type':Sequelize[_0xae05('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index bcca343..0b6d0cc 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 _0xa1ed=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','merge','where','then','includeAll','findAll','rows','catch','show','params','length','include','options','create','body','update','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x5e21b0,_0x4d7961){var _0x5903e2=function(_0x510551){while(--_0x510551){_0x5e21b0['push'](_0x5e21b0['shift']());}};_0x5903e2(++_0x4d7961);}(_0xa1ed,0x1b6));var _0xda1e=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0xa1ed[_0x5519a9];return _0x32f2cc;};'use strict';var emlformat=require(_0xda1e('0x0'));var rimraf=require(_0xda1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda1e('0x2'));var rp=require(_0xda1e('0x3'));var moment=require(_0xda1e('0x4'));var BPromise=require(_0xda1e('0x5'));var Mustache=require(_0xda1e('0x6'));var util=require('util');var path=require(_0xda1e('0x7'));var sox=require(_0xda1e('0x8'));var csv=require(_0xda1e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda1e('0xa'));var squel=require(_0xda1e('0xb'));var crypto=require('crypto');var jsforce=require(_0xda1e('0xc'));var deskjs=require(_0xda1e('0xd'));var toCsv=require(_0xda1e('0x9'));var querystring=require(_0xda1e('0xe'));var Papa=require(_0xda1e('0xf'));var Redis=require('ioredis');var authService=require(_0xda1e('0x10'));var qs=require(_0xda1e('0x11'));var as=require(_0xda1e('0x12'));var hardwareService=require(_0xda1e('0x13'));var logger=require(_0xda1e('0x14'))(_0xda1e('0x15'));var utils=require('../../config/utils');var config=require(_0xda1e('0x16'));var licenseUtil=require(_0xda1e('0x17'));var db=require(_0xda1e('0x18'))['db'];function respondWithStatusCode(_0x1761eb,_0x5a0d24){_0x5a0d24=_0x5a0d24||0xcc;return function(_0x381706){if(_0x381706){return _0x1761eb[_0xda1e('0x19')](_0x5a0d24);}return _0x1761eb[_0xda1e('0x1a')](_0x5a0d24)[_0xda1e('0x1b')]();};}function respondWithResult(_0x1502be,_0x252f09){_0x252f09=_0x252f09||0xc8;return function(_0x845010){if(_0x845010){return _0x1502be['status'](_0x252f09)[_0xda1e('0x1c')](_0x845010);}};}function respondWithFilteredResult(_0x9373a5,_0x540db3){return function(_0x436441){if(_0x436441){var _0x565622=typeof _0x540db3[_0xda1e('0x1d')]===_0xda1e('0x1e')&&typeof _0x540db3[_0xda1e('0x1f')]==='undefined';var _0x440643=_0x436441[_0xda1e('0x20')];var _0x3f8d37=_0x565622?0x0:_0x540db3[_0xda1e('0x1d')];var _0x7af715=_0x565622?_0x436441['count']:_0x540db3['offset']+_0x540db3[_0xda1e('0x1f')];var _0x28939f;if(_0x7af715>=_0x440643){_0x7af715=_0x440643;_0x28939f=0xc8;}else{_0x28939f=0xce;}_0x9373a5['status'](_0x28939f);return _0x9373a5[_0xda1e('0x21')](_0xda1e('0x22'),_0x3f8d37+'-'+_0x7af715+'/'+_0x440643)['json'](_0x436441);}return null;};}function patchUpdates(_0x5d06c8){return function(_0x3c0a08){try{jsonpatch[_0xda1e('0x23')](_0x3c0a08,_0x5d06c8,!![]);}catch(_0x20ec9c){return BPromise[_0xda1e('0x24')](_0x20ec9c);}return _0x3c0a08['save']();};}function saveUpdates(_0x5ba0db,_0x2694f4){return function(_0x56bea0){if(_0x56bea0){return _0x56bea0['update'](_0x5ba0db)['then'](function(_0x3d4478){return _0x3d4478;});}return null;};}function removeEntity(_0x37cefb,_0x449461){return function(_0x247c01){if(_0x247c01){return _0x247c01['destroy']()['then'](function(){_0x37cefb[_0xda1e('0x1a')](0xcc)[_0xda1e('0x1b')]();});}};}function handleEntityNotFound(_0x2db28f,_0x3ee60f){return function(_0x449078){if(!_0x449078){_0x2db28f[_0xda1e('0x19')](0x194);}return _0x449078;};}function handleError(_0x594cf7,_0x13c523){_0x13c523=_0x13c523||0x1f4;return function(_0x27c89d){logger[_0xda1e('0x25')](_0x27c89d['stack']);if(_0x27c89d[_0xda1e('0x26')]){delete _0x27c89d['name'];}_0x594cf7['status'](_0x13c523)[_0xda1e('0x27')](_0x27c89d);};}exports[_0xda1e('0x28')]=function(_0xde5c97,_0x5d64c7){var _0x2c34a0={},_0x268f6f={},_0x388d51={'count':0x0,'rows':[]};var _0x28ecb8=_[_0xda1e('0x29')](db[_0xda1e('0x2a')][_0xda1e('0x2b')],function(_0x588aac){return{'name':_0x588aac[_0xda1e('0x2c')],'type':_0x588aac[_0xda1e('0x2d')][_0xda1e('0x2e')]};});_0x268f6f['model']=_['map'](_0x28ecb8,_0xda1e('0x26'));_0x268f6f[_0xda1e('0x2f')]=_[_0xda1e('0x30')](_0xde5c97[_0xda1e('0x2f')]);_0x268f6f[_0xda1e('0x31')]=_['intersection'](_0x268f6f[_0xda1e('0x32')],_0x268f6f[_0xda1e('0x2f')]);_0x2c34a0[_0xda1e('0x33')]=_[_0xda1e('0x34')](_0x268f6f[_0xda1e('0x32')],qs[_0xda1e('0x35')](_0xde5c97[_0xda1e('0x2f')][_0xda1e('0x35')]));_0x2c34a0[_0xda1e('0x33')]=_0x2c34a0[_0xda1e('0x33')]['length']?_0x2c34a0[_0xda1e('0x33')]:_0x268f6f[_0xda1e('0x32')];if(!_0xde5c97[_0xda1e('0x2f')][_0xda1e('0x36')](_0xda1e('0x37'))){_0x2c34a0[_0xda1e('0x1f')]=qs[_0xda1e('0x1f')](_0xde5c97['query'][_0xda1e('0x1f')]);_0x2c34a0[_0xda1e('0x1d')]=qs['offset'](_0xde5c97[_0xda1e('0x2f')][_0xda1e('0x1d')]);}_0x2c34a0[_0xda1e('0x38')]=qs[_0xda1e('0x39')](_0xde5c97['query']['sort']);_0x2c34a0['where']=qs['filters'](_['pick'](_0xde5c97[_0xda1e('0x2f')],_0x268f6f['filters']),_0x28ecb8);if(_0xde5c97[_0xda1e('0x2f')][_0xda1e('0x3a')]){_0x2c34a0['where']=_['merge'](_0x2c34a0['where'],{'$or':_[_0xda1e('0x29')](_0x28ecb8,function(_0x3bc57a){if(_0x3bc57a[_0xda1e('0x2d')]!==_0xda1e('0x3b')){var _0x317447={};_0x317447[_0x3bc57a[_0xda1e('0x26')]]={'$like':'%'+_0xde5c97['query'][_0xda1e('0x3a')]+'%'};return _0x317447;}})});}_0x2c34a0=_[_0xda1e('0x3c')]({},_0x2c34a0,_0xde5c97['options']);var _0x188204={'where':_0x2c34a0[_0xda1e('0x3d')]};return db[_0xda1e('0x2a')]['count'](_0x188204)[_0xda1e('0x3e')](function(_0xc50687){_0x388d51['count']=_0xc50687;if(_0xde5c97[_0xda1e('0x2f')][_0xda1e('0x3f')]){_0x2c34a0['include']=[{'all':!![]}];}return db['SalesforceField'][_0xda1e('0x40')](_0x2c34a0);})[_0xda1e('0x3e')](function(_0x2f0773){_0x388d51[_0xda1e('0x41')]=_0x2f0773;return _0x388d51;})[_0xda1e('0x3e')](respondWithFilteredResult(_0x5d64c7,_0x2c34a0))[_0xda1e('0x42')](handleError(_0x5d64c7,null));};exports[_0xda1e('0x43')]=function(_0x1ee005,_0xd7429d){var _0x56eb12={'raw':!![],'where':{'id':_0x1ee005[_0xda1e('0x44')]['id']}},_0x8ad965={};_0x8ad965['model']=_['keys'](db[_0xda1e('0x2a')][_0xda1e('0x2b')]);_0x8ad965[_0xda1e('0x2f')]=_[_0xda1e('0x30')](_0x1ee005['query']);_0x8ad965[_0xda1e('0x31')]=_[_0xda1e('0x34')](_0x8ad965['model'],_0x8ad965[_0xda1e('0x2f')]);_0x56eb12[_0xda1e('0x33')]=_[_0xda1e('0x34')](_0x8ad965['model'],qs[_0xda1e('0x35')](_0x1ee005[_0xda1e('0x2f')]['fields']));_0x56eb12['attributes']=_0x56eb12[_0xda1e('0x33')][_0xda1e('0x45')]?_0x56eb12[_0xda1e('0x33')]:_0x8ad965[_0xda1e('0x32')];if(_0x1ee005[_0xda1e('0x2f')][_0xda1e('0x3f')]){_0x56eb12[_0xda1e('0x46')]=[{'all':!![]}];}_0x56eb12=_[_0xda1e('0x3c')]({},_0x56eb12,_0x1ee005[_0xda1e('0x47')]);return db['SalesforceField']['find'](_0x56eb12)[_0xda1e('0x3e')](handleEntityNotFound(_0xd7429d,null))[_0xda1e('0x3e')](respondWithResult(_0xd7429d,null))[_0xda1e('0x42')](handleError(_0xd7429d,null));};exports[_0xda1e('0x48')]=function(_0x52ba66,_0xa761f9){return db[_0xda1e('0x2a')][_0xda1e('0x48')](_0x52ba66[_0xda1e('0x49')],{})['then'](respondWithResult(_0xa761f9,0xc9))[_0xda1e('0x42')](handleError(_0xa761f9,null));};exports[_0xda1e('0x4a')]=function(_0x33c8d4,_0x16c117){if(_0x33c8d4[_0xda1e('0x49')]['id']){delete _0x33c8d4[_0xda1e('0x49')]['id'];}return db[_0xda1e('0x2a')][_0xda1e('0x4b')]({'where':{'id':_0x33c8d4['params']['id']}})[_0xda1e('0x3e')](handleEntityNotFound(_0x16c117,null))[_0xda1e('0x3e')](saveUpdates(_0x33c8d4[_0xda1e('0x49')],null))[_0xda1e('0x3e')](respondWithResult(_0x16c117,null))[_0xda1e('0x42')](handleError(_0x16c117,null));};exports[_0xda1e('0x4c')]=function(_0x27dc47,_0x1da8f8){return db[_0xda1e('0x2a')][_0xda1e('0x4b')]({'where':{'id':_0x27dc47[_0xda1e('0x44')]['id']}})[_0xda1e('0x3e')](handleEntityNotFound(_0x1da8f8,null))[_0xda1e('0x3e')](removeEntity(_0x1da8f8,null))['catch'](handleError(_0x1da8f8,null));}; \ No newline at end of file +var _0x9851=['end','error','name','status','send','index','SalesforceField','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','order','sort','where','VIRTUAL','filter','merge','options','rows','show','params','keys','length','includeAll','include','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x50ab4b,_0x37361c){var _0x108753=function(_0x7c7a81){while(--_0x7c7a81){_0x50ab4b['push'](_0x50ab4b['shift']());}};_0x108753(++_0x37361c);}(_0x9851,0x1f1));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x1985('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1985('0x1'));var jsonpatch=require(_0x1985('0x2'));var rp=require(_0x1985('0x3'));var moment=require(_0x1985('0x4'));var BPromise=require(_0x1985('0x5'));var Mustache=require(_0x1985('0x6'));var util=require(_0x1985('0x7'));var path=require(_0x1985('0x8'));var sox=require(_0x1985('0x9'));var csv=require(_0x1985('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1985('0xb'));var _=require(_0x1985('0xc'));var squel=require(_0x1985('0xd'));var crypto=require('crypto');var jsforce=require(_0x1985('0xe'));var deskjs=require(_0x1985('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1985('0x10'));var Papa=require('papaparse');var Redis=require(_0x1985('0x11'));var authService=require(_0x1985('0x12'));var qs=require(_0x1985('0x13'));var as=require(_0x1985('0x14'));var hardwareService=require(_0x1985('0x15'));var logger=require(_0x1985('0x16'))(_0x1985('0x17'));var utils=require(_0x1985('0x18'));var config=require(_0x1985('0x19'));var licenseUtil=require(_0x1985('0x1a'));var db=require(_0x1985('0x1b'))['db'];function respondWithStatusCode(_0x10e96b,_0x50f28f){_0x50f28f=_0x50f28f||0xcc;return function(_0x262ff9){if(_0x262ff9){return _0x10e96b[_0x1985('0x1c')](_0x50f28f);}return _0x10e96b['status'](_0x50f28f)['end']();};}function respondWithResult(_0x4cdde9,_0xacb40f){_0xacb40f=_0xacb40f||0xc8;return function(_0x3a8db7){if(_0x3a8db7){return _0x4cdde9['status'](_0xacb40f)[_0x1985('0x1d')](_0x3a8db7);}};}function respondWithFilteredResult(_0x324644,_0x131884){return function(_0x49ec6e){if(_0x49ec6e){var _0xbe7245=typeof _0x131884['offset']===_0x1985('0x1e')&&typeof _0x131884['limit']===_0x1985('0x1e');var _0x51b4f4=_0x49ec6e[_0x1985('0x1f')];var _0x2c7279=_0xbe7245?0x0:_0x131884[_0x1985('0x20')];var _0x433a33=_0xbe7245?_0x49ec6e[_0x1985('0x1f')]:_0x131884[_0x1985('0x20')]+_0x131884[_0x1985('0x21')];var _0x112913;if(_0x433a33>=_0x51b4f4){_0x433a33=_0x51b4f4;_0x112913=0xc8;}else{_0x112913=0xce;}_0x324644['status'](_0x112913);return _0x324644[_0x1985('0x22')](_0x1985('0x23'),_0x2c7279+'-'+_0x433a33+'/'+_0x51b4f4)['json'](_0x49ec6e);}return null;};}function patchUpdates(_0x417bf7){return function(_0x17aa33){try{jsonpatch[_0x1985('0x24')](_0x17aa33,_0x417bf7,!![]);}catch(_0x435422){return BPromise[_0x1985('0x25')](_0x435422);}return _0x17aa33[_0x1985('0x26')]();};}function saveUpdates(_0xb73151,_0x290c1a){return function(_0x2e648a){if(_0x2e648a){return _0x2e648a[_0x1985('0x27')](_0xb73151)[_0x1985('0x28')](function(_0x5506a7){return _0x5506a7;});}return null;};}function removeEntity(_0xeac967,_0x6d7358){return function(_0x42889c){if(_0x42889c){return _0x42889c[_0x1985('0x29')]()[_0x1985('0x28')](function(){_0xeac967['status'](0xcc)[_0x1985('0x2a')]();});}};}function handleEntityNotFound(_0x17ffe2,_0x452e15){return function(_0x1ed802){if(!_0x1ed802){_0x17ffe2['sendStatus'](0x194);}return _0x1ed802;};}function handleError(_0xa9578,_0x36e919){_0x36e919=_0x36e919||0x1f4;return function(_0x3ea584){logger[_0x1985('0x2b')](_0x3ea584['stack']);if(_0x3ea584['name']){delete _0x3ea584[_0x1985('0x2c')];}_0xa9578[_0x1985('0x2d')](_0x36e919)[_0x1985('0x2e')](_0x3ea584);};}exports[_0x1985('0x2f')]=function(_0x518449,_0x3ad278){var _0x51a226={},_0x5ed429={},_0x20bd30={'count':0x0,'rows':[]};var _0x488e9c=_['map'](db[_0x1985('0x30')][_0x1985('0x31')],function(_0x1e7701){return{'name':_0x1e7701[_0x1985('0x32')],'type':_0x1e7701['type'][_0x1985('0x33')]};});_0x5ed429[_0x1985('0x34')]=_[_0x1985('0x35')](_0x488e9c,_0x1985('0x2c'));_0x5ed429[_0x1985('0x36')]=_['keys'](_0x518449[_0x1985('0x36')]);_0x5ed429[_0x1985('0x37')]=_[_0x1985('0x38')](_0x5ed429[_0x1985('0x34')],_0x5ed429[_0x1985('0x36')]);_0x51a226[_0x1985('0x39')]=_['intersection'](_0x5ed429[_0x1985('0x34')],qs[_0x1985('0x3a')](_0x518449[_0x1985('0x36')][_0x1985('0x3a')]));_0x51a226['attributes']=_0x51a226[_0x1985('0x39')]['length']?_0x51a226['attributes']:_0x5ed429[_0x1985('0x34')];if(!_0x518449[_0x1985('0x36')]['hasOwnProperty']('nolimit')){_0x51a226[_0x1985('0x21')]=qs[_0x1985('0x21')](_0x518449[_0x1985('0x36')][_0x1985('0x21')]);_0x51a226[_0x1985('0x20')]=qs[_0x1985('0x20')](_0x518449[_0x1985('0x36')][_0x1985('0x20')]);}_0x51a226[_0x1985('0x3b')]=qs[_0x1985('0x3c')](_0x518449[_0x1985('0x36')]['sort']);_0x51a226[_0x1985('0x3d')]=qs['filters'](_['pick'](_0x518449['query'],_0x5ed429[_0x1985('0x37')]),_0x488e9c);if(_0x518449[_0x1985('0x36')]['filter']){_0x51a226[_0x1985('0x3d')]=_['merge'](_0x51a226[_0x1985('0x3d')],{'$or':_[_0x1985('0x35')](_0x488e9c,function(_0x1fc3b3){if(_0x1fc3b3['type']!==_0x1985('0x3e')){var _0x5aecab={};_0x5aecab[_0x1fc3b3[_0x1985('0x2c')]]={'$like':'%'+_0x518449['query'][_0x1985('0x3f')]+'%'};return _0x5aecab;}})});}_0x51a226=_[_0x1985('0x40')]({},_0x51a226,_0x518449[_0x1985('0x41')]);var _0x2ae405={'where':_0x51a226[_0x1985('0x3d')]};return db['SalesforceField'][_0x1985('0x1f')](_0x2ae405)[_0x1985('0x28')](function(_0x19a114){_0x20bd30[_0x1985('0x1f')]=_0x19a114;if(_0x518449[_0x1985('0x36')]['includeAll']){_0x51a226['include']=[{'all':!![]}];}return db[_0x1985('0x30')]['findAll'](_0x51a226);})[_0x1985('0x28')](function(_0x38fc14){_0x20bd30[_0x1985('0x42')]=_0x38fc14;return _0x20bd30;})['then'](respondWithFilteredResult(_0x3ad278,_0x51a226))['catch'](handleError(_0x3ad278,null));};exports[_0x1985('0x43')]=function(_0x4736ad,_0x181abf){var _0x5486b7={'raw':!![],'where':{'id':_0x4736ad[_0x1985('0x44')]['id']}},_0x537f6e={};_0x537f6e[_0x1985('0x34')]=_[_0x1985('0x45')](db[_0x1985('0x30')][_0x1985('0x31')]);_0x537f6e[_0x1985('0x36')]=_[_0x1985('0x45')](_0x4736ad[_0x1985('0x36')]);_0x537f6e[_0x1985('0x37')]=_[_0x1985('0x38')](_0x537f6e[_0x1985('0x34')],_0x537f6e[_0x1985('0x36')]);_0x5486b7[_0x1985('0x39')]=_[_0x1985('0x38')](_0x537f6e[_0x1985('0x34')],qs[_0x1985('0x3a')](_0x4736ad['query']['fields']));_0x5486b7['attributes']=_0x5486b7[_0x1985('0x39')][_0x1985('0x46')]?_0x5486b7[_0x1985('0x39')]:_0x537f6e['model'];if(_0x4736ad[_0x1985('0x36')][_0x1985('0x47')]){_0x5486b7[_0x1985('0x48')]=[{'all':!![]}];}_0x5486b7=_['merge']({},_0x5486b7,_0x4736ad['options']);return db['SalesforceField']['find'](_0x5486b7)[_0x1985('0x28')](handleEntityNotFound(_0x181abf,null))[_0x1985('0x28')](respondWithResult(_0x181abf,null))[_0x1985('0x49')](handleError(_0x181abf,null));};exports[_0x1985('0x4a')]=function(_0x26dbee,_0x32cf0c){return db['SalesforceField']['create'](_0x26dbee['body'],{})[_0x1985('0x28')](respondWithResult(_0x32cf0c,0xc9))[_0x1985('0x49')](handleError(_0x32cf0c,null));};exports[_0x1985('0x27')]=function(_0x3be6b2,_0x434e52){if(_0x3be6b2[_0x1985('0x4b')]['id']){delete _0x3be6b2[_0x1985('0x4b')]['id'];}return db[_0x1985('0x30')][_0x1985('0x4c')]({'where':{'id':_0x3be6b2[_0x1985('0x44')]['id']}})[_0x1985('0x28')](handleEntityNotFound(_0x434e52,null))['then'](saveUpdates(_0x3be6b2[_0x1985('0x4b')],null))['then'](respondWithResult(_0x434e52,null))[_0x1985('0x49')](handleError(_0x434e52,null));};exports[_0x1985('0x29')]=function(_0x4e1e39,_0x423541){return db[_0x1985('0x30')][_0x1985('0x4c')]({'where':{'id':_0x4e1e39[_0x1985('0x44')]['id']}})[_0x1985('0x28')](handleEntityNotFound(_0x423541,null))[_0x1985('0x28')](removeEntity(_0x423541,null))[_0x1985('0x49')](handleError(_0x423541,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9d38a51..e2f149e 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 _0xa64b=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','idField'];(function(_0x2b8388,_0x246b8f){var _0x3ba12a=function(_0x848995){while(--_0x848995){_0x2b8388['push'](_0x2b8388['shift']());}};_0x3ba12a(++_0x246b8f);}(_0xa64b,0xa9));var _0xba64=function(_0x30d4e8,_0xaae2a9){_0x30d4e8=_0x30d4e8-0x0;var _0x4a2d9d=_0xa64b[_0x30d4e8];return _0x4a2d9d;};'use strict';var _=require(_0xba64('0x0'));var util=require(_0xba64('0x1'));var logger=require('../../config/logger')(_0xba64('0x2'));var moment=require(_0xba64('0x3'));var BPromise=require(_0xba64('0x4'));var rp=require(_0xba64('0x5'));var fs=require('fs');var path=require(_0xba64('0x6'));var rimraf=require('rimraf');var config=require(_0xba64('0x7'));var attributes=require(_0xba64('0x8'));module[_0xba64('0x9')]=function(_0x5d5a05,_0x26448a){return _0x5d5a05['define'](_0xba64('0xa'),attributes,{'tableName':_0xba64('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xba64('0xc'),_0xba64('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b1=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x252f17,_0x50d7e2){var _0x40ae7b=function(_0x210966){while(--_0x210966){_0x252f17['push'](_0x252f17['shift']());}};_0x40ae7b(++_0x50d7e2);}(_0xe4b1,0xa7));var _0x1e4b=function(_0x1e2f5b,_0x60bf47){_0x1e2f5b=_0x1e2f5b-0x0;var _0x2bb7bc=_0xe4b1[_0x1e2f5b];return _0x2bb7bc;};'use strict';var _=require(_0x1e4b('0x0'));var util=require(_0x1e4b('0x1'));var logger=require(_0x1e4b('0x2'))(_0x1e4b('0x3'));var moment=require(_0x1e4b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e4b('0x5'));var fs=require('fs');var path=require(_0x1e4b('0x6'));var rimraf=require('rimraf');var config=require(_0x1e4b('0x7'));var attributes=require(_0x1e4b('0x8'));module['exports']=function(_0x1d3609,_0x429f41){return _0x1d3609[_0x1e4b('0x9')](_0x1e4b('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x1e4b('0xb'),'fields':[_0x1e4b('0xc'),_0x1e4b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 743eb9f..f4f3cf8 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 _0x894a=['../../config/logger','rpc','jayson/promise','http','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x3125ea,_0x52eb93){var _0x296132=function(_0x5e4417){while(--_0x5e4417){_0x3125ea['push'](_0x3125ea['shift']());}};_0x296132(++_0x52eb93);}(_0x894a,0xb8));var _0xa894=function(_0x435db1,_0xa45498){_0x435db1=_0x435db1-0x0;var _0x38f449=_0x894a[_0x435db1];return _0x38f449;};'use strict';var _=require('lodash');var util=require(_0xa894('0x0'));var moment=require(_0xa894('0x1'));var BPromise=require(_0xa894('0x2'));var rs=require(_0xa894('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa894('0x4'));var logger=require(_0xa894('0x5'))(_0xa894('0x6'));var config=require('../../config/environment');var jayson=require(_0xa894('0x7'));var client=jayson['client'][_0xa894('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a81fb,_0x208a90,_0x56526d){return new BPromise(function(_0x1fed76,_0x12dd76){return client[_0xa894('0x9')](_0x1a81fb,_0x56526d)[_0xa894('0xa')](function(_0x4f50dc){logger['info'](_0xa894('0xb'),_0x208a90,'request\x20sent');logger[_0xa894('0xc')](_0xa894('0xd'),_0x208a90,_0xa894('0xe'),JSON[_0xa894('0xf')](_0x4f50dc));if(_0x4f50dc[_0xa894('0x10')]){if(_0x4f50dc[_0xa894('0x10')][_0xa894('0x11')]===0x1f4){logger[_0xa894('0x10')](_0xa894('0xb'),_0x208a90,_0x4f50dc[_0xa894('0x10')][_0xa894('0x12')]);return _0x12dd76(_0x4f50dc[_0xa894('0x10')]['message']);}logger[_0xa894('0x10')](_0xa894('0xb'),_0x208a90,_0x4f50dc['error']['message']);return _0x1fed76(_0x4f50dc['error'][_0xa894('0x12')]);}else{logger[_0xa894('0x13')]('SalesforceField,\x20%s,\x20%s',_0x208a90,_0xa894('0xe'));_0x1fed76(_0x4f50dc[_0xa894('0x14')][_0xa894('0x12')]);}})['catch'](function(_0x3f4f7e){logger['error'](_0xa894('0xb'),_0x208a90,_0x3f4f7e);_0x12dd76(_0x3f4f7e);});});} \ No newline at end of file +var _0xd99f=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4bfd86,_0x43dac9){var _0x2fa6fc=function(_0x5d7b2e){while(--_0x5d7b2e){_0x4bfd86['push'](_0x4bfd86['shift']());}};_0x2fa6fc(++_0x43dac9);}(_0xd99f,0xaa));var _0xfd99=function(_0x11a79c,_0x174655){_0x11a79c=_0x11a79c-0x0;var _0x3d177e=_0xd99f[_0x11a79c];return _0x3d177e;};'use strict';var _=require(_0xfd99('0x0'));var util=require('util');var moment=require(_0xfd99('0x1'));var BPromise=require(_0xfd99('0x2'));var rs=require(_0xfd99('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd99('0x4'))['db'];var utils=require(_0xfd99('0x5'));var logger=require(_0xfd99('0x6'))(_0xfd99('0x7'));var config=require(_0xfd99('0x8'));var jayson=require(_0xfd99('0x9'));var client=jayson[_0xfd99('0xa')][_0xfd99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x82251d,_0x112227,_0x372e14){return new BPromise(function(_0x5a32c3,_0x58236d){return client['request'](_0x82251d,_0x372e14)['then'](function(_0x41d8dd){logger[_0xfd99('0xc')](_0xfd99('0xd'),_0x112227,_0xfd99('0xe'));logger[_0xfd99('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x112227,_0xfd99('0xe'),JSON[_0xfd99('0x10')](_0x41d8dd));if(_0x41d8dd[_0xfd99('0x11')]){if(_0x41d8dd[_0xfd99('0x11')]['code']===0x1f4){logger[_0xfd99('0x11')](_0xfd99('0xd'),_0x112227,_0x41d8dd[_0xfd99('0x11')][_0xfd99('0x12')]);return _0x58236d(_0x41d8dd[_0xfd99('0x11')][_0xfd99('0x12')]);}logger[_0xfd99('0x11')]('SalesforceField,\x20%s,\x20%s',_0x112227,_0x41d8dd[_0xfd99('0x11')][_0xfd99('0x12')]);return _0x5a32c3(_0x41d8dd['error'][_0xfd99('0x12')]);}else{logger[_0xfd99('0xc')](_0xfd99('0xd'),_0x112227,'request\x20sent');_0x5a32c3(_0x41d8dd[_0xfd99('0x13')][_0xfd99('0x12')]);}})[_0xfd99('0x14')](function(_0x3b37dc){logger[_0xfd99('0x11')](_0xfd99('0xd'),_0x112227,_0x3b37dc);_0x58236d(_0x3b37dc);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b2dcfb1..634e211 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 _0x0911=['getConfigurations','/:id/fields','post','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x0911,0x1a9));var _0x1091=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0x0911[_0x4cf8d4];return _0x2c1beb;};'use strict';var multer=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var path=require(_0x1091('0x2'));var timeout=require(_0x1091('0x3'));var express=require(_0x1091('0x4'));var router=express['Router']();var fs_extra=require(_0x1091('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1091('0x6'));var config=require(_0x1091('0x7'));var controller=require(_0x1091('0x8'));router[_0x1091('0x9')]('/',auth[_0x1091('0xa')](),controller[_0x1091('0xb')]);router[_0x1091('0x9')](_0x1091('0xc'),auth[_0x1091('0xa')](),controller[_0x1091('0xd')]);router['get'](_0x1091('0xe'),auth[_0x1091('0xa')](),controller[_0x1091('0xf')]);router[_0x1091('0x9')](_0x1091('0x10'),auth[_0x1091('0xa')](),controller['getFields']);router[_0x1091('0x11')]('/',auth[_0x1091('0xa')](),controller['create']);router['post'](_0x1091('0xe'),auth['isAuthenticated'](),controller[_0x1091('0x12')]);router['put'](_0x1091('0xc'),auth[_0x1091('0xa')](),controller[_0x1091('0x13')]);router[_0x1091('0x14')]('/:id',auth[_0x1091('0xa')](),controller[_0x1091('0x15')]);module['exports']=router; \ No newline at end of file +var _0x069d=['../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','index','isAuthenticated','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','path','express','Router'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x069d,0x11a));var _0xd069=function(_0x385f81,_0x3a68b6){_0x385f81=_0x385f81-0x0;var _0x1d11a3=_0x069d[_0x385f81];return _0x1d11a3;};'use strict';var multer=require(_0xd069('0x0'));var util=require('util');var path=require(_0xd069('0x1'));var timeout=require('connect-timeout');var express=require(_0xd069('0x2'));var router=express[_0xd069('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd069('0x4'));var interaction=require(_0xd069('0x5'));var config=require('../../config/environment');var controller=require(_0xd069('0x6'));router[_0xd069('0x7')]('/',auth['isAuthenticated'](),controller[_0xd069('0x8')]);router[_0xd069('0x7')]('/:id',auth[_0xd069('0x9')](),controller[_0xd069('0xa')]);router[_0xd069('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xd069('0x7')](_0xd069('0xb'),auth[_0xd069('0x9')](),controller[_0xd069('0xc')]);router[_0xd069('0xd')]('/',auth[_0xd069('0x9')](),controller[_0xd069('0xe')]);router[_0xd069('0xd')](_0xd069('0xf'),auth[_0xd069('0x9')](),controller[_0xd069('0x10')]);router[_0xd069('0x11')](_0xd069('0x12'),auth['isAuthenticated'](),controller[_0xd069('0x13')]);router['delete'](_0xd069('0x12'),auth[_0xd069('0x9')](),controller[_0xd069('0x14')]);module[_0xd069('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 564b789..ac9cf84 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 _0xb671=['sequelize','exports','STRING','username','remoteUri'];(function(_0x5a56cc,_0x29650c){var _0x589caa=function(_0x1e3ce5){while(--_0x1e3ce5){_0x5a56cc['push'](_0x5a56cc['shift']());}};_0x589caa(++_0x29650c);}(_0xb671,0x73));var _0x1b67=function(_0x5843b3,_0x161e9b){_0x5843b3=_0x5843b3-0x0;var _0x2c4a0f=_0xb671[_0x5843b3];return _0x2c4a0f;};'use strict';var Sequelize=require(_0x1b67('0x0'));module[_0x1b67('0x1')]={'name':{'type':Sequelize[_0x1b67('0x2')]},'description':{'type':Sequelize[_0x1b67('0x2')]},'username':{'type':Sequelize[_0x1b67('0x2')],'unique':_0x1b67('0x3')},'password':{'type':Sequelize[_0x1b67('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1b67('0x2')],'unique':_0x1b67('0x4')},'serverUrl':{'type':Sequelize[_0x1b67('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x464d=['sequelize','STRING','username','remoteUri'];(function(_0x5b191d,_0x28c0ed){var _0x313877=function(_0x185587){while(--_0x185587){_0x5b191d['push'](_0x5b191d['shift']());}};_0x313877(++_0x28c0ed);}(_0x464d,0x1c8));var _0xd464=function(_0x57e468,_0x25edd9){_0x57e468=_0x57e468-0x0;var _0x7ea0a1=_0x464d[_0x57e468];return _0x7ea0a1;};'use strict';var Sequelize=require(_0xd464('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd464('0x1')]},'username':{'type':Sequelize[_0xd464('0x1')],'unique':_0xd464('0x2')},'password':{'type':Sequelize[_0xd464('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd464('0x1')],'unique':_0xd464('0x3')},'serverUrl':{'type':Sequelize[_0xd464('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 ddcda68..f40ecb1 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 _0xd8bb=['update','destroy','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','options','ServicenowAccount','rows','catch','show','params','includeAll','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','opened_at','business_duration','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','urgency','company','reassignment_count','assigned_to','severity','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','%s/api/now/doc/table/schema/','GET','result','log','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save'];(function(_0x4a8e82,_0x4c53c1){var _0x3ba3e6=function(_0x1b5c59){while(--_0x1b5c59){_0x4a8e82['push'](_0x4a8e82['shift']());}};_0x3ba3e6(++_0x4c53c1);}(_0xd8bb,0x1e1));var _0xbd8b=function(_0x2e8c98,_0x5c10cc){_0x2e8c98=_0x2e8c98-0x0;var _0x31b0cd=_0xd8bb[_0x2e8c98];return _0x31b0cd;};'use strict';var emlformat=require(_0xbd8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd8b('0x1'));var jsonpatch=require(_0xbd8b('0x2'));var rp=require(_0xbd8b('0x3'));var moment=require('moment');var BPromise=require(_0xbd8b('0x4'));var Mustache=require('mustache');var util=require(_0xbd8b('0x5'));var path=require(_0xbd8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd8b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd8b('0x8'));var squel=require(_0xbd8b('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8b('0xa'));var deskjs=require(_0xbd8b('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbd8b('0xc'));var Papa=require('papaparse');var Redis=require(_0xbd8b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd8b('0xe'));var logger=require(_0xbd8b('0xf'))(_0xbd8b('0x10'));var utils=require(_0xbd8b('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xbd8b('0x12'));var db=require(_0xbd8b('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4f701c,_0x1d12ad){_0x1d12ad=_0x1d12ad||0xcc;return function(_0x47db88){if(_0x47db88){return _0x4f701c[_0xbd8b('0x14')](_0x1d12ad);}return _0x4f701c[_0xbd8b('0x15')](_0x1d12ad)[_0xbd8b('0x16')]();};}function respondWithResult(_0xbc7d99,_0x1c5ae0){_0x1c5ae0=_0x1c5ae0||0xc8;return function(_0x213907){if(_0x213907){return _0xbc7d99[_0xbd8b('0x15')](_0x1c5ae0)['json'](_0x213907);}};}function respondWithFilteredResult(_0xd357dc,_0x5dcdb8){return function(_0x22c292){if(_0x22c292){var _0x17372d=typeof _0x5dcdb8[_0xbd8b('0x17')]==='undefined'&&typeof _0x5dcdb8[_0xbd8b('0x18')]===_0xbd8b('0x19');var _0x2d1baf=_0x22c292[_0xbd8b('0x1a')];var _0x492e34=_0x17372d?0x0:_0x5dcdb8[_0xbd8b('0x17')];var _0x4a7ab4=_0x17372d?_0x22c292[_0xbd8b('0x1a')]:_0x5dcdb8[_0xbd8b('0x17')]+_0x5dcdb8[_0xbd8b('0x18')];var _0x49c8bd;if(_0x4a7ab4>=_0x2d1baf){_0x4a7ab4=_0x2d1baf;_0x49c8bd=0xc8;}else{_0x49c8bd=0xce;}_0xd357dc[_0xbd8b('0x15')](_0x49c8bd);return _0xd357dc[_0xbd8b('0x1b')](_0xbd8b('0x1c'),_0x492e34+'-'+_0x4a7ab4+'/'+_0x2d1baf)[_0xbd8b('0x1d')](_0x22c292);}return null;};}function patchUpdates(_0x2ccdc0){return function(_0x52e8b6){try{jsonpatch['apply'](_0x52e8b6,_0x2ccdc0,!![]);}catch(_0x48c822){return BPromise[_0xbd8b('0x1e')](_0x48c822);}return _0x52e8b6[_0xbd8b('0x1f')]();};}function saveUpdates(_0x2defe6,_0x5e9d61){return function(_0xfed733){if(_0xfed733){return _0xfed733[_0xbd8b('0x20')](_0x2defe6)['then'](function(_0x40b7a5){return _0x40b7a5;});}return null;};}function removeEntity(_0x514404,_0x27deae){return function(_0x4a8849){if(_0x4a8849){return _0x4a8849[_0xbd8b('0x21')]()[_0xbd8b('0x22')](function(){_0x514404[_0xbd8b('0x15')](0xcc)[_0xbd8b('0x16')]();});}};}function handleEntityNotFound(_0x18ffbd,_0x3769fa){return function(_0x1b9fb8){if(!_0x1b9fb8){_0x18ffbd[_0xbd8b('0x14')](0x194);}return _0x1b9fb8;};}function handleError(_0x9dd1af,_0x5889a2){_0x5889a2=_0x5889a2||0x1f4;return function(_0x1ba97e){logger[_0xbd8b('0x23')](_0x1ba97e[_0xbd8b('0x24')]);if(_0x1ba97e[_0xbd8b('0x25')]){delete _0x1ba97e[_0xbd8b('0x25')];}_0x9dd1af['status'](_0x5889a2)[_0xbd8b('0x26')](_0x1ba97e);};}exports['index']=function(_0x1d9c28,_0xad1958){var _0x4d11a1={},_0x1a7a41={},_0x564569={'count':0x0,'rows':[]};var _0x1f439a=_['map'](db['ServicenowAccount'][_0xbd8b('0x27')],function(_0x5827d4){return{'name':_0x5827d4[_0xbd8b('0x28')],'type':_0x5827d4[_0xbd8b('0x29')][_0xbd8b('0x2a')]};});_0x1a7a41[_0xbd8b('0x2b')]=_['map'](_0x1f439a,_0xbd8b('0x25'));_0x1a7a41[_0xbd8b('0x2c')]=_[_0xbd8b('0x2d')](_0x1d9c28['query']);_0x1a7a41['filters']=_[_0xbd8b('0x2e')](_0x1a7a41['model'],_0x1a7a41[_0xbd8b('0x2c')]);_0x4d11a1['attributes']=_['intersection'](_0x1a7a41['model'],qs[_0xbd8b('0x2f')](_0x1d9c28[_0xbd8b('0x2c')][_0xbd8b('0x2f')]));_0x4d11a1[_0xbd8b('0x30')]=_0x4d11a1[_0xbd8b('0x30')][_0xbd8b('0x31')]?_0x4d11a1[_0xbd8b('0x30')]:_0x1a7a41[_0xbd8b('0x2b')];if(!_0x1d9c28[_0xbd8b('0x2c')][_0xbd8b('0x32')](_0xbd8b('0x33'))){_0x4d11a1[_0xbd8b('0x18')]=qs['limit'](_0x1d9c28['query']['limit']);_0x4d11a1['offset']=qs['offset'](_0x1d9c28[_0xbd8b('0x2c')][_0xbd8b('0x17')]);}_0x4d11a1['order']=qs[_0xbd8b('0x34')](_0x1d9c28[_0xbd8b('0x2c')][_0xbd8b('0x34')]);_0x4d11a1[_0xbd8b('0x35')]=qs[_0xbd8b('0x36')](_[_0xbd8b('0x37')](_0x1d9c28['query'],_0x1a7a41[_0xbd8b('0x36')]),_0x1f439a);if(_0x1d9c28['query'][_0xbd8b('0x38')]){_0x4d11a1[_0xbd8b('0x35')]=_[_0xbd8b('0x39')](_0x4d11a1[_0xbd8b('0x35')],{'$or':_[_0xbd8b('0x3a')](_0x1f439a,function(_0x4a9221){if(_0x4a9221['type']!=='VIRTUAL'){var _0x38786e={};_0x38786e[_0x4a9221[_0xbd8b('0x25')]]={'$like':'%'+_0x1d9c28[_0xbd8b('0x2c')][_0xbd8b('0x38')]+'%'};return _0x38786e;}})});}_0x4d11a1=_[_0xbd8b('0x39')]({},_0x4d11a1,_0x1d9c28[_0xbd8b('0x3b')]);var _0x3eed8b={'where':_0x4d11a1[_0xbd8b('0x35')]};return db[_0xbd8b('0x3c')][_0xbd8b('0x1a')](_0x3eed8b)[_0xbd8b('0x22')](function(_0x2903e){_0x564569[_0xbd8b('0x1a')]=_0x2903e;if(_0x1d9c28[_0xbd8b('0x2c')]['includeAll']){_0x4d11a1['include']=[{'all':!![]}];}return db[_0xbd8b('0x3c')]['findAll'](_0x4d11a1);})['then'](function(_0x1fdfa9){_0x564569[_0xbd8b('0x3d')]=_0x1fdfa9;return _0x564569;})['then'](respondWithFilteredResult(_0xad1958,_0x4d11a1))[_0xbd8b('0x3e')](handleError(_0xad1958,null));};exports[_0xbd8b('0x3f')]=function(_0x59da53,_0x55771f){var _0x46d8f2={'raw':![],'where':{'id':_0x59da53[_0xbd8b('0x40')]['id']}},_0x126c73={};_0x126c73['model']=_['keys'](db['ServicenowAccount'][_0xbd8b('0x27')]);_0x126c73[_0xbd8b('0x2c')]=_[_0xbd8b('0x2d')](_0x59da53[_0xbd8b('0x2c')]);_0x126c73['filters']=_[_0xbd8b('0x2e')](_0x126c73['model'],_0x126c73[_0xbd8b('0x2c')]);_0x46d8f2[_0xbd8b('0x30')]=_[_0xbd8b('0x2e')](_0x126c73[_0xbd8b('0x2b')],qs[_0xbd8b('0x2f')](_0x59da53[_0xbd8b('0x2c')][_0xbd8b('0x2f')]));_0x46d8f2[_0xbd8b('0x30')]=_0x46d8f2[_0xbd8b('0x30')][_0xbd8b('0x31')]?_0x46d8f2[_0xbd8b('0x30')]:_0x126c73[_0xbd8b('0x2b')];if(_0x59da53[_0xbd8b('0x2c')][_0xbd8b('0x41')]){_0x46d8f2[_0xbd8b('0x42')]=[{'all':!![]}];}_0x46d8f2=_['merge']({},_0x46d8f2,_0x59da53[_0xbd8b('0x3b')]);return db[_0xbd8b('0x3c')][_0xbd8b('0x43')](_0x46d8f2)[_0xbd8b('0x22')](handleEntityNotFound(_0x55771f,null))[_0xbd8b('0x22')](respondWithResult(_0x55771f,null))['catch'](handleError(_0x55771f,null));};exports[_0xbd8b('0x44')]=function(_0x2140c8,_0x21a9f2){return db[_0xbd8b('0x3c')][_0xbd8b('0x44')](_0x2140c8[_0xbd8b('0x45')],{})[_0xbd8b('0x22')](respondWithResult(_0x21a9f2,0xc9))['catch'](handleError(_0x21a9f2,null));};exports[_0xbd8b('0x20')]=function(_0x23f70e,_0x12ab5c){if(_0x23f70e[_0xbd8b('0x45')]['id']){delete _0x23f70e['body']['id'];}return db[_0xbd8b('0x3c')][_0xbd8b('0x43')]({'where':{'id':_0x23f70e[_0xbd8b('0x40')]['id']}})[_0xbd8b('0x22')](handleEntityNotFound(_0x12ab5c,null))[_0xbd8b('0x22')](saveUpdates(_0x23f70e[_0xbd8b('0x45')],null))[_0xbd8b('0x22')](respondWithResult(_0x12ab5c,null))[_0xbd8b('0x3e')](handleError(_0x12ab5c,null));};exports[_0xbd8b('0x21')]=function(_0x4935dd,_0x4eb4a3){return db['ServicenowAccount']['find']({'where':{'id':_0x4935dd[_0xbd8b('0x40')]['id']}})[_0xbd8b('0x22')](handleEntityNotFound(_0x4eb4a3,null))[_0xbd8b('0x22')](removeEntity(_0x4eb4a3,null))['catch'](handleError(_0x4eb4a3,null));};exports[_0xbd8b('0x46')]=function(_0x28f254,_0x388b5f,_0x3507a1){var _0x29cfb9={};var _0x32b8a2={};var _0x8b2fac;var _0x751b54;return db[_0xbd8b('0x3c')][_0xbd8b('0x47')]({'where':{'id':_0x28f254['params']['id']}})[_0xbd8b('0x22')](handleEntityNotFound(_0x388b5f,null))[_0xbd8b('0x22')](function(_0x1d8fbf){if(_0x1d8fbf){_0x8b2fac=_0x1d8fbf;_0x32b8a2[_0xbd8b('0x2b')]=_['keys'](db[_0xbd8b('0x48')][_0xbd8b('0x27')]);_0x32b8a2[_0xbd8b('0x2c')]=_[_0xbd8b('0x2d')](_0x28f254[_0xbd8b('0x2c')]);_0x32b8a2['filters']=_[_0xbd8b('0x2e')](_0x32b8a2[_0xbd8b('0x2b')],_0x32b8a2[_0xbd8b('0x2c')]);_0x29cfb9[_0xbd8b('0x30')]=_['intersection'](_0x32b8a2['model'],qs['fields'](_0x28f254['query'][_0xbd8b('0x2f')]));_0x29cfb9[_0xbd8b('0x30')]=_0x29cfb9['attributes'][_0xbd8b('0x31')]?_0x29cfb9['attributes']:_0x32b8a2[_0xbd8b('0x2b')];_0x29cfb9[_0xbd8b('0x49')]=qs['sort'](_0x28f254[_0xbd8b('0x2c')][_0xbd8b('0x34')]);_0x29cfb9[_0xbd8b('0x35')]=qs[_0xbd8b('0x36')](_['pick'](_0x28f254['query'],_0x32b8a2[_0xbd8b('0x36')]));if(_0x28f254[_0xbd8b('0x2c')][_0xbd8b('0x38')]){_0x29cfb9['where']=_[_0xbd8b('0x39')](_0x29cfb9[_0xbd8b('0x35')],{'$or':_['map'](_0x29cfb9['attributes'],function(_0x4f3070){var _0x13ab37={};_0x13ab37[_0x4f3070]={'$like':'%'+_0x28f254[_0xbd8b('0x2c')]['filter']+'%'};return _0x13ab37;})});}_0x29cfb9=_[_0xbd8b('0x39')]({},_0x29cfb9,_0x28f254[_0xbd8b('0x3b')]);return _0x8b2fac['getConfigurations'](_0x29cfb9);}})[_0xbd8b('0x22')](function(_0x131cd4){if(_0x131cd4){_0x751b54=_0x131cd4[_0xbd8b('0x31')];if(!_0x28f254['query']['hasOwnProperty'](_0xbd8b('0x33'))){_0x29cfb9[_0xbd8b('0x18')]=qs['limit'](_0x28f254['query'][_0xbd8b('0x18')]);_0x29cfb9[_0xbd8b('0x17')]=qs['offset'](_0x28f254['query'][_0xbd8b('0x17')]);}return _0x8b2fac['getConfigurations'](_0x29cfb9);}})[_0xbd8b('0x22')](function(_0x4b11ab){if(_0x4b11ab){return _0x4b11ab?{'count':_0x751b54,'rows':_0x4b11ab}:null;}})[_0xbd8b('0x22')](respondWithResult(_0x388b5f,null))[_0xbd8b('0x3e')](handleError(_0x388b5f,null));};exports[_0xbd8b('0x4a')]=function(_0xda8017,_0xaa2f77,_0x3eea52){if(_0xda8017[_0xbd8b('0x45')]['id']){delete _0xda8017[_0xbd8b('0x45')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0xda8017['params']['id']}})['then'](handleEntityNotFound(_0xaa2f77,null))[_0xbd8b('0x22')](function(_0x4993e1){if(_0x4993e1){_0xda8017['body'][_0xbd8b('0x4b')]=_0x4993e1['id'];_0xda8017[_0xbd8b('0x45')][_0xbd8b('0x4c')]=integrations[_0xbd8b('0x4d')](_0xda8017[_0xbd8b('0x45')][_0xbd8b('0x4e')],_0xda8017[_0xbd8b('0x45')][_0xbd8b('0x29')]);_0xda8017[_0xbd8b('0x45')][_0xbd8b('0x4f')]=integrations[_0xbd8b('0x50')](_0xda8017[_0xbd8b('0x45')][_0xbd8b('0x4e')],_0xda8017['body'][_0xbd8b('0x29')]);return db[_0xbd8b('0x48')]['create'](_0xda8017[_0xbd8b('0x45')],{'include':[{'model':db[_0xbd8b('0x51')],'as':_0xbd8b('0x4c')},{'model':db[_0xbd8b('0x51')],'as':_0xbd8b('0x4f')}]});}return null;})[_0xbd8b('0x22')](respondWithResult(_0xaa2f77,null))[_0xbd8b('0x3e')](handleError(_0xaa2f77,null));};exports['getFields']=function(_0x3cda07,_0x4f15da,_0x385946){var _0x37165a=[_0xbd8b('0x52'),_0xbd8b('0x53'),_0xbd8b('0x54'),_0xbd8b('0x55'),_0xbd8b('0x56'),_0xbd8b('0x57'),_0xbd8b('0x58'),'severity',_0xbd8b('0x59')];var _0x261095=[_0xbd8b('0x5a'),_0xbd8b('0x52'),'caused_by',_0xbd8b('0x5b'),_0xbd8b('0x5c'),_0xbd8b('0x5d'),_0xbd8b('0x5e'),_0xbd8b('0x53'),'approval_history','number',_0xbd8b('0x5f'),'sys_updated_by',_0xbd8b('0x60'),_0xbd8b('0x61'),_0xbd8b('0x62'),_0xbd8b('0x63'),'state',_0xbd8b('0x64'),_0xbd8b('0x54'),_0xbd8b('0x49'),_0xbd8b('0x65'),'closed_at','cmdb_ci',_0xbd8b('0x66'),_0xbd8b('0x67'),_0xbd8b('0x68'),_0xbd8b('0x69'),_0xbd8b('0x6a'),_0xbd8b('0x6b'),_0xbd8b('0x6c'),'rfc','time_worked','expected_start',_0xbd8b('0x6d'),_0xbd8b('0x6e'),'group_list','work_end',_0xbd8b('0x6f'),_0xbd8b('0x70'),_0xbd8b('0x71'),_0xbd8b('0x72'),'subcategory',_0xbd8b('0x73'),_0xbd8b('0x74'),_0xbd8b('0x56'),_0xbd8b('0x75'),_0xbd8b('0x76'),_0xbd8b('0x77'),_0xbd8b('0x78'),'business_stc',_0xbd8b('0x79'),_0xbd8b('0x7a'),_0xbd8b('0x7b'),_0xbd8b('0x57'),_0xbd8b('0x7c'),_0xbd8b('0x7d'),_0xbd8b('0x7e'),'follow_up','parent_incident','sys_id','contact_type','reopened_by',_0xbd8b('0x58'),_0xbd8b('0x7f'),'problem_id',_0xbd8b('0x80'),_0xbd8b('0x81'),'activity_due',_0xbd8b('0x82'),_0xbd8b('0x83'),_0xbd8b('0x84'),_0xbd8b('0x85'),'approval',_0xbd8b('0x86'),_0xbd8b('0x87'),_0xbd8b('0x88'),_0xbd8b('0x89'),_0xbd8b('0x8a'),'escalation',_0xbd8b('0x8b'),_0xbd8b('0x8c'),_0xbd8b('0x8d'),_0xbd8b('0x59')];var _0x54328c='';var _0x53b0d7='';var _0x442409=[];var _0x4210f1='';var _0x465ffa='';var _0x58d36e=[];var _0x3146c5='';var _0x52e7dc='';var _0x2ecb5f={};var _0x277366='';return db['ServicenowAccount'][_0xbd8b('0x47')]({'where':{'id':_0x3cda07[_0xbd8b('0x40')]['id']},'attributes':['id',_0xbd8b('0x8e'),_0xbd8b('0x8f'),_0xbd8b('0x90'),_0xbd8b('0x91'),_0xbd8b('0x92')]})[_0xbd8b('0x22')](handleEntityNotFound(_0x4f15da,null))['then'](function(_0xc53640){if(_0xc53640){_0x277366=_0xc53640['remoteUri'];var _0xcde231=_0x277366[_0xbd8b('0x93')](-0x1);if(_0xcde231==='/'){_0x277366=_0x277366['substring'](0x0,_0x277366['lastIndexOf'](_0xcde231));}_0x52e7dc=util['format'](_0xbd8b('0x94'),_0x277366);_0x3146c5=util['format']('%s/api/now/table/',_0x277366);_0x2ecb5f={'user':_0xc53640[_0xbd8b('0x8e')],'pass':_0xc53640[_0xbd8b('0x8f')]};var _0x3d3417={'method':_0xbd8b('0x95'),'uri':_0x52e7dc+'incident?sysparm_display_value=all','auth':_0x2ecb5f,'json':!![]};return rp(_0x3d3417);}})[_0xbd8b('0x22')](function(_0x2b610a){if(_0x2b610a[_0xbd8b('0x96')][_0xbd8b('0x31')]>0x0){_0x54328c=_0x2b610a[_0xbd8b('0x96')];}console[_0xbd8b('0x97')]('incident\x20table\x20objects',_0x54328c);_0x58d36e=[];_0x53b0d7=Object[_0xbd8b('0x98')]([],_0x54328c);_[_0xbd8b('0x99')](_0x53b0d7,function(_0x6904ad){return!_0x37165a['includes'](_0x6904ad[_0xbd8b('0x25')]);});_0x53b0d7[_0xbd8b('0x9a')](function(_0x15b6fd){var _0x1f1fdb=createFieldObject(_0x3146c5,_0x2ecb5f,_0x15b6fd[_0xbd8b('0x9b')],_0x15b6fd['name'],_0x15b6fd[_0xbd8b('0x9c')],![]);_0x58d36e[_0xbd8b('0x9d')](_0x1f1fdb);});return Promise[_0xbd8b('0x9e')](_0x58d36e);})[_0xbd8b('0x22')](function(_0x4984c3){_0x442409=_0x4984c3;_0x4210f1=Object[_0xbd8b('0x98')]([],_0x54328c);console[_0xbd8b('0x97')](_0xbd8b('0x9f'),_0x54328c);_[_0xbd8b('0x99')](_0x4210f1,function(_0x33832d){return _0x261095[_0xbd8b('0xa0')](_0x33832d[_0xbd8b('0x25')]);});console[_0xbd8b('0x97')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4210f1);_0x58d36e=[];_0x4210f1[_0xbd8b('0x9a')](function(_0x7d7997){var _0x53e7a9=createFieldObject(_0x3146c5,_0x2ecb5f,_0x7d7997['internalType'],_0x7d7997[_0xbd8b('0x25')],_0x7d7997['label'],!![]);_0x58d36e[_0xbd8b('0x9d')](_0x53e7a9);});return Promise[_0xbd8b('0x9e')](_0x58d36e);})[_0xbd8b('0x22')](function(_0x47c10b){_0x465ffa=_0x47c10b;var _0x528e34=_0x442409[_0xbd8b('0xa1')](_0x465ffa);return{'count':_0x528e34[_0xbd8b('0x31')],'rows':_0x528e34};})[_0xbd8b('0x22')](respondWithResult(_0x4f15da,null))[_0xbd8b('0x3e')](function(_0x2a393b){console['log'](_0xbd8b('0xa2')+_0x2a393b);var _0x31c502=_0x3cda07[_0xbd8b('0x2c')][_0xbd8b('0xa3')]?0x1f4:_0x2a393b['statusCode']||0x1f4;logger['error'](_0x2a393b[_0xbd8b('0x24')]);delete _0x2a393b['name'];if(_0x31c502===0x191){_0x31c502=0x190;}_0x4f15da['status'](_0x31c502)[_0xbd8b('0x26')](_0x3cda07[_0xbd8b('0x2c')]['test']?{'message':_0xbd8b('0xa4'),'statusCode':_0x2a393b[_0xbd8b('0xa5')]}:_0x2a393b);});};function createFieldObject(_0x13e0ff,_0x583304,_0x4fe912,_0x25865d,_0x266862,_0x1a3999){return new Promise(function(_0x593692,_0x5de5d4){var _0xff645a={'id':_0x25865d,'name':_0x266862,'custom':_0x1a3999};if(_0x4fe912==='boolean'){_0xff645a[_0xbd8b('0x3b')]=[{'name':_0xbd8b('0xa6'),'value':_0xbd8b('0xa7')},{'name':'False','value':'false'}];_0x593692(_0xff645a);}else{var _0x1a45fe={'method':_0xbd8b('0x95'),'uri':_0x13e0ff+_0xbd8b('0xa8')+_0x25865d,'auth':_0x583304,'json':!![]};return rp(_0x1a45fe)[_0xbd8b('0x22')](function(_0x3f6498){var _0x580ddb=[];if(_0x3f6498['result'][_0xbd8b('0x31')]>0x0){_0x3f6498[_0xbd8b('0x96')][_0xbd8b('0x9a')](function(_0x53802f){if(_0x53802f[_0xbd8b('0xa9')]==='false'){var _0x3fd35b={'name':_0x53802f['label'],'value':_0x53802f[_0xbd8b('0xaa')]};_0x580ddb['push'](_0x3fd35b);}});}_0xff645a['options']=_0x580ddb;if(_0xff645a[_0xbd8b('0x3b')]['length']>0x0){_0x593692(_0xff645a);}else{if(_0x1a3999==![]){_0x593692();}else{_0x593692(_0xff645a);}}});}});} \ No newline at end of file +var _0x23bc=['request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','show','params','catch','create','body','find','ServicenowConfiguration','hasOwnProperty','nolimit','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','type','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','incident_state','category','parent','caused_by','upon_reject','approval_history','number','sys_updated_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','correlation_display','additional_assignee_list','description','sys_class_name','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','label','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch'];(function(_0x5318b3,_0x11719f){var _0x98249c=function(_0x3d7a1e){while(--_0x3d7a1e){_0x5318b3['push'](_0x5318b3['shift']());}};_0x98249c(++_0x11719f);}(_0x23bc,0xb1));var _0xc23b=function(_0x3e45ed,_0x11bf49){_0x3e45ed=_0x3e45ed-0x0;var _0xccda57=_0x23bc[_0x3e45ed];return _0xccda57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc23b('0x0'));var zipdir=require(_0xc23b('0x1'));var jsonpatch=require(_0xc23b('0x2'));var rp=require(_0xc23b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc23b('0x4'));var util=require(_0xc23b('0x5'));var path=require(_0xc23b('0x6'));var sox=require(_0xc23b('0x7'));var csv=require(_0xc23b('0x8'));var ejs=require(_0xc23b('0x9'));var fs=require('fs');var fs_extra=require(_0xc23b('0xa'));var _=require(_0xc23b('0xb'));var squel=require(_0xc23b('0xc'));var crypto=require('crypto');var jsforce=require(_0xc23b('0xd'));var deskjs=require(_0xc23b('0xe'));var toCsv=require(_0xc23b('0x8'));var querystring=require(_0xc23b('0xf'));var Papa=require(_0xc23b('0x10'));var Redis=require(_0xc23b('0x11'));var authService=require(_0xc23b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc23b('0x13'));var logger=require(_0xc23b('0x14'))(_0xc23b('0x15'));var utils=require(_0xc23b('0x16'));var config=require(_0xc23b('0x17'));var licenseUtil=require(_0xc23b('0x18'));var db=require(_0xc23b('0x19'))['db'];var integrations=require(_0xc23b('0x1a'));function respondWithStatusCode(_0x327cb6,_0x490a50){_0x490a50=_0x490a50||0xcc;return function(_0x22a5ee){if(_0x22a5ee){return _0x327cb6[_0xc23b('0x1b')](_0x490a50);}return _0x327cb6[_0xc23b('0x1c')](_0x490a50)['end']();};}function respondWithResult(_0x4d50b2,_0x41317d){_0x41317d=_0x41317d||0xc8;return function(_0x5d4374){if(_0x5d4374){return _0x4d50b2[_0xc23b('0x1c')](_0x41317d)[_0xc23b('0x1d')](_0x5d4374);}};}function respondWithFilteredResult(_0x366d60,_0x57aab9){return function(_0x1f48b7){if(_0x1f48b7){var _0x1d7a57=typeof _0x57aab9[_0xc23b('0x1e')]==='undefined'&&typeof _0x57aab9[_0xc23b('0x1f')]===_0xc23b('0x20');var _0x38e8e0=_0x1f48b7['count'];var _0x239062=_0x1d7a57?0x0:_0x57aab9[_0xc23b('0x1e')];var _0x13ffcc=_0x1d7a57?_0x1f48b7[_0xc23b('0x21')]:_0x57aab9['offset']+_0x57aab9['limit'];var _0x4f7cd8;if(_0x13ffcc>=_0x38e8e0){_0x13ffcc=_0x38e8e0;_0x4f7cd8=0xc8;}else{_0x4f7cd8=0xce;}_0x366d60[_0xc23b('0x1c')](_0x4f7cd8);return _0x366d60['set']('Content-Range',_0x239062+'-'+_0x13ffcc+'/'+_0x38e8e0)[_0xc23b('0x1d')](_0x1f48b7);}return null;};}function patchUpdates(_0xaebf91){return function(_0x4df54b){try{jsonpatch['apply'](_0x4df54b,_0xaebf91,!![]);}catch(_0xd02276){return BPromise[_0xc23b('0x22')](_0xd02276);}return _0x4df54b[_0xc23b('0x23')]();};}function saveUpdates(_0x4bdab5,_0x30dae9){return function(_0xe43e7){if(_0xe43e7){return _0xe43e7[_0xc23b('0x24')](_0x4bdab5)[_0xc23b('0x25')](function(_0x3b6b39){return _0x3b6b39;});}return null;};}function removeEntity(_0x4a3d62,_0x262445){return function(_0x157236){if(_0x157236){return _0x157236[_0xc23b('0x26')]()[_0xc23b('0x25')](function(){_0x4a3d62['status'](0xcc)[_0xc23b('0x27')]();});}};}function handleEntityNotFound(_0xae8934,_0x39f190){return function(_0x5c9059){if(!_0x5c9059){_0xae8934[_0xc23b('0x1b')](0x194);}return _0x5c9059;};}function handleError(_0x20fcce,_0x2a8a19){_0x2a8a19=_0x2a8a19||0x1f4;return function(_0x23cd46){logger[_0xc23b('0x28')](_0x23cd46[_0xc23b('0x29')]);if(_0x23cd46[_0xc23b('0x2a')]){delete _0x23cd46[_0xc23b('0x2a')];}_0x20fcce[_0xc23b('0x1c')](_0x2a8a19)['send'](_0x23cd46);};}exports[_0xc23b('0x2b')]=function(_0x5e0bcb,_0x2252a6){var _0x57c8b0={},_0x1c8479={},_0x207a3f={'count':0x0,'rows':[]};var _0x392e22=_[_0xc23b('0x2c')](db['ServicenowAccount'][_0xc23b('0x2d')],function(_0x376cff){return{'name':_0x376cff[_0xc23b('0x2e')],'type':_0x376cff['type'][_0xc23b('0x2f')]};});_0x1c8479['model']=_[_0xc23b('0x2c')](_0x392e22,'name');_0x1c8479['query']=_[_0xc23b('0x30')](_0x5e0bcb[_0xc23b('0x31')]);_0x1c8479[_0xc23b('0x32')]=_[_0xc23b('0x33')](_0x1c8479[_0xc23b('0x34')],_0x1c8479[_0xc23b('0x31')]);_0x57c8b0[_0xc23b('0x35')]=_[_0xc23b('0x33')](_0x1c8479[_0xc23b('0x34')],qs[_0xc23b('0x36')](_0x5e0bcb[_0xc23b('0x31')][_0xc23b('0x36')]));_0x57c8b0[_0xc23b('0x35')]=_0x57c8b0['attributes'][_0xc23b('0x37')]?_0x57c8b0[_0xc23b('0x35')]:_0x1c8479[_0xc23b('0x34')];if(!_0x5e0bcb[_0xc23b('0x31')]['hasOwnProperty']('nolimit')){_0x57c8b0[_0xc23b('0x1f')]=qs[_0xc23b('0x1f')](_0x5e0bcb[_0xc23b('0x31')]['limit']);_0x57c8b0[_0xc23b('0x1e')]=qs[_0xc23b('0x1e')](_0x5e0bcb[_0xc23b('0x31')][_0xc23b('0x1e')]);}_0x57c8b0[_0xc23b('0x38')]=qs[_0xc23b('0x39')](_0x5e0bcb['query'][_0xc23b('0x39')]);_0x57c8b0[_0xc23b('0x3a')]=qs[_0xc23b('0x32')](_[_0xc23b('0x3b')](_0x5e0bcb[_0xc23b('0x31')],_0x1c8479[_0xc23b('0x32')]),_0x392e22);if(_0x5e0bcb[_0xc23b('0x31')][_0xc23b('0x3c')]){_0x57c8b0['where']=_[_0xc23b('0x3d')](_0x57c8b0['where'],{'$or':_[_0xc23b('0x2c')](_0x392e22,function(_0x43c99d){if(_0x43c99d['type']!==_0xc23b('0x3e')){var _0x41cba3={};_0x41cba3[_0x43c99d['name']]={'$like':'%'+_0x5e0bcb[_0xc23b('0x31')][_0xc23b('0x3c')]+'%'};return _0x41cba3;}})});}_0x57c8b0=_[_0xc23b('0x3d')]({},_0x57c8b0,_0x5e0bcb[_0xc23b('0x3f')]);var _0x7054ff={'where':_0x57c8b0['where']};return db[_0xc23b('0x40')][_0xc23b('0x21')](_0x7054ff)['then'](function(_0x3137d6){_0x207a3f['count']=_0x3137d6;if(_0x5e0bcb['query'][_0xc23b('0x41')]){_0x57c8b0[_0xc23b('0x42')]=[{'all':!![]}];}return db[_0xc23b('0x40')][_0xc23b('0x43')](_0x57c8b0);})[_0xc23b('0x25')](function(_0x39887d){_0x207a3f['rows']=_0x39887d;return _0x207a3f;})[_0xc23b('0x25')](respondWithFilteredResult(_0x2252a6,_0x57c8b0))['catch'](handleError(_0x2252a6,null));};exports[_0xc23b('0x44')]=function(_0x4fa092,_0x78b4bd){var _0x496f61={'raw':![],'where':{'id':_0x4fa092[_0xc23b('0x45')]['id']}},_0x1d40ab={};_0x1d40ab['model']=_['keys'](db['ServicenowAccount'][_0xc23b('0x2d')]);_0x1d40ab[_0xc23b('0x31')]=_[_0xc23b('0x30')](_0x4fa092[_0xc23b('0x31')]);_0x1d40ab[_0xc23b('0x32')]=_['intersection'](_0x1d40ab['model'],_0x1d40ab[_0xc23b('0x31')]);_0x496f61['attributes']=_[_0xc23b('0x33')](_0x1d40ab[_0xc23b('0x34')],qs[_0xc23b('0x36')](_0x4fa092[_0xc23b('0x31')][_0xc23b('0x36')]));_0x496f61['attributes']=_0x496f61[_0xc23b('0x35')]['length']?_0x496f61[_0xc23b('0x35')]:_0x1d40ab[_0xc23b('0x34')];if(_0x4fa092['query'][_0xc23b('0x41')]){_0x496f61[_0xc23b('0x42')]=[{'all':!![]}];}_0x496f61=_[_0xc23b('0x3d')]({},_0x496f61,_0x4fa092[_0xc23b('0x3f')]);return db['ServicenowAccount']['find'](_0x496f61)[_0xc23b('0x25')](handleEntityNotFound(_0x78b4bd,null))[_0xc23b('0x25')](respondWithResult(_0x78b4bd,null))[_0xc23b('0x46')](handleError(_0x78b4bd,null));};exports[_0xc23b('0x47')]=function(_0x3294c0,_0x3f41bb){return db[_0xc23b('0x40')]['create'](_0x3294c0[_0xc23b('0x48')],{})[_0xc23b('0x25')](respondWithResult(_0x3f41bb,0xc9))[_0xc23b('0x46')](handleError(_0x3f41bb,null));};exports[_0xc23b('0x24')]=function(_0x2ff9d9,_0x35d0ce){if(_0x2ff9d9[_0xc23b('0x48')]['id']){delete _0x2ff9d9['body']['id'];}return db[_0xc23b('0x40')][_0xc23b('0x49')]({'where':{'id':_0x2ff9d9['params']['id']}})[_0xc23b('0x25')](handleEntityNotFound(_0x35d0ce,null))[_0xc23b('0x25')](saveUpdates(_0x2ff9d9[_0xc23b('0x48')],null))['then'](respondWithResult(_0x35d0ce,null))[_0xc23b('0x46')](handleError(_0x35d0ce,null));};exports[_0xc23b('0x26')]=function(_0x10e1bd,_0x272692){return db[_0xc23b('0x40')][_0xc23b('0x49')]({'where':{'id':_0x10e1bd[_0xc23b('0x45')]['id']}})[_0xc23b('0x25')](handleEntityNotFound(_0x272692,null))['then'](removeEntity(_0x272692,null))[_0xc23b('0x46')](handleError(_0x272692,null));};exports['getConfigurations']=function(_0x4dced2,_0x468ff5,_0x59bc97){var _0xa63a3={};var _0x1e736f={};var _0x384d87;var _0x6ebf17;return db[_0xc23b('0x40')]['findOne']({'where':{'id':_0x4dced2[_0xc23b('0x45')]['id']}})[_0xc23b('0x25')](handleEntityNotFound(_0x468ff5,null))[_0xc23b('0x25')](function(_0x111d60){if(_0x111d60){_0x384d87=_0x111d60;_0x1e736f['model']=_[_0xc23b('0x30')](db[_0xc23b('0x4a')]['rawAttributes']);_0x1e736f[_0xc23b('0x31')]=_[_0xc23b('0x30')](_0x4dced2[_0xc23b('0x31')]);_0x1e736f[_0xc23b('0x32')]=_['intersection'](_0x1e736f['model'],_0x1e736f['query']);_0xa63a3[_0xc23b('0x35')]=_[_0xc23b('0x33')](_0x1e736f['model'],qs[_0xc23b('0x36')](_0x4dced2[_0xc23b('0x31')][_0xc23b('0x36')]));_0xa63a3[_0xc23b('0x35')]=_0xa63a3[_0xc23b('0x35')]['length']?_0xa63a3[_0xc23b('0x35')]:_0x1e736f[_0xc23b('0x34')];_0xa63a3[_0xc23b('0x38')]=qs['sort'](_0x4dced2[_0xc23b('0x31')][_0xc23b('0x39')]);_0xa63a3[_0xc23b('0x3a')]=qs['filters'](_[_0xc23b('0x3b')](_0x4dced2[_0xc23b('0x31')],_0x1e736f['filters']));if(_0x4dced2['query'][_0xc23b('0x3c')]){_0xa63a3[_0xc23b('0x3a')]=_[_0xc23b('0x3d')](_0xa63a3[_0xc23b('0x3a')],{'$or':_[_0xc23b('0x2c')](_0xa63a3[_0xc23b('0x35')],function(_0x10fd56){var _0x51611e={};_0x51611e[_0x10fd56]={'$like':'%'+_0x4dced2[_0xc23b('0x31')]['filter']+'%'};return _0x51611e;})});}_0xa63a3=_[_0xc23b('0x3d')]({},_0xa63a3,_0x4dced2[_0xc23b('0x3f')]);return _0x384d87['getConfigurations'](_0xa63a3);}})[_0xc23b('0x25')](function(_0x2a5a6f){if(_0x2a5a6f){_0x6ebf17=_0x2a5a6f['length'];if(!_0x4dced2[_0xc23b('0x31')][_0xc23b('0x4b')](_0xc23b('0x4c'))){_0xa63a3[_0xc23b('0x1f')]=qs[_0xc23b('0x1f')](_0x4dced2[_0xc23b('0x31')][_0xc23b('0x1f')]);_0xa63a3[_0xc23b('0x1e')]=qs[_0xc23b('0x1e')](_0x4dced2['query'][_0xc23b('0x1e')]);}return _0x384d87[_0xc23b('0x4d')](_0xa63a3);}})[_0xc23b('0x25')](function(_0x4ed46f){if(_0x4ed46f){return _0x4ed46f?{'count':_0x6ebf17,'rows':_0x4ed46f}:null;}})[_0xc23b('0x25')](respondWithResult(_0x468ff5,null))[_0xc23b('0x46')](handleError(_0x468ff5,null));};exports[_0xc23b('0x4e')]=function(_0x3f15bc,_0x497048,_0x46666e){if(_0x3f15bc[_0xc23b('0x48')]['id']){delete _0x3f15bc[_0xc23b('0x48')]['id'];}return db[_0xc23b('0x40')][_0xc23b('0x4f')]({'where':{'id':_0x3f15bc[_0xc23b('0x45')]['id']}})[_0xc23b('0x25')](handleEntityNotFound(_0x497048,null))[_0xc23b('0x25')](function(_0x342554){if(_0x342554){_0x3f15bc[_0xc23b('0x48')][_0xc23b('0x50')]=_0x342554['id'];_0x3f15bc[_0xc23b('0x48')][_0xc23b('0x51')]=integrations['getSubjects'](_0x3f15bc['body'][_0xc23b('0x52')],_0x3f15bc[_0xc23b('0x48')][_0xc23b('0x53')]);_0x3f15bc[_0xc23b('0x48')][_0xc23b('0x54')]=integrations[_0xc23b('0x55')](_0x3f15bc['body'][_0xc23b('0x52')],_0x3f15bc[_0xc23b('0x48')]['type']);return db[_0xc23b('0x4a')][_0xc23b('0x47')](_0x3f15bc[_0xc23b('0x48')],{'include':[{'model':db['ServicenowField'],'as':_0xc23b('0x51')},{'model':db[_0xc23b('0x56')],'as':'Descriptions'}]});}return null;})[_0xc23b('0x25')](respondWithResult(_0x497048,null))[_0xc23b('0x46')](handleError(_0x497048,null));};exports[_0xc23b('0x57')]=function(_0x23ee73,_0x3f9d20,_0x541166){var _0x29b2d3=[_0xc23b('0x58'),_0xc23b('0x59'),_0xc23b('0x5a'),'subcategory',_0xc23b('0x5b'),_0xc23b('0x5c'),_0xc23b('0x5d'),'severity',_0xc23b('0x5e')];var _0x25605c=[_0xc23b('0x5f'),'made_sla',_0xc23b('0x60'),'watch_list',_0xc23b('0x61'),'sys_updated_on','child_incidents','hold_reason',_0xc23b('0x62'),_0xc23b('0x63'),'resolved_by',_0xc23b('0x64'),'opened_by','user_input',_0xc23b('0x65'),_0xc23b('0x66'),'state',_0xc23b('0x67'),_0xc23b('0x5a'),_0xc23b('0x38'),_0xc23b('0x68'),_0xc23b('0x69'),_0xc23b('0x6a'),_0xc23b('0x6b'),'impact',_0xc23b('0x6c'),'work_notes_list',_0xc23b('0x6d'),_0xc23b('0x6e'),_0xc23b('0x6f'),_0xc23b('0x70'),_0xc23b('0x71'),'expected_start',_0xc23b('0x72'),_0xc23b('0x73'),_0xc23b('0x74'),_0xc23b('0x75'),_0xc23b('0x76'),_0xc23b('0x77'),_0xc23b('0x78'),_0xc23b('0x79'),_0xc23b('0x7a'),'work_notes','short_description',_0xc23b('0x5b'),_0xc23b('0x7b'),'delivery_task','work_start','assignment_group','business_stc',_0xc23b('0x7c'),_0xc23b('0x7d'),'calendar_duration',_0xc23b('0x5c'),_0xc23b('0x7e'),'close_notes',_0xc23b('0x7f'),_0xc23b('0x80'),_0xc23b('0x81'),'sys_id',_0xc23b('0x82'),_0xc23b('0x83'),'incident_state',_0xc23b('0x84'),_0xc23b('0x85'),'company',_0xc23b('0x86'),_0xc23b('0x87'),_0xc23b('0x88'),'severity','comments','sla_due','approval',_0xc23b('0x89'),_0xc23b('0x8a'),_0xc23b('0x8b'),_0xc23b('0x8c'),_0xc23b('0x8d'),_0xc23b('0x8e'),_0xc23b('0x8f'),_0xc23b('0x90'),_0xc23b('0x91'),_0xc23b('0x5e')];var _0x99ed49='';var _0x1d990f='';var _0x12501e=[];var _0x2865df='';var _0x991a36='';var _0x1d18d5=[];var _0xb5898b='';var _0x5cab4c='';var _0x119843={};var _0x6e37fb='';return db['ServicenowAccount'][_0xc23b('0x4f')]({'where':{'id':_0x23ee73[_0xc23b('0x45')]['id']},'attributes':['id',_0xc23b('0x92'),_0xc23b('0x93'),'email',_0xc23b('0x94'),_0xc23b('0x95')]})[_0xc23b('0x25')](handleEntityNotFound(_0x3f9d20,null))[_0xc23b('0x25')](function(_0x338e24){if(_0x338e24){_0x6e37fb=_0x338e24[_0xc23b('0x94')];var _0x359d2b=_0x6e37fb[_0xc23b('0x96')](-0x1);if(_0x359d2b==='/'){_0x6e37fb=_0x6e37fb[_0xc23b('0x97')](0x0,_0x6e37fb[_0xc23b('0x98')](_0x359d2b));}_0x5cab4c=util[_0xc23b('0x99')](_0xc23b('0x9a'),_0x6e37fb);_0xb5898b=util['format'](_0xc23b('0x9b'),_0x6e37fb);_0x119843={'user':_0x338e24[_0xc23b('0x92')],'pass':_0x338e24[_0xc23b('0x93')]};var _0x3b6885={'method':_0xc23b('0x9c'),'uri':_0x5cab4c+_0xc23b('0x9d'),'auth':_0x119843,'json':!![]};return rp(_0x3b6885);}})[_0xc23b('0x25')](function(_0x1693aa){if(_0x1693aa[_0xc23b('0x9e')]['length']>0x0){_0x99ed49=_0x1693aa['result'];}console[_0xc23b('0x9f')]('incident\x20table\x20objects',_0x99ed49);_0x1d18d5=[];_0x1d990f=Object[_0xc23b('0xa0')]([],_0x99ed49);_[_0xc23b('0xa1')](_0x1d990f,function(_0x5f59fe){return!_0x29b2d3[_0xc23b('0xa2')](_0x5f59fe['name']);});_0x1d990f[_0xc23b('0xa3')](function(_0x49398a){var _0x3ac979=createFieldObject(_0xb5898b,_0x119843,_0x49398a[_0xc23b('0xa4')],_0x49398a['name'],_0x49398a['label'],![]);_0x1d18d5[_0xc23b('0xa5')](_0x3ac979);});return Promise[_0xc23b('0xa6')](_0x1d18d5);})[_0xc23b('0x25')](function(_0x2f1be1){_0x12501e=_0x2f1be1;_0x2865df=Object[_0xc23b('0xa0')]([],_0x99ed49);console[_0xc23b('0x9f')](_0xc23b('0xa7'),_0x99ed49);_[_0xc23b('0xa1')](_0x2865df,function(_0x2071f3){return _0x25605c[_0xc23b('0xa2')](_0x2071f3['name']);});console[_0xc23b('0x9f')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x2865df);_0x1d18d5=[];_0x2865df[_0xc23b('0xa3')](function(_0x3d665){var _0x5f4802=createFieldObject(_0xb5898b,_0x119843,_0x3d665[_0xc23b('0xa4')],_0x3d665[_0xc23b('0x2a')],_0x3d665[_0xc23b('0xa8')],!![]);_0x1d18d5[_0xc23b('0xa5')](_0x5f4802);});return Promise[_0xc23b('0xa6')](_0x1d18d5);})[_0xc23b('0x25')](function(_0x33c8e1){_0x991a36=_0x33c8e1;var _0x2468c1=_0x12501e['concat'](_0x991a36);return{'count':_0x2468c1[_0xc23b('0x37')],'rows':_0x2468c1};})[_0xc23b('0x25')](respondWithResult(_0x3f9d20,null))[_0xc23b('0x46')](function(_0x4f687a){console[_0xc23b('0x9f')]('ServiceNow\x20error:\x20'+_0x4f687a);var _0x292143=_0x23ee73['query'][_0xc23b('0xa9')]?0x1f4:_0x4f687a[_0xc23b('0xaa')]||0x1f4;logger[_0xc23b('0x28')](_0x4f687a[_0xc23b('0x29')]);delete _0x4f687a['name'];if(_0x292143===0x191){_0x292143=0x190;}_0x3f9d20[_0xc23b('0x1c')](_0x292143)['send'](_0x23ee73[_0xc23b('0x31')][_0xc23b('0xa9')]?{'message':_0xc23b('0xab'),'statusCode':_0x4f687a[_0xc23b('0xaa')]}:_0x4f687a);});};function createFieldObject(_0x59f3a2,_0x5afdf4,_0x20d336,_0x33a9f7,_0x566b65,_0x35faa3){return new Promise(function(_0x516d87,_0x331776){var _0x4b7ff7={'id':_0x33a9f7,'name':_0x566b65,'custom':_0x35faa3};if(_0x20d336===_0xc23b('0xac')){_0x4b7ff7[_0xc23b('0x3f')]=[{'name':_0xc23b('0xad'),'value':_0xc23b('0xae')},{'name':_0xc23b('0xaf'),'value':_0xc23b('0xb0')}];_0x516d87(_0x4b7ff7);}else{var _0x358eae={'method':'GET','uri':_0x59f3a2+_0xc23b('0xb1')+_0x33a9f7,'auth':_0x5afdf4,'json':!![]};return rp(_0x358eae)[_0xc23b('0x25')](function(_0x2dd0c3){var _0x20d831=[];if(_0x2dd0c3[_0xc23b('0x9e')][_0xc23b('0x37')]>0x0){_0x2dd0c3['result'][_0xc23b('0xa3')](function(_0x1b46f2){if(_0x1b46f2[_0xc23b('0xb2')]==='false'){var _0x75a1b0={'name':_0x1b46f2[_0xc23b('0xa8')],'value':_0x1b46f2[_0xc23b('0xb3')]};_0x20d831[_0xc23b('0xa5')](_0x75a1b0);}});}_0x4b7ff7[_0xc23b('0x3f')]=_0x20d831;if(_0x4b7ff7[_0xc23b('0x3f')][_0xc23b('0x37')]>0x0){_0x516d87(_0x4b7ff7);}else{if(_0x35faa3==![]){_0x516d87();}else{_0x516d87(_0x4b7ff7);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f316d34..119a01d 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 _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x575bf0,_0x3ca9cb){var _0x32bc42=function(_0x3d8b71){while(--_0x3d8b71){_0x575bf0['push'](_0x575bf0['shift']());}};_0x32bc42(++_0x3ca9cb);}(_0x31f0,0xb7));var _0x031f=function(_0x43d14f,_0x51cfa0){_0x43d14f=_0x43d14f-0x0;var _0x1abcb9=_0x31f0[_0x43d14f];return _0x1abcb9;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x57bad4,_0x1367ed){var _0x4ca24d=function(_0x30a88b){while(--_0x30a88b){_0x57bad4['push'](_0x57bad4['shift']());}};_0x4ca24d(++_0x1367ed);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x469610,_0x2a992a){_0x469610=_0x469610-0x0;var _0x116384=_0xdbf5[_0x469610];return _0x116384;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','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 5200288..d1fd3fd 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 _0xcaf1=['rpc','../../config/environment','jayson/promise','client','http','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','model','then','catch','find','map','ShowServicenowAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x482438,_0x39c98e){var _0x538a04=function(_0x36b8d0){while(--_0x36b8d0){_0x482438['push'](_0x482438['shift']());}};_0x538a04(++_0x39c98e);}(_0xcaf1,0x89));var _0x1caf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1caf('0x0'));var moment=require(_0x1caf('0x1'));var BPromise=require(_0x1caf('0x2'));var rs=require(_0x1caf('0x3'));var fs=require('fs');var Redis=require(_0x1caf('0x4'));var db=require(_0x1caf('0x5'))['db'];var utils=require(_0x1caf('0x6'));var logger=require('../../config/logger')(_0x1caf('0x7'));var config=require(_0x1caf('0x8'));var jayson=require(_0x1caf('0x9'));var client=jayson[_0x1caf('0xa')][_0x1caf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0e2a,_0xde597c,_0x1f2cc9){return new BPromise(function(_0x11423a,_0x1c89a6){return client['request'](_0x1f0e2a,_0x1f2cc9)['then'](function(_0x388940){logger[_0x1caf('0xc')](_0x1caf('0xd'),_0xde597c,'request\x20sent');logger[_0x1caf('0xe')](_0x1caf('0xf'),_0xde597c,_0x1caf('0x10'),JSON[_0x1caf('0x11')](_0x388940));if(_0x388940[_0x1caf('0x12')]){if(_0x388940[_0x1caf('0x12')][_0x1caf('0x13')]===0x1f4){logger[_0x1caf('0x12')](_0x1caf('0xd'),_0xde597c,_0x388940['error'][_0x1caf('0x14')]);return _0x1c89a6(_0x388940[_0x1caf('0x12')]['message']);}logger['error'](_0x1caf('0xd'),_0xde597c,_0x388940[_0x1caf('0x12')][_0x1caf('0x14')]);return _0x11423a(_0x388940[_0x1caf('0x12')][_0x1caf('0x14')]);}else{logger[_0x1caf('0xc')](_0x1caf('0xd'),_0xde597c,'request\x20sent');_0x11423a(_0x388940[_0x1caf('0x15')][_0x1caf('0x14')]);}})['catch'](function(_0x4e54ec){logger['error'](_0x1caf('0xd'),_0xde597c,_0x4e54ec);_0x1c89a6(_0x4e54ec);});});}exports[_0x1caf('0x16')]=function(_0x28b648){var _0x5a2474=this;return new Promise(function(_0x36aa3a,_0x3b17bf){return db[_0x1caf('0x17')][_0x1caf('0x18')]({'raw':_0x28b648[_0x1caf('0x19')]?_0x28b648[_0x1caf('0x19')][_0x1caf('0x1a')]===undefined?!![]:![]:!![],'where':_0x28b648[_0x1caf('0x19')]?_0x28b648['options']['where']||null:null,'attributes':_0x28b648[_0x1caf('0x19')]?_0x28b648[_0x1caf('0x19')][_0x1caf('0x1b')]||null:null,'limit':_0x28b648[_0x1caf('0x19')]?_0x28b648[_0x1caf('0x19')][_0x1caf('0x1c')]||null:null,'include':_0x28b648[_0x1caf('0x19')]?_0x28b648['options'][_0x1caf('0x1d')]?_['map'](_0x28b648[_0x1caf('0x19')][_0x1caf('0x1d')],function(_0x54bcbd){return{'model':db[_0x54bcbd['model']],'as':_0x54bcbd['as'],'attributes':_0x54bcbd[_0x1caf('0x1b')],'include':_0x54bcbd[_0x1caf('0x1d')]?_['map'](_0x54bcbd[_0x1caf('0x1d')],function(_0x2405f6){return{'model':db[_0x2405f6[_0x1caf('0x1e')]],'as':_0x2405f6['as'],'attributes':_0x2405f6[_0x1caf('0x1b')],'include':_0x2405f6[_0x1caf('0x1d')]?_['map'](_0x2405f6[_0x1caf('0x1d')],function(_0x569296){return{'model':db[_0x569296['model']],'as':_0x569296['as'],'attributes':_0x569296['attributes']};}):[]};}):[]};}):[]:[]})[_0x1caf('0x1f')](function(_0x4ca1c6){logger[_0x1caf('0xc')](_0x1caf('0x16'),_0x28b648);logger['debug'](_0x1caf('0x16'),_0x28b648,JSON[_0x1caf('0x11')](_0x4ca1c6));_0x36aa3a(_0x4ca1c6);})[_0x1caf('0x20')](function(_0x4fc52f){logger['error'](_0x1caf('0x16'),_0x4fc52f[_0x1caf('0x14')],_0x28b648);_0x3b17bf(_0x5a2474[_0x1caf('0x12')](0x1f4,_0x4fc52f[_0x1caf('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x2b7118){var _0x56f041=this;return new Promise(function(_0x3627d2,_0x39b21b){return db[_0x1caf('0x17')][_0x1caf('0x21')]({'raw':_0x2b7118[_0x1caf('0x19')]?_0x2b7118['options'][_0x1caf('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b7118[_0x1caf('0x19')]?_0x2b7118[_0x1caf('0x19')]['where']||null:null,'attributes':_0x2b7118[_0x1caf('0x19')]?_0x2b7118[_0x1caf('0x19')][_0x1caf('0x1b')]||null:null,'include':_0x2b7118[_0x1caf('0x19')]?_0x2b7118[_0x1caf('0x19')][_0x1caf('0x1d')]?_[_0x1caf('0x22')](_0x2b7118[_0x1caf('0x19')][_0x1caf('0x1d')],function(_0x23a8fc){return{'model':db[_0x23a8fc[_0x1caf('0x1e')]],'as':_0x23a8fc['as'],'attributes':_0x23a8fc['attributes'],'include':_0x23a8fc['include']?_[_0x1caf('0x22')](_0x23a8fc[_0x1caf('0x1d')],function(_0x550d94){return{'model':db[_0x550d94[_0x1caf('0x1e')]],'as':_0x550d94['as'],'attributes':_0x550d94[_0x1caf('0x1b')],'include':_0x550d94[_0x1caf('0x1d')]?_[_0x1caf('0x22')](_0x550d94[_0x1caf('0x1d')],function(_0x326302){return{'model':db[_0x326302[_0x1caf('0x1e')]],'as':_0x326302['as'],'attributes':_0x326302['attributes']};}):[]};}):[]};}):[]:[]})[_0x1caf('0x1f')](function(_0x2d2f9f){logger['info'](_0x1caf('0x23'),_0x2b7118);logger[_0x1caf('0xe')](_0x1caf('0x23'),_0x2b7118,JSON[_0x1caf('0x11')](_0x2d2f9f));_0x3627d2(_0x2d2f9f);})['catch'](function(_0x5862f3){logger['error'](_0x1caf('0x23'),_0x5862f3['message'],_0x2b7118);_0x39b21b(_0x56f041[_0x1caf('0x12')](0x1f4,_0x5862f3[_0x1caf('0x14')]));});});}; \ No newline at end of file +var _0x528f=['ioredis','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','model','include','map','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x528f,0xe9));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf528('0x0'));var util=require(_0xf528('0x1'));var moment=require(_0xf528('0x2'));var BPromise=require(_0xf528('0x3'));var rs=require(_0xf528('0x4'));var fs=require('fs');var Redis=require(_0xf528('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf528('0x6'));var logger=require(_0xf528('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf528('0x8')][_0xf528('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a499,_0xd8f703,_0x25349b){return new BPromise(function(_0x4b8418,_0x4d06ad){return client[_0xf528('0xa')](_0x32a499,_0x25349b)[_0xf528('0xb')](function(_0x4508f3){logger[_0xf528('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0xd8f703,_0xf528('0xd'));logger[_0xf528('0xe')](_0xf528('0xf'),_0xd8f703,_0xf528('0xd'),JSON[_0xf528('0x10')](_0x4508f3));if(_0x4508f3[_0xf528('0x11')]){if(_0x4508f3[_0xf528('0x11')][_0xf528('0x12')]===0x1f4){logger[_0xf528('0x11')](_0xf528('0x13'),_0xd8f703,_0x4508f3[_0xf528('0x11')][_0xf528('0x14')]);return _0x4d06ad(_0x4508f3[_0xf528('0x11')][_0xf528('0x14')]);}logger[_0xf528('0x11')](_0xf528('0x13'),_0xd8f703,_0x4508f3['error'][_0xf528('0x14')]);return _0x4b8418(_0x4508f3[_0xf528('0x11')]['message']);}else{logger['info'](_0xf528('0x13'),_0xd8f703,_0xf528('0xd'));_0x4b8418(_0x4508f3['result'][_0xf528('0x14')]);}})[_0xf528('0x15')](function(_0x474c18){logger[_0xf528('0x11')](_0xf528('0x13'),_0xd8f703,_0x474c18);_0x4d06ad(_0x474c18);});});}exports[_0xf528('0x16')]=function(_0x4dd248){var _0x632ce0=this;return new Promise(function(_0x1f9ad8,_0x3ecb8d){return db[_0xf528('0x17')][_0xf528('0x18')]({'raw':_0x4dd248[_0xf528('0x19')]?_0x4dd248[_0xf528('0x19')][_0xf528('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dd248[_0xf528('0x19')]?_0x4dd248[_0xf528('0x19')][_0xf528('0x1b')]||null:null,'attributes':_0x4dd248['options']?_0x4dd248['options'][_0xf528('0x1c')]||null:null,'limit':_0x4dd248[_0xf528('0x19')]?_0x4dd248[_0xf528('0x19')]['limit']||null:null,'include':_0x4dd248['options']?_0x4dd248['options']['include']?_['map'](_0x4dd248[_0xf528('0x19')]['include'],function(_0x4183d2){return{'model':db[_0x4183d2[_0xf528('0x1d')]],'as':_0x4183d2['as'],'attributes':_0x4183d2[_0xf528('0x1c')],'include':_0x4183d2[_0xf528('0x1e')]?_['map'](_0x4183d2[_0xf528('0x1e')],function(_0x16bd26){return{'model':db[_0x16bd26[_0xf528('0x1d')]],'as':_0x16bd26['as'],'attributes':_0x16bd26[_0xf528('0x1c')],'include':_0x16bd26['include']?_[_0xf528('0x1f')](_0x16bd26['include'],function(_0x3566a9){return{'model':db[_0x3566a9[_0xf528('0x1d')]],'as':_0x3566a9['as'],'attributes':_0x3566a9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1158cf){logger[_0xf528('0xc')](_0xf528('0x16'),_0x4dd248);logger[_0xf528('0xe')](_0xf528('0x16'),_0x4dd248,JSON['stringify'](_0x1158cf));_0x1f9ad8(_0x1158cf);})[_0xf528('0x15')](function(_0x91bf73){logger[_0xf528('0x11')](_0xf528('0x16'),_0x91bf73[_0xf528('0x14')],_0x4dd248);_0x3ecb8d(_0x632ce0[_0xf528('0x11')](0x1f4,_0x91bf73[_0xf528('0x14')]));});});};exports[_0xf528('0x20')]=function(_0x239b76){var _0x2ec811=this;return new Promise(function(_0xfcf545,_0x2e82df){return db[_0xf528('0x17')][_0xf528('0x21')]({'raw':_0x239b76[_0xf528('0x19')]?_0x239b76[_0xf528('0x19')][_0xf528('0x1a')]===undefined?!![]:![]:!![],'where':_0x239b76[_0xf528('0x19')]?_0x239b76['options'][_0xf528('0x1b')]||null:null,'attributes':_0x239b76[_0xf528('0x19')]?_0x239b76['options'][_0xf528('0x1c')]||null:null,'include':_0x239b76[_0xf528('0x19')]?_0x239b76['options']['include']?_[_0xf528('0x1f')](_0x239b76[_0xf528('0x19')][_0xf528('0x1e')],function(_0x651e45){return{'model':db[_0x651e45[_0xf528('0x1d')]],'as':_0x651e45['as'],'attributes':_0x651e45[_0xf528('0x1c')],'include':_0x651e45[_0xf528('0x1e')]?_[_0xf528('0x1f')](_0x651e45[_0xf528('0x1e')],function(_0x30e992){return{'model':db[_0x30e992[_0xf528('0x1d')]],'as':_0x30e992['as'],'attributes':_0x30e992['attributes'],'include':_0x30e992['include']?_[_0xf528('0x1f')](_0x30e992[_0xf528('0x1e')],function(_0x4c46d0){return{'model':db[_0x4c46d0[_0xf528('0x1d')]],'as':_0x4c46d0['as'],'attributes':_0x4c46d0[_0xf528('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf528('0xb')](function(_0x1f9043){logger[_0xf528('0xc')](_0xf528('0x20'),_0x239b76);logger['debug'](_0xf528('0x20'),_0x239b76,JSON[_0xf528('0x10')](_0x1f9043));_0xfcf545(_0x1f9043);})[_0xf528('0x15')](function(_0x5ef47d){logger[_0xf528('0x11')](_0xf528('0x20'),_0x5ef47d[_0xf528('0x14')],_0x239b76);_0x2e82df(_0x2ec811['error'](0x1f4,_0x5ef47d[_0xf528('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index cf4fce8..84573ac 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 _0xb68c=['destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/fields','getDescriptions','post','create','update','delete'];(function(_0x5b4473,_0x1c5e15){var _0x4d0302=function(_0x48389a){while(--_0x48389a){_0x5b4473['push'](_0x5b4473['shift']());}};_0x4d0302(++_0x1c5e15);}(_0xb68c,0xe5));var _0xcb68=function(_0x2b5580,_0x15b0c1){_0x2b5580=_0x2b5580-0x0;var _0x2b5bf3=_0xb68c[_0x2b5580];return _0x2b5bf3;};'use strict';var multer=require(_0xcb68('0x0'));var util=require(_0xcb68('0x1'));var path=require(_0xcb68('0x2'));var timeout=require(_0xcb68('0x3'));var express=require(_0xcb68('0x4'));var router=express[_0xcb68('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcb68('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xcb68('0x7')]);router[_0xcb68('0x8')](_0xcb68('0x9'),auth[_0xcb68('0xa')](),controller[_0xcb68('0xb')]);router['get'](_0xcb68('0xc'),auth[_0xcb68('0xa')](),controller['getFields']);router[_0xcb68('0x8')]('/:id/subjects',auth[_0xcb68('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xcb68('0xd')]);router[_0xcb68('0xe')]('/',auth[_0xcb68('0xa')](),controller[_0xcb68('0xf')]);router['put'](_0xcb68('0x9'),auth[_0xcb68('0xa')](),controller[_0xcb68('0x10')]);router[_0xcb68('0x11')]('/:id',auth[_0xcb68('0xa')](),controller[_0xcb68('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1860=['put','destroy','exports','path','express','Router','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post'];(function(_0x4d9443,_0xe0d01f){var _0x350586=function(_0x1e8783){while(--_0x1e8783){_0x4d9443['push'](_0x4d9443['shift']());}};_0x350586(++_0xe0d01f);}(_0x1860,0x1ac));var _0x0186=function(_0x3b801f,_0x5182b8){_0x3b801f=_0x3b801f-0x0;var _0x324c31=_0x1860[_0x3b801f];return _0x324c31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0186('0x0'));var timeout=require('connect-timeout');var express=require(_0x0186('0x1'));var router=express[_0x0186('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0186('0x3'));router[_0x0186('0x4')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0186('0x5'),auth[_0x0186('0x6')](),controller[_0x0186('0x7')]);router[_0x0186('0x4')](_0x0186('0x8'),auth[_0x0186('0x6')](),controller[_0x0186('0x9')]);router[_0x0186('0x4')](_0x0186('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0186('0x4')](_0x0186('0xb'),auth[_0x0186('0x6')](),controller[_0x0186('0xc')]);router[_0x0186('0xd')]('/',auth[_0x0186('0x6')](),controller['create']);router[_0x0186('0xe')](_0x0186('0x5'),auth[_0x0186('0x6')](),controller['update']);router['delete']('/:id',auth[_0x0186('0x6')](),controller[_0x0186('0xf')]);module[_0x0186('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9229576..ce3ed94 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 _0x6517=['STRING'];(function(_0x4e9fe4,_0x3c9f38){var _0x531c77=function(_0x4ccfd2){while(--_0x4ccfd2){_0x4e9fe4['push'](_0x4e9fe4['shift']());}};_0x531c77(++_0x3c9f38);}(_0x6517,0x1a1));var _0x7651=function(_0x576164,_0x4ccfbf){_0x576164=_0x576164-0x0;var _0x3e8d02=_0x6517[_0x576164];return _0x3e8d02;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7651('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x33b7=['STRING','exports'];(function(_0x2904bf,_0x5b7f16){var _0x589cbc=function(_0x36535f){while(--_0x36535f){_0x2904bf['push'](_0x2904bf['shift']());}};_0x589cbc(++_0x5b7f16);}(_0x33b7,0xe7));var _0x733b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x33b7[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require('sequelize');module[_0x733b('0x0')]={'name':{'type':Sequelize[_0x733b('0x1')]},'description':{'type':Sequelize[_0x733b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ddfd2c3..9baeb9d 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 _0xd331=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','include','rows','params','includeAll','create','body','catch','find','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x5525c7,_0x2bae8b){var _0x1f68c2=function(_0x5de9cb){while(--_0x5de9cb){_0x5525c7['push'](_0x5525c7['shift']());}};_0x1f68c2(++_0x2bae8b);}(_0xd331,0x14e));var _0x1d33=function(_0x3fc9a3,_0x223b97){_0x3fc9a3=_0x3fc9a3-0x0;var _0x1670cc=_0xd331[_0x3fc9a3];return _0x1670cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d33('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d33('0x1'));var rp=require(_0x1d33('0x2'));var moment=require('moment');var BPromise=require(_0x1d33('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1d33('0x4'));var sox=require(_0x1d33('0x5'));var csv=require(_0x1d33('0x6'));var ejs=require(_0x1d33('0x7'));var fs=require('fs');var fs_extra=require(_0x1d33('0x8'));var _=require('lodash');var squel=require(_0x1d33('0x9'));var crypto=require(_0x1d33('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1d33('0xb'));var Papa=require(_0x1d33('0xc'));var Redis=require('ioredis');var authService=require(_0x1d33('0xd'));var qs=require(_0x1d33('0xe'));var as=require(_0x1d33('0xf'));var hardwareService=require(_0x1d33('0x10'));var logger=require('../../config/logger')(_0x1d33('0x11'));var utils=require(_0x1d33('0x12'));var config=require(_0x1d33('0x13'));var licenseUtil=require(_0x1d33('0x14'));var db=require(_0x1d33('0x15'))['db'];function respondWithStatusCode(_0x55ba5b,_0x398c20){_0x398c20=_0x398c20||0xcc;return function(_0x5a0e69){if(_0x5a0e69){return _0x55ba5b[_0x1d33('0x16')](_0x398c20);}return _0x55ba5b['status'](_0x398c20)[_0x1d33('0x17')]();};}function respondWithResult(_0x34f7a6,_0x4ab826){_0x4ab826=_0x4ab826||0xc8;return function(_0x49f4a9){if(_0x49f4a9){return _0x34f7a6[_0x1d33('0x18')](_0x4ab826)[_0x1d33('0x19')](_0x49f4a9);}};}function respondWithFilteredResult(_0x2f5bf8,_0x397984){return function(_0x2f1640){if(_0x2f1640){var _0x8f8247=typeof _0x397984[_0x1d33('0x1a')]===_0x1d33('0x1b')&&typeof _0x397984['limit']===_0x1d33('0x1b');var _0x3893e1=_0x2f1640[_0x1d33('0x1c')];var _0x3d374a=_0x8f8247?0x0:_0x397984[_0x1d33('0x1a')];var _0x39a416=_0x8f8247?_0x2f1640['count']:_0x397984[_0x1d33('0x1a')]+_0x397984[_0x1d33('0x1d')];var _0x5bf9c5;if(_0x39a416>=_0x3893e1){_0x39a416=_0x3893e1;_0x5bf9c5=0xc8;}else{_0x5bf9c5=0xce;}_0x2f5bf8[_0x1d33('0x18')](_0x5bf9c5);return _0x2f5bf8['set']('Content-Range',_0x3d374a+'-'+_0x39a416+'/'+_0x3893e1)[_0x1d33('0x19')](_0x2f1640);}return null;};}function patchUpdates(_0x1f1d06){return function(_0x56edd5){try{jsonpatch[_0x1d33('0x1e')](_0x56edd5,_0x1f1d06,!![]);}catch(_0x1a57cf){return BPromise[_0x1d33('0x1f')](_0x1a57cf);}return _0x56edd5[_0x1d33('0x20')]();};}function saveUpdates(_0x4e094d,_0xf266ac){return function(_0x10245b){if(_0x10245b){return _0x10245b[_0x1d33('0x21')](_0x4e094d)[_0x1d33('0x22')](function(_0x5d1b1f){return _0x5d1b1f;});}return null;};}function removeEntity(_0x23788c,_0xe0b64){return function(_0x1b9044){if(_0x1b9044){return _0x1b9044[_0x1d33('0x23')]()[_0x1d33('0x22')](function(){_0x23788c['status'](0xcc)[_0x1d33('0x17')]();});}};}function handleEntityNotFound(_0x24523e,_0x59d99b){return function(_0x41580c){if(!_0x41580c){_0x24523e[_0x1d33('0x16')](0x194);}return _0x41580c;};}function handleError(_0x10be24,_0x2d7a32){_0x2d7a32=_0x2d7a32||0x1f4;return function(_0x2f2ce9){logger['error'](_0x2f2ce9[_0x1d33('0x24')]);if(_0x2f2ce9[_0x1d33('0x25')]){delete _0x2f2ce9['name'];}_0x10be24['status'](_0x2d7a32)[_0x1d33('0x26')](_0x2f2ce9);};}exports[_0x1d33('0x27')]=function(_0x3997cd,_0xc29ae9){var _0xab4ce0={},_0x452785={},_0x39632e={'count':0x0,'rows':[]};var _0x532be9=_[_0x1d33('0x28')](db['ServicenowConfiguration'][_0x1d33('0x29')],function(_0x474be){return{'name':_0x474be[_0x1d33('0x2a')],'type':_0x474be[_0x1d33('0x2b')][_0x1d33('0x2c')]};});_0x452785[_0x1d33('0x2d')]=_[_0x1d33('0x28')](_0x532be9,_0x1d33('0x25'));_0x452785[_0x1d33('0x2e')]=_[_0x1d33('0x2f')](_0x3997cd[_0x1d33('0x2e')]);_0x452785[_0x1d33('0x30')]=_[_0x1d33('0x31')](_0x452785['model'],_0x452785[_0x1d33('0x2e')]);_0xab4ce0['attributes']=_[_0x1d33('0x31')](_0x452785[_0x1d33('0x2d')],qs[_0x1d33('0x32')](_0x3997cd[_0x1d33('0x2e')]['fields']));_0xab4ce0[_0x1d33('0x33')]=_0xab4ce0[_0x1d33('0x33')][_0x1d33('0x34')]?_0xab4ce0[_0x1d33('0x33')]:_0x452785[_0x1d33('0x2d')];if(!_0x3997cd[_0x1d33('0x2e')][_0x1d33('0x35')](_0x1d33('0x36'))){_0xab4ce0[_0x1d33('0x1d')]=qs[_0x1d33('0x1d')](_0x3997cd[_0x1d33('0x2e')]['limit']);_0xab4ce0[_0x1d33('0x1a')]=qs['offset'](_0x3997cd['query'][_0x1d33('0x1a')]);}_0xab4ce0[_0x1d33('0x37')]=qs[_0x1d33('0x38')](_0x3997cd[_0x1d33('0x2e')][_0x1d33('0x38')]);_0xab4ce0[_0x1d33('0x39')]=qs[_0x1d33('0x30')](_[_0x1d33('0x3a')](_0x3997cd[_0x1d33('0x2e')],_0x452785[_0x1d33('0x30')]),_0x532be9);if(_0x3997cd['query'][_0x1d33('0x3b')]){_0xab4ce0[_0x1d33('0x39')]=_[_0x1d33('0x3c')](_0xab4ce0[_0x1d33('0x39')],{'$or':_[_0x1d33('0x28')](_0x532be9,function(_0x1e9c31){if(_0x1e9c31[_0x1d33('0x2b')]!==_0x1d33('0x3d')){var _0x25b5a9={};_0x25b5a9[_0x1e9c31['name']]={'$like':'%'+_0x3997cd[_0x1d33('0x2e')][_0x1d33('0x3b')]+'%'};return _0x25b5a9;}})});}_0xab4ce0=_[_0x1d33('0x3c')]({},_0xab4ce0,_0x3997cd[_0x1d33('0x3e')]);var _0x66c46={'where':_0xab4ce0[_0x1d33('0x39')]};return db[_0x1d33('0x3f')][_0x1d33('0x1c')](_0x66c46)[_0x1d33('0x22')](function(_0x4090b0){_0x39632e[_0x1d33('0x1c')]=_0x4090b0;if(_0x3997cd[_0x1d33('0x2e')]['includeAll']){_0xab4ce0[_0x1d33('0x40')]=[{'all':!![]}];}return db[_0x1d33('0x3f')]['findAll'](_0xab4ce0);})[_0x1d33('0x22')](function(_0x2f4072){_0x39632e[_0x1d33('0x41')]=_0x2f4072;return _0x39632e;})[_0x1d33('0x22')](respondWithFilteredResult(_0xc29ae9,_0xab4ce0))['catch'](handleError(_0xc29ae9,null));};exports['show']=function(_0x38aa8b,_0xbdb3e7){var _0xf4ed2e={'raw':![],'where':{'id':_0x38aa8b[_0x1d33('0x42')]['id']}},_0x24b3d4={};_0x24b3d4['model']=_[_0x1d33('0x2f')](db[_0x1d33('0x3f')][_0x1d33('0x29')]);_0x24b3d4[_0x1d33('0x2e')]=_[_0x1d33('0x2f')](_0x38aa8b[_0x1d33('0x2e')]);_0x24b3d4[_0x1d33('0x30')]=_['intersection'](_0x24b3d4[_0x1d33('0x2d')],_0x24b3d4[_0x1d33('0x2e')]);_0xf4ed2e['attributes']=_[_0x1d33('0x31')](_0x24b3d4['model'],qs[_0x1d33('0x32')](_0x38aa8b[_0x1d33('0x2e')][_0x1d33('0x32')]));_0xf4ed2e[_0x1d33('0x33')]=_0xf4ed2e[_0x1d33('0x33')][_0x1d33('0x34')]?_0xf4ed2e[_0x1d33('0x33')]:_0x24b3d4['model'];if(_0x38aa8b[_0x1d33('0x2e')][_0x1d33('0x43')]){_0xf4ed2e[_0x1d33('0x40')]=[{'all':!![]}];}_0xf4ed2e=_[_0x1d33('0x3c')]({},_0xf4ed2e,_0x38aa8b[_0x1d33('0x3e')]);return db[_0x1d33('0x3f')]['find'](_0xf4ed2e)[_0x1d33('0x22')](handleEntityNotFound(_0xbdb3e7,null))[_0x1d33('0x22')](respondWithResult(_0xbdb3e7,null))['catch'](handleError(_0xbdb3e7,null));};exports[_0x1d33('0x44')]=function(_0x335aa4,_0x22d224){return db[_0x1d33('0x3f')]['create'](_0x335aa4[_0x1d33('0x45')],{})['then'](respondWithResult(_0x22d224,0xc9))[_0x1d33('0x46')](handleError(_0x22d224,null));};exports[_0x1d33('0x21')]=function(_0x2e96a8,_0x51fbaa){if(_0x2e96a8[_0x1d33('0x45')]['id']){delete _0x2e96a8[_0x1d33('0x45')]['id'];}return db[_0x1d33('0x3f')][_0x1d33('0x47')]({'where':{'id':_0x2e96a8[_0x1d33('0x42')]['id']}})[_0x1d33('0x22')](handleEntityNotFound(_0x51fbaa,null))['then'](saveUpdates(_0x2e96a8[_0x1d33('0x45')],null))['then'](respondWithResult(_0x51fbaa,null))['catch'](handleError(_0x51fbaa,null));};exports[_0x1d33('0x23')]=function(_0x21b61f,_0x1c9015){return db[_0x1d33('0x3f')]['find']({'where':{'id':_0x21b61f[_0x1d33('0x42')]['id']}})[_0x1d33('0x22')](handleEntityNotFound(_0x1c9015,null))[_0x1d33('0x22')](removeEntity(_0x1c9015,null))[_0x1d33('0x46')](handleError(_0x1c9015,null));};exports[_0x1d33('0x48')]=function(_0x389ed,_0x45cb47,_0x563ebd){var _0x545b30={};var _0x249308={};var _0x2a7447;var _0x4f3070;return db[_0x1d33('0x3f')][_0x1d33('0x49')]({'where':{'id':_0x389ed[_0x1d33('0x42')]['id']}})[_0x1d33('0x22')](handleEntityNotFound(_0x45cb47,null))[_0x1d33('0x22')](function(_0x1a2655){if(_0x1a2655){_0x2a7447=_0x1a2655;_0x249308[_0x1d33('0x2d')]=_['keys'](db[_0x1d33('0x4a')][_0x1d33('0x29')]);_0x249308[_0x1d33('0x2e')]=_[_0x1d33('0x2f')](_0x389ed[_0x1d33('0x2e')]);_0x249308[_0x1d33('0x30')]=_['intersection'](_0x249308[_0x1d33('0x2d')],_0x249308['query']);_0x545b30[_0x1d33('0x33')]=_[_0x1d33('0x31')](_0x249308[_0x1d33('0x2d')],qs[_0x1d33('0x32')](_0x389ed[_0x1d33('0x2e')][_0x1d33('0x32')]));_0x545b30[_0x1d33('0x33')]=_0x545b30['attributes'][_0x1d33('0x34')]?_0x545b30['attributes']:_0x249308[_0x1d33('0x2d')];_0x545b30[_0x1d33('0x37')]=qs[_0x1d33('0x38')](_0x389ed[_0x1d33('0x2e')][_0x1d33('0x38')]);_0x545b30[_0x1d33('0x39')]=qs[_0x1d33('0x30')](_['pick'](_0x389ed[_0x1d33('0x2e')],_0x249308[_0x1d33('0x30')]));if(_0x389ed[_0x1d33('0x2e')][_0x1d33('0x3b')]){_0x545b30[_0x1d33('0x39')]=_['merge'](_0x545b30[_0x1d33('0x39')],{'$or':_[_0x1d33('0x28')](_0x545b30[_0x1d33('0x33')],function(_0x3a8845){var _0x37dc0c={};_0x37dc0c[_0x3a8845]={'$like':'%'+_0x389ed[_0x1d33('0x2e')]['filter']+'%'};return _0x37dc0c;})});}_0x545b30=_[_0x1d33('0x3c')]({},_0x545b30,_0x389ed[_0x1d33('0x3e')]);return _0x2a7447[_0x1d33('0x48')](_0x545b30);}})['then'](function(_0x1294e6){if(_0x1294e6){_0x4f3070=_0x1294e6[_0x1d33('0x34')];if(!_0x389ed['query'][_0x1d33('0x35')](_0x1d33('0x36'))){_0x545b30[_0x1d33('0x1d')]=qs[_0x1d33('0x1d')](_0x389ed[_0x1d33('0x2e')][_0x1d33('0x1d')]);_0x545b30[_0x1d33('0x1a')]=qs[_0x1d33('0x1a')](_0x389ed['query']['offset']);}return _0x2a7447['getFields'](_0x545b30);}})[_0x1d33('0x22')](function(_0x103b14){if(_0x103b14){return _0x103b14?{'count':_0x4f3070,'rows':_0x103b14}:null;}})[_0x1d33('0x22')](respondWithResult(_0x45cb47,null))[_0x1d33('0x46')](handleError(_0x45cb47,null));};exports['getSubjects']=function(_0x466eaf,_0x57cfb2,_0xdd5f85){var _0x1139e1={};var _0x3b5679={};var _0x313fc3;var _0x21c2f6;return db[_0x1d33('0x3f')]['findOne']({'where':{'id':_0x466eaf[_0x1d33('0x42')]['id']}})[_0x1d33('0x22')](handleEntityNotFound(_0x57cfb2,null))[_0x1d33('0x22')](function(_0x13205c){if(_0x13205c){_0x313fc3=_0x13205c;_0x3b5679[_0x1d33('0x2d')]=_[_0x1d33('0x2f')](db[_0x1d33('0x4a')]['rawAttributes']);_0x3b5679[_0x1d33('0x2e')]=_[_0x1d33('0x2f')](_0x466eaf['query']);_0x3b5679[_0x1d33('0x30')]=_[_0x1d33('0x31')](_0x3b5679[_0x1d33('0x2d')],_0x3b5679[_0x1d33('0x2e')]);_0x1139e1[_0x1d33('0x33')]=_[_0x1d33('0x31')](_0x3b5679['model'],qs['fields'](_0x466eaf[_0x1d33('0x2e')][_0x1d33('0x32')]));_0x1139e1[_0x1d33('0x33')]=_0x1139e1['attributes'][_0x1d33('0x34')]?_0x1139e1[_0x1d33('0x33')]:_0x3b5679[_0x1d33('0x2d')];_0x1139e1['order']=qs[_0x1d33('0x38')](_0x466eaf[_0x1d33('0x2e')]['sort']);_0x1139e1['where']=qs['filters'](_[_0x1d33('0x3a')](_0x466eaf[_0x1d33('0x2e')],_0x3b5679['filters']));if(_0x466eaf[_0x1d33('0x2e')][_0x1d33('0x3b')]){_0x1139e1[_0x1d33('0x39')]=_[_0x1d33('0x3c')](_0x1139e1[_0x1d33('0x39')],{'$or':_[_0x1d33('0x28')](_0x1139e1[_0x1d33('0x33')],function(_0x5455a1){var _0x12cb95={};_0x12cb95[_0x5455a1]={'$like':'%'+_0x466eaf[_0x1d33('0x2e')][_0x1d33('0x3b')]+'%'};return _0x12cb95;})});}_0x1139e1=_[_0x1d33('0x3c')]({},_0x1139e1,_0x466eaf[_0x1d33('0x3e')]);return _0x313fc3[_0x1d33('0x4b')](_0x1139e1);}})[_0x1d33('0x22')](function(_0x4bfd31){if(_0x4bfd31){_0x21c2f6=_0x4bfd31[_0x1d33('0x34')];if(!_0x466eaf[_0x1d33('0x2e')][_0x1d33('0x35')](_0x1d33('0x36'))){_0x1139e1[_0x1d33('0x1d')]=qs['limit'](_0x466eaf['query'][_0x1d33('0x1d')]);_0x1139e1[_0x1d33('0x1a')]=qs[_0x1d33('0x1a')](_0x466eaf['query'][_0x1d33('0x1a')]);}return _0x313fc3[_0x1d33('0x4b')](_0x1139e1);}})['then'](function(_0x1ec2ad){if(_0x1ec2ad){return _0x1ec2ad?{'count':_0x21c2f6,'rows':_0x1ec2ad}:null;}})[_0x1d33('0x22')](respondWithResult(_0x57cfb2,null))['catch'](handleError(_0x57cfb2,null));};exports['getDescriptions']=function(_0x2441b6,_0x435850,_0x1f3c66){var _0x36c6a7={};var _0x44eb35={};var _0x2acded;var _0x466390;return db['ServicenowConfiguration'][_0x1d33('0x49')]({'where':{'id':_0x2441b6[_0x1d33('0x42')]['id']}})['then'](handleEntityNotFound(_0x435850,null))['then'](function(_0x111a8e){if(_0x111a8e){_0x2acded=_0x111a8e;_0x44eb35[_0x1d33('0x2d')]=_[_0x1d33('0x2f')](db[_0x1d33('0x4a')]['rawAttributes']);_0x44eb35['query']=_[_0x1d33('0x2f')](_0x2441b6[_0x1d33('0x2e')]);_0x44eb35['filters']=_['intersection'](_0x44eb35[_0x1d33('0x2d')],_0x44eb35[_0x1d33('0x2e')]);_0x36c6a7[_0x1d33('0x33')]=_[_0x1d33('0x31')](_0x44eb35[_0x1d33('0x2d')],qs[_0x1d33('0x32')](_0x2441b6[_0x1d33('0x2e')][_0x1d33('0x32')]));_0x36c6a7[_0x1d33('0x33')]=_0x36c6a7[_0x1d33('0x33')][_0x1d33('0x34')]?_0x36c6a7['attributes']:_0x44eb35[_0x1d33('0x2d')];_0x36c6a7[_0x1d33('0x37')]=qs['sort'](_0x2441b6[_0x1d33('0x2e')]['sort']);_0x36c6a7[_0x1d33('0x39')]=qs[_0x1d33('0x30')](_[_0x1d33('0x3a')](_0x2441b6[_0x1d33('0x2e')],_0x44eb35['filters']));if(_0x2441b6['query'][_0x1d33('0x3b')]){_0x36c6a7['where']=_['merge'](_0x36c6a7[_0x1d33('0x39')],{'$or':_[_0x1d33('0x28')](_0x36c6a7['attributes'],function(_0x573164){var _0x4e43fc={};_0x4e43fc[_0x573164]={'$like':'%'+_0x2441b6[_0x1d33('0x2e')][_0x1d33('0x3b')]+'%'};return _0x4e43fc;})});}_0x36c6a7=_[_0x1d33('0x3c')]({},_0x36c6a7,_0x2441b6[_0x1d33('0x3e')]);return _0x2acded[_0x1d33('0x4c')](_0x36c6a7);}})[_0x1d33('0x22')](function(_0x1028b1){if(_0x1028b1){_0x466390=_0x1028b1[_0x1d33('0x34')];if(!_0x2441b6[_0x1d33('0x2e')][_0x1d33('0x35')](_0x1d33('0x36'))){_0x36c6a7[_0x1d33('0x1d')]=qs[_0x1d33('0x1d')](_0x2441b6[_0x1d33('0x2e')][_0x1d33('0x1d')]);_0x36c6a7[_0x1d33('0x1a')]=qs['offset'](_0x2441b6[_0x1d33('0x2e')][_0x1d33('0x1a')]);}return _0x2acded[_0x1d33('0x4c')](_0x36c6a7);}})['then'](function(_0x59c905){if(_0x59c905){return _0x59c905?{'count':_0x466390,'rows':_0x59c905}:null;}})[_0x1d33('0x22')](respondWithResult(_0x435850,null))['catch'](handleError(_0x435850,null));}; \ No newline at end of file +var _0xd26c=['getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','undefined','limit','count','offset','set','Content-Range','save','update','then','end','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','body','destroy','findOne','getFields','getSubjects','ServicenowField'];(function(_0x200ad9,_0x3273b7){var _0x5b8f4e=function(_0x15d4bf){while(--_0x15d4bf){_0x200ad9['push'](_0x200ad9['shift']());}};_0x5b8f4e(++_0x3273b7);}(_0xd26c,0xe5));var _0xcd26=function(_0x1e28e9,_0x436896){_0x1e28e9=_0x1e28e9-0x0;var _0x546799=_0xd26c[_0x1e28e9];return _0x546799;};'use strict';var emlformat=require(_0xcd26('0x0'));var rimraf=require(_0xcd26('0x1'));var zipdir=require(_0xcd26('0x2'));var jsonpatch=require(_0xcd26('0x3'));var rp=require('request-promise');var moment=require(_0xcd26('0x4'));var BPromise=require(_0xcd26('0x5'));var Mustache=require(_0xcd26('0x6'));var util=require(_0xcd26('0x7'));var path=require(_0xcd26('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd26('0x9'));var _=require(_0xcd26('0xa'));var squel=require(_0xcd26('0xb'));var crypto=require(_0xcd26('0xc'));var jsforce=require(_0xcd26('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcd26('0xe'));var querystring=require(_0xcd26('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcd26('0x10'));var qs=require(_0xcd26('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd26('0x12'))(_0xcd26('0x13'));var utils=require(_0xcd26('0x14'));var config=require(_0xcd26('0x15'));var licenseUtil=require(_0xcd26('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa06709,_0x137819){_0x137819=_0x137819||0xcc;return function(_0x20825b){if(_0x20825b){return _0xa06709['sendStatus'](_0x137819);}return _0xa06709[_0xcd26('0x17')](_0x137819)['end']();};}function respondWithResult(_0x212200,_0x302bf7){_0x302bf7=_0x302bf7||0xc8;return function(_0x7cb689){if(_0x7cb689){return _0x212200[_0xcd26('0x17')](_0x302bf7)['json'](_0x7cb689);}};}function respondWithFilteredResult(_0x109086,_0x120144){return function(_0x5d7983){if(_0x5d7983){var _0x438221=typeof _0x120144['offset']===_0xcd26('0x18')&&typeof _0x120144[_0xcd26('0x19')]===_0xcd26('0x18');var _0x9f2ea=_0x5d7983[_0xcd26('0x1a')];var _0x182a9c=_0x438221?0x0:_0x120144['offset'];var _0x2dff7d=_0x438221?_0x5d7983['count']:_0x120144[_0xcd26('0x1b')]+_0x120144[_0xcd26('0x19')];var _0x382490;if(_0x2dff7d>=_0x9f2ea){_0x2dff7d=_0x9f2ea;_0x382490=0xc8;}else{_0x382490=0xce;}_0x109086[_0xcd26('0x17')](_0x382490);return _0x109086[_0xcd26('0x1c')](_0xcd26('0x1d'),_0x182a9c+'-'+_0x2dff7d+'/'+_0x9f2ea)['json'](_0x5d7983);}return null;};}function patchUpdates(_0x629cf5){return function(_0x1aef7c){try{jsonpatch['apply'](_0x1aef7c,_0x629cf5,!![]);}catch(_0x27bef1){return BPromise['reject'](_0x27bef1);}return _0x1aef7c[_0xcd26('0x1e')]();};}function saveUpdates(_0x23a22c,_0x1122e1){return function(_0x516bcf){if(_0x516bcf){return _0x516bcf[_0xcd26('0x1f')](_0x23a22c)['then'](function(_0x4237a7){return _0x4237a7;});}return null;};}function removeEntity(_0x52c168,_0x288e88){return function(_0xe4a950){if(_0xe4a950){return _0xe4a950['destroy']()[_0xcd26('0x20')](function(){_0x52c168[_0xcd26('0x17')](0xcc)[_0xcd26('0x21')]();});}};}function handleEntityNotFound(_0x39f2ef,_0x11b5b1){return function(_0x3c7707){if(!_0x3c7707){_0x39f2ef['sendStatus'](0x194);}return _0x3c7707;};}function handleError(_0x46d792,_0x8120ed){_0x8120ed=_0x8120ed||0x1f4;return function(_0x510f67){logger[_0xcd26('0x22')](_0x510f67[_0xcd26('0x23')]);if(_0x510f67[_0xcd26('0x24')]){delete _0x510f67['name'];}_0x46d792[_0xcd26('0x17')](_0x8120ed)[_0xcd26('0x25')](_0x510f67);};}exports['index']=function(_0x21b55a,_0x3fe5c6){var _0x37655e={},_0x17e18a={},_0xd6f8e6={'count':0x0,'rows':[]};var _0x37f7d2=_[_0xcd26('0x26')](db[_0xcd26('0x27')][_0xcd26('0x28')],function(_0x2ce132){return{'name':_0x2ce132[_0xcd26('0x29')],'type':_0x2ce132[_0xcd26('0x2a')][_0xcd26('0x2b')]};});_0x17e18a[_0xcd26('0x2c')]=_[_0xcd26('0x26')](_0x37f7d2,'name');_0x17e18a[_0xcd26('0x2d')]=_['keys'](_0x21b55a[_0xcd26('0x2d')]);_0x17e18a[_0xcd26('0x2e')]=_[_0xcd26('0x2f')](_0x17e18a[_0xcd26('0x2c')],_0x17e18a[_0xcd26('0x2d')]);_0x37655e['attributes']=_[_0xcd26('0x2f')](_0x17e18a['model'],qs[_0xcd26('0x30')](_0x21b55a[_0xcd26('0x2d')][_0xcd26('0x30')]));_0x37655e[_0xcd26('0x31')]=_0x37655e['attributes'][_0xcd26('0x32')]?_0x37655e[_0xcd26('0x31')]:_0x17e18a[_0xcd26('0x2c')];if(!_0x21b55a[_0xcd26('0x2d')][_0xcd26('0x33')](_0xcd26('0x34'))){_0x37655e[_0xcd26('0x19')]=qs[_0xcd26('0x19')](_0x21b55a[_0xcd26('0x2d')][_0xcd26('0x19')]);_0x37655e[_0xcd26('0x1b')]=qs[_0xcd26('0x1b')](_0x21b55a[_0xcd26('0x2d')][_0xcd26('0x1b')]);}_0x37655e[_0xcd26('0x35')]=qs[_0xcd26('0x36')](_0x21b55a[_0xcd26('0x2d')][_0xcd26('0x36')]);_0x37655e[_0xcd26('0x37')]=qs[_0xcd26('0x2e')](_[_0xcd26('0x38')](_0x21b55a[_0xcd26('0x2d')],_0x17e18a[_0xcd26('0x2e')]),_0x37f7d2);if(_0x21b55a[_0xcd26('0x2d')][_0xcd26('0x39')]){_0x37655e[_0xcd26('0x37')]=_[_0xcd26('0x3a')](_0x37655e[_0xcd26('0x37')],{'$or':_[_0xcd26('0x26')](_0x37f7d2,function(_0x357358){if(_0x357358[_0xcd26('0x2a')]!==_0xcd26('0x3b')){var _0x4711d9={};_0x4711d9[_0x357358[_0xcd26('0x24')]]={'$like':'%'+_0x21b55a[_0xcd26('0x2d')][_0xcd26('0x39')]+'%'};return _0x4711d9;}})});}_0x37655e=_['merge']({},_0x37655e,_0x21b55a[_0xcd26('0x3c')]);var _0x5840f1={'where':_0x37655e['where']};return db[_0xcd26('0x27')][_0xcd26('0x1a')](_0x5840f1)[_0xcd26('0x20')](function(_0x90d3bf){_0xd6f8e6[_0xcd26('0x1a')]=_0x90d3bf;if(_0x21b55a[_0xcd26('0x2d')][_0xcd26('0x3d')]){_0x37655e[_0xcd26('0x3e')]=[{'all':!![]}];}return db[_0xcd26('0x27')]['findAll'](_0x37655e);})['then'](function(_0x4dd52a){_0xd6f8e6[_0xcd26('0x3f')]=_0x4dd52a;return _0xd6f8e6;})[_0xcd26('0x20')](respondWithFilteredResult(_0x3fe5c6,_0x37655e))[_0xcd26('0x40')](handleError(_0x3fe5c6,null));};exports[_0xcd26('0x41')]=function(_0x5a9d52,_0x3974da){var _0x57d7e7={'raw':![],'where':{'id':_0x5a9d52[_0xcd26('0x42')]['id']}},_0x1e3ee4={};_0x1e3ee4[_0xcd26('0x2c')]=_['keys'](db[_0xcd26('0x27')][_0xcd26('0x28')]);_0x1e3ee4[_0xcd26('0x2d')]=_[_0xcd26('0x43')](_0x5a9d52[_0xcd26('0x2d')]);_0x1e3ee4['filters']=_[_0xcd26('0x2f')](_0x1e3ee4[_0xcd26('0x2c')],_0x1e3ee4['query']);_0x57d7e7['attributes']=_[_0xcd26('0x2f')](_0x1e3ee4['model'],qs[_0xcd26('0x30')](_0x5a9d52[_0xcd26('0x2d')][_0xcd26('0x30')]));_0x57d7e7[_0xcd26('0x31')]=_0x57d7e7[_0xcd26('0x31')][_0xcd26('0x32')]?_0x57d7e7['attributes']:_0x1e3ee4[_0xcd26('0x2c')];if(_0x5a9d52[_0xcd26('0x2d')][_0xcd26('0x3d')]){_0x57d7e7[_0xcd26('0x3e')]=[{'all':!![]}];}_0x57d7e7=_[_0xcd26('0x3a')]({},_0x57d7e7,_0x5a9d52[_0xcd26('0x3c')]);return db['ServicenowConfiguration'][_0xcd26('0x44')](_0x57d7e7)[_0xcd26('0x20')](handleEntityNotFound(_0x3974da,null))[_0xcd26('0x20')](respondWithResult(_0x3974da,null))[_0xcd26('0x40')](handleError(_0x3974da,null));};exports['create']=function(_0x774233,_0x3e91c3){return db[_0xcd26('0x27')]['create'](_0x774233[_0xcd26('0x45')],{})[_0xcd26('0x20')](respondWithResult(_0x3e91c3,0xc9))[_0xcd26('0x40')](handleError(_0x3e91c3,null));};exports[_0xcd26('0x1f')]=function(_0x31fb49,_0x5c3861){if(_0x31fb49[_0xcd26('0x45')]['id']){delete _0x31fb49[_0xcd26('0x45')]['id'];}return db[_0xcd26('0x27')][_0xcd26('0x44')]({'where':{'id':_0x31fb49[_0xcd26('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c3861,null))[_0xcd26('0x20')](saveUpdates(_0x31fb49['body'],null))[_0xcd26('0x20')](respondWithResult(_0x5c3861,null))['catch'](handleError(_0x5c3861,null));};exports[_0xcd26('0x46')]=function(_0x53fd15,_0x3b30c2){return db[_0xcd26('0x27')][_0xcd26('0x44')]({'where':{'id':_0x53fd15[_0xcd26('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b30c2,null))[_0xcd26('0x20')](removeEntity(_0x3b30c2,null))[_0xcd26('0x40')](handleError(_0x3b30c2,null));};exports['getFields']=function(_0x443cdd,_0x17d623,_0x14bdd1){var _0x59babe={};var _0x20af56={};var _0xb406fc;var _0x4fad82;return db[_0xcd26('0x27')][_0xcd26('0x47')]({'where':{'id':_0x443cdd[_0xcd26('0x42')]['id']}})[_0xcd26('0x20')](handleEntityNotFound(_0x17d623,null))[_0xcd26('0x20')](function(_0xa565b8){if(_0xa565b8){_0xb406fc=_0xa565b8;_0x20af56[_0xcd26('0x2c')]=_[_0xcd26('0x43')](db['ServicenowField'][_0xcd26('0x28')]);_0x20af56[_0xcd26('0x2d')]=_[_0xcd26('0x43')](_0x443cdd[_0xcd26('0x2d')]);_0x20af56[_0xcd26('0x2e')]=_[_0xcd26('0x2f')](_0x20af56[_0xcd26('0x2c')],_0x20af56[_0xcd26('0x2d')]);_0x59babe['attributes']=_[_0xcd26('0x2f')](_0x20af56[_0xcd26('0x2c')],qs[_0xcd26('0x30')](_0x443cdd[_0xcd26('0x2d')]['fields']));_0x59babe[_0xcd26('0x31')]=_0x59babe[_0xcd26('0x31')]['length']?_0x59babe[_0xcd26('0x31')]:_0x20af56['model'];_0x59babe[_0xcd26('0x35')]=qs['sort'](_0x443cdd['query'][_0xcd26('0x36')]);_0x59babe[_0xcd26('0x37')]=qs[_0xcd26('0x2e')](_[_0xcd26('0x38')](_0x443cdd[_0xcd26('0x2d')],_0x20af56[_0xcd26('0x2e')]));if(_0x443cdd[_0xcd26('0x2d')][_0xcd26('0x39')]){_0x59babe[_0xcd26('0x37')]=_[_0xcd26('0x3a')](_0x59babe[_0xcd26('0x37')],{'$or':_[_0xcd26('0x26')](_0x59babe[_0xcd26('0x31')],function(_0x10bcd2){var _0x3e760c={};_0x3e760c[_0x10bcd2]={'$like':'%'+_0x443cdd[_0xcd26('0x2d')][_0xcd26('0x39')]+'%'};return _0x3e760c;})});}_0x59babe=_['merge']({},_0x59babe,_0x443cdd[_0xcd26('0x3c')]);return _0xb406fc[_0xcd26('0x48')](_0x59babe);}})[_0xcd26('0x20')](function(_0x24048f){if(_0x24048f){_0x4fad82=_0x24048f[_0xcd26('0x32')];if(!_0x443cdd[_0xcd26('0x2d')][_0xcd26('0x33')](_0xcd26('0x34'))){_0x59babe[_0xcd26('0x19')]=qs[_0xcd26('0x19')](_0x443cdd[_0xcd26('0x2d')]['limit']);_0x59babe[_0xcd26('0x1b')]=qs[_0xcd26('0x1b')](_0x443cdd[_0xcd26('0x2d')][_0xcd26('0x1b')]);}return _0xb406fc[_0xcd26('0x48')](_0x59babe);}})['then'](function(_0x1c55a5){if(_0x1c55a5){return _0x1c55a5?{'count':_0x4fad82,'rows':_0x1c55a5}:null;}})['then'](respondWithResult(_0x17d623,null))[_0xcd26('0x40')](handleError(_0x17d623,null));};exports[_0xcd26('0x49')]=function(_0x37c62d,_0x4d73ec,_0x1241ac){var _0x36b15c={};var _0xfceb68={};var _0x5e7c26;var _0x40dbec;return db['ServicenowConfiguration'][_0xcd26('0x47')]({'where':{'id':_0x37c62d[_0xcd26('0x42')]['id']}})[_0xcd26('0x20')](handleEntityNotFound(_0x4d73ec,null))[_0xcd26('0x20')](function(_0x58b630){if(_0x58b630){_0x5e7c26=_0x58b630;_0xfceb68['model']=_['keys'](db['ServicenowField'][_0xcd26('0x28')]);_0xfceb68[_0xcd26('0x2d')]=_[_0xcd26('0x43')](_0x37c62d[_0xcd26('0x2d')]);_0xfceb68['filters']=_['intersection'](_0xfceb68['model'],_0xfceb68[_0xcd26('0x2d')]);_0x36b15c['attributes']=_[_0xcd26('0x2f')](_0xfceb68[_0xcd26('0x2c')],qs[_0xcd26('0x30')](_0x37c62d[_0xcd26('0x2d')][_0xcd26('0x30')]));_0x36b15c[_0xcd26('0x31')]=_0x36b15c[_0xcd26('0x31')][_0xcd26('0x32')]?_0x36b15c[_0xcd26('0x31')]:_0xfceb68[_0xcd26('0x2c')];_0x36b15c['order']=qs['sort'](_0x37c62d['query'][_0xcd26('0x36')]);_0x36b15c[_0xcd26('0x37')]=qs[_0xcd26('0x2e')](_['pick'](_0x37c62d['query'],_0xfceb68[_0xcd26('0x2e')]));if(_0x37c62d['query'][_0xcd26('0x39')]){_0x36b15c[_0xcd26('0x37')]=_[_0xcd26('0x3a')](_0x36b15c[_0xcd26('0x37')],{'$or':_[_0xcd26('0x26')](_0x36b15c[_0xcd26('0x31')],function(_0x1e4c3e){var _0xb15ad9={};_0xb15ad9[_0x1e4c3e]={'$like':'%'+_0x37c62d[_0xcd26('0x2d')]['filter']+'%'};return _0xb15ad9;})});}_0x36b15c=_[_0xcd26('0x3a')]({},_0x36b15c,_0x37c62d['options']);return _0x5e7c26[_0xcd26('0x49')](_0x36b15c);}})[_0xcd26('0x20')](function(_0x1e98f7){if(_0x1e98f7){_0x40dbec=_0x1e98f7['length'];if(!_0x37c62d[_0xcd26('0x2d')]['hasOwnProperty'](_0xcd26('0x34'))){_0x36b15c[_0xcd26('0x19')]=qs[_0xcd26('0x19')](_0x37c62d[_0xcd26('0x2d')]['limit']);_0x36b15c[_0xcd26('0x1b')]=qs['offset'](_0x37c62d[_0xcd26('0x2d')][_0xcd26('0x1b')]);}return _0x5e7c26[_0xcd26('0x49')](_0x36b15c);}})[_0xcd26('0x20')](function(_0x41a43f){if(_0x41a43f){return _0x41a43f?{'count':_0x40dbec,'rows':_0x41a43f}:null;}})['then'](respondWithResult(_0x4d73ec,null))[_0xcd26('0x40')](handleError(_0x4d73ec,null));};exports['getDescriptions']=function(_0x110463,_0x43f4e5,_0x4e52ec){var _0x2725f4={};var _0x5586af={};var _0x443907;var _0x1c9860;return db[_0xcd26('0x27')][_0xcd26('0x47')]({'where':{'id':_0x110463[_0xcd26('0x42')]['id']}})[_0xcd26('0x20')](handleEntityNotFound(_0x43f4e5,null))[_0xcd26('0x20')](function(_0x528df0){if(_0x528df0){_0x443907=_0x528df0;_0x5586af[_0xcd26('0x2c')]=_[_0xcd26('0x43')](db[_0xcd26('0x4a')]['rawAttributes']);_0x5586af['query']=_[_0xcd26('0x43')](_0x110463[_0xcd26('0x2d')]);_0x5586af[_0xcd26('0x2e')]=_[_0xcd26('0x2f')](_0x5586af['model'],_0x5586af['query']);_0x2725f4[_0xcd26('0x31')]=_[_0xcd26('0x2f')](_0x5586af[_0xcd26('0x2c')],qs[_0xcd26('0x30')](_0x110463[_0xcd26('0x2d')][_0xcd26('0x30')]));_0x2725f4[_0xcd26('0x31')]=_0x2725f4[_0xcd26('0x31')][_0xcd26('0x32')]?_0x2725f4['attributes']:_0x5586af[_0xcd26('0x2c')];_0x2725f4[_0xcd26('0x35')]=qs[_0xcd26('0x36')](_0x110463[_0xcd26('0x2d')][_0xcd26('0x36')]);_0x2725f4[_0xcd26('0x37')]=qs[_0xcd26('0x2e')](_[_0xcd26('0x38')](_0x110463[_0xcd26('0x2d')],_0x5586af[_0xcd26('0x2e')]));if(_0x110463[_0xcd26('0x2d')][_0xcd26('0x39')]){_0x2725f4[_0xcd26('0x37')]=_[_0xcd26('0x3a')](_0x2725f4['where'],{'$or':_[_0xcd26('0x26')](_0x2725f4[_0xcd26('0x31')],function(_0x1ea5f5){var _0x188b9f={};_0x188b9f[_0x1ea5f5]={'$like':'%'+_0x110463['query'][_0xcd26('0x39')]+'%'};return _0x188b9f;})});}_0x2725f4=_[_0xcd26('0x3a')]({},_0x2725f4,_0x110463[_0xcd26('0x3c')]);return _0x443907[_0xcd26('0x4b')](_0x2725f4);}})[_0xcd26('0x20')](function(_0x29742a){if(_0x29742a){_0x1c9860=_0x29742a[_0xcd26('0x32')];if(!_0x110463[_0xcd26('0x2d')][_0xcd26('0x33')](_0xcd26('0x34'))){_0x2725f4[_0xcd26('0x19')]=qs[_0xcd26('0x19')](_0x110463[_0xcd26('0x2d')][_0xcd26('0x19')]);_0x2725f4[_0xcd26('0x1b')]=qs[_0xcd26('0x1b')](_0x110463[_0xcd26('0x2d')][_0xcd26('0x1b')]);}return _0x443907[_0xcd26('0x4b')](_0x2725f4);}})['then'](function(_0x38f21a){if(_0x38f21a){return _0x38f21a?{'count':_0x1c9860,'rows':_0x38f21a}:null;}})[_0xcd26('0x20')](respondWithResult(_0x43f4e5,null))[_0xcd26('0x40')](handleError(_0x43f4e5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1886285..e236513 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 _0xc7a7=['moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x393e29,_0x25a0d8){var _0xe4a1e0=function(_0x31703a){while(--_0x31703a){_0x393e29['push'](_0x393e29['shift']());}};_0xe4a1e0(++_0x25a0d8);}(_0xc7a7,0x171));var _0x7c7a=function(_0x553f0f,_0x4a15f3){_0x553f0f=_0x553f0f-0x0;var _0x20acf8=_0xc7a7[_0x553f0f];return _0x20acf8;};'use strict';var _=require(_0x7c7a('0x0'));var util=require(_0x7c7a('0x1'));var logger=require(_0x7c7a('0x2'))('api');var moment=require(_0x7c7a('0x3'));var BPromise=require(_0x7c7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c7a('0x5'));var rimraf=require(_0x7c7a('0x6'));var config=require(_0x7c7a('0x7'));var attributes=require(_0x7c7a('0x8'));module[_0x7c7a('0x9')]=function(_0xc84abf,_0x346f96){return _0xc84abf[_0x7c7a('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0x7c7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcff=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x311ba8,_0x4cf191){var _0x4e3e82=function(_0x8446fe){while(--_0x8446fe){_0x311ba8['push'](_0x311ba8['shift']());}};_0x4e3e82(++_0x4cf191);}(_0xbcff,0x12e));var _0xfbcf=function(_0xc521a4,_0x223f05){_0xc521a4=_0xc521a4-0x0;var _0x135f3c=_0xbcff[_0xc521a4];return _0x135f3c;};'use strict';var _=require(_0xfbcf('0x0'));var util=require(_0xfbcf('0x1'));var logger=require(_0xfbcf('0x2'))('api');var moment=require(_0xfbcf('0x3'));var BPromise=require(_0xfbcf('0x4'));var rp=require(_0xfbcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbcf('0x6'));var config=require(_0xfbcf('0x7'));var attributes=require(_0xfbcf('0x8'));module['exports']=function(_0x2d8044,_0x3b30c8){return _0x2d8044['define'](_0xfbcf('0x9'),attributes,{'tableName':_0xfbcf('0xa'),'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 26bd9e2..a76d2cf 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 _0x4c8f=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x197241,_0x53f3b1){var _0x378d57=function(_0x21b39e){while(--_0x21b39e){_0x197241['push'](_0x197241['shift']());}};_0x378d57(++_0x53f3b1);}(_0x4c8f,0x10b));var _0xf4c8=function(_0x4eef59,_0x19a03d){_0x4eef59=_0x4eef59-0x0;var _0x2e954b=_0x4c8f[_0x4eef59];return _0x2e954b;};'use strict';var _=require(_0xf4c8('0x0'));var util=require(_0xf4c8('0x1'));var moment=require('moment');var BPromise=require(_0xf4c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4c8('0x3'));var db=require(_0xf4c8('0x4'))['db'];var utils=require(_0xf4c8('0x5'));var logger=require(_0xf4c8('0x6'))(_0xf4c8('0x7'));var config=require(_0xf4c8('0x8'));var jayson=require(_0xf4c8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3faa64,_0x3c3ce0,_0x472ec9){return new BPromise(function(_0x28ad7a,_0x29283d){return client[_0xf4c8('0xa')](_0x3faa64,_0x472ec9)['then'](function(_0xf75c3){logger['info'](_0xf4c8('0xb'),_0x3c3ce0,_0xf4c8('0xc'));logger[_0xf4c8('0xd')](_0xf4c8('0xe'),_0x3c3ce0,'request\x20sent',JSON[_0xf4c8('0xf')](_0xf75c3));if(_0xf75c3[_0xf4c8('0x10')]){if(_0xf75c3[_0xf4c8('0x10')]['code']===0x1f4){logger[_0xf4c8('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3c3ce0,_0xf75c3[_0xf4c8('0x10')]['message']);return _0x29283d(_0xf75c3[_0xf4c8('0x10')][_0xf4c8('0x11')]);}logger[_0xf4c8('0x10')](_0xf4c8('0xb'),_0x3c3ce0,_0xf75c3['error'][_0xf4c8('0x11')]);return _0x28ad7a(_0xf75c3[_0xf4c8('0x10')]['message']);}else{logger['info'](_0xf4c8('0xb'),_0x3c3ce0,_0xf4c8('0xc'));_0x28ad7a(_0xf75c3[_0xf4c8('0x12')][_0xf4c8('0x11')]);}})[_0xf4c8('0x13')](function(_0x590d82){logger[_0xf4c8('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3c3ce0,_0x590d82);_0x29283d(_0x590d82);});});} \ No newline at end of file +var _0x4e30=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x572e0f,_0x51bf90){var _0x4dfbcf=function(_0x530b8c){while(--_0x530b8c){_0x572e0f['push'](_0x572e0f['shift']());}};_0x4dfbcf(++_0x51bf90);}(_0x4e30,0xf3));var _0x04e3=function(_0x33e7d0,_0x31a2ca){_0x33e7d0=_0x33e7d0-0x0;var _0x45395f=_0x4e30[_0x33e7d0];return _0x45395f;};'use strict';var _=require(_0x04e3('0x0'));var util=require(_0x04e3('0x1'));var moment=require('moment');var BPromise=require(_0x04e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04e3('0x3'));var db=require(_0x04e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x04e3('0x5'))(_0x04e3('0x6'));var config=require('../../config/environment');var jayson=require(_0x04e3('0x7'));var client=jayson[_0x04e3('0x8')][_0x04e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x123a1d,_0x1d8c73,_0x2262b9){return new BPromise(function(_0x12098c,_0x4660e1){return client[_0x04e3('0xa')](_0x123a1d,_0x2262b9)[_0x04e3('0xb')](function(_0x1dc610){logger['info'](_0x04e3('0xc'),_0x1d8c73,_0x04e3('0xd'));logger[_0x04e3('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x1d8c73,_0x04e3('0xd'),JSON['stringify'](_0x1dc610));if(_0x1dc610[_0x04e3('0xf')]){if(_0x1dc610[_0x04e3('0xf')][_0x04e3('0x10')]===0x1f4){logger[_0x04e3('0xf')](_0x04e3('0xc'),_0x1d8c73,_0x1dc610[_0x04e3('0xf')][_0x04e3('0x11')]);return _0x4660e1(_0x1dc610[_0x04e3('0xf')][_0x04e3('0x11')]);}logger[_0x04e3('0xf')](_0x04e3('0xc'),_0x1d8c73,_0x1dc610[_0x04e3('0xf')][_0x04e3('0x11')]);return _0x12098c(_0x1dc610[_0x04e3('0xf')][_0x04e3('0x11')]);}else{logger['info'](_0x04e3('0xc'),_0x1d8c73,_0x04e3('0xd'));_0x12098c(_0x1dc610[_0x04e3('0x12')][_0x04e3('0x11')]);}})[_0x04e3('0x13')](function(_0x318069){logger['error'](_0x04e3('0xc'),_0x1d8c73,_0x318069);_0x4660e1(_0x318069);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 64c9799..8778877 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 _0x6628=['/:id','show','post','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x319a03,_0x4456d4){var _0x3b6704=function(_0x1f3476){while(--_0x1f3476){_0x319a03['push'](_0x319a03['shift']());}};_0x3b6704(++_0x4456d4);}(_0x6628,0x113));var _0x8662=function(_0x10e763,_0x4ed7df){_0x10e763=_0x10e763-0x0;var _0x53abee=_0x6628[_0x10e763];return _0x53abee;};'use strict';var multer=require(_0x8662('0x0'));var util=require(_0x8662('0x1'));var path=require(_0x8662('0x2'));var timeout=require(_0x8662('0x3'));var express=require(_0x8662('0x4'));var router=express['Router']();var fs_extra=require(_0x8662('0x5'));var auth=require(_0x8662('0x6'));var interaction=require(_0x8662('0x7'));var config=require(_0x8662('0x8'));var controller=require(_0x8662('0x9'));router[_0x8662('0xa')]('/',auth[_0x8662('0xb')](),controller[_0x8662('0xc')]);router['get'](_0x8662('0xd'),auth[_0x8662('0xb')](),controller[_0x8662('0xe')]);router[_0x8662('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x8662('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8662('0x10')]);module[_0x8662('0x11')]=router; \ No newline at end of file +var _0x1b21=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','create','put','update','destroy','multer','path','Router'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x1b21,0x1dd));var _0x11b2=function(_0x1bc429,_0xc7360e){_0x1bc429=_0x1bc429-0x0;var _0xd0a58b=_0x1b21[_0x1bc429];return _0xd0a58b;};'use strict';var multer=require(_0x11b2('0x0'));var util=require('util');var path=require(_0x11b2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x11b2('0x2')]();var fs_extra=require(_0x11b2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x11b2('0x4'));var config=require(_0x11b2('0x5'));var controller=require(_0x11b2('0x6'));router[_0x11b2('0x7')]('/',auth[_0x11b2('0x8')](),controller['index']);router[_0x11b2('0x7')](_0x11b2('0x9'),auth['isAuthenticated'](),controller[_0x11b2('0xa')]);router['post']('/',auth[_0x11b2('0x8')](),controller[_0x11b2('0xb')]);router[_0x11b2('0xc')](_0x11b2('0x9'),auth[_0x11b2('0x8')](),controller[_0x11b2('0xd')]);router['delete'](_0x11b2('0x9'),auth['isAuthenticated'](),controller[_0x11b2('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ec7b4e2..41d188e 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 _0xdcda=['customVariable','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x343aa1,_0x443588){var _0x145484=function(_0x4f14ee){while(--_0x4f14ee){_0x343aa1['push'](_0x343aa1['shift']());}};_0x145484(++_0x443588);}(_0xdcda,0xa7));var _0xadcd=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdcda[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xadcd('0x0'));module[_0xadcd('0x1')]={'type':{'type':Sequelize['ENUM'](_0xadcd('0x2'),_0xadcd('0x3'),_0xadcd('0x4'),'keyValue',_0xadcd('0x5')),'defaultValue':_0xadcd('0x2')},'content':{'type':Sequelize[_0xadcd('0x6')]},'key':{'type':Sequelize[_0xadcd('0x6')]},'keyType':{'type':Sequelize[_0xadcd('0x7')](_0xadcd('0x2'),_0xadcd('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xadcd('0x6')]},'nameField':{'type':Sequelize[_0xadcd('0x6')]},'customField':{'type':Sequelize[_0xadcd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xadcd('0x6')]}}; \ No newline at end of file +var _0x9c3f=['picklist','string','STRING','BOOLEAN','exports','ENUM','customVariable','keyValue'];(function(_0x42d662,_0x3fa9a8){var _0x3697b0=function(_0x45b20e){while(--_0x45b20e){_0x42d662['push'](_0x42d662['shift']());}};_0x3697b0(++_0x3fa9a8);}(_0x9c3f,0x174));var _0xf9c3=function(_0x3d720d,_0x484c36){_0x3d720d=_0x3d720d-0x0;var _0x101525=_0x9c3f[_0x3d720d];return _0x101525;};'use strict';var Sequelize=require('sequelize');module[_0xf9c3('0x0')]={'type':{'type':Sequelize[_0xf9c3('0x1')]('string','variable',_0xf9c3('0x2'),_0xf9c3('0x3'),_0xf9c3('0x4')),'defaultValue':_0xf9c3('0x5')},'content':{'type':Sequelize[_0xf9c3('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf9c3('0x1')](_0xf9c3('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf9c3('0x6')]},'idField':{'type':Sequelize[_0xf9c3('0x6')]},'nameField':{'type':Sequelize[_0xf9c3('0x6')]},'customField':{'type':Sequelize[_0xf9c3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index fcaeb4b..312b813 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 _0xebc0=['sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','status','error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4852ad,_0x3707b2){var _0x8563e8=function(_0x29528e){while(--_0x29528e){_0x4852ad['push'](_0x4852ad['shift']());}};_0x8563e8(++_0x3707b2);}(_0xebc0,0x111));var _0x0ebc=function(_0x331f2d,_0x4e0fe5){_0x331f2d=_0x331f2d-0x0;var _0x3d9ea1=_0xebc0[_0x331f2d];return _0x3d9ea1;};'use strict';var emlformat=require(_0x0ebc('0x0'));var rimraf=require(_0x0ebc('0x1'));var zipdir=require(_0x0ebc('0x2'));var jsonpatch=require(_0x0ebc('0x3'));var rp=require(_0x0ebc('0x4'));var moment=require(_0x0ebc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ebc('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0ebc('0x7'));var csv=require(_0x0ebc('0x8'));var ejs=require(_0x0ebc('0x9'));var fs=require('fs');var fs_extra=require(_0x0ebc('0xa'));var _=require(_0x0ebc('0xb'));var squel=require(_0x0ebc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0ebc('0xd'));var toCsv=require(_0x0ebc('0x8'));var querystring=require('querystring');var Papa=require(_0x0ebc('0xe'));var Redis=require('ioredis');var authService=require(_0x0ebc('0xf'));var qs=require(_0x0ebc('0x10'));var as=require(_0x0ebc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0ebc('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0ebc('0x13'));var db=require(_0x0ebc('0x14'))['db'];function respondWithStatusCode(_0x20cb40,_0x24f568){_0x24f568=_0x24f568||0xcc;return function(_0x7f54cc){if(_0x7f54cc){return _0x20cb40[_0x0ebc('0x15')](_0x24f568);}return _0x20cb40['status'](_0x24f568)[_0x0ebc('0x16')]();};}function respondWithResult(_0xc9a5ef,_0x54f318){_0x54f318=_0x54f318||0xc8;return function(_0x2f45bf){if(_0x2f45bf){return _0xc9a5ef['status'](_0x54f318)['json'](_0x2f45bf);}};}function respondWithFilteredResult(_0x46d9df,_0x237d5e){return function(_0x564bd2){if(_0x564bd2){var _0x557da9=typeof _0x237d5e['offset']===_0x0ebc('0x17')&&typeof _0x237d5e[_0x0ebc('0x18')]===_0x0ebc('0x17');var _0x5a73a7=_0x564bd2[_0x0ebc('0x19')];var _0x5f0594=_0x557da9?0x0:_0x237d5e[_0x0ebc('0x1a')];var _0x1161cc=_0x557da9?_0x564bd2[_0x0ebc('0x19')]:_0x237d5e[_0x0ebc('0x1a')]+_0x237d5e['limit'];var _0x4e6e9c;if(_0x1161cc>=_0x5a73a7){_0x1161cc=_0x5a73a7;_0x4e6e9c=0xc8;}else{_0x4e6e9c=0xce;}_0x46d9df['status'](_0x4e6e9c);return _0x46d9df[_0x0ebc('0x1b')](_0x0ebc('0x1c'),_0x5f0594+'-'+_0x1161cc+'/'+_0x5a73a7)[_0x0ebc('0x1d')](_0x564bd2);}return null;};}function patchUpdates(_0x3256a9){return function(_0x3641aa){try{jsonpatch['apply'](_0x3641aa,_0x3256a9,!![]);}catch(_0x388125){return BPromise[_0x0ebc('0x1e')](_0x388125);}return _0x3641aa['save']();};}function saveUpdates(_0x10006f,_0x59b888){return function(_0xf8dc5a){if(_0xf8dc5a){return _0xf8dc5a[_0x0ebc('0x1f')](_0x10006f)[_0x0ebc('0x20')](function(_0x2704db){return _0x2704db;});}return null;};}function removeEntity(_0x33ad39,_0x54f9d1){return function(_0x4da89b){if(_0x4da89b){return _0x4da89b['destroy']()[_0x0ebc('0x20')](function(){_0x33ad39[_0x0ebc('0x21')](0xcc)[_0x0ebc('0x16')]();});}};}function handleEntityNotFound(_0x18f8fe,_0x3c7e94){return function(_0x13090e){if(!_0x13090e){_0x18f8fe[_0x0ebc('0x15')](0x194);}return _0x13090e;};}function handleError(_0x11da14,_0x460856){_0x460856=_0x460856||0x1f4;return function(_0x3ad702){logger[_0x0ebc('0x22')](_0x3ad702[_0x0ebc('0x23')]);if(_0x3ad702[_0x0ebc('0x24')]){delete _0x3ad702[_0x0ebc('0x24')];}_0x11da14[_0x0ebc('0x21')](_0x460856)[_0x0ebc('0x25')](_0x3ad702);};}exports['index']=function(_0x44b2f5,_0x3ce509){var _0x513969={},_0x463019={},_0x102dde={'count':0x0,'rows':[]};var _0x2fe1cc=_['map'](db[_0x0ebc('0x26')][_0x0ebc('0x27')],function(_0x3698d2){return{'name':_0x3698d2[_0x0ebc('0x28')],'type':_0x3698d2[_0x0ebc('0x29')][_0x0ebc('0x2a')]};});_0x463019[_0x0ebc('0x2b')]=_[_0x0ebc('0x2c')](_0x2fe1cc,_0x0ebc('0x24'));_0x463019['query']=_[_0x0ebc('0x2d')](_0x44b2f5['query']);_0x463019[_0x0ebc('0x2e')]=_[_0x0ebc('0x2f')](_0x463019['model'],_0x463019['query']);_0x513969['attributes']=_['intersection'](_0x463019['model'],qs[_0x0ebc('0x30')](_0x44b2f5[_0x0ebc('0x31')][_0x0ebc('0x30')]));_0x513969[_0x0ebc('0x32')]=_0x513969['attributes'][_0x0ebc('0x33')]?_0x513969[_0x0ebc('0x32')]:_0x463019['model'];if(!_0x44b2f5['query'][_0x0ebc('0x34')](_0x0ebc('0x35'))){_0x513969[_0x0ebc('0x18')]=qs[_0x0ebc('0x18')](_0x44b2f5[_0x0ebc('0x31')][_0x0ebc('0x18')]);_0x513969[_0x0ebc('0x1a')]=qs[_0x0ebc('0x1a')](_0x44b2f5['query']['offset']);}_0x513969['order']=qs[_0x0ebc('0x36')](_0x44b2f5[_0x0ebc('0x31')][_0x0ebc('0x36')]);_0x513969[_0x0ebc('0x37')]=qs[_0x0ebc('0x2e')](_['pick'](_0x44b2f5[_0x0ebc('0x31')],_0x463019['filters']),_0x2fe1cc);if(_0x44b2f5[_0x0ebc('0x31')][_0x0ebc('0x38')]){_0x513969[_0x0ebc('0x37')]=_['merge'](_0x513969[_0x0ebc('0x37')],{'$or':_['map'](_0x2fe1cc,function(_0x4884d4){if(_0x4884d4[_0x0ebc('0x29')]!==_0x0ebc('0x39')){var _0x2a21c2={};_0x2a21c2[_0x4884d4[_0x0ebc('0x24')]]={'$like':'%'+_0x44b2f5['query'][_0x0ebc('0x38')]+'%'};return _0x2a21c2;}})});}_0x513969=_[_0x0ebc('0x3a')]({},_0x513969,_0x44b2f5[_0x0ebc('0x3b')]);var _0x39f0f3={'where':_0x513969[_0x0ebc('0x37')]};return db[_0x0ebc('0x26')][_0x0ebc('0x19')](_0x39f0f3)[_0x0ebc('0x20')](function(_0x8732d3){_0x102dde['count']=_0x8732d3;if(_0x44b2f5['query']['includeAll']){_0x513969[_0x0ebc('0x3c')]=[{'all':!![]}];}return db[_0x0ebc('0x26')][_0x0ebc('0x3d')](_0x513969);})[_0x0ebc('0x20')](function(_0x4aab40){_0x102dde[_0x0ebc('0x3e')]=_0x4aab40;return _0x102dde;})[_0x0ebc('0x20')](respondWithFilteredResult(_0x3ce509,_0x513969))[_0x0ebc('0x3f')](handleError(_0x3ce509,null));};exports['show']=function(_0x1a7ddd,_0x163a54){var _0x4b3654={'raw':!![],'where':{'id':_0x1a7ddd[_0x0ebc('0x40')]['id']}},_0x572753={};_0x572753[_0x0ebc('0x2b')]=_[_0x0ebc('0x2d')](db[_0x0ebc('0x26')][_0x0ebc('0x27')]);_0x572753[_0x0ebc('0x31')]=_[_0x0ebc('0x2d')](_0x1a7ddd[_0x0ebc('0x31')]);_0x572753[_0x0ebc('0x2e')]=_[_0x0ebc('0x2f')](_0x572753[_0x0ebc('0x2b')],_0x572753[_0x0ebc('0x31')]);_0x4b3654['attributes']=_[_0x0ebc('0x2f')](_0x572753[_0x0ebc('0x2b')],qs[_0x0ebc('0x30')](_0x1a7ddd[_0x0ebc('0x31')][_0x0ebc('0x30')]));_0x4b3654[_0x0ebc('0x32')]=_0x4b3654[_0x0ebc('0x32')]['length']?_0x4b3654['attributes']:_0x572753[_0x0ebc('0x2b')];if(_0x1a7ddd[_0x0ebc('0x31')][_0x0ebc('0x41')]){_0x4b3654['include']=[{'all':!![]}];}_0x4b3654=_[_0x0ebc('0x3a')]({},_0x4b3654,_0x1a7ddd[_0x0ebc('0x3b')]);return db[_0x0ebc('0x26')][_0x0ebc('0x42')](_0x4b3654)['then'](handleEntityNotFound(_0x163a54,null))['then'](respondWithResult(_0x163a54,null))[_0x0ebc('0x3f')](handleError(_0x163a54,null));};exports[_0x0ebc('0x43')]=function(_0x4c5687,_0xc9b103){return db['ServicenowField'][_0x0ebc('0x43')](_0x4c5687[_0x0ebc('0x44')],{})['then'](respondWithResult(_0xc9b103,0xc9))[_0x0ebc('0x3f')](handleError(_0xc9b103,null));};exports[_0x0ebc('0x1f')]=function(_0x35f84e,_0x250479){if(_0x35f84e[_0x0ebc('0x44')]['id']){delete _0x35f84e[_0x0ebc('0x44')]['id'];}return db[_0x0ebc('0x26')][_0x0ebc('0x42')]({'where':{'id':_0x35f84e[_0x0ebc('0x40')]['id']}})['then'](handleEntityNotFound(_0x250479,null))[_0x0ebc('0x20')](saveUpdates(_0x35f84e[_0x0ebc('0x44')],null))[_0x0ebc('0x20')](respondWithResult(_0x250479,null))[_0x0ebc('0x3f')](handleError(_0x250479,null));};exports[_0x0ebc('0x45')]=function(_0x68c42e,_0x146fa9){return db[_0x0ebc('0x26')][_0x0ebc('0x42')]({'where':{'id':_0x68c42e[_0x0ebc('0x40')]['id']}})[_0x0ebc('0x20')](handleEntityNotFound(_0x146fa9,null))['then'](removeEntity(_0x146fa9,null))[_0x0ebc('0x3f')](handleError(_0x146fa9,null));}; \ No newline at end of file +var _0xf863=['name','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','ServicenowField','count','includeAll','rows','catch','show','params','include','create','body','find','destroy','eml-format','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/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','set','apply','reject','save','update','then','error'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0xf863,0x6b));var _0x3f86=function(_0x2eebef,_0x2fa511){_0x2eebef=_0x2eebef-0x0;var _0x5bb435=_0xf863[_0x2eebef];return _0x5bb435;};'use strict';var emlformat=require(_0x3f86('0x0'));var rimraf=require(_0x3f86('0x1'));var zipdir=require(_0x3f86('0x2'));var jsonpatch=require(_0x3f86('0x3'));var rp=require(_0x3f86('0x4'));var moment=require(_0x3f86('0x5'));var BPromise=require(_0x3f86('0x6'));var Mustache=require('mustache');var util=require(_0x3f86('0x7'));var path=require(_0x3f86('0x8'));var sox=require(_0x3f86('0x9'));var csv=require(_0x3f86('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f86('0xb'));var _=require(_0x3f86('0xc'));var squel=require(_0x3f86('0xd'));var crypto=require(_0x3f86('0xe'));var jsforce=require(_0x3f86('0xf'));var deskjs=require(_0x3f86('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3f86('0x11'));var Papa=require(_0x3f86('0x12'));var Redis=require(_0x3f86('0x13'));var authService=require(_0x3f86('0x14'));var qs=require(_0x3f86('0x15'));var as=require(_0x3f86('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f86('0x17'))('api');var utils=require(_0x3f86('0x18'));var config=require(_0x3f86('0x19'));var licenseUtil=require(_0x3f86('0x1a'));var db=require(_0x3f86('0x1b'))['db'];function respondWithStatusCode(_0x42e524,_0xc1846d){_0xc1846d=_0xc1846d||0xcc;return function(_0xbd85bb){if(_0xbd85bb){return _0x42e524[_0x3f86('0x1c')](_0xc1846d);}return _0x42e524[_0x3f86('0x1d')](_0xc1846d)[_0x3f86('0x1e')]();};}function respondWithResult(_0x36ac54,_0x1d4a10){_0x1d4a10=_0x1d4a10||0xc8;return function(_0x415c1b){if(_0x415c1b){return _0x36ac54['status'](_0x1d4a10)[_0x3f86('0x1f')](_0x415c1b);}};}function respondWithFilteredResult(_0x1fcaa8,_0x9af486){return function(_0x2fef43){if(_0x2fef43){var _0x31f270=typeof _0x9af486['offset']==='undefined'&&typeof _0x9af486[_0x3f86('0x20')]==='undefined';var _0x1494c0=_0x2fef43['count'];var _0x5b6e13=_0x31f270?0x0:_0x9af486[_0x3f86('0x21')];var _0x4728d9=_0x31f270?_0x2fef43['count']:_0x9af486[_0x3f86('0x21')]+_0x9af486[_0x3f86('0x20')];var _0x2a219c;if(_0x4728d9>=_0x1494c0){_0x4728d9=_0x1494c0;_0x2a219c=0xc8;}else{_0x2a219c=0xce;}_0x1fcaa8['status'](_0x2a219c);return _0x1fcaa8[_0x3f86('0x22')]('Content-Range',_0x5b6e13+'-'+_0x4728d9+'/'+_0x1494c0)[_0x3f86('0x1f')](_0x2fef43);}return null;};}function patchUpdates(_0x48de6d){return function(_0x397b6e){try{jsonpatch[_0x3f86('0x23')](_0x397b6e,_0x48de6d,!![]);}catch(_0x10f946){return BPromise[_0x3f86('0x24')](_0x10f946);}return _0x397b6e[_0x3f86('0x25')]();};}function saveUpdates(_0x590cd9,_0x1d7902){return function(_0x5e8694){if(_0x5e8694){return _0x5e8694[_0x3f86('0x26')](_0x590cd9)[_0x3f86('0x27')](function(_0x42dacc){return _0x42dacc;});}return null;};}function removeEntity(_0x1efaff,_0x33bbbd){return function(_0x3cc167){if(_0x3cc167){return _0x3cc167['destroy']()['then'](function(){_0x1efaff['status'](0xcc)[_0x3f86('0x1e')]();});}};}function handleEntityNotFound(_0x54d2a2,_0x162b1b){return function(_0xad6520){if(!_0xad6520){_0x54d2a2[_0x3f86('0x1c')](0x194);}return _0xad6520;};}function handleError(_0x5a3c0c,_0xc48e0a){_0xc48e0a=_0xc48e0a||0x1f4;return function(_0x386643){logger[_0x3f86('0x28')](_0x386643['stack']);if(_0x386643[_0x3f86('0x29')]){delete _0x386643[_0x3f86('0x29')];}_0x5a3c0c[_0x3f86('0x1d')](_0xc48e0a)['send'](_0x386643);};}exports['index']=function(_0x278c04,_0x1debbb){var _0x2de877={},_0x25d395={},_0x58bf5a={'count':0x0,'rows':[]};var _0x405286=_['map'](db['ServicenowField'][_0x3f86('0x2a')],function(_0x202fe5){return{'name':_0x202fe5[_0x3f86('0x2b')],'type':_0x202fe5[_0x3f86('0x2c')][_0x3f86('0x2d')]};});_0x25d395[_0x3f86('0x2e')]=_[_0x3f86('0x2f')](_0x405286,_0x3f86('0x29'));_0x25d395['query']=_[_0x3f86('0x30')](_0x278c04['query']);_0x25d395['filters']=_[_0x3f86('0x31')](_0x25d395[_0x3f86('0x2e')],_0x25d395[_0x3f86('0x32')]);_0x2de877[_0x3f86('0x33')]=_[_0x3f86('0x31')](_0x25d395['model'],qs[_0x3f86('0x34')](_0x278c04[_0x3f86('0x32')][_0x3f86('0x34')]));_0x2de877[_0x3f86('0x33')]=_0x2de877[_0x3f86('0x33')]['length']?_0x2de877['attributes']:_0x25d395[_0x3f86('0x2e')];if(!_0x278c04[_0x3f86('0x32')]['hasOwnProperty'](_0x3f86('0x35'))){_0x2de877[_0x3f86('0x20')]=qs['limit'](_0x278c04[_0x3f86('0x32')][_0x3f86('0x20')]);_0x2de877[_0x3f86('0x21')]=qs[_0x3f86('0x21')](_0x278c04[_0x3f86('0x32')][_0x3f86('0x21')]);}_0x2de877[_0x3f86('0x36')]=qs[_0x3f86('0x37')](_0x278c04['query']['sort']);_0x2de877[_0x3f86('0x38')]=qs[_0x3f86('0x39')](_['pick'](_0x278c04[_0x3f86('0x32')],_0x25d395[_0x3f86('0x39')]),_0x405286);if(_0x278c04[_0x3f86('0x32')][_0x3f86('0x3a')]){_0x2de877[_0x3f86('0x38')]=_['merge'](_0x2de877[_0x3f86('0x38')],{'$or':_[_0x3f86('0x2f')](_0x405286,function(_0x571592){if(_0x571592[_0x3f86('0x2c')]!==_0x3f86('0x3b')){var _0x1266a5={};_0x1266a5[_0x571592[_0x3f86('0x29')]]={'$like':'%'+_0x278c04['query']['filter']+'%'};return _0x1266a5;}})});}_0x2de877=_[_0x3f86('0x3c')]({},_0x2de877,_0x278c04[_0x3f86('0x3d')]);var _0x246fbb={'where':_0x2de877['where']};return db[_0x3f86('0x3e')][_0x3f86('0x3f')](_0x246fbb)[_0x3f86('0x27')](function(_0x3f59ee){_0x58bf5a[_0x3f86('0x3f')]=_0x3f59ee;if(_0x278c04[_0x3f86('0x32')][_0x3f86('0x40')]){_0x2de877['include']=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x2de877);})[_0x3f86('0x27')](function(_0x1c0a70){_0x58bf5a[_0x3f86('0x41')]=_0x1c0a70;return _0x58bf5a;})[_0x3f86('0x27')](respondWithFilteredResult(_0x1debbb,_0x2de877))[_0x3f86('0x42')](handleError(_0x1debbb,null));};exports[_0x3f86('0x43')]=function(_0x16040f,_0x448e82){var _0x236ecf={'raw':!![],'where':{'id':_0x16040f[_0x3f86('0x44')]['id']}},_0x10c377={};_0x10c377['model']=_[_0x3f86('0x30')](db[_0x3f86('0x3e')]['rawAttributes']);_0x10c377[_0x3f86('0x32')]=_[_0x3f86('0x30')](_0x16040f[_0x3f86('0x32')]);_0x10c377[_0x3f86('0x39')]=_[_0x3f86('0x31')](_0x10c377[_0x3f86('0x2e')],_0x10c377[_0x3f86('0x32')]);_0x236ecf[_0x3f86('0x33')]=_[_0x3f86('0x31')](_0x10c377['model'],qs[_0x3f86('0x34')](_0x16040f['query'][_0x3f86('0x34')]));_0x236ecf[_0x3f86('0x33')]=_0x236ecf['attributes']['length']?_0x236ecf[_0x3f86('0x33')]:_0x10c377['model'];if(_0x16040f[_0x3f86('0x32')][_0x3f86('0x40')]){_0x236ecf[_0x3f86('0x45')]=[{'all':!![]}];}_0x236ecf=_[_0x3f86('0x3c')]({},_0x236ecf,_0x16040f[_0x3f86('0x3d')]);return db[_0x3f86('0x3e')]['find'](_0x236ecf)[_0x3f86('0x27')](handleEntityNotFound(_0x448e82,null))['then'](respondWithResult(_0x448e82,null))[_0x3f86('0x42')](handleError(_0x448e82,null));};exports['create']=function(_0x1b9674,_0x1c2bbd){return db['ServicenowField'][_0x3f86('0x46')](_0x1b9674[_0x3f86('0x47')],{})[_0x3f86('0x27')](respondWithResult(_0x1c2bbd,0xc9))[_0x3f86('0x42')](handleError(_0x1c2bbd,null));};exports[_0x3f86('0x26')]=function(_0x41a994,_0x1dd037){if(_0x41a994[_0x3f86('0x47')]['id']){delete _0x41a994[_0x3f86('0x47')]['id'];}return db[_0x3f86('0x3e')][_0x3f86('0x48')]({'where':{'id':_0x41a994[_0x3f86('0x44')]['id']}})['then'](handleEntityNotFound(_0x1dd037,null))[_0x3f86('0x27')](saveUpdates(_0x41a994[_0x3f86('0x47')],null))[_0x3f86('0x27')](respondWithResult(_0x1dd037,null))[_0x3f86('0x42')](handleError(_0x1dd037,null));};exports[_0x3f86('0x49')]=function(_0x94ecb8,_0x16a531){return db[_0x3f86('0x3e')][_0x3f86('0x48')]({'where':{'id':_0x94ecb8[_0x3f86('0x44')]['id']}})[_0x3f86('0x27')](handleEntityNotFound(_0x16a531,null))[_0x3f86('0x27')](removeEntity(_0x16a531,null))['catch'](handleError(_0x16a531,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index bee9f93..105ba6e 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 _0xd82a=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0xd82a,0x7d));var _0xad82=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd82a[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xad82('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad82('0x1'));var moment=require('moment');var BPromise=require(_0xad82('0x2'));var rp=require(_0xad82('0x3'));var fs=require('fs');var path=require(_0xad82('0x4'));var rimraf=require(_0xad82('0x5'));var config=require(_0xad82('0x6'));var attributes=require(_0xad82('0x7'));module[_0xad82('0x8')]=function(_0x5710d5,_0xeb6f94){return _0x5710d5[_0xad82('0x9')](_0xad82('0xa'),attributes,{'tableName':_0xad82('0xb'),'paranoid':![],'indexes':[{'name':_0xad82('0xc'),'fields':[_0xad82('0xd'),_0xad82('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x409e=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x409e,0x17c));var _0xe409=function(_0x17bcce,_0x39ec4a){_0x17bcce=_0x17bcce-0x0;var _0x47fccb=_0x409e[_0x17bcce];return _0x47fccb;};'use strict';var _=require(_0xe409('0x0'));var util=require(_0xe409('0x1'));var logger=require('../../config/logger')(_0xe409('0x2'));var moment=require(_0xe409('0x3'));var BPromise=require(_0xe409('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe409('0x5'));var config=require(_0xe409('0x6'));var attributes=require(_0xe409('0x7'));module[_0xe409('0x8')]=function(_0x2358d1,_0x45049f){return _0x2358d1[_0xe409('0x9')](_0xe409('0xa'),attributes,{'tableName':_0xe409('0xb'),'paranoid':![],'indexes':[{'name':_0xe409('0xc'),'fields':[_0xe409('0xd'),_0xe409('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index d9c9473..a38d1b4 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xda3f,0xec));var _0xfda3=function(_0x287096,_0x1c8c29){_0x287096=_0x287096-0x0;var _0x1545d4=_0xda3f[_0x287096];return _0x1545d4;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x2c73bf,_0x17ced7){var _0x4f7ec2=function(_0x30c650){while(--_0x30c650){_0x2c73bf['push'](_0x2c73bf['shift']());}};_0x4f7ec2(++_0x17ced7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bc4b4c7..0148460 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(_0xa0aa45,_0x2c7518){var _0x4cbef2=function(_0x4318ea){while(--_0x4318ea){_0xa0aa45['push'](_0xa0aa45['shift']());}};_0x4cbef2(++_0x2c7518);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x39c838,_0x3e3e93){var _0x58eb45=function(_0x820259){while(--_0x820259){_0x39c838['push'](_0x39c838['shift']());}};_0x58eb45(++_0x3e3e93);}(_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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index fd21bab..3ec2133 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(_0x29ee3c,_0x12eb99){var _0x3d9d30=function(_0x53360d){while(--_0x53360d){_0x29ee3c['push'](_0x29ee3c['shift']());}};_0x3d9d30(++_0x12eb99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x55f020,_0xe5fcbf){var _0x1a0bf0=function(_0x454bd6){while(--_0x454bd6){_0x55f020['push'](_0x55f020['shift']());}};_0x1a0bf0(++_0xe5fcbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 8479d18..bce19bc 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 _0x6a6d=['statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','map','SugarcrmAccount','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','sort','merge','VIRTUAL','filter','where','findAll','rows','keys','rawAttributes','length','includeAll','include','options','find','catch','create','body','params','getConfigurations','findOne','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','lastIndexOf','POST','format','%s%s','JSON','stringify','PLAIN','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','label','endsWith','values','value','test'];(function(_0x128022,_0x328b12){var _0xae9839=function(_0x11b916){while(--_0x11b916){_0x128022['push'](_0x128022['shift']());}};_0xae9839(++_0x328b12);}(_0x6a6d,0x73));var _0xd6a6=function(_0x91e341,_0x298ff2){_0x91e341=_0x91e341-0x0;var _0x1db814=_0x6a6d[_0x91e341];return _0x1db814;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6a6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6a6('0x1'));var rp=require(_0xd6a6('0x2'));var moment=require(_0xd6a6('0x3'));var BPromise=require(_0xd6a6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd6a6('0x5'));var sox=require(_0xd6a6('0x6'));var csv=require(_0xd6a6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6a6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd6a6('0x9'));var jsforce=require(_0xd6a6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6a6('0xb'));var Papa=require(_0xd6a6('0xc'));var Redis=require(_0xd6a6('0xd'));var authService=require(_0xd6a6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd6a6('0xf'));var hardwareService=require(_0xd6a6('0x10'));var logger=require('../../config/logger')(_0xd6a6('0x11'));var utils=require(_0xd6a6('0x12'));var config=require(_0xd6a6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6a6('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2ad69b,_0x271607){_0x271607=_0x271607||0xcc;return function(_0x4c7fd5){if(_0x4c7fd5){return _0x2ad69b[_0xd6a6('0x15')](_0x271607);}return _0x2ad69b[_0xd6a6('0x16')](_0x271607)[_0xd6a6('0x17')]();};}function respondWithResult(_0x116c75,_0x576688){_0x576688=_0x576688||0xc8;return function(_0x2d31e7){if(_0x2d31e7){return _0x116c75['status'](_0x576688)[_0xd6a6('0x18')](_0x2d31e7);}};}function respondWithFilteredResult(_0x1c8f5a,_0x2a7d9f){return function(_0x46f737){if(_0x46f737){var _0x23fb80=typeof _0x2a7d9f[_0xd6a6('0x19')]===_0xd6a6('0x1a')&&typeof _0x2a7d9f[_0xd6a6('0x1b')]===_0xd6a6('0x1a');var _0x4f184c=_0x46f737[_0xd6a6('0x1c')];var _0x4d360f=_0x23fb80?0x0:_0x2a7d9f['offset'];var _0x4cd192=_0x23fb80?_0x46f737[_0xd6a6('0x1c')]:_0x2a7d9f[_0xd6a6('0x19')]+_0x2a7d9f['limit'];var _0xfbf648;if(_0x4cd192>=_0x4f184c){_0x4cd192=_0x4f184c;_0xfbf648=0xc8;}else{_0xfbf648=0xce;}_0x1c8f5a[_0xd6a6('0x16')](_0xfbf648);return _0x1c8f5a[_0xd6a6('0x1d')](_0xd6a6('0x1e'),_0x4d360f+'-'+_0x4cd192+'/'+_0x4f184c)[_0xd6a6('0x18')](_0x46f737);}return null;};}function patchUpdates(_0x165c60){return function(_0x380182){try{jsonpatch['apply'](_0x380182,_0x165c60,!![]);}catch(_0x3d75e8){return BPromise[_0xd6a6('0x1f')](_0x3d75e8);}return _0x380182['save']();};}function saveUpdates(_0x35c99b,_0x341d81){return function(_0xe28f53){if(_0xe28f53){return _0xe28f53['update'](_0x35c99b)[_0xd6a6('0x20')](function(_0x2a0256){return _0x2a0256;});}return null;};}function removeEntity(_0x353da9,_0x25a5fc){return function(_0x528661){if(_0x528661){return _0x528661[_0xd6a6('0x21')]()[_0xd6a6('0x20')](function(){_0x353da9[_0xd6a6('0x16')](0xcc)[_0xd6a6('0x17')]();});}};}function handleEntityNotFound(_0x378317,_0x416256){return function(_0xeb6ceb){if(!_0xeb6ceb){_0x378317[_0xd6a6('0x15')](0x194);}return _0xeb6ceb;};}function handleError(_0x5603e9,_0xb9ea39){_0xb9ea39=_0xb9ea39||0x1f4;return function(_0x20d32d){logger[_0xd6a6('0x22')](_0x20d32d[_0xd6a6('0x23')]);if(_0x20d32d[_0xd6a6('0x24')]){delete _0x20d32d[_0xd6a6('0x24')];}_0x5603e9[_0xd6a6('0x16')](_0xb9ea39)[_0xd6a6('0x25')](_0x20d32d);};}exports['index']=function(_0x49e0ae,_0x4ccdb9){var _0x887b11={},_0x423e28={},_0x10999f={'count':0x0,'rows':[]};var _0x1db94f=_[_0xd6a6('0x26')](db[_0xd6a6('0x27')]['rawAttributes'],function(_0x5d4252){return{'name':_0x5d4252[_0xd6a6('0x28')],'type':_0x5d4252[_0xd6a6('0x29')]['key']};});_0x423e28[_0xd6a6('0x2a')]=_['map'](_0x1db94f,_0xd6a6('0x24'));_0x423e28[_0xd6a6('0x2b')]=_['keys'](_0x49e0ae[_0xd6a6('0x2b')]);_0x423e28[_0xd6a6('0x2c')]=_['intersection'](_0x423e28[_0xd6a6('0x2a')],_0x423e28['query']);_0x887b11[_0xd6a6('0x2d')]=_[_0xd6a6('0x2e')](_0x423e28[_0xd6a6('0x2a')],qs[_0xd6a6('0x2f')](_0x49e0ae[_0xd6a6('0x2b')][_0xd6a6('0x2f')]));_0x887b11[_0xd6a6('0x2d')]=_0x887b11[_0xd6a6('0x2d')]['length']?_0x887b11[_0xd6a6('0x2d')]:_0x423e28['model'];if(!_0x49e0ae[_0xd6a6('0x2b')][_0xd6a6('0x30')]('nolimit')){_0x887b11[_0xd6a6('0x1b')]=qs[_0xd6a6('0x1b')](_0x49e0ae[_0xd6a6('0x2b')][_0xd6a6('0x1b')]);_0x887b11[_0xd6a6('0x19')]=qs[_0xd6a6('0x19')](_0x49e0ae['query']['offset']);}_0x887b11['order']=qs[_0xd6a6('0x31')](_0x49e0ae['query'][_0xd6a6('0x31')]);_0x887b11['where']=qs[_0xd6a6('0x2c')](_['pick'](_0x49e0ae[_0xd6a6('0x2b')],_0x423e28[_0xd6a6('0x2c')]),_0x1db94f);if(_0x49e0ae[_0xd6a6('0x2b')]['filter']){_0x887b11['where']=_[_0xd6a6('0x32')](_0x887b11['where'],{'$or':_[_0xd6a6('0x26')](_0x1db94f,function(_0x54e410){if(_0x54e410[_0xd6a6('0x29')]!==_0xd6a6('0x33')){var _0x419818={};_0x419818[_0x54e410['name']]={'$like':'%'+_0x49e0ae[_0xd6a6('0x2b')][_0xd6a6('0x34')]+'%'};return _0x419818;}})});}_0x887b11=_[_0xd6a6('0x32')]({},_0x887b11,_0x49e0ae['options']);var _0x1efbd0={'where':_0x887b11[_0xd6a6('0x35')]};return db[_0xd6a6('0x27')][_0xd6a6('0x1c')](_0x1efbd0)[_0xd6a6('0x20')](function(_0x59b154){_0x10999f['count']=_0x59b154;if(_0x49e0ae[_0xd6a6('0x2b')]['includeAll']){_0x887b11['include']=[{'all':!![]}];}return db[_0xd6a6('0x27')][_0xd6a6('0x36')](_0x887b11);})[_0xd6a6('0x20')](function(_0x2a9487){_0x10999f[_0xd6a6('0x37')]=_0x2a9487;return _0x10999f;})[_0xd6a6('0x20')](respondWithFilteredResult(_0x4ccdb9,_0x887b11))['catch'](handleError(_0x4ccdb9,null));};exports['show']=function(_0x1f5629,_0x14c184){var _0x4542a8={'raw':![],'where':{'id':_0x1f5629['params']['id']}},_0xade49a={};_0xade49a['model']=_[_0xd6a6('0x38')](db[_0xd6a6('0x27')][_0xd6a6('0x39')]);_0xade49a[_0xd6a6('0x2b')]=_[_0xd6a6('0x38')](_0x1f5629[_0xd6a6('0x2b')]);_0xade49a[_0xd6a6('0x2c')]=_['intersection'](_0xade49a[_0xd6a6('0x2a')],_0xade49a[_0xd6a6('0x2b')]);_0x4542a8[_0xd6a6('0x2d')]=_['intersection'](_0xade49a[_0xd6a6('0x2a')],qs[_0xd6a6('0x2f')](_0x1f5629['query']['fields']));_0x4542a8['attributes']=_0x4542a8[_0xd6a6('0x2d')][_0xd6a6('0x3a')]?_0x4542a8[_0xd6a6('0x2d')]:_0xade49a[_0xd6a6('0x2a')];if(_0x1f5629[_0xd6a6('0x2b')][_0xd6a6('0x3b')]){_0x4542a8[_0xd6a6('0x3c')]=[{'all':!![]}];}_0x4542a8=_[_0xd6a6('0x32')]({},_0x4542a8,_0x1f5629[_0xd6a6('0x3d')]);return db[_0xd6a6('0x27')][_0xd6a6('0x3e')](_0x4542a8)['then'](handleEntityNotFound(_0x14c184,null))[_0xd6a6('0x20')](respondWithResult(_0x14c184,null))[_0xd6a6('0x3f')](handleError(_0x14c184,null));};exports[_0xd6a6('0x40')]=function(_0xa29480,_0x128acd){return db[_0xd6a6('0x27')][_0xd6a6('0x40')](_0xa29480[_0xd6a6('0x41')],{})[_0xd6a6('0x20')](respondWithResult(_0x128acd,0xc9))[_0xd6a6('0x3f')](handleError(_0x128acd,null));};exports['update']=function(_0x55b40e,_0x49528d){if(_0x55b40e[_0xd6a6('0x41')]['id']){delete _0x55b40e[_0xd6a6('0x41')]['id'];}return db['SugarcrmAccount'][_0xd6a6('0x3e')]({'where':{'id':_0x55b40e[_0xd6a6('0x42')]['id']}})[_0xd6a6('0x20')](handleEntityNotFound(_0x49528d,null))[_0xd6a6('0x20')](saveUpdates(_0x55b40e['body'],null))[_0xd6a6('0x20')](respondWithResult(_0x49528d,null))[_0xd6a6('0x3f')](handleError(_0x49528d,null));};exports[_0xd6a6('0x21')]=function(_0x943d19,_0x590e55){return db['SugarcrmAccount'][_0xd6a6('0x3e')]({'where':{'id':_0x943d19[_0xd6a6('0x42')]['id']}})[_0xd6a6('0x20')](handleEntityNotFound(_0x590e55,null))[_0xd6a6('0x20')](removeEntity(_0x590e55,null))[_0xd6a6('0x3f')](handleError(_0x590e55,null));};exports[_0xd6a6('0x43')]=function(_0x131f8b,_0x419c81,_0x794885){var _0x4036f0={};var _0x53671d={};var _0x13ae4e;var _0xe72846;return db[_0xd6a6('0x27')][_0xd6a6('0x44')]({'where':{'id':_0x131f8b[_0xd6a6('0x42')]['id']}})[_0xd6a6('0x20')](handleEntityNotFound(_0x419c81,null))[_0xd6a6('0x20')](function(_0x3ff8d6){if(_0x3ff8d6){_0x13ae4e=_0x3ff8d6;_0x53671d['model']=_[_0xd6a6('0x38')](db['SugarcrmConfiguration'][_0xd6a6('0x39')]);_0x53671d[_0xd6a6('0x2b')]=_[_0xd6a6('0x38')](_0x131f8b['query']);_0x53671d[_0xd6a6('0x2c')]=_[_0xd6a6('0x2e')](_0x53671d[_0xd6a6('0x2a')],_0x53671d[_0xd6a6('0x2b')]);_0x4036f0[_0xd6a6('0x2d')]=_['intersection'](_0x53671d[_0xd6a6('0x2a')],qs[_0xd6a6('0x2f')](_0x131f8b[_0xd6a6('0x2b')][_0xd6a6('0x2f')]));_0x4036f0[_0xd6a6('0x2d')]=_0x4036f0['attributes'][_0xd6a6('0x3a')]?_0x4036f0[_0xd6a6('0x2d')]:_0x53671d[_0xd6a6('0x2a')];_0x4036f0[_0xd6a6('0x45')]=qs[_0xd6a6('0x31')](_0x131f8b[_0xd6a6('0x2b')][_0xd6a6('0x31')]);_0x4036f0['where']=qs[_0xd6a6('0x2c')](_['pick'](_0x131f8b[_0xd6a6('0x2b')],_0x53671d[_0xd6a6('0x2c')]));if(_0x131f8b[_0xd6a6('0x2b')][_0xd6a6('0x34')]){_0x4036f0[_0xd6a6('0x35')]=_['merge'](_0x4036f0[_0xd6a6('0x35')],{'$or':_['map'](_0x4036f0[_0xd6a6('0x2d')],function(_0x3ab891){var _0x2a5dad={};_0x2a5dad[_0x3ab891]={'$like':'%'+_0x131f8b[_0xd6a6('0x2b')][_0xd6a6('0x34')]+'%'};return _0x2a5dad;})});}_0x4036f0=_[_0xd6a6('0x32')]({},_0x4036f0,_0x131f8b[_0xd6a6('0x3d')]);return _0x13ae4e[_0xd6a6('0x43')](_0x4036f0);}})[_0xd6a6('0x20')](function(_0x18a2d1){if(_0x18a2d1){_0xe72846=_0x18a2d1[_0xd6a6('0x3a')];if(!_0x131f8b['query'][_0xd6a6('0x30')](_0xd6a6('0x46'))){_0x4036f0[_0xd6a6('0x1b')]=qs[_0xd6a6('0x1b')](_0x131f8b[_0xd6a6('0x2b')]['limit']);_0x4036f0['offset']=qs[_0xd6a6('0x19')](_0x131f8b[_0xd6a6('0x2b')]['offset']);}return _0x13ae4e[_0xd6a6('0x43')](_0x4036f0);}})[_0xd6a6('0x20')](function(_0x5ab3d0){if(_0x5ab3d0){return _0x5ab3d0?{'count':_0xe72846,'rows':_0x5ab3d0}:null;}})[_0xd6a6('0x20')](respondWithResult(_0x419c81,null))[_0xd6a6('0x3f')](handleError(_0x419c81,null));};exports[_0xd6a6('0x47')]=function(_0x4ae5f9,_0x3b0aa0,_0x1c1cec){if(_0x4ae5f9[_0xd6a6('0x41')]['id']){delete _0x4ae5f9['body']['id'];}return db[_0xd6a6('0x27')][_0xd6a6('0x44')]({'where':{'id':_0x4ae5f9[_0xd6a6('0x42')]['id']}})[_0xd6a6('0x20')](handleEntityNotFound(_0x3b0aa0,null))[_0xd6a6('0x20')](function(_0x59596){if(_0x59596){_0x4ae5f9[_0xd6a6('0x41')][_0xd6a6('0x48')]=_0x59596['id'];_0x4ae5f9[_0xd6a6('0x41')][_0xd6a6('0x49')]=integrations[_0xd6a6('0x4a')](_0x4ae5f9['body'][_0xd6a6('0x4b')],_0x4ae5f9[_0xd6a6('0x41')][_0xd6a6('0x29')]);_0x4ae5f9[_0xd6a6('0x41')][_0xd6a6('0x4c')]=integrations['getDescriptions'](_0x4ae5f9[_0xd6a6('0x41')][_0xd6a6('0x4b')],_0x4ae5f9[_0xd6a6('0x41')]['type']);return db[_0xd6a6('0x4d')][_0xd6a6('0x40')](_0x4ae5f9[_0xd6a6('0x41')],{'include':[{'model':db[_0xd6a6('0x4e')],'as':_0xd6a6('0x49')},{'model':db['SugarcrmField'],'as':_0xd6a6('0x4c')}]});}return null;})[_0xd6a6('0x20')](respondWithResult(_0x3b0aa0,null))[_0xd6a6('0x3f')](handleError(_0x3b0aa0,null));};exports[_0xd6a6('0x4f')]=function(_0x1ed7c9,_0x2f117b,_0x1354c7){var _0x364fdb='';var _0x22a454=['id',_0xd6a6('0x24'),_0xd6a6('0x50'),'created_by',_0xd6a6('0x51'),_0xd6a6('0x52'),_0xd6a6('0x53'),_0xd6a6('0x54'),_0xd6a6('0x55'),_0xd6a6('0x56'),_0xd6a6('0x57'),_0xd6a6('0x58')];return db['SugarcrmAccount'][_0xd6a6('0x44')]({'where':{'id':_0x1ed7c9['params']['id']},'attributes':['id',_0xd6a6('0x59'),_0xd6a6('0x5a'),_0xd6a6('0x5b')]})['then'](handleEntityNotFound(_0x2f117b,null))[_0xd6a6('0x20')](function(_0x4943b5){if(_0x4943b5){_0x364fdb=_0x4943b5[_0xd6a6('0x5b')];var _0x4afcf5=_0x364fdb['slice'](-0x1);if(_0x4afcf5==='/'){_0x364fdb=_0x364fdb['substring'](0x0,_0x364fdb[_0xd6a6('0x5c')](_0x4afcf5));}return rp({'method':_0xd6a6('0x5d'),'uri':util[_0xd6a6('0x5e')](_0xd6a6('0x5f'),_0x364fdb,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xd6a6('0x60'),'response_type':_0xd6a6('0x60'),'rest_data':JSON[_0xd6a6('0x61')]({'user_auth':{'user_name':_0x4943b5[_0xd6a6('0x59')],'password':_0x4943b5['password'],'encryption':_0xd6a6('0x62')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x58d3f1){if(_0x58d3f1&&_0x58d3f1[_0xd6a6('0x24')]!=='Invalid\x20Login'&&_0x58d3f1[_0xd6a6('0x24')]!=='Password\x20Expired'){return rp({'method':_0xd6a6('0x5d'),'uri':util[_0xd6a6('0x5e')](_0xd6a6('0x5f'),_0x364fdb,_0xd6a6('0x63')),'json':!![],'form':{'method':_0xd6a6('0x64'),'input_type':_0xd6a6('0x60'),'response_type':_0xd6a6('0x60'),'rest_data':JSON[_0xd6a6('0x61')]({'session':_0x58d3f1['id'],'module_name':_0xd6a6('0x65')})}})[_0xd6a6('0x20')](function(_0x1c6afd){if(_0x1c6afd){var _0x579e4a=_['values'](_0x1c6afd[_0xd6a6('0x66')]);_[_0xd6a6('0x67')](_0x579e4a,function(_0xb458f5){return _0x22a454['includes'](_0xb458f5[_0xd6a6('0x24')]);});return{'count':_0x579e4a[_0xd6a6('0x3a')],'rows':_['map'](_0x579e4a,function(_0x4cc8ea){return{'id':_0x4cc8ea[_0xd6a6('0x24')],'name':_0x4cc8ea[_0xd6a6('0x68')],'custom':_[_0xd6a6('0x69')](_0x4cc8ea[_0xd6a6('0x24')],'_c')?!![]:![],'options':_0x4cc8ea[_0xd6a6('0x3d')]?_['map'](_[_0xd6a6('0x6a')](_0x4cc8ea[_0xd6a6('0x3d')]),function(_0x4a7891){return{'name':_0x4a7891[_0xd6a6('0x6b')],'value':_0x4a7891[_0xd6a6('0x24')]};}):[]};})};}})[_0xd6a6('0x20')](respondWithResult(_0x2f117b,null))[_0xd6a6('0x3f')](function(_0x2b09f1){var _0x450eb0=_0x1ed7c9[_0xd6a6('0x2b')][_0xd6a6('0x6c')]?0x1f4:_0x2b09f1[_0xd6a6('0x6d')]||0x1f4;logger['error'](_0xd6a6('0x6e'),_0xd6a6('0x4f'),_0x450eb0,JSON[_0xd6a6('0x61')](_0x2b09f1));delete _0x2b09f1[_0xd6a6('0x24')];if(_0x450eb0===0x191){_0x450eb0=0x190;}_0x2f117b[_0xd6a6('0x16')](_0x450eb0)[_0xd6a6('0x25')](_0x1ed7c9[_0xd6a6('0x2b')]['test']?{'message':_0xd6a6('0x6f'),'statusCode':_0x2b09f1['statusCode']}:_0x2b09f1);});}else{var _0x956577=0x1f4;_0x2f117b[_0xd6a6('0x16')](_0x956577)[_0xd6a6('0x25')]({'message':_0xd6a6('0x6f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x890c=['getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','get_module_fields','values','module_fields','includes','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','end','stack','name','index','map','SugarcrmAccount','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','catch','create','body','getConfigurations','sort','addConfiguration','Subjects'];(function(_0x2c9555,_0x49e0a1){var _0x369f8d=function(_0x126bdd){while(--_0x126bdd){_0x2c9555['push'](_0x2c9555['shift']());}};_0x369f8d(++_0x49e0a1);}(_0x890c,0x99));var _0xc890=function(_0x372e79,_0x75c6c6){_0x372e79=_0x372e79-0x0;var _0x532dd4=_0x890c[_0x372e79];return _0x532dd4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc890('0x0'));var jsonpatch=require(_0xc890('0x1'));var rp=require(_0xc890('0x2'));var moment=require(_0xc890('0x3'));var BPromise=require(_0xc890('0x4'));var Mustache=require(_0xc890('0x5'));var util=require(_0xc890('0x6'));var path=require(_0xc890('0x7'));var sox=require('sox');var csv=require(_0xc890('0x8'));var ejs=require(_0xc890('0x9'));var fs=require('fs');var fs_extra=require(_0xc890('0xa'));var _=require(_0xc890('0xb'));var squel=require(_0xc890('0xc'));var crypto=require(_0xc890('0xd'));var jsforce=require(_0xc890('0xe'));var deskjs=require(_0xc890('0xf'));var toCsv=require(_0xc890('0x8'));var querystring=require('querystring');var Papa=require(_0xc890('0x10'));var Redis=require(_0xc890('0x11'));var authService=require(_0xc890('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc890('0x13'));var hardwareService=require(_0xc890('0x14'));var logger=require(_0xc890('0x15'))(_0xc890('0x16'));var utils=require('../../config/utils');var config=require(_0xc890('0x17'));var licenseUtil=require(_0xc890('0x18'));var db=require(_0xc890('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x36cdb7,_0x19e464){_0x19e464=_0x19e464||0xcc;return function(_0x4e8bf6){if(_0x4e8bf6){return _0x36cdb7[_0xc890('0x1a')](_0x19e464);}return _0x36cdb7[_0xc890('0x1b')](_0x19e464)['end']();};}function respondWithResult(_0x5b2703,_0x212ac5){_0x212ac5=_0x212ac5||0xc8;return function(_0x29cd6b){if(_0x29cd6b){return _0x5b2703[_0xc890('0x1b')](_0x212ac5)['json'](_0x29cd6b);}};}function respondWithFilteredResult(_0x44cd63,_0x565e68){return function(_0x4c18b9){if(_0x4c18b9){var _0x11f289=typeof _0x565e68[_0xc890('0x1c')]===_0xc890('0x1d')&&typeof _0x565e68[_0xc890('0x1e')]===_0xc890('0x1d');var _0xf3e4b8=_0x4c18b9[_0xc890('0x1f')];var _0x2dc2f7=_0x11f289?0x0:_0x565e68['offset'];var _0x42527a=_0x11f289?_0x4c18b9[_0xc890('0x1f')]:_0x565e68[_0xc890('0x1c')]+_0x565e68['limit'];var _0x2f0bea;if(_0x42527a>=_0xf3e4b8){_0x42527a=_0xf3e4b8;_0x2f0bea=0xc8;}else{_0x2f0bea=0xce;}_0x44cd63['status'](_0x2f0bea);return _0x44cd63['set'](_0xc890('0x20'),_0x2dc2f7+'-'+_0x42527a+'/'+_0xf3e4b8)['json'](_0x4c18b9);}return null;};}function patchUpdates(_0x3a9f16){return function(_0x206647){try{jsonpatch[_0xc890('0x21')](_0x206647,_0x3a9f16,!![]);}catch(_0x318a44){return BPromise['reject'](_0x318a44);}return _0x206647[_0xc890('0x22')]();};}function saveUpdates(_0x5948c0,_0x372bdf){return function(_0x4f66e6){if(_0x4f66e6){return _0x4f66e6[_0xc890('0x23')](_0x5948c0)['then'](function(_0x37b5de){return _0x37b5de;});}return null;};}function removeEntity(_0x4b4bf4,_0x47f9fb){return function(_0x420b63){if(_0x420b63){return _0x420b63[_0xc890('0x24')]()[_0xc890('0x25')](function(){_0x4b4bf4[_0xc890('0x1b')](0xcc)[_0xc890('0x26')]();});}};}function handleEntityNotFound(_0x1529e2,_0xf094b){return function(_0x31fbb9){if(!_0x31fbb9){_0x1529e2[_0xc890('0x1a')](0x194);}return _0x31fbb9;};}function handleError(_0x1a752b,_0x4dd7dd){_0x4dd7dd=_0x4dd7dd||0x1f4;return function(_0x3f5dc4){logger['error'](_0x3f5dc4[_0xc890('0x27')]);if(_0x3f5dc4[_0xc890('0x28')]){delete _0x3f5dc4[_0xc890('0x28')];}_0x1a752b['status'](_0x4dd7dd)['send'](_0x3f5dc4);};}exports[_0xc890('0x29')]=function(_0x1fa582,_0x4a4649){var _0x233030={},_0x62f849={},_0x9f0c39={'count':0x0,'rows':[]};var _0x25ba95=_[_0xc890('0x2a')](db[_0xc890('0x2b')]['rawAttributes'],function(_0xbd747b){return{'name':_0xbd747b['fieldName'],'type':_0xbd747b[_0xc890('0x2c')][_0xc890('0x2d')]};});_0x62f849[_0xc890('0x2e')]=_[_0xc890('0x2a')](_0x25ba95,_0xc890('0x28'));_0x62f849[_0xc890('0x2f')]=_[_0xc890('0x30')](_0x1fa582[_0xc890('0x2f')]);_0x62f849['filters']=_[_0xc890('0x31')](_0x62f849[_0xc890('0x2e')],_0x62f849[_0xc890('0x2f')]);_0x233030['attributes']=_[_0xc890('0x31')](_0x62f849['model'],qs[_0xc890('0x32')](_0x1fa582['query'][_0xc890('0x32')]));_0x233030[_0xc890('0x33')]=_0x233030[_0xc890('0x33')]['length']?_0x233030[_0xc890('0x33')]:_0x62f849[_0xc890('0x2e')];if(!_0x1fa582[_0xc890('0x2f')][_0xc890('0x34')](_0xc890('0x35'))){_0x233030[_0xc890('0x1e')]=qs[_0xc890('0x1e')](_0x1fa582[_0xc890('0x2f')]['limit']);_0x233030[_0xc890('0x1c')]=qs['offset'](_0x1fa582[_0xc890('0x2f')][_0xc890('0x1c')]);}_0x233030[_0xc890('0x36')]=qs['sort'](_0x1fa582[_0xc890('0x2f')]['sort']);_0x233030[_0xc890('0x37')]=qs[_0xc890('0x38')](_[_0xc890('0x39')](_0x1fa582['query'],_0x62f849[_0xc890('0x38')]),_0x25ba95);if(_0x1fa582[_0xc890('0x2f')][_0xc890('0x3a')]){_0x233030['where']=_[_0xc890('0x3b')](_0x233030[_0xc890('0x37')],{'$or':_[_0xc890('0x2a')](_0x25ba95,function(_0x6f755){if(_0x6f755[_0xc890('0x2c')]!==_0xc890('0x3c')){var _0x5dc54d={};_0x5dc54d[_0x6f755[_0xc890('0x28')]]={'$like':'%'+_0x1fa582[_0xc890('0x2f')][_0xc890('0x3a')]+'%'};return _0x5dc54d;}})});}_0x233030=_['merge']({},_0x233030,_0x1fa582[_0xc890('0x3d')]);var _0x242a63={'where':_0x233030['where']};return db[_0xc890('0x2b')][_0xc890('0x1f')](_0x242a63)[_0xc890('0x25')](function(_0x48db73){_0x9f0c39[_0xc890('0x1f')]=_0x48db73;if(_0x1fa582[_0xc890('0x2f')][_0xc890('0x3e')]){_0x233030[_0xc890('0x3f')]=[{'all':!![]}];}return db[_0xc890('0x2b')][_0xc890('0x40')](_0x233030);})['then'](function(_0x490272){_0x9f0c39[_0xc890('0x41')]=_0x490272;return _0x9f0c39;})[_0xc890('0x25')](respondWithFilteredResult(_0x4a4649,_0x233030))['catch'](handleError(_0x4a4649,null));};exports[_0xc890('0x42')]=function(_0xa630f,_0x16e6a1){var _0x5b4229={'raw':![],'where':{'id':_0xa630f[_0xc890('0x43')]['id']}},_0x17c7a6={};_0x17c7a6[_0xc890('0x2e')]=_[_0xc890('0x30')](db[_0xc890('0x2b')][_0xc890('0x44')]);_0x17c7a6[_0xc890('0x2f')]=_[_0xc890('0x30')](_0xa630f['query']);_0x17c7a6[_0xc890('0x38')]=_[_0xc890('0x31')](_0x17c7a6[_0xc890('0x2e')],_0x17c7a6[_0xc890('0x2f')]);_0x5b4229[_0xc890('0x33')]=_[_0xc890('0x31')](_0x17c7a6[_0xc890('0x2e')],qs[_0xc890('0x32')](_0xa630f[_0xc890('0x2f')]['fields']));_0x5b4229[_0xc890('0x33')]=_0x5b4229[_0xc890('0x33')][_0xc890('0x45')]?_0x5b4229[_0xc890('0x33')]:_0x17c7a6[_0xc890('0x2e')];if(_0xa630f[_0xc890('0x2f')]['includeAll']){_0x5b4229[_0xc890('0x3f')]=[{'all':!![]}];}_0x5b4229=_[_0xc890('0x3b')]({},_0x5b4229,_0xa630f[_0xc890('0x3d')]);return db['SugarcrmAccount']['find'](_0x5b4229)[_0xc890('0x25')](handleEntityNotFound(_0x16e6a1,null))[_0xc890('0x25')](respondWithResult(_0x16e6a1,null))[_0xc890('0x46')](handleError(_0x16e6a1,null));};exports[_0xc890('0x47')]=function(_0x1a2055,_0x2f7fbd){return db[_0xc890('0x2b')][_0xc890('0x47')](_0x1a2055['body'],{})[_0xc890('0x25')](respondWithResult(_0x2f7fbd,0xc9))[_0xc890('0x46')](handleError(_0x2f7fbd,null));};exports['update']=function(_0x576136,_0x4e0314){if(_0x576136[_0xc890('0x48')]['id']){delete _0x576136[_0xc890('0x48')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x576136['params']['id']}})[_0xc890('0x25')](handleEntityNotFound(_0x4e0314,null))['then'](saveUpdates(_0x576136[_0xc890('0x48')],null))[_0xc890('0x25')](respondWithResult(_0x4e0314,null))[_0xc890('0x46')](handleError(_0x4e0314,null));};exports['destroy']=function(_0x3eef6c,_0xec0939){return db['SugarcrmAccount']['find']({'where':{'id':_0x3eef6c[_0xc890('0x43')]['id']}})['then'](handleEntityNotFound(_0xec0939,null))['then'](removeEntity(_0xec0939,null))[_0xc890('0x46')](handleError(_0xec0939,null));};exports[_0xc890('0x49')]=function(_0x51d216,_0x4f2b52,_0x4e0bed){var _0x4773ca={};var _0x55de14={};var _0x499017;var _0x5c8126;return db[_0xc890('0x2b')]['findOne']({'where':{'id':_0x51d216[_0xc890('0x43')]['id']}})[_0xc890('0x25')](handleEntityNotFound(_0x4f2b52,null))[_0xc890('0x25')](function(_0x497f69){if(_0x497f69){_0x499017=_0x497f69;_0x55de14[_0xc890('0x2e')]=_[_0xc890('0x30')](db['SugarcrmConfiguration'][_0xc890('0x44')]);_0x55de14['query']=_[_0xc890('0x30')](_0x51d216[_0xc890('0x2f')]);_0x55de14[_0xc890('0x38')]=_[_0xc890('0x31')](_0x55de14[_0xc890('0x2e')],_0x55de14['query']);_0x4773ca['attributes']=_[_0xc890('0x31')](_0x55de14[_0xc890('0x2e')],qs[_0xc890('0x32')](_0x51d216[_0xc890('0x2f')][_0xc890('0x32')]));_0x4773ca[_0xc890('0x33')]=_0x4773ca[_0xc890('0x33')][_0xc890('0x45')]?_0x4773ca['attributes']:_0x55de14[_0xc890('0x2e')];_0x4773ca[_0xc890('0x36')]=qs[_0xc890('0x4a')](_0x51d216[_0xc890('0x2f')][_0xc890('0x4a')]);_0x4773ca[_0xc890('0x37')]=qs[_0xc890('0x38')](_['pick'](_0x51d216[_0xc890('0x2f')],_0x55de14[_0xc890('0x38')]));if(_0x51d216[_0xc890('0x2f')][_0xc890('0x3a')]){_0x4773ca[_0xc890('0x37')]=_['merge'](_0x4773ca[_0xc890('0x37')],{'$or':_['map'](_0x4773ca['attributes'],function(_0xf679d){var _0x3ff221={};_0x3ff221[_0xf679d]={'$like':'%'+_0x51d216[_0xc890('0x2f')][_0xc890('0x3a')]+'%'};return _0x3ff221;})});}_0x4773ca=_[_0xc890('0x3b')]({},_0x4773ca,_0x51d216[_0xc890('0x3d')]);return _0x499017[_0xc890('0x49')](_0x4773ca);}})[_0xc890('0x25')](function(_0x3d2ee4){if(_0x3d2ee4){_0x5c8126=_0x3d2ee4['length'];if(!_0x51d216[_0xc890('0x2f')][_0xc890('0x34')](_0xc890('0x35'))){_0x4773ca['limit']=qs[_0xc890('0x1e')](_0x51d216['query'][_0xc890('0x1e')]);_0x4773ca[_0xc890('0x1c')]=qs[_0xc890('0x1c')](_0x51d216[_0xc890('0x2f')]['offset']);}return _0x499017[_0xc890('0x49')](_0x4773ca);}})['then'](function(_0x3566cf){if(_0x3566cf){return _0x3566cf?{'count':_0x5c8126,'rows':_0x3566cf}:null;}})[_0xc890('0x25')](respondWithResult(_0x4f2b52,null))[_0xc890('0x46')](handleError(_0x4f2b52,null));};exports[_0xc890('0x4b')]=function(_0x448b72,_0x4ebf47,_0xba12e0){if(_0x448b72[_0xc890('0x48')]['id']){delete _0x448b72[_0xc890('0x48')]['id'];}return db[_0xc890('0x2b')]['findOne']({'where':{'id':_0x448b72['params']['id']}})[_0xc890('0x25')](handleEntityNotFound(_0x4ebf47,null))[_0xc890('0x25')](function(_0x536412){if(_0x536412){_0x448b72[_0xc890('0x48')]['AccountId']=_0x536412['id'];_0x448b72['body'][_0xc890('0x4c')]=integrations[_0xc890('0x4d')](_0x448b72['body'][_0xc890('0x4e')],_0x448b72[_0xc890('0x48')][_0xc890('0x2c')]);_0x448b72['body'][_0xc890('0x4f')]=integrations[_0xc890('0x50')](_0x448b72[_0xc890('0x48')][_0xc890('0x4e')],_0x448b72[_0xc890('0x48')]['type']);return db[_0xc890('0x51')][_0xc890('0x47')](_0x448b72[_0xc890('0x48')],{'include':[{'model':db[_0xc890('0x52')],'as':_0xc890('0x4c')},{'model':db[_0xc890('0x52')],'as':_0xc890('0x4f')}]});}return null;})['then'](respondWithResult(_0x4ebf47,null))['catch'](handleError(_0x4ebf47,null));};exports['getFields']=function(_0x9a19c0,_0xe0b118,_0x5bed7c){var _0xb1789e='';var _0x3f1879=['id',_0xc890('0x28'),_0xc890('0x53'),_0xc890('0x54'),_0xc890('0x55'),_0xc890('0x56'),_0xc890('0x57'),'duration_minutes',_0xc890('0x58'),_0xc890('0x59'),_0xc890('0x5a'),_0xc890('0x5b')];return db[_0xc890('0x2b')]['findOne']({'where':{'id':_0x9a19c0[_0xc890('0x43')]['id']},'attributes':['id',_0xc890('0x5c'),_0xc890('0x5d'),'remoteUri']})[_0xc890('0x25')](handleEntityNotFound(_0xe0b118,null))[_0xc890('0x25')](function(_0x230117){if(_0x230117){_0xb1789e=_0x230117['remoteUri'];var _0x478551=_0xb1789e[_0xc890('0x5e')](-0x1);if(_0x478551==='/'){_0xb1789e=_0xb1789e[_0xc890('0x5f')](0x0,_0xb1789e[_0xc890('0x60')](_0x478551));}return rp({'method':_0xc890('0x61'),'uri':util[_0xc890('0x62')](_0xc890('0x63'),_0xb1789e,_0xc890('0x64')),'json':!![],'form':{'method':'login','input_type':_0xc890('0x65'),'response_type':_0xc890('0x65'),'rest_data':JSON[_0xc890('0x66')]({'user_auth':{'user_name':_0x230117[_0xc890('0x5c')],'password':_0x230117['password'],'encryption':_0xc890('0x67')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xc890('0x25')](function(_0x3eb45b){if(_0x3eb45b&&_0x3eb45b['name']!=='Invalid\x20Login'&&_0x3eb45b[_0xc890('0x28')]!=='Password\x20Expired'){return rp({'method':_0xc890('0x61'),'uri':util[_0xc890('0x62')](_0xc890('0x63'),_0xb1789e,_0xc890('0x64')),'json':!![],'form':{'method':_0xc890('0x68'),'input_type':_0xc890('0x65'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3eb45b['id'],'module_name':'Calls'})}})[_0xc890('0x25')](function(_0x17098e){if(_0x17098e){var _0x31ab68=_[_0xc890('0x69')](_0x17098e[_0xc890('0x6a')]);_['remove'](_0x31ab68,function(_0x5c94d5){return _0x3f1879[_0xc890('0x6b')](_0x5c94d5['name']);});return{'count':_0x31ab68[_0xc890('0x45')],'rows':_[_0xc890('0x2a')](_0x31ab68,function(_0x1e37d3){return{'id':_0x1e37d3[_0xc890('0x28')],'name':_0x1e37d3['label'],'custom':_['endsWith'](_0x1e37d3[_0xc890('0x28')],'_c')?!![]:![],'options':_0x1e37d3[_0xc890('0x3d')]?_[_0xc890('0x2a')](_[_0xc890('0x69')](_0x1e37d3[_0xc890('0x3d')]),function(_0x34c832){return{'name':_0x34c832['value'],'value':_0x34c832[_0xc890('0x28')]};}):[]};})};}})[_0xc890('0x25')](respondWithResult(_0xe0b118,null))['catch'](function(_0x77dbd2){var _0x3eb42c=_0x9a19c0['query'][_0xc890('0x6c')]?0x1f4:_0x77dbd2[_0xc890('0x6d')]||0x1f4;logger[_0xc890('0x6e')](_0xc890('0x6f'),_0xc890('0x70'),_0x3eb42c,JSON[_0xc890('0x66')](_0x77dbd2));delete _0x77dbd2[_0xc890('0x28')];if(_0x3eb42c===0x191){_0x3eb42c=0x190;}_0xe0b118[_0xc890('0x1b')](_0x3eb42c)[_0xc890('0x71')](_0x9a19c0[_0xc890('0x2f')][_0xc890('0x6c')]?{'message':_0xc890('0x72'),'statusCode':_0x77dbd2[_0xc890('0x6d')]}:_0x77dbd2);});}else{var _0x4cd065=0x1f4;_0xe0b118[_0xc890('0x1b')](_0x4cd065)[_0xc890('0x71')]({'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 534ffd1..0742388 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 _0x2032=['request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2032,0xd9));var _0x2203=function(_0x479aac,_0x58a635){_0x479aac=_0x479aac-0x0;var _0xb6e2f4=_0x2032[_0x479aac];return _0xb6e2f4;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));var integrations=require(_0x2203('0x8'));module[_0x2203('0x9')]=function(_0x13367a,_0x2e0f63){return _0x13367a[_0x2203('0xa')](_0x2203('0xb'),attributes,{'tableName':_0x2203('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b53=['int_sugarcrm_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x5b53,0x1b1));var _0x35b5=function(_0x584da8,_0x4944c4){_0x584da8=_0x584da8-0x0;var _0x4da924=_0x5b53[_0x584da8];return _0x4da924;};'use strict';var _=require(_0x35b5('0x0'));var util=require('util');var logger=require(_0x35b5('0x1'))(_0x35b5('0x2'));var moment=require('moment');var BPromise=require(_0x35b5('0x3'));var rp=require(_0x35b5('0x4'));var fs=require('fs');var path=require(_0x35b5('0x5'));var rimraf=require('rimraf');var config=require(_0x35b5('0x6'));var attributes=require(_0x35b5('0x7'));var integrations=require(_0x35b5('0x8'));module[_0x35b5('0x9')]=function(_0x31e1f6,_0x56ccd5){return _0x31e1f6['define'](_0x35b5('0xa'),attributes,{'tableName':_0x35b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 2673c0f..887ea71 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 _0x89b1=['where','limit','include','map','attributes','model','GetSugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SugarcrmAccount','findAll','raw','options'];(function(_0x42dbe5,_0x237f34){var _0x2b1607=function(_0x517405){while(--_0x517405){_0x42dbe5['push'](_0x42dbe5['shift']());}};_0x2b1607(++_0x237f34);}(_0x89b1,0x8d));var _0x189b=function(_0x565f9c,_0xb9050a){_0x565f9c=_0x565f9c-0x0;var _0x42d58b=_0x89b1[_0x565f9c];return _0x42d58b;};'use strict';var _=require(_0x189b('0x0'));var util=require(_0x189b('0x1'));var moment=require(_0x189b('0x2'));var BPromise=require('bluebird');var rs=require(_0x189b('0x3'));var fs=require('fs');var Redis=require(_0x189b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x189b('0x5'));var logger=require(_0x189b('0x6'))(_0x189b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x189b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1baeea,_0x5399b1,_0x55ca67){return new BPromise(function(_0x19a05d,_0x1a52e6){return client[_0x189b('0x9')](_0x1baeea,_0x55ca67)[_0x189b('0xa')](function(_0x24dd00){logger[_0x189b('0xb')](_0x189b('0xc'),_0x5399b1,_0x189b('0xd'));logger[_0x189b('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5399b1,_0x189b('0xd'),JSON[_0x189b('0xf')](_0x24dd00));if(_0x24dd00[_0x189b('0x10')]){if(_0x24dd00[_0x189b('0x10')][_0x189b('0x11')]===0x1f4){logger[_0x189b('0x10')](_0x189b('0xc'),_0x5399b1,_0x24dd00[_0x189b('0x10')]['message']);return _0x1a52e6(_0x24dd00[_0x189b('0x10')]['message']);}logger['error'](_0x189b('0xc'),_0x5399b1,_0x24dd00[_0x189b('0x10')][_0x189b('0x12')]);return _0x19a05d(_0x24dd00[_0x189b('0x10')][_0x189b('0x12')]);}else{logger[_0x189b('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x5399b1,_0x189b('0xd'));_0x19a05d(_0x24dd00['result'][_0x189b('0x12')]);}})[_0x189b('0x13')](function(_0x1f2b72){logger[_0x189b('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x5399b1,_0x1f2b72);_0x1a52e6(_0x1f2b72);});});}exports['GetSugarcrmAccount']=function(_0x36eb3d){var _0x465a60=this;return new Promise(function(_0x5073b5,_0x4ed871){return db[_0x189b('0x14')][_0x189b('0x15')]({'raw':_0x36eb3d['options']?_0x36eb3d['options'][_0x189b('0x16')]===undefined?!![]:![]:!![],'where':_0x36eb3d[_0x189b('0x17')]?_0x36eb3d[_0x189b('0x17')][_0x189b('0x18')]||null:null,'attributes':_0x36eb3d[_0x189b('0x17')]?_0x36eb3d['options']['attributes']||null:null,'limit':_0x36eb3d[_0x189b('0x17')]?_0x36eb3d[_0x189b('0x17')][_0x189b('0x19')]||null:null,'include':_0x36eb3d[_0x189b('0x17')]?_0x36eb3d[_0x189b('0x17')][_0x189b('0x1a')]?_[_0x189b('0x1b')](_0x36eb3d[_0x189b('0x17')][_0x189b('0x1a')],function(_0x51dde7){return{'model':db[_0x51dde7['model']],'as':_0x51dde7['as'],'attributes':_0x51dde7[_0x189b('0x1c')],'include':_0x51dde7[_0x189b('0x1a')]?_[_0x189b('0x1b')](_0x51dde7[_0x189b('0x1a')],function(_0x38173f){return{'model':db[_0x38173f[_0x189b('0x1d')]],'as':_0x38173f['as'],'attributes':_0x38173f['attributes'],'include':_0x38173f[_0x189b('0x1a')]?_[_0x189b('0x1b')](_0x38173f[_0x189b('0x1a')],function(_0x563cef){return{'model':db[_0x563cef[_0x189b('0x1d')]],'as':_0x563cef['as'],'attributes':_0x563cef[_0x189b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x189b('0xa')](function(_0xf4067b){logger[_0x189b('0xb')](_0x189b('0x1e'),_0x36eb3d);logger[_0x189b('0xe')](_0x189b('0x1e'),_0x36eb3d,JSON[_0x189b('0xf')](_0xf4067b));_0x5073b5(_0xf4067b);})[_0x189b('0x13')](function(_0x19a624){logger['error'](_0x189b('0x1e'),_0x19a624['message'],_0x36eb3d);_0x4ed871(_0x465a60[_0x189b('0x10')](0x1f4,_0x19a624['message']));});});};exports['ShowSugarcrmAccount']=function(_0xb7a62){var _0xb9ac00=this;return new Promise(function(_0x4dae7d,_0x103de1){return db['SugarcrmAccount'][_0x189b('0x1f')]({'raw':_0xb7a62[_0x189b('0x17')]?_0xb7a62['options'][_0x189b('0x16')]===undefined?!![]:![]:!![],'where':_0xb7a62['options']?_0xb7a62['options']['where']||null:null,'attributes':_0xb7a62[_0x189b('0x17')]?_0xb7a62['options'][_0x189b('0x1c')]||null:null,'include':_0xb7a62[_0x189b('0x17')]?_0xb7a62[_0x189b('0x17')][_0x189b('0x1a')]?_[_0x189b('0x1b')](_0xb7a62[_0x189b('0x17')][_0x189b('0x1a')],function(_0x39ea46){return{'model':db[_0x39ea46[_0x189b('0x1d')]],'as':_0x39ea46['as'],'attributes':_0x39ea46['attributes'],'include':_0x39ea46[_0x189b('0x1a')]?_[_0x189b('0x1b')](_0x39ea46[_0x189b('0x1a')],function(_0x59e953){return{'model':db[_0x59e953['model']],'as':_0x59e953['as'],'attributes':_0x59e953[_0x189b('0x1c')],'include':_0x59e953[_0x189b('0x1a')]?_[_0x189b('0x1b')](_0x59e953[_0x189b('0x1a')],function(_0x3884e2){return{'model':db[_0x3884e2[_0x189b('0x1d')]],'as':_0x3884e2['as'],'attributes':_0x3884e2[_0x189b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411393){logger[_0x189b('0xb')](_0x189b('0x20'),_0xb7a62);logger[_0x189b('0xe')](_0x189b('0x20'),_0xb7a62,JSON[_0x189b('0xf')](_0x411393));_0x4dae7d(_0x411393);})['catch'](function(_0x24833a){logger[_0x189b('0x10')](_0x189b('0x20'),_0x24833a[_0x189b('0x12')],_0xb7a62);_0x103de1(_0xb9ac00[_0x189b('0x10')](0x1f4,_0x24833a[_0x189b('0x12')]));});});}; \ No newline at end of file +var _0xa7f8=['result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map','model','stringify','ShowSugarcrmAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x17771c,_0x4e378b){var _0x104c46=function(_0x474692){while(--_0x474692){_0x17771c['push'](_0x17771c['shift']());}};_0x104c46(++_0x4e378b);}(_0xa7f8,0x1bf));var _0x8a7f=function(_0xcb785d,_0x29e22d){_0xcb785d=_0xcb785d-0x0;var _0x6e8faf=_0xa7f8[_0xcb785d];return _0x6e8faf;};'use strict';var _=require(_0x8a7f('0x0'));var util=require(_0x8a7f('0x1'));var moment=require(_0x8a7f('0x2'));var BPromise=require(_0x8a7f('0x3'));var rs=require(_0x8a7f('0x4'));var fs=require('fs');var Redis=require(_0x8a7f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a7f('0x6'));var logger=require(_0x8a7f('0x7'))(_0x8a7f('0x8'));var config=require(_0x8a7f('0x9'));var jayson=require(_0x8a7f('0xa'));var client=jayson[_0x8a7f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x112ce0,_0x533ddc,_0x27fda0){return new BPromise(function(_0x27f934,_0x4858b9){return client[_0x8a7f('0xc')](_0x112ce0,_0x27fda0)[_0x8a7f('0xd')](function(_0x50a5e6){logger[_0x8a7f('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x533ddc,_0x8a7f('0xf'));logger[_0x8a7f('0x10')](_0x8a7f('0x11'),_0x533ddc,_0x8a7f('0xf'),JSON['stringify'](_0x50a5e6));if(_0x50a5e6[_0x8a7f('0x12')]){if(_0x50a5e6[_0x8a7f('0x12')][_0x8a7f('0x13')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x533ddc,_0x50a5e6[_0x8a7f('0x12')][_0x8a7f('0x14')]);return _0x4858b9(_0x50a5e6[_0x8a7f('0x12')][_0x8a7f('0x14')]);}logger[_0x8a7f('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x533ddc,_0x50a5e6[_0x8a7f('0x12')][_0x8a7f('0x14')]);return _0x27f934(_0x50a5e6['error'][_0x8a7f('0x14')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x533ddc,_0x8a7f('0xf'));_0x27f934(_0x50a5e6[_0x8a7f('0x15')]['message']);}})[_0x8a7f('0x16')](function(_0x2e4c6c){logger[_0x8a7f('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x533ddc,_0x2e4c6c);_0x4858b9(_0x2e4c6c);});});}exports[_0x8a7f('0x17')]=function(_0x47a127){var _0xb0ce42=this;return new Promise(function(_0x238460,_0x54fa6e){return db[_0x8a7f('0x18')][_0x8a7f('0x19')]({'raw':_0x47a127[_0x8a7f('0x1a')]?_0x47a127['options']['raw']===undefined?!![]:![]:!![],'where':_0x47a127[_0x8a7f('0x1a')]?_0x47a127[_0x8a7f('0x1a')][_0x8a7f('0x1b')]||null:null,'attributes':_0x47a127[_0x8a7f('0x1a')]?_0x47a127[_0x8a7f('0x1a')][_0x8a7f('0x1c')]||null:null,'limit':_0x47a127[_0x8a7f('0x1a')]?_0x47a127['options']['limit']||null:null,'include':_0x47a127[_0x8a7f('0x1a')]?_0x47a127[_0x8a7f('0x1a')][_0x8a7f('0x1d')]?_[_0x8a7f('0x1e')](_0x47a127[_0x8a7f('0x1a')][_0x8a7f('0x1d')],function(_0x380acf){return{'model':db[_0x380acf[_0x8a7f('0x1f')]],'as':_0x380acf['as'],'attributes':_0x380acf[_0x8a7f('0x1c')],'include':_0x380acf[_0x8a7f('0x1d')]?_[_0x8a7f('0x1e')](_0x380acf[_0x8a7f('0x1d')],function(_0x1b0672){return{'model':db[_0x1b0672[_0x8a7f('0x1f')]],'as':_0x1b0672['as'],'attributes':_0x1b0672['attributes'],'include':_0x1b0672[_0x8a7f('0x1d')]?_[_0x8a7f('0x1e')](_0x1b0672[_0x8a7f('0x1d')],function(_0x305896){return{'model':db[_0x305896[_0x8a7f('0x1f')]],'as':_0x305896['as'],'attributes':_0x305896[_0x8a7f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8a7f('0xd')](function(_0x16a449){logger[_0x8a7f('0xe')](_0x8a7f('0x17'),_0x47a127);logger['debug'](_0x8a7f('0x17'),_0x47a127,JSON[_0x8a7f('0x20')](_0x16a449));_0x238460(_0x16a449);})['catch'](function(_0x37deff){logger[_0x8a7f('0x12')](_0x8a7f('0x17'),_0x37deff[_0x8a7f('0x14')],_0x47a127);_0x54fa6e(_0xb0ce42[_0x8a7f('0x12')](0x1f4,_0x37deff[_0x8a7f('0x14')]));});});};exports[_0x8a7f('0x21')]=function(_0x4d1ba4){var _0x2ad487=this;return new Promise(function(_0x41cdad,_0x40ca7d){return db[_0x8a7f('0x18')][_0x8a7f('0x22')]({'raw':_0x4d1ba4[_0x8a7f('0x1a')]?_0x4d1ba4[_0x8a7f('0x1a')][_0x8a7f('0x23')]===undefined?!![]:![]:!![],'where':_0x4d1ba4['options']?_0x4d1ba4[_0x8a7f('0x1a')]['where']||null:null,'attributes':_0x4d1ba4[_0x8a7f('0x1a')]?_0x4d1ba4['options'][_0x8a7f('0x1c')]||null:null,'include':_0x4d1ba4[_0x8a7f('0x1a')]?_0x4d1ba4[_0x8a7f('0x1a')][_0x8a7f('0x1d')]?_[_0x8a7f('0x1e')](_0x4d1ba4['options']['include'],function(_0x51a3fe){return{'model':db[_0x51a3fe[_0x8a7f('0x1f')]],'as':_0x51a3fe['as'],'attributes':_0x51a3fe['attributes'],'include':_0x51a3fe[_0x8a7f('0x1d')]?_[_0x8a7f('0x1e')](_0x51a3fe[_0x8a7f('0x1d')],function(_0x964643){return{'model':db[_0x964643['model']],'as':_0x964643['as'],'attributes':_0x964643[_0x8a7f('0x1c')],'include':_0x964643[_0x8a7f('0x1d')]?_[_0x8a7f('0x1e')](_0x964643['include'],function(_0x214819){return{'model':db[_0x214819[_0x8a7f('0x1f')]],'as':_0x214819['as'],'attributes':_0x214819[_0x8a7f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8a7f('0xd')](function(_0x5e9a1e){logger[_0x8a7f('0xe')]('ShowSugarcrmAccount',_0x4d1ba4);logger[_0x8a7f('0x10')](_0x8a7f('0x21'),_0x4d1ba4,JSON[_0x8a7f('0x20')](_0x5e9a1e));_0x41cdad(_0x5e9a1e);})[_0x8a7f('0x16')](function(_0x57b4b6){logger[_0x8a7f('0x12')]('ShowSugarcrmAccount',_0x57b4b6[_0x8a7f('0x14')],_0x4d1ba4);_0x40ca7d(_0x2ad487['error'](0x1f4,_0x57b4b6[_0x8a7f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 947c36d..bd65d1a 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 _0x8cc1=['fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2201ee,_0xf01c75){var _0x8f3a1=function(_0x119a32){while(--_0x119a32){_0x2201ee['push'](_0x2201ee['shift']());}};_0x8f3a1(++_0xf01c75);}(_0x8cc1,0x6e));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x18cc('0x0'));var util=require(_0x18cc('0x1'));var path=require(_0x18cc('0x2'));var timeout=require(_0x18cc('0x3'));var express=require(_0x18cc('0x4'));var router=express['Router']();var fs_extra=require(_0x18cc('0x5'));var auth=require(_0x18cc('0x6'));var interaction=require(_0x18cc('0x7'));var config=require('../../config/environment');var controller=require(_0x18cc('0x8'));router[_0x18cc('0x9')]('/',auth[_0x18cc('0xa')](),controller[_0x18cc('0xb')]);router[_0x18cc('0x9')](_0x18cc('0xc'),auth[_0x18cc('0xa')](),controller[_0x18cc('0xd')]);router[_0x18cc('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x18cc('0xe')]);router[_0x18cc('0x9')](_0x18cc('0xf'),auth[_0x18cc('0xa')](),controller[_0x18cc('0x10')]);router[_0x18cc('0x9')]('/:id/descriptions',auth[_0x18cc('0xa')](),controller[_0x18cc('0x11')]);router[_0x18cc('0x12')]('/',auth[_0x18cc('0xa')](),controller['create']);router[_0x18cc('0x13')]('/:id',auth[_0x18cc('0xa')](),controller[_0x18cc('0x14')]);router['delete'](_0x18cc('0xc'),auth[_0x18cc('0xa')](),controller[_0x18cc('0x15')]);module[_0x18cc('0x16')]=router; \ No newline at end of file +var _0x3a46=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports'];(function(_0x4615e3,_0x19f759){var _0x1d843d=function(_0x5391ea){while(--_0x5391ea){_0x4615e3['push'](_0x4615e3['shift']());}};_0x1d843d(++_0x19f759);}(_0x3a46,0xdc));var _0x63a4=function(_0xdf06e3,_0x5700aa){_0xdf06e3=_0xdf06e3-0x0;var _0x11abfc=_0x3a46[_0xdf06e3];return _0x11abfc;};'use strict';var multer=require(_0x63a4('0x0'));var util=require('util');var path=require(_0x63a4('0x1'));var timeout=require(_0x63a4('0x2'));var express=require(_0x63a4('0x3'));var router=express[_0x63a4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x63a4('0x5'));var config=require(_0x63a4('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x63a4('0x7')]('/',auth[_0x63a4('0x8')](),controller[_0x63a4('0x9')]);router[_0x63a4('0x7')](_0x63a4('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x63a4('0x7')](_0x63a4('0xb'),auth[_0x63a4('0x8')](),controller[_0x63a4('0xc')]);router[_0x63a4('0x7')](_0x63a4('0xd'),auth['isAuthenticated'](),controller[_0x63a4('0xe')]);router[_0x63a4('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x63a4('0xf')]);router[_0x63a4('0x10')]('/',auth[_0x63a4('0x8')](),controller['create']);router[_0x63a4('0x11')]('/:id',auth[_0x63a4('0x8')](),controller[_0x63a4('0x12')]);router[_0x63a4('0x13')](_0x63a4('0xa'),auth[_0x63a4('0x8')](),controller[_0x63a4('0x14')]);module[_0x63a4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index bf29144..d4a4c58 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 _0x8cda=['exports','STRING','sequelize'];(function(_0x2ff127,_0x3d6e2b){var _0x53af48=function(_0x4a0c47){while(--_0x4a0c47){_0x2ff127['push'](_0x2ff127['shift']());}};_0x53af48(++_0x3d6e2b);}(_0x8cda,0xb6));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa8cd('0x0'));module[_0xa8cd('0x1')]={'name':{'type':Sequelize[_0xa8cd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbcb9=['exports','STRING','sequelize'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xbcb9,0x113));var _0x9bcb=function(_0x57b2dd,_0x2e900b){_0x57b2dd=_0x57b2dd-0x0;var _0x44253c=_0xbcb9[_0x57b2dd];return _0x44253c;};'use strict';var Sequelize=require(_0x9bcb('0x0'));module[_0x9bcb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9bcb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c9b020d..344ca14 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 _0x88c8=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','SugarcrmConfiguration','findAll','rows','catch','params','options','find','create','body','destroy','getFields','findOne','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','ejs','fs-extra','jsforce','querystring'];(function(_0x4ea539,_0x16f1d6){var _0x554799=function(_0x37feda){while(--_0x37feda){_0x4ea539['push'](_0x4ea539['shift']());}};_0x554799(++_0x16f1d6);}(_0x88c8,0xd7));var _0x888c=function(_0x110e10,_0x22789c){_0x110e10=_0x110e10-0x0;var _0x1d76f1=_0x88c8[_0x110e10];return _0x1d76f1;};'use strict';var emlformat=require(_0x888c('0x0'));var rimraf=require(_0x888c('0x1'));var zipdir=require(_0x888c('0x2'));var jsonpatch=require(_0x888c('0x3'));var rp=require('request-promise');var moment=require(_0x888c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x888c('0x5'));var ejs=require(_0x888c('0x6'));var fs=require('fs');var fs_extra=require(_0x888c('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x888c('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x888c('0x9'));var Papa=require(_0x888c('0xa'));var Redis=require(_0x888c('0xb'));var authService=require(_0x888c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x888c('0xd'));var hardwareService=require(_0x888c('0xe'));var logger=require(_0x888c('0xf'))(_0x888c('0x10'));var utils=require('../../config/utils');var config=require(_0x888c('0x11'));var licenseUtil=require(_0x888c('0x12'));var db=require(_0x888c('0x13'))['db'];function respondWithStatusCode(_0x3b1b39,_0xac0fae){_0xac0fae=_0xac0fae||0xcc;return function(_0x1d0e84){if(_0x1d0e84){return _0x3b1b39['sendStatus'](_0xac0fae);}return _0x3b1b39[_0x888c('0x14')](_0xac0fae)[_0x888c('0x15')]();};}function respondWithResult(_0x2fd4fb,_0x24714c){_0x24714c=_0x24714c||0xc8;return function(_0x2b7a3f){if(_0x2b7a3f){return _0x2fd4fb[_0x888c('0x14')](_0x24714c)[_0x888c('0x16')](_0x2b7a3f);}};}function respondWithFilteredResult(_0xf7b6a1,_0x390a41){return function(_0x4f0912){if(_0x4f0912){var _0x36d4de=typeof _0x390a41[_0x888c('0x17')]===_0x888c('0x18')&&typeof _0x390a41[_0x888c('0x19')]===_0x888c('0x18');var _0x417852=_0x4f0912[_0x888c('0x1a')];var _0x1a4907=_0x36d4de?0x0:_0x390a41[_0x888c('0x17')];var _0x2d2bbe=_0x36d4de?_0x4f0912[_0x888c('0x1a')]:_0x390a41['offset']+_0x390a41[_0x888c('0x19')];var _0xd2e277;if(_0x2d2bbe>=_0x417852){_0x2d2bbe=_0x417852;_0xd2e277=0xc8;}else{_0xd2e277=0xce;}_0xf7b6a1[_0x888c('0x14')](_0xd2e277);return _0xf7b6a1['set'](_0x888c('0x1b'),_0x1a4907+'-'+_0x2d2bbe+'/'+_0x417852)[_0x888c('0x16')](_0x4f0912);}return null;};}function patchUpdates(_0x9bd892){return function(_0x51180c){try{jsonpatch['apply'](_0x51180c,_0x9bd892,!![]);}catch(_0x382f56){return BPromise[_0x888c('0x1c')](_0x382f56);}return _0x51180c['save']();};}function saveUpdates(_0x1d82f4,_0x3b4faf){return function(_0x4e4157){if(_0x4e4157){return _0x4e4157[_0x888c('0x1d')](_0x1d82f4)[_0x888c('0x1e')](function(_0x4ac593){return _0x4ac593;});}return null;};}function removeEntity(_0x34bba5,_0x557f44){return function(_0x3eb831){if(_0x3eb831){return _0x3eb831['destroy']()['then'](function(){_0x34bba5[_0x888c('0x14')](0xcc)[_0x888c('0x15')]();});}};}function handleEntityNotFound(_0x2a4f30,_0x3aadd2){return function(_0x60d42d){if(!_0x60d42d){_0x2a4f30['sendStatus'](0x194);}return _0x60d42d;};}function handleError(_0x266a58,_0x5c014f){_0x5c014f=_0x5c014f||0x1f4;return function(_0x5b1ede){logger[_0x888c('0x1f')](_0x5b1ede[_0x888c('0x20')]);if(_0x5b1ede[_0x888c('0x21')]){delete _0x5b1ede['name'];}_0x266a58['status'](_0x5c014f)[_0x888c('0x22')](_0x5b1ede);};}exports[_0x888c('0x23')]=function(_0x44fdd8,_0x2b28a5){var _0x248424={},_0x482cb8={},_0x511a36={'count':0x0,'rows':[]};var _0x110b9b=_[_0x888c('0x24')](db['SugarcrmConfiguration'][_0x888c('0x25')],function(_0x5f43d3){return{'name':_0x5f43d3[_0x888c('0x26')],'type':_0x5f43d3['type'][_0x888c('0x27')]};});_0x482cb8[_0x888c('0x28')]=_[_0x888c('0x24')](_0x110b9b,_0x888c('0x21'));_0x482cb8[_0x888c('0x29')]=_[_0x888c('0x2a')](_0x44fdd8['query']);_0x482cb8[_0x888c('0x2b')]=_[_0x888c('0x2c')](_0x482cb8[_0x888c('0x28')],_0x482cb8['query']);_0x248424[_0x888c('0x2d')]=_['intersection'](_0x482cb8[_0x888c('0x28')],qs[_0x888c('0x2e')](_0x44fdd8['query'][_0x888c('0x2e')]));_0x248424['attributes']=_0x248424[_0x888c('0x2d')][_0x888c('0x2f')]?_0x248424[_0x888c('0x2d')]:_0x482cb8[_0x888c('0x28')];if(!_0x44fdd8[_0x888c('0x29')][_0x888c('0x30')](_0x888c('0x31'))){_0x248424[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x44fdd8[_0x888c('0x29')][_0x888c('0x19')]);_0x248424[_0x888c('0x17')]=qs[_0x888c('0x17')](_0x44fdd8[_0x888c('0x29')][_0x888c('0x17')]);}_0x248424[_0x888c('0x32')]=qs[_0x888c('0x33')](_0x44fdd8[_0x888c('0x29')]['sort']);_0x248424[_0x888c('0x34')]=qs[_0x888c('0x2b')](_[_0x888c('0x35')](_0x44fdd8[_0x888c('0x29')],_0x482cb8[_0x888c('0x2b')]),_0x110b9b);if(_0x44fdd8['query'][_0x888c('0x36')]){_0x248424['where']=_['merge'](_0x248424[_0x888c('0x34')],{'$or':_[_0x888c('0x24')](_0x110b9b,function(_0x60b0a8){if(_0x60b0a8[_0x888c('0x37')]!==_0x888c('0x38')){var _0x11e8eb={};_0x11e8eb[_0x60b0a8[_0x888c('0x21')]]={'$like':'%'+_0x44fdd8[_0x888c('0x29')][_0x888c('0x36')]+'%'};return _0x11e8eb;}})});}_0x248424=_[_0x888c('0x39')]({},_0x248424,_0x44fdd8['options']);var _0x26b65d={'where':_0x248424['where']};return db['SugarcrmConfiguration'][_0x888c('0x1a')](_0x26b65d)[_0x888c('0x1e')](function(_0x59bb3f){_0x511a36[_0x888c('0x1a')]=_0x59bb3f;if(_0x44fdd8[_0x888c('0x29')][_0x888c('0x3a')]){_0x248424[_0x888c('0x3b')]=[{'all':!![]}];}return db[_0x888c('0x3c')][_0x888c('0x3d')](_0x248424);})[_0x888c('0x1e')](function(_0x3c5789){_0x511a36[_0x888c('0x3e')]=_0x3c5789;return _0x511a36;})['then'](respondWithFilteredResult(_0x2b28a5,_0x248424))[_0x888c('0x3f')](handleError(_0x2b28a5,null));};exports['show']=function(_0x4465ff,_0x35adb1){var _0x5da0a7={'raw':![],'where':{'id':_0x4465ff[_0x888c('0x40')]['id']}},_0x19828d={};_0x19828d[_0x888c('0x28')]=_['keys'](db[_0x888c('0x3c')][_0x888c('0x25')]);_0x19828d[_0x888c('0x29')]=_['keys'](_0x4465ff[_0x888c('0x29')]);_0x19828d[_0x888c('0x2b')]=_[_0x888c('0x2c')](_0x19828d['model'],_0x19828d[_0x888c('0x29')]);_0x5da0a7[_0x888c('0x2d')]=_['intersection'](_0x19828d[_0x888c('0x28')],qs[_0x888c('0x2e')](_0x4465ff[_0x888c('0x29')][_0x888c('0x2e')]));_0x5da0a7[_0x888c('0x2d')]=_0x5da0a7[_0x888c('0x2d')][_0x888c('0x2f')]?_0x5da0a7[_0x888c('0x2d')]:_0x19828d[_0x888c('0x28')];if(_0x4465ff[_0x888c('0x29')][_0x888c('0x3a')]){_0x5da0a7[_0x888c('0x3b')]=[{'all':!![]}];}_0x5da0a7=_[_0x888c('0x39')]({},_0x5da0a7,_0x4465ff[_0x888c('0x41')]);return db['SugarcrmConfiguration'][_0x888c('0x42')](_0x5da0a7)[_0x888c('0x1e')](handleEntityNotFound(_0x35adb1,null))[_0x888c('0x1e')](respondWithResult(_0x35adb1,null))[_0x888c('0x3f')](handleError(_0x35adb1,null));};exports[_0x888c('0x43')]=function(_0x270d1b,_0x1dba5a){return db['SugarcrmConfiguration']['create'](_0x270d1b[_0x888c('0x44')],{})[_0x888c('0x1e')](respondWithResult(_0x1dba5a,0xc9))[_0x888c('0x3f')](handleError(_0x1dba5a,null));};exports[_0x888c('0x1d')]=function(_0x34cb36,_0x37c75c){if(_0x34cb36[_0x888c('0x44')]['id']){delete _0x34cb36[_0x888c('0x44')]['id'];}return db[_0x888c('0x3c')][_0x888c('0x42')]({'where':{'id':_0x34cb36[_0x888c('0x40')]['id']}})[_0x888c('0x1e')](handleEntityNotFound(_0x37c75c,null))[_0x888c('0x1e')](saveUpdates(_0x34cb36[_0x888c('0x44')],null))[_0x888c('0x1e')](respondWithResult(_0x37c75c,null))[_0x888c('0x3f')](handleError(_0x37c75c,null));};exports[_0x888c('0x45')]=function(_0x9937b1,_0x38d30c){return db[_0x888c('0x3c')][_0x888c('0x42')]({'where':{'id':_0x9937b1[_0x888c('0x40')]['id']}})['then'](handleEntityNotFound(_0x38d30c,null))[_0x888c('0x1e')](removeEntity(_0x38d30c,null))['catch'](handleError(_0x38d30c,null));};exports[_0x888c('0x46')]=function(_0x1de204,_0x5c127b,_0x500c8a){var _0xd7b641={};var _0x2db32f={};var _0xe9b24a;var _0x40ca9c;return db[_0x888c('0x3c')][_0x888c('0x47')]({'where':{'id':_0x1de204['params']['id']}})['then'](handleEntityNotFound(_0x5c127b,null))[_0x888c('0x1e')](function(_0xca376a){if(_0xca376a){_0xe9b24a=_0xca376a;_0x2db32f[_0x888c('0x28')]=_[_0x888c('0x2a')](db['SugarcrmField'][_0x888c('0x25')]);_0x2db32f['query']=_[_0x888c('0x2a')](_0x1de204['query']);_0x2db32f[_0x888c('0x2b')]=_[_0x888c('0x2c')](_0x2db32f[_0x888c('0x28')],_0x2db32f['query']);_0xd7b641[_0x888c('0x2d')]=_[_0x888c('0x2c')](_0x2db32f[_0x888c('0x28')],qs[_0x888c('0x2e')](_0x1de204[_0x888c('0x29')][_0x888c('0x2e')]));_0xd7b641[_0x888c('0x2d')]=_0xd7b641[_0x888c('0x2d')]['length']?_0xd7b641['attributes']:_0x2db32f[_0x888c('0x28')];_0xd7b641[_0x888c('0x32')]=qs[_0x888c('0x33')](_0x1de204[_0x888c('0x29')][_0x888c('0x33')]);_0xd7b641[_0x888c('0x34')]=qs[_0x888c('0x2b')](_[_0x888c('0x35')](_0x1de204[_0x888c('0x29')],_0x2db32f['filters']));if(_0x1de204[_0x888c('0x29')]['filter']){_0xd7b641[_0x888c('0x34')]=_['merge'](_0xd7b641[_0x888c('0x34')],{'$or':_[_0x888c('0x24')](_0xd7b641[_0x888c('0x2d')],function(_0x57a786){var _0x44d38c={};_0x44d38c[_0x57a786]={'$like':'%'+_0x1de204['query'][_0x888c('0x36')]+'%'};return _0x44d38c;})});}_0xd7b641=_[_0x888c('0x39')]({},_0xd7b641,_0x1de204[_0x888c('0x41')]);return _0xe9b24a['getFields'](_0xd7b641);}})[_0x888c('0x1e')](function(_0x5927f1){if(_0x5927f1){_0x40ca9c=_0x5927f1['length'];if(!_0x1de204[_0x888c('0x29')][_0x888c('0x30')](_0x888c('0x31'))){_0xd7b641[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x1de204[_0x888c('0x29')]['limit']);_0xd7b641[_0x888c('0x17')]=qs[_0x888c('0x17')](_0x1de204[_0x888c('0x29')][_0x888c('0x17')]);}return _0xe9b24a[_0x888c('0x46')](_0xd7b641);}})['then'](function(_0x2159f9){if(_0x2159f9){return _0x2159f9?{'count':_0x40ca9c,'rows':_0x2159f9}:null;}})[_0x888c('0x1e')](respondWithResult(_0x5c127b,null))['catch'](handleError(_0x5c127b,null));};exports[_0x888c('0x48')]=function(_0x17e2a5,_0x171209,_0x11b7e7){var _0x13c9df={};var _0x554f3c={};var _0x196549;var _0x4fc52e;return db[_0x888c('0x3c')][_0x888c('0x47')]({'where':{'id':_0x17e2a5[_0x888c('0x40')]['id']}})[_0x888c('0x1e')](handleEntityNotFound(_0x171209,null))[_0x888c('0x1e')](function(_0x5cc332){if(_0x5cc332){_0x196549=_0x5cc332;_0x554f3c[_0x888c('0x28')]=_['keys'](db[_0x888c('0x49')][_0x888c('0x25')]);_0x554f3c['query']=_['keys'](_0x17e2a5[_0x888c('0x29')]);_0x554f3c[_0x888c('0x2b')]=_[_0x888c('0x2c')](_0x554f3c[_0x888c('0x28')],_0x554f3c[_0x888c('0x29')]);_0x13c9df['attributes']=_[_0x888c('0x2c')](_0x554f3c[_0x888c('0x28')],qs['fields'](_0x17e2a5['query'][_0x888c('0x2e')]));_0x13c9df['attributes']=_0x13c9df[_0x888c('0x2d')]['length']?_0x13c9df[_0x888c('0x2d')]:_0x554f3c[_0x888c('0x28')];_0x13c9df[_0x888c('0x32')]=qs[_0x888c('0x33')](_0x17e2a5[_0x888c('0x29')]['sort']);_0x13c9df[_0x888c('0x34')]=qs[_0x888c('0x2b')](_['pick'](_0x17e2a5[_0x888c('0x29')],_0x554f3c[_0x888c('0x2b')]));if(_0x17e2a5[_0x888c('0x29')][_0x888c('0x36')]){_0x13c9df[_0x888c('0x34')]=_[_0x888c('0x39')](_0x13c9df['where'],{'$or':_[_0x888c('0x24')](_0x13c9df[_0x888c('0x2d')],function(_0x532493){var _0x39bafd={};_0x39bafd[_0x532493]={'$like':'%'+_0x17e2a5[_0x888c('0x29')][_0x888c('0x36')]+'%'};return _0x39bafd;})});}_0x13c9df=_[_0x888c('0x39')]({},_0x13c9df,_0x17e2a5[_0x888c('0x41')]);return _0x196549[_0x888c('0x48')](_0x13c9df);}})[_0x888c('0x1e')](function(_0x5a652f){if(_0x5a652f){_0x4fc52e=_0x5a652f[_0x888c('0x2f')];if(!_0x17e2a5['query']['hasOwnProperty'](_0x888c('0x31'))){_0x13c9df[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x17e2a5['query'][_0x888c('0x19')]);_0x13c9df['offset']=qs[_0x888c('0x17')](_0x17e2a5['query'][_0x888c('0x17')]);}return _0x196549['getSubjects'](_0x13c9df);}})[_0x888c('0x1e')](function(_0x281bf2){if(_0x281bf2){return _0x281bf2?{'count':_0x4fc52e,'rows':_0x281bf2}:null;}})[_0x888c('0x1e')](respondWithResult(_0x171209,null))[_0x888c('0x3f')](handleError(_0x171209,null));};exports['getDescriptions']=function(_0x51fcec,_0x1f9900,_0x5c1bce){var _0x570335={};var _0x85a4c8={};var _0x420664;var _0x485cf0;return db[_0x888c('0x3c')][_0x888c('0x47')]({'where':{'id':_0x51fcec[_0x888c('0x40')]['id']}})[_0x888c('0x1e')](handleEntityNotFound(_0x1f9900,null))[_0x888c('0x1e')](function(_0x1cf898){if(_0x1cf898){_0x420664=_0x1cf898;_0x85a4c8[_0x888c('0x28')]=_[_0x888c('0x2a')](db[_0x888c('0x49')][_0x888c('0x25')]);_0x85a4c8[_0x888c('0x29')]=_[_0x888c('0x2a')](_0x51fcec[_0x888c('0x29')]);_0x85a4c8['filters']=_[_0x888c('0x2c')](_0x85a4c8[_0x888c('0x28')],_0x85a4c8['query']);_0x570335[_0x888c('0x2d')]=_['intersection'](_0x85a4c8[_0x888c('0x28')],qs['fields'](_0x51fcec['query']['fields']));_0x570335[_0x888c('0x2d')]=_0x570335['attributes'][_0x888c('0x2f')]?_0x570335[_0x888c('0x2d')]:_0x85a4c8[_0x888c('0x28')];_0x570335['order']=qs['sort'](_0x51fcec[_0x888c('0x29')][_0x888c('0x33')]);_0x570335[_0x888c('0x34')]=qs[_0x888c('0x2b')](_[_0x888c('0x35')](_0x51fcec[_0x888c('0x29')],_0x85a4c8[_0x888c('0x2b')]));if(_0x51fcec[_0x888c('0x29')][_0x888c('0x36')]){_0x570335['where']=_['merge'](_0x570335[_0x888c('0x34')],{'$or':_[_0x888c('0x24')](_0x570335[_0x888c('0x2d')],function(_0x2e837f){var _0x355545={};_0x355545[_0x2e837f]={'$like':'%'+_0x51fcec[_0x888c('0x29')][_0x888c('0x36')]+'%'};return _0x355545;})});}_0x570335=_['merge']({},_0x570335,_0x51fcec[_0x888c('0x41')]);return _0x420664[_0x888c('0x4a')](_0x570335);}})['then'](function(_0x136478){if(_0x136478){_0x485cf0=_0x136478['length'];if(!_0x51fcec[_0x888c('0x29')]['hasOwnProperty'](_0x888c('0x31'))){_0x570335[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x51fcec['query']['limit']);_0x570335['offset']=qs[_0x888c('0x17')](_0x51fcec[_0x888c('0x29')][_0x888c('0x17')]);}return _0x420664[_0x888c('0x4a')](_0x570335);}})[_0x888c('0x1e')](function(_0x5b2295){if(_0x5b2295){return _0x5b2295?{'count':_0x485cf0,'rows':_0x5b2295}:null;}})['then'](respondWithResult(_0x1f9900,null))[_0x888c('0x3f')](handleError(_0x1f9900,null));}; \ No newline at end of file +var _0xd41f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','fields','include','create','body','find','SugarcrmField','order','getFields','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x20f7cd,_0x2e6910){var _0x4d8fd8=function(_0x4613b6){while(--_0x4613b6){_0x20f7cd['push'](_0x20f7cd['shift']());}};_0x4d8fd8(++_0x2e6910);}(_0xd41f,0x191));var _0xfd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfd41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd41('0x1'));var jsonpatch=require(_0xfd41('0x2'));var rp=require(_0xfd41('0x3'));var moment=require(_0xfd41('0x4'));var BPromise=require(_0xfd41('0x5'));var Mustache=require(_0xfd41('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfd41('0x7'));var ejs=require(_0xfd41('0x8'));var fs=require('fs');var fs_extra=require(_0xfd41('0x9'));var _=require('lodash');var squel=require(_0xfd41('0xa'));var crypto=require(_0xfd41('0xb'));var jsforce=require(_0xfd41('0xc'));var deskjs=require(_0xfd41('0xd'));var toCsv=require(_0xfd41('0x7'));var querystring=require(_0xfd41('0xe'));var Papa=require(_0xfd41('0xf'));var Redis=require(_0xfd41('0x10'));var authService=require(_0xfd41('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfd41('0x12'));var hardwareService=require(_0xfd41('0x13'));var logger=require(_0xfd41('0x14'))(_0xfd41('0x15'));var utils=require(_0xfd41('0x16'));var config=require(_0xfd41('0x17'));var licenseUtil=require(_0xfd41('0x18'));var db=require(_0xfd41('0x19'))['db'];function respondWithStatusCode(_0x196017,_0x38b149){_0x38b149=_0x38b149||0xcc;return function(_0x5f19cf){if(_0x5f19cf){return _0x196017[_0xfd41('0x1a')](_0x38b149);}return _0x196017['status'](_0x38b149)[_0xfd41('0x1b')]();};}function respondWithResult(_0x14c067,_0x5559c5){_0x5559c5=_0x5559c5||0xc8;return function(_0x43ccbb){if(_0x43ccbb){return _0x14c067['status'](_0x5559c5)[_0xfd41('0x1c')](_0x43ccbb);}};}function respondWithFilteredResult(_0x5ec533,_0x20c87d){return function(_0x1f7ea5){if(_0x1f7ea5){var _0xe43851=typeof _0x20c87d[_0xfd41('0x1d')]===_0xfd41('0x1e')&&typeof _0x20c87d[_0xfd41('0x1f')]==='undefined';var _0x2392f4=_0x1f7ea5[_0xfd41('0x20')];var _0x3653d3=_0xe43851?0x0:_0x20c87d[_0xfd41('0x1d')];var _0x2eaa7a=_0xe43851?_0x1f7ea5[_0xfd41('0x20')]:_0x20c87d[_0xfd41('0x1d')]+_0x20c87d[_0xfd41('0x1f')];var _0x57f43e;if(_0x2eaa7a>=_0x2392f4){_0x2eaa7a=_0x2392f4;_0x57f43e=0xc8;}else{_0x57f43e=0xce;}_0x5ec533[_0xfd41('0x21')](_0x57f43e);return _0x5ec533[_0xfd41('0x22')](_0xfd41('0x23'),_0x3653d3+'-'+_0x2eaa7a+'/'+_0x2392f4)[_0xfd41('0x1c')](_0x1f7ea5);}return null;};}function patchUpdates(_0x56d9f9){return function(_0x3aead7){try{jsonpatch[_0xfd41('0x24')](_0x3aead7,_0x56d9f9,!![]);}catch(_0x5ed3f2){return BPromise[_0xfd41('0x25')](_0x5ed3f2);}return _0x3aead7[_0xfd41('0x26')]();};}function saveUpdates(_0x1e18c8,_0x925694){return function(_0x293afd){if(_0x293afd){return _0x293afd[_0xfd41('0x27')](_0x1e18c8)[_0xfd41('0x28')](function(_0x1f2290){return _0x1f2290;});}return null;};}function removeEntity(_0x4d57de,_0x476908){return function(_0x4b8b7f){if(_0x4b8b7f){return _0x4b8b7f[_0xfd41('0x29')]()[_0xfd41('0x28')](function(){_0x4d57de['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f2708,_0xfc4c77){return function(_0x2ecd59){if(!_0x2ecd59){_0x1f2708[_0xfd41('0x1a')](0x194);}return _0x2ecd59;};}function handleError(_0x10ced1,_0x44ee66){_0x44ee66=_0x44ee66||0x1f4;return function(_0x3f5c7f){logger['error'](_0x3f5c7f[_0xfd41('0x2a')]);if(_0x3f5c7f[_0xfd41('0x2b')]){delete _0x3f5c7f[_0xfd41('0x2b')];}_0x10ced1[_0xfd41('0x21')](_0x44ee66)['send'](_0x3f5c7f);};}exports[_0xfd41('0x2c')]=function(_0x201890,_0x3247af){var _0x3baabf={},_0x18bfc4={},_0x44a29a={'count':0x0,'rows':[]};var _0x1b470a=_['map'](db[_0xfd41('0x2d')][_0xfd41('0x2e')],function(_0x59e103){return{'name':_0x59e103[_0xfd41('0x2f')],'type':_0x59e103[_0xfd41('0x30')][_0xfd41('0x31')]};});_0x18bfc4['model']=_[_0xfd41('0x32')](_0x1b470a,_0xfd41('0x2b'));_0x18bfc4[_0xfd41('0x33')]=_['keys'](_0x201890[_0xfd41('0x33')]);_0x18bfc4[_0xfd41('0x34')]=_[_0xfd41('0x35')](_0x18bfc4['model'],_0x18bfc4[_0xfd41('0x33')]);_0x3baabf[_0xfd41('0x36')]=_['intersection'](_0x18bfc4[_0xfd41('0x37')],qs['fields'](_0x201890['query']['fields']));_0x3baabf['attributes']=_0x3baabf['attributes'][_0xfd41('0x38')]?_0x3baabf[_0xfd41('0x36')]:_0x18bfc4[_0xfd41('0x37')];if(!_0x201890[_0xfd41('0x33')][_0xfd41('0x39')](_0xfd41('0x3a'))){_0x3baabf[_0xfd41('0x1f')]=qs[_0xfd41('0x1f')](_0x201890[_0xfd41('0x33')][_0xfd41('0x1f')]);_0x3baabf[_0xfd41('0x1d')]=qs['offset'](_0x201890[_0xfd41('0x33')][_0xfd41('0x1d')]);}_0x3baabf['order']=qs[_0xfd41('0x3b')](_0x201890[_0xfd41('0x33')]['sort']);_0x3baabf[_0xfd41('0x3c')]=qs[_0xfd41('0x34')](_[_0xfd41('0x3d')](_0x201890['query'],_0x18bfc4[_0xfd41('0x34')]),_0x1b470a);if(_0x201890[_0xfd41('0x33')][_0xfd41('0x3e')]){_0x3baabf['where']=_[_0xfd41('0x3f')](_0x3baabf[_0xfd41('0x3c')],{'$or':_[_0xfd41('0x32')](_0x1b470a,function(_0x567951){if(_0x567951[_0xfd41('0x30')]!==_0xfd41('0x40')){var _0xdd73ca={};_0xdd73ca[_0x567951[_0xfd41('0x2b')]]={'$like':'%'+_0x201890[_0xfd41('0x33')]['filter']+'%'};return _0xdd73ca;}})});}_0x3baabf=_['merge']({},_0x3baabf,_0x201890[_0xfd41('0x41')]);var _0x721dab={'where':_0x3baabf['where']};return db['SugarcrmConfiguration'][_0xfd41('0x20')](_0x721dab)['then'](function(_0x446dc9){_0x44a29a[_0xfd41('0x20')]=_0x446dc9;if(_0x201890[_0xfd41('0x33')][_0xfd41('0x42')]){_0x3baabf['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xfd41('0x43')](_0x3baabf);})['then'](function(_0x1736d4){_0x44a29a[_0xfd41('0x44')]=_0x1736d4;return _0x44a29a;})[_0xfd41('0x28')](respondWithFilteredResult(_0x3247af,_0x3baabf))[_0xfd41('0x45')](handleError(_0x3247af,null));};exports[_0xfd41('0x46')]=function(_0x5c5345,_0x56f24b){var _0x470636={'raw':![],'where':{'id':_0x5c5345[_0xfd41('0x47')]['id']}},_0x323dd4={};_0x323dd4[_0xfd41('0x37')]=_[_0xfd41('0x48')](db[_0xfd41('0x2d')][_0xfd41('0x2e')]);_0x323dd4[_0xfd41('0x33')]=_[_0xfd41('0x48')](_0x5c5345[_0xfd41('0x33')]);_0x323dd4[_0xfd41('0x34')]=_[_0xfd41('0x35')](_0x323dd4[_0xfd41('0x37')],_0x323dd4[_0xfd41('0x33')]);_0x470636[_0xfd41('0x36')]=_[_0xfd41('0x35')](_0x323dd4[_0xfd41('0x37')],qs[_0xfd41('0x49')](_0x5c5345[_0xfd41('0x33')]['fields']));_0x470636[_0xfd41('0x36')]=_0x470636[_0xfd41('0x36')][_0xfd41('0x38')]?_0x470636[_0xfd41('0x36')]:_0x323dd4[_0xfd41('0x37')];if(_0x5c5345[_0xfd41('0x33')][_0xfd41('0x42')]){_0x470636[_0xfd41('0x4a')]=[{'all':!![]}];}_0x470636=_[_0xfd41('0x3f')]({},_0x470636,_0x5c5345['options']);return db['SugarcrmConfiguration']['find'](_0x470636)[_0xfd41('0x28')](handleEntityNotFound(_0x56f24b,null))['then'](respondWithResult(_0x56f24b,null))['catch'](handleError(_0x56f24b,null));};exports[_0xfd41('0x4b')]=function(_0x49e658,_0x16f34e){return db[_0xfd41('0x2d')]['create'](_0x49e658['body'],{})[_0xfd41('0x28')](respondWithResult(_0x16f34e,0xc9))[_0xfd41('0x45')](handleError(_0x16f34e,null));};exports['update']=function(_0x3484df,_0x2cfd5b){if(_0x3484df['body']['id']){delete _0x3484df[_0xfd41('0x4c')]['id'];}return db[_0xfd41('0x2d')][_0xfd41('0x4d')]({'where':{'id':_0x3484df[_0xfd41('0x47')]['id']}})[_0xfd41('0x28')](handleEntityNotFound(_0x2cfd5b,null))[_0xfd41('0x28')](saveUpdates(_0x3484df[_0xfd41('0x4c')],null))[_0xfd41('0x28')](respondWithResult(_0x2cfd5b,null))[_0xfd41('0x45')](handleError(_0x2cfd5b,null));};exports[_0xfd41('0x29')]=function(_0x35c9ff,_0x2b685d){return db[_0xfd41('0x2d')][_0xfd41('0x4d')]({'where':{'id':_0x35c9ff[_0xfd41('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b685d,null))[_0xfd41('0x28')](removeEntity(_0x2b685d,null))['catch'](handleError(_0x2b685d,null));};exports['getFields']=function(_0x3fd315,_0x1a44f9,_0x28d968){var _0x175750={};var _0x292e16={};var _0x337937;var _0x40fba2;return db[_0xfd41('0x2d')]['findOne']({'where':{'id':_0x3fd315[_0xfd41('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a44f9,null))[_0xfd41('0x28')](function(_0x4c3f8d){if(_0x4c3f8d){_0x337937=_0x4c3f8d;_0x292e16[_0xfd41('0x37')]=_[_0xfd41('0x48')](db[_0xfd41('0x4e')]['rawAttributes']);_0x292e16[_0xfd41('0x33')]=_[_0xfd41('0x48')](_0x3fd315[_0xfd41('0x33')]);_0x292e16['filters']=_[_0xfd41('0x35')](_0x292e16[_0xfd41('0x37')],_0x292e16['query']);_0x175750[_0xfd41('0x36')]=_[_0xfd41('0x35')](_0x292e16[_0xfd41('0x37')],qs['fields'](_0x3fd315[_0xfd41('0x33')][_0xfd41('0x49')]));_0x175750[_0xfd41('0x36')]=_0x175750[_0xfd41('0x36')][_0xfd41('0x38')]?_0x175750['attributes']:_0x292e16[_0xfd41('0x37')];_0x175750[_0xfd41('0x4f')]=qs['sort'](_0x3fd315['query'][_0xfd41('0x3b')]);_0x175750[_0xfd41('0x3c')]=qs['filters'](_[_0xfd41('0x3d')](_0x3fd315[_0xfd41('0x33')],_0x292e16[_0xfd41('0x34')]));if(_0x3fd315[_0xfd41('0x33')][_0xfd41('0x3e')]){_0x175750[_0xfd41('0x3c')]=_[_0xfd41('0x3f')](_0x175750[_0xfd41('0x3c')],{'$or':_[_0xfd41('0x32')](_0x175750[_0xfd41('0x36')],function(_0x575102){var _0x2a6530={};_0x2a6530[_0x575102]={'$like':'%'+_0x3fd315[_0xfd41('0x33')][_0xfd41('0x3e')]+'%'};return _0x2a6530;})});}_0x175750=_[_0xfd41('0x3f')]({},_0x175750,_0x3fd315['options']);return _0x337937[_0xfd41('0x50')](_0x175750);}})[_0xfd41('0x28')](function(_0x8075fa){if(_0x8075fa){_0x40fba2=_0x8075fa[_0xfd41('0x38')];if(!_0x3fd315['query'][_0xfd41('0x39')](_0xfd41('0x3a'))){_0x175750[_0xfd41('0x1f')]=qs[_0xfd41('0x1f')](_0x3fd315['query']['limit']);_0x175750[_0xfd41('0x1d')]=qs[_0xfd41('0x1d')](_0x3fd315[_0xfd41('0x33')][_0xfd41('0x1d')]);}return _0x337937[_0xfd41('0x50')](_0x175750);}})[_0xfd41('0x28')](function(_0x5b5720){if(_0x5b5720){return _0x5b5720?{'count':_0x40fba2,'rows':_0x5b5720}:null;}})[_0xfd41('0x28')](respondWithResult(_0x1a44f9,null))[_0xfd41('0x45')](handleError(_0x1a44f9,null));};exports[_0xfd41('0x51')]=function(_0x570379,_0x4cb4b3,_0x21fe4a){var _0x55ec2c={};var _0x363771={};var _0xe6bc27;var _0x2880c4;return db[_0xfd41('0x2d')][_0xfd41('0x52')]({'where':{'id':_0x570379[_0xfd41('0x47')]['id']}})[_0xfd41('0x28')](handleEntityNotFound(_0x4cb4b3,null))[_0xfd41('0x28')](function(_0x344dfd){if(_0x344dfd){_0xe6bc27=_0x344dfd;_0x363771[_0xfd41('0x37')]=_['keys'](db[_0xfd41('0x4e')][_0xfd41('0x2e')]);_0x363771[_0xfd41('0x33')]=_[_0xfd41('0x48')](_0x570379[_0xfd41('0x33')]);_0x363771[_0xfd41('0x34')]=_[_0xfd41('0x35')](_0x363771[_0xfd41('0x37')],_0x363771[_0xfd41('0x33')]);_0x55ec2c[_0xfd41('0x36')]=_[_0xfd41('0x35')](_0x363771['model'],qs[_0xfd41('0x49')](_0x570379[_0xfd41('0x33')]['fields']));_0x55ec2c[_0xfd41('0x36')]=_0x55ec2c['attributes'][_0xfd41('0x38')]?_0x55ec2c[_0xfd41('0x36')]:_0x363771['model'];_0x55ec2c[_0xfd41('0x4f')]=qs[_0xfd41('0x3b')](_0x570379['query'][_0xfd41('0x3b')]);_0x55ec2c[_0xfd41('0x3c')]=qs[_0xfd41('0x34')](_[_0xfd41('0x3d')](_0x570379[_0xfd41('0x33')],_0x363771[_0xfd41('0x34')]));if(_0x570379[_0xfd41('0x33')][_0xfd41('0x3e')]){_0x55ec2c[_0xfd41('0x3c')]=_[_0xfd41('0x3f')](_0x55ec2c[_0xfd41('0x3c')],{'$or':_[_0xfd41('0x32')](_0x55ec2c[_0xfd41('0x36')],function(_0x552362){var _0x378946={};_0x378946[_0x552362]={'$like':'%'+_0x570379[_0xfd41('0x33')][_0xfd41('0x3e')]+'%'};return _0x378946;})});}_0x55ec2c=_[_0xfd41('0x3f')]({},_0x55ec2c,_0x570379[_0xfd41('0x41')]);return _0xe6bc27[_0xfd41('0x51')](_0x55ec2c);}})['then'](function(_0x2df575){if(_0x2df575){_0x2880c4=_0x2df575[_0xfd41('0x38')];if(!_0x570379['query'][_0xfd41('0x39')](_0xfd41('0x3a'))){_0x55ec2c[_0xfd41('0x1f')]=qs[_0xfd41('0x1f')](_0x570379[_0xfd41('0x33')][_0xfd41('0x1f')]);_0x55ec2c[_0xfd41('0x1d')]=qs[_0xfd41('0x1d')](_0x570379[_0xfd41('0x33')][_0xfd41('0x1d')]);}return _0xe6bc27['getSubjects'](_0x55ec2c);}})[_0xfd41('0x28')](function(_0x5c4ddd){if(_0x5c4ddd){return _0x5c4ddd?{'count':_0x2880c4,'rows':_0x5c4ddd}:null;}})[_0xfd41('0x28')](respondWithResult(_0x4cb4b3,null))[_0xfd41('0x45')](handleError(_0x4cb4b3,null));};exports[_0xfd41('0x53')]=function(_0x51da94,_0x326236,_0x3126d5){var _0x7a4dde={};var _0x4a9872={};var _0x2ca693;var _0x5c66ce;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x51da94['params']['id']}})['then'](handleEntityNotFound(_0x326236,null))[_0xfd41('0x28')](function(_0x3f67f6){if(_0x3f67f6){_0x2ca693=_0x3f67f6;_0x4a9872[_0xfd41('0x37')]=_[_0xfd41('0x48')](db[_0xfd41('0x4e')][_0xfd41('0x2e')]);_0x4a9872['query']=_[_0xfd41('0x48')](_0x51da94[_0xfd41('0x33')]);_0x4a9872[_0xfd41('0x34')]=_['intersection'](_0x4a9872['model'],_0x4a9872[_0xfd41('0x33')]);_0x7a4dde[_0xfd41('0x36')]=_[_0xfd41('0x35')](_0x4a9872[_0xfd41('0x37')],qs['fields'](_0x51da94['query'][_0xfd41('0x49')]));_0x7a4dde[_0xfd41('0x36')]=_0x7a4dde['attributes'][_0xfd41('0x38')]?_0x7a4dde[_0xfd41('0x36')]:_0x4a9872[_0xfd41('0x37')];_0x7a4dde[_0xfd41('0x4f')]=qs['sort'](_0x51da94[_0xfd41('0x33')][_0xfd41('0x3b')]);_0x7a4dde[_0xfd41('0x3c')]=qs[_0xfd41('0x34')](_[_0xfd41('0x3d')](_0x51da94[_0xfd41('0x33')],_0x4a9872[_0xfd41('0x34')]));if(_0x51da94[_0xfd41('0x33')][_0xfd41('0x3e')]){_0x7a4dde[_0xfd41('0x3c')]=_['merge'](_0x7a4dde[_0xfd41('0x3c')],{'$or':_['map'](_0x7a4dde[_0xfd41('0x36')],function(_0x49156a){var _0x109bdc={};_0x109bdc[_0x49156a]={'$like':'%'+_0x51da94[_0xfd41('0x33')][_0xfd41('0x3e')]+'%'};return _0x109bdc;})});}_0x7a4dde=_[_0xfd41('0x3f')]({},_0x7a4dde,_0x51da94['options']);return _0x2ca693[_0xfd41('0x53')](_0x7a4dde);}})['then'](function(_0x102dbe){if(_0x102dbe){_0x5c66ce=_0x102dbe[_0xfd41('0x38')];if(!_0x51da94[_0xfd41('0x33')][_0xfd41('0x39')](_0xfd41('0x3a'))){_0x7a4dde[_0xfd41('0x1f')]=qs['limit'](_0x51da94['query'][_0xfd41('0x1f')]);_0x7a4dde['offset']=qs['offset'](_0x51da94[_0xfd41('0x33')][_0xfd41('0x1d')]);}return _0x2ca693[_0xfd41('0x53')](_0x7a4dde);}})['then'](function(_0x471a02){if(_0x471a02){return _0x471a02?{'count':_0x5c66ce,'rows':_0x471a02}:null;}})[_0xfd41('0x28')](respondWithResult(_0x326236,null))[_0xfd41('0x45')](handleError(_0x326236,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 365b930..a63811a 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 _0x52b6=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x52b6,0x131));var _0x652b=function(_0x45ce66,_0x54bdb1){_0x45ce66=_0x45ce66-0x0;var _0x32c0be=_0x52b6[_0x45ce66];return _0x32c0be;};'use strict';var _=require(_0x652b('0x0'));var util=require('util');var logger=require(_0x652b('0x1'))('api');var moment=require(_0x652b('0x2'));var BPromise=require(_0x652b('0x3'));var rp=require(_0x652b('0x4'));var fs=require('fs');var path=require(_0x652b('0x5'));var rimraf=require(_0x652b('0x6'));var config=require(_0x652b('0x7'));var attributes=require(_0x652b('0x8'));module[_0x652b('0x9')]=function(_0x4e6e0e,_0x4c64be){return _0x4e6e0e[_0x652b('0xa')](_0x652b('0xb'),attributes,{'tableName':_0x652b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81cb=['./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','bluebird','rimraf'];(function(_0xa938f9,_0x1cf7b0){var _0x63382a=function(_0x5641a9){while(--_0x5641a9){_0xa938f9['push'](_0xa938f9['shift']());}};_0x63382a(++_0x1cf7b0);}(_0x81cb,0x83));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb81c('0x0'));var logger=require(_0xb81c('0x1'))(_0xb81c('0x2'));var moment=require('moment');var BPromise=require(_0xb81c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb81c('0x4'));var config=require('../../config/environment');var attributes=require(_0xb81c('0x5'));module['exports']=function(_0x54db1c,_0x27da33){return _0x54db1c['define'](_0xb81c('0x6'),attributes,{'tableName':_0xb81c('0x7'),'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 ead962c..27b09f8 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 _0xdffa=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x24c8ea,_0xa29a34){var _0x139c08=function(_0x12e609){while(--_0x12e609){_0x24c8ea['push'](_0x24c8ea['shift']());}};_0x139c08(++_0xa29a34);}(_0xdffa,0x151));var _0xadff=function(_0x4c3b8c,_0x574b60){_0x4c3b8c=_0x4c3b8c-0x0;var _0x458c13=_0xdffa[_0x4c3b8c];return _0x458c13;};'use strict';var _=require(_0xadff('0x0'));var util=require(_0xadff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xadff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadff('0x3'))['db'];var utils=require(_0xadff('0x4'));var logger=require(_0xadff('0x5'))(_0xadff('0x6'));var config=require(_0xadff('0x7'));var jayson=require(_0xadff('0x8'));var client=jayson[_0xadff('0x9')][_0xadff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26a2e6,_0x3e3caa,_0x3559d8){return new BPromise(function(_0x2fe8b7,_0x2bcc6b){return client[_0xadff('0xb')](_0x26a2e6,_0x3559d8)[_0xadff('0xc')](function(_0x291728){logger[_0xadff('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3e3caa,_0xadff('0xe'));logger['debug'](_0xadff('0xf'),_0x3e3caa,_0xadff('0xe'),JSON[_0xadff('0x10')](_0x291728));if(_0x291728[_0xadff('0x11')]){if(_0x291728['error']['code']===0x1f4){logger[_0xadff('0x11')](_0xadff('0x12'),_0x3e3caa,_0x291728['error'][_0xadff('0x13')]);return _0x2bcc6b(_0x291728[_0xadff('0x11')][_0xadff('0x13')]);}logger['error'](_0xadff('0x12'),_0x3e3caa,_0x291728[_0xadff('0x11')]['message']);return _0x2fe8b7(_0x291728[_0xadff('0x11')]['message']);}else{logger[_0xadff('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3e3caa,_0xadff('0xe'));_0x2fe8b7(_0x291728[_0xadff('0x14')][_0xadff('0x13')]);}})[_0xadff('0x15')](function(_0x2adbe8){logger[_0xadff('0x11')](_0xadff('0x12'),_0x3e3caa,_0x2adbe8);_0x2bcc6b(_0x2adbe8);});});} \ No newline at end of file +var _0x1194=['then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x34d55f,_0x46ec83){var _0x40af85=function(_0x5aaa69){while(--_0x5aaa69){_0x34d55f['push'](_0x34d55f['shift']());}};_0x40af85(++_0x46ec83);}(_0x1194,0x154));var _0x4119=function(_0x594867,_0x2ee5d3){_0x594867=_0x594867-0x0;var _0x9ac5b1=_0x1194[_0x594867];return _0x9ac5b1;};'use strict';var _=require(_0x4119('0x0'));var util=require(_0x4119('0x1'));var moment=require('moment');var BPromise=require(_0x4119('0x2'));var rs=require(_0x4119('0x3'));var fs=require('fs');var Redis=require(_0x4119('0x4'));var db=require(_0x4119('0x5'))['db'];var utils=require(_0x4119('0x6'));var logger=require(_0x4119('0x7'))('rpc');var config=require(_0x4119('0x8'));var jayson=require(_0x4119('0x9'));var client=jayson[_0x4119('0xa')][_0x4119('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e5329,_0x533b36,_0x232b9d){return new BPromise(function(_0x148049,_0x5c6a18){return client['request'](_0x3e5329,_0x232b9d)[_0x4119('0xc')](function(_0x551307){logger[_0x4119('0xd')](_0x4119('0xe'),_0x533b36,_0x4119('0xf'));logger[_0x4119('0x10')](_0x4119('0x11'),_0x533b36,_0x4119('0xf'),JSON[_0x4119('0x12')](_0x551307));if(_0x551307[_0x4119('0x13')]){if(_0x551307[_0x4119('0x13')]['code']===0x1f4){logger['error'](_0x4119('0xe'),_0x533b36,_0x551307[_0x4119('0x13')][_0x4119('0x14')]);return _0x5c6a18(_0x551307[_0x4119('0x13')][_0x4119('0x14')]);}logger['error'](_0x4119('0xe'),_0x533b36,_0x551307[_0x4119('0x13')][_0x4119('0x14')]);return _0x148049(_0x551307[_0x4119('0x13')]['message']);}else{logger[_0x4119('0xd')](_0x4119('0xe'),_0x533b36,_0x4119('0xf'));_0x148049(_0x551307[_0x4119('0x15')][_0x4119('0x14')]);}})['catch'](function(_0x5d498c){logger[_0x4119('0x13')](_0x4119('0xe'),_0x533b36,_0x5d498c);_0x5c6a18(_0x5d498c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 90b0a16..9d4ee07 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 _0xe6b7=['/:id','isAuthenticated','show','post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0xe6b7,0x1d2));var _0x7e6b=function(_0x426c38,_0x56b57a){_0x426c38=_0x426c38-0x0;var _0x2a38cd=_0xe6b7[_0x426c38];return _0x2a38cd;};'use strict';var multer=require(_0x7e6b('0x0'));var util=require(_0x7e6b('0x1'));var path=require(_0x7e6b('0x2'));var timeout=require(_0x7e6b('0x3'));var express=require(_0x7e6b('0x4'));var router=express[_0x7e6b('0x5')]();var fs_extra=require(_0x7e6b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7e6b('0x7'));var config=require(_0x7e6b('0x8'));var controller=require('./intSugarcrmField.controller');router[_0x7e6b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e6b('0x9')](_0x7e6b('0xa'),auth[_0x7e6b('0xb')](),controller[_0x7e6b('0xc')]);router[_0x7e6b('0xd')]('/',auth[_0x7e6b('0xb')](),controller['create']);router[_0x7e6b('0xe')](_0x7e6b('0xa'),auth[_0x7e6b('0xb')](),controller[_0x7e6b('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7e6b('0x10')]=router; \ No newline at end of file +var _0x0a6b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x556480,_0x764857){var _0x1f3c7a=function(_0x7a8506){while(--_0x7a8506){_0x556480['push'](_0x556480['shift']());}};_0x1f3c7a(++_0x764857);}(_0x0a6b,0x12f));var _0xb0a6=function(_0x126a6f,_0x5985d4){_0x126a6f=_0x126a6f-0x0;var _0x548b1b=_0x0a6b[_0x126a6f];return _0x548b1b;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require(_0xb0a6('0x1'));var path=require(_0xb0a6('0x2'));var timeout=require(_0xb0a6('0x3'));var express=require(_0xb0a6('0x4'));var router=express[_0xb0a6('0x5')]();var fs_extra=require(_0xb0a6('0x6'));var auth=require(_0xb0a6('0x7'));var interaction=require(_0xb0a6('0x8'));var config=require(_0xb0a6('0x9'));var controller=require(_0xb0a6('0xa'));router[_0xb0a6('0xb')]('/',auth['isAuthenticated'](),controller[_0xb0a6('0xc')]);router[_0xb0a6('0xb')](_0xb0a6('0xd'),auth[_0xb0a6('0xe')](),controller[_0xb0a6('0xf')]);router[_0xb0a6('0x10')]('/',auth[_0xb0a6('0xe')](),controller[_0xb0a6('0x11')]);router[_0xb0a6('0x12')](_0xb0a6('0xd'),auth[_0xb0a6('0xe')](),controller[_0xb0a6('0x13')]);router[_0xb0a6('0x14')](_0xb0a6('0xd'),auth['isAuthenticated'](),controller[_0xb0a6('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 56178bd..cd666ec 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 _0x07ce=['STRING','exports','ENUM','string','customVariable','keyValue','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x07ce,0x1eb));var _0xe07c=function(_0xda6b23,_0x280f43){_0xda6b23=_0xda6b23-0x0;var _0x24f68b=_0x07ce[_0xda6b23];return _0x24f68b;};'use strict';var Sequelize=require('sequelize');module[_0xe07c('0x0')]={'type':{'type':Sequelize[_0xe07c('0x1')](_0xe07c('0x2'),'variable',_0xe07c('0x3'),_0xe07c('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe07c('0x1')](_0xe07c('0x2'),_0xe07c('0x5'),_0xe07c('0x3'))},'keyContent':{'type':Sequelize[_0xe07c('0x6')]},'idField':{'type':Sequelize[_0xe07c('0x6')]},'nameField':{'type':Sequelize[_0xe07c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe07c('0x6')]}}; \ No newline at end of file +var _0xbc57=['ENUM','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x5a846c,_0x55ae9a){var _0x2e09df=function(_0x3b15fe){while(--_0x3b15fe){_0x5a846c['push'](_0x5a846c['shift']());}};_0x2e09df(++_0x55ae9a);}(_0xbc57,0x12e));var _0x7bc5=function(_0x59f33e,_0x50645e){_0x59f33e=_0x59f33e-0x0;var _0x412e53=_0xbc57[_0x59f33e];return _0x412e53;};'use strict';var Sequelize=require(_0x7bc5('0x0'));module[_0x7bc5('0x1')]={'type':{'type':Sequelize[_0x7bc5('0x2')]('string',_0x7bc5('0x3'),_0x7bc5('0x4'),_0x7bc5('0x5'),_0x7bc5('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7bc5('0x7')]},'key':{'type':Sequelize[_0x7bc5('0x7')]},'keyType':{'type':Sequelize[_0x7bc5('0x2')]('string',_0x7bc5('0x3'),_0x7bc5('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7bc5('0x7')]},'nameField':{'type':Sequelize[_0x7bc5('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7bc5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 6303b24..3ad0047 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 _0xbe77=['undefined','count','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','rawAttributes','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','SugarcrmField','include','findAll','rows','catch','show','params','keys','intersection','includeAll','find','create','body','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit'];(function(_0x158b54,_0xc7a51b){var _0x5d0e54=function(_0x10dcfd){while(--_0x10dcfd){_0x158b54['push'](_0x158b54['shift']());}};_0x5d0e54(++_0xc7a51b);}(_0xbe77,0x192));var _0x7be7=function(_0x2a70f4,_0x440e7f){_0x2a70f4=_0x2a70f4-0x0;var _0x479442=_0xbe77[_0x2a70f4];return _0x479442;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7be7('0x0'));var BPromise=require(_0x7be7('0x1'));var Mustache=require('mustache');var util=require(_0x7be7('0x2'));var path=require(_0x7be7('0x3'));var sox=require(_0x7be7('0x4'));var csv=require(_0x7be7('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7be7('0x6'));var _=require(_0x7be7('0x7'));var squel=require(_0x7be7('0x8'));var crypto=require('crypto');var jsforce=require(_0x7be7('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7be7('0xa'));var Redis=require(_0x7be7('0xb'));var authService=require(_0x7be7('0xc'));var qs=require(_0x7be7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7be7('0xe'))(_0x7be7('0xf'));var utils=require('../../config/utils');var config=require(_0x7be7('0x10'));var licenseUtil=require(_0x7be7('0x11'));var db=require(_0x7be7('0x12'))['db'];function respondWithStatusCode(_0x2309ac,_0x4a326d){_0x4a326d=_0x4a326d||0xcc;return function(_0x692ca6){if(_0x692ca6){return _0x2309ac[_0x7be7('0x13')](_0x4a326d);}return _0x2309ac['status'](_0x4a326d)['end']();};}function respondWithResult(_0x4ff2f8,_0x4e0758){_0x4e0758=_0x4e0758||0xc8;return function(_0x19ccc9){if(_0x19ccc9){return _0x4ff2f8[_0x7be7('0x14')](_0x4e0758)[_0x7be7('0x15')](_0x19ccc9);}};}function respondWithFilteredResult(_0x4021e1,_0x55b9a4){return function(_0x7e2763){if(_0x7e2763){var _0x4dd674=typeof _0x55b9a4[_0x7be7('0x16')]==='undefined'&&typeof _0x55b9a4[_0x7be7('0x17')]===_0x7be7('0x18');var _0x404690=_0x7e2763['count'];var _0x97aa1d=_0x4dd674?0x0:_0x55b9a4[_0x7be7('0x16')];var _0xc9b4d8=_0x4dd674?_0x7e2763[_0x7be7('0x19')]:_0x55b9a4[_0x7be7('0x16')]+_0x55b9a4[_0x7be7('0x17')];var _0x540157;if(_0xc9b4d8>=_0x404690){_0xc9b4d8=_0x404690;_0x540157=0xc8;}else{_0x540157=0xce;}_0x4021e1['status'](_0x540157);return _0x4021e1[_0x7be7('0x1a')]('Content-Range',_0x97aa1d+'-'+_0xc9b4d8+'/'+_0x404690)['json'](_0x7e2763);}return null;};}function patchUpdates(_0x1abfbf){return function(_0x51ce38){try{jsonpatch[_0x7be7('0x1b')](_0x51ce38,_0x1abfbf,!![]);}catch(_0xced22b){return BPromise[_0x7be7('0x1c')](_0xced22b);}return _0x51ce38[_0x7be7('0x1d')]();};}function saveUpdates(_0x47a9d2,_0x444807){return function(_0x478ee1){if(_0x478ee1){return _0x478ee1[_0x7be7('0x1e')](_0x47a9d2)['then'](function(_0x4d7e94){return _0x4d7e94;});}return null;};}function removeEntity(_0x1611fa,_0x5dca7d){return function(_0x49577e){if(_0x49577e){return _0x49577e[_0x7be7('0x1f')]()[_0x7be7('0x20')](function(){_0x1611fa['status'](0xcc)[_0x7be7('0x21')]();});}};}function handleEntityNotFound(_0x26c3e1,_0x1ff9f6){return function(_0x3fe60a){if(!_0x3fe60a){_0x26c3e1[_0x7be7('0x13')](0x194);}return _0x3fe60a;};}function handleError(_0xa38198,_0x2a7b35){_0x2a7b35=_0x2a7b35||0x1f4;return function(_0x23ec67){logger[_0x7be7('0x22')](_0x23ec67[_0x7be7('0x23')]);if(_0x23ec67[_0x7be7('0x24')]){delete _0x23ec67['name'];}_0xa38198['status'](_0x2a7b35)[_0x7be7('0x25')](_0x23ec67);};}exports['index']=function(_0xb73cc,_0x5a33ea){var _0x16a399={},_0x11425f={},_0x38979a={'count':0x0,'rows':[]};var _0x515845=_['map'](db['SugarcrmField'][_0x7be7('0x26')],function(_0x596fa5){return{'name':_0x596fa5['fieldName'],'type':_0x596fa5['type'][_0x7be7('0x27')]};});_0x11425f[_0x7be7('0x28')]=_[_0x7be7('0x29')](_0x515845,_0x7be7('0x24'));_0x11425f[_0x7be7('0x2a')]=_['keys'](_0xb73cc[_0x7be7('0x2a')]);_0x11425f[_0x7be7('0x2b')]=_['intersection'](_0x11425f[_0x7be7('0x28')],_0x11425f['query']);_0x16a399[_0x7be7('0x2c')]=_['intersection'](_0x11425f['model'],qs[_0x7be7('0x2d')](_0xb73cc[_0x7be7('0x2a')][_0x7be7('0x2d')]));_0x16a399[_0x7be7('0x2c')]=_0x16a399['attributes'][_0x7be7('0x2e')]?_0x16a399['attributes']:_0x11425f[_0x7be7('0x28')];if(!_0xb73cc[_0x7be7('0x2a')][_0x7be7('0x2f')](_0x7be7('0x30'))){_0x16a399[_0x7be7('0x17')]=qs[_0x7be7('0x17')](_0xb73cc[_0x7be7('0x2a')][_0x7be7('0x17')]);_0x16a399[_0x7be7('0x16')]=qs[_0x7be7('0x16')](_0xb73cc['query'][_0x7be7('0x16')]);}_0x16a399[_0x7be7('0x31')]=qs[_0x7be7('0x32')](_0xb73cc['query']['sort']);_0x16a399[_0x7be7('0x33')]=qs[_0x7be7('0x2b')](_[_0x7be7('0x34')](_0xb73cc[_0x7be7('0x2a')],_0x11425f[_0x7be7('0x2b')]),_0x515845);if(_0xb73cc['query']['filter']){_0x16a399[_0x7be7('0x33')]=_['merge'](_0x16a399[_0x7be7('0x33')],{'$or':_['map'](_0x515845,function(_0x4444cf){if(_0x4444cf[_0x7be7('0x35')]!==_0x7be7('0x36')){var _0x3cc3d7={};_0x3cc3d7[_0x4444cf[_0x7be7('0x24')]]={'$like':'%'+_0xb73cc[_0x7be7('0x2a')][_0x7be7('0x37')]+'%'};return _0x3cc3d7;}})});}_0x16a399=_[_0x7be7('0x38')]({},_0x16a399,_0xb73cc[_0x7be7('0x39')]);var _0x26da0b={'where':_0x16a399[_0x7be7('0x33')]};return db[_0x7be7('0x3a')][_0x7be7('0x19')](_0x26da0b)[_0x7be7('0x20')](function(_0x2c3c53){_0x38979a[_0x7be7('0x19')]=_0x2c3c53;if(_0xb73cc['query']['includeAll']){_0x16a399[_0x7be7('0x3b')]=[{'all':!![]}];}return db[_0x7be7('0x3a')][_0x7be7('0x3c')](_0x16a399);})[_0x7be7('0x20')](function(_0x30d41a){_0x38979a[_0x7be7('0x3d')]=_0x30d41a;return _0x38979a;})[_0x7be7('0x20')](respondWithFilteredResult(_0x5a33ea,_0x16a399))[_0x7be7('0x3e')](handleError(_0x5a33ea,null));};exports[_0x7be7('0x3f')]=function(_0x4f58e2,_0x61a0d7){var _0x3a2fee={'raw':!![],'where':{'id':_0x4f58e2[_0x7be7('0x40')]['id']}},_0x204c66={};_0x204c66['model']=_[_0x7be7('0x41')](db[_0x7be7('0x3a')]['rawAttributes']);_0x204c66[_0x7be7('0x2a')]=_[_0x7be7('0x41')](_0x4f58e2[_0x7be7('0x2a')]);_0x204c66[_0x7be7('0x2b')]=_[_0x7be7('0x42')](_0x204c66['model'],_0x204c66[_0x7be7('0x2a')]);_0x3a2fee[_0x7be7('0x2c')]=_['intersection'](_0x204c66['model'],qs[_0x7be7('0x2d')](_0x4f58e2[_0x7be7('0x2a')][_0x7be7('0x2d')]));_0x3a2fee[_0x7be7('0x2c')]=_0x3a2fee[_0x7be7('0x2c')]['length']?_0x3a2fee[_0x7be7('0x2c')]:_0x204c66['model'];if(_0x4f58e2['query'][_0x7be7('0x43')]){_0x3a2fee[_0x7be7('0x3b')]=[{'all':!![]}];}_0x3a2fee=_[_0x7be7('0x38')]({},_0x3a2fee,_0x4f58e2['options']);return db[_0x7be7('0x3a')][_0x7be7('0x44')](_0x3a2fee)['then'](handleEntityNotFound(_0x61a0d7,null))['then'](respondWithResult(_0x61a0d7,null))['catch'](handleError(_0x61a0d7,null));};exports[_0x7be7('0x45')]=function(_0x54ca9c,_0x4f6cfa){return db['SugarcrmField'][_0x7be7('0x45')](_0x54ca9c[_0x7be7('0x46')],{})[_0x7be7('0x20')](respondWithResult(_0x4f6cfa,0xc9))['catch'](handleError(_0x4f6cfa,null));};exports[_0x7be7('0x1e')]=function(_0x17b7fe,_0x9b01f){if(_0x17b7fe['body']['id']){delete _0x17b7fe[_0x7be7('0x46')]['id'];}return db[_0x7be7('0x3a')][_0x7be7('0x44')]({'where':{'id':_0x17b7fe['params']['id']}})[_0x7be7('0x20')](handleEntityNotFound(_0x9b01f,null))['then'](saveUpdates(_0x17b7fe[_0x7be7('0x46')],null))[_0x7be7('0x20')](respondWithResult(_0x9b01f,null))[_0x7be7('0x3e')](handleError(_0x9b01f,null));};exports['destroy']=function(_0x348542,_0x341054){return db[_0x7be7('0x3a')][_0x7be7('0x44')]({'where':{'id':_0x348542['params']['id']}})[_0x7be7('0x20')](handleEntityNotFound(_0x341054,null))[_0x7be7('0x20')](removeEntity(_0x341054,null))[_0x7be7('0x3e')](handleError(_0x341054,null));}; \ No newline at end of file +var _0x54b3=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','fast-json-patch','moment','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','length','nolimit','order','sort'];(function(_0x4fb4c8,_0x141745){var _0x1b6740=function(_0x40e993){while(--_0x40e993){_0x4fb4c8['push'](_0x4fb4c8['shift']());}};_0x1b6740(++_0x141745);}(_0x54b3,0xdd));var _0x354b=function(_0x3989df,_0x457cb5){_0x3989df=_0x3989df-0x0;var _0x42f6b8=_0x54b3[_0x3989df];return _0x42f6b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x354b('0x0'));var rp=require('request-promise');var moment=require(_0x354b('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354b('0x2'));var path=require(_0x354b('0x3'));var sox=require('sox');var csv=require(_0x354b('0x4'));var ejs=require(_0x354b('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x354b('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x354b('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x354b('0x4'));var querystring=require(_0x354b('0x8'));var Papa=require(_0x354b('0x9'));var Redis=require('ioredis');var authService=require(_0x354b('0xa'));var qs=require(_0x354b('0xb'));var as=require(_0x354b('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x354b('0xd'));var utils=require('../../config/utils');var config=require(_0x354b('0xe'));var licenseUtil=require(_0x354b('0xf'));var db=require(_0x354b('0x10'))['db'];function respondWithStatusCode(_0x487a23,_0x32e983){_0x32e983=_0x32e983||0xcc;return function(_0x36b393){if(_0x36b393){return _0x487a23[_0x354b('0x11')](_0x32e983);}return _0x487a23[_0x354b('0x12')](_0x32e983)[_0x354b('0x13')]();};}function respondWithResult(_0x37c013,_0xe374fb){_0xe374fb=_0xe374fb||0xc8;return function(_0x555a33){if(_0x555a33){return _0x37c013[_0x354b('0x12')](_0xe374fb)[_0x354b('0x14')](_0x555a33);}};}function respondWithFilteredResult(_0x1d425b,_0x38c43b){return function(_0x344d4b){if(_0x344d4b){var _0x459723=typeof _0x38c43b[_0x354b('0x15')]===_0x354b('0x16')&&typeof _0x38c43b[_0x354b('0x17')]===_0x354b('0x16');var _0x5e5694=_0x344d4b[_0x354b('0x18')];var _0x156d49=_0x459723?0x0:_0x38c43b[_0x354b('0x15')];var _0x3d4a9a=_0x459723?_0x344d4b['count']:_0x38c43b['offset']+_0x38c43b[_0x354b('0x17')];var _0x9f114e;if(_0x3d4a9a>=_0x5e5694){_0x3d4a9a=_0x5e5694;_0x9f114e=0xc8;}else{_0x9f114e=0xce;}_0x1d425b[_0x354b('0x12')](_0x9f114e);return _0x1d425b[_0x354b('0x19')](_0x354b('0x1a'),_0x156d49+'-'+_0x3d4a9a+'/'+_0x5e5694)[_0x354b('0x14')](_0x344d4b);}return null;};}function patchUpdates(_0x238ded){return function(_0xe050ad){try{jsonpatch['apply'](_0xe050ad,_0x238ded,!![]);}catch(_0x4173f1){return BPromise[_0x354b('0x1b')](_0x4173f1);}return _0xe050ad[_0x354b('0x1c')]();};}function saveUpdates(_0x1c7859,_0xac1e16){return function(_0x32d8f9){if(_0x32d8f9){return _0x32d8f9[_0x354b('0x1d')](_0x1c7859)[_0x354b('0x1e')](function(_0x43daef){return _0x43daef;});}return null;};}function removeEntity(_0x8c17d5,_0x54f2ef){return function(_0x4aa4c2){if(_0x4aa4c2){return _0x4aa4c2[_0x354b('0x1f')]()[_0x354b('0x1e')](function(){_0x8c17d5[_0x354b('0x12')](0xcc)[_0x354b('0x13')]();});}};}function handleEntityNotFound(_0x508a5e,_0x15f2e0){return function(_0x38d8e4){if(!_0x38d8e4){_0x508a5e[_0x354b('0x11')](0x194);}return _0x38d8e4;};}function handleError(_0x161247,_0x56214b){_0x56214b=_0x56214b||0x1f4;return function(_0x5cbe08){logger[_0x354b('0x20')](_0x5cbe08[_0x354b('0x21')]);if(_0x5cbe08[_0x354b('0x22')]){delete _0x5cbe08[_0x354b('0x22')];}_0x161247[_0x354b('0x12')](_0x56214b)['send'](_0x5cbe08);};}exports[_0x354b('0x23')]=function(_0x5968c7,_0x398a9e){var _0x1c90be={},_0x4a924f={},_0x353d84={'count':0x0,'rows':[]};var _0x246891=_[_0x354b('0x24')](db[_0x354b('0x25')][_0x354b('0x26')],function(_0x48efbe){return{'name':_0x48efbe[_0x354b('0x27')],'type':_0x48efbe[_0x354b('0x28')][_0x354b('0x29')]};});_0x4a924f['model']=_[_0x354b('0x24')](_0x246891,_0x354b('0x22'));_0x4a924f[_0x354b('0x2a')]=_['keys'](_0x5968c7[_0x354b('0x2a')]);_0x4a924f[_0x354b('0x2b')]=_['intersection'](_0x4a924f[_0x354b('0x2c')],_0x4a924f[_0x354b('0x2a')]);_0x1c90be[_0x354b('0x2d')]=_['intersection'](_0x4a924f[_0x354b('0x2c')],qs['fields'](_0x5968c7[_0x354b('0x2a')][_0x354b('0x2e')]));_0x1c90be['attributes']=_0x1c90be[_0x354b('0x2d')][_0x354b('0x2f')]?_0x1c90be[_0x354b('0x2d')]:_0x4a924f['model'];if(!_0x5968c7['query']['hasOwnProperty'](_0x354b('0x30'))){_0x1c90be[_0x354b('0x17')]=qs[_0x354b('0x17')](_0x5968c7[_0x354b('0x2a')][_0x354b('0x17')]);_0x1c90be[_0x354b('0x15')]=qs[_0x354b('0x15')](_0x5968c7[_0x354b('0x2a')][_0x354b('0x15')]);}_0x1c90be[_0x354b('0x31')]=qs['sort'](_0x5968c7[_0x354b('0x2a')][_0x354b('0x32')]);_0x1c90be[_0x354b('0x33')]=qs['filters'](_[_0x354b('0x34')](_0x5968c7[_0x354b('0x2a')],_0x4a924f[_0x354b('0x2b')]),_0x246891);if(_0x5968c7[_0x354b('0x2a')][_0x354b('0x35')]){_0x1c90be[_0x354b('0x33')]=_[_0x354b('0x36')](_0x1c90be[_0x354b('0x33')],{'$or':_['map'](_0x246891,function(_0x5cb834){if(_0x5cb834[_0x354b('0x28')]!==_0x354b('0x37')){var _0x5862b4={};_0x5862b4[_0x5cb834[_0x354b('0x22')]]={'$like':'%'+_0x5968c7[_0x354b('0x2a')][_0x354b('0x35')]+'%'};return _0x5862b4;}})});}_0x1c90be=_['merge']({},_0x1c90be,_0x5968c7[_0x354b('0x38')]);var _0x470144={'where':_0x1c90be['where']};return db[_0x354b('0x25')][_0x354b('0x18')](_0x470144)[_0x354b('0x1e')](function(_0x3d974d){_0x353d84['count']=_0x3d974d;if(_0x5968c7['query'][_0x354b('0x39')]){_0x1c90be[_0x354b('0x3a')]=[{'all':!![]}];}return db[_0x354b('0x25')][_0x354b('0x3b')](_0x1c90be);})[_0x354b('0x1e')](function(_0x44971d){_0x353d84[_0x354b('0x3c')]=_0x44971d;return _0x353d84;})[_0x354b('0x1e')](respondWithFilteredResult(_0x398a9e,_0x1c90be))[_0x354b('0x3d')](handleError(_0x398a9e,null));};exports[_0x354b('0x3e')]=function(_0x537420,_0x43ae1e){var _0x14e37b={'raw':!![],'where':{'id':_0x537420[_0x354b('0x3f')]['id']}},_0x2840d4={};_0x2840d4['model']=_[_0x354b('0x40')](db[_0x354b('0x25')][_0x354b('0x26')]);_0x2840d4[_0x354b('0x2a')]=_[_0x354b('0x40')](_0x537420['query']);_0x2840d4[_0x354b('0x2b')]=_['intersection'](_0x2840d4[_0x354b('0x2c')],_0x2840d4[_0x354b('0x2a')]);_0x14e37b[_0x354b('0x2d')]=_['intersection'](_0x2840d4['model'],qs[_0x354b('0x2e')](_0x537420['query'][_0x354b('0x2e')]));_0x14e37b[_0x354b('0x2d')]=_0x14e37b['attributes'][_0x354b('0x2f')]?_0x14e37b[_0x354b('0x2d')]:_0x2840d4[_0x354b('0x2c')];if(_0x537420['query'][_0x354b('0x39')]){_0x14e37b[_0x354b('0x3a')]=[{'all':!![]}];}_0x14e37b=_[_0x354b('0x36')]({},_0x14e37b,_0x537420[_0x354b('0x38')]);return db['SugarcrmField'][_0x354b('0x41')](_0x14e37b)['then'](handleEntityNotFound(_0x43ae1e,null))['then'](respondWithResult(_0x43ae1e,null))[_0x354b('0x3d')](handleError(_0x43ae1e,null));};exports[_0x354b('0x42')]=function(_0x23aaf5,_0x1e1abb){return db[_0x354b('0x25')][_0x354b('0x42')](_0x23aaf5[_0x354b('0x43')],{})[_0x354b('0x1e')](respondWithResult(_0x1e1abb,0xc9))['catch'](handleError(_0x1e1abb,null));};exports[_0x354b('0x1d')]=function(_0x538a41,_0x25ed35){if(_0x538a41['body']['id']){delete _0x538a41[_0x354b('0x43')]['id'];}return db[_0x354b('0x25')][_0x354b('0x41')]({'where':{'id':_0x538a41[_0x354b('0x3f')]['id']}})[_0x354b('0x1e')](handleEntityNotFound(_0x25ed35,null))[_0x354b('0x1e')](saveUpdates(_0x538a41['body'],null))[_0x354b('0x1e')](respondWithResult(_0x25ed35,null))[_0x354b('0x3d')](handleError(_0x25ed35,null));};exports['destroy']=function(_0x4d8c5a,_0x356f52){return db[_0x354b('0x25')][_0x354b('0x41')]({'where':{'id':_0x4d8c5a[_0x354b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x356f52,null))[_0x354b('0x1e')](removeEntity(_0x356f52,null))[_0x354b('0x3d')](handleError(_0x356f52,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1316136..5a01253 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 _0xc7ff=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x3b40ac,_0x43e467){var _0x31adeb=function(_0x1efeca){while(--_0x1efeca){_0x3b40ac['push'](_0x3b40ac['shift']());}};_0x31adeb(++_0x43e467);}(_0xc7ff,0xd1));var _0xfc7f=function(_0xb77dd4,_0x371dd8){_0xb77dd4=_0xb77dd4-0x0;var _0x29db3c=_0xc7ff[_0xb77dd4];return _0x29db3c;};'use strict';var _=require(_0xfc7f('0x0'));var util=require(_0xfc7f('0x1'));var logger=require(_0xfc7f('0x2'))(_0xfc7f('0x3'));var moment=require(_0xfc7f('0x4'));var BPromise=require(_0xfc7f('0x5'));var rp=require(_0xfc7f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc7f('0x7'));var config=require(_0xfc7f('0x8'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x2f98ab,_0x4c1071){return _0x2f98ab[_0xfc7f('0x9')]('SugarcrmField',attributes,{'tableName':_0xfc7f('0xa'),'paranoid':![],'indexes':[{'name':_0xfc7f('0xb'),'fields':[_0xfc7f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa344=['sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x533da3,_0x469556){var _0x2999bd=function(_0x2bb88d){while(--_0x2bb88d){_0x533da3['push'](_0x533da3['shift']());}};_0x2999bd(++_0x469556);}(_0xa344,0x11a));var _0x4a34=function(_0x4f032e,_0x428278){_0x4f032e=_0x4f032e-0x0;var _0x46f5b4=_0xa344[_0x4f032e];return _0x46f5b4;};'use strict';var _=require(_0x4a34('0x0'));var util=require(_0x4a34('0x1'));var logger=require(_0x4a34('0x2'))(_0x4a34('0x3'));var moment=require(_0x4a34('0x4'));var BPromise=require(_0x4a34('0x5'));var rp=require(_0x4a34('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4a34('0x7'));module[_0x4a34('0x8')]=function(_0x288502,_0xc96600){return _0x288502[_0x4a34('0x9')](_0x4a34('0xa'),attributes,{'tableName':_0x4a34('0xb'),'paranoid':![],'indexes':[{'name':_0x4a34('0xc'),'fields':['idField',_0x4a34('0xd')],'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 74ffeb5..baea459 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 _0x3585=['SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','info','request\x20sent','debug','stringify','error','code'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x3585,0x193));var _0x5358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3585[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5358('0x0'));var util=require(_0x5358('0x1'));var moment=require(_0x5358('0x2'));var BPromise=require(_0x5358('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5358('0x4'));var db=require(_0x5358('0x5'))['db'];var utils=require(_0x5358('0x6'));var logger=require('../../config/logger')(_0x5358('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5358('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0470,_0x30c946,_0x33f9f2){return new BPromise(function(_0x131f91,_0x2aa30e){return client['request'](_0x5a0470,_0x33f9f2)['then'](function(_0x5789f8){logger[_0x5358('0x9')]('SugarcrmField,\x20%s,\x20%s',_0x30c946,_0x5358('0xa'));logger[_0x5358('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x30c946,'request\x20sent',JSON[_0x5358('0xc')](_0x5789f8));if(_0x5789f8[_0x5358('0xd')]){if(_0x5789f8[_0x5358('0xd')][_0x5358('0xe')]===0x1f4){logger[_0x5358('0xd')](_0x5358('0xf'),_0x30c946,_0x5789f8[_0x5358('0xd')][_0x5358('0x10')]);return _0x2aa30e(_0x5789f8[_0x5358('0xd')][_0x5358('0x10')]);}logger[_0x5358('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x30c946,_0x5789f8['error'][_0x5358('0x10')]);return _0x131f91(_0x5789f8[_0x5358('0xd')][_0x5358('0x10')]);}else{logger[_0x5358('0x9')](_0x5358('0xf'),_0x30c946,'request\x20sent');_0x131f91(_0x5789f8[_0x5358('0x11')][_0x5358('0x10')]);}})[_0x5358('0x12')](function(_0xc4799f){logger[_0x5358('0xd')](_0x5358('0xf'),_0x30c946,_0xc4799f);_0x2aa30e(_0xc4799f);});});} \ No newline at end of file +var _0x2d7d=['../../config/logger','rpc','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x594163,_0xf3583c){var _0x18c749=function(_0x52f41b){while(--_0x52f41b){_0x594163['push'](_0x594163['shift']());}};_0x18c749(++_0xf3583c);}(_0x2d7d,0xdf));var _0xd2d7=function(_0x43114f,_0x35f00d){_0x43114f=_0x43114f-0x0;var _0xc40938=_0x2d7d[_0x43114f];return _0xc40938;};'use strict';var _=require(_0xd2d7('0x0'));var util=require(_0xd2d7('0x1'));var moment=require(_0xd2d7('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2d7('0x3'));var fs=require('fs');var Redis=require(_0xd2d7('0x4'));var db=require(_0xd2d7('0x5'))['db'];var utils=require(_0xd2d7('0x6'));var logger=require(_0xd2d7('0x7'))(_0xd2d7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd2d7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2520,_0x382044,_0x2362e8){return new BPromise(function(_0x307bd2,_0x5103c9){return client[_0xd2d7('0xa')](_0x5b2520,_0x2362e8)[_0xd2d7('0xb')](function(_0x2f375c){logger['info'](_0xd2d7('0xc'),_0x382044,_0xd2d7('0xd'));logger[_0xd2d7('0xe')](_0xd2d7('0xf'),_0x382044,_0xd2d7('0xd'),JSON[_0xd2d7('0x10')](_0x2f375c));if(_0x2f375c[_0xd2d7('0x11')]){if(_0x2f375c[_0xd2d7('0x11')][_0xd2d7('0x12')]===0x1f4){logger['error'](_0xd2d7('0xc'),_0x382044,_0x2f375c['error'][_0xd2d7('0x13')]);return _0x5103c9(_0x2f375c[_0xd2d7('0x11')]['message']);}logger[_0xd2d7('0x11')](_0xd2d7('0xc'),_0x382044,_0x2f375c[_0xd2d7('0x11')]['message']);return _0x307bd2(_0x2f375c[_0xd2d7('0x11')][_0xd2d7('0x13')]);}else{logger[_0xd2d7('0x14')](_0xd2d7('0xc'),_0x382044,_0xd2d7('0xd'));_0x307bd2(_0x2f375c[_0xd2d7('0x15')][_0xd2d7('0x13')]);}})[_0xd2d7('0x16')](function(_0x585840){logger[_0xd2d7('0x11')](_0xd2d7('0xc'),_0x382044,_0x585840);_0x5103c9(_0x585840);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index c97af62..9250e4b 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 _0x8128=['isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x8128,0x1b1));var _0x8812=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x8128[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require(_0x8812('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8812('0x1'));var express=require(_0x8812('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8812('0x3'));var interaction=require(_0x8812('0x4'));var config=require(_0x8812('0x5'));var controller=require('./intVtigerAccount.controller');router[_0x8812('0x6')]('/',auth[_0x8812('0x7')](),controller[_0x8812('0x8')]);router[_0x8812('0x6')]('/:id',auth[_0x8812('0x7')](),controller[_0x8812('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x8812('0xa')]);router[_0x8812('0x6')](_0x8812('0xb'),auth[_0x8812('0x7')](),controller[_0x8812('0xc')]);router[_0x8812('0xd')]('/',auth[_0x8812('0x7')](),controller[_0x8812('0xe')]);router[_0x8812('0xd')]('/:id/configurations',auth[_0x8812('0x7')](),controller[_0x8812('0xf')]);router[_0x8812('0x10')](_0x8812('0x11'),auth[_0x8812('0x7')](),controller[_0x8812('0x12')]);router['delete'](_0x8812('0x11'),auth[_0x8812('0x7')](),controller[_0x8812('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1da6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x12dedb,_0x3c6e09){var _0x3b2f0d=function(_0x309c65){while(--_0x309c65){_0x12dedb['push'](_0x12dedb['shift']());}};_0x3b2f0d(++_0x3c6e09);}(_0x1da6,0x7c));var _0x61da=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0x1da6[_0x55d829];return _0x52163b;};'use strict';var multer=require(_0x61da('0x0'));var util=require(_0x61da('0x1'));var path=require(_0x61da('0x2'));var timeout=require(_0x61da('0x3'));var express=require(_0x61da('0x4'));var router=express[_0x61da('0x5')]();var fs_extra=require(_0x61da('0x6'));var auth=require(_0x61da('0x7'));var interaction=require(_0x61da('0x8'));var config=require(_0x61da('0x9'));var controller=require(_0x61da('0xa'));router[_0x61da('0xb')]('/',auth[_0x61da('0xc')](),controller[_0x61da('0xd')]);router[_0x61da('0xb')](_0x61da('0xe'),auth[_0x61da('0xc')](),controller[_0x61da('0xf')]);router[_0x61da('0xb')](_0x61da('0x10'),auth['isAuthenticated'](),controller[_0x61da('0x11')]);router[_0x61da('0xb')](_0x61da('0x12'),auth[_0x61da('0xc')](),controller[_0x61da('0x13')]);router[_0x61da('0x14')]('/',auth[_0x61da('0xc')](),controller[_0x61da('0x15')]);router[_0x61da('0x14')](_0x61da('0x10'),auth[_0x61da('0xc')](),controller[_0x61da('0x16')]);router[_0x61da('0x17')](_0x61da('0xe'),auth[_0x61da('0xc')](),controller['update']);router[_0x61da('0x18')](_0x61da('0xe'),auth[_0x61da('0xc')](),controller[_0x61da('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e7edb63..0ed62f8 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 _0xfe52=['STRING','HelpDesk','exports'];(function(_0x390a62,_0x410ce3){var _0x320c67=function(_0x4382e9){while(--_0x4382e9){_0x390a62['push'](_0x390a62['shift']());}};_0x320c67(++_0x410ce3);}(_0xfe52,0x122));var _0x2fe5=function(_0x12a84f,_0x200604){_0x12a84f=_0x12a84f-0x0;var _0x1fc582=_0xfe52[_0x12a84f];return _0x1fc582;};'use strict';var Sequelize=require('sequelize');module[_0x2fe5('0x0')]={'name':{'type':Sequelize[_0x2fe5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2fe5('0x1')]},'username':{'type':Sequelize[_0x2fe5('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2fe5('0x2')},'remoteUri':{'type':Sequelize[_0x2fe5('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2fe5('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2fe5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x08b5=['exports','STRING','sequelize'];(function(_0x7edda,_0x32ffa0){var _0x4007f6=function(_0x2584d3){while(--_0x2584d3){_0x7edda['push'](_0x7edda['shift']());}};_0x4007f6(++_0x32ffa0);}(_0x08b5,0xad));var _0x508b=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x08b5[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x508b('0x0'));module[_0x508b('0x1')]={'name':{'type':Sequelize[_0x508b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x508b('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x508b('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x508b('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 140d255..fb8aa96 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 _0xc074=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VtigerAccount','count','includeAll','findAll','length','include','catch','create','body','update','getConfigurations','params','findOne','AccountId','getSubjects','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','Subjects','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','format','GET','success','POST','login','result','token','describe','sessionName','reference','owner','remove','editable','false','startsWith','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5740a7,_0x19e089){var _0x436f32=function(_0x44e171){while(--_0x44e171){_0x5740a7['push'](_0x5740a7['shift']());}};_0x436f32(++_0x19e089);}(_0xc074,0x151));var _0x4c07=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0xc074[_0x4c6d6f];return _0x2d4478;};'use strict';var emlformat=require(_0x4c07('0x0'));var rimraf=require(_0x4c07('0x1'));var zipdir=require(_0x4c07('0x2'));var jsonpatch=require(_0x4c07('0x3'));var rp=require(_0x4c07('0x4'));var moment=require('moment');var BPromise=require(_0x4c07('0x5'));var Mustache=require(_0x4c07('0x6'));var util=require(_0x4c07('0x7'));var path=require(_0x4c07('0x8'));var sox=require('sox');var csv=require(_0x4c07('0x9'));var ejs=require(_0x4c07('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4c07('0xb'));var crypto=require(_0x4c07('0xc'));var jsforce=require(_0x4c07('0xd'));var deskjs=require(_0x4c07('0xe'));var toCsv=require(_0x4c07('0x9'));var querystring=require(_0x4c07('0xf'));var Papa=require(_0x4c07('0x10'));var Redis=require(_0x4c07('0x11'));var authService=require(_0x4c07('0x12'));var qs=require(_0x4c07('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c07('0x14'));var logger=require(_0x4c07('0x15'))('api');var utils=require(_0x4c07('0x16'));var config=require(_0x4c07('0x17'));var licenseUtil=require(_0x4c07('0x18'));var db=require(_0x4c07('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x279398,_0x12523f){_0x12523f=_0x12523f||0xcc;return function(_0x3fa609){if(_0x3fa609){return _0x279398[_0x4c07('0x1a')](_0x12523f);}return _0x279398[_0x4c07('0x1b')](_0x12523f)[_0x4c07('0x1c')]();};}function respondWithResult(_0x541684,_0x25461b){_0x25461b=_0x25461b||0xc8;return function(_0x3eeaf3){if(_0x3eeaf3){return _0x541684[_0x4c07('0x1b')](_0x25461b)[_0x4c07('0x1d')](_0x3eeaf3);}};}function respondWithFilteredResult(_0x4d81c3,_0x7de134){return function(_0x4b4054){if(_0x4b4054){var _0x569f34=typeof _0x7de134['offset']===_0x4c07('0x1e')&&typeof _0x7de134[_0x4c07('0x1f')]===_0x4c07('0x1e');var _0x3fe1b0=_0x4b4054['count'];var _0xfdd5f0=_0x569f34?0x0:_0x7de134['offset'];var _0x1da37c=_0x569f34?_0x4b4054['count']:_0x7de134[_0x4c07('0x20')]+_0x7de134['limit'];var _0x1b662c;if(_0x1da37c>=_0x3fe1b0){_0x1da37c=_0x3fe1b0;_0x1b662c=0xc8;}else{_0x1b662c=0xce;}_0x4d81c3['status'](_0x1b662c);return _0x4d81c3[_0x4c07('0x21')](_0x4c07('0x22'),_0xfdd5f0+'-'+_0x1da37c+'/'+_0x3fe1b0)['json'](_0x4b4054);}return null;};}function patchUpdates(_0x66990d){return function(_0x482adc){try{jsonpatch[_0x4c07('0x23')](_0x482adc,_0x66990d,!![]);}catch(_0x44834a){return BPromise['reject'](_0x44834a);}return _0x482adc[_0x4c07('0x24')]();};}function saveUpdates(_0x4c99d7,_0x203ece){return function(_0xe2b685){if(_0xe2b685){return _0xe2b685['update'](_0x4c99d7)[_0x4c07('0x25')](function(_0x1dbbca){return _0x1dbbca;});}return null;};}function removeEntity(_0x4d12e4,_0x42f73a){return function(_0x473fad){if(_0x473fad){return _0x473fad[_0x4c07('0x26')]()['then'](function(){_0x4d12e4[_0x4c07('0x1b')](0xcc)[_0x4c07('0x1c')]();});}};}function handleEntityNotFound(_0x273ea2,_0x30502e){return function(_0x40e43a){if(!_0x40e43a){_0x273ea2[_0x4c07('0x1a')](0x194);}return _0x40e43a;};}function handleError(_0x1c266d,_0x41d258){_0x41d258=_0x41d258||0x1f4;return function(_0x226bc6){logger[_0x4c07('0x27')](_0x226bc6[_0x4c07('0x28')]);if(_0x226bc6['name']){delete _0x226bc6[_0x4c07('0x29')];}_0x1c266d[_0x4c07('0x1b')](_0x41d258)['send'](_0x226bc6);};}exports[_0x4c07('0x2a')]=function(_0x447145,_0x4c221b){var _0x8ac8a8={},_0x46dd76={},_0x2884e5={'count':0x0,'rows':[]};var _0x292ab4=_[_0x4c07('0x2b')](db['VtigerAccount'][_0x4c07('0x2c')],function(_0x57e08c){return{'name':_0x57e08c[_0x4c07('0x2d')],'type':_0x57e08c[_0x4c07('0x2e')][_0x4c07('0x2f')]};});_0x46dd76['model']=_[_0x4c07('0x2b')](_0x292ab4,_0x4c07('0x29'));_0x46dd76[_0x4c07('0x30')]=_[_0x4c07('0x31')](_0x447145[_0x4c07('0x30')]);_0x46dd76[_0x4c07('0x32')]=_[_0x4c07('0x33')](_0x46dd76[_0x4c07('0x34')],_0x46dd76[_0x4c07('0x30')]);_0x8ac8a8[_0x4c07('0x35')]=_['intersection'](_0x46dd76[_0x4c07('0x34')],qs[_0x4c07('0x36')](_0x447145['query']['fields']));_0x8ac8a8['attributes']=_0x8ac8a8[_0x4c07('0x35')]['length']?_0x8ac8a8['attributes']:_0x46dd76[_0x4c07('0x34')];if(!_0x447145[_0x4c07('0x30')][_0x4c07('0x37')](_0x4c07('0x38'))){_0x8ac8a8[_0x4c07('0x1f')]=qs[_0x4c07('0x1f')](_0x447145[_0x4c07('0x30')]['limit']);_0x8ac8a8[_0x4c07('0x20')]=qs[_0x4c07('0x20')](_0x447145[_0x4c07('0x30')][_0x4c07('0x20')]);}_0x8ac8a8[_0x4c07('0x39')]=qs['sort'](_0x447145[_0x4c07('0x30')][_0x4c07('0x3a')]);_0x8ac8a8[_0x4c07('0x3b')]=qs[_0x4c07('0x32')](_['pick'](_0x447145[_0x4c07('0x30')],_0x46dd76[_0x4c07('0x32')]),_0x292ab4);if(_0x447145[_0x4c07('0x30')][_0x4c07('0x3c')]){_0x8ac8a8[_0x4c07('0x3b')]=_[_0x4c07('0x3d')](_0x8ac8a8['where'],{'$or':_[_0x4c07('0x2b')](_0x292ab4,function(_0x141157){if(_0x141157['type']!==_0x4c07('0x3e')){var _0x19b2cc={};_0x19b2cc[_0x141157[_0x4c07('0x29')]]={'$like':'%'+_0x447145[_0x4c07('0x30')][_0x4c07('0x3c')]+'%'};return _0x19b2cc;}})});}_0x8ac8a8=_[_0x4c07('0x3d')]({},_0x8ac8a8,_0x447145[_0x4c07('0x3f')]);var _0x5a0fd2={'where':_0x8ac8a8[_0x4c07('0x3b')]};return db[_0x4c07('0x40')][_0x4c07('0x41')](_0x5a0fd2)[_0x4c07('0x25')](function(_0x49929e){_0x2884e5[_0x4c07('0x41')]=_0x49929e;if(_0x447145[_0x4c07('0x30')][_0x4c07('0x42')]){_0x8ac8a8['include']=[{'all':!![]}];}return db[_0x4c07('0x40')][_0x4c07('0x43')](_0x8ac8a8);})[_0x4c07('0x25')](function(_0x687d9c){_0x2884e5['rows']=_0x687d9c;return _0x2884e5;})[_0x4c07('0x25')](respondWithFilteredResult(_0x4c221b,_0x8ac8a8))['catch'](handleError(_0x4c221b,null));};exports['show']=function(_0x8b2146,_0x97e5d8){var _0x314b67={'raw':![],'where':{'id':_0x8b2146['params']['id']}},_0x1ed0d7={};_0x1ed0d7['model']=_[_0x4c07('0x31')](db[_0x4c07('0x40')]['rawAttributes']);_0x1ed0d7[_0x4c07('0x30')]=_[_0x4c07('0x31')](_0x8b2146[_0x4c07('0x30')]);_0x1ed0d7['filters']=_['intersection'](_0x1ed0d7['model'],_0x1ed0d7['query']);_0x314b67[_0x4c07('0x35')]=_[_0x4c07('0x33')](_0x1ed0d7[_0x4c07('0x34')],qs[_0x4c07('0x36')](_0x8b2146[_0x4c07('0x30')]['fields']));_0x314b67[_0x4c07('0x35')]=_0x314b67[_0x4c07('0x35')][_0x4c07('0x44')]?_0x314b67[_0x4c07('0x35')]:_0x1ed0d7[_0x4c07('0x34')];if(_0x8b2146['query'][_0x4c07('0x42')]){_0x314b67[_0x4c07('0x45')]=[{'all':!![]}];}_0x314b67=_[_0x4c07('0x3d')]({},_0x314b67,_0x8b2146['options']);return db[_0x4c07('0x40')]['find'](_0x314b67)['then'](handleEntityNotFound(_0x97e5d8,null))[_0x4c07('0x25')](respondWithResult(_0x97e5d8,null))[_0x4c07('0x46')](handleError(_0x97e5d8,null));};exports[_0x4c07('0x47')]=function(_0x117e82,_0x237727){return db[_0x4c07('0x40')][_0x4c07('0x47')](_0x117e82[_0x4c07('0x48')],{})[_0x4c07('0x25')](respondWithResult(_0x237727,0xc9))['catch'](handleError(_0x237727,null));};exports[_0x4c07('0x49')]=function(_0x52ffb9,_0x423956){if(_0x52ffb9['body']['id']){delete _0x52ffb9[_0x4c07('0x48')]['id'];}return db[_0x4c07('0x40')]['find']({'where':{'id':_0x52ffb9['params']['id']}})['then'](handleEntityNotFound(_0x423956,null))['then'](saveUpdates(_0x52ffb9[_0x4c07('0x48')],null))[_0x4c07('0x25')](respondWithResult(_0x423956,null))[_0x4c07('0x46')](handleError(_0x423956,null));};exports[_0x4c07('0x26')]=function(_0x122e7d,_0x514c4e){return db[_0x4c07('0x40')]['find']({'where':{'id':_0x122e7d['params']['id']}})['then'](handleEntityNotFound(_0x514c4e,null))[_0x4c07('0x25')](removeEntity(_0x514c4e,null))[_0x4c07('0x46')](handleError(_0x514c4e,null));};exports[_0x4c07('0x4a')]=function(_0x3ebc4c,_0x2a1599,_0x37d09b){var _0x4ff60a={};var _0x36b7cb={};var _0x4de018;var _0x6a3ac3;return db[_0x4c07('0x40')]['findOne']({'where':{'id':_0x3ebc4c[_0x4c07('0x4b')]['id']}})[_0x4c07('0x25')](handleEntityNotFound(_0x2a1599,null))[_0x4c07('0x25')](function(_0x1c9108){if(_0x1c9108){_0x4de018=_0x1c9108;_0x36b7cb[_0x4c07('0x34')]=_[_0x4c07('0x31')](db['VtigerConfiguration']['rawAttributes']);_0x36b7cb[_0x4c07('0x30')]=_['keys'](_0x3ebc4c[_0x4c07('0x30')]);_0x36b7cb[_0x4c07('0x32')]=_[_0x4c07('0x33')](_0x36b7cb[_0x4c07('0x34')],_0x36b7cb[_0x4c07('0x30')]);_0x4ff60a[_0x4c07('0x35')]=_[_0x4c07('0x33')](_0x36b7cb[_0x4c07('0x34')],qs['fields'](_0x3ebc4c['query'][_0x4c07('0x36')]));_0x4ff60a[_0x4c07('0x35')]=_0x4ff60a[_0x4c07('0x35')][_0x4c07('0x44')]?_0x4ff60a['attributes']:_0x36b7cb[_0x4c07('0x34')];_0x4ff60a['order']=qs[_0x4c07('0x3a')](_0x3ebc4c[_0x4c07('0x30')][_0x4c07('0x3a')]);_0x4ff60a[_0x4c07('0x3b')]=qs['filters'](_['pick'](_0x3ebc4c[_0x4c07('0x30')],_0x36b7cb[_0x4c07('0x32')]));if(_0x3ebc4c[_0x4c07('0x30')][_0x4c07('0x3c')]){_0x4ff60a[_0x4c07('0x3b')]=_[_0x4c07('0x3d')](_0x4ff60a[_0x4c07('0x3b')],{'$or':_['map'](_0x4ff60a[_0x4c07('0x35')],function(_0x5f37a1){var _0x315817={};_0x315817[_0x5f37a1]={'$like':'%'+_0x3ebc4c[_0x4c07('0x30')]['filter']+'%'};return _0x315817;})});}_0x4ff60a=_['merge']({},_0x4ff60a,_0x3ebc4c[_0x4c07('0x3f')]);return _0x4de018[_0x4c07('0x4a')](_0x4ff60a);}})[_0x4c07('0x25')](function(_0x1e9d02){if(_0x1e9d02){_0x6a3ac3=_0x1e9d02[_0x4c07('0x44')];if(!_0x3ebc4c[_0x4c07('0x30')][_0x4c07('0x37')](_0x4c07('0x38'))){_0x4ff60a[_0x4c07('0x1f')]=qs[_0x4c07('0x1f')](_0x3ebc4c[_0x4c07('0x30')]['limit']);_0x4ff60a['offset']=qs[_0x4c07('0x20')](_0x3ebc4c[_0x4c07('0x30')][_0x4c07('0x20')]);}return _0x4de018[_0x4c07('0x4a')](_0x4ff60a);}})[_0x4c07('0x25')](function(_0x41e5c4){if(_0x41e5c4){return _0x41e5c4?{'count':_0x6a3ac3,'rows':_0x41e5c4}:null;}})[_0x4c07('0x25')](respondWithResult(_0x2a1599,null))[_0x4c07('0x46')](handleError(_0x2a1599,null));};exports['addConfiguration']=function(_0x54440c,_0x36cb36,_0x15dcd9){if(_0x54440c[_0x4c07('0x48')]['id']){delete _0x54440c[_0x4c07('0x48')]['id'];}return db['VtigerAccount'][_0x4c07('0x4c')]({'where':{'id':_0x54440c[_0x4c07('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36cb36,null))[_0x4c07('0x25')](function(_0x210da8){if(_0x210da8){_0x54440c[_0x4c07('0x48')][_0x4c07('0x4d')]=_0x210da8['id'];_0x54440c['body']['Subjects']=integrations[_0x4c07('0x4e')](_0x54440c[_0x4c07('0x48')]['channel'],_0x54440c[_0x4c07('0x48')]['type']);_0x54440c[_0x4c07('0x48')][_0x4c07('0x4f')]=integrations[_0x4c07('0x50')](_0x54440c['body']['channel'],_0x54440c[_0x4c07('0x48')][_0x4c07('0x2e')]);return db[_0x4c07('0x51')][_0x4c07('0x47')](_0x54440c[_0x4c07('0x48')],{'include':[{'model':db[_0x4c07('0x52')],'as':_0x4c07('0x53')},{'model':db[_0x4c07('0x52')],'as':'Descriptions'}]});}return null;})[_0x4c07('0x25')](respondWithResult(_0x36cb36,null))[_0x4c07('0x46')](handleError(_0x36cb36,null));};var md5=require(_0x4c07('0x54'));exports[_0x4c07('0x55')]=function(_0x4a370c,_0x493c19,_0x4870ce){var _0x4b277a=null;var _0x2e3fa3=null;var _0x2dcafe=null;var _0x5765b8=null;var _0x26f38d='';return db[_0x4c07('0x40')][_0x4c07('0x4c')]({'where':{'id':_0x4a370c[_0x4c07('0x4b')]['id']},'attributes':['id','name',_0x4c07('0x56'),_0x4c07('0x57'),'moduleName',_0x4c07('0x58'),_0x4c07('0x59'),_0x4c07('0x5a')]})[_0x4c07('0x25')](handleEntityNotFound(_0x493c19,null))[_0x4c07('0x25')](function(_0x4a193c){if(_0x4a193c){_0x4b277a=_0x4a193c['username'];_0x2e3fa3=_0x4a193c[_0x4c07('0x5a')];_0x2dcafe=_0x4a193c[_0x4c07('0x5b')];_0x26f38d=_0x4a193c[_0x4c07('0x58')];var _0x465459=_0x26f38d[_0x4c07('0x5c')](-0x1);if(_0x465459==='/'){_0x26f38d=_0x26f38d[_0x4c07('0x5d')](0x0,_0x26f38d[_0x4c07('0x5e')](_0x465459));}_0x5765b8=util[_0x4c07('0x5f')]('%s/webservice.php',_0x26f38d);var _0x2596a1={'method':_0x4c07('0x60'),'uri':_0x5765b8,'qs':{'operation':'getchallenge','username':_0x4a193c[_0x4c07('0x56')]},'json':!![]};return rp(_0x2596a1);}})['then'](function(_0x598676){if(_0x598676[_0x4c07('0x61')]){var _0x1fb6d5={'method':_0x4c07('0x62'),'uri':_0x5765b8,'form':{'operation':_0x4c07('0x63'),'username':_0x4b277a,'accessKey':md5(_0x598676[_0x4c07('0x64')][_0x4c07('0x65')]+_0x2e3fa3)},'json':!![]};return rp(_0x1fb6d5);}})['then'](function(_0x550efb){if(_0x550efb[_0x4c07('0x61')]){var _0x2effb7={'method':'GET','uri':_0x5765b8,'qs':{'operation':_0x4c07('0x66'),'username':_0x4b277a,'sessionName':_0x550efb[_0x4c07('0x64')][_0x4c07('0x67')],'elementType':_0x2dcafe},'json':!![]};return rp(_0x2effb7);}})[_0x4c07('0x25')](function(_0x4861df){if(_0x4861df[_0x4c07('0x61')]){var _0x267eeb=['autogenerated',_0x4c07('0x68'),_0x4c07('0x69')];_[_0x4c07('0x6a')](_0x4861df[_0x4c07('0x64')][_0x4c07('0x36')],function(_0x4659e4){return _0x267eeb['includes'](_0x4659e4[_0x4c07('0x2e')][_0x4c07('0x29')]);});_[_0x4c07('0x6a')](_0x4861df[_0x4c07('0x64')][_0x4c07('0x36')],function(_0xe29e6b){return _0xe29e6b[_0x4c07('0x6b')]===_0x4c07('0x6c');});return{'count':_0x4861df[_0x4c07('0x64')][_0x4c07('0x36')][_0x4c07('0x44')],'rows':_[_0x4c07('0x2b')](_0x4861df[_0x4c07('0x64')][_0x4c07('0x36')],function(_0x13aaaf){return{'id':_0x13aaaf['name'],'name':_0x13aaaf['label'],'custom':_[_0x4c07('0x6d')](_0x13aaaf[_0x4c07('0x29')],'cf_')?!![]:![],'options':_0x13aaaf[_0x4c07('0x2e')]['name']===_0x4c07('0x6e')&&_0x13aaaf[_0x4c07('0x2e')][_0x4c07('0x6f')][_0x4c07('0x44')]>0x0?_[_0x4c07('0x2b')](_0x13aaaf['type']['picklistValues'],function(_0x3627b4){return{'name':_0x3627b4['label'],'value':_0x3627b4[_0x4c07('0x70')]};}):[]};})};}})[_0x4c07('0x25')](respondWithResult(_0x493c19,null))['catch'](function(_0x48b90d){console[_0x4c07('0x71')]('vTiger\x20error:\x20'+_0x48b90d);var _0x318d8a=_0x4a370c['query'][_0x4c07('0x72')]?0x1f4:_0x48b90d[_0x4c07('0x73')]||0x1f4;logger['error'](_0x4c07('0x74'),_0x4c07('0x55'),_0x318d8a,JSON[_0x4c07('0x75')](_0x48b90d));delete _0x48b90d[_0x4c07('0x29')];if(_0x318d8a===0x191){_0x318d8a=0x190;}_0x493c19[_0x4c07('0x1b')](_0x318d8a)[_0x4c07('0x76')](_0x4a370c[_0x4c07('0x30')][_0x4c07('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x48b90d['statusCode']}:_0x48b90d);});}; \ No newline at end of file +var _0xc3c6=['map','VtigerAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','update','body','findOne','order','sort','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','channel','VtigerField','Subjects','Descriptions','md5','getFields','description','moduleName','remoteUri','serverUrl','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','describe','result','sessionName','autogenerated','reference','owner','false','label','startsWith','picklist','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index'];(function(_0x251339,_0xdaf1e4){var _0x1297ed=function(_0x54e512){while(--_0x54e512){_0x251339['push'](_0x251339['shift']());}};_0x1297ed(++_0xdaf1e4);}(_0xc3c6,0x1c9));var _0x6c3c=function(_0x478d8b,_0x48be19){_0x478d8b=_0x478d8b-0x0;var _0x18b868=_0xc3c6[_0x478d8b];return _0x18b868;};'use strict';var emlformat=require(_0x6c3c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c3c('0x1'));var jsonpatch=require(_0x6c3c('0x2'));var rp=require(_0x6c3c('0x3'));var moment=require(_0x6c3c('0x4'));var BPromise=require(_0x6c3c('0x5'));var Mustache=require(_0x6c3c('0x6'));var util=require(_0x6c3c('0x7'));var path=require(_0x6c3c('0x8'));var sox=require(_0x6c3c('0x9'));var csv=require(_0x6c3c('0xa'));var ejs=require(_0x6c3c('0xb'));var fs=require('fs');var fs_extra=require(_0x6c3c('0xc'));var _=require(_0x6c3c('0xd'));var squel=require('squel');var crypto=require(_0x6c3c('0xe'));var jsforce=require(_0x6c3c('0xf'));var deskjs=require(_0x6c3c('0x10'));var toCsv=require(_0x6c3c('0xa'));var querystring=require(_0x6c3c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c3c('0x12'));var qs=require(_0x6c3c('0x13'));var as=require(_0x6c3c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c3c('0x15'))(_0x6c3c('0x16'));var utils=require(_0x6c3c('0x17'));var config=require(_0x6c3c('0x18'));var licenseUtil=require(_0x6c3c('0x19'));var db=require(_0x6c3c('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2c440b,_0x50036e){_0x50036e=_0x50036e||0xcc;return function(_0x5d57ae){if(_0x5d57ae){return _0x2c440b[_0x6c3c('0x1b')](_0x50036e);}return _0x2c440b[_0x6c3c('0x1c')](_0x50036e)[_0x6c3c('0x1d')]();};}function respondWithResult(_0x508415,_0x36021a){_0x36021a=_0x36021a||0xc8;return function(_0x81e749){if(_0x81e749){return _0x508415[_0x6c3c('0x1c')](_0x36021a)[_0x6c3c('0x1e')](_0x81e749);}};}function respondWithFilteredResult(_0xc73feb,_0x36a5fc){return function(_0x23af03){if(_0x23af03){var _0x3b76d5=typeof _0x36a5fc['offset']===_0x6c3c('0x1f')&&typeof _0x36a5fc[_0x6c3c('0x20')]===_0x6c3c('0x1f');var _0x33a8d5=_0x23af03[_0x6c3c('0x21')];var _0x404d3f=_0x3b76d5?0x0:_0x36a5fc[_0x6c3c('0x22')];var _0xe680ee=_0x3b76d5?_0x23af03[_0x6c3c('0x21')]:_0x36a5fc[_0x6c3c('0x22')]+_0x36a5fc[_0x6c3c('0x20')];var _0x3ac693;if(_0xe680ee>=_0x33a8d5){_0xe680ee=_0x33a8d5;_0x3ac693=0xc8;}else{_0x3ac693=0xce;}_0xc73feb[_0x6c3c('0x1c')](_0x3ac693);return _0xc73feb[_0x6c3c('0x23')](_0x6c3c('0x24'),_0x404d3f+'-'+_0xe680ee+'/'+_0x33a8d5)[_0x6c3c('0x1e')](_0x23af03);}return null;};}function patchUpdates(_0x1015bb){return function(_0x3285fd){try{jsonpatch[_0x6c3c('0x25')](_0x3285fd,_0x1015bb,!![]);}catch(_0x1b362f){return BPromise[_0x6c3c('0x26')](_0x1b362f);}return _0x3285fd[_0x6c3c('0x27')]();};}function saveUpdates(_0x4d46a4,_0x31e6b5){return function(_0x101b6d){if(_0x101b6d){return _0x101b6d['update'](_0x4d46a4)[_0x6c3c('0x28')](function(_0x3e84b){return _0x3e84b;});}return null;};}function removeEntity(_0xbf9250,_0x2e4f08){return function(_0x1bec12){if(_0x1bec12){return _0x1bec12[_0x6c3c('0x29')]()[_0x6c3c('0x28')](function(){_0xbf9250['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x276b31,_0x8061d8){return function(_0x55731c){if(!_0x55731c){_0x276b31[_0x6c3c('0x1b')](0x194);}return _0x55731c;};}function handleError(_0x416c3a,_0x5bd9b1){_0x5bd9b1=_0x5bd9b1||0x1f4;return function(_0x135632){logger[_0x6c3c('0x2a')](_0x135632[_0x6c3c('0x2b')]);if(_0x135632['name']){delete _0x135632[_0x6c3c('0x2c')];}_0x416c3a[_0x6c3c('0x1c')](_0x5bd9b1)[_0x6c3c('0x2d')](_0x135632);};}exports[_0x6c3c('0x2e')]=function(_0x2ad97c,_0x18d19d){var _0x129032={},_0x116370={},_0x2272c5={'count':0x0,'rows':[]};var _0x592ad8=_[_0x6c3c('0x2f')](db[_0x6c3c('0x30')][_0x6c3c('0x31')],function(_0x11445b){return{'name':_0x11445b[_0x6c3c('0x32')],'type':_0x11445b['type'][_0x6c3c('0x33')]};});_0x116370[_0x6c3c('0x34')]=_['map'](_0x592ad8,_0x6c3c('0x2c'));_0x116370[_0x6c3c('0x35')]=_[_0x6c3c('0x36')](_0x2ad97c[_0x6c3c('0x35')]);_0x116370['filters']=_[_0x6c3c('0x37')](_0x116370[_0x6c3c('0x34')],_0x116370['query']);_0x129032[_0x6c3c('0x38')]=_[_0x6c3c('0x37')](_0x116370[_0x6c3c('0x34')],qs[_0x6c3c('0x39')](_0x2ad97c[_0x6c3c('0x35')][_0x6c3c('0x39')]));_0x129032['attributes']=_0x129032[_0x6c3c('0x38')][_0x6c3c('0x3a')]?_0x129032['attributes']:_0x116370['model'];if(!_0x2ad97c['query'][_0x6c3c('0x3b')](_0x6c3c('0x3c'))){_0x129032[_0x6c3c('0x20')]=qs[_0x6c3c('0x20')](_0x2ad97c[_0x6c3c('0x35')][_0x6c3c('0x20')]);_0x129032[_0x6c3c('0x22')]=qs['offset'](_0x2ad97c[_0x6c3c('0x35')]['offset']);}_0x129032['order']=qs['sort'](_0x2ad97c[_0x6c3c('0x35')]['sort']);_0x129032[_0x6c3c('0x3d')]=qs[_0x6c3c('0x3e')](_[_0x6c3c('0x3f')](_0x2ad97c[_0x6c3c('0x35')],_0x116370[_0x6c3c('0x3e')]),_0x592ad8);if(_0x2ad97c[_0x6c3c('0x35')]['filter']){_0x129032[_0x6c3c('0x3d')]=_['merge'](_0x129032[_0x6c3c('0x3d')],{'$or':_[_0x6c3c('0x2f')](_0x592ad8,function(_0x5089cd){if(_0x5089cd[_0x6c3c('0x40')]!==_0x6c3c('0x41')){var _0x1400fc={};_0x1400fc[_0x5089cd[_0x6c3c('0x2c')]]={'$like':'%'+_0x2ad97c['query'][_0x6c3c('0x42')]+'%'};return _0x1400fc;}})});}_0x129032=_['merge']({},_0x129032,_0x2ad97c[_0x6c3c('0x43')]);var _0x16b6f4={'where':_0x129032[_0x6c3c('0x3d')]};return db[_0x6c3c('0x30')]['count'](_0x16b6f4)['then'](function(_0x16980a){_0x2272c5[_0x6c3c('0x21')]=_0x16980a;if(_0x2ad97c[_0x6c3c('0x35')][_0x6c3c('0x44')]){_0x129032[_0x6c3c('0x45')]=[{'all':!![]}];}return db[_0x6c3c('0x30')][_0x6c3c('0x46')](_0x129032);})[_0x6c3c('0x28')](function(_0x27ef67){_0x2272c5[_0x6c3c('0x47')]=_0x27ef67;return _0x2272c5;})[_0x6c3c('0x28')](respondWithFilteredResult(_0x18d19d,_0x129032))['catch'](handleError(_0x18d19d,null));};exports[_0x6c3c('0x48')]=function(_0x5cc59c,_0x1d2824){var _0x4e1e72={'raw':![],'where':{'id':_0x5cc59c[_0x6c3c('0x49')]['id']}},_0x35bc2c={};_0x35bc2c[_0x6c3c('0x34')]=_['keys'](db['VtigerAccount'][_0x6c3c('0x31')]);_0x35bc2c[_0x6c3c('0x35')]=_[_0x6c3c('0x36')](_0x5cc59c['query']);_0x35bc2c[_0x6c3c('0x3e')]=_[_0x6c3c('0x37')](_0x35bc2c[_0x6c3c('0x34')],_0x35bc2c[_0x6c3c('0x35')]);_0x4e1e72['attributes']=_[_0x6c3c('0x37')](_0x35bc2c['model'],qs[_0x6c3c('0x39')](_0x5cc59c['query'][_0x6c3c('0x39')]));_0x4e1e72[_0x6c3c('0x38')]=_0x4e1e72[_0x6c3c('0x38')]['length']?_0x4e1e72[_0x6c3c('0x38')]:_0x35bc2c[_0x6c3c('0x34')];if(_0x5cc59c['query'][_0x6c3c('0x44')]){_0x4e1e72[_0x6c3c('0x45')]=[{'all':!![]}];}_0x4e1e72=_[_0x6c3c('0x4a')]({},_0x4e1e72,_0x5cc59c['options']);return db['VtigerAccount'][_0x6c3c('0x4b')](_0x4e1e72)[_0x6c3c('0x28')](handleEntityNotFound(_0x1d2824,null))[_0x6c3c('0x28')](respondWithResult(_0x1d2824,null))[_0x6c3c('0x4c')](handleError(_0x1d2824,null));};exports['create']=function(_0x39641d,_0x537039){return db[_0x6c3c('0x30')][_0x6c3c('0x4d')](_0x39641d['body'],{})[_0x6c3c('0x28')](respondWithResult(_0x537039,0xc9))[_0x6c3c('0x4c')](handleError(_0x537039,null));};exports[_0x6c3c('0x4e')]=function(_0x165038,_0x392894){if(_0x165038['body']['id']){delete _0x165038[_0x6c3c('0x4f')]['id'];}return db[_0x6c3c('0x30')][_0x6c3c('0x4b')]({'where':{'id':_0x165038[_0x6c3c('0x49')]['id']}})[_0x6c3c('0x28')](handleEntityNotFound(_0x392894,null))[_0x6c3c('0x28')](saveUpdates(_0x165038[_0x6c3c('0x4f')],null))[_0x6c3c('0x28')](respondWithResult(_0x392894,null))[_0x6c3c('0x4c')](handleError(_0x392894,null));};exports['destroy']=function(_0x1fbe8e,_0x2fb10c){return db[_0x6c3c('0x30')]['find']({'where':{'id':_0x1fbe8e[_0x6c3c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fb10c,null))['then'](removeEntity(_0x2fb10c,null))[_0x6c3c('0x4c')](handleError(_0x2fb10c,null));};exports['getConfigurations']=function(_0x4d9dfb,_0x4d7adb,_0x4d778f){var _0x4caa6a={};var _0x469366={};var _0x22cc01;var _0x38c909;return db[_0x6c3c('0x30')][_0x6c3c('0x50')]({'where':{'id':_0x4d9dfb[_0x6c3c('0x49')]['id']}})[_0x6c3c('0x28')](handleEntityNotFound(_0x4d7adb,null))[_0x6c3c('0x28')](function(_0x3e42e4){if(_0x3e42e4){_0x22cc01=_0x3e42e4;_0x469366['model']=_[_0x6c3c('0x36')](db['VtigerConfiguration'][_0x6c3c('0x31')]);_0x469366[_0x6c3c('0x35')]=_[_0x6c3c('0x36')](_0x4d9dfb[_0x6c3c('0x35')]);_0x469366['filters']=_['intersection'](_0x469366[_0x6c3c('0x34')],_0x469366[_0x6c3c('0x35')]);_0x4caa6a[_0x6c3c('0x38')]=_['intersection'](_0x469366['model'],qs[_0x6c3c('0x39')](_0x4d9dfb[_0x6c3c('0x35')]['fields']));_0x4caa6a[_0x6c3c('0x38')]=_0x4caa6a['attributes']['length']?_0x4caa6a['attributes']:_0x469366['model'];_0x4caa6a[_0x6c3c('0x51')]=qs[_0x6c3c('0x52')](_0x4d9dfb['query'][_0x6c3c('0x52')]);_0x4caa6a['where']=qs[_0x6c3c('0x3e')](_[_0x6c3c('0x3f')](_0x4d9dfb['query'],_0x469366[_0x6c3c('0x3e')]));if(_0x4d9dfb[_0x6c3c('0x35')][_0x6c3c('0x42')]){_0x4caa6a[_0x6c3c('0x3d')]=_['merge'](_0x4caa6a[_0x6c3c('0x3d')],{'$or':_[_0x6c3c('0x2f')](_0x4caa6a['attributes'],function(_0x5bd2ad){var _0x1d83b6={};_0x1d83b6[_0x5bd2ad]={'$like':'%'+_0x4d9dfb['query'][_0x6c3c('0x42')]+'%'};return _0x1d83b6;})});}_0x4caa6a=_[_0x6c3c('0x4a')]({},_0x4caa6a,_0x4d9dfb[_0x6c3c('0x43')]);return _0x22cc01[_0x6c3c('0x53')](_0x4caa6a);}})['then'](function(_0x2bc052){if(_0x2bc052){_0x38c909=_0x2bc052[_0x6c3c('0x3a')];if(!_0x4d9dfb[_0x6c3c('0x35')]['hasOwnProperty'](_0x6c3c('0x3c'))){_0x4caa6a['limit']=qs[_0x6c3c('0x20')](_0x4d9dfb[_0x6c3c('0x35')][_0x6c3c('0x20')]);_0x4caa6a['offset']=qs[_0x6c3c('0x22')](_0x4d9dfb['query'][_0x6c3c('0x22')]);}return _0x22cc01[_0x6c3c('0x53')](_0x4caa6a);}})['then'](function(_0x3bf24c){if(_0x3bf24c){return _0x3bf24c?{'count':_0x38c909,'rows':_0x3bf24c}:null;}})[_0x6c3c('0x28')](respondWithResult(_0x4d7adb,null))['catch'](handleError(_0x4d7adb,null));};exports[_0x6c3c('0x54')]=function(_0x7c00f0,_0x22a314,_0xbf227c){if(_0x7c00f0['body']['id']){delete _0x7c00f0['body']['id'];}return db[_0x6c3c('0x30')][_0x6c3c('0x50')]({'where':{'id':_0x7c00f0[_0x6c3c('0x49')]['id']}})['then'](handleEntityNotFound(_0x22a314,null))[_0x6c3c('0x28')](function(_0xd10c5d){if(_0xd10c5d){_0x7c00f0[_0x6c3c('0x4f')][_0x6c3c('0x55')]=_0xd10c5d['id'];_0x7c00f0[_0x6c3c('0x4f')]['Subjects']=integrations[_0x6c3c('0x56')](_0x7c00f0['body']['channel'],_0x7c00f0[_0x6c3c('0x4f')][_0x6c3c('0x40')]);_0x7c00f0[_0x6c3c('0x4f')]['Descriptions']=integrations[_0x6c3c('0x57')](_0x7c00f0[_0x6c3c('0x4f')][_0x6c3c('0x58')],_0x7c00f0['body'][_0x6c3c('0x40')]);return db['VtigerConfiguration'][_0x6c3c('0x4d')](_0x7c00f0['body'],{'include':[{'model':db[_0x6c3c('0x59')],'as':_0x6c3c('0x5a')},{'model':db['VtigerField'],'as':_0x6c3c('0x5b')}]});}return null;})[_0x6c3c('0x28')](respondWithResult(_0x22a314,null))[_0x6c3c('0x4c')](handleError(_0x22a314,null));};var md5=require(_0x6c3c('0x5c'));exports[_0x6c3c('0x5d')]=function(_0x588de5,_0x10416d,_0x5ee30c){var _0x694742=null;var _0x46b361=null;var _0x1beaca=null;var _0x256c59=null;var _0x89a9d1='';return db[_0x6c3c('0x30')]['findOne']({'where':{'id':_0x588de5['params']['id']},'attributes':['id',_0x6c3c('0x2c'),'username',_0x6c3c('0x5e'),_0x6c3c('0x5f'),_0x6c3c('0x60'),_0x6c3c('0x61'),'accessKey']})[_0x6c3c('0x28')](handleEntityNotFound(_0x10416d,null))[_0x6c3c('0x28')](function(_0x1b4e85){if(_0x1b4e85){_0x694742=_0x1b4e85[_0x6c3c('0x62')];_0x46b361=_0x1b4e85['accessKey'];_0x1beaca=_0x1b4e85['moduleName'];_0x89a9d1=_0x1b4e85['remoteUri'];var _0x2e8006=_0x89a9d1[_0x6c3c('0x63')](-0x1);if(_0x2e8006==='/'){_0x89a9d1=_0x89a9d1[_0x6c3c('0x64')](0x0,_0x89a9d1[_0x6c3c('0x65')](_0x2e8006));}_0x256c59=util[_0x6c3c('0x66')](_0x6c3c('0x67'),_0x89a9d1);var _0x4e4bec={'method':_0x6c3c('0x68'),'uri':_0x256c59,'qs':{'operation':_0x6c3c('0x69'),'username':_0x1b4e85[_0x6c3c('0x62')]},'json':!![]};return rp(_0x4e4bec);}})[_0x6c3c('0x28')](function(_0x2a521d){if(_0x2a521d['success']){var _0x555283={'method':_0x6c3c('0x6a'),'uri':_0x256c59,'form':{'operation':_0x6c3c('0x6b'),'username':_0x694742,'accessKey':md5(_0x2a521d['result'][_0x6c3c('0x6c')]+_0x46b361)},'json':!![]};return rp(_0x555283);}})[_0x6c3c('0x28')](function(_0x5ad9bf){if(_0x5ad9bf[_0x6c3c('0x6d')]){var _0x59c356={'method':_0x6c3c('0x68'),'uri':_0x256c59,'qs':{'operation':_0x6c3c('0x6e'),'username':_0x694742,'sessionName':_0x5ad9bf[_0x6c3c('0x6f')][_0x6c3c('0x70')],'elementType':_0x1beaca},'json':!![]};return rp(_0x59c356);}})[_0x6c3c('0x28')](function(_0x30cb51){if(_0x30cb51[_0x6c3c('0x6d')]){var _0x226f69=[_0x6c3c('0x71'),_0x6c3c('0x72'),_0x6c3c('0x73')];_['remove'](_0x30cb51[_0x6c3c('0x6f')][_0x6c3c('0x39')],function(_0x127a66){return _0x226f69['includes'](_0x127a66[_0x6c3c('0x40')]['name']);});_['remove'](_0x30cb51[_0x6c3c('0x6f')][_0x6c3c('0x39')],function(_0x48812e){return _0x48812e['editable']===_0x6c3c('0x74');});return{'count':_0x30cb51[_0x6c3c('0x6f')][_0x6c3c('0x39')]['length'],'rows':_['map'](_0x30cb51[_0x6c3c('0x6f')][_0x6c3c('0x39')],function(_0x5168d3){return{'id':_0x5168d3[_0x6c3c('0x2c')],'name':_0x5168d3[_0x6c3c('0x75')],'custom':_[_0x6c3c('0x76')](_0x5168d3['name'],'cf_')?!![]:![],'options':_0x5168d3[_0x6c3c('0x40')][_0x6c3c('0x2c')]===_0x6c3c('0x77')&&_0x5168d3['type']['picklistValues'][_0x6c3c('0x3a')]>0x0?_[_0x6c3c('0x2f')](_0x5168d3[_0x6c3c('0x40')]['picklistValues'],function(_0x16363b){return{'name':_0x16363b[_0x6c3c('0x75')],'value':_0x16363b['value']};}):[]};})};}})[_0x6c3c('0x28')](respondWithResult(_0x10416d,null))[_0x6c3c('0x4c')](function(_0x6d89e3){console['log'](_0x6c3c('0x78')+_0x6d89e3);var _0x25692f=_0x588de5[_0x6c3c('0x35')][_0x6c3c('0x79')]?0x1f4:_0x6d89e3['statusCode']||0x1f4;logger['error'](_0x6c3c('0x7a'),_0x6c3c('0x5d'),_0x25692f,JSON[_0x6c3c('0x7b')](_0x6d89e3));delete _0x6d89e3[_0x6c3c('0x2c')];if(_0x25692f===0x191){_0x25692f=0x190;}_0x10416d['status'](_0x25692f)[_0x6c3c('0x2d')](_0x588de5[_0x6c3c('0x35')]['test']?{'message':_0x6c3c('0x7c'),'statusCode':_0x6d89e3[_0x6c3c('0x7d')]}:_0x6d89e3);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 00c503e..e3c3320 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 _0xd704=['path','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xd704,0xe4));var _0x4d70=function(_0x3d485a,_0x2ac0d8){_0x3d485a=_0x3d485a-0x0;var _0x7d0beb=_0xd704[_0x3d485a];return _0x7d0beb;};'use strict';var _=require(_0x4d70('0x0'));var util=require(_0x4d70('0x1'));var logger=require(_0x4d70('0x2'))(_0x4d70('0x3'));var moment=require(_0x4d70('0x4'));var BPromise=require(_0x4d70('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d70('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4d70('0x7'));var integrations=require(_0x4d70('0x8'));module[_0x4d70('0x9')]=function(_0xeb8996,_0x5f4646){return _0xeb8996[_0x4d70('0xa')](_0x4d70('0xb'),attributes,{'tableName':_0x4d70('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x967c=['../../config/logger','api','moment','bluebird','rimraf','./intVtigerAccount.attributes','exports','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x3ba76d,_0x11d851){var _0x3954f5=function(_0x2e63b3){while(--_0x2e63b3){_0x3ba76d['push'](_0x3ba76d['shift']());}};_0x3954f5(++_0x11d851);}(_0x967c,0x1a0));var _0xc967=function(_0x20f19a,_0x1676a2){_0x20f19a=_0x20f19a-0x0;var _0x2f81e6=_0x967c[_0x20f19a];return _0x2f81e6;};'use strict';var _=require(_0xc967('0x0'));var util=require(_0xc967('0x1'));var logger=require(_0xc967('0x2'))(_0xc967('0x3'));var moment=require(_0xc967('0x4'));var BPromise=require(_0xc967('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc967('0x6'));var config=require('../../config/environment');var attributes=require(_0xc967('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc967('0x8')]=function(_0x1c2fc9,_0x104602){return _0x1c2fc9['define'](_0xc967('0x9'),attributes,{'tableName':_0xc967('0xa'),'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 e036690..2db99bc 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 _0x8f59=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','catch','ShowVtigerAccount','stringify','lodash','util','moment'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x8f59,0x11d));var _0x98f5=function(_0x220d1a,_0x31f1e3){_0x220d1a=_0x220d1a-0x0;var _0x4f0fe3=_0x8f59[_0x220d1a];return _0x4f0fe3;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2acf,_0x5869ee,_0x5e91b3){return new BPromise(function(_0x109417,_0x1cd8a8){return client[_0x98f5('0xc')](_0x2e2acf,_0x5e91b3)['then'](function(_0x456329){logger[_0x98f5('0xd')](_0x98f5('0xe'),_0x5869ee,_0x98f5('0xf'));logger['debug'](_0x98f5('0x10'),_0x5869ee,'request\x20sent',JSON['stringify'](_0x456329));if(_0x456329[_0x98f5('0x11')]){if(_0x456329[_0x98f5('0x11')]['code']===0x1f4){logger[_0x98f5('0x11')](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);return _0x1cd8a8(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}logger['error'](_0x98f5('0xe'),_0x5869ee,_0x456329[_0x98f5('0x11')]['message']);return _0x109417(_0x456329[_0x98f5('0x11')][_0x98f5('0x12')]);}else{logger[_0x98f5('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x98f5('0xf'));_0x109417(_0x456329[_0x98f5('0x13')][_0x98f5('0x12')]);}})['catch'](function(_0x440cfa){logger[_0x98f5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5869ee,_0x440cfa);_0x1cd8a8(_0x440cfa);});});}exports[_0x98f5('0x14')]=function(_0x51a567){var _0x10c57c=this;return new Promise(function(_0x9e42dd,_0x2291d5){return db[_0x98f5('0x15')][_0x98f5('0x16')]({'raw':_0x51a567[_0x98f5('0x17')]?_0x51a567['options'][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x19')]||null:null,'attributes':_0x51a567['options']?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'limit':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')][_0x98f5('0x1b')]||null:null,'include':_0x51a567[_0x98f5('0x17')]?_0x51a567[_0x98f5('0x17')]['include']?_[_0x98f5('0x1c')](_0x51a567['options'][_0x98f5('0x1d')],function(_0x495889){return{'model':db[_0x495889[_0x98f5('0x1e')]],'as':_0x495889['as'],'attributes':_0x495889[_0x98f5('0x1a')],'include':_0x495889[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x495889[_0x98f5('0x1d')],function(_0x18052d){return{'model':db[_0x18052d[_0x98f5('0x1e')]],'as':_0x18052d['as'],'attributes':_0x18052d['attributes'],'include':_0x18052d[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x18052d['include'],function(_0x1a1c55){return{'model':db[_0x1a1c55[_0x98f5('0x1e')]],'as':_0x1a1c55['as'],'attributes':_0x1a1c55[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x230d1b){logger[_0x98f5('0xd')](_0x98f5('0x14'),_0x51a567);logger[_0x98f5('0x20')]('GetVtigerAccount',_0x51a567,JSON['stringify'](_0x230d1b));_0x9e42dd(_0x230d1b);})[_0x98f5('0x21')](function(_0x71661e){logger[_0x98f5('0x11')](_0x98f5('0x14'),_0x71661e[_0x98f5('0x12')],_0x51a567);_0x2291d5(_0x10c57c[_0x98f5('0x11')](0x1f4,_0x71661e['message']));});});};exports[_0x98f5('0x22')]=function(_0x6d7418){var _0x7a922b=this;return new Promise(function(_0xd20823,_0x1e7138){return db[_0x98f5('0x15')]['find']({'raw':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x18')]===undefined?!![]:![]:!![],'where':_0x6d7418[_0x98f5('0x17')]?_0x6d7418['options'][_0x98f5('0x19')]||null:null,'attributes':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1a')]||null:null,'include':_0x6d7418[_0x98f5('0x17')]?_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x6d7418[_0x98f5('0x17')][_0x98f5('0x1d')],function(_0x12d874){return{'model':db[_0x12d874[_0x98f5('0x1e')]],'as':_0x12d874['as'],'attributes':_0x12d874[_0x98f5('0x1a')],'include':_0x12d874[_0x98f5('0x1d')]?_[_0x98f5('0x1c')](_0x12d874[_0x98f5('0x1d')],function(_0x2227f1){return{'model':db[_0x2227f1[_0x98f5('0x1e')]],'as':_0x2227f1['as'],'attributes':_0x2227f1[_0x98f5('0x1a')],'include':_0x2227f1[_0x98f5('0x1d')]?_['map'](_0x2227f1[_0x98f5('0x1d')],function(_0x4aba7a){return{'model':db[_0x4aba7a['model']],'as':_0x4aba7a['as'],'attributes':_0x4aba7a[_0x98f5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x98f5('0x1f')](function(_0x65c03b){logger[_0x98f5('0xd')]('ShowVtigerAccount',_0x6d7418);logger[_0x98f5('0x20')](_0x98f5('0x22'),_0x6d7418,JSON[_0x98f5('0x23')](_0x65c03b));_0xd20823(_0x65c03b);})['catch'](function(_0x17bfe2){logger[_0x98f5('0x11')]('ShowVtigerAccount',_0x17bfe2[_0x98f5('0x12')],_0x6d7418);_0x1e7138(_0x7a922b[_0x98f5('0x11')](0x1f4,_0x17bfe2[_0x98f5('0x12')]));});});}; \ No newline at end of file +var _0x36ee=['message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','find','ShowVtigerAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x58a588,_0x5b3ee6){var _0x27c360=function(_0x4f263b){while(--_0x4f263b){_0x58a588['push'](_0x58a588['shift']());}};_0x27c360(++_0x5b3ee6);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')]({'raw':_0x2184ae['options']?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'limit':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')]['limit']||null:null,'include':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x2184ae[_0xe36e('0x1b')]['include'],function(_0x598a7a){return{'model':db[_0x598a7a[_0xe36e('0x21')]],'as':_0x598a7a['as'],'attributes':_0x598a7a[_0xe36e('0x1e')],'include':_0x598a7a[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x598a7a[_0xe36e('0x1f')],function(_0x1507f9){return{'model':db[_0x1507f9[_0xe36e('0x21')]],'as':_0x1507f9['as'],'attributes':_0x1507f9['attributes'],'include':_0x1507f9[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x1507f9[_0xe36e('0x1f')],function(_0x262caa){return{'model':db[_0x262caa['model']],'as':_0x262caa['as'],'attributes':_0x262caa[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf7b02e){logger['info'](_0xe36e('0x18'),_0x2184ae);logger['debug'](_0xe36e('0x18'),_0x2184ae,JSON['stringify'](_0xf7b02e));_0x21d9a3(_0xf7b02e);})[_0xe36e('0x17')](function(_0x59548b){logger['error']('GetVtigerAccount',_0x59548b['message'],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0x59548b[_0xe36e('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4ac819){var _0x1fa1ec=this;return new Promise(function(_0xb8d44e,_0x259e19){return db[_0xe36e('0x19')][_0xe36e('0x22')]({'raw':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819['options'][_0xe36e('0x1d')]||null:null,'attributes':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1e')]||null:null,'include':_0x4ac819[_0xe36e('0x1b')]?_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4ac819[_0xe36e('0x1b')][_0xe36e('0x1f')],function(_0xf808f5){return{'model':db[_0xf808f5['model']],'as':_0xf808f5['as'],'attributes':_0xf808f5[_0xe36e('0x1e')],'include':_0xf808f5['include']?_['map'](_0xf808f5[_0xe36e('0x1f')],function(_0x4f620d){return{'model':db[_0x4f620d[_0xe36e('0x21')]],'as':_0x4f620d['as'],'attributes':_0x4f620d[_0xe36e('0x1e')],'include':_0x4f620d[_0xe36e('0x1f')]?_[_0xe36e('0x20')](_0x4f620d['include'],function(_0x56135c){return{'model':db[_0x56135c[_0xe36e('0x21')]],'as':_0x56135c['as'],'attributes':_0x56135c[_0xe36e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe36e('0xc')](function(_0x243338){logger['info'](_0xe36e('0x23'),_0x4ac819);logger[_0xe36e('0xe')](_0xe36e('0x23'),_0x4ac819,JSON['stringify'](_0x243338));_0xb8d44e(_0x243338);})[_0xe36e('0x17')](function(_0x2ff8f4){logger['error'](_0xe36e('0x23'),_0x2ff8f4[_0xe36e('0x14')],_0x4ac819);_0x259e19(_0x1fa1ec[_0xe36e('0x12')](0x1f4,_0x2ff8f4[_0xe36e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a486dd8..c859538 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 _0x10cc=['/:id/fields','getFields','/:id/subjects','getSubjects','create','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x43b88c,_0x46fb04){var _0x407299=function(_0x16dcd3){while(--_0x16dcd3){_0x43b88c['push'](_0x43b88c['shift']());}};_0x407299(++_0x46fb04);}(_0x10cc,0x143));var _0xc10c=function(_0x5a8349,_0x2d611c){_0x5a8349=_0x5a8349-0x0;var _0x1bff84=_0x10cc[_0x5a8349];return _0x1bff84;};'use strict';var multer=require(_0xc10c('0x0'));var util=require(_0xc10c('0x1'));var path=require(_0xc10c('0x2'));var timeout=require('connect-timeout');var express=require(_0xc10c('0x3'));var router=express[_0xc10c('0x4')]();var fs_extra=require(_0xc10c('0x5'));var auth=require(_0xc10c('0x6'));var interaction=require(_0xc10c('0x7'));var config=require(_0xc10c('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0xc10c('0x9')]('/',auth[_0xc10c('0xa')](),controller[_0xc10c('0xb')]);router[_0xc10c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc10c('0xc')]);router[_0xc10c('0x9')](_0xc10c('0xd'),auth[_0xc10c('0xa')](),controller[_0xc10c('0xe')]);router[_0xc10c('0x9')](_0xc10c('0xf'),auth[_0xc10c('0xa')](),controller[_0xc10c('0x10')]);router['get']('/:id/descriptions',auth[_0xc10c('0xa')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xc10c('0x11')]);router['put'](_0xc10c('0x12'),auth[_0xc10c('0xa')](),controller[_0xc10c('0x13')]);router[_0xc10c('0x14')](_0xc10c('0x12'),auth[_0xc10c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x591c=['get','show','getFields','/:id/subjects','getSubjects','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index'];(function(_0x3dee2a,_0x1ddf41){var _0x3d4276=function(_0x2c87a7){while(--_0x2c87a7){_0x3dee2a['push'](_0x3dee2a['shift']());}};_0x3d4276(++_0x1ddf41);}(_0x591c,0x1bc));var _0xc591=function(_0x21a960,_0x591ee7){_0x21a960=_0x21a960-0x0;var _0x10421c=_0x591c[_0x21a960];return _0x10421c;};'use strict';var multer=require(_0xc591('0x0'));var util=require(_0xc591('0x1'));var path=require('path');var timeout=require(_0xc591('0x2'));var express=require(_0xc591('0x3'));var router=express[_0xc591('0x4')]();var fs_extra=require(_0xc591('0x5'));var auth=require(_0xc591('0x6'));var interaction=require(_0xc591('0x7'));var config=require(_0xc591('0x8'));var controller=require(_0xc591('0x9'));router['get']('/',auth[_0xc591('0xa')](),controller[_0xc591('0xb')]);router[_0xc591('0xc')]('/:id',auth[_0xc591('0xa')](),controller[_0xc591('0xd')]);router['get']('/:id/fields',auth[_0xc591('0xa')](),controller[_0xc591('0xe')]);router[_0xc591('0xc')](_0xc591('0xf'),auth[_0xc591('0xa')](),controller[_0xc591('0x10')]);router[_0xc591('0xc')]('/:id/descriptions',auth[_0xc591('0xa')](),controller['getDescriptions']);router[_0xc591('0x11')]('/',auth[_0xc591('0xa')](),controller['create']);router[_0xc591('0x12')](_0xc591('0x13'),auth['isAuthenticated'](),controller[_0xc591('0x14')]);router[_0xc591('0x15')](_0xc591('0x13'),auth[_0xc591('0xa')](),controller[_0xc591('0x16')]);module[_0xc591('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index b468841..8e1d220 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 _0xc335=['exports','STRING'];(function(_0x593c41,_0x5bb5a0){var _0x5d5da1=function(_0x48f9fa){while(--_0x48f9fa){_0x593c41['push'](_0x593c41['shift']());}};_0x5d5da1(++_0x5bb5a0);}(_0xc335,0x17c));var _0x5c33=function(_0x5601b3,_0x152d6f){_0x5601b3=_0x5601b3-0x0;var _0x1269f4=_0xc335[_0x5601b3];return _0x1269f4;};'use strict';var Sequelize=require('sequelize');module[_0x5c33('0x0')]={'name':{'type':Sequelize[_0x5c33('0x1')]},'description':{'type':Sequelize[_0x5c33('0x1')]}}; \ No newline at end of file +var _0xf232=['exports','STRING'];(function(_0x17bed1,_0x5be76f){var _0x1ccbc1=function(_0x554a68){while(--_0x554a68){_0x17bed1['push'](_0x17bed1['shift']());}};_0x1ccbc1(++_0x5be76f);}(_0xf232,0xce));var _0x2f23=function(_0x392658,_0x2fa22b){_0x392658=_0x392658-0x0;var _0x59a4b4=_0xf232[_0x392658];return _0x59a4b4;};'use strict';var Sequelize=require('sequelize');module[_0x2f23('0x0')]={'name':{'type':Sequelize[_0x2f23('0x1')]},'description':{'type':Sequelize[_0x2f23('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5e405ff..e86f368 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 _0xe5b0=['merge','includeAll','include','rows','catch','show','params','keys','find','create','body','findOne','VtigerField','order','options','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter'];(function(_0x1fb4a0,_0x48a602){var _0x1094e7=function(_0x25fcd5){while(--_0x25fcd5){_0x1fb4a0['push'](_0x1fb4a0['shift']());}};_0x1094e7(++_0x48a602);}(_0xe5b0,0x156));var _0x0e5b=function(_0x5b9619,_0x4aed16){_0x5b9619=_0x5b9619-0x0;var _0x338e7a=_0xe5b0[_0x5b9619];return _0x338e7a;};'use strict';var emlformat=require(_0x0e5b('0x0'));var rimraf=require(_0x0e5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e5b('0x2'));var rp=require(_0x0e5b('0x3'));var moment=require(_0x0e5b('0x4'));var BPromise=require(_0x0e5b('0x5'));var Mustache=require(_0x0e5b('0x6'));var util=require(_0x0e5b('0x7'));var path=require(_0x0e5b('0x8'));var sox=require(_0x0e5b('0x9'));var csv=require(_0x0e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e5b('0xb'));var _=require(_0x0e5b('0xc'));var squel=require(_0x0e5b('0xd'));var crypto=require(_0x0e5b('0xe'));var jsforce=require(_0x0e5b('0xf'));var deskjs=require(_0x0e5b('0x10'));var toCsv=require(_0x0e5b('0xa'));var querystring=require(_0x0e5b('0x11'));var Papa=require(_0x0e5b('0x12'));var Redis=require('ioredis');var authService=require(_0x0e5b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0e5b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e5b('0x15'))(_0x0e5b('0x16'));var utils=require(_0x0e5b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0e5b('0x18'));var db=require(_0x0e5b('0x19'))['db'];function respondWithStatusCode(_0x39f8c1,_0x5f45a7){_0x5f45a7=_0x5f45a7||0xcc;return function(_0xf8631c){if(_0xf8631c){return _0x39f8c1[_0x0e5b('0x1a')](_0x5f45a7);}return _0x39f8c1[_0x0e5b('0x1b')](_0x5f45a7)['end']();};}function respondWithResult(_0x357ba6,_0x69f9e9){_0x69f9e9=_0x69f9e9||0xc8;return function(_0x28b3d8){if(_0x28b3d8){return _0x357ba6['status'](_0x69f9e9)[_0x0e5b('0x1c')](_0x28b3d8);}};}function respondWithFilteredResult(_0x5a0e8e,_0x468f9b){return function(_0xb5ffd1){if(_0xb5ffd1){var _0x543850=typeof _0x468f9b['offset']===_0x0e5b('0x1d')&&typeof _0x468f9b[_0x0e5b('0x1e')]==='undefined';var _0x509dc3=_0xb5ffd1[_0x0e5b('0x1f')];var _0x44d3ca=_0x543850?0x0:_0x468f9b['offset'];var _0x199278=_0x543850?_0xb5ffd1[_0x0e5b('0x1f')]:_0x468f9b[_0x0e5b('0x20')]+_0x468f9b[_0x0e5b('0x1e')];var _0x3e6bf9;if(_0x199278>=_0x509dc3){_0x199278=_0x509dc3;_0x3e6bf9=0xc8;}else{_0x3e6bf9=0xce;}_0x5a0e8e['status'](_0x3e6bf9);return _0x5a0e8e[_0x0e5b('0x21')](_0x0e5b('0x22'),_0x44d3ca+'-'+_0x199278+'/'+_0x509dc3)[_0x0e5b('0x1c')](_0xb5ffd1);}return null;};}function patchUpdates(_0xc75cfa){return function(_0x476c3d){try{jsonpatch[_0x0e5b('0x23')](_0x476c3d,_0xc75cfa,!![]);}catch(_0x2aa820){return BPromise[_0x0e5b('0x24')](_0x2aa820);}return _0x476c3d['save']();};}function saveUpdates(_0x3f086e,_0x5a8480){return function(_0x31383f){if(_0x31383f){return _0x31383f[_0x0e5b('0x25')](_0x3f086e)['then'](function(_0x340aa8){return _0x340aa8;});}return null;};}function removeEntity(_0x1f4486,_0x5b5b7f){return function(_0x31a2dd){if(_0x31a2dd){return _0x31a2dd[_0x0e5b('0x26')]()[_0x0e5b('0x27')](function(){_0x1f4486[_0x0e5b('0x1b')](0xcc)[_0x0e5b('0x28')]();});}};}function handleEntityNotFound(_0x21f609,_0x12c443){return function(_0x46b38e){if(!_0x46b38e){_0x21f609[_0x0e5b('0x1a')](0x194);}return _0x46b38e;};}function handleError(_0x3ce211,_0x532ecb){_0x532ecb=_0x532ecb||0x1f4;return function(_0x8389d9){logger['error'](_0x8389d9[_0x0e5b('0x29')]);if(_0x8389d9[_0x0e5b('0x2a')]){delete _0x8389d9[_0x0e5b('0x2a')];}_0x3ce211[_0x0e5b('0x1b')](_0x532ecb)[_0x0e5b('0x2b')](_0x8389d9);};}exports[_0x0e5b('0x2c')]=function(_0x56abea,_0x86ec60){var _0x475aed={},_0x57c087={},_0x55af0b={'count':0x0,'rows':[]};var _0x364f3d=_['map'](db[_0x0e5b('0x2d')][_0x0e5b('0x2e')],function(_0x1b5831){return{'name':_0x1b5831[_0x0e5b('0x2f')],'type':_0x1b5831['type'][_0x0e5b('0x30')]};});_0x57c087[_0x0e5b('0x31')]=_[_0x0e5b('0x32')](_0x364f3d,_0x0e5b('0x2a'));_0x57c087['query']=_['keys'](_0x56abea[_0x0e5b('0x33')]);_0x57c087['filters']=_[_0x0e5b('0x34')](_0x57c087[_0x0e5b('0x31')],_0x57c087[_0x0e5b('0x33')]);_0x475aed[_0x0e5b('0x35')]=_[_0x0e5b('0x34')](_0x57c087['model'],qs['fields'](_0x56abea[_0x0e5b('0x33')][_0x0e5b('0x36')]));_0x475aed[_0x0e5b('0x35')]=_0x475aed[_0x0e5b('0x35')][_0x0e5b('0x37')]?_0x475aed[_0x0e5b('0x35')]:_0x57c087[_0x0e5b('0x31')];if(!_0x56abea['query'][_0x0e5b('0x38')](_0x0e5b('0x39'))){_0x475aed[_0x0e5b('0x1e')]=qs[_0x0e5b('0x1e')](_0x56abea[_0x0e5b('0x33')][_0x0e5b('0x1e')]);_0x475aed[_0x0e5b('0x20')]=qs[_0x0e5b('0x20')](_0x56abea['query']['offset']);}_0x475aed['order']=qs[_0x0e5b('0x3a')](_0x56abea[_0x0e5b('0x33')]['sort']);_0x475aed[_0x0e5b('0x3b')]=qs[_0x0e5b('0x3c')](_[_0x0e5b('0x3d')](_0x56abea[_0x0e5b('0x33')],_0x57c087[_0x0e5b('0x3c')]),_0x364f3d);if(_0x56abea[_0x0e5b('0x33')][_0x0e5b('0x3e')]){_0x475aed[_0x0e5b('0x3b')]=_[_0x0e5b('0x3f')](_0x475aed[_0x0e5b('0x3b')],{'$or':_[_0x0e5b('0x32')](_0x364f3d,function(_0x1a8324){if(_0x1a8324['type']!=='VIRTUAL'){var _0x5e8984={};_0x5e8984[_0x1a8324['name']]={'$like':'%'+_0x56abea[_0x0e5b('0x33')]['filter']+'%'};return _0x5e8984;}})});}_0x475aed=_[_0x0e5b('0x3f')]({},_0x475aed,_0x56abea['options']);var _0x16f4d8={'where':_0x475aed['where']};return db[_0x0e5b('0x2d')][_0x0e5b('0x1f')](_0x16f4d8)[_0x0e5b('0x27')](function(_0x25c205){_0x55af0b[_0x0e5b('0x1f')]=_0x25c205;if(_0x56abea[_0x0e5b('0x33')][_0x0e5b('0x40')]){_0x475aed[_0x0e5b('0x41')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x475aed);})[_0x0e5b('0x27')](function(_0x366284){_0x55af0b[_0x0e5b('0x42')]=_0x366284;return _0x55af0b;})[_0x0e5b('0x27')](respondWithFilteredResult(_0x86ec60,_0x475aed))[_0x0e5b('0x43')](handleError(_0x86ec60,null));};exports[_0x0e5b('0x44')]=function(_0x69d903,_0x5256d9){var _0x494e3d={'raw':![],'where':{'id':_0x69d903[_0x0e5b('0x45')]['id']}},_0x494c03={};_0x494c03['model']=_[_0x0e5b('0x46')](db[_0x0e5b('0x2d')][_0x0e5b('0x2e')]);_0x494c03[_0x0e5b('0x33')]=_[_0x0e5b('0x46')](_0x69d903[_0x0e5b('0x33')]);_0x494c03[_0x0e5b('0x3c')]=_['intersection'](_0x494c03['model'],_0x494c03['query']);_0x494e3d['attributes']=_[_0x0e5b('0x34')](_0x494c03[_0x0e5b('0x31')],qs['fields'](_0x69d903['query'][_0x0e5b('0x36')]));_0x494e3d['attributes']=_0x494e3d['attributes'][_0x0e5b('0x37')]?_0x494e3d[_0x0e5b('0x35')]:_0x494c03[_0x0e5b('0x31')];if(_0x69d903[_0x0e5b('0x33')][_0x0e5b('0x40')]){_0x494e3d[_0x0e5b('0x41')]=[{'all':!![]}];}_0x494e3d=_[_0x0e5b('0x3f')]({},_0x494e3d,_0x69d903['options']);return db['VtigerConfiguration'][_0x0e5b('0x47')](_0x494e3d)['then'](handleEntityNotFound(_0x5256d9,null))[_0x0e5b('0x27')](respondWithResult(_0x5256d9,null))[_0x0e5b('0x43')](handleError(_0x5256d9,null));};exports[_0x0e5b('0x48')]=function(_0x40fc14,_0x208fbb){return db[_0x0e5b('0x2d')][_0x0e5b('0x48')](_0x40fc14[_0x0e5b('0x49')],{})[_0x0e5b('0x27')](respondWithResult(_0x208fbb,0xc9))[_0x0e5b('0x43')](handleError(_0x208fbb,null));};exports[_0x0e5b('0x25')]=function(_0x42f3cf,_0xc9d09f){if(_0x42f3cf[_0x0e5b('0x49')]['id']){delete _0x42f3cf[_0x0e5b('0x49')]['id'];}return db['VtigerConfiguration'][_0x0e5b('0x47')]({'where':{'id':_0x42f3cf[_0x0e5b('0x45')]['id']}})['then'](handleEntityNotFound(_0xc9d09f,null))['then'](saveUpdates(_0x42f3cf[_0x0e5b('0x49')],null))[_0x0e5b('0x27')](respondWithResult(_0xc9d09f,null))['catch'](handleError(_0xc9d09f,null));};exports[_0x0e5b('0x26')]=function(_0x254950,_0xb326cd){return db[_0x0e5b('0x2d')]['find']({'where':{'id':_0x254950['params']['id']}})[_0x0e5b('0x27')](handleEntityNotFound(_0xb326cd,null))[_0x0e5b('0x27')](removeEntity(_0xb326cd,null))[_0x0e5b('0x43')](handleError(_0xb326cd,null));};exports['getFields']=function(_0x5f21a8,_0x54d1e8,_0x193001){var _0x136e09={};var _0x29021c={};var _0xb28c72;var _0x247bbd;return db[_0x0e5b('0x2d')][_0x0e5b('0x4a')]({'where':{'id':_0x5f21a8[_0x0e5b('0x45')]['id']}})[_0x0e5b('0x27')](handleEntityNotFound(_0x54d1e8,null))[_0x0e5b('0x27')](function(_0x1bc3e0){if(_0x1bc3e0){_0xb28c72=_0x1bc3e0;_0x29021c[_0x0e5b('0x31')]=_[_0x0e5b('0x46')](db[_0x0e5b('0x4b')][_0x0e5b('0x2e')]);_0x29021c[_0x0e5b('0x33')]=_[_0x0e5b('0x46')](_0x5f21a8[_0x0e5b('0x33')]);_0x29021c[_0x0e5b('0x3c')]=_[_0x0e5b('0x34')](_0x29021c[_0x0e5b('0x31')],_0x29021c['query']);_0x136e09[_0x0e5b('0x35')]=_[_0x0e5b('0x34')](_0x29021c[_0x0e5b('0x31')],qs[_0x0e5b('0x36')](_0x5f21a8[_0x0e5b('0x33')][_0x0e5b('0x36')]));_0x136e09[_0x0e5b('0x35')]=_0x136e09[_0x0e5b('0x35')][_0x0e5b('0x37')]?_0x136e09[_0x0e5b('0x35')]:_0x29021c['model'];_0x136e09[_0x0e5b('0x4c')]=qs[_0x0e5b('0x3a')](_0x5f21a8[_0x0e5b('0x33')][_0x0e5b('0x3a')]);_0x136e09['where']=qs[_0x0e5b('0x3c')](_['pick'](_0x5f21a8[_0x0e5b('0x33')],_0x29021c[_0x0e5b('0x3c')]));if(_0x5f21a8['query'][_0x0e5b('0x3e')]){_0x136e09[_0x0e5b('0x3b')]=_[_0x0e5b('0x3f')](_0x136e09[_0x0e5b('0x3b')],{'$or':_['map'](_0x136e09[_0x0e5b('0x35')],function(_0x11bcea){var _0x10adcb={};_0x10adcb[_0x11bcea]={'$like':'%'+_0x5f21a8[_0x0e5b('0x33')][_0x0e5b('0x3e')]+'%'};return _0x10adcb;})});}_0x136e09=_['merge']({},_0x136e09,_0x5f21a8[_0x0e5b('0x4d')]);return _0xb28c72[_0x0e5b('0x4e')](_0x136e09);}})[_0x0e5b('0x27')](function(_0x48f0fb){if(_0x48f0fb){_0x247bbd=_0x48f0fb[_0x0e5b('0x37')];if(!_0x5f21a8['query'][_0x0e5b('0x38')](_0x0e5b('0x39'))){_0x136e09[_0x0e5b('0x1e')]=qs['limit'](_0x5f21a8[_0x0e5b('0x33')]['limit']);_0x136e09[_0x0e5b('0x20')]=qs[_0x0e5b('0x20')](_0x5f21a8[_0x0e5b('0x33')][_0x0e5b('0x20')]);}return _0xb28c72['getFields'](_0x136e09);}})[_0x0e5b('0x27')](function(_0x4c6a32){if(_0x4c6a32){return _0x4c6a32?{'count':_0x247bbd,'rows':_0x4c6a32}:null;}})[_0x0e5b('0x27')](respondWithResult(_0x54d1e8,null))[_0x0e5b('0x43')](handleError(_0x54d1e8,null));};exports['getSubjects']=function(_0x334a35,_0x314257,_0x1a444d){var _0x547500={};var _0x473b1a={};var _0x4a30fb;var _0x1a1779;return db[_0x0e5b('0x2d')][_0x0e5b('0x4a')]({'where':{'id':_0x334a35['params']['id']}})[_0x0e5b('0x27')](handleEntityNotFound(_0x314257,null))[_0x0e5b('0x27')](function(_0x1208d1){if(_0x1208d1){_0x4a30fb=_0x1208d1;_0x473b1a['model']=_[_0x0e5b('0x46')](db[_0x0e5b('0x4b')][_0x0e5b('0x2e')]);_0x473b1a[_0x0e5b('0x33')]=_[_0x0e5b('0x46')](_0x334a35[_0x0e5b('0x33')]);_0x473b1a[_0x0e5b('0x3c')]=_[_0x0e5b('0x34')](_0x473b1a['model'],_0x473b1a[_0x0e5b('0x33')]);_0x547500['attributes']=_['intersection'](_0x473b1a[_0x0e5b('0x31')],qs[_0x0e5b('0x36')](_0x334a35[_0x0e5b('0x33')]['fields']));_0x547500[_0x0e5b('0x35')]=_0x547500['attributes']['length']?_0x547500['attributes']:_0x473b1a[_0x0e5b('0x31')];_0x547500['order']=qs['sort'](_0x334a35[_0x0e5b('0x33')][_0x0e5b('0x3a')]);_0x547500['where']=qs[_0x0e5b('0x3c')](_['pick'](_0x334a35['query'],_0x473b1a[_0x0e5b('0x3c')]));if(_0x334a35[_0x0e5b('0x33')][_0x0e5b('0x3e')]){_0x547500[_0x0e5b('0x3b')]=_[_0x0e5b('0x3f')](_0x547500[_0x0e5b('0x3b')],{'$or':_[_0x0e5b('0x32')](_0x547500[_0x0e5b('0x35')],function(_0x499d13){var _0x4d7ffa={};_0x4d7ffa[_0x499d13]={'$like':'%'+_0x334a35[_0x0e5b('0x33')]['filter']+'%'};return _0x4d7ffa;})});}_0x547500=_[_0x0e5b('0x3f')]({},_0x547500,_0x334a35[_0x0e5b('0x4d')]);return _0x4a30fb[_0x0e5b('0x4f')](_0x547500);}})['then'](function(_0x24af91){if(_0x24af91){_0x1a1779=_0x24af91[_0x0e5b('0x37')];if(!_0x334a35['query'][_0x0e5b('0x38')](_0x0e5b('0x39'))){_0x547500[_0x0e5b('0x1e')]=qs[_0x0e5b('0x1e')](_0x334a35[_0x0e5b('0x33')][_0x0e5b('0x1e')]);_0x547500[_0x0e5b('0x20')]=qs[_0x0e5b('0x20')](_0x334a35[_0x0e5b('0x33')]['offset']);}return _0x4a30fb[_0x0e5b('0x4f')](_0x547500);}})[_0x0e5b('0x27')](function(_0x140de4){if(_0x140de4){return _0x140de4?{'count':_0x1a1779,'rows':_0x140de4}:null;}})['then'](respondWithResult(_0x314257,null))[_0x0e5b('0x43')](handleError(_0x314257,null));};exports['getDescriptions']=function(_0x260da6,_0x4e7037,_0x20bc1f){var _0x31ac7b={};var _0x1d5fa8={};var _0x181ff2;var _0x4b8e73;return db['VtigerConfiguration'][_0x0e5b('0x4a')]({'where':{'id':_0x260da6[_0x0e5b('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e7037,null))['then'](function(_0x129e19){if(_0x129e19){_0x181ff2=_0x129e19;_0x1d5fa8[_0x0e5b('0x31')]=_[_0x0e5b('0x46')](db[_0x0e5b('0x4b')]['rawAttributes']);_0x1d5fa8['query']=_[_0x0e5b('0x46')](_0x260da6[_0x0e5b('0x33')]);_0x1d5fa8[_0x0e5b('0x3c')]=_[_0x0e5b('0x34')](_0x1d5fa8[_0x0e5b('0x31')],_0x1d5fa8['query']);_0x31ac7b[_0x0e5b('0x35')]=_[_0x0e5b('0x34')](_0x1d5fa8[_0x0e5b('0x31')],qs[_0x0e5b('0x36')](_0x260da6[_0x0e5b('0x33')]['fields']));_0x31ac7b[_0x0e5b('0x35')]=_0x31ac7b[_0x0e5b('0x35')][_0x0e5b('0x37')]?_0x31ac7b[_0x0e5b('0x35')]:_0x1d5fa8[_0x0e5b('0x31')];_0x31ac7b[_0x0e5b('0x4c')]=qs[_0x0e5b('0x3a')](_0x260da6[_0x0e5b('0x33')]['sort']);_0x31ac7b[_0x0e5b('0x3b')]=qs[_0x0e5b('0x3c')](_[_0x0e5b('0x3d')](_0x260da6[_0x0e5b('0x33')],_0x1d5fa8[_0x0e5b('0x3c')]));if(_0x260da6['query'][_0x0e5b('0x3e')]){_0x31ac7b[_0x0e5b('0x3b')]=_[_0x0e5b('0x3f')](_0x31ac7b[_0x0e5b('0x3b')],{'$or':_['map'](_0x31ac7b['attributes'],function(_0x4fc48c){var _0xcf3f81={};_0xcf3f81[_0x4fc48c]={'$like':'%'+_0x260da6[_0x0e5b('0x33')][_0x0e5b('0x3e')]+'%'};return _0xcf3f81;})});}_0x31ac7b=_[_0x0e5b('0x3f')]({},_0x31ac7b,_0x260da6[_0x0e5b('0x4d')]);return _0x181ff2[_0x0e5b('0x50')](_0x31ac7b);}})['then'](function(_0x4662f5){if(_0x4662f5){_0x4b8e73=_0x4662f5['length'];if(!_0x260da6['query'][_0x0e5b('0x38')](_0x0e5b('0x39'))){_0x31ac7b[_0x0e5b('0x1e')]=qs['limit'](_0x260da6[_0x0e5b('0x33')][_0x0e5b('0x1e')]);_0x31ac7b['offset']=qs[_0x0e5b('0x20')](_0x260da6[_0x0e5b('0x33')][_0x0e5b('0x20')]);}return _0x181ff2[_0x0e5b('0x50')](_0x31ac7b);}})[_0x0e5b('0x27')](function(_0x2dd154){if(_0x2dd154){return _0x2dd154?{'count':_0x4b8e73,'rows':_0x2dd154}:null;}})[_0x0e5b('0x27')](respondWithResult(_0x4e7037,null))[_0x0e5b('0x43')](handleError(_0x4e7037,null));}; \ No newline at end of file +var _0x8ea9=['nolimit','order','sort','where','filter','map','type','VIRTUAL','merge','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','update','body','getFields','findOne','VtigerField','pick','options','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','VtigerConfiguration','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x361d9d,_0x31ccb1){var _0x1e3cb2=function(_0x267491){while(--_0x267491){_0x361d9d['push'](_0x361d9d['shift']());}};_0x1e3cb2(++_0x31ccb1);}(_0x8ea9,0xb3));var _0x98ea=function(_0x59a8ae,_0x46793c){_0x59a8ae=_0x59a8ae-0x0;var _0x457e8f=_0x8ea9[_0x59a8ae];return _0x457e8f;};'use strict';var emlformat=require(_0x98ea('0x0'));var rimraf=require(_0x98ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x98ea('0x2'));var moment=require(_0x98ea('0x3'));var BPromise=require(_0x98ea('0x4'));var Mustache=require(_0x98ea('0x5'));var util=require('util');var path=require(_0x98ea('0x6'));var sox=require(_0x98ea('0x7'));var csv=require('to-csv');var ejs=require(_0x98ea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x98ea('0x9'));var toCsv=require(_0x98ea('0xa'));var querystring=require(_0x98ea('0xb'));var Papa=require(_0x98ea('0xc'));var Redis=require('ioredis');var authService=require(_0x98ea('0xd'));var qs=require(_0x98ea('0xe'));var as=require(_0x98ea('0xf'));var hardwareService=require(_0x98ea('0x10'));var logger=require('../../config/logger')(_0x98ea('0x11'));var utils=require('../../config/utils');var config=require(_0x98ea('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x98ea('0x13'))['db'];function respondWithStatusCode(_0x12d5e0,_0x2335b1){_0x2335b1=_0x2335b1||0xcc;return function(_0x2dcf42){if(_0x2dcf42){return _0x12d5e0[_0x98ea('0x14')](_0x2335b1);}return _0x12d5e0[_0x98ea('0x15')](_0x2335b1)['end']();};}function respondWithResult(_0x277a2c,_0x264437){_0x264437=_0x264437||0xc8;return function(_0xa0b1a3){if(_0xa0b1a3){return _0x277a2c['status'](_0x264437)[_0x98ea('0x16')](_0xa0b1a3);}};}function respondWithFilteredResult(_0x50d5db,_0x330948){return function(_0x3a3951){if(_0x3a3951){var _0x113951=typeof _0x330948['offset']===_0x98ea('0x17')&&typeof _0x330948[_0x98ea('0x18')]===_0x98ea('0x17');var _0x33bca5=_0x3a3951['count'];var _0x2a443c=_0x113951?0x0:_0x330948[_0x98ea('0x19')];var _0x2c2f98=_0x113951?_0x3a3951[_0x98ea('0x1a')]:_0x330948[_0x98ea('0x19')]+_0x330948[_0x98ea('0x18')];var _0x4edba2;if(_0x2c2f98>=_0x33bca5){_0x2c2f98=_0x33bca5;_0x4edba2=0xc8;}else{_0x4edba2=0xce;}_0x50d5db[_0x98ea('0x15')](_0x4edba2);return _0x50d5db[_0x98ea('0x1b')](_0x98ea('0x1c'),_0x2a443c+'-'+_0x2c2f98+'/'+_0x33bca5)[_0x98ea('0x16')](_0x3a3951);}return null;};}function patchUpdates(_0x5e0c46){return function(_0x3420df){try{jsonpatch[_0x98ea('0x1d')](_0x3420df,_0x5e0c46,!![]);}catch(_0x3f4273){return BPromise[_0x98ea('0x1e')](_0x3f4273);}return _0x3420df[_0x98ea('0x1f')]();};}function saveUpdates(_0x11bb36,_0x436077){return function(_0x403fb5){if(_0x403fb5){return _0x403fb5['update'](_0x11bb36)[_0x98ea('0x20')](function(_0x358046){return _0x358046;});}return null;};}function removeEntity(_0x1bdcd9,_0x3440fa){return function(_0x21c4c2){if(_0x21c4c2){return _0x21c4c2[_0x98ea('0x21')]()[_0x98ea('0x20')](function(){_0x1bdcd9[_0x98ea('0x15')](0xcc)[_0x98ea('0x22')]();});}};}function handleEntityNotFound(_0x24476b,_0x1e85f7){return function(_0x36115f){if(!_0x36115f){_0x24476b[_0x98ea('0x14')](0x194);}return _0x36115f;};}function handleError(_0x25448d,_0x468de2){_0x468de2=_0x468de2||0x1f4;return function(_0x3c9c0f){logger['error'](_0x3c9c0f[_0x98ea('0x23')]);if(_0x3c9c0f[_0x98ea('0x24')]){delete _0x3c9c0f['name'];}_0x25448d[_0x98ea('0x15')](_0x468de2)[_0x98ea('0x25')](_0x3c9c0f);};}exports[_0x98ea('0x26')]=function(_0x253065,_0x5e0e46){var _0x2a1d49={},_0x1328d3={},_0x30a27d={'count':0x0,'rows':[]};var _0x588d14=_['map'](db[_0x98ea('0x27')]['rawAttributes'],function(_0x233ebd){return{'name':_0x233ebd['fieldName'],'type':_0x233ebd['type']['key']};});_0x1328d3[_0x98ea('0x28')]=_['map'](_0x588d14,_0x98ea('0x24'));_0x1328d3[_0x98ea('0x29')]=_[_0x98ea('0x2a')](_0x253065[_0x98ea('0x29')]);_0x1328d3[_0x98ea('0x2b')]=_[_0x98ea('0x2c')](_0x1328d3[_0x98ea('0x28')],_0x1328d3[_0x98ea('0x29')]);_0x2a1d49[_0x98ea('0x2d')]=_[_0x98ea('0x2c')](_0x1328d3[_0x98ea('0x28')],qs[_0x98ea('0x2e')](_0x253065['query']['fields']));_0x2a1d49['attributes']=_0x2a1d49['attributes'][_0x98ea('0x2f')]?_0x2a1d49[_0x98ea('0x2d')]:_0x1328d3[_0x98ea('0x28')];if(!_0x253065[_0x98ea('0x29')][_0x98ea('0x30')](_0x98ea('0x31'))){_0x2a1d49[_0x98ea('0x18')]=qs[_0x98ea('0x18')](_0x253065[_0x98ea('0x29')][_0x98ea('0x18')]);_0x2a1d49[_0x98ea('0x19')]=qs[_0x98ea('0x19')](_0x253065[_0x98ea('0x29')][_0x98ea('0x19')]);}_0x2a1d49[_0x98ea('0x32')]=qs[_0x98ea('0x33')](_0x253065['query'][_0x98ea('0x33')]);_0x2a1d49[_0x98ea('0x34')]=qs[_0x98ea('0x2b')](_['pick'](_0x253065['query'],_0x1328d3[_0x98ea('0x2b')]),_0x588d14);if(_0x253065[_0x98ea('0x29')][_0x98ea('0x35')]){_0x2a1d49[_0x98ea('0x34')]=_['merge'](_0x2a1d49['where'],{'$or':_[_0x98ea('0x36')](_0x588d14,function(_0x144c50){if(_0x144c50[_0x98ea('0x37')]!==_0x98ea('0x38')){var _0x2868b7={};_0x2868b7[_0x144c50['name']]={'$like':'%'+_0x253065[_0x98ea('0x29')]['filter']+'%'};return _0x2868b7;}})});}_0x2a1d49=_[_0x98ea('0x39')]({},_0x2a1d49,_0x253065['options']);var _0x11a91a={'where':_0x2a1d49[_0x98ea('0x34')]};return db[_0x98ea('0x27')][_0x98ea('0x1a')](_0x11a91a)[_0x98ea('0x20')](function(_0x3c2065){_0x30a27d[_0x98ea('0x1a')]=_0x3c2065;if(_0x253065[_0x98ea('0x29')][_0x98ea('0x3a')]){_0x2a1d49[_0x98ea('0x3b')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x98ea('0x3c')](_0x2a1d49);})['then'](function(_0x3e3175){_0x30a27d['rows']=_0x3e3175;return _0x30a27d;})[_0x98ea('0x20')](respondWithFilteredResult(_0x5e0e46,_0x2a1d49))['catch'](handleError(_0x5e0e46,null));};exports[_0x98ea('0x3d')]=function(_0xa4551a,_0x12880c){var _0x551bdf={'raw':![],'where':{'id':_0xa4551a[_0x98ea('0x3e')]['id']}},_0xd36409={};_0xd36409['model']=_[_0x98ea('0x2a')](db[_0x98ea('0x27')][_0x98ea('0x3f')]);_0xd36409[_0x98ea('0x29')]=_[_0x98ea('0x2a')](_0xa4551a[_0x98ea('0x29')]);_0xd36409[_0x98ea('0x2b')]=_[_0x98ea('0x2c')](_0xd36409[_0x98ea('0x28')],_0xd36409[_0x98ea('0x29')]);_0x551bdf['attributes']=_[_0x98ea('0x2c')](_0xd36409[_0x98ea('0x28')],qs[_0x98ea('0x2e')](_0xa4551a[_0x98ea('0x29')][_0x98ea('0x2e')]));_0x551bdf[_0x98ea('0x2d')]=_0x551bdf[_0x98ea('0x2d')][_0x98ea('0x2f')]?_0x551bdf[_0x98ea('0x2d')]:_0xd36409[_0x98ea('0x28')];if(_0xa4551a[_0x98ea('0x29')][_0x98ea('0x3a')]){_0x551bdf[_0x98ea('0x3b')]=[{'all':!![]}];}_0x551bdf=_[_0x98ea('0x39')]({},_0x551bdf,_0xa4551a['options']);return db['VtigerConfiguration'][_0x98ea('0x40')](_0x551bdf)[_0x98ea('0x20')](handleEntityNotFound(_0x12880c,null))[_0x98ea('0x20')](respondWithResult(_0x12880c,null))[_0x98ea('0x41')](handleError(_0x12880c,null));};exports['create']=function(_0x1631a3,_0x271ff5){return db[_0x98ea('0x27')][_0x98ea('0x42')](_0x1631a3['body'],{})[_0x98ea('0x20')](respondWithResult(_0x271ff5,0xc9))[_0x98ea('0x41')](handleError(_0x271ff5,null));};exports[_0x98ea('0x43')]=function(_0x2213a8,_0x5899c3){if(_0x2213a8[_0x98ea('0x44')]['id']){delete _0x2213a8[_0x98ea('0x44')]['id'];}return db[_0x98ea('0x27')][_0x98ea('0x40')]({'where':{'id':_0x2213a8[_0x98ea('0x3e')]['id']}})[_0x98ea('0x20')](handleEntityNotFound(_0x5899c3,null))[_0x98ea('0x20')](saveUpdates(_0x2213a8[_0x98ea('0x44')],null))[_0x98ea('0x20')](respondWithResult(_0x5899c3,null))[_0x98ea('0x41')](handleError(_0x5899c3,null));};exports[_0x98ea('0x21')]=function(_0x3eb053,_0x5b224b){return db['VtigerConfiguration']['find']({'where':{'id':_0x3eb053['params']['id']}})[_0x98ea('0x20')](handleEntityNotFound(_0x5b224b,null))[_0x98ea('0x20')](removeEntity(_0x5b224b,null))[_0x98ea('0x41')](handleError(_0x5b224b,null));};exports[_0x98ea('0x45')]=function(_0x34bfc1,_0x51791c,_0x43f2bd){var _0x33846f={};var _0x3e3285={};var _0x534119;var _0x596e7a;return db[_0x98ea('0x27')][_0x98ea('0x46')]({'where':{'id':_0x34bfc1['params']['id']}})['then'](handleEntityNotFound(_0x51791c,null))[_0x98ea('0x20')](function(_0x120cd5){if(_0x120cd5){_0x534119=_0x120cd5;_0x3e3285[_0x98ea('0x28')]=_['keys'](db[_0x98ea('0x47')]['rawAttributes']);_0x3e3285['query']=_['keys'](_0x34bfc1['query']);_0x3e3285[_0x98ea('0x2b')]=_[_0x98ea('0x2c')](_0x3e3285[_0x98ea('0x28')],_0x3e3285[_0x98ea('0x29')]);_0x33846f['attributes']=_[_0x98ea('0x2c')](_0x3e3285[_0x98ea('0x28')],qs[_0x98ea('0x2e')](_0x34bfc1[_0x98ea('0x29')]['fields']));_0x33846f[_0x98ea('0x2d')]=_0x33846f['attributes'][_0x98ea('0x2f')]?_0x33846f['attributes']:_0x3e3285[_0x98ea('0x28')];_0x33846f[_0x98ea('0x32')]=qs['sort'](_0x34bfc1['query'][_0x98ea('0x33')]);_0x33846f[_0x98ea('0x34')]=qs['filters'](_[_0x98ea('0x48')](_0x34bfc1[_0x98ea('0x29')],_0x3e3285[_0x98ea('0x2b')]));if(_0x34bfc1[_0x98ea('0x29')][_0x98ea('0x35')]){_0x33846f[_0x98ea('0x34')]=_['merge'](_0x33846f[_0x98ea('0x34')],{'$or':_[_0x98ea('0x36')](_0x33846f['attributes'],function(_0x4af4af){var _0x24335b={};_0x24335b[_0x4af4af]={'$like':'%'+_0x34bfc1[_0x98ea('0x29')][_0x98ea('0x35')]+'%'};return _0x24335b;})});}_0x33846f=_[_0x98ea('0x39')]({},_0x33846f,_0x34bfc1[_0x98ea('0x49')]);return _0x534119['getFields'](_0x33846f);}})[_0x98ea('0x20')](function(_0x5446f0){if(_0x5446f0){_0x596e7a=_0x5446f0[_0x98ea('0x2f')];if(!_0x34bfc1[_0x98ea('0x29')][_0x98ea('0x30')]('nolimit')){_0x33846f['limit']=qs[_0x98ea('0x18')](_0x34bfc1['query']['limit']);_0x33846f[_0x98ea('0x19')]=qs[_0x98ea('0x19')](_0x34bfc1['query']['offset']);}return _0x534119['getFields'](_0x33846f);}})[_0x98ea('0x20')](function(_0x43447f){if(_0x43447f){return _0x43447f?{'count':_0x596e7a,'rows':_0x43447f}:null;}})['then'](respondWithResult(_0x51791c,null))[_0x98ea('0x41')](handleError(_0x51791c,null));};exports[_0x98ea('0x4a')]=function(_0x198b59,_0x476962,_0x2b2beb){var _0x1bad8e={};var _0x17f01c={};var _0x5646ae;var _0x4397a0;return db[_0x98ea('0x27')]['findOne']({'where':{'id':_0x198b59[_0x98ea('0x3e')]['id']}})[_0x98ea('0x20')](handleEntityNotFound(_0x476962,null))[_0x98ea('0x20')](function(_0x1fb443){if(_0x1fb443){_0x5646ae=_0x1fb443;_0x17f01c[_0x98ea('0x28')]=_['keys'](db['VtigerField'][_0x98ea('0x3f')]);_0x17f01c[_0x98ea('0x29')]=_[_0x98ea('0x2a')](_0x198b59[_0x98ea('0x29')]);_0x17f01c['filters']=_[_0x98ea('0x2c')](_0x17f01c[_0x98ea('0x28')],_0x17f01c[_0x98ea('0x29')]);_0x1bad8e['attributes']=_[_0x98ea('0x2c')](_0x17f01c[_0x98ea('0x28')],qs['fields'](_0x198b59[_0x98ea('0x29')]['fields']));_0x1bad8e[_0x98ea('0x2d')]=_0x1bad8e[_0x98ea('0x2d')]['length']?_0x1bad8e[_0x98ea('0x2d')]:_0x17f01c[_0x98ea('0x28')];_0x1bad8e[_0x98ea('0x32')]=qs[_0x98ea('0x33')](_0x198b59['query']['sort']);_0x1bad8e[_0x98ea('0x34')]=qs[_0x98ea('0x2b')](_[_0x98ea('0x48')](_0x198b59[_0x98ea('0x29')],_0x17f01c['filters']));if(_0x198b59['query'][_0x98ea('0x35')]){_0x1bad8e[_0x98ea('0x34')]=_[_0x98ea('0x39')](_0x1bad8e['where'],{'$or':_[_0x98ea('0x36')](_0x1bad8e[_0x98ea('0x2d')],function(_0x5e417e){var _0x2979a2={};_0x2979a2[_0x5e417e]={'$like':'%'+_0x198b59[_0x98ea('0x29')][_0x98ea('0x35')]+'%'};return _0x2979a2;})});}_0x1bad8e=_[_0x98ea('0x39')]({},_0x1bad8e,_0x198b59[_0x98ea('0x49')]);return _0x5646ae['getSubjects'](_0x1bad8e);}})['then'](function(_0x3c8c3e){if(_0x3c8c3e){_0x4397a0=_0x3c8c3e[_0x98ea('0x2f')];if(!_0x198b59[_0x98ea('0x29')][_0x98ea('0x30')]('nolimit')){_0x1bad8e[_0x98ea('0x18')]=qs[_0x98ea('0x18')](_0x198b59[_0x98ea('0x29')][_0x98ea('0x18')]);_0x1bad8e[_0x98ea('0x19')]=qs[_0x98ea('0x19')](_0x198b59[_0x98ea('0x29')][_0x98ea('0x19')]);}return _0x5646ae[_0x98ea('0x4a')](_0x1bad8e);}})[_0x98ea('0x20')](function(_0x429431){if(_0x429431){return _0x429431?{'count':_0x4397a0,'rows':_0x429431}:null;}})[_0x98ea('0x20')](respondWithResult(_0x476962,null))[_0x98ea('0x41')](handleError(_0x476962,null));};exports['getDescriptions']=function(_0x24e476,_0x423583,_0x79ad96){var _0x38ce58={};var _0x3730ed={};var _0x491b79;var _0x59a0c0;return db[_0x98ea('0x27')][_0x98ea('0x46')]({'where':{'id':_0x24e476[_0x98ea('0x3e')]['id']}})[_0x98ea('0x20')](handleEntityNotFound(_0x423583,null))[_0x98ea('0x20')](function(_0x3b19ad){if(_0x3b19ad){_0x491b79=_0x3b19ad;_0x3730ed[_0x98ea('0x28')]=_[_0x98ea('0x2a')](db['VtigerField'][_0x98ea('0x3f')]);_0x3730ed[_0x98ea('0x29')]=_['keys'](_0x24e476['query']);_0x3730ed['filters']=_[_0x98ea('0x2c')](_0x3730ed[_0x98ea('0x28')],_0x3730ed[_0x98ea('0x29')]);_0x38ce58['attributes']=_['intersection'](_0x3730ed['model'],qs[_0x98ea('0x2e')](_0x24e476[_0x98ea('0x29')][_0x98ea('0x2e')]));_0x38ce58['attributes']=_0x38ce58[_0x98ea('0x2d')][_0x98ea('0x2f')]?_0x38ce58[_0x98ea('0x2d')]:_0x3730ed[_0x98ea('0x28')];_0x38ce58[_0x98ea('0x32')]=qs[_0x98ea('0x33')](_0x24e476[_0x98ea('0x29')][_0x98ea('0x33')]);_0x38ce58[_0x98ea('0x34')]=qs[_0x98ea('0x2b')](_[_0x98ea('0x48')](_0x24e476['query'],_0x3730ed[_0x98ea('0x2b')]));if(_0x24e476[_0x98ea('0x29')][_0x98ea('0x35')]){_0x38ce58[_0x98ea('0x34')]=_['merge'](_0x38ce58[_0x98ea('0x34')],{'$or':_[_0x98ea('0x36')](_0x38ce58[_0x98ea('0x2d')],function(_0x578995){var _0x417306={};_0x417306[_0x578995]={'$like':'%'+_0x24e476[_0x98ea('0x29')][_0x98ea('0x35')]+'%'};return _0x417306;})});}_0x38ce58=_[_0x98ea('0x39')]({},_0x38ce58,_0x24e476[_0x98ea('0x49')]);return _0x491b79['getDescriptions'](_0x38ce58);}})['then'](function(_0x5d6393){if(_0x5d6393){_0x59a0c0=_0x5d6393['length'];if(!_0x24e476[_0x98ea('0x29')]['hasOwnProperty'](_0x98ea('0x31'))){_0x38ce58[_0x98ea('0x18')]=qs[_0x98ea('0x18')](_0x24e476[_0x98ea('0x29')][_0x98ea('0x18')]);_0x38ce58[_0x98ea('0x19')]=qs[_0x98ea('0x19')](_0x24e476[_0x98ea('0x29')]['offset']);}return _0x491b79[_0x98ea('0x4b')](_0x38ce58);}})['then'](function(_0x29dc69){if(_0x29dc69){return _0x29dc69?{'count':_0x59a0c0,'rows':_0x29dc69}:null;}})[_0x98ea('0x20')](respondWithResult(_0x423583,null))['catch'](handleError(_0x423583,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index cea992c..b526afa 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 _0x0569=['define','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x149dfc,_0x3c53df){var _0x4246ce=function(_0x159e35){while(--_0x159e35){_0x149dfc['push'](_0x149dfc['shift']());}};_0x4246ce(++_0x3c53df);}(_0x0569,0x146));var _0x9056=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x0569[_0x4191bc];return _0x1ffd4e;};'use strict';var _=require('lodash');var util=require(_0x9056('0x0'));var logger=require(_0x9056('0x1'))(_0x9056('0x2'));var moment=require(_0x9056('0x3'));var BPromise=require(_0x9056('0x4'));var rp=require(_0x9056('0x5'));var fs=require('fs');var path=require(_0x9056('0x6'));var rimraf=require(_0x9056('0x7'));var config=require(_0x9056('0x8'));var attributes=require(_0x9056('0x9'));module['exports']=function(_0x28a78e,_0x54c993){return _0x28a78e[_0x9056('0xa')]('VtigerConfiguration',attributes,{'tableName':_0x9056('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60b4=['./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4f486d,_0x3152c6){var _0x55470c=function(_0x411122){while(--_0x411122){_0x4f486d['push'](_0x4f486d['shift']());}};_0x55470c(++_0x3152c6);}(_0x60b4,0x1bc));var _0x460b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x460b('0x0'));var util=require(_0x460b('0x1'));var logger=require('../../config/logger')(_0x460b('0x2'));var moment=require(_0x460b('0x3'));var BPromise=require(_0x460b('0x4'));var rp=require(_0x460b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x460b('0x6'));var attributes=require(_0x460b('0x7'));module[_0x460b('0x8')]=function(_0x3f242f,_0x1fd114){return _0x3f242f[_0x460b('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x460b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 0b3ab19..cb163ca 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 _0x60e9=['jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x7c2035,_0x13334){var _0x50f5c1=function(_0x20a9b4){while(--_0x20a9b4){_0x7c2035['push'](_0x7c2035['shift']());}};_0x50f5c1(++_0x13334);}(_0x60e9,0x116));var _0x960e=function(_0x4305ac,_0x12e430){_0x4305ac=_0x4305ac-0x0;var _0xfdaae0=_0x60e9[_0x4305ac];return _0xfdaae0;};'use strict';var _=require(_0x960e('0x0'));var util=require(_0x960e('0x1'));var moment=require(_0x960e('0x2'));var BPromise=require('bluebird');var rs=require(_0x960e('0x3'));var fs=require('fs');var Redis=require(_0x960e('0x4'));var db=require(_0x960e('0x5'))['db'];var utils=require(_0x960e('0x6'));var logger=require(_0x960e('0x7'))(_0x960e('0x8'));var config=require(_0x960e('0x9'));var jayson=require(_0x960e('0xa'));var client=jayson['client'][_0x960e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe954dd,_0x39d928,_0x4d63b7){return new BPromise(function(_0x3e9b41,_0x506c9e){return client[_0x960e('0xc')](_0xe954dd,_0x4d63b7)[_0x960e('0xd')](function(_0x599c84){logger[_0x960e('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x39d928,_0x960e('0xf'));logger[_0x960e('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x39d928,_0x960e('0xf'),JSON[_0x960e('0x11')](_0x599c84));if(_0x599c84['error']){if(_0x599c84[_0x960e('0x12')][_0x960e('0x13')]===0x1f4){logger[_0x960e('0x12')](_0x960e('0x14'),_0x39d928,_0x599c84[_0x960e('0x12')][_0x960e('0x15')]);return _0x506c9e(_0x599c84[_0x960e('0x12')][_0x960e('0x15')]);}logger[_0x960e('0x12')](_0x960e('0x14'),_0x39d928,_0x599c84[_0x960e('0x12')]['message']);return _0x3e9b41(_0x599c84['error'][_0x960e('0x15')]);}else{logger[_0x960e('0xe')](_0x960e('0x14'),_0x39d928,_0x960e('0xf'));_0x3e9b41(_0x599c84[_0x960e('0x16')]['message']);}})[_0x960e('0x17')](function(_0x1b3660){logger[_0x960e('0x12')](_0x960e('0x14'),_0x39d928,_0x1b3660);_0x506c9e(_0x1b3660);});});} \ No newline at end of file +var _0xde3d=['request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5e0914,_0x481afe){var _0x5eebff=function(_0x34c6f3){while(--_0x34c6f3){_0x5e0914['push'](_0x5e0914['shift']());}};_0x5eebff(++_0x481afe);}(_0xde3d,0x15e));var _0xdde3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde3d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdde3('0x0'));var util=require(_0xdde3('0x1'));var moment=require(_0xdde3('0x2'));var BPromise=require(_0xdde3('0x3'));var rs=require(_0xdde3('0x4'));var fs=require('fs');var Redis=require(_0xdde3('0x5'));var db=require(_0xdde3('0x6'))['db'];var utils=require(_0xdde3('0x7'));var logger=require(_0xdde3('0x8'))(_0xdde3('0x9'));var config=require(_0xdde3('0xa'));var jayson=require(_0xdde3('0xb'));var client=jayson[_0xdde3('0xc')][_0xdde3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x42e48d,_0x1f8153,_0x58776d){return new BPromise(function(_0x10c4b1,_0x17685a){return client[_0xdde3('0xe')](_0x42e48d,_0x58776d)[_0xdde3('0xf')](function(_0x37153e){logger[_0xdde3('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f8153,'request\x20sent');logger[_0xdde3('0x11')](_0xdde3('0x12'),_0x1f8153,_0xdde3('0x13'),JSON[_0xdde3('0x14')](_0x37153e));if(_0x37153e[_0xdde3('0x15')]){if(_0x37153e[_0xdde3('0x15')][_0xdde3('0x16')]===0x1f4){logger[_0xdde3('0x15')](_0xdde3('0x17'),_0x1f8153,_0x37153e[_0xdde3('0x15')][_0xdde3('0x18')]);return _0x17685a(_0x37153e['error']['message']);}logger['error'](_0xdde3('0x17'),_0x1f8153,_0x37153e['error']['message']);return _0x10c4b1(_0x37153e['error'][_0xdde3('0x18')]);}else{logger[_0xdde3('0x10')](_0xdde3('0x17'),_0x1f8153,'request\x20sent');_0x10c4b1(_0x37153e[_0xdde3('0x19')][_0xdde3('0x18')]);}})['catch'](function(_0x106c6b){logger[_0xdde3('0x15')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f8153,_0x106c6b);_0x17685a(_0x106c6b);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 685885a..8e291fb 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 _0xaaf1=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xaaf1,0x6a));var _0x1aaf=function(_0x2e0114,_0x15c885){_0x2e0114=_0x2e0114-0x0;var _0x50df1b=_0xaaf1[_0x2e0114];return _0x50df1b;};'use strict';var multer=require('multer');var util=require(_0x1aaf('0x0'));var path=require('path');var timeout=require(_0x1aaf('0x1'));var express=require(_0x1aaf('0x2'));var router=express[_0x1aaf('0x3')]();var fs_extra=require(_0x1aaf('0x4'));var auth=require(_0x1aaf('0x5'));var interaction=require(_0x1aaf('0x6'));var config=require(_0x1aaf('0x7'));var controller=require(_0x1aaf('0x8'));router[_0x1aaf('0x9')]('/',auth[_0x1aaf('0xa')](),controller[_0x1aaf('0xb')]);router[_0x1aaf('0x9')]('/:id',auth[_0x1aaf('0xa')](),controller[_0x1aaf('0xc')]);router[_0x1aaf('0xd')]('/',auth[_0x1aaf('0xa')](),controller[_0x1aaf('0xe')]);router[_0x1aaf('0xf')](_0x1aaf('0x10'),auth['isAuthenticated'](),controller[_0x1aaf('0x11')]);router[_0x1aaf('0x12')](_0x1aaf('0x10'),auth[_0x1aaf('0xa')](),controller[_0x1aaf('0x13')]);module[_0x1aaf('0x14')]=router; \ No newline at end of file +var _0x8bc5=['post','create','put','/:id','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x8bc5,0xb0));var _0x58bc=function(_0x3bee83,_0x4a6401){_0x3bee83=_0x3bee83-0x0;var _0x26117b=_0x8bc5[_0x3bee83];return _0x26117b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x58bc('0x0'));var express=require(_0x58bc('0x1'));var router=express[_0x58bc('0x2')]();var fs_extra=require(_0x58bc('0x3'));var auth=require(_0x58bc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x58bc('0x5'));var controller=require(_0x58bc('0x6'));router[_0x58bc('0x7')]('/',auth[_0x58bc('0x8')](),controller[_0x58bc('0x9')]);router[_0x58bc('0x7')]('/:id',auth[_0x58bc('0x8')](),controller[_0x58bc('0xa')]);router[_0x58bc('0xb')]('/',auth[_0x58bc('0x8')](),controller[_0x58bc('0xc')]);router[_0x58bc('0xd')]('/:id',auth[_0x58bc('0x8')](),controller['update']);router['delete'](_0x58bc('0xe'),auth[_0x58bc('0x8')](),controller[_0x58bc('0xf')]);module[_0x58bc('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 0304fa4..4b07389 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 _0xad53=['exports','ENUM','string','variable','customVariable','STRING','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xad53,0xd1));var _0x3ad5=function(_0x3ea2ff,_0x148396){_0x3ea2ff=_0x3ea2ff-0x0;var _0x164122=_0xad53[_0x3ea2ff];return _0x164122;};'use strict';var Sequelize=require(_0x3ad5('0x0'));module[_0x3ad5('0x1')]={'type':{'type':Sequelize[_0x3ad5('0x2')](_0x3ad5('0x3'),_0x3ad5('0x4'),_0x3ad5('0x5'),'keyValue','picklist'),'defaultValue':_0x3ad5('0x3')},'content':{'type':Sequelize[_0x3ad5('0x6')]},'key':{'type':Sequelize[_0x3ad5('0x6')]},'keyType':{'type':Sequelize[_0x3ad5('0x2')]('string',_0x3ad5('0x4'),_0x3ad5('0x5'))},'keyContent':{'type':Sequelize[_0x3ad5('0x6')]},'idField':{'type':Sequelize[_0x3ad5('0x6')]},'nameField':{'type':Sequelize[_0x3ad5('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc8be=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x3fcda6,_0x409932){var _0x13c54d=function(_0x2f1576){while(--_0x2f1576){_0x3fcda6['push'](_0x3fcda6['shift']());}};_0x13c54d(++_0x409932);}(_0xc8be,0x149));var _0xec8b=function(_0x1360e3,_0x20d445){_0x1360e3=_0x1360e3-0x0;var _0x2ad81c=_0xc8be[_0x1360e3];return _0x2ad81c;};'use strict';var Sequelize=require(_0xec8b('0x0'));module['exports']={'type':{'type':Sequelize[_0xec8b('0x1')](_0xec8b('0x2'),_0xec8b('0x3'),_0xec8b('0x4'),_0xec8b('0x5'),_0xec8b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xec8b('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xec8b('0x2'),'variable',_0xec8b('0x4'))},'keyContent':{'type':Sequelize[_0xec8b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xec8b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec8b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b855f52..d7f9a63 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 _0x9993=['fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VtigerField','type','query','keys','filters','intersection','model','attributes'];(function(_0x1d8107,_0x4d91ae){var _0x59e251=function(_0x151e6d){while(--_0x151e6d){_0x1d8107['push'](_0x1d8107['shift']());}};_0x59e251(++_0x4d91ae);}(_0x9993,0xfa));var _0x3999=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9993[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x3999('0x0'));var rimraf=require(_0x3999('0x1'));var zipdir=require(_0x3999('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3999('0x3'));var moment=require(_0x3999('0x4'));var BPromise=require(_0x3999('0x5'));var Mustache=require(_0x3999('0x6'));var util=require(_0x3999('0x7'));var path=require(_0x3999('0x8'));var sox=require(_0x3999('0x9'));var csv=require(_0x3999('0xa'));var ejs=require(_0x3999('0xb'));var fs=require('fs');var fs_extra=require(_0x3999('0xc'));var _=require(_0x3999('0xd'));var squel=require(_0x3999('0xe'));var crypto=require(_0x3999('0xf'));var jsforce=require(_0x3999('0x10'));var deskjs=require(_0x3999('0x11'));var toCsv=require(_0x3999('0xa'));var querystring=require(_0x3999('0x12'));var Papa=require(_0x3999('0x13'));var Redis=require(_0x3999('0x14'));var authService=require(_0x3999('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x3999('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3999('0x17'))(_0x3999('0x18'));var utils=require(_0x3999('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3999('0x1a'));var db=require(_0x3999('0x1b'))['db'];function respondWithStatusCode(_0x44375d,_0x1a5175){_0x1a5175=_0x1a5175||0xcc;return function(_0x5bc5f4){if(_0x5bc5f4){return _0x44375d[_0x3999('0x1c')](_0x1a5175);}return _0x44375d[_0x3999('0x1d')](_0x1a5175)['end']();};}function respondWithResult(_0x5a586f,_0x474990){_0x474990=_0x474990||0xc8;return function(_0x1ba666){if(_0x1ba666){return _0x5a586f[_0x3999('0x1d')](_0x474990)[_0x3999('0x1e')](_0x1ba666);}};}function respondWithFilteredResult(_0x2303b4,_0x5e1ca2){return function(_0x4339fd){if(_0x4339fd){var _0x36357a=typeof _0x5e1ca2['offset']==='undefined'&&typeof _0x5e1ca2[_0x3999('0x1f')]===_0x3999('0x20');var _0x12954c=_0x4339fd[_0x3999('0x21')];var _0xfb183c=_0x36357a?0x0:_0x5e1ca2[_0x3999('0x22')];var _0x4f7802=_0x36357a?_0x4339fd[_0x3999('0x21')]:_0x5e1ca2[_0x3999('0x22')]+_0x5e1ca2[_0x3999('0x1f')];var _0xb5e372;if(_0x4f7802>=_0x12954c){_0x4f7802=_0x12954c;_0xb5e372=0xc8;}else{_0xb5e372=0xce;}_0x2303b4[_0x3999('0x1d')](_0xb5e372);return _0x2303b4[_0x3999('0x23')](_0x3999('0x24'),_0xfb183c+'-'+_0x4f7802+'/'+_0x12954c)[_0x3999('0x1e')](_0x4339fd);}return null;};}function patchUpdates(_0x48e836){return function(_0x617efb){try{jsonpatch[_0x3999('0x25')](_0x617efb,_0x48e836,!![]);}catch(_0x1771e9){return BPromise[_0x3999('0x26')](_0x1771e9);}return _0x617efb[_0x3999('0x27')]();};}function saveUpdates(_0xf7a472,_0x4f1777){return function(_0x5ed0bf){if(_0x5ed0bf){return _0x5ed0bf[_0x3999('0x28')](_0xf7a472)[_0x3999('0x29')](function(_0x1ef952){return _0x1ef952;});}return null;};}function removeEntity(_0x5cd106,_0x187a95){return function(_0xfe4adc){if(_0xfe4adc){return _0xfe4adc[_0x3999('0x2a')]()[_0x3999('0x29')](function(){_0x5cd106[_0x3999('0x1d')](0xcc)[_0x3999('0x2b')]();});}};}function handleEntityNotFound(_0x182bb3,_0x28d49b){return function(_0x32c267){if(!_0x32c267){_0x182bb3[_0x3999('0x1c')](0x194);}return _0x32c267;};}function handleError(_0x59966,_0xc7740e){_0xc7740e=_0xc7740e||0x1f4;return function(_0x2f70f1){logger[_0x3999('0x2c')](_0x2f70f1[_0x3999('0x2d')]);if(_0x2f70f1[_0x3999('0x2e')]){delete _0x2f70f1['name'];}_0x59966['status'](_0xc7740e)[_0x3999('0x2f')](_0x2f70f1);};}exports[_0x3999('0x30')]=function(_0x286e50,_0x33f282){var _0xc2eaf9={},_0x2d8c61={},_0x4d8660={'count':0x0,'rows':[]};var _0x1c279d=_[_0x3999('0x31')](db[_0x3999('0x32')]['rawAttributes'],function(_0x1d3863){return{'name':_0x1d3863['fieldName'],'type':_0x1d3863[_0x3999('0x33')]['key']};});_0x2d8c61['model']=_[_0x3999('0x31')](_0x1c279d,_0x3999('0x2e'));_0x2d8c61[_0x3999('0x34')]=_[_0x3999('0x35')](_0x286e50[_0x3999('0x34')]);_0x2d8c61[_0x3999('0x36')]=_[_0x3999('0x37')](_0x2d8c61[_0x3999('0x38')],_0x2d8c61['query']);_0xc2eaf9[_0x3999('0x39')]=_['intersection'](_0x2d8c61['model'],qs['fields'](_0x286e50[_0x3999('0x34')][_0x3999('0x3a')]));_0xc2eaf9[_0x3999('0x39')]=_0xc2eaf9['attributes']['length']?_0xc2eaf9[_0x3999('0x39')]:_0x2d8c61[_0x3999('0x38')];if(!_0x286e50[_0x3999('0x34')][_0x3999('0x3b')](_0x3999('0x3c'))){_0xc2eaf9[_0x3999('0x1f')]=qs['limit'](_0x286e50['query'][_0x3999('0x1f')]);_0xc2eaf9[_0x3999('0x22')]=qs[_0x3999('0x22')](_0x286e50[_0x3999('0x34')][_0x3999('0x22')]);}_0xc2eaf9['order']=qs[_0x3999('0x3d')](_0x286e50[_0x3999('0x34')][_0x3999('0x3d')]);_0xc2eaf9[_0x3999('0x3e')]=qs[_0x3999('0x36')](_['pick'](_0x286e50[_0x3999('0x34')],_0x2d8c61['filters']),_0x1c279d);if(_0x286e50[_0x3999('0x34')][_0x3999('0x3f')]){_0xc2eaf9[_0x3999('0x3e')]=_[_0x3999('0x40')](_0xc2eaf9[_0x3999('0x3e')],{'$or':_[_0x3999('0x31')](_0x1c279d,function(_0x413141){if(_0x413141[_0x3999('0x33')]!==_0x3999('0x41')){var _0x1c7211={};_0x1c7211[_0x413141['name']]={'$like':'%'+_0x286e50[_0x3999('0x34')]['filter']+'%'};return _0x1c7211;}})});}_0xc2eaf9=_['merge']({},_0xc2eaf9,_0x286e50['options']);var _0x3f451c={'where':_0xc2eaf9[_0x3999('0x3e')]};return db[_0x3999('0x32')][_0x3999('0x21')](_0x3f451c)[_0x3999('0x29')](function(_0x10b9f3){_0x4d8660['count']=_0x10b9f3;if(_0x286e50['query'][_0x3999('0x42')]){_0xc2eaf9['include']=[{'all':!![]}];}return db[_0x3999('0x32')][_0x3999('0x43')](_0xc2eaf9);})['then'](function(_0x4aef8f){_0x4d8660[_0x3999('0x44')]=_0x4aef8f;return _0x4d8660;})['then'](respondWithFilteredResult(_0x33f282,_0xc2eaf9))['catch'](handleError(_0x33f282,null));};exports[_0x3999('0x45')]=function(_0x43f027,_0x1a22d8){var _0x4dce9c={'raw':!![],'where':{'id':_0x43f027['params']['id']}},_0x592f99={};_0x592f99[_0x3999('0x38')]=_[_0x3999('0x35')](db[_0x3999('0x32')][_0x3999('0x46')]);_0x592f99['query']=_['keys'](_0x43f027[_0x3999('0x34')]);_0x592f99[_0x3999('0x36')]=_[_0x3999('0x37')](_0x592f99[_0x3999('0x38')],_0x592f99[_0x3999('0x34')]);_0x4dce9c[_0x3999('0x39')]=_[_0x3999('0x37')](_0x592f99[_0x3999('0x38')],qs[_0x3999('0x3a')](_0x43f027[_0x3999('0x34')][_0x3999('0x3a')]));_0x4dce9c[_0x3999('0x39')]=_0x4dce9c[_0x3999('0x39')]['length']?_0x4dce9c[_0x3999('0x39')]:_0x592f99['model'];if(_0x43f027[_0x3999('0x34')][_0x3999('0x42')]){_0x4dce9c[_0x3999('0x47')]=[{'all':!![]}];}_0x4dce9c=_[_0x3999('0x40')]({},_0x4dce9c,_0x43f027[_0x3999('0x48')]);return db[_0x3999('0x32')][_0x3999('0x49')](_0x4dce9c)[_0x3999('0x29')](handleEntityNotFound(_0x1a22d8,null))[_0x3999('0x29')](respondWithResult(_0x1a22d8,null))[_0x3999('0x4a')](handleError(_0x1a22d8,null));};exports[_0x3999('0x4b')]=function(_0x221ecd,_0x387782){return db[_0x3999('0x32')]['create'](_0x221ecd[_0x3999('0x4c')],{})[_0x3999('0x29')](respondWithResult(_0x387782,0xc9))[_0x3999('0x4a')](handleError(_0x387782,null));};exports['update']=function(_0x5c2a9d,_0x431d5f){if(_0x5c2a9d[_0x3999('0x4c')]['id']){delete _0x5c2a9d[_0x3999('0x4c')]['id'];}return db[_0x3999('0x32')][_0x3999('0x49')]({'where':{'id':_0x5c2a9d['params']['id']}})['then'](handleEntityNotFound(_0x431d5f,null))[_0x3999('0x29')](saveUpdates(_0x5c2a9d[_0x3999('0x4c')],null))[_0x3999('0x29')](respondWithResult(_0x431d5f,null))[_0x3999('0x4a')](handleError(_0x431d5f,null));};exports[_0x3999('0x2a')]=function(_0x1d5ed8,_0x27e4b9){return db[_0x3999('0x32')][_0x3999('0x49')]({'where':{'id':_0x1d5ed8['params']['id']}})[_0x3999('0x29')](handleEntityNotFound(_0x27e4b9,null))[_0x3999('0x29')](removeEntity(_0x27e4b9,null))[_0x3999('0x4a')](handleError(_0x27e4b9,null));}; \ No newline at end of file +var _0x8f3f=['intersection','attributes','fields','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','rows','catch','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','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','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x46f0e7,_0x2b5d69){var _0x219793=function(_0xa9686b){while(--_0xa9686b){_0x46f0e7['push'](_0x46f0e7['shift']());}};_0x219793(++_0x2b5d69);}(_0x8f3f,0xe7));var _0xf8f3=function(_0x90b94e,_0x34592e){_0x90b94e=_0x90b94e-0x0;var _0x144935=_0x8f3f[_0x90b94e];return _0x144935;};'use strict';var emlformat=require(_0xf8f3('0x0'));var rimraf=require(_0xf8f3('0x1'));var zipdir=require(_0xf8f3('0x2'));var jsonpatch=require(_0xf8f3('0x3'));var rp=require('request-promise');var moment=require(_0xf8f3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf8f3('0x5'));var util=require(_0xf8f3('0x6'));var path=require(_0xf8f3('0x7'));var sox=require('sox');var csv=require(_0xf8f3('0x8'));var ejs=require(_0xf8f3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf8f3('0xa'));var crypto=require(_0xf8f3('0xb'));var jsforce=require(_0xf8f3('0xc'));var deskjs=require(_0xf8f3('0xd'));var toCsv=require(_0xf8f3('0x8'));var querystring=require(_0xf8f3('0xe'));var Papa=require(_0xf8f3('0xf'));var Redis=require(_0xf8f3('0x10'));var authService=require(_0xf8f3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8f3('0x12'));var logger=require(_0xf8f3('0x13'))(_0xf8f3('0x14'));var utils=require(_0xf8f3('0x15'));var config=require(_0xf8f3('0x16'));var licenseUtil=require(_0xf8f3('0x17'));var db=require(_0xf8f3('0x18'))['db'];function respondWithStatusCode(_0x55dec3,_0x1bcb6b){_0x1bcb6b=_0x1bcb6b||0xcc;return function(_0x3f59bf){if(_0x3f59bf){return _0x55dec3['sendStatus'](_0x1bcb6b);}return _0x55dec3[_0xf8f3('0x19')](_0x1bcb6b)[_0xf8f3('0x1a')]();};}function respondWithResult(_0x31536e,_0x4511e1){_0x4511e1=_0x4511e1||0xc8;return function(_0x251ae6){if(_0x251ae6){return _0x31536e[_0xf8f3('0x19')](_0x4511e1)[_0xf8f3('0x1b')](_0x251ae6);}};}function respondWithFilteredResult(_0x5f341e,_0x5499f0){return function(_0x4c1da5){if(_0x4c1da5){var _0x15b152=typeof _0x5499f0['offset']===_0xf8f3('0x1c')&&typeof _0x5499f0[_0xf8f3('0x1d')]===_0xf8f3('0x1c');var _0x24690a=_0x4c1da5['count'];var _0xdc84ea=_0x15b152?0x0:_0x5499f0[_0xf8f3('0x1e')];var _0x17e922=_0x15b152?_0x4c1da5[_0xf8f3('0x1f')]:_0x5499f0[_0xf8f3('0x1e')]+_0x5499f0[_0xf8f3('0x1d')];var _0x421ab9;if(_0x17e922>=_0x24690a){_0x17e922=_0x24690a;_0x421ab9=0xc8;}else{_0x421ab9=0xce;}_0x5f341e[_0xf8f3('0x19')](_0x421ab9);return _0x5f341e[_0xf8f3('0x20')](_0xf8f3('0x21'),_0xdc84ea+'-'+_0x17e922+'/'+_0x24690a)[_0xf8f3('0x1b')](_0x4c1da5);}return null;};}function patchUpdates(_0x38f1a9){return function(_0x4d237a){try{jsonpatch[_0xf8f3('0x22')](_0x4d237a,_0x38f1a9,!![]);}catch(_0x10a99f){return BPromise[_0xf8f3('0x23')](_0x10a99f);}return _0x4d237a[_0xf8f3('0x24')]();};}function saveUpdates(_0x362ce5,_0x5d0563){return function(_0x32764a){if(_0x32764a){return _0x32764a[_0xf8f3('0x25')](_0x362ce5)[_0xf8f3('0x26')](function(_0x1af2c6){return _0x1af2c6;});}return null;};}function removeEntity(_0x1ab7a3,_0x584e61){return function(_0x24e446){if(_0x24e446){return _0x24e446[_0xf8f3('0x27')]()[_0xf8f3('0x26')](function(){_0x1ab7a3[_0xf8f3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2afd5f,_0x5f10dc){return function(_0x8ffbb7){if(!_0x8ffbb7){_0x2afd5f['sendStatus'](0x194);}return _0x8ffbb7;};}function handleError(_0x1912de,_0x2d9f9f){_0x2d9f9f=_0x2d9f9f||0x1f4;return function(_0x52297b){logger[_0xf8f3('0x28')](_0x52297b['stack']);if(_0x52297b['name']){delete _0x52297b[_0xf8f3('0x29')];}_0x1912de[_0xf8f3('0x19')](_0x2d9f9f)['send'](_0x52297b);};}exports[_0xf8f3('0x2a')]=function(_0x2df451,_0x440009){var _0x519053={},_0x10c32a={},_0x510701={'count':0x0,'rows':[]};var _0x2c26b6=_[_0xf8f3('0x2b')](db[_0xf8f3('0x2c')][_0xf8f3('0x2d')],function(_0x22a1f0){return{'name':_0x22a1f0[_0xf8f3('0x2e')],'type':_0x22a1f0[_0xf8f3('0x2f')][_0xf8f3('0x30')]};});_0x10c32a[_0xf8f3('0x31')]=_[_0xf8f3('0x2b')](_0x2c26b6,_0xf8f3('0x29'));_0x10c32a[_0xf8f3('0x32')]=_[_0xf8f3('0x33')](_0x2df451[_0xf8f3('0x32')]);_0x10c32a[_0xf8f3('0x34')]=_[_0xf8f3('0x35')](_0x10c32a[_0xf8f3('0x31')],_0x10c32a[_0xf8f3('0x32')]);_0x519053[_0xf8f3('0x36')]=_[_0xf8f3('0x35')](_0x10c32a[_0xf8f3('0x31')],qs[_0xf8f3('0x37')](_0x2df451[_0xf8f3('0x32')]['fields']));_0x519053['attributes']=_0x519053[_0xf8f3('0x36')]['length']?_0x519053[_0xf8f3('0x36')]:_0x10c32a[_0xf8f3('0x31')];if(!_0x2df451[_0xf8f3('0x32')][_0xf8f3('0x38')]('nolimit')){_0x519053[_0xf8f3('0x1d')]=qs[_0xf8f3('0x1d')](_0x2df451[_0xf8f3('0x32')][_0xf8f3('0x1d')]);_0x519053[_0xf8f3('0x1e')]=qs[_0xf8f3('0x1e')](_0x2df451[_0xf8f3('0x32')][_0xf8f3('0x1e')]);}_0x519053['order']=qs['sort'](_0x2df451[_0xf8f3('0x32')]['sort']);_0x519053[_0xf8f3('0x39')]=qs[_0xf8f3('0x34')](_[_0xf8f3('0x3a')](_0x2df451[_0xf8f3('0x32')],_0x10c32a[_0xf8f3('0x34')]),_0x2c26b6);if(_0x2df451[_0xf8f3('0x32')][_0xf8f3('0x3b')]){_0x519053[_0xf8f3('0x39')]=_[_0xf8f3('0x3c')](_0x519053[_0xf8f3('0x39')],{'$or':_[_0xf8f3('0x2b')](_0x2c26b6,function(_0x4ba5b4){if(_0x4ba5b4[_0xf8f3('0x2f')]!=='VIRTUAL'){var _0xd1643c={};_0xd1643c[_0x4ba5b4[_0xf8f3('0x29')]]={'$like':'%'+_0x2df451[_0xf8f3('0x32')][_0xf8f3('0x3b')]+'%'};return _0xd1643c;}})});}_0x519053=_[_0xf8f3('0x3c')]({},_0x519053,_0x2df451[_0xf8f3('0x3d')]);var _0xf7087={'where':_0x519053[_0xf8f3('0x39')]};return db['VtigerField'][_0xf8f3('0x1f')](_0xf7087)[_0xf8f3('0x26')](function(_0x2b0b63){_0x510701[_0xf8f3('0x1f')]=_0x2b0b63;if(_0x2df451[_0xf8f3('0x32')][_0xf8f3('0x3e')]){_0x519053[_0xf8f3('0x3f')]=[{'all':!![]}];}return db[_0xf8f3('0x2c')]['findAll'](_0x519053);})['then'](function(_0x3d1057){_0x510701[_0xf8f3('0x40')]=_0x3d1057;return _0x510701;})['then'](respondWithFilteredResult(_0x440009,_0x519053))[_0xf8f3('0x41')](handleError(_0x440009,null));};exports['show']=function(_0x47091c,_0x549624){var _0x17e6ca={'raw':!![],'where':{'id':_0x47091c[_0xf8f3('0x42')]['id']}},_0x29585b={};_0x29585b[_0xf8f3('0x31')]=_[_0xf8f3('0x33')](db['VtigerField'][_0xf8f3('0x2d')]);_0x29585b[_0xf8f3('0x32')]=_[_0xf8f3('0x33')](_0x47091c['query']);_0x29585b[_0xf8f3('0x34')]=_['intersection'](_0x29585b[_0xf8f3('0x31')],_0x29585b[_0xf8f3('0x32')]);_0x17e6ca[_0xf8f3('0x36')]=_[_0xf8f3('0x35')](_0x29585b[_0xf8f3('0x31')],qs[_0xf8f3('0x37')](_0x47091c['query'][_0xf8f3('0x37')]));_0x17e6ca['attributes']=_0x17e6ca['attributes'][_0xf8f3('0x43')]?_0x17e6ca[_0xf8f3('0x36')]:_0x29585b[_0xf8f3('0x31')];if(_0x47091c[_0xf8f3('0x32')][_0xf8f3('0x3e')]){_0x17e6ca[_0xf8f3('0x3f')]=[{'all':!![]}];}_0x17e6ca=_['merge']({},_0x17e6ca,_0x47091c[_0xf8f3('0x3d')]);return db[_0xf8f3('0x2c')]['find'](_0x17e6ca)[_0xf8f3('0x26')](handleEntityNotFound(_0x549624,null))[_0xf8f3('0x26')](respondWithResult(_0x549624,null))[_0xf8f3('0x41')](handleError(_0x549624,null));};exports[_0xf8f3('0x44')]=function(_0x4dc44b,_0x3175d1){return db[_0xf8f3('0x2c')][_0xf8f3('0x44')](_0x4dc44b[_0xf8f3('0x45')],{})[_0xf8f3('0x26')](respondWithResult(_0x3175d1,0xc9))['catch'](handleError(_0x3175d1,null));};exports[_0xf8f3('0x25')]=function(_0x3318e1,_0x39505e){if(_0x3318e1[_0xf8f3('0x45')]['id']){delete _0x3318e1['body']['id'];}return db[_0xf8f3('0x2c')][_0xf8f3('0x46')]({'where':{'id':_0x3318e1[_0xf8f3('0x42')]['id']}})['then'](handleEntityNotFound(_0x39505e,null))[_0xf8f3('0x26')](saveUpdates(_0x3318e1[_0xf8f3('0x45')],null))[_0xf8f3('0x26')](respondWithResult(_0x39505e,null))[_0xf8f3('0x41')](handleError(_0x39505e,null));};exports[_0xf8f3('0x27')]=function(_0x103752,_0x42f6df){return db[_0xf8f3('0x2c')]['find']({'where':{'id':_0x103752[_0xf8f3('0x42')]['id']}})[_0xf8f3('0x26')](handleEntityNotFound(_0x42f6df,null))[_0xf8f3('0x26')](removeEntity(_0x42f6df,null))[_0xf8f3('0x41')](handleError(_0x42f6df,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 114ed41..efd7ae7 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 _0x7255=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util'];(function(_0x46f585,_0x2affad){var _0x2915bb=function(_0x39bd0c){while(--_0x39bd0c){_0x46f585['push'](_0x46f585['shift']());}};_0x2915bb(++_0x2affad);}(_0x7255,0x1db));var _0x5725=function(_0x1a8528,_0x50f473){_0x1a8528=_0x1a8528-0x0;var _0xae3778=_0x7255[_0x1a8528];return _0xae3778;};'use strict';var _=require('lodash');var util=require(_0x5725('0x0'));var logger=require(_0x5725('0x1'))(_0x5725('0x2'));var moment=require(_0x5725('0x3'));var BPromise=require(_0x5725('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5725('0x5'));var rimraf=require(_0x5725('0x6'));var config=require(_0x5725('0x7'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0xd21548,_0x2e45c6){return _0xd21548[_0x5725('0x8')](_0x5725('0x9'),attributes,{'tableName':_0x5725('0xa'),'paranoid':![],'indexes':[{'name':_0x5725('0xb'),'fields':[_0x5725('0xc'),_0x5725('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d3f=['vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField'];(function(_0x54c07c,_0x49bae0){var _0x3872dd=function(_0x9cc488){while(--_0x9cc488){_0x54c07c['push'](_0x54c07c['shift']());}};_0x3872dd(++_0x49bae0);}(_0x1d3f,0x8a));var _0xf1d3=function(_0x42c9c9,_0x26b783){_0x42c9c9=_0x42c9c9-0x0;var _0xefacfc=_0x1d3f[_0x42c9c9];return _0xefacfc;};'use strict';var _=require(_0xf1d3('0x0'));var util=require(_0xf1d3('0x1'));var logger=require(_0xf1d3('0x2'))(_0xf1d3('0x3'));var moment=require(_0xf1d3('0x4'));var BPromise=require('bluebird');var rp=require(_0xf1d3('0x5'));var fs=require('fs');var path=require(_0xf1d3('0x6'));var rimraf=require(_0xf1d3('0x7'));var config=require(_0xf1d3('0x8'));var attributes=require(_0xf1d3('0x9'));module['exports']=function(_0x1eb021,_0xa8dc3c){return _0x1eb021[_0xf1d3('0xa')](_0xf1d3('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xf1d3('0xc'),'fields':[_0xf1d3('0xd'),_0xf1d3('0xe')],'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 3d4fd37..033088c 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 _0x831e=['debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x831e,0xb0));var _0xe831=function(_0x42af98,_0x105e1a){_0x42af98=_0x42af98-0x0;var _0x294e1c=_0x831e[_0x42af98];return _0x294e1c;};'use strict';var _=require(_0xe831('0x0'));var util=require('util');var moment=require(_0xe831('0x1'));var BPromise=require(_0xe831('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe831('0x3'));var db=require(_0xe831('0x4'))['db'];var utils=require(_0xe831('0x5'));var logger=require(_0xe831('0x6'))(_0xe831('0x7'));var config=require(_0xe831('0x8'));var jayson=require(_0xe831('0x9'));var client=jayson[_0xe831('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x582bcd,_0xe43687,_0x3b9078){return new BPromise(function(_0x3f725a,_0x27ff52){return client[_0xe831('0xb')](_0x582bcd,_0x3b9078)[_0xe831('0xc')](function(_0x4b61fe){logger[_0xe831('0xd')](_0xe831('0xe'),_0xe43687,_0xe831('0xf'));logger[_0xe831('0x10')](_0xe831('0x11'),_0xe43687,_0xe831('0xf'),JSON[_0xe831('0x12')](_0x4b61fe));if(_0x4b61fe[_0xe831('0x13')]){if(_0x4b61fe[_0xe831('0x13')][_0xe831('0x14')]===0x1f4){logger[_0xe831('0x13')](_0xe831('0xe'),_0xe43687,_0x4b61fe['error'][_0xe831('0x15')]);return _0x27ff52(_0x4b61fe[_0xe831('0x13')][_0xe831('0x15')]);}logger[_0xe831('0x13')](_0xe831('0xe'),_0xe43687,_0x4b61fe[_0xe831('0x13')][_0xe831('0x15')]);return _0x3f725a(_0x4b61fe[_0xe831('0x13')][_0xe831('0x15')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0xe43687,_0xe831('0xf'));_0x3f725a(_0x4b61fe[_0xe831('0x16')][_0xe831('0x15')]);}})[_0xe831('0x17')](function(_0x2ae6b5){logger[_0xe831('0x13')](_0xe831('0xe'),_0xe43687,_0x2ae6b5);_0x27ff52(_0x2ae6b5);});});} \ No newline at end of file +var _0xf9b6=['jayson/promise','client','request','then','info','request\x20sent','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment'];(function(_0x101172,_0x313305){var _0x5b6b11=function(_0x35a275){while(--_0x35a275){_0x101172['push'](_0x101172['shift']());}};_0x5b6b11(++_0x313305);}(_0xf9b6,0xac));var _0x6f9b=function(_0x59c6dc,_0x2f43d2){_0x59c6dc=_0x59c6dc-0x0;var _0x3ae1b6=_0xf9b6[_0x59c6dc];return _0x3ae1b6;};'use strict';var _=require(_0x6f9b('0x0'));var util=require(_0x6f9b('0x1'));var moment=require(_0x6f9b('0x2'));var BPromise=require(_0x6f9b('0x3'));var rs=require(_0x6f9b('0x4'));var fs=require('fs');var Redis=require(_0x6f9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6f9b('0x6'))('rpc');var config=require(_0x6f9b('0x7'));var jayson=require(_0x6f9b('0x8'));var client=jayson[_0x6f9b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5466e7,_0x3b30c3,_0x4685a4){return new BPromise(function(_0x37fc2b,_0x213559){return client[_0x6f9b('0xa')](_0x5466e7,_0x4685a4)[_0x6f9b('0xb')](function(_0x4c4227){logger[_0x6f9b('0xc')]('VtigerField,\x20%s,\x20%s',_0x3b30c3,_0x6f9b('0xd'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x3b30c3,_0x6f9b('0xd'),JSON['stringify'](_0x4c4227));if(_0x4c4227['error']){if(_0x4c4227[_0x6f9b('0xe')][_0x6f9b('0xf')]===0x1f4){logger[_0x6f9b('0xe')](_0x6f9b('0x10'),_0x3b30c3,_0x4c4227[_0x6f9b('0xe')][_0x6f9b('0x11')]);return _0x213559(_0x4c4227[_0x6f9b('0xe')][_0x6f9b('0x11')]);}logger[_0x6f9b('0xe')](_0x6f9b('0x10'),_0x3b30c3,_0x4c4227['error'][_0x6f9b('0x11')]);return _0x37fc2b(_0x4c4227[_0x6f9b('0xe')][_0x6f9b('0x11')]);}else{logger[_0x6f9b('0xc')](_0x6f9b('0x10'),_0x3b30c3,_0x6f9b('0xd'));_0x37fc2b(_0x4c4227[_0x6f9b('0x12')][_0x6f9b('0x11')]);}})[_0x6f9b('0x13')](function(_0x47ca04){logger[_0x6f9b('0xe')](_0x6f9b('0x10'),_0x3b30c3,_0x47ca04);_0x213559(_0x47ca04);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1ef7d6b..d3ed09a 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 _0xdc59=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdc59,0x12c));var _0x9dc5=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xdc59[_0x3c8e9a];return _0x2d4c57;};'use strict';var multer=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var path=require(_0x9dc5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9dc5('0x3')]();var fs_extra=require(_0x9dc5('0x4'));var auth=require(_0x9dc5('0x5'));var interaction=require(_0x9dc5('0x6'));var config=require(_0x9dc5('0x7'));var controller=require(_0x9dc5('0x8'));router[_0x9dc5('0x9')]('/',auth[_0x9dc5('0xa')](),controller[_0x9dc5('0xb')]);router['get'](_0x9dc5('0xc'),auth[_0x9dc5('0xa')](),controller[_0x9dc5('0xd')]);router[_0x9dc5('0x9')](_0x9dc5('0xe'),auth[_0x9dc5('0xa')](),controller[_0x9dc5('0xf')]);router[_0x9dc5('0x9')](_0x9dc5('0x10'),auth[_0x9dc5('0xa')](),controller['getFields']);router[_0x9dc5('0x11')]('/',auth[_0x9dc5('0xa')](),controller[_0x9dc5('0x12')]);router[_0x9dc5('0x11')]('/:id/configurations',auth[_0x9dc5('0xa')](),controller[_0x9dc5('0x13')]);router[_0x9dc5('0x14')]('/:id',auth[_0x9dc5('0xa')](),controller[_0x9dc5('0x15')]);router[_0x9dc5('0x16')](_0x9dc5('0xc'),auth[_0x9dc5('0xa')](),controller[_0x9dc5('0x17')]);module[_0x9dc5('0x18')]=router; \ No newline at end of file +var _0x3adf=['/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x10d530,_0x1bf710){var _0x33e238=function(_0x40fe43){while(--_0x40fe43){_0x10d530['push'](_0x10d530['shift']());}};_0x33e238(++_0x1bf710);}(_0x3adf,0x1a6));var _0xf3ad=function(_0x17c10a,_0xc9ee44){_0x17c10a=_0x17c10a-0x0;var _0x149440=_0x3adf[_0x17c10a];return _0x149440;};'use strict';var multer=require(_0xf3ad('0x0'));var util=require(_0xf3ad('0x1'));var path=require(_0xf3ad('0x2'));var timeout=require(_0xf3ad('0x3'));var express=require(_0xf3ad('0x4'));var router=express[_0xf3ad('0x5')]();var fs_extra=require(_0xf3ad('0x6'));var auth=require(_0xf3ad('0x7'));var interaction=require(_0xf3ad('0x8'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf3ad('0x9')]('/:id',auth[_0xf3ad('0xa')](),controller['show']);router[_0xf3ad('0x9')](_0xf3ad('0xb'),auth[_0xf3ad('0xa')](),controller[_0xf3ad('0xc')]);router[_0xf3ad('0x9')](_0xf3ad('0xd'),auth[_0xf3ad('0xa')](),controller[_0xf3ad('0xe')]);router[_0xf3ad('0xf')]('/',auth[_0xf3ad('0xa')](),controller['create']);router[_0xf3ad('0xf')](_0xf3ad('0xb'),auth[_0xf3ad('0xa')](),controller[_0xf3ad('0x10')]);router[_0xf3ad('0x11')](_0xf3ad('0x12'),auth[_0xf3ad('0xa')](),controller['update']);router[_0xf3ad('0x13')](_0xf3ad('0x12'),auth[_0xf3ad('0xa')](),controller[_0xf3ad('0x14')]);module[_0xf3ad('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 88b5a6f..abf5630 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 _0x5324=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x14c95b,_0x4acb8d){var _0x8f9fbb=function(_0x569f5c){while(--_0x569f5c){_0x14c95b['push'](_0x14c95b['shift']());}};_0x8f9fbb(++_0x4acb8d);}(_0x5324,0x154));var _0x4532=function(_0x4b7411,_0xfcdba2){_0x4b7411=_0x4b7411-0x0;var _0x5984c7=_0x5324[_0x4b7411];return _0x5984c7;};'use strict';var Sequelize=require(_0x4532('0x0'));module[_0x4532('0x1')]={'name':{'type':Sequelize[_0x4532('0x2')]},'description':{'type':Sequelize[_0x4532('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x4532('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4532('0x2')]},'remoteUri':{'type':Sequelize[_0x4532('0x2')],'unique':_0x4532('0x4')},'authType':{'type':Sequelize[_0x4532('0x5')](_0x4532('0x6'),_0x4532('0x7')),'defaultValue':_0x4532('0x6')},'serverUrl':{'type':Sequelize[_0x4532('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4532('0x8'),_0x4532('0x9')),'defaultValue':_0x4532('0x8')}}; \ No newline at end of file +var _0x81d4=['STRING','username','remoteUri','ENUM','password','integrationTab','newTab','exports'];(function(_0x28f3b4,_0x1acab5){var _0x401cde=function(_0x2114c4){while(--_0x2114c4){_0x28f3b4['push'](_0x28f3b4['shift']());}};_0x401cde(++_0x1acab5);}(_0x81d4,0x197));var _0x481d=function(_0x20bbe0,_0x5a35e5){_0x20bbe0=_0x20bbe0-0x0;var _0x4abc07=_0x81d4[_0x20bbe0];return _0x4abc07;};'use strict';var Sequelize=require('sequelize');module[_0x481d('0x0')]={'name':{'type':Sequelize[_0x481d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x481d('0x1')],'unique':_0x481d('0x2')},'password':{'type':Sequelize[_0x481d('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x481d('0x3')},'authType':{'type':Sequelize[_0x481d('0x4')](_0x481d('0x5'),'token'),'defaultValue':_0x481d('0x5')},'serverUrl':{'type':Sequelize[_0x481d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x481d('0x4')](_0x481d('0x6'),_0x481d('0x7')),'defaultValue':_0x481d('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index e6a6a07..013b22a 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 _0x4ded=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','intersection','include','find','create','body','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','username','password','token','authType','remoteUri','substring','format','%s/%s','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','subject','description','group','assignee','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','type','model','query','filters','fields','attributes','length'];(function(_0x5d6cfe,_0x32cab1){var _0x58b64f=function(_0x2fe469){while(--_0x2fe469){_0x5d6cfe['push'](_0x5d6cfe['shift']());}};_0x58b64f(++_0x32cab1);}(_0x4ded,0x116));var _0xd4de=function(_0x553ab1,_0xc45423){_0x553ab1=_0x553ab1-0x0;var _0x599d7f=_0x4ded[_0x553ab1];return _0x599d7f;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require(_0xd4de('0x9'));var sox=require(_0xd4de('0xa'));var csv=require(_0xd4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4de('0x16'));var db=require(_0xd4de('0x17'))['db'];var integrations=require(_0xd4de('0x18'));function respondWithStatusCode(_0x2aa09d,_0x3ffc72){_0x3ffc72=_0x3ffc72||0xcc;return function(_0x3af6e0){if(_0x3af6e0){return _0x2aa09d[_0xd4de('0x19')](_0x3ffc72);}return _0x2aa09d[_0xd4de('0x1a')](_0x3ffc72)[_0xd4de('0x1b')]();};}function respondWithResult(_0x37cb9f,_0x691ba9){_0x691ba9=_0x691ba9||0xc8;return function(_0xd0d906){if(_0xd0d906){return _0x37cb9f[_0xd4de('0x1a')](_0x691ba9)[_0xd4de('0x1c')](_0xd0d906);}};}function respondWithFilteredResult(_0x102e5b,_0xa7c18b){return function(_0x325fba){if(_0x325fba){var _0x4b0a95=typeof _0xa7c18b['offset']===_0xd4de('0x1d')&&typeof _0xa7c18b[_0xd4de('0x1e')]===_0xd4de('0x1d');var _0x428aa2=_0x325fba['count'];var _0x4d0df6=_0x4b0a95?0x0:_0xa7c18b[_0xd4de('0x1f')];var _0x54b757=_0x4b0a95?_0x325fba[_0xd4de('0x20')]:_0xa7c18b[_0xd4de('0x1f')]+_0xa7c18b['limit'];var _0xc15081;if(_0x54b757>=_0x428aa2){_0x54b757=_0x428aa2;_0xc15081=0xc8;}else{_0xc15081=0xce;}_0x102e5b['status'](_0xc15081);return _0x102e5b[_0xd4de('0x21')](_0xd4de('0x22'),_0x4d0df6+'-'+_0x54b757+'/'+_0x428aa2)[_0xd4de('0x1c')](_0x325fba);}return null;};}function patchUpdates(_0x8e8712){return function(_0x5368f5){try{jsonpatch[_0xd4de('0x23')](_0x5368f5,_0x8e8712,!![]);}catch(_0x47311c){return BPromise[_0xd4de('0x24')](_0x47311c);}return _0x5368f5[_0xd4de('0x25')]();};}function saveUpdates(_0x1c631a,_0x2d092a){return function(_0x1561fd){if(_0x1561fd){return _0x1561fd[_0xd4de('0x26')](_0x1c631a)[_0xd4de('0x27')](function(_0x413f68){return _0x413f68;});}return null;};}function removeEntity(_0x534b37,_0xad333f){return function(_0x88a0b9){if(_0x88a0b9){return _0x88a0b9[_0xd4de('0x28')]()[_0xd4de('0x27')](function(){_0x534b37[_0xd4de('0x1a')](0xcc)[_0xd4de('0x1b')]();});}};}function handleEntityNotFound(_0xffe1cc,_0x36308c){return function(_0x2aa82a){if(!_0x2aa82a){_0xffe1cc[_0xd4de('0x19')](0x194);}return _0x2aa82a;};}function handleError(_0x2ea712,_0xb2d8a1){_0xb2d8a1=_0xb2d8a1||0x1f4;return function(_0x586126){logger[_0xd4de('0x29')](_0x586126[_0xd4de('0x2a')]);if(_0x586126['name']){delete _0x586126[_0xd4de('0x2b')];}_0x2ea712['status'](_0xb2d8a1)[_0xd4de('0x2c')](_0x586126);};}exports[_0xd4de('0x2d')]=function(_0x15d2b7,_0x4fa53a){var _0xd4de93={},_0x36f2f1={},_0x17f0a={'count':0x0,'rows':[]};var _0x50cb73=_[_0xd4de('0x2e')](db[_0xd4de('0x2f')]['rawAttributes'],function(_0x5103b5){return{'name':_0x5103b5['fieldName'],'type':_0x5103b5[_0xd4de('0x30')]['key']};});_0x36f2f1[_0xd4de('0x31')]=_[_0xd4de('0x2e')](_0x50cb73,_0xd4de('0x2b'));_0x36f2f1[_0xd4de('0x32')]=_['keys'](_0x15d2b7[_0xd4de('0x32')]);_0x36f2f1[_0xd4de('0x33')]=_['intersection'](_0x36f2f1[_0xd4de('0x31')],_0x36f2f1[_0xd4de('0x32')]);_0xd4de93['attributes']=_['intersection'](_0x36f2f1[_0xd4de('0x31')],qs[_0xd4de('0x34')](_0x15d2b7[_0xd4de('0x32')][_0xd4de('0x34')]));_0xd4de93['attributes']=_0xd4de93[_0xd4de('0x35')][_0xd4de('0x36')]?_0xd4de93['attributes']:_0x36f2f1[_0xd4de('0x31')];if(!_0x15d2b7[_0xd4de('0x32')][_0xd4de('0x37')](_0xd4de('0x38'))){_0xd4de93[_0xd4de('0x1e')]=qs[_0xd4de('0x1e')](_0x15d2b7['query']['limit']);_0xd4de93[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x15d2b7[_0xd4de('0x32')]['offset']);}_0xd4de93[_0xd4de('0x39')]=qs[_0xd4de('0x3a')](_0x15d2b7['query'][_0xd4de('0x3a')]);_0xd4de93[_0xd4de('0x3b')]=qs[_0xd4de('0x33')](_[_0xd4de('0x3c')](_0x15d2b7['query'],_0x36f2f1['filters']),_0x50cb73);if(_0x15d2b7[_0xd4de('0x32')]['filter']){_0xd4de93[_0xd4de('0x3b')]=_['merge'](_0xd4de93[_0xd4de('0x3b')],{'$or':_[_0xd4de('0x2e')](_0x50cb73,function(_0x21cd77){if(_0x21cd77[_0xd4de('0x30')]!=='VIRTUAL'){var _0x21209d={};_0x21209d[_0x21cd77['name']]={'$like':'%'+_0x15d2b7[_0xd4de('0x32')][_0xd4de('0x3d')]+'%'};return _0x21209d;}})});}_0xd4de93=_[_0xd4de('0x3e')]({},_0xd4de93,_0x15d2b7[_0xd4de('0x3f')]);var _0x349c5f={'where':_0xd4de93[_0xd4de('0x3b')]};return db[_0xd4de('0x2f')]['count'](_0x349c5f)[_0xd4de('0x27')](function(_0x1eb001){_0x17f0a[_0xd4de('0x20')]=_0x1eb001;if(_0x15d2b7[_0xd4de('0x32')][_0xd4de('0x40')]){_0xd4de93['include']=[{'all':!![]}];}return db[_0xd4de('0x2f')][_0xd4de('0x41')](_0xd4de93);})[_0xd4de('0x27')](function(_0x593ee9){_0x17f0a[_0xd4de('0x42')]=_0x593ee9;return _0x17f0a;})[_0xd4de('0x27')](respondWithFilteredResult(_0x4fa53a,_0xd4de93))[_0xd4de('0x43')](handleError(_0x4fa53a,null));};exports['show']=function(_0x3b9026,_0x10a42c){var _0x419c49={'raw':![],'where':{'id':_0x3b9026[_0xd4de('0x44')]['id']}},_0x3f1e22={};_0x3f1e22[_0xd4de('0x31')]=_[_0xd4de('0x45')](db['ZendeskAccount'][_0xd4de('0x46')]);_0x3f1e22[_0xd4de('0x32')]=_[_0xd4de('0x45')](_0x3b9026['query']);_0x3f1e22[_0xd4de('0x33')]=_[_0xd4de('0x47')](_0x3f1e22[_0xd4de('0x31')],_0x3f1e22['query']);_0x419c49['attributes']=_[_0xd4de('0x47')](_0x3f1e22[_0xd4de('0x31')],qs['fields'](_0x3b9026[_0xd4de('0x32')][_0xd4de('0x34')]));_0x419c49[_0xd4de('0x35')]=_0x419c49[_0xd4de('0x35')]['length']?_0x419c49[_0xd4de('0x35')]:_0x3f1e22[_0xd4de('0x31')];if(_0x3b9026[_0xd4de('0x32')][_0xd4de('0x40')]){_0x419c49[_0xd4de('0x48')]=[{'all':!![]}];}_0x419c49=_[_0xd4de('0x3e')]({},_0x419c49,_0x3b9026['options']);return db[_0xd4de('0x2f')][_0xd4de('0x49')](_0x419c49)[_0xd4de('0x27')](handleEntityNotFound(_0x10a42c,null))[_0xd4de('0x27')](respondWithResult(_0x10a42c,null))[_0xd4de('0x43')](handleError(_0x10a42c,null));};exports[_0xd4de('0x4a')]=function(_0x40bf55,_0x425a7e){return db[_0xd4de('0x2f')][_0xd4de('0x4a')](_0x40bf55['body'],{})[_0xd4de('0x27')](respondWithResult(_0x425a7e,0xc9))[_0xd4de('0x43')](handleError(_0x425a7e,null));};exports[_0xd4de('0x26')]=function(_0x518bfe,_0x13a900){if(_0x518bfe[_0xd4de('0x4b')]['id']){delete _0x518bfe[_0xd4de('0x4b')]['id'];}return db[_0xd4de('0x2f')][_0xd4de('0x49')]({'where':{'id':_0x518bfe[_0xd4de('0x44')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x13a900,null))[_0xd4de('0x27')](saveUpdates(_0x518bfe[_0xd4de('0x4b')],null))[_0xd4de('0x27')](respondWithResult(_0x13a900,null))['catch'](handleError(_0x13a900,null));};exports[_0xd4de('0x28')]=function(_0x26d032,_0x215f85){return db[_0xd4de('0x2f')][_0xd4de('0x49')]({'where':{'id':_0x26d032['params']['id']}})['then'](handleEntityNotFound(_0x215f85,null))[_0xd4de('0x27')](removeEntity(_0x215f85,null))[_0xd4de('0x43')](handleError(_0x215f85,null));};exports['getConfigurations']=function(_0x48cb7d,_0x2d8589,_0x368081){var _0x377376={};var _0x199440={};var _0x34d772;var _0x15c8cd;return db[_0xd4de('0x2f')][_0xd4de('0x4c')]({'where':{'id':_0x48cb7d[_0xd4de('0x44')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0x2d8589,null))[_0xd4de('0x27')](function(_0x2e1780){if(_0x2e1780){_0x34d772=_0x2e1780;_0x199440['model']=_[_0xd4de('0x45')](db[_0xd4de('0x4d')][_0xd4de('0x46')]);_0x199440[_0xd4de('0x32')]=_[_0xd4de('0x45')](_0x48cb7d[_0xd4de('0x32')]);_0x199440['filters']=_[_0xd4de('0x47')](_0x199440['model'],_0x199440['query']);_0x377376[_0xd4de('0x35')]=_[_0xd4de('0x47')](_0x199440[_0xd4de('0x31')],qs[_0xd4de('0x34')](_0x48cb7d['query'][_0xd4de('0x34')]));_0x377376[_0xd4de('0x35')]=_0x377376[_0xd4de('0x35')][_0xd4de('0x36')]?_0x377376[_0xd4de('0x35')]:_0x199440['model'];_0x377376['order']=qs['sort'](_0x48cb7d[_0xd4de('0x32')][_0xd4de('0x3a')]);_0x377376[_0xd4de('0x3b')]=qs[_0xd4de('0x33')](_['pick'](_0x48cb7d[_0xd4de('0x32')],_0x199440[_0xd4de('0x33')]));if(_0x48cb7d[_0xd4de('0x32')][_0xd4de('0x3d')]){_0x377376['where']=_[_0xd4de('0x3e')](_0x377376[_0xd4de('0x3b')],{'$or':_[_0xd4de('0x2e')](_0x377376[_0xd4de('0x35')],function(_0x598b60){var _0x4fd7c2={};_0x4fd7c2[_0x598b60]={'$like':'%'+_0x48cb7d['query'][_0xd4de('0x3d')]+'%'};return _0x4fd7c2;})});}_0x377376=_[_0xd4de('0x3e')]({},_0x377376,_0x48cb7d[_0xd4de('0x3f')]);return _0x34d772['getConfigurations'](_0x377376);}})[_0xd4de('0x27')](function(_0x3005c2){if(_0x3005c2){_0x15c8cd=_0x3005c2[_0xd4de('0x36')];if(!_0x48cb7d['query'][_0xd4de('0x37')]('nolimit')){_0x377376[_0xd4de('0x1e')]=qs[_0xd4de('0x1e')](_0x48cb7d[_0xd4de('0x32')][_0xd4de('0x1e')]);_0x377376[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x48cb7d[_0xd4de('0x32')][_0xd4de('0x1f')]);}return _0x34d772['getConfigurations'](_0x377376);}})[_0xd4de('0x27')](function(_0x59f9d9){if(_0x59f9d9){return _0x59f9d9?{'count':_0x15c8cd,'rows':_0x59f9d9}:null;}})[_0xd4de('0x27')](respondWithResult(_0x2d8589,null))[_0xd4de('0x43')](handleError(_0x2d8589,null));};exports['addConfiguration']=function(_0x29c840,_0xb366b0,_0x21f7f7){if(_0x29c840[_0xd4de('0x4b')]['id']){delete _0x29c840[_0xd4de('0x4b')]['id'];}return db[_0xd4de('0x2f')][_0xd4de('0x4c')]({'where':{'id':_0x29c840[_0xd4de('0x44')]['id']}})[_0xd4de('0x27')](handleEntityNotFound(_0xb366b0,null))[_0xd4de('0x27')](function(_0x1e7e93){if(_0x1e7e93){_0x29c840[_0xd4de('0x4b')][_0xd4de('0x4e')]=_0x1e7e93['id'];_0x29c840['body'][_0xd4de('0x4f')]=integrations[_0xd4de('0x50')](_0x29c840[_0xd4de('0x4b')][_0xd4de('0x51')],_0x29c840[_0xd4de('0x4b')][_0xd4de('0x30')]);_0x29c840[_0xd4de('0x4b')][_0xd4de('0x52')]=integrations['getDescriptions'](_0x29c840[_0xd4de('0x4b')]['channel'],_0x29c840['body']['type']);return db[_0xd4de('0x4d')][_0xd4de('0x4a')](_0x29c840['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0xd4de('0x52')}]});}return null;})['then'](respondWithResult(_0xb366b0,null))[_0xd4de('0x43')](handleError(_0xb366b0,null));};exports['getFields']=function(_0x1a0e6c,_0x223b1a,_0x4ee475){var _0x5df891='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x1a0e6c[_0xd4de('0x44')]['id']},'attributes':['id',_0xd4de('0x53'),_0xd4de('0x54'),_0xd4de('0x55'),_0xd4de('0x56'),_0xd4de('0x57')]})['then'](handleEntityNotFound(_0x223b1a,null))['then'](function(_0x53cbd9){if(_0x53cbd9){_0x5df891=_0x53cbd9[_0xd4de('0x57')];var _0x2bb19d=_0x5df891['slice'](-0x1);if(_0x2bb19d==='/'){_0x5df891=_0x5df891[_0xd4de('0x58')](0x0,_0x5df891['lastIndexOf'](_0x2bb19d));}var _0x1bc101={'method':'GET','uri':util[_0xd4de('0x59')](_0xd4de('0x5a'),_0x5df891,'ticket_fields'),'json':!![]};switch(_0x53cbd9[_0xd4de('0x56')]){case'password':_0x1bc101[_0xd4de('0x5b')]={'Authorization':util[_0xd4de('0x59')](_0xd4de('0x5c'),new Buffer(util[_0xd4de('0x59')]('%s:%s',_0x53cbd9[_0xd4de('0x53')],_0x53cbd9[_0xd4de('0x54')]))[_0xd4de('0x5d')](_0xd4de('0x5e')))};break;case _0xd4de('0x55'):_0x1bc101[_0xd4de('0x5b')]={'Authorization':util[_0xd4de('0x59')](_0xd4de('0x5c'),new Buffer(util[_0xd4de('0x59')](_0xd4de('0x5f'),_0x53cbd9[_0xd4de('0x53')],_0x53cbd9[_0xd4de('0x55')]))[_0xd4de('0x5d')]('base64'))};break;default:throw new db[(_0xd4de('0x60'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x1bc101);}})[_0xd4de('0x27')](function(_0x595ee){if(_0x595ee){var _0x5f197d=[_0xd4de('0x61'),_0xd4de('0x62'),_0xd4de('0x63'),_0xd4de('0x64')];_['remove'](_0x595ee[_0xd4de('0x65')],function(_0xee18fc){return _0x5f197d[_0xd4de('0x66')](_0xee18fc[_0xd4de('0x30')]);});return{'count':_0x595ee[_0xd4de('0x65')]['length'],'rows':_['map'](_0x595ee['ticket_fields'],function(_0x4a2467){return{'id':_0x4a2467['id'],'name':_0x4a2467[_0xd4de('0x67')]>0x7?_0x4a2467['title']:_0x4a2467[_0xd4de('0x30')],'custom':_0x4a2467['position']>0x7?!![]:![],'options':_0x4a2467[_0xd4de('0x68')]?_0x4a2467[_0xd4de('0x68')]:_0x4a2467[_0xd4de('0x69')]?_0x4a2467[_0xd4de('0x69')]:[]};})};}})[_0xd4de('0x27')](respondWithResult(_0x223b1a,null))[_0xd4de('0x43')](function(_0x15f056){var _0x31b518=_0x1a0e6c['query'][_0xd4de('0x6a')]?0x1f4:_0x15f056[_0xd4de('0x6b')]||0x1f4;logger[_0xd4de('0x29')](_0xd4de('0x6c'),'getFields',_0x31b518,JSON[_0xd4de('0x6d')](_0x15f056));delete _0x15f056[_0xd4de('0x2b')];if(_0x31b518===0x191){_0x31b518=0x190;}_0x223b1a['status'](_0x31b518)[_0xd4de('0x2c')](_0x1a0e6c[_0xd4de('0x32')][_0xd4de('0x6a')]?{'message':_0xd4de('0x6e'),'statusCode':_0x15f056[_0xd4de('0x6b')]}:_0x15f056);});}; \ No newline at end of file +var _0x351d=['Subjects','Descriptions','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','%s/%s','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','stack','index','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','ZendeskAccount','includeAll','findAll','catch','params','include','find','create','body','update','findOne','ZendeskConfiguration','order','sort','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','channel','ZendeskField'];(function(_0x2a5b28,_0x22bbdc){var _0x5be01f=function(_0x3ece9b){while(--_0x3ece9b){_0x2a5b28['push'](_0x2a5b28['shift']());}};_0x5be01f(++_0x22bbdc);}(_0x351d,0x90));var _0xd351=function(_0x3f6e88,_0x229bd4){_0x3f6e88=_0x3f6e88-0x0;var _0x4686ca=_0x351d[_0x3f6e88];return _0x4686ca;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd351('0x13'));function respondWithStatusCode(_0x15549a,_0x23445f){_0x23445f=_0x23445f||0xcc;return function(_0x1eb2a9){if(_0x1eb2a9){return _0x15549a['sendStatus'](_0x23445f);}return _0x15549a[_0xd351('0x14')](_0x23445f)[_0xd351('0x15')]();};}function respondWithResult(_0x597d7c,_0xc5a145){_0xc5a145=_0xc5a145||0xc8;return function(_0xb106ef){if(_0xb106ef){return _0x597d7c[_0xd351('0x14')](_0xc5a145)[_0xd351('0x16')](_0xb106ef);}};}function respondWithFilteredResult(_0x3867fb,_0x4d238c){return function(_0x9f790f){if(_0x9f790f){var _0x49d8bb=typeof _0x4d238c['offset']===_0xd351('0x17')&&typeof _0x4d238c['limit']===_0xd351('0x17');var _0x1de35f=_0x9f790f[_0xd351('0x18')];var _0x4c6693=_0x49d8bb?0x0:_0x4d238c[_0xd351('0x19')];var _0x2bfc53=_0x49d8bb?_0x9f790f[_0xd351('0x18')]:_0x4d238c[_0xd351('0x19')]+_0x4d238c['limit'];var _0xc2d2c0;if(_0x2bfc53>=_0x1de35f){_0x2bfc53=_0x1de35f;_0xc2d2c0=0xc8;}else{_0xc2d2c0=0xce;}_0x3867fb['status'](_0xc2d2c0);return _0x3867fb['set'](_0xd351('0x1a'),_0x4c6693+'-'+_0x2bfc53+'/'+_0x1de35f)['json'](_0x9f790f);}return null;};}function patchUpdates(_0x33b1e5){return function(_0x2d75dd){try{jsonpatch[_0xd351('0x1b')](_0x2d75dd,_0x33b1e5,!![]);}catch(_0x42631b){return BPromise[_0xd351('0x1c')](_0x42631b);}return _0x2d75dd['save']();};}function saveUpdates(_0x18625b,_0xbbc58){return function(_0x241265){if(_0x241265){return _0x241265['update'](_0x18625b)[_0xd351('0x1d')](function(_0x2d9aa0){return _0x2d9aa0;});}return null;};}function removeEntity(_0x365bbc,_0x59fb6d){return function(_0x1ce279){if(_0x1ce279){return _0x1ce279[_0xd351('0x1e')]()[_0xd351('0x1d')](function(){_0x365bbc[_0xd351('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f7f3,_0x483c92){return function(_0x358bff){if(!_0x358bff){_0x40f7f3[_0xd351('0x1f')](0x194);}return _0x358bff;};}function handleError(_0x54f471,_0x2648d0){_0x2648d0=_0x2648d0||0x1f4;return function(_0x55b4d3){logger['error'](_0x55b4d3[_0xd351('0x20')]);if(_0x55b4d3['name']){delete _0x55b4d3['name'];}_0x54f471[_0xd351('0x14')](_0x2648d0)['send'](_0x55b4d3);};}exports[_0xd351('0x21')]=function(_0x2ddae8,_0x407b50){var _0x4d3f48={},_0x71ce9c={},_0x4aa902={'count':0x0,'rows':[]};var _0x1c826b=_['map'](db['ZendeskAccount'][_0xd351('0x22')],function(_0x38c82f){return{'name':_0x38c82f[_0xd351('0x23')],'type':_0x38c82f[_0xd351('0x24')]['key']};});_0x71ce9c[_0xd351('0x25')]=_[_0xd351('0x26')](_0x1c826b,_0xd351('0x27'));_0x71ce9c[_0xd351('0x28')]=_[_0xd351('0x29')](_0x2ddae8[_0xd351('0x28')]);_0x71ce9c[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],_0x71ce9c['query']);_0x4d3f48[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x2ddae8['query'][_0xd351('0x2d')]));_0x4d3f48[_0xd351('0x2c')]=_0x4d3f48[_0xd351('0x2c')][_0xd351('0x2e')]?_0x4d3f48[_0xd351('0x2c')]:_0x71ce9c[_0xd351('0x25')];if(!_0x2ddae8[_0xd351('0x28')][_0xd351('0x2f')](_0xd351('0x30'))){_0x4d3f48['limit']=qs['limit'](_0x2ddae8[_0xd351('0x28')][_0xd351('0x31')]);_0x4d3f48[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x2ddae8[_0xd351('0x28')][_0xd351('0x19')]);}_0x4d3f48['order']=qs['sort'](_0x2ddae8[_0xd351('0x28')]['sort']);_0x4d3f48[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x2ddae8[_0xd351('0x28')],_0x71ce9c[_0xd351('0x2a')]),_0x1c826b);if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]){_0x4d3f48[_0xd351('0x32')]=_[_0xd351('0x35')](_0x4d3f48[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x1c826b,function(_0x4b15db){if(_0x4b15db[_0xd351('0x24')]!=='VIRTUAL'){var _0x22631={};_0x22631[_0x4b15db[_0xd351('0x27')]]={'$like':'%'+_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]+'%'};return _0x22631;}})});}_0x4d3f48=_[_0xd351('0x35')]({},_0x4d3f48,_0x2ddae8[_0xd351('0x36')]);var _0x545bfc={'where':_0x4d3f48[_0xd351('0x32')]};return db[_0xd351('0x37')]['count'](_0x545bfc)[_0xd351('0x1d')](function(_0x2d8ea8){_0x4aa902[_0xd351('0x18')]=_0x2d8ea8;if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x38')]){_0x4d3f48['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xd351('0x39')](_0x4d3f48);})[_0xd351('0x1d')](function(_0x5dae6d){_0x4aa902['rows']=_0x5dae6d;return _0x4aa902;})[_0xd351('0x1d')](respondWithFilteredResult(_0x407b50,_0x4d3f48))[_0xd351('0x3a')](handleError(_0x407b50,null));};exports['show']=function(_0x570d57,_0x46af23){var _0x18f9d1={'raw':![],'where':{'id':_0x570d57[_0xd351('0x3b')]['id']}},_0x3b8526={};_0x3b8526[_0xd351('0x25')]=_[_0xd351('0x29')](db[_0xd351('0x37')][_0xd351('0x22')]);_0x3b8526[_0xd351('0x28')]=_['keys'](_0x570d57['query']);_0x3b8526[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],_0x3b8526[_0xd351('0x28')]);_0x18f9d1[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x570d57[_0xd351('0x28')][_0xd351('0x2d')]));_0x18f9d1[_0xd351('0x2c')]=_0x18f9d1[_0xd351('0x2c')][_0xd351('0x2e')]?_0x18f9d1[_0xd351('0x2c')]:_0x3b8526[_0xd351('0x25')];if(_0x570d57[_0xd351('0x28')]['includeAll']){_0x18f9d1[_0xd351('0x3c')]=[{'all':!![]}];}_0x18f9d1=_[_0xd351('0x35')]({},_0x18f9d1,_0x570d57[_0xd351('0x36')]);return db['ZendeskAccount'][_0xd351('0x3d')](_0x18f9d1)[_0xd351('0x1d')](handleEntityNotFound(_0x46af23,null))[_0xd351('0x1d')](respondWithResult(_0x46af23,null))[_0xd351('0x3a')](handleError(_0x46af23,null));};exports[_0xd351('0x3e')]=function(_0x5bc86a,_0x5adea4){return db['ZendeskAccount'][_0xd351('0x3e')](_0x5bc86a[_0xd351('0x3f')],{})['then'](respondWithResult(_0x5adea4,0xc9))['catch'](handleError(_0x5adea4,null));};exports[_0xd351('0x40')]=function(_0x444206,_0x2af877){if(_0x444206['body']['id']){delete _0x444206[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')]['find']({'where':{'id':_0x444206[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2af877,null))[_0xd351('0x1d')](saveUpdates(_0x444206[_0xd351('0x3f')],null))['then'](respondWithResult(_0x2af877,null))['catch'](handleError(_0x2af877,null));};exports[_0xd351('0x1e')]=function(_0x58ce5a,_0xf9f375){return db[_0xd351('0x37')][_0xd351('0x3d')]({'where':{'id':_0x58ce5a['params']['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0xf9f375,null))['then'](removeEntity(_0xf9f375,null))['catch'](handleError(_0xf9f375,null));};exports['getConfigurations']=function(_0x7e4bad,_0x292af3,_0x334029){var _0x5a2e9b={};var _0x554e3a={};var _0x1748f0;var _0x42f248;return db['ZendeskAccount'][_0xd351('0x41')]({'where':{'id':_0x7e4bad[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x292af3,null))[_0xd351('0x1d')](function(_0x59ab0f){if(_0x59ab0f){_0x1748f0=_0x59ab0f;_0x554e3a[_0xd351('0x25')]=_['keys'](db[_0xd351('0x42')][_0xd351('0x22')]);_0x554e3a[_0xd351('0x28')]=_[_0xd351('0x29')](_0x7e4bad[_0xd351('0x28')]);_0x554e3a[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x554e3a['model'],_0x554e3a['query']);_0x5a2e9b[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x554e3a['model'],qs[_0xd351('0x2d')](_0x7e4bad[_0xd351('0x28')][_0xd351('0x2d')]));_0x5a2e9b['attributes']=_0x5a2e9b[_0xd351('0x2c')]['length']?_0x5a2e9b['attributes']:_0x554e3a[_0xd351('0x25')];_0x5a2e9b[_0xd351('0x43')]=qs['sort'](_0x7e4bad[_0xd351('0x28')][_0xd351('0x44')]);_0x5a2e9b[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x7e4bad[_0xd351('0x28')],_0x554e3a['filters']));if(_0x7e4bad[_0xd351('0x28')][_0xd351('0x34')]){_0x5a2e9b[_0xd351('0x32')]=_[_0xd351('0x35')](_0x5a2e9b[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x5a2e9b[_0xd351('0x2c')],function(_0x4b2029){var _0x24dcdb={};_0x24dcdb[_0x4b2029]={'$like':'%'+_0x7e4bad['query'][_0xd351('0x34')]+'%'};return _0x24dcdb;})});}_0x5a2e9b=_[_0xd351('0x35')]({},_0x5a2e9b,_0x7e4bad[_0xd351('0x36')]);return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x4eaf18){if(_0x4eaf18){_0x42f248=_0x4eaf18[_0xd351('0x2e')];if(!_0x7e4bad['query'][_0xd351('0x2f')](_0xd351('0x30'))){_0x5a2e9b[_0xd351('0x31')]=qs[_0xd351('0x31')](_0x7e4bad[_0xd351('0x28')]['limit']);_0x5a2e9b['offset']=qs[_0xd351('0x19')](_0x7e4bad[_0xd351('0x28')]['offset']);}return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x2718e9){if(_0x2718e9){return _0x2718e9?{'count':_0x42f248,'rows':_0x2718e9}:null;}})['then'](respondWithResult(_0x292af3,null))[_0xd351('0x3a')](handleError(_0x292af3,null));};exports[_0xd351('0x46')]=function(_0x284d12,_0x5dbdef,_0x5d13ec){if(_0x284d12['body']['id']){delete _0x284d12[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x284d12[_0xd351('0x3b')]['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0x5dbdef,null))[_0xd351('0x1d')](function(_0x2c83fe){if(_0x2c83fe){_0x284d12['body'][_0xd351('0x47')]=_0x2c83fe['id'];_0x284d12['body']['Subjects']=integrations[_0xd351('0x48')](_0x284d12[_0xd351('0x3f')]['channel'],_0x284d12[_0xd351('0x3f')]['type']);_0x284d12['body']['Descriptions']=integrations[_0xd351('0x49')](_0x284d12[_0xd351('0x3f')][_0xd351('0x4a')],_0x284d12['body'][_0xd351('0x24')]);return db[_0xd351('0x42')][_0xd351('0x3e')](_0x284d12[_0xd351('0x3f')],{'include':[{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4c')},{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4d')}]});}return null;})[_0xd351('0x1d')](respondWithResult(_0x5dbdef,null))[_0xd351('0x3a')](handleError(_0x5dbdef,null));};exports[_0xd351('0x4e')]=function(_0x4d20af,_0x2fcede,_0x2d59a5){var _0x431e91='';return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x4d20af[_0xd351('0x3b')]['id']},'attributes':['id','username',_0xd351('0x4f'),_0xd351('0x50'),'authType','remoteUri']})[_0xd351('0x1d')](handleEntityNotFound(_0x2fcede,null))[_0xd351('0x1d')](function(_0x44dc58){if(_0x44dc58){_0x431e91=_0x44dc58[_0xd351('0x51')];var _0x1db455=_0x431e91[_0xd351('0x52')](-0x1);if(_0x1db455==='/'){_0x431e91=_0x431e91[_0xd351('0x53')](0x0,_0x431e91[_0xd351('0x54')](_0x1db455));}var _0x3ce2b9={'method':'GET','uri':util[_0xd351('0x55')](_0xd351('0x56'),_0x431e91,'ticket_fields'),'json':!![]};switch(_0x44dc58[_0xd351('0x57')]){case'password':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util['format'](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5a'),_0x44dc58[_0xd351('0x5b')],_0x44dc58[_0xd351('0x4f')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;case'token':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util[_0xd351('0x55')](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5e'),_0x44dc58['username'],_0x44dc58[_0xd351('0x50')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;default:throw new db['Sequelize'][(_0xd351('0x5f'))](_0xd351('0x60'));}return rp(_0x3ce2b9);}})[_0xd351('0x1d')](function(_0x3f0d27){if(_0x3f0d27){var _0x3635ad=[_0xd351('0x61'),_0xd351('0x62'),_0xd351('0x63'),_0xd351('0x64')];_['remove'](_0x3f0d27[_0xd351('0x65')],function(_0x190a00){return _0x3635ad['includes'](_0x190a00[_0xd351('0x24')]);});return{'count':_0x3f0d27['ticket_fields']['length'],'rows':_['map'](_0x3f0d27[_0xd351('0x65')],function(_0x3367f8){return{'id':_0x3367f8['id'],'name':_0x3367f8[_0xd351('0x66')]>0x7?_0x3367f8['title']:_0x3367f8[_0xd351('0x24')],'custom':_0x3367f8['position']>0x7?!![]:![],'options':_0x3367f8[_0xd351('0x67')]?_0x3367f8['system_field_options']:_0x3367f8[_0xd351('0x68')]?_0x3367f8[_0xd351('0x68')]:[]};})};}})[_0xd351('0x1d')](respondWithResult(_0x2fcede,null))[_0xd351('0x3a')](function(_0x35b148){var _0x1bb955=_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?0x1f4:_0x35b148[_0xd351('0x6a')]||0x1f4;logger[_0xd351('0x6b')](_0xd351('0x6c'),_0xd351('0x4e'),_0x1bb955,JSON['stringify'](_0x35b148));delete _0x35b148[_0xd351('0x27')];if(_0x1bb955===0x191){_0x1bb955=0x190;}_0x2fcede[_0xd351('0x14')](_0x1bb955)[_0xd351('0x6d')](_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x35b148[_0xd351('0x6a')]}:_0x35b148);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 696e6ab..147b8b6 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 _0xb252=['exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xb252,0x176));var _0x2b25=function(_0x5a3625,_0x12ec42){_0x5a3625=_0x5a3625-0x0;var _0x4e273c=_0xb252[_0x5a3625];return _0x4e273c;};'use strict';var _=require(_0x2b25('0x0'));var util=require(_0x2b25('0x1'));var logger=require(_0x2b25('0x2'))('api');var moment=require(_0x2b25('0x3'));var BPromise=require(_0x2b25('0x4'));var rp=require(_0x2b25('0x5'));var fs=require('fs');var path=require(_0x2b25('0x6'));var rimraf=require('rimraf');var config=require(_0x2b25('0x7'));var attributes=require(_0x2b25('0x8'));var integrations=require(_0x2b25('0x9'));module[_0x2b25('0xa')]=function(_0x2bba50,_0x3839e0){return _0x2bba50[_0x2b25('0xb')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9ae=['rimraf','../../components/integrations/configuration','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0x415b5d,_0x52a76d){var _0x3c0911=function(_0x6cd6a6){while(--_0x6cd6a6){_0x415b5d['push'](_0x415b5d['shift']());}};_0x3c0911(++_0x52a76d);}(_0xb9ae,0xaf));var _0xeb9a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb9ae[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xeb9a('0x0'));var util=require(_0xeb9a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeb9a('0x2'));var BPromise=require(_0xeb9a('0x3'));var rp=require(_0xeb9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb9a('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xeb9a('0x6'));module[_0xeb9a('0x7')]=function(_0x1d8390,_0x1ad3a8){return _0x1d8390[_0xeb9a('0x8')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 45f3246..bc36035 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 _0xf568=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','ShowZendeskAccount','find','catch','lodash','util'];(function(_0x2ad9f1,_0x24b057){var _0x3fb56c=function(_0x5af8b0){while(--_0x5af8b0){_0x2ad9f1['push'](_0x2ad9f1['shift']());}};_0x3fb56c(++_0x24b057);}(_0xf568,0x67));var _0x8f56=function(_0x17861c,_0x1b24b){_0x17861c=_0x17861c-0x0;var _0x1fd17e=_0xf568[_0x17861c];return _0x1fd17e;};'use strict';var _=require(_0x8f56('0x0'));var util=require(_0x8f56('0x1'));var moment=require(_0x8f56('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f56('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f56('0x4'))['db'];var utils=require(_0x8f56('0x5'));var logger=require('../../config/logger')(_0x8f56('0x6'));var config=require(_0x8f56('0x7'));var jayson=require(_0x8f56('0x8'));var client=jayson[_0x8f56('0x9')][_0x8f56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59a72c,_0x16e025,_0x2a71dc){return new BPromise(function(_0x233e56,_0x326c4b){return client[_0x8f56('0xb')](_0x59a72c,_0x2a71dc)[_0x8f56('0xc')](function(_0x4d550d){logger[_0x8f56('0xd')](_0x8f56('0xe'),_0x16e025,_0x8f56('0xf'));logger[_0x8f56('0x10')](_0x8f56('0x11'),_0x16e025,_0x8f56('0xf'),JSON[_0x8f56('0x12')](_0x4d550d));if(_0x4d550d[_0x8f56('0x13')]){if(_0x4d550d[_0x8f56('0x13')][_0x8f56('0x14')]===0x1f4){logger[_0x8f56('0x13')](_0x8f56('0xe'),_0x16e025,_0x4d550d[_0x8f56('0x13')]['message']);return _0x326c4b(_0x4d550d[_0x8f56('0x13')][_0x8f56('0x15')]);}logger[_0x8f56('0x13')](_0x8f56('0xe'),_0x16e025,_0x4d550d['error'][_0x8f56('0x15')]);return _0x233e56(_0x4d550d[_0x8f56('0x13')][_0x8f56('0x15')]);}else{logger[_0x8f56('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x16e025,_0x8f56('0xf'));_0x233e56(_0x4d550d['result'][_0x8f56('0x15')]);}})['catch'](function(_0x790e74){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x16e025,_0x790e74);_0x326c4b(_0x790e74);});});}exports['GetZendeskAccount']=function(_0x14d017){var _0x216612=this;return new Promise(function(_0x31b55e,_0x405706){return db[_0x8f56('0x16')][_0x8f56('0x17')]({'raw':_0x14d017[_0x8f56('0x18')]?_0x14d017['options'][_0x8f56('0x19')]===undefined?!![]:![]:!![],'where':_0x14d017[_0x8f56('0x18')]?_0x14d017['options'][_0x8f56('0x1a')]||null:null,'attributes':_0x14d017['options']?_0x14d017['options'][_0x8f56('0x1b')]||null:null,'limit':_0x14d017[_0x8f56('0x18')]?_0x14d017['options']['limit']||null:null,'include':_0x14d017[_0x8f56('0x18')]?_0x14d017[_0x8f56('0x18')][_0x8f56('0x1c')]?_[_0x8f56('0x1d')](_0x14d017[_0x8f56('0x18')]['include'],function(_0x5b7216){return{'model':db[_0x5b7216[_0x8f56('0x1e')]],'as':_0x5b7216['as'],'attributes':_0x5b7216[_0x8f56('0x1b')],'include':_0x5b7216[_0x8f56('0x1c')]?_[_0x8f56('0x1d')](_0x5b7216[_0x8f56('0x1c')],function(_0x194626){return{'model':db[_0x194626['model']],'as':_0x194626['as'],'attributes':_0x194626[_0x8f56('0x1b')],'include':_0x194626[_0x8f56('0x1c')]?_[_0x8f56('0x1d')](_0x194626[_0x8f56('0x1c')],function(_0x958175){return{'model':db[_0x958175[_0x8f56('0x1e')]],'as':_0x958175['as'],'attributes':_0x958175['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f56('0xc')](function(_0x415c52){logger[_0x8f56('0xd')](_0x8f56('0x1f'),_0x14d017);logger['debug'](_0x8f56('0x1f'),_0x14d017,JSON[_0x8f56('0x12')](_0x415c52));_0x31b55e(_0x415c52);})['catch'](function(_0x2b2a00){logger[_0x8f56('0x13')](_0x8f56('0x1f'),_0x2b2a00[_0x8f56('0x15')],_0x14d017);_0x405706(_0x216612[_0x8f56('0x13')](0x1f4,_0x2b2a00[_0x8f56('0x15')]));});});};exports[_0x8f56('0x20')]=function(_0x3ca341){var _0x2a37bd=this;return new Promise(function(_0x29dcc5,_0x3a942b){return db['ZendeskAccount'][_0x8f56('0x21')]({'raw':_0x3ca341[_0x8f56('0x18')]?_0x3ca341['options'][_0x8f56('0x19')]===undefined?!![]:![]:!![],'where':_0x3ca341[_0x8f56('0x18')]?_0x3ca341[_0x8f56('0x18')]['where']||null:null,'attributes':_0x3ca341['options']?_0x3ca341['options']['attributes']||null:null,'include':_0x3ca341[_0x8f56('0x18')]?_0x3ca341['options']['include']?_['map'](_0x3ca341[_0x8f56('0x18')]['include'],function(_0x5181b8){return{'model':db[_0x5181b8[_0x8f56('0x1e')]],'as':_0x5181b8['as'],'attributes':_0x5181b8[_0x8f56('0x1b')],'include':_0x5181b8['include']?_[_0x8f56('0x1d')](_0x5181b8[_0x8f56('0x1c')],function(_0x52deaf){return{'model':db[_0x52deaf[_0x8f56('0x1e')]],'as':_0x52deaf['as'],'attributes':_0x52deaf['attributes'],'include':_0x52deaf[_0x8f56('0x1c')]?_[_0x8f56('0x1d')](_0x52deaf[_0x8f56('0x1c')],function(_0x485bdb){return{'model':db[_0x485bdb[_0x8f56('0x1e')]],'as':_0x485bdb['as'],'attributes':_0x485bdb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x24875f){logger[_0x8f56('0xd')](_0x8f56('0x20'),_0x3ca341);logger['debug']('ShowZendeskAccount',_0x3ca341,JSON['stringify'](_0x24875f));_0x29dcc5(_0x24875f);})[_0x8f56('0x22')](function(_0x2fbd03){logger['error'](_0x8f56('0x20'),_0x2fbd03[_0x8f56('0x15')],_0x3ca341);_0x3a942b(_0x2a37bd[_0x8f56('0x13')](0x1f4,_0x2fbd03[_0x8f56('0x15')]));});});}; \ No newline at end of file +var _0x0ec0=['model','map','then','GetZendeskAccount','ShowZendeskAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','ZendeskAccount','options','raw','where','attributes','limit','include'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x0ec0,0x12f));var _0x00ec=function(_0x8b7417,_0x423d2f){_0x8b7417=_0x8b7417-0x0;var _0x116ce2=_0x0ec0[_0x8b7417];return _0x116ce2;};'use strict';var _=require(_0x00ec('0x0'));var util=require(_0x00ec('0x1'));var moment=require(_0x00ec('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00ec('0x3'));var db=require(_0x00ec('0x4'))['db'];var utils=require(_0x00ec('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x00ec('0x6'));var jayson=require(_0x00ec('0x7'));var client=jayson[_0x00ec('0x8')][_0x00ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a4dfa,_0x5d2f8d,_0x29b9dc){return new BPromise(function(_0x5c9bcb,_0xda4895){return client['request'](_0x2a4dfa,_0x29b9dc)['then'](function(_0x12a480){logger[_0x00ec('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x5d2f8d,'request\x20sent');logger[_0x00ec('0xb')](_0x00ec('0xc'),_0x5d2f8d,_0x00ec('0xd'),JSON[_0x00ec('0xe')](_0x12a480));if(_0x12a480[_0x00ec('0xf')]){if(_0x12a480[_0x00ec('0xf')][_0x00ec('0x10')]===0x1f4){logger[_0x00ec('0xf')](_0x00ec('0x11'),_0x5d2f8d,_0x12a480['error']['message']);return _0xda4895(_0x12a480[_0x00ec('0xf')][_0x00ec('0x12')]);}logger[_0x00ec('0xf')](_0x00ec('0x11'),_0x5d2f8d,_0x12a480[_0x00ec('0xf')][_0x00ec('0x12')]);return _0x5c9bcb(_0x12a480['error'][_0x00ec('0x12')]);}else{logger[_0x00ec('0xa')](_0x00ec('0x11'),_0x5d2f8d,_0x00ec('0xd'));_0x5c9bcb(_0x12a480[_0x00ec('0x13')][_0x00ec('0x12')]);}})['catch'](function(_0x86f195){logger[_0x00ec('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x5d2f8d,_0x86f195);_0xda4895(_0x86f195);});});}exports['GetZendeskAccount']=function(_0x4f5451){var _0x3586c4=this;return new Promise(function(_0x3bb069,_0x5dd332){return db[_0x00ec('0x14')]['findAll']({'raw':_0x4f5451['options']?_0x4f5451[_0x00ec('0x15')][_0x00ec('0x16')]===undefined?!![]:![]:!![],'where':_0x4f5451[_0x00ec('0x15')]?_0x4f5451[_0x00ec('0x15')][_0x00ec('0x17')]||null:null,'attributes':_0x4f5451[_0x00ec('0x15')]?_0x4f5451[_0x00ec('0x15')][_0x00ec('0x18')]||null:null,'limit':_0x4f5451[_0x00ec('0x15')]?_0x4f5451[_0x00ec('0x15')][_0x00ec('0x19')]||null:null,'include':_0x4f5451[_0x00ec('0x15')]?_0x4f5451[_0x00ec('0x15')][_0x00ec('0x1a')]?_['map'](_0x4f5451[_0x00ec('0x15')][_0x00ec('0x1a')],function(_0x3f3289){return{'model':db[_0x3f3289[_0x00ec('0x1b')]],'as':_0x3f3289['as'],'attributes':_0x3f3289['attributes'],'include':_0x3f3289['include']?_[_0x00ec('0x1c')](_0x3f3289[_0x00ec('0x1a')],function(_0x19c146){return{'model':db[_0x19c146[_0x00ec('0x1b')]],'as':_0x19c146['as'],'attributes':_0x19c146['attributes'],'include':_0x19c146[_0x00ec('0x1a')]?_[_0x00ec('0x1c')](_0x19c146['include'],function(_0x46398f){return{'model':db[_0x46398f[_0x00ec('0x1b')]],'as':_0x46398f['as'],'attributes':_0x46398f[_0x00ec('0x18')]};}):[]};}):[]};}):[]:[]})[_0x00ec('0x1d')](function(_0x94a479){logger[_0x00ec('0xa')](_0x00ec('0x1e'),_0x4f5451);logger[_0x00ec('0xb')]('GetZendeskAccount',_0x4f5451,JSON[_0x00ec('0xe')](_0x94a479));_0x3bb069(_0x94a479);})['catch'](function(_0x1335a3){logger['error'](_0x00ec('0x1e'),_0x1335a3[_0x00ec('0x12')],_0x4f5451);_0x5dd332(_0x3586c4[_0x00ec('0xf')](0x1f4,_0x1335a3[_0x00ec('0x12')]));});});};exports[_0x00ec('0x1f')]=function(_0x41a54f){var _0x4069b7=this;return new Promise(function(_0x2775f7,_0x1a78ec){return db[_0x00ec('0x14')][_0x00ec('0x20')]({'raw':_0x41a54f[_0x00ec('0x15')]?_0x41a54f[_0x00ec('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41a54f[_0x00ec('0x15')]?_0x41a54f[_0x00ec('0x15')][_0x00ec('0x17')]||null:null,'attributes':_0x41a54f[_0x00ec('0x15')]?_0x41a54f[_0x00ec('0x15')][_0x00ec('0x18')]||null:null,'include':_0x41a54f['options']?_0x41a54f['options'][_0x00ec('0x1a')]?_[_0x00ec('0x1c')](_0x41a54f[_0x00ec('0x15')][_0x00ec('0x1a')],function(_0x32f330){return{'model':db[_0x32f330[_0x00ec('0x1b')]],'as':_0x32f330['as'],'attributes':_0x32f330[_0x00ec('0x18')],'include':_0x32f330[_0x00ec('0x1a')]?_[_0x00ec('0x1c')](_0x32f330[_0x00ec('0x1a')],function(_0x5d2151){return{'model':db[_0x5d2151[_0x00ec('0x1b')]],'as':_0x5d2151['as'],'attributes':_0x5d2151[_0x00ec('0x18')],'include':_0x5d2151['include']?_['map'](_0x5d2151['include'],function(_0x7dc3bd){return{'model':db[_0x7dc3bd[_0x00ec('0x1b')]],'as':_0x7dc3bd['as'],'attributes':_0x7dc3bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x00ec('0x1d')](function(_0x3705e8){logger[_0x00ec('0xa')](_0x00ec('0x1f'),_0x41a54f);logger[_0x00ec('0xb')](_0x00ec('0x1f'),_0x41a54f,JSON[_0x00ec('0xe')](_0x3705e8));_0x2775f7(_0x3705e8);})['catch'](function(_0x12b61f){logger[_0x00ec('0xf')]('ShowZendeskAccount',_0x12b61f[_0x00ec('0x12')],_0x41a54f);_0x1a78ec(_0x4069b7[_0x00ec('0xf')](0x1f4,_0x12b61f[_0x00ec('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index fddf442..3e2fffd 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 _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x185cd2,_0xe226d6){var _0x5b8902=function(_0x374abc){while(--_0x374abc){_0x185cd2['push'](_0x185cd2['shift']());}};_0x5b8902(++_0xe226d6);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x4d6c19,_0x4b317f){var _0x4f5b28=function(_0x2616f6){while(--_0x2616f6){_0x4d6c19['push'](_0x4d6c19['shift']());}};_0x4f5b28(++_0x4b317f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1fab93,_0x40b1d5){_0x1fab93=_0x1fab93-0x0;var _0x31140f=_0xf4eb[_0x1fab93];return _0x31140f;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 2e99947..f27452e 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 _0x29f4=['exports','STRING','sequelize'];(function(_0x2c8b7a,_0x483fe0){var _0x1c1cf9=function(_0x464bcf){while(--_0x464bcf){_0x2c8b7a['push'](_0x2c8b7a['shift']());}};_0x1c1cf9(++_0x483fe0);}(_0x29f4,0x152));var _0x429f=function(_0x494b32,_0x2f82e5){_0x494b32=_0x494b32-0x0;var _0x45efd0=_0x29f4[_0x494b32];return _0x45efd0;};'use strict';var Sequelize=require(_0x429f('0x0'));module[_0x429f('0x1')]={'name':{'type':Sequelize[_0x429f('0x2')]},'description':{'type':Sequelize[_0x429f('0x2')]}}; \ No newline at end of file +var _0xb5ce=['STRING'];(function(_0x53cc66,_0x5162fc){var _0x6effae=function(_0x2ddb4f){while(--_0x2ddb4f){_0x53cc66['push'](_0x53cc66['shift']());}};_0x6effae(++_0x5162fc);}(_0xb5ce,0x136));var _0xeb5c=function(_0x253152,_0x38dce3){_0x253152=_0x253152-0x0;var _0xd2560=_0xb5ce[_0x253152];return _0xd2560;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xeb5c('0x0')]},'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 f36844a..dbe7f45 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 _0x157d=['send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x2b2330,_0x564df5){var _0x27a0c2=function(_0x1dfc16){while(--_0x1dfc16){_0x2b2330['push'](_0x2b2330['shift']());}};_0x27a0c2(++_0x564df5);}(_0x157d,0x128));var _0xd157=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x157d[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xd157('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd157('0x1'));var jsonpatch=require(_0xd157('0x2'));var rp=require(_0xd157('0x3'));var moment=require(_0xd157('0x4'));var BPromise=require(_0xd157('0x5'));var Mustache=require(_0xd157('0x6'));var util=require(_0xd157('0x7'));var path=require(_0xd157('0x8'));var sox=require(_0xd157('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd157('0xa'));var squel=require(_0xd157('0xb'));var crypto=require('crypto');var jsforce=require(_0xd157('0xc'));var deskjs=require(_0xd157('0xd'));var toCsv=require(_0xd157('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd157('0xf'));var authService=require(_0xd157('0x10'));var qs=require(_0xd157('0x11'));var as=require(_0xd157('0x12'));var hardwareService=require(_0xd157('0x13'));var logger=require(_0xd157('0x14'))(_0xd157('0x15'));var utils=require(_0xd157('0x16'));var config=require(_0xd157('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd157('0x18'))['db'];function respondWithStatusCode(_0x395270,_0x5826f9){_0x5826f9=_0x5826f9||0xcc;return function(_0x5a31a8){if(_0x5a31a8){return _0x395270['sendStatus'](_0x5826f9);}return _0x395270[_0xd157('0x19')](_0x5826f9)['end']();};}function respondWithResult(_0x2a54f7,_0x2216ee){_0x2216ee=_0x2216ee||0xc8;return function(_0x2509b5){if(_0x2509b5){return _0x2a54f7['status'](_0x2216ee)['json'](_0x2509b5);}};}function respondWithFilteredResult(_0xb83f99,_0x8be30){return function(_0x3884d6){if(_0x3884d6){var _0x5c4d28=typeof _0x8be30[_0xd157('0x1a')]===_0xd157('0x1b')&&typeof _0x8be30[_0xd157('0x1c')]==='undefined';var _0x3ada2a=_0x3884d6[_0xd157('0x1d')];var _0x64fcb=_0x5c4d28?0x0:_0x8be30[_0xd157('0x1a')];var _0x19efe7=_0x5c4d28?_0x3884d6['count']:_0x8be30[_0xd157('0x1a')]+_0x8be30['limit'];var _0x2bdcce;if(_0x19efe7>=_0x3ada2a){_0x19efe7=_0x3ada2a;_0x2bdcce=0xc8;}else{_0x2bdcce=0xce;}_0xb83f99['status'](_0x2bdcce);return _0xb83f99['set'](_0xd157('0x1e'),_0x64fcb+'-'+_0x19efe7+'/'+_0x3ada2a)['json'](_0x3884d6);}return null;};}function patchUpdates(_0x49c6da){return function(_0x4b4628){try{jsonpatch[_0xd157('0x1f')](_0x4b4628,_0x49c6da,!![]);}catch(_0x2d9d73){return BPromise['reject'](_0x2d9d73);}return _0x4b4628[_0xd157('0x20')]();};}function saveUpdates(_0x675062,_0x143bb4){return function(_0x370730){if(_0x370730){return _0x370730[_0xd157('0x21')](_0x675062)[_0xd157('0x22')](function(_0x12c011){return _0x12c011;});}return null;};}function removeEntity(_0xa6000c,_0x359cf9){return function(_0x4723c4){if(_0x4723c4){return _0x4723c4[_0xd157('0x23')]()['then'](function(){_0xa6000c[_0xd157('0x19')](0xcc)[_0xd157('0x24')]();});}};}function handleEntityNotFound(_0x2376e9,_0xd5c57a){return function(_0x24af12){if(!_0x24af12){_0x2376e9[_0xd157('0x25')](0x194);}return _0x24af12;};}function handleError(_0x3f68fd,_0x2bf889){_0x2bf889=_0x2bf889||0x1f4;return function(_0x495e7f){logger[_0xd157('0x26')](_0x495e7f[_0xd157('0x27')]);if(_0x495e7f['name']){delete _0x495e7f['name'];}_0x3f68fd[_0xd157('0x19')](_0x2bf889)[_0xd157('0x28')](_0x495e7f);};}exports[_0xd157('0x29')]=function(_0x60f486,_0x2b62cb){var _0x7ffc79={},_0x329e23={},_0x2751d5={'count':0x0,'rows':[]};var _0x469837=_[_0xd157('0x2a')](db[_0xd157('0x2b')][_0xd157('0x2c')],function(_0x266e28){return{'name':_0x266e28[_0xd157('0x2d')],'type':_0x266e28[_0xd157('0x2e')]['key']};});_0x329e23[_0xd157('0x2f')]=_[_0xd157('0x2a')](_0x469837,_0xd157('0x30'));_0x329e23[_0xd157('0x31')]=_[_0xd157('0x32')](_0x60f486['query']);_0x329e23[_0xd157('0x33')]=_[_0xd157('0x34')](_0x329e23[_0xd157('0x2f')],_0x329e23['query']);_0x7ffc79[_0xd157('0x35')]=_['intersection'](_0x329e23[_0xd157('0x2f')],qs[_0xd157('0x36')](_0x60f486[_0xd157('0x31')][_0xd157('0x36')]));_0x7ffc79[_0xd157('0x35')]=_0x7ffc79[_0xd157('0x35')][_0xd157('0x37')]?_0x7ffc79[_0xd157('0x35')]:_0x329e23[_0xd157('0x2f')];if(!_0x60f486['query'][_0xd157('0x38')](_0xd157('0x39'))){_0x7ffc79[_0xd157('0x1c')]=qs[_0xd157('0x1c')](_0x60f486[_0xd157('0x31')][_0xd157('0x1c')]);_0x7ffc79[_0xd157('0x1a')]=qs[_0xd157('0x1a')](_0x60f486[_0xd157('0x31')][_0xd157('0x1a')]);}_0x7ffc79['order']=qs[_0xd157('0x3a')](_0x60f486['query'][_0xd157('0x3a')]);_0x7ffc79['where']=qs[_0xd157('0x33')](_[_0xd157('0x3b')](_0x60f486['query'],_0x329e23[_0xd157('0x33')]),_0x469837);if(_0x60f486[_0xd157('0x31')][_0xd157('0x3c')]){_0x7ffc79[_0xd157('0x3d')]=_[_0xd157('0x3e')](_0x7ffc79[_0xd157('0x3d')],{'$or':_[_0xd157('0x2a')](_0x469837,function(_0x50e9f8){if(_0x50e9f8[_0xd157('0x2e')]!==_0xd157('0x3f')){var _0x554792={};_0x554792[_0x50e9f8[_0xd157('0x30')]]={'$like':'%'+_0x60f486[_0xd157('0x31')][_0xd157('0x3c')]+'%'};return _0x554792;}})});}_0x7ffc79=_[_0xd157('0x3e')]({},_0x7ffc79,_0x60f486['options']);var _0x1d06df={'where':_0x7ffc79[_0xd157('0x3d')]};return db[_0xd157('0x2b')]['count'](_0x1d06df)[_0xd157('0x22')](function(_0x2722e7){_0x2751d5[_0xd157('0x1d')]=_0x2722e7;if(_0x60f486[_0xd157('0x31')][_0xd157('0x40')]){_0x7ffc79[_0xd157('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xd157('0x42')](_0x7ffc79);})['then'](function(_0x2c4686){_0x2751d5[_0xd157('0x43')]=_0x2c4686;return _0x2751d5;})['then'](respondWithFilteredResult(_0x2b62cb,_0x7ffc79))[_0xd157('0x44')](handleError(_0x2b62cb,null));};exports[_0xd157('0x45')]=function(_0x42e094,_0xa13c4e){var _0x3273b8={'raw':![],'where':{'id':_0x42e094[_0xd157('0x46')]['id']}},_0x398b9e={};_0x398b9e['model']=_['keys'](db[_0xd157('0x2b')][_0xd157('0x2c')]);_0x398b9e[_0xd157('0x31')]=_['keys'](_0x42e094[_0xd157('0x31')]);_0x398b9e[_0xd157('0x33')]=_['intersection'](_0x398b9e[_0xd157('0x2f')],_0x398b9e[_0xd157('0x31')]);_0x3273b8[_0xd157('0x35')]=_['intersection'](_0x398b9e[_0xd157('0x2f')],qs[_0xd157('0x36')](_0x42e094[_0xd157('0x31')][_0xd157('0x36')]));_0x3273b8['attributes']=_0x3273b8[_0xd157('0x35')][_0xd157('0x37')]?_0x3273b8['attributes']:_0x398b9e['model'];if(_0x42e094['query'][_0xd157('0x40')]){_0x3273b8[_0xd157('0x41')]=[{'all':!![]}];}_0x3273b8=_[_0xd157('0x3e')]({},_0x3273b8,_0x42e094[_0xd157('0x47')]);return db['ZendeskConfiguration'][_0xd157('0x48')](_0x3273b8)[_0xd157('0x22')](handleEntityNotFound(_0xa13c4e,null))['then'](respondWithResult(_0xa13c4e,null))[_0xd157('0x44')](handleError(_0xa13c4e,null));};exports['create']=function(_0x4bd3d4,_0x3e016b){return db[_0xd157('0x2b')][_0xd157('0x49')](_0x4bd3d4[_0xd157('0x4a')],{})[_0xd157('0x22')](respondWithResult(_0x3e016b,0xc9))[_0xd157('0x44')](handleError(_0x3e016b,null));};exports[_0xd157('0x21')]=function(_0x31c893,_0x3e4d1b){if(_0x31c893[_0xd157('0x4a')]['id']){delete _0x31c893[_0xd157('0x4a')]['id'];}return db[_0xd157('0x2b')][_0xd157('0x48')]({'where':{'id':_0x31c893['params']['id']}})[_0xd157('0x22')](handleEntityNotFound(_0x3e4d1b,null))[_0xd157('0x22')](saveUpdates(_0x31c893['body'],null))[_0xd157('0x22')](respondWithResult(_0x3e4d1b,null))[_0xd157('0x44')](handleError(_0x3e4d1b,null));};exports[_0xd157('0x23')]=function(_0x50502a,_0x155d5c){return db[_0xd157('0x2b')][_0xd157('0x48')]({'where':{'id':_0x50502a[_0xd157('0x46')]['id']}})[_0xd157('0x22')](handleEntityNotFound(_0x155d5c,null))[_0xd157('0x22')](removeEntity(_0x155d5c,null))['catch'](handleError(_0x155d5c,null));};exports[_0xd157('0x4b')]=function(_0x356914,_0x2ee14b,_0x191ac0){var _0x13d873={};var _0x3f8d19={};var _0x1bac31;var _0x5be7e5;return db[_0xd157('0x2b')][_0xd157('0x4c')]({'where':{'id':_0x356914[_0xd157('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ee14b,null))['then'](function(_0x31ccf7){if(_0x31ccf7){_0x1bac31=_0x31ccf7;_0x3f8d19[_0xd157('0x2f')]=_[_0xd157('0x32')](db[_0xd157('0x4d')]['rawAttributes']);_0x3f8d19[_0xd157('0x31')]=_[_0xd157('0x32')](_0x356914[_0xd157('0x31')]);_0x3f8d19[_0xd157('0x33')]=_[_0xd157('0x34')](_0x3f8d19[_0xd157('0x2f')],_0x3f8d19[_0xd157('0x31')]);_0x13d873[_0xd157('0x35')]=_[_0xd157('0x34')](_0x3f8d19[_0xd157('0x2f')],qs[_0xd157('0x36')](_0x356914[_0xd157('0x31')][_0xd157('0x36')]));_0x13d873[_0xd157('0x35')]=_0x13d873[_0xd157('0x35')][_0xd157('0x37')]?_0x13d873[_0xd157('0x35')]:_0x3f8d19[_0xd157('0x2f')];_0x13d873[_0xd157('0x4e')]=qs[_0xd157('0x3a')](_0x356914[_0xd157('0x31')][_0xd157('0x3a')]);_0x13d873[_0xd157('0x3d')]=qs['filters'](_[_0xd157('0x3b')](_0x356914[_0xd157('0x31')],_0x3f8d19[_0xd157('0x33')]));if(_0x356914[_0xd157('0x31')][_0xd157('0x3c')]){_0x13d873[_0xd157('0x3d')]=_['merge'](_0x13d873['where'],{'$or':_['map'](_0x13d873['attributes'],function(_0x5a8f15){var _0x141dfd={};_0x141dfd[_0x5a8f15]={'$like':'%'+_0x356914[_0xd157('0x31')][_0xd157('0x3c')]+'%'};return _0x141dfd;})});}_0x13d873=_[_0xd157('0x3e')]({},_0x13d873,_0x356914['options']);return _0x1bac31[_0xd157('0x4b')](_0x13d873);}})[_0xd157('0x22')](function(_0x49f174){if(_0x49f174){_0x5be7e5=_0x49f174[_0xd157('0x37')];if(!_0x356914[_0xd157('0x31')][_0xd157('0x38')]('nolimit')){_0x13d873[_0xd157('0x1c')]=qs[_0xd157('0x1c')](_0x356914[_0xd157('0x31')]['limit']);_0x13d873[_0xd157('0x1a')]=qs[_0xd157('0x1a')](_0x356914[_0xd157('0x31')][_0xd157('0x1a')]);}return _0x1bac31[_0xd157('0x4b')](_0x13d873);}})[_0xd157('0x22')](function(_0x567518){if(_0x567518){return _0x567518?{'count':_0x5be7e5,'rows':_0x567518}:null;}})[_0xd157('0x22')](respondWithResult(_0x2ee14b,null))['catch'](handleError(_0x2ee14b,null));};exports['getSubjects']=function(_0x1c1e70,_0x1836fb,_0x15ca0d){var _0x18508f={};var _0x2c96e5={};var _0x15191a;var _0x20065c;return db[_0xd157('0x2b')][_0xd157('0x4c')]({'where':{'id':_0x1c1e70[_0xd157('0x46')]['id']}})[_0xd157('0x22')](handleEntityNotFound(_0x1836fb,null))['then'](function(_0x288c09){if(_0x288c09){_0x15191a=_0x288c09;_0x2c96e5[_0xd157('0x2f')]=_[_0xd157('0x32')](db['ZendeskField'][_0xd157('0x2c')]);_0x2c96e5[_0xd157('0x31')]=_[_0xd157('0x32')](_0x1c1e70['query']);_0x2c96e5[_0xd157('0x33')]=_['intersection'](_0x2c96e5[_0xd157('0x2f')],_0x2c96e5[_0xd157('0x31')]);_0x18508f[_0xd157('0x35')]=_[_0xd157('0x34')](_0x2c96e5[_0xd157('0x2f')],qs[_0xd157('0x36')](_0x1c1e70[_0xd157('0x31')][_0xd157('0x36')]));_0x18508f[_0xd157('0x35')]=_0x18508f[_0xd157('0x35')][_0xd157('0x37')]?_0x18508f[_0xd157('0x35')]:_0x2c96e5[_0xd157('0x2f')];_0x18508f[_0xd157('0x4e')]=qs['sort'](_0x1c1e70[_0xd157('0x31')]['sort']);_0x18508f['where']=qs[_0xd157('0x33')](_[_0xd157('0x3b')](_0x1c1e70[_0xd157('0x31')],_0x2c96e5[_0xd157('0x33')]));if(_0x1c1e70['query'][_0xd157('0x3c')]){_0x18508f[_0xd157('0x3d')]=_[_0xd157('0x3e')](_0x18508f[_0xd157('0x3d')],{'$or':_[_0xd157('0x2a')](_0x18508f['attributes'],function(_0x25f0d3){var _0x24c30e={};_0x24c30e[_0x25f0d3]={'$like':'%'+_0x1c1e70[_0xd157('0x31')][_0xd157('0x3c')]+'%'};return _0x24c30e;})});}_0x18508f=_[_0xd157('0x3e')]({},_0x18508f,_0x1c1e70[_0xd157('0x47')]);return _0x15191a[_0xd157('0x4f')](_0x18508f);}})[_0xd157('0x22')](function(_0xa9ab03){if(_0xa9ab03){_0x20065c=_0xa9ab03['length'];if(!_0x1c1e70[_0xd157('0x31')][_0xd157('0x38')](_0xd157('0x39'))){_0x18508f[_0xd157('0x1c')]=qs[_0xd157('0x1c')](_0x1c1e70['query'][_0xd157('0x1c')]);_0x18508f['offset']=qs[_0xd157('0x1a')](_0x1c1e70[_0xd157('0x31')]['offset']);}return _0x15191a['getSubjects'](_0x18508f);}})['then'](function(_0x8d1365){if(_0x8d1365){return _0x8d1365?{'count':_0x20065c,'rows':_0x8d1365}:null;}})[_0xd157('0x22')](respondWithResult(_0x1836fb,null))[_0xd157('0x44')](handleError(_0x1836fb,null));};exports[_0xd157('0x50')]=function(_0x59384a,_0x598826,_0x213855){var _0x38091a={};var _0x72ccd0={};var _0x3546aa;var _0x155d1f;return db[_0xd157('0x2b')][_0xd157('0x4c')]({'where':{'id':_0x59384a[_0xd157('0x46')]['id']}})[_0xd157('0x22')](handleEntityNotFound(_0x598826,null))['then'](function(_0x4e4542){if(_0x4e4542){_0x3546aa=_0x4e4542;_0x72ccd0[_0xd157('0x2f')]=_[_0xd157('0x32')](db[_0xd157('0x4d')]['rawAttributes']);_0x72ccd0['query']=_[_0xd157('0x32')](_0x59384a[_0xd157('0x31')]);_0x72ccd0[_0xd157('0x33')]=_[_0xd157('0x34')](_0x72ccd0[_0xd157('0x2f')],_0x72ccd0['query']);_0x38091a[_0xd157('0x35')]=_['intersection'](_0x72ccd0[_0xd157('0x2f')],qs[_0xd157('0x36')](_0x59384a['query']['fields']));_0x38091a['attributes']=_0x38091a[_0xd157('0x35')]['length']?_0x38091a['attributes']:_0x72ccd0[_0xd157('0x2f')];_0x38091a['order']=qs[_0xd157('0x3a')](_0x59384a[_0xd157('0x31')][_0xd157('0x3a')]);_0x38091a[_0xd157('0x3d')]=qs[_0xd157('0x33')](_[_0xd157('0x3b')](_0x59384a['query'],_0x72ccd0[_0xd157('0x33')]));if(_0x59384a[_0xd157('0x31')][_0xd157('0x3c')]){_0x38091a[_0xd157('0x3d')]=_[_0xd157('0x3e')](_0x38091a[_0xd157('0x3d')],{'$or':_[_0xd157('0x2a')](_0x38091a[_0xd157('0x35')],function(_0x4d4de7){var _0x1e02d6={};_0x1e02d6[_0x4d4de7]={'$like':'%'+_0x59384a[_0xd157('0x31')][_0xd157('0x3c')]+'%'};return _0x1e02d6;})});}_0x38091a=_[_0xd157('0x3e')]({},_0x38091a,_0x59384a[_0xd157('0x47')]);return _0x3546aa[_0xd157('0x50')](_0x38091a);}})['then'](function(_0x4d2560){if(_0x4d2560){_0x155d1f=_0x4d2560['length'];if(!_0x59384a['query'][_0xd157('0x38')](_0xd157('0x39'))){_0x38091a[_0xd157('0x1c')]=qs['limit'](_0x59384a[_0xd157('0x31')][_0xd157('0x1c')]);_0x38091a[_0xd157('0x1a')]=qs[_0xd157('0x1a')](_0x59384a[_0xd157('0x31')][_0xd157('0x1a')]);}return _0x3546aa[_0xd157('0x50')](_0x38091a);}})[_0xd157('0x22')](function(_0x2f960b){if(_0x2f960b){return _0x2f960b?{'count':_0x155d1f,'rows':_0x2f960b}:null;}})[_0xd157('0x22')](respondWithResult(_0x598826,null))[_0xd157('0x44')](handleError(_0x598826,null));};exports[_0xd157('0x51')]=function(_0x42f26b,_0xb53cba,_0x31e0e1){var _0x2921c4={};var _0x59cd7d={};var _0x14c356;var _0x385f31;return db[_0xd157('0x2b')][_0xd157('0x4c')]({'where':{'id':_0x42f26b['params']['id']}})[_0xd157('0x22')](handleEntityNotFound(_0xb53cba,null))[_0xd157('0x22')](function(_0x52f126){if(_0x52f126){_0x14c356=_0x52f126;_0x59cd7d[_0xd157('0x2f')]=_[_0xd157('0x32')](db['Tag']['rawAttributes']);_0x59cd7d[_0xd157('0x31')]=_[_0xd157('0x32')](_0x42f26b[_0xd157('0x31')]);_0x59cd7d[_0xd157('0x33')]=_[_0xd157('0x34')](_0x59cd7d[_0xd157('0x2f')],_0x59cd7d[_0xd157('0x31')]);_0x2921c4[_0xd157('0x35')]=_[_0xd157('0x34')](_0x59cd7d['model'],qs[_0xd157('0x36')](_0x42f26b['query'][_0xd157('0x36')]));_0x2921c4[_0xd157('0x35')]=_0x2921c4[_0xd157('0x35')][_0xd157('0x37')]?_0x2921c4['attributes']:_0x59cd7d['model'];_0x2921c4[_0xd157('0x4e')]=qs[_0xd157('0x3a')](_0x42f26b[_0xd157('0x31')][_0xd157('0x3a')]);_0x2921c4[_0xd157('0x3d')]=qs[_0xd157('0x33')](_['pick'](_0x42f26b[_0xd157('0x31')],_0x59cd7d[_0xd157('0x33')]));if(_0x42f26b[_0xd157('0x31')][_0xd157('0x3c')]){_0x2921c4['where']=_[_0xd157('0x3e')](_0x2921c4[_0xd157('0x3d')],{'$or':_[_0xd157('0x2a')](_0x2921c4[_0xd157('0x35')],function(_0x159d0c){var _0x3c8076={};_0x3c8076[_0x159d0c]={'$like':'%'+_0x42f26b[_0xd157('0x31')][_0xd157('0x3c')]+'%'};return _0x3c8076;})});}_0x2921c4=_[_0xd157('0x3e')]({},_0x2921c4,_0x42f26b[_0xd157('0x47')]);return _0x14c356[_0xd157('0x51')](_0x2921c4);}})[_0xd157('0x22')](function(_0x4b2189){if(_0x4b2189){_0x385f31=_0x4b2189[_0xd157('0x37')];if(!_0x42f26b['query'][_0xd157('0x38')]('nolimit')){_0x2921c4[_0xd157('0x1c')]=qs[_0xd157('0x1c')](_0x42f26b['query']['limit']);_0x2921c4[_0xd157('0x1a')]=qs[_0xd157('0x1a')](_0x42f26b[_0xd157('0x31')][_0xd157('0x1a')]);}return _0x14c356[_0xd157('0x51')](_0x2921c4);}})['then'](function(_0x2d078d){if(_0x2d078d){return _0x2d078d?{'count':_0x385f31,'rows':_0x2d078d}:null;}})[_0xd157('0x22')](respondWithResult(_0xb53cba,null))[_0xd157('0x44')](handleError(_0xb53cba,null));};exports[_0xd157('0x52')]=function(_0x1beb9f,_0x4b9141,_0x26f2a1){if(_0x1beb9f[_0xd157('0x4a')]['id']){delete _0x1beb9f[_0xd157('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xd157('0x4c')]({'where':{'id':_0x1beb9f[_0xd157('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b9141,null))[_0xd157('0x22')](function(_0x5ec805){if(_0x5ec805){return _0x5ec805[_0xd157('0x52')](_0x1beb9f[_0xd157('0x4a')][_0xd157('0x53')]||[]);}return null;})['then'](respondWithResult(_0x4b9141,null))['catch'](handleError(_0x4b9141,null));}; \ No newline at end of file +var _0xaf5d=['sort','filter','where','merge','name','options','include','rows','catch','params','includeAll','create','body','find','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','index','map','ZendeskConfiguration','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2bdf6b,_0x573735){var _0x38eab5=function(_0x4d18e1){while(--_0x4d18e1){_0x2bdf6b['push'](_0x2bdf6b['shift']());}};_0x38eab5(++_0x573735);}(_0xaf5d,0x1b6));var _0xdaf5=function(_0xf573a1,_0xcd2506){_0xf573a1=_0xf573a1-0x0;var _0x3fc125=_0xaf5d[_0xf573a1];return _0x3fc125;};'use strict';var emlformat=require(_0xdaf5('0x0'));var rimraf=require(_0xdaf5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdaf5('0x2'));var rp=require(_0xdaf5('0x3'));var moment=require(_0xdaf5('0x4'));var BPromise=require(_0xdaf5('0x5'));var Mustache=require(_0xdaf5('0x6'));var util=require(_0xdaf5('0x7'));var path=require(_0xdaf5('0x8'));var sox=require(_0xdaf5('0x9'));var csv=require(_0xdaf5('0xa'));var ejs=require(_0xdaf5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaf5('0xc'));var squel=require(_0xdaf5('0xd'));var crypto=require(_0xdaf5('0xe'));var jsforce=require(_0xdaf5('0xf'));var deskjs=require(_0xdaf5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdaf5('0x11'));var Papa=require(_0xdaf5('0x12'));var Redis=require(_0xdaf5('0x13'));var authService=require(_0xdaf5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xdaf5('0x15'));var hardwareService=require(_0xdaf5('0x16'));var logger=require(_0xdaf5('0x17'))(_0xdaf5('0x18'));var utils=require('../../config/utils');var config=require(_0xdaf5('0x19'));var licenseUtil=require(_0xdaf5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4eaceb,_0x541a73){_0x541a73=_0x541a73||0xcc;return function(_0x3d5585){if(_0x3d5585){return _0x4eaceb[_0xdaf5('0x1b')](_0x541a73);}return _0x4eaceb[_0xdaf5('0x1c')](_0x541a73)[_0xdaf5('0x1d')]();};}function respondWithResult(_0x4bc626,_0x42eb8d){_0x42eb8d=_0x42eb8d||0xc8;return function(_0x434fce){if(_0x434fce){return _0x4bc626[_0xdaf5('0x1c')](_0x42eb8d)['json'](_0x434fce);}};}function respondWithFilteredResult(_0x1af115,_0x2e1b13){return function(_0x12b11c){if(_0x12b11c){var _0x4b2484=typeof _0x2e1b13[_0xdaf5('0x1e')]===_0xdaf5('0x1f')&&typeof _0x2e1b13['limit']===_0xdaf5('0x1f');var _0x29d745=_0x12b11c[_0xdaf5('0x20')];var _0x30fe84=_0x4b2484?0x0:_0x2e1b13['offset'];var _0x1fad74=_0x4b2484?_0x12b11c['count']:_0x2e1b13[_0xdaf5('0x1e')]+_0x2e1b13[_0xdaf5('0x21')];var _0xe8fd9d;if(_0x1fad74>=_0x29d745){_0x1fad74=_0x29d745;_0xe8fd9d=0xc8;}else{_0xe8fd9d=0xce;}_0x1af115['status'](_0xe8fd9d);return _0x1af115[_0xdaf5('0x22')](_0xdaf5('0x23'),_0x30fe84+'-'+_0x1fad74+'/'+_0x29d745)[_0xdaf5('0x24')](_0x12b11c);}return null;};}function patchUpdates(_0x293494){return function(_0x5ae4f6){try{jsonpatch[_0xdaf5('0x25')](_0x5ae4f6,_0x293494,!![]);}catch(_0x3f6a86){return BPromise[_0xdaf5('0x26')](_0x3f6a86);}return _0x5ae4f6[_0xdaf5('0x27')]();};}function saveUpdates(_0x233cf4,_0xf04abf){return function(_0x43f349){if(_0x43f349){return _0x43f349[_0xdaf5('0x28')](_0x233cf4)[_0xdaf5('0x29')](function(_0x57c9d2){return _0x57c9d2;});}return null;};}function removeEntity(_0x3684e2,_0x4a8c73){return function(_0x2cd50c){if(_0x2cd50c){return _0x2cd50c['destroy']()[_0xdaf5('0x29')](function(){_0x3684e2[_0xdaf5('0x1c')](0xcc)[_0xdaf5('0x1d')]();});}};}function handleEntityNotFound(_0x176c83,_0x265f8d){return function(_0x58ed77){if(!_0x58ed77){_0x176c83['sendStatus'](0x194);}return _0x58ed77;};}function handleError(_0x25c715,_0x380457){_0x380457=_0x380457||0x1f4;return function(_0x28554f){logger[_0xdaf5('0x2a')](_0x28554f[_0xdaf5('0x2b')]);if(_0x28554f['name']){delete _0x28554f['name'];}_0x25c715[_0xdaf5('0x1c')](_0x380457)['send'](_0x28554f);};}exports[_0xdaf5('0x2c')]=function(_0x5435e0,_0x5b8f43){var _0x1b2ac3={},_0x185042={},_0x467120={'count':0x0,'rows':[]};var _0x13d465=_[_0xdaf5('0x2d')](db[_0xdaf5('0x2e')][_0xdaf5('0x2f')],function(_0x1d8ff1){return{'name':_0x1d8ff1[_0xdaf5('0x30')],'type':_0x1d8ff1['type']['key']};});_0x185042[_0xdaf5('0x31')]=_[_0xdaf5('0x2d')](_0x13d465,'name');_0x185042[_0xdaf5('0x32')]=_[_0xdaf5('0x33')](_0x5435e0[_0xdaf5('0x32')]);_0x185042[_0xdaf5('0x34')]=_['intersection'](_0x185042[_0xdaf5('0x31')],_0x185042[_0xdaf5('0x32')]);_0x1b2ac3[_0xdaf5('0x35')]=_[_0xdaf5('0x36')](_0x185042[_0xdaf5('0x31')],qs['fields'](_0x5435e0[_0xdaf5('0x32')][_0xdaf5('0x37')]));_0x1b2ac3[_0xdaf5('0x35')]=_0x1b2ac3[_0xdaf5('0x35')][_0xdaf5('0x38')]?_0x1b2ac3[_0xdaf5('0x35')]:_0x185042[_0xdaf5('0x31')];if(!_0x5435e0[_0xdaf5('0x32')][_0xdaf5('0x39')](_0xdaf5('0x3a'))){_0x1b2ac3[_0xdaf5('0x21')]=qs['limit'](_0x5435e0[_0xdaf5('0x32')]['limit']);_0x1b2ac3[_0xdaf5('0x1e')]=qs[_0xdaf5('0x1e')](_0x5435e0['query']['offset']);}_0x1b2ac3[_0xdaf5('0x3b')]=qs[_0xdaf5('0x3c')](_0x5435e0[_0xdaf5('0x32')][_0xdaf5('0x3c')]);_0x1b2ac3['where']=qs['filters'](_['pick'](_0x5435e0[_0xdaf5('0x32')],_0x185042[_0xdaf5('0x34')]),_0x13d465);if(_0x5435e0[_0xdaf5('0x32')][_0xdaf5('0x3d')]){_0x1b2ac3[_0xdaf5('0x3e')]=_[_0xdaf5('0x3f')](_0x1b2ac3[_0xdaf5('0x3e')],{'$or':_[_0xdaf5('0x2d')](_0x13d465,function(_0x3fec59){if(_0x3fec59['type']!=='VIRTUAL'){var _0x12fe4a={};_0x12fe4a[_0x3fec59[_0xdaf5('0x40')]]={'$like':'%'+_0x5435e0['query'][_0xdaf5('0x3d')]+'%'};return _0x12fe4a;}})});}_0x1b2ac3=_[_0xdaf5('0x3f')]({},_0x1b2ac3,_0x5435e0[_0xdaf5('0x41')]);var _0x358a1f={'where':_0x1b2ac3['where']};return db[_0xdaf5('0x2e')][_0xdaf5('0x20')](_0x358a1f)[_0xdaf5('0x29')](function(_0x28166f){_0x467120[_0xdaf5('0x20')]=_0x28166f;if(_0x5435e0['query']['includeAll']){_0x1b2ac3[_0xdaf5('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x1b2ac3);})[_0xdaf5('0x29')](function(_0x4e8489){_0x467120[_0xdaf5('0x43')]=_0x4e8489;return _0x467120;})[_0xdaf5('0x29')](respondWithFilteredResult(_0x5b8f43,_0x1b2ac3))[_0xdaf5('0x44')](handleError(_0x5b8f43,null));};exports['show']=function(_0x550802,_0x40242e){var _0x4d214e={'raw':![],'where':{'id':_0x550802[_0xdaf5('0x45')]['id']}},_0x25c63d={};_0x25c63d['model']=_[_0xdaf5('0x33')](db[_0xdaf5('0x2e')][_0xdaf5('0x2f')]);_0x25c63d['query']=_[_0xdaf5('0x33')](_0x550802[_0xdaf5('0x32')]);_0x25c63d[_0xdaf5('0x34')]=_[_0xdaf5('0x36')](_0x25c63d[_0xdaf5('0x31')],_0x25c63d[_0xdaf5('0x32')]);_0x4d214e[_0xdaf5('0x35')]=_[_0xdaf5('0x36')](_0x25c63d[_0xdaf5('0x31')],qs[_0xdaf5('0x37')](_0x550802['query'][_0xdaf5('0x37')]));_0x4d214e[_0xdaf5('0x35')]=_0x4d214e[_0xdaf5('0x35')][_0xdaf5('0x38')]?_0x4d214e['attributes']:_0x25c63d[_0xdaf5('0x31')];if(_0x550802[_0xdaf5('0x32')][_0xdaf5('0x46')]){_0x4d214e[_0xdaf5('0x42')]=[{'all':!![]}];}_0x4d214e=_['merge']({},_0x4d214e,_0x550802[_0xdaf5('0x41')]);return db[_0xdaf5('0x2e')]['find'](_0x4d214e)[_0xdaf5('0x29')](handleEntityNotFound(_0x40242e,null))[_0xdaf5('0x29')](respondWithResult(_0x40242e,null))[_0xdaf5('0x44')](handleError(_0x40242e,null));};exports[_0xdaf5('0x47')]=function(_0x44bb3c,_0x548b24){return db[_0xdaf5('0x2e')][_0xdaf5('0x47')](_0x44bb3c[_0xdaf5('0x48')],{})[_0xdaf5('0x29')](respondWithResult(_0x548b24,0xc9))[_0xdaf5('0x44')](handleError(_0x548b24,null));};exports[_0xdaf5('0x28')]=function(_0x536dfe,_0x579779){if(_0x536dfe[_0xdaf5('0x48')]['id']){delete _0x536dfe[_0xdaf5('0x48')]['id'];}return db['ZendeskConfiguration'][_0xdaf5('0x49')]({'where':{'id':_0x536dfe[_0xdaf5('0x45')]['id']}})[_0xdaf5('0x29')](handleEntityNotFound(_0x579779,null))[_0xdaf5('0x29')](saveUpdates(_0x536dfe[_0xdaf5('0x48')],null))[_0xdaf5('0x29')](respondWithResult(_0x579779,null))[_0xdaf5('0x44')](handleError(_0x579779,null));};exports['destroy']=function(_0x4df817,_0x3241f3){return db['ZendeskConfiguration']['find']({'where':{'id':_0x4df817[_0xdaf5('0x45')]['id']}})[_0xdaf5('0x29')](handleEntityNotFound(_0x3241f3,null))[_0xdaf5('0x29')](removeEntity(_0x3241f3,null))[_0xdaf5('0x44')](handleError(_0x3241f3,null));};exports[_0xdaf5('0x4a')]=function(_0x34e13f,_0x18f92d,_0x55c2ca){var _0x511098={};var _0x82a852={};var _0x477b5b;var _0x429bb1;return db[_0xdaf5('0x2e')][_0xdaf5('0x4b')]({'where':{'id':_0x34e13f[_0xdaf5('0x45')]['id']}})[_0xdaf5('0x29')](handleEntityNotFound(_0x18f92d,null))[_0xdaf5('0x29')](function(_0x339acb){if(_0x339acb){_0x477b5b=_0x339acb;_0x82a852['model']=_[_0xdaf5('0x33')](db[_0xdaf5('0x4c')][_0xdaf5('0x2f')]);_0x82a852[_0xdaf5('0x32')]=_[_0xdaf5('0x33')](_0x34e13f[_0xdaf5('0x32')]);_0x82a852['filters']=_[_0xdaf5('0x36')](_0x82a852[_0xdaf5('0x31')],_0x82a852['query']);_0x511098['attributes']=_[_0xdaf5('0x36')](_0x82a852[_0xdaf5('0x31')],qs[_0xdaf5('0x37')](_0x34e13f[_0xdaf5('0x32')]['fields']));_0x511098['attributes']=_0x511098[_0xdaf5('0x35')]['length']?_0x511098[_0xdaf5('0x35')]:_0x82a852[_0xdaf5('0x31')];_0x511098['order']=qs[_0xdaf5('0x3c')](_0x34e13f[_0xdaf5('0x32')][_0xdaf5('0x3c')]);_0x511098['where']=qs[_0xdaf5('0x34')](_[_0xdaf5('0x4d')](_0x34e13f[_0xdaf5('0x32')],_0x82a852['filters']));if(_0x34e13f[_0xdaf5('0x32')][_0xdaf5('0x3d')]){_0x511098['where']=_[_0xdaf5('0x3f')](_0x511098[_0xdaf5('0x3e')],{'$or':_[_0xdaf5('0x2d')](_0x511098[_0xdaf5('0x35')],function(_0x8ec841){var _0x5142e2={};_0x5142e2[_0x8ec841]={'$like':'%'+_0x34e13f['query']['filter']+'%'};return _0x5142e2;})});}_0x511098=_['merge']({},_0x511098,_0x34e13f[_0xdaf5('0x41')]);return _0x477b5b[_0xdaf5('0x4a')](_0x511098);}})[_0xdaf5('0x29')](function(_0x1e64e4){if(_0x1e64e4){_0x429bb1=_0x1e64e4[_0xdaf5('0x38')];if(!_0x34e13f[_0xdaf5('0x32')][_0xdaf5('0x39')](_0xdaf5('0x3a'))){_0x511098[_0xdaf5('0x21')]=qs['limit'](_0x34e13f[_0xdaf5('0x32')][_0xdaf5('0x21')]);_0x511098['offset']=qs[_0xdaf5('0x1e')](_0x34e13f['query'][_0xdaf5('0x1e')]);}return _0x477b5b['getFields'](_0x511098);}})['then'](function(_0x34cea9){if(_0x34cea9){return _0x34cea9?{'count':_0x429bb1,'rows':_0x34cea9}:null;}})[_0xdaf5('0x29')](respondWithResult(_0x18f92d,null))['catch'](handleError(_0x18f92d,null));};exports['getSubjects']=function(_0x1df057,_0x2dc8a3,_0x414358){var _0x11b2c8={};var _0xc03eaf={};var _0x9df203;var _0x4cce0a;return db['ZendeskConfiguration'][_0xdaf5('0x4b')]({'where':{'id':_0x1df057[_0xdaf5('0x45')]['id']}})[_0xdaf5('0x29')](handleEntityNotFound(_0x2dc8a3,null))[_0xdaf5('0x29')](function(_0x211bda){if(_0x211bda){_0x9df203=_0x211bda;_0xc03eaf[_0xdaf5('0x31')]=_[_0xdaf5('0x33')](db[_0xdaf5('0x4c')][_0xdaf5('0x2f')]);_0xc03eaf[_0xdaf5('0x32')]=_[_0xdaf5('0x33')](_0x1df057[_0xdaf5('0x32')]);_0xc03eaf[_0xdaf5('0x34')]=_[_0xdaf5('0x36')](_0xc03eaf['model'],_0xc03eaf[_0xdaf5('0x32')]);_0x11b2c8[_0xdaf5('0x35')]=_[_0xdaf5('0x36')](_0xc03eaf[_0xdaf5('0x31')],qs[_0xdaf5('0x37')](_0x1df057[_0xdaf5('0x32')]['fields']));_0x11b2c8[_0xdaf5('0x35')]=_0x11b2c8[_0xdaf5('0x35')][_0xdaf5('0x38')]?_0x11b2c8[_0xdaf5('0x35')]:_0xc03eaf[_0xdaf5('0x31')];_0x11b2c8[_0xdaf5('0x3b')]=qs[_0xdaf5('0x3c')](_0x1df057['query'][_0xdaf5('0x3c')]);_0x11b2c8[_0xdaf5('0x3e')]=qs['filters'](_['pick'](_0x1df057['query'],_0xc03eaf[_0xdaf5('0x34')]));if(_0x1df057[_0xdaf5('0x32')][_0xdaf5('0x3d')]){_0x11b2c8[_0xdaf5('0x3e')]=_['merge'](_0x11b2c8[_0xdaf5('0x3e')],{'$or':_['map'](_0x11b2c8[_0xdaf5('0x35')],function(_0x162203){var _0x4ed627={};_0x4ed627[_0x162203]={'$like':'%'+_0x1df057[_0xdaf5('0x32')][_0xdaf5('0x3d')]+'%'};return _0x4ed627;})});}_0x11b2c8=_[_0xdaf5('0x3f')]({},_0x11b2c8,_0x1df057[_0xdaf5('0x41')]);return _0x9df203[_0xdaf5('0x4e')](_0x11b2c8);}})['then'](function(_0xadaf73){if(_0xadaf73){_0x4cce0a=_0xadaf73[_0xdaf5('0x38')];if(!_0x1df057[_0xdaf5('0x32')][_0xdaf5('0x39')](_0xdaf5('0x3a'))){_0x11b2c8['limit']=qs['limit'](_0x1df057[_0xdaf5('0x32')][_0xdaf5('0x21')]);_0x11b2c8[_0xdaf5('0x1e')]=qs['offset'](_0x1df057[_0xdaf5('0x32')][_0xdaf5('0x1e')]);}return _0x9df203[_0xdaf5('0x4e')](_0x11b2c8);}})[_0xdaf5('0x29')](function(_0x3cd92f){if(_0x3cd92f){return _0x3cd92f?{'count':_0x4cce0a,'rows':_0x3cd92f}:null;}})[_0xdaf5('0x29')](respondWithResult(_0x2dc8a3,null))['catch'](handleError(_0x2dc8a3,null));};exports[_0xdaf5('0x4f')]=function(_0x4cba82,_0x38ac4d,_0x311400){var _0x4e5ab9={};var _0x542162={};var _0x1d3d86;var _0xc0a9fe;return db[_0xdaf5('0x2e')]['findOne']({'where':{'id':_0x4cba82['params']['id']}})[_0xdaf5('0x29')](handleEntityNotFound(_0x38ac4d,null))['then'](function(_0x27e838){if(_0x27e838){_0x1d3d86=_0x27e838;_0x542162['model']=_['keys'](db[_0xdaf5('0x4c')]['rawAttributes']);_0x542162[_0xdaf5('0x32')]=_['keys'](_0x4cba82[_0xdaf5('0x32')]);_0x542162[_0xdaf5('0x34')]=_[_0xdaf5('0x36')](_0x542162[_0xdaf5('0x31')],_0x542162[_0xdaf5('0x32')]);_0x4e5ab9[_0xdaf5('0x35')]=_[_0xdaf5('0x36')](_0x542162[_0xdaf5('0x31')],qs[_0xdaf5('0x37')](_0x4cba82[_0xdaf5('0x32')][_0xdaf5('0x37')]));_0x4e5ab9['attributes']=_0x4e5ab9['attributes'][_0xdaf5('0x38')]?_0x4e5ab9[_0xdaf5('0x35')]:_0x542162[_0xdaf5('0x31')];_0x4e5ab9[_0xdaf5('0x3b')]=qs[_0xdaf5('0x3c')](_0x4cba82['query']['sort']);_0x4e5ab9[_0xdaf5('0x3e')]=qs[_0xdaf5('0x34')](_[_0xdaf5('0x4d')](_0x4cba82[_0xdaf5('0x32')],_0x542162[_0xdaf5('0x34')]));if(_0x4cba82[_0xdaf5('0x32')]['filter']){_0x4e5ab9[_0xdaf5('0x3e')]=_[_0xdaf5('0x3f')](_0x4e5ab9['where'],{'$or':_[_0xdaf5('0x2d')](_0x4e5ab9[_0xdaf5('0x35')],function(_0xa169e){var _0x2e98b2={};_0x2e98b2[_0xa169e]={'$like':'%'+_0x4cba82[_0xdaf5('0x32')]['filter']+'%'};return _0x2e98b2;})});}_0x4e5ab9=_[_0xdaf5('0x3f')]({},_0x4e5ab9,_0x4cba82[_0xdaf5('0x41')]);return _0x1d3d86[_0xdaf5('0x4f')](_0x4e5ab9);}})['then'](function(_0x4aaa3c){if(_0x4aaa3c){_0xc0a9fe=_0x4aaa3c[_0xdaf5('0x38')];if(!_0x4cba82[_0xdaf5('0x32')][_0xdaf5('0x39')](_0xdaf5('0x3a'))){_0x4e5ab9[_0xdaf5('0x21')]=qs[_0xdaf5('0x21')](_0x4cba82['query']['limit']);_0x4e5ab9[_0xdaf5('0x1e')]=qs[_0xdaf5('0x1e')](_0x4cba82[_0xdaf5('0x32')][_0xdaf5('0x1e')]);}return _0x1d3d86[_0xdaf5('0x4f')](_0x4e5ab9);}})[_0xdaf5('0x29')](function(_0xb1c44c){if(_0xb1c44c){return _0xb1c44c?{'count':_0xc0a9fe,'rows':_0xb1c44c}:null;}})['then'](respondWithResult(_0x38ac4d,null))[_0xdaf5('0x44')](handleError(_0x38ac4d,null));};exports[_0xdaf5('0x50')]=function(_0x52c597,_0x8559ce,_0x152f7f){var _0x441453={};var _0x2ed81b={};var _0x1bc919;var _0x4c0253;return db[_0xdaf5('0x2e')][_0xdaf5('0x4b')]({'where':{'id':_0x52c597[_0xdaf5('0x45')]['id']}})[_0xdaf5('0x29')](handleEntityNotFound(_0x8559ce,null))[_0xdaf5('0x29')](function(_0x18abc1){if(_0x18abc1){_0x1bc919=_0x18abc1;_0x2ed81b[_0xdaf5('0x31')]=_[_0xdaf5('0x33')](db[_0xdaf5('0x51')]['rawAttributes']);_0x2ed81b[_0xdaf5('0x32')]=_['keys'](_0x52c597[_0xdaf5('0x32')]);_0x2ed81b[_0xdaf5('0x34')]=_[_0xdaf5('0x36')](_0x2ed81b[_0xdaf5('0x31')],_0x2ed81b[_0xdaf5('0x32')]);_0x441453['attributes']=_[_0xdaf5('0x36')](_0x2ed81b[_0xdaf5('0x31')],qs[_0xdaf5('0x37')](_0x52c597[_0xdaf5('0x32')]['fields']));_0x441453[_0xdaf5('0x35')]=_0x441453[_0xdaf5('0x35')][_0xdaf5('0x38')]?_0x441453[_0xdaf5('0x35')]:_0x2ed81b[_0xdaf5('0x31')];_0x441453[_0xdaf5('0x3b')]=qs[_0xdaf5('0x3c')](_0x52c597[_0xdaf5('0x32')][_0xdaf5('0x3c')]);_0x441453[_0xdaf5('0x3e')]=qs[_0xdaf5('0x34')](_[_0xdaf5('0x4d')](_0x52c597[_0xdaf5('0x32')],_0x2ed81b['filters']));if(_0x52c597['query'][_0xdaf5('0x3d')]){_0x441453[_0xdaf5('0x3e')]=_[_0xdaf5('0x3f')](_0x441453[_0xdaf5('0x3e')],{'$or':_['map'](_0x441453['attributes'],function(_0x10004f){var _0x498da9={};_0x498da9[_0x10004f]={'$like':'%'+_0x52c597[_0xdaf5('0x32')][_0xdaf5('0x3d')]+'%'};return _0x498da9;})});}_0x441453=_[_0xdaf5('0x3f')]({},_0x441453,_0x52c597['options']);return _0x1bc919[_0xdaf5('0x50')](_0x441453);}})[_0xdaf5('0x29')](function(_0xefca1c){if(_0xefca1c){_0x4c0253=_0xefca1c[_0xdaf5('0x38')];if(!_0x52c597[_0xdaf5('0x32')][_0xdaf5('0x39')]('nolimit')){_0x441453[_0xdaf5('0x21')]=qs[_0xdaf5('0x21')](_0x52c597[_0xdaf5('0x32')][_0xdaf5('0x21')]);_0x441453[_0xdaf5('0x1e')]=qs[_0xdaf5('0x1e')](_0x52c597[_0xdaf5('0x32')][_0xdaf5('0x1e')]);}return _0x1bc919[_0xdaf5('0x50')](_0x441453);}})[_0xdaf5('0x29')](function(_0x5109cf){if(_0x5109cf){return _0x5109cf?{'count':_0x4c0253,'rows':_0x5109cf}:null;}})[_0xdaf5('0x29')](respondWithResult(_0x8559ce,null))[_0xdaf5('0x44')](handleError(_0x8559ce,null));};exports['setTags']=function(_0x355933,_0x5cd2fa,_0x4d7523){if(_0x355933[_0xdaf5('0x48')]['id']){delete _0x355933[_0xdaf5('0x48')]['id'];}return db[_0xdaf5('0x2e')]['findOne']({'where':{'id':_0x355933[_0xdaf5('0x45')]['id']}})['then'](handleEntityNotFound(_0x5cd2fa,null))[_0xdaf5('0x29')](function(_0x1a6b4a){if(_0x1a6b4a){return _0x1a6b4a[_0xdaf5('0x52')](_0x355933[_0xdaf5('0x48')]['ids']||[]);}return null;})[_0xdaf5('0x29')](respondWithResult(_0x5cd2fa,null))[_0xdaf5('0x44')](handleError(_0x5cd2fa,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 851899d..cff4703 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 _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x2cd708,_0x40810a){var _0x5dbdaf=function(_0x275349){while(--_0x275349){_0x2cd708['push'](_0x2cd708['shift']());}};_0x5dbdaf(++_0x40810a);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x5391a9,_0x119e43){_0x5391a9=_0x5391a9-0x0;var _0x4f0c45=_0xe1e3[_0x5391a9];return _0x4f0c45;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x4336a6,_0xc235ca){var _0x4012f3=function(_0x1acacf){while(--_0x1acacf){_0x4336a6['push'](_0x4336a6['shift']());}};_0x4012f3(++_0xc235ca);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index e28960f..d9f218f 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 _0x21be=['../../config/logger','rpc','../../config/environment','client','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37657a,_0x25aa09){var _0x7126b9=function(_0x2c4cf4){while(--_0x2c4cf4){_0x37657a['push'](_0x37657a['shift']());}};_0x7126b9(++_0x25aa09);}(_0x21be,0x125));var _0xe21b=function(_0x37d7f5,_0x478e72){_0x37d7f5=_0x37d7f5-0x0;var _0x582bc7=_0x21be[_0x37d7f5];return _0x582bc7;};'use strict';var _=require(_0xe21b('0x0'));var util=require('util');var moment=require(_0xe21b('0x1'));var BPromise=require(_0xe21b('0x2'));var rs=require(_0xe21b('0x3'));var fs=require('fs');var Redis=require(_0xe21b('0x4'));var db=require(_0xe21b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe21b('0x6'))(_0xe21b('0x7'));var config=require(_0xe21b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe21b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x436d56,_0x51317c,_0x5b568a){return new BPromise(function(_0x3614a5,_0x483c11){return client[_0xe21b('0xa')](_0x436d56,_0x5b568a)[_0xe21b('0xb')](function(_0xebb556){logger['info'](_0xe21b('0xc'),_0x51317c,_0xe21b('0xd'));logger[_0xe21b('0xe')](_0xe21b('0xf'),_0x51317c,'request\x20sent',JSON[_0xe21b('0x10')](_0xebb556));if(_0xebb556[_0xe21b('0x11')]){if(_0xebb556[_0xe21b('0x11')][_0xe21b('0x12')]===0x1f4){logger[_0xe21b('0x11')](_0xe21b('0xc'),_0x51317c,_0xebb556['error']['message']);return _0x483c11(_0xebb556[_0xe21b('0x11')][_0xe21b('0x13')]);}logger['error'](_0xe21b('0xc'),_0x51317c,_0xebb556['error']['message']);return _0x3614a5(_0xebb556[_0xe21b('0x11')][_0xe21b('0x13')]);}else{logger[_0xe21b('0x14')](_0xe21b('0xc'),_0x51317c,_0xe21b('0xd'));_0x3614a5(_0xebb556[_0xe21b('0x15')][_0xe21b('0x13')]);}})[_0xe21b('0x16')](function(_0x146b2e){logger[_0xe21b('0x11')](_0xe21b('0xc'),_0x51317c,_0x146b2e);_0x483c11(_0x146b2e);});});} \ No newline at end of file +var _0xaf4c=['then','info','request\x20sent','debug','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2577d9,_0x8f2f28){var _0x36fe58=function(_0xbba849){while(--_0xbba849){_0x2577d9['push'](_0x2577d9['shift']());}};_0x36fe58(++_0x8f2f28);}(_0xaf4c,0x195));var _0xcaf4=function(_0x362a0f,_0x2f624d){_0x362a0f=_0x362a0f-0x0;var _0x35d7b7=_0xaf4c[_0x362a0f];return _0x35d7b7;};'use strict';var _=require(_0xcaf4('0x0'));var util=require(_0xcaf4('0x1'));var moment=require(_0xcaf4('0x2'));var BPromise=require(_0xcaf4('0x3'));var rs=require(_0xcaf4('0x4'));var fs=require('fs');var Redis=require(_0xcaf4('0x5'));var db=require(_0xcaf4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaf4('0x7'))(_0xcaf4('0x8'));var config=require(_0xcaf4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcaf4('0xa')][_0xcaf4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54127d,_0x4729c4,_0x1af8d2){return new BPromise(function(_0x3d5e82,_0x4f8db3){return client[_0xcaf4('0xc')](_0x54127d,_0x1af8d2)[_0xcaf4('0xd')](function(_0x6d1a4a){logger[_0xcaf4('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4729c4,_0xcaf4('0xf'));logger[_0xcaf4('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4729c4,_0xcaf4('0xf'),JSON[_0xcaf4('0x11')](_0x6d1a4a));if(_0x6d1a4a[_0xcaf4('0x12')]){if(_0x6d1a4a[_0xcaf4('0x12')]['code']===0x1f4){logger[_0xcaf4('0x12')](_0xcaf4('0x13'),_0x4729c4,_0x6d1a4a[_0xcaf4('0x12')]['message']);return _0x4f8db3(_0x6d1a4a['error'][_0xcaf4('0x14')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x4729c4,_0x6d1a4a['error'][_0xcaf4('0x14')]);return _0x3d5e82(_0x6d1a4a['error'][_0xcaf4('0x14')]);}else{logger['info'](_0xcaf4('0x13'),_0x4729c4,'request\x20sent');_0x3d5e82(_0x6d1a4a['result'][_0xcaf4('0x14')]);}})[_0xcaf4('0x15')](function(_0x5dfc22){logger[_0xcaf4('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4729c4,_0x5dfc22);_0x4f8db3(_0x5dfc22);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4b0299d..ce15447 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 _0x7727=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','multer','util','path'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0x7727,0x1bf));var _0x7772=function(_0x5d75ff,_0x5bc7ac){_0x5d75ff=_0x5d75ff-0x0;var _0x1c1894=_0x7727[_0x5d75ff];return _0x1c1894;};'use strict';var multer=require(_0x7772('0x0'));var util=require(_0x7772('0x1'));var path=require(_0x7772('0x2'));var timeout=require(_0x7772('0x3'));var express=require('express');var router=express[_0x7772('0x4')]();var fs_extra=require(_0x7772('0x5'));var auth=require(_0x7772('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7772('0x7'));var controller=require(_0x7772('0x8'));router[_0x7772('0x9')]('/',auth[_0x7772('0xa')](),controller[_0x7772('0xb')]);router[_0x7772('0x9')](_0x7772('0xc'),auth[_0x7772('0xa')](),controller[_0x7772('0xd')]);router[_0x7772('0xe')]('/',auth[_0x7772('0xa')](),controller[_0x7772('0xf')]);router['put']('/:id',auth[_0x7772('0xa')](),controller[_0x7772('0x10')]);router['delete'](_0x7772('0xc'),auth[_0x7772('0xa')](),controller[_0x7772('0x11')]);module['exports']=router; \ No newline at end of file +var _0x30f2=['./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x30f2,0x7c));var _0x230f=function(_0x4d8c98,_0x38c1e2){_0x4d8c98=_0x4d8c98-0x0;var _0x3c9156=_0x30f2[_0x4d8c98];return _0x3c9156;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x230f('0x0'));var express=require('express');var router=express[_0x230f('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x230f('0x2'));var interaction=require(_0x230f('0x3'));var config=require('../../config/environment');var controller=require(_0x230f('0x4'));router['get']('/',auth[_0x230f('0x5')](),controller[_0x230f('0x6')]);router[_0x230f('0x7')](_0x230f('0x8'),auth[_0x230f('0x5')](),controller[_0x230f('0x9')]);router[_0x230f('0xa')]('/',auth[_0x230f('0x5')](),controller[_0x230f('0xb')]);router[_0x230f('0xc')](_0x230f('0x8'),auth[_0x230f('0x5')](),controller['update']);router[_0x230f('0xd')](_0x230f('0x8'),auth[_0x230f('0x5')](),controller[_0x230f('0xe')]);module[_0x230f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index cc3ee56..9c9d501 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 _0xaadf=['keyValue','picklist','variable','STRING','BOOLEAN','ENUM','string'];(function(_0x245327,_0x2bbe5f){var _0x4d441c=function(_0x281a13){while(--_0x281a13){_0x245327['push'](_0x245327['shift']());}};_0x4d441c(++_0x2bbe5f);}(_0xaadf,0xe5));var _0xfaad=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xaadf[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xfaad('0x0')](_0xfaad('0x1'),'variable','customVariable',_0xfaad('0x2'),_0xfaad('0x3')),'defaultValue':_0xfaad('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfaad('0x0')](_0xfaad('0x1'),_0xfaad('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfaad('0x5')]},'nameField':{'type':Sequelize[_0xfaad('0x5')]},'customField':{'type':Sequelize[_0xfaad('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfaad('0x5')]}}; \ No newline at end of file +var _0x705f=['customVariable','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x10fc8a,_0x52263b){var _0x2b39b5=function(_0x347ed){while(--_0x347ed){_0x10fc8a['push'](_0x10fc8a['shift']());}};_0x2b39b5(++_0x52263b);}(_0x705f,0x1b6));var _0xf705=function(_0x5c64a1,_0x10a799){_0x5c64a1=_0x5c64a1-0x0;var _0x3cc675=_0x705f[_0x5c64a1];return _0x3cc675;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf705('0x0')](_0xf705('0x1'),_0xf705('0x2'),_0xf705('0x3'),'keyValue',_0xf705('0x4')),'defaultValue':_0xf705('0x1')},'content':{'type':Sequelize[_0xf705('0x5')]},'key':{'type':Sequelize[_0xf705('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xf705('0x1'),_0xf705('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf705('0x5')]},'nameField':{'type':Sequelize[_0xf705('0x5')]},'customField':{'type':Sequelize[_0xf705('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf705('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 350775b..58d30c9 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 _0x0be4=['../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','find','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x0be4,0x1ed));var _0x40be=function(_0x3d04d8,_0x35709f){_0x3d04d8=_0x3d04d8-0x0;var _0x35d01f=_0x0be4[_0x3d04d8];return _0x35d01f;};'use strict';var emlformat=require(_0x40be('0x0'));var rimraf=require(_0x40be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40be('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40be('0x3'));var Mustache=require(_0x40be('0x4'));var util=require(_0x40be('0x5'));var path=require(_0x40be('0x6'));var sox=require('sox');var csv=require(_0x40be('0x7'));var ejs=require(_0x40be('0x8'));var fs=require('fs');var fs_extra=require(_0x40be('0x9'));var _=require('lodash');var squel=require(_0x40be('0xa'));var crypto=require(_0x40be('0xb'));var jsforce=require(_0x40be('0xc'));var deskjs=require(_0x40be('0xd'));var toCsv=require('to-csv');var querystring=require(_0x40be('0xe'));var Papa=require(_0x40be('0xf'));var Redis=require(_0x40be('0x10'));var authService=require(_0x40be('0x11'));var qs=require(_0x40be('0x12'));var as=require(_0x40be('0x13'));var hardwareService=require(_0x40be('0x14'));var logger=require(_0x40be('0x15'))(_0x40be('0x16'));var utils=require(_0x40be('0x17'));var config=require(_0x40be('0x18'));var licenseUtil=require(_0x40be('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19f4a2,_0xa01481){_0xa01481=_0xa01481||0xcc;return function(_0x1f00e7){if(_0x1f00e7){return _0x19f4a2[_0x40be('0x1a')](_0xa01481);}return _0x19f4a2[_0x40be('0x1b')](_0xa01481)[_0x40be('0x1c')]();};}function respondWithResult(_0xe9dbe3,_0x45b737){_0x45b737=_0x45b737||0xc8;return function(_0x5934af){if(_0x5934af){return _0xe9dbe3[_0x40be('0x1b')](_0x45b737)[_0x40be('0x1d')](_0x5934af);}};}function respondWithFilteredResult(_0x3ad07c,_0x5b062c){return function(_0xcec47d){if(_0xcec47d){var _0x58d9a0=typeof _0x5b062c['offset']==='undefined'&&typeof _0x5b062c['limit']==='undefined';var _0x5944a4=_0xcec47d[_0x40be('0x1e')];var _0x3ca6ec=_0x58d9a0?0x0:_0x5b062c[_0x40be('0x1f')];var _0x4b98b1=_0x58d9a0?_0xcec47d[_0x40be('0x1e')]:_0x5b062c[_0x40be('0x1f')]+_0x5b062c[_0x40be('0x20')];var _0xac524;if(_0x4b98b1>=_0x5944a4){_0x4b98b1=_0x5944a4;_0xac524=0xc8;}else{_0xac524=0xce;}_0x3ad07c[_0x40be('0x1b')](_0xac524);return _0x3ad07c[_0x40be('0x21')](_0x40be('0x22'),_0x3ca6ec+'-'+_0x4b98b1+'/'+_0x5944a4)[_0x40be('0x1d')](_0xcec47d);}return null;};}function patchUpdates(_0x251c86){return function(_0x2b213c){try{jsonpatch[_0x40be('0x23')](_0x2b213c,_0x251c86,!![]);}catch(_0x178ead){return BPromise[_0x40be('0x24')](_0x178ead);}return _0x2b213c['save']();};}function saveUpdates(_0x4acc15,_0x252168){return function(_0x82871a){if(_0x82871a){return _0x82871a[_0x40be('0x25')](_0x4acc15)[_0x40be('0x26')](function(_0x563ec1){return _0x563ec1;});}return null;};}function removeEntity(_0x2d4ba5,_0xba9ff4){return function(_0x37314f){if(_0x37314f){return _0x37314f[_0x40be('0x27')]()[_0x40be('0x26')](function(){_0x2d4ba5[_0x40be('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1a97,_0x28a835){return function(_0x2c7f25){if(!_0x2c7f25){_0x4e1a97['sendStatus'](0x194);}return _0x2c7f25;};}function handleError(_0x2d6e57,_0x2e600a){_0x2e600a=_0x2e600a||0x1f4;return function(_0x336dcb){logger[_0x40be('0x28')](_0x336dcb['stack']);if(_0x336dcb[_0x40be('0x29')]){delete _0x336dcb[_0x40be('0x29')];}_0x2d6e57['status'](_0x2e600a)['send'](_0x336dcb);};}exports[_0x40be('0x2a')]=function(_0x311996,_0xce4d1c){var _0x17ad1f={},_0x45df58={},_0x46ca54={'count':0x0,'rows':[]};var _0x47b1d0=_[_0x40be('0x2b')](db[_0x40be('0x2c')][_0x40be('0x2d')],function(_0x51316d){return{'name':_0x51316d['fieldName'],'type':_0x51316d[_0x40be('0x2e')][_0x40be('0x2f')]};});_0x45df58[_0x40be('0x30')]=_[_0x40be('0x2b')](_0x47b1d0,'name');_0x45df58[_0x40be('0x31')]=_[_0x40be('0x32')](_0x311996[_0x40be('0x31')]);_0x45df58[_0x40be('0x33')]=_['intersection'](_0x45df58[_0x40be('0x30')],_0x45df58[_0x40be('0x31')]);_0x17ad1f[_0x40be('0x34')]=_[_0x40be('0x35')](_0x45df58['model'],qs[_0x40be('0x36')](_0x311996[_0x40be('0x31')][_0x40be('0x36')]));_0x17ad1f['attributes']=_0x17ad1f[_0x40be('0x34')][_0x40be('0x37')]?_0x17ad1f['attributes']:_0x45df58[_0x40be('0x30')];if(!_0x311996[_0x40be('0x31')][_0x40be('0x38')](_0x40be('0x39'))){_0x17ad1f['limit']=qs[_0x40be('0x20')](_0x311996[_0x40be('0x31')][_0x40be('0x20')]);_0x17ad1f[_0x40be('0x1f')]=qs[_0x40be('0x1f')](_0x311996[_0x40be('0x31')]['offset']);}_0x17ad1f['order']=qs[_0x40be('0x3a')](_0x311996[_0x40be('0x31')][_0x40be('0x3a')]);_0x17ad1f[_0x40be('0x3b')]=qs[_0x40be('0x33')](_[_0x40be('0x3c')](_0x311996['query'],_0x45df58[_0x40be('0x33')]),_0x47b1d0);if(_0x311996['query'][_0x40be('0x3d')]){_0x17ad1f[_0x40be('0x3b')]=_[_0x40be('0x3e')](_0x17ad1f['where'],{'$or':_['map'](_0x47b1d0,function(_0x30a112){if(_0x30a112[_0x40be('0x2e')]!==_0x40be('0x3f')){var _0x267422={};_0x267422[_0x30a112[_0x40be('0x29')]]={'$like':'%'+_0x311996[_0x40be('0x31')][_0x40be('0x3d')]+'%'};return _0x267422;}})});}_0x17ad1f=_['merge']({},_0x17ad1f,_0x311996[_0x40be('0x40')]);var _0x5dc6c2={'where':_0x17ad1f[_0x40be('0x3b')]};return db[_0x40be('0x2c')][_0x40be('0x1e')](_0x5dc6c2)[_0x40be('0x26')](function(_0x913e45){_0x46ca54['count']=_0x913e45;if(_0x311996[_0x40be('0x31')][_0x40be('0x41')]){_0x17ad1f[_0x40be('0x42')]=[{'all':!![]}];}return db[_0x40be('0x2c')][_0x40be('0x43')](_0x17ad1f);})[_0x40be('0x26')](function(_0x1c1361){_0x46ca54['rows']=_0x1c1361;return _0x46ca54;})[_0x40be('0x26')](respondWithFilteredResult(_0xce4d1c,_0x17ad1f))['catch'](handleError(_0xce4d1c,null));};exports[_0x40be('0x44')]=function(_0x2a2535,_0x4bc838){var _0x58ce4f={'raw':!![],'where':{'id':_0x2a2535[_0x40be('0x45')]['id']}},_0x39c74e={};_0x39c74e[_0x40be('0x30')]=_[_0x40be('0x32')](db[_0x40be('0x2c')][_0x40be('0x2d')]);_0x39c74e[_0x40be('0x31')]=_[_0x40be('0x32')](_0x2a2535[_0x40be('0x31')]);_0x39c74e['filters']=_[_0x40be('0x35')](_0x39c74e[_0x40be('0x30')],_0x39c74e[_0x40be('0x31')]);_0x58ce4f[_0x40be('0x34')]=_[_0x40be('0x35')](_0x39c74e['model'],qs[_0x40be('0x36')](_0x2a2535['query'][_0x40be('0x36')]));_0x58ce4f['attributes']=_0x58ce4f['attributes']['length']?_0x58ce4f[_0x40be('0x34')]:_0x39c74e[_0x40be('0x30')];if(_0x2a2535[_0x40be('0x31')]['includeAll']){_0x58ce4f['include']=[{'all':!![]}];}_0x58ce4f=_[_0x40be('0x3e')]({},_0x58ce4f,_0x2a2535['options']);return db[_0x40be('0x2c')]['find'](_0x58ce4f)[_0x40be('0x26')](handleEntityNotFound(_0x4bc838,null))[_0x40be('0x26')](respondWithResult(_0x4bc838,null))[_0x40be('0x46')](handleError(_0x4bc838,null));};exports['create']=function(_0x48fc0b,_0x45df19){return db[_0x40be('0x2c')][_0x40be('0x47')](_0x48fc0b[_0x40be('0x48')],{})['then'](respondWithResult(_0x45df19,0xc9))[_0x40be('0x46')](handleError(_0x45df19,null));};exports['update']=function(_0x5972af,_0xd459c7){if(_0x5972af[_0x40be('0x48')]['id']){delete _0x5972af[_0x40be('0x48')]['id'];}return db['ZendeskField'][_0x40be('0x49')]({'where':{'id':_0x5972af[_0x40be('0x45')]['id']}})['then'](handleEntityNotFound(_0xd459c7,null))[_0x40be('0x26')](saveUpdates(_0x5972af[_0x40be('0x48')],null))[_0x40be('0x26')](respondWithResult(_0xd459c7,null))[_0x40be('0x46')](handleError(_0xd459c7,null));};exports[_0x40be('0x27')]=function(_0x11fb0e,_0x291eb6){return db[_0x40be('0x2c')]['find']({'where':{'id':_0x11fb0e[_0x40be('0x45')]['id']}})[_0x40be('0x26')](handleEntityNotFound(_0x291eb6,null))[_0x40be('0x26')](removeEntity(_0x291eb6,null))[_0x40be('0x46')](handleError(_0x291eb6,null));}; \ No newline at end of file +var _0xe4ae=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','ZendeskField','includeAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','rawAttributes','model','map','query'];(function(_0x2a5c48,_0x30769c){var _0x146cca=function(_0x468fe1){while(--_0x468fe1){_0x2a5c48['push'](_0x2a5c48['shift']());}};_0x146cca(++_0x30769c);}(_0xe4ae,0x182));var _0xee4a=function(_0x3e7ad4,_0x70c17b){_0x3e7ad4=_0x3e7ad4-0x0;var _0x2b0d65=_0xe4ae[_0x3e7ad4];return _0x2b0d65;};'use strict';var emlformat=require(_0xee4a('0x0'));var rimraf=require(_0xee4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee4a('0x2'));var rp=require(_0xee4a('0x3'));var moment=require(_0xee4a('0x4'));var BPromise=require(_0xee4a('0x5'));var Mustache=require(_0xee4a('0x6'));var util=require('util');var path=require(_0xee4a('0x7'));var sox=require(_0xee4a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee4a('0x9'));var _=require(_0xee4a('0xa'));var squel=require(_0xee4a('0xb'));var crypto=require(_0xee4a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee4a('0xd'));var toCsv=require(_0xee4a('0xe'));var querystring=require(_0xee4a('0xf'));var Papa=require(_0xee4a('0x10'));var Redis=require('ioredis');var authService=require(_0xee4a('0x11'));var qs=require(_0xee4a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xee4a('0x13'))(_0xee4a('0x14'));var utils=require('../../config/utils');var config=require(_0xee4a('0x15'));var licenseUtil=require(_0xee4a('0x16'));var db=require(_0xee4a('0x17'))['db'];function respondWithStatusCode(_0x17a66f,_0x463aa6){_0x463aa6=_0x463aa6||0xcc;return function(_0x3cda96){if(_0x3cda96){return _0x17a66f['sendStatus'](_0x463aa6);}return _0x17a66f[_0xee4a('0x18')](_0x463aa6)[_0xee4a('0x19')]();};}function respondWithResult(_0x13caea,_0x210c53){_0x210c53=_0x210c53||0xc8;return function(_0x3d14fe){if(_0x3d14fe){return _0x13caea['status'](_0x210c53)[_0xee4a('0x1a')](_0x3d14fe);}};}function respondWithFilteredResult(_0x23af7e,_0x2fd408){return function(_0x1011f3){if(_0x1011f3){var _0x5263c4=typeof _0x2fd408[_0xee4a('0x1b')]==='undefined'&&typeof _0x2fd408[_0xee4a('0x1c')]==='undefined';var _0x50882b=_0x1011f3['count'];var _0x500b56=_0x5263c4?0x0:_0x2fd408[_0xee4a('0x1b')];var _0x187d97=_0x5263c4?_0x1011f3[_0xee4a('0x1d')]:_0x2fd408[_0xee4a('0x1b')]+_0x2fd408['limit'];var _0x86a827;if(_0x187d97>=_0x50882b){_0x187d97=_0x50882b;_0x86a827=0xc8;}else{_0x86a827=0xce;}_0x23af7e['status'](_0x86a827);return _0x23af7e['set'](_0xee4a('0x1e'),_0x500b56+'-'+_0x187d97+'/'+_0x50882b)[_0xee4a('0x1a')](_0x1011f3);}return null;};}function patchUpdates(_0x1ce082){return function(_0x28f49e){try{jsonpatch[_0xee4a('0x1f')](_0x28f49e,_0x1ce082,!![]);}catch(_0x394b31){return BPromise[_0xee4a('0x20')](_0x394b31);}return _0x28f49e[_0xee4a('0x21')]();};}function saveUpdates(_0x4c0a58,_0x58a072){return function(_0x25ab91){if(_0x25ab91){return _0x25ab91[_0xee4a('0x22')](_0x4c0a58)['then'](function(_0x5650d6){return _0x5650d6;});}return null;};}function removeEntity(_0xcfad03,_0x5571e0){return function(_0x2be00b){if(_0x2be00b){return _0x2be00b[_0xee4a('0x23')]()[_0xee4a('0x24')](function(){_0xcfad03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b8b50,_0x31841d){return function(_0x547907){if(!_0x547907){_0x2b8b50[_0xee4a('0x25')](0x194);}return _0x547907;};}function handleError(_0x4452eb,_0x65ffe8){_0x65ffe8=_0x65ffe8||0x1f4;return function(_0x3da689){logger['error'](_0x3da689[_0xee4a('0x26')]);if(_0x3da689[_0xee4a('0x27')]){delete _0x3da689[_0xee4a('0x27')];}_0x4452eb['status'](_0x65ffe8)[_0xee4a('0x28')](_0x3da689);};}exports[_0xee4a('0x29')]=function(_0x233285,_0x3bfe18){var _0x359164={},_0x108264={},_0x32ce4a={'count':0x0,'rows':[]};var _0x41a0ce=_['map'](db['ZendeskField'][_0xee4a('0x2a')],function(_0x4252f0){return{'name':_0x4252f0['fieldName'],'type':_0x4252f0['type']['key']};});_0x108264[_0xee4a('0x2b')]=_[_0xee4a('0x2c')](_0x41a0ce,_0xee4a('0x27'));_0x108264[_0xee4a('0x2d')]=_[_0xee4a('0x2e')](_0x233285['query']);_0x108264[_0xee4a('0x2f')]=_['intersection'](_0x108264[_0xee4a('0x2b')],_0x108264[_0xee4a('0x2d')]);_0x359164[_0xee4a('0x30')]=_[_0xee4a('0x31')](_0x108264[_0xee4a('0x2b')],qs[_0xee4a('0x32')](_0x233285[_0xee4a('0x2d')]['fields']));_0x359164[_0xee4a('0x30')]=_0x359164[_0xee4a('0x30')][_0xee4a('0x33')]?_0x359164[_0xee4a('0x30')]:_0x108264[_0xee4a('0x2b')];if(!_0x233285['query'][_0xee4a('0x34')](_0xee4a('0x35'))){_0x359164[_0xee4a('0x1c')]=qs[_0xee4a('0x1c')](_0x233285[_0xee4a('0x2d')][_0xee4a('0x1c')]);_0x359164[_0xee4a('0x1b')]=qs[_0xee4a('0x1b')](_0x233285['query'][_0xee4a('0x1b')]);}_0x359164[_0xee4a('0x36')]=qs[_0xee4a('0x37')](_0x233285[_0xee4a('0x2d')]['sort']);_0x359164[_0xee4a('0x38')]=qs[_0xee4a('0x2f')](_[_0xee4a('0x39')](_0x233285[_0xee4a('0x2d')],_0x108264[_0xee4a('0x2f')]),_0x41a0ce);if(_0x233285[_0xee4a('0x2d')][_0xee4a('0x3a')]){_0x359164[_0xee4a('0x38')]=_[_0xee4a('0x3b')](_0x359164[_0xee4a('0x38')],{'$or':_[_0xee4a('0x2c')](_0x41a0ce,function(_0x2cfbec){if(_0x2cfbec[_0xee4a('0x3c')]!==_0xee4a('0x3d')){var _0x3aab2e={};_0x3aab2e[_0x2cfbec[_0xee4a('0x27')]]={'$like':'%'+_0x233285[_0xee4a('0x2d')]['filter']+'%'};return _0x3aab2e;}})});}_0x359164=_['merge']({},_0x359164,_0x233285['options']);var _0x44d77e={'where':_0x359164[_0xee4a('0x38')]};return db[_0xee4a('0x3e')]['count'](_0x44d77e)[_0xee4a('0x24')](function(_0x3429e5){_0x32ce4a[_0xee4a('0x1d')]=_0x3429e5;if(_0x233285['query'][_0xee4a('0x3f')]){_0x359164['include']=[{'all':!![]}];}return db[_0xee4a('0x3e')]['findAll'](_0x359164);})[_0xee4a('0x24')](function(_0x23884d){_0x32ce4a[_0xee4a('0x40')]=_0x23884d;return _0x32ce4a;})[_0xee4a('0x24')](respondWithFilteredResult(_0x3bfe18,_0x359164))[_0xee4a('0x41')](handleError(_0x3bfe18,null));};exports[_0xee4a('0x42')]=function(_0x513fd6,_0x149ab3){var _0xc661b6={'raw':!![],'where':{'id':_0x513fd6[_0xee4a('0x43')]['id']}},_0x5ef604={};_0x5ef604[_0xee4a('0x2b')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x5ef604[_0xee4a('0x2d')]=_[_0xee4a('0x2e')](_0x513fd6['query']);_0x5ef604[_0xee4a('0x2f')]=_[_0xee4a('0x31')](_0x5ef604[_0xee4a('0x2b')],_0x5ef604['query']);_0xc661b6[_0xee4a('0x30')]=_[_0xee4a('0x31')](_0x5ef604[_0xee4a('0x2b')],qs[_0xee4a('0x32')](_0x513fd6['query']['fields']));_0xc661b6[_0xee4a('0x30')]=_0xc661b6[_0xee4a('0x30')][_0xee4a('0x33')]?_0xc661b6[_0xee4a('0x30')]:_0x5ef604[_0xee4a('0x2b')];if(_0x513fd6[_0xee4a('0x2d')][_0xee4a('0x3f')]){_0xc661b6[_0xee4a('0x44')]=[{'all':!![]}];}_0xc661b6=_[_0xee4a('0x3b')]({},_0xc661b6,_0x513fd6['options']);return db[_0xee4a('0x3e')][_0xee4a('0x45')](_0xc661b6)['then'](handleEntityNotFound(_0x149ab3,null))[_0xee4a('0x24')](respondWithResult(_0x149ab3,null))[_0xee4a('0x41')](handleError(_0x149ab3,null));};exports[_0xee4a('0x46')]=function(_0x1b2b65,_0x46bbc7){return db[_0xee4a('0x3e')][_0xee4a('0x46')](_0x1b2b65[_0xee4a('0x47')],{})['then'](respondWithResult(_0x46bbc7,0xc9))[_0xee4a('0x41')](handleError(_0x46bbc7,null));};exports[_0xee4a('0x22')]=function(_0x193aab,_0x22b738){if(_0x193aab[_0xee4a('0x47')]['id']){delete _0x193aab[_0xee4a('0x47')]['id'];}return db[_0xee4a('0x3e')][_0xee4a('0x45')]({'where':{'id':_0x193aab[_0xee4a('0x43')]['id']}})[_0xee4a('0x24')](handleEntityNotFound(_0x22b738,null))[_0xee4a('0x24')](saveUpdates(_0x193aab['body'],null))[_0xee4a('0x24')](respondWithResult(_0x22b738,null))[_0xee4a('0x41')](handleError(_0x22b738,null));};exports[_0xee4a('0x23')]=function(_0x4f3bd3,_0x4ae27c){return db[_0xee4a('0x3e')][_0xee4a('0x45')]({'where':{'id':_0x4f3bd3[_0xee4a('0x43')]['id']}})[_0xee4a('0x24')](handleEntityNotFound(_0x4ae27c,null))[_0xee4a('0x24')](removeEntity(_0x4ae27c,null))[_0xee4a('0x41')](handleError(_0x4ae27c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 1761240..876e818 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 _0x1e00=['FieldId','util','../../config/logger','api','moment','request-promise','path','./intZendeskField.attributes','define','ZendeskField','zendesk_unique_index'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x1e00,0x1b9));var _0x01e0=function(_0x1fd912,_0x5f27b7){_0x1fd912=_0x1fd912-0x0;var _0xe87d35=_0x1e00[_0x1fd912];return _0xe87d35;};'use strict';var _=require('lodash');var util=require(_0x01e0('0x0'));var logger=require(_0x01e0('0x1'))(_0x01e0('0x2'));var moment=require(_0x01e0('0x3'));var BPromise=require('bluebird');var rp=require(_0x01e0('0x4'));var fs=require('fs');var path=require(_0x01e0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x01e0('0x6'));module['exports']=function(_0x301ddf,_0xd3761d){return _0x301ddf[_0x01e0('0x7')](_0x01e0('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x01e0('0x9'),'fields':['idField',_0x01e0('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x826a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','idField','FieldId'];(function(_0x2dfb77,_0x9b4e41){var _0x12ad92=function(_0x5d87f5){while(--_0x5d87f5){_0x2dfb77['push'](_0x2dfb77['shift']());}};_0x12ad92(++_0x9b4e41);}(_0x826a,0x68));var _0xa826=function(_0x322203,_0x4e018d){_0x322203=_0x322203-0x0;var _0x3d0bf5=_0x826a[_0x322203];return _0x3d0bf5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa826('0x0'))(_0xa826('0x1'));var moment=require(_0xa826('0x2'));var BPromise=require(_0xa826('0x3'));var rp=require(_0xa826('0x4'));var fs=require('fs');var path=require(_0xa826('0x5'));var rimraf=require(_0xa826('0x6'));var config=require(_0xa826('0x7'));var attributes=require(_0xa826('0x8'));module[_0xa826('0x9')]=function(_0x469125,_0x6eab38){return _0x469125['define'](_0xa826('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xa826('0xb'),_0xa826('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 632b50d..28c6621 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 _0xb16c=['then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x159b5b,_0x4ec484){var _0x5c82c5=function(_0x26694f){while(--_0x26694f){_0x159b5b['push'](_0x159b5b['shift']());}};_0x5c82c5(++_0x4ec484);}(_0xb16c,0x161));var _0xcb16=function(_0x2f8375,_0x347fd7){_0x2f8375=_0x2f8375-0x0;var _0x2c003c=_0xb16c[_0x2f8375];return _0x2c003c;};'use strict';var _=require('lodash');var util=require(_0xcb16('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb16('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb16('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb16('0x3'))(_0xcb16('0x4'));var config=require('../../config/environment');var jayson=require(_0xcb16('0x5'));var client=jayson['client'][_0xcb16('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34dd3b,_0x5d1fc9,_0x4b1aba){return new BPromise(function(_0x22a05d,_0x5dae70){return client[_0xcb16('0x7')](_0x34dd3b,_0x4b1aba)[_0xcb16('0x8')](function(_0x546a19){logger['info'](_0xcb16('0x9'),_0x5d1fc9,_0xcb16('0xa'));logger[_0xcb16('0xb')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5d1fc9,_0xcb16('0xa'),JSON[_0xcb16('0xc')](_0x546a19));if(_0x546a19['error']){if(_0x546a19[_0xcb16('0xd')][_0xcb16('0xe')]===0x1f4){logger['error'](_0xcb16('0x9'),_0x5d1fc9,_0x546a19[_0xcb16('0xd')][_0xcb16('0xf')]);return _0x5dae70(_0x546a19[_0xcb16('0xd')][_0xcb16('0xf')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x5d1fc9,_0x546a19[_0xcb16('0xd')][_0xcb16('0xf')]);return _0x22a05d(_0x546a19[_0xcb16('0xd')]['message']);}else{logger[_0xcb16('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5d1fc9,_0xcb16('0xa'));_0x22a05d(_0x546a19[_0xcb16('0x11')][_0xcb16('0xf')]);}})[_0xcb16('0x12')](function(_0x4f3043){logger[_0xcb16('0xd')](_0xcb16('0x9'),_0x5d1fc9,_0x4f3043);_0x5dae70(_0x4f3043);});});} \ No newline at end of file +var _0x59bc=['ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug'];(function(_0x4720ad,_0xb46733){var _0x54bb0c=function(_0x326e11){while(--_0x326e11){_0x4720ad['push'](_0x4720ad['shift']());}};_0x54bb0c(++_0xb46733);}(_0x59bc,0x12d));var _0xc59b=function(_0x5e6f4d,_0x26c904){_0x5e6f4d=_0x5e6f4d-0x0;var _0x2ce287=_0x59bc[_0x5e6f4d];return _0x2ce287;};'use strict';var _=require(_0xc59b('0x0'));var util=require('util');var moment=require(_0xc59b('0x1'));var BPromise=require(_0xc59b('0x2'));var rs=require(_0xc59b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc59b('0x4'))['db'];var utils=require(_0xc59b('0x5'));var logger=require(_0xc59b('0x6'))('rpc');var config=require(_0xc59b('0x7'));var jayson=require(_0xc59b('0x8'));var client=jayson[_0xc59b('0x9')][_0xc59b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbeb12f,_0x559c7b,_0x594794){return new BPromise(function(_0x4a87ab,_0x45edef){return client['request'](_0xbeb12f,_0x594794)[_0xc59b('0xb')](function(_0x39f278){logger[_0xc59b('0xc')]('ZendeskField,\x20%s,\x20%s',_0x559c7b,'request\x20sent');logger[_0xc59b('0xd')](_0xc59b('0xe'),_0x559c7b,_0xc59b('0xf'),JSON['stringify'](_0x39f278));if(_0x39f278[_0xc59b('0x10')]){if(_0x39f278['error']['code']===0x1f4){logger[_0xc59b('0x10')](_0xc59b('0x11'),_0x559c7b,_0x39f278['error'][_0xc59b('0x12')]);return _0x45edef(_0x39f278[_0xc59b('0x10')][_0xc59b('0x12')]);}logger[_0xc59b('0x10')](_0xc59b('0x11'),_0x559c7b,_0x39f278[_0xc59b('0x10')]['message']);return _0x4a87ab(_0x39f278[_0xc59b('0x10')][_0xc59b('0x12')]);}else{logger['info'](_0xc59b('0x11'),_0x559c7b,'request\x20sent');_0x4a87ab(_0x39f278[_0xc59b('0x13')][_0xc59b('0x12')]);}})[_0xc59b('0x14')](function(_0x4fdc4c){logger[_0xc59b('0x10')](_0xc59b('0x11'),_0x559c7b,_0x4fdc4c);_0x45edef(_0x4fdc4c);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2632e9f..dd44def 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 _0xe68e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','/:id','delete','exports','util'];(function(_0x3014a4,_0x56b5aa){var _0x4ff3da=function(_0x17c093){while(--_0x17c093){_0x3014a4['push'](_0x3014a4['shift']());}};_0x4ff3da(++_0x56b5aa);}(_0xe68e,0x14f));var _0xee68=function(_0x3a2deb,_0x2f8c2d){_0x3a2deb=_0x3a2deb-0x0;var _0x203ab0=_0xe68e[_0x3a2deb];return _0x203ab0;};'use strict';var multer=require('multer');var util=require(_0xee68('0x0'));var path=require(_0xee68('0x1'));var timeout=require(_0xee68('0x2'));var express=require(_0xee68('0x3'));var router=express[_0xee68('0x4')]();var fs_extra=require(_0xee68('0x5'));var auth=require(_0xee68('0x6'));var interaction=require(_0xee68('0x7'));var config=require(_0xee68('0x8'));var controller=require(_0xee68('0x9'));router[_0xee68('0xa')]('/',auth[_0xee68('0xb')](),controller['index']);router[_0xee68('0xa')]('/:id',auth[_0xee68('0xb')](),controller['show']);router['get'](_0xee68('0xc'),auth['isAuthenticated'](),controller[_0xee68('0xd')]);router[_0xee68('0xa')](_0xee68('0xe'),auth['isAuthenticated'](),controller[_0xee68('0xf')]);router[_0xee68('0x10')]('/',auth[_0xee68('0xb')](),controller['create']);router[_0xee68('0x10')]('/:id/configurations',auth[_0xee68('0xb')](),controller['addConfiguration']);router[_0xee68('0x11')](_0xee68('0x12'),auth[_0xee68('0xb')](),controller['update']);router[_0xee68('0x13')](_0xee68('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xee68('0x14')]=router; \ No newline at end of file +var _0xb22f=['getConfigurations','/:id/fields','post','addConfiguration','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations'];(function(_0x465d9e,_0x24af89){var _0x29bb3d=function(_0x5cc2eb){while(--_0x5cc2eb){_0x465d9e['push'](_0x465d9e['shift']());}};_0x29bb3d(++_0x24af89);}(_0xb22f,0x1bf));var _0xfb22=function(_0x12698e,_0x20aa91){_0x12698e=_0x12698e-0x0;var _0x4e4b4f=_0xb22f[_0x12698e];return _0x4e4b4f;};'use strict';var multer=require(_0xfb22('0x0'));var util=require('util');var path=require(_0xfb22('0x1'));var timeout=require(_0xfb22('0x2'));var express=require(_0xfb22('0x3'));var router=express[_0xfb22('0x4')]();var fs_extra=require(_0xfb22('0x5'));var auth=require(_0xfb22('0x6'));var interaction=require(_0xfb22('0x7'));var config=require(_0xfb22('0x8'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xfb22('0x9')](),controller[_0xfb22('0xa')]);router[_0xfb22('0xb')](_0xfb22('0xc'),auth[_0xfb22('0x9')](),controller[_0xfb22('0xd')]);router[_0xfb22('0xb')](_0xfb22('0xe'),auth[_0xfb22('0x9')](),controller[_0xfb22('0xf')]);router[_0xfb22('0xb')](_0xfb22('0x10'),auth[_0xfb22('0x9')](),controller['getFields']);router[_0xfb22('0x11')]('/',auth[_0xfb22('0x9')](),controller['create']);router[_0xfb22('0x11')](_0xfb22('0xe'),auth[_0xfb22('0x9')](),controller[_0xfb22('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfb22('0x13')]);router['delete'](_0xfb22('0xc'),auth[_0xfb22('0x9')](),controller[_0xfb22('0x14')]);module[_0xfb22('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0b40e15..9713cff 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 _0xda55=['STRING','sequelize','exports'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xda55,0x6d));var _0x5da5=function(_0x610144,_0x1be4c5){_0x610144=_0x610144-0x0;var _0x43b6e4=_0xda55[_0x610144];return _0x43b6e4;};'use strict';var Sequelize=require(_0x5da5('0x0'));module[_0x5da5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5da5('0x2')]},'zone':{'type':Sequelize[_0x5da5('0x2')]},'clientId':{'type':Sequelize[_0x5da5('0x2')]},'clientSecret':{'type':Sequelize[_0x5da5('0x2')]},'serverUrl':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x5da5('0x2')]}}; \ No newline at end of file +var _0x9c44=['STRING'];(function(_0x3df21d,_0xa44265){var _0x37ab8a=function(_0x156e3d){while(--_0x156e3d){_0x3df21d['push'](_0x3df21d['shift']());}};_0x37ab8a(++_0xa44265);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')]},'description':{'type':Sequelize[_0x49c4('0x0')]},'host':{'type':Sequelize[_0x49c4('0x0')]},'zone':{'type':Sequelize[_0x49c4('0x0')]},'clientId':{'type':Sequelize[_0x49c4('0x0')]},'clientSecret':{'type':Sequelize[_0x49c4('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x49c4('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d7e4d4f..e4ce7b3 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 _0xc689=['body','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','refresh_token','access_token','getFields','host','zone','serverUrl','refreshToken','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Type','remove','includes','system_mandatory','push','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','map','ZohoAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','find','create'];(function(_0x228598,_0x489492){var _0x1bd8c3=function(_0x16874f){while(--_0x16874f){_0x228598['push'](_0x228598['shift']());}};_0x1bd8c3(++_0x489492);}(_0xc689,0xb8));var _0x9c68=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0xc689[_0x340756];return _0x2ef745;};'use strict';var emlformat=require(_0x9c68('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c68('0x1'));var jsonpatch=require(_0x9c68('0x2'));var rp=require(_0x9c68('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c68('0x4'));var util=require('util');var path=require(_0x9c68('0x5'));var sox=require('sox');var csv=require(_0x9c68('0x6'));var ejs=require(_0x9c68('0x7'));var fs=require('fs');var fs_extra=require(_0x9c68('0x8'));var _=require(_0x9c68('0x9'));var squel=require(_0x9c68('0xa'));var crypto=require(_0x9c68('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c68('0xc'));var toCsv=require(_0x9c68('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9c68('0xd'));var authService=require(_0x9c68('0xe'));var qs=require(_0x9c68('0xf'));var as=require(_0x9c68('0x10'));var hardwareService=require(_0x9c68('0x11'));var logger=require(_0x9c68('0x12'))('api');var utils=require(_0x9c68('0x13'));var config=require(_0x9c68('0x14'));var licenseUtil=require(_0x9c68('0x15'));var db=require(_0x9c68('0x16'))['db'];var integrations=require(_0x9c68('0x17'));function respondWithStatusCode(_0x1791c0,_0x1ee99f){_0x1ee99f=_0x1ee99f||0xcc;return function(_0x4ed282){if(_0x4ed282){return _0x1791c0['sendStatus'](_0x1ee99f);}return _0x1791c0[_0x9c68('0x18')](_0x1ee99f)[_0x9c68('0x19')]();};}function respondWithResult(_0x18992f,_0x5bd5dd){_0x5bd5dd=_0x5bd5dd||0xc8;return function(_0x3a45e2){if(_0x3a45e2){return _0x18992f[_0x9c68('0x18')](_0x5bd5dd)[_0x9c68('0x1a')](_0x3a45e2);}};}function respondWithFilteredResult(_0x4fcc34,_0x1e5560){return function(_0x47753b){if(_0x47753b){var _0x4d4f21=typeof _0x1e5560[_0x9c68('0x1b')]==='undefined'&&typeof _0x1e5560[_0x9c68('0x1c')]===_0x9c68('0x1d');var _0x2c9440=_0x47753b[_0x9c68('0x1e')];var _0x531092=_0x4d4f21?0x0:_0x1e5560[_0x9c68('0x1b')];var _0x3486=_0x4d4f21?_0x47753b[_0x9c68('0x1e')]:_0x1e5560['offset']+_0x1e5560[_0x9c68('0x1c')];var _0x190c70;if(_0x3486>=_0x2c9440){_0x3486=_0x2c9440;_0x190c70=0xc8;}else{_0x190c70=0xce;}_0x4fcc34['status'](_0x190c70);return _0x4fcc34[_0x9c68('0x1f')](_0x9c68('0x20'),_0x531092+'-'+_0x3486+'/'+_0x2c9440)[_0x9c68('0x1a')](_0x47753b);}return null;};}function patchUpdates(_0x207db4){return function(_0x586f18){try{jsonpatch[_0x9c68('0x21')](_0x586f18,_0x207db4,!![]);}catch(_0x5dc95f){return BPromise[_0x9c68('0x22')](_0x5dc95f);}return _0x586f18['save']();};}function saveUpdates(_0x2c5be8,_0x2c43b8){return function(_0x1148ff){if(_0x1148ff){return _0x1148ff[_0x9c68('0x23')](_0x2c5be8)['then'](function(_0x3174cf){return _0x3174cf;});}return null;};}function removeEntity(_0x4db795,_0x5cb8f9){return function(_0x11dc6c){if(_0x11dc6c){return _0x11dc6c[_0x9c68('0x24')]()[_0x9c68('0x25')](function(){_0x4db795[_0x9c68('0x18')](0xcc)[_0x9c68('0x19')]();});}};}function handleEntityNotFound(_0x238b07,_0xe689a9){return function(_0xa972b2){if(!_0xa972b2){_0x238b07[_0x9c68('0x26')](0x194);}return _0xa972b2;};}function handleError(_0x18d1f8,_0x1ffab1){_0x1ffab1=_0x1ffab1||0x1f4;return function(_0x1d2cea){logger[_0x9c68('0x27')](_0x1d2cea['stack']);if(_0x1d2cea['name']){delete _0x1d2cea[_0x9c68('0x28')];}_0x18d1f8[_0x9c68('0x18')](_0x1ffab1)['send'](_0x1d2cea);};}exports['index']=function(_0x49332a,_0x2dd987){var _0x150d23={},_0x4823ae={},_0x3f27cd={'count':0x0,'rows':[]};var _0x32e7a6=_[_0x9c68('0x29')](db[_0x9c68('0x2a')][_0x9c68('0x2b')],function(_0x411bfa){return{'name':_0x411bfa[_0x9c68('0x2c')],'type':_0x411bfa[_0x9c68('0x2d')]['key']};});_0x4823ae[_0x9c68('0x2e')]=_[_0x9c68('0x29')](_0x32e7a6,_0x9c68('0x28'));_0x4823ae[_0x9c68('0x2f')]=_['keys'](_0x49332a[_0x9c68('0x2f')]);_0x4823ae['filters']=_[_0x9c68('0x30')](_0x4823ae[_0x9c68('0x2e')],_0x4823ae['query']);_0x150d23[_0x9c68('0x31')]=_[_0x9c68('0x30')](_0x4823ae[_0x9c68('0x2e')],qs[_0x9c68('0x32')](_0x49332a[_0x9c68('0x2f')][_0x9c68('0x32')]));_0x150d23[_0x9c68('0x31')]=_0x150d23[_0x9c68('0x31')][_0x9c68('0x33')]?_0x150d23[_0x9c68('0x31')]:_0x4823ae[_0x9c68('0x2e')];if(!_0x49332a[_0x9c68('0x2f')][_0x9c68('0x34')](_0x9c68('0x35'))){_0x150d23[_0x9c68('0x1c')]=qs[_0x9c68('0x1c')](_0x49332a['query'][_0x9c68('0x1c')]);_0x150d23[_0x9c68('0x1b')]=qs[_0x9c68('0x1b')](_0x49332a[_0x9c68('0x2f')][_0x9c68('0x1b')]);}_0x150d23['order']=qs[_0x9c68('0x36')](_0x49332a[_0x9c68('0x2f')][_0x9c68('0x36')]);_0x150d23[_0x9c68('0x37')]=qs[_0x9c68('0x38')](_[_0x9c68('0x39')](_0x49332a[_0x9c68('0x2f')],_0x4823ae[_0x9c68('0x38')]),_0x32e7a6);if(_0x49332a[_0x9c68('0x2f')]['filter']){_0x150d23['where']=_[_0x9c68('0x3a')](_0x150d23[_0x9c68('0x37')],{'$or':_[_0x9c68('0x29')](_0x32e7a6,function(_0x884aa0){if(_0x884aa0[_0x9c68('0x2d')]!==_0x9c68('0x3b')){var _0x4c661f={};_0x4c661f[_0x884aa0['name']]={'$like':'%'+_0x49332a[_0x9c68('0x2f')][_0x9c68('0x3c')]+'%'};return _0x4c661f;}})});}_0x150d23=_[_0x9c68('0x3a')]({},_0x150d23,_0x49332a[_0x9c68('0x3d')]);var _0x3c4000={'where':_0x150d23[_0x9c68('0x37')]};return db['ZohoAccount'][_0x9c68('0x1e')](_0x3c4000)['then'](function(_0x34f70c){_0x3f27cd[_0x9c68('0x1e')]=_0x34f70c;if(_0x49332a[_0x9c68('0x2f')][_0x9c68('0x3e')]){_0x150d23[_0x9c68('0x3f')]=[{'all':!![]}];}return db[_0x9c68('0x2a')]['findAll'](_0x150d23);})[_0x9c68('0x25')](function(_0x3ed2a8){_0x3f27cd[_0x9c68('0x40')]=_0x3ed2a8;return _0x3f27cd;})[_0x9c68('0x25')](respondWithFilteredResult(_0x2dd987,_0x150d23))[_0x9c68('0x41')](handleError(_0x2dd987,null));};exports[_0x9c68('0x42')]=function(_0x51d8c7,_0x53bc5f){var _0x4512bb={'raw':![],'where':{'id':_0x51d8c7['params']['id']}},_0x48fb4b={};_0x48fb4b[_0x9c68('0x2e')]=_[_0x9c68('0x43')](db[_0x9c68('0x2a')][_0x9c68('0x2b')]);_0x48fb4b[_0x9c68('0x2f')]=_[_0x9c68('0x43')](_0x51d8c7[_0x9c68('0x2f')]);_0x48fb4b[_0x9c68('0x38')]=_[_0x9c68('0x30')](_0x48fb4b['model'],_0x48fb4b['query']);_0x4512bb[_0x9c68('0x31')]=_['intersection'](_0x48fb4b['model'],qs[_0x9c68('0x32')](_0x51d8c7[_0x9c68('0x2f')]['fields']));_0x4512bb[_0x9c68('0x31')]=_0x4512bb[_0x9c68('0x31')][_0x9c68('0x33')]?_0x4512bb[_0x9c68('0x31')]:_0x48fb4b[_0x9c68('0x2e')];if(_0x51d8c7[_0x9c68('0x2f')][_0x9c68('0x3e')]){_0x4512bb[_0x9c68('0x3f')]=[{'all':!![]}];}_0x4512bb=_[_0x9c68('0x3a')]({},_0x4512bb,_0x51d8c7[_0x9c68('0x3d')]);return db[_0x9c68('0x2a')][_0x9c68('0x44')](_0x4512bb)[_0x9c68('0x25')](handleEntityNotFound(_0x53bc5f,null))[_0x9c68('0x25')](respondWithResult(_0x53bc5f,null))[_0x9c68('0x41')](handleError(_0x53bc5f,null));};exports[_0x9c68('0x45')]=function(_0x5c9878,_0x3e79da){return db[_0x9c68('0x2a')]['create'](_0x5c9878['body'],{})[_0x9c68('0x25')](respondWithResult(_0x3e79da,0xc9))[_0x9c68('0x41')](handleError(_0x3e79da,null));};exports[_0x9c68('0x23')]=function(_0x5aa9b3,_0x208a72){if(_0x5aa9b3[_0x9c68('0x46')]['id']){delete _0x5aa9b3[_0x9c68('0x46')]['id'];}return db[_0x9c68('0x2a')]['find']({'where':{'id':_0x5aa9b3[_0x9c68('0x47')]['id']}})[_0x9c68('0x25')](handleEntityNotFound(_0x208a72,null))[_0x9c68('0x25')](saveUpdates(_0x5aa9b3[_0x9c68('0x46')],null))[_0x9c68('0x25')](respondWithResult(_0x208a72,null))['catch'](handleError(_0x208a72,null));};exports[_0x9c68('0x24')]=function(_0x290e6d,_0xf3c194){return db['ZohoAccount'][_0x9c68('0x44')]({'where':{'id':_0x290e6d['params']['id']}})['then'](handleEntityNotFound(_0xf3c194,null))[_0x9c68('0x25')](removeEntity(_0xf3c194,null))[_0x9c68('0x41')](handleError(_0xf3c194,null));};exports[_0x9c68('0x48')]=function(_0x923571,_0x4a688c,_0x356bc6){var _0x337c3b={};var _0x415d74={};var _0x2d3b77;var _0x1c482f;return db[_0x9c68('0x2a')][_0x9c68('0x49')]({'where':{'id':_0x923571[_0x9c68('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a688c,null))['then'](function(_0x5c6bb8){if(_0x5c6bb8){_0x2d3b77=_0x5c6bb8;_0x415d74[_0x9c68('0x2e')]=_[_0x9c68('0x43')](db[_0x9c68('0x4a')][_0x9c68('0x2b')]);_0x415d74['query']=_[_0x9c68('0x43')](_0x923571[_0x9c68('0x2f')]);_0x415d74['filters']=_['intersection'](_0x415d74[_0x9c68('0x2e')],_0x415d74[_0x9c68('0x2f')]);_0x337c3b[_0x9c68('0x31')]=_[_0x9c68('0x30')](_0x415d74[_0x9c68('0x2e')],qs[_0x9c68('0x32')](_0x923571[_0x9c68('0x2f')]['fields']));_0x337c3b['attributes']=_0x337c3b[_0x9c68('0x31')][_0x9c68('0x33')]?_0x337c3b[_0x9c68('0x31')]:_0x415d74[_0x9c68('0x2e')];_0x337c3b['order']=qs['sort'](_0x923571['query']['sort']);_0x337c3b[_0x9c68('0x37')]=qs['filters'](_[_0x9c68('0x39')](_0x923571[_0x9c68('0x2f')],_0x415d74[_0x9c68('0x38')]));if(_0x923571['query']['filter']){_0x337c3b['where']=_[_0x9c68('0x3a')](_0x337c3b[_0x9c68('0x37')],{'$or':_[_0x9c68('0x29')](_0x337c3b['attributes'],function(_0xc6f054){var _0xad997c={};_0xad997c[_0xc6f054]={'$like':'%'+_0x923571[_0x9c68('0x2f')][_0x9c68('0x3c')]+'%'};return _0xad997c;})});}_0x337c3b=_['merge']({},_0x337c3b,_0x923571[_0x9c68('0x3d')]);return _0x2d3b77[_0x9c68('0x48')](_0x337c3b);}})[_0x9c68('0x25')](function(_0x34128e){if(_0x34128e){_0x1c482f=_0x34128e[_0x9c68('0x33')];if(!_0x923571['query'][_0x9c68('0x34')](_0x9c68('0x35'))){_0x337c3b[_0x9c68('0x1c')]=qs['limit'](_0x923571[_0x9c68('0x2f')][_0x9c68('0x1c')]);_0x337c3b[_0x9c68('0x1b')]=qs[_0x9c68('0x1b')](_0x923571['query'][_0x9c68('0x1b')]);}return _0x2d3b77[_0x9c68('0x48')](_0x337c3b);}})[_0x9c68('0x25')](function(_0xeba0dc){if(_0xeba0dc){return _0xeba0dc?{'count':_0x1c482f,'rows':_0xeba0dc}:null;}})['then'](respondWithResult(_0x4a688c,null))[_0x9c68('0x41')](handleError(_0x4a688c,null));};exports[_0x9c68('0x4b')]=function(_0x32dd1a,_0x240b5b,_0x507337){if(_0x32dd1a[_0x9c68('0x46')]['id']){delete _0x32dd1a[_0x9c68('0x46')]['id'];}return db['ZohoAccount'][_0x9c68('0x49')]({'where':{'id':_0x32dd1a[_0x9c68('0x47')]['id']}})['then'](handleEntityNotFound(_0x240b5b,null))[_0x9c68('0x25')](function(_0x5ef53d){if(_0x5ef53d){_0x32dd1a[_0x9c68('0x46')][_0x9c68('0x4c')]=_0x5ef53d['id'];_0x32dd1a[_0x9c68('0x46')][_0x9c68('0x4d')]=integrations[_0x9c68('0x4e')](_0x32dd1a[_0x9c68('0x46')][_0x9c68('0x4f')],_0x32dd1a[_0x9c68('0x46')][_0x9c68('0x2d')]);_0x32dd1a['body'][_0x9c68('0x50')]=integrations[_0x9c68('0x51')](_0x32dd1a['body'][_0x9c68('0x4f')],_0x32dd1a[_0x9c68('0x46')][_0x9c68('0x2d')]);return db[_0x9c68('0x4a')][_0x9c68('0x45')](_0x32dd1a[_0x9c68('0x46')],{'include':[{'model':db[_0x9c68('0x52')],'as':_0x9c68('0x4d')},{'model':db[_0x9c68('0x52')],'as':_0x9c68('0x50')}]});}return null;})[_0x9c68('0x25')](respondWithResult(_0x240b5b,null))[_0x9c68('0x41')](handleError(_0x240b5b,null));};function getAccessToken(_0x4cf25c){return new Promise(function(_0x5e49a9,_0x1f441a){var _0x5228d8;switch(_0x4cf25c['zone']){case'US':_0x5228d8=_0x9c68('0x53');break;case'AU':_0x5228d8='https://accounts.zoho.com.au';break;case'EU':_0x5228d8=_0x9c68('0x54');break;case'IN':_0x5228d8=_0x9c68('0x55');break;case'CN':_0x5228d8=_0x9c68('0x56');break;default:_0x5228d8=_0x9c68('0x54');break;}var _0x8f0480={'method':_0x9c68('0x57'),'uri':_0x5228d8+_0x9c68('0x58'),'qs':{'refresh_token':_0x4cf25c['refreshToken'],'client_id':_0x4cf25c[_0x9c68('0x59')],'client_secret':_0x4cf25c['clientSecret'],'grant_type':_0x9c68('0x5a')},'json':!![]};return rp(_0x8f0480)['then'](function(_0x5ead38){if(_0x5ead38['access_token']){_0x5e49a9(_0x5ead38[_0x9c68('0x5b')]);}else{_0x1f441a('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x9c68('0x41')](function(_0x540c10){_0x1f441a(_0x540c10);});});}exports[_0x9c68('0x5c')]=function(_0x160a96,_0x776db4,_0x4afed2){var _0x275740,_0x516f4a,_0x2d7191,_0x7be7a6,_0x12ea39;return db[_0x9c68('0x2a')][_0x9c68('0x49')]({'where':{'id':_0x160a96[_0x9c68('0x47')]['id']},'attributes':['id',_0x9c68('0x5d'),_0x9c68('0x5e'),'clientId','clientSecret',_0x9c68('0x5f'),'code',_0x9c68('0x60')]})[_0x9c68('0x25')](handleEntityNotFound(_0x776db4,null))[_0x9c68('0x25')](function(_0x5c61dd){_0x12ea39=_0x5c61dd;_0x275740=_0x12ea39[_0x9c68('0x5d')];_0x516f4a=_0x275740===_0x9c68('0x61')?'eu':_0x9c68('0x62');_0x2d7191=_0x12ea39[_0x9c68('0x5f')];var _0x4c266e=_0x2d7191[_0x9c68('0x63')](-0x1);if(_0x4c266e==='/'||_0x4c266e==='\x5c'||_0x4c266e===':'){_0x2d7191=_0x2d7191['substring'](0x0,_0x2d7191[_0x9c68('0x64')](_0x4c266e));}if(!_0x12ea39[_0x9c68('0x60')]){throw new Error(_0x9c68('0x65'));}return getAccessToken(_0x12ea39);})[_0x9c68('0x25')](function(_0x20465a){if(_0x20465a){return rp({'method':_0x9c68('0x66'),'uri':util[_0x9c68('0x67')](_0x9c68('0x68'),_0x516f4a),'qs':{'module':_0x9c68('0x69')},'headers':{'Authorization':_0x9c68('0x6a')+_0x20465a},'json':!![]});}})['then'](function(_0x4af482){if(_0x4af482){if(_0x4af482[_0x9c68('0x6b')]&&_0x4af482[_0x9c68('0x6b')][_0x9c68('0x27')]){throw new Error(_0x4af482[_0x9c68('0x6b')][_0x9c68('0x27')]['message']);}var _0x27a4b0=[];var _0x38af77=[];var _0x1b05a8=[_0x9c68('0x6c'),_0x9c68('0x6d'),_0x9c68('0x6e'),_0x9c68('0x6f'),'Call_Duration',_0x9c68('0x70'),'Call_Start_Time',_0x9c68('0x71')];_0x38af77=_[_0x9c68('0x72')](_0x4af482[_0x9c68('0x32')],function(_0x1085e2){return _0x1b05a8[_0x9c68('0x73')](_0x1085e2['api_name']);});for(var _0x50996d=0x0;_0x50996d<_0x38af77[_0x9c68('0x33')];_0x50996d++){if(_0x38af77[_0x50996d][_0x9c68('0x74')]===![]){_0x27a4b0[_0x9c68('0x75')]({'id':_0x38af77[_0x50996d]['id'],'name':_0x38af77[_0x50996d]['display_label'],'custom':_0x38af77[_0x50996d][_0x9c68('0x76')],'options':_0x38af77[_0x50996d]['data_type']===_0x9c68('0x77')&&_0x38af77[_0x50996d][_0x9c68('0x78')][_0x9c68('0x33')]>-0x1?_[_0x9c68('0x29')](_0x38af77[_0x50996d][_0x9c68('0x78')],function(_0x3c5f7e){return{'name':_0x3c5f7e,'value':_0x3c5f7e};}):[]});}}return{'count':_0x27a4b0[_0x9c68('0x33')],'rows':_0x27a4b0};}else{return{'count':0x0,'rows':[]};}})[_0x9c68('0x25')](respondWithResult(_0x776db4,null))[_0x9c68('0x41')](function(_0x2e711a){var _0x51b2b0=_0x160a96[_0x9c68('0x2f')][_0x9c68('0x79')]?0x1f4:_0x2e711a[_0x9c68('0x7a')]||0x1f4;logger[_0x9c68('0x27')](_0x9c68('0x7b'),_0x9c68('0x5c'),_0x51b2b0,JSON[_0x9c68('0x7c')](_0x2e711a));delete _0x2e711a['name'];if(_0x51b2b0===0x191){_0x51b2b0=0x190;}_0x776db4[_0x9c68('0x18')](_0x51b2b0)[_0x9c68('0x7d')](_0x160a96['query'][_0x9c68('0x79')]?{'message':_0x9c68('0x7e'),'statusCode':_0x2e711a[_0x9c68('0x7a')]}:_0x2e711a);});}; \ No newline at end of file +var _0x16ae=['lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','ZohoAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','findOne','ZohoConfiguration','getConfigurations','AccountId','getSubjects','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','serverUrl','code','host','zoho.eu','com','substring','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration','Call_Result','remove','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3c1edd,_0x4e43aa){var _0x4707e0=function(_0x33dcc3){while(--_0x33dcc3){_0x3c1edd['push'](_0x3c1edd['shift']());}};_0x4707e0(++_0x4e43aa);}(_0x16ae,0x1f0));var _0xe16a=function(_0x3b8cbe,_0x1242f3){_0x3b8cbe=_0x3b8cbe-0x0;var _0x3c4ff1=_0x16ae[_0x3b8cbe];return _0x3c4ff1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe16a('0x0'));var zipdir=require(_0xe16a('0x1'));var jsonpatch=require(_0xe16a('0x2'));var rp=require(_0xe16a('0x3'));var moment=require(_0xe16a('0x4'));var BPromise=require(_0xe16a('0x5'));var Mustache=require('mustache');var util=require(_0xe16a('0x6'));var path=require(_0xe16a('0x7'));var sox=require(_0xe16a('0x8'));var csv=require(_0xe16a('0x9'));var ejs=require(_0xe16a('0xa'));var fs=require('fs');var fs_extra=require(_0xe16a('0xb'));var _=require(_0xe16a('0xc'));var squel=require(_0xe16a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe16a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe16a('0xf'));var Redis=require('ioredis');var authService=require(_0xe16a('0x10'));var qs=require(_0xe16a('0x11'));var as=require(_0xe16a('0x12'));var hardwareService=require(_0xe16a('0x13'));var logger=require('../../config/logger')(_0xe16a('0x14'));var utils=require('../../config/utils');var config=require(_0xe16a('0x15'));var licenseUtil=require(_0xe16a('0x16'));var db=require(_0xe16a('0x17'))['db'];var integrations=require(_0xe16a('0x18'));function respondWithStatusCode(_0x14e910,_0x42012c){_0x42012c=_0x42012c||0xcc;return function(_0x5ba901){if(_0x5ba901){return _0x14e910[_0xe16a('0x19')](_0x42012c);}return _0x14e910[_0xe16a('0x1a')](_0x42012c)[_0xe16a('0x1b')]();};}function respondWithResult(_0x132c79,_0x3c8f88){_0x3c8f88=_0x3c8f88||0xc8;return function(_0x2236a6){if(_0x2236a6){return _0x132c79[_0xe16a('0x1a')](_0x3c8f88)[_0xe16a('0x1c')](_0x2236a6);}};}function respondWithFilteredResult(_0x2ce7ea,_0x16072f){return function(_0x2066c5){if(_0x2066c5){var _0x397d8f=typeof _0x16072f[_0xe16a('0x1d')]===_0xe16a('0x1e')&&typeof _0x16072f[_0xe16a('0x1f')]===_0xe16a('0x1e');var _0x2037bb=_0x2066c5[_0xe16a('0x20')];var _0x478bf5=_0x397d8f?0x0:_0x16072f['offset'];var _0x44e5e3=_0x397d8f?_0x2066c5['count']:_0x16072f['offset']+_0x16072f[_0xe16a('0x1f')];var _0x594877;if(_0x44e5e3>=_0x2037bb){_0x44e5e3=_0x2037bb;_0x594877=0xc8;}else{_0x594877=0xce;}_0x2ce7ea[_0xe16a('0x1a')](_0x594877);return _0x2ce7ea[_0xe16a('0x21')](_0xe16a('0x22'),_0x478bf5+'-'+_0x44e5e3+'/'+_0x2037bb)[_0xe16a('0x1c')](_0x2066c5);}return null;};}function patchUpdates(_0x4f87df){return function(_0x53a5fe){try{jsonpatch[_0xe16a('0x23')](_0x53a5fe,_0x4f87df,!![]);}catch(_0xddd29e){return BPromise[_0xe16a('0x24')](_0xddd29e);}return _0x53a5fe['save']();};}function saveUpdates(_0x1994ce,_0x40dfd6){return function(_0x108eea){if(_0x108eea){return _0x108eea[_0xe16a('0x25')](_0x1994ce)[_0xe16a('0x26')](function(_0x5df2cf){return _0x5df2cf;});}return null;};}function removeEntity(_0x3c118d,_0x218fdf){return function(_0x36904c){if(_0x36904c){return _0x36904c['destroy']()[_0xe16a('0x26')](function(){_0x3c118d[_0xe16a('0x1a')](0xcc)[_0xe16a('0x1b')]();});}};}function handleEntityNotFound(_0x2cdac6,_0xefa5a6){return function(_0x1f9881){if(!_0x1f9881){_0x2cdac6[_0xe16a('0x19')](0x194);}return _0x1f9881;};}function handleError(_0x730140,_0x23e98f){_0x23e98f=_0x23e98f||0x1f4;return function(_0x4038fc){logger[_0xe16a('0x27')](_0x4038fc[_0xe16a('0x28')]);if(_0x4038fc[_0xe16a('0x29')]){delete _0x4038fc[_0xe16a('0x29')];}_0x730140['status'](_0x23e98f)[_0xe16a('0x2a')](_0x4038fc);};}exports[_0xe16a('0x2b')]=function(_0x53fa8c,_0xa9df6e){var _0x36adaa={},_0x42402c={},_0x33d50d={'count':0x0,'rows':[]};var _0x5e5333=_['map'](db[_0xe16a('0x2c')][_0xe16a('0x2d')],function(_0x2b85a3){return{'name':_0x2b85a3['fieldName'],'type':_0x2b85a3['type'][_0xe16a('0x2e')]};});_0x42402c[_0xe16a('0x2f')]=_[_0xe16a('0x30')](_0x5e5333,_0xe16a('0x29'));_0x42402c[_0xe16a('0x31')]=_[_0xe16a('0x32')](_0x53fa8c[_0xe16a('0x31')]);_0x42402c[_0xe16a('0x33')]=_[_0xe16a('0x34')](_0x42402c[_0xe16a('0x2f')],_0x42402c[_0xe16a('0x31')]);_0x36adaa[_0xe16a('0x35')]=_[_0xe16a('0x34')](_0x42402c[_0xe16a('0x2f')],qs[_0xe16a('0x36')](_0x53fa8c['query'][_0xe16a('0x36')]));_0x36adaa[_0xe16a('0x35')]=_0x36adaa['attributes'][_0xe16a('0x37')]?_0x36adaa[_0xe16a('0x35')]:_0x42402c['model'];if(!_0x53fa8c[_0xe16a('0x31')][_0xe16a('0x38')](_0xe16a('0x39'))){_0x36adaa['limit']=qs[_0xe16a('0x1f')](_0x53fa8c[_0xe16a('0x31')][_0xe16a('0x1f')]);_0x36adaa['offset']=qs[_0xe16a('0x1d')](_0x53fa8c[_0xe16a('0x31')][_0xe16a('0x1d')]);}_0x36adaa[_0xe16a('0x3a')]=qs['sort'](_0x53fa8c['query'][_0xe16a('0x3b')]);_0x36adaa[_0xe16a('0x3c')]=qs[_0xe16a('0x33')](_[_0xe16a('0x3d')](_0x53fa8c[_0xe16a('0x31')],_0x42402c['filters']),_0x5e5333);if(_0x53fa8c[_0xe16a('0x31')][_0xe16a('0x3e')]){_0x36adaa[_0xe16a('0x3c')]=_[_0xe16a('0x3f')](_0x36adaa[_0xe16a('0x3c')],{'$or':_[_0xe16a('0x30')](_0x5e5333,function(_0x26a2bb){if(_0x26a2bb[_0xe16a('0x40')]!==_0xe16a('0x41')){var _0x50bc45={};_0x50bc45[_0x26a2bb[_0xe16a('0x29')]]={'$like':'%'+_0x53fa8c[_0xe16a('0x31')][_0xe16a('0x3e')]+'%'};return _0x50bc45;}})});}_0x36adaa=_[_0xe16a('0x3f')]({},_0x36adaa,_0x53fa8c[_0xe16a('0x42')]);var _0x462504={'where':_0x36adaa[_0xe16a('0x3c')]};return db[_0xe16a('0x2c')][_0xe16a('0x20')](_0x462504)[_0xe16a('0x26')](function(_0x1a65fe){_0x33d50d[_0xe16a('0x20')]=_0x1a65fe;if(_0x53fa8c[_0xe16a('0x31')][_0xe16a('0x43')]){_0x36adaa[_0xe16a('0x44')]=[{'all':!![]}];}return db['ZohoAccount'][_0xe16a('0x45')](_0x36adaa);})[_0xe16a('0x26')](function(_0x73dd90){_0x33d50d[_0xe16a('0x46')]=_0x73dd90;return _0x33d50d;})[_0xe16a('0x26')](respondWithFilteredResult(_0xa9df6e,_0x36adaa))[_0xe16a('0x47')](handleError(_0xa9df6e,null));};exports[_0xe16a('0x48')]=function(_0x441378,_0xf41999){var _0x26731c={'raw':![],'where':{'id':_0x441378[_0xe16a('0x49')]['id']}},_0x100c43={};_0x100c43[_0xe16a('0x2f')]=_[_0xe16a('0x32')](db[_0xe16a('0x2c')]['rawAttributes']);_0x100c43[_0xe16a('0x31')]=_['keys'](_0x441378[_0xe16a('0x31')]);_0x100c43[_0xe16a('0x33')]=_[_0xe16a('0x34')](_0x100c43[_0xe16a('0x2f')],_0x100c43[_0xe16a('0x31')]);_0x26731c[_0xe16a('0x35')]=_[_0xe16a('0x34')](_0x100c43[_0xe16a('0x2f')],qs[_0xe16a('0x36')](_0x441378[_0xe16a('0x31')][_0xe16a('0x36')]));_0x26731c[_0xe16a('0x35')]=_0x26731c[_0xe16a('0x35')][_0xe16a('0x37')]?_0x26731c['attributes']:_0x100c43[_0xe16a('0x2f')];if(_0x441378[_0xe16a('0x31')]['includeAll']){_0x26731c[_0xe16a('0x44')]=[{'all':!![]}];}_0x26731c=_[_0xe16a('0x3f')]({},_0x26731c,_0x441378['options']);return db[_0xe16a('0x2c')][_0xe16a('0x4a')](_0x26731c)['then'](handleEntityNotFound(_0xf41999,null))[_0xe16a('0x26')](respondWithResult(_0xf41999,null))['catch'](handleError(_0xf41999,null));};exports[_0xe16a('0x4b')]=function(_0x15b085,_0x40286e){return db['ZohoAccount']['create'](_0x15b085[_0xe16a('0x4c')],{})[_0xe16a('0x26')](respondWithResult(_0x40286e,0xc9))[_0xe16a('0x47')](handleError(_0x40286e,null));};exports[_0xe16a('0x25')]=function(_0x115621,_0x37df78){if(_0x115621[_0xe16a('0x4c')]['id']){delete _0x115621['body']['id'];}return db['ZohoAccount'][_0xe16a('0x4a')]({'where':{'id':_0x115621[_0xe16a('0x49')]['id']}})[_0xe16a('0x26')](handleEntityNotFound(_0x37df78,null))[_0xe16a('0x26')](saveUpdates(_0x115621[_0xe16a('0x4c')],null))[_0xe16a('0x26')](respondWithResult(_0x37df78,null))['catch'](handleError(_0x37df78,null));};exports[_0xe16a('0x4d')]=function(_0xf815ac,_0x26662e){return db['ZohoAccount'][_0xe16a('0x4a')]({'where':{'id':_0xf815ac[_0xe16a('0x49')]['id']}})[_0xe16a('0x26')](handleEntityNotFound(_0x26662e,null))['then'](removeEntity(_0x26662e,null))[_0xe16a('0x47')](handleError(_0x26662e,null));};exports['getConfigurations']=function(_0x166016,_0x181b32,_0x361eec){var _0x3ad7f2={};var _0x3f0e62={};var _0x2e3c5d;var _0x57aaf8;return db['ZohoAccount'][_0xe16a('0x4e')]({'where':{'id':_0x166016['params']['id']}})[_0xe16a('0x26')](handleEntityNotFound(_0x181b32,null))['then'](function(_0x1c5694){if(_0x1c5694){_0x2e3c5d=_0x1c5694;_0x3f0e62[_0xe16a('0x2f')]=_[_0xe16a('0x32')](db[_0xe16a('0x4f')]['rawAttributes']);_0x3f0e62[_0xe16a('0x31')]=_[_0xe16a('0x32')](_0x166016[_0xe16a('0x31')]);_0x3f0e62[_0xe16a('0x33')]=_['intersection'](_0x3f0e62[_0xe16a('0x2f')],_0x3f0e62[_0xe16a('0x31')]);_0x3ad7f2[_0xe16a('0x35')]=_[_0xe16a('0x34')](_0x3f0e62[_0xe16a('0x2f')],qs[_0xe16a('0x36')](_0x166016['query'][_0xe16a('0x36')]));_0x3ad7f2[_0xe16a('0x35')]=_0x3ad7f2[_0xe16a('0x35')]['length']?_0x3ad7f2[_0xe16a('0x35')]:_0x3f0e62[_0xe16a('0x2f')];_0x3ad7f2[_0xe16a('0x3a')]=qs['sort'](_0x166016[_0xe16a('0x31')][_0xe16a('0x3b')]);_0x3ad7f2[_0xe16a('0x3c')]=qs[_0xe16a('0x33')](_[_0xe16a('0x3d')](_0x166016[_0xe16a('0x31')],_0x3f0e62[_0xe16a('0x33')]));if(_0x166016[_0xe16a('0x31')][_0xe16a('0x3e')]){_0x3ad7f2['where']=_[_0xe16a('0x3f')](_0x3ad7f2[_0xe16a('0x3c')],{'$or':_[_0xe16a('0x30')](_0x3ad7f2[_0xe16a('0x35')],function(_0x497014){var _0x2f6231={};_0x2f6231[_0x497014]={'$like':'%'+_0x166016[_0xe16a('0x31')][_0xe16a('0x3e')]+'%'};return _0x2f6231;})});}_0x3ad7f2=_[_0xe16a('0x3f')]({},_0x3ad7f2,_0x166016['options']);return _0x2e3c5d[_0xe16a('0x50')](_0x3ad7f2);}})[_0xe16a('0x26')](function(_0x1713a2){if(_0x1713a2){_0x57aaf8=_0x1713a2['length'];if(!_0x166016[_0xe16a('0x31')][_0xe16a('0x38')](_0xe16a('0x39'))){_0x3ad7f2[_0xe16a('0x1f')]=qs[_0xe16a('0x1f')](_0x166016[_0xe16a('0x31')][_0xe16a('0x1f')]);_0x3ad7f2[_0xe16a('0x1d')]=qs[_0xe16a('0x1d')](_0x166016[_0xe16a('0x31')][_0xe16a('0x1d')]);}return _0x2e3c5d[_0xe16a('0x50')](_0x3ad7f2);}})[_0xe16a('0x26')](function(_0x95dc42){if(_0x95dc42){return _0x95dc42?{'count':_0x57aaf8,'rows':_0x95dc42}:null;}})[_0xe16a('0x26')](respondWithResult(_0x181b32,null))[_0xe16a('0x47')](handleError(_0x181b32,null));};exports['addConfiguration']=function(_0x1bec38,_0x30e1ae,_0x4133ab){if(_0x1bec38['body']['id']){delete _0x1bec38[_0xe16a('0x4c')]['id'];}return db[_0xe16a('0x2c')][_0xe16a('0x4e')]({'where':{'id':_0x1bec38[_0xe16a('0x49')]['id']}})['then'](handleEntityNotFound(_0x30e1ae,null))[_0xe16a('0x26')](function(_0x3420f0){if(_0x3420f0){_0x1bec38[_0xe16a('0x4c')][_0xe16a('0x51')]=_0x3420f0['id'];_0x1bec38['body']['Subjects']=integrations[_0xe16a('0x52')](_0x1bec38[_0xe16a('0x4c')]['channel'],_0x1bec38[_0xe16a('0x4c')][_0xe16a('0x40')]);_0x1bec38[_0xe16a('0x4c')][_0xe16a('0x53')]=integrations[_0xe16a('0x54')](_0x1bec38[_0xe16a('0x4c')]['channel'],_0x1bec38[_0xe16a('0x4c')][_0xe16a('0x40')]);return db[_0xe16a('0x4f')][_0xe16a('0x4b')](_0x1bec38[_0xe16a('0x4c')],{'include':[{'model':db[_0xe16a('0x55')],'as':_0xe16a('0x56')},{'model':db['ZohoField'],'as':_0xe16a('0x53')}]});}return null;})[_0xe16a('0x26')](respondWithResult(_0x30e1ae,null))['catch'](handleError(_0x30e1ae,null));};function getAccessToken(_0x13416a){return new Promise(function(_0x4ebb35,_0x27be36){var _0x172bcb;switch(_0x13416a[_0xe16a('0x57')]){case'US':_0x172bcb=_0xe16a('0x58');break;case'AU':_0x172bcb='https://accounts.zoho.com.au';break;case'EU':_0x172bcb=_0xe16a('0x59');break;case'IN':_0x172bcb='https://accounts.zoho.in';break;case'CN':_0x172bcb=_0xe16a('0x5a');break;default:_0x172bcb=_0xe16a('0x59');break;}var _0x120ab0={'method':_0xe16a('0x5b'),'uri':_0x172bcb+_0xe16a('0x5c'),'qs':{'refresh_token':_0x13416a[_0xe16a('0x5d')],'client_id':_0x13416a['clientId'],'client_secret':_0x13416a[_0xe16a('0x5e')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x120ab0)[_0xe16a('0x26')](function(_0x457c25){if(_0x457c25['access_token']){_0x4ebb35(_0x457c25[_0xe16a('0x5f')]);}else{_0x27be36(_0xe16a('0x60'));}})['catch'](function(_0x4079e5){_0x27be36(_0x4079e5);});});}exports[_0xe16a('0x61')]=function(_0x5dec2f,_0x297ed3,_0x1a13ad){var _0x252c66,_0x36382d,_0x28e5b9,_0x308168,_0x23d170;return db[_0xe16a('0x2c')]['findOne']({'where':{'id':_0x5dec2f[_0xe16a('0x49')]['id']},'attributes':['id','host',_0xe16a('0x57'),_0xe16a('0x62'),_0xe16a('0x5e'),_0xe16a('0x63'),_0xe16a('0x64'),_0xe16a('0x5d')]})[_0xe16a('0x26')](handleEntityNotFound(_0x297ed3,null))[_0xe16a('0x26')](function(_0x12b929){_0x23d170=_0x12b929;_0x252c66=_0x23d170[_0xe16a('0x65')];_0x36382d=_0x252c66===_0xe16a('0x66')?'eu':_0xe16a('0x67');_0x28e5b9=_0x23d170['serverUrl'];var _0x2a7969=_0x28e5b9['slice'](-0x1);if(_0x2a7969==='/'||_0x2a7969==='\x5c'||_0x2a7969===':'){_0x28e5b9=_0x28e5b9[_0xe16a('0x68')](0x0,_0x28e5b9['lastIndexOf'](_0x2a7969));}if(!_0x23d170['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x23d170);})[_0xe16a('0x26')](function(_0x46e503){if(_0x46e503){return rp({'method':'GET','uri':util[_0xe16a('0x69')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x36382d),'qs':{'module':_0xe16a('0x6a')},'headers':{'Authorization':_0xe16a('0x6b')+_0x46e503},'json':!![]});}})[_0xe16a('0x26')](function(_0x28afc6){if(_0x28afc6){if(_0x28afc6[_0xe16a('0x6c')]&&_0x28afc6[_0xe16a('0x6c')][_0xe16a('0x27')]){throw new Error(_0x28afc6[_0xe16a('0x6c')][_0xe16a('0x27')][_0xe16a('0x6d')]);}var _0x15d18d=[];var _0x1cfb2e=[];var _0x472b91=[_0xe16a('0x6e'),_0xe16a('0x6f'),_0xe16a('0x70'),'WhoId',_0xe16a('0x71'),_0xe16a('0x72'),'Call_Start_Time','Call_Type'];_0x1cfb2e=_[_0xe16a('0x73')](_0x28afc6['fields'],function(_0x501a65){return _0x472b91['includes'](_0x501a65[_0xe16a('0x74')]);});for(var _0x5b0ffb=0x0;_0x5b0ffb<_0x1cfb2e[_0xe16a('0x37')];_0x5b0ffb++){if(_0x1cfb2e[_0x5b0ffb][_0xe16a('0x75')]===![]){_0x15d18d[_0xe16a('0x76')]({'id':_0x1cfb2e[_0x5b0ffb]['id'],'name':_0x1cfb2e[_0x5b0ffb][_0xe16a('0x77')],'custom':_0x1cfb2e[_0x5b0ffb]['custom_field'],'options':_0x1cfb2e[_0x5b0ffb][_0xe16a('0x78')]===_0xe16a('0x79')&&_0x1cfb2e[_0x5b0ffb][_0xe16a('0x7a')][_0xe16a('0x37')]>-0x1?_[_0xe16a('0x30')](_0x1cfb2e[_0x5b0ffb][_0xe16a('0x7a')],function(_0x2e1867){return{'name':_0x2e1867,'value':_0x2e1867};}):[]});}}return{'count':_0x15d18d[_0xe16a('0x37')],'rows':_0x15d18d};}else{return{'count':0x0,'rows':[]};}})[_0xe16a('0x26')](respondWithResult(_0x297ed3,null))['catch'](function(_0x2dba7a){var _0x91851d=_0x5dec2f['query']['test']?0x1f4:_0x2dba7a['statusCode']||0x1f4;logger[_0xe16a('0x27')](_0xe16a('0x7b'),_0xe16a('0x61'),_0x91851d,JSON[_0xe16a('0x7c')](_0x2dba7a));delete _0x2dba7a['name'];if(_0x91851d===0x191){_0x91851d=0x190;}_0x297ed3[_0xe16a('0x1a')](_0x91851d)['send'](_0x5dec2f[_0xe16a('0x31')][_0xe16a('0x7d')]?{'message':_0xe16a('0x7e'),'statusCode':_0x2dba7a['statusCode']}:_0x2dba7a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6451201..15b536b 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 _0x85e6=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','moment','request-promise','path','rimraf','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','zone','serverUrl','clientId','changed','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','name','error','catch','inspect','https://accounts.zoho.com.au','/oauth/v2/token','then','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x85e6,0x1a5));var _0x685e=function(_0x8a2d76,_0x519b02){_0x8a2d76=_0x8a2d76-0x0;var _0xe71214=_0x85e6[_0x8a2d76];return _0xe71214;};'use strict';var _=require(_0x685e('0x0'));var util=require(_0x685e('0x1'));var logger=require('../../config/logger')(_0x685e('0x2'));var moment=require(_0x685e('0x3'));var BPromise=require('bluebird');var rp=require(_0x685e('0x4'));var fs=require('fs');var path=require(_0x685e('0x5'));var rimraf=require(_0x685e('0x6'));var config=require('../../config/environment');var attributes=require(_0x685e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x685e('0x8')]=function(_0x41f13f,_0x3cde2c){return _0x41f13f['define'](_0x685e('0x9'),attributes,{'tableName':_0x685e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a3035,_0x41b38f,_0x3804ae){if(_0x3a3035['changed'](_0x685e('0xb'))||_0x3a3035['changed'](_0x685e('0xc'))||_0x3a3035['changed'](_0x685e('0xd'))||_0x3a3035[_0x685e('0xe')](_0x685e('0xf'))||_0x3a3035[_0x685e('0xe')](_0x685e('0x10'))||_0x3a3035[_0x685e('0xe')](_0x685e('0x11'))){var _0x2d28ca,_0x11401c;_0x2d28ca=_0x3a3035[_0x685e('0xc')];var _0x42fca4=_0x2d28ca[_0x685e('0x12')](-0x1);if(_0x42fca4==='/'||_0x42fca4==='\x5c'||_0x42fca4===':'){_0x2d28ca=_0x2d28ca[_0x685e('0x13')](0x0,_0x2d28ca[_0x685e('0x14')](_0x42fca4));}switch(_0x3a3035[_0x685e('0xb')]){case'US':_0x11401c=_0x685e('0x15');break;case'AU':_0x11401c='https://accounts.zoho.com.au';break;case'IN':_0x11401c=_0x685e('0x16');break;case'CN':_0x11401c=_0x685e('0x17');break;default:_0x11401c=_0x685e('0x18');break;}var _0x3e2a13={'method':_0x685e('0x19'),'uri':_0x11401c+'/oauth/v2/token','form':{'grant_type':_0x685e('0x1a'),'client_id':_0x3a3035[_0x685e('0xd')],'client_secret':_0x3a3035[_0x685e('0xf')],'redirect_uri':_0x3a3035[_0x685e('0xc')],'code':_0x3a3035[_0x685e('0x10')]},'headers':{'Content-Type':_0x685e('0x1b')}};return rp(_0x3e2a13)['then'](function(_0x762e43){var _0x5cfd87=JSON['parse'](_0x762e43);if(_0x5cfd87[_0x685e('0x1c')]){_0x3a3035[_0x685e('0x1d')]=_0x5cfd87[_0x685e('0x1c')];logger[_0x685e('0x1e')](util[_0x685e('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3a3035[_0x685e('0x20')],_0x3a3035['id']));}else{logger[_0x685e('0x21')](util[_0x685e('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3a3035[_0x685e('0x20')],_0x3a3035['id']),util['inspect'](_0x5cfd87,{'showHidden':![],'depth':null}));}return _0x3804ae(null,_0x41b38f);})[_0x685e('0x22')](function(_0x4de4fe){logger[_0x685e('0x21')](util[_0x685e('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3a3035[_0x685e('0x20')],_0x3a3035['id']),util[_0x685e('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x3804ae(_0x4de4fe);});}else{return _0x3804ae(null,_0x41b38f);}},'beforeUpdate':function(_0x3f55a6,_0x2dff6d,_0x486ad2){if(_0x3f55a6[_0x685e('0xe')](_0x685e('0xb'))||_0x3f55a6[_0x685e('0xe')](_0x685e('0xc'))||_0x3f55a6[_0x685e('0xe')](_0x685e('0xd'))||_0x3f55a6[_0x685e('0xe')](_0x685e('0xf'))||_0x3f55a6['changed']('code')||_0x3f55a6[_0x685e('0xe')](_0x685e('0x11'))){var _0x8b1125,_0xd9835d;_0x8b1125=_0x3f55a6['serverUrl'];var _0x11c271=_0x8b1125[_0x685e('0x12')](-0x1);if(_0x11c271==='/'||_0x11c271==='\x5c'||_0x11c271===':'){_0x8b1125=_0x8b1125[_0x685e('0x13')](0x0,_0x8b1125['lastIndexOf'](_0x11c271));}switch(_0x3f55a6[_0x685e('0xb')]){case'US':_0xd9835d=_0x685e('0x15');break;case'AU':_0xd9835d=_0x685e('0x24');break;case'IN':_0xd9835d=_0x685e('0x16');break;case'CN':_0xd9835d='https://accounts.zoho.com.cn';break;default:_0xd9835d=_0x685e('0x18');break;}var _0x28f422={'method':_0x685e('0x19'),'uri':_0xd9835d+_0x685e('0x25'),'form':{'grant_type':'authorization_code','client_id':_0x3f55a6[_0x685e('0xd')],'client_secret':_0x3f55a6[_0x685e('0xf')],'redirect_uri':_0x3f55a6['serverUrl'],'code':_0x3f55a6[_0x685e('0x10')]},'headers':{'Content-Type':_0x685e('0x1b')}};return rp(_0x28f422)[_0x685e('0x26')](function(_0x54de3c){var _0x286b4a=JSON[_0x685e('0x27')](_0x54de3c);if(_0x286b4a[_0x685e('0x1c')]){_0x3f55a6[_0x685e('0x1d')]=_0x286b4a[_0x685e('0x1c')];logger['info'](util[_0x685e('0x1f')](_0x685e('0x28'),_0x3f55a6[_0x685e('0x20')],_0x3f55a6['id']));}else{logger['error'](util[_0x685e('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3f55a6[_0x685e('0x20')],_0x3f55a6['id']),util[_0x685e('0x23')](_0x286b4a,{'showHidden':![],'depth':null}));}return _0x486ad2(null,_0x2dff6d);})[_0x685e('0x22')](function(_0x39babc){logger[_0x685e('0x21')](util['format'](_0x685e('0x29'),_0x3f55a6[_0x685e('0x20')],_0x3f55a6['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x486ad2(_0x39babc);});}else{return _0x486ad2(null,_0x2dff6d);}}}});}; \ No newline at end of file +var _0x9356=['exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','https://accounts.zoho.eu','application/x-www-form-urlencoded','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../components/integrations/configuration'];(function(_0x5b9489,_0x362a93){var _0x16590e=function(_0x2d1819){while(--_0x2d1819){_0x5b9489['push'](_0x5b9489['shift']());}};_0x16590e(++_0x362a93);}(_0x9356,0xff));var _0x6935=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x9356[_0x521929];return _0x632436;};'use strict';var _=require(_0x6935('0x0'));var util=require(_0x6935('0x1'));var logger=require(_0x6935('0x2'))(_0x6935('0x3'));var moment=require('moment');var BPromise=require(_0x6935('0x4'));var rp=require(_0x6935('0x5'));var fs=require('fs');var path=require(_0x6935('0x6'));var rimraf=require(_0x6935('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x6935('0x8'));module[_0x6935('0x9')]=function(_0x8abe46,_0x35aa19){return _0x8abe46[_0x6935('0xa')](_0x6935('0xb'),attributes,{'tableName':_0x6935('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x235cba,_0x54e142,_0x2c6900){if(_0x235cba[_0x6935('0xd')](_0x6935('0xe'))||_0x235cba[_0x6935('0xd')](_0x6935('0xf'))||_0x235cba[_0x6935('0xd')](_0x6935('0x10'))||_0x235cba['changed'](_0x6935('0x11'))||_0x235cba['changed'](_0x6935('0x12'))||_0x235cba['changed'](_0x6935('0x13'))){var _0x3d3eb6,_0x5f019d;_0x3d3eb6=_0x235cba[_0x6935('0xf')];var _0x2c0e87=_0x3d3eb6[_0x6935('0x14')](-0x1);if(_0x2c0e87==='/'||_0x2c0e87==='\x5c'||_0x2c0e87===':'){_0x3d3eb6=_0x3d3eb6[_0x6935('0x15')](0x0,_0x3d3eb6[_0x6935('0x16')](_0x2c0e87));}switch(_0x235cba['zone']){case'US':_0x5f019d=_0x6935('0x17');break;case'AU':_0x5f019d=_0x6935('0x18');break;case'IN':_0x5f019d=_0x6935('0x19');break;case'CN':_0x5f019d=_0x6935('0x1a');break;default:_0x5f019d='https://accounts.zoho.eu';break;}var _0x224efc={'method':_0x6935('0x1b'),'uri':_0x5f019d+_0x6935('0x1c'),'form':{'grant_type':_0x6935('0x1d'),'client_id':_0x235cba[_0x6935('0x10')],'client_secret':_0x235cba[_0x6935('0x11')],'redirect_uri':_0x235cba['serverUrl'],'code':_0x235cba[_0x6935('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x224efc)[_0x6935('0x1e')](function(_0x446111){var _0x247ed1=JSON[_0x6935('0x1f')](_0x446111);if(_0x247ed1[_0x6935('0x20')]){_0x235cba[_0x6935('0x21')]=_0x247ed1['refresh_token'];logger[_0x6935('0x22')](util['format'](_0x6935('0x23'),_0x235cba['name'],_0x235cba['id']));}else{logger[_0x6935('0x24')](util[_0x6935('0x25')](_0x6935('0x26'),_0x235cba[_0x6935('0x27')],_0x235cba['id']),util[_0x6935('0x28')](_0x247ed1,{'showHidden':![],'depth':null}));}return _0x2c6900(null,_0x54e142);})[_0x6935('0x29')](function(_0x1689ab){logger[_0x6935('0x24')](util[_0x6935('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x235cba[_0x6935('0x27')],_0x235cba['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2c6900(_0x1689ab);});}else{return _0x2c6900(null,_0x54e142);}},'beforeUpdate':function(_0x2008a6,_0x1f637f,_0x40fa67){if(_0x2008a6[_0x6935('0xd')](_0x6935('0xe'))||_0x2008a6[_0x6935('0xd')]('serverUrl')||_0x2008a6[_0x6935('0xd')](_0x6935('0x10'))||_0x2008a6[_0x6935('0xd')](_0x6935('0x11'))||_0x2008a6['changed']('code')||_0x2008a6['changed'](_0x6935('0x13'))){var _0x3160f8,_0x3a3491;_0x3160f8=_0x2008a6[_0x6935('0xf')];var _0x9b1fff=_0x3160f8['slice'](-0x1);if(_0x9b1fff==='/'||_0x9b1fff==='\x5c'||_0x9b1fff===':'){_0x3160f8=_0x3160f8[_0x6935('0x15')](0x0,_0x3160f8['lastIndexOf'](_0x9b1fff));}switch(_0x2008a6[_0x6935('0xe')]){case'US':_0x3a3491=_0x6935('0x17');break;case'AU':_0x3a3491='https://accounts.zoho.com.au';break;case'IN':_0x3a3491=_0x6935('0x19');break;case'CN':_0x3a3491=_0x6935('0x1a');break;default:_0x3a3491=_0x6935('0x2a');break;}var _0x5a5edd={'method':_0x6935('0x1b'),'uri':_0x3a3491+_0x6935('0x1c'),'form':{'grant_type':_0x6935('0x1d'),'client_id':_0x2008a6['clientId'],'client_secret':_0x2008a6[_0x6935('0x11')],'redirect_uri':_0x2008a6[_0x6935('0xf')],'code':_0x2008a6['code']},'headers':{'Content-Type':_0x6935('0x2b')}};return rp(_0x5a5edd)[_0x6935('0x1e')](function(_0x4f87fd){var _0x251033=JSON[_0x6935('0x1f')](_0x4f87fd);if(_0x251033[_0x6935('0x20')]){_0x2008a6[_0x6935('0x21')]=_0x251033['refresh_token'];logger['info'](util[_0x6935('0x25')](_0x6935('0x23'),_0x2008a6[_0x6935('0x27')],_0x2008a6['id']));}else{logger[_0x6935('0x24')](util[_0x6935('0x25')](_0x6935('0x26'),_0x2008a6['name'],_0x2008a6['id']),util[_0x6935('0x28')](_0x251033,{'showHidden':![],'depth':null}));}return _0x40fa67(null,_0x1f637f);})[_0x6935('0x29')](function(_0x2e5941){logger[_0x6935('0x24')](util[_0x6935('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2008a6[_0x6935('0x27')],_0x2008a6['id']),util[_0x6935('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x40fa67(_0x2e5941);});}else{return _0x40fa67(null,_0x1f637f);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 413c538..f17682b 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 _0xacf4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowZohoAccount'];(function(_0x55849a,_0x312a0f){var _0x44508f=function(_0x1df85c){while(--_0x1df85c){_0x55849a['push'](_0x55849a['shift']());}};_0x44508f(++_0x312a0f);}(_0xacf4,0xe7));var _0x4acf=function(_0x35d291,_0x1a131b){_0x35d291=_0x35d291-0x0;var _0x370b86=_0xacf4[_0x35d291];return _0x370b86;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});}exports[_0x4acf('0x13')]=function(_0x240c00){var _0x4b1d93=this;return new Promise(function(_0x2a678b,_0x137302){return db[_0x4acf('0x14')][_0x4acf('0x15')]({'raw':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x18')]||null:null,'attributes':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x19')]||null:null,'limit':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1a')]||null:null,'include':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x240c00[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x53885f){return{'model':db[_0x53885f[_0x4acf('0x1d')]],'as':_0x53885f['as'],'attributes':_0x53885f[_0x4acf('0x19')],'include':_0x53885f['include']?_[_0x4acf('0x1c')](_0x53885f[_0x4acf('0x1b')],function(_0x52a84a){return{'model':db[_0x52a84a[_0x4acf('0x1d')]],'as':_0x52a84a['as'],'attributes':_0x52a84a[_0x4acf('0x19')],'include':_0x52a84a[_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x52a84a['include'],function(_0x50236d){return{'model':db[_0x50236d[_0x4acf('0x1d')]],'as':_0x50236d['as'],'attributes':_0x50236d[_0x4acf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0x42c90c){logger[_0x4acf('0xb')](_0x4acf('0x13'),_0x240c00);logger[_0x4acf('0x1e')](_0x4acf('0x13'),_0x240c00,JSON[_0x4acf('0x1f')](_0x42c90c));_0x2a678b(_0x42c90c);})[_0x4acf('0x12')](function(_0x57989e){logger[_0x4acf('0xf')](_0x4acf('0x13'),_0x57989e[_0x4acf('0x10')],_0x240c00);_0x137302(_0x4b1d93[_0x4acf('0xf')](0x1f4,_0x57989e[_0x4acf('0x10')]));});});};exports[_0x4acf('0x20')]=function(_0x27384c){var _0x5d862f=this;return new Promise(function(_0x337b3c,_0x1d221b){return db[_0x4acf('0x14')]['find']({'raw':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x27384c[_0x4acf('0x16')]?_0x27384c['options'][_0x4acf('0x18')]||null:null,'attributes':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')]['attributes']||null:null,'include':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x27384c[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x490880){return{'model':db[_0x490880[_0x4acf('0x1d')]],'as':_0x490880['as'],'attributes':_0x490880[_0x4acf('0x19')],'include':_0x490880['include']?_[_0x4acf('0x1c')](_0x490880['include'],function(_0x4cd020){return{'model':db[_0x4cd020['model']],'as':_0x4cd020['as'],'attributes':_0x4cd020['attributes'],'include':_0x4cd020['include']?_['map'](_0x4cd020['include'],function(_0x3364dd){return{'model':db[_0x3364dd[_0x4acf('0x1d')]],'as':_0x3364dd['as'],'attributes':_0x3364dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0xbd0f92){logger[_0x4acf('0xb')](_0x4acf('0x20'),_0x27384c);logger[_0x4acf('0x1e')](_0x4acf('0x20'),_0x27384c,JSON[_0x4acf('0x1f')](_0xbd0f92));_0x337b3c(_0xbd0f92);})[_0x4acf('0x12')](function(_0x24465b){logger[_0x4acf('0xf')]('ShowZohoAccount',_0x24465b['message'],_0x27384c);_0x1d221b(_0x5d862f[_0x4acf('0xf')](0x1f4,_0x24465b[_0x4acf('0x10')]));});});}; \ No newline at end of file +var _0xaafc=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ZohoAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','GetZohoAccount','find','ShowZohoAccount'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xaafc,0x176));var _0xcaaf=function(_0x52e604,_0x7dbd89){_0x52e604=_0x52e604-0x0;var _0x27d4ee=_0xaafc[_0x52e604];return _0x27d4ee;};'use strict';var _=require('lodash');var util=require(_0xcaaf('0x0'));var moment=require(_0xcaaf('0x1'));var BPromise=require(_0xcaaf('0x2'));var rs=require(_0xcaaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaaf('0x4'))['db'];var utils=require(_0xcaaf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcaaf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcaaf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31e6bb,_0x19d453,_0x22d1b2){return new BPromise(function(_0xdccf0d,_0x4c3e09){return client[_0xcaaf('0x8')](_0x31e6bb,_0x22d1b2)['then'](function(_0x4211c6){logger['info'](_0xcaaf('0x9'),_0x19d453,'request\x20sent');logger[_0xcaaf('0xa')](_0xcaaf('0xb'),_0x19d453,_0xcaaf('0xc'),JSON[_0xcaaf('0xd')](_0x4211c6));if(_0x4211c6[_0xcaaf('0xe')]){if(_0x4211c6[_0xcaaf('0xe')][_0xcaaf('0xf')]===0x1f4){logger[_0xcaaf('0xe')](_0xcaaf('0x9'),_0x19d453,_0x4211c6['error'][_0xcaaf('0x10')]);return _0x4c3e09(_0x4211c6[_0xcaaf('0xe')][_0xcaaf('0x10')]);}logger[_0xcaaf('0xe')](_0xcaaf('0x9'),_0x19d453,_0x4211c6[_0xcaaf('0xe')][_0xcaaf('0x10')]);return _0xdccf0d(_0x4211c6[_0xcaaf('0xe')][_0xcaaf('0x10')]);}else{logger[_0xcaaf('0x11')](_0xcaaf('0x9'),_0x19d453,'request\x20sent');_0xdccf0d(_0x4211c6[_0xcaaf('0x12')][_0xcaaf('0x10')]);}})[_0xcaaf('0x13')](function(_0x3bb678){logger[_0xcaaf('0xe')](_0xcaaf('0x9'),_0x19d453,_0x3bb678);_0x4c3e09(_0x3bb678);});});}exports['GetZohoAccount']=function(_0xf8e303){var _0x10ad54=this;return new Promise(function(_0x534598,_0x4511f4){return db[_0xcaaf('0x14')][_0xcaaf('0x15')]({'raw':_0xf8e303[_0xcaaf('0x16')]?_0xf8e303[_0xcaaf('0x16')][_0xcaaf('0x17')]===undefined?!![]:![]:!![],'where':_0xf8e303[_0xcaaf('0x16')]?_0xf8e303[_0xcaaf('0x16')][_0xcaaf('0x18')]||null:null,'attributes':_0xf8e303[_0xcaaf('0x16')]?_0xf8e303[_0xcaaf('0x16')]['attributes']||null:null,'limit':_0xf8e303[_0xcaaf('0x16')]?_0xf8e303[_0xcaaf('0x16')][_0xcaaf('0x19')]||null:null,'include':_0xf8e303[_0xcaaf('0x16')]?_0xf8e303[_0xcaaf('0x16')][_0xcaaf('0x1a')]?_[_0xcaaf('0x1b')](_0xf8e303['options'][_0xcaaf('0x1a')],function(_0x2c565f){return{'model':db[_0x2c565f[_0xcaaf('0x1c')]],'as':_0x2c565f['as'],'attributes':_0x2c565f['attributes'],'include':_0x2c565f[_0xcaaf('0x1a')]?_[_0xcaaf('0x1b')](_0x2c565f[_0xcaaf('0x1a')],function(_0x3dac7d){return{'model':db[_0x3dac7d[_0xcaaf('0x1c')]],'as':_0x3dac7d['as'],'attributes':_0x3dac7d[_0xcaaf('0x1d')],'include':_0x3dac7d[_0xcaaf('0x1a')]?_['map'](_0x3dac7d[_0xcaaf('0x1a')],function(_0x52145b){return{'model':db[_0x52145b['model']],'as':_0x52145b['as'],'attributes':_0x52145b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcaaf('0x1e')](function(_0x85b4a){logger[_0xcaaf('0x11')](_0xcaaf('0x1f'),_0xf8e303);logger[_0xcaaf('0xa')](_0xcaaf('0x1f'),_0xf8e303,JSON[_0xcaaf('0xd')](_0x85b4a));_0x534598(_0x85b4a);})[_0xcaaf('0x13')](function(_0x1523bc){logger['error']('GetZohoAccount',_0x1523bc[_0xcaaf('0x10')],_0xf8e303);_0x4511f4(_0x10ad54['error'](0x1f4,_0x1523bc[_0xcaaf('0x10')]));});});};exports['ShowZohoAccount']=function(_0x343cd5){var _0x10fec3=this;return new Promise(function(_0x2e8530,_0x336fa3){return db['ZohoAccount'][_0xcaaf('0x20')]({'raw':_0x343cd5[_0xcaaf('0x16')]?_0x343cd5[_0xcaaf('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x343cd5['options']?_0x343cd5[_0xcaaf('0x16')][_0xcaaf('0x18')]||null:null,'attributes':_0x343cd5['options']?_0x343cd5[_0xcaaf('0x16')][_0xcaaf('0x1d')]||null:null,'include':_0x343cd5[_0xcaaf('0x16')]?_0x343cd5[_0xcaaf('0x16')][_0xcaaf('0x1a')]?_[_0xcaaf('0x1b')](_0x343cd5[_0xcaaf('0x16')][_0xcaaf('0x1a')],function(_0x2bc7f6){return{'model':db[_0x2bc7f6['model']],'as':_0x2bc7f6['as'],'attributes':_0x2bc7f6['attributes'],'include':_0x2bc7f6[_0xcaaf('0x1a')]?_['map'](_0x2bc7f6[_0xcaaf('0x1a')],function(_0x351beb){return{'model':db[_0x351beb[_0xcaaf('0x1c')]],'as':_0x351beb['as'],'attributes':_0x351beb['attributes'],'include':_0x351beb['include']?_[_0xcaaf('0x1b')](_0x351beb[_0xcaaf('0x1a')],function(_0x5939db){return{'model':db[_0x5939db['model']],'as':_0x5939db['as'],'attributes':_0x5939db[_0xcaaf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcaaf('0x1e')](function(_0x3573b3){logger['info'](_0xcaaf('0x21'),_0x343cd5);logger['debug'](_0xcaaf('0x21'),_0x343cd5,JSON['stringify'](_0x3573b3));_0x2e8530(_0x3573b3);})[_0xcaaf('0x13')](function(_0x44abfd){logger['error']('ShowZohoAccount',_0x44abfd[_0xcaaf('0x10')],_0x343cd5);_0x336fa3(_0x10fec3[_0xcaaf('0xe')](0x1f4,_0x44abfd['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d8a99a8..133f82a 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 _0x6618=['getDescriptions','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','isAuthenticated','getFields','/:id/subjects','/:id/descriptions'];(function(_0x2d66a8,_0x1625a2){var _0x374b6e=function(_0x35ec72){while(--_0x35ec72){_0x2d66a8['push'](_0x2d66a8['shift']());}};_0x374b6e(++_0x1625a2);}(_0x6618,0x96));var _0x8661=function(_0x58df59,_0x5a0824){_0x58df59=_0x58df59-0x0;var _0x3888fe=_0x6618[_0x58df59];return _0x3888fe;};'use strict';var multer=require(_0x8661('0x0'));var util=require(_0x8661('0x1'));var path=require(_0x8661('0x2'));var timeout=require(_0x8661('0x3'));var express=require(_0x8661('0x4'));var router=express[_0x8661('0x5')]();var fs_extra=require(_0x8661('0x6'));var auth=require(_0x8661('0x7'));var interaction=require(_0x8661('0x8'));var config=require(_0x8661('0x9'));var controller=require('./intZohoConfiguration.controller');router[_0x8661('0xa')]('/',auth['isAuthenticated'](),controller[_0x8661('0xb')]);router['get'](_0x8661('0xc'),auth['isAuthenticated'](),controller[_0x8661('0xd')]);router[_0x8661('0xa')]('/:id/fields',auth[_0x8661('0xe')](),controller[_0x8661('0xf')]);router[_0x8661('0xa')](_0x8661('0x10'),auth[_0x8661('0xe')](),controller['getSubjects']);router['get'](_0x8661('0x11'),auth[_0x8661('0xe')](),controller[_0x8661('0x12')]);router[_0x8661('0x13')]('/',auth[_0x8661('0xe')](),controller['create']);router['put'](_0x8661('0xc'),auth[_0x8661('0xe')](),controller[_0x8661('0x14')]);router[_0x8661('0x15')](_0x8661('0xc'),auth[_0x8661('0xe')](),controller[_0x8661('0x16')]);module[_0x8661('0x17')]=router; \ No newline at end of file +var _0xd363=['../../components/auth/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4b7f88,_0x40a1f8){var _0x6cef80=function(_0x366922){while(--_0x366922){_0x4b7f88['push'](_0x4b7f88['shift']());}};_0x6cef80(++_0x40a1f8);}(_0xd363,0x18a));var _0x3d36=function(_0x289e48,_0x2fe387){_0x289e48=_0x289e48-0x0;var _0x56d497=_0xd363[_0x289e48];return _0x56d497;};'use strict';var multer=require(_0x3d36('0x0'));var util=require('util');var path=require(_0x3d36('0x1'));var timeout=require(_0x3d36('0x2'));var express=require(_0x3d36('0x3'));var router=express[_0x3d36('0x4')]();var fs_extra=require(_0x3d36('0x5'));var auth=require(_0x3d36('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d36('0x7'));router[_0x3d36('0x8')]('/',auth[_0x3d36('0x9')](),controller['index']);router[_0x3d36('0x8')](_0x3d36('0xa'),auth['isAuthenticated'](),controller[_0x3d36('0xb')]);router[_0x3d36('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3d36('0xc')]);router['get']('/:id/subjects',auth[_0x3d36('0x9')](),controller[_0x3d36('0xd')]);router[_0x3d36('0x8')](_0x3d36('0xe'),auth['isAuthenticated'](),controller[_0x3d36('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3d36('0x10')](_0x3d36('0xa'),auth['isAuthenticated'](),controller[_0x3d36('0x11')]);router[_0x3d36('0x12')](_0x3d36('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3d36('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 304d128..e24b27e 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 _0x9aee=['contact_lead','sequelize','exports','STRING','ENUM','lead','contact','nothing'];(function(_0x5bcb92,_0x40de87){var _0x9a3e07=function(_0x2af088){while(--_0x2af088){_0x5bcb92['push'](_0x5bcb92['shift']());}};_0x9a3e07(++_0x40de87);}(_0x9aee,0x71));var _0xe9ae=function(_0x1b43e3,_0x9f8fed){_0x1b43e3=_0x1b43e3-0x0;var _0xbfcd48=_0x9aee[_0x1b43e3];return _0xbfcd48;};'use strict';var Sequelize=require(_0xe9ae('0x0'));module[_0xe9ae('0x1')]={'name':{'type':Sequelize[_0xe9ae('0x2')]},'moduleCreate':{'type':Sequelize[_0xe9ae('0x3')](_0xe9ae('0x4'),_0xe9ae('0x5'),_0xe9ae('0x6')),'defaultValue':_0xe9ae('0x4')},'moduleSearch':{'type':Sequelize[_0xe9ae('0x3')]('contact_lead','contact','lead'),'defaultValue':_0xe9ae('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0d05=['ENUM','lead','nothing','contact_lead','contact','sequelize','exports','STRING'];(function(_0x378f04,_0x5d94e4){var _0x228776=function(_0x3e6ee4){while(--_0x3e6ee4){_0x378f04['push'](_0x378f04['shift']());}};_0x228776(++_0x5d94e4);}(_0x0d05,0xed));var _0x50d0=function(_0x3be1a7,_0x1b1f31){_0x3be1a7=_0x3be1a7-0x0;var _0x6648ac=_0x0d05[_0x3be1a7];return _0x6648ac;};'use strict';var Sequelize=require(_0x50d0('0x0'));module[_0x50d0('0x1')]={'name':{'type':Sequelize[_0x50d0('0x2')]},'moduleCreate':{'type':Sequelize[_0x50d0('0x3')](_0x50d0('0x4'),'contact',_0x50d0('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x50d0('0x3')](_0x50d0('0x6'),_0x50d0('0x7'),_0x50d0('0x4')),'defaultValue':_0x50d0('0x6')},'description':{'type':Sequelize[_0x50d0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 41b3ab1..52e9fe2 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 _0xc366=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','rows','catch','show','keys','include','find','create','body','update','params','destroy','getFields','findOne','order','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x1af097,_0x5f2b5f){var _0x2d7e2e=function(_0x30b742){while(--_0x30b742){_0x1af097['push'](_0x1af097['shift']());}};_0x2d7e2e(++_0x5f2b5f);}(_0xc366,0x88));var _0x6c36=function(_0x49390c,_0xbeec97){_0x49390c=_0x49390c-0x0;var _0xbb8940=_0xc366[_0x49390c];return _0xbb8940;};'use strict';var emlformat=require(_0x6c36('0x0'));var rimraf=require(_0x6c36('0x1'));var zipdir=require(_0x6c36('0x2'));var jsonpatch=require(_0x6c36('0x3'));var rp=require(_0x6c36('0x4'));var moment=require(_0x6c36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6c36('0x6'));var util=require(_0x6c36('0x7'));var path=require(_0x6c36('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6c36('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c36('0xa'));var squel=require(_0x6c36('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c36('0xc'));var querystring=require(_0x6c36('0xd'));var Papa=require('papaparse');var Redis=require(_0x6c36('0xe'));var authService=require(_0x6c36('0xf'));var qs=require(_0x6c36('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c36('0x11'))(_0x6c36('0x12'));var utils=require(_0x6c36('0x13'));var config=require(_0x6c36('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c36('0x15'))['db'];function respondWithStatusCode(_0x2bdecf,_0x3d3f98){_0x3d3f98=_0x3d3f98||0xcc;return function(_0x4bb8da){if(_0x4bb8da){return _0x2bdecf[_0x6c36('0x16')](_0x3d3f98);}return _0x2bdecf['status'](_0x3d3f98)['end']();};}function respondWithResult(_0x30c1c9,_0x2ce417){_0x2ce417=_0x2ce417||0xc8;return function(_0x5c8d32){if(_0x5c8d32){return _0x30c1c9[_0x6c36('0x17')](_0x2ce417)[_0x6c36('0x18')](_0x5c8d32);}};}function respondWithFilteredResult(_0x549498,_0x3f02d6){return function(_0x50d7eb){if(_0x50d7eb){var _0x850558=typeof _0x3f02d6[_0x6c36('0x19')]===_0x6c36('0x1a')&&typeof _0x3f02d6[_0x6c36('0x1b')]===_0x6c36('0x1a');var _0x1f53a1=_0x50d7eb[_0x6c36('0x1c')];var _0x4764a8=_0x850558?0x0:_0x3f02d6[_0x6c36('0x19')];var _0x2280e5=_0x850558?_0x50d7eb[_0x6c36('0x1c')]:_0x3f02d6['offset']+_0x3f02d6['limit'];var _0x13d9c1;if(_0x2280e5>=_0x1f53a1){_0x2280e5=_0x1f53a1;_0x13d9c1=0xc8;}else{_0x13d9c1=0xce;}_0x549498[_0x6c36('0x17')](_0x13d9c1);return _0x549498[_0x6c36('0x1d')](_0x6c36('0x1e'),_0x4764a8+'-'+_0x2280e5+'/'+_0x1f53a1)[_0x6c36('0x18')](_0x50d7eb);}return null;};}function patchUpdates(_0x2bbd43){return function(_0x5c4195){try{jsonpatch[_0x6c36('0x1f')](_0x5c4195,_0x2bbd43,!![]);}catch(_0x246d7b){return BPromise[_0x6c36('0x20')](_0x246d7b);}return _0x5c4195['save']();};}function saveUpdates(_0x429e1a,_0x3e351d){return function(_0x14f45e){if(_0x14f45e){return _0x14f45e['update'](_0x429e1a)[_0x6c36('0x21')](function(_0x2cf908){return _0x2cf908;});}return null;};}function removeEntity(_0xc57970,_0x1c7e61){return function(_0xe82604){if(_0xe82604){return _0xe82604['destroy']()[_0x6c36('0x21')](function(){_0xc57970['status'](0xcc)[_0x6c36('0x22')]();});}};}function handleEntityNotFound(_0x203622,_0x143ac2){return function(_0x402707){if(!_0x402707){_0x203622['sendStatus'](0x194);}return _0x402707;};}function handleError(_0x5da2aa,_0x23e3fc){_0x23e3fc=_0x23e3fc||0x1f4;return function(_0x594a57){logger[_0x6c36('0x23')](_0x594a57['stack']);if(_0x594a57[_0x6c36('0x24')]){delete _0x594a57['name'];}_0x5da2aa[_0x6c36('0x17')](_0x23e3fc)[_0x6c36('0x25')](_0x594a57);};}exports[_0x6c36('0x26')]=function(_0x3f9767,_0x17ebfe){var _0x4e1c43={},_0x49610c={},_0x2bd1f5={'count':0x0,'rows':[]};var _0x1884a5=_[_0x6c36('0x27')](db[_0x6c36('0x28')][_0x6c36('0x29')],function(_0x3fa0d1){return{'name':_0x3fa0d1[_0x6c36('0x2a')],'type':_0x3fa0d1[_0x6c36('0x2b')]['key']};});_0x49610c[_0x6c36('0x2c')]=_[_0x6c36('0x27')](_0x1884a5,_0x6c36('0x24'));_0x49610c[_0x6c36('0x2d')]=_['keys'](_0x3f9767[_0x6c36('0x2d')]);_0x49610c[_0x6c36('0x2e')]=_['intersection'](_0x49610c[_0x6c36('0x2c')],_0x49610c[_0x6c36('0x2d')]);_0x4e1c43['attributes']=_[_0x6c36('0x2f')](_0x49610c['model'],qs[_0x6c36('0x30')](_0x3f9767[_0x6c36('0x2d')]['fields']));_0x4e1c43[_0x6c36('0x31')]=_0x4e1c43[_0x6c36('0x31')][_0x6c36('0x32')]?_0x4e1c43[_0x6c36('0x31')]:_0x49610c[_0x6c36('0x2c')];if(!_0x3f9767['query'][_0x6c36('0x33')](_0x6c36('0x34'))){_0x4e1c43[_0x6c36('0x1b')]=qs[_0x6c36('0x1b')](_0x3f9767[_0x6c36('0x2d')][_0x6c36('0x1b')]);_0x4e1c43[_0x6c36('0x19')]=qs[_0x6c36('0x19')](_0x3f9767['query'][_0x6c36('0x19')]);}_0x4e1c43['order']=qs[_0x6c36('0x35')](_0x3f9767[_0x6c36('0x2d')][_0x6c36('0x35')]);_0x4e1c43['where']=qs[_0x6c36('0x2e')](_[_0x6c36('0x36')](_0x3f9767[_0x6c36('0x2d')],_0x49610c[_0x6c36('0x2e')]),_0x1884a5);if(_0x3f9767[_0x6c36('0x2d')][_0x6c36('0x37')]){_0x4e1c43[_0x6c36('0x38')]=_[_0x6c36('0x39')](_0x4e1c43[_0x6c36('0x38')],{'$or':_[_0x6c36('0x27')](_0x1884a5,function(_0x4b3a14){if(_0x4b3a14['type']!==_0x6c36('0x3a')){var _0x57ee7a={};_0x57ee7a[_0x4b3a14[_0x6c36('0x24')]]={'$like':'%'+_0x3f9767[_0x6c36('0x2d')][_0x6c36('0x37')]+'%'};return _0x57ee7a;}})});}_0x4e1c43=_[_0x6c36('0x39')]({},_0x4e1c43,_0x3f9767[_0x6c36('0x3b')]);var _0x31b0e0={'where':_0x4e1c43[_0x6c36('0x38')]};return db[_0x6c36('0x28')][_0x6c36('0x1c')](_0x31b0e0)[_0x6c36('0x21')](function(_0x4c6143){_0x2bd1f5[_0x6c36('0x1c')]=_0x4c6143;if(_0x3f9767[_0x6c36('0x2d')]['includeAll']){_0x4e1c43['include']=[{'all':!![]}];}return db[_0x6c36('0x28')]['findAll'](_0x4e1c43);})['then'](function(_0x2b7c40){_0x2bd1f5[_0x6c36('0x3c')]=_0x2b7c40;return _0x2bd1f5;})[_0x6c36('0x21')](respondWithFilteredResult(_0x17ebfe,_0x4e1c43))[_0x6c36('0x3d')](handleError(_0x17ebfe,null));};exports[_0x6c36('0x3e')]=function(_0x296b4a,_0x43cbba){var _0x13dc9a={'raw':![],'where':{'id':_0x296b4a['params']['id']}},_0x3db1e5={};_0x3db1e5['model']=_[_0x6c36('0x3f')](db[_0x6c36('0x28')][_0x6c36('0x29')]);_0x3db1e5['query']=_[_0x6c36('0x3f')](_0x296b4a['query']);_0x3db1e5[_0x6c36('0x2e')]=_[_0x6c36('0x2f')](_0x3db1e5[_0x6c36('0x2c')],_0x3db1e5[_0x6c36('0x2d')]);_0x13dc9a[_0x6c36('0x31')]=_[_0x6c36('0x2f')](_0x3db1e5[_0x6c36('0x2c')],qs[_0x6c36('0x30')](_0x296b4a[_0x6c36('0x2d')][_0x6c36('0x30')]));_0x13dc9a[_0x6c36('0x31')]=_0x13dc9a[_0x6c36('0x31')]['length']?_0x13dc9a[_0x6c36('0x31')]:_0x3db1e5[_0x6c36('0x2c')];if(_0x296b4a[_0x6c36('0x2d')]['includeAll']){_0x13dc9a[_0x6c36('0x40')]=[{'all':!![]}];}_0x13dc9a=_['merge']({},_0x13dc9a,_0x296b4a['options']);return db[_0x6c36('0x28')][_0x6c36('0x41')](_0x13dc9a)[_0x6c36('0x21')](handleEntityNotFound(_0x43cbba,null))['then'](respondWithResult(_0x43cbba,null))[_0x6c36('0x3d')](handleError(_0x43cbba,null));};exports[_0x6c36('0x42')]=function(_0x354b86,_0x5162d6){return db[_0x6c36('0x28')]['create'](_0x354b86[_0x6c36('0x43')],{})['then'](respondWithResult(_0x5162d6,0xc9))[_0x6c36('0x3d')](handleError(_0x5162d6,null));};exports[_0x6c36('0x44')]=function(_0x54168a,_0x44fed8){if(_0x54168a['body']['id']){delete _0x54168a['body']['id'];}return db[_0x6c36('0x28')][_0x6c36('0x41')]({'where':{'id':_0x54168a[_0x6c36('0x45')]['id']}})['then'](handleEntityNotFound(_0x44fed8,null))['then'](saveUpdates(_0x54168a[_0x6c36('0x43')],null))[_0x6c36('0x21')](respondWithResult(_0x44fed8,null))[_0x6c36('0x3d')](handleError(_0x44fed8,null));};exports[_0x6c36('0x46')]=function(_0x367e3c,_0x214e60){return db[_0x6c36('0x28')][_0x6c36('0x41')]({'where':{'id':_0x367e3c['params']['id']}})[_0x6c36('0x21')](handleEntityNotFound(_0x214e60,null))['then'](removeEntity(_0x214e60,null))['catch'](handleError(_0x214e60,null));};exports[_0x6c36('0x47')]=function(_0x2afcda,_0x5356d4,_0x549a6a){var _0x3e6cc6={};var _0x48c84e={};var _0x4f6904;var _0x515042;return db[_0x6c36('0x28')][_0x6c36('0x48')]({'where':{'id':_0x2afcda['params']['id']}})[_0x6c36('0x21')](handleEntityNotFound(_0x5356d4,null))[_0x6c36('0x21')](function(_0x40d567){if(_0x40d567){_0x4f6904=_0x40d567;_0x48c84e[_0x6c36('0x2c')]=_[_0x6c36('0x3f')](db['ZohoField']['rawAttributes']);_0x48c84e[_0x6c36('0x2d')]=_['keys'](_0x2afcda['query']);_0x48c84e['filters']=_['intersection'](_0x48c84e[_0x6c36('0x2c')],_0x48c84e[_0x6c36('0x2d')]);_0x3e6cc6['attributes']=_['intersection'](_0x48c84e[_0x6c36('0x2c')],qs[_0x6c36('0x30')](_0x2afcda['query']['fields']));_0x3e6cc6[_0x6c36('0x31')]=_0x3e6cc6[_0x6c36('0x31')][_0x6c36('0x32')]?_0x3e6cc6[_0x6c36('0x31')]:_0x48c84e[_0x6c36('0x2c')];_0x3e6cc6[_0x6c36('0x49')]=qs[_0x6c36('0x35')](_0x2afcda[_0x6c36('0x2d')]['sort']);_0x3e6cc6['where']=qs[_0x6c36('0x2e')](_[_0x6c36('0x36')](_0x2afcda[_0x6c36('0x2d')],_0x48c84e[_0x6c36('0x2e')]));if(_0x2afcda['query'][_0x6c36('0x37')]){_0x3e6cc6[_0x6c36('0x38')]=_['merge'](_0x3e6cc6[_0x6c36('0x38')],{'$or':_[_0x6c36('0x27')](_0x3e6cc6['attributes'],function(_0x3508ce){var _0x17832f={};_0x17832f[_0x3508ce]={'$like':'%'+_0x2afcda[_0x6c36('0x2d')][_0x6c36('0x37')]+'%'};return _0x17832f;})});}_0x3e6cc6=_[_0x6c36('0x39')]({},_0x3e6cc6,_0x2afcda[_0x6c36('0x3b')]);return _0x4f6904[_0x6c36('0x47')](_0x3e6cc6);}})[_0x6c36('0x21')](function(_0x37a1f5){if(_0x37a1f5){_0x515042=_0x37a1f5[_0x6c36('0x32')];if(!_0x2afcda['query'][_0x6c36('0x33')](_0x6c36('0x34'))){_0x3e6cc6[_0x6c36('0x1b')]=qs[_0x6c36('0x1b')](_0x2afcda['query']['limit']);_0x3e6cc6[_0x6c36('0x19')]=qs[_0x6c36('0x19')](_0x2afcda[_0x6c36('0x2d')][_0x6c36('0x19')]);}return _0x4f6904[_0x6c36('0x47')](_0x3e6cc6);}})[_0x6c36('0x21')](function(_0x1154fd){if(_0x1154fd){return _0x1154fd?{'count':_0x515042,'rows':_0x1154fd}:null;}})[_0x6c36('0x21')](respondWithResult(_0x5356d4,null))[_0x6c36('0x3d')](handleError(_0x5356d4,null));};exports['getSubjects']=function(_0x2079f1,_0x198a5e,_0x3cd6f5){var _0x3d2efa={};var _0x585bcf={};var _0xc7511f;var _0x4c50ee;return db[_0x6c36('0x28')][_0x6c36('0x48')]({'where':{'id':_0x2079f1[_0x6c36('0x45')]['id']}})[_0x6c36('0x21')](handleEntityNotFound(_0x198a5e,null))[_0x6c36('0x21')](function(_0x543e11){if(_0x543e11){_0xc7511f=_0x543e11;_0x585bcf[_0x6c36('0x2c')]=_[_0x6c36('0x3f')](db[_0x6c36('0x4a')][_0x6c36('0x29')]);_0x585bcf[_0x6c36('0x2d')]=_['keys'](_0x2079f1[_0x6c36('0x2d')]);_0x585bcf[_0x6c36('0x2e')]=_[_0x6c36('0x2f')](_0x585bcf['model'],_0x585bcf['query']);_0x3d2efa[_0x6c36('0x31')]=_['intersection'](_0x585bcf[_0x6c36('0x2c')],qs[_0x6c36('0x30')](_0x2079f1[_0x6c36('0x2d')][_0x6c36('0x30')]));_0x3d2efa[_0x6c36('0x31')]=_0x3d2efa[_0x6c36('0x31')][_0x6c36('0x32')]?_0x3d2efa[_0x6c36('0x31')]:_0x585bcf[_0x6c36('0x2c')];_0x3d2efa[_0x6c36('0x49')]=qs[_0x6c36('0x35')](_0x2079f1[_0x6c36('0x2d')][_0x6c36('0x35')]);_0x3d2efa[_0x6c36('0x38')]=qs[_0x6c36('0x2e')](_[_0x6c36('0x36')](_0x2079f1[_0x6c36('0x2d')],_0x585bcf[_0x6c36('0x2e')]));if(_0x2079f1[_0x6c36('0x2d')][_0x6c36('0x37')]){_0x3d2efa[_0x6c36('0x38')]=_[_0x6c36('0x39')](_0x3d2efa['where'],{'$or':_[_0x6c36('0x27')](_0x3d2efa[_0x6c36('0x31')],function(_0x310619){var _0xbd84d3={};_0xbd84d3[_0x310619]={'$like':'%'+_0x2079f1[_0x6c36('0x2d')][_0x6c36('0x37')]+'%'};return _0xbd84d3;})});}_0x3d2efa=_[_0x6c36('0x39')]({},_0x3d2efa,_0x2079f1[_0x6c36('0x3b')]);return _0xc7511f['getSubjects'](_0x3d2efa);}})[_0x6c36('0x21')](function(_0x38d5ed){if(_0x38d5ed){_0x4c50ee=_0x38d5ed[_0x6c36('0x32')];if(!_0x2079f1[_0x6c36('0x2d')][_0x6c36('0x33')](_0x6c36('0x34'))){_0x3d2efa[_0x6c36('0x1b')]=qs[_0x6c36('0x1b')](_0x2079f1[_0x6c36('0x2d')][_0x6c36('0x1b')]);_0x3d2efa[_0x6c36('0x19')]=qs[_0x6c36('0x19')](_0x2079f1['query']['offset']);}return _0xc7511f[_0x6c36('0x4b')](_0x3d2efa);}})[_0x6c36('0x21')](function(_0x1db452){if(_0x1db452){return _0x1db452?{'count':_0x4c50ee,'rows':_0x1db452}:null;}})[_0x6c36('0x21')](respondWithResult(_0x198a5e,null))['catch'](handleError(_0x198a5e,null));};exports[_0x6c36('0x4c')]=function(_0x389698,_0x600ac5,_0x5f50f6){var _0xe2de9={};var _0x516813={};var _0x228392;var _0x15ca91;return db[_0x6c36('0x28')][_0x6c36('0x48')]({'where':{'id':_0x389698[_0x6c36('0x45')]['id']}})[_0x6c36('0x21')](handleEntityNotFound(_0x600ac5,null))[_0x6c36('0x21')](function(_0x43bc24){if(_0x43bc24){_0x228392=_0x43bc24;_0x516813[_0x6c36('0x2c')]=_['keys'](db['ZohoField']['rawAttributes']);_0x516813[_0x6c36('0x2d')]=_[_0x6c36('0x3f')](_0x389698[_0x6c36('0x2d')]);_0x516813['filters']=_[_0x6c36('0x2f')](_0x516813[_0x6c36('0x2c')],_0x516813[_0x6c36('0x2d')]);_0xe2de9['attributes']=_['intersection'](_0x516813[_0x6c36('0x2c')],qs['fields'](_0x389698[_0x6c36('0x2d')][_0x6c36('0x30')]));_0xe2de9['attributes']=_0xe2de9[_0x6c36('0x31')]['length']?_0xe2de9[_0x6c36('0x31')]:_0x516813[_0x6c36('0x2c')];_0xe2de9[_0x6c36('0x49')]=qs[_0x6c36('0x35')](_0x389698[_0x6c36('0x2d')][_0x6c36('0x35')]);_0xe2de9[_0x6c36('0x38')]=qs[_0x6c36('0x2e')](_['pick'](_0x389698[_0x6c36('0x2d')],_0x516813['filters']));if(_0x389698[_0x6c36('0x2d')][_0x6c36('0x37')]){_0xe2de9[_0x6c36('0x38')]=_[_0x6c36('0x39')](_0xe2de9[_0x6c36('0x38')],{'$or':_[_0x6c36('0x27')](_0xe2de9[_0x6c36('0x31')],function(_0x496c32){var _0x344290={};_0x344290[_0x496c32]={'$like':'%'+_0x389698['query'][_0x6c36('0x37')]+'%'};return _0x344290;})});}_0xe2de9=_['merge']({},_0xe2de9,_0x389698[_0x6c36('0x3b')]);return _0x228392[_0x6c36('0x4c')](_0xe2de9);}})[_0x6c36('0x21')](function(_0x386f9d){if(_0x386f9d){_0x15ca91=_0x386f9d[_0x6c36('0x32')];if(!_0x389698[_0x6c36('0x2d')]['hasOwnProperty'](_0x6c36('0x34'))){_0xe2de9['limit']=qs[_0x6c36('0x1b')](_0x389698[_0x6c36('0x2d')]['limit']);_0xe2de9[_0x6c36('0x19')]=qs[_0x6c36('0x19')](_0x389698['query']['offset']);}return _0x228392['getDescriptions'](_0xe2de9);}})[_0x6c36('0x21')](function(_0x205477){if(_0x205477){return _0x205477?{'count':_0x15ca91,'rows':_0x205477}:null;}})[_0x6c36('0x21')](respondWithResult(_0x600ac5,null))[_0x6c36('0x3d')](handleError(_0x600ac5,null));}; \ No newline at end of file +var _0xb960=['find','create','body','params','getFields','findOne','ZohoField','rawAttributes','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','map','options','includeAll','include','rows','catch','show'];(function(_0x20bf8f,_0x20038f){var _0x1eb2d5=function(_0xa746c6){while(--_0xa746c6){_0x20bf8f['push'](_0x20bf8f['shift']());}};_0x1eb2d5(++_0x20038f);}(_0xb960,0x1a1));var _0x0b96=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0xb960[_0x257b0e];return _0x27ac2a;};'use strict';var emlformat=require(_0x0b96('0x0'));var rimraf=require(_0x0b96('0x1'));var zipdir=require(_0x0b96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b96('0x3'));var moment=require('moment');var BPromise=require(_0x0b96('0x4'));var Mustache=require(_0x0b96('0x5'));var util=require(_0x0b96('0x6'));var path=require('path');var sox=require(_0x0b96('0x7'));var csv=require(_0x0b96('0x8'));var ejs=require(_0x0b96('0x9'));var fs=require('fs');var fs_extra=require(_0x0b96('0xa'));var _=require(_0x0b96('0xb'));var squel=require(_0x0b96('0xc'));var crypto=require(_0x0b96('0xd'));var jsforce=require(_0x0b96('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b96('0xf'));var Redis=require(_0x0b96('0x10'));var authService=require(_0x0b96('0x11'));var qs=require(_0x0b96('0x12'));var as=require(_0x0b96('0x13'));var hardwareService=require(_0x0b96('0x14'));var logger=require(_0x0b96('0x15'))(_0x0b96('0x16'));var utils=require(_0x0b96('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0b96('0x18'));var db=require(_0x0b96('0x19'))['db'];function respondWithStatusCode(_0x1dc31a,_0x3dd5da){_0x3dd5da=_0x3dd5da||0xcc;return function(_0x2df296){if(_0x2df296){return _0x1dc31a[_0x0b96('0x1a')](_0x3dd5da);}return _0x1dc31a[_0x0b96('0x1b')](_0x3dd5da)[_0x0b96('0x1c')]();};}function respondWithResult(_0xeacbb7,_0x3e81e1){_0x3e81e1=_0x3e81e1||0xc8;return function(_0x40c6fb){if(_0x40c6fb){return _0xeacbb7[_0x0b96('0x1b')](_0x3e81e1)['json'](_0x40c6fb);}};}function respondWithFilteredResult(_0x53c01f,_0x2dec6a){return function(_0x1659cb){if(_0x1659cb){var _0x14b43c=typeof _0x2dec6a[_0x0b96('0x1d')]===_0x0b96('0x1e')&&typeof _0x2dec6a[_0x0b96('0x1f')]===_0x0b96('0x1e');var _0x18ed02=_0x1659cb[_0x0b96('0x20')];var _0x5ca84d=_0x14b43c?0x0:_0x2dec6a[_0x0b96('0x1d')];var _0xf2020a=_0x14b43c?_0x1659cb['count']:_0x2dec6a[_0x0b96('0x1d')]+_0x2dec6a[_0x0b96('0x1f')];var _0x54224c;if(_0xf2020a>=_0x18ed02){_0xf2020a=_0x18ed02;_0x54224c=0xc8;}else{_0x54224c=0xce;}_0x53c01f[_0x0b96('0x1b')](_0x54224c);return _0x53c01f['set']('Content-Range',_0x5ca84d+'-'+_0xf2020a+'/'+_0x18ed02)[_0x0b96('0x21')](_0x1659cb);}return null;};}function patchUpdates(_0x2991f3){return function(_0x9f60a4){try{jsonpatch[_0x0b96('0x22')](_0x9f60a4,_0x2991f3,!![]);}catch(_0x3117e9){return BPromise[_0x0b96('0x23')](_0x3117e9);}return _0x9f60a4[_0x0b96('0x24')]();};}function saveUpdates(_0x4d4c8e,_0x3025ce){return function(_0xc601a8){if(_0xc601a8){return _0xc601a8[_0x0b96('0x25')](_0x4d4c8e)[_0x0b96('0x26')](function(_0x1b8a74){return _0x1b8a74;});}return null;};}function removeEntity(_0x16e010,_0x50fcc7){return function(_0x111ecd){if(_0x111ecd){return _0x111ecd[_0x0b96('0x27')]()[_0x0b96('0x26')](function(){_0x16e010['status'](0xcc)[_0x0b96('0x1c')]();});}};}function handleEntityNotFound(_0x48e752,_0x58f58c){return function(_0x39e024){if(!_0x39e024){_0x48e752[_0x0b96('0x1a')](0x194);}return _0x39e024;};}function handleError(_0x1dcd9e,_0x3ed1fa){_0x3ed1fa=_0x3ed1fa||0x1f4;return function(_0x11fa55){logger[_0x0b96('0x28')](_0x11fa55[_0x0b96('0x29')]);if(_0x11fa55[_0x0b96('0x2a')]){delete _0x11fa55[_0x0b96('0x2a')];}_0x1dcd9e[_0x0b96('0x1b')](_0x3ed1fa)[_0x0b96('0x2b')](_0x11fa55);};}exports[_0x0b96('0x2c')]=function(_0x13f507,_0x424f5e){var _0x16bd52={},_0x2936f7={},_0x33f001={'count':0x0,'rows':[]};var _0x5af50d=_['map'](db[_0x0b96('0x2d')]['rawAttributes'],function(_0xfaf501){return{'name':_0xfaf501['fieldName'],'type':_0xfaf501[_0x0b96('0x2e')][_0x0b96('0x2f')]};});_0x2936f7['model']=_['map'](_0x5af50d,_0x0b96('0x2a'));_0x2936f7['query']=_[_0x0b96('0x30')](_0x13f507[_0x0b96('0x31')]);_0x2936f7[_0x0b96('0x32')]=_[_0x0b96('0x33')](_0x2936f7[_0x0b96('0x34')],_0x2936f7[_0x0b96('0x31')]);_0x16bd52[_0x0b96('0x35')]=_['intersection'](_0x2936f7[_0x0b96('0x34')],qs[_0x0b96('0x36')](_0x13f507[_0x0b96('0x31')][_0x0b96('0x36')]));_0x16bd52['attributes']=_0x16bd52[_0x0b96('0x35')][_0x0b96('0x37')]?_0x16bd52[_0x0b96('0x35')]:_0x2936f7['model'];if(!_0x13f507[_0x0b96('0x31')][_0x0b96('0x38')]('nolimit')){_0x16bd52['limit']=qs[_0x0b96('0x1f')](_0x13f507[_0x0b96('0x31')][_0x0b96('0x1f')]);_0x16bd52[_0x0b96('0x1d')]=qs[_0x0b96('0x1d')](_0x13f507[_0x0b96('0x31')][_0x0b96('0x1d')]);}_0x16bd52[_0x0b96('0x39')]=qs['sort'](_0x13f507['query'][_0x0b96('0x3a')]);_0x16bd52['where']=qs['filters'](_['pick'](_0x13f507[_0x0b96('0x31')],_0x2936f7['filters']),_0x5af50d);if(_0x13f507['query'][_0x0b96('0x3b')]){_0x16bd52[_0x0b96('0x3c')]=_[_0x0b96('0x3d')](_0x16bd52[_0x0b96('0x3c')],{'$or':_[_0x0b96('0x3e')](_0x5af50d,function(_0x2c0381){if(_0x2c0381[_0x0b96('0x2e')]!=='VIRTUAL'){var _0x99956c={};_0x99956c[_0x2c0381['name']]={'$like':'%'+_0x13f507[_0x0b96('0x31')][_0x0b96('0x3b')]+'%'};return _0x99956c;}})});}_0x16bd52=_[_0x0b96('0x3d')]({},_0x16bd52,_0x13f507[_0x0b96('0x3f')]);var _0x4ea191={'where':_0x16bd52['where']};return db['ZohoConfiguration'][_0x0b96('0x20')](_0x4ea191)[_0x0b96('0x26')](function(_0x249028){_0x33f001['count']=_0x249028;if(_0x13f507[_0x0b96('0x31')][_0x0b96('0x40')]){_0x16bd52[_0x0b96('0x41')]=[{'all':!![]}];}return db[_0x0b96('0x2d')]['findAll'](_0x16bd52);})['then'](function(_0x3e427b){_0x33f001[_0x0b96('0x42')]=_0x3e427b;return _0x33f001;})['then'](respondWithFilteredResult(_0x424f5e,_0x16bd52))[_0x0b96('0x43')](handleError(_0x424f5e,null));};exports[_0x0b96('0x44')]=function(_0x3fd001,_0x5db942){var _0x238368={'raw':![],'where':{'id':_0x3fd001['params']['id']}},_0x21de9f={};_0x21de9f[_0x0b96('0x34')]=_[_0x0b96('0x30')](db[_0x0b96('0x2d')]['rawAttributes']);_0x21de9f['query']=_[_0x0b96('0x30')](_0x3fd001[_0x0b96('0x31')]);_0x21de9f[_0x0b96('0x32')]=_[_0x0b96('0x33')](_0x21de9f[_0x0b96('0x34')],_0x21de9f[_0x0b96('0x31')]);_0x238368[_0x0b96('0x35')]=_['intersection'](_0x21de9f[_0x0b96('0x34')],qs[_0x0b96('0x36')](_0x3fd001[_0x0b96('0x31')][_0x0b96('0x36')]));_0x238368[_0x0b96('0x35')]=_0x238368[_0x0b96('0x35')][_0x0b96('0x37')]?_0x238368[_0x0b96('0x35')]:_0x21de9f[_0x0b96('0x34')];if(_0x3fd001[_0x0b96('0x31')]['includeAll']){_0x238368[_0x0b96('0x41')]=[{'all':!![]}];}_0x238368=_[_0x0b96('0x3d')]({},_0x238368,_0x3fd001['options']);return db['ZohoConfiguration'][_0x0b96('0x45')](_0x238368)[_0x0b96('0x26')](handleEntityNotFound(_0x5db942,null))['then'](respondWithResult(_0x5db942,null))[_0x0b96('0x43')](handleError(_0x5db942,null));};exports[_0x0b96('0x46')]=function(_0x468479,_0xdae299){return db[_0x0b96('0x2d')][_0x0b96('0x46')](_0x468479[_0x0b96('0x47')],{})[_0x0b96('0x26')](respondWithResult(_0xdae299,0xc9))[_0x0b96('0x43')](handleError(_0xdae299,null));};exports['update']=function(_0x24cc08,_0x29bf3d){if(_0x24cc08[_0x0b96('0x47')]['id']){delete _0x24cc08[_0x0b96('0x47')]['id'];}return db[_0x0b96('0x2d')][_0x0b96('0x45')]({'where':{'id':_0x24cc08[_0x0b96('0x48')]['id']}})[_0x0b96('0x26')](handleEntityNotFound(_0x29bf3d,null))[_0x0b96('0x26')](saveUpdates(_0x24cc08[_0x0b96('0x47')],null))['then'](respondWithResult(_0x29bf3d,null))['catch'](handleError(_0x29bf3d,null));};exports[_0x0b96('0x27')]=function(_0x36f2b7,_0x56d66e){return db['ZohoConfiguration'][_0x0b96('0x45')]({'where':{'id':_0x36f2b7[_0x0b96('0x48')]['id']}})[_0x0b96('0x26')](handleEntityNotFound(_0x56d66e,null))[_0x0b96('0x26')](removeEntity(_0x56d66e,null))[_0x0b96('0x43')](handleError(_0x56d66e,null));};exports[_0x0b96('0x49')]=function(_0x23d1c1,_0x328872,_0x14ef1a){var _0x28212b={};var _0x56bb5c={};var _0x13a5cf;var _0x39019f;return db[_0x0b96('0x2d')][_0x0b96('0x4a')]({'where':{'id':_0x23d1c1['params']['id']}})[_0x0b96('0x26')](handleEntityNotFound(_0x328872,null))[_0x0b96('0x26')](function(_0x4edf00){if(_0x4edf00){_0x13a5cf=_0x4edf00;_0x56bb5c[_0x0b96('0x34')]=_[_0x0b96('0x30')](db[_0x0b96('0x4b')][_0x0b96('0x4c')]);_0x56bb5c[_0x0b96('0x31')]=_['keys'](_0x23d1c1[_0x0b96('0x31')]);_0x56bb5c[_0x0b96('0x32')]=_['intersection'](_0x56bb5c['model'],_0x56bb5c['query']);_0x28212b[_0x0b96('0x35')]=_[_0x0b96('0x33')](_0x56bb5c['model'],qs[_0x0b96('0x36')](_0x23d1c1[_0x0b96('0x31')][_0x0b96('0x36')]));_0x28212b[_0x0b96('0x35')]=_0x28212b[_0x0b96('0x35')][_0x0b96('0x37')]?_0x28212b[_0x0b96('0x35')]:_0x56bb5c['model'];_0x28212b[_0x0b96('0x39')]=qs[_0x0b96('0x3a')](_0x23d1c1[_0x0b96('0x31')]['sort']);_0x28212b[_0x0b96('0x3c')]=qs[_0x0b96('0x32')](_[_0x0b96('0x4d')](_0x23d1c1[_0x0b96('0x31')],_0x56bb5c[_0x0b96('0x32')]));if(_0x23d1c1[_0x0b96('0x31')][_0x0b96('0x3b')]){_0x28212b['where']=_['merge'](_0x28212b[_0x0b96('0x3c')],{'$or':_['map'](_0x28212b[_0x0b96('0x35')],function(_0x2c3472){var _0x1defee={};_0x1defee[_0x2c3472]={'$like':'%'+_0x23d1c1['query'][_0x0b96('0x3b')]+'%'};return _0x1defee;})});}_0x28212b=_[_0x0b96('0x3d')]({},_0x28212b,_0x23d1c1[_0x0b96('0x3f')]);return _0x13a5cf['getFields'](_0x28212b);}})['then'](function(_0x2dc977){if(_0x2dc977){_0x39019f=_0x2dc977[_0x0b96('0x37')];if(!_0x23d1c1[_0x0b96('0x31')][_0x0b96('0x38')](_0x0b96('0x4e'))){_0x28212b[_0x0b96('0x1f')]=qs[_0x0b96('0x1f')](_0x23d1c1[_0x0b96('0x31')][_0x0b96('0x1f')]);_0x28212b[_0x0b96('0x1d')]=qs['offset'](_0x23d1c1[_0x0b96('0x31')][_0x0b96('0x1d')]);}return _0x13a5cf[_0x0b96('0x49')](_0x28212b);}})[_0x0b96('0x26')](function(_0x3dd1ff){if(_0x3dd1ff){return _0x3dd1ff?{'count':_0x39019f,'rows':_0x3dd1ff}:null;}})[_0x0b96('0x26')](respondWithResult(_0x328872,null))['catch'](handleError(_0x328872,null));};exports['getSubjects']=function(_0x1a1208,_0x5eb903,_0x343dff){var _0x2b692c={};var _0x32f35f={};var _0x47d6db;var _0x1e70c9;return db[_0x0b96('0x2d')]['findOne']({'where':{'id':_0x1a1208['params']['id']}})[_0x0b96('0x26')](handleEntityNotFound(_0x5eb903,null))[_0x0b96('0x26')](function(_0xf58180){if(_0xf58180){_0x47d6db=_0xf58180;_0x32f35f[_0x0b96('0x34')]=_[_0x0b96('0x30')](db['ZohoField'][_0x0b96('0x4c')]);_0x32f35f[_0x0b96('0x31')]=_[_0x0b96('0x30')](_0x1a1208[_0x0b96('0x31')]);_0x32f35f[_0x0b96('0x32')]=_[_0x0b96('0x33')](_0x32f35f[_0x0b96('0x34')],_0x32f35f['query']);_0x2b692c['attributes']=_[_0x0b96('0x33')](_0x32f35f[_0x0b96('0x34')],qs[_0x0b96('0x36')](_0x1a1208[_0x0b96('0x31')][_0x0b96('0x36')]));_0x2b692c[_0x0b96('0x35')]=_0x2b692c[_0x0b96('0x35')][_0x0b96('0x37')]?_0x2b692c['attributes']:_0x32f35f[_0x0b96('0x34')];_0x2b692c[_0x0b96('0x39')]=qs[_0x0b96('0x3a')](_0x1a1208[_0x0b96('0x31')]['sort']);_0x2b692c['where']=qs[_0x0b96('0x32')](_['pick'](_0x1a1208['query'],_0x32f35f[_0x0b96('0x32')]));if(_0x1a1208[_0x0b96('0x31')]['filter']){_0x2b692c[_0x0b96('0x3c')]=_[_0x0b96('0x3d')](_0x2b692c[_0x0b96('0x3c')],{'$or':_[_0x0b96('0x3e')](_0x2b692c[_0x0b96('0x35')],function(_0x24455d){var _0x1e605d={};_0x1e605d[_0x24455d]={'$like':'%'+_0x1a1208[_0x0b96('0x31')][_0x0b96('0x3b')]+'%'};return _0x1e605d;})});}_0x2b692c=_[_0x0b96('0x3d')]({},_0x2b692c,_0x1a1208[_0x0b96('0x3f')]);return _0x47d6db[_0x0b96('0x4f')](_0x2b692c);}})[_0x0b96('0x26')](function(_0x382a13){if(_0x382a13){_0x1e70c9=_0x382a13[_0x0b96('0x37')];if(!_0x1a1208[_0x0b96('0x31')]['hasOwnProperty'](_0x0b96('0x4e'))){_0x2b692c['limit']=qs[_0x0b96('0x1f')](_0x1a1208[_0x0b96('0x31')][_0x0b96('0x1f')]);_0x2b692c['offset']=qs[_0x0b96('0x1d')](_0x1a1208[_0x0b96('0x31')][_0x0b96('0x1d')]);}return _0x47d6db[_0x0b96('0x4f')](_0x2b692c);}})[_0x0b96('0x26')](function(_0x14e332){if(_0x14e332){return _0x14e332?{'count':_0x1e70c9,'rows':_0x14e332}:null;}})[_0x0b96('0x26')](respondWithResult(_0x5eb903,null))['catch'](handleError(_0x5eb903,null));};exports[_0x0b96('0x50')]=function(_0x5cdd90,_0x32c872,_0xde4b91){var _0xe58383={};var _0x33206d={};var _0x16f08e;var _0x50a2a4;return db[_0x0b96('0x2d')]['findOne']({'where':{'id':_0x5cdd90['params']['id']}})['then'](handleEntityNotFound(_0x32c872,null))[_0x0b96('0x26')](function(_0x9a2002){if(_0x9a2002){_0x16f08e=_0x9a2002;_0x33206d[_0x0b96('0x34')]=_['keys'](db[_0x0b96('0x4b')]['rawAttributes']);_0x33206d[_0x0b96('0x31')]=_[_0x0b96('0x30')](_0x5cdd90[_0x0b96('0x31')]);_0x33206d[_0x0b96('0x32')]=_['intersection'](_0x33206d[_0x0b96('0x34')],_0x33206d[_0x0b96('0x31')]);_0xe58383[_0x0b96('0x35')]=_[_0x0b96('0x33')](_0x33206d[_0x0b96('0x34')],qs[_0x0b96('0x36')](_0x5cdd90[_0x0b96('0x31')]['fields']));_0xe58383['attributes']=_0xe58383['attributes']['length']?_0xe58383[_0x0b96('0x35')]:_0x33206d['model'];_0xe58383[_0x0b96('0x39')]=qs[_0x0b96('0x3a')](_0x5cdd90[_0x0b96('0x31')][_0x0b96('0x3a')]);_0xe58383[_0x0b96('0x3c')]=qs['filters'](_[_0x0b96('0x4d')](_0x5cdd90['query'],_0x33206d[_0x0b96('0x32')]));if(_0x5cdd90[_0x0b96('0x31')][_0x0b96('0x3b')]){_0xe58383[_0x0b96('0x3c')]=_['merge'](_0xe58383[_0x0b96('0x3c')],{'$or':_['map'](_0xe58383[_0x0b96('0x35')],function(_0x585764){var _0xfcf23e={};_0xfcf23e[_0x585764]={'$like':'%'+_0x5cdd90['query'][_0x0b96('0x3b')]+'%'};return _0xfcf23e;})});}_0xe58383=_[_0x0b96('0x3d')]({},_0xe58383,_0x5cdd90[_0x0b96('0x3f')]);return _0x16f08e['getDescriptions'](_0xe58383);}})[_0x0b96('0x26')](function(_0xb351bd){if(_0xb351bd){_0x50a2a4=_0xb351bd[_0x0b96('0x37')];if(!_0x5cdd90[_0x0b96('0x31')]['hasOwnProperty']('nolimit')){_0xe58383['limit']=qs[_0x0b96('0x1f')](_0x5cdd90[_0x0b96('0x31')][_0x0b96('0x1f')]);_0xe58383[_0x0b96('0x1d')]=qs[_0x0b96('0x1d')](_0x5cdd90['query'][_0x0b96('0x1d')]);}return _0x16f08e[_0x0b96('0x50')](_0xe58383);}})[_0x0b96('0x26')](function(_0x880965){if(_0x880965){return _0x880965?{'count':_0x50a2a4,'rows':_0x880965}:null;}})['then'](respondWithResult(_0x32c872,null))[_0x0b96('0x43')](handleError(_0x32c872,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 285dcd9..8daecf8 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 _0x1ac7=['../../config/environment','./intZohoConfiguration.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4e2861,_0x199be0){var _0x2265e3=function(_0x469693){while(--_0x469693){_0x4e2861['push'](_0x4e2861['shift']());}};_0x2265e3(++_0x199be0);}(_0x1ac7,0x126));var _0x71ac=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x1ac7[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require(_0x71ac('0x0'));var logger=require(_0x71ac('0x1'))(_0x71ac('0x2'));var moment=require('moment');var BPromise=require(_0x71ac('0x3'));var rp=require(_0x71ac('0x4'));var fs=require('fs');var path=require(_0x71ac('0x5'));var rimraf=require('rimraf');var config=require(_0x71ac('0x6'));var attributes=require(_0x71ac('0x7'));module[_0x71ac('0x8')]=function(_0x469b2b,_0x3159cc){return _0x469b2b[_0x71ac('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f9a=['api','moment','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','util','../../config/logger'];(function(_0x8165b0,_0x4cdf2b){var _0x533030=function(_0x3a2962){while(--_0x3a2962){_0x8165b0['push'](_0x8165b0['shift']());}};_0x533030(++_0x4cdf2b);}(_0x4f9a,0xa8));var _0xa4f9=function(_0x520407,_0x24a4ce){_0x520407=_0x520407-0x0;var _0x45f7a1=_0x4f9a[_0x520407];return _0x45f7a1;};'use strict';var _=require('lodash');var util=require(_0xa4f9('0x0'));var logger=require(_0xa4f9('0x1'))(_0xa4f9('0x2'));var moment=require(_0xa4f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4f9('0x4'));var fs=require('fs');var path=require(_0xa4f9('0x5'));var rimraf=require(_0xa4f9('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4f9('0x7'));module[_0xa4f9('0x8')]=function(_0x34ea30,_0x3cb05d){return _0x34ea30['define'](_0xa4f9('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index c4d96a6..110d82a 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 _0x3f9d=['error','code','message','result','catch','ZohoConfiguration,\x20%s,\x20%s','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3f9d,0x16e));var _0xd3f9=function(_0x118749,_0x50e848){_0x118749=_0x118749-0x0;var _0x20d489=_0x3f9d[_0x118749];return _0x20d489;};'use strict';var _=require('lodash');var util=require(_0xd3f9('0x0'));var moment=require(_0xd3f9('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3f9('0x2'));var fs=require('fs');var Redis=require(_0xd3f9('0x3'));var db=require(_0xd3f9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3f9('0x5'))(_0xd3f9('0x6'));var config=require(_0xd3f9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd3f9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bcb56,_0x1b381b,_0x4abab9){return new BPromise(function(_0x495985,_0x4d4d20){return client[_0xd3f9('0x9')](_0x2bcb56,_0x4abab9)['then'](function(_0x366d45){logger[_0xd3f9('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x1b381b,_0xd3f9('0xb'));logger[_0xd3f9('0xc')](_0xd3f9('0xd'),_0x1b381b,'request\x20sent',JSON['stringify'](_0x366d45));if(_0x366d45['error']){if(_0x366d45[_0xd3f9('0xe')][_0xd3f9('0xf')]===0x1f4){logger[_0xd3f9('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x1b381b,_0x366d45[_0xd3f9('0xe')][_0xd3f9('0x10')]);return _0x4d4d20(_0x366d45[_0xd3f9('0xe')][_0xd3f9('0x10')]);}logger[_0xd3f9('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x1b381b,_0x366d45[_0xd3f9('0xe')]['message']);return _0x495985(_0x366d45[_0xd3f9('0xe')][_0xd3f9('0x10')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x1b381b,_0xd3f9('0xb'));_0x495985(_0x366d45[_0xd3f9('0x11')][_0xd3f9('0x10')]);}})[_0xd3f9('0x12')](function(_0x4c8a48){logger[_0xd3f9('0xe')](_0xd3f9('0x13'),_0x1b381b,_0x4c8a48);_0x4d4d20(_0x4c8a48);});});} \ No newline at end of file +var _0xd125=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x453f96,_0x4894de){var _0x33d3ca=function(_0x4eb761){while(--_0x4eb761){_0x453f96['push'](_0x453f96['shift']());}};_0x33d3ca(++_0x4894de);}(_0xd125,0x196));var _0x5d12=function(_0x2ca739,_0x340b94){_0x2ca739=_0x2ca739-0x0;var _0x2e5a29=_0xd125[_0x2ca739];return _0x2e5a29;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5d12('0x0'));var BPromise=require('bluebird');var rs=require(_0x5d12('0x1'));var fs=require('fs');var Redis=require(_0x5d12('0x2'));var db=require(_0x5d12('0x3'))['db'];var utils=require(_0x5d12('0x4'));var logger=require(_0x5d12('0x5'))('rpc');var config=require(_0x5d12('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5d12('0x7')][_0x5d12('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c692,_0x45bd82,_0x346ea6){return new BPromise(function(_0x44ad24,_0x3f0809){return client[_0x5d12('0x9')](_0x3c692,_0x346ea6)[_0x5d12('0xa')](function(_0x5a4313){logger[_0x5d12('0xb')](_0x5d12('0xc'),_0x45bd82,_0x5d12('0xd'));logger[_0x5d12('0xe')](_0x5d12('0xf'),_0x45bd82,_0x5d12('0xd'),JSON[_0x5d12('0x10')](_0x5a4313));if(_0x5a4313[_0x5d12('0x11')]){if(_0x5a4313[_0x5d12('0x11')][_0x5d12('0x12')]===0x1f4){logger['error'](_0x5d12('0xc'),_0x45bd82,_0x5a4313[_0x5d12('0x11')][_0x5d12('0x13')]);return _0x3f0809(_0x5a4313[_0x5d12('0x11')][_0x5d12('0x13')]);}logger[_0x5d12('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x45bd82,_0x5a4313['error']['message']);return _0x44ad24(_0x5a4313['error'][_0x5d12('0x13')]);}else{logger[_0x5d12('0xb')](_0x5d12('0xc'),_0x45bd82,_0x5d12('0xd'));_0x44ad24(_0x5a4313[_0x5d12('0x14')][_0x5d12('0x13')]);}})[_0x5d12('0x15')](function(_0x23076b){logger[_0x5d12('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x45bd82,_0x23076b);_0x3f0809(_0x23076b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2ed675a..164f125 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 _0x9cb0=['express','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xb1b864,_0x222c52){var _0x587bfc=function(_0x55e549){while(--_0x55e549){_0xb1b864['push'](_0xb1b864['shift']());}};_0x587bfc(++_0x222c52);}(_0x9cb0,0x1b2));var _0x09cb=function(_0xe6aba1,_0x4ff2b4){_0xe6aba1=_0xe6aba1-0x0;var _0x56482c=_0x9cb0[_0xe6aba1];return _0x56482c;};'use strict';var multer=require(_0x09cb('0x0'));var util=require(_0x09cb('0x1'));var path=require('path');var timeout=require(_0x09cb('0x2'));var express=require(_0x09cb('0x3'));var router=express['Router']();var fs_extra=require(_0x09cb('0x4'));var auth=require(_0x09cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x09cb('0x6'));var controller=require(_0x09cb('0x7'));router['get']('/',auth[_0x09cb('0x8')](),controller[_0x09cb('0x9')]);router[_0x09cb('0xa')](_0x09cb('0xb'),auth[_0x09cb('0x8')](),controller[_0x09cb('0xc')]);router[_0x09cb('0xd')]('/',auth[_0x09cb('0x8')](),controller[_0x09cb('0xe')]);router[_0x09cb('0xf')](_0x09cb('0xb'),auth[_0x09cb('0x8')](),controller['update']);router[_0x09cb('0x10')](_0x09cb('0xb'),auth['isAuthenticated'](),controller[_0x09cb('0x11')]);module[_0x09cb('0x12')]=router; \ No newline at end of file +var _0x6727=['../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6727,0x1b5));var _0x7672=function(_0x1e3c58,_0x4baead){_0x1e3c58=_0x1e3c58-0x0;var _0x2cd780=_0x6727[_0x1e3c58];return _0x2cd780;};'use strict';var multer=require('multer');var util=require(_0x7672('0x0'));var path=require(_0x7672('0x1'));var timeout=require('connect-timeout');var express=require(_0x7672('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7672('0x3'));var interaction=require(_0x7672('0x4'));var config=require(_0x7672('0x5'));var controller=require(_0x7672('0x6'));router[_0x7672('0x7')]('/',auth[_0x7672('0x8')](),controller['index']);router[_0x7672('0x7')](_0x7672('0x9'),auth[_0x7672('0x8')](),controller[_0x7672('0xa')]);router[_0x7672('0xb')]('/',auth[_0x7672('0x8')](),controller['create']);router[_0x7672('0xc')](_0x7672('0x9'),auth[_0x7672('0x8')](),controller[_0x7672('0xd')]);router[_0x7672('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7672('0xf')]);module[_0x7672('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 99e4011..f85f47e 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 _0xafb0=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xafb0,0x17c));var _0x0afb=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xafb0[_0x231e16];return _0x570a7c;};'use strict';var Sequelize=require(_0x0afb('0x0'));module[_0x0afb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0afb('0x2'),'variable',_0x0afb('0x3'),_0x0afb('0x4'),_0x0afb('0x5')),'defaultValue':_0x0afb('0x2')},'content':{'type':Sequelize[_0x0afb('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0afb('0x7')](_0x0afb('0x2'),_0x0afb('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x0afb('0x6')]},'idField':{'type':Sequelize[_0x0afb('0x6')]},'nameField':{'type':Sequelize[_0x0afb('0x6')]},'customField':{'type':Sequelize[_0x0afb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0afb('0x6')]}}; \ No newline at end of file +var _0x3cd7=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x978971,_0x4ca3cb){var _0x48572f=function(_0x58fdd6){while(--_0x58fdd6){_0x978971['push'](_0x978971['shift']());}};_0x48572f(++_0x4ca3cb);}(_0x3cd7,0x8f));var _0x73cd=function(_0x3fd401,_0x114d73){_0x3fd401=_0x3fd401-0x0;var _0x14403a=_0x3cd7[_0x3fd401];return _0x14403a;};'use strict';var Sequelize=require(_0x73cd('0x0'));module[_0x73cd('0x1')]={'type':{'type':Sequelize[_0x73cd('0x2')]('string',_0x73cd('0x3'),_0x73cd('0x4'),_0x73cd('0x5'),_0x73cd('0x6')),'defaultValue':_0x73cd('0x7')},'content':{'type':Sequelize[_0x73cd('0x8')]},'key':{'type':Sequelize[_0x73cd('0x8')]},'keyType':{'type':Sequelize[_0x73cd('0x2')]('string',_0x73cd('0x3'),_0x73cd('0x4'))},'keyContent':{'type':Sequelize[_0x73cd('0x8')]},'idField':{'type':Sequelize[_0x73cd('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x73cd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x73cd('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1c1ed99..cfe5d83 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 _0xce0d=['jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','ZohoField','findAll','rows','params','length','include','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','util','path','ejs','fs-extra','lodash','squel'];(function(_0x6751ce,_0x261da6){var _0x51b6ce=function(_0x5784b2){while(--_0x5784b2){_0x6751ce['push'](_0x6751ce['shift']());}};_0x51b6ce(++_0x261da6);}(_0xce0d,0x1e6));var _0xdce0=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0xce0d[_0x1c7137];return _0xeb4432;};'use strict';var emlformat=require(_0xdce0('0x0'));var rimraf=require(_0xdce0('0x1'));var zipdir=require(_0xdce0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdce0('0x3'));var moment=require(_0xdce0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdce0('0x5'));var path=require(_0xdce0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdce0('0x7'));var fs=require('fs');var fs_extra=require(_0xdce0('0x8'));var _=require(_0xdce0('0x9'));var squel=require(_0xdce0('0xa'));var crypto=require('crypto');var jsforce=require(_0xdce0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdce0('0xc'));var querystring=require('querystring');var Papa=require(_0xdce0('0xd'));var Redis=require(_0xdce0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdce0('0xf'));var as=require(_0xdce0('0x10'));var hardwareService=require(_0xdce0('0x11'));var logger=require(_0xdce0('0x12'))(_0xdce0('0x13'));var utils=require('../../config/utils');var config=require(_0xdce0('0x14'));var licenseUtil=require(_0xdce0('0x15'));var db=require(_0xdce0('0x16'))['db'];function respondWithStatusCode(_0x28138d,_0x3e0225){_0x3e0225=_0x3e0225||0xcc;return function(_0x2577c0){if(_0x2577c0){return _0x28138d['sendStatus'](_0x3e0225);}return _0x28138d[_0xdce0('0x17')](_0x3e0225)['end']();};}function respondWithResult(_0xffd8e4,_0x3f0931){_0x3f0931=_0x3f0931||0xc8;return function(_0x3045f4){if(_0x3045f4){return _0xffd8e4[_0xdce0('0x17')](_0x3f0931)[_0xdce0('0x18')](_0x3045f4);}};}function respondWithFilteredResult(_0x390afe,_0x267fa1){return function(_0x40a66b){if(_0x40a66b){var _0x54ff2d=typeof _0x267fa1[_0xdce0('0x19')]==='undefined'&&typeof _0x267fa1[_0xdce0('0x1a')]===_0xdce0('0x1b');var _0x43ba6b=_0x40a66b[_0xdce0('0x1c')];var _0x519db3=_0x54ff2d?0x0:_0x267fa1[_0xdce0('0x19')];var _0x35837c=_0x54ff2d?_0x40a66b[_0xdce0('0x1c')]:_0x267fa1['offset']+_0x267fa1[_0xdce0('0x1a')];var _0x2f7b5c;if(_0x35837c>=_0x43ba6b){_0x35837c=_0x43ba6b;_0x2f7b5c=0xc8;}else{_0x2f7b5c=0xce;}_0x390afe[_0xdce0('0x17')](_0x2f7b5c);return _0x390afe['set']('Content-Range',_0x519db3+'-'+_0x35837c+'/'+_0x43ba6b)[_0xdce0('0x18')](_0x40a66b);}return null;};}function patchUpdates(_0x2a473e){return function(_0x4782ac){try{jsonpatch[_0xdce0('0x1d')](_0x4782ac,_0x2a473e,!![]);}catch(_0x1c2507){return BPromise[_0xdce0('0x1e')](_0x1c2507);}return _0x4782ac[_0xdce0('0x1f')]();};}function saveUpdates(_0x133e53,_0x25f096){return function(_0x139db3){if(_0x139db3){return _0x139db3[_0xdce0('0x20')](_0x133e53)[_0xdce0('0x21')](function(_0x582e3e){return _0x582e3e;});}return null;};}function removeEntity(_0x385c7f,_0xe56fd6){return function(_0x1a6b09){if(_0x1a6b09){return _0x1a6b09['destroy']()[_0xdce0('0x21')](function(){_0x385c7f[_0xdce0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12c621,_0x23d3bb){return function(_0x8c4c51){if(!_0x8c4c51){_0x12c621[_0xdce0('0x22')](0x194);}return _0x8c4c51;};}function handleError(_0x150c81,_0x37e279){_0x37e279=_0x37e279||0x1f4;return function(_0x1c27f5){logger[_0xdce0('0x23')](_0x1c27f5[_0xdce0('0x24')]);if(_0x1c27f5[_0xdce0('0x25')]){delete _0x1c27f5[_0xdce0('0x25')];}_0x150c81[_0xdce0('0x17')](_0x37e279)['send'](_0x1c27f5);};}exports[_0xdce0('0x26')]=function(_0x1d6016,_0x2b877f){var _0x5573cb={},_0x2bf8d8={},_0x15b329={'count':0x0,'rows':[]};var _0x2985fa=_[_0xdce0('0x27')](db['ZohoField'][_0xdce0('0x28')],function(_0x34aa76){return{'name':_0x34aa76[_0xdce0('0x29')],'type':_0x34aa76['type'][_0xdce0('0x2a')]};});_0x2bf8d8[_0xdce0('0x2b')]=_[_0xdce0('0x27')](_0x2985fa,'name');_0x2bf8d8['query']=_[_0xdce0('0x2c')](_0x1d6016[_0xdce0('0x2d')]);_0x2bf8d8[_0xdce0('0x2e')]=_['intersection'](_0x2bf8d8[_0xdce0('0x2b')],_0x2bf8d8[_0xdce0('0x2d')]);_0x5573cb[_0xdce0('0x2f')]=_[_0xdce0('0x30')](_0x2bf8d8[_0xdce0('0x2b')],qs[_0xdce0('0x31')](_0x1d6016[_0xdce0('0x2d')][_0xdce0('0x31')]));_0x5573cb['attributes']=_0x5573cb['attributes']['length']?_0x5573cb['attributes']:_0x2bf8d8[_0xdce0('0x2b')];if(!_0x1d6016[_0xdce0('0x2d')][_0xdce0('0x32')](_0xdce0('0x33'))){_0x5573cb[_0xdce0('0x1a')]=qs['limit'](_0x1d6016[_0xdce0('0x2d')][_0xdce0('0x1a')]);_0x5573cb[_0xdce0('0x19')]=qs['offset'](_0x1d6016[_0xdce0('0x2d')][_0xdce0('0x19')]);}_0x5573cb['order']=qs['sort'](_0x1d6016[_0xdce0('0x2d')][_0xdce0('0x34')]);_0x5573cb['where']=qs[_0xdce0('0x2e')](_['pick'](_0x1d6016[_0xdce0('0x2d')],_0x2bf8d8[_0xdce0('0x2e')]),_0x2985fa);if(_0x1d6016[_0xdce0('0x2d')][_0xdce0('0x35')]){_0x5573cb[_0xdce0('0x36')]=_[_0xdce0('0x37')](_0x5573cb['where'],{'$or':_[_0xdce0('0x27')](_0x2985fa,function(_0xcb9b16){if(_0xcb9b16[_0xdce0('0x38')]!==_0xdce0('0x39')){var _0xcb359b={};_0xcb359b[_0xcb9b16[_0xdce0('0x25')]]={'$like':'%'+_0x1d6016[_0xdce0('0x2d')]['filter']+'%'};return _0xcb359b;}})});}_0x5573cb=_[_0xdce0('0x37')]({},_0x5573cb,_0x1d6016[_0xdce0('0x3a')]);var _0x1d1f2d={'where':_0x5573cb['where']};return db['ZohoField'][_0xdce0('0x1c')](_0x1d1f2d)['then'](function(_0x1e8671){_0x15b329[_0xdce0('0x1c')]=_0x1e8671;if(_0x1d6016[_0xdce0('0x2d')][_0xdce0('0x3b')]){_0x5573cb['include']=[{'all':!![]}];}return db[_0xdce0('0x3c')][_0xdce0('0x3d')](_0x5573cb);})[_0xdce0('0x21')](function(_0x5e1cbd){_0x15b329[_0xdce0('0x3e')]=_0x5e1cbd;return _0x15b329;})[_0xdce0('0x21')](respondWithFilteredResult(_0x2b877f,_0x5573cb))['catch'](handleError(_0x2b877f,null));};exports['show']=function(_0x10543e,_0x4745c6){var _0x4ef05c={'raw':!![],'where':{'id':_0x10543e[_0xdce0('0x3f')]['id']}},_0x1a3b25={};_0x1a3b25[_0xdce0('0x2b')]=_[_0xdce0('0x2c')](db[_0xdce0('0x3c')]['rawAttributes']);_0x1a3b25[_0xdce0('0x2d')]=_['keys'](_0x10543e[_0xdce0('0x2d')]);_0x1a3b25[_0xdce0('0x2e')]=_[_0xdce0('0x30')](_0x1a3b25['model'],_0x1a3b25['query']);_0x4ef05c[_0xdce0('0x2f')]=_[_0xdce0('0x30')](_0x1a3b25[_0xdce0('0x2b')],qs['fields'](_0x10543e[_0xdce0('0x2d')][_0xdce0('0x31')]));_0x4ef05c[_0xdce0('0x2f')]=_0x4ef05c[_0xdce0('0x2f')][_0xdce0('0x40')]?_0x4ef05c[_0xdce0('0x2f')]:_0x1a3b25[_0xdce0('0x2b')];if(_0x10543e[_0xdce0('0x2d')][_0xdce0('0x3b')]){_0x4ef05c[_0xdce0('0x41')]=[{'all':!![]}];}_0x4ef05c=_[_0xdce0('0x37')]({},_0x4ef05c,_0x10543e[_0xdce0('0x3a')]);return db[_0xdce0('0x3c')][_0xdce0('0x42')](_0x4ef05c)[_0xdce0('0x21')](handleEntityNotFound(_0x4745c6,null))[_0xdce0('0x21')](respondWithResult(_0x4745c6,null))[_0xdce0('0x43')](handleError(_0x4745c6,null));};exports[_0xdce0('0x44')]=function(_0x4e19ac,_0x2eed8b){return db[_0xdce0('0x3c')][_0xdce0('0x44')](_0x4e19ac['body'],{})['then'](respondWithResult(_0x2eed8b,0xc9))['catch'](handleError(_0x2eed8b,null));};exports['update']=function(_0x71e6a9,_0x360d80){if(_0x71e6a9[_0xdce0('0x45')]['id']){delete _0x71e6a9[_0xdce0('0x45')]['id'];}return db[_0xdce0('0x3c')][_0xdce0('0x42')]({'where':{'id':_0x71e6a9['params']['id']}})[_0xdce0('0x21')](handleEntityNotFound(_0x360d80,null))[_0xdce0('0x21')](saveUpdates(_0x71e6a9['body'],null))[_0xdce0('0x21')](respondWithResult(_0x360d80,null))[_0xdce0('0x43')](handleError(_0x360d80,null));};exports[_0xdce0('0x46')]=function(_0x105b5c,_0x21bbab){return db[_0xdce0('0x3c')]['find']({'where':{'id':_0x105b5c['params']['id']}})[_0xdce0('0x21')](handleEntityNotFound(_0x21bbab,null))[_0xdce0('0x21')](removeEntity(_0x21bbab,null))[_0xdce0('0x43')](handleError(_0x21bbab,null));}; \ No newline at end of file +var _0x075e=['model','query','intersection','attributes','fields','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','show','rawAttributes','keys','find','create','body','catch','params','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','map','ZohoField','fieldName','type','key'];(function(_0x357b73,_0x2714e8){var _0x476365=function(_0x5a5be7){while(--_0x5a5be7){_0x357b73['push'](_0x357b73['shift']());}};_0x476365(++_0x2714e8);}(_0x075e,0x1a4));var _0xe075=function(_0x4a9b6f,_0x32c14b){_0x4a9b6f=_0x4a9b6f-0x0;var _0xc940ef=_0x075e[_0x4a9b6f];return _0xc940ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe075('0x0'));var jsonpatch=require(_0xe075('0x1'));var rp=require('request-promise');var moment=require(_0xe075('0x2'));var BPromise=require(_0xe075('0x3'));var Mustache=require(_0xe075('0x4'));var util=require('util');var path=require(_0xe075('0x5'));var sox=require(_0xe075('0x6'));var csv=require(_0xe075('0x7'));var ejs=require(_0xe075('0x8'));var fs=require('fs');var fs_extra=require(_0xe075('0x9'));var _=require(_0xe075('0xa'));var squel=require(_0xe075('0xb'));var crypto=require(_0xe075('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe075('0x7'));var querystring=require('querystring');var Papa=require(_0xe075('0xd'));var Redis=require(_0xe075('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe075('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe075('0x10'));var logger=require('../../config/logger')(_0xe075('0x11'));var utils=require(_0xe075('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe075('0x13'))['db'];function respondWithStatusCode(_0x15a39c,_0x51b649){_0x51b649=_0x51b649||0xcc;return function(_0x4d3310){if(_0x4d3310){return _0x15a39c[_0xe075('0x14')](_0x51b649);}return _0x15a39c[_0xe075('0x15')](_0x51b649)[_0xe075('0x16')]();};}function respondWithResult(_0x15868c,_0x478247){_0x478247=_0x478247||0xc8;return function(_0x2e2ce7){if(_0x2e2ce7){return _0x15868c[_0xe075('0x15')](_0x478247)[_0xe075('0x17')](_0x2e2ce7);}};}function respondWithFilteredResult(_0x8cb788,_0x472eca){return function(_0x491d39){if(_0x491d39){var _0x221f95=typeof _0x472eca[_0xe075('0x18')]==='undefined'&&typeof _0x472eca[_0xe075('0x19')]===_0xe075('0x1a');var _0x6d242b=_0x491d39[_0xe075('0x1b')];var _0x5151bc=_0x221f95?0x0:_0x472eca[_0xe075('0x18')];var _0x316b6f=_0x221f95?_0x491d39['count']:_0x472eca[_0xe075('0x18')]+_0x472eca[_0xe075('0x19')];var _0x2c645c;if(_0x316b6f>=_0x6d242b){_0x316b6f=_0x6d242b;_0x2c645c=0xc8;}else{_0x2c645c=0xce;}_0x8cb788[_0xe075('0x15')](_0x2c645c);return _0x8cb788[_0xe075('0x1c')](_0xe075('0x1d'),_0x5151bc+'-'+_0x316b6f+'/'+_0x6d242b)[_0xe075('0x17')](_0x491d39);}return null;};}function patchUpdates(_0x300041){return function(_0x37f06e){try{jsonpatch[_0xe075('0x1e')](_0x37f06e,_0x300041,!![]);}catch(_0x84d62e){return BPromise[_0xe075('0x1f')](_0x84d62e);}return _0x37f06e['save']();};}function saveUpdates(_0x4814d8,_0x2e3f7f){return function(_0x551c0c){if(_0x551c0c){return _0x551c0c['update'](_0x4814d8)[_0xe075('0x20')](function(_0xfca406){return _0xfca406;});}return null;};}function removeEntity(_0x21aacc,_0x2ee4ff){return function(_0x58e93a){if(_0x58e93a){return _0x58e93a[_0xe075('0x21')]()[_0xe075('0x20')](function(){_0x21aacc[_0xe075('0x15')](0xcc)[_0xe075('0x16')]();});}};}function handleEntityNotFound(_0x5d9d0d,_0xfbc673){return function(_0x4ebf1f){if(!_0x4ebf1f){_0x5d9d0d[_0xe075('0x14')](0x194);}return _0x4ebf1f;};}function handleError(_0x67603,_0x3bee03){_0x3bee03=_0x3bee03||0x1f4;return function(_0x269823){logger[_0xe075('0x22')](_0x269823[_0xe075('0x23')]);if(_0x269823[_0xe075('0x24')]){delete _0x269823[_0xe075('0x24')];}_0x67603['status'](_0x3bee03)['send'](_0x269823);};}exports['index']=function(_0x377bfa,_0x48d1d5){var _0x2357b0={},_0x434b5b={},_0x4e7d49={'count':0x0,'rows':[]};var _0x4a8dfd=_[_0xe075('0x25')](db[_0xe075('0x26')]['rawAttributes'],function(_0x17cf16){return{'name':_0x17cf16[_0xe075('0x27')],'type':_0x17cf16[_0xe075('0x28')][_0xe075('0x29')]};});_0x434b5b[_0xe075('0x2a')]=_[_0xe075('0x25')](_0x4a8dfd,'name');_0x434b5b[_0xe075('0x2b')]=_['keys'](_0x377bfa['query']);_0x434b5b['filters']=_[_0xe075('0x2c')](_0x434b5b[_0xe075('0x2a')],_0x434b5b[_0xe075('0x2b')]);_0x2357b0[_0xe075('0x2d')]=_['intersection'](_0x434b5b[_0xe075('0x2a')],qs[_0xe075('0x2e')](_0x377bfa['query']['fields']));_0x2357b0[_0xe075('0x2d')]=_0x2357b0[_0xe075('0x2d')]['length']?_0x2357b0[_0xe075('0x2d')]:_0x434b5b['model'];if(!_0x377bfa[_0xe075('0x2b')]['hasOwnProperty']('nolimit')){_0x2357b0['limit']=qs[_0xe075('0x19')](_0x377bfa[_0xe075('0x2b')][_0xe075('0x19')]);_0x2357b0['offset']=qs[_0xe075('0x18')](_0x377bfa[_0xe075('0x2b')][_0xe075('0x18')]);}_0x2357b0[_0xe075('0x2f')]=qs[_0xe075('0x30')](_0x377bfa[_0xe075('0x2b')][_0xe075('0x30')]);_0x2357b0[_0xe075('0x31')]=qs[_0xe075('0x32')](_[_0xe075('0x33')](_0x377bfa['query'],_0x434b5b[_0xe075('0x32')]),_0x4a8dfd);if(_0x377bfa[_0xe075('0x2b')]['filter']){_0x2357b0[_0xe075('0x31')]=_[_0xe075('0x34')](_0x2357b0[_0xe075('0x31')],{'$or':_[_0xe075('0x25')](_0x4a8dfd,function(_0x25b1e4){if(_0x25b1e4['type']!=='VIRTUAL'){var _0x39f5e2={};_0x39f5e2[_0x25b1e4['name']]={'$like':'%'+_0x377bfa[_0xe075('0x2b')][_0xe075('0x35')]+'%'};return _0x39f5e2;}})});}_0x2357b0=_[_0xe075('0x34')]({},_0x2357b0,_0x377bfa[_0xe075('0x36')]);var _0x393101={'where':_0x2357b0[_0xe075('0x31')]};return db['ZohoField'][_0xe075('0x1b')](_0x393101)[_0xe075('0x20')](function(_0x22bfcb){_0x4e7d49[_0xe075('0x1b')]=_0x22bfcb;if(_0x377bfa['query'][_0xe075('0x37')]){_0x2357b0[_0xe075('0x38')]=[{'all':!![]}];}return db[_0xe075('0x26')][_0xe075('0x39')](_0x2357b0);})[_0xe075('0x20')](function(_0x1df131){_0x4e7d49['rows']=_0x1df131;return _0x4e7d49;})[_0xe075('0x20')](respondWithFilteredResult(_0x48d1d5,_0x2357b0))['catch'](handleError(_0x48d1d5,null));};exports[_0xe075('0x3a')]=function(_0x521edd,_0x33f416){var _0xda9cdc={'raw':!![],'where':{'id':_0x521edd['params']['id']}},_0x2a3e40={};_0x2a3e40['model']=_['keys'](db[_0xe075('0x26')][_0xe075('0x3b')]);_0x2a3e40[_0xe075('0x2b')]=_[_0xe075('0x3c')](_0x521edd[_0xe075('0x2b')]);_0x2a3e40['filters']=_[_0xe075('0x2c')](_0x2a3e40[_0xe075('0x2a')],_0x2a3e40['query']);_0xda9cdc[_0xe075('0x2d')]=_['intersection'](_0x2a3e40['model'],qs[_0xe075('0x2e')](_0x521edd['query'][_0xe075('0x2e')]));_0xda9cdc['attributes']=_0xda9cdc[_0xe075('0x2d')]['length']?_0xda9cdc[_0xe075('0x2d')]:_0x2a3e40[_0xe075('0x2a')];if(_0x521edd[_0xe075('0x2b')][_0xe075('0x37')]){_0xda9cdc[_0xe075('0x38')]=[{'all':!![]}];}_0xda9cdc=_[_0xe075('0x34')]({},_0xda9cdc,_0x521edd[_0xe075('0x36')]);return db['ZohoField'][_0xe075('0x3d')](_0xda9cdc)[_0xe075('0x20')](handleEntityNotFound(_0x33f416,null))[_0xe075('0x20')](respondWithResult(_0x33f416,null))['catch'](handleError(_0x33f416,null));};exports[_0xe075('0x3e')]=function(_0x54a8f6,_0x540442){return db[_0xe075('0x26')]['create'](_0x54a8f6[_0xe075('0x3f')],{})[_0xe075('0x20')](respondWithResult(_0x540442,0xc9))[_0xe075('0x40')](handleError(_0x540442,null));};exports['update']=function(_0x4bb2b4,_0x3b5f87){if(_0x4bb2b4[_0xe075('0x3f')]['id']){delete _0x4bb2b4['body']['id'];}return db[_0xe075('0x26')][_0xe075('0x3d')]({'where':{'id':_0x4bb2b4[_0xe075('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b5f87,null))[_0xe075('0x20')](saveUpdates(_0x4bb2b4[_0xe075('0x3f')],null))[_0xe075('0x20')](respondWithResult(_0x3b5f87,null))[_0xe075('0x40')](handleError(_0x3b5f87,null));};exports[_0xe075('0x21')]=function(_0x2f9e70,_0x41ac85){return db[_0xe075('0x26')][_0xe075('0x3d')]({'where':{'id':_0x2f9e70[_0xe075('0x41')]['id']}})[_0xe075('0x20')](handleEntityNotFound(_0x41ac85,null))[_0xe075('0x20')](removeEntity(_0x41ac85,null))[_0xe075('0x40')](handleError(_0x41ac85,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0598e0d..10de64a 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33af=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','util','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x33af,0xec));var _0xf33a=function(_0x485bad,_0x21c418){_0x485bad=_0x485bad-0x0;var _0x523c91=_0x33af[_0x485bad];return _0x523c91;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','lodash','util'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1a37,0xb4));var _0x71a3=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x1a37[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intZohoField.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'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 37198ad..474b994 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 _0xcab5=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcab5,0xcd));var _0x5cab=function(_0x12ed9f,_0x59d900){_0x12ed9f=_0x12ed9f-0x0;var _0x28db1d=_0xcab5[_0x12ed9f];return _0x28db1d;};'use strict';var _=require(_0x5cab('0x0'));var util=require(_0x5cab('0x1'));var moment=require(_0x5cab('0x2'));var BPromise=require(_0x5cab('0x3'));var rs=require(_0x5cab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cab('0x5'))['db'];var utils=require(_0x5cab('0x6'));var logger=require('../../config/logger')(_0x5cab('0x7'));var config=require('../../config/environment');var jayson=require(_0x5cab('0x8'));var client=jayson['client'][_0x5cab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x545615,_0x323592,_0x31444f){return new BPromise(function(_0x5da7e6,_0x5854ae){return client[_0x5cab('0xa')](_0x545615,_0x31444f)[_0x5cab('0xb')](function(_0x359763){logger['info'](_0x5cab('0xc'),_0x323592,_0x5cab('0xd'));logger[_0x5cab('0xe')](_0x5cab('0xf'),_0x323592,_0x5cab('0xd'),JSON[_0x5cab('0x10')](_0x359763));if(_0x359763[_0x5cab('0x11')]){if(_0x359763[_0x5cab('0x11')]['code']===0x1f4){logger[_0x5cab('0x11')](_0x5cab('0xc'),_0x323592,_0x359763['error'][_0x5cab('0x12')]);return _0x5854ae(_0x359763[_0x5cab('0x11')][_0x5cab('0x12')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x323592,_0x359763[_0x5cab('0x11')][_0x5cab('0x12')]);return _0x5da7e6(_0x359763[_0x5cab('0x11')][_0x5cab('0x12')]);}else{logger[_0x5cab('0x13')](_0x5cab('0xc'),_0x323592,'request\x20sent');_0x5da7e6(_0x359763[_0x5cab('0x14')][_0x5cab('0x12')]);}})[_0x5cab('0x15')](function(_0x133b9a){logger[_0x5cab('0x11')](_0x5cab('0xc'),_0x323592,_0x133b9a);_0x5854ae(_0x133b9a);});});} \ No newline at end of file +var _0xb088=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x589002,_0x1c9c42){var _0x1ebe5a=function(_0x7f9547){while(--_0x7f9547){_0x589002['push'](_0x589002['shift']());}};_0x1ebe5a(++_0x1c9c42);}(_0xb088,0x187));var _0x8b08=function(_0x19c393,_0x830e87){_0x19c393=_0x19c393-0x0;var _0x283a25=_0xb088[_0x19c393];return _0x283a25;};'use strict';var _=require(_0x8b08('0x0'));var util=require('util');var moment=require(_0x8b08('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b08('0x2'));var db=require(_0x8b08('0x3'))['db'];var utils=require(_0x8b08('0x4'));var logger=require(_0x8b08('0x5'))(_0x8b08('0x6'));var config=require(_0x8b08('0x7'));var jayson=require(_0x8b08('0x8'));var client=jayson[_0x8b08('0x9')][_0x8b08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x264a25,_0x36f601,_0x250008){return new BPromise(function(_0x4f7729,_0x257b86){return client[_0x8b08('0xb')](_0x264a25,_0x250008)['then'](function(_0x2a294e){logger[_0x8b08('0xc')](_0x8b08('0xd'),_0x36f601,_0x8b08('0xe'));logger[_0x8b08('0xf')](_0x8b08('0x10'),_0x36f601,_0x8b08('0xe'),JSON[_0x8b08('0x11')](_0x2a294e));if(_0x2a294e['error']){if(_0x2a294e[_0x8b08('0x12')][_0x8b08('0x13')]===0x1f4){logger[_0x8b08('0x12')]('ZohoField,\x20%s,\x20%s',_0x36f601,_0x2a294e['error']['message']);return _0x257b86(_0x2a294e[_0x8b08('0x12')][_0x8b08('0x14')]);}logger[_0x8b08('0x12')](_0x8b08('0xd'),_0x36f601,_0x2a294e[_0x8b08('0x12')][_0x8b08('0x14')]);return _0x4f7729(_0x2a294e[_0x8b08('0x12')]['message']);}else{logger[_0x8b08('0xc')]('ZohoField,\x20%s,\x20%s',_0x36f601,'request\x20sent');_0x4f7729(_0x2a294e[_0x8b08('0x15')][_0x8b08('0x14')]);}})[_0x8b08('0x16')](function(_0x4f11c2){logger[_0x8b08('0x12')]('ZohoField,\x20%s,\x20%s',_0x36f601,_0x4f11c2);_0x257b86(_0x4f11c2);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e892833..21f7b60 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x220b8a,_0x1e0b2d){var _0x2f57c7=function(_0x4beb23){while(--_0x4beb23){_0x220b8a['push'](_0x220b8a['shift']());}};_0x2f57c7(++_0x1e0b2d);}(_0xe706,0xa3));var _0x6e70=function(_0x19dd8a,_0x4af545){_0x19dd8a=_0x19dd8a-0x0;var _0x6245d3=_0xe706[_0x19dd8a];return _0x6245d3;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x53c891,_0x358ba1){var _0x1decc7=function(_0x45b548){while(--_0x45b548){_0x53c891['push'](_0x53c891['shift']());}};_0x1decc7(++_0x358ba1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4ae30c6..3b7f906 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 _0x6635=['app.js','INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version'];(function(_0x3239a4,_0x3eb4d1){var _0x45d773=function(_0x39df47){while(--_0x39df47){_0x3239a4['push'](_0x3239a4['shift']());}};_0x45d773(++_0x3eb4d1);}(_0x6635,0x90));var _0x5663=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x6635[_0x1b6c6d];return _0x290d9d;};'use strict';var Sequelize=require('sequelize');module[_0x5663('0x0')]={'name':{'type':Sequelize[_0x5663('0x1')],'allowNull':![],'unique':_0x5663('0x2')},'version':{'type':Sequelize[_0x5663('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x5663('0x1')],'defaultValue':_0x5663('0x3')},'filename':{'type':Sequelize[_0x5663('0x1')]},'path':{'type':Sequelize[_0x5663('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x5663('0x4')]},'active':{'type':Sequelize[_0x5663('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x5663('0x1')]},'state':{'type':Sequelize[_0x5663('0x1')],'unique':_0x5663('0x6')},'description':{'type':Sequelize[_0x5663('0x1')]},'title':{'type':Sequelize[_0x5663('0x1')]},'remoteUri':{'type':Sequelize[_0x5663('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x5755=['INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version','app.js'];(function(_0x5c2b7d,_0x367e50){var _0x19c37b=function(_0x3edf00){while(--_0x3edf00){_0x5c2b7d['push'](_0x5c2b7d['shift']());}};_0x19c37b(++_0x367e50);}(_0x5755,0x8f));var _0x5575=function(_0xff7c05,_0x2456ca){_0xff7c05=_0xff7c05-0x0;var _0x1c1ab9=_0x5755[_0xff7c05];return _0x1c1ab9;};'use strict';var Sequelize=require('sequelize');module[_0x5575('0x0')]={'name':{'type':Sequelize[_0x5575('0x1')],'allowNull':![],'unique':_0x5575('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5575('0x2')},'main':{'type':Sequelize[_0x5575('0x1')],'defaultValue':_0x5575('0x3')},'filename':{'type':Sequelize[_0x5575('0x1')]},'path':{'type':Sequelize[_0x5575('0x1')]},'type':{'type':Sequelize[_0x5575('0x1')]},'size':{'type':Sequelize[_0x5575('0x4')]},'active':{'type':Sequelize[_0x5575('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x5575('0x1')]},'logo':{'type':Sequelize[_0x5575('0x1')]},'state':{'type':Sequelize[_0x5575('0x1')],'unique':_0x5575('0x6')},'description':{'type':Sequelize[_0x5575('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x5575('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0f8b5c7..6c4fa43 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 _0x57ca=['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','Integration','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','rimraf','zip-dir','request-promise','moment'];(function(_0xfeb2c1,_0x59e500){var _0x569da7=function(_0x5b2e22){while(--_0x5b2e22){_0xfeb2c1['push'](_0xfeb2c1['shift']());}};_0x569da7(++_0x59e500);}(_0x57ca,0x108));var _0xa57c=function(_0x1e31aa,_0x169602){_0x1e31aa=_0x1e31aa-0x0;var _0x13dc54=_0x57ca[_0x1e31aa];return _0x13dc54;};'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['Integration']['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['Integration'][_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));}; \ No newline at end of file +var _0x524e=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Integration','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x524e,0x15e));var _0xe524=function(_0x224c45,_0xa46053){_0x224c45=_0x224c45-0x0;var _0x4c2a30=_0x524e[_0x224c45];return _0x4c2a30;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['Integration'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['Integration'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a872529..39cf86f 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 _0xa138=['../../config/environment','./integration.attributes','exports','integrations','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x1303b6,_0x3d7288){var _0x4a983f=function(_0x77db26){while(--_0x77db26){_0x1303b6['push'](_0x1303b6['shift']());}};_0x4a983f(++_0x3d7288);}(_0xa138,0x7c));var _0x8a13=function(_0x1ae0d5,_0x5d9a7b){_0x1ae0d5=_0x1ae0d5-0x0;var _0x48e447=_0xa138[_0x1ae0d5];return _0x48e447;};'use strict';var _=require(_0x8a13('0x0'));var util=require(_0x8a13('0x1'));var logger=require(_0x8a13('0x2'))(_0x8a13('0x3'));var moment=require('moment');var BPromise=require(_0x8a13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a13('0x5'));var config=require(_0x8a13('0x6'));var attributes=require(_0x8a13('0x7'));module[_0x8a13('0x8')]=function(_0x5f3c66,_0xa2b7dc){return _0x5f3c66['define']('Integration',attributes,{'tableName':_0x8a13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ac7=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','moment','bluebird','request-promise','path'];(function(_0x5e5f82,_0x45cf21){var _0x352bcd=function(_0x528bf1){while(--_0x528bf1){_0x5e5f82['push'](_0x5e5f82['shift']());}};_0x352bcd(++_0x45cf21);}(_0x2ac7,0xe4));var _0x72ac=function(_0x25ebd3,_0x4d91fd){_0x25ebd3=_0x25ebd3-0x0;var _0x5738f9=_0x2ac7[_0x25ebd3];return _0x5738f9;};'use strict';var _=require(_0x72ac('0x0'));var util=require(_0x72ac('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x72ac('0x2'));var BPromise=require(_0x72ac('0x3'));var rp=require(_0x72ac('0x4'));var fs=require('fs');var path=require(_0x72ac('0x5'));var rimraf=require(_0x72ac('0x6'));var config=require(_0x72ac('0x7'));var attributes=require(_0x72ac('0x8'));module[_0x72ac('0x9')]=function(_0x35852f,_0x2c0ed9){return _0x35852f[_0x72ac('0xa')](_0x72ac('0xb'),attributes,{'tableName':_0x72ac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 2866292..c6e1666 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x524e,0x15e));var _0xe524=function(_0x5d61c7,_0x472679){_0x5d61c7=_0x5d61c7-0x0;var _0x4f978d=_0x524e[_0x5d61c7];return _0x4f978d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1373ea,_0x30d9b8){_0x1373ea=_0x1373ea-0x0;var _0x56b4f4=_0xc2c7[_0x1373ea];return _0x56b4f4;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('Integration,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index a89462d..4dacab7 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 _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xdb28,0x106));var _0x8db2=function(_0x2904cb,_0x326d88){_0x2904cb=_0x2904cb-0x0;var _0x33a129=_0xdb28[_0x2904cb];return _0x33a129;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./integrationReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 0f19e53..31a7b66 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 _0xb10a=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb10a,0x73));var _0xab10=function(_0x52ebb0,_0x2b13ca){_0x52ebb0=_0x52ebb0-0x0;var _0x230177=_0xb10a[_0x52ebb0];return _0x230177;};'use strict';var Sequelize=require(_0xab10('0x0'));module[_0xab10('0x1')]={'integration':{'type':Sequelize[_0xab10('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xab10('0x2')]},'ticketId':{'type':Sequelize[_0xab10('0x2')]},'integrationId':{'type':Sequelize[_0xab10('0x3')]},'contacts':{'type':Sequelize[_0xab10('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xab10('0x2')]},'calleridname':{'type':Sequelize[_0xab10('0x2')]},'queue':{'type':Sequelize[_0xab10('0x2')]},'interface':{'type':Sequelize[_0xab10('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xab10('0x4')]},'holdtime':{'type':Sequelize[_0xab10('0x3')]},'agentcomplete':{'type':Sequelize[_0xab10('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xab10('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xab10('0x3')]},'reason':{'type':Sequelize[_0xab10('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xab10('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xab10('0x4')]},'agentdump':{'type':Sequelize[_0xab10('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xab10('0x4')]},'lastevent':{'type':Sequelize[_0xab10('0x2')]},'channel':{'type':Sequelize[_0xab10('0x2')]},'channelstate':{'type':Sequelize[_0xab10('0x3')]},'channelstatedesc':{'type':Sequelize[_0xab10('0x2')]},'connectedlinenum':{'type':Sequelize[_0xab10('0x2')]},'connectedlinename':{'type':Sequelize[_0xab10('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xab10('0x2')]},'exten':{'type':Sequelize[_0xab10('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xab10('0x2')]},'destchannelstate':{'type':Sequelize[_0xab10('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xab10('0x2')]},'destcalleridnum':{'type':Sequelize[_0xab10('0x2')]},'destcalleridname':{'type':Sequelize[_0xab10('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xab10('0x2')]},'destlanguage':{'type':Sequelize[_0xab10('0x2')]},'destaccountcode':{'type':Sequelize[_0xab10('0x2')]},'destcontext':{'type':Sequelize[_0xab10('0x2')]},'destexten':{'type':Sequelize[_0xab10('0x2')]},'destpriority':{'type':Sequelize[_0xab10('0x2')]},'destuniqueid':{'type':Sequelize[_0xab10('0x2')]},'messageId':{'type':Sequelize[_0xab10('0x2')]},'inReplyTo':{'type':Sequelize[_0xab10('0x2')]},'subject':{'type':Sequelize[_0xab10('0x2')]},'from':{'type':Sequelize[_0xab10('0x2')]},'to':{'type':Sequelize[_0xab10('0x2')]},'cc':{'type':Sequelize[_0xab10('0x2')]},'attachment':{'type':Sequelize[_0xab10('0x6')]},'html':{'type':Sequelize[_0xab10('0x6')]},'text':{'type':Sequelize[_0xab10('0x6')]},'status':{'type':Sequelize[_0xab10('0x7')](_0xab10('0x8'),_0xab10('0x9'),_0xab10('0xa'),_0xab10('0xb'))},'url':{'type':Sequelize[_0xab10('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xab10('0x2')]},'projectId':{'type':Sequelize[_0xab10('0x3')]}}; \ No newline at end of file +var _0x97a2=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x97a2,0x1d7));var _0x297a=function(_0x34c74f,_0x48b50c){_0x34c74f=_0x34c74f-0x0;var _0x23e777=_0x97a2[_0x34c74f];return _0x23e777;};'use strict';var Sequelize=require(_0x297a('0x0'));module[_0x297a('0x1')]={'integration':{'type':Sequelize[_0x297a('0x2')]},'eventChannel':{'type':Sequelize[_0x297a('0x2')]},'exitStatus':{'type':Sequelize[_0x297a('0x2')]},'ticketId':{'type':Sequelize[_0x297a('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x297a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x297a('0x2')]},'calleridname':{'type':Sequelize[_0x297a('0x2')]},'queue':{'type':Sequelize[_0x297a('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x297a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x297a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x297a('0x3')]},'holdtime':{'type':Sequelize[_0x297a('0x4')]},'agentcomplete':{'type':Sequelize[_0x297a('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x297a('0x4')]},'agentacw':{'type':Sequelize[_0x297a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x297a('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x297a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x297a('0x2')]},'channel':{'type':Sequelize[_0x297a('0x2')]},'channelstate':{'type':Sequelize[_0x297a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x297a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x297a('0x2')]},'connectedlinename':{'type':Sequelize[_0x297a('0x2')]},'language':{'type':Sequelize[_0x297a('0x2')]},'accountcode':{'type':Sequelize[_0x297a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x297a('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x297a('0x2')]},'destchannelstate':{'type':Sequelize[_0x297a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x297a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x297a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x297a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x297a('0x2')]},'destlanguage':{'type':Sequelize[_0x297a('0x2')]},'destaccountcode':{'type':Sequelize[_0x297a('0x2')]},'destcontext':{'type':Sequelize[_0x297a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x297a('0x2')]},'destuniqueid':{'type':Sequelize[_0x297a('0x2')]},'messageId':{'type':Sequelize[_0x297a('0x2')]},'inReplyTo':{'type':Sequelize[_0x297a('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x297a('0x2')]},'cc':{'type':Sequelize[_0x297a('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x297a('0x6')]},'text':{'type':Sequelize[_0x297a('0x6')]},'status':{'type':Sequelize[_0x297a('0x7')](_0x297a('0x8'),_0x297a('0x9'),_0x297a('0xa'),_0x297a('0xb'))},'url':{'type':Sequelize[_0x297a('0x2')]},'app':{'type':Sequelize[_0x297a('0x2')]},'appdata':{'type':Sequelize[_0x297a('0x2')]},'projectId':{'type':Sequelize[_0x297a('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e009bca..a77cfb2 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 _0x238b=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','IntegrationReport','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x31c6a2,_0x38cd91){var _0x19d5d4=function(_0x124929){while(--_0x124929){_0x31c6a2['push'](_0x31c6a2['shift']());}};_0x19d5d4(++_0x38cd91);}(_0x238b,0x199));var _0xb238=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x238b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb238('0x0'));var zipdir=require(_0xb238('0x1'));var jsonpatch=require(_0xb238('0x2'));var rp=require(_0xb238('0x3'));var moment=require('moment');var BPromise=require(_0xb238('0x4'));var Mustache=require(_0xb238('0x5'));var util=require(_0xb238('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb238('0x7'));var ejs=require(_0xb238('0x8'));var fs=require('fs');var fs_extra=require(_0xb238('0x9'));var _=require(_0xb238('0xa'));var squel=require(_0xb238('0xb'));var crypto=require(_0xb238('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb238('0x7'));var querystring=require(_0xb238('0xd'));var Papa=require('papaparse');var Redis=require(_0xb238('0xe'));var authService=require(_0xb238('0xf'));var qs=require(_0xb238('0x10'));var as=require(_0xb238('0x11'));var hardwareService=require(_0xb238('0x12'));var logger=require('../../config/logger')(_0xb238('0x13'));var utils=require(_0xb238('0x14'));var config=require(_0xb238('0x15'));var licenseUtil=require(_0xb238('0x16'));var db=require(_0xb238('0x17'))['db'];function respondWithStatusCode(_0x49a170,_0x1ba044){_0x1ba044=_0x1ba044||0xcc;return function(_0x5a615f){if(_0x5a615f){return _0x49a170['sendStatus'](_0x1ba044);}return _0x49a170['status'](_0x1ba044)[_0xb238('0x18')]();};}function respondWithResult(_0x3b51db,_0x102cc4){_0x102cc4=_0x102cc4||0xc8;return function(_0x31e9bb){if(_0x31e9bb){return _0x3b51db[_0xb238('0x19')](_0x102cc4)[_0xb238('0x1a')](_0x31e9bb);}};}function respondWithFilteredResult(_0x4c8263,_0x511ce4){return function(_0x242d9f){if(_0x242d9f){var _0x412803=typeof _0x511ce4[_0xb238('0x1b')]===_0xb238('0x1c')&&typeof _0x511ce4[_0xb238('0x1d')]===_0xb238('0x1c');var _0x46f111=_0x242d9f[_0xb238('0x1e')];var _0x8e4c70=_0x412803?0x0:_0x511ce4[_0xb238('0x1b')];var _0x14cac0=_0x412803?_0x242d9f[_0xb238('0x1e')]:_0x511ce4[_0xb238('0x1b')]+_0x511ce4['limit'];var _0xf9f797;if(_0x14cac0>=_0x46f111){_0x14cac0=_0x46f111;_0xf9f797=0xc8;}else{_0xf9f797=0xce;}_0x4c8263['status'](_0xf9f797);return _0x4c8263['set'](_0xb238('0x1f'),_0x8e4c70+'-'+_0x14cac0+'/'+_0x46f111)['json'](_0x242d9f);}return null;};}function patchUpdates(_0x1fc6ff){return function(_0x10a2be){try{jsonpatch[_0xb238('0x20')](_0x10a2be,_0x1fc6ff,!![]);}catch(_0x2103e3){return BPromise['reject'](_0x2103e3);}return _0x10a2be[_0xb238('0x21')]();};}function saveUpdates(_0x6d248f,_0x1f6a3f){return function(_0x4953fc){if(_0x4953fc){return _0x4953fc[_0xb238('0x22')](_0x6d248f)['then'](function(_0x5133c7){return _0x5133c7;});}return null;};}function removeEntity(_0x970d7c,_0xf98521){return function(_0x27937b){if(_0x27937b){return _0x27937b[_0xb238('0x23')]()[_0xb238('0x24')](function(){_0x970d7c[_0xb238('0x19')](0xcc)[_0xb238('0x18')]();});}};}function handleEntityNotFound(_0x56aab7,_0xcd2595){return function(_0x50defb){if(!_0x50defb){_0x56aab7[_0xb238('0x25')](0x194);}return _0x50defb;};}function handleError(_0x11fd03,_0x6e877){_0x6e877=_0x6e877||0x1f4;return function(_0x2074b0){logger[_0xb238('0x26')](_0x2074b0[_0xb238('0x27')]);if(_0x2074b0[_0xb238('0x28')]){delete _0x2074b0['name'];}_0x11fd03['status'](_0x6e877)[_0xb238('0x29')](_0x2074b0);};}exports['index']=function(_0x4e133a,_0x19e970){var _0x447bee={},_0x335a82={},_0x2d1d7b={'count':0x0,'rows':[]};var _0x14ab11=_['map'](db[_0xb238('0x2a')]['rawAttributes'],function(_0x53421e){return{'name':_0x53421e['fieldName'],'type':_0x53421e['type']['key']};});_0x335a82['model']=_[_0xb238('0x2b')](_0x14ab11,'name');_0x335a82[_0xb238('0x2c')]=_[_0xb238('0x2d')](_0x4e133a[_0xb238('0x2c')]);_0x335a82[_0xb238('0x2e')]=_[_0xb238('0x2f')](_0x335a82[_0xb238('0x30')],_0x335a82[_0xb238('0x2c')]);_0x447bee['attributes']=_[_0xb238('0x2f')](_0x335a82[_0xb238('0x30')],qs[_0xb238('0x31')](_0x4e133a[_0xb238('0x2c')][_0xb238('0x31')]));_0x447bee[_0xb238('0x32')]=_0x447bee[_0xb238('0x32')]['length']?_0x447bee[_0xb238('0x32')]:_0x335a82[_0xb238('0x30')];if(!_0x4e133a[_0xb238('0x2c')][_0xb238('0x33')]('nolimit')){_0x447bee[_0xb238('0x1d')]=qs[_0xb238('0x1d')](_0x4e133a[_0xb238('0x2c')]['limit']);_0x447bee[_0xb238('0x1b')]=qs[_0xb238('0x1b')](_0x4e133a[_0xb238('0x2c')]['offset']);}_0x447bee[_0xb238('0x34')]=qs[_0xb238('0x35')](_0x4e133a['query'][_0xb238('0x35')]);_0x447bee[_0xb238('0x36')]=qs['filters'](_['pick'](_0x4e133a[_0xb238('0x2c')],_0x335a82['filters']),_0x14ab11);if(_0x4e133a['query'][_0xb238('0x37')]){_0x447bee[_0xb238('0x36')]=_[_0xb238('0x38')](_0x447bee[_0xb238('0x36')],{'$or':_[_0xb238('0x2b')](_0x14ab11,function(_0x93a174){if(_0x93a174[_0xb238('0x39')]!=='VIRTUAL'){var _0x501cfb={};_0x501cfb[_0x93a174[_0xb238('0x28')]]={'$like':'%'+_0x4e133a[_0xb238('0x2c')][_0xb238('0x37')]+'%'};return _0x501cfb;}})});}_0x447bee=_[_0xb238('0x38')]({},_0x447bee,_0x4e133a[_0xb238('0x3a')]);var _0x56ebe5={'where':_0x447bee[_0xb238('0x36')]};return db[_0xb238('0x2a')]['count'](_0x56ebe5)[_0xb238('0x24')](function(_0x355a22){_0x2d1d7b[_0xb238('0x1e')]=_0x355a22;if(_0x4e133a[_0xb238('0x2c')][_0xb238('0x3b')]){_0x447bee[_0xb238('0x3c')]=[{'all':!![]}];}return db[_0xb238('0x2a')][_0xb238('0x3d')](_0x447bee);})[_0xb238('0x24')](function(_0x18d425){_0x2d1d7b[_0xb238('0x3e')]=_0x18d425;return _0x2d1d7b;})[_0xb238('0x24')](respondWithFilteredResult(_0x19e970,_0x447bee))[_0xb238('0x3f')](handleError(_0x19e970,null));};exports[_0xb238('0x40')]=function(_0x5a1030,_0x20ed24){var _0x1c77c3={'raw':![],'where':{'id':_0x5a1030[_0xb238('0x41')]['id']}},_0x447b13={};_0x447b13['model']=_[_0xb238('0x2d')](db[_0xb238('0x2a')][_0xb238('0x42')]);_0x447b13[_0xb238('0x2c')]=_[_0xb238('0x2d')](_0x5a1030[_0xb238('0x2c')]);_0x447b13[_0xb238('0x2e')]=_[_0xb238('0x2f')](_0x447b13[_0xb238('0x30')],_0x447b13['query']);_0x1c77c3[_0xb238('0x32')]=_[_0xb238('0x2f')](_0x447b13[_0xb238('0x30')],qs[_0xb238('0x31')](_0x5a1030[_0xb238('0x2c')]['fields']));_0x1c77c3[_0xb238('0x32')]=_0x1c77c3['attributes']['length']?_0x1c77c3[_0xb238('0x32')]:_0x447b13[_0xb238('0x30')];if(_0x5a1030['query']['includeAll']){_0x1c77c3[_0xb238('0x3c')]=[{'all':!![]}];}_0x1c77c3=_[_0xb238('0x38')]({},_0x1c77c3,_0x5a1030[_0xb238('0x3a')]);return db['IntegrationReport']['find'](_0x1c77c3)[_0xb238('0x24')](handleEntityNotFound(_0x20ed24,null))[_0xb238('0x24')](respondWithResult(_0x20ed24,null))[_0xb238('0x3f')](handleError(_0x20ed24,null));};exports[_0xb238('0x43')]=function(_0x857929,_0x2ab243){return db[_0xb238('0x2a')][_0xb238('0x43')](_0x857929[_0xb238('0x44')],{})['then'](respondWithResult(_0x2ab243,0xc9))[_0xb238('0x3f')](handleError(_0x2ab243,null));};exports[_0xb238('0x22')]=function(_0x3dc884,_0x598b05){if(_0x3dc884[_0xb238('0x44')]['id']){delete _0x3dc884[_0xb238('0x44')]['id'];}return db[_0xb238('0x2a')][_0xb238('0x45')]({'where':{'id':_0x3dc884[_0xb238('0x41')]['id']}})[_0xb238('0x24')](handleEntityNotFound(_0x598b05,null))[_0xb238('0x24')](saveUpdates(_0x3dc884[_0xb238('0x44')],null))['then'](respondWithResult(_0x598b05,null))[_0xb238('0x3f')](handleError(_0x598b05,null));};exports[_0xb238('0x23')]=function(_0x4fe430,_0x309113){return db[_0xb238('0x2a')][_0xb238('0x45')]({'where':{'id':_0x4fe430[_0xb238('0x41')]['id']}})[_0xb238('0x24')](handleEntityNotFound(_0x309113,null))[_0xb238('0x24')](removeEntity(_0x309113,null))[_0xb238('0x3f')](handleError(_0x309113,null));};exports[_0xb238('0x46')]=function(_0xe90ad0,_0x166dc5){return db[_0xb238('0x2a')]['describe']()[_0xb238('0x24')](respondWithResult(_0x166dc5,null))[_0xb238('0x3f')](handleError(_0x166dc5,null));}; \ No newline at end of file +var _0xab48=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','end','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra'];(function(_0x2597ec,_0xe48eb5){var _0xc16ff8=function(_0x3bf2f6){while(--_0x3bf2f6){_0x2597ec['push'](_0x2597ec['shift']());}};_0xc16ff8(++_0xe48eb5);}(_0xab48,0x1c4));var _0x8ab4=function(_0x3c9c4d,_0x1a2ef0){_0x3c9c4d=_0x3c9c4d-0x0;var _0x189ec2=_0xab48[_0x3c9c4d];return _0x189ec2;};'use strict';var emlformat=require(_0x8ab4('0x0'));var rimraf=require(_0x8ab4('0x1'));var zipdir=require(_0x8ab4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ab4('0x3'));var moment=require(_0x8ab4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8ab4('0x5'));var util=require(_0x8ab4('0x6'));var path=require(_0x8ab4('0x7'));var sox=require('sox');var csv=require(_0x8ab4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ab4('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8ab4('0xa'));var jsforce=require(_0x8ab4('0xb'));var deskjs=require(_0x8ab4('0xc'));var toCsv=require(_0x8ab4('0x8'));var querystring=require(_0x8ab4('0xd'));var Papa=require(_0x8ab4('0xe'));var Redis=require(_0x8ab4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8ab4('0x10'));var as=require(_0x8ab4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ab4('0x12'))('api');var utils=require(_0x8ab4('0x13'));var config=require(_0x8ab4('0x14'));var licenseUtil=require(_0x8ab4('0x15'));var db=require(_0x8ab4('0x16'))['db'];function respondWithStatusCode(_0x684cc5,_0x1f92a3){_0x1f92a3=_0x1f92a3||0xcc;return function(_0x6373ef){if(_0x6373ef){return _0x684cc5[_0x8ab4('0x17')](_0x1f92a3);}return _0x684cc5[_0x8ab4('0x18')](_0x1f92a3)['end']();};}function respondWithResult(_0x2f43af,_0x56f194){_0x56f194=_0x56f194||0xc8;return function(_0x58379a){if(_0x58379a){return _0x2f43af[_0x8ab4('0x18')](_0x56f194)[_0x8ab4('0x19')](_0x58379a);}};}function respondWithFilteredResult(_0x409cc6,_0xc33e18){return function(_0x4a8f34){if(_0x4a8f34){var _0xd7b8c2=typeof _0xc33e18['offset']===_0x8ab4('0x1a')&&typeof _0xc33e18['limit']==='undefined';var _0x29d374=_0x4a8f34[_0x8ab4('0x1b')];var _0x44cdb7=_0xd7b8c2?0x0:_0xc33e18['offset'];var _0x531dd0=_0xd7b8c2?_0x4a8f34[_0x8ab4('0x1b')]:_0xc33e18[_0x8ab4('0x1c')]+_0xc33e18[_0x8ab4('0x1d')];var _0x2cbec9;if(_0x531dd0>=_0x29d374){_0x531dd0=_0x29d374;_0x2cbec9=0xc8;}else{_0x2cbec9=0xce;}_0x409cc6[_0x8ab4('0x18')](_0x2cbec9);return _0x409cc6[_0x8ab4('0x1e')](_0x8ab4('0x1f'),_0x44cdb7+'-'+_0x531dd0+'/'+_0x29d374)[_0x8ab4('0x19')](_0x4a8f34);}return null;};}function patchUpdates(_0x5818e4){return function(_0x3eb5c6){try{jsonpatch[_0x8ab4('0x20')](_0x3eb5c6,_0x5818e4,!![]);}catch(_0x18ae7b){return BPromise['reject'](_0x18ae7b);}return _0x3eb5c6[_0x8ab4('0x21')]();};}function saveUpdates(_0x3fc47c,_0x51c29c){return function(_0x10b213){if(_0x10b213){return _0x10b213['update'](_0x3fc47c)['then'](function(_0x17a836){return _0x17a836;});}return null;};}function removeEntity(_0x424444,_0x293094){return function(_0x22fb32){if(_0x22fb32){return _0x22fb32['destroy']()[_0x8ab4('0x22')](function(){_0x424444[_0x8ab4('0x18')](0xcc)[_0x8ab4('0x23')]();});}};}function handleEntityNotFound(_0x5759e8,_0x520378){return function(_0x317afe){if(!_0x317afe){_0x5759e8[_0x8ab4('0x17')](0x194);}return _0x317afe;};}function handleError(_0x2c1a5a,_0x33c514){_0x33c514=_0x33c514||0x1f4;return function(_0x1669a0){logger[_0x8ab4('0x24')](_0x1669a0[_0x8ab4('0x25')]);if(_0x1669a0[_0x8ab4('0x26')]){delete _0x1669a0[_0x8ab4('0x26')];}_0x2c1a5a['status'](_0x33c514)[_0x8ab4('0x27')](_0x1669a0);};}exports['index']=function(_0x128c05,_0x2af652){var _0x3f6533={},_0xe17cd0={},_0x3a7780={'count':0x0,'rows':[]};var _0x561f78=_[_0x8ab4('0x28')](db[_0x8ab4('0x29')][_0x8ab4('0x2a')],function(_0x1db4a2){return{'name':_0x1db4a2[_0x8ab4('0x2b')],'type':_0x1db4a2[_0x8ab4('0x2c')][_0x8ab4('0x2d')]};});_0xe17cd0['model']=_[_0x8ab4('0x28')](_0x561f78,'name');_0xe17cd0[_0x8ab4('0x2e')]=_['keys'](_0x128c05[_0x8ab4('0x2e')]);_0xe17cd0[_0x8ab4('0x2f')]=_[_0x8ab4('0x30')](_0xe17cd0[_0x8ab4('0x31')],_0xe17cd0[_0x8ab4('0x2e')]);_0x3f6533[_0x8ab4('0x32')]=_[_0x8ab4('0x30')](_0xe17cd0[_0x8ab4('0x31')],qs[_0x8ab4('0x33')](_0x128c05['query'][_0x8ab4('0x33')]));_0x3f6533[_0x8ab4('0x32')]=_0x3f6533[_0x8ab4('0x32')][_0x8ab4('0x34')]?_0x3f6533[_0x8ab4('0x32')]:_0xe17cd0[_0x8ab4('0x31')];if(!_0x128c05[_0x8ab4('0x2e')][_0x8ab4('0x35')](_0x8ab4('0x36'))){_0x3f6533['limit']=qs[_0x8ab4('0x1d')](_0x128c05[_0x8ab4('0x2e')]['limit']);_0x3f6533[_0x8ab4('0x1c')]=qs[_0x8ab4('0x1c')](_0x128c05[_0x8ab4('0x2e')][_0x8ab4('0x1c')]);}_0x3f6533[_0x8ab4('0x37')]=qs[_0x8ab4('0x38')](_0x128c05[_0x8ab4('0x2e')][_0x8ab4('0x38')]);_0x3f6533[_0x8ab4('0x39')]=qs[_0x8ab4('0x2f')](_[_0x8ab4('0x3a')](_0x128c05[_0x8ab4('0x2e')],_0xe17cd0[_0x8ab4('0x2f')]),_0x561f78);if(_0x128c05[_0x8ab4('0x2e')][_0x8ab4('0x3b')]){_0x3f6533[_0x8ab4('0x39')]=_[_0x8ab4('0x3c')](_0x3f6533[_0x8ab4('0x39')],{'$or':_[_0x8ab4('0x28')](_0x561f78,function(_0x27d722){if(_0x27d722[_0x8ab4('0x2c')]!==_0x8ab4('0x3d')){var _0x2b1005={};_0x2b1005[_0x27d722[_0x8ab4('0x26')]]={'$like':'%'+_0x128c05['query'][_0x8ab4('0x3b')]+'%'};return _0x2b1005;}})});}_0x3f6533=_[_0x8ab4('0x3c')]({},_0x3f6533,_0x128c05[_0x8ab4('0x3e')]);var _0x5edc63={'where':_0x3f6533['where']};return db[_0x8ab4('0x29')][_0x8ab4('0x1b')](_0x5edc63)[_0x8ab4('0x22')](function(_0x1f55cd){_0x3a7780[_0x8ab4('0x1b')]=_0x1f55cd;if(_0x128c05[_0x8ab4('0x2e')][_0x8ab4('0x3f')]){_0x3f6533[_0x8ab4('0x40')]=[{'all':!![]}];}return db[_0x8ab4('0x29')][_0x8ab4('0x41')](_0x3f6533);})[_0x8ab4('0x22')](function(_0x4894c6){_0x3a7780[_0x8ab4('0x42')]=_0x4894c6;return _0x3a7780;})[_0x8ab4('0x22')](respondWithFilteredResult(_0x2af652,_0x3f6533))[_0x8ab4('0x43')](handleError(_0x2af652,null));};exports[_0x8ab4('0x44')]=function(_0x978884,_0x5c6ffc){var _0x50c0e1={'raw':![],'where':{'id':_0x978884[_0x8ab4('0x45')]['id']}},_0x43dd64={};_0x43dd64['model']=_[_0x8ab4('0x46')](db[_0x8ab4('0x29')][_0x8ab4('0x2a')]);_0x43dd64[_0x8ab4('0x2e')]=_[_0x8ab4('0x46')](_0x978884[_0x8ab4('0x2e')]);_0x43dd64[_0x8ab4('0x2f')]=_[_0x8ab4('0x30')](_0x43dd64['model'],_0x43dd64['query']);_0x50c0e1[_0x8ab4('0x32')]=_[_0x8ab4('0x30')](_0x43dd64[_0x8ab4('0x31')],qs[_0x8ab4('0x33')](_0x978884[_0x8ab4('0x2e')][_0x8ab4('0x33')]));_0x50c0e1['attributes']=_0x50c0e1[_0x8ab4('0x32')][_0x8ab4('0x34')]?_0x50c0e1['attributes']:_0x43dd64['model'];if(_0x978884[_0x8ab4('0x2e')][_0x8ab4('0x3f')]){_0x50c0e1[_0x8ab4('0x40')]=[{'all':!![]}];}_0x50c0e1=_['merge']({},_0x50c0e1,_0x978884[_0x8ab4('0x3e')]);return db['IntegrationReport']['find'](_0x50c0e1)[_0x8ab4('0x22')](handleEntityNotFound(_0x5c6ffc,null))[_0x8ab4('0x22')](respondWithResult(_0x5c6ffc,null))['catch'](handleError(_0x5c6ffc,null));};exports[_0x8ab4('0x47')]=function(_0x22827d,_0x329e35){return db[_0x8ab4('0x29')][_0x8ab4('0x47')](_0x22827d[_0x8ab4('0x48')],{})[_0x8ab4('0x22')](respondWithResult(_0x329e35,0xc9))[_0x8ab4('0x43')](handleError(_0x329e35,null));};exports[_0x8ab4('0x49')]=function(_0x489d65,_0x2099a0){if(_0x489d65[_0x8ab4('0x48')]['id']){delete _0x489d65[_0x8ab4('0x48')]['id'];}return db['IntegrationReport'][_0x8ab4('0x4a')]({'where':{'id':_0x489d65[_0x8ab4('0x45')]['id']}})[_0x8ab4('0x22')](handleEntityNotFound(_0x2099a0,null))[_0x8ab4('0x22')](saveUpdates(_0x489d65['body'],null))[_0x8ab4('0x22')](respondWithResult(_0x2099a0,null))[_0x8ab4('0x43')](handleError(_0x2099a0,null));};exports[_0x8ab4('0x4b')]=function(_0xf511ae,_0x35849a){return db['IntegrationReport'][_0x8ab4('0x4a')]({'where':{'id':_0xf511ae[_0x8ab4('0x45')]['id']}})['then'](handleEntityNotFound(_0x35849a,null))['then'](removeEntity(_0x35849a,null))[_0x8ab4('0x43')](handleError(_0x35849a,null));};exports['describe']=function(_0x36a4f0,_0x1e0ed2){return db[_0x8ab4('0x29')][_0x8ab4('0x4c')]()[_0x8ab4('0x22')](respondWithResult(_0x1e0ed2,null))[_0x8ab4('0x43')](handleError(_0x1e0ed2,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 60f8b60..8f2aff0 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 _0xc13e=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x580197,_0xbb7e10){var _0x54a754=function(_0x271e2b){while(--_0x271e2b){_0x580197['push'](_0x580197['shift']());}};_0x54a754(++_0xbb7e10);}(_0xc13e,0xa3));var _0xec13=function(_0x1c678c,_0x11fa6b){_0x1c678c=_0x1c678c-0x0;var _0x29cf5f=_0xc13e[_0x1c678c];return _0x29cf5f;};'use strict';var _=require(_0xec13('0x0'));var util=require(_0xec13('0x1'));var logger=require(_0xec13('0x2'))(_0xec13('0x3'));var moment=require(_0xec13('0x4'));var BPromise=require(_0xec13('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec13('0x6'));var rimraf=require(_0xec13('0x7'));var config=require(_0xec13('0x8'));var attributes=require(_0xec13('0x9'));module[_0xec13('0xa')]=function(_0xd81abc,_0x1f08d7){return _0xd81abc[_0xec13('0xb')](_0xec13('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaad9=['moment','bluebird','path','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaad9,0x68));var _0x9aad=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xaad9[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x9aad('0x0'));var util=require(_0x9aad('0x1'));var logger=require(_0x9aad('0x2'))(_0x9aad('0x3'));var moment=require(_0x9aad('0x4'));var BPromise=require(_0x9aad('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aad('0x6'));var rimraf=require('rimraf');var config=require(_0x9aad('0x7'));var attributes=require(_0x9aad('0x8'));module[_0x9aad('0x9')]=function(_0x310cb1,_0x2c23e6){return _0x310cb1[_0x9aad('0xa')]('IntegrationReport',attributes,{'tableName':_0x9aad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index f800dc5..9c59b4f 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 _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x814b,0x1a2));var _0xb814=function(_0x9148ba,_0x2cb1b5){_0x9148ba=_0x9148ba-0x0;var _0x355e3b=_0x814b[_0x9148ba];return _0x355e3b;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x5c12a6,_0x125238){var _0x544f51=function(_0x449367){while(--_0x449367){_0x5c12a6['push'](_0x5c12a6['shift']());}};_0x544f51(++_0x125238);}(_0xba34,0x119));var _0x4ba3=function(_0x5729b3,_0x1e83cf){_0x5729b3=_0x5729b3-0x0;var _0x15ea13=_0xba34[_0x5729b3];return _0x15ea13;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c2ae08d..afc2974 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 _0x4553=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','getIntervals','post','/:id/sub_intervals'];(function(_0x360f00,_0x345389){var _0x2d2832=function(_0xebb3b9){while(--_0xebb3b9){_0x360f00['push'](_0x360f00['shift']());}};_0x2d2832(++_0x345389);}(_0x4553,0x1be));var _0x3455=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x4553[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require(_0x3455('0x0'));var path=require(_0x3455('0x1'));var timeout=require(_0x3455('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3455('0x3'));var auth=require(_0x3455('0x4'));var interaction=require(_0x3455('0x5'));var config=require(_0x3455('0x6'));var controller=require(_0x3455('0x7'));router[_0x3455('0x8')]('/',auth[_0x3455('0x9')](),controller[_0x3455('0xa')]);router[_0x3455('0x8')]('/:id',auth[_0x3455('0x9')](),controller['show']);router[_0x3455('0x8')]('/:id/sub_intervals',auth[_0x3455('0x9')](),controller[_0x3455('0xb')]);router[_0x3455('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3455('0xc')](_0x3455('0xd'),auth[_0x3455('0x9')](),controller[_0x3455('0xe')]);router[_0x3455('0xc')](_0x3455('0xf'),auth[_0x3455('0x9')](),controller[_0x3455('0x10')]);router[_0x3455('0x11')](_0x3455('0x12'),auth[_0x3455('0x9')](),controller[_0x3455('0x13')]);router[_0x3455('0x14')](_0x3455('0x12'),auth[_0x3455('0x9')](),controller[_0x3455('0x15')]);module[_0x3455('0x16')]=router; \ No newline at end of file +var _0xd9a8=['../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','/:id/sub_intervals','post','create','addInterval','addIntervals','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x2376d1,_0x38eec4){_0x2376d1=_0x2376d1-0x0;var _0x443759=_0xd9a8[_0x2376d1];return _0x443759;};'use strict';var multer=require(_0x8d9a('0x0'));var util=require(_0x8d9a('0x1'));var path=require(_0x8d9a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d9a('0x3'));var router=express[_0x8d9a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8d9a('0x5'));var config=require(_0x8d9a('0x6'));var controller=require(_0x8d9a('0x7'));router[_0x8d9a('0x8')]('/',auth[_0x8d9a('0x9')](),controller['index']);router[_0x8d9a('0x8')](_0x8d9a('0xa'),auth[_0x8d9a('0x9')](),controller['show']);router[_0x8d9a('0x8')](_0x8d9a('0xb'),auth[_0x8d9a('0x9')](),controller['getIntervals']);router[_0x8d9a('0xc')]('/',auth[_0x8d9a('0x9')](),controller[_0x8d9a('0xd')]);router['post'](_0x8d9a('0xb'),auth['isAuthenticated'](),controller[_0x8d9a('0xe')]);router[_0x8d9a('0xc')]('/:id/sub_intervals/create_many',auth[_0x8d9a('0x9')](),controller[_0x8d9a('0xf')]);router['put'](_0x8d9a('0xa'),auth[_0x8d9a('0x9')](),controller[_0x8d9a('0x10')]);router[_0x8d9a('0x11')](_0x8d9a('0xa'),auth[_0x8d9a('0x9')](),controller[_0x8d9a('0x12')]);module[_0x8d9a('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 605abcb..6c4af8f 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 _0x2984=['STRING','sequelize','exports'];(function(_0x4ef712,_0x11525e){var _0x17c8d2=function(_0x953ec7){while(--_0x953ec7){_0x4ef712['push'](_0x4ef712['shift']());}};_0x17c8d2(++_0x11525e);}(_0x2984,0x15a));var _0x4298=function(_0x2cc842,_0xd6800d){_0x2cc842=_0x2cc842-0x0;var _0x24adab=_0x2984[_0x2cc842];return _0x24adab;};'use strict';var Sequelize=require(_0x4298('0x0'));module[_0x4298('0x1')]={'name':{'type':Sequelize[_0x4298('0x2')]},'description':{'type':Sequelize[_0x4298('0x2')]},'interval':{'type':Sequelize[_0x4298('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xae92=['sequelize','exports'];(function(_0x56989c,_0x6781f0){var _0x22ab27=function(_0x390034){while(--_0x390034){_0x56989c['push'](_0x56989c['shift']());}};_0x22ab27(++_0x6781f0);}(_0xae92,0x1ac));var _0x2ae9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae92[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2ae9('0x0'));module[_0x2ae9('0x1')]={'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 e3ddf2c..ddaec62 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 _0x8788=['type','key','map','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','getIntervals','findOne','pick','filter','hasOwnProperty','sequelize','transaction','bulkCreate','findAll','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','Interval','rawAttributes'];(function(_0x287502,_0x4cf65a){var _0x26b939=function(_0x2c9213){while(--_0x2c9213){_0x287502['push'](_0x287502['shift']());}};_0x26b939(++_0x4cf65a);}(_0x8788,0x1f3));var _0x8878=function(_0x1bcc92,_0x4929b8){_0x1bcc92=_0x1bcc92-0x0;var _0x88406a=_0x8788[_0x1bcc92];return _0x88406a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8878('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8878('0x1'));var rp=require('request-promise');var moment=require(_0x8878('0x2'));var BPromise=require(_0x8878('0x3'));var Mustache=require(_0x8878('0x4'));var util=require('util');var path=require(_0x8878('0x5'));var sox=require(_0x8878('0x6'));var csv=require(_0x8878('0x7'));var ejs=require(_0x8878('0x8'));var fs=require('fs');var fs_extra=require(_0x8878('0x9'));var _=require('lodash');var squel=require(_0x8878('0xa'));var crypto=require('crypto');var jsforce=require(_0x8878('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8878('0x7'));var querystring=require(_0x8878('0xc'));var Papa=require(_0x8878('0xd'));var Redis=require(_0x8878('0xe'));var authService=require(_0x8878('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8878('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8878('0x11'))(_0x8878('0x12'));var utils=require(_0x8878('0x13'));var config=require(_0x8878('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8878('0x15'))['db'];var extensions=require(_0x8878('0x16'));function respondWithStatusCode(_0x419868,_0x887144){_0x887144=_0x887144||0xcc;return function(_0x1e9ea3){if(_0x1e9ea3){return _0x419868[_0x8878('0x17')](_0x887144);}return _0x419868[_0x8878('0x18')](_0x887144)[_0x8878('0x19')]();};}function respondWithResult(_0x1d8a26,_0x374841){_0x374841=_0x374841||0xc8;return function(_0x2a1efd){if(_0x2a1efd){return _0x1d8a26[_0x8878('0x18')](_0x374841)[_0x8878('0x1a')](_0x2a1efd);}};}function respondWithFilteredResult(_0x37ed52,_0x22a962){return function(_0x1133d0){if(_0x1133d0){var _0x2e07b5=typeof _0x22a962[_0x8878('0x1b')]===_0x8878('0x1c')&&typeof _0x22a962[_0x8878('0x1d')]===_0x8878('0x1c');var _0x2d12f8=_0x1133d0[_0x8878('0x1e')];var _0xe244aa=_0x2e07b5?0x0:_0x22a962[_0x8878('0x1b')];var _0x1c5ab1=_0x2e07b5?_0x1133d0[_0x8878('0x1e')]:_0x22a962['offset']+_0x22a962[_0x8878('0x1d')];var _0x22298e;if(_0x1c5ab1>=_0x2d12f8){_0x1c5ab1=_0x2d12f8;_0x22298e=0xc8;}else{_0x22298e=0xce;}_0x37ed52[_0x8878('0x18')](_0x22298e);return _0x37ed52[_0x8878('0x1f')](_0x8878('0x20'),_0xe244aa+'-'+_0x1c5ab1+'/'+_0x2d12f8)[_0x8878('0x1a')](_0x1133d0);}return null;};}function patchUpdates(_0x1e6630){return function(_0x33a812){try{jsonpatch[_0x8878('0x21')](_0x33a812,_0x1e6630,!![]);}catch(_0xd93d46){return BPromise[_0x8878('0x22')](_0xd93d46);}return _0x33a812[_0x8878('0x23')]();};}function saveUpdates(_0x1e49c3,_0x5e8dce){return function(_0x17f646){if(_0x17f646){return _0x17f646[_0x8878('0x24')](_0x1e49c3)[_0x8878('0x25')](function(_0x45d00a){return _0x45d00a;});}return null;};}function removeEntity(_0x12c8d3,_0x3db20b){return function(_0x572f2d){if(_0x572f2d){return _0x572f2d[_0x8878('0x26')]()['then'](function(){var _0x22948e=_0x572f2d[_0x8878('0x27')]({'plain':!![]});var _0x5789b1=_0x8878('0x28');return db[_0x8878('0x29')][_0x8878('0x26')]({'where':{'type':_0x5789b1,'resourceId':_0x22948e['id']}})[_0x8878('0x25')](function(){return _0x572f2d;});})[_0x8878('0x25')](function(){_0x12c8d3[_0x8878('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x317485,_0x385c12){return function(_0x39b0af){if(!_0x39b0af){_0x317485[_0x8878('0x17')](0x194);}return _0x39b0af;};}function handleError(_0x19e68d,_0x241f94){_0x241f94=_0x241f94||0x1f4;return function(_0x5392e1){logger[_0x8878('0x2a')](_0x5392e1[_0x8878('0x2b')]);if(_0x5392e1[_0x8878('0x2c')]){delete _0x5392e1[_0x8878('0x2c')];}_0x19e68d[_0x8878('0x18')](_0x241f94)['send'](_0x5392e1);};}exports['index']=function(_0x110232,_0x4c8f76){var _0x4850a2={},_0x27291f={},_0x52921b={'count':0x0,'rows':[]};var _0x196299=_['map'](db[_0x8878('0x2d')][_0x8878('0x2e')],function(_0x16f4c8){return{'name':_0x16f4c8['fieldName'],'type':_0x16f4c8[_0x8878('0x2f')][_0x8878('0x30')]};});_0x27291f['model']=_[_0x8878('0x31')](_0x196299,_0x8878('0x2c'));_0x27291f['query']=_[_0x8878('0x32')](_0x110232[_0x8878('0x33')]);_0x27291f[_0x8878('0x34')]=_['intersection'](_0x27291f[_0x8878('0x35')],_0x27291f[_0x8878('0x33')]);_0x4850a2[_0x8878('0x36')]=_[_0x8878('0x37')](_0x27291f[_0x8878('0x35')],qs[_0x8878('0x38')](_0x110232[_0x8878('0x33')][_0x8878('0x38')]));_0x4850a2[_0x8878('0x36')]=_0x4850a2[_0x8878('0x36')][_0x8878('0x39')]?_0x4850a2[_0x8878('0x36')]:_0x27291f[_0x8878('0x35')];if(!_0x110232[_0x8878('0x33')]['hasOwnProperty'](_0x8878('0x3a'))){_0x4850a2[_0x8878('0x1d')]=qs[_0x8878('0x1d')](_0x110232[_0x8878('0x33')][_0x8878('0x1d')]);_0x4850a2['offset']=qs[_0x8878('0x1b')](_0x110232[_0x8878('0x33')][_0x8878('0x1b')]);}_0x4850a2[_0x8878('0x3b')]=qs[_0x8878('0x3c')](_0x110232[_0x8878('0x33')]['sort']);_0x4850a2[_0x8878('0x3d')]=qs[_0x8878('0x34')](_['pick'](_0x110232[_0x8878('0x33')],_0x27291f['filters']),_0x196299);if(_0x110232[_0x8878('0x33')]['filter']){_0x4850a2[_0x8878('0x3d')]=_[_0x8878('0x3e')](_0x4850a2[_0x8878('0x3d')],{'$or':_[_0x8878('0x31')](_0x196299,function(_0x16d969){if(_0x16d969[_0x8878('0x2f')]!==_0x8878('0x3f')){var _0x401694={};_0x401694[_0x16d969[_0x8878('0x2c')]]={'$like':'%'+_0x110232[_0x8878('0x33')]['filter']+'%'};return _0x401694;}})});}_0x4850a2=_['merge']({},_0x4850a2,_0x110232[_0x8878('0x40')]);var _0x4314c9={'where':_0x4850a2[_0x8878('0x3d')]};return db[_0x8878('0x2d')][_0x8878('0x1e')](_0x4314c9)[_0x8878('0x25')](function(_0x306035){_0x52921b[_0x8878('0x1e')]=_0x306035;if(_0x110232[_0x8878('0x33')][_0x8878('0x41')]){_0x4850a2[_0x8878('0x42')]=[{'all':!![]}];}return db[_0x8878('0x2d')]['findAll'](_0x4850a2);})[_0x8878('0x25')](function(_0xd5d4c4){_0x52921b[_0x8878('0x43')]=_0xd5d4c4;return _0x52921b;})[_0x8878('0x25')](respondWithFilteredResult(_0x4c8f76,_0x4850a2))[_0x8878('0x44')](handleError(_0x4c8f76,null));};exports[_0x8878('0x45')]=function(_0x3c4c54,_0x23b050){var _0x583c24={'raw':!![],'where':{'id':_0x3c4c54['params']['id']}},_0x3264fe={};_0x3264fe[_0x8878('0x35')]=_[_0x8878('0x32')](db[_0x8878('0x2d')][_0x8878('0x2e')]);_0x3264fe['query']=_['keys'](_0x3c4c54[_0x8878('0x33')]);_0x3264fe['filters']=_[_0x8878('0x37')](_0x3264fe[_0x8878('0x35')],_0x3264fe[_0x8878('0x33')]);_0x583c24[_0x8878('0x36')]=_['intersection'](_0x3264fe[_0x8878('0x35')],qs[_0x8878('0x38')](_0x3c4c54['query'][_0x8878('0x38')]));_0x583c24['attributes']=_0x583c24[_0x8878('0x36')][_0x8878('0x39')]?_0x583c24['attributes']:_0x3264fe[_0x8878('0x35')];if(_0x3c4c54[_0x8878('0x33')][_0x8878('0x41')]){_0x583c24[_0x8878('0x42')]=[{'all':!![]}];}_0x583c24=_[_0x8878('0x3e')]({},_0x583c24,_0x3c4c54[_0x8878('0x40')]);return db[_0x8878('0x2d')][_0x8878('0x46')](_0x583c24)[_0x8878('0x25')](handleEntityNotFound(_0x23b050,null))[_0x8878('0x25')](respondWithResult(_0x23b050,null))['catch'](handleError(_0x23b050,null));};exports[_0x8878('0x47')]=function(_0x22e042,_0x10e390){return db['Interval'][_0x8878('0x47')](_0x22e042['body'],{})['then'](function(_0x31fcf4){var _0x3183a0=_0x22e042[_0x8878('0x48')][_0x8878('0x27')]({'plain':!![]});if(!_0x3183a0)throw new Error(_0x8878('0x49'));if(_0x3183a0[_0x8878('0x4a')]===_0x8878('0x48')){var _0x48993e=_0x31fcf4['get']({'plain':!![]});var _0x3d0a33=_0x8878('0x28');return db['UserProfileSection'][_0x8878('0x46')]({'where':{'name':_0x3d0a33,'userProfileId':_0x3183a0[_0x8878('0x4b')]},'raw':!![]})[_0x8878('0x25')](function(_0x501620){if(_0x501620&&_0x501620[_0x8878('0x4c')]===0x0){return db['UserProfileResource'][_0x8878('0x47')]({'name':_0x48993e['name'],'resourceId':_0x48993e['id'],'type':_0x501620[_0x8878('0x2c')],'sectionId':_0x501620['id']},{})['then'](function(){return _0x31fcf4;});}else{return _0x31fcf4;}})['catch'](function(_0x1aafa6){logger['error'](_0x8878('0x4d'),_0x1aafa6);throw _0x1aafa6;});}return _0x31fcf4;})[_0x8878('0x25')](respondWithResult(_0x10e390,0xc9))[_0x8878('0x44')](handleError(_0x10e390,null));};exports[_0x8878('0x24')]=function(_0x184104,_0x2d8b8d){if(_0x184104['body']['id']){delete _0x184104[_0x8878('0x4e')]['id'];}return db[_0x8878('0x2d')][_0x8878('0x46')]({'where':{'id':_0x184104[_0x8878('0x4f')]['id']}})[_0x8878('0x25')](handleEntityNotFound(_0x2d8b8d,null))[_0x8878('0x25')](saveUpdates(_0x184104[_0x8878('0x4e')],null))[_0x8878('0x25')](respondWithResult(_0x2d8b8d,null))[_0x8878('0x44')](handleError(_0x2d8b8d,null));};exports[_0x8878('0x26')]=function(_0x3b3ade,_0x674b77){return db[_0x8878('0x2d')][_0x8878('0x46')]({'where':{'id':_0x3b3ade[_0x8878('0x4f')]['id']}})['then'](handleEntityNotFound(_0x674b77,null))['then'](removeEntity(_0x674b77,null))[_0x8878('0x44')](handleError(_0x674b77,null));};exports[_0x8878('0x50')]=function(_0x4905a5,_0xd09b46,_0x529cfd){if(_0x4905a5[_0x8878('0x4e')]['id']){delete _0x4905a5[_0x8878('0x4e')]['id'];}return db[_0x8878('0x2d')][_0x8878('0x46')]({'where':{'id':_0x4905a5[_0x8878('0x4f')]['id']}})[_0x8878('0x25')](handleEntityNotFound(_0xd09b46,null))[_0x8878('0x25')](function(_0x2ec87d){if(_0x2ec87d){_0x4905a5[_0x8878('0x4e')][_0x8878('0x51')]=_0x2ec87d['id'];return db[_0x8878('0x2d')][_0x8878('0x47')](_0x4905a5[_0x8878('0x4e')]);}})['then'](respondWithResult(_0xd09b46,null))[_0x8878('0x44')](handleError(_0xd09b46,null));};exports[_0x8878('0x52')]=function(_0x56ea31,_0x488a09,_0x1a1f38){var _0x10aed6={};var _0x3f634b={};var _0xd2e1c1;var _0x2dbe4c;return db[_0x8878('0x2d')][_0x8878('0x53')]({'where':{'id':_0x56ea31['params']['id']}})[_0x8878('0x25')](handleEntityNotFound(_0x488a09,null))[_0x8878('0x25')](function(_0x1725f4){if(_0x1725f4){_0xd2e1c1=_0x1725f4;_0x3f634b[_0x8878('0x35')]=_[_0x8878('0x32')](db[_0x8878('0x2d')]['rawAttributes']);_0x3f634b[_0x8878('0x33')]=_[_0x8878('0x32')](_0x56ea31[_0x8878('0x33')]);_0x3f634b[_0x8878('0x34')]=_[_0x8878('0x37')](_0x3f634b[_0x8878('0x35')],_0x3f634b['query']);_0x10aed6[_0x8878('0x36')]=_['intersection'](_0x3f634b[_0x8878('0x35')],qs['fields'](_0x56ea31[_0x8878('0x33')]['fields']));_0x10aed6['attributes']=_0x10aed6['attributes']['length']?_0x10aed6[_0x8878('0x36')]:_0x3f634b[_0x8878('0x35')];_0x10aed6[_0x8878('0x3b')]=qs['sort'](_0x56ea31[_0x8878('0x33')][_0x8878('0x3c')]);_0x10aed6[_0x8878('0x3d')]=qs[_0x8878('0x34')](_[_0x8878('0x54')](_0x56ea31[_0x8878('0x33')],_0x3f634b[_0x8878('0x34')]));if(_0x56ea31['query'][_0x8878('0x55')]){_0x10aed6['where']=_[_0x8878('0x3e')](_0x10aed6[_0x8878('0x3d')],{'$or':_[_0x8878('0x31')](_0x10aed6[_0x8878('0x36')],function(_0x509a65){var _0x55db8e={};_0x55db8e[_0x509a65]={'$like':'%'+_0x56ea31['query'][_0x8878('0x55')]+'%'};return _0x55db8e;})});}_0x10aed6=_['merge']({},_0x10aed6,_0x56ea31[_0x8878('0x40')]);return _0xd2e1c1[_0x8878('0x52')](_0x10aed6);}})['then'](function(_0x47f2d2){if(_0x47f2d2){_0x2dbe4c=_0x47f2d2['length'];if(!_0x56ea31[_0x8878('0x33')][_0x8878('0x56')]('nolimit')){_0x10aed6[_0x8878('0x1d')]=qs[_0x8878('0x1d')](_0x56ea31[_0x8878('0x33')][_0x8878('0x1d')]);_0x10aed6[_0x8878('0x1b')]=qs[_0x8878('0x1b')](_0x56ea31[_0x8878('0x33')]['offset']);}return _0xd2e1c1['getIntervals'](_0x10aed6);}})[_0x8878('0x25')](function(_0xbff4e3){if(_0xbff4e3){return _0xbff4e3?{'count':_0x2dbe4c,'rows':_0xbff4e3}:null;}})[_0x8878('0x25')](respondWithResult(_0x488a09,null))[_0x8878('0x44')](handleError(_0x488a09,null));};exports['addIntervals']=function(_0x22d0ed,_0x21be6f,_0x481ba7){return db['Interval'][_0x8878('0x53')]({'where':{'id':_0x22d0ed[_0x8878('0x4f')]['id']}})[_0x8878('0x25')](handleEntityNotFound(_0x21be6f,null))[_0x8878('0x25')](function(_0x4a208f){if(_0x4a208f){return db[_0x8878('0x57')][_0x8878('0x58')](function(_0x4d558f){return db[_0x8878('0x2d')][_0x8878('0x26')]({'where':{'IntervalId':_0x22d0ed[_0x8878('0x4f')]['id']},'transaction':_0x4d558f})[_0x8878('0x25')](function(_0x501a9b){var _0xaf997d=_[_0x8878('0x31')](_0x22d0ed[_0x8878('0x4e')],function(_0x3f915b){delete _0x3f915b['id'];_0x3f915b['IntervalId']=_0x22d0ed[_0x8878('0x4f')]['id'];return _0x3f915b;});return db[_0x8878('0x2d')][_0x8878('0x59')](_0xaf997d,{'transaction':_0x4d558f});});})[_0x8878('0x25')](function(){return db[_0x8878('0x2d')][_0x8878('0x5a')]({'where':{'IntervalId':_0x22d0ed[_0x8878('0x4f')]['id']}});});}})[_0x8878('0x25')](respondWithResult(_0x21be6f,null))['catch'](handleError(_0x21be6f,null));}; \ No newline at end of file +var _0x6142=['then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','length','hasOwnProperty','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x427ed7,_0x28ac32){var _0x325239=function(_0x3e6d98){while(--_0x3e6d98){_0x427ed7['push'](_0x427ed7['shift']());}};_0x325239(++_0x28ac32);}(_0x6142,0x9b));var _0x2614=function(_0x8ce699,_0x24011c){_0x8ce699=_0x8ce699-0x0;var _0x2cc0be=_0x6142[_0x8ce699];return _0x2cc0be;};'use strict';var emlformat=require(_0x2614('0x0'));var rimraf=require(_0x2614('0x1'));var zipdir=require(_0x2614('0x2'));var jsonpatch=require(_0x2614('0x3'));var rp=require(_0x2614('0x4'));var moment=require(_0x2614('0x5'));var BPromise=require(_0x2614('0x6'));var Mustache=require(_0x2614('0x7'));var util=require(_0x2614('0x8'));var path=require('path');var sox=require(_0x2614('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2614('0xa'));var _=require(_0x2614('0xb'));var squel=require('squel');var crypto=require(_0x2614('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2614('0xd'));var toCsv=require(_0x2614('0xe'));var querystring=require(_0x2614('0xf'));var Papa=require(_0x2614('0x10'));var Redis=require(_0x2614('0x11'));var authService=require(_0x2614('0x12'));var qs=require(_0x2614('0x13'));var as=require(_0x2614('0x14'));var hardwareService=require(_0x2614('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2614('0x16'));var config=require(_0x2614('0x17'));var licenseUtil=require(_0x2614('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0x2614('0x19'));function respondWithStatusCode(_0x2674be,_0x3f8eae){_0x3f8eae=_0x3f8eae||0xcc;return function(_0x456615){if(_0x456615){return _0x2674be[_0x2614('0x1a')](_0x3f8eae);}return _0x2674be[_0x2614('0x1b')](_0x3f8eae)['end']();};}function respondWithResult(_0x48d2bc,_0x51dfc2){_0x51dfc2=_0x51dfc2||0xc8;return function(_0x4e8044){if(_0x4e8044){return _0x48d2bc['status'](_0x51dfc2)[_0x2614('0x1c')](_0x4e8044);}};}function respondWithFilteredResult(_0x51ca24,_0x3b0b47){return function(_0x4809d5){if(_0x4809d5){var _0x4eb2ef=typeof _0x3b0b47[_0x2614('0x1d')]===_0x2614('0x1e')&&typeof _0x3b0b47[_0x2614('0x1f')]===_0x2614('0x1e');var _0x1ff6c7=_0x4809d5['count'];var _0x50ad0c=_0x4eb2ef?0x0:_0x3b0b47[_0x2614('0x1d')];var _0x583c7c=_0x4eb2ef?_0x4809d5[_0x2614('0x20')]:_0x3b0b47[_0x2614('0x1d')]+_0x3b0b47['limit'];var _0x5b60ca;if(_0x583c7c>=_0x1ff6c7){_0x583c7c=_0x1ff6c7;_0x5b60ca=0xc8;}else{_0x5b60ca=0xce;}_0x51ca24[_0x2614('0x1b')](_0x5b60ca);return _0x51ca24[_0x2614('0x21')]('Content-Range',_0x50ad0c+'-'+_0x583c7c+'/'+_0x1ff6c7)['json'](_0x4809d5);}return null;};}function patchUpdates(_0x42ed53){return function(_0x2e6fe5){try{jsonpatch[_0x2614('0x22')](_0x2e6fe5,_0x42ed53,!![]);}catch(_0x31e60d){return BPromise[_0x2614('0x23')](_0x31e60d);}return _0x2e6fe5[_0x2614('0x24')]();};}function saveUpdates(_0x3987e2,_0x279014){return function(_0x226e54){if(_0x226e54){return _0x226e54['update'](_0x3987e2)[_0x2614('0x25')](function(_0x4e4659){return _0x4e4659;});}return null;};}function removeEntity(_0x1fa25f,_0x50a2dd){return function(_0x1d72e1){if(_0x1d72e1){return _0x1d72e1[_0x2614('0x26')]()[_0x2614('0x25')](function(){var _0x207c29=_0x1d72e1[_0x2614('0x27')]({'plain':!![]});var _0x146609=_0x2614('0x28');return db[_0x2614('0x29')]['destroy']({'where':{'type':_0x146609,'resourceId':_0x207c29['id']}})[_0x2614('0x25')](function(){return _0x1d72e1;});})[_0x2614('0x25')](function(){_0x1fa25f[_0x2614('0x1b')](0xcc)[_0x2614('0x2a')]();});}};}function handleEntityNotFound(_0x1dbbc2,_0x52f10b){return function(_0x1900bc){if(!_0x1900bc){_0x1dbbc2[_0x2614('0x1a')](0x194);}return _0x1900bc;};}function handleError(_0x54320b,_0x208fa7){_0x208fa7=_0x208fa7||0x1f4;return function(_0x1396e8){logger[_0x2614('0x2b')](_0x1396e8[_0x2614('0x2c')]);if(_0x1396e8[_0x2614('0x2d')]){delete _0x1396e8[_0x2614('0x2d')];}_0x54320b['status'](_0x208fa7)[_0x2614('0x2e')](_0x1396e8);};}exports[_0x2614('0x2f')]=function(_0x489a5f,_0x59b355){var _0x2cf6d8={},_0x2277aa={},_0x3975e2={'count':0x0,'rows':[]};var _0x461f92=_[_0x2614('0x30')](db[_0x2614('0x31')][_0x2614('0x32')],function(_0xc6afee){return{'name':_0xc6afee[_0x2614('0x33')],'type':_0xc6afee[_0x2614('0x34')][_0x2614('0x35')]};});_0x2277aa[_0x2614('0x36')]=_[_0x2614('0x30')](_0x461f92,_0x2614('0x2d'));_0x2277aa[_0x2614('0x37')]=_[_0x2614('0x38')](_0x489a5f['query']);_0x2277aa[_0x2614('0x39')]=_[_0x2614('0x3a')](_0x2277aa[_0x2614('0x36')],_0x2277aa[_0x2614('0x37')]);_0x2cf6d8[_0x2614('0x3b')]=_[_0x2614('0x3a')](_0x2277aa['model'],qs[_0x2614('0x3c')](_0x489a5f[_0x2614('0x37')]['fields']));_0x2cf6d8[_0x2614('0x3b')]=_0x2cf6d8[_0x2614('0x3b')]['length']?_0x2cf6d8[_0x2614('0x3b')]:_0x2277aa[_0x2614('0x36')];if(!_0x489a5f[_0x2614('0x37')]['hasOwnProperty'](_0x2614('0x3d'))){_0x2cf6d8[_0x2614('0x1f')]=qs[_0x2614('0x1f')](_0x489a5f[_0x2614('0x37')][_0x2614('0x1f')]);_0x2cf6d8[_0x2614('0x1d')]=qs[_0x2614('0x1d')](_0x489a5f[_0x2614('0x37')][_0x2614('0x1d')]);}_0x2cf6d8[_0x2614('0x3e')]=qs[_0x2614('0x3f')](_0x489a5f[_0x2614('0x37')][_0x2614('0x3f')]);_0x2cf6d8['where']=qs[_0x2614('0x39')](_[_0x2614('0x40')](_0x489a5f['query'],_0x2277aa[_0x2614('0x39')]),_0x461f92);if(_0x489a5f['query'][_0x2614('0x41')]){_0x2cf6d8[_0x2614('0x42')]=_[_0x2614('0x43')](_0x2cf6d8[_0x2614('0x42')],{'$or':_[_0x2614('0x30')](_0x461f92,function(_0x4713aa){if(_0x4713aa[_0x2614('0x34')]!==_0x2614('0x44')){var _0x527815={};_0x527815[_0x4713aa[_0x2614('0x2d')]]={'$like':'%'+_0x489a5f['query'][_0x2614('0x41')]+'%'};return _0x527815;}})});}_0x2cf6d8=_[_0x2614('0x43')]({},_0x2cf6d8,_0x489a5f[_0x2614('0x45')]);var _0x321177={'where':_0x2cf6d8[_0x2614('0x42')]};return db['Interval'][_0x2614('0x20')](_0x321177)[_0x2614('0x25')](function(_0x2341e4){_0x3975e2[_0x2614('0x20')]=_0x2341e4;if(_0x489a5f[_0x2614('0x37')][_0x2614('0x46')]){_0x2cf6d8[_0x2614('0x47')]=[{'all':!![]}];}return db[_0x2614('0x31')][_0x2614('0x48')](_0x2cf6d8);})[_0x2614('0x25')](function(_0x41f513){_0x3975e2['rows']=_0x41f513;return _0x3975e2;})[_0x2614('0x25')](respondWithFilteredResult(_0x59b355,_0x2cf6d8))['catch'](handleError(_0x59b355,null));};exports[_0x2614('0x49')]=function(_0x129d73,_0x54dc30){var _0x18d085={'raw':!![],'where':{'id':_0x129d73['params']['id']}},_0x45f936={};_0x45f936[_0x2614('0x36')]=_['keys'](db[_0x2614('0x31')]['rawAttributes']);_0x45f936[_0x2614('0x37')]=_['keys'](_0x129d73['query']);_0x45f936[_0x2614('0x39')]=_[_0x2614('0x3a')](_0x45f936[_0x2614('0x36')],_0x45f936[_0x2614('0x37')]);_0x18d085[_0x2614('0x3b')]=_[_0x2614('0x3a')](_0x45f936['model'],qs[_0x2614('0x3c')](_0x129d73['query'][_0x2614('0x3c')]));_0x18d085[_0x2614('0x3b')]=_0x18d085[_0x2614('0x3b')]['length']?_0x18d085[_0x2614('0x3b')]:_0x45f936[_0x2614('0x36')];if(_0x129d73[_0x2614('0x37')][_0x2614('0x46')]){_0x18d085[_0x2614('0x47')]=[{'all':!![]}];}_0x18d085=_[_0x2614('0x43')]({},_0x18d085,_0x129d73['options']);return db[_0x2614('0x31')]['find'](_0x18d085)[_0x2614('0x25')](handleEntityNotFound(_0x54dc30,null))['then'](respondWithResult(_0x54dc30,null))[_0x2614('0x4a')](handleError(_0x54dc30,null));};exports[_0x2614('0x4b')]=function(_0x325e97,_0x501e4f){return db['Interval'][_0x2614('0x4b')](_0x325e97[_0x2614('0x4c')],{})['then'](function(_0x21e146){var _0x592e8a=_0x325e97[_0x2614('0x4d')][_0x2614('0x27')]({'plain':!![]});if(!_0x592e8a)throw new Error(_0x2614('0x4e'));if(_0x592e8a[_0x2614('0x4f')]===_0x2614('0x4d')){var _0x653218=_0x21e146[_0x2614('0x27')]({'plain':!![]});var _0x5aa550=_0x2614('0x28');return db[_0x2614('0x50')][_0x2614('0x51')]({'where':{'name':_0x5aa550,'userProfileId':_0x592e8a['userProfileId']},'raw':!![]})['then'](function(_0x236856){if(_0x236856&&_0x236856[_0x2614('0x52')]===0x0){return db['UserProfileResource'][_0x2614('0x4b')]({'name':_0x653218[_0x2614('0x2d')],'resourceId':_0x653218['id'],'type':_0x236856[_0x2614('0x2d')],'sectionId':_0x236856['id']},{})[_0x2614('0x25')](function(){return _0x21e146;});}else{return _0x21e146;}})[_0x2614('0x4a')](function(_0x397a5a){logger[_0x2614('0x2b')](_0x2614('0x53'),_0x397a5a);throw _0x397a5a;});}return _0x21e146;})[_0x2614('0x25')](respondWithResult(_0x501e4f,0xc9))['catch'](handleError(_0x501e4f,null));};exports[_0x2614('0x54')]=function(_0x50ebcb,_0x343cb7){if(_0x50ebcb[_0x2614('0x4c')]['id']){delete _0x50ebcb['body']['id'];}return db[_0x2614('0x31')][_0x2614('0x51')]({'where':{'id':_0x50ebcb[_0x2614('0x55')]['id']}})[_0x2614('0x25')](handleEntityNotFound(_0x343cb7,null))['then'](saveUpdates(_0x50ebcb[_0x2614('0x4c')],null))[_0x2614('0x25')](respondWithResult(_0x343cb7,null))['catch'](handleError(_0x343cb7,null));};exports[_0x2614('0x26')]=function(_0x22fa0e,_0x3062da){return db['Interval'][_0x2614('0x51')]({'where':{'id':_0x22fa0e['params']['id']}})['then'](handleEntityNotFound(_0x3062da,null))['then'](removeEntity(_0x3062da,null))[_0x2614('0x4a')](handleError(_0x3062da,null));};exports[_0x2614('0x56')]=function(_0x433b7a,_0xa9823b,_0x45f8ee){if(_0x433b7a[_0x2614('0x4c')]['id']){delete _0x433b7a[_0x2614('0x4c')]['id'];}return db[_0x2614('0x31')][_0x2614('0x51')]({'where':{'id':_0x433b7a[_0x2614('0x55')]['id']}})['then'](handleEntityNotFound(_0xa9823b,null))['then'](function(_0x55cbc3){if(_0x55cbc3){_0x433b7a[_0x2614('0x4c')][_0x2614('0x57')]=_0x55cbc3['id'];return db[_0x2614('0x31')][_0x2614('0x4b')](_0x433b7a[_0x2614('0x4c')]);}})[_0x2614('0x25')](respondWithResult(_0xa9823b,null))[_0x2614('0x4a')](handleError(_0xa9823b,null));};exports[_0x2614('0x58')]=function(_0x1c2874,_0x2204ac,_0xade496){var _0x540969={};var _0x559e76={};var _0x1e175;var _0x3dc45a;return db[_0x2614('0x31')][_0x2614('0x59')]({'where':{'id':_0x1c2874[_0x2614('0x55')]['id']}})[_0x2614('0x25')](handleEntityNotFound(_0x2204ac,null))[_0x2614('0x25')](function(_0x12bd3c){if(_0x12bd3c){_0x1e175=_0x12bd3c;_0x559e76[_0x2614('0x36')]=_['keys'](db['Interval'][_0x2614('0x32')]);_0x559e76[_0x2614('0x37')]=_['keys'](_0x1c2874[_0x2614('0x37')]);_0x559e76[_0x2614('0x39')]=_[_0x2614('0x3a')](_0x559e76['model'],_0x559e76[_0x2614('0x37')]);_0x540969[_0x2614('0x3b')]=_['intersection'](_0x559e76['model'],qs[_0x2614('0x3c')](_0x1c2874[_0x2614('0x37')][_0x2614('0x3c')]));_0x540969[_0x2614('0x3b')]=_0x540969[_0x2614('0x3b')][_0x2614('0x5a')]?_0x540969[_0x2614('0x3b')]:_0x559e76['model'];_0x540969[_0x2614('0x3e')]=qs[_0x2614('0x3f')](_0x1c2874['query'][_0x2614('0x3f')]);_0x540969[_0x2614('0x42')]=qs[_0x2614('0x39')](_[_0x2614('0x40')](_0x1c2874['query'],_0x559e76['filters']));if(_0x1c2874['query'][_0x2614('0x41')]){_0x540969[_0x2614('0x42')]=_[_0x2614('0x43')](_0x540969[_0x2614('0x42')],{'$or':_[_0x2614('0x30')](_0x540969[_0x2614('0x3b')],function(_0xd0e2a2){var _0xa15def={};_0xa15def[_0xd0e2a2]={'$like':'%'+_0x1c2874[_0x2614('0x37')][_0x2614('0x41')]+'%'};return _0xa15def;})});}_0x540969=_[_0x2614('0x43')]({},_0x540969,_0x1c2874[_0x2614('0x45')]);return _0x1e175[_0x2614('0x58')](_0x540969);}})[_0x2614('0x25')](function(_0x256259){if(_0x256259){_0x3dc45a=_0x256259[_0x2614('0x5a')];if(!_0x1c2874['query'][_0x2614('0x5b')](_0x2614('0x3d'))){_0x540969[_0x2614('0x1f')]=qs[_0x2614('0x1f')](_0x1c2874[_0x2614('0x37')][_0x2614('0x1f')]);_0x540969['offset']=qs[_0x2614('0x1d')](_0x1c2874[_0x2614('0x37')][_0x2614('0x1d')]);}return _0x1e175['getIntervals'](_0x540969);}})['then'](function(_0x2e1950){if(_0x2e1950){return _0x2e1950?{'count':_0x3dc45a,'rows':_0x2e1950}:null;}})[_0x2614('0x25')](respondWithResult(_0x2204ac,null))['catch'](handleError(_0x2204ac,null));};exports[_0x2614('0x5c')]=function(_0x417dd6,_0x1597ce,_0x1df72d){return db[_0x2614('0x31')][_0x2614('0x59')]({'where':{'id':_0x417dd6[_0x2614('0x55')]['id']}})[_0x2614('0x25')](handleEntityNotFound(_0x1597ce,null))[_0x2614('0x25')](function(_0x635378){if(_0x635378){return db[_0x2614('0x5d')][_0x2614('0x5e')](function(_0x14a0ad){return db['Interval']['destroy']({'where':{'IntervalId':_0x417dd6[_0x2614('0x55')]['id']},'transaction':_0x14a0ad})[_0x2614('0x25')](function(_0xc03c48){var _0x42b0f8=_[_0x2614('0x30')](_0x417dd6[_0x2614('0x4c')],function(_0x919e70){delete _0x919e70['id'];_0x919e70[_0x2614('0x57')]=_0x417dd6['params']['id'];return _0x919e70;});return db['Interval'][_0x2614('0x5f')](_0x42b0f8,{'transaction':_0x14a0ad});});})[_0x2614('0x25')](function(){return db['Interval'][_0x2614('0x48')]({'where':{'IntervalId':_0x417dd6[_0x2614('0x55')]['id']}});});}})[_0x2614('0x25')](respondWithResult(_0x1597ce,null))['catch'](handleError(_0x1597ce,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 652d414..c93f998 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 _0xbd33=['Interval','tools_intervals','rewrite','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define'];(function(_0x112377,_0x5b22d9){var _0x424918=function(_0x28d282){while(--_0x28d282){_0x112377['push'](_0x112377['shift']());}};_0x424918(++_0x5b22d9);}(_0xbd33,0x155));var _0x3bd3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd33[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3bd3('0x0'));var util=require('util');var logger=require(_0x3bd3('0x1'))('api');var moment=require(_0x3bd3('0x2'));var BPromise=require(_0x3bd3('0x3'));var rp=require(_0x3bd3('0x4'));var fs=require('fs');var path=require(_0x3bd3('0x5'));var rimraf=require('rimraf');var config=require(_0x3bd3('0x6'));var attributes=require(_0x3bd3('0x7'));var extensions=require(_0x3bd3('0x8'));module['exports']=function(_0x47d924,_0x154da8){return _0x47d924[_0x3bd3('0x9')](_0x3bd3('0xa'),attributes,{'tableName':_0x3bd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5dee57,_0x307a5b){extensions['rewrite'](_0x47d924,_0x5dee57);},'afterBulkCreate':function(_0x252481,_0x3875ef,_0x7ef803){_0x7ef803();extensions[_0x3bd3('0xc')](_0x47d924,_0x252481[0x0]);},'afterUpdate':function(_0x22fc3c,_0x1a9f54){extensions[_0x3bd3('0xc')](_0x47d924,_0x22fc3c);},'afterDestroy':function(_0xa4adde,_0x10ed59){extensions[_0x3bd3('0xc')](_0x47d924,_0xa4adde);}}});}; \ No newline at end of file +var _0xb3bf=['moment','bluebird','request-promise','../../config/environment','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','api'];(function(_0x313dc9,_0x21a4fd){var _0x3d9584=function(_0x2ee599){while(--_0x2ee599){_0x313dc9['push'](_0x313dc9['shift']());}};_0x3d9584(++_0x21a4fd);}(_0xb3bf,0x1b7));var _0xfb3b=function(_0x315ec9,_0x10303){_0x315ec9=_0x315ec9-0x0;var _0x12ee99=_0xb3bf[_0x315ec9];return _0x12ee99;};'use strict';var _=require('lodash');var util=require(_0xfb3b('0x0'));var logger=require(_0xfb3b('0x1'))(_0xfb3b('0x2'));var moment=require(_0xfb3b('0x3'));var BPromise=require(_0xfb3b('0x4'));var rp=require(_0xfb3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb3b('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0xfb3b('0x7'));module[_0xfb3b('0x8')]=function(_0x4a0e9f,_0x3af086){return _0x4a0e9f[_0xfb3b('0x9')](_0xfb3b('0xa'),attributes,{'tableName':_0xfb3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1765ac,_0x3c1136){extensions[_0xfb3b('0xc')](_0x4a0e9f,_0x1765ac);},'afterBulkCreate':function(_0x55aa9a,_0x14f839,_0x2fff57){_0x2fff57();extensions[_0xfb3b('0xc')](_0x4a0e9f,_0x55aa9a[0x0]);},'afterUpdate':function(_0x52aa8d,_0x56cb7d){extensions['rewrite'](_0x4a0e9f,_0x52aa8d);},'afterDestroy':function(_0x4d7572,_0x4f7728){extensions[_0xfb3b('0xc')](_0x4a0e9f,_0x4d7572);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index f350cb7..59d36f7 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 9527b81..765c9df 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(_0x508afb,_0x5ae8fc){var _0x2b9550=function(_0x2b67f6){while(--_0x2b67f6){_0x508afb['push'](_0x508afb['shift']());}};_0x2b9550(++_0x5ae8fc);}(_0xadb5,0xad));var _0x5adb=function(_0x5abb71,_0x50d5bd){_0x5abb71=_0x5abb71-0x0;var _0x56d873=_0xadb5[_0x5abb71];return _0x56d873;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x477cf4,_0x4e8a89){var _0x555ecf=function(_0x160afb){while(--_0x160afb){_0x477cf4['push'](_0x477cf4['shift']());}};_0x555ecf(++_0x4e8a89);}(_0xdb28,0x106));var _0x8db2=function(_0x2aa686,_0x3d71bf){_0x2aa686=_0x2aa686-0x0;var _0x31aac3=_0xdb28[_0x2aa686];return _0x31aac3;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 152858e..a0a3f22 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 _0x6324=['name','customfield_11504','reason','track.xcallymotion.com','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','end','statusCode','json','parse','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','Report','description','stringify','Bug','email','fields','customfield_11501','oldToken','customfield_11502'];(function(_0x5ae794,_0x36def7){var _0x26b363=function(_0x1b8395){while(--_0x1b8395){_0x5ae794['push'](_0x5ae794['shift']());}};_0x26b363(++_0x36def7);}(_0x6324,0x10f));var _0x4632=function(_0x20e1fd,_0x506bf0){_0x20e1fd=_0x20e1fd-0x0;var _0x3be635=_0x6324[_0x20e1fd];return _0x3be635;};'use strict';var BPromise=require(_0x4632('0x0'));var https=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var USERNAME=_0x4632('0x4');var PASSWORD=_0x4632('0x5');function openIssue(_0x2827e6,_0x1bcd3c){var _0xb017ef={'fields':{'project':{'key':_0x2827e6['key']||_0x4632('0x6')},'summary':(_0x2827e6['summary']||_0x4632('0x7'))+'\x20from\x20'+_0x2827e6['ip'],'description':_0x2827e6[_0x4632('0x8')]||JSON[_0x4632('0x9')](_0x2827e6),'issuetype':{'name':_0x2827e6['issuetype']||_0x4632('0xa')}}};_0xb017ef['fields']['customfield_11500']=_0x2827e6[_0x4632('0xb')];_0xb017ef[_0x4632('0xc')][_0x4632('0xd')]=_0x2827e6[_0x4632('0xe')];_0xb017ef[_0x4632('0xc')][_0x4632('0xf')]=_0x2827e6['newToken'];_0xb017ef['fields']['customfield_11503']=_0x2827e6[_0x4632('0x10')];_0xb017ef[_0x4632('0xc')][_0x4632('0x11')]=_0x2827e6[_0x4632('0x12')];_0xb017ef[_0x4632('0xc')]['customfield_10102']=_0x2827e6['ip'];var _0x25c860={'host':_0x4632('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x4632('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x4632('0x15'),'Authorization':_0x4632('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x4632('0x17')]('base64')}};var _0x2e7548=JSON[_0x4632('0x9')](_0xb017ef);var _0x143e7e=https[_0x4632('0x18')](_0x25c860,function(_0x2de2ff){_0x2de2ff[_0x4632('0x19')](_0x4632('0x1a'));var _0x1423d0='';_0x2de2ff['on']('data',function(_0x5bb91a){_0x1423d0+=_0x5bb91a;});_0x2de2ff['on'](_0x4632('0x1b'),function(){if(_0x1bcd3c){return _0x1bcd3c['status'](_0x2de2ff[_0x4632('0x1c')])[_0x4632('0x1d')](JSON[_0x4632('0x1e')](_0x1423d0));}});});_0x143e7e['on']('error',function(_0x169029){if(_0x1bcd3c){return _0x1bcd3c[_0x4632('0x1f')](0x1f4)[_0x4632('0x1d')]({'errors':[{'message':_0x4632('0x20'),'type':'api.jira'}]});}});_0x143e7e[_0x4632('0x21')](_0x2e7548);_0x143e7e[_0x4632('0x1b')]();}exports[_0x4632('0x22')]=openIssue;exports[_0x4632('0x23')]=function(_0xbd54c7,_0x5847cf){_0xbd54c7[_0x4632('0x24')]['ip']=_0xbd54c7['headers'][_0x4632('0x25')]||_0xbd54c7[_0x4632('0x26')]['remoteAddress']||_0xbd54c7['socket'][_0x4632('0x27')]||_0xbd54c7[_0x4632('0x26')][_0x4632('0x28')][_0x4632('0x27')];return openIssue(_0xbd54c7['body'],_0x5847cf);}; \ No newline at end of file +var _0xefff=['socket','bluebird','https','../../config/logger','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','oldToken','customfield_11502','newToken','fields','name','reason','customfield_10102','POST','Basic\x20','base64','request','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','connection','remoteAddress'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xefff,0x9d));var _0xfeff=function(_0x4a6bd8,_0x3fd9ce){_0x4a6bd8=_0x4a6bd8-0x0;var _0x55d8d9=_0xefff[_0x4a6bd8];return _0x55d8d9;};'use strict';var BPromise=require(_0xfeff('0x0'));var https=require(_0xfeff('0x1'));var logger=require(_0xfeff('0x2'))('api');var USERNAME='support';var PASSWORD=_0xfeff('0x3');function openIssue(_0x296530,_0x49379f){var _0x29a76b={'fields':{'project':{'key':_0x296530['key']||_0xfeff('0x4')},'summary':(_0x296530[_0xfeff('0x5')]||'Report')+_0xfeff('0x6')+_0x296530['ip'],'description':_0x296530[_0xfeff('0x7')]||JSON[_0xfeff('0x8')](_0x296530),'issuetype':{'name':_0x296530[_0xfeff('0x9')]||'Bug'}}};_0x29a76b['fields']['customfield_11500']=_0x296530['email'];_0x29a76b['fields']['customfield_11501']=_0x296530[_0xfeff('0xa')];_0x29a76b['fields'][_0xfeff('0xb')]=_0x296530[_0xfeff('0xc')];_0x29a76b[_0xfeff('0xd')]['customfield_11503']=_0x296530[_0xfeff('0xe')];_0x29a76b[_0xfeff('0xd')]['customfield_11504']=_0x296530[_0xfeff('0xf')];_0x29a76b['fields'][_0xfeff('0x10')]=_0x296530['ip'];var _0x500be7={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xfeff('0x11'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xfeff('0x12')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xfeff('0x13'))}};var _0x485a5c=JSON[_0xfeff('0x8')](_0x29a76b);var _0x490a5b=https[_0xfeff('0x14')](_0x500be7,function(_0x2f01db){_0x2f01db['setEncoding'](_0xfeff('0x15'));var _0xaa90b5='';_0x2f01db['on'](_0xfeff('0x16'),function(_0x4df294){_0xaa90b5+=_0x4df294;});_0x2f01db['on'](_0xfeff('0x17'),function(){if(_0x49379f){return _0x49379f[_0xfeff('0x18')](_0x2f01db[_0xfeff('0x19')])[_0xfeff('0x1a')](JSON[_0xfeff('0x1b')](_0xaa90b5));}});});_0x490a5b['on'](_0xfeff('0x1c'),function(_0xf8fdf9){if(_0x49379f){return _0x49379f[_0xfeff('0x18')](0x1f4)['json']({'errors':[{'message':_0xfeff('0x1d'),'type':_0xfeff('0x1e')}]});}});_0x490a5b[_0xfeff('0x1f')](_0x485a5c);_0x490a5b['end']();}exports[_0xfeff('0x20')]=openIssue;exports[_0xfeff('0x21')]=function(_0x57f13f,_0xa2952f){_0x57f13f[_0xfeff('0x22')]['ip']=_0x57f13f[_0xfeff('0x23')]['x-forwarded-for']||_0x57f13f[_0xfeff('0x24')][_0xfeff('0x25')]||_0x57f13f[_0xfeff('0x26')][_0xfeff('0x25')]||_0x57f13f[_0xfeff('0x24')][_0xfeff('0x26')][_0xfeff('0x25')];return openIssue(_0x57f13f[_0xfeff('0x22')],_0xa2952f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 875334d..6024e71 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 _0x22fb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x384fbc,_0x11696f){var _0x2b7827=function(_0x33ee67){while(--_0x33ee67){_0x384fbc['push'](_0x384fbc['shift']());}};_0x2b7827(++_0x11696f);}(_0x22fb,0x192));var _0xb22f=function(_0x39b03c,_0x15be11){_0x39b03c=_0x39b03c-0x0;var _0x58d778=_0x22fb[_0x39b03c];return _0x58d778;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x702d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x702d,0x147));var _0xd702=function(_0x356258,_0x2dc3b8){_0x356258=_0x356258-0x0;var _0x29a795=_0x702d[_0x356258];return _0x29a795;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')]('/',auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0x13')]);router['delete']('/:id',auth[_0xd702('0xe')](),controller[_0xd702('0x14')]);module[_0xd702('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b4c149e..7039178 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x2450d9,_0x309495){_0x2450d9=_0x2450d9-0x0;var _0x35e91f=_0x7a54[_0x2450d9];return _0x35e91f;};'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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x6e893f,_0x3f8930){_0x6e893f=_0x6e893f-0x0;var _0x111392=_0x7a54[_0x6e893f];return _0x111392;};'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 b17728c..d812730 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 _0xf2ca=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x25f5b8,_0x2d8313){var _0x364bdc=function(_0x4b2038){while(--_0x4b2038){_0x25f5b8['push'](_0x25f5b8['shift']());}};_0x364bdc(++_0x2d8313);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1b964a,_0x40fdc2){_0x1b964a=_0x1b964a-0x0;var _0x2559fa=_0xf2ca[_0x1b964a];return _0x2559fa;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x3c1ae6,_0xe929b5){return function(_0xff396f){if(!_0xff396f){_0x3c1ae6[_0xaf2c('0x18')](0x194);}return _0xff396f;};}function handleError(_0x4a8dd8,_0x29f8b0){_0x29f8b0=_0x29f8b0||0x1f4;return function(_0x2051be){logger[_0xaf2c('0x24')](_0x2051be[_0xaf2c('0x25')]);if(_0x2051be['name']){delete _0x2051be[_0xaf2c('0x26')];}_0x4a8dd8['status'](_0x29f8b0)[_0xaf2c('0x27')](_0x2051be);};}exports[_0xaf2c('0x28')]=function(_0x15466b,_0x5d685a){var _0x2747bb={},_0x2ea490={},_0x3baee2={'count':0x0,'rows':[]};var _0x4a96d2=_[_0xaf2c('0x29')](db[_0xaf2c('0x2a')][_0xaf2c('0x2b')],function(_0x19364e){return{'name':_0x19364e['fieldName'],'type':_0x19364e[_0xaf2c('0x2c')][_0xaf2c('0x2d')]};});_0x2ea490[_0xaf2c('0x2e')]=_['map'](_0x4a96d2,'name');_0x2ea490[_0xaf2c('0x2f')]=_['keys'](_0x15466b[_0xaf2c('0x2f')]);_0x2ea490['filters']=_[_0xaf2c('0x30')](_0x2ea490[_0xaf2c('0x2e')],_0x2ea490['query']);_0x2747bb[_0xaf2c('0x31')]=_[_0xaf2c('0x30')](_0x2ea490['model'],qs[_0xaf2c('0x32')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x2747bb[_0xaf2c('0x31')]=_0x2747bb[_0xaf2c('0x31')][_0xaf2c('0x33')]?_0x2747bb['attributes']:_0x2ea490[_0xaf2c('0x2e')];if(!_0x15466b['query'][_0xaf2c('0x34')]('nolimit')){_0x2747bb[_0xaf2c('0x1e')]=qs['limit'](_0x15466b[_0xaf2c('0x2f')]['limit']);_0x2747bb[_0xaf2c('0x1c')]=qs['offset'](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x1c')]);}_0x2747bb[_0xaf2c('0x35')]=qs[_0xaf2c('0x36')](_0x15466b[_0xaf2c('0x2f')]['sort']);_0x2747bb['where']=qs[_0xaf2c('0x37')](_[_0xaf2c('0x38')](_0x15466b[_0xaf2c('0x2f')],_0x2ea490[_0xaf2c('0x37')]),_0x4a96d2);if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x39')]){_0x2747bb['where']=_[_0xaf2c('0x3a')](_0x2747bb[_0xaf2c('0x3b')],{'$or':_['map'](_0x4a96d2,function(_0x36081a){if(_0x36081a[_0xaf2c('0x2c')]!==_0xaf2c('0x3c')){var _0x71c597={};_0x71c597[_0x36081a[_0xaf2c('0x26')]]={'$like':'%'+_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x39')]+'%'};return _0x71c597;}})});}_0x2747bb=_[_0xaf2c('0x3a')]({},_0x2747bb,_0x15466b[_0xaf2c('0x3d')]);var _0x106eb9={'where':_0x2747bb[_0xaf2c('0x3b')]};return db[_0xaf2c('0x2a')][_0xaf2c('0x3e')](_0x106eb9)['then'](function(_0x54a953){_0x3baee2['count']=_0x54a953;if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3f')]){_0x2747bb[_0xaf2c('0x40')]=[{'all':!![]}];}return db[_0xaf2c('0x2a')][_0xaf2c('0x41')](_0x2747bb);})[_0xaf2c('0x23')](function(_0x51c441){_0x3baee2[_0xaf2c('0x42')]=_0x51c441;return _0x3baee2;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x5d685a,_0x2747bb))[_0xaf2c('0x43')](handleError(_0x5d685a,null));};exports['show']=function(_0x493266,_0x4ac61a){var _0x4f8440={'raw':!![],'where':{'id':_0x493266[_0xaf2c('0x44')]['id']}},_0x181787={};_0x181787[_0xaf2c('0x2e')]=_[_0xaf2c('0x45')](db['JscriptyAnswerReport'][_0xaf2c('0x2b')]);_0x181787['query']=_[_0xaf2c('0x45')](_0x493266[_0xaf2c('0x2f')]);_0x181787['filters']=_[_0xaf2c('0x30')](_0x181787['model'],_0x181787[_0xaf2c('0x2f')]);_0x4f8440[_0xaf2c('0x31')]=_[_0xaf2c('0x30')](_0x181787[_0xaf2c('0x2e')],qs[_0xaf2c('0x32')](_0x493266[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x4f8440[_0xaf2c('0x31')]=_0x4f8440[_0xaf2c('0x31')]['length']?_0x4f8440['attributes']:_0x181787[_0xaf2c('0x2e')];if(_0x493266['query']['includeAll']){_0x4f8440['include']=[{'all':!![]}];}_0x4f8440=_[_0xaf2c('0x3a')]({},_0x4f8440,_0x493266[_0xaf2c('0x3d')]);return db[_0xaf2c('0x2a')][_0xaf2c('0x46')](_0x4f8440)['then'](handleEntityNotFound(_0x4ac61a,null))[_0xaf2c('0x23')](respondWithResult(_0x4ac61a,null))['catch'](handleError(_0x4ac61a,null));};exports[_0xaf2c('0x47')]=function(_0x5ae138,_0x166c26){return db[_0xaf2c('0x2a')][_0xaf2c('0x47')](_0x5ae138[_0xaf2c('0x48')],{})[_0xaf2c('0x23')](respondWithResult(_0x166c26,0xc9))['catch'](handleError(_0x166c26,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){if(_0x26afee['body']['id']){delete _0x26afee[_0xaf2c('0x48')]['id'];}return db['JscriptyAnswerReport'][_0xaf2c('0x46')]({'where':{'id':_0x26afee[_0xaf2c('0x44')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x4b3ca4,null))[_0xaf2c('0x23')](saveUpdates(_0x26afee[_0xaf2c('0x48')],null))[_0xaf2c('0x23')](respondWithResult(_0x4b3ca4,null))[_0xaf2c('0x43')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x4a')]=function(_0x31ccfe,_0x1e72b0){return db[_0xaf2c('0x2a')]['find']({'where':{'id':_0x31ccfe[_0xaf2c('0x44')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x1e72b0,null))['then'](removeEntity(_0x1e72b0,null))['catch'](handleError(_0x1e72b0,null));};exports['describe']=function(_0x7ddca0,_0x1f6907){return db['JscriptyAnswerReport'][_0xaf2c('0x4b')]()[_0xaf2c('0x23')](respondWithResult(_0x1f6907,null))[_0xaf2c('0x43')](handleError(_0x1f6907,null));}; \ No newline at end of file +var _0x91c6=['length','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0x91c6,0xf9));var _0x691c=function(_0x87e66b,_0x4c54eb){_0x87e66b=_0x87e66b-0x0;var _0x1fc892=_0x91c6[_0x87e66b];return _0x1fc892;};'use strict';var emlformat=require(_0x691c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x691c('0x1'));var rp=require(_0x691c('0x2'));var moment=require(_0x691c('0x3'));var BPromise=require(_0x691c('0x4'));var Mustache=require(_0x691c('0x5'));var util=require('util');var path=require(_0x691c('0x6'));var sox=require(_0x691c('0x7'));var csv=require(_0x691c('0x8'));var ejs=require(_0x691c('0x9'));var fs=require('fs');var fs_extra=require(_0x691c('0xa'));var _=require(_0x691c('0xb'));var squel=require('squel');var crypto=require(_0x691c('0xc'));var jsforce=require(_0x691c('0xd'));var deskjs=require(_0x691c('0xe'));var toCsv=require(_0x691c('0x8'));var querystring=require('querystring');var Papa=require(_0x691c('0xf'));var Redis=require(_0x691c('0x10'));var authService=require(_0x691c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x691c('0x12'))(_0x691c('0x13'));var utils=require(_0x691c('0x14'));var config=require(_0x691c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b69f5,_0x246a67){_0x246a67=_0x246a67||0xcc;return function(_0x20fd87){if(_0x20fd87){return _0x2b69f5[_0x691c('0x16')](_0x246a67);}return _0x2b69f5[_0x691c('0x17')](_0x246a67)[_0x691c('0x18')]();};}function respondWithResult(_0x337b64,_0x2678e7){_0x2678e7=_0x2678e7||0xc8;return function(_0x5416e4){if(_0x5416e4){return _0x337b64[_0x691c('0x17')](_0x2678e7)[_0x691c('0x19')](_0x5416e4);}};}function respondWithFilteredResult(_0x257d9c,_0xa99230){return function(_0x136747){if(_0x136747){var _0x13c97d=typeof _0xa99230[_0x691c('0x1a')]===_0x691c('0x1b')&&typeof _0xa99230['limit']===_0x691c('0x1b');var _0x1b4cf0=_0x136747[_0x691c('0x1c')];var _0x299653=_0x13c97d?0x0:_0xa99230[_0x691c('0x1a')];var _0x522ad0=_0x13c97d?_0x136747[_0x691c('0x1c')]:_0xa99230[_0x691c('0x1a')]+_0xa99230['limit'];var _0x5b23b0;if(_0x522ad0>=_0x1b4cf0){_0x522ad0=_0x1b4cf0;_0x5b23b0=0xc8;}else{_0x5b23b0=0xce;}_0x257d9c['status'](_0x5b23b0);return _0x257d9c[_0x691c('0x1d')]('Content-Range',_0x299653+'-'+_0x522ad0+'/'+_0x1b4cf0)[_0x691c('0x19')](_0x136747);}return null;};}function patchUpdates(_0x53a419){return function(_0x49d816){try{jsonpatch[_0x691c('0x1e')](_0x49d816,_0x53a419,!![]);}catch(_0x40317d){return BPromise[_0x691c('0x1f')](_0x40317d);}return _0x49d816[_0x691c('0x20')]();};}function saveUpdates(_0xc7de7f,_0x59d3de){return function(_0xd1e967){if(_0xd1e967){return _0xd1e967['update'](_0xc7de7f)[_0x691c('0x21')](function(_0x56bcf9){return _0x56bcf9;});}return null;};}function removeEntity(_0x14b26a,_0x52abf){return function(_0x63e21c){if(_0x63e21c){return _0x63e21c[_0x691c('0x22')]()[_0x691c('0x21')](function(){_0x14b26a['status'](0xcc)[_0x691c('0x18')]();});}};}function handleEntityNotFound(_0x5a1635,_0x18b564){return function(_0x22cc77){if(!_0x22cc77){_0x5a1635[_0x691c('0x16')](0x194);}return _0x22cc77;};}function handleError(_0x2a8fa3,_0x228488){_0x228488=_0x228488||0x1f4;return function(_0x4281ad){logger[_0x691c('0x23')](_0x4281ad[_0x691c('0x24')]);if(_0x4281ad['name']){delete _0x4281ad[_0x691c('0x25')];}_0x2a8fa3[_0x691c('0x17')](_0x228488)[_0x691c('0x26')](_0x4281ad);};}exports[_0x691c('0x27')]=function(_0x598ece,_0x5208b2){var _0x3f2b90={},_0xcceaa={},_0x4feaa6={'count':0x0,'rows':[]};var _0x26dfb1=_['map'](db[_0x691c('0x28')]['rawAttributes'],function(_0x416c43){return{'name':_0x416c43[_0x691c('0x29')],'type':_0x416c43[_0x691c('0x2a')]['key']};});_0xcceaa['model']=_[_0x691c('0x2b')](_0x26dfb1,_0x691c('0x25'));_0xcceaa[_0x691c('0x2c')]=_[_0x691c('0x2d')](_0x598ece[_0x691c('0x2c')]);_0xcceaa[_0x691c('0x2e')]=_[_0x691c('0x2f')](_0xcceaa['model'],_0xcceaa[_0x691c('0x2c')]);_0x3f2b90[_0x691c('0x30')]=_['intersection'](_0xcceaa[_0x691c('0x31')],qs[_0x691c('0x32')](_0x598ece[_0x691c('0x2c')][_0x691c('0x32')]));_0x3f2b90['attributes']=_0x3f2b90[_0x691c('0x30')][_0x691c('0x33')]?_0x3f2b90[_0x691c('0x30')]:_0xcceaa['model'];if(!_0x598ece[_0x691c('0x2c')][_0x691c('0x34')](_0x691c('0x35'))){_0x3f2b90[_0x691c('0x36')]=qs[_0x691c('0x36')](_0x598ece['query'][_0x691c('0x36')]);_0x3f2b90[_0x691c('0x1a')]=qs[_0x691c('0x1a')](_0x598ece[_0x691c('0x2c')][_0x691c('0x1a')]);}_0x3f2b90[_0x691c('0x37')]=qs['sort'](_0x598ece[_0x691c('0x2c')]['sort']);_0x3f2b90['where']=qs[_0x691c('0x2e')](_[_0x691c('0x38')](_0x598ece[_0x691c('0x2c')],_0xcceaa[_0x691c('0x2e')]),_0x26dfb1);if(_0x598ece['query'][_0x691c('0x39')]){_0x3f2b90[_0x691c('0x3a')]=_[_0x691c('0x3b')](_0x3f2b90[_0x691c('0x3a')],{'$or':_[_0x691c('0x2b')](_0x26dfb1,function(_0x30f39c){if(_0x30f39c[_0x691c('0x2a')]!==_0x691c('0x3c')){var _0x9ca616={};_0x9ca616[_0x30f39c[_0x691c('0x25')]]={'$like':'%'+_0x598ece[_0x691c('0x2c')]['filter']+'%'};return _0x9ca616;}})});}_0x3f2b90=_[_0x691c('0x3b')]({},_0x3f2b90,_0x598ece[_0x691c('0x3d')]);var _0x515aa2={'where':_0x3f2b90['where']};return db[_0x691c('0x28')][_0x691c('0x1c')](_0x515aa2)[_0x691c('0x21')](function(_0x2cd0a2){_0x4feaa6[_0x691c('0x1c')]=_0x2cd0a2;if(_0x598ece[_0x691c('0x2c')][_0x691c('0x3e')]){_0x3f2b90[_0x691c('0x3f')]=[{'all':!![]}];}return db[_0x691c('0x28')][_0x691c('0x40')](_0x3f2b90);})['then'](function(_0x23a9a1){_0x4feaa6[_0x691c('0x41')]=_0x23a9a1;return _0x4feaa6;})[_0x691c('0x21')](respondWithFilteredResult(_0x5208b2,_0x3f2b90))[_0x691c('0x42')](handleError(_0x5208b2,null));};exports[_0x691c('0x43')]=function(_0x340507,_0x51d557){var _0x39fbc5={'raw':!![],'where':{'id':_0x340507[_0x691c('0x44')]['id']}},_0x317a0b={};_0x317a0b[_0x691c('0x31')]=_[_0x691c('0x2d')](db[_0x691c('0x28')][_0x691c('0x45')]);_0x317a0b[_0x691c('0x2c')]=_[_0x691c('0x2d')](_0x340507['query']);_0x317a0b[_0x691c('0x2e')]=_[_0x691c('0x2f')](_0x317a0b['model'],_0x317a0b[_0x691c('0x2c')]);_0x39fbc5[_0x691c('0x30')]=_[_0x691c('0x2f')](_0x317a0b[_0x691c('0x31')],qs[_0x691c('0x32')](_0x340507['query'][_0x691c('0x32')]));_0x39fbc5[_0x691c('0x30')]=_0x39fbc5['attributes'][_0x691c('0x33')]?_0x39fbc5[_0x691c('0x30')]:_0x317a0b[_0x691c('0x31')];if(_0x340507['query'][_0x691c('0x3e')]){_0x39fbc5[_0x691c('0x3f')]=[{'all':!![]}];}_0x39fbc5=_[_0x691c('0x3b')]({},_0x39fbc5,_0x340507[_0x691c('0x3d')]);return db[_0x691c('0x28')][_0x691c('0x46')](_0x39fbc5)[_0x691c('0x21')](handleEntityNotFound(_0x51d557,null))['then'](respondWithResult(_0x51d557,null))[_0x691c('0x42')](handleError(_0x51d557,null));};exports[_0x691c('0x47')]=function(_0x79aaec,_0x262706){return db[_0x691c('0x28')][_0x691c('0x47')](_0x79aaec[_0x691c('0x48')],{})[_0x691c('0x21')](respondWithResult(_0x262706,0xc9))['catch'](handleError(_0x262706,null));};exports[_0x691c('0x49')]=function(_0x27feef,_0xd011ac){if(_0x27feef[_0x691c('0x48')]['id']){delete _0x27feef[_0x691c('0x48')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x27feef[_0x691c('0x44')]['id']}})['then'](handleEntityNotFound(_0xd011ac,null))[_0x691c('0x21')](saveUpdates(_0x27feef[_0x691c('0x48')],null))[_0x691c('0x21')](respondWithResult(_0xd011ac,null))[_0x691c('0x42')](handleError(_0xd011ac,null));};exports['destroy']=function(_0x4062f5,_0x237d5f){return db[_0x691c('0x28')][_0x691c('0x46')]({'where':{'id':_0x4062f5[_0x691c('0x44')]['id']}})[_0x691c('0x21')](handleEntityNotFound(_0x237d5f,null))[_0x691c('0x21')](removeEntity(_0x237d5f,null))[_0x691c('0x42')](handleError(_0x237d5f,null));};exports['describe']=function(_0x2ec9f8,_0x3870bc){return db['JscriptyAnswerReport'][_0x691c('0x4a')]()[_0x691c('0x21')](respondWithResult(_0x3870bc,null))['catch'](handleError(_0x3870bc,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 686f985..e29adab 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 _0x8eb0=['path','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5bf828,_0xdc0357){var _0x1192b9=function(_0x3c0443){while(--_0x3c0443){_0x5bf828['push'](_0x5bf828['shift']());}};_0x1192b9(++_0xdc0357);}(_0x8eb0,0x162));var _0x08eb=function(_0x3f27e3,_0x48b14e){_0x3f27e3=_0x3f27e3-0x0;var _0x24e167=_0x8eb0[_0x3f27e3];return _0x24e167;};'use strict';var _=require(_0x08eb('0x0'));var util=require('util');var logger=require(_0x08eb('0x1'))(_0x08eb('0x2'));var moment=require(_0x08eb('0x3'));var BPromise=require(_0x08eb('0x4'));var rp=require(_0x08eb('0x5'));var fs=require('fs');var path=require(_0x08eb('0x6'));var rimraf=require('rimraf');var config=require(_0x08eb('0x7'));var attributes=require(_0x08eb('0x8'));module['exports']=function(_0x5ac8fd,_0x12f37c){return _0x5ac8fd[_0x08eb('0x9')](_0x08eb('0xa'),attributes,{'tableName':_0x08eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbec=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyAnswerReport.attributes','exports'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xbbec,0x85));var _0xcbbe=function(_0x289835,_0x1608c2){_0x289835=_0x289835-0x0;var _0x3f3acb=_0xbbec[_0x289835];return _0x3f3acb;};'use strict';var _=require(_0xcbbe('0x0'));var util=require(_0xcbbe('0x1'));var logger=require(_0xcbbe('0x2'))(_0xcbbe('0x3'));var moment=require(_0xcbbe('0x4'));var BPromise=require(_0xcbbe('0x5'));var rp=require(_0xcbbe('0x6'));var fs=require('fs');var path=require(_0xcbbe('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcbbe('0x8'));module[_0xcbbe('0x9')]=function(_0x466300,_0x5d32f9){return _0x466300[_0xcbbe('0xa')](_0xcbbe('0xb'),attributes,{'tableName':_0xcbbe('0xc'),'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 711eebc..7dd241a 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 _0x7fef=['JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7fef,0xd1));var _0xf7fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7fef[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf7fe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf7fe('0x1'));var rs=require(_0xf7fe('0x2'));var fs=require('fs');var Redis=require(_0xf7fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7fe('0x4'));var logger=require(_0xf7fe('0x5'))('rpc');var config=require(_0xf7fe('0x6'));var jayson=require(_0xf7fe('0x7'));var client=jayson[_0xf7fe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x385646,_0x5ca079,_0x2e440f){return new BPromise(function(_0x1ad040,_0x5492c6){return client[_0xf7fe('0x9')](_0x385646,_0x2e440f)[_0xf7fe('0xa')](function(_0x5a160d){logger['info'](_0xf7fe('0xb'),_0x5ca079,'request\x20sent');logger[_0xf7fe('0xc')](_0xf7fe('0xd'),_0x5ca079,'request\x20sent',JSON[_0xf7fe('0xe')](_0x5a160d));if(_0x5a160d[_0xf7fe('0xf')]){if(_0x5a160d[_0xf7fe('0xf')][_0xf7fe('0x10')]===0x1f4){logger[_0xf7fe('0xf')](_0xf7fe('0xb'),_0x5ca079,_0x5a160d[_0xf7fe('0xf')][_0xf7fe('0x11')]);return _0x5492c6(_0x5a160d[_0xf7fe('0xf')][_0xf7fe('0x11')]);}logger[_0xf7fe('0xf')](_0xf7fe('0xb'),_0x5ca079,_0x5a160d[_0xf7fe('0xf')][_0xf7fe('0x11')]);return _0x1ad040(_0x5a160d[_0xf7fe('0xf')][_0xf7fe('0x11')]);}else{logger[_0xf7fe('0x12')](_0xf7fe('0xb'),_0x5ca079,_0xf7fe('0x13'));_0x1ad040(_0x5a160d[_0xf7fe('0x14')]['message']);}})[_0xf7fe('0x15')](function(_0x1ad117){logger[_0xf7fe('0xf')](_0xf7fe('0xb'),_0x5ca079,_0x1ad117);_0x5492c6(_0x1ad117);});});} \ No newline at end of file +var _0xb846=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x35f08c,_0x343fe8){var _0x1c8fe4=function(_0x4d92b5){while(--_0x4d92b5){_0x35f08c['push'](_0x35f08c['shift']());}};_0x1c8fe4(++_0x343fe8);}(_0xb846,0x1e8));var _0x6b84=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xb846[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x6b84('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b84('0x1'));var rs=require(_0x6b84('0x2'));var fs=require('fs');var Redis=require(_0x6b84('0x3'));var db=require(_0x6b84('0x4'))['db'];var utils=require(_0x6b84('0x5'));var logger=require(_0x6b84('0x6'))(_0x6b84('0x7'));var config=require(_0x6b84('0x8'));var jayson=require(_0x6b84('0x9'));var client=jayson[_0x6b84('0xa')][_0x6b84('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37bcf4,_0x110a70,_0x28d119){return new BPromise(function(_0x18c63f,_0x32f29c){return client[_0x6b84('0xc')](_0x37bcf4,_0x28d119)[_0x6b84('0xd')](function(_0x12a046){logger[_0x6b84('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x110a70,_0x6b84('0xf'));logger[_0x6b84('0x10')](_0x6b84('0x11'),_0x110a70,'request\x20sent',JSON[_0x6b84('0x12')](_0x12a046));if(_0x12a046[_0x6b84('0x13')]){if(_0x12a046[_0x6b84('0x13')][_0x6b84('0x14')]===0x1f4){logger['error'](_0x6b84('0x15'),_0x110a70,_0x12a046[_0x6b84('0x13')][_0x6b84('0x16')]);return _0x32f29c(_0x12a046[_0x6b84('0x13')][_0x6b84('0x16')]);}logger[_0x6b84('0x13')](_0x6b84('0x15'),_0x110a70,_0x12a046[_0x6b84('0x13')][_0x6b84('0x16')]);return _0x18c63f(_0x12a046[_0x6b84('0x13')][_0x6b84('0x16')]);}else{logger[_0x6b84('0xe')](_0x6b84('0x15'),_0x110a70,'request\x20sent');_0x18c63f(_0x12a046['result'][_0x6b84('0x16')]);}})[_0x6b84('0x17')](function(_0x103640){logger[_0x6b84('0x13')](_0x6b84('0x15'),_0x110a70,_0x103640);_0x32f29c(_0x103640);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 6416754..215dcf6 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 _0x0eb7=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','30s','getSummary','create','post','/:id/clone','clone','put','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x47b7bc,_0x56e90c){var _0x34e64e=function(_0x5b84f6){while(--_0x5b84f6){_0x47b7bc['push'](_0x47b7bc['shift']());}};_0x34e64e(++_0x56e90c);}(_0x0eb7,0x14b));var _0x70eb=function(_0x13e0cf,_0x583514){_0x13e0cf=_0x13e0cf-0x0;var _0x5ed8b4=_0x0eb7[_0x13e0cf];return _0x5ed8b4;};'use strict';var multer=require(_0x70eb('0x0'));var util=require('util');var path=require(_0x70eb('0x1'));var timeout=require(_0x70eb('0x2'));var express=require(_0x70eb('0x3'));var router=express[_0x70eb('0x4')]();var fs_extra=require(_0x70eb('0x5'));var auth=require(_0x70eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x70eb('0x7'));var controller=require('./jscriptyProject.controller');router[_0x70eb('0x8')]('/',auth[_0x70eb('0x9')](),controller['index']);router[_0x70eb('0x8')](_0x70eb('0xa'),auth['isAuthenticated'](),controller[_0x70eb('0xb')]);router[_0x70eb('0x8')](_0x70eb('0xc'),auth[_0x70eb('0x9')](),controller[_0x70eb('0xd')]);router[_0x70eb('0x8')](_0x70eb('0xe'),auth[_0x70eb('0x9')](),controller['getAnswers']);router[_0x70eb('0x8')]('/:id/summary',auth[_0x70eb('0x9')](),timeout(_0x70eb('0xf')),controller[_0x70eb('0x10')]);router['post']('/',auth[_0x70eb('0x9')](),controller[_0x70eb('0x11')]);router[_0x70eb('0x12')](_0x70eb('0x13'),auth[_0x70eb('0x9')](),controller[_0x70eb('0x14')]);router[_0x70eb('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x70eb('0x16')](_0x70eb('0xa'),auth[_0x70eb('0x9')](),controller[_0x70eb('0x17')]);module['exports']=router; \ No newline at end of file +var _0x7ded=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','create','post','/:id/clone','clone','put','update','destroy','exports','multer','path','express','Router'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0x7ded,0xb9));var _0xd7de=function(_0x469a18,_0x2af75c){_0x469a18=_0x469a18-0x0;var _0x1a952c=_0x7ded[_0x469a18];return _0x1a952c;};'use strict';var multer=require(_0xd7de('0x0'));var util=require('util');var path=require(_0xd7de('0x1'));var timeout=require('connect-timeout');var express=require(_0xd7de('0x2'));var router=express[_0xd7de('0x3')]();var fs_extra=require(_0xd7de('0x4'));var auth=require(_0xd7de('0x5'));var interaction=require(_0xd7de('0x6'));var config=require(_0xd7de('0x7'));var controller=require(_0xd7de('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd7de('0x9')](_0xd7de('0xa'),auth[_0xd7de('0xb')](),controller[_0xd7de('0xc')]);router['get'](_0xd7de('0xd'),auth[_0xd7de('0xb')](),controller[_0xd7de('0xe')]);router[_0xd7de('0x9')](_0xd7de('0xf'),auth[_0xd7de('0xb')](),controller[_0xd7de('0x10')]);router[_0xd7de('0x9')]('/:id/summary',auth[_0xd7de('0xb')](),timeout(_0xd7de('0x11')),controller[_0xd7de('0x12')]);router['post']('/',auth[_0xd7de('0xb')](),controller[_0xd7de('0x13')]);router[_0xd7de('0x14')](_0xd7de('0x15'),auth['isAuthenticated'](),controller[_0xd7de('0x16')]);router[_0xd7de('0x17')](_0xd7de('0xa'),auth['isAuthenticated'](),controller[_0xd7de('0x18')]);router['delete']('/:id',auth[_0xd7de('0xb')](),controller[_0xd7de('0x19')]);module[_0xd7de('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 578c375..551695f 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 _0x8204=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format'];(function(_0x30a3a7,_0x3fe1c0){var _0x4ce9f5=function(_0x9c88b9){while(--_0x9c88b9){_0x30a3a7['push'](_0x30a3a7['shift']());}};_0x4ce9f5(++_0x3fe1c0);}(_0x8204,0xee));var _0x4820=function(_0x568743,_0x532a67){_0x568743=_0x568743-0x0;var _0x390328=_0x8204[_0x568743];return _0x390328;};'use strict';var Sequelize=require(_0x4820('0x0'));var _=require(_0x4820('0x1'));var util=require(_0x4820('0x2'));module[_0x4820('0x3')]={'name':{'type':Sequelize[_0x4820('0x4')],'unique':_0x4820('0x5')},'description':{'type':Sequelize[_0x4820('0x4')]},'formData':{'type':Sequelize[_0x4820('0x6')](_0x4820('0x7')),'set':function(_0x54634b){if(_[_0x4820('0x8')](_0x54634b)){this[_0x4820('0x9')](_0x4820('0xa'),JSON[_0x4820('0xb')](_0x54634b));}else if(_[_0x4820('0xc')](_0x54634b)){this[_0x4820('0x9')](_0x4820('0xa'),_0x54634b);}else{this['setDataValue'](_0x4820('0xa'),util[_0x4820('0xd')](_0x4820('0xe'),this[_0x4820('0xf')](_0x4820('0x5'))||'',this[_0x4820('0xf')](_0x4820('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4820('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2f4d=['exports','STRING','long','isObjectLike','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','lodash','util'];(function(_0x160112,_0x17a2cb){var _0x1bfbb2=function(_0x3b1a25){while(--_0x3b1a25){_0x160112['push'](_0x160112['shift']());}};_0x1bfbb2(++_0x17a2cb);}(_0x2f4d,0x66));var _0xd2f4=function(_0xb5c8ef,_0x4ed8d4){_0xb5c8ef=_0xb5c8ef-0x0;var _0x3f8d99=_0x2f4d[_0xb5c8ef];return _0x3f8d99;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd2f4('0x0'));var util=require(_0xd2f4('0x1'));module[_0xd2f4('0x2')]={'name':{'type':Sequelize[_0xd2f4('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xd2f4('0x4')),'set':function(_0x2bde5d){if(_[_0xd2f4('0x5')](_0x2bde5d)){this['setDataValue']('formData',JSON['stringify'](_0x2bde5d));}else if(_['isString'](_0x2bde5d)){this[_0xd2f4('0x6')](_0xd2f4('0x7'),_0x2bde5d);}else{this[_0xd2f4('0x6')]('formData',util['format'](_0xd2f4('0x8'),this[_0xd2f4('0x9')](_0xd2f4('0xa'))||'',this[_0xd2f4('0x9')](_0xd2f4('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd2f4('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd2f4('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 34cb321..47f9fa5 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 _0x78e2=['rawAttributes','intersection','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','JscriptySessionReport','pick','ProjectId','include','getAnswers','JscriptyAnswerReport','order','number','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','format','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','index','JscriptyProject','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x1732f2,_0x3150b9){var _0x1f8f83=function(_0x20c2c5){while(--_0x20c2c5){_0x1732f2['push'](_0x1732f2['shift']());}};_0x1f8f83(++_0x3150b9);}(_0x78e2,0x1a8));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x278e('0x0'));var rimraf=require(_0x278e('0x1'));var zipdir=require(_0x278e('0x2'));var jsonpatch=require(_0x278e('0x3'));var rp=require(_0x278e('0x4'));var moment=require('moment');var BPromise=require(_0x278e('0x5'));var Mustache=require('mustache');var util=require(_0x278e('0x6'));var path=require(_0x278e('0x7'));var sox=require(_0x278e('0x8'));var csv=require(_0x278e('0x9'));var ejs=require(_0x278e('0xa'));var fs=require('fs');var fs_extra=require(_0x278e('0xb'));var _=require(_0x278e('0xc'));var squel=require(_0x278e('0xd'));var crypto=require(_0x278e('0xe'));var jsforce=require(_0x278e('0xf'));var deskjs=require(_0x278e('0x10'));var toCsv=require(_0x278e('0x9'));var querystring=require(_0x278e('0x11'));var Papa=require(_0x278e('0x12'));var Redis=require(_0x278e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x278e('0x14'));var as=require(_0x278e('0x15'));var hardwareService=require(_0x278e('0x16'));var logger=require(_0x278e('0x17'))(_0x278e('0x18'));var utils=require(_0x278e('0x19'));var config=require(_0x278e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x278e('0x1b'))['db'];function respondWithStatusCode(_0x3f2a66,_0x4fe711){_0x4fe711=_0x4fe711||0xcc;return function(_0x2bfe2b){if(_0x2bfe2b){return _0x3f2a66['sendStatus'](_0x4fe711);}return _0x3f2a66[_0x278e('0x1c')](_0x4fe711)['end']();};}function respondWithResult(_0x580b58,_0x4503ba){_0x4503ba=_0x4503ba||0xc8;return function(_0x108ce5){if(_0x108ce5){return _0x580b58['status'](_0x4503ba)['json'](_0x108ce5);}};}function respondWithFilteredResult(_0x43f659,_0x15be55){return function(_0x58f1ec){if(_0x58f1ec){var _0x1b6300=typeof _0x15be55[_0x278e('0x1d')]==='undefined'&&typeof _0x15be55[_0x278e('0x1e')]===_0x278e('0x1f');var _0x2cc807=_0x58f1ec['count'];var _0x381cc9=_0x1b6300?0x0:_0x15be55[_0x278e('0x1d')];var _0x58a511=_0x1b6300?_0x58f1ec[_0x278e('0x20')]:_0x15be55[_0x278e('0x1d')]+_0x15be55[_0x278e('0x1e')];var _0x4b66a9;if(_0x58a511>=_0x2cc807){_0x58a511=_0x2cc807;_0x4b66a9=0xc8;}else{_0x4b66a9=0xce;}_0x43f659[_0x278e('0x1c')](_0x4b66a9);return _0x43f659[_0x278e('0x21')](_0x278e('0x22'),_0x381cc9+'-'+_0x58a511+'/'+_0x2cc807)[_0x278e('0x23')](_0x58f1ec);}return null;};}function patchUpdates(_0x576470){return function(_0x380a10){try{jsonpatch[_0x278e('0x24')](_0x380a10,_0x576470,!![]);}catch(_0x5c0920){return BPromise[_0x278e('0x25')](_0x5c0920);}return _0x380a10[_0x278e('0x26')]();};}function saveUpdates(_0x2f4e73,_0x9562e3){return function(_0x461d37){if(_0x461d37){return _0x461d37[_0x278e('0x27')](_0x2f4e73)[_0x278e('0x28')](function(_0x30262f){return _0x30262f;});}return null;};}function removeEntity(_0x1dbc09,_0x269148){return function(_0x3c5de5){if(_0x3c5de5){return _0x3c5de5[_0x278e('0x29')]()['then'](function(){var _0x57054f=_0x3c5de5['get']({'plain':!![]});var _0x42bccd='Projects';return db[_0x278e('0x2a')][_0x278e('0x29')]({'where':{'type':_0x42bccd,'resourceId':_0x57054f['id']}})[_0x278e('0x28')](function(){return _0x3c5de5;});})[_0x278e('0x28')](function(){_0x1dbc09[_0x278e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2f0b,_0x15b8e6){return function(_0x14fbc0){if(!_0x14fbc0){_0x2b2f0b[_0x278e('0x2b')](0x194);}return _0x14fbc0;};}function handleError(_0x50cc81,_0x370151){_0x370151=_0x370151||0x1f4;return function(_0x1b91d9){logger[_0x278e('0x2c')](_0x1b91d9[_0x278e('0x2d')]);if(_0x1b91d9[_0x278e('0x2e')]){delete _0x1b91d9[_0x278e('0x2e')];}_0x50cc81[_0x278e('0x1c')](_0x370151)['send'](_0x1b91d9);};}exports[_0x278e('0x2f')]=function(_0x319043,_0x302eec){var _0x3f3c79={},_0x47a14c={},_0x4c5dfd={'count':0x0,'rows':[]};var _0x48b0ad=_['map'](db[_0x278e('0x30')]['rawAttributes'],function(_0x307941){return{'name':_0x307941['fieldName'],'type':_0x307941[_0x278e('0x31')][_0x278e('0x32')]};});_0x47a14c[_0x278e('0x33')]=_[_0x278e('0x34')](_0x48b0ad,'name');_0x47a14c[_0x278e('0x35')]=_[_0x278e('0x36')](_0x319043[_0x278e('0x35')]);_0x47a14c[_0x278e('0x37')]=_['intersection'](_0x47a14c[_0x278e('0x33')],_0x47a14c[_0x278e('0x35')]);_0x3f3c79[_0x278e('0x38')]=_['intersection'](_0x47a14c['model'],qs['fields'](_0x319043[_0x278e('0x35')][_0x278e('0x39')]));_0x3f3c79[_0x278e('0x38')]=_0x3f3c79[_0x278e('0x38')]['length']?_0x3f3c79[_0x278e('0x38')]:_0x47a14c['model'];if(!_0x319043[_0x278e('0x35')][_0x278e('0x3a')](_0x278e('0x3b'))){_0x3f3c79[_0x278e('0x1e')]=qs[_0x278e('0x1e')](_0x319043['query'][_0x278e('0x1e')]);_0x3f3c79[_0x278e('0x1d')]=qs[_0x278e('0x1d')](_0x319043[_0x278e('0x35')][_0x278e('0x1d')]);}_0x3f3c79['order']=qs[_0x278e('0x3c')](_0x319043[_0x278e('0x35')][_0x278e('0x3c')]);_0x3f3c79[_0x278e('0x3d')]=qs[_0x278e('0x37')](_['pick'](_0x319043[_0x278e('0x35')],_0x47a14c[_0x278e('0x37')]),_0x48b0ad);if(_0x319043[_0x278e('0x35')]['filter']){_0x3f3c79[_0x278e('0x3d')]=_['merge'](_0x3f3c79['where'],{'$or':_[_0x278e('0x34')](_0x48b0ad,function(_0x546bda){if(_0x546bda[_0x278e('0x31')]!==_0x278e('0x3e')){var _0x1bb9b9={};_0x1bb9b9[_0x546bda['name']]={'$like':'%'+_0x319043[_0x278e('0x35')][_0x278e('0x3f')]+'%'};return _0x1bb9b9;}})});}_0x3f3c79=_[_0x278e('0x40')]({},_0x3f3c79,_0x319043[_0x278e('0x41')]);var _0x410259={'where':_0x3f3c79['where']};return db['JscriptyProject'][_0x278e('0x20')](_0x410259)['then'](function(_0x34b3ba){_0x4c5dfd['count']=_0x34b3ba;if(_0x319043[_0x278e('0x35')][_0x278e('0x42')]){_0x3f3c79['include']=[{'all':!![]}];}return db[_0x278e('0x30')][_0x278e('0x43')](_0x3f3c79);})[_0x278e('0x28')](function(_0x8d48f5){_0x4c5dfd[_0x278e('0x44')]=_0x8d48f5;return _0x4c5dfd;})[_0x278e('0x28')](respondWithFilteredResult(_0x302eec,_0x3f3c79))[_0x278e('0x45')](handleError(_0x302eec,null));};exports[_0x278e('0x46')]=function(_0x3cde01,_0x1e2d70){var _0x24d696={'raw':![],'where':{'id':_0x3cde01[_0x278e('0x47')]['id']}},_0x285490={};_0x285490[_0x278e('0x33')]=_[_0x278e('0x36')](db[_0x278e('0x30')][_0x278e('0x48')]);_0x285490[_0x278e('0x35')]=_['keys'](_0x3cde01['query']);_0x285490[_0x278e('0x37')]=_['intersection'](_0x285490[_0x278e('0x33')],_0x285490[_0x278e('0x35')]);_0x24d696[_0x278e('0x38')]=_[_0x278e('0x49')](_0x285490[_0x278e('0x33')],qs[_0x278e('0x39')](_0x3cde01[_0x278e('0x35')][_0x278e('0x39')]));_0x24d696[_0x278e('0x38')]=_0x24d696[_0x278e('0x38')][_0x278e('0x4a')]?_0x24d696[_0x278e('0x38')]:_0x285490[_0x278e('0x33')];if(_0x3cde01[_0x278e('0x35')][_0x278e('0x42')]){_0x24d696['include']=[{'all':!![]}];}_0x24d696=_[_0x278e('0x40')]({},_0x24d696,_0x3cde01[_0x278e('0x41')]);return db[_0x278e('0x30')][_0x278e('0x4b')](_0x24d696)[_0x278e('0x28')](handleEntityNotFound(_0x1e2d70,null))[_0x278e('0x28')](respondWithResult(_0x1e2d70,null))[_0x278e('0x45')](handleError(_0x1e2d70,null));};exports[_0x278e('0x4c')]=function(_0x12411f,_0x2e7c86){return db[_0x278e('0x30')][_0x278e('0x4c')](_0x12411f[_0x278e('0x4d')],{})[_0x278e('0x28')](function(_0x37cf1e){var _0x58b996=_0x12411f[_0x278e('0x4e')][_0x278e('0x4f')]({'plain':!![]});if(!_0x58b996)throw new Error(_0x278e('0x50'));if(_0x58b996['role']===_0x278e('0x4e')){var _0xd5a35b=_0x37cf1e[_0x278e('0x4f')]({'plain':!![]});var _0x4c2c43=_0x278e('0x51');return db[_0x278e('0x52')]['find']({'where':{'name':_0x4c2c43,'userProfileId':_0x58b996[_0x278e('0x53')]},'raw':!![]})['then'](function(_0x19d658){if(_0x19d658&&_0x19d658[_0x278e('0x54')]===0x0){return db['UserProfileResource'][_0x278e('0x4c')]({'name':_0xd5a35b['name'],'resourceId':_0xd5a35b['id'],'type':_0x19d658[_0x278e('0x2e')],'sectionId':_0x19d658['id']},{})['then'](function(){return _0x37cf1e;});}else{return _0x37cf1e;}})[_0x278e('0x45')](function(_0x115d7a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x115d7a);throw _0x115d7a;});}return _0x37cf1e;})[_0x278e('0x28')](respondWithResult(_0x2e7c86,0xc9))[_0x278e('0x45')](handleError(_0x2e7c86,null));};exports[_0x278e('0x55')]=function(_0x32b77f,_0x2115dd){var _0x36a696={'where':{'id':_0x32b77f[_0x278e('0x47')]['id']}},_0x9dbc55={};_0x9dbc55['model']=_[_0x278e('0x36')](db[_0x278e('0x30')]['rawAttributes']);_0x36a696[_0x278e('0x38')]=_[_0x278e('0x49')](_0x9dbc55[_0x278e('0x33')],qs['fields'](_0x32b77f['query'][_0x278e('0x39')]));_0x36a696[_0x278e('0x38')]=_0x36a696[_0x278e('0x38')][_0x278e('0x4a')]?_0x36a696['attributes']:_0x9dbc55[_0x278e('0x33')];if(_0x32b77f[_0x278e('0x35')]['includeAll']){_0x36a696['include']=[{'all':!![]}];}_0x36a696=_[_0x278e('0x40')]({},_0x36a696,_0x32b77f[_0x278e('0x41')]);return db[_0x278e('0x30')][_0x278e('0x4b')](_0x36a696)[_0x278e('0x28')](handleEntityNotFound(_0x2115dd,null))[_0x278e('0x28')](function(_0x467bf2){if(_0x467bf2){var _0x292ecc=_0x467bf2[_0x278e('0x4f')]({'plain':!![]});_0x292ecc=qs[_0x278e('0x56')](_0x292ecc,['id',_0x278e('0x57'),'updatedAt']);_0x32b77f['body']=_['omit'](_0x32b77f[_0x278e('0x4d')],['id',_0x278e('0x57'),_0x278e('0x58')]);return db[_0x278e('0x30')][_0x278e('0x4c')](_[_0x278e('0x40')](_0x292ecc,_0x32b77f[_0x278e('0x4d')]),{'include':_0x32b77f[_0x278e('0x35')][_0x278e('0x42')]?[{'all':!![]}]:undefined})[_0x278e('0x28')](function(_0x11c639){var _0x3e6992=_0x32b77f[_0x278e('0x4e')][_0x278e('0x4f')]({'plain':!![]});if(!_0x3e6992)throw new Error(_0x278e('0x50'));if(_0x3e6992[_0x278e('0x59')]===_0x278e('0x4e')){var _0x28bfa3=_0x11c639[_0x278e('0x4f')]({'plain':!![]});var _0xf07224=_0x278e('0x51');return db[_0x278e('0x52')][_0x278e('0x4b')]({'where':{'name':_0xf07224,'userProfileId':_0x3e6992['userProfileId']},'raw':!![]})[_0x278e('0x28')](function(_0x46574a){if(_0x46574a&&_0x46574a['autoAssociation']===0x0){return db[_0x278e('0x2a')]['create']({'name':_0x28bfa3['name'],'resourceId':_0x28bfa3['id'],'type':_0x46574a['name'],'sectionId':_0x46574a['id']},{})[_0x278e('0x28')](function(){return _0x11c639;});}else{return _0x11c639;}})['catch'](function(_0x1152f6){logger[_0x278e('0x2c')](_0x278e('0x5a'),_0x1152f6);throw _0x1152f6;});}return _0x11c639;});}})['then'](respondWithResult(_0x2115dd,0xc9))[_0x278e('0x45')](handleError(_0x2115dd,null));};exports[_0x278e('0x27')]=function(_0x2ab62e,_0xe8e420){if(_0x2ab62e[_0x278e('0x4d')]['id']){delete _0x2ab62e[_0x278e('0x4d')]['id'];}return db[_0x278e('0x30')][_0x278e('0x4b')]({'where':{'id':_0x2ab62e[_0x278e('0x47')]['id']}})['then'](handleEntityNotFound(_0xe8e420,null))[_0x278e('0x28')](saveUpdates(_0x2ab62e[_0x278e('0x4d')],null))[_0x278e('0x28')](respondWithResult(_0xe8e420,null))[_0x278e('0x45')](handleError(_0xe8e420,null));};exports['destroy']=function(_0x9e9199,_0x231437){return db[_0x278e('0x30')][_0x278e('0x4b')]({'where':{'id':_0x9e9199[_0x278e('0x47')]['id']}})[_0x278e('0x28')](handleEntityNotFound(_0x231437,null))[_0x278e('0x28')](removeEntity(_0x231437,null))[_0x278e('0x45')](handleError(_0x231437,null));};exports['getSessions']=function(_0x28cee6,_0x473edf,_0x5d82c8){var _0x51fcd4={'raw':!![],'where':{}};var _0x3fa9b4={};var _0xf82bf6={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x278e('0x5b')]({'where':{'id':_0x28cee6[_0x278e('0x47')]['id']}})[_0x278e('0x28')](handleEntityNotFound(_0x473edf,null))['then'](function(_0x3516b3){if(_0x3516b3){_0x3fa9b4[_0x278e('0x33')]=_[_0x278e('0x36')](db[_0x278e('0x5c')]['rawAttributes']);_0x3fa9b4[_0x278e('0x35')]=_[_0x278e('0x36')](_0x28cee6[_0x278e('0x35')]);_0x3fa9b4[_0x278e('0x37')]=_[_0x278e('0x49')](_0x3fa9b4[_0x278e('0x33')],_0x3fa9b4[_0x278e('0x35')]);_0x51fcd4[_0x278e('0x38')]=_[_0x278e('0x49')](_0x3fa9b4[_0x278e('0x33')],qs['fields'](_0x28cee6['query'][_0x278e('0x39')]));_0x51fcd4[_0x278e('0x38')]=_0x51fcd4[_0x278e('0x38')][_0x278e('0x4a')]?_0x51fcd4['attributes']:_0x3fa9b4['model'];if(!_0x28cee6[_0x278e('0x35')][_0x278e('0x3a')](_0x278e('0x3b'))){_0x51fcd4[_0x278e('0x1e')]=qs[_0x278e('0x1e')](_0x28cee6['query'][_0x278e('0x1e')]);_0x51fcd4[_0x278e('0x1d')]=qs['offset'](_0x28cee6[_0x278e('0x35')][_0x278e('0x1d')]);}_0x51fcd4['order']=qs['sort'](_0x28cee6[_0x278e('0x35')]['sort']);_0x51fcd4[_0x278e('0x3d')]=qs[_0x278e('0x37')](_[_0x278e('0x5d')](_0x28cee6[_0x278e('0x35')],_0x3fa9b4[_0x278e('0x37')]));_0x51fcd4[_0x278e('0x3d')][_0x278e('0x5e')]=_0x3516b3['id'];if(_0x28cee6['query'][_0x278e('0x3f')]){_0x51fcd4[_0x278e('0x3d')]=_[_0x278e('0x40')](_0x51fcd4['where'],{'$or':_[_0x278e('0x34')](_0x51fcd4[_0x278e('0x38')],function(_0x656864){var _0x304639={};_0x304639[_0x656864]={'$like':'%'+_0x28cee6[_0x278e('0x35')]['filter']+'%'};return _0x304639;})});}_0x51fcd4=_[_0x278e('0x40')]({},_0x51fcd4,_0x28cee6[_0x278e('0x41')]);return db[_0x278e('0x5c')][_0x278e('0x20')]({'where':_0x51fcd4[_0x278e('0x3d')]})[_0x278e('0x28')](function(_0x325681){_0xf82bf6[_0x278e('0x20')]=_0x325681;if(_0x28cee6[_0x278e('0x35')][_0x278e('0x42')]){_0x51fcd4[_0x278e('0x5f')]=[{'all':!![]}];}return db[_0x278e('0x5c')]['findAll'](_0x51fcd4);})['then'](function(_0x593b21){_0xf82bf6[_0x278e('0x44')]=_0x593b21;return _0xf82bf6;});}})[_0x278e('0x28')](respondWithFilteredResult(_0x473edf,_0x51fcd4))[_0x278e('0x45')](handleError(_0x473edf,null));};exports[_0x278e('0x60')]=function(_0x492382,_0x29be6f,_0x5a1c56){var _0x3f516a={'raw':!![],'where':{}};var _0x3f176e={};var _0xb3e777={'count':0x0,'rows':[]};return db[_0x278e('0x30')][_0x278e('0x5b')]({'where':{'id':_0x492382[_0x278e('0x47')]['id']}})[_0x278e('0x28')](handleEntityNotFound(_0x29be6f,null))['then'](function(_0x787373){if(_0x787373){_0x3f176e[_0x278e('0x33')]=_[_0x278e('0x36')](db[_0x278e('0x61')][_0x278e('0x48')]);_0x3f176e['query']=_['keys'](_0x492382['query']);_0x3f176e['filters']=_['intersection'](_0x3f176e[_0x278e('0x33')],_0x3f176e[_0x278e('0x35')]);_0x3f516a[_0x278e('0x38')]=_[_0x278e('0x49')](_0x3f176e[_0x278e('0x33')],qs[_0x278e('0x39')](_0x492382['query'][_0x278e('0x39')]));_0x3f516a[_0x278e('0x38')]=_0x3f516a[_0x278e('0x38')]['length']?_0x3f516a[_0x278e('0x38')]:_0x3f176e[_0x278e('0x33')];if(!_0x492382[_0x278e('0x35')][_0x278e('0x3a')](_0x278e('0x3b'))){_0x3f516a['limit']=qs['limit'](_0x492382[_0x278e('0x35')][_0x278e('0x1e')]);_0x3f516a[_0x278e('0x1d')]=qs[_0x278e('0x1d')](_0x492382[_0x278e('0x35')][_0x278e('0x1d')]);}_0x3f516a[_0x278e('0x62')]=qs[_0x278e('0x3c')](_0x492382['query'][_0x278e('0x3c')]);_0x3f516a[_0x278e('0x3d')]=qs['filters'](_[_0x278e('0x5d')](_0x492382['query'],_0x3f176e[_0x278e('0x37')]));_0x3f516a[_0x278e('0x3d')][_0x278e('0x5e')]=_0x787373['id'];if(_0x492382[_0x278e('0x35')]['filter']){_0x3f516a[_0x278e('0x3d')]=_[_0x278e('0x40')](_0x3f516a[_0x278e('0x3d')],{'$or':_[_0x278e('0x34')](_0x3f516a[_0x278e('0x38')],function(_0x17d9ca){var _0x43916d={};_0x43916d[_0x17d9ca]={'$like':'%'+_0x492382[_0x278e('0x35')][_0x278e('0x3f')]+'%'};return _0x43916d;})});}_0x3f516a=_[_0x278e('0x40')]({},_0x3f516a,_0x492382[_0x278e('0x41')]);return db[_0x278e('0x61')][_0x278e('0x20')]({'where':_0x3f516a[_0x278e('0x3d')]})['then'](function(_0x47e97d){_0xb3e777[_0x278e('0x20')]=_0x47e97d;if(_0x492382[_0x278e('0x35')]['includeAll']){_0x3f516a['include']=[{'all':!![]}];}return db[_0x278e('0x61')]['findAll'](_0x3f516a);})[_0x278e('0x28')](function(_0x1bbb9b){_0xb3e777[_0x278e('0x44')]=_0x1bbb9b;return _0xb3e777;});}})[_0x278e('0x28')](respondWithFilteredResult(_0x29be6f,_0x3f516a))[_0x278e('0x45')](handleError(_0x29be6f,null));};function char(_0x92281f){return _0x278e('0x63')===typeof _0x92281f?String['fromCharCode'][_0x278e('0x24')](null,arguments):_0x92281f;}function needsEncapsulation(_0x303287){return!!_0x303287&&(_0x303287[_0x278e('0x64')]()[_0x278e('0x65')](char(0xd))>=0x0||_0x303287[_0x278e('0x64')]()[_0x278e('0x65')](char(0xa))>=0x0||_0x303287[_0x278e('0x64')]()[_0x278e('0x65')](char(0x2c))>=0x0||_0x303287['toString']()[_0x278e('0x65')](char(0x22))>=0x0);}function encapsulate(_0x1e52a4){var _0x3ec15a=char(0x22),_0x13365c='\x5c'+char(0x22),_0x495bdc=_0x1e52a4[_0x278e('0x64')]()['replace'](new RegExp(_0x3ec15a,'g'),_0x13365c);return _0x3ec15a+_0x495bdc+_0x3ec15a;}exports[_0x278e('0x66')]=function(_0x379af8,_0x5f2a95,_0x30d91b){var _0x4bedd3,_0x1ce7e0;var _0x246a86={'where':{'ProjectId':_0x379af8[_0x278e('0x47')]['id']}};if(_0x379af8[_0x278e('0x35')][_0x278e('0x67')]){_0x246a86[_0x278e('0x3d')][_0x278e('0x68')]=JSON[_0x278e('0x69')](_0x379af8['query'][_0x278e('0x67')]);}return db[_0x278e('0x5c')][_0x278e('0x43')](_0x246a86)[_0x278e('0x28')](handleEntityNotFound(_0x5f2a95,null))[_0x278e('0x28')](function(_0x3c5b7e){if(_0x3c5b7e){_0x4bedd3=_0x3c5b7e;return db[_0x278e('0x6a')][_0x278e('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x4bedd3,'id')},'ProjectId':_0x379af8[_0x278e('0x47')]['id']},'order':_0x278e('0x6b')});}})[_0x278e('0x28')](handleEntityNotFound(_0x5f2a95,null))[_0x278e('0x28')](function(_0x39d74c){if(_0x39d74c){_0x1ce7e0=_0x39d74c;var _0xbba205={};for(var _0x4ea066=0x0,_0x1db1b5=_0x1ce7e0[_0x278e('0x4a')];_0x4ea066<_0x1db1b5;_0x4ea066++){if(!_0xbba205[_0x278e('0x3a')](_0x1ce7e0[_0x4ea066][_0x278e('0x6c')])){_0xbba205[_0x1ce7e0[_0x4ea066]['questionId']]=needsEncapsulation(_0x1ce7e0[_0x4ea066][_0x278e('0x6d')])?encapsulate(_0x1ce7e0[_0x4ea066][_0x278e('0x6d')]):_0x1ce7e0[_0x4ea066][_0x278e('0x6d')];}}var _0x210320=[],_0x3ee6df={};for(var _0x919126=0x0,_0x1a41a0=_0x4bedd3[_0x278e('0x4a')];_0x919126<_0x1a41a0;_0x919126++){_0x3ee6df={'ProjectId':_0x379af8[_0x278e('0x47')]['id'],'SessionId':_0x4bedd3[_0x919126]['id'],'StartTime':moment(_0x4bedd3[_0x919126]['starttime'])['format'](_0x278e('0x6e'))};for(var _0x58a3b2=0x0,_0x25fcd2=_0x1ce7e0[_0x278e('0x4a')];_0x58a3b2<_0x25fcd2;_0x58a3b2++){if(_0x1ce7e0[_0x58a3b2][_0x278e('0x6f')]==_0x4bedd3[_0x919126]['id']&&_0xbba205[_0x278e('0x3a')](_0x1ce7e0[_0x58a3b2]['questionId'])){_0x3ee6df[_0xbba205[_0x1ce7e0[_0x58a3b2]['questionId']]]=_0x1ce7e0[_0x58a3b2][_0x278e('0x70')];}}for(var _0x47f567 in _0xbba205){if(!_0x3ee6df[_0x278e('0x3a')](_0xbba205[_0x47f567])){_0x3ee6df[_0xbba205[_0x47f567]]=null;}}_0x210320[_0x278e('0x71')](_0x3ee6df);}return _0x210320;}})[_0x278e('0x28')](function(_0x2386d1){if(!_[_0x278e('0x72')](_0x2386d1)){var _0x2c8768=toCsv(_0x2386d1);var _0x5d87e3=Date[_0x278e('0x73')]();fs[_0x278e('0x74')](util['format'](_0x278e('0x75'),_0x379af8[_0x278e('0x47')]['id'],_0x5d87e3),_0x2c8768);_0x5f2a95[_0x278e('0x76')](_0x278e('0x77'),'attachment;\x20filename='+util[_0x278e('0x78')]('Jscripty_Project_%d_Summary_%s.csv',_0x379af8['params']['id'],_0x5d87e3));_0x5f2a95['setHeader'](_0x278e('0x79'),_0x278e('0x7a'));return _0x5f2a95[_0x278e('0x7b')](util['format'](_0x278e('0x75'),_0x379af8['params']['id'],_0x5d87e3));}else{return _0x5f2a95[_0x278e('0x2b')](0xcc);}})[_0x278e('0x45')](handleError(_0x5f2a95,null));}; \ No newline at end of file +var _0xf269=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','getSessions','ProjectId','JscriptySessionReport','findOne','JscriptyAnswerReport','filter','number','toString','indexOf','replace','getSummary','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x46f19f,_0x227b4e){var _0x390c63=function(_0x4fd2ec){while(--_0x4fd2ec){_0x46f19f['push'](_0x46f19f['shift']());}};_0x390c63(++_0x227b4e);}(_0xf269,0xd2));var _0x9f26=function(_0xa497e9,_0x212955){_0xa497e9=_0xa497e9-0x0;var _0x7faf63=_0xf269[_0xa497e9];return _0x7faf63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f26('0x0'));var zipdir=require(_0x9f26('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f26('0x2'));var moment=require(_0x9f26('0x3'));var BPromise=require(_0x9f26('0x4'));var Mustache=require('mustache');var util=require(_0x9f26('0x5'));var path=require('path');var sox=require(_0x9f26('0x6'));var csv=require(_0x9f26('0x7'));var ejs=require(_0x9f26('0x8'));var fs=require('fs');var fs_extra=require(_0x9f26('0x9'));var _=require(_0x9f26('0xa'));var squel=require(_0x9f26('0xb'));var crypto=require(_0x9f26('0xc'));var jsforce=require(_0x9f26('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9f26('0xe'));var Redis=require(_0x9f26('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f26('0x10'));var hardwareService=require(_0x9f26('0x11'));var logger=require(_0x9f26('0x12'))(_0x9f26('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9f26('0x14'))['db'];function respondWithStatusCode(_0x2f2c78,_0x4f24f4){_0x4f24f4=_0x4f24f4||0xcc;return function(_0xc464ee){if(_0xc464ee){return _0x2f2c78[_0x9f26('0x15')](_0x4f24f4);}return _0x2f2c78[_0x9f26('0x16')](_0x4f24f4)[_0x9f26('0x17')]();};}function respondWithResult(_0x1718f8,_0x511228){_0x511228=_0x511228||0xc8;return function(_0x259395){if(_0x259395){return _0x1718f8[_0x9f26('0x16')](_0x511228)[_0x9f26('0x18')](_0x259395);}};}function respondWithFilteredResult(_0x5f2dfa,_0x307cb4){return function(_0x71944f){if(_0x71944f){var _0x212c4e=typeof _0x307cb4[_0x9f26('0x19')]===_0x9f26('0x1a')&&typeof _0x307cb4['limit']===_0x9f26('0x1a');var _0x25c021=_0x71944f[_0x9f26('0x1b')];var _0x126996=_0x212c4e?0x0:_0x307cb4[_0x9f26('0x19')];var _0x2a0f6d=_0x212c4e?_0x71944f['count']:_0x307cb4['offset']+_0x307cb4[_0x9f26('0x1c')];var _0x573636;if(_0x2a0f6d>=_0x25c021){_0x2a0f6d=_0x25c021;_0x573636=0xc8;}else{_0x573636=0xce;}_0x5f2dfa[_0x9f26('0x16')](_0x573636);return _0x5f2dfa[_0x9f26('0x1d')](_0x9f26('0x1e'),_0x126996+'-'+_0x2a0f6d+'/'+_0x25c021)[_0x9f26('0x18')](_0x71944f);}return null;};}function patchUpdates(_0xa2a523){return function(_0x2c9bb3){try{jsonpatch[_0x9f26('0x1f')](_0x2c9bb3,_0xa2a523,!![]);}catch(_0x5a7ace){return BPromise[_0x9f26('0x20')](_0x5a7ace);}return _0x2c9bb3[_0x9f26('0x21')]();};}function saveUpdates(_0x12defd,_0x38af34){return function(_0x4503c9){if(_0x4503c9){return _0x4503c9[_0x9f26('0x22')](_0x12defd)[_0x9f26('0x23')](function(_0x1d47e7){return _0x1d47e7;});}return null;};}function removeEntity(_0xd38c5,_0x298510){return function(_0xe9d254){if(_0xe9d254){return _0xe9d254[_0x9f26('0x24')]()['then'](function(){var _0x3e7b54=_0xe9d254[_0x9f26('0x25')]({'plain':!![]});var _0x6da052=_0x9f26('0x26');return db[_0x9f26('0x27')][_0x9f26('0x24')]({'where':{'type':_0x6da052,'resourceId':_0x3e7b54['id']}})['then'](function(){return _0xe9d254;});})[_0x9f26('0x23')](function(){_0xd38c5[_0x9f26('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1973,_0x100fb5){return function(_0x53f00d){if(!_0x53f00d){_0x5f1973[_0x9f26('0x15')](0x194);}return _0x53f00d;};}function handleError(_0x55e50f,_0x44a51e){_0x44a51e=_0x44a51e||0x1f4;return function(_0x25168b){logger[_0x9f26('0x28')](_0x25168b[_0x9f26('0x29')]);if(_0x25168b[_0x9f26('0x2a')]){delete _0x25168b[_0x9f26('0x2a')];}_0x55e50f[_0x9f26('0x16')](_0x44a51e)[_0x9f26('0x2b')](_0x25168b);};}exports[_0x9f26('0x2c')]=function(_0x2ad80b,_0x2cc229){var _0x3844ab={},_0x2dbdf9={},_0x24fcec={'count':0x0,'rows':[]};var _0x1ad5d5=_[_0x9f26('0x2d')](db[_0x9f26('0x2e')][_0x9f26('0x2f')],function(_0x41bc57){return{'name':_0x41bc57[_0x9f26('0x30')],'type':_0x41bc57[_0x9f26('0x31')][_0x9f26('0x32')]};});_0x2dbdf9[_0x9f26('0x33')]=_[_0x9f26('0x2d')](_0x1ad5d5,'name');_0x2dbdf9[_0x9f26('0x34')]=_[_0x9f26('0x35')](_0x2ad80b[_0x9f26('0x34')]);_0x2dbdf9[_0x9f26('0x36')]=_[_0x9f26('0x37')](_0x2dbdf9[_0x9f26('0x33')],_0x2dbdf9['query']);_0x3844ab['attributes']=_['intersection'](_0x2dbdf9[_0x9f26('0x33')],qs[_0x9f26('0x38')](_0x2ad80b['query'][_0x9f26('0x38')]));_0x3844ab[_0x9f26('0x39')]=_0x3844ab[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x3844ab[_0x9f26('0x39')]:_0x2dbdf9[_0x9f26('0x33')];if(!_0x2ad80b['query'][_0x9f26('0x3b')](_0x9f26('0x3c'))){_0x3844ab['limit']=qs[_0x9f26('0x1c')](_0x2ad80b['query'][_0x9f26('0x1c')]);_0x3844ab[_0x9f26('0x19')]=qs[_0x9f26('0x19')](_0x2ad80b[_0x9f26('0x34')]['offset']);}_0x3844ab[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x2ad80b[_0x9f26('0x34')]['sort']);_0x3844ab[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x2ad80b[_0x9f26('0x34')],_0x2dbdf9[_0x9f26('0x36')]),_0x1ad5d5);if(_0x2ad80b[_0x9f26('0x34')]['filter']){_0x3844ab[_0x9f26('0x3f')]=_['merge'](_0x3844ab[_0x9f26('0x3f')],{'$or':_[_0x9f26('0x2d')](_0x1ad5d5,function(_0x4aa8a7){if(_0x4aa8a7[_0x9f26('0x31')]!=='VIRTUAL'){var _0xaf8c0f={};_0xaf8c0f[_0x4aa8a7['name']]={'$like':'%'+_0x2ad80b[_0x9f26('0x34')]['filter']+'%'};return _0xaf8c0f;}})});}_0x3844ab=_[_0x9f26('0x41')]({},_0x3844ab,_0x2ad80b[_0x9f26('0x42')]);var _0x34e1f6={'where':_0x3844ab[_0x9f26('0x3f')]};return db[_0x9f26('0x2e')]['count'](_0x34e1f6)[_0x9f26('0x23')](function(_0x2c5245){_0x24fcec['count']=_0x2c5245;if(_0x2ad80b['query'][_0x9f26('0x43')]){_0x3844ab[_0x9f26('0x44')]=[{'all':!![]}];}return db[_0x9f26('0x2e')][_0x9f26('0x45')](_0x3844ab);})['then'](function(_0x343801){_0x24fcec[_0x9f26('0x46')]=_0x343801;return _0x24fcec;})[_0x9f26('0x23')](respondWithFilteredResult(_0x2cc229,_0x3844ab))[_0x9f26('0x47')](handleError(_0x2cc229,null));};exports['show']=function(_0x433d25,_0x57cb8e){var _0x5d54ef={'raw':![],'where':{'id':_0x433d25['params']['id']}},_0x5ef94a={};_0x5ef94a[_0x9f26('0x33')]=_[_0x9f26('0x35')](db[_0x9f26('0x2e')]['rawAttributes']);_0x5ef94a['query']=_[_0x9f26('0x35')](_0x433d25['query']);_0x5ef94a['filters']=_['intersection'](_0x5ef94a[_0x9f26('0x33')],_0x5ef94a[_0x9f26('0x34')]);_0x5d54ef[_0x9f26('0x39')]=_[_0x9f26('0x37')](_0x5ef94a[_0x9f26('0x33')],qs[_0x9f26('0x38')](_0x433d25['query']['fields']));_0x5d54ef[_0x9f26('0x39')]=_0x5d54ef[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x5d54ef[_0x9f26('0x39')]:_0x5ef94a['model'];if(_0x433d25[_0x9f26('0x34')][_0x9f26('0x43')]){_0x5d54ef['include']=[{'all':!![]}];}_0x5d54ef=_['merge']({},_0x5d54ef,_0x433d25[_0x9f26('0x42')]);return db[_0x9f26('0x2e')][_0x9f26('0x48')](_0x5d54ef)[_0x9f26('0x23')](handleEntityNotFound(_0x57cb8e,null))[_0x9f26('0x23')](respondWithResult(_0x57cb8e,null))[_0x9f26('0x47')](handleError(_0x57cb8e,null));};exports['create']=function(_0x1861dc,_0x2504f){return db[_0x9f26('0x2e')]['create'](_0x1861dc['body'],{})[_0x9f26('0x23')](function(_0x3ac946){var _0x1b6468=_0x1861dc[_0x9f26('0x49')][_0x9f26('0x25')]({'plain':!![]});if(!_0x1b6468)throw new Error(_0x9f26('0x4a'));if(_0x1b6468[_0x9f26('0x4b')]==='user'){var _0x3e0c28=_0x3ac946['get']({'plain':!![]});var _0x4722ad=_0x9f26('0x26');return db[_0x9f26('0x4c')][_0x9f26('0x48')]({'where':{'name':_0x4722ad,'userProfileId':_0x1b6468[_0x9f26('0x4d')]},'raw':!![]})[_0x9f26('0x23')](function(_0x1c024b){if(_0x1c024b&&_0x1c024b[_0x9f26('0x4e')]===0x0){return db[_0x9f26('0x27')][_0x9f26('0x4f')]({'name':_0x3e0c28['name'],'resourceId':_0x3e0c28['id'],'type':_0x1c024b[_0x9f26('0x2a')],'sectionId':_0x1c024b['id']},{})[_0x9f26('0x23')](function(){return _0x3ac946;});}else{return _0x3ac946;}})[_0x9f26('0x47')](function(_0x31566a){logger[_0x9f26('0x28')](_0x9f26('0x50'),_0x31566a);throw _0x31566a;});}return _0x3ac946;})['then'](respondWithResult(_0x2504f,0xc9))[_0x9f26('0x47')](handleError(_0x2504f,null));};exports[_0x9f26('0x51')]=function(_0x2dbf08,_0x110750){var _0x121685={'where':{'id':_0x2dbf08[_0x9f26('0x52')]['id']}},_0x416fa5={};_0x416fa5[_0x9f26('0x33')]=_['keys'](db[_0x9f26('0x2e')][_0x9f26('0x2f')]);_0x121685['attributes']=_[_0x9f26('0x37')](_0x416fa5['model'],qs[_0x9f26('0x38')](_0x2dbf08['query'][_0x9f26('0x38')]));_0x121685[_0x9f26('0x39')]=_0x121685[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x121685['attributes']:_0x416fa5['model'];if(_0x2dbf08[_0x9f26('0x34')][_0x9f26('0x43')]){_0x121685['include']=[{'all':!![]}];}_0x121685=_[_0x9f26('0x41')]({},_0x121685,_0x2dbf08[_0x9f26('0x42')]);return db[_0x9f26('0x2e')][_0x9f26('0x48')](_0x121685)[_0x9f26('0x23')](handleEntityNotFound(_0x110750,null))['then'](function(_0x448c58){if(_0x448c58){var _0x25c1ba=_0x448c58[_0x9f26('0x25')]({'plain':!![]});_0x25c1ba=qs[_0x9f26('0x53')](_0x25c1ba,['id',_0x9f26('0x54'),_0x9f26('0x55')]);_0x2dbf08['body']=_[_0x9f26('0x53')](_0x2dbf08[_0x9f26('0x56')],['id',_0x9f26('0x54'),_0x9f26('0x55')]);return db['JscriptyProject'][_0x9f26('0x4f')](_[_0x9f26('0x41')](_0x25c1ba,_0x2dbf08[_0x9f26('0x56')]),{'include':_0x2dbf08[_0x9f26('0x34')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x171cec){var _0x200020=_0x2dbf08['user'][_0x9f26('0x25')]({'plain':!![]});if(!_0x200020)throw new Error(_0x9f26('0x4a'));if(_0x200020[_0x9f26('0x4b')]===_0x9f26('0x49')){var _0x320950=_0x171cec['get']({'plain':!![]});var _0x271c83=_0x9f26('0x26');return db[_0x9f26('0x4c')]['find']({'where':{'name':_0x271c83,'userProfileId':_0x200020['userProfileId']},'raw':!![]})[_0x9f26('0x23')](function(_0x39c1e5){if(_0x39c1e5&&_0x39c1e5[_0x9f26('0x4e')]===0x0){return db[_0x9f26('0x27')]['create']({'name':_0x320950[_0x9f26('0x2a')],'resourceId':_0x320950['id'],'type':_0x39c1e5[_0x9f26('0x2a')],'sectionId':_0x39c1e5['id']},{})[_0x9f26('0x23')](function(){return _0x171cec;});}else{return _0x171cec;}})[_0x9f26('0x47')](function(_0x175293){logger[_0x9f26('0x28')](_0x9f26('0x50'),_0x175293);throw _0x175293;});}return _0x171cec;});}})[_0x9f26('0x23')](respondWithResult(_0x110750,0xc9))[_0x9f26('0x47')](handleError(_0x110750,null));};exports[_0x9f26('0x22')]=function(_0x281a61,_0x3c2926){if(_0x281a61[_0x9f26('0x56')]['id']){delete _0x281a61[_0x9f26('0x56')]['id'];}return db['JscriptyProject'][_0x9f26('0x48')]({'where':{'id':_0x281a61[_0x9f26('0x52')]['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x3c2926,null))[_0x9f26('0x23')](saveUpdates(_0x281a61[_0x9f26('0x56')],null))[_0x9f26('0x23')](respondWithResult(_0x3c2926,null))['catch'](handleError(_0x3c2926,null));};exports['destroy']=function(_0x27fd0f,_0x5aba94){return db[_0x9f26('0x2e')][_0x9f26('0x48')]({'where':{'id':_0x27fd0f[_0x9f26('0x52')]['id']}})['then'](handleEntityNotFound(_0x5aba94,null))[_0x9f26('0x23')](removeEntity(_0x5aba94,null))[_0x9f26('0x47')](handleError(_0x5aba94,null));};exports[_0x9f26('0x57')]=function(_0x5e91da,_0x455859,_0x412dd8){var _0x4655b8={'raw':!![],'where':{}};var _0x244c89={};var _0x240306={'count':0x0,'rows':[]};return db[_0x9f26('0x2e')]['findOne']({'where':{'id':_0x5e91da[_0x9f26('0x52')]['id']}})['then'](handleEntityNotFound(_0x455859,null))['then'](function(_0x267a33){if(_0x267a33){_0x244c89[_0x9f26('0x33')]=_[_0x9f26('0x35')](db['JscriptySessionReport'][_0x9f26('0x2f')]);_0x244c89[_0x9f26('0x34')]=_[_0x9f26('0x35')](_0x5e91da[_0x9f26('0x34')]);_0x244c89[_0x9f26('0x36')]=_[_0x9f26('0x37')](_0x244c89[_0x9f26('0x33')],_0x244c89[_0x9f26('0x34')]);_0x4655b8[_0x9f26('0x39')]=_[_0x9f26('0x37')](_0x244c89['model'],qs['fields'](_0x5e91da[_0x9f26('0x34')][_0x9f26('0x38')]));_0x4655b8[_0x9f26('0x39')]=_0x4655b8[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x4655b8['attributes']:_0x244c89[_0x9f26('0x33')];if(!_0x5e91da[_0x9f26('0x34')][_0x9f26('0x3b')]('nolimit')){_0x4655b8[_0x9f26('0x1c')]=qs['limit'](_0x5e91da[_0x9f26('0x34')][_0x9f26('0x1c')]);_0x4655b8['offset']=qs[_0x9f26('0x19')](_0x5e91da[_0x9f26('0x34')]['offset']);}_0x4655b8[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x5e91da[_0x9f26('0x34')]['sort']);_0x4655b8[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x5e91da[_0x9f26('0x34')],_0x244c89['filters']));_0x4655b8[_0x9f26('0x3f')][_0x9f26('0x58')]=_0x267a33['id'];if(_0x5e91da[_0x9f26('0x34')]['filter']){_0x4655b8[_0x9f26('0x3f')]=_['merge'](_0x4655b8['where'],{'$or':_[_0x9f26('0x2d')](_0x4655b8['attributes'],function(_0x3fb2c3){var _0x3639c4={};_0x3639c4[_0x3fb2c3]={'$like':'%'+_0x5e91da[_0x9f26('0x34')]['filter']+'%'};return _0x3639c4;})});}_0x4655b8=_['merge']({},_0x4655b8,_0x5e91da['options']);return db[_0x9f26('0x59')]['count']({'where':_0x4655b8[_0x9f26('0x3f')]})[_0x9f26('0x23')](function(_0x40e736){_0x240306['count']=_0x40e736;if(_0x5e91da['query'][_0x9f26('0x43')]){_0x4655b8[_0x9f26('0x44')]=[{'all':!![]}];}return db[_0x9f26('0x59')]['findAll'](_0x4655b8);})[_0x9f26('0x23')](function(_0x4c7a80){_0x240306[_0x9f26('0x46')]=_0x4c7a80;return _0x240306;});}})[_0x9f26('0x23')](respondWithFilteredResult(_0x455859,_0x4655b8))[_0x9f26('0x47')](handleError(_0x455859,null));};exports['getAnswers']=function(_0x147f6d,_0x3e9309,_0x490c1a){var _0x495341={'raw':!![],'where':{}};var _0x31921f={};var _0x16d8ca={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x9f26('0x5a')]({'where':{'id':_0x147f6d['params']['id']}})[_0x9f26('0x23')](handleEntityNotFound(_0x3e9309,null))[_0x9f26('0x23')](function(_0x591713){if(_0x591713){_0x31921f[_0x9f26('0x33')]=_[_0x9f26('0x35')](db[_0x9f26('0x5b')]['rawAttributes']);_0x31921f[_0x9f26('0x34')]=_['keys'](_0x147f6d[_0x9f26('0x34')]);_0x31921f[_0x9f26('0x36')]=_[_0x9f26('0x37')](_0x31921f[_0x9f26('0x33')],_0x31921f[_0x9f26('0x34')]);_0x495341['attributes']=_[_0x9f26('0x37')](_0x31921f[_0x9f26('0x33')],qs[_0x9f26('0x38')](_0x147f6d[_0x9f26('0x34')][_0x9f26('0x38')]));_0x495341['attributes']=_0x495341[_0x9f26('0x39')][_0x9f26('0x3a')]?_0x495341[_0x9f26('0x39')]:_0x31921f['model'];if(!_0x147f6d[_0x9f26('0x34')][_0x9f26('0x3b')](_0x9f26('0x3c'))){_0x495341[_0x9f26('0x1c')]=qs[_0x9f26('0x1c')](_0x147f6d[_0x9f26('0x34')]['limit']);_0x495341[_0x9f26('0x19')]=qs['offset'](_0x147f6d[_0x9f26('0x34')][_0x9f26('0x19')]);}_0x495341[_0x9f26('0x3d')]=qs[_0x9f26('0x3e')](_0x147f6d[_0x9f26('0x34')][_0x9f26('0x3e')]);_0x495341[_0x9f26('0x3f')]=qs[_0x9f26('0x36')](_[_0x9f26('0x40')](_0x147f6d[_0x9f26('0x34')],_0x31921f[_0x9f26('0x36')]));_0x495341['where']['ProjectId']=_0x591713['id'];if(_0x147f6d[_0x9f26('0x34')][_0x9f26('0x5c')]){_0x495341[_0x9f26('0x3f')]=_['merge'](_0x495341['where'],{'$or':_[_0x9f26('0x2d')](_0x495341[_0x9f26('0x39')],function(_0xe5f90){var _0x5c77b4={};_0x5c77b4[_0xe5f90]={'$like':'%'+_0x147f6d[_0x9f26('0x34')]['filter']+'%'};return _0x5c77b4;})});}_0x495341=_[_0x9f26('0x41')]({},_0x495341,_0x147f6d['options']);return db[_0x9f26('0x5b')][_0x9f26('0x1b')]({'where':_0x495341[_0x9f26('0x3f')]})[_0x9f26('0x23')](function(_0x14301a){_0x16d8ca[_0x9f26('0x1b')]=_0x14301a;if(_0x147f6d['query'][_0x9f26('0x43')]){_0x495341[_0x9f26('0x44')]=[{'all':!![]}];}return db[_0x9f26('0x5b')]['findAll'](_0x495341);})[_0x9f26('0x23')](function(_0x10182){_0x16d8ca[_0x9f26('0x46')]=_0x10182;return _0x16d8ca;});}})['then'](respondWithFilteredResult(_0x3e9309,_0x495341))[_0x9f26('0x47')](handleError(_0x3e9309,null));};function char(_0x35e6bf){return _0x9f26('0x5d')===typeof _0x35e6bf?String['fromCharCode'][_0x9f26('0x1f')](null,arguments):_0x35e6bf;}function needsEncapsulation(_0x191c8d){return!!_0x191c8d&&(_0x191c8d[_0x9f26('0x5e')]()[_0x9f26('0x5f')](char(0xd))>=0x0||_0x191c8d['toString']()['indexOf'](char(0xa))>=0x0||_0x191c8d['toString']()[_0x9f26('0x5f')](char(0x2c))>=0x0||_0x191c8d[_0x9f26('0x5e')]()[_0x9f26('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x38919b){var _0x4e5442=char(0x22),_0x43bd5e='\x5c'+char(0x22),_0x303053=_0x38919b['toString']()[_0x9f26('0x60')](new RegExp(_0x4e5442,'g'),_0x43bd5e);return _0x4e5442+_0x303053+_0x4e5442;}exports[_0x9f26('0x61')]=function(_0x102c2b,_0x144af6,_0x3bee9f){var _0x1bbadb,_0x5e0cd4;var _0x376fa4={'where':{'ProjectId':_0x102c2b[_0x9f26('0x52')]['id']}};if(_0x102c2b[_0x9f26('0x34')]['startTime']){_0x376fa4[_0x9f26('0x3f')]['starttime']=JSON[_0x9f26('0x62')](_0x102c2b['query'][_0x9f26('0x63')]);}return db[_0x9f26('0x59')][_0x9f26('0x45')](_0x376fa4)[_0x9f26('0x23')](handleEntityNotFound(_0x144af6,null))[_0x9f26('0x23')](function(_0x1b3359){if(_0x1b3359){_0x1bbadb=_0x1b3359;return db[_0x9f26('0x64')][_0x9f26('0x45')]({'where':{'SessionId':{'$in':_['map'](_0x1bbadb,'id')},'ProjectId':_0x102c2b['params']['id']},'order':_0x9f26('0x65')});}})[_0x9f26('0x23')](handleEntityNotFound(_0x144af6,null))['then'](function(_0x129e2b){if(_0x129e2b){_0x5e0cd4=_0x129e2b;var _0x407740={};for(var _0xe19237=0x0,_0x423473=_0x5e0cd4[_0x9f26('0x3a')];_0xe19237<_0x423473;_0xe19237++){if(!_0x407740[_0x9f26('0x3b')](_0x5e0cd4[_0xe19237][_0x9f26('0x66')])){_0x407740[_0x5e0cd4[_0xe19237][_0x9f26('0x66')]]=needsEncapsulation(_0x5e0cd4[_0xe19237]['question'])?encapsulate(_0x5e0cd4[_0xe19237]['question']):_0x5e0cd4[_0xe19237][_0x9f26('0x67')];}}var _0x5f1e20=[],_0x4bf7c9={};for(var _0x328794=0x0,_0x12a13e=_0x1bbadb[_0x9f26('0x3a')];_0x328794<_0x12a13e;_0x328794++){_0x4bf7c9={'ProjectId':_0x102c2b[_0x9f26('0x52')]['id'],'SessionId':_0x1bbadb[_0x328794]['id'],'StartTime':moment(_0x1bbadb[_0x328794][_0x9f26('0x68')])['format'](_0x9f26('0x69'))};for(var _0x4817e2=0x0,_0x345843=_0x5e0cd4[_0x9f26('0x3a')];_0x4817e2<_0x345843;_0x4817e2++){if(_0x5e0cd4[_0x4817e2][_0x9f26('0x6a')]==_0x1bbadb[_0x328794]['id']&&_0x407740[_0x9f26('0x3b')](_0x5e0cd4[_0x4817e2]['questionId'])){_0x4bf7c9[_0x407740[_0x5e0cd4[_0x4817e2][_0x9f26('0x66')]]]=_0x5e0cd4[_0x4817e2][_0x9f26('0x6b')];}}for(var _0x595f35 in _0x407740){if(!_0x4bf7c9['hasOwnProperty'](_0x407740[_0x595f35])){_0x4bf7c9[_0x407740[_0x595f35]]=null;}}_0x5f1e20[_0x9f26('0x6c')](_0x4bf7c9);}return _0x5f1e20;}})[_0x9f26('0x23')](function(_0x2bf435){if(!_['isEmpty'](_0x2bf435)){var _0x2ec938=toCsv(_0x2bf435);var _0x12dabe=Date[_0x9f26('0x6d')]();fs[_0x9f26('0x6e')](util[_0x9f26('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x102c2b['params']['id'],_0x12dabe),_0x2ec938);_0x144af6[_0x9f26('0x70')](_0x9f26('0x71'),_0x9f26('0x72')+util[_0x9f26('0x6f')](_0x9f26('0x73'),_0x102c2b[_0x9f26('0x52')]['id'],_0x12dabe));_0x144af6['setHeader'](_0x9f26('0x74'),'text/csv');return _0x144af6[_0x9f26('0x75')](util[_0x9f26('0x6f')](_0x9f26('0x76'),_0x102c2b['params']['id'],_0x12dabe));}else{return _0x144af6[_0x9f26('0x15')](0xcc);}})[_0x9f26('0x47')](handleError(_0x144af6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 545e527..520ee6f 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 _0x23ea=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x2d323f,_0x231fe6){var _0x11e018=function(_0x4f326b){while(--_0x4f326b){_0x2d323f['push'](_0x2d323f['shift']());}};_0x11e018(++_0x231fe6);}(_0x23ea,0xc3));var _0xa23e=function(_0x415264,_0x4e71cc){_0x415264=_0x415264-0x0;var _0x305b9e=_0x23ea[_0x415264];return _0x305b9e;};'use strict';var _=require(_0xa23e('0x0'));var util=require(_0xa23e('0x1'));var logger=require(_0xa23e('0x2'))(_0xa23e('0x3'));var moment=require(_0xa23e('0x4'));var BPromise=require(_0xa23e('0x5'));var rp=require(_0xa23e('0x6'));var fs=require('fs');var path=require(_0xa23e('0x7'));var rimraf=require(_0xa23e('0x8'));var config=require(_0xa23e('0x9'));var attributes=require(_0xa23e('0xa'));module['exports']=function(_0x3baf3d,_0x423454){return _0x3baf3d[_0xa23e('0xb')](_0xa23e('0xc'),attributes,{'tableName':_0xa23e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf14b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x62665,_0x5eb51a){var _0x3b3095=function(_0x2ec04f){while(--_0x2ec04f){_0x62665['push'](_0x62665['shift']());}};_0x3b3095(++_0x5eb51a);}(_0xf14b,0xdd));var _0xbf14=function(_0x488dd0,_0x1e0044){_0x488dd0=_0x488dd0-0x0;var _0xb0577d=_0xf14b[_0x488dd0];return _0xb0577d;};'use strict';var _=require(_0xbf14('0x0'));var util=require(_0xbf14('0x1'));var logger=require(_0xbf14('0x2'))(_0xbf14('0x3'));var moment=require(_0xbf14('0x4'));var BPromise=require(_0xbf14('0x5'));var rp=require(_0xbf14('0x6'));var fs=require('fs');var path=require(_0xbf14('0x7'));var rimraf=require(_0xbf14('0x8'));var config=require(_0xbf14('0x9'));var attributes=require('./jscriptyProject.attributes');module[_0xbf14('0xa')]=function(_0xb9333b,_0x1b6462){return _0xb9333b[_0xbf14('0xb')](_0xbf14('0xc'),attributes,{'tableName':_0xbf14('0xd'),'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 ca07718..9e1a620 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_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 moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _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(_0x52b221,_0x488927){var _0x4eca84=function(_0x3f55d6){while(--_0x3f55d6){_0x52b221['push'](_0x52b221['shift']());}};_0x4eca84(++_0x488927);}(_0x70e0,0x17b));var _0x070e=function(_0x3c3e09,_0x43326c){_0x3c3e09=_0x3c3e09-0x0;var _0xbfdd82=_0x70e0[_0x3c3e09];return _0xbfdd82;};'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 3146491..2f66744 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 _0xe2e1=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','create','put','update'];(function(_0x8fee8e,_0x4efa85){var _0x5bd02d=function(_0x5aaeeb){while(--_0x5aaeeb){_0x8fee8e['push'](_0x8fee8e['shift']());}};_0x5bd02d(++_0x4efa85);}(_0xe2e1,0xd5));var _0x1e2e=function(_0x33f623,_0x242842){_0x33f623=_0x33f623-0x0;var _0xff4394=_0xe2e1[_0x33f623];return _0xff4394;};'use strict';var multer=require(_0x1e2e('0x0'));var util=require(_0x1e2e('0x1'));var path=require(_0x1e2e('0x2'));var timeout=require(_0x1e2e('0x3'));var express=require(_0x1e2e('0x4'));var router=express[_0x1e2e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1e2e('0x6'));var controller=require(_0x1e2e('0x7'));router['get']('/',auth[_0x1e2e('0x8')](),controller[_0x1e2e('0x9')]);router['get'](_0x1e2e('0xa'),auth[_0x1e2e('0x8')](),controller[_0x1e2e('0xb')]);router[_0x1e2e('0xc')](_0x1e2e('0xd'),auth[_0x1e2e('0x8')](),controller[_0x1e2e('0xe')]);router['post']('/',auth[_0x1e2e('0x8')](),controller[_0x1e2e('0xf')]);router[_0x1e2e('0x10')](_0x1e2e('0xd'),auth['isAuthenticated'](),controller[_0x1e2e('0x11')]);router[_0x1e2e('0x12')]('/:id',auth[_0x1e2e('0x8')](),controller[_0x1e2e('0x13')]);module[_0x1e2e('0x14')]=router; \ No newline at end of file +var _0x9c02=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe','show','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x126fe7,_0x19bdca){var _0x4f83e5=function(_0x314907){while(--_0x314907){_0x126fe7['push'](_0x126fe7['shift']());}};_0x4f83e5(++_0x19bdca);}(_0x9c02,0x104));var _0x29c0=function(_0x4a7e3f,_0x3fc5a1){_0x4a7e3f=_0x4a7e3f-0x0;var _0x160ac9=_0x9c02[_0x4a7e3f];return _0x160ac9;};'use strict';var multer=require(_0x29c0('0x0'));var util=require(_0x29c0('0x1'));var path=require(_0x29c0('0x2'));var timeout=require(_0x29c0('0x3'));var express=require(_0x29c0('0x4'));var router=express[_0x29c0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x29c0('0x6'));var interaction=require(_0x29c0('0x7'));var config=require(_0x29c0('0x8'));var controller=require(_0x29c0('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x29c0('0xa')](_0x29c0('0xb'),auth[_0x29c0('0xc')](),controller[_0x29c0('0xd')]);router[_0x29c0('0xa')]('/:id',auth[_0x29c0('0xc')](),controller[_0x29c0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x29c0('0xf')]);router[_0x29c0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x29c0('0x11')]);router[_0x29c0('0x12')](_0x29c0('0x13'),auth[_0x29c0('0xc')](),controller[_0x29c0('0x14')]);module[_0x29c0('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 158b0eb..cbc38b6 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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0x49e4b6,_0x3b1205){_0x49e4b6=_0x49e4b6-0x0;var _0x15ce69=_0x7a54[_0x49e4b6];return _0x15ce69;};'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(_0x3eb14b,_0x26538e){_0x3eb14b=_0x3eb14b-0x0;var _0x26ee4e=_0x7a54[_0x3eb14b];return _0x26ee4e;};'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 c71ba5c..c8e3672 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 _0xbb24=['name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x1ee413,_0xb2c7e9){var _0x47114e=function(_0x58e7b8){while(--_0x58e7b8){_0x1ee413['push'](_0x1ee413['shift']());}};_0x47114e(++_0xb2c7e9);}(_0xbb24,0xc3));var _0x4bb2=function(_0x2b264c,_0x119a1f){_0x2b264c=_0x2b264c-0x0;var _0xe41d02=_0xbb24[_0x2b264c];return _0xe41d02;};'use strict';var emlformat=require(_0x4bb2('0x0'));var rimraf=require(_0x4bb2('0x1'));var zipdir=require(_0x4bb2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4bb2('0x3'));var moment=require(_0x4bb2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4bb2('0x5'));var util=require(_0x4bb2('0x6'));var path=require(_0x4bb2('0x7'));var sox=require(_0x4bb2('0x8'));var csv=require(_0x4bb2('0x9'));var ejs=require(_0x4bb2('0xa'));var fs=require('fs');var fs_extra=require(_0x4bb2('0xb'));var _=require(_0x4bb2('0xc'));var squel=require(_0x4bb2('0xd'));var crypto=require(_0x4bb2('0xe'));var jsforce=require(_0x4bb2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4bb2('0x10'));var Papa=require(_0x4bb2('0x11'));var Redis=require(_0x4bb2('0x12'));var authService=require(_0x4bb2('0x13'));var qs=require(_0x4bb2('0x14'));var as=require(_0x4bb2('0x15'));var hardwareService=require(_0x4bb2('0x16'));var logger=require('../../config/logger')(_0x4bb2('0x17'));var utils=require(_0x4bb2('0x18'));var config=require(_0x4bb2('0x19'));var licenseUtil=require(_0x4bb2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x514d89,_0x19ca0a){_0x19ca0a=_0x19ca0a||0xcc;return function(_0x879038){if(_0x879038){return _0x514d89['sendStatus'](_0x19ca0a);}return _0x514d89[_0x4bb2('0x1b')](_0x19ca0a)['end']();};}function respondWithResult(_0x467a97,_0x54f67b){_0x54f67b=_0x54f67b||0xc8;return function(_0x4e3ac4){if(_0x4e3ac4){return _0x467a97[_0x4bb2('0x1b')](_0x54f67b)[_0x4bb2('0x1c')](_0x4e3ac4);}};}function respondWithFilteredResult(_0x371f5e,_0xee36a5){return function(_0x2d472e){if(_0x2d472e){var _0x1d825e=typeof _0xee36a5[_0x4bb2('0x1d')]===_0x4bb2('0x1e')&&typeof _0xee36a5[_0x4bb2('0x1f')]==='undefined';var _0x154ed3=_0x2d472e[_0x4bb2('0x20')];var _0x5b6f3b=_0x1d825e?0x0:_0xee36a5['offset'];var _0x1153f0=_0x1d825e?_0x2d472e[_0x4bb2('0x20')]:_0xee36a5[_0x4bb2('0x1d')]+_0xee36a5[_0x4bb2('0x1f')];var _0xf96f13;if(_0x1153f0>=_0x154ed3){_0x1153f0=_0x154ed3;_0xf96f13=0xc8;}else{_0xf96f13=0xce;}_0x371f5e['status'](_0xf96f13);return _0x371f5e[_0x4bb2('0x21')](_0x4bb2('0x22'),_0x5b6f3b+'-'+_0x1153f0+'/'+_0x154ed3)[_0x4bb2('0x1c')](_0x2d472e);}return null;};}function patchUpdates(_0x44e173){return function(_0x5b8548){try{jsonpatch[_0x4bb2('0x23')](_0x5b8548,_0x44e173,!![]);}catch(_0x45c918){return BPromise[_0x4bb2('0x24')](_0x45c918);}return _0x5b8548[_0x4bb2('0x25')]();};}function saveUpdates(_0x1c440f,_0x1cd421){return function(_0x5ce308){if(_0x5ce308){return _0x5ce308[_0x4bb2('0x26')](_0x1c440f)[_0x4bb2('0x27')](function(_0x1fe082){return _0x1fe082;});}return null;};}function removeEntity(_0x54697e,_0x2a5150){return function(_0x3b0a2d){if(_0x3b0a2d){return _0x3b0a2d[_0x4bb2('0x28')]()['then'](function(){_0x54697e[_0x4bb2('0x1b')](0xcc)[_0x4bb2('0x29')]();});}};}function handleEntityNotFound(_0x4225fc,_0x459039){return function(_0xdf950a){if(!_0xdf950a){_0x4225fc[_0x4bb2('0x2a')](0x194);}return _0xdf950a;};}function handleError(_0x2ff447,_0x34112c){_0x34112c=_0x34112c||0x1f4;return function(_0x262aba){logger[_0x4bb2('0x2b')](_0x262aba[_0x4bb2('0x2c')]);if(_0x262aba[_0x4bb2('0x2d')]){delete _0x262aba[_0x4bb2('0x2d')];}_0x2ff447[_0x4bb2('0x1b')](_0x34112c)[_0x4bb2('0x2e')](_0x262aba);};}exports['index']=function(_0x3cb75b,_0x40acc1){var _0x24172b={},_0x13ced0={},_0x5c8317={'count':0x0,'rows':[]};var _0x26bdcf=_[_0x4bb2('0x2f')](db[_0x4bb2('0x30')][_0x4bb2('0x31')],function(_0x2780ef){return{'name':_0x2780ef[_0x4bb2('0x32')],'type':_0x2780ef[_0x4bb2('0x33')][_0x4bb2('0x34')]};});_0x13ced0[_0x4bb2('0x35')]=_[_0x4bb2('0x2f')](_0x26bdcf,_0x4bb2('0x2d'));_0x13ced0[_0x4bb2('0x36')]=_[_0x4bb2('0x37')](_0x3cb75b[_0x4bb2('0x36')]);_0x13ced0[_0x4bb2('0x38')]=_[_0x4bb2('0x39')](_0x13ced0[_0x4bb2('0x35')],_0x13ced0[_0x4bb2('0x36')]);_0x24172b['attributes']=_['intersection'](_0x13ced0[_0x4bb2('0x35')],qs['fields'](_0x3cb75b[_0x4bb2('0x36')]['fields']));_0x24172b[_0x4bb2('0x3a')]=_0x24172b[_0x4bb2('0x3a')][_0x4bb2('0x3b')]?_0x24172b[_0x4bb2('0x3a')]:_0x13ced0[_0x4bb2('0x35')];if(!_0x3cb75b[_0x4bb2('0x36')][_0x4bb2('0x3c')](_0x4bb2('0x3d'))){_0x24172b[_0x4bb2('0x1f')]=qs[_0x4bb2('0x1f')](_0x3cb75b[_0x4bb2('0x36')][_0x4bb2('0x1f')]);_0x24172b['offset']=qs['offset'](_0x3cb75b[_0x4bb2('0x36')][_0x4bb2('0x1d')]);}_0x24172b[_0x4bb2('0x3e')]=qs[_0x4bb2('0x3f')](_0x3cb75b[_0x4bb2('0x36')][_0x4bb2('0x3f')]);_0x24172b[_0x4bb2('0x40')]=qs[_0x4bb2('0x38')](_[_0x4bb2('0x41')](_0x3cb75b[_0x4bb2('0x36')],_0x13ced0['filters']),_0x26bdcf);if(_0x3cb75b[_0x4bb2('0x36')][_0x4bb2('0x42')]){_0x24172b[_0x4bb2('0x40')]=_[_0x4bb2('0x43')](_0x24172b[_0x4bb2('0x40')],{'$or':_[_0x4bb2('0x2f')](_0x26bdcf,function(_0x22a9e1){if(_0x22a9e1[_0x4bb2('0x33')]!==_0x4bb2('0x44')){var _0x1a600d={};_0x1a600d[_0x22a9e1[_0x4bb2('0x2d')]]={'$like':'%'+_0x3cb75b[_0x4bb2('0x36')][_0x4bb2('0x42')]+'%'};return _0x1a600d;}})});}_0x24172b=_[_0x4bb2('0x43')]({},_0x24172b,_0x3cb75b[_0x4bb2('0x45')]);var _0x1cf960={'where':_0x24172b[_0x4bb2('0x40')]};return db[_0x4bb2('0x30')][_0x4bb2('0x20')](_0x1cf960)[_0x4bb2('0x27')](function(_0x3b13fd){_0x5c8317['count']=_0x3b13fd;if(_0x3cb75b[_0x4bb2('0x36')]['includeAll']){_0x24172b[_0x4bb2('0x46')]=[{'all':!![]}];}return db[_0x4bb2('0x30')]['findAll'](_0x24172b);})['then'](function(_0x594d01){_0x5c8317[_0x4bb2('0x47')]=_0x594d01;return _0x5c8317;})['then'](respondWithFilteredResult(_0x40acc1,_0x24172b))['catch'](handleError(_0x40acc1,null));};exports[_0x4bb2('0x48')]=function(_0x2390ee,_0x219ab3){var _0x287bd4={'raw':!![],'where':{'id':_0x2390ee[_0x4bb2('0x49')]['id']}},_0x28cef3={};_0x28cef3[_0x4bb2('0x35')]=_[_0x4bb2('0x37')](db[_0x4bb2('0x30')]['rawAttributes']);_0x28cef3[_0x4bb2('0x36')]=_[_0x4bb2('0x37')](_0x2390ee[_0x4bb2('0x36')]);_0x28cef3[_0x4bb2('0x38')]=_[_0x4bb2('0x39')](_0x28cef3[_0x4bb2('0x35')],_0x28cef3[_0x4bb2('0x36')]);_0x287bd4[_0x4bb2('0x3a')]=_[_0x4bb2('0x39')](_0x28cef3[_0x4bb2('0x35')],qs['fields'](_0x2390ee['query']['fields']));_0x287bd4[_0x4bb2('0x3a')]=_0x287bd4[_0x4bb2('0x3a')][_0x4bb2('0x3b')]?_0x287bd4['attributes']:_0x28cef3[_0x4bb2('0x35')];if(_0x2390ee['query'][_0x4bb2('0x4a')]){_0x287bd4[_0x4bb2('0x46')]=[{'all':!![]}];}_0x287bd4=_[_0x4bb2('0x43')]({},_0x287bd4,_0x2390ee['options']);return db[_0x4bb2('0x30')][_0x4bb2('0x4b')](_0x287bd4)[_0x4bb2('0x27')](handleEntityNotFound(_0x219ab3,null))['then'](respondWithResult(_0x219ab3,null))[_0x4bb2('0x4c')](handleError(_0x219ab3,null));};exports[_0x4bb2('0x4d')]=function(_0x492528,_0x3aaa53){return db[_0x4bb2('0x30')][_0x4bb2('0x4d')](_0x492528[_0x4bb2('0x4e')],{})[_0x4bb2('0x27')](respondWithResult(_0x3aaa53,0xc9))['catch'](handleError(_0x3aaa53,null));};exports[_0x4bb2('0x26')]=function(_0x1461bc,_0x2a2ba2){if(_0x1461bc[_0x4bb2('0x4e')]['id']){delete _0x1461bc[_0x4bb2('0x4e')]['id'];}return db[_0x4bb2('0x30')][_0x4bb2('0x4b')]({'where':{'id':_0x1461bc[_0x4bb2('0x49')]['id']}})[_0x4bb2('0x27')](handleEntityNotFound(_0x2a2ba2,null))['then'](saveUpdates(_0x1461bc[_0x4bb2('0x4e')],null))['then'](respondWithResult(_0x2a2ba2,null))[_0x4bb2('0x4c')](handleError(_0x2a2ba2,null));};exports[_0x4bb2('0x28')]=function(_0x597511,_0x29f3cb){return db[_0x4bb2('0x30')][_0x4bb2('0x4b')]({'where':{'id':_0x597511[_0x4bb2('0x49')]['id']}})['then'](handleEntityNotFound(_0x29f3cb,null))['then'](removeEntity(_0x29f3cb,null))[_0x4bb2('0x4c')](handleError(_0x29f3cb,null));};exports[_0x4bb2('0x4f')]=function(_0x5c6b9e,_0x1bfd0){return db['JscriptyQuestionReport']['describe']()[_0x4bb2('0x27')](respondWithResult(_0x1bfd0,null))[_0x4bb2('0x4c')](handleError(_0x1bfd0,null));}; \ No newline at end of file +var _0xdbd7=['name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','JscriptyQuestionReport','findAll','catch','show','params','rawAttributes','include','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error'];(function(_0xed1d04,_0x539fbf){var _0xff4bec=function(_0xed87e4){while(--_0xed87e4){_0xed1d04['push'](_0xed1d04['shift']());}};_0xff4bec(++_0x539fbf);}(_0xdbd7,0x171));var _0x7dbd=function(_0x483428,_0x57ccc7){_0x483428=_0x483428-0x0;var _0x4a69e4=_0xdbd7[_0x483428];return _0x4a69e4;};'use strict';var emlformat=require(_0x7dbd('0x0'));var rimraf=require(_0x7dbd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dbd('0x2'));var rp=require('request-promise');var moment=require(_0x7dbd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7dbd('0x4'));var util=require(_0x7dbd('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7dbd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dbd('0x7'));var squel=require('squel');var crypto=require(_0x7dbd('0x8'));var jsforce=require(_0x7dbd('0x9'));var deskjs=require(_0x7dbd('0xa'));var toCsv=require(_0x7dbd('0x6'));var querystring=require('querystring');var Papa=require(_0x7dbd('0xb'));var Redis=require(_0x7dbd('0xc'));var authService=require(_0x7dbd('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7dbd('0xe'))('api');var utils=require(_0x7dbd('0xf'));var config=require(_0x7dbd('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x7dbd('0x11'))['db'];function respondWithStatusCode(_0x5b5275,_0x16a8a5){_0x16a8a5=_0x16a8a5||0xcc;return function(_0x444f5a){if(_0x444f5a){return _0x5b5275[_0x7dbd('0x12')](_0x16a8a5);}return _0x5b5275[_0x7dbd('0x13')](_0x16a8a5)[_0x7dbd('0x14')]();};}function respondWithResult(_0x37668d,_0x2954a2){_0x2954a2=_0x2954a2||0xc8;return function(_0x252a1c){if(_0x252a1c){return _0x37668d['status'](_0x2954a2)[_0x7dbd('0x15')](_0x252a1c);}};}function respondWithFilteredResult(_0x67ca8f,_0x192693){return function(_0x3729ca){if(_0x3729ca){var _0x2f2dcd=typeof _0x192693[_0x7dbd('0x16')]===_0x7dbd('0x17')&&typeof _0x192693[_0x7dbd('0x18')]==='undefined';var _0x33acec=_0x3729ca['count'];var _0x5826f4=_0x2f2dcd?0x0:_0x192693[_0x7dbd('0x16')];var _0x24e525=_0x2f2dcd?_0x3729ca[_0x7dbd('0x19')]:_0x192693[_0x7dbd('0x16')]+_0x192693[_0x7dbd('0x18')];var _0x251258;if(_0x24e525>=_0x33acec){_0x24e525=_0x33acec;_0x251258=0xc8;}else{_0x251258=0xce;}_0x67ca8f[_0x7dbd('0x13')](_0x251258);return _0x67ca8f[_0x7dbd('0x1a')](_0x7dbd('0x1b'),_0x5826f4+'-'+_0x24e525+'/'+_0x33acec)['json'](_0x3729ca);}return null;};}function patchUpdates(_0x1c6000){return function(_0x43ec40){try{jsonpatch[_0x7dbd('0x1c')](_0x43ec40,_0x1c6000,!![]);}catch(_0x335bdc){return BPromise['reject'](_0x335bdc);}return _0x43ec40[_0x7dbd('0x1d')]();};}function saveUpdates(_0x1064a0,_0x12fc76){return function(_0x4df9ae){if(_0x4df9ae){return _0x4df9ae[_0x7dbd('0x1e')](_0x1064a0)[_0x7dbd('0x1f')](function(_0x2130b0){return _0x2130b0;});}return null;};}function removeEntity(_0x3bcc27,_0x1db3ae){return function(_0x4bded0){if(_0x4bded0){return _0x4bded0['destroy']()['then'](function(){_0x3bcc27[_0x7dbd('0x13')](0xcc)[_0x7dbd('0x14')]();});}};}function handleEntityNotFound(_0x5d6937,_0x4a6916){return function(_0x43c76d){if(!_0x43c76d){_0x5d6937[_0x7dbd('0x12')](0x194);}return _0x43c76d;};}function handleError(_0x2587cb,_0x389302){_0x389302=_0x389302||0x1f4;return function(_0x19e5e6){logger[_0x7dbd('0x20')](_0x19e5e6['stack']);if(_0x19e5e6[_0x7dbd('0x21')]){delete _0x19e5e6['name'];}_0x2587cb['status'](_0x389302)['send'](_0x19e5e6);};}exports[_0x7dbd('0x22')]=function(_0x5bec36,_0xe89f4f){var _0x36a0b3={},_0x57927c={},_0x526966={'count':0x0,'rows':[]};var _0x16b940=_[_0x7dbd('0x23')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x331193){return{'name':_0x331193[_0x7dbd('0x24')],'type':_0x331193['type'][_0x7dbd('0x25')]};});_0x57927c[_0x7dbd('0x26')]=_['map'](_0x16b940,_0x7dbd('0x21'));_0x57927c[_0x7dbd('0x27')]=_[_0x7dbd('0x28')](_0x5bec36[_0x7dbd('0x27')]);_0x57927c[_0x7dbd('0x29')]=_[_0x7dbd('0x2a')](_0x57927c[_0x7dbd('0x26')],_0x57927c[_0x7dbd('0x27')]);_0x36a0b3[_0x7dbd('0x2b')]=_[_0x7dbd('0x2a')](_0x57927c[_0x7dbd('0x26')],qs['fields'](_0x5bec36[_0x7dbd('0x27')][_0x7dbd('0x2c')]));_0x36a0b3[_0x7dbd('0x2b')]=_0x36a0b3[_0x7dbd('0x2b')][_0x7dbd('0x2d')]?_0x36a0b3[_0x7dbd('0x2b')]:_0x57927c['model'];if(!_0x5bec36['query']['hasOwnProperty']('nolimit')){_0x36a0b3['limit']=qs[_0x7dbd('0x18')](_0x5bec36['query'][_0x7dbd('0x18')]);_0x36a0b3[_0x7dbd('0x16')]=qs[_0x7dbd('0x16')](_0x5bec36[_0x7dbd('0x27')][_0x7dbd('0x16')]);}_0x36a0b3[_0x7dbd('0x2e')]=qs[_0x7dbd('0x2f')](_0x5bec36['query'][_0x7dbd('0x2f')]);_0x36a0b3[_0x7dbd('0x30')]=qs[_0x7dbd('0x29')](_[_0x7dbd('0x31')](_0x5bec36[_0x7dbd('0x27')],_0x57927c['filters']),_0x16b940);if(_0x5bec36[_0x7dbd('0x27')]['filter']){_0x36a0b3[_0x7dbd('0x30')]=_[_0x7dbd('0x32')](_0x36a0b3[_0x7dbd('0x30')],{'$or':_[_0x7dbd('0x23')](_0x16b940,function(_0x5aa208){if(_0x5aa208[_0x7dbd('0x33')]!==_0x7dbd('0x34')){var _0x5f1485={};_0x5f1485[_0x5aa208[_0x7dbd('0x21')]]={'$like':'%'+_0x5bec36[_0x7dbd('0x27')]['filter']+'%'};return _0x5f1485;}})});}_0x36a0b3=_['merge']({},_0x36a0b3,_0x5bec36[_0x7dbd('0x35')]);var _0x222947={'where':_0x36a0b3['where']};return db['JscriptyQuestionReport'][_0x7dbd('0x19')](_0x222947)[_0x7dbd('0x1f')](function(_0x5090f6){_0x526966[_0x7dbd('0x19')]=_0x5090f6;if(_0x5bec36[_0x7dbd('0x27')][_0x7dbd('0x36')]){_0x36a0b3['include']=[{'all':!![]}];}return db[_0x7dbd('0x37')][_0x7dbd('0x38')](_0x36a0b3);})[_0x7dbd('0x1f')](function(_0x57cf38){_0x526966['rows']=_0x57cf38;return _0x526966;})[_0x7dbd('0x1f')](respondWithFilteredResult(_0xe89f4f,_0x36a0b3))[_0x7dbd('0x39')](handleError(_0xe89f4f,null));};exports[_0x7dbd('0x3a')]=function(_0x41c6df,_0x4d5380){var _0x3b6b3b={'raw':!![],'where':{'id':_0x41c6df[_0x7dbd('0x3b')]['id']}},_0x49138c={};_0x49138c['model']=_[_0x7dbd('0x28')](db[_0x7dbd('0x37')][_0x7dbd('0x3c')]);_0x49138c[_0x7dbd('0x27')]=_[_0x7dbd('0x28')](_0x41c6df[_0x7dbd('0x27')]);_0x49138c['filters']=_['intersection'](_0x49138c[_0x7dbd('0x26')],_0x49138c[_0x7dbd('0x27')]);_0x3b6b3b['attributes']=_['intersection'](_0x49138c[_0x7dbd('0x26')],qs[_0x7dbd('0x2c')](_0x41c6df['query']['fields']));_0x3b6b3b[_0x7dbd('0x2b')]=_0x3b6b3b['attributes'][_0x7dbd('0x2d')]?_0x3b6b3b['attributes']:_0x49138c[_0x7dbd('0x26')];if(_0x41c6df[_0x7dbd('0x27')][_0x7dbd('0x36')]){_0x3b6b3b[_0x7dbd('0x3d')]=[{'all':!![]}];}_0x3b6b3b=_[_0x7dbd('0x32')]({},_0x3b6b3b,_0x41c6df[_0x7dbd('0x35')]);return db[_0x7dbd('0x37')]['find'](_0x3b6b3b)[_0x7dbd('0x1f')](handleEntityNotFound(_0x4d5380,null))['then'](respondWithResult(_0x4d5380,null))[_0x7dbd('0x39')](handleError(_0x4d5380,null));};exports[_0x7dbd('0x3e')]=function(_0x207c9f,_0x107358){return db[_0x7dbd('0x37')][_0x7dbd('0x3e')](_0x207c9f[_0x7dbd('0x3f')],{})[_0x7dbd('0x1f')](respondWithResult(_0x107358,0xc9))[_0x7dbd('0x39')](handleError(_0x107358,null));};exports[_0x7dbd('0x1e')]=function(_0x328ccd,_0x334b5b){if(_0x328ccd[_0x7dbd('0x3f')]['id']){delete _0x328ccd['body']['id'];}return db[_0x7dbd('0x37')][_0x7dbd('0x40')]({'where':{'id':_0x328ccd['params']['id']}})[_0x7dbd('0x1f')](handleEntityNotFound(_0x334b5b,null))[_0x7dbd('0x1f')](saveUpdates(_0x328ccd[_0x7dbd('0x3f')],null))[_0x7dbd('0x1f')](respondWithResult(_0x334b5b,null))[_0x7dbd('0x39')](handleError(_0x334b5b,null));};exports[_0x7dbd('0x41')]=function(_0x5e1a3a,_0x2bfebb){return db['JscriptyQuestionReport'][_0x7dbd('0x40')]({'where':{'id':_0x5e1a3a[_0x7dbd('0x3b')]['id']}})[_0x7dbd('0x1f')](handleEntityNotFound(_0x2bfebb,null))[_0x7dbd('0x1f')](removeEntity(_0x2bfebb,null))['catch'](handleError(_0x2bfebb,null));};exports[_0x7dbd('0x42')]=function(_0x1aede8,_0x4f4b2f){return db[_0x7dbd('0x37')][_0x7dbd('0x42')]()[_0x7dbd('0x1f')](respondWithResult(_0x4f4b2f,null))[_0x7dbd('0x39')](handleError(_0x4f4b2f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index cdbde8d..35c2bcc 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 _0xdb1d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xdb1d,0x1a1));var _0xddb1=function(_0x11056d,_0x1826da){_0x11056d=_0x11056d-0x0;var _0x59f7d9=_0xdb1d[_0x11056d];return _0x59f7d9;};'use strict';var _=require(_0xddb1('0x0'));var util=require(_0xddb1('0x1'));var logger=require(_0xddb1('0x2'))(_0xddb1('0x3'));var moment=require('moment');var BPromise=require(_0xddb1('0x4'));var rp=require(_0xddb1('0x5'));var fs=require('fs');var path=require(_0xddb1('0x6'));var rimraf=require(_0xddb1('0x7'));var config=require(_0xddb1('0x8'));var attributes=require(_0xddb1('0x9'));module['exports']=function(_0x5c508f,_0x1095f0){return _0x5c508f['define'](_0xddb1('0xa'),attributes,{'tableName':_0xddb1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5847=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x3a6922,_0xc728be){var _0x9c1b44=function(_0x4ffb5e){while(--_0x4ffb5e){_0x3a6922['push'](_0x3a6922['shift']());}};_0x9c1b44(++_0xc728be);}(_0x5847,0x178));var _0x7584=function(_0x4aa0e8,_0x3ed33a){_0x4aa0e8=_0x4aa0e8-0x0;var _0xd0d06d=_0x5847[_0x4aa0e8];return _0xd0d06d;};'use strict';var _=require(_0x7584('0x0'));var util=require(_0x7584('0x1'));var logger=require(_0x7584('0x2'))(_0x7584('0x3'));var moment=require(_0x7584('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7584('0x5'));var rimraf=require(_0x7584('0x6'));var config=require(_0x7584('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x7584('0x8')]=function(_0x5b55a7,_0x45bbb9){return _0x5b55a7[_0x7584('0x9')](_0x7584('0xa'),attributes,{'tableName':_0x7584('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 7653d5b..2aef1e0 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 _0x2229=['../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x334315,_0x4b2526){var _0x4f044b=function(_0x5adba7){while(--_0x5adba7){_0x334315['push'](_0x334315['shift']());}};_0x4f044b(++_0x4b2526);}(_0x2229,0x9a));var _0x9222=function(_0x4f9449,_0x44f559){_0x4f9449=_0x4f9449-0x0;var _0x5d1884=_0x2229[_0x4f9449];return _0x5d1884;};'use strict';var _=require(_0x9222('0x0'));var util=require(_0x9222('0x1'));var moment=require(_0x9222('0x2'));var BPromise=require('bluebird');var rs=require(_0x9222('0x3'));var fs=require('fs');var Redis=require(_0x9222('0x4'));var db=require(_0x9222('0x5'))['db'];var utils=require(_0x9222('0x6'));var logger=require(_0x9222('0x7'))(_0x9222('0x8'));var config=require(_0x9222('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9222('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a576a,_0x33f203,_0xe5923c){return new BPromise(function(_0x3ec731,_0xe006b7){return client[_0x9222('0xb')](_0x2a576a,_0xe5923c)['then'](function(_0x2eeae3){logger[_0x9222('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x33f203,_0x9222('0xd'));logger[_0x9222('0xe')](_0x9222('0xf'),_0x33f203,_0x9222('0xd'),JSON[_0x9222('0x10')](_0x2eeae3));if(_0x2eeae3[_0x9222('0x11')]){if(_0x2eeae3[_0x9222('0x11')][_0x9222('0x12')]===0x1f4){logger[_0x9222('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x33f203,_0x2eeae3['error'][_0x9222('0x13')]);return _0xe006b7(_0x2eeae3[_0x9222('0x11')][_0x9222('0x13')]);}logger[_0x9222('0x11')](_0x9222('0x14'),_0x33f203,_0x2eeae3[_0x9222('0x11')][_0x9222('0x13')]);return _0x3ec731(_0x2eeae3['error'][_0x9222('0x13')]);}else{logger[_0x9222('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x33f203,_0x9222('0xd'));_0x3ec731(_0x2eeae3[_0x9222('0x15')][_0x9222('0x13')]);}})[_0x9222('0x16')](function(_0x3ae0f2){logger[_0x9222('0x11')](_0x9222('0x14'),_0x33f203,_0x3ae0f2);_0xe006b7(_0x3ae0f2);});});} \ No newline at end of file +var _0x86a1=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0x86a1,0xb6));var _0x186a=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x86a1[_0x533110];return _0xc3c866;};'use strict';var _=require(_0x186a('0x0'));var util=require(_0x186a('0x1'));var moment=require(_0x186a('0x2'));var BPromise=require(_0x186a('0x3'));var rs=require(_0x186a('0x4'));var fs=require('fs');var Redis=require(_0x186a('0x5'));var db=require(_0x186a('0x6'))['db'];var utils=require(_0x186a('0x7'));var logger=require(_0x186a('0x8'))('rpc');var config=require(_0x186a('0x9'));var jayson=require(_0x186a('0xa'));var client=jayson[_0x186a('0xb')][_0x186a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27e103,_0x55da9d,_0x1d7ef3){return new BPromise(function(_0x60838d,_0x3dff64){return client[_0x186a('0xd')](_0x27e103,_0x1d7ef3)[_0x186a('0xe')](function(_0x546afa){logger[_0x186a('0xf')](_0x186a('0x10'),_0x55da9d,_0x186a('0x11'));logger[_0x186a('0x12')](_0x186a('0x13'),_0x55da9d,_0x186a('0x11'),JSON['stringify'](_0x546afa));if(_0x546afa[_0x186a('0x14')]){if(_0x546afa[_0x186a('0x14')]['code']===0x1f4){logger[_0x186a('0x14')](_0x186a('0x10'),_0x55da9d,_0x546afa[_0x186a('0x14')][_0x186a('0x15')]);return _0x3dff64(_0x546afa[_0x186a('0x14')]['message']);}logger[_0x186a('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x55da9d,_0x546afa[_0x186a('0x14')][_0x186a('0x15')]);return _0x60838d(_0x546afa[_0x186a('0x14')][_0x186a('0x15')]);}else{logger['info'](_0x186a('0x10'),_0x55da9d,_0x186a('0x11'));_0x60838d(_0x546afa['result'][_0x186a('0x15')]);}})['catch'](function(_0x27243a){logger[_0x186a('0x14')](_0x186a('0x10'),_0x55da9d,_0x27243a);_0x3dff64(_0x27243a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 397db83..c066936 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 _0x6410=['/:id','show','/:id/questions','getQuestions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x2ce71c,_0x4a403e){var _0x223e00=function(_0x291496){while(--_0x291496){_0x2ce71c['push'](_0x2ce71c['shift']());}};_0x223e00(++_0x4a403e);}(_0x6410,0x172));var _0x0641=function(_0x20f803,_0x261284){_0x20f803=_0x20f803-0x0;var _0x1ca559=_0x6410[_0x20f803];return _0x1ca559;};'use strict';var multer=require(_0x0641('0x0'));var util=require(_0x0641('0x1'));var path=require(_0x0641('0x2'));var timeout=require(_0x0641('0x3'));var express=require(_0x0641('0x4'));var router=express['Router']();var fs_extra=require(_0x0641('0x5'));var auth=require(_0x0641('0x6'));var interaction=require(_0x0641('0x7'));var config=require(_0x0641('0x8'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x0641('0x9')](),controller[_0x0641('0xa')]);router[_0x0641('0xb')](_0x0641('0xc'),auth[_0x0641('0x9')](),controller[_0x0641('0xd')]);router[_0x0641('0xb')](_0x0641('0xe'),auth['isAuthenticated'](),controller[_0x0641('0xf')]);router[_0x0641('0xb')](_0x0641('0x10'),auth[_0x0641('0x9')](),controller[_0x0641('0x11')]);router[_0x0641('0x12')]('/',auth[_0x0641('0x9')](),controller[_0x0641('0x13')]);router[_0x0641('0x14')](_0x0641('0xe'),auth[_0x0641('0x9')](),controller['update']);router[_0x0641('0x15')](_0x0641('0xe'),auth[_0x0641('0x9')](),controller[_0x0641('0x16')]);module[_0x0641('0x17')]=router; \ No newline at end of file +var _0xefae=['/describe','describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','post','create','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc7089,_0x4768dd){var _0x1f9bf6=function(_0x2b7ccf){while(--_0x2b7ccf){_0xc7089['push'](_0xc7089['shift']());}};_0x1f9bf6(++_0x4768dd);}(_0xefae,0x1ef));var _0xeefa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xefae[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xeefa('0x0'));var util=require(_0xeefa('0x1'));var path=require(_0xeefa('0x2'));var timeout=require(_0xeefa('0x3'));var express=require('express');var router=express[_0xeefa('0x4')]();var fs_extra=require(_0xeefa('0x5'));var auth=require(_0xeefa('0x6'));var interaction=require(_0xeefa('0x7'));var config=require(_0xeefa('0x8'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xeefa('0x9'),auth['isAuthenticated'](),controller[_0xeefa('0xa')]);router['get'](_0xeefa('0xb'),auth[_0xeefa('0xc')](),controller[_0xeefa('0xd')]);router['get'](_0xeefa('0xe'),auth[_0xeefa('0xc')](),controller[_0xeefa('0xf')]);router[_0xeefa('0x10')]('/',auth[_0xeefa('0xc')](),controller[_0xeefa('0x11')]);router['put'](_0xeefa('0xb'),auth['isAuthenticated'](),controller[_0xeefa('0x12')]);router[_0xeefa('0x13')](_0xeefa('0xb'),auth[_0xeefa('0xc')](),controller['destroy']);module[_0xeefa('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f87e722..e9bd0f7 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 _0x53ea=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','starttime','setDataValue'];(function(_0x3e77ed,_0x3dec1d){var _0x17d3b1=function(_0x1039ce){while(--_0x1039ce){_0x3e77ed['push'](_0x3e77ed['shift']());}};_0x17d3b1(++_0x3dec1d);}(_0x53ea,0x16c));var _0xa53e=function(_0x4cc812,_0x18f2d5){_0x4cc812=_0x4cc812-0x0;var _0x3e54f0=_0x53ea[_0x4cc812];return _0x3e54f0;};'use strict';var moment=require(_0xa53e('0x0'));var Sequelize=require(_0xa53e('0x1'));module[_0xa53e('0x2')]={'starttime':{'type':Sequelize[_0xa53e('0x3')],'set':function(_0x1fed8e){this['setDataValue'](_0xa53e('0x4'),_0x1fed8e);this[_0xa53e('0x5')](_0xa53e('0x6'),moment()[_0xa53e('0x7')](_0xa53e('0x8')));}},'endtime':{'type':Sequelize[_0xa53e('0x3')]},'membername':{'type':Sequelize[_0xa53e('0x9')]},'projectname':{'type':Sequelize[_0xa53e('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa53e('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9d44=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x419c0c,_0x2598ad){var _0x391694=function(_0x530772){while(--_0x530772){_0x419c0c['push'](_0x419c0c['shift']());}};_0x391694(++_0x2598ad);}(_0x9d44,0x1af));var _0x49d4=function(_0x4fb9ed,_0x187ea0){_0x4fb9ed=_0x4fb9ed-0x0;var _0x263645=_0x9d44[_0x4fb9ed];return _0x263645;};'use strict';var moment=require(_0x49d4('0x0'));var Sequelize=require(_0x49d4('0x1'));module[_0x49d4('0x2')]={'starttime':{'type':Sequelize[_0x49d4('0x3')],'set':function(_0x11b0fc){this[_0x49d4('0x4')](_0x49d4('0x5'),_0x11b0fc);this[_0x49d4('0x4')](_0x49d4('0x6'),moment()[_0x49d4('0x7')](_0x49d4('0x8')));}},'endtime':{'type':Sequelize[_0x49d4('0x3')]},'membername':{'type':Sequelize[_0x49d4('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x49d4('0x9')]},'uniqueid':{'type':Sequelize[_0x49d4('0x9')]},'calleridname':{'type':Sequelize[_0x49d4('0x9')]},'calleridnum':{'type':Sequelize[_0x49d4('0x9')]},'completed':{'type':Sequelize[_0x49d4('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 06ad747..35f4049 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 _0x45d9=['../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','JscriptySessionReport','type','model','map','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','keys','length','include','find','create','body','describe','findOne','rawAttributes','pick','SessionId','filter','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45d9,0x1b7));var _0x945d=function(_0x52eba2,_0x6a85b9){_0x52eba2=_0x52eba2-0x0;var _0x93b44d=_0x45d9[_0x52eba2];return _0x93b44d;};'use strict';var emlformat=require(_0x945d('0x0'));var rimraf=require(_0x945d('0x1'));var zipdir=require(_0x945d('0x2'));var jsonpatch=require(_0x945d('0x3'));var rp=require(_0x945d('0x4'));var moment=require(_0x945d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x945d('0x6'));var util=require(_0x945d('0x7'));var path=require(_0x945d('0x8'));var sox=require(_0x945d('0x9'));var csv=require(_0x945d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x945d('0xb'));var _=require(_0x945d('0xc'));var squel=require(_0x945d('0xd'));var crypto=require('crypto');var jsforce=require(_0x945d('0xe'));var deskjs=require(_0x945d('0xf'));var toCsv=require(_0x945d('0xa'));var querystring=require('querystring');var Papa=require(_0x945d('0x10'));var Redis=require('ioredis');var authService=require(_0x945d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x945d('0x12'));var hardwareService=require(_0x945d('0x13'));var logger=require(_0x945d('0x14'))(_0x945d('0x15'));var utils=require(_0x945d('0x16'));var config=require(_0x945d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x325a13,_0x179836){_0x179836=_0x179836||0xcc;return function(_0x123060){if(_0x123060){return _0x325a13[_0x945d('0x18')](_0x179836);}return _0x325a13['status'](_0x179836)['end']();};}function respondWithResult(_0x49c2bc,_0x18dcad){_0x18dcad=_0x18dcad||0xc8;return function(_0x56cfd6){if(_0x56cfd6){return _0x49c2bc[_0x945d('0x19')](_0x18dcad)[_0x945d('0x1a')](_0x56cfd6);}};}function respondWithFilteredResult(_0x12d3bf,_0x4374f4){return function(_0x179004){if(_0x179004){var _0x1c210d=typeof _0x4374f4[_0x945d('0x1b')]===_0x945d('0x1c')&&typeof _0x4374f4[_0x945d('0x1d')]===_0x945d('0x1c');var _0x3ee98c=_0x179004[_0x945d('0x1e')];var _0x28e029=_0x1c210d?0x0:_0x4374f4[_0x945d('0x1b')];var _0x1bcca2=_0x1c210d?_0x179004[_0x945d('0x1e')]:_0x4374f4[_0x945d('0x1b')]+_0x4374f4[_0x945d('0x1d')];var _0x1a3d3e;if(_0x1bcca2>=_0x3ee98c){_0x1bcca2=_0x3ee98c;_0x1a3d3e=0xc8;}else{_0x1a3d3e=0xce;}_0x12d3bf[_0x945d('0x19')](_0x1a3d3e);return _0x12d3bf[_0x945d('0x1f')](_0x945d('0x20'),_0x28e029+'-'+_0x1bcca2+'/'+_0x3ee98c)[_0x945d('0x1a')](_0x179004);}return null;};}function patchUpdates(_0x36dfb8){return function(_0x3aa331){try{jsonpatch[_0x945d('0x21')](_0x3aa331,_0x36dfb8,!![]);}catch(_0x461966){return BPromise[_0x945d('0x22')](_0x461966);}return _0x3aa331[_0x945d('0x23')]();};}function saveUpdates(_0x15fbe6,_0x46b448){return function(_0x5a9143){if(_0x5a9143){return _0x5a9143[_0x945d('0x24')](_0x15fbe6)['then'](function(_0x537cdc){return _0x537cdc;});}return null;};}function removeEntity(_0xc60f4d,_0x418fc6){return function(_0xcaa403){if(_0xcaa403){return _0xcaa403['destroy']()[_0x945d('0x25')](function(){_0xc60f4d[_0x945d('0x19')](0xcc)[_0x945d('0x26')]();});}};}function handleEntityNotFound(_0x2b0138,_0x2e0267){return function(_0x1ad2b8){if(!_0x1ad2b8){_0x2b0138['sendStatus'](0x194);}return _0x1ad2b8;};}function handleError(_0x354421,_0x414e4d){_0x414e4d=_0x414e4d||0x1f4;return function(_0x5412d5){logger[_0x945d('0x27')](_0x5412d5['stack']);if(_0x5412d5[_0x945d('0x28')]){delete _0x5412d5[_0x945d('0x28')];}_0x354421[_0x945d('0x19')](_0x414e4d)[_0x945d('0x29')](_0x5412d5);};}exports['index']=function(_0x28a55b,_0x1fe340){var _0x4d236f={},_0x7cbe91={},_0x426a5b={'count':0x0,'rows':[]};var _0x2e2f19=_['map'](db[_0x945d('0x2a')]['rawAttributes'],function(_0x54e488){return{'name':_0x54e488['fieldName'],'type':_0x54e488[_0x945d('0x2b')]['key']};});_0x7cbe91[_0x945d('0x2c')]=_[_0x945d('0x2d')](_0x2e2f19,_0x945d('0x28'));_0x7cbe91['query']=_['keys'](_0x28a55b['query']);_0x7cbe91[_0x945d('0x2e')]=_[_0x945d('0x2f')](_0x7cbe91[_0x945d('0x2c')],_0x7cbe91[_0x945d('0x30')]);_0x4d236f['attributes']=_['intersection'](_0x7cbe91['model'],qs['fields'](_0x28a55b['query'][_0x945d('0x31')]));_0x4d236f[_0x945d('0x32')]=_0x4d236f[_0x945d('0x32')]['length']?_0x4d236f[_0x945d('0x32')]:_0x7cbe91[_0x945d('0x2c')];if(!_0x28a55b[_0x945d('0x30')][_0x945d('0x33')](_0x945d('0x34'))){_0x4d236f['limit']=qs[_0x945d('0x1d')](_0x28a55b[_0x945d('0x30')][_0x945d('0x1d')]);_0x4d236f[_0x945d('0x1b')]=qs[_0x945d('0x1b')](_0x28a55b[_0x945d('0x30')][_0x945d('0x1b')]);}_0x4d236f[_0x945d('0x35')]=qs['sort'](_0x28a55b[_0x945d('0x30')][_0x945d('0x36')]);_0x4d236f['where']=qs['filters'](_['pick'](_0x28a55b[_0x945d('0x30')],_0x7cbe91[_0x945d('0x2e')]),_0x2e2f19);if(_0x28a55b[_0x945d('0x30')]['filter']){_0x4d236f['where']=_[_0x945d('0x37')](_0x4d236f[_0x945d('0x38')],{'$or':_[_0x945d('0x2d')](_0x2e2f19,function(_0x5e2c1c){if(_0x5e2c1c[_0x945d('0x2b')]!==_0x945d('0x39')){var _0x58c46d={};_0x58c46d[_0x5e2c1c[_0x945d('0x28')]]={'$like':'%'+_0x28a55b[_0x945d('0x30')]['filter']+'%'};return _0x58c46d;}})});}_0x4d236f=_['merge']({},_0x4d236f,_0x28a55b[_0x945d('0x3a')]);var _0x47989b={'where':_0x4d236f['where']};return db[_0x945d('0x2a')]['count'](_0x47989b)[_0x945d('0x25')](function(_0x2674cf){_0x426a5b[_0x945d('0x1e')]=_0x2674cf;if(_0x28a55b[_0x945d('0x30')][_0x945d('0x3b')]){_0x4d236f['include']=[{'all':!![]}];}return db[_0x945d('0x2a')]['findAll'](_0x4d236f);})['then'](function(_0x51a222){_0x426a5b[_0x945d('0x3c')]=_0x51a222;return _0x426a5b;})['then'](respondWithFilteredResult(_0x1fe340,_0x4d236f))[_0x945d('0x3d')](handleError(_0x1fe340,null));};exports[_0x945d('0x3e')]=function(_0x20a7c5,_0x2d9630){var _0xe2744b={'raw':!![],'where':{'id':_0x20a7c5[_0x945d('0x3f')]['id']}},_0x34b62b={};_0x34b62b[_0x945d('0x2c')]=_['keys'](db[_0x945d('0x2a')]['rawAttributes']);_0x34b62b[_0x945d('0x30')]=_[_0x945d('0x40')](_0x20a7c5[_0x945d('0x30')]);_0x34b62b[_0x945d('0x2e')]=_[_0x945d('0x2f')](_0x34b62b['model'],_0x34b62b[_0x945d('0x30')]);_0xe2744b[_0x945d('0x32')]=_['intersection'](_0x34b62b[_0x945d('0x2c')],qs[_0x945d('0x31')](_0x20a7c5[_0x945d('0x30')][_0x945d('0x31')]));_0xe2744b[_0x945d('0x32')]=_0xe2744b[_0x945d('0x32')][_0x945d('0x41')]?_0xe2744b[_0x945d('0x32')]:_0x34b62b[_0x945d('0x2c')];if(_0x20a7c5[_0x945d('0x30')][_0x945d('0x3b')]){_0xe2744b[_0x945d('0x42')]=[{'all':!![]}];}_0xe2744b=_['merge']({},_0xe2744b,_0x20a7c5[_0x945d('0x3a')]);return db[_0x945d('0x2a')][_0x945d('0x43')](_0xe2744b)[_0x945d('0x25')](handleEntityNotFound(_0x2d9630,null))[_0x945d('0x25')](respondWithResult(_0x2d9630,null))[_0x945d('0x3d')](handleError(_0x2d9630,null));};exports['create']=function(_0xb95269,_0x3211f4){return db['JscriptySessionReport'][_0x945d('0x44')](_0xb95269['body'],{})[_0x945d('0x25')](respondWithResult(_0x3211f4,0xc9))[_0x945d('0x3d')](handleError(_0x3211f4,null));};exports['update']=function(_0x30a9ff,_0x5c9e8f){if(_0x30a9ff[_0x945d('0x45')]['id']){delete _0x30a9ff[_0x945d('0x45')]['id'];}return db[_0x945d('0x2a')][_0x945d('0x43')]({'where':{'id':_0x30a9ff[_0x945d('0x3f')]['id']}})[_0x945d('0x25')](handleEntityNotFound(_0x5c9e8f,null))[_0x945d('0x25')](saveUpdates(_0x30a9ff[_0x945d('0x45')],null))[_0x945d('0x25')](respondWithResult(_0x5c9e8f,null))['catch'](handleError(_0x5c9e8f,null));};exports['destroy']=function(_0xf2134e,_0x418dc1){return db[_0x945d('0x2a')][_0x945d('0x43')]({'where':{'id':_0xf2134e['params']['id']}})[_0x945d('0x25')](handleEntityNotFound(_0x418dc1,null))[_0x945d('0x25')](removeEntity(_0x418dc1,null))[_0x945d('0x3d')](handleError(_0x418dc1,null));};exports['describe']=function(_0x1c15f5,_0x12bec6){return db['JscriptySessionReport'][_0x945d('0x46')]()[_0x945d('0x25')](respondWithResult(_0x12bec6,null))[_0x945d('0x3d')](handleError(_0x12bec6,null));};exports['getQuestions']=function(_0x253ba0,_0x401fd9,_0x220054){var _0x5d75b3={'raw':!![],'where':{}};var _0x52e59e={};var _0x2ca646={'count':0x0,'rows':[]};return db[_0x945d('0x2a')][_0x945d('0x47')]({'where':{'id':_0x253ba0[_0x945d('0x3f')]['id']}})[_0x945d('0x25')](handleEntityNotFound(_0x401fd9,null))[_0x945d('0x25')](function(_0x587629){if(_0x587629){_0x52e59e['model']=_['keys'](db['JscriptyQuestionReport'][_0x945d('0x48')]);_0x52e59e[_0x945d('0x30')]=_[_0x945d('0x40')](_0x253ba0[_0x945d('0x30')]);_0x52e59e[_0x945d('0x2e')]=_['intersection'](_0x52e59e[_0x945d('0x2c')],_0x52e59e[_0x945d('0x30')]);_0x5d75b3[_0x945d('0x32')]=_[_0x945d('0x2f')](_0x52e59e['model'],qs[_0x945d('0x31')](_0x253ba0[_0x945d('0x30')][_0x945d('0x31')]));_0x5d75b3[_0x945d('0x32')]=_0x5d75b3[_0x945d('0x32')][_0x945d('0x41')]?_0x5d75b3[_0x945d('0x32')]:_0x52e59e[_0x945d('0x2c')];if(!_0x253ba0[_0x945d('0x30')][_0x945d('0x33')]('nolimit')){_0x5d75b3[_0x945d('0x1d')]=qs[_0x945d('0x1d')](_0x253ba0[_0x945d('0x30')][_0x945d('0x1d')]);_0x5d75b3[_0x945d('0x1b')]=qs['offset'](_0x253ba0['query'][_0x945d('0x1b')]);}_0x5d75b3[_0x945d('0x35')]=qs[_0x945d('0x36')](_0x253ba0[_0x945d('0x30')][_0x945d('0x36')]);_0x5d75b3[_0x945d('0x38')]=qs[_0x945d('0x2e')](_[_0x945d('0x49')](_0x253ba0['query'],_0x52e59e['filters']));_0x5d75b3['where'][_0x945d('0x4a')]=_0x587629['id'];if(_0x253ba0[_0x945d('0x30')][_0x945d('0x4b')]){_0x5d75b3['where']=_['merge'](_0x5d75b3[_0x945d('0x38')],{'$or':_[_0x945d('0x2d')](_0x5d75b3[_0x945d('0x32')],function(_0x54b66d){var _0x28a6c2={};_0x28a6c2[_0x54b66d]={'$like':'%'+_0x253ba0[_0x945d('0x30')][_0x945d('0x4b')]+'%'};return _0x28a6c2;})});}_0x5d75b3=_[_0x945d('0x37')]({},_0x5d75b3,_0x253ba0[_0x945d('0x3a')]);return db['JscriptyQuestionReport'][_0x945d('0x1e')]({'where':_0x5d75b3[_0x945d('0x38')]})[_0x945d('0x25')](function(_0x18d702){_0x2ca646[_0x945d('0x1e')]=_0x18d702;if(_0x253ba0[_0x945d('0x30')][_0x945d('0x3b')]){_0x5d75b3[_0x945d('0x42')]=[{'all':!![]}];}return db[_0x945d('0x4c')]['findAll'](_0x5d75b3);})['then'](function(_0xe55dc7){_0x2ca646[_0x945d('0x3c')]=_0xe55dc7;return _0x2ca646;});}})[_0x945d('0x25')](respondWithFilteredResult(_0x401fd9,_0x5d75b3))['catch'](handleError(_0x401fd9,null));}; \ No newline at end of file +var _0x1552=['order','sort','pick','filter','where','merge','type','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rows','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1b5cb4,_0xa6b826){var _0x330fe7=function(_0x41f7d8){while(--_0x41f7d8){_0x1b5cb4['push'](_0x1b5cb4['shift']());}};_0x330fe7(++_0xa6b826);}(_0x1552,0xb3));var _0x2155=function(_0xd49e15,_0x5e34ac){_0xd49e15=_0xd49e15-0x0;var _0x306b6a=_0x1552[_0xd49e15];return _0x306b6a;};'use strict';var emlformat=require(_0x2155('0x0'));var rimraf=require(_0x2155('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2155('0x2'));var moment=require(_0x2155('0x3'));var BPromise=require(_0x2155('0x4'));var Mustache=require('mustache');var util=require(_0x2155('0x5'));var path=require('path');var sox=require(_0x2155('0x6'));var csv=require(_0x2155('0x7'));var ejs=require(_0x2155('0x8'));var fs=require('fs');var fs_extra=require(_0x2155('0x9'));var _=require(_0x2155('0xa'));var squel=require(_0x2155('0xb'));var crypto=require(_0x2155('0xc'));var jsforce=require(_0x2155('0xd'));var deskjs=require(_0x2155('0xe'));var toCsv=require(_0x2155('0x7'));var querystring=require(_0x2155('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2155('0x10'));var as=require(_0x2155('0x11'));var hardwareService=require(_0x2155('0x12'));var logger=require(_0x2155('0x13'))('api');var utils=require(_0x2155('0x14'));var config=require(_0x2155('0x15'));var licenseUtil=require(_0x2155('0x16'));var db=require(_0x2155('0x17'))['db'];function respondWithStatusCode(_0x45d71e,_0x4b6796){_0x4b6796=_0x4b6796||0xcc;return function(_0x37aef7){if(_0x37aef7){return _0x45d71e['sendStatus'](_0x4b6796);}return _0x45d71e[_0x2155('0x18')](_0x4b6796)[_0x2155('0x19')]();};}function respondWithResult(_0x56b646,_0x10bcad){_0x10bcad=_0x10bcad||0xc8;return function(_0x16ecc7){if(_0x16ecc7){return _0x56b646[_0x2155('0x18')](_0x10bcad)['json'](_0x16ecc7);}};}function respondWithFilteredResult(_0x2369e3,_0x2b1e56){return function(_0x582cc1){if(_0x582cc1){var _0x178221=typeof _0x2b1e56['offset']===_0x2155('0x1a')&&typeof _0x2b1e56[_0x2155('0x1b')]===_0x2155('0x1a');var _0x3b94c2=_0x582cc1[_0x2155('0x1c')];var _0x27c693=_0x178221?0x0:_0x2b1e56['offset'];var _0x6f0b97=_0x178221?_0x582cc1['count']:_0x2b1e56[_0x2155('0x1d')]+_0x2b1e56[_0x2155('0x1b')];var _0x15a972;if(_0x6f0b97>=_0x3b94c2){_0x6f0b97=_0x3b94c2;_0x15a972=0xc8;}else{_0x15a972=0xce;}_0x2369e3[_0x2155('0x18')](_0x15a972);return _0x2369e3[_0x2155('0x1e')](_0x2155('0x1f'),_0x27c693+'-'+_0x6f0b97+'/'+_0x3b94c2)['json'](_0x582cc1);}return null;};}function patchUpdates(_0x230ed3){return function(_0xecf9d0){try{jsonpatch['apply'](_0xecf9d0,_0x230ed3,!![]);}catch(_0x2758e9){return BPromise[_0x2155('0x20')](_0x2758e9);}return _0xecf9d0[_0x2155('0x21')]();};}function saveUpdates(_0x3d24aa,_0xa19dc9){return function(_0x56ac93){if(_0x56ac93){return _0x56ac93[_0x2155('0x22')](_0x3d24aa)['then'](function(_0x5cff1e){return _0x5cff1e;});}return null;};}function removeEntity(_0x19e31d,_0x40f975){return function(_0x27e8a4){if(_0x27e8a4){return _0x27e8a4[_0x2155('0x23')]()[_0x2155('0x24')](function(){_0x19e31d[_0x2155('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1817bf,_0x4b3846){return function(_0x4ab565){if(!_0x4ab565){_0x1817bf[_0x2155('0x25')](0x194);}return _0x4ab565;};}function handleError(_0x56eb8d,_0xd35845){_0xd35845=_0xd35845||0x1f4;return function(_0x4a2af5){logger['error'](_0x4a2af5[_0x2155('0x26')]);if(_0x4a2af5[_0x2155('0x27')]){delete _0x4a2af5[_0x2155('0x27')];}_0x56eb8d['status'](_0xd35845)['send'](_0x4a2af5);};}exports[_0x2155('0x28')]=function(_0x1e8e5e,_0x37bfec){var _0x2495b2={},_0x5d7be4={},_0xb470b6={'count':0x0,'rows':[]};var _0x315a26=_[_0x2155('0x29')](db[_0x2155('0x2a')][_0x2155('0x2b')],function(_0x27d06c){return{'name':_0x27d06c[_0x2155('0x2c')],'type':_0x27d06c['type']['key']};});_0x5d7be4['model']=_[_0x2155('0x29')](_0x315a26,_0x2155('0x27'));_0x5d7be4[_0x2155('0x2d')]=_[_0x2155('0x2e')](_0x1e8e5e[_0x2155('0x2d')]);_0x5d7be4[_0x2155('0x2f')]=_[_0x2155('0x30')](_0x5d7be4[_0x2155('0x31')],_0x5d7be4[_0x2155('0x2d')]);_0x2495b2[_0x2155('0x32')]=_[_0x2155('0x30')](_0x5d7be4[_0x2155('0x31')],qs[_0x2155('0x33')](_0x1e8e5e['query']['fields']));_0x2495b2['attributes']=_0x2495b2[_0x2155('0x32')][_0x2155('0x34')]?_0x2495b2[_0x2155('0x32')]:_0x5d7be4[_0x2155('0x31')];if(!_0x1e8e5e['query'][_0x2155('0x35')](_0x2155('0x36'))){_0x2495b2['limit']=qs['limit'](_0x1e8e5e[_0x2155('0x2d')]['limit']);_0x2495b2[_0x2155('0x1d')]=qs['offset'](_0x1e8e5e['query'][_0x2155('0x1d')]);}_0x2495b2[_0x2155('0x37')]=qs['sort'](_0x1e8e5e[_0x2155('0x2d')][_0x2155('0x38')]);_0x2495b2['where']=qs[_0x2155('0x2f')](_[_0x2155('0x39')](_0x1e8e5e[_0x2155('0x2d')],_0x5d7be4[_0x2155('0x2f')]),_0x315a26);if(_0x1e8e5e[_0x2155('0x2d')][_0x2155('0x3a')]){_0x2495b2[_0x2155('0x3b')]=_[_0x2155('0x3c')](_0x2495b2['where'],{'$or':_[_0x2155('0x29')](_0x315a26,function(_0x28bcf3){if(_0x28bcf3[_0x2155('0x3d')]!=='VIRTUAL'){var _0x1d1a80={};_0x1d1a80[_0x28bcf3[_0x2155('0x27')]]={'$like':'%'+_0x1e8e5e['query'][_0x2155('0x3a')]+'%'};return _0x1d1a80;}})});}_0x2495b2=_['merge']({},_0x2495b2,_0x1e8e5e[_0x2155('0x3e')]);var _0x43664d={'where':_0x2495b2[_0x2155('0x3b')]};return db[_0x2155('0x2a')][_0x2155('0x1c')](_0x43664d)[_0x2155('0x24')](function(_0x270ae0){_0xb470b6['count']=_0x270ae0;if(_0x1e8e5e[_0x2155('0x2d')][_0x2155('0x3f')]){_0x2495b2['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2155('0x40')](_0x2495b2);})['then'](function(_0x48b682){_0xb470b6['rows']=_0x48b682;return _0xb470b6;})[_0x2155('0x24')](respondWithFilteredResult(_0x37bfec,_0x2495b2))[_0x2155('0x41')](handleError(_0x37bfec,null));};exports[_0x2155('0x42')]=function(_0x21e4da,_0x4674d9){var _0x1c8e56={'raw':!![],'where':{'id':_0x21e4da[_0x2155('0x43')]['id']}},_0x43b790={};_0x43b790[_0x2155('0x31')]=_[_0x2155('0x2e')](db[_0x2155('0x2a')][_0x2155('0x2b')]);_0x43b790[_0x2155('0x2d')]=_[_0x2155('0x2e')](_0x21e4da[_0x2155('0x2d')]);_0x43b790[_0x2155('0x2f')]=_[_0x2155('0x30')](_0x43b790[_0x2155('0x31')],_0x43b790[_0x2155('0x2d')]);_0x1c8e56[_0x2155('0x32')]=_['intersection'](_0x43b790['model'],qs['fields'](_0x21e4da[_0x2155('0x2d')]['fields']));_0x1c8e56[_0x2155('0x32')]=_0x1c8e56[_0x2155('0x32')]['length']?_0x1c8e56['attributes']:_0x43b790['model'];if(_0x21e4da[_0x2155('0x2d')][_0x2155('0x3f')]){_0x1c8e56[_0x2155('0x44')]=[{'all':!![]}];}_0x1c8e56=_[_0x2155('0x3c')]({},_0x1c8e56,_0x21e4da['options']);return db['JscriptySessionReport'][_0x2155('0x45')](_0x1c8e56)[_0x2155('0x24')](handleEntityNotFound(_0x4674d9,null))[_0x2155('0x24')](respondWithResult(_0x4674d9,null))[_0x2155('0x41')](handleError(_0x4674d9,null));};exports['create']=function(_0x59b3b5,_0x385eb2){return db[_0x2155('0x2a')][_0x2155('0x46')](_0x59b3b5['body'],{})[_0x2155('0x24')](respondWithResult(_0x385eb2,0xc9))['catch'](handleError(_0x385eb2,null));};exports[_0x2155('0x22')]=function(_0x36838c,_0x3fb731){if(_0x36838c['body']['id']){delete _0x36838c['body']['id'];}return db[_0x2155('0x2a')][_0x2155('0x45')]({'where':{'id':_0x36838c['params']['id']}})[_0x2155('0x24')](handleEntityNotFound(_0x3fb731,null))[_0x2155('0x24')](saveUpdates(_0x36838c[_0x2155('0x47')],null))['then'](respondWithResult(_0x3fb731,null))[_0x2155('0x41')](handleError(_0x3fb731,null));};exports[_0x2155('0x23')]=function(_0xeba014,_0x2395d6){return db[_0x2155('0x2a')][_0x2155('0x45')]({'where':{'id':_0xeba014[_0x2155('0x43')]['id']}})[_0x2155('0x24')](handleEntityNotFound(_0x2395d6,null))[_0x2155('0x24')](removeEntity(_0x2395d6,null))['catch'](handleError(_0x2395d6,null));};exports[_0x2155('0x48')]=function(_0x1a8783,_0x3e69f4){return db['JscriptySessionReport'][_0x2155('0x48')]()['then'](respondWithResult(_0x3e69f4,null))[_0x2155('0x41')](handleError(_0x3e69f4,null));};exports[_0x2155('0x49')]=function(_0xbc2513,_0x5058c1,_0x42d123){var _0x26fdb0={'raw':!![],'where':{}};var _0x25fb43={};var _0x4f5c39={'count':0x0,'rows':[]};return db[_0x2155('0x2a')][_0x2155('0x4a')]({'where':{'id':_0xbc2513['params']['id']}})[_0x2155('0x24')](handleEntityNotFound(_0x5058c1,null))[_0x2155('0x24')](function(_0x5ae915){if(_0x5ae915){_0x25fb43['model']=_[_0x2155('0x2e')](db[_0x2155('0x4b')][_0x2155('0x2b')]);_0x25fb43[_0x2155('0x2d')]=_[_0x2155('0x2e')](_0xbc2513['query']);_0x25fb43[_0x2155('0x2f')]=_['intersection'](_0x25fb43[_0x2155('0x31')],_0x25fb43[_0x2155('0x2d')]);_0x26fdb0['attributes']=_[_0x2155('0x30')](_0x25fb43[_0x2155('0x31')],qs[_0x2155('0x33')](_0xbc2513['query'][_0x2155('0x33')]));_0x26fdb0[_0x2155('0x32')]=_0x26fdb0['attributes'][_0x2155('0x34')]?_0x26fdb0[_0x2155('0x32')]:_0x25fb43['model'];if(!_0xbc2513['query'][_0x2155('0x35')]('nolimit')){_0x26fdb0['limit']=qs[_0x2155('0x1b')](_0xbc2513['query'][_0x2155('0x1b')]);_0x26fdb0[_0x2155('0x1d')]=qs['offset'](_0xbc2513['query']['offset']);}_0x26fdb0[_0x2155('0x37')]=qs[_0x2155('0x38')](_0xbc2513[_0x2155('0x2d')][_0x2155('0x38')]);_0x26fdb0[_0x2155('0x3b')]=qs[_0x2155('0x2f')](_[_0x2155('0x39')](_0xbc2513['query'],_0x25fb43['filters']));_0x26fdb0[_0x2155('0x3b')][_0x2155('0x4c')]=_0x5ae915['id'];if(_0xbc2513[_0x2155('0x2d')][_0x2155('0x3a')]){_0x26fdb0[_0x2155('0x3b')]=_[_0x2155('0x3c')](_0x26fdb0['where'],{'$or':_[_0x2155('0x29')](_0x26fdb0[_0x2155('0x32')],function(_0x3d2416){var _0xd07c8={};_0xd07c8[_0x3d2416]={'$like':'%'+_0xbc2513[_0x2155('0x2d')]['filter']+'%'};return _0xd07c8;})});}_0x26fdb0=_[_0x2155('0x3c')]({},_0x26fdb0,_0xbc2513[_0x2155('0x3e')]);return db[_0x2155('0x4b')][_0x2155('0x1c')]({'where':_0x26fdb0[_0x2155('0x3b')]})[_0x2155('0x24')](function(_0x5dd431){_0x4f5c39[_0x2155('0x1c')]=_0x5dd431;if(_0xbc2513[_0x2155('0x2d')][_0x2155('0x3f')]){_0x26fdb0[_0x2155('0x44')]=[{'all':!![]}];}return db[_0x2155('0x4b')]['findAll'](_0x26fdb0);})[_0x2155('0x24')](function(_0x58b7d7){_0x4f5c39[_0x2155('0x4d')]=_0x58b7d7;return _0x4f5c39;});}})[_0x2155('0x24')](respondWithFilteredResult(_0x5058c1,_0x26fdb0))['catch'](handleError(_0x5058c1,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c7cc30f..0b32874 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 _0x11e5=['path','../../config/environment','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5aa891,_0x414f30){var _0x251790=function(_0x430eab){while(--_0x430eab){_0x5aa891['push'](_0x5aa891['shift']());}};_0x251790(++_0x414f30);}(_0x11e5,0x8b));var _0x511e=function(_0x135cd7,_0x6bdc01){_0x135cd7=_0x135cd7-0x0;var _0x300a1d=_0x11e5[_0x135cd7];return _0x300a1d;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x342539,_0x323f8c){return _0x342539[_0x511e('0x7')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db9=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x423b10,_0x36cad4){var _0x1338d9=function(_0xeb09ac){while(--_0xeb09ac){_0x423b10['push'](_0x423b10['shift']());}};_0x1338d9(++_0x36cad4);}(_0x1db9,0x176));var _0x91db=function(_0x505b81,_0xf14649){_0x505b81=_0x505b81-0x0;var _0x36c092=_0x1db9[_0x505b81];return _0x36c092;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'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 6df879c..e502cba 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 _0x6d38=['request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3eed68,_0x1ef8a4){var _0x10ce08=function(_0x4403ed){while(--_0x4403ed){_0x3eed68['push'](_0x3eed68['shift']());}};_0x10ce08(++_0x1ef8a4);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x0424,0x159));var _0x4042=function(_0x324f55,_0x2e6ca4){_0x324f55=_0x324f55-0x0;var _0x284952=_0x0424[_0x324f55];return _0x284952;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c2e11b8..f2ed71e 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 _0xe74d=['update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated'];(function(_0x1eec3a,_0x168828){var _0x133cf7=function(_0x1a0c97){while(--_0x1a0c97){_0x1eec3a['push'](_0x1eec3a['shift']());}};_0x133cf7(++_0x168828);}(_0xe74d,0x16e));var _0xde74=function(_0x527228,_0x2bf9d1){_0x527228=_0x527228-0x0;var _0x18fc82=_0xe74d[_0x527228];return _0x18fc82;};'use strict';var multer=require(_0xde74('0x0'));var util=require(_0xde74('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde74('0x2'));var router=express[_0xde74('0x3')]();var fs_extra=require(_0xde74('0x4'));var auth=require(_0xde74('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde74('0x6'));var controller=require(_0xde74('0x7'));router[_0xde74('0x8')]('/',controller[_0xde74('0x9')]);router['put'](_0xde74('0xa'),auth[_0xde74('0xb')](),controller[_0xde74('0xc')]);module[_0xde74('0xd')]=router; \ No newline at end of file +var _0x56e6=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express'];(function(_0x59f617,_0x1ef891){var _0x409053=function(_0x2af264){while(--_0x2af264){_0x59f617['push'](_0x59f617['shift']());}};_0x409053(++_0x1ef891);}(_0x56e6,0x6b));var _0x656e=function(_0x280919,_0xd6a4fb){_0x280919=_0x280919-0x0;var _0x37884f=_0x56e6[_0x280919];return _0x37884f;};'use strict';var multer=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var path=require(_0x656e('0x2'));var timeout=require(_0x656e('0x3'));var express=require(_0x656e('0x4'));var router=express[_0x656e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x656e('0x6'));var interaction=require(_0x656e('0x7'));var config=require(_0x656e('0x8'));var controller=require(_0x656e('0x9'));router[_0x656e('0xa')]('/',controller[_0x656e('0xb')]);router[_0x656e('0xc')]('/:id',auth[_0x656e('0xd')](),controller[_0x656e('0xe')]);module[_0x656e('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 21453e0..4fc52b0 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 _0x03f6=['exports','STRING'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0x03f6,0x16a));var _0x603f=function(_0x56e0a5,_0x49191d){_0x56e0a5=_0x56e0a5-0x0;var _0x4ceb56=_0x03f6[_0x56e0a5];return _0x4ceb56;};'use strict';var Sequelize=require('sequelize');module[_0x603f('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x603f('0x1')]},'data2':{'type':Sequelize[_0x603f('0x1')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ca9=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x3ff31d,_0x29f905){var _0x2c3526=function(_0xd59eea){while(--_0xd59eea){_0x3ff31d['push'](_0x3ff31d['shift']());}};_0x2c3526(++_0x29f905);}(_0x2ca9,0x1a3));var _0x92ca=function(_0x2f7c6b,_0xd9685b){_0x2f7c6b=_0x2f7c6b-0x0;var _0x2fed9c=_0x2ca9[_0x2f7c6b];return _0x2fed9c;};'use strict';var Sequelize=require(_0x92ca('0x0'));module[_0x92ca('0x1')]={'license':{'type':Sequelize[_0x92ca('0x2')]},'data1':{'type':Sequelize[_0x92ca('0x3')]},'data2':{'type':Sequelize[_0x92ca('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x92ca('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 90f6324..f98fa11 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 _0x7a54=['count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','model','License','query','keys','intersection','attributes','fields','length','options','getLicense','body','find','checkLicense','key','demo','catch','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'];(function(_0x26e105,_0x821a88){var _0x534f19=function(_0x3cbc79){while(--_0x3cbc79){_0x26e105['push'](_0x26e105['shift']());}};_0x534f19(++_0x821a88);}(_0x7a54,0x106));var _0x47a5=function(_0x5e275d,_0x1b7e48){_0x5e275d=_0x5e275d-0x0;var _0x2ee1bf=_0x7a54[_0x5e275d];return _0x2ee1bf;};'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);};}var utilLicense=require(_0x47a5('0x14'));exports[_0x47a5('0x29')]=function(_0x16631f,_0x361bfa){var _0x1127f8={'raw':!![],'where':{'id':0x1}},_0x11a4fa={};_0x11a4fa[_0x47a5('0x2a')]=_['keys'](db[_0x47a5('0x2b')]['rawAttributes']);_0x11a4fa[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x16631f[_0x47a5('0x2c')]);_0x11a4fa['filters']=_[_0x47a5('0x2e')](_0x11a4fa[_0x47a5('0x2a')],_0x11a4fa[_0x47a5('0x2c')]);_0x1127f8[_0x47a5('0x2f')]=_['intersection'](_0x11a4fa['model'],qs[_0x47a5('0x30')](_0x16631f[_0x47a5('0x2c')]['fields']));_0x1127f8['attributes']=_0x1127f8[_0x47a5('0x2f')][_0x47a5('0x31')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x2a')];_0x1127f8=_['merge']({},_0x1127f8,_0x16631f[_0x47a5('0x32')]);return utilLicense[_0x47a5('0x33')](_0x1127f8)['then'](respondWithResult(_0x361bfa,null))['catch'](handleError(_0x361bfa,null));};exports[_0x47a5('0x22')]=function(_0x5910bb,_0x403028){if(_0x5910bb[_0x47a5('0x34')]['id']){delete _0x5910bb[_0x47a5('0x34')]['id'];}return db['License'][_0x47a5('0x35')]({'where':{'id':_0x5910bb['params']['id']}})['then'](handleEntityNotFound(_0x403028,null))[_0x47a5('0x23')](function(_0x5a8a7c){var _0x25cce0=_0x5a8a7c['get']({'plain':!![]});return utilLicense[_0x47a5('0x36')](_0x25cce0,_0x5910bb[_0x47a5('0x34')][_0x47a5('0x37')]);})[_0x47a5('0x23')](function(_0x36add5){if(!_0x36add5[_0x47a5('0x38')]){return saveUpdates(_0x5910bb[_0x47a5('0x34')],null);}return _0x36add5;})[_0x47a5('0x23')](respondWithResult(_0x403028,null))[_0x47a5('0x39')](handleError(_0x403028,null));}; \ No newline at end of file +var _0xf494=['fields','length','merge','options','getLicense','body','License','find','params','get','key','demo','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','../../config/license/util','index','model','rawAttributes','query','keys','filters','intersection','attributes'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xf494,0x1c6));var _0x4f49=function(_0x7a3f4,_0x1926c7){_0x7a3f4=_0x7a3f4-0x0;var _0x377f7b=_0xf494[_0x7a3f4];return _0x377f7b;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}var utilLicense=require(_0x4f49('0x29'));exports[_0x4f49('0x2a')]=function(_0x605c91,_0x560050){var _0x3cbfbd={'raw':!![],'where':{'id':0x1}},_0x206203={};_0x206203[_0x4f49('0x2b')]=_['keys'](db['License'][_0x4f49('0x2c')]);_0x206203[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x605c91['query']);_0x206203[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],_0x206203[_0x4f49('0x2d')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],qs[_0x4f49('0x32')](_0x605c91[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x3cbfbd[_0x4f49('0x31')]=_0x3cbfbd[_0x4f49('0x31')][_0x4f49('0x33')]?_0x3cbfbd[_0x4f49('0x31')]:_0x206203[_0x4f49('0x2b')];_0x3cbfbd=_[_0x4f49('0x34')]({},_0x3cbfbd,_0x605c91[_0x4f49('0x35')]);return utilLicense[_0x4f49('0x36')](_0x3cbfbd)[_0x4f49('0x25')](respondWithResult(_0x560050,null))['catch'](handleError(_0x560050,null));};exports[_0x4f49('0x24')]=function(_0x46b7ba,_0x24f568){if(_0x46b7ba[_0x4f49('0x37')]['id']){delete _0x46b7ba[_0x4f49('0x37')]['id'];}return db[_0x4f49('0x38')][_0x4f49('0x39')]({'where':{'id':_0x46b7ba[_0x4f49('0x3a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x24f568,null))[_0x4f49('0x25')](function(_0x44e6a0){var _0x343365=_0x44e6a0[_0x4f49('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x343365,_0x46b7ba[_0x4f49('0x37')][_0x4f49('0x3c')]);})[_0x4f49('0x25')](function(_0x26014f){if(!_0x26014f[_0x4f49('0x3d')]){return saveUpdates(_0x46b7ba[_0x4f49('0x37')],null);}return _0x26014f;})[_0x4f49('0x25')](respondWithResult(_0x24f568,null))[_0x4f49('0x3e')](handleError(_0x24f568,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ca10133..82286bf 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 _0x980d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','define','license','lodash','util'];(function(_0x516899,_0x38eb50){var _0x507eba=function(_0x3e9182){while(--_0x3e9182){_0x516899['push'](_0x516899['shift']());}};_0x507eba(++_0x38eb50);}(_0x980d,0x184));var _0xd980=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0x980d[_0x3d9b04];return _0x557936;};'use strict';var _=require(_0xd980('0x0'));var util=require(_0xd980('0x1'));var logger=require(_0xd980('0x2'))(_0xd980('0x3'));var moment=require(_0xd980('0x4'));var BPromise=require(_0xd980('0x5'));var rp=require(_0xd980('0x6'));var fs=require('fs');var path=require(_0xd980('0x7'));var rimraf=require(_0xd980('0x8'));var config=require(_0xd980('0x9'));var attributes=require(_0xd980('0xa'));module['exports']=function(_0x17552d,_0x422a10){return _0x17552d[_0xd980('0xb')]('License',attributes,{'tableName':_0xd980('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dbe=['License','license','util','../../config/logger','api','request-promise','path','rimraf','./license.attributes','exports'];(function(_0xdb049c,_0x21b35d){var _0x3b9bf0=function(_0x2725b2){while(--_0x2725b2){_0xdb049c['push'](_0xdb049c['shift']());}};_0x3b9bf0(++_0x21b35d);}(_0x6dbe,0xa2));var _0xe6db=function(_0x187405,_0x5a5a84){_0x187405=_0x187405-0x0;var _0x1e7242=_0x6dbe[_0x187405];return _0x1e7242;};'use strict';var _=require('lodash');var util=require(_0xe6db('0x0'));var logger=require(_0xe6db('0x1'))(_0xe6db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe6db('0x3'));var fs=require('fs');var path=require(_0xe6db('0x4'));var rimraf=require(_0xe6db('0x5'));var config=require('../../config/environment');var attributes=require(_0xe6db('0x6'));module[_0xe6db('0x7')]=function(_0x2be236,_0x28b8dd){return _0x2be236['define'](_0xe6db('0x8'),attributes,{'tableName':_0xe6db('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 216109c..c7b431b 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 _0x18f4=['info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x55fb9f,_0x6993d6){var _0x4bc218=function(_0x554378){while(--_0x554378){_0x55fb9f['push'](_0x55fb9f['shift']());}};_0x4bc218(++_0x6993d6);}(_0x18f4,0x180));var _0x418f=function(_0x5806b1,_0x38c276){_0x5806b1=_0x5806b1-0x0;var _0x15f734=_0x18f4[_0x5806b1];return _0x15f734;};'use strict';var _=require(_0x418f('0x0'));var util=require(_0x418f('0x1'));var moment=require(_0x418f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x418f('0x3'));var db=require(_0x418f('0x4'))['db'];var utils=require(_0x418f('0x5'));var logger=require(_0x418f('0x6'))('rpc');var config=require(_0x418f('0x7'));var jayson=require(_0x418f('0x8'));var client=jayson[_0x418f('0x9')][_0x418f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4549b7,_0x3c80ac,_0x238640){return new BPromise(function(_0x362fa1,_0x3deeb4){return client[_0x418f('0xb')](_0x4549b7,_0x238640)['then'](function(_0x4c4f8f){logger[_0x418f('0xc')]('License,\x20%s,\x20%s',_0x3c80ac,_0x418f('0xd'));logger[_0x418f('0xe')](_0x418f('0xf'),_0x3c80ac,_0x418f('0xd'),JSON[_0x418f('0x10')](_0x4c4f8f));if(_0x4c4f8f['error']){if(_0x4c4f8f[_0x418f('0x11')][_0x418f('0x12')]===0x1f4){logger[_0x418f('0x11')]('License,\x20%s,\x20%s',_0x3c80ac,_0x4c4f8f['error'][_0x418f('0x13')]);return _0x3deeb4(_0x4c4f8f[_0x418f('0x11')][_0x418f('0x13')]);}logger['error'](_0x418f('0x14'),_0x3c80ac,_0x4c4f8f['error']['message']);return _0x362fa1(_0x4c4f8f['error'][_0x418f('0x13')]);}else{logger['info'](_0x418f('0x14'),_0x3c80ac,_0x418f('0xd'));_0x362fa1(_0x4c4f8f['result']['message']);}})[_0x418f('0x15')](function(_0x3edd22){logger[_0x418f('0x11')](_0x418f('0x14'),_0x3c80ac,_0x3edd22);_0x3deeb4(_0x3edd22);});});} \ No newline at end of file +var _0x6d79=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird'];(function(_0x319e2b,_0x5dda9c){var _0x1e2fca=function(_0x343c1d){while(--_0x343c1d){_0x319e2b['push'](_0x319e2b['shift']());}};_0x1e2fca(++_0x5dda9c);}(_0x6d79,0x13f));var _0x96d7=function(_0x323f47,_0x296730){_0x323f47=_0x323f47-0x0;var _0x2dff06=_0x6d79[_0x323f47];return _0x2dff06;};'use strict';var _=require(_0x96d7('0x0'));var util=require(_0x96d7('0x1'));var moment=require('moment');var BPromise=require(_0x96d7('0x2'));var rs=require(_0x96d7('0x3'));var fs=require('fs');var Redis=require(_0x96d7('0x4'));var db=require(_0x96d7('0x5'))['db'];var utils=require(_0x96d7('0x6'));var logger=require(_0x96d7('0x7'))(_0x96d7('0x8'));var config=require('../../config/environment');var jayson=require(_0x96d7('0x9'));var client=jayson[_0x96d7('0xa')][_0x96d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29df1d,_0x3ac818,_0x11f587){return new BPromise(function(_0x15b8ab,_0x2a6ee5){return client[_0x96d7('0xc')](_0x29df1d,_0x11f587)[_0x96d7('0xd')](function(_0x53d3ab){logger['info'](_0x96d7('0xe'),_0x3ac818,_0x96d7('0xf'));logger[_0x96d7('0x10')](_0x96d7('0x11'),_0x3ac818,_0x96d7('0xf'),JSON['stringify'](_0x53d3ab));if(_0x53d3ab[_0x96d7('0x12')]){if(_0x53d3ab[_0x96d7('0x12')]['code']===0x1f4){logger[_0x96d7('0x12')](_0x96d7('0xe'),_0x3ac818,_0x53d3ab[_0x96d7('0x12')][_0x96d7('0x13')]);return _0x2a6ee5(_0x53d3ab[_0x96d7('0x12')][_0x96d7('0x13')]);}logger[_0x96d7('0x12')](_0x96d7('0xe'),_0x3ac818,_0x53d3ab['error']['message']);return _0x15b8ab(_0x53d3ab['error'][_0x96d7('0x13')]);}else{logger[_0x96d7('0x14')](_0x96d7('0xe'),_0x3ac818,_0x96d7('0xf'));_0x15b8ab(_0x53d3ab[_0x96d7('0x15')]['message']);}})[_0x96d7('0x16')](function(_0x5cdab6){logger[_0x96d7('0x12')](_0x96d7('0xe'),_0x3ac818,_0x5cdab6);_0x2a6ee5(_0x5cdab6);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c9d463a..639e068 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 _0xa6f2=['/:id/applications','getApplications','getMessages','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','create','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions'];(function(_0x117eb9,_0x373dd1){var _0x5ee00b=function(_0x4ac96c){while(--_0x4ac96c){_0x117eb9['push'](_0x117eb9['shift']());}};_0x5ee00b(++_0x373dd1);}(_0xa6f2,0x187));var _0x2a6f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa6f2[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x2a6f('0x0'));var util=require(_0x2a6f('0x1'));var path=require(_0x2a6f('0x2'));var timeout=require(_0x2a6f('0x3'));var express=require(_0x2a6f('0x4'));var router=express[_0x2a6f('0x5')]();var fs_extra=require(_0x2a6f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a6f('0x7'));var controller=require(_0x2a6f('0x8'));router[_0x2a6f('0x9')]('/',auth[_0x2a6f('0xa')](),controller[_0x2a6f('0xb')]);router[_0x2a6f('0x9')](_0x2a6f('0xc'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0xd')]);router[_0x2a6f('0x9')](_0x2a6f('0xe'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0xf')]);router[_0x2a6f('0x9')](_0x2a6f('0x10'),auth[_0x2a6f('0xa')](),controller['getDispositions']);router[_0x2a6f('0x9')]('/:id/canned_answers',auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x11')]);router['get'](_0x2a6f('0x12'),auth['isAuthenticated'](),controller[_0x2a6f('0x13')]);router[_0x2a6f('0x9')](_0x2a6f('0x14'),auth[_0x2a6f('0xa')](),controller['getSmtp']);router[_0x2a6f('0x9')](_0x2a6f('0x15'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x16')]);router['get'](_0x2a6f('0x17'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x18')]);router[_0x2a6f('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2a6f('0x19')]);router[_0x2a6f('0x9')]('/:id/verify',auth['isAuthenticated'](),controller[_0x2a6f('0x1a')]);router[_0x2a6f('0x9')](_0x2a6f('0x1b'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x1c')]);router[_0x2a6f('0x1d')]('/:id/dispositions',auth[_0x2a6f('0xa')](),controller['addDisposition']);router[_0x2a6f('0x1d')](_0x2a6f('0x1e'),auth[_0x2a6f('0xa')](),controller['addAnswer']);router[_0x2a6f('0x1d')]('/',auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x1f')]);router[_0x2a6f('0x1d')](_0x2a6f('0x12'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x20')]);router[_0x2a6f('0x1d')]('/:id/out_servers',auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x21')]);router[_0x2a6f('0x1d')](_0x2a6f('0x15'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x22')]);router['post'](_0x2a6f('0x17'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x2a6f('0x23'),auth['isAuthenticated'](),controller[_0x2a6f('0x24')]);router['post'](_0x2a6f('0x1b'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x25')]);router[_0x2a6f('0x26')](_0x2a6f('0xe'),auth['isAuthenticated'](),controller[_0x2a6f('0x27')]);router[_0x2a6f('0x28')](_0x2a6f('0x10'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x29')]);router[_0x2a6f('0x28')](_0x2a6f('0x1e'),auth[_0x2a6f('0xa')](),controller['removeAnswers']);router[_0x2a6f('0x28')](_0x2a6f('0x12'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x2a')]);router['delete'](_0x2a6f('0x14'),auth[_0x2a6f('0xa')](),controller[_0x2a6f('0x2b')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2a6f('0x2c')]);router[_0x2a6f('0x28')](_0x2a6f('0x1b'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x2a6f('0x2d')]=router; \ No newline at end of file +var _0x5d6e=['/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','/:id','removeDispositions','delete','removeImap','destroy','removeAgents','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','/:id/applications','getApplications'];(function(_0x3f3f40,_0x4e745f){var _0x32c366=function(_0x343f6a){while(--_0x343f6a){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x32c366(++_0x4e745f);}(_0x5d6e,0x75));var _0xe5d6=function(_0x327e8b,_0x912506){_0x327e8b=_0x327e8b-0x0;var _0x89151=_0x5d6e[_0x327e8b];return _0x89151;};'use strict';var multer=require(_0xe5d6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe5d6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe5d6('0x2'));var auth=require(_0xe5d6('0x3'));var interaction=require(_0xe5d6('0x4'));var config=require(_0xe5d6('0x5'));var controller=require(_0xe5d6('0x6'));router[_0xe5d6('0x7')]('/',auth[_0xe5d6('0x8')](),controller['index']);router[_0xe5d6('0x7')](_0xe5d6('0x9'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0xa')]);router[_0xe5d6('0x7')]('/:id',auth[_0xe5d6('0x8')](),controller['show']);router[_0xe5d6('0x7')](_0xe5d6('0xb'),auth['isAuthenticated'](),controller[_0xe5d6('0xc')]);router[_0xe5d6('0x7')](_0xe5d6('0xd'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0xe')]);router['get'](_0xe5d6('0xf'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x10')]);router[_0xe5d6('0x7')](_0xe5d6('0x11'),auth['isAuthenticated'](),controller['getSmtp']);router[_0xe5d6('0x7')](_0xe5d6('0x12'),auth[_0xe5d6('0x8')](),controller['getInteractions']);router[_0xe5d6('0x7')](_0xe5d6('0x13'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x14')]);router[_0xe5d6('0x7')](_0xe5d6('0x15'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x16')]);router[_0xe5d6('0x7')](_0xe5d6('0x17'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x18')]);router['get'](_0xe5d6('0x19'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x1a')]);router['post'](_0xe5d6('0xb'),auth['isAuthenticated'](),controller[_0xe5d6('0x1b')]);router[_0xe5d6('0x1c')]('/:id/canned_answers',auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe5d6('0x1e')]);router[_0xe5d6('0x1c')](_0xe5d6('0xf'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x1f')]);router[_0xe5d6('0x1c')](_0xe5d6('0x11'),auth['isAuthenticated'](),controller[_0xe5d6('0x20')]);router[_0xe5d6('0x1c')]('/:id/interactions',auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x21')]);router[_0xe5d6('0x1c')](_0xe5d6('0x13'),auth['isAuthenticated'](),controller[_0xe5d6('0x22')]);router['post'](_0xe5d6('0x23'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x24')]);router[_0xe5d6('0x1c')](_0xe5d6('0x19'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x25')]);router[_0xe5d6('0x26')](_0xe5d6('0x27'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe5d6('0xb'),auth['isAuthenticated'](),controller[_0xe5d6('0x28')]);router[_0xe5d6('0x29')](_0xe5d6('0xd'),auth[_0xe5d6('0x8')](),controller['removeAnswers']);router['delete'](_0xe5d6('0xf'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x2a')]);router[_0xe5d6('0x29')]('/:id/out_servers',auth[_0xe5d6('0x8')](),controller['removeSmtp']);router['delete'](_0xe5d6('0x27'),auth[_0xe5d6('0x8')](),controller[_0xe5d6('0x2b')]);router[_0xe5d6('0x29')]('/:id/users',auth['isAuthenticated'](),controller[_0xe5d6('0x2c')]);module[_0xe5d6('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 27bcc30..e450e70 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 _0x24cd=['mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x3e4189,_0x225517){var _0x23221d=function(_0xf09b39){while(--_0xf09b39){_0x3e4189['push'](_0x3e4189['shift']());}};_0x23221d(++_0x225517);}(_0x24cd,0x83));var _0xd24c=function(_0x443d0b,_0x42d426){_0x443d0b=_0x443d0b-0x0;var _0x212e3b=_0x24cd[_0x443d0b];return _0x212e3b;};'use strict';var Sequelize=require(_0xd24c('0x0'));module[_0xd24c('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xd24c('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd24c('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd24c('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd24c('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xd24c('0x4')](0x2)[_0xd24c('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd24c('0x6')],'defaultValue':function(){return _0xd24c('0x7');}},'notificationSound':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd24c('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd24c('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd24c('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xd24c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd24c('0x3')],'defaultValue':![],'comment':_0xd24c('0x9'),'set':function(_0x1aa701){if(!_0x1aa701)this[_0xd24c('0xa')](_0xd24c('0xb'),null);this['setDataValue'](_0xd24c('0xc'),_0x1aa701);}}}; \ No newline at end of file +var _0x34e8=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x2ecffe,_0x187a1c){var _0x37f8c4=function(_0x4c9d25){while(--_0x4c9d25){_0x2ecffe['push'](_0x2ecffe['shift']());}};_0x37f8c4(++_0x187a1c);}(_0x34e8,0x12c));var _0x834e=function(_0x312a95,_0x288ddf){_0x312a95=_0x312a95-0x0;var _0x40cea0=_0x34e8[_0x312a95];return _0x40cea0;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'description':{'type':Sequelize[_0x834e('0x2')]},'name':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x834e('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x834e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x834e('0x4')]},'markAsUnread':{'type':Sequelize[_0x834e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x834e('0x2')],'allowNull':![],'defaultValue':_0x834e('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x834e('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x834e('0x7');}},'notificationSound':{'type':Sequelize[_0x834e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x834e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x834e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x834e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x834e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x834e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x834e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x834e('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x834e('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x834e('0x3')],'defaultValue':![],'comment':_0x834e('0xa'),'set':function(_0x14038b){if(!_0x14038b)this[_0x834e('0xb')](_0x834e('0xc'),null);this[_0x834e('0xb')](_0x834e('0xd'),_0x14038b);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7b9dd32..153fb0f 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 _0x0725=['Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','html-to-text','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','update','destroy','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','Smtp','Pause','map','MailAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','MailServerOut','mandatoryDispositionPause','includeAll','find','body','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','fields','findAll','removeDispositions','ids','CannedAnswer','removeAnswers','email','ListId','active','isNil','cservice','cauthentication','user','pass','cpassword','authentication','host','port','cuser','password','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','User','fullname','internal','Tags','tag','sequelize','MailApplication','priority','getApplications','getMessages','MailMessage','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','service','SendMail','sendMail','Contacts','List\x20not\x20found','messageId','Interaction','VerifySmtp','verifySmtp'];(function(_0x3e482d,_0x27e689){var _0x5223ab=function(_0x580b4f){while(--_0x580b4f){_0x3e482d['push'](_0x3e482d['shift']());}};_0x5223ab(++_0x27e689);}(_0x0725,0xc7));var _0x5072=function(_0x2e2b4c,_0xcc1065){_0x2e2b4c=_0x2e2b4c-0x0;var _0x45f48c=_0x0725[_0x2e2b4c];return _0x45f48c;};'use strict';var emlformat=require(_0x5072('0x0'));var rimraf=require(_0x5072('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5072('0x2'));var BPromise=require(_0x5072('0x3'));var Mustache=require('mustache');var util=require(_0x5072('0x4'));var path=require(_0x5072('0x5'));var sox=require(_0x5072('0x6'));var csv=require(_0x5072('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5072('0x8'));var _=require(_0x5072('0x9'));var squel=require(_0x5072('0xa'));var crypto=require(_0x5072('0xb'));var jsforce=require(_0x5072('0xc'));var deskjs=require(_0x5072('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5072('0xe'));var Papa=require('papaparse');var htmlToText=require(_0x5072('0xf'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0x5072('0x10'));var qs=require(_0x5072('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5072('0x12'));var logger=require(_0x5072('0x13'))(_0x5072('0x14'));var utils=require('../../config/utils');var config=require(_0x5072('0x15'));var licenseUtil=require(_0x5072('0x16'));var db=require(_0x5072('0x17'))['db'];config[_0x5072('0x18')]=_[_0x5072('0x19')](config['redis'],{'host':_0x5072('0x1a'),'port':0x18eb});var socket=require(_0x5072('0x1b'))(new Redis(config['redis']));require(_0x5072('0x1c'))[_0x5072('0x1d')](socket);var jayson=require(_0x5072('0x1e'));var client=jayson[_0x5072('0x1f')][_0x5072('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x420c41,_0x49ae45,_0x159971,_0x592065){return new BPromise(function(_0xb3d375,_0xe4a3cb){var _0x44b907=_0x592065||client;return _0x44b907[_0x5072('0x21')](_0x420c41,_0x159971)[_0x5072('0x22')](function(_0x17b923){logger[_0x5072('0x23')](_0x5072('0x24'),_0x49ae45,_0x5072('0x25'));logger[_0x5072('0x26')](_0x5072('0x27'),_0x49ae45,'request\x20sent',JSON[_0x5072('0x28')](_0x17b923));if(_0x17b923[_0x5072('0x29')]){if(_0x17b923[_0x5072('0x29')][_0x5072('0x2a')]===0x1f4){logger[_0x5072('0x29')](_0x5072('0x24'),_0x49ae45,_0x17b923[_0x5072('0x29')]['message']);return _0xe4a3cb(_0x17b923[_0x5072('0x29')][_0x5072('0x2b')]);}logger['error'](_0x5072('0x24'),_0x49ae45,_0x17b923[_0x5072('0x29')][_0x5072('0x2b')]);return _0xb3d375(_0x17b923[_0x5072('0x29')][_0x5072('0x2b')]);}else{logger[_0x5072('0x23')](_0x5072('0x24'),_0x49ae45,_0x5072('0x25'));_0xb3d375(_0x17b923['result'][_0x5072('0x2b')]);}})['catch'](function(_0x4a4c44){logger[_0x5072('0x29')](_0x5072('0x24'),_0x49ae45,_0x4a4c44);_0xe4a3cb(_0x4a4c44);});});}function respondWithStatusCode(_0x479c66,_0x2d09d8){_0x2d09d8=_0x2d09d8||0xcc;return function(_0x5eb5fd){if(_0x5eb5fd){return _0x479c66[_0x5072('0x2c')](_0x2d09d8);}return _0x479c66[_0x5072('0x2d')](_0x2d09d8)[_0x5072('0x2e')]();};}function respondWithResult(_0x484787,_0x53c618){_0x53c618=_0x53c618||0xc8;return function(_0x27419d){if(_0x27419d){return _0x484787['status'](_0x53c618)[_0x5072('0x2f')](_0x27419d);}};}function respondWithFilteredResult(_0x200985,_0x5c81fa){return function(_0x41ed2d){if(_0x41ed2d){var _0x32ccf6=typeof _0x5c81fa['offset']==='undefined'&&typeof _0x5c81fa[_0x5072('0x30')]===_0x5072('0x31');var _0x333fa0=_0x41ed2d[_0x5072('0x32')];var _0x5f52ba=_0x32ccf6?0x0:_0x5c81fa[_0x5072('0x33')];var _0x40e54e=_0x32ccf6?_0x41ed2d[_0x5072('0x32')]:_0x5c81fa[_0x5072('0x33')]+_0x5c81fa['limit'];var _0x2035c0;if(_0x40e54e>=_0x333fa0){_0x40e54e=_0x333fa0;_0x2035c0=0xc8;}else{_0x2035c0=0xce;}_0x200985['status'](_0x2035c0);return _0x200985[_0x5072('0x34')](_0x5072('0x35'),_0x5f52ba+'-'+_0x40e54e+'/'+_0x333fa0)[_0x5072('0x2f')](_0x41ed2d);}return null;};}function patchUpdates(_0x15f3f2){return function(_0x418599){try{jsonpatch['apply'](_0x418599,_0x15f3f2,!![]);}catch(_0x43df10){return BPromise[_0x5072('0x36')](_0x43df10);}return _0x418599['save']();};}function saveUpdates(_0x287a34,_0x5464dc){return function(_0x279647){if(_0x279647){return _0x279647[_0x5072('0x37')](_0x287a34)['then'](function(_0x36df8d){return _0x36df8d;});}return null;};}function removeEntity(_0x10bc95,_0xa343a){return function(_0x212f11){if(_0x212f11){return _0x212f11[_0x5072('0x38')]()['then'](function(){var _0x3cff6e=_0x212f11['get']({'plain':!![]});var _0x57a064=_0x5072('0x39');return db[_0x5072('0x3a')][_0x5072('0x38')]({'where':{'type':_0x57a064,'resourceId':_0x3cff6e['id']}})[_0x5072('0x22')](function(){return _0x212f11;});})[_0x5072('0x22')](function(){_0x10bc95[_0x5072('0x2d')](0xcc)[_0x5072('0x2e')]();});}};}function handleEntityNotFound(_0x4749b0,_0xc7e848){return function(_0x5009c2){if(!_0x5009c2){_0x4749b0['sendStatus'](0x194);}return _0x5009c2;};}function handleError(_0x441bbd,_0x40e75c){_0x40e75c=_0x40e75c||0x1f4;return function(_0x259f3a){logger['error'](_0x259f3a[_0x5072('0x3b')]);if(_0x259f3a[_0x5072('0x3c')]){delete _0x259f3a[_0x5072('0x3c')];}_0x441bbd[_0x5072('0x2d')](_0x40e75c)[_0x5072('0x3d')](_0x259f3a);};}exports[_0x5072('0x3e')]=function(_0x22caf7,_0x520429){var _0x141eb6={'include':[{'model':db[_0x5072('0x3f')],'as':_0x5072('0x40')},{'model':db['MailServerOut'],'as':_0x5072('0x41')},{'model':db[_0x5072('0x42')],'as':'mandatoryDispositionPause'}]},_0x5102c3={},_0x523f0e={'count':0x0,'rows':[]};var _0x246be0=_[_0x5072('0x43')](db[_0x5072('0x44')][_0x5072('0x45')],function(_0x1b6175){return{'name':_0x1b6175['fieldName'],'type':_0x1b6175[_0x5072('0x46')][_0x5072('0x47')]};});_0x5102c3[_0x5072('0x48')]=_['map'](_0x246be0,_0x5072('0x3c'));_0x5102c3[_0x5072('0x49')]=_[_0x5072('0x4a')](_0x22caf7['query']);_0x5102c3[_0x5072('0x4b')]=_[_0x5072('0x4c')](_0x5102c3[_0x5072('0x48')],_0x5102c3['query']);_0x141eb6[_0x5072('0x4d')]=_[_0x5072('0x4c')](_0x5102c3[_0x5072('0x48')],qs['fields'](_0x22caf7[_0x5072('0x49')]['fields']));_0x141eb6[_0x5072('0x4d')]=_0x141eb6['attributes'][_0x5072('0x4e')]?_0x141eb6[_0x5072('0x4d')]:_0x5102c3[_0x5072('0x48')];if(!_0x22caf7['query'][_0x5072('0x4f')](_0x5072('0x50'))){_0x141eb6[_0x5072('0x30')]=qs[_0x5072('0x30')](_0x22caf7[_0x5072('0x49')][_0x5072('0x30')]);_0x141eb6[_0x5072('0x33')]=qs['offset'](_0x22caf7['query'][_0x5072('0x33')]);}_0x141eb6[_0x5072('0x51')]=qs[_0x5072('0x52')](_0x22caf7['query'][_0x5072('0x52')]);_0x141eb6[_0x5072('0x53')]=qs[_0x5072('0x4b')](_[_0x5072('0x54')](_0x22caf7[_0x5072('0x49')],_0x5102c3[_0x5072('0x4b')]),_0x246be0);if(_0x22caf7[_0x5072('0x49')][_0x5072('0x55')]){_0x141eb6[_0x5072('0x53')]=_[_0x5072('0x56')](_0x141eb6['where'],{'$or':_[_0x5072('0x43')](_0x246be0,function(_0x372498){if(_0x372498[_0x5072('0x46')]!=='VIRTUAL'){var _0x26836e={};_0x26836e[_0x372498['name']]={'$like':'%'+_0x22caf7[_0x5072('0x49')][_0x5072('0x55')]+'%'};return _0x26836e;}})});}_0x141eb6=_[_0x5072('0x56')]({},_0x141eb6,_0x22caf7[_0x5072('0x57')]);var _0x221f04={'where':_0x141eb6[_0x5072('0x53')]};return db[_0x5072('0x44')]['count'](_0x221f04)[_0x5072('0x22')](function(_0x2ce0ca){_0x523f0e['count']=_0x2ce0ca;if(_0x22caf7[_0x5072('0x49')]['includeAll']){_0x141eb6[_0x5072('0x58')]=[{'all':!![]}];}return db[_0x5072('0x44')]['findAll'](_0x141eb6);})[_0x5072('0x22')](function(_0x308470){_0x523f0e[_0x5072('0x59')]=_0x308470;return _0x523f0e;})[_0x5072('0x22')](respondWithFilteredResult(_0x520429,_0x141eb6))[_0x5072('0x5a')](handleError(_0x520429,null));};exports[_0x5072('0x5b')]=function(_0x3fe83f,_0x52ee04){var _0x46936a={'raw':![],'where':{'id':_0x3fe83f[_0x5072('0x5c')]['id']},'include':[{'model':db[_0x5072('0x3f')],'as':_0x5072('0x40')},{'model':db[_0x5072('0x5d')],'as':_0x5072('0x41')},{'model':db[_0x5072('0x42')],'as':_0x5072('0x5e')}]},_0x52981a={};_0x52981a[_0x5072('0x48')]=_[_0x5072('0x4a')](db[_0x5072('0x44')][_0x5072('0x45')]);_0x52981a[_0x5072('0x49')]=_['keys'](_0x3fe83f[_0x5072('0x49')]);_0x52981a[_0x5072('0x4b')]=_[_0x5072('0x4c')](_0x52981a['model'],_0x52981a[_0x5072('0x49')]);_0x46936a['attributes']=_[_0x5072('0x4c')](_0x52981a[_0x5072('0x48')],qs['fields'](_0x3fe83f['query']['fields']));_0x46936a[_0x5072('0x4d')]=_0x46936a[_0x5072('0x4d')][_0x5072('0x4e')]?_0x46936a[_0x5072('0x4d')]:_0x52981a[_0x5072('0x48')];if(_0x3fe83f['query'][_0x5072('0x5f')]){_0x46936a[_0x5072('0x58')]=[{'all':!![]}];}_0x46936a=_[_0x5072('0x56')]({},_0x46936a,_0x3fe83f[_0x5072('0x57')]);return db['MailAccount'][_0x5072('0x60')](_0x46936a)['then'](handleEntityNotFound(_0x52ee04,null))[_0x5072('0x22')](respondWithResult(_0x52ee04,null))[_0x5072('0x5a')](handleError(_0x52ee04,null));};exports['update']=function(_0x3691f1,_0x465085){if(_0x3691f1['body']['id']){delete _0x3691f1['body']['id'];}return db[_0x5072('0x44')]['find']({'where':{'id':_0x3691f1['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x5072('0x5d')],'as':'Smtp'},{'model':db[_0x5072('0x42')],'as':_0x5072('0x5e')}]})[_0x5072('0x22')](handleEntityNotFound(_0x465085,null))['then'](saveUpdates(_0x3691f1[_0x5072('0x61')],null))[_0x5072('0x22')](function(_0x4114b6){if(_0x4114b6&&_0x3691f1[_0x5072('0x61')]['Imap']){return db['MailServerIn'][_0x5072('0x37')](_0x3691f1[_0x5072('0x61')]['Imap'],{'where':{'MailAccountId':_0x4114b6['id']}})['then'](function(){return _0x4114b6;});}return _0x4114b6;})['then'](function(_0x4541a9){if(_0x4541a9&&_0x3691f1[_0x5072('0x61')][_0x5072('0x41')]){return db[_0x5072('0x5d')][_0x5072('0x37')](_0x3691f1['body'][_0x5072('0x41')],{'where':{'MailAccountId':_0x4541a9['id']}})[_0x5072('0x22')](function(){return _0x4541a9;});}return _0x4541a9;})[_0x5072('0x22')](respondWithResult(_0x465085,null))[_0x5072('0x5a')](handleError(_0x465085,null));};exports[_0x5072('0x62')]=function(_0x573d2d,_0x56ebe4){return db['MailAccount'][_0x5072('0x62')]()[_0x5072('0x22')](respondWithResult(_0x56ebe4,null))[_0x5072('0x5a')](handleError(_0x56ebe4,null));};exports[_0x5072('0x63')]=function(_0xd9040b,_0x255d21,_0x20fee7){if(_0xd9040b[_0x5072('0x61')]['id']){delete _0xd9040b[_0x5072('0x61')]['id'];}return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0xd9040b[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x255d21,null))['then'](function(_0x2b39c1){if(_0x2b39c1){_0xd9040b['body'][_0x5072('0x64')]=_0x2b39c1['id'];return db['Disposition'][_0x5072('0x65')](_0xd9040b[_0x5072('0x61')]);}})['then'](respondWithResult(_0x255d21,null))[_0x5072('0x5a')](handleError(_0x255d21,null));};exports[_0x5072('0x66')]=function(_0x5eb528,_0x28ceb2,_0x1864fa){var _0x5c6676={'raw':![],'where':{}};var _0x2d8363={};var _0x1888ab={'count':0x0,'rows':[]};return db['MailAccount'][_0x5072('0x67')]({'where':{'id':_0x5eb528[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x28ceb2,null))['then'](function(_0x37c53d){if(_0x37c53d){_0x2d8363[_0x5072('0x48')]=_[_0x5072('0x4a')](db[_0x5072('0x68')]['rawAttributes']);_0x2d8363[_0x5072('0x49')]=_['keys'](_0x5eb528['query']);_0x2d8363['filters']=_[_0x5072('0x4c')](_0x2d8363[_0x5072('0x48')],_0x2d8363[_0x5072('0x49')]);_0x5c6676[_0x5072('0x4d')]=_[_0x5072('0x4c')](_0x2d8363[_0x5072('0x48')],qs[_0x5072('0x69')](_0x5eb528[_0x5072('0x49')][_0x5072('0x69')]));_0x5c6676['attributes']=_0x5c6676[_0x5072('0x4d')][_0x5072('0x4e')]?_0x5c6676[_0x5072('0x4d')]:_0x2d8363['model'];if(!_0x5eb528[_0x5072('0x49')][_0x5072('0x4f')](_0x5072('0x50'))){_0x5c6676[_0x5072('0x30')]=qs[_0x5072('0x30')](_0x5eb528[_0x5072('0x49')][_0x5072('0x30')]);_0x5c6676[_0x5072('0x33')]=qs[_0x5072('0x33')](_0x5eb528['query'][_0x5072('0x33')]);}_0x5c6676[_0x5072('0x51')]=qs[_0x5072('0x52')](_0x5eb528[_0x5072('0x49')][_0x5072('0x52')]);_0x5c6676[_0x5072('0x53')]=qs[_0x5072('0x4b')](_[_0x5072('0x54')](_0x5eb528[_0x5072('0x49')],_0x2d8363['filters']));_0x5c6676['where'][_0x5072('0x64')]=_0x37c53d['id'];if(_0x5eb528[_0x5072('0x49')][_0x5072('0x55')]){_0x5c6676[_0x5072('0x53')]=_[_0x5072('0x56')](_0x5c6676[_0x5072('0x53')],{'$or':_[_0x5072('0x43')](_0x5c6676[_0x5072('0x4d')],function(_0x3af84e){var _0x23a668={};_0x23a668[_0x3af84e]={'$like':'%'+_0x5eb528[_0x5072('0x49')][_0x5072('0x55')]+'%'};return _0x23a668;})});}_0x5c6676=_[_0x5072('0x56')]({},_0x5c6676,_0x5eb528[_0x5072('0x57')]);return db[_0x5072('0x68')][_0x5072('0x32')]({'where':_0x5c6676['where']})[_0x5072('0x22')](function(_0x180122){_0x1888ab[_0x5072('0x32')]=_0x180122;if(_0x5eb528[_0x5072('0x49')]['includeAll']){_0x5c6676['include']=[{'all':!![]}];}return db[_0x5072('0x68')][_0x5072('0x6a')](_0x5c6676);})[_0x5072('0x22')](function(_0x1a7094){_0x1888ab[_0x5072('0x59')]=_0x1a7094;return _0x1888ab;});}})[_0x5072('0x22')](respondWithFilteredResult(_0x28ceb2,_0x5c6676))[_0x5072('0x5a')](handleError(_0x28ceb2,null));};exports[_0x5072('0x6b')]=function(_0x40f5fd,_0x3479ba,_0x925d21){return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0x40f5fd[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x3479ba,null))[_0x5072('0x22')](function(_0x3512ff){if(_0x3512ff){return _0x3512ff[_0x5072('0x6b')](_0x40f5fd[_0x5072('0x49')][_0x5072('0x6c')]);}})[_0x5072('0x22')](respondWithStatusCode(_0x3479ba,null))[_0x5072('0x5a')](handleError(_0x3479ba,null));};exports['addAnswer']=function(_0x1ab987,_0x1ddd10,_0x2e8626){if(_0x1ab987[_0x5072('0x61')]['id']){delete _0x1ab987[_0x5072('0x61')]['id'];}return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0x1ab987[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x1ddd10,null))[_0x5072('0x22')](function(_0x5739af){if(_0x5739af){_0x1ab987[_0x5072('0x61')]['MailAccountId']=_0x5739af['id'];return db[_0x5072('0x6d')]['create'](_0x1ab987[_0x5072('0x61')]);}})[_0x5072('0x22')](respondWithResult(_0x1ddd10,null))['catch'](handleError(_0x1ddd10,null));};exports['getAnswers']=function(_0x3053be,_0x24b734,_0x36a7f6){var _0x3619ff={'raw':![],'where':{}};var _0x3925d2={};var _0x42a312={'count':0x0,'rows':[]};return db[_0x5072('0x44')][_0x5072('0x67')]({'where':{'id':_0x3053be[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x24b734,null))['then'](function(_0x40dc20){if(_0x40dc20){_0x3925d2[_0x5072('0x48')]=_['keys'](db[_0x5072('0x6d')][_0x5072('0x45')]);_0x3925d2[_0x5072('0x49')]=_['keys'](_0x3053be[_0x5072('0x49')]);_0x3925d2['filters']=_[_0x5072('0x4c')](_0x3925d2[_0x5072('0x48')],_0x3925d2['query']);_0x3619ff[_0x5072('0x4d')]=_[_0x5072('0x4c')](_0x3925d2[_0x5072('0x48')],qs['fields'](_0x3053be[_0x5072('0x49')][_0x5072('0x69')]));_0x3619ff['attributes']=_0x3619ff[_0x5072('0x4d')][_0x5072('0x4e')]?_0x3619ff[_0x5072('0x4d')]:_0x3925d2[_0x5072('0x48')];if(!_0x3053be[_0x5072('0x49')][_0x5072('0x4f')](_0x5072('0x50'))){_0x3619ff[_0x5072('0x30')]=qs[_0x5072('0x30')](_0x3053be['query']['limit']);_0x3619ff[_0x5072('0x33')]=qs[_0x5072('0x33')](_0x3053be[_0x5072('0x49')][_0x5072('0x33')]);}_0x3619ff[_0x5072('0x51')]=qs[_0x5072('0x52')](_0x3053be[_0x5072('0x49')]['sort']);_0x3619ff[_0x5072('0x53')]=qs[_0x5072('0x4b')](_[_0x5072('0x54')](_0x3053be['query'],_0x3925d2[_0x5072('0x4b')]));_0x3619ff[_0x5072('0x53')][_0x5072('0x64')]=_0x40dc20['id'];if(_0x3053be['query'][_0x5072('0x55')]){_0x3619ff[_0x5072('0x53')]=_[_0x5072('0x56')](_0x3619ff[_0x5072('0x53')],{'$or':_[_0x5072('0x43')](_0x3619ff[_0x5072('0x4d')],function(_0x3917ea){var _0x3546dc={};_0x3546dc[_0x3917ea]={'$like':'%'+_0x3053be['query'][_0x5072('0x55')]+'%'};return _0x3546dc;})});}_0x3619ff=_[_0x5072('0x56')]({},_0x3619ff,_0x3053be[_0x5072('0x57')]);return db[_0x5072('0x6d')]['count']({'where':_0x3619ff['where']})['then'](function(_0x3b7cb3){_0x42a312['count']=_0x3b7cb3;if(_0x3053be[_0x5072('0x49')][_0x5072('0x5f')]){_0x3619ff[_0x5072('0x58')]=[{'all':!![]}];}return db[_0x5072('0x6d')][_0x5072('0x6a')](_0x3619ff);})[_0x5072('0x22')](function(_0x4ce1fc){_0x42a312[_0x5072('0x59')]=_0x4ce1fc;return _0x42a312;});}})[_0x5072('0x22')](respondWithFilteredResult(_0x24b734,_0x3619ff))['catch'](handleError(_0x24b734,null));};exports['removeAnswers']=function(_0x55dbdf,_0x9c3d08,_0x18b220){return db['MailAccount'][_0x5072('0x60')]({'where':{'id':_0x55dbdf[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x9c3d08,null))[_0x5072('0x22')](function(_0x52549a){if(_0x52549a){return _0x52549a[_0x5072('0x6e')](_0x55dbdf[_0x5072('0x49')][_0x5072('0x6c')]);}})[_0x5072('0x22')](respondWithStatusCode(_0x9c3d08,null))[_0x5072('0x5a')](handleError(_0x9c3d08,null));};exports[_0x5072('0x65')]=function(_0x57f3ba,_0x1c31f3){var _0x37d2b0={'name':_0x57f3ba[_0x5072('0x61')][_0x5072('0x3c')],'key':_0x57f3ba[_0x5072('0x61')]['key'],'email':_0x57f3ba[_0x5072('0x61')][_0x5072('0x6f')],'ListId':_0x57f3ba[_0x5072('0x61')][_0x5072('0x70')],'active':!_['isNil'](_0x57f3ba[_0x5072('0x61')][_0x5072('0x71')])?_0x57f3ba[_0x5072('0x61')]['active']:!![],'description':_0x57f3ba[_0x5072('0x61')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x5072('0x72')](_0x57f3ba[_0x5072('0x61')][_0x5072('0x73')])){if(_0x57f3ba[_0x5072('0x61')][_0x5072('0x74')]){_0x37d2b0[_0x5072('0x40')][_0x5072('0x75')]=_0x37d2b0[_0x5072('0x41')][_0x5072('0x75')]=_0x57f3ba['body']['cuser'];_0x37d2b0['Imap']['password']=_0x37d2b0[_0x5072('0x41')][_0x5072('0x76')]=_0x57f3ba[_0x5072('0x61')][_0x5072('0x77')];}else{_0x37d2b0['Imap'][_0x5072('0x78')]=_0x37d2b0[_0x5072('0x41')][_0x5072('0x78')]=![];}_0x37d2b0[_0x5072('0x40')]['host']=_0x57f3ba['body'][_0x5072('0x40')][_0x5072('0x79')];_0x37d2b0[_0x5072('0x40')][_0x5072('0x7a')]=_0x57f3ba[_0x5072('0x61')][_0x5072('0x40')]['port'];_0x37d2b0[_0x5072('0x41')][_0x5072('0x79')]=_0x57f3ba[_0x5072('0x61')]['Smtp'][_0x5072('0x79')];_0x37d2b0['Smtp'][_0x5072('0x7a')]=_0x57f3ba[_0x5072('0x61')][_0x5072('0x41')][_0x5072('0x7a')];}else{_0x37d2b0['Imap']['service']=_0x37d2b0[_0x5072('0x41')]['service']=_0x57f3ba['body'][_0x5072('0x73')];_0x37d2b0['Imap']['user']=_0x37d2b0[_0x5072('0x41')][_0x5072('0x75')]=_0x57f3ba[_0x5072('0x61')][_0x5072('0x7b')];_0x37d2b0[_0x5072('0x40')][_0x5072('0x7c')]=_0x37d2b0[_0x5072('0x41')][_0x5072('0x76')]=_0x57f3ba[_0x5072('0x61')][_0x5072('0x77')];}return db[_0x5072('0x44')]['create'](_0x37d2b0,{'include':[{'model':db[_0x5072('0x5d')],'as':_0x5072('0x41')},{'model':db['MailServerIn'],'as':_0x5072('0x40')}]})[_0x5072('0x22')](function(_0x487f1d){var _0x1e7ce0=_0x57f3ba[_0x5072('0x75')][_0x5072('0x7d')]({'plain':!![]});if(!_0x1e7ce0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e7ce0['role']===_0x5072('0x75')){var _0x1f208f=_0x487f1d['get']({'plain':!![]});return db[_0x5072('0x7e')][_0x5072('0x60')]({'where':{'name':_0x5072('0x39'),'userProfileId':_0x1e7ce0[_0x5072('0x7f')]},'raw':!![]})[_0x5072('0x22')](function(_0x11f297){if(_0x11f297&&_0x11f297[_0x5072('0x80')]===0x0){return db[_0x5072('0x3a')][_0x5072('0x65')]({'name':_0x1f208f[_0x5072('0x3c')],'resourceId':_0x1f208f['id'],'type':_0x11f297[_0x5072('0x3c')],'sectionId':_0x11f297['id']},{})['then'](function(){return _0x487f1d;});}else{return _0x487f1d;}})[_0x5072('0x5a')](function(_0x3ca72a){logger[_0x5072('0x29')](_0x5072('0x81'),_0x3ca72a);throw _0x3ca72a;});}return _0x487f1d;})[_0x5072('0x22')](respondWithResult(_0x1c31f3,0xc9))[_0x5072('0x5a')](handleError(_0x1c31f3,null));};exports[_0x5072('0x82')]=function(_0x2e471b,_0x4cd581,_0x1dea30){return db[_0x5072('0x44')][_0x5072('0x67')]({'where':{'id':_0x2e471b[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x4cd581,null))[_0x5072('0x22')](function(_0x9658a5){if(_0x9658a5){return _0x9658a5[_0x5072('0x82')]();}return null;})[_0x5072('0x22')](respondWithResult(_0x4cd581,null))[_0x5072('0x5a')](handleError(_0x4cd581,null));};exports[_0x5072('0x83')]=function(_0x11074a,_0x464eaa,_0x46c2dd){if(_0x11074a['body']['id']){delete _0x11074a[_0x5072('0x61')]['id'];}return db[_0x5072('0x44')]['find']({'where':{'id':_0x11074a[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x464eaa,null))[_0x5072('0x22')](function(_0x14acd3){if(_0x14acd3){_0x11074a[_0x5072('0x61')]['MailAccountId']=_0x14acd3['id'];return db[_0x5072('0x3f')][_0x5072('0x65')](_0x11074a['body']);}})['then'](respondWithResult(_0x464eaa,null))[_0x5072('0x5a')](handleError(_0x464eaa,null));};exports[_0x5072('0x84')]=function(_0x5cbc70,_0x4c837a,_0x5a5e6e){return db['MailAccount']['findOne']({'where':{'id':_0x5cbc70[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x4c837a,null))['then'](function(_0x30c194){if(_0x30c194){return _0x30c194[_0x5072('0x85')](null);}return null;})[_0x5072('0x22')](respondWithStatusCode(_0x4c837a,null))[_0x5072('0x5a')](handleError(_0x4c837a,null));};exports[_0x5072('0x86')]=function(_0xf1afc2,_0x9803a6,_0x38e320){return db[_0x5072('0x44')]['findOne']({'where':{'id':_0xf1afc2[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x9803a6,null))['then'](function(_0x3cef49){if(_0x3cef49){return _0x3cef49[_0x5072('0x86')]();}return null;})['then'](respondWithResult(_0x9803a6,null))[_0x5072('0x5a')](handleError(_0x9803a6,null));};exports[_0x5072('0x87')]=function(_0xa3061c,_0x263524,_0x5ccac8){if(_0xa3061c['body']['id']){delete _0xa3061c[_0x5072('0x61')]['id'];}return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0xa3061c[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x263524,null))[_0x5072('0x22')](function(_0x3d3705){if(_0x3d3705){_0xa3061c[_0x5072('0x61')]['MailAccountId']=_0x3d3705['id'];return db[_0x5072('0x5d')][_0x5072('0x65')](_0xa3061c[_0x5072('0x61')]);}})[_0x5072('0x22')](respondWithResult(_0x263524,null))[_0x5072('0x5a')](handleError(_0x263524,null));};exports[_0x5072('0x88')]=function(_0x4555eb,_0x64d89c,_0x11ccca){return db[_0x5072('0x44')][_0x5072('0x67')]({'where':{'id':_0x4555eb[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x64d89c,null))[_0x5072('0x22')](function(_0x3ebc3c){if(_0x3ebc3c){return _0x3ebc3c[_0x5072('0x89')](null);}return null;})[_0x5072('0x22')](respondWithStatusCode(_0x64d89c,null))[_0x5072('0x5a')](handleError(_0x64d89c,null));};exports[_0x5072('0x8a')]=function(_0x22314e,_0x28590e,_0x1842db){return db[_0x5072('0x8b')][_0x5072('0x60')]({'where':{'id':_0x22314e[_0x5072('0x5c')]['id']}})['then'](handleEntityNotFound(_0x28590e,null))['then'](function(_0x5b4f23){if(_0x5b4f23){return _0x5b4f23['addInteraction'](_0x22314e[_0x5072('0x61')][_0x5072('0x6c')],_[_0x5072('0x8c')](_0x22314e[_0x5072('0x61')],[_0x5072('0x6c'),'id'])||{});}})[_0x5072('0x22')](respondWithResult(_0x28590e,null))[_0x5072('0x5a')](handleError(_0x28590e,null));};exports['getInteractions']=function(_0x18317c,_0x5cb7e4,_0x4a44df){var _0x36c53f={'raw':![],'where':{}};var _0x2be3f8={};var _0x1345eb={'count':0x0,'rows':[]};return db[_0x5072('0x44')][_0x5072('0x67')]({'where':{'id':_0x18317c[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x5cb7e4,null))['then'](function(_0x3c4590){if(_0x3c4590){_0x2be3f8['model']=_['keys'](db[_0x5072('0x8b')][_0x5072('0x45')]);_0x2be3f8[_0x5072('0x49')]=_[_0x5072('0x4a')](_0x18317c['query']);_0x2be3f8[_0x5072('0x4b')]=_[_0x5072('0x4c')](_0x2be3f8[_0x5072('0x48')],_0x2be3f8[_0x5072('0x49')]);_0x36c53f[_0x5072('0x4d')]=_[_0x5072('0x4c')](_0x2be3f8[_0x5072('0x48')],qs[_0x5072('0x69')](_0x18317c[_0x5072('0x49')][_0x5072('0x69')]));_0x36c53f[_0x5072('0x4d')]=_0x36c53f[_0x5072('0x4d')]['length']?_0x36c53f['attributes']:_0x2be3f8[_0x5072('0x48')];if(!_0x18317c[_0x5072('0x49')][_0x5072('0x4f')](_0x5072('0x50'))){_0x36c53f[_0x5072('0x30')]=qs['limit'](_0x18317c[_0x5072('0x49')][_0x5072('0x30')]);_0x36c53f[_0x5072('0x33')]=qs[_0x5072('0x33')](_0x18317c[_0x5072('0x49')]['offset']);}_0x36c53f['order']=qs['sort'](_0x18317c['query'][_0x5072('0x52')]);_0x36c53f[_0x5072('0x53')]=qs[_0x5072('0x4b')](_[_0x5072('0x54')](_0x18317c[_0x5072('0x49')],_0x2be3f8['filters']));_0x36c53f['where'][_0x5072('0x64')]=_0x3c4590['id'];if(_0x18317c[_0x5072('0x49')][_0x5072('0x55')]){_0x36c53f[_0x5072('0x53')]=_['merge'](_0x36c53f[_0x5072('0x53')],{'$or':_[_0x5072('0x43')](_0x36c53f[_0x5072('0x4d')],function(_0x4a1e18){var _0x994863={};_0x994863[_0x4a1e18]={'$like':'%'+_0x18317c['query'][_0x5072('0x55')]+'%'};return _0x994863;})});}_0x36c53f=_[_0x5072('0x56')]({},_0x36c53f,_0x18317c['options']);return db['MailInteraction'][_0x5072('0x32')]({'where':_0x36c53f['where']})[_0x5072('0x22')](function(_0x30b648){_0x1345eb[_0x5072('0x32')]=_0x30b648;if(_0x18317c[_0x5072('0x49')][_0x5072('0x5f')]){_0x36c53f[_0x5072('0x58')]=[{'model':db[_0x5072('0x8d')],'as':'Contact','required':![]},{'model':db[_0x5072('0x8e')],'as':'Owner','attributes':[_0x5072('0x3c'),_0x5072('0x8f'),_0x5072('0x90')],'required':![]},{'model':db['Tag'],'as':_0x5072('0x91'),'attributes':['id','name','color'],'where':_0x18317c[_0x5072('0x49')][_0x5072('0x92')]?{'id':_0x18317c[_0x5072('0x49')]['tag']}:undefined,'required':_0x18317c[_0x5072('0x49')][_0x5072('0x92')]?!![]:![]}];}return db[_0x5072('0x8b')][_0x5072('0x6a')](_0x36c53f);})['then'](function(_0x366c15){_0x1345eb[_0x5072('0x59')]=_0x366c15;return _0x1345eb;});}})['then'](respondWithFilteredResult(_0x5cb7e4,_0x36c53f))['catch'](handleError(_0x5cb7e4,null));};exports['addApplications']=function(_0x545ceb,_0x33896a,_0x2e28){return db[_0x5072('0x44')][_0x5072('0x67')]({'where':{'id':_0x545ceb[_0x5072('0x5c')]['id']}})['then'](handleEntityNotFound(_0x33896a,null))[_0x5072('0x22')](function(_0x11b138){if(_0x11b138){return db[_0x5072('0x93')]['transaction'](function(_0x1d78b9){return db['MailApplication'][_0x5072('0x38')]({'where':{'MailAccountId':_0x545ceb[_0x5072('0x5c')]['id']},'transaction':_0x1d78b9})[_0x5072('0x22')](function(_0x5c4824){var _0x3b7ca6=_['map'](_0x545ceb[_0x5072('0x61')],function(_0x4cb183){_0x4cb183[_0x5072('0x64')]=_0x545ceb[_0x5072('0x5c')]['id'];return _0x4cb183;});return db['MailApplication']['bulkCreate'](_0x3b7ca6,{'transaction':_0x1d78b9});});})[_0x5072('0x22')](function(){return db[_0x5072('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x545ceb[_0x5072('0x5c')]['id']},'order':_0x5072('0x95')});});}})[_0x5072('0x22')](respondWithResult(_0x33896a,null))[_0x5072('0x5a')](handleError(_0x33896a,null));};exports['getApplications']=function(_0x1f5398,_0x320e62,_0x2483bd){var _0xa5d6c4={};var _0xf7df3={};var _0x154c60;var _0x555218;return db[_0x5072('0x44')][_0x5072('0x67')]({'where':{'id':_0x1f5398['params']['id']}})['then'](handleEntityNotFound(_0x320e62,null))[_0x5072('0x22')](function(_0x558c91){if(_0x558c91){_0x154c60=_0x558c91;_0xf7df3[_0x5072('0x48')]=_['keys'](db['MailApplication'][_0x5072('0x45')]);_0xf7df3['query']=_[_0x5072('0x4a')](_0x1f5398[_0x5072('0x49')]);_0xf7df3[_0x5072('0x4b')]=_[_0x5072('0x4c')](_0xf7df3[_0x5072('0x48')],_0xf7df3[_0x5072('0x49')]);_0xa5d6c4['attributes']=_['intersection'](_0xf7df3[_0x5072('0x48')],qs[_0x5072('0x69')](_0x1f5398[_0x5072('0x49')][_0x5072('0x69')]));_0xa5d6c4['attributes']=_0xa5d6c4[_0x5072('0x4d')][_0x5072('0x4e')]?_0xa5d6c4['attributes']:_0xf7df3[_0x5072('0x48')];_0xa5d6c4[_0x5072('0x51')]=qs[_0x5072('0x52')](_0x1f5398[_0x5072('0x49')][_0x5072('0x52')]);_0xa5d6c4[_0x5072('0x53')]=qs['filters'](_[_0x5072('0x54')](_0x1f5398[_0x5072('0x49')],_0xf7df3['filters']));if(_0x1f5398[_0x5072('0x49')][_0x5072('0x55')]){_0xa5d6c4[_0x5072('0x53')]=_[_0x5072('0x56')](_0xa5d6c4['where'],{'$or':_[_0x5072('0x43')](_0xa5d6c4[_0x5072('0x4d')],function(_0x57da5a){var _0x296282={};_0x296282[_0x57da5a]={'$like':'%'+_0x1f5398[_0x5072('0x49')][_0x5072('0x55')]+'%'};return _0x296282;})});}_0xa5d6c4=_['merge']({},_0xa5d6c4,_0x1f5398[_0x5072('0x57')]);return _0x154c60[_0x5072('0x96')](_0xa5d6c4);}})[_0x5072('0x22')](function(_0xc6d309){if(_0xc6d309){_0x555218=_0xc6d309[_0x5072('0x4e')];if(!_0x1f5398[_0x5072('0x49')][_0x5072('0x4f')]('nolimit')){_0xa5d6c4[_0x5072('0x30')]=qs[_0x5072('0x30')](_0x1f5398[_0x5072('0x49')][_0x5072('0x30')]);_0xa5d6c4['offset']=qs[_0x5072('0x33')](_0x1f5398[_0x5072('0x49')][_0x5072('0x33')]);}return _0x154c60['getApplications'](_0xa5d6c4);}})[_0x5072('0x22')](function(_0x3ffd52){if(_0x3ffd52){return _0x3ffd52?{'count':_0x555218,'rows':_0x3ffd52}:null;}})[_0x5072('0x22')](respondWithResult(_0x320e62,null))[_0x5072('0x5a')](handleError(_0x320e62,null));};exports[_0x5072('0x97')]=function(_0x431af8,_0x4cd0da,_0x43981c){var _0xbf5869={'raw':!![],'where':{}};var _0x26e482={};var _0x181fc2={'count':0x0,'rows':[]};return db[_0x5072('0x44')][_0x5072('0x67')]({'where':{'id':_0x431af8[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x4cd0da,null))[_0x5072('0x22')](function(_0x42244a){if(_0x42244a){_0x26e482[_0x5072('0x48')]=_['keys'](db[_0x5072('0x98')][_0x5072('0x45')]);_0x26e482[_0x5072('0x49')]=_[_0x5072('0x4a')](_0x431af8[_0x5072('0x49')]);_0x26e482[_0x5072('0x4b')]=_['intersection'](_0x26e482[_0x5072('0x48')],_0x26e482[_0x5072('0x49')]);_0xbf5869[_0x5072('0x4d')]=_[_0x5072('0x4c')](_0x26e482[_0x5072('0x48')],qs[_0x5072('0x69')](_0x431af8[_0x5072('0x49')]['fields']));_0xbf5869['attributes']=_0xbf5869[_0x5072('0x4d')]['length']?_0xbf5869[_0x5072('0x4d')]:_0x26e482[_0x5072('0x48')];if(!_0x431af8[_0x5072('0x49')]['hasOwnProperty']('nolimit')){_0xbf5869[_0x5072('0x30')]=qs[_0x5072('0x30')](_0x431af8[_0x5072('0x49')][_0x5072('0x30')]);_0xbf5869['offset']=qs['offset'](_0x431af8[_0x5072('0x49')][_0x5072('0x33')]);}_0xbf5869['order']=qs['sort'](_0x431af8['query'][_0x5072('0x52')]);_0xbf5869['where']=qs[_0x5072('0x4b')](_[_0x5072('0x54')](_0x431af8[_0x5072('0x49')],_0x26e482[_0x5072('0x4b')]));_0xbf5869[_0x5072('0x53')]['MailAccountId']=_0x42244a['id'];if(_0x431af8[_0x5072('0x49')]['filter']){_0xbf5869[_0x5072('0x53')]=_[_0x5072('0x56')](_0xbf5869[_0x5072('0x53')],{'$or':_['map'](_0xbf5869['attributes'],function(_0x22be3c){var _0x2a5c99={};_0x2a5c99[_0x22be3c]={'$like':'%'+_0x431af8[_0x5072('0x49')][_0x5072('0x55')]+'%'};return _0x2a5c99;})});}if(_0x431af8[_0x5072('0x49')]['$gte']){var _0x4be2b0=_0x431af8[_0x5072('0x49')]['$gte'][_0x5072('0x99')](',');var _0x309013={};_0x309013[_0x4be2b0[0x0]]={'$gte':moment(_0x4be2b0[0x1])['format'](_0x5072('0x9a'))};_0xbf5869[_0x5072('0x53')]=_[_0x5072('0x56')](_0xbf5869['where'],_0x309013);}_0xbf5869=_[_0x5072('0x56')]({},_0xbf5869,_0x431af8[_0x5072('0x57')]);return db['MailMessage'][_0x5072('0x32')]({'where':_0xbf5869[_0x5072('0x53')]})[_0x5072('0x22')](function(_0xe1419){_0x181fc2[_0x5072('0x32')]=_0xe1419;if(_0x431af8['query'][_0x5072('0x5f')]){_0xbf5869[_0x5072('0x58')]=[{'all':!![]}];}return db[_0x5072('0x98')]['findAll'](_0xbf5869);})['then'](function(_0x11cccc){if(_0x431af8['query'][_0x5072('0x9b')]===_0x5072('0x9c')){for(var _0x110743=0x0;_0x110743<_0x11cccc['length'];_0x110743++){_0x11cccc[_0x110743][_0x5072('0x61')]=juice(_0x11cccc[_0x110743][_0x5072('0x61')]);}}_0x181fc2[_0x5072('0x59')]=_0x11cccc;return _0x181fc2;});}})['then'](respondWithFilteredResult(_0x4cd0da,_0xbf5869))[_0x5072('0x5a')](handleError(_0x4cd0da,null));};exports[_0x5072('0x3d')]=function(_0xdf6c46,_0x3d7580,_0x5d2a81){var _0x252274,_0x50b385={},_0x1a3530;if(_0xdf6c46[_0x5072('0x61')]['to']){_0x1a3530=_0xdf6c46[_0x5072('0x61')]['to'][_0x5072('0x99')](',')[0x0];}return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0xdf6c46[_0x5072('0x5c')]['id']},'include':[{'model':db[_0x5072('0x9d')],'as':_0x5072('0x9e'),'include':[{'model':db[_0x5072('0x8d')],'as':'Contacts','where':{'email':_0x1a3530},'limit':0x1,'order':[[_0x5072('0x9f'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x5072('0x22')](handleEntityNotFound(_0x3d7580,null))[_0x5072('0x22')](function(_0x1f6e8a){if(_0x1f6e8a){_0x252274=_0x1f6e8a;if(_0x1f6e8a[_0x5072('0x41')]){if(_[_0x5072('0x72')](_0xdf6c46[_0x5072('0x61')][_0x5072('0xa0')])){_0xdf6c46[_0x5072('0x61')]['from']=util[_0x5072('0xa1')](_0x5072('0xa2'),_0x1f6e8a[_0x5072('0x3c')],_0x1f6e8a[_0x5072('0x6f')]||_0x1f6e8a[_0x5072('0x41')][_0x5072('0x75')]);}if(_0xdf6c46[_0x5072('0x61')][_0x5072('0xa3')]&&_0xdf6c46[_0x5072('0x61')]['attachments'][_0x5072('0x4e')]){for(var _0x34769f=0x0;_0x34769f<_0xdf6c46['body'][_0x5072('0xa3')][_0x5072('0x4e')];_0x34769f+=0x1){_0xdf6c46[_0x5072('0x61')][_0x5072('0xa3')][_0x34769f]={'filename':_0xdf6c46[_0x5072('0x61')]['attachments'][_0x34769f][_0x5072('0x3c')],'path':path[_0x5072('0xa4')](config[_0x5072('0xa5')],_0x5072('0xa6'),_0xdf6c46['body'][_0x5072('0xa3')][_0x34769f][_0x5072('0xa7')])};}}var _0x5c6ac6={'tls':{'rejectUnauthorized':![]}};if(_[_0x5072('0x72')](_0x1f6e8a[_0x5072('0x41')]['service'])){if(_0x1f6e8a[_0x5072('0x41')]['authentication']){_0x5c6ac6[_0x5072('0xa8')]={'user':_0x1f6e8a['Smtp'][_0x5072('0x75')],'pass':_0x1f6e8a[_0x5072('0x41')][_0x5072('0x76')]};}_0x5c6ac6['host']=_0x1f6e8a[_0x5072('0x41')]['host'];_0x5c6ac6[_0x5072('0x7a')]=_0x1f6e8a[_0x5072('0x41')][_0x5072('0x7a')];_0x5c6ac6[_0x5072('0xa9')]=_0x1f6e8a[_0x5072('0x41')][_0x5072('0xa9')];}else{_0x5c6ac6['service']=_0x1f6e8a[_0x5072('0x41')][_0x5072('0xaa')];_0x5c6ac6[_0x5072('0xa8')]={'user':_0x1f6e8a[_0x5072('0x41')][_0x5072('0x75')],'pass':_0x1f6e8a[_0x5072('0x41')][_0x5072('0x76')]};}return respondWithRpcPromise(_0x5072('0xab'),_0x5072('0xac'),{'account':_0x5c6ac6,'message':_0xdf6c46[_0x5072('0x61')]});}else{throw new Error('List\x20not\x20found');}}})[_0x5072('0x22')](function(_0x6bba1e){if(_0x6bba1e){_0x50b385=_0x6bba1e;if(_0x252274[_0x5072('0x9e')]){if(_0x252274[_0x5072('0x9e')][_0x5072('0xad')][_0x5072('0x4e')]){return _0x252274[_0x5072('0x9e')]['Contacts'][0x0];}else{return db[_0x5072('0x8d')][_0x5072('0x65')](_[_0x5072('0x19')](_0xdf6c46['body'],{'firstName':_0xdf6c46['body']['to'],'email':_0xdf6c46[_0x5072('0x61')]['to'],'phone':_0xdf6c46[_0x5072('0x61')]['to'],'ListId':_0x252274[_0x5072('0x70')]}));}}else{throw new Error(_0x5072('0xae'));}}})[_0x5072('0x22')](function(_0x38ef35){if(_0x38ef35){var _0x2ed64a={'UserId':_0xdf6c46['user']['id'],'ContactId':_0x38ef35['id'],'MailAccountId':_0x252274['id'],'inReplyTo':_0x50b385['messageId'],'to':_0xdf6c46[_0x5072('0x61')][_0x5072('0xa0')],'cc':_0xdf6c46[_0x5072('0x61')]['cc'],'subject':_0xdf6c46[_0x5072('0x61')]['subject'],'attach':_0xdf6c46[_0x5072('0x61')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x5072('0xa1')](_0x5072('0x9a')),'lastMsgDirection':'out','Messages':[_['merge'](_0xdf6c46['body'],{'messageId':_0x50b385[_0x5072('0xaf')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x252274['id'],'UserId':_0xdf6c46[_0x5072('0x75')]['id'],'ContactId':_0x38ef35['id']})]};if(_0xdf6c46[_0x5072('0x61')][_0x5072('0xb0')]){_0x2ed64a=_['merge'](_0x2ed64a,_0xdf6c46['body'][_0x5072('0xb0')]);}return db[_0x5072('0x8b')][_0x5072('0x65')](_0x2ed64a,{'include':[{'model':db[_0x5072('0x98')],'as':'Messages'}]});}})['then'](respondWithResult(_0x3d7580,null))[_0x5072('0x5a')](handleError(_0x3d7580,null));};exports['verifySmtp']=function(_0x2cad15,_0x477c03,_0x3cb942){return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0x2cad15[_0x5072('0x5c')]['id']},'include':[{'model':db[_0x5072('0x5d')],'as':_0x5072('0x41'),'raw':!![]}]})[_0x5072('0x22')](handleEntityNotFound(_0x477c03,null))[_0x5072('0x22')](function(_0x4d86d5){if(_0x4d86d5&&_0x4d86d5[_0x5072('0x41')]){var _0x54fbd5={'id':_0x4d86d5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4d86d5['Smtp'][_0x5072('0xaa')]){_0x54fbd5[_0x5072('0xaa')]=_0x4d86d5[_0x5072('0x41')][_0x5072('0xaa')];}else{_0x54fbd5[_0x5072('0x79')]=_0x4d86d5[_0x5072('0x41')][_0x5072('0x79')];_0x54fbd5[_0x5072('0x7a')]=_0x4d86d5[_0x5072('0x41')][_0x5072('0x7a')];_0x54fbd5[_0x5072('0xa9')]=_0x4d86d5['Smtp'][_0x5072('0xa9')];}if(_0x4d86d5[_0x5072('0x41')][_0x5072('0x78')]){_0x54fbd5[_0x5072('0xa8')]={'user':_0x4d86d5['Smtp'][_0x5072('0x75')],'pass':_0x4d86d5[_0x5072('0x41')][_0x5072('0x76')]};}return respondWithRpcPromise(_0x5072('0xb1'),_0x5072('0xb2'),{'account':_0x54fbd5});}})[_0x5072('0x22')](respondWithResult(_0x477c03,null))['catch'](handleError(_0x477c03,null));};exports[_0x5072('0x38')]=function(_0x3c1faa,_0x4a099d){return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0x3c1faa['params']['id']}})['then'](handleEntityNotFound(_0x4a099d,null))[_0x5072('0x22')](function(_0x508c96){if(_0x508c96&&_0x508c96['service']){throw new db[(_0x5072('0xb3'))]['ValidationError'](_0x5072('0xb4'));}return _0x508c96;})['then'](removeEntity(_0x4a099d,null))[_0x5072('0x5a')](handleError(_0x4a099d,null));};exports[_0x5072('0xb5')]=function(_0x4f1121,_0x1473ec,_0x5a9055){return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0x4f1121[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x1473ec,null))[_0x5072('0x22')](function(_0x55f12a){if(_0x55f12a){return _0x55f12a[_0x5072('0xb5')](_0x4f1121[_0x5072('0x61')][_0x5072('0x6c')],_[_0x5072('0x8c')](_0x4f1121[_0x5072('0x61')],[_0x5072('0x6c'),'id'])||{})[_0x5072('0xb6')](function(_0x3cf975){for(var _0x29c711=0x0;_0x29c711<_0x4f1121[_0x5072('0x61')][_0x5072('0x6c')]['length'];_0x29c711+=0x1){socket[_0x5072('0xb7')](_0x5072('0xb8'),{'UserId':Number(_0x4f1121[_0x5072('0x61')]['ids'][_0x29c711]),'MailAccountId':Number(_0x4f1121[_0x5072('0x5c')]['id'])});}return _0x3cf975;});}})[_0x5072('0x22')](respondWithResult(_0x1473ec,null))[_0x5072('0x5a')](handleError(_0x1473ec,null));};exports[_0x5072('0xb9')]=function(_0x1964b2,_0x1f1b36,_0x5e5722){return db[_0x5072('0x44')][_0x5072('0x60')]({'where':{'id':_0x1964b2[_0x5072('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1f1b36,null))[_0x5072('0x22')](function(_0x29df31){if(_0x29df31){return _0x29df31[_0x5072('0xb9')](_0x1964b2[_0x5072('0x49')][_0x5072('0x6c')])[_0x5072('0x22')](function(){if(_[_0x5072('0xba')](_0x1964b2['query'][_0x5072('0x6c')])){for(var _0x21a58f=0x0;_0x21a58f<_0x1964b2[_0x5072('0x49')][_0x5072('0x6c')][_0x5072('0x4e')];_0x21a58f+=0x1){socket[_0x5072('0xb7')](_0x5072('0xbb'),{'UserId':Number(_0x1964b2[_0x5072('0x49')]['ids'][_0x21a58f]),'MailAccountId':Number(_0x1964b2[_0x5072('0x5c')]['id'])});}}else{socket[_0x5072('0xb7')]('userMailAccount:remove',{'UserId':Number(_0x1964b2[_0x5072('0x49')][_0x5072('0x6c')]),'MailAccountId':Number(_0x1964b2['params']['id'])});}});}})[_0x5072('0x22')](respondWithStatusCode(_0x1f1b36,null))['catch'](handleError(_0x1f1b36,null));};exports[_0x5072('0xbc')]=function(_0x20fbae,_0x364bef,_0x12b34c){var _0x1987dd={};var _0x295791={};var _0x1d47f5;var _0x5ba18a;return db['MailAccount']['findOne']({'where':{'id':_0x20fbae[_0x5072('0x5c')]['id']}})[_0x5072('0x22')](handleEntityNotFound(_0x364bef,null))[_0x5072('0x22')](function(_0x42ce6d){if(_0x42ce6d){_0x1d47f5=_0x42ce6d;_0x295791[_0x5072('0x48')]=_['keys'](db['User'][_0x5072('0x45')]);_0x295791[_0x5072('0x49')]=_[_0x5072('0x4a')](_0x20fbae[_0x5072('0x49')]);_0x295791[_0x5072('0x4b')]=_[_0x5072('0x4c')](_0x295791[_0x5072('0x48')],_0x295791['query']);_0x1987dd['attributes']=_[_0x5072('0x4c')](_0x295791[_0x5072('0x48')],qs['fields'](_0x20fbae[_0x5072('0x49')][_0x5072('0x69')]));_0x1987dd[_0x5072('0x4d')]=_0x1987dd[_0x5072('0x4d')][_0x5072('0x4e')]?_0x1987dd['attributes']:_0x295791[_0x5072('0x48')];_0x1987dd['order']=qs['sort'](_0x20fbae['query'][_0x5072('0x52')]);_0x1987dd[_0x5072('0x53')]=qs[_0x5072('0x4b')](_['pick'](_0x20fbae[_0x5072('0x49')],_0x295791[_0x5072('0x4b')]));if(_0x20fbae['query'][_0x5072('0x55')]){_0x1987dd[_0x5072('0x53')]=_[_0x5072('0x56')](_0x1987dd['where'],{'$or':_[_0x5072('0x43')](_0x1987dd[_0x5072('0x4d')],function(_0x14a60e){var _0x2c494d={};_0x2c494d[_0x14a60e]={'$like':'%'+_0x20fbae[_0x5072('0x49')][_0x5072('0x55')]+'%'};return _0x2c494d;})});}_0x1987dd=_[_0x5072('0x56')]({},_0x1987dd,_0x20fbae[_0x5072('0x57')]);return _0x1d47f5[_0x5072('0xbc')](_0x1987dd);}})[_0x5072('0x22')](function(_0x3b803f){if(_0x3b803f){_0x5ba18a=_0x3b803f[_0x5072('0x4e')];if(!_0x20fbae[_0x5072('0x49')][_0x5072('0x4f')](_0x5072('0x50'))){_0x1987dd[_0x5072('0x30')]=qs[_0x5072('0x30')](_0x20fbae[_0x5072('0x49')]['limit']);_0x1987dd[_0x5072('0x33')]=qs[_0x5072('0x33')](_0x20fbae[_0x5072('0x49')][_0x5072('0x33')]);}return _0x1d47f5[_0x5072('0xbc')](_0x1987dd);}})['then'](function(_0x133d04){if(_0x133d04){return _0x133d04?{'count':_0x5ba18a,'rows':_0x133d04}:null;}})[_0x5072('0x22')](respondWithResult(_0x364bef,null))['catch'](handleError(_0x364bef,null));}; \ No newline at end of file +var _0xa805=['error','code','message','MailAccount,\x20%s,\x20%s','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','MailAccounts','UserProfileResource','destroy','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','MailAccount','includeAll','include','findAll','rows','show','Pause','body','find','params','describe','MailAccountId','create','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rawAttributes','removeAnswers','isNil','active','description','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','cservice','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','setImap','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','inlineCss','true','Contacts','DESC','from','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','ListId','messageId','subject','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','html-to-text','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e38a5,_0x1bf640){var _0x20796e=function(_0x1a23a2){while(--_0x1a23a2){_0x1e38a5['push'](_0x1e38a5['shift']());}};_0x20796e(++_0x1bf640);}(_0xa805,0x161));var _0x5a80=function(_0x3938c6,_0x77935d){_0x3938c6=_0x3938c6-0x0;var _0x1ba276=_0xa805[_0x3938c6];return _0x1ba276;};'use strict';var emlformat=require(_0x5a80('0x0'));var rimraf=require(_0x5a80('0x1'));var zipdir=require(_0x5a80('0x2'));var jsonpatch=require(_0x5a80('0x3'));var rp=require(_0x5a80('0x4'));var moment=require(_0x5a80('0x5'));var BPromise=require(_0x5a80('0x6'));var Mustache=require(_0x5a80('0x7'));var util=require(_0x5a80('0x8'));var path=require(_0x5a80('0x9'));var sox=require(_0x5a80('0xa'));var csv=require(_0x5a80('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a80('0xc'));var squel=require('squel');var crypto=require(_0x5a80('0xd'));var jsforce=require(_0x5a80('0xe'));var deskjs=require(_0x5a80('0xf'));var toCsv=require(_0x5a80('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x5a80('0x10'));var juice=require(_0x5a80('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5a80('0x12'));var as=require(_0x5a80('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5a80('0x14'));var utils=require(_0x5a80('0x15'));var config=require(_0x5a80('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a80('0x17'))['db'];config[_0x5a80('0x18')]=_[_0x5a80('0x19')](config[_0x5a80('0x18')],{'host':_0x5a80('0x1a'),'port':0x18eb});var socket=require(_0x5a80('0x1b'))(new Redis(config[_0x5a80('0x18')]));require(_0x5a80('0x1c'))[_0x5a80('0x1d')](socket);var jayson=require(_0x5a80('0x1e'));var client=jayson[_0x5a80('0x1f')][_0x5a80('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x3e8109,_0x5dc158,_0x14b790,_0x5e0bda){return new BPromise(function(_0x528616,_0x3f042e){var _0x2c63e4=_0x5e0bda||client;return _0x2c63e4[_0x5a80('0x21')](_0x3e8109,_0x14b790)[_0x5a80('0x22')](function(_0x3278fc){logger['info']('MailAccount,\x20%s,\x20%s',_0x5dc158,_0x5a80('0x23'));logger[_0x5a80('0x24')](_0x5a80('0x25'),_0x5dc158,_0x5a80('0x23'),JSON[_0x5a80('0x26')](_0x3278fc));if(_0x3278fc[_0x5a80('0x27')]){if(_0x3278fc[_0x5a80('0x27')][_0x5a80('0x28')]===0x1f4){logger[_0x5a80('0x27')]('MailAccount,\x20%s,\x20%s',_0x5dc158,_0x3278fc[_0x5a80('0x27')][_0x5a80('0x29')]);return _0x3f042e(_0x3278fc[_0x5a80('0x27')][_0x5a80('0x29')]);}logger[_0x5a80('0x27')](_0x5a80('0x2a'),_0x5dc158,_0x3278fc[_0x5a80('0x27')]['message']);return _0x528616(_0x3278fc[_0x5a80('0x27')]['message']);}else{logger[_0x5a80('0x2b')]('MailAccount,\x20%s,\x20%s',_0x5dc158,_0x5a80('0x23'));_0x528616(_0x3278fc[_0x5a80('0x2c')][_0x5a80('0x29')]);}})[_0x5a80('0x2d')](function(_0x567e59){logger[_0x5a80('0x27')]('MailAccount,\x20%s,\x20%s',_0x5dc158,_0x567e59);_0x3f042e(_0x567e59);});});}function respondWithStatusCode(_0x5be8dd,_0x315d77){_0x315d77=_0x315d77||0xcc;return function(_0x528f8b){if(_0x528f8b){return _0x5be8dd[_0x5a80('0x2e')](_0x315d77);}return _0x5be8dd['status'](_0x315d77)[_0x5a80('0x2f')]();};}function respondWithResult(_0x155cc8,_0x401c3d){_0x401c3d=_0x401c3d||0xc8;return function(_0x475398){if(_0x475398){return _0x155cc8[_0x5a80('0x30')](_0x401c3d)[_0x5a80('0x31')](_0x475398);}};}function respondWithFilteredResult(_0x10d6b2,_0x11d445){return function(_0x584332){if(_0x584332){var _0x3d1c83=typeof _0x11d445[_0x5a80('0x32')]===_0x5a80('0x33')&&typeof _0x11d445[_0x5a80('0x34')]==='undefined';var _0xe27cfe=_0x584332['count'];var _0x3a16e8=_0x3d1c83?0x0:_0x11d445[_0x5a80('0x32')];var _0x2bae5c=_0x3d1c83?_0x584332[_0x5a80('0x35')]:_0x11d445[_0x5a80('0x32')]+_0x11d445[_0x5a80('0x34')];var _0x1ccd79;if(_0x2bae5c>=_0xe27cfe){_0x2bae5c=_0xe27cfe;_0x1ccd79=0xc8;}else{_0x1ccd79=0xce;}_0x10d6b2[_0x5a80('0x30')](_0x1ccd79);return _0x10d6b2[_0x5a80('0x36')](_0x5a80('0x37'),_0x3a16e8+'-'+_0x2bae5c+'/'+_0xe27cfe)[_0x5a80('0x31')](_0x584332);}return null;};}function patchUpdates(_0x55fce2){return function(_0x2dc8d2){try{jsonpatch[_0x5a80('0x38')](_0x2dc8d2,_0x55fce2,!![]);}catch(_0x4f98a2){return BPromise[_0x5a80('0x39')](_0x4f98a2);}return _0x2dc8d2[_0x5a80('0x3a')]();};}function saveUpdates(_0xdabeea,_0x2a04d2){return function(_0x4cc536){if(_0x4cc536){return _0x4cc536[_0x5a80('0x3b')](_0xdabeea)[_0x5a80('0x22')](function(_0x53e0e1){return _0x53e0e1;});}return null;};}function removeEntity(_0x37a0be,_0x2cde5e){return function(_0x21461c){if(_0x21461c){return _0x21461c['destroy']()[_0x5a80('0x22')](function(){var _0x33988a=_0x21461c[_0x5a80('0x3c')]({'plain':!![]});var _0x4cc040=_0x5a80('0x3d');return db[_0x5a80('0x3e')][_0x5a80('0x3f')]({'where':{'type':_0x4cc040,'resourceId':_0x33988a['id']}})[_0x5a80('0x22')](function(){return _0x21461c;});})['then'](function(){_0x37a0be[_0x5a80('0x30')](0xcc)[_0x5a80('0x2f')]();});}};}function handleEntityNotFound(_0x4667cd,_0x132b98){return function(_0x539ab7){if(!_0x539ab7){_0x4667cd[_0x5a80('0x2e')](0x194);}return _0x539ab7;};}function handleError(_0x5d89c6,_0x3a3394){_0x3a3394=_0x3a3394||0x1f4;return function(_0x17469c){logger[_0x5a80('0x27')](_0x17469c['stack']);if(_0x17469c[_0x5a80('0x40')]){delete _0x17469c[_0x5a80('0x40')];}_0x5d89c6[_0x5a80('0x30')](_0x3a3394)[_0x5a80('0x41')](_0x17469c);};}exports[_0x5a80('0x42')]=function(_0x1a4f70,_0x5ae136){var _0xbedfee={'include':[{'model':db[_0x5a80('0x43')],'as':_0x5a80('0x44')},{'model':db[_0x5a80('0x45')],'as':_0x5a80('0x46')},{'model':db['Pause'],'as':_0x5a80('0x47')}]},_0xd9eedd={},_0x9f38f7={'count':0x0,'rows':[]};var _0x578d7e=_[_0x5a80('0x48')](db['MailAccount']['rawAttributes'],function(_0x2c4d5a){return{'name':_0x2c4d5a[_0x5a80('0x49')],'type':_0x2c4d5a[_0x5a80('0x4a')][_0x5a80('0x4b')]};});_0xd9eedd['model']=_[_0x5a80('0x48')](_0x578d7e,_0x5a80('0x40'));_0xd9eedd[_0x5a80('0x4c')]=_[_0x5a80('0x4d')](_0x1a4f70[_0x5a80('0x4c')]);_0xd9eedd[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0xd9eedd[_0x5a80('0x50')],_0xd9eedd[_0x5a80('0x4c')]);_0xbedfee[_0x5a80('0x51')]=_['intersection'](_0xd9eedd['model'],qs[_0x5a80('0x52')](_0x1a4f70[_0x5a80('0x4c')][_0x5a80('0x52')]));_0xbedfee[_0x5a80('0x51')]=_0xbedfee[_0x5a80('0x51')][_0x5a80('0x53')]?_0xbedfee[_0x5a80('0x51')]:_0xd9eedd[_0x5a80('0x50')];if(!_0x1a4f70[_0x5a80('0x4c')][_0x5a80('0x54')]('nolimit')){_0xbedfee[_0x5a80('0x34')]=qs['limit'](_0x1a4f70['query'][_0x5a80('0x34')]);_0xbedfee['offset']=qs[_0x5a80('0x32')](_0x1a4f70['query']['offset']);}_0xbedfee[_0x5a80('0x55')]=qs[_0x5a80('0x56')](_0x1a4f70[_0x5a80('0x4c')][_0x5a80('0x56')]);_0xbedfee[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_[_0x5a80('0x58')](_0x1a4f70[_0x5a80('0x4c')],_0xd9eedd[_0x5a80('0x4e')]),_0x578d7e);if(_0x1a4f70[_0x5a80('0x4c')]['filter']){_0xbedfee[_0x5a80('0x57')]=_[_0x5a80('0x59')](_0xbedfee['where'],{'$or':_[_0x5a80('0x48')](_0x578d7e,function(_0x3f9f4f){if(_0x3f9f4f['type']!==_0x5a80('0x5a')){var _0x51a29d={};_0x51a29d[_0x3f9f4f[_0x5a80('0x40')]]={'$like':'%'+_0x1a4f70[_0x5a80('0x4c')][_0x5a80('0x5b')]+'%'};return _0x51a29d;}})});}_0xbedfee=_['merge']({},_0xbedfee,_0x1a4f70[_0x5a80('0x5c')]);var _0x5339aa={'where':_0xbedfee[_0x5a80('0x57')]};return db[_0x5a80('0x5d')][_0x5a80('0x35')](_0x5339aa)['then'](function(_0x5c786b){_0x9f38f7[_0x5a80('0x35')]=_0x5c786b;if(_0x1a4f70[_0x5a80('0x4c')][_0x5a80('0x5e')]){_0xbedfee[_0x5a80('0x5f')]=[{'all':!![]}];}return db[_0x5a80('0x5d')][_0x5a80('0x60')](_0xbedfee);})['then'](function(_0x3f2692){_0x9f38f7[_0x5a80('0x61')]=_0x3f2692;return _0x9f38f7;})['then'](respondWithFilteredResult(_0x5ae136,_0xbedfee))[_0x5a80('0x2d')](handleError(_0x5ae136,null));};exports[_0x5a80('0x62')]=function(_0x180f16,_0x3450a4){var _0x9e0e38={'raw':![],'where':{'id':_0x180f16['params']['id']},'include':[{'model':db[_0x5a80('0x43')],'as':_0x5a80('0x44')},{'model':db['MailServerOut'],'as':_0x5a80('0x46')},{'model':db[_0x5a80('0x63')],'as':_0x5a80('0x47')}]},_0x9b5eb7={};_0x9b5eb7[_0x5a80('0x50')]=_[_0x5a80('0x4d')](db['MailAccount']['rawAttributes']);_0x9b5eb7[_0x5a80('0x4c')]=_[_0x5a80('0x4d')](_0x180f16[_0x5a80('0x4c')]);_0x9b5eb7[_0x5a80('0x4e')]=_['intersection'](_0x9b5eb7['model'],_0x9b5eb7[_0x5a80('0x4c')]);_0x9e0e38[_0x5a80('0x51')]=_[_0x5a80('0x4f')](_0x9b5eb7[_0x5a80('0x50')],qs['fields'](_0x180f16[_0x5a80('0x4c')]['fields']));_0x9e0e38['attributes']=_0x9e0e38[_0x5a80('0x51')][_0x5a80('0x53')]?_0x9e0e38[_0x5a80('0x51')]:_0x9b5eb7[_0x5a80('0x50')];if(_0x180f16[_0x5a80('0x4c')][_0x5a80('0x5e')]){_0x9e0e38[_0x5a80('0x5f')]=[{'all':!![]}];}_0x9e0e38=_[_0x5a80('0x59')]({},_0x9e0e38,_0x180f16[_0x5a80('0x5c')]);return db[_0x5a80('0x5d')]['find'](_0x9e0e38)[_0x5a80('0x22')](handleEntityNotFound(_0x3450a4,null))['then'](respondWithResult(_0x3450a4,null))['catch'](handleError(_0x3450a4,null));};exports['update']=function(_0x225886,_0x40ac13){if(_0x225886['body']['id']){delete _0x225886[_0x5a80('0x64')]['id'];}return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x225886[_0x5a80('0x66')]['id']},'include':[{'model':db[_0x5a80('0x43')],'as':_0x5a80('0x44')},{'model':db[_0x5a80('0x45')],'as':_0x5a80('0x46')},{'model':db['Pause'],'as':_0x5a80('0x47')}]})[_0x5a80('0x22')](handleEntityNotFound(_0x40ac13,null))[_0x5a80('0x22')](saveUpdates(_0x225886[_0x5a80('0x64')],null))['then'](function(_0x40bb17){if(_0x40bb17&&_0x225886['body'][_0x5a80('0x44')]){return db[_0x5a80('0x43')][_0x5a80('0x3b')](_0x225886['body']['Imap'],{'where':{'MailAccountId':_0x40bb17['id']}})['then'](function(){return _0x40bb17;});}return _0x40bb17;})[_0x5a80('0x22')](function(_0x5640fd){if(_0x5640fd&&_0x225886[_0x5a80('0x64')][_0x5a80('0x46')]){return db[_0x5a80('0x45')][_0x5a80('0x3b')](_0x225886['body']['Smtp'],{'where':{'MailAccountId':_0x5640fd['id']}})['then'](function(){return _0x5640fd;});}return _0x5640fd;})['then'](respondWithResult(_0x40ac13,null))[_0x5a80('0x2d')](handleError(_0x40ac13,null));};exports[_0x5a80('0x67')]=function(_0x4c55b4,_0x4ff856){return db[_0x5a80('0x5d')][_0x5a80('0x67')]()['then'](respondWithResult(_0x4ff856,null))[_0x5a80('0x2d')](handleError(_0x4ff856,null));};exports['addDisposition']=function(_0x39b04a,_0x15dce1,_0x1ce6e8){if(_0x39b04a[_0x5a80('0x64')]['id']){delete _0x39b04a['body']['id'];}return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x39b04a[_0x5a80('0x66')]['id']}})['then'](handleEntityNotFound(_0x15dce1,null))[_0x5a80('0x22')](function(_0x3573d8){if(_0x3573d8){_0x39b04a[_0x5a80('0x64')][_0x5a80('0x68')]=_0x3573d8['id'];return db['Disposition'][_0x5a80('0x69')](_0x39b04a[_0x5a80('0x64')]);}})['then'](respondWithResult(_0x15dce1,null))[_0x5a80('0x2d')](handleError(_0x15dce1,null));};exports[_0x5a80('0x6a')]=function(_0x3f10c3,_0x348567,_0x28cdc2){var _0x596b97={'raw':![],'where':{}};var _0xe8b47a={};var _0xa0aa53={'count':0x0,'rows':[]};return db[_0x5a80('0x5d')][_0x5a80('0x6b')]({'where':{'id':_0x3f10c3[_0x5a80('0x66')]['id']}})['then'](handleEntityNotFound(_0x348567,null))['then'](function(_0x27bc33){if(_0x27bc33){_0xe8b47a[_0x5a80('0x50')]=_[_0x5a80('0x4d')](db[_0x5a80('0x6c')]['rawAttributes']);_0xe8b47a[_0x5a80('0x4c')]=_[_0x5a80('0x4d')](_0x3f10c3[_0x5a80('0x4c')]);_0xe8b47a[_0x5a80('0x4e')]=_['intersection'](_0xe8b47a[_0x5a80('0x50')],_0xe8b47a[_0x5a80('0x4c')]);_0x596b97[_0x5a80('0x51')]=_['intersection'](_0xe8b47a[_0x5a80('0x50')],qs[_0x5a80('0x52')](_0x3f10c3['query'][_0x5a80('0x52')]));_0x596b97['attributes']=_0x596b97[_0x5a80('0x51')]['length']?_0x596b97['attributes']:_0xe8b47a[_0x5a80('0x50')];if(!_0x3f10c3[_0x5a80('0x4c')]['hasOwnProperty'](_0x5a80('0x6d'))){_0x596b97['limit']=qs[_0x5a80('0x34')](_0x3f10c3[_0x5a80('0x4c')]['limit']);_0x596b97[_0x5a80('0x32')]=qs[_0x5a80('0x32')](_0x3f10c3[_0x5a80('0x4c')][_0x5a80('0x32')]);}_0x596b97[_0x5a80('0x55')]=qs[_0x5a80('0x56')](_0x3f10c3[_0x5a80('0x4c')][_0x5a80('0x56')]);_0x596b97[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_[_0x5a80('0x58')](_0x3f10c3['query'],_0xe8b47a[_0x5a80('0x4e')]));_0x596b97[_0x5a80('0x57')][_0x5a80('0x68')]=_0x27bc33['id'];if(_0x3f10c3[_0x5a80('0x4c')][_0x5a80('0x5b')]){_0x596b97['where']=_['merge'](_0x596b97['where'],{'$or':_[_0x5a80('0x48')](_0x596b97[_0x5a80('0x51')],function(_0x28845d){var _0x4b6b5d={};_0x4b6b5d[_0x28845d]={'$like':'%'+_0x3f10c3['query'][_0x5a80('0x5b')]+'%'};return _0x4b6b5d;})});}_0x596b97=_[_0x5a80('0x59')]({},_0x596b97,_0x3f10c3[_0x5a80('0x5c')]);return db[_0x5a80('0x6c')][_0x5a80('0x35')]({'where':_0x596b97[_0x5a80('0x57')]})['then'](function(_0x4d4648){_0xa0aa53[_0x5a80('0x35')]=_0x4d4648;if(_0x3f10c3[_0x5a80('0x4c')][_0x5a80('0x5e')]){_0x596b97[_0x5a80('0x5f')]=[{'all':!![]}];}return db[_0x5a80('0x6c')][_0x5a80('0x60')](_0x596b97);})[_0x5a80('0x22')](function(_0x2b62e5){_0xa0aa53[_0x5a80('0x61')]=_0x2b62e5;return _0xa0aa53;});}})[_0x5a80('0x22')](respondWithFilteredResult(_0x348567,_0x596b97))[_0x5a80('0x2d')](handleError(_0x348567,null));};exports['removeDispositions']=function(_0x1c613b,_0x5ad3aa,_0x2b882d){return db[_0x5a80('0x5d')]['find']({'where':{'id':_0x1c613b[_0x5a80('0x66')]['id']}})['then'](handleEntityNotFound(_0x5ad3aa,null))[_0x5a80('0x22')](function(_0x3c252b){if(_0x3c252b){return _0x3c252b[_0x5a80('0x6e')](_0x1c613b[_0x5a80('0x4c')][_0x5a80('0x6f')]);}})['then'](respondWithStatusCode(_0x5ad3aa,null))[_0x5a80('0x2d')](handleError(_0x5ad3aa,null));};exports[_0x5a80('0x70')]=function(_0x2b7af9,_0x4e4642,_0x461096){if(_0x2b7af9[_0x5a80('0x64')]['id']){delete _0x2b7af9[_0x5a80('0x64')]['id'];}return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x2b7af9['params']['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x4e4642,null))[_0x5a80('0x22')](function(_0x2eab6f){if(_0x2eab6f){_0x2b7af9[_0x5a80('0x64')][_0x5a80('0x68')]=_0x2eab6f['id'];return db[_0x5a80('0x71')]['create'](_0x2b7af9['body']);}})['then'](respondWithResult(_0x4e4642,null))[_0x5a80('0x2d')](handleError(_0x4e4642,null));};exports[_0x5a80('0x72')]=function(_0xa38667,_0x37a86c,_0x32fc5c){var _0x5eb9a4={'raw':![],'where':{}};var _0x1671e3={};var _0x50945a={'count':0x0,'rows':[]};return db[_0x5a80('0x5d')][_0x5a80('0x6b')]({'where':{'id':_0xa38667[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x37a86c,null))[_0x5a80('0x22')](function(_0x18b42f){if(_0x18b42f){_0x1671e3[_0x5a80('0x50')]=_[_0x5a80('0x4d')](db['CannedAnswer'][_0x5a80('0x73')]);_0x1671e3[_0x5a80('0x4c')]=_[_0x5a80('0x4d')](_0xa38667[_0x5a80('0x4c')]);_0x1671e3[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0x1671e3[_0x5a80('0x50')],_0x1671e3[_0x5a80('0x4c')]);_0x5eb9a4[_0x5a80('0x51')]=_[_0x5a80('0x4f')](_0x1671e3[_0x5a80('0x50')],qs[_0x5a80('0x52')](_0xa38667[_0x5a80('0x4c')]['fields']));_0x5eb9a4[_0x5a80('0x51')]=_0x5eb9a4[_0x5a80('0x51')]['length']?_0x5eb9a4[_0x5a80('0x51')]:_0x1671e3[_0x5a80('0x50')];if(!_0xa38667[_0x5a80('0x4c')]['hasOwnProperty']('nolimit')){_0x5eb9a4[_0x5a80('0x34')]=qs[_0x5a80('0x34')](_0xa38667[_0x5a80('0x4c')][_0x5a80('0x34')]);_0x5eb9a4[_0x5a80('0x32')]=qs[_0x5a80('0x32')](_0xa38667[_0x5a80('0x4c')]['offset']);}_0x5eb9a4[_0x5a80('0x55')]=qs[_0x5a80('0x56')](_0xa38667[_0x5a80('0x4c')]['sort']);_0x5eb9a4[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_[_0x5a80('0x58')](_0xa38667['query'],_0x1671e3['filters']));_0x5eb9a4[_0x5a80('0x57')]['MailAccountId']=_0x18b42f['id'];if(_0xa38667[_0x5a80('0x4c')]['filter']){_0x5eb9a4[_0x5a80('0x57')]=_[_0x5a80('0x59')](_0x5eb9a4[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x5eb9a4['attributes'],function(_0x5174d4){var _0xafdd0b={};_0xafdd0b[_0x5174d4]={'$like':'%'+_0xa38667[_0x5a80('0x4c')]['filter']+'%'};return _0xafdd0b;})});}_0x5eb9a4=_[_0x5a80('0x59')]({},_0x5eb9a4,_0xa38667[_0x5a80('0x5c')]);return db['CannedAnswer'][_0x5a80('0x35')]({'where':_0x5eb9a4[_0x5a80('0x57')]})['then'](function(_0x33fbd5){_0x50945a[_0x5a80('0x35')]=_0x33fbd5;if(_0xa38667[_0x5a80('0x4c')]['includeAll']){_0x5eb9a4['include']=[{'all':!![]}];}return db[_0x5a80('0x71')][_0x5a80('0x60')](_0x5eb9a4);})[_0x5a80('0x22')](function(_0x186d1b){_0x50945a['rows']=_0x186d1b;return _0x50945a;});}})[_0x5a80('0x22')](respondWithFilteredResult(_0x37a86c,_0x5eb9a4))['catch'](handleError(_0x37a86c,null));};exports[_0x5a80('0x74')]=function(_0x513cee,_0x8723fe,_0x153fe4){return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x513cee[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x8723fe,null))[_0x5a80('0x22')](function(_0x4d8bcc){if(_0x4d8bcc){return _0x4d8bcc['removeAnswers'](_0x513cee['query'][_0x5a80('0x6f')]);}})['then'](respondWithStatusCode(_0x8723fe,null))[_0x5a80('0x2d')](handleError(_0x8723fe,null));};exports[_0x5a80('0x69')]=function(_0x17fbdc,_0x2a8782){var _0x44fc00={'name':_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x40')],'key':_0x17fbdc['body'][_0x5a80('0x4b')],'email':_0x17fbdc[_0x5a80('0x64')]['email'],'ListId':_0x17fbdc[_0x5a80('0x64')]['ListId'],'active':!_[_0x5a80('0x75')](_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x76')])?_0x17fbdc['body'][_0x5a80('0x76')]:!![],'description':_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x77')]||null,'Imap':{},'Smtp':{}};if(_[_0x5a80('0x75')](_0x17fbdc['body']['cservice'])){if(_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x78')]){_0x44fc00['Imap'][_0x5a80('0x79')]=_0x44fc00['Smtp']['user']=_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x7a')];_0x44fc00[_0x5a80('0x44')][_0x5a80('0x7b')]=_0x44fc00[_0x5a80('0x46')]['pass']=_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x7c')];}else{_0x44fc00[_0x5a80('0x44')][_0x5a80('0x7d')]=_0x44fc00[_0x5a80('0x46')][_0x5a80('0x7d')]=![];}_0x44fc00['Imap'][_0x5a80('0x7e')]=_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x44')]['host'];_0x44fc00[_0x5a80('0x44')][_0x5a80('0x7f')]=_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x44')][_0x5a80('0x7f')];_0x44fc00[_0x5a80('0x46')][_0x5a80('0x7e')]=_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x46')]['host'];_0x44fc00['Smtp'][_0x5a80('0x7f')]=_0x17fbdc[_0x5a80('0x64')]['Smtp'][_0x5a80('0x7f')];}else{_0x44fc00[_0x5a80('0x44')]['service']=_0x44fc00['Smtp'][_0x5a80('0x80')]=_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x81')];_0x44fc00[_0x5a80('0x44')][_0x5a80('0x79')]=_0x44fc00['Smtp'][_0x5a80('0x79')]=_0x17fbdc[_0x5a80('0x64')][_0x5a80('0x7a')];_0x44fc00['Imap'][_0x5a80('0x7b')]=_0x44fc00[_0x5a80('0x46')][_0x5a80('0x82')]=_0x17fbdc[_0x5a80('0x64')]['cpassword'];}return db[_0x5a80('0x5d')][_0x5a80('0x69')](_0x44fc00,{'include':[{'model':db[_0x5a80('0x45')],'as':_0x5a80('0x46')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x5a80('0x22')](function(_0x1747e5){var _0x287265=_0x17fbdc[_0x5a80('0x79')]['get']({'plain':!![]});if(!_0x287265)throw new Error(_0x5a80('0x83'));if(_0x287265[_0x5a80('0x84')]==='user'){var _0x213d72=_0x1747e5[_0x5a80('0x3c')]({'plain':!![]});return db[_0x5a80('0x85')]['find']({'where':{'name':_0x5a80('0x3d'),'userProfileId':_0x287265[_0x5a80('0x86')]},'raw':!![]})[_0x5a80('0x22')](function(_0x225971){if(_0x225971&&_0x225971[_0x5a80('0x87')]===0x0){return db[_0x5a80('0x3e')]['create']({'name':_0x213d72[_0x5a80('0x40')],'resourceId':_0x213d72['id'],'type':_0x225971[_0x5a80('0x40')],'sectionId':_0x225971['id']},{})[_0x5a80('0x22')](function(){return _0x1747e5;});}else{return _0x1747e5;}})[_0x5a80('0x2d')](function(_0x458dc0){logger['error'](_0x5a80('0x88'),_0x458dc0);throw _0x458dc0;});}return _0x1747e5;})['then'](respondWithResult(_0x2a8782,0xc9))[_0x5a80('0x2d')](handleError(_0x2a8782,null));};exports['getImap']=function(_0x5d6137,_0x20c1b8,_0x4c8018){return db[_0x5a80('0x5d')][_0x5a80('0x6b')]({'where':{'id':_0x5d6137['params']['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x20c1b8,null))['then'](function(_0x44f064){if(_0x44f064){return _0x44f064['getImap']();}return null;})[_0x5a80('0x22')](respondWithResult(_0x20c1b8,null))[_0x5a80('0x2d')](handleError(_0x20c1b8,null));};exports['addImap']=function(_0x4a8ca0,_0x1512cd,_0x194a87){if(_0x4a8ca0['body']['id']){delete _0x4a8ca0[_0x5a80('0x64')]['id'];}return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x4a8ca0[_0x5a80('0x66')]['id']}})['then'](handleEntityNotFound(_0x1512cd,null))[_0x5a80('0x22')](function(_0x304ba4){if(_0x304ba4){_0x4a8ca0['body']['MailAccountId']=_0x304ba4['id'];return db[_0x5a80('0x43')][_0x5a80('0x69')](_0x4a8ca0[_0x5a80('0x64')]);}})[_0x5a80('0x22')](respondWithResult(_0x1512cd,null))[_0x5a80('0x2d')](handleError(_0x1512cd,null));};exports['removeImap']=function(_0x2d43c4,_0x511f8d,_0x53e4fb){return db[_0x5a80('0x5d')]['findOne']({'where':{'id':_0x2d43c4[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x511f8d,null))[_0x5a80('0x22')](function(_0x64b78c){if(_0x64b78c){return _0x64b78c[_0x5a80('0x89')](null);}return null;})[_0x5a80('0x22')](respondWithStatusCode(_0x511f8d,null))[_0x5a80('0x2d')](handleError(_0x511f8d,null));};exports['getSmtp']=function(_0xe3203d,_0x4867c6,_0x47e57b){return db['MailAccount'][_0x5a80('0x6b')]({'where':{'id':_0xe3203d[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x4867c6,null))[_0x5a80('0x22')](function(_0x5e5c44){if(_0x5e5c44){return _0x5e5c44['getSmtp']();}return null;})[_0x5a80('0x22')](respondWithResult(_0x4867c6,null))['catch'](handleError(_0x4867c6,null));};exports[_0x5a80('0x8a')]=function(_0x1258df,_0x33dfce,_0x144058){if(_0x1258df[_0x5a80('0x64')]['id']){delete _0x1258df['body']['id'];}return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x1258df[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x33dfce,null))['then'](function(_0x1fb5c5){if(_0x1fb5c5){_0x1258df[_0x5a80('0x64')][_0x5a80('0x68')]=_0x1fb5c5['id'];return db[_0x5a80('0x45')][_0x5a80('0x69')](_0x1258df[_0x5a80('0x64')]);}})['then'](respondWithResult(_0x33dfce,null))[_0x5a80('0x2d')](handleError(_0x33dfce,null));};exports[_0x5a80('0x8b')]=function(_0x276137,_0x57b842,_0x5bf10a){return db[_0x5a80('0x5d')]['findOne']({'where':{'id':_0x276137[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x57b842,null))[_0x5a80('0x22')](function(_0x434075){if(_0x434075){return _0x434075[_0x5a80('0x8c')](null);}return null;})[_0x5a80('0x22')](respondWithStatusCode(_0x57b842,null))[_0x5a80('0x2d')](handleError(_0x57b842,null));};exports['addInteraction']=function(_0x3275ba,_0x4dccc6,_0x1667b4){return db[_0x5a80('0x8d')][_0x5a80('0x65')]({'where':{'id':_0x3275ba['params']['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x4dccc6,null))[_0x5a80('0x22')](function(_0x2348d3){if(_0x2348d3){return _0x2348d3[_0x5a80('0x8e')](_0x3275ba[_0x5a80('0x64')]['ids'],_[_0x5a80('0x8f')](_0x3275ba['body'],[_0x5a80('0x6f'),'id'])||{});}})[_0x5a80('0x22')](respondWithResult(_0x4dccc6,null))[_0x5a80('0x2d')](handleError(_0x4dccc6,null));};exports[_0x5a80('0x90')]=function(_0x14adea,_0x3cbc85,_0x188d9b){var _0x3314df={'raw':![],'where':{}};var _0x77780={};var _0x1d4ed1={'count':0x0,'rows':[]};return db[_0x5a80('0x5d')][_0x5a80('0x6b')]({'where':{'id':_0x14adea[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x3cbc85,null))[_0x5a80('0x22')](function(_0x4dcc66){if(_0x4dcc66){_0x77780[_0x5a80('0x50')]=_[_0x5a80('0x4d')](db['MailInteraction'][_0x5a80('0x73')]);_0x77780[_0x5a80('0x4c')]=_[_0x5a80('0x4d')](_0x14adea[_0x5a80('0x4c')]);_0x77780[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0x77780[_0x5a80('0x50')],_0x77780[_0x5a80('0x4c')]);_0x3314df['attributes']=_[_0x5a80('0x4f')](_0x77780[_0x5a80('0x50')],qs['fields'](_0x14adea[_0x5a80('0x4c')][_0x5a80('0x52')]));_0x3314df[_0x5a80('0x51')]=_0x3314df['attributes'][_0x5a80('0x53')]?_0x3314df[_0x5a80('0x51')]:_0x77780[_0x5a80('0x50')];if(!_0x14adea[_0x5a80('0x4c')][_0x5a80('0x54')](_0x5a80('0x6d'))){_0x3314df[_0x5a80('0x34')]=qs[_0x5a80('0x34')](_0x14adea[_0x5a80('0x4c')][_0x5a80('0x34')]);_0x3314df['offset']=qs['offset'](_0x14adea[_0x5a80('0x4c')][_0x5a80('0x32')]);}_0x3314df[_0x5a80('0x55')]=qs[_0x5a80('0x56')](_0x14adea[_0x5a80('0x4c')][_0x5a80('0x56')]);_0x3314df[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_[_0x5a80('0x58')](_0x14adea['query'],_0x77780['filters']));_0x3314df[_0x5a80('0x57')][_0x5a80('0x68')]=_0x4dcc66['id'];if(_0x14adea['query'][_0x5a80('0x5b')]){_0x3314df[_0x5a80('0x57')]=_[_0x5a80('0x59')](_0x3314df[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x3314df[_0x5a80('0x51')],function(_0x34c6d9){var _0x204d32={};_0x204d32[_0x34c6d9]={'$like':'%'+_0x14adea['query']['filter']+'%'};return _0x204d32;})});}_0x3314df=_[_0x5a80('0x59')]({},_0x3314df,_0x14adea[_0x5a80('0x5c')]);return db[_0x5a80('0x8d')][_0x5a80('0x35')]({'where':_0x3314df[_0x5a80('0x57')]})[_0x5a80('0x22')](function(_0x4d861f){_0x1d4ed1['count']=_0x4d861f;if(_0x14adea[_0x5a80('0x4c')][_0x5a80('0x5e')]){_0x3314df[_0x5a80('0x5f')]=[{'model':db[_0x5a80('0x91')],'as':_0x5a80('0x92'),'required':![]},{'model':db[_0x5a80('0x93')],'as':_0x5a80('0x94'),'attributes':[_0x5a80('0x40'),_0x5a80('0x95'),_0x5a80('0x96')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x5a80('0x97')],'where':_0x14adea[_0x5a80('0x4c')]['tag']?{'id':_0x14adea['query']['tag']}:undefined,'required':_0x14adea['query'][_0x5a80('0x98')]?!![]:![]}];}return db[_0x5a80('0x8d')][_0x5a80('0x60')](_0x3314df);})[_0x5a80('0x22')](function(_0x4980f6){_0x1d4ed1['rows']=_0x4980f6;return _0x1d4ed1;});}})[_0x5a80('0x22')](respondWithFilteredResult(_0x3cbc85,_0x3314df))[_0x5a80('0x2d')](handleError(_0x3cbc85,null));};exports[_0x5a80('0x99')]=function(_0x507011,_0x58c4b9,_0x598e59){return db[_0x5a80('0x5d')][_0x5a80('0x6b')]({'where':{'id':_0x507011[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x58c4b9,null))['then'](function(_0x53a57c){if(_0x53a57c){return db[_0x5a80('0x9a')][_0x5a80('0x9b')](function(_0x4bb99b){return db[_0x5a80('0x9c')]['destroy']({'where':{'MailAccountId':_0x507011[_0x5a80('0x66')]['id']},'transaction':_0x4bb99b})[_0x5a80('0x22')](function(_0x39312b){var _0x4454fb=_['map'](_0x507011[_0x5a80('0x64')],function(_0x38352a){_0x38352a['MailAccountId']=_0x507011[_0x5a80('0x66')]['id'];return _0x38352a;});return db[_0x5a80('0x9c')][_0x5a80('0x9d')](_0x4454fb,{'transaction':_0x4bb99b});});})['then'](function(){return db['MailApplication'][_0x5a80('0x9e')]({'where':{'MailAccountId':_0x507011[_0x5a80('0x66')]['id']},'order':_0x5a80('0x9f')});});}})['then'](respondWithResult(_0x58c4b9,null))[_0x5a80('0x2d')](handleError(_0x58c4b9,null));};exports[_0x5a80('0xa0')]=function(_0x519070,_0x1ba7db,_0x35e990){var _0x4e16a1={};var _0x2b3c8d={};var _0xbbd7f6;var _0x151cb7;return db['MailAccount'][_0x5a80('0x6b')]({'where':{'id':_0x519070[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x1ba7db,null))[_0x5a80('0x22')](function(_0x3b9888){if(_0x3b9888){_0xbbd7f6=_0x3b9888;_0x2b3c8d[_0x5a80('0x50')]=_[_0x5a80('0x4d')](db[_0x5a80('0x9c')][_0x5a80('0x73')]);_0x2b3c8d['query']=_['keys'](_0x519070[_0x5a80('0x4c')]);_0x2b3c8d['filters']=_[_0x5a80('0x4f')](_0x2b3c8d[_0x5a80('0x50')],_0x2b3c8d[_0x5a80('0x4c')]);_0x4e16a1['attributes']=_[_0x5a80('0x4f')](_0x2b3c8d[_0x5a80('0x50')],qs[_0x5a80('0x52')](_0x519070[_0x5a80('0x4c')]['fields']));_0x4e16a1[_0x5a80('0x51')]=_0x4e16a1[_0x5a80('0x51')]['length']?_0x4e16a1[_0x5a80('0x51')]:_0x2b3c8d[_0x5a80('0x50')];_0x4e16a1[_0x5a80('0x55')]=qs['sort'](_0x519070[_0x5a80('0x4c')][_0x5a80('0x56')]);_0x4e16a1[_0x5a80('0x57')]=qs['filters'](_['pick'](_0x519070[_0x5a80('0x4c')],_0x2b3c8d[_0x5a80('0x4e')]));if(_0x519070['query'][_0x5a80('0x5b')]){_0x4e16a1[_0x5a80('0x57')]=_['merge'](_0x4e16a1[_0x5a80('0x57')],{'$or':_['map'](_0x4e16a1[_0x5a80('0x51')],function(_0x2a959b){var _0x3875b1={};_0x3875b1[_0x2a959b]={'$like':'%'+_0x519070[_0x5a80('0x4c')][_0x5a80('0x5b')]+'%'};return _0x3875b1;})});}_0x4e16a1=_[_0x5a80('0x59')]({},_0x4e16a1,_0x519070['options']);return _0xbbd7f6[_0x5a80('0xa0')](_0x4e16a1);}})['then'](function(_0x4c8694){if(_0x4c8694){_0x151cb7=_0x4c8694['length'];if(!_0x519070['query'][_0x5a80('0x54')](_0x5a80('0x6d'))){_0x4e16a1[_0x5a80('0x34')]=qs[_0x5a80('0x34')](_0x519070[_0x5a80('0x4c')][_0x5a80('0x34')]);_0x4e16a1[_0x5a80('0x32')]=qs[_0x5a80('0x32')](_0x519070[_0x5a80('0x4c')][_0x5a80('0x32')]);}return _0xbbd7f6[_0x5a80('0xa0')](_0x4e16a1);}})[_0x5a80('0x22')](function(_0x4b7e94){if(_0x4b7e94){return _0x4b7e94?{'count':_0x151cb7,'rows':_0x4b7e94}:null;}})[_0x5a80('0x22')](respondWithResult(_0x1ba7db,null))[_0x5a80('0x2d')](handleError(_0x1ba7db,null));};exports['getMessages']=function(_0x31d607,_0x55e122,_0x576803){var _0x4de1bf={'raw':!![],'where':{}};var _0x2931d9={};var _0x219379={'count':0x0,'rows':[]};return db[_0x5a80('0x5d')]['findOne']({'where':{'id':_0x31d607[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0x55e122,null))[_0x5a80('0x22')](function(_0x9b9703){if(_0x9b9703){_0x2931d9[_0x5a80('0x50')]=_[_0x5a80('0x4d')](db[_0x5a80('0xa1')]['rawAttributes']);_0x2931d9[_0x5a80('0x4c')]=_[_0x5a80('0x4d')](_0x31d607[_0x5a80('0x4c')]);_0x2931d9['filters']=_[_0x5a80('0x4f')](_0x2931d9['model'],_0x2931d9[_0x5a80('0x4c')]);_0x4de1bf[_0x5a80('0x51')]=_[_0x5a80('0x4f')](_0x2931d9['model'],qs[_0x5a80('0x52')](_0x31d607[_0x5a80('0x4c')][_0x5a80('0x52')]));_0x4de1bf[_0x5a80('0x51')]=_0x4de1bf[_0x5a80('0x51')][_0x5a80('0x53')]?_0x4de1bf[_0x5a80('0x51')]:_0x2931d9[_0x5a80('0x50')];if(!_0x31d607[_0x5a80('0x4c')][_0x5a80('0x54')](_0x5a80('0x6d'))){_0x4de1bf['limit']=qs[_0x5a80('0x34')](_0x31d607[_0x5a80('0x4c')][_0x5a80('0x34')]);_0x4de1bf[_0x5a80('0x32')]=qs[_0x5a80('0x32')](_0x31d607['query'][_0x5a80('0x32')]);}_0x4de1bf[_0x5a80('0x55')]=qs[_0x5a80('0x56')](_0x31d607['query'][_0x5a80('0x56')]);_0x4de1bf['where']=qs['filters'](_[_0x5a80('0x58')](_0x31d607[_0x5a80('0x4c')],_0x2931d9[_0x5a80('0x4e')]));_0x4de1bf[_0x5a80('0x57')][_0x5a80('0x68')]=_0x9b9703['id'];if(_0x31d607[_0x5a80('0x4c')]['filter']){_0x4de1bf[_0x5a80('0x57')]=_[_0x5a80('0x59')](_0x4de1bf[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x4de1bf['attributes'],function(_0x3ff2d0){var _0x5daabf={};_0x5daabf[_0x3ff2d0]={'$like':'%'+_0x31d607[_0x5a80('0x4c')][_0x5a80('0x5b')]+'%'};return _0x5daabf;})});}if(_0x31d607[_0x5a80('0x4c')][_0x5a80('0xa2')]){var _0x4aa040=_0x31d607[_0x5a80('0x4c')]['$gte'][_0x5a80('0xa3')](',');var _0x13d2ee={};_0x13d2ee[_0x4aa040[0x0]]={'$gte':moment(_0x4aa040[0x1])[_0x5a80('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4de1bf[_0x5a80('0x57')]=_[_0x5a80('0x59')](_0x4de1bf[_0x5a80('0x57')],_0x13d2ee);}_0x4de1bf=_[_0x5a80('0x59')]({},_0x4de1bf,_0x31d607[_0x5a80('0x5c')]);return db[_0x5a80('0xa1')][_0x5a80('0x35')]({'where':_0x4de1bf[_0x5a80('0x57')]})[_0x5a80('0x22')](function(_0x42b963){_0x219379['count']=_0x42b963;if(_0x31d607['query'][_0x5a80('0x5e')]){_0x4de1bf[_0x5a80('0x5f')]=[{'all':!![]}];}return db['MailMessage'][_0x5a80('0x60')](_0x4de1bf);})[_0x5a80('0x22')](function(_0x447b52){if(_0x31d607[_0x5a80('0x4c')][_0x5a80('0xa5')]===_0x5a80('0xa6')){for(var _0xd17011=0x0;_0xd17011<_0x447b52[_0x5a80('0x53')];_0xd17011++){_0x447b52[_0xd17011][_0x5a80('0x64')]=juice(_0x447b52[_0xd17011][_0x5a80('0x64')]);}}_0x219379[_0x5a80('0x61')]=_0x447b52;return _0x219379;});}})[_0x5a80('0x22')](respondWithFilteredResult(_0x55e122,_0x4de1bf))['catch'](handleError(_0x55e122,null));};exports[_0x5a80('0x41')]=function(_0x3a0acf,_0x1763c3,_0x149303){var _0x510e36,_0x52f7f0={},_0x3d7fc6;if(_0x3a0acf['body']['to']){_0x3d7fc6=_0x3a0acf[_0x5a80('0x64')]['to']['split'](',')[0x0];}return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x3a0acf[_0x5a80('0x66')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x5a80('0x91')],'as':_0x5a80('0xa7'),'where':{'email':_0x3d7fc6},'limit':0x1,'order':[['updatedAt',_0x5a80('0xa8')]]}]},{'model':db[_0x5a80('0x45')],'as':_0x5a80('0x46'),'raw':!![]}]})[_0x5a80('0x22')](handleEntityNotFound(_0x1763c3,null))['then'](function(_0x3a8e2a){if(_0x3a8e2a){_0x510e36=_0x3a8e2a;if(_0x3a8e2a['Smtp']){if(_['isNil'](_0x3a0acf[_0x5a80('0x64')][_0x5a80('0xa9')])){_0x3a0acf[_0x5a80('0x64')][_0x5a80('0xa9')]=util[_0x5a80('0xa4')]('%s\x20<%s>',_0x3a8e2a['name'],_0x3a8e2a['email']||_0x3a8e2a[_0x5a80('0x46')][_0x5a80('0x79')]);}if(_0x3a0acf[_0x5a80('0x64')]['attachments']&&_0x3a0acf[_0x5a80('0x64')][_0x5a80('0xaa')][_0x5a80('0x53')]){for(var _0x5d6b99=0x0;_0x5d6b99<_0x3a0acf['body'][_0x5a80('0xaa')][_0x5a80('0x53')];_0x5d6b99+=0x1){_0x3a0acf[_0x5a80('0x64')]['attachments'][_0x5d6b99]={'filename':_0x3a0acf[_0x5a80('0x64')][_0x5a80('0xaa')][_0x5d6b99]['name'],'path':path[_0x5a80('0xab')](config['root'],_0x5a80('0xac'),_0x3a0acf[_0x5a80('0x64')][_0x5a80('0xaa')][_0x5d6b99][_0x5a80('0xad')])};}}var _0x5bb068={'tls':{'rejectUnauthorized':![]}};if(_[_0x5a80('0x75')](_0x3a8e2a[_0x5a80('0x46')][_0x5a80('0x80')])){if(_0x3a8e2a[_0x5a80('0x46')]['authentication']){_0x5bb068[_0x5a80('0xae')]={'user':_0x3a8e2a[_0x5a80('0x46')][_0x5a80('0x79')],'pass':_0x3a8e2a[_0x5a80('0x46')][_0x5a80('0x82')]};}_0x5bb068[_0x5a80('0x7e')]=_0x3a8e2a['Smtp'][_0x5a80('0x7e')];_0x5bb068[_0x5a80('0x7f')]=_0x3a8e2a[_0x5a80('0x46')]['port'];_0x5bb068[_0x5a80('0xaf')]=_0x3a8e2a['Smtp']['secure'];}else{_0x5bb068[_0x5a80('0x80')]=_0x3a8e2a['Smtp'][_0x5a80('0x80')];_0x5bb068[_0x5a80('0xae')]={'user':_0x3a8e2a['Smtp'][_0x5a80('0x79')],'pass':_0x3a8e2a[_0x5a80('0x46')][_0x5a80('0x82')]};}return respondWithRpcPromise(_0x5a80('0xb0'),_0x5a80('0xb1'),{'account':_0x5bb068,'message':_0x3a0acf[_0x5a80('0x64')]});}else{throw new Error(_0x5a80('0xb2'));}}})[_0x5a80('0x22')](function(_0x5c3559){if(_0x5c3559){_0x52f7f0=_0x5c3559;if(_0x510e36['List']){if(_0x510e36['List'][_0x5a80('0xa7')][_0x5a80('0x53')]){return _0x510e36['List']['Contacts'][0x0];}else{return db[_0x5a80('0x91')][_0x5a80('0x69')](_[_0x5a80('0x19')](_0x3a0acf[_0x5a80('0x64')],{'firstName':_0x3a0acf[_0x5a80('0x64')]['to'],'email':_0x3a0acf[_0x5a80('0x64')]['to'],'phone':_0x3a0acf[_0x5a80('0x64')]['to'],'ListId':_0x510e36[_0x5a80('0xb3')]}));}}else{throw new Error(_0x5a80('0xb2'));}}})['then'](function(_0x1c15a6){if(_0x1c15a6){var _0x241731={'UserId':_0x3a0acf[_0x5a80('0x79')]['id'],'ContactId':_0x1c15a6['id'],'MailAccountId':_0x510e36['id'],'inReplyTo':_0x52f7f0[_0x5a80('0xb4')],'to':_0x3a0acf['body'][_0x5a80('0xa9')],'cc':_0x3a0acf['body']['cc'],'subject':_0x3a0acf['body'][_0x5a80('0xb5')],'attach':_0x3a0acf['body']['attach'],'firstMsgDirection':_0x5a80('0xb6'),'lastMsgAt':moment()[_0x5a80('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x5a80('0xb6'),'Messages':[_[_0x5a80('0x59')](_0x3a0acf[_0x5a80('0x64')],{'messageId':_0x52f7f0['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x510e36['id'],'UserId':_0x3a0acf['user']['id'],'ContactId':_0x1c15a6['id']})]};if(_0x3a0acf[_0x5a80('0x64')][_0x5a80('0xb7')]){_0x241731=_['merge'](_0x241731,_0x3a0acf['body'][_0x5a80('0xb7')]);}return db[_0x5a80('0x8d')][_0x5a80('0x69')](_0x241731,{'include':[{'model':db['MailMessage'],'as':_0x5a80('0xb8')}]});}})[_0x5a80('0x22')](respondWithResult(_0x1763c3,null))[_0x5a80('0x2d')](handleError(_0x1763c3,null));};exports[_0x5a80('0xb9')]=function(_0x36f3e4,_0x248235,_0x7467de){return db['MailAccount'][_0x5a80('0x65')]({'where':{'id':_0x36f3e4['params']['id']},'include':[{'model':db[_0x5a80('0x45')],'as':'Smtp','raw':!![]}]})[_0x5a80('0x22')](handleEntityNotFound(_0x248235,null))[_0x5a80('0x22')](function(_0x48b418){if(_0x48b418&&_0x48b418[_0x5a80('0x46')]){var _0x569230={'id':_0x48b418['id'],'tls':{'rejectUnauthorized':![]}};if(_0x48b418['Smtp'][_0x5a80('0x80')]){_0x569230[_0x5a80('0x80')]=_0x48b418['Smtp'][_0x5a80('0x80')];}else{_0x569230[_0x5a80('0x7e')]=_0x48b418[_0x5a80('0x46')][_0x5a80('0x7e')];_0x569230[_0x5a80('0x7f')]=_0x48b418[_0x5a80('0x46')]['port'];_0x569230[_0x5a80('0xaf')]=_0x48b418[_0x5a80('0x46')][_0x5a80('0xaf')];}if(_0x48b418[_0x5a80('0x46')][_0x5a80('0x7d')]){_0x569230[_0x5a80('0xae')]={'user':_0x48b418[_0x5a80('0x46')][_0x5a80('0x79')],'pass':_0x48b418[_0x5a80('0x46')][_0x5a80('0x82')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x569230});}})[_0x5a80('0x22')](respondWithResult(_0x248235,null))['catch'](handleError(_0x248235,null));};exports['destroy']=function(_0x43e675,_0xa0b05a){return db[_0x5a80('0x5d')]['find']({'where':{'id':_0x43e675[_0x5a80('0x66')]['id']}})['then'](handleEntityNotFound(_0xa0b05a,null))[_0x5a80('0x22')](function(_0xf20d2c){if(_0xf20d2c&&_0xf20d2c[_0x5a80('0x80')]){throw new db[(_0x5a80('0xba'))][(_0x5a80('0xbb'))](_0x5a80('0xbc'));}return _0xf20d2c;})[_0x5a80('0x22')](removeEntity(_0xa0b05a,null))[_0x5a80('0x2d')](handleError(_0xa0b05a,null));};exports[_0x5a80('0xbd')]=function(_0x41e827,_0xf2c68f,_0x2c2d39){return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x41e827[_0x5a80('0x66')]['id']}})[_0x5a80('0x22')](handleEntityNotFound(_0xf2c68f,null))['then'](function(_0x23a79b){if(_0x23a79b){return _0x23a79b[_0x5a80('0xbd')](_0x41e827[_0x5a80('0x64')]['ids'],_['omit'](_0x41e827['body'],[_0x5a80('0x6f'),'id'])||{})[_0x5a80('0xbe')](function(_0x410a2a){for(var _0xed0a4e=0x0;_0xed0a4e<_0x41e827[_0x5a80('0x64')][_0x5a80('0x6f')][_0x5a80('0x53')];_0xed0a4e+=0x1){socket[_0x5a80('0xbf')](_0x5a80('0xc0'),{'UserId':Number(_0x41e827['body'][_0x5a80('0x6f')][_0xed0a4e]),'MailAccountId':Number(_0x41e827[_0x5a80('0x66')]['id'])});}return _0x410a2a;});}})['then'](respondWithResult(_0xf2c68f,null))[_0x5a80('0x2d')](handleError(_0xf2c68f,null));};exports[_0x5a80('0xc1')]=function(_0x251724,_0x31fe8a,_0xaa7575){return db[_0x5a80('0x5d')][_0x5a80('0x65')]({'where':{'id':_0x251724['params']['id']}})['then'](handleEntityNotFound(_0x31fe8a,null))['then'](function(_0x22c2ca){if(_0x22c2ca){return _0x22c2ca[_0x5a80('0xc1')](_0x251724[_0x5a80('0x4c')][_0x5a80('0x6f')])[_0x5a80('0x22')](function(){if(_['isArray'](_0x251724[_0x5a80('0x4c')][_0x5a80('0x6f')])){for(var _0x29d7e4=0x0;_0x29d7e4<_0x251724['query'][_0x5a80('0x6f')][_0x5a80('0x53')];_0x29d7e4+=0x1){socket[_0x5a80('0xbf')](_0x5a80('0xc2'),{'UserId':Number(_0x251724[_0x5a80('0x4c')][_0x5a80('0x6f')][_0x29d7e4]),'MailAccountId':Number(_0x251724['params']['id'])});}}else{socket['emit'](_0x5a80('0xc2'),{'UserId':Number(_0x251724[_0x5a80('0x4c')][_0x5a80('0x6f')]),'MailAccountId':Number(_0x251724['params']['id'])});}});}})[_0x5a80('0x22')](respondWithStatusCode(_0x31fe8a,null))[_0x5a80('0x2d')](handleError(_0x31fe8a,null));};exports[_0x5a80('0xc3')]=function(_0x79497f,_0x2f2eec,_0x5bf49a){var _0x2ed07c={};var _0x459c4b={};var _0x136029;var _0x1290b8;return db['MailAccount']['findOne']({'where':{'id':_0x79497f[_0x5a80('0x66')]['id']}})['then'](handleEntityNotFound(_0x2f2eec,null))[_0x5a80('0x22')](function(_0x4122b8){if(_0x4122b8){_0x136029=_0x4122b8;_0x459c4b[_0x5a80('0x50')]=_[_0x5a80('0x4d')](db['User'][_0x5a80('0x73')]);_0x459c4b[_0x5a80('0x4c')]=_[_0x5a80('0x4d')](_0x79497f[_0x5a80('0x4c')]);_0x459c4b[_0x5a80('0x4e')]=_[_0x5a80('0x4f')](_0x459c4b['model'],_0x459c4b[_0x5a80('0x4c')]);_0x2ed07c[_0x5a80('0x51')]=_[_0x5a80('0x4f')](_0x459c4b[_0x5a80('0x50')],qs['fields'](_0x79497f[_0x5a80('0x4c')][_0x5a80('0x52')]));_0x2ed07c[_0x5a80('0x51')]=_0x2ed07c[_0x5a80('0x51')]['length']?_0x2ed07c[_0x5a80('0x51')]:_0x459c4b['model'];_0x2ed07c[_0x5a80('0x55')]=qs[_0x5a80('0x56')](_0x79497f[_0x5a80('0x4c')][_0x5a80('0x56')]);_0x2ed07c[_0x5a80('0x57')]=qs[_0x5a80('0x4e')](_['pick'](_0x79497f[_0x5a80('0x4c')],_0x459c4b[_0x5a80('0x4e')]));if(_0x79497f[_0x5a80('0x4c')][_0x5a80('0x5b')]){_0x2ed07c[_0x5a80('0x57')]=_[_0x5a80('0x59')](_0x2ed07c[_0x5a80('0x57')],{'$or':_[_0x5a80('0x48')](_0x2ed07c[_0x5a80('0x51')],function(_0x2ada20){var _0x12eb97={};_0x12eb97[_0x2ada20]={'$like':'%'+_0x79497f[_0x5a80('0x4c')][_0x5a80('0x5b')]+'%'};return _0x12eb97;})});}_0x2ed07c=_[_0x5a80('0x59')]({},_0x2ed07c,_0x79497f['options']);return _0x136029[_0x5a80('0xc3')](_0x2ed07c);}})[_0x5a80('0x22')](function(_0x51a690){if(_0x51a690){_0x1290b8=_0x51a690['length'];if(!_0x79497f['query'][_0x5a80('0x54')](_0x5a80('0x6d'))){_0x2ed07c[_0x5a80('0x34')]=qs['limit'](_0x79497f[_0x5a80('0x4c')][_0x5a80('0x34')]);_0x2ed07c[_0x5a80('0x32')]=qs[_0x5a80('0x32')](_0x79497f['query'][_0x5a80('0x32')]);}return _0x136029[_0x5a80('0xc3')](_0x2ed07c);}})[_0x5a80('0x22')](function(_0x231323){if(_0x231323){return _0x231323?{'count':_0x1290b8,'rows':_0x231323}:null;}})['then'](respondWithResult(_0x2f2eec,null))[_0x5a80('0x2d')](handleError(_0x2f2eec,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 987a2ab..1e596b4 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 _0xc4aa=['../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var MailAccount=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xac4a('0x3')](0x0);var events={'afterCreate':_0xac4a('0x4'),'afterUpdate':_0xac4a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5cda73){return function(_0x47d4f6,_0x2f48ed,_0x15b967){MailAccountEvents[_0xac4a('0x6')](_0x5cda73+':'+_0x47d4f6['id'],_0x47d4f6);MailAccountEvents[_0xac4a('0x6')](_0x5cda73,_0x47d4f6);_0x15b967(null);};}for(var e in events){if(events[_0xac4a('0x7')](e)){var event=events[e];MailAccount[_0xac4a('0x8')](e,emitEvent(event));}}module[_0xac4a('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xc971=['remove','emit','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xc971,0x17b));var _0x1c97=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xc971[_0x1f9f37];return _0x21c080;};'use strict';var EventEmitter=require(_0x1c97('0x0'));var MailAccount=require(_0x1c97('0x1'))['db'][_0x1c97('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1c97('0x3')](0x0);var events={'afterCreate':_0x1c97('0x4'),'afterUpdate':'update','afterDestroy':_0x1c97('0x5')};function emitEvent(_0x3de361){return function(_0x215896,_0x58bc7d,_0x47b9cb){MailAccountEvents[_0x1c97('0x6')](_0x3de361+':'+_0x215896['id'],_0x215896);MailAccountEvents[_0x1c97('0x6')](_0x3de361,_0x215896);_0x47b9cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x1c97('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 a734022..0d42b96 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 _0x13a6=['moment','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','../../config/logger','api'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x13a6,0xa4));var _0x613a=function(_0x2b0ee6,_0x528f7d){_0x2b0ee6=_0x2b0ee6-0x0;var _0x411283=_0x13a6[_0x2b0ee6];return _0x411283;};'use strict';var _=require(_0x613a('0x0'));var util=require(_0x613a('0x1'));var logger=require(_0x613a('0x2'))(_0x613a('0x3'));var moment=require(_0x613a('0x4'));var BPromise=require(_0x613a('0x5'));var rp=require(_0x613a('0x6'));var fs=require('fs');var path=require(_0x613a('0x7'));var rimraf=require('rimraf');var config=require(_0x613a('0x8'));var attributes=require(_0x613a('0x9'));module[_0x613a('0xa')]=function(_0x5a1d66,_0x192c2e){return _0x5a1d66[_0x613a('0xb')](_0x613a('0xc'),attributes,{'tableName':_0x613a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x067d=['bluebird','path','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts','lodash','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x067d,0x17e));var _0xd067=function(_0x2624f7,_0x4175b9){_0x2624f7=_0x2624f7-0x0;var _0x3ea815=_0x067d[_0x2624f7];return _0x3ea815;};'use strict';var _=require(_0xd067('0x0'));var util=require('util');var logger=require(_0xd067('0x1'))(_0xd067('0x2'));var moment=require('moment');var BPromise=require(_0xd067('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd067('0x4'));var rimraf=require(_0xd067('0x5'));var config=require(_0xd067('0x6'));var attributes=require(_0xd067('0x7'));module['exports']=function(_0x4c3233,_0x1af8d1){return _0x4c3233[_0xd067('0x8')](_0xd067('0x9'),attributes,{'tableName':_0xd067('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 1f04fc6..b8cbd85 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 _0x0079=['info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','Contacts','updatedAt','MailApplication','Applications','Smtp','get','List','applications','priority','asc','autoclose','push','length','close','CmContact','List\x20not\x20found','contact','messageId','format','MailMessage','Messages','inReplyTo','create','spread','update','subject','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','then'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x0079,0x1f2));var _0x9007=function(_0x321b01,_0x46c235){_0x321b01=_0x321b01-0x0;var _0x499084=_0x0079[_0x321b01];return _0x499084;};'use strict';var _=require('lodash');var util=require(_0x9007('0x0'));var moment=require(_0x9007('0x1'));var BPromise=require(_0x9007('0x2'));var rs=require(_0x9007('0x3'));var fs=require('fs');var Redis=require(_0x9007('0x4'));var db=require(_0x9007('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9007('0x6'));var config=require(_0x9007('0x7'));var jayson=require(_0x9007('0x8'));var client=jayson[_0x9007('0x9')][_0x9007('0xa')]({'port':0x232c});config[_0x9007('0xb')]=_[_0x9007('0xc')](config[_0x9007('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9007('0xd'))(new Redis(config[_0x9007('0xb')]));require(_0x9007('0xe'))[_0x9007('0xf')](socket);function respondWithRpcPromise(_0x59e030,_0x14b1dd,_0x2822df){return new BPromise(function(_0x742c73,_0x5c0a8d){return client['request'](_0x59e030,_0x2822df)[_0x9007('0x10')](function(_0x5a9e92){logger[_0x9007('0x11')](_0x9007('0x12'),_0x14b1dd,_0x9007('0x13'));logger[_0x9007('0x14')](_0x9007('0x15'),_0x14b1dd,_0x9007('0x13'),JSON[_0x9007('0x16')](_0x5a9e92));if(_0x5a9e92[_0x9007('0x17')]){if(_0x5a9e92[_0x9007('0x17')][_0x9007('0x18')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x14b1dd,_0x5a9e92['error'][_0x9007('0x19')]);return _0x5c0a8d(_0x5a9e92[_0x9007('0x17')][_0x9007('0x19')]);}logger[_0x9007('0x17')](_0x9007('0x12'),_0x14b1dd,_0x5a9e92['error']['message']);return _0x742c73(_0x5a9e92['error'][_0x9007('0x19')]);}else{logger[_0x9007('0x11')]('MailAccount,\x20%s,\x20%s',_0x14b1dd,_0x9007('0x13'));_0x742c73(_0x5a9e92[_0x9007('0x1a')][_0x9007('0x19')]);}})['catch'](function(_0x29f32b){logger['error'](_0x9007('0x12'),_0x14b1dd,_0x29f32b);_0x5c0a8d(_0x29f32b);});});}exports[_0x9007('0x1b')]=function(_0x2177bb){var _0x362264=this;return new Promise(function(_0x1374e0,_0x388c3c){return db[_0x9007('0x1c')][_0x9007('0x1d')]({'raw':_0x2177bb[_0x9007('0x1e')]?_0x2177bb[_0x9007('0x1e')][_0x9007('0x1f')]===undefined?!![]:![]:!![],'where':_0x2177bb[_0x9007('0x1e')]?_0x2177bb[_0x9007('0x1e')][_0x9007('0x20')]||null:null,'attributes':_0x2177bb[_0x9007('0x1e')]?_0x2177bb[_0x9007('0x1e')][_0x9007('0x21')]||null:null,'limit':_0x2177bb[_0x9007('0x1e')]?_0x2177bb[_0x9007('0x1e')][_0x9007('0x22')]||null:null,'include':_0x2177bb[_0x9007('0x1e')]?_0x2177bb['options'][_0x9007('0x23')]?_[_0x9007('0x24')](_0x2177bb[_0x9007('0x1e')][_0x9007('0x23')],function(_0x21e643){return{'model':db[_0x21e643[_0x9007('0x25')]],'as':_0x21e643['as'],'attributes':_0x21e643['attributes'],'include':_0x21e643[_0x9007('0x23')]?_[_0x9007('0x24')](_0x21e643[_0x9007('0x23')],function(_0x250bc1){return{'model':db[_0x250bc1[_0x9007('0x25')]],'as':_0x250bc1['as'],'attributes':_0x250bc1['attributes'],'include':_0x250bc1[_0x9007('0x23')]?_[_0x9007('0x24')](_0x250bc1[_0x9007('0x23')],function(_0x3449ed){return{'model':db[_0x3449ed[_0x9007('0x25')]],'as':_0x3449ed['as'],'attributes':_0x3449ed[_0x9007('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9007('0x10')](function(_0x1b0ef9){logger['info']('GetMailAccount',_0x2177bb);logger['debug'](_0x9007('0x1b'),_0x2177bb,JSON[_0x9007('0x16')](_0x1b0ef9));_0x1374e0(_0x1b0ef9);})[_0x9007('0x26')](function(_0x42287a){logger[_0x9007('0x17')]('GetMailAccount',_0x42287a[_0x9007('0x19')],_0x2177bb);_0x388c3c(_0x362264[_0x9007('0x17')](0x1f4,_0x42287a[_0x9007('0x19')]));});});};exports['ShowMailAccount']=function(_0x1a5f42){var _0x15fdda=this;return new Promise(function(_0x5e368c,_0x1bfa7f){return db[_0x9007('0x1c')][_0x9007('0x27')]({'raw':_0x1a5f42[_0x9007('0x1e')]?_0x1a5f42['options'][_0x9007('0x1f')]===undefined?!![]:![]:!![],'where':_0x1a5f42[_0x9007('0x1e')]?_0x1a5f42['options'][_0x9007('0x20')]||null:null,'attributes':_0x1a5f42[_0x9007('0x1e')]?_0x1a5f42[_0x9007('0x1e')][_0x9007('0x21')]||null:null,'include':_0x1a5f42[_0x9007('0x1e')]?_0x1a5f42[_0x9007('0x1e')][_0x9007('0x23')]?_[_0x9007('0x24')](_0x1a5f42[_0x9007('0x1e')][_0x9007('0x23')],function(_0x3c24ff){return{'model':db[_0x3c24ff[_0x9007('0x25')]],'as':_0x3c24ff['as'],'attributes':_0x3c24ff[_0x9007('0x21')],'include':_0x3c24ff[_0x9007('0x23')]?_[_0x9007('0x24')](_0x3c24ff[_0x9007('0x23')],function(_0xf83ef8){return{'model':db[_0xf83ef8[_0x9007('0x25')]],'as':_0xf83ef8['as'],'attributes':_0xf83ef8['attributes'],'include':_0xf83ef8[_0x9007('0x23')]?_['map'](_0xf83ef8[_0x9007('0x23')],function(_0x2cd34b){return{'model':db[_0x2cd34b[_0x9007('0x25')]],'as':_0x2cd34b['as'],'attributes':_0x2cd34b['attributes']};}):[]};}):[]};}):[]:[]})[_0x9007('0x10')](function(_0x3d4c3c){logger['info']('ShowMailAccount',_0x1a5f42);logger[_0x9007('0x14')]('ShowMailAccount',_0x1a5f42,JSON[_0x9007('0x16')](_0x3d4c3c));_0x5e368c(_0x3d4c3c);})[_0x9007('0x26')](function(_0x4e45e9){logger[_0x9007('0x17')](_0x9007('0x28'),_0x4e45e9[_0x9007('0x19')],_0x1a5f42);_0x1bfa7f(_0x15fdda[_0x9007('0x17')](0x1f4,_0x4e45e9['message']));});});};exports[_0x9007('0x29')]=function(_0x15549a){var _0x3d263b=this;return new Promise(function(_0x3a358a,_0x59aedc){var _0x34c8ce={'body':_0x15549a[_0x9007('0x2a')],'channel':_0x9007('0x2b')};var _0x29bcae=_[_0x9007('0x2c')](_[_0x9007('0x2d')](db['CmContact'][_0x9007('0x2e')]),[_0x9007('0x2f'),'updatedAt',_0x9007('0x30'),_0x9007('0x31')]);var _0x523e6e=![];if(_0x15549a[_0x9007('0x2a')]['id']){delete _0x15549a[_0x9007('0x2a')]['id'];}if(_[_0x9007('0x32')](_0x15549a[_0x9007('0x2a')][_0x9007('0x33')])){return _0x59aedc(_0x3d263b['error'](0x1f4,_0x9007('0x34')));}if(_[_0x9007('0x32')](_0x15549a[_0x9007('0x2a')][_0x9007('0x2a')])||_0x15549a[_0x9007('0x2a')]['body']===''){return _0x59aedc(_0x3d263b[_0x9007('0x17')](0x1f4,_0x9007('0x35')));}if(_[_0x9007('0x32')](_0x15549a['body']['mapKey'])){return _0x59aedc(_0x3d263b[_0x9007('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x29bcae));}if(!_[_0x9007('0x36')](_0x29bcae,_0x15549a['body'][_0x9007('0x37')])){return _0x59aedc(_0x3d263b[_0x9007('0x17')](0x1f4,_0x9007('0x38')+_0x29bcae));}var _0x4a7bf5={};_0x4a7bf5[_0x15549a[_0x9007('0x2a')]['mapKey']]=_0x15549a[_0x9007('0x2a')][_0x9007('0x33')];return db[_0x9007('0x1c')]['find']({'where':{'id':_0x15549a[_0x9007('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x9007('0x3a'),'where':_0x4a7bf5,'limit':0x1,'order':[[_0x9007('0x3b'),'DESC']]}]},{'model':db[_0x9007('0x3c')],'as':_0x9007('0x3d')},{'model':db['MailServerOut'],'as':_0x9007('0x3e')}]})[_0x9007('0x10')](function(_0x16c936){if(_0x16c936&&_0x16c936['List']){var _0x3fd8ba=_0x16c936[_0x9007('0x3f')]({'plain':!![]});_0x34c8ce[_0x9007('0x39')]=_['omit'](_0x3fd8ba,['Applications',_0x9007('0x40')]);_0x34c8ce[_0x9007('0x41')]=_0x3fd8ba['Applications'];_0x34c8ce['list']=_0x3fd8ba[_0x9007('0x40')];_0x34c8ce[_0x9007('0x41')]=_['orderBy'](_0x34c8ce[_0x9007('0x41')],[_0x9007('0x42')],[_0x9007('0x43')]);if(_0x34c8ce[_0x9007('0x39')]&&_0x34c8ce[_0x9007('0x39')][_0x9007('0x44')]){_0x34c8ce[_0x9007('0x41')][_0x9007('0x45')]({'id':0x0,'priority':_0x34c8ce['applications'][_0x9007('0x46')]+0x1,'app':_0x9007('0x47'),'appdata':_0x9007('0x44'),'interval':'*,*,*,*'});}if(_0x34c8ce[_0x9007('0x39')][_0x9007('0x3d')]){delete _0x34c8ce[_0x9007('0x39')][_0x9007('0x3d')];}if(_0x34c8ce['account'][_0x9007('0x40')]){delete _0x34c8ce['account']['List'];}if(_0x3fd8ba[_0x9007('0x40')][_0x9007('0x3a')][_0x9007('0x46')]){return _0x3fd8ba['List'][_0x9007('0x3a')][0x0];}var _0xc3d34=_['defaults'](_0x15549a[_0x9007('0x2a')],{'firstName':_0x15549a['body']['from'],'ListId':_0x3fd8ba['ListId']});_0xc3d34[_0x15549a[_0x9007('0x2a')][_0x9007('0x37')]]=_0x15549a[_0x9007('0x2a')][_0x9007('0x33')];return db[_0x9007('0x48')]['create'](_0xc3d34);}else{throw new Error(_0x9007('0x49'));}})[_0x9007('0x10')](function(_0x12f96f){_0x34c8ce[_0x9007('0x4a')]=_0x12f96f;if(_0x12f96f){if(!_0x15549a[_0x9007('0x2a')]['message'][_0x9007('0x4b')]){_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x4b')]=rs['generate']()+'\x20'+_0x15549a['body'][_0x9007('0x19')][_0x9007('0x33')];}var _0x145650={'ContactId':_0x12f96f['id'],'MailAccountId':_0x15549a[_0x9007('0x39')]['id'],'inReplyTo':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x4b')],'to':_0x15549a[_0x9007('0x2a')]['message'][_0x9007('0x33')],'cc':_0x15549a[_0x9007('0x2a')]['message']['cc'],'subject':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['subject'],'attach':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['attach'],'lastMsgAt':moment()[_0x9007('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x15549a[_0x9007('0x39')]['id']},'include':[{'model':db[_0x9007('0x4d')],'as':_0x9007('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x4f')]}}]})[_0x9007('0x10')](function(_0x31cdfe){if(_0x31cdfe){return[_0x31cdfe,![]];}return db['MailInteraction'][_0x9007('0x50')](_0x145650)[_0x9007('0x10')](function(_0xe0683a){return[_0xe0683a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9007('0x51')](function(_0x1c8ab5,_0x10331c){if(_0x1c8ab5){_0x523e6e=_0x10331c;if(!_0x10331c){return _0x1c8ab5[_0x9007('0x52')]({'inReplyTo':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['messageId'],'to':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x33')],'cc':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['cc'],'subject':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x53')],'attach':_0x1c8ab5[_0x9007('0x54')]?_0x1c8ab5[_0x9007('0x54')]:_0x15549a[_0x9007('0x2a')]['message'][_0x9007('0x54')],'substatus':null,'substatusAt':moment()[_0x9007('0x4c')](_0x9007('0x55')),'lastMsgAt':moment()[_0x9007('0x4c')](_0x9007('0x55')),'lastMsgDirection':'in'});}else{return _0x1c8ab5;}}})[_0x9007('0x10')](function(_0x215a86){_0x34c8ce[_0x9007('0x56')]=_0x215a86['get']({'plain':!![]});_0x34c8ce[_0x9007('0x56')][_0x9007('0x57')]=_0x523e6e;return db[_0x9007('0x4d')][_0x9007('0x50')]({'body':_0x15549a['body'][_0x9007('0x2a')],'MailAccountId':_0x15549a[_0x9007('0x39')]['id'],'MailInteractionId':_0x215a86['id'],'direction':'in','ContactId':_0x34c8ce[_0x9007('0x4a')]['id'],'messageId':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['messageId'],'from':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x33')],'to':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['to'],'cc':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['cc'],'subject':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x53')],'attach':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['attach'],'Attachments':_0x15549a['body']['message'][_0x9007('0x58')],'originTo':_0x15549a[_0x9007('0x2a')]['message'][_0x9007('0x59')],'originCc':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['originCc'],'bcc':_0x15549a['body'][_0x9007('0x19')][_0x9007('0x5a')],'ChatWebsiteId':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x5b')]||null,'originChannel':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')]['originChannel']||'Email','ChatOfflineMessageId':_0x15549a[_0x9007('0x2a')][_0x9007('0x19')][_0x9007('0x5c')]||null},{'include':[{'model':db[_0x9007('0x5d')],'as':_0x9007('0x5e')}]});})[_0x9007('0x10')](function(_0x28b3c7){_0x34c8ce[_0x9007('0x19')]=_0x28b3c7;if(_0x34c8ce[_0x9007('0x56')][_0x9007('0x5f')]){return db[_0x9007('0x60')]['find']({'attributes':['id',_0x9007('0x61')],'where':{'id':_0x34c8ce[_0x9007('0x56')][_0x9007('0x5f')]}})[_0x9007('0x10')](function(_0x1615ca){if(_0x1615ca){_0x34c8ce['applications'][_0x9007('0x62')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1615ca['name']+','+(_0x34c8ce[_0x9007('0x39')][_0x9007('0x63')]||0xa),'interval':_0x9007('0x64')});}return respondWithRpcPromise(_0x9007('0x65'),'startRouting',_0x34c8ce);});}return respondWithRpcPromise(_0x9007('0x65'),_0x9007('0x66'),_0x34c8ce);})['then'](function(_0x754641){_0x3a358a(_0x754641);})[_0x9007('0x26')](function(_0x21e2c0){_0x59aedc(_0x3d263b[_0x9007('0x17')](0x1f4,_0x21e2c0[_0x9007('0x19')]));});});}; \ No newline at end of file +var _0xde0c=['MailMessage','create','Contact\x20not\x20found','spread','interaction','created','subject','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailAccount','raw','options','where','attributes','limit','map','include','model','then','GetMailAccount','ShowMailAccount','find','catch','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Smtp','applications','Applications','list','orderBy','priority','asc','account','autoclose','length','close','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction'];(function(_0x3392fa,_0x16bf10){var _0x523226=function(_0x5921f1){while(--_0x5921f1){_0x3392fa['push'](_0x3392fa['shift']());}};_0x523226(++_0x16bf10);}(_0xde0c,0x7f));var _0xcde0=function(_0x5be0e5,_0x459331){_0x5be0e5=_0x5be0e5-0x0;var _0x20bb0d=_0xde0c[_0x5be0e5];return _0x20bb0d;};'use strict';var _=require('lodash');var util=require(_0xcde0('0x0'));var moment=require(_0xcde0('0x1'));var BPromise=require(_0xcde0('0x2'));var rs=require(_0xcde0('0x3'));var fs=require('fs');var Redis=require(_0xcde0('0x4'));var db=require(_0xcde0('0x5'))['db'];var utils=require(_0xcde0('0x6'));var logger=require('../../config/logger')(_0xcde0('0x7'));var config=require('../../config/environment');var jayson=require(_0xcde0('0x8'));var client=jayson[_0xcde0('0x9')][_0xcde0('0xa')]({'port':0x232c});config[_0xcde0('0xb')]=_[_0xcde0('0xc')](config[_0xcde0('0xb')],{'host':_0xcde0('0xd'),'port':0x18eb});var socket=require(_0xcde0('0xe'))(new Redis(config[_0xcde0('0xb')]));require(_0xcde0('0xf'))[_0xcde0('0x10')](socket);function respondWithRpcPromise(_0x55c1ea,_0x155fa5,_0x296f11){return new BPromise(function(_0x2ec948,_0x21b47e){return client[_0xcde0('0x11')](_0x55c1ea,_0x296f11)['then'](function(_0x34d8ac){logger[_0xcde0('0x12')](_0xcde0('0x13'),_0x155fa5,_0xcde0('0x14'));logger[_0xcde0('0x15')](_0xcde0('0x16'),_0x155fa5,_0xcde0('0x14'),JSON[_0xcde0('0x17')](_0x34d8ac));if(_0x34d8ac[_0xcde0('0x18')]){if(_0x34d8ac[_0xcde0('0x18')][_0xcde0('0x19')]===0x1f4){logger['error'](_0xcde0('0x13'),_0x155fa5,_0x34d8ac[_0xcde0('0x18')]['message']);return _0x21b47e(_0x34d8ac[_0xcde0('0x18')][_0xcde0('0x1a')]);}logger[_0xcde0('0x18')](_0xcde0('0x13'),_0x155fa5,_0x34d8ac[_0xcde0('0x18')]['message']);return _0x2ec948(_0x34d8ac[_0xcde0('0x18')][_0xcde0('0x1a')]);}else{logger[_0xcde0('0x12')](_0xcde0('0x13'),_0x155fa5,_0xcde0('0x14'));_0x2ec948(_0x34d8ac[_0xcde0('0x1b')][_0xcde0('0x1a')]);}})['catch'](function(_0x2cbe47){logger[_0xcde0('0x18')]('MailAccount,\x20%s,\x20%s',_0x155fa5,_0x2cbe47);_0x21b47e(_0x2cbe47);});});}exports['GetMailAccount']=function(_0x5e2415){var _0x3ca8d5=this;return new Promise(function(_0x402da9,_0x4a62e3){return db[_0xcde0('0x1c')]['findAll']({'raw':_0x5e2415['options']?_0x5e2415['options'][_0xcde0('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e2415[_0xcde0('0x1e')]?_0x5e2415['options'][_0xcde0('0x1f')]||null:null,'attributes':_0x5e2415[_0xcde0('0x1e')]?_0x5e2415['options'][_0xcde0('0x20')]||null:null,'limit':_0x5e2415[_0xcde0('0x1e')]?_0x5e2415[_0xcde0('0x1e')][_0xcde0('0x21')]||null:null,'include':_0x5e2415[_0xcde0('0x1e')]?_0x5e2415[_0xcde0('0x1e')]['include']?_[_0xcde0('0x22')](_0x5e2415['options'][_0xcde0('0x23')],function(_0x5b5f79){return{'model':db[_0x5b5f79['model']],'as':_0x5b5f79['as'],'attributes':_0x5b5f79[_0xcde0('0x20')],'include':_0x5b5f79[_0xcde0('0x23')]?_[_0xcde0('0x22')](_0x5b5f79[_0xcde0('0x23')],function(_0x567237){return{'model':db[_0x567237[_0xcde0('0x24')]],'as':_0x567237['as'],'attributes':_0x567237['attributes'],'include':_0x567237['include']?_[_0xcde0('0x22')](_0x567237['include'],function(_0x44a36e){return{'model':db[_0x44a36e[_0xcde0('0x24')]],'as':_0x44a36e['as'],'attributes':_0x44a36e[_0xcde0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcde0('0x25')](function(_0x537b0e){logger[_0xcde0('0x12')](_0xcde0('0x26'),_0x5e2415);logger[_0xcde0('0x15')]('GetMailAccount',_0x5e2415,JSON[_0xcde0('0x17')](_0x537b0e));_0x402da9(_0x537b0e);})['catch'](function(_0x2fc3d9){logger[_0xcde0('0x18')]('GetMailAccount',_0x2fc3d9['message'],_0x5e2415);_0x4a62e3(_0x3ca8d5[_0xcde0('0x18')](0x1f4,_0x2fc3d9[_0xcde0('0x1a')]));});});};exports[_0xcde0('0x27')]=function(_0x425e68){var _0x1a8758=this;return new Promise(function(_0x1ffb6b,_0x5b93cb){return db['MailAccount'][_0xcde0('0x28')]({'raw':_0x425e68['options']?_0x425e68[_0xcde0('0x1e')][_0xcde0('0x1d')]===undefined?!![]:![]:!![],'where':_0x425e68[_0xcde0('0x1e')]?_0x425e68[_0xcde0('0x1e')][_0xcde0('0x1f')]||null:null,'attributes':_0x425e68[_0xcde0('0x1e')]?_0x425e68[_0xcde0('0x1e')][_0xcde0('0x20')]||null:null,'include':_0x425e68[_0xcde0('0x1e')]?_0x425e68['options'][_0xcde0('0x23')]?_['map'](_0x425e68['options'][_0xcde0('0x23')],function(_0x5db54e){return{'model':db[_0x5db54e[_0xcde0('0x24')]],'as':_0x5db54e['as'],'attributes':_0x5db54e[_0xcde0('0x20')],'include':_0x5db54e[_0xcde0('0x23')]?_[_0xcde0('0x22')](_0x5db54e['include'],function(_0x56b35f){return{'model':db[_0x56b35f[_0xcde0('0x24')]],'as':_0x56b35f['as'],'attributes':_0x56b35f[_0xcde0('0x20')],'include':_0x56b35f[_0xcde0('0x23')]?_[_0xcde0('0x22')](_0x56b35f[_0xcde0('0x23')],function(_0x2f9243){return{'model':db[_0x2f9243[_0xcde0('0x24')]],'as':_0x2f9243['as'],'attributes':_0x2f9243[_0xcde0('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c5bf5){logger['info']('ShowMailAccount',_0x425e68);logger[_0xcde0('0x15')](_0xcde0('0x27'),_0x425e68,JSON[_0xcde0('0x17')](_0x2c5bf5));_0x1ffb6b(_0x2c5bf5);})[_0xcde0('0x29')](function(_0x276d26){logger[_0xcde0('0x18')](_0xcde0('0x27'),_0x276d26[_0xcde0('0x1a')],_0x425e68);_0x5b93cb(_0x1a8758[_0xcde0('0x18')](0x1f4,_0x276d26[_0xcde0('0x1a')]));});});};exports['NotifyMailAccount']=function(_0x95b17d){var _0x5d2d5d=this;return new Promise(function(_0xe0ab62,_0x2d4e0c){var _0x4323bc={'body':_0x95b17d[_0xcde0('0x2a')],'channel':_0xcde0('0x2b')};var _0x1151ef=_[_0xcde0('0x2c')](_[_0xcde0('0x2d')](db[_0xcde0('0x2e')][_0xcde0('0x2f')]),[_0xcde0('0x30'),_0xcde0('0x31'),_0xcde0('0x32'),_0xcde0('0x33')]);var _0x1770b8=![];if(_0x95b17d['body']['id']){delete _0x95b17d[_0xcde0('0x2a')]['id'];}if(_[_0xcde0('0x34')](_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x35')])){return _0x2d4e0c(_0x5d2d5d['error'](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x95b17d['body']['body'])||_0x95b17d['body']['body']===''){return _0x2d4e0c(_0x5d2d5d['error'](0x1f4,_0xcde0('0x36')));}if(_['isNil'](_0x95b17d['body'][_0xcde0('0x37')])){return _0x2d4e0c(_0x5d2d5d['error'](0x1f4,_0xcde0('0x38')+_0x1151ef));}if(!_[_0xcde0('0x39')](_0x1151ef,_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x37')])){return _0x2d4e0c(_0x5d2d5d['error'](0x1f4,_0xcde0('0x3a')+_0x1151ef));}var _0x1b4ca6={};_0x1b4ca6[_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x37')]]=_0x95b17d['body']['from'];return db['MailAccount'][_0xcde0('0x28')]({'where':{'id':_0x95b17d['account']['id']},'include':[{'model':db[_0xcde0('0x3b')],'as':_0xcde0('0x3c'),'include':[{'model':db[_0xcde0('0x2e')],'as':_0xcde0('0x3d'),'where':_0x1b4ca6,'limit':0x1,'order':[[_0xcde0('0x31'),_0xcde0('0x3e')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xcde0('0x3f')}]})[_0xcde0('0x25')](function(_0x260b77){if(_0x260b77&&_0x260b77['List']){var _0x395051=_0x260b77['get']({'plain':!![]});_0x4323bc['account']=_['omit'](_0x395051,['Applications',_0xcde0('0x3c')]);_0x4323bc[_0xcde0('0x40')]=_0x395051[_0xcde0('0x41')];_0x4323bc[_0xcde0('0x42')]=_0x395051['List'];_0x4323bc['applications']=_[_0xcde0('0x43')](_0x4323bc[_0xcde0('0x40')],[_0xcde0('0x44')],[_0xcde0('0x45')]);if(_0x4323bc[_0xcde0('0x46')]&&_0x4323bc[_0xcde0('0x46')][_0xcde0('0x47')]){_0x4323bc['applications']['push']({'id':0x0,'priority':_0x4323bc[_0xcde0('0x40')][_0xcde0('0x48')]+0x1,'app':_0xcde0('0x49'),'appdata':_0xcde0('0x47'),'interval':'*,*,*,*'});}if(_0x4323bc[_0xcde0('0x46')][_0xcde0('0x41')]){delete _0x4323bc['account'][_0xcde0('0x41')];}if(_0x4323bc[_0xcde0('0x46')][_0xcde0('0x3c')]){delete _0x4323bc['account'][_0xcde0('0x3c')];}if(_0x395051[_0xcde0('0x3c')][_0xcde0('0x3d')][_0xcde0('0x48')]){return _0x395051[_0xcde0('0x3c')][_0xcde0('0x3d')][0x0];}var _0xbfec39=_[_0xcde0('0xc')](_0x95b17d[_0xcde0('0x2a')],{'firstName':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x35')],'ListId':_0x395051[_0xcde0('0x33')]});_0xbfec39[_0x95b17d['body'][_0xcde0('0x37')]]=_0x95b17d['body']['from'];return db[_0xcde0('0x2e')]['create'](_0xbfec39);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x219271){_0x4323bc[_0xcde0('0x4a')]=_0x219271;if(_0x219271){if(!_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x4b')]){_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x4b')]=rs[_0xcde0('0x4c')]()+'\x20'+_0x95b17d[_0xcde0('0x2a')]['message'][_0xcde0('0x35')];}var _0x46e769={'ContactId':_0x219271['id'],'MailAccountId':_0x95b17d[_0xcde0('0x46')]['id'],'inReplyTo':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x4b')],'to':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x35')],'cc':_0x95b17d['body']['message']['cc'],'subject':_0x95b17d['body']['message']['subject'],'attach':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x4d')],'lastMsgAt':moment()[_0xcde0('0x4e')](_0xcde0('0x4f')),'lastMsgDirection':'in'};return db[_0xcde0('0x50')][_0xcde0('0x28')]({'where':{'closed':![],'MailAccountId':_0x95b17d[_0xcde0('0x46')]['id']},'include':[{'model':db[_0xcde0('0x51')],'as':'Messages','attributes':[_0xcde0('0x4b')],'where':{'messageId':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')]['inReplyTo']}}]})[_0xcde0('0x25')](function(_0xf8ed58){if(_0xf8ed58){return[_0xf8ed58,![]];}return db[_0xcde0('0x50')][_0xcde0('0x52')](_0x46e769)[_0xcde0('0x25')](function(_0x328a9e){return[_0x328a9e,!![]];});});}else{throw new Error(_0xcde0('0x53'));}})[_0xcde0('0x54')](function(_0x55c53e,_0x5dd8c2){if(_0x55c53e){_0x1770b8=_0x5dd8c2;if(!_0x5dd8c2){return _0x55c53e['update']({'inReplyTo':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x4b')],'to':_0x95b17d[_0xcde0('0x2a')]['message'][_0xcde0('0x35')],'cc':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')]['cc'],'subject':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')]['subject'],'attach':_0x55c53e[_0xcde0('0x4d')]?_0x55c53e[_0xcde0('0x4d')]:_0x95b17d['body'][_0xcde0('0x1a')][_0xcde0('0x4d')],'substatus':null,'substatusAt':moment()[_0xcde0('0x4e')](_0xcde0('0x4f')),'lastMsgAt':moment()[_0xcde0('0x4e')](_0xcde0('0x4f')),'lastMsgDirection':'in'});}else{return _0x55c53e;}}})[_0xcde0('0x25')](function(_0x450407){_0x4323bc[_0xcde0('0x55')]=_0x450407['get']({'plain':!![]});_0x4323bc[_0xcde0('0x55')][_0xcde0('0x56')]=_0x1770b8;return db[_0xcde0('0x51')][_0xcde0('0x52')]({'body':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x2a')],'MailAccountId':_0x95b17d[_0xcde0('0x46')]['id'],'MailInteractionId':_0x450407['id'],'direction':'in','ContactId':_0x4323bc['contact']['id'],'messageId':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x4b')],'from':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x35')],'to':_0x95b17d[_0xcde0('0x2a')]['message']['to'],'cc':_0x95b17d[_0xcde0('0x2a')]['message']['cc'],'subject':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x57')],'attach':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')]['attach'],'Attachments':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x58')],'originTo':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x59')],'originCc':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x5a')],'bcc':_0x95b17d['body'][_0xcde0('0x1a')][_0xcde0('0x5b')],'ChatWebsiteId':_0x95b17d[_0xcde0('0x2a')][_0xcde0('0x1a')][_0xcde0('0x5c')]||null,'originChannel':_0x95b17d[_0xcde0('0x2a')]['message'][_0xcde0('0x5d')]||_0xcde0('0x5e'),'ChatOfflineMessageId':_0x95b17d[_0xcde0('0x2a')]['message'][_0xcde0('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0xcde0('0x60')}]});})[_0xcde0('0x25')](function(_0x19ee10){_0x4323bc[_0xcde0('0x1a')]=_0x19ee10;if(_0x4323bc['interaction'][_0xcde0('0x61')]){return db[_0xcde0('0x62')][_0xcde0('0x28')]({'attributes':['id','name'],'where':{'id':_0x4323bc[_0xcde0('0x55')][_0xcde0('0x61')]}})[_0xcde0('0x25')](function(_0x2666b5){if(_0x2666b5){_0x4323bc[_0xcde0('0x40')][_0xcde0('0x63')]({'id':0x0,'priority':0x0,'app':_0xcde0('0x64'),'appdata':_0x2666b5['name']+','+(_0x4323bc[_0xcde0('0x46')][_0xcde0('0x65')]||0xa),'interval':_0xcde0('0x66')});}return respondWithRpcPromise(_0xcde0('0x67'),'startRouting',_0x4323bc);});}return respondWithRpcPromise(_0xcde0('0x67'),'startRouting',_0x4323bc);})[_0xcde0('0x25')](function(_0x268f6f){_0xe0ab62(_0x268f6f);})['catch'](function(_0x30af4b){_0x2d4e0c(_0x5d2d5d[_0xcde0('0x18')](0x1f4,_0x30af4b[_0xcde0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9c8772e..c78978e 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 _0xb7aa=['./mailAccount.events','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7aa,0x11a));var _0xab7a=function(_0x4b1573,_0x2d7e3b){_0x4b1573=_0x4b1573-0x0;var _0x5898dc=_0xb7aa[_0x4b1573];return _0x5898dc;};'use strict';var MailAccountEvents=require(_0xab7a('0x0'));var events=[_0xab7a('0x1'),_0xab7a('0x2'),_0xab7a('0x3')];function createListener(_0x1d2507,_0x3eab6c){return function(_0x20b86d){_0x3eab6c[_0xab7a('0x4')](_0x1d2507,_0x20b86d);};}function removeListener(_0x34adc3,_0x3b0621){return function(){MailAccountEvents['removeListener'](_0x34adc3,_0x3b0621);};}exports[_0xab7a('0x5')]=function(_0x1c761b){for(var _0x2ee412=0x0,_0x29ef15=events['length'];_0x2ee412<_0x29ef15;_0x2ee412++){var _0x99ac82=events[_0x2ee412];var _0x1e3b23=createListener('mailAccount:'+_0x99ac82,_0x1c761b);MailAccountEvents['on'](_0x99ac82,_0x1e3b23);}}; \ No newline at end of file +var _0xe09d=['register','length','mailAccount:','./mailAccount.events','save','emit','removeListener'];(function(_0x42a271,_0x540387){var _0x3ec97a=function(_0x208295){while(--_0x208295){_0x42a271['push'](_0x42a271['shift']());}};_0x3ec97a(++_0x540387);}(_0xe09d,0x9d));var _0xde09=function(_0xa3daa4,_0x29690c){_0xa3daa4=_0xa3daa4-0x0;var _0x128994=_0xe09d[_0xa3daa4];return _0x128994;};'use strict';var MailAccountEvents=require(_0xde09('0x0'));var events=[_0xde09('0x1'),'remove','update'];function createListener(_0x2a51fd,_0xab888){return function(_0x5be4b1){_0xab888[_0xde09('0x2')](_0x2a51fd,_0x5be4b1);};}function removeListener(_0x28e31f,_0x4b50a6){return function(){MailAccountEvents[_0xde09('0x3')](_0x28e31f,_0x4b50a6);};}exports[_0xde09('0x4')]=function(_0x2bb6c4){for(var _0x245fe1=0x0,_0x22134c=events[_0xde09('0x5')];_0x245fe1<_0x22134c;_0x245fe1++){var _0x4302e8=events[_0x245fe1];var _0x44e890=createListener(_0xde09('0x6')+_0x4302e8,_0x2bb6c4);MailAccountEvents['on'](_0x4302e8,_0x44e890);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index c92d732..2fe43c7 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 _0xb878=['put','update','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb878,0x112));var _0x8b87=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb878[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x8b87('0x0'));var util=require(_0x8b87('0x1'));var path=require(_0x8b87('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8b87('0x3'));var auth=require(_0x8b87('0x4'));var interaction=require(_0x8b87('0x5'));var config=require(_0x8b87('0x6'));var controller=require('./mailApplication.controller');router[_0x8b87('0x7')](_0x8b87('0x8'),auth[_0x8b87('0x9')](),controller[_0x8b87('0xa')]);router[_0x8b87('0xb')](_0x8b87('0x8'),auth[_0x8b87('0x9')](),controller[_0x8b87('0xc')]);router['delete'](_0x8b87('0x8'),auth[_0x8b87('0x9')](),controller[_0x8b87('0xd')]);module[_0x8b87('0xe')]=router; \ No newline at end of file +var _0x03d3=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put','/:id','exports','util'];(function(_0x3f6d0,_0x18c6cf){var _0x177ed3=function(_0x260e7f){while(--_0x260e7f){_0x3f6d0['push'](_0x3f6d0['shift']());}};_0x177ed3(++_0x18c6cf);}(_0x03d3,0x176));var _0x303d=function(_0x3899b9,_0x1d7b0a){_0x3899b9=_0x3899b9-0x0;var _0x31d026=_0x03d3[_0x3899b9];return _0x31d026;};'use strict';var multer=require('multer');var util=require(_0x303d('0x0'));var path=require(_0x303d('0x1'));var timeout=require(_0x303d('0x2'));var express=require(_0x303d('0x3'));var router=express['Router']();var fs_extra=require(_0x303d('0x4'));var auth=require(_0x303d('0x5'));var interaction=require(_0x303d('0x6'));var config=require(_0x303d('0x7'));var controller=require(_0x303d('0x8'));router[_0x303d('0x9')]('/:id',auth[_0x303d('0xa')](),controller[_0x303d('0xb')]);router[_0x303d('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x303d('0xd'),auth[_0x303d('0xa')](),controller['destroy']);module[_0x303d('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index dc495df..9800390 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 _0x41a9=['noop','exports','STRING'];(function(_0x2749f1,_0x5023e2){var _0xd2c36e=function(_0x3c1bbb){while(--_0x3c1bbb){_0x2749f1['push'](_0x2749f1['shift']());}};_0xd2c36e(++_0x5023e2);}(_0x41a9,0x1a5));var _0x941a=function(_0x3e4e4e,_0x2621d5){_0x3e4e4e=_0x3e4e4e-0x0;var _0x480c9c=_0x41a9[_0x3e4e4e];return _0x480c9c;};'use strict';var Sequelize=require('sequelize');module[_0x941a('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x941a('0x1')],'allowNull':![],'defaultValue':_0x941a('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x941a('0x1')]},'interval':{'type':Sequelize[_0x941a('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8b73=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x3df655,_0x31c238){var _0x41487a=function(_0x145fd5){while(--_0x145fd5){_0x3df655['push'](_0x3df655['shift']());}};_0x41487a(++_0x31c238);}(_0x8b73,0xf5));var _0x38b7=function(_0x469cb7,_0x1cbd88){_0x469cb7=_0x469cb7-0x0;var _0x8013f=_0x8b73[_0x469cb7];return _0x8013f;};'use strict';var Sequelize=require(_0x38b7('0x0'));module[_0x38b7('0x1')]={'priority':{'type':Sequelize[_0x38b7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x38b7('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x38b7('0x4')]()},'description':{'type':Sequelize[_0x38b7('0x3')]},'interval':{'type':Sequelize[_0x38b7('0x3')],'defaultValue':_0x38b7('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4af9ea0..ae1479e 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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x4c912e,_0x27299d){var _0x2fa424=function(_0x4b0cfb){while(--_0x4b0cfb){_0x4c912e['push'](_0x4c912e['shift']());}};_0x2fa424(++_0x27299d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x5b1042,_0x21f757){var _0x28485d=function(_0xecfefd){while(--_0xecfefd){_0x5b1042['push'](_0x5b1042['shift']());}};_0x28485d(++_0x21f757);}(_0x70e0,0x17b));var _0x070e=function(_0x593fc3,_0x4a0310){_0x593fc3=_0x593fc3-0x0;var _0xa79754=_0x70e0[_0x593fc3];return _0xa79754;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index db86f5d..af44831 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 _0x685c=['bluebird','request-promise','path','rimraf','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x4b23b0,_0xf3d9b4){var _0x1440d7=function(_0xcbf17b){while(--_0xcbf17b){_0x4b23b0['push'](_0x4b23b0['shift']());}};_0x1440d7(++_0xf3d9b4);}(_0x685c,0x1bb));var _0xc685=function(_0x131b6a,_0x13c1d3){_0x131b6a=_0x131b6a-0x0;var _0x11b39d=_0x685c[_0x131b6a];return _0x11b39d;};'use strict';var _=require(_0xc685('0x0'));var util=require(_0xc685('0x1'));var logger=require(_0xc685('0x2'))(_0xc685('0x3'));var moment=require(_0xc685('0x4'));var BPromise=require(_0xc685('0x5'));var rp=require(_0xc685('0x6'));var fs=require('fs');var path=require(_0xc685('0x7'));var rimraf=require(_0xc685('0x8'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0xc685('0x9')]=function(_0x53a11c,_0x20fb5c){return _0x53a11c['define'](_0xc685('0xa'),attributes,{'tableName':_0xc685('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc685('0xc'),'collate':_0xc685('0xd')});}; \ No newline at end of file +var _0x5b46=['mail_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','request-promise','rimraf','./mailApplication.attributes','define'];(function(_0x4d331a,_0xc87a30){var _0xc12d87=function(_0x22b525){while(--_0x22b525){_0x4d331a['push'](_0x4d331a['shift']());}};_0xc12d87(++_0xc87a30);}(_0x5b46,0xae));var _0x65b4=function(_0x227ca7,_0x671322){_0x227ca7=_0x227ca7-0x0;var _0x32b8be=_0x5b46[_0x227ca7];return _0x32b8be;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x65b4('0x0'))(_0x65b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x65b4('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65b4('0x3'));var config=require('../../config/environment');var attributes=require(_0x65b4('0x4'));module['exports']=function(_0x257f54,_0x53eb79){return _0x257f54[_0x65b4('0x5')]('MailApplication',attributes,{'tableName':_0x65b4('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x65b4('0x7'),'collate':_0x65b4('0x8')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9366d2d..dc676a3 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 _0x7788=['raw','options','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body'];(function(_0x566bb4,_0x2a9b96){var _0xc9d199=function(_0x8b8032){while(--_0x8b8032){_0x566bb4['push'](_0x566bb4['shift']());}};_0xc9d199(++_0x2a9b96);}(_0x7788,0x185));var _0x8778=function(_0x1526a9,_0x48fb64){_0x1526a9=_0x1526a9-0x0;var _0x9f4049=_0x7788[_0x1526a9];return _0x9f4049;};'use strict';var _=require(_0x8778('0x0'));var util=require(_0x8778('0x1'));var moment=require(_0x8778('0x2'));var BPromise=require('bluebird');var rs=require(_0x8778('0x3'));var fs=require('fs');var Redis=require(_0x8778('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8778('0x5'))(_0x8778('0x6'));var config=require(_0x8778('0x7'));var jayson=require(_0x8778('0x8'));var client=jayson[_0x8778('0x9')][_0x8778('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x431375,_0x1b217e,_0x591ab7){return new BPromise(function(_0x30c345,_0x5ae985){return client[_0x8778('0xb')](_0x431375,_0x591ab7)[_0x8778('0xc')](function(_0x280a92){logger[_0x8778('0xd')](_0x8778('0xe'),_0x1b217e,_0x8778('0xf'));logger[_0x8778('0x10')](_0x8778('0x11'),_0x1b217e,_0x8778('0xf'),JSON['stringify'](_0x280a92));if(_0x280a92['error']){if(_0x280a92[_0x8778('0x12')][_0x8778('0x13')]===0x1f4){logger[_0x8778('0x12')](_0x8778('0xe'),_0x1b217e,_0x280a92[_0x8778('0x12')][_0x8778('0x14')]);return _0x5ae985(_0x280a92['error'][_0x8778('0x14')]);}logger[_0x8778('0x12')]('MailApplication,\x20%s,\x20%s',_0x1b217e,_0x280a92[_0x8778('0x12')]['message']);return _0x30c345(_0x280a92[_0x8778('0x12')]['message']);}else{logger[_0x8778('0xd')]('MailApplication,\x20%s,\x20%s',_0x1b217e,_0x8778('0xf'));_0x30c345(_0x280a92[_0x8778('0x15')][_0x8778('0x14')]);}})[_0x8778('0x16')](function(_0x11c617){logger[_0x8778('0x12')]('MailApplication,\x20%s,\x20%s',_0x1b217e,_0x11c617);_0x5ae985(_0x11c617);});});}exports[_0x8778('0x17')]=function(_0x76ea81){var _0x36a755=this;return new Promise(function(_0x384b7a,_0x2a72ff){return db[_0x8778('0x18')][_0x8778('0x19')](_0x76ea81[_0x8778('0x1a')],{'raw':_0x76ea81['options']?_0x76ea81['options'][_0x8778('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x76ea81[_0x8778('0x1c')]?_0x76ea81[_0x8778('0x1c')][_0x8778('0x1d')]||null:null,'attributes':_0x76ea81[_0x8778('0x1c')]?_0x76ea81[_0x8778('0x1c')][_0x8778('0x1e')]||null:null,'limit':_0x76ea81[_0x8778('0x1c')]?_0x76ea81[_0x8778('0x1c')][_0x8778('0x1f')]||null:null})[_0x8778('0xc')](function(_0x12f979){logger[_0x8778('0xd')](_0x8778('0x17'),_0x76ea81);logger['debug']('UpdateMailApplication',_0x76ea81,JSON['stringify'](_0x12f979));_0x384b7a(_0x12f979);})[_0x8778('0x16')](function(_0x23c1f9){logger[_0x8778('0x12')]('UpdateMailApplication',_0x23c1f9[_0x8778('0x14')],_0x76ea81);_0x2a72ff(_0x36a755[_0x8778('0x12')](0x1f4,_0x23c1f9[_0x8778('0x14')]));});});}; \ No newline at end of file +var _0x1e10=['MailApplication,\x20%s,\x20%s','result','catch','UpdateMailApplication','update','body','options','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x768c56,_0x2d06b6){var _0x5a4396=function(_0xb6e179){while(--_0xb6e179){_0x768c56['push'](_0x768c56['shift']());}};_0x5a4396(++_0x2d06b6);}(_0x1e10,0x18a));var _0x01e1=function(_0x4df04b,_0x52b8cb){_0x4df04b=_0x4df04b-0x0;var _0x5ce10e=_0x1e10[_0x4df04b];return _0x5ce10e;};'use strict';var _=require(_0x01e1('0x0'));var util=require('util');var moment=require(_0x01e1('0x1'));var BPromise=require(_0x01e1('0x2'));var rs=require(_0x01e1('0x3'));var fs=require('fs');var Redis=require(_0x01e1('0x4'));var db=require(_0x01e1('0x5'))['db'];var utils=require(_0x01e1('0x6'));var logger=require(_0x01e1('0x7'))(_0x01e1('0x8'));var config=require(_0x01e1('0x9'));var jayson=require(_0x01e1('0xa'));var client=jayson['client'][_0x01e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x317f1b,_0x6d768e,_0x56a29a){return new BPromise(function(_0xd9e650,_0xa502b8){return client[_0x01e1('0xc')](_0x317f1b,_0x56a29a)[_0x01e1('0xd')](function(_0x36df3b){logger[_0x01e1('0xe')]('MailApplication,\x20%s,\x20%s',_0x6d768e,'request\x20sent');logger[_0x01e1('0xf')](_0x01e1('0x10'),_0x6d768e,_0x01e1('0x11'),JSON[_0x01e1('0x12')](_0x36df3b));if(_0x36df3b[_0x01e1('0x13')]){if(_0x36df3b[_0x01e1('0x13')][_0x01e1('0x14')]===0x1f4){logger[_0x01e1('0x13')]('MailApplication,\x20%s,\x20%s',_0x6d768e,_0x36df3b[_0x01e1('0x13')]['message']);return _0xa502b8(_0x36df3b[_0x01e1('0x13')][_0x01e1('0x15')]);}logger['error'](_0x01e1('0x16'),_0x6d768e,_0x36df3b[_0x01e1('0x13')][_0x01e1('0x15')]);return _0xd9e650(_0x36df3b[_0x01e1('0x13')][_0x01e1('0x15')]);}else{logger[_0x01e1('0xe')]('MailApplication,\x20%s,\x20%s',_0x6d768e,'request\x20sent');_0xd9e650(_0x36df3b[_0x01e1('0x17')][_0x01e1('0x15')]);}})[_0x01e1('0x18')](function(_0x37cd85){logger[_0x01e1('0x13')](_0x01e1('0x16'),_0x6d768e,_0x37cd85);_0xa502b8(_0x37cd85);});});}exports[_0x01e1('0x19')]=function(_0x529269){var _0x237f4a=this;return new Promise(function(_0x336d3e,_0x4b7cdc){return db['MailApplication'][_0x01e1('0x1a')](_0x529269[_0x01e1('0x1b')],{'raw':_0x529269['options']?_0x529269[_0x01e1('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529269[_0x01e1('0x1c')]?_0x529269[_0x01e1('0x1c')][_0x01e1('0x1d')]||null:null,'attributes':_0x529269[_0x01e1('0x1c')]?_0x529269[_0x01e1('0x1c')][_0x01e1('0x1e')]||null:null,'limit':_0x529269['options']?_0x529269[_0x01e1('0x1c')][_0x01e1('0x1f')]||null:null})[_0x01e1('0xd')](function(_0x15ab6b){logger[_0x01e1('0xe')](_0x01e1('0x19'),_0x529269);logger[_0x01e1('0xf')]('UpdateMailApplication',_0x529269,JSON[_0x01e1('0x12')](_0x15ab6b));_0x336d3e(_0x15ab6b);})[_0x01e1('0x18')](function(_0x50c836){logger[_0x01e1('0x13')](_0x01e1('0x19'),_0x50c836[_0x01e1('0x15')],_0x529269);_0x4b7cdc(_0x237f4a[_0x01e1('0x13')](0x1f4,_0x50c836[_0x01e1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 35fcea2..5f1fb28 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 _0x6d1a=['show','/:id/messages','getMessages','/:id/download','post','addMessage','mail','mailinteraction:addtags','addTags','put','/:id','tracked','update','mailinteraction:destroy','destroy','delete','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x15e1ca,_0x50df5d){var _0xd0c43c=function(_0x1f9f78){while(--_0x1f9f78){_0x15e1ca['push'](_0x15e1ca['shift']());}};_0xd0c43c(++_0x50df5d);}(_0x6d1a,0xb3));var _0xa6d1=function(_0xfb72c,_0x400d94){_0xfb72c=_0xfb72c-0x0;var _0x52e905=_0x6d1a[_0xfb72c];return _0x52e905;};'use strict';var express=require(_0xa6d1('0x0'));var router=express[_0xa6d1('0x1')]();var auth=require(_0xa6d1('0x2'));var interaction=require(_0xa6d1('0x3'));var controller=require(_0xa6d1('0x4'));router[_0xa6d1('0x5')]('/',auth[_0xa6d1('0x6')](),controller[_0xa6d1('0x7')]);router['get'](_0xa6d1('0x8'),auth['isAuthenticated'](),controller[_0xa6d1('0x9')]);router['get']('/:id',auth[_0xa6d1('0x6')](),controller[_0xa6d1('0xa')]);router[_0xa6d1('0x5')](_0xa6d1('0xb'),auth[_0xa6d1('0x6')](),controller[_0xa6d1('0xc')]);router['get'](_0xa6d1('0xd'),auth[_0xa6d1('0x6')](),controller['download']);router[_0xa6d1('0xe')]('/',auth[_0xa6d1('0x6')](),controller['create']);router['post'](_0xa6d1('0xb'),auth[_0xa6d1('0x6')](),controller[_0xa6d1('0xf')]);router[_0xa6d1('0xe')]('/:id/tags',auth[_0xa6d1('0x6')](),interaction['tracked'](_0xa6d1('0x10'),_0xa6d1('0x11')),controller[_0xa6d1('0x12')]);router[_0xa6d1('0x13')](_0xa6d1('0x14'),auth[_0xa6d1('0x6')](),interaction[_0xa6d1('0x15')](_0xa6d1('0x10'),'mailinteraction:update'),controller[_0xa6d1('0x16')]);router['delete'](_0xa6d1('0x14'),auth['isAuthenticated'](),interaction[_0xa6d1('0x15')]('mail',_0xa6d1('0x17')),controller[_0xa6d1('0x18')]);router[_0xa6d1('0x19')]('/:id/tags',auth[_0xa6d1('0x6')](),controller['removeTags']);module[_0xa6d1('0x1a')]=router; \ No newline at end of file +var _0x447d=['mailinteraction:destroy','destroy','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete'];(function(_0x381a38,_0x4e6e2e){var _0x5448b1=function(_0x1a2807){while(--_0x1a2807){_0x381a38['push'](_0x381a38['shift']());}};_0x5448b1(++_0x4e6e2e);}(_0x447d,0x1e8));var _0xd447=function(_0x3ec98c,_0x19f239){_0x3ec98c=_0x3ec98c-0x0;var _0x59e4c8=_0x447d[_0x3ec98c];return _0x59e4c8;};'use strict';var express=require('express');var router=express[_0xd447('0x0')]();var auth=require(_0xd447('0x1'));var interaction=require(_0xd447('0x2'));var controller=require(_0xd447('0x3'));router[_0xd447('0x4')]('/',auth['isAuthenticated'](),controller[_0xd447('0x5')]);router[_0xd447('0x4')]('/describe',auth[_0xd447('0x6')](),controller[_0xd447('0x7')]);router[_0xd447('0x4')](_0xd447('0x8'),auth[_0xd447('0x6')](),controller[_0xd447('0x9')]);router['get'](_0xd447('0xa'),auth[_0xd447('0x6')](),controller[_0xd447('0xb')]);router['get'](_0xd447('0xc'),auth['isAuthenticated'](),controller[_0xd447('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd447('0xe')](_0xd447('0xa'),auth[_0xd447('0x6')](),controller[_0xd447('0xf')]);router[_0xd447('0xe')](_0xd447('0x10'),auth['isAuthenticated'](),interaction[_0xd447('0x11')](_0xd447('0x12'),_0xd447('0x13')),controller[_0xd447('0x14')]);router[_0xd447('0x15')](_0xd447('0x8'),auth['isAuthenticated'](),interaction[_0xd447('0x11')](_0xd447('0x12'),_0xd447('0x16')),controller[_0xd447('0x17')]);router[_0xd447('0x18')](_0xd447('0x8'),auth[_0xd447('0x6')](),interaction[_0xd447('0x11')]('mail',_0xd447('0x19')),controller[_0xd447('0x1a')]);router[_0xd447('0x18')]('/:id/tags',auth[_0xd447('0x6')](),controller['removeTags']);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 e9e16fb..f1a737c 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 _0x4d29=['exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out'];(function(_0x167307,_0x5a60ae){var _0x550140=function(_0x5b5009){while(--_0x5b5009){_0x167307['push'](_0x167307['shift']());}};_0x550140(++_0x5a60ae);}(_0x4d29,0xc8));var _0x94d2=function(_0x43205a,_0x3bd9f3){_0x43205a=_0x43205a-0x0;var _0x32d6a4=_0x4d29[_0x43205a];return _0x32d6a4;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x94d2('0x0')]={'closed':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x94d2('0x2')]},'disposition':{'type':Sequelize[_0x94d2('0x3')]},'secondDisposition':{'type':Sequelize[_0x94d2('0x3')]},'thirdDisposition':{'type':Sequelize[_0x94d2('0x3')]},'note':{'type':Sequelize[_0x94d2('0x3')]},'inReplyTo':{'type':Sequelize[_0x94d2('0x3')](0x1fe)},'to':{'type':Sequelize[_0x94d2('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x94d2('0x4'))},'subject':{'type':Sequelize[_0x94d2('0x5')]()},'attach':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x94d2('0x2')]},'substatus':{'type':Sequelize[_0x94d2('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x94d2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x94d2('0x6')]('in',_0x94d2('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x94d2('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xd0b2=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x4dd063,_0x386d0c){var _0x2b8747=function(_0x282e72){while(--_0x282e72){_0x4dd063['push'](_0x4dd063['shift']());}};_0x2b8747(++_0x386d0c);}(_0xd0b2,0x96));var _0x2d0b=function(_0x11cdd3,_0x23f16c){_0x11cdd3=_0x11cdd3-0x0;var _0x3859da=_0xd0b2[_0x11cdd3];return _0x3859da;};'use strict';var Sequelize=require(_0x2d0b('0x0'));var iconv=require(_0x2d0b('0x1'));module[_0x2d0b('0x2')]={'closed':{'type':Sequelize[_0x2d0b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2d0b('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2d0b('0x5')]},'note':{'type':Sequelize[_0x2d0b('0x5')]},'inReplyTo':{'type':Sequelize[_0x2d0b('0x5')](0x1fe)},'to':{'type':Sequelize[_0x2d0b('0x5')]},'cc':{'type':Sequelize[_0x2d0b('0x6')](_0x2d0b('0x7'))},'subject':{'type':Sequelize[_0x2d0b('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x2d0b('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x2d0b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2d0b('0x8')]('in',_0x2d0b('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2d0b('0x8')]('in',_0x2d0b('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2d0b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 7ee4b62..00f0c1d 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 _0x648b=['read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','i.MailAccountId\x20IS\x20NOT\x20NULL','user','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','show','params','rawAttributes','includeAll','include','create','body','describe','addMessage','ids','getMessages','$gte','split','format','options','findAll','true','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','server','tmp','join','files','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','basename','existsSync','attachments','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','util','path','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','status','offset','undefined','limit','Content-Range','json','update','destroy','then','end','sendStatus','stack','name','Users','map','fullname','TagIds','Tags','push','MailMessage','out','plainBody','catch','index','MailInteraction','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','select','field','color','from','u.id','u.fullname','user_has_mail_interactions','left_join','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','isEmpty','MailAccountId','where','i.MailAccountId\x20IN\x20?','concat','parse','null','\x20IS\x20NULL','\x20=\x20?'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x648b,0x73));var _0xb648=function(_0x231ddb,_0xf437f2){_0x231ddb=_0x231ddb-0x0;var _0x5a0521=_0x648b[_0x231ddb];return _0x5a0521;};'use strict';var emlformat=require(_0xb648('0x0'));var rimraf=require(_0xb648('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xb648('0x2'));var path=require(_0xb648('0x3'));var fs=require('fs');var _=require(_0xb648('0x4'));var squel=require('squel');var juice=require('juice');var Redis=require(_0xb648('0x5'));var qs=require(_0xb648('0x6'));var as=require(_0xb648('0x7'));var logger=require(_0xb648('0x8'))('api');var config=require(_0xb648('0x9'));var db=require(_0xb648('0xa'))['db'];var htmlEntities=require(_0xb648('0xb'));config[_0xb648('0xc')]=_[_0xb648('0xd')](config[_0xb648('0xc')],{'host':_0xb648('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb648('0xc')]));require(_0xb648('0xf'))['register'](socket);function respondWithStatusCode(_0x56bc22,_0x1ccb6b){_0x1ccb6b=_0x1ccb6b||0xcc;return function(_0x2c817b){if(_0x2c817b){return _0x56bc22['sendStatus'](_0x1ccb6b);}return _0x56bc22[_0xb648('0x10')](_0x1ccb6b)['end']();};}function respondWithResult(_0x4ad507,_0x3db95c){_0x3db95c=_0x3db95c||0xc8;return function(_0x367628){if(_0x367628){return _0x4ad507[_0xb648('0x10')](_0x3db95c)['json'](_0x367628);}};}function respondWithFilteredResult(_0x1229a8,_0x5d49fb){return function(_0x5a7cde){if(_0x5a7cde){var _0x44bd94=typeof _0x5d49fb[_0xb648('0x11')]===_0xb648('0x12')&&typeof _0x5d49fb[_0xb648('0x13')]===_0xb648('0x12');var _0x2e4b16=_0x5a7cde['count'];var _0x26b18b=_0x44bd94?0x0:_0x5d49fb[_0xb648('0x11')];var _0x1be5c9=_0x44bd94?_0x5a7cde['count']:_0x5d49fb[_0xb648('0x11')]+_0x5d49fb[_0xb648('0x13')];var _0x4c7018;if(_0x1be5c9>=_0x2e4b16){_0x1be5c9=_0x2e4b16;_0x4c7018=0xc8;}else{_0x4c7018=0xce;}_0x1229a8[_0xb648('0x10')](_0x4c7018);return _0x1229a8['set'](_0xb648('0x14'),_0x26b18b+'-'+_0x1be5c9+'/'+_0x2e4b16)[_0xb648('0x15')](_0x5a7cde);}return null;};}function saveUpdates(_0x5c8a7b){return function(_0x436d8a){if(_0x436d8a){return _0x436d8a[_0xb648('0x16')](_0x5c8a7b)['then'](function(_0x55cbe0){return _0x55cbe0;});}return null;};}function removeEntity(_0x4e5f44){return function(_0x15e448){if(_0x15e448){return _0x15e448[_0xb648('0x17')]()[_0xb648('0x18')](function(){_0x4e5f44[_0xb648('0x10')](0xcc)[_0xb648('0x19')]();});}};}function handleEntityNotFound(_0x3507ec){return function(_0x1aa43b){if(!_0x1aa43b){_0x3507ec[_0xb648('0x1a')](0x194);}return _0x1aa43b;};}function handleError(_0x22eac9,_0x2d460d){_0x2d460d=_0x2d460d||0x1f4;return function(_0xa73c51){logger['error'](_0xa73c51[_0xb648('0x1b')]);if(_0xa73c51[_0xb648('0x1c')]){delete _0xa73c51[_0xb648('0x1c')];}_0x22eac9['status'](_0x2d460d)['send'](_0xa73c51);};}function getInteractionUsers(_0x2e1779,_0x145efe){return new BPromise(function(_0x38b3d0,_0x32cbca){try{if(_0x145efe[_0x2e1779['id']]){_0x2e1779[_0xb648('0x1d')]=_[_0xb648('0x1e')](_0x145efe[_0x2e1779['id']],function(_0x5cc289){return{'id':_0x5cc289['id'],'fullname':_0x5cc289[_0xb648('0x1f')]};});}}catch(_0x4a5e73){_0x32cbca(_0x4a5e73);}_0x38b3d0(_0x2e1779);});}function getInteractionTags(_0xa64803,_0x1b970a){return new BPromise(function(_0xfe416b,_0x500f86){try{if(_0xa64803[_0xb648('0x20')]){_0xa64803[_0xb648('0x21')]=[];_0xa64803[_0xb648('0x20')]['split'](',')['forEach'](function(_0x53d56a){_0xa64803[_0xb648('0x21')][_0xb648('0x22')](_0x1b970a[_0x53d56a]);});}delete _0xa64803['TagIds'];}catch(_0x356362){_0x500f86(_0x356362);}_0xfe416b(_0xa64803);});}function getLastMessageText(_0x43437f){return new BPromise(function(_0x14f4cb,_0x2ac0d4){return db[_0xb648('0x23')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x43437f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb648('0x24')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})['then'](function(_0x4acb9b){if(_0x4acb9b&&_0x4acb9b[_0xb648('0x25')]){_0x43437f['lastMsgText']=_['trimStart'](_0x4acb9b[_0xb648('0x25')]);}_0x14f4cb(_0x43437f);})[_0xb648('0x26')](function(_0x126c64){_0x2ac0d4(_0x126c64);});});}function updateMailInteraction(_0x5c0f3d,_0x3408d5,_0x2153f6,_0x5335e8){return new BPromise(function(_0x1aeaf6,_0x1a2831){return getInteractionUsers(_0x5c0f3d,_0x2153f6)[_0xb648('0x18')](function(_0x8361dd){return getInteractionTags(_0x8361dd,_0x3408d5);})[_0xb648('0x18')](function(_0x1ff7c1){if(_0x5335e8){_0x1aeaf6(getLastMessageText(_0x1ff7c1));}else{_0x1aeaf6(_0x1ff7c1);}})[_0xb648('0x26')](function(_0x3a82e9){_0x1a2831(_0x3a82e9);});});}exports[_0xb648('0x27')]=function(_0x5e6ab2,_0x230749){var _0x41a792={},_0x390c9f={},_0x1c331c={'count':0x0,'rows':[]};var _0x25aaf0=_[_0xb648('0x1e')](db[_0xb648('0x28')]['rawAttributes'],function(_0x3a5843){return{'name':_0x3a5843[_0xb648('0x29')],'type':_0x3a5843[_0xb648('0x2a')]['key']};});_0x390c9f[_0xb648('0x2b')]=_['map'](_0x25aaf0,_0xb648('0x1c'));_0x390c9f[_0xb648('0x2c')]=_[_0xb648('0x2d')](_0x5e6ab2[_0xb648('0x2c')]);_0x390c9f['filters']=_[_0xb648('0x2e')](_0x390c9f[_0xb648('0x2b')],_0x390c9f[_0xb648('0x2c')]);_0x41a792[_0xb648('0x2f')]=_[_0xb648('0x2e')](_0x390c9f[_0xb648('0x2b')],qs['fields'](_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x30')]));_0x41a792[_0xb648('0x2f')]=_0x41a792[_0xb648('0x2f')][_0xb648('0x31')]?_0x41a792['attributes']:_0x390c9f['model'];if(!_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x32')](_0xb648('0x33'))){_0x41a792[_0xb648('0x13')]=qs[_0xb648('0x13')](_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x13')]);_0x41a792[_0xb648('0x11')]=qs[_0xb648('0x11')](_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x11')]);}_0x41a792['order']=qs[_0xb648('0x34')](_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x34')]);_0x41a792['where']=qs[_0xb648('0x35')](_[_0xb648('0x36')](_0x5e6ab2[_0xb648('0x2c')],_0x390c9f[_0xb648('0x35')]),_0x25aaf0);var _0x340144=[];var _0x537468=squel[_0xb648('0x37')]()[_0xb648('0x38')]('id')[_0xb648('0x38')](_0xb648('0x1c'))[_0xb648('0x38')](_0xb648('0x39'))[_0xb648('0x3a')]('tools_tags');var _0x1fcc32=squel[_0xb648('0x37')]()[_0xb648('0x38')](_0xb648('0x3b'))[_0xb648('0x38')](_0xb648('0x3c'))['field']('ui.MailInteractionId')[_0xb648('0x3a')](_0xb648('0x3d'),'ui')[_0xb648('0x3e')]('users','u',_0xb648('0x3f'));var _0x13f9a6=squel[_0xb648('0x37')]()[_0xb648('0x3a')](_0xb648('0x40'),'i')[_0xb648('0x3e')]('cm_contacts','c',_0xb648('0x41'))[_0xb648('0x3e')]('users','o','o.id\x20=\x20i.UserId')[_0xb648('0x3e')](_0xb648('0x42'),'a','a.id\x20=\x20i.MailAccountId')[_0xb648('0x3e')](_0xb648('0x43'),'me',_0xb648('0x44'))[_0xb648('0x3e')](_0xb648('0x45'),'it',_0xb648('0x46'))[_0xb648('0x3e')]('tools_tags','t',_0xb648('0x47'));var _0x57c2f7=squel[_0xb648('0x48')]();var _0x3184eb=[];var _0x1b4c79=squel[_0xb648('0x48')]();var _0x2fe0dd;if(_0x5e6ab2[_0xb648('0x2c')]['search']){_0x2fe0dd=as['parseSearch'](_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x49')]);var _0x3d6dd7=_0x2fe0dd[_0xb648('0x4a')];for(var _0x12d7f6=0x0;_0x12d7f6<_0x2fe0dd[_0xb648('0x4b')][_0xb648('0x31')];_0x12d7f6++){var _0x3faa1d=_0x2fe0dd['conditions'][_0x12d7f6];var _0x330632='i';var _0x465de7=_[_0xb648('0x4c')](_0x25aaf0,[_0xb648('0x1c'),_0x3faa1d[_0xb648('0x38')]]);if(!_0x465de7){switch(_0x3faa1d['field']){case _0xb648('0x4d'):if(_0x3faa1d['value']==0x1){_0x13f9a6[_0xb648('0x4e')]('`'+_0x3faa1d[_0xb648('0x38')]+'`\x20=\x200');}else{_0x13f9a6[_0xb648('0x4e')]('`'+_0x3faa1d[_0xb648('0x38')]+_0xb648('0x4f'));}break;case _0xb648('0x50'):if(_0x3faa1d[_0xb648('0x51')]==='$substring'){if(_0x3faa1d['value']['split']('\x20')[_0xb648('0x31')]>0x1){_0x57c2f7[_0x3d6dd7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb648('0x52')](_0x3faa1d[_0xb648('0x53')]),null);}else{var _0x59ccda='%'+_0x3faa1d[_0xb648('0x53')]+'%';_0x57c2f7[_0x3d6dd7](_0xb648('0x54'),_0x59ccda,_0x59ccda,_0x59ccda);}}else{_0x465de7=_['find'](_0x25aaf0,[_0xb648('0x1c'),_0xb648('0x55')]);_0x3faa1d['field']=_0xb648('0x55');_0x5e6cbc=as[_0xb648('0x56')](_0x330632,_0x465de7[_0xb648('0x2a')],_0x3faa1d);_0x57c2f7[_0x3d6dd7](_0x5e6cbc[_0xb648('0x57')],_0x5e6cbc[_0xb648('0x53')][_0xb648('0x58')],_0x5e6cbc[_0xb648('0x53')]['end']);}break;case _0xb648('0x59'):var _0x39d386=_0x3faa1d[_0xb648('0x53')]['split'](',')[_0xb648('0x1e')](function(_0x4ddf2e){return Number(_0x4ddf2e);});_0x39d386[_0xb648('0x5a')](function(_0x10dd0b){_0x1b4c79['or'](_0xb648('0x5b'),'%,'+_0x10dd0b+',%');});_0x3184eb=_[_0xb648('0x5c')](_0x3184eb,_0x39d386);break;case _0xb648('0x5d'):if(_0x3faa1d['operator']===_0xb648('0x5e')){_0x57c2f7[_0x3d6dd7](_0xb648('0x5f'),'%'+_0x3faa1d['value']+'%',null);}else{_0x465de7=_[_0xb648('0x4c')](_0x25aaf0,[_0xb648('0x1c'),'UserId']);_0x3faa1d[_0xb648('0x38')]='UserId';_0x5e6cbc=as[_0xb648('0x56')](_0x330632,_0x465de7['type'],_0x3faa1d);_0x57c2f7[_0x3d6dd7](_0x5e6cbc[_0xb648('0x57')],_0x5e6cbc[_0xb648('0x53')][_0xb648('0x58')],_0x5e6cbc['value']['end']);}break;case _0xb648('0x25'):_0x5e6cbc=as['buildExpression']('me',null,_0x3faa1d);_0x57c2f7[_0x3d6dd7](_0x5e6cbc[_0xb648('0x57')],_0x5e6cbc[_0xb648('0x53')][_0xb648('0x58')],_0x5e6cbc[_0xb648('0x53')]['end']);break;}}else{var _0x5e6cbc=as[_0xb648('0x56')](_0x330632,_0x465de7[_0xb648('0x2a')],_0x3faa1d);_0x57c2f7[_0x3d6dd7](_0x5e6cbc['text'],_0x5e6cbc[_0xb648('0x53')][_0xb648('0x58')],_0x5e6cbc[_0xb648('0x53')]['end']);}}}else{var _0x15c812=_(_0x5e6ab2['query'])['keys']()[_0xb648('0x1e')](function(_0x4dd809){return _['some'](_0x25aaf0,['name',_0x4dd809])?_0x4dd809:undefined;})['compact']()[_0xb648('0x53')]();if(!_[_0xb648('0x60')](_0x15c812)){_0x15c812[_0xb648('0x5a')](function(_0x33058d){if(_0x33058d===_0xb648('0x61')){_0x13f9a6[_0xb648('0x62')](_0xb648('0x63'),[][_0xb648('0x64')](_0x5e6ab2[_0xb648('0x2c')][_0x33058d]));}else if(_0x33058d==='createdAt'){var _0x1cfafd=JSON[_0xb648('0x65')](_0x5e6ab2[_0xb648('0x2c')][_0x33058d])['$gte'];var _0x1bf329=JSON['parse'](_0x5e6ab2[_0xb648('0x2c')][_0x33058d])['$lte'];_0x13f9a6[_0xb648('0x62')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1cfafd,_0x1bf329);}else{if(_0x5e6ab2[_0xb648('0x2c')][_0x33058d]===_0xb648('0x66')){_0x13f9a6[_0xb648('0x62')]('i.'+_0x33058d+_0xb648('0x67'));}else{_0x13f9a6[_0xb648('0x62')]('i.'+_0x33058d+_0xb648('0x68'),_0x5e6ab2[_0xb648('0x2c')][_0x33058d]);}}});}if(_0x5e6ab2['query']['read']){if(_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x69')]==0x1){_0x13f9a6[_0xb648('0x4e')](_0xb648('0x6a'));}else{_0x13f9a6['having'](_0xb648('0x6b'));}}if(_0x5e6ab2[_0xb648('0x2c')]['tag']){_0x3184eb=_[_0xb648('0x6c')](_0x5e6ab2[_0xb648('0x2c')]['tag'])?_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x6d')]:new Array(_0x5e6ab2['query'][_0xb648('0x6d')]);_0x3184eb[_0xb648('0x5a')](function(_0x6db383){_0x1b4c79['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x6db383+',%');});}if(_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x6e')]){var _0x4f4e35=_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x6e')]['replace']('\x5c','\x5c\x5c')[_0xb648('0x6f')](/'/g,'\x27\x27');if(qs[_0xb648('0x70')](_0x4f4e35)){_0x57c2f7['or'](_0xb648('0x71'),_0x4f4e35+'%');}else if(qs[_0xb648('0x72')](_0x4f4e35)){_0x57c2f7['or']('c.email\x20LIKE\x20?',_0x4f4e35+'%');}else{_0x57c2f7['or'](_0xb648('0x73'),qs['getFullTextValue'](_0x4f4e35))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb648('0x52')](_0x4f4e35));}}}_0x13f9a6['where'](_0x57c2f7);_0x13f9a6[_0xb648('0x74')](_0xb648('0x75'));var _0x418d47={'type':db[_0xb648('0x76')]['QueryTypes'][_0xb648('0x77')],'raw':!![]};var _0xd56591=_0x13f9a6['clone']();_0xd56591[_0xb648('0x38')](_0xb648('0x75'));_0xd56591['field'](_0xb648('0x78'),_0xb648('0x4d'));if(_0x41a792[_0xb648('0x79')]){_0x41a792[_0xb648('0x79')][_0xb648('0x5a')](function(_0x364ae7){var _0x1c1f80=_0x364ae7[0x0]===_0xb648('0x7a')?_0x364ae7[0x0]:'i.'+_0x364ae7[0x0];_0x13f9a6[_0xb648('0x79')](_0x1c1f80,_0x364ae7[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x3184eb)){_0x13f9a6['having'](_0x1b4c79);_0xd56591['where']('t.id\x20IN\x20?',_0x3184eb);}BPromise['resolve']()['then'](function(){if(!_0x2fe0dd){if(_0x5e6ab2[_0xb648('0x2c')]['MailAccountId'])return;_0xd56591['where'](_0xb648('0x7b'));_0x13f9a6[_0xb648('0x62')](_0xb648('0x7b'));return;}if(_0x5e6ab2[_0xb648('0x7c')]['role']!=='agent')return;return _0x5e6ab2[_0xb648('0x7c')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xb648('0x18')](function(_0x1f5856){if(_['isEmpty'](_0x1f5856)){_0xd56591[_0xb648('0x62')](_0xb648('0x7d'));_0x13f9a6[_0xb648('0x62')](_0xb648('0x7d'));}else{_0xd56591['where'](_0xb648('0x63'),_[_0xb648('0x1e')](_0x1f5856,'id'));_0x13f9a6[_0xb648('0x62')]('i.MailAccountId\x20IN\x20?',_['map'](_0x1f5856,'id'));}});})[_0xb648('0x18')](function(){if(_0x5e6ab2[_0xb648('0x7c')][_0xb648('0x7e')]==='agent'&&!_0x2fe0dd&&!_0x5e6ab2[_0xb648('0x2c')]['MailAccountId'])return[];return db[_0xb648('0x7f')][_0xb648('0x2c')](_0xd56591[_0xb648('0x80')](),_0x418d47);})['then'](function(_0x3e6d86){_0x1c331c[_0xb648('0x81')]=_0x3e6d86[_0xb648('0x31')];if(_0x1c331c[_0xb648('0x81')]===0x0)return[];return db[_0xb648('0x7f')]['query'](_0x537468[_0xb648('0x80')](),_0x418d47)[_0xb648('0x18')](function(_0x53b740){_0x340144=_[_0xb648('0x82')](_0x53b740,'id');_0x418d47=_[_0xb648('0x83')](_0x418d47,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e6ab2[_0xb648('0x2c')][_0xb648('0x30')]){_0x41a792[_0xb648('0x2f')][_0xb648('0x5a')](function(_0x152600){_0x13f9a6[_0xb648('0x38')]('i.'+_0x152600);});}else{_0x13f9a6[_0xb648('0x38')](_0xb648('0x78'),_0xb648('0x4d'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x84'),_0xb648('0x85'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x86'),_0xb648('0x87'));_0x13f9a6[_0xb648('0x38')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb648('0x7a'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x75'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x88'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x89'));_0x13f9a6[_0xb648('0x38')]('i.closed');_0x13f9a6[_0xb648('0x38')]('i.closedAt');_0x13f9a6[_0xb648('0x38')]('i.attach');_0x13f9a6[_0xb648('0x38')](_0xb648('0x8a'));_0x13f9a6['field'](_0xb648('0x8b'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x8c'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x8d'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x8e'));_0x13f9a6['field'](_0xb648('0x8f'));_0x13f9a6[_0xb648('0x38')]('i.substatus');_0x13f9a6[_0xb648('0x38')]('i.to');_0x13f9a6[_0xb648('0x38')](_0xb648('0x90'));_0x13f9a6['field'](_0xb648('0x91'));_0x13f9a6['field'](_0xb648('0x92'));_0x13f9a6['field'](_0xb648('0x93'),_0xb648('0x94'));_0x13f9a6['field'](_0xb648('0x95'),_0xb648('0x96'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x97'),'Contact.email');_0x13f9a6['field']('c.phone',_0xb648('0x98'));_0x13f9a6['field'](_0xb648('0x99'),_0xb648('0x9a'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x9b'),_0xb648('0x9c'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x9d'),_0xb648('0x9e'));_0x13f9a6[_0xb648('0x38')](_0xb648('0x9f'),_0xb648('0xa0'));_0x13f9a6[_0xb648('0x38')](_0xb648('0xa1'),_0xb648('0x20'));}if(_0x41a792[_0xb648('0x13')])_0x13f9a6[_0xb648('0x13')](_0x41a792['limit']);if(_0x41a792[_0xb648('0x11')])_0x13f9a6[_0xb648('0x11')](_0x41a792[_0xb648('0x11')]);return db[_0xb648('0x7f')]['query'](_0x13f9a6[_0xb648('0x80')](),_0x418d47);})[_0xb648('0x18')](function(_0x53abf8){if(_0x53abf8[_0xb648('0x31')]>0x0)_0x1fcc32[_0xb648('0x62')](_0xb648('0xa2'),_[_0xb648('0x1e')](_0x53abf8,'id'));return db['sequelize'][_0xb648('0x2c')](_0x1fcc32[_0xb648('0x80')](),_0x418d47)[_0xb648('0x18')](function(_0x51bcd8){var _0x2b663b=_[_0xb648('0xa3')](_0x51bcd8,_0xb648('0xa4'));var _0x10ed55=[];return db[_0xb648('0xa5')][_0xb648('0xa6')]({'attributes':[_0xb648('0xa7')],'raw':!![]})[_0xb648('0x18')](function(_0x557b31){var _0x101345=_0x557b31['enableEmailPreview'];_0x53abf8[_0xb648('0x5a')](function(_0x21c965){_0x10ed55[_0xb648('0x22')](updateMailInteraction(_0x21c965,_0x340144,_0x2b663b,_0x101345));});return BPromise[_0xb648('0xa8')](_0x10ed55);});});});})[_0xb648('0x18')](function(_0x169d18){_0x1c331c['rows']=_0x169d18;return _0x1c331c;})[_0xb648('0x18')](respondWithFilteredResult(_0x230749,_0x41a792))[_0xb648('0x26')](handleError(_0x230749,null));};exports[_0xb648('0xa9')]=function(_0x41e5f1,_0x39758b){var _0xe55199={'raw':![],'where':{'id':_0x41e5f1[_0xb648('0xaa')]['id']}},_0x1380c2={};_0x1380c2[_0xb648('0x2b')]=_[_0xb648('0x2d')](db[_0xb648('0x28')][_0xb648('0xab')]);_0x1380c2[_0xb648('0x2c')]=_['keys'](_0x41e5f1[_0xb648('0x2c')]);_0x1380c2[_0xb648('0x35')]=_[_0xb648('0x2e')](_0x1380c2[_0xb648('0x2b')],_0x1380c2[_0xb648('0x2c')]);_0xe55199[_0xb648('0x2f')]=_[_0xb648('0x2e')](_0x1380c2['model'],qs['fields'](_0x41e5f1[_0xb648('0x2c')]['fields']));_0xe55199[_0xb648('0x2f')]=_0xe55199[_0xb648('0x2f')]['length']?_0xe55199[_0xb648('0x2f')]:_0x1380c2[_0xb648('0x2b')];if(_0x41e5f1[_0xb648('0x2c')][_0xb648('0xac')]){_0xe55199[_0xb648('0xad')]=[{'all':!![]}];}_0xe55199=_['merge']({},_0xe55199,_0x41e5f1['options']);return db['MailInteraction'][_0xb648('0x4c')](_0xe55199)['then'](handleEntityNotFound(_0x39758b,null))[_0xb648('0x18')](respondWithResult(_0x39758b,null))[_0xb648('0x26')](handleError(_0x39758b,null));};exports[_0xb648('0xae')]=function(_0x18c96d,_0x1f0d3c){return db['MailInteraction'][_0xb648('0xae')](_0x18c96d[_0xb648('0xaf')],{})[_0xb648('0x18')](respondWithResult(_0x1f0d3c,0xc9))[_0xb648('0x26')](handleError(_0x1f0d3c,null));};exports[_0xb648('0x16')]=function(_0xa2696a,_0x39616d){if(_0xa2696a['body']['id']){delete _0xa2696a[_0xb648('0xaf')]['id'];}return db[_0xb648('0x28')][_0xb648('0x4c')]({'where':{'id':_0xa2696a[_0xb648('0xaa')]['id']}})['then'](handleEntityNotFound(_0x39616d,null))[_0xb648('0x18')](saveUpdates(_0xa2696a[_0xb648('0xaf')],null))[_0xb648('0x18')](respondWithResult(_0x39616d,null))['catch'](handleError(_0x39616d,null));};exports['destroy']=function(_0x5f1df1,_0x320b12){return db['MailInteraction'][_0xb648('0x4c')]({'where':{'id':_0x5f1df1[_0xb648('0xaa')]['id']}})[_0xb648('0x18')](handleEntityNotFound(_0x320b12,null))['then'](removeEntity(_0x320b12,null))[_0xb648('0x26')](handleError(_0x320b12,null));};exports[_0xb648('0xb0')]=function(_0x13adc2,_0x49b8b8){return db['MailInteraction'][_0xb648('0xb0')]()[_0xb648('0x18')](respondWithResult(_0x49b8b8,null))[_0xb648('0x26')](handleError(_0x49b8b8,null));};exports['addMessage']=function(_0x1c6a84,_0x44f3f2){return db['MailMessage']['find']({'where':{'id':_0x1c6a84[_0xb648('0xaa')]['id']}})['then'](handleEntityNotFound(_0x44f3f2,null))[_0xb648('0x18')](function(_0xa27a55){if(_0xa27a55){return _0xa27a55[_0xb648('0xb1')](_0x1c6a84[_0xb648('0xaf')]['ids'],_['omit'](_0x1c6a84[_0xb648('0xaf')],[_0xb648('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x44f3f2,null))[_0xb648('0x26')](handleError(_0x44f3f2,null));};exports[_0xb648('0xb3')]=function(_0x3ccdce,_0x3ac61c){var _0x38ad02={'raw':![],'where':{}};var _0x14e763={};var _0x30b9eb={'count':0x0,'rows':[]};return db[_0xb648('0x28')][_0xb648('0xa6')]({'where':{'id':_0x3ccdce[_0xb648('0xaa')]['id']}})[_0xb648('0x18')](handleEntityNotFound(_0x3ac61c,null))[_0xb648('0x18')](function(_0x4a381f){if(_0x4a381f){_0x14e763[_0xb648('0x2b')]=_['keys'](db[_0xb648('0x23')][_0xb648('0xab')]);_0x14e763[_0xb648('0x2c')]=_[_0xb648('0x2d')](_0x3ccdce[_0xb648('0x2c')]);_0x14e763[_0xb648('0x35')]=_[_0xb648('0x2e')](_0x14e763[_0xb648('0x2b')],_0x14e763[_0xb648('0x2c')]);_0x38ad02[_0xb648('0x2f')]=_[_0xb648('0x2e')](_0x14e763[_0xb648('0x2b')],qs[_0xb648('0x30')](_0x3ccdce['query'][_0xb648('0x30')]));_0x38ad02[_0xb648('0x2f')]=_0x38ad02[_0xb648('0x2f')]['length']?_0x38ad02['attributes']:_0x14e763[_0xb648('0x2b')];if(!_0x3ccdce[_0xb648('0x2c')][_0xb648('0x32')](_0xb648('0x33'))){_0x38ad02[_0xb648('0x13')]=qs['limit'](_0x3ccdce[_0xb648('0x2c')][_0xb648('0x13')]);_0x38ad02[_0xb648('0x11')]=qs['offset'](_0x3ccdce[_0xb648('0x2c')][_0xb648('0x11')]);}_0x38ad02[_0xb648('0x79')]=qs[_0xb648('0x34')](_0x3ccdce[_0xb648('0x2c')][_0xb648('0x34')]);_0x38ad02[_0xb648('0x62')]=qs[_0xb648('0x35')](_[_0xb648('0x36')](_0x3ccdce['query'],_0x14e763[_0xb648('0x35')]));_0x38ad02[_0xb648('0x62')][_0xb648('0xa4')]=_0x4a381f['id'];if(_0x3ccdce[_0xb648('0x2c')]['filter']){_0x38ad02[_0xb648('0x62')]=_[_0xb648('0x83')](_0x38ad02['where'],{'$or':_['map'](_0x38ad02[_0xb648('0x2f')],function(_0xd19aa9){var _0x48c2b9={};_0x48c2b9[_0xd19aa9]={'$like':'%'+_0x3ccdce['query'][_0xb648('0x6e')]+'%'};return _0x48c2b9;})});}if(_0x3ccdce['query'][_0xb648('0xb4')]){var _0xee87b8=_0x3ccdce['query'][_0xb648('0xb4')][_0xb648('0xb5')](',');var _0x34bb76={};_0x34bb76[_0xee87b8[0x0]]={'$gte':moment(_0xee87b8[0x1])[_0xb648('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x38ad02['where']=_[_0xb648('0x83')](_0x38ad02[_0xb648('0x62')],_0x34bb76);}_0x38ad02=_[_0xb648('0x83')]({},_0x38ad02,_0x3ccdce[_0xb648('0xb7')]);return db[_0xb648('0x23')][_0xb648('0x81')]({'where':_0x38ad02[_0xb648('0x62')]})['then'](function(_0x508681){_0x30b9eb[_0xb648('0x81')]=_0x508681;if(_0x3ccdce[_0xb648('0x2c')][_0xb648('0xac')]){_0x38ad02[_0xb648('0xad')]=[{'all':!![]}];}return db['MailMessage'][_0xb648('0xb8')](_0x38ad02);})[_0xb648('0x18')](function(_0xac6494){if(_0x3ccdce[_0xb648('0x2c')]['inlineCss']===_0xb648('0xb9')){for(var _0x2c79da=0x0;_0x2c79da<_0xac6494['length'];_0x2c79da++){_0xac6494[_0x2c79da][_0xb648('0xaf')]=juice(_0xac6494[_0x2c79da][_0xb648('0xaf')]);}}_0x30b9eb['rows']=_0xac6494;return _0x30b9eb;});}})['then'](respondWithFilteredResult(_0x3ac61c,_0x38ad02))[_0xb648('0x26')](handleError(_0x3ac61c,null));};exports[_0xb648('0xba')]=function(_0x44b6e7,_0xb79def){return db[_0xb648('0x28')][_0xb648('0x4c')]({'where':{'id':_0x44b6e7[_0xb648('0xaa')]['id']}})[_0xb648('0x18')](handleEntityNotFound(_0xb79def,null))[_0xb648('0x18')](function(_0xdbb3cd){if(_0xdbb3cd){return _0xdbb3cd[_0xb648('0xbb')](_0x44b6e7['body'][_0xb648('0xb2')],_[_0xb648('0xbc')](_0x44b6e7[_0xb648('0xaf')],['ids','id'])||{})[_0xb648('0xbd')](function(){return db[_0xb648('0x59')][_0xb648('0xb8')]({'attributes':['id',_0xb648('0x1c'),_0xb648('0x39')],'where':{'id':_0x44b6e7['body'][_0xb648('0xb2')]}});})[_0xb648('0x18')](function(_0x43a409){socket[_0xb648('0xbe')](_0xb648('0xbf'),{'id':Number(_0x44b6e7[_0xb648('0xaa')]['id']),'tags':_0x43a409||[]});return{'id':Number(_0x44b6e7['params']['id']),'tags':_0x43a409||[]};});}})[_0xb648('0x18')](respondWithResult(_0xb79def,null))[_0xb648('0x26')](handleError(_0xb79def,null));};exports['removeTags']=function(_0x1781e3,_0x19f2a1){return db[_0xb648('0x28')]['find']({'where':{'id':_0x1781e3[_0xb648('0xaa')]['id']}})[_0xb648('0x18')](handleEntityNotFound(_0x19f2a1,null))[_0xb648('0x18')](function(_0x1ddd64){if(_0x1ddd64){return _0x1ddd64[_0xb648('0xc0')](_0x1781e3[_0xb648('0x2c')]['ids']);}})['then'](respondWithStatusCode(_0x19f2a1,null))[_0xb648('0x26')](handleError(_0x19f2a1,null));};exports[_0xb648('0xc1')]=function(_0x2dee27,_0xbdd3a6){var _0x1e2f5f=moment()[_0xb648('0xc2')]()[_0xb648('0x80')]();var _0x56d653=path['join'](config['root'],_0xb648('0xc3'),'files',_0xb648('0xc4'));var _0x403a53=path[_0xb648('0xc5')](config['root'],_0xb648('0xc3'),_0xb648('0xc6'),'attachments');var _0x715666=path['join'](_0x56d653,_0x1e2f5f);var _0x3a07d0=util['format'](_0xb648('0xc7'),_0x2dee27['params']['id'],_0x1e2f5f);var _0x3c2192=path['join'](_0x56d653,_0x3a07d0);var _0x193148=[];if(_0x2dee27[_0xb648('0x2c')]['attachments']){_0x193148[_0xb648('0x22')]({'model':db[_0xb648('0xc8')],'as':_0xb648('0xc9'),'raw':!![]});}var _0x5bd6ec=[{'model':db[_0xb648('0x23')],'as':_0xb648('0xca'),'attributes':['id',_0xb648('0xaf'),_0xb648('0x3a'),'to','cc','bcc',_0xb648('0xcb'),_0xb648('0xcc')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x193148}];return db[_0xb648('0x28')][_0xb648('0x4c')]({'where':{'id':_0x2dee27['params']['id']},'include':_0x5bd6ec})[_0xb648('0x18')](handleEntityNotFound(_0xbdd3a6,null))['then'](function(_0x4c9a1c){if(_0x4c9a1c&&_0x4c9a1c[_0xb648('0xca')]){var _0x2ea94e=_0x4c9a1c[_0xb648('0xcd')]({'plain':!![]});fs[_0xb648('0xce')](_0x715666);return BPromise[_0xb648('0xcf')](_0x2ea94e[_0xb648('0xca')],function(_0x54d907,_0x48ec34){var _0x27a149={'from':_0x54d907[_0xb648('0x3a')],'to':_0x54d907['to'],'subject':_0x54d907['subject'],'html':htmlEntities[_0xb648('0xd0')](_0x54d907[_0xb648('0xaf')]),'headers':{'Date':moment(_0x54d907[_0xb648('0xcc')])[_0xb648('0xb6')](_0xb648('0xd1'))},'attachments':[]};if(_0x54d907['cc']){_0x27a149[_0xb648('0xd2')]['Cc']=_0x54d907['cc'];}if(_0x54d907['bcc']){_0x27a149[_0xb648('0xd2')][_0xb648('0xd3')]=_0x54d907[_0xb648('0xd4')];}return new BPromise(function(_0x55fbfe,_0xfeb5e9){if(_0x54d907[_0xb648('0xc9')]){for(var _0x4ef2b8=0x0;_0x4ef2b8<_0x54d907[_0xb648('0xc9')][_0xb648('0x31')];_0x4ef2b8++){var _0x1b7e47=_0x54d907['Attachments'][_0x4ef2b8];var _0x4f552d=path[_0xb648('0xc5')](_0x403a53,_0x1b7e47[_0xb648('0xd5')]);if(fs[_0xb648('0xd6')](_0x4f552d)){_0x27a149[_0xb648('0xd7')][_0xb648('0x22')]({'name':_0x1b7e47[_0xb648('0x1c')],'contentType':_0x1b7e47[_0xb648('0x2a')],'data':fs[_0xb648('0xd8')](_0x4f552d)});}}}emlformat['build'](_0x27a149,function(_0x236ab6,_0x3122a3){if(_0x236ab6)return _0xfeb5e9(_0x236ab6);fs[_0xb648('0xd9')](path[_0xb648('0xc5')](_0x715666,util[_0xb648('0xb6')](_0xb648('0xda'),_0x48ec34)),_0x3122a3);return _0x55fbfe(_0x3122a3);});});})[_0xb648('0x18')](function(){return new BPromise(function(_0x3f07ba,_0x8fc7fe){zipdir(_0x715666,{'saveTo':_0x3c2192},function(_0x417ed8,_0x3ffc5a){if(_0x417ed8)return _0x8fc7fe(_0x417ed8);return _0x3f07ba(_0x3ffc5a);});})[_0xb648('0x18')](function(){return new BPromise(function(_0x447b76,_0x34b254){rimraf(_0x715666,function(_0x1c9d43){if(_0x1c9d43)_0x34b254(_0x1c9d43);return _0x447b76();});});})['then'](function(){return _0xbdd3a6[_0xb648('0xc1')](_0x3c2192,_0x3a07d0,function(_0x31642f){if(!_0x31642f)fs[_0xb648('0xdb')](_0x3c2192);});});});}else{return _0xbdd3a6[_0xb648('0x1a')](0xc8);}})[_0xb648('0x26')](handleError(_0xbdd3a6,null));}; \ No newline at end of file +var _0x126b=['ids','getMessages','$gte','format','findAll','inlineCss','true','addTags','spread','emit','mailInteractionTags:save','removeTags','unix','join','root','tmp','server','files','attachments','Attachment','Attachments','Messages','createdAt','get','mkdirSync','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','readFileSync','build','writeFileSync','download','rimraf','zip-dir','moment','bluebird','util','lodash','squel','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','name','map','fullname','TagIds','Tags','split','push','findOne','out','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','forEach','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','MailMessage','omit'];(function(_0x5d19ce,_0x56310b){var _0x17c120=function(_0x6606d8){while(--_0x6606d8){_0x5d19ce['push'](_0x5d19ce['shift']());}};_0x17c120(++_0x56310b);}(_0x126b,0x1e1));var _0xb126=function(_0x5bda1d,_0x4cb554){_0x5bda1d=_0x5bda1d-0x0;var _0xff64d3=_0x126b[_0x5bda1d];return _0xff64d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb126('0x0'));var zipdir=require(_0xb126('0x1'));var moment=require(_0xb126('0x2'));var BPromise=require(_0xb126('0x3'));var util=require(_0xb126('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xb126('0x5'));var squel=require(_0xb126('0x6'));var juice=require(_0xb126('0x7'));var Redis=require('ioredis');var qs=require(_0xb126('0x8'));var as=require(_0xb126('0x9'));var logger=require(_0xb126('0xa'))('api');var config=require(_0xb126('0xb'));var db=require(_0xb126('0xc'))['db'];var htmlEntities=require('html-entities');config[_0xb126('0xd')]=_['defaults'](config['redis'],{'host':_0xb126('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb126('0xf'))['register'](socket);function respondWithStatusCode(_0x3ee8c2,_0x35bae7){_0x35bae7=_0x35bae7||0xcc;return function(_0x2e6525){if(_0x2e6525){return _0x3ee8c2[_0xb126('0x10')](_0x35bae7);}return _0x3ee8c2[_0xb126('0x11')](_0x35bae7)[_0xb126('0x12')]();};}function respondWithResult(_0x25e6cb,_0x32293c){_0x32293c=_0x32293c||0xc8;return function(_0x293ecf){if(_0x293ecf){return _0x25e6cb[_0xb126('0x11')](_0x32293c)[_0xb126('0x13')](_0x293ecf);}};}function respondWithFilteredResult(_0x473395,_0xad4cca){return function(_0x2b0b0d){if(_0x2b0b0d){var _0x16c88b=typeof _0xad4cca[_0xb126('0x14')]==='undefined'&&typeof _0xad4cca['limit']===_0xb126('0x15');var _0x1a24ff=_0x2b0b0d[_0xb126('0x16')];var _0x17bc04=_0x16c88b?0x0:_0xad4cca[_0xb126('0x14')];var _0x454b5e=_0x16c88b?_0x2b0b0d['count']:_0xad4cca[_0xb126('0x14')]+_0xad4cca['limit'];var _0x28d7c7;if(_0x454b5e>=_0x1a24ff){_0x454b5e=_0x1a24ff;_0x28d7c7=0xc8;}else{_0x28d7c7=0xce;}_0x473395[_0xb126('0x11')](_0x28d7c7);return _0x473395[_0xb126('0x17')](_0xb126('0x18'),_0x17bc04+'-'+_0x454b5e+'/'+_0x1a24ff)[_0xb126('0x13')](_0x2b0b0d);}return null;};}function saveUpdates(_0xc36c93){return function(_0x51ddfa){if(_0x51ddfa){return _0x51ddfa[_0xb126('0x19')](_0xc36c93)[_0xb126('0x1a')](function(_0x36e504){return _0x36e504;});}return null;};}function removeEntity(_0x8965b7){return function(_0x97fb18){if(_0x97fb18){return _0x97fb18[_0xb126('0x1b')]()['then'](function(){_0x8965b7['status'](0xcc)[_0xb126('0x12')]();});}};}function handleEntityNotFound(_0x4a9aeb){return function(_0x229909){if(!_0x229909){_0x4a9aeb['sendStatus'](0x194);}return _0x229909;};}function handleError(_0x38940e,_0xd7fa61){_0xd7fa61=_0xd7fa61||0x1f4;return function(_0x203f1c){logger['error'](_0x203f1c['stack']);if(_0x203f1c[_0xb126('0x1c')]){delete _0x203f1c[_0xb126('0x1c')];}_0x38940e[_0xb126('0x11')](_0xd7fa61)['send'](_0x203f1c);};}function getInteractionUsers(_0x302c06,_0x5a6e2b){return new BPromise(function(_0x595e1a,_0x5e5873){try{if(_0x5a6e2b[_0x302c06['id']]){_0x302c06['Users']=_[_0xb126('0x1d')](_0x5a6e2b[_0x302c06['id']],function(_0x49f9c7){return{'id':_0x49f9c7['id'],'fullname':_0x49f9c7[_0xb126('0x1e')]};});}}catch(_0x344a12){_0x5e5873(_0x344a12);}_0x595e1a(_0x302c06);});}function getInteractionTags(_0x2d643e,_0x58edfa){return new BPromise(function(_0x550a31,_0x52a16d){try{if(_0x2d643e[_0xb126('0x1f')]){_0x2d643e[_0xb126('0x20')]=[];_0x2d643e[_0xb126('0x1f')][_0xb126('0x21')](',')['forEach'](function(_0x4ce841){_0x2d643e[_0xb126('0x20')][_0xb126('0x22')](_0x58edfa[_0x4ce841]);});}delete _0x2d643e[_0xb126('0x1f')];}catch(_0x5e6bc2){_0x52a16d(_0x5e6bc2);}_0x550a31(_0x2d643e);});}function getLastMessageText(_0x26b2a2){return new BPromise(function(_0x498e62,_0x1fe489){return db['MailMessage'][_0xb126('0x23')]({'where':{'$and':[{'MailInteractionId':_0x26b2a2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb126('0x24')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb126('0x25')],'order':'-id','raw':!![]})[_0xb126('0x1a')](function(_0x383751){if(_0x383751&&_0x383751[_0xb126('0x25')]){_0x26b2a2[_0xb126('0x26')]=_[_0xb126('0x27')](_0x383751['plainBody']);}_0x498e62(_0x26b2a2);})[_0xb126('0x28')](function(_0x49e1ea){_0x1fe489(_0x49e1ea);});});}function updateMailInteraction(_0x518d4a,_0x294fcb,_0x6961c2,_0x32ff73){return new BPromise(function(_0x18fae0,_0x573aca){return getInteractionUsers(_0x518d4a,_0x6961c2)['then'](function(_0x3c1461){return getInteractionTags(_0x3c1461,_0x294fcb);})[_0xb126('0x1a')](function(_0x528ccd){if(_0x32ff73){_0x18fae0(getLastMessageText(_0x528ccd));}else{_0x18fae0(_0x528ccd);}})[_0xb126('0x28')](function(_0x1e9980){_0x573aca(_0x1e9980);});});}exports[_0xb126('0x29')]=function(_0x345145,_0x4982c2){var _0x31eec6={},_0x143774={},_0x2dc1d3={'count':0x0,'rows':[]};var _0x249a8a=_[_0xb126('0x1d')](db[_0xb126('0x2a')][_0xb126('0x2b')],function(_0x6cb62d){return{'name':_0x6cb62d[_0xb126('0x2c')],'type':_0x6cb62d[_0xb126('0x2d')][_0xb126('0x2e')]};});_0x143774[_0xb126('0x2f')]=_[_0xb126('0x1d')](_0x249a8a,_0xb126('0x1c'));_0x143774[_0xb126('0x30')]=_[_0xb126('0x31')](_0x345145[_0xb126('0x30')]);_0x143774['filters']=_[_0xb126('0x32')](_0x143774[_0xb126('0x2f')],_0x143774[_0xb126('0x30')]);_0x31eec6['attributes']=_[_0xb126('0x32')](_0x143774['model'],qs['fields'](_0x345145[_0xb126('0x30')]['fields']));_0x31eec6['attributes']=_0x31eec6[_0xb126('0x33')][_0xb126('0x34')]?_0x31eec6[_0xb126('0x33')]:_0x143774['model'];if(!_0x345145[_0xb126('0x30')][_0xb126('0x35')](_0xb126('0x36'))){_0x31eec6[_0xb126('0x37')]=qs['limit'](_0x345145[_0xb126('0x30')][_0xb126('0x37')]);_0x31eec6['offset']=qs['offset'](_0x345145[_0xb126('0x30')][_0xb126('0x14')]);}_0x31eec6[_0xb126('0x38')]=qs[_0xb126('0x39')](_0x345145[_0xb126('0x30')][_0xb126('0x39')]);_0x31eec6[_0xb126('0x3a')]=qs[_0xb126('0x3b')](_[_0xb126('0x3c')](_0x345145[_0xb126('0x30')],_0x143774[_0xb126('0x3b')]),_0x249a8a);var _0x222723=[];var _0xac387=squel[_0xb126('0x3d')]()[_0xb126('0x3e')]('id')[_0xb126('0x3e')](_0xb126('0x1c'))[_0xb126('0x3e')](_0xb126('0x3f'))[_0xb126('0x40')](_0xb126('0x41'));var _0x5ae463=squel[_0xb126('0x3d')]()[_0xb126('0x3e')]('u.id')['field'](_0xb126('0x42'))[_0xb126('0x3e')](_0xb126('0x43'))[_0xb126('0x40')](_0xb126('0x44'),'ui')[_0xb126('0x45')]('users','u','u.id\x20=\x20ui.UserId');var _0x24279b=squel['select']()[_0xb126('0x40')]('mail_interactions','i')[_0xb126('0x45')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xb126('0x46'),'o',_0xb126('0x47'))['left_join'](_0xb126('0x48'),'a','a.id\x20=\x20i.MailAccountId')['left_join'](_0xb126('0x49'),'me','me.MailInteractionId\x20=\x20i.id')[_0xb126('0x45')](_0xb126('0x4a'),'it',_0xb126('0x4b'))[_0xb126('0x45')](_0xb126('0x41'),'t',_0xb126('0x4c'));var _0x374a28=squel['expr']();var _0x386eb3=[];var _0x3eb8cd=squel[_0xb126('0x4d')]();var _0x53dfb3;if(_0x345145['query']['search']){_0x53dfb3=as['parseSearch'](_0x345145[_0xb126('0x30')][_0xb126('0x4e')]);var _0x49c510=_0x53dfb3[_0xb126('0x4f')];for(var _0x472c22=0x0;_0x472c22<_0x53dfb3[_0xb126('0x50')][_0xb126('0x34')];_0x472c22++){var _0x5f048d=_0x53dfb3['conditions'][_0x472c22];var _0x2654bd='i';var _0x41cca3=_[_0xb126('0x51')](_0x249a8a,[_0xb126('0x1c'),_0x5f048d[_0xb126('0x3e')]]);if(!_0x41cca3){switch(_0x5f048d['field']){case _0xb126('0x52'):if(_0x5f048d['value']==0x1){_0x24279b[_0xb126('0x53')]('`'+_0x5f048d[_0xb126('0x3e')]+'`\x20=\x200');}else{_0x24279b[_0xb126('0x53')]('`'+_0x5f048d[_0xb126('0x3e')]+_0xb126('0x54'));}break;case _0xb126('0x55'):if(_0x5f048d[_0xb126('0x56')]===_0xb126('0x57')){if(_0x5f048d[_0xb126('0x58')][_0xb126('0x21')]('\x20')[_0xb126('0x34')]>0x1){_0x374a28[_0x49c510]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb126('0x59')](_0x5f048d[_0xb126('0x58')]),null);}else{var _0x331d67='%'+_0x5f048d[_0xb126('0x58')]+'%';_0x374a28[_0x49c510](_0xb126('0x5a'),_0x331d67,_0x331d67,_0x331d67);}}else{_0x41cca3=_[_0xb126('0x51')](_0x249a8a,['name',_0xb126('0x5b')]);_0x5f048d[_0xb126('0x3e')]=_0xb126('0x5b');_0x5642bd=as[_0xb126('0x5c')](_0x2654bd,_0x41cca3['type'],_0x5f048d);_0x374a28[_0x49c510](_0x5642bd[_0xb126('0x5d')],_0x5642bd['value']['start'],_0x5642bd[_0xb126('0x58')][_0xb126('0x12')]);}break;case _0xb126('0x5e'):var _0x3e2ade=_0x5f048d[_0xb126('0x58')][_0xb126('0x21')](',')[_0xb126('0x1d')](function(_0x1558a1){return Number(_0x1558a1);});_0x3e2ade['forEach'](function(_0x5ee678){_0x3eb8cd['or'](_0xb126('0x5f'),'%,'+_0x5ee678+',%');});_0x386eb3=_[_0xb126('0x60')](_0x386eb3,_0x3e2ade);break;case _0xb126('0x61'):if(_0x5f048d[_0xb126('0x56')]==='$substring'){_0x374a28[_0x49c510](_0xb126('0x62'),'%'+_0x5f048d[_0xb126('0x58')]+'%',null);}else{_0x41cca3=_[_0xb126('0x51')](_0x249a8a,[_0xb126('0x1c'),_0xb126('0x63')]);_0x5f048d[_0xb126('0x3e')]=_0xb126('0x63');_0x5642bd=as[_0xb126('0x5c')](_0x2654bd,_0x41cca3[_0xb126('0x2d')],_0x5f048d);_0x374a28[_0x49c510](_0x5642bd[_0xb126('0x5d')],_0x5642bd[_0xb126('0x58')]['start'],_0x5642bd['value']['end']);}break;case _0xb126('0x25'):_0x5642bd=as[_0xb126('0x5c')]('me',null,_0x5f048d);_0x374a28[_0x49c510](_0x5642bd[_0xb126('0x5d')],_0x5642bd[_0xb126('0x58')][_0xb126('0x64')],_0x5642bd['value']['end']);break;}}else{var _0x5642bd=as[_0xb126('0x5c')](_0x2654bd,_0x41cca3[_0xb126('0x2d')],_0x5f048d);_0x374a28[_0x49c510](_0x5642bd['text'],_0x5642bd['value']['start'],_0x5642bd[_0xb126('0x58')][_0xb126('0x12')]);}}}else{var _0x5ec604=_(_0x345145[_0xb126('0x30')])[_0xb126('0x31')]()[_0xb126('0x1d')](function(_0xf3b735){return _[_0xb126('0x65')](_0x249a8a,['name',_0xf3b735])?_0xf3b735:undefined;})[_0xb126('0x66')]()[_0xb126('0x58')]();if(!_[_0xb126('0x67')](_0x5ec604)){_0x5ec604[_0xb126('0x68')](function(_0x2ccf57){if(_0x2ccf57===_0xb126('0x69')){_0x24279b['where'](_0xb126('0x6a'),[][_0xb126('0x6b')](_0x345145[_0xb126('0x30')][_0x2ccf57]));}else if(_0x2ccf57==='createdAt'){var _0x51735b=JSON[_0xb126('0x6c')](_0x345145[_0xb126('0x30')][_0x2ccf57])['$gte'];var _0x4a7d1f=JSON[_0xb126('0x6c')](_0x345145[_0xb126('0x30')][_0x2ccf57])[_0xb126('0x6d')];_0x24279b[_0xb126('0x3a')](_0xb126('0x6e'),_0x51735b,_0x4a7d1f);}else{if(_0x345145[_0xb126('0x30')][_0x2ccf57]==='null'){_0x24279b[_0xb126('0x3a')]('i.'+_0x2ccf57+_0xb126('0x6f'));}else{_0x24279b[_0xb126('0x3a')]('i.'+_0x2ccf57+_0xb126('0x70'),_0x345145[_0xb126('0x30')][_0x2ccf57]);}}});}if(_0x345145['query'][_0xb126('0x71')]){if(_0x345145[_0xb126('0x30')][_0xb126('0x71')]==0x1){_0x24279b[_0xb126('0x53')](_0xb126('0x72'));}else{_0x24279b[_0xb126('0x53')]('`unreadMessages`\x20>\x200');}}if(_0x345145[_0xb126('0x30')]['tag']){_0x386eb3=_[_0xb126('0x73')](_0x345145[_0xb126('0x30')]['tag'])?_0x345145[_0xb126('0x30')][_0xb126('0x74')]:new Array(_0x345145[_0xb126('0x30')]['tag']);_0x386eb3['forEach'](function(_0x3671c6){_0x3eb8cd['or'](_0xb126('0x5f'),'%,'+_0x3671c6+',%');});}if(_0x345145[_0xb126('0x30')][_0xb126('0x75')]){var _0x2f8678=_0x345145[_0xb126('0x30')][_0xb126('0x75')][_0xb126('0x76')]('\x5c','\x5c\x5c')[_0xb126('0x76')](/'/g,'\x27\x27');if(qs[_0xb126('0x77')](_0x2f8678)){_0x374a28['or'](_0xb126('0x78'),_0x2f8678+'%');}else if(qs[_0xb126('0x79')](_0x2f8678)){_0x374a28['or'](_0xb126('0x7a'),_0x2f8678+'%');}else{_0x374a28['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb126('0x59')](_0x2f8678))['or'](_0xb126('0x7b'),qs['getFullTextValue'](_0x2f8678));}}}_0x24279b[_0xb126('0x3a')](_0x374a28);_0x24279b['group'](_0xb126('0x7c'));var _0x36c78d={'type':db[_0xb126('0x7d')][_0xb126('0x7e')]['SELECT'],'raw':!![]};var _0xe46ddd=_0x24279b['clone']();_0xe46ddd['field'](_0xb126('0x7c'));_0xe46ddd[_0xb126('0x3e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb126('0x52'));if(_0x31eec6[_0xb126('0x38')]){_0x31eec6['order']['forEach'](function(_0x2e7e42){var _0x4ebf63=_0x2e7e42[0x0]===_0xb126('0x7f')?_0x2e7e42[0x0]:'i.'+_0x2e7e42[0x0];_0x24279b[_0xb126('0x38')](_0x4ebf63,_0x2e7e42[0x1]===_0xb126('0x80')?![]:!![]);});}if(!_[_0xb126('0x67')](_0x386eb3)){_0x24279b[_0xb126('0x53')](_0x3eb8cd);_0xe46ddd['where'](_0xb126('0x81'),_0x386eb3);}BPromise[_0xb126('0x82')]()[_0xb126('0x1a')](function(){if(!_0x53dfb3){if(_0x345145['query'][_0xb126('0x69')])return;_0xe46ddd['where'](_0xb126('0x83'));_0x24279b[_0xb126('0x3a')](_0xb126('0x83'));return;}if(_0x345145[_0xb126('0x84')][_0xb126('0x85')]!==_0xb126('0x86'))return;return _0x345145[_0xb126('0x84')][_0xb126('0x87')]({'attributes':['id'],'raw':!![]})[_0xb126('0x1a')](function(_0x71674d){if(_[_0xb126('0x67')](_0x71674d)){_0xe46ddd[_0xb126('0x3a')](_0xb126('0x88'));_0x24279b[_0xb126('0x3a')](_0xb126('0x88'));}else{_0xe46ddd[_0xb126('0x3a')](_0xb126('0x6a'),_[_0xb126('0x1d')](_0x71674d,'id'));_0x24279b[_0xb126('0x3a')](_0xb126('0x6a'),_['map'](_0x71674d,'id'));}});})[_0xb126('0x1a')](function(){if(_0x345145['user'][_0xb126('0x85')]==='agent'&&!_0x53dfb3&&!_0x345145['query'][_0xb126('0x69')])return[];return db['sequelize'][_0xb126('0x30')](_0xe46ddd['toString'](),_0x36c78d);})[_0xb126('0x1a')](function(_0xfcbc24){_0x2dc1d3[_0xb126('0x16')]=_0xfcbc24[_0xb126('0x34')];if(_0x2dc1d3[_0xb126('0x16')]===0x0)return[];return db[_0xb126('0x89')][_0xb126('0x30')](_0xac387[_0xb126('0x8a')](),_0x36c78d)[_0xb126('0x1a')](function(_0x2983a1){_0x222723=_['keyBy'](_0x2983a1,'id');_0x36c78d=_[_0xb126('0x8b')](_0x36c78d,{'model':db[_0xb126('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x345145[_0xb126('0x30')][_0xb126('0x8c')]){_0x31eec6[_0xb126('0x33')][_0xb126('0x68')](function(_0x99708f){_0x24279b[_0xb126('0x3e')]('i.'+_0x99708f);});}else{_0x24279b['field'](_0xb126('0x8d'),_0xb126('0x52'));_0x24279b[_0xb126('0x3e')](_0xb126('0x8e'),_0xb126('0x8f'));_0x24279b[_0xb126('0x3e')](_0xb126('0x90'),'Account.mandatoryDisposition');_0x24279b[_0xb126('0x3e')](_0xb126('0x91'),'contactName');_0x24279b[_0xb126('0x3e')](_0xb126('0x7c'));_0x24279b['field'](_0xb126('0x92'));_0x24279b[_0xb126('0x3e')](_0xb126('0x93'));_0x24279b[_0xb126('0x3e')](_0xb126('0x94'));_0x24279b['field']('i.closedAt');_0x24279b[_0xb126('0x3e')](_0xb126('0x95'));_0x24279b[_0xb126('0x3e')](_0xb126('0x96'));_0x24279b[_0xb126('0x3e')](_0xb126('0x97'));_0x24279b[_0xb126('0x3e')](_0xb126('0x98'));_0x24279b['field']('i.disposition');_0x24279b['field'](_0xb126('0x99'));_0x24279b[_0xb126('0x3e')](_0xb126('0x9a'));_0x24279b[_0xb126('0x3e')](_0xb126('0x9b'));_0x24279b[_0xb126('0x3e')](_0xb126('0x9c'));_0x24279b[_0xb126('0x3e')]('i.ContactId');_0x24279b[_0xb126('0x3e')](_0xb126('0x9d'));_0x24279b[_0xb126('0x3e')]('i.UserId');_0x24279b[_0xb126('0x3e')](_0xb126('0x9e'),_0xb126('0x9f'));_0x24279b[_0xb126('0x3e')](_0xb126('0xa0'),'Contact.lastName');_0x24279b[_0xb126('0x3e')]('c.email',_0xb126('0xa1'));_0x24279b[_0xb126('0x3e')](_0xb126('0xa2'),_0xb126('0xa3'));_0x24279b[_0xb126('0x3e')](_0xb126('0xa4'),_0xb126('0xa5'));_0x24279b[_0xb126('0x3e')](_0xb126('0xa6'),_0xb126('0xa7'));_0x24279b[_0xb126('0x3e')](_0xb126('0xa8'),_0xb126('0xa9'));_0x24279b[_0xb126('0x3e')]('o.internal',_0xb126('0xaa'));_0x24279b[_0xb126('0x3e')](_0xb126('0xab'),_0xb126('0x1f'));}if(_0x31eec6['limit'])_0x24279b[_0xb126('0x37')](_0x31eec6[_0xb126('0x37')]);if(_0x31eec6[_0xb126('0x14')])_0x24279b['offset'](_0x31eec6[_0xb126('0x14')]);return db['sequelize'][_0xb126('0x30')](_0x24279b[_0xb126('0x8a')](),_0x36c78d);})[_0xb126('0x1a')](function(_0xacca5b){if(_0xacca5b[_0xb126('0x34')]>0x0)_0x5ae463['where']('ui.MailInteractionId\x20IN\x20?',_[_0xb126('0x1d')](_0xacca5b,'id'));return db[_0xb126('0x89')]['query'](_0x5ae463[_0xb126('0x8a')](),_0x36c78d)[_0xb126('0x1a')](function(_0x4eba78){var _0x7db9ca=_['groupBy'](_0x4eba78,_0xb126('0xac'));var _0x19e3e9=[];return db[_0xb126('0xad')][_0xb126('0x23')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xb126('0x1a')](function(_0x4e6534){var _0x270523=_0x4e6534[_0xb126('0xae')];_0xacca5b[_0xb126('0x68')](function(_0x142d7b){_0x19e3e9['push'](updateMailInteraction(_0x142d7b,_0x222723,_0x7db9ca,_0x270523));});return BPromise[_0xb126('0xaf')](_0x19e3e9);});});});})[_0xb126('0x1a')](function(_0x50b5b0){_0x2dc1d3[_0xb126('0xb0')]=_0x50b5b0;return _0x2dc1d3;})['then'](respondWithFilteredResult(_0x4982c2,_0x31eec6))[_0xb126('0x28')](handleError(_0x4982c2,null));};exports[_0xb126('0xb1')]=function(_0xe5a9b6,_0x46334a){var _0x7f4622={'raw':![],'where':{'id':_0xe5a9b6[_0xb126('0xb2')]['id']}},_0x3558a5={};_0x3558a5[_0xb126('0x2f')]=_[_0xb126('0x31')](db['MailInteraction'][_0xb126('0x2b')]);_0x3558a5[_0xb126('0x30')]=_['keys'](_0xe5a9b6['query']);_0x3558a5[_0xb126('0x3b')]=_['intersection'](_0x3558a5[_0xb126('0x2f')],_0x3558a5[_0xb126('0x30')]);_0x7f4622[_0xb126('0x33')]=_[_0xb126('0x32')](_0x3558a5['model'],qs[_0xb126('0x8c')](_0xe5a9b6[_0xb126('0x30')][_0xb126('0x8c')]));_0x7f4622['attributes']=_0x7f4622[_0xb126('0x33')][_0xb126('0x34')]?_0x7f4622[_0xb126('0x33')]:_0x3558a5['model'];if(_0xe5a9b6[_0xb126('0x30')][_0xb126('0xb3')]){_0x7f4622[_0xb126('0xb4')]=[{'all':!![]}];}_0x7f4622=_[_0xb126('0x8b')]({},_0x7f4622,_0xe5a9b6[_0xb126('0xb5')]);return db['MailInteraction'][_0xb126('0x51')](_0x7f4622)['then'](handleEntityNotFound(_0x46334a,null))['then'](respondWithResult(_0x46334a,null))[_0xb126('0x28')](handleError(_0x46334a,null));};exports['create']=function(_0x14c8d5,_0x4dd725){return db['MailInteraction'][_0xb126('0xb6')](_0x14c8d5[_0xb126('0xb7')],{})['then'](respondWithResult(_0x4dd725,0xc9))['catch'](handleError(_0x4dd725,null));};exports['update']=function(_0x433cc2,_0xf31e11){if(_0x433cc2[_0xb126('0xb7')]['id']){delete _0x433cc2[_0xb126('0xb7')]['id'];}return db[_0xb126('0x2a')][_0xb126('0x51')]({'where':{'id':_0x433cc2[_0xb126('0xb2')]['id']}})[_0xb126('0x1a')](handleEntityNotFound(_0xf31e11,null))['then'](saveUpdates(_0x433cc2[_0xb126('0xb7')],null))['then'](respondWithResult(_0xf31e11,null))[_0xb126('0x28')](handleError(_0xf31e11,null));};exports[_0xb126('0x1b')]=function(_0x4b2f6e,_0x5cbab7){return db[_0xb126('0x2a')]['find']({'where':{'id':_0x4b2f6e['params']['id']}})['then'](handleEntityNotFound(_0x5cbab7,null))[_0xb126('0x1a')](removeEntity(_0x5cbab7,null))[_0xb126('0x28')](handleError(_0x5cbab7,null));};exports[_0xb126('0xb8')]=function(_0x4fbea4,_0x5936df){return db['MailInteraction'][_0xb126('0xb8')]()[_0xb126('0x1a')](respondWithResult(_0x5936df,null))[_0xb126('0x28')](handleError(_0x5936df,null));};exports[_0xb126('0xb9')]=function(_0x33360a,_0x3580ba){return db[_0xb126('0xba')][_0xb126('0x51')]({'where':{'id':_0x33360a[_0xb126('0xb2')]['id']}})['then'](handleEntityNotFound(_0x3580ba,null))[_0xb126('0x1a')](function(_0x1f3418){if(_0x1f3418){return _0x1f3418[_0xb126('0xb9')](_0x33360a[_0xb126('0xb7')]['ids'],_[_0xb126('0xbb')](_0x33360a[_0xb126('0xb7')],[_0xb126('0xbc'),'id'])||{});}})[_0xb126('0x1a')](respondWithResult(_0x3580ba,null))[_0xb126('0x28')](handleError(_0x3580ba,null));};exports[_0xb126('0xbd')]=function(_0x2f9d3d,_0x4dfe94){var _0x27fab9={'raw':![],'where':{}};var _0x39952d={};var _0xcefb97={'count':0x0,'rows':[]};return db[_0xb126('0x2a')][_0xb126('0x23')]({'where':{'id':_0x2f9d3d[_0xb126('0xb2')]['id']}})[_0xb126('0x1a')](handleEntityNotFound(_0x4dfe94,null))['then'](function(_0x34cc9d){if(_0x34cc9d){_0x39952d[_0xb126('0x2f')]=_['keys'](db[_0xb126('0xba')][_0xb126('0x2b')]);_0x39952d['query']=_[_0xb126('0x31')](_0x2f9d3d[_0xb126('0x30')]);_0x39952d[_0xb126('0x3b')]=_[_0xb126('0x32')](_0x39952d[_0xb126('0x2f')],_0x39952d[_0xb126('0x30')]);_0x27fab9[_0xb126('0x33')]=_[_0xb126('0x32')](_0x39952d[_0xb126('0x2f')],qs[_0xb126('0x8c')](_0x2f9d3d['query'][_0xb126('0x8c')]));_0x27fab9[_0xb126('0x33')]=_0x27fab9[_0xb126('0x33')][_0xb126('0x34')]?_0x27fab9[_0xb126('0x33')]:_0x39952d[_0xb126('0x2f')];if(!_0x2f9d3d[_0xb126('0x30')][_0xb126('0x35')](_0xb126('0x36'))){_0x27fab9[_0xb126('0x37')]=qs[_0xb126('0x37')](_0x2f9d3d['query'][_0xb126('0x37')]);_0x27fab9['offset']=qs[_0xb126('0x14')](_0x2f9d3d['query'][_0xb126('0x14')]);}_0x27fab9[_0xb126('0x38')]=qs['sort'](_0x2f9d3d[_0xb126('0x30')][_0xb126('0x39')]);_0x27fab9[_0xb126('0x3a')]=qs['filters'](_[_0xb126('0x3c')](_0x2f9d3d[_0xb126('0x30')],_0x39952d[_0xb126('0x3b')]));_0x27fab9[_0xb126('0x3a')][_0xb126('0xac')]=_0x34cc9d['id'];if(_0x2f9d3d[_0xb126('0x30')][_0xb126('0x75')]){_0x27fab9[_0xb126('0x3a')]=_['merge'](_0x27fab9[_0xb126('0x3a')],{'$or':_[_0xb126('0x1d')](_0x27fab9['attributes'],function(_0x51fe94){var _0x3183f1={};_0x3183f1[_0x51fe94]={'$like':'%'+_0x2f9d3d['query'][_0xb126('0x75')]+'%'};return _0x3183f1;})});}if(_0x2f9d3d[_0xb126('0x30')][_0xb126('0xbe')]){var _0x426141=_0x2f9d3d[_0xb126('0x30')][_0xb126('0xbe')][_0xb126('0x21')](',');var _0x29c903={};_0x29c903[_0x426141[0x0]]={'$gte':moment(_0x426141[0x1])[_0xb126('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x27fab9[_0xb126('0x3a')]=_['merge'](_0x27fab9[_0xb126('0x3a')],_0x29c903);}_0x27fab9=_[_0xb126('0x8b')]({},_0x27fab9,_0x2f9d3d['options']);return db['MailMessage'][_0xb126('0x16')]({'where':_0x27fab9[_0xb126('0x3a')]})[_0xb126('0x1a')](function(_0x190290){_0xcefb97[_0xb126('0x16')]=_0x190290;if(_0x2f9d3d['query'][_0xb126('0xb3')]){_0x27fab9[_0xb126('0xb4')]=[{'all':!![]}];}return db[_0xb126('0xba')][_0xb126('0xc0')](_0x27fab9);})['then'](function(_0xe00d9){if(_0x2f9d3d['query'][_0xb126('0xc1')]===_0xb126('0xc2')){for(var _0xff67e5=0x0;_0xff67e5<_0xe00d9[_0xb126('0x34')];_0xff67e5++){_0xe00d9[_0xff67e5][_0xb126('0xb7')]=juice(_0xe00d9[_0xff67e5]['body']);}}_0xcefb97[_0xb126('0xb0')]=_0xe00d9;return _0xcefb97;});}})[_0xb126('0x1a')](respondWithFilteredResult(_0x4dfe94,_0x27fab9))['catch'](handleError(_0x4dfe94,null));};exports[_0xb126('0xc3')]=function(_0xe32d6d,_0x2c7415){return db['MailInteraction'][_0xb126('0x51')]({'where':{'id':_0xe32d6d[_0xb126('0xb2')]['id']}})[_0xb126('0x1a')](handleEntityNotFound(_0x2c7415,null))['then'](function(_0x1a2706){if(_0x1a2706){return _0x1a2706['setTags'](_0xe32d6d[_0xb126('0xb7')][_0xb126('0xbc')],_[_0xb126('0xbb')](_0xe32d6d['body'],[_0xb126('0xbc'),'id'])||{})[_0xb126('0xc4')](function(){return db[_0xb126('0x5e')][_0xb126('0xc0')]({'attributes':['id',_0xb126('0x1c'),'color'],'where':{'id':_0xe32d6d[_0xb126('0xb7')]['ids']}});})[_0xb126('0x1a')](function(_0x36b967){socket[_0xb126('0xc5')](_0xb126('0xc6'),{'id':Number(_0xe32d6d[_0xb126('0xb2')]['id']),'tags':_0x36b967||[]});return{'id':Number(_0xe32d6d[_0xb126('0xb2')]['id']),'tags':_0x36b967||[]};});}})[_0xb126('0x1a')](respondWithResult(_0x2c7415,null))[_0xb126('0x28')](handleError(_0x2c7415,null));};exports['removeTags']=function(_0x24e930,_0x2a7f46){return db[_0xb126('0x2a')][_0xb126('0x51')]({'where':{'id':_0x24e930[_0xb126('0xb2')]['id']}})['then'](handleEntityNotFound(_0x2a7f46,null))[_0xb126('0x1a')](function(_0x2c9eb3){if(_0x2c9eb3){return _0x2c9eb3[_0xb126('0xc7')](_0x24e930['query'][_0xb126('0xbc')]);}})[_0xb126('0x1a')](respondWithStatusCode(_0x2a7f46,null))[_0xb126('0x28')](handleError(_0x2a7f46,null));};exports['download']=function(_0x1e1a1e,_0x505d48){var _0x523141=moment()[_0xb126('0xc8')]()[_0xb126('0x8a')]();var _0xd7c9e2=path[_0xb126('0xc9')](config[_0xb126('0xca')],'server','files',_0xb126('0xcb'));var _0x1ac949=path[_0xb126('0xc9')](config['root'],_0xb126('0xcc'),_0xb126('0xcd'),_0xb126('0xce'));var _0x1c111b=path[_0xb126('0xc9')](_0xd7c9e2,_0x523141);var _0x1f6148=util['format']('transcript-%d-%s.zip',_0x1e1a1e[_0xb126('0xb2')]['id'],_0x523141);var _0x31c537=path[_0xb126('0xc9')](_0xd7c9e2,_0x1f6148);var _0x190eb2=[];if(_0x1e1a1e[_0xb126('0x30')][_0xb126('0xce')]){_0x190eb2[_0xb126('0x22')]({'model':db[_0xb126('0xcf')],'as':_0xb126('0xd0'),'raw':!![]});}var _0x5a46ae=[{'model':db[_0xb126('0xba')],'as':_0xb126('0xd1'),'attributes':['id',_0xb126('0xb7'),_0xb126('0x40'),'to','cc','bcc','subject',_0xb126('0xd2')],'where':{'secret':![]},'order':qs[_0xb126('0x39')]('id'),'include':_0x190eb2}];return db[_0xb126('0x2a')][_0xb126('0x51')]({'where':{'id':_0x1e1a1e[_0xb126('0xb2')]['id']},'include':_0x5a46ae})[_0xb126('0x1a')](handleEntityNotFound(_0x505d48,null))[_0xb126('0x1a')](function(_0x66027d){if(_0x66027d&&_0x66027d[_0xb126('0xd1')]){var _0x309d65=_0x66027d[_0xb126('0xd3')]({'plain':!![]});fs[_0xb126('0xd4')](_0x1c111b);return BPromise['each'](_0x309d65['Messages'],function(_0x4e2ca2,_0x39223f){var _0x4e49b1={'from':_0x4e2ca2[_0xb126('0x40')],'to':_0x4e2ca2['to'],'subject':_0x4e2ca2['subject'],'html':htmlEntities[_0xb126('0xd5')](_0x4e2ca2[_0xb126('0xb7')]),'headers':{'Date':moment(_0x4e2ca2[_0xb126('0xd2')])[_0xb126('0xbf')](_0xb126('0xd6'))},'attachments':[]};if(_0x4e2ca2['cc']){_0x4e49b1[_0xb126('0xd7')]['Cc']=_0x4e2ca2['cc'];}if(_0x4e2ca2[_0xb126('0xd8')]){_0x4e49b1['headers'][_0xb126('0xd9')]=_0x4e2ca2[_0xb126('0xd8')];}return new BPromise(function(_0xf49fcc,_0x232a88){if(_0x4e2ca2['Attachments']){for(var _0x50adf8=0x0;_0x50adf8<_0x4e2ca2[_0xb126('0xd0')][_0xb126('0x34')];_0x50adf8++){var _0x4d87b8=_0x4e2ca2[_0xb126('0xd0')][_0x50adf8];var _0x52a068=path[_0xb126('0xc9')](_0x1ac949,_0x4d87b8['basename']);if(fs[_0xb126('0xda')](_0x52a068)){_0x4e49b1[_0xb126('0xce')][_0xb126('0x22')]({'name':_0x4d87b8[_0xb126('0x1c')],'contentType':_0x4d87b8[_0xb126('0x2d')],'data':fs[_0xb126('0xdb')](_0x52a068)});}}}emlformat[_0xb126('0xdc')](_0x4e49b1,function(_0x170fe4,_0x369c9f){if(_0x170fe4)return _0x232a88(_0x170fe4);fs[_0xb126('0xdd')](path[_0xb126('0xc9')](_0x1c111b,util[_0xb126('0xbf')]('message%d.eml',_0x39223f)),_0x369c9f);return _0xf49fcc(_0x369c9f);});});})[_0xb126('0x1a')](function(){return new BPromise(function(_0x5e5446,_0x139113){zipdir(_0x1c111b,{'saveTo':_0x31c537},function(_0x2344ee,_0x62160){if(_0x2344ee)return _0x139113(_0x2344ee);return _0x5e5446(_0x62160);});})[_0xb126('0x1a')](function(){return new BPromise(function(_0x177fc3,_0x15e5ab){rimraf(_0x1c111b,function(_0x51fc14){if(_0x51fc14)_0x15e5ab(_0x51fc14);return _0x177fc3();});});})[_0xb126('0x1a')](function(){return _0x505d48[_0xb126('0xde')](_0x31c537,_0x1f6148,function(_0x3dcceb){if(!_0x3dcceb)fs['unlinkSync'](_0x31c537);});});});}else{return _0x505d48[_0xb126('0x10')](0xc8);}})[_0xb126('0x28')](handleError(_0x505d48,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b816507..e5728a5 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 _0x731a=['then','unreadMessages','length','emit','catch','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','findAll'];(function(_0x3a2dfb,_0x18cd8a){var _0x5bd842=function(_0x443997){while(--_0x443997){_0x3a2dfb['push'](_0x3a2dfb['shift']());}};_0x5bd842(++_0x18cd8a);}(_0x731a,0xa6));var _0xa731=function(_0x4def83,_0x5277f9){_0x4def83=_0x4def83-0x0;var _0xa4c6bf=_0x731a[_0x4def83];return _0xa4c6bf;};'use strict';var EventEmitter=require(_0xa731('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xa731('0x1'))['db'][_0xa731('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa731('0x3')](0x0);var events={'afterCreate':_0xa731('0x4'),'afterUpdate':_0xa731('0x5'),'afterDestroy':_0xa731('0x6')};function emitEvent(_0x1b5808){return function(_0x298bd4,_0x39c29a,_0x4c6e20){_0x298bd4[_0xa731('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5d5329){_0x298bd4[_0xa731('0x8')]('Users',_0x5d5329['map'](function(_0x144054){return{'id':_0x144054['id']};}));return MailMessage[_0xa731('0x9')]({'where':{'MailInteractionId':_0x298bd4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa731('0xa')](function(_0x4831b8){_0x298bd4[_0xa731('0x8')](_0xa731('0xb'),_0x4831b8[_0xa731('0xc')]);MailInteractionEvents[_0xa731('0xd')](_0x1b5808+':'+_0x298bd4['id'],_0x298bd4);MailInteractionEvents[_0xa731('0xd')](_0x1b5808,_0x298bd4);_0x4c6e20(null);})[_0xa731('0xe')](_0x4c6e20(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa731('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xb365=['update','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners','save'];(function(_0x2ed311,_0x47a90f){var _0x520e64=function(_0x48eaad){while(--_0x48eaad){_0x2ed311['push'](_0x2ed311['shift']());}};_0x520e64(++_0x47a90f);}(_0xb365,0xbb));var _0x5b36=function(_0x212363,_0x296f6f){_0x212363=_0x212363-0x0;var _0x5272a8=_0xb365[_0x212363];return _0x5272a8;};'use strict';var EventEmitter=require(_0x5b36('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x5b36('0x1')];var MailMessage=require(_0x5b36('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5b36('0x3')](0x0);var events={'afterCreate':_0x5b36('0x4'),'afterUpdate':_0x5b36('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4fee8d){return function(_0x189dd,_0x16253f,_0x308c14){_0x189dd[_0x5b36('0x6')]({'attributes':['id'],'raw':!![]})[_0x5b36('0x7')](function(_0x40a947){_0x189dd[_0x5b36('0x8')]('Users',_0x40a947['map'](function(_0x5e89be){return{'id':_0x5e89be['id']};}));return MailMessage[_0x5b36('0x9')]({'where':{'MailInteractionId':_0x189dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5b36('0x7')](function(_0x236b6e){_0x189dd[_0x5b36('0x8')](_0x5b36('0xa'),_0x236b6e[_0x5b36('0xb')]);MailInteractionEvents[_0x5b36('0xc')](_0x4fee8d+':'+_0x189dd['id'],_0x189dd);MailInteractionEvents['emit'](_0x4fee8d,_0x189dd);_0x308c14(null);})[_0x5b36('0xd')](_0x308c14(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x5b36('0xe')](e,emitEvent(event));}}module[_0x5b36('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 090c795..3f3c2cc 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 _0xcf3e=['path','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','then','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x315f4c,_0xa9b324){var _0x8e2ba6=function(_0x2b4f1b){while(--_0x2b4f1b){_0x315f4c['push'](_0x315f4c['shift']());}};_0x8e2ba6(++_0xa9b324);}(_0xcf3e,0x69));var _0xecf3=function(_0x329812,_0x5b57a3){_0x329812=_0x329812-0x0;var _0x3073be=_0xcf3e[_0x329812];return _0x3073be;};'use strict';var _=require(_0xecf3('0x0'));var util=require(_0xecf3('0x1'));var logger=require(_0xecf3('0x2'))(_0xecf3('0x3'));var moment=require(_0xecf3('0x4'));var BPromise=require(_0xecf3('0x5'));var rp=require(_0xecf3('0x6'));var fs=require('fs');var path=require(_0xecf3('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xecf3('0x8'));module[_0xecf3('0x9')]=function(_0x26fb2c,_0x2758cc){return _0x26fb2c[_0xecf3('0xa')](_0xecf3('0xb'),attributes,{'tableName':_0xecf3('0xc'),'paranoid':![],'indexes':[{'name':_0xecf3('0xd'),'fields':[_0xecf3('0xe'),'to'],'type':_0xecf3('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59ac4a,_0x63145e,_0x87787d){if(_0x59ac4a[_0xecf3('0x10')]){_0x59ac4a[_0xecf3('0x11')]=moment()[_0xecf3('0x12')](_0xecf3('0x13'));}if(_0x59ac4a['closed']){_0x59ac4a[_0xecf3('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x87787d(null,_0x63145e);},'beforeUpdate':function(_0x32daa4,_0x194a67,_0x49dd96){if(_0x32daa4['changed']('substatus')){_0x32daa4[_0xecf3('0x11')]=_0x32daa4[_0xecf3('0x10')]?moment()[_0xecf3('0x12')](_0xecf3('0x13')):null;}if(_0x32daa4[_0xecf3('0x15')](_0xecf3('0x16'))){_0x32daa4[_0xecf3('0x14')]=moment()[_0xecf3('0x12')](_0xecf3('0x13'));_0x32daa4[_0xecf3('0x10')]=null;_0x32daa4[_0xecf3('0x11')]=null;}_0x49dd96(null,_0x32daa4);},'afterUpdate':function(_0x54def7,_0xf57c3e,_0x3e46bd){var _0x51b29e=_0x26fb2c[_0xecf3('0x17')];var _0x4302d6=_0x54def7[_0xecf3('0x18')]({'plain':!![]});if(_0x4302d6[_0xecf3('0x16')]){return _0x51b29e[_0xecf3('0x19')][_0xecf3('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x4302d6['id']}})[_0xecf3('0x1b')](function(){_0x3e46bd();})['catch'](function(_0x334dc9){_0x3e46bd(_0x334dc9);});}else{_0x3e46bd();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5bf0=['mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','format','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','rimraf','./mailInteraction.attributes','exports','define'];(function(_0x316364,_0x13614a){var _0x4dbf5f=function(_0x50756a){while(--_0x50756a){_0x316364['push'](_0x316364['shift']());}};_0x4dbf5f(++_0x13614a);}(_0x5bf0,0x171));var _0x05bf=function(_0x374270,_0xfbe456){_0x374270=_0x374270-0x0;var _0x2e20dd=_0x5bf0[_0x374270];return _0x2e20dd;};'use strict';var _=require('lodash');var util=require(_0x05bf('0x0'));var logger=require(_0x05bf('0x1'))(_0x05bf('0x2'));var moment=require('moment');var BPromise=require(_0x05bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x05bf('0x4'));var rimraf=require(_0x05bf('0x5'));var config=require('../../config/environment');var attributes=require(_0x05bf('0x6'));module[_0x05bf('0x7')]=function(_0x36a949,_0x4f28ba){return _0x36a949[_0x05bf('0x8')]('MailInteraction',attributes,{'tableName':_0x05bf('0x9'),'paranoid':![],'indexes':[{'name':_0x05bf('0xa'),'fields':[_0x05bf('0xb'),'to'],'type':_0x05bf('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31a101,_0x1355e6,_0x553442){if(_0x31a101[_0x05bf('0xd')]){_0x31a101[_0x05bf('0xe')]=moment()['format'](_0x05bf('0xf'));}if(_0x31a101['closed']){_0x31a101[_0x05bf('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x553442(null,_0x1355e6);},'beforeUpdate':function(_0x25ad75,_0x79ebd5,_0x49c9c2){if(_0x25ad75[_0x05bf('0x11')](_0x05bf('0xd'))){_0x25ad75[_0x05bf('0xe')]=_0x25ad75[_0x05bf('0xd')]?moment()['format'](_0x05bf('0xf')):null;}if(_0x25ad75[_0x05bf('0x11')](_0x05bf('0x12'))){_0x25ad75[_0x05bf('0x10')]=moment()[_0x05bf('0x13')](_0x05bf('0xf'));_0x25ad75[_0x05bf('0xd')]=null;_0x25ad75['substatusAt']=null;}_0x49c9c2(null,_0x25ad75);},'afterUpdate':function(_0xf7922a,_0x5e929a,_0x5cab94){var _0x2794ae=_0x36a949[_0x05bf('0x14')];var _0x3c53cf=_0xf7922a[_0x05bf('0x15')]({'plain':!![]});if(_0x3c53cf[_0x05bf('0x12')]){return _0x2794ae[_0x05bf('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3c53cf['id']}})[_0x05bf('0x17')](function(){_0x5cab94();})[_0x05bf('0x18')](function(_0x4aeedd){_0x5cab94(_0x4aeedd);});}else{_0x5cab94();}}},'charset':_0x05bf('0x19'),'collate':_0x05bf('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 6f1fa7d..d6b9cfe 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 _0xb353=['request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','MailInteraction,\x20%s,\x20%s','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','find','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','register','request','then','info'];(function(_0x4bc776,_0x43eb91){var _0x276039=function(_0x3be2aa){while(--_0x3be2aa){_0x4bc776['push'](_0x4bc776['shift']());}};_0x276039(++_0x43eb91);}(_0xb353,0xdd));var _0x3b35=function(_0x397682,_0x2d14ba){_0x397682=_0x397682-0x0;var _0xdfab9e=_0xb353[_0x397682];return _0xdfab9e;};'use strict';var _=require(_0x3b35('0x0'));var util=require(_0x3b35('0x1'));var moment=require(_0x3b35('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b35('0x3'));var fs=require('fs');var Redis=require(_0x3b35('0x4'));var db=require(_0x3b35('0x5'))['db'];var utils=require(_0x3b35('0x6'));var logger=require(_0x3b35('0x7'))(_0x3b35('0x8'));var config=require(_0x3b35('0x9'));var jayson=require(_0x3b35('0xa'));var client=jayson['client'][_0x3b35('0xb')]({'port':0x232a});config['redis']=_[_0x3b35('0xc')](config[_0x3b35('0xd')],{'host':_0x3b35('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b35('0xd')]));require('./mailInteraction.socket')[_0x3b35('0xf')](socket);function respondWithRpcPromise(_0x413008,_0x4e0ca0,_0x4ba4e3){return new BPromise(function(_0x13ba13,_0x35455f){return client[_0x3b35('0x10')](_0x413008,_0x4ba4e3)[_0x3b35('0x11')](function(_0x4b9a55){logger[_0x3b35('0x12')]('MailInteraction,\x20%s,\x20%s',_0x4e0ca0,_0x3b35('0x13'));logger[_0x3b35('0x14')](_0x3b35('0x15'),_0x4e0ca0,_0x3b35('0x13'),JSON[_0x3b35('0x16')](_0x4b9a55));if(_0x4b9a55[_0x3b35('0x17')]){if(_0x4b9a55[_0x3b35('0x17')]['code']===0x1f4){logger[_0x3b35('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4e0ca0,_0x4b9a55[_0x3b35('0x17')][_0x3b35('0x18')]);return _0x35455f(_0x4b9a55[_0x3b35('0x17')]['message']);}logger[_0x3b35('0x17')](_0x3b35('0x19'),_0x4e0ca0,_0x4b9a55['error'][_0x3b35('0x18')]);return _0x13ba13(_0x4b9a55[_0x3b35('0x17')][_0x3b35('0x18')]);}else{logger[_0x3b35('0x12')]('MailInteraction,\x20%s,\x20%s',_0x4e0ca0,'request\x20sent');_0x13ba13(_0x4b9a55['result'][_0x3b35('0x18')]);}})[_0x3b35('0x1a')](function(_0x2fd014){logger[_0x3b35('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4e0ca0,_0x2fd014);_0x35455f(_0x2fd014);});});}exports[_0x3b35('0x1b')]=function(_0x4f927c){var _0x1a9475=this;return new Promise(function(_0x1357e2,_0x4f2193){return db[_0x3b35('0x1c')][_0x3b35('0x1d')](_0x4f927c[_0x3b35('0x1e')],{'raw':_0x4f927c[_0x3b35('0x1f')]?_0x4f927c[_0x3b35('0x1f')][_0x3b35('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f927c[_0x3b35('0x1f')]?_0x4f927c[_0x3b35('0x1f')][_0x3b35('0x21')]||null:null,'attributes':_0x4f927c['options']?_0x4f927c[_0x3b35('0x1f')][_0x3b35('0x22')]||null:null,'limit':_0x4f927c[_0x3b35('0x1f')]?_0x4f927c[_0x3b35('0x1f')]['limit']||null:null})[_0x3b35('0x11')](function(_0x40fa65){logger[_0x3b35('0x12')]('UpdateMailInteraction',_0x4f927c);logger[_0x3b35('0x14')](_0x3b35('0x1b'),_0x4f927c,JSON[_0x3b35('0x16')](_0x40fa65));_0x1357e2(_0x40fa65);})[_0x3b35('0x1a')](function(_0x511beb){logger[_0x3b35('0x17')]('UpdateMailInteraction',_0x511beb['message'],_0x4f927c);_0x4f2193(_0x1a9475[_0x3b35('0x17')](0x1f4,_0x511beb[_0x3b35('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x548a74){return new Promise(function(_0x4c126b,_0x22d0a5){return db[_0x3b35('0x1c')][_0x3b35('0x23')]({'where':_0x548a74[_0x3b35('0x1f')]?_0x548a74[_0x3b35('0x1f')][_0x3b35('0x21')]||null:null})[_0x3b35('0x11')](function(_0x654865){if(_0x654865){return _0x654865[_0x3b35('0x24')](_0x548a74[_0x3b35('0x1e')][_0x3b35('0x25')],_[_0x3b35('0x26')](_0x548a74[_0x3b35('0x1e')],[_0x3b35('0x25'),'id'])||{});}})['spread'](function(_0x22b421){logger[_0x3b35('0x12')]('AddTags',_0x548a74);logger[_0x3b35('0x14')](_0x3b35('0x27'),_0x548a74,JSON[_0x3b35('0x16')](_0x22b421));_0x4c126b(_0x22b421);})[_0x3b35('0x1a')](function(_0x307ff1){logger[_0x3b35('0x17')](_0x3b35('0x27'),_0x307ff1[_0x3b35('0x18')],_0x548a74);_0x22d0a5(_this[_0x3b35('0x17')](0x1f4,_0x307ff1[_0x3b35('0x18')]));});});}; \ No newline at end of file +var _0x1cff=['localhost','./mailInteraction.socket','register','request','then','info','debug','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','request\x20sent','result','MailInteraction','options','raw','where','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x1096a5,_0x16923c){var _0x575d0d=function(_0x5a3008){while(--_0x5a3008){_0x1096a5['push'](_0x1096a5['shift']());}};_0x575d0d(++_0x16923c);}(_0x1cff,0x164));var _0xf1cf=function(_0x177ea1,_0x5b0df6){_0x177ea1=_0x177ea1-0x0;var _0x156121=_0x1cff[_0x177ea1];return _0x156121;};'use strict';var _=require(_0xf1cf('0x0'));var util=require(_0xf1cf('0x1'));var moment=require(_0xf1cf('0x2'));var BPromise=require(_0xf1cf('0x3'));var rs=require(_0xf1cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1cf('0x5'))['db'];var utils=require(_0xf1cf('0x6'));var logger=require(_0xf1cf('0x7'))('rpc');var config=require(_0xf1cf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf1cf('0x9')][_0xf1cf('0xa')]({'port':0x232a});config[_0xf1cf('0xb')]=_[_0xf1cf('0xc')](config[_0xf1cf('0xb')],{'host':_0xf1cf('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf1cf('0xe'))[_0xf1cf('0xf')](socket);function respondWithRpcPromise(_0x1bc577,_0x3ac403,_0xe8d905){return new BPromise(function(_0x47291a,_0x33b8fc){return client[_0xf1cf('0x10')](_0x1bc577,_0xe8d905)[_0xf1cf('0x11')](function(_0x53904a){logger[_0xf1cf('0x12')]('MailInteraction,\x20%s,\x20%s',_0x3ac403,'request\x20sent');logger[_0xf1cf('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3ac403,'request\x20sent',JSON[_0xf1cf('0x14')](_0x53904a));if(_0x53904a[_0xf1cf('0x15')]){if(_0x53904a[_0xf1cf('0x15')][_0xf1cf('0x16')]===0x1f4){logger['error'](_0xf1cf('0x17'),_0x3ac403,_0x53904a['error']['message']);return _0x33b8fc(_0x53904a[_0xf1cf('0x15')][_0xf1cf('0x18')]);}logger[_0xf1cf('0x15')](_0xf1cf('0x17'),_0x3ac403,_0x53904a[_0xf1cf('0x15')]['message']);return _0x47291a(_0x53904a['error'][_0xf1cf('0x18')]);}else{logger[_0xf1cf('0x12')](_0xf1cf('0x17'),_0x3ac403,_0xf1cf('0x19'));_0x47291a(_0x53904a[_0xf1cf('0x1a')][_0xf1cf('0x18')]);}})['catch'](function(_0x2f41bd){logger[_0xf1cf('0x15')](_0xf1cf('0x17'),_0x3ac403,_0x2f41bd);_0x33b8fc(_0x2f41bd);});});}exports['UpdateMailInteraction']=function(_0x5a4bdb){var _0x512787=this;return new Promise(function(_0x217200,_0x22e93a){return db[_0xf1cf('0x1b')]['update'](_0x5a4bdb['body'],{'raw':_0x5a4bdb[_0xf1cf('0x1c')]?_0x5a4bdb[_0xf1cf('0x1c')][_0xf1cf('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a4bdb['options']?_0x5a4bdb['options'][_0xf1cf('0x1e')]||null:null,'attributes':_0x5a4bdb['options']?_0x5a4bdb[_0xf1cf('0x1c')]['attributes']||null:null,'limit':_0x5a4bdb[_0xf1cf('0x1c')]?_0x5a4bdb[_0xf1cf('0x1c')]['limit']||null:null})[_0xf1cf('0x11')](function(_0x313bf9){logger[_0xf1cf('0x12')](_0xf1cf('0x1f'),_0x5a4bdb);logger['debug'](_0xf1cf('0x1f'),_0x5a4bdb,JSON[_0xf1cf('0x14')](_0x313bf9));_0x217200(_0x313bf9);})[_0xf1cf('0x20')](function(_0x2ce3e0){logger[_0xf1cf('0x15')](_0xf1cf('0x1f'),_0x2ce3e0[_0xf1cf('0x18')],_0x5a4bdb);_0x22e93a(_0x512787['error'](0x1f4,_0x2ce3e0[_0xf1cf('0x18')]));});});};exports[_0xf1cf('0x21')]=function(_0x28f44c){return new Promise(function(_0x1db3c9,_0x465cab){return db['MailInteraction'][_0xf1cf('0x22')]({'where':_0x28f44c['options']?_0x28f44c[_0xf1cf('0x1c')][_0xf1cf('0x1e')]||null:null})[_0xf1cf('0x11')](function(_0x1e3223){if(_0x1e3223){return _0x1e3223[_0xf1cf('0x23')](_0x28f44c[_0xf1cf('0x24')][_0xf1cf('0x25')],_[_0xf1cf('0x26')](_0x28f44c[_0xf1cf('0x24')],[_0xf1cf('0x25'),'id'])||{});}})[_0xf1cf('0x27')](function(_0xb9f8c5){logger[_0xf1cf('0x12')](_0xf1cf('0x28'),_0x28f44c);logger['debug'](_0xf1cf('0x28'),_0x28f44c,JSON[_0xf1cf('0x14')](_0xb9f8c5));_0x1db3c9(_0xb9f8c5);})['catch'](function(_0x51d5d8){logger[_0xf1cf('0x15')]('AddTags',_0x51d5d8[_0xf1cf('0x18')],_0x28f44c);_0x465cab(_this[_0xf1cf('0x15')](0x1f4,_0x51d5d8[_0xf1cf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 712ca71..425e1ce 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 _0xc68f=['length','mailInteraction:','./mailInteraction.events','save','update','removeListener','register'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xc68f,0x80));var _0xfc68=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc68f[_0x2dafbe];return _0x58a45a;};'use strict';var MailInteractionEvents=require(_0xfc68('0x0'));var events=[_0xfc68('0x1'),'remove',_0xfc68('0x2')];function createListener(_0x35caf4,_0x39f865){return function(_0x1e9db2){_0x39f865['emit'](_0x35caf4,_0x1e9db2);};}function removeListener(_0x47c786,_0x2e2214){return function(){MailInteractionEvents[_0xfc68('0x3')](_0x47c786,_0x2e2214);};}exports[_0xfc68('0x4')]=function(_0x3a222e){for(var _0x1f1034=0x0,_0x3eb0d2=events[_0xfc68('0x5')];_0x1f1034<_0x3eb0d2;_0x1f1034++){var _0x281568=events[_0x1f1034];var _0x61f19e=createListener(_0xfc68('0x6')+_0x281568,_0x3a222e);MailInteractionEvents['on'](_0x281568,_0x61f19e);}}; \ No newline at end of file +var _0xd1c7=['save','emit','removeListener','length','mailInteraction:','./mailInteraction.events'];(function(_0x34c23e,_0x274b06){var _0x4729dd=function(_0x4cab2d){while(--_0x4cab2d){_0x34c23e['push'](_0x34c23e['shift']());}};_0x4729dd(++_0x274b06);}(_0xd1c7,0x1d3));var _0x7d1c=function(_0xcba81,_0x2d4fe8){_0xcba81=_0xcba81-0x0;var _0x2f4468=_0xd1c7[_0xcba81];return _0x2f4468;};'use strict';var MailInteractionEvents=require(_0x7d1c('0x0'));var events=[_0x7d1c('0x1'),'remove','update'];function createListener(_0x3cdd6a,_0xaaf87f){return function(_0x4575c4){_0xaaf87f[_0x7d1c('0x2')](_0x3cdd6a,_0x4575c4);};}function removeListener(_0x576679,_0x132032){return function(){MailInteractionEvents[_0x7d1c('0x3')](_0x576679,_0x132032);};}exports['register']=function(_0x3aa477){for(var _0x4e412d=0x0,_0x158d38=events[_0x7d1c('0x4')];_0x4e412d<_0x158d38;_0x4e412d++){var _0x602aaf=events[_0x4e412d];var _0x4640d9=createListener(_0x7d1c('0x5')+_0x602aaf,_0x3aa477);MailInteractionEvents['on'](_0x602aaf,_0x4640d9);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 2effb03..f2a24c9 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 _0xae13=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','multer'];(function(_0x38d35c,_0x30e90e){var _0x2f80d4=function(_0x504e22){while(--_0x504e22){_0x38d35c['push'](_0x38d35c['shift']());}};_0x2f80d4(++_0x30e90e);}(_0xae13,0x154));var _0x3ae1=function(_0x252093,_0x576b7d){_0x252093=_0x252093-0x0;var _0x1a57f7=_0xae13[_0x252093];return _0x1a57f7;};'use strict';var multer=require(_0x3ae1('0x0'));var util=require(_0x3ae1('0x1'));var path=require(_0x3ae1('0x2'));var timeout=require(_0x3ae1('0x3'));var express=require(_0x3ae1('0x4'));var router=express[_0x3ae1('0x5')]();var fs_extra=require(_0x3ae1('0x6'));var auth=require(_0x3ae1('0x7'));var interaction=require(_0x3ae1('0x8'));var config=require(_0x3ae1('0x9'));var controller=require(_0x3ae1('0xa'));router[_0x3ae1('0xb')]('/',auth[_0x3ae1('0xc')](),controller[_0x3ae1('0xd')]);router['get']('/describe',auth[_0x3ae1('0xc')](),controller[_0x3ae1('0xe')]);router[_0x3ae1('0xb')](_0x3ae1('0xf'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x10')]);router[_0x3ae1('0xb')](_0x3ae1('0x11'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x12')]);router[_0x3ae1('0x13')]('/',auth['isAuthenticated'](),interaction[_0x3ae1('0x14')](_0x3ae1('0x15'),_0x3ae1('0x16')),controller[_0x3ae1('0x17')]);router[_0x3ae1('0x18')](_0x3ae1('0xf'),auth['isAuthenticated'](),controller[_0x3ae1('0x19')]);router[_0x3ae1('0x18')](_0x3ae1('0x1a'),auth['isAuthenticated'](),controller['accept']);router[_0x3ae1('0x18')]('/:id/reject',auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x1b')]);router[_0x3ae1('0x1c')](_0x3ae1('0xf'),auth[_0x3ae1('0xc')](),controller[_0x3ae1('0x1d')]);module[_0x3ae1('0x1e')]=router; \ No newline at end of file +var _0x5d40=['/:id/reject','reject','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','get','index','isAuthenticated','describe','/:id','show','/:id/download','tracked','mailmessage:create','create','put','/:id/accept','accept'];(function(_0x308bae,_0x19d7f5){var _0x1ec4f2=function(_0x5ac33e){while(--_0x5ac33e){_0x308bae['push'](_0x308bae['shift']());}};_0x1ec4f2(++_0x19d7f5);}(_0x5d40,0x1a2));var _0x05d4=function(_0xd629d5,_0x306574){_0xd629d5=_0xd629d5-0x0;var _0x467c5d=_0x5d40[_0xd629d5];return _0x467c5d;};'use strict';var multer=require(_0x05d4('0x0'));var util=require(_0x05d4('0x1'));var path=require('path');var timeout=require(_0x05d4('0x2'));var express=require('express');var router=express[_0x05d4('0x3')]();var fs_extra=require(_0x05d4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x05d4('0x5'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0x05d4('0x6')]('/',auth['isAuthenticated'](),controller[_0x05d4('0x7')]);router['get']('/describe',auth[_0x05d4('0x8')](),controller[_0x05d4('0x9')]);router[_0x05d4('0x6')](_0x05d4('0xa'),auth['isAuthenticated'](),controller[_0x05d4('0xb')]);router[_0x05d4('0x6')](_0x05d4('0xc'),auth[_0x05d4('0x8')](),controller['download']);router['post']('/',auth['isAuthenticated'](),interaction[_0x05d4('0xd')]('mail',_0x05d4('0xe')),controller[_0x05d4('0xf')]);router[_0x05d4('0x10')](_0x05d4('0xa'),auth[_0x05d4('0x8')](),controller['update']);router[_0x05d4('0x10')](_0x05d4('0x11'),auth['isAuthenticated'](),controller[_0x05d4('0x12')]);router[_0x05d4('0x10')](_0x05d4('0x13'),auth[_0x05d4('0x8')](),controller[_0x05d4('0x14')]);router[_0x05d4('0x15')]('/:id',auth[_0x05d4('0x8')](),controller[_0x05d4('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 00296bc..16246a0 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 _0xa960=['out','long','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xa960,0xb9));var _0x0a96=function(_0x299a9e,_0x40a615){_0x299a9e=_0x299a9e-0x0;var _0x41b74f=_0xa960[_0x299a9e];return _0x41b74f;};'use strict';var Sequelize=require(_0x0a96('0x0'));var _=require(_0x0a96('0x1'));module[_0x0a96('0x2')]={'body':{'type':Sequelize[_0x0a96('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0a96('0x3')](_0x0a96('0x4'))},'read':{'type':Sequelize[_0x0a96('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0a96('0x6')]('in',_0x0a96('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x0a96('0x3')](_0x0a96('0x8'))},'cc':{'type':Sequelize[_0x0a96('0x3')](_0x0a96('0x8'))},'bcc':{'type':Sequelize[_0x0a96('0x3')]('long')},'subject':{'type':Sequelize[_0x0a96('0x3')]},'sentAt':{'type':Sequelize[_0x0a96('0x9')]},'attach':{'type':Sequelize[_0x0a96('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0a96('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0a96('0x9')]},'originTo':{'type':Sequelize[_0x0a96('0x3')](_0x0a96('0x8'))},'originCc':{'type':Sequelize['TEXT'](_0x0a96('0x8'))},'originChannel':{'type':Sequelize[_0x0a96('0x6')](_0x0a96('0xb'),'Chat'),'defaultValue':_0x0a96('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x482a=['lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Email','sequelize'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x482a,0x178));var _0xa482=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x482a[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require(_0xa482('0x0'));var _=require(_0xa482('0x1'));module[_0xa482('0x2')]={'body':{'type':Sequelize[_0xa482('0x3')](_0xa482('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa482('0x3')](_0xa482('0x5'))},'read':{'type':Sequelize[_0xa482('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa482('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xa482('0x8')](0x1fe)},'from':{'type':Sequelize[_0xa482('0x8')]},'to':{'type':Sequelize[_0xa482('0x3')](_0xa482('0x4'))},'cc':{'type':Sequelize[_0xa482('0x3')](_0xa482('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xa482('0x3')]},'sentAt':{'type':Sequelize[_0xa482('0x9')]},'attach':{'type':Sequelize[_0xa482('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa482('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa482('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xa482('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xa482('0x4'))},'originChannel':{'type':Sequelize[_0xa482('0xb')](_0xa482('0xc'),'Chat'),'defaultValue':_0xa482('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3ae695f..f73765a 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 _0x2944=['rawAttributes','length','includeAll','options','find','update','body','describe','create','out','split','MailAccount','findOne','CmList','List','CmContact','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','interface','SIP/%s','channel','event','fromString','EventManager','reject','mail','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','internal','rejectmessage','unix','toString','root','files','tmp','server','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','existsSync','push','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','undefined','limit','count','offset','status','set','Content-Range','json','then','destroy','end','sendStatus','name','send','index','MailMessage','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','include','show','params'];(function(_0x4848ca,_0x833580){var _0x29878e=function(_0x184683){while(--_0x184683){_0x4848ca['push'](_0x4848ca['shift']());}};_0x29878e(++_0x833580);}(_0x2944,0xfb));var _0x4294=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2944[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x4294('0x0'));var moment=require(_0x4294('0x1'));var BPromise=require(_0x4294('0x2'));var util=require(_0x4294('0x3'));var path=require(_0x4294('0x4'));var fs=require('fs');var _=require(_0x4294('0x5'));var Redis=require(_0x4294('0x6'));var htmlToText=require(_0x4294('0x7'));var qs=require(_0x4294('0x8'));var logger=require(_0x4294('0x9'))(_0x4294('0xa'));var interaction_log=require(_0x4294('0x9'))(_0x4294('0xb'));var config=require(_0x4294('0xc'));var db=require(_0x4294('0xd'))['db'];config[_0x4294('0xe')]=_[_0x4294('0xf')](config[_0x4294('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x4294('0x10'))(new Redis(config[_0x4294('0xe')]));var htmlEntities=require(_0x4294('0x11'));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x4294('0x12'));var client=jayson[_0x4294('0x13')][_0x4294('0x14')]({'port':0x232c});var client9003=jayson[_0x4294('0x13')][_0x4294('0x14')]({'port':0x232b});var client9002=jayson[_0x4294('0x13')][_0x4294('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x2e36c9,_0x45f538,_0x22953b,_0x591653){return new BPromise(function(_0xfac66f,_0x177ed0){var _0xd0a3d8=_0x591653||client;return _0xd0a3d8[_0x4294('0x15')](_0x2e36c9,_0x22953b)['then'](function(_0x1d1a75){logger[_0x4294('0x16')](_0x4294('0x17'),_0x45f538,'request\x20sent');logger[_0x4294('0x18')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x45f538,_0x4294('0x19'),JSON[_0x4294('0x1a')](_0x1d1a75));if(_0x1d1a75[_0x4294('0x1b')]){if(_0x1d1a75[_0x4294('0x1b')][_0x4294('0x1c')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x45f538,_0x1d1a75[_0x4294('0x1b')]['message']);return _0x177ed0(_0x1d1a75[_0x4294('0x1b')][_0x4294('0x1d')]);}logger[_0x4294('0x1b')]('MailMessage,\x20%s,\x20%s',_0x45f538,_0x1d1a75[_0x4294('0x1b')][_0x4294('0x1d')]);return _0xfac66f(_0x1d1a75[_0x4294('0x1b')]['message']);}else{logger[_0x4294('0x16')]('MailMessage,\x20%s,\x20%s',_0x45f538,_0x4294('0x19'));_0xfac66f(_0x1d1a75['result'][_0x4294('0x1d')]);}})[_0x4294('0x1e')](function(_0x2e7f62){logger[_0x4294('0x1b')](_0x4294('0x17'),_0x45f538,_0x2e7f62);_0x177ed0(_0x2e7f62);});});}function respondWithResult(_0x382fa8,_0x5e29e8){_0x5e29e8=_0x5e29e8||0xc8;return function(_0x37501a){if(_0x37501a){return _0x382fa8['status'](_0x5e29e8)['json'](_0x37501a);}};}function respondWithFilteredResult(_0xb6b1c9,_0x284b24){return function(_0x14ff5b){if(_0x14ff5b){var _0x5b45ec=typeof _0x284b24['offset']===_0x4294('0x1f')&&typeof _0x284b24[_0x4294('0x20')]===_0x4294('0x1f');var _0xbeeba4=_0x14ff5b[_0x4294('0x21')];var _0x524575=_0x5b45ec?0x0:_0x284b24[_0x4294('0x22')];var _0x11fc2c=_0x5b45ec?_0x14ff5b['count']:_0x284b24[_0x4294('0x22')]+_0x284b24[_0x4294('0x20')];var _0x37b75e;if(_0x11fc2c>=_0xbeeba4){_0x11fc2c=_0xbeeba4;_0x37b75e=0xc8;}else{_0x37b75e=0xce;}_0xb6b1c9[_0x4294('0x23')](_0x37b75e);return _0xb6b1c9[_0x4294('0x24')](_0x4294('0x25'),_0x524575+'-'+_0x11fc2c+'/'+_0xbeeba4)[_0x4294('0x26')](_0x14ff5b);}return null;};}function saveUpdates(_0x12527d){return function(_0x2b72e7){if(_0x2b72e7){return _0x2b72e7['update'](_0x12527d)[_0x4294('0x27')](function(_0x40dd48){return _0x40dd48;});}return null;};}function removeEntity(_0xd1bc1a){return function(_0x5f31d7){if(_0x5f31d7){return _0x5f31d7[_0x4294('0x28')]()[_0x4294('0x27')](function(){_0xd1bc1a['status'](0xcc)[_0x4294('0x29')]();});}};}function handleEntityNotFound(_0xef62d9){return function(_0x1e7c16){if(!_0x1e7c16){_0xef62d9[_0x4294('0x2a')](0x194);}return _0x1e7c16;};}function handleError(_0x19ae6a,_0x5ea64b){_0x5ea64b=_0x5ea64b||0x1f4;return function(_0x551de1){logger[_0x4294('0x1b')](_0x551de1['stack']);if(_0x551de1[_0x4294('0x2b')]){delete _0x551de1[_0x4294('0x2b')];}_0x19ae6a[_0x4294('0x23')](_0x5ea64b)[_0x4294('0x2c')](_0x551de1);};}exports[_0x4294('0x2d')]=function(_0x945cc4,_0x4f5cd1){var _0x2ee7af={},_0x1c1c63={},_0x5b3624={'count':0x0,'rows':[]};var _0x5c0517=_['map'](db[_0x4294('0x2e')]['rawAttributes'],function(_0x1f8dbe){return{'name':_0x1f8dbe[_0x4294('0x2f')],'type':_0x1f8dbe[_0x4294('0x30')]['key']};});_0x1c1c63[_0x4294('0x31')]=_['map'](_0x5c0517,_0x4294('0x2b'));_0x1c1c63[_0x4294('0x32')]=_[_0x4294('0x33')](_0x945cc4['query']);_0x1c1c63[_0x4294('0x34')]=_[_0x4294('0x35')](_0x1c1c63[_0x4294('0x31')],_0x1c1c63[_0x4294('0x32')]);_0x2ee7af[_0x4294('0x36')]=_['intersection'](_0x1c1c63[_0x4294('0x31')],qs[_0x4294('0x37')](_0x945cc4[_0x4294('0x32')][_0x4294('0x37')]));_0x2ee7af['attributes']=_0x2ee7af[_0x4294('0x36')]['length']?_0x2ee7af[_0x4294('0x36')]:_0x1c1c63[_0x4294('0x31')];if(!_0x945cc4[_0x4294('0x32')][_0x4294('0x38')](_0x4294('0x39'))){_0x2ee7af[_0x4294('0x20')]=qs['limit'](_0x945cc4[_0x4294('0x32')][_0x4294('0x20')]);_0x2ee7af[_0x4294('0x22')]=qs[_0x4294('0x22')](_0x945cc4['query'][_0x4294('0x22')]);}_0x2ee7af[_0x4294('0x3a')]=qs[_0x4294('0x3b')](_0x945cc4[_0x4294('0x32')]['sort']);_0x2ee7af[_0x4294('0x3c')]=qs[_0x4294('0x34')](_[_0x4294('0x3d')](_0x945cc4[_0x4294('0x32')],_0x1c1c63[_0x4294('0x34')]),_0x5c0517);if(_0x945cc4[_0x4294('0x32')]['filter']){_0x2ee7af[_0x4294('0x3c')]=_[_0x4294('0x3e')](_0x2ee7af[_0x4294('0x3c')],{'$or':_[_0x4294('0x3f')](_0x5c0517,function(_0x254990){if(_0x254990[_0x4294('0x30')]!==_0x4294('0x40')){var _0x3876ff={};_0x3876ff[_0x254990[_0x4294('0x2b')]]={'$like':'%'+_0x945cc4[_0x4294('0x32')][_0x4294('0x41')]+'%'};return _0x3876ff;}})});}_0x2ee7af=_[_0x4294('0x3e')]({},_0x2ee7af,_0x945cc4['options']);var _0x1dcabe={'where':_0x2ee7af[_0x4294('0x3c')]};return db[_0x4294('0x2e')][_0x4294('0x21')](_0x1dcabe)[_0x4294('0x27')](function(_0x5c7a6b){_0x5b3624[_0x4294('0x21')]=_0x5c7a6b;if(_0x945cc4[_0x4294('0x32')]['includeAll']){_0x2ee7af[_0x4294('0x42')]=[{'all':!![]}];}return db[_0x4294('0x2e')]['findAll'](_0x2ee7af);})['then'](function(_0x2fc80f){_0x5b3624['rows']=_0x2fc80f;return _0x5b3624;})[_0x4294('0x27')](respondWithFilteredResult(_0x4f5cd1,_0x2ee7af))[_0x4294('0x1e')](handleError(_0x4f5cd1,null));};exports[_0x4294('0x43')]=function(_0xa78ae7,_0x1dc981){var _0x5d106e={'raw':!![],'where':{'id':_0xa78ae7[_0x4294('0x44')]['id']}},_0x558088={};_0x558088['model']=_['keys'](db[_0x4294('0x2e')][_0x4294('0x45')]);_0x558088[_0x4294('0x32')]=_[_0x4294('0x33')](_0xa78ae7['query']);_0x558088[_0x4294('0x34')]=_['intersection'](_0x558088[_0x4294('0x31')],_0x558088[_0x4294('0x32')]);_0x5d106e[_0x4294('0x36')]=_[_0x4294('0x35')](_0x558088[_0x4294('0x31')],qs['fields'](_0xa78ae7[_0x4294('0x32')]['fields']));_0x5d106e[_0x4294('0x36')]=_0x5d106e[_0x4294('0x36')][_0x4294('0x46')]?_0x5d106e[_0x4294('0x36')]:_0x558088[_0x4294('0x31')];if(_0xa78ae7[_0x4294('0x32')][_0x4294('0x47')]){_0x5d106e[_0x4294('0x42')]=[{'all':!![]}];}_0x5d106e=_[_0x4294('0x3e')]({},_0x5d106e,_0xa78ae7[_0x4294('0x48')]);return db[_0x4294('0x2e')][_0x4294('0x49')](_0x5d106e)[_0x4294('0x27')](handleEntityNotFound(_0x1dc981,null))['then'](respondWithResult(_0x1dc981,null))[_0x4294('0x1e')](handleError(_0x1dc981,null));};exports[_0x4294('0x4a')]=function(_0x48fa46,_0xceece8){if(_0x48fa46[_0x4294('0x4b')]['id']){delete _0x48fa46[_0x4294('0x4b')]['id'];}return db[_0x4294('0x2e')][_0x4294('0x49')]({'where':{'id':_0x48fa46[_0x4294('0x44')]['id']}})[_0x4294('0x27')](handleEntityNotFound(_0xceece8,null))['then'](saveUpdates(_0x48fa46['body'],null))[_0x4294('0x27')](respondWithResult(_0xceece8,null))[_0x4294('0x1e')](handleError(_0xceece8,null));};exports['destroy']=function(_0x1ea011,_0x3c873e){return db[_0x4294('0x2e')][_0x4294('0x49')]({'where':{'id':_0x1ea011['params']['id']}})[_0x4294('0x27')](handleEntityNotFound(_0x3c873e,null))[_0x4294('0x27')](removeEntity(_0x3c873e,null))['catch'](handleError(_0x3c873e,null));};exports[_0x4294('0x4c')]=function(_0x5ae3ad,_0x2f0eac){return db[_0x4294('0x2e')][_0x4294('0x4c')]()[_0x4294('0x27')](respondWithResult(_0x2f0eac,null))[_0x4294('0x1e')](handleError(_0x2f0eac,null));};exports[_0x4294('0x4d')]=function(_0x1ac6d4,_0xbd77aa){return db[_0x4294('0x2e')][_0x4294('0x4d')](_0x1ac6d4[_0x4294('0x4b')])[_0x4294('0x27')](function(_0x4db795){if(_0x4db795){if(_0x4db795['direction']===_0x4294('0x4e')&&!_0x4db795['secret']){var _0x2c256a,_0x5db1d9,_0x438f53;if(_0x1ac6d4[_0x4294('0x4b')]['to']){_0x5db1d9=_0x1ac6d4['body']['to'][_0x4294('0x4f')](',')[0x0];}return db[_0x4294('0x50')][_0x4294('0x51')]({'where':{'id':_0x4db795['MailAccountId']},'include':[{'model':db[_0x4294('0x52')],'as':_0x4294('0x53'),'include':[{'model':db[_0x4294('0x54')],'as':'Contacts','where':{'email':_0x5db1d9},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x4294('0x27')](function(_0x59b58a){_0x2c256a=_0x59b58a;if(_0x2c256a&&_0x2c256a[_0x4294('0x55')]){var _0x4ab28f={'tls':{'rejectUnauthorized':![]}};if(_[_0x4294('0x56')](_0x2c256a[_0x4294('0x55')][_0x4294('0x57')])){_0x4ab28f[_0x4294('0x58')]=_0x2c256a['Smtp'][_0x4294('0x58')];_0x4ab28f[_0x4294('0x59')]=_0x2c256a[_0x4294('0x55')]['port'];_0x4ab28f['secure']=_0x2c256a['Smtp'][_0x4294('0x5a')];if(_0x2c256a[_0x4294('0x55')][_0x4294('0x5b')]){_0x4ab28f[_0x4294('0x5c')]={'user':_0x2c256a['Smtp'][_0x4294('0x5d')],'pass':_0x2c256a['Smtp']['pass']};}}else{_0x4ab28f[_0x4294('0x57')]=_0x2c256a[_0x4294('0x55')][_0x4294('0x57')];_0x4ab28f[_0x4294('0x5c')]={'user':_0x2c256a[_0x4294('0x55')][_0x4294('0x5d')],'pass':_0x2c256a[_0x4294('0x55')][_0x4294('0x5e')]};_0x4ab28f[_0x4294('0x5a')]=_0x2c256a[_0x4294('0x55')][_0x4294('0x5a')];}if(_0x1ac6d4[_0x4294('0x4b')]['attachments']&&_0x1ac6d4[_0x4294('0x4b')][_0x4294('0x5f')][_0x4294('0x46')]){for(var _0x3fc56c=0x0;_0x3fc56c<_0x1ac6d4['body'][_0x4294('0x5f')]['length'];_0x3fc56c+=0x1){_0x1ac6d4[_0x4294('0x4b')]['attachments'][_0x3fc56c]={'filename':_0x1ac6d4[_0x4294('0x4b')][_0x4294('0x5f')][_0x3fc56c][_0x4294('0x2b')],'path':path[_0x4294('0x60')](config['root'],_0x4294('0x61'),_0x1ac6d4[_0x4294('0x4b')][_0x4294('0x5f')][_0x3fc56c][_0x4294('0x62')])};}}_0x438f53={'account':_0x4ab28f,'message':_0x1ac6d4[_0x4294('0x4b')]};return;}})[_0x4294('0x27')](function(){if(_0x2c256a[_0x4294('0x53')]){if(_0x2c256a[_0x4294('0x53')]['Contacts'][_0x4294('0x46')]){return _0x2c256a[_0x4294('0x53')]['Contacts'][0x0];}else{return db[_0x4294('0x54')]['create'](_[_0x4294('0xf')](_0x1ac6d4[_0x4294('0x4b')],{'firstName':_0x1ac6d4[_0x4294('0x4b')]['to'],'email':_0x1ac6d4[_0x4294('0x4b')]['to'],'phone':_0x1ac6d4['body']['to'],'ListId':_0x2c256a[_0x4294('0x63')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x438f53){return respondWithRpcPromise(_0x4294('0x64'),_0x4294('0x65'),_0x438f53,client9003)[_0x4294('0x27')](function(_0x4c63cc){return _0x4db795[_0x4294('0x4a')]({'read':!![],'messageId':_0x4c63cc[_0x4294('0x66')],'sentAt':moment()[_0x4294('0x67')](_0x4294('0x68'))});})['catch'](function(_0xd8533b){logger[_0x4294('0x1b')]('%s',JSON[_0x4294('0x1a')](_0xd8533b));return _0x4db795;});}return _0x4db795;});}return _0x4db795;}})[_0x4294('0x27')](respondWithResult(_0xbd77aa,0xc9))[_0x4294('0x1e')](handleError(_0xbd77aa,null));};exports[_0x4294('0x69')]=function(_0x1db5cb,_0x39a473){var _0x1bb1af={'agent':{},'channel':'mail'};if(_0x1db5cb['body']['id']){delete _0x1db5cb[_0x4294('0x4b')]['id'];}_0x1db5cb['body'][_0x4294('0x6a')]=!![];_0x1db5cb[_0x4294('0x4b')][_0x4294('0x6b')]=moment()[_0x4294('0x67')](_0x4294('0x68'));_0x1db5cb[_0x4294('0x4b')][_0x4294('0x6c')]=_0x1db5cb['body']['UserId']||_0x1db5cb[_0x4294('0x5d')]['id'];_0x1bb1af['agent']['id']=_0x1db5cb[_0x4294('0x4b')]['UserId'];return db[_0x4294('0x2e')]['find']({'where':{'id':_0x1db5cb['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x39a473,null))[_0x4294('0x27')](saveUpdates(_0x1db5cb[_0x4294('0x4b')],null))[_0x4294('0x27')](function(_0x505900){if(_0x505900){_0x1bb1af['message']=_0x505900[_0x4294('0x6d')]({'plain':!![]});return db[_0x4294('0x6e')][_0x4294('0x49')]({'where':{'id':_0x505900['MailInteractionId']}});}return null;})[_0x4294('0x27')](handleEntityNotFound(_0x39a473,null))[_0x4294('0x27')](function(_0x3205cd){if(_0x3205cd){return _0x3205cd['update']({'UserId':_0x1db5cb['body'][_0x4294('0x6c')],'read1stAt':_[_0x4294('0x56')](_0x3205cd[_0x4294('0x6f')])?moment()[_0x4294('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4294('0x27')](function(_0x2c24d1){if(_0x2c24d1){_0x1bb1af[_0x4294('0x70')]=_0x2c24d1[_0x4294('0x6d')]({'plain':!![]});interaction_log[_0x4294('0x16')](_0x4294('0x71'),_0x1db5cb[_0x4294('0x5d')]['id'],_0x1db5cb[_0x4294('0x5d')]['name'],_0x1db5cb['user'][_0x4294('0x72')],_0x1bb1af[_0x4294('0x70')]['id'],_0x1db5cb[_0x4294('0x4b')]?JSON[_0x4294('0x1a')](_0x1db5cb[_0x4294('0x4b')]):'null');return respondWithRpcPromise(_0x4294('0x73'),'acceptMessage',_0x1bb1af);}return null;})['then'](function(_0x19debd){var _0x137965=_0x4294('0x74')+_0x19debd[_0x4294('0x1d')][_0x4294('0x75')];return db[_0x4294('0x76')]['query'](_0x137965,{'type':db[_0x4294('0x77')][_0x4294('0x78')][_0x4294('0x79')],'raw':!![]})[_0x4294('0x27')](function(_0x52bb5b){return _0x52bb5b;});})['then'](function(_0x4bd04f){if(_0x4bd04f){_0x1bb1af['message'][_0x4294('0x7a')]=_0x4bd04f[0x0];if(!_0x1db5cb[_0x4294('0x4b')]['UserId'])return;return db[_0x4294('0x7b')]['find']({'where':{'id':_0x1db5cb['body']['UserId'],'role':_0x4294('0x7c')},'attributes':['id',_0x4294('0x2b'),_0x4294('0x7d'),_0x4294('0x7e'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2baf17){if(!_0x2baf17)return null;_0x1bb1af[_0x4294('0x1d')][_0x4294('0x7c')]=_0x2baf17;return _0x1bb1af;})[_0x4294('0x27')](function(_0x2ffd86){if(_0x2ffd86){if(_0x1db5cb[_0x4294('0x4b')]['manual']){_0x1bb1af[_0x4294('0x1d')][_0x4294('0x7f')]=util[_0x4294('0x67')](_0x4294('0x80'),_0x1db5cb[_0x4294('0x5d')][_0x4294('0x2b')]);_0x1bb1af[_0x4294('0x1d')][_0x4294('0x81')]=_0x1bb1af[_0x4294('0x81')];_0x1bb1af[_0x4294('0x1d')][_0x4294('0x82')]=_0x4294('0x69');_0x1bb1af[_0x4294('0x1d')][_0x4294('0x4b')]=htmlToText[_0x4294('0x83')](_0x1bb1af[_0x4294('0x1d')][_0x4294('0x4b')]);return respondWithRpcPromise('EventManager',_0x4294('0x84'),{'event':'acceptmessage','message':_0x1bb1af['message']},client9002)[_0x4294('0x27')](function(){return _0x1bb1af;});}return _0x1bb1af;}return null;})[_0x4294('0x27')](respondWithResult(_0x39a473,null))['catch'](handleError(_0x39a473,null));};exports[_0x4294('0x85')]=function(_0xaf3368,_0x36c7cb){var _0x19f5ce={'agent':{},'channel':_0x4294('0x86')};if(_0xaf3368[_0x4294('0x4b')]['id']){delete _0xaf3368[_0x4294('0x4b')]['id'];}_0xaf3368[_0x4294('0x4b')][_0x4294('0x6c')]=_0xaf3368[_0x4294('0x4b')][_0x4294('0x6c')]||_0xaf3368[_0x4294('0x5d')]['id'];_0x19f5ce[_0x4294('0x7c')]['id']=_0xaf3368[_0x4294('0x4b')][_0x4294('0x6c')];return db['MailMessage'][_0x4294('0x49')]({'where':{'id':_0xaf3368['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x36c7cb,null))[_0x4294('0x27')](function(_0x13de09){if(_0x13de09){_0x19f5ce[_0x4294('0x1d')]=_0x13de09[_0x4294('0x6d')]({'plain':!![]});return db[_0x4294('0x6e')]['find']({'where':{'id':_0x13de09[_0x4294('0x87')]}});}return null;})[_0x4294('0x27')](handleEntityNotFound(_0x36c7cb,null))[_0x4294('0x27')](function(_0x4b699c){if(_0x4b699c){_0x19f5ce[_0x4294('0x70')]=_0x4b699c[_0x4294('0x6d')]({'plain':!![]});interaction_log['info'](_0x4294('0x88'),_0xaf3368[_0x4294('0x5d')]['id'],_0xaf3368['user'][_0x4294('0x2b')],_0xaf3368[_0x4294('0x5d')]['role'],_0x19f5ce[_0x4294('0x70')]['id'],_0xaf3368[_0x4294('0x4b')]?JSON[_0x4294('0x1a')](_0xaf3368[_0x4294('0x4b')]):_0x4294('0x89'));return respondWithRpcPromise(_0x4294('0x8a'),_0x4294('0x8b'),_0x19f5ce);}return null;})[_0x4294('0x27')](function(_0x5928b3){var _0x1df9f3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5928b3[_0x4294('0x1d')]['ContactId'];return db[_0x4294('0x76')][_0x4294('0x32')](_0x1df9f3,{'type':db['Sequelize']['QueryTypes'][_0x4294('0x79')],'raw':!![]})[_0x4294('0x27')](function(_0x4d96ff){return _0x4d96ff;});})['then'](function(_0xe04218){if(_0xe04218){_0x19f5ce[_0x4294('0x1d')]['contact']=_0xe04218[0x0];if(!_0xaf3368[_0x4294('0x4b')][_0x4294('0x6c')])return;return db[_0x4294('0x7b')][_0x4294('0x49')]({'where':{'id':_0xaf3368[_0x4294('0x4b')][_0x4294('0x6c')],'role':'agent'},'attributes':['id','name','fullname',_0x4294('0x7e'),_0x4294('0x8c')],'raw':!![]});}return null;})[_0x4294('0x27')](function(_0x367222){if(!_0x367222)return null;_0x19f5ce['message'][_0x4294('0x7c')]=_0x367222;return _0x19f5ce;})[_0x4294('0x27')](function(_0x237fbf){if(_0x237fbf){_0x237fbf[_0x4294('0x1d')][_0x4294('0x7f')]=util[_0x4294('0x67')](_0x4294('0x80'),_0xaf3368[_0x4294('0x5d')][_0x4294('0x2b')]);_0x237fbf[_0x4294('0x1d')][_0x4294('0x81')]=_0x19f5ce[_0x4294('0x81')];_0x237fbf['message']['event']='reject';_0x237fbf[_0x4294('0x1d')][_0x4294('0x4b')]=htmlToText[_0x4294('0x83')](_0x19f5ce[_0x4294('0x1d')][_0x4294('0x4b')]);respondWithRpcPromise('EventManager',_0x4294('0x84'),{'event':_0x4294('0x8d'),'message':_0x237fbf[_0x4294('0x1d')]},client9002);return _0x19f5ce;}return null;})[_0x4294('0x27')](respondWithResult(_0x36c7cb,null))[_0x4294('0x1e')](handleError(_0x36c7cb,null));};exports['download']=function(_0x282bef,_0x2fe972){var _0xef3adc=moment()[_0x4294('0x8e')]()[_0x4294('0x8f')]();var _0x3db819=path[_0x4294('0x60')](config[_0x4294('0x90')],'server',_0x4294('0x91'),_0x4294('0x92'));var _0x4f8844=path[_0x4294('0x60')](config[_0x4294('0x90')],_0x4294('0x93'),'files',_0x4294('0x5f'));var _0x521ce3=util[_0x4294('0x67')]('message-%s.eml',_0xef3adc);return db[_0x4294('0x2e')][_0x4294('0x49')]({'where':{'id':_0x282bef[_0x4294('0x44')]['id']},'attributes':['id','body',_0x4294('0x94'),'to','cc','bcc',_0x4294('0x95'),_0x4294('0x96')],'include':_0x282bef[_0x4294('0x32')]['attachments']?[{'model':db[_0x4294('0x97')],'as':_0x4294('0x98')}]:undefined})[_0x4294('0x27')](handleEntityNotFound(_0x2fe972,null))[_0x4294('0x27')](function(_0x1a49c9){if(_0x1a49c9){var _0x12f47b=_0x1a49c9;var _0x227508={'from':_0x12f47b[_0x4294('0x94')],'to':_0x12f47b['to'],'subject':_0x12f47b[_0x4294('0x95')],'html':htmlEntities[_0x4294('0x99')](_0x12f47b[_0x4294('0x4b')]),'headers':{'Date':moment(_0x12f47b[_0x4294('0x96')])[_0x4294('0x67')](_0x4294('0x9a'))},'attachments':[]};if(_0x1a49c9['cc']){_0x227508['headers']['Cc']=_0x1a49c9['cc'];}if(_0x1a49c9[_0x4294('0x9b')]){_0x227508['headers']['Bcc']=_0x1a49c9[_0x4294('0x9b')];}return new BPromise(function(_0x818ac5,_0x24c50c){if(_0x1a49c9[_0x4294('0x98')]){for(var _0x31095b=0x0;_0x31095b<_0x1a49c9[_0x4294('0x98')][_0x4294('0x46')];_0x31095b++){var _0x13af41=_0x1a49c9[_0x4294('0x98')][_0x31095b];var _0x40e47c=path[_0x4294('0x60')](_0x4f8844,_0x13af41['basename']);if(fs[_0x4294('0x9c')](_0x40e47c)){_0x227508['attachments'][_0x4294('0x9d')]({'name':_0x13af41[_0x4294('0x2b')],'contentType':_0x13af41[_0x4294('0x30')],'data':fs['readFileSync'](_0x40e47c)});}}}emlformat['build'](_0x227508,function(_0x536580,_0x16e984){if(_0x536580)return _0x24c50c(_0x536580);fs['writeFileSync'](path['join'](_0x3db819,_0x521ce3),_0x16e984);return _0x818ac5(_0x16e984);});});}})[_0x4294('0x27')](function(_0x65e54f){if(_0x65e54f){return _0x2fe972[_0x4294('0x9e')](path[_0x4294('0x60')](_0x3db819,_0x521ce3),_0x521ce3,function(_0x46106e){if(!_0x46106e)fs[_0x4294('0x9f')](path[_0x4294('0x60')](_0x3db819,_0x521ce3));});}})[_0x4294('0x1e')](handleError(_0x2fe972,null));}; \ No newline at end of file +var _0x4695=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','SIP/%s','channel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','rejectmessage','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','download','unlinkSync','moment','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','catch','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','end','sendStatus','stack','name','send','index','MailMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','find','update','body','describe','create','out','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','ListId','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage'];(function(_0x5dc73b,_0x5186c9){var _0x44c923=function(_0x5c45a0){while(--_0x5c45a0){_0x5dc73b['push'](_0x5dc73b['shift']());}};_0x44c923(++_0x5186c9);}(_0x4695,0xc6));var _0x5469=function(_0xc7e844,_0x4885da){_0xc7e844=_0xc7e844-0x0;var _0x24f2c1=_0x4695[_0xc7e844];return _0x24f2c1;};'use strict';var emlformat=require('eml-format');var moment=require(_0x5469('0x0'));var BPromise=require('bluebird');var util=require(_0x5469('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x5469('0x2'));var Redis=require(_0x5469('0x3'));var htmlToText=require('html-to-text');var qs=require(_0x5469('0x4'));var logger=require(_0x5469('0x5'))('api');var interaction_log=require(_0x5469('0x5'))(_0x5469('0x6'));var config=require(_0x5469('0x7'));var db=require(_0x5469('0x8'))['db'];config[_0x5469('0x9')]=_[_0x5469('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5469('0xb'))(new Redis(config[_0x5469('0x9')]));var htmlEntities=require(_0x5469('0xc'));require(_0x5469('0xd'))[_0x5469('0xe')](socket);var jayson=require(_0x5469('0xf'));var client=jayson[_0x5469('0x10')][_0x5469('0x11')]({'port':0x232c});var client9003=jayson[_0x5469('0x10')]['http']({'port':0x232b});var client9002=jayson[_0x5469('0x10')][_0x5469('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x22ebbc,_0x24f927,_0x157887,_0x154edf){return new BPromise(function(_0x527a3e,_0x1b5f51){var _0x1b3025=_0x154edf||client;return _0x1b3025[_0x5469('0x12')](_0x22ebbc,_0x157887)['then'](function(_0x5a5a93){logger['info']('MailMessage,\x20%s,\x20%s',_0x24f927,_0x5469('0x13'));logger[_0x5469('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x24f927,'request\x20sent',JSON[_0x5469('0x15')](_0x5a5a93));if(_0x5a5a93[_0x5469('0x16')]){if(_0x5a5a93[_0x5469('0x16')][_0x5469('0x17')]===0x1f4){logger[_0x5469('0x16')](_0x5469('0x18'),_0x24f927,_0x5a5a93[_0x5469('0x16')][_0x5469('0x19')]);return _0x1b5f51(_0x5a5a93[_0x5469('0x16')][_0x5469('0x19')]);}logger[_0x5469('0x16')](_0x5469('0x18'),_0x24f927,_0x5a5a93[_0x5469('0x16')][_0x5469('0x19')]);return _0x527a3e(_0x5a5a93[_0x5469('0x16')][_0x5469('0x19')]);}else{logger[_0x5469('0x1a')](_0x5469('0x18'),_0x24f927,'request\x20sent');_0x527a3e(_0x5a5a93['result'][_0x5469('0x19')]);}})[_0x5469('0x1b')](function(_0x5321cf){logger[_0x5469('0x16')](_0x5469('0x18'),_0x24f927,_0x5321cf);_0x1b5f51(_0x5321cf);});});}function respondWithResult(_0x38d963,_0x33a0f8){_0x33a0f8=_0x33a0f8||0xc8;return function(_0x3fae76){if(_0x3fae76){return _0x38d963[_0x5469('0x1c')](_0x33a0f8)[_0x5469('0x1d')](_0x3fae76);}};}function respondWithFilteredResult(_0x2ba9e9,_0x18c2d5){return function(_0x4e3410){if(_0x4e3410){var _0x62e679=typeof _0x18c2d5['offset']===_0x5469('0x1e')&&typeof _0x18c2d5[_0x5469('0x1f')]===_0x5469('0x1e');var _0x5c0875=_0x4e3410[_0x5469('0x20')];var _0x5f4fec=_0x62e679?0x0:_0x18c2d5[_0x5469('0x21')];var _0x356271=_0x62e679?_0x4e3410[_0x5469('0x20')]:_0x18c2d5['offset']+_0x18c2d5[_0x5469('0x1f')];var _0x469e65;if(_0x356271>=_0x5c0875){_0x356271=_0x5c0875;_0x469e65=0xc8;}else{_0x469e65=0xce;}_0x2ba9e9[_0x5469('0x1c')](_0x469e65);return _0x2ba9e9[_0x5469('0x22')](_0x5469('0x23'),_0x5f4fec+'-'+_0x356271+'/'+_0x5c0875)[_0x5469('0x1d')](_0x4e3410);}return null;};}function saveUpdates(_0x393acd){return function(_0x4a4b4d){if(_0x4a4b4d){return _0x4a4b4d['update'](_0x393acd)['then'](function(_0xb5c38a){return _0xb5c38a;});}return null;};}function removeEntity(_0x3f90ff){return function(_0x3dc285){if(_0x3dc285){return _0x3dc285[_0x5469('0x24')]()[_0x5469('0x25')](function(){_0x3f90ff[_0x5469('0x1c')](0xcc)[_0x5469('0x26')]();});}};}function handleEntityNotFound(_0x461891){return function(_0xde678f){if(!_0xde678f){_0x461891[_0x5469('0x27')](0x194);}return _0xde678f;};}function handleError(_0x1dba4f,_0x27d84e){_0x27d84e=_0x27d84e||0x1f4;return function(_0x3afa8f){logger[_0x5469('0x16')](_0x3afa8f[_0x5469('0x28')]);if(_0x3afa8f[_0x5469('0x29')]){delete _0x3afa8f['name'];}_0x1dba4f[_0x5469('0x1c')](_0x27d84e)[_0x5469('0x2a')](_0x3afa8f);};}exports[_0x5469('0x2b')]=function(_0x5d68d8,_0x3a2143){var _0x4558fb={},_0x10bb1f={},_0xa00aa2={'count':0x0,'rows':[]};var _0x51afca=_['map'](db[_0x5469('0x2c')]['rawAttributes'],function(_0x8ca95a){return{'name':_0x8ca95a[_0x5469('0x2d')],'type':_0x8ca95a[_0x5469('0x2e')][_0x5469('0x2f')]};});_0x10bb1f[_0x5469('0x30')]=_[_0x5469('0x31')](_0x51afca,_0x5469('0x29'));_0x10bb1f[_0x5469('0x32')]=_[_0x5469('0x33')](_0x5d68d8['query']);_0x10bb1f[_0x5469('0x34')]=_[_0x5469('0x35')](_0x10bb1f[_0x5469('0x30')],_0x10bb1f[_0x5469('0x32')]);_0x4558fb[_0x5469('0x36')]=_[_0x5469('0x35')](_0x10bb1f[_0x5469('0x30')],qs[_0x5469('0x37')](_0x5d68d8[_0x5469('0x32')][_0x5469('0x37')]));_0x4558fb[_0x5469('0x36')]=_0x4558fb['attributes'][_0x5469('0x38')]?_0x4558fb[_0x5469('0x36')]:_0x10bb1f['model'];if(!_0x5d68d8[_0x5469('0x32')][_0x5469('0x39')](_0x5469('0x3a'))){_0x4558fb[_0x5469('0x1f')]=qs[_0x5469('0x1f')](_0x5d68d8[_0x5469('0x32')]['limit']);_0x4558fb[_0x5469('0x21')]=qs[_0x5469('0x21')](_0x5d68d8[_0x5469('0x32')]['offset']);}_0x4558fb[_0x5469('0x3b')]=qs[_0x5469('0x3c')](_0x5d68d8[_0x5469('0x32')][_0x5469('0x3c')]);_0x4558fb['where']=qs[_0x5469('0x34')](_[_0x5469('0x3d')](_0x5d68d8[_0x5469('0x32')],_0x10bb1f['filters']),_0x51afca);if(_0x5d68d8[_0x5469('0x32')][_0x5469('0x3e')]){_0x4558fb[_0x5469('0x3f')]=_[_0x5469('0x40')](_0x4558fb['where'],{'$or':_[_0x5469('0x31')](_0x51afca,function(_0x262484){if(_0x262484[_0x5469('0x2e')]!=='VIRTUAL'){var _0x29b57f={};_0x29b57f[_0x262484[_0x5469('0x29')]]={'$like':'%'+_0x5d68d8[_0x5469('0x32')][_0x5469('0x3e')]+'%'};return _0x29b57f;}})});}_0x4558fb=_[_0x5469('0x40')]({},_0x4558fb,_0x5d68d8[_0x5469('0x41')]);var _0x6ea36c={'where':_0x4558fb[_0x5469('0x3f')]};return db[_0x5469('0x2c')][_0x5469('0x20')](_0x6ea36c)[_0x5469('0x25')](function(_0x54dadd){_0xa00aa2[_0x5469('0x20')]=_0x54dadd;if(_0x5d68d8[_0x5469('0x32')][_0x5469('0x42')]){_0x4558fb[_0x5469('0x43')]=[{'all':!![]}];}return db[_0x5469('0x2c')][_0x5469('0x44')](_0x4558fb);})[_0x5469('0x25')](function(_0x11e2c9){_0xa00aa2['rows']=_0x11e2c9;return _0xa00aa2;})['then'](respondWithFilteredResult(_0x3a2143,_0x4558fb))[_0x5469('0x1b')](handleError(_0x3a2143,null));};exports[_0x5469('0x45')]=function(_0x13155d,_0x30ede1){var _0x1c908f={'raw':!![],'where':{'id':_0x13155d[_0x5469('0x46')]['id']}},_0x2b90f2={};_0x2b90f2['model']=_[_0x5469('0x33')](db['MailMessage']['rawAttributes']);_0x2b90f2[_0x5469('0x32')]=_[_0x5469('0x33')](_0x13155d['query']);_0x2b90f2[_0x5469('0x34')]=_[_0x5469('0x35')](_0x2b90f2[_0x5469('0x30')],_0x2b90f2[_0x5469('0x32')]);_0x1c908f['attributes']=_[_0x5469('0x35')](_0x2b90f2[_0x5469('0x30')],qs[_0x5469('0x37')](_0x13155d[_0x5469('0x32')]['fields']));_0x1c908f[_0x5469('0x36')]=_0x1c908f[_0x5469('0x36')]['length']?_0x1c908f[_0x5469('0x36')]:_0x2b90f2[_0x5469('0x30')];if(_0x13155d[_0x5469('0x32')][_0x5469('0x42')]){_0x1c908f[_0x5469('0x43')]=[{'all':!![]}];}_0x1c908f=_[_0x5469('0x40')]({},_0x1c908f,_0x13155d[_0x5469('0x41')]);return db[_0x5469('0x2c')][_0x5469('0x47')](_0x1c908f)[_0x5469('0x25')](handleEntityNotFound(_0x30ede1,null))['then'](respondWithResult(_0x30ede1,null))[_0x5469('0x1b')](handleError(_0x30ede1,null));};exports[_0x5469('0x48')]=function(_0x3f3e1a,_0x42b6c8){if(_0x3f3e1a[_0x5469('0x49')]['id']){delete _0x3f3e1a['body']['id'];}return db[_0x5469('0x2c')][_0x5469('0x47')]({'where':{'id':_0x3f3e1a['params']['id']}})['then'](handleEntityNotFound(_0x42b6c8,null))[_0x5469('0x25')](saveUpdates(_0x3f3e1a[_0x5469('0x49')],null))[_0x5469('0x25')](respondWithResult(_0x42b6c8,null))[_0x5469('0x1b')](handleError(_0x42b6c8,null));};exports[_0x5469('0x24')]=function(_0xf9c202,_0xa95a30){return db[_0x5469('0x2c')][_0x5469('0x47')]({'where':{'id':_0xf9c202[_0x5469('0x46')]['id']}})[_0x5469('0x25')](handleEntityNotFound(_0xa95a30,null))[_0x5469('0x25')](removeEntity(_0xa95a30,null))[_0x5469('0x1b')](handleError(_0xa95a30,null));};exports[_0x5469('0x4a')]=function(_0x28df6d,_0x4047c7){return db[_0x5469('0x2c')][_0x5469('0x4a')]()[_0x5469('0x25')](respondWithResult(_0x4047c7,null))[_0x5469('0x1b')](handleError(_0x4047c7,null));};exports['create']=function(_0x19802c,_0x5a5c01){return db[_0x5469('0x2c')][_0x5469('0x4b')](_0x19802c[_0x5469('0x49')])[_0x5469('0x25')](function(_0x462e84){if(_0x462e84){if(_0x462e84['direction']===_0x5469('0x4c')&&!_0x462e84['secret']){var _0x113485,_0x871306,_0x526357;if(_0x19802c[_0x5469('0x49')]['to']){_0x871306=_0x19802c[_0x5469('0x49')]['to'][_0x5469('0x4d')](',')[0x0];}return db['MailAccount'][_0x5469('0x4e')]({'where':{'id':_0x462e84[_0x5469('0x4f')]},'include':[{'model':db[_0x5469('0x50')],'as':_0x5469('0x51'),'include':[{'model':db[_0x5469('0x52')],'as':_0x5469('0x53'),'where':{'email':_0x871306},'limit':0x1,'order':[[_0x5469('0x54'),'DESC']]}]},{'model':db[_0x5469('0x55')],'as':_0x5469('0x56'),'raw':!![]}]})['then'](function(_0x1f7ce8){_0x113485=_0x1f7ce8;if(_0x113485&&_0x113485[_0x5469('0x56')]){var _0x3e36b2={'tls':{'rejectUnauthorized':![]}};if(_[_0x5469('0x57')](_0x113485[_0x5469('0x56')][_0x5469('0x58')])){_0x3e36b2[_0x5469('0x59')]=_0x113485[_0x5469('0x56')][_0x5469('0x59')];_0x3e36b2[_0x5469('0x5a')]=_0x113485[_0x5469('0x56')][_0x5469('0x5a')];_0x3e36b2[_0x5469('0x5b')]=_0x113485[_0x5469('0x56')][_0x5469('0x5b')];if(_0x113485['Smtp'][_0x5469('0x5c')]){_0x3e36b2[_0x5469('0x5d')]={'user':_0x113485[_0x5469('0x56')][_0x5469('0x5e')],'pass':_0x113485[_0x5469('0x56')][_0x5469('0x5f')]};}}else{_0x3e36b2[_0x5469('0x58')]=_0x113485[_0x5469('0x56')][_0x5469('0x58')];_0x3e36b2[_0x5469('0x5d')]={'user':_0x113485[_0x5469('0x56')][_0x5469('0x5e')],'pass':_0x113485[_0x5469('0x56')]['pass']};_0x3e36b2[_0x5469('0x5b')]=_0x113485[_0x5469('0x56')]['secure'];}if(_0x19802c[_0x5469('0x49')][_0x5469('0x60')]&&_0x19802c[_0x5469('0x49')][_0x5469('0x60')][_0x5469('0x38')]){for(var _0x51109c=0x0;_0x51109c<_0x19802c[_0x5469('0x49')][_0x5469('0x60')][_0x5469('0x38')];_0x51109c+=0x1){_0x19802c[_0x5469('0x49')]['attachments'][_0x51109c]={'filename':_0x19802c['body']['attachments'][_0x51109c]['name'],'path':path[_0x5469('0x61')](config['root'],_0x5469('0x62'),_0x19802c['body']['attachments'][_0x51109c][_0x5469('0x63')])};}}_0x526357={'account':_0x3e36b2,'message':_0x19802c[_0x5469('0x49')]};return;}})[_0x5469('0x25')](function(){if(_0x113485[_0x5469('0x51')]){if(_0x113485[_0x5469('0x51')][_0x5469('0x53')]['length']){return _0x113485[_0x5469('0x51')][_0x5469('0x53')][0x0];}else{return db[_0x5469('0x52')]['create'](_[_0x5469('0xa')](_0x19802c[_0x5469('0x49')],{'firstName':_0x19802c[_0x5469('0x49')]['to'],'email':_0x19802c[_0x5469('0x49')]['to'],'phone':_0x19802c['body']['to'],'ListId':_0x113485[_0x5469('0x64')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x5469('0x25')](function(){if(_0x526357){return respondWithRpcPromise('SendMail','sendMail',_0x526357,client9003)['then'](function(_0x5aac80){return _0x462e84[_0x5469('0x48')]({'read':!![],'messageId':_0x5aac80[_0x5469('0x65')],'sentAt':moment()[_0x5469('0x66')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5469('0x1b')](function(_0x5c8750){logger[_0x5469('0x16')]('%s',JSON[_0x5469('0x15')](_0x5c8750));return _0x462e84;});}return _0x462e84;});}return _0x462e84;}})[_0x5469('0x25')](respondWithResult(_0x5a5c01,0xc9))[_0x5469('0x1b')](handleError(_0x5a5c01,null));};exports[_0x5469('0x67')]=function(_0x10859d,_0x4ce03c){var _0x1d0c31={'agent':{},'channel':_0x5469('0x68')};if(_0x10859d[_0x5469('0x49')]['id']){delete _0x10859d[_0x5469('0x49')]['id'];}_0x10859d[_0x5469('0x49')][_0x5469('0x69')]=!![];_0x10859d['body'][_0x5469('0x6a')]=moment()['format'](_0x5469('0x6b'));_0x10859d[_0x5469('0x49')][_0x5469('0x6c')]=_0x10859d['body'][_0x5469('0x6c')]||_0x10859d[_0x5469('0x5e')]['id'];_0x1d0c31[_0x5469('0x6d')]['id']=_0x10859d[_0x5469('0x49')]['UserId'];return db[_0x5469('0x2c')][_0x5469('0x47')]({'where':{'id':_0x10859d[_0x5469('0x46')]['id'],'UserId':null}})[_0x5469('0x25')](handleEntityNotFound(_0x4ce03c,null))[_0x5469('0x25')](saveUpdates(_0x10859d[_0x5469('0x49')],null))['then'](function(_0xccbada){if(_0xccbada){_0x1d0c31[_0x5469('0x19')]=_0xccbada[_0x5469('0x6e')]({'plain':!![]});return db[_0x5469('0x6f')]['find']({'where':{'id':_0xccbada[_0x5469('0x70')]}});}return null;})[_0x5469('0x25')](handleEntityNotFound(_0x4ce03c,null))[_0x5469('0x25')](function(_0x33e402){if(_0x33e402){return _0x33e402[_0x5469('0x48')]({'UserId':_0x10859d[_0x5469('0x49')]['UserId'],'read1stAt':_['isNil'](_0x33e402[_0x5469('0x71')])?moment()[_0x5469('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5469('0x25')](function(_0xfe0537){if(_0xfe0537){_0x1d0c31[_0x5469('0x72')]=_0xfe0537[_0x5469('0x6e')]({'plain':!![]});interaction_log[_0x5469('0x1a')](_0x5469('0x73'),_0x10859d[_0x5469('0x5e')]['id'],_0x10859d[_0x5469('0x5e')][_0x5469('0x29')],_0x10859d[_0x5469('0x5e')][_0x5469('0x74')],_0x1d0c31['interaction']['id'],_0x10859d['body']?JSON['stringify'](_0x10859d[_0x5469('0x49')]):_0x5469('0x75'));return respondWithRpcPromise(_0x5469('0x76'),_0x5469('0x77'),_0x1d0c31);}return null;})[_0x5469('0x25')](function(_0x2965b0){var _0x33a7ed=_0x5469('0x78')+_0x2965b0[_0x5469('0x19')][_0x5469('0x79')];return db['sequelize'][_0x5469('0x32')](_0x33a7ed,{'type':db[_0x5469('0x7a')][_0x5469('0x7b')][_0x5469('0x7c')],'raw':!![]})[_0x5469('0x25')](function(_0x42704a){return _0x42704a;});})[_0x5469('0x25')](function(_0x42c996){if(_0x42c996){_0x1d0c31[_0x5469('0x19')][_0x5469('0x7d')]=_0x42c996[0x0];if(!_0x10859d[_0x5469('0x49')][_0x5469('0x6c')])return;return db[_0x5469('0x7e')][_0x5469('0x47')]({'where':{'id':_0x10859d['body'][_0x5469('0x6c')],'role':'agent'},'attributes':['id','name','fullname',_0x5469('0x7f'),'internal'],'raw':!![]});}return null;})[_0x5469('0x25')](function(_0x31af13){if(!_0x31af13)return null;_0x1d0c31[_0x5469('0x19')][_0x5469('0x6d')]=_0x31af13;return _0x1d0c31;})[_0x5469('0x25')](function(_0x75a3fa){if(_0x75a3fa){if(_0x10859d[_0x5469('0x49')]['manual']){_0x1d0c31[_0x5469('0x19')]['interface']=util['format'](_0x5469('0x80'),_0x10859d[_0x5469('0x5e')][_0x5469('0x29')]);_0x1d0c31[_0x5469('0x19')][_0x5469('0x81')]=_0x1d0c31[_0x5469('0x81')];_0x1d0c31[_0x5469('0x19')][_0x5469('0x82')]=_0x5469('0x67');_0x1d0c31['message'][_0x5469('0x49')]=htmlToText[_0x5469('0x83')](_0x1d0c31[_0x5469('0x19')][_0x5469('0x49')]);return respondWithRpcPromise(_0x5469('0x84'),_0x5469('0x84'),{'event':_0x5469('0x85'),'message':_0x1d0c31[_0x5469('0x19')]},client9002)[_0x5469('0x25')](function(){return _0x1d0c31;});}return _0x1d0c31;}return null;})[_0x5469('0x25')](respondWithResult(_0x4ce03c,null))[_0x5469('0x1b')](handleError(_0x4ce03c,null));};exports[_0x5469('0x86')]=function(_0x2c907e,_0x45a89c){var _0xf1e323={'agent':{},'channel':_0x5469('0x68')};if(_0x2c907e[_0x5469('0x49')]['id']){delete _0x2c907e[_0x5469('0x49')]['id'];}_0x2c907e['body']['UserId']=_0x2c907e[_0x5469('0x49')][_0x5469('0x6c')]||_0x2c907e[_0x5469('0x5e')]['id'];_0xf1e323[_0x5469('0x6d')]['id']=_0x2c907e[_0x5469('0x49')]['UserId'];return db[_0x5469('0x2c')][_0x5469('0x47')]({'where':{'id':_0x2c907e[_0x5469('0x46')]['id'],'UserId':null}})[_0x5469('0x25')](handleEntityNotFound(_0x45a89c,null))['then'](function(_0x1caea4){if(_0x1caea4){_0xf1e323[_0x5469('0x19')]=_0x1caea4[_0x5469('0x6e')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x1caea4[_0x5469('0x70')]}});}return null;})[_0x5469('0x25')](handleEntityNotFound(_0x45a89c,null))[_0x5469('0x25')](function(_0x2867d7){if(_0x2867d7){_0xf1e323[_0x5469('0x72')]=_0x2867d7[_0x5469('0x6e')]({'plain':!![]});interaction_log['info'](_0x5469('0x87'),_0x2c907e[_0x5469('0x5e')]['id'],_0x2c907e[_0x5469('0x5e')][_0x5469('0x29')],_0x2c907e[_0x5469('0x5e')][_0x5469('0x74')],_0xf1e323[_0x5469('0x72')]['id'],_0x2c907e[_0x5469('0x49')]?JSON['stringify'](_0x2c907e[_0x5469('0x49')]):_0x5469('0x75'));return respondWithRpcPromise(_0x5469('0x88'),'rejectMessage',_0xf1e323);}return null;})['then'](function(_0x53b5ed){var _0x2f61e4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x53b5ed[_0x5469('0x19')]['ContactId'];return db[_0x5469('0x89')][_0x5469('0x32')](_0x2f61e4,{'type':db[_0x5469('0x7a')][_0x5469('0x7b')][_0x5469('0x7c')],'raw':!![]})[_0x5469('0x25')](function(_0x3d0142){return _0x3d0142;});})[_0x5469('0x25')](function(_0x5d9f66){if(_0x5d9f66){_0xf1e323[_0x5469('0x19')][_0x5469('0x7d')]=_0x5d9f66[0x0];if(!_0x2c907e[_0x5469('0x49')][_0x5469('0x6c')])return;return db[_0x5469('0x7e')][_0x5469('0x47')]({'where':{'id':_0x2c907e['body']['UserId'],'role':_0x5469('0x6d')},'attributes':['id',_0x5469('0x29'),'fullname',_0x5469('0x7f'),'internal'],'raw':!![]});}return null;})[_0x5469('0x25')](function(_0x2c46a1){if(!_0x2c46a1)return null;_0xf1e323['message'][_0x5469('0x6d')]=_0x2c46a1;return _0xf1e323;})[_0x5469('0x25')](function(_0x219c0b){if(_0x219c0b){_0x219c0b[_0x5469('0x19')]['interface']=util[_0x5469('0x66')](_0x5469('0x80'),_0x2c907e[_0x5469('0x5e')][_0x5469('0x29')]);_0x219c0b[_0x5469('0x19')]['channel']=_0xf1e323[_0x5469('0x81')];_0x219c0b[_0x5469('0x19')][_0x5469('0x82')]=_0x5469('0x86');_0x219c0b[_0x5469('0x19')][_0x5469('0x49')]=htmlToText['fromString'](_0xf1e323[_0x5469('0x19')][_0x5469('0x49')]);respondWithRpcPromise(_0x5469('0x84'),_0x5469('0x84'),{'event':_0x5469('0x8a'),'message':_0x219c0b['message']},client9002);return _0xf1e323;}return null;})[_0x5469('0x25')](respondWithResult(_0x45a89c,null))[_0x5469('0x1b')](handleError(_0x45a89c,null));};exports['download']=function(_0x51fe93,_0x1f8405){var _0x226e79=moment()['unix']()['toString']();var _0x546ad0=path[_0x5469('0x61')](config[_0x5469('0x8b')],_0x5469('0x8c'),_0x5469('0x8d'),_0x5469('0x8e'));var _0x38c17f=path[_0x5469('0x61')](config[_0x5469('0x8b')],_0x5469('0x8c'),_0x5469('0x8d'),_0x5469('0x60'));var _0x5b98f2=util['format'](_0x5469('0x8f'),_0x226e79);return db[_0x5469('0x2c')][_0x5469('0x47')]({'where':{'id':_0x51fe93[_0x5469('0x46')]['id']},'attributes':['id',_0x5469('0x49'),_0x5469('0x90'),'to','cc',_0x5469('0x91'),_0x5469('0x92'),_0x5469('0x93')],'include':_0x51fe93['query'][_0x5469('0x60')]?[{'model':db[_0x5469('0x94')],'as':_0x5469('0x95')}]:undefined})[_0x5469('0x25')](handleEntityNotFound(_0x1f8405,null))[_0x5469('0x25')](function(_0x191604){if(_0x191604){var _0x42ae5d=_0x191604;var _0x288418={'from':_0x42ae5d['from'],'to':_0x42ae5d['to'],'subject':_0x42ae5d['subject'],'html':htmlEntities['decode'](_0x42ae5d[_0x5469('0x49')]),'headers':{'Date':moment(_0x42ae5d['createdAt'])[_0x5469('0x66')](_0x5469('0x96'))},'attachments':[]};if(_0x191604['cc']){_0x288418[_0x5469('0x97')]['Cc']=_0x191604['cc'];}if(_0x191604['bcc']){_0x288418[_0x5469('0x97')][_0x5469('0x98')]=_0x191604[_0x5469('0x91')];}return new BPromise(function(_0xe51073,_0x16261f){if(_0x191604[_0x5469('0x95')]){for(var _0x11e917=0x0;_0x11e917<_0x191604['Attachments'][_0x5469('0x38')];_0x11e917++){var _0xa35526=_0x191604[_0x5469('0x95')][_0x11e917];var _0xebe302=path[_0x5469('0x61')](_0x38c17f,_0xa35526[_0x5469('0x63')]);if(fs[_0x5469('0x99')](_0xebe302)){_0x288418[_0x5469('0x60')]['push']({'name':_0xa35526[_0x5469('0x29')],'contentType':_0xa35526[_0x5469('0x2e')],'data':fs[_0x5469('0x9a')](_0xebe302)});}}}emlformat[_0x5469('0x9b')](_0x288418,function(_0x54af7a,_0x63d9ed){if(_0x54af7a)return _0x16261f(_0x54af7a);fs[_0x5469('0x9c')](path[_0x5469('0x61')](_0x546ad0,_0x5b98f2),_0x63d9ed);return _0xe51073(_0x63d9ed);});});}})['then'](function(_0x4d6b6f){if(_0x4d6b6f){return _0x1f8405[_0x5469('0x9d')](path['join'](_0x546ad0,_0x5b98f2),_0x5b98f2,function(_0x460ad4){if(!_0x460ad4)fs[_0x5469('0x9e')](path['join'](_0x546ad0,_0x5b98f2));});}})['catch'](handleError(_0x1f8405,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 390ae71..1fea9cc 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 _0xd38b=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','emit'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0xd38b,0x193));var _0xbd38=function(_0x242bb9,_0x5575b7){_0x242bb9=_0x242bb9-0x0;var _0x2a2760=_0xd38b[_0x242bb9];return _0x2a2760;};'use strict';var EventEmitter=require(_0xbd38('0x0'));var MailMessage=require(_0xbd38('0x1'))['db'][_0xbd38('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbd38('0x3')](0x0);var events={'afterCreate':_0xbd38('0x4'),'afterUpdate':_0xbd38('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41542e){return function(_0x3cec3f,_0xee05ae,_0x4d93da){MailMessageEvents['emit'](_0x41542e+':'+_0x3cec3f['id'],_0x3cec3f);MailMessageEvents[_0xbd38('0x6')](_0x41542e,_0x3cec3f);_0x4d93da(null);};}for(var e in events){if(events[_0xbd38('0x7')](e)){var event=events[e];MailMessage[_0xbd38('0x8')](e,emitEvent(event));}}module[_0xbd38('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x8b61=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x4be730,_0x341fe4){var _0x54bbe5=function(_0x57aba7){while(--_0x57aba7){_0x4be730['push'](_0x4be730['shift']());}};_0x54bbe5(++_0x341fe4);}(_0x8b61,0x17b));var _0x18b6=function(_0x571230,_0x25dc63){_0x571230=_0x571230-0x0;var _0x481f1a=_0x8b61[_0x571230];return _0x481f1a;};'use strict';var EventEmitter=require(_0x18b6('0x0'));var MailMessage=require(_0x18b6('0x1'))['db'][_0x18b6('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x18b6('0x3')](0x0);var events={'afterCreate':_0x18b6('0x4'),'afterUpdate':_0x18b6('0x5'),'afterDestroy':_0x18b6('0x6')};function emitEvent(_0x5f5a72){return function(_0x23ce8e,_0x54fd5b,_0x7a293a){MailMessageEvents[_0x18b6('0x7')](_0x5f5a72+':'+_0x23ce8e['id'],_0x23ce8e);MailMessageEvents[_0x18b6('0x7')](_0x5f5a72,_0x23ce8e);_0x7a293a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x18b6('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a15f77b..c8c3707 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 _0x207b=['./mailMessage.attributes','exports','define','MailMessage','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','isNil','MailInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment'];(function(_0x12ae97,_0x385f36){var _0xb50847=function(_0x50238c){while(--_0x50238c){_0x12ae97['push'](_0x12ae97['shift']());}};_0xb50847(++_0x385f36);}(_0x207b,0x1f3));var _0xb207=function(_0x699049,_0x51d7d6){_0x699049=_0x699049-0x0;var _0x5e25e4=_0x207b[_0x699049];return _0x5e25e4;};'use strict';var _=require(_0xb207('0x0'));var util=require(_0xb207('0x1'));var logger=require(_0xb207('0x2'))(_0xb207('0x3'));var moment=require(_0xb207('0x4'));var BPromise=require(_0xb207('0x5'));var rp=require(_0xb207('0x6'));var htmlToText=require(_0xb207('0x7'));var fs=require('fs');var path=require(_0xb207('0x8'));var rimraf=require(_0xb207('0x9'));var config=require(_0xb207('0xa'));var attributes=require(_0xb207('0xb'));module[_0xb207('0xc')]=function(_0x248462,_0x5127d8){return _0x248462[_0xb207('0xd')](_0xb207('0xe'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xb207('0xf'),'fields':[_0xb207('0x10'),'subject'],'type':_0xb207('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5dc19d,_0x123381,_0x37c883){if(_0x5dc19d[_0xb207('0x12')]){_0x5dc19d['plainBody']=htmlToText[_0xb207('0x13')](_0x5dc19d[_0xb207('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x37c883(null,_0x123381);},'afterCreate':function(_0x1c002b,_0x54da30,_0x41e20c){var _0x1fafba=_0x248462[_0xb207('0x14')];var _0x19f7b6=_0x1c002b[_0xb207('0x15')]({'plain':!![]});if(_0x19f7b6[_0xb207('0x16')][_0xb207('0x17')]()==='in'||_0x19f7b6[_0xb207('0x16')]['toLowerCase']()==='out'&&!_0x19f7b6[_0xb207('0x18')]&&!_[_0xb207('0x19')](_0x19f7b6['UserId'])){_0x1fafba[_0xb207('0x1a')][_0xb207('0x1b')]({'where':{'id':_0x19f7b6['MailInteractionId']}})['then'](function(_0x155557){if(_0x155557){_0x155557[_0xb207('0x1c')]({'lastMsgAt':_0x19f7b6[_0xb207('0x1d')],'lastMsgDirection':_0x19f7b6[_0xb207('0x16')][_0xb207('0x17')]()});}})[_0xb207('0x1e')](function(_0x245769){console[_0xb207('0x1f')](_0x245769);});}_0x41e20c();}},'charset':_0xb207('0x20'),'collate':_0xb207('0x21')});}; \ No newline at end of file +var _0xd5dc=['util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','messageId','fti_mail_messages','subject','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd5dc,0x9f));var _0xcd5d=function(_0xefb415,_0x3144e2){_0xefb415=_0xefb415-0x0;var _0x1d4a99=_0xd5dc[_0xefb415];return _0x1d4a99;};'use strict';var _=require(_0xcd5d('0x0'));var util=require(_0xcd5d('0x1'));var logger=require(_0xcd5d('0x2'))(_0xcd5d('0x3'));var moment=require(_0xcd5d('0x4'));var BPromise=require(_0xcd5d('0x5'));var rp=require(_0xcd5d('0x6'));var htmlToText=require(_0xcd5d('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd5d('0x8'));var config=require(_0xcd5d('0x9'));var attributes=require(_0xcd5d('0xa'));module[_0xcd5d('0xb')]=function(_0x5a05aa,_0x2e6d42){return _0x5a05aa['define']('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xcd5d('0xc')]},{'name':_0xcd5d('0xd'),'fields':['plainBody',_0xcd5d('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23a50c,_0x44841d,_0x1ec382){if(_0x23a50c[_0xcd5d('0xf')]){_0x23a50c[_0xcd5d('0x10')]=htmlToText[_0xcd5d('0x11')](_0x23a50c['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1ec382(null,_0x44841d);},'afterCreate':function(_0x24ae99,_0x8d3576,_0x2403ab){var _0x506a6a=_0x5a05aa[_0xcd5d('0x12')];var _0x1922d2=_0x24ae99[_0xcd5d('0x13')]({'plain':!![]});if(_0x1922d2[_0xcd5d('0x14')][_0xcd5d('0x15')]()==='in'||_0x1922d2[_0xcd5d('0x14')]['toLowerCase']()===_0xcd5d('0x16')&&!_0x1922d2[_0xcd5d('0x17')]&&!_[_0xcd5d('0x18')](_0x1922d2[_0xcd5d('0x19')])){_0x506a6a['MailInteraction'][_0xcd5d('0x1a')]({'where':{'id':_0x1922d2[_0xcd5d('0x1b')]}})[_0xcd5d('0x1c')](function(_0x1e85d5){if(_0x1e85d5){_0x1e85d5['update']({'lastMsgAt':_0x1922d2[_0xcd5d('0x1d')],'lastMsgDirection':_0x1922d2['direction']['toLowerCase']()});}})['catch'](function(_0x10ea0a){console['error'](_0x10ea0a);});}_0x2403ab();}},'charset':_0xcd5d('0x1e'),'collate':_0xcd5d('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 9be37bb..de54cab 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 _0xc900=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','body','options','raw','debug','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0xc900,0xb3));var _0x0c90=function(_0x71330,_0x7941ee){_0x71330=_0x71330-0x0;var _0x24e508=_0xc900[_0x71330];return _0x24e508;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});config[_0x0c90('0xa')]=_['defaults'](config[_0x0c90('0xa')],{'host':_0x0c90('0xb'),'port':0x18eb});var socket=require(_0x0c90('0xc'))(new Redis(config[_0x0c90('0xa')]));require(_0x0c90('0xd'))[_0x0c90('0xe')](socket);function respondWithRpcPromise(_0x313ce9,_0x18d9fd,_0x3e0df6){return new BPromise(function(_0x34456e,_0x10daeb){return client[_0x0c90('0xf')](_0x313ce9,_0x3e0df6)[_0x0c90('0x10')](function(_0x57917b){logger[_0x0c90('0x11')]('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x0c90('0x12'));logger['debug'](_0x0c90('0x13'),_0x18d9fd,_0x0c90('0x12'),JSON[_0x0c90('0x14')](_0x57917b));if(_0x57917b[_0x0c90('0x15')]){if(_0x57917b[_0x0c90('0x15')]['code']===0x1f4){logger[_0x0c90('0x15')](_0x0c90('0x16'),_0x18d9fd,_0x57917b['error'][_0x0c90('0x17')]);return _0x10daeb(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);return _0x34456e(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}else{logger[_0x0c90('0x11')](_0x0c90('0x16'),_0x18d9fd,_0x0c90('0x12'));_0x34456e(_0x57917b['result'][_0x0c90('0x17')]);}})[_0x0c90('0x18')](function(_0x462d49){logger[_0x0c90('0x15')]('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x462d49);_0x10daeb(_0x462d49);});});}exports[_0x0c90('0x19')]=function(_0xd129ca){var _0x143047=this;return new Promise(function(_0x1241a9,_0x315932){return db[_0x0c90('0x1a')]['create'](_0xd129ca[_0x0c90('0x1b')],{'raw':_0xd129ca['options']?_0xd129ca[_0x0c90('0x1c')][_0x0c90('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2a053a){logger[_0x0c90('0x11')](_0x0c90('0x19'),_0xd129ca);logger[_0x0c90('0x1e')](_0x0c90('0x19'),_0xd129ca,JSON[_0x0c90('0x14')](_0x2a053a));_0x1241a9(_0x2a053a);})['catch'](function(_0x26f0a3){logger[_0x0c90('0x15')]('CreateMailMessage',_0x26f0a3['message'],_0xd129ca);_0x315932(_0x143047[_0x0c90('0x15')](0x1f4,_0x26f0a3[_0x0c90('0x17')]));});});}; \ No newline at end of file +var _0x2032=['register','request','MailMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateMailMessage','create','options','then','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x2032,0xd9));var _0x2203=function(_0x4a59c6,_0x5cbfae){_0x4a59c6=_0x4a59c6-0x0;var _0x513c9c=_0x2032[_0x4a59c6];return _0x513c9c;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});config[_0x2203('0xb')]=_[_0x2203('0xc')](config[_0x2203('0xb')],{'host':_0x2203('0xd'),'port':0x18eb});var socket=require(_0x2203('0xe'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x2203('0xf')](socket);function respondWithRpcPromise(_0x549908,_0x27081c,_0x2972f3){return new BPromise(function(_0x6339c4,_0x5b19df){return client[_0x2203('0x10')](_0x549908,_0x2972f3)['then'](function(_0x3f690a){logger['info'](_0x2203('0x11'),_0x27081c,_0x2203('0x12'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27081c,'request\x20sent',JSON['stringify'](_0x3f690a));if(_0x3f690a['error']){if(_0x3f690a[_0x2203('0x13')]['code']===0x1f4){logger['error'](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x5b19df(_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);}logger[_0x2203('0x13')](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x6339c4(_0x3f690a[_0x2203('0x13')]['message']);}else{logger[_0x2203('0x15')](_0x2203('0x11'),_0x27081c,'request\x20sent');_0x6339c4(_0x3f690a[_0x2203('0x16')][_0x2203('0x14')]);}})['catch'](function(_0x30c6f7){logger['error'](_0x2203('0x11'),_0x27081c,_0x30c6f7);_0x5b19df(_0x30c6f7);});});}exports[_0x2203('0x17')]=function(_0x3c8c34){var _0x3b4034=this;return new Promise(function(_0x15cb1a,_0x449039){return db['MailMessage'][_0x2203('0x18')](_0x3c8c34['body'],{'raw':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2203('0x1a')](function(_0x5bfe61){logger['info'](_0x2203('0x17'),_0x3c8c34);logger['debug']('CreateMailMessage',_0x3c8c34,JSON[_0x2203('0x1b')](_0x5bfe61));_0x15cb1a(_0x5bfe61);})[_0x2203('0x1c')](function(_0x21f930){logger[_0x2203('0x13')](_0x2203('0x17'),_0x21f930[_0x2203('0x14')],_0x3c8c34);_0x449039(_0x3b4034[_0x2203('0x13')](0x1f4,_0x21f930[_0x2203('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 247d0ad..94853ff 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 _0xe60e=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe60e,0x10a));var _0xee60=function(_0x2ed08e,_0x31e039){_0x2ed08e=_0x2ed08e-0x0;var _0x5d98cb=_0xe60e[_0x2ed08e];return _0x5d98cb;};'use strict';var MailMessageEvents=require(_0xee60('0x0'));var events=[_0xee60('0x1'),_0xee60('0x2'),_0xee60('0x3')];function createListener(_0x452c33,_0x2a9df8){return function(_0x23f305){_0x2a9df8[_0xee60('0x4')](_0x452c33,_0x23f305);};}function removeListener(_0x2e4cf4,_0x4ba086){return function(){MailMessageEvents[_0xee60('0x5')](_0x2e4cf4,_0x4ba086);};}exports[_0xee60('0x6')]=function(_0x3d35f7){for(var _0x595ec1=0x0,_0x53b644=events[_0xee60('0x7')];_0x595ec1<_0x53b644;_0x595ec1++){var _0x25e4f6=events[_0x595ec1];var _0x7f8cdf=createListener(_0xee60('0x8')+_0x25e4f6,_0x3d35f7);MailMessageEvents['on'](_0x25e4f6,_0x7f8cdf);}}; \ No newline at end of file +var _0xd8b2=['mailMessage:','save','remove','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b2,0x145));var _0x2d8b=function(_0x359f76,_0x56fd42){_0x359f76=_0x359f76-0x0;var _0x15ca82=_0xd8b2[_0x359f76];return _0x15ca82;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x2d8b('0x0'),_0x2d8b('0x1'),'update'];function createListener(_0x5b239b,_0x5c23e4){return function(_0x3e574a){_0x5c23e4['emit'](_0x5b239b,_0x3e574a);};}function removeListener(_0x12f945,_0x5a2976){return function(){MailMessageEvents[_0x2d8b('0x2')](_0x12f945,_0x5a2976);};}exports[_0x2d8b('0x3')]=function(_0x131eed){for(var _0x43ac4e=0x0,_0xbc7de3=events[_0x2d8b('0x4')];_0x43ac4e<_0xbc7de3;_0x43ac4e++){var _0x428f4c=events[_0x43ac4e];var _0x460910=createListener(_0x2d8b('0x5')+_0x428f4c,_0x131eed);MailMessageEvents['on'](_0x428f4c,_0x460910);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f8d0ef7..4f90f21 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 _0x844f=['getTeams','getAgents','post','create','addTeams','put','delete','removeTeams','/:id/users','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','/describe','isAuthenticated','describe','/:id','/:id/members','/:id/teams'];(function(_0x5dbb04,_0x213d3d){var _0x3de2d9=function(_0x26b1e5){while(--_0x26b1e5){_0x5dbb04['push'](_0x5dbb04['shift']());}};_0x3de2d9(++_0x213d3d);}(_0x844f,0x8c));var _0xf844=function(_0x261228,_0x460a5c){_0x261228=_0x261228-0x0;var _0x26380c=_0x844f[_0x261228];return _0x26380c;};'use strict';var multer=require(_0xf844('0x0'));var util=require(_0xf844('0x1'));var path=require('path');var timeout=require(_0xf844('0x2'));var express=require(_0xf844('0x3'));var router=express[_0xf844('0x4')]();var fs_extra=require(_0xf844('0x5'));var auth=require(_0xf844('0x6'));var interaction=require(_0xf844('0x7'));var config=require('../../config/environment');var controller=require(_0xf844('0x8'));router[_0xf844('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf844('0xa'),auth[_0xf844('0xb')](),controller[_0xf844('0xc')]);router[_0xf844('0x9')](_0xf844('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xf844('0x9')](_0xf844('0xe'),auth[_0xf844('0xb')](),controller['getMembers']);router['get'](_0xf844('0xf'),auth[_0xf844('0xb')](),controller[_0xf844('0x10')]);router[_0xf844('0x9')]('/:id/users',auth[_0xf844('0xb')](),controller[_0xf844('0x11')]);router[_0xf844('0x12')]('/',auth[_0xf844('0xb')](),controller[_0xf844('0x13')]);router[_0xf844('0x12')](_0xf844('0xf'),auth[_0xf844('0xb')](),controller[_0xf844('0x14')]);router['post']('/:id/users',auth[_0xf844('0xb')](),controller['addAgents']);router[_0xf844('0x15')](_0xf844('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf844('0xd'),auth[_0xf844('0xb')](),controller['destroy']);router[_0xf844('0x16')](_0xf844('0xf'),auth[_0xf844('0xb')](),controller[_0xf844('0x17')]);router[_0xf844('0x16')](_0xf844('0x18'),auth['isAuthenticated'](),controller[_0xf844('0x19')]);module['exports']=router; \ No newline at end of file +var _0x439d=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x354b3a,_0xa86d1){var _0x5bf086=function(_0x5d520f){while(--_0x5d520f){_0x354b3a['push'](_0x354b3a['shift']());}};_0x5bf086(++_0xa86d1);}(_0x439d,0xbf));var _0xd439=function(_0x5c4a87,_0x35cd28){_0x5c4a87=_0x5c4a87-0x0;var _0x1a8c55=_0x439d[_0x5c4a87];return _0x1a8c55;};'use strict';var multer=require(_0xd439('0x0'));var util=require('util');var path=require(_0xd439('0x1'));var timeout=require('connect-timeout');var express=require(_0xd439('0x2'));var router=express[_0xd439('0x3')]();var fs_extra=require(_0xd439('0x4'));var auth=require(_0xd439('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd439('0x6'));router[_0xd439('0x7')]('/',auth[_0xd439('0x8')](),controller[_0xd439('0x9')]);router[_0xd439('0x7')](_0xd439('0xa'),auth['isAuthenticated'](),controller[_0xd439('0xb')]);router['get'](_0xd439('0xc'),auth['isAuthenticated'](),controller[_0xd439('0xd')]);router[_0xd439('0x7')](_0xd439('0xe'),auth[_0xd439('0x8')](),controller[_0xd439('0xf')]);router[_0xd439('0x7')](_0xd439('0x10'),auth[_0xd439('0x8')](),controller[_0xd439('0x11')]);router['get'](_0xd439('0x12'),auth[_0xd439('0x8')](),controller['getAgents']);router[_0xd439('0x13')]('/',auth['isAuthenticated'](),controller[_0xd439('0x14')]);router[_0xd439('0x13')](_0xd439('0x10'),auth[_0xd439('0x8')](),controller[_0xd439('0x15')]);router[_0xd439('0x13')](_0xd439('0x12'),auth[_0xd439('0x8')](),controller[_0xd439('0x16')]);router[_0xd439('0x17')](_0xd439('0xc'),auth[_0xd439('0x8')](),controller[_0xd439('0x18')]);router[_0xd439('0x19')](_0xd439('0xc'),auth[_0xd439('0x8')](),controller[_0xd439('0x1a')]);router[_0xd439('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd439('0x1b')]);router['delete']('/:id/users',auth[_0xd439('0x8')](),controller[_0xd439('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 0f28e9e..b8e42de 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 _0xd808=['ENUM','rrmemory','beepall','roundrobin','STRING','name','INTEGER'];(function(_0x522897,_0x1c76c9){var _0x1075b8=function(_0x1b23d5){while(--_0x1b23d5){_0x522897['push'](_0x522897['shift']());}};_0x1075b8(++_0x1c76c9);}(_0xd808,0x162));var _0x8d80=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xd808[_0x47c5bf];return _0x11b779;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8d80('0x0')],'unique':_0x8d80('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8d80('0x0')]},'timeout':{'type':Sequelize[_0x8d80('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8d80('0x3')](_0x8d80('0x4'),_0x8d80('0x5'),_0x8d80('0x6'))}}; \ No newline at end of file +var _0x54d6=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x14ba80,_0x3de3a2){var _0x363901=function(_0x20aee7){while(--_0x20aee7){_0x14ba80['push'](_0x14ba80['shift']());}};_0x363901(++_0x3de3a2);}(_0x54d6,0x171));var _0x654d=function(_0x2b0727,_0xf73311){_0x2b0727=_0x2b0727-0x0;var _0x2ce434=_0x54d6[_0x2b0727];return _0x2ce434;};'use strict';var Sequelize=require(_0x654d('0x0'));module[_0x654d('0x1')]={'name':{'type':Sequelize[_0x654d('0x2')],'unique':_0x654d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x654d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x654d('0x5')](_0x654d('0x6'),_0x654d('0x7'),_0x654d('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4b51259..de18ea6 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 _0x7d89=['pick','filter','merge','includeAll','include','findAll','catch','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','nolimit','order','MailQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','rows','format','%s/%s','SIP','mailPause','getTeams','addTeams','Team','Agents','online','interface','sequelize','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','clone','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','transaction','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where'];(function(_0x84f1ac,_0x3475fc){var _0x28d064=function(_0x2d5e45){while(--_0x2d5e45){_0x84f1ac['push'](_0x84f1ac['shift']());}};_0x28d064(++_0x3475fc);}(_0x7d89,0x158));var _0x97d8=function(_0x2753ef,_0x2ee9c9){_0x2753ef=_0x2753ef-0x0;var _0x21103c=_0x7d89[_0x2753ef];return _0x21103c;};'use strict';var emlformat=require(_0x97d8('0x0'));var rimraf=require(_0x97d8('0x1'));var zipdir=require(_0x97d8('0x2'));var jsonpatch=require(_0x97d8('0x3'));var rp=require(_0x97d8('0x4'));var moment=require(_0x97d8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x97d8('0x6'));var util=require(_0x97d8('0x7'));var path=require('path');var sox=require(_0x97d8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97d8('0x9'));var _=require(_0x97d8('0xa'));var squel=require(_0x97d8('0xb'));var crypto=require(_0x97d8('0xc'));var jsforce=require(_0x97d8('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x97d8('0xe'));var Papa=require(_0x97d8('0xf'));var Redis=require(_0x97d8('0x10'));var authService=require(_0x97d8('0x11'));var qs=require(_0x97d8('0x12'));var as=require(_0x97d8('0x13'));var hardwareService=require(_0x97d8('0x14'));var logger=require(_0x97d8('0x15'))(_0x97d8('0x16'));var utils=require(_0x97d8('0x17'));var config=require(_0x97d8('0x18'));var licenseUtil=require(_0x97d8('0x19'));var db=require(_0x97d8('0x1a'))['db'];config['redis']=_[_0x97d8('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x97d8('0x1c'))(new Redis(config[_0x97d8('0x1d')]));require('./mailQueue.socket')[_0x97d8('0x1e')](socket);function respondWithStatusCode(_0x57dc0c,_0x247559){_0x247559=_0x247559||0xcc;return function(_0x486f95){if(_0x486f95){return _0x57dc0c[_0x97d8('0x1f')](_0x247559);}return _0x57dc0c[_0x97d8('0x20')](_0x247559)[_0x97d8('0x21')]();};}function respondWithResult(_0x3f7dd1,_0x16631e){_0x16631e=_0x16631e||0xc8;return function(_0x349df4){if(_0x349df4){return _0x3f7dd1[_0x97d8('0x20')](_0x16631e)[_0x97d8('0x22')](_0x349df4);}};}function respondWithFilteredResult(_0xa1a7bb,_0x27eb5e){return function(_0x3adb79){if(_0x3adb79){var _0x41055b=typeof _0x27eb5e[_0x97d8('0x23')]==='undefined'&&typeof _0x27eb5e[_0x97d8('0x24')]===_0x97d8('0x25');var _0x4a4bcc=_0x3adb79[_0x97d8('0x26')];var _0x260372=_0x41055b?0x0:_0x27eb5e[_0x97d8('0x23')];var _0xd0a089=_0x41055b?_0x3adb79[_0x97d8('0x26')]:_0x27eb5e[_0x97d8('0x23')]+_0x27eb5e['limit'];var _0x452893;if(_0xd0a089>=_0x4a4bcc){_0xd0a089=_0x4a4bcc;_0x452893=0xc8;}else{_0x452893=0xce;}_0xa1a7bb['status'](_0x452893);return _0xa1a7bb[_0x97d8('0x27')](_0x97d8('0x28'),_0x260372+'-'+_0xd0a089+'/'+_0x4a4bcc)[_0x97d8('0x22')](_0x3adb79);}return null;};}function patchUpdates(_0xe34876){return function(_0x2f1c35){try{jsonpatch['apply'](_0x2f1c35,_0xe34876,!![]);}catch(_0x5f3935){return BPromise['reject'](_0x5f3935);}return _0x2f1c35[_0x97d8('0x29')]();};}function saveUpdates(_0x3146af,_0x104c59){return function(_0x31efb3){if(_0x31efb3){return _0x31efb3[_0x97d8('0x2a')](_0x3146af)[_0x97d8('0x2b')](function(_0x5a2338){return _0x5a2338;});}return null;};}function removeEntity(_0x30b0ef,_0x546183){return function(_0x59f7f4){if(_0x59f7f4){return _0x59f7f4[_0x97d8('0x2c')]()['then'](function(){var _0x5d19b7=_0x59f7f4[_0x97d8('0x2d')]({'plain':!![]});var _0x4e02cd='MailQueues';return db[_0x97d8('0x2e')][_0x97d8('0x2c')]({'where':{'type':_0x4e02cd,'resourceId':_0x5d19b7['id']}})[_0x97d8('0x2b')](function(){return _0x59f7f4;});})[_0x97d8('0x2b')](function(){_0x30b0ef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8207,_0x2c8189){return function(_0x4b883d){if(!_0x4b883d){_0x2c8207[_0x97d8('0x1f')](0x194);}return _0x4b883d;};}function handleError(_0x162759,_0x344d87){_0x344d87=_0x344d87||0x1f4;return function(_0x201a9d){logger[_0x97d8('0x2f')](_0x201a9d[_0x97d8('0x30')]);if(_0x201a9d[_0x97d8('0x31')]){delete _0x201a9d['name'];}_0x162759[_0x97d8('0x20')](_0x344d87)[_0x97d8('0x32')](_0x201a9d);};}exports[_0x97d8('0x33')]=function(_0x4a43f0,_0x2c5bea){var _0x5a3121={},_0x1e1f20={},_0x1506dc={'count':0x0,'rows':[]};var _0x3224e4=_[_0x97d8('0x34')](db[_0x97d8('0x35')][_0x97d8('0x36')],function(_0x1ec5be){return{'name':_0x1ec5be['fieldName'],'type':_0x1ec5be[_0x97d8('0x37')][_0x97d8('0x38')]};});_0x1e1f20[_0x97d8('0x39')]=_['map'](_0x3224e4,_0x97d8('0x31'));_0x1e1f20[_0x97d8('0x3a')]=_['keys'](_0x4a43f0[_0x97d8('0x3a')]);_0x1e1f20[_0x97d8('0x3b')]=_[_0x97d8('0x3c')](_0x1e1f20[_0x97d8('0x39')],_0x1e1f20[_0x97d8('0x3a')]);_0x5a3121[_0x97d8('0x3d')]=_[_0x97d8('0x3c')](_0x1e1f20[_0x97d8('0x39')],qs[_0x97d8('0x3e')](_0x4a43f0[_0x97d8('0x3a')]['fields']));_0x5a3121[_0x97d8('0x3d')]=_0x5a3121[_0x97d8('0x3d')][_0x97d8('0x3f')]?_0x5a3121['attributes']:_0x1e1f20[_0x97d8('0x39')];if(!_0x4a43f0[_0x97d8('0x3a')][_0x97d8('0x40')]('nolimit')){_0x5a3121[_0x97d8('0x24')]=qs[_0x97d8('0x24')](_0x4a43f0[_0x97d8('0x3a')][_0x97d8('0x24')]);_0x5a3121['offset']=qs['offset'](_0x4a43f0[_0x97d8('0x3a')][_0x97d8('0x23')]);}_0x5a3121['order']=qs[_0x97d8('0x41')](_0x4a43f0['query'][_0x97d8('0x41')]);_0x5a3121[_0x97d8('0x42')]=qs[_0x97d8('0x3b')](_[_0x97d8('0x43')](_0x4a43f0[_0x97d8('0x3a')],_0x1e1f20['filters']),_0x3224e4);if(_0x4a43f0[_0x97d8('0x3a')][_0x97d8('0x44')]){_0x5a3121['where']=_[_0x97d8('0x45')](_0x5a3121[_0x97d8('0x42')],{'$or':_[_0x97d8('0x34')](_0x3224e4,function(_0x1a90fe){if(_0x1a90fe[_0x97d8('0x37')]!=='VIRTUAL'){var _0x20e304={};_0x20e304[_0x1a90fe[_0x97d8('0x31')]]={'$like':'%'+_0x4a43f0[_0x97d8('0x3a')][_0x97d8('0x44')]+'%'};return _0x20e304;}})});}_0x5a3121=_[_0x97d8('0x45')]({},_0x5a3121,_0x4a43f0['options']);var _0x2db2de={'where':_0x5a3121['where']};return db['MailQueue'][_0x97d8('0x26')](_0x2db2de)['then'](function(_0x175645){_0x1506dc[_0x97d8('0x26')]=_0x175645;if(_0x4a43f0['query'][_0x97d8('0x46')]){_0x5a3121[_0x97d8('0x47')]=[{'all':!![]}];}return db[_0x97d8('0x35')][_0x97d8('0x48')](_0x5a3121);})['then'](function(_0x469028){_0x1506dc['rows']=_0x469028;return _0x1506dc;})[_0x97d8('0x2b')](respondWithFilteredResult(_0x2c5bea,_0x5a3121))[_0x97d8('0x49')](handleError(_0x2c5bea,null));};exports['show']=function(_0x484461,_0x3027de){var _0x3039fa={'raw':!![],'where':{'id':_0x484461[_0x97d8('0x4a')]['id']}},_0x110b43={};_0x110b43[_0x97d8('0x39')]=_[_0x97d8('0x4b')](db['MailQueue']['rawAttributes']);_0x110b43['query']=_[_0x97d8('0x4b')](_0x484461['query']);_0x110b43['filters']=_[_0x97d8('0x3c')](_0x110b43['model'],_0x110b43[_0x97d8('0x3a')]);_0x3039fa[_0x97d8('0x3d')]=_[_0x97d8('0x3c')](_0x110b43[_0x97d8('0x39')],qs[_0x97d8('0x3e')](_0x484461[_0x97d8('0x3a')][_0x97d8('0x3e')]));_0x3039fa[_0x97d8('0x3d')]=_0x3039fa['attributes'][_0x97d8('0x3f')]?_0x3039fa[_0x97d8('0x3d')]:_0x110b43[_0x97d8('0x39')];if(_0x484461['query'][_0x97d8('0x46')]){_0x3039fa[_0x97d8('0x47')]=[{'all':!![]}];}_0x3039fa=_['merge']({},_0x3039fa,_0x484461[_0x97d8('0x4c')]);return db['MailQueue'][_0x97d8('0x4d')](_0x3039fa)['then'](handleEntityNotFound(_0x3027de,null))['then'](respondWithResult(_0x3027de,null))['catch'](handleError(_0x3027de,null));};exports[_0x97d8('0x4e')]=function(_0x1d781d,_0x3de21f){return db[_0x97d8('0x35')]['create'](_0x1d781d[_0x97d8('0x4f')],{})[_0x97d8('0x2b')](function(_0x2792e5){var _0x3c630f=_0x1d781d['user']['get']({'plain':!![]});if(!_0x3c630f)throw new Error(_0x97d8('0x50'));if(_0x3c630f['role']===_0x97d8('0x51')){var _0x1c0594=_0x2792e5[_0x97d8('0x2d')]({'plain':!![]});var _0x4586bf='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x4586bf,'userProfileId':_0x3c630f[_0x97d8('0x52')]},'raw':!![]})['then'](function(_0x100ff2){if(_0x100ff2&&_0x100ff2['autoAssociation']===0x0){return db[_0x97d8('0x2e')][_0x97d8('0x4e')]({'name':_0x1c0594[_0x97d8('0x31')],'resourceId':_0x1c0594['id'],'type':_0x100ff2['name'],'sectionId':_0x100ff2['id']},{})[_0x97d8('0x2b')](function(){return _0x2792e5;});}else{return _0x2792e5;}})[_0x97d8('0x49')](function(_0x59acf5){logger[_0x97d8('0x2f')](_0x97d8('0x53'),_0x59acf5);throw _0x59acf5;});}return _0x2792e5;})['then'](respondWithResult(_0x3de21f,0xc9))[_0x97d8('0x49')](handleError(_0x3de21f,null));};exports[_0x97d8('0x2a')]=function(_0x2c1bb7,_0x2fc691){if(_0x2c1bb7[_0x97d8('0x4f')]['id']){delete _0x2c1bb7['body']['id'];}return db[_0x97d8('0x35')][_0x97d8('0x4d')]({'where':{'id':_0x2c1bb7[_0x97d8('0x4a')]['id']}})[_0x97d8('0x2b')](handleEntityNotFound(_0x2fc691,null))['then'](saveUpdates(_0x2c1bb7[_0x97d8('0x4f')],null))[_0x97d8('0x2b')](respondWithResult(_0x2fc691,null))[_0x97d8('0x49')](handleError(_0x2fc691,null));};exports[_0x97d8('0x2c')]=function(_0x551d1b,_0x8d48b9){return db[_0x97d8('0x35')][_0x97d8('0x4d')]({'where':{'id':_0x551d1b[_0x97d8('0x4a')]['id']}})[_0x97d8('0x2b')](handleEntityNotFound(_0x8d48b9,null))[_0x97d8('0x2b')](removeEntity(_0x8d48b9,null))[_0x97d8('0x49')](handleError(_0x8d48b9,null));};exports[_0x97d8('0x54')]=function(_0x476453,_0x45d0b6){return db['MailQueue']['describe']()[_0x97d8('0x2b')](respondWithResult(_0x45d0b6,null))[_0x97d8('0x49')](handleError(_0x45d0b6,null));};exports['getMembers']=function(_0x1482b2,_0x3b2cff,_0x43a309){var _0x78afdb={'raw':!![],'where':{}},_0x4f94bb={},_0x531dc4;return db[_0x97d8('0x35')][_0x97d8('0x55')]({'where':{'id':_0x1482b2[_0x97d8('0x4a')]['id']}})[_0x97d8('0x2b')](handleEntityNotFound(_0x3b2cff,null))[_0x97d8('0x2b')](function(_0x2380ca){if(_0x2380ca){_0x531dc4=_0x2380ca['get']({'plain':!![]});_0x4f94bb[_0x97d8('0x39')]=_[_0x97d8('0x4b')](db[_0x97d8('0x56')]['rawAttributes']);_0x4f94bb['query']=_[_0x97d8('0x4b')](_0x1482b2[_0x97d8('0x3a')]);_0x4f94bb[_0x97d8('0x3b')]=_[_0x97d8('0x3c')](_0x4f94bb['model'],_0x4f94bb[_0x97d8('0x3a')]);_0x78afdb[_0x97d8('0x3d')]=_['intersection'](_0x4f94bb['model'],qs[_0x97d8('0x3e')](_0x1482b2[_0x97d8('0x3a')][_0x97d8('0x3e')]));_0x78afdb['attributes']=_0x78afdb[_0x97d8('0x3d')][_0x97d8('0x3f')]?_0x78afdb[_0x97d8('0x3d')]:_0x4f94bb[_0x97d8('0x39')];if(!_0x1482b2[_0x97d8('0x3a')][_0x97d8('0x40')](_0x97d8('0x57'))){_0x78afdb['limit']=qs[_0x97d8('0x24')](_0x1482b2[_0x97d8('0x3a')][_0x97d8('0x24')]);_0x78afdb[_0x97d8('0x23')]=qs[_0x97d8('0x23')](_0x1482b2[_0x97d8('0x3a')]['offset']);}_0x78afdb[_0x97d8('0x58')]=qs[_0x97d8('0x41')](_0x1482b2[_0x97d8('0x3a')][_0x97d8('0x41')]);_0x78afdb[_0x97d8('0x42')]=qs[_0x97d8('0x3b')](_[_0x97d8('0x43')](_0x1482b2[_0x97d8('0x3a')],_0x4f94bb['filters']));_0x78afdb['where'][_0x97d8('0x59')]=_0x2380ca['id'];if(_0x1482b2[_0x97d8('0x3a')][_0x97d8('0x44')]){_0x78afdb[_0x97d8('0x42')]=_['merge'](_0x78afdb[_0x97d8('0x42')],{'$or':_['map'](_0x78afdb[_0x97d8('0x3d')],function(_0x1fbb3f){var _0x176f3b={};_0x176f3b[_0x1fbb3f]={'$like':'%'+_0x1482b2[_0x97d8('0x3a')][_0x97d8('0x44')]+'%'};return _0x176f3b;})});}_0x78afdb=_[_0x97d8('0x45')]({},_0x78afdb,_0x1482b2[_0x97d8('0x4c')]);return db[_0x97d8('0x56')]['findAll'](_0x78afdb);}})['then'](function(_0x1f0aa5){if(_0x1f0aa5){return db[_0x97d8('0x5a')][_0x97d8('0x5b')]({'where':{'id':_[_0x97d8('0x34')](_0x1f0aa5,_0x97d8('0x5c')),'role':'agent'},'attributes':['id','name','mailPause',_0x97d8('0x5d'),_0x97d8('0x5e')]});}})['then'](function(_0x317044){if(_0x317044){return{'count':_0x317044['count'],'rows':_[_0x97d8('0x34')](_0x317044[_0x97d8('0x5f')],function(_0x21e732){return{'membername':_0x21e732[_0x97d8('0x31')],'UserId':_0x21e732['id'],'queue_name':_0x531dc4['name'],'MailQueueId':_0x531dc4['id'],'interface':util[_0x97d8('0x60')](_0x97d8('0x61'),_0x97d8('0x62'),_0x21e732[_0x97d8('0x31')]),'penalty':0x0,'paused':_0x21e732[_0x97d8('0x63')],'createdAt':_0x21e732['createdAt'],'updatedAt':_0x21e732[_0x97d8('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x97d8('0x2b')](respondWithFilteredResult(_0x3b2cff,_0x78afdb))[_0x97d8('0x49')](handleError(_0x3b2cff,null));};exports['getTeams']=function(_0x493834,_0x5df761,_0x96f30a){var _0xaf1597={};var _0x1e2736={};var _0x5c4a11;var _0x498c21;return db[_0x97d8('0x35')][_0x97d8('0x55')]({'where':{'id':_0x493834['params']['id']}})[_0x97d8('0x2b')](handleEntityNotFound(_0x5df761,null))[_0x97d8('0x2b')](function(_0x19b0e0){if(_0x19b0e0){_0x5c4a11=_0x19b0e0;_0x1e2736[_0x97d8('0x39')]=_['keys'](db['Team']['rawAttributes']);_0x1e2736[_0x97d8('0x3a')]=_[_0x97d8('0x4b')](_0x493834[_0x97d8('0x3a')]);_0x1e2736[_0x97d8('0x3b')]=_['intersection'](_0x1e2736[_0x97d8('0x39')],_0x1e2736['query']);_0xaf1597[_0x97d8('0x3d')]=_[_0x97d8('0x3c')](_0x1e2736['model'],qs[_0x97d8('0x3e')](_0x493834[_0x97d8('0x3a')][_0x97d8('0x3e')]));_0xaf1597[_0x97d8('0x3d')]=_0xaf1597[_0x97d8('0x3d')][_0x97d8('0x3f')]?_0xaf1597[_0x97d8('0x3d')]:_0x1e2736[_0x97d8('0x39')];_0xaf1597['order']=qs[_0x97d8('0x41')](_0x493834[_0x97d8('0x3a')]['sort']);_0xaf1597[_0x97d8('0x42')]=qs['filters'](_[_0x97d8('0x43')](_0x493834[_0x97d8('0x3a')],_0x1e2736['filters']));if(_0x493834['query'][_0x97d8('0x44')]){_0xaf1597[_0x97d8('0x42')]=_[_0x97d8('0x45')](_0xaf1597[_0x97d8('0x42')],{'$or':_[_0x97d8('0x34')](_0xaf1597[_0x97d8('0x3d')],function(_0x5a9373){var _0x49fea1={};_0x49fea1[_0x5a9373]={'$like':'%'+_0x493834[_0x97d8('0x3a')]['filter']+'%'};return _0x49fea1;})});}_0xaf1597=_[_0x97d8('0x45')]({},_0xaf1597,_0x493834['options']);return _0x5c4a11[_0x97d8('0x64')](_0xaf1597);}})['then'](function(_0x2c1597){if(_0x2c1597){_0x498c21=_0x2c1597[_0x97d8('0x3f')];if(!_0x493834[_0x97d8('0x3a')][_0x97d8('0x40')]('nolimit')){_0xaf1597[_0x97d8('0x24')]=qs[_0x97d8('0x24')](_0x493834[_0x97d8('0x3a')][_0x97d8('0x24')]);_0xaf1597[_0x97d8('0x23')]=qs[_0x97d8('0x23')](_0x493834[_0x97d8('0x3a')][_0x97d8('0x23')]);}return _0x5c4a11[_0x97d8('0x64')](_0xaf1597);}})[_0x97d8('0x2b')](function(_0x505c78){if(_0x505c78){return _0x505c78?{'count':_0x498c21,'rows':_0x505c78}:null;}})[_0x97d8('0x2b')](respondWithResult(_0x5df761,null))[_0x97d8('0x49')](handleError(_0x5df761,null));};exports[_0x97d8('0x65')]=function(_0x3fa295,_0x2bab7a,_0x4f0ff0){var _0x2307e3=_0x3fa295[_0x97d8('0x4f')]['ids'];return db[_0x97d8('0x66')][_0x97d8('0x48')]({'where':{'id':_0x2307e3},'attributes':['id'],'include':[{'model':db[_0x97d8('0x5a')],'as':_0x97d8('0x67'),'attributes':['id',_0x97d8('0x31'),_0x97d8('0x68'),'voicePause',_0x97d8('0x69')],'raw':!![]}]})['then'](function(_0x3c23c1){if(_0x3c23c1){var _0x4350e6=_['flatMap'](_0x3c23c1,function(_0x41dc16){var _0x4d3d8f=_0x41dc16[_0x97d8('0x2d')]({'plain':!![]});return _0x4d3d8f[_0x97d8('0x67')];});return db[_0x97d8('0x35')][_0x97d8('0x4d')]({'where':{'id':_0x3fa295['params']['id']}})[_0x97d8('0x2b')](function(_0x252ec5){return db[_0x97d8('0x6a')]['transaction'](function(_0x514c10){return _0x252ec5[_0x97d8('0x65')](_0x2307e3,{'transaction':_0x514c10})['then'](function(){return BPromise['each'](_0x4350e6,function(_0x32732c){return db['UserMailQueue'][_0x97d8('0x6b')]({'where':{'UserId':_0x32732c['id'],'MailQueueId':_0x3fa295[_0x97d8('0x4a')]['id']},'transaction':_0x514c10});});})[_0x97d8('0x2b')](function(){_0x4350e6[_0x97d8('0x6c')](function(_0x52ea81){socket['emit'](_0x97d8('0x6d'),{'UserId':_0x52ea81['id'],'MailQueueId':_0x252ec5['id']});});});});});}})[_0x97d8('0x2b')](respondWithStatusCode(_0x2bab7a,null))[_0x97d8('0x49')](handleError(_0x2bab7a,null));};exports[_0x97d8('0x6e')]=function(_0x3b2999,_0x2f5fce,_0x37aa27){return db[_0x97d8('0x66')][_0x97d8('0x48')]({'where':{'id':_0x3b2999[_0x97d8('0x3a')][_0x97d8('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x97d8('0x5a')],'as':_0x97d8('0x67'),'attributes':['id'],'raw':!![]}]})[_0x97d8('0x2b')](handleEntityNotFound(_0x2f5fce,null))['then'](function(_0x37a340){var _0x4bc6bd=_[_0x97d8('0x34')](_0x37a340,'id');var _0x571e19=[];var _0x1c0a0f=[];var _0x18fa22=squel[_0x97d8('0x70')]();_0x18fa22[_0x97d8('0x71')](_0x97d8('0x72'))[_0x97d8('0x73')](_0x97d8('0x74'),'tq')['join'](_0x97d8('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x3b2999[_0x97d8('0x4a')]['id']);for(var _0x5a9b20=0x0;_0x5a9b20<_0x37a340['length'];_0x5a9b20+=0x1){let _0x3fe139=_0x37a340[_0x5a9b20];for(var _0x1ef12c=0x0;_0x1ef12c<_0x3fe139[_0x97d8('0x67')]['length'];_0x1ef12c+=0x1){let _0x6adfcb=_0x3fe139['Agents'][_0x1ef12c];var _0x596458=_0x18fa22[_0x97d8('0x76')]();_0x596458[_0x97d8('0x42')]('ut.UserId\x20=\x20?',_0x6adfcb['id']);_0x1c0a0f[_0x97d8('0x77')](db[_0x97d8('0x6a')]['query'](_0x596458[_0x97d8('0x78')](),{'type':db[_0x97d8('0x6a')][_0x97d8('0x79')][_0x97d8('0x7a')]})['then'](function(_0xadcca6){if(_0xadcca6[_0x97d8('0x3f')]===0x1){return _0x6adfcb['id'];}else{var _0x1f7be5=_[_0x97d8('0x7b')](_[_0x97d8('0x34')](_0xadcca6,_0x97d8('0x7c')),function(_0xf6799){return _['includes'](_0x4bc6bd,_0xf6799);});if(_0x1f7be5){return _0x6adfcb['id'];}}}));}}return BPromise['all'](_0x1c0a0f)[_0x97d8('0x2b')](function(_0x4e5f87){_0x571e19=_(_0x571e19)[_0x97d8('0x7d')](_0x4e5f87)[_0x97d8('0x7e')]()['value']();return db['MailQueue'][_0x97d8('0x4d')]({'where':{'id':_0x3b2999[_0x97d8('0x4a')]['id']}})[_0x97d8('0x2b')](function(_0x2fbfcc){return db['sequelize'][_0x97d8('0x7f')](function(_0x529445){return _0x2fbfcc[_0x97d8('0x6e')](_0x3b2999[_0x97d8('0x3a')][_0x97d8('0x6f')],{'transaction':_0x529445})[_0x97d8('0x2b')](function(){if(!_[_0x97d8('0x80')](_0x571e19)){return _0x2fbfcc[_0x97d8('0x81')](_0x571e19,{'transaction':_0x529445});}})[_0x97d8('0x2b')](function(){_0x571e19[_0x97d8('0x6c')](function(_0x5467b1){socket[_0x97d8('0x82')](_0x97d8('0x83'),{'UserId':_0x5467b1,'MailQueueId':_0x2fbfcc['id']});});});});});});})['then'](respondWithStatusCode(_0x2f5fce,null))[_0x97d8('0x49')](handleError(_0x2f5fce,null));};exports[_0x97d8('0x84')]=function(_0x1710ba,_0x2a3cd2,_0x502df5){return db[_0x97d8('0x35')][_0x97d8('0x4d')]({'where':{'id':_0x1710ba[_0x97d8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a3cd2,null))[_0x97d8('0x2b')](function(_0x37aa2d){if(_0x37aa2d){return _0x37aa2d[_0x97d8('0x84')](_0x1710ba['body'][_0x97d8('0x6f')],_[_0x97d8('0x85')](_0x1710ba[_0x97d8('0x4f')],[_0x97d8('0x6f'),'id'])||{})[_0x97d8('0x86')](function(_0x3f5036){for(var _0x34481d=0x0;_0x34481d<_0x1710ba[_0x97d8('0x4f')][_0x97d8('0x6f')][_0x97d8('0x3f')];_0x34481d+=0x1){socket[_0x97d8('0x82')](_0x97d8('0x6d'),{'UserId':Number(_0x1710ba['body'][_0x97d8('0x6f')][_0x34481d]),'MailQueueId':Number(_0x1710ba[_0x97d8('0x4a')]['id'])});}return _0x3f5036;});}})['then'](respondWithResult(_0x2a3cd2,null))['catch'](handleError(_0x2a3cd2,null));};exports['removeAgents']=function(_0x398e63,_0x45d1c1,_0x1395f6){return db[_0x97d8('0x35')][_0x97d8('0x4d')]({'where':{'id':_0x398e63[_0x97d8('0x4a')]['id']}})[_0x97d8('0x2b')](handleEntityNotFound(_0x45d1c1,null))[_0x97d8('0x2b')](function(_0x55292a){if(_0x55292a){return _0x55292a[_0x97d8('0x81')](_0x398e63['query'][_0x97d8('0x6f')])[_0x97d8('0x2b')](function(){if(_[_0x97d8('0x87')](_0x398e63[_0x97d8('0x3a')][_0x97d8('0x6f')])){for(var _0x4ad03a=0x0;_0x4ad03a<_0x398e63[_0x97d8('0x3a')]['ids']['length'];_0x4ad03a+=0x1){socket[_0x97d8('0x82')](_0x97d8('0x83'),{'UserId':Number(_0x398e63['query'][_0x97d8('0x6f')][_0x4ad03a]),'MailQueueId':Number(_0x398e63[_0x97d8('0x4a')]['id'])});}}else{socket['emit'](_0x97d8('0x83'),{'UserId':Number(_0x398e63[_0x97d8('0x3a')]['ids']),'MailQueueId':Number(_0x398e63['params']['id'])});}});}})[_0x97d8('0x2b')](respondWithStatusCode(_0x45d1c1,null))[_0x97d8('0x49')](handleError(_0x45d1c1,null));};exports['getAgents']=function(_0x2336b4,_0x43370c,_0x5c5f36){var _0x165880={};var _0x43f3db={};var _0xbfd4a6;var _0x22c431;return db[_0x97d8('0x35')]['findOne']({'where':{'id':_0x2336b4['params']['id']}})['then'](handleEntityNotFound(_0x43370c,null))[_0x97d8('0x2b')](function(_0x4bac51){if(_0x4bac51){_0xbfd4a6=_0x4bac51;_0x43f3db[_0x97d8('0x39')]=_[_0x97d8('0x4b')](db[_0x97d8('0x5a')][_0x97d8('0x36')]);_0x43f3db['query']=_[_0x97d8('0x4b')](_0x2336b4['query']);_0x43f3db[_0x97d8('0x3b')]=_['intersection'](_0x43f3db[_0x97d8('0x39')],_0x43f3db[_0x97d8('0x3a')]);_0x165880[_0x97d8('0x3d')]=_[_0x97d8('0x3c')](_0x43f3db[_0x97d8('0x39')],qs[_0x97d8('0x3e')](_0x2336b4[_0x97d8('0x3a')][_0x97d8('0x3e')]));_0x165880['attributes']=_0x165880[_0x97d8('0x3d')][_0x97d8('0x3f')]?_0x165880[_0x97d8('0x3d')]:_0x43f3db[_0x97d8('0x39')];_0x165880[_0x97d8('0x58')]=qs[_0x97d8('0x41')](_0x2336b4[_0x97d8('0x3a')][_0x97d8('0x41')]);_0x165880[_0x97d8('0x42')]=qs[_0x97d8('0x3b')](_[_0x97d8('0x43')](_0x2336b4[_0x97d8('0x3a')],_0x43f3db[_0x97d8('0x3b')]));if(_0x2336b4['query']['filter']){_0x165880[_0x97d8('0x42')]=_['merge'](_0x165880[_0x97d8('0x42')],{'$or':_[_0x97d8('0x34')](_0x165880['attributes'],function(_0x1d48b3){var _0x861f7a={};_0x861f7a[_0x1d48b3]={'$like':'%'+_0x2336b4[_0x97d8('0x3a')][_0x97d8('0x44')]+'%'};return _0x861f7a;})});}_0x165880=_[_0x97d8('0x45')]({},_0x165880,_0x2336b4[_0x97d8('0x4c')]);return _0xbfd4a6[_0x97d8('0x88')](_0x165880);}})[_0x97d8('0x2b')](function(_0x5bd916){if(_0x5bd916){_0x22c431=_0x5bd916['length'];if(!_0x2336b4['query'][_0x97d8('0x40')](_0x97d8('0x57'))){_0x165880[_0x97d8('0x24')]=qs['limit'](_0x2336b4[_0x97d8('0x3a')][_0x97d8('0x24')]);_0x165880['offset']=qs['offset'](_0x2336b4['query']['offset']);}return _0xbfd4a6['getAgents'](_0x165880);}})[_0x97d8('0x2b')](function(_0x4b21bb){if(_0x4b21bb){return _0x4b21bb?{'count':_0x22c431,'rows':_0x4b21bb}:null;}})['then'](respondWithResult(_0x43370c,null))[_0x97d8('0x49')](handleError(_0x43370c,null));}; \ No newline at end of file +var _0x4717=['flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','rimraf','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','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','MailQueues','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserMailQueue','nolimit','pick','MailQueueId','findAndCountAll','UserId','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','User','Agents','voicePause','interface'];(function(_0x5caa1f,_0x4e65c8){var _0x2df31f=function(_0x54cca9){while(--_0x54cca9){_0x5caa1f['push'](_0x5caa1f['shift']());}};_0x2df31f(++_0x4e65c8);}(_0x4717,0x1e1));var _0x7471=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x4717[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7471('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7471('0x1'));var moment=require(_0x7471('0x2'));var BPromise=require(_0x7471('0x3'));var Mustache=require(_0x7471('0x4'));var util=require(_0x7471('0x5'));var path=require(_0x7471('0x6'));var sox=require(_0x7471('0x7'));var csv=require(_0x7471('0x8'));var ejs=require(_0x7471('0x9'));var fs=require('fs');var fs_extra=require(_0x7471('0xa'));var _=require(_0x7471('0xb'));var squel=require(_0x7471('0xc'));var crypto=require('crypto');var jsforce=require(_0x7471('0xd'));var deskjs=require(_0x7471('0xe'));var toCsv=require(_0x7471('0x8'));var querystring=require(_0x7471('0xf'));var Papa=require(_0x7471('0x10'));var Redis=require(_0x7471('0x11'));var authService=require(_0x7471('0x12'));var qs=require(_0x7471('0x13'));var as=require(_0x7471('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7471('0x15'));var utils=require(_0x7471('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7471('0x17'));var db=require(_0x7471('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x7471('0x19'),'port':0x18eb});var socket=require(_0x7471('0x1a'))(new Redis(config[_0x7471('0x1b')]));require(_0x7471('0x1c'))[_0x7471('0x1d')](socket);function respondWithStatusCode(_0xdf38bf,_0x327573){_0x327573=_0x327573||0xcc;return function(_0x42054c){if(_0x42054c){return _0xdf38bf[_0x7471('0x1e')](_0x327573);}return _0xdf38bf[_0x7471('0x1f')](_0x327573)['end']();};}function respondWithResult(_0x2417bc,_0x5d754e){_0x5d754e=_0x5d754e||0xc8;return function(_0x1e4ec2){if(_0x1e4ec2){return _0x2417bc[_0x7471('0x1f')](_0x5d754e)[_0x7471('0x20')](_0x1e4ec2);}};}function respondWithFilteredResult(_0x3cb3a9,_0x50aac1){return function(_0x43734f){if(_0x43734f){var _0x16a659=typeof _0x50aac1[_0x7471('0x21')]===_0x7471('0x22')&&typeof _0x50aac1[_0x7471('0x23')]===_0x7471('0x22');var _0x89c812=_0x43734f[_0x7471('0x24')];var _0x60ce36=_0x16a659?0x0:_0x50aac1[_0x7471('0x21')];var _0x504c74=_0x16a659?_0x43734f[_0x7471('0x24')]:_0x50aac1[_0x7471('0x21')]+_0x50aac1[_0x7471('0x23')];var _0x42e4b7;if(_0x504c74>=_0x89c812){_0x504c74=_0x89c812;_0x42e4b7=0xc8;}else{_0x42e4b7=0xce;}_0x3cb3a9['status'](_0x42e4b7);return _0x3cb3a9[_0x7471('0x25')](_0x7471('0x26'),_0x60ce36+'-'+_0x504c74+'/'+_0x89c812)[_0x7471('0x20')](_0x43734f);}return null;};}function patchUpdates(_0xae1ae4){return function(_0x46eb94){try{jsonpatch[_0x7471('0x27')](_0x46eb94,_0xae1ae4,!![]);}catch(_0x455617){return BPromise['reject'](_0x455617);}return _0x46eb94[_0x7471('0x28')]();};}function saveUpdates(_0x354cb1,_0x550fb9){return function(_0x1ab7e6){if(_0x1ab7e6){return _0x1ab7e6['update'](_0x354cb1)['then'](function(_0x2a6ba4){return _0x2a6ba4;});}return null;};}function removeEntity(_0x55bde8,_0x19f019){return function(_0x3eebef){if(_0x3eebef){return _0x3eebef[_0x7471('0x29')]()[_0x7471('0x2a')](function(){var _0x343539=_0x3eebef[_0x7471('0x2b')]({'plain':!![]});var _0x59431f=_0x7471('0x2c');return db['UserProfileResource'][_0x7471('0x29')]({'where':{'type':_0x59431f,'resourceId':_0x343539['id']}})[_0x7471('0x2a')](function(){return _0x3eebef;});})['then'](function(){_0x55bde8[_0x7471('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6af0,_0x54d3f9){return function(_0x4f854a){if(!_0x4f854a){_0x2b6af0[_0x7471('0x1e')](0x194);}return _0x4f854a;};}function handleError(_0x1a7775,_0x715507){_0x715507=_0x715507||0x1f4;return function(_0x3c0005){logger[_0x7471('0x2d')](_0x3c0005[_0x7471('0x2e')]);if(_0x3c0005['name']){delete _0x3c0005[_0x7471('0x2f')];}_0x1a7775['status'](_0x715507)[_0x7471('0x30')](_0x3c0005);};}exports[_0x7471('0x31')]=function(_0xa9d7ec,_0x54f8fc){var _0x311635={},_0x43d9d0={},_0xc0e812={'count':0x0,'rows':[]};var _0x5827f4=_[_0x7471('0x32')](db[_0x7471('0x33')][_0x7471('0x34')],function(_0x56ea1b){return{'name':_0x56ea1b[_0x7471('0x35')],'type':_0x56ea1b['type'][_0x7471('0x36')]};});_0x43d9d0[_0x7471('0x37')]=_[_0x7471('0x32')](_0x5827f4,'name');_0x43d9d0['query']=_[_0x7471('0x38')](_0xa9d7ec[_0x7471('0x39')]);_0x43d9d0[_0x7471('0x3a')]=_['intersection'](_0x43d9d0[_0x7471('0x37')],_0x43d9d0[_0x7471('0x39')]);_0x311635[_0x7471('0x3b')]=_['intersection'](_0x43d9d0[_0x7471('0x37')],qs[_0x7471('0x3c')](_0xa9d7ec[_0x7471('0x39')][_0x7471('0x3c')]));_0x311635[_0x7471('0x3b')]=_0x311635[_0x7471('0x3b')]['length']?_0x311635['attributes']:_0x43d9d0[_0x7471('0x37')];if(!_0xa9d7ec[_0x7471('0x39')][_0x7471('0x3d')]('nolimit')){_0x311635['limit']=qs[_0x7471('0x23')](_0xa9d7ec[_0x7471('0x39')][_0x7471('0x23')]);_0x311635[_0x7471('0x21')]=qs[_0x7471('0x21')](_0xa9d7ec[_0x7471('0x39')]['offset']);}_0x311635[_0x7471('0x3e')]=qs[_0x7471('0x3f')](_0xa9d7ec['query']['sort']);_0x311635[_0x7471('0x40')]=qs[_0x7471('0x3a')](_['pick'](_0xa9d7ec['query'],_0x43d9d0[_0x7471('0x3a')]),_0x5827f4);if(_0xa9d7ec['query'][_0x7471('0x41')]){_0x311635[_0x7471('0x40')]=_[_0x7471('0x42')](_0x311635[_0x7471('0x40')],{'$or':_[_0x7471('0x32')](_0x5827f4,function(_0x5312c9){if(_0x5312c9[_0x7471('0x43')]!==_0x7471('0x44')){var _0x30296a={};_0x30296a[_0x5312c9['name']]={'$like':'%'+_0xa9d7ec[_0x7471('0x39')][_0x7471('0x41')]+'%'};return _0x30296a;}})});}_0x311635=_[_0x7471('0x42')]({},_0x311635,_0xa9d7ec[_0x7471('0x45')]);var _0x5325dd={'where':_0x311635['where']};return db['MailQueue'][_0x7471('0x24')](_0x5325dd)['then'](function(_0x4ce1a5){_0xc0e812[_0x7471('0x24')]=_0x4ce1a5;if(_0xa9d7ec[_0x7471('0x39')][_0x7471('0x46')]){_0x311635[_0x7471('0x47')]=[{'all':!![]}];}return db[_0x7471('0x33')][_0x7471('0x48')](_0x311635);})['then'](function(_0x3467fe){_0xc0e812[_0x7471('0x49')]=_0x3467fe;return _0xc0e812;})[_0x7471('0x2a')](respondWithFilteredResult(_0x54f8fc,_0x311635))[_0x7471('0x4a')](handleError(_0x54f8fc,null));};exports[_0x7471('0x4b')]=function(_0x32d331,_0x2495b3){var _0x140f85={'raw':!![],'where':{'id':_0x32d331[_0x7471('0x4c')]['id']}},_0x4f673e={};_0x4f673e[_0x7471('0x37')]=_['keys'](db[_0x7471('0x33')]['rawAttributes']);_0x4f673e[_0x7471('0x39')]=_[_0x7471('0x38')](_0x32d331['query']);_0x4f673e[_0x7471('0x3a')]=_['intersection'](_0x4f673e[_0x7471('0x37')],_0x4f673e[_0x7471('0x39')]);_0x140f85[_0x7471('0x3b')]=_[_0x7471('0x4d')](_0x4f673e[_0x7471('0x37')],qs[_0x7471('0x3c')](_0x32d331['query'][_0x7471('0x3c')]));_0x140f85[_0x7471('0x3b')]=_0x140f85[_0x7471('0x3b')][_0x7471('0x4e')]?_0x140f85[_0x7471('0x3b')]:_0x4f673e[_0x7471('0x37')];if(_0x32d331['query'][_0x7471('0x46')]){_0x140f85[_0x7471('0x47')]=[{'all':!![]}];}_0x140f85=_[_0x7471('0x42')]({},_0x140f85,_0x32d331[_0x7471('0x45')]);return db[_0x7471('0x33')][_0x7471('0x4f')](_0x140f85)['then'](handleEntityNotFound(_0x2495b3,null))[_0x7471('0x2a')](respondWithResult(_0x2495b3,null))[_0x7471('0x4a')](handleError(_0x2495b3,null));};exports[_0x7471('0x50')]=function(_0x241400,_0x1104cc){return db[_0x7471('0x33')]['create'](_0x241400[_0x7471('0x51')],{})[_0x7471('0x2a')](function(_0x587c94){var _0x2007d9=_0x241400[_0x7471('0x52')][_0x7471('0x2b')]({'plain':!![]});if(!_0x2007d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2007d9[_0x7471('0x53')]===_0x7471('0x52')){var _0x22e494=_0x587c94['get']({'plain':!![]});var _0x54e2b2=_0x7471('0x2c');return db[_0x7471('0x54')][_0x7471('0x4f')]({'where':{'name':_0x54e2b2,'userProfileId':_0x2007d9[_0x7471('0x55')]},'raw':!![]})[_0x7471('0x2a')](function(_0x36927e){if(_0x36927e&&_0x36927e[_0x7471('0x56')]===0x0){return db[_0x7471('0x57')][_0x7471('0x50')]({'name':_0x22e494[_0x7471('0x2f')],'resourceId':_0x22e494['id'],'type':_0x36927e['name'],'sectionId':_0x36927e['id']},{})['then'](function(){return _0x587c94;});}else{return _0x587c94;}})['catch'](function(_0x23f8cb){logger['error'](_0x7471('0x58'),_0x23f8cb);throw _0x23f8cb;});}return _0x587c94;})[_0x7471('0x2a')](respondWithResult(_0x1104cc,0xc9))[_0x7471('0x4a')](handleError(_0x1104cc,null));};exports[_0x7471('0x59')]=function(_0x426339,_0x1f1eaf){if(_0x426339[_0x7471('0x51')]['id']){delete _0x426339[_0x7471('0x51')]['id'];}return db[_0x7471('0x33')][_0x7471('0x4f')]({'where':{'id':_0x426339[_0x7471('0x4c')]['id']}})[_0x7471('0x2a')](handleEntityNotFound(_0x1f1eaf,null))[_0x7471('0x2a')](saveUpdates(_0x426339[_0x7471('0x51')],null))[_0x7471('0x2a')](respondWithResult(_0x1f1eaf,null))['catch'](handleError(_0x1f1eaf,null));};exports['destroy']=function(_0x1570f3,_0x80a537){return db[_0x7471('0x33')][_0x7471('0x4f')]({'where':{'id':_0x1570f3[_0x7471('0x4c')]['id']}})[_0x7471('0x2a')](handleEntityNotFound(_0x80a537,null))[_0x7471('0x2a')](removeEntity(_0x80a537,null))[_0x7471('0x4a')](handleError(_0x80a537,null));};exports[_0x7471('0x5a')]=function(_0x55e931,_0x48a01b){return db[_0x7471('0x33')]['describe']()[_0x7471('0x2a')](respondWithResult(_0x48a01b,null))['catch'](handleError(_0x48a01b,null));};exports[_0x7471('0x5b')]=function(_0x38ce13,_0x2c52a4,_0x559141){var _0x37b596={'raw':!![],'where':{}},_0x337042={},_0x18f3ef;return db[_0x7471('0x33')]['findOne']({'where':{'id':_0x38ce13[_0x7471('0x4c')]['id']}})[_0x7471('0x2a')](handleEntityNotFound(_0x2c52a4,null))['then'](function(_0x208aba){if(_0x208aba){_0x18f3ef=_0x208aba[_0x7471('0x2b')]({'plain':!![]});_0x337042[_0x7471('0x37')]=_['keys'](db[_0x7471('0x5c')][_0x7471('0x34')]);_0x337042['query']=_[_0x7471('0x38')](_0x38ce13[_0x7471('0x39')]);_0x337042['filters']=_[_0x7471('0x4d')](_0x337042[_0x7471('0x37')],_0x337042[_0x7471('0x39')]);_0x37b596[_0x7471('0x3b')]=_[_0x7471('0x4d')](_0x337042[_0x7471('0x37')],qs['fields'](_0x38ce13[_0x7471('0x39')][_0x7471('0x3c')]));_0x37b596[_0x7471('0x3b')]=_0x37b596[_0x7471('0x3b')][_0x7471('0x4e')]?_0x37b596[_0x7471('0x3b')]:_0x337042[_0x7471('0x37')];if(!_0x38ce13['query']['hasOwnProperty'](_0x7471('0x5d'))){_0x37b596[_0x7471('0x23')]=qs[_0x7471('0x23')](_0x38ce13[_0x7471('0x39')]['limit']);_0x37b596[_0x7471('0x21')]=qs[_0x7471('0x21')](_0x38ce13['query'][_0x7471('0x21')]);}_0x37b596[_0x7471('0x3e')]=qs['sort'](_0x38ce13['query']['sort']);_0x37b596[_0x7471('0x40')]=qs[_0x7471('0x3a')](_[_0x7471('0x5e')](_0x38ce13['query'],_0x337042[_0x7471('0x3a')]));_0x37b596[_0x7471('0x40')][_0x7471('0x5f')]=_0x208aba['id'];if(_0x38ce13[_0x7471('0x39')][_0x7471('0x41')]){_0x37b596[_0x7471('0x40')]=_['merge'](_0x37b596[_0x7471('0x40')],{'$or':_['map'](_0x37b596[_0x7471('0x3b')],function(_0x588c05){var _0x4b7475={};_0x4b7475[_0x588c05]={'$like':'%'+_0x38ce13[_0x7471('0x39')][_0x7471('0x41')]+'%'};return _0x4b7475;})});}_0x37b596=_['merge']({},_0x37b596,_0x38ce13[_0x7471('0x45')]);return db[_0x7471('0x5c')]['findAll'](_0x37b596);}})[_0x7471('0x2a')](function(_0x329227){if(_0x329227){return db['User'][_0x7471('0x60')]({'where':{'id':_[_0x7471('0x32')](_0x329227,_0x7471('0x61')),'role':'agent'},'attributes':['id',_0x7471('0x2f'),_0x7471('0x62'),_0x7471('0x63'),_0x7471('0x64')]});}})[_0x7471('0x2a')](function(_0x45fadc){if(_0x45fadc){return{'count':_0x45fadc[_0x7471('0x24')],'rows':_[_0x7471('0x32')](_0x45fadc[_0x7471('0x49')],function(_0x3b54d7){return{'membername':_0x3b54d7[_0x7471('0x2f')],'UserId':_0x3b54d7['id'],'queue_name':_0x18f3ef[_0x7471('0x2f')],'MailQueueId':_0x18f3ef['id'],'interface':util['format'](_0x7471('0x65'),_0x7471('0x66'),_0x3b54d7[_0x7471('0x2f')]),'penalty':0x0,'paused':_0x3b54d7['mailPause'],'createdAt':_0x3b54d7[_0x7471('0x64')],'updatedAt':_0x3b54d7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7471('0x2a')](respondWithFilteredResult(_0x2c52a4,_0x37b596))[_0x7471('0x4a')](handleError(_0x2c52a4,null));};exports[_0x7471('0x67')]=function(_0x2ee301,_0x4fa815,_0x1f76ea){var _0xdfafbf={};var _0x184d7f={};var _0x4286c4;var _0x3ce564;return db[_0x7471('0x33')]['findOne']({'where':{'id':_0x2ee301['params']['id']}})[_0x7471('0x2a')](handleEntityNotFound(_0x4fa815,null))[_0x7471('0x2a')](function(_0x34b04a){if(_0x34b04a){_0x4286c4=_0x34b04a;_0x184d7f['model']=_[_0x7471('0x38')](db['Team'][_0x7471('0x34')]);_0x184d7f[_0x7471('0x39')]=_[_0x7471('0x38')](_0x2ee301[_0x7471('0x39')]);_0x184d7f[_0x7471('0x3a')]=_[_0x7471('0x4d')](_0x184d7f['model'],_0x184d7f['query']);_0xdfafbf[_0x7471('0x3b')]=_[_0x7471('0x4d')](_0x184d7f[_0x7471('0x37')],qs['fields'](_0x2ee301[_0x7471('0x39')]['fields']));_0xdfafbf[_0x7471('0x3b')]=_0xdfafbf[_0x7471('0x3b')]['length']?_0xdfafbf[_0x7471('0x3b')]:_0x184d7f[_0x7471('0x37')];_0xdfafbf[_0x7471('0x3e')]=qs[_0x7471('0x3f')](_0x2ee301[_0x7471('0x39')][_0x7471('0x3f')]);_0xdfafbf[_0x7471('0x40')]=qs[_0x7471('0x3a')](_['pick'](_0x2ee301[_0x7471('0x39')],_0x184d7f['filters']));if(_0x2ee301[_0x7471('0x39')]['filter']){_0xdfafbf['where']=_[_0x7471('0x42')](_0xdfafbf[_0x7471('0x40')],{'$or':_[_0x7471('0x32')](_0xdfafbf['attributes'],function(_0x50bb74){var _0x532772={};_0x532772[_0x50bb74]={'$like':'%'+_0x2ee301[_0x7471('0x39')]['filter']+'%'};return _0x532772;})});}_0xdfafbf=_[_0x7471('0x42')]({},_0xdfafbf,_0x2ee301[_0x7471('0x45')]);return _0x4286c4[_0x7471('0x67')](_0xdfafbf);}})[_0x7471('0x2a')](function(_0x23f413){if(_0x23f413){_0x3ce564=_0x23f413['length'];if(!_0x2ee301[_0x7471('0x39')]['hasOwnProperty']('nolimit')){_0xdfafbf[_0x7471('0x23')]=qs['limit'](_0x2ee301[_0x7471('0x39')][_0x7471('0x23')]);_0xdfafbf[_0x7471('0x21')]=qs[_0x7471('0x21')](_0x2ee301['query'][_0x7471('0x21')]);}return _0x4286c4[_0x7471('0x67')](_0xdfafbf);}})['then'](function(_0x5a9a91){if(_0x5a9a91){return _0x5a9a91?{'count':_0x3ce564,'rows':_0x5a9a91}:null;}})[_0x7471('0x2a')](respondWithResult(_0x4fa815,null))[_0x7471('0x4a')](handleError(_0x4fa815,null));};exports[_0x7471('0x68')]=function(_0x35d815,_0x33ecbb,_0x305b25){var _0xce9481=_0x35d815[_0x7471('0x51')][_0x7471('0x69')];return db[_0x7471('0x6a')][_0x7471('0x48')]({'where':{'id':_0xce9481},'attributes':['id'],'include':[{'model':db[_0x7471('0x6b')],'as':_0x7471('0x6c'),'attributes':['id','name','online',_0x7471('0x6d'),_0x7471('0x6e')],'raw':!![]}]})[_0x7471('0x2a')](function(_0x2a8a67){if(_0x2a8a67){var _0x51f636=_[_0x7471('0x6f')](_0x2a8a67,function(_0x41eaa8){var _0x45ed80=_0x41eaa8['get']({'plain':!![]});return _0x45ed80[_0x7471('0x6c')];});return db['MailQueue'][_0x7471('0x4f')]({'where':{'id':_0x35d815[_0x7471('0x4c')]['id']}})['then'](function(_0x23ff66){return db[_0x7471('0x70')][_0x7471('0x71')](function(_0xec51eb){return _0x23ff66[_0x7471('0x68')](_0xce9481,{'transaction':_0xec51eb})[_0x7471('0x2a')](function(){return BPromise['each'](_0x51f636,function(_0x53ddea){return db['UserMailQueue'][_0x7471('0x72')]({'where':{'UserId':_0x53ddea['id'],'MailQueueId':_0x35d815[_0x7471('0x4c')]['id']},'transaction':_0xec51eb});});})[_0x7471('0x2a')](function(){_0x51f636[_0x7471('0x73')](function(_0x1014e7){socket[_0x7471('0x74')](_0x7471('0x75'),{'UserId':_0x1014e7['id'],'MailQueueId':_0x23ff66['id']});});});});});}})['then'](respondWithStatusCode(_0x33ecbb,null))[_0x7471('0x4a')](handleError(_0x33ecbb,null));};exports['removeTeams']=function(_0x431729,_0x10611b,_0x7e3ced){return db['Team']['findAll']({'where':{'id':_0x431729[_0x7471('0x39')][_0x7471('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7471('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10611b,null))['then'](function(_0x3e9de0){var _0x85e54=_[_0x7471('0x32')](_0x3e9de0,'id');var _0x3b1e28=[];var _0x35dd8d=[];var _0xe396f0=squel[_0x7471('0x76')]();_0xe396f0[_0x7471('0x77')]('tq.TeamId')[_0x7471('0x78')](_0x7471('0x79'),'tq')[_0x7471('0x7a')](_0x7471('0x7b'),'ut',_0x7471('0x7c'))[_0x7471('0x40')](_0x7471('0x7d'),_0x431729[_0x7471('0x4c')]['id']);for(var _0x194a9b=0x0;_0x194a9b<_0x3e9de0[_0x7471('0x4e')];_0x194a9b+=0x1){let _0x4f1e0c=_0x3e9de0[_0x194a9b];for(var _0xe4a133=0x0;_0xe4a133<_0x4f1e0c[_0x7471('0x6c')][_0x7471('0x4e')];_0xe4a133+=0x1){let _0x31151a=_0x4f1e0c['Agents'][_0xe4a133];var _0x4d54d9=_0xe396f0[_0x7471('0x7e')]();_0x4d54d9[_0x7471('0x40')](_0x7471('0x7f'),_0x31151a['id']);_0x35dd8d[_0x7471('0x80')](db[_0x7471('0x70')][_0x7471('0x39')](_0x4d54d9[_0x7471('0x81')](),{'type':db['sequelize'][_0x7471('0x82')][_0x7471('0x83')]})[_0x7471('0x2a')](function(_0x169624){if(_0x169624[_0x7471('0x4e')]===0x1){return _0x31151a['id'];}else{var _0x341559=_[_0x7471('0x84')](_[_0x7471('0x32')](_0x169624,_0x7471('0x85')),function(_0x95daf4){return _[_0x7471('0x86')](_0x85e54,_0x95daf4);});if(_0x341559){return _0x31151a['id'];}}}));}}return BPromise[_0x7471('0x87')](_0x35dd8d)[_0x7471('0x2a')](function(_0x236d6b){_0x3b1e28=_(_0x3b1e28)[_0x7471('0x88')](_0x236d6b)[_0x7471('0x89')]()[_0x7471('0x8a')]();return db[_0x7471('0x33')][_0x7471('0x4f')]({'where':{'id':_0x431729[_0x7471('0x4c')]['id']}})[_0x7471('0x2a')](function(_0x55a6f2){return db[_0x7471('0x70')][_0x7471('0x71')](function(_0x3207d9){return _0x55a6f2[_0x7471('0x8b')](_0x431729[_0x7471('0x39')][_0x7471('0x69')],{'transaction':_0x3207d9})[_0x7471('0x2a')](function(){if(!_['isEmpty'](_0x3b1e28)){return _0x55a6f2[_0x7471('0x8c')](_0x3b1e28,{'transaction':_0x3207d9});}})[_0x7471('0x2a')](function(){_0x3b1e28[_0x7471('0x73')](function(_0x1b55d6){socket[_0x7471('0x74')](_0x7471('0x8d'),{'UserId':_0x1b55d6,'MailQueueId':_0x55a6f2['id']});});});});});});})[_0x7471('0x2a')](respondWithStatusCode(_0x10611b,null))[_0x7471('0x4a')](handleError(_0x10611b,null));};exports[_0x7471('0x8e')]=function(_0x760d31,_0x467485,_0x166461){return db[_0x7471('0x33')][_0x7471('0x4f')]({'where':{'id':_0x760d31['params']['id']}})['then'](handleEntityNotFound(_0x467485,null))[_0x7471('0x2a')](function(_0x3ebbf0){if(_0x3ebbf0){return _0x3ebbf0['addAgents'](_0x760d31[_0x7471('0x51')][_0x7471('0x69')],_[_0x7471('0x8f')](_0x760d31[_0x7471('0x51')],[_0x7471('0x69'),'id'])||{})[_0x7471('0x90')](function(_0x1fc717){for(var _0x1f527f=0x0;_0x1f527f<_0x760d31['body'][_0x7471('0x69')][_0x7471('0x4e')];_0x1f527f+=0x1){socket[_0x7471('0x74')](_0x7471('0x75'),{'UserId':Number(_0x760d31[_0x7471('0x51')][_0x7471('0x69')][_0x1f527f]),'MailQueueId':Number(_0x760d31[_0x7471('0x4c')]['id'])});}return _0x1fc717;});}})[_0x7471('0x2a')](respondWithResult(_0x467485,null))[_0x7471('0x4a')](handleError(_0x467485,null));};exports[_0x7471('0x8c')]=function(_0x9fe94c,_0x8c3225,_0x53d7dc){return db[_0x7471('0x33')][_0x7471('0x4f')]({'where':{'id':_0x9fe94c[_0x7471('0x4c')]['id']}})[_0x7471('0x2a')](handleEntityNotFound(_0x8c3225,null))[_0x7471('0x2a')](function(_0x2897a1){if(_0x2897a1){return _0x2897a1['removeAgents'](_0x9fe94c[_0x7471('0x39')][_0x7471('0x69')])[_0x7471('0x2a')](function(){if(_[_0x7471('0x91')](_0x9fe94c[_0x7471('0x39')]['ids'])){for(var _0x31e98b=0x0;_0x31e98b<_0x9fe94c['query']['ids'][_0x7471('0x4e')];_0x31e98b+=0x1){socket['emit'](_0x7471('0x8d'),{'UserId':Number(_0x9fe94c[_0x7471('0x39')]['ids'][_0x31e98b]),'MailQueueId':Number(_0x9fe94c[_0x7471('0x4c')]['id'])});}}else{socket[_0x7471('0x74')](_0x7471('0x8d'),{'UserId':Number(_0x9fe94c['query'][_0x7471('0x69')]),'MailQueueId':Number(_0x9fe94c[_0x7471('0x4c')]['id'])});}});}})[_0x7471('0x2a')](respondWithStatusCode(_0x8c3225,null))[_0x7471('0x4a')](handleError(_0x8c3225,null));};exports[_0x7471('0x92')]=function(_0x57fe3f,_0x43e458,_0x471876){var _0x388c47={};var _0x518686={};var _0x1d9810;var _0x19cabe;return db[_0x7471('0x33')][_0x7471('0x93')]({'where':{'id':_0x57fe3f[_0x7471('0x4c')]['id']}})['then'](handleEntityNotFound(_0x43e458,null))[_0x7471('0x2a')](function(_0x2c8d4b){if(_0x2c8d4b){_0x1d9810=_0x2c8d4b;_0x518686[_0x7471('0x37')]=_[_0x7471('0x38')](db['User']['rawAttributes']);_0x518686[_0x7471('0x39')]=_[_0x7471('0x38')](_0x57fe3f[_0x7471('0x39')]);_0x518686['filters']=_[_0x7471('0x4d')](_0x518686[_0x7471('0x37')],_0x518686[_0x7471('0x39')]);_0x388c47['attributes']=_[_0x7471('0x4d')](_0x518686[_0x7471('0x37')],qs['fields'](_0x57fe3f[_0x7471('0x39')]['fields']));_0x388c47[_0x7471('0x3b')]=_0x388c47[_0x7471('0x3b')][_0x7471('0x4e')]?_0x388c47[_0x7471('0x3b')]:_0x518686[_0x7471('0x37')];_0x388c47[_0x7471('0x3e')]=qs[_0x7471('0x3f')](_0x57fe3f[_0x7471('0x39')][_0x7471('0x3f')]);_0x388c47[_0x7471('0x40')]=qs[_0x7471('0x3a')](_['pick'](_0x57fe3f['query'],_0x518686['filters']));if(_0x57fe3f['query'][_0x7471('0x41')]){_0x388c47[_0x7471('0x40')]=_[_0x7471('0x42')](_0x388c47[_0x7471('0x40')],{'$or':_[_0x7471('0x32')](_0x388c47['attributes'],function(_0x1e2ebf){var _0x1cad58={};_0x1cad58[_0x1e2ebf]={'$like':'%'+_0x57fe3f[_0x7471('0x39')][_0x7471('0x41')]+'%'};return _0x1cad58;})});}_0x388c47=_['merge']({},_0x388c47,_0x57fe3f[_0x7471('0x45')]);return _0x1d9810[_0x7471('0x92')](_0x388c47);}})[_0x7471('0x2a')](function(_0x1d71b6){if(_0x1d71b6){_0x19cabe=_0x1d71b6['length'];if(!_0x57fe3f['query'][_0x7471('0x3d')](_0x7471('0x5d'))){_0x388c47[_0x7471('0x23')]=qs[_0x7471('0x23')](_0x57fe3f[_0x7471('0x39')][_0x7471('0x23')]);_0x388c47['offset']=qs['offset'](_0x57fe3f['query']['offset']);}return _0x1d9810[_0x7471('0x92')](_0x388c47);}})[_0x7471('0x2a')](function(_0x3659ac){if(_0x3659ac){return _0x3659ac?{'count':_0x19cabe,'rows':_0x3659ac}:null;}})[_0x7471('0x2a')](respondWithResult(_0x43e458,null))[_0x7471('0x4a')](handleError(_0x43e458,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 628afe5..46b68b4 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 _0x4431=['events','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x294975,_0xba7309){var _0x523628=function(_0x53e7ee){while(--_0x53e7ee){_0x294975['push'](_0x294975['shift']());}};_0x523628(++_0xba7309);}(_0x4431,0x13b));var _0x1443=function(_0xcf3fcc,_0xeceecc){_0xcf3fcc=_0xcf3fcc-0x0;var _0x35cbb1=_0x4431[_0xcf3fcc];return _0x35cbb1;};'use strict';var EventEmitter=require(_0x1443('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1443('0x1'),'afterUpdate':'update','afterDestroy':_0x1443('0x2')};function emitEvent(_0x229738){return function(_0x2021a1,_0x32ff27,_0xd397ed){MailQueueEvents[_0x1443('0x3')](_0x229738+':'+_0x2021a1['id'],_0x2021a1);MailQueueEvents[_0x1443('0x3')](_0x229738,_0x2021a1);_0xd397ed(null);};}for(var e in events){if(events[_0x1443('0x4')](e)){var event=events[e];MailQueue[_0x1443('0x5')](e,emitEvent(event));}}module[_0x1443('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x2186=['MailQueue','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x1f8844,_0x906bd){var _0x3f9b53=function(_0x36c1df){while(--_0x36c1df){_0x1f8844['push'](_0x1f8844['shift']());}};_0x3f9b53(++_0x906bd);}(_0x2186,0x16f));var _0x6218=function(_0x107d3a,_0x5ba79c){_0x107d3a=_0x107d3a-0x0;var _0x506561=_0x2186[_0x107d3a];return _0x506561;};'use strict';var EventEmitter=require(_0x6218('0x0'));var MailQueue=require(_0x6218('0x1'))['db'][_0x6218('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6218('0x3')](0x0);var events={'afterCreate':_0x6218('0x4'),'afterUpdate':_0x6218('0x5'),'afterDestroy':_0x6218('0x6')};function emitEvent(_0x21ab54){return function(_0x4be57c,_0x3b21a4,_0x370886){MailQueueEvents[_0x6218('0x7')](_0x21ab54+':'+_0x4be57c['id'],_0x4be57c);MailQueueEvents[_0x6218('0x7')](_0x21ab54,_0x4be57c);_0x370886(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x6218('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 3343652..ccdb86e 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 _0xc9be=['define','MailQueue','mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','./mailQueue.attributes','exports'];(function(_0xe37cad,_0x9fcbdd){var _0x24593e=function(_0x4170bb){while(--_0x4170bb){_0xe37cad['push'](_0xe37cad['shift']());}};_0x24593e(++_0x9fcbdd);}(_0xc9be,0x1cb));var _0xec9b=function(_0x6beb99,_0x57d4da){_0x6beb99=_0x6beb99-0x0;var _0x241505=_0xc9be[_0x6beb99];return _0x241505;};'use strict';var _=require('lodash');var util=require(_0xec9b('0x0'));var logger=require(_0xec9b('0x1'))(_0xec9b('0x2'));var moment=require(_0xec9b('0x3'));var BPromise=require(_0xec9b('0x4'));var rp=require(_0xec9b('0x5'));var fs=require('fs');var path=require(_0xec9b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xec9b('0x7'));module[_0xec9b('0x8')]=function(_0x2018de,_0x1b60f3){return _0x2018de[_0xec9b('0x9')](_0xec9b('0xa'),attributes,{'tableName':_0xec9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad73=['./mailQueue.attributes','exports','define','MailQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2eb99e,_0x4801ea){var _0x184abd=function(_0x254f21){while(--_0x254f21){_0x2eb99e['push'](_0x2eb99e['shift']());}};_0x184abd(++_0x4801ea);}(_0xad73,0x1f0));var _0x3ad7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad73[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3ad7('0x0'));var logger=require(_0x3ad7('0x1'))(_0x3ad7('0x2'));var moment=require(_0x3ad7('0x3'));var BPromise=require(_0x3ad7('0x4'));var rp=require(_0x3ad7('0x5'));var fs=require('fs');var path=require(_0x3ad7('0x6'));var rimraf=require(_0x3ad7('0x7'));var config=require('../../config/environment');var attributes=require(_0x3ad7('0x8'));module[_0x3ad7('0x9')]=function(_0x2ac4e0,_0x202c16){return _0x2ac4e0[_0x3ad7('0xa')](_0x3ad7('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 75589db..55a08b4 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 _0xb664=['info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowMailQueue','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb664,0x192));var _0x4b66=function(_0x2d6088,_0x143ee6){_0x2d6088=_0x2d6088-0x0;var _0x506a0c=_0xb664[_0x2d6088];return _0x506a0c;};'use strict';var _=require(_0x4b66('0x0'));var util=require(_0x4b66('0x1'));var moment=require(_0x4b66('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b66('0x3'));var fs=require('fs');var Redis=require(_0x4b66('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b66('0x5'));var logger=require(_0x4b66('0x6'))('rpc');var config=require(_0x4b66('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4b66('0x8')][_0x4b66('0x9')]({'port':0x232a});config[_0x4b66('0xa')]=_[_0x4b66('0xb')](config[_0x4b66('0xa')],{'host':_0x4b66('0xc'),'port':0x18eb});var socket=require(_0x4b66('0xd'))(new Redis(config[_0x4b66('0xa')]));require(_0x4b66('0xe'))[_0x4b66('0xf')](socket);function respondWithRpcPromise(_0x125d33,_0xb9ceb8,_0x275315){return new BPromise(function(_0xa232ab,_0x455221){return client[_0x4b66('0x10')](_0x125d33,_0x275315)[_0x4b66('0x11')](function(_0x45331c){logger[_0x4b66('0x12')](_0x4b66('0x13'),_0xb9ceb8,_0x4b66('0x14'));logger['debug'](_0x4b66('0x15'),_0xb9ceb8,_0x4b66('0x14'),JSON[_0x4b66('0x16')](_0x45331c));if(_0x45331c[_0x4b66('0x17')]){if(_0x45331c[_0x4b66('0x17')][_0x4b66('0x18')]===0x1f4){logger['error'](_0x4b66('0x13'),_0xb9ceb8,_0x45331c[_0x4b66('0x17')][_0x4b66('0x19')]);return _0x455221(_0x45331c[_0x4b66('0x17')][_0x4b66('0x19')]);}logger[_0x4b66('0x17')](_0x4b66('0x13'),_0xb9ceb8,_0x45331c[_0x4b66('0x17')][_0x4b66('0x19')]);return _0xa232ab(_0x45331c[_0x4b66('0x17')][_0x4b66('0x19')]);}else{logger[_0x4b66('0x12')]('MailQueue,\x20%s,\x20%s',_0xb9ceb8,_0x4b66('0x14'));_0xa232ab(_0x45331c[_0x4b66('0x1a')]['message']);}})[_0x4b66('0x1b')](function(_0x5ae083){logger[_0x4b66('0x17')](_0x4b66('0x13'),_0xb9ceb8,_0x5ae083);_0x455221(_0x5ae083);});});}exports[_0x4b66('0x1c')]=function(_0xf6b696){var _0x52ed39=this;return new Promise(function(_0x54e111,_0x24bb05){return db[_0x4b66('0x1d')][_0x4b66('0x1e')]({'raw':_0xf6b696['options']?_0xf6b696[_0x4b66('0x1f')][_0x4b66('0x20')]===undefined?!![]:![]:!![],'where':_0xf6b696['options']?_0xf6b696[_0x4b66('0x1f')][_0x4b66('0x21')]||null:null,'attributes':_0xf6b696[_0x4b66('0x1f')]?_0xf6b696[_0x4b66('0x1f')][_0x4b66('0x22')]||null:null,'limit':_0xf6b696[_0x4b66('0x1f')]?_0xf6b696[_0x4b66('0x1f')][_0x4b66('0x23')]||null:null,'include':_0xf6b696[_0x4b66('0x1f')]?_0xf6b696[_0x4b66('0x1f')][_0x4b66('0x24')]?_[_0x4b66('0x25')](_0xf6b696['options'][_0x4b66('0x24')],function(_0x334fcd){return{'model':db[_0x334fcd[_0x4b66('0x26')]],'as':_0x334fcd['as'],'attributes':_0x334fcd[_0x4b66('0x22')],'include':_0x334fcd[_0x4b66('0x24')]?_[_0x4b66('0x25')](_0x334fcd[_0x4b66('0x24')],function(_0x437215){return{'model':db[_0x437215['model']],'as':_0x437215['as'],'attributes':_0x437215[_0x4b66('0x22')],'include':_0x437215[_0x4b66('0x24')]?_[_0x4b66('0x25')](_0x437215[_0x4b66('0x24')],function(_0x27c962){return{'model':db[_0x27c962[_0x4b66('0x26')]],'as':_0x27c962['as'],'attributes':_0x27c962[_0x4b66('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4b66('0x11')](function(_0x4d22e5){logger[_0x4b66('0x12')](_0x4b66('0x1c'),_0xf6b696);logger[_0x4b66('0x27')](_0x4b66('0x1c'),_0xf6b696,JSON[_0x4b66('0x16')](_0x4d22e5));_0x54e111(_0x4d22e5);})[_0x4b66('0x1b')](function(_0x1c8ad6){logger['error']('GetMailQueue',_0x1c8ad6[_0x4b66('0x19')],_0xf6b696);_0x24bb05(_0x52ed39[_0x4b66('0x17')](0x1f4,_0x1c8ad6[_0x4b66('0x19')]));});});};exports[_0x4b66('0x28')]=function(_0x38f769){var _0x445540=this;return new Promise(function(_0x22cc63,_0x138751){return db[_0x4b66('0x1d')][_0x4b66('0x29')]({'raw':_0x38f769[_0x4b66('0x1f')]?_0x38f769[_0x4b66('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x38f769[_0x4b66('0x1f')]?_0x38f769[_0x4b66('0x1f')][_0x4b66('0x21')]||null:null,'attributes':_0x38f769['options']?_0x38f769[_0x4b66('0x1f')][_0x4b66('0x22')]||null:null,'include':_0x38f769[_0x4b66('0x1f')]?_0x38f769['options']['include']?_[_0x4b66('0x25')](_0x38f769['options'][_0x4b66('0x24')],function(_0x5c1950){return{'model':db[_0x5c1950[_0x4b66('0x26')]],'as':_0x5c1950['as'],'attributes':_0x5c1950[_0x4b66('0x22')],'include':_0x5c1950[_0x4b66('0x24')]?_[_0x4b66('0x25')](_0x5c1950[_0x4b66('0x24')],function(_0x187d22){return{'model':db[_0x187d22[_0x4b66('0x26')]],'as':_0x187d22['as'],'attributes':_0x187d22['attributes'],'include':_0x187d22[_0x4b66('0x24')]?_[_0x4b66('0x25')](_0x187d22[_0x4b66('0x24')],function(_0xee1b78){return{'model':db[_0xee1b78['model']],'as':_0xee1b78['as'],'attributes':_0xee1b78[_0x4b66('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4b66('0x11')](function(_0x21eb25){logger[_0x4b66('0x12')](_0x4b66('0x28'),_0x38f769);logger[_0x4b66('0x27')](_0x4b66('0x28'),_0x38f769,JSON[_0x4b66('0x16')](_0x21eb25));_0x22cc63(_0x21eb25);})['catch'](function(_0x348509){logger[_0x4b66('0x17')](_0x4b66('0x28'),_0x348509[_0x4b66('0x19')],_0x38f769);_0x138751(_0x445540[_0x4b66('0x17')](0x1f4,_0x348509['message']));});});}; \ No newline at end of file +var _0xd89a=['socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','catch','ShowMailQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x2b72d7,_0x39e8e9){var _0x49536f=function(_0x314807){while(--_0x314807){_0x2b72d7['push'](_0x2b72d7['shift']());}};_0x49536f(++_0x39e8e9);}(_0xd89a,0x6b));var _0xad89=function(_0x18c3ca,_0x3c800f){_0x18c3ca=_0x18c3ca-0x0;var _0xa9521a=_0xd89a[_0x18c3ca];return _0xa9521a;};'use strict';var _=require(_0xad89('0x0'));var util=require('util');var moment=require(_0xad89('0x1'));var BPromise=require(_0xad89('0x2'));var rs=require(_0xad89('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad89('0x4'))['db'];var utils=require(_0xad89('0x5'));var logger=require('../../config/logger')(_0xad89('0x6'));var config=require(_0xad89('0x7'));var jayson=require(_0xad89('0x8'));var client=jayson[_0xad89('0x9')][_0xad89('0xa')]({'port':0x232a});config[_0xad89('0xb')]=_['defaults'](config[_0xad89('0xb')],{'host':_0xad89('0xc'),'port':0x18eb});var socket=require(_0xad89('0xd'))(new Redis(config[_0xad89('0xb')]));require(_0xad89('0xe'))[_0xad89('0xf')](socket);function respondWithRpcPromise(_0x39a06d,_0x41c409,_0x2f5d9b){return new BPromise(function(_0x3ae8bc,_0x326052){return client[_0xad89('0x10')](_0x39a06d,_0x2f5d9b)[_0xad89('0x11')](function(_0x46f9bf){logger[_0xad89('0x12')](_0xad89('0x13'),_0x41c409,_0xad89('0x14'));logger[_0xad89('0x15')](_0xad89('0x16'),_0x41c409,_0xad89('0x14'),JSON[_0xad89('0x17')](_0x46f9bf));if(_0x46f9bf['error']){if(_0x46f9bf['error'][_0xad89('0x18')]===0x1f4){logger[_0xad89('0x19')](_0xad89('0x13'),_0x41c409,_0x46f9bf[_0xad89('0x19')][_0xad89('0x1a')]);return _0x326052(_0x46f9bf['error'][_0xad89('0x1a')]);}logger['error'](_0xad89('0x13'),_0x41c409,_0x46f9bf[_0xad89('0x19')][_0xad89('0x1a')]);return _0x3ae8bc(_0x46f9bf[_0xad89('0x19')][_0xad89('0x1a')]);}else{logger[_0xad89('0x12')](_0xad89('0x13'),_0x41c409,_0xad89('0x14'));_0x3ae8bc(_0x46f9bf[_0xad89('0x1b')][_0xad89('0x1a')]);}})['catch'](function(_0x18dc90){logger[_0xad89('0x19')](_0xad89('0x13'),_0x41c409,_0x18dc90);_0x326052(_0x18dc90);});});}exports[_0xad89('0x1c')]=function(_0x2e0083){var _0x24e921=this;return new Promise(function(_0x5cc7f1,_0x2196c4){return db[_0xad89('0x1d')][_0xad89('0x1e')]({'raw':_0x2e0083[_0xad89('0x1f')]?_0x2e0083[_0xad89('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2e0083[_0xad89('0x1f')]?_0x2e0083['options'][_0xad89('0x20')]||null:null,'attributes':_0x2e0083['options']?_0x2e0083[_0xad89('0x1f')][_0xad89('0x21')]||null:null,'limit':_0x2e0083[_0xad89('0x1f')]?_0x2e0083['options'][_0xad89('0x22')]||null:null,'include':_0x2e0083[_0xad89('0x1f')]?_0x2e0083[_0xad89('0x1f')][_0xad89('0x23')]?_[_0xad89('0x24')](_0x2e0083[_0xad89('0x1f')][_0xad89('0x23')],function(_0x2bc22c){return{'model':db[_0x2bc22c[_0xad89('0x25')]],'as':_0x2bc22c['as'],'attributes':_0x2bc22c[_0xad89('0x21')],'include':_0x2bc22c[_0xad89('0x23')]?_[_0xad89('0x24')](_0x2bc22c[_0xad89('0x23')],function(_0x8d6c00){return{'model':db[_0x8d6c00[_0xad89('0x25')]],'as':_0x8d6c00['as'],'attributes':_0x8d6c00[_0xad89('0x21')],'include':_0x8d6c00[_0xad89('0x23')]?_[_0xad89('0x24')](_0x8d6c00[_0xad89('0x23')],function(_0x818f57){return{'model':db[_0x818f57[_0xad89('0x25')]],'as':_0x818f57['as'],'attributes':_0x818f57[_0xad89('0x21')]};}):[]};}):[]};}):[]:[]})[_0xad89('0x11')](function(_0x3d5250){logger[_0xad89('0x12')]('GetMailQueue',_0x2e0083);logger[_0xad89('0x15')](_0xad89('0x1c'),_0x2e0083,JSON[_0xad89('0x17')](_0x3d5250));_0x5cc7f1(_0x3d5250);})[_0xad89('0x26')](function(_0x2b58d8){logger[_0xad89('0x19')](_0xad89('0x1c'),_0x2b58d8[_0xad89('0x1a')],_0x2e0083);_0x2196c4(_0x24e921[_0xad89('0x19')](0x1f4,_0x2b58d8[_0xad89('0x1a')]));});});};exports['ShowMailQueue']=function(_0x429b52){var _0xd1198d=this;return new Promise(function(_0x1e373e,_0x2c752c){return db[_0xad89('0x1d')]['find']({'raw':_0x429b52['options']?_0x429b52['options']['raw']===undefined?!![]:![]:!![],'where':_0x429b52[_0xad89('0x1f')]?_0x429b52['options'][_0xad89('0x20')]||null:null,'attributes':_0x429b52[_0xad89('0x1f')]?_0x429b52[_0xad89('0x1f')][_0xad89('0x21')]||null:null,'include':_0x429b52['options']?_0x429b52[_0xad89('0x1f')][_0xad89('0x23')]?_['map'](_0x429b52['options'][_0xad89('0x23')],function(_0x135c93){return{'model':db[_0x135c93[_0xad89('0x25')]],'as':_0x135c93['as'],'attributes':_0x135c93[_0xad89('0x21')],'include':_0x135c93[_0xad89('0x23')]?_[_0xad89('0x24')](_0x135c93['include'],function(_0x185fb8){return{'model':db[_0x185fb8[_0xad89('0x25')]],'as':_0x185fb8['as'],'attributes':_0x185fb8[_0xad89('0x21')],'include':_0x185fb8['include']?_['map'](_0x185fb8[_0xad89('0x23')],function(_0x3a8fbd){return{'model':db[_0x3a8fbd['model']],'as':_0x3a8fbd['as'],'attributes':_0x3a8fbd[_0xad89('0x21')]};}):[]};}):[]};}):[]:[]})[_0xad89('0x11')](function(_0x3d16c5){logger[_0xad89('0x12')](_0xad89('0x27'),_0x429b52);logger[_0xad89('0x15')](_0xad89('0x27'),_0x429b52,JSON[_0xad89('0x17')](_0x3d16c5));_0x1e373e(_0x3d16c5);})[_0xad89('0x26')](function(_0x10970a){logger[_0xad89('0x19')]('ShowMailQueue',_0x10970a[_0xad89('0x1a')],_0x429b52);_0x2c752c(_0xd1198d[_0xad89('0x19')](0x1f4,_0x10970a[_0xad89('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index fad9aad..86c4c8e 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 _0x1e50=['update','emit','register','length','mailQueue:','save','remove'];(function(_0x2a2f97,_0x473212){var _0x19149c=function(_0x1a5df3){while(--_0x1a5df3){_0x2a2f97['push'](_0x2a2f97['shift']());}};_0x19149c(++_0x473212);}(_0x1e50,0xa6));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x01e5('0x0'),_0x01e5('0x1'),_0x01e5('0x2')];function createListener(_0x4dd0a0,_0x359139){return function(_0x41ca00){_0x359139[_0x01e5('0x3')](_0x4dd0a0,_0x41ca00);};}function removeListener(_0x19f39a,_0x12f461){return function(){MailQueueEvents['removeListener'](_0x19f39a,_0x12f461);};}exports[_0x01e5('0x4')]=function(_0x1f6db6){for(var _0x4f331a=0x0,_0x1eb2b1=events[_0x01e5('0x5')];_0x4f331a<_0x1eb2b1;_0x4f331a++){var _0x2c0305=events[_0x4f331a];var _0x6aaf5e=createListener(_0x01e5('0x6')+_0x2c0305,_0x1f6db6);MailQueueEvents['on'](_0x2c0305,_0x6aaf5e);}}; \ No newline at end of file +var _0x26f0=['emit','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0xf64716,_0x3002c8){var _0x76b08b=function(_0x417cad){while(--_0x417cad){_0xf64716['push'](_0xf64716['shift']());}};_0x76b08b(++_0x3002c8);}(_0x26f0,0xf4));var _0x026f=function(_0x48df24,_0xea6d17){_0x48df24=_0x48df24-0x0;var _0xdc179c=_0x26f0[_0x48df24];return _0xdc179c;};'use strict';var MailQueueEvents=require(_0x026f('0x0'));var events=[_0x026f('0x1'),_0x026f('0x2'),_0x026f('0x3')];function createListener(_0x5a1e17,_0x3a44e8){return function(_0x14d7f8){_0x3a44e8[_0x026f('0x4')](_0x5a1e17,_0x14d7f8);};}function removeListener(_0x378202,_0x28a7f0){return function(){MailQueueEvents['removeListener'](_0x378202,_0x28a7f0);};}exports[_0x026f('0x5')]=function(_0x57cf6f){for(var _0x4206b3=0x0,_0x51a294=events[_0x026f('0x6')];_0x4206b3<_0x51a294;_0x4206b3++){var _0x2cea10=events[_0x4206b3];var _0x5dc285=createListener(_0x026f('0x7')+_0x2cea10,_0x57cf6f);MailQueueEvents['on'](_0x2cea10,_0x5dc285);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 22b2524..fe37190 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 _0x4d5d=['/:id','delete','multer','connect-timeout','Router','fs-extra','../../components/auth/service','./mailQueueReport.controller','get','index','isAuthenticated','describe','show'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x4d5d,0x1a2));var _0xd4d5=function(_0xf96956,_0x201650){_0xf96956=_0xf96956-0x0;var _0x314653=_0x4d5d[_0xf96956];return _0x314653;};'use strict';var multer=require(_0xd4d5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd4d5('0x1'));var express=require('express');var router=express[_0xd4d5('0x2')]();var fs_extra=require(_0xd4d5('0x3'));var auth=require(_0xd4d5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd4d5('0x5'));router[_0xd4d5('0x6')]('/',auth['isAuthenticated'](),controller[_0xd4d5('0x7')]);router[_0xd4d5('0x6')]('/describe',auth[_0xd4d5('0x8')](),controller[_0xd4d5('0x9')]);router[_0xd4d5('0x6')]('/:id',auth[_0xd4d5('0x8')](),controller[_0xd4d5('0xa')]);router['post']('/',auth[_0xd4d5('0x8')](),controller['create']);router['put'](_0xd4d5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xd4d5('0xc')]('/:id',auth[_0xd4d5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2720=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','create','/:id','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2720,0x1dd));var _0x0272=function(_0x2e5197,_0x145c06){_0x2e5197=_0x2e5197-0x0;var _0x3dd1d2=_0x2720[_0x2e5197];return _0x3dd1d2;};'use strict';var multer=require(_0x0272('0x0'));var util=require('util');var path=require(_0x0272('0x1'));var timeout=require(_0x0272('0x2'));var express=require(_0x0272('0x3'));var router=express['Router']();var fs_extra=require(_0x0272('0x4'));var auth=require(_0x0272('0x5'));var interaction=require(_0x0272('0x6'));var config=require(_0x0272('0x7'));var controller=require('./mailQueueReport.controller');router[_0x0272('0x8')]('/',auth['isAuthenticated'](),controller[_0x0272('0x9')]);router[_0x0272('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0272('0x8')]('/:id',auth[_0x0272('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0272('0xb')]);router['put'](_0x0272('0xc'),auth[_0x0272('0xa')](),controller['update']);router[_0x0272('0xd')](_0x0272('0xc'),auth[_0x0272('0xa')](),controller[_0x0272('0xe')]);module[_0x0272('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 469cdea..d7aed94 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 _0xb777=['exports','STRING','DATE','sequelize'];(function(_0x1480bb,_0x5de613){var _0x1c3289=function(_0x18e292){while(--_0x18e292){_0x1480bb['push'](_0x1480bb['shift']());}};_0x1c3289(++_0x5de613);}(_0xb777,0x107));var _0x7b77=function(_0x10be58,_0x41cdad){_0x10be58=_0x10be58-0x0;var _0x14deb3=_0xb777[_0x10be58];return _0x14deb3;};'use strict';var moment=require('moment');var Sequelize=require(_0x7b77('0x0'));module[_0x7b77('0x1')]={'uniqueid':{'type':Sequelize[_0x7b77('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7b77('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7b77('0x3')]},'acceptAt':{'type':Sequelize[_0x7b77('0x3')]},'exitAt':{'type':Sequelize[_0x7b77('0x3')]},'reason':{'type':Sequelize[_0x7b77('0x2')]}}; \ No newline at end of file +var _0x340b=['STRING','DATE','moment','sequelize'];(function(_0x26cb01,_0x16b442){var _0x11c1e8=function(_0x38b113){while(--_0x38b113){_0x26cb01['push'](_0x26cb01['shift']());}};_0x11c1e8(++_0x16b442);}(_0x340b,0x15a));var _0xb340=function(_0x14b01a,_0x347050){_0x14b01a=_0x14b01a-0x0;var _0x369967=_0x340b[_0x14b01a];return _0x369967;};'use strict';var moment=require(_0xb340('0x0'));var Sequelize=require(_0xb340('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb340('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb340('0x2')]},'joinAt':{'type':Sequelize[_0xb340('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb340('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 036787b..8bfc7d0 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 _0x0424=['index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','MailQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send'];(function(_0xd4d369,_0x4f6ad2){var _0x293e5d=function(_0xb0e6a4){while(--_0xb0e6a4){_0xd4d369['push'](_0xd4d369['shift']());}};_0x293e5d(++_0x4f6ad2);}(_0x0424,0x159));var _0x4042=function(_0x35a329,_0x488fee){_0x35a329=_0x35a329-0x0;var _0x4cbdb1=_0x0424[_0x35a329];return _0x4cbdb1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4042('0x0'));var jsonpatch=require(_0x4042('0x1'));var rp=require(_0x4042('0x2'));var moment=require(_0x4042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4042('0x5'));var csv=require(_0x4042('0x6'));var ejs=require(_0x4042('0x7'));var fs=require('fs');var fs_extra=require(_0x4042('0x8'));var _=require(_0x4042('0x9'));var squel=require(_0x4042('0xa'));var crypto=require(_0x4042('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4042('0x6'));var querystring=require(_0x4042('0xc'));var Papa=require(_0x4042('0xd'));var Redis=require('ioredis');var authService=require(_0x4042('0xe'));var qs=require(_0x4042('0xf'));var as=require(_0x4042('0x10'));var hardwareService=require(_0x4042('0x11'));var logger=require(_0x4042('0x12'))(_0x4042('0x13'));var utils=require(_0x4042('0x14'));var config=require(_0x4042('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4042('0x16'))['db'];function respondWithStatusCode(_0x357838,_0x59a068){_0x59a068=_0x59a068||0xcc;return function(_0x25fd0a){if(_0x25fd0a){return _0x357838[_0x4042('0x17')](_0x59a068);}return _0x357838[_0x4042('0x18')](_0x59a068)[_0x4042('0x19')]();};}function respondWithResult(_0x35f82a,_0x1ff3ca){_0x1ff3ca=_0x1ff3ca||0xc8;return function(_0xc115bd){if(_0xc115bd){return _0x35f82a['status'](_0x1ff3ca)[_0x4042('0x1a')](_0xc115bd);}};}function respondWithFilteredResult(_0x291e5c,_0x50206f){return function(_0x28087d){if(_0x28087d){var _0x3f99f8=typeof _0x50206f[_0x4042('0x1b')]===_0x4042('0x1c')&&typeof _0x50206f[_0x4042('0x1d')]===_0x4042('0x1c');var _0x62cb76=_0x28087d[_0x4042('0x1e')];var _0x466077=_0x3f99f8?0x0:_0x50206f['offset'];var _0xe5c1ec=_0x3f99f8?_0x28087d['count']:_0x50206f[_0x4042('0x1b')]+_0x50206f['limit'];var _0xca9ca6;if(_0xe5c1ec>=_0x62cb76){_0xe5c1ec=_0x62cb76;_0xca9ca6=0xc8;}else{_0xca9ca6=0xce;}_0x291e5c[_0x4042('0x18')](_0xca9ca6);return _0x291e5c[_0x4042('0x1f')](_0x4042('0x20'),_0x466077+'-'+_0xe5c1ec+'/'+_0x62cb76)['json'](_0x28087d);}return null;};}function patchUpdates(_0xb72021){return function(_0x4561e3){try{jsonpatch[_0x4042('0x21')](_0x4561e3,_0xb72021,!![]);}catch(_0xd1ddb){return BPromise['reject'](_0xd1ddb);}return _0x4561e3[_0x4042('0x22')]();};}function saveUpdates(_0xf0e0c6,_0xd6fe6c){return function(_0x83ce71){if(_0x83ce71){return _0x83ce71[_0x4042('0x23')](_0xf0e0c6)['then'](function(_0x1f9d4a){return _0x1f9d4a;});}return null;};}function removeEntity(_0x6d12a5,_0x519f2c){return function(_0x1daee8){if(_0x1daee8){return _0x1daee8['destroy']()[_0x4042('0x24')](function(){_0x6d12a5[_0x4042('0x18')](0xcc)[_0x4042('0x19')]();});}};}function handleEntityNotFound(_0x5d5c6d,_0x461c5e){return function(_0x3b9e78){if(!_0x3b9e78){_0x5d5c6d[_0x4042('0x17')](0x194);}return _0x3b9e78;};}function handleError(_0xbdadc8,_0x1c4d9f){_0x1c4d9f=_0x1c4d9f||0x1f4;return function(_0x52e575){logger['error'](_0x52e575[_0x4042('0x25')]);if(_0x52e575[_0x4042('0x26')]){delete _0x52e575[_0x4042('0x26')];}_0xbdadc8[_0x4042('0x18')](_0x1c4d9f)[_0x4042('0x27')](_0x52e575);};}exports[_0x4042('0x28')]=function(_0x5eb84b,_0x33733b){var _0x1e9bd7={},_0x4a6a6e={},_0xae26c2={'count':0x0,'rows':[]};var _0x89e16=_[_0x4042('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x3d1f48){return{'name':_0x3d1f48[_0x4042('0x2a')],'type':_0x3d1f48['type'][_0x4042('0x2b')]};});_0x4a6a6e[_0x4042('0x2c')]=_[_0x4042('0x29')](_0x89e16,_0x4042('0x26'));_0x4a6a6e[_0x4042('0x2d')]=_[_0x4042('0x2e')](_0x5eb84b[_0x4042('0x2d')]);_0x4a6a6e[_0x4042('0x2f')]=_[_0x4042('0x30')](_0x4a6a6e['model'],_0x4a6a6e[_0x4042('0x2d')]);_0x1e9bd7[_0x4042('0x31')]=_['intersection'](_0x4a6a6e[_0x4042('0x2c')],qs[_0x4042('0x32')](_0x5eb84b['query'][_0x4042('0x32')]));_0x1e9bd7[_0x4042('0x31')]=_0x1e9bd7[_0x4042('0x31')][_0x4042('0x33')]?_0x1e9bd7[_0x4042('0x31')]:_0x4a6a6e[_0x4042('0x2c')];if(!_0x5eb84b[_0x4042('0x2d')][_0x4042('0x34')](_0x4042('0x35'))){_0x1e9bd7[_0x4042('0x1d')]=qs[_0x4042('0x1d')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x1d')]);_0x1e9bd7[_0x4042('0x1b')]=qs[_0x4042('0x1b')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x1b')]);}_0x1e9bd7[_0x4042('0x36')]=qs[_0x4042('0x37')](_0x5eb84b[_0x4042('0x2d')][_0x4042('0x37')]);_0x1e9bd7['where']=qs[_0x4042('0x2f')](_[_0x4042('0x38')](_0x5eb84b[_0x4042('0x2d')],_0x4a6a6e[_0x4042('0x2f')]),_0x89e16);if(_0x5eb84b['query'][_0x4042('0x39')]){_0x1e9bd7[_0x4042('0x3a')]=_[_0x4042('0x3b')](_0x1e9bd7[_0x4042('0x3a')],{'$or':_[_0x4042('0x29')](_0x89e16,function(_0x13da64){if(_0x13da64[_0x4042('0x3c')]!==_0x4042('0x3d')){var _0x341083={};_0x341083[_0x13da64[_0x4042('0x26')]]={'$like':'%'+_0x5eb84b['query'][_0x4042('0x39')]+'%'};return _0x341083;}})});}_0x1e9bd7=_[_0x4042('0x3b')]({},_0x1e9bd7,_0x5eb84b[_0x4042('0x3e')]);var _0x1eab87={'where':_0x1e9bd7[_0x4042('0x3a')]};return db[_0x4042('0x3f')][_0x4042('0x1e')](_0x1eab87)[_0x4042('0x24')](function(_0x52b1bd){_0xae26c2['count']=_0x52b1bd;if(_0x5eb84b[_0x4042('0x2d')][_0x4042('0x40')]){_0x1e9bd7[_0x4042('0x41')]=[{'all':!![]}];}return db[_0x4042('0x3f')][_0x4042('0x42')](_0x1e9bd7);})[_0x4042('0x24')](function(_0xdfb5cb){_0xae26c2[_0x4042('0x43')]=_0xdfb5cb;return _0xae26c2;})[_0x4042('0x24')](respondWithFilteredResult(_0x33733b,_0x1e9bd7))[_0x4042('0x44')](handleError(_0x33733b,null));};exports[_0x4042('0x45')]=function(_0x35fdc2,_0x5666ed){var _0x5dea57={'raw':!![],'where':{'id':_0x35fdc2[_0x4042('0x46')]['id']}},_0x929884={};_0x929884['model']=_[_0x4042('0x2e')](db['MailQueueReport'][_0x4042('0x47')]);_0x929884[_0x4042('0x2d')]=_[_0x4042('0x2e')](_0x35fdc2['query']);_0x929884[_0x4042('0x2f')]=_[_0x4042('0x30')](_0x929884['model'],_0x929884[_0x4042('0x2d')]);_0x5dea57[_0x4042('0x31')]=_[_0x4042('0x30')](_0x929884[_0x4042('0x2c')],qs[_0x4042('0x32')](_0x35fdc2['query']['fields']));_0x5dea57['attributes']=_0x5dea57[_0x4042('0x31')][_0x4042('0x33')]?_0x5dea57['attributes']:_0x929884['model'];if(_0x35fdc2['query'][_0x4042('0x40')]){_0x5dea57['include']=[{'all':!![]}];}_0x5dea57=_['merge']({},_0x5dea57,_0x35fdc2[_0x4042('0x3e')]);return db[_0x4042('0x3f')][_0x4042('0x48')](_0x5dea57)[_0x4042('0x24')](handleEntityNotFound(_0x5666ed,null))[_0x4042('0x24')](respondWithResult(_0x5666ed,null))[_0x4042('0x44')](handleError(_0x5666ed,null));};exports[_0x4042('0x49')]=function(_0x2abc13,_0x198209){return db['MailQueueReport']['create'](_0x2abc13['body'],{})['then'](respondWithResult(_0x198209,0xc9))[_0x4042('0x44')](handleError(_0x198209,null));};exports[_0x4042('0x23')]=function(_0xd898ea,_0x250434){if(_0xd898ea[_0x4042('0x4a')]['id']){delete _0xd898ea[_0x4042('0x4a')]['id'];}return db[_0x4042('0x3f')][_0x4042('0x48')]({'where':{'id':_0xd898ea['params']['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x250434,null))[_0x4042('0x24')](saveUpdates(_0xd898ea[_0x4042('0x4a')],null))[_0x4042('0x24')](respondWithResult(_0x250434,null))[_0x4042('0x44')](handleError(_0x250434,null));};exports[_0x4042('0x4b')]=function(_0xf5f38a,_0x591a0f){return db['MailQueueReport']['find']({'where':{'id':_0xf5f38a[_0x4042('0x46')]['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x591a0f,null))['then'](removeEntity(_0x591a0f,null))[_0x4042('0x44')](handleError(_0x591a0f,null));};exports[_0x4042('0x4c')]=function(_0x5d42a7,_0x4ec047){return db[_0x4042('0x3f')][_0x4042('0x4c')]()[_0x4042('0x24')](respondWithResult(_0x4ec047,null))[_0x4042('0x44')](handleError(_0x4ec047,null));}; \ No newline at end of file +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(_0x3fe579,_0x797709){var _0xce8a86=function(_0x4c9d8c){while(--_0x4c9d8c){_0x3fe579['push'](_0x3fe579['shift']());}};_0xce8a86(++_0x797709);}(_0xef0f,0x168));var _0xfef0=function(_0x22ea59,_0x387ed1){_0x22ea59=_0x22ea59-0x0;var _0x444611=_0xef0f[_0x22ea59];return _0x444611;};'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 diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0a91065..d798552 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 _0x0142=['request-promise','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x29a558,_0x16db73){var _0x6105be=function(_0x122cab){while(--_0x122cab){_0x29a558['push'](_0x29a558['shift']());}};_0x6105be(++_0x16db73);}(_0x0142,0x130));var _0x2014=function(_0x1252bf,_0x53dd51){_0x1252bf=_0x1252bf-0x0;var _0x370be2=_0x0142[_0x1252bf];return _0x370be2;};'use strict';var _=require(_0x2014('0x0'));var util=require('util');var logger=require(_0x2014('0x1'))('api');var moment=require(_0x2014('0x2'));var BPromise=require(_0x2014('0x3'));var rp=require(_0x2014('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2014('0x5'));var attributes=require(_0x2014('0x6'));module[_0x2014('0x7')]=function(_0x503bc3,_0x59a50e){return _0x503bc3[_0x2014('0x8')]('MailQueueReport',attributes,{'tableName':_0x2014('0x9'),'paranoid':![],'indexes':[{'name':_0x2014('0xa'),'fields':[_0x2014('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9fc5=['api','moment','bluebird','request-promise','path','define','uniqueid','lodash','../../config/logger'];(function(_0x261631,_0x4749d8){var _0x4067ad=function(_0x5a3d6c){while(--_0x5a3d6c){_0x261631['push'](_0x261631['shift']());}};_0x4067ad(++_0x4749d8);}(_0x9fc5,0x8e));var _0x59fc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x9fc5[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x59fc('0x0'));var util=require('util');var logger=require(_0x59fc('0x1'))(_0x59fc('0x2'));var moment=require(_0x59fc('0x3'));var BPromise=require(_0x59fc('0x4'));var rp=require(_0x59fc('0x5'));var fs=require('fs');var path=require(_0x59fc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x45a72e,_0x3fdc54){return _0x45a72e[_0x59fc('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x59fc('0x8'),'fields':[_0x59fc('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 65c9df5..27e3168 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32e610,_0x46e0a6){var _0x223620=function(_0x18c8b4){while(--_0x18c8b4){_0x32e610['push'](_0x32e610['shift']());}};_0x223620(++_0x46e0a6);}(_0x326f,0xd1));var _0xf326=function(_0x52a8ea,_0xb0d982){_0x52a8ea=_0x52a8ea-0x0;var _0xf98690=_0x326f[_0x52a8ea];return _0xf98690;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _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(_0x467409,_0x21bba7){var _0x447419=function(_0x49a7f5){while(--_0x49a7f5){_0x467409['push'](_0x467409['shift']());}};_0x447419(++_0x21bba7);}(_0x1261,0x144));var _0x1126=function(_0x51c39f,_0x5bfb0b){_0x51c39f=_0x51c39f-0x0;var _0x274221=_0x1261[_0x51c39f];return _0x274221;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 688cc73..0cfdbdb 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb6a50e,_0x4f9a3e){var _0x102922=function(_0x49d8c0){while(--_0x49d8c0){_0xb6a50e['push'](_0xb6a50e['shift']());}};_0x102922(++_0x4f9a3e);}(_0xe706,0xa3));var _0x6e70=function(_0x3a831f,_0x31c8a4){_0x3a831f=_0x3a831f-0x0;var _0x26786c=_0xe706[_0x3a831f];return _0x26786c;};'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(_0x1413e6,_0xfc5531){var _0x2276b7=function(_0x212d69){while(--_0x212d69){_0x1413e6['push'](_0x1413e6['shift']());}};_0x2276b7(++_0xfc5531);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b3d502d..23f24ae 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 _0xc2da=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x595095,_0x8b993a){var _0x5adac9=function(_0x3dad27){while(--_0x3dad27){_0x595095['push'](_0x595095['shift']());}};_0x5adac9(++_0x8b993a);}(_0xc2da,0x124));var _0xac2d=function(_0x5a6d3b,_0x15a93b){_0x5a6d3b=_0x5a6d3b-0x0;var _0x3aaf17=_0xc2da[_0x5a6d3b];return _0x3aaf17;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'description':{'type':Sequelize[_0xac2d('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xac2d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xac2d('0x1')]},'port':{'type':Sequelize[_0xac2d('0x3')]},'tls':{'type':Sequelize[_0xac2d('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xac2d('0x1')],'defaultValue':_0xac2d('0x4')},'connTimeout':{'type':Sequelize[_0xac2d('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xac2d('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xac2d('0x1')]}}; \ No newline at end of file +var _0x57f8=['BOOLEAN','INTEGER','INBOX','exports','STRING'];(function(_0x674df3,_0x5abbed){var _0x4fafc5=function(_0x24c8f4){while(--_0x24c8f4){_0x674df3['push'](_0x674df3['shift']());}};_0x4fafc5(++_0x5abbed);}(_0x57f8,0x198));var _0x857f=function(_0x3bb21a,_0x353b56){_0x3bb21a=_0x3bb21a-0x0;var _0x5f3983=_0x57f8[_0x3bb21a];return _0x5f3983;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'description':{'type':Sequelize[_0x857f('0x1')]},'host':{'type':Sequelize[_0x857f('0x1')]},'authentication':{'type':Sequelize[_0x857f('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x857f('0x1')]},'password':{'type':Sequelize[_0x857f('0x1')]},'port':{'type':Sequelize[_0x857f('0x3')]},'tls':{'type':Sequelize[_0x857f('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x857f('0x1')],'defaultValue':_0x857f('0x4')},'connTimeout':{'type':Sequelize[_0x857f('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x857f('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9e89af5..1894198 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 _0x4ee3=['mail_servers_in','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0x284773,_0x222f16){var _0x343a57=function(_0x2be481){while(--_0x2be481){_0x284773['push'](_0x284773['shift']());}};_0x343a57(++_0x222f16);}(_0x4ee3,0x1ae));var _0x34ee=function(_0x21ba3c,_0x3b04e2){_0x21ba3c=_0x21ba3c-0x0;var _0x19d20d=_0x4ee3[_0x21ba3c];return _0x19d20d;};'use strict';var _=require(_0x34ee('0x0'));var util=require(_0x34ee('0x1'));var logger=require(_0x34ee('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x34ee('0x4'));var config=require(_0x34ee('0x5'));var attributes=require(_0x34ee('0x6'));module[_0x34ee('0x7')]=function(_0x35b0cc,_0x2127d2){return _0x35b0cc[_0x34ee('0x8')](_0x34ee('0x9'),attributes,{'tableName':_0x34ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf07f=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf07f,0xf7));var _0xff07=function(_0x54e15f,_0x345fe3){_0x54e15f=_0x54e15f-0x0;var _0xfa0d64=_0xf07f[_0x54e15f];return _0xfa0d64;};'use strict';var _=require(_0xff07('0x0'));var util=require(_0xff07('0x1'));var logger=require(_0xff07('0x2'))('api');var moment=require(_0xff07('0x3'));var BPromise=require('bluebird');var rp=require(_0xff07('0x4'));var fs=require('fs');var path=require(_0xff07('0x5'));var rimraf=require(_0xff07('0x6'));var config=require(_0xff07('0x7'));var attributes=require(_0xff07('0x8'));module[_0xff07('0x9')]=function(_0xf9e9e7,_0x11058a){return _0xf9e9e7['define'](_0xff07('0xa'),attributes,{'tableName':_0xff07('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 bfec759..e91243f 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 _0xfdb5=['model','attributes','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','include','map'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xfdb5[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x5fdb('0x0'));var util=require(_0x5fdb('0x1'));var moment=require(_0x5fdb('0x2'));var BPromise=require('bluebird');var rs=require(_0x5fdb('0x3'));var fs=require('fs');var Redis=require(_0x5fdb('0x4'));var db=require(_0x5fdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5fdb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5fdb('0x7'));var client=jayson['client'][_0x5fdb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xda053e,_0x4b6fe0,_0x542bbc){return new BPromise(function(_0x5a556e,_0x340588){return client[_0x5fdb('0x9')](_0xda053e,_0x542bbc)[_0x5fdb('0xa')](function(_0x25cef8){logger[_0x5fdb('0xb')](_0x5fdb('0xc'),_0x4b6fe0,_0x5fdb('0xd'));logger['debug'](_0x5fdb('0xe'),_0x4b6fe0,'request\x20sent',JSON[_0x5fdb('0xf')](_0x25cef8));if(_0x25cef8[_0x5fdb('0x10')]){if(_0x25cef8[_0x5fdb('0x10')]['code']===0x1f4){logger[_0x5fdb('0x10')]('MailServerIn,\x20%s,\x20%s',_0x4b6fe0,_0x25cef8[_0x5fdb('0x10')][_0x5fdb('0x11')]);return _0x340588(_0x25cef8['error'][_0x5fdb('0x11')]);}logger[_0x5fdb('0x10')](_0x5fdb('0xc'),_0x4b6fe0,_0x25cef8['error'][_0x5fdb('0x11')]);return _0x5a556e(_0x25cef8[_0x5fdb('0x10')][_0x5fdb('0x11')]);}else{logger[_0x5fdb('0xb')](_0x5fdb('0xc'),_0x4b6fe0,_0x5fdb('0xd'));_0x5a556e(_0x25cef8['result']['message']);}})[_0x5fdb('0x12')](function(_0x5f1ddc){logger[_0x5fdb('0x10')](_0x5fdb('0xc'),_0x4b6fe0,_0x5f1ddc);_0x340588(_0x5f1ddc);});});}exports[_0x5fdb('0x13')]=function(_0x47a10f){var _0x15fa3e=this;return new Promise(function(_0xb8c99f,_0xf27e5d){return db[_0x5fdb('0x14')][_0x5fdb('0x15')]({'raw':_0x47a10f[_0x5fdb('0x16')]?_0x47a10f['options'][_0x5fdb('0x17')]===undefined?!![]:![]:!![],'where':_0x47a10f['options']?_0x47a10f['options'][_0x5fdb('0x18')]||null:null,'attributes':_0x47a10f[_0x5fdb('0x16')]?_0x47a10f[_0x5fdb('0x16')]['attributes']||null:null,'limit':_0x47a10f[_0x5fdb('0x16')]?_0x47a10f[_0x5fdb('0x16')]['limit']||null:null,'include':_0x47a10f[_0x5fdb('0x16')]?_0x47a10f[_0x5fdb('0x16')]['include']?_['map'](_0x47a10f['options']['include'],function(_0x15d2ec){return{'model':db[_0x15d2ec['model']],'as':_0x15d2ec['as'],'attributes':_0x15d2ec['attributes'],'include':_0x15d2ec[_0x5fdb('0x19')]?_[_0x5fdb('0x1a')](_0x15d2ec[_0x5fdb('0x19')],function(_0x49e795){return{'model':db[_0x49e795[_0x5fdb('0x1b')]],'as':_0x49e795['as'],'attributes':_0x49e795[_0x5fdb('0x1c')],'include':_0x49e795[_0x5fdb('0x19')]?_[_0x5fdb('0x1a')](_0x49e795['include'],function(_0x200eaf){return{'model':db[_0x200eaf['model']],'as':_0x200eaf['as'],'attributes':_0x200eaf[_0x5fdb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5fdb('0xa')](function(_0x488843){logger[_0x5fdb('0xb')]('GetMailServerIn',_0x47a10f);logger[_0x5fdb('0x1d')](_0x5fdb('0x13'),_0x47a10f,JSON['stringify'](_0x488843));_0xb8c99f(_0x488843);})['catch'](function(_0xa5c0e2){logger[_0x5fdb('0x10')](_0x5fdb('0x13'),_0xa5c0e2[_0x5fdb('0x11')],_0x47a10f);_0xf27e5d(_0x15fa3e[_0x5fdb('0x10')](0x1f4,_0xa5c0e2['message']));});});}; \ No newline at end of file +var _0x7bc9=['request\x20sent','debug','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s'];(function(_0x38e261,_0x4db54a){var _0x5921f8=function(_0x32d5b4){while(--_0x32d5b4){_0x38e261['push'](_0x38e261['shift']());}};_0x5921f8(++_0x4db54a);}(_0x7bc9,0x128));var _0x97bc=function(_0x151346,_0x1b15e3){_0x151346=_0x151346-0x0;var _0x32fb78=_0x7bc9[_0x151346];return _0x32fb78;};'use strict';var _=require('lodash');var util=require(_0x97bc('0x0'));var moment=require('moment');var BPromise=require(_0x97bc('0x1'));var rs=require(_0x97bc('0x2'));var fs=require('fs');var Redis=require(_0x97bc('0x3'));var db=require(_0x97bc('0x4'))['db'];var utils=require(_0x97bc('0x5'));var logger=require('../../config/logger')(_0x97bc('0x6'));var config=require(_0x97bc('0x7'));var jayson=require(_0x97bc('0x8'));var client=jayson[_0x97bc('0x9')][_0x97bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18be89,_0x437f44,_0x4799e6){return new BPromise(function(_0x26f851,_0x1f9782){return client['request'](_0x18be89,_0x4799e6)[_0x97bc('0xb')](function(_0x3de1a6){logger[_0x97bc('0xc')](_0x97bc('0xd'),_0x437f44,_0x97bc('0xe'));logger[_0x97bc('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x437f44,_0x97bc('0xe'),JSON[_0x97bc('0x10')](_0x3de1a6));if(_0x3de1a6[_0x97bc('0x11')]){if(_0x3de1a6[_0x97bc('0x11')][_0x97bc('0x12')]===0x1f4){logger[_0x97bc('0x11')](_0x97bc('0xd'),_0x437f44,_0x3de1a6['error'][_0x97bc('0x13')]);return _0x1f9782(_0x3de1a6[_0x97bc('0x11')][_0x97bc('0x13')]);}logger[_0x97bc('0x11')]('MailServerIn,\x20%s,\x20%s',_0x437f44,_0x3de1a6[_0x97bc('0x11')][_0x97bc('0x13')]);return _0x26f851(_0x3de1a6[_0x97bc('0x11')][_0x97bc('0x13')]);}else{logger[_0x97bc('0xc')](_0x97bc('0xd'),_0x437f44,_0x97bc('0xe'));_0x26f851(_0x3de1a6['result'][_0x97bc('0x13')]);}})[_0x97bc('0x14')](function(_0x42bffd){logger[_0x97bc('0x11')](_0x97bc('0xd'),_0x437f44,_0x42bffd);_0x1f9782(_0x42bffd);});});}exports[_0x97bc('0x15')]=function(_0x33a2fe){var _0x48a9d2=this;return new Promise(function(_0x2b1de1,_0x174612){return db[_0x97bc('0x16')][_0x97bc('0x17')]({'raw':_0x33a2fe['options']?_0x33a2fe[_0x97bc('0x18')][_0x97bc('0x19')]===undefined?!![]:![]:!![],'where':_0x33a2fe['options']?_0x33a2fe[_0x97bc('0x18')]['where']||null:null,'attributes':_0x33a2fe[_0x97bc('0x18')]?_0x33a2fe[_0x97bc('0x18')][_0x97bc('0x1a')]||null:null,'limit':_0x33a2fe[_0x97bc('0x18')]?_0x33a2fe['options'][_0x97bc('0x1b')]||null:null,'include':_0x33a2fe[_0x97bc('0x18')]?_0x33a2fe[_0x97bc('0x18')][_0x97bc('0x1c')]?_[_0x97bc('0x1d')](_0x33a2fe[_0x97bc('0x18')][_0x97bc('0x1c')],function(_0x20aa32){return{'model':db[_0x20aa32['model']],'as':_0x20aa32['as'],'attributes':_0x20aa32['attributes'],'include':_0x20aa32['include']?_[_0x97bc('0x1d')](_0x20aa32[_0x97bc('0x1c')],function(_0x49e11c){return{'model':db[_0x49e11c[_0x97bc('0x1e')]],'as':_0x49e11c['as'],'attributes':_0x49e11c[_0x97bc('0x1a')],'include':_0x49e11c[_0x97bc('0x1c')]?_[_0x97bc('0x1d')](_0x49e11c[_0x97bc('0x1c')],function(_0x35cae7){return{'model':db[_0x35cae7[_0x97bc('0x1e')]],'as':_0x35cae7['as'],'attributes':_0x35cae7[_0x97bc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x97bc('0xb')](function(_0x5279b4){logger[_0x97bc('0xc')](_0x97bc('0x15'),_0x33a2fe);logger[_0x97bc('0xf')](_0x97bc('0x15'),_0x33a2fe,JSON[_0x97bc('0x10')](_0x5279b4));_0x2b1de1(_0x5279b4);})['catch'](function(_0x5a5e2c){logger[_0x97bc('0x11')]('GetMailServerIn',_0x5a5e2c[_0x97bc('0x13')],_0x33a2fe);_0x174612(_0x48a9d2[_0x97bc('0x11')](0x1f4,_0x5a5e2c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b9d7dfd..2ea4478 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(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 _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(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index df25ccb..bbbfed1 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 _0x0810=['STRING','INTEGER','BOOLEAN'];(function(_0x569ab3,_0x36d30b){var _0x549d12=function(_0xd67be8){while(--_0xd67be8){_0x569ab3['push'](_0x569ab3['shift']());}};_0x549d12(++_0x36d30b);}(_0x0810,0x1e6));var _0x0081=function(_0x116c9e,_0x16d22d){_0x116c9e=_0x116c9e-0x0;var _0xc37eb2=_0x0810[_0x116c9e];return _0xc37eb2;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x0081('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x0081('0x0')]},'pass':{'type':Sequelize[_0x0081('0x0')]},'port':{'type':Sequelize[_0x0081('0x1')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x0081('0x0')]},'authentication':{'type':Sequelize[_0x0081('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9ea6=['exports','STRING','INTEGER','sequelize'];(function(_0x2458f0,_0xf805c){var _0x2b4fd9=function(_0x57deeb){while(--_0x57deeb){_0x2458f0['push'](_0x2458f0['shift']());}};_0x2b4fd9(++_0xf805c);}(_0x9ea6,0x15b));var _0x69ea=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9ea6[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x69ea('0x0'));module[_0x69ea('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x69ea('0x2')]},'port':{'type':Sequelize[_0x69ea('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d8ae384..4aa8ee9 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 _0x4bcb=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','map','filter','merge','options','MailServerOut','includeAll','include','findAll','rows','params','keys','length','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x4bcb,0x74));var _0xb4bc=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0x4bcb[_0x29d6e6];return _0xc75ff0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4bc('0x0'));var zipdir=require(_0xb4bc('0x1'));var jsonpatch=require(_0xb4bc('0x2'));var rp=require(_0xb4bc('0x3'));var moment=require(_0xb4bc('0x4'));var BPromise=require(_0xb4bc('0x5'));var Mustache=require(_0xb4bc('0x6'));var util=require(_0xb4bc('0x7'));var path=require(_0xb4bc('0x8'));var sox=require('sox');var csv=require(_0xb4bc('0x9'));var ejs=require(_0xb4bc('0xa'));var fs=require('fs');var fs_extra=require(_0xb4bc('0xb'));var _=require(_0xb4bc('0xc'));var squel=require(_0xb4bc('0xd'));var crypto=require(_0xb4bc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb4bc('0xf'));var toCsv=require(_0xb4bc('0x9'));var querystring=require(_0xb4bc('0x10'));var Papa=require(_0xb4bc('0x11'));var Redis=require(_0xb4bc('0x12'));var authService=require(_0xb4bc('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4bc('0x14'))(_0xb4bc('0x15'));var utils=require(_0xb4bc('0x16'));var config=require(_0xb4bc('0x17'));var licenseUtil=require(_0xb4bc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20fa0b,_0x178fc0){_0x178fc0=_0x178fc0||0xcc;return function(_0x20bc3d){if(_0x20bc3d){return _0x20fa0b['sendStatus'](_0x178fc0);}return _0x20fa0b[_0xb4bc('0x19')](_0x178fc0)['end']();};}function respondWithResult(_0x48655c,_0xb50d9c){_0xb50d9c=_0xb50d9c||0xc8;return function(_0x12abb1){if(_0x12abb1){return _0x48655c[_0xb4bc('0x19')](_0xb50d9c)[_0xb4bc('0x1a')](_0x12abb1);}};}function respondWithFilteredResult(_0x490eb1,_0x51a84b){return function(_0x292c75){if(_0x292c75){var _0x25555f=typeof _0x51a84b[_0xb4bc('0x1b')]===_0xb4bc('0x1c')&&typeof _0x51a84b[_0xb4bc('0x1d')]==='undefined';var _0x4d5ee0=_0x292c75[_0xb4bc('0x1e')];var _0x4c83fd=_0x25555f?0x0:_0x51a84b[_0xb4bc('0x1b')];var _0x2784a4=_0x25555f?_0x292c75[_0xb4bc('0x1e')]:_0x51a84b[_0xb4bc('0x1b')]+_0x51a84b[_0xb4bc('0x1d')];var _0x2c0b5c;if(_0x2784a4>=_0x4d5ee0){_0x2784a4=_0x4d5ee0;_0x2c0b5c=0xc8;}else{_0x2c0b5c=0xce;}_0x490eb1[_0xb4bc('0x19')](_0x2c0b5c);return _0x490eb1[_0xb4bc('0x1f')](_0xb4bc('0x20'),_0x4c83fd+'-'+_0x2784a4+'/'+_0x4d5ee0)[_0xb4bc('0x1a')](_0x292c75);}return null;};}function patchUpdates(_0xb3e2c1){return function(_0x5469df){try{jsonpatch[_0xb4bc('0x21')](_0x5469df,_0xb3e2c1,!![]);}catch(_0x398187){return BPromise[_0xb4bc('0x22')](_0x398187);}return _0x5469df[_0xb4bc('0x23')]();};}function saveUpdates(_0x59d189,_0x1af179){return function(_0x2bc7e7){if(_0x2bc7e7){return _0x2bc7e7[_0xb4bc('0x24')](_0x59d189)[_0xb4bc('0x25')](function(_0x395ea2){return _0x395ea2;});}return null;};}function removeEntity(_0x16bdf0,_0x49778e){return function(_0x527595){if(_0x527595){return _0x527595[_0xb4bc('0x26')]()[_0xb4bc('0x25')](function(){_0x16bdf0[_0xb4bc('0x19')](0xcc)[_0xb4bc('0x27')]();});}};}function handleEntityNotFound(_0x3cc2b0,_0x46d330){return function(_0x32d62d){if(!_0x32d62d){_0x3cc2b0['sendStatus'](0x194);}return _0x32d62d;};}function handleError(_0x5205f6,_0x4887f0){_0x4887f0=_0x4887f0||0x1f4;return function(_0x24541d){logger[_0xb4bc('0x28')](_0x24541d[_0xb4bc('0x29')]);if(_0x24541d[_0xb4bc('0x2a')]){delete _0x24541d['name'];}_0x5205f6['status'](_0x4887f0)['send'](_0x24541d);};}exports[_0xb4bc('0x2b')]=function(_0x3b5e87,_0x12de36){var _0x4cd07b={},_0x4c1b34={},_0x592d34={'count':0x0,'rows':[]};var _0x3a79d1=_['map'](db['MailServerOut'][_0xb4bc('0x2c')],function(_0x6b184f){return{'name':_0x6b184f[_0xb4bc('0x2d')],'type':_0x6b184f[_0xb4bc('0x2e')][_0xb4bc('0x2f')]};});_0x4c1b34[_0xb4bc('0x30')]=_['map'](_0x3a79d1,_0xb4bc('0x2a'));_0x4c1b34[_0xb4bc('0x31')]=_['keys'](_0x3b5e87['query']);_0x4c1b34[_0xb4bc('0x32')]=_[_0xb4bc('0x33')](_0x4c1b34['model'],_0x4c1b34[_0xb4bc('0x31')]);_0x4cd07b[_0xb4bc('0x34')]=_[_0xb4bc('0x33')](_0x4c1b34[_0xb4bc('0x30')],qs[_0xb4bc('0x35')](_0x3b5e87[_0xb4bc('0x31')][_0xb4bc('0x35')]));_0x4cd07b[_0xb4bc('0x34')]=_0x4cd07b['attributes']['length']?_0x4cd07b['attributes']:_0x4c1b34[_0xb4bc('0x30')];if(!_0x3b5e87[_0xb4bc('0x31')]['hasOwnProperty'](_0xb4bc('0x36'))){_0x4cd07b[_0xb4bc('0x1d')]=qs['limit'](_0x3b5e87[_0xb4bc('0x31')][_0xb4bc('0x1d')]);_0x4cd07b['offset']=qs[_0xb4bc('0x1b')](_0x3b5e87[_0xb4bc('0x31')]['offset']);}_0x4cd07b[_0xb4bc('0x37')]=qs[_0xb4bc('0x38')](_0x3b5e87[_0xb4bc('0x31')][_0xb4bc('0x38')]);_0x4cd07b[_0xb4bc('0x39')]=qs[_0xb4bc('0x32')](_['pick'](_0x3b5e87[_0xb4bc('0x31')],_0x4c1b34[_0xb4bc('0x32')]),_0x3a79d1);if(_0x3b5e87['query']['filter']){_0x4cd07b[_0xb4bc('0x39')]=_['merge'](_0x4cd07b[_0xb4bc('0x39')],{'$or':_[_0xb4bc('0x3a')](_0x3a79d1,function(_0x1a3722){if(_0x1a3722[_0xb4bc('0x2e')]!=='VIRTUAL'){var _0x13d0ef={};_0x13d0ef[_0x1a3722[_0xb4bc('0x2a')]]={'$like':'%'+_0x3b5e87[_0xb4bc('0x31')][_0xb4bc('0x3b')]+'%'};return _0x13d0ef;}})});}_0x4cd07b=_[_0xb4bc('0x3c')]({},_0x4cd07b,_0x3b5e87[_0xb4bc('0x3d')]);var _0x3b8d48={'where':_0x4cd07b[_0xb4bc('0x39')]};return db[_0xb4bc('0x3e')][_0xb4bc('0x1e')](_0x3b8d48)[_0xb4bc('0x25')](function(_0x25fff2){_0x592d34[_0xb4bc('0x1e')]=_0x25fff2;if(_0x3b5e87['query'][_0xb4bc('0x3f')]){_0x4cd07b[_0xb4bc('0x40')]=[{'all':!![]}];}return db[_0xb4bc('0x3e')][_0xb4bc('0x41')](_0x4cd07b);})[_0xb4bc('0x25')](function(_0x3e2c38){_0x592d34[_0xb4bc('0x42')]=_0x3e2c38;return _0x592d34;})['then'](respondWithFilteredResult(_0x12de36,_0x4cd07b))['catch'](handleError(_0x12de36,null));};exports['show']=function(_0x1d5f0e,_0x3d920e){var _0x5b71f9={'raw':!![],'where':{'id':_0x1d5f0e[_0xb4bc('0x43')]['id']}},_0x2fdc4d={};_0x2fdc4d[_0xb4bc('0x30')]=_[_0xb4bc('0x44')](db[_0xb4bc('0x3e')]['rawAttributes']);_0x2fdc4d['query']=_['keys'](_0x1d5f0e[_0xb4bc('0x31')]);_0x2fdc4d[_0xb4bc('0x32')]=_[_0xb4bc('0x33')](_0x2fdc4d[_0xb4bc('0x30')],_0x2fdc4d[_0xb4bc('0x31')]);_0x5b71f9[_0xb4bc('0x34')]=_[_0xb4bc('0x33')](_0x2fdc4d[_0xb4bc('0x30')],qs['fields'](_0x1d5f0e[_0xb4bc('0x31')][_0xb4bc('0x35')]));_0x5b71f9['attributes']=_0x5b71f9[_0xb4bc('0x34')][_0xb4bc('0x45')]?_0x5b71f9[_0xb4bc('0x34')]:_0x2fdc4d[_0xb4bc('0x30')];if(_0x1d5f0e['query'][_0xb4bc('0x3f')]){_0x5b71f9[_0xb4bc('0x40')]=[{'all':!![]}];}_0x5b71f9=_['merge']({},_0x5b71f9,_0x1d5f0e['options']);return db['MailServerOut'][_0xb4bc('0x46')](_0x5b71f9)[_0xb4bc('0x25')](handleEntityNotFound(_0x3d920e,null))[_0xb4bc('0x25')](respondWithResult(_0x3d920e,null))['catch'](handleError(_0x3d920e,null));};exports[_0xb4bc('0x47')]=function(_0x5da839,_0x14f81a){return db[_0xb4bc('0x3e')]['create'](_0x5da839['body'],{})[_0xb4bc('0x25')](respondWithResult(_0x14f81a,0xc9))[_0xb4bc('0x48')](handleError(_0x14f81a,null));};exports[_0xb4bc('0x24')]=function(_0x340761,_0x2c39a2){if(_0x340761[_0xb4bc('0x49')]['id']){delete _0x340761[_0xb4bc('0x49')]['id'];}return db[_0xb4bc('0x3e')][_0xb4bc('0x46')]({'where':{'id':_0x340761[_0xb4bc('0x43')]['id']}})[_0xb4bc('0x25')](handleEntityNotFound(_0x2c39a2,null))['then'](saveUpdates(_0x340761[_0xb4bc('0x49')],null))[_0xb4bc('0x25')](respondWithResult(_0x2c39a2,null))[_0xb4bc('0x48')](handleError(_0x2c39a2,null));};exports[_0xb4bc('0x26')]=function(_0x4e604a,_0x5a0932){return db[_0xb4bc('0x3e')][_0xb4bc('0x46')]({'where':{'id':_0x4e604a[_0xb4bc('0x43')]['id']}})[_0xb4bc('0x25')](handleEntityNotFound(_0x5a0932,null))[_0xb4bc('0x25')](removeEntity(_0x5a0932,null))[_0xb4bc('0x48')](handleError(_0x5a0932,null));}; \ No newline at end of file +var _0xf54e=['limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','index','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x4a4a43,_0x115ccf){var _0x5893a6=function(_0x14c914){while(--_0x14c914){_0x4a4a43['push'](_0x4a4a43['shift']());}};_0x5893a6(++_0x115ccf);}(_0xf54e,0x7a));var _0xef54=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0xf54e[_0x55677b];return _0x104b88;};'use strict';var emlformat=require(_0xef54('0x0'));var rimraf=require(_0xef54('0x1'));var zipdir=require(_0xef54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef54('0x3'));var moment=require(_0xef54('0x4'));var BPromise=require(_0xef54('0x5'));var Mustache=require(_0xef54('0x6'));var util=require(_0xef54('0x7'));var path=require(_0xef54('0x8'));var sox=require(_0xef54('0x9'));var csv=require(_0xef54('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef54('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xef54('0xc'));var deskjs=require(_0xef54('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef54('0xe'));var Redis=require(_0xef54('0xf'));var authService=require(_0xef54('0x10'));var qs=require(_0xef54('0x11'));var as=require(_0xef54('0x12'));var hardwareService=require(_0xef54('0x13'));var logger=require(_0xef54('0x14'))(_0xef54('0x15'));var utils=require(_0xef54('0x16'));var config=require(_0xef54('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xef54('0x18'))['db'];function respondWithStatusCode(_0x5aa5d1,_0x294801){_0x294801=_0x294801||0xcc;return function(_0x135fc6){if(_0x135fc6){return _0x5aa5d1[_0xef54('0x19')](_0x294801);}return _0x5aa5d1['status'](_0x294801)['end']();};}function respondWithResult(_0x57b292,_0x5e8385){_0x5e8385=_0x5e8385||0xc8;return function(_0x592655){if(_0x592655){return _0x57b292[_0xef54('0x1a')](_0x5e8385)[_0xef54('0x1b')](_0x592655);}};}function respondWithFilteredResult(_0x5403a3,_0x2b49d2){return function(_0x3e4235){if(_0x3e4235){var _0x458b79=typeof _0x2b49d2[_0xef54('0x1c')]===_0xef54('0x1d')&&typeof _0x2b49d2[_0xef54('0x1e')]===_0xef54('0x1d');var _0x4c462a=_0x3e4235['count'];var _0x158726=_0x458b79?0x0:_0x2b49d2[_0xef54('0x1c')];var _0x1e9880=_0x458b79?_0x3e4235[_0xef54('0x1f')]:_0x2b49d2[_0xef54('0x1c')]+_0x2b49d2['limit'];var _0x3b6d1c;if(_0x1e9880>=_0x4c462a){_0x1e9880=_0x4c462a;_0x3b6d1c=0xc8;}else{_0x3b6d1c=0xce;}_0x5403a3[_0xef54('0x1a')](_0x3b6d1c);return _0x5403a3[_0xef54('0x20')](_0xef54('0x21'),_0x158726+'-'+_0x1e9880+'/'+_0x4c462a)[_0xef54('0x1b')](_0x3e4235);}return null;};}function patchUpdates(_0x32e4cc){return function(_0x187397){try{jsonpatch[_0xef54('0x22')](_0x187397,_0x32e4cc,!![]);}catch(_0x2be45d){return BPromise[_0xef54('0x23')](_0x2be45d);}return _0x187397['save']();};}function saveUpdates(_0x526adc,_0x397d44){return function(_0x157bf6){if(_0x157bf6){return _0x157bf6[_0xef54('0x24')](_0x526adc)[_0xef54('0x25')](function(_0x27868f){return _0x27868f;});}return null;};}function removeEntity(_0x2f01fe,_0x2f9d7d){return function(_0x5dbb81){if(_0x5dbb81){return _0x5dbb81['destroy']()[_0xef54('0x25')](function(){_0x2f01fe['status'](0xcc)[_0xef54('0x26')]();});}};}function handleEntityNotFound(_0x297706,_0x302bb4){return function(_0x59abcd){if(!_0x59abcd){_0x297706[_0xef54('0x19')](0x194);}return _0x59abcd;};}function handleError(_0x44d066,_0x2521b9){_0x2521b9=_0x2521b9||0x1f4;return function(_0x301920){logger[_0xef54('0x27')](_0x301920[_0xef54('0x28')]);if(_0x301920[_0xef54('0x29')]){delete _0x301920[_0xef54('0x29')];}_0x44d066['status'](_0x2521b9)['send'](_0x301920);};}exports[_0xef54('0x2a')]=function(_0x346d3c,_0x1daa8a){var _0x4d487c={},_0x23926c={},_0x23ca11={'count':0x0,'rows':[]};var _0x17c102=_[_0xef54('0x2b')](db['MailServerOut'][_0xef54('0x2c')],function(_0x323e82){return{'name':_0x323e82['fieldName'],'type':_0x323e82[_0xef54('0x2d')][_0xef54('0x2e')]};});_0x23926c['model']=_[_0xef54('0x2b')](_0x17c102,'name');_0x23926c[_0xef54('0x2f')]=_[_0xef54('0x30')](_0x346d3c[_0xef54('0x2f')]);_0x23926c['filters']=_[_0xef54('0x31')](_0x23926c[_0xef54('0x32')],_0x23926c[_0xef54('0x2f')]);_0x4d487c[_0xef54('0x33')]=_[_0xef54('0x31')](_0x23926c['model'],qs['fields'](_0x346d3c[_0xef54('0x2f')][_0xef54('0x34')]));_0x4d487c[_0xef54('0x33')]=_0x4d487c['attributes'][_0xef54('0x35')]?_0x4d487c[_0xef54('0x33')]:_0x23926c['model'];if(!_0x346d3c[_0xef54('0x2f')][_0xef54('0x36')](_0xef54('0x37'))){_0x4d487c[_0xef54('0x1e')]=qs[_0xef54('0x1e')](_0x346d3c[_0xef54('0x2f')]['limit']);_0x4d487c[_0xef54('0x1c')]=qs['offset'](_0x346d3c[_0xef54('0x2f')][_0xef54('0x1c')]);}_0x4d487c[_0xef54('0x38')]=qs[_0xef54('0x39')](_0x346d3c[_0xef54('0x2f')][_0xef54('0x39')]);_0x4d487c['where']=qs['filters'](_['pick'](_0x346d3c[_0xef54('0x2f')],_0x23926c[_0xef54('0x3a')]),_0x17c102);if(_0x346d3c['query']['filter']){_0x4d487c[_0xef54('0x3b')]=_[_0xef54('0x3c')](_0x4d487c[_0xef54('0x3b')],{'$or':_[_0xef54('0x2b')](_0x17c102,function(_0x2fe693){if(_0x2fe693['type']!==_0xef54('0x3d')){var _0x59cdd3={};_0x59cdd3[_0x2fe693[_0xef54('0x29')]]={'$like':'%'+_0x346d3c[_0xef54('0x2f')][_0xef54('0x3e')]+'%'};return _0x59cdd3;}})});}_0x4d487c=_['merge']({},_0x4d487c,_0x346d3c[_0xef54('0x3f')]);var _0x333637={'where':_0x4d487c[_0xef54('0x3b')]};return db[_0xef54('0x40')][_0xef54('0x1f')](_0x333637)['then'](function(_0xe17529){_0x23ca11['count']=_0xe17529;if(_0x346d3c['query'][_0xef54('0x41')]){_0x4d487c[_0xef54('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0xef54('0x43')](_0x4d487c);})[_0xef54('0x25')](function(_0x13174c){_0x23ca11[_0xef54('0x44')]=_0x13174c;return _0x23ca11;})[_0xef54('0x25')](respondWithFilteredResult(_0x1daa8a,_0x4d487c))[_0xef54('0x45')](handleError(_0x1daa8a,null));};exports[_0xef54('0x46')]=function(_0x3026ca,_0xaa98d3){var _0x57613a={'raw':!![],'where':{'id':_0x3026ca[_0xef54('0x47')]['id']}},_0x195031={};_0x195031[_0xef54('0x32')]=_['keys'](db[_0xef54('0x40')][_0xef54('0x2c')]);_0x195031[_0xef54('0x2f')]=_[_0xef54('0x30')](_0x3026ca[_0xef54('0x2f')]);_0x195031[_0xef54('0x3a')]=_[_0xef54('0x31')](_0x195031[_0xef54('0x32')],_0x195031[_0xef54('0x2f')]);_0x57613a[_0xef54('0x33')]=_['intersection'](_0x195031[_0xef54('0x32')],qs[_0xef54('0x34')](_0x3026ca[_0xef54('0x2f')][_0xef54('0x34')]));_0x57613a[_0xef54('0x33')]=_0x57613a[_0xef54('0x33')]['length']?_0x57613a['attributes']:_0x195031[_0xef54('0x32')];if(_0x3026ca[_0xef54('0x2f')]['includeAll']){_0x57613a[_0xef54('0x42')]=[{'all':!![]}];}_0x57613a=_['merge']({},_0x57613a,_0x3026ca[_0xef54('0x3f')]);return db[_0xef54('0x40')]['find'](_0x57613a)[_0xef54('0x25')](handleEntityNotFound(_0xaa98d3,null))[_0xef54('0x25')](respondWithResult(_0xaa98d3,null))[_0xef54('0x45')](handleError(_0xaa98d3,null));};exports['create']=function(_0x5b6758,_0xfea03b){return db['MailServerOut'][_0xef54('0x48')](_0x5b6758['body'],{})[_0xef54('0x25')](respondWithResult(_0xfea03b,0xc9))[_0xef54('0x45')](handleError(_0xfea03b,null));};exports['update']=function(_0x1595b7,_0x1da23c){if(_0x1595b7[_0xef54('0x49')]['id']){delete _0x1595b7[_0xef54('0x49')]['id'];}return db[_0xef54('0x40')][_0xef54('0x4a')]({'where':{'id':_0x1595b7['params']['id']}})[_0xef54('0x25')](handleEntityNotFound(_0x1da23c,null))['then'](saveUpdates(_0x1595b7[_0xef54('0x49')],null))[_0xef54('0x25')](respondWithResult(_0x1da23c,null))['catch'](handleError(_0x1da23c,null));};exports[_0xef54('0x4b')]=function(_0xbdd8b4,_0x39fbe1){return db[_0xef54('0x40')][_0xef54('0x4a')]({'where':{'id':_0xbdd8b4[_0xef54('0x47')]['id']}})[_0xef54('0x25')](handleEntityNotFound(_0x39fbe1,null))[_0xef54('0x25')](removeEntity(_0x39fbe1,null))[_0xef54('0x45')](handleError(_0x39fbe1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f42812e..847b403 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 _0xd537=['bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','lodash','api'];(function(_0x3d53e6,_0x7a8d60){var _0x5651d5=function(_0x2052f3){while(--_0x2052f3){_0x3d53e6['push'](_0x3d53e6['shift']());}};_0x5651d5(++_0x7a8d60);}(_0xd537,0x103));var _0x7d53=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xd537[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x7d53('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7d53('0x1'));var moment=require('moment');var BPromise=require(_0x7d53('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d53('0x3'));var rimraf=require(_0x7d53('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d53('0x5'));module[_0x7d53('0x6')]=function(_0x33e6ea,_0x2f974f){return _0x33e6ea[_0x7d53('0x7')](_0x7d53('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fd3=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','../../config/logger','api','moment'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x6fd3,0x17d));var _0x36fd=function(_0x1d88d2,_0x173738){_0x1d88d2=_0x1d88d2-0x0;var _0x2c3b92=_0x6fd3[_0x1d88d2];return _0x2c3b92;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x36fd('0x0'))(_0x36fd('0x1'));var moment=require(_0x36fd('0x2'));var BPromise=require(_0x36fd('0x3'));var rp=require(_0x36fd('0x4'));var fs=require('fs');var path=require(_0x36fd('0x5'));var rimraf=require(_0x36fd('0x6'));var config=require(_0x36fd('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x36fd('0x8')]=function(_0x4e628c,_0x17a0d6){return _0x4e628c[_0x36fd('0x9')](_0x36fd('0xa'),attributes,{'tableName':_0x36fd('0xb'),'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 79ed787..56d1e1a 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\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(_0x15b68d,_0x4de6a8){var _0x1ee804=function(_0x5f5975){while(--_0x5f5975){_0x15b68d['push'](_0x15b68d['shift']());}};_0x1ee804(++_0x4de6a8);}(_0x1261,0x144));var _0x1126=function(_0x5b328a,_0x5c48bc){_0x5b328a=_0x5b328a-0x0;var _0xfcf474=_0x1261[_0x5b328a];return _0xfcf474;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x2b635c,_0x10d557){_0x2b635c=_0x2b635c-0x0;var _0x2956cb=_0x7a54[_0x2b635c];return _0x2956cb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fee3d44..87507a6 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 _0xbfba=['post','create','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','show'];(function(_0x341c04,_0x5e171f){var _0x330c67=function(_0x397013){while(--_0x397013){_0x341c04['push'](_0x341c04['shift']());}};_0x330c67(++_0x5e171f);}(_0xbfba,0x1c0));var _0xabfb=function(_0x47c894,_0xc09b1f){_0x47c894=_0x47c894-0x0;var _0x1338d0=_0xbfba[_0x47c894];return _0x1338d0;};'use strict';var multer=require(_0xabfb('0x0'));var util=require(_0xabfb('0x1'));var path=require(_0xabfb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xabfb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xabfb('0x4'));var interaction=require(_0xabfb('0x5'));var config=require(_0xabfb('0x6'));var controller=require(_0xabfb('0x7'));router['get']('/',auth[_0xabfb('0x8')](),controller[_0xabfb('0x9')]);router[_0xabfb('0xa')](_0xabfb('0xb'),auth[_0xabfb('0x8')](),controller[_0xabfb('0xc')]);router[_0xabfb('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xabfb('0xd')]);router[_0xabfb('0xe')]('/',auth[_0xabfb('0x8')](),controller[_0xabfb('0xf')]);router['put'](_0xabfb('0x10'),auth[_0xabfb('0x8')](),controller[_0xabfb('0x11')]);router[_0xabfb('0x12')]('/:id',auth[_0xabfb('0x8')](),controller[_0xabfb('0x13')]);module[_0xabfb('0x14')]=router; \ No newline at end of file +var _0xac32=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','exports'];(function(_0x5a9666,_0x30bc94){var _0x28601f=function(_0x52e447){while(--_0x52e447){_0x5a9666['push'](_0x5a9666['shift']());}};_0x28601f(++_0x30bc94);}(_0xac32,0x154));var _0x2ac3=function(_0x1051ce,_0x461894){_0x1051ce=_0x1051ce-0x0;var _0x36d623=_0xac32[_0x1051ce];return _0x36d623;};'use strict';var multer=require(_0x2ac3('0x0'));var util=require(_0x2ac3('0x1'));var path=require(_0x2ac3('0x2'));var timeout=require('connect-timeout');var express=require(_0x2ac3('0x3'));var router=express[_0x2ac3('0x4')]();var fs_extra=require(_0x2ac3('0x5'));var auth=require(_0x2ac3('0x6'));var interaction=require(_0x2ac3('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x2ac3('0x8')]('/',auth['isAuthenticated'](),controller[_0x2ac3('0x9')]);router[_0x2ac3('0x8')](_0x2ac3('0xa'),auth[_0x2ac3('0xb')](),controller[_0x2ac3('0xc')]);router['get'](_0x2ac3('0xd'),auth[_0x2ac3('0xb')](),controller[_0x2ac3('0xe')]);router[_0x2ac3('0xf')]('/',auth[_0x2ac3('0xb')](),controller[_0x2ac3('0x10')]);router['put'](_0x2ac3('0xd'),auth['isAuthenticated'](),controller[_0x2ac3('0x11')]);router[_0x2ac3('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2ac3('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e427c4e..bce7e47 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 _0xcf98=['exports','STRING','name'];(function(_0x306ddc,_0x9c4d60){var _0x11767f=function(_0x35183e){while(--_0x35183e){_0x306ddc['push'](_0x306ddc['shift']());}};_0x11767f(++_0x9c4d60);}(_0xcf98,0x8d));var _0x8cf9=function(_0x1877a6,_0x3baabf){_0x1877a6=_0x1877a6-0x0;var _0x38a7f2=_0xcf98[_0x1877a6];return _0x38a7f2;};'use strict';var Sequelize=require('sequelize');module[_0x8cf9('0x0')]={'name':{'type':Sequelize[_0x8cf9('0x1')],'unique':_0x8cf9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8cf9('0x1')]}}; \ No newline at end of file +var _0x9f5a=['name','sequelize','exports','STRING'];(function(_0x215093,_0x2414df){var _0x1abb85=function(_0x3ea6d6){while(--_0x3ea6d6){_0x215093['push'](_0x215093['shift']());}};_0x1abb85(++_0x2414df);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x18eff8,_0x7b1917){_0x18eff8=_0x18eff8-0x0;var _0x2209ca=_0x9f5a[_0x18eff8];return _0x2209ca;};'use strict';var Sequelize=require(_0xa9f5('0x0'));module[_0xa9f5('0x1')]={'name':{'type':Sequelize[_0xa9f5('0x2')],'unique':_0xa9f5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 16f5b23..5c83daa 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 _0xef4a=['body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','send','map','MailSubstatus','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create'];(function(_0x3ad54a,_0x33f0e2){var _0x18f50f=function(_0x342bbc){while(--_0x342bbc){_0x3ad54a['push'](_0x3ad54a['shift']());}};_0x18f50f(++_0x33f0e2);}(_0xef4a,0x1d0));var _0xaef4=function(_0x871ef5,_0x58880b){_0x871ef5=_0x871ef5-0x0;var _0x1f62ea=_0xef4a[_0x871ef5];return _0x1f62ea;};'use strict';var emlformat=require(_0xaef4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaef4('0x1'));var jsonpatch=require(_0xaef4('0x2'));var rp=require(_0xaef4('0x3'));var moment=require(_0xaef4('0x4'));var BPromise=require(_0xaef4('0x5'));var Mustache=require(_0xaef4('0x6'));var util=require('util');var path=require(_0xaef4('0x7'));var sox=require(_0xaef4('0x8'));var csv=require('to-csv');var ejs=require(_0xaef4('0x9'));var fs=require('fs');var fs_extra=require(_0xaef4('0xa'));var _=require(_0xaef4('0xb'));var squel=require(_0xaef4('0xc'));var crypto=require(_0xaef4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaef4('0xe'));var toCsv=require(_0xaef4('0xf'));var querystring=require(_0xaef4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaef4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaef4('0x12'));var hardwareService=require(_0xaef4('0x13'));var logger=require(_0xaef4('0x14'))(_0xaef4('0x15'));var utils=require(_0xaef4('0x16'));var config=require(_0xaef4('0x17'));var licenseUtil=require(_0xaef4('0x18'));var db=require(_0xaef4('0x19'))['db'];function respondWithStatusCode(_0x42687d,_0x362237){_0x362237=_0x362237||0xcc;return function(_0x1d8c86){if(_0x1d8c86){return _0x42687d[_0xaef4('0x1a')](_0x362237);}return _0x42687d[_0xaef4('0x1b')](_0x362237)[_0xaef4('0x1c')]();};}function respondWithResult(_0x3c6d2d,_0x4c41f3){_0x4c41f3=_0x4c41f3||0xc8;return function(_0x519ff0){if(_0x519ff0){return _0x3c6d2d[_0xaef4('0x1b')](_0x4c41f3)[_0xaef4('0x1d')](_0x519ff0);}};}function respondWithFilteredResult(_0x5a2bbd,_0x50f4c8){return function(_0x83e441){if(_0x83e441){var _0x557966=typeof _0x50f4c8[_0xaef4('0x1e')]===_0xaef4('0x1f')&&typeof _0x50f4c8[_0xaef4('0x20')]===_0xaef4('0x1f');var _0x7cd232=_0x83e441[_0xaef4('0x21')];var _0x4c9791=_0x557966?0x0:_0x50f4c8[_0xaef4('0x1e')];var _0x4f4b4a=_0x557966?_0x83e441[_0xaef4('0x21')]:_0x50f4c8[_0xaef4('0x1e')]+_0x50f4c8[_0xaef4('0x20')];var _0x863dbd;if(_0x4f4b4a>=_0x7cd232){_0x4f4b4a=_0x7cd232;_0x863dbd=0xc8;}else{_0x863dbd=0xce;}_0x5a2bbd[_0xaef4('0x1b')](_0x863dbd);return _0x5a2bbd[_0xaef4('0x22')](_0xaef4('0x23'),_0x4c9791+'-'+_0x4f4b4a+'/'+_0x7cd232)[_0xaef4('0x1d')](_0x83e441);}return null;};}function patchUpdates(_0x5a07f0){return function(_0x514d2e){try{jsonpatch[_0xaef4('0x24')](_0x514d2e,_0x5a07f0,!![]);}catch(_0x18f7d1){return BPromise['reject'](_0x18f7d1);}return _0x514d2e[_0xaef4('0x25')]();};}function saveUpdates(_0x5bdd2b,_0x3b43ac){return function(_0x461200){if(_0x461200){return _0x461200[_0xaef4('0x26')](_0x5bdd2b)[_0xaef4('0x27')](function(_0x4c8803){return _0x4c8803;});}return null;};}function removeEntity(_0x1241a9,_0x39a8ec){return function(_0x49f795){if(_0x49f795){return _0x49f795[_0xaef4('0x28')]()[_0xaef4('0x27')](function(){_0x1241a9[_0xaef4('0x1b')](0xcc)[_0xaef4('0x1c')]();});}};}function handleEntityNotFound(_0x58f198,_0x4e0a16){return function(_0x5cf796){if(!_0x5cf796){_0x58f198[_0xaef4('0x1a')](0x194);}return _0x5cf796;};}function handleError(_0x29197d,_0x40fff7){_0x40fff7=_0x40fff7||0x1f4;return function(_0x2550d2){logger['error'](_0x2550d2[_0xaef4('0x29')]);if(_0x2550d2['name']){delete _0x2550d2['name'];}_0x29197d['status'](_0x40fff7)[_0xaef4('0x2a')](_0x2550d2);};}exports['index']=function(_0x367a9e,_0x4788c7){var _0x38a307={},_0xb71558={},_0x493e07={'count':0x0,'rows':[]};var _0x3d16ae=_[_0xaef4('0x2b')](db[_0xaef4('0x2c')][_0xaef4('0x2d')],function(_0x44875d){return{'name':_0x44875d[_0xaef4('0x2e')],'type':_0x44875d[_0xaef4('0x2f')][_0xaef4('0x30')]};});_0xb71558['model']=_['map'](_0x3d16ae,_0xaef4('0x31'));_0xb71558[_0xaef4('0x32')]=_['keys'](_0x367a9e[_0xaef4('0x32')]);_0xb71558[_0xaef4('0x33')]=_[_0xaef4('0x34')](_0xb71558['model'],_0xb71558['query']);_0x38a307[_0xaef4('0x35')]=_[_0xaef4('0x34')](_0xb71558['model'],qs['fields'](_0x367a9e[_0xaef4('0x32')][_0xaef4('0x36')]));_0x38a307['attributes']=_0x38a307['attributes'][_0xaef4('0x37')]?_0x38a307[_0xaef4('0x35')]:_0xb71558[_0xaef4('0x38')];if(!_0x367a9e[_0xaef4('0x32')]['hasOwnProperty'](_0xaef4('0x39'))){_0x38a307[_0xaef4('0x20')]=qs[_0xaef4('0x20')](_0x367a9e[_0xaef4('0x32')][_0xaef4('0x20')]);_0x38a307[_0xaef4('0x1e')]=qs[_0xaef4('0x1e')](_0x367a9e[_0xaef4('0x32')]['offset']);}_0x38a307[_0xaef4('0x3a')]=qs['sort'](_0x367a9e[_0xaef4('0x32')][_0xaef4('0x3b')]);_0x38a307[_0xaef4('0x3c')]=qs[_0xaef4('0x33')](_['pick'](_0x367a9e['query'],_0xb71558['filters']),_0x3d16ae);if(_0x367a9e[_0xaef4('0x32')][_0xaef4('0x3d')]){_0x38a307[_0xaef4('0x3c')]=_[_0xaef4('0x3e')](_0x38a307['where'],{'$or':_[_0xaef4('0x2b')](_0x3d16ae,function(_0x160e7e){if(_0x160e7e[_0xaef4('0x2f')]!==_0xaef4('0x3f')){var _0x5978ba={};_0x5978ba[_0x160e7e[_0xaef4('0x31')]]={'$like':'%'+_0x367a9e[_0xaef4('0x32')][_0xaef4('0x3d')]+'%'};return _0x5978ba;}})});}_0x38a307=_[_0xaef4('0x3e')]({},_0x38a307,_0x367a9e['options']);var _0x2e9856={'where':_0x38a307[_0xaef4('0x3c')]};return db[_0xaef4('0x2c')][_0xaef4('0x21')](_0x2e9856)['then'](function(_0x505951){_0x493e07[_0xaef4('0x21')]=_0x505951;if(_0x367a9e[_0xaef4('0x32')][_0xaef4('0x40')]){_0x38a307[_0xaef4('0x41')]=[{'all':!![]}];}return db[_0xaef4('0x2c')][_0xaef4('0x42')](_0x38a307);})['then'](function(_0x133b03){_0x493e07[_0xaef4('0x43')]=_0x133b03;return _0x493e07;})[_0xaef4('0x27')](respondWithFilteredResult(_0x4788c7,_0x38a307))['catch'](handleError(_0x4788c7,null));};exports[_0xaef4('0x44')]=function(_0x1d6522,_0x13286d){var _0x2c6dde={'raw':!![],'where':{'id':_0x1d6522[_0xaef4('0x45')]['id']}},_0x4c43c5={};_0x4c43c5[_0xaef4('0x38')]=_[_0xaef4('0x46')](db[_0xaef4('0x2c')][_0xaef4('0x2d')]);_0x4c43c5[_0xaef4('0x32')]=_[_0xaef4('0x46')](_0x1d6522[_0xaef4('0x32')]);_0x4c43c5[_0xaef4('0x33')]=_['intersection'](_0x4c43c5[_0xaef4('0x38')],_0x4c43c5[_0xaef4('0x32')]);_0x2c6dde[_0xaef4('0x35')]=_[_0xaef4('0x34')](_0x4c43c5[_0xaef4('0x38')],qs[_0xaef4('0x36')](_0x1d6522['query']['fields']));_0x2c6dde[_0xaef4('0x35')]=_0x2c6dde[_0xaef4('0x35')][_0xaef4('0x37')]?_0x2c6dde[_0xaef4('0x35')]:_0x4c43c5['model'];if(_0x1d6522['query'][_0xaef4('0x40')]){_0x2c6dde[_0xaef4('0x41')]=[{'all':!![]}];}_0x2c6dde=_[_0xaef4('0x3e')]({},_0x2c6dde,_0x1d6522[_0xaef4('0x47')]);return db['MailSubstatus'][_0xaef4('0x48')](_0x2c6dde)[_0xaef4('0x27')](handleEntityNotFound(_0x13286d,null))[_0xaef4('0x27')](respondWithResult(_0x13286d,null))[_0xaef4('0x49')](handleError(_0x13286d,null));};exports[_0xaef4('0x4a')]=function(_0x49b9a9,_0x5597d1){return db[_0xaef4('0x2c')]['create'](_0x49b9a9[_0xaef4('0x4b')],{})[_0xaef4('0x27')](respondWithResult(_0x5597d1,0xc9))['catch'](handleError(_0x5597d1,null));};exports[_0xaef4('0x26')]=function(_0x5738f3,_0x1d1269){if(_0x5738f3[_0xaef4('0x4b')]['id']){delete _0x5738f3[_0xaef4('0x4b')]['id'];}return db[_0xaef4('0x2c')][_0xaef4('0x48')]({'where':{'id':_0x5738f3[_0xaef4('0x45')]['id']}})[_0xaef4('0x27')](handleEntityNotFound(_0x1d1269,null))[_0xaef4('0x27')](saveUpdates(_0x5738f3['body'],null))[_0xaef4('0x27')](respondWithResult(_0x1d1269,null))[_0xaef4('0x49')](handleError(_0x1d1269,null));};exports[_0xaef4('0x28')]=function(_0x49b6bc,_0x32ec72){return db['MailSubstatus'][_0xaef4('0x48')]({'where':{'id':_0x49b6bc[_0xaef4('0x45')]['id']}})[_0xaef4('0x27')](handleEntityNotFound(_0x32ec72,null))['then'](removeEntity(_0x32ec72,null))[_0xaef4('0x49')](handleError(_0x32ec72,null));};exports[_0xaef4('0x4c')]=function(_0x36498e,_0xbf8208){return db['MailSubstatus'][_0xaef4('0x4c')]()[_0xaef4('0x27')](respondWithResult(_0xbf8208,null))[_0xaef4('0x49')](handleError(_0xbf8208,null));}; \ No newline at end of file +var _0x11d9=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x3d1b3a,_0x269484){var _0x1c9d35=function(_0x32ae1e){while(--_0x32ae1e){_0x3d1b3a['push'](_0x3d1b3a['shift']());}};_0x1c9d35(++_0x269484);}(_0x11d9,0xe6));var _0x911d=function(_0x415acc,_0x378814){_0x415acc=_0x415acc-0x0;var _0x36f894=_0x11d9[_0x415acc];return _0x36f894;};'use strict';var emlformat=require(_0x911d('0x0'));var rimraf=require(_0x911d('0x1'));var zipdir=require(_0x911d('0x2'));var jsonpatch=require(_0x911d('0x3'));var rp=require(_0x911d('0x4'));var moment=require(_0x911d('0x5'));var BPromise=require(_0x911d('0x6'));var Mustache=require('mustache');var util=require(_0x911d('0x7'));var path=require(_0x911d('0x8'));var sox=require(_0x911d('0x9'));var csv=require(_0x911d('0xa'));var ejs=require(_0x911d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x911d('0xc'));var crypto=require(_0x911d('0xd'));var jsforce=require(_0x911d('0xe'));var deskjs=require(_0x911d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x911d('0x10'));var Papa=require(_0x911d('0x11'));var Redis=require(_0x911d('0x12'));var authService=require(_0x911d('0x13'));var qs=require(_0x911d('0x14'));var as=require(_0x911d('0x15'));var hardwareService=require(_0x911d('0x16'));var logger=require(_0x911d('0x17'))(_0x911d('0x18'));var utils=require(_0x911d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x911d('0x1a'));var db=require(_0x911d('0x1b'))['db'];function respondWithStatusCode(_0x394684,_0x29a6bf){_0x29a6bf=_0x29a6bf||0xcc;return function(_0xc46997){if(_0xc46997){return _0x394684[_0x911d('0x1c')](_0x29a6bf);}return _0x394684[_0x911d('0x1d')](_0x29a6bf)['end']();};}function respondWithResult(_0x2d79fe,_0x15ac9b){_0x15ac9b=_0x15ac9b||0xc8;return function(_0x22c223){if(_0x22c223){return _0x2d79fe[_0x911d('0x1d')](_0x15ac9b)[_0x911d('0x1e')](_0x22c223);}};}function respondWithFilteredResult(_0x19431c,_0x83d168){return function(_0x10ec1c){if(_0x10ec1c){var _0x1759df=typeof _0x83d168[_0x911d('0x1f')]===_0x911d('0x20')&&typeof _0x83d168[_0x911d('0x21')]===_0x911d('0x20');var _0x2fc36a=_0x10ec1c[_0x911d('0x22')];var _0x150d56=_0x1759df?0x0:_0x83d168[_0x911d('0x1f')];var _0x54b1d1=_0x1759df?_0x10ec1c[_0x911d('0x22')]:_0x83d168['offset']+_0x83d168[_0x911d('0x21')];var _0x1c8315;if(_0x54b1d1>=_0x2fc36a){_0x54b1d1=_0x2fc36a;_0x1c8315=0xc8;}else{_0x1c8315=0xce;}_0x19431c[_0x911d('0x1d')](_0x1c8315);return _0x19431c[_0x911d('0x23')](_0x911d('0x24'),_0x150d56+'-'+_0x54b1d1+'/'+_0x2fc36a)[_0x911d('0x1e')](_0x10ec1c);}return null;};}function patchUpdates(_0x100060){return function(_0x22b6a9){try{jsonpatch[_0x911d('0x25')](_0x22b6a9,_0x100060,!![]);}catch(_0x507f1d){return BPromise[_0x911d('0x26')](_0x507f1d);}return _0x22b6a9[_0x911d('0x27')]();};}function saveUpdates(_0x551259,_0xff04){return function(_0x493a84){if(_0x493a84){return _0x493a84[_0x911d('0x28')](_0x551259)[_0x911d('0x29')](function(_0x36ee99){return _0x36ee99;});}return null;};}function removeEntity(_0x47c569,_0x2c642f){return function(_0x528db3){if(_0x528db3){return _0x528db3[_0x911d('0x2a')]()[_0x911d('0x29')](function(){_0x47c569[_0x911d('0x1d')](0xcc)[_0x911d('0x2b')]();});}};}function handleEntityNotFound(_0x3536eb,_0x5e1634){return function(_0x3148f7){if(!_0x3148f7){_0x3536eb['sendStatus'](0x194);}return _0x3148f7;};}function handleError(_0x38ff77,_0x282c5f){_0x282c5f=_0x282c5f||0x1f4;return function(_0x4c69a3){logger[_0x911d('0x2c')](_0x4c69a3[_0x911d('0x2d')]);if(_0x4c69a3[_0x911d('0x2e')]){delete _0x4c69a3[_0x911d('0x2e')];}_0x38ff77['status'](_0x282c5f)[_0x911d('0x2f')](_0x4c69a3);};}exports[_0x911d('0x30')]=function(_0x29323b,_0x49861d){var _0x25b30f={},_0x2f9a6b={},_0x590d66={'count':0x0,'rows':[]};var _0x301252=_['map'](db[_0x911d('0x31')][_0x911d('0x32')],function(_0x23495a){return{'name':_0x23495a[_0x911d('0x33')],'type':_0x23495a[_0x911d('0x34')][_0x911d('0x35')]};});_0x2f9a6b[_0x911d('0x36')]=_[_0x911d('0x37')](_0x301252,_0x911d('0x2e'));_0x2f9a6b[_0x911d('0x38')]=_[_0x911d('0x39')](_0x29323b[_0x911d('0x38')]);_0x2f9a6b[_0x911d('0x3a')]=_[_0x911d('0x3b')](_0x2f9a6b['model'],_0x2f9a6b[_0x911d('0x38')]);_0x25b30f[_0x911d('0x3c')]=_['intersection'](_0x2f9a6b[_0x911d('0x36')],qs['fields'](_0x29323b['query'][_0x911d('0x3d')]));_0x25b30f[_0x911d('0x3c')]=_0x25b30f[_0x911d('0x3c')][_0x911d('0x3e')]?_0x25b30f[_0x911d('0x3c')]:_0x2f9a6b[_0x911d('0x36')];if(!_0x29323b[_0x911d('0x38')][_0x911d('0x3f')](_0x911d('0x40'))){_0x25b30f[_0x911d('0x21')]=qs['limit'](_0x29323b[_0x911d('0x38')][_0x911d('0x21')]);_0x25b30f[_0x911d('0x1f')]=qs[_0x911d('0x1f')](_0x29323b[_0x911d('0x38')][_0x911d('0x1f')]);}_0x25b30f[_0x911d('0x41')]=qs['sort'](_0x29323b[_0x911d('0x38')]['sort']);_0x25b30f[_0x911d('0x42')]=qs[_0x911d('0x3a')](_[_0x911d('0x43')](_0x29323b[_0x911d('0x38')],_0x2f9a6b[_0x911d('0x3a')]),_0x301252);if(_0x29323b[_0x911d('0x38')][_0x911d('0x44')]){_0x25b30f[_0x911d('0x42')]=_[_0x911d('0x45')](_0x25b30f[_0x911d('0x42')],{'$or':_[_0x911d('0x37')](_0x301252,function(_0x41b903){if(_0x41b903[_0x911d('0x34')]!==_0x911d('0x46')){var _0xd6cf7f={};_0xd6cf7f[_0x41b903[_0x911d('0x2e')]]={'$like':'%'+_0x29323b['query'][_0x911d('0x44')]+'%'};return _0xd6cf7f;}})});}_0x25b30f=_[_0x911d('0x45')]({},_0x25b30f,_0x29323b['options']);var _0x4248f4={'where':_0x25b30f['where']};return db[_0x911d('0x31')][_0x911d('0x22')](_0x4248f4)[_0x911d('0x29')](function(_0x54c077){_0x590d66['count']=_0x54c077;if(_0x29323b[_0x911d('0x38')][_0x911d('0x47')]){_0x25b30f[_0x911d('0x48')]=[{'all':!![]}];}return db[_0x911d('0x31')][_0x911d('0x49')](_0x25b30f);})[_0x911d('0x29')](function(_0x1d7c02){_0x590d66[_0x911d('0x4a')]=_0x1d7c02;return _0x590d66;})['then'](respondWithFilteredResult(_0x49861d,_0x25b30f))[_0x911d('0x4b')](handleError(_0x49861d,null));};exports[_0x911d('0x4c')]=function(_0x17bf74,_0x3b451d){var _0x605dd2={'raw':!![],'where':{'id':_0x17bf74[_0x911d('0x4d')]['id']}},_0x1574ea={};_0x1574ea[_0x911d('0x36')]=_[_0x911d('0x39')](db['MailSubstatus'][_0x911d('0x32')]);_0x1574ea[_0x911d('0x38')]=_[_0x911d('0x39')](_0x17bf74[_0x911d('0x38')]);_0x1574ea[_0x911d('0x3a')]=_[_0x911d('0x3b')](_0x1574ea['model'],_0x1574ea['query']);_0x605dd2[_0x911d('0x3c')]=_['intersection'](_0x1574ea[_0x911d('0x36')],qs[_0x911d('0x3d')](_0x17bf74[_0x911d('0x38')]['fields']));_0x605dd2[_0x911d('0x3c')]=_0x605dd2[_0x911d('0x3c')][_0x911d('0x3e')]?_0x605dd2['attributes']:_0x1574ea[_0x911d('0x36')];if(_0x17bf74[_0x911d('0x38')]['includeAll']){_0x605dd2[_0x911d('0x48')]=[{'all':!![]}];}_0x605dd2=_[_0x911d('0x45')]({},_0x605dd2,_0x17bf74['options']);return db[_0x911d('0x31')][_0x911d('0x4e')](_0x605dd2)[_0x911d('0x29')](handleEntityNotFound(_0x3b451d,null))[_0x911d('0x29')](respondWithResult(_0x3b451d,null))[_0x911d('0x4b')](handleError(_0x3b451d,null));};exports['create']=function(_0x2af552,_0xe39e65){return db[_0x911d('0x31')][_0x911d('0x4f')](_0x2af552[_0x911d('0x50')],{})[_0x911d('0x29')](respondWithResult(_0xe39e65,0xc9))[_0x911d('0x4b')](handleError(_0xe39e65,null));};exports['update']=function(_0x1bbed8,_0x1d9258){if(_0x1bbed8[_0x911d('0x50')]['id']){delete _0x1bbed8['body']['id'];}return db[_0x911d('0x31')][_0x911d('0x4e')]({'where':{'id':_0x1bbed8[_0x911d('0x4d')]['id']}})[_0x911d('0x29')](handleEntityNotFound(_0x1d9258,null))[_0x911d('0x29')](saveUpdates(_0x1bbed8[_0x911d('0x50')],null))[_0x911d('0x29')](respondWithResult(_0x1d9258,null))[_0x911d('0x4b')](handleError(_0x1d9258,null));};exports['destroy']=function(_0xe07e2e,_0xc2112e){return db[_0x911d('0x31')][_0x911d('0x4e')]({'where':{'id':_0xe07e2e[_0x911d('0x4d')]['id']}})[_0x911d('0x29')](handleEntityNotFound(_0xc2112e,null))[_0x911d('0x29')](removeEntity(_0xc2112e,null))[_0x911d('0x4b')](handleError(_0xc2112e,null));};exports[_0x911d('0x51')]=function(_0x5891ab,_0xd42f6f){return db[_0x911d('0x31')]['describe']()[_0x911d('0x29')](respondWithResult(_0xd42f6f,null))[_0x911d('0x4b')](handleError(_0xd42f6f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index fce724e..a949547 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 _0x9e2f=['request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','../../config/logger','api','moment'];(function(_0x3ba552,_0x304107){var _0x58b770=function(_0x1be5ba){while(--_0x1be5ba){_0x3ba552['push'](_0x3ba552['shift']());}};_0x58b770(++_0x304107);}(_0x9e2f,0x76));var _0xf9e2=function(_0x14bd48,_0x5d2831){_0x14bd48=_0x14bd48-0x0;var _0x3e2890=_0x9e2f[_0x14bd48];return _0x3e2890;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf9e2('0x0'))(_0xf9e2('0x1'));var moment=require(_0xf9e2('0x2'));var BPromise=require('bluebird');var rp=require(_0xf9e2('0x3'));var fs=require('fs');var path=require(_0xf9e2('0x4'));var rimraf=require(_0xf9e2('0x5'));var config=require(_0xf9e2('0x6'));var attributes=require(_0xf9e2('0x7'));module[_0xf9e2('0x8')]=function(_0xfc50ee,_0x2b2c52){return _0xfc50ee[_0xf9e2('0x9')](_0xf9e2('0xa'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e5d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','util','../../config/logger'];(function(_0x4daa4f,_0x19036a){var _0x3ca9f8=function(_0x31607f){while(--_0x31607f){_0x4daa4f['push'](_0x4daa4f['shift']());}};_0x3ca9f8(++_0x19036a);}(_0x2e5d,0x12a));var _0xd2e5=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0x2e5d[_0xe84805];return _0x398efd;};'use strict';var _=require('lodash');var util=require(_0xd2e5('0x0'));var logger=require(_0xd2e5('0x1'))(_0xd2e5('0x2'));var moment=require(_0xd2e5('0x3'));var BPromise=require(_0xd2e5('0x4'));var rp=require(_0xd2e5('0x5'));var fs=require('fs');var path=require(_0xd2e5('0x6'));var rimraf=require(_0xd2e5('0x7'));var config=require(_0xd2e5('0x8'));var attributes=require(_0xd2e5('0x9'));module[_0xd2e5('0xa')]=function(_0xd6e780,_0x4856bb){return _0xd6e780[_0xd2e5('0xb')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index afb36f6..cf223a0 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 _0x07be=['jayson/promise','client','http','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5d3a59,_0x475e27){var _0x5f04c8=function(_0x141dd3){while(--_0x141dd3){_0x5d3a59['push'](_0x5d3a59['shift']());}};_0x5f04c8(++_0x475e27);}(_0x07be,0x75));var _0xe07b=function(_0x436091,_0x351cb0){_0x436091=_0x436091-0x0;var _0x4cd281=_0x07be[_0x436091];return _0x4cd281;};'use strict';var _=require(_0xe07b('0x0'));var util=require(_0xe07b('0x1'));var moment=require(_0xe07b('0x2'));var BPromise=require(_0xe07b('0x3'));var rs=require(_0xe07b('0x4'));var fs=require('fs');var Redis=require(_0xe07b('0x5'));var db=require(_0xe07b('0x6'))['db'];var utils=require(_0xe07b('0x7'));var logger=require(_0xe07b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe07b('0x9'));var client=jayson[_0xe07b('0xa')][_0xe07b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x270136,_0x5d66a1,_0x1288c4){return new BPromise(function(_0x59ee59,_0x33e11a){return client['request'](_0x270136,_0x1288c4)['then'](function(_0x554cdc){logger[_0xe07b('0xc')](_0xe07b('0xd'),_0x5d66a1,_0xe07b('0xe'));logger[_0xe07b('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x5d66a1,_0xe07b('0xe'),JSON['stringify'](_0x554cdc));if(_0x554cdc[_0xe07b('0x10')]){if(_0x554cdc[_0xe07b('0x10')][_0xe07b('0x11')]===0x1f4){logger[_0xe07b('0x10')](_0xe07b('0xd'),_0x5d66a1,_0x554cdc[_0xe07b('0x10')]['message']);return _0x33e11a(_0x554cdc['error'][_0xe07b('0x12')]);}logger[_0xe07b('0x10')](_0xe07b('0xd'),_0x5d66a1,_0x554cdc[_0xe07b('0x10')][_0xe07b('0x12')]);return _0x59ee59(_0x554cdc[_0xe07b('0x10')][_0xe07b('0x12')]);}else{logger['info'](_0xe07b('0xd'),_0x5d66a1,_0xe07b('0xe'));_0x59ee59(_0x554cdc[_0xe07b('0x13')][_0xe07b('0x12')]);}})[_0xe07b('0x14')](function(_0xfcce2e){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5d66a1,_0xfcce2e);_0x33e11a(_0xfcce2e);});});} \ No newline at end of file +var _0x1bae=['request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1bae,0x7e));var _0xe1ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bae[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe1ba('0x0'));var moment=require(_0xe1ba('0x1'));var BPromise=require(_0xe1ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe1ba('0x3'));var db=require(_0xe1ba('0x4'))['db'];var utils=require(_0xe1ba('0x5'));var logger=require(_0xe1ba('0x6'))(_0xe1ba('0x7'));var config=require(_0xe1ba('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe1ba('0x9')][_0xe1ba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16d55f,_0x1e5dd5,_0x284d69){return new BPromise(function(_0x3c5773,_0x1e0ee1){return client['request'](_0x16d55f,_0x284d69)[_0xe1ba('0xb')](function(_0x5aa173){logger[_0xe1ba('0xc')](_0xe1ba('0xd'),_0x1e5dd5,_0xe1ba('0xe'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1e5dd5,'request\x20sent',JSON[_0xe1ba('0xf')](_0x5aa173));if(_0x5aa173[_0xe1ba('0x10')]){if(_0x5aa173[_0xe1ba('0x10')]['code']===0x1f4){logger[_0xe1ba('0x10')](_0xe1ba('0xd'),_0x1e5dd5,_0x5aa173[_0xe1ba('0x10')][_0xe1ba('0x11')]);return _0x1e0ee1(_0x5aa173[_0xe1ba('0x10')][_0xe1ba('0x11')]);}logger[_0xe1ba('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x1e5dd5,_0x5aa173['error'][_0xe1ba('0x11')]);return _0x3c5773(_0x5aa173['error'][_0xe1ba('0x11')]);}else{logger[_0xe1ba('0xc')](_0xe1ba('0xd'),_0x1e5dd5,_0xe1ba('0xe'));_0x3c5773(_0x5aa173[_0xe1ba('0x12')][_0xe1ba('0x11')]);}})[_0xe1ba('0x13')](function(_0x4b273d){logger[_0xe1ba('0x10')](_0xe1ba('0xd'),_0x1e5dd5,_0x4b273d);_0x1e0ee1(_0x4b273d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c11bd0d..fefd93a 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 _0x79e0=['show','create','put','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0xbab754,_0x5c993c){var _0x4de870=function(_0x378624){while(--_0x378624){_0xbab754['push'](_0xbab754['shift']());}};_0x4de870(++_0x5c993c);}(_0x79e0,0x194));var _0x079e=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0x79e0[_0x29e2af];return _0x1ea06a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x079e('0x0'));var timeout=require(_0x079e('0x1'));var express=require(_0x079e('0x2'));var router=express[_0x079e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x079e('0x4'));var interaction=require(_0x079e('0x5'));var config=require(_0x079e('0x6'));var controller=require(_0x079e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x079e('0x8')]);router[_0x079e('0x9')](_0x079e('0xa'),auth[_0x079e('0xb')](),controller[_0x079e('0xc')]);router[_0x079e('0x9')](_0x079e('0xd'),auth[_0x079e('0xb')](),controller[_0x079e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x079e('0xf')]);router[_0x079e('0x10')](_0x079e('0xd'),auth[_0x079e('0xb')](),controller['update']);router['delete'](_0x079e('0xd'),auth[_0x079e('0xb')](),controller[_0x079e('0x11')]);module[_0x079e('0x12')]=router; \ No newline at end of file +var _0xf8af=['../../components/auth/service','./mailTransferReport.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8af,0xd2));var _0xff8a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf8af[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0xff8a('0x0'));var path=require(_0xff8a('0x1'));var timeout=require(_0xff8a('0x2'));var express=require(_0xff8a('0x3'));var router=express[_0xff8a('0x4')]();var fs_extra=require(_0xff8a('0x5'));var auth=require(_0xff8a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xff8a('0x7'));router[_0xff8a('0x8')]('/',auth['isAuthenticated'](),controller[_0xff8a('0x9')]);router[_0xff8a('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xff8a('0xa'),auth[_0xff8a('0xb')](),controller[_0xff8a('0xc')]);router[_0xff8a('0xd')]('/',auth[_0xff8a('0xb')](),controller['create']);router[_0xff8a('0xe')](_0xff8a('0xa'),auth[_0xff8a('0xb')](),controller[_0xff8a('0xf')]);router[_0xff8a('0x10')](_0xff8a('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xff8a('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a5c9d97..7ad7786 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0xd32b55,_0x1b2696){var _0x5b86fd=function(_0x3a667a){while(--_0x3a667a){_0xd32b55['push'](_0xd32b55['shift']());}};_0x5b86fd(++_0x1b2696);}(_0x008c,0x188));var _0xc008=function(_0x41b133,_0x114320){_0x41b133=_0x41b133-0x0;var _0x844201=_0x008c[_0x41b133];return _0x844201;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x35f381,_0x146cef){var _0x4bd627=function(_0x4c5552){while(--_0x4c5552){_0x35f381['push'](_0x35f381['shift']());}};_0x4bd627(++_0x146cef);}(_0xedd9,0xfc));var _0x9edd=function(_0x256089,_0x47e128){_0x256089=_0x256089-0x0;var _0x72ce1f=_0xedd9[_0x256089];return _0x72ce1f;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 3fdcdf7..6c482fc 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 _0xd47d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','name','send','index','MailTransferReport','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x206251,_0x6c4977){var _0x442b47=function(_0x1e4beb){while(--_0x1e4beb){_0x206251['push'](_0x206251['shift']());}};_0x442b47(++_0x6c4977);}(_0xd47d,0x117));var _0xdd47=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0xd47d[_0x23f8c8];return _0x3dc718;};'use strict';var emlformat=require(_0xdd47('0x0'));var rimraf=require(_0xdd47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd47('0x2'));var rp=require('request-promise');var moment=require(_0xdd47('0x3'));var BPromise=require(_0xdd47('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd47('0x5'));var sox=require(_0xdd47('0x6'));var csv=require(_0xdd47('0x7'));var ejs=require(_0xdd47('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd47('0x9'));var squel=require(_0xdd47('0xa'));var crypto=require(_0xdd47('0xb'));var jsforce=require(_0xdd47('0xc'));var deskjs=require(_0xdd47('0xd'));var toCsv=require(_0xdd47('0x7'));var querystring=require('querystring');var Papa=require(_0xdd47('0xe'));var Redis=require(_0xdd47('0xf'));var authService=require(_0xdd47('0x10'));var qs=require(_0xdd47('0x11'));var as=require(_0xdd47('0x12'));var hardwareService=require(_0xdd47('0x13'));var logger=require(_0xdd47('0x14'))(_0xdd47('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd47('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39661f,_0x1bf352){_0x1bf352=_0x1bf352||0xcc;return function(_0x5be26a){if(_0x5be26a){return _0x39661f[_0xdd47('0x17')](_0x1bf352);}return _0x39661f['status'](_0x1bf352)[_0xdd47('0x18')]();};}function respondWithResult(_0x157660,_0x2a98f8){_0x2a98f8=_0x2a98f8||0xc8;return function(_0x3465a8){if(_0x3465a8){return _0x157660[_0xdd47('0x19')](_0x2a98f8)[_0xdd47('0x1a')](_0x3465a8);}};}function respondWithFilteredResult(_0x263aad,_0x4b314f){return function(_0x240a18){if(_0x240a18){var _0xedbfe4=typeof _0x4b314f[_0xdd47('0x1b')]===_0xdd47('0x1c')&&typeof _0x4b314f[_0xdd47('0x1d')]==='undefined';var _0x648ef2=_0x240a18[_0xdd47('0x1e')];var _0x522918=_0xedbfe4?0x0:_0x4b314f['offset'];var _0x35f0c9=_0xedbfe4?_0x240a18['count']:_0x4b314f[_0xdd47('0x1b')]+_0x4b314f[_0xdd47('0x1d')];var _0xd4c007;if(_0x35f0c9>=_0x648ef2){_0x35f0c9=_0x648ef2;_0xd4c007=0xc8;}else{_0xd4c007=0xce;}_0x263aad[_0xdd47('0x19')](_0xd4c007);return _0x263aad['set'](_0xdd47('0x1f'),_0x522918+'-'+_0x35f0c9+'/'+_0x648ef2)[_0xdd47('0x1a')](_0x240a18);}return null;};}function patchUpdates(_0x5e620a){return function(_0x3bbb81){try{jsonpatch[_0xdd47('0x20')](_0x3bbb81,_0x5e620a,!![]);}catch(_0x354e65){return BPromise['reject'](_0x354e65);}return _0x3bbb81['save']();};}function saveUpdates(_0x3954ec,_0x50a707){return function(_0x14d3d1){if(_0x14d3d1){return _0x14d3d1[_0xdd47('0x21')](_0x3954ec)[_0xdd47('0x22')](function(_0x3fb97d){return _0x3fb97d;});}return null;};}function removeEntity(_0x27f2ee,_0x40082f){return function(_0x2a862b){if(_0x2a862b){return _0x2a862b[_0xdd47('0x23')]()[_0xdd47('0x22')](function(){_0x27f2ee[_0xdd47('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507dec,_0x4be2a3){return function(_0x3bdb88){if(!_0x3bdb88){_0x507dec[_0xdd47('0x17')](0x194);}return _0x3bdb88;};}function handleError(_0x13f636,_0x4bfd35){_0x4bfd35=_0x4bfd35||0x1f4;return function(_0x5d5986){logger[_0xdd47('0x24')](_0x5d5986['stack']);if(_0x5d5986[_0xdd47('0x25')]){delete _0x5d5986['name'];}_0x13f636[_0xdd47('0x19')](_0x4bfd35)[_0xdd47('0x26')](_0x5d5986);};}exports[_0xdd47('0x27')]=function(_0x532b83,_0x1cf2a7){var _0x389e35={},_0x45f213={},_0xac43e5={'count':0x0,'rows':[]};var _0xf3d81a=_['map'](db[_0xdd47('0x28')]['rawAttributes'],function(_0x550e2d){return{'name':_0x550e2d['fieldName'],'type':_0x550e2d['type'][_0xdd47('0x29')]};});_0x45f213[_0xdd47('0x2a')]=_[_0xdd47('0x2b')](_0xf3d81a,_0xdd47('0x25'));_0x45f213[_0xdd47('0x2c')]=_[_0xdd47('0x2d')](_0x532b83['query']);_0x45f213[_0xdd47('0x2e')]=_[_0xdd47('0x2f')](_0x45f213[_0xdd47('0x2a')],_0x45f213[_0xdd47('0x2c')]);_0x389e35[_0xdd47('0x30')]=_[_0xdd47('0x2f')](_0x45f213[_0xdd47('0x2a')],qs['fields'](_0x532b83[_0xdd47('0x2c')][_0xdd47('0x31')]));_0x389e35[_0xdd47('0x30')]=_0x389e35[_0xdd47('0x30')][_0xdd47('0x32')]?_0x389e35[_0xdd47('0x30')]:_0x45f213[_0xdd47('0x2a')];if(!_0x532b83[_0xdd47('0x2c')][_0xdd47('0x33')](_0xdd47('0x34'))){_0x389e35[_0xdd47('0x1d')]=qs[_0xdd47('0x1d')](_0x532b83[_0xdd47('0x2c')][_0xdd47('0x1d')]);_0x389e35['offset']=qs[_0xdd47('0x1b')](_0x532b83[_0xdd47('0x2c')]['offset']);}_0x389e35[_0xdd47('0x35')]=qs[_0xdd47('0x36')](_0x532b83['query']['sort']);_0x389e35[_0xdd47('0x37')]=qs[_0xdd47('0x2e')](_[_0xdd47('0x38')](_0x532b83[_0xdd47('0x2c')],_0x45f213[_0xdd47('0x2e')]),_0xf3d81a);if(_0x532b83['query'][_0xdd47('0x39')]){_0x389e35[_0xdd47('0x37')]=_[_0xdd47('0x3a')](_0x389e35[_0xdd47('0x37')],{'$or':_[_0xdd47('0x2b')](_0xf3d81a,function(_0x58f921){if(_0x58f921[_0xdd47('0x3b')]!==_0xdd47('0x3c')){var _0x2ee4ad={};_0x2ee4ad[_0x58f921[_0xdd47('0x25')]]={'$like':'%'+_0x532b83[_0xdd47('0x2c')][_0xdd47('0x39')]+'%'};return _0x2ee4ad;}})});}_0x389e35=_[_0xdd47('0x3a')]({},_0x389e35,_0x532b83[_0xdd47('0x3d')]);var _0x9910e2={'where':_0x389e35['where']};return db[_0xdd47('0x28')][_0xdd47('0x1e')](_0x9910e2)[_0xdd47('0x22')](function(_0x3eb20e){_0xac43e5['count']=_0x3eb20e;if(_0x532b83[_0xdd47('0x2c')]['includeAll']){_0x389e35[_0xdd47('0x3e')]=[{'all':!![]}];}return db[_0xdd47('0x28')][_0xdd47('0x3f')](_0x389e35);})['then'](function(_0x5b2963){_0xac43e5[_0xdd47('0x40')]=_0x5b2963;return _0xac43e5;})[_0xdd47('0x22')](respondWithFilteredResult(_0x1cf2a7,_0x389e35))[_0xdd47('0x41')](handleError(_0x1cf2a7,null));};exports[_0xdd47('0x42')]=function(_0x18e75c,_0x308576){var _0x2595e0={'raw':!![],'where':{'id':_0x18e75c[_0xdd47('0x43')]['id']}},_0x298946={};_0x298946['model']=_[_0xdd47('0x2d')](db[_0xdd47('0x28')][_0xdd47('0x44')]);_0x298946['query']=_[_0xdd47('0x2d')](_0x18e75c[_0xdd47('0x2c')]);_0x298946[_0xdd47('0x2e')]=_[_0xdd47('0x2f')](_0x298946[_0xdd47('0x2a')],_0x298946[_0xdd47('0x2c')]);_0x2595e0['attributes']=_[_0xdd47('0x2f')](_0x298946['model'],qs[_0xdd47('0x31')](_0x18e75c[_0xdd47('0x2c')][_0xdd47('0x31')]));_0x2595e0['attributes']=_0x2595e0['attributes'][_0xdd47('0x32')]?_0x2595e0[_0xdd47('0x30')]:_0x298946[_0xdd47('0x2a')];if(_0x18e75c[_0xdd47('0x2c')][_0xdd47('0x45')]){_0x2595e0[_0xdd47('0x3e')]=[{'all':!![]}];}_0x2595e0=_['merge']({},_0x2595e0,_0x18e75c[_0xdd47('0x3d')]);return db['MailTransferReport'][_0xdd47('0x46')](_0x2595e0)[_0xdd47('0x22')](handleEntityNotFound(_0x308576,null))[_0xdd47('0x22')](respondWithResult(_0x308576,null))[_0xdd47('0x41')](handleError(_0x308576,null));};exports[_0xdd47('0x47')]=function(_0x29fc73,_0x318fde){return db[_0xdd47('0x28')][_0xdd47('0x47')](_0x29fc73[_0xdd47('0x48')],{})['then'](respondWithResult(_0x318fde,0xc9))['catch'](handleError(_0x318fde,null));};exports[_0xdd47('0x21')]=function(_0x9b6b44,_0x4359e0){if(_0x9b6b44[_0xdd47('0x48')]['id']){delete _0x9b6b44['body']['id'];}return db['MailTransferReport'][_0xdd47('0x46')]({'where':{'id':_0x9b6b44[_0xdd47('0x43')]['id']}})[_0xdd47('0x22')](handleEntityNotFound(_0x4359e0,null))['then'](saveUpdates(_0x9b6b44[_0xdd47('0x48')],null))[_0xdd47('0x22')](respondWithResult(_0x4359e0,null))[_0xdd47('0x41')](handleError(_0x4359e0,null));};exports[_0xdd47('0x23')]=function(_0x37c71a,_0x43ca9f){return db['MailTransferReport']['find']({'where':{'id':_0x37c71a['params']['id']}})[_0xdd47('0x22')](handleEntityNotFound(_0x43ca9f,null))['then'](removeEntity(_0x43ca9f,null))[_0xdd47('0x41')](handleError(_0x43ca9f,null));};exports[_0xdd47('0x49')]=function(_0x1369d4,_0x303b0f){return db[_0xdd47('0x28')]['describe']()[_0xdd47('0x22')](respondWithResult(_0x303b0f,null))['catch'](handleError(_0x303b0f,null));}; \ No newline at end of file +var _0x6b67=['nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','params','fields','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','end','error','name','send','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length'];(function(_0x1487b5,_0x1aec5e){var _0xb40cf1=function(_0x397e70){while(--_0x397e70){_0x1487b5['push'](_0x1487b5['shift']());}};_0xb40cf1(++_0x1aec5e);}(_0x6b67,0xb3));var _0x76b6=function(_0x22ed4b,_0x20609c){_0x22ed4b=_0x22ed4b-0x0;var _0x4e9cf6=_0x6b67[_0x22ed4b];return _0x4e9cf6;};'use strict';var emlformat=require(_0x76b6('0x0'));var rimraf=require(_0x76b6('0x1'));var zipdir=require(_0x76b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76b6('0x3'));var moment=require(_0x76b6('0x4'));var BPromise=require(_0x76b6('0x5'));var Mustache=require(_0x76b6('0x6'));var util=require(_0x76b6('0x7'));var path=require(_0x76b6('0x8'));var sox=require(_0x76b6('0x9'));var csv=require(_0x76b6('0xa'));var ejs=require(_0x76b6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76b6('0xc'));var squel=require(_0x76b6('0xd'));var crypto=require(_0x76b6('0xe'));var jsforce=require(_0x76b6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x76b6('0xa'));var querystring=require(_0x76b6('0x10'));var Papa=require(_0x76b6('0x11'));var Redis=require(_0x76b6('0x12'));var authService=require(_0x76b6('0x13'));var qs=require(_0x76b6('0x14'));var as=require(_0x76b6('0x15'));var hardwareService=require(_0x76b6('0x16'));var logger=require(_0x76b6('0x17'))(_0x76b6('0x18'));var utils=require(_0x76b6('0x19'));var config=require(_0x76b6('0x1a'));var licenseUtil=require(_0x76b6('0x1b'));var db=require(_0x76b6('0x1c'))['db'];function respondWithStatusCode(_0x3e2d9a,_0x3cb96e){_0x3cb96e=_0x3cb96e||0xcc;return function(_0x5e6f3d){if(_0x5e6f3d){return _0x3e2d9a[_0x76b6('0x1d')](_0x3cb96e);}return _0x3e2d9a[_0x76b6('0x1e')](_0x3cb96e)['end']();};}function respondWithResult(_0x29affa,_0x26b62a){_0x26b62a=_0x26b62a||0xc8;return function(_0x365b2f){if(_0x365b2f){return _0x29affa[_0x76b6('0x1e')](_0x26b62a)['json'](_0x365b2f);}};}function respondWithFilteredResult(_0x59f7ff,_0x47483a){return function(_0xe1b569){if(_0xe1b569){var _0xdc8f3e=typeof _0x47483a['offset']===_0x76b6('0x1f')&&typeof _0x47483a[_0x76b6('0x20')]===_0x76b6('0x1f');var _0x5f21a0=_0xe1b569['count'];var _0x4e3ce2=_0xdc8f3e?0x0:_0x47483a['offset'];var _0x106633=_0xdc8f3e?_0xe1b569[_0x76b6('0x21')]:_0x47483a[_0x76b6('0x22')]+_0x47483a['limit'];var _0xe4a0ec;if(_0x106633>=_0x5f21a0){_0x106633=_0x5f21a0;_0xe4a0ec=0xc8;}else{_0xe4a0ec=0xce;}_0x59f7ff[_0x76b6('0x1e')](_0xe4a0ec);return _0x59f7ff['set'](_0x76b6('0x23'),_0x4e3ce2+'-'+_0x106633+'/'+_0x5f21a0)[_0x76b6('0x24')](_0xe1b569);}return null;};}function patchUpdates(_0x5b0dde){return function(_0x19c96b){try{jsonpatch[_0x76b6('0x25')](_0x19c96b,_0x5b0dde,!![]);}catch(_0x119dd8){return BPromise[_0x76b6('0x26')](_0x119dd8);}return _0x19c96b[_0x76b6('0x27')]();};}function saveUpdates(_0x48fbc3,_0x984a6c){return function(_0x1af1de){if(_0x1af1de){return _0x1af1de[_0x76b6('0x28')](_0x48fbc3)[_0x76b6('0x29')](function(_0x5f4b08){return _0x5f4b08;});}return null;};}function removeEntity(_0x3d6871,_0x296f4f){return function(_0x397e03){if(_0x397e03){return _0x397e03['destroy']()[_0x76b6('0x29')](function(){_0x3d6871[_0x76b6('0x1e')](0xcc)[_0x76b6('0x2a')]();});}};}function handleEntityNotFound(_0x126fc1,_0x3c960a){return function(_0x382872){if(!_0x382872){_0x126fc1[_0x76b6('0x1d')](0x194);}return _0x382872;};}function handleError(_0x14ab46,_0x1d084b){_0x1d084b=_0x1d084b||0x1f4;return function(_0x34a164){logger[_0x76b6('0x2b')](_0x34a164['stack']);if(_0x34a164[_0x76b6('0x2c')]){delete _0x34a164[_0x76b6('0x2c')];}_0x14ab46['status'](_0x1d084b)[_0x76b6('0x2d')](_0x34a164);};}exports['index']=function(_0x10ca16,_0x1b931b){var _0x53d82e={},_0xf66575={},_0x24c72a={'count':0x0,'rows':[]};var _0x33b841=_[_0x76b6('0x2e')](db[_0x76b6('0x2f')][_0x76b6('0x30')],function(_0x3cbdeb){return{'name':_0x3cbdeb[_0x76b6('0x31')],'type':_0x3cbdeb['type'][_0x76b6('0x32')]};});_0xf66575[_0x76b6('0x33')]=_[_0x76b6('0x2e')](_0x33b841,_0x76b6('0x2c'));_0xf66575[_0x76b6('0x34')]=_[_0x76b6('0x35')](_0x10ca16[_0x76b6('0x34')]);_0xf66575[_0x76b6('0x36')]=_[_0x76b6('0x37')](_0xf66575[_0x76b6('0x33')],_0xf66575[_0x76b6('0x34')]);_0x53d82e[_0x76b6('0x38')]=_[_0x76b6('0x37')](_0xf66575['model'],qs['fields'](_0x10ca16[_0x76b6('0x34')]['fields']));_0x53d82e[_0x76b6('0x38')]=_0x53d82e['attributes'][_0x76b6('0x39')]?_0x53d82e[_0x76b6('0x38')]:_0xf66575[_0x76b6('0x33')];if(!_0x10ca16[_0x76b6('0x34')]['hasOwnProperty'](_0x76b6('0x3a'))){_0x53d82e[_0x76b6('0x20')]=qs['limit'](_0x10ca16[_0x76b6('0x34')]['limit']);_0x53d82e[_0x76b6('0x22')]=qs[_0x76b6('0x22')](_0x10ca16[_0x76b6('0x34')][_0x76b6('0x22')]);}_0x53d82e[_0x76b6('0x3b')]=qs[_0x76b6('0x3c')](_0x10ca16[_0x76b6('0x34')][_0x76b6('0x3c')]);_0x53d82e[_0x76b6('0x3d')]=qs[_0x76b6('0x36')](_[_0x76b6('0x3e')](_0x10ca16[_0x76b6('0x34')],_0xf66575[_0x76b6('0x36')]),_0x33b841);if(_0x10ca16[_0x76b6('0x34')][_0x76b6('0x3f')]){_0x53d82e['where']=_[_0x76b6('0x40')](_0x53d82e['where'],{'$or':_[_0x76b6('0x2e')](_0x33b841,function(_0x12d9e4){if(_0x12d9e4[_0x76b6('0x41')]!=='VIRTUAL'){var _0x50a68b={};_0x50a68b[_0x12d9e4[_0x76b6('0x2c')]]={'$like':'%'+_0x10ca16[_0x76b6('0x34')][_0x76b6('0x3f')]+'%'};return _0x50a68b;}})});}_0x53d82e=_[_0x76b6('0x40')]({},_0x53d82e,_0x10ca16[_0x76b6('0x42')]);var _0x59f100={'where':_0x53d82e['where']};return db['MailTransferReport'][_0x76b6('0x21')](_0x59f100)[_0x76b6('0x29')](function(_0xc8cf1a){_0x24c72a['count']=_0xc8cf1a;if(_0x10ca16[_0x76b6('0x34')][_0x76b6('0x43')]){_0x53d82e['include']=[{'all':!![]}];}return db[_0x76b6('0x2f')][_0x76b6('0x44')](_0x53d82e);})[_0x76b6('0x29')](function(_0x2ac429){_0x24c72a[_0x76b6('0x45')]=_0x2ac429;return _0x24c72a;})[_0x76b6('0x29')](respondWithFilteredResult(_0x1b931b,_0x53d82e))[_0x76b6('0x46')](handleError(_0x1b931b,null));};exports['show']=function(_0x592a0a,_0x1e9ae0){var _0x49d635={'raw':!![],'where':{'id':_0x592a0a[_0x76b6('0x47')]['id']}},_0x25a0fc={};_0x25a0fc[_0x76b6('0x33')]=_[_0x76b6('0x35')](db[_0x76b6('0x2f')][_0x76b6('0x30')]);_0x25a0fc[_0x76b6('0x34')]=_[_0x76b6('0x35')](_0x592a0a[_0x76b6('0x34')]);_0x25a0fc[_0x76b6('0x36')]=_[_0x76b6('0x37')](_0x25a0fc[_0x76b6('0x33')],_0x25a0fc[_0x76b6('0x34')]);_0x49d635['attributes']=_[_0x76b6('0x37')](_0x25a0fc['model'],qs[_0x76b6('0x48')](_0x592a0a[_0x76b6('0x34')]['fields']));_0x49d635[_0x76b6('0x38')]=_0x49d635[_0x76b6('0x38')][_0x76b6('0x39')]?_0x49d635[_0x76b6('0x38')]:_0x25a0fc[_0x76b6('0x33')];if(_0x592a0a['query'][_0x76b6('0x43')]){_0x49d635[_0x76b6('0x49')]=[{'all':!![]}];}_0x49d635=_['merge']({},_0x49d635,_0x592a0a[_0x76b6('0x42')]);return db['MailTransferReport'][_0x76b6('0x4a')](_0x49d635)['then'](handleEntityNotFound(_0x1e9ae0,null))[_0x76b6('0x29')](respondWithResult(_0x1e9ae0,null))[_0x76b6('0x46')](handleError(_0x1e9ae0,null));};exports[_0x76b6('0x4b')]=function(_0x1747c7,_0x217029){return db['MailTransferReport']['create'](_0x1747c7['body'],{})[_0x76b6('0x29')](respondWithResult(_0x217029,0xc9))['catch'](handleError(_0x217029,null));};exports[_0x76b6('0x28')]=function(_0x283d64,_0x4f7c78){if(_0x283d64[_0x76b6('0x4c')]['id']){delete _0x283d64[_0x76b6('0x4c')]['id'];}return db['MailTransferReport'][_0x76b6('0x4a')]({'where':{'id':_0x283d64['params']['id']}})[_0x76b6('0x29')](handleEntityNotFound(_0x4f7c78,null))['then'](saveUpdates(_0x283d64[_0x76b6('0x4c')],null))[_0x76b6('0x29')](respondWithResult(_0x4f7c78,null))['catch'](handleError(_0x4f7c78,null));};exports[_0x76b6('0x4d')]=function(_0x3e8c0a,_0x4e37f3){return db[_0x76b6('0x2f')]['find']({'where':{'id':_0x3e8c0a[_0x76b6('0x47')]['id']}})[_0x76b6('0x29')](handleEntityNotFound(_0x4e37f3,null))[_0x76b6('0x29')](removeEntity(_0x4e37f3,null))[_0x76b6('0x46')](handleError(_0x4e37f3,null));};exports[_0x76b6('0x4e')]=function(_0x3b0a50,_0x3df9cf){return db[_0x76b6('0x2f')]['describe']()[_0x76b6('0x29')](respondWithResult(_0x3df9cf,null))['catch'](handleError(_0x3df9cf,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index fe28d67..70f0680 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 _0x3c94=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x120297,_0x1b2fbd){var _0x589f25=function(_0xf1a29b){while(--_0xf1a29b){_0x120297['push'](_0x120297['shift']());}};_0x589f25(++_0x1b2fbd);}(_0x3c94,0xcd));var _0x43c9=function(_0x250514,_0x389eda){_0x250514=_0x250514-0x0;var _0x59c25b=_0x3c94[_0x250514];return _0x59c25b;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var logger=require(_0x43c9('0x2'))(_0x43c9('0x3'));var moment=require(_0x43c9('0x4'));var BPromise=require(_0x43c9('0x5'));var rp=require(_0x43c9('0x6'));var fs=require('fs');var path=require(_0x43c9('0x7'));var rimraf=require(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var attributes=require(_0x43c9('0xa'));module[_0x43c9('0xb')]=function(_0x4fdfc2,_0x39c220){return _0x4fdfc2[_0x43c9('0xc')](_0x43c9('0xd'),attributes,{'tableName':_0x43c9('0xe'),'paranoid':![],'indexes':[{'name':_0x43c9('0xf'),'fields':[_0x43c9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bff=['bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api'];(function(_0x4145ed,_0x1965e3){var _0x2294a6=function(_0x21c3bb){while(--_0x21c3bb){_0x4145ed['push'](_0x4145ed['shift']());}};_0x2294a6(++_0x1965e3);}(_0x6bff,0xa6));var _0xf6bf=function(_0x14a7e0,_0x4a8b58){_0x14a7e0=_0x14a7e0-0x0;var _0x21f8bf=_0x6bff[_0x14a7e0];return _0x21f8bf;};'use strict';var _=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var logger=require('../../config/logger')(_0xf6bf('0x2'));var moment=require('moment');var BPromise=require(_0xf6bf('0x3'));var rp=require(_0xf6bf('0x4'));var fs=require('fs');var path=require(_0xf6bf('0x5'));var rimraf=require(_0xf6bf('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6bf('0x7'));module[_0xf6bf('0x8')]=function(_0x27cdda,_0x239d17){return _0x27cdda[_0xf6bf('0x9')](_0xf6bf('0xa'),attributes,{'tableName':_0xf6bf('0xb'),'paranoid':![],'indexes':[{'name':_0xf6bf('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index c764686..2e61c66 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 _0x2b1a=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x2b1a,0x1aa));var _0xa2b1=function(_0x114efa,_0x507a4f){_0x114efa=_0x114efa-0x0;var _0x52f1d7=_0x2b1a[_0x114efa];return _0x52f1d7;};'use strict';var _=require('lodash');var util=require(_0xa2b1('0x0'));var moment=require(_0xa2b1('0x1'));var BPromise=require(_0xa2b1('0x2'));var rs=require(_0xa2b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa2b1('0x4'))(_0xa2b1('0x5'));var config=require(_0xa2b1('0x6'));var jayson=require(_0xa2b1('0x7'));var client=jayson[_0xa2b1('0x8')][_0xa2b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1033ae,_0x1ef190,_0x1645a8){return new BPromise(function(_0x4aaa39,_0x5c641a){return client[_0xa2b1('0xa')](_0x1033ae,_0x1645a8)[_0xa2b1('0xb')](function(_0x40a68e){logger[_0xa2b1('0xc')](_0xa2b1('0xd'),_0x1ef190,_0xa2b1('0xe'));logger[_0xa2b1('0xf')](_0xa2b1('0x10'),_0x1ef190,_0xa2b1('0xe'),JSON[_0xa2b1('0x11')](_0x40a68e));if(_0x40a68e[_0xa2b1('0x12')]){if(_0x40a68e[_0xa2b1('0x12')][_0xa2b1('0x13')]===0x1f4){logger[_0xa2b1('0x12')](_0xa2b1('0xd'),_0x1ef190,_0x40a68e[_0xa2b1('0x12')][_0xa2b1('0x14')]);return _0x5c641a(_0x40a68e[_0xa2b1('0x12')][_0xa2b1('0x14')]);}logger['error'](_0xa2b1('0xd'),_0x1ef190,_0x40a68e[_0xa2b1('0x12')][_0xa2b1('0x14')]);return _0x4aaa39(_0x40a68e[_0xa2b1('0x12')][_0xa2b1('0x14')]);}else{logger[_0xa2b1('0xc')](_0xa2b1('0xd'),_0x1ef190,_0xa2b1('0xe'));_0x4aaa39(_0x40a68e['result'][_0xa2b1('0x14')]);}})[_0xa2b1('0x15')](function(_0x1564ab){logger[_0xa2b1('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x1ef190,_0x1564ab);_0x5c641a(_0x1564ab);});});} \ No newline at end of file +var _0xc732=['http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x24c5df,_0x3237c0){var _0x2fcfcd=function(_0xd8269d){while(--_0xd8269d){_0x24c5df['push'](_0x24c5df['shift']());}};_0x2fcfcd(++_0x3237c0);}(_0xc732,0x121));var _0x2c73=function(_0x28c945,_0x559cb0){_0x28c945=_0x28c945-0x0;var _0x560382=_0xc732[_0x28c945];return _0x560382;};'use strict';var _=require(_0x2c73('0x0'));var util=require(_0x2c73('0x1'));var moment=require('moment');var BPromise=require(_0x2c73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c73('0x3'));var db=require(_0x2c73('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c73('0x5'))(_0x2c73('0x6'));var config=require(_0x2c73('0x7'));var jayson=require(_0x2c73('0x8'));var client=jayson[_0x2c73('0x9')][_0x2c73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e09fd,_0x42e0cc,_0x2343eb){return new BPromise(function(_0x3eff63,_0x3f0f52){return client['request'](_0x4e09fd,_0x2343eb)[_0x2c73('0xb')](function(_0x5db68a){logger[_0x2c73('0xc')](_0x2c73('0xd'),_0x42e0cc,_0x2c73('0xe'));logger[_0x2c73('0xf')](_0x2c73('0x10'),_0x42e0cc,_0x2c73('0xe'),JSON[_0x2c73('0x11')](_0x5db68a));if(_0x5db68a['error']){if(_0x5db68a['error'][_0x2c73('0x12')]===0x1f4){logger[_0x2c73('0x13')](_0x2c73('0xd'),_0x42e0cc,_0x5db68a[_0x2c73('0x13')][_0x2c73('0x14')]);return _0x3f0f52(_0x5db68a[_0x2c73('0x13')][_0x2c73('0x14')]);}logger['error'](_0x2c73('0xd'),_0x42e0cc,_0x5db68a[_0x2c73('0x13')]['message']);return _0x3eff63(_0x5db68a[_0x2c73('0x13')]['message']);}else{logger[_0x2c73('0xc')](_0x2c73('0xd'),_0x42e0cc,_0x2c73('0xe'));_0x3eff63(_0x5db68a[_0x2c73('0x15')][_0x2c73('0x14')]);}})[_0x2c73('0x16')](function(_0x5f2cc0){logger[_0x2c73('0x13')](_0x2c73('0xd'),_0x42e0cc,_0x5f2cc0);_0x3f0f52(_0x5f2cc0);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b4e6790..9fc25e0 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 _0xdc10=['../../config/environment','./memberReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55eae4,_0x159cc8){var _0x3771a4=function(_0x18275a){while(--_0x18275a){_0x55eae4['push'](_0x55eae4['shift']());}};_0x3771a4(++_0x159cc8);}(_0xdc10,0x187));var _0x0dc1=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xdc10[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0x0dc1('0x0'));var util=require(_0x0dc1('0x1'));var path=require(_0x0dc1('0x2'));var timeout=require('connect-timeout');var express=require(_0x0dc1('0x3'));var router=express[_0x0dc1('0x4')]();var fs_extra=require(_0x0dc1('0x5'));var auth=require(_0x0dc1('0x6'));var interaction=require(_0x0dc1('0x7'));var config=require(_0x0dc1('0x8'));var controller=require(_0x0dc1('0x9'));router[_0x0dc1('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0dc1('0xa')](_0x0dc1('0xb'),auth[_0x0dc1('0xc')](),controller[_0x0dc1('0xd')]);router[_0x0dc1('0xa')](_0x0dc1('0xe'),auth[_0x0dc1('0xc')](),controller[_0x0dc1('0xf')]);router[_0x0dc1('0x10')]('/',auth[_0x0dc1('0xc')](),controller['create']);router['put'](_0x0dc1('0xe'),auth['isAuthenticated'](),controller[_0x0dc1('0x11')]);router['delete'](_0x0dc1('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x0dc1('0x12')]=router; \ No newline at end of file +var _0x68e9=['update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x1b191b,_0x390ed4){var _0xbb824d=function(_0x183b14){while(--_0x183b14){_0x1b191b['push'](_0x1b191b['shift']());}};_0xbb824d(++_0x390ed4);}(_0x68e9,0x113));var _0x968e=function(_0x423567,_0x1b732f){_0x423567=_0x423567-0x0;var _0x25eefc=_0x68e9[_0x423567];return _0x25eefc;};'use strict';var multer=require(_0x968e('0x0'));var util=require(_0x968e('0x1'));var path=require('path');var timeout=require(_0x968e('0x2'));var express=require('express');var router=express[_0x968e('0x3')]();var fs_extra=require(_0x968e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x968e('0x5'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x968e('0x6')]('/',auth[_0x968e('0x7')](),controller[_0x968e('0x8')]);router[_0x968e('0x6')]('/describe',auth[_0x968e('0x7')](),controller['describe']);router['get']('/:id',auth[_0x968e('0x7')](),controller[_0x968e('0x9')]);router[_0x968e('0xa')]('/',auth['isAuthenticated'](),controller[_0x968e('0xb')]);router[_0x968e('0xc')](_0x968e('0xd'),auth[_0x968e('0x7')](),controller[_0x968e('0xe')]);router[_0x968e('0xf')](_0x968e('0xd'),auth['isAuthenticated'](),controller[_0x968e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index da73967..b591e0f 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 _0xe189=['STRING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize'];(function(_0x1de195,_0x54eb95){var _0x4bcee9=function(_0xa5ae){while(--_0xa5ae){_0x1de195['push'](_0x1de195['shift']());}};_0x4bcee9(++_0x54eb95);}(_0xe189,0x194));var _0x9e18=function(_0x25c592,_0xe96982){_0x25c592=_0x25c592-0x0;var _0x5eafc3=_0xe189[_0x25c592];return _0x5eafc3;};'use strict';var Sequelize=require(_0x9e18('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x9e18('0x1')]},'membername':{'type':Sequelize[_0x9e18('0x1')]},'interface':{'type':Sequelize[_0x9e18('0x1')]},'type':{'type':Sequelize[_0x9e18('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x9e18('0x2')]},'enterAt':{'type':Sequelize[_0x9e18('0x3')]},'exitAt':{'type':Sequelize[_0x9e18('0x3')],'set':function(_0x53d7c9){var _0x3e6881=moment(_0x53d7c9);var _0x5e6097=moment(this[_0x9e18('0x4')](_0x9e18('0x5')));var _0x4656a4=_0x3e6881['diff'](_0x5e6097,_0x9e18('0x6'));this[_0x9e18('0x7')](_0x9e18('0x8'),_0x53d7c9);this['setDataValue'](_0x9e18('0x9'),_0x4656a4||null);}},'data1':{'type':Sequelize[_0x9e18('0x1')],'comment':_0x9e18('0xa')},'data2':{'type':Sequelize[_0x9e18('0x1')],'comment':_0x9e18('0xb')},'data3':{'type':Sequelize[_0x9e18('0x1')],'comment':_0x9e18('0xc')},'data4':{'type':Sequelize[_0x9e18('0x1')],'comment':_0x9e18('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x9e18('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9e18('0x2')]},'uniqueid':{'type':Sequelize[_0x9e18('0x1')]}}; \ No newline at end of file +var _0x5ebe=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','INTEGER','DATE','getDataValue','enterAt'];(function(_0x3cf8f8,_0x1c2cd6){var _0x4e5050=function(_0x5a5eb7){while(--_0x5a5eb7){_0x3cf8f8['push'](_0x3cf8f8['shift']());}};_0x4e5050(++_0x1c2cd6);}(_0x5ebe,0x69));var _0xe5eb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5ebe[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe5eb('0x0'));module[_0xe5eb('0x1')]={'channel':{'type':Sequelize[_0xe5eb('0x2')]},'membername':{'type':Sequelize[_0xe5eb('0x2')]},'interface':{'type':Sequelize[_0xe5eb('0x2')]},'type':{'type':Sequelize[_0xe5eb('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xe5eb('0x3')]},'enterAt':{'type':Sequelize[_0xe5eb('0x4')]},'exitAt':{'type':Sequelize[_0xe5eb('0x4')],'set':function(_0x1f7414){var _0x3055ba=moment(_0x1f7414);var _0x3ae8d2=moment(this[_0xe5eb('0x5')](_0xe5eb('0x6')));var _0x5158f0=_0x3055ba['diff'](_0x3ae8d2,'seconds');this['setDataValue'](_0xe5eb('0x7'),_0x1f7414);this['setDataValue'](_0xe5eb('0x8'),_0x5158f0||null);}},'data1':{'type':Sequelize[_0xe5eb('0x2')],'comment':_0xe5eb('0x9')},'data2':{'type':Sequelize['STRING'],'comment':_0xe5eb('0xa')},'data3':{'type':Sequelize[_0xe5eb('0x2')],'comment':_0xe5eb('0xb')},'data4':{'type':Sequelize[_0xe5eb('0x2')],'comment':_0xe5eb('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0xe5eb('0xd')},'role':{'type':Sequelize[_0xe5eb('0x2')]},'internal':{'type':Sequelize[_0xe5eb('0x3')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 51b5647..2bc57e5 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x4ebe67,_0x3b8559){var _0x2ece89=function(_0xf7d805){while(--_0xf7d805){_0x4ebe67['push'](_0x4ebe67['shift']());}};_0x2ece89(++_0x3b8559);}(_0x008c,0x188));var _0xc008=function(_0x539fef,_0x17f310){_0x539fef=_0x539fef-0x0;var _0x1c9d6f=_0x008c[_0x539fef];return _0x1c9d6f;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_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['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 25b74c6..c2cc7f3 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 _0xf0a8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','interface'];(function(_0x229b5c,_0x2b6d90){var _0x4121dd=function(_0x435d9b){while(--_0x435d9b){_0x229b5c['push'](_0x229b5c['shift']());}};_0x4121dd(++_0x2b6d90);}(_0xf0a8,0xb4));var _0x8f0a=function(_0x28243c,_0x5d3149){_0x28243c=_0x28243c-0x0;var _0x3f41ec=_0xf0a8[_0x28243c];return _0x3f41ec;};'use strict';var _=require(_0x8f0a('0x0'));var util=require(_0x8f0a('0x1'));var logger=require(_0x8f0a('0x2'))(_0x8f0a('0x3'));var moment=require(_0x8f0a('0x4'));var BPromise=require(_0x8f0a('0x5'));var rp=require(_0x8f0a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f0a('0x7'));var config=require(_0x8f0a('0x8'));var attributes=require(_0x8f0a('0x9'));module[_0x8f0a('0xa')]=function(_0x32146a,_0x3276d7){return _0x32146a[_0x8f0a('0xb')](_0x8f0a('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x8f0a('0xd'),'fields':['membername',_0x8f0a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6673=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','MemberReport','report_member','lodash'];(function(_0x34d6c6,_0x228e57){var _0x2bbf90=function(_0x206c00){while(--_0x206c00){_0x34d6c6['push'](_0x34d6c6['shift']());}};_0x2bbf90(++_0x228e57);}(_0x6673,0x1df));var _0x3667=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x6673[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x3667('0x0'));var util=require('util');var logger=require(_0x3667('0x1'))('api');var moment=require(_0x3667('0x2'));var BPromise=require(_0x3667('0x3'));var rp=require(_0x3667('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3667('0x5'));var config=require(_0x3667('0x6'));var attributes=require('./memberReport.attributes');module[_0x3667('0x7')]=function(_0x2f2c32,_0x52affe){return _0x2f2c32['define'](_0x3667('0x8'),attributes,{'tableName':_0x3667('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index d41ed36..3731f34 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 _0x6657=['MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','map','model','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','debug'];(function(_0x3ee8d1,_0x54afbd){var _0x5e6660=function(_0x3414a5){while(--_0x3414a5){_0x3ee8d1['push'](_0x3ee8d1['shift']());}};_0x5e6660(++_0x54afbd);}(_0x6657,0x17f));var _0x7665=function(_0x58dd0b,_0x39de95){_0x58dd0b=_0x58dd0b-0x0;var _0x30fd30=_0x6657[_0x58dd0b];return _0x30fd30;};'use strict';var _=require(_0x7665('0x0'));var util=require('util');var moment=require(_0x7665('0x1'));var BPromise=require(_0x7665('0x2'));var rs=require(_0x7665('0x3'));var fs=require('fs');var Redis=require(_0x7665('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7665('0x5'));var logger=require(_0x7665('0x6'))(_0x7665('0x7'));var config=require(_0x7665('0x8'));var jayson=require(_0x7665('0x9'));var client=jayson[_0x7665('0xa')][_0x7665('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3387d8,_0x4c0b5c,_0x31da89){return new BPromise(function(_0x464ec1,_0x24e6aa){return client[_0x7665('0xc')](_0x3387d8,_0x31da89)[_0x7665('0xd')](function(_0x3f3a65){logger[_0x7665('0xe')](_0x7665('0xf'),_0x4c0b5c,'request\x20sent');logger[_0x7665('0x10')](_0x7665('0x11'),_0x4c0b5c,_0x7665('0x12'),JSON['stringify'](_0x3f3a65));if(_0x3f3a65[_0x7665('0x13')]){if(_0x3f3a65['error'][_0x7665('0x14')]===0x1f4){logger[_0x7665('0x13')]('MemberReport,\x20%s,\x20%s',_0x4c0b5c,_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);return _0x24e6aa(_0x3f3a65['error'][_0x7665('0x15')]);}logger[_0x7665('0x13')]('MemberReport,\x20%s,\x20%s',_0x4c0b5c,_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);return _0x464ec1(_0x3f3a65[_0x7665('0x13')][_0x7665('0x15')]);}else{logger[_0x7665('0xe')](_0x7665('0xf'),_0x4c0b5c,_0x7665('0x12'));_0x464ec1(_0x3f3a65[_0x7665('0x16')][_0x7665('0x15')]);}})[_0x7665('0x17')](function(_0x365469){logger[_0x7665('0x13')](_0x7665('0xf'),_0x4c0b5c,_0x365469);_0x24e6aa(_0x365469);});});}exports[_0x7665('0x18')]=function(_0x2dab51){var _0xa3f5d4=this;return new Promise(function(_0x522944,_0x30dedb){return db[_0x7665('0x19')]['findAll']({'raw':_0x2dab51[_0x7665('0x1a')]?_0x2dab51[_0x7665('0x1a')][_0x7665('0x1b')]===undefined?!![]:![]:!![],'where':_0x2dab51[_0x7665('0x1a')]?_0x2dab51['options'][_0x7665('0x1c')]||null:null,'attributes':_0x2dab51[_0x7665('0x1a')]?_0x2dab51[_0x7665('0x1a')][_0x7665('0x1d')]||null:null,'limit':_0x2dab51[_0x7665('0x1a')]?_0x2dab51['options'][_0x7665('0x1e')]||null:null,'include':_0x2dab51['options']?_0x2dab51[_0x7665('0x1a')][_0x7665('0x1f')]?_['map'](_0x2dab51['options'][_0x7665('0x1f')],function(_0x2b60dc){return{'model':db[_0x2b60dc['model']],'as':_0x2b60dc['as'],'attributes':_0x2b60dc[_0x7665('0x1d')],'include':_0x2b60dc[_0x7665('0x1f')]?_[_0x7665('0x20')](_0x2b60dc['include'],function(_0x5b5be6){return{'model':db[_0x5b5be6['model']],'as':_0x5b5be6['as'],'attributes':_0x5b5be6['attributes'],'include':_0x5b5be6[_0x7665('0x1f')]?_[_0x7665('0x20')](_0x5b5be6[_0x7665('0x1f')],function(_0x5809e9){return{'model':db[_0x5809e9[_0x7665('0x21')]],'as':_0x5809e9['as'],'attributes':_0x5809e9[_0x7665('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56b6e8){logger[_0x7665('0xe')](_0x7665('0x18'),_0x2dab51);logger[_0x7665('0x10')](_0x7665('0x18'),_0x2dab51,JSON[_0x7665('0x22')](_0x56b6e8));_0x522944(_0x56b6e8);})[_0x7665('0x17')](function(_0x5891fb){logger[_0x7665('0x13')]('GetMemberReport',_0x5891fb['message'],_0x2dab51);_0x30dedb(_0xa3f5d4[_0x7665('0x13')](0x1f4,_0x5891fb[_0x7665('0x15')]));});});};exports[_0x7665('0x23')]=function(_0x34476b){var _0x264b6e=this;return new Promise(function(_0x2837da,_0x39c7a5){return db[_0x7665('0x19')][_0x7665('0x24')](_0x34476b[_0x7665('0x25')],{'raw':_0x34476b[_0x7665('0x1a')]?_0x34476b[_0x7665('0x1a')][_0x7665('0x1b')]===undefined?!![]:![]:!![]})[_0x7665('0xd')](function(_0x42ec7f){logger[_0x7665('0xe')](_0x7665('0x23'),_0x34476b);logger[_0x7665('0x10')](_0x7665('0x23'),_0x34476b,JSON['stringify'](_0x42ec7f));_0x2837da(_0x42ec7f);})[_0x7665('0x17')](function(_0xd93b75){logger[_0x7665('0x13')](_0x7665('0x23'),_0xd93b75[_0x7665('0x15')],_0x34476b);_0x39c7a5(_0x264b6e[_0x7665('0x13')](0x1f4,_0xd93b75['message']));});});};exports[_0x7665('0x26')]=function(_0x2d93b6){var _0x16043b=this;return new Promise(function(_0x1899ad,_0x35abcb){return db['MemberReport'][_0x7665('0x27')](_0x2d93b6['body'],{'raw':_0x2d93b6[_0x7665('0x1a')]?_0x2d93b6['options'][_0x7665('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d93b6[_0x7665('0x1a')]?_0x2d93b6[_0x7665('0x1a')][_0x7665('0x1c')]||null:null,'attributes':_0x2d93b6[_0x7665('0x1a')]?_0x2d93b6[_0x7665('0x1a')]['attributes']||null:null,'limit':_0x2d93b6[_0x7665('0x1a')]?_0x2d93b6[_0x7665('0x1a')][_0x7665('0x1e')]||null:null})[_0x7665('0xd')](function(_0x4d195d){logger[_0x7665('0xe')](_0x7665('0x26'),_0x2d93b6);logger[_0x7665('0x10')](_0x7665('0x26'),_0x2d93b6,JSON[_0x7665('0x22')](_0x4d195d));_0x1899ad(_0x4d195d);})['catch'](function(_0x16d694){logger[_0x7665('0x13')](_0x7665('0x26'),_0x16d694[_0x7665('0x15')],_0x2d93b6);_0x35abcb(_0x16043b[_0x7665('0x13')](0x1f4,_0x16d694[_0x7665('0x15')]));});});}; \ No newline at end of file +var _0x7722=['options','raw','attributes','model','include','map','GetMemberReport','stringify','CreateMemberReport','body','UpdateMemberReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MemberReport','findAll'];(function(_0x1b776e,_0x1d341e){var _0x3b8294=function(_0x352b9a){while(--_0x352b9a){_0x1b776e['push'](_0x1b776e['shift']());}};_0x3b8294(++_0x1d341e);}(_0x7722,0x14e));var _0x2772=function(_0x28a7a6,_0x35d328){_0x28a7a6=_0x28a7a6-0x0;var _0x26b366=_0x7722[_0x28a7a6];return _0x26b366;};'use strict';var _=require(_0x2772('0x0'));var util=require(_0x2772('0x1'));var moment=require(_0x2772('0x2'));var BPromise=require(_0x2772('0x3'));var rs=require(_0x2772('0x4'));var fs=require('fs');var Redis=require(_0x2772('0x5'));var db=require(_0x2772('0x6'))['db'];var utils=require(_0x2772('0x7'));var logger=require(_0x2772('0x8'))('rpc');var config=require(_0x2772('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2772('0xa')][_0x2772('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e6c6e,_0xabc5bb,_0x21b452){return new BPromise(function(_0x53f017,_0x408df9){return client[_0x2772('0xc')](_0x3e6c6e,_0x21b452)[_0x2772('0xd')](function(_0x131220){logger[_0x2772('0xe')](_0x2772('0xf'),_0xabc5bb,_0x2772('0x10'));logger[_0x2772('0x11')](_0x2772('0x12'),_0xabc5bb,_0x2772('0x10'),JSON['stringify'](_0x131220));if(_0x131220[_0x2772('0x13')]){if(_0x131220[_0x2772('0x13')][_0x2772('0x14')]===0x1f4){logger['error'](_0x2772('0xf'),_0xabc5bb,_0x131220[_0x2772('0x13')][_0x2772('0x15')]);return _0x408df9(_0x131220[_0x2772('0x13')][_0x2772('0x15')]);}logger['error'](_0x2772('0xf'),_0xabc5bb,_0x131220[_0x2772('0x13')][_0x2772('0x15')]);return _0x53f017(_0x131220[_0x2772('0x13')]['message']);}else{logger[_0x2772('0xe')]('MemberReport,\x20%s,\x20%s',_0xabc5bb,_0x2772('0x10'));_0x53f017(_0x131220[_0x2772('0x16')][_0x2772('0x15')]);}})[_0x2772('0x17')](function(_0x3c5f5a){logger[_0x2772('0x13')](_0x2772('0xf'),_0xabc5bb,_0x3c5f5a);_0x408df9(_0x3c5f5a);});});}exports['GetMemberReport']=function(_0x27868d){var _0x3bed0f=this;return new Promise(function(_0x3dd1ed,_0x3a2170){return db[_0x2772('0x18')][_0x2772('0x19')]({'raw':_0x27868d[_0x2772('0x1a')]?_0x27868d[_0x2772('0x1a')][_0x2772('0x1b')]===undefined?!![]:![]:!![],'where':_0x27868d[_0x2772('0x1a')]?_0x27868d['options']['where']||null:null,'attributes':_0x27868d[_0x2772('0x1a')]?_0x27868d[_0x2772('0x1a')][_0x2772('0x1c')]||null:null,'limit':_0x27868d[_0x2772('0x1a')]?_0x27868d[_0x2772('0x1a')]['limit']||null:null,'include':_0x27868d[_0x2772('0x1a')]?_0x27868d[_0x2772('0x1a')]['include']?_['map'](_0x27868d['options']['include'],function(_0x52c703){return{'model':db[_0x52c703[_0x2772('0x1d')]],'as':_0x52c703['as'],'attributes':_0x52c703['attributes'],'include':_0x52c703[_0x2772('0x1e')]?_[_0x2772('0x1f')](_0x52c703[_0x2772('0x1e')],function(_0x26ffc5){return{'model':db[_0x26ffc5[_0x2772('0x1d')]],'as':_0x26ffc5['as'],'attributes':_0x26ffc5[_0x2772('0x1c')],'include':_0x26ffc5[_0x2772('0x1e')]?_[_0x2772('0x1f')](_0x26ffc5[_0x2772('0x1e')],function(_0x2de9a4){return{'model':db[_0x2de9a4[_0x2772('0x1d')]],'as':_0x2de9a4['as'],'attributes':_0x2de9a4[_0x2772('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x455ad1){logger[_0x2772('0xe')](_0x2772('0x20'),_0x27868d);logger[_0x2772('0x11')](_0x2772('0x20'),_0x27868d,JSON[_0x2772('0x21')](_0x455ad1));_0x3dd1ed(_0x455ad1);})[_0x2772('0x17')](function(_0x4323f0){logger[_0x2772('0x13')]('GetMemberReport',_0x4323f0['message'],_0x27868d);_0x3a2170(_0x3bed0f[_0x2772('0x13')](0x1f4,_0x4323f0[_0x2772('0x15')]));});});};exports[_0x2772('0x22')]=function(_0x430be9){var _0x47eacb=this;return new Promise(function(_0x33b6c0,_0x4625e6){return db[_0x2772('0x18')]['create'](_0x430be9[_0x2772('0x23')],{'raw':_0x430be9[_0x2772('0x1a')]?_0x430be9[_0x2772('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xf0f535){logger['info']('CreateMemberReport',_0x430be9);logger[_0x2772('0x11')](_0x2772('0x22'),_0x430be9,JSON[_0x2772('0x21')](_0xf0f535));_0x33b6c0(_0xf0f535);})[_0x2772('0x17')](function(_0x3983a1){logger[_0x2772('0x13')](_0x2772('0x22'),_0x3983a1[_0x2772('0x15')],_0x430be9);_0x4625e6(_0x47eacb[_0x2772('0x13')](0x1f4,_0x3983a1[_0x2772('0x15')]));});});};exports[_0x2772('0x24')]=function(_0x38e1ce){var _0x431583=this;return new Promise(function(_0x58026a,_0xef3a95){return db[_0x2772('0x18')][_0x2772('0x25')](_0x38e1ce[_0x2772('0x23')],{'raw':_0x38e1ce['options']?_0x38e1ce[_0x2772('0x1a')][_0x2772('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38e1ce[_0x2772('0x1a')]?_0x38e1ce[_0x2772('0x1a')][_0x2772('0x26')]||null:null,'attributes':_0x38e1ce[_0x2772('0x1a')]?_0x38e1ce[_0x2772('0x1a')][_0x2772('0x1c')]||null:null,'limit':_0x38e1ce['options']?_0x38e1ce[_0x2772('0x1a')][_0x2772('0x27')]||null:null})[_0x2772('0xd')](function(_0xb58776){logger['info'](_0x2772('0x24'),_0x38e1ce);logger[_0x2772('0x11')]('UpdateMemberReport',_0x38e1ce,JSON[_0x2772('0x21')](_0xb58776));_0x58026a(_0xb58776);})[_0x2772('0x17')](function(_0x425deb){logger[_0x2772('0x13')](_0x2772('0x24'),_0x425deb[_0x2772('0x15')],_0x38e1ce);_0xef3a95(_0x431583[_0x2772('0x13')](0x1f4,_0x425deb[_0x2772('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index dbbf73f..bcad333 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 _0x31bb=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path'];(function(_0x383f33,_0x290ffa){var _0x357573=function(_0xe4c4d6){while(--_0xe4c4d6){_0x383f33['push'](_0x383f33['shift']());}};_0x357573(++_0x290ffa);}(_0x31bb,0x1e2));var _0xb31b=function(_0x3b2896,_0xb8c5f7){_0x3b2896=_0x3b2896-0x0;var _0x1e8650=_0x31bb[_0x3b2896];return _0x1e8650;};'use strict';var multer=require('multer');var util=require(_0xb31b('0x0'));var path=require(_0xb31b('0x1'));var timeout=require(_0xb31b('0x2'));var express=require(_0xb31b('0x3'));var router=express[_0xb31b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb31b('0x5'));var config=require(_0xb31b('0x6'));var controller=require(_0xb31b('0x7'));router[_0xb31b('0x8')]('/',controller[_0xb31b('0x9')]);module[_0xb31b('0xa')]=router; \ No newline at end of file +var _0x1052=['get','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a6a8b,_0x277cd5){var _0x491ff6=function(_0x2523f4){while(--_0x2523f4){_0x1a6a8b['push'](_0x1a6a8b['shift']());}};_0x491ff6(++_0x277cd5);}(_0x1052,0xf4));var _0x2105=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x1052[_0x2353fe];return _0x4d43f6;};'use strict';var multer=require(_0x2105('0x0'));var util=require(_0x2105('0x1'));var path=require(_0x2105('0x2'));var timeout=require(_0x2105('0x3'));var express=require(_0x2105('0x4'));var router=express[_0x2105('0x5')]();var fs_extra=require(_0x2105('0x6'));var auth=require(_0x2105('0x7'));var interaction=require(_0x2105('0x8'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x2105('0x9')]('/',controller['index']);module[_0x2105('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9a645ba..ffac318 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 _0x023c=['STRING','version','sequelize','exports'];(function(_0x154666,_0x2144c9){var _0x1d0e84=function(_0x521bfd){while(--_0x521bfd){_0x154666['push'](_0x154666['shift']());}};_0x1d0e84(++_0x2144c9);}(_0x023c,0x182));var _0xc023=function(_0x5e8571,_0xc46307){_0x5e8571=_0x5e8571-0x0;var _0x5e2293=_0x023c[_0x5e8571];return _0x5e2293;};'use strict';var Sequelize=require(_0xc023('0x0'));module[_0xc023('0x1')]={'version':{'type':Sequelize[_0xc023('0x2')],'unique':_0xc023('0x3')}}; \ No newline at end of file +var _0x007b=['STRING','version','sequelize','exports'];(function(_0x4b82e6,_0x5559da){var _0x39ff49=function(_0x46f7b0){while(--_0x46f7b0){_0x4b82e6['push'](_0x4b82e6['shift']());}};_0x39ff49(++_0x5559da);}(_0x007b,0x17e));var _0xb007=function(_0x4adedb,_0x44fdf3){_0x4adedb=_0x4adedb-0x0;var _0x5df3b3=_0x007b[_0x4adedb];return _0x5df3b3;};'use strict';var Sequelize=require(_0xb007('0x0'));module[_0xb007('0x1')]={'version':{'type':Sequelize[_0xb007('0x2')],'unique':_0xb007('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 97e26fd..4fa25d0 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 _0x5c30=['lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','eml-format','rimraf','moment','mustache','util','path','to-csv','fs-extra'];(function(_0x4795ea,_0x3584e3){var _0x5e6de2=function(_0x597db9){while(--_0x597db9){_0x4795ea['push'](_0x4795ea['shift']());}};_0x5e6de2(++_0x3584e3);}(_0x5c30,0xb5));var _0x05c3=function(_0xb9f7cf,_0x2b7c4f){_0xb9f7cf=_0xb9f7cf-0x0;var _0x18953a=_0x5c30[_0xb9f7cf];return _0x18953a;};'use strict';var emlformat=require(_0x05c3('0x0'));var rimraf=require(_0x05c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x05c3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x05c3('0x3'));var util=require(_0x05c3('0x4'));var path=require(_0x05c3('0x5'));var sox=require('sox');var csv=require(_0x05c3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05c3('0x7'));var _=require(_0x05c3('0x8'));var squel=require(_0x05c3('0x9'));var crypto=require(_0x05c3('0xa'));var jsforce=require(_0x05c3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x05c3('0x6'));var querystring=require(_0x05c3('0xc'));var Papa=require('papaparse');var Redis=require(_0x05c3('0xd'));var authService=require(_0x05c3('0xe'));var qs=require(_0x05c3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05c3('0x10'));var logger=require(_0x05c3('0x11'))('api');var utils=require(_0x05c3('0x12'));var config=require(_0x05c3('0x13'));var licenseUtil=require(_0x05c3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8fd3e,_0x5c31d7){_0x5c31d7=_0x5c31d7||0xcc;return function(_0xf9ac25){if(_0xf9ac25){return _0x8fd3e[_0x05c3('0x15')](_0x5c31d7);}return _0x8fd3e[_0x05c3('0x16')](_0x5c31d7)['end']();};}function respondWithResult(_0x4c7bad,_0x414c79){_0x414c79=_0x414c79||0xc8;return function(_0xd1fed6){if(_0xd1fed6){return _0x4c7bad['status'](_0x414c79)['json'](_0xd1fed6);}};}function respondWithFilteredResult(_0x1433b3,_0x545e1f){return function(_0x661b28){if(_0x661b28){var _0x603e6a=typeof _0x545e1f[_0x05c3('0x17')]===_0x05c3('0x18')&&typeof _0x545e1f[_0x05c3('0x19')]===_0x05c3('0x18');var _0x3b1e2f=_0x661b28[_0x05c3('0x1a')];var _0x3db74b=_0x603e6a?0x0:_0x545e1f[_0x05c3('0x17')];var _0x3d61ba=_0x603e6a?_0x661b28['count']:_0x545e1f[_0x05c3('0x17')]+_0x545e1f[_0x05c3('0x19')];var _0x3bbd9f;if(_0x3d61ba>=_0x3b1e2f){_0x3d61ba=_0x3b1e2f;_0x3bbd9f=0xc8;}else{_0x3bbd9f=0xce;}_0x1433b3['status'](_0x3bbd9f);return _0x1433b3['set']('Content-Range',_0x3db74b+'-'+_0x3d61ba+'/'+_0x3b1e2f)[_0x05c3('0x1b')](_0x661b28);}return null;};}function patchUpdates(_0x3dde01){return function(_0x2afe35){try{jsonpatch[_0x05c3('0x1c')](_0x2afe35,_0x3dde01,!![]);}catch(_0xe7aaaa){return BPromise[_0x05c3('0x1d')](_0xe7aaaa);}return _0x2afe35[_0x05c3('0x1e')]();};}function saveUpdates(_0x45e30e,_0x4a3813){return function(_0x27a6b6){if(_0x27a6b6){return _0x27a6b6[_0x05c3('0x1f')](_0x45e30e)['then'](function(_0x41009e){return _0x41009e;});}return null;};}function removeEntity(_0x19e8d4,_0x46125e){return function(_0x531a93){if(_0x531a93){return _0x531a93[_0x05c3('0x20')]()[_0x05c3('0x21')](function(){_0x19e8d4['status'](0xcc)[_0x05c3('0x22')]();});}};}function handleEntityNotFound(_0x328df1,_0x2c80dd){return function(_0x3196cf){if(!_0x3196cf){_0x328df1[_0x05c3('0x15')](0x194);}return _0x3196cf;};}function handleError(_0x1b5d93,_0x4271b7){_0x4271b7=_0x4271b7||0x1f4;return function(_0x2fa27b){logger['error'](_0x2fa27b[_0x05c3('0x23')]);if(_0x2fa27b[_0x05c3('0x24')]){delete _0x2fa27b[_0x05c3('0x24')];}_0x1b5d93[_0x05c3('0x16')](_0x4271b7)[_0x05c3('0x25')](_0x2fa27b);};}exports[_0x05c3('0x26')]=function(_0x43136f,_0x4d7868){var _0x4cfbae={},_0x2dff3d={},_0x46f88f={'count':0x0,'rows':[]};var _0x2aa646=_[_0x05c3('0x27')](db[_0x05c3('0x28')][_0x05c3('0x29')],function(_0x36c440){return{'name':_0x36c440[_0x05c3('0x2a')],'type':_0x36c440[_0x05c3('0x2b')]['key']};});_0x2dff3d[_0x05c3('0x2c')]=_[_0x05c3('0x27')](_0x2aa646,_0x05c3('0x24'));_0x2dff3d['query']=_[_0x05c3('0x2d')](_0x43136f['query']);_0x2dff3d[_0x05c3('0x2e')]=_[_0x05c3('0x2f')](_0x2dff3d['model'],_0x2dff3d['query']);_0x4cfbae[_0x05c3('0x30')]=_[_0x05c3('0x2f')](_0x2dff3d[_0x05c3('0x2c')],qs[_0x05c3('0x31')](_0x43136f['query']['fields']));_0x4cfbae[_0x05c3('0x30')]=_0x4cfbae[_0x05c3('0x30')][_0x05c3('0x32')]?_0x4cfbae['attributes']:_0x2dff3d['model'];if(!_0x43136f[_0x05c3('0x33')][_0x05c3('0x34')](_0x05c3('0x35'))){_0x4cfbae[_0x05c3('0x19')]=qs[_0x05c3('0x19')](_0x43136f[_0x05c3('0x33')][_0x05c3('0x19')]);_0x4cfbae[_0x05c3('0x17')]=qs['offset'](_0x43136f['query'][_0x05c3('0x17')]);}_0x4cfbae['order']=qs[_0x05c3('0x36')](_0x43136f[_0x05c3('0x33')][_0x05c3('0x36')]);_0x4cfbae[_0x05c3('0x37')]=qs[_0x05c3('0x2e')](_[_0x05c3('0x38')](_0x43136f['query'],_0x2dff3d['filters']),_0x2aa646);if(_0x43136f[_0x05c3('0x33')][_0x05c3('0x39')]){_0x4cfbae[_0x05c3('0x37')]=_[_0x05c3('0x3a')](_0x4cfbae[_0x05c3('0x37')],{'$or':_['map'](_0x2aa646,function(_0x14663d){if(_0x14663d[_0x05c3('0x2b')]!==_0x05c3('0x3b')){var _0x4e6950={};_0x4e6950[_0x14663d[_0x05c3('0x24')]]={'$like':'%'+_0x43136f[_0x05c3('0x33')][_0x05c3('0x39')]+'%'};return _0x4e6950;}})});}_0x4cfbae=_['merge']({},_0x4cfbae,_0x43136f['options']);var _0x749d20={'where':_0x4cfbae[_0x05c3('0x37')]};return db[_0x05c3('0x28')][_0x05c3('0x1a')](_0x749d20)[_0x05c3('0x21')](function(_0x36e928){_0x46f88f['count']=_0x36e928;if(_0x43136f[_0x05c3('0x33')][_0x05c3('0x3c')]){_0x4cfbae['include']=[{'all':!![]}];}return db[_0x05c3('0x28')][_0x05c3('0x3d')](_0x4cfbae);})[_0x05c3('0x21')](function(_0x5c987f){_0x46f88f['rows']=_0x5c987f;return _0x46f88f;})[_0x05c3('0x21')](respondWithFilteredResult(_0x4d7868,_0x4cfbae))[_0x05c3('0x3e')](handleError(_0x4d7868,null));}; \ No newline at end of file +var _0xc158=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','stack','name','send','index','map','Migration','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','moment','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0xc158,0x13c));var _0x8c15=function(_0x508911,_0x54c10f){_0x508911=_0x508911-0x0;var _0x220e7f=_0xc158[_0x508911];return _0x220e7f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c15('0x0'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8c15('0x1'));var path=require(_0x8c15('0x2'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c15('0x3'));var _=require(_0x8c15('0x4'));var squel=require(_0x8c15('0x5'));var crypto=require(_0x8c15('0x6'));var jsforce=require(_0x8c15('0x7'));var deskjs=require(_0x8c15('0x8'));var toCsv=require(_0x8c15('0x9'));var querystring=require(_0x8c15('0xa'));var Papa=require(_0x8c15('0xb'));var Redis=require(_0x8c15('0xc'));var authService=require(_0x8c15('0xd'));var qs=require(_0x8c15('0xe'));var as=require(_0x8c15('0xf'));var hardwareService=require(_0x8c15('0x10'));var logger=require(_0x8c15('0x11'))(_0x8c15('0x12'));var utils=require(_0x8c15('0x13'));var config=require(_0x8c15('0x14'));var licenseUtil=require(_0x8c15('0x15'));var db=require(_0x8c15('0x16'))['db'];function respondWithStatusCode(_0x249b2d,_0x3ccd9b){_0x3ccd9b=_0x3ccd9b||0xcc;return function(_0x1e207f){if(_0x1e207f){return _0x249b2d['sendStatus'](_0x3ccd9b);}return _0x249b2d[_0x8c15('0x17')](_0x3ccd9b)[_0x8c15('0x18')]();};}function respondWithResult(_0x228d5c,_0x364ceb){_0x364ceb=_0x364ceb||0xc8;return function(_0x379f60){if(_0x379f60){return _0x228d5c[_0x8c15('0x17')](_0x364ceb)[_0x8c15('0x19')](_0x379f60);}};}function respondWithFilteredResult(_0x364d79,_0x1ba075){return function(_0x1ce028){if(_0x1ce028){var _0x20ac5c=typeof _0x1ba075[_0x8c15('0x1a')]===_0x8c15('0x1b')&&typeof _0x1ba075[_0x8c15('0x1c')]===_0x8c15('0x1b');var _0x8c7587=_0x1ce028[_0x8c15('0x1d')];var _0x2552ba=_0x20ac5c?0x0:_0x1ba075[_0x8c15('0x1a')];var _0x1d4c96=_0x20ac5c?_0x1ce028[_0x8c15('0x1d')]:_0x1ba075[_0x8c15('0x1a')]+_0x1ba075[_0x8c15('0x1c')];var _0x46c31c;if(_0x1d4c96>=_0x8c7587){_0x1d4c96=_0x8c7587;_0x46c31c=0xc8;}else{_0x46c31c=0xce;}_0x364d79[_0x8c15('0x17')](_0x46c31c);return _0x364d79[_0x8c15('0x1e')](_0x8c15('0x1f'),_0x2552ba+'-'+_0x1d4c96+'/'+_0x8c7587)[_0x8c15('0x19')](_0x1ce028);}return null;};}function patchUpdates(_0x2891fe){return function(_0x4112fe){try{jsonpatch[_0x8c15('0x20')](_0x4112fe,_0x2891fe,!![]);}catch(_0x51a90f){return BPromise['reject'](_0x51a90f);}return _0x4112fe[_0x8c15('0x21')]();};}function saveUpdates(_0x3208a7,_0x382e7d){return function(_0x30db7c){if(_0x30db7c){return _0x30db7c[_0x8c15('0x22')](_0x3208a7)['then'](function(_0x54551a){return _0x54551a;});}return null;};}function removeEntity(_0x516ad1,_0x17a1ec){return function(_0x14c989){if(_0x14c989){return _0x14c989['destroy']()[_0x8c15('0x23')](function(){_0x516ad1[_0x8c15('0x17')](0xcc)[_0x8c15('0x18')]();});}};}function handleEntityNotFound(_0x3bd2d5,_0x22e04d){return function(_0x188afd){if(!_0x188afd){_0x3bd2d5[_0x8c15('0x24')](0x194);}return _0x188afd;};}function handleError(_0x18a2bb,_0x50b687){_0x50b687=_0x50b687||0x1f4;return function(_0x52e7bc){logger['error'](_0x52e7bc[_0x8c15('0x25')]);if(_0x52e7bc[_0x8c15('0x26')]){delete _0x52e7bc[_0x8c15('0x26')];}_0x18a2bb[_0x8c15('0x17')](_0x50b687)[_0x8c15('0x27')](_0x52e7bc);};}exports[_0x8c15('0x28')]=function(_0x5c0441,_0x542aa0){var _0x93c8cd={},_0x20934e={},_0xe64f8a={'count':0x0,'rows':[]};var _0x4d9a9f=_[_0x8c15('0x29')](db[_0x8c15('0x2a')]['rawAttributes'],function(_0x509398){return{'name':_0x509398[_0x8c15('0x2b')],'type':_0x509398[_0x8c15('0x2c')]['key']};});_0x20934e[_0x8c15('0x2d')]=_[_0x8c15('0x29')](_0x4d9a9f,'name');_0x20934e[_0x8c15('0x2e')]=_[_0x8c15('0x2f')](_0x5c0441[_0x8c15('0x2e')]);_0x20934e['filters']=_[_0x8c15('0x30')](_0x20934e[_0x8c15('0x2d')],_0x20934e[_0x8c15('0x2e')]);_0x93c8cd[_0x8c15('0x31')]=_[_0x8c15('0x30')](_0x20934e[_0x8c15('0x2d')],qs[_0x8c15('0x32')](_0x5c0441[_0x8c15('0x2e')][_0x8c15('0x32')]));_0x93c8cd[_0x8c15('0x31')]=_0x93c8cd['attributes'][_0x8c15('0x33')]?_0x93c8cd['attributes']:_0x20934e['model'];if(!_0x5c0441['query']['hasOwnProperty'](_0x8c15('0x34'))){_0x93c8cd[_0x8c15('0x1c')]=qs[_0x8c15('0x1c')](_0x5c0441[_0x8c15('0x2e')][_0x8c15('0x1c')]);_0x93c8cd['offset']=qs[_0x8c15('0x1a')](_0x5c0441[_0x8c15('0x2e')][_0x8c15('0x1a')]);}_0x93c8cd[_0x8c15('0x35')]=qs['sort'](_0x5c0441[_0x8c15('0x2e')][_0x8c15('0x36')]);_0x93c8cd[_0x8c15('0x37')]=qs[_0x8c15('0x38')](_[_0x8c15('0x39')](_0x5c0441[_0x8c15('0x2e')],_0x20934e[_0x8c15('0x38')]),_0x4d9a9f);if(_0x5c0441[_0x8c15('0x2e')][_0x8c15('0x3a')]){_0x93c8cd[_0x8c15('0x37')]=_['merge'](_0x93c8cd['where'],{'$or':_[_0x8c15('0x29')](_0x4d9a9f,function(_0x62e404){if(_0x62e404['type']!=='VIRTUAL'){var _0x4bc51b={};_0x4bc51b[_0x62e404[_0x8c15('0x26')]]={'$like':'%'+_0x5c0441[_0x8c15('0x2e')][_0x8c15('0x3a')]+'%'};return _0x4bc51b;}})});}_0x93c8cd=_[_0x8c15('0x3b')]({},_0x93c8cd,_0x5c0441[_0x8c15('0x3c')]);var _0x3002e7={'where':_0x93c8cd[_0x8c15('0x37')]};return db['Migration'][_0x8c15('0x1d')](_0x3002e7)[_0x8c15('0x23')](function(_0x178b4b){_0xe64f8a[_0x8c15('0x1d')]=_0x178b4b;if(_0x5c0441[_0x8c15('0x2e')][_0x8c15('0x3d')]){_0x93c8cd[_0x8c15('0x3e')]=[{'all':!![]}];}return db[_0x8c15('0x2a')][_0x8c15('0x3f')](_0x93c8cd);})[_0x8c15('0x23')](function(_0x591254){_0xe64f8a['rows']=_0x591254;return _0xe64f8a;})[_0x8c15('0x23')](respondWithFilteredResult(_0x542aa0,_0x93c8cd))[_0x8c15('0x40')](handleError(_0x542aa0,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 80c66b6..a73dd44 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 _0xc0d1=['../../config/environment','./migration.attributes','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x136c8f,_0xf7a48f){var _0x24eb1f=function(_0x2a4026){while(--_0x2a4026){_0x136c8f['push'](_0x136c8f['shift']());}};_0x24eb1f(++_0xf7a48f);}(_0xc0d1,0x1d3));var _0x1c0d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc0d1[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x1c0d('0x0'));var util=require(_0x1c0d('0x1'));var logger=require(_0x1c0d('0x2'))(_0x1c0d('0x3'));var moment=require(_0x1c0d('0x4'));var BPromise=require(_0x1c0d('0x5'));var rp=require(_0x1c0d('0x6'));var fs=require('fs');var path=require(_0x1c0d('0x7'));var rimraf=require(_0x1c0d('0x8'));var config=require(_0x1c0d('0x9'));var attributes=require(_0x1c0d('0xa'));module['exports']=function(_0xaabe8f,_0x4b3382){return _0xaabe8f[_0x1c0d('0xb')](_0x1c0d('0xc'),attributes,{'tableName':_0x1c0d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53a6=['Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x53a6,0x106));var _0x653a=function(_0x2e9e9a,_0x1e8b56){_0x2e9e9a=_0x2e9e9a-0x0;var _0x3412ae=_0x53a6[_0x2e9e9a];return _0x3412ae;};'use strict';var _=require(_0x653a('0x0'));var util=require(_0x653a('0x1'));var logger=require(_0x653a('0x2'))(_0x653a('0x3'));var moment=require(_0x653a('0x4'));var BPromise=require('bluebird');var rp=require(_0x653a('0x5'));var fs=require('fs');var path=require(_0x653a('0x6'));var rimraf=require(_0x653a('0x7'));var config=require(_0x653a('0x8'));var attributes=require('./migration.attributes');module[_0x653a('0x9')]=function(_0x515a8d,_0x2b45c3){return _0x515a8d[_0x653a('0xa')](_0x653a('0xb'),attributes,{'tableName':_0x653a('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 92794a3..053d581 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 _0xe28e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x38d3bd,_0x49f837){var _0x19022c=function(_0x30341f){while(--_0x30341f){_0x38d3bd['push'](_0x38d3bd['shift']());}};_0x19022c(++_0x49f837);}(_0xe28e,0x1ba));var _0xee28=function(_0x56d700,_0x47df7a){_0x56d700=_0x56d700-0x0;var _0xdfde29=_0xe28e[_0x56d700];return _0xdfde29;};'use strict';var _=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var moment=require(_0xee28('0x2'));var BPromise=require(_0xee28('0x3'));var rs=require(_0xee28('0x4'));var fs=require('fs');var Redis=require(_0xee28('0x5'));var db=require(_0xee28('0x6'))['db'];var utils=require(_0xee28('0x7'));var logger=require(_0xee28('0x8'))(_0xee28('0x9'));var config=require(_0xee28('0xa'));var jayson=require(_0xee28('0xb'));var client=jayson[_0xee28('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39b337,_0x30224a,_0x3f9bd9){return new BPromise(function(_0x66d0b6,_0x156aad){return client[_0xee28('0xd')](_0x39b337,_0x3f9bd9)[_0xee28('0xe')](function(_0x5d7562){logger['info']('Migration,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'));logger[_0xee28('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x30224a,_0xee28('0xf'),JSON[_0xee28('0x11')](_0x5d7562));if(_0x5d7562['error']){if(_0x5d7562[_0xee28('0x12')][_0xee28('0x13')]===0x1f4){logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x156aad(_0x5d7562[_0xee28('0x12')]['message']);}logger[_0xee28('0x12')](_0xee28('0x14'),_0x30224a,_0x5d7562[_0xee28('0x12')][_0xee28('0x15')]);return _0x66d0b6(_0x5d7562[_0xee28('0x12')]['message']);}else{logger[_0xee28('0x16')](_0xee28('0x14'),_0x30224a,_0xee28('0xf'));_0x66d0b6(_0x5d7562[_0xee28('0x17')][_0xee28('0x15')]);}})[_0xee28('0x18')](function(_0x4c0eb9){logger[_0xee28('0x12')]('Migration,\x20%s,\x20%s',_0x30224a,_0x4c0eb9);_0x156aad(_0x4c0eb9);});});} \ No newline at end of file +var _0xf46a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','Migration,\x20%s,\x20%s','message','info','lodash','moment','bluebird','ioredis'];(function(_0x5229ce,_0x2ca964){var _0x43e489=function(_0x332a49){while(--_0x332a49){_0x5229ce['push'](_0x5229ce['shift']());}};_0x43e489(++_0x2ca964);}(_0xf46a,0xa4));var _0xaf46=function(_0x4a0aad,_0x3502e0){_0x4a0aad=_0x4a0aad-0x0;var _0x8d2de6=_0xf46a[_0x4a0aad];return _0x8d2de6;};'use strict';var _=require(_0xaf46('0x0'));var util=require('util');var moment=require(_0xaf46('0x1'));var BPromise=require(_0xaf46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf46('0x3'));var db=require(_0xaf46('0x4'))['db'];var utils=require(_0xaf46('0x5'));var logger=require(_0xaf46('0x6'))(_0xaf46('0x7'));var config=require(_0xaf46('0x8'));var jayson=require(_0xaf46('0x9'));var client=jayson[_0xaf46('0xa')][_0xaf46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9e9887,_0x4f76cc,_0xa4a618){return new BPromise(function(_0x105943,_0x328d92){return client['request'](_0x9e9887,_0xa4a618)[_0xaf46('0xc')](function(_0x4e67c0){logger['info']('Migration,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'));logger[_0xaf46('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x4f76cc,_0xaf46('0xd'),JSON[_0xaf46('0xf')](_0x4e67c0));if(_0x4e67c0[_0xaf46('0x10')]){if(_0x4e67c0['error'][_0xaf46('0x11')]===0x1f4){logger['error'](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0['error'][_0xaf46('0x13')]);return _0x328d92(_0x4e67c0['error'][_0xaf46('0x13')]);}logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);return _0x105943(_0x4e67c0[_0xaf46('0x10')][_0xaf46('0x13')]);}else{logger[_0xaf46('0x14')]('Migration,\x20%s,\x20%s',_0x4f76cc,'request\x20sent');_0x105943(_0x4e67c0['result'][_0xaf46('0x13')]);}})['catch'](function(_0x498720){logger[_0xaf46('0x10')](_0xaf46('0x12'),_0x4f76cc,_0x498720);_0x328d92(_0x498720);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 96575d0..7e160a8 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 _0xac41=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller'];(function(_0x5853ae,_0x107a03){var _0x1a4a53=function(_0x310797){while(--_0x310797){_0x5853ae['push'](_0x5853ae['shift']());}};_0x1a4a53(++_0x107a03);}(_0xac41,0xdd));var _0x1ac4=function(_0x141598,_0x3bbe65){_0x141598=_0x141598-0x0;var _0x34175d=_0xac41[_0x141598];return _0x34175d;};'use strict';var multer=require(_0x1ac4('0x0'));var util=require(_0x1ac4('0x1'));var path=require(_0x1ac4('0x2'));var timeout=require(_0x1ac4('0x3'));var express=require(_0x1ac4('0x4'));var router=express[_0x1ac4('0x5')]();var fs_extra=require(_0x1ac4('0x6'));var auth=require(_0x1ac4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1ac4('0x8'));var controller=require(_0x1ac4('0x9'));router[_0x1ac4('0xa')]('/',auth[_0x1ac4('0xb')](),controller[_0x1ac4('0xc')]);router[_0x1ac4('0xa')](_0x1ac4('0xd'),auth[_0x1ac4('0xb')](),controller[_0x1ac4('0xe')]);router[_0x1ac4('0xf')]('/',auth[_0x1ac4('0xb')](),controller[_0x1ac4('0x10')]);router[_0x1ac4('0x11')](_0x1ac4('0xd'),auth[_0x1ac4('0xb')](),controller[_0x1ac4('0x12')]);router['delete'](_0x1ac4('0xd'),auth['isAuthenticated'](),controller[_0x1ac4('0x13')]);module[_0x1ac4('0x14')]=router; \ No newline at end of file +var _0xe144=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','create','put','/:id','delete','destroy','exports'];(function(_0x1b131,_0x2b404c){var _0xe33647=function(_0x5eb985){while(--_0x5eb985){_0x1b131['push'](_0x1b131['shift']());}};_0xe33647(++_0x2b404c);}(_0xe144,0x168));var _0x4e14=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0xe144[_0x4e21ba];return _0x55b94b;};'use strict';var multer=require(_0x4e14('0x0'));var util=require('util');var path=require(_0x4e14('0x1'));var timeout=require(_0x4e14('0x2'));var express=require(_0x4e14('0x3'));var router=express[_0x4e14('0x4')]();var fs_extra=require(_0x4e14('0x5'));var auth=require(_0x4e14('0x6'));var interaction=require(_0x4e14('0x7'));var config=require(_0x4e14('0x8'));var controller=require(_0x4e14('0x9'));router[_0x4e14('0xa')]('/',auth[_0x4e14('0xb')](),controller[_0x4e14('0xc')]);router[_0x4e14('0xa')]('/:id',auth[_0x4e14('0xb')](),controller[_0x4e14('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e14('0xe')]);router[_0x4e14('0xf')](_0x4e14('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x4e14('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4e14('0x12')]);module[_0x4e14('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 8b105cc..3b4f89a 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 _0x0135=['ENUM','externip','stun','STRING','sequelize','exports'];(function(_0x119d13,_0x263cd2){var _0x333c35=function(_0x422c6e){while(--_0x422c6e){_0x119d13['push'](_0x119d13['shift']());}};_0x333c35(++_0x263cd2);}(_0x0135,0xd0));var _0x5013=function(_0x470607,_0xc7427e){_0x470607=_0x470607-0x0;var _0x3f404c=_0x0135[_0x470607];return _0x3f404c;};'use strict';var Sequelize=require(_0x5013('0x0'));module[_0x5013('0x1')]={'type':{'type':Sequelize[_0x5013('0x2')]('localnet',_0x5013('0x3'),_0x5013('0x4'),'turn')},'value':{'type':Sequelize[_0x5013('0x5')]},'username':{'type':Sequelize[_0x5013('0x5')]},'password':{'type':Sequelize[_0x5013('0x5')]}}; \ No newline at end of file +var _0x24f4=['ENUM','STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24f4,0x16a));var _0x424f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24f4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x424f('0x0')]={'type':{'type':Sequelize[_0x424f('0x1')]('localnet','externip','stun','turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x424f('0x2')]},'password':{'type':Sequelize[_0x424f('0x2')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9ed849d..de16b45 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 _0xaa48=['render','res_stun_monitor.so','toUpperCase','TURN','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','STUN','root','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','limit','count','Content-Range','apply','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','Network','findAll','params','length','include','find','create','sequelize','transaction','body','type','readFileSync','join','server/files/templates/stun_multiple.ejs'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xaa48,0x15a));var _0x8aa4=function(_0x4ed91c,_0x187465){_0x4ed91c=_0x4ed91c-0x0;var _0x1da6ef=_0xaa48[_0x4ed91c];return _0x1da6ef;};'use strict';var emlformat=require(_0x8aa4('0x0'));var rimraf=require(_0x8aa4('0x1'));var zipdir=require(_0x8aa4('0x2'));var jsonpatch=require(_0x8aa4('0x3'));var rp=require(_0x8aa4('0x4'));var moment=require(_0x8aa4('0x5'));var BPromise=require(_0x8aa4('0x6'));var Mustache=require(_0x8aa4('0x7'));var util=require(_0x8aa4('0x8'));var path=require(_0x8aa4('0x9'));var sox=require(_0x8aa4('0xa'));var csv=require(_0x8aa4('0xb'));var ejs=require(_0x8aa4('0xc'));var fs=require('fs');var fs_extra=require(_0x8aa4('0xd'));var _=require(_0x8aa4('0xe'));var squel=require(_0x8aa4('0xf'));var crypto=require(_0x8aa4('0x10'));var jsforce=require(_0x8aa4('0x11'));var deskjs=require(_0x8aa4('0x12'));var toCsv=require('to-csv');var querystring=require(_0x8aa4('0x13'));var Papa=require(_0x8aa4('0x14'));var Redis=require('ioredis');var authService=require(_0x8aa4('0x15'));var qs=require(_0x8aa4('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8aa4('0x17'));var logger=require(_0x8aa4('0x18'))(_0x8aa4('0x19'));var utils=require(_0x8aa4('0x1a'));var config=require(_0x8aa4('0x1b'));var licenseUtil=require(_0x8aa4('0x1c'));var db=require(_0x8aa4('0x1d'))['db'];var jayson=require(_0x8aa4('0x1e'));var client=jayson[_0x8aa4('0x1f')][_0x8aa4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x569c43,_0x5951ce,_0x3143f7,_0x455a80){return new BPromise(function(_0xb8ce80,_0x38f35f){var _0x7b909c=_0x455a80||client;return _0x7b909c[_0x8aa4('0x21')](_0x569c43,_0x3143f7)[_0x8aa4('0x22')](function(_0x356df1){logger[_0x8aa4('0x23')](_0x8aa4('0x24'),_0x5951ce,'request\x20sent');logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x5951ce,_0x8aa4('0x25'),JSON[_0x8aa4('0x26')](_0x356df1));if(_0x356df1[_0x8aa4('0x27')]){if(_0x356df1[_0x8aa4('0x27')]['code']===0x1f4){logger[_0x8aa4('0x27')](_0x8aa4('0x24'),_0x5951ce,_0x356df1['error'][_0x8aa4('0x28')]);return _0x38f35f(_0x356df1['error']['message']);}logger[_0x8aa4('0x27')]('Network,\x20%s,\x20%s',_0x5951ce,_0x356df1[_0x8aa4('0x27')][_0x8aa4('0x28')]);return _0xb8ce80(_0x356df1['error'][_0x8aa4('0x28')]);}else{logger[_0x8aa4('0x23')]('Network,\x20%s,\x20%s',_0x5951ce,_0x8aa4('0x25'));_0xb8ce80(_0x356df1[_0x8aa4('0x29')][_0x8aa4('0x28')]);}})[_0x8aa4('0x2a')](function(_0x16259a){logger['error']('Network,\x20%s,\x20%s',_0x5951ce,_0x16259a);_0x38f35f(_0x16259a);});});}function respondWithStatusCode(_0x4c429f,_0x4984f9){_0x4984f9=_0x4984f9||0xcc;return function(_0x32466f){if(_0x32466f){return _0x4c429f['sendStatus'](_0x4984f9);}return _0x4c429f[_0x8aa4('0x2b')](_0x4984f9)[_0x8aa4('0x2c')]();};}function respondWithResult(_0x6b4bd,_0x387434){_0x387434=_0x387434||0xc8;return function(_0x5b8165){if(_0x5b8165){return _0x6b4bd['status'](_0x387434)[_0x8aa4('0x2d')](_0x5b8165);}};}function respondWithFilteredResult(_0x5a070c,_0x286601){return function(_0x4145ed){if(_0x4145ed){var _0x556f5c=typeof _0x286601[_0x8aa4('0x2e')]==='undefined'&&typeof _0x286601[_0x8aa4('0x2f')]==='undefined';var _0x46024e=_0x4145ed[_0x8aa4('0x30')];var _0x41b1e0=_0x556f5c?0x0:_0x286601[_0x8aa4('0x2e')];var _0x169ca3=_0x556f5c?_0x4145ed['count']:_0x286601['offset']+_0x286601['limit'];var _0x2aec56;if(_0x169ca3>=_0x46024e){_0x169ca3=_0x46024e;_0x2aec56=0xc8;}else{_0x2aec56=0xce;}_0x5a070c[_0x8aa4('0x2b')](_0x2aec56);return _0x5a070c['set'](_0x8aa4('0x31'),_0x41b1e0+'-'+_0x169ca3+'/'+_0x46024e)[_0x8aa4('0x2d')](_0x4145ed);}return null;};}function patchUpdates(_0x3e4595){return function(_0x3633d1){try{jsonpatch[_0x8aa4('0x32')](_0x3633d1,_0x3e4595,!![]);}catch(_0x1d6e19){return BPromise['reject'](_0x1d6e19);}return _0x3633d1[_0x8aa4('0x33')]();};}function saveUpdates(_0x599191,_0x4f8bb9){return function(_0x22da7c){if(_0x22da7c){return _0x22da7c[_0x8aa4('0x34')](_0x599191)[_0x8aa4('0x22')](function(_0x5cb97c){return _0x5cb97c;});}return null;};}function removeEntity(_0x27f90c,_0x481800){return function(_0x342938){if(_0x342938){return _0x342938[_0x8aa4('0x35')]()[_0x8aa4('0x22')](function(){_0x27f90c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ab8a3,_0x541cd9){return function(_0x3eceb8){if(!_0x3eceb8){_0x5ab8a3[_0x8aa4('0x36')](0x194);}return _0x3eceb8;};}function handleError(_0x328732,_0x10d821){_0x10d821=_0x10d821||0x1f4;return function(_0x4e3eb0){logger['error'](_0x4e3eb0[_0x8aa4('0x37')]);if(_0x4e3eb0[_0x8aa4('0x38')]){delete _0x4e3eb0[_0x8aa4('0x38')];}_0x328732[_0x8aa4('0x2b')](_0x10d821)[_0x8aa4('0x39')](_0x4e3eb0);};}exports['index']=function(_0x5b7024,_0x157ae6){var _0x157bfb={},_0x2b579a={},_0x4d9630={'count':0x0,'rows':[]};var _0x132414=_[_0x8aa4('0x3a')](db['Network'][_0x8aa4('0x3b')],function(_0x28c0a1){return{'name':_0x28c0a1[_0x8aa4('0x3c')],'type':_0x28c0a1['type'][_0x8aa4('0x3d')]};});_0x2b579a['model']=_['map'](_0x132414,_0x8aa4('0x38'));_0x2b579a['query']=_[_0x8aa4('0x3e')](_0x5b7024[_0x8aa4('0x3f')]);_0x2b579a['filters']=_[_0x8aa4('0x40')](_0x2b579a[_0x8aa4('0x41')],_0x2b579a[_0x8aa4('0x3f')]);_0x157bfb[_0x8aa4('0x42')]=_['intersection'](_0x2b579a[_0x8aa4('0x41')],qs[_0x8aa4('0x43')](_0x5b7024[_0x8aa4('0x3f')]['fields']));_0x157bfb[_0x8aa4('0x42')]=_0x157bfb[_0x8aa4('0x42')]['length']?_0x157bfb[_0x8aa4('0x42')]:_0x2b579a['model'];if(!_0x5b7024[_0x8aa4('0x3f')][_0x8aa4('0x44')](_0x8aa4('0x45'))){_0x157bfb[_0x8aa4('0x2f')]=qs[_0x8aa4('0x2f')](_0x5b7024[_0x8aa4('0x3f')][_0x8aa4('0x2f')]);_0x157bfb[_0x8aa4('0x2e')]=qs[_0x8aa4('0x2e')](_0x5b7024[_0x8aa4('0x3f')][_0x8aa4('0x2e')]);}_0x157bfb[_0x8aa4('0x46')]=qs[_0x8aa4('0x47')](_0x5b7024['query'][_0x8aa4('0x47')]);_0x157bfb[_0x8aa4('0x48')]=qs[_0x8aa4('0x49')](_[_0x8aa4('0x4a')](_0x5b7024[_0x8aa4('0x3f')],_0x2b579a[_0x8aa4('0x49')]),_0x132414);if(_0x5b7024[_0x8aa4('0x3f')]['filter']){_0x157bfb[_0x8aa4('0x48')]=_[_0x8aa4('0x4b')](_0x157bfb[_0x8aa4('0x48')],{'$or':_['map'](_0x132414,function(_0x53ef35){if(_0x53ef35['type']!==_0x8aa4('0x4c')){var _0x556e26={};_0x556e26[_0x53ef35[_0x8aa4('0x38')]]={'$like':'%'+_0x5b7024[_0x8aa4('0x3f')][_0x8aa4('0x4d')]+'%'};return _0x556e26;}})});}_0x157bfb=_[_0x8aa4('0x4b')]({},_0x157bfb,_0x5b7024[_0x8aa4('0x4e')]);var _0xdd6440={'where':_0x157bfb[_0x8aa4('0x48')]};return db['Network'][_0x8aa4('0x30')](_0xdd6440)[_0x8aa4('0x22')](function(_0x1503c9){_0x4d9630[_0x8aa4('0x30')]=_0x1503c9;if(_0x5b7024[_0x8aa4('0x3f')][_0x8aa4('0x4f')]){_0x157bfb['include']=[{'all':!![]}];}return db[_0x8aa4('0x50')][_0x8aa4('0x51')](_0x157bfb);})['then'](function(_0x436ad7){_0x4d9630['rows']=_0x436ad7;return _0x4d9630;})[_0x8aa4('0x22')](respondWithFilteredResult(_0x157ae6,_0x157bfb))[_0x8aa4('0x2a')](handleError(_0x157ae6,null));};exports['show']=function(_0x38abd4,_0x370725){var _0x4d193b={'raw':!![],'where':{'id':_0x38abd4[_0x8aa4('0x52')]['id']}},_0xc6557e={};_0xc6557e['model']=_['keys'](db[_0x8aa4('0x50')][_0x8aa4('0x3b')]);_0xc6557e[_0x8aa4('0x3f')]=_[_0x8aa4('0x3e')](_0x38abd4['query']);_0xc6557e[_0x8aa4('0x49')]=_['intersection'](_0xc6557e['model'],_0xc6557e[_0x8aa4('0x3f')]);_0x4d193b[_0x8aa4('0x42')]=_['intersection'](_0xc6557e[_0x8aa4('0x41')],qs[_0x8aa4('0x43')](_0x38abd4['query'][_0x8aa4('0x43')]));_0x4d193b[_0x8aa4('0x42')]=_0x4d193b[_0x8aa4('0x42')][_0x8aa4('0x53')]?_0x4d193b['attributes']:_0xc6557e['model'];if(_0x38abd4[_0x8aa4('0x3f')][_0x8aa4('0x4f')]){_0x4d193b[_0x8aa4('0x54')]=[{'all':!![]}];}_0x4d193b=_[_0x8aa4('0x4b')]({},_0x4d193b,_0x38abd4[_0x8aa4('0x4e')]);return db[_0x8aa4('0x50')][_0x8aa4('0x55')](_0x4d193b)[_0x8aa4('0x22')](handleEntityNotFound(_0x370725,null))[_0x8aa4('0x22')](respondWithResult(_0x370725,null))['catch'](handleError(_0x370725,null));};exports[_0x8aa4('0x56')]=function(_0x466b7d,_0x256b72,_0x5bea3b){var _0x3dbd08;return db[_0x8aa4('0x57')][_0x8aa4('0x58')](function(_0x5b0f26){return db['Network'][_0x8aa4('0x56')](_0x466b7d[_0x8aa4('0x59')],{'raw':!![]})['then'](function(_0x3d1ef7){_0x3dbd08=_0x3d1ef7;return db[_0x8aa4('0x50')][_0x8aa4('0x51')]({'where':{'type':_0x466b7d[_0x8aa4('0x59')][_0x8aa4('0x5a')]},'raw':!![]});})[_0x8aa4('0x22')](function(_0x12b2b1){if(_0x3dbd08['type']['toUpperCase']()=='STUN'){var _0x23530c=fs[_0x8aa4('0x5b')](path[_0x8aa4('0x5c')](config['root'],_0x8aa4('0x5d')),'utf8');var _0x30c97b=ejs[_0x8aa4('0x5e')](_0x23530c,{'networks':_0x12b2b1||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x30c97b);return respondWithRpcPromise('Reload',_0x8aa4('0x56'),{'module':_0x8aa4('0x5f')});}else if(_0x3dbd08['type'][_0x8aa4('0x60')]()==_0x8aa4('0x61')){var _0x36dc50=fs['readFileSync'](path[_0x8aa4('0x5c')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x8aa4('0x62'));var _0x1992af=ejs['render'](_0x36dc50,{'networks':_0x12b2b1||[]});fs[_0x8aa4('0x63')](_0x8aa4('0x64'),_0x1992af);return respondWithRpcPromise(_0x8aa4('0x65'),'create',{'module':_0x8aa4('0x5f')});}else{var _0x4571e6=fs[_0x8aa4('0x5b')](path[_0x8aa4('0x5c')](config['root'],'server/files/templates/network.ejs'),_0x8aa4('0x62'));var _0x1cb811=ejs[_0x8aa4('0x5e')](_0x4571e6,{'networks':_0x12b2b1||[]});fs[_0x8aa4('0x63')](util[_0x8aa4('0x66')](_0x8aa4('0x67'),_0x466b7d[_0x8aa4('0x59')]['type'][_0x8aa4('0x68')]()),_0x1cb811);return respondWithRpcPromise(_0x8aa4('0x65'),_0x8aa4('0x56'),{'module':_0x8aa4('0x69')});}return null;})[_0x8aa4('0x22')](function(){return _0x3dbd08;});})[_0x8aa4('0x22')](respondWithResult(_0x256b72,0xc9))[_0x8aa4('0x2a')](handleError(_0x256b72,null));};exports['update']=function(_0x3915a5,_0x5f3fa6,_0x18faeb){var _0x2a33a9;return db[_0x8aa4('0x57')][_0x8aa4('0x58')](function(_0x2c410b){return db[_0x8aa4('0x50')][_0x8aa4('0x55')]({'where':{'id':_0x3915a5[_0x8aa4('0x52')]['id']}})[_0x8aa4('0x22')](handleEntityNotFound(_0x5f3fa6,null))[_0x8aa4('0x22')](saveUpdates(_0x3915a5[_0x8aa4('0x59')],null))[_0x8aa4('0x22')](function(_0x2e8515){if(_0x2e8515){_0x2a33a9=_0x2e8515;return db[_0x8aa4('0x50')]['findAll']({'where':{'type':_0x2a33a9['type']},'raw':!![]});}return null;})[_0x8aa4('0x22')](function(_0x683c08){if(_0x2a33a9[_0x8aa4('0x5a')][_0x8aa4('0x60')]()==_0x8aa4('0x6a')){var _0x2d15e2=fs['readFileSync'](path['join'](config[_0x8aa4('0x6b')],_0x8aa4('0x5d')),_0x8aa4('0x62'));var _0xd42124=ejs[_0x8aa4('0x5e')](_0x2d15e2,{'networks':_0x683c08||[]});fs[_0x8aa4('0x63')](_0x8aa4('0x6c'),_0xd42124);return respondWithRpcPromise(_0x8aa4('0x65'),_0x8aa4('0x34'),{'module':_0x8aa4('0x5f')});}else if(_0x2a33a9[_0x8aa4('0x5a')]['toUpperCase']()=='TURN'){var _0x472162=fs[_0x8aa4('0x5b')](path[_0x8aa4('0x5c')](config[_0x8aa4('0x6b')],'server/files/templates/turn_multiple.ejs'),_0x8aa4('0x62'));var _0x42fcef=ejs['render'](_0x472162,{'networks':_0x683c08||[]});fs[_0x8aa4('0x63')](_0x8aa4('0x64'),_0x42fcef);return respondWithRpcPromise(_0x8aa4('0x65'),_0x8aa4('0x34'),{'module':'res_stun_monitor.so'});}else{var _0x37bad9=fs['readFileSync'](path[_0x8aa4('0x5c')](config[_0x8aa4('0x6b')],'server/files/templates/network.ejs'),'utf8');var _0x4425fd=ejs[_0x8aa4('0x5e')](_0x37bad9,{'networks':_0x683c08||[]});fs[_0x8aa4('0x63')](util[_0x8aa4('0x66')](_0x8aa4('0x67'),_0x3915a5['body'][_0x8aa4('0x5a')][_0x8aa4('0x68')]()),_0x4425fd);return respondWithRpcPromise('Reload',_0x8aa4('0x34'),{'module':_0x8aa4('0x69')});}return null;})[_0x8aa4('0x22')](function(_0x418e82){if(_0x418e82){return _0x2a33a9;}return null;});})[_0x8aa4('0x22')](respondWithResult(_0x5f3fa6,null))[_0x8aa4('0x2a')](handleError(_0x5f3fa6,null));};exports['destroy']=function(_0x572951,_0x4d1cc5,_0x563766){var _0xcecba8;return db[_0x8aa4('0x50')][_0x8aa4('0x55')]({'where':{'id':_0x572951[_0x8aa4('0x52')]['id']}})['then'](function(_0xc38784){_0xcecba8=_0xc38784;return _0xc38784;})[_0x8aa4('0x22')](handleEntityNotFound(_0x4d1cc5,null))[_0x8aa4('0x22')](removeEntity(_0x4d1cc5,null))[_0x8aa4('0x22')](function(){if(_0xcecba8){return db[_0x8aa4('0x50')]['findAll']({'where':{'type':_0xcecba8[_0x8aa4('0x5a')]},'raw':!![]});}})[_0x8aa4('0x22')](function(_0x13148e){if(_0xcecba8[_0x8aa4('0x5a')][_0x8aa4('0x60')]()==_0x8aa4('0x6a')){var _0x5d0a4f=fs['readFileSync'](path[_0x8aa4('0x5c')](config[_0x8aa4('0x6b')],_0x8aa4('0x5d')),_0x8aa4('0x62'));var _0x127fed=ejs['render'](_0x5d0a4f,{'networks':_0x13148e||[]});fs['writeFileSync'](_0x8aa4('0x6c'),_0x127fed);return respondWithRpcPromise(_0x8aa4('0x65'),'destroy',{'module':_0x8aa4('0x5f')});}else if(_0xcecba8['type'][_0x8aa4('0x60')]()=='TURN'){var _0x330594=fs[_0x8aa4('0x5b')](path[_0x8aa4('0x5c')](config[_0x8aa4('0x6b')],_0x8aa4('0x6d')),_0x8aa4('0x62'));var _0x1cee8e=ejs['render'](_0x330594,{'networks':_0x13148e||[]});fs[_0x8aa4('0x63')](_0x8aa4('0x64'),_0x1cee8e);return respondWithRpcPromise(_0x8aa4('0x65'),_0x8aa4('0x35'),{'module':'res_stun_monitor.so'});}else{var _0x1400eb=fs['readFileSync'](path[_0x8aa4('0x5c')](config[_0x8aa4('0x6b')],'server/files/templates/network.ejs'),'utf8');var _0x1d6679=ejs[_0x8aa4('0x5e')](_0x1400eb,{'networks':_0x13148e||[]});fs['writeFileSync'](util['format'](_0x8aa4('0x67'),_0x572951[_0x8aa4('0x59')][_0x8aa4('0x5a')][_0x8aa4('0x68')]()),_0x1d6679);return respondWithRpcPromise('Reload',_0x8aa4('0x35'),{'module':_0x8aa4('0x69')});}return null;})[_0x8aa4('0x2a')](handleError(_0x4d1cc5,null));}; \ No newline at end of file +var _0x1d44=['nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','rows','params','keys','options','find','create','sequelize','transaction','body','findAll','toUpperCase','STUN','root','utf8','render','writeFileSync','res_stun_monitor.so','TURN','readFileSync','join','/etc/asterisk/turn_xcally.conf','Reload','format','toLowerCase','chan_sip.so','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','catch','/etc/asterisk/stun_xcally.conf','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','name','index','Network','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x40f310,_0x33f8ba){var _0x414b2d=function(_0x23aa85){while(--_0x23aa85){_0x40f310['push'](_0x40f310['shift']());}};_0x414b2d(++_0x33f8ba);}(_0x1d44,0x95));var _0x41d4=function(_0x1e0de7,_0x28b328){_0x1e0de7=_0x1e0de7-0x0;var _0x212ce6=_0x1d44[_0x1e0de7];return _0x212ce6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41d4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41d4('0x1'));var rp=require(_0x41d4('0x2'));var moment=require(_0x41d4('0x3'));var BPromise=require(_0x41d4('0x4'));var Mustache=require(_0x41d4('0x5'));var util=require(_0x41d4('0x6'));var path=require(_0x41d4('0x7'));var sox=require(_0x41d4('0x8'));var csv=require(_0x41d4('0x9'));var ejs=require(_0x41d4('0xa'));var fs=require('fs');var fs_extra=require(_0x41d4('0xb'));var _=require(_0x41d4('0xc'));var squel=require(_0x41d4('0xd'));var crypto=require('crypto');var jsforce=require(_0x41d4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x41d4('0x9'));var querystring=require(_0x41d4('0xf'));var Papa=require('papaparse');var Redis=require(_0x41d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x41d4('0x11'));var as=require(_0x41d4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41d4('0x13'))(_0x41d4('0x14'));var utils=require('../../config/utils');var config=require(_0x41d4('0x15'));var licenseUtil=require(_0x41d4('0x16'));var db=require(_0x41d4('0x17'))['db'];var jayson=require(_0x41d4('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35901d,_0xb519ba,_0x3b990b,_0x339df8){return new BPromise(function(_0x1f2fae,_0x4ff3d4){var _0x42a4d1=_0x339df8||client;return _0x42a4d1['request'](_0x35901d,_0x3b990b)[_0x41d4('0x19')](function(_0x30d520){logger[_0x41d4('0x1a')](_0x41d4('0x1b'),_0xb519ba,'request\x20sent');logger[_0x41d4('0x1c')](_0x41d4('0x1d'),_0xb519ba,_0x41d4('0x1e'),JSON[_0x41d4('0x1f')](_0x30d520));if(_0x30d520[_0x41d4('0x20')]){if(_0x30d520[_0x41d4('0x20')][_0x41d4('0x21')]===0x1f4){logger['error'](_0x41d4('0x1b'),_0xb519ba,_0x30d520[_0x41d4('0x20')]['message']);return _0x4ff3d4(_0x30d520[_0x41d4('0x20')][_0x41d4('0x22')]);}logger['error'](_0x41d4('0x1b'),_0xb519ba,_0x30d520[_0x41d4('0x20')][_0x41d4('0x22')]);return _0x1f2fae(_0x30d520['error'][_0x41d4('0x22')]);}else{logger[_0x41d4('0x1a')]('Network,\x20%s,\x20%s',_0xb519ba,'request\x20sent');_0x1f2fae(_0x30d520['result'][_0x41d4('0x22')]);}})['catch'](function(_0x67175d){logger['error'](_0x41d4('0x1b'),_0xb519ba,_0x67175d);_0x4ff3d4(_0x67175d);});});}function respondWithStatusCode(_0x233de4,_0x32d665){_0x32d665=_0x32d665||0xcc;return function(_0x4ee8c9){if(_0x4ee8c9){return _0x233de4[_0x41d4('0x23')](_0x32d665);}return _0x233de4[_0x41d4('0x24')](_0x32d665)[_0x41d4('0x25')]();};}function respondWithResult(_0x142439,_0x4b2cd8){_0x4b2cd8=_0x4b2cd8||0xc8;return function(_0x1c4108){if(_0x1c4108){return _0x142439[_0x41d4('0x24')](_0x4b2cd8)['json'](_0x1c4108);}};}function respondWithFilteredResult(_0x13a3df,_0x216d71){return function(_0x13ade7){if(_0x13ade7){var _0x119471=typeof _0x216d71[_0x41d4('0x26')]===_0x41d4('0x27')&&typeof _0x216d71[_0x41d4('0x28')]==='undefined';var _0x4190bb=_0x13ade7[_0x41d4('0x29')];var _0x2c2711=_0x119471?0x0:_0x216d71[_0x41d4('0x26')];var _0x417e9f=_0x119471?_0x13ade7['count']:_0x216d71[_0x41d4('0x26')]+_0x216d71[_0x41d4('0x28')];var _0x5241b1;if(_0x417e9f>=_0x4190bb){_0x417e9f=_0x4190bb;_0x5241b1=0xc8;}else{_0x5241b1=0xce;}_0x13a3df[_0x41d4('0x24')](_0x5241b1);return _0x13a3df[_0x41d4('0x2a')](_0x41d4('0x2b'),_0x2c2711+'-'+_0x417e9f+'/'+_0x4190bb)[_0x41d4('0x2c')](_0x13ade7);}return null;};}function patchUpdates(_0x3ed82f){return function(_0x40b637){try{jsonpatch['apply'](_0x40b637,_0x3ed82f,!![]);}catch(_0x4e0796){return BPromise[_0x41d4('0x2d')](_0x4e0796);}return _0x40b637[_0x41d4('0x2e')]();};}function saveUpdates(_0x30b7d9,_0x374b4b){return function(_0x2c5091){if(_0x2c5091){return _0x2c5091[_0x41d4('0x2f')](_0x30b7d9)[_0x41d4('0x19')](function(_0x39cbfa){return _0x39cbfa;});}return null;};}function removeEntity(_0x2a9880,_0x45be8e){return function(_0x2b5776){if(_0x2b5776){return _0x2b5776['destroy']()[_0x41d4('0x19')](function(){_0x2a9880[_0x41d4('0x24')](0xcc)[_0x41d4('0x25')]();});}};}function handleEntityNotFound(_0x5e4bcf,_0x285f09){return function(_0x4bd3d8){if(!_0x4bd3d8){_0x5e4bcf[_0x41d4('0x23')](0x194);}return _0x4bd3d8;};}function handleError(_0x5b7d2d,_0x15391e){_0x15391e=_0x15391e||0x1f4;return function(_0x28d040){logger[_0x41d4('0x20')](_0x28d040['stack']);if(_0x28d040['name']){delete _0x28d040[_0x41d4('0x30')];}_0x5b7d2d[_0x41d4('0x24')](_0x15391e)['send'](_0x28d040);};}exports[_0x41d4('0x31')]=function(_0x3f52a3,_0x3fe488){var _0x5813d8={},_0xb98790={},_0x20d917={'count':0x0,'rows':[]};var _0x55cb67=_['map'](db[_0x41d4('0x32')][_0x41d4('0x33')],function(_0x37e2d6){return{'name':_0x37e2d6[_0x41d4('0x34')],'type':_0x37e2d6['type'][_0x41d4('0x35')]};});_0xb98790[_0x41d4('0x36')]=_[_0x41d4('0x37')](_0x55cb67,_0x41d4('0x30'));_0xb98790[_0x41d4('0x38')]=_['keys'](_0x3f52a3[_0x41d4('0x38')]);_0xb98790[_0x41d4('0x39')]=_[_0x41d4('0x3a')](_0xb98790[_0x41d4('0x36')],_0xb98790['query']);_0x5813d8['attributes']=_[_0x41d4('0x3a')](_0xb98790[_0x41d4('0x36')],qs['fields'](_0x3f52a3[_0x41d4('0x38')][_0x41d4('0x3b')]));_0x5813d8[_0x41d4('0x3c')]=_0x5813d8[_0x41d4('0x3c')][_0x41d4('0x3d')]?_0x5813d8[_0x41d4('0x3c')]:_0xb98790[_0x41d4('0x36')];if(!_0x3f52a3[_0x41d4('0x38')][_0x41d4('0x3e')](_0x41d4('0x3f'))){_0x5813d8[_0x41d4('0x28')]=qs[_0x41d4('0x28')](_0x3f52a3['query'][_0x41d4('0x28')]);_0x5813d8[_0x41d4('0x26')]=qs[_0x41d4('0x26')](_0x3f52a3['query'][_0x41d4('0x26')]);}_0x5813d8[_0x41d4('0x40')]=qs[_0x41d4('0x41')](_0x3f52a3[_0x41d4('0x38')]['sort']);_0x5813d8[_0x41d4('0x42')]=qs[_0x41d4('0x39')](_[_0x41d4('0x43')](_0x3f52a3[_0x41d4('0x38')],_0xb98790['filters']),_0x55cb67);if(_0x3f52a3[_0x41d4('0x38')][_0x41d4('0x44')]){_0x5813d8[_0x41d4('0x42')]=_['merge'](_0x5813d8[_0x41d4('0x42')],{'$or':_[_0x41d4('0x37')](_0x55cb67,function(_0x3b6142){if(_0x3b6142[_0x41d4('0x45')]!==_0x41d4('0x46')){var _0x845a61={};_0x845a61[_0x3b6142[_0x41d4('0x30')]]={'$like':'%'+_0x3f52a3[_0x41d4('0x38')][_0x41d4('0x44')]+'%'};return _0x845a61;}})});}_0x5813d8=_[_0x41d4('0x47')]({},_0x5813d8,_0x3f52a3['options']);var _0x33aafa={'where':_0x5813d8['where']};return db[_0x41d4('0x32')]['count'](_0x33aafa)[_0x41d4('0x19')](function(_0xb403bd){_0x20d917[_0x41d4('0x29')]=_0xb403bd;if(_0x3f52a3[_0x41d4('0x38')][_0x41d4('0x48')]){_0x5813d8[_0x41d4('0x49')]=[{'all':!![]}];}return db[_0x41d4('0x32')]['findAll'](_0x5813d8);})[_0x41d4('0x19')](function(_0xb1d93a){_0x20d917[_0x41d4('0x4a')]=_0xb1d93a;return _0x20d917;})[_0x41d4('0x19')](respondWithFilteredResult(_0x3fe488,_0x5813d8))['catch'](handleError(_0x3fe488,null));};exports['show']=function(_0x5f579e,_0x579c37){var _0x4e926c={'raw':!![],'where':{'id':_0x5f579e[_0x41d4('0x4b')]['id']}},_0x330f61={};_0x330f61['model']=_['keys'](db[_0x41d4('0x32')]['rawAttributes']);_0x330f61[_0x41d4('0x38')]=_[_0x41d4('0x4c')](_0x5f579e[_0x41d4('0x38')]);_0x330f61['filters']=_[_0x41d4('0x3a')](_0x330f61[_0x41d4('0x36')],_0x330f61['query']);_0x4e926c[_0x41d4('0x3c')]=_['intersection'](_0x330f61[_0x41d4('0x36')],qs[_0x41d4('0x3b')](_0x5f579e[_0x41d4('0x38')][_0x41d4('0x3b')]));_0x4e926c['attributes']=_0x4e926c[_0x41d4('0x3c')]['length']?_0x4e926c[_0x41d4('0x3c')]:_0x330f61[_0x41d4('0x36')];if(_0x5f579e[_0x41d4('0x38')]['includeAll']){_0x4e926c['include']=[{'all':!![]}];}_0x4e926c=_[_0x41d4('0x47')]({},_0x4e926c,_0x5f579e[_0x41d4('0x4d')]);return db[_0x41d4('0x32')][_0x41d4('0x4e')](_0x4e926c)['then'](handleEntityNotFound(_0x579c37,null))[_0x41d4('0x19')](respondWithResult(_0x579c37,null))['catch'](handleError(_0x579c37,null));};exports[_0x41d4('0x4f')]=function(_0x73b553,_0x29a4e3,_0x105a44){var _0x278d79;return db[_0x41d4('0x50')][_0x41d4('0x51')](function(_0x3cba5a){return db[_0x41d4('0x32')][_0x41d4('0x4f')](_0x73b553[_0x41d4('0x52')],{'raw':!![]})[_0x41d4('0x19')](function(_0x348c56){_0x278d79=_0x348c56;return db[_0x41d4('0x32')][_0x41d4('0x53')]({'where':{'type':_0x73b553[_0x41d4('0x52')][_0x41d4('0x45')]},'raw':!![]});})['then'](function(_0x77ee6b){if(_0x278d79[_0x41d4('0x45')][_0x41d4('0x54')]()==_0x41d4('0x55')){var _0x42d91b=fs['readFileSync'](path['join'](config[_0x41d4('0x56')],'server/files/templates/stun_multiple.ejs'),_0x41d4('0x57'));var _0x47f2cf=ejs[_0x41d4('0x58')](_0x42d91b,{'networks':_0x77ee6b||[]});fs[_0x41d4('0x59')]('/etc/asterisk/stun_xcally.conf',_0x47f2cf);return respondWithRpcPromise('Reload',_0x41d4('0x4f'),{'module':_0x41d4('0x5a')});}else if(_0x278d79[_0x41d4('0x45')]['toUpperCase']()==_0x41d4('0x5b')){var _0x183728=fs[_0x41d4('0x5c')](path[_0x41d4('0x5d')](config[_0x41d4('0x56')],'server/files/templates/turn_multiple.ejs'),_0x41d4('0x57'));var _0x10cd3a=ejs[_0x41d4('0x58')](_0x183728,{'networks':_0x77ee6b||[]});fs[_0x41d4('0x59')](_0x41d4('0x5e'),_0x10cd3a);return respondWithRpcPromise(_0x41d4('0x5f'),_0x41d4('0x4f'),{'module':'res_stun_monitor.so'});}else{var _0x3ed1f3=fs[_0x41d4('0x5c')](path[_0x41d4('0x5d')](config[_0x41d4('0x56')],'server/files/templates/network.ejs'),_0x41d4('0x57'));var _0x72418d=ejs[_0x41d4('0x58')](_0x3ed1f3,{'networks':_0x77ee6b||[]});fs[_0x41d4('0x59')](util[_0x41d4('0x60')]('/etc/asterisk/sip_xcally_%s.conf',_0x73b553[_0x41d4('0x52')][_0x41d4('0x45')][_0x41d4('0x61')]()),_0x72418d);return respondWithRpcPromise(_0x41d4('0x5f'),_0x41d4('0x4f'),{'module':_0x41d4('0x62')});}return null;})[_0x41d4('0x19')](function(){return _0x278d79;});})[_0x41d4('0x19')](respondWithResult(_0x29a4e3,0xc9))['catch'](handleError(_0x29a4e3,null));};exports['update']=function(_0xea403a,_0xbe758b,_0x554e18){var _0x218742;return db[_0x41d4('0x50')][_0x41d4('0x51')](function(_0x343420){return db[_0x41d4('0x32')][_0x41d4('0x4e')]({'where':{'id':_0xea403a[_0x41d4('0x4b')]['id']}})[_0x41d4('0x19')](handleEntityNotFound(_0xbe758b,null))[_0x41d4('0x19')](saveUpdates(_0xea403a['body'],null))['then'](function(_0x4f63c2){if(_0x4f63c2){_0x218742=_0x4f63c2;return db[_0x41d4('0x32')][_0x41d4('0x53')]({'where':{'type':_0x218742[_0x41d4('0x45')]},'raw':!![]});}return null;})[_0x41d4('0x19')](function(_0x317606){if(_0x218742['type']['toUpperCase']()==_0x41d4('0x55')){var _0x43f4a3=fs[_0x41d4('0x5c')](path[_0x41d4('0x5d')](config[_0x41d4('0x56')],_0x41d4('0x63')),'utf8');var _0x18003a=ejs[_0x41d4('0x58')](_0x43f4a3,{'networks':_0x317606||[]});fs[_0x41d4('0x59')]('/etc/asterisk/stun_xcally.conf',_0x18003a);return respondWithRpcPromise(_0x41d4('0x5f'),_0x41d4('0x2f'),{'module':_0x41d4('0x5a')});}else if(_0x218742[_0x41d4('0x45')][_0x41d4('0x54')]()==_0x41d4('0x5b')){var _0x115535=fs[_0x41d4('0x5c')](path[_0x41d4('0x5d')](config[_0x41d4('0x56')],_0x41d4('0x64')),'utf8');var _0x313e1a=ejs[_0x41d4('0x58')](_0x115535,{'networks':_0x317606||[]});fs[_0x41d4('0x59')](_0x41d4('0x5e'),_0x313e1a);return respondWithRpcPromise('Reload',_0x41d4('0x2f'),{'module':_0x41d4('0x5a')});}else{var _0x425211=fs['readFileSync'](path[_0x41d4('0x5d')](config[_0x41d4('0x56')],_0x41d4('0x65')),_0x41d4('0x57'));var _0x58c189=ejs[_0x41d4('0x58')](_0x425211,{'networks':_0x317606||[]});fs['writeFileSync'](util['format'](_0x41d4('0x66'),_0xea403a[_0x41d4('0x52')][_0x41d4('0x45')][_0x41d4('0x61')]()),_0x58c189);return respondWithRpcPromise('Reload',_0x41d4('0x2f'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x51a8c2){if(_0x51a8c2){return _0x218742;}return null;});})[_0x41d4('0x19')](respondWithResult(_0xbe758b,null))[_0x41d4('0x67')](handleError(_0xbe758b,null));};exports['destroy']=function(_0x10fbe0,_0x5a7ff2,_0x18b667){var _0x530c4a;return db[_0x41d4('0x32')][_0x41d4('0x4e')]({'where':{'id':_0x10fbe0[_0x41d4('0x4b')]['id']}})[_0x41d4('0x19')](function(_0x35e106){_0x530c4a=_0x35e106;return _0x35e106;})[_0x41d4('0x19')](handleEntityNotFound(_0x5a7ff2,null))[_0x41d4('0x19')](removeEntity(_0x5a7ff2,null))[_0x41d4('0x19')](function(){if(_0x530c4a){return db[_0x41d4('0x32')][_0x41d4('0x53')]({'where':{'type':_0x530c4a['type']},'raw':!![]});}})['then'](function(_0xd9757e){if(_0x530c4a[_0x41d4('0x45')][_0x41d4('0x54')]()==_0x41d4('0x55')){var _0x2cf029=fs[_0x41d4('0x5c')](path[_0x41d4('0x5d')](config[_0x41d4('0x56')],_0x41d4('0x63')),'utf8');var _0x210baa=ejs[_0x41d4('0x58')](_0x2cf029,{'networks':_0xd9757e||[]});fs['writeFileSync'](_0x41d4('0x68'),_0x210baa);return respondWithRpcPromise(_0x41d4('0x5f'),_0x41d4('0x69'),{'module':_0x41d4('0x5a')});}else if(_0x530c4a[_0x41d4('0x45')][_0x41d4('0x54')]()==_0x41d4('0x5b')){var _0x55f0eb=fs[_0x41d4('0x5c')](path[_0x41d4('0x5d')](config[_0x41d4('0x56')],_0x41d4('0x64')),_0x41d4('0x57'));var _0x5e0bd0=ejs[_0x41d4('0x58')](_0x55f0eb,{'networks':_0xd9757e||[]});fs[_0x41d4('0x59')](_0x41d4('0x5e'),_0x5e0bd0);return respondWithRpcPromise(_0x41d4('0x5f'),_0x41d4('0x69'),{'module':_0x41d4('0x5a')});}else{var _0xfd2bb3=fs[_0x41d4('0x5c')](path[_0x41d4('0x5d')](config['root'],_0x41d4('0x65')),_0x41d4('0x57'));var _0x111de9=ejs['render'](_0xfd2bb3,{'networks':_0xd9757e||[]});fs['writeFileSync'](util[_0x41d4('0x60')](_0x41d4('0x66'),_0x10fbe0[_0x41d4('0x52')][_0x41d4('0x45')][_0x41d4('0x61')]()),_0x111de9);return respondWithRpcPromise('Reload',_0x41d4('0x69'),{'module':_0x41d4('0x62')});}return null;})[_0x41d4('0x67')](handleError(_0x5a7ff2,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 680e007..96d2317 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 _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','define','Network','network'];(function(_0x50b896,_0x1aa0a9){var _0xb80900=function(_0x2ab794){while(--_0x2ab794){_0x50b896['push'](_0x50b896['shift']());}};_0xb80900(++_0x1aa0a9);}(_0x2dae,0xc3));var _0xe2da=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x2dae[_0x874cf1];return _0x233579;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf6e=['./network.attributes','exports','define','Network','network','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5d3a3a,_0x180bdf){var _0x5aa867=function(_0x5b6cf8){while(--_0x5b6cf8){_0x5d3a3a['push'](_0x5d3a3a['shift']());}};_0x5aa867(++_0x180bdf);}(_0xbf6e,0x149));var _0xebf6=function(_0x452f5b,_0x5389d1){_0x452f5b=_0x452f5b-0x0;var _0x33e5e2=_0xbf6e[_0x452f5b];return _0x33e5e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xebf6('0x0'))(_0xebf6('0x1'));var moment=require(_0xebf6('0x2'));var BPromise=require(_0xebf6('0x3'));var rp=require(_0xebf6('0x4'));var fs=require('fs');var path=require(_0xebf6('0x5'));var rimraf=require(_0xebf6('0x6'));var config=require('../../config/environment');var attributes=require(_0xebf6('0x7'));module[_0xebf6('0x8')]=function(_0x3b2bb6,_0x1e15cf){return _0x3b2bb6[_0xebf6('0x9')](_0xebf6('0xa'),attributes,{'tableName':_0xebf6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index cc00b7a..034971c 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(_0x17a71c,_0x1a6238){var _0x1921b8=function(_0x4a9ddd){while(--_0x4a9ddd){_0x17a71c['push'](_0x17a71c['shift']());}};_0x1921b8(++_0x1a6238);}(_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(_0x2ed92a,_0x5e1ea3){var _0x3fb3c7=function(_0x292e83){while(--_0x292e83){_0x2ed92a['push'](_0x2ed92a['shift']());}};_0x3fb3c7(++_0x5e1ea3);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 ac935a8..46903c8 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 _0x3b7d=['/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','addDisposition','addAnswer','post','/:id/notify','addApplications','addAgents','/:id/send','put','/:id','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/dispositions','/:id/canned_answers'];(function(_0x12eabf,_0x1bd868){var _0x509b5c=function(_0x313c63){while(--_0x313c63){_0x12eabf['push'](_0x12eabf['shift']());}};_0x509b5c(++_0x1bd868);}(_0x3b7d,0xa1));var _0xd3b7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3b7d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xd3b7('0x0'));var util=require(_0xd3b7('0x1'));var path=require(_0xd3b7('0x2'));var timeout=require(_0xd3b7('0x3'));var express=require(_0xd3b7('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd3b7('0x5'));var interaction=require(_0xd3b7('0x6'));var config=require(_0xd3b7('0x7'));var controller=require('./openchannelAccount.controller');router[_0xd3b7('0x8')]('/',auth[_0xd3b7('0x9')](),controller['index']);router[_0xd3b7('0x8')](_0xd3b7('0xa'),auth[_0xd3b7('0x9')](),controller['describe']);router[_0xd3b7('0x8')]('/:id',auth[_0xd3b7('0x9')](),controller[_0xd3b7('0xb')]);router[_0xd3b7('0x8')](_0xd3b7('0xc'),auth[_0xd3b7('0x9')](),controller['getDispositions']);router[_0xd3b7('0x8')](_0xd3b7('0xd'),auth[_0xd3b7('0x9')](),controller['getAnswers']);router['get'](_0xd3b7('0xe'),auth[_0xd3b7('0x9')](),controller[_0xd3b7('0xf')]);router['get'](_0xd3b7('0x10'),auth[_0xd3b7('0x9')](),controller[_0xd3b7('0x11')]);router[_0xd3b7('0x8')](_0xd3b7('0x12'),auth[_0xd3b7('0x9')](),controller[_0xd3b7('0x13')]);router['post']('/',auth[_0xd3b7('0x9')](),controller[_0xd3b7('0x14')]);router['post'](_0xd3b7('0xc'),auth['isAuthenticated'](),controller[_0xd3b7('0x15')]);router['post'](_0xd3b7('0xd'),auth[_0xd3b7('0x9')](),controller[_0xd3b7('0x16')]);router[_0xd3b7('0x17')](_0xd3b7('0x18'),controller['notify']);router[_0xd3b7('0x17')](_0xd3b7('0xe'),auth[_0xd3b7('0x9')](),controller[_0xd3b7('0x19')]);router[_0xd3b7('0x17')](_0xd3b7('0x12'),auth[_0xd3b7('0x9')](),controller[_0xd3b7('0x1a')]);router[_0xd3b7('0x17')](_0xd3b7('0x1b'),auth[_0xd3b7('0x9')](),controller['send']);router[_0xd3b7('0x1c')](_0xd3b7('0x1d'),auth[_0xd3b7('0x9')](),controller['update']);router[_0xd3b7('0x1e')](_0xd3b7('0x1d'),auth[_0xd3b7('0x9')](),controller['destroy']);router['delete'](_0xd3b7('0xc'),auth['isAuthenticated'](),controller[_0xd3b7('0x1f')]);router[_0xd3b7('0x1e')](_0xd3b7('0xd'),auth[_0xd3b7('0x9')](),controller[_0xd3b7('0x20')]);router[_0xd3b7('0x1e')](_0xd3b7('0x12'),auth[_0xd3b7('0x9')](),controller[_0xd3b7('0x21')]);module[_0xd3b7('0x22')]=router; \ No newline at end of file +var _0x8979=['index','get','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated'];(function(_0x48bd30,_0x56cea7){var _0x34bfe4=function(_0xfcf40){while(--_0xfcf40){_0x48bd30['push'](_0x48bd30['shift']());}};_0x34bfe4(++_0x56cea7);}(_0x8979,0x184));var _0x9897=function(_0x1b08f6,_0x5aad52){_0x1b08f6=_0x1b08f6-0x0;var _0x54dc87=_0x8979[_0x1b08f6];return _0x54dc87;};'use strict';var multer=require('multer');var util=require(_0x9897('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9897('0x1'));var router=express[_0x9897('0x2')]();var fs_extra=require(_0x9897('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9897('0x4'));var config=require(_0x9897('0x5'));var controller=require(_0x9897('0x6'));router['get']('/',auth[_0x9897('0x7')](),controller[_0x9897('0x8')]);router[_0x9897('0x9')]('/describe',auth[_0x9897('0x7')](),controller[_0x9897('0xa')]);router[_0x9897('0x9')](_0x9897('0xb'),auth[_0x9897('0x7')](),controller[_0x9897('0xc')]);router[_0x9897('0x9')](_0x9897('0xd'),auth[_0x9897('0x7')](),controller[_0x9897('0xe')]);router[_0x9897('0x9')](_0x9897('0xf'),auth[_0x9897('0x7')](),controller['getAnswers']);router[_0x9897('0x9')](_0x9897('0x10'),auth[_0x9897('0x7')](),controller[_0x9897('0x11')]);router['get']('/:id/interactions',auth[_0x9897('0x7')](),controller['getInteractions']);router['get']('/:id/users',auth[_0x9897('0x7')](),controller['getAgents']);router[_0x9897('0x12')]('/',auth[_0x9897('0x7')](),controller[_0x9897('0x13')]);router['post'](_0x9897('0xd'),auth[_0x9897('0x7')](),controller['addDisposition']);router[_0x9897('0x12')](_0x9897('0xf'),auth[_0x9897('0x7')](),controller[_0x9897('0x14')]);router['post'](_0x9897('0x15'),controller[_0x9897('0x16')]);router[_0x9897('0x12')](_0x9897('0x10'),auth[_0x9897('0x7')](),controller[_0x9897('0x17')]);router[_0x9897('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x9897('0x18')]);router[_0x9897('0x12')]('/:id/send',auth[_0x9897('0x7')](),controller[_0x9897('0x19')]);router[_0x9897('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x9897('0x1b')]);router[_0x9897('0x1c')](_0x9897('0xb'),auth[_0x9897('0x7')](),controller[_0x9897('0x1d')]);router[_0x9897('0x1c')](_0x9897('0xd'),auth[_0x9897('0x7')](),controller[_0x9897('0x1e')]);router[_0x9897('0x1c')](_0x9897('0xf'),auth[_0x9897('0x7')](),controller[_0x9897('0x1f')]);router[_0x9897('0x1c')](_0x9897('0x20'),auth['isAuthenticated'](),controller['removeAgents']);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 93d863d..a999d07 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 _0xc14b=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','BOOLEAN'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xc14b,0x9d));var _0xbc14=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0xc14b[_0x50bf5a];return _0x4ddc1d;};'use strict';var Sequelize=require(_0xbc14('0x0'));var rs=require('randomstring');module[_0xbc14('0x1')]={'name':{'type':Sequelize[_0xbc14('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbc14('0x2')]},'token':{'type':Sequelize[_0xbc14('0x2')],'defaultValue':function(){return rs[_0xbc14('0x3')]();}},'replyUri':{'type':Sequelize[_0xbc14('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbc14('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbc14('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbc14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbc14('0x2')]},'queueTransfer':{'type':Sequelize[_0xbc14('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbc14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbc14('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbc14('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbc14('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbc14('0x6'),'set':function(_0x6d0943){if(!_0x6d0943)this[_0xbc14('0x7')]('mandatoryDispositionPauseId',null);this[_0xbc14('0x7')](_0xbc14('0x8'),_0x6d0943);}}}; \ No newline at end of file +var _0x3a1e=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3a1e,0x196));var _0xe3a1=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x3a1e[_0x1e6659];return _0x4d16e4;};'use strict';var Sequelize=require(_0xe3a1('0x0'));var rs=require(_0xe3a1('0x1'));module[_0xe3a1('0x2')]={'name':{'type':Sequelize[_0xe3a1('0x3')],'unique':_0xe3a1('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe3a1('0x3')],'defaultValue':function(){return rs[_0xe3a1('0x5')]();}},'replyUri':{'type':Sequelize[_0xe3a1('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe3a1('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe3a1('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe3a1('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe3a1('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe3a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xe3a1('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe3a1('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe3a1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe3a1('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xe3a1('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe3a1('0x7')],'defaultValue':![],'comment':_0xe3a1('0xa'),'set':function(_0x4297c5){if(!_0x4297c5)this[_0xe3a1('0xb')](_0xe3a1('0xc'),null);this[_0xe3a1('0xb')]('mandatoryDisposition',_0x4297c5);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index aa96524..25c75f4 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 _0xe68e=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','show','mandatoryDispositionPause','keys','include','merge','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addDisposition','OpenchannelAccountId','Disposition','getDispositions','includeAll','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','rawAttributes','removeAnswers','ids','notify','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','List','account','applications','Applications','list','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','then','end','name','send','index','Pause','map','OpenchannelAccount','type','model','query','filters'];(function(_0x2c0ac2,_0x3f250e){var _0x1909cc=function(_0x2b9c54){while(--_0x2b9c54){_0x2c0ac2['push'](_0x2c0ac2['shift']());}};_0x1909cc(++_0x3f250e);}(_0xe68e,0x12c));var _0xee68=function(_0x39b07e,_0x33b057){_0x39b07e=_0x39b07e-0x0;var _0x591dae=_0xe68e[_0x39b07e];return _0x591dae;};'use strict';var emlformat=require(_0xee68('0x0'));var rimraf=require(_0xee68('0x1'));var zipdir=require(_0xee68('0x2'));var jsonpatch=require(_0xee68('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee68('0x4'));var util=require('util');var path=require(_0xee68('0x5'));var sox=require(_0xee68('0x6'));var csv=require(_0xee68('0x7'));var ejs=require(_0xee68('0x8'));var fs=require('fs');var fs_extra=require(_0xee68('0x9'));var _=require(_0xee68('0xa'));var squel=require(_0xee68('0xb'));var crypto=require('crypto');var jsforce=require(_0xee68('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xee68('0x7'));var querystring=require(_0xee68('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee68('0xe'));var qs=require(_0xee68('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee68('0x10'));var logger=require(_0xee68('0x11'))('api');var utils=require(_0xee68('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xee68('0x13'));var db=require('../../mysqldb')['db'];config[_0xee68('0x14')]=_[_0xee68('0x15')](config[_0xee68('0x14')],{'host':_0xee68('0x16'),'port':0x18eb});var socket=require(_0xee68('0x17'))(new Redis(config[_0xee68('0x14')]));require(_0xee68('0x18'))[_0xee68('0x19')](socket);var jayson=require(_0xee68('0x1a'));var client=jayson[_0xee68('0x1b')][_0xee68('0x1c')]({'port':0x232c});var client9002=jayson[_0xee68('0x1b')][_0xee68('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x497482,_0x14ec5d,_0x57d981,_0xcf22c8){return new BPromise(function(_0x30aeda,_0x48302f){var _0x4ec9c5=_0xcf22c8||client;return _0x4ec9c5[_0xee68('0x1d')](_0x497482,_0x57d981)['then'](function(_0x56f667){logger[_0xee68('0x1e')](_0xee68('0x1f'),_0x14ec5d,_0xee68('0x20'));logger[_0xee68('0x21')](_0xee68('0x22'),_0x14ec5d,'request\x20sent',JSON[_0xee68('0x23')](_0x56f667));if(_0x56f667[_0xee68('0x24')]){if(_0x56f667[_0xee68('0x24')][_0xee68('0x25')]===0x1f4){logger['error'](_0xee68('0x1f'),_0x14ec5d,_0x56f667[_0xee68('0x24')]['message']);return _0x48302f(_0x56f667[_0xee68('0x24')]['message']);}logger[_0xee68('0x24')](_0xee68('0x1f'),_0x14ec5d,_0x56f667[_0xee68('0x24')]['message']);return _0x30aeda(_0x56f667[_0xee68('0x24')][_0xee68('0x26')]);}else{logger[_0xee68('0x1e')](_0xee68('0x1f'),_0x14ec5d,_0xee68('0x20'));_0x30aeda(_0x56f667[_0xee68('0x27')][_0xee68('0x26')]);}})[_0xee68('0x28')](function(_0x4ca3d5){logger['error'](_0xee68('0x1f'),_0x14ec5d,_0x4ca3d5);_0x48302f(_0x4ca3d5);});});}function respondWithStatusCode(_0x26a2f8,_0x4d2540){_0x4d2540=_0x4d2540||0xcc;return function(_0x3a6f73){if(_0x3a6f73){return _0x26a2f8[_0xee68('0x29')](_0x4d2540);}return _0x26a2f8[_0xee68('0x2a')](_0x4d2540)['end']();};}function respondWithResult(_0x42c473,_0x23c3a3){_0x23c3a3=_0x23c3a3||0xc8;return function(_0x4f7aac){if(_0x4f7aac){return _0x42c473['status'](_0x23c3a3)[_0xee68('0x2b')](_0x4f7aac);}};}function respondWithFilteredResult(_0x2c8c3b,_0xd746df){return function(_0x23933a){if(_0x23933a){var _0x5a0817=typeof _0xd746df[_0xee68('0x2c')]===_0xee68('0x2d')&&typeof _0xd746df[_0xee68('0x2e')]===_0xee68('0x2d');var _0x5123cd=_0x23933a[_0xee68('0x2f')];var _0x587be4=_0x5a0817?0x0:_0xd746df['offset'];var _0x428655=_0x5a0817?_0x23933a[_0xee68('0x2f')]:_0xd746df[_0xee68('0x2c')]+_0xd746df[_0xee68('0x2e')];var _0x55a463;if(_0x428655>=_0x5123cd){_0x428655=_0x5123cd;_0x55a463=0xc8;}else{_0x55a463=0xce;}_0x2c8c3b[_0xee68('0x2a')](_0x55a463);return _0x2c8c3b['set'](_0xee68('0x30'),_0x587be4+'-'+_0x428655+'/'+_0x5123cd)[_0xee68('0x2b')](_0x23933a);}return null;};}function patchUpdates(_0x4b07d9){return function(_0x5cd81b){try{jsonpatch[_0xee68('0x31')](_0x5cd81b,_0x4b07d9,!![]);}catch(_0x24bfc6){return BPromise['reject'](_0x24bfc6);}return _0x5cd81b[_0xee68('0x32')]();};}function saveUpdates(_0x35edb7,_0x4e4540){return function(_0x210148){if(_0x210148){return _0x210148[_0xee68('0x33')](_0x35edb7)['then'](function(_0x1733ec){return _0x1733ec;});}return null;};}function removeEntity(_0xfafbb6,_0x17c634){return function(_0x3d3de1){if(_0x3d3de1){return _0x3d3de1['destroy']()['then'](function(){var _0x1a41ff=_0x3d3de1[_0xee68('0x34')]({'plain':!![]});var _0xd6243d=_0xee68('0x35');return db[_0xee68('0x36')][_0xee68('0x37')]({'where':{'type':_0xd6243d,'resourceId':_0x1a41ff['id']}})[_0xee68('0x38')](function(){return _0x3d3de1;});})[_0xee68('0x38')](function(){_0xfafbb6['status'](0xcc)[_0xee68('0x39')]();});}};}function handleEntityNotFound(_0x5f5736,_0x2af34f){return function(_0xbedbd2){if(!_0xbedbd2){_0x5f5736[_0xee68('0x29')](0x194);}return _0xbedbd2;};}function handleError(_0x55d721,_0x3a6a89){_0x3a6a89=_0x3a6a89||0x1f4;return function(_0x36ff93){logger[_0xee68('0x24')](_0x36ff93['stack']);if(_0x36ff93[_0xee68('0x3a')]){delete _0x36ff93['name'];}_0x55d721[_0xee68('0x2a')](_0x3a6a89)[_0xee68('0x3b')](_0x36ff93);};}exports[_0xee68('0x3c')]=function(_0x4c4528,_0x591ef0){var _0x4c2a23={'include':[{'model':db[_0xee68('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2dbefa={},_0x58cdff={'count':0x0,'rows':[]};var _0x528795=_[_0xee68('0x3e')](db[_0xee68('0x3f')]['rawAttributes'],function(_0x37d57e){return{'name':_0x37d57e['fieldName'],'type':_0x37d57e[_0xee68('0x40')]['key']};});_0x2dbefa[_0xee68('0x41')]=_['map'](_0x528795,_0xee68('0x3a'));_0x2dbefa[_0xee68('0x42')]=_['keys'](_0x4c4528[_0xee68('0x42')]);_0x2dbefa[_0xee68('0x43')]=_[_0xee68('0x44')](_0x2dbefa['model'],_0x2dbefa[_0xee68('0x42')]);_0x4c2a23[_0xee68('0x45')]=_[_0xee68('0x44')](_0x2dbefa[_0xee68('0x41')],qs[_0xee68('0x46')](_0x4c4528[_0xee68('0x42')]['fields']));_0x4c2a23[_0xee68('0x45')]=_0x4c2a23[_0xee68('0x45')][_0xee68('0x47')]?_0x4c2a23['attributes']:_0x2dbefa[_0xee68('0x41')];if(!_0x4c4528[_0xee68('0x42')][_0xee68('0x48')](_0xee68('0x49'))){_0x4c2a23[_0xee68('0x2e')]=qs[_0xee68('0x2e')](_0x4c4528['query'][_0xee68('0x2e')]);_0x4c2a23['offset']=qs[_0xee68('0x2c')](_0x4c4528[_0xee68('0x42')]['offset']);}_0x4c2a23[_0xee68('0x4a')]=qs[_0xee68('0x4b')](_0x4c4528[_0xee68('0x42')][_0xee68('0x4b')]);_0x4c2a23[_0xee68('0x4c')]=qs['filters'](_[_0xee68('0x4d')](_0x4c4528[_0xee68('0x42')],_0x2dbefa[_0xee68('0x43')]),_0x528795);if(_0x4c4528[_0xee68('0x42')][_0xee68('0x4e')]){_0x4c2a23[_0xee68('0x4c')]=_['merge'](_0x4c2a23[_0xee68('0x4c')],{'$or':_['map'](_0x528795,function(_0x5d93f4){if(_0x5d93f4[_0xee68('0x40')]!==_0xee68('0x4f')){var _0x34a4ab={};_0x34a4ab[_0x5d93f4[_0xee68('0x3a')]]={'$like':'%'+_0x4c4528['query']['filter']+'%'};return _0x34a4ab;}})});}_0x4c2a23=_['merge']({},_0x4c2a23,_0x4c4528[_0xee68('0x50')]);var _0x41906b={'where':_0x4c2a23[_0xee68('0x4c')]};return db['OpenchannelAccount'][_0xee68('0x2f')](_0x41906b)[_0xee68('0x38')](function(_0x2ce4da){_0x58cdff[_0xee68('0x2f')]=_0x2ce4da;if(_0x4c4528['query']['includeAll']){_0x4c2a23['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0xee68('0x51')](_0x4c2a23);})['then'](function(_0x521716){_0x58cdff[_0xee68('0x52')]=_0x521716;return _0x58cdff;})[_0xee68('0x38')](respondWithFilteredResult(_0x591ef0,_0x4c2a23))[_0xee68('0x28')](handleError(_0x591ef0,null));};exports[_0xee68('0x53')]=function(_0x6a00c3,_0x138b45){var _0x2ad7c8={'raw':![],'where':{'id':_0x6a00c3['params']['id']},'include':[{'model':db[_0xee68('0x3d')],'as':_0xee68('0x54')}]},_0x5c0f58={};_0x5c0f58[_0xee68('0x41')]=_[_0xee68('0x55')](db[_0xee68('0x3f')]['rawAttributes']);_0x5c0f58[_0xee68('0x42')]=_['keys'](_0x6a00c3[_0xee68('0x42')]);_0x5c0f58[_0xee68('0x43')]=_['intersection'](_0x5c0f58[_0xee68('0x41')],_0x5c0f58[_0xee68('0x42')]);_0x2ad7c8[_0xee68('0x45')]=_[_0xee68('0x44')](_0x5c0f58[_0xee68('0x41')],qs['fields'](_0x6a00c3['query'][_0xee68('0x46')]));_0x2ad7c8['attributes']=_0x2ad7c8[_0xee68('0x45')][_0xee68('0x47')]?_0x2ad7c8[_0xee68('0x45')]:_0x5c0f58[_0xee68('0x41')];if(_0x6a00c3[_0xee68('0x42')]['includeAll']){_0x2ad7c8[_0xee68('0x56')]=[{'all':!![]}];}_0x2ad7c8=_[_0xee68('0x57')]({},_0x2ad7c8,_0x6a00c3[_0xee68('0x50')]);return db[_0xee68('0x3f')]['find'](_0x2ad7c8)['then'](handleEntityNotFound(_0x138b45,null))[_0xee68('0x38')](respondWithResult(_0x138b45,null))[_0xee68('0x28')](handleError(_0x138b45,null));};exports[_0xee68('0x58')]=function(_0x472fcc,_0x371d88){return db[_0xee68('0x3f')][_0xee68('0x58')](_0x472fcc[_0xee68('0x59')],{})['then'](function(_0x4bcc5c){var _0xc6c120=_0x472fcc[_0xee68('0x5a')][_0xee68('0x34')]({'plain':!![]});if(!_0xc6c120)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc6c120[_0xee68('0x5b')]===_0xee68('0x5a')){var _0x473e98=_0x4bcc5c[_0xee68('0x34')]({'plain':!![]});var _0x237114=_0xee68('0x35');return db[_0xee68('0x5c')]['find']({'where':{'name':_0x237114,'userProfileId':_0xc6c120[_0xee68('0x5d')]},'raw':!![]})[_0xee68('0x38')](function(_0x9b4e18){if(_0x9b4e18&&_0x9b4e18[_0xee68('0x5e')]===0x0){return db[_0xee68('0x36')][_0xee68('0x58')]({'name':_0x473e98[_0xee68('0x3a')],'resourceId':_0x473e98['id'],'type':_0x9b4e18[_0xee68('0x3a')],'sectionId':_0x9b4e18['id']},{})['then'](function(){return _0x4bcc5c;});}else{return _0x4bcc5c;}})[_0xee68('0x28')](function(_0x4f6c59){logger[_0xee68('0x24')](_0xee68('0x5f'),_0x4f6c59);throw _0x4f6c59;});}return _0x4bcc5c;})[_0xee68('0x38')](respondWithResult(_0x371d88,0xc9))[_0xee68('0x28')](handleError(_0x371d88,null));};exports[_0xee68('0x33')]=function(_0x40e7f9,_0x273470){if(_0x40e7f9[_0xee68('0x59')]['id']){delete _0x40e7f9['body']['id'];}return db['OpenchannelAccount'][_0xee68('0x60')]({'where':{'id':_0x40e7f9[_0xee68('0x61')]['id']},'include':[{'model':db[_0xee68('0x3d')],'as':_0xee68('0x54')}]})['then'](handleEntityNotFound(_0x273470,null))[_0xee68('0x38')](saveUpdates(_0x40e7f9[_0xee68('0x59')],null))[_0xee68('0x38')](respondWithResult(_0x273470,null))[_0xee68('0x28')](handleError(_0x273470,null));};exports[_0xee68('0x37')]=function(_0xc844b6,_0x4e3cbe){return db[_0xee68('0x3f')][_0xee68('0x60')]({'where':{'id':_0xc844b6['params']['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x4e3cbe,null))[_0xee68('0x38')](removeEntity(_0x4e3cbe,null))[_0xee68('0x28')](handleError(_0x4e3cbe,null));};exports['describe']=function(_0xe836a6,_0x9e94a){return db[_0xee68('0x3f')]['describe']()[_0xee68('0x38')](respondWithResult(_0x9e94a,null))['catch'](handleError(_0x9e94a,null));};exports[_0xee68('0x62')]=function(_0x23fd28,_0x113640,_0x44de28){if(_0x23fd28[_0xee68('0x59')]['id']){delete _0x23fd28[_0xee68('0x59')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x23fd28[_0xee68('0x61')]['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x113640,null))[_0xee68('0x38')](function(_0xbed152){if(_0xbed152){_0x23fd28['body'][_0xee68('0x63')]=_0xbed152['id'];return db[_0xee68('0x64')][_0xee68('0x58')](_0x23fd28['body']);}})[_0xee68('0x38')](respondWithResult(_0x113640,null))[_0xee68('0x28')](handleError(_0x113640,null));};exports[_0xee68('0x65')]=function(_0xc5ecc8,_0x3e0916,_0x226b6a){var _0x201b40={'raw':![],'where':{}};var _0x3c2f69={};var _0x3ded21={'count':0x0,'rows':[]};return db[_0xee68('0x3f')]['findOne']({'where':{'id':_0xc5ecc8['params']['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x3e0916,null))[_0xee68('0x38')](function(_0x37d7cf){if(_0x37d7cf){_0x3c2f69['model']=_[_0xee68('0x55')](db[_0xee68('0x64')]['rawAttributes']);_0x3c2f69[_0xee68('0x42')]=_[_0xee68('0x55')](_0xc5ecc8[_0xee68('0x42')]);_0x3c2f69['filters']=_[_0xee68('0x44')](_0x3c2f69[_0xee68('0x41')],_0x3c2f69[_0xee68('0x42')]);_0x201b40[_0xee68('0x45')]=_[_0xee68('0x44')](_0x3c2f69[_0xee68('0x41')],qs[_0xee68('0x46')](_0xc5ecc8['query'][_0xee68('0x46')]));_0x201b40[_0xee68('0x45')]=_0x201b40[_0xee68('0x45')][_0xee68('0x47')]?_0x201b40[_0xee68('0x45')]:_0x3c2f69[_0xee68('0x41')];if(!_0xc5ecc8[_0xee68('0x42')][_0xee68('0x48')]('nolimit')){_0x201b40[_0xee68('0x2e')]=qs[_0xee68('0x2e')](_0xc5ecc8['query']['limit']);_0x201b40['offset']=qs[_0xee68('0x2c')](_0xc5ecc8[_0xee68('0x42')][_0xee68('0x2c')]);}_0x201b40[_0xee68('0x4a')]=qs['sort'](_0xc5ecc8['query'][_0xee68('0x4b')]);_0x201b40['where']=qs[_0xee68('0x43')](_[_0xee68('0x4d')](_0xc5ecc8[_0xee68('0x42')],_0x3c2f69[_0xee68('0x43')]));_0x201b40[_0xee68('0x4c')][_0xee68('0x63')]=_0x37d7cf['id'];if(_0xc5ecc8['query'][_0xee68('0x4e')]){_0x201b40[_0xee68('0x4c')]=_[_0xee68('0x57')](_0x201b40['where'],{'$or':_['map'](_0x201b40[_0xee68('0x45')],function(_0x88ed1b){var _0x26ce5a={};_0x26ce5a[_0x88ed1b]={'$like':'%'+_0xc5ecc8[_0xee68('0x42')][_0xee68('0x4e')]+'%'};return _0x26ce5a;})});}_0x201b40=_[_0xee68('0x57')]({},_0x201b40,_0xc5ecc8[_0xee68('0x50')]);return db[_0xee68('0x64')][_0xee68('0x2f')]({'where':_0x201b40['where']})[_0xee68('0x38')](function(_0x4a229a){_0x3ded21[_0xee68('0x2f')]=_0x4a229a;if(_0xc5ecc8[_0xee68('0x42')][_0xee68('0x66')]){_0x201b40[_0xee68('0x56')]=[{'all':!![]}];}return db[_0xee68('0x64')][_0xee68('0x51')](_0x201b40);})['then'](function(_0x4e7001){_0x3ded21[_0xee68('0x52')]=_0x4e7001;return _0x3ded21;});}})[_0xee68('0x38')](respondWithFilteredResult(_0x3e0916,_0x201b40))[_0xee68('0x28')](handleError(_0x3e0916,null));};exports['removeDispositions']=function(_0x5b210b,_0x332592,_0x4eec6c){return db[_0xee68('0x3f')]['find']({'where':{'id':_0x5b210b[_0xee68('0x61')]['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x332592,null))[_0xee68('0x38')](function(_0x39fd4a){if(_0x39fd4a){return _0x39fd4a[_0xee68('0x67')](_0x5b210b[_0xee68('0x42')]['ids']);}})[_0xee68('0x38')](respondWithStatusCode(_0x332592,null))[_0xee68('0x28')](handleError(_0x332592,null));};exports[_0xee68('0x68')]=function(_0xe52f4b,_0x17b0c5,_0x29b0d8){if(_0xe52f4b[_0xee68('0x59')]['id']){delete _0xe52f4b['body']['id'];}return db[_0xee68('0x3f')]['find']({'where':{'id':_0xe52f4b[_0xee68('0x61')]['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x17b0c5,null))[_0xee68('0x38')](function(_0x38a7c7){if(_0x38a7c7){_0xe52f4b[_0xee68('0x59')][_0xee68('0x63')]=_0x38a7c7['id'];return db['CannedAnswer'][_0xee68('0x58')](_0xe52f4b[_0xee68('0x59')]);}})[_0xee68('0x38')](respondWithResult(_0x17b0c5,null))[_0xee68('0x28')](handleError(_0x17b0c5,null));};exports[_0xee68('0x69')]=function(_0x5cc98f,_0x1bee8b,_0x4679a2){var _0x1b0910={'raw':![],'where':{}};var _0x2986de={};var _0x34f03d={'count':0x0,'rows':[]};return db[_0xee68('0x3f')][_0xee68('0x6a')]({'where':{'id':_0x5cc98f[_0xee68('0x61')]['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x1bee8b,null))[_0xee68('0x38')](function(_0x29285a){if(_0x29285a){_0x2986de[_0xee68('0x41')]=_['keys'](db[_0xee68('0x6b')][_0xee68('0x6c')]);_0x2986de[_0xee68('0x42')]=_[_0xee68('0x55')](_0x5cc98f[_0xee68('0x42')]);_0x2986de['filters']=_[_0xee68('0x44')](_0x2986de[_0xee68('0x41')],_0x2986de[_0xee68('0x42')]);_0x1b0910['attributes']=_[_0xee68('0x44')](_0x2986de[_0xee68('0x41')],qs[_0xee68('0x46')](_0x5cc98f[_0xee68('0x42')][_0xee68('0x46')]));_0x1b0910[_0xee68('0x45')]=_0x1b0910[_0xee68('0x45')][_0xee68('0x47')]?_0x1b0910[_0xee68('0x45')]:_0x2986de[_0xee68('0x41')];if(!_0x5cc98f['query'][_0xee68('0x48')]('nolimit')){_0x1b0910[_0xee68('0x2e')]=qs[_0xee68('0x2e')](_0x5cc98f['query'][_0xee68('0x2e')]);_0x1b0910[_0xee68('0x2c')]=qs['offset'](_0x5cc98f['query'][_0xee68('0x2c')]);}_0x1b0910[_0xee68('0x4a')]=qs[_0xee68('0x4b')](_0x5cc98f[_0xee68('0x42')][_0xee68('0x4b')]);_0x1b0910['where']=qs[_0xee68('0x43')](_[_0xee68('0x4d')](_0x5cc98f[_0xee68('0x42')],_0x2986de['filters']));_0x1b0910['where'][_0xee68('0x63')]=_0x29285a['id'];if(_0x5cc98f[_0xee68('0x42')][_0xee68('0x4e')]){_0x1b0910[_0xee68('0x4c')]=_[_0xee68('0x57')](_0x1b0910[_0xee68('0x4c')],{'$or':_['map'](_0x1b0910[_0xee68('0x45')],function(_0x26900b){var _0x12416f={};_0x12416f[_0x26900b]={'$like':'%'+_0x5cc98f['query'][_0xee68('0x4e')]+'%'};return _0x12416f;})});}_0x1b0910=_[_0xee68('0x57')]({},_0x1b0910,_0x5cc98f[_0xee68('0x50')]);return db[_0xee68('0x6b')][_0xee68('0x2f')]({'where':_0x1b0910[_0xee68('0x4c')]})[_0xee68('0x38')](function(_0x5a11fd){_0x34f03d[_0xee68('0x2f')]=_0x5a11fd;if(_0x5cc98f[_0xee68('0x42')][_0xee68('0x66')]){_0x1b0910[_0xee68('0x56')]=[{'all':!![]}];}return db[_0xee68('0x6b')][_0xee68('0x51')](_0x1b0910);})[_0xee68('0x38')](function(_0x137fcb){_0x34f03d[_0xee68('0x52')]=_0x137fcb;return _0x34f03d;});}})['then'](respondWithFilteredResult(_0x1bee8b,_0x1b0910))[_0xee68('0x28')](handleError(_0x1bee8b,null));};exports[_0xee68('0x6d')]=function(_0x5a0806,_0x1ec2a2,_0x42623c){return db[_0xee68('0x3f')][_0xee68('0x60')]({'where':{'id':_0x5a0806['params']['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x1ec2a2,null))[_0xee68('0x38')](function(_0x3e1ee3){if(_0x3e1ee3){return _0x3e1ee3[_0xee68('0x6d')](_0x5a0806[_0xee68('0x42')][_0xee68('0x6e')]);}})['then'](respondWithStatusCode(_0x1ec2a2,null))[_0xee68('0x28')](handleError(_0x1ec2a2,null));};exports[_0xee68('0x6f')]=function(_0x41107a,_0x5f0b7c,_0x59c05a){var _0x4ebeb2={'body':_0x41107a['body'],'channel':'openchannel'};var _0x528745=[];var _0x675b20=[];var _0x2cbd67={};var _0x2989e9=![];return db[_0xee68('0x70')]['describe']()[_0xee68('0x38')](function(_0x3250b8){if(!_0x3250b8){throw new db[(_0xee68('0x71'))][(_0xee68('0x72'))]('no\x20available\x20attributes');}_0x528745=_[_0xee68('0x73')](_[_0xee68('0x55')](_0x3250b8),[_0xee68('0x74'),_0xee68('0x75')]);_0x675b20=_['difference'](_[_0xee68('0x55')](_0x3250b8),[_0xee68('0x74'),_0xee68('0x75'),_0xee68('0x76'),_0xee68('0x77')]);if(_0x41107a[_0xee68('0x59')]['id']){delete _0x41107a[_0xee68('0x59')]['id'];}if(_[_0xee68('0x78')](_0x41107a['body'][_0xee68('0x79')])){throw new db[(_0xee68('0x71'))][(_0xee68('0x72'))](_0xee68('0x7a'));}if(_['isNil'](_0x41107a['body'][_0xee68('0x59')])||_0x41107a['body']['body']===''){throw new db[(_0xee68('0x71'))][(_0xee68('0x72'))](_0xee68('0x7b'));}if(_[_0xee68('0x78')](_0x41107a['body'][_0xee68('0x7c')])){throw new db[(_0xee68('0x71'))]['ValidationError'](_0xee68('0x7d')+_0x675b20);}if(!_[_0xee68('0x7e')](_0x675b20,_0x41107a['body'][_0xee68('0x7c')])){throw new db[(_0xee68('0x71'))][(_0xee68('0x72'))](_0xee68('0x7f')+_0x675b20);}_0x2cbd67[_0x41107a['body'][_0xee68('0x7c')]]=_0x41107a['body'][_0xee68('0x79')];})[_0xee68('0x38')](function(){return db[_0xee68('0x3f')][_0xee68('0x60')]({'where':{'id':_0x41107a[_0xee68('0x61')]['id']},'include':[{'model':db[_0xee68('0x80')],'as':'List','include':[{'model':db[_0xee68('0x70')],'as':_0xee68('0x81'),'where':_0x2cbd67,'limit':0x1,'order':[[_0xee68('0x75'),_0xee68('0x82')]]}]},{'model':db[_0xee68('0x83')],'as':'Applications'}]});})[_0xee68('0x38')](handleEntityNotFound(_0x5f0b7c,null))[_0xee68('0x38')](function(_0x50c2e4){if(_0x50c2e4&&_0x50c2e4[_0xee68('0x84')]){_0x4ebeb2[_0xee68('0x85')]=_0x50c2e4;_0x4ebeb2[_0xee68('0x86')]=_0x50c2e4[_0xee68('0x87')];_0x4ebeb2[_0xee68('0x88')]=_0x50c2e4[_0xee68('0x84')];_0x4ebeb2[_0xee68('0x86')]=_['orderBy'](_0x4ebeb2[_0xee68('0x86')],[_0xee68('0x89')],[_0xee68('0x8a')]);if(_0x4ebeb2[_0xee68('0x85')]['Applications']){delete _0x4ebeb2['account']['Applications'];}if(_0x4ebeb2[_0xee68('0x85')][_0xee68('0x84')]&&_0x4ebeb2[_0xee68('0x85')]['List'][_0xee68('0x81')][_0xee68('0x47')]){return _0x4ebeb2[_0xee68('0x85')]['List'][_0xee68('0x81')][0x0];}var _0x56bb7f=_[_0xee68('0x15')](_0x41107a[_0xee68('0x59')],{'firstName':_0x41107a[_0xee68('0x59')][_0xee68('0x79')],'ListId':_0x50c2e4['ListId']});_0x56bb7f[_0x41107a[_0xee68('0x59')][_0xee68('0x7c')]]=_0x41107a[_0xee68('0x59')][_0xee68('0x79')];return db[_0xee68('0x70')]['create'](_0x56bb7f,{'fields':_0x528745,'raw':!![]});}})['then'](handleEntityNotFound(_0x5f0b7c,null))[_0xee68('0x38')](function(_0x3ee731){_0x4ebeb2[_0xee68('0x8b')]=_0x3ee731;if(_0x3ee731){var _0xa7c61a={'ContactId':_0x3ee731['id'],'OpenchannelAccountId':_0x41107a[_0xee68('0x61')]['id'],'from':(_0x3ee731[_0xee68('0x8c')]||'')+'\x20'+(_0x3ee731[_0xee68('0x8d')]||'')};var _0x5d860c={'OpenchannelAccountId':_0x41107a['params']['id'],'closed':![]};if(_0x41107a[_0xee68('0x59')][_0xee68('0x8e')]){_0x5d860c['threadId']=_0x41107a['body'][_0xee68('0x8e')];return db['OpenchannelInteraction'][_0xee68('0x60')]({'where':_0x5d860c})[_0xee68('0x38')](function(_0x489e0a){if(_0x489e0a){return[_0x489e0a,![]];}_0xa7c61a[_0xee68('0x8e')]=_0x41107a[_0xee68('0x59')][_0xee68('0x8e')];_0xa7c61a[_0xee68('0x8f')]=_0x41107a['body'][_0xee68('0x8f')];return db[_0xee68('0x90')][_0xee68('0x58')](_0xa7c61a)['then'](function(_0x3823ec){return[_0x3823ec,!![]];});});}else{_0x5d860c[_0xee68('0x8e')]=null;}_0x5d860c[_0xee68('0x91')]=_0x3ee731['id'];return db[_0xee68('0x90')]['find']({'where':_0x5d860c})[_0xee68('0x38')](function(_0x791f7a){if(_0x791f7a){return[_0x791f7a,![]];}return db['OpenchannelInteraction']['create'](_0xa7c61a)[_0xee68('0x38')](function(_0x9a3248){return[_0x9a3248,!![]];});});}})[_0xee68('0x92')](function(_0x27eb42,_0x1e12cb){if(_0x27eb42){_0x2989e9=_0x1e12cb;if(!_0x1e12cb){var _0x1b30f4={'from':(_0x4ebeb2['contact']['firstName']||'')+'\x20'+(_0x4ebeb2[_0xee68('0x8b')][_0xee68('0x8d')]||'')};if(_0x41107a[_0xee68('0x59')]['threadId']&&_0x41107a[_0xee68('0x59')]['messageId']&&_0x41107a[_0xee68('0x59')]['threadId']!=_0x41107a[_0xee68('0x59')][_0xee68('0x93')]){_0x1b30f4[_0xee68('0x8e')]=_0x41107a[_0xee68('0x59')][_0xee68('0x93')];}return _0x27eb42[_0xee68('0x33')](_0x1b30f4);}else{return _0x27eb42;}}})[_0xee68('0x38')](function(_0x4d4027){_0x4ebeb2[_0xee68('0x94')]=_0x4d4027['get']({'plain':!![]});_0x4ebeb2['interaction'][_0xee68('0x95')]=_0x2989e9;if(_0x4ebeb2[_0xee68('0x94')][_0xee68('0x95')]){if(_0x4ebeb2[_0xee68('0x85')][_0xee68('0x96')]){_0x4ebeb2[_0xee68('0x86')][_0xee68('0x97')]({'id':0x0,'priority':_0x4ebeb2['applications']['length']+0x1,'app':'close','appdata':_0xee68('0x98'),'interval':_0xee68('0x99')});}}return db[_0xee68('0x9a')]['create']({'body':_0x41107a[_0xee68('0x59')][_0xee68('0x59')],'OpenchannelAccountId':_0x41107a[_0xee68('0x61')]['id'],'OpenchannelInteractionId':_0x4d4027['id'],'direction':'in','ContactId':_0x4ebeb2[_0xee68('0x8b')]['id'],'AttachmentId':_0x41107a[_0xee68('0x59')]['AttachmentId']});})['then'](function(_0x185bed){_0x4ebeb2[_0xee68('0x26')]=_0x185bed;if(_0x4ebeb2[_0xee68('0x94')][_0xee68('0x9b')]){return db[_0xee68('0x9c')]['find']({'attributes':['id','name'],'where':{'id':_0x4ebeb2[_0xee68('0x94')][_0xee68('0x9b')]}})[_0xee68('0x38')](function(_0x295dfc){if(_0x295dfc){_0x4ebeb2[_0xee68('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0xee68('0x9d'),'appdata':_0x295dfc[_0xee68('0x3a')]+','+(_0x4ebeb2[_0xee68('0x85')][_0xee68('0x9e')]||0xa),'interval':'*,*,*,*'});_0x4ebeb2[_0xee68('0x9f')]=![];}return respondWithRpcPromise('Start',_0xee68('0xa0'),_0x4ebeb2);});}return respondWithRpcPromise(_0xee68('0xa1'),_0xee68('0xa0'),_0x4ebeb2);})[_0xee68('0x38')](function(_0x319dd0){respondWithRpcPromise(_0xee68('0xa2'),_0xee68('0xa2'),{'event':_0xee68('0x6f'),'message':_0x319dd0},client9002);return _0x319dd0;})[_0xee68('0x38')](respondWithResult(_0x5f0b7c,null))[_0xee68('0x28')](handleError(_0x5f0b7c,null));};exports['addApplications']=function(_0x6101df,_0x584b26,_0xe8d98e){return db[_0xee68('0x3f')][_0xee68('0x6a')]({'where':{'id':_0x6101df[_0xee68('0x61')]['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x584b26,null))[_0xee68('0x38')](function(_0x546120){if(_0x546120){return db[_0xee68('0xa3')]['transaction'](function(_0x49697b){return db[_0xee68('0x83')][_0xee68('0x37')]({'where':{'OpenchannelAccountId':_0x6101df[_0xee68('0x61')]['id']},'transaction':_0x49697b})['then'](function(_0x423b70){var _0x14759e=_['map'](_0x6101df[_0xee68('0x59')],function(_0x386e79){_0x386e79['OpenchannelAccountId']=_0x6101df['params']['id'];return _0x386e79;});return db[_0xee68('0x83')][_0xee68('0xa4')](_0x14759e,{'transaction':_0x49697b});});})[_0xee68('0x38')](function(){return db['OpenchannelApplication'][_0xee68('0xa5')]({'where':{'OpenchannelAccountId':_0x6101df[_0xee68('0x61')]['id']},'order':_0xee68('0x89')});});}})['then'](respondWithResult(_0x584b26,null))[_0xee68('0x28')](handleError(_0x584b26,null));};exports['getApplications']=function(_0x1ecf62,_0x1713df,_0x5232cf){var _0x24b5e4={};var _0x110a3b={};var _0x25f208;var _0x206b2c;return db['OpenchannelAccount'][_0xee68('0x6a')]({'where':{'id':_0x1ecf62[_0xee68('0x61')]['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x1713df,null))['then'](function(_0x5e47ec){if(_0x5e47ec){_0x25f208=_0x5e47ec;_0x110a3b[_0xee68('0x41')]=_['keys'](db[_0xee68('0x83')]['rawAttributes']);_0x110a3b[_0xee68('0x42')]=_[_0xee68('0x55')](_0x1ecf62['query']);_0x110a3b[_0xee68('0x43')]=_['intersection'](_0x110a3b[_0xee68('0x41')],_0x110a3b[_0xee68('0x42')]);_0x24b5e4[_0xee68('0x45')]=_['intersection'](_0x110a3b['model'],qs[_0xee68('0x46')](_0x1ecf62[_0xee68('0x42')][_0xee68('0x46')]));_0x24b5e4['attributes']=_0x24b5e4[_0xee68('0x45')][_0xee68('0x47')]?_0x24b5e4[_0xee68('0x45')]:_0x110a3b[_0xee68('0x41')];_0x24b5e4[_0xee68('0x4a')]=qs[_0xee68('0x4b')](_0x1ecf62[_0xee68('0x42')][_0xee68('0x4b')]);_0x24b5e4['where']=qs['filters'](_[_0xee68('0x4d')](_0x1ecf62[_0xee68('0x42')],_0x110a3b[_0xee68('0x43')]));if(_0x1ecf62[_0xee68('0x42')][_0xee68('0x4e')]){_0x24b5e4['where']=_[_0xee68('0x57')](_0x24b5e4[_0xee68('0x4c')],{'$or':_[_0xee68('0x3e')](_0x24b5e4['attributes'],function(_0x416f1f){var _0x33f24a={};_0x33f24a[_0x416f1f]={'$like':'%'+_0x1ecf62[_0xee68('0x42')][_0xee68('0x4e')]+'%'};return _0x33f24a;})});}_0x24b5e4=_[_0xee68('0x57')]({},_0x24b5e4,_0x1ecf62['options']);return _0x25f208[_0xee68('0xa6')](_0x24b5e4);}})[_0xee68('0x38')](function(_0x53972e){if(_0x53972e){_0x206b2c=_0x53972e[_0xee68('0x47')];if(!_0x1ecf62[_0xee68('0x42')]['hasOwnProperty'](_0xee68('0x49'))){_0x24b5e4[_0xee68('0x2e')]=qs[_0xee68('0x2e')](_0x1ecf62['query'][_0xee68('0x2e')]);_0x24b5e4[_0xee68('0x2c')]=qs[_0xee68('0x2c')](_0x1ecf62['query']['offset']);}return _0x25f208[_0xee68('0xa6')](_0x24b5e4);}})[_0xee68('0x38')](function(_0x4b1e1e){if(_0x4b1e1e){return _0x4b1e1e?{'count':_0x206b2c,'rows':_0x4b1e1e}:null;}})[_0xee68('0x38')](respondWithResult(_0x1713df,null))[_0xee68('0x28')](handleError(_0x1713df,null));};exports[_0xee68('0xa7')]=function(_0x321b9b,_0x4c21e2,_0x483e6b){var _0x419c88={'raw':![],'where':{}};var _0x720721={};var _0x282f3e={'count':0x0,'rows':[]};return db[_0xee68('0x3f')][_0xee68('0x6a')]({'where':{'id':_0x321b9b['params']['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x4c21e2,null))[_0xee68('0x38')](function(_0x1fd3f6){if(_0x1fd3f6){_0x720721[_0xee68('0x41')]=_[_0xee68('0x55')](db[_0xee68('0x90')][_0xee68('0x6c')]);_0x720721['query']=_['keys'](_0x321b9b[_0xee68('0x42')]);_0x720721['filters']=_[_0xee68('0x44')](_0x720721[_0xee68('0x41')],_0x720721[_0xee68('0x42')]);_0x419c88[_0xee68('0x45')]=_[_0xee68('0x44')](_0x720721['model'],qs[_0xee68('0x46')](_0x321b9b[_0xee68('0x42')][_0xee68('0x46')]));_0x419c88['attributes']=_0x419c88[_0xee68('0x45')][_0xee68('0x47')]?_0x419c88[_0xee68('0x45')]:_0x720721[_0xee68('0x41')];if(!_0x321b9b[_0xee68('0x42')]['hasOwnProperty'](_0xee68('0x49'))){_0x419c88[_0xee68('0x2e')]=qs[_0xee68('0x2e')](_0x321b9b[_0xee68('0x42')][_0xee68('0x2e')]);_0x419c88[_0xee68('0x2c')]=qs[_0xee68('0x2c')](_0x321b9b['query'][_0xee68('0x2c')]);}_0x419c88[_0xee68('0x4a')]=qs['sort'](_0x321b9b['query']['sort']);_0x419c88[_0xee68('0x4c')]=qs[_0xee68('0x43')](_[_0xee68('0x4d')](_0x321b9b[_0xee68('0x42')],_0x720721[_0xee68('0x43')]));_0x419c88['where'][_0xee68('0x63')]=_0x1fd3f6['id'];if(_0x321b9b[_0xee68('0x42')][_0xee68('0x4e')]){_0x419c88['where']=_[_0xee68('0x57')](_0x419c88[_0xee68('0x4c')],{'$or':_[_0xee68('0x3e')](_0x419c88[_0xee68('0x45')],function(_0xc8aa9c){var _0x3965ec={};_0x3965ec[_0xc8aa9c]={'$like':'%'+_0x321b9b[_0xee68('0x42')][_0xee68('0x4e')]+'%'};return _0x3965ec;})});}_0x419c88=_[_0xee68('0x57')]({},_0x419c88,_0x321b9b['options']);return db[_0xee68('0x90')][_0xee68('0x2f')]({'where':_0x419c88[_0xee68('0x4c')]})[_0xee68('0x38')](function(_0x5f489d){_0x282f3e[_0xee68('0x2f')]=_0x5f489d;if(_0x321b9b[_0xee68('0x42')][_0xee68('0x66')]){_0x419c88[_0xee68('0x56')]=[{'model':db[_0xee68('0x70')],'as':_0xee68('0xa8'),'required':![]},{'model':db[_0xee68('0x9c')],'as':_0xee68('0xa9'),'attributes':[_0xee68('0x3a'),_0xee68('0xaa'),'internal'],'required':![]},{'model':db[_0xee68('0xab')],'as':_0xee68('0xac'),'attributes':['id',_0xee68('0x3a'),_0xee68('0xad')],'where':_0x321b9b[_0xee68('0x42')]['tag']?{'id':_0x321b9b[_0xee68('0x42')][_0xee68('0xae')]}:undefined,'required':_0x321b9b[_0xee68('0x42')][_0xee68('0xae')]?!![]:![]}];}return db[_0xee68('0x90')][_0xee68('0x51')](_0x419c88);})[_0xee68('0x38')](function(_0x12bbb4){_0x282f3e['rows']=_0x12bbb4;return _0x282f3e;});}})[_0xee68('0x38')](respondWithFilteredResult(_0x4c21e2,_0x419c88))[_0xee68('0x28')](handleError(_0x4c21e2,null));};exports[_0xee68('0xaf')]=function(_0x493047,_0x53e379,_0x3e26f8){return db[_0xee68('0x3f')][_0xee68('0x60')]({'where':{'id':_0x493047[_0xee68('0x61')]['id']}})['then'](handleEntityNotFound(_0x53e379,null))[_0xee68('0x38')](function(_0x5502b1){if(_0x5502b1){return _0x5502b1[_0xee68('0xaf')](_0x493047[_0xee68('0x59')][_0xee68('0x6e')],_['omit'](_0x493047['body'],['ids','id'])||{})[_0xee68('0x92')](function(_0x12cd24){for(var _0x4f95c9=0x0;_0x4f95c9<_0x493047['body'][_0xee68('0x6e')]['length'];_0x4f95c9+=0x1){socket[_0xee68('0xb0')](_0xee68('0xb1'),{'UserId':Number(_0x493047['body'][_0xee68('0x6e')][_0x4f95c9]),'OpenchannelAccountId':Number(_0x493047[_0xee68('0x61')]['id'])});}return _0x12cd24;});}})[_0xee68('0x38')](respondWithResult(_0x53e379,null))[_0xee68('0x28')](handleError(_0x53e379,null));};exports['removeAgents']=function(_0x1084b1,_0x51b10c,_0x2ff666){return db['OpenchannelAccount'][_0xee68('0x60')]({'where':{'id':_0x1084b1[_0xee68('0x61')]['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x51b10c,null))[_0xee68('0x38')](function(_0x47c2d0){if(_0x47c2d0){return _0x47c2d0[_0xee68('0xb2')](_0x1084b1[_0xee68('0x42')][_0xee68('0x6e')])[_0xee68('0x38')](function(){if(_[_0xee68('0xb3')](_0x1084b1[_0xee68('0x42')][_0xee68('0x6e')])){for(var _0x52a1a7=0x0;_0x52a1a7<_0x1084b1['query'][_0xee68('0x6e')][_0xee68('0x47')];_0x52a1a7+=0x1){socket['emit'](_0xee68('0xb4'),{'UserId':Number(_0x1084b1['query'][_0xee68('0x6e')][_0x52a1a7]),'OpenchannelAccountId':Number(_0x1084b1[_0xee68('0x61')]['id'])});}}else{socket[_0xee68('0xb0')](_0xee68('0xb4'),{'UserId':Number(_0x1084b1[_0xee68('0x42')]['ids']),'OpenchannelAccountId':Number(_0x1084b1[_0xee68('0x61')]['id'])});}});}})[_0xee68('0x38')](respondWithStatusCode(_0x51b10c,null))[_0xee68('0x28')](handleError(_0x51b10c,null));};exports[_0xee68('0xb5')]=function(_0x57b842,_0x22d827,_0x2bc4b4){var _0xf30058={};var _0x19167c={};var _0x2bb1d7;var _0x372422;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x57b842[_0xee68('0x61')]['id']}})[_0xee68('0x38')](handleEntityNotFound(_0x22d827,null))[_0xee68('0x38')](function(_0x379bc7){if(_0x379bc7){_0x2bb1d7=_0x379bc7;_0x19167c[_0xee68('0x41')]=_[_0xee68('0x55')](db[_0xee68('0x9c')][_0xee68('0x6c')]);_0x19167c[_0xee68('0x42')]=_[_0xee68('0x55')](_0x57b842[_0xee68('0x42')]);_0x19167c[_0xee68('0x43')]=_['intersection'](_0x19167c[_0xee68('0x41')],_0x19167c[_0xee68('0x42')]);_0xf30058[_0xee68('0x45')]=_[_0xee68('0x44')](_0x19167c[_0xee68('0x41')],qs[_0xee68('0x46')](_0x57b842[_0xee68('0x42')][_0xee68('0x46')]));_0xf30058[_0xee68('0x45')]=_0xf30058[_0xee68('0x45')]['length']?_0xf30058[_0xee68('0x45')]:_0x19167c[_0xee68('0x41')];_0xf30058[_0xee68('0x4a')]=qs[_0xee68('0x4b')](_0x57b842[_0xee68('0x42')]['sort']);_0xf30058['where']=qs[_0xee68('0x43')](_[_0xee68('0x4d')](_0x57b842['query'],_0x19167c[_0xee68('0x43')]));if(_0x57b842['query'][_0xee68('0x4e')]){_0xf30058['where']=_[_0xee68('0x57')](_0xf30058[_0xee68('0x4c')],{'$or':_[_0xee68('0x3e')](_0xf30058['attributes'],function(_0x56efbf){var _0x5438d9={};_0x5438d9[_0x56efbf]={'$like':'%'+_0x57b842[_0xee68('0x42')][_0xee68('0x4e')]+'%'};return _0x5438d9;})});}_0xf30058=_[_0xee68('0x57')]({},_0xf30058,_0x57b842[_0xee68('0x50')]);return _0x2bb1d7[_0xee68('0xb5')](_0xf30058);}})[_0xee68('0x38')](function(_0x5acf47){if(_0x5acf47){_0x372422=_0x5acf47['length'];if(!_0x57b842[_0xee68('0x42')][_0xee68('0x48')](_0xee68('0x49'))){_0xf30058[_0xee68('0x2e')]=qs[_0xee68('0x2e')](_0x57b842['query']['limit']);_0xf30058[_0xee68('0x2c')]=qs[_0xee68('0x2c')](_0x57b842[_0xee68('0x42')][_0xee68('0x2c')]);}return _0x2bb1d7['getAgents'](_0xf30058);}})[_0xee68('0x38')](function(_0x271224){if(_0x271224){return _0x271224?{'count':_0x372422,'rows':_0x271224}:null;}})['then'](respondWithResult(_0x22d827,null))[_0xee68('0x28')](handleError(_0x22d827,null));};exports[_0xee68('0x3b')]=function(_0x450819,_0x497672,_0x7e75eb){var _0x5a7ed6,_0x57fd84,_0x5b6d1a;if(_[_0xee68('0x78')](_0x450819[_0xee68('0x59')][_0xee68('0x59')])||_0x450819[_0xee68('0x59')]['body']===''){throw new db['Sequelize'][(_0xee68('0x72'))](_0xee68('0x7b'));}if(_[_0xee68('0x78')](_0x450819['body']['to'])){}_0x5a7ed6=_0x450819[_0xee68('0x59')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x450819['params']['id']}})['then'](handleEntityNotFound(_0x497672,null))['then'](function(_0x2945dc){if(_0x2945dc){return db[_0xee68('0x3f')][_0xee68('0x60')]({'where':{'id':_0x2945dc['id']},'include':[{'model':db[_0xee68('0x80')],'as':_0xee68('0x84'),'include':[{'model':db['CmContact'],'as':_0xee68('0x81'),'where':{[_0x2945dc['mapKey']]:_0x5a7ed6},'limit':0x1,'order':[[_0xee68('0x75'),_0xee68('0x82')]]}]}]})[_0xee68('0x38')](handleEntityNotFound(_0x497672,null))[_0xee68('0x38')](function(_0x347176){if(_0x347176&&_0x347176[_0xee68('0x84')]){_0x57fd84=_0x347176[_0xee68('0x34')]({'plain':!![]});if(_0x57fd84['List']&&_0x57fd84[_0xee68('0x84')][_0xee68('0x81')][_0xee68('0x47')]){return _0x57fd84[_0xee68('0x84')][_0xee68('0x81')][0x0];}return db['CmContact']['create'](_['defaults'](_0x450819[_0xee68('0x59')],{'firstName':_0x5a7ed6,[_0x347176[_0xee68('0x7c')]]:_0x5a7ed6,'phone':_0x5a7ed6,'ListId':_0x57fd84['ListId']}));}})[_0xee68('0x38')](handleEntityNotFound(_0x497672,null))[_0xee68('0x38')](function(_0x25e7a8){if(_0x25e7a8){_0x5b6d1a=_0x25e7a8;return db[_0xee68('0x90')][_0xee68('0x60')]({'where':{'ContactId':_0x5b6d1a['id'],'closed':![],'OpenchannelAccountId':_0x57fd84['id']}})[_0xee68('0x38')](function(_0x1c2905){if(_0x1c2905){return[_0x1c2905,![]];}return db[_0xee68('0x90')][_0xee68('0x58')]({'UserId':_0x450819[_0xee68('0x5a')]['id'],'ContactId':_0x5b6d1a['id'],'OpenchannelAccountId':_0x57fd84['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x450819[_0xee68('0x59')],{'read':![],'body':_0x450819[_0xee68('0x59')][_0xee68('0x59')],'OpenchannelAccountId':_0x57fd84['id'],'UserId':_0x450819[_0xee68('0x5a')]['id'],'ContactId':_0x5b6d1a['id']})]},{'include':[{'model':db[_0xee68('0x9a')],'as':_0xee68('0xb6')}]})[_0xee68('0x38')](function(_0x4ece72){return[_0x4ece72,!![]];});});}})[_0xee68('0x92')](function(_0xb39445,_0xfd6221){if(_0xfd6221){return _0xb39445;}return db['OpenchannelMessage'][_0xee68('0x58')](_[_0xee68('0x57')](_0x450819[_0xee68('0x59')],{'read':![],'body':_0x450819['body']['body'],'OpenchannelAccountId':_0x57fd84['id'],'OpenchannelInteractionId':_0xb39445['id'],'UserId':_0x450819[_0xee68('0x5a')]['id'],'ContactId':_0x5b6d1a['id']}))[_0xee68('0x38')](function(_0x2d851a){_0xb39445['dataValues'][_0xee68('0xb6')]=[];_0xb39445['dataValues'][_0xee68('0xb6')][_0xee68('0x97')](_0x2d851a[_0xee68('0xb7')]);return _0xb39445;});});}})['then'](respondWithResult(_0x497672,null))[_0xee68('0x28')](handleError(_0x497672,null));}; \ No newline at end of file +var _0x96ce=['error','code','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','UserProfileResource','end','name','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','OpenchannelAccount','includeAll','include','rows','show','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','params','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','CmContact','Sequelize','ValidationError','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','push','close','unmanaged','OpenchannelMessage','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x17e6cd,_0x5976ec){var _0x3ad482=function(_0x1deca2){while(--_0x1deca2){_0x17e6cd['push'](_0x17e6cd['shift']());}};_0x3ad482(++_0x5976ec);}(_0x96ce,0x14b));var _0xe96c=function(_0x5c8b01,_0x1102c1){_0x5c8b01=_0x5c8b01-0x0;var _0x180b22=_0x96ce[_0x5c8b01];return _0x180b22;};'use strict';var emlformat=require(_0xe96c('0x0'));var rimraf=require(_0xe96c('0x1'));var zipdir=require(_0xe96c('0x2'));var jsonpatch=require(_0xe96c('0x3'));var rp=require(_0xe96c('0x4'));var moment=require(_0xe96c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe96c('0x6'));var path=require(_0xe96c('0x7'));var sox=require(_0xe96c('0x8'));var csv=require(_0xe96c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe96c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe96c('0xb'));var toCsv=require(_0xe96c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe96c('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe96c('0xd'));var as=require(_0xe96c('0xe'));var hardwareService=require(_0xe96c('0xf'));var logger=require(_0xe96c('0x10'))(_0xe96c('0x11'));var utils=require('../../config/utils');var config=require(_0xe96c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe96c('0x13'))['db'];config[_0xe96c('0x14')]=_[_0xe96c('0x15')](config['redis'],{'host':_0xe96c('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe96c('0x14')]));require(_0xe96c('0x17'))[_0xe96c('0x18')](socket);var jayson=require(_0xe96c('0x19'));var client=jayson[_0xe96c('0x1a')][_0xe96c('0x1b')]({'port':0x232c});var client9002=jayson[_0xe96c('0x1a')][_0xe96c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5b477d,_0x3c6c9a,_0xbb0a3f,_0x368ac5){return new BPromise(function(_0x3b22a3,_0x43b184){var _0x8e0f7b=_0x368ac5||client;return _0x8e0f7b[_0xe96c('0x1c')](_0x5b477d,_0xbb0a3f)[_0xe96c('0x1d')](function(_0x8ab000){logger['info'](_0xe96c('0x1e'),_0x3c6c9a,_0xe96c('0x1f'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3c6c9a,'request\x20sent',JSON[_0xe96c('0x20')](_0x8ab000));if(_0x8ab000[_0xe96c('0x21')]){if(_0x8ab000[_0xe96c('0x21')][_0xe96c('0x22')]===0x1f4){logger[_0xe96c('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c6c9a,_0x8ab000['error'][_0xe96c('0x23')]);return _0x43b184(_0x8ab000[_0xe96c('0x21')][_0xe96c('0x23')]);}logger['error'](_0xe96c('0x1e'),_0x3c6c9a,_0x8ab000[_0xe96c('0x21')][_0xe96c('0x23')]);return _0x3b22a3(_0x8ab000[_0xe96c('0x21')][_0xe96c('0x23')]);}else{logger[_0xe96c('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c6c9a,_0xe96c('0x1f'));_0x3b22a3(_0x8ab000[_0xe96c('0x25')][_0xe96c('0x23')]);}})[_0xe96c('0x26')](function(_0x3e2c00){logger[_0xe96c('0x21')](_0xe96c('0x1e'),_0x3c6c9a,_0x3e2c00);_0x43b184(_0x3e2c00);});});}function respondWithStatusCode(_0x1d0c9a,_0x4439ba){_0x4439ba=_0x4439ba||0xcc;return function(_0x9c1675){if(_0x9c1675){return _0x1d0c9a[_0xe96c('0x27')](_0x4439ba);}return _0x1d0c9a[_0xe96c('0x28')](_0x4439ba)['end']();};}function respondWithResult(_0xb420e3,_0x393b32){_0x393b32=_0x393b32||0xc8;return function(_0x307106){if(_0x307106){return _0xb420e3[_0xe96c('0x28')](_0x393b32)['json'](_0x307106);}};}function respondWithFilteredResult(_0x290e24,_0x41b17c){return function(_0x486570){if(_0x486570){var _0x2f7c55=typeof _0x41b17c[_0xe96c('0x29')]===_0xe96c('0x2a')&&typeof _0x41b17c[_0xe96c('0x2b')]===_0xe96c('0x2a');var _0xb656d8=_0x486570[_0xe96c('0x2c')];var _0xc7ac19=_0x2f7c55?0x0:_0x41b17c[_0xe96c('0x29')];var _0x55dd7d=_0x2f7c55?_0x486570[_0xe96c('0x2c')]:_0x41b17c[_0xe96c('0x29')]+_0x41b17c[_0xe96c('0x2b')];var _0x306e12;if(_0x55dd7d>=_0xb656d8){_0x55dd7d=_0xb656d8;_0x306e12=0xc8;}else{_0x306e12=0xce;}_0x290e24[_0xe96c('0x28')](_0x306e12);return _0x290e24[_0xe96c('0x2d')]('Content-Range',_0xc7ac19+'-'+_0x55dd7d+'/'+_0xb656d8)[_0xe96c('0x2e')](_0x486570);}return null;};}function patchUpdates(_0x3c789d){return function(_0x3f8237){try{jsonpatch[_0xe96c('0x2f')](_0x3f8237,_0x3c789d,!![]);}catch(_0x58702f){return BPromise[_0xe96c('0x30')](_0x58702f);}return _0x3f8237[_0xe96c('0x31')]();};}function saveUpdates(_0x372df4,_0x2dc3b4){return function(_0x432c48){if(_0x432c48){return _0x432c48[_0xe96c('0x32')](_0x372df4)[_0xe96c('0x1d')](function(_0x15e469){return _0x15e469;});}return null;};}function removeEntity(_0xef1743,_0x52bd29){return function(_0x242b91){if(_0x242b91){return _0x242b91[_0xe96c('0x33')]()[_0xe96c('0x1d')](function(){var _0x29f43f=_0x242b91['get']({'plain':!![]});var _0x30dff2='OpenchannelAccounts';return db[_0xe96c('0x34')][_0xe96c('0x33')]({'where':{'type':_0x30dff2,'resourceId':_0x29f43f['id']}})[_0xe96c('0x1d')](function(){return _0x242b91;});})[_0xe96c('0x1d')](function(){_0xef1743[_0xe96c('0x28')](0xcc)[_0xe96c('0x35')]();});}};}function handleEntityNotFound(_0x5efb0f,_0x4d1d6d){return function(_0x20a102){if(!_0x20a102){_0x5efb0f[_0xe96c('0x27')](0x194);}return _0x20a102;};}function handleError(_0x33b4f3,_0x1ce8c9){_0x1ce8c9=_0x1ce8c9||0x1f4;return function(_0xe08fa){logger[_0xe96c('0x21')](_0xe08fa['stack']);if(_0xe08fa[_0xe96c('0x36')]){delete _0xe08fa['name'];}_0x33b4f3[_0xe96c('0x28')](_0x1ce8c9)['send'](_0xe08fa);};}exports[_0xe96c('0x37')]=function(_0x447d79,_0x48a784){var _0x255a0f={'include':[{'model':db[_0xe96c('0x38')],'as':_0xe96c('0x39')}]},_0x18e008={},_0x1ff896={'count':0x0,'rows':[]};var _0x3e9e80=_['map'](db['OpenchannelAccount'][_0xe96c('0x3a')],function(_0x1cb9f3){return{'name':_0x1cb9f3[_0xe96c('0x3b')],'type':_0x1cb9f3[_0xe96c('0x3c')][_0xe96c('0x3d')]};});_0x18e008[_0xe96c('0x3e')]=_[_0xe96c('0x3f')](_0x3e9e80,'name');_0x18e008['query']=_[_0xe96c('0x40')](_0x447d79['query']);_0x18e008[_0xe96c('0x41')]=_['intersection'](_0x18e008[_0xe96c('0x3e')],_0x18e008[_0xe96c('0x42')]);_0x255a0f[_0xe96c('0x43')]=_[_0xe96c('0x44')](_0x18e008[_0xe96c('0x3e')],qs['fields'](_0x447d79['query'][_0xe96c('0x45')]));_0x255a0f[_0xe96c('0x43')]=_0x255a0f[_0xe96c('0x43')]['length']?_0x255a0f[_0xe96c('0x43')]:_0x18e008['model'];if(!_0x447d79[_0xe96c('0x42')][_0xe96c('0x46')](_0xe96c('0x47'))){_0x255a0f['limit']=qs[_0xe96c('0x2b')](_0x447d79['query'][_0xe96c('0x2b')]);_0x255a0f['offset']=qs['offset'](_0x447d79[_0xe96c('0x42')]['offset']);}_0x255a0f[_0xe96c('0x48')]=qs['sort'](_0x447d79['query'][_0xe96c('0x49')]);_0x255a0f[_0xe96c('0x4a')]=qs[_0xe96c('0x41')](_[_0xe96c('0x4b')](_0x447d79[_0xe96c('0x42')],_0x18e008['filters']),_0x3e9e80);if(_0x447d79[_0xe96c('0x42')][_0xe96c('0x4c')]){_0x255a0f['where']=_['merge'](_0x255a0f['where'],{'$or':_['map'](_0x3e9e80,function(_0x112606){if(_0x112606['type']!==_0xe96c('0x4d')){var _0x2aa085={};_0x2aa085[_0x112606[_0xe96c('0x36')]]={'$like':'%'+_0x447d79[_0xe96c('0x42')][_0xe96c('0x4c')]+'%'};return _0x2aa085;}})});}_0x255a0f=_[_0xe96c('0x4e')]({},_0x255a0f,_0x447d79['options']);var _0x1ed0a5={'where':_0x255a0f[_0xe96c('0x4a')]};return db[_0xe96c('0x4f')][_0xe96c('0x2c')](_0x1ed0a5)['then'](function(_0x3adb41){_0x1ff896[_0xe96c('0x2c')]=_0x3adb41;if(_0x447d79[_0xe96c('0x42')][_0xe96c('0x50')]){_0x255a0f[_0xe96c('0x51')]=[{'all':!![]}];}return db[_0xe96c('0x4f')]['findAll'](_0x255a0f);})[_0xe96c('0x1d')](function(_0x571424){_0x1ff896[_0xe96c('0x52')]=_0x571424;return _0x1ff896;})['then'](respondWithFilteredResult(_0x48a784,_0x255a0f))[_0xe96c('0x26')](handleError(_0x48a784,null));};exports[_0xe96c('0x53')]=function(_0x45b401,_0x11bb8c){var _0x540ebd={'raw':![],'where':{'id':_0x45b401['params']['id']},'include':[{'model':db[_0xe96c('0x38')],'as':_0xe96c('0x39')}]},_0x36f354={};_0x36f354[_0xe96c('0x3e')]=_[_0xe96c('0x40')](db['OpenchannelAccount'][_0xe96c('0x3a')]);_0x36f354[_0xe96c('0x42')]=_[_0xe96c('0x40')](_0x45b401[_0xe96c('0x42')]);_0x36f354[_0xe96c('0x41')]=_[_0xe96c('0x44')](_0x36f354[_0xe96c('0x3e')],_0x36f354[_0xe96c('0x42')]);_0x540ebd[_0xe96c('0x43')]=_[_0xe96c('0x44')](_0x36f354[_0xe96c('0x3e')],qs['fields'](_0x45b401[_0xe96c('0x42')][_0xe96c('0x45')]));_0x540ebd['attributes']=_0x540ebd[_0xe96c('0x43')][_0xe96c('0x54')]?_0x540ebd[_0xe96c('0x43')]:_0x36f354[_0xe96c('0x3e')];if(_0x45b401['query']['includeAll']){_0x540ebd['include']=[{'all':!![]}];}_0x540ebd=_[_0xe96c('0x4e')]({},_0x540ebd,_0x45b401[_0xe96c('0x55')]);return db[_0xe96c('0x4f')][_0xe96c('0x56')](_0x540ebd)[_0xe96c('0x1d')](handleEntityNotFound(_0x11bb8c,null))['then'](respondWithResult(_0x11bb8c,null))[_0xe96c('0x26')](handleError(_0x11bb8c,null));};exports[_0xe96c('0x57')]=function(_0x4d01b2,_0x7bede9){return db[_0xe96c('0x4f')][_0xe96c('0x57')](_0x4d01b2[_0xe96c('0x58')],{})[_0xe96c('0x1d')](function(_0x3e885d){var _0x1fe4f2=_0x4d01b2[_0xe96c('0x59')][_0xe96c('0x5a')]({'plain':!![]});if(!_0x1fe4f2)throw new Error(_0xe96c('0x5b'));if(_0x1fe4f2[_0xe96c('0x5c')]===_0xe96c('0x59')){var _0x4c212c=_0x3e885d[_0xe96c('0x5a')]({'plain':!![]});var _0x402805=_0xe96c('0x5d');return db[_0xe96c('0x5e')][_0xe96c('0x56')]({'where':{'name':_0x402805,'userProfileId':_0x1fe4f2['userProfileId']},'raw':!![]})[_0xe96c('0x1d')](function(_0x3f64b6){if(_0x3f64b6&&_0x3f64b6[_0xe96c('0x5f')]===0x0){return db[_0xe96c('0x34')][_0xe96c('0x57')]({'name':_0x4c212c['name'],'resourceId':_0x4c212c['id'],'type':_0x3f64b6[_0xe96c('0x36')],'sectionId':_0x3f64b6['id']},{})[_0xe96c('0x1d')](function(){return _0x3e885d;});}else{return _0x3e885d;}})['catch'](function(_0x288505){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x288505);throw _0x288505;});}return _0x3e885d;})[_0xe96c('0x1d')](respondWithResult(_0x7bede9,0xc9))[_0xe96c('0x26')](handleError(_0x7bede9,null));};exports['update']=function(_0x4aaf25,_0xe9d4cd){if(_0x4aaf25[_0xe96c('0x58')]['id']){delete _0x4aaf25[_0xe96c('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x4aaf25[_0xe96c('0x60')]['id']},'include':[{'model':db[_0xe96c('0x38')],'as':_0xe96c('0x39')}]})[_0xe96c('0x1d')](handleEntityNotFound(_0xe9d4cd,null))[_0xe96c('0x1d')](saveUpdates(_0x4aaf25[_0xe96c('0x58')],null))[_0xe96c('0x1d')](respondWithResult(_0xe9d4cd,null))[_0xe96c('0x26')](handleError(_0xe9d4cd,null));};exports['destroy']=function(_0x1db810,_0x281946){return db['OpenchannelAccount']['find']({'where':{'id':_0x1db810[_0xe96c('0x60')]['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x281946,null))[_0xe96c('0x1d')](removeEntity(_0x281946,null))[_0xe96c('0x26')](handleError(_0x281946,null));};exports[_0xe96c('0x61')]=function(_0xb0bf2a,_0x44da93){return db[_0xe96c('0x4f')][_0xe96c('0x61')]()[_0xe96c('0x1d')](respondWithResult(_0x44da93,null))[_0xe96c('0x26')](handleError(_0x44da93,null));};exports[_0xe96c('0x62')]=function(_0x13deac,_0x4460e6,_0x3bf984){if(_0x13deac[_0xe96c('0x58')]['id']){delete _0x13deac[_0xe96c('0x58')]['id'];}return db[_0xe96c('0x4f')][_0xe96c('0x56')]({'where':{'id':_0x13deac['params']['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x4460e6,null))[_0xe96c('0x1d')](function(_0x1670a3){if(_0x1670a3){_0x13deac[_0xe96c('0x58')][_0xe96c('0x63')]=_0x1670a3['id'];return db['Disposition']['create'](_0x13deac[_0xe96c('0x58')]);}})[_0xe96c('0x1d')](respondWithResult(_0x4460e6,null))[_0xe96c('0x26')](handleError(_0x4460e6,null));};exports[_0xe96c('0x64')]=function(_0x2a231f,_0x1cf188,_0x4f0bf6){var _0x263b6a={'raw':![],'where':{}};var _0x55c694={};var _0x4b2905={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe96c('0x65')]({'where':{'id':_0x2a231f['params']['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x1cf188,null))[_0xe96c('0x1d')](function(_0xd48aaf){if(_0xd48aaf){_0x55c694[_0xe96c('0x3e')]=_[_0xe96c('0x40')](db['Disposition']['rawAttributes']);_0x55c694[_0xe96c('0x42')]=_[_0xe96c('0x40')](_0x2a231f[_0xe96c('0x42')]);_0x55c694[_0xe96c('0x41')]=_['intersection'](_0x55c694[_0xe96c('0x3e')],_0x55c694[_0xe96c('0x42')]);_0x263b6a[_0xe96c('0x43')]=_[_0xe96c('0x44')](_0x55c694[_0xe96c('0x3e')],qs[_0xe96c('0x45')](_0x2a231f[_0xe96c('0x42')][_0xe96c('0x45')]));_0x263b6a[_0xe96c('0x43')]=_0x263b6a[_0xe96c('0x43')][_0xe96c('0x54')]?_0x263b6a['attributes']:_0x55c694[_0xe96c('0x3e')];if(!_0x2a231f['query'][_0xe96c('0x46')](_0xe96c('0x47'))){_0x263b6a[_0xe96c('0x2b')]=qs['limit'](_0x2a231f['query'][_0xe96c('0x2b')]);_0x263b6a[_0xe96c('0x29')]=qs[_0xe96c('0x29')](_0x2a231f[_0xe96c('0x42')][_0xe96c('0x29')]);}_0x263b6a[_0xe96c('0x48')]=qs[_0xe96c('0x49')](_0x2a231f['query']['sort']);_0x263b6a[_0xe96c('0x4a')]=qs[_0xe96c('0x41')](_['pick'](_0x2a231f[_0xe96c('0x42')],_0x55c694[_0xe96c('0x41')]));_0x263b6a[_0xe96c('0x4a')][_0xe96c('0x63')]=_0xd48aaf['id'];if(_0x2a231f[_0xe96c('0x42')][_0xe96c('0x4c')]){_0x263b6a[_0xe96c('0x4a')]=_[_0xe96c('0x4e')](_0x263b6a[_0xe96c('0x4a')],{'$or':_[_0xe96c('0x3f')](_0x263b6a[_0xe96c('0x43')],function(_0x4c744e){var _0x10d372={};_0x10d372[_0x4c744e]={'$like':'%'+_0x2a231f[_0xe96c('0x42')][_0xe96c('0x4c')]+'%'};return _0x10d372;})});}_0x263b6a=_[_0xe96c('0x4e')]({},_0x263b6a,_0x2a231f[_0xe96c('0x55')]);return db[_0xe96c('0x66')][_0xe96c('0x2c')]({'where':_0x263b6a[_0xe96c('0x4a')]})['then'](function(_0x1ec8e9){_0x4b2905[_0xe96c('0x2c')]=_0x1ec8e9;if(_0x2a231f[_0xe96c('0x42')][_0xe96c('0x50')]){_0x263b6a['include']=[{'all':!![]}];}return db[_0xe96c('0x66')][_0xe96c('0x67')](_0x263b6a);})[_0xe96c('0x1d')](function(_0x12c5fc){_0x4b2905[_0xe96c('0x52')]=_0x12c5fc;return _0x4b2905;});}})[_0xe96c('0x1d')](respondWithFilteredResult(_0x1cf188,_0x263b6a))[_0xe96c('0x26')](handleError(_0x1cf188,null));};exports[_0xe96c('0x68')]=function(_0x5a0537,_0x1d4660,_0x2025d4){return db[_0xe96c('0x4f')][_0xe96c('0x56')]({'where':{'id':_0x5a0537[_0xe96c('0x60')]['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x1d4660,null))[_0xe96c('0x1d')](function(_0x20e3aa){if(_0x20e3aa){return _0x20e3aa[_0xe96c('0x68')](_0x5a0537['query']['ids']);}})[_0xe96c('0x1d')](respondWithStatusCode(_0x1d4660,null))['catch'](handleError(_0x1d4660,null));};exports[_0xe96c('0x69')]=function(_0x11a643,_0x349203,_0x802881){if(_0x11a643[_0xe96c('0x58')]['id']){delete _0x11a643[_0xe96c('0x58')]['id'];}return db[_0xe96c('0x4f')]['find']({'where':{'id':_0x11a643[_0xe96c('0x60')]['id']}})['then'](handleEntityNotFound(_0x349203,null))[_0xe96c('0x1d')](function(_0x572b09){if(_0x572b09){_0x11a643[_0xe96c('0x58')][_0xe96c('0x63')]=_0x572b09['id'];return db[_0xe96c('0x6a')][_0xe96c('0x57')](_0x11a643['body']);}})['then'](respondWithResult(_0x349203,null))[_0xe96c('0x26')](handleError(_0x349203,null));};exports[_0xe96c('0x6b')]=function(_0x5506b0,_0xe1c76e,_0x291e5e){var _0x3ce053={'raw':![],'where':{}};var _0x211bfa={};var _0x51c29b={'count':0x0,'rows':[]};return db[_0xe96c('0x4f')]['findOne']({'where':{'id':_0x5506b0[_0xe96c('0x60')]['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0xe1c76e,null))[_0xe96c('0x1d')](function(_0x338c47){if(_0x338c47){_0x211bfa[_0xe96c('0x3e')]=_[_0xe96c('0x40')](db['CannedAnswer'][_0xe96c('0x3a')]);_0x211bfa[_0xe96c('0x42')]=_[_0xe96c('0x40')](_0x5506b0[_0xe96c('0x42')]);_0x211bfa[_0xe96c('0x41')]=_['intersection'](_0x211bfa[_0xe96c('0x3e')],_0x211bfa['query']);_0x3ce053[_0xe96c('0x43')]=_[_0xe96c('0x44')](_0x211bfa[_0xe96c('0x3e')],qs[_0xe96c('0x45')](_0x5506b0[_0xe96c('0x42')][_0xe96c('0x45')]));_0x3ce053[_0xe96c('0x43')]=_0x3ce053[_0xe96c('0x43')]['length']?_0x3ce053['attributes']:_0x211bfa['model'];if(!_0x5506b0[_0xe96c('0x42')][_0xe96c('0x46')](_0xe96c('0x47'))){_0x3ce053[_0xe96c('0x2b')]=qs[_0xe96c('0x2b')](_0x5506b0[_0xe96c('0x42')][_0xe96c('0x2b')]);_0x3ce053[_0xe96c('0x29')]=qs[_0xe96c('0x29')](_0x5506b0[_0xe96c('0x42')]['offset']);}_0x3ce053[_0xe96c('0x48')]=qs[_0xe96c('0x49')](_0x5506b0[_0xe96c('0x42')][_0xe96c('0x49')]);_0x3ce053[_0xe96c('0x4a')]=qs['filters'](_[_0xe96c('0x4b')](_0x5506b0[_0xe96c('0x42')],_0x211bfa['filters']));_0x3ce053[_0xe96c('0x4a')][_0xe96c('0x63')]=_0x338c47['id'];if(_0x5506b0['query'][_0xe96c('0x4c')]){_0x3ce053['where']=_[_0xe96c('0x4e')](_0x3ce053[_0xe96c('0x4a')],{'$or':_['map'](_0x3ce053[_0xe96c('0x43')],function(_0x1a8d3b){var _0x585c53={};_0x585c53[_0x1a8d3b]={'$like':'%'+_0x5506b0['query'][_0xe96c('0x4c')]+'%'};return _0x585c53;})});}_0x3ce053=_[_0xe96c('0x4e')]({},_0x3ce053,_0x5506b0[_0xe96c('0x55')]);return db[_0xe96c('0x6a')][_0xe96c('0x2c')]({'where':_0x3ce053['where']})[_0xe96c('0x1d')](function(_0x2637aa){_0x51c29b[_0xe96c('0x2c')]=_0x2637aa;if(_0x5506b0[_0xe96c('0x42')][_0xe96c('0x50')]){_0x3ce053[_0xe96c('0x51')]=[{'all':!![]}];}return db[_0xe96c('0x6a')]['findAll'](_0x3ce053);})[_0xe96c('0x1d')](function(_0x4d8d74){_0x51c29b[_0xe96c('0x52')]=_0x4d8d74;return _0x51c29b;});}})[_0xe96c('0x1d')](respondWithFilteredResult(_0xe1c76e,_0x3ce053))['catch'](handleError(_0xe1c76e,null));};exports[_0xe96c('0x6c')]=function(_0x3a4329,_0x2b700,_0x2f0bcc){return db[_0xe96c('0x4f')][_0xe96c('0x56')]({'where':{'id':_0x3a4329[_0xe96c('0x60')]['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x2b700,null))[_0xe96c('0x1d')](function(_0x3d8859){if(_0x3d8859){return _0x3d8859[_0xe96c('0x6c')](_0x3a4329[_0xe96c('0x42')][_0xe96c('0x6d')]);}})['then'](respondWithStatusCode(_0x2b700,null))['catch'](handleError(_0x2b700,null));};exports['notify']=function(_0x48eb0e,_0x189317,_0x5da776){var _0x56d18e={'body':_0x48eb0e[_0xe96c('0x58')],'channel':'openchannel'};var _0x3f175c=[];var _0x46f050=[];var _0x40936f={};var _0x460394=![];return db[_0xe96c('0x6e')]['describe']()[_0xe96c('0x1d')](function(_0x288249){if(!_0x288249){throw new db[(_0xe96c('0x6f'))][(_0xe96c('0x70'))]('no\x20available\x20attributes');}_0x3f175c=_['difference'](_['keys'](_0x288249),[_0xe96c('0x71'),'updatedAt']);_0x46f050=_[_0xe96c('0x72')](_[_0xe96c('0x40')](_0x288249),[_0xe96c('0x71'),_0xe96c('0x73'),_0xe96c('0x74'),_0xe96c('0x75')]);if(_0x48eb0e[_0xe96c('0x58')]['id']){delete _0x48eb0e[_0xe96c('0x58')]['id'];}if(_[_0xe96c('0x76')](_0x48eb0e['body'][_0xe96c('0x77')])){throw new db[(_0xe96c('0x6f'))][(_0xe96c('0x70'))]('from\x20is\x20mandatory');}if(_[_0xe96c('0x76')](_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x58')])||_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x58')]===''){throw new db[(_0xe96c('0x6f'))][(_0xe96c('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe96c('0x76')](_0x48eb0e['body'][_0xe96c('0x78')])){throw new db['Sequelize'][(_0xe96c('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46f050);}if(!_[_0xe96c('0x79')](_0x46f050,_0x48eb0e[_0xe96c('0x58')]['mapKey'])){throw new db[(_0xe96c('0x6f'))][(_0xe96c('0x70'))](_0xe96c('0x7a')+_0x46f050);}_0x40936f[_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x78')]]=_0x48eb0e[_0xe96c('0x58')]['from'];})[_0xe96c('0x1d')](function(){return db['OpenchannelAccount'][_0xe96c('0x56')]({'where':{'id':_0x48eb0e[_0xe96c('0x60')]['id']},'include':[{'model':db[_0xe96c('0x7b')],'as':_0xe96c('0x7c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x40936f,'limit':0x1,'order':[[_0xe96c('0x73'),_0xe96c('0x7d')]]}]},{'model':db[_0xe96c('0x7e')],'as':_0xe96c('0x7f')}]});})[_0xe96c('0x1d')](handleEntityNotFound(_0x189317,null))[_0xe96c('0x1d')](function(_0x543633){if(_0x543633&&_0x543633[_0xe96c('0x7c')]){_0x56d18e[_0xe96c('0x80')]=_0x543633;_0x56d18e[_0xe96c('0x81')]=_0x543633['Applications'];_0x56d18e[_0xe96c('0x82')]=_0x543633[_0xe96c('0x7c')];_0x56d18e['applications']=_[_0xe96c('0x83')](_0x56d18e[_0xe96c('0x81')],[_0xe96c('0x84')],[_0xe96c('0x85')]);if(_0x56d18e['account'][_0xe96c('0x7f')]){delete _0x56d18e[_0xe96c('0x80')]['Applications'];}if(_0x56d18e['account']['List']&&_0x56d18e[_0xe96c('0x80')][_0xe96c('0x7c')][_0xe96c('0x86')][_0xe96c('0x54')]){return _0x56d18e[_0xe96c('0x80')][_0xe96c('0x7c')]['Contacts'][0x0];}var _0xf44ff5=_[_0xe96c('0x15')](_0x48eb0e[_0xe96c('0x58')],{'firstName':_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x77')],'ListId':_0x543633[_0xe96c('0x75')]});_0xf44ff5[_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x78')]]=_0x48eb0e['body'][_0xe96c('0x77')];return db[_0xe96c('0x6e')][_0xe96c('0x57')](_0xf44ff5,{'fields':_0x3f175c,'raw':!![]});}})['then'](handleEntityNotFound(_0x189317,null))['then'](function(_0x3427da){_0x56d18e[_0xe96c('0x87')]=_0x3427da;if(_0x3427da){var _0x5705cb={'ContactId':_0x3427da['id'],'OpenchannelAccountId':_0x48eb0e[_0xe96c('0x60')]['id'],'from':(_0x3427da[_0xe96c('0x88')]||'')+'\x20'+(_0x3427da['lastName']||'')};var _0x1ce23e={'OpenchannelAccountId':_0x48eb0e[_0xe96c('0x60')]['id'],'closed':![]};if(_0x48eb0e[_0xe96c('0x58')]['threadId']){_0x1ce23e[_0xe96c('0x89')]=_0x48eb0e['body'][_0xe96c('0x89')];return db[_0xe96c('0x8a')][_0xe96c('0x56')]({'where':_0x1ce23e})[_0xe96c('0x1d')](function(_0x22a30d){if(_0x22a30d){return[_0x22a30d,![]];}_0x5705cb[_0xe96c('0x89')]=_0x48eb0e['body'][_0xe96c('0x89')];_0x5705cb[_0xe96c('0x8b')]=_0x48eb0e[_0xe96c('0x58')]['externalUrl'];return db[_0xe96c('0x8a')][_0xe96c('0x57')](_0x5705cb)[_0xe96c('0x1d')](function(_0x2adec2){return[_0x2adec2,!![]];});});}else{_0x1ce23e[_0xe96c('0x89')]=null;}_0x1ce23e['ContactId']=_0x3427da['id'];return db['OpenchannelInteraction'][_0xe96c('0x56')]({'where':_0x1ce23e})[_0xe96c('0x1d')](function(_0x383708){if(_0x383708){return[_0x383708,![]];}return db[_0xe96c('0x8a')]['create'](_0x5705cb)[_0xe96c('0x1d')](function(_0x1c982d){return[_0x1c982d,!![]];});});}})[_0xe96c('0x8c')](function(_0xdae93c,_0x34054b){if(_0xdae93c){_0x460394=_0x34054b;if(!_0x34054b){var _0x812af1={'from':(_0x56d18e[_0xe96c('0x87')][_0xe96c('0x88')]||'')+'\x20'+(_0x56d18e[_0xe96c('0x87')][_0xe96c('0x8d')]||'')};if(_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x89')]&&_0x48eb0e[_0xe96c('0x58')]['messageId']&&_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x89')]!=_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x8e')]){_0x812af1[_0xe96c('0x89')]=_0x48eb0e['body']['messageId'];}return _0xdae93c['update'](_0x812af1);}else{return _0xdae93c;}}})[_0xe96c('0x1d')](function(_0x5aa1e4){_0x56d18e[_0xe96c('0x8f')]=_0x5aa1e4['get']({'plain':!![]});_0x56d18e['interaction']['created']=_0x460394;if(_0x56d18e['interaction']['created']){if(_0x56d18e['account']['autoclose']){_0x56d18e[_0xe96c('0x81')][_0xe96c('0x90')]({'id':0x0,'priority':_0x56d18e[_0xe96c('0x81')][_0xe96c('0x54')]+0x1,'app':_0xe96c('0x91'),'appdata':_0xe96c('0x92'),'interval':'*,*,*,*'});}}return db[_0xe96c('0x93')][_0xe96c('0x57')]({'body':_0x48eb0e[_0xe96c('0x58')][_0xe96c('0x58')],'OpenchannelAccountId':_0x48eb0e['params']['id'],'OpenchannelInteractionId':_0x5aa1e4['id'],'direction':'in','ContactId':_0x56d18e[_0xe96c('0x87')]['id'],'AttachmentId':_0x48eb0e[_0xe96c('0x58')]['AttachmentId']});})[_0xe96c('0x1d')](function(_0x116dd1){_0x56d18e[_0xe96c('0x23')]=_0x116dd1;if(_0x56d18e['interaction'][_0xe96c('0x94')]){return db[_0xe96c('0x95')][_0xe96c('0x56')]({'attributes':['id',_0xe96c('0x36')],'where':{'id':_0x56d18e[_0xe96c('0x8f')][_0xe96c('0x94')]}})[_0xe96c('0x1d')](function(_0x3c7678){if(_0x3c7678){_0x56d18e[_0xe96c('0x81')][_0xe96c('0x96')]({'id':0x0,'priority':0x0,'app':_0xe96c('0x97'),'appdata':_0x3c7678[_0xe96c('0x36')]+','+(_0x56d18e['account']['waitForTheAssignedAgent']||0xa),'interval':_0xe96c('0x98')});_0x56d18e[_0xe96c('0x99')]=![];}return respondWithRpcPromise(_0xe96c('0x9a'),'startRouting',_0x56d18e);});}return respondWithRpcPromise('Start',_0xe96c('0x9b'),_0x56d18e);})[_0xe96c('0x1d')](function(_0x5cea9c){respondWithRpcPromise(_0xe96c('0x9c'),_0xe96c('0x9c'),{'event':_0xe96c('0x9d'),'message':_0x5cea9c},client9002);return _0x5cea9c;})['then'](respondWithResult(_0x189317,null))[_0xe96c('0x26')](handleError(_0x189317,null));};exports[_0xe96c('0x9e')]=function(_0x20cfca,_0x51f455,_0x442b91){return db[_0xe96c('0x4f')]['findOne']({'where':{'id':_0x20cfca['params']['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x51f455,null))['then'](function(_0x1d76b0){if(_0x1d76b0){return db['sequelize']['transaction'](function(_0x5bf183){return db[_0xe96c('0x7e')]['destroy']({'where':{'OpenchannelAccountId':_0x20cfca[_0xe96c('0x60')]['id']},'transaction':_0x5bf183})[_0xe96c('0x1d')](function(_0x32ff65){var _0x588926=_[_0xe96c('0x3f')](_0x20cfca[_0xe96c('0x58')],function(_0x13a549){_0x13a549[_0xe96c('0x63')]=_0x20cfca[_0xe96c('0x60')]['id'];return _0x13a549;});return db[_0xe96c('0x7e')][_0xe96c('0x9f')](_0x588926,{'transaction':_0x5bf183});});})[_0xe96c('0x1d')](function(){return db[_0xe96c('0x7e')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x20cfca[_0xe96c('0x60')]['id']},'order':_0xe96c('0x84')});});}})[_0xe96c('0x1d')](respondWithResult(_0x51f455,null))['catch'](handleError(_0x51f455,null));};exports[_0xe96c('0xa0')]=function(_0x23c005,_0x1dbb6e,_0x6185be){var _0x432ffc={};var _0x1e2612={};var _0x3f1307;var _0x47ad4f;return db['OpenchannelAccount'][_0xe96c('0x65')]({'where':{'id':_0x23c005[_0xe96c('0x60')]['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x1dbb6e,null))[_0xe96c('0x1d')](function(_0x11ef82){if(_0x11ef82){_0x3f1307=_0x11ef82;_0x1e2612[_0xe96c('0x3e')]=_['keys'](db[_0xe96c('0x7e')][_0xe96c('0x3a')]);_0x1e2612[_0xe96c('0x42')]=_[_0xe96c('0x40')](_0x23c005['query']);_0x1e2612[_0xe96c('0x41')]=_[_0xe96c('0x44')](_0x1e2612[_0xe96c('0x3e')],_0x1e2612[_0xe96c('0x42')]);_0x432ffc['attributes']=_[_0xe96c('0x44')](_0x1e2612[_0xe96c('0x3e')],qs[_0xe96c('0x45')](_0x23c005[_0xe96c('0x42')]['fields']));_0x432ffc[_0xe96c('0x43')]=_0x432ffc['attributes'][_0xe96c('0x54')]?_0x432ffc[_0xe96c('0x43')]:_0x1e2612[_0xe96c('0x3e')];_0x432ffc[_0xe96c('0x48')]=qs[_0xe96c('0x49')](_0x23c005['query'][_0xe96c('0x49')]);_0x432ffc[_0xe96c('0x4a')]=qs[_0xe96c('0x41')](_[_0xe96c('0x4b')](_0x23c005[_0xe96c('0x42')],_0x1e2612[_0xe96c('0x41')]));if(_0x23c005[_0xe96c('0x42')][_0xe96c('0x4c')]){_0x432ffc['where']=_[_0xe96c('0x4e')](_0x432ffc[_0xe96c('0x4a')],{'$or':_[_0xe96c('0x3f')](_0x432ffc[_0xe96c('0x43')],function(_0x340a78){var _0xfbb240={};_0xfbb240[_0x340a78]={'$like':'%'+_0x23c005[_0xe96c('0x42')][_0xe96c('0x4c')]+'%'};return _0xfbb240;})});}_0x432ffc=_[_0xe96c('0x4e')]({},_0x432ffc,_0x23c005[_0xe96c('0x55')]);return _0x3f1307[_0xe96c('0xa0')](_0x432ffc);}})['then'](function(_0x3be7d3){if(_0x3be7d3){_0x47ad4f=_0x3be7d3[_0xe96c('0x54')];if(!_0x23c005['query'][_0xe96c('0x46')](_0xe96c('0x47'))){_0x432ffc[_0xe96c('0x2b')]=qs['limit'](_0x23c005[_0xe96c('0x42')]['limit']);_0x432ffc[_0xe96c('0x29')]=qs['offset'](_0x23c005['query'][_0xe96c('0x29')]);}return _0x3f1307[_0xe96c('0xa0')](_0x432ffc);}})[_0xe96c('0x1d')](function(_0x10d684){if(_0x10d684){return _0x10d684?{'count':_0x47ad4f,'rows':_0x10d684}:null;}})[_0xe96c('0x1d')](respondWithResult(_0x1dbb6e,null))[_0xe96c('0x26')](handleError(_0x1dbb6e,null));};exports['getInteractions']=function(_0x362384,_0x49fe9f,_0x157dc3){var _0x29a93c={'raw':![],'where':{}};var _0xb6914f={};var _0x4ee17f={'count':0x0,'rows':[]};return db[_0xe96c('0x4f')][_0xe96c('0x65')]({'where':{'id':_0x362384[_0xe96c('0x60')]['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x49fe9f,null))[_0xe96c('0x1d')](function(_0x190133){if(_0x190133){_0xb6914f[_0xe96c('0x3e')]=_['keys'](db[_0xe96c('0x8a')][_0xe96c('0x3a')]);_0xb6914f['query']=_[_0xe96c('0x40')](_0x362384[_0xe96c('0x42')]);_0xb6914f['filters']=_[_0xe96c('0x44')](_0xb6914f[_0xe96c('0x3e')],_0xb6914f[_0xe96c('0x42')]);_0x29a93c[_0xe96c('0x43')]=_['intersection'](_0xb6914f[_0xe96c('0x3e')],qs[_0xe96c('0x45')](_0x362384[_0xe96c('0x42')][_0xe96c('0x45')]));_0x29a93c['attributes']=_0x29a93c[_0xe96c('0x43')][_0xe96c('0x54')]?_0x29a93c['attributes']:_0xb6914f['model'];if(!_0x362384[_0xe96c('0x42')]['hasOwnProperty'](_0xe96c('0x47'))){_0x29a93c['limit']=qs[_0xe96c('0x2b')](_0x362384[_0xe96c('0x42')][_0xe96c('0x2b')]);_0x29a93c[_0xe96c('0x29')]=qs[_0xe96c('0x29')](_0x362384[_0xe96c('0x42')]['offset']);}_0x29a93c['order']=qs[_0xe96c('0x49')](_0x362384[_0xe96c('0x42')]['sort']);_0x29a93c[_0xe96c('0x4a')]=qs[_0xe96c('0x41')](_['pick'](_0x362384[_0xe96c('0x42')],_0xb6914f[_0xe96c('0x41')]));_0x29a93c[_0xe96c('0x4a')][_0xe96c('0x63')]=_0x190133['id'];if(_0x362384['query'][_0xe96c('0x4c')]){_0x29a93c[_0xe96c('0x4a')]=_[_0xe96c('0x4e')](_0x29a93c[_0xe96c('0x4a')],{'$or':_[_0xe96c('0x3f')](_0x29a93c['attributes'],function(_0x20a69e){var _0x32348c={};_0x32348c[_0x20a69e]={'$like':'%'+_0x362384[_0xe96c('0x42')]['filter']+'%'};return _0x32348c;})});}_0x29a93c=_[_0xe96c('0x4e')]({},_0x29a93c,_0x362384[_0xe96c('0x55')]);return db[_0xe96c('0x8a')]['count']({'where':_0x29a93c['where']})[_0xe96c('0x1d')](function(_0x14af43){_0x4ee17f[_0xe96c('0x2c')]=_0x14af43;if(_0x362384[_0xe96c('0x42')]['includeAll']){_0x29a93c[_0xe96c('0x51')]=[{'model':db[_0xe96c('0x6e')],'as':_0xe96c('0xa1'),'required':![]},{'model':db[_0xe96c('0x95')],'as':_0xe96c('0xa2'),'attributes':['name',_0xe96c('0xa3'),_0xe96c('0xa4')],'required':![]},{'model':db[_0xe96c('0xa5')],'as':_0xe96c('0xa6'),'attributes':['id',_0xe96c('0x36'),_0xe96c('0xa7')],'where':_0x362384['query'][_0xe96c('0xa8')]?{'id':_0x362384[_0xe96c('0x42')][_0xe96c('0xa8')]}:undefined,'required':_0x362384['query'][_0xe96c('0xa8')]?!![]:![]}];}return db[_0xe96c('0x8a')][_0xe96c('0x67')](_0x29a93c);})[_0xe96c('0x1d')](function(_0x16e778){_0x4ee17f[_0xe96c('0x52')]=_0x16e778;return _0x4ee17f;});}})[_0xe96c('0x1d')](respondWithFilteredResult(_0x49fe9f,_0x29a93c))['catch'](handleError(_0x49fe9f,null));};exports[_0xe96c('0xa9')]=function(_0x47df99,_0x317642,_0x276a76){return db['OpenchannelAccount'][_0xe96c('0x56')]({'where':{'id':_0x47df99[_0xe96c('0x60')]['id']}})['then'](handleEntityNotFound(_0x317642,null))['then'](function(_0x52fe44){if(_0x52fe44){return _0x52fe44[_0xe96c('0xa9')](_0x47df99['body'][_0xe96c('0x6d')],_[_0xe96c('0xaa')](_0x47df99[_0xe96c('0x58')],[_0xe96c('0x6d'),'id'])||{})['spread'](function(_0x19e354){for(var _0x4f9110=0x0;_0x4f9110<_0x47df99[_0xe96c('0x58')][_0xe96c('0x6d')][_0xe96c('0x54')];_0x4f9110+=0x1){socket[_0xe96c('0xab')](_0xe96c('0xac'),{'UserId':Number(_0x47df99['body'][_0xe96c('0x6d')][_0x4f9110]),'OpenchannelAccountId':Number(_0x47df99[_0xe96c('0x60')]['id'])});}return _0x19e354;});}})[_0xe96c('0x1d')](respondWithResult(_0x317642,null))[_0xe96c('0x26')](handleError(_0x317642,null));};exports[_0xe96c('0xad')]=function(_0x17a923,_0x37a581,_0x40d5d9){return db[_0xe96c('0x4f')][_0xe96c('0x56')]({'where':{'id':_0x17a923[_0xe96c('0x60')]['id']}})['then'](handleEntityNotFound(_0x37a581,null))['then'](function(_0x2eee80){if(_0x2eee80){return _0x2eee80[_0xe96c('0xad')](_0x17a923['query']['ids'])[_0xe96c('0x1d')](function(){if(_[_0xe96c('0xae')](_0x17a923['query'][_0xe96c('0x6d')])){for(var _0xcc6ba5=0x0;_0xcc6ba5<_0x17a923[_0xe96c('0x42')][_0xe96c('0x6d')]['length'];_0xcc6ba5+=0x1){socket[_0xe96c('0xab')](_0xe96c('0xaf'),{'UserId':Number(_0x17a923[_0xe96c('0x42')][_0xe96c('0x6d')][_0xcc6ba5]),'OpenchannelAccountId':Number(_0x17a923[_0xe96c('0x60')]['id'])});}}else{socket[_0xe96c('0xab')](_0xe96c('0xaf'),{'UserId':Number(_0x17a923[_0xe96c('0x42')]['ids']),'OpenchannelAccountId':Number(_0x17a923[_0xe96c('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x37a581,null))[_0xe96c('0x26')](handleError(_0x37a581,null));};exports[_0xe96c('0xb0')]=function(_0x17b680,_0x2bfb5c,_0x9f2b10){var _0x497a5e={};var _0x536b71={};var _0x427933;var _0x1f55d1;return db[_0xe96c('0x4f')][_0xe96c('0x65')]({'where':{'id':_0x17b680[_0xe96c('0x60')]['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x2bfb5c,null))[_0xe96c('0x1d')](function(_0x1b2417){if(_0x1b2417){_0x427933=_0x1b2417;_0x536b71[_0xe96c('0x3e')]=_[_0xe96c('0x40')](db[_0xe96c('0x95')][_0xe96c('0x3a')]);_0x536b71[_0xe96c('0x42')]=_[_0xe96c('0x40')](_0x17b680[_0xe96c('0x42')]);_0x536b71[_0xe96c('0x41')]=_[_0xe96c('0x44')](_0x536b71[_0xe96c('0x3e')],_0x536b71[_0xe96c('0x42')]);_0x497a5e['attributes']=_[_0xe96c('0x44')](_0x536b71['model'],qs[_0xe96c('0x45')](_0x17b680[_0xe96c('0x42')]['fields']));_0x497a5e[_0xe96c('0x43')]=_0x497a5e[_0xe96c('0x43')]['length']?_0x497a5e['attributes']:_0x536b71[_0xe96c('0x3e')];_0x497a5e['order']=qs[_0xe96c('0x49')](_0x17b680[_0xe96c('0x42')][_0xe96c('0x49')]);_0x497a5e[_0xe96c('0x4a')]=qs[_0xe96c('0x41')](_[_0xe96c('0x4b')](_0x17b680[_0xe96c('0x42')],_0x536b71[_0xe96c('0x41')]));if(_0x17b680[_0xe96c('0x42')][_0xe96c('0x4c')]){_0x497a5e[_0xe96c('0x4a')]=_[_0xe96c('0x4e')](_0x497a5e[_0xe96c('0x4a')],{'$or':_[_0xe96c('0x3f')](_0x497a5e[_0xe96c('0x43')],function(_0x424156){var _0x3d66ab={};_0x3d66ab[_0x424156]={'$like':'%'+_0x17b680[_0xe96c('0x42')][_0xe96c('0x4c')]+'%'};return _0x3d66ab;})});}_0x497a5e=_[_0xe96c('0x4e')]({},_0x497a5e,_0x17b680[_0xe96c('0x55')]);return _0x427933[_0xe96c('0xb0')](_0x497a5e);}})[_0xe96c('0x1d')](function(_0x5b209a){if(_0x5b209a){_0x1f55d1=_0x5b209a['length'];if(!_0x17b680[_0xe96c('0x42')][_0xe96c('0x46')]('nolimit')){_0x497a5e[_0xe96c('0x2b')]=qs[_0xe96c('0x2b')](_0x17b680['query']['limit']);_0x497a5e[_0xe96c('0x29')]=qs[_0xe96c('0x29')](_0x17b680['query'][_0xe96c('0x29')]);}return _0x427933[_0xe96c('0xb0')](_0x497a5e);}})[_0xe96c('0x1d')](function(_0x544e44){if(_0x544e44){return _0x544e44?{'count':_0x1f55d1,'rows':_0x544e44}:null;}})[_0xe96c('0x1d')](respondWithResult(_0x2bfb5c,null))[_0xe96c('0x26')](handleError(_0x2bfb5c,null));};exports[_0xe96c('0xb1')]=function(_0x57cb96,_0x2ae194,_0xa5a025){var _0x4cd792,_0x3cd19d,_0x53997f;if(_[_0xe96c('0x76')](_0x57cb96[_0xe96c('0x58')]['body'])||_0x57cb96[_0xe96c('0x58')][_0xe96c('0x58')]===''){throw new db[(_0xe96c('0x6f'))][(_0xe96c('0x70'))](_0xe96c('0xb2'));}if(_[_0xe96c('0x76')](_0x57cb96[_0xe96c('0x58')]['to'])){}_0x4cd792=_0x57cb96['body']['to'];return db[_0xe96c('0x4f')]['findOne']({'where':{'id':_0x57cb96[_0xe96c('0x60')]['id']}})[_0xe96c('0x1d')](handleEntityNotFound(_0x2ae194,null))[_0xe96c('0x1d')](function(_0x37bca2){if(_0x37bca2){return db[_0xe96c('0x4f')][_0xe96c('0x56')]({'where':{'id':_0x37bca2['id']},'include':[{'model':db[_0xe96c('0x7b')],'as':_0xe96c('0x7c'),'include':[{'model':db[_0xe96c('0x6e')],'as':'Contacts','where':{[_0x37bca2[_0xe96c('0x78')]]:_0x4cd792},'limit':0x1,'order':[['updatedAt',_0xe96c('0x7d')]]}]}]})[_0xe96c('0x1d')](handleEntityNotFound(_0x2ae194,null))[_0xe96c('0x1d')](function(_0x1d3e61){if(_0x1d3e61&&_0x1d3e61['List']){_0x3cd19d=_0x1d3e61[_0xe96c('0x5a')]({'plain':!![]});if(_0x3cd19d[_0xe96c('0x7c')]&&_0x3cd19d['List']['Contacts'][_0xe96c('0x54')]){return _0x3cd19d['List'][_0xe96c('0x86')][0x0];}return db[_0xe96c('0x6e')]['create'](_[_0xe96c('0x15')](_0x57cb96[_0xe96c('0x58')],{'firstName':_0x4cd792,[_0x1d3e61[_0xe96c('0x78')]]:_0x4cd792,'phone':_0x4cd792,'ListId':_0x3cd19d['ListId']}));}})['then'](handleEntityNotFound(_0x2ae194,null))['then'](function(_0x3febe0){if(_0x3febe0){_0x53997f=_0x3febe0;return db[_0xe96c('0x8a')][_0xe96c('0x56')]({'where':{'ContactId':_0x53997f['id'],'closed':![],'OpenchannelAccountId':_0x3cd19d['id']}})[_0xe96c('0x1d')](function(_0x1908a0){if(_0x1908a0){return[_0x1908a0,![]];}return db[_0xe96c('0x8a')][_0xe96c('0x57')]({'UserId':_0x57cb96[_0xe96c('0x59')]['id'],'ContactId':_0x53997f['id'],'OpenchannelAccountId':_0x3cd19d['id'],'lastMsgDirection':_0xe96c('0xb3'),'Messages':[_['merge'](_0x57cb96[_0xe96c('0x58')],{'read':![],'body':_0x57cb96[_0xe96c('0x58')][_0xe96c('0x58')],'OpenchannelAccountId':_0x3cd19d['id'],'UserId':_0x57cb96[_0xe96c('0x59')]['id'],'ContactId':_0x53997f['id']})]},{'include':[{'model':db[_0xe96c('0x93')],'as':_0xe96c('0xb4')}]})[_0xe96c('0x1d')](function(_0x49810d){return[_0x49810d,!![]];});});}})[_0xe96c('0x8c')](function(_0x5d967b,_0x460e9f){if(_0x460e9f){return _0x5d967b;}return db[_0xe96c('0x93')][_0xe96c('0x57')](_[_0xe96c('0x4e')](_0x57cb96[_0xe96c('0x58')],{'read':![],'body':_0x57cb96[_0xe96c('0x58')][_0xe96c('0x58')],'OpenchannelAccountId':_0x3cd19d['id'],'OpenchannelInteractionId':_0x5d967b['id'],'UserId':_0x57cb96[_0xe96c('0x59')]['id'],'ContactId':_0x53997f['id']}))[_0xe96c('0x1d')](function(_0x98e004){_0x5d967b[_0xe96c('0xb5')][_0xe96c('0xb4')]=[];_0x5d967b[_0xe96c('0xb5')]['Messages'][_0xe96c('0x90')](_0x98e004[_0xe96c('0xb5')]);return _0x5d967b;});});}})[_0xe96c('0x1d')](respondWithResult(_0x2ae194,null))[_0xe96c('0x26')](handleError(_0x2ae194,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index f51ba1a..93ac8e2 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 _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x0bb5,0x148));var _0x50bb=function(_0x19b168,_0x34d479){_0x19b168=_0x19b168-0x0;var _0x5df2d6=_0x0bb5[_0x19b168];return _0x5df2d6;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb43b=['events','../../mysqldb','setMaxListeners','save','update','hasOwnProperty','exports'];(function(_0x520398,_0x3779e1){var _0x23ce9d=function(_0x83a3dd){while(--_0x83a3dd){_0x520398['push'](_0x520398['shift']());}};_0x23ce9d(++_0x3779e1);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4b1b1c,_0x3f5a98){_0x4b1b1c=_0x4b1b1c-0x0;var _0x16ebf3=_0xb43b[_0x4b1b1c];return _0x16ebf3;};'use strict';var EventEmitter=require(_0xbb43('0x0'));var OpenchannelAccount=require(_0xbb43('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb43('0x2')](0x0);var events={'afterCreate':_0xbb43('0x3'),'afterUpdate':_0xbb43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x131e9e){return function(_0x41aff6,_0x351254,_0x16432a){OpenchannelAccountEvents['emit'](_0x131e9e+':'+_0x41aff6['id'],_0x41aff6);OpenchannelAccountEvents['emit'](_0x131e9e,_0x41aff6);_0x16432a(null);};}for(var e in events){if(events[_0xbb43('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xbb43('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index cb90176..154395f 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(_0x38bac8,_0x3ccfcd){var _0x528ead=function(_0x213fc2){while(--_0x213fc2){_0x38bac8['push'](_0x38bac8['shift']());}};_0x528ead(++_0x3ccfcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x22b3e4,_0x243e45){var _0x274cff=function(_0xfce75c){while(--_0xfce75c){_0x22b3e4['push'](_0x22b3e4['shift']());}};_0x274cff(++_0x243e45);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d6572b2..e814544 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 _0x049e=['localhost','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0xe6f7a7,_0x52c1fa){var _0x15f41b=function(_0x2cea45){while(--_0x2cea45){_0xe6f7a7['push'](_0xe6f7a7['shift']());}};_0x15f41b(++_0x52c1fa);}(_0x049e,0x16a));var _0xe049=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x049e[_0x595013];return _0x2a29e3;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var moment=require('moment');var BPromise=require(_0xe049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe049('0x3'));var db=require(_0xe049('0x4'))['db'];var utils=require(_0xe049('0x5'));var logger=require(_0xe049('0x6'))(_0xe049('0x7'));var config=require('../../config/environment');var jayson=require(_0xe049('0x8'));var client=jayson[_0xe049('0x9')][_0xe049('0xa')]({'port':0x232a});config[_0xe049('0xb')]=_[_0xe049('0xc')](config[_0xe049('0xb')],{'host':_0xe049('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe049('0xb')]));require(_0xe049('0xe'))[_0xe049('0xf')](socket);function respondWithRpcPromise(_0x492115,_0x5cd404,_0x45a5fa){return new BPromise(function(_0x2ac671,_0x32a065){return client['request'](_0x492115,_0x45a5fa)['then'](function(_0x574549){logger[_0xe049('0x10')](_0xe049('0x11'),_0x5cd404,_0xe049('0x12'));logger[_0xe049('0x13')](_0xe049('0x14'),_0x5cd404,_0xe049('0x12'),JSON[_0xe049('0x15')](_0x574549));if(_0x574549[_0xe049('0x16')]){if(_0x574549['error'][_0xe049('0x17')]===0x1f4){logger[_0xe049('0x16')](_0xe049('0x11'),_0x5cd404,_0x574549[_0xe049('0x16')]['message']);return _0x32a065(_0x574549[_0xe049('0x16')][_0xe049('0x18')]);}logger['error'](_0xe049('0x11'),_0x5cd404,_0x574549[_0xe049('0x16')]['message']);return _0x2ac671(_0x574549[_0xe049('0x16')][_0xe049('0x18')]);}else{logger['info'](_0xe049('0x11'),_0x5cd404,'request\x20sent');_0x2ac671(_0x574549['result'][_0xe049('0x18')]);}})['catch'](function(_0x55da56){logger[_0xe049('0x16')](_0xe049('0x11'),_0x5cd404,_0x55da56);_0x32a065(_0x55da56);});});} \ No newline at end of file +var _0x6215=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info'];(function(_0x1b26b7,_0x3d01d7){var _0x56d643=function(_0x4ad769){while(--_0x4ad769){_0x1b26b7['push'](_0x1b26b7['shift']());}};_0x56d643(++_0x3d01d7);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5621('0x9')]=_[_0x5621('0xa')](config[_0x5621('0x9')],{'host':_0x5621('0xb'),'port':0x18eb});var socket=require(_0x5621('0xc'))(new Redis(config['redis']));require(_0x5621('0xd'))[_0x5621('0xe')](socket);function respondWithRpcPromise(_0x3aa022,_0x418114,_0x53625c){return new BPromise(function(_0x1f4148,_0x10bb32){return client[_0x5621('0xf')](_0x3aa022,_0x53625c)['then'](function(_0x2b0f51){logger[_0x5621('0x10')](_0x5621('0x11'),_0x418114,_0x5621('0x12'));logger[_0x5621('0x13')](_0x5621('0x14'),_0x418114,_0x5621('0x12'),JSON[_0x5621('0x15')](_0x2b0f51));if(_0x2b0f51[_0x5621('0x16')]){if(_0x2b0f51[_0x5621('0x16')]['code']===0x1f4){logger[_0x5621('0x16')](_0x5621('0x11'),_0x418114,_0x2b0f51[_0x5621('0x16')]['message']);return _0x10bb32(_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);}logger['error'](_0x5621('0x11'),_0x418114,_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);return _0x1f4148(_0x2b0f51[_0x5621('0x16')][_0x5621('0x17')]);}else{logger[_0x5621('0x10')](_0x5621('0x11'),_0x418114,_0x5621('0x12'));_0x1f4148(_0x2b0f51[_0x5621('0x18')][_0x5621('0x17')]);}})['catch'](function(_0x1111b2){logger[_0x5621('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x418114,_0x1111b2);_0x10bb32(_0x1111b2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 46ca602..247ff5c 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 _0x4bd1=['removeListener','register','length','openchannelAccount:','save','update','emit'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x4bd1,0x90));var _0x14bd=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0x4bd1[_0x47d6dc];return _0x1a1c93;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x14bd('0x0'),'remove',_0x14bd('0x1')];function createListener(_0xa0d344,_0x50d79a){return function(_0x17e7b6){_0x50d79a[_0x14bd('0x2')](_0xa0d344,_0x17e7b6);};}function removeListener(_0x51fcdb,_0x4080e1){return function(){OpenchannelAccountEvents[_0x14bd('0x3')](_0x51fcdb,_0x4080e1);};}exports[_0x14bd('0x4')]=function(_0x31b468){for(var _0x5c4680=0x0,_0x35806e=events[_0x14bd('0x5')];_0x5c4680<_0x35806e;_0x5c4680++){var _0xb06dbf=events[_0x5c4680];var _0x2e9a2f=createListener(_0x14bd('0x6')+_0xb06dbf,_0x31b468);OpenchannelAccountEvents['on'](_0xb06dbf,_0x2e9a2f);}}; \ No newline at end of file +var _0x803f=['length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','register'];(function(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0x803f,0x64));var _0xf803=function(_0x4e2542,_0x506ad0){_0x4e2542=_0x4e2542-0x0;var _0x2256ab=_0x803f[_0x4e2542];return _0x2256ab;};'use strict';var OpenchannelAccountEvents=require(_0xf803('0x0'));var events=['save',_0xf803('0x1'),_0xf803('0x2')];function createListener(_0x4ce875,_0x1a8691){return function(_0x43fb3b){_0x1a8691[_0xf803('0x3')](_0x4ce875,_0x43fb3b);};}function removeListener(_0x6baafe,_0x5c2cd6){return function(){OpenchannelAccountEvents['removeListener'](_0x6baafe,_0x5c2cd6);};}exports[_0xf803('0x4')]=function(_0x2ba12f){for(var _0x1d3a79=0x0,_0x584b2d=events[_0xf803('0x5')];_0x1d3a79<_0x584b2d;_0x1d3a79++){var _0x47128f=events[_0x1d3a79];var _0x587319=createListener(_0xf803('0x6')+_0x47128f,_0x2ba12f);OpenchannelAccountEvents['on'](_0x47128f,_0x587319);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index bb0b4a3..57dafe4 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 _0xadb4=['get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./openchannelApplication.controller'];(function(_0x51b1ef,_0x54e8dc){var _0x4bc52e=function(_0x19e605){while(--_0x19e605){_0x51b1ef['push'](_0x51b1ef['shift']());}};_0x4bc52e(++_0x54e8dc);}(_0xadb4,0x14d));var _0x4adb=function(_0x289c32,_0x1bca41){_0x289c32=_0x289c32-0x0;var _0x365c1d=_0xadb4[_0x289c32];return _0x365c1d;};'use strict';var multer=require(_0x4adb('0x0'));var util=require(_0x4adb('0x1'));var path=require(_0x4adb('0x2'));var timeout=require(_0x4adb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4adb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4adb('0x5'));var controller=require(_0x4adb('0x6'));router[_0x4adb('0x7')]('/',auth[_0x4adb('0x8')](),controller['index']);router[_0x4adb('0x7')]('/:id',auth[_0x4adb('0x8')](),controller[_0x4adb('0x9')]);router['post']('/',auth[_0x4adb('0x8')](),controller[_0x4adb('0xa')]);router[_0x4adb('0xb')](_0x4adb('0xc'),auth[_0x4adb('0x8')](),controller[_0x4adb('0xd')]);router[_0x4adb('0xe')](_0x4adb('0xc'),auth[_0x4adb('0x8')](),controller[_0x4adb('0xf')]);module[_0x4adb('0x10')]=router; \ No newline at end of file +var _0xf11a=['./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0xf11a,0x1e5));var _0xaf11=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0xf11a[_0x5c2c7c];return _0xea7ffe;};'use strict';var multer=require(_0xaf11('0x0'));var util=require(_0xaf11('0x1'));var path=require(_0xaf11('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf11('0x3'));var router=express[_0xaf11('0x4')]();var fs_extra=require(_0xaf11('0x5'));var auth=require(_0xaf11('0x6'));var interaction=require(_0xaf11('0x7'));var config=require(_0xaf11('0x8'));var controller=require(_0xaf11('0x9'));router[_0xaf11('0xa')]('/',auth[_0xaf11('0xb')](),controller[_0xaf11('0xc')]);router['get'](_0xaf11('0xd'),auth[_0xaf11('0xb')](),controller[_0xaf11('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaf11('0xf')]);router['put'](_0xaf11('0xd'),auth[_0xaf11('0xb')](),controller[_0xaf11('0x10')]);router[_0xaf11('0x11')](_0xaf11('0xd'),auth[_0xaf11('0xb')](),controller['destroy']);module[_0xaf11('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index e56c913..0ae6744 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 _0x6933=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x6933,0xdf));var _0x3693=function(_0x5e33f6,_0x2e18e6){_0x5e33f6=_0x5e33f6-0x0;var _0x20cb0f=_0x6933[_0x5e33f6];return _0x20cb0f;};'use strict';var Sequelize=require(_0x3693('0x0'));module[_0x3693('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3693('0x2')],'allowNull':![],'defaultValue':_0x3693('0x3')},'appdata':{'type':Sequelize[_0x3693('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3693('0x5')}}; \ No newline at end of file +var _0x381e=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0x381e,0x18f));var _0xe381=function(_0x192321,_0x2590dc){_0x192321=_0x192321-0x0;var _0x4adec6=_0x381e[_0x192321];return _0x4adec6;};'use strict';var Sequelize=require(_0xe381('0x0'));module[_0xe381('0x1')]={'priority':{'type':Sequelize[_0xe381('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe381('0x3')],'allowNull':![],'defaultValue':_0xe381('0x4')},'appdata':{'type':Sequelize[_0xe381('0x5')]()},'description':{'type':Sequelize[_0xe381('0x3')]},'interval':{'type':Sequelize[_0xe381('0x3')],'defaultValue':_0xe381('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index c628c9a..7053bac 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 _0x01fc=['merge','options','include','rows','show','rawAttributes','includeAll','find','create','body','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0x4f33a1,_0x3808ea){var _0x571700=function(_0x1c65c6){while(--_0x1c65c6){_0x4f33a1['push'](_0x4f33a1['shift']());}};_0x571700(++_0x3808ea);}(_0x01fc,0x13c));var _0xc01f=function(_0x4a961e,_0x43f968){_0x4a961e=_0x4a961e-0x0;var _0x426312=_0x01fc[_0x4a961e];return _0x426312;};'use strict';var emlformat=require(_0xc01f('0x0'));var rimraf=require(_0xc01f('0x1'));var zipdir=require(_0xc01f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc01f('0x3'));var moment=require(_0xc01f('0x4'));var BPromise=require(_0xc01f('0x5'));var Mustache=require(_0xc01f('0x6'));var util=require(_0xc01f('0x7'));var path=require(_0xc01f('0x8'));var sox=require(_0xc01f('0x9'));var csv=require(_0xc01f('0xa'));var ejs=require(_0xc01f('0xb'));var fs=require('fs');var fs_extra=require(_0xc01f('0xc'));var _=require('lodash');var squel=require(_0xc01f('0xd'));var crypto=require('crypto');var jsforce=require(_0xc01f('0xe'));var deskjs=require(_0xc01f('0xf'));var toCsv=require(_0xc01f('0xa'));var querystring=require(_0xc01f('0x10'));var Papa=require(_0xc01f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc01f('0x12'));var hardwareService=require(_0xc01f('0x13'));var logger=require(_0xc01f('0x14'))(_0xc01f('0x15'));var utils=require(_0xc01f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x534b65,_0x2ade14){_0x2ade14=_0x2ade14||0xcc;return function(_0x1494e1){if(_0x1494e1){return _0x534b65[_0xc01f('0x17')](_0x2ade14);}return _0x534b65[_0xc01f('0x18')](_0x2ade14)[_0xc01f('0x19')]();};}function respondWithResult(_0x2521f0,_0xa2a089){_0xa2a089=_0xa2a089||0xc8;return function(_0x4fc617){if(_0x4fc617){return _0x2521f0[_0xc01f('0x18')](_0xa2a089)[_0xc01f('0x1a')](_0x4fc617);}};}function respondWithFilteredResult(_0x17dfb1,_0x15e9d2){return function(_0x1a80ed){if(_0x1a80ed){var _0x35f237=typeof _0x15e9d2[_0xc01f('0x1b')]==='undefined'&&typeof _0x15e9d2[_0xc01f('0x1c')]===_0xc01f('0x1d');var _0x362591=_0x1a80ed[_0xc01f('0x1e')];var _0x284f38=_0x35f237?0x0:_0x15e9d2[_0xc01f('0x1b')];var _0x46fa4b=_0x35f237?_0x1a80ed[_0xc01f('0x1e')]:_0x15e9d2[_0xc01f('0x1b')]+_0x15e9d2['limit'];var _0x4de9a4;if(_0x46fa4b>=_0x362591){_0x46fa4b=_0x362591;_0x4de9a4=0xc8;}else{_0x4de9a4=0xce;}_0x17dfb1['status'](_0x4de9a4);return _0x17dfb1['set'](_0xc01f('0x1f'),_0x284f38+'-'+_0x46fa4b+'/'+_0x362591)[_0xc01f('0x1a')](_0x1a80ed);}return null;};}function patchUpdates(_0x43ab02){return function(_0xce1bcb){try{jsonpatch[_0xc01f('0x20')](_0xce1bcb,_0x43ab02,!![]);}catch(_0x42b08e){return BPromise[_0xc01f('0x21')](_0x42b08e);}return _0xce1bcb[_0xc01f('0x22')]();};}function saveUpdates(_0x18050b,_0x3a7c3b){return function(_0x5a301c){if(_0x5a301c){return _0x5a301c[_0xc01f('0x23')](_0x18050b)[_0xc01f('0x24')](function(_0x50d295){return _0x50d295;});}return null;};}function removeEntity(_0x4cd6dd,_0x3672a9){return function(_0x446f04){if(_0x446f04){return _0x446f04[_0xc01f('0x25')]()['then'](function(){_0x4cd6dd[_0xc01f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x502cd2,_0x3bad0f){return function(_0x2badaf){if(!_0x2badaf){_0x502cd2[_0xc01f('0x17')](0x194);}return _0x2badaf;};}function handleError(_0x191be9,_0xa5053f){_0xa5053f=_0xa5053f||0x1f4;return function(_0x482b67){logger[_0xc01f('0x26')](_0x482b67[_0xc01f('0x27')]);if(_0x482b67[_0xc01f('0x28')]){delete _0x482b67[_0xc01f('0x28')];}_0x191be9[_0xc01f('0x18')](_0xa5053f)[_0xc01f('0x29')](_0x482b67);};}exports[_0xc01f('0x2a')]=function(_0x46ab42,_0x17776e){var _0xe36c56={},_0xc9ac42={},_0x203f75={'count':0x0,'rows':[]};var _0x15c648=_[_0xc01f('0x2b')](db[_0xc01f('0x2c')]['rawAttributes'],function(_0x262c87){return{'name':_0x262c87[_0xc01f('0x2d')],'type':_0x262c87[_0xc01f('0x2e')][_0xc01f('0x2f')]};});_0xc9ac42[_0xc01f('0x30')]=_[_0xc01f('0x2b')](_0x15c648,_0xc01f('0x28'));_0xc9ac42[_0xc01f('0x31')]=_[_0xc01f('0x32')](_0x46ab42['query']);_0xc9ac42[_0xc01f('0x33')]=_[_0xc01f('0x34')](_0xc9ac42[_0xc01f('0x30')],_0xc9ac42['query']);_0xe36c56['attributes']=_[_0xc01f('0x34')](_0xc9ac42['model'],qs[_0xc01f('0x35')](_0x46ab42[_0xc01f('0x31')]['fields']));_0xe36c56[_0xc01f('0x36')]=_0xe36c56[_0xc01f('0x36')][_0xc01f('0x37')]?_0xe36c56['attributes']:_0xc9ac42[_0xc01f('0x30')];if(!_0x46ab42['query'][_0xc01f('0x38')](_0xc01f('0x39'))){_0xe36c56[_0xc01f('0x1c')]=qs[_0xc01f('0x1c')](_0x46ab42[_0xc01f('0x31')][_0xc01f('0x1c')]);_0xe36c56[_0xc01f('0x1b')]=qs[_0xc01f('0x1b')](_0x46ab42[_0xc01f('0x31')][_0xc01f('0x1b')]);}_0xe36c56[_0xc01f('0x3a')]=qs[_0xc01f('0x3b')](_0x46ab42['query'][_0xc01f('0x3b')]);_0xe36c56[_0xc01f('0x3c')]=qs[_0xc01f('0x33')](_[_0xc01f('0x3d')](_0x46ab42['query'],_0xc9ac42[_0xc01f('0x33')]),_0x15c648);if(_0x46ab42['query'][_0xc01f('0x3e')]){_0xe36c56[_0xc01f('0x3c')]=_['merge'](_0xe36c56[_0xc01f('0x3c')],{'$or':_[_0xc01f('0x2b')](_0x15c648,function(_0x96e20f){if(_0x96e20f[_0xc01f('0x2e')]!==_0xc01f('0x3f')){var _0x454d28={};_0x454d28[_0x96e20f[_0xc01f('0x28')]]={'$like':'%'+_0x46ab42[_0xc01f('0x31')][_0xc01f('0x3e')]+'%'};return _0x454d28;}})});}_0xe36c56=_[_0xc01f('0x40')]({},_0xe36c56,_0x46ab42[_0xc01f('0x41')]);var _0x545bd7={'where':_0xe36c56[_0xc01f('0x3c')]};return db[_0xc01f('0x2c')][_0xc01f('0x1e')](_0x545bd7)[_0xc01f('0x24')](function(_0x37e866){_0x203f75[_0xc01f('0x1e')]=_0x37e866;if(_0x46ab42[_0xc01f('0x31')]['includeAll']){_0xe36c56[_0xc01f('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0xe36c56);})[_0xc01f('0x24')](function(_0x140133){_0x203f75[_0xc01f('0x43')]=_0x140133;return _0x203f75;})['then'](respondWithFilteredResult(_0x17776e,_0xe36c56))['catch'](handleError(_0x17776e,null));};exports[_0xc01f('0x44')]=function(_0x5d87c4,_0xe3b65d){var _0x430fb8={'raw':!![],'where':{'id':_0x5d87c4['params']['id']}},_0x32c912={};_0x32c912[_0xc01f('0x30')]=_[_0xc01f('0x32')](db[_0xc01f('0x2c')][_0xc01f('0x45')]);_0x32c912[_0xc01f('0x31')]=_[_0xc01f('0x32')](_0x5d87c4[_0xc01f('0x31')]);_0x32c912[_0xc01f('0x33')]=_[_0xc01f('0x34')](_0x32c912[_0xc01f('0x30')],_0x32c912[_0xc01f('0x31')]);_0x430fb8[_0xc01f('0x36')]=_[_0xc01f('0x34')](_0x32c912[_0xc01f('0x30')],qs[_0xc01f('0x35')](_0x5d87c4['query'][_0xc01f('0x35')]));_0x430fb8[_0xc01f('0x36')]=_0x430fb8[_0xc01f('0x36')]['length']?_0x430fb8[_0xc01f('0x36')]:_0x32c912[_0xc01f('0x30')];if(_0x5d87c4[_0xc01f('0x31')][_0xc01f('0x46')]){_0x430fb8[_0xc01f('0x42')]=[{'all':!![]}];}_0x430fb8=_[_0xc01f('0x40')]({},_0x430fb8,_0x5d87c4[_0xc01f('0x41')]);return db['OpenchannelApplication'][_0xc01f('0x47')](_0x430fb8)['then'](handleEntityNotFound(_0xe3b65d,null))[_0xc01f('0x24')](respondWithResult(_0xe3b65d,null))['catch'](handleError(_0xe3b65d,null));};exports[_0xc01f('0x48')]=function(_0xef4bb9,_0x40ba66){return db['OpenchannelApplication'][_0xc01f('0x48')](_0xef4bb9[_0xc01f('0x49')],{})[_0xc01f('0x24')](respondWithResult(_0x40ba66,0xc9))[_0xc01f('0x4a')](handleError(_0x40ba66,null));};exports[_0xc01f('0x23')]=function(_0x4e0f7c,_0x32d0a6){if(_0x4e0f7c[_0xc01f('0x49')]['id']){delete _0x4e0f7c[_0xc01f('0x49')]['id'];}return db[_0xc01f('0x2c')]['find']({'where':{'id':_0x4e0f7c['params']['id']}})[_0xc01f('0x24')](handleEntityNotFound(_0x32d0a6,null))[_0xc01f('0x24')](saveUpdates(_0x4e0f7c[_0xc01f('0x49')],null))['then'](respondWithResult(_0x32d0a6,null))[_0xc01f('0x4a')](handleError(_0x32d0a6,null));};exports[_0xc01f('0x25')]=function(_0x4b83bb,_0x5a794c){return db[_0xc01f('0x2c')][_0xc01f('0x47')]({'where':{'id':_0x4b83bb[_0xc01f('0x4b')]['id']}})[_0xc01f('0x24')](handleEntityNotFound(_0x5a794c,null))[_0xc01f('0x24')](removeEntity(_0x5a794c,null))[_0xc01f('0x4a')](handleError(_0x5a794c,null));}; \ No newline at end of file +var _0x3494=['send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','type','merge','count','include','OpenchannelApplication','findAll','show','params','includeAll','options','find','catch','create','body','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','update','destroy','then','error','stack','name'];(function(_0x551b77,_0x86c510){var _0x34faf7=function(_0x3692b6){while(--_0x3692b6){_0x551b77['push'](_0x551b77['shift']());}};_0x34faf7(++_0x86c510);}(_0x3494,0x16d));var _0x4349=function(_0x59d053,_0x33b111){_0x59d053=_0x59d053-0x0;var _0x5157aa=_0x3494[_0x59d053];return _0x5157aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4349('0x0'));var zipdir=require(_0x4349('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4349('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4349('0x3'));var util=require(_0x4349('0x4'));var path=require(_0x4349('0x5'));var sox=require(_0x4349('0x6'));var csv=require('to-csv');var ejs=require(_0x4349('0x7'));var fs=require('fs');var fs_extra=require(_0x4349('0x8'));var _=require(_0x4349('0x9'));var squel=require('squel');var crypto=require(_0x4349('0xa'));var jsforce=require(_0x4349('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4349('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4349('0xd'));var authService=require(_0x4349('0xe'));var qs=require(_0x4349('0xf'));var as=require(_0x4349('0x10'));var hardwareService=require(_0x4349('0x11'));var logger=require(_0x4349('0x12'))(_0x4349('0x13'));var utils=require('../../config/utils');var config=require(_0x4349('0x14'));var licenseUtil=require(_0x4349('0x15'));var db=require(_0x4349('0x16'))['db'];function respondWithStatusCode(_0x2a678e,_0xd9fe91){_0xd9fe91=_0xd9fe91||0xcc;return function(_0x25f415){if(_0x25f415){return _0x2a678e[_0x4349('0x17')](_0xd9fe91);}return _0x2a678e[_0x4349('0x18')](_0xd9fe91)[_0x4349('0x19')]();};}function respondWithResult(_0x2792a3,_0x5ebc53){_0x5ebc53=_0x5ebc53||0xc8;return function(_0x4ca15d){if(_0x4ca15d){return _0x2792a3[_0x4349('0x18')](_0x5ebc53)['json'](_0x4ca15d);}};}function respondWithFilteredResult(_0x1bcb89,_0x2b9734){return function(_0x57d230){if(_0x57d230){var _0x2d14d9=typeof _0x2b9734[_0x4349('0x1a')]==='undefined'&&typeof _0x2b9734[_0x4349('0x1b')]===_0x4349('0x1c');var _0x16ecee=_0x57d230['count'];var _0x3a5c22=_0x2d14d9?0x0:_0x2b9734[_0x4349('0x1a')];var _0x51e21d=_0x2d14d9?_0x57d230['count']:_0x2b9734[_0x4349('0x1a')]+_0x2b9734['limit'];var _0x45ab93;if(_0x51e21d>=_0x16ecee){_0x51e21d=_0x16ecee;_0x45ab93=0xc8;}else{_0x45ab93=0xce;}_0x1bcb89[_0x4349('0x18')](_0x45ab93);return _0x1bcb89[_0x4349('0x1d')](_0x4349('0x1e'),_0x3a5c22+'-'+_0x51e21d+'/'+_0x16ecee)['json'](_0x57d230);}return null;};}function patchUpdates(_0x314610){return function(_0x44dc1b){try{jsonpatch['apply'](_0x44dc1b,_0x314610,!![]);}catch(_0x517906){return BPromise['reject'](_0x517906);}return _0x44dc1b['save']();};}function saveUpdates(_0x173677,_0x49188b){return function(_0x532821){if(_0x532821){return _0x532821[_0x4349('0x1f')](_0x173677)['then'](function(_0x35d323){return _0x35d323;});}return null;};}function removeEntity(_0x814154,_0x5399c0){return function(_0x5f4774){if(_0x5f4774){return _0x5f4774[_0x4349('0x20')]()[_0x4349('0x21')](function(){_0x814154[_0x4349('0x18')](0xcc)[_0x4349('0x19')]();});}};}function handleEntityNotFound(_0x5a35dd,_0x151ca5){return function(_0x247fb9){if(!_0x247fb9){_0x5a35dd['sendStatus'](0x194);}return _0x247fb9;};}function handleError(_0x5c4660,_0x477b0c){_0x477b0c=_0x477b0c||0x1f4;return function(_0x452bc7){logger[_0x4349('0x22')](_0x452bc7[_0x4349('0x23')]);if(_0x452bc7['name']){delete _0x452bc7[_0x4349('0x24')];}_0x5c4660[_0x4349('0x18')](_0x477b0c)[_0x4349('0x25')](_0x452bc7);};}exports[_0x4349('0x26')]=function(_0x3ad2f4,_0x53c0f5){var _0x555c37={},_0x4167af={},_0x153ef2={'count':0x0,'rows':[]};var _0x44f988=_[_0x4349('0x27')](db['OpenchannelApplication'][_0x4349('0x28')],function(_0x102fe9){return{'name':_0x102fe9['fieldName'],'type':_0x102fe9['type']['key']};});_0x4167af[_0x4349('0x29')]=_[_0x4349('0x27')](_0x44f988,_0x4349('0x24'));_0x4167af[_0x4349('0x2a')]=_[_0x4349('0x2b')](_0x3ad2f4['query']);_0x4167af[_0x4349('0x2c')]=_[_0x4349('0x2d')](_0x4167af[_0x4349('0x29')],_0x4167af[_0x4349('0x2a')]);_0x555c37[_0x4349('0x2e')]=_[_0x4349('0x2d')](_0x4167af[_0x4349('0x29')],qs[_0x4349('0x2f')](_0x3ad2f4[_0x4349('0x2a')]['fields']));_0x555c37[_0x4349('0x2e')]=_0x555c37['attributes'][_0x4349('0x30')]?_0x555c37[_0x4349('0x2e')]:_0x4167af[_0x4349('0x29')];if(!_0x3ad2f4[_0x4349('0x2a')]['hasOwnProperty']('nolimit')){_0x555c37[_0x4349('0x1b')]=qs['limit'](_0x3ad2f4[_0x4349('0x2a')][_0x4349('0x1b')]);_0x555c37[_0x4349('0x1a')]=qs[_0x4349('0x1a')](_0x3ad2f4[_0x4349('0x2a')][_0x4349('0x1a')]);}_0x555c37[_0x4349('0x31')]=qs[_0x4349('0x32')](_0x3ad2f4[_0x4349('0x2a')][_0x4349('0x32')]);_0x555c37[_0x4349('0x33')]=qs[_0x4349('0x2c')](_['pick'](_0x3ad2f4[_0x4349('0x2a')],_0x4167af[_0x4349('0x2c')]),_0x44f988);if(_0x3ad2f4[_0x4349('0x2a')][_0x4349('0x34')]){_0x555c37[_0x4349('0x33')]=_['merge'](_0x555c37['where'],{'$or':_[_0x4349('0x27')](_0x44f988,function(_0xd40d3a){if(_0xd40d3a[_0x4349('0x35')]!=='VIRTUAL'){var _0x13a06b={};_0x13a06b[_0xd40d3a[_0x4349('0x24')]]={'$like':'%'+_0x3ad2f4[_0x4349('0x2a')][_0x4349('0x34')]+'%'};return _0x13a06b;}})});}_0x555c37=_[_0x4349('0x36')]({},_0x555c37,_0x3ad2f4['options']);var _0x5aeadc={'where':_0x555c37['where']};return db['OpenchannelApplication'][_0x4349('0x37')](_0x5aeadc)[_0x4349('0x21')](function(_0x358a71){_0x153ef2['count']=_0x358a71;if(_0x3ad2f4[_0x4349('0x2a')]['includeAll']){_0x555c37[_0x4349('0x38')]=[{'all':!![]}];}return db[_0x4349('0x39')][_0x4349('0x3a')](_0x555c37);})[_0x4349('0x21')](function(_0x563fa8){_0x153ef2['rows']=_0x563fa8;return _0x153ef2;})[_0x4349('0x21')](respondWithFilteredResult(_0x53c0f5,_0x555c37))['catch'](handleError(_0x53c0f5,null));};exports[_0x4349('0x3b')]=function(_0x5a3951,_0x55cc79){var _0x286058={'raw':!![],'where':{'id':_0x5a3951[_0x4349('0x3c')]['id']}},_0x19b08b={};_0x19b08b['model']=_[_0x4349('0x2b')](db[_0x4349('0x39')][_0x4349('0x28')]);_0x19b08b['query']=_[_0x4349('0x2b')](_0x5a3951[_0x4349('0x2a')]);_0x19b08b['filters']=_[_0x4349('0x2d')](_0x19b08b[_0x4349('0x29')],_0x19b08b[_0x4349('0x2a')]);_0x286058['attributes']=_[_0x4349('0x2d')](_0x19b08b[_0x4349('0x29')],qs[_0x4349('0x2f')](_0x5a3951[_0x4349('0x2a')]['fields']));_0x286058[_0x4349('0x2e')]=_0x286058[_0x4349('0x2e')][_0x4349('0x30')]?_0x286058[_0x4349('0x2e')]:_0x19b08b[_0x4349('0x29')];if(_0x5a3951[_0x4349('0x2a')][_0x4349('0x3d')]){_0x286058[_0x4349('0x38')]=[{'all':!![]}];}_0x286058=_['merge']({},_0x286058,_0x5a3951[_0x4349('0x3e')]);return db['OpenchannelApplication'][_0x4349('0x3f')](_0x286058)[_0x4349('0x21')](handleEntityNotFound(_0x55cc79,null))[_0x4349('0x21')](respondWithResult(_0x55cc79,null))[_0x4349('0x40')](handleError(_0x55cc79,null));};exports['create']=function(_0x12991b,_0x3f266b){return db[_0x4349('0x39')][_0x4349('0x41')](_0x12991b[_0x4349('0x42')],{})['then'](respondWithResult(_0x3f266b,0xc9))[_0x4349('0x40')](handleError(_0x3f266b,null));};exports[_0x4349('0x1f')]=function(_0x3f23fc,_0x410d39){if(_0x3f23fc[_0x4349('0x42')]['id']){delete _0x3f23fc[_0x4349('0x42')]['id'];}return db['OpenchannelApplication'][_0x4349('0x3f')]({'where':{'id':_0x3f23fc[_0x4349('0x3c')]['id']}})[_0x4349('0x21')](handleEntityNotFound(_0x410d39,null))['then'](saveUpdates(_0x3f23fc[_0x4349('0x42')],null))[_0x4349('0x21')](respondWithResult(_0x410d39,null))[_0x4349('0x40')](handleError(_0x410d39,null));};exports[_0x4349('0x20')]=function(_0x58df80,_0x274406){return db[_0x4349('0x39')][_0x4349('0x3f')]({'where':{'id':_0x58df80[_0x4349('0x3c')]['id']}})[_0x4349('0x21')](handleEntityNotFound(_0x274406,null))[_0x4349('0x21')](removeEntity(_0x274406,null))[_0x4349('0x40')](handleError(_0x274406,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 373ffd3..1b5fdbb 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 _0x31b2=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4'];(function(_0x214aa2,_0x41b96e){var _0x3798e6=function(_0x3a7fd6){while(--_0x3a7fd6){_0x214aa2['push'](_0x214aa2['shift']());}};_0x3798e6(++_0x41b96e);}(_0x31b2,0x6c));var _0x231b=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0x31b2[_0x38e177];return _0x1faf15;};'use strict';var _=require(_0x231b('0x0'));var util=require(_0x231b('0x1'));var logger=require(_0x231b('0x2'))('api');var moment=require(_0x231b('0x3'));var BPromise=require('bluebird');var rp=require(_0x231b('0x4'));var fs=require('fs');var path=require(_0x231b('0x5'));var rimraf=require(_0x231b('0x6'));var config=require(_0x231b('0x7'));var attributes=require(_0x231b('0x8'));module[_0x231b('0x9')]=function(_0x26f02a,_0x2f1843){return _0x26f02a['define']('OpenchannelApplication',attributes,{'tableName':_0x231b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x231b('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4d33=['bluebird','request-promise','rimraf','../../config/environment','define','OpenchannelApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x4d4fcf,_0x41bcea){var _0x31b21c=function(_0x4988d4){while(--_0x4988d4){_0x4d4fcf['push'](_0x4d4fcf['shift']());}};_0x31b21c(++_0x41bcea);}(_0x4d33,0xac));var _0x34d3=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4d33[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x34d3('0x0'));var util=require(_0x34d3('0x1'));var logger=require(_0x34d3('0x2'))('api');var moment=require(_0x34d3('0x3'));var BPromise=require(_0x34d3('0x4'));var rp=require(_0x34d3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x34d3('0x6'));var config=require(_0x34d3('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x3d9b5f,_0x17616e){return _0x3d9b5f[_0x34d3('0x8')](_0x34d3('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x34d3('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 5c998b5..10638b7 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 _0x354b=['request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','limit','then','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x405202,_0xaacb44){var _0x300d57=function(_0xf9fb28){while(--_0xf9fb28){_0x405202['push'](_0x405202['shift']());}};_0x300d57(++_0xaacb44);}(_0x354b,0xd6));var _0xb354=function(_0x3bb10b,_0x546bc2){_0x3bb10b=_0x3bb10b-0x0;var _0x19d91b=_0x354b[_0x3bb10b];return _0x19d91b;};'use strict';var _=require(_0xb354('0x0'));var util=require('util');var moment=require(_0xb354('0x1'));var BPromise=require(_0xb354('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb354('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb354('0x4'))(_0xb354('0x5'));var config=require(_0xb354('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb354('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x401ec7,_0xb2feda,_0x1df9ea){return new BPromise(function(_0x393868,_0x4a6d08){return client[_0xb354('0x8')](_0x401ec7,_0x1df9ea)['then'](function(_0x318573){logger['info'](_0xb354('0x9'),_0xb2feda,_0xb354('0xa'));logger[_0xb354('0xb')](_0xb354('0xc'),_0xb2feda,_0xb354('0xa'),JSON[_0xb354('0xd')](_0x318573));if(_0x318573['error']){if(_0x318573[_0xb354('0xe')][_0xb354('0xf')]===0x1f4){logger[_0xb354('0xe')](_0xb354('0x9'),_0xb2feda,_0x318573[_0xb354('0xe')][_0xb354('0x10')]);return _0x4a6d08(_0x318573['error']['message']);}logger[_0xb354('0xe')](_0xb354('0x9'),_0xb2feda,_0x318573['error'][_0xb354('0x10')]);return _0x393868(_0x318573['error']['message']);}else{logger[_0xb354('0x11')](_0xb354('0x9'),_0xb2feda,'request\x20sent');_0x393868(_0x318573[_0xb354('0x12')][_0xb354('0x10')]);}})['catch'](function(_0x429d6a){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xb2feda,_0x429d6a);_0x4a6d08(_0x429d6a);});});}exports[_0xb354('0x13')]=function(_0x2584be){var _0x23eddc=this;return new Promise(function(_0x24806d,_0x59d6ef){return db[_0xb354('0x14')][_0xb354('0x15')](_0x2584be[_0xb354('0x16')],{'raw':_0x2584be['options']?_0x2584be[_0xb354('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2584be[_0xb354('0x17')]?_0x2584be['options'][_0xb354('0x18')]||null:null,'attributes':_0x2584be[_0xb354('0x17')]?_0x2584be[_0xb354('0x17')]['attributes']||null:null,'limit':_0x2584be['options']?_0x2584be['options'][_0xb354('0x19')]||null:null})[_0xb354('0x1a')](function(_0x761ff3){logger['info'](_0xb354('0x13'),_0x2584be);logger[_0xb354('0xb')](_0xb354('0x13'),_0x2584be,JSON['stringify'](_0x761ff3));_0x24806d(_0x761ff3);})[_0xb354('0x1b')](function(_0x3ac5aa){logger[_0xb354('0xe')](_0xb354('0x13'),_0x3ac5aa[_0xb354('0x10')],_0x2584be);_0x59d6ef(_0x23eddc[_0xb354('0xe')](0x1f4,_0x3ac5aa['message']));});});}; \ No newline at end of file +var _0x5410=['debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','catch','OpenchannelApplication','update','body','options','where','then','UpdateOpenchannelApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent'];(function(_0x15e11,_0x4efcdf){var _0x56f2c2=function(_0x27905b){while(--_0x27905b){_0x15e11['push'](_0x15e11['shift']());}};_0x56f2c2(++_0x4efcdf);}(_0x5410,0xa0));var _0x0541=function(_0x3a8255,_0x8e978b){_0x3a8255=_0x3a8255-0x0;var _0x42b122=_0x5410[_0x3a8255];return _0x42b122;};'use strict';var _=require('lodash');var util=require(_0x0541('0x0'));var moment=require(_0x0541('0x1'));var BPromise=require(_0x0541('0x2'));var rs=require(_0x0541('0x3'));var fs=require('fs');var Redis=require(_0x0541('0x4'));var db=require(_0x0541('0x5'))['db'];var utils=require(_0x0541('0x6'));var logger=require(_0x0541('0x7'))(_0x0541('0x8'));var config=require(_0x0541('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0541('0xa')][_0x0541('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a79e8,_0xb7df5c,_0x4903c2){return new BPromise(function(_0x1ba982,_0x378f2d){return client['request'](_0x1a79e8,_0x4903c2)['then'](function(_0x22ad8f){logger[_0x0541('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0xb7df5c,_0x0541('0xd'));logger[_0x0541('0xe')](_0x0541('0xf'),_0xb7df5c,_0x0541('0xd'),JSON[_0x0541('0x10')](_0x22ad8f));if(_0x22ad8f[_0x0541('0x11')]){if(_0x22ad8f[_0x0541('0x11')][_0x0541('0x12')]===0x1f4){logger[_0x0541('0x11')](_0x0541('0x13'),_0xb7df5c,_0x22ad8f[_0x0541('0x11')]['message']);return _0x378f2d(_0x22ad8f[_0x0541('0x11')]['message']);}logger[_0x0541('0x11')](_0x0541('0x13'),_0xb7df5c,_0x22ad8f[_0x0541('0x11')][_0x0541('0x14')]);return _0x1ba982(_0x22ad8f[_0x0541('0x11')]['message']);}else{logger[_0x0541('0xc')](_0x0541('0x13'),_0xb7df5c,_0x0541('0xd'));_0x1ba982(_0x22ad8f['result'][_0x0541('0x14')]);}})[_0x0541('0x15')](function(_0x15ba6e){logger[_0x0541('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0xb7df5c,_0x15ba6e);_0x378f2d(_0x15ba6e);});});}exports['UpdateOpenchannelApplication']=function(_0x579de5){var _0x1dcad5=this;return new Promise(function(_0x1aa78c,_0x506507){return db[_0x0541('0x16')][_0x0541('0x17')](_0x579de5[_0x0541('0x18')],{'raw':_0x579de5[_0x0541('0x19')]?_0x579de5[_0x0541('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x579de5[_0x0541('0x19')]?_0x579de5[_0x0541('0x19')][_0x0541('0x1a')]||null:null,'attributes':_0x579de5[_0x0541('0x19')]?_0x579de5[_0x0541('0x19')]['attributes']||null:null,'limit':_0x579de5[_0x0541('0x19')]?_0x579de5[_0x0541('0x19')]['limit']||null:null})[_0x0541('0x1b')](function(_0x32b891){logger[_0x0541('0xc')]('UpdateOpenchannelApplication',_0x579de5);logger[_0x0541('0xe')](_0x0541('0x1c'),_0x579de5,JSON['stringify'](_0x32b891));_0x1aa78c(_0x32b891);})['catch'](function(_0x51ab32){logger['error'](_0x0541('0x1c'),_0x51ab32[_0x0541('0x14')],_0x579de5);_0x506507(_0x1dcad5['error'](0x1f4,_0x51ab32['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 0b52706..0edef82 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 _0x62c2=['./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x2d4f08,_0x1c3c2c){var _0x10b031=function(_0x340e33){while(--_0x340e33){_0x2d4f08['push'](_0x2d4f08['shift']());}};_0x10b031(++_0x1c3c2c);}(_0x62c2,0x1d8));var _0x262c=function(_0x55c1d2,_0x180516){_0x55c1d2=_0x55c1d2-0x0;var _0x4b49a3=_0x62c2[_0x55c1d2];return _0x4b49a3;};'use strict';var multer=require(_0x262c('0x0'));var util=require(_0x262c('0x1'));var path=require(_0x262c('0x2'));var timeout=require(_0x262c('0x3'));var express=require(_0x262c('0x4'));var router=express[_0x262c('0x5')]();var fs_extra=require(_0x262c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x262c('0x7'));var controller=require(_0x262c('0x8'));router[_0x262c('0x9')]('/',auth[_0x262c('0xa')](),controller[_0x262c('0xb')]);router[_0x262c('0x9')](_0x262c('0xc'),auth[_0x262c('0xa')](),controller[_0x262c('0xd')]);router[_0x262c('0x9')](_0x262c('0xe'),auth['isAuthenticated'](),controller[_0x262c('0xf')]);router[_0x262c('0x9')](_0x262c('0x10'),auth[_0x262c('0xa')](),controller[_0x262c('0x11')]);router[_0x262c('0x9')](_0x262c('0x12'),auth[_0x262c('0xa')](),controller['download']);router[_0x262c('0x13')]('/',auth[_0x262c('0xa')](),controller[_0x262c('0x14')]);router['post']('/:id/messages',auth[_0x262c('0xa')](),controller['addMessage']);router['post'](_0x262c('0x15'),auth['isAuthenticated'](),interaction[_0x262c('0x16')](_0x262c('0x17'),_0x262c('0x18')),controller[_0x262c('0x19')]);router['put'](_0x262c('0xe'),auth[_0x262c('0xa')](),interaction[_0x262c('0x16')](_0x262c('0x17'),_0x262c('0x1a')),controller[_0x262c('0x1b')]);router[_0x262c('0x1c')](_0x262c('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0x262c('0x17'),'openchannelinteraction:destroy'),controller[_0x262c('0x1d')]);router[_0x262c('0x1c')](_0x262c('0x15'),auth[_0x262c('0xa')](),controller[_0x262c('0x1e')]);module[_0x262c('0x1f')]=router; \ No newline at end of file +var _0x4436=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','addMessage','/:id/tags','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update','delete','openchannel','openchannelinteraction:destroy'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0x4436,0x7a));var _0x6443=function(_0xde8955,_0x246b3b){_0xde8955=_0xde8955-0x0;var _0x1886be=_0x4436[_0xde8955];return _0x1886be;};'use strict';var multer=require('multer');var util=require(_0x6443('0x0'));var path=require(_0x6443('0x1'));var timeout=require(_0x6443('0x2'));var express=require(_0x6443('0x3'));var router=express[_0x6443('0x4')]();var fs_extra=require(_0x6443('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6443('0x6'));var config=require(_0x6443('0x7'));var controller=require(_0x6443('0x8'));router[_0x6443('0x9')]('/',auth[_0x6443('0xa')](),controller[_0x6443('0xb')]);router[_0x6443('0x9')](_0x6443('0xc'),auth[_0x6443('0xa')](),controller[_0x6443('0xd')]);router['get'](_0x6443('0xe'),auth[_0x6443('0xa')](),controller[_0x6443('0xf')]);router[_0x6443('0x9')](_0x6443('0x10'),auth[_0x6443('0xa')](),controller['getMessages']);router['get']('/:id/download',auth[_0x6443('0xa')](),controller[_0x6443('0x11')]);router[_0x6443('0x12')]('/',auth[_0x6443('0xa')](),controller['create']);router['post'](_0x6443('0x10'),auth[_0x6443('0xa')](),controller[_0x6443('0x13')]);router['post'](_0x6443('0x14'),auth[_0x6443('0xa')](),interaction['tracked']('openchannel',_0x6443('0x15')),controller['addTags']);router[_0x6443('0x16')](_0x6443('0xe'),auth['isAuthenticated'](),interaction[_0x6443('0x17')]('openchannel',_0x6443('0x18')),controller['update']);router[_0x6443('0x19')](_0x6443('0xe'),auth['isAuthenticated'](),interaction[_0x6443('0x17')](_0x6443('0x1a'),_0x6443('0x1b')),controller[_0x6443('0x1c')]);router['delete'](_0x6443('0x14'),auth[_0x6443('0xa')](),controller['removeTags']);module[_0x6443('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9883056..eb51ef4 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 _0xaa3f=['exports','DATE','STRING','ENUM','BOOLEAN','sequelize'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xaa3f,0x95));var _0xfaa3=function(_0x337bee,_0x53cbca){_0x337bee=_0x337bee-0x0;var _0x24c37d=_0xaa3f[_0x337bee];return _0x24c37d;};'use strict';var Sequelize=require(_0xfaa3('0x0'));module[_0xfaa3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfaa3('0x2')]},'disposition':{'type':Sequelize[_0xfaa3('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfaa3('0x3')]},'read1stAt':{'type':Sequelize[_0xfaa3('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xfaa3('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfaa3('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xfaa3('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xfaa3('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x1b69=['DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x101e0a,_0x2e76b7){var _0xf80304=function(_0x112bbb){while(--_0x112bbb){_0x101e0a['push'](_0x101e0a['shift']());}};_0xf80304(++_0x2e76b7);}(_0x1b69,0x190));var _0x91b6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1b69[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x91b6('0x0')]},'disposition':{'type':Sequelize[_0x91b6('0x1')]},'secondDisposition':{'type':Sequelize[_0x91b6('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x91b6('0x1')]},'read1stAt':{'type':Sequelize[_0x91b6('0x0')]},'threadId':{'type':Sequelize[_0x91b6('0x1')]},'externalUrl':{'type':Sequelize[_0x91b6('0x1')]},'lastMsgAt':{'type':Sequelize[_0x91b6('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x91b6('0x2')]('in',_0x91b6('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x91b6('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0x91b6('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 112e29b..a437082 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 _0x7252=['tools_tags','expr','search','parseSearch','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','i.id','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','sequelize','keyBy','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','params','includeAll','include','options','create','update','body','describe','addMessage','ids','omit','getMessages','findOne','merge','format','OpenchannelMessage','addTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','Public','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','end','stack','name','send','fullname','TagIds','Tags','split','forEach','push','catch','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id'];(function(_0x20f318,_0x4ae4ba){var _0x543ebf=function(_0x34df4c){while(--_0x34df4c){_0x20f318['push'](_0x20f318['shift']());}};_0x543ebf(++_0x4ae4ba);}(_0x7252,0x177));var _0x2725=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0x7252[_0x1deb72];return _0x18bbdf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2725('0x0'));var zipdir=require(_0x2725('0x1'));var jsonpatch=require(_0x2725('0x2'));var rp=require(_0x2725('0x3'));var moment=require('moment');var BPromise=require(_0x2725('0x4'));var Mustache=require(_0x2725('0x5'));var util=require(_0x2725('0x6'));var path=require('path');var sox=require(_0x2725('0x7'));var csv=require('to-csv');var ejs=require(_0x2725('0x8'));var fs=require('fs');var fs_extra=require(_0x2725('0x9'));var _=require('lodash');var squel=require(_0x2725('0xa'));var crypto=require('crypto');var jsforce=require(_0x2725('0xb'));var deskjs=require(_0x2725('0xc'));var toCsv=require(_0x2725('0xd'));var querystring=require(_0x2725('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2725('0xf'));var as=require(_0x2725('0x10'));var pdf=require(_0x2725('0x11'));var hardwareService=require(_0x2725('0x12'));var logger=require(_0x2725('0x13'))('api');var utils=require(_0x2725('0x14'));var config=require(_0x2725('0x15'));var licenseUtil=require(_0x2725('0x16'));var db=require('../../mysqldb')['db'];config[_0x2725('0x17')]=_[_0x2725('0x18')](config[_0x2725('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2725('0x19'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x2725('0x1a')](socket);function respondWithStatusCode(_0x5a69dc,_0x9581c7){_0x9581c7=_0x9581c7||0xcc;return function(_0x50058a){if(_0x50058a){return _0x5a69dc[_0x2725('0x1b')](_0x9581c7);}return _0x5a69dc['status'](_0x9581c7)['end']();};}function respondWithResult(_0x1f636c,_0x40d67a){_0x40d67a=_0x40d67a||0xc8;return function(_0x9957cf){if(_0x9957cf){return _0x1f636c[_0x2725('0x1c')](_0x40d67a)[_0x2725('0x1d')](_0x9957cf);}};}function respondWithFilteredResult(_0x1347ea,_0x37f67b){return function(_0x29fac8){if(_0x29fac8){var _0x33e88b=typeof _0x37f67b[_0x2725('0x1e')]===_0x2725('0x1f')&&typeof _0x37f67b[_0x2725('0x20')]===_0x2725('0x1f');var _0x48b4c2=_0x29fac8[_0x2725('0x21')];var _0x106c9c=_0x33e88b?0x0:_0x37f67b['offset'];var _0xf99564=_0x33e88b?_0x29fac8[_0x2725('0x21')]:_0x37f67b[_0x2725('0x1e')]+_0x37f67b[_0x2725('0x20')];var _0x46284c;if(_0xf99564>=_0x48b4c2){_0xf99564=_0x48b4c2;_0x46284c=0xc8;}else{_0x46284c=0xce;}_0x1347ea[_0x2725('0x1c')](_0x46284c);return _0x1347ea['set'](_0x2725('0x22'),_0x106c9c+'-'+_0xf99564+'/'+_0x48b4c2)[_0x2725('0x1d')](_0x29fac8);}return null;};}function patchUpdates(_0x1d9712){return function(_0x5c1128){try{jsonpatch[_0x2725('0x23')](_0x5c1128,_0x1d9712,!![]);}catch(_0x1c6481){return BPromise[_0x2725('0x24')](_0x1c6481);}return _0x5c1128['save']();};}function saveUpdates(_0x426e10,_0x4bf0a9){return function(_0x4a0ba5){if(_0x4a0ba5){return _0x4a0ba5['update'](_0x426e10)['then'](function(_0x4286cc){return _0x4286cc;});}return null;};}function removeEntity(_0x3eb901,_0x56b108){return function(_0x497ed2){if(_0x497ed2){return _0x497ed2[_0x2725('0x25')]()[_0x2725('0x26')](function(){_0x3eb901[_0x2725('0x1c')](0xcc)[_0x2725('0x27')]();});}};}function handleEntityNotFound(_0x203dbe,_0x5326d7){return function(_0x27ad00){if(!_0x27ad00){_0x203dbe[_0x2725('0x1b')](0x194);}return _0x27ad00;};}function handleError(_0x21018d,_0x3ef869){_0x3ef869=_0x3ef869||0x1f4;return function(_0x4fc694){logger['error'](_0x4fc694[_0x2725('0x28')]);if(_0x4fc694[_0x2725('0x29')]){delete _0x4fc694[_0x2725('0x29')];}_0x21018d[_0x2725('0x1c')](_0x3ef869)[_0x2725('0x2a')](_0x4fc694);};}function getInteractionUsers(_0x138126,_0x494f6a){return new BPromise(function(_0x21927d,_0x57cd14){try{if(_0x494f6a[_0x138126['id']]){_0x138126['Users']=_['map'](_0x494f6a[_0x138126['id']],function(_0x3ab61a){return{'id':_0x3ab61a['id'],'fullname':_0x3ab61a[_0x2725('0x2b')]};});}}catch(_0x572da7){_0x57cd14(_0x572da7);}_0x21927d(_0x138126);});}function getInteractionTags(_0x528d12,_0x2a2d5e){return new BPromise(function(_0x3b701e,_0x3d1ad1){try{if(_0x528d12[_0x2725('0x2c')]){_0x528d12[_0x2725('0x2d')]=[];_0x528d12[_0x2725('0x2c')][_0x2725('0x2e')](',')[_0x2725('0x2f')](function(_0x30ba6d){_0x528d12['Tags'][_0x2725('0x30')](_0x2a2d5e[_0x30ba6d]);});}delete _0x528d12['TagIds'];}catch(_0x56a7a4){_0x3d1ad1(_0x56a7a4);}_0x3b701e(_0x528d12);});}function updateOpenchannelInteraction(_0x4bb2c8,_0x5594ac,_0x5b146d){return new BPromise(function(_0x30fad9,_0x5c5dd6){return getInteractionUsers(_0x4bb2c8,_0x5b146d)[_0x2725('0x26')](function(_0x44bc4b){return getInteractionTags(_0x44bc4b,_0x5594ac);})['then'](function(_0x335ceb){_0x30fad9(_0x335ceb);})[_0x2725('0x31')](function(_0x5dbe95){_0x5c5dd6(_0x5dbe95);});});}exports[_0x2725('0x32')]=function(_0x5a7bce,_0x3040a8){var _0xb9195={},_0x1a4e70={},_0x1c0ac3={'count':0x0,'rows':[]};var _0x41e08a=_[_0x2725('0x33')](db[_0x2725('0x34')][_0x2725('0x35')],function(_0x2579a7){return{'name':_0x2579a7[_0x2725('0x36')],'type':_0x2579a7['type'][_0x2725('0x37')]};});_0x1a4e70[_0x2725('0x38')]=_[_0x2725('0x33')](_0x41e08a,'name');_0x1a4e70[_0x2725('0x39')]=_[_0x2725('0x3a')](_0x5a7bce[_0x2725('0x39')]);_0x1a4e70[_0x2725('0x3b')]=_[_0x2725('0x3c')](_0x1a4e70['model'],_0x1a4e70[_0x2725('0x39')]);_0xb9195[_0x2725('0x3d')]=_['intersection'](_0x1a4e70['model'],qs[_0x2725('0x3e')](_0x5a7bce['query'][_0x2725('0x3e')]));_0xb9195[_0x2725('0x3d')]=_0xb9195[_0x2725('0x3d')][_0x2725('0x3f')]?_0xb9195[_0x2725('0x3d')]:_0x1a4e70[_0x2725('0x38')];if(!_0x5a7bce[_0x2725('0x39')][_0x2725('0x40')](_0x2725('0x41'))){_0xb9195[_0x2725('0x20')]=qs['limit'](_0x5a7bce[_0x2725('0x39')][_0x2725('0x20')]);_0xb9195['offset']=qs[_0x2725('0x1e')](_0x5a7bce[_0x2725('0x39')][_0x2725('0x1e')]);}_0xb9195[_0x2725('0x42')]=qs['sort'](_0x5a7bce[_0x2725('0x39')][_0x2725('0x43')]);_0xb9195[_0x2725('0x44')]=qs[_0x2725('0x3b')](_[_0x2725('0x45')](_0x5a7bce[_0x2725('0x39')],_0x1a4e70[_0x2725('0x3b')]),_0x41e08a);var _0x499c88=[];var _0x5a03e7=squel['select']()[_0x2725('0x46')]('id')[_0x2725('0x46')]('name')[_0x2725('0x46')](_0x2725('0x47'))[_0x2725('0x48')]('tools_tags');var _0xbf7074=squel[_0x2725('0x49')]()[_0x2725('0x46')](_0x2725('0x4a'))[_0x2725('0x46')](_0x2725('0x4b'))[_0x2725('0x46')](_0x2725('0x4c'))[_0x2725('0x48')](_0x2725('0x4d'),'ui')[_0x2725('0x4e')]('users','u','u.id\x20=\x20ui.UserId');var _0x4a0404=squel['select']()[_0x2725('0x48')](_0x2725('0x4f'),'i')[_0x2725('0x4e')](_0x2725('0x50'),'c',_0x2725('0x51'))[_0x2725('0x4e')](_0x2725('0x52'),'o',_0x2725('0x53'))[_0x2725('0x4e')]('openchannel_accounts','a',_0x2725('0x54'))['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x2725('0x55'),'it',_0x2725('0x56'))[_0x2725('0x4e')](_0x2725('0x57'),'t','t.id\x20=\x20it.TagId');var _0x4af951=squel[_0x2725('0x58')]();var _0x55350b=[];var _0x195677=squel[_0x2725('0x58')]();var _0xcd16d6;if(_0x5a7bce['query'][_0x2725('0x59')]){_0xcd16d6=as[_0x2725('0x5a')](_0x5a7bce[_0x2725('0x39')][_0x2725('0x59')]);var _0x4c7e45=_0xcd16d6['sqlOperator'];for(var _0x3a333d=0x0;_0x3a333d<_0xcd16d6['conditions'][_0x2725('0x3f')];_0x3a333d++){var _0x1f0d2f=_0xcd16d6['conditions'][_0x3a333d];var _0x18226b='i';var _0x3951fa=_[_0x2725('0x5b')](_0x41e08a,[_0x2725('0x29'),_0x1f0d2f['field']]);if(!_0x3951fa){switch(_0x1f0d2f['field']){case _0x2725('0x5c'):if(_0x1f0d2f[_0x2725('0x5d')]==0x1){_0x4a0404['having']('`'+_0x1f0d2f['field']+_0x2725('0x5e'));}else{_0x4a0404['having']('`'+_0x1f0d2f['field']+_0x2725('0x5f'));}break;case _0x2725('0x60'):if(_0x1f0d2f['operator']===_0x2725('0x61')){if(_0x1f0d2f[_0x2725('0x5d')]['split']('\x20')[_0x2725('0x3f')]>0x1){_0x4af951[_0x4c7e45](_0x2725('0x62'),qs['getFullTextValue'](_0x1f0d2f[_0x2725('0x5d')]),null);}else{var _0x5a85dd='%'+_0x1f0d2f[_0x2725('0x5d')]+'%';_0x4af951[_0x4c7e45](_0x2725('0x63'),_0x5a85dd,_0x5a85dd,_0x5a85dd);}}else{_0x3951fa=_[_0x2725('0x5b')](_0x41e08a,['name','ContactId']);_0x1f0d2f[_0x2725('0x46')]='ContactId';_0x2e99fa=as[_0x2725('0x64')](_0x18226b,_0x3951fa[_0x2725('0x65')],_0x1f0d2f);_0x4af951[_0x4c7e45](_0x2e99fa['text'],_0x2e99fa[_0x2725('0x5d')][_0x2725('0x66')],_0x2e99fa['value'][_0x2725('0x27')]);}break;case _0x2725('0x67'):var _0x28ded4=_0x1f0d2f[_0x2725('0x5d')][_0x2725('0x2e')](',')[_0x2725('0x33')](function(_0x1b8b6e){return Number(_0x1b8b6e);});_0x28ded4[_0x2725('0x2f')](function(_0x3e8fea){_0x195677['or'](_0x2725('0x68'),'%,'+_0x3e8fea+',%');});_0x55350b=_[_0x2725('0x69')](_0x55350b,_0x28ded4);break;case _0x2725('0x6a'):if(_0x1f0d2f[_0x2725('0x6b')]==='$substring'){_0x4af951[_0x4c7e45](_0x2725('0x6c'),'%'+_0x1f0d2f[_0x2725('0x5d')]+'%',null);}else{_0x3951fa=_[_0x2725('0x5b')](_0x41e08a,['name',_0x2725('0x6d')]);_0x1f0d2f[_0x2725('0x46')]=_0x2725('0x6d');_0x2e99fa=as[_0x2725('0x64')](_0x18226b,_0x3951fa[_0x2725('0x65')],_0x1f0d2f);_0x4af951[_0x4c7e45](_0x2e99fa['text'],_0x2e99fa[_0x2725('0x5d')][_0x2725('0x66')],_0x2e99fa[_0x2725('0x5d')][_0x2725('0x27')]);}break;case'body':_0x2e99fa=as[_0x2725('0x64')]('me',null,_0x1f0d2f);_0x4af951[_0x4c7e45](_0x2e99fa[_0x2725('0x6e')],_0x2e99fa[_0x2725('0x5d')][_0x2725('0x66')],_0x2e99fa[_0x2725('0x5d')]['end']);break;}}else{var _0x2e99fa=as[_0x2725('0x64')](_0x18226b,_0x3951fa[_0x2725('0x65')],_0x1f0d2f);_0x4af951[_0x4c7e45](_0x2e99fa[_0x2725('0x6e')],_0x2e99fa[_0x2725('0x5d')]['start'],_0x2e99fa['value'][_0x2725('0x27')]);}}}else{var _0x485bc5=_(_0x5a7bce[_0x2725('0x39')])[_0x2725('0x3a')]()[_0x2725('0x33')](function(_0x529e68){return _[_0x2725('0x6f')](_0x41e08a,[_0x2725('0x29'),_0x529e68])?_0x529e68:undefined;})[_0x2725('0x70')]()[_0x2725('0x5d')]();if(!_[_0x2725('0x71')](_0x485bc5)){_0x485bc5[_0x2725('0x2f')](function(_0x5907a3){if(_0x5907a3===_0x2725('0x72')){_0x4a0404['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x2725('0x73')](_0x5a7bce[_0x2725('0x39')][_0x5907a3]));}else if(_0x5907a3===_0x2725('0x74')){var _0xda902=JSON[_0x2725('0x75')](_0x5a7bce[_0x2725('0x39')][_0x5907a3])[_0x2725('0x76')];var _0x3c0d3e=JSON[_0x2725('0x75')](_0x5a7bce['query'][_0x5907a3])['$lte'];_0x4a0404[_0x2725('0x44')](_0x2725('0x77'),_0xda902,_0x3c0d3e);}else{if(_0x5a7bce['query'][_0x5907a3]===_0x2725('0x78')){_0x4a0404['where']('i.'+_0x5907a3+_0x2725('0x79'));}else{_0x4a0404[_0x2725('0x44')]('i.'+_0x5907a3+_0x2725('0x7a'),_0x5a7bce[_0x2725('0x39')][_0x5907a3]);}}});}if(_0x5a7bce[_0x2725('0x39')][_0x2725('0x7b')]){if(_0x5a7bce[_0x2725('0x39')]['read']==0x1){_0x4a0404[_0x2725('0x7c')](_0x2725('0x7d'));}else{_0x4a0404[_0x2725('0x7c')]('`unreadMessages`\x20>\x200');}}if(_0x5a7bce[_0x2725('0x39')][_0x2725('0x7e')]){_0x55350b=_[_0x2725('0x7f')](_0x5a7bce[_0x2725('0x39')]['tag'])?_0x5a7bce[_0x2725('0x39')]['tag']:new Array(_0x5a7bce[_0x2725('0x39')][_0x2725('0x7e')]);_0x55350b['forEach'](function(_0x5b31e3){_0x195677['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5b31e3+',%');});}if(_0x5a7bce[_0x2725('0x39')][_0x2725('0x80')]){var _0x281aed=_0x5a7bce[_0x2725('0x39')]['filter'][_0x2725('0x81')]('\x5c','\x5c\x5c')[_0x2725('0x81')](/'/g,'\x27\x27');if(qs[_0x2725('0x82')](_0x281aed)){_0x4af951['or'](_0x2725('0x83'),_0x281aed+'%');}else{_0x4af951['or'](_0x2725('0x84'),qs['getFullTextValue'](_0x281aed))['or'](_0x2725('0x85'),_0x281aed+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x281aed+'%');}}}_0x4a0404[_0x2725('0x44')](_0x4af951);_0x4a0404['group'](_0x2725('0x86'));var _0x310406={'type':db['Sequelize']['QueryTypes'][_0x2725('0x87')],'raw':!![]};var _0xa8385c=_0x4a0404[_0x2725('0x88')]();_0xa8385c[_0x2725('0x46')](_0x2725('0x86'));_0xa8385c[_0x2725('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xb9195[_0x2725('0x42')]){_0xb9195['order']['forEach'](function(_0x414af9){var _0x475980=_0x414af9[0x0]===_0x2725('0x89')?_0x414af9[0x0]:'i.'+_0x414af9[0x0];_0x4a0404[_0x2725('0x42')](_0x475980,_0x414af9[0x1]===_0x2725('0x8a')?![]:!![]);});}if(!_[_0x2725('0x71')](_0x55350b)){_0x4a0404[_0x2725('0x7c')](_0x195677);_0xa8385c['where'](_0x2725('0x8b'),_0x55350b);}BPromise[_0x2725('0x8c')]()[_0x2725('0x26')](function(){if(!_0xcd16d6){if(_0x5a7bce['query'][_0x2725('0x72')])return;_0xa8385c[_0x2725('0x44')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x4a0404['where'](_0x2725('0x8d'));return;}if(_0x5a7bce['user']['role']!==_0x2725('0x8e'))return;return _0x5a7bce[_0x2725('0x8f')][_0x2725('0x90')]({'attributes':['id'],'raw':!![]})[_0x2725('0x26')](function(_0x4dbd3f){if(_['isEmpty'](_0x4dbd3f)){_0xa8385c[_0x2725('0x44')](_0x2725('0x91'));_0x4a0404['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0xa8385c[_0x2725('0x44')](_0x2725('0x92'),_[_0x2725('0x33')](_0x4dbd3f,'id'));_0x4a0404[_0x2725('0x44')](_0x2725('0x92'),_[_0x2725('0x33')](_0x4dbd3f,'id'));}});})[_0x2725('0x26')](function(){if(_0x5a7bce[_0x2725('0x8f')]['role']===_0x2725('0x8e')&&!_0xcd16d6&&!_0x5a7bce[_0x2725('0x39')][_0x2725('0x72')])return[];return db['sequelize']['query'](_0xa8385c[_0x2725('0x93')](),_0x310406);})[_0x2725('0x26')](function(_0xae0799){_0x1c0ac3[_0x2725('0x21')]=_0xae0799['length'];if(_0x1c0ac3[_0x2725('0x21')]===0x0)return[];return db[_0x2725('0x94')]['query'](_0x5a03e7[_0x2725('0x93')](),_0x310406)[_0x2725('0x26')](function(_0x5b6d6b){_0x499c88=_[_0x2725('0x95')](_0x5b6d6b,'id');_0x310406=_['merge'](_0x310406,{'model':db[_0x2725('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a7bce[_0x2725('0x39')]['fields']){_0xb9195[_0x2725('0x3d')][_0x2725('0x2f')](function(_0x18dec4){_0x4a0404[_0x2725('0x46')]('i.'+_0x18dec4);});}else{_0x4a0404['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2725('0x5c'));_0x4a0404[_0x2725('0x46')]('a.key','Account.key');_0x4a0404[_0x2725('0x46')](_0x2725('0x96'),_0x2725('0x97'));_0x4a0404[_0x2725('0x46')](_0x2725('0x98'),_0x2725('0x89'));_0x4a0404['field']('i.*');_0x4a0404[_0x2725('0x46')](_0x2725('0x99'),_0x2725('0x9a'));_0x4a0404[_0x2725('0x46')]('c.lastName',_0x2725('0x9b'));_0x4a0404[_0x2725('0x46')]('c.email',_0x2725('0x9c'));_0x4a0404[_0x2725('0x46')](_0x2725('0x9d'),'Contact.phone');_0x4a0404[_0x2725('0x46')](_0x2725('0x9e'),'Contact.mobile');_0x4a0404[_0x2725('0x46')]('c.fax',_0x2725('0x9f'));_0x4a0404['field'](_0x2725('0xa0'),_0x2725('0xa1'));_0x4a0404[_0x2725('0x46')](_0x2725('0xa2'),_0x2725('0xa3'));_0x4a0404[_0x2725('0x46')](_0x2725('0xa4'),_0x2725('0x2c'));}if(_0xb9195['limit'])_0x4a0404[_0x2725('0x20')](_0xb9195[_0x2725('0x20')]);if(_0xb9195[_0x2725('0x1e')])_0x4a0404['offset'](_0xb9195[_0x2725('0x1e')]);return db[_0x2725('0x94')][_0x2725('0x39')](_0x4a0404[_0x2725('0x93')](),_0x310406);})[_0x2725('0x26')](function(_0x3c8b2b){if(_0x3c8b2b[_0x2725('0x3f')]>0x0)_0xbf7074[_0x2725('0x44')](_0x2725('0xa5'),_['map'](_0x3c8b2b,'id'));return db['sequelize'][_0x2725('0x39')](_0xbf7074[_0x2725('0x93')](),_0x310406)[_0x2725('0x26')](function(_0x3ca596){var _0x103674=_[_0x2725('0xa6')](_0x3ca596,_0x2725('0xa7'));var _0x235aa2=[];_0x3c8b2b[_0x2725('0x2f')](function(_0x4a4844){_0x235aa2[_0x2725('0x30')](updateOpenchannelInteraction(_0x4a4844,_0x499c88,_0x103674));});return BPromise[_0x2725('0xa8')](_0x235aa2);});});})[_0x2725('0x26')](function(_0x5ef50a){_0x1c0ac3[_0x2725('0xa9')]=_0x5ef50a;return _0x1c0ac3;})[_0x2725('0x26')](respondWithFilteredResult(_0x3040a8,_0xb9195))[_0x2725('0x31')](handleError(_0x3040a8,null));};exports['show']=function(_0x30a21a,_0x3d2e51){var _0x39b1ff={};if(_0x30a21a['query'][_0x2725('0x65')]&&_0x30a21a['query']['type']===_0x2725('0x48')){_0x39b1ff[_0x2725('0x48')]=_0x30a21a[_0x2725('0xaa')]['id'];}else{_0x39b1ff['id']=_0x30a21a['params']['id'];}var _0x2cf068={'raw':![],'where':_0x39b1ff},_0x4afde5={};_0x4afde5[_0x2725('0x38')]=_[_0x2725('0x3a')](db[_0x2725('0x34')][_0x2725('0x35')]);_0x4afde5[_0x2725('0x39')]=_['keys'](_0x30a21a[_0x2725('0x39')]);_0x4afde5[_0x2725('0x3b')]=_['intersection'](_0x4afde5[_0x2725('0x38')],_0x4afde5[_0x2725('0x39')]);_0x2cf068[_0x2725('0x3d')]=_[_0x2725('0x3c')](_0x4afde5[_0x2725('0x38')],qs['fields'](_0x30a21a[_0x2725('0x39')][_0x2725('0x3e')]));_0x2cf068[_0x2725('0x3d')]=_0x2cf068[_0x2725('0x3d')][_0x2725('0x3f')]?_0x2cf068['attributes']:_0x4afde5[_0x2725('0x38')];if(_0x30a21a[_0x2725('0x39')][_0x2725('0xab')]){_0x2cf068[_0x2725('0xac')]=[{'all':!![]}];}_0x2cf068=_['merge']({},_0x2cf068,_0x30a21a[_0x2725('0xad')]);return db[_0x2725('0x34')][_0x2725('0x5b')](_0x2cf068)[_0x2725('0x26')](handleEntityNotFound(_0x3d2e51,null))['then'](respondWithResult(_0x3d2e51,null))[_0x2725('0x31')](handleError(_0x3d2e51,null));};exports[_0x2725('0xae')]=function(_0x28d335,_0x32ece8){return db['OpenchannelInteraction'][_0x2725('0xae')](_0x28d335['body'],{})[_0x2725('0x26')](respondWithResult(_0x32ece8,0xc9))[_0x2725('0x31')](handleError(_0x32ece8,null));};exports[_0x2725('0xaf')]=function(_0x3d6d0b,_0x39ece9){if(_0x3d6d0b[_0x2725('0xb0')]['id']){delete _0x3d6d0b[_0x2725('0xb0')]['id'];}return db[_0x2725('0x34')][_0x2725('0x5b')]({'where':{'id':_0x3d6d0b[_0x2725('0xaa')]['id']}})[_0x2725('0x26')](handleEntityNotFound(_0x39ece9,null))[_0x2725('0x26')](saveUpdates(_0x3d6d0b['body'],null))['then'](respondWithResult(_0x39ece9,null))[_0x2725('0x31')](handleError(_0x39ece9,null));};exports[_0x2725('0x25')]=function(_0x1d5b7c,_0x2a3c44){return db[_0x2725('0x34')][_0x2725('0x5b')]({'where':{'id':_0x1d5b7c['params']['id']}})[_0x2725('0x26')](handleEntityNotFound(_0x2a3c44,null))[_0x2725('0x26')](removeEntity(_0x2a3c44,null))[_0x2725('0x31')](handleError(_0x2a3c44,null));};exports[_0x2725('0xb1')]=function(_0x471d2e,_0x430216){return db[_0x2725('0x34')][_0x2725('0xb1')]()[_0x2725('0x26')](respondWithResult(_0x430216,null))['catch'](handleError(_0x430216,null));};exports[_0x2725('0xb2')]=function(_0x6fdab3,_0x51ee2f,_0x4427e5){return db['OpenchannelMessage'][_0x2725('0x5b')]({'where':{'id':_0x6fdab3[_0x2725('0xaa')]['id']}})[_0x2725('0x26')](handleEntityNotFound(_0x51ee2f,null))[_0x2725('0x26')](function(_0x521dc9){if(_0x521dc9){return _0x521dc9['addMessage'](_0x6fdab3[_0x2725('0xb0')][_0x2725('0xb3')],_[_0x2725('0xb4')](_0x6fdab3[_0x2725('0xb0')],['ids','id'])||{});}})[_0x2725('0x26')](respondWithResult(_0x51ee2f,null))[_0x2725('0x31')](handleError(_0x51ee2f,null));};exports[_0x2725('0xb5')]=function(_0x4220f4,_0x203822,_0x387637){var _0xc48e50={'raw':![],'where':{}};var _0x5c4d55={};var _0xe54bc4={'count':0x0,'rows':[]};return db[_0x2725('0x34')][_0x2725('0xb6')]({'where':{'id':_0x4220f4['params']['id']}})['then'](handleEntityNotFound(_0x203822,null))[_0x2725('0x26')](function(_0x46f4fe){if(_0x46f4fe){_0x5c4d55[_0x2725('0x38')]=_[_0x2725('0x3a')](db['OpenchannelMessage']['rawAttributes']);_0x5c4d55['query']=_[_0x2725('0x3a')](_0x4220f4['query']);_0x5c4d55[_0x2725('0x3b')]=_[_0x2725('0x3c')](_0x5c4d55[_0x2725('0x38')],_0x5c4d55[_0x2725('0x39')]);_0xc48e50['attributes']=_['intersection'](_0x5c4d55[_0x2725('0x38')],qs['fields'](_0x4220f4[_0x2725('0x39')][_0x2725('0x3e')]));_0xc48e50[_0x2725('0x3d')]=_0xc48e50[_0x2725('0x3d')]['length']?_0xc48e50[_0x2725('0x3d')]:_0x5c4d55['model'];if(!_0x4220f4[_0x2725('0x39')][_0x2725('0x40')](_0x2725('0x41'))){_0xc48e50[_0x2725('0x20')]=qs['limit'](_0x4220f4[_0x2725('0x39')][_0x2725('0x20')]);_0xc48e50[_0x2725('0x1e')]=qs['offset'](_0x4220f4['query'][_0x2725('0x1e')]);}_0xc48e50[_0x2725('0x42')]=qs[_0x2725('0x43')](_0x4220f4[_0x2725('0x39')][_0x2725('0x43')]);_0xc48e50[_0x2725('0x44')]=qs[_0x2725('0x3b')](_[_0x2725('0x45')](_0x4220f4[_0x2725('0x39')],_0x5c4d55[_0x2725('0x3b')]));_0xc48e50[_0x2725('0x44')][_0x2725('0xa7')]=_0x46f4fe['id'];if(_0x4220f4[_0x2725('0x39')][_0x2725('0x80')]){_0xc48e50[_0x2725('0x44')]=_[_0x2725('0xb7')](_0xc48e50[_0x2725('0x44')],{'$or':_[_0x2725('0x33')](_0xc48e50[_0x2725('0x3d')],function(_0x3f8253){var _0x557f83={};_0x557f83[_0x3f8253]={'$like':'%'+_0x4220f4[_0x2725('0x39')]['filter']+'%'};return _0x557f83;})});}if(_0x4220f4['query'][_0x2725('0x76')]){var _0x37043f=_0x4220f4[_0x2725('0x39')][_0x2725('0x76')][_0x2725('0x2e')](',');var _0x124458={};_0x124458[_0x37043f[0x0]]={'$gte':moment(_0x37043f[0x1])[_0x2725('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')};_0xc48e50[_0x2725('0x44')]=_[_0x2725('0xb7')](_0xc48e50[_0x2725('0x44')],_0x124458);}_0xc48e50=_[_0x2725('0xb7')]({},_0xc48e50,_0x4220f4[_0x2725('0xad')]);return db[_0x2725('0xb9')][_0x2725('0x21')]({'where':_0xc48e50[_0x2725('0x44')]})[_0x2725('0x26')](function(_0x4f6212){_0xe54bc4[_0x2725('0x21')]=_0x4f6212;if(_0x4220f4[_0x2725('0x39')][_0x2725('0xab')]){_0xc48e50[_0x2725('0xac')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0xc48e50);})['then'](function(_0xac45b){_0xe54bc4[_0x2725('0xa9')]=_0xac45b;return _0xe54bc4;});}})['then'](respondWithFilteredResult(_0x203822,_0xc48e50))[_0x2725('0x31')](handleError(_0x203822,null));};exports[_0x2725('0xba')]=function(_0x4fa993,_0x21ee05,_0x5ac197){return db[_0x2725('0x34')][_0x2725('0x5b')]({'where':{'id':_0x4fa993[_0x2725('0xaa')]['id']}})[_0x2725('0x26')](handleEntityNotFound(_0x21ee05,null))['then'](function(_0x43e670){if(_0x43e670){return _0x43e670['setTags'](_0x4fa993[_0x2725('0xb0')]['ids'],_[_0x2725('0xb4')](_0x4fa993['body'],[_0x2725('0xb3'),'id'])||{})[_0x2725('0xbb')](function(){return db[_0x2725('0x67')]['findAll']({'attributes':['id',_0x2725('0x29'),_0x2725('0x47')],'where':{'id':_0x4fa993['body'][_0x2725('0xb3')]}});})[_0x2725('0x26')](function(_0x13f4a6){socket[_0x2725('0xbc')]('openchannelInteractionTags:save',{'id':Number(_0x4fa993[_0x2725('0xaa')]['id']),'tags':_0x13f4a6||[]});return{'id':Number(_0x4fa993[_0x2725('0xaa')]['id']),'tags':_0x13f4a6||[]};});}})[_0x2725('0x26')](respondWithResult(_0x21ee05,null))['catch'](handleError(_0x21ee05,null));};exports['removeTags']=function(_0x30e873,_0x5de2a0,_0x4b7ade){return db[_0x2725('0x34')][_0x2725('0x5b')]({'where':{'id':_0x30e873['params']['id']}})['then'](handleEntityNotFound(_0x5de2a0,null))['then'](function(_0x65ba3b){if(_0x65ba3b){return _0x65ba3b[_0x2725('0xbd')](_0x30e873['query']['ids']);}})[_0x2725('0x26')](respondWithStatusCode(_0x5de2a0,null))[_0x2725('0x31')](handleError(_0x5de2a0,null));};exports[_0x2725('0xbe')]=function(_0x2cd73c,_0x44b870){var _0x1aed16=moment()[_0x2725('0xbf')]()[_0x2725('0x93')]();var _0x17431e=path[_0x2725('0xc0')](config[_0x2725('0xc1')],_0x2725('0xc2'),_0x2725('0xc3'),'tmp');var _0x23027b=path[_0x2725('0xc0')](config[_0x2725('0xc1')],_0x2725('0xc2'),'files',_0x2725('0xc4'));var _0x2767ea=path[_0x2725('0xc0')](_0x17431e,_0x1aed16);var _0x2316fe=util['format'](_0x2725('0xc5'),_0x2cd73c['params']['id'],_0x1aed16);var _0x569919=path[_0x2725('0xc0')](_0x17431e,_0x2316fe);var _0x498e29=[];_0x498e29['push']({'model':db['User'],'as':_0x2725('0x6a'),'attributes':['id',_0x2725('0x2b')],'raw':!![]});_0x498e29['push']({'model':db[_0x2725('0xc6')],'as':_0x2725('0x60'),'attributes':['id',_0x2725('0xc7'),_0x2725('0xc8')],'raw':!![]});if(_0x2cd73c[_0x2725('0x39')][_0x2725('0xc4')]){_0x498e29[_0x2725('0x30')]({'model':db['Attachment'],'as':_0x2725('0xc9'),'raw':!![]});}var _0x5bfe92=[{'model':db[_0x2725('0xb9')],'as':_0x2725('0xca'),'attributes':['id',_0x2725('0xb0'),_0x2725('0x74'),_0x2725('0xcb'),_0x2725('0xcc'),_0x2725('0x7b')],'include':_0x498e29}];_0x5bfe92[_0x2725('0x30')]({'model':db[_0x2725('0xcd')],'as':_0x2725('0xce'),'attributes':['id','name']});_0x5bfe92[_0x2725('0x30')]({'model':db[_0x2725('0x6a')],'as':_0x2725('0xcf'),'attributes':['id',_0x2725('0x2b')]});return db[_0x2725('0x34')][_0x2725('0x5b')]({'where':{'id':_0x2cd73c[_0x2725('0xaa')]['id']},'include':_0x5bfe92})[_0x2725('0x26')](handleEntityNotFound(_0x44b870,null))[_0x2725('0x26')](function(_0x4b3c86){if(_0x4b3c86){var _0x466579=_0x4b3c86[_0x2725('0xd0')]({'plain':!![]});fs[_0x2725('0xd1')](_0x2767ea);var _0xa91462={'channel':'Openchannel','account':_0x466579[_0x2725('0xce')][_0x2725('0x29')],'agent':_0x466579[_0x2725('0xcf')]?_0x466579[_0x2725('0xcf')][_0x2725('0x2b')]:_0x2725('0xd2'),'createdAt':moment(_0x466579[_0x2725('0x74')])[_0x2725('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2725('0x93')](),'closedAt':_0x466579[_0x2725('0xd3')]?moment(_0x466579['closedAt'])[_0x2725('0xb8')](_0x2725('0xd4'))[_0x2725('0x93')]():'','disposition':_0x466579[_0x2725('0xd5')],'visibility':_0x466579['threadId']?_0x2725('0xd6'):'Private','messages':_(_0x466579[_0x2725('0xca')])[_0x2725('0x80')]({'secret':![]})['map'](function(_0x1a65b0){if(_0x1a65b0[_0x2725('0xc9')]){var _0x48151a=path[_0x2725('0xc0')](_0x23027b,_0x1a65b0[_0x2725('0xc9')]['basename']);if(fs[_0x2725('0xd7')](_0x48151a)){fs[_0x2725('0xd8')](_0x48151a)[_0x2725('0xd9')](fs[_0x2725('0xda')](path[_0x2725('0xc0')](_0x2767ea,_0x1a65b0[_0x2725('0xc9')][_0x2725('0xdb')])));}}return{'date':moment(_0x1a65b0[_0x2725('0x74')])['format'](_0x2725('0xd4'))[_0x2725('0x93')](),'sender':_0x1a65b0[_0x2725('0xcb')]===_0x2725('0xdc')?_0x1a65b0[_0x2725('0x6a')]?_0x1a65b0[_0x2725('0x6a')][_0x2725('0x2b')]:_0x2725('0xdd'):_0x1a65b0['Contact'][_0x2725('0xc7')]+(_0x1a65b0[_0x2725('0x60')]['lastName']?'\x20'+_0x1a65b0[_0x2725('0x60')][_0x2725('0xc8')]:''),'body':_0x1a65b0[_0x2725('0xc9')]?_0x1a65b0[_0x2725('0xc9')][_0x2725('0xdb')]:_0x1a65b0[_0x2725('0xb0')],'direction':_0x1a65b0[_0x2725('0xcb')]===_0x2725('0xdc')?'A':'C','secret':_0x1a65b0[_0x2725('0xcc')],'read':_0x1a65b0['read'],'attachment':_0x1a65b0[_0x2725('0xc9')]};})['value']()};return ejs[_0x2725('0xde')](path[_0x2725('0xc0')](config[_0x2725('0xc1')],_0x2725('0xc2'),_0x2725('0xdf'),_0x2725('0xe0')),{'interaction':_0xa91462})[_0x2725('0x26')](function(_0x413331){var _0x27d6c5=path[_0x2725('0xc0')](_0x2767ea,_0x2725('0xe1')+_0x466579['id']+'-'+_0x1aed16+_0x2725('0xe2'));var _0x24278c={'path':_0x27d6c5,'channel':_0x2725('0xe3'),'interactionId':_0x466579['id']};return pdf['createPdfFromHTML'](_0x413331,_0x24278c);})[_0x2725('0x26')](function(){return new BPromise(function(_0x2c2ea0,_0x4a8fa2){zipdir(_0x2767ea,{'saveTo':_0x569919},function(_0x3cebb6,_0x49d25e){if(_0x3cebb6)return _0x4a8fa2(_0x3cebb6);return _0x2c2ea0(_0x49d25e);});})[_0x2725('0x26')](function(){return new BPromise(function(_0x212935,_0x4a9c0b){rimraf(_0x2767ea,function(_0x4b0d76){if(_0x4b0d76)_0x4a9c0b(_0x4b0d76);return _0x212935();});});})[_0x2725('0x26')](function(){return _0x44b870[_0x2725('0xbe')](_0x569919,_0x2316fe,function(_0x20c876){if(_0x20c876){console[_0x2725('0xe4')](_0x2725('0xe5'),_0x20c876);}else{fs[_0x2725('0xe6')](_0x569919);}});});});}else{return _0x44b870[_0x2725('0x1b')](0xc8);}})['catch'](handleError(_0x44b870,null));}; \ No newline at end of file +var _0xf16f=['openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','isEmpty','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','OpenchannelAccountId','sequelize','toString','keyBy','merge','OpenchannelInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','removeTags','download','root','server','files','tmp','join','firstName','lastName','attachments','Attachment','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','threadId','Private','Messages','basename','createReadStream','pipe','out','System','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','catch','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xf16f,0x8f));var _0xff16=function(_0x14e5d5,_0x316882){_0x14e5d5=_0x14e5d5-0x0;var _0x306a5e=_0xf16f[_0x14e5d5];return _0x306a5e;};'use strict';var emlformat=require(_0xff16('0x0'));var rimraf=require(_0xff16('0x1'));var zipdir=require(_0xff16('0x2'));var jsonpatch=require(_0xff16('0x3'));var rp=require(_0xff16('0x4'));var moment=require(_0xff16('0x5'));var BPromise=require(_0xff16('0x6'));var Mustache=require(_0xff16('0x7'));var util=require(_0xff16('0x8'));var path=require('path');var sox=require(_0xff16('0x9'));var csv=require(_0xff16('0xa'));var ejs=require(_0xff16('0xb'));var fs=require('fs');var fs_extra=require(_0xff16('0xc'));var _=require(_0xff16('0xd'));var squel=require('squel');var crypto=require(_0xff16('0xe'));var jsforce=require(_0xff16('0xf'));var deskjs=require(_0xff16('0x10'));var toCsv=require(_0xff16('0xa'));var querystring=require('querystring');var Papa=require(_0xff16('0x11'));var Redis=require('ioredis');var authService=require(_0xff16('0x12'));var qs=require(_0xff16('0x13'));var as=require(_0xff16('0x14'));var pdf=require(_0xff16('0x15'));var hardwareService=require(_0xff16('0x16'));var logger=require(_0xff16('0x17'))(_0xff16('0x18'));var utils=require(_0xff16('0x19'));var config=require(_0xff16('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xff16('0x1b'))['db'];config[_0xff16('0x1c')]=_[_0xff16('0x1d')](config['redis'],{'host':_0xff16('0x1e'),'port':0x18eb});var socket=require(_0xff16('0x1f'))(new Redis(config[_0xff16('0x1c')]));require(_0xff16('0x20'))[_0xff16('0x21')](socket);function respondWithStatusCode(_0x550fba,_0xab39a3){_0xab39a3=_0xab39a3||0xcc;return function(_0x476f87){if(_0x476f87){return _0x550fba[_0xff16('0x22')](_0xab39a3);}return _0x550fba[_0xff16('0x23')](_0xab39a3)[_0xff16('0x24')]();};}function respondWithResult(_0x4deac8,_0x3ea297){_0x3ea297=_0x3ea297||0xc8;return function(_0x81e5f){if(_0x81e5f){return _0x4deac8[_0xff16('0x23')](_0x3ea297)[_0xff16('0x25')](_0x81e5f);}};}function respondWithFilteredResult(_0x329cbd,_0xac00cb){return function(_0x251898){if(_0x251898){var _0x405051=typeof _0xac00cb[_0xff16('0x26')]==='undefined'&&typeof _0xac00cb[_0xff16('0x27')]==='undefined';var _0xa327a7=_0x251898[_0xff16('0x28')];var _0x2a9802=_0x405051?0x0:_0xac00cb['offset'];var _0x54f420=_0x405051?_0x251898[_0xff16('0x28')]:_0xac00cb[_0xff16('0x26')]+_0xac00cb[_0xff16('0x27')];var _0x192043;if(_0x54f420>=_0xa327a7){_0x54f420=_0xa327a7;_0x192043=0xc8;}else{_0x192043=0xce;}_0x329cbd[_0xff16('0x23')](_0x192043);return _0x329cbd[_0xff16('0x29')](_0xff16('0x2a'),_0x2a9802+'-'+_0x54f420+'/'+_0xa327a7)[_0xff16('0x25')](_0x251898);}return null;};}function patchUpdates(_0x53ef3f){return function(_0x3ad9a0){try{jsonpatch['apply'](_0x3ad9a0,_0x53ef3f,!![]);}catch(_0x724a01){return BPromise[_0xff16('0x2b')](_0x724a01);}return _0x3ad9a0[_0xff16('0x2c')]();};}function saveUpdates(_0x15c945,_0x486a35){return function(_0x449f99){if(_0x449f99){return _0x449f99[_0xff16('0x2d')](_0x15c945)[_0xff16('0x2e')](function(_0x274949){return _0x274949;});}return null;};}function removeEntity(_0x14523f,_0x225c07){return function(_0x33797c){if(_0x33797c){return _0x33797c['destroy']()['then'](function(){_0x14523f[_0xff16('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47c5f6,_0x4b40c0){return function(_0x17b267){if(!_0x17b267){_0x47c5f6[_0xff16('0x22')](0x194);}return _0x17b267;};}function handleError(_0x4dd959,_0x348167){_0x348167=_0x348167||0x1f4;return function(_0x4e227f){logger[_0xff16('0x2f')](_0x4e227f[_0xff16('0x30')]);if(_0x4e227f[_0xff16('0x31')]){delete _0x4e227f[_0xff16('0x31')];}_0x4dd959[_0xff16('0x23')](_0x348167)[_0xff16('0x32')](_0x4e227f);};}function getInteractionUsers(_0x2c58dd,_0x217df6){return new BPromise(function(_0x34a030,_0x8436e){try{if(_0x217df6[_0x2c58dd['id']]){_0x2c58dd[_0xff16('0x33')]=_[_0xff16('0x34')](_0x217df6[_0x2c58dd['id']],function(_0x246639){return{'id':_0x246639['id'],'fullname':_0x246639[_0xff16('0x35')]};});}}catch(_0x3062c9){_0x8436e(_0x3062c9);}_0x34a030(_0x2c58dd);});}function getInteractionTags(_0x4f9ea3,_0x501580){return new BPromise(function(_0x333577,_0x7a244b){try{if(_0x4f9ea3[_0xff16('0x36')]){_0x4f9ea3['Tags']=[];_0x4f9ea3[_0xff16('0x36')]['split'](',')[_0xff16('0x37')](function(_0x2ee3e4){_0x4f9ea3[_0xff16('0x38')][_0xff16('0x39')](_0x501580[_0x2ee3e4]);});}delete _0x4f9ea3[_0xff16('0x36')];}catch(_0x3e78d1){_0x7a244b(_0x3e78d1);}_0x333577(_0x4f9ea3);});}function updateOpenchannelInteraction(_0x539586,_0x33dbda,_0x2433f5){return new BPromise(function(_0x2f0c36,_0x5250fe){return getInteractionUsers(_0x539586,_0x2433f5)['then'](function(_0x29a5ea){return getInteractionTags(_0x29a5ea,_0x33dbda);})[_0xff16('0x2e')](function(_0x210093){_0x2f0c36(_0x210093);})[_0xff16('0x3a')](function(_0x46d06d){_0x5250fe(_0x46d06d);});});}exports[_0xff16('0x3b')]=function(_0x59f736,_0x57a4c3){var _0x41eb98={},_0x36c04f={},_0x29d04c={'count':0x0,'rows':[]};var _0x3897a5=_[_0xff16('0x34')](db['OpenchannelInteraction'][_0xff16('0x3c')],function(_0x30babb){return{'name':_0x30babb[_0xff16('0x3d')],'type':_0x30babb[_0xff16('0x3e')][_0xff16('0x3f')]};});_0x36c04f['model']=_[_0xff16('0x34')](_0x3897a5,_0xff16('0x31'));_0x36c04f[_0xff16('0x40')]=_[_0xff16('0x41')](_0x59f736[_0xff16('0x40')]);_0x36c04f[_0xff16('0x42')]=_[_0xff16('0x43')](_0x36c04f[_0xff16('0x44')],_0x36c04f[_0xff16('0x40')]);_0x41eb98['attributes']=_['intersection'](_0x36c04f[_0xff16('0x44')],qs['fields'](_0x59f736['query'][_0xff16('0x45')]));_0x41eb98['attributes']=_0x41eb98[_0xff16('0x46')][_0xff16('0x47')]?_0x41eb98['attributes']:_0x36c04f[_0xff16('0x44')];if(!_0x59f736[_0xff16('0x40')][_0xff16('0x48')](_0xff16('0x49'))){_0x41eb98[_0xff16('0x27')]=qs[_0xff16('0x27')](_0x59f736[_0xff16('0x40')][_0xff16('0x27')]);_0x41eb98[_0xff16('0x26')]=qs['offset'](_0x59f736[_0xff16('0x40')][_0xff16('0x26')]);}_0x41eb98[_0xff16('0x4a')]=qs[_0xff16('0x4b')](_0x59f736[_0xff16('0x40')][_0xff16('0x4b')]);_0x41eb98[_0xff16('0x4c')]=qs['filters'](_['pick'](_0x59f736[_0xff16('0x40')],_0x36c04f[_0xff16('0x42')]),_0x3897a5);var _0x2c2dcb=[];var _0x8f8e5f=squel[_0xff16('0x4d')]()[_0xff16('0x4e')]('id')[_0xff16('0x4e')](_0xff16('0x31'))[_0xff16('0x4e')](_0xff16('0x4f'))[_0xff16('0x50')](_0xff16('0x51'));var _0x30e46d=squel['select']()[_0xff16('0x4e')](_0xff16('0x52'))[_0xff16('0x4e')](_0xff16('0x53'))['field'](_0xff16('0x54'))[_0xff16('0x50')](_0xff16('0x55'),'ui')['left_join'](_0xff16('0x56'),'u',_0xff16('0x57'));var _0x423b49=squel[_0xff16('0x4d')]()[_0xff16('0x50')](_0xff16('0x58'),'i')[_0xff16('0x59')]('cm_contacts','c',_0xff16('0x5a'))[_0xff16('0x59')](_0xff16('0x56'),'o','o.id\x20=\x20i.UserId')[_0xff16('0x59')](_0xff16('0x5b'),'a',_0xff16('0x5c'))[_0xff16('0x59')](_0xff16('0x5d'),'me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xff16('0x5e'),'it',_0xff16('0x5f'))[_0xff16('0x59')](_0xff16('0x51'),'t','t.id\x20=\x20it.TagId');var _0xea4a7e=squel[_0xff16('0x60')]();var _0x3384d9=[];var _0x1c1508=squel[_0xff16('0x60')]();var _0x321134;if(_0x59f736[_0xff16('0x40')][_0xff16('0x61')]){_0x321134=as[_0xff16('0x62')](_0x59f736['query'][_0xff16('0x61')]);var _0x5f0f99=_0x321134['sqlOperator'];for(var _0x2bfe45=0x0;_0x2bfe45<_0x321134[_0xff16('0x63')][_0xff16('0x47')];_0x2bfe45++){var _0x2105fc=_0x321134[_0xff16('0x63')][_0x2bfe45];var _0x4137f8='i';var _0x18f1a8=_[_0xff16('0x64')](_0x3897a5,[_0xff16('0x31'),_0x2105fc[_0xff16('0x4e')]]);if(!_0x18f1a8){switch(_0x2105fc[_0xff16('0x4e')]){case _0xff16('0x65'):if(_0x2105fc[_0xff16('0x66')]==0x1){_0x423b49['having']('`'+_0x2105fc['field']+_0xff16('0x67'));}else{_0x423b49[_0xff16('0x68')]('`'+_0x2105fc[_0xff16('0x4e')]+_0xff16('0x69'));}break;case _0xff16('0x6a'):if(_0x2105fc[_0xff16('0x6b')]===_0xff16('0x6c')){if(_0x2105fc[_0xff16('0x66')]['split']('\x20')[_0xff16('0x47')]>0x1){_0xea4a7e[_0x5f0f99](_0xff16('0x6d'),qs[_0xff16('0x6e')](_0x2105fc[_0xff16('0x66')]),null);}else{var _0x15e900='%'+_0x2105fc['value']+'%';_0xea4a7e[_0x5f0f99]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x15e900,_0x15e900,_0x15e900);}}else{_0x18f1a8=_[_0xff16('0x64')](_0x3897a5,[_0xff16('0x31'),_0xff16('0x6f')]);_0x2105fc['field']='ContactId';_0x18df08=as['buildExpression'](_0x4137f8,_0x18f1a8[_0xff16('0x3e')],_0x2105fc);_0xea4a7e[_0x5f0f99](_0x18df08[_0xff16('0x70')],_0x18df08[_0xff16('0x66')][_0xff16('0x71')],_0x18df08[_0xff16('0x66')][_0xff16('0x24')]);}break;case _0xff16('0x72'):var _0x3ac2e3=_0x2105fc[_0xff16('0x66')][_0xff16('0x73')](',')['map'](function(_0x509b44){return Number(_0x509b44);});_0x3ac2e3[_0xff16('0x37')](function(_0x2c8fb1){_0x1c1508['or'](_0xff16('0x74'),'%,'+_0x2c8fb1+',%');});_0x3384d9=_['union'](_0x3384d9,_0x3ac2e3);break;case _0xff16('0x75'):if(_0x2105fc[_0xff16('0x6b')]===_0xff16('0x6c')){_0xea4a7e[_0x5f0f99](_0xff16('0x76'),'%'+_0x2105fc[_0xff16('0x66')]+'%',null);}else{_0x18f1a8=_[_0xff16('0x64')](_0x3897a5,[_0xff16('0x31'),_0xff16('0x77')]);_0x2105fc[_0xff16('0x4e')]=_0xff16('0x77');_0x18df08=as[_0xff16('0x78')](_0x4137f8,_0x18f1a8[_0xff16('0x3e')],_0x2105fc);_0xea4a7e[_0x5f0f99](_0x18df08[_0xff16('0x70')],_0x18df08[_0xff16('0x66')][_0xff16('0x71')],_0x18df08['value'][_0xff16('0x24')]);}break;case'body':_0x18df08=as[_0xff16('0x78')]('me',null,_0x2105fc);_0xea4a7e[_0x5f0f99](_0x18df08[_0xff16('0x70')],_0x18df08[_0xff16('0x66')]['start'],_0x18df08['value'][_0xff16('0x24')]);break;}}else{var _0x18df08=as[_0xff16('0x78')](_0x4137f8,_0x18f1a8[_0xff16('0x3e')],_0x2105fc);_0xea4a7e[_0x5f0f99](_0x18df08[_0xff16('0x70')],_0x18df08[_0xff16('0x66')][_0xff16('0x71')],_0x18df08[_0xff16('0x66')]['end']);}}}else{var _0x1f2cc9=_(_0x59f736[_0xff16('0x40')])['keys']()[_0xff16('0x34')](function(_0x196501){return _[_0xff16('0x79')](_0x3897a5,['name',_0x196501])?_0x196501:undefined;})['compact']()[_0xff16('0x66')]();if(!_[_0xff16('0x7a')](_0x1f2cc9)){_0x1f2cc9[_0xff16('0x37')](function(_0x4ac6fe){if(_0x4ac6fe==='OpenchannelAccountId'){_0x423b49[_0xff16('0x4c')](_0xff16('0x7b'),[]['concat'](_0x59f736[_0xff16('0x40')][_0x4ac6fe]));}else if(_0x4ac6fe===_0xff16('0x7c')){var _0x31e4ee=JSON[_0xff16('0x7d')](_0x59f736[_0xff16('0x40')][_0x4ac6fe])[_0xff16('0x7e')];var _0xb5395d=JSON[_0xff16('0x7d')](_0x59f736['query'][_0x4ac6fe])['$lte'];_0x423b49[_0xff16('0x4c')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x31e4ee,_0xb5395d);}else{if(_0x59f736[_0xff16('0x40')][_0x4ac6fe]==='null'){_0x423b49[_0xff16('0x4c')]('i.'+_0x4ac6fe+_0xff16('0x7f'));}else{_0x423b49[_0xff16('0x4c')]('i.'+_0x4ac6fe+_0xff16('0x80'),_0x59f736[_0xff16('0x40')][_0x4ac6fe]);}}});}if(_0x59f736[_0xff16('0x40')][_0xff16('0x81')]){if(_0x59f736[_0xff16('0x40')][_0xff16('0x81')]==0x1){_0x423b49[_0xff16('0x68')](_0xff16('0x82'));}else{_0x423b49['having'](_0xff16('0x83'));}}if(_0x59f736[_0xff16('0x40')][_0xff16('0x84')]){_0x3384d9=_[_0xff16('0x85')](_0x59f736[_0xff16('0x40')][_0xff16('0x84')])?_0x59f736[_0xff16('0x40')][_0xff16('0x84')]:new Array(_0x59f736['query'][_0xff16('0x84')]);_0x3384d9[_0xff16('0x37')](function(_0x3f0fb2){_0x1c1508['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f0fb2+',%');});}if(_0x59f736[_0xff16('0x40')][_0xff16('0x86')]){var _0x1c0b65=_0x59f736['query'][_0xff16('0x86')][_0xff16('0x87')]('\x5c','\x5c\x5c')[_0xff16('0x87')](/'/g,'\x27\x27');if(qs[_0xff16('0x88')](_0x1c0b65)){_0xea4a7e['or'](_0xff16('0x89'),_0x1c0b65+'%');}else{_0xea4a7e['or'](_0xff16('0x8a'),qs[_0xff16('0x6e')](_0x1c0b65))['or']('i.from\x20LIKE\x20?',_0x1c0b65+'%')['or'](_0xff16('0x8b'),_0x1c0b65+'%');}}}_0x423b49['where'](_0xea4a7e);_0x423b49['group'](_0xff16('0x8c'));var _0x3184c7={'type':db[_0xff16('0x8d')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4456ad=_0x423b49['clone']();_0x4456ad[_0xff16('0x4e')]('i.id');_0x4456ad[_0xff16('0x4e')](_0xff16('0x8e'),'unreadMessages');if(_0x41eb98[_0xff16('0x4a')]){_0x41eb98[_0xff16('0x4a')]['forEach'](function(_0x1b7c5b){var _0x1cf8d5=_0x1b7c5b[0x0]===_0xff16('0x8f')?_0x1b7c5b[0x0]:'i.'+_0x1b7c5b[0x0];_0x423b49['order'](_0x1cf8d5,_0x1b7c5b[0x1]===_0xff16('0x90')?![]:!![]);});}if(!_[_0xff16('0x7a')](_0x3384d9)){_0x423b49['having'](_0x1c1508);_0x4456ad[_0xff16('0x4c')](_0xff16('0x91'),_0x3384d9);}BPromise[_0xff16('0x92')]()['then'](function(){if(!_0x321134){if(_0x59f736[_0xff16('0x40')]['OpenchannelAccountId'])return;_0x4456ad[_0xff16('0x4c')](_0xff16('0x93'));_0x423b49[_0xff16('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x59f736[_0xff16('0x94')][_0xff16('0x95')]!==_0xff16('0x96'))return;return _0x59f736[_0xff16('0x94')][_0xff16('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2bc2e5){if(_[_0xff16('0x7a')](_0x2bc2e5)){_0x4456ad['where'](_0xff16('0x98'));_0x423b49['where'](_0xff16('0x98'));}else{_0x4456ad[_0xff16('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xff16('0x34')](_0x2bc2e5,'id'));_0x423b49[_0xff16('0x4c')](_0xff16('0x7b'),_['map'](_0x2bc2e5,'id'));}});})['then'](function(){if(_0x59f736[_0xff16('0x94')][_0xff16('0x95')]===_0xff16('0x96')&&!_0x321134&&!_0x59f736[_0xff16('0x40')][_0xff16('0x99')])return[];return db[_0xff16('0x9a')]['query'](_0x4456ad[_0xff16('0x9b')](),_0x3184c7);})[_0xff16('0x2e')](function(_0x32759a){_0x29d04c[_0xff16('0x28')]=_0x32759a[_0xff16('0x47')];if(_0x29d04c['count']===0x0)return[];return db[_0xff16('0x9a')][_0xff16('0x40')](_0x8f8e5f[_0xff16('0x9b')](),_0x3184c7)[_0xff16('0x2e')](function(_0x29893a){_0x2c2dcb=_[_0xff16('0x9c')](_0x29893a,'id');_0x3184c7=_[_0xff16('0x9d')](_0x3184c7,{'model':db[_0xff16('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59f736['query'][_0xff16('0x45')]){_0x41eb98[_0xff16('0x46')][_0xff16('0x37')](function(_0xa65e35){_0x423b49['field']('i.'+_0xa65e35);});}else{_0x423b49[_0xff16('0x4e')](_0xff16('0x8e'),_0xff16('0x65'));_0x423b49[_0xff16('0x4e')]('a.key',_0xff16('0x9f'));_0x423b49['field'](_0xff16('0xa0'),_0xff16('0xa1'));_0x423b49[_0xff16('0x4e')]('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',_0xff16('0x8f'));_0x423b49[_0xff16('0x4e')]('i.*');_0x423b49[_0xff16('0x4e')]('c.firstName',_0xff16('0xa2'));_0x423b49[_0xff16('0x4e')](_0xff16('0xa3'),_0xff16('0xa4'));_0x423b49['field'](_0xff16('0xa5'),'Contact.email');_0x423b49[_0xff16('0x4e')](_0xff16('0xa6'),_0xff16('0xa7'));_0x423b49[_0xff16('0x4e')](_0xff16('0xa8'),_0xff16('0xa9'));_0x423b49['field']('c.fax',_0xff16('0xaa'));_0x423b49[_0xff16('0x4e')](_0xff16('0xab'),_0xff16('0xac'));_0x423b49[_0xff16('0x4e')](_0xff16('0xad'),'Owner.internal');_0x423b49[_0xff16('0x4e')](_0xff16('0xae'),_0xff16('0x36'));}if(_0x41eb98[_0xff16('0x27')])_0x423b49['limit'](_0x41eb98[_0xff16('0x27')]);if(_0x41eb98[_0xff16('0x26')])_0x423b49[_0xff16('0x26')](_0x41eb98[_0xff16('0x26')]);return db[_0xff16('0x9a')][_0xff16('0x40')](_0x423b49['toString'](),_0x3184c7);})[_0xff16('0x2e')](function(_0x129ca2){if(_0x129ca2[_0xff16('0x47')]>0x0)_0x30e46d[_0xff16('0x4c')](_0xff16('0xaf'),_[_0xff16('0x34')](_0x129ca2,'id'));return db[_0xff16('0x9a')][_0xff16('0x40')](_0x30e46d[_0xff16('0x9b')](),_0x3184c7)[_0xff16('0x2e')](function(_0x28b82c){var _0x38ede1=_[_0xff16('0xb0')](_0x28b82c,_0xff16('0xb1'));var _0x4e4693=[];_0x129ca2[_0xff16('0x37')](function(_0x147066){_0x4e4693[_0xff16('0x39')](updateOpenchannelInteraction(_0x147066,_0x2c2dcb,_0x38ede1));});return BPromise[_0xff16('0xb2')](_0x4e4693);});});})['then'](function(_0x4a352e){_0x29d04c[_0xff16('0xb3')]=_0x4a352e;return _0x29d04c;})[_0xff16('0x2e')](respondWithFilteredResult(_0x57a4c3,_0x41eb98))[_0xff16('0x3a')](handleError(_0x57a4c3,null));};exports[_0xff16('0xb4')]=function(_0x575b61,_0x2fc627){var _0x2a2d9a={};if(_0x575b61[_0xff16('0x40')][_0xff16('0x3e')]&&_0x575b61['query']['type']==='from'){_0x2a2d9a[_0xff16('0x50')]=_0x575b61[_0xff16('0xb5')]['id'];}else{_0x2a2d9a['id']=_0x575b61[_0xff16('0xb5')]['id'];}var _0x54e213={'raw':![],'where':_0x2a2d9a},_0x9b0569={};_0x9b0569['model']=_[_0xff16('0x41')](db[_0xff16('0x9e')][_0xff16('0x3c')]);_0x9b0569[_0xff16('0x40')]=_[_0xff16('0x41')](_0x575b61[_0xff16('0x40')]);_0x9b0569[_0xff16('0x42')]=_['intersection'](_0x9b0569[_0xff16('0x44')],_0x9b0569['query']);_0x54e213[_0xff16('0x46')]=_['intersection'](_0x9b0569[_0xff16('0x44')],qs['fields'](_0x575b61[_0xff16('0x40')]['fields']));_0x54e213['attributes']=_0x54e213[_0xff16('0x46')][_0xff16('0x47')]?_0x54e213[_0xff16('0x46')]:_0x9b0569['model'];if(_0x575b61[_0xff16('0x40')][_0xff16('0xb6')]){_0x54e213[_0xff16('0xb7')]=[{'all':!![]}];}_0x54e213=_[_0xff16('0x9d')]({},_0x54e213,_0x575b61[_0xff16('0xb8')]);return db[_0xff16('0x9e')][_0xff16('0x64')](_0x54e213)['then'](handleEntityNotFound(_0x2fc627,null))[_0xff16('0x2e')](respondWithResult(_0x2fc627,null))[_0xff16('0x3a')](handleError(_0x2fc627,null));};exports[_0xff16('0xb9')]=function(_0x1694fb,_0x304063){return db['OpenchannelInteraction'][_0xff16('0xb9')](_0x1694fb[_0xff16('0xba')],{})['then'](respondWithResult(_0x304063,0xc9))[_0xff16('0x3a')](handleError(_0x304063,null));};exports['update']=function(_0x3d7713,_0x4104e1){if(_0x3d7713[_0xff16('0xba')]['id']){delete _0x3d7713[_0xff16('0xba')]['id'];}return db['OpenchannelInteraction'][_0xff16('0x64')]({'where':{'id':_0x3d7713['params']['id']}})['then'](handleEntityNotFound(_0x4104e1,null))[_0xff16('0x2e')](saveUpdates(_0x3d7713[_0xff16('0xba')],null))[_0xff16('0x2e')](respondWithResult(_0x4104e1,null))[_0xff16('0x3a')](handleError(_0x4104e1,null));};exports['destroy']=function(_0x27846b,_0x1d7d12){return db[_0xff16('0x9e')]['find']({'where':{'id':_0x27846b['params']['id']}})[_0xff16('0x2e')](handleEntityNotFound(_0x1d7d12,null))[_0xff16('0x2e')](removeEntity(_0x1d7d12,null))[_0xff16('0x3a')](handleError(_0x1d7d12,null));};exports['describe']=function(_0x527227,_0x3f4668){return db[_0xff16('0x9e')][_0xff16('0xbb')]()['then'](respondWithResult(_0x3f4668,null))[_0xff16('0x3a')](handleError(_0x3f4668,null));};exports[_0xff16('0xbc')]=function(_0x274a89,_0x1f0152,_0x3b3a7e){return db[_0xff16('0xbd')][_0xff16('0x64')]({'where':{'id':_0x274a89[_0xff16('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1f0152,null))[_0xff16('0x2e')](function(_0x21f4ee){if(_0x21f4ee){return _0x21f4ee[_0xff16('0xbc')](_0x274a89[_0xff16('0xba')][_0xff16('0xbe')],_['omit'](_0x274a89[_0xff16('0xba')],[_0xff16('0xbe'),'id'])||{});}})[_0xff16('0x2e')](respondWithResult(_0x1f0152,null))[_0xff16('0x3a')](handleError(_0x1f0152,null));};exports[_0xff16('0xbf')]=function(_0x4b0345,_0xf56da7,_0x5c2aa3){var _0x1af36d={'raw':![],'where':{}};var _0x588c6b={};var _0x5a3a2b={'count':0x0,'rows':[]};return db[_0xff16('0x9e')]['findOne']({'where':{'id':_0x4b0345[_0xff16('0xb5')]['id']}})['then'](handleEntityNotFound(_0xf56da7,null))[_0xff16('0x2e')](function(_0x1b8f95){if(_0x1b8f95){_0x588c6b[_0xff16('0x44')]=_[_0xff16('0x41')](db['OpenchannelMessage'][_0xff16('0x3c')]);_0x588c6b[_0xff16('0x40')]=_[_0xff16('0x41')](_0x4b0345[_0xff16('0x40')]);_0x588c6b['filters']=_[_0xff16('0x43')](_0x588c6b[_0xff16('0x44')],_0x588c6b['query']);_0x1af36d['attributes']=_['intersection'](_0x588c6b[_0xff16('0x44')],qs[_0xff16('0x45')](_0x4b0345[_0xff16('0x40')][_0xff16('0x45')]));_0x1af36d[_0xff16('0x46')]=_0x1af36d[_0xff16('0x46')]['length']?_0x1af36d[_0xff16('0x46')]:_0x588c6b[_0xff16('0x44')];if(!_0x4b0345[_0xff16('0x40')]['hasOwnProperty'](_0xff16('0x49'))){_0x1af36d[_0xff16('0x27')]=qs[_0xff16('0x27')](_0x4b0345[_0xff16('0x40')][_0xff16('0x27')]);_0x1af36d[_0xff16('0x26')]=qs[_0xff16('0x26')](_0x4b0345[_0xff16('0x40')][_0xff16('0x26')]);}_0x1af36d['order']=qs[_0xff16('0x4b')](_0x4b0345[_0xff16('0x40')][_0xff16('0x4b')]);_0x1af36d[_0xff16('0x4c')]=qs[_0xff16('0x42')](_[_0xff16('0xc0')](_0x4b0345[_0xff16('0x40')],_0x588c6b[_0xff16('0x42')]));_0x1af36d[_0xff16('0x4c')][_0xff16('0xb1')]=_0x1b8f95['id'];if(_0x4b0345['query'][_0xff16('0x86')]){_0x1af36d['where']=_[_0xff16('0x9d')](_0x1af36d[_0xff16('0x4c')],{'$or':_[_0xff16('0x34')](_0x1af36d[_0xff16('0x46')],function(_0x5e1aa0){var _0x5c6cc2={};_0x5c6cc2[_0x5e1aa0]={'$like':'%'+_0x4b0345['query'][_0xff16('0x86')]+'%'};return _0x5c6cc2;})});}if(_0x4b0345[_0xff16('0x40')][_0xff16('0x7e')]){var _0x1eaded=_0x4b0345[_0xff16('0x40')]['$gte'][_0xff16('0x73')](',');var _0x181840={};_0x181840[_0x1eaded[0x0]]={'$gte':moment(_0x1eaded[0x1])[_0xff16('0xc1')](_0xff16('0xc2'))};_0x1af36d['where']=_['merge'](_0x1af36d[_0xff16('0x4c')],_0x181840);}_0x1af36d=_['merge']({},_0x1af36d,_0x4b0345['options']);return db[_0xff16('0xbd')]['count']({'where':_0x1af36d[_0xff16('0x4c')]})['then'](function(_0x17ff93){_0x5a3a2b[_0xff16('0x28')]=_0x17ff93;if(_0x4b0345[_0xff16('0x40')][_0xff16('0xb6')]){_0x1af36d[_0xff16('0xb7')]=[{'all':!![]}];}return db[_0xff16('0xbd')][_0xff16('0xc3')](_0x1af36d);})['then'](function(_0x4bba32){_0x5a3a2b[_0xff16('0xb3')]=_0x4bba32;return _0x5a3a2b;});}})[_0xff16('0x2e')](respondWithFilteredResult(_0xf56da7,_0x1af36d))[_0xff16('0x3a')](handleError(_0xf56da7,null));};exports[_0xff16('0xc4')]=function(_0x5389d9,_0x2c9113,_0x500871){return db['OpenchannelInteraction'][_0xff16('0x64')]({'where':{'id':_0x5389d9[_0xff16('0xb5')]['id']}})[_0xff16('0x2e')](handleEntityNotFound(_0x2c9113,null))['then'](function(_0x41e2d6){if(_0x41e2d6){return _0x41e2d6[_0xff16('0xc5')](_0x5389d9['body'][_0xff16('0xbe')],_['omit'](_0x5389d9[_0xff16('0xba')],[_0xff16('0xbe'),'id'])||{})[_0xff16('0xc6')](function(){return db[_0xff16('0x72')][_0xff16('0xc3')]({'attributes':['id',_0xff16('0x31'),_0xff16('0x4f')],'where':{'id':_0x5389d9[_0xff16('0xba')]['ids']}});})[_0xff16('0x2e')](function(_0x162953){socket[_0xff16('0xc7')]('openchannelInteractionTags:save',{'id':Number(_0x5389d9['params']['id']),'tags':_0x162953||[]});return{'id':Number(_0x5389d9[_0xff16('0xb5')]['id']),'tags':_0x162953||[]};});}})[_0xff16('0x2e')](respondWithResult(_0x2c9113,null))[_0xff16('0x3a')](handleError(_0x2c9113,null));};exports[_0xff16('0xc8')]=function(_0x134ce0,_0x1b178e,_0x5f2632){return db[_0xff16('0x9e')][_0xff16('0x64')]({'where':{'id':_0x134ce0[_0xff16('0xb5')]['id']}})[_0xff16('0x2e')](handleEntityNotFound(_0x1b178e,null))[_0xff16('0x2e')](function(_0x1b3f6c){if(_0x1b3f6c){return _0x1b3f6c['removeTags'](_0x134ce0[_0xff16('0x40')][_0xff16('0xbe')]);}})[_0xff16('0x2e')](respondWithStatusCode(_0x1b178e,null))[_0xff16('0x3a')](handleError(_0x1b178e,null));};exports[_0xff16('0xc9')]=function(_0x3e483b,_0x442a06){var _0x507bfe=moment()['unix']()['toString']();var _0x505f8d=path['join'](config[_0xff16('0xca')],_0xff16('0xcb'),_0xff16('0xcc'),_0xff16('0xcd'));var _0x4326d8=path['join'](config['root'],_0xff16('0xcb'),_0xff16('0xcc'),'attachments');var _0x286a3f=path[_0xff16('0xce')](_0x505f8d,_0x507bfe);var _0x5c569f=util[_0xff16('0xc1')]('transcript-%d-%s.zip',_0x3e483b[_0xff16('0xb5')]['id'],_0x507bfe);var _0x27a2a4=path[_0xff16('0xce')](_0x505f8d,_0x5c569f);var _0x4f32d6=[];_0x4f32d6[_0xff16('0x39')]({'model':db[_0xff16('0x75')],'as':_0xff16('0x75'),'attributes':['id',_0xff16('0x35')],'raw':!![]});_0x4f32d6[_0xff16('0x39')]({'model':db['CmContact'],'as':_0xff16('0x6a'),'attributes':['id',_0xff16('0xcf'),_0xff16('0xd0')],'raw':!![]});if(_0x3e483b[_0xff16('0x40')][_0xff16('0xd1')]){_0x4f32d6[_0xff16('0x39')]({'model':db[_0xff16('0xd2')],'as':_0xff16('0xd2'),'raw':!![]});}var _0xba646d=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0xff16('0xba'),'createdAt',_0xff16('0xd3'),'secret',_0xff16('0x81')],'include':_0x4f32d6}];_0xba646d['push']({'model':db[_0xff16('0xd4')],'as':_0xff16('0xd5'),'attributes':['id','name']});_0xba646d['push']({'model':db['User'],'as':_0xff16('0xd6'),'attributes':['id',_0xff16('0x35')]});return db['OpenchannelInteraction'][_0xff16('0x64')]({'where':{'id':_0x3e483b[_0xff16('0xb5')]['id']},'include':_0xba646d})['then'](handleEntityNotFound(_0x442a06,null))[_0xff16('0x2e')](function(_0x5593c0){if(_0x5593c0){var _0x21c180=_0x5593c0[_0xff16('0xd7')]({'plain':!![]});fs[_0xff16('0xd8')](_0x286a3f);var _0x321dcd={'channel':_0xff16('0xd9'),'account':_0x21c180[_0xff16('0xd5')][_0xff16('0x31')],'agent':_0x21c180[_0xff16('0xd6')]?_0x21c180[_0xff16('0xd6')]['fullname']:_0xff16('0xda'),'createdAt':moment(_0x21c180['createdAt'])[_0xff16('0xc1')](_0xff16('0xc2'))[_0xff16('0x9b')](),'closedAt':_0x21c180[_0xff16('0xdb')]?moment(_0x21c180[_0xff16('0xdc')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x21c180['disposition'],'visibility':_0x21c180[_0xff16('0xdd')]?'Public':_0xff16('0xde'),'messages':_(_0x21c180[_0xff16('0xdf')])[_0xff16('0x86')]({'secret':![]})['map'](function(_0x38552a){if(_0x38552a[_0xff16('0xd2')]){var _0x5266b2=path[_0xff16('0xce')](_0x4326d8,_0x38552a['Attachment'][_0xff16('0xe0')]);if(fs['existsSync'](_0x5266b2)){fs[_0xff16('0xe1')](_0x5266b2)[_0xff16('0xe2')](fs['createWriteStream'](path[_0xff16('0xce')](_0x286a3f,_0x38552a[_0xff16('0xd2')][_0xff16('0xe0')])));}}return{'date':moment(_0x38552a[_0xff16('0x7c')])[_0xff16('0xc1')](_0xff16('0xc2'))[_0xff16('0x9b')](),'sender':_0x38552a[_0xff16('0xd3')]===_0xff16('0xe3')?_0x38552a['User']?_0x38552a[_0xff16('0x75')][_0xff16('0x35')]:_0xff16('0xe4'):_0x38552a['Contact']['firstName']+(_0x38552a[_0xff16('0x6a')][_0xff16('0xd0')]?'\x20'+_0x38552a[_0xff16('0x6a')]['lastName']:''),'body':_0x38552a[_0xff16('0xd2')]?_0x38552a[_0xff16('0xd2')][_0xff16('0xe0')]:_0x38552a[_0xff16('0xba')],'direction':_0x38552a[_0xff16('0xd3')]==='out'?'A':'C','secret':_0x38552a['secret'],'read':_0x38552a[_0xff16('0x81')],'attachment':_0x38552a[_0xff16('0xd2')]};})['value']()};return ejs[_0xff16('0xe5')](path['join'](config[_0xff16('0xca')],_0xff16('0xcb'),_0xff16('0xe6'),_0xff16('0xe7')),{'interaction':_0x321dcd})[_0xff16('0x2e')](function(_0xf02464){var _0x5a8ae8=path[_0xff16('0xce')](_0x286a3f,'transcript-'+_0x21c180['id']+'-'+_0x507bfe+_0xff16('0xe8'));var _0x402c4d={'path':_0x5a8ae8,'channel':_0xff16('0xd9'),'interactionId':_0x21c180['id']};return pdf[_0xff16('0xe9')](_0xf02464,_0x402c4d);})['then'](function(){return new BPromise(function(_0xaf8f1,_0x13dcc6){zipdir(_0x286a3f,{'saveTo':_0x27a2a4},function(_0x5a140e,_0xc6005b){if(_0x5a140e)return _0x13dcc6(_0x5a140e);return _0xaf8f1(_0xc6005b);});})[_0xff16('0x2e')](function(){return new BPromise(function(_0x5d8cbd,_0xd09a89){rimraf(_0x286a3f,function(_0x1d1857){if(_0x1d1857)_0xd09a89(_0x1d1857);return _0x5d8cbd();});});})['then'](function(){return _0x442a06[_0xff16('0xc9')](_0x27a2a4,_0x5c569f,function(_0x514575){if(_0x514575){console[_0xff16('0xea')](_0xff16('0xeb'),_0x514575);}else{fs[_0xff16('0xec')](_0x27a2a4);}});});});}else{return _0x442a06[_0xff16('0x22')](0xc8);}})[_0xff16('0x3a')](handleError(_0x442a06,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ee55f82..6ac6e82 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 _0xe486=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','update','remove','getUsers','then','setDataValue','map','unreadMessages','length'];(function(_0x34fea9,_0x4454b7){var _0xf5a367=function(_0x4ba17d){while(--_0x4ba17d){_0x34fea9['push'](_0x34fea9['shift']());}};_0xf5a367(++_0x4454b7);}(_0xe486,0xa4));var _0x6e48=function(_0x2a153b,_0x2d5c66){_0x2a153b=_0x2a153b-0x0;var _0x37d930=_0xe486[_0x2a153b];return _0x37d930;};'use strict';var EventEmitter=require(_0x6e48('0x0'));var OpenchannelInteraction=require(_0x6e48('0x1'))['db'][_0x6e48('0x2')];var OpenchannelMessage=require(_0x6e48('0x1'))['db'][_0x6e48('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6e48('0x4'),'afterDestroy':_0x6e48('0x5')};function emitEvent(_0x3d5593){return function(_0x35430f,_0x33d581,_0x47ede2){_0x35430f[_0x6e48('0x6')]({'attributes':['id'],'raw':!![]})[_0x6e48('0x7')](function(_0x34e84c){_0x35430f[_0x6e48('0x8')]('Users',_0x34e84c[_0x6e48('0x9')](function(_0x13d5d9){return{'id':_0x13d5d9['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x35430f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6e48('0x7')](function(_0x44f779){_0x35430f[_0x6e48('0x8')](_0x6e48('0xa'),_0x44f779[_0x6e48('0xb')]);OpenchannelInteractionEvents[_0x6e48('0xc')](_0x3d5593+':'+_0x35430f['id'],_0x35430f);OpenchannelInteractionEvents[_0x6e48('0xc')](_0x3d5593,_0x35430f);_0x47ede2(null);})[_0x6e48('0xd')](_0x47ede2(null));};}for(var e in events){if(events[_0x6e48('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x6e48('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6d0d=['setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','getUsers','then'];(function(_0x16dcc0,_0x3016f8){var _0x1076d4=function(_0xfae9a2){while(--_0xfae9a2){_0x16dcc0['push'](_0x16dcc0['shift']());}};_0x1076d4(++_0x3016f8);}(_0x6d0d,0x108));var _0xd6d0=function(_0x4cab2f,_0x25df76){_0x4cab2f=_0x4cab2f-0x0;var _0x4a35d5=_0x6d0d[_0x4cab2f];return _0x4a35d5;};'use strict';var EventEmitter=require(_0xd6d0('0x0'));var OpenchannelInteraction=require(_0xd6d0('0x1'))['db'][_0xd6d0('0x2')];var OpenchannelMessage=require(_0xd6d0('0x1'))['db'][_0xd6d0('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd6d0('0x4'),'afterUpdate':_0xd6d0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21abe7){return function(_0x2309f6,_0x44c637,_0x5d0896){_0x2309f6[_0xd6d0('0x6')]({'attributes':['id'],'raw':!![]})[_0xd6d0('0x7')](function(_0x5e8e5d){_0x2309f6[_0xd6d0('0x8')]('Users',_0x5e8e5d[_0xd6d0('0x9')](function(_0x473590){return{'id':_0x473590['id']};}));return OpenchannelMessage[_0xd6d0('0xa')]({'where':{'OpenchannelInteractionId':_0x2309f6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd6d0('0x7')](function(_0xd8301c){_0x2309f6[_0xd6d0('0x8')](_0xd6d0('0xb'),_0xd8301c[_0xd6d0('0xc')]);OpenchannelInteractionEvents[_0xd6d0('0xd')](_0x21abe7+':'+_0x2309f6['id'],_0x2309f6);OpenchannelInteractionEvents[_0xd6d0('0xd')](_0x21abe7,_0x2309f6);_0x5d0896(null);})[_0xd6d0('0xe')](_0x5d0896(null));};}for(var e in events){if(events[_0xd6d0('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xd6d0('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7eccd61..c3544a1 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 _0xdc36=['exports','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','../../config/environment'];(function(_0x398226,_0x4b5eae){var _0x280539=function(_0x50cace){while(--_0x50cace){_0x398226['push'](_0x398226['shift']());}};_0x280539(++_0x4b5eae);}(_0xdc36,0x73));var _0x6dc3=function(_0x16410f,_0x5ec630){_0x16410f=_0x16410f-0x0;var _0xc8bfa8=_0xdc36[_0x16410f];return _0xc8bfa8;};'use strict';var _=require(_0x6dc3('0x0'));var util=require(_0x6dc3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6dc3('0x2'));var BPromise=require('bluebird');var rp=require(_0x6dc3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6dc3('0x4'));var attributes=require('./openchannelInteraction.attributes');module[_0x6dc3('0x5')]=function(_0x3261b5,_0x2fb7ab){return _0x3261b5['define']('OpenchannelInteraction',attributes,{'tableName':_0x6dc3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6dc3('0x7'),'hooks':{'beforeUpdate':function(_0x56b1aa,_0xb81746,_0x10ce90){if(_0x56b1aa[_0x6dc3('0x8')](_0x6dc3('0x9'))){_0x56b1aa[_0x6dc3('0xa')]=moment()['format'](_0x6dc3('0xb'));}_0x10ce90(null,_0x56b1aa);}}});}; \ No newline at end of file +var _0x7fcf=['path','rimraf','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7fcf,0x128));var _0xf7fc=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x7fcf[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xf7fc('0x0'));var util=require(_0xf7fc('0x1'));var logger=require('../../config/logger')(_0xf7fc('0x2'));var moment=require(_0xf7fc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7fc('0x4'));var rimraf=require(_0xf7fc('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xf7fc('0x6')]=function(_0x2f6173,_0x4c75b2){return _0x2f6173['define'](_0xf7fc('0x7'),attributes,{'tableName':_0xf7fc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf7fc('0x9'),'collate':_0xf7fc('0xa'),'hooks':{'beforeUpdate':function(_0x4bf21c,_0x2d7489,_0x310059){if(_0x4bf21c[_0xf7fc('0xb')]('closed')){_0x4bf21c[_0xf7fc('0xc')]=moment()[_0xf7fc('0xd')](_0xf7fc('0xe'));}_0x310059(null,_0x4bf21c);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index b478faf..af291da 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 _0x30d1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./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','OpenchannelInteraction','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','catch','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x1558ee,_0x40ed70){var _0x252dba=function(_0x2dbde5){while(--_0x2dbde5){_0x1558ee['push'](_0x1558ee['shift']());}};_0x252dba(++_0x40ed70);}(_0x30d1,0xdd));var _0x130d=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0x30d1[_0x5806c3];return _0x48ac77;};'use strict';var _=require(_0x130d('0x0'));var util=require(_0x130d('0x1'));var moment=require(_0x130d('0x2'));var BPromise=require(_0x130d('0x3'));var rs=require(_0x130d('0x4'));var fs=require('fs');var Redis=require(_0x130d('0x5'));var db=require(_0x130d('0x6'))['db'];var utils=require(_0x130d('0x7'));var logger=require(_0x130d('0x8'))(_0x130d('0x9'));var config=require(_0x130d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x130d('0xb')][_0x130d('0xc')]({'port':0x232a});config[_0x130d('0xd')]=_[_0x130d('0xe')](config[_0x130d('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x130d('0xf'))(new Redis(config[_0x130d('0xd')]));require(_0x130d('0x10'))[_0x130d('0x11')](socket);function respondWithRpcPromise(_0x392063,_0x123a80,_0x436010){return new BPromise(function(_0x353809,_0x37c140){return client[_0x130d('0x12')](_0x392063,_0x436010)[_0x130d('0x13')](function(_0x232dc7){logger[_0x130d('0x14')](_0x130d('0x15'),_0x123a80,_0x130d('0x16'));logger[_0x130d('0x17')](_0x130d('0x18'),_0x123a80,'request\x20sent',JSON[_0x130d('0x19')](_0x232dc7));if(_0x232dc7[_0x130d('0x1a')]){if(_0x232dc7['error'][_0x130d('0x1b')]===0x1f4){logger['error'](_0x130d('0x15'),_0x123a80,_0x232dc7[_0x130d('0x1a')][_0x130d('0x1c')]);return _0x37c140(_0x232dc7[_0x130d('0x1a')][_0x130d('0x1c')]);}logger['error'](_0x130d('0x15'),_0x123a80,_0x232dc7[_0x130d('0x1a')][_0x130d('0x1c')]);return _0x353809(_0x232dc7[_0x130d('0x1a')]['message']);}else{logger[_0x130d('0x14')](_0x130d('0x15'),_0x123a80,'request\x20sent');_0x353809(_0x232dc7[_0x130d('0x1d')]['message']);}})['catch'](function(_0x131ca4){logger[_0x130d('0x1a')](_0x130d('0x15'),_0x123a80,_0x131ca4);_0x37c140(_0x131ca4);});});}exports['UpdateOpenchannelInteraction']=function(_0x603928){var _0x1a1092=this;return new Promise(function(_0x57c92d,_0x9ff687){return db[_0x130d('0x1e')][_0x130d('0x1f')](_0x603928[_0x130d('0x20')],{'raw':_0x603928[_0x130d('0x21')]?_0x603928[_0x130d('0x21')][_0x130d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x603928[_0x130d('0x21')]?_0x603928[_0x130d('0x21')]['where']||null:null,'attributes':_0x603928[_0x130d('0x21')]?_0x603928[_0x130d('0x21')][_0x130d('0x23')]||null:null,'limit':_0x603928[_0x130d('0x21')]?_0x603928['options'][_0x130d('0x24')]||null:null})['then'](function(_0x13acac){logger[_0x130d('0x14')](_0x130d('0x25'),_0x603928);logger[_0x130d('0x17')](_0x130d('0x25'),_0x603928,JSON[_0x130d('0x19')](_0x13acac));_0x57c92d(_0x13acac);})[_0x130d('0x26')](function(_0x23b014){logger[_0x130d('0x1a')](_0x130d('0x25'),_0x23b014[_0x130d('0x1c')],_0x603928);_0x9ff687(_0x1a1092[_0x130d('0x1a')](0x1f4,_0x23b014['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x859433){return new Promise(function(_0x4281a4,_0x113fcb){return db[_0x130d('0x1e')]['find']({'where':_0x859433['options']?_0x859433[_0x130d('0x21')][_0x130d('0x27')]||null:null})[_0x130d('0x13')](function(_0x37455b){if(_0x37455b){return _0x37455b[_0x130d('0x28')](_0x859433[_0x130d('0x20')][_0x130d('0x29')],_[_0x130d('0x2a')](_0x859433[_0x130d('0x20')],['ids','id'])||{});}})[_0x130d('0x2b')](function(_0x48aa13){logger[_0x130d('0x14')](_0x130d('0x2c'),_0x859433);logger[_0x130d('0x17')]('AddTags',_0x859433,JSON[_0x130d('0x19')](_0x48aa13));_0x4281a4(_0x48aa13);})[_0x130d('0x26')](function(_0x3d263c){logger[_0x130d('0x1a')](_0x130d('0x2c'),_0x3d263c[_0x130d('0x1c')],_0x859433);_0x113fcb(_this[_0x130d('0x1a')](0x1f4,_0x3d263c[_0x130d('0x1c')]));});});}; \ No newline at end of file +var _0xce60=['UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch'];(function(_0x2178e9,_0x30db4c){var _0x51113b=function(_0xf469aa){while(--_0xf469aa){_0x2178e9['push'](_0x2178e9['shift']());}};_0x51113b(++_0x30db4c);}(_0xce60,0x150));var _0x0ce6=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xce60[_0x3aeb36];return _0xa2ef21;};'use strict';var _=require(_0x0ce6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ce6('0x1'));var rs=require(_0x0ce6('0x2'));var fs=require('fs');var Redis=require(_0x0ce6('0x3'));var db=require(_0x0ce6('0x4'))['db'];var utils=require(_0x0ce6('0x5'));var logger=require(_0x0ce6('0x6'))(_0x0ce6('0x7'));var config=require(_0x0ce6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0ce6('0x9')][_0x0ce6('0xa')]({'port':0x232a});config[_0x0ce6('0xb')]=_[_0x0ce6('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0ce6('0xd'))(new Redis(config[_0x0ce6('0xb')]));require(_0x0ce6('0xe'))[_0x0ce6('0xf')](socket);function respondWithRpcPromise(_0x311a90,_0x584e1c,_0x74521d){return new BPromise(function(_0x416e9a,_0x4c5824){return client['request'](_0x311a90,_0x74521d)['then'](function(_0x371098){logger[_0x0ce6('0x10')](_0x0ce6('0x11'),_0x584e1c,'request\x20sent');logger[_0x0ce6('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x584e1c,_0x0ce6('0x13'),JSON['stringify'](_0x371098));if(_0x371098['error']){if(_0x371098[_0x0ce6('0x14')]['code']===0x1f4){logger[_0x0ce6('0x14')](_0x0ce6('0x11'),_0x584e1c,_0x371098[_0x0ce6('0x14')][_0x0ce6('0x15')]);return _0x4c5824(_0x371098[_0x0ce6('0x14')][_0x0ce6('0x15')]);}logger[_0x0ce6('0x14')](_0x0ce6('0x11'),_0x584e1c,_0x371098[_0x0ce6('0x14')][_0x0ce6('0x15')]);return _0x416e9a(_0x371098['error'][_0x0ce6('0x15')]);}else{logger[_0x0ce6('0x10')](_0x0ce6('0x11'),_0x584e1c,'request\x20sent');_0x416e9a(_0x371098[_0x0ce6('0x16')][_0x0ce6('0x15')]);}})[_0x0ce6('0x17')](function(_0x2c0151){logger[_0x0ce6('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x584e1c,_0x2c0151);_0x4c5824(_0x2c0151);});});}exports[_0x0ce6('0x18')]=function(_0x402b3d){var _0x4ae0fd=this;return new Promise(function(_0x410751,_0x38451d){return db[_0x0ce6('0x19')][_0x0ce6('0x1a')](_0x402b3d[_0x0ce6('0x1b')],{'raw':_0x402b3d[_0x0ce6('0x1c')]?_0x402b3d['options'][_0x0ce6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x402b3d['options']?_0x402b3d['options'][_0x0ce6('0x1e')]||null:null,'attributes':_0x402b3d['options']?_0x402b3d[_0x0ce6('0x1c')][_0x0ce6('0x1f')]||null:null,'limit':_0x402b3d[_0x0ce6('0x1c')]?_0x402b3d[_0x0ce6('0x1c')][_0x0ce6('0x20')]||null:null})['then'](function(_0x2fd2d7){logger[_0x0ce6('0x10')](_0x0ce6('0x18'),_0x402b3d);logger[_0x0ce6('0x12')]('UpdateOpenchannelInteraction',_0x402b3d,JSON[_0x0ce6('0x21')](_0x2fd2d7));_0x410751(_0x2fd2d7);})[_0x0ce6('0x17')](function(_0x27815c){logger[_0x0ce6('0x14')](_0x0ce6('0x18'),_0x27815c[_0x0ce6('0x15')],_0x402b3d);_0x38451d(_0x4ae0fd[_0x0ce6('0x14')](0x1f4,_0x27815c[_0x0ce6('0x15')]));});});};exports[_0x0ce6('0x22')]=function(_0x18e3cb){return new Promise(function(_0x21875c,_0x3d69f0){return db[_0x0ce6('0x19')][_0x0ce6('0x23')]({'where':_0x18e3cb['options']?_0x18e3cb['options'][_0x0ce6('0x1e')]||null:null})['then'](function(_0x458bf2){if(_0x458bf2){return _0x458bf2['addTags'](_0x18e3cb['body'][_0x0ce6('0x24')],_[_0x0ce6('0x25')](_0x18e3cb['body'],[_0x0ce6('0x24'),'id'])||{});}})[_0x0ce6('0x26')](function(_0xd189f2){logger['info'](_0x0ce6('0x27'),_0x18e3cb);logger['debug'](_0x0ce6('0x27'),_0x18e3cb,JSON[_0x0ce6('0x21')](_0xd189f2));_0x21875c(_0xd189f2);})[_0x0ce6('0x17')](function(_0x5106d2){logger[_0x0ce6('0x14')](_0x0ce6('0x27'),_0x5106d2[_0x0ce6('0x15')],_0x18e3cb);_0x3d69f0(_this[_0x0ce6('0x14')](0x1f4,_0x5106d2[_0x0ce6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a2e3668..286dd86 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 _0x539b=['emit','removeListener','openchannelInteraction:','./openchannelInteraction.events','save','update'];(function(_0x525bf2,_0xb771c9){var _0x5a2baa=function(_0x24579c){while(--_0x24579c){_0x525bf2['push'](_0x525bf2['shift']());}};_0x5a2baa(++_0xb771c9);}(_0x539b,0x195));var _0xb539=function(_0x27a32e,_0x491865){_0x27a32e=_0x27a32e-0x0;var _0x2d1c87=_0x539b[_0x27a32e];return _0x2d1c87;};'use strict';var OpenchannelInteractionEvents=require(_0xb539('0x0'));var events=[_0xb539('0x1'),'remove',_0xb539('0x2')];function createListener(_0x302eea,_0x58e2cc){return function(_0x1e6c5f){_0x58e2cc[_0xb539('0x3')](_0x302eea,_0x1e6c5f);};}function removeListener(_0x5f0974,_0x4b5e01){return function(){OpenchannelInteractionEvents[_0xb539('0x4')](_0x5f0974,_0x4b5e01);};}exports['register']=function(_0x3bc2e1){for(var _0x57d594=0x0,_0x549b26=events['length'];_0x57d594<_0x549b26;_0x57d594++){var _0x581bf1=events[_0x57d594];var _0x51c29a=createListener(_0xb539('0x5')+_0x581bf1,_0x3bc2e1);OpenchannelInteractionEvents['on'](_0x581bf1,_0x51c29a);}}; \ No newline at end of file +var _0xc59a=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0xc59a,0xb1));var _0xac59=function(_0x143a84,_0x5b6d11){_0x143a84=_0x143a84-0x0;var _0x2dac81=_0xc59a[_0x143a84];return _0x2dac81;};'use strict';var OpenchannelInteractionEvents=require(_0xac59('0x0'));var events=[_0xac59('0x1'),_0xac59('0x2'),_0xac59('0x3')];function createListener(_0x28d2a3,_0x5d2ef7){return function(_0x23d441){_0x5d2ef7[_0xac59('0x4')](_0x28d2a3,_0x23d441);};}function removeListener(_0x1f0565,_0x5f4198){return function(){OpenchannelInteractionEvents[_0xac59('0x5')](_0x1f0565,_0x5f4198);};}exports['register']=function(_0x405cfe){for(var _0x63b3cc=0x0,_0x1c318b=events[_0xac59('0x6')];_0x63b3cc<_0x1c318b;_0x63b3cc++){var _0xa9a54f=events[_0x63b3cc];var _0x587ca6=createListener(_0xac59('0x7')+_0xa9a54f,_0x405cfe);OpenchannelInteractionEvents['on'](_0xa9a54f,_0x587ca6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 2cf9d1a..c3818f2 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x51ee45,_0x3df551){var _0x2ac5dc=function(_0x38c2f1){while(--_0x38c2f1){_0x51ee45['push'](_0x51ee45['shift']());}};_0x2ac5dc(++_0x3df551);}(_0xe706,0xa3));var _0x6e70=function(_0x1e8219,_0x31b4a0){_0x1e8219=_0x1e8219-0x0;var _0x37d537=_0xe706[_0x1e8219];return _0x37d537;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x39316c,_0x4bc4c1){var _0x1a0099=function(_0x2c5187){while(--_0x2c5187){_0x39316c['push'](_0x39316c['shift']());}};_0x1a0099(++_0x4bc4c1);}(_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('./openchannelMessage.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')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index d20723c..49ab93e 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 _0x117c=['ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x117c,0x71));var _0xc117=function(_0x33c3d3,_0x51eed3){_0x33c3d3=_0x33c3d3-0x0;var _0xf3a17f=_0x117c[_0x33c3d3];return _0xf3a17f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xc117('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc117('0x1')]('in',_0xc117('0x2')),'defaultValue':_0xc117('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc117('0x3')]},'providerName':{'type':Sequelize[_0xc117('0x4')]},'providerResponse':{'type':Sequelize[_0xc117('0x5')]}}; \ No newline at end of file +var _0xb84e=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x134ff8,_0x39a6bd){var _0x49a773=function(_0x19073d){while(--_0x19073d){_0x134ff8['push'](_0x134ff8['shift']());}};_0x49a773(++_0x39a6bd);}(_0xb84e,0xbf));var _0xeb84=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0xb84e[_0x695b76];return _0x1dc21f;};'use strict';var Sequelize=require('sequelize');module[_0xeb84('0x0')]={'body':{'type':Sequelize[_0xeb84('0x1')](_0xeb84('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeb84('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xeb84('0x4')),'defaultValue':_0xeb84('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb84('0x5')]},'providerName':{'type':Sequelize[_0xeb84('0x6')]},'providerResponse':{'type':Sequelize[_0xeb84('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 30cd42a..d8286fb 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 _0x5d60=['send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','body','find','describe','../../config/logger','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','internal','manual','SIP/%s','channel','event','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','User','fullname','email','interface','EventManager','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x5d60,0xcc));var _0x05d6=function(_0x1d4871,_0x39763e){_0x1d4871=_0x1d4871-0x0;var _0xa89b4=_0x5d60[_0x1d4871];return _0xa89b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05d6('0x0'));var zipdir=require(_0x05d6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05d6('0x2'));var moment=require('moment');var BPromise=require(_0x05d6('0x3'));var Mustache=require(_0x05d6('0x4'));var util=require(_0x05d6('0x5'));var path=require(_0x05d6('0x6'));var sox=require(_0x05d6('0x7'));var csv=require(_0x05d6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05d6('0x9'));var _=require('lodash');var squel=require(_0x05d6('0xa'));var crypto=require(_0x05d6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x05d6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x05d6('0xd'));var Papa=require(_0x05d6('0xe'));var Redis=require(_0x05d6('0xf'));var authService=require(_0x05d6('0x10'));var qs=require(_0x05d6('0x11'));var as=require(_0x05d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x05d6('0x13'));var config=require(_0x05d6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x05d6('0x15'))['db'];config[_0x05d6('0x16')]=_[_0x05d6('0x17')](config['redis'],{'host':_0x05d6('0x18'),'port':0x18eb});var socket=require(_0x05d6('0x19'))(new Redis(config[_0x05d6('0x16')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x05d6('0x1a'));var client=jayson[_0x05d6('0x1b')][_0x05d6('0x1c')]({'port':0x232c});var client9002=jayson[_0x05d6('0x1b')][_0x05d6('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x14ba2c,_0x2a3307,_0x6918,_0x569579){return new BPromise(function(_0x501920,_0x184d3e){var _0x2076e9=_0x569579||client;return _0x2076e9[_0x05d6('0x1d')](_0x14ba2c,_0x6918)['then'](function(_0x5ec114){logger[_0x05d6('0x1e')](_0x05d6('0x1f'),_0x2a3307,_0x05d6('0x20'));logger['debug'](_0x05d6('0x21'),_0x2a3307,_0x05d6('0x20'),JSON[_0x05d6('0x22')](_0x5ec114));if(_0x5ec114[_0x05d6('0x23')]){if(_0x5ec114[_0x05d6('0x23')][_0x05d6('0x24')]===0x1f4){logger[_0x05d6('0x23')](_0x05d6('0x1f'),_0x2a3307,_0x5ec114[_0x05d6('0x23')]['message']);return _0x184d3e(_0x5ec114[_0x05d6('0x23')][_0x05d6('0x25')]);}logger[_0x05d6('0x23')](_0x05d6('0x1f'),_0x2a3307,_0x5ec114['error'][_0x05d6('0x25')]);return _0x501920(_0x5ec114[_0x05d6('0x23')][_0x05d6('0x25')]);}else{logger[_0x05d6('0x1e')](_0x05d6('0x1f'),_0x2a3307,_0x05d6('0x20'));_0x501920(_0x5ec114[_0x05d6('0x26')][_0x05d6('0x25')]);}})['catch'](function(_0x457f57){logger[_0x05d6('0x23')](_0x05d6('0x1f'),_0x2a3307,_0x457f57);_0x184d3e(_0x457f57);});});}function respondWithStatusCode(_0x3ce6f9,_0x663897){_0x663897=_0x663897||0xcc;return function(_0x470cc6){if(_0x470cc6){return _0x3ce6f9[_0x05d6('0x27')](_0x663897);}return _0x3ce6f9[_0x05d6('0x28')](_0x663897)[_0x05d6('0x29')]();};}function respondWithResult(_0xe68944,_0x39de6d){_0x39de6d=_0x39de6d||0xc8;return function(_0x2653fa){if(_0x2653fa){return _0xe68944[_0x05d6('0x28')](_0x39de6d)[_0x05d6('0x2a')](_0x2653fa);}};}function respondWithFilteredResult(_0xc615ad,_0x158856){return function(_0x43c4dc){if(_0x43c4dc){var _0x1f35b8=typeof _0x158856['offset']===_0x05d6('0x2b')&&typeof _0x158856[_0x05d6('0x2c')]===_0x05d6('0x2b');var _0x1eea5d=_0x43c4dc[_0x05d6('0x2d')];var _0x29ae8b=_0x1f35b8?0x0:_0x158856[_0x05d6('0x2e')];var _0x3047db=_0x1f35b8?_0x43c4dc[_0x05d6('0x2d')]:_0x158856[_0x05d6('0x2e')]+_0x158856['limit'];var _0x3717e7;if(_0x3047db>=_0x1eea5d){_0x3047db=_0x1eea5d;_0x3717e7=0xc8;}else{_0x3717e7=0xce;}_0xc615ad[_0x05d6('0x28')](_0x3717e7);return _0xc615ad[_0x05d6('0x2f')](_0x05d6('0x30'),_0x29ae8b+'-'+_0x3047db+'/'+_0x1eea5d)[_0x05d6('0x2a')](_0x43c4dc);}return null;};}function patchUpdates(_0x5d1f60){return function(_0x2251c8){try{jsonpatch[_0x05d6('0x31')](_0x2251c8,_0x5d1f60,!![]);}catch(_0x139a41){return BPromise['reject'](_0x139a41);}return _0x2251c8[_0x05d6('0x32')]();};}function saveUpdates(_0x4dcdcf,_0x44aa9d){return function(_0x3ee4de){if(_0x3ee4de){return _0x3ee4de[_0x05d6('0x33')](_0x4dcdcf)[_0x05d6('0x34')](function(_0x2d1eb5){return _0x2d1eb5;});}return null;};}function removeEntity(_0x24d564,_0x43703e){return function(_0x3b16a9){if(_0x3b16a9){return _0x3b16a9[_0x05d6('0x35')]()[_0x05d6('0x34')](function(){_0x24d564[_0x05d6('0x28')](0xcc)[_0x05d6('0x29')]();});}};}function handleEntityNotFound(_0x4a3ac8,_0x33461e){return function(_0x2c09dc){if(!_0x2c09dc){_0x4a3ac8[_0x05d6('0x27')](0x194);}return _0x2c09dc;};}function handleError(_0x1f4f94,_0xccb433){_0xccb433=_0xccb433||0x1f4;return function(_0x464526){logger['error'](_0x464526[_0x05d6('0x36')]);if(_0x464526[_0x05d6('0x37')]){delete _0x464526['name'];}_0x1f4f94['status'](_0xccb433)[_0x05d6('0x38')](_0x464526);};}exports[_0x05d6('0x39')]=function(_0x339060,_0x5cb77f){var _0xfb0591={},_0x3af665={},_0x33a29b={'count':0x0,'rows':[]};var _0x497b04=_[_0x05d6('0x3a')](db[_0x05d6('0x3b')][_0x05d6('0x3c')],function(_0x153359){return{'name':_0x153359[_0x05d6('0x3d')],'type':_0x153359[_0x05d6('0x3e')][_0x05d6('0x3f')]};});_0x3af665[_0x05d6('0x40')]=_[_0x05d6('0x3a')](_0x497b04,_0x05d6('0x37'));_0x3af665[_0x05d6('0x41')]=_[_0x05d6('0x42')](_0x339060[_0x05d6('0x41')]);_0x3af665['filters']=_[_0x05d6('0x43')](_0x3af665[_0x05d6('0x40')],_0x3af665[_0x05d6('0x41')]);_0xfb0591[_0x05d6('0x44')]=_['intersection'](_0x3af665[_0x05d6('0x40')],qs[_0x05d6('0x45')](_0x339060['query']['fields']));_0xfb0591['attributes']=_0xfb0591[_0x05d6('0x44')]['length']?_0xfb0591['attributes']:_0x3af665[_0x05d6('0x40')];if(!_0x339060[_0x05d6('0x41')][_0x05d6('0x46')](_0x05d6('0x47'))){_0xfb0591[_0x05d6('0x2c')]=qs['limit'](_0x339060['query']['limit']);_0xfb0591['offset']=qs[_0x05d6('0x2e')](_0x339060[_0x05d6('0x41')]['offset']);}_0xfb0591['order']=qs[_0x05d6('0x48')](_0x339060[_0x05d6('0x41')][_0x05d6('0x48')]);_0xfb0591['where']=qs[_0x05d6('0x49')](_[_0x05d6('0x4a')](_0x339060['query'],_0x3af665[_0x05d6('0x49')]),_0x497b04);if(_0x339060[_0x05d6('0x41')]['filter']){_0xfb0591[_0x05d6('0x4b')]=_[_0x05d6('0x4c')](_0xfb0591[_0x05d6('0x4b')],{'$or':_[_0x05d6('0x3a')](_0x497b04,function(_0x334932){if(_0x334932[_0x05d6('0x3e')]!==_0x05d6('0x4d')){var _0x24ecb8={};_0x24ecb8[_0x334932[_0x05d6('0x37')]]={'$like':'%'+_0x339060[_0x05d6('0x41')][_0x05d6('0x4e')]+'%'};return _0x24ecb8;}})});}_0xfb0591=_[_0x05d6('0x4c')]({},_0xfb0591,_0x339060[_0x05d6('0x4f')]);var _0x193cb3={'where':_0xfb0591[_0x05d6('0x4b')]};return db[_0x05d6('0x3b')][_0x05d6('0x2d')](_0x193cb3)[_0x05d6('0x34')](function(_0x4fd967){_0x33a29b[_0x05d6('0x2d')]=_0x4fd967;if(_0x339060[_0x05d6('0x41')][_0x05d6('0x50')]){_0xfb0591[_0x05d6('0x51')]=[{'all':!![]}];}return db[_0x05d6('0x3b')][_0x05d6('0x52')](_0xfb0591);})[_0x05d6('0x34')](function(_0x3668d8){_0x33a29b[_0x05d6('0x53')]=_0x3668d8;return _0x33a29b;})[_0x05d6('0x34')](respondWithFilteredResult(_0x5cb77f,_0xfb0591))[_0x05d6('0x54')](handleError(_0x5cb77f,null));};exports[_0x05d6('0x55')]=function(_0xc07d6a,_0x32c6f2){var _0x26577c={'raw':!![],'where':{'id':_0xc07d6a[_0x05d6('0x56')]['id']}},_0x43a251={};_0x43a251[_0x05d6('0x40')]=_[_0x05d6('0x42')](db['OpenchannelMessage'][_0x05d6('0x3c')]);_0x43a251[_0x05d6('0x41')]=_[_0x05d6('0x42')](_0xc07d6a[_0x05d6('0x41')]);_0x43a251[_0x05d6('0x49')]=_[_0x05d6('0x43')](_0x43a251[_0x05d6('0x40')],_0x43a251[_0x05d6('0x41')]);_0x26577c[_0x05d6('0x44')]=_[_0x05d6('0x43')](_0x43a251[_0x05d6('0x40')],qs[_0x05d6('0x45')](_0xc07d6a[_0x05d6('0x41')][_0x05d6('0x45')]));_0x26577c['attributes']=_0x26577c[_0x05d6('0x44')]['length']?_0x26577c[_0x05d6('0x44')]:_0x43a251['model'];if(_0xc07d6a[_0x05d6('0x41')][_0x05d6('0x50')]){_0x26577c['include']=[{'all':!![]}];}_0x26577c=_[_0x05d6('0x4c')]({},_0x26577c,_0xc07d6a['options']);return db[_0x05d6('0x3b')]['find'](_0x26577c)[_0x05d6('0x34')](handleEntityNotFound(_0x32c6f2,null))[_0x05d6('0x34')](respondWithResult(_0x32c6f2,null))[_0x05d6('0x54')](handleError(_0x32c6f2,null));};exports['create']=function(_0x318065,_0x4d73d8){return db[_0x05d6('0x3b')]['create'](_0x318065[_0x05d6('0x57')],{})[_0x05d6('0x34')](respondWithResult(_0x4d73d8,0xc9))['catch'](handleError(_0x4d73d8,null));};exports['update']=function(_0xbd119f,_0x49b671){if(_0xbd119f[_0x05d6('0x57')]['id']){delete _0xbd119f['body']['id'];}return db[_0x05d6('0x3b')][_0x05d6('0x58')]({'where':{'id':_0xbd119f[_0x05d6('0x56')]['id']}})[_0x05d6('0x34')](handleEntityNotFound(_0x49b671,null))[_0x05d6('0x34')](saveUpdates(_0xbd119f[_0x05d6('0x57')],null))[_0x05d6('0x34')](respondWithResult(_0x49b671,null))[_0x05d6('0x54')](handleError(_0x49b671,null));};exports[_0x05d6('0x35')]=function(_0x153790,_0x5436c7){return db[_0x05d6('0x3b')][_0x05d6('0x58')]({'where':{'id':_0x153790[_0x05d6('0x56')]['id']}})[_0x05d6('0x34')](handleEntityNotFound(_0x5436c7,null))[_0x05d6('0x34')](removeEntity(_0x5436c7,null))['catch'](handleError(_0x5436c7,null));};exports[_0x05d6('0x59')]=function(_0x1becbb,_0x2782fc){return db['OpenchannelMessage'][_0x05d6('0x59')]()[_0x05d6('0x34')](respondWithResult(_0x2782fc,null))['catch'](handleError(_0x2782fc,null));};var interaction_log=require(_0x05d6('0x5a'))(_0x05d6('0x5b'));exports[_0x05d6('0x5c')]=function(_0x549f4c,_0x346c97,_0x2f9121){var _0x3ee63a={'agent':{},'channel':_0x05d6('0x5d')};if(_0x549f4c['body']['id']){delete _0x549f4c['body']['id'];}_0x549f4c['body']['read']=!![];_0x549f4c[_0x05d6('0x57')][_0x05d6('0x5e')]=moment()[_0x05d6('0x5f')](_0x05d6('0x60'));_0x549f4c['body'][_0x05d6('0x61')]=_0x549f4c['body'][_0x05d6('0x61')]||_0x549f4c['user']['id'];_0x3ee63a[_0x05d6('0x62')]['id']=_0x549f4c[_0x05d6('0x57')][_0x05d6('0x61')];return db[_0x05d6('0x3b')][_0x05d6('0x58')]({'where':{'id':_0x549f4c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x346c97,null))[_0x05d6('0x34')](saveUpdates(_0x549f4c[_0x05d6('0x57')],null))[_0x05d6('0x34')](function(_0xa645ee){if(_0xa645ee){_0x3ee63a[_0x05d6('0x25')]=_0xa645ee[_0x05d6('0x63')]({'plain':!![]});return db[_0x05d6('0x64')]['find']({'where':{'id':_0xa645ee[_0x05d6('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x346c97,null))[_0x05d6('0x34')](function(_0x346358){if(_0x346358){return _0x346358[_0x05d6('0x33')]({'UserId':_0x549f4c[_0x05d6('0x57')]['UserId'],'read1stAt':_['isNil'](_0x346358[_0x05d6('0x66')])?moment()[_0x05d6('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x05d6('0x34')](function(_0x1d0bfa){if(_0x1d0bfa){_0x3ee63a[_0x05d6('0x67')]=_0x1d0bfa[_0x05d6('0x63')]({'plain':!![]});interaction_log[_0x05d6('0x1e')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x549f4c[_0x05d6('0x68')]['id'],_0x549f4c['user'][_0x05d6('0x37')],_0x549f4c['user'][_0x05d6('0x69')],_0x3ee63a[_0x05d6('0x67')]['id'],_0x549f4c[_0x05d6('0x57')]?JSON[_0x05d6('0x22')](_0x549f4c[_0x05d6('0x57')]):_0x05d6('0x6a'));return respondWithRpcPromise(_0x05d6('0x6b'),_0x05d6('0x6c'),_0x3ee63a);}return null;})[_0x05d6('0x34')](function(_0x1ec3d4){var _0x38cafa=_0x05d6('0x6d')+_0x1ec3d4[_0x05d6('0x25')]['ContactId'];return db[_0x05d6('0x6e')][_0x05d6('0x41')](_0x38cafa,{'type':db[_0x05d6('0x6f')][_0x05d6('0x70')][_0x05d6('0x71')],'raw':!![]})[_0x05d6('0x34')](function(_0x1274b9){return _0x1274b9;});})[_0x05d6('0x34')](function(_0x1d6375){if(_0x1d6375){_0x3ee63a[_0x05d6('0x25')][_0x05d6('0x72')]=_0x1d6375[0x0];if(!_0x549f4c['body'][_0x05d6('0x61')])return;return db['User'][_0x05d6('0x58')]({'where':{'id':_0x549f4c['body'][_0x05d6('0x61')],'role':_0x05d6('0x62')},'attributes':['id',_0x05d6('0x37'),'fullname','email',_0x05d6('0x73')],'raw':!![]});}return null;})[_0x05d6('0x34')](function(_0x22f08b){if(!_0x22f08b)return null;_0x3ee63a['message'][_0x05d6('0x62')]=_0x22f08b;return _0x3ee63a;})['then'](function(_0x30376c){if(_0x30376c){if(_0x549f4c[_0x05d6('0x57')][_0x05d6('0x74')]){_0x3ee63a['message']['interface']=util['format'](_0x05d6('0x75'),_0x549f4c[_0x05d6('0x68')]['name']);_0x3ee63a['message'][_0x05d6('0x76')]=_0x3ee63a['channel'];_0x3ee63a[_0x05d6('0x25')][_0x05d6('0x77')]=_0x05d6('0x5c');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x05d6('0x78'),'message':_0x3ee63a[_0x05d6('0x25')]},client9002)[_0x05d6('0x34')](function(){return _0x3ee63a;});}return _0x3ee63a;}return null;})[_0x05d6('0x34')](respondWithResult(_0x346c97,null))[_0x05d6('0x54')](handleError(_0x346c97,null));};var interaction_log=require(_0x05d6('0x5a'))(_0x05d6('0x5b'));exports['reject']=function(_0x2bbedd,_0xeb1346,_0xa7e27b){var _0x548e5f={'agent':{},'channel':'openchannel'};if(_0x2bbedd[_0x05d6('0x57')]['id']){delete _0x2bbedd[_0x05d6('0x57')]['id'];}_0x2bbedd['body'][_0x05d6('0x61')]=_0x2bbedd[_0x05d6('0x57')][_0x05d6('0x61')]||_0x2bbedd['user']['id'];_0x548e5f[_0x05d6('0x62')]['id']=_0x2bbedd['body'][_0x05d6('0x61')];return db[_0x05d6('0x3b')]['find']({'where':{'id':_0x2bbedd['params']['id'],'UserId':null}})[_0x05d6('0x34')](handleEntityNotFound(_0xeb1346,null))[_0x05d6('0x34')](function(_0x46e910){if(_0x46e910){_0x548e5f[_0x05d6('0x25')]=_0x46e910['get']({'plain':!![]});return db[_0x05d6('0x64')][_0x05d6('0x58')]({'where':{'id':_0x46e910[_0x05d6('0x65')]}});}return null;})[_0x05d6('0x34')](handleEntityNotFound(_0xeb1346,null))['then'](function(_0x4940f5){if(_0x4940f5){_0x548e5f[_0x05d6('0x67')]=_0x4940f5['get']({'plain':!![]});interaction_log[_0x05d6('0x1e')](_0x05d6('0x79'),_0x2bbedd['user']['id'],_0x2bbedd[_0x05d6('0x68')][_0x05d6('0x37')],_0x2bbedd[_0x05d6('0x68')][_0x05d6('0x69')],_0x548e5f[_0x05d6('0x67')]['id'],_0x2bbedd[_0x05d6('0x57')]?JSON[_0x05d6('0x22')](_0x2bbedd[_0x05d6('0x57')]):'null');return respondWithRpcPromise(_0x05d6('0x7a'),_0x05d6('0x7b'),_0x548e5f);}return null;})[_0x05d6('0x34')](function(_0x3de597){var _0x1f9edc=_0x05d6('0x6d')+_0x3de597[_0x05d6('0x25')][_0x05d6('0x7c')];return db['sequelize']['query'](_0x1f9edc,{'type':db[_0x05d6('0x6f')][_0x05d6('0x70')]['SELECT'],'raw':!![]})[_0x05d6('0x34')](function(_0x585b8b){return _0x585b8b;});})[_0x05d6('0x34')](function(_0x7e1d4d){if(_0x7e1d4d){_0x548e5f[_0x05d6('0x25')][_0x05d6('0x72')]=_0x7e1d4d[0x0];if(!_0x2bbedd[_0x05d6('0x57')][_0x05d6('0x61')])return;return db[_0x05d6('0x7d')]['find']({'where':{'id':_0x2bbedd[_0x05d6('0x57')][_0x05d6('0x61')],'role':_0x05d6('0x62')},'attributes':['id',_0x05d6('0x37'),_0x05d6('0x7e'),_0x05d6('0x7f'),_0x05d6('0x73')],'raw':!![]});}return null;})[_0x05d6('0x34')](function(_0x33929e){if(!_0x33929e)return null;_0x548e5f[_0x05d6('0x25')][_0x05d6('0x62')]=_0x33929e;return _0x548e5f;})[_0x05d6('0x34')](function(_0x4d0937){if(_0x4d0937){_0x4d0937[_0x05d6('0x25')][_0x05d6('0x80')]=util[_0x05d6('0x5f')](_0x05d6('0x75'),_0x2bbedd[_0x05d6('0x68')][_0x05d6('0x37')]);_0x4d0937[_0x05d6('0x25')]['channel']=_0x548e5f['channel'];_0x4d0937[_0x05d6('0x25')][_0x05d6('0x77')]='reject';respondWithRpcPromise(_0x05d6('0x81'),_0x05d6('0x81'),{'event':'rejectmessage','message':_0x4d0937['message']},client9002);return _0x548e5f;}return null;})[_0x05d6('0x34')](respondWithResult(_0xeb1346,null))['catch'](handleError(_0xeb1346,null));}; \ No newline at end of file +var _0x7b8b=['OpenchannelMessage','rows','show','params','merge','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','interface','channel','event','EventManager','OpenchannelInteractionId','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','request-promise','moment','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','name','index','map','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include'];(function(_0x3cb1f6,_0x1e0c6d){var _0x187362=function(_0x8743b2){while(--_0x8743b2){_0x3cb1f6['push'](_0x3cb1f6['shift']());}};_0x187362(++_0x1e0c6d);}(_0x7b8b,0x1ab));var _0xb7b8=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x7b8b[_0x21b36c];return _0x236627;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb7b8('0x0'));var moment=require(_0xb7b8('0x1'));var BPromise=require(_0xb7b8('0x2'));var Mustache=require('mustache');var util=require(_0xb7b8('0x3'));var path=require(_0xb7b8('0x4'));var sox=require(_0xb7b8('0x5'));var csv=require('to-csv');var ejs=require(_0xb7b8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb7b8('0x7'));var jsforce=require(_0xb7b8('0x8'));var deskjs=require(_0xb7b8('0x9'));var toCsv=require(_0xb7b8('0xa'));var querystring=require(_0xb7b8('0xb'));var Papa=require(_0xb7b8('0xc'));var Redis=require(_0xb7b8('0xd'));var authService=require(_0xb7b8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb7b8('0xf'));var hardwareService=require(_0xb7b8('0x10'));var logger=require('../../config/logger')(_0xb7b8('0x11'));var utils=require('../../config/utils');var config=require(_0xb7b8('0x12'));var licenseUtil=require(_0xb7b8('0x13'));var db=require(_0xb7b8('0x14'))['db'];config['redis']=_[_0xb7b8('0x15')](config['redis'],{'host':_0xb7b8('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb7b8('0x17')]));require(_0xb7b8('0x18'))[_0xb7b8('0x19')](socket);var jayson=require(_0xb7b8('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xb7b8('0x1b')][_0xb7b8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x224a5d,_0x233df2,_0x48a92e,_0x3f46aa){return new BPromise(function(_0x3ff343,_0x45c985){var _0x2094d5=_0x3f46aa||client;return _0x2094d5[_0xb7b8('0x1d')](_0x224a5d,_0x48a92e)[_0xb7b8('0x1e')](function(_0x5b9064){logger[_0xb7b8('0x1f')](_0xb7b8('0x20'),_0x233df2,_0xb7b8('0x21'));logger[_0xb7b8('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x233df2,_0xb7b8('0x21'),JSON[_0xb7b8('0x23')](_0x5b9064));if(_0x5b9064[_0xb7b8('0x24')]){if(_0x5b9064[_0xb7b8('0x24')]['code']===0x1f4){logger[_0xb7b8('0x24')](_0xb7b8('0x20'),_0x233df2,_0x5b9064[_0xb7b8('0x24')][_0xb7b8('0x25')]);return _0x45c985(_0x5b9064['error']['message']);}logger['error'](_0xb7b8('0x20'),_0x233df2,_0x5b9064['error'][_0xb7b8('0x25')]);return _0x3ff343(_0x5b9064['error'][_0xb7b8('0x25')]);}else{logger[_0xb7b8('0x1f')](_0xb7b8('0x20'),_0x233df2,'request\x20sent');_0x3ff343(_0x5b9064[_0xb7b8('0x26')]['message']);}})[_0xb7b8('0x27')](function(_0x3ff557){logger[_0xb7b8('0x24')](_0xb7b8('0x20'),_0x233df2,_0x3ff557);_0x45c985(_0x3ff557);});});}function respondWithStatusCode(_0x51907d,_0x59c8f6){_0x59c8f6=_0x59c8f6||0xcc;return function(_0x1c8f0a){if(_0x1c8f0a){return _0x51907d[_0xb7b8('0x28')](_0x59c8f6);}return _0x51907d[_0xb7b8('0x29')](_0x59c8f6)[_0xb7b8('0x2a')]();};}function respondWithResult(_0x36103c,_0x5bc6a0){_0x5bc6a0=_0x5bc6a0||0xc8;return function(_0x5b2ad5){if(_0x5b2ad5){return _0x36103c[_0xb7b8('0x29')](_0x5bc6a0)[_0xb7b8('0x2b')](_0x5b2ad5);}};}function respondWithFilteredResult(_0x4811bd,_0x1293ed){return function(_0x3975d7){if(_0x3975d7){var _0xc92436=typeof _0x1293ed[_0xb7b8('0x2c')]===_0xb7b8('0x2d')&&typeof _0x1293ed[_0xb7b8('0x2e')]===_0xb7b8('0x2d');var _0x567961=_0x3975d7[_0xb7b8('0x2f')];var _0x46caa6=_0xc92436?0x0:_0x1293ed[_0xb7b8('0x2c')];var _0x50d112=_0xc92436?_0x3975d7['count']:_0x1293ed['offset']+_0x1293ed[_0xb7b8('0x2e')];var _0x51a76d;if(_0x50d112>=_0x567961){_0x50d112=_0x567961;_0x51a76d=0xc8;}else{_0x51a76d=0xce;}_0x4811bd['status'](_0x51a76d);return _0x4811bd['set']('Content-Range',_0x46caa6+'-'+_0x50d112+'/'+_0x567961)['json'](_0x3975d7);}return null;};}function patchUpdates(_0x57905b){return function(_0x14a26f){try{jsonpatch['apply'](_0x14a26f,_0x57905b,!![]);}catch(_0xbf0760){return BPromise[_0xb7b8('0x30')](_0xbf0760);}return _0x14a26f[_0xb7b8('0x31')]();};}function saveUpdates(_0xc216e4,_0x3dc1c7){return function(_0x19e8d3){if(_0x19e8d3){return _0x19e8d3[_0xb7b8('0x32')](_0xc216e4)[_0xb7b8('0x1e')](function(_0x3bfe38){return _0x3bfe38;});}return null;};}function removeEntity(_0x3e1d2f,_0x3292f4){return function(_0x405343){if(_0x405343){return _0x405343[_0xb7b8('0x33')]()[_0xb7b8('0x1e')](function(){_0x3e1d2f[_0xb7b8('0x29')](0xcc)[_0xb7b8('0x2a')]();});}};}function handleEntityNotFound(_0x1ca1f7,_0x190825){return function(_0x3482c6){if(!_0x3482c6){_0x1ca1f7[_0xb7b8('0x28')](0x194);}return _0x3482c6;};}function handleError(_0x70fc0e,_0xe9d76b){_0xe9d76b=_0xe9d76b||0x1f4;return function(_0x26843c){logger[_0xb7b8('0x24')](_0x26843c['stack']);if(_0x26843c['name']){delete _0x26843c[_0xb7b8('0x34')];}_0x70fc0e[_0xb7b8('0x29')](_0xe9d76b)['send'](_0x26843c);};}exports[_0xb7b8('0x35')]=function(_0x17f4eb,_0x21cd2f){var _0x45dcb2={},_0x39e319={},_0x2a3399={'count':0x0,'rows':[]};var _0x3838d0=_[_0xb7b8('0x36')](db['OpenchannelMessage'][_0xb7b8('0x37')],function(_0x5a013d){return{'name':_0x5a013d['fieldName'],'type':_0x5a013d[_0xb7b8('0x38')][_0xb7b8('0x39')]};});_0x39e319['model']=_[_0xb7b8('0x36')](_0x3838d0,_0xb7b8('0x34'));_0x39e319['query']=_[_0xb7b8('0x3a')](_0x17f4eb[_0xb7b8('0x3b')]);_0x39e319['filters']=_[_0xb7b8('0x3c')](_0x39e319[_0xb7b8('0x3d')],_0x39e319[_0xb7b8('0x3b')]);_0x45dcb2[_0xb7b8('0x3e')]=_[_0xb7b8('0x3c')](_0x39e319[_0xb7b8('0x3d')],qs[_0xb7b8('0x3f')](_0x17f4eb[_0xb7b8('0x3b')][_0xb7b8('0x3f')]));_0x45dcb2[_0xb7b8('0x3e')]=_0x45dcb2[_0xb7b8('0x3e')][_0xb7b8('0x40')]?_0x45dcb2[_0xb7b8('0x3e')]:_0x39e319['model'];if(!_0x17f4eb[_0xb7b8('0x3b')][_0xb7b8('0x41')](_0xb7b8('0x42'))){_0x45dcb2[_0xb7b8('0x2e')]=qs['limit'](_0x17f4eb['query'][_0xb7b8('0x2e')]);_0x45dcb2[_0xb7b8('0x2c')]=qs['offset'](_0x17f4eb[_0xb7b8('0x3b')]['offset']);}_0x45dcb2[_0xb7b8('0x43')]=qs[_0xb7b8('0x44')](_0x17f4eb[_0xb7b8('0x3b')][_0xb7b8('0x44')]);_0x45dcb2[_0xb7b8('0x45')]=qs[_0xb7b8('0x46')](_[_0xb7b8('0x47')](_0x17f4eb[_0xb7b8('0x3b')],_0x39e319[_0xb7b8('0x46')]),_0x3838d0);if(_0x17f4eb[_0xb7b8('0x3b')][_0xb7b8('0x48')]){_0x45dcb2[_0xb7b8('0x45')]=_['merge'](_0x45dcb2[_0xb7b8('0x45')],{'$or':_[_0xb7b8('0x36')](_0x3838d0,function(_0x555d7d){if(_0x555d7d[_0xb7b8('0x38')]!==_0xb7b8('0x49')){var _0x1cfd2a={};_0x1cfd2a[_0x555d7d[_0xb7b8('0x34')]]={'$like':'%'+_0x17f4eb['query'][_0xb7b8('0x48')]+'%'};return _0x1cfd2a;}})});}_0x45dcb2=_['merge']({},_0x45dcb2,_0x17f4eb[_0xb7b8('0x4a')]);var _0x60c4f5={'where':_0x45dcb2[_0xb7b8('0x45')]};return db['OpenchannelMessage'][_0xb7b8('0x2f')](_0x60c4f5)[_0xb7b8('0x1e')](function(_0x504912){_0x2a3399['count']=_0x504912;if(_0x17f4eb['query'][_0xb7b8('0x4b')]){_0x45dcb2[_0xb7b8('0x4c')]=[{'all':!![]}];}return db[_0xb7b8('0x4d')]['findAll'](_0x45dcb2);})[_0xb7b8('0x1e')](function(_0x24fd4a){_0x2a3399[_0xb7b8('0x4e')]=_0x24fd4a;return _0x2a3399;})[_0xb7b8('0x1e')](respondWithFilteredResult(_0x21cd2f,_0x45dcb2))[_0xb7b8('0x27')](handleError(_0x21cd2f,null));};exports[_0xb7b8('0x4f')]=function(_0x1afde7,_0x4d0c62){var _0x38665f={'raw':!![],'where':{'id':_0x1afde7[_0xb7b8('0x50')]['id']}},_0x20cd89={};_0x20cd89[_0xb7b8('0x3d')]=_[_0xb7b8('0x3a')](db['OpenchannelMessage']['rawAttributes']);_0x20cd89[_0xb7b8('0x3b')]=_[_0xb7b8('0x3a')](_0x1afde7['query']);_0x20cd89[_0xb7b8('0x46')]=_[_0xb7b8('0x3c')](_0x20cd89[_0xb7b8('0x3d')],_0x20cd89[_0xb7b8('0x3b')]);_0x38665f[_0xb7b8('0x3e')]=_['intersection'](_0x20cd89[_0xb7b8('0x3d')],qs['fields'](_0x1afde7[_0xb7b8('0x3b')]['fields']));_0x38665f[_0xb7b8('0x3e')]=_0x38665f[_0xb7b8('0x3e')]['length']?_0x38665f['attributes']:_0x20cd89[_0xb7b8('0x3d')];if(_0x1afde7[_0xb7b8('0x3b')]['includeAll']){_0x38665f['include']=[{'all':!![]}];}_0x38665f=_[_0xb7b8('0x51')]({},_0x38665f,_0x1afde7['options']);return db[_0xb7b8('0x4d')][_0xb7b8('0x52')](_0x38665f)[_0xb7b8('0x1e')](handleEntityNotFound(_0x4d0c62,null))[_0xb7b8('0x1e')](respondWithResult(_0x4d0c62,null))[_0xb7b8('0x27')](handleError(_0x4d0c62,null));};exports[_0xb7b8('0x53')]=function(_0x43b02a,_0x31e4b7){return db[_0xb7b8('0x4d')][_0xb7b8('0x53')](_0x43b02a[_0xb7b8('0x54')],{})[_0xb7b8('0x1e')](respondWithResult(_0x31e4b7,0xc9))[_0xb7b8('0x27')](handleError(_0x31e4b7,null));};exports['update']=function(_0x117a5c,_0x2e1acf){if(_0x117a5c['body']['id']){delete _0x117a5c[_0xb7b8('0x54')]['id'];}return db[_0xb7b8('0x4d')][_0xb7b8('0x52')]({'where':{'id':_0x117a5c[_0xb7b8('0x50')]['id']}})[_0xb7b8('0x1e')](handleEntityNotFound(_0x2e1acf,null))[_0xb7b8('0x1e')](saveUpdates(_0x117a5c[_0xb7b8('0x54')],null))[_0xb7b8('0x1e')](respondWithResult(_0x2e1acf,null))[_0xb7b8('0x27')](handleError(_0x2e1acf,null));};exports[_0xb7b8('0x33')]=function(_0x1645b8,_0x232085){return db['OpenchannelMessage'][_0xb7b8('0x52')]({'where':{'id':_0x1645b8[_0xb7b8('0x50')]['id']}})[_0xb7b8('0x1e')](handleEntityNotFound(_0x232085,null))[_0xb7b8('0x1e')](removeEntity(_0x232085,null))[_0xb7b8('0x27')](handleError(_0x232085,null));};exports['describe']=function(_0x3a482c,_0x3dfdf7){return db[_0xb7b8('0x4d')][_0xb7b8('0x55')]()[_0xb7b8('0x1e')](respondWithResult(_0x3dfdf7,null))[_0xb7b8('0x27')](handleError(_0x3dfdf7,null));};var interaction_log=require(_0xb7b8('0x56'))(_0xb7b8('0x57'));exports[_0xb7b8('0x58')]=function(_0x4b6a57,_0x28f895,_0x21066a){var _0x414d39={'agent':{},'channel':_0xb7b8('0x59')};if(_0x4b6a57['body']['id']){delete _0x4b6a57[_0xb7b8('0x54')]['id'];}_0x4b6a57[_0xb7b8('0x54')][_0xb7b8('0x5a')]=!![];_0x4b6a57[_0xb7b8('0x54')][_0xb7b8('0x5b')]=moment()[_0xb7b8('0x5c')](_0xb7b8('0x5d'));_0x4b6a57[_0xb7b8('0x54')][_0xb7b8('0x5e')]=_0x4b6a57[_0xb7b8('0x54')][_0xb7b8('0x5e')]||_0x4b6a57[_0xb7b8('0x5f')]['id'];_0x414d39['agent']['id']=_0x4b6a57[_0xb7b8('0x54')][_0xb7b8('0x5e')];return db[_0xb7b8('0x4d')][_0xb7b8('0x52')]({'where':{'id':_0x4b6a57[_0xb7b8('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28f895,null))[_0xb7b8('0x1e')](saveUpdates(_0x4b6a57['body'],null))[_0xb7b8('0x1e')](function(_0x2c493a){if(_0x2c493a){_0x414d39['message']=_0x2c493a[_0xb7b8('0x60')]({'plain':!![]});return db[_0xb7b8('0x61')]['find']({'where':{'id':_0x2c493a['OpenchannelInteractionId']}});}return null;})[_0xb7b8('0x1e')](handleEntityNotFound(_0x28f895,null))[_0xb7b8('0x1e')](function(_0x4af5d9){if(_0x4af5d9){return _0x4af5d9[_0xb7b8('0x32')]({'UserId':_0x4b6a57[_0xb7b8('0x54')][_0xb7b8('0x5e')],'read1stAt':_[_0xb7b8('0x62')](_0x4af5d9[_0xb7b8('0x63')])?moment()['format'](_0xb7b8('0x5d')):undefined});}return null;})['then'](function(_0x22e5da){if(_0x22e5da){_0x414d39[_0xb7b8('0x64')]=_0x22e5da['get']({'plain':!![]});interaction_log[_0xb7b8('0x1f')](_0xb7b8('0x65'),_0x4b6a57[_0xb7b8('0x5f')]['id'],_0x4b6a57[_0xb7b8('0x5f')][_0xb7b8('0x34')],_0x4b6a57[_0xb7b8('0x5f')]['role'],_0x414d39['interaction']['id'],_0x4b6a57[_0xb7b8('0x54')]?JSON[_0xb7b8('0x23')](_0x4b6a57[_0xb7b8('0x54')]):_0xb7b8('0x66'));return respondWithRpcPromise(_0xb7b8('0x67'),_0xb7b8('0x68'),_0x414d39);}return null;})[_0xb7b8('0x1e')](function(_0x5ed87c){var _0xbf61f=_0xb7b8('0x69')+_0x5ed87c[_0xb7b8('0x25')][_0xb7b8('0x6a')];return db[_0xb7b8('0x6b')][_0xb7b8('0x3b')](_0xbf61f,{'type':db[_0xb7b8('0x6c')][_0xb7b8('0x6d')][_0xb7b8('0x6e')],'raw':!![]})['then'](function(_0x1f4d2e){return _0x1f4d2e;});})['then'](function(_0x3b0915){if(_0x3b0915){_0x414d39['message'][_0xb7b8('0x6f')]=_0x3b0915[0x0];if(!_0x4b6a57[_0xb7b8('0x54')][_0xb7b8('0x5e')])return;return db[_0xb7b8('0x70')][_0xb7b8('0x52')]({'where':{'id':_0x4b6a57[_0xb7b8('0x54')]['UserId'],'role':_0xb7b8('0x71')},'attributes':['id',_0xb7b8('0x34'),_0xb7b8('0x72'),'email',_0xb7b8('0x73')],'raw':!![]});}return null;})[_0xb7b8('0x1e')](function(_0x175ec3){if(!_0x175ec3)return null;_0x414d39['message']['agent']=_0x175ec3;return _0x414d39;})['then'](function(_0x35267a){if(_0x35267a){if(_0x4b6a57[_0xb7b8('0x54')]['manual']){_0x414d39[_0xb7b8('0x25')][_0xb7b8('0x74')]=util['format']('SIP/%s',_0x4b6a57['user'][_0xb7b8('0x34')]);_0x414d39[_0xb7b8('0x25')][_0xb7b8('0x75')]=_0x414d39[_0xb7b8('0x75')];_0x414d39[_0xb7b8('0x25')][_0xb7b8('0x76')]=_0xb7b8('0x58');return respondWithRpcPromise('EventManager',_0xb7b8('0x77'),{'event':'acceptmessage','message':_0x414d39[_0xb7b8('0x25')]},client9002)[_0xb7b8('0x1e')](function(){return _0x414d39;});}return _0x414d39;}return null;})[_0xb7b8('0x1e')](respondWithResult(_0x28f895,null))[_0xb7b8('0x27')](handleError(_0x28f895,null));};var interaction_log=require(_0xb7b8('0x56'))(_0xb7b8('0x57'));exports[_0xb7b8('0x30')]=function(_0x210547,_0x192990,_0x233afc){var _0x133fa6={'agent':{},'channel':_0xb7b8('0x59')};if(_0x210547[_0xb7b8('0x54')]['id']){delete _0x210547[_0xb7b8('0x54')]['id'];}_0x210547[_0xb7b8('0x54')][_0xb7b8('0x5e')]=_0x210547[_0xb7b8('0x54')][_0xb7b8('0x5e')]||_0x210547[_0xb7b8('0x5f')]['id'];_0x133fa6[_0xb7b8('0x71')]['id']=_0x210547[_0xb7b8('0x54')][_0xb7b8('0x5e')];return db[_0xb7b8('0x4d')][_0xb7b8('0x52')]({'where':{'id':_0x210547['params']['id'],'UserId':null}})[_0xb7b8('0x1e')](handleEntityNotFound(_0x192990,null))[_0xb7b8('0x1e')](function(_0x102f60){if(_0x102f60){_0x133fa6[_0xb7b8('0x25')]=_0x102f60[_0xb7b8('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0xb7b8('0x52')]({'where':{'id':_0x102f60[_0xb7b8('0x78')]}});}return null;})['then'](handleEntityNotFound(_0x192990,null))[_0xb7b8('0x1e')](function(_0x5c4be0){if(_0x5c4be0){_0x133fa6[_0xb7b8('0x64')]=_0x5c4be0[_0xb7b8('0x60')]({'plain':!![]});interaction_log[_0xb7b8('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x210547[_0xb7b8('0x5f')]['id'],_0x210547[_0xb7b8('0x5f')][_0xb7b8('0x34')],_0x210547['user'][_0xb7b8('0x79')],_0x133fa6[_0xb7b8('0x64')]['id'],_0x210547[_0xb7b8('0x54')]?JSON[_0xb7b8('0x23')](_0x210547[_0xb7b8('0x54')]):'null');return respondWithRpcPromise(_0xb7b8('0x7a'),_0xb7b8('0x7b'),_0x133fa6);}return null;})['then'](function(_0x2a64f4){var _0x4c4b6f=_0xb7b8('0x69')+_0x2a64f4['message'][_0xb7b8('0x6a')];return db[_0xb7b8('0x6b')][_0xb7b8('0x3b')](_0x4c4b6f,{'type':db[_0xb7b8('0x6c')][_0xb7b8('0x6d')][_0xb7b8('0x6e')],'raw':!![]})['then'](function(_0x32fbdd){return _0x32fbdd;});})[_0xb7b8('0x1e')](function(_0x8aa797){if(_0x8aa797){_0x133fa6['message'][_0xb7b8('0x6f')]=_0x8aa797[0x0];if(!_0x210547[_0xb7b8('0x54')][_0xb7b8('0x5e')])return;return db[_0xb7b8('0x70')][_0xb7b8('0x52')]({'where':{'id':_0x210547[_0xb7b8('0x54')][_0xb7b8('0x5e')],'role':_0xb7b8('0x71')},'attributes':['id',_0xb7b8('0x34'),_0xb7b8('0x72'),'email',_0xb7b8('0x73')],'raw':!![]});}return null;})[_0xb7b8('0x1e')](function(_0x58c2c9){if(!_0x58c2c9)return null;_0x133fa6[_0xb7b8('0x25')]['agent']=_0x58c2c9;return _0x133fa6;})[_0xb7b8('0x1e')](function(_0x189bf3){if(_0x189bf3){_0x189bf3[_0xb7b8('0x25')][_0xb7b8('0x74')]=util[_0xb7b8('0x5c')](_0xb7b8('0x7c'),_0x210547[_0xb7b8('0x5f')]['name']);_0x189bf3[_0xb7b8('0x25')][_0xb7b8('0x75')]=_0x133fa6[_0xb7b8('0x75')];_0x189bf3['message'][_0xb7b8('0x76')]=_0xb7b8('0x30');respondWithRpcPromise('EventManager',_0xb7b8('0x77'),{'event':_0xb7b8('0x7d'),'message':_0x189bf3[_0xb7b8('0x25')]},client9002);return _0x133fa6;}return null;})[_0xb7b8('0x1e')](respondWithResult(_0x192990,null))[_0xb7b8('0x27')](handleError(_0x192990,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e3403c1..ff80cf3 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 _0xe7d8=['hasOwnProperty','events','../../mysqldb','OpenchannelMessage','save','remove','emit'];(function(_0x2a0bb0,_0x1fa696){var _0x5552c9=function(_0x1bc803){while(--_0x1bc803){_0x2a0bb0['push'](_0x2a0bb0['shift']());}};_0x5552c9(++_0x1fa696);}(_0xe7d8,0xbe));var _0x8e7d=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0xe7d8[_0x45f111];return _0x483508;};'use strict';var EventEmitter=require(_0x8e7d('0x0'));var OpenchannelMessage=require(_0x8e7d('0x1'))['db'][_0x8e7d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8e7d('0x3'),'afterUpdate':'update','afterDestroy':_0x8e7d('0x4')};function emitEvent(_0xcb18b5){return function(_0x4afd3f,_0x3b6cf1,_0xff740e){OpenchannelMessageEvents[_0x8e7d('0x5')](_0xcb18b5+':'+_0x4afd3f['id'],_0x4afd3f);OpenchannelMessageEvents[_0x8e7d('0x5')](_0xcb18b5,_0x4afd3f);_0xff740e(null);};}for(var e in events){if(events[_0x8e7d('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x882a=['OpenchannelMessage','setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x25f786,_0x39a7cb){var _0x57993c=function(_0x44f98b){while(--_0x44f98b){_0x25f786['push'](_0x25f786['shift']());}};_0x57993c(++_0x39a7cb);}(_0x882a,0x154));var _0xa882=function(_0x200084,_0x5d8906){_0x200084=_0x200084-0x0;var _0x4bf7e4=_0x882a[_0x200084];return _0x4bf7e4;};'use strict';var EventEmitter=require(_0xa882('0x0'));var OpenchannelMessage=require(_0xa882('0x1'))['db'][_0xa882('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa882('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa882('0x4'),'afterDestroy':_0xa882('0x5')};function emitEvent(_0x105237){return function(_0x16c27d,_0x3536d5,_0x701c9c){OpenchannelMessageEvents[_0xa882('0x6')](_0x105237+':'+_0x16c27d['id'],_0x16c27d);OpenchannelMessageEvents[_0xa882('0x6')](_0x105237,_0x16c27d);_0x701c9c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xa882('0x7')](e,emitEvent(event));}}module[_0xa882('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 72fcf7e..431a38b 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 _0x1775=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','omit','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x5d737f,_0xa7269){var _0x1ffe01=function(_0x3c143b){while(--_0x3c143b){_0x5d737f['push'](_0x5d737f['shift']());}};_0x1ffe01(++_0xa7269);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var logger=require(_0x5177('0x1'))(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var BPromise=require(_0x5177('0x4'));var rp=require(_0x5177('0x5'));var fs=require('fs');var path=require(_0x5177('0x6'));var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require(_0x5177('0x9'));module[_0x5177('0xa')]=function(_0x2c5c42,_0x153c1a){return _0x2c5c42[_0x5177('0xb')](_0x5177('0xc'),attributes,{'tableName':_0x5177('0xd'),'paranoid':![],'indexes':[{'name':_0x5177('0xe'),'fields':[_0x5177('0xf')],'type':_0x5177('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e5a3b,_0x2c23d8,_0x206035){var _0x5bdca9=_0x2c5c42['models'];var _0x13c7f6=_0x2e5a3b[_0x5177('0x11')]({'plain':!![]});if(_0x13c7f6[_0x5177('0x12')][_0x5177('0x13')]()==='in'||_0x13c7f6[_0x5177('0x12')]['toLowerCase']()===_0x5177('0x14')&&!_0x13c7f6[_0x5177('0x15')]&&!_[_0x5177('0x16')](_0x13c7f6[_0x5177('0x17')])){_0x5bdca9[_0x5177('0x18')][_0x5177('0x19')]({'where':{'id':_0x13c7f6[_0x5177('0x1a')]}})[_0x5177('0x1b')](function(_0x3e6224){if(_0x3e6224){_0x3e6224[_0x5177('0x1c')]({'lastMsgAt':_0x13c7f6[_0x5177('0x1d')],'lastMsgDirection':_0x13c7f6[_0x5177('0x12')][_0x5177('0x13')]()});}})[_0x5177('0x1e')](function(_0x1b32e6){console[_0x5177('0x1f')](_0x1b32e6);});}if(_0x13c7f6[_0x5177('0x12')]===_0x5177('0x14')&&!_0x13c7f6[_0x5177('0x15')]){var _0x50ce2c;_0x5bdca9[_0x5177('0x20')][_0x5177('0x21')]()[_0x5177('0x1b')](function(_0x1b4102){return _0x5bdca9['OpenchannelAccount'][_0x5177('0x22')]({'where':{'id':_0x13c7f6[_0x5177('0x23')]},'include':[{'model':_0x5bdca9[_0x5177('0x18')],'as':'Interactions','where':{'id':_0x13c7f6[_0x5177('0x1a')]},'limit':0x1,'include':[{'model':_0x5bdca9['CmContact'],'as':_0x5177('0x24'),'attributes':_[_0x5177('0x25')](_0x1b4102)}]}]});})[_0x5177('0x1b')](function(_0x27b732){_0x50ce2c=_0x27b732[_0x5177('0x11')]({'plain':!![]});if(_0x50ce2c&&_0x50ce2c[_0x5177('0x26')]){logger[_0x5177('0x27')](_0x5177('0x28'),_0x5177('0x29'),util[_0x5177('0x2a')](_0x5177('0x2b'),_0x13c7f6['id'],_0x50ce2c[_0x5177('0x26')]));if(_0x50ce2c['Interactions']&&_0x50ce2c[_0x5177('0x2c')]['length']){_0x13c7f6[_0x5177('0x2d')]=_[_0x5177('0x2e')](_0x50ce2c[_0x5177('0x2c')][0x0],_0x5177('0x24'));_0x13c7f6['Contact']=_0x50ce2c[_0x5177('0x2c')][0x0]['Contact'];}var _0x2c23d8={'method':_0x5177('0x2f'),'uri':encodeURI(_0x50ce2c[_0x5177('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2c23d8['method']){case _0x5177('0x30'):_0x2c23d8['qs']=_0x13c7f6;break;case'POST':_0x2c23d8[_0x5177('0xf')]=_0x13c7f6;break;}return rp(_0x2c23d8)[_0x5177('0x1b')](function(_0x58846c){logger[_0x5177('0x27')](_0x5177('0x28'),_0x5177('0x29'),util[_0x5177('0x2a')](_0x5177('0x31'),_0x13c7f6['id'],_0x50ce2c[_0x5177('0x26')]));if(_0x58846c['body']['threadId']&&_0x58846c[_0x5177('0xf')][_0x5177('0x32')]!=_0x13c7f6[_0x5177('0x2d')][_0x5177('0x32')]){return _0x5bdca9[_0x5177('0x18')][_0x5177('0x1c')]({'threadId':_0x58846c[_0x5177('0xf')][_0x5177('0x32')]},{'logging':!![],'where':{'id':_0x13c7f6['Interaction']['id']}});}else{return;}})[_0x5177('0x1b')](function(){return _0x2e5a3b[_0x5177('0x1c')]({'read':!![]});})['catch'](function(_0x32bea9){logger['error'](_0x5177('0x28'),_0x5177('0x29'),util[_0x5177('0x33')](_0x32bea9,{'showHidden':![],'depth':null}));_0x206035();});}else{_0x206035();}})['finally'](function(){_0x206035();});}else{_0x206035();}}},'charset':'utf8mb4','collate':_0x5177('0x34')});}; \ No newline at end of file +var _0x1a85=['openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','OpenchannelMessage'];(function(_0x3b99ab,_0x506a6b){var _0x39f4d5=function(_0xd27f0d){while(--_0xd27f0d){_0x3b99ab['push'](_0x3b99ab['shift']());}};_0x39f4d5(++_0x506a6b);}(_0x1a85,0x178));var _0x51a8=function(_0x79324e,_0x4af67e){_0x79324e=_0x79324e-0x0;var _0x555666=_0x1a85[_0x79324e];return _0x555666;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x51a8('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e1b4,_0x39e06a,_0x2f276b){var _0x1a476d=_0x4b76a8[_0x51a8('0xa')];var _0x418f06=_0x56e1b4[_0x51a8('0xb')]({'plain':!![]});if(_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()==='in'||_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]&&!_[_0x51a8('0x10')](_0x418f06[_0x51a8('0x11')])){_0x1a476d[_0x51a8('0x12')][_0x51a8('0x13')]({'where':{'id':_0x418f06[_0x51a8('0x14')]}})['then'](function(_0x461f5c){if(_0x461f5c){_0x461f5c[_0x51a8('0x15')]({'lastMsgAt':_0x418f06[_0x51a8('0x16')],'lastMsgDirection':_0x418f06['direction'][_0x51a8('0xd')]()});}})['catch'](function(_0x10584b){console[_0x51a8('0x17')](_0x10584b);});}if(_0x418f06[_0x51a8('0xc')]===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]){var _0x3e0603;_0x1a476d[_0x51a8('0x18')]['describe']()[_0x51a8('0x19')](function(_0x45a433){return _0x1a476d[_0x51a8('0x1a')][_0x51a8('0x1b')]({'where':{'id':_0x418f06[_0x51a8('0x1c')]},'include':[{'model':_0x1a476d[_0x51a8('0x12')],'as':'Interactions','where':{'id':_0x418f06[_0x51a8('0x14')]},'limit':0x1,'include':[{'model':_0x1a476d[_0x51a8('0x18')],'as':_0x51a8('0x1d'),'attributes':_[_0x51a8('0x1e')](_0x45a433)}]}]});})[_0x51a8('0x19')](function(_0x3bc044){_0x3e0603=_0x3bc044[_0x51a8('0xb')]({'plain':!![]});if(_0x3e0603&&_0x3e0603[_0x51a8('0x1f')]){logger['info'](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x21')](_0x51a8('0x22'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0x3e0603[_0x51a8('0x23')]&&_0x3e0603['Interactions'][_0x51a8('0x24')]){_0x418f06['Interaction']=_['omit'](_0x3e0603[_0x51a8('0x23')][0x0],'Contact');_0x418f06[_0x51a8('0x1d')]=_0x3e0603[_0x51a8('0x23')][0x0][_0x51a8('0x1d')];}var _0x39e06a={'method':_0x51a8('0x25'),'uri':encodeURI(_0x3e0603[_0x51a8('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39e06a[_0x51a8('0x26')]){case _0x51a8('0x27'):_0x39e06a['qs']=_0x418f06;break;case'POST':_0x39e06a[_0x51a8('0x9')]=_0x418f06;break;}return rp(_0x39e06a)[_0x51a8('0x19')](function(_0xca5746){logger[_0x51a8('0x28')](_0x51a8('0x20'),_0x51a8('0x29'),util[_0x51a8('0x21')](_0x51a8('0x2a'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]&&_0xca5746[_0x51a8('0x9')]['threadId']!=_0x418f06[_0x51a8('0x2c')]['threadId']){return _0x1a476d[_0x51a8('0x12')][_0x51a8('0x15')]({'threadId':_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]},{'logging':!![],'where':{'id':_0x418f06[_0x51a8('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x56e1b4[_0x51a8('0x15')]({'read':!![]});})['catch'](function(_0x41c4de){logger[_0x51a8('0x17')](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x2d')](_0x41c4de,{'showHidden':![],'depth':null}));_0x2f276b();});}else{_0x2f276b();}})['finally'](function(){_0x2f276b();});}else{_0x2f276b();}}},'charset':_0x51a8('0x2e'),'collate':_0x51a8('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 576b3c7..d5382af 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(_0xce66bf,_0x3b37a2){var _0xb93d70=function(_0x3f2ded){while(--_0x3f2ded){_0xce66bf['push'](_0xce66bf['shift']());}};_0xb93d70(++_0x3b37a2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x545ed6,_0x7ddca6){_0x545ed6=_0x545ed6-0x0;var _0x51704b=_0x5f2f[_0x545ed6];return _0x51704b;};'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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x270836,_0x350925){var _0x40d416=function(_0x1b796b){while(--_0x1b796b){_0x270836['push'](_0x270836['shift']());}};_0x40d416(++_0x350925);}(_0x2ef3,0xba));var _0x32ef=function(_0x6b7ce0,_0x1c6bde){_0x6b7ce0=_0x6b7ce0-0x0;var _0x319e9e=_0x2ef3[_0x6b7ce0];return _0x319e9e;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 2c61782..c6759f7 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 _0xab13=['openchannelMessage:','./openchannelMessage.events','remove','removeListener','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab13,0x8b));var _0x3ab1=function(_0x1465dc,_0x4d684d){_0x1465dc=_0x1465dc-0x0;var _0x226206=_0xab13[_0x1465dc];return _0x226206;};'use strict';var OpenchannelMessageEvents=require(_0x3ab1('0x0'));var events=['save',_0x3ab1('0x1'),'update'];function createListener(_0x2c4021,_0x84b028){return function(_0x299319){_0x84b028['emit'](_0x2c4021,_0x299319);};}function removeListener(_0x49ff19,_0x87151e){return function(){OpenchannelMessageEvents[_0x3ab1('0x2')](_0x49ff19,_0x87151e);};}exports[_0x3ab1('0x3')]=function(_0x31ea13){for(var _0x3236f3=0x0,_0x4428fc=events[_0x3ab1('0x4')];_0x3236f3<_0x4428fc;_0x3236f3++){var _0x46fc8f=events[_0x3236f3];var _0x5f572e=createListener(_0x3ab1('0x5')+_0x46fc8f,_0x31ea13);OpenchannelMessageEvents['on'](_0x46fc8f,_0x5f572e);}}; \ No newline at end of file +var _0xdced=['save','remove','update','removeListener','register','length','openchannelMessage:'];(function(_0x3a58dc,_0x3a61d7){var _0x152559=function(_0xcf3cb6){while(--_0xcf3cb6){_0x3a58dc['push'](_0x3a58dc['shift']());}};_0x152559(++_0x3a61d7);}(_0xdced,0xcb));var _0xddce=function(_0x339974,_0x318f2f){_0x339974=_0x339974-0x0;var _0x56dc65=_0xdced[_0x339974];return _0x56dc65;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xddce('0x0'),_0xddce('0x1'),_0xddce('0x2')];function createListener(_0x3d775a,_0x7e2315){return function(_0x1a747d){_0x7e2315['emit'](_0x3d775a,_0x1a747d);};}function removeListener(_0x1c3f2a,_0x509b66){return function(){OpenchannelMessageEvents[_0xddce('0x3')](_0x1c3f2a,_0x509b66);};}exports[_0xddce('0x4')]=function(_0x541f99){for(var _0x31c76b=0x0,_0x57e11c=events[_0xddce('0x5')];_0x31c76b<_0x57e11c;_0x31c76b++){var _0x46b464=events[_0x31c76b];var _0x272a2c=createListener(_0xddce('0x6')+_0x46b464,_0x541f99);OpenchannelMessageEvents['on'](_0x46b464,_0x272a2c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f7e7502..5e1ee74 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 _0x9434=['removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','/:id/users','addAgents','/:id','delete'];(function(_0x5058f1,_0x12fd68){var _0x32c2f3=function(_0x1d097a){while(--_0x1d097a){_0x5058f1['push'](_0x5058f1['shift']());}};_0x32c2f3(++_0x12fd68);}(_0x9434,0x193));var _0x4943=function(_0x1b1b7b,_0xf3cb03){_0x1b1b7b=_0x1b1b7b-0x0;var _0x4d3852=_0x9434[_0x1b1b7b];return _0x4d3852;};'use strict';var multer=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var path=require('path');var timeout=require(_0x4943('0x2'));var express=require(_0x4943('0x3'));var router=express['Router']();var fs_extra=require(_0x4943('0x4'));var auth=require(_0x4943('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4943('0x6'));var controller=require(_0x4943('0x7'));router['get']('/',auth[_0x4943('0x8')](),controller[_0x4943('0x9')]);router[_0x4943('0xa')]('/describe',auth[_0x4943('0x8')](),controller['describe']);router[_0x4943('0xa')]('/:id',auth[_0x4943('0x8')](),controller[_0x4943('0xb')]);router[_0x4943('0xa')](_0x4943('0xc'),auth[_0x4943('0x8')](),controller[_0x4943('0xd')]);router[_0x4943('0xa')](_0x4943('0xe'),auth[_0x4943('0x8')](),controller[_0x4943('0xf')]);router[_0x4943('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x4943('0x10')]('/',auth['isAuthenticated'](),controller[_0x4943('0x11')]);router[_0x4943('0x10')](_0x4943('0xe'),auth[_0x4943('0x8')](),controller['addTeams']);router[_0x4943('0x10')](_0x4943('0x12'),auth[_0x4943('0x8')](),controller[_0x4943('0x13')]);router['put'](_0x4943('0x14'),auth[_0x4943('0x8')](),controller['update']);router[_0x4943('0x15')]('/:id',auth[_0x4943('0x8')](),controller['destroy']);router[_0x4943('0x15')](_0x4943('0xe'),auth[_0x4943('0x8')](),controller[_0x4943('0x16')]);router[_0x4943('0x15')](_0x4943('0x12'),auth[_0x4943('0x8')](),controller[_0x4943('0x17')]);module[_0x4943('0x18')]=router; \ No newline at end of file +var _0x7d4f=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x14fec8,_0x3865f9){var _0x383726=function(_0x31f512){while(--_0x31f512){_0x14fec8['push'](_0x14fec8['shift']());}};_0x383726(++_0x3865f9);}(_0x7d4f,0x73));var _0xf7d4=function(_0x2c921c,_0x3c6a85){_0x2c921c=_0x2c921c-0x0;var _0x440bf2=_0x7d4f[_0x2c921c];return _0x440bf2;};'use strict';var multer=require(_0xf7d4('0x0'));var util=require(_0xf7d4('0x1'));var path=require(_0xf7d4('0x2'));var timeout=require(_0xf7d4('0x3'));var express=require(_0xf7d4('0x4'));var router=express[_0xf7d4('0x5')]();var fs_extra=require(_0xf7d4('0x6'));var auth=require(_0xf7d4('0x7'));var interaction=require(_0xf7d4('0x8'));var config=require('../../config/environment');var controller=require(_0xf7d4('0x9'));router[_0xf7d4('0xa')]('/',auth[_0xf7d4('0xb')](),controller['index']);router[_0xf7d4('0xa')]('/describe',auth[_0xf7d4('0xb')](),controller[_0xf7d4('0xc')]);router[_0xf7d4('0xa')](_0xf7d4('0xd'),auth[_0xf7d4('0xb')](),controller[_0xf7d4('0xe')]);router[_0xf7d4('0xa')](_0xf7d4('0xf'),auth[_0xf7d4('0xb')](),controller['getMembers']);router[_0xf7d4('0xa')](_0xf7d4('0x10'),auth[_0xf7d4('0xb')](),controller[_0xf7d4('0x11')]);router[_0xf7d4('0xa')](_0xf7d4('0x12'),auth[_0xf7d4('0xb')](),controller['getAgents']);router[_0xf7d4('0x13')]('/',auth[_0xf7d4('0xb')](),controller[_0xf7d4('0x14')]);router[_0xf7d4('0x13')]('/:id/teams',auth[_0xf7d4('0xb')](),controller[_0xf7d4('0x15')]);router[_0xf7d4('0x13')](_0xf7d4('0x12'),auth[_0xf7d4('0xb')](),controller['addAgents']);router[_0xf7d4('0x16')](_0xf7d4('0xd'),auth[_0xf7d4('0xb')](),controller[_0xf7d4('0x17')]);router[_0xf7d4('0x18')]('/:id',auth[_0xf7d4('0xb')](),controller[_0xf7d4('0x19')]);router['delete']('/:id/teams',auth[_0xf7d4('0xb')](),controller[_0xf7d4('0x1a')]);router[_0xf7d4('0x18')]('/:id/users',auth[_0xf7d4('0xb')](),controller[_0xf7d4('0x1b')]);module[_0xf7d4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 890e6ed..a0c9df2 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 _0x0681=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x550124,_0x3fc10a){var _0xcf0613=function(_0x489045){while(--_0x489045){_0x550124['push'](_0x550124['shift']());}};_0xcf0613(++_0x3fc10a);}(_0x0681,0x17e));var _0x1068=function(_0x3862cd,_0x299e88){_0x3862cd=_0x3862cd-0x0;var _0x2864a1=_0x0681[_0x3862cd];return _0x2864a1;};'use strict';var Sequelize=require(_0x1068('0x0'));module[_0x1068('0x1')]={'name':{'type':Sequelize[_0x1068('0x2')],'unique':_0x1068('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1068('0x2')]},'timeout':{'type':Sequelize[_0x1068('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1068('0x5')](_0x1068('0x6'),_0x1068('0x7'),_0x1068('0x8'))}}; \ No newline at end of file +var _0x081b=['INTEGER','sequelize','exports','name','STRING'];(function(_0x55503b,_0x489192){var _0x4783c2=function(_0x18f1c8){while(--_0x18f1c8){_0x55503b['push'](_0x55503b['shift']());}};_0x4783c2(++_0x489192);}(_0x081b,0x1f0));var _0xb081=function(_0x596cfd,_0x129074){_0x596cfd=_0x596cfd-0x0;var _0x2bed9d=_0x081b[_0x596cfd];return _0x2bed9d;};'use strict';var Sequelize=require(_0xb081('0x0'));module[_0xb081('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb081('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb081('0x3')]},'timeout':{'type':Sequelize[_0xb081('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 260fedb..2225802 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 _0x4ad9=['findOne','UserOpenchannelQueue','hasOwnProperty','filter','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','rows','%s/%s','SIP','updatedAt','getTeams','Team','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','userOpenchannelQueue:save','removeTeams','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','every','includes','union','compact','value','isEmpty','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','catch','params','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers'];(function(_0x261969,_0x1cb619){var _0x22feaa=function(_0x4f1243){while(--_0x4f1243){_0x261969['push'](_0x261969['shift']());}};_0x22feaa(++_0x1cb619);}(_0x4ad9,0xbe));var _0x94ad=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4ad9[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94ad('0x1'));var rp=require(_0x94ad('0x2'));var moment=require(_0x94ad('0x3'));var BPromise=require(_0x94ad('0x4'));var Mustache=require(_0x94ad('0x5'));var util=require(_0x94ad('0x6'));var path=require(_0x94ad('0x7'));var sox=require(_0x94ad('0x8'));var csv=require(_0x94ad('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94ad('0xa'));var _=require(_0x94ad('0xb'));var squel=require(_0x94ad('0xc'));var crypto=require(_0x94ad('0xd'));var jsforce=require(_0x94ad('0xe'));var deskjs=require(_0x94ad('0xf'));var toCsv=require(_0x94ad('0x9'));var querystring=require(_0x94ad('0x10'));var Papa=require(_0x94ad('0x11'));var Redis=require(_0x94ad('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94ad('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x94ad('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x94ad('0x15'))['db'];config['redis']=_['defaults'](config[_0x94ad('0x16')],{'host':_0x94ad('0x17'),'port':0x18eb});var socket=require(_0x94ad('0x18'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x55ac6b,_0x53eeb4){_0x53eeb4=_0x53eeb4||0xcc;return function(_0x5d447b){if(_0x5d447b){return _0x55ac6b[_0x94ad('0x19')](_0x53eeb4);}return _0x55ac6b['status'](_0x53eeb4)[_0x94ad('0x1a')]();};}function respondWithResult(_0x3c3940,_0x2f5fd3){_0x2f5fd3=_0x2f5fd3||0xc8;return function(_0x4fa504){if(_0x4fa504){return _0x3c3940[_0x94ad('0x1b')](_0x2f5fd3)[_0x94ad('0x1c')](_0x4fa504);}};}function respondWithFilteredResult(_0x57b0f4,_0x20befd){return function(_0xee2c0c){if(_0xee2c0c){var _0x24927a=typeof _0x20befd[_0x94ad('0x1d')]===_0x94ad('0x1e')&&typeof _0x20befd[_0x94ad('0x1f')]==='undefined';var _0x7aea2e=_0xee2c0c['count'];var _0xf1b1a0=_0x24927a?0x0:_0x20befd[_0x94ad('0x1d')];var _0x1acc72=_0x24927a?_0xee2c0c[_0x94ad('0x20')]:_0x20befd['offset']+_0x20befd['limit'];var _0x325fd9;if(_0x1acc72>=_0x7aea2e){_0x1acc72=_0x7aea2e;_0x325fd9=0xc8;}else{_0x325fd9=0xce;}_0x57b0f4[_0x94ad('0x1b')](_0x325fd9);return _0x57b0f4[_0x94ad('0x21')](_0x94ad('0x22'),_0xf1b1a0+'-'+_0x1acc72+'/'+_0x7aea2e)['json'](_0xee2c0c);}return null;};}function patchUpdates(_0x424237){return function(_0x148cd4){try{jsonpatch[_0x94ad('0x23')](_0x148cd4,_0x424237,!![]);}catch(_0x31d47a){return BPromise['reject'](_0x31d47a);}return _0x148cd4[_0x94ad('0x24')]();};}function saveUpdates(_0x253aa9,_0x244e0f){return function(_0x1983db){if(_0x1983db){return _0x1983db[_0x94ad('0x25')](_0x253aa9)[_0x94ad('0x26')](function(_0x1c05c3){return _0x1c05c3;});}return null;};}function removeEntity(_0x35e10b,_0x57e6e8){return function(_0x29447c){if(_0x29447c){return _0x29447c['destroy']()['then'](function(){var _0x2a3659=_0x29447c[_0x94ad('0x27')]({'plain':!![]});var _0x3186e2=_0x94ad('0x28');return db[_0x94ad('0x29')][_0x94ad('0x2a')]({'where':{'type':_0x3186e2,'resourceId':_0x2a3659['id']}})['then'](function(){return _0x29447c;});})[_0x94ad('0x26')](function(){_0x35e10b[_0x94ad('0x1b')](0xcc)[_0x94ad('0x1a')]();});}};}function handleEntityNotFound(_0x56d4da,_0x36ef82){return function(_0x543e99){if(!_0x543e99){_0x56d4da[_0x94ad('0x19')](0x194);}return _0x543e99;};}function handleError(_0x45c9d9,_0x49c856){_0x49c856=_0x49c856||0x1f4;return function(_0x1abecc){logger[_0x94ad('0x2b')](_0x1abecc['stack']);if(_0x1abecc[_0x94ad('0x2c')]){delete _0x1abecc[_0x94ad('0x2c')];}_0x45c9d9[_0x94ad('0x1b')](_0x49c856)[_0x94ad('0x2d')](_0x1abecc);};}exports[_0x94ad('0x2e')]=function(_0x38a56f,_0x445bfd){var _0x3beb5d={},_0x2c12bc={},_0x433036={'count':0x0,'rows':[]};var _0x115b5e=_['map'](db[_0x94ad('0x2f')][_0x94ad('0x30')],function(_0x81d57d){return{'name':_0x81d57d[_0x94ad('0x31')],'type':_0x81d57d[_0x94ad('0x32')]['key']};});_0x2c12bc[_0x94ad('0x33')]=_[_0x94ad('0x34')](_0x115b5e,_0x94ad('0x2c'));_0x2c12bc[_0x94ad('0x35')]=_[_0x94ad('0x36')](_0x38a56f[_0x94ad('0x35')]);_0x2c12bc[_0x94ad('0x37')]=_[_0x94ad('0x38')](_0x2c12bc[_0x94ad('0x33')],_0x2c12bc[_0x94ad('0x35')]);_0x3beb5d['attributes']=_[_0x94ad('0x38')](_0x2c12bc[_0x94ad('0x33')],qs['fields'](_0x38a56f[_0x94ad('0x35')][_0x94ad('0x39')]));_0x3beb5d[_0x94ad('0x3a')]=_0x3beb5d[_0x94ad('0x3a')][_0x94ad('0x3b')]?_0x3beb5d[_0x94ad('0x3a')]:_0x2c12bc[_0x94ad('0x33')];if(!_0x38a56f[_0x94ad('0x35')]['hasOwnProperty'](_0x94ad('0x3c'))){_0x3beb5d[_0x94ad('0x1f')]=qs[_0x94ad('0x1f')](_0x38a56f[_0x94ad('0x35')][_0x94ad('0x1f')]);_0x3beb5d[_0x94ad('0x1d')]=qs[_0x94ad('0x1d')](_0x38a56f[_0x94ad('0x35')][_0x94ad('0x1d')]);}_0x3beb5d[_0x94ad('0x3d')]=qs[_0x94ad('0x3e')](_0x38a56f[_0x94ad('0x35')]['sort']);_0x3beb5d[_0x94ad('0x3f')]=qs['filters'](_[_0x94ad('0x40')](_0x38a56f[_0x94ad('0x35')],_0x2c12bc[_0x94ad('0x37')]),_0x115b5e);if(_0x38a56f['query']['filter']){_0x3beb5d['where']=_['merge'](_0x3beb5d[_0x94ad('0x3f')],{'$or':_[_0x94ad('0x34')](_0x115b5e,function(_0x470000){if(_0x470000[_0x94ad('0x32')]!==_0x94ad('0x41')){var _0x43eb68={};_0x43eb68[_0x470000[_0x94ad('0x2c')]]={'$like':'%'+_0x38a56f['query']['filter']+'%'};return _0x43eb68;}})});}_0x3beb5d=_['merge']({},_0x3beb5d,_0x38a56f[_0x94ad('0x42')]);var _0x3e8383={'where':_0x3beb5d[_0x94ad('0x3f')]};return db[_0x94ad('0x2f')][_0x94ad('0x20')](_0x3e8383)[_0x94ad('0x26')](function(_0x19a5ca){_0x433036[_0x94ad('0x20')]=_0x19a5ca;if(_0x38a56f[_0x94ad('0x35')][_0x94ad('0x43')]){_0x3beb5d[_0x94ad('0x44')]=[{'all':!![]}];}return db[_0x94ad('0x2f')][_0x94ad('0x45')](_0x3beb5d);})[_0x94ad('0x26')](function(_0x1dce15){_0x433036['rows']=_0x1dce15;return _0x433036;})['then'](respondWithFilteredResult(_0x445bfd,_0x3beb5d))[_0x94ad('0x46')](handleError(_0x445bfd,null));};exports['show']=function(_0x279997,_0x1fdb59){var _0x1fdac3={'raw':!![],'where':{'id':_0x279997[_0x94ad('0x47')]['id']}},_0x74d010={};_0x74d010[_0x94ad('0x33')]=_[_0x94ad('0x36')](db[_0x94ad('0x2f')]['rawAttributes']);_0x74d010[_0x94ad('0x35')]=_[_0x94ad('0x36')](_0x279997['query']);_0x74d010['filters']=_[_0x94ad('0x38')](_0x74d010[_0x94ad('0x33')],_0x74d010['query']);_0x1fdac3[_0x94ad('0x3a')]=_[_0x94ad('0x38')](_0x74d010[_0x94ad('0x33')],qs[_0x94ad('0x39')](_0x279997['query'][_0x94ad('0x39')]));_0x1fdac3[_0x94ad('0x3a')]=_0x1fdac3[_0x94ad('0x3a')][_0x94ad('0x3b')]?_0x1fdac3[_0x94ad('0x3a')]:_0x74d010[_0x94ad('0x33')];if(_0x279997[_0x94ad('0x35')][_0x94ad('0x43')]){_0x1fdac3[_0x94ad('0x44')]=[{'all':!![]}];}_0x1fdac3=_[_0x94ad('0x48')]({},_0x1fdac3,_0x279997[_0x94ad('0x42')]);return db['OpenchannelQueue'][_0x94ad('0x49')](_0x1fdac3)[_0x94ad('0x26')](handleEntityNotFound(_0x1fdb59,null))[_0x94ad('0x26')](respondWithResult(_0x1fdb59,null))['catch'](handleError(_0x1fdb59,null));};exports[_0x94ad('0x4a')]=function(_0x5e1103,_0x187691){return db[_0x94ad('0x2f')][_0x94ad('0x4a')](_0x5e1103[_0x94ad('0x4b')],{})['then'](function(_0x18e54a){var _0x4b8912=_0x5e1103[_0x94ad('0x4c')][_0x94ad('0x27')]({'plain':!![]});if(!_0x4b8912)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b8912[_0x94ad('0x4d')]===_0x94ad('0x4c')){var _0x191c90=_0x18e54a[_0x94ad('0x27')]({'plain':!![]});var _0x126274=_0x94ad('0x28');return db[_0x94ad('0x4e')][_0x94ad('0x49')]({'where':{'name':_0x126274,'userProfileId':_0x4b8912[_0x94ad('0x4f')]},'raw':!![]})['then'](function(_0x2b4ed3){if(_0x2b4ed3&&_0x2b4ed3[_0x94ad('0x50')]===0x0){return db['UserProfileResource'][_0x94ad('0x4a')]({'name':_0x191c90[_0x94ad('0x2c')],'resourceId':_0x191c90['id'],'type':_0x2b4ed3[_0x94ad('0x2c')],'sectionId':_0x2b4ed3['id']},{})[_0x94ad('0x26')](function(){return _0x18e54a;});}else{return _0x18e54a;}})[_0x94ad('0x46')](function(_0x4eeaf3){logger[_0x94ad('0x2b')](_0x94ad('0x51'),_0x4eeaf3);throw _0x4eeaf3;});}return _0x18e54a;})[_0x94ad('0x26')](respondWithResult(_0x187691,0xc9))[_0x94ad('0x46')](handleError(_0x187691,null));};exports[_0x94ad('0x25')]=function(_0x5c405e,_0x54f340){if(_0x5c405e[_0x94ad('0x4b')]['id']){delete _0x5c405e[_0x94ad('0x4b')]['id'];}return db[_0x94ad('0x2f')][_0x94ad('0x49')]({'where':{'id':_0x5c405e[_0x94ad('0x47')]['id']}})[_0x94ad('0x26')](handleEntityNotFound(_0x54f340,null))['then'](saveUpdates(_0x5c405e['body'],null))[_0x94ad('0x26')](respondWithResult(_0x54f340,null))[_0x94ad('0x46')](handleError(_0x54f340,null));};exports[_0x94ad('0x2a')]=function(_0x44860a,_0x20b968){return db[_0x94ad('0x2f')][_0x94ad('0x49')]({'where':{'id':_0x44860a[_0x94ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x20b968,null))['then'](removeEntity(_0x20b968,null))[_0x94ad('0x46')](handleError(_0x20b968,null));};exports[_0x94ad('0x52')]=function(_0x2412c4,_0x14aba6){return db['OpenchannelQueue'][_0x94ad('0x52')]()[_0x94ad('0x26')](respondWithResult(_0x14aba6,null))[_0x94ad('0x46')](handleError(_0x14aba6,null));};exports[_0x94ad('0x53')]=function(_0x297604,_0x5f73e6,_0x46297a){var _0x350af7={'raw':!![],'where':{}},_0x3f14a7={},_0x3ba468;return db[_0x94ad('0x2f')][_0x94ad('0x54')]({'where':{'id':_0x297604[_0x94ad('0x47')]['id']}})[_0x94ad('0x26')](handleEntityNotFound(_0x5f73e6,null))[_0x94ad('0x26')](function(_0x15ca9a){if(_0x15ca9a){_0x3ba468=_0x15ca9a[_0x94ad('0x27')]({'plain':!![]});_0x3f14a7['model']=_[_0x94ad('0x36')](db[_0x94ad('0x55')][_0x94ad('0x30')]);_0x3f14a7[_0x94ad('0x35')]=_[_0x94ad('0x36')](_0x297604[_0x94ad('0x35')]);_0x3f14a7['filters']=_[_0x94ad('0x38')](_0x3f14a7[_0x94ad('0x33')],_0x3f14a7[_0x94ad('0x35')]);_0x350af7[_0x94ad('0x3a')]=_[_0x94ad('0x38')](_0x3f14a7['model'],qs['fields'](_0x297604[_0x94ad('0x35')][_0x94ad('0x39')]));_0x350af7[_0x94ad('0x3a')]=_0x350af7[_0x94ad('0x3a')][_0x94ad('0x3b')]?_0x350af7[_0x94ad('0x3a')]:_0x3f14a7[_0x94ad('0x33')];if(!_0x297604[_0x94ad('0x35')][_0x94ad('0x56')](_0x94ad('0x3c'))){_0x350af7[_0x94ad('0x1f')]=qs[_0x94ad('0x1f')](_0x297604[_0x94ad('0x35')][_0x94ad('0x1f')]);_0x350af7[_0x94ad('0x1d')]=qs[_0x94ad('0x1d')](_0x297604['query']['offset']);}_0x350af7[_0x94ad('0x3d')]=qs['sort'](_0x297604[_0x94ad('0x35')]['sort']);_0x350af7[_0x94ad('0x3f')]=qs[_0x94ad('0x37')](_[_0x94ad('0x40')](_0x297604[_0x94ad('0x35')],_0x3f14a7[_0x94ad('0x37')]));_0x350af7[_0x94ad('0x3f')]['OpenchannelQueueId']=_0x15ca9a['id'];if(_0x297604[_0x94ad('0x35')][_0x94ad('0x57')]){_0x350af7[_0x94ad('0x3f')]=_['merge'](_0x350af7[_0x94ad('0x3f')],{'$or':_[_0x94ad('0x34')](_0x350af7[_0x94ad('0x3a')],function(_0xade5b5){var _0x477020={};_0x477020[_0xade5b5]={'$like':'%'+_0x297604[_0x94ad('0x35')]['filter']+'%'};return _0x477020;})});}_0x350af7=_[_0x94ad('0x48')]({},_0x350af7,_0x297604[_0x94ad('0x42')]);return db[_0x94ad('0x55')][_0x94ad('0x45')](_0x350af7);}})['then'](function(_0x426155){if(_0x426155){return db[_0x94ad('0x58')][_0x94ad('0x59')]({'where':{'id':_[_0x94ad('0x34')](_0x426155,_0x94ad('0x5a')),'role':_0x94ad('0x5b')},'attributes':['id',_0x94ad('0x2c'),_0x94ad('0x5c'),'updatedAt',_0x94ad('0x5d')]});}})['then'](function(_0x1b836a){if(_0x1b836a){return{'count':_0x1b836a[_0x94ad('0x20')],'rows':_[_0x94ad('0x34')](_0x1b836a[_0x94ad('0x5e')],function(_0x4155fd){return{'membername':_0x4155fd[_0x94ad('0x2c')],'UserId':_0x4155fd['id'],'queue_name':_0x3ba468['name'],'OpenchannelQueueId':_0x3ba468['id'],'interface':util['format'](_0x94ad('0x5f'),_0x94ad('0x60'),_0x4155fd[_0x94ad('0x2c')]),'penalty':0x0,'paused':_0x4155fd[_0x94ad('0x5c')],'createdAt':_0x4155fd[_0x94ad('0x5d')],'updatedAt':_0x4155fd[_0x94ad('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5f73e6,_0x350af7))[_0x94ad('0x46')](handleError(_0x5f73e6,null));};exports[_0x94ad('0x62')]=function(_0x216e40,_0x3976b7,_0x3158dd){var _0x313e13={};var _0x3196ab={};var _0x1d41c7;var _0x373b48;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x216e40[_0x94ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x3976b7,null))[_0x94ad('0x26')](function(_0xa09380){if(_0xa09380){_0x1d41c7=_0xa09380;_0x3196ab['model']=_[_0x94ad('0x36')](db[_0x94ad('0x63')][_0x94ad('0x30')]);_0x3196ab[_0x94ad('0x35')]=_[_0x94ad('0x36')](_0x216e40[_0x94ad('0x35')]);_0x3196ab[_0x94ad('0x37')]=_[_0x94ad('0x38')](_0x3196ab[_0x94ad('0x33')],_0x3196ab[_0x94ad('0x35')]);_0x313e13['attributes']=_[_0x94ad('0x38')](_0x3196ab['model'],qs[_0x94ad('0x39')](_0x216e40[_0x94ad('0x35')]['fields']));_0x313e13[_0x94ad('0x3a')]=_0x313e13[_0x94ad('0x3a')]['length']?_0x313e13[_0x94ad('0x3a')]:_0x3196ab[_0x94ad('0x33')];_0x313e13[_0x94ad('0x3d')]=qs[_0x94ad('0x3e')](_0x216e40['query'][_0x94ad('0x3e')]);_0x313e13[_0x94ad('0x3f')]=qs[_0x94ad('0x37')](_[_0x94ad('0x40')](_0x216e40['query'],_0x3196ab[_0x94ad('0x37')]));if(_0x216e40[_0x94ad('0x35')][_0x94ad('0x57')]){_0x313e13['where']=_[_0x94ad('0x48')](_0x313e13[_0x94ad('0x3f')],{'$or':_[_0x94ad('0x34')](_0x313e13[_0x94ad('0x3a')],function(_0x565cb4){var _0x596ebe={};_0x596ebe[_0x565cb4]={'$like':'%'+_0x216e40['query'][_0x94ad('0x57')]+'%'};return _0x596ebe;})});}_0x313e13=_[_0x94ad('0x48')]({},_0x313e13,_0x216e40['options']);return _0x1d41c7[_0x94ad('0x62')](_0x313e13);}})['then'](function(_0x2fc775){if(_0x2fc775){_0x373b48=_0x2fc775[_0x94ad('0x3b')];if(!_0x216e40[_0x94ad('0x35')][_0x94ad('0x56')]('nolimit')){_0x313e13[_0x94ad('0x1f')]=qs[_0x94ad('0x1f')](_0x216e40[_0x94ad('0x35')]['limit']);_0x313e13[_0x94ad('0x1d')]=qs['offset'](_0x216e40[_0x94ad('0x35')][_0x94ad('0x1d')]);}return _0x1d41c7[_0x94ad('0x62')](_0x313e13);}})[_0x94ad('0x26')](function(_0x37a93a){if(_0x37a93a){return _0x37a93a?{'count':_0x373b48,'rows':_0x37a93a}:null;}})['then'](respondWithResult(_0x3976b7,null))['catch'](handleError(_0x3976b7,null));};exports['addTeams']=function(_0x509898,_0x41b67f,_0x1f57d8){var _0x26c1b3=_0x509898[_0x94ad('0x4b')]['ids'];return db[_0x94ad('0x63')]['findAll']({'where':{'id':_0x26c1b3},'attributes':['id'],'include':[{'model':db[_0x94ad('0x58')],'as':_0x94ad('0x64'),'attributes':['id',_0x94ad('0x2c'),_0x94ad('0x65'),_0x94ad('0x66'),'interface'],'raw':!![]}]})['then'](function(_0x4025a1){if(_0x4025a1){var _0x140fc1=_[_0x94ad('0x67')](_0x4025a1,function(_0x513dd4){var _0xcb3c99=_0x513dd4['get']({'plain':!![]});return _0xcb3c99[_0x94ad('0x64')];});return db['OpenchannelQueue'][_0x94ad('0x49')]({'where':{'id':_0x509898[_0x94ad('0x47')]['id']}})[_0x94ad('0x26')](function(_0x2162f8){return db['sequelize'][_0x94ad('0x68')](function(_0x593d2e){return _0x2162f8['addTeams'](_0x26c1b3,{'transaction':_0x593d2e})[_0x94ad('0x26')](function(){return BPromise[_0x94ad('0x69')](_0x140fc1,function(_0x314402){return db[_0x94ad('0x55')][_0x94ad('0x6a')]({'where':{'UserId':_0x314402['id'],'OpenchannelQueueId':_0x509898[_0x94ad('0x47')]['id']},'transaction':_0x593d2e});});})[_0x94ad('0x26')](function(){_0x140fc1['forEach'](function(_0x4a268f){socket['emit'](_0x94ad('0x6b'),{'UserId':_0x4a268f['id'],'OpenchannelQueueId':_0x2162f8['id']});});});});});}})['then'](respondWithStatusCode(_0x41b67f,null))[_0x94ad('0x46')](handleError(_0x41b67f,null));};exports[_0x94ad('0x6c')]=function(_0x42bd81,_0x181643,_0x27e091){return db[_0x94ad('0x63')]['findAll']({'where':{'id':_0x42bd81[_0x94ad('0x35')][_0x94ad('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x94ad('0x58')],'as':_0x94ad('0x64'),'attributes':['id'],'raw':!![]}]})[_0x94ad('0x26')](handleEntityNotFound(_0x181643,null))['then'](function(_0x255556){var _0xea54a3=_[_0x94ad('0x34')](_0x255556,'id');var _0x3078f0=[];var _0x61bc6b=[];var _0x6b8751=squel[_0x94ad('0x6e')]();_0x6b8751[_0x94ad('0x6f')]('tq.TeamId')[_0x94ad('0x70')](_0x94ad('0x71'),'tq')[_0x94ad('0x72')](_0x94ad('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x94ad('0x3f')](_0x94ad('0x74'),_0x42bd81[_0x94ad('0x47')]['id']);for(var _0x17212b=0x0;_0x17212b<_0x255556[_0x94ad('0x3b')];_0x17212b+=0x1){let _0x2bf67d=_0x255556[_0x17212b];for(var _0x15543f=0x0;_0x15543f<_0x2bf67d[_0x94ad('0x64')][_0x94ad('0x3b')];_0x15543f+=0x1){let _0xbb33a1=_0x2bf67d[_0x94ad('0x64')][_0x15543f];var _0x1fdcec=_0x6b8751[_0x94ad('0x75')]();_0x1fdcec[_0x94ad('0x3f')](_0x94ad('0x76'),_0xbb33a1['id']);_0x61bc6b['push'](db['sequelize'][_0x94ad('0x35')](_0x1fdcec[_0x94ad('0x77')](),{'type':db[_0x94ad('0x78')][_0x94ad('0x79')]['SELECT']})[_0x94ad('0x26')](function(_0x564869){if(_0x564869[_0x94ad('0x3b')]===0x1){return _0xbb33a1['id'];}else{var _0x7e305f=_[_0x94ad('0x7a')](_[_0x94ad('0x34')](_0x564869,'TeamId'),function(_0x26124d){return _[_0x94ad('0x7b')](_0xea54a3,_0x26124d);});if(_0x7e305f){return _0xbb33a1['id'];}}}));}}return BPromise['all'](_0x61bc6b)[_0x94ad('0x26')](function(_0x230d89){_0x3078f0=_(_0x3078f0)[_0x94ad('0x7c')](_0x230d89)[_0x94ad('0x7d')]()[_0x94ad('0x7e')]();return db[_0x94ad('0x2f')][_0x94ad('0x49')]({'where':{'id':_0x42bd81[_0x94ad('0x47')]['id']}})[_0x94ad('0x26')](function(_0x58d560){return db[_0x94ad('0x78')][_0x94ad('0x68')](function(_0x1a4a01){return _0x58d560[_0x94ad('0x6c')](_0x42bd81[_0x94ad('0x35')]['ids'],{'transaction':_0x1a4a01})[_0x94ad('0x26')](function(){if(!_[_0x94ad('0x7f')](_0x3078f0)){return _0x58d560[_0x94ad('0x80')](_0x3078f0,{'transaction':_0x1a4a01});}})[_0x94ad('0x26')](function(){_0x3078f0[_0x94ad('0x81')](function(_0x3c847f){socket[_0x94ad('0x82')](_0x94ad('0x83'),{'UserId':_0x3c847f,'OpenchannelQueueId':_0x58d560['id']});});});});});});})[_0x94ad('0x26')](respondWithStatusCode(_0x181643,null))[_0x94ad('0x46')](handleError(_0x181643,null));};exports['addAgents']=function(_0x18ef27,_0x503bdf,_0x58ee63){return db[_0x94ad('0x2f')][_0x94ad('0x49')]({'where':{'id':_0x18ef27[_0x94ad('0x47')]['id']}})[_0x94ad('0x26')](handleEntityNotFound(_0x503bdf,null))[_0x94ad('0x26')](function(_0x1bb05d){if(_0x1bb05d){return _0x1bb05d[_0x94ad('0x84')](_0x18ef27[_0x94ad('0x4b')][_0x94ad('0x6d')],_[_0x94ad('0x85')](_0x18ef27[_0x94ad('0x4b')],[_0x94ad('0x6d'),'id'])||{})[_0x94ad('0x86')](function(_0x51a062){for(var _0x385acc=0x0;_0x385acc<_0x18ef27['body'][_0x94ad('0x6d')]['length'];_0x385acc+=0x1){socket[_0x94ad('0x82')]('userOpenchannelQueue:save',{'UserId':Number(_0x18ef27['body'][_0x94ad('0x6d')][_0x385acc]),'OpenchannelQueueId':Number(_0x18ef27[_0x94ad('0x47')]['id'])});}return _0x51a062;});}})['then'](respondWithResult(_0x503bdf,null))[_0x94ad('0x46')](handleError(_0x503bdf,null));};exports[_0x94ad('0x80')]=function(_0x4d0d75,_0x291f53,_0x3c78f5){return db[_0x94ad('0x2f')]['find']({'where':{'id':_0x4d0d75[_0x94ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x291f53,null))[_0x94ad('0x26')](function(_0x25f372){if(_0x25f372){return _0x25f372['removeAgents'](_0x4d0d75[_0x94ad('0x35')][_0x94ad('0x6d')])[_0x94ad('0x26')](function(){if(_[_0x94ad('0x87')](_0x4d0d75[_0x94ad('0x35')][_0x94ad('0x6d')])){for(var _0x29598f=0x0;_0x29598f<_0x4d0d75['query'][_0x94ad('0x6d')][_0x94ad('0x3b')];_0x29598f+=0x1){socket[_0x94ad('0x82')](_0x94ad('0x83'),{'UserId':Number(_0x4d0d75[_0x94ad('0x35')][_0x94ad('0x6d')][_0x29598f]),'OpenchannelQueueId':Number(_0x4d0d75[_0x94ad('0x47')]['id'])});}}else{socket[_0x94ad('0x82')](_0x94ad('0x83'),{'UserId':Number(_0x4d0d75['query']['ids']),'OpenchannelQueueId':Number(_0x4d0d75[_0x94ad('0x47')]['id'])});}});}})[_0x94ad('0x26')](respondWithStatusCode(_0x291f53,null))[_0x94ad('0x46')](handleError(_0x291f53,null));};exports[_0x94ad('0x88')]=function(_0x21a950,_0x2e12b3,_0x1edcf9){var _0x51652d={};var _0x53438d={};var _0xe10c19;var _0x26f73d;return db[_0x94ad('0x2f')]['findOne']({'where':{'id':_0x21a950[_0x94ad('0x47')]['id']}})[_0x94ad('0x26')](handleEntityNotFound(_0x2e12b3,null))['then'](function(_0x35c4d0){if(_0x35c4d0){_0xe10c19=_0x35c4d0;_0x53438d[_0x94ad('0x33')]=_[_0x94ad('0x36')](db[_0x94ad('0x58')]['rawAttributes']);_0x53438d['query']=_[_0x94ad('0x36')](_0x21a950[_0x94ad('0x35')]);_0x53438d[_0x94ad('0x37')]=_[_0x94ad('0x38')](_0x53438d[_0x94ad('0x33')],_0x53438d[_0x94ad('0x35')]);_0x51652d[_0x94ad('0x3a')]=_[_0x94ad('0x38')](_0x53438d[_0x94ad('0x33')],qs[_0x94ad('0x39')](_0x21a950[_0x94ad('0x35')][_0x94ad('0x39')]));_0x51652d[_0x94ad('0x3a')]=_0x51652d[_0x94ad('0x3a')]['length']?_0x51652d['attributes']:_0x53438d['model'];_0x51652d[_0x94ad('0x3d')]=qs[_0x94ad('0x3e')](_0x21a950['query']['sort']);_0x51652d['where']=qs['filters'](_[_0x94ad('0x40')](_0x21a950[_0x94ad('0x35')],_0x53438d[_0x94ad('0x37')]));if(_0x21a950[_0x94ad('0x35')][_0x94ad('0x57')]){_0x51652d[_0x94ad('0x3f')]=_[_0x94ad('0x48')](_0x51652d[_0x94ad('0x3f')],{'$or':_[_0x94ad('0x34')](_0x51652d['attributes'],function(_0x4c29e6){var _0x26d584={};_0x26d584[_0x4c29e6]={'$like':'%'+_0x21a950[_0x94ad('0x35')]['filter']+'%'};return _0x26d584;})});}_0x51652d=_[_0x94ad('0x48')]({},_0x51652d,_0x21a950[_0x94ad('0x42')]);return _0xe10c19[_0x94ad('0x88')](_0x51652d);}})[_0x94ad('0x26')](function(_0x2ac2f2){if(_0x2ac2f2){_0x26f73d=_0x2ac2f2[_0x94ad('0x3b')];if(!_0x21a950['query'][_0x94ad('0x56')](_0x94ad('0x3c'))){_0x51652d[_0x94ad('0x1f')]=qs['limit'](_0x21a950[_0x94ad('0x35')]['limit']);_0x51652d[_0x94ad('0x1d')]=qs[_0x94ad('0x1d')](_0x21a950[_0x94ad('0x35')][_0x94ad('0x1d')]);}return _0xe10c19[_0x94ad('0x88')](_0x51652d);}})['then'](function(_0x3a932d){if(_0x3a932d){return _0x3a932d?{'count':_0x26f73d,'rows':_0x3a932d}:null;}})[_0x94ad('0x26')](respondWithResult(_0x2e12b3,null))[_0x94ad('0x46')](handleError(_0x2e12b3,null));}; \ No newline at end of file +var _0xfddd=['filter','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','params','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','pick','OpenchannelQueueId','UserId','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','User','online','voicePause','interface','flatMap','Agents','transaction','each','forEach','emit','userOpenchannelQueue:save','ids','field','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','OpenchannelQueue','fieldName','type','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','merge'];(function(_0x4d78ce,_0x4339f5){var _0x369c3a=function(_0x2ca4f4){while(--_0x2ca4f4){_0x4d78ce['push'](_0x4d78ce['shift']());}};_0x369c3a(++_0x4339f5);}(_0xfddd,0x1e4));var _0xdfdd=function(_0x59fc96,_0x253394){_0x59fc96=_0x59fc96-0x0;var _0x578088=_0xfddd[_0x59fc96];return _0x578088;};'use strict';var emlformat=require(_0xdfdd('0x0'));var rimraf=require(_0xdfdd('0x1'));var zipdir=require(_0xdfdd('0x2'));var jsonpatch=require(_0xdfdd('0x3'));var rp=require('request-promise');var moment=require(_0xdfdd('0x4'));var BPromise=require(_0xdfdd('0x5'));var Mustache=require('mustache');var util=require(_0xdfdd('0x6'));var path=require('path');var sox=require(_0xdfdd('0x7'));var csv=require(_0xdfdd('0x8'));var ejs=require(_0xdfdd('0x9'));var fs=require('fs');var fs_extra=require(_0xdfdd('0xa'));var _=require(_0xdfdd('0xb'));var squel=require(_0xdfdd('0xc'));var crypto=require(_0xdfdd('0xd'));var jsforce=require(_0xdfdd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdfdd('0xf'));var Redis=require(_0xdfdd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdfdd('0x11'));var as=require(_0xdfdd('0x12'));var hardwareService=require(_0xdfdd('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdfdd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdd('0x15'));var db=require('../../mysqldb')['db'];config[_0xdfdd('0x16')]=_[_0xdfdd('0x17')](config['redis'],{'host':_0xdfdd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfdd('0x16')]));require(_0xdfdd('0x19'))[_0xdfdd('0x1a')](socket);function respondWithStatusCode(_0x1fbb65,_0x96112a){_0x96112a=_0x96112a||0xcc;return function(_0x216cd1){if(_0x216cd1){return _0x1fbb65[_0xdfdd('0x1b')](_0x96112a);}return _0x1fbb65[_0xdfdd('0x1c')](_0x96112a)[_0xdfdd('0x1d')]();};}function respondWithResult(_0x91758d,_0xb7d25d){_0xb7d25d=_0xb7d25d||0xc8;return function(_0x223392){if(_0x223392){return _0x91758d['status'](_0xb7d25d)[_0xdfdd('0x1e')](_0x223392);}};}function respondWithFilteredResult(_0x58b4c7,_0x11ac05){return function(_0x4e1f3f){if(_0x4e1f3f){var _0x39e990=typeof _0x11ac05[_0xdfdd('0x1f')]===_0xdfdd('0x20')&&typeof _0x11ac05['limit']===_0xdfdd('0x20');var _0x338999=_0x4e1f3f['count'];var _0xcf7c0a=_0x39e990?0x0:_0x11ac05[_0xdfdd('0x1f')];var _0x406646=_0x39e990?_0x4e1f3f[_0xdfdd('0x21')]:_0x11ac05['offset']+_0x11ac05['limit'];var _0x5736de;if(_0x406646>=_0x338999){_0x406646=_0x338999;_0x5736de=0xc8;}else{_0x5736de=0xce;}_0x58b4c7[_0xdfdd('0x1c')](_0x5736de);return _0x58b4c7['set'](_0xdfdd('0x22'),_0xcf7c0a+'-'+_0x406646+'/'+_0x338999)[_0xdfdd('0x1e')](_0x4e1f3f);}return null;};}function patchUpdates(_0x331eba){return function(_0x12e0ae){try{jsonpatch['apply'](_0x12e0ae,_0x331eba,!![]);}catch(_0x3dda11){return BPromise[_0xdfdd('0x23')](_0x3dda11);}return _0x12e0ae[_0xdfdd('0x24')]();};}function saveUpdates(_0x275e33,_0x3815eb){return function(_0x42af1d){if(_0x42af1d){return _0x42af1d['update'](_0x275e33)[_0xdfdd('0x25')](function(_0x1e61fc){return _0x1e61fc;});}return null;};}function removeEntity(_0x135101,_0x36a3ac){return function(_0x23da2b){if(_0x23da2b){return _0x23da2b[_0xdfdd('0x26')]()[_0xdfdd('0x25')](function(){var _0x43dbf0=_0x23da2b[_0xdfdd('0x27')]({'plain':!![]});var _0x388aed=_0xdfdd('0x28');return db[_0xdfdd('0x29')][_0xdfdd('0x26')]({'where':{'type':_0x388aed,'resourceId':_0x43dbf0['id']}})['then'](function(){return _0x23da2b;});})[_0xdfdd('0x25')](function(){_0x135101[_0xdfdd('0x1c')](0xcc)[_0xdfdd('0x1d')]();});}};}function handleEntityNotFound(_0x22008b,_0x598780){return function(_0x1fef33){if(!_0x1fef33){_0x22008b[_0xdfdd('0x1b')](0x194);}return _0x1fef33;};}function handleError(_0x5bbcbb,_0x165c7c){_0x165c7c=_0x165c7c||0x1f4;return function(_0xf57cb7){logger[_0xdfdd('0x2a')](_0xf57cb7['stack']);if(_0xf57cb7[_0xdfdd('0x2b')]){delete _0xf57cb7[_0xdfdd('0x2b')];}_0x5bbcbb['status'](_0x165c7c)[_0xdfdd('0x2c')](_0xf57cb7);};}exports['index']=function(_0x1951a6,_0x152323){var _0x4c69ed={},_0x4c7d33={},_0x112ce5={'count':0x0,'rows':[]};var _0x4a6cbc=_['map'](db[_0xdfdd('0x2d')]['rawAttributes'],function(_0x393376){return{'name':_0x393376[_0xdfdd('0x2e')],'type':_0x393376[_0xdfdd('0x2f')][_0xdfdd('0x30')]};});_0x4c7d33['model']=_[_0xdfdd('0x31')](_0x4a6cbc,'name');_0x4c7d33[_0xdfdd('0x32')]=_[_0xdfdd('0x33')](_0x1951a6[_0xdfdd('0x32')]);_0x4c7d33[_0xdfdd('0x34')]=_['intersection'](_0x4c7d33[_0xdfdd('0x35')],_0x4c7d33[_0xdfdd('0x32')]);_0x4c69ed['attributes']=_[_0xdfdd('0x36')](_0x4c7d33['model'],qs[_0xdfdd('0x37')](_0x1951a6[_0xdfdd('0x32')][_0xdfdd('0x37')]));_0x4c69ed[_0xdfdd('0x38')]=_0x4c69ed[_0xdfdd('0x38')][_0xdfdd('0x39')]?_0x4c69ed[_0xdfdd('0x38')]:_0x4c7d33[_0xdfdd('0x35')];if(!_0x1951a6[_0xdfdd('0x32')][_0xdfdd('0x3a')]('nolimit')){_0x4c69ed['limit']=qs[_0xdfdd('0x3b')](_0x1951a6[_0xdfdd('0x32')][_0xdfdd('0x3b')]);_0x4c69ed[_0xdfdd('0x1f')]=qs['offset'](_0x1951a6[_0xdfdd('0x32')][_0xdfdd('0x1f')]);}_0x4c69ed[_0xdfdd('0x3c')]=qs[_0xdfdd('0x3d')](_0x1951a6['query'][_0xdfdd('0x3d')]);_0x4c69ed['where']=qs[_0xdfdd('0x34')](_['pick'](_0x1951a6[_0xdfdd('0x32')],_0x4c7d33['filters']),_0x4a6cbc);if(_0x1951a6[_0xdfdd('0x32')]['filter']){_0x4c69ed[_0xdfdd('0x3e')]=_[_0xdfdd('0x3f')](_0x4c69ed[_0xdfdd('0x3e')],{'$or':_[_0xdfdd('0x31')](_0x4a6cbc,function(_0x4ddf3a){if(_0x4ddf3a[_0xdfdd('0x2f')]!=='VIRTUAL'){var _0x6cd8cb={};_0x6cd8cb[_0x4ddf3a[_0xdfdd('0x2b')]]={'$like':'%'+_0x1951a6[_0xdfdd('0x32')][_0xdfdd('0x40')]+'%'};return _0x6cd8cb;}})});}_0x4c69ed=_['merge']({},_0x4c69ed,_0x1951a6[_0xdfdd('0x41')]);var _0x3cf0a5={'where':_0x4c69ed[_0xdfdd('0x3e')]};return db[_0xdfdd('0x2d')][_0xdfdd('0x21')](_0x3cf0a5)[_0xdfdd('0x25')](function(_0x569665){_0x112ce5[_0xdfdd('0x21')]=_0x569665;if(_0x1951a6[_0xdfdd('0x32')]['includeAll']){_0x4c69ed[_0xdfdd('0x42')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xdfdd('0x43')](_0x4c69ed);})[_0xdfdd('0x25')](function(_0x95fb60){_0x112ce5[_0xdfdd('0x44')]=_0x95fb60;return _0x112ce5;})[_0xdfdd('0x25')](respondWithFilteredResult(_0x152323,_0x4c69ed))[_0xdfdd('0x45')](handleError(_0x152323,null));};exports[_0xdfdd('0x46')]=function(_0x236222,_0x34a091){var _0x463e88={'raw':!![],'where':{'id':_0x236222['params']['id']}},_0x26dfb5={};_0x26dfb5[_0xdfdd('0x35')]=_[_0xdfdd('0x33')](db[_0xdfdd('0x2d')][_0xdfdd('0x47')]);_0x26dfb5[_0xdfdd('0x32')]=_[_0xdfdd('0x33')](_0x236222[_0xdfdd('0x32')]);_0x26dfb5[_0xdfdd('0x34')]=_[_0xdfdd('0x36')](_0x26dfb5[_0xdfdd('0x35')],_0x26dfb5[_0xdfdd('0x32')]);_0x463e88['attributes']=_['intersection'](_0x26dfb5['model'],qs['fields'](_0x236222[_0xdfdd('0x32')][_0xdfdd('0x37')]));_0x463e88['attributes']=_0x463e88['attributes']['length']?_0x463e88[_0xdfdd('0x38')]:_0x26dfb5[_0xdfdd('0x35')];if(_0x236222['query']['includeAll']){_0x463e88[_0xdfdd('0x42')]=[{'all':!![]}];}_0x463e88=_[_0xdfdd('0x3f')]({},_0x463e88,_0x236222[_0xdfdd('0x41')]);return db[_0xdfdd('0x2d')][_0xdfdd('0x48')](_0x463e88)[_0xdfdd('0x25')](handleEntityNotFound(_0x34a091,null))[_0xdfdd('0x25')](respondWithResult(_0x34a091,null))['catch'](handleError(_0x34a091,null));};exports[_0xdfdd('0x49')]=function(_0x4ed2da,_0x26d06e){return db[_0xdfdd('0x2d')][_0xdfdd('0x49')](_0x4ed2da[_0xdfdd('0x4a')],{})[_0xdfdd('0x25')](function(_0x5ab94d){var _0x45a1bf=_0x4ed2da[_0xdfdd('0x4b')][_0xdfdd('0x27')]({'plain':!![]});if(!_0x45a1bf)throw new Error(_0xdfdd('0x4c'));if(_0x45a1bf[_0xdfdd('0x4d')]==='user'){var _0x546409=_0x5ab94d[_0xdfdd('0x27')]({'plain':!![]});var _0x4dc815=_0xdfdd('0x28');return db[_0xdfdd('0x4e')][_0xdfdd('0x48')]({'where':{'name':_0x4dc815,'userProfileId':_0x45a1bf[_0xdfdd('0x4f')]},'raw':!![]})['then'](function(_0x3eeaca){if(_0x3eeaca&&_0x3eeaca[_0xdfdd('0x50')]===0x0){return db[_0xdfdd('0x29')][_0xdfdd('0x49')]({'name':_0x546409[_0xdfdd('0x2b')],'resourceId':_0x546409['id'],'type':_0x3eeaca['name'],'sectionId':_0x3eeaca['id']},{})[_0xdfdd('0x25')](function(){return _0x5ab94d;});}else{return _0x5ab94d;}})[_0xdfdd('0x45')](function(_0x220f32){logger[_0xdfdd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x220f32);throw _0x220f32;});}return _0x5ab94d;})[_0xdfdd('0x25')](respondWithResult(_0x26d06e,0xc9))[_0xdfdd('0x45')](handleError(_0x26d06e,null));};exports[_0xdfdd('0x51')]=function(_0x3ea28b,_0x47ca2a){if(_0x3ea28b[_0xdfdd('0x4a')]['id']){delete _0x3ea28b['body']['id'];}return db[_0xdfdd('0x2d')][_0xdfdd('0x48')]({'where':{'id':_0x3ea28b['params']['id']}})[_0xdfdd('0x25')](handleEntityNotFound(_0x47ca2a,null))[_0xdfdd('0x25')](saveUpdates(_0x3ea28b['body'],null))[_0xdfdd('0x25')](respondWithResult(_0x47ca2a,null))['catch'](handleError(_0x47ca2a,null));};exports[_0xdfdd('0x26')]=function(_0x335983,_0x4e5654){return db[_0xdfdd('0x2d')]['find']({'where':{'id':_0x335983[_0xdfdd('0x52')]['id']}})[_0xdfdd('0x25')](handleEntityNotFound(_0x4e5654,null))[_0xdfdd('0x25')](removeEntity(_0x4e5654,null))['catch'](handleError(_0x4e5654,null));};exports['describe']=function(_0x25ee35,_0x434e08){return db[_0xdfdd('0x2d')][_0xdfdd('0x53')]()[_0xdfdd('0x25')](respondWithResult(_0x434e08,null))['catch'](handleError(_0x434e08,null));};exports[_0xdfdd('0x54')]=function(_0x5aa437,_0x4f9aea,_0xa2a64a){var _0x4a2c8c={'raw':!![],'where':{}},_0x918a79={},_0x3911be;return db[_0xdfdd('0x2d')][_0xdfdd('0x55')]({'where':{'id':_0x5aa437[_0xdfdd('0x52')]['id']}})['then'](handleEntityNotFound(_0x4f9aea,null))[_0xdfdd('0x25')](function(_0x1d15ce){if(_0x1d15ce){_0x3911be=_0x1d15ce[_0xdfdd('0x27')]({'plain':!![]});_0x918a79[_0xdfdd('0x35')]=_[_0xdfdd('0x33')](db[_0xdfdd('0x56')][_0xdfdd('0x47')]);_0x918a79[_0xdfdd('0x32')]=_[_0xdfdd('0x33')](_0x5aa437[_0xdfdd('0x32')]);_0x918a79[_0xdfdd('0x34')]=_['intersection'](_0x918a79[_0xdfdd('0x35')],_0x918a79[_0xdfdd('0x32')]);_0x4a2c8c['attributes']=_[_0xdfdd('0x36')](_0x918a79[_0xdfdd('0x35')],qs[_0xdfdd('0x37')](_0x5aa437[_0xdfdd('0x32')][_0xdfdd('0x37')]));_0x4a2c8c['attributes']=_0x4a2c8c[_0xdfdd('0x38')][_0xdfdd('0x39')]?_0x4a2c8c[_0xdfdd('0x38')]:_0x918a79['model'];if(!_0x5aa437['query'][_0xdfdd('0x3a')](_0xdfdd('0x57'))){_0x4a2c8c[_0xdfdd('0x3b')]=qs[_0xdfdd('0x3b')](_0x5aa437[_0xdfdd('0x32')]['limit']);_0x4a2c8c['offset']=qs[_0xdfdd('0x1f')](_0x5aa437[_0xdfdd('0x32')][_0xdfdd('0x1f')]);}_0x4a2c8c[_0xdfdd('0x3c')]=qs[_0xdfdd('0x3d')](_0x5aa437['query'][_0xdfdd('0x3d')]);_0x4a2c8c[_0xdfdd('0x3e')]=qs[_0xdfdd('0x34')](_[_0xdfdd('0x58')](_0x5aa437[_0xdfdd('0x32')],_0x918a79[_0xdfdd('0x34')]));_0x4a2c8c[_0xdfdd('0x3e')][_0xdfdd('0x59')]=_0x1d15ce['id'];if(_0x5aa437['query'][_0xdfdd('0x40')]){_0x4a2c8c[_0xdfdd('0x3e')]=_['merge'](_0x4a2c8c['where'],{'$or':_[_0xdfdd('0x31')](_0x4a2c8c[_0xdfdd('0x38')],function(_0x2bb7cf){var _0xc028d0={};_0xc028d0[_0x2bb7cf]={'$like':'%'+_0x5aa437['query'][_0xdfdd('0x40')]+'%'};return _0xc028d0;})});}_0x4a2c8c=_[_0xdfdd('0x3f')]({},_0x4a2c8c,_0x5aa437[_0xdfdd('0x41')]);return db[_0xdfdd('0x56')][_0xdfdd('0x43')](_0x4a2c8c);}})['then'](function(_0x29973e){if(_0x29973e){return db['User']['findAndCountAll']({'where':{'id':_[_0xdfdd('0x31')](_0x29973e,_0xdfdd('0x5a')),'role':'agent'},'attributes':['id',_0xdfdd('0x2b'),_0xdfdd('0x5b'),_0xdfdd('0x5c'),'createdAt']});}})[_0xdfdd('0x25')](function(_0x544932){if(_0x544932){return{'count':_0x544932[_0xdfdd('0x21')],'rows':_[_0xdfdd('0x31')](_0x544932[_0xdfdd('0x44')],function(_0x35e565){return{'membername':_0x35e565[_0xdfdd('0x2b')],'UserId':_0x35e565['id'],'queue_name':_0x3911be[_0xdfdd('0x2b')],'OpenchannelQueueId':_0x3911be['id'],'interface':util[_0xdfdd('0x5d')](_0xdfdd('0x5e'),_0xdfdd('0x5f'),_0x35e565['name']),'penalty':0x0,'paused':_0x35e565['openchannelPause'],'createdAt':_0x35e565[_0xdfdd('0x60')],'updatedAt':_0x35e565[_0xdfdd('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdfdd('0x25')](respondWithFilteredResult(_0x4f9aea,_0x4a2c8c))[_0xdfdd('0x45')](handleError(_0x4f9aea,null));};exports['getTeams']=function(_0x32a24f,_0x970d29,_0x239014){var _0xb5f84={};var _0xb45145={};var _0x528db2;var _0x18d0e2;return db['OpenchannelQueue'][_0xdfdd('0x55')]({'where':{'id':_0x32a24f[_0xdfdd('0x52')]['id']}})['then'](handleEntityNotFound(_0x970d29,null))['then'](function(_0x1f22bf){if(_0x1f22bf){_0x528db2=_0x1f22bf;_0xb45145[_0xdfdd('0x35')]=_[_0xdfdd('0x33')](db[_0xdfdd('0x61')][_0xdfdd('0x47')]);_0xb45145[_0xdfdd('0x32')]=_[_0xdfdd('0x33')](_0x32a24f[_0xdfdd('0x32')]);_0xb45145[_0xdfdd('0x34')]=_['intersection'](_0xb45145['model'],_0xb45145[_0xdfdd('0x32')]);_0xb5f84[_0xdfdd('0x38')]=_[_0xdfdd('0x36')](_0xb45145['model'],qs['fields'](_0x32a24f[_0xdfdd('0x32')]['fields']));_0xb5f84[_0xdfdd('0x38')]=_0xb5f84[_0xdfdd('0x38')][_0xdfdd('0x39')]?_0xb5f84[_0xdfdd('0x38')]:_0xb45145[_0xdfdd('0x35')];_0xb5f84['order']=qs[_0xdfdd('0x3d')](_0x32a24f[_0xdfdd('0x32')][_0xdfdd('0x3d')]);_0xb5f84['where']=qs[_0xdfdd('0x34')](_['pick'](_0x32a24f['query'],_0xb45145[_0xdfdd('0x34')]));if(_0x32a24f[_0xdfdd('0x32')][_0xdfdd('0x40')]){_0xb5f84[_0xdfdd('0x3e')]=_['merge'](_0xb5f84[_0xdfdd('0x3e')],{'$or':_['map'](_0xb5f84[_0xdfdd('0x38')],function(_0x9a8340){var _0x1d7df9={};_0x1d7df9[_0x9a8340]={'$like':'%'+_0x32a24f[_0xdfdd('0x32')][_0xdfdd('0x40')]+'%'};return _0x1d7df9;})});}_0xb5f84=_[_0xdfdd('0x3f')]({},_0xb5f84,_0x32a24f[_0xdfdd('0x41')]);return _0x528db2[_0xdfdd('0x62')](_0xb5f84);}})['then'](function(_0x34d6be){if(_0x34d6be){_0x18d0e2=_0x34d6be[_0xdfdd('0x39')];if(!_0x32a24f[_0xdfdd('0x32')][_0xdfdd('0x3a')](_0xdfdd('0x57'))){_0xb5f84[_0xdfdd('0x3b')]=qs[_0xdfdd('0x3b')](_0x32a24f[_0xdfdd('0x32')][_0xdfdd('0x3b')]);_0xb5f84['offset']=qs[_0xdfdd('0x1f')](_0x32a24f[_0xdfdd('0x32')][_0xdfdd('0x1f')]);}return _0x528db2[_0xdfdd('0x62')](_0xb5f84);}})[_0xdfdd('0x25')](function(_0x565a5a){if(_0x565a5a){return _0x565a5a?{'count':_0x18d0e2,'rows':_0x565a5a}:null;}})[_0xdfdd('0x25')](respondWithResult(_0x970d29,null))[_0xdfdd('0x45')](handleError(_0x970d29,null));};exports[_0xdfdd('0x63')]=function(_0x2bd8fc,_0x54eb15,_0x18427e){var _0x1aa290=_0x2bd8fc[_0xdfdd('0x4a')]['ids'];return db[_0xdfdd('0x61')]['findAll']({'where':{'id':_0x1aa290},'attributes':['id'],'include':[{'model':db[_0xdfdd('0x64')],'as':'Agents','attributes':['id',_0xdfdd('0x2b'),_0xdfdd('0x65'),_0xdfdd('0x66'),_0xdfdd('0x67')],'raw':!![]}]})[_0xdfdd('0x25')](function(_0x5979bb){if(_0x5979bb){var _0x4b983a=_[_0xdfdd('0x68')](_0x5979bb,function(_0x2b07c3){var _0x2fcef5=_0x2b07c3[_0xdfdd('0x27')]({'plain':!![]});return _0x2fcef5[_0xdfdd('0x69')];});return db['OpenchannelQueue'][_0xdfdd('0x48')]({'where':{'id':_0x2bd8fc[_0xdfdd('0x52')]['id']}})['then'](function(_0xcc5224){return db['sequelize'][_0xdfdd('0x6a')](function(_0x29487c){return _0xcc5224[_0xdfdd('0x63')](_0x1aa290,{'transaction':_0x29487c})[_0xdfdd('0x25')](function(){return BPromise[_0xdfdd('0x6b')](_0x4b983a,function(_0x144f71){return db[_0xdfdd('0x56')]['findOrCreate']({'where':{'UserId':_0x144f71['id'],'OpenchannelQueueId':_0x2bd8fc[_0xdfdd('0x52')]['id']},'transaction':_0x29487c});});})[_0xdfdd('0x25')](function(){_0x4b983a[_0xdfdd('0x6c')](function(_0x10e39a){socket[_0xdfdd('0x6d')](_0xdfdd('0x6e'),{'UserId':_0x10e39a['id'],'OpenchannelQueueId':_0xcc5224['id']});});});});});}})[_0xdfdd('0x25')](respondWithStatusCode(_0x54eb15,null))[_0xdfdd('0x45')](handleError(_0x54eb15,null));};exports['removeTeams']=function(_0x592037,_0x8b5814,_0x5ae529){return db['Team'][_0xdfdd('0x43')]({'where':{'id':_0x592037[_0xdfdd('0x32')][_0xdfdd('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xdfdd('0x64')],'as':_0xdfdd('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x8b5814,null))[_0xdfdd('0x25')](function(_0x5f562b){var _0x5e8f2e=_[_0xdfdd('0x31')](_0x5f562b,'id');var _0x2cd485=[];var _0x31da6d=[];var _0x4654b7=squel['select']();_0x4654b7[_0xdfdd('0x70')]('tq.TeamId')[_0xdfdd('0x71')](_0xdfdd('0x72'),'tq')[_0xdfdd('0x73')]('user_has_teams','ut',_0xdfdd('0x74'))[_0xdfdd('0x3e')](_0xdfdd('0x75'),_0x592037['params']['id']);for(var _0x17c4ef=0x0;_0x17c4ef<_0x5f562b[_0xdfdd('0x39')];_0x17c4ef+=0x1){let _0x227a53=_0x5f562b[_0x17c4ef];for(var _0x2f2f86=0x0;_0x2f2f86<_0x227a53[_0xdfdd('0x69')]['length'];_0x2f2f86+=0x1){let _0x3090f5=_0x227a53['Agents'][_0x2f2f86];var _0x2a2973=_0x4654b7[_0xdfdd('0x76')]();_0x2a2973[_0xdfdd('0x3e')](_0xdfdd('0x77'),_0x3090f5['id']);_0x31da6d[_0xdfdd('0x78')](db[_0xdfdd('0x79')][_0xdfdd('0x32')](_0x2a2973[_0xdfdd('0x7a')](),{'type':db[_0xdfdd('0x79')][_0xdfdd('0x7b')]['SELECT']})['then'](function(_0x1ebd2f){if(_0x1ebd2f[_0xdfdd('0x39')]===0x1){return _0x3090f5['id'];}else{var _0x522eb5=_[_0xdfdd('0x7c')](_[_0xdfdd('0x31')](_0x1ebd2f,_0xdfdd('0x7d')),function(_0xb72e45){return _['includes'](_0x5e8f2e,_0xb72e45);});if(_0x522eb5){return _0x3090f5['id'];}}}));}}return BPromise['all'](_0x31da6d)['then'](function(_0x33da0e){_0x2cd485=_(_0x2cd485)[_0xdfdd('0x7e')](_0x33da0e)[_0xdfdd('0x7f')]()[_0xdfdd('0x80')]();return db[_0xdfdd('0x2d')][_0xdfdd('0x48')]({'where':{'id':_0x592037[_0xdfdd('0x52')]['id']}})[_0xdfdd('0x25')](function(_0x513ec7){return db['sequelize'][_0xdfdd('0x6a')](function(_0x50438e){return _0x513ec7[_0xdfdd('0x81')](_0x592037[_0xdfdd('0x32')][_0xdfdd('0x6f')],{'transaction':_0x50438e})[_0xdfdd('0x25')](function(){if(!_[_0xdfdd('0x82')](_0x2cd485)){return _0x513ec7[_0xdfdd('0x83')](_0x2cd485,{'transaction':_0x50438e});}})[_0xdfdd('0x25')](function(){_0x2cd485[_0xdfdd('0x6c')](function(_0x210622){socket['emit'](_0xdfdd('0x84'),{'UserId':_0x210622,'OpenchannelQueueId':_0x513ec7['id']});});});});});});})['then'](respondWithStatusCode(_0x8b5814,null))[_0xdfdd('0x45')](handleError(_0x8b5814,null));};exports[_0xdfdd('0x85')]=function(_0x32b569,_0x54d640,_0x55fb61){return db['OpenchannelQueue']['find']({'where':{'id':_0x32b569[_0xdfdd('0x52')]['id']}})['then'](handleEntityNotFound(_0x54d640,null))[_0xdfdd('0x25')](function(_0x1a7cca){if(_0x1a7cca){return _0x1a7cca['addAgents'](_0x32b569['body'][_0xdfdd('0x6f')],_[_0xdfdd('0x86')](_0x32b569[_0xdfdd('0x4a')],[_0xdfdd('0x6f'),'id'])||{})[_0xdfdd('0x87')](function(_0x331c88){for(var _0x3a4c02=0x0;_0x3a4c02<_0x32b569[_0xdfdd('0x4a')][_0xdfdd('0x6f')][_0xdfdd('0x39')];_0x3a4c02+=0x1){socket[_0xdfdd('0x6d')](_0xdfdd('0x6e'),{'UserId':Number(_0x32b569[_0xdfdd('0x4a')][_0xdfdd('0x6f')][_0x3a4c02]),'OpenchannelQueueId':Number(_0x32b569[_0xdfdd('0x52')]['id'])});}return _0x331c88;});}})['then'](respondWithResult(_0x54d640,null))[_0xdfdd('0x45')](handleError(_0x54d640,null));};exports[_0xdfdd('0x83')]=function(_0x10e721,_0x521835,_0x5eb463){return db['OpenchannelQueue'][_0xdfdd('0x48')]({'where':{'id':_0x10e721['params']['id']}})[_0xdfdd('0x25')](handleEntityNotFound(_0x521835,null))[_0xdfdd('0x25')](function(_0x2403bc){if(_0x2403bc){return _0x2403bc[_0xdfdd('0x83')](_0x10e721['query'][_0xdfdd('0x6f')])[_0xdfdd('0x25')](function(){if(_[_0xdfdd('0x88')](_0x10e721[_0xdfdd('0x32')][_0xdfdd('0x6f')])){for(var _0x2f01bc=0x0;_0x2f01bc<_0x10e721['query'][_0xdfdd('0x6f')]['length'];_0x2f01bc+=0x1){socket[_0xdfdd('0x6d')](_0xdfdd('0x84'),{'UserId':Number(_0x10e721[_0xdfdd('0x32')][_0xdfdd('0x6f')][_0x2f01bc]),'OpenchannelQueueId':Number(_0x10e721[_0xdfdd('0x52')]['id'])});}}else{socket[_0xdfdd('0x6d')](_0xdfdd('0x84'),{'UserId':Number(_0x10e721[_0xdfdd('0x32')][_0xdfdd('0x6f')]),'OpenchannelQueueId':Number(_0x10e721['params']['id'])});}});}})[_0xdfdd('0x25')](respondWithStatusCode(_0x521835,null))[_0xdfdd('0x45')](handleError(_0x521835,null));};exports['getAgents']=function(_0x2e37eb,_0x3ea7b0,_0x404a0b){var _0x1e9334={};var _0x5a166c={};var _0x98cfaf;var _0x19728c;return db[_0xdfdd('0x2d')][_0xdfdd('0x55')]({'where':{'id':_0x2e37eb[_0xdfdd('0x52')]['id']}})[_0xdfdd('0x25')](handleEntityNotFound(_0x3ea7b0,null))[_0xdfdd('0x25')](function(_0x3ddceb){if(_0x3ddceb){_0x98cfaf=_0x3ddceb;_0x5a166c['model']=_['keys'](db[_0xdfdd('0x64')]['rawAttributes']);_0x5a166c[_0xdfdd('0x32')]=_['keys'](_0x2e37eb[_0xdfdd('0x32')]);_0x5a166c['filters']=_[_0xdfdd('0x36')](_0x5a166c[_0xdfdd('0x35')],_0x5a166c['query']);_0x1e9334['attributes']=_['intersection'](_0x5a166c[_0xdfdd('0x35')],qs['fields'](_0x2e37eb[_0xdfdd('0x32')]['fields']));_0x1e9334[_0xdfdd('0x38')]=_0x1e9334['attributes'][_0xdfdd('0x39')]?_0x1e9334['attributes']:_0x5a166c[_0xdfdd('0x35')];_0x1e9334[_0xdfdd('0x3c')]=qs[_0xdfdd('0x3d')](_0x2e37eb[_0xdfdd('0x32')][_0xdfdd('0x3d')]);_0x1e9334[_0xdfdd('0x3e')]=qs[_0xdfdd('0x34')](_['pick'](_0x2e37eb[_0xdfdd('0x32')],_0x5a166c[_0xdfdd('0x34')]));if(_0x2e37eb[_0xdfdd('0x32')]['filter']){_0x1e9334['where']=_[_0xdfdd('0x3f')](_0x1e9334[_0xdfdd('0x3e')],{'$or':_[_0xdfdd('0x31')](_0x1e9334[_0xdfdd('0x38')],function(_0x568299){var _0x34393c={};_0x34393c[_0x568299]={'$like':'%'+_0x2e37eb[_0xdfdd('0x32')]['filter']+'%'};return _0x34393c;})});}_0x1e9334=_[_0xdfdd('0x3f')]({},_0x1e9334,_0x2e37eb['options']);return _0x98cfaf['getAgents'](_0x1e9334);}})['then'](function(_0x881681){if(_0x881681){_0x19728c=_0x881681[_0xdfdd('0x39')];if(!_0x2e37eb['query'][_0xdfdd('0x3a')]('nolimit')){_0x1e9334[_0xdfdd('0x3b')]=qs['limit'](_0x2e37eb[_0xdfdd('0x32')][_0xdfdd('0x3b')]);_0x1e9334[_0xdfdd('0x1f')]=qs[_0xdfdd('0x1f')](_0x2e37eb['query'][_0xdfdd('0x1f')]);}return _0x98cfaf['getAgents'](_0x1e9334);}})['then'](function(_0x2f70f0){if(_0x2f70f0){return _0x2f70f0?{'count':_0x19728c,'rows':_0x2f70f0}:null;}})[_0xdfdd('0x25')](respondWithResult(_0x3ea7b0,null))[_0xdfdd('0x45')](handleError(_0x3ea7b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 5cd7b6d..4a8e6bb 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 _0x3294=['emit','hook','events','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x4b4154,_0x38a122){var _0x340ed7=function(_0x1250b9){while(--_0x1250b9){_0x4b4154['push'](_0x4b4154['shift']());}};_0x340ed7(++_0x38a122);}(_0x3294,0x172));var _0x4329=function(_0x4d3bfb,_0x7baca8){_0x4d3bfb=_0x4d3bfb-0x0;var _0x330929=_0x3294[_0x4d3bfb];return _0x330929;};'use strict';var EventEmitter=require(_0x4329('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x4329('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4329('0x2')](0x0);var events={'afterCreate':_0x4329('0x3'),'afterUpdate':_0x4329('0x4'),'afterDestroy':_0x4329('0x5')};function emitEvent(_0x368c47){return function(_0x53ef7d,_0x4e9c0c,_0x12b38f){OpenchannelQueueEvents[_0x4329('0x6')](_0x368c47+':'+_0x53ef7d['id'],_0x53ef7d);OpenchannelQueueEvents[_0x4329('0x6')](_0x368c47,_0x53ef7d);_0x12b38f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4329('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x851a=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x1a3cf5,_0x4b17da){var _0x182c4c=function(_0x2ce275){while(--_0x2ce275){_0x1a3cf5['push'](_0x1a3cf5['shift']());}};_0x182c4c(++_0x4b17da);}(_0x851a,0x125));var _0xa851=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x851a[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0xa851('0x0'));var OpenchannelQueue=require(_0xa851('0x1'))['db'][_0xa851('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa851('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa851('0x4'),'afterDestroy':_0xa851('0x5')};function emitEvent(_0x49824d){return function(_0x50fe88,_0x5d26cb,_0x2aa318){OpenchannelQueueEvents[_0xa851('0x6')](_0x49824d+':'+_0x50fe88['id'],_0x50fe88);OpenchannelQueueEvents[_0xa851('0x6')](_0x49824d,_0x50fe88);_0x2aa318(null);};}for(var e in events){if(events[_0xa851('0x7')](e)){var event=events[e];OpenchannelQueue[_0xa851('0x8')](e,emitEvent(event));}}module[_0xa851('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index eafea48..64fec7c 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 _0x935c=['api','bluebird','request-promise','path','../../config/environment','exports','OpenchannelQueue','lodash','util','../../config/logger'];(function(_0x5265d5,_0x51a837){var _0x44899d=function(_0x13d39b){while(--_0x13d39b){_0x5265d5['push'](_0x5265d5['shift']());}};_0x44899d(++_0x51a837);}(_0x935c,0x115));var _0xc935=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x935c[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xc935('0x0'));var util=require(_0xc935('0x1'));var logger=require(_0xc935('0x2'))(_0xc935('0x3'));var moment=require('moment');var BPromise=require(_0xc935('0x4'));var rp=require(_0xc935('0x5'));var fs=require('fs');var path=require(_0xc935('0x6'));var rimraf=require('rimraf');var config=require(_0xc935('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0xc935('0x8')]=function(_0x10fe52,_0x59bc51){return _0x10fe52['define'](_0xc935('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00fc=['openchannel_queues','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x55913b,_0x5e7078){var _0x55cf8d=function(_0x56d652){while(--_0x56d652){_0x55913b['push'](_0x55913b['shift']());}};_0x55cf8d(++_0x5e7078);}(_0x00fc,0x1b1));var _0xc00f=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x00fc[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0xc00f('0x0'));var logger=require(_0xc00f('0x1'))('api');var moment=require(_0xc00f('0x2'));var BPromise=require('bluebird');var rp=require(_0xc00f('0x3'));var fs=require('fs');var path=require(_0xc00f('0x4'));var rimraf=require(_0xc00f('0x5'));var config=require(_0xc00f('0x6'));var attributes=require(_0xc00f('0x7'));module[_0xc00f('0x8')]=function(_0x81e410,_0xbe1619){return _0x81e410[_0xc00f('0x9')](_0xc00f('0xa'),attributes,{'tableName':_0xc00f('0xb'),'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 2282577..e9afd5b 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 _0xde85=['options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','OpenchannelQueue'];(function(_0x4260d0,_0x73ac34){var _0x5f34c2=function(_0x1c28ca){while(--_0x1c28ca){_0x4260d0['push'](_0x4260d0['shift']());}};_0x5f34c2(++_0x73ac34);}(_0xde85,0x101));var _0x5de8=function(_0x4a5f2c,_0x436f6c){_0x4a5f2c=_0x4a5f2c-0x0;var _0x2a99ba=_0xde85[_0x4a5f2c];return _0x2a99ba;};'use strict';var _=require(_0x5de8('0x0'));var util=require(_0x5de8('0x1'));var moment=require(_0x5de8('0x2'));var BPromise=require(_0x5de8('0x3'));var rs=require(_0x5de8('0x4'));var fs=require('fs');var Redis=require(_0x5de8('0x5'));var db=require(_0x5de8('0x6'))['db'];var utils=require(_0x5de8('0x7'));var logger=require(_0x5de8('0x8'))(_0x5de8('0x9'));var config=require(_0x5de8('0xa'));var jayson=require(_0x5de8('0xb'));var client=jayson[_0x5de8('0xc')][_0x5de8('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5de8('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x5de8('0xf'))(new Redis(config['redis']));require(_0x5de8('0x10'))[_0x5de8('0x11')](socket);function respondWithRpcPromise(_0x22a870,_0x13f560,_0x5bd2ef){return new BPromise(function(_0x11889f,_0x3161c9){return client[_0x5de8('0x12')](_0x22a870,_0x5bd2ef)[_0x5de8('0x13')](function(_0x3c775a){logger[_0x5de8('0x14')](_0x5de8('0x15'),_0x13f560,_0x5de8('0x16'));logger[_0x5de8('0x17')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x13f560,_0x5de8('0x16'),JSON[_0x5de8('0x18')](_0x3c775a));if(_0x3c775a[_0x5de8('0x19')]){if(_0x3c775a[_0x5de8('0x19')]['code']===0x1f4){logger[_0x5de8('0x19')](_0x5de8('0x15'),_0x13f560,_0x3c775a[_0x5de8('0x19')][_0x5de8('0x1a')]);return _0x3161c9(_0x3c775a['error'][_0x5de8('0x1a')]);}logger['error'](_0x5de8('0x15'),_0x13f560,_0x3c775a['error'][_0x5de8('0x1a')]);return _0x11889f(_0x3c775a[_0x5de8('0x19')][_0x5de8('0x1a')]);}else{logger['info'](_0x5de8('0x15'),_0x13f560,_0x5de8('0x16'));_0x11889f(_0x3c775a[_0x5de8('0x1b')]['message']);}})[_0x5de8('0x1c')](function(_0x539dc9){logger[_0x5de8('0x19')](_0x5de8('0x15'),_0x13f560,_0x539dc9);_0x3161c9(_0x539dc9);});});}exports['GetOpenchannelQueue']=function(_0x1cbbf4){var _0x53ab4c=this;return new Promise(function(_0x1b596d,_0x33d33c){return db[_0x5de8('0x1d')]['findAll']({'raw':_0x1cbbf4['options']?_0x1cbbf4[_0x5de8('0x1e')][_0x5de8('0x1f')]===undefined?!![]:![]:!![],'where':_0x1cbbf4[_0x5de8('0x1e')]?_0x1cbbf4[_0x5de8('0x1e')][_0x5de8('0x20')]||null:null,'attributes':_0x1cbbf4[_0x5de8('0x1e')]?_0x1cbbf4['options'][_0x5de8('0x21')]||null:null,'limit':_0x1cbbf4['options']?_0x1cbbf4[_0x5de8('0x1e')][_0x5de8('0x22')]||null:null,'include':_0x1cbbf4[_0x5de8('0x1e')]?_0x1cbbf4[_0x5de8('0x1e')][_0x5de8('0x23')]?_[_0x5de8('0x24')](_0x1cbbf4[_0x5de8('0x1e')][_0x5de8('0x23')],function(_0x55cfc6){return{'model':db[_0x55cfc6['model']],'as':_0x55cfc6['as'],'attributes':_0x55cfc6[_0x5de8('0x21')],'include':_0x55cfc6[_0x5de8('0x23')]?_[_0x5de8('0x24')](_0x55cfc6[_0x5de8('0x23')],function(_0x3b1663){return{'model':db[_0x3b1663['model']],'as':_0x3b1663['as'],'attributes':_0x3b1663[_0x5de8('0x21')],'include':_0x3b1663[_0x5de8('0x23')]?_[_0x5de8('0x24')](_0x3b1663[_0x5de8('0x23')],function(_0x54cec7){return{'model':db[_0x54cec7[_0x5de8('0x25')]],'as':_0x54cec7['as'],'attributes':_0x54cec7[_0x5de8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5de8('0x13')](function(_0x2d8034){logger[_0x5de8('0x14')](_0x5de8('0x26'),_0x1cbbf4);logger[_0x5de8('0x17')](_0x5de8('0x26'),_0x1cbbf4,JSON[_0x5de8('0x18')](_0x2d8034));_0x1b596d(_0x2d8034);})['catch'](function(_0x4ab27a){logger[_0x5de8('0x19')](_0x5de8('0x26'),_0x4ab27a[_0x5de8('0x1a')],_0x1cbbf4);_0x33d33c(_0x53ab4c[_0x5de8('0x19')](0x1f4,_0x4ab27a['message']));});});};exports[_0x5de8('0x27')]=function(_0x267417){var _0x3db79b=this;return new Promise(function(_0x3626a7,_0x24b833){return db[_0x5de8('0x1d')][_0x5de8('0x28')]({'raw':_0x267417[_0x5de8('0x1e')]?_0x267417[_0x5de8('0x1e')][_0x5de8('0x1f')]===undefined?!![]:![]:!![],'where':_0x267417[_0x5de8('0x1e')]?_0x267417['options'][_0x5de8('0x20')]||null:null,'attributes':_0x267417[_0x5de8('0x1e')]?_0x267417[_0x5de8('0x1e')][_0x5de8('0x21')]||null:null,'include':_0x267417[_0x5de8('0x1e')]?_0x267417[_0x5de8('0x1e')]['include']?_[_0x5de8('0x24')](_0x267417['options']['include'],function(_0x3b9383){return{'model':db[_0x3b9383[_0x5de8('0x25')]],'as':_0x3b9383['as'],'attributes':_0x3b9383['attributes'],'include':_0x3b9383[_0x5de8('0x23')]?_[_0x5de8('0x24')](_0x3b9383['include'],function(_0x39ea32){return{'model':db[_0x39ea32['model']],'as':_0x39ea32['as'],'attributes':_0x39ea32[_0x5de8('0x21')],'include':_0x39ea32['include']?_[_0x5de8('0x24')](_0x39ea32[_0x5de8('0x23')],function(_0x2117b7){return{'model':db[_0x2117b7[_0x5de8('0x25')]],'as':_0x2117b7['as'],'attributes':_0x2117b7[_0x5de8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5de8('0x13')](function(_0x4698cd){logger[_0x5de8('0x14')](_0x5de8('0x27'),_0x267417);logger[_0x5de8('0x17')]('ShowOpenchannelQueue',_0x267417,JSON[_0x5de8('0x18')](_0x4698cd));_0x3626a7(_0x4698cd);})['catch'](function(_0x4ec9bd){logger[_0x5de8('0x19')](_0x5de8('0x27'),_0x4ec9bd[_0x5de8('0x1a')],_0x267417);_0x24b833(_0x3db79b[_0x5de8('0x19')](0x1f4,_0x4ec9bd[_0x5de8('0x1a')]));});});}; \ No newline at end of file +var _0xce93=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','limit','map','model','attributes','include','then','ShowOpenchannelQueue','find'];(function(_0x263553,_0x194e2b){var _0x44e408=function(_0x5bd538){while(--_0x5bd538){_0x263553['push'](_0x263553['shift']());}};_0x44e408(++_0x194e2b);}(_0xce93,0x160));var _0x3ce9=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0xce93[_0x148c09];return _0x18e613;};'use strict';var _=require(_0x3ce9('0x0'));var util=require(_0x3ce9('0x1'));var moment=require(_0x3ce9('0x2'));var BPromise=require(_0x3ce9('0x3'));var rs=require(_0x3ce9('0x4'));var fs=require('fs');var Redis=require(_0x3ce9('0x5'));var db=require(_0x3ce9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3ce9('0x7'));var config=require(_0x3ce9('0x8'));var jayson=require(_0x3ce9('0x9'));var client=jayson[_0x3ce9('0xa')]['http']({'port':0x232a});config[_0x3ce9('0xb')]=_[_0x3ce9('0xc')](config['redis'],{'host':_0x3ce9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ce9('0xb')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x46534d,_0xa16814,_0xb3b75e){return new BPromise(function(_0x4687e0,_0x10bab4){return client[_0x3ce9('0xe')](_0x46534d,_0xb3b75e)['then'](function(_0x4fddbe){logger[_0x3ce9('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0xa16814,'request\x20sent');logger[_0x3ce9('0x10')](_0x3ce9('0x11'),_0xa16814,_0x3ce9('0x12'),JSON[_0x3ce9('0x13')](_0x4fddbe));if(_0x4fddbe[_0x3ce9('0x14')]){if(_0x4fddbe[_0x3ce9('0x14')][_0x3ce9('0x15')]===0x1f4){logger[_0x3ce9('0x14')](_0x3ce9('0x16'),_0xa16814,_0x4fddbe[_0x3ce9('0x14')]['message']);return _0x10bab4(_0x4fddbe[_0x3ce9('0x14')][_0x3ce9('0x17')]);}logger[_0x3ce9('0x14')](_0x3ce9('0x16'),_0xa16814,_0x4fddbe[_0x3ce9('0x14')][_0x3ce9('0x17')]);return _0x4687e0(_0x4fddbe[_0x3ce9('0x14')][_0x3ce9('0x17')]);}else{logger[_0x3ce9('0xf')](_0x3ce9('0x16'),_0xa16814,_0x3ce9('0x12'));_0x4687e0(_0x4fddbe[_0x3ce9('0x18')]['message']);}})[_0x3ce9('0x19')](function(_0x460c31){logger[_0x3ce9('0x14')](_0x3ce9('0x16'),_0xa16814,_0x460c31);_0x10bab4(_0x460c31);});});}exports[_0x3ce9('0x1a')]=function(_0x13b800){var _0x27dfd8=this;return new Promise(function(_0x51965f,_0x154812){return db[_0x3ce9('0x1b')][_0x3ce9('0x1c')]({'raw':_0x13b800[_0x3ce9('0x1d')]?_0x13b800['options']['raw']===undefined?!![]:![]:!![],'where':_0x13b800[_0x3ce9('0x1d')]?_0x13b800['options']['where']||null:null,'attributes':_0x13b800[_0x3ce9('0x1d')]?_0x13b800[_0x3ce9('0x1d')]['attributes']||null:null,'limit':_0x13b800['options']?_0x13b800[_0x3ce9('0x1d')][_0x3ce9('0x1e')]||null:null,'include':_0x13b800['options']?_0x13b800[_0x3ce9('0x1d')]['include']?_[_0x3ce9('0x1f')](_0x13b800[_0x3ce9('0x1d')]['include'],function(_0x39135a){return{'model':db[_0x39135a[_0x3ce9('0x20')]],'as':_0x39135a['as'],'attributes':_0x39135a[_0x3ce9('0x21')],'include':_0x39135a[_0x3ce9('0x22')]?_['map'](_0x39135a[_0x3ce9('0x22')],function(_0x2bd607){return{'model':db[_0x2bd607['model']],'as':_0x2bd607['as'],'attributes':_0x2bd607[_0x3ce9('0x21')],'include':_0x2bd607[_0x3ce9('0x22')]?_[_0x3ce9('0x1f')](_0x2bd607[_0x3ce9('0x22')],function(_0x216712){return{'model':db[_0x216712['model']],'as':_0x216712['as'],'attributes':_0x216712['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ce9('0x23')](function(_0x129307){logger[_0x3ce9('0xf')](_0x3ce9('0x1a'),_0x13b800);logger[_0x3ce9('0x10')](_0x3ce9('0x1a'),_0x13b800,JSON[_0x3ce9('0x13')](_0x129307));_0x51965f(_0x129307);})[_0x3ce9('0x19')](function(_0x2e4c74){logger[_0x3ce9('0x14')]('GetOpenchannelQueue',_0x2e4c74[_0x3ce9('0x17')],_0x13b800);_0x154812(_0x27dfd8[_0x3ce9('0x14')](0x1f4,_0x2e4c74[_0x3ce9('0x17')]));});});};exports[_0x3ce9('0x24')]=function(_0x8c97f5){var _0xb40788=this;return new Promise(function(_0x5643b5,_0x1f1cf2){return db[_0x3ce9('0x1b')][_0x3ce9('0x25')]({'raw':_0x8c97f5['options']?_0x8c97f5[_0x3ce9('0x1d')][_0x3ce9('0x26')]===undefined?!![]:![]:!![],'where':_0x8c97f5['options']?_0x8c97f5[_0x3ce9('0x1d')]['where']||null:null,'attributes':_0x8c97f5[_0x3ce9('0x1d')]?_0x8c97f5[_0x3ce9('0x1d')][_0x3ce9('0x21')]||null:null,'include':_0x8c97f5[_0x3ce9('0x1d')]?_0x8c97f5[_0x3ce9('0x1d')][_0x3ce9('0x22')]?_['map'](_0x8c97f5[_0x3ce9('0x1d')][_0x3ce9('0x22')],function(_0x471479){return{'model':db[_0x471479[_0x3ce9('0x20')]],'as':_0x471479['as'],'attributes':_0x471479[_0x3ce9('0x21')],'include':_0x471479[_0x3ce9('0x22')]?_[_0x3ce9('0x1f')](_0x471479[_0x3ce9('0x22')],function(_0x4dbde3){return{'model':db[_0x4dbde3[_0x3ce9('0x20')]],'as':_0x4dbde3['as'],'attributes':_0x4dbde3['attributes'],'include':_0x4dbde3[_0x3ce9('0x22')]?_[_0x3ce9('0x1f')](_0x4dbde3[_0x3ce9('0x22')],function(_0x1ccef7){return{'model':db[_0x1ccef7[_0x3ce9('0x20')]],'as':_0x1ccef7['as'],'attributes':_0x1ccef7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ce9('0x23')](function(_0x222aeb){logger[_0x3ce9('0xf')](_0x3ce9('0x24'),_0x8c97f5);logger[_0x3ce9('0x10')](_0x3ce9('0x24'),_0x8c97f5,JSON[_0x3ce9('0x13')](_0x222aeb));_0x5643b5(_0x222aeb);})[_0x3ce9('0x19')](function(_0x10d868){logger[_0x3ce9('0x14')](_0x3ce9('0x24'),_0x10d868[_0x3ce9('0x17')],_0x8c97f5);_0x1f1cf2(_0xb40788[_0x3ce9('0x14')](0x1f4,_0x10d868[_0x3ce9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 59607e9..dcb1ef2 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 _0xf971=['./openchannelQueue.events','remove','emit','removeListener','register','length'];(function(_0x405f77,_0x39cfad){var _0x293250=function(_0x2b0544){while(--_0x2b0544){_0x405f77['push'](_0x405f77['shift']());}};_0x293250(++_0x39cfad);}(_0xf971,0x114));var _0x1f97=function(_0x1576a6,_0x3afc2e){_0x1576a6=_0x1576a6-0x0;var _0x5eba93=_0xf971[_0x1576a6];return _0x5eba93;};'use strict';var OpenchannelQueueEvents=require(_0x1f97('0x0'));var events=['save',_0x1f97('0x1'),'update'];function createListener(_0x578440,_0x18f5b8){return function(_0x209c59){_0x18f5b8[_0x1f97('0x2')](_0x578440,_0x209c59);};}function removeListener(_0x4cfb90,_0x339d31){return function(){OpenchannelQueueEvents[_0x1f97('0x3')](_0x4cfb90,_0x339d31);};}exports[_0x1f97('0x4')]=function(_0x68fd14){for(var _0x2d77e3=0x0,_0x173077=events[_0x1f97('0x5')];_0x2d77e3<_0x173077;_0x2d77e3++){var _0x3f271d=events[_0x2d77e3];var _0x4c27da=createListener('openchannelQueue:'+_0x3f271d,_0x68fd14);OpenchannelQueueEvents['on'](_0x3f271d,_0x4c27da);}}; \ No newline at end of file +var _0x15cd=['emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','remove','update'];(function(_0x4aa99d,_0x3511ab){var _0x18ed98=function(_0x35a2e4){while(--_0x35a2e4){_0x4aa99d['push'](_0x4aa99d['shift']());}};_0x18ed98(++_0x3511ab);}(_0x15cd,0x138));var _0xd15c=function(_0x325a08,_0x571fff){_0x325a08=_0x325a08-0x0;var _0x436e01=_0x15cd[_0x325a08];return _0x436e01;};'use strict';var OpenchannelQueueEvents=require(_0xd15c('0x0'));var events=['save',_0xd15c('0x1'),_0xd15c('0x2')];function createListener(_0x2bc0dd,_0x2c8d99){return function(_0x39ed09){_0x2c8d99[_0xd15c('0x3')](_0x2bc0dd,_0x39ed09);};}function removeListener(_0x5c9318,_0x123fac){return function(){OpenchannelQueueEvents[_0xd15c('0x4')](_0x5c9318,_0x123fac);};}exports['register']=function(_0x5e32f0){for(var _0xf286fc=0x0,_0x1724c3=events[_0xd15c('0x5')];_0xf286fc<_0x1724c3;_0xf286fc++){var _0x4de167=events[_0xf286fc];var _0x4e4d75=createListener(_0xd15c('0x6')+_0x4de167,_0x5e32f0);OpenchannelQueueEvents['on'](_0x4de167,_0x4e4d75);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f60f5f0..18a15b3 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 _0x7641=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3efc22,_0x27b8c8){var _0x413389=function(_0x579963){while(--_0x579963){_0x3efc22['push'](_0x3efc22['shift']());}};_0x413389(++_0x27b8c8);}(_0x7641,0x188));var _0x1764=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x7641[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1764('0x0'));var timeout=require(_0x1764('0x1'));var express=require(_0x1764('0x2'));var router=express[_0x1764('0x3')]();var fs_extra=require(_0x1764('0x4'));var auth=require(_0x1764('0x5'));var interaction=require(_0x1764('0x6'));var config=require(_0x1764('0x7'));var controller=require(_0x1764('0x8'));router[_0x1764('0x9')]('/',auth[_0x1764('0xa')](),controller[_0x1764('0xb')]);router['get']('/describe',auth[_0x1764('0xa')](),controller[_0x1764('0xc')]);router[_0x1764('0x9')](_0x1764('0xd'),auth[_0x1764('0xa')](),controller['show']);router[_0x1764('0xe')]('/',auth['isAuthenticated'](),controller[_0x1764('0xf')]);router[_0x1764('0x10')]('/:id',auth[_0x1764('0xa')](),controller[_0x1764('0x11')]);router[_0x1764('0x12')](_0x1764('0xd'),auth[_0x1764('0xa')](),controller[_0x1764('0x13')]);module[_0x1764('0x14')]=router; \ No newline at end of file +var _0x9f8a=['show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x2eaa03,_0x300922){var _0x8a0b78=function(_0x2d1204){while(--_0x2d1204){_0x2eaa03['push'](_0x2eaa03['shift']());}};_0x8a0b78(++_0x300922);}(_0x9f8a,0x196));var _0xa9f8=function(_0x3de4c5,_0x43c1c2){_0x3de4c5=_0x3de4c5-0x0;var _0x1bcc83=_0x9f8a[_0x3de4c5];return _0x1bcc83;};'use strict';var multer=require(_0xa9f8('0x0'));var util=require(_0xa9f8('0x1'));var path=require(_0xa9f8('0x2'));var timeout=require(_0xa9f8('0x3'));var express=require('express');var router=express[_0xa9f8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa9f8('0x5'));var config=require(_0xa9f8('0x6'));var controller=require(_0xa9f8('0x7'));router['get']('/',auth[_0xa9f8('0x8')](),controller[_0xa9f8('0x9')]);router[_0xa9f8('0xa')](_0xa9f8('0xb'),auth[_0xa9f8('0x8')](),controller[_0xa9f8('0xc')]);router[_0xa9f8('0xa')](_0xa9f8('0xd'),auth[_0xa9f8('0x8')](),controller[_0xa9f8('0xe')]);router['post']('/',auth[_0xa9f8('0x8')](),controller[_0xa9f8('0xf')]);router[_0xa9f8('0x10')](_0xa9f8('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa9f8('0x11')](_0xa9f8('0xd'),auth['isAuthenticated'](),controller[_0xa9f8('0x12')]);module[_0xa9f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 6a4bab5..d3e0d2e 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 _0x10bf=['exports','STRING','DATE'];(function(_0x1e5db8,_0x44ef41){var _0x219a51=function(_0x5b86a3){while(--_0x5b86a3){_0x1e5db8['push'](_0x1e5db8['shift']());}};_0x219a51(++_0x44ef41);}(_0x10bf,0x195));var _0xf10b=function(_0x448c09,_0x40cacc){_0x448c09=_0x448c09-0x0;var _0x3825cd=_0x10bf[_0x448c09];return _0x3825cd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xf10b('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf10b('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf10b('0x2')]},'exitAt':{'type':Sequelize[_0xf10b('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c63=['sequelize','STRING','DATE'];(function(_0x38fb6d,_0x2c0448){var _0x4c1034=function(_0x20aab6){while(--_0x20aab6){_0x38fb6d['push'](_0x38fb6d['shift']());}};_0x4c1034(++_0x2c0448);}(_0x9c63,0x7e));var _0x39c6=function(_0x3b1707,_0xed3f38){_0x3b1707=_0x3b1707-0x0;var _0x3b3d0e=_0x9c63[_0x3b1707];return _0x3b3d0e;};'use strict';var moment=require('moment');var Sequelize=require(_0x39c6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x39c6('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x39c6('0x1')]},'joinAt':{'type':Sequelize[_0x39c6('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x39c6('0x2')]},'exitAt':{'type':Sequelize[_0x39c6('0x2')]},'reason':{'type':Sequelize[_0x39c6('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2e46996..f010523 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 _0x5d0f=['name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','stack'];(function(_0x5b35cb,_0xa2c5b9){var _0x1a1da8=function(_0xf40c3a){while(--_0xf40c3a){_0x5b35cb['push'](_0x5b35cb['shift']());}};_0x1a1da8(++_0xa2c5b9);}(_0x5d0f,0x1d8));var _0xf5d0=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0x5d0f[_0x1c6089];return _0x4d97c1;};'use strict';var emlformat=require(_0xf5d0('0x0'));var rimraf=require(_0xf5d0('0x1'));var zipdir=require(_0xf5d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5d0('0x3'));var moment=require(_0xf5d0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf5d0('0x5'));var path=require(_0xf5d0('0x6'));var sox=require(_0xf5d0('0x7'));var csv=require(_0xf5d0('0x8'));var ejs=require(_0xf5d0('0x9'));var fs=require('fs');var fs_extra=require(_0xf5d0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf5d0('0xb'));var deskjs=require(_0xf5d0('0xc'));var toCsv=require(_0xf5d0('0x8'));var querystring=require(_0xf5d0('0xd'));var Papa=require(_0xf5d0('0xe'));var Redis=require(_0xf5d0('0xf'));var authService=require(_0xf5d0('0x10'));var qs=require(_0xf5d0('0x11'));var as=require(_0xf5d0('0x12'));var hardwareService=require(_0xf5d0('0x13'));var logger=require(_0xf5d0('0x14'))('api');var utils=require(_0xf5d0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf5d0('0x16'))['db'];function respondWithStatusCode(_0x35b141,_0x5a9d04){_0x5a9d04=_0x5a9d04||0xcc;return function(_0x541b08){if(_0x541b08){return _0x35b141[_0xf5d0('0x17')](_0x5a9d04);}return _0x35b141[_0xf5d0('0x18')](_0x5a9d04)['end']();};}function respondWithResult(_0x46ed06,_0x2a85a2){_0x2a85a2=_0x2a85a2||0xc8;return function(_0xab4ce4){if(_0xab4ce4){return _0x46ed06[_0xf5d0('0x18')](_0x2a85a2)[_0xf5d0('0x19')](_0xab4ce4);}};}function respondWithFilteredResult(_0x5d9c84,_0x30052b){return function(_0x264f28){if(_0x264f28){var _0xea2b9e=typeof _0x30052b[_0xf5d0('0x1a')]==='undefined'&&typeof _0x30052b[_0xf5d0('0x1b')]===_0xf5d0('0x1c');var _0x1a738b=_0x264f28[_0xf5d0('0x1d')];var _0x1136b7=_0xea2b9e?0x0:_0x30052b[_0xf5d0('0x1a')];var _0x13e8f9=_0xea2b9e?_0x264f28[_0xf5d0('0x1d')]:_0x30052b['offset']+_0x30052b[_0xf5d0('0x1b')];var _0x1f59ea;if(_0x13e8f9>=_0x1a738b){_0x13e8f9=_0x1a738b;_0x1f59ea=0xc8;}else{_0x1f59ea=0xce;}_0x5d9c84['status'](_0x1f59ea);return _0x5d9c84[_0xf5d0('0x1e')](_0xf5d0('0x1f'),_0x1136b7+'-'+_0x13e8f9+'/'+_0x1a738b)['json'](_0x264f28);}return null;};}function patchUpdates(_0x49845c){return function(_0x27a95e){try{jsonpatch[_0xf5d0('0x20')](_0x27a95e,_0x49845c,!![]);}catch(_0x45da2b){return BPromise[_0xf5d0('0x21')](_0x45da2b);}return _0x27a95e['save']();};}function saveUpdates(_0x258aec,_0x369f17){return function(_0x2f8a11){if(_0x2f8a11){return _0x2f8a11[_0xf5d0('0x22')](_0x258aec)[_0xf5d0('0x23')](function(_0x53086c){return _0x53086c;});}return null;};}function removeEntity(_0x198474,_0x2e4577){return function(_0x2bd8e7){if(_0x2bd8e7){return _0x2bd8e7[_0xf5d0('0x24')]()[_0xf5d0('0x23')](function(){_0x198474[_0xf5d0('0x18')](0xcc)[_0xf5d0('0x25')]();});}};}function handleEntityNotFound(_0x29b565,_0x493b4b){return function(_0x15f894){if(!_0x15f894){_0x29b565[_0xf5d0('0x17')](0x194);}return _0x15f894;};}function handleError(_0x58eed0,_0x2e094b){_0x2e094b=_0x2e094b||0x1f4;return function(_0x955031){logger['error'](_0x955031[_0xf5d0('0x26')]);if(_0x955031[_0xf5d0('0x27')]){delete _0x955031['name'];}_0x58eed0[_0xf5d0('0x18')](_0x2e094b)[_0xf5d0('0x28')](_0x955031);};}exports['index']=function(_0xec0cfc,_0xff4959){var _0x552ab1={},_0x4d821a={},_0x352bd0={'count':0x0,'rows':[]};var _0x51c6ea=_[_0xf5d0('0x29')](db['OpenchannelQueueReport'][_0xf5d0('0x2a')],function(_0x21b77f){return{'name':_0x21b77f[_0xf5d0('0x2b')],'type':_0x21b77f[_0xf5d0('0x2c')][_0xf5d0('0x2d')]};});_0x4d821a[_0xf5d0('0x2e')]=_[_0xf5d0('0x29')](_0x51c6ea,_0xf5d0('0x27'));_0x4d821a[_0xf5d0('0x2f')]=_[_0xf5d0('0x30')](_0xec0cfc[_0xf5d0('0x2f')]);_0x4d821a['filters']=_[_0xf5d0('0x31')](_0x4d821a['model'],_0x4d821a['query']);_0x552ab1[_0xf5d0('0x32')]=_[_0xf5d0('0x31')](_0x4d821a[_0xf5d0('0x2e')],qs[_0xf5d0('0x33')](_0xec0cfc[_0xf5d0('0x2f')]['fields']));_0x552ab1[_0xf5d0('0x32')]=_0x552ab1[_0xf5d0('0x32')][_0xf5d0('0x34')]?_0x552ab1[_0xf5d0('0x32')]:_0x4d821a[_0xf5d0('0x2e')];if(!_0xec0cfc[_0xf5d0('0x2f')][_0xf5d0('0x35')](_0xf5d0('0x36'))){_0x552ab1[_0xf5d0('0x1b')]=qs[_0xf5d0('0x1b')](_0xec0cfc[_0xf5d0('0x2f')][_0xf5d0('0x1b')]);_0x552ab1[_0xf5d0('0x1a')]=qs['offset'](_0xec0cfc[_0xf5d0('0x2f')]['offset']);}_0x552ab1['order']=qs['sort'](_0xec0cfc[_0xf5d0('0x2f')][_0xf5d0('0x37')]);_0x552ab1[_0xf5d0('0x38')]=qs[_0xf5d0('0x39')](_[_0xf5d0('0x3a')](_0xec0cfc['query'],_0x4d821a[_0xf5d0('0x39')]),_0x51c6ea);if(_0xec0cfc[_0xf5d0('0x2f')][_0xf5d0('0x3b')]){_0x552ab1[_0xf5d0('0x38')]=_[_0xf5d0('0x3c')](_0x552ab1[_0xf5d0('0x38')],{'$or':_[_0xf5d0('0x29')](_0x51c6ea,function(_0xcf4574){if(_0xcf4574[_0xf5d0('0x2c')]!=='VIRTUAL'){var _0x23aae2={};_0x23aae2[_0xcf4574[_0xf5d0('0x27')]]={'$like':'%'+_0xec0cfc[_0xf5d0('0x2f')][_0xf5d0('0x3b')]+'%'};return _0x23aae2;}})});}_0x552ab1=_[_0xf5d0('0x3c')]({},_0x552ab1,_0xec0cfc['options']);var _0x23075e={'where':_0x552ab1[_0xf5d0('0x38')]};return db[_0xf5d0('0x3d')][_0xf5d0('0x1d')](_0x23075e)[_0xf5d0('0x23')](function(_0xd07c26){_0x352bd0['count']=_0xd07c26;if(_0xec0cfc['query'][_0xf5d0('0x3e')]){_0x552ab1[_0xf5d0('0x3f')]=[{'all':!![]}];}return db[_0xf5d0('0x3d')][_0xf5d0('0x40')](_0x552ab1);})[_0xf5d0('0x23')](function(_0x2778b7){_0x352bd0[_0xf5d0('0x41')]=_0x2778b7;return _0x352bd0;})[_0xf5d0('0x23')](respondWithFilteredResult(_0xff4959,_0x552ab1))[_0xf5d0('0x42')](handleError(_0xff4959,null));};exports[_0xf5d0('0x43')]=function(_0xdc5a78,_0x30795b){var _0x1272f5={'raw':!![],'where':{'id':_0xdc5a78[_0xf5d0('0x44')]['id']}},_0x1c0705={};_0x1c0705['model']=_[_0xf5d0('0x30')](db[_0xf5d0('0x3d')][_0xf5d0('0x2a')]);_0x1c0705[_0xf5d0('0x2f')]=_[_0xf5d0('0x30')](_0xdc5a78[_0xf5d0('0x2f')]);_0x1c0705[_0xf5d0('0x39')]=_['intersection'](_0x1c0705['model'],_0x1c0705[_0xf5d0('0x2f')]);_0x1272f5[_0xf5d0('0x32')]=_[_0xf5d0('0x31')](_0x1c0705[_0xf5d0('0x2e')],qs['fields'](_0xdc5a78[_0xf5d0('0x2f')][_0xf5d0('0x33')]));_0x1272f5[_0xf5d0('0x32')]=_0x1272f5[_0xf5d0('0x32')]['length']?_0x1272f5[_0xf5d0('0x32')]:_0x1c0705[_0xf5d0('0x2e')];if(_0xdc5a78['query'][_0xf5d0('0x3e')]){_0x1272f5['include']=[{'all':!![]}];}_0x1272f5=_['merge']({},_0x1272f5,_0xdc5a78['options']);return db[_0xf5d0('0x3d')][_0xf5d0('0x45')](_0x1272f5)['then'](handleEntityNotFound(_0x30795b,null))[_0xf5d0('0x23')](respondWithResult(_0x30795b,null))[_0xf5d0('0x42')](handleError(_0x30795b,null));};exports[_0xf5d0('0x46')]=function(_0x55c6a0,_0x556cdc){return db[_0xf5d0('0x3d')][_0xf5d0('0x46')](_0x55c6a0[_0xf5d0('0x47')],{})[_0xf5d0('0x23')](respondWithResult(_0x556cdc,0xc9))[_0xf5d0('0x42')](handleError(_0x556cdc,null));};exports[_0xf5d0('0x22')]=function(_0x17641a,_0x25a31d){if(_0x17641a['body']['id']){delete _0x17641a[_0xf5d0('0x47')]['id'];}return db[_0xf5d0('0x3d')]['find']({'where':{'id':_0x17641a[_0xf5d0('0x44')]['id']}})[_0xf5d0('0x23')](handleEntityNotFound(_0x25a31d,null))[_0xf5d0('0x23')](saveUpdates(_0x17641a[_0xf5d0('0x47')],null))[_0xf5d0('0x23')](respondWithResult(_0x25a31d,null))[_0xf5d0('0x42')](handleError(_0x25a31d,null));};exports[_0xf5d0('0x24')]=function(_0x33f4a1,_0x82987d){return db[_0xf5d0('0x3d')][_0xf5d0('0x45')]({'where':{'id':_0x33f4a1[_0xf5d0('0x44')]['id']}})[_0xf5d0('0x23')](handleEntityNotFound(_0x82987d,null))['then'](removeEntity(_0x82987d,null))[_0xf5d0('0x42')](handleError(_0x82987d,null));};exports[_0xf5d0('0x48')]=function(_0x3fe00e,_0x5da767){return db[_0xf5d0('0x3d')][_0xf5d0('0x48')]()['then'](respondWithResult(_0x5da767,null))[_0xf5d0('0x42')](handleError(_0x5da767,null));}; \ No newline at end of file +var _0xce47=['update','then','error','stack','name','send','index','map','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','OpenchannelQueueReport','findAll','rows','catch','show','params','length','include','options','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','end','status','offset','undefined','limit','set','apply','reject'];(function(_0x5192e8,_0x254ca4){var _0x9f0941=function(_0x469789){while(--_0x469789){_0x5192e8['push'](_0x5192e8['shift']());}};_0x9f0941(++_0x254ca4);}(_0xce47,0x1b1));var _0x7ce4=function(_0x44664b,_0x2ab97b){_0x44664b=_0x44664b-0x0;var _0xba200a=_0xce47[_0x44664b];return _0xba200a;};'use strict';var emlformat=require(_0x7ce4('0x0'));var rimraf=require(_0x7ce4('0x1'));var zipdir=require(_0x7ce4('0x2'));var jsonpatch=require(_0x7ce4('0x3'));var rp=require(_0x7ce4('0x4'));var moment=require(_0x7ce4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7ce4('0x6'));var path=require(_0x7ce4('0x7'));var sox=require(_0x7ce4('0x8'));var csv=require(_0x7ce4('0x9'));var ejs=require(_0x7ce4('0xa'));var fs=require('fs');var fs_extra=require(_0x7ce4('0xb'));var _=require(_0x7ce4('0xc'));var squel=require('squel');var crypto=require(_0x7ce4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7ce4('0xe'));var toCsv=require(_0x7ce4('0x9'));var querystring=require('querystring');var Papa=require(_0x7ce4('0xf'));var Redis=require(_0x7ce4('0x10'));var authService=require(_0x7ce4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7ce4('0x12'));var hardwareService=require(_0x7ce4('0x13'));var logger=require(_0x7ce4('0x14'))(_0x7ce4('0x15'));var utils=require(_0x7ce4('0x16'));var config=require(_0x7ce4('0x17'));var licenseUtil=require(_0x7ce4('0x18'));var db=require(_0x7ce4('0x19'))['db'];function respondWithStatusCode(_0x24f120,_0x59f40a){_0x59f40a=_0x59f40a||0xcc;return function(_0x56fdf4){if(_0x56fdf4){return _0x24f120[_0x7ce4('0x1a')](_0x59f40a);}return _0x24f120['status'](_0x59f40a)[_0x7ce4('0x1b')]();};}function respondWithResult(_0x1c86ca,_0x57d3d1){_0x57d3d1=_0x57d3d1||0xc8;return function(_0x556fd8){if(_0x556fd8){return _0x1c86ca[_0x7ce4('0x1c')](_0x57d3d1)['json'](_0x556fd8);}};}function respondWithFilteredResult(_0x36490e,_0xa5276e){return function(_0xb71de1){if(_0xb71de1){var _0x4410c0=typeof _0xa5276e[_0x7ce4('0x1d')]===_0x7ce4('0x1e')&&typeof _0xa5276e['limit']==='undefined';var _0x32ba4e=_0xb71de1['count'];var _0x110abf=_0x4410c0?0x0:_0xa5276e['offset'];var _0x4f7b27=_0x4410c0?_0xb71de1['count']:_0xa5276e[_0x7ce4('0x1d')]+_0xa5276e[_0x7ce4('0x1f')];var _0xbdd084;if(_0x4f7b27>=_0x32ba4e){_0x4f7b27=_0x32ba4e;_0xbdd084=0xc8;}else{_0xbdd084=0xce;}_0x36490e['status'](_0xbdd084);return _0x36490e[_0x7ce4('0x20')]('Content-Range',_0x110abf+'-'+_0x4f7b27+'/'+_0x32ba4e)['json'](_0xb71de1);}return null;};}function patchUpdates(_0x2a5ddc){return function(_0x304ea9){try{jsonpatch[_0x7ce4('0x21')](_0x304ea9,_0x2a5ddc,!![]);}catch(_0xedbbb2){return BPromise[_0x7ce4('0x22')](_0xedbbb2);}return _0x304ea9['save']();};}function saveUpdates(_0x4aad2a,_0x1a5dc4){return function(_0x5d9aed){if(_0x5d9aed){return _0x5d9aed[_0x7ce4('0x23')](_0x4aad2a)[_0x7ce4('0x24')](function(_0x204e7c){return _0x204e7c;});}return null;};}function removeEntity(_0x4e14e3,_0x796d0a){return function(_0x55080e){if(_0x55080e){return _0x55080e['destroy']()[_0x7ce4('0x24')](function(){_0x4e14e3[_0x7ce4('0x1c')](0xcc)[_0x7ce4('0x1b')]();});}};}function handleEntityNotFound(_0x4ce77d,_0x5bd261){return function(_0x5b270e){if(!_0x5b270e){_0x4ce77d['sendStatus'](0x194);}return _0x5b270e;};}function handleError(_0x2d2813,_0x2d53a7){_0x2d53a7=_0x2d53a7||0x1f4;return function(_0x30f771){logger[_0x7ce4('0x25')](_0x30f771[_0x7ce4('0x26')]);if(_0x30f771[_0x7ce4('0x27')]){delete _0x30f771['name'];}_0x2d2813[_0x7ce4('0x1c')](_0x2d53a7)[_0x7ce4('0x28')](_0x30f771);};}exports[_0x7ce4('0x29')]=function(_0x1dd410,_0x45241){var _0x5e747b={},_0x1689da={},_0x50e263={'count':0x0,'rows':[]};var _0x1681e7=_[_0x7ce4('0x2a')](db['OpenchannelQueueReport'][_0x7ce4('0x2b')],function(_0x36a361){return{'name':_0x36a361['fieldName'],'type':_0x36a361[_0x7ce4('0x2c')][_0x7ce4('0x2d')]};});_0x1689da['model']=_['map'](_0x1681e7,_0x7ce4('0x27'));_0x1689da['query']=_[_0x7ce4('0x2e')](_0x1dd410['query']);_0x1689da['filters']=_[_0x7ce4('0x2f')](_0x1689da[_0x7ce4('0x30')],_0x1689da['query']);_0x5e747b[_0x7ce4('0x31')]=_[_0x7ce4('0x2f')](_0x1689da['model'],qs[_0x7ce4('0x32')](_0x1dd410['query'][_0x7ce4('0x32')]));_0x5e747b[_0x7ce4('0x31')]=_0x5e747b[_0x7ce4('0x31')]['length']?_0x5e747b[_0x7ce4('0x31')]:_0x1689da['model'];if(!_0x1dd410[_0x7ce4('0x33')][_0x7ce4('0x34')](_0x7ce4('0x35'))){_0x5e747b[_0x7ce4('0x1f')]=qs[_0x7ce4('0x1f')](_0x1dd410[_0x7ce4('0x33')][_0x7ce4('0x1f')]);_0x5e747b[_0x7ce4('0x1d')]=qs[_0x7ce4('0x1d')](_0x1dd410[_0x7ce4('0x33')][_0x7ce4('0x1d')]);}_0x5e747b[_0x7ce4('0x36')]=qs[_0x7ce4('0x37')](_0x1dd410[_0x7ce4('0x33')][_0x7ce4('0x37')]);_0x5e747b[_0x7ce4('0x38')]=qs[_0x7ce4('0x39')](_[_0x7ce4('0x3a')](_0x1dd410[_0x7ce4('0x33')],_0x1689da['filters']),_0x1681e7);if(_0x1dd410[_0x7ce4('0x33')][_0x7ce4('0x3b')]){_0x5e747b[_0x7ce4('0x38')]=_[_0x7ce4('0x3c')](_0x5e747b[_0x7ce4('0x38')],{'$or':_[_0x7ce4('0x2a')](_0x1681e7,function(_0x47d6ee){if(_0x47d6ee['type']!==_0x7ce4('0x3d')){var _0x49de9e={};_0x49de9e[_0x47d6ee[_0x7ce4('0x27')]]={'$like':'%'+_0x1dd410[_0x7ce4('0x33')]['filter']+'%'};return _0x49de9e;}})});}_0x5e747b=_[_0x7ce4('0x3c')]({},_0x5e747b,_0x1dd410['options']);var _0x2213da={'where':_0x5e747b[_0x7ce4('0x38')]};return db['OpenchannelQueueReport'][_0x7ce4('0x3e')](_0x2213da)[_0x7ce4('0x24')](function(_0x554ddb){_0x50e263[_0x7ce4('0x3e')]=_0x554ddb;if(_0x1dd410[_0x7ce4('0x33')][_0x7ce4('0x3f')]){_0x5e747b['include']=[{'all':!![]}];}return db[_0x7ce4('0x40')][_0x7ce4('0x41')](_0x5e747b);})[_0x7ce4('0x24')](function(_0x4d6de0){_0x50e263[_0x7ce4('0x42')]=_0x4d6de0;return _0x50e263;})[_0x7ce4('0x24')](respondWithFilteredResult(_0x45241,_0x5e747b))[_0x7ce4('0x43')](handleError(_0x45241,null));};exports[_0x7ce4('0x44')]=function(_0x1257f3,_0x39e1eb){var _0x1e2755={'raw':!![],'where':{'id':_0x1257f3[_0x7ce4('0x45')]['id']}},_0x3efbd1={};_0x3efbd1['model']=_['keys'](db['OpenchannelQueueReport'][_0x7ce4('0x2b')]);_0x3efbd1[_0x7ce4('0x33')]=_['keys'](_0x1257f3['query']);_0x3efbd1[_0x7ce4('0x39')]=_[_0x7ce4('0x2f')](_0x3efbd1[_0x7ce4('0x30')],_0x3efbd1['query']);_0x1e2755[_0x7ce4('0x31')]=_[_0x7ce4('0x2f')](_0x3efbd1[_0x7ce4('0x30')],qs[_0x7ce4('0x32')](_0x1257f3[_0x7ce4('0x33')][_0x7ce4('0x32')]));_0x1e2755['attributes']=_0x1e2755[_0x7ce4('0x31')][_0x7ce4('0x46')]?_0x1e2755['attributes']:_0x3efbd1[_0x7ce4('0x30')];if(_0x1257f3[_0x7ce4('0x33')][_0x7ce4('0x3f')]){_0x1e2755[_0x7ce4('0x47')]=[{'all':!![]}];}_0x1e2755=_[_0x7ce4('0x3c')]({},_0x1e2755,_0x1257f3[_0x7ce4('0x48')]);return db[_0x7ce4('0x40')]['find'](_0x1e2755)['then'](handleEntityNotFound(_0x39e1eb,null))[_0x7ce4('0x24')](respondWithResult(_0x39e1eb,null))[_0x7ce4('0x43')](handleError(_0x39e1eb,null));};exports[_0x7ce4('0x49')]=function(_0xca02a7,_0x3daa9c){return db[_0x7ce4('0x40')][_0x7ce4('0x49')](_0xca02a7['body'],{})[_0x7ce4('0x24')](respondWithResult(_0x3daa9c,0xc9))[_0x7ce4('0x43')](handleError(_0x3daa9c,null));};exports[_0x7ce4('0x23')]=function(_0x4fec0a,_0x4556d8){if(_0x4fec0a[_0x7ce4('0x4a')]['id']){delete _0x4fec0a[_0x7ce4('0x4a')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x4fec0a['params']['id']}})[_0x7ce4('0x24')](handleEntityNotFound(_0x4556d8,null))['then'](saveUpdates(_0x4fec0a[_0x7ce4('0x4a')],null))['then'](respondWithResult(_0x4556d8,null))[_0x7ce4('0x43')](handleError(_0x4556d8,null));};exports[_0x7ce4('0x4b')]=function(_0x4cb932,_0x580d1e){return db['OpenchannelQueueReport'][_0x7ce4('0x4c')]({'where':{'id':_0x4cb932[_0x7ce4('0x45')]['id']}})['then'](handleEntityNotFound(_0x580d1e,null))['then'](removeEntity(_0x580d1e,null))[_0x7ce4('0x43')](handleError(_0x580d1e,null));};exports[_0x7ce4('0x4d')]=function(_0xd92696,_0x4bc566){return db['OpenchannelQueueReport'][_0x7ce4('0x4d')]()[_0x7ce4('0x24')](respondWithResult(_0x4bc566,null))[_0x7ce4('0x43')](handleError(_0x4bc566,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7d977b0..bbf1fa4 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(_0x192a2f,_0x3e782e){var _0x546abb=function(_0x3b8bf5){while(--_0x3b8bf5){_0x192a2f['push'](_0x192a2f['shift']());}};_0x546abb(++_0x3e782e);}(_0x1261,0x144));var _0x1126=function(_0x544cd7,_0x20f588){_0x544cd7=_0x544cd7-0x0;var _0x43c000=_0x1261[_0x544cd7];return _0x43c000;};'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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x359fdb,_0x37713d){var _0x36df9a=function(_0x574ee5){while(--_0x574ee5){_0x359fdb['push'](_0x359fdb['shift']());}};_0x36df9a(++_0x37713d);}(_0x1261,0x144));var _0x1126=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x1261[_0x19115e];return _0x45bbd4;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index f22f479..168fac2 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 _0x8603=['create','options','raw','debug','stringify','UpdateOpenchannelQueueReport','where','attributes','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x8603,0x190));var _0x3860=function(_0xbcb4bf,_0x5296ed){_0xbcb4bf=_0xbcb4bf-0x0;var _0x3932b3=_0x8603[_0xbcb4bf];return _0x3932b3;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')](_0x45b799['body'],{'raw':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![]})[_0x3860('0x9')](function(_0x20a5b0){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger[_0x3860('0x17')](_0x3860('0x12'),_0x45b799,JSON[_0x3860('0x18')](_0x20a5b0));_0x4863bd(_0x20a5b0);})[_0x3860('0x11')](function(_0x2e0b6e){logger[_0x3860('0xd')](_0x3860('0x12'),_0x2e0b6e[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15['error'](0x1f4,_0x2e0b6e[_0x3860('0xe')]));});});};exports[_0x3860('0x19')]=function(_0x2b91f2){var _0x301e03=this;return new Promise(function(_0x20bb1e,_0x56a6d1){return db[_0x3860('0x13')]['update'](_0x2b91f2['body'],{'raw':_0x2b91f2[_0x3860('0x15')]?_0x2b91f2[_0x3860('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b91f2['options']?_0x2b91f2['options'][_0x3860('0x1a')]||null:null,'attributes':_0x2b91f2[_0x3860('0x15')]?_0x2b91f2[_0x3860('0x15')][_0x3860('0x1b')]||null:null,'limit':_0x2b91f2[_0x3860('0x15')]?_0x2b91f2[_0x3860('0x15')]['limit']||null:null})['then'](function(_0x389bd0){logger[_0x3860('0xf')]('UpdateOpenchannelQueueReport',_0x2b91f2);logger[_0x3860('0x17')](_0x3860('0x19'),_0x2b91f2,JSON[_0x3860('0x18')](_0x389bd0));_0x20bb1e(_0x389bd0);})[_0x3860('0x11')](function(_0x3628f7){logger['error'](_0x3860('0x19'),_0x3628f7[_0x3860('0xe')],_0x2b91f2);_0x56a6d1(_0x301e03[_0x3860('0xd')](0x1f4,_0x3628f7['message']));});});}; \ No newline at end of file +var _0x6343=['create','options','CreateOpenchannelQueueReport','stringify','update','body','raw','debug','UpdateOpenchannelQueueReport','moment','bluebird','../../config/logger','rpc','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','OpenchannelQueueReport'];(function(_0x12ed74,_0x3ec76d){var _0x17edf6=function(_0x2754de){while(--_0x2754de){_0x12ed74['push'](_0x12ed74['shift']());}};_0x17edf6(++_0x3ec76d);}(_0x6343,0x168));var _0x3634=function(_0x101d49,_0x1a29e2){_0x101d49=_0x101d49-0x0;var _0x21635a=_0x6343[_0x101d49];return _0x21635a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302828,_0xd40513,_0x4e6d71){return new BPromise(function(_0x5affba,_0x19170a){return client[_0x3634('0x6')](_0x302828,_0x4e6d71)[_0x3634('0x7')](function(_0x3c813b){logger[_0x3634('0x8')](_0x3634('0x9'),_0xd40513,'request\x20sent');logger['debug'](_0x3634('0xa'),_0xd40513,_0x3634('0xb'),JSON['stringify'](_0x3c813b));if(_0x3c813b[_0x3634('0xc')]){if(_0x3c813b[_0x3634('0xc')][_0x3634('0xd')]===0x1f4){logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x19170a(_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);}logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x5affba(_0x3c813b[_0x3634('0xc')]['message']);}else{logger[_0x3634('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd40513,_0x3634('0xb'));_0x5affba(_0x3c813b[_0x3634('0xf')][_0x3634('0xe')]);}})[_0x3634('0x10')](function(_0x91061e){logger['error'](_0x3634('0x9'),_0xd40513,_0x91061e);_0x19170a(_0x91061e);});});}exports['CreateOpenchannelQueueReport']=function(_0x50350d){var _0x2aaac7=this;return new Promise(function(_0x4b2115,_0x2fac8b){return db[_0x3634('0x11')][_0x3634('0x12')](_0x50350d['body'],{'raw':_0x50350d[_0x3634('0x13')]?_0x50350d[_0x3634('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x3634('0x7')](function(_0x506281){logger[_0x3634('0x8')](_0x3634('0x14'),_0x50350d);logger['debug'](_0x3634('0x14'),_0x50350d,JSON[_0x3634('0x15')](_0x506281));_0x4b2115(_0x506281);})[_0x3634('0x10')](function(_0x505026){logger[_0x3634('0xc')](_0x3634('0x14'),_0x505026['message'],_0x50350d);_0x2fac8b(_0x2aaac7[_0x3634('0xc')](0x1f4,_0x505026['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3a8c41){var _0x862ab5=this;return new Promise(function(_0x5df6fb,_0x1b25be){return db[_0x3634('0x11')][_0x3634('0x16')](_0x3a8c41[_0x3634('0x17')],{'raw':_0x3a8c41[_0x3634('0x13')]?_0x3a8c41[_0x3634('0x13')][_0x3634('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a8c41[_0x3634('0x13')]?_0x3a8c41[_0x3634('0x13')]['where']||null:null,'attributes':_0x3a8c41[_0x3634('0x13')]?_0x3a8c41['options']['attributes']||null:null,'limit':_0x3a8c41['options']?_0x3a8c41[_0x3634('0x13')]['limit']||null:null})[_0x3634('0x7')](function(_0x12b80e){logger['info']('UpdateOpenchannelQueueReport',_0x3a8c41);logger[_0x3634('0x19')]('UpdateOpenchannelQueueReport',_0x3a8c41,JSON[_0x3634('0x15')](_0x12b80e));_0x5df6fb(_0x12b80e);})['catch'](function(_0x1e04cc){logger[_0x3634('0xc')](_0x3634('0x1a'),_0x1e04cc[_0x3634('0xe')],_0x3a8c41);_0x1b25be(_0x862ab5[_0x3634('0xc')](0x1f4,_0x1e04cc[_0x3634('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 78c2842..b531986 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 _0x1609=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x331c8d,_0x1093fa){var _0x167c9b=function(_0x9c775){while(--_0x9c775){_0x331c8d['push'](_0x331c8d['shift']());}};_0x167c9b(++_0x1093fa);}(_0x1609,0x170));var _0x9160=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1609[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x9160('0x0'));var util=require(_0x9160('0x1'));var path=require('path');var timeout=require(_0x9160('0x2'));var express=require(_0x9160('0x3'));var router=express[_0x9160('0x4')]();var fs_extra=require(_0x9160('0x5'));var auth=require(_0x9160('0x6'));var interaction=require(_0x9160('0x7'));var config=require(_0x9160('0x8'));var controller=require(_0x9160('0x9'));router[_0x9160('0xa')]('/',auth[_0x9160('0xb')](),controller['index']);router[_0x9160('0xa')]('/describe',auth[_0x9160('0xb')](),controller[_0x9160('0xc')]);router[_0x9160('0xa')](_0x9160('0xd'),auth[_0x9160('0xb')](),controller[_0x9160('0xe')]);router['post']('/',auth[_0x9160('0xb')](),controller[_0x9160('0xf')]);router[_0x9160('0x10')](_0x9160('0xd'),auth[_0x9160('0xb')](),controller[_0x9160('0x11')]);router[_0x9160('0x12')]('/:id',auth[_0x9160('0xb')](),controller[_0x9160('0x13')]);module[_0x9160('0x14')]=router; \ No newline at end of file +var _0xec39=['delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id'];(function(_0x44f250,_0x577ff5){var _0x4490eb=function(_0x1e4409){while(--_0x1e4409){_0x44f250['push'](_0x44f250['shift']());}};_0x4490eb(++_0x577ff5);}(_0xec39,0x80));var _0x9ec3=function(_0x2ea7fd,_0xcf30b){_0x2ea7fd=_0x2ea7fd-0x0;var _0x53d5b8=_0xec39[_0x2ea7fd];return _0x53d5b8;};'use strict';var multer=require(_0x9ec3('0x0'));var util=require('util');var path=require(_0x9ec3('0x1'));var timeout=require(_0x9ec3('0x2'));var express=require(_0x9ec3('0x3'));var router=express[_0x9ec3('0x4')]();var fs_extra=require(_0x9ec3('0x5'));var auth=require(_0x9ec3('0x6'));var interaction=require(_0x9ec3('0x7'));var config=require('../../config/environment');var controller=require(_0x9ec3('0x8'));router[_0x9ec3('0x9')]('/',auth['isAuthenticated'](),controller[_0x9ec3('0xa')]);router['get'](_0x9ec3('0xb'),auth[_0x9ec3('0xc')](),controller[_0x9ec3('0xd')]);router[_0x9ec3('0x9')]('/:id',auth[_0x9ec3('0xc')](),controller[_0x9ec3('0xe')]);router[_0x9ec3('0xf')]('/',auth[_0x9ec3('0xc')](),controller[_0x9ec3('0x10')]);router[_0x9ec3('0x11')](_0x9ec3('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x9ec3('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9ec3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index a19dae9..2c40610 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x3ba6bf,_0x290126){var _0x4c7e0a=function(_0x2bbf74){while(--_0x2bbf74){_0x3ba6bf['push'](_0x3ba6bf['shift']());}};_0x4c7e0a(++_0x290126);}(_0xe706,0xa3));var _0x6e70=function(_0x2f3412,_0x2b8d24){_0x2f3412=_0x2f3412-0x0;var _0x4071d6=_0xe706[_0x2f3412];return _0x4071d6;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xf7dc1d,_0x3303ea){var _0xf8c37d=function(_0x5946ac){while(--_0x5946ac){_0xf7dc1d['push'](_0xf7dc1d['shift']());}};_0xf8c37d(++_0x3303ea);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x24f5b1,_0x350007){_0x24f5b1=_0x24f5b1-0x0;var _0x451a13=_0xf3cd[_0x24f5b1];return _0x451a13;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f2234bc..2297943 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 _0xee5a=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelTransferReport','type','key','model','filters','intersection','query','attributes','fields','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','describe','rimraf','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xee5a,0x1a3));var _0xaee5=function(_0x513404,_0x502d59){_0x513404=_0x513404-0x0;var _0x558677=_0xee5a[_0x513404];return _0x558677;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaee5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaee5('0x1'));var moment=require(_0xaee5('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaee5('0x3'));var sox=require(_0xaee5('0x4'));var csv=require(_0xaee5('0x5'));var ejs=require(_0xaee5('0x6'));var fs=require('fs');var fs_extra=require(_0xaee5('0x7'));var _=require(_0xaee5('0x8'));var squel=require('squel');var crypto=require(_0xaee5('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaee5('0xa'));var Papa=require(_0xaee5('0xb'));var Redis=require(_0xaee5('0xc'));var authService=require(_0xaee5('0xd'));var qs=require(_0xaee5('0xe'));var as=require(_0xaee5('0xf'));var hardwareService=require(_0xaee5('0x10'));var logger=require(_0xaee5('0x11'))(_0xaee5('0x12'));var utils=require(_0xaee5('0x13'));var config=require(_0xaee5('0x14'));var licenseUtil=require(_0xaee5('0x15'));var db=require(_0xaee5('0x16'))['db'];function respondWithStatusCode(_0x3b38d7,_0x163490){_0x163490=_0x163490||0xcc;return function(_0x4017c3){if(_0x4017c3){return _0x3b38d7[_0xaee5('0x17')](_0x163490);}return _0x3b38d7[_0xaee5('0x18')](_0x163490)[_0xaee5('0x19')]();};}function respondWithResult(_0x30c585,_0x580e09){_0x580e09=_0x580e09||0xc8;return function(_0x5f02ef){if(_0x5f02ef){return _0x30c585['status'](_0x580e09)[_0xaee5('0x1a')](_0x5f02ef);}};}function respondWithFilteredResult(_0x304616,_0x1b5f41){return function(_0x595104){if(_0x595104){var _0x5b6038=typeof _0x1b5f41[_0xaee5('0x1b')]==='undefined'&&typeof _0x1b5f41[_0xaee5('0x1c')]===_0xaee5('0x1d');var _0x12ec99=_0x595104[_0xaee5('0x1e')];var _0x3a2d1c=_0x5b6038?0x0:_0x1b5f41[_0xaee5('0x1b')];var _0x1220a9=_0x5b6038?_0x595104[_0xaee5('0x1e')]:_0x1b5f41['offset']+_0x1b5f41[_0xaee5('0x1c')];var _0x1e8bb4;if(_0x1220a9>=_0x12ec99){_0x1220a9=_0x12ec99;_0x1e8bb4=0xc8;}else{_0x1e8bb4=0xce;}_0x304616[_0xaee5('0x18')](_0x1e8bb4);return _0x304616[_0xaee5('0x1f')](_0xaee5('0x20'),_0x3a2d1c+'-'+_0x1220a9+'/'+_0x12ec99)['json'](_0x595104);}return null;};}function patchUpdates(_0x18123d){return function(_0x3932c3){try{jsonpatch[_0xaee5('0x21')](_0x3932c3,_0x18123d,!![]);}catch(_0x5a291d){return BPromise[_0xaee5('0x22')](_0x5a291d);}return _0x3932c3[_0xaee5('0x23')]();};}function saveUpdates(_0x269736,_0x22bc65){return function(_0x5f9ba1){if(_0x5f9ba1){return _0x5f9ba1[_0xaee5('0x24')](_0x269736)[_0xaee5('0x25')](function(_0x5e24be){return _0x5e24be;});}return null;};}function removeEntity(_0x2c02ec,_0x2bbba8){return function(_0x245091){if(_0x245091){return _0x245091[_0xaee5('0x26')]()[_0xaee5('0x25')](function(){_0x2c02ec['status'](0xcc)[_0xaee5('0x19')]();});}};}function handleEntityNotFound(_0x2b9bbc,_0x10b6fd){return function(_0x1975c6){if(!_0x1975c6){_0x2b9bbc[_0xaee5('0x17')](0x194);}return _0x1975c6;};}function handleError(_0x4f98e8,_0xab061a){_0xab061a=_0xab061a||0x1f4;return function(_0x51d2c5){logger[_0xaee5('0x27')](_0x51d2c5['stack']);if(_0x51d2c5[_0xaee5('0x28')]){delete _0x51d2c5[_0xaee5('0x28')];}_0x4f98e8[_0xaee5('0x18')](_0xab061a)[_0xaee5('0x29')](_0x51d2c5);};}exports[_0xaee5('0x2a')]=function(_0x4a585a,_0x39e7fd){var _0x49a5bf={},_0xf8a0a4={},_0x52e7f7={'count':0x0,'rows':[]};var _0x3df8c1=_[_0xaee5('0x2b')](db[_0xaee5('0x2c')]['rawAttributes'],function(_0x4992c4){return{'name':_0x4992c4['fieldName'],'type':_0x4992c4[_0xaee5('0x2d')][_0xaee5('0x2e')]};});_0xf8a0a4[_0xaee5('0x2f')]=_['map'](_0x3df8c1,_0xaee5('0x28'));_0xf8a0a4['query']=_['keys'](_0x4a585a['query']);_0xf8a0a4[_0xaee5('0x30')]=_[_0xaee5('0x31')](_0xf8a0a4['model'],_0xf8a0a4[_0xaee5('0x32')]);_0x49a5bf[_0xaee5('0x33')]=_[_0xaee5('0x31')](_0xf8a0a4[_0xaee5('0x2f')],qs[_0xaee5('0x34')](_0x4a585a['query'][_0xaee5('0x34')]));_0x49a5bf[_0xaee5('0x33')]=_0x49a5bf[_0xaee5('0x33')]['length']?_0x49a5bf[_0xaee5('0x33')]:_0xf8a0a4['model'];if(!_0x4a585a[_0xaee5('0x32')]['hasOwnProperty'](_0xaee5('0x35'))){_0x49a5bf['limit']=qs[_0xaee5('0x1c')](_0x4a585a['query'][_0xaee5('0x1c')]);_0x49a5bf[_0xaee5('0x1b')]=qs[_0xaee5('0x1b')](_0x4a585a[_0xaee5('0x32')][_0xaee5('0x1b')]);}_0x49a5bf['order']=qs[_0xaee5('0x36')](_0x4a585a[_0xaee5('0x32')][_0xaee5('0x36')]);_0x49a5bf['where']=qs[_0xaee5('0x30')](_['pick'](_0x4a585a[_0xaee5('0x32')],_0xf8a0a4[_0xaee5('0x30')]),_0x3df8c1);if(_0x4a585a['query']['filter']){_0x49a5bf[_0xaee5('0x37')]=_[_0xaee5('0x38')](_0x49a5bf['where'],{'$or':_[_0xaee5('0x2b')](_0x3df8c1,function(_0x32589c){if(_0x32589c[_0xaee5('0x2d')]!==_0xaee5('0x39')){var _0x5fbb6b={};_0x5fbb6b[_0x32589c[_0xaee5('0x28')]]={'$like':'%'+_0x4a585a['query'][_0xaee5('0x3a')]+'%'};return _0x5fbb6b;}})});}_0x49a5bf=_[_0xaee5('0x38')]({},_0x49a5bf,_0x4a585a[_0xaee5('0x3b')]);var _0x4e43ab={'where':_0x49a5bf[_0xaee5('0x37')]};return db[_0xaee5('0x2c')][_0xaee5('0x1e')](_0x4e43ab)[_0xaee5('0x25')](function(_0xbb59c){_0x52e7f7['count']=_0xbb59c;if(_0x4a585a[_0xaee5('0x32')][_0xaee5('0x3c')]){_0x49a5bf['include']=[{'all':!![]}];}return db[_0xaee5('0x2c')][_0xaee5('0x3d')](_0x49a5bf);})[_0xaee5('0x25')](function(_0x5395fb){_0x52e7f7[_0xaee5('0x3e')]=_0x5395fb;return _0x52e7f7;})[_0xaee5('0x25')](respondWithFilteredResult(_0x39e7fd,_0x49a5bf))[_0xaee5('0x3f')](handleError(_0x39e7fd,null));};exports[_0xaee5('0x40')]=function(_0x15fb29,_0x37b402){var _0x51317f={'raw':!![],'where':{'id':_0x15fb29[_0xaee5('0x41')]['id']}},_0x287b76={};_0x287b76[_0xaee5('0x2f')]=_[_0xaee5('0x42')](db[_0xaee5('0x2c')][_0xaee5('0x43')]);_0x287b76[_0xaee5('0x32')]=_[_0xaee5('0x42')](_0x15fb29[_0xaee5('0x32')]);_0x287b76['filters']=_[_0xaee5('0x31')](_0x287b76[_0xaee5('0x2f')],_0x287b76[_0xaee5('0x32')]);_0x51317f['attributes']=_[_0xaee5('0x31')](_0x287b76[_0xaee5('0x2f')],qs['fields'](_0x15fb29[_0xaee5('0x32')][_0xaee5('0x34')]));_0x51317f[_0xaee5('0x33')]=_0x51317f[_0xaee5('0x33')][_0xaee5('0x44')]?_0x51317f[_0xaee5('0x33')]:_0x287b76[_0xaee5('0x2f')];if(_0x15fb29[_0xaee5('0x32')][_0xaee5('0x3c')]){_0x51317f[_0xaee5('0x45')]=[{'all':!![]}];}_0x51317f=_[_0xaee5('0x38')]({},_0x51317f,_0x15fb29['options']);return db[_0xaee5('0x2c')][_0xaee5('0x46')](_0x51317f)[_0xaee5('0x25')](handleEntityNotFound(_0x37b402,null))[_0xaee5('0x25')](respondWithResult(_0x37b402,null))['catch'](handleError(_0x37b402,null));};exports[_0xaee5('0x47')]=function(_0x291aad,_0x12b4b8){return db['OpenchannelTransferReport'][_0xaee5('0x47')](_0x291aad[_0xaee5('0x48')],{})[_0xaee5('0x25')](respondWithResult(_0x12b4b8,0xc9))[_0xaee5('0x3f')](handleError(_0x12b4b8,null));};exports[_0xaee5('0x24')]=function(_0x521a75,_0x1a3c54){if(_0x521a75['body']['id']){delete _0x521a75['body']['id'];}return db['OpenchannelTransferReport'][_0xaee5('0x46')]({'where':{'id':_0x521a75[_0xaee5('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a3c54,null))[_0xaee5('0x25')](saveUpdates(_0x521a75['body'],null))[_0xaee5('0x25')](respondWithResult(_0x1a3c54,null))[_0xaee5('0x3f')](handleError(_0x1a3c54,null));};exports[_0xaee5('0x26')]=function(_0x13d8be,_0x232b4a){return db[_0xaee5('0x2c')][_0xaee5('0x46')]({'where':{'id':_0x13d8be[_0xaee5('0x41')]['id']}})[_0xaee5('0x25')](handleEntityNotFound(_0x232b4a,null))[_0xaee5('0x25')](removeEntity(_0x232b4a,null))[_0xaee5('0x3f')](handleError(_0x232b4a,null));};exports[_0xaee5('0x49')]=function(_0x44c584,_0xd4f415){return db['OpenchannelTransferReport'][_0xaee5('0x49')]()[_0xaee5('0x25')](respondWithResult(_0xd4f415,null))[_0xaee5('0x3f')](handleError(_0xd4f415,null));}; \ No newline at end of file +var _0x2718=['rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','apply','reject','save','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x3ca6ef,_0x3ce483){var _0x346ef9=function(_0x2e69cf){while(--_0x2e69cf){_0x3ca6ef['push'](_0x3ca6ef['shift']());}};_0x346ef9(++_0x3ce483);}(_0x2718,0xd4));var _0x8271=function(_0x9ef7c0,_0x5070fe){_0x9ef7c0=_0x9ef7c0-0x0;var _0x35eaf4=_0x2718[_0x9ef7c0];return _0x35eaf4;};'use strict';var emlformat=require(_0x8271('0x0'));var rimraf=require(_0x8271('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8271('0x2'));var moment=require(_0x8271('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8271('0x4'));var util=require(_0x8271('0x5'));var path=require(_0x8271('0x6'));var sox=require(_0x8271('0x7'));var csv=require(_0x8271('0x8'));var ejs=require(_0x8271('0x9'));var fs=require('fs');var fs_extra=require(_0x8271('0xa'));var _=require(_0x8271('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8271('0xc'));var deskjs=require(_0x8271('0xd'));var toCsv=require(_0x8271('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8271('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8271('0xf'));var as=require(_0x8271('0x10'));var hardwareService=require(_0x8271('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8271('0x12'));var licenseUtil=require(_0x8271('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59bf87,_0x3ca59d){_0x3ca59d=_0x3ca59d||0xcc;return function(_0x477340){if(_0x477340){return _0x59bf87[_0x8271('0x14')](_0x3ca59d);}return _0x59bf87[_0x8271('0x15')](_0x3ca59d)[_0x8271('0x16')]();};}function respondWithResult(_0x5577bf,_0x2e2e06){_0x2e2e06=_0x2e2e06||0xc8;return function(_0x51a65c){if(_0x51a65c){return _0x5577bf['status'](_0x2e2e06)[_0x8271('0x17')](_0x51a65c);}};}function respondWithFilteredResult(_0x5c8e7a,_0x165843){return function(_0x4a41c5){if(_0x4a41c5){var _0x510293=typeof _0x165843[_0x8271('0x18')]==='undefined'&&typeof _0x165843[_0x8271('0x19')]==='undefined';var _0x43a877=_0x4a41c5['count'];var _0x29ecfc=_0x510293?0x0:_0x165843[_0x8271('0x18')];var _0x219ada=_0x510293?_0x4a41c5[_0x8271('0x1a')]:_0x165843[_0x8271('0x18')]+_0x165843['limit'];var _0x507180;if(_0x219ada>=_0x43a877){_0x219ada=_0x43a877;_0x507180=0xc8;}else{_0x507180=0xce;}_0x5c8e7a[_0x8271('0x15')](_0x507180);return _0x5c8e7a['set']('Content-Range',_0x29ecfc+'-'+_0x219ada+'/'+_0x43a877)[_0x8271('0x17')](_0x4a41c5);}return null;};}function patchUpdates(_0x2b303f){return function(_0x7449f7){try{jsonpatch[_0x8271('0x1b')](_0x7449f7,_0x2b303f,!![]);}catch(_0x520c75){return BPromise[_0x8271('0x1c')](_0x520c75);}return _0x7449f7[_0x8271('0x1d')]();};}function saveUpdates(_0x2838f5,_0x4d175d){return function(_0x559066){if(_0x559066){return _0x559066['update'](_0x2838f5)[_0x8271('0x1e')](function(_0x474fa7){return _0x474fa7;});}return null;};}function removeEntity(_0x345977,_0x17b6cc){return function(_0x304d99){if(_0x304d99){return _0x304d99[_0x8271('0x1f')]()[_0x8271('0x1e')](function(){_0x345977[_0x8271('0x15')](0xcc)[_0x8271('0x16')]();});}};}function handleEntityNotFound(_0x461f1b,_0x7afe7a){return function(_0xbeb117){if(!_0xbeb117){_0x461f1b[_0x8271('0x14')](0x194);}return _0xbeb117;};}function handleError(_0x32a1f3,_0x1a7554){_0x1a7554=_0x1a7554||0x1f4;return function(_0x3d18e6){logger['error'](_0x3d18e6[_0x8271('0x20')]);if(_0x3d18e6[_0x8271('0x21')]){delete _0x3d18e6[_0x8271('0x21')];}_0x32a1f3[_0x8271('0x15')](_0x1a7554)[_0x8271('0x22')](_0x3d18e6);};}exports[_0x8271('0x23')]=function(_0xe703b4,_0x14842a){var _0x22ada9={},_0x158b02={},_0x3b49d5={'count':0x0,'rows':[]};var _0x12e3e5=_[_0x8271('0x24')](db[_0x8271('0x25')][_0x8271('0x26')],function(_0xa6544b){return{'name':_0xa6544b[_0x8271('0x27')],'type':_0xa6544b[_0x8271('0x28')][_0x8271('0x29')]};});_0x158b02[_0x8271('0x2a')]=_[_0x8271('0x24')](_0x12e3e5,_0x8271('0x21'));_0x158b02[_0x8271('0x2b')]=_['keys'](_0xe703b4[_0x8271('0x2b')]);_0x158b02[_0x8271('0x2c')]=_[_0x8271('0x2d')](_0x158b02[_0x8271('0x2a')],_0x158b02[_0x8271('0x2b')]);_0x22ada9[_0x8271('0x2e')]=_[_0x8271('0x2d')](_0x158b02[_0x8271('0x2a')],qs[_0x8271('0x2f')](_0xe703b4[_0x8271('0x2b')]['fields']));_0x22ada9['attributes']=_0x22ada9[_0x8271('0x2e')][_0x8271('0x30')]?_0x22ada9[_0x8271('0x2e')]:_0x158b02[_0x8271('0x2a')];if(!_0xe703b4['query'][_0x8271('0x31')](_0x8271('0x32'))){_0x22ada9[_0x8271('0x19')]=qs['limit'](_0xe703b4[_0x8271('0x2b')][_0x8271('0x19')]);_0x22ada9['offset']=qs[_0x8271('0x18')](_0xe703b4['query'][_0x8271('0x18')]);}_0x22ada9['order']=qs[_0x8271('0x33')](_0xe703b4['query'][_0x8271('0x33')]);_0x22ada9[_0x8271('0x34')]=qs[_0x8271('0x2c')](_[_0x8271('0x35')](_0xe703b4[_0x8271('0x2b')],_0x158b02[_0x8271('0x2c')]),_0x12e3e5);if(_0xe703b4['query'][_0x8271('0x36')]){_0x22ada9[_0x8271('0x34')]=_[_0x8271('0x37')](_0x22ada9[_0x8271('0x34')],{'$or':_[_0x8271('0x24')](_0x12e3e5,function(_0x1d7f1e){if(_0x1d7f1e[_0x8271('0x28')]!==_0x8271('0x38')){var _0x44a18b={};_0x44a18b[_0x1d7f1e['name']]={'$like':'%'+_0xe703b4[_0x8271('0x2b')][_0x8271('0x36')]+'%'};return _0x44a18b;}})});}_0x22ada9=_[_0x8271('0x37')]({},_0x22ada9,_0xe703b4[_0x8271('0x39')]);var _0x30110c={'where':_0x22ada9[_0x8271('0x34')]};return db['OpenchannelTransferReport']['count'](_0x30110c)[_0x8271('0x1e')](function(_0x3aa7f2){_0x3b49d5[_0x8271('0x1a')]=_0x3aa7f2;if(_0xe703b4['query'][_0x8271('0x3a')]){_0x22ada9[_0x8271('0x3b')]=[{'all':!![]}];}return db[_0x8271('0x25')]['findAll'](_0x22ada9);})[_0x8271('0x1e')](function(_0x3e754e){_0x3b49d5[_0x8271('0x3c')]=_0x3e754e;return _0x3b49d5;})[_0x8271('0x1e')](respondWithFilteredResult(_0x14842a,_0x22ada9))[_0x8271('0x3d')](handleError(_0x14842a,null));};exports['show']=function(_0xb660bb,_0x5ace86){var _0x533be4={'raw':!![],'where':{'id':_0xb660bb[_0x8271('0x3e')]['id']}},_0x22d534={};_0x22d534[_0x8271('0x2a')]=_[_0x8271('0x3f')](db[_0x8271('0x25')]['rawAttributes']);_0x22d534[_0x8271('0x2b')]=_[_0x8271('0x3f')](_0xb660bb['query']);_0x22d534[_0x8271('0x2c')]=_[_0x8271('0x2d')](_0x22d534['model'],_0x22d534[_0x8271('0x2b')]);_0x533be4[_0x8271('0x2e')]=_[_0x8271('0x2d')](_0x22d534['model'],qs[_0x8271('0x2f')](_0xb660bb[_0x8271('0x2b')][_0x8271('0x2f')]));_0x533be4['attributes']=_0x533be4['attributes'][_0x8271('0x30')]?_0x533be4[_0x8271('0x2e')]:_0x22d534[_0x8271('0x2a')];if(_0xb660bb[_0x8271('0x2b')]['includeAll']){_0x533be4[_0x8271('0x3b')]=[{'all':!![]}];}_0x533be4=_[_0x8271('0x37')]({},_0x533be4,_0xb660bb[_0x8271('0x39')]);return db['OpenchannelTransferReport'][_0x8271('0x40')](_0x533be4)[_0x8271('0x1e')](handleEntityNotFound(_0x5ace86,null))[_0x8271('0x1e')](respondWithResult(_0x5ace86,null))[_0x8271('0x3d')](handleError(_0x5ace86,null));};exports[_0x8271('0x41')]=function(_0x3f23b9,_0x39db5b){return db[_0x8271('0x25')][_0x8271('0x41')](_0x3f23b9['body'],{})[_0x8271('0x1e')](respondWithResult(_0x39db5b,0xc9))['catch'](handleError(_0x39db5b,null));};exports['update']=function(_0x541772,_0x3dedcc){if(_0x541772[_0x8271('0x42')]['id']){delete _0x541772[_0x8271('0x42')]['id'];}return db[_0x8271('0x25')][_0x8271('0x40')]({'where':{'id':_0x541772['params']['id']}})[_0x8271('0x1e')](handleEntityNotFound(_0x3dedcc,null))[_0x8271('0x1e')](saveUpdates(_0x541772[_0x8271('0x42')],null))[_0x8271('0x1e')](respondWithResult(_0x3dedcc,null))[_0x8271('0x3d')](handleError(_0x3dedcc,null));};exports['destroy']=function(_0x4330f6,_0x53d1af){return db[_0x8271('0x25')][_0x8271('0x40')]({'where':{'id':_0x4330f6['params']['id']}})[_0x8271('0x1e')](handleEntityNotFound(_0x53d1af,null))[_0x8271('0x1e')](removeEntity(_0x53d1af,null))[_0x8271('0x3d')](handleError(_0x53d1af,null));};exports[_0x8271('0x43')]=function(_0x37e2fb,_0x2f1b87){return db[_0x8271('0x25')][_0x8271('0x43')]()['then'](respondWithResult(_0x2f1b87,null))['catch'](handleError(_0x2f1b87,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b276a10..d986e08 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 _0x1c68=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define'];(function(_0x1c9487,_0x496cdb){var _0x5da536=function(_0x1bc258){while(--_0x1bc258){_0x1c9487['push'](_0x1c9487['shift']());}};_0x5da536(++_0x496cdb);}(_0x1c68,0x9d));var _0x81c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x81c6('0x0'));var logger=require(_0x81c6('0x1'))(_0x81c6('0x2'));var moment=require(_0x81c6('0x3'));var BPromise=require(_0x81c6('0x4'));var rp=require(_0x81c6('0x5'));var fs=require('fs');var path=require(_0x81c6('0x6'));var rimraf=require(_0x81c6('0x7'));var config=require('../../config/environment');var attributes=require(_0x81c6('0x8'));module[_0x81c6('0x9')]=function(_0x20a886,_0x1f05cf){return _0x20a886[_0x81c6('0xa')](_0x81c6('0xb'),attributes,{'tableName':_0x81c6('0xc'),'paranoid':![],'indexes':[{'name':_0x81c6('0xd'),'fields':[_0x81c6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x834d=['request-promise','path','./openchannelTransferReport.attributes','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x41554e,_0x10591b){var _0x4895bc=function(_0x25ff5f){while(--_0x25ff5f){_0x41554e['push'](_0x41554e['shift']());}};_0x4895bc(++_0x10591b);}(_0x834d,0x11c));var _0xd834=function(_0x13df23,_0x3919da){_0x13df23=_0x13df23-0x0;var _0x371cdc=_0x834d[_0x13df23];return _0x371cdc;};'use strict';var _=require(_0xd834('0x0'));var util=require('util');var logger=require(_0xd834('0x1'))(_0xd834('0x2'));var moment=require(_0xd834('0x3'));var BPromise=require('bluebird');var rp=require(_0xd834('0x4'));var fs=require('fs');var path=require(_0xd834('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd834('0x6'));module['exports']=function(_0x3b31d4,_0xfc8791){return _0x3b31d4['define']('OpenchannelTransferReport',attributes,{'tableName':_0xd834('0x7'),'paranoid':![],'indexes':[{'name':_0xd834('0x8'),'fields':[_0xd834('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 38e9830..3ec0d71 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 _0x34aa=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xb0acfa,_0x369e2e){var _0x5cf647=function(_0x377d36){while(--_0x377d36){_0xb0acfa['push'](_0xb0acfa['shift']());}};_0x5cf647(++_0x369e2e);}(_0x34aa,0x171));var _0xa34a=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x34aa[_0x1b745b];return _0x120a9d;};'use strict';var _=require(_0xa34a('0x0'));var util=require('util');var moment=require(_0xa34a('0x1'));var BPromise=require(_0xa34a('0x2'));var rs=require(_0xa34a('0x3'));var fs=require('fs');var Redis=require(_0xa34a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa34a('0x5'));var logger=require(_0xa34a('0x6'))(_0xa34a('0x7'));var config=require(_0xa34a('0x8'));var jayson=require(_0xa34a('0x9'));var client=jayson[_0xa34a('0xa')][_0xa34a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43f9ea,_0x1a03fd,_0x45f2b4){return new BPromise(function(_0x467864,_0x5c858b){return client[_0xa34a('0xc')](_0x43f9ea,_0x45f2b4)[_0xa34a('0xd')](function(_0x35f231){logger[_0xa34a('0xe')](_0xa34a('0xf'),_0x1a03fd,'request\x20sent');logger[_0xa34a('0x10')](_0xa34a('0x11'),_0x1a03fd,_0xa34a('0x12'),JSON[_0xa34a('0x13')](_0x35f231));if(_0x35f231[_0xa34a('0x14')]){if(_0x35f231[_0xa34a('0x14')][_0xa34a('0x15')]===0x1f4){logger['error'](_0xa34a('0xf'),_0x1a03fd,_0x35f231[_0xa34a('0x14')][_0xa34a('0x16')]);return _0x5c858b(_0x35f231['error'][_0xa34a('0x16')]);}logger[_0xa34a('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1a03fd,_0x35f231[_0xa34a('0x14')][_0xa34a('0x16')]);return _0x467864(_0x35f231['error'][_0xa34a('0x16')]);}else{logger[_0xa34a('0xe')](_0xa34a('0xf'),_0x1a03fd,_0xa34a('0x12'));_0x467864(_0x35f231[_0xa34a('0x17')]['message']);}})[_0xa34a('0x18')](function(_0x56f4da){logger[_0xa34a('0x14')](_0xa34a('0xf'),_0x1a03fd,_0x56f4da);_0x5c858b(_0x56f4da);});});} \ No newline at end of file +var _0xec39=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec39,0x19f));var _0x9ec3=function(_0x4d5bdc,_0x59e300){_0x4d5bdc=_0x4d5bdc-0x0;var _0xb316da=_0xec39[_0x4d5bdc];return _0xb316da;};'use strict';var _=require(_0x9ec3('0x0'));var util=require(_0x9ec3('0x1'));var moment=require(_0x9ec3('0x2'));var BPromise=require(_0x9ec3('0x3'));var rs=require(_0x9ec3('0x4'));var fs=require('fs');var Redis=require(_0x9ec3('0x5'));var db=require(_0x9ec3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ec3('0x7'))(_0x9ec3('0x8'));var config=require(_0x9ec3('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3742c5,_0x11c4d1,_0x29a6a2){return new BPromise(function(_0x595e3a,_0x570a91){return client[_0x9ec3('0xa')](_0x3742c5,_0x29a6a2)[_0x9ec3('0xb')](function(_0x2d0c30){logger[_0x9ec3('0xc')](_0x9ec3('0xd'),_0x11c4d1,_0x9ec3('0xe'));logger['debug'](_0x9ec3('0xf'),_0x11c4d1,_0x9ec3('0xe'),JSON[_0x9ec3('0x10')](_0x2d0c30));if(_0x2d0c30[_0x9ec3('0x11')]){if(_0x2d0c30[_0x9ec3('0x11')][_0x9ec3('0x12')]===0x1f4){logger[_0x9ec3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x11c4d1,_0x2d0c30[_0x9ec3('0x11')][_0x9ec3('0x13')]);return _0x570a91(_0x2d0c30[_0x9ec3('0x11')]['message']);}logger[_0x9ec3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x11c4d1,_0x2d0c30[_0x9ec3('0x11')][_0x9ec3('0x13')]);return _0x595e3a(_0x2d0c30[_0x9ec3('0x11')][_0x9ec3('0x13')]);}else{logger[_0x9ec3('0xc')](_0x9ec3('0xd'),_0x11c4d1,_0x9ec3('0xe'));_0x595e3a(_0x2d0c30[_0x9ec3('0x14')][_0x9ec3('0x13')]);}})['catch'](function(_0x39ca26){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x11c4d1,_0x39ca26);_0x570a91(_0x39ca26);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a85759c..aab3c94 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 _0xb923=['util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer'];(function(_0x52ee06,_0x3fb98d){var _0x6066b1=function(_0x368c05){while(--_0x368c05){_0x52ee06['push'](_0x52ee06['shift']());}};_0x6066b1(++_0x3fb98d);}(_0xb923,0xfe));var _0x3b92=function(_0x5129e1,_0x4baf70){_0x5129e1=_0x5129e1-0x0;var _0x58b34e=_0xb923[_0x5129e1];return _0x58b34e;};'use strict';var multer=require(_0x3b92('0x0'));var util=require(_0x3b92('0x1'));var path=require('path');var timeout=require(_0x3b92('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3b92('0x3'));var auth=require(_0x3b92('0x4'));var interaction=require(_0x3b92('0x5'));var config=require(_0x3b92('0x6'));var controller=require('./pause.controller');router[_0x3b92('0x7')]('/',auth[_0x3b92('0x8')](),controller[_0x3b92('0x9')]);router[_0x3b92('0x7')](_0x3b92('0xa'),auth['isAuthenticated'](),controller[_0x3b92('0xb')]);router[_0x3b92('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b92('0xd')](_0x3b92('0xa'),auth[_0x3b92('0x8')](),controller['update']);router[_0x3b92('0xe')](_0x3b92('0xa'),auth['isAuthenticated'](),controller[_0x3b92('0xf')]);module[_0x3b92('0x10')]=router; \ No newline at end of file +var _0xafe7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer'];(function(_0x69ede,_0x3f8e97){var _0x13e7e1=function(_0x314100){while(--_0x314100){_0x69ede['push'](_0x69ede['shift']());}};_0x13e7e1(++_0x3f8e97);}(_0xafe7,0x9f));var _0x7afe=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xafe7[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x7afe('0x0'));var util=require('util');var path=require(_0x7afe('0x1'));var timeout=require(_0x7afe('0x2'));var express=require(_0x7afe('0x3'));var router=express[_0x7afe('0x4')]();var fs_extra=require(_0x7afe('0x5'));var auth=require(_0x7afe('0x6'));var interaction=require(_0x7afe('0x7'));var config=require(_0x7afe('0x8'));var controller=require('./pause.controller');router[_0x7afe('0x9')]('/',auth[_0x7afe('0xa')](),controller[_0x7afe('0xb')]);router[_0x7afe('0x9')]('/:id',auth[_0x7afe('0xa')](),controller[_0x7afe('0xc')]);router[_0x7afe('0xd')]('/',auth[_0x7afe('0xa')](),controller[_0x7afe('0xe')]);router[_0x7afe('0xf')](_0x7afe('0x10'),auth['isAuthenticated'](),controller[_0x7afe('0x11')]);router[_0x7afe('0x12')](_0x7afe('0x10'),auth['isAuthenticated'](),controller[_0x7afe('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 18bfc4c..6021c8a 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 _0x311e=['name','STRING','sequelize'];(function(_0x1e4db4,_0x311e15){var _0x5da414=function(_0x19c34c){while(--_0x19c34c){_0x1e4db4['push'](_0x1e4db4['shift']());}};_0x5da414(++_0x311e15);}(_0x311e,0x1b2));var _0xe311=function(_0x5206b0,_0x9e6ae8){_0x5206b0=_0x5206b0-0x0;var _0x159a37=_0x311e[_0x5206b0];return _0x159a37;};'use strict';var Sequelize=require(_0xe311('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe311('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xe311('0x2')]}}; \ No newline at end of file +var _0x4599=['exports','name','STRING','sequelize'];(function(_0x559196,_0x55af8e){var _0x4a985c=function(_0x223cff){while(--_0x223cff){_0x559196['push'](_0x559196['shift']());}};_0x4a985c(++_0x55af8e);}(_0x4599,0x15f));var _0x9459=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4599[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x9459('0x0'));module[_0x9459('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9459('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9459('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6ad0f3a..d640392 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 _0x1940=['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/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','Pauses','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','role','UserProfileSection','userProfileId','update','eml-format','rimraf'];(function(_0x4dc928,_0x1e6125){var _0x209324=function(_0x31cd6a){while(--_0x31cd6a){_0x4dc928['push'](_0x4dc928['shift']());}};_0x209324(++_0x1e6125);}(_0x1940,0x1a2));var _0x0194=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x1940[_0x13f980];return _0x27153c;};'use strict';var emlformat=require(_0x0194('0x0'));var rimraf=require(_0x0194('0x1'));var zipdir=require(_0x0194('0x2'));var jsonpatch=require(_0x0194('0x3'));var rp=require(_0x0194('0x4'));var moment=require(_0x0194('0x5'));var BPromise=require(_0x0194('0x6'));var Mustache=require('mustache');var util=require(_0x0194('0x7'));var path=require(_0x0194('0x8'));var sox=require(_0x0194('0x9'));var csv=require(_0x0194('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0194('0xb'));var _=require(_0x0194('0xc'));var squel=require(_0x0194('0xd'));var crypto=require(_0x0194('0xe'));var jsforce=require(_0x0194('0xf'));var deskjs=require(_0x0194('0x10'));var toCsv=require(_0x0194('0xa'));var querystring=require(_0x0194('0x11'));var Papa=require(_0x0194('0x12'));var Redis=require('ioredis');var authService=require(_0x0194('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0194('0x14'));var logger=require(_0x0194('0x15'))(_0x0194('0x16'));var utils=require('../../config/utils');var config=require(_0x0194('0x17'));var licenseUtil=require(_0x0194('0x18'));var db=require(_0x0194('0x19'))['db'];function respondWithStatusCode(_0x5a7594,_0x233168){_0x233168=_0x233168||0xcc;return function(_0x33dd6c){if(_0x33dd6c){return _0x5a7594[_0x0194('0x1a')](_0x233168);}return _0x5a7594[_0x0194('0x1b')](_0x233168)['end']();};}function respondWithResult(_0x4371f6,_0xebdec4){_0xebdec4=_0xebdec4||0xc8;return function(_0x2c50bc){if(_0x2c50bc){return _0x4371f6[_0x0194('0x1b')](_0xebdec4)[_0x0194('0x1c')](_0x2c50bc);}};}function respondWithFilteredResult(_0x476752,_0xfb85d8){return function(_0x2ecba8){if(_0x2ecba8){var _0x1d54af=typeof _0xfb85d8[_0x0194('0x1d')]===_0x0194('0x1e')&&typeof _0xfb85d8[_0x0194('0x1f')]==='undefined';var _0x47042b=_0x2ecba8[_0x0194('0x20')];var _0x405d6b=_0x1d54af?0x0:_0xfb85d8[_0x0194('0x1d')];var _0x29efae=_0x1d54af?_0x2ecba8[_0x0194('0x20')]:_0xfb85d8[_0x0194('0x1d')]+_0xfb85d8['limit'];var _0x322c5b;if(_0x29efae>=_0x47042b){_0x29efae=_0x47042b;_0x322c5b=0xc8;}else{_0x322c5b=0xce;}_0x476752[_0x0194('0x1b')](_0x322c5b);return _0x476752[_0x0194('0x21')](_0x0194('0x22'),_0x405d6b+'-'+_0x29efae+'/'+_0x47042b)[_0x0194('0x1c')](_0x2ecba8);}return null;};}function patchUpdates(_0x16c88e){return function(_0x26a641){try{jsonpatch[_0x0194('0x23')](_0x26a641,_0x16c88e,!![]);}catch(_0x5522ed){return BPromise[_0x0194('0x24')](_0x5522ed);}return _0x26a641['save']();};}function saveUpdates(_0x1a616f,_0x3635d6){return function(_0x268e12){if(_0x268e12){return _0x268e12['update'](_0x1a616f)[_0x0194('0x25')](function(_0x371d9d){return _0x371d9d;});}return null;};}function removeEntity(_0x393f12,_0x4aad00){return function(_0x377384){if(_0x377384){return _0x377384[_0x0194('0x26')]()[_0x0194('0x25')](function(){var _0x43cc95=_0x377384[_0x0194('0x27')]({'plain':!![]});var _0x5a7e53=_0x0194('0x28');return db[_0x0194('0x29')][_0x0194('0x26')]({'where':{'type':_0x5a7e53,'resourceId':_0x43cc95['id']}})[_0x0194('0x25')](function(){return _0x377384;});})[_0x0194('0x25')](function(){_0x393f12[_0x0194('0x1b')](0xcc)[_0x0194('0x2a')]();});}};}function handleEntityNotFound(_0x813ff1,_0x15f0d9){return function(_0x3c21e4){if(!_0x3c21e4){_0x813ff1[_0x0194('0x1a')](0x194);}return _0x3c21e4;};}function handleError(_0x5bafa4,_0xc13252){_0xc13252=_0xc13252||0x1f4;return function(_0x4fabd9){logger[_0x0194('0x2b')](_0x4fabd9['stack']);if(_0x4fabd9[_0x0194('0x2c')]){delete _0x4fabd9[_0x0194('0x2c')];}_0x5bafa4[_0x0194('0x1b')](_0xc13252)[_0x0194('0x2d')](_0x4fabd9);};}exports[_0x0194('0x2e')]=function(_0x2daa02,_0x4605e3){var _0x1c3cd6={},_0xf39dd8={},_0xdc020={'count':0x0,'rows':[]};var _0x4863f4=_[_0x0194('0x2f')](db['Pause'][_0x0194('0x30')],function(_0x10606d){return{'name':_0x10606d[_0x0194('0x31')],'type':_0x10606d[_0x0194('0x32')][_0x0194('0x33')]};});_0xf39dd8['model']=_[_0x0194('0x2f')](_0x4863f4,_0x0194('0x2c'));_0xf39dd8[_0x0194('0x34')]=_['keys'](_0x2daa02[_0x0194('0x34')]);_0xf39dd8[_0x0194('0x35')]=_[_0x0194('0x36')](_0xf39dd8['model'],_0xf39dd8[_0x0194('0x34')]);_0x1c3cd6[_0x0194('0x37')]=_[_0x0194('0x36')](_0xf39dd8[_0x0194('0x38')],qs['fields'](_0x2daa02['query']['fields']));_0x1c3cd6[_0x0194('0x37')]=_0x1c3cd6['attributes'][_0x0194('0x39')]?_0x1c3cd6['attributes']:_0xf39dd8[_0x0194('0x38')];if(!_0x2daa02[_0x0194('0x34')]['hasOwnProperty'](_0x0194('0x3a'))){_0x1c3cd6[_0x0194('0x1f')]=qs[_0x0194('0x1f')](_0x2daa02['query'][_0x0194('0x1f')]);_0x1c3cd6[_0x0194('0x1d')]=qs['offset'](_0x2daa02['query'][_0x0194('0x1d')]);}_0x1c3cd6['order']=qs['sort'](_0x2daa02[_0x0194('0x34')][_0x0194('0x3b')]);_0x1c3cd6[_0x0194('0x3c')]=qs['filters'](_[_0x0194('0x3d')](_0x2daa02[_0x0194('0x34')],_0xf39dd8['filters']),_0x4863f4);if(_0x2daa02['query'][_0x0194('0x3e')]){_0x1c3cd6[_0x0194('0x3c')]=_[_0x0194('0x3f')](_0x1c3cd6[_0x0194('0x3c')],{'$or':_[_0x0194('0x2f')](_0x4863f4,function(_0x26dcfc){if(_0x26dcfc[_0x0194('0x32')]!==_0x0194('0x40')){var _0x30b35b={};_0x30b35b[_0x26dcfc[_0x0194('0x2c')]]={'$like':'%'+_0x2daa02['query'][_0x0194('0x3e')]+'%'};return _0x30b35b;}})});}_0x1c3cd6=_[_0x0194('0x3f')]({},_0x1c3cd6,_0x2daa02[_0x0194('0x41')]);var _0x2d938f={'where':_0x1c3cd6[_0x0194('0x3c')]};return db[_0x0194('0x42')][_0x0194('0x20')](_0x2d938f)[_0x0194('0x25')](function(_0x50c34d){_0xdc020[_0x0194('0x20')]=_0x50c34d;if(_0x2daa02[_0x0194('0x34')][_0x0194('0x43')]){_0x1c3cd6[_0x0194('0x44')]=[{'all':!![]}];}return db[_0x0194('0x42')][_0x0194('0x45')](_0x1c3cd6);})[_0x0194('0x25')](function(_0x403be2){_0xdc020[_0x0194('0x46')]=_0x403be2;return _0xdc020;})['then'](respondWithFilteredResult(_0x4605e3,_0x1c3cd6))[_0x0194('0x47')](handleError(_0x4605e3,null));};exports[_0x0194('0x48')]=function(_0x2d10e3,_0x1c775f){var _0x1d7e47={'raw':!![],'where':{'id':_0x2d10e3[_0x0194('0x49')]['id']}},_0x35186d={};_0x35186d[_0x0194('0x38')]=_['keys'](db['Pause'][_0x0194('0x30')]);_0x35186d['query']=_[_0x0194('0x4a')](_0x2d10e3['query']);_0x35186d[_0x0194('0x35')]=_['intersection'](_0x35186d[_0x0194('0x38')],_0x35186d[_0x0194('0x34')]);_0x1d7e47[_0x0194('0x37')]=_[_0x0194('0x36')](_0x35186d['model'],qs[_0x0194('0x4b')](_0x2d10e3[_0x0194('0x34')][_0x0194('0x4b')]));_0x1d7e47[_0x0194('0x37')]=_0x1d7e47[_0x0194('0x37')][_0x0194('0x39')]?_0x1d7e47[_0x0194('0x37')]:_0x35186d[_0x0194('0x38')];if(_0x2d10e3[_0x0194('0x34')][_0x0194('0x43')]){_0x1d7e47['include']=[{'all':!![]}];}_0x1d7e47=_[_0x0194('0x3f')]({},_0x1d7e47,_0x2d10e3[_0x0194('0x41')]);return db[_0x0194('0x42')][_0x0194('0x4c')](_0x1d7e47)[_0x0194('0x25')](handleEntityNotFound(_0x1c775f,null))[_0x0194('0x25')](respondWithResult(_0x1c775f,null))[_0x0194('0x47')](handleError(_0x1c775f,null));};exports[_0x0194('0x4d')]=function(_0x359ff4,_0x305eef){return db[_0x0194('0x42')][_0x0194('0x4d')](_0x359ff4[_0x0194('0x4e')],{})[_0x0194('0x25')](function(_0x317615){var _0x3ddcbb=_0x359ff4[_0x0194('0x4f')]['get']({'plain':!![]});if(!_0x3ddcbb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ddcbb[_0x0194('0x50')]===_0x0194('0x4f')){var _0x256b85=_0x317615['get']({'plain':!![]});var _0x2fb864=_0x0194('0x28');return db[_0x0194('0x51')][_0x0194('0x4c')]({'where':{'name':_0x2fb864,'userProfileId':_0x3ddcbb[_0x0194('0x52')]},'raw':!![]})[_0x0194('0x25')](function(_0x28bfe8){if(_0x28bfe8&&_0x28bfe8['autoAssociation']===0x0){return db[_0x0194('0x29')][_0x0194('0x4d')]({'name':_0x256b85[_0x0194('0x2c')],'resourceId':_0x256b85['id'],'type':_0x28bfe8[_0x0194('0x2c')],'sectionId':_0x28bfe8['id']},{})[_0x0194('0x25')](function(){return _0x317615;});}else{return _0x317615;}})['catch'](function(_0x5d502a){logger[_0x0194('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d502a);throw _0x5d502a;});}return _0x317615;})[_0x0194('0x25')](respondWithResult(_0x305eef,0xc9))[_0x0194('0x47')](handleError(_0x305eef,null));};exports[_0x0194('0x53')]=function(_0x34eaf3,_0x14090a){if(_0x34eaf3[_0x0194('0x4e')]['id']){delete _0x34eaf3['body']['id'];}return db['Pause']['find']({'where':{'id':_0x34eaf3[_0x0194('0x49')]['id']}})[_0x0194('0x25')](handleEntityNotFound(_0x14090a,null))[_0x0194('0x25')](saveUpdates(_0x34eaf3[_0x0194('0x4e')],null))[_0x0194('0x25')](respondWithResult(_0x14090a,null))[_0x0194('0x47')](handleError(_0x14090a,null));};exports[_0x0194('0x26')]=function(_0x526d58,_0xa6e4da){return db[_0x0194('0x42')][_0x0194('0x4c')]({'where':{'id':_0x526d58[_0x0194('0x49')]['id']}})['then'](handleEntityNotFound(_0xa6e4da,null))[_0x0194('0x25')](removeEntity(_0xa6e4da,null))[_0x0194('0x47')](handleError(_0xa6e4da,null));}; \ No newline at end of file +var _0x20cb=['offset','undefined','limit','count','set','reject','save','destroy','UserProfileResource','then','stack','name','map','Pause','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','find','create','body','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','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'];(function(_0x37ea83,_0x3659a3){var _0x1820a0=function(_0x32f5d5){while(--_0x32f5d5){_0x37ea83['push'](_0x37ea83['shift']());}};_0x1820a0(++_0x3659a3);}(_0x20cb,0x11e));var _0xb20c=function(_0x5fc95f,_0x299c09){_0x5fc95f=_0x5fc95f-0x0;var _0x1239f1=_0x20cb[_0x5fc95f];return _0x1239f1;};'use strict';var emlformat=require(_0xb20c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb20c('0x1'));var jsonpatch=require(_0xb20c('0x2'));var rp=require(_0xb20c('0x3'));var moment=require(_0xb20c('0x4'));var BPromise=require(_0xb20c('0x5'));var Mustache=require(_0xb20c('0x6'));var util=require(_0xb20c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb20c('0x8'));var ejs=require(_0xb20c('0x9'));var fs=require('fs');var fs_extra=require(_0xb20c('0xa'));var _=require(_0xb20c('0xb'));var squel=require(_0xb20c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb20c('0xd'));var toCsv=require(_0xb20c('0x8'));var querystring=require(_0xb20c('0xe'));var Papa=require(_0xb20c('0xf'));var Redis=require(_0xb20c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb20c('0x11'));var as=require(_0xb20c('0x12'));var hardwareService=require(_0xb20c('0x13'));var logger=require(_0xb20c('0x14'))(_0xb20c('0x15'));var utils=require(_0xb20c('0x16'));var config=require(_0xb20c('0x17'));var licenseUtil=require(_0xb20c('0x18'));var db=require(_0xb20c('0x19'))['db'];function respondWithStatusCode(_0x165801,_0x5961a3){_0x5961a3=_0x5961a3||0xcc;return function(_0xc93f2){if(_0xc93f2){return _0x165801[_0xb20c('0x1a')](_0x5961a3);}return _0x165801[_0xb20c('0x1b')](_0x5961a3)[_0xb20c('0x1c')]();};}function respondWithResult(_0x45beba,_0x286a35){_0x286a35=_0x286a35||0xc8;return function(_0x1a3916){if(_0x1a3916){return _0x45beba[_0xb20c('0x1b')](_0x286a35)[_0xb20c('0x1d')](_0x1a3916);}};}function respondWithFilteredResult(_0x43cc91,_0x379fb7){return function(_0x465db7){if(_0x465db7){var _0x371da5=typeof _0x379fb7[_0xb20c('0x1e')]===_0xb20c('0x1f')&&typeof _0x379fb7[_0xb20c('0x20')]==='undefined';var _0x539337=_0x465db7[_0xb20c('0x21')];var _0x28d1ea=_0x371da5?0x0:_0x379fb7[_0xb20c('0x1e')];var _0x340c79=_0x371da5?_0x465db7[_0xb20c('0x21')]:_0x379fb7[_0xb20c('0x1e')]+_0x379fb7[_0xb20c('0x20')];var _0x33d491;if(_0x340c79>=_0x539337){_0x340c79=_0x539337;_0x33d491=0xc8;}else{_0x33d491=0xce;}_0x43cc91[_0xb20c('0x1b')](_0x33d491);return _0x43cc91[_0xb20c('0x22')]('Content-Range',_0x28d1ea+'-'+_0x340c79+'/'+_0x539337)[_0xb20c('0x1d')](_0x465db7);}return null;};}function patchUpdates(_0x5cefd6){return function(_0x154fbd){try{jsonpatch['apply'](_0x154fbd,_0x5cefd6,!![]);}catch(_0x44bb33){return BPromise[_0xb20c('0x23')](_0x44bb33);}return _0x154fbd[_0xb20c('0x24')]();};}function saveUpdates(_0x5cee8f,_0xabc1e1){return function(_0x5b9717){if(_0x5b9717){return _0x5b9717['update'](_0x5cee8f)['then'](function(_0xef52fe){return _0xef52fe;});}return null;};}function removeEntity(_0x5271ba,_0xd0e12a){return function(_0x2bc961){if(_0x2bc961){return _0x2bc961[_0xb20c('0x25')]()['then'](function(){var _0xe06fca=_0x2bc961['get']({'plain':!![]});var _0x46de38='Pauses';return db[_0xb20c('0x26')][_0xb20c('0x25')]({'where':{'type':_0x46de38,'resourceId':_0xe06fca['id']}})[_0xb20c('0x27')](function(){return _0x2bc961;});})[_0xb20c('0x27')](function(){_0x5271ba[_0xb20c('0x1b')](0xcc)[_0xb20c('0x1c')]();});}};}function handleEntityNotFound(_0x5e6a9a,_0x51ce3d){return function(_0x1d042a){if(!_0x1d042a){_0x5e6a9a[_0xb20c('0x1a')](0x194);}return _0x1d042a;};}function handleError(_0x46c2f3,_0x1fda35){_0x1fda35=_0x1fda35||0x1f4;return function(_0x361415){logger['error'](_0x361415[_0xb20c('0x28')]);if(_0x361415[_0xb20c('0x29')]){delete _0x361415[_0xb20c('0x29')];}_0x46c2f3[_0xb20c('0x1b')](_0x1fda35)['send'](_0x361415);};}exports['index']=function(_0xd716c6,_0xf15707){var _0x5a7ffc={},_0x5ee682={},_0x28dc8a={'count':0x0,'rows':[]};var _0x390d43=_[_0xb20c('0x2a')](db[_0xb20c('0x2b')][_0xb20c('0x2c')],function(_0xeb0929){return{'name':_0xeb0929['fieldName'],'type':_0xeb0929[_0xb20c('0x2d')][_0xb20c('0x2e')]};});_0x5ee682[_0xb20c('0x2f')]=_[_0xb20c('0x2a')](_0x390d43,_0xb20c('0x29'));_0x5ee682[_0xb20c('0x30')]=_[_0xb20c('0x31')](_0xd716c6[_0xb20c('0x30')]);_0x5ee682[_0xb20c('0x32')]=_[_0xb20c('0x33')](_0x5ee682[_0xb20c('0x2f')],_0x5ee682[_0xb20c('0x30')]);_0x5a7ffc['attributes']=_[_0xb20c('0x33')](_0x5ee682[_0xb20c('0x2f')],qs[_0xb20c('0x34')](_0xd716c6[_0xb20c('0x30')]['fields']));_0x5a7ffc[_0xb20c('0x35')]=_0x5a7ffc[_0xb20c('0x35')]['length']?_0x5a7ffc[_0xb20c('0x35')]:_0x5ee682[_0xb20c('0x2f')];if(!_0xd716c6[_0xb20c('0x30')][_0xb20c('0x36')]('nolimit')){_0x5a7ffc[_0xb20c('0x20')]=qs[_0xb20c('0x20')](_0xd716c6[_0xb20c('0x30')][_0xb20c('0x20')]);_0x5a7ffc['offset']=qs['offset'](_0xd716c6[_0xb20c('0x30')][_0xb20c('0x1e')]);}_0x5a7ffc[_0xb20c('0x37')]=qs[_0xb20c('0x38')](_0xd716c6[_0xb20c('0x30')][_0xb20c('0x38')]);_0x5a7ffc[_0xb20c('0x39')]=qs[_0xb20c('0x32')](_['pick'](_0xd716c6['query'],_0x5ee682[_0xb20c('0x32')]),_0x390d43);if(_0xd716c6['query'][_0xb20c('0x3a')]){_0x5a7ffc[_0xb20c('0x39')]=_[_0xb20c('0x3b')](_0x5a7ffc[_0xb20c('0x39')],{'$or':_[_0xb20c('0x2a')](_0x390d43,function(_0x26f05b){if(_0x26f05b[_0xb20c('0x2d')]!==_0xb20c('0x3c')){var _0x257f38={};_0x257f38[_0x26f05b[_0xb20c('0x29')]]={'$like':'%'+_0xd716c6[_0xb20c('0x30')]['filter']+'%'};return _0x257f38;}})});}_0x5a7ffc=_['merge']({},_0x5a7ffc,_0xd716c6[_0xb20c('0x3d')]);var _0x4d36bf={'where':_0x5a7ffc['where']};return db[_0xb20c('0x2b')][_0xb20c('0x21')](_0x4d36bf)[_0xb20c('0x27')](function(_0x4a7aa6){_0x28dc8a[_0xb20c('0x21')]=_0x4a7aa6;if(_0xd716c6[_0xb20c('0x30')]['includeAll']){_0x5a7ffc[_0xb20c('0x3e')]=[{'all':!![]}];}return db[_0xb20c('0x2b')][_0xb20c('0x3f')](_0x5a7ffc);})[_0xb20c('0x27')](function(_0x12fd3a){_0x28dc8a[_0xb20c('0x40')]=_0x12fd3a;return _0x28dc8a;})[_0xb20c('0x27')](respondWithFilteredResult(_0xf15707,_0x5a7ffc))[_0xb20c('0x41')](handleError(_0xf15707,null));};exports['show']=function(_0x170d81,_0x284817){var _0x5aa90b={'raw':!![],'where':{'id':_0x170d81[_0xb20c('0x42')]['id']}},_0x129dc3={};_0x129dc3[_0xb20c('0x2f')]=_[_0xb20c('0x31')](db[_0xb20c('0x2b')][_0xb20c('0x2c')]);_0x129dc3[_0xb20c('0x30')]=_[_0xb20c('0x31')](_0x170d81[_0xb20c('0x30')]);_0x129dc3[_0xb20c('0x32')]=_[_0xb20c('0x33')](_0x129dc3[_0xb20c('0x2f')],_0x129dc3[_0xb20c('0x30')]);_0x5aa90b[_0xb20c('0x35')]=_['intersection'](_0x129dc3[_0xb20c('0x2f')],qs[_0xb20c('0x34')](_0x170d81['query'][_0xb20c('0x34')]));_0x5aa90b[_0xb20c('0x35')]=_0x5aa90b['attributes'][_0xb20c('0x43')]?_0x5aa90b['attributes']:_0x129dc3[_0xb20c('0x2f')];if(_0x170d81[_0xb20c('0x30')][_0xb20c('0x44')]){_0x5aa90b[_0xb20c('0x3e')]=[{'all':!![]}];}_0x5aa90b=_['merge']({},_0x5aa90b,_0x170d81[_0xb20c('0x3d')]);return db[_0xb20c('0x2b')][_0xb20c('0x45')](_0x5aa90b)['then'](handleEntityNotFound(_0x284817,null))[_0xb20c('0x27')](respondWithResult(_0x284817,null))[_0xb20c('0x41')](handleError(_0x284817,null));};exports[_0xb20c('0x46')]=function(_0x173599,_0x57c156){return db['Pause'][_0xb20c('0x46')](_0x173599[_0xb20c('0x47')],{})[_0xb20c('0x27')](function(_0x4b5231){var _0x3dfc9e=_0x173599[_0xb20c('0x48')]['get']({'plain':!![]});if(!_0x3dfc9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dfc9e[_0xb20c('0x49')]===_0xb20c('0x48')){var _0x228e15=_0x4b5231['get']({'plain':!![]});var _0x1b152d='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x1b152d,'userProfileId':_0x3dfc9e[_0xb20c('0x4a')]},'raw':!![]})['then'](function(_0x3beff8){if(_0x3beff8&&_0x3beff8[_0xb20c('0x4b')]===0x0){return db[_0xb20c('0x26')]['create']({'name':_0x228e15[_0xb20c('0x29')],'resourceId':_0x228e15['id'],'type':_0x3beff8[_0xb20c('0x29')],'sectionId':_0x3beff8['id']},{})['then'](function(){return _0x4b5231;});}else{return _0x4b5231;}})[_0xb20c('0x41')](function(_0xb7a213){logger[_0xb20c('0x4c')](_0xb20c('0x4d'),_0xb7a213);throw _0xb7a213;});}return _0x4b5231;})[_0xb20c('0x27')](respondWithResult(_0x57c156,0xc9))[_0xb20c('0x41')](handleError(_0x57c156,null));};exports[_0xb20c('0x4e')]=function(_0x2e1bce,_0x2db990){if(_0x2e1bce[_0xb20c('0x47')]['id']){delete _0x2e1bce[_0xb20c('0x47')]['id'];}return db['Pause'][_0xb20c('0x45')]({'where':{'id':_0x2e1bce[_0xb20c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2db990,null))['then'](saveUpdates(_0x2e1bce[_0xb20c('0x47')],null))[_0xb20c('0x27')](respondWithResult(_0x2db990,null))[_0xb20c('0x41')](handleError(_0x2db990,null));};exports[_0xb20c('0x25')]=function(_0x356bed,_0x37a871){return db[_0xb20c('0x2b')][_0xb20c('0x45')]({'where':{'id':_0x356bed[_0xb20c('0x42')]['id']}})['then'](handleEntityNotFound(_0x37a871,null))[_0xb20c('0x27')](removeEntity(_0x37a871,null))[_0xb20c('0x41')](handleError(_0x37a871,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7381d77..d4fae94 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 _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xfecdd4,_0xf0c15e){var _0x27e792=function(_0x274fc1){while(--_0x274fc1){_0xfecdd4['push'](_0xfecdd4['shift']());}};_0x27e792(++_0xf0c15e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2a6afb,_0xe4ef5){_0x2a6afb=_0x2a6afb-0x0;var _0x47abdf=_0x1cb9[_0x2a6afb];return _0x47abdf;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x58d6f5,_0x52798d){var _0x956d00=function(_0x87dc8f){while(--_0x87dc8f){_0x58d6f5['push'](_0x58d6f5['shift']());}};_0x956d00(++_0x52798d);}(_0x814b,0x1a2));var _0xb814=function(_0x524ce0,_0x3670b2){_0x524ce0=_0x524ce0-0x0;var _0x38299f=_0x814b[_0x524ce0];return _0x38299f;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e6d89e6..73cdccc 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(_0x958fff,_0x468916){var _0x54a665=function(_0x38c6dd){while(--_0x38c6dd){_0x958fff['push'](_0x958fff['shift']());}};_0x54a665(++_0x468916);}(_0x7a54,0x106));var _0x47a5=function(_0x1fa6ea,_0x17ea9f){_0x1fa6ea=_0x1fa6ea-0x0;var _0x26a66c=_0x7a54[_0x1fa6ea];return _0x26a66c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2625ee,_0x57328e){var _0x572a02=function(_0x2295e0){while(--_0x2295e0){_0x2625ee['push'](_0x2625ee['shift']());}};_0x572a02(++_0x57328e);}(_0x7a54,0x106));var _0x47a5=function(_0x597698,_0x1d8f20){_0x597698=_0x597698-0x0;var _0x295ec7=_0x7a54[_0x597698];return _0x295ec7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 2228be3..97cc3ad 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 _0x5178=['root','server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','diskStorage','join'];(function(_0x5414e5,_0x37b3b9){var _0x5a4a6c=function(_0x5a899b){while(--_0x5a899b){_0x5414e5['push'](_0x5414e5['shift']());}};_0x5a4a6c(++_0x37b3b9);}(_0x5178,0x171));var _0x8517=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5178[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./plugin.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),controller[_0x8517('0xa')]);router[_0x8517('0x7')]('/:id',auth[_0x8517('0xb')](),controller['show']);router['get'](_0x8517('0xc'),auth[_0x8517('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x8517('0xd')]({'destination':function(_0x24172f,_0x203154,_0x3be6b0){_0x3be6b0(null,path[_0x8517('0xe')](config[_0x8517('0xf')],_0x8517('0x10')));},'filename':function(_0x12388f,_0x4b9768,_0x9c57de){_0x4b9768[_0x8517('0x11')]=_0x4b9768[_0x8517('0x11')][_0x8517('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9c57de(null,util[_0x8517('0x13')]('%s-%s%s',path[_0x8517('0x14')](_0x4b9768[_0x8517('0x11')],path[_0x8517('0x15')](_0x4b9768[_0x8517('0x11')])),Date[_0x8517('0x16')](),path[_0x8517('0x15')](_0x4b9768[_0x8517('0x11')])));}})});router[_0x8517('0x17')]('/',upload[_0x8517('0x18')](_0x8517('0x19')),controller[_0x8517('0x1a')]);router[_0x8517('0x17')]('/webhook',controller[_0x8517('0x1b')]);router[_0x8517('0x1c')](_0x8517('0x1d'),auth[_0x8517('0xb')](),controller[_0x8517('0x1e')]);router[_0x8517('0x1f')](_0x8517('0x1d'),auth['isAuthenticated'](),controller[_0x8517('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x55e0=['webhookPost','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','file','upload','/webhook'];(function(_0x5f741f,_0xfba059){var _0x20ec03=function(_0x3141b4){while(--_0x3141b4){_0x5f741f['push'](_0x5f741f['shift']());}};_0x20ec03(++_0xfba059);}(_0x55e0,0xdc));var _0x055e=function(_0x45c536,_0x52a556){_0x45c536=_0x45c536-0x0;var _0x10e06d=_0x55e0[_0x45c536];return _0x10e06d;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/webhook',controller[_0x055e('0xa')]);router[_0x055e('0x9')](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0xd')]);router['get'](_0x055e('0xe'),auth[_0x055e('0xc')](),controller[_0x055e('0xf')]);var upload=multer({'storage':multer[_0x055e('0x10')]({'destination':function(_0x238068,_0x5237d9,_0x56c78a){_0x56c78a(null,path[_0x055e('0x11')](config['root'],_0x055e('0x12')));},'filename':function(_0x466da3,_0x72d424,_0x101bc3){_0x72d424[_0x055e('0x13')]=_0x72d424[_0x055e('0x13')][_0x055e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101bc3(null,util['format'](_0x055e('0x15'),path[_0x055e('0x16')](_0x72d424[_0x055e('0x13')],path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])),Date['now'](),path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])));}})});router[_0x055e('0x18')]('/',upload['single'](_0x055e('0x19')),controller[_0x055e('0x1a')]);router[_0x055e('0x18')](_0x055e('0x1b'),controller[_0x055e('0x1c')]);router['put'](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0x1d')]);router[_0x055e('0x1e')]('/:id',auth[_0x055e('0xc')](),controller[_0x055e('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1b8a131..4078ee8 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 _0xeda8=['ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeda8,0xaf));var _0x8eda=function(_0x416d7c,_0x43b2dd){_0x416d7c=_0x416d7c-0x0;var _0x345bce=_0xeda8[_0x416d7c];return _0x345bce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8eda('0x0')]},'type':{'type':Sequelize[_0x8eda('0x1')](_0x8eda('0x2'),_0x8eda('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x8eda('0x0')],'comment':_0x8eda('0x4')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8eda('0x5')},'sidebar':{'type':Sequelize[_0x8eda('0x1')](_0x8eda('0x6'),'agentOnly',_0x8eda('0x7'),'never'),'defaultValue':_0x8eda('0x7'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x8eda('0x0')]},'adminUrl':{'type':Sequelize[_0x8eda('0x0')]},'agentUrl':{'type':Sequelize[_0x8eda('0x0')]},'scriptName':{'type':Sequelize[_0x8eda('0x0')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdec0=['STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x1e4c55,_0x1415eb){var _0x511ab5=function(_0x2958cb){while(--_0x2958cb){_0x1e4c55['push'](_0x1e4c55['shift']());}};_0x511ab5(++_0x1415eb);}(_0xdec0,0xbd));var _0x0dec=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xdec0[_0xdaab62];return _0x13d767;};'use strict';var Sequelize=require(_0x0dec('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dec('0x1')]},'type':{'type':Sequelize[_0x0dec('0x2')](_0x0dec('0x3'),_0x0dec('0x4'))},'description':{'type':Sequelize[_0x0dec('0x5')]},'version':{'type':Sequelize[_0x0dec('0x5')]},'path':{'type':Sequelize[_0x0dec('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x0dec('0x6')],'defaultValue':0x0,'comment':_0x0dec('0x7')},'sidebar':{'type':Sequelize[_0x0dec('0x2')]('adminOnly','agentOnly',_0x0dec('0x8'),'never'),'defaultValue':'always','comment':_0x0dec('0x9')},'icon':{'type':Sequelize[_0x0dec('0x1')]},'adminUrl':{'type':Sequelize[_0x0dec('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x0dec('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2853f80..f31fc5f 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 _0x7645=['isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','script','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','content-type','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Plugins','sendStatus','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','catch','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','dirname','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x7645,0xeb));var _0x5764=function(_0x3904b9,_0x3dc82d){_0x3904b9=_0x3904b9-0x0;var _0x5c44ec=_0x7645[_0x3904b9];return _0x5c44ec;};'use strict';var emlformat=require(_0x5764('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5764('0x1'));var jsonpatch=require(_0x5764('0x2'));var rp=require(_0x5764('0x3'));var moment=require(_0x5764('0x4'));var BPromise=require(_0x5764('0x5'));var Mustache=require('mustache');var util=require(_0x5764('0x6'));var path=require(_0x5764('0x7'));var sox=require(_0x5764('0x8'));var csv=require(_0x5764('0x9'));var ejs=require(_0x5764('0xa'));var fs=require('fs');var fs_extra=require(_0x5764('0xb'));var _=require('lodash');var squel=require(_0x5764('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5764('0xd'));var toCsv=require(_0x5764('0x9'));var querystring=require(_0x5764('0xe'));var Papa=require(_0x5764('0xf'));var extract=require(_0x5764('0x10'));var rimraf=require(_0x5764('0x11'));var archiver=require(_0x5764('0x12'));var Redis=require(_0x5764('0x13'));var authService=require(_0x5764('0x14'));var qs=require(_0x5764('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5764('0x16'));var logger=require(_0x5764('0x17'))(_0x5764('0x18'));var utils=require(_0x5764('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5764('0x1a'));var db=require(_0x5764('0x1b'))['db'];config['redis']=_[_0x5764('0x1c')](config[_0x5764('0x1d')],{'host':_0x5764('0x1e'),'port':0x18eb});var socket=require(_0x5764('0x1f'))(new Redis(config[_0x5764('0x1d')]));require(_0x5764('0x20'))[_0x5764('0x21')](socket);function respondWithStatusCode(_0x13e5cf,_0x2aecd5){_0x2aecd5=_0x2aecd5||0xcc;return function(_0x4cd3bf){if(_0x4cd3bf){return _0x13e5cf['sendStatus'](_0x2aecd5);}return _0x13e5cf[_0x5764('0x22')](_0x2aecd5)[_0x5764('0x23')]();};}function respondWithResult(_0xb6ebc0,_0x5d430e){_0x5d430e=_0x5d430e||0xc8;return function(_0x341975){if(_0x341975){return _0xb6ebc0[_0x5764('0x22')](_0x5d430e)[_0x5764('0x24')](_0x341975);}};}function respondWithFilteredResult(_0x2b85b1,_0xe082e7){return function(_0x139343){if(_0x139343){var _0x43983b=typeof _0xe082e7['offset']===_0x5764('0x25')&&typeof _0xe082e7['limit']==='undefined';var _0x47ca72=_0x139343[_0x5764('0x26')];var _0xae5bc0=_0x43983b?0x0:_0xe082e7[_0x5764('0x27')];var _0x320209=_0x43983b?_0x139343[_0x5764('0x26')]:_0xe082e7['offset']+_0xe082e7['limit'];var _0x33279e;if(_0x320209>=_0x47ca72){_0x320209=_0x47ca72;_0x33279e=0xc8;}else{_0x33279e=0xce;}_0x2b85b1[_0x5764('0x22')](_0x33279e);return _0x2b85b1[_0x5764('0x28')](_0x5764('0x29'),_0xae5bc0+'-'+_0x320209+'/'+_0x47ca72)[_0x5764('0x24')](_0x139343);}return null;};}function patchUpdates(_0x16cb0d){return function(_0x425433){try{jsonpatch[_0x5764('0x2a')](_0x425433,_0x16cb0d,!![]);}catch(_0x196e7e){return BPromise[_0x5764('0x2b')](_0x196e7e);}return _0x425433[_0x5764('0x2c')]();};}function saveUpdates(_0xea7a8a,_0x19749a){return function(_0x2f5256){if(_0x2f5256){return _0x2f5256[_0x5764('0x2d')](_0xea7a8a)[_0x5764('0x2e')](function(_0x5d685f){return _0x5d685f;});}return null;};}function removeEntity(_0x5c0a6b,_0x43e5b2){return function(_0x311fbe){if(_0x311fbe){return _0x311fbe[_0x5764('0x2f')]()[_0x5764('0x2e')](function(){var _0x5387a7=_0x311fbe['get']({'plain':!![]});var _0x563355=_0x5764('0x30');return db['UserProfileResource'][_0x5764('0x2f')]({'where':{'type':_0x563355,'resourceId':_0x5387a7['id']}})['then'](function(){return _0x311fbe;});})['then'](function(){_0x5c0a6b['status'](0xcc)[_0x5764('0x23')]();});}};}function handleEntityNotFound(_0x29e560,_0x35ff83){return function(_0xd922c5){if(!_0xd922c5){_0x29e560[_0x5764('0x31')](0x194);}return _0xd922c5;};}function handleError(_0x4357f5,_0x4e9206){_0x4e9206=_0x4e9206||0x1f4;return function(_0x37916e){logger[_0x5764('0x32')](_0x37916e[_0x5764('0x33')]);if(_0x37916e['name']){delete _0x37916e[_0x5764('0x34')];}_0x4357f5[_0x5764('0x22')](_0x4e9206)[_0x5764('0x35')](_0x37916e);};}exports[_0x5764('0x36')]=function(_0x2c4b11,_0x30c002){var _0x3b4382={},_0x3c6b55={},_0x49cb8f={'count':0x0,'rows':[]};var _0x17151c=_['map'](db[_0x5764('0x37')][_0x5764('0x38')],function(_0x5a7f8a){return{'name':_0x5a7f8a[_0x5764('0x39')],'type':_0x5a7f8a[_0x5764('0x3a')]['key']};});_0x3c6b55[_0x5764('0x3b')]=_['map'](_0x17151c,_0x5764('0x34'));_0x3c6b55[_0x5764('0x3c')]=_[_0x5764('0x3d')](_0x2c4b11['query']);_0x3c6b55[_0x5764('0x3e')]=_[_0x5764('0x3f')](_0x3c6b55[_0x5764('0x3b')],_0x3c6b55['query']);_0x3b4382[_0x5764('0x40')]=_['intersection'](_0x3c6b55[_0x5764('0x3b')],qs[_0x5764('0x41')](_0x2c4b11[_0x5764('0x3c')]['fields']));_0x3b4382['attributes']=_0x3b4382[_0x5764('0x40')]['length']?_0x3b4382[_0x5764('0x40')]:_0x3c6b55[_0x5764('0x3b')];if(!_0x2c4b11[_0x5764('0x3c')]['hasOwnProperty'](_0x5764('0x42'))){_0x3b4382['limit']=qs[_0x5764('0x43')](_0x2c4b11[_0x5764('0x3c')]['limit']);_0x3b4382[_0x5764('0x27')]=qs['offset'](_0x2c4b11[_0x5764('0x3c')][_0x5764('0x27')]);}_0x3b4382['order']=qs['sort'](_0x2c4b11[_0x5764('0x3c')][_0x5764('0x44')]);_0x3b4382[_0x5764('0x45')]=qs[_0x5764('0x3e')](_['pick'](_0x2c4b11[_0x5764('0x3c')],_0x3c6b55['filters']),_0x17151c);if(_0x2c4b11[_0x5764('0x3c')][_0x5764('0x46')]){_0x3b4382[_0x5764('0x45')]=_[_0x5764('0x47')](_0x3b4382[_0x5764('0x45')],{'$or':_[_0x5764('0x48')](_0x17151c,function(_0x379c02){if(_0x379c02[_0x5764('0x3a')]!==_0x5764('0x49')){var _0x755185={};_0x755185[_0x379c02[_0x5764('0x34')]]={'$like':'%'+_0x2c4b11[_0x5764('0x3c')][_0x5764('0x46')]+'%'};return _0x755185;}})});}_0x3b4382=_[_0x5764('0x47')]({},_0x3b4382,_0x2c4b11[_0x5764('0x4a')]);var _0x2d08ac={'where':_0x3b4382[_0x5764('0x45')]};return db['Plugin'][_0x5764('0x26')](_0x2d08ac)['then'](function(_0x2d1891){_0x49cb8f[_0x5764('0x26')]=_0x2d1891;if(_0x2c4b11[_0x5764('0x3c')][_0x5764('0x4b')]){_0x3b4382['include']=[{'all':!![]}];}return db['Plugin'][_0x5764('0x4c')](_0x3b4382);})[_0x5764('0x2e')](function(_0x104f03){_0x49cb8f[_0x5764('0x4d')]=_0x104f03;return _0x49cb8f;})['then'](respondWithFilteredResult(_0x30c002,_0x3b4382))['catch'](handleError(_0x30c002,null));};exports[_0x5764('0x4e')]=function(_0x3a7bbb,_0x5afdc7){var _0x543027={'raw':!![],'where':{'id':_0x3a7bbb[_0x5764('0x4f')]['id']}},_0x3de6e2={};_0x3de6e2[_0x5764('0x3b')]=_[_0x5764('0x3d')](db[_0x5764('0x37')]['rawAttributes']);_0x3de6e2['query']=_[_0x5764('0x3d')](_0x3a7bbb['query']);_0x3de6e2['filters']=_[_0x5764('0x3f')](_0x3de6e2[_0x5764('0x3b')],_0x3de6e2[_0x5764('0x3c')]);_0x543027[_0x5764('0x40')]=_['intersection'](_0x3de6e2[_0x5764('0x3b')],qs[_0x5764('0x41')](_0x3a7bbb[_0x5764('0x3c')][_0x5764('0x41')]));_0x543027[_0x5764('0x40')]=_0x543027['attributes'][_0x5764('0x50')]?_0x543027[_0x5764('0x40')]:_0x3de6e2['model'];if(_0x3a7bbb[_0x5764('0x3c')][_0x5764('0x4b')]){_0x543027[_0x5764('0x51')]=[{'all':!![]}];}_0x543027=_[_0x5764('0x47')]({},_0x543027,_0x3a7bbb['options']);return db['Plugin']['find'](_0x543027)[_0x5764('0x2e')](handleEntityNotFound(_0x5afdc7,null))[_0x5764('0x2e')](respondWithResult(_0x5afdc7,null))[_0x5764('0x52')](handleError(_0x5afdc7,null));};exports[_0x5764('0x53')]=function(_0x4746cf,_0x4b302f,_0x313727){return db[_0x5764('0x37')][_0x5764('0x54')]({'where':{'id':_0x4746cf['params']['id']},'attributes':[_0x5764('0x34'),_0x5764('0x7')],'raw':!![]})[_0x5764('0x2e')](handleEntityNotFound(_0x4b302f,null))[_0x5764('0x2e')](function(_0x163c2f){if(_0x163c2f){var _0x102d56=path[_0x5764('0x55')](config[_0x5764('0x56')],_0x5764('0x57'),util[_0x5764('0x58')](_0x5764('0x59'),path[_0x5764('0x5a')](_0x163c2f[_0x5764('0x7')])));var _0x5e172a=fs[_0x5764('0x5b')](_0x102d56);var _0x5ecc86=archiver(_0x5764('0x5c'),{'zlib':{'level':0x9}});_0x5ecc86['on'](_0x5764('0x5d'),function(_0x490f85){if(_0x490f85[_0x5764('0x5e')]==='ENOENT'){logger['error'](_0x490f85);}else{throw new db['Sequelize']['Error'](_0x5764('0x5f'));}});_0x5ecc86['on'](_0x5764('0x32'),function(_0x42428f){throw new db[(_0x5764('0x60'))][(_0x5764('0x61'))](_0x5764('0x5f'));});_0x5ecc86[_0x5764('0x62')](_0x5e172a);_0x5ecc86[_0x5764('0x63')]('**/*',{'cwd':path['join'](config[_0x5764('0x56')],_0x5764('0x57'),path[_0x5764('0x64')](_0x163c2f['path'])),'ignore':[path['join'](path[_0x5764('0x5a')](_0x163c2f[_0x5764('0x7')]),_0x5764('0x65')),path[_0x5764('0x55')](path['basename'](_0x163c2f[_0x5764('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x5e172a['on'](_0x5764('0x66'),function(){if(!fs[_0x5764('0x67')](_0x102d56)){throw new db[(_0x5764('0x60'))][(_0x5764('0x61'))](_0x5764('0x68'));}return _0x4b302f[_0x5764('0x53')](_0x102d56,util[_0x5764('0x58')]('%s.zip',path[_0x5764('0x5a')](_0x163c2f[_0x5764('0x7')])),function(_0xe96168){if(_0xe96168){throw new db[(_0x5764('0x60'))][(_0x5764('0x61'))](_0x5764('0x69'));}fs[_0x5764('0x6a')](_0x102d56);logger[_0x5764('0x6b')](_0x5764('0x6c'));logger[_0x5764('0x6b')](_0x5764('0x6d'));});});}return null;})[_0x5764('0x52')](handleError(_0x4b302f,null));};exports[_0x5764('0x6e')]=function(_0x5c49c4,_0x23430b,_0x21470f){var _0x39e0a6=path['basename'](_0x5c49c4[_0x5764('0x6f')]['filename'],path[_0x5764('0x70')](_0x5c49c4[_0x5764('0x6f')][_0x5764('0x71')]));var _0x28203a=path['join'](config['root'],_0x5764('0x57'),_0x5c49c4['file'][_0x5764('0x71')]);var _0x432674=path['join'](config[_0x5764('0x56')],_0x5764('0x57'),_0x39e0a6);logger[_0x5764('0x6b')]('Plugin\x20upload\x20filepath:\x20%s',_0x28203a);logger[_0x5764('0x6b')](_0x5764('0x72'),_0x432674);try{fs[_0x5764('0x73')](_0x28203a,parseInt(_0x5764('0x74'),0x8));extract(_0x28203a,{'dir':_0x432674},function(_0x33c858){if(_0x33c858){logger['error'](_0x33c858);handleError(_0x33c858,!![]);};var _0x2f09e4=fs[_0x5764('0x75')](_0x432674);if(_0x2f09e4[_0x5764('0x50')]>0x1){removeReferences(_0x28203a,_0x432674);logger[_0x5764('0x32')](_0x5764('0x76'));return _0x21470f(new Error(_0x5764('0x76')));}var _0x4bdec8=fs[_0x5764('0x77')](path[_0x5764('0x55')](_0x432674,_0x2f09e4[0x0]));if(_0x4bdec8[_0x5764('0x78')]()){removeReferences(_0x28203a,_0x432674);logger[_0x5764('0x32')](_0x5764('0x76'));return _0x21470f(new Error(_0x5764('0x76')));}if(_0x4bdec8[_0x5764('0x79')]()){var _0x5bba59=fs[_0x5764('0x75')](path[_0x5764('0x55')](_0x432674,_0x2f09e4[0x0]));if(_0x5bba59['length']===0x0){removeReferences(_0x28203a,_0x432674);logger[_0x5764('0x32')](_0x5764('0x76'));return _0x21470f(new Error(_0x5764('0x76')));}var _0x2efe58=_0x5bba59['some'](function(_0x4c8c27){return _0x4c8c27===_0x5764('0x7a');});if(!_0x2efe58){return _0x21470f(new Error(_0x5764('0x7b')));}var _0x542034=fs[_0x5764('0x7c')](path[_0x5764('0x55')](_0x432674,_0x2f09e4[0x0],_0x5764('0x7a')));var _0x136db2=JSON[_0x5764('0x7d')](_0x542034);if(_0x5764('0x25')==typeof _0x136db2[_0x5764('0x34')]){return _0x21470f(new Error(_0x5764('0x7e')));}if(_0x5764('0x25')==typeof _0x136db2[_0x5764('0x3a')]){return _0x21470f(new Error(_0x5764('0x7f')));}if(_0x5764('0x25')==typeof _0x136db2['version']){return _0x21470f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x5764('0x25')==typeof _0x136db2[_0x5764('0x80')]){return _0x21470f(new Error(_0x5764('0x81')));}if(_0x136db2[_0x5764('0x3a')]===_0x5764('0x82')){if(_0x5764('0x25')==typeof _0x136db2[_0x5764('0x80')][_0x5764('0x83')]){return _0x21470f(new Error(_0x5764('0x84')));}if(_0x5764('0x25')==typeof _0x136db2['parameters'][_0x5764('0x83')][_0x5764('0x85')]&&_0x5764('0x25')==typeof _0x136db2[_0x5764('0x80')]['views'][_0x5764('0x86')]){return _0x21470f(new Error(_0x5764('0x87')));}}else if(_0x136db2['type']==='script'){if(_0x5764('0x25')==typeof _0x136db2[_0x5764('0x80')][_0x5764('0x88')]){return _0x21470f(new Error(_0x5764('0x89')));}if('undefined'==typeof _0x136db2[_0x5764('0x80')][_0x5764('0x8a')]){return _0x21470f(new Error(_0x5764('0x8b')));}}else{return _0x21470f(new Error(_0x5764('0x8c')));}var _0x4c801a=_0x136db2[_0x5764('0x34')];var _0x40bf03=_0x136db2[_0x5764('0x8d')];var _0xb255d0=_0x136db2['type'];var _0xf259e=_0x136db2[_0x5764('0x8e')]?_0x136db2[_0x5764('0x8e')]:_0x5764('0x8f');var _0x49c531=_0x136db2[_0x5764('0x90')]?_0x136db2[_0x5764('0x90')]:'icon-apps';var _0x167387='';var _0x56e28b='';var _0x24287e='';var _0x512660='';var _0xd18638=_0x136db2['version'];if(_0xb255d0===_0x5764('0x82')){if(_0x5764('0x25')!=typeof _0x136db2[_0x5764('0x80')][_0x5764('0x83')]['admin']){var _0x500593=_0x136db2['parameters'][_0x5764('0x83')][_0x5764('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x500593)){_0x167387=path['join'](_0x5764('0x91'),_0x39e0a6,_0x2f09e4[0x0],_0x500593);}else{_0x167387=_0x500593;}}else{logger['info'](_0x5764('0x92'));}if(_0x5764('0x25')!=typeof _0x136db2['parameters'][_0x5764('0x83')][_0x5764('0x86')]){var _0xb348a=_0x136db2[_0x5764('0x80')][_0x5764('0x83')][_0x5764('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x5764('0x93')](_0xb348a)){_0x56e28b=path['join'](_0x5764('0x91'),_0x39e0a6,_0x2f09e4[0x0],_0xb348a);}else{_0x56e28b=_0xb348a;}}else{logger[_0x5764('0x6b')](_0x5764('0x94'));}}else if(_0xb255d0===_0x5764('0x95')){_0x24287e=_0x136db2[_0x5764('0x80')][_0x5764('0x88')];_0x512660=_0x136db2['parameters'][_0x5764('0x8a')];if(_0x5764('0x25')!=typeof _0x136db2['parameters'][_0x5764('0x83')]){if(_0x5764('0x25')!=typeof _0x136db2[_0x5764('0x80')]['views']['admin']){var _0x500593=_0x136db2[_0x5764('0x80')][_0x5764('0x83')][_0x5764('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x5764('0x93')](_0x500593)){_0x167387=path[_0x5764('0x55')](_0x5764('0x91'),_0x39e0a6,_0x2f09e4[0x0],_0x500593);}else{_0x167387=_0x500593;}}if(_0x5764('0x25')!=typeof _0x136db2[_0x5764('0x80')]['views'][_0x5764('0x86')]){var _0xb348a=_0x136db2[_0x5764('0x80')][_0x5764('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0xb348a)){_0x56e28b=path[_0x5764('0x55')](_0x5764('0x91'),_0x39e0a6,_0x2f09e4[0x0],_0xb348a);}else{_0x56e28b=_0xb348a;}}}}var _0x8e4ea3={'name':_0x4c801a,'description':_0x40bf03,'path':path[_0x5764('0x55')](_0x39e0a6,_0x2f09e4[0x0]),'type':_0xb255d0,'sidebar':_0xf259e,'icon':_0x49c531,'adminUrl':_0x167387,'agentUrl':_0x56e28b,'scriptName':_0x24287e,'scriptPath':_0x512660,'version':_0xd18638};removeReferences(_0x28203a,null);return db[_0x5764('0x37')]['create'](_0x8e4ea3)[_0x5764('0x2e')](function(_0x28584d){var _0x35009d={'role':_0x5c49c4[_0x5764('0x96')]['role'],'userProfileId':_0x5c49c4['body'][_0x5764('0x97')]};if(!_0x35009d)throw new Error(_0x5764('0x98'));if(_0x35009d[_0x5764('0x99')]===_0x5764('0x9a')){var _0x238ada=_0x28584d['get']({'plain':!![]});return db[_0x5764('0x9b')][_0x5764('0x54')]({'where':{'name':'Plugins','userProfileId':_0x35009d[_0x5764('0x97')]},'raw':!![]})[_0x5764('0x2e')](function(_0xcd3bff){if(_0xcd3bff&&_0xcd3bff[_0x5764('0x9c')]===0x0){return db[_0x5764('0x9d')][_0x5764('0x9e')]({'name':_0x238ada[_0x5764('0x34')],'resourceId':_0x238ada['id'],'type':_0xcd3bff[_0x5764('0x34')],'sectionId':_0xcd3bff['id']},{})['then'](function(){return _0x28584d;});}else{return _0x28584d;}})[_0x5764('0x52')](function(_0x110b5b){logger[_0x5764('0x32')](_0x5764('0x9f'),_0x110b5b);throw _0x110b5b;});}return _0x28584d;})[_0x5764('0x2e')](respondWithResult(_0x23430b,null))['catch'](handleError(_0x23430b,null));}});}catch(_0x4b9ca4){_0x23430b[_0x5764('0x22')](0x1f4)['send'](_0x4b9ca4);}};function removeReferences(_0x28f42f,_0x457402){try{if(_0x28f42f){fs[_0x5764('0x6a')](_0x28f42f);logger['info'](_0x5764('0xa0'));}if(_0x457402){rimraf(_0x457402,function(){});logger[_0x5764('0x6b')](_0x5764('0xa1'));}}catch(_0x1c57d8){logger['error'](_0x1c57d8);}}exports[_0x5764('0x2d')]=function(_0x7a70a7,_0x3eada2,_0x35ba1b){return db[_0x5764('0x37')][_0x5764('0x54')]({'where':{'id':_0x7a70a7[_0x5764('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3eada2,null))['then'](saveUpdates(_0x7a70a7[_0x5764('0x96')],null))['then'](respondWithResult(_0x3eada2,null))[_0x5764('0x52')](handleError(_0x3eada2,null));};exports[_0x5764('0xa2')]=function(_0x4383f8,_0x1b6d34,_0x576461){return db[_0x5764('0x37')]['find']({'where':{'id':_0x4383f8[_0x5764('0x4f')]['id']}})[_0x5764('0x2e')](function(_0x1ced8f){if(_0x1ced8f){return _0x1ced8f[_0x5764('0x2f')]();}})[_0x5764('0x2e')](function(_0x44deca){rimraf(path['join'](config[_0x5764('0x56')],_0x5764('0x57'),path['dirname'](_0x44deca[_0x5764('0x7')])),function(){});return _0x44deca;})[_0x5764('0x2e')](handleEntityNotFound(_0x1b6d34,null))[_0x5764('0x2e')](respondWithStatusCode(_0x1b6d34,null))['catch'](handleError(_0x1b6d34,null));};exports['webhookGet']=function(_0x59b63e,_0x5d35f6,_0x4ae4a9){return BPromise[_0x5764('0xa3')]()['then'](function(){if(!_0x59b63e['query'][_0x5764('0x7')]){throw new Error(_0x5764('0xa4'));}if(!_0x59b63e[_0x5764('0x3c')][_0x5764('0xa5')]){throw new Error(_0x5764('0xa6'));}var _0x5e12ab=_0x59b63e[_0x5764('0x3c')][_0x5764('0xa7')]?_0x59b63e[_0x5764('0x3c')][_0x5764('0xa7')]+':'+_0x59b63e[_0x5764('0x3c')]['port']:_0x5764('0xa8')+_0x59b63e['query'][_0x5764('0xa5')];var _0x1ac34f=_0x59b63e[_0x5764('0x3c')][_0x5764('0x24')]?_0x59b63e[_0x5764('0x3c')][_0x5764('0x24')]:!![];var _0x39dd44=_0x59b63e[_0x5764('0x3c')][_0x5764('0xa9')]?_0x59b63e['query']['encoding']:null;var _0x2d04a2={'method':_0x59b63e[_0x5764('0xaa')],'uri':util[_0x5764('0x58')](_0x5764('0xab'),_0x5e12ab,_0x59b63e[_0x5764('0x3c')]['path']),'json':_0x1ac34f,'resolveWithFullResponse':!![],'encoding':_0x39dd44,'qs':_0x59b63e[_0x5764('0x3c')]};if(_0x59b63e[_0x5764('0xac')]){_0x2d04a2[_0x5764('0xac')]=_0x59b63e[_0x5764('0xac')];if(_0x2d04a2[_0x5764('0xac')][_0x5764('0xad')]){delete _0x2d04a2[_0x5764('0xac')]['content-length'];}}if(_0x2d04a2[_0x5764('0xac')]['content-type']){delete _0x2d04a2[_0x5764('0xac')]['content-type'];}return rp(_0x2d04a2);})[_0x5764('0x2e')](function(_0x27eccb){if(_0x27eccb){_0x5d35f6['set'](_0x27eccb[_0x5764('0xac')]);logger[_0x5764('0x6b')](_0x27eccb['body']);if(_[_0x5764('0xae')](_0x59b63e[_0x5764('0x3c')]['path'],'download')&&_0x27eccb['statusCode']==0x1f4){return _0x5d35f6[_0x5764('0x31')](_0x27eccb[_0x5764('0xaf')]);}else{return _0x5d35f6[_0x5764('0x22')](_0x27eccb['statusCode'])[_0x5764('0x35')](_0x27eccb['body']);}}else{return _0x5d35f6[_0x5764('0x31')](0xc8);}})['catch'](handleError(_0x5d35f6,null));};exports[_0x5764('0xb0')]=function(_0x6646db,_0x13c472,_0x2736aa){return BPromise[_0x5764('0xa3')]()[_0x5764('0x2e')](function(){if(!_0x6646db[_0x5764('0x3c')][_0x5764('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x6646db[_0x5764('0x3c')][_0x5764('0xa5')]){throw new Error(_0x5764('0xa6'));}var _0x1e0d1e=_0x6646db[_0x5764('0x3c')]['hostname']?_0x6646db[_0x5764('0x3c')][_0x5764('0xa7')]+':'+_0x6646db['query']['port']:'http://localhost:'+_0x6646db[_0x5764('0x3c')]['port'];var _0x133303=_0x6646db[_0x5764('0x3c')]['json']?_0x6646db['query']['json']:!![];var _0x1c0105=_0x6646db[_0x5764('0x3c')][_0x5764('0xa9')]?_0x6646db[_0x5764('0x3c')][_0x5764('0xa9')]:null;var _0x1edde0={'method':_0x6646db[_0x5764('0xaa')],'uri':util[_0x5764('0x58')](_0x5764('0xab'),_0x1e0d1e,_0x6646db[_0x5764('0x3c')]['path']),'json':_0x133303,'resolveWithFullResponse':!![],'encoding':_0x1c0105,'body':_0x6646db[_0x5764('0x96')]};if(_0x6646db[_0x5764('0xac')]){_0x1edde0[_0x5764('0xac')]=_0x6646db[_0x5764('0xac')];if(_0x1edde0['headers'][_0x5764('0xad')]){delete _0x1edde0['headers'][_0x5764('0xad')];}}if(_0x1edde0[_0x5764('0xac')][_0x5764('0xb1')]){delete _0x1edde0[_0x5764('0xac')][_0x5764('0xb1')];}return rp(_0x1edde0);})[_0x5764('0x2e')](function(_0x1d1c66){if(_0x1d1c66){_0x13c472[_0x5764('0x28')](_0x1d1c66[_0x5764('0xac')]);logger['info'](_0x1d1c66[_0x5764('0x96')]);return _0x13c472['status'](_0x1d1c66['statusCode'])[_0x5764('0x35')](_0x1d1c66[_0x5764('0x96')]);}else{return _0x13c472[_0x5764('0x31')](0xc8);}})[_0x5764('0x52')](handleError(_0x13c472,null));}; \ No newline at end of file +var _0x313e=['status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','find','download','join','root','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','info','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus'];(function(_0x402d56,_0x242183){var _0x167f2f=function(_0x57781f){while(--_0x57781f){_0x402d56['push'](_0x402d56['shift']());}};_0x167f2f(++_0x242183);}(_0x313e,0x135));var _0xe313=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0x313e[_0x5805d7];return _0x170fe4;};'use strict';var emlformat=require(_0xe313('0x0'));var rimraf=require(_0xe313('0x1'));var zipdir=require(_0xe313('0x2'));var jsonpatch=require(_0xe313('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe313('0x4'));var sox=require(_0xe313('0x5'));var csv=require(_0xe313('0x6'));var ejs=require(_0xe313('0x7'));var fs=require('fs');var fs_extra=require(_0xe313('0x8'));var _=require(_0xe313('0x9'));var squel=require(_0xe313('0xa'));var crypto=require(_0xe313('0xb'));var jsforce=require(_0xe313('0xc'));var deskjs=require(_0xe313('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe313('0xe'));var Papa=require(_0xe313('0xf'));var extract=require(_0xe313('0x10'));var rimraf=require(_0xe313('0x1'));var archiver=require(_0xe313('0x11'));var Redis=require('ioredis');var authService=require(_0xe313('0x12'));var qs=require(_0xe313('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe313('0x14'));var logger=require(_0xe313('0x15'))(_0xe313('0x16'));var utils=require('../../config/utils');var config=require(_0xe313('0x17'));var licenseUtil=require(_0xe313('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xe313('0x19')],{'host':_0xe313('0x1a'),'port':0x18eb});var socket=require(_0xe313('0x1b'))(new Redis(config[_0xe313('0x19')]));require(_0xe313('0x1c'))[_0xe313('0x1d')](socket);function respondWithStatusCode(_0x587604,_0x5d1aa5){_0x5d1aa5=_0x5d1aa5||0xcc;return function(_0x1521b0){if(_0x1521b0){return _0x587604[_0xe313('0x1e')](_0x5d1aa5);}return _0x587604[_0xe313('0x1f')](_0x5d1aa5)[_0xe313('0x20')]();};}function respondWithResult(_0x3b2af2,_0x99d2ed){_0x99d2ed=_0x99d2ed||0xc8;return function(_0x281e7a){if(_0x281e7a){return _0x3b2af2[_0xe313('0x1f')](_0x99d2ed)[_0xe313('0x21')](_0x281e7a);}};}function respondWithFilteredResult(_0x5c55d3,_0x2431ee){return function(_0x4b027b){if(_0x4b027b){var _0x8ad6f5=typeof _0x2431ee[_0xe313('0x22')]===_0xe313('0x23')&&typeof _0x2431ee[_0xe313('0x24')]===_0xe313('0x23');var _0x4ec723=_0x4b027b[_0xe313('0x25')];var _0x3fe6a9=_0x8ad6f5?0x0:_0x2431ee[_0xe313('0x22')];var _0x1a5699=_0x8ad6f5?_0x4b027b[_0xe313('0x25')]:_0x2431ee['offset']+_0x2431ee['limit'];var _0x240110;if(_0x1a5699>=_0x4ec723){_0x1a5699=_0x4ec723;_0x240110=0xc8;}else{_0x240110=0xce;}_0x5c55d3[_0xe313('0x1f')](_0x240110);return _0x5c55d3[_0xe313('0x26')]('Content-Range',_0x3fe6a9+'-'+_0x1a5699+'/'+_0x4ec723)[_0xe313('0x21')](_0x4b027b);}return null;};}function patchUpdates(_0x37b55a){return function(_0x2a3fd0){try{jsonpatch[_0xe313('0x27')](_0x2a3fd0,_0x37b55a,!![]);}catch(_0x139a40){return BPromise[_0xe313('0x28')](_0x139a40);}return _0x2a3fd0[_0xe313('0x29')]();};}function saveUpdates(_0x4f190c,_0x445b4a){return function(_0x374dc9){if(_0x374dc9){return _0x374dc9['update'](_0x4f190c)['then'](function(_0x298e34){return _0x298e34;});}return null;};}function removeEntity(_0x1b58cd,_0xc5662a){return function(_0x23e277){if(_0x23e277){return _0x23e277[_0xe313('0x2a')]()[_0xe313('0x2b')](function(){var _0x330a5b=_0x23e277[_0xe313('0x2c')]({'plain':!![]});var _0x1f7b6a=_0xe313('0x2d');return db[_0xe313('0x2e')]['destroy']({'where':{'type':_0x1f7b6a,'resourceId':_0x330a5b['id']}})[_0xe313('0x2b')](function(){return _0x23e277;});})[_0xe313('0x2b')](function(){_0x1b58cd['status'](0xcc)[_0xe313('0x20')]();});}};}function handleEntityNotFound(_0x3f7133,_0x2cc896){return function(_0x5533dc){if(!_0x5533dc){_0x3f7133[_0xe313('0x1e')](0x194);}return _0x5533dc;};}function handleError(_0x4512f2,_0x4cafa8){_0x4cafa8=_0x4cafa8||0x1f4;return function(_0x4362f1){logger[_0xe313('0x2f')](_0x4362f1[_0xe313('0x30')]);if(_0x4362f1[_0xe313('0x31')]){delete _0x4362f1[_0xe313('0x31')];}_0x4512f2['status'](_0x4cafa8)[_0xe313('0x32')](_0x4362f1);};}exports[_0xe313('0x33')]=function(_0x394f78,_0x23c8c5){var _0x2e9bd5={},_0x196dcc={},_0x12d00b={'count':0x0,'rows':[]};var _0xa17e25=_['map'](db[_0xe313('0x34')]['rawAttributes'],function(_0x3c4092){return{'name':_0x3c4092[_0xe313('0x35')],'type':_0x3c4092[_0xe313('0x36')][_0xe313('0x37')]};});_0x196dcc[_0xe313('0x38')]=_[_0xe313('0x39')](_0xa17e25,_0xe313('0x31'));_0x196dcc[_0xe313('0x3a')]=_[_0xe313('0x3b')](_0x394f78[_0xe313('0x3a')]);_0x196dcc[_0xe313('0x3c')]=_[_0xe313('0x3d')](_0x196dcc['model'],_0x196dcc[_0xe313('0x3a')]);_0x2e9bd5[_0xe313('0x3e')]=_[_0xe313('0x3d')](_0x196dcc[_0xe313('0x38')],qs[_0xe313('0x3f')](_0x394f78[_0xe313('0x3a')][_0xe313('0x3f')]));_0x2e9bd5[_0xe313('0x3e')]=_0x2e9bd5[_0xe313('0x3e')][_0xe313('0x40')]?_0x2e9bd5[_0xe313('0x3e')]:_0x196dcc[_0xe313('0x38')];if(!_0x394f78[_0xe313('0x3a')][_0xe313('0x41')](_0xe313('0x42'))){_0x2e9bd5[_0xe313('0x24')]=qs[_0xe313('0x24')](_0x394f78[_0xe313('0x3a')]['limit']);_0x2e9bd5['offset']=qs[_0xe313('0x22')](_0x394f78['query'][_0xe313('0x22')]);}_0x2e9bd5[_0xe313('0x43')]=qs['sort'](_0x394f78[_0xe313('0x3a')]['sort']);_0x2e9bd5[_0xe313('0x44')]=qs[_0xe313('0x3c')](_['pick'](_0x394f78[_0xe313('0x3a')],_0x196dcc['filters']),_0xa17e25);if(_0x394f78['query'][_0xe313('0x45')]){_0x2e9bd5['where']=_[_0xe313('0x46')](_0x2e9bd5[_0xe313('0x44')],{'$or':_['map'](_0xa17e25,function(_0x188f3d){if(_0x188f3d[_0xe313('0x36')]!==_0xe313('0x47')){var _0x2949aa={};_0x2949aa[_0x188f3d[_0xe313('0x31')]]={'$like':'%'+_0x394f78[_0xe313('0x3a')][_0xe313('0x45')]+'%'};return _0x2949aa;}})});}_0x2e9bd5=_['merge']({},_0x2e9bd5,_0x394f78[_0xe313('0x48')]);var _0xd03b4={'where':_0x2e9bd5['where']};return db[_0xe313('0x34')][_0xe313('0x25')](_0xd03b4)[_0xe313('0x2b')](function(_0x4c8ff2){_0x12d00b[_0xe313('0x25')]=_0x4c8ff2;if(_0x394f78[_0xe313('0x3a')][_0xe313('0x49')]){_0x2e9bd5[_0xe313('0x4a')]=[{'all':!![]}];}return db[_0xe313('0x34')]['findAll'](_0x2e9bd5);})[_0xe313('0x2b')](function(_0x294dee){_0x12d00b['rows']=_0x294dee;return _0x12d00b;})[_0xe313('0x2b')](respondWithFilteredResult(_0x23c8c5,_0x2e9bd5))[_0xe313('0x4b')](handleError(_0x23c8c5,null));};exports['show']=function(_0x54dea6,_0xd620ac){var _0x3b20f0={'raw':!![],'where':{'id':_0x54dea6[_0xe313('0x4c')]['id']}},_0x2e1828={};_0x2e1828['model']=_[_0xe313('0x3b')](db['Plugin'][_0xe313('0x4d')]);_0x2e1828[_0xe313('0x3a')]=_[_0xe313('0x3b')](_0x54dea6['query']);_0x2e1828[_0xe313('0x3c')]=_[_0xe313('0x3d')](_0x2e1828[_0xe313('0x38')],_0x2e1828[_0xe313('0x3a')]);_0x3b20f0['attributes']=_[_0xe313('0x3d')](_0x2e1828[_0xe313('0x38')],qs[_0xe313('0x3f')](_0x54dea6[_0xe313('0x3a')][_0xe313('0x3f')]));_0x3b20f0['attributes']=_0x3b20f0[_0xe313('0x3e')][_0xe313('0x40')]?_0x3b20f0[_0xe313('0x3e')]:_0x2e1828[_0xe313('0x38')];if(_0x54dea6['query'][_0xe313('0x49')]){_0x3b20f0[_0xe313('0x4a')]=[{'all':!![]}];}_0x3b20f0=_['merge']({},_0x3b20f0,_0x54dea6['options']);return db[_0xe313('0x34')][_0xe313('0x4e')](_0x3b20f0)['then'](handleEntityNotFound(_0xd620ac,null))[_0xe313('0x2b')](respondWithResult(_0xd620ac,null))['catch'](handleError(_0xd620ac,null));};exports[_0xe313('0x4f')]=function(_0x17e51a,_0x1caed1,_0x12d6d8){return db[_0xe313('0x34')]['find']({'where':{'id':_0x17e51a[_0xe313('0x4c')]['id']},'attributes':[_0xe313('0x31'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x1caed1,null))['then'](function(_0xccfe1c){if(_0xccfe1c){var _0x34e1ce=path[_0xe313('0x50')](config[_0xe313('0x51')],'server/files/plugins',util[_0xe313('0x52')](_0xe313('0x53'),path[_0xe313('0x54')](_0xccfe1c[_0xe313('0x4')])));var _0x469f41=fs[_0xe313('0x55')](_0x34e1ce);var _0x4de60c=archiver('zip',{'zlib':{'level':0x9}});_0x4de60c['on'](_0xe313('0x56'),function(_0x3b75e1){if(_0x3b75e1[_0xe313('0x57')]===_0xe313('0x58')){logger[_0xe313('0x2f')](_0x3b75e1);}else{throw new db[(_0xe313('0x59'))][(_0xe313('0x5a'))](_0xe313('0x5b'));}});_0x4de60c['on'](_0xe313('0x2f'),function(_0x4ba5ae){throw new db[(_0xe313('0x59'))][(_0xe313('0x5a'))](_0xe313('0x5b'));});_0x4de60c[_0xe313('0x5c')](_0x469f41);_0x4de60c[_0xe313('0x5d')](_0xe313('0x5e'),{'cwd':path[_0xe313('0x50')](config['root'],_0xe313('0x5f'),path[_0xe313('0x60')](_0xccfe1c[_0xe313('0x4')])),'ignore':[path[_0xe313('0x50')](path['basename'](_0xccfe1c[_0xe313('0x4')]),'node_modules/**/*'),path['join'](path['basename'](_0xccfe1c[_0xe313('0x4')]),_0xe313('0x61'))],'nodir':!![]})[_0xe313('0x62')]();_0x469f41['on'](_0xe313('0x63'),function(){if(!fs[_0xe313('0x64')](_0x34e1ce)){throw new db['Sequelize'][(_0xe313('0x5a'))](_0xe313('0x65'));}return _0x1caed1['download'](_0x34e1ce,util[_0xe313('0x52')]('%s.zip',path['basename'](_0xccfe1c[_0xe313('0x4')])),function(_0xc29b1f){if(_0xc29b1f){throw new db[(_0xe313('0x59'))][(_0xe313('0x5a'))](_0xe313('0x66'));}fs[_0xe313('0x67')](_0x34e1ce);logger['info'](_0xe313('0x68'));logger['info'](_0xe313('0x69'));});});}return null;})[_0xe313('0x4b')](handleError(_0x1caed1,null));};exports[_0xe313('0x6a')]=function(_0x221db3,_0x5990e9,_0x49c533){var _0x5a7bb0=path['basename'](_0x221db3[_0xe313('0x6b')]['filename'],path[_0xe313('0x6c')](_0x221db3[_0xe313('0x6b')][_0xe313('0x6d')]));var _0xc92fc2=path[_0xe313('0x50')](config[_0xe313('0x51')],_0xe313('0x5f'),_0x221db3[_0xe313('0x6b')][_0xe313('0x6d')]);var _0x397e5a=path[_0xe313('0x50')](config[_0xe313('0x51')],_0xe313('0x5f'),_0x5a7bb0);logger[_0xe313('0x6e')](_0xe313('0x6f'),_0xc92fc2);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x397e5a);try{fs[_0xe313('0x70')](_0xc92fc2,parseInt(_0xe313('0x71'),0x8));extract(_0xc92fc2,{'dir':_0x397e5a},function(_0x427a93){if(_0x427a93){logger[_0xe313('0x2f')](_0x427a93);handleError(_0x427a93,!![]);};var _0x50d3ae=fs['readdirSync'](_0x397e5a);if(_0x50d3ae['length']>0x1){removeReferences(_0xc92fc2,_0x397e5a);logger[_0xe313('0x2f')](_0xe313('0x72'));return _0x49c533(new Error('Invalid\x20plugin\x20structure'));}var _0x3772b3=fs['lstatSync'](path[_0xe313('0x50')](_0x397e5a,_0x50d3ae[0x0]));if(_0x3772b3[_0xe313('0x73')]()){removeReferences(_0xc92fc2,_0x397e5a);logger[_0xe313('0x2f')](_0xe313('0x72'));return _0x49c533(new Error('Invalid\x20plugin\x20structure'));}if(_0x3772b3[_0xe313('0x74')]()){var _0x49c581=fs['readdirSync'](path[_0xe313('0x50')](_0x397e5a,_0x50d3ae[0x0]));if(_0x49c581[_0xe313('0x40')]===0x0){removeReferences(_0xc92fc2,_0x397e5a);logger[_0xe313('0x2f')](_0xe313('0x72'));return _0x49c533(new Error('Invalid\x20plugin\x20structure'));}var _0x3ffd65=_0x49c581[_0xe313('0x75')](function(_0x5d53e5){return _0x5d53e5===_0xe313('0x76');});if(!_0x3ffd65){return _0x49c533(new Error(_0xe313('0x77')));}var _0x3ea9fe=fs[_0xe313('0x78')](path[_0xe313('0x50')](_0x397e5a,_0x50d3ae[0x0],_0xe313('0x76')));var _0x564d28=JSON['parse'](_0x3ea9fe);if('undefined'==typeof _0x564d28[_0xe313('0x31')]){return _0x49c533(new Error(_0xe313('0x79')));}if('undefined'==typeof _0x564d28[_0xe313('0x36')]){return _0x49c533(new Error(_0xe313('0x7a')));}if(_0xe313('0x23')==typeof _0x564d28[_0xe313('0x7b')]){return _0x49c533(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xe313('0x23')==typeof _0x564d28[_0xe313('0x7c')]){return _0x49c533(new Error(_0xe313('0x7d')));}if(_0x564d28[_0xe313('0x36')]===_0xe313('0x7e')){if(_0xe313('0x23')==typeof _0x564d28[_0xe313('0x7c')][_0xe313('0x7f')]){return _0x49c533(new Error(_0xe313('0x80')));}if(_0xe313('0x23')==typeof _0x564d28[_0xe313('0x7c')][_0xe313('0x7f')][_0xe313('0x81')]&&'undefined'==typeof _0x564d28[_0xe313('0x7c')][_0xe313('0x7f')]['agent']){return _0x49c533(new Error(_0xe313('0x82')));}}else if(_0x564d28['type']===_0xe313('0x83')){if(_0xe313('0x23')==typeof _0x564d28[_0xe313('0x7c')]['scriptName']){return _0x49c533(new Error(_0xe313('0x84')));}if(_0xe313('0x23')==typeof _0x564d28[_0xe313('0x7c')][_0xe313('0x85')]){return _0x49c533(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x49c533(new Error(_0xe313('0x86')));}var _0x33afaf=_0x564d28['name'];var _0x4a2a6a=_0x564d28['description'];var _0x399ec9=_0x564d28[_0xe313('0x36')];var _0x59ad3d=_0x564d28[_0xe313('0x87')]?_0x564d28[_0xe313('0x87')]:_0xe313('0x88');var _0x2e1d2a=_0x564d28[_0xe313('0x89')]?_0x564d28[_0xe313('0x89')]:_0xe313('0x8a');var _0x9fc02d='';var _0x29b867='';var _0x491e8c='';var _0x236295='';var _0x1ea74e=_0x564d28[_0xe313('0x7b')];if(_0x399ec9===_0xe313('0x7e')){if(_0xe313('0x23')!=typeof _0x564d28[_0xe313('0x7c')][_0xe313('0x7f')][_0xe313('0x81')]){var _0x4be6eb=_0x564d28[_0xe313('0x7c')]['views'][_0xe313('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xe313('0x8b')](_0x4be6eb)){_0x9fc02d=path[_0xe313('0x50')](_0xe313('0x8c'),_0x5a7bb0,_0x50d3ae[0x0],_0x4be6eb);}else{_0x9fc02d=_0x4be6eb;}}else{logger[_0xe313('0x6e')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xe313('0x23')!=typeof _0x564d28['parameters'][_0xe313('0x7f')]['agent']){var _0x5c5a59=_0x564d28[_0xe313('0x7c')]['views'][_0xe313('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xe313('0x8b')](_0x5c5a59)){_0x29b867=path[_0xe313('0x50')](_0xe313('0x8c'),_0x5a7bb0,_0x50d3ae[0x0],_0x5c5a59);}else{_0x29b867=_0x5c5a59;}}else{logger[_0xe313('0x6e')](_0xe313('0x8e'));}}else if(_0x399ec9===_0xe313('0x83')){_0x491e8c=_0x564d28[_0xe313('0x7c')][_0xe313('0x8f')];_0x236295=_0x564d28[_0xe313('0x7c')][_0xe313('0x85')];if(_0xe313('0x23')!=typeof _0x564d28[_0xe313('0x7c')][_0xe313('0x7f')]){if(_0xe313('0x23')!=typeof _0x564d28[_0xe313('0x7c')]['views'][_0xe313('0x81')]){var _0x4be6eb=_0x564d28[_0xe313('0x7c')]['views'][_0xe313('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xe313('0x8b')](_0x4be6eb)){_0x9fc02d=path[_0xe313('0x50')](_0xe313('0x8c'),_0x5a7bb0,_0x50d3ae[0x0],_0x4be6eb);}else{_0x9fc02d=_0x4be6eb;}}if(_0xe313('0x23')!=typeof _0x564d28[_0xe313('0x7c')][_0xe313('0x7f')][_0xe313('0x8d')]){var _0x5c5a59=_0x564d28[_0xe313('0x7c')][_0xe313('0x7f')][_0xe313('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0xe313('0x8b')](_0x5c5a59)){_0x29b867=path['join']('plugins',_0x5a7bb0,_0x50d3ae[0x0],_0x5c5a59);}else{_0x29b867=_0x5c5a59;}}}}var _0x1f596a={'name':_0x33afaf,'description':_0x4a2a6a,'path':path['join'](_0x5a7bb0,_0x50d3ae[0x0]),'type':_0x399ec9,'sidebar':_0x59ad3d,'icon':_0x2e1d2a,'adminUrl':_0x9fc02d,'agentUrl':_0x29b867,'scriptName':_0x491e8c,'scriptPath':_0x236295,'version':_0x1ea74e};removeReferences(_0xc92fc2,null);return db['Plugin'][_0xe313('0x90')](_0x1f596a)[_0xe313('0x2b')](function(_0x23d549){var _0x3549cc={'role':_0x221db3[_0xe313('0x91')][_0xe313('0x92')],'userProfileId':_0x221db3['body']['userProfileId']};if(!_0x3549cc)throw new Error(_0xe313('0x93'));if(_0x3549cc[_0xe313('0x92')]===_0xe313('0x94')){var _0x2f8ca9=_0x23d549[_0xe313('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0xe313('0x4e')]({'where':{'name':_0xe313('0x2d'),'userProfileId':_0x3549cc[_0xe313('0x95')]},'raw':!![]})[_0xe313('0x2b')](function(_0x1044f8){if(_0x1044f8&&_0x1044f8[_0xe313('0x96')]===0x0){return db[_0xe313('0x2e')][_0xe313('0x90')]({'name':_0x2f8ca9['name'],'resourceId':_0x2f8ca9['id'],'type':_0x1044f8['name'],'sectionId':_0x1044f8['id']},{})[_0xe313('0x2b')](function(){return _0x23d549;});}else{return _0x23d549;}})['catch'](function(_0x80aec4){logger[_0xe313('0x2f')](_0xe313('0x97'),_0x80aec4);throw _0x80aec4;});}return _0x23d549;})[_0xe313('0x2b')](respondWithResult(_0x5990e9,null))['catch'](handleError(_0x5990e9,null));}});}catch(_0x598b2f){_0x5990e9[_0xe313('0x1f')](0x1f4)[_0xe313('0x32')](_0x598b2f);}};function removeReferences(_0x332647,_0x224e6c){try{if(_0x332647){fs['unlinkSync'](_0x332647);logger[_0xe313('0x6e')](_0xe313('0x98'));}if(_0x224e6c){rimraf(_0x224e6c,function(){});logger[_0xe313('0x6e')](_0xe313('0x99'));}}catch(_0x469942){logger['error'](_0x469942);}}exports[_0xe313('0x9a')]=function(_0x1dc787,_0x1fcb32,_0x44294d){return db[_0xe313('0x34')][_0xe313('0x4e')]({'where':{'id':_0x1dc787[_0xe313('0x4c')]['id']}})[_0xe313('0x2b')](handleEntityNotFound(_0x1fcb32,null))[_0xe313('0x2b')](saveUpdates(_0x1dc787[_0xe313('0x91')],null))[_0xe313('0x2b')](respondWithResult(_0x1fcb32,null))[_0xe313('0x4b')](handleError(_0x1fcb32,null));};exports['delete']=function(_0x20bf01,_0x1374bd,_0x349eb8){return db[_0xe313('0x34')]['find']({'where':{'id':_0x20bf01[_0xe313('0x4c')]['id']}})[_0xe313('0x2b')](function(_0x5e4e14){if(_0x5e4e14){return _0x5e4e14[_0xe313('0x2a')]();}})[_0xe313('0x2b')](function(_0x19cfd9){rimraf(path[_0xe313('0x50')](config[_0xe313('0x51')],'server/files/plugins',path[_0xe313('0x60')](_0x19cfd9['path'])),function(){});return _0x19cfd9;})[_0xe313('0x2b')](handleEntityNotFound(_0x1374bd,null))[_0xe313('0x2b')](respondWithStatusCode(_0x1374bd,null))['catch'](handleError(_0x1374bd,null));};exports['webhookGet']=function(_0x4ac645,_0x4dc409,_0x20f36d){return BPromise[_0xe313('0x9b')]()[_0xe313('0x2b')](function(){if(!_0x4ac645['query'][_0xe313('0x4')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4ac645[_0xe313('0x3a')][_0xe313('0x9c')]){throw new Error(_0xe313('0x9d'));}var _0x26ff0a=_0x4ac645[_0xe313('0x3a')][_0xe313('0x9e')]?_0x4ac645[_0xe313('0x3a')][_0xe313('0x9e')]+':'+_0x4ac645[_0xe313('0x3a')][_0xe313('0x9c')]:_0xe313('0x9f')+_0x4ac645[_0xe313('0x3a')][_0xe313('0x9c')];var _0x3ba10c=_0x4ac645[_0xe313('0x3a')][_0xe313('0x21')]?_0x4ac645[_0xe313('0x3a')][_0xe313('0x21')]:!![];var _0xfa5ec0=_0x4ac645[_0xe313('0x3a')]['encoding']?_0x4ac645['query'][_0xe313('0xa0')]:null;var _0x4a9951={'method':_0x4ac645[_0xe313('0xa1')],'uri':util['format'](_0xe313('0xa2'),_0x26ff0a,_0x4ac645[_0xe313('0x3a')][_0xe313('0x4')]),'json':_0x3ba10c,'resolveWithFullResponse':!![],'encoding':_0xfa5ec0,'qs':_0x4ac645[_0xe313('0x3a')]};if(_0x4ac645[_0xe313('0xa3')]){_0x4a9951['headers']=_0x4ac645[_0xe313('0xa3')];if(_0x4a9951['headers'][_0xe313('0xa4')]){delete _0x4a9951['headers'][_0xe313('0xa4')];}}if(_0x4a9951['headers'][_0xe313('0xa5')]){delete _0x4a9951[_0xe313('0xa3')][_0xe313('0xa5')];}return rp(_0x4a9951);})[_0xe313('0x2b')](function(_0x469c8b){if(_0x469c8b){_0x4dc409[_0xe313('0x26')](_0x469c8b['headers']);logger[_0xe313('0x6e')](_0x469c8b[_0xe313('0x91')]);if(_[_0xe313('0xa6')](_0x4ac645[_0xe313('0x3a')][_0xe313('0x4')],_0xe313('0x4f'))&&_0x469c8b[_0xe313('0xa7')]==0x1f4){return _0x4dc409['sendStatus'](_0x469c8b[_0xe313('0xa7')]);}else{return _0x4dc409[_0xe313('0x1f')](_0x469c8b[_0xe313('0xa7')])[_0xe313('0x32')](_0x469c8b['body']);}}else{return _0x4dc409[_0xe313('0x1e')](0xc8);}})[_0xe313('0x4b')](handleError(_0x4dc409,null));};exports[_0xe313('0xa8')]=function(_0x37837e,_0x1e69c6,_0x2913c7){return BPromise[_0xe313('0x9b')]()[_0xe313('0x2b')](function(){if(!_0x37837e[_0xe313('0x3a')][_0xe313('0x4')]){throw new Error(_0xe313('0xa9'));}if(!_0x37837e[_0xe313('0x3a')][_0xe313('0x9c')]){throw new Error(_0xe313('0x9d'));}var _0x194e09=_0x37837e[_0xe313('0x3a')][_0xe313('0x9e')]?_0x37837e[_0xe313('0x3a')]['hostname']+':'+_0x37837e[_0xe313('0x3a')][_0xe313('0x9c')]:_0xe313('0x9f')+_0x37837e[_0xe313('0x3a')]['port'];var _0x3fb1bd=_0x37837e[_0xe313('0x3a')][_0xe313('0x21')]?_0x37837e[_0xe313('0x3a')][_0xe313('0x21')]:!![];var _0x10c1d1=_0x37837e[_0xe313('0x3a')][_0xe313('0xa0')]?_0x37837e[_0xe313('0x3a')][_0xe313('0xa0')]:null;var _0x5300b8={'method':_0x37837e['method'],'uri':util['format'](_0xe313('0xa2'),_0x194e09,_0x37837e['query']['path']),'json':_0x3fb1bd,'resolveWithFullResponse':!![],'encoding':_0x10c1d1,'body':_0x37837e[_0xe313('0x91')]};if(_0x37837e[_0xe313('0xa3')]){_0x5300b8['headers']=_0x37837e[_0xe313('0xa3')];if(_0x5300b8[_0xe313('0xa3')]['content-length']){delete _0x5300b8[_0xe313('0xa3')][_0xe313('0xa4')];}}if(_0x5300b8[_0xe313('0xa3')][_0xe313('0xa5')]){delete _0x5300b8[_0xe313('0xa3')][_0xe313('0xa5')];}return rp(_0x5300b8);})['then'](function(_0x1f54a8){if(_0x1f54a8){_0x1e69c6[_0xe313('0x26')](_0x1f54a8[_0xe313('0xa3')]);logger[_0xe313('0x6e')](_0x1f54a8[_0xe313('0x91')]);return _0x1e69c6[_0xe313('0x1f')](_0x1f54a8[_0xe313('0xa7')])[_0xe313('0x32')](_0x1f54a8[_0xe313('0x91')]);}else{return _0x1e69c6[_0xe313('0x1e')](0xc8);}})[_0xe313('0x4b')](handleError(_0x1e69c6,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5844264..05b1a3f 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 _0xdc03=['update','remove','emit','hasOwnProperty','hook','events','Plugin','setMaxListeners'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0xdc03,0x65));var _0x3dc0=function(_0x5c557d,_0x171723){_0x5c557d=_0x5c557d-0x0;var _0x358b93=_0xdc03[_0x5c557d];return _0x358b93;};'use strict';var EventEmitter=require(_0x3dc0('0x0'));var Plugin=require('../../mysqldb')['db'][_0x3dc0('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x3dc0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dc0('0x3'),'afterDestroy':_0x3dc0('0x4')};function emitEvent(_0x2971c1){return function(_0x10c75a,_0x3b41f0,_0x221975){PluginEvents['emit'](_0x2971c1+':'+_0x10c75a['id'],_0x10c75a);PluginEvents[_0x3dc0('0x5')](_0x2971c1,_0x10c75a);_0x221975(null);};}for(var e in events){if(events[_0x3dc0('0x6')](e)){var event=events[e];Plugin[_0x3dc0('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xa87e=['events','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x379204,_0x232e2c){var _0x51f413=function(_0x1835dd){while(--_0x1835dd){_0x379204['push'](_0x379204['shift']());}};_0x51f413(++_0x232e2c);}(_0xa87e,0x1c2));var _0xea87=function(_0x303d38,_0x19fe15){_0x303d38=_0x303d38-0x0;var _0x3d163d=_0xa87e[_0x303d38];return _0x3d163d;};'use strict';var EventEmitter=require(_0xea87('0x0'));var Plugin=require(_0xea87('0x1'))['db'][_0xea87('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xea87('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xea87('0x4'),'afterDestroy':_0xea87('0x5')};function emitEvent(_0x2ae388){return function(_0x55c9af,_0x43d37e,_0x162284){PluginEvents[_0xea87('0x6')](_0x2ae388+':'+_0x55c9af['id'],_0x55c9af);PluginEvents[_0xea87('0x6')](_0x2ae388,_0x55c9af);_0x162284(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xea87('0x7')](e,emitEvent(event));}}module[_0xea87('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index b8a2265..1a4bc80 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 _0xfa49=['../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x124d7d,_0x3f9c95){var _0x55d7c7=function(_0x2a0111){while(--_0x2a0111){_0x124d7d['push'](_0x124d7d['shift']());}};_0x55d7c7(++_0x3f9c95);}(_0xfa49,0x12c));var _0x9fa4=function(_0x1f1dc8,_0x5f042a){_0x1f1dc8=_0x1f1dc8-0x0;var _0x4981ba=_0xfa49[_0x1f1dc8];return _0x4981ba;};'use strict';var _=require(_0x9fa4('0x0'));var util=require(_0x9fa4('0x1'));var logger=require(_0x9fa4('0x2'))(_0x9fa4('0x3'));var moment=require(_0x9fa4('0x4'));var BPromise=require(_0x9fa4('0x5'));var rp=require(_0x9fa4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fa4('0x7'));var config=require(_0x9fa4('0x8'));var attributes=require(_0x9fa4('0x9'));module[_0x9fa4('0xa')]=function(_0x57e8a9,_0x5c7e6a){return _0x57e8a9[_0x9fa4('0xb')](_0x9fa4('0xc'),attributes,{'tableName':_0x9fa4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd56c=['api','moment','bluebird','request-promise','path','../../config/environment','./plugin.attributes','exports','Plugin','plugins','lodash','util'];(function(_0x32650d,_0x48b385){var _0x24f6a4=function(_0xa5adae){while(--_0xa5adae){_0x32650d['push'](_0x32650d['shift']());}};_0x24f6a4(++_0x48b385);}(_0xd56c,0x106));var _0xcd56=function(_0x1b0635,_0x7b1567){_0x1b0635=_0x1b0635-0x0;var _0x11d72e=_0xd56c[_0x1b0635];return _0x11d72e;};'use strict';var _=require(_0xcd56('0x0'));var util=require(_0xcd56('0x1'));var logger=require('../../config/logger')(_0xcd56('0x2'));var moment=require(_0xcd56('0x3'));var BPromise=require(_0xcd56('0x4'));var rp=require(_0xcd56('0x5'));var fs=require('fs');var path=require(_0xcd56('0x6'));var rimraf=require('rimraf');var config=require(_0xcd56('0x7'));var attributes=require(_0xcd56('0x8'));module[_0xcd56('0x9')]=function(_0x51a0ed,_0x263a6a){return _0x51a0ed['define'](_0xcd56('0xa'),attributes,{'tableName':_0xcd56('0xb'),'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 213adf7..29b57e0 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 _0x6c1c=['CreatePlugin','create','options','raw','then','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x6c1c,0x7e));var _0xc6c1=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x6c1c[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0xc6c1('0x0'));var util=require(_0xc6c1('0x1'));var moment=require(_0xc6c1('0x2'));var BPromise=require('bluebird');var rs=require(_0xc6c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6c1('0x4'));var logger=require(_0xc6c1('0x5'))(_0xc6c1('0x6'));var config=require(_0xc6c1('0x7'));var jayson=require(_0xc6c1('0x8'));var client=jayson[_0xc6c1('0x9')][_0xc6c1('0xa')]({'port':0x232a});config[_0xc6c1('0xb')]=_[_0xc6c1('0xc')](config[_0xc6c1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6c1('0xd'))(new Redis(config[_0xc6c1('0xb')]));require(_0xc6c1('0xe'))['register'](socket);function respondWithRpcPromise(_0x563f49,_0x248570,_0x5e2489){return new BPromise(function(_0x2d5824,_0x4aeffb){return client[_0xc6c1('0xf')](_0x563f49,_0x5e2489)['then'](function(_0x28fb30){logger[_0xc6c1('0x10')](_0xc6c1('0x11'),_0x248570,_0xc6c1('0x12'));logger[_0xc6c1('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x248570,_0xc6c1('0x12'),JSON['stringify'](_0x28fb30));if(_0x28fb30['error']){if(_0x28fb30[_0xc6c1('0x14')]['code']===0x1f4){logger[_0xc6c1('0x14')](_0xc6c1('0x11'),_0x248570,_0x28fb30[_0xc6c1('0x14')][_0xc6c1('0x15')]);return _0x4aeffb(_0x28fb30[_0xc6c1('0x14')][_0xc6c1('0x15')]);}logger[_0xc6c1('0x14')](_0xc6c1('0x11'),_0x248570,_0x28fb30[_0xc6c1('0x14')][_0xc6c1('0x15')]);return _0x2d5824(_0x28fb30[_0xc6c1('0x14')]['message']);}else{logger['info'](_0xc6c1('0x11'),_0x248570,'request\x20sent');_0x2d5824(_0x28fb30[_0xc6c1('0x16')][_0xc6c1('0x15')]);}})[_0xc6c1('0x17')](function(_0x10c925){logger['error'](_0xc6c1('0x11'),_0x248570,_0x10c925);_0x4aeffb(_0x10c925);});});}exports[_0xc6c1('0x18')]=function(_0x3ae6e0){var _0x2ccdb2=this;return new Promise(function(_0x12170a,_0x2aab6d){return db['Plugin'][_0xc6c1('0x19')](_0x3ae6e0['body'],{'raw':_0x3ae6e0[_0xc6c1('0x1a')]?_0x3ae6e0[_0xc6c1('0x1a')][_0xc6c1('0x1b')]===undefined?!![]:![]:!![]})[_0xc6c1('0x1c')](function(_0x62f44b){logger[_0xc6c1('0x10')]('CreatePlugin',_0x3ae6e0);logger[_0xc6c1('0x13')]('CreatePlugin',_0x3ae6e0,JSON[_0xc6c1('0x1d')](_0x62f44b));_0x12170a(_0x62f44b);})[_0xc6c1('0x17')](function(_0x2e8a74){logger[_0xc6c1('0x14')]('CreatePlugin',_0x2e8a74[_0xc6c1('0x15')],_0x3ae6e0);_0x2aab6d(_0x2ccdb2['error'](0x1f4,_0x2e8a74[_0xc6c1('0x15')]));});});}; \ No newline at end of file +var _0xdda2=['Plugin','create','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','register','request','info','Plugin,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin'];(function(_0xbdf4cc,_0x12db5a){var _0x355feb=function(_0xe430b5){while(--_0xe430b5){_0xbdf4cc['push'](_0xbdf4cc['shift']());}};_0x355feb(++_0x12db5a);}(_0xdda2,0xb9));var _0x2dda=function(_0x34559b,_0x42b8ed){_0x34559b=_0x34559b-0x0;var _0x517ca8=_0xdda2[_0x34559b];return _0x517ca8;};'use strict';var _=require(_0x2dda('0x0'));var util=require(_0x2dda('0x1'));var moment=require(_0x2dda('0x2'));var BPromise=require('bluebird');var rs=require(_0x2dda('0x3'));var fs=require('fs');var Redis=require(_0x2dda('0x4'));var db=require(_0x2dda('0x5'))['db'];var utils=require(_0x2dda('0x6'));var logger=require(_0x2dda('0x7'))('rpc');var config=require(_0x2dda('0x8'));var jayson=require(_0x2dda('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2dda('0xa')]=_['defaults'](config[_0x2dda('0xa')],{'host':_0x2dda('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2dda('0xa')]));require('./plugin.socket')[_0x2dda('0xc')](socket);function respondWithRpcPromise(_0x16f558,_0x2c98b2,_0x39bfe6){return new BPromise(function(_0x3c7c1a,_0x105a85){return client[_0x2dda('0xd')](_0x16f558,_0x39bfe6)['then'](function(_0x5ef8b0){logger[_0x2dda('0xe')](_0x2dda('0xf'),_0x2c98b2,'request\x20sent');logger[_0x2dda('0x10')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2c98b2,_0x2dda('0x11'),JSON[_0x2dda('0x12')](_0x5ef8b0));if(_0x5ef8b0[_0x2dda('0x13')]){if(_0x5ef8b0[_0x2dda('0x13')][_0x2dda('0x14')]===0x1f4){logger[_0x2dda('0x13')]('Plugin,\x20%s,\x20%s',_0x2c98b2,_0x5ef8b0[_0x2dda('0x13')][_0x2dda('0x15')]);return _0x105a85(_0x5ef8b0[_0x2dda('0x13')][_0x2dda('0x15')]);}logger[_0x2dda('0x13')](_0x2dda('0xf'),_0x2c98b2,_0x5ef8b0[_0x2dda('0x13')][_0x2dda('0x15')]);return _0x3c7c1a(_0x5ef8b0['error'][_0x2dda('0x15')]);}else{logger[_0x2dda('0xe')](_0x2dda('0xf'),_0x2c98b2,_0x2dda('0x11'));_0x3c7c1a(_0x5ef8b0[_0x2dda('0x16')][_0x2dda('0x15')]);}})[_0x2dda('0x17')](function(_0x4145dd){logger['error'](_0x2dda('0xf'),_0x2c98b2,_0x4145dd);_0x105a85(_0x4145dd);});});}exports[_0x2dda('0x18')]=function(_0x5c8ae3){var _0x35764d=this;return new Promise(function(_0x6aaed3,_0x578f5b){return db[_0x2dda('0x19')][_0x2dda('0x1a')](_0x5c8ae3['body'],{'raw':_0x5c8ae3[_0x2dda('0x1b')]?_0x5c8ae3['options'][_0x2dda('0x1c')]===undefined?!![]:![]:!![]})[_0x2dda('0x1d')](function(_0x414bdd){logger['info'](_0x2dda('0x18'),_0x5c8ae3);logger[_0x2dda('0x10')](_0x2dda('0x18'),_0x5c8ae3,JSON[_0x2dda('0x12')](_0x414bdd));_0x6aaed3(_0x414bdd);})[_0x2dda('0x17')](function(_0x162888){logger['error']('CreatePlugin',_0x162888['message'],_0x5c8ae3);_0x578f5b(_0x35764d[_0x2dda('0x13')](0x1f4,_0x162888[_0x2dda('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5985a11..f9cdb26 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 _0x766e=['emit','removeListener','register','length','plugin:','./plugin.events','remove','update'];(function(_0x58016a,_0xa61e0){var _0x3b13ea=function(_0x2ea81a){while(--_0x2ea81a){_0x58016a['push'](_0x58016a['shift']());}};_0x3b13ea(++_0xa61e0);}(_0x766e,0x12d));var _0xe766=function(_0x2338ae,_0x1896f8){_0x2338ae=_0x2338ae-0x0;var _0x4adad9=_0x766e[_0x2338ae];return _0x4adad9;};'use strict';var PluginEvents=require(_0xe766('0x0'));var events=['save',_0xe766('0x1'),_0xe766('0x2')];function createListener(_0x1b4478,_0x3c1919){return function(_0x3a0b19){_0x3c1919[_0xe766('0x3')](_0x1b4478,_0x3a0b19);};}function removeListener(_0xe2cabb,_0x5875b9){return function(){PluginEvents[_0xe766('0x4')](_0xe2cabb,_0x5875b9);};}exports[_0xe766('0x5')]=function(_0x591d92){for(var _0x5da162=0x0,_0x28092e=events[_0xe766('0x6')];_0x5da162<_0x28092e;_0x5da162++){var _0x45f020=events[_0x5da162];var _0x22f690=createListener(_0xe766('0x7')+_0x45f020,_0x591d92);PluginEvents['on'](_0x45f020,_0x22f690);}}; \ No newline at end of file +var _0x1db3=['removeListener','register','length','plugin:','./plugin.events','remove','emit'];(function(_0x599f3a,_0x334c6b){var _0x1ceaa3=function(_0x11cbd3){while(--_0x11cbd3){_0x599f3a['push'](_0x599f3a['shift']());}};_0x1ceaa3(++_0x334c6b);}(_0x1db3,0x1d2));var _0x31db=function(_0x523c61,_0x4de16f){_0x523c61=_0x523c61-0x0;var _0x1701ac=_0x1db3[_0x523c61];return _0x1701ac;};'use strict';var PluginEvents=require(_0x31db('0x0'));var events=['save',_0x31db('0x1'),'update'];function createListener(_0x4b9c53,_0x139b41){return function(_0x224851){_0x139b41[_0x31db('0x2')](_0x4b9c53,_0x224851);};}function removeListener(_0x1b6afa,_0x3f5038){return function(){PluginEvents[_0x31db('0x3')](_0x1b6afa,_0x3f5038);};}exports[_0x31db('0x4')]=function(_0x581b84){for(var _0x246e90=0x0,_0xef9ee1=events[_0x31db('0x5')];_0x246e90<_0xef9ee1;_0x246e90++){var _0x356909=events[_0x246e90];var _0x5cf4ff=createListener(_0x31db('0x6')+_0x356909,_0x581b84);PluginEvents['on'](_0x356909,_0x5cf4ff);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4d611f7..e996ccc 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(_0x3759b1,_0x31db9f){var _0x36a2a5=function(_0x4a6300){while(--_0x4a6300){_0x3759b1['push'](_0x3759b1['shift']());}};_0x36a2a5(++_0x31db9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x560e8f,_0x4cfd16){var _0x38ece0=function(_0x10d6cd){while(--_0x10d6cd){_0x560e8f['push'](_0x560e8f['shift']());}};_0x38ece0(++_0x4cfd16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 87082d8..42cc264 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 _0x1d2d=['reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','list','then'];(function(_0x2519e4,_0x2c7257){var _0x37a165=function(_0x11e07c){while(--_0x11e07c){_0x2519e4['push'](_0x2519e4['shift']());}};_0x37a165(++_0x2c7257);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x1bd92a,_0x4531be){_0x1bd92a=_0x1bd92a-0x0;var _0x2e4b34=_0x1d2d[_0x1bd92a];return _0x2e4b34;};'use strict';var _=require(_0xd1d2('0x0'));var pm2=require(_0xd1d2('0x1'));var logger=require(_0xd1d2('0x2'))(_0xd1d2('0x3'));var path=require(_0xd1d2('0x4'));var exec=require('child_process')[_0xd1d2('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5d3fac,_0x3caa72){return function(_0x2bfabc){if(!_0x2bfabc){_0x5d3fac[_0xd1d2('0x6')](0x194);;}return _0x2bfabc;};}function respondWithResult(_0x269613,_0x2f930d){_0x2f930d=_0x2f930d||0xc8;return function(_0x353dbd){if(_0x353dbd){return _0x269613['status'](_0x2f930d)[_0xd1d2('0x7')](_0x353dbd);}return null;};}function handleError(_0x21bc28,_0x35735f){_0x35735f=_0x35735f||0x1f4;return function(_0x37ff2a){logger[_0xd1d2('0x8')](_0x37ff2a[_0xd1d2('0x9')]);if(_0x37ff2a[_0xd1d2('0xa')]){delete _0x37ff2a[_0xd1d2('0xa')];}_0x21bc28[_0xd1d2('0xb')](_0x35735f)[_0xd1d2('0xc')](_0x37ff2a);};}function execChildProcess(){return new BPromise(function(_0x900ec,_0x227d7f){exec(_0xd1d2('0xd'),function(_0x5b21f4,_0x41fcb5,_0x1f49ed){logger[_0xd1d2('0xe')](_0x41fcb5);logger[_0xd1d2('0xe')](_0x1f49ed);if(_0x5b21f4){logger[_0xd1d2('0x8')](_0x5b21f4);return _0x227d7f(_0x5b21f4);}return _0x900ec(_0x41fcb5);});});}exports[_0xd1d2('0xf')]=function(_0x2df8a5,_0x31dc84){return pm2[_0xd1d2('0x10')]()[_0xd1d2('0x11')](function(_0x4cf702){if(_0x4cf702){var _0x2e7fec=_[_0xd1d2('0x12')](_0x4cf702,function(_0x3476f8){return _0x3476f8['name']===_0xd1d2('0x13')||_0x3476f8[_0xd1d2('0xa')]===_0xd1d2('0x14');});return{'rows':_0x2e7fec,'count':_0x2e7fec[_0xd1d2('0x15')]};}return null;})[_0xd1d2('0x11')](respondWithResult(_0x31dc84,null))[_0xd1d2('0x16')](handleError(_0x31dc84,null));};exports[_0xd1d2('0x17')]=function(_0x57f2f9,_0x539d5a){return pm2[_0xd1d2('0x18')](_0x57f2f9['params']['id'])[_0xd1d2('0x11')](respondWithResult(_0x539d5a,null))[_0xd1d2('0x11')](handleEntityNotFound(_0x539d5a,null))[_0xd1d2('0x16')](handleError(_0x539d5a,null));};exports[_0xd1d2('0x19')]=function(_0x4ab386,_0x4f1201){if(_0x4ab386[_0xd1d2('0x1a')]['name']&&_0x4ab386['body'][_0xd1d2('0x1b')]){var _0x27e26b=path[_0xd1d2('0x1c')](__dirname,_0xd1d2('0x1d'),_0x4ab386['body'][_0xd1d2('0x1b')]);var _0xbb4d27=process[_0xd1d2('0x1e')]();process['chdir'](path['dirname'](_0x27e26b));return execChildProcess()[_0xd1d2('0x11')](function(_0x3a1078){process[_0xd1d2('0x1f')](_0xbb4d27);return pm2[_0xd1d2('0x20')]({'name':_0x4ab386[_0xd1d2('0x1a')][_0xd1d2('0xa')],'script':_0x27e26b});})[_0xd1d2('0x11')](function(_0x5df4af){pm2[_0xd1d2('0x21')]();return _0x5df4af[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x4f1201,0xc9))[_0xd1d2('0x16')](handleError(_0x4f1201,null));}else{return _0x4f1201[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x22')});}};exports[_0xd1d2('0x23')]=function(_0x34faf7,_0xe6ef3c){if(_0x34faf7[_0xd1d2('0x1a')]['id']){delete _0x34faf7[_0xd1d2('0x1a')]['id'];}var _0x4e1bc2={'online':'restart','stopped':_0xd1d2('0x24')};if(_0x4e1bc2[_0xd1d2('0x25')](_0x34faf7[_0xd1d2('0x1a')][_0xd1d2('0xb')])){return pm2[_0x4e1bc2[_0x34faf7[_0xd1d2('0x1a')]['status']]](_0x34faf7[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](respondWithResult(_0xe6ef3c,0xc8))[_0xd1d2('0x16')](handleError(_0xe6ef3c,null));}else{return _0xe6ef3c['status'](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x27')});}};exports[_0xd1d2('0x28')]=function(_0x56557d,_0x419db7){if(_0x56557d[_0xd1d2('0x1a')]['id']){delete _0x56557d[_0xd1d2('0x1a')]['id'];}if(_0x56557d[_0xd1d2('0x26')]['id']){return pm2[_0xd1d2('0x29')](_0x56557d[_0xd1d2('0x26')]['id'])[_0xd1d2('0x11')](function(_0x322f50){pm2[_0xd1d2('0x21')]();return _0x322f50[0x0];})[_0xd1d2('0x11')](respondWithResult(_0x419db7,null))[_0xd1d2('0x16')](handleError(_0x419db7,null));}else{return _0x419db7[_0xd1d2('0xb')](0x1f4)[_0xd1d2('0xc')]({'message':_0xd1d2('0x2a')});}}; \ No newline at end of file +var _0x7072=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','express','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump'];(function(_0x2eb070,_0x2eb725){var _0x30197f=function(_0x24b18f){while(--_0x24b18f){_0x2eb070['push'](_0x2eb070['shift']());}};_0x30197f(++_0x2eb725);}(_0x7072,0x138));var _0x2707=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x7072[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var pm2=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var path=require(_0x2707('0x3'));var exec=require(_0x2707('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0xfdfa7a,_0x5f3c1c){return function(_0xd36287){if(!_0xd36287){_0xfdfa7a[_0x2707('0x5')](0x194);;}return _0xd36287;};}function respondWithResult(_0x1e86f2,_0x194132){_0x194132=_0x194132||0xc8;return function(_0x2fd8ff){if(_0x2fd8ff){return _0x1e86f2[_0x2707('0x6')](_0x194132)[_0x2707('0x7')](_0x2fd8ff);}return null;};}function handleError(_0x745cfd,_0x4062b6){_0x4062b6=_0x4062b6||0x1f4;return function(_0x2820ef){logger['error'](_0x2820ef['stack']);if(_0x2820ef[_0x2707('0x8')]){delete _0x2820ef[_0x2707('0x8')];}_0x745cfd[_0x2707('0x6')](_0x4062b6)[_0x2707('0x9')](_0x2820ef);};}function execChildProcess(){return new BPromise(function(_0x30090e,_0x2e1a46){exec(_0x2707('0xa'),function(_0x19881c,_0x115535,_0x478717){logger[_0x2707('0xb')](_0x115535);logger[_0x2707('0xb')](_0x478717);if(_0x19881c){logger[_0x2707('0xc')](_0x19881c);return _0x2e1a46(_0x19881c);}return _0x30090e(_0x115535);});});}exports['index']=function(_0x44c1d7,_0x590152){return pm2[_0x2707('0xd')]()[_0x2707('0xe')](function(_0xfe975c){if(_0xfe975c){var _0x3a67f2=_[_0x2707('0xf')](_0xfe975c,function(_0x4e52a3){return _0x4e52a3[_0x2707('0x8')]===_0x2707('0x10')||_0x4e52a3[_0x2707('0x8')]==='motion2';});return{'rows':_0x3a67f2,'count':_0x3a67f2[_0x2707('0x11')]};}return null;})[_0x2707('0xe')](respondWithResult(_0x590152,null))[_0x2707('0x12')](handleError(_0x590152,null));};exports[_0x2707('0x13')]=function(_0x7ed037,_0x27a3ea){return pm2['describe'](_0x7ed037[_0x2707('0x14')]['id'])[_0x2707('0xe')](respondWithResult(_0x27a3ea,null))[_0x2707('0xe')](handleEntityNotFound(_0x27a3ea,null))['catch'](handleError(_0x27a3ea,null));};exports['create']=function(_0x58a4ee,_0x1da4a6){if(_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')]&&_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]){var _0x3c2935=path[_0x2707('0x17')](__dirname,_0x2707('0x18'),_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]);var _0x37c475=process[_0x2707('0x19')]();process[_0x2707('0x1a')](path[_0x2707('0x1b')](_0x3c2935));return execChildProcess()['then'](function(_0x1acf22){process[_0x2707('0x1a')](_0x37c475);return pm2[_0x2707('0x1c')]({'name':_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')],'script':_0x3c2935});})[_0x2707('0xe')](function(_0x4831ed){pm2[_0x2707('0x1d')]();return _0x4831ed[0x0];})[_0x2707('0xe')](respondWithResult(_0x1da4a6,0xc9))[_0x2707('0x12')](handleError(_0x1da4a6,null));}else{return _0x1da4a6[_0x2707('0x6')](0x1f4)[_0x2707('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2707('0x1e')]=function(_0x4ca05d,_0x29dad2){if(_0x4ca05d[_0x2707('0x15')]['id']){delete _0x4ca05d[_0x2707('0x15')]['id'];}var _0x57da26={'online':_0x2707('0x1f'),'stopped':_0x2707('0x20')};if(_0x57da26[_0x2707('0x21')](_0x4ca05d['body'][_0x2707('0x6')])){return pm2[_0x57da26[_0x4ca05d[_0x2707('0x15')]['status']]](_0x4ca05d[_0x2707('0x14')]['id'])['then'](respondWithResult(_0x29dad2,0xc8))['catch'](handleError(_0x29dad2,null));}else{return _0x29dad2[_0x2707('0x6')](0x1f4)['send']({'message':_0x2707('0x22')});}};exports[_0x2707('0x23')]=function(_0x417a97,_0x36b2e9){if(_0x417a97['body']['id']){delete _0x417a97[_0x2707('0x15')]['id'];}if(_0x417a97[_0x2707('0x14')]['id']){return pm2[_0x2707('0x24')](_0x417a97[_0x2707('0x14')]['id'])[_0x2707('0xe')](function(_0x341e14){pm2[_0x2707('0x1d')]();return _0x341e14[0x0];})[_0x2707('0xe')](respondWithResult(_0x36b2e9,null))[_0x2707('0x12')](handleError(_0x36b2e9,null));}else{return _0x36b2e9['status'](0x1f4)[_0x2707('0x9')]({'message':_0x2707('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 97f3de3..cb8cc4a 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 _0x6d11=['Router','../../components/auth/service','get','isAuthenticated','getQueues','express'];(function(_0x7f82c7,_0x2bec9d){var _0xccd46=function(_0x14083a){while(--_0x14083a){_0x7f82c7['push'](_0x7f82c7['shift']());}};_0xccd46(++_0x2bec9d);}(_0x6d11,0xbf));var _0x16d1=function(_0xb4201a,_0x377d31){_0xb4201a=_0xb4201a-0x0;var _0x1f3553=_0x6d11[_0xb4201a];return _0x1f3553;};'use strict';var express=require(_0x16d1('0x0'));var router=express[_0x16d1('0x1')]();var auth=require(_0x16d1('0x2'));var controller=require('./realtime.controller');router[_0x16d1('0x3')]('/queues',auth[_0x16d1('0x4')](),controller[_0x16d1('0x5')]);module['exports']=router; \ No newline at end of file +var _0x31bd=['../../components/auth/service','./realtime.controller','/queues','getQueues','exports','express','Router'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x31bd,0xbb));var _0xd31b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x31bd[_0x3b380d];return _0x54502b;};'use strict';var express=require(_0xd31b('0x0'));var router=express[_0xd31b('0x1')]();var auth=require(_0xd31b('0x2'));var controller=require(_0xd31b('0x3'));router['get'](_0xd31b('0x4'),auth['isAuthenticated'](),controller[_0xd31b('0x5')]);module[_0xd31b('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 d2d1b0d..9dbdcde 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 _0x7880=['agents','User','Pause','findAll','QueueId','map','agent','all','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','client','offset','undefined','limit','count','set','Content-Range','json','error','name','status','send','mail','chat','sms','openchannel','fax','resolve','then','query','includes','toLowerCase','startCase','Queue','fieldName','type','key','role','user','voice','QueueCampaigns','filter','UserProfile','getResources','findAndCountAll','request','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','outbound','push','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','rows','get','loggedInDb','find','merge','pick','online','getMembers','length'];(function(_0x3b3493,_0x4eae83){var _0x51953f=function(_0x1f8929){while(--_0x1f8929){_0x3b3493['push'](_0x3b3493['shift']());}};_0x51953f(++_0x4eae83);}(_0x7880,0x1f4));var _0x0788=function(_0x3f9ec3,_0x3dfd37){_0x3f9ec3=_0x3f9ec3-0x0;var _0xe85b13=_0x7880[_0x3f9ec3];return _0xe85b13;};'use strict';var util=require('util');var _=require(_0x0788('0x0'));var jayson=require(_0x0788('0x1'));var qs=require(_0x0788('0x2'));var logger=require(_0x0788('0x3'))(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var client=jayson['client'][_0x0788('0x6')]({'port':0x232a});var routingClient=jayson[_0x0788('0x7')][_0x0788('0x6')]({'port':0x232c});function respondWithFilteredResult(_0xd53e7d,_0x262f5c){return function(_0x775629){if(_0x775629){var _0x3f9cb8=typeof _0x262f5c[_0x0788('0x8')]===_0x0788('0x9')&&typeof _0x262f5c[_0x0788('0xa')]==='undefined';var _0x1497dd=_0x775629['count'];var _0xabaf81=_0x3f9cb8?0x0:_0x262f5c['offset'];var _0x433c26=_0x3f9cb8?_0x775629[_0x0788('0xb')]:_0x262f5c[_0x0788('0x8')]+_0x262f5c[_0x0788('0xa')];var _0x469ebe;if(_0x433c26>=_0x1497dd){_0x433c26=_0x1497dd;_0x469ebe=0xc8;}else{_0x469ebe=0xce;}_0xd53e7d['status'](_0x469ebe);return _0xd53e7d[_0x0788('0xc')](_0x0788('0xd'),_0xabaf81+'-'+_0x433c26+'/'+_0x1497dd)[_0x0788('0xe')](_0x775629);}return null;};}function handleError(_0x2d8568,_0x311729){_0x311729=_0x311729||0x1f4;return function(_0xce4342){logger[_0x0788('0xf')](_0xce4342['stack']);if(_0xce4342[_0x0788('0x10')]){delete _0xce4342[_0x0788('0x10')];}_0x2d8568[_0x0788('0x11')](_0x311729)[_0x0788('0x12')](_0xce4342);};}exports['getQueues']=function(_0x43ca01,_0x4ed024){var _0x195f14=[_0x0788('0x13'),_0x0788('0x14'),_0x0788('0x15'),_0x0788('0x16'),_0x0788('0x17'),'whatsapp','voice'];var _0x17d805={'count':0x0,'rows':[]},_0x461d9d={},_0x5b2bdc;Promise[_0x0788('0x18')]()[_0x0788('0x19')](function(){if(_0x43ca01[_0x0788('0x1a')]['channel']){if(!_[_0x0788('0x1b')](_0x195f14,_0x43ca01[_0x0788('0x1a')]['channel'][_0x0788('0x1c')]()))throw new Error('Invalid\x20channel');_0x5b2bdc=_0x43ca01[_0x0788('0x1a')]['channel'][_0x0788('0x1c')]();}var _0x3c37ca=_[_0x0788('0x1d')](_0x5b2bdc)+_0x0788('0x1e');var _0x3aa142=_['map'](db[_0x3c37ca]['rawAttributes'],function(_0x2270d4){return{'name':_0x2270d4[_0x0788('0x1f')],'type':_0x2270d4[_0x0788('0x20')][_0x0788('0x21')]};});_0x461d9d=qs['getOptions'](_0x3aa142,_0x43ca01);if(_0x43ca01['user'][_0x0788('0x22')]===_0x0788('0x23')){var _0x40309d={'params':{'id':_0x43ca01['user']['userProfileId']},'query':{'section':_0x5b2bdc===_0x0788('0x24')&&_0x43ca01[_0x0788('0x1a')]['type']==='outbound'?_0x0788('0x25'):_[_0x0788('0x1d')](_0x5b2bdc)+'Queues','type':_0x43ca01[_0x0788('0x1a')][_0x0788('0x20')],'nolimit':!![],'sort':_0x0788('0x10'),'filter':_0x43ca01[_0x0788('0x1a')][_0x0788('0x26')]}};return db[_0x0788('0x27')][_0x0788('0x28')](_0x40309d);}return db[_0x3c37ca][_0x0788('0x29')](_0x461d9d);})['then'](function(_0x5a5178){_0x17d805[_0x0788('0xb')]=_0x5a5178[_0x0788('0xb')];var _0x54979a=_0x5b2bdc==='voice'?client:routingClient;return _0x54979a[_0x0788('0x2a')](_[_0x0788('0x1d')](_0x5b2bdc)+_0x0788('0x2b'),_0x43ca01)[_0x0788('0x19')](function(_0x44cbfb){if(_0x44cbfb[_0x0788('0xf')])throw new Error(util[_0x0788('0x2c')](_0x0788('0x2d'),_0x5b2bdc));var _0x28a50a=_0x44cbfb[_0x0788('0x2e')];var _0x5ec0ed=[_0x0788('0x2f'),_0x0788('0x30'),_0x0788('0x31'),_0x0788('0x32'),_0x0788('0x33')];if(_0x5b2bdc===_0x0788('0x24')&&_0x43ca01[_0x0788('0x1a')][_0x0788('0x20')]===_0x0788('0x34')){_0x5ec0ed[_0x0788('0x35')]('pTalking','originated','message','dialActive','dialMethod','Trunk',_0x0788('0x36'),_0x0788('0x37'),_0x0788('0x38'),'erlangCallToSecond',_0x0788('0x39'),_0x0788('0x3a'),_0x0788('0x3b'),_0x0788('0x3c'),'dialPredictiveIntervalMinThreshold',_0x0788('0x3d'),'predictiveIntervalTotalCalls',_0x0788('0x3e'),'predictiveIntervalDroppedCallsTimeout',_0x0788('0x3f'),_0x0788('0x40'),'predictiveIntervalAvgTalktime');}var _0x16f053=_0x5a5178[_0x0788('0x41')]['map'](function(_0x17240e){var _0x5eb693=_0x17240e[_0x0788('0x42')]({'plain':!![]});_0x5eb693['paused']=0x0;_0x5eb693[_0x0788('0x43')]=0x0;_0x5eb693['loggedIn']=0x0;_0x5eb693[_0x0788('0x30')]=0x0;_0x5eb693['paused']=0x0;_0x5eb693['waiting']=0x0;if(_0x5b2bdc===_0x0788('0x24')){_0x5eb693[_0x0788('0x32')]=0x0;if(_0x43ca01[_0x0788('0x1a')][_0x0788('0x20')]===_0x0788('0x34')){_0x5eb693['pTalking']=0x0;_0x5eb693['originated']=0x0;}}_0x5eb693['agents']=[];var _0x4d539a=_[_0x0788('0x44')](_0x28a50a[_0x0788('0x41')],['id',_0x5eb693['id']]);if(_0x4d539a)_[_0x0788('0x45')](_0x5eb693,_[_0x0788('0x46')](_0x4d539a,_0x5ec0ed));if(_0x5b2bdc===_0x0788('0x24')){return _0x17240e['getAgents']({'attributes':['id','name',_0x0788('0x47')],'joinTableAttributes':[],'raw':!![]})[_0x0788('0x19')](function(_0x330421){return _0x17240e[_0x0788('0x48')]({'raw':!![]})[_0x0788('0x19')](function(_0x4316aa){for(var _0x27201b=0x0;_0x27201b<_0x330421[_0x0788('0x49')];_0x27201b++){var _0x347984=_['find'](_0x4316aa,['UserId',_0x330421[_0x27201b]['id']]);var _0x441aec={'id':_0x330421[_0x27201b]['id'],'name':_0x330421[_0x27201b][_0x0788('0x10')],'online':Boolean(_0x330421[_0x27201b][_0x0788('0x47')]),'paused':_0x347984?Boolean(_0x347984['paused']):![]};if(_0x441aec['online'])_0x5eb693['loggedInDb']++;if(_0x441aec[_0x0788('0x33')])_0x5eb693[_0x0788('0x33')]++;_0x5eb693[_0x0788('0x4a')][_0x0788('0x35')](_0x441aec);}return _0x5eb693;});});}else{var _0x2737d8=_0x0788('0x4b')+_[_0x0788('0x1d')](_0x5b2bdc)+_0x0788('0x1e');var _0x4bd0d9=_0x5b2bdc+_0x0788('0x4c');return db[_0x2737d8][_0x0788('0x4d')]({'where':{[_[_0x0788('0x1d')](_0x5b2bdc)+_0x0788('0x4e')]:_0x17240e['id']},'raw':!![]})['then'](function(_0x6aa745){return db[_0x0788('0x4b')]['findAll']({'attributes':['id','name','online',_0x4bd0d9],'where':{'id':_[_0x0788('0x4f')](_0x6aa745,'UserId'),'role':_0x0788('0x50')},'raw':!![]});})[_0x0788('0x19')](function(_0x127ab4){for(var _0x329508=0x0;_0x329508<_0x127ab4[_0x0788('0x49')];_0x329508++){var _0x359dd6={'id':_0x127ab4[_0x329508]['id'],'name':_0x127ab4[_0x329508][_0x0788('0x10')],'online':Boolean(_0x127ab4[_0x329508][_0x0788('0x47')]),'paused':Boolean(_0x127ab4[_0x329508][_0x4bd0d9])};if(_0x359dd6['online'])_0x5eb693['loggedInDb']++;if(_0x359dd6[_0x0788('0x33')])_0x5eb693[_0x0788('0x33')]++;_0x5eb693[_0x0788('0x4a')]['push'](_0x359dd6);}return _0x5eb693;});}});return Promise[_0x0788('0x51')](_0x16f053);});})[_0x0788('0x19')](function(_0x19aad6){_0x17d805[_0x0788('0x41')]=_0x19aad6;return _0x17d805;})[_0x0788('0x19')](respondWithFilteredResult(_0x4ed024,_0x461d9d))['catch'](handleError(_0x4ed024,null));}; \ No newline at end of file +var _0x1883=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','status','set','error','stack','name','mail','chat','sms','openchannel','fax','whatsapp','resolve','then','query','channel','includes','toLowerCase','startCase','map','rawAttributes','fieldName','type','getOptions','user','userProfileId','voice','outbound','QueueCampaigns','Queues','filter','UserProfile','getResources','findAndCountAll','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','waiting','talking','paused','push','originated','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','loggedInDb','agents','find','merge','online','getMembers','UserId','User','Queue','Pause','QueueId','findAll','agent','all','util','lodash','jayson/promise'];(function(_0x59af37,_0x446e71){var _0x20d5ec=function(_0x405a84){while(--_0x405a84){_0x59af37['push'](_0x59af37['shift']());}};_0x20d5ec(++_0x446e71);}(_0x1883,0xab));var _0x3188=function(_0xc4868c,_0x5242ae){_0xc4868c=_0xc4868c-0x0;var _0x38f1c8=_0x1883[_0xc4868c];return _0x38f1c8;};'use strict';var util=require(_0x3188('0x0'));var _=require(_0x3188('0x1'));var jayson=require(_0x3188('0x2'));var qs=require(_0x3188('0x3'));var logger=require(_0x3188('0x4'))(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var client=jayson[_0x3188('0x7')][_0x3188('0x8')]({'port':0x232a});var routingClient=jayson[_0x3188('0x7')][_0x3188('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x345612,_0x408ae0){return function(_0x33b62d){if(_0x33b62d){var _0x24f2f1=typeof _0x408ae0[_0x3188('0x9')]===_0x3188('0xa')&&typeof _0x408ae0['limit']===_0x3188('0xa');var _0x2a2f07=_0x33b62d['count'];var _0x2213b5=_0x24f2f1?0x0:_0x408ae0['offset'];var _0xc6040=_0x24f2f1?_0x33b62d[_0x3188('0xb')]:_0x408ae0[_0x3188('0x9')]+_0x408ae0[_0x3188('0xc')];var _0x5b968e;if(_0xc6040>=_0x2a2f07){_0xc6040=_0x2a2f07;_0x5b968e=0xc8;}else{_0x5b968e=0xce;}_0x345612[_0x3188('0xd')](_0x5b968e);return _0x345612[_0x3188('0xe')]('Content-Range',_0x2213b5+'-'+_0xc6040+'/'+_0x2a2f07)['json'](_0x33b62d);}return null;};}function handleError(_0x339b4a,_0x45e94e){_0x45e94e=_0x45e94e||0x1f4;return function(_0x20fef6){logger[_0x3188('0xf')](_0x20fef6[_0x3188('0x10')]);if(_0x20fef6[_0x3188('0x11')]){delete _0x20fef6['name'];}_0x339b4a[_0x3188('0xd')](_0x45e94e)['send'](_0x20fef6);};}exports['getQueues']=function(_0x1b8a18,_0x53668b){var _0x54a87f=[_0x3188('0x12'),_0x3188('0x13'),_0x3188('0x14'),_0x3188('0x15'),_0x3188('0x16'),_0x3188('0x17'),'voice'];var _0x19cc72={'count':0x0,'rows':[]},_0x1c3598={},_0x3f5b35;Promise[_0x3188('0x18')]()[_0x3188('0x19')](function(){if(_0x1b8a18[_0x3188('0x1a')][_0x3188('0x1b')]){if(!_[_0x3188('0x1c')](_0x54a87f,_0x1b8a18['query'][_0x3188('0x1b')][_0x3188('0x1d')]()))throw new Error('Invalid\x20channel');_0x3f5b35=_0x1b8a18['query']['channel'][_0x3188('0x1d')]();}var _0x8b207=_[_0x3188('0x1e')](_0x3f5b35)+'Queue';var _0x48673c=_[_0x3188('0x1f')](db[_0x8b207][_0x3188('0x20')],function(_0x375077){return{'name':_0x375077[_0x3188('0x21')],'type':_0x375077[_0x3188('0x22')]['key']};});_0x1c3598=qs[_0x3188('0x23')](_0x48673c,_0x1b8a18);if(_0x1b8a18[_0x3188('0x24')]['role']===_0x3188('0x24')){var _0x4be6c3={'params':{'id':_0x1b8a18['user'][_0x3188('0x25')]},'query':{'section':_0x3f5b35===_0x3188('0x26')&&_0x1b8a18[_0x3188('0x1a')][_0x3188('0x22')]===_0x3188('0x27')?_0x3188('0x28'):_[_0x3188('0x1e')](_0x3f5b35)+_0x3188('0x29'),'type':_0x1b8a18['query'][_0x3188('0x22')],'nolimit':!![],'sort':_0x3188('0x11'),'filter':_0x1b8a18['query'][_0x3188('0x2a')]}};return db[_0x3188('0x2b')][_0x3188('0x2c')](_0x4be6c3);}return db[_0x8b207][_0x3188('0x2d')](_0x1c3598);})[_0x3188('0x19')](function(_0x1f1c6f){_0x19cc72[_0x3188('0xb')]=_0x1f1c6f[_0x3188('0xb')];var _0x57c21c=_0x3f5b35===_0x3188('0x26')?client:routingClient;return _0x57c21c['request'](_[_0x3188('0x1e')](_0x3f5b35)+'Queues',_0x1b8a18)[_0x3188('0x19')](function(_0x80f9a8){if(_0x80f9a8[_0x3188('0xf')])throw new Error(util[_0x3188('0x2e')](_0x3188('0x2f'),_0x3f5b35));var _0x263892=_0x80f9a8[_0x3188('0x30')];var _0x279069=[_0x3188('0x31'),_0x3188('0x32'),_0x3188('0x33'),_0x3188('0x34'),_0x3188('0x35')];if(_0x3f5b35===_0x3188('0x26')&&_0x1b8a18[_0x3188('0x1a')][_0x3188('0x22')]===_0x3188('0x27')){_0x279069[_0x3188('0x36')]('pTalking',_0x3188('0x37'),'message',_0x3188('0x38'),_0x3188('0x39'),'Trunk',_0x3188('0x3a'),_0x3188('0x3b'),_0x3188('0x3c'),_0x3188('0x3d'),_0x3188('0x3e'),_0x3188('0x3f'),_0x3188('0x40'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x3188('0x41'),_0x3188('0x42'),_0x3188('0x43'),_0x3188('0x44'),'predictiveIntervalDroppedCallsCallersExit',_0x3188('0x45'),_0x3188('0x46'));}var _0x25ad4c=_0x1f1c6f[_0x3188('0x47')]['map'](function(_0x201ef2){var _0x4a290f=_0x201ef2[_0x3188('0x48')]({'plain':!![]});_0x4a290f['paused']=0x0;_0x4a290f[_0x3188('0x49')]=0x0;_0x4a290f[_0x3188('0x31')]=0x0;_0x4a290f[_0x3188('0x32')]=0x0;_0x4a290f[_0x3188('0x35')]=0x0;_0x4a290f[_0x3188('0x33')]=0x0;if(_0x3f5b35===_0x3188('0x26')){_0x4a290f[_0x3188('0x34')]=0x0;if(_0x1b8a18[_0x3188('0x1a')][_0x3188('0x22')]===_0x3188('0x27')){_0x4a290f['pTalking']=0x0;_0x4a290f[_0x3188('0x37')]=0x0;}}_0x4a290f[_0x3188('0x4a')]=[];var _0x10f676=_[_0x3188('0x4b')](_0x263892[_0x3188('0x47')],['id',_0x4a290f['id']]);if(_0x10f676)_[_0x3188('0x4c')](_0x4a290f,_['pick'](_0x10f676,_0x279069));if(_0x3f5b35===_0x3188('0x26')){return _0x201ef2['getAgents']({'attributes':['id',_0x3188('0x11'),_0x3188('0x4d')],'joinTableAttributes':[],'raw':!![]})[_0x3188('0x19')](function(_0x8f3756){return _0x201ef2[_0x3188('0x4e')]({'raw':!![]})['then'](function(_0x484eeb){for(var _0x59069f=0x0;_0x59069f<_0x8f3756['length'];_0x59069f++){var _0x4b9ed3=_[_0x3188('0x4b')](_0x484eeb,[_0x3188('0x4f'),_0x8f3756[_0x59069f]['id']]);var _0x3e5f90={'id':_0x8f3756[_0x59069f]['id'],'name':_0x8f3756[_0x59069f][_0x3188('0x11')],'online':Boolean(_0x8f3756[_0x59069f][_0x3188('0x4d')]),'paused':_0x4b9ed3?Boolean(_0x4b9ed3['paused']):![]};if(_0x3e5f90[_0x3188('0x4d')])_0x4a290f['loggedInDb']++;if(_0x3e5f90[_0x3188('0x35')])_0x4a290f[_0x3188('0x35')]++;_0x4a290f[_0x3188('0x4a')][_0x3188('0x36')](_0x3e5f90);}return _0x4a290f;});});}else{var _0x55bd61=_0x3188('0x50')+_[_0x3188('0x1e')](_0x3f5b35)+_0x3188('0x51');var _0x258741=_0x3f5b35+_0x3188('0x52');return db[_0x55bd61]['findAll']({'where':{[_['startCase'](_0x3f5b35)+_0x3188('0x53')]:_0x201ef2['id']},'raw':!![]})[_0x3188('0x19')](function(_0x59371c){return db[_0x3188('0x50')][_0x3188('0x54')]({'attributes':['id','name',_0x3188('0x4d'),_0x258741],'where':{'id':_[_0x3188('0x1f')](_0x59371c,_0x3188('0x4f')),'role':_0x3188('0x55')},'raw':!![]});})[_0x3188('0x19')](function(_0x5a3142){for(var _0x467ead=0x0;_0x467ead<_0x5a3142['length'];_0x467ead++){var _0x44f133={'id':_0x5a3142[_0x467ead]['id'],'name':_0x5a3142[_0x467ead][_0x3188('0x11')],'online':Boolean(_0x5a3142[_0x467ead][_0x3188('0x4d')]),'paused':Boolean(_0x5a3142[_0x467ead][_0x258741])};if(_0x44f133[_0x3188('0x4d')])_0x4a290f[_0x3188('0x49')]++;if(_0x44f133[_0x3188('0x35')])_0x4a290f[_0x3188('0x35')]++;_0x4a290f[_0x3188('0x4a')][_0x3188('0x36')](_0x44f133);}return _0x4a290f;});}});return Promise[_0x3188('0x56')](_0x25ad4c);});})[_0x3188('0x19')](function(_0x50c08d){_0x19cc72['rows']=_0x50c08d;return _0x19cc72;})[_0x3188('0x19')](respondWithFilteredResult(_0x53668b,_0x1c3598))['catch'](handleError(_0x53668b,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d3375f7..7c9c3d3 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x239a30,_0x47c987){var _0x32671e=function(_0x9c2369){while(--_0x9c2369){_0x239a30['push'](_0x239a30['shift']());}};_0x32671e(++_0x47c987);}(_0xedd9,0xfc));var _0x9edd=function(_0x810d09,_0x4adab4){_0x810d09=_0x810d09-0x0;var _0x417828=_0xedd9[_0x810d09];return _0x417828;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1580c6,_0x3f2acb){var _0x38cb08=function(_0x3ee6ad){while(--_0x3ee6ad){_0x1580c6['push'](_0x1580c6['shift']());}};_0x38cb08(++_0x3f2acb);}(_0xe706,0xa3));var _0x6e70=function(_0x56321f,_0x1c41eb){_0x56321f=_0x56321f-0x0;var _0x5aa129=_0xe706[_0x56321f];return _0x5aa129;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2290801..cdf6e4c 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 _0xee4a=['STRING','DATE','sequelize','INTEGER'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xee4a,0x9e));var _0xaee4=function(_0x5595c1,_0x1471b5){_0x5595c1=_0x5595c1-0x0;var _0x18f01=_0xee4a[_0x5595c1];return _0x18f01;};'use strict';var Sequelize=require(_0xaee4('0x0'));module['exports']={'state':{'type':Sequelize[_0xaee4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xaee4('0x2')]},'scheduledat':{'type':Sequelize[_0xaee4('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaee4('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xaee4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xaee4('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x04f9=['INTEGER','STRING','DATE','exports'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0x04f9,0xb3));var _0x904f=function(_0x170b75,_0x28ca69){_0x170b75=_0x170b75-0x0;var _0x38ca90=_0x04f9[_0x170b75];return _0x38ca90;};'use strict';var Sequelize=require('sequelize');module[_0x904f('0x0')]={'state':{'type':Sequelize[_0x904f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x904f('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x904f('0x2')]},'starttime':{'type':Sequelize[_0x904f('0x3')]},'responsetime':{'type':Sequelize[_0x904f('0x3')]},'ringtime':{'type':Sequelize[_0x904f('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x904f('0x2')]},'campaigntype':{'type':Sequelize[_0x904f('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 722b0fd..28ca39c 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 _0x2330=['lodash','moment','bluebird','request-promise','path','../../config/environment','exports','define','report_agent_preview'];(function(_0x414e82,_0x2e58b5){var _0x140ba4=function(_0x4180f9){while(--_0x4180f9){_0x414e82['push'](_0x414e82['shift']());}};_0x140ba4(++_0x2e58b5);}(_0x2330,0x7e));var _0x0233=function(_0x14e393,_0x5ef7b3){_0x14e393=_0x14e393-0x0;var _0x5b5ffa=_0x2330[_0x14e393];return _0x5b5ffa;};'use strict';var _=require(_0x0233('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0233('0x1'));var BPromise=require(_0x0233('0x2'));var rp=require(_0x0233('0x3'));var fs=require('fs');var path=require(_0x0233('0x4'));var rimraf=require('rimraf');var config=require(_0x0233('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0x0233('0x6')]=function(_0x4b8364,_0x4af916){return _0x4b8364[_0x0233('0x7')]('ReportAgentPreview',attributes,{'tableName':_0x0233('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc06=['moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','lodash','util','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfc06,0x13d));var _0x6fc0=function(_0x2b3087,_0x5bad3a){_0x2b3087=_0x2b3087-0x0;var _0x39bb6a=_0xfc06[_0x2b3087];return _0x39bb6a;};'use strict';var _=require(_0x6fc0('0x0'));var util=require(_0x6fc0('0x1'));var logger=require(_0x6fc0('0x2'))('api');var moment=require(_0x6fc0('0x3'));var BPromise=require(_0x6fc0('0x4'));var rp=require(_0x6fc0('0x5'));var fs=require('fs');var path=require(_0x6fc0('0x6'));var rimraf=require(_0x6fc0('0x7'));var config=require('../../config/environment');var attributes=require(_0x6fc0('0x8'));module[_0x6fc0('0x9')]=function(_0x33f57f,_0x395d8f){return _0x33f57f['define']('ReportAgentPreview',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 d48a6ba..7b9c921 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 _0x340f=['moment','randomstring','ioredis','../../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','stringify','error','code','message','result','catch','CreateReportAgentPreview','body','options','raw','then','lodash'];(function(_0x445c34,_0x2e884f){var _0x122dc4=function(_0x4f3378){while(--_0x4f3378){_0x445c34['push'](_0x445c34['shift']());}};_0x122dc4(++_0x2e884f);}(_0x340f,0x194));var _0xf340=function(_0x44da69,_0x5244ad){_0x44da69=_0x44da69-0x0;var _0x1f7ff4=_0x340f[_0x44da69];return _0x1f7ff4;};'use strict';var _=require(_0xf340('0x0'));var util=require('util');var moment=require(_0xf340('0x1'));var BPromise=require('bluebird');var rs=require(_0xf340('0x2'));var fs=require('fs');var Redis=require(_0xf340('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf340('0x4'))(_0xf340('0x5'));var config=require(_0xf340('0x6'));var jayson=require(_0xf340('0x7'));var client=jayson[_0xf340('0x8')][_0xf340('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x334b5c,_0x407cc4,_0x1941ac){return new BPromise(function(_0x4ed288,_0x4cf5c7){return client[_0xf340('0xa')](_0x334b5c,_0x1941ac)['then'](function(_0xc4dee3){logger[_0xf340('0xb')](_0xf340('0xc'),_0x407cc4,_0xf340('0xd'));logger[_0xf340('0xe')](_0xf340('0xf'),_0x407cc4,_0xf340('0xd'),JSON[_0xf340('0x10')](_0xc4dee3));if(_0xc4dee3['error']){if(_0xc4dee3[_0xf340('0x11')][_0xf340('0x12')]===0x1f4){logger['error'](_0xf340('0xc'),_0x407cc4,_0xc4dee3[_0xf340('0x11')][_0xf340('0x13')]);return _0x4cf5c7(_0xc4dee3[_0xf340('0x11')][_0xf340('0x13')]);}logger[_0xf340('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x407cc4,_0xc4dee3['error'][_0xf340('0x13')]);return _0x4ed288(_0xc4dee3[_0xf340('0x11')][_0xf340('0x13')]);}else{logger[_0xf340('0xb')](_0xf340('0xc'),_0x407cc4,'request\x20sent');_0x4ed288(_0xc4dee3[_0xf340('0x14')][_0xf340('0x13')]);}})[_0xf340('0x15')](function(_0x4d5f15){logger[_0xf340('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x407cc4,_0x4d5f15);_0x4cf5c7(_0x4d5f15);});});}exports[_0xf340('0x16')]=function(_0x2780b1){var _0x16c131=this;return new Promise(function(_0x316820,_0x4ce5d4){return db['ReportAgentPreview']['create'](_0x2780b1[_0xf340('0x17')],{'raw':_0x2780b1['options']?_0x2780b1[_0xf340('0x18')][_0xf340('0x19')]===undefined?!![]:![]:!![]})[_0xf340('0x1a')](function(_0xef1da8){logger[_0xf340('0xb')]('CreateReportAgentPreview',_0x2780b1);logger[_0xf340('0xe')](_0xf340('0x16'),_0x2780b1,JSON[_0xf340('0x10')](_0xef1da8));_0x316820(_0xef1da8);})['catch'](function(_0x551ac8){logger[_0xf340('0x11')](_0xf340('0x16'),_0x551ac8[_0xf340('0x13')],_0x2780b1);_0x4ce5d4(_0x16c131[_0xf340('0x11')](0x1f4,_0x551ac8['message']));});});}; \ No newline at end of file +var _0xa78d=['options','raw','CreateReportAgentPreview','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','body'];(function(_0x4569ed,_0x287abc){var _0xe05886=function(_0x34dea4){while(--_0x34dea4){_0x4569ed['push'](_0x4569ed['shift']());}};_0xe05886(++_0x287abc);}(_0xa78d,0x7b));var _0xda78=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xa78d[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0xda78('0x0'));var util=require('util');var moment=require(_0xda78('0x1'));var BPromise=require('bluebird');var rs=require(_0xda78('0x2'));var fs=require('fs');var Redis=require(_0xda78('0x3'));var db=require(_0xda78('0x4'))['db'];var utils=require(_0xda78('0x5'));var logger=require(_0xda78('0x6'))(_0xda78('0x7'));var config=require(_0xda78('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xda78('0x9')][_0xda78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e58f1,_0x422a5b,_0x462696){return new BPromise(function(_0x3cc404,_0x547fae){return client[_0xda78('0xb')](_0x5e58f1,_0x462696)[_0xda78('0xc')](function(_0x317dd8){logger[_0xda78('0xd')](_0xda78('0xe'),_0x422a5b,_0xda78('0xf'));logger[_0xda78('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x422a5b,_0xda78('0xf'),JSON[_0xda78('0x11')](_0x317dd8));if(_0x317dd8[_0xda78('0x12')]){if(_0x317dd8['error']['code']===0x1f4){logger[_0xda78('0x12')](_0xda78('0xe'),_0x422a5b,_0x317dd8[_0xda78('0x12')][_0xda78('0x13')]);return _0x547fae(_0x317dd8[_0xda78('0x12')]['message']);}logger[_0xda78('0x12')](_0xda78('0xe'),_0x422a5b,_0x317dd8['error'][_0xda78('0x13')]);return _0x3cc404(_0x317dd8[_0xda78('0x12')][_0xda78('0x13')]);}else{logger[_0xda78('0xd')](_0xda78('0xe'),_0x422a5b,'request\x20sent');_0x3cc404(_0x317dd8['result'][_0xda78('0x13')]);}})['catch'](function(_0x4dec03){logger[_0xda78('0x12')](_0xda78('0xe'),_0x422a5b,_0x4dec03);_0x547fae(_0x4dec03);});});}exports['CreateReportAgentPreview']=function(_0x25fa1f){var _0x3d611e=this;return new Promise(function(_0x4b9b00,_0x513293){return db['ReportAgentPreview']['create'](_0x25fa1f[_0xda78('0x14')],{'raw':_0x25fa1f[_0xda78('0x15')]?_0x25fa1f[_0xda78('0x15')][_0xda78('0x16')]===undefined?!![]:![]:!![]})[_0xda78('0xc')](function(_0x530bad){logger[_0xda78('0xd')](_0xda78('0x17'),_0x25fa1f);logger[_0xda78('0x10')](_0xda78('0x17'),_0x25fa1f,JSON[_0xda78('0x11')](_0x530bad));_0x4b9b00(_0x530bad);})['catch'](function(_0x202e75){logger['error']('CreateReportAgentPreview',_0x202e75[_0xda78('0x13')],_0x25fa1f);_0x513293(_0x3d611e[_0xda78('0x12')](0x1f4,_0x202e75[_0xda78('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e71e0ae..a1a9521 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 _0x69d3=['/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','/voice/channels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues'];(function(_0x35b4c6,_0x5e57a2){var _0xa45f4c=function(_0x347b3e){while(--_0x347b3e){_0x35b4c6['push'](_0x35b4c6['shift']());}};_0xa45f4c(++_0x5e57a2);}(_0x69d3,0xda));var _0x369d=function(_0x38071c,_0x263bff){_0x38071c=_0x38071c-0x0;var _0x2ee64a=_0x69d3[_0x38071c];return _0x2ee64a;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var express=require('express');var router=express[_0x369d('0x3')]();var auth=require(_0x369d('0x4'));var controller=require('./rpc.controller');router['get'](_0x369d('0x5'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x369d('0x6')](_0x369d('0x7'),auth[_0x369d('0x8')](),controller[_0x369d('0x9')]);router[_0x369d('0x6')](_0x369d('0xa'),auth[_0x369d('0x8')](),controller[_0x369d('0xb')]);router[_0x369d('0x6')]('/voice/queues',auth['isAuthenticated'](),controller[_0x369d('0xc')]);router[_0x369d('0x6')](_0x369d('0xd'),auth[_0x369d('0x8')](),controller['chatQueues']);router['get'](_0x369d('0xe'),auth[_0x369d('0x8')](),controller[_0x369d('0xf')]);router[_0x369d('0x6')](_0x369d('0x10'),auth[_0x369d('0x8')](),controller['mailAccounts']);router[_0x369d('0x6')](_0x369d('0x11'),auth[_0x369d('0x8')](),controller[_0x369d('0x12')]);router[_0x369d('0x6')]('/sms/queues',auth['isAuthenticated'](),controller['smsQueues']);router[_0x369d('0x6')](_0x369d('0x13'),auth[_0x369d('0x8')](),controller['whatsappQueues']);router[_0x369d('0x6')](_0x369d('0x14'),auth[_0x369d('0x8')](),controller['faxQueues']);router[_0x369d('0x6')](_0x369d('0x15'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x369d('0x16'),auth[_0x369d('0x8')](),controller[_0x369d('0x17')]);router['get'](_0x369d('0x18'),auth[_0x369d('0x8')](),controller[_0x369d('0x19')]);router[_0x369d('0x6')](_0x369d('0x1a'),auth['isAuthenticated'](),controller[_0x369d('0x1b')]);router[_0x369d('0x6')](_0x369d('0x1c'),auth[_0x369d('0x8')](),controller[_0x369d('0x1d')]);router[_0x369d('0x6')](_0x369d('0x1e'),auth[_0x369d('0x8')](),controller['showVoiceQueues']);router['put'](_0x369d('0x1e'),auth[_0x369d('0x8')](),controller[_0x369d('0x1f')]);router[_0x369d('0x6')](_0x369d('0x20'),auth[_0x369d('0x8')](),controller[_0x369d('0x21')]);router['get']('/outbound/channels',auth[_0x369d('0x8')](),controller[_0x369d('0x22')]);router[_0x369d('0x6')](_0x369d('0x23'),auth[_0x369d('0x8')](),controller[_0x369d('0x24')]);router[_0x369d('0x25')]('/agents/:id/capacity',auth[_0x369d('0x8')](),controller[_0x369d('0x26')]);router[_0x369d('0x6')](_0x369d('0x27'),auth[_0x369d('0x8')](),controller[_0x369d('0x28')]);router[_0x369d('0x6')]('/trunks',auth[_0x369d('0x8')](),controller['trunks']);router['get'](_0x369d('0x29'),auth[_0x369d('0x8')](),controller['campaigns']);router[_0x369d('0x6')]('/fax/accounts',auth[_0x369d('0x8')](),controller[_0x369d('0x2a')]);router[_0x369d('0x6')](_0x369d('0x2b'),auth[_0x369d('0x8')](),controller[_0x369d('0x2c')]);router[_0x369d('0x6')]('/mail/queues/waitinginteractions',auth[_0x369d('0x8')](),controller[_0x369d('0x2d')]);router[_0x369d('0x6')](_0x369d('0x2e'),auth[_0x369d('0x8')](),controller[_0x369d('0x2f')]);router[_0x369d('0x6')](_0x369d('0x30'),auth['isAuthenticated'](),controller[_0x369d('0x31')]);router[_0x369d('0x6')](_0x369d('0x32'),auth[_0x369d('0x8')](),controller[_0x369d('0x33')]);router['get'](_0x369d('0x34'),auth[_0x369d('0x8')](),controller[_0x369d('0x35')]);router[_0x369d('0x6')](_0x369d('0x36'),auth[_0x369d('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x369d('0x37')](_0x369d('0x38'),auth[_0x369d('0x8')](),controller[_0x369d('0x39')](_0x369d('0x3a')));router[_0x369d('0x6')](_0x369d('0x3b'),auth[_0x369d('0x8')](),controller[_0x369d('0x3c')]);router[_0x369d('0x37')](_0x369d('0x3d'),auth[_0x369d('0x8')](),controller[_0x369d('0x39')](_0x369d('0x3e')));router[_0x369d('0x6')](_0x369d('0x3f'),auth[_0x369d('0x8')](),controller[_0x369d('0x40')]);router[_0x369d('0x37')](_0x369d('0x41'),auth[_0x369d('0x8')](),controller[_0x369d('0x39')](_0x369d('0x42')));router[_0x369d('0x6')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x369d('0x43')]);router[_0x369d('0x37')](_0x369d('0x44'),auth[_0x369d('0x8')](),controller[_0x369d('0x39')](_0x369d('0x45')));router[_0x369d('0x6')](_0x369d('0x46'),auth[_0x369d('0x8')](),controller['showOpenchannelQueues']);router[_0x369d('0x37')](_0x369d('0x47'),auth[_0x369d('0x8')](),controller[_0x369d('0x39')](_0x369d('0x48')));router[_0x369d('0x37')](_0x369d('0x49'),auth[_0x369d('0x8')](),controller['queueNotify']('whatsapp'));router[_0x369d('0x6')](_0x369d('0x4a'),auth[_0x369d('0x8')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x369d('0x8')](),controller[_0x369d('0x4b')]);router['post'](_0x369d('0x4c'),auth[_0x369d('0x8')](),controller[_0x369d('0x4d')]);module[_0x369d('0x4e')]=router; \ No newline at end of file +var _0x52ae=['voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x59372a,_0x2b45bd){var _0xc4731a=function(_0x4a4437){while(--_0x4a4437){_0x59372a['push'](_0x59372a['shift']());}};_0xc4731a(++_0x2b45bd);}(_0x52ae,0x17e));var _0xe52a=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x52ae[_0x44c974];return _0x5214c6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express[_0xe52a('0x0')]();var auth=require(_0xe52a('0x1'));var controller=require(_0xe52a('0x2'));router[_0xe52a('0x3')](_0xe52a('0x4'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x6')]);router[_0xe52a('0x3')](_0xe52a('0x7'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x8')]);router['get'](_0xe52a('0x9'),auth[_0xe52a('0x5')](),controller[_0xe52a('0xa')]);router[_0xe52a('0x3')](_0xe52a('0xb'),auth[_0xe52a('0x5')](),controller[_0xe52a('0xc')]);router['get'](_0xe52a('0xd'),auth['isAuthenticated'](),controller[_0xe52a('0xe')]);router[_0xe52a('0x3')](_0xe52a('0xf'),auth['isAuthenticated'](),controller[_0xe52a('0x10')]);router[_0xe52a('0x3')](_0xe52a('0x11'),auth['isAuthenticated'](),controller[_0xe52a('0x12')]);router[_0xe52a('0x3')]('/openchannel/queues',auth[_0xe52a('0x5')](),controller[_0xe52a('0x13')]);router[_0xe52a('0x3')](_0xe52a('0x14'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x15')]);router[_0xe52a('0x3')](_0xe52a('0x16'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xe52a('0x3')](_0xe52a('0x17'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x18')]);router[_0xe52a('0x3')](_0xe52a('0x19'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x1a')]);router[_0xe52a('0x3')](_0xe52a('0x1b'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x1c')]);router['get'](_0xe52a('0x1d'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x1e')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xe52a('0x5')](),controller[_0xe52a('0x1f')]);router[_0xe52a('0x3')](_0xe52a('0x20'),auth[_0xe52a('0x5')](),controller['voiceQueuesChannelRedirect']);router[_0xe52a('0x3')](_0xe52a('0x21'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x22')]);router[_0xe52a('0x23')](_0xe52a('0x21'),auth[_0xe52a('0x5')](),controller['updateVoiceQueue']);router['get'](_0xe52a('0x24'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x25')]);router['get'](_0xe52a('0x26'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x27')]);router[_0xe52a('0x3')](_0xe52a('0x28'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x29')]);router[_0xe52a('0x23')](_0xe52a('0x2a'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x2b')]);router[_0xe52a('0x3')](_0xe52a('0x2c'),auth[_0xe52a('0x5')](),controller['telephones']);router['get'](_0xe52a('0x2d'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x2e')]);router[_0xe52a('0x3')](_0xe52a('0x2f'),auth[_0xe52a('0x5')](),controller['campaigns']);router[_0xe52a('0x3')](_0xe52a('0x30'),auth[_0xe52a('0x5')](),controller['faxAccounts']);router[_0xe52a('0x3')](_0xe52a('0x31'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xe52a('0x3')](_0xe52a('0x32'),auth['isAuthenticated'](),controller[_0xe52a('0x33')]);router[_0xe52a('0x3')](_0xe52a('0x34'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x35')]);router[_0xe52a('0x3')](_0xe52a('0x36'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x37')]);router[_0xe52a('0x3')](_0xe52a('0x38'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xe52a('0x5')](),controller[_0xe52a('0x39')]);router['get'](_0xe52a('0x3a'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x3b')]);router[_0xe52a('0x3c')]('/mail/queues/:id/notify',auth[_0xe52a('0x5')](),controller[_0xe52a('0x3d')](_0xe52a('0x3e')));router[_0xe52a('0x3')]('/mail/queues/:id',auth[_0xe52a('0x5')](),controller['showMailQueues']);router['post']('/chat/queues/:id/notify',auth[_0xe52a('0x5')](),controller[_0xe52a('0x3d')]('chat'));router[_0xe52a('0x3')](_0xe52a('0x3f'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x40')]);router['post'](_0xe52a('0x41'),auth[_0xe52a('0x5')](),controller['queueNotify'](_0xe52a('0x42')));router[_0xe52a('0x3')](_0xe52a('0x43'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x44')]);router[_0xe52a('0x3c')](_0xe52a('0x45'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x3d')](_0xe52a('0x46')));router[_0xe52a('0x3')](_0xe52a('0x47'),auth[_0xe52a('0x5')](),controller['showOpenchannelQueues']);router[_0xe52a('0x3c')]('/sms/queues/:id/notify',auth[_0xe52a('0x5')](),controller[_0xe52a('0x3d')]('sms'));router[_0xe52a('0x3c')](_0xe52a('0x48'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x3d')](_0xe52a('0x49')));router['get'](_0xe52a('0x4a'),auth[_0xe52a('0x5')](),controller[_0xe52a('0x4b')]);router['get']('/whatsapp/queues/:id',auth[_0xe52a('0x5')](),controller[_0xe52a('0x4c')]);router[_0xe52a('0x3c')]('/agents/:id/notify',auth[_0xe52a('0x5')](),controller[_0xe52a('0x4d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6abbd54..8ff9567 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 _0xbd51=['chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','create','Start','queue','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','client','http','request','error','code','message','catch','status','json','stack','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts'];(function(_0x57e05f,_0x318b8d){var _0x435e54=function(_0x5de9eb){while(--_0x5de9eb){_0x57e05f['push'](_0x57e05f['shift']());}};_0x435e54(++_0x318b8d);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x233cf2,_0x522849){_0x233cf2=_0x233cf2-0x0;var _0x14bde9=_0xbd51[_0x233cf2];return _0x14bde9;};'use strict';var BPromise=require(_0x1bd5('0x0'));var moment=require('moment');var _=require(_0x1bd5('0x1'));var util=require(_0x1bd5('0x2'));var db=require(_0x1bd5('0x3'))['db'];var logger=require(_0x1bd5('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0x1bd5('0x5')][_0x1bd5('0x6')]({'port':0x232b});var routingClient=jayson[_0x1bd5('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){var _0x4a7f90=_0x19077c?_0x19077c:amiClient;return _0x4a7f90[_0x1bd5('0x7')](_0x29abea,_0x30a385)['then'](function(_0x2bd975){if(_0x2bd975[_0x1bd5('0x8')]){if(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0x9')]===0x1f4){return _0xd8418f(_0x2bd975[_0x1bd5('0x8')][_0x1bd5('0xa')]);}return _0x27d58f(_0x2bd975['error'][_0x1bd5('0xa')]);}else{_0x27d58f(_0x2bd975['result']);}})[_0x1bd5('0xb')](function(_0x24e38c){_0xd8418f(_0x24e38c);});});}function respondWithResult(_0x37e8e1,_0x14606b){_0x14606b=_0x14606b||0xc8;return function(_0x177be0){if(_0x177be0){return _0x37e8e1[_0x1bd5('0xc')](_0x14606b)[_0x1bd5('0xd')](_0x177be0);}return _0x37e8e1['sendStatus'](0x194);};}function handleError(_0x5650b5,_0x8b2390){_0x8b2390=_0x8b2390||0x1f4;return function(_0x6d2c40){logger[_0x1bd5('0x8')](_0x6d2c40[_0x1bd5('0xe')]);if(_0x6d2c40['name']){delete _0x6d2c40['name'];}_0x5650b5[_0x1bd5('0xc')](_0x8b2390)[_0x1bd5('0xf')](_0x6d2c40);};}function findById(_0x2b2c57){return function(_0x4793dd){if(!_[_0x1bd5('0x10')](_0x2b2c57)&&!_[_0x1bd5('0x10')](_0x4793dd)&&!_[_0x1bd5('0x10')](_0x4793dd[_0x1bd5('0x11')])){return _[_0x1bd5('0x12')](_0x4793dd['rows'],function(_0x53ad5e){return _0x53ad5e['id']==_0x2b2c57;});}return null;};}exports[_0x1bd5('0x13')]=function(_0x260827,_0x476bd1){return respondWithRpcPromise(_0x1bd5('0x14'),_0x260827[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x476bd1,null))[_0x1bd5('0xb')](handleError(_0x476bd1,null));};exports[_0x1bd5('0x17')]=function(_0x456051,_0xb1ac1e){return respondWithRpcPromise(_0x1bd5('0x18'),_[_0x1bd5('0x19')](_0x456051[_0x1bd5('0x15')],_0x456051[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0xb1ac1e,null))[_0x1bd5('0xb')](handleError(_0xb1ac1e,null));};exports[_0x1bd5('0x1b')]=function(_0x29c340,_0x5567c9){return respondWithRpcPromise(_0x1bd5('0x1c'),_['merge'](_0x29c340[_0x1bd5('0x15')],_0x29c340[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x5567c9,null))['catch'](handleError(_0x5567c9,null));};exports[_0x1bd5('0x1d')]=function(_0x4fa37c,_0x2ed551){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x4fa37c[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x2ed551,null))['catch'](handleError(_0x2ed551,null));};exports[_0x1bd5('0x1f')]=function(_0x69bb17,_0x20245c){return respondWithRpcPromise(_0x1bd5('0x1e'),_0x69bb17['query'])[_0x1bd5('0x16')](findById(_0x69bb17[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x20245c,null))[_0x1bd5('0xb')](handleError(_0x20245c,null));};exports[_0x1bd5('0x20')]=function(_0xc73670,_0x4e72b2){return respondWithRpcPromise(_0x1bd5('0x21'),_[_0x1bd5('0x19')](_0xc73670[_0x1bd5('0x22')],_0xc73670['params']))[_0x1bd5('0x16')](respondWithResult(_0x4e72b2,null))[_0x1bd5('0xb')](handleError(_0x4e72b2,null));};exports[_0x1bd5('0x23')]=function(_0x3430bf,_0x1f4456){return respondWithRpcPromise(_0x1bd5('0x24'),_['merge'](_0x3430bf['query'],_0x3430bf[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x1f4456,null))['catch'](handleError(_0x1f4456,null));};exports[_0x1bd5('0x25')]=function(_0x198b88,_0x1efa8c){return respondWithRpcPromise(_0x1bd5('0x26'),_0x198b88['query'])[_0x1bd5('0x16')](respondWithResult(_0x1efa8c,null))[_0x1bd5('0xb')](handleError(_0x1efa8c,null));};exports[_0x1bd5('0x27')]=function(_0x233743,_0x209ce1){return respondWithRpcPromise(_0x1bd5('0x28'),_[_0x1bd5('0x19')](_0x233743[_0x1bd5('0x15')],_0x233743['params']))[_0x1bd5('0x16')](respondWithResult(_0x209ce1,null))[_0x1bd5('0xb')](handleError(_0x209ce1,null));};exports[_0x1bd5('0x29')]=function(_0x24c92e,_0x11a6d2){return respondWithRpcPromise(_0x1bd5('0x2a'),_[_0x1bd5('0x19')](_0x24c92e['query'],_0x24c92e[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x11a6d2,null))[_0x1bd5('0xb')](handleError(_0x11a6d2,null));};exports[_0x1bd5('0x2b')]=function(_0x3cf898,_0x192ca7){return respondWithRpcPromise(_0x1bd5('0x2c'),_['merge'](_0x3cf898['query'],_0x3cf898[_0x1bd5('0x1a')]))[_0x1bd5('0x16')](respondWithResult(_0x192ca7,null))[_0x1bd5('0xb')](handleError(_0x192ca7,null));};exports['outbound']=function(_0x4595a0,_0x5af974){return respondWithRpcPromise(_0x1bd5('0x2d'),_0x4595a0[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5af974,null))[_0x1bd5('0xb')](handleError(_0x5af974,null));};exports[_0x1bd5('0x2e')]=function(_0x2470ec,_0x41096d){return respondWithRpcPromise(_0x1bd5('0x2f'),_0x2470ec['query'])[_0x1bd5('0x16')](respondWithResult(_0x41096d,null))[_0x1bd5('0xb')](handleError(_0x41096d,null));};exports['agents']=function(_0x3b5a0d,_0x77ebcf){var _0x20b25c;return respondWithRpcPromise('Agents',_0x3b5a0d[_0x1bd5('0x15')])[_0x1bd5('0x16')](function(_0x2997a2){_0x20b25c=_0x2997a2;return respondWithRpcPromise(_0x1bd5('0x30'),_0x3b5a0d['query'],routingClient);})[_0x1bd5('0x16')](function(_0x22f437){return _[_0x1bd5('0x19')]({},_0x22f437,_0x20b25c);})[_0x1bd5('0x16')](respondWithResult(_0x77ebcf,null))['catch'](handleError(_0x77ebcf,null));};exports['agentCapacity']=function(_0x40eeff,_0x35afc7){if(_0x40eeff[_0x1bd5('0x22')]&&_0x40eeff['body'][_0x1bd5('0x31')]&&_0x40eeff[_0x1bd5('0x32')]&&_0x40eeff['user'][_0x1bd5('0x33')]){for(var _0x5761b8 in _0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')]){if(_0x40eeff['body'][_0x1bd5('0x31')][_0x1bd5('0x34')](_0x5761b8)){db[_0x1bd5('0x35')][_0x1bd5('0x36')]({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'exitAt':null,'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]&&_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x1bd5('0x38')]?{'$notIn':_0x40eeff['body'][_0x1bd5('0x31')][_0x5761b8]}:{'$ne':null}}})[_0x1bd5('0x16')](function(_0x335125){var _0x52ade4=moment()[_0x1bd5('0x39')](_0x1bd5('0x3a'));for(var _0x5bb8a6=0x0,_0x1dbde9=_0x335125['length'];_0x5bb8a6<_0x1dbde9;_0x5bb8a6+=0x1){_0x335125[_0x5bb8a6][_0x1bd5('0x3b')]({'exitAt':_0x52ade4});}});for(var _0x558fec=0x0;_0x558fec<_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8]['length'];_0x558fec+=0x1){db[_0x1bd5('0x35')]['findOrCreate']({'where':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'type':_0x1bd5('0x37'),'uniqueid':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x31')][_0x5761b8][_0x558fec],'exitAt':null},'defaults':{'channel':_0x5761b8,'membername':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')],'interface':_[_0x1bd5('0x10')](_0x40eeff['user'][_0x1bd5('0x3c')])?util[_0x1bd5('0x39')](_0x1bd5('0x3d'),_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x33')]):_0x40eeff[_0x1bd5('0x32')]['interface'],'type':_0x1bd5('0x37'),'enterAt':moment()[_0x1bd5('0x39')](_0x1bd5('0x3a')),'role':_0x1bd5('0x3e'),'internal':_0x40eeff[_0x1bd5('0x32')][_0x1bd5('0x3f')],'uniqueid':_0x40eeff[_0x1bd5('0x22')]['interaction'][_0x5761b8][_0x558fec]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x40eeff[_0x1bd5('0x1a')]['id'],'capacity':_0x40eeff[_0x1bd5('0x22')][_0x1bd5('0x40')]},routingClient)['then'](respondWithResult(_0x35afc7,null))[_0x1bd5('0xb')](handleError(_0x35afc7,null));};exports[_0x1bd5('0x41')]=function(_0x1ad2ff,_0x1f2d7e){return respondWithRpcPromise(_0x1bd5('0x42'),_0x1ad2ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x1f2d7e,null))['catch'](handleError(_0x1f2d7e,null));};exports[_0x1bd5('0x43')]=function(_0x2bcd23,_0x4f2d91){return respondWithRpcPromise(_0x1bd5('0x44'),_0x2bcd23['query'])[_0x1bd5('0x16')](respondWithResult(_0x4f2d91,null))['catch'](handleError(_0x4f2d91,null));};exports[_0x1bd5('0x45')]=function(_0x555ba1,_0x5a011e){return respondWithRpcPromise(_0x1bd5('0x46'),_0x555ba1[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x5a011e,null))[_0x1bd5('0xb')](handleError(_0x5a011e,null));};exports[_0x1bd5('0x47')]=function(_0x33f011,_0x35c478){return respondWithRpcPromise('ChatQueues',_0x33f011[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x35c478,null))[_0x1bd5('0xb')](handleError(_0x35c478,null));};exports[_0x1bd5('0x48')]=function(_0x2cc5ba,_0x5a8132){return respondWithRpcPromise('ChatQueues',_0x2cc5ba[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x2cc5ba[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x5a8132,null))[_0x1bd5('0xb')](handleError(_0x5a8132,null));};exports[_0x1bd5('0x49')]=function(_0x46e36c,_0x383a68){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x46e36c[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x383a68,null))[_0x1bd5('0xb')](handleError(_0x383a68,null));};exports['showMailQueues']=function(_0x2fe8f4,_0x34d93b){return respondWithRpcPromise(_0x1bd5('0x4a'),_0x2fe8f4['query'],routingClient)[_0x1bd5('0x16')](findById(_0x2fe8f4[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x34d93b,null))['catch'](handleError(_0x34d93b,null));};exports[_0x1bd5('0x4b')]=function(_0x10103a,_0x39f973){return respondWithRpcPromise(_0x1bd5('0x4c'),_0x10103a['query'],mailClient)['then'](respondWithResult(_0x39f973,null))[_0x1bd5('0xb')](handleError(_0x39f973,null));};exports[_0x1bd5('0x4d')]=function(_0x1790af,_0x54a8c4){return respondWithRpcPromise('OpenchannelQueues',_0x1790af[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x54a8c4,null))[_0x1bd5('0xb')](handleError(_0x54a8c4,null));};exports[_0x1bd5('0x4e')]=function(_0x5068ae,_0x32f646){return respondWithRpcPromise('OpenchannelQueues',_0x5068ae[_0x1bd5('0x15')],routingClient)['then'](findById(_0x5068ae[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x32f646,null))['catch'](handleError(_0x32f646,null));};exports[_0x1bd5('0x4f')]=function(_0x19f765,_0x47ca3f){return respondWithRpcPromise('SmsQueues',_0x19f765[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x47ca3f,null))['catch'](handleError(_0x47ca3f,null));};exports[_0x1bd5('0x50')]=function(_0x40b508,_0x5da595){return respondWithRpcPromise('SmsQueues',_0x40b508[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x40b508[_0x1bd5('0x1a')]['id']))['then'](respondWithResult(_0x5da595,null))[_0x1bd5('0xb')](handleError(_0x5da595,null));};exports[_0x1bd5('0x51')]=function(_0x5c1db7,_0x4b317d){return respondWithRpcPromise(_0x1bd5('0x52'),_0x5c1db7[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x4b317d,null))[_0x1bd5('0xb')](handleError(_0x4b317d,null));};exports[_0x1bd5('0x53')]=function(_0x53c6de,_0x3827d7){return respondWithRpcPromise('WhatsappQueues',_0x53c6de[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0x53c6de[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x3827d7,null))['catch'](handleError(_0x3827d7,null));};exports['faxQueues']=function(_0x3a7dd6,_0x36d62e){return respondWithRpcPromise(_0x1bd5('0x54'),_0x3a7dd6[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x36d62e,null))[_0x1bd5('0xb')](handleError(_0x36d62e,null));};exports[_0x1bd5('0x55')]=function(_0xc080d5,_0x1a35cf){return respondWithRpcPromise(_0x1bd5('0x54'),_0xc080d5[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](findById(_0xc080d5[_0x1bd5('0x1a')]['id']))[_0x1bd5('0x16')](respondWithResult(_0x1a35cf,null))[_0x1bd5('0xb')](handleError(_0x1a35cf,null));};exports[_0x1bd5('0x56')]=function(_0x1b99ff,_0x195176){return respondWithRpcPromise(_0x1bd5('0x57'),_0x1b99ff[_0x1bd5('0x15')])[_0x1bd5('0x16')](respondWithResult(_0x195176,null))[_0x1bd5('0xb')](handleError(_0x195176,null));};exports[_0x1bd5('0x58')]=function(_0x3ddf27,_0x56e99c){return respondWithRpcPromise(_0x1bd5('0x59'),_0x3ddf27[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x56e99c,null))[_0x1bd5('0xb')](handleError(_0x56e99c,null));};exports[_0x1bd5('0x5a')]=function(_0x37a6f3,_0x1e282c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x37a6f3[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x1e282c,null))[_0x1bd5('0xb')](handleError(_0x1e282c,null));};exports[_0x1bd5('0x5b')]=function(_0x590b3d,_0x2ed59d){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x590b3d[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x2ed59d,null))[_0x1bd5('0xb')](handleError(_0x2ed59d,null));};exports[_0x1bd5('0x5d')]=function(_0x32a878,_0x4cc7a5){return respondWithRpcPromise(_0x1bd5('0x5c'),_0x32a878['query'],routingClient)['then'](function(_0x34f98c){if(_0x32a878['query'][_0x1bd5('0x5e')]!==undefined){var _0x1a4ee6=_(_0x34f98c['rows'])[_0x1bd5('0x5f')]([_0x32a878[_0x1bd5('0x15')][_0x1bd5('0x5e')],_0x32a878[_0x1bd5('0x1a')]['id']])[_0x1bd5('0x60')](_0x1bd5('0x61'))['uniq']()[_0x1bd5('0x62')]();return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x1c9cec){return _0x1a4ee6['indexOf'](_0x1c9cec['queue_id'])>-0x1;});}else{return _0x34f98c[_0x1bd5('0x11')][_0x1bd5('0x5f')](function(_0x2fe037){return _0x2fe037[_0x1bd5('0x61')]===parseInt(_0x32a878['params']['id']);});}})[_0x1bd5('0x16')](respondWithResult(_0x4cc7a5,null))['catch'](handleError(_0x4cc7a5,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a203f,_0x5045f9){return respondWithRpcPromise(_0x1bd5('0x63'),_0x3a203f[_0x1bd5('0x15')],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x5045f9,null))[_0x1bd5('0xb')](handleError(_0x5045f9,null));};exports[_0x1bd5('0x64')]=function(_0xab4ed6,_0x232077){return respondWithRpcPromise(_0x1bd5('0x65'),_0xab4ed6[_0x1bd5('0x15')],routingClient)['then'](respondWithResult(_0x232077,null))[_0x1bd5('0xb')](handleError(_0x232077,null));};exports['faxQueuesWaitingInteractions']=function(_0x58c715,_0x59b491){return respondWithRpcPromise(_0x1bd5('0x66'),_0x58c715['query'],routingClient)[_0x1bd5('0x16')](respondWithResult(_0x59b491,null))[_0x1bd5('0xb')](handleError(_0x59b491,null));};exports[_0x1bd5('0x67')]=function(_0x4a3f74){return function(_0x201968,_0x91bcf8){var _0x3410f8,_0x52cd5f;var _0xfc9282=_['capitalize'](_0x4a3f74);var _0x327eb6=_0x4a3f74===_0x1bd5('0x68')?_0x1bd5('0x69'):'Account';return db[_0xfc9282+'Queue'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x201968['params']['id']}})[_0x1bd5('0x16')](function(_0x53be05){if(_[_0x1bd5('0x10')](_0x53be05)){throw new Error(_0xfc9282+_0x1bd5('0x6b'));}_0x3410f8=_0x53be05;return db[_0xfc9282+_0x1bd5('0x6c')][_0x1bd5('0x6a')]({'where':{'id':_0x201968[_0x1bd5('0x22')][_0x1bd5('0x6d')]},'include':[{'model':db[_0xfc9282+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0xfc9282+_0x327eb6],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x3c90dc){if(_[_0x1bd5('0x10')](_0x3c90dc)){throw new Error(_0xfc9282+_0x1bd5('0x70'));}_0x52cd5f=_0x3c90dc;return _0x3c90dc[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2a1b4a={'uniqueid':_0x4a3f74+'.'+_0x52cd5f['id']+'.'+_0x52cd5f[_0x1bd5('0x6e')]['id'],'FromUserId':_0x201968[_0x1bd5('0x32')]['id'],'type':'queue'};_0x2a1b4a[_0xfc9282+_0x1bd5('0x72')]=_0x52cd5f['id'];_0x2a1b4a[_0xfc9282+_0x1bd5('0x73')]=_0x52cd5f['Interaction']['id'];_0x2a1b4a[_0x1bd5('0x74')+_0xfc9282+_0x327eb6+'Id']=_0x52cd5f[_0x1bd5('0x6f')]['id'];_0x2a1b4a['To'+_0xfc9282+_0x1bd5('0x75')]=_0x3410f8['id'];return db[_0xfc9282+'TransferReport'][_0x1bd5('0x76')](_0x2a1b4a);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x4a3f74,'interaction':_0x52cd5f[_0x1bd5('0x6e')],'message':_0x52cd5f,'account':_0x52cd5f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x78'),'appdata':_0x3410f8[_0x1bd5('0x33')]+','+(_0x52cd5f[_0x1bd5('0x6f')]['queueTransferTimeout']||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x91bcf8,null))['catch'](handleError(_0x91bcf8,null));};};exports['agentNotify']=function(_0x4230e9,_0x182d75){var _0x5c9098,_0x5d6b17;if(_[_0x1bd5('0x10')](_0x4230e9['body']['channel'])){throw new Error(_0x1bd5('0x7a'));}var _0x5cb13d=_0x4230e9[_0x1bd5('0x22')][_0x1bd5('0x7b')];var _0x5df043=_[_0x1bd5('0x7c')](_0x5cb13d);var _0x254c8d=_0x5cb13d===_0x1bd5('0x68')?'Website':_0x1bd5('0x6f');return db['User'][_0x1bd5('0x6a')]({'raw':!![],'where':{'id':_0x4230e9[_0x1bd5('0x1a')]['id'],'role':_0x1bd5('0x3e')}})[_0x1bd5('0x16')](function(_0x2f9dff){if(_['isNil'](_0x2f9dff)){throw new Error(_0x1bd5('0x7d'));}_0x5c9098=_0x2f9dff;return db[_0x5df043+'Message'][_0x1bd5('0x6a')]({'where':{'id':_0x4230e9['body']['messageId']},'include':[{'model':db[_0x5df043+_0x1bd5('0x6e')],'as':_0x1bd5('0x6e')},{'model':db[_0x5df043+_0x254c8d],'as':_0x1bd5('0x6f')}]});})[_0x1bd5('0x16')](function(_0x4c9931){if(_[_0x1bd5('0x10')](_0x4c9931)){throw new Error(_0x5df043+_0x1bd5('0x70'));}_0x5d6b17=_0x4c9931;return _0x4c9931[_0x1bd5('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1bd5('0x16')](function(){var _0x15e584={'uniqueid':_0x5cb13d+'.'+_0x5d6b17['id']+'.'+_0x5d6b17[_0x1bd5('0x6e')]['id'],'FromUserId':_0x4230e9[_0x1bd5('0x32')]['id'],'type':_0x1bd5('0x78'),'ToUserId':_0x5c9098['id']};_0x15e584[_0x5df043+_0x1bd5('0x72')]=_0x5d6b17['id'];_0x15e584[_0x5df043+_0x1bd5('0x73')]=_0x5d6b17[_0x1bd5('0x6e')]['id'];_0x15e584[_0x1bd5('0x74')+_0x5df043+_0x254c8d+'Id']=_0x5d6b17[_0x1bd5('0x6f')]['id'];return db[_0x5df043+_0x1bd5('0x7e')]['create'](_0x15e584);})[_0x1bd5('0x16')](function(){return respondWithRpcPromise(_0x1bd5('0x77'),{'channel':_0x5cb13d,'interaction':_0x5d6b17[_0x1bd5('0x6e')],'message':_0x5d6b17,'account':_0x5d6b17[_0x1bd5('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1bd5('0x3e'),'appdata':_0x5c9098[_0x1bd5('0x33')]+','+(_0x5d6b17[_0x1bd5('0x6f')][_0x1bd5('0x7f')]||0x12c),'interval':_0x1bd5('0x79')}]},routingClient);})[_0x1bd5('0x16')](respondWithResult(_0x182d75,null))[_0x1bd5('0xb')](handleError(_0x182d75,null));}; \ No newline at end of file +var _0xeff8=['error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','format','length','updateAttributes','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','messageId','update','InteractionId','create','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0xeff8,0x186));var _0x8eff=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xeff8[_0xc4001c];return _0x49f7bc;};'use strict';var BPromise=require(_0x8eff('0x0'));var moment=require(_0x8eff('0x1'));var _=require('lodash');var util=require(_0x8eff('0x2'));var db=require(_0x8eff('0x3'))['db'];var logger=require(_0x8eff('0x4'))('api');var jayson=require(_0x8eff('0x5'));var amiClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232a});var mailClient=jayson[_0x8eff('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){var _0x17f22b=_0x491f01?_0x491f01:amiClient;return _0x17f22b[_0x8eff('0x8')](_0x3409bc,_0x323b2)['then'](function(_0x56f120){if(_0x56f120[_0x8eff('0x9')]){if(_0x56f120[_0x8eff('0x9')][_0x8eff('0xa')]===0x1f4){return _0x19557f(_0x56f120['error'][_0x8eff('0xb')]);}return _0x3fb9ee(_0x56f120[_0x8eff('0x9')]['message']);}else{_0x3fb9ee(_0x56f120[_0x8eff('0xc')]);}})[_0x8eff('0xd')](function(_0x559143){_0x19557f(_0x559143);});});}function respondWithResult(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xc8;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0xe')](_0x45f280)[_0x8eff('0xf')](_0x43c914);}return _0x4a399e[_0x8eff('0x10')](0x194);};}function handleError(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0x1f4;return function(_0x212a2e){logger[_0x8eff('0x9')](_0x212a2e[_0x8eff('0x11')]);if(_0x212a2e[_0x8eff('0x12')]){delete _0x212a2e[_0x8eff('0x12')];}_0x56efdf[_0x8eff('0xe')](_0x3e7c01)[_0x8eff('0x13')](_0x212a2e);};}function findById(_0x16a4eb){return function(_0x427902){if(!_[_0x8eff('0x14')](_0x16a4eb)&&!_['isNil'](_0x427902)&&!_[_0x8eff('0x14')](_0x427902[_0x8eff('0x15')])){return _[_0x8eff('0x16')](_0x427902[_0x8eff('0x15')],function(_0x2cd7c5){return _0x2cd7c5['id']==_0x16a4eb;});}return null;};}exports[_0x8eff('0x17')]=function(_0x38f5ee,_0x399d96){return respondWithRpcPromise(_0x8eff('0x18'),_0x38f5ee[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x399d96,null))[_0x8eff('0xd')](handleError(_0x399d96,null));};exports[_0x8eff('0x1b')]=function(_0x2a7337,_0xdbb7b5){return respondWithRpcPromise(_0x8eff('0x1c'),_['merge'](_0x2a7337[_0x8eff('0x19')],_0x2a7337[_0x8eff('0x1d')]))['then'](respondWithResult(_0xdbb7b5,null))[_0x8eff('0xd')](handleError(_0xdbb7b5,null));};exports['voiceChannelStopMixMonitor']=function(_0x2fe360,_0x23c030){return respondWithRpcPromise(_0x8eff('0x1e'),_[_0x8eff('0x1f')](_0x2fe360[_0x8eff('0x19')],_0x2fe360['params']))[_0x8eff('0x1a')](respondWithResult(_0x23c030,null))[_0x8eff('0xd')](handleError(_0x23c030,null));};exports['voiceQueues']=function(_0x15b66f,_0x5ec3d7){return respondWithRpcPromise(_0x8eff('0x20'),_0x15b66f[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x5ec3d7,null))[_0x8eff('0xd')](handleError(_0x5ec3d7,null));};exports[_0x8eff('0x21')]=function(_0x2e8067,_0x516173){return respondWithRpcPromise(_0x8eff('0x20'),_0x2e8067[_0x8eff('0x19')])[_0x8eff('0x1a')](findById(_0x2e8067[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x516173,null))[_0x8eff('0xd')](handleError(_0x516173,null));};exports['updateVoiceQueue']=function(_0x4ed3b8,_0x44dcdb){return respondWithRpcPromise(_0x8eff('0x22'),_[_0x8eff('0x1f')](_0x4ed3b8['body'],_0x4ed3b8[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x44dcdb,null))[_0x8eff('0xd')](handleError(_0x44dcdb,null));};exports[_0x8eff('0x23')]=function(_0x25b98e,_0x2c5727){return respondWithRpcPromise(_0x8eff('0x24'),_[_0x8eff('0x1f')](_0x25b98e[_0x8eff('0x19')],_0x25b98e[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x2c5727,null))[_0x8eff('0xd')](handleError(_0x2c5727,null));};exports['voiceQueuesChannels']=function(_0x2ad4b7,_0x165f8e){return respondWithRpcPromise(_0x8eff('0x25'),_0x2ad4b7[_0x8eff('0x19')])['then'](respondWithResult(_0x165f8e,null))[_0x8eff('0xd')](handleError(_0x165f8e,null));};exports[_0x8eff('0x26')]=function(_0x4c4220,_0x4e1256){return respondWithRpcPromise(_0x8eff('0x27'),_[_0x8eff('0x1f')](_0x4c4220['query'],_0x4c4220['params']))['then'](respondWithResult(_0x4e1256,null))[_0x8eff('0xd')](handleError(_0x4e1256,null));};exports['voiceQueuesChannelHangup']=function(_0x45d9d4,_0x59c9cc){return respondWithRpcPromise(_0x8eff('0x28'),_[_0x8eff('0x1f')](_0x45d9d4[_0x8eff('0x19')],_0x45d9d4[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x59c9cc,null))[_0x8eff('0xd')](handleError(_0x59c9cc,null));};exports['voiceQueuesChannelRedirect']=function(_0xd95908,_0x5907e0){return respondWithRpcPromise(_0x8eff('0x29'),_['merge'](_0xd95908[_0x8eff('0x19')],_0xd95908[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x5907e0,null))[_0x8eff('0xd')](handleError(_0x5907e0,null));};exports['outbound']=function(_0x2eb4bb,_0x170a33){return respondWithRpcPromise(_0x8eff('0x2a'),_0x2eb4bb['query'])[_0x8eff('0x1a')](respondWithResult(_0x170a33,null))[_0x8eff('0xd')](handleError(_0x170a33,null));};exports[_0x8eff('0x2b')]=function(_0x345bc7,_0x721c71){return respondWithRpcPromise(_0x8eff('0x2c'),_0x345bc7[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x721c71,null))[_0x8eff('0xd')](handleError(_0x721c71,null));};exports['agents']=function(_0x54a2d9,_0xf67cf3){var _0x114f8e;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9[_0x8eff('0x19')])[_0x8eff('0x1a')](function(_0x1ba78a){_0x114f8e=_0x1ba78a;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9['query'],routingClient);})[_0x8eff('0x1a')](function(_0x1c7332){return _['merge']({},_0x1c7332,_0x114f8e);})[_0x8eff('0x1a')](respondWithResult(_0xf67cf3,null))[_0x8eff('0xd')](handleError(_0xf67cf3,null));};exports[_0x8eff('0x2e')]=function(_0x18309b,_0xdc5e2f){if(_0x18309b[_0x8eff('0x2f')]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]&&_0x18309b[_0x8eff('0x31')]&&_0x18309b['user'][_0x8eff('0x12')]){for(var _0x27a8c9 in _0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]){if(_0x18309b[_0x8eff('0x2f')]['interaction'][_0x8eff('0x32')](_0x27a8c9)){db['MemberReport'][_0x8eff('0x33')]({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'exitAt':null,'uniqueid':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9]['length']?{'$notIn':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]}:{'$ne':null}}})[_0x8eff('0x1a')](function(_0x3bf913){var _0x22f173=moment()[_0x8eff('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x28cb8e=0x0,_0x51aa5d=_0x3bf913[_0x8eff('0x36')];_0x28cb8e<_0x51aa5d;_0x28cb8e+=0x1){_0x3bf913[_0x28cb8e][_0x8eff('0x37')]({'exitAt':_0x22f173});}});for(var _0x577a2b=0x0;_0x577a2b<_0x18309b['body']['interaction'][_0x27a8c9]['length'];_0x577a2b+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b],'exitAt':null},'defaults':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'interface':_[_0x8eff('0x14')](_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')])?util['format'](_0x8eff('0x39'),_0x18309b['user'][_0x8eff('0x12')]):_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')],'type':_0x8eff('0x34'),'enterAt':moment()[_0x8eff('0x35')](_0x8eff('0x3a')),'role':_0x8eff('0x3b'),'internal':_0x18309b[_0x8eff('0x31')][_0x8eff('0x3c')],'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b]}});}}}}return respondWithRpcPromise(_0x8eff('0x3d'),{'id':_0x18309b['params']['id'],'capacity':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x3e')]},routingClient)[_0x8eff('0x1a')](respondWithResult(_0xdc5e2f,null))[_0x8eff('0xd')](handleError(_0xdc5e2f,null));};exports[_0x8eff('0x3f')]=function(_0x2de7fd,_0x16473d){return respondWithRpcPromise(_0x8eff('0x40'),_0x2de7fd[_0x8eff('0x19')])['then'](respondWithResult(_0x16473d,null))['catch'](handleError(_0x16473d,null));};exports[_0x8eff('0x41')]=function(_0x36e2fd,_0x430f5e){return respondWithRpcPromise(_0x8eff('0x42'),_0x36e2fd[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x430f5e,null))['catch'](handleError(_0x430f5e,null));};exports[_0x8eff('0x43')]=function(_0x1ca203,_0x1d0a8e){return respondWithRpcPromise('Campaigns',_0x1ca203[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x1d0a8e,null))[_0x8eff('0xd')](handleError(_0x1d0a8e,null));};exports[_0x8eff('0x44')]=function(_0x549e88,_0x40de1d){return respondWithRpcPromise(_0x8eff('0x45'),_0x549e88[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x40de1d,null))[_0x8eff('0xd')](handleError(_0x40de1d,null));};exports[_0x8eff('0x46')]=function(_0x3f646d,_0x575b0e){return respondWithRpcPromise(_0x8eff('0x45'),_0x3f646d[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x3f646d[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x575b0e,null))['catch'](handleError(_0x575b0e,null));};exports[_0x8eff('0x47')]=function(_0x16b968,_0x5d79b){return respondWithRpcPromise('MailQueues',_0x16b968[_0x8eff('0x19')],routingClient)['then'](respondWithResult(_0x5d79b,null))[_0x8eff('0xd')](handleError(_0x5d79b,null));};exports[_0x8eff('0x48')]=function(_0x23ed92,_0xfecdd8){return respondWithRpcPromise(_0x8eff('0x49'),_0x23ed92[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x23ed92['params']['id']))['then'](respondWithResult(_0xfecdd8,null))[_0x8eff('0xd')](handleError(_0xfecdd8,null));};exports['mailAccounts']=function(_0x3bfeac,_0x375ed3){return respondWithRpcPromise(_0x8eff('0x4a'),_0x3bfeac[_0x8eff('0x19')],mailClient)[_0x8eff('0x1a')](respondWithResult(_0x375ed3,null))['catch'](handleError(_0x375ed3,null));};exports[_0x8eff('0x4b')]=function(_0x36afc3,_0x1813df){return respondWithRpcPromise(_0x8eff('0x4c'),_0x36afc3[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1813df,null))['catch'](handleError(_0x1813df,null));};exports[_0x8eff('0x4d')]=function(_0x5c0ea3,_0x2e45c2){return respondWithRpcPromise(_0x8eff('0x4c'),_0x5c0ea3['query'],routingClient)[_0x8eff('0x1a')](findById(_0x5c0ea3[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x2e45c2,null))[_0x8eff('0xd')](handleError(_0x2e45c2,null));};exports[_0x8eff('0x4e')]=function(_0x35467c,_0xabdd84){return respondWithRpcPromise(_0x8eff('0x4f'),_0x35467c['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xabdd84,null))['catch'](handleError(_0xabdd84,null));};exports['showSmsQueues']=function(_0x1a748f,_0x47626e){return respondWithRpcPromise('SmsQueues',_0x1a748f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x1a748f['params']['id']))[_0x8eff('0x1a')](respondWithResult(_0x47626e,null))[_0x8eff('0xd')](handleError(_0x47626e,null));};exports['whatsappQueues']=function(_0xc70ecc,_0x1c6ee1){return respondWithRpcPromise(_0x8eff('0x50'),_0xc70ecc[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1c6ee1,null))[_0x8eff('0xd')](handleError(_0x1c6ee1,null));};exports[_0x8eff('0x51')]=function(_0x58c9e6,_0x479a4b){return respondWithRpcPromise(_0x8eff('0x50'),_0x58c9e6[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x58c9e6[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x479a4b,null))[_0x8eff('0xd')](handleError(_0x479a4b,null));};exports[_0x8eff('0x52')]=function(_0x4f1c54,_0x593a18){return respondWithRpcPromise(_0x8eff('0x53'),_0x4f1c54['query'],routingClient)['then'](respondWithResult(_0x593a18,null))['catch'](handleError(_0x593a18,null));};exports[_0x8eff('0x54')]=function(_0x436db2,_0x461026){return respondWithRpcPromise(_0x8eff('0x53'),_0x436db2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x436db2[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x461026,null))['catch'](handleError(_0x461026,null));};exports[_0x8eff('0x55')]=function(_0x5492df,_0x42efc6){return respondWithRpcPromise(_0x8eff('0x56'),_0x5492df[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x42efc6,null))[_0x8eff('0xd')](handleError(_0x42efc6,null));};exports[_0x8eff('0x57')]=function(_0x570728,_0x3db0d8){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x570728[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x3db0d8,null))[_0x8eff('0xd')](handleError(_0x3db0d8,null));};exports[_0x8eff('0x58')]=function(_0x41d7e2,_0x2f30cb){return respondWithRpcPromise(_0x8eff('0x59'),_0x41d7e2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x2f30cb,null))['catch'](handleError(_0x2f30cb,null));};exports[_0x8eff('0x5a')]=function(_0x73b49f,_0x1299b5){return respondWithRpcPromise(_0x8eff('0x5b'),_0x73b49f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1299b5,null))[_0x8eff('0xd')](handleError(_0x1299b5,null));};exports[_0x8eff('0x5c')]=function(_0x3350b8,_0x123673){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3350b8['query'],routingClient)['then'](function(_0x5f3443){if(_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')]!==undefined){var _0x2a15ba=_(_0x5f3443[_0x8eff('0x15')])[_0x8eff('0x5e')]([_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')],_0x3350b8['params']['id']])[_0x8eff('0x5f')](_0x8eff('0x60'))[_0x8eff('0x61')]()[_0x8eff('0x62')]();return _0x5f3443['rows'][_0x8eff('0x5e')](function(_0x34ca22){return _0x2a15ba['indexOf'](_0x34ca22[_0x8eff('0x60')])>-0x1;});}else{return _0x5f3443[_0x8eff('0x15')][_0x8eff('0x5e')](function(_0x47e24f){return _0x47e24f['queue_id']===parseInt(_0x3350b8['params']['id']);});}})[_0x8eff('0x1a')](respondWithResult(_0x123673,null))[_0x8eff('0xd')](handleError(_0x123673,null));};exports[_0x8eff('0x63')]=function(_0x168465,_0xaca1b5){return respondWithRpcPromise(_0x8eff('0x64'),_0x168465[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xaca1b5,null))[_0x8eff('0xd')](handleError(_0xaca1b5,null));};exports[_0x8eff('0x65')]=function(_0x4272e8,_0x5c8a83){return respondWithRpcPromise(_0x8eff('0x66'),_0x4272e8['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x5c8a83,null))[_0x8eff('0xd')](handleError(_0x5c8a83,null));};exports['faxQueuesWaitingInteractions']=function(_0x9c448b,_0x536b6f){return respondWithRpcPromise(_0x8eff('0x67'),_0x9c448b[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x536b6f,null))[_0x8eff('0xd')](handleError(_0x536b6f,null));};exports[_0x8eff('0x68')]=function(_0x4a4603){return function(_0x842ad7,_0x56fd7d){var _0xd5edc5,_0x19768b;var _0x30c321=_[_0x8eff('0x69')](_0x4a4603);var _0x52be06=_0x4a4603===_0x8eff('0x6a')?_0x8eff('0x6b'):_0x8eff('0x6c');return db[_0x30c321+_0x8eff('0x6d')]['findOne']({'raw':!![],'where':{'id':_0x842ad7[_0x8eff('0x1d')]['id']}})[_0x8eff('0x1a')](function(_0x10e26f){if(_[_0x8eff('0x14')](_0x10e26f)){throw new Error(_0x30c321+_0x8eff('0x6e'));}_0xd5edc5=_0x10e26f;return db[_0x30c321+'Message'][_0x8eff('0x6f')]({'where':{'id':_0x842ad7[_0x8eff('0x2f')]['messageId']},'include':[{'model':db[_0x30c321+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x30c321+_0x52be06],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0xe31924){if(_[_0x8eff('0x14')](_0xe31924)){throw new Error(_0x30c321+_0x8eff('0x71'));}_0x19768b=_0xe31924;return _0xe31924['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x522e5f={'uniqueid':_0x4a4603+'.'+_0x19768b['id']+'.'+_0x19768b[_0x8eff('0x70')]['id'],'FromUserId':_0x842ad7[_0x8eff('0x31')]['id'],'type':'queue'};_0x522e5f[_0x30c321+_0x8eff('0x72')]=_0x19768b['id'];_0x522e5f[_0x30c321+'InteractionId']=_0x19768b['Interaction']['id'];_0x522e5f[_0x8eff('0x73')+_0x30c321+_0x52be06+'Id']=_0x19768b['Account']['id'];_0x522e5f['To'+_0x30c321+_0x8eff('0x74')]=_0xd5edc5['id'];return db[_0x30c321+_0x8eff('0x75')]['create'](_0x522e5f);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x4a4603,'interaction':_0x19768b['Interaction'],'message':_0x19768b,'account':_0x19768b[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x77'),'appdata':_0xd5edc5[_0x8eff('0x12')]+','+(_0x19768b[_0x8eff('0x6c')][_0x8eff('0x78')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x56fd7d,null))[_0x8eff('0xd')](handleError(_0x56fd7d,null));};};exports[_0x8eff('0x7a')]=function(_0x4aa16e,_0x4f7209){var _0x4c9436,_0x338269;if(_[_0x8eff('0x14')](_0x4aa16e[_0x8eff('0x2f')]['channel'])){throw new Error(_0x8eff('0x7b'));}var _0x35cf4c=_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x7c')];var _0x2c9646=_[_0x8eff('0x69')](_0x35cf4c);var _0x5ee248=_0x35cf4c===_0x8eff('0x6a')?'Website':_0x8eff('0x6c');return db[_0x8eff('0x7d')][_0x8eff('0x6f')]({'raw':!![],'where':{'id':_0x4aa16e[_0x8eff('0x1d')]['id'],'role':_0x8eff('0x3b')}})[_0x8eff('0x1a')](function(_0x476701){if(_['isNil'](_0x476701)){throw new Error(_0x8eff('0x7e'));}_0x4c9436=_0x476701;return db[_0x2c9646+_0x8eff('0x7f')][_0x8eff('0x6f')]({'where':{'id':_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x80')]},'include':[{'model':db[_0x2c9646+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x2c9646+_0x5ee248],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0x488a69){if(_['isNil'](_0x488a69)){throw new Error(_0x2c9646+_0x8eff('0x71'));}_0x338269=_0x488a69;return _0x488a69[_0x8eff('0x81')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x58db46={'uniqueid':_0x35cf4c+'.'+_0x338269['id']+'.'+_0x338269[_0x8eff('0x70')]['id'],'FromUserId':_0x4aa16e['user']['id'],'type':'queue','ToUserId':_0x4c9436['id']};_0x58db46[_0x2c9646+_0x8eff('0x72')]=_0x338269['id'];_0x58db46[_0x2c9646+_0x8eff('0x82')]=_0x338269[_0x8eff('0x70')]['id'];_0x58db46[_0x8eff('0x73')+_0x2c9646+_0x5ee248+'Id']=_0x338269[_0x8eff('0x6c')]['id'];return db[_0x2c9646+_0x8eff('0x75')][_0x8eff('0x83')](_0x58db46);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x35cf4c,'interaction':_0x338269[_0x8eff('0x70')],'message':_0x338269,'account':_0x338269[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x3b'),'appdata':_0x4c9436['name']+','+(_0x338269[_0x8eff('0x6c')][_0x8eff('0x84')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x4f7209,null))[_0x8eff('0xd')](handleError(_0x4f7209,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 12e2ec0..aad91af 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 _0x3581=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','post','create','put','delete','destroy','multer'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x3581,0x18f));var _0x1358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3581[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1358('0x0'));var util=require(_0x1358('0x1'));var path=require('path');var timeout=require(_0x1358('0x2'));var express=require('express');var router=express[_0x1358('0x3')]();var fs_extra=require(_0x1358('0x4'));var auth=require(_0x1358('0x5'));var interaction=require(_0x1358('0x6'));var config=require(_0x1358('0x7'));var controller=require(_0x1358('0x8'));router[_0x1358('0x9')]('/',auth[_0x1358('0xa')](),controller[_0x1358('0xb')]);router[_0x1358('0x9')](_0x1358('0xc'),auth['isAuthenticated'](),controller[_0x1358('0xd')]);router[_0x1358('0x9')](_0x1358('0xe'),auth[_0x1358('0xa')](),controller['run']);router[_0x1358('0xf')]('/',auth[_0x1358('0xa')](),controller[_0x1358('0x10')]);router[_0x1358('0x11')](_0x1358('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1358('0x12')](_0x1358('0xc'),auth[_0x1358('0xa')](),controller[_0x1358('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc093=['get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','update','delete','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2049e5,_0x350870){var _0x7acbdd=function(_0x1511ad){while(--_0x1511ad){_0x2049e5['push'](_0x2049e5['shift']());}};_0x7acbdd(++_0x350870);}(_0xc093,0xbb));var _0x3c09=function(_0x44a274,_0x17b558){_0x44a274=_0x44a274-0x0;var _0x582fdc=_0xc093[_0x44a274];return _0x582fdc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3c09('0x0'));var router=express[_0x3c09('0x1')]();var fs_extra=require(_0x3c09('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3c09('0x3'));var config=require(_0x3c09('0x4'));var controller=require('./schedule.controller');router[_0x3c09('0x5')]('/',auth[_0x3c09('0x6')](),controller[_0x3c09('0x7')]);router['get'](_0x3c09('0x8'),auth[_0x3c09('0x6')](),controller[_0x3c09('0x9')]);router[_0x3c09('0x5')](_0x3c09('0xa'),auth[_0x3c09('0x6')](),controller[_0x3c09('0xb')]);router[_0x3c09('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c09('0xd')]);router['put'](_0x3c09('0x8'),auth[_0x3c09('0x6')](),controller[_0x3c09('0xe')]);router[_0x3c09('0xf')](_0x3c09('0x8'),auth[_0x3c09('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index de0b78c..b5ed71a 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 _0x5d78=['weeks','days','hours','minutes','csv','pdf','xlsx','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5d78,0xed));var _0x85d7=function(_0x368765,_0x13017c){_0x368765=_0x368765-0x0;var _0x3f5985=_0x5d78[_0x368765];return _0x3f5985;};'use strict';var Sequelize=require(_0x85d7('0x0'));module[_0x85d7('0x1')]={'name':{'type':Sequelize[_0x85d7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x85d7('0x2')]},'active':{'type':Sequelize[_0x85d7('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85d7('0x4')},'startAt':{'type':Sequelize[_0x85d7('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x85d7('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x85d7('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x85d7('0x7')](_0x85d7('0x8'),_0x85d7('0x9'),'months',_0x85d7('0xa'),_0x85d7('0xb'),_0x85d7('0xc'),_0x85d7('0xd')),'allowNull':![],'defaultValue':_0x85d7('0xb')},'output':{'type':Sequelize['ENUM'](_0x85d7('0xe'),_0x85d7('0xf'),_0x85d7('0x10')),'allowNull':![],'defaultValue':_0x85d7('0xe')},'type':{'type':Sequelize[_0x85d7('0x7')]('custom',_0x85d7('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x85d7('0x2')]},'cc':{'type':Sequelize[_0x85d7('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x85d7('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x385e=['ENUM','years','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0x44b268,_0x28b22d){var _0x1a112a=function(_0x585919){while(--_0x585919){_0x44b268['push'](_0x44b268['shift']());}};_0x1a112a(++_0x28b22d);}(_0x385e,0x19b));var _0xe385=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0x385e[_0x16b1a5];return _0x475e25;};'use strict';var Sequelize=require(_0xe385('0x0'));module[_0xe385('0x1')]={'name':{'type':Sequelize[_0xe385('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe385('0x2')]},'active':{'type':Sequelize[_0xe385('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe385('0x2')],'allowNull':![],'defaultValue':_0xe385('0x4')},'startAt':{'type':Sequelize[_0xe385('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe385('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe385('0x7')](_0xe385('0x8'),'quarters','months',_0xe385('0x9'),_0xe385('0xa'),_0xe385('0xb'),_0xe385('0xc')),'allowNull':![],'defaultValue':_0xe385('0xa')},'output':{'type':Sequelize[_0xe385('0x7')](_0xe385('0xd'),_0xe385('0xe'),_0xe385('0xf')),'allowNull':![],'defaultValue':_0xe385('0xd')},'type':{'type':Sequelize['ENUM'](_0xe385('0x10'),_0xe385('0x11')),'allowNull':![],'defaultValue':_0xe385('0x10')},'sendMail':{'type':Sequelize[_0xe385('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xe385('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xe385('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xe385('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 0055c00..0ae9ec2 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 _0x0363=['limit','set','apply','reject','save','then','destroy','Scheduler','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','catch','params','keys','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','find','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count'];(function(_0x496be4,_0x158dcb){var _0x535de1=function(_0x67a78e){while(--_0x67a78e){_0x496be4['push'](_0x496be4['shift']());}};_0x535de1(++_0x158dcb);}(_0x0363,0x1d9));var _0x3036=function(_0x37468e,_0x14c7a4){_0x37468e=_0x37468e-0x0;var _0x203d9f=_0x0363[_0x37468e];return _0x203d9f;};'use strict';var emlformat=require(_0x3036('0x0'));var rimraf=require(_0x3036('0x1'));var zipdir=require(_0x3036('0x2'));var jsonpatch=require(_0x3036('0x3'));var rp=require(_0x3036('0x4'));var moment=require(_0x3036('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3036('0x6'));var sox=require(_0x3036('0x7'));var csv=require(_0x3036('0x8'));var ejs=require(_0x3036('0x9'));var fs=require('fs');var fs_extra=require(_0x3036('0xa'));var _=require(_0x3036('0xb'));var squel=require(_0x3036('0xc'));var crypto=require(_0x3036('0xd'));var jsforce=require(_0x3036('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3036('0x8'));var querystring=require(_0x3036('0xf'));var Papa=require(_0x3036('0x10'));var Redis=require(_0x3036('0x11'));var authService=require(_0x3036('0x12'));var qs=require(_0x3036('0x13'));var as=require(_0x3036('0x14'));var hardwareService=require(_0x3036('0x15'));var logger=require('../../config/logger')(_0x3036('0x16'));var utils=require('../../config/utils');var config=require(_0x3036('0x17'));var licenseUtil=require(_0x3036('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f8d0,_0x48a957){_0x48a957=_0x48a957||0xcc;return function(_0x2cef89){if(_0x2cef89){return _0x43f8d0['sendStatus'](_0x48a957);}return _0x43f8d0[_0x3036('0x19')](_0x48a957)[_0x3036('0x1a')]();};}function respondWithResult(_0x5be471,_0x3ed2ee){_0x3ed2ee=_0x3ed2ee||0xc8;return function(_0x43c3cf){if(_0x43c3cf){return _0x5be471['status'](_0x3ed2ee)[_0x3036('0x1b')](_0x43c3cf);}};}function respondWithFilteredResult(_0x177e03,_0x3e924d){return function(_0x4f84fd){if(_0x4f84fd){var _0x13800b=typeof _0x3e924d[_0x3036('0x1c')]===_0x3036('0x1d')&&typeof _0x3e924d['limit']===_0x3036('0x1d');var _0x733895=_0x4f84fd[_0x3036('0x1e')];var _0x53c48b=_0x13800b?0x0:_0x3e924d['offset'];var _0x24f100=_0x13800b?_0x4f84fd['count']:_0x3e924d[_0x3036('0x1c')]+_0x3e924d[_0x3036('0x1f')];var _0x2d263b;if(_0x24f100>=_0x733895){_0x24f100=_0x733895;_0x2d263b=0xc8;}else{_0x2d263b=0xce;}_0x177e03[_0x3036('0x19')](_0x2d263b);return _0x177e03[_0x3036('0x20')]('Content-Range',_0x53c48b+'-'+_0x24f100+'/'+_0x733895)[_0x3036('0x1b')](_0x4f84fd);}return null;};}function patchUpdates(_0xa8e950){return function(_0x1307ea){try{jsonpatch[_0x3036('0x21')](_0x1307ea,_0xa8e950,!![]);}catch(_0x398827){return BPromise[_0x3036('0x22')](_0x398827);}return _0x1307ea[_0x3036('0x23')]();};}function saveUpdates(_0x505f86,_0xc061b3){return function(_0x3c8c5a){if(_0x3c8c5a){return _0x3c8c5a['update'](_0x505f86)[_0x3036('0x24')](function(_0x296763){return _0x296763;});}return null;};}function removeEntity(_0x34d216,_0x177733){return function(_0x28e30e){if(_0x28e30e){return _0x28e30e[_0x3036('0x25')]()[_0x3036('0x24')](function(){var _0x3de002=_0x28e30e['get']({'plain':!![]});var _0x3cd90c=_0x3036('0x26');return db['UserProfileResource'][_0x3036('0x25')]({'where':{'type':_0x3cd90c,'resourceId':_0x3de002['id']}})[_0x3036('0x24')](function(){return _0x28e30e;});})[_0x3036('0x24')](function(){_0x34d216[_0x3036('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25c837,_0x4430f1){return function(_0x4cd42b){if(!_0x4cd42b){_0x25c837[_0x3036('0x27')](0x194);}return _0x4cd42b;};}function handleError(_0x5c9b80,_0x25d4b0){_0x25d4b0=_0x25d4b0||0x1f4;return function(_0x3fb0c9){logger[_0x3036('0x28')](_0x3fb0c9[_0x3036('0x29')]);if(_0x3fb0c9[_0x3036('0x2a')]){delete _0x3fb0c9[_0x3036('0x2a')];}_0x5c9b80[_0x3036('0x19')](_0x25d4b0)[_0x3036('0x2b')](_0x3fb0c9);};}exports[_0x3036('0x2c')]=function(_0x58bba0,_0x2f4f1c){var _0x35949a={},_0x4d1bce={},_0x391aa4={'count':0x0,'rows':[]};var _0x504a88=_[_0x3036('0x2d')](db[_0x3036('0x2e')][_0x3036('0x2f')],function(_0x2a31c0){return{'name':_0x2a31c0[_0x3036('0x30')],'type':_0x2a31c0[_0x3036('0x31')]['key']};});_0x4d1bce[_0x3036('0x32')]=_[_0x3036('0x2d')](_0x504a88,_0x3036('0x2a'));_0x4d1bce[_0x3036('0x33')]=_['keys'](_0x58bba0['query']);_0x4d1bce[_0x3036('0x34')]=_[_0x3036('0x35')](_0x4d1bce['model'],_0x4d1bce[_0x3036('0x33')]);_0x35949a['attributes']=_['intersection'](_0x4d1bce[_0x3036('0x32')],qs[_0x3036('0x36')](_0x58bba0[_0x3036('0x33')][_0x3036('0x36')]));_0x35949a['attributes']=_0x35949a[_0x3036('0x37')][_0x3036('0x38')]?_0x35949a[_0x3036('0x37')]:_0x4d1bce[_0x3036('0x32')];if(!_0x58bba0[_0x3036('0x33')]['hasOwnProperty'](_0x3036('0x39'))){_0x35949a['limit']=qs[_0x3036('0x1f')](_0x58bba0[_0x3036('0x33')][_0x3036('0x1f')]);_0x35949a[_0x3036('0x1c')]=qs[_0x3036('0x1c')](_0x58bba0[_0x3036('0x33')][_0x3036('0x1c')]);}_0x35949a[_0x3036('0x3a')]=qs[_0x3036('0x3b')](_0x58bba0[_0x3036('0x33')][_0x3036('0x3b')]);_0x35949a[_0x3036('0x3c')]=qs[_0x3036('0x34')](_[_0x3036('0x3d')](_0x58bba0[_0x3036('0x33')],_0x4d1bce['filters']),_0x504a88);if(_0x58bba0[_0x3036('0x33')][_0x3036('0x3e')]){_0x35949a[_0x3036('0x3c')]=_[_0x3036('0x3f')](_0x35949a[_0x3036('0x3c')],{'$or':_['map'](_0x504a88,function(_0x22c672){if(_0x22c672[_0x3036('0x31')]!=='VIRTUAL'){var _0x40856e={};_0x40856e[_0x22c672[_0x3036('0x2a')]]={'$like':'%'+_0x58bba0['query'][_0x3036('0x3e')]+'%'};return _0x40856e;}})});}_0x35949a=_[_0x3036('0x3f')]({},_0x35949a,_0x58bba0['options']);var _0x4e549f={'where':_0x35949a['where']};return db[_0x3036('0x2e')][_0x3036('0x1e')](_0x4e549f)[_0x3036('0x24')](function(_0x531835){_0x391aa4['count']=_0x531835;if(_0x58bba0[_0x3036('0x33')][_0x3036('0x40')]){_0x35949a['include']=[{'all':!![]}];}return db[_0x3036('0x2e')]['findAll'](_0x35949a);})[_0x3036('0x24')](function(_0x3c6792){_0x391aa4[_0x3036('0x41')]=_0x3c6792;return _0x391aa4;})['then'](respondWithFilteredResult(_0x2f4f1c,_0x35949a))[_0x3036('0x42')](handleError(_0x2f4f1c,null));};exports['show']=function(_0x162696,_0x5311ff){var _0x11edd6={'raw':![],'where':{'id':_0x162696[_0x3036('0x43')]['id']}},_0x3803a3={};_0x3803a3[_0x3036('0x32')]=_[_0x3036('0x44')](db[_0x3036('0x2e')][_0x3036('0x2f')]);_0x3803a3[_0x3036('0x33')]=_[_0x3036('0x44')](_0x162696['query']);_0x3803a3[_0x3036('0x34')]=_[_0x3036('0x35')](_0x3803a3[_0x3036('0x32')],_0x3803a3[_0x3036('0x33')]);_0x11edd6['attributes']=_[_0x3036('0x35')](_0x3803a3[_0x3036('0x32')],qs[_0x3036('0x36')](_0x162696['query'][_0x3036('0x36')]));_0x11edd6[_0x3036('0x37')]=_0x11edd6[_0x3036('0x37')][_0x3036('0x38')]?_0x11edd6['attributes']:_0x3803a3[_0x3036('0x32')];if(_0x162696['query'][_0x3036('0x40')]){_0x11edd6[_0x3036('0x45')]=[{'all':!![]}];}_0x11edd6=_[_0x3036('0x3f')]({},_0x11edd6,_0x162696[_0x3036('0x46')]);return db['Schedule']['find'](_0x11edd6)[_0x3036('0x24')](handleEntityNotFound(_0x5311ff,null))['then'](respondWithResult(_0x5311ff,null))['catch'](handleError(_0x5311ff,null));};exports[_0x3036('0x47')]=function(_0x189515,_0x4680ee){return db[_0x3036('0x2e')]['create'](_0x189515[_0x3036('0x48')],{})[_0x3036('0x24')](function(_0x4caa24){var _0x16aba7=_0x189515[_0x3036('0x49')][_0x3036('0x4a')]({'plain':!![]});if(!_0x16aba7)throw new Error(_0x3036('0x4b'));if(_0x16aba7['role']==='user'){var _0x2c3f1e=_0x4caa24[_0x3036('0x4a')]({'plain':!![]});var _0x4af264=_0x3036('0x26');return db[_0x3036('0x4c')]['find']({'where':{'name':_0x4af264,'userProfileId':_0x16aba7[_0x3036('0x4d')]},'raw':!![]})[_0x3036('0x24')](function(_0x12175c){if(_0x12175c&&_0x12175c[_0x3036('0x4e')]===0x0){return db[_0x3036('0x4f')]['create']({'name':_0x2c3f1e[_0x3036('0x2a')],'resourceId':_0x2c3f1e['id'],'type':_0x12175c['name'],'sectionId':_0x12175c['id']},{})[_0x3036('0x24')](function(){return _0x4caa24;});}else{return _0x4caa24;}})[_0x3036('0x42')](function(_0x62f052){logger[_0x3036('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x62f052);throw _0x62f052;});}return _0x4caa24;})[_0x3036('0x24')](respondWithResult(_0x4680ee,0xc9))[_0x3036('0x42')](handleError(_0x4680ee,null));};exports[_0x3036('0x50')]=function(_0x4b134e,_0x53c122){if(_0x4b134e['body']['id']){delete _0x4b134e[_0x3036('0x48')]['id'];}return db[_0x3036('0x2e')][_0x3036('0x51')]({'where':{'id':_0x4b134e['params']['id']}})[_0x3036('0x24')](handleEntityNotFound(_0x53c122,null))[_0x3036('0x24')](saveUpdates(_0x4b134e[_0x3036('0x48')],null))[_0x3036('0x24')](respondWithResult(_0x53c122,null))[_0x3036('0x42')](handleError(_0x53c122,null));};exports[_0x3036('0x25')]=function(_0x35c51d,_0x5a5611){return db[_0x3036('0x2e')]['find']({'where':{'id':_0x35c51d[_0x3036('0x43')]['id']}})[_0x3036('0x24')](handleEntityNotFound(_0x5a5611,null))[_0x3036('0x24')](removeEntity(_0x5a5611,null))['catch'](handleError(_0x5a5611,null));};exports[_0x3036('0x52')]=function(_0x4e1cdf,_0x433069,_0x50ff53){var _0xa5e120=require(_0x3036('0x53'));return db[_0x3036('0x2e')][_0x3036('0x51')]({'where':{'id':_0x4e1cdf[_0x3036('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x433069,null))[_0x3036('0x24')](function(){_0xa5e120['run'](_0x4e1cdf['params']['id']);})[_0x3036('0x24')](respondWithStatusCode(_0x433069,null))['catch'](handleError(_0x433069,null));}; \ No newline at end of file +var _0xee23=['save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','rawAttributes','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','filters','filter','where','VIRTUAL','merge','options','includeAll','include','Schedule','findAll','rows','catch','params','intersection','find','create','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','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xee23,0x17b));var _0x3ee2=function(_0x1cf50e,_0x465219){_0x1cf50e=_0x1cf50e-0x0;var _0x5e0ac4=_0xee23[_0x1cf50e];return _0x5e0ac4;};'use strict';var emlformat=require(_0x3ee2('0x0'));var rimraf=require(_0x3ee2('0x1'));var zipdir=require(_0x3ee2('0x2'));var jsonpatch=require(_0x3ee2('0x3'));var rp=require(_0x3ee2('0x4'));var moment=require('moment');var BPromise=require(_0x3ee2('0x5'));var Mustache=require('mustache');var util=require(_0x3ee2('0x6'));var path=require(_0x3ee2('0x7'));var sox=require(_0x3ee2('0x8'));var csv=require('to-csv');var ejs=require(_0x3ee2('0x9'));var fs=require('fs');var fs_extra=require(_0x3ee2('0xa'));var _=require(_0x3ee2('0xb'));var squel=require(_0x3ee2('0xc'));var crypto=require(_0x3ee2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3ee2('0xe'));var toCsv=require(_0x3ee2('0xf'));var querystring=require(_0x3ee2('0x10'));var Papa=require('papaparse');var Redis=require(_0x3ee2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3ee2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ee2('0x13'));var logger=require(_0x3ee2('0x14'))(_0x3ee2('0x15'));var utils=require(_0x3ee2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3ee2('0x17'));var db=require(_0x3ee2('0x18'))['db'];function respondWithStatusCode(_0x279c14,_0x895bb){_0x895bb=_0x895bb||0xcc;return function(_0x19536c){if(_0x19536c){return _0x279c14[_0x3ee2('0x19')](_0x895bb);}return _0x279c14[_0x3ee2('0x1a')](_0x895bb)[_0x3ee2('0x1b')]();};}function respondWithResult(_0x504087,_0x4f3a81){_0x4f3a81=_0x4f3a81||0xc8;return function(_0x37f5c1){if(_0x37f5c1){return _0x504087[_0x3ee2('0x1a')](_0x4f3a81)[_0x3ee2('0x1c')](_0x37f5c1);}};}function respondWithFilteredResult(_0x285952,_0x194239){return function(_0x37d0d8){if(_0x37d0d8){var _0x52cdfa=typeof _0x194239[_0x3ee2('0x1d')]===_0x3ee2('0x1e')&&typeof _0x194239[_0x3ee2('0x1f')]===_0x3ee2('0x1e');var _0x4398b1=_0x37d0d8[_0x3ee2('0x20')];var _0x448f6c=_0x52cdfa?0x0:_0x194239[_0x3ee2('0x1d')];var _0x11918d=_0x52cdfa?_0x37d0d8[_0x3ee2('0x20')]:_0x194239[_0x3ee2('0x1d')]+_0x194239[_0x3ee2('0x1f')];var _0x264c8a;if(_0x11918d>=_0x4398b1){_0x11918d=_0x4398b1;_0x264c8a=0xc8;}else{_0x264c8a=0xce;}_0x285952[_0x3ee2('0x1a')](_0x264c8a);return _0x285952[_0x3ee2('0x21')](_0x3ee2('0x22'),_0x448f6c+'-'+_0x11918d+'/'+_0x4398b1)['json'](_0x37d0d8);}return null;};}function patchUpdates(_0x38527a){return function(_0x38229f){try{jsonpatch['apply'](_0x38229f,_0x38527a,!![]);}catch(_0x591f77){return BPromise[_0x3ee2('0x23')](_0x591f77);}return _0x38229f[_0x3ee2('0x24')]();};}function saveUpdates(_0x2a6dc2,_0x240d56){return function(_0x561f13){if(_0x561f13){return _0x561f13[_0x3ee2('0x25')](_0x2a6dc2)[_0x3ee2('0x26')](function(_0x30706c){return _0x30706c;});}return null;};}function removeEntity(_0x2dab1d,_0x203a69){return function(_0x43be8f){if(_0x43be8f){return _0x43be8f[_0x3ee2('0x27')]()['then'](function(){var _0x3db4d1=_0x43be8f[_0x3ee2('0x28')]({'plain':!![]});var _0x154255=_0x3ee2('0x29');return db[_0x3ee2('0x2a')][_0x3ee2('0x27')]({'where':{'type':_0x154255,'resourceId':_0x3db4d1['id']}})[_0x3ee2('0x26')](function(){return _0x43be8f;});})[_0x3ee2('0x26')](function(){_0x2dab1d[_0x3ee2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf5ed1,_0x4deddb){return function(_0x5db1c1){if(!_0x5db1c1){_0xbf5ed1[_0x3ee2('0x19')](0x194);}return _0x5db1c1;};}function handleError(_0x3b4530,_0x3ff0f3){_0x3ff0f3=_0x3ff0f3||0x1f4;return function(_0x133474){logger[_0x3ee2('0x2b')](_0x133474[_0x3ee2('0x2c')]);if(_0x133474[_0x3ee2('0x2d')]){delete _0x133474[_0x3ee2('0x2d')];}_0x3b4530['status'](_0x3ff0f3)[_0x3ee2('0x2e')](_0x133474);};}exports['index']=function(_0x32f7ea,_0x46bda6){var _0x1b46cd={},_0x751153={},_0x149404={'count':0x0,'rows':[]};var _0x32465c=_[_0x3ee2('0x2f')](db['Schedule'][_0x3ee2('0x30')],function(_0x58b159){return{'name':_0x58b159['fieldName'],'type':_0x58b159[_0x3ee2('0x31')]['key']};});_0x751153[_0x3ee2('0x32')]=_[_0x3ee2('0x2f')](_0x32465c,_0x3ee2('0x2d'));_0x751153[_0x3ee2('0x33')]=_[_0x3ee2('0x34')](_0x32f7ea['query']);_0x751153['filters']=_['intersection'](_0x751153[_0x3ee2('0x32')],_0x751153[_0x3ee2('0x33')]);_0x1b46cd[_0x3ee2('0x35')]=_['intersection'](_0x751153[_0x3ee2('0x32')],qs['fields'](_0x32f7ea[_0x3ee2('0x33')][_0x3ee2('0x36')]));_0x1b46cd[_0x3ee2('0x35')]=_0x1b46cd[_0x3ee2('0x35')][_0x3ee2('0x37')]?_0x1b46cd[_0x3ee2('0x35')]:_0x751153[_0x3ee2('0x32')];if(!_0x32f7ea[_0x3ee2('0x33')][_0x3ee2('0x38')](_0x3ee2('0x39'))){_0x1b46cd[_0x3ee2('0x1f')]=qs[_0x3ee2('0x1f')](_0x32f7ea[_0x3ee2('0x33')][_0x3ee2('0x1f')]);_0x1b46cd[_0x3ee2('0x1d')]=qs[_0x3ee2('0x1d')](_0x32f7ea[_0x3ee2('0x33')]['offset']);}_0x1b46cd['order']=qs['sort'](_0x32f7ea[_0x3ee2('0x33')]['sort']);_0x1b46cd['where']=qs[_0x3ee2('0x3a')](_['pick'](_0x32f7ea[_0x3ee2('0x33')],_0x751153[_0x3ee2('0x3a')]),_0x32465c);if(_0x32f7ea[_0x3ee2('0x33')][_0x3ee2('0x3b')]){_0x1b46cd['where']=_['merge'](_0x1b46cd[_0x3ee2('0x3c')],{'$or':_[_0x3ee2('0x2f')](_0x32465c,function(_0x9be07a){if(_0x9be07a[_0x3ee2('0x31')]!==_0x3ee2('0x3d')){var _0x59daf1={};_0x59daf1[_0x9be07a['name']]={'$like':'%'+_0x32f7ea[_0x3ee2('0x33')][_0x3ee2('0x3b')]+'%'};return _0x59daf1;}})});}_0x1b46cd=_[_0x3ee2('0x3e')]({},_0x1b46cd,_0x32f7ea[_0x3ee2('0x3f')]);var _0x347250={'where':_0x1b46cd['where']};return db['Schedule'][_0x3ee2('0x20')](_0x347250)[_0x3ee2('0x26')](function(_0x17fb36){_0x149404[_0x3ee2('0x20')]=_0x17fb36;if(_0x32f7ea[_0x3ee2('0x33')][_0x3ee2('0x40')]){_0x1b46cd[_0x3ee2('0x41')]=[{'all':!![]}];}return db[_0x3ee2('0x42')][_0x3ee2('0x43')](_0x1b46cd);})[_0x3ee2('0x26')](function(_0x1c00ac){_0x149404[_0x3ee2('0x44')]=_0x1c00ac;return _0x149404;})[_0x3ee2('0x26')](respondWithFilteredResult(_0x46bda6,_0x1b46cd))[_0x3ee2('0x45')](handleError(_0x46bda6,null));};exports['show']=function(_0x4708de,_0x408bc1){var _0x4ee204={'raw':![],'where':{'id':_0x4708de[_0x3ee2('0x46')]['id']}},_0x4188eb={};_0x4188eb[_0x3ee2('0x32')]=_[_0x3ee2('0x34')](db[_0x3ee2('0x42')][_0x3ee2('0x30')]);_0x4188eb[_0x3ee2('0x33')]=_[_0x3ee2('0x34')](_0x4708de['query']);_0x4188eb[_0x3ee2('0x3a')]=_[_0x3ee2('0x47')](_0x4188eb[_0x3ee2('0x32')],_0x4188eb[_0x3ee2('0x33')]);_0x4ee204['attributes']=_['intersection'](_0x4188eb[_0x3ee2('0x32')],qs['fields'](_0x4708de['query'][_0x3ee2('0x36')]));_0x4ee204[_0x3ee2('0x35')]=_0x4ee204[_0x3ee2('0x35')][_0x3ee2('0x37')]?_0x4ee204[_0x3ee2('0x35')]:_0x4188eb[_0x3ee2('0x32')];if(_0x4708de[_0x3ee2('0x33')][_0x3ee2('0x40')]){_0x4ee204['include']=[{'all':!![]}];}_0x4ee204=_['merge']({},_0x4ee204,_0x4708de['options']);return db[_0x3ee2('0x42')][_0x3ee2('0x48')](_0x4ee204)[_0x3ee2('0x26')](handleEntityNotFound(_0x408bc1,null))[_0x3ee2('0x26')](respondWithResult(_0x408bc1,null))['catch'](handleError(_0x408bc1,null));};exports[_0x3ee2('0x49')]=function(_0x42da59,_0x452012){return db['Schedule'][_0x3ee2('0x49')](_0x42da59['body'],{})[_0x3ee2('0x26')](function(_0x4088c2){var _0x5432e2=_0x42da59['user'][_0x3ee2('0x28')]({'plain':!![]});if(!_0x5432e2)throw new Error(_0x3ee2('0x4a'));if(_0x5432e2[_0x3ee2('0x4b')]==='user'){var _0x12bbaa=_0x4088c2[_0x3ee2('0x28')]({'plain':!![]});var _0x4cb928='Scheduler';return db[_0x3ee2('0x4c')][_0x3ee2('0x48')]({'where':{'name':_0x4cb928,'userProfileId':_0x5432e2[_0x3ee2('0x4d')]},'raw':!![]})[_0x3ee2('0x26')](function(_0x10e6a8){if(_0x10e6a8&&_0x10e6a8[_0x3ee2('0x4e')]===0x0){return db['UserProfileResource'][_0x3ee2('0x49')]({'name':_0x12bbaa[_0x3ee2('0x2d')],'resourceId':_0x12bbaa['id'],'type':_0x10e6a8['name'],'sectionId':_0x10e6a8['id']},{})[_0x3ee2('0x26')](function(){return _0x4088c2;});}else{return _0x4088c2;}})[_0x3ee2('0x45')](function(_0x4247a9){logger[_0x3ee2('0x2b')](_0x3ee2('0x4f'),_0x4247a9);throw _0x4247a9;});}return _0x4088c2;})[_0x3ee2('0x26')](respondWithResult(_0x452012,0xc9))[_0x3ee2('0x45')](handleError(_0x452012,null));};exports[_0x3ee2('0x25')]=function(_0x5cd869,_0x356dce){if(_0x5cd869[_0x3ee2('0x50')]['id']){delete _0x5cd869['body']['id'];}return db['Schedule']['find']({'where':{'id':_0x5cd869['params']['id']}})['then'](handleEntityNotFound(_0x356dce,null))[_0x3ee2('0x26')](saveUpdates(_0x5cd869[_0x3ee2('0x50')],null))[_0x3ee2('0x26')](respondWithResult(_0x356dce,null))[_0x3ee2('0x45')](handleError(_0x356dce,null));};exports['destroy']=function(_0x189067,_0x346480){return db['Schedule']['find']({'where':{'id':_0x189067['params']['id']}})['then'](handleEntityNotFound(_0x346480,null))[_0x3ee2('0x26')](removeEntity(_0x346480,null))['catch'](handleError(_0x346480,null));};exports[_0x3ee2('0x51')]=function(_0x5a2c9d,_0x11b02e,_0x1f7571){var _0x139875=require(_0x3ee2('0x52'));return db['Schedule'][_0x3ee2('0x48')]({'where':{'id':_0x5a2c9d['params']['id']},'raw':!![]})[_0x3ee2('0x26')](handleEntityNotFound(_0x11b02e,null))[_0x3ee2('0x26')](function(){_0x139875[_0x3ee2('0x51')](_0x5a2c9d['params']['id']);})[_0x3ee2('0x26')](respondWithStatusCode(_0x11b02e,null))[_0x3ee2('0x45')](handleError(_0x11b02e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ca415b5..4aab46d 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 _0x43e4=['path','../../config/environment','exports','define','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x43e4,0x7e));var _0x443e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x43e4[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x443e('0x0'));var util=require(_0x443e('0x1'));var logger=require(_0x443e('0x2'))(_0x443e('0x3'));var moment=require(_0x443e('0x4'));var BPromise=require(_0x443e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x443e('0x6'));var rimraf=require('rimraf');var config=require(_0x443e('0x7'));var attributes=require('./schedule.attributes');module[_0x443e('0x8')]=function(_0x3aec56,_0x3b5844){return _0x3aec56[_0x443e('0x9')]('Schedule',attributes,{'tableName':_0x443e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1649=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define','tools_schedules','lodash','util'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x1649,0x1c0));var _0x9164=function(_0x4d04db,_0x10ce24){_0x4d04db=_0x4d04db-0x0;var _0x52f10d=_0x1649[_0x4d04db];return _0x52f10d;};'use strict';var _=require(_0x9164('0x0'));var util=require(_0x9164('0x1'));var logger=require(_0x9164('0x2'))('api');var moment=require(_0x9164('0x3'));var BPromise=require(_0x9164('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9164('0x5'));var rimraf=require(_0x9164('0x6'));var config=require(_0x9164('0x7'));var attributes=require('./schedule.attributes');module['exports']=function(_0x3ba0a7,_0x2a223d){return _0x3ba0a7[_0x9164('0x8')]('Schedule',attributes,{'tableName':_0x9164('0x9'),'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 3185faa..e42b3b0 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 _0x6963=['catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','code','Schedule,\x20%s,\x20%s','message','result'];(function(_0x583b0b,_0x46857f){var _0x37da47=function(_0xc0b17c){while(--_0xc0b17c){_0x583b0b['push'](_0x583b0b['shift']());}};_0x37da47(++_0x46857f);}(_0x6963,0x1a5));var _0x3696=function(_0x46ba21,_0xdf1c00){_0x46ba21=_0x46ba21-0x0;var _0x562548=_0x6963[_0x46ba21];return _0x562548;};'use strict';var _=require(_0x3696('0x0'));var util=require(_0x3696('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3696('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3696('0x3'))['db'];var utils=require(_0x3696('0x4'));var logger=require(_0x3696('0x5'))(_0x3696('0x6'));var config=require(_0x3696('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3696('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e80c7,_0xb0f0f6,_0x101c54){return new BPromise(function(_0x10f8df,_0x1a08e6){return client[_0x3696('0x9')](_0x3e80c7,_0x101c54)[_0x3696('0xa')](function(_0x49007b){logger[_0x3696('0xb')]('Schedule,\x20%s,\x20%s',_0xb0f0f6,_0x3696('0xc'));logger[_0x3696('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0xb0f0f6,_0x3696('0xc'),JSON[_0x3696('0xe')](_0x49007b));if(_0x49007b[_0x3696('0xf')]){if(_0x49007b['error'][_0x3696('0x10')]===0x1f4){logger[_0x3696('0xf')](_0x3696('0x11'),_0xb0f0f6,_0x49007b['error'][_0x3696('0x12')]);return _0x1a08e6(_0x49007b['error'][_0x3696('0x12')]);}logger[_0x3696('0xf')]('Schedule,\x20%s,\x20%s',_0xb0f0f6,_0x49007b['error'][_0x3696('0x12')]);return _0x10f8df(_0x49007b[_0x3696('0xf')][_0x3696('0x12')]);}else{logger[_0x3696('0xb')](_0x3696('0x11'),_0xb0f0f6,_0x3696('0xc'));_0x10f8df(_0x49007b[_0x3696('0x13')]['message']);}})[_0x3696('0x14')](function(_0x111928){logger[_0x3696('0xf')](_0x3696('0x11'),_0xb0f0f6,_0x111928);_0x1a08e6(_0x111928);});});} \ No newline at end of file +var _0xa1ec=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','randomstring'];(function(_0x5d831d,_0x3a4972){var _0x65d245=function(_0x60c306){while(--_0x60c306){_0x5d831d['push'](_0x5d831d['shift']());}};_0x65d245(++_0x3a4972);}(_0xa1ec,0x107));var _0xca1e=function(_0x17ac84,_0x125b06){_0x17ac84=_0x17ac84-0x0;var _0x156c13=_0xa1ec[_0x17ac84];return _0x156c13;};'use strict';var _=require('lodash');var util=require(_0xca1e('0x0'));var moment=require(_0xca1e('0x1'));var BPromise=require('bluebird');var rs=require(_0xca1e('0x2'));var fs=require('fs');var Redis=require(_0xca1e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xca1e('0x4'));var logger=require('../../config/logger')(_0xca1e('0x5'));var config=require(_0xca1e('0x6'));var jayson=require(_0xca1e('0x7'));var client=jayson[_0xca1e('0x8')][_0xca1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d036,_0x5b3c88,_0x16d677){return new BPromise(function(_0x16baaa,_0x248a52){return client[_0xca1e('0xa')](_0x18d036,_0x16d677)['then'](function(_0x1ebae9){logger['info'](_0xca1e('0xb'),_0x5b3c88,'request\x20sent');logger[_0xca1e('0xc')](_0xca1e('0xd'),_0x5b3c88,_0xca1e('0xe'),JSON[_0xca1e('0xf')](_0x1ebae9));if(_0x1ebae9[_0xca1e('0x10')]){if(_0x1ebae9[_0xca1e('0x10')][_0xca1e('0x11')]===0x1f4){logger[_0xca1e('0x10')]('Schedule,\x20%s,\x20%s',_0x5b3c88,_0x1ebae9['error'][_0xca1e('0x12')]);return _0x248a52(_0x1ebae9[_0xca1e('0x10')][_0xca1e('0x12')]);}logger[_0xca1e('0x10')]('Schedule,\x20%s,\x20%s',_0x5b3c88,_0x1ebae9['error']['message']);return _0x16baaa(_0x1ebae9[_0xca1e('0x10')][_0xca1e('0x12')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x5b3c88,_0xca1e('0xe'));_0x16baaa(_0x1ebae9['result']['message']);}})['catch'](function(_0x2a4b0b){logger[_0xca1e('0x10')]('Schedule,\x20%s,\x20%s',_0x5b3c88,_0x2a4b0b);_0x248a52(_0x2a4b0b);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 22d4ce2..6621560 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 _0x1dbf=['/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','download','post','create','update','delete'];(function(_0x37d51d,_0x473cde){var _0x38f60d=function(_0x137e65){while(--_0x137e65){_0x37d51d['push'](_0x37d51d['shift']());}};_0x38f60d(++_0x473cde);}(_0x1dbf,0x157));var _0xf1db=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0x1dbf[_0x5302fb];return _0x43e6a4;};'use strict';var multer=require(_0xf1db('0x0'));var util=require(_0xf1db('0x1'));var path=require(_0xf1db('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1db('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf1db('0x4'));var interaction=require(_0xf1db('0x5'));var config=require(_0xf1db('0x6'));var controller=require('./screenRecording.controller');router[_0xf1db('0x7')]('/',auth[_0xf1db('0x8')](),controller[_0xf1db('0x9')]);router['get'](_0xf1db('0xa'),auth[_0xf1db('0x8')](),controller[_0xf1db('0xb')]);router['get']('/:id',auth[_0xf1db('0x8')](),controller['show']);router[_0xf1db('0x7')]('/:id/download',auth[_0xf1db('0x8')](),controller[_0xf1db('0xc')]);router[_0xf1db('0xd')]('/',auth[_0xf1db('0x8')](),controller[_0xf1db('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf1db('0xf')]);router[_0xf1db('0x10')](_0xf1db('0x11'),auth['isAuthenticated'](),controller[_0xf1db('0x12')]);module[_0xf1db('0x13')]=router; \ No newline at end of file +var _0x9a5d=['post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','download'];(function(_0x2237b6,_0x3228ac){var _0x121a83=function(_0x54f211){while(--_0x54f211){_0x2237b6['push'](_0x2237b6['shift']());}};_0x121a83(++_0x3228ac);}(_0x9a5d,0x1ea));var _0xd9a5=function(_0x5b1950,_0x40c575){_0x5b1950=_0x5b1950-0x0;var _0x5f1f54=_0x9a5d[_0x5b1950];return _0x5f1f54;};'use strict';var multer=require(_0xd9a5('0x0'));var util=require(_0xd9a5('0x1'));var path=require(_0xd9a5('0x2'));var timeout=require(_0xd9a5('0x3'));var express=require('express');var router=express[_0xd9a5('0x4')]();var fs_extra=require(_0xd9a5('0x5'));var auth=require(_0xd9a5('0x6'));var interaction=require(_0xd9a5('0x7'));var config=require(_0xd9a5('0x8'));var controller=require('./screenRecording.controller');router[_0xd9a5('0x9')]('/',auth['isAuthenticated'](),controller[_0xd9a5('0xa')]);router[_0xd9a5('0x9')](_0xd9a5('0xb'),auth[_0xd9a5('0xc')](),controller[_0xd9a5('0xd')]);router['get']('/:id',auth[_0xd9a5('0xc')](),controller[_0xd9a5('0xe')]);router['get']('/:id/download',auth[_0xd9a5('0xc')](),controller[_0xd9a5('0xf')]);router[_0xd9a5('0x10')]('/',auth['isAuthenticated'](),controller[_0xd9a5('0x11')]);router[_0xd9a5('0x12')](_0xd9a5('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xd9a5('0x14')](_0xd9a5('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0xd9a5('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 41f2dd1..6075c1c 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 _0x627e=['value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue'];(function(_0x265b0a,_0x34c7ea){var _0x19294b=function(_0x2ade23){while(--_0x2ade23){_0x265b0a['push'](_0x265b0a['shift']());}};_0x19294b(++_0x34c7ea);}(_0x627e,0x14a));var _0xe627=function(_0x41b370,_0x1e7e54){_0x41b370=_0x41b370-0x0;var _0xa9cc01=_0x627e[_0x41b370];return _0xa9cc01;};'use strict';var Sequelize=require(_0xe627('0x0'));var moment=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var config=require(_0xe627('0x3'));module[_0xe627('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe627('0x5')](_0xe627('0x6'))?path[_0xe627('0x7')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe627('0x8')]},'value':{'type':Sequelize[_0xe627('0x8')],'set':function(_0x45e49a){var _0x2d4f63=_0x45e49a[_0xe627('0x9')](/\\/g,'/');this[_0xe627('0xa')]('value',_0x2d4f63);}},'rating':{'type':Sequelize[_0xe627('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x56549e){this[_0xe627('0xa')](_0xe627('0xc'),moment()['subtract'](_0x56549e,'ms'));this['setDataValue'](_0xe627('0xd'),moment());this[_0xe627('0xa')](_0xe627('0xe'),_0x56549e);}},'startedAt':{'type':Sequelize[_0xe627('0xf')],'get':function(){return moment(this[_0xe627('0x5')](_0xe627('0xc')))[_0xe627('0x10')](_0xe627('0x11'))[_0xe627('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe627('0x5')](_0xe627('0xd')))[_0xe627('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xe627('0x12')]();}},'createdAt':{'type':Sequelize[_0xe627('0xf')],'get':function(){return moment(this[_0xe627('0x5')](_0xe627('0x13')))[_0xe627('0x10')](_0xe627('0x11'))[_0xe627('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe627('0x5')](_0xe627('0x14')))[_0xe627('0x10')](_0xe627('0x11'))[_0xe627('0x12')]();}}}; \ No newline at end of file +var _0xa817=['../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','updatedAt','sequelize','moment','path'];(function(_0x14c7ee,_0x1b254d){var _0x12fdf9=function(_0x1447a3){while(--_0x1447a3){_0x14c7ee['push'](_0x14c7ee['shift']());}};_0x12fdf9(++_0x1b254d);}(_0xa817,0x7b));var _0x7a81=function(_0x125ad2,_0x3d3c53){_0x125ad2=_0x125ad2-0x0;var _0x539b48=_0xa817[_0x125ad2];return _0x539b48;};'use strict';var Sequelize=require(_0x7a81('0x0'));var moment=require(_0x7a81('0x1'));var path=require(_0x7a81('0x2'));var config=require(_0x7a81('0x3'));module[_0x7a81('0x4')]={'format':{'type':Sequelize[_0x7a81('0x5')],'get':function(){return this[_0x7a81('0x6')](_0x7a81('0x7'))?path[_0x7a81('0x8')](this['getDataValue'](_0x7a81('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x7a81('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7a81('0x9')],'set':function(_0x35c35a){var _0x3ab25c=_0x35c35a[_0x7a81('0xa')](/\\/g,'/');this[_0x7a81('0xb')](_0x7a81('0x7'),_0x3ab25c);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7a81('0xc')],'set':function(_0x5b3b66){this['setDataValue'](_0x7a81('0xd'),moment()['subtract'](_0x5b3b66,'ms'));this[_0x7a81('0xb')](_0x7a81('0xe'),moment());this[_0x7a81('0xb')](_0x7a81('0xf'),_0x5b3b66);}},'startedAt':{'type':Sequelize[_0x7a81('0x10')],'get':function(){return moment(this[_0x7a81('0x6')](_0x7a81('0xd')))['format'](_0x7a81('0x11'))[_0x7a81('0x12')]();}},'closedAt':{'type':Sequelize[_0x7a81('0x10')],'get':function(){return moment(this['getDataValue'](_0x7a81('0xe')))[_0x7a81('0x13')](_0x7a81('0x11'))[_0x7a81('0x12')]();}},'createdAt':{'type':Sequelize[_0x7a81('0x10')],'get':function(){return moment(this[_0x7a81('0x6')]('createdAt'))['format'](_0x7a81('0x11'))[_0x7a81('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7a81('0x6')](_0x7a81('0x14')))[_0x7a81('0x13')](_0x7a81('0x11'))[_0x7a81('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index bcd41d4..47afa32 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 _0xd6d6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','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'];(function(_0x24d38d,_0x2b0a28){var _0x5b1fb7=function(_0x3b5c77){while(--_0x3b5c77){_0x24d38d['push'](_0x24d38d['shift']());}};_0x5b1fb7(++_0x2b0a28);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x98d749,_0x3dd6cc){_0x98d749=_0x98d749-0x0;var _0x515571=_0xd6d6[_0x98d749];return _0x515571;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x34')](_['map'](_0xde3272,_0x6d6d('0x2b')),['format']);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x553645[_0x6d6d('0x35')]);_0x8a9a84[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x8a9a84['model'],qs[_0x6d6d('0x3a')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3a')]));_0x5273cd[_0x6d6d('0x38')]=_0x5273cd[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x5273cd[_0x6d6d('0x38')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x35')]['limit']);_0x5273cd[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x1f')]);}_0x5273cd['order']=qs['sort'](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3e')]);_0x5273cd[_0x6d6d('0x3f')]=qs['filters'](_[_0x6d6d('0x40')](_0x553645[_0x6d6d('0x35')],_0x8a9a84[_0x6d6d('0x37')]),_0xde3272);if(_0x553645[_0x6d6d('0x35')]['filter']){_0x5273cd['where']=_['merge'](_0x5273cd[_0x6d6d('0x3f')],{'$or':_[_0x6d6d('0x2d')](_0xde3272,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x31')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2b')]]={'$like':'%'+_0x553645[_0x6d6d('0x35')][_0x6d6d('0x41')]+'%'};return _0x253416;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x4b457d={'where':_0x5273cd[_0x6d6d('0x3f')]};return db[_0x6d6d('0x2e')][_0x6d6d('0x20')](_0x4b457d)[_0x6d6d('0x27')](function(_0x32275b){_0x57341f[_0x6d6d('0x20')]=_0x32275b;if(_0x553645[_0x6d6d('0x35')]['includeAll']){_0x5273cd[_0x6d6d('0x44')]=[{'all':!![]}];}return db[_0x6d6d('0x2e')][_0x6d6d('0x45')](_0x5273cd);})[_0x6d6d('0x27')](function(_0xe1aa77){_0x57341f['rows']=_0xe1aa77;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))[_0x6d6d('0x46')](handleError(_0x3edcce,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x33')]=_[_0x6d6d('0x36')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x43c03c[_0x6d6d('0x35')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x37')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x35')]);_0x15bf62[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x43c03c['model'],qs[_0x6d6d('0x3a')](_0x452de2['query'][_0x6d6d('0x3a')]));_0x15bf62[_0x6d6d('0x38')]=_0x15bf62[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x15bf62[_0x6d6d('0x38')]:_0x43c03c[_0x6d6d('0x33')];if(_0x452de2[_0x6d6d('0x35')]['includeAll']){_0x15bf62[_0x6d6d('0x44')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x42')]({},_0x15bf62,_0x452de2[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x47')](_0x15bf62)[_0x6d6d('0x27')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x27')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x46')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x48')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2e')][_0x6d6d('0x48')](_0x5e4c04[_0x6d6d('0x49')],{})[_0x6d6d('0x27')](respondWithResult(_0x4d78bb,0xc9))[_0x6d6d('0x46')](handleError(_0x4d78bb,null));};exports['update']=function(_0x47170d,_0x27b396){if(_0x47170d[_0x6d6d('0x49')]['id']){delete _0x47170d[_0x6d6d('0x49')]['id'];}delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4a')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4b')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4c')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4d')];return db['ScreenRecording'][_0x6d6d('0x47')]({'where':{'id':_0x47170d[_0x6d6d('0x4e')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x27b396,null))[_0x6d6d('0x27')](saveUpdates(_0x47170d[_0x6d6d('0x49')],null))['then'](respondWithResult(_0x27b396,null))[_0x6d6d('0x46')](handleError(_0x27b396,null));};exports[_0x6d6d('0x4f')]=function(_0x45340b,_0x4e4c3e){return db['ScreenRecording'][_0x6d6d('0x4f')]()['then'](respondWithResult(_0x4e4c3e,null))[_0x6d6d('0x46')](handleError(_0x4e4c3e,null));};exports[_0x6d6d('0x50')]=function(_0x32aaae,_0x268361,_0x4777a5){var _0x18e2de=require(_0x6d6d('0x51'));var _0x26c23a=![];var _0x1a8f33={};if(_0x32aaae[_0x6d6d('0x35')]['type']&&_0x32aaae[_0x6d6d('0x35')][_0x6d6d('0x31')]===_0x6d6d('0x52')){_0x1a8f33[_0x6d6d('0x52')]=_0x32aaae[_0x6d6d('0x4e')]['id'];}else{_0x1a8f33['id']=_0x32aaae[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')]['find']({'where':_0x1a8f33,'attributes':['id','value'],'raw':!![]})[_0x6d6d('0x27')](handleEntityNotFound(_0x268361,null))[_0x6d6d('0x27')](function(_0x5cc644){if(_0x5cc644){var _0x3e98a0=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x5cc644[_0x6d6d('0x4d')]);var _0xc6b96e=util[_0x6d6d('0x56')](_0x6d6d('0x57'),_0x3e98a0);if(fs[_0x6d6d('0x58')](_0xc6b96e)){_0x26c23a=!![];return _0x18e2de[_0x6d6d('0x59')](_0xc6b96e,_0x3e98a0,config[_0x6d6d('0x5a')][_0x6d6d('0x5b')])[_0x6d6d('0x27')](function(){return _0x5cc644;});}return _0x5cc644;}})[_0x6d6d('0x27')](function(_0x3065ea){if(_0x3065ea){var _0x50d8dd=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],'server/files/screen_recordings',_0x3065ea[_0x6d6d('0x4d')]);if(!fs[_0x6d6d('0x58')](_0x50d8dd)){throw new db[(_0x6d6d('0x5c'))][(_0x6d6d('0x5d'))](_0x6d6d('0x5e'));}if(_0x3065ea[_0x6d6d('0x5f')]){return _0x268361[_0x6d6d('0x50')](_0x50d8dd,_0x3065ea[_0x6d6d('0x5f')]+path[_0x6d6d('0x60')](_0x50d8dd),function(){if(_0x26c23a){fs['unlink'](_0x50d8dd);}});}else{return _0x268361['download'](_0x50d8dd,function(_0x22c3a1){if(_0x26c23a){fs[_0x6d6d('0x61')](_0x50d8dd);}});}}})[_0x6d6d('0x46')](function(_0x5de33f){if(_0x5de33f['message']===_0x6d6d('0x5e')){_0x268361['status'](0x194)[_0x6d6d('0x2c')]('Not\x20found');}else{return handleError(_0x268361,null);}});};exports[_0x6d6d('0x28')]=function(_0x367a6f,_0x21f14c){return db[_0x6d6d('0x2e')][_0x6d6d('0x47')]({'where':{'id':_0x367a6f[_0x6d6d('0x4e')]['id']}})['then'](function(_0x41e576){if(_['isNil'](_0x41e576)){throw new ReferenceError(_0x6d6d('0x62'));}return _0x41e576;})['then'](function(_0x2a21d8){var _0x3e48f7=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x2a21d8[_0x6d6d('0x4d')]);logger[_0x6d6d('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x3e48f7);if(!_['isNil'](_0x2a21d8[_0x6d6d('0x4d')])&&fs['existsSync'](_0x3e48f7)){logger[_0x6d6d('0x63')]('File:\x20\x22'+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}_0x3e48f7=_0x3e48f7+_0x6d6d('0x66');if(!_[_0x6d6d('0x67')](_0x2a21d8[_0x6d6d('0x4d')])&&fs[_0x6d6d('0x58')](_0x3e48f7)){logger['info'](_0x6d6d('0x68')+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}return _0x2a21d8;})[_0x6d6d('0x27')](function(_0x1ba731){if(!_0x1ba731)throw new InternalError();return _0x1ba731[_0x6d6d('0x28')]();})[_0x6d6d('0x27')](function(){_0x21f14c['status'](0xcc)[_0x6d6d('0x1b')]();})[_0x6d6d('0x46')](handleError(_0x21f14c,null));}; \ No newline at end of file +var _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0xfe9b52,_0x56139e){var _0x3b8f8d=function(_0x44443f){while(--_0x44443f){_0xfe9b52['push'](_0xfe9b52['shift']());}};_0x3b8f8d(++_0x56139e);}(_0x98a8,0x12c));var _0x898a=function(_0x2900e8,_0x30c34b){_0x2900e8=_0x2900e8-0x0;var _0x54a1eb=_0x98a8[_0x2900e8];return _0x54a1eb;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index bff466b..22be36e 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 _0xb4bf=['rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x40736f,_0x537528){var _0x42a129=function(_0x2139ff){while(--_0x2139ff){_0x40736f['push'](_0x40736f['shift']());}};_0x42a129(++_0x537528);}(_0xb4bf,0x77));var _0xfb4b=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb4bf[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xfb4b('0x0'));var util=require('util');var logger=require(_0xfb4b('0x1'))(_0xfb4b('0x2'));var moment=require(_0xfb4b('0x3'));var BPromise=require(_0xfb4b('0x4'));var rp=require(_0xfb4b('0x5'));var fs=require('fs');var path=require(_0xfb4b('0x6'));var rimraf=require(_0xfb4b('0x7'));var config=require(_0xfb4b('0x8'));var attributes=require(_0xfb4b('0x9'));module['exports']=function(_0x3d2f56,_0x1cf4bc){return _0x3d2f56[_0xfb4b('0xa')](_0xfb4b('0xb'),attributes,{'tableName':_0xfb4b('0xc'),'paranoid':![],'indexes':[{'name':_0xfb4b('0xd'),'fields':[_0xfb4b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4d3=['lodash','util','../../config/logger','api','moment','path','rimraf','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x1681a9,_0x58d65e){var _0x38589d=function(_0x540168){while(--_0x540168){_0x1681a9['push'](_0x1681a9['shift']());}};_0x38589d(++_0x58d65e);}(_0xc4d3,0xe4));var _0x3c4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4d3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c4d('0x0'));var util=require(_0x3c4d('0x1'));var logger=require(_0x3c4d('0x2'))(_0x3c4d('0x3'));var moment=require(_0x3c4d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c4d('0x5'));var rimraf=require(_0x3c4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x3c4d('0x7'));module['exports']=function(_0x165908,_0x200285){return _0x165908[_0x3c4d('0x8')](_0x3c4d('0x9'),attributes,{'tableName':_0x3c4d('0xa'),'paranoid':![],'indexes':[{'name':_0x3c4d('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index e3f8d85..8d861a0 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 _0xf662=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xf662,0x1a1));var _0x2f66=function(_0xd9caad,_0x5856b7){_0xd9caad=_0xd9caad-0x0;var _0x3127e6=_0xf662[_0xd9caad];return _0x3127e6;};'use strict';var _=require(_0x2f66('0x0'));var util=require('util');var moment=require(_0x2f66('0x1'));var BPromise=require('bluebird');var rs=require(_0x2f66('0x2'));var fs=require('fs');var Redis=require(_0x2f66('0x3'));var db=require(_0x2f66('0x4'))['db'];var utils=require(_0x2f66('0x5'));var logger=require(_0x2f66('0x6'))(_0x2f66('0x7'));var config=require(_0x2f66('0x8'));var jayson=require(_0x2f66('0x9'));var client=jayson[_0x2f66('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x467c68,_0x6a3520,_0x4deff0){return new BPromise(function(_0x526dc0,_0x3ad025){return client[_0x2f66('0xb')](_0x467c68,_0x4deff0)['then'](function(_0x2e940d){logger[_0x2f66('0xc')](_0x2f66('0xd'),_0x6a3520,'request\x20sent');logger[_0x2f66('0xe')](_0x2f66('0xf'),_0x6a3520,'request\x20sent',JSON[_0x2f66('0x10')](_0x2e940d));if(_0x2e940d['error']){if(_0x2e940d[_0x2f66('0x11')][_0x2f66('0x12')]===0x1f4){logger[_0x2f66('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x6a3520,_0x2e940d[_0x2f66('0x11')][_0x2f66('0x13')]);return _0x3ad025(_0x2e940d[_0x2f66('0x11')][_0x2f66('0x13')]);}logger['error'](_0x2f66('0xd'),_0x6a3520,_0x2e940d['error'][_0x2f66('0x13')]);return _0x526dc0(_0x2e940d[_0x2f66('0x11')]['message']);}else{logger['info'](_0x2f66('0xd'),_0x6a3520,'request\x20sent');_0x526dc0(_0x2e940d[_0x2f66('0x14')][_0x2f66('0x13')]);}})[_0x2f66('0x15')](function(_0x3ff077){logger[_0x2f66('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x6a3520,_0x3ff077);_0x3ad025(_0x3ff077);});});} \ No newline at end of file +var _0x7d93=['../../config/environment','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1aae33,_0x110a80){var _0x2e91e9=function(_0x218767){while(--_0x218767){_0x1aae33['push'](_0x1aae33['shift']());}};_0x2e91e9(++_0x110a80);}(_0x7d93,0x13c));var _0x37d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x37d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x37d9('0x1'));var rs=require(_0x37d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37d9('0x3'))['db'];var utils=require(_0x37d9('0x4'));var logger=require(_0x37d9('0x5'))(_0x37d9('0x6'));var config=require(_0x37d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x37d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52a02d,_0x37526e,_0x5a08ba){return new BPromise(function(_0xa52e79,_0x4b94cc){return client['request'](_0x52a02d,_0x5a08ba)[_0x37d9('0x9')](function(_0xaa819f){logger[_0x37d9('0xa')](_0x37d9('0xb'),_0x37526e,_0x37d9('0xc'));logger['debug'](_0x37d9('0xd'),_0x37526e,_0x37d9('0xc'),JSON[_0x37d9('0xe')](_0xaa819f));if(_0xaa819f[_0x37d9('0xf')]){if(_0xaa819f[_0x37d9('0xf')][_0x37d9('0x10')]===0x1f4){logger[_0x37d9('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x37526e,_0xaa819f[_0x37d9('0xf')][_0x37d9('0x11')]);return _0x4b94cc(_0xaa819f[_0x37d9('0xf')][_0x37d9('0x11')]);}logger[_0x37d9('0xf')](_0x37d9('0xb'),_0x37526e,_0xaa819f[_0x37d9('0xf')][_0x37d9('0x11')]);return _0xa52e79(_0xaa819f['error'][_0x37d9('0x11')]);}else{logger[_0x37d9('0xa')](_0x37d9('0xb'),_0x37526e,_0x37d9('0xc'));_0xa52e79(_0xaa819f[_0x37d9('0x12')][_0x37d9('0x11')]);}})['catch'](function(_0x1b39d7){logger['error'](_0x37d9('0xb'),_0x37526e,_0x1b39d7);_0x4b94cc(_0x1b39d7);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index ba60488..5bc60b7 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 _0x4d50=['single','file','server/files/images/logos/','logologin','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','extname','originalname','post'];(function(_0x39c749,_0x46d4fd){var _0xe3f963=function(_0x33a22e){while(--_0x33a22e){_0x39c749['push'](_0x39c749['shift']());}};_0xe3f963(++_0x46d4fd);}(_0x4d50,0x10e));var _0x04d5=function(_0x211171,_0x8fac45){_0x211171=_0x211171-0x0;var _0x35124d=_0x4d50[_0x211171];return _0x35124d;};'use strict';var multer=require(_0x04d5('0x0'));var util=require(_0x04d5('0x1'));var path=require('path');var timeout=require(_0x04d5('0x2'));var express=require(_0x04d5('0x3'));var router=express[_0x04d5('0x4')]();var fs_extra=require(_0x04d5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x04d5('0x6'));var config=require(_0x04d5('0x7'));var controller=require(_0x04d5('0x8'));router[_0x04d5('0x9')]('/',auth[_0x04d5('0xa')](),controller[_0x04d5('0xb')]);router['get'](_0x04d5('0xc'),controller[_0x04d5('0xd')]);router[_0x04d5('0x9')](_0x04d5('0xe'),controller[_0x04d5('0xf')]);router['get'](_0x04d5('0x10'),controller[_0x04d5('0x11')]);router[_0x04d5('0x9')]('/:id/logo_login',controller[_0x04d5('0x12')]);router[_0x04d5('0x9')]('/:id/gdpr',controller['gdpr']);router[_0x04d5('0x9')](_0x04d5('0x13'),controller[_0x04d5('0x14')]);router[_0x04d5('0x9')](_0x04d5('0x15'),controller[_0x04d5('0x16')]);var upload=multer({'storage':multer[_0x04d5('0x17')]({'destination':function(_0x2998b3,_0x39f1a6,_0x3584d4){_0x3584d4(null,path[_0x04d5('0x18')](config[_0x04d5('0x19')],'server/files/images/logos/'));},'filename':function(_0x2e9d50,_0x51fdc7,_0x480908){_0x480908(null,util[_0x04d5('0x1a')](_0x04d5('0x1b'),'logo',path[_0x04d5('0x1c')](_0x51fdc7[_0x04d5('0x1d')])));}})});router[_0x04d5('0x1e')](_0x04d5('0x10'),upload[_0x04d5('0x1f')](_0x04d5('0x20')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x475b4a,_0x3586fb,_0x3c690b){_0x3c690b(null,path['join'](config[_0x04d5('0x19')],_0x04d5('0x21')));},'filename':function(_0x39d67f,_0xcb1fd,_0x4a16b3){_0x4a16b3(null,util[_0x04d5('0x1a')](_0x04d5('0x1b'),_0x04d5('0x22'),path['extname'](_0xcb1fd[_0x04d5('0x1d')])));}})});router[_0x04d5('0x1e')](_0x04d5('0x23'),upload[_0x04d5('0x1f')](_0x04d5('0x20')),controller[_0x04d5('0x24')]);var upload=multer({'storage':multer[_0x04d5('0x17')]({'destination':function(_0x2dea66,_0x4dbfb9,_0x17bf33){_0x17bf33(null,path[_0x04d5('0x18')](config[_0x04d5('0x19')],_0x04d5('0x21')));},'filename':function(_0x164b0f,_0x3eadfb,_0x49056b){_0x49056b(null,util['format'](_0x04d5('0x1b'),_0x04d5('0x25'),path[_0x04d5('0x1c')](_0x3eadfb[_0x04d5('0x1d')])));}})});router[_0x04d5('0x1e')]('/:id/preferred',upload[_0x04d5('0x1f')](_0x04d5('0x20')),controller[_0x04d5('0x26')]);var upload=multer({'storage':multer[_0x04d5('0x17')]({'destination':function(_0x1359a9,_0xfd97a0,_0x4724dc){_0x4724dc(null,path[_0x04d5('0x18')](config[_0x04d5('0x19')],'server/files/images/logos/'));},'filename':function(_0x470ee1,_0x557b0f,_0x51b10b){_0x51b10b(null,util[_0x04d5('0x1a')](_0x04d5('0x1b'),_0x04d5('0x27'),path[_0x04d5('0x1c')](_0x557b0f['originalname'])));}})});router['post']('/:id/favicon',upload[_0x04d5('0x1f')](_0x04d5('0x20')),controller['addFavicon']);router[_0x04d5('0x28')]('/:id',auth[_0x04d5('0xa')](),controller[_0x04d5('0x29')]);module[_0x04d5('0x2a')]=router; \ No newline at end of file +var _0x792a=['single','file','addLogoLogin','%s%s','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','originalname','post','diskStorage','logologin','extname'];(function(_0x139a23,_0x184a3f){var _0x4da424=function(_0x5d6309){while(--_0x5d6309){_0x139a23['push'](_0x139a23['shift']());}};_0x4da424(++_0x184a3f);}(_0x792a,0x137));var _0xa792=function(_0x42d24b,_0x51b42b){_0x42d24b=_0x42d24b-0x0;var _0x37d248=_0x792a[_0x42d24b];return _0x37d248;};'use strict';var multer=require(_0xa792('0x0'));var util=require(_0xa792('0x1'));var path=require(_0xa792('0x2'));var timeout=require(_0xa792('0x3'));var express=require(_0xa792('0x4'));var router=express[_0xa792('0x5')]();var fs_extra=require(_0xa792('0x6'));var auth=require(_0xa792('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa792('0x8'));var controller=require(_0xa792('0x9'));router['get']('/',auth[_0xa792('0xa')](),controller[_0xa792('0xb')]);router[_0xa792('0xc')](_0xa792('0xd'),controller[_0xa792('0xe')]);router[_0xa792('0xc')]('/:id',controller['show']);router['get']('/:id/logo',controller[_0xa792('0xf')]);router[_0xa792('0xc')](_0xa792('0x10'),controller[_0xa792('0x11')]);router[_0xa792('0xc')](_0xa792('0x12'),controller[_0xa792('0x13')]);router[_0xa792('0xc')](_0xa792('0x14'),controller[_0xa792('0x15')]);router[_0xa792('0xc')](_0xa792('0x16'),controller[_0xa792('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8373d8,_0x312a9d,_0x348bf3){_0x348bf3(null,path[_0xa792('0x18')](config[_0xa792('0x19')],_0xa792('0x1a')));},'filename':function(_0x5e4975,_0x362587,_0x46865d){_0x46865d(null,util[_0xa792('0x1b')]('%s%s','logo',path['extname'](_0x362587[_0xa792('0x1c')])));}})});router[_0xa792('0x1d')]('/:id/logo',upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xa792('0x1e')]({'destination':function(_0x224c58,_0x585e92,_0x95ba05){_0x95ba05(null,path[_0xa792('0x18')](config[_0xa792('0x19')],'server/files/images/logos/'));},'filename':function(_0x3b5af1,_0x555efa,_0x5c4985){_0x5c4985(null,util[_0xa792('0x1b')]('%s%s',_0xa792('0x1f'),path[_0xa792('0x20')](_0x555efa['originalname'])));}})});router[_0xa792('0x1d')]('/:id/logo_login',upload[_0xa792('0x21')](_0xa792('0x22')),controller[_0xa792('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13513f,_0x4281dd,_0x2b6079){_0x2b6079(null,path[_0xa792('0x18')](config[_0xa792('0x19')],_0xa792('0x1a')));},'filename':function(_0x2e79d0,_0x3f4bda,_0x333e7a){_0x333e7a(null,util[_0xa792('0x1b')](_0xa792('0x24'),'preferred',path[_0xa792('0x20')](_0x3f4bda[_0xa792('0x1c')])));}})});router[_0xa792('0x1d')](_0xa792('0x14'),upload[_0xa792('0x21')](_0xa792('0x22')),controller[_0xa792('0x25')]);var upload=multer({'storage':multer[_0xa792('0x1e')]({'destination':function(_0x259d0d,_0x1576f1,_0x22db3b){_0x22db3b(null,path[_0xa792('0x18')](config[_0xa792('0x19')],_0xa792('0x1a')));},'filename':function(_0x3e672e,_0x5606d3,_0x535dc5){_0x535dc5(null,util[_0xa792('0x1b')](_0xa792('0x24'),_0xa792('0x26'),path[_0xa792('0x20')](_0x5606d3[_0xa792('0x1c')])));}})});router[_0xa792('0x1d')](_0xa792('0x16'),upload[_0xa792('0x21')](_0xa792('0x22')),controller[_0xa792('0x27')]);router[_0xa792('0x28')]('/:id',auth['isAuthenticated'](),controller[_0xa792('0x29')]);module[_0xa792('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1c5d9ac..c2d88ff 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 _0x5f66=['STRING','BOOLEAN','UNSIGNED','exports','min_internal','INTEGER','min_mailbox'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x65f6('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x65f6('0x2')](0xb),'unique':_0x65f6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x65f6('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnaddr':{'type':Sequelize[_0x65f6('0x4')]},'turnusername':{'type':Sequelize[_0x65f6('0x4')]},'turnpassword':{'type':Sequelize[_0x65f6('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x65f6('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x65f6('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x65f6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x65f6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x65f6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x65f6('0x4')]},'sentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x65f6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x65f6('0x4')]},'language':{'type':Sequelize[_0x65f6('0x4')]},'bucket':{'type':Sequelize[_0x65f6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x65f6('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x65f6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0b0e=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0x47ff41,_0x10df2c){var _0x22ba9f=function(_0x49d008){while(--_0x49d008){_0x47ff41['push'](_0x47ff41['shift']());}};_0x22ba9f(++_0x10df2c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x0b0e[_0x2181fc];return _0x315da1;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':_0xe0b0('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe0b0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x4')},'logo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe0b0('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnusername':{'type':Sequelize[_0xe0b0('0x3')]},'turnpassword':{'type':Sequelize[_0xe0b0('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x6')},'chatTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe0b0('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe0b0('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe0b0('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xe0b0('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xe0b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 490e6a2..2887148 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 _0xebc5=['catch','body','addLogo','file','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','logo','loginLogo','preferred','favicon','defaultLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','custom','ValidationError','upperFirst','download','getLogoLogin','defaultLoginLogo','defaultFavicon','default','Sequelize','\x20not\x20found','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','sendStatus','stack','name','send','index','Setting','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','find'];(function(_0x1e9449,_0x422da){var _0x1740ab=function(_0x2562b8){while(--_0x2562b8){_0x1e9449['push'](_0x1e9449['shift']());}};_0x1740ab(++_0x422da);}(_0xebc5,0x11a));var _0x5ebc=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xebc5[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0x5ebc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ebc('0x1'));var jsonpatch=require(_0x5ebc('0x2'));var rp=require(_0x5ebc('0x3'));var moment=require(_0x5ebc('0x4'));var BPromise=require(_0x5ebc('0x5'));var Mustache=require(_0x5ebc('0x6'));var util=require('util');var path=require(_0x5ebc('0x7'));var sox=require(_0x5ebc('0x8'));var csv=require(_0x5ebc('0x9'));var ejs=require(_0x5ebc('0xa'));var fs=require('fs');var fs_extra=require(_0x5ebc('0xb'));var _=require('lodash');var squel=require(_0x5ebc('0xc'));var crypto=require(_0x5ebc('0xd'));var jsforce=require(_0x5ebc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5ebc('0x9'));var querystring=require(_0x5ebc('0xf'));var Papa=require(_0x5ebc('0x10'));var Redis=require('ioredis');var authService=require(_0x5ebc('0x11'));var qs=require(_0x5ebc('0x12'));var as=require(_0x5ebc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ebc('0x14'))(_0x5ebc('0x15'));var utils=require(_0x5ebc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5ebc('0x17'));var db=require(_0x5ebc('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x484c6c,_0x370a46,_0x1999c8,_0x5da771){return new BPromise(function(_0x517f80,_0x1b6a8e){var _0x4d8519=_0x5da771||client;return _0x4d8519[_0x5ebc('0x19')](_0x484c6c,_0x1999c8)['then'](function(_0x4c3b8c){logger['info'](_0x5ebc('0x1a'),_0x370a46,_0x5ebc('0x1b'));logger[_0x5ebc('0x1c')](_0x5ebc('0x1d'),_0x370a46,'request\x20sent',JSON[_0x5ebc('0x1e')](_0x4c3b8c));if(_0x4c3b8c[_0x5ebc('0x1f')]){if(_0x4c3b8c['error'][_0x5ebc('0x20')]===0x1f4){logger[_0x5ebc('0x1f')](_0x5ebc('0x1a'),_0x370a46,_0x4c3b8c[_0x5ebc('0x1f')][_0x5ebc('0x21')]);return _0x1b6a8e(_0x4c3b8c[_0x5ebc('0x1f')][_0x5ebc('0x21')]);}logger['error'](_0x5ebc('0x1a'),_0x370a46,_0x4c3b8c[_0x5ebc('0x1f')][_0x5ebc('0x21')]);return _0x517f80(_0x4c3b8c[_0x5ebc('0x1f')]['message']);}else{logger[_0x5ebc('0x22')]('Setting,\x20%s,\x20%s',_0x370a46,_0x5ebc('0x1b'));_0x517f80(_0x4c3b8c[_0x5ebc('0x23')][_0x5ebc('0x21')]);}})['catch'](function(_0x5a40e4){logger[_0x5ebc('0x1f')](_0x5ebc('0x1a'),_0x370a46,_0x5a40e4);_0x1b6a8e(_0x5a40e4);});});}function respondWithStatusCode(_0x2426ba,_0x5c8dc6){_0x5c8dc6=_0x5c8dc6||0xcc;return function(_0x4fc003){if(_0x4fc003){return _0x2426ba['sendStatus'](_0x5c8dc6);}return _0x2426ba[_0x5ebc('0x24')](_0x5c8dc6)[_0x5ebc('0x25')]();};}function respondWithResult(_0x409596,_0x3441a5){_0x3441a5=_0x3441a5||0xc8;return function(_0x3b7de6){if(_0x3b7de6){return _0x409596[_0x5ebc('0x24')](_0x3441a5)[_0x5ebc('0x26')](_0x3b7de6);}};}function respondWithFilteredResult(_0x5a3b6c,_0x1b9563){return function(_0x343f7b){if(_0x343f7b){var _0x3d59e2=typeof _0x1b9563[_0x5ebc('0x27')]===_0x5ebc('0x28')&&typeof _0x1b9563[_0x5ebc('0x29')]===_0x5ebc('0x28');var _0x25226e=_0x343f7b[_0x5ebc('0x2a')];var _0x53983a=_0x3d59e2?0x0:_0x1b9563[_0x5ebc('0x27')];var _0x11a6cb=_0x3d59e2?_0x343f7b[_0x5ebc('0x2a')]:_0x1b9563['offset']+_0x1b9563[_0x5ebc('0x29')];var _0x321254;if(_0x11a6cb>=_0x25226e){_0x11a6cb=_0x25226e;_0x321254=0xc8;}else{_0x321254=0xce;}_0x5a3b6c[_0x5ebc('0x24')](_0x321254);return _0x5a3b6c['set']('Content-Range',_0x53983a+'-'+_0x11a6cb+'/'+_0x25226e)[_0x5ebc('0x26')](_0x343f7b);}return null;};}function patchUpdates(_0x2ac674){return function(_0x45abc7){try{jsonpatch[_0x5ebc('0x2b')](_0x45abc7,_0x2ac674,!![]);}catch(_0x3da657){return BPromise[_0x5ebc('0x2c')](_0x3da657);}return _0x45abc7['save']();};}function saveUpdates(_0x473a86,_0x1afe64){return function(_0xa8990c){if(_0xa8990c){return _0xa8990c[_0x5ebc('0x2d')](_0x473a86)['then'](function(_0x4fcf6e){return _0x4fcf6e;});}return null;};}function removeEntity(_0xec2168,_0x7fc173){return function(_0xde9b92){if(_0xde9b92){return _0xde9b92[_0x5ebc('0x2e')]()['then'](function(){_0xec2168[_0x5ebc('0x24')](0xcc)[_0x5ebc('0x25')]();});}};}function handleEntityNotFound(_0x26949c,_0xb0b4e4){return function(_0x3566d5){if(!_0x3566d5){_0x26949c[_0x5ebc('0x2f')](0x194);}return _0x3566d5;};}function handleError(_0x27541f,_0x12ed49){_0x12ed49=_0x12ed49||0x1f4;return function(_0x395175){logger[_0x5ebc('0x1f')](_0x395175[_0x5ebc('0x30')]);if(_0x395175[_0x5ebc('0x31')]){delete _0x395175[_0x5ebc('0x31')];}_0x27541f[_0x5ebc('0x24')](_0x12ed49)[_0x5ebc('0x32')](_0x395175);};}exports[_0x5ebc('0x33')]=function(_0x237e26,_0xc249a9){var _0x13fd39={},_0x1b8589={},_0x1d9a88={'count':0x0,'rows':[]};var _0x16f718=_['map'](db[_0x5ebc('0x34')]['rawAttributes'],function(_0x491507){return{'name':_0x491507['fieldName'],'type':_0x491507['type'][_0x5ebc('0x35')]};});_0x1b8589[_0x5ebc('0x36')]=_[_0x5ebc('0x37')](_0x16f718,'name');_0x1b8589[_0x5ebc('0x38')]=_['keys'](_0x237e26[_0x5ebc('0x38')]);_0x1b8589['filters']=_[_0x5ebc('0x39')](_0x1b8589['model'],_0x1b8589[_0x5ebc('0x38')]);_0x13fd39[_0x5ebc('0x3a')]=_[_0x5ebc('0x39')](_0x1b8589[_0x5ebc('0x36')],qs[_0x5ebc('0x3b')](_0x237e26['query'][_0x5ebc('0x3b')]));_0x13fd39[_0x5ebc('0x3a')]=_0x13fd39[_0x5ebc('0x3a')]['length']?_0x13fd39[_0x5ebc('0x3a')]:_0x1b8589[_0x5ebc('0x36')];if(!_0x237e26[_0x5ebc('0x38')][_0x5ebc('0x3c')](_0x5ebc('0x3d'))){_0x13fd39[_0x5ebc('0x29')]=qs[_0x5ebc('0x29')](_0x237e26['query'][_0x5ebc('0x29')]);_0x13fd39[_0x5ebc('0x27')]=qs[_0x5ebc('0x27')](_0x237e26['query'][_0x5ebc('0x27')]);}_0x13fd39[_0x5ebc('0x3e')]=qs[_0x5ebc('0x3f')](_0x237e26['query']['sort']);_0x13fd39[_0x5ebc('0x40')]=qs['filters'](_['pick'](_0x237e26[_0x5ebc('0x38')],_0x1b8589[_0x5ebc('0x41')]),_0x16f718);if(_0x237e26[_0x5ebc('0x38')][_0x5ebc('0x42')]){_0x13fd39[_0x5ebc('0x40')]=_['merge'](_0x13fd39[_0x5ebc('0x40')],{'$or':_[_0x5ebc('0x37')](_0x16f718,function(_0x45cabc){if(_0x45cabc['type']!==_0x5ebc('0x43')){var _0x19f724={};_0x19f724[_0x45cabc[_0x5ebc('0x31')]]={'$like':'%'+_0x237e26['query'][_0x5ebc('0x42')]+'%'};return _0x19f724;}})});}_0x13fd39=_[_0x5ebc('0x44')]({},_0x13fd39,_0x237e26[_0x5ebc('0x45')]);var _0x1c97f8={'where':_0x13fd39[_0x5ebc('0x40')]};return db[_0x5ebc('0x34')]['count'](_0x1c97f8)[_0x5ebc('0x46')](function(_0x5a9f87){_0x1d9a88[_0x5ebc('0x2a')]=_0x5a9f87;if(_0x237e26[_0x5ebc('0x38')][_0x5ebc('0x47')]){_0x13fd39[_0x5ebc('0x48')]=[{'all':!![]}];}return db[_0x5ebc('0x34')][_0x5ebc('0x49')](_0x13fd39);})[_0x5ebc('0x46')](function(_0x31accf){_0x1d9a88[_0x5ebc('0x4a')]=_0x31accf;return _0x1d9a88;})[_0x5ebc('0x46')](respondWithFilteredResult(_0xc249a9,_0x13fd39))['catch'](handleError(_0xc249a9,null));};exports[_0x5ebc('0x4b')]=function(_0x5577fd,_0x516d6b){var _0x552706={'raw':![],'where':{'id':_0x5577fd[_0x5ebc('0x4c')]['id']}},_0x23cb9d={};_0x23cb9d[_0x5ebc('0x36')]=_[_0x5ebc('0x4d')](db[_0x5ebc('0x34')][_0x5ebc('0x4e')]);_0x23cb9d['query']=_['keys'](_0x5577fd[_0x5ebc('0x38')]);_0x23cb9d[_0x5ebc('0x41')]=_[_0x5ebc('0x39')](_0x23cb9d['model'],_0x23cb9d[_0x5ebc('0x38')]);_0x552706[_0x5ebc('0x3a')]=_[_0x5ebc('0x39')](_0x23cb9d[_0x5ebc('0x36')],qs[_0x5ebc('0x3b')](_0x5577fd[_0x5ebc('0x38')][_0x5ebc('0x3b')]));_0x552706[_0x5ebc('0x3a')]=_0x552706[_0x5ebc('0x3a')][_0x5ebc('0x4f')]?_0x552706['attributes']:_0x23cb9d['model'];if(_0x5577fd[_0x5ebc('0x38')][_0x5ebc('0x47')]){_0x552706[_0x5ebc('0x48')]=[{'all':!![]}];}_0x552706=_[_0x5ebc('0x44')]({},_0x552706,_0x5577fd[_0x5ebc('0x45')]);return db[_0x5ebc('0x34')][_0x5ebc('0x50')](_0x552706)['then'](handleEntityNotFound(_0x516d6b,null))[_0x5ebc('0x46')](respondWithResult(_0x516d6b,null))[_0x5ebc('0x51')](handleError(_0x516d6b,null));};exports[_0x5ebc('0x2d')]=function(_0x3251d9,_0x1e876e){if(_0x3251d9[_0x5ebc('0x52')]['id']){delete _0x3251d9[_0x5ebc('0x52')]['id'];}return db[_0x5ebc('0x34')]['find']({'where':{'id':_0x3251d9['params']['id']}})[_0x5ebc('0x46')](handleEntityNotFound(_0x1e876e,null))[_0x5ebc('0x46')](saveUpdates(_0x3251d9[_0x5ebc('0x52')],null))[_0x5ebc('0x46')](respondWithResult(_0x1e876e,null))[_0x5ebc('0x51')](handleError(_0x1e876e,null));};exports[_0x5ebc('0x53')]=function(_0x238e08,_0xe77323,_0xa74723){if(_0x238e08[_0x5ebc('0x54')]&&_0x238e08['file'][_0x5ebc('0x55')]){_0x238e08['body']['logo']=_0x238e08[_0x5ebc('0x54')][_0x5ebc('0x55')];}return db[_0x5ebc('0x34')][_0x5ebc('0x50')]({'where':{'id':_0x238e08[_0x5ebc('0x4c')]['id']}})[_0x5ebc('0x46')](handleEntityNotFound(_0xe77323,null))[_0x5ebc('0x46')](saveUpdates(_0x238e08[_0x5ebc('0x52')],null))[_0x5ebc('0x46')](respondWithResult(_0xe77323,null))['catch'](handleError(_0xe77323,null));};exports[_0x5ebc('0x56')]=function(_0x366621,_0x5f19d8,_0x395356){if(_0x366621['file']&&_0x366621[_0x5ebc('0x54')][_0x5ebc('0x55')]){_0x366621[_0x5ebc('0x52')]['loginLogo']=_0x366621[_0x5ebc('0x54')][_0x5ebc('0x55')];}return db[_0x5ebc('0x34')][_0x5ebc('0x50')]({'where':{'id':_0x366621[_0x5ebc('0x4c')]['id']}})[_0x5ebc('0x46')](handleEntityNotFound(_0x5f19d8,null))['then'](saveUpdates(_0x366621[_0x5ebc('0x52')],null))[_0x5ebc('0x46')](respondWithResult(_0x5f19d8,null))[_0x5ebc('0x51')](handleError(_0x5f19d8,null));};var utilLicense=require('../../config/license/util');exports[_0x5ebc('0x57')]=function(_0x3d149a,_0x512fad,_0x3f386c){var _0x19fda2=_0x5ebc('0x58');var _0x5c46d7={'custom':![]};return utilLicense[_0x5ebc('0x59')]()['then'](function(_0x4b2a17){if(_0x4b2a17){_0x5c46d7=_0x4b2a17;}return db[_0x5ebc('0x34')][_0x5ebc('0x50')]({'where':{'id':_0x3d149a[_0x5ebc('0x4c')]['id']},'attributes':[_0x5ebc('0x5a'),_0x5ebc('0x5b'),_0x5ebc('0x5c'),_0x5ebc('0x5d'),_0x5ebc('0x5e'),'defaultLoginLogo',_0x5ebc('0x5f'),'defaultFavicon'],'raw':!![]});})[_0x5ebc('0x46')](handleEntityNotFound(_0x512fad,null))['then'](function(_0x561601){if(_0x561601){var _0x5a29e7=_0x561601[_0x5ebc('0x5a')]&&fs[_0x5ebc('0x60')](path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x19fda2,_[_0x5ebc('0x63')](_0x561601[_0x5ebc('0x5a')])))?path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x19fda2,_[_0x5ebc('0x63')](_0x561601[_0x5ebc('0x5a')])):path['join'](config['root'],_0x19fda2,_[_0x5ebc('0x63')](_0x5ebc('0x64')));var _0x3100e1='default'+_['upperFirst'](_0x5ebc('0x5a'));if(_0x561601[_0x3100e1]||!_0x5c46d7[_0x5ebc('0x65')]){_0x5a29e7=path['join'](config[_0x5ebc('0x62')],_0x19fda2,_['toLower'](_0x5ebc('0x64')));}if(!fs[_0x5ebc('0x60')](_0x5a29e7)){throw new db['Sequelize'][(_0x5ebc('0x66'))](_[_0x5ebc('0x67')]('logo')+'\x20not\x20found');}return _0x512fad[_0x5ebc('0x68')](_0x5a29e7);}})[_0x5ebc('0x51')](handleError(_0x512fad,null));};var utilLicense=require(_0x5ebc('0x17'));exports[_0x5ebc('0x69')]=function(_0xbf9b5f,_0x3be66c,_0x3e8200){var _0x492742='server/files/images/logos';var _0x3d2c56={'custom':![]};return utilLicense[_0x5ebc('0x59')]()[_0x5ebc('0x46')](function(_0x1b57c3){if(_0x1b57c3){_0x3d2c56=_0x1b57c3;}return db[_0x5ebc('0x34')]['find']({'where':{'id':_0xbf9b5f[_0x5ebc('0x4c')]['id']},'attributes':[_0x5ebc('0x5a'),_0x5ebc('0x5b'),'preferred',_0x5ebc('0x5d'),_0x5ebc('0x5e'),_0x5ebc('0x6a'),_0x5ebc('0x5f'),_0x5ebc('0x6b')],'raw':!![]});})[_0x5ebc('0x46')](handleEntityNotFound(_0x3be66c,null))[_0x5ebc('0x46')](function(_0x4bbc58){if(_0x4bbc58){var _0x2aa83d=_0x4bbc58[_0x5ebc('0x5b')]&&fs[_0x5ebc('0x60')](path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x492742,_['toLower'](_0x4bbc58['loginLogo'])))?path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x492742,_[_0x5ebc('0x63')](_0x4bbc58[_0x5ebc('0x5b')])):path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x492742,_['toLower']('default_loginLogo.svg'));var _0x745666=_0x5ebc('0x6c')+_[_0x5ebc('0x67')]('loginLogo');if(_0x4bbc58[_0x745666]||!_0x3d2c56[_0x5ebc('0x65')]){_0x2aa83d=path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x492742,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x5ebc('0x60')](_0x2aa83d)){throw new db[(_0x5ebc('0x6d'))][(_0x5ebc('0x66'))](_[_0x5ebc('0x67')](_0x5ebc('0x5b'))+_0x5ebc('0x6e'));}return _0x3be66c[_0x5ebc('0x68')](_0x2aa83d);}})[_0x5ebc('0x51')](handleError(_0x3be66c,null));};exports['gdpr']=function(_0x5abb28,_0x12376a){return db[_0x5ebc('0x34')][_0x5ebc('0x50')]({'where':{'id':_0x5abb28['params']['id']},'attributes':[_0x5ebc('0x6f')]})['then'](respondWithResult(_0x12376a,null))[_0x5ebc('0x51')](handleError(_0x12376a,null));};exports[_0x5ebc('0x70')]=function(_0xa91d9b,_0x1a512a,_0x5f07c8){if(_0xa91d9b['file']&&_0xa91d9b[_0x5ebc('0x54')][_0x5ebc('0x55')]){_0xa91d9b[_0x5ebc('0x52')]['preferred']=_0xa91d9b[_0x5ebc('0x54')][_0x5ebc('0x55')];}return db[_0x5ebc('0x34')][_0x5ebc('0x50')]({'where':{'id':_0xa91d9b[_0x5ebc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a512a,null))['then'](saveUpdates(_0xa91d9b[_0x5ebc('0x52')],null))[_0x5ebc('0x46')](respondWithResult(_0x1a512a,null))['catch'](handleError(_0x1a512a,null));};var utilLicense=require(_0x5ebc('0x17'));exports[_0x5ebc('0x71')]=function(_0x3d7e32,_0x4abe13,_0x39fc1c){var _0x156c74=_0x5ebc('0x58');var _0x1cd8af={'custom':![]};return utilLicense[_0x5ebc('0x59')]()[_0x5ebc('0x46')](function(_0x4e87ef){if(_0x4e87ef){_0x1cd8af=_0x4e87ef;}return db[_0x5ebc('0x34')]['find']({'where':{'id':_0x3d7e32[_0x5ebc('0x4c')]['id']},'attributes':[_0x5ebc('0x5a'),_0x5ebc('0x5b'),_0x5ebc('0x5c'),_0x5ebc('0x5d'),'defaultLogo','defaultLoginLogo',_0x5ebc('0x5f'),_0x5ebc('0x6b')],'raw':!![]});})['then'](handleEntityNotFound(_0x4abe13,null))['then'](function(_0x35981b){if(_0x35981b){var _0x4e4d70=_0x35981b[_0x5ebc('0x5c')]&&fs[_0x5ebc('0x60')](path[_0x5ebc('0x61')](config['root'],_0x156c74,_['toLower'](_0x35981b[_0x5ebc('0x5c')])))?path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x156c74,_[_0x5ebc('0x63')](_0x35981b[_0x5ebc('0x5c')])):path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x156c74,_[_0x5ebc('0x63')]('default_preferred.png'));var _0x574aeb=_0x5ebc('0x6c')+_[_0x5ebc('0x67')]('preferred');if(_0x35981b[_0x574aeb]||!_0x1cd8af[_0x5ebc('0x65')]||!_0x1cd8af[_0x5ebc('0x5c')]){_0x4e4d70=path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x156c74,_[_0x5ebc('0x63')](_0x5ebc('0x72')));}if(!fs[_0x5ebc('0x60')](_0x4e4d70)){throw new db[(_0x5ebc('0x6d'))]['ValidationError'](_[_0x5ebc('0x67')](_0x5ebc('0x5c'))+_0x5ebc('0x6e'));}return _0x4abe13['download'](_0x4e4d70);}})[_0x5ebc('0x51')](handleError(_0x4abe13,null));};exports[_0x5ebc('0x73')]=function(_0x37d0c5,_0x123564,_0x3fc79d){if(_0x37d0c5[_0x5ebc('0x54')]&&_0x37d0c5[_0x5ebc('0x54')][_0x5ebc('0x55')]){_0x37d0c5[_0x5ebc('0x52')][_0x5ebc('0x5d')]=_0x37d0c5[_0x5ebc('0x54')][_0x5ebc('0x55')];}return db[_0x5ebc('0x34')][_0x5ebc('0x50')]({'where':{'id':_0x37d0c5[_0x5ebc('0x4c')]['id']}})[_0x5ebc('0x46')](handleEntityNotFound(_0x123564,null))[_0x5ebc('0x46')](saveUpdates(_0x37d0c5['body'],null))['then'](respondWithResult(_0x123564,null))[_0x5ebc('0x51')](handleError(_0x123564,null));};var utilLicense=require(_0x5ebc('0x17'));exports[_0x5ebc('0x74')]=function(_0x2e1bc4,_0x2281e1,_0xde5bfd){var _0x1d9067=_0x5ebc('0x58');var _0x2bfd87={'custom':![]};return utilLicense[_0x5ebc('0x59')]()[_0x5ebc('0x46')](function(_0x3e7b5e){if(_0x3e7b5e){_0x2bfd87=_0x3e7b5e;}return db[_0x5ebc('0x34')][_0x5ebc('0x50')]({'where':{'id':_0x2e1bc4[_0x5ebc('0x4c')]['id']},'attributes':['logo',_0x5ebc('0x5b'),_0x5ebc('0x5c'),_0x5ebc('0x5d'),_0x5ebc('0x5e'),_0x5ebc('0x6a'),_0x5ebc('0x5f'),_0x5ebc('0x6b')],'raw':!![]});})['then'](handleEntityNotFound(_0x2281e1,null))[_0x5ebc('0x46')](function(_0x18e32d){if(_0x18e32d){var _0xdb48ef=_0x18e32d[_0x5ebc('0x5d')]&&fs[_0x5ebc('0x60')](path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x1d9067,_[_0x5ebc('0x63')](_0x18e32d[_0x5ebc('0x5d')])))?path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x1d9067,_[_0x5ebc('0x63')](_0x18e32d[_0x5ebc('0x5d')])):path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x1d9067,_[_0x5ebc('0x63')](_0x5ebc('0x75')));var _0x302fa0=_0x5ebc('0x6c')+_[_0x5ebc('0x67')](_0x5ebc('0x5d'));if(_0x18e32d[_0x302fa0]||!_0x2bfd87[_0x5ebc('0x65')]){_0xdb48ef=path[_0x5ebc('0x61')](config[_0x5ebc('0x62')],_0x1d9067,_[_0x5ebc('0x63')]('default_favicon.ico'));}if(!fs[_0x5ebc('0x60')](_0xdb48ef)){throw new db['Sequelize']['ValidationError'](_[_0x5ebc('0x67')](_0x5ebc('0x5d'))+_0x5ebc('0x6e'));}return _0x2281e1[_0x5ebc('0x68')](_0xdb48ef);}})[_0x5ebc('0x51')](handleError(_0x2281e1,null));};exports['getDate']=function(_0x15f4e4,_0x137031){var _0xdc7eae={'offset':moment()['utcOffset']()};_0xdc7eae['now']=moment()[_0x5ebc('0x76')](_0xdc7eae[_0x5ebc('0x27')])[_0x5ebc('0x77')](_0x5ebc('0x78'));return _0x137031['status'](0xc8)[_0x5ebc('0x32')](_0xdc7eae);}; \ No newline at end of file +var _0xd0ba=['defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','../../config/license/util','getLogoLogin','defaultPreferred','default_loginLogo.svg','download','addPreferred','getPreferred','server/files/images/logos','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','Setting','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','length','update','body','addLogo','file','filename','find','addLogoLogin','getLicense','logo','loginLogo','preferred','favicon'];(function(_0x281385,_0x30aa9b){var _0x4fda8e=function(_0x25bb44){while(--_0x25bb44){_0x281385['push'](_0x281385['shift']());}};_0x4fda8e(++_0x30aa9b);}(_0xd0ba,0x17c));var _0xad0b=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xd0ba[_0x587fb5];return _0x551105;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad0b('0x0'));var zipdir=require(_0xad0b('0x1'));var jsonpatch=require(_0xad0b('0x2'));var rp=require(_0xad0b('0x3'));var moment=require(_0xad0b('0x4'));var BPromise=require(_0xad0b('0x5'));var Mustache=require(_0xad0b('0x6'));var util=require(_0xad0b('0x7'));var path=require(_0xad0b('0x8'));var sox=require('sox');var csv=require(_0xad0b('0x9'));var ejs=require(_0xad0b('0xa'));var fs=require('fs');var fs_extra=require(_0xad0b('0xb'));var _=require('lodash');var squel=require(_0xad0b('0xc'));var crypto=require(_0xad0b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xad0b('0xe'));var Redis=require('ioredis');var authService=require(_0xad0b('0xf'));var qs=require(_0xad0b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad0b('0x11'));var logger=require(_0xad0b('0x12'))(_0xad0b('0x13'));var utils=require(_0xad0b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad0b('0x15'))['db'];var jayson=require(_0xad0b('0x16'));var client=jayson[_0xad0b('0x17')][_0xad0b('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xfea400,_0x134b9a,_0xcb09c1,_0x6dafab){return new BPromise(function(_0x3c97b7,_0x1b858d){var _0x53d4a3=_0x6dafab||client;return _0x53d4a3[_0xad0b('0x19')](_0xfea400,_0xcb09c1)[_0xad0b('0x1a')](function(_0x535618){logger[_0xad0b('0x1b')]('Setting,\x20%s,\x20%s',_0x134b9a,_0xad0b('0x1c'));logger[_0xad0b('0x1d')](_0xad0b('0x1e'),_0x134b9a,'request\x20sent',JSON['stringify'](_0x535618));if(_0x535618[_0xad0b('0x1f')]){if(_0x535618['error']['code']===0x1f4){logger[_0xad0b('0x1f')](_0xad0b('0x20'),_0x134b9a,_0x535618[_0xad0b('0x1f')][_0xad0b('0x21')]);return _0x1b858d(_0x535618[_0xad0b('0x1f')]['message']);}logger['error'](_0xad0b('0x20'),_0x134b9a,_0x535618[_0xad0b('0x1f')][_0xad0b('0x21')]);return _0x3c97b7(_0x535618[_0xad0b('0x1f')][_0xad0b('0x21')]);}else{logger[_0xad0b('0x1b')](_0xad0b('0x20'),_0x134b9a,_0xad0b('0x1c'));_0x3c97b7(_0x535618[_0xad0b('0x22')][_0xad0b('0x21')]);}})[_0xad0b('0x23')](function(_0xada76a){logger[_0xad0b('0x1f')](_0xad0b('0x20'),_0x134b9a,_0xada76a);_0x1b858d(_0xada76a);});});}function respondWithStatusCode(_0xcbc365,_0x3e713e){_0x3e713e=_0x3e713e||0xcc;return function(_0x3179fd){if(_0x3179fd){return _0xcbc365[_0xad0b('0x24')](_0x3e713e);}return _0xcbc365[_0xad0b('0x25')](_0x3e713e)[_0xad0b('0x26')]();};}function respondWithResult(_0x3b15fc,_0x68ac23){_0x68ac23=_0x68ac23||0xc8;return function(_0x3a20f2){if(_0x3a20f2){return _0x3b15fc[_0xad0b('0x25')](_0x68ac23)[_0xad0b('0x27')](_0x3a20f2);}};}function respondWithFilteredResult(_0x3116ac,_0x40a291){return function(_0x54918b){if(_0x54918b){var _0x5c785d=typeof _0x40a291[_0xad0b('0x28')]===_0xad0b('0x29')&&typeof _0x40a291[_0xad0b('0x2a')]===_0xad0b('0x29');var _0x6e4d3a=_0x54918b[_0xad0b('0x2b')];var _0x126bd4=_0x5c785d?0x0:_0x40a291[_0xad0b('0x28')];var _0x8b828b=_0x5c785d?_0x54918b['count']:_0x40a291[_0xad0b('0x28')]+_0x40a291[_0xad0b('0x2a')];var _0x4970b5;if(_0x8b828b>=_0x6e4d3a){_0x8b828b=_0x6e4d3a;_0x4970b5=0xc8;}else{_0x4970b5=0xce;}_0x3116ac[_0xad0b('0x25')](_0x4970b5);return _0x3116ac[_0xad0b('0x2c')](_0xad0b('0x2d'),_0x126bd4+'-'+_0x8b828b+'/'+_0x6e4d3a)[_0xad0b('0x27')](_0x54918b);}return null;};}function patchUpdates(_0x19d204){return function(_0x43ca99){try{jsonpatch['apply'](_0x43ca99,_0x19d204,!![]);}catch(_0x4a08ea){return BPromise[_0xad0b('0x2e')](_0x4a08ea);}return _0x43ca99[_0xad0b('0x2f')]();};}function saveUpdates(_0x5e6caf,_0x4eed33){return function(_0x2255b7){if(_0x2255b7){return _0x2255b7['update'](_0x5e6caf)[_0xad0b('0x1a')](function(_0x1f5045){return _0x1f5045;});}return null;};}function removeEntity(_0x32c970,_0x32dec9){return function(_0x8ff29e){if(_0x8ff29e){return _0x8ff29e['destroy']()[_0xad0b('0x1a')](function(){_0x32c970[_0xad0b('0x25')](0xcc)[_0xad0b('0x26')]();});}};}function handleEntityNotFound(_0xd7c321,_0x1c8390){return function(_0x359566){if(!_0x359566){_0xd7c321[_0xad0b('0x24')](0x194);}return _0x359566;};}function handleError(_0x3d1bd0,_0x1f881b){_0x1f881b=_0x1f881b||0x1f4;return function(_0x16a494){logger[_0xad0b('0x1f')](_0x16a494[_0xad0b('0x30')]);if(_0x16a494['name']){delete _0x16a494[_0xad0b('0x31')];}_0x3d1bd0[_0xad0b('0x25')](_0x1f881b)[_0xad0b('0x32')](_0x16a494);};}exports[_0xad0b('0x33')]=function(_0x2f5b76,_0x7afbc3){var _0x5a7996={},_0x1dcf00={},_0x3110e3={'count':0x0,'rows':[]};var _0x55d481=_[_0xad0b('0x34')](db[_0xad0b('0x35')][_0xad0b('0x36')],function(_0x51badb){return{'name':_0x51badb['fieldName'],'type':_0x51badb[_0xad0b('0x37')][_0xad0b('0x38')]};});_0x1dcf00[_0xad0b('0x39')]=_['map'](_0x55d481,_0xad0b('0x31'));_0x1dcf00['query']=_[_0xad0b('0x3a')](_0x2f5b76[_0xad0b('0x3b')]);_0x1dcf00[_0xad0b('0x3c')]=_[_0xad0b('0x3d')](_0x1dcf00[_0xad0b('0x39')],_0x1dcf00['query']);_0x5a7996[_0xad0b('0x3e')]=_[_0xad0b('0x3d')](_0x1dcf00[_0xad0b('0x39')],qs[_0xad0b('0x3f')](_0x2f5b76[_0xad0b('0x3b')]['fields']));_0x5a7996[_0xad0b('0x3e')]=_0x5a7996['attributes']['length']?_0x5a7996[_0xad0b('0x3e')]:_0x1dcf00[_0xad0b('0x39')];if(!_0x2f5b76[_0xad0b('0x3b')]['hasOwnProperty']('nolimit')){_0x5a7996[_0xad0b('0x2a')]=qs[_0xad0b('0x2a')](_0x2f5b76['query'][_0xad0b('0x2a')]);_0x5a7996[_0xad0b('0x28')]=qs[_0xad0b('0x28')](_0x2f5b76[_0xad0b('0x3b')][_0xad0b('0x28')]);}_0x5a7996['order']=qs[_0xad0b('0x40')](_0x2f5b76[_0xad0b('0x3b')][_0xad0b('0x40')]);_0x5a7996[_0xad0b('0x41')]=qs[_0xad0b('0x3c')](_[_0xad0b('0x42')](_0x2f5b76[_0xad0b('0x3b')],_0x1dcf00['filters']),_0x55d481);if(_0x2f5b76[_0xad0b('0x3b')]['filter']){_0x5a7996[_0xad0b('0x41')]=_[_0xad0b('0x43')](_0x5a7996['where'],{'$or':_[_0xad0b('0x34')](_0x55d481,function(_0x254239){if(_0x254239[_0xad0b('0x37')]!=='VIRTUAL'){var _0x4f444b={};_0x4f444b[_0x254239[_0xad0b('0x31')]]={'$like':'%'+_0x2f5b76['query'][_0xad0b('0x44')]+'%'};return _0x4f444b;}})});}_0x5a7996=_[_0xad0b('0x43')]({},_0x5a7996,_0x2f5b76[_0xad0b('0x45')]);var _0x116bdb={'where':_0x5a7996[_0xad0b('0x41')]};return db['Setting']['count'](_0x116bdb)['then'](function(_0x2a7049){_0x3110e3[_0xad0b('0x2b')]=_0x2a7049;if(_0x2f5b76[_0xad0b('0x3b')][_0xad0b('0x46')]){_0x5a7996[_0xad0b('0x47')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x5a7996);})[_0xad0b('0x1a')](function(_0x7f321b){_0x3110e3[_0xad0b('0x48')]=_0x7f321b;return _0x3110e3;})[_0xad0b('0x1a')](respondWithFilteredResult(_0x7afbc3,_0x5a7996))[_0xad0b('0x23')](handleError(_0x7afbc3,null));};exports[_0xad0b('0x49')]=function(_0x115523,_0x39b590){var _0x18da59={'raw':![],'where':{'id':_0x115523[_0xad0b('0x4a')]['id']}},_0x5c7739={};_0x5c7739[_0xad0b('0x39')]=_[_0xad0b('0x3a')](db[_0xad0b('0x35')][_0xad0b('0x36')]);_0x5c7739[_0xad0b('0x3b')]=_['keys'](_0x115523[_0xad0b('0x3b')]);_0x5c7739[_0xad0b('0x3c')]=_[_0xad0b('0x3d')](_0x5c7739[_0xad0b('0x39')],_0x5c7739[_0xad0b('0x3b')]);_0x18da59[_0xad0b('0x3e')]=_[_0xad0b('0x3d')](_0x5c7739[_0xad0b('0x39')],qs['fields'](_0x115523['query'][_0xad0b('0x3f')]));_0x18da59['attributes']=_0x18da59[_0xad0b('0x3e')][_0xad0b('0x4b')]?_0x18da59[_0xad0b('0x3e')]:_0x5c7739[_0xad0b('0x39')];if(_0x115523[_0xad0b('0x3b')][_0xad0b('0x46')]){_0x18da59['include']=[{'all':!![]}];}_0x18da59=_['merge']({},_0x18da59,_0x115523[_0xad0b('0x45')]);return db['Setting']['find'](_0x18da59)[_0xad0b('0x1a')](handleEntityNotFound(_0x39b590,null))['then'](respondWithResult(_0x39b590,null))[_0xad0b('0x23')](handleError(_0x39b590,null));};exports[_0xad0b('0x4c')]=function(_0x144667,_0x250eb6){if(_0x144667['body']['id']){delete _0x144667['body']['id'];}return db[_0xad0b('0x35')]['find']({'where':{'id':_0x144667['params']['id']}})[_0xad0b('0x1a')](handleEntityNotFound(_0x250eb6,null))[_0xad0b('0x1a')](saveUpdates(_0x144667[_0xad0b('0x4d')],null))[_0xad0b('0x1a')](respondWithResult(_0x250eb6,null))[_0xad0b('0x23')](handleError(_0x250eb6,null));};exports[_0xad0b('0x4e')]=function(_0x5e7674,_0x462e89,_0x15de3a){if(_0x5e7674[_0xad0b('0x4f')]&&_0x5e7674[_0xad0b('0x4f')][_0xad0b('0x50')]){_0x5e7674['body']['logo']=_0x5e7674[_0xad0b('0x4f')][_0xad0b('0x50')];}return db[_0xad0b('0x35')][_0xad0b('0x51')]({'where':{'id':_0x5e7674[_0xad0b('0x4a')]['id']}})[_0xad0b('0x1a')](handleEntityNotFound(_0x462e89,null))[_0xad0b('0x1a')](saveUpdates(_0x5e7674[_0xad0b('0x4d')],null))[_0xad0b('0x1a')](respondWithResult(_0x462e89,null))[_0xad0b('0x23')](handleError(_0x462e89,null));};exports[_0xad0b('0x52')]=function(_0x5ccc5b,_0x53de2b,_0xc8548d){if(_0x5ccc5b[_0xad0b('0x4f')]&&_0x5ccc5b['file'][_0xad0b('0x50')]){_0x5ccc5b[_0xad0b('0x4d')]['loginLogo']=_0x5ccc5b[_0xad0b('0x4f')]['filename'];}return db[_0xad0b('0x35')]['find']({'where':{'id':_0x5ccc5b[_0xad0b('0x4a')]['id']}})[_0xad0b('0x1a')](handleEntityNotFound(_0x53de2b,null))[_0xad0b('0x1a')](saveUpdates(_0x5ccc5b['body'],null))[_0xad0b('0x1a')](respondWithResult(_0x53de2b,null))['catch'](handleError(_0x53de2b,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x2cd6be,_0x5e883d,_0x27a7c5){var _0x1c43e2='server/files/images/logos';var _0x2d7fd4={'custom':![]};return utilLicense[_0xad0b('0x53')]()['then'](function(_0x5541a){if(_0x5541a){_0x2d7fd4=_0x5541a;}return db['Setting'][_0xad0b('0x51')]({'where':{'id':_0x2cd6be['params']['id']},'attributes':[_0xad0b('0x54'),_0xad0b('0x55'),_0xad0b('0x56'),_0xad0b('0x57'),_0xad0b('0x58'),_0xad0b('0x59'),'defaultPreferred',_0xad0b('0x5a')],'raw':!![]});})[_0xad0b('0x1a')](handleEntityNotFound(_0x5e883d,null))[_0xad0b('0x1a')](function(_0x251bed){if(_0x251bed){var _0x210b51=_0x251bed[_0xad0b('0x54')]&&fs[_0xad0b('0x5b')](path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x1c43e2,_[_0xad0b('0x5e')](_0x251bed[_0xad0b('0x54')])))?path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x1c43e2,_[_0xad0b('0x5e')](_0x251bed[_0xad0b('0x54')])):path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x1c43e2,_[_0xad0b('0x5e')](_0xad0b('0x5f')));var _0x1d8584=_0xad0b('0x60')+_[_0xad0b('0x61')](_0xad0b('0x54'));if(_0x251bed[_0x1d8584]||!_0x2d7fd4[_0xad0b('0x62')]){_0x210b51=path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x1c43e2,_[_0xad0b('0x5e')]('default_logo.svg'));}if(!fs[_0xad0b('0x5b')](_0x210b51)){throw new db[(_0xad0b('0x63'))][(_0xad0b('0x64'))](_[_0xad0b('0x61')](_0xad0b('0x54'))+_0xad0b('0x65'));}return _0x5e883d['download'](_0x210b51);}})['catch'](handleError(_0x5e883d,null));};var utilLicense=require(_0xad0b('0x66'));exports[_0xad0b('0x67')]=function(_0x39be36,_0x2f2e2f,_0x4c37c5){var _0x3c7e70='server/files/images/logos';var _0x239a9a={'custom':![]};return utilLicense[_0xad0b('0x53')]()[_0xad0b('0x1a')](function(_0x493231){if(_0x493231){_0x239a9a=_0x493231;}return db['Setting'][_0xad0b('0x51')]({'where':{'id':_0x39be36['params']['id']},'attributes':[_0xad0b('0x54'),'loginLogo',_0xad0b('0x56'),_0xad0b('0x57'),_0xad0b('0x58'),_0xad0b('0x59'),_0xad0b('0x68'),_0xad0b('0x5a')],'raw':!![]});})[_0xad0b('0x1a')](handleEntityNotFound(_0x2f2e2f,null))[_0xad0b('0x1a')](function(_0x12e54c){if(_0x12e54c){var _0x1aa2cc=_0x12e54c[_0xad0b('0x55')]&&fs[_0xad0b('0x5b')](path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x3c7e70,_[_0xad0b('0x5e')](_0x12e54c[_0xad0b('0x55')])))?path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x3c7e70,_[_0xad0b('0x5e')](_0x12e54c[_0xad0b('0x55')])):path[_0xad0b('0x5c')](config['root'],_0x3c7e70,_[_0xad0b('0x5e')]('default_loginLogo.svg'));var _0x564163=_0xad0b('0x60')+_['upperFirst']('loginLogo');if(_0x12e54c[_0x564163]||!_0x239a9a['custom']){_0x1aa2cc=path[_0xad0b('0x5c')](config['root'],_0x3c7e70,_['toLower'](_0xad0b('0x69')));}if(!fs['existsSync'](_0x1aa2cc)){throw new db[(_0xad0b('0x63'))][(_0xad0b('0x64'))](_[_0xad0b('0x61')](_0xad0b('0x55'))+_0xad0b('0x65'));}return _0x2f2e2f[_0xad0b('0x6a')](_0x1aa2cc);}})['catch'](handleError(_0x2f2e2f,null));};exports['gdpr']=function(_0x32a69e,_0x504e00){return db['Setting'][_0xad0b('0x51')]({'where':{'id':_0x32a69e[_0xad0b('0x4a')]['id']},'attributes':['securePassword']})[_0xad0b('0x1a')](respondWithResult(_0x504e00,null))[_0xad0b('0x23')](handleError(_0x504e00,null));};exports[_0xad0b('0x6b')]=function(_0x2deb5a,_0x59cb39,_0x3e3180){if(_0x2deb5a[_0xad0b('0x4f')]&&_0x2deb5a[_0xad0b('0x4f')][_0xad0b('0x50')]){_0x2deb5a[_0xad0b('0x4d')][_0xad0b('0x56')]=_0x2deb5a[_0xad0b('0x4f')][_0xad0b('0x50')];}return db[_0xad0b('0x35')][_0xad0b('0x51')]({'where':{'id':_0x2deb5a['params']['id']}})['then'](handleEntityNotFound(_0x59cb39,null))[_0xad0b('0x1a')](saveUpdates(_0x2deb5a[_0xad0b('0x4d')],null))[_0xad0b('0x1a')](respondWithResult(_0x59cb39,null))[_0xad0b('0x23')](handleError(_0x59cb39,null));};var utilLicense=require(_0xad0b('0x66'));exports[_0xad0b('0x6c')]=function(_0x560323,_0x48fc19,_0x2e1694){var _0x3137df=_0xad0b('0x6d');var _0x13864d={'custom':![]};return utilLicense[_0xad0b('0x53')]()['then'](function(_0x3ea84d){if(_0x3ea84d){_0x13864d=_0x3ea84d;}return db['Setting'][_0xad0b('0x51')]({'where':{'id':_0x560323[_0xad0b('0x4a')]['id']},'attributes':[_0xad0b('0x54'),_0xad0b('0x55'),'preferred','favicon',_0xad0b('0x58'),_0xad0b('0x59'),_0xad0b('0x68'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x48fc19,null))[_0xad0b('0x1a')](function(_0x4d08b0){if(_0x4d08b0){var _0x4aae30=_0x4d08b0[_0xad0b('0x56')]&&fs[_0xad0b('0x5b')](path[_0xad0b('0x5c')](config['root'],_0x3137df,_[_0xad0b('0x5e')](_0x4d08b0[_0xad0b('0x56')])))?path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x3137df,_[_0xad0b('0x5e')](_0x4d08b0[_0xad0b('0x56')])):path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x3137df,_[_0xad0b('0x5e')](_0xad0b('0x6e')));var _0x3653e8=_0xad0b('0x60')+_[_0xad0b('0x61')](_0xad0b('0x56'));if(_0x4d08b0[_0x3653e8]||!_0x13864d[_0xad0b('0x62')]||!_0x13864d['preferred']){_0x4aae30=path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0x3137df,_[_0xad0b('0x5e')](_0xad0b('0x6e')));}if(!fs['existsSync'](_0x4aae30)){throw new db['Sequelize']['ValidationError'](_['upperFirst']('preferred')+_0xad0b('0x65'));}return _0x48fc19[_0xad0b('0x6a')](_0x4aae30);}})[_0xad0b('0x23')](handleError(_0x48fc19,null));};exports[_0xad0b('0x6f')]=function(_0x28e414,_0x3059e3,_0x8b170e){if(_0x28e414[_0xad0b('0x4f')]&&_0x28e414[_0xad0b('0x4f')][_0xad0b('0x50')]){_0x28e414[_0xad0b('0x4d')][_0xad0b('0x57')]=_0x28e414['file'][_0xad0b('0x50')];}return db[_0xad0b('0x35')][_0xad0b('0x51')]({'where':{'id':_0x28e414['params']['id']}})[_0xad0b('0x1a')](handleEntityNotFound(_0x3059e3,null))[_0xad0b('0x1a')](saveUpdates(_0x28e414[_0xad0b('0x4d')],null))[_0xad0b('0x1a')](respondWithResult(_0x3059e3,null))[_0xad0b('0x23')](handleError(_0x3059e3,null));};var utilLicense=require(_0xad0b('0x66'));exports[_0xad0b('0x70')]=function(_0x14fc0b,_0x32e86e,_0x18659a){var _0xb8bd5d=_0xad0b('0x6d');var _0x3eea84={'custom':![]};return utilLicense[_0xad0b('0x53')]()['then'](function(_0x2ce2ad){if(_0x2ce2ad){_0x3eea84=_0x2ce2ad;}return db[_0xad0b('0x35')][_0xad0b('0x51')]({'where':{'id':_0x14fc0b[_0xad0b('0x4a')]['id']},'attributes':[_0xad0b('0x54'),'loginLogo',_0xad0b('0x56'),'favicon',_0xad0b('0x58'),_0xad0b('0x59'),_0xad0b('0x68'),_0xad0b('0x5a')],'raw':!![]});})[_0xad0b('0x1a')](handleEntityNotFound(_0x32e86e,null))[_0xad0b('0x1a')](function(_0x75e9bd){if(_0x75e9bd){var _0x31a57c=_0x75e9bd['favicon']&&fs[_0xad0b('0x5b')](path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0xb8bd5d,_[_0xad0b('0x5e')](_0x75e9bd[_0xad0b('0x57')])))?path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0xb8bd5d,_['toLower'](_0x75e9bd['favicon'])):path[_0xad0b('0x5c')](config[_0xad0b('0x5d')],_0xb8bd5d,_[_0xad0b('0x5e')](_0xad0b('0x71')));var _0x45ef02=_0xad0b('0x60')+_['upperFirst'](_0xad0b('0x57'));if(_0x75e9bd[_0x45ef02]||!_0x3eea84[_0xad0b('0x62')]){_0x31a57c=path['join'](config[_0xad0b('0x5d')],_0xb8bd5d,_[_0xad0b('0x5e')](_0xad0b('0x71')));}if(!fs[_0xad0b('0x5b')](_0x31a57c)){throw new db[(_0xad0b('0x63'))][(_0xad0b('0x64'))](_['upperFirst'](_0xad0b('0x57'))+_0xad0b('0x65'));}return _0x32e86e[_0xad0b('0x6a')](_0x31a57c);}})[_0xad0b('0x23')](handleError(_0x32e86e,null));};exports[_0xad0b('0x72')]=function(_0x4af734,_0x28bebf){var _0x360da6={'offset':moment()[_0xad0b('0x73')]()};_0x360da6[_0xad0b('0x74')]=moment()['utcOffset'](_0x360da6[_0xad0b('0x28')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x28bebf['status'](0xc8)[_0xad0b('0x32')](_0x360da6);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ce5e65f..72c904a 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x55ca,0x126));var _0xa55c=function(_0x258257,_0x32042d){_0x258257=_0x258257-0x0;var _0xafb58a=_0x55ca[_0x258257];return _0xafb58a;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f6e1a4a..2e1fb2c 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 _0x4ef1=['attributes','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','ShowSetting','Setting','find','options','raw'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x4ef1,0x14f));var _0x14ef=function(_0x4309eb,_0x319008){_0x4309eb=_0x4309eb-0x0;var _0x45cbe7=_0x4ef1[_0x4309eb];return _0x45cbe7;};'use strict';var _=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var moment=require('moment');var BPromise=require(_0x14ef('0x2'));var rs=require(_0x14ef('0x3'));var fs=require('fs');var Redis=require(_0x14ef('0x4'));var db=require(_0x14ef('0x5'))['db'];var utils=require(_0x14ef('0x6'));var logger=require('../../config/logger')(_0x14ef('0x7'));var config=require(_0x14ef('0x8'));var jayson=require(_0x14ef('0x9'));var client=jayson[_0x14ef('0xa')][_0x14ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x375db5,_0x4f58ae,_0x36f190){return new BPromise(function(_0x4592a1,_0x3e39af){return client[_0x14ef('0xc')](_0x375db5,_0x36f190)[_0x14ef('0xd')](function(_0x15cc8c){logger['info']('Setting,\x20%s,\x20%s',_0x4f58ae,_0x14ef('0xe'));logger[_0x14ef('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x4f58ae,_0x14ef('0xe'),JSON[_0x14ef('0x10')](_0x15cc8c));if(_0x15cc8c[_0x14ef('0x11')]){if(_0x15cc8c[_0x14ef('0x11')][_0x14ef('0x12')]===0x1f4){logger[_0x14ef('0x11')](_0x14ef('0x13'),_0x4f58ae,_0x15cc8c[_0x14ef('0x11')]['message']);return _0x3e39af(_0x15cc8c[_0x14ef('0x11')][_0x14ef('0x14')]);}logger[_0x14ef('0x11')](_0x14ef('0x13'),_0x4f58ae,_0x15cc8c[_0x14ef('0x11')]['message']);return _0x4592a1(_0x15cc8c['error'][_0x14ef('0x14')]);}else{logger[_0x14ef('0x15')]('Setting,\x20%s,\x20%s',_0x4f58ae,_0x14ef('0xe'));_0x4592a1(_0x15cc8c[_0x14ef('0x16')]['message']);}})['catch'](function(_0x5003b0){logger[_0x14ef('0x11')](_0x14ef('0x13'),_0x4f58ae,_0x5003b0);_0x3e39af(_0x5003b0);});});}exports[_0x14ef('0x17')]=function(_0x4e4d5f){var _0x552f24=this;return new Promise(function(_0x4cc8ae,_0x432cc8){return db[_0x14ef('0x18')][_0x14ef('0x19')]({'raw':_0x4e4d5f[_0x14ef('0x1a')]?_0x4e4d5f[_0x14ef('0x1a')][_0x14ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e4d5f['options']?_0x4e4d5f[_0x14ef('0x1a')]['where']||null:null,'attributes':_0x4e4d5f[_0x14ef('0x1a')]?_0x4e4d5f['options'][_0x14ef('0x1c')]||null:null,'include':_0x4e4d5f[_0x14ef('0x1a')]?_0x4e4d5f['options'][_0x14ef('0x1d')]?_[_0x14ef('0x1e')](_0x4e4d5f[_0x14ef('0x1a')]['include'],function(_0x26b4de){return{'model':db[_0x26b4de[_0x14ef('0x1f')]],'as':_0x26b4de['as'],'attributes':_0x26b4de['attributes'],'include':_0x26b4de[_0x14ef('0x1d')]?_[_0x14ef('0x1e')](_0x26b4de[_0x14ef('0x1d')],function(_0x55415f){return{'model':db[_0x55415f[_0x14ef('0x1f')]],'as':_0x55415f['as'],'attributes':_0x55415f[_0x14ef('0x1c')],'include':_0x55415f[_0x14ef('0x1d')]?_[_0x14ef('0x1e')](_0x55415f[_0x14ef('0x1d')],function(_0x489d83){return{'model':db[_0x489d83[_0x14ef('0x1f')]],'as':_0x489d83['as'],'attributes':_0x489d83[_0x14ef('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14ef('0xd')](function(_0x20c03f){logger[_0x14ef('0x15')]('ShowSetting',_0x4e4d5f);logger['debug'](_0x14ef('0x17'),_0x4e4d5f,JSON[_0x14ef('0x10')](_0x20c03f));_0x4cc8ae(_0x20c03f);})[_0x14ef('0x20')](function(_0x2f66fc){logger[_0x14ef('0x11')]('ShowSetting',_0x2f66fc['message'],_0x4e4d5f);_0x432cc8(_0x552f24['error'](0x1f4,_0x2f66fc['message']));});});}; \ No newline at end of file +var _0xfbf9=['ShowSetting','Setting','options','raw','where','attributes','include','map','model','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x2bebae,_0x4dd079){var _0x383830=function(_0xabb25b){while(--_0xabb25b){_0x2bebae['push'](_0x2bebae['shift']());}};_0x383830(++_0x4dd079);}(_0xfbf9,0x81));var _0x9fbf=function(_0x425b19,_0x2dcf14){_0x425b19=_0x425b19-0x0;var _0x15ecab=_0xfbf9[_0x425b19];return _0x15ecab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9fbf('0x0'));var BPromise=require('bluebird');var rs=require(_0x9fbf('0x1'));var fs=require('fs');var Redis=require(_0x9fbf('0x2'));var db=require(_0x9fbf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9fbf('0x4'))(_0x9fbf('0x5'));var config=require(_0x9fbf('0x6'));var jayson=require(_0x9fbf('0x7'));var client=jayson[_0x9fbf('0x8')][_0x9fbf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dda48,_0x1fba21,_0x25cd1f){return new BPromise(function(_0x26ab8b,_0x4aa45b){return client['request'](_0x2dda48,_0x25cd1f)[_0x9fbf('0xa')](function(_0xd31728){logger[_0x9fbf('0xb')](_0x9fbf('0xc'),_0x1fba21,_0x9fbf('0xd'));logger[_0x9fbf('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x1fba21,'request\x20sent',JSON[_0x9fbf('0xf')](_0xd31728));if(_0xd31728[_0x9fbf('0x10')]){if(_0xd31728[_0x9fbf('0x10')][_0x9fbf('0x11')]===0x1f4){logger[_0x9fbf('0x10')]('Setting,\x20%s,\x20%s',_0x1fba21,_0xd31728[_0x9fbf('0x10')][_0x9fbf('0x12')]);return _0x4aa45b(_0xd31728[_0x9fbf('0x10')]['message']);}logger[_0x9fbf('0x10')]('Setting,\x20%s,\x20%s',_0x1fba21,_0xd31728[_0x9fbf('0x10')][_0x9fbf('0x12')]);return _0x26ab8b(_0xd31728['error'][_0x9fbf('0x12')]);}else{logger['info'](_0x9fbf('0xc'),_0x1fba21,_0x9fbf('0xd'));_0x26ab8b(_0xd31728[_0x9fbf('0x13')]['message']);}})[_0x9fbf('0x14')](function(_0x2c78b0){logger[_0x9fbf('0x10')](_0x9fbf('0xc'),_0x1fba21,_0x2c78b0);_0x4aa45b(_0x2c78b0);});});}exports[_0x9fbf('0x15')]=function(_0x200cd7){var _0x512905=this;return new Promise(function(_0x485acc,_0x5a2e55){return db[_0x9fbf('0x16')]['find']({'raw':_0x200cd7[_0x9fbf('0x17')]?_0x200cd7[_0x9fbf('0x17')][_0x9fbf('0x18')]===undefined?!![]:![]:!![],'where':_0x200cd7[_0x9fbf('0x17')]?_0x200cd7[_0x9fbf('0x17')][_0x9fbf('0x19')]||null:null,'attributes':_0x200cd7[_0x9fbf('0x17')]?_0x200cd7[_0x9fbf('0x17')][_0x9fbf('0x1a')]||null:null,'include':_0x200cd7[_0x9fbf('0x17')]?_0x200cd7[_0x9fbf('0x17')][_0x9fbf('0x1b')]?_[_0x9fbf('0x1c')](_0x200cd7[_0x9fbf('0x17')]['include'],function(_0x4ab8fb){return{'model':db[_0x4ab8fb['model']],'as':_0x4ab8fb['as'],'attributes':_0x4ab8fb[_0x9fbf('0x1a')],'include':_0x4ab8fb[_0x9fbf('0x1b')]?_['map'](_0x4ab8fb[_0x9fbf('0x1b')],function(_0x3bb1c5){return{'model':db[_0x3bb1c5[_0x9fbf('0x1d')]],'as':_0x3bb1c5['as'],'attributes':_0x3bb1c5['attributes'],'include':_0x3bb1c5[_0x9fbf('0x1b')]?_['map'](_0x3bb1c5[_0x9fbf('0x1b')],function(_0x9316cc){return{'model':db[_0x9316cc['model']],'as':_0x9316cc['as'],'attributes':_0x9316cc[_0x9fbf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9fbf('0xa')](function(_0x3fef5e){logger[_0x9fbf('0xb')]('ShowSetting',_0x200cd7);logger['debug']('ShowSetting',_0x200cd7,JSON[_0x9fbf('0xf')](_0x3fef5e));_0x485acc(_0x3fef5e);})['catch'](function(_0x27be7c){logger[_0x9fbf('0x10')](_0x9fbf('0x15'),_0x27be7c['message'],_0x200cd7);_0x5a2e55(_0x512905[_0x9fbf('0x10')](0x1f4,_0x27be7c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8ac42fa..f64772f 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 _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7217,0x19e));var _0x7721=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x7217[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x3c3d59,_0x369b04){var _0x25d467=function(_0x991667){while(--_0x991667){_0x3c3d59['push'](_0x3c3d59['shift']());}};_0x25d467(++_0x369b04);}(_0xe14b,0x93));var _0xbe14=function(_0x23bef7,_0x128f30){_0x23bef7=_0x23bef7-0x0;var _0x2ff43e=_0xe14b[_0x23bef7];return _0x2ff43e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 561dc2e..2b5f629 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 _0x7655=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','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'];(function(_0x7ea9e0,_0x3e2a22){var _0x191073=function(_0x9e1df5){while(--_0x9e1df5){_0x7ea9e0['push'](_0x7ea9e0['shift']());}};_0x191073(++_0x3e2a22);}(_0x7655,0x144));var _0x5765=function(_0x518657,_0x33d293){_0x518657=_0x518657-0x0;var _0x1b1f4f=_0x7655[_0x518657];return _0x1b1f4f;};'use strict';var Sequelize=require(_0x5765('0x0'));var rs=require(_0x5765('0x1'));module[_0x5765('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x5765('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x5765('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x5765('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x5765('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5765('0x4')]},'type':{'type':Sequelize[_0x5765('0x5')](_0x5765('0x6'),_0x5765('0x7'),'connectel',_0x5765('0x8'),_0x5765('0x9'),_0x5765('0xa'),_0x5765('0xb'),_0x5765('0xc'),_0x5765('0xd'),_0x5765('0xe'))},'accountSid':{'type':Sequelize[_0x5765('0x4')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x5765('0x4')]},'smsMethod':{'type':Sequelize[_0x5765('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5765('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x5765('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5765('0x4')]},'notificationTemplate':{'type':Sequelize[_0x5765('0xf')],'defaultValue':function(){return _0x5765('0x10');}},'notificationSound':{'type':Sequelize[_0x5765('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5765('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5765('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5765('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5765('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5765('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5765('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5765('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x5765('0x11')],'defaultValue':![],'comment':_0x5765('0x14'),'set':function(_0x26e49c){if(!_0x26e49c)this[_0x5765('0x15')]('mandatoryDispositionPauseId',null);this[_0x5765('0x15')](_0x5765('0x16'),_0x26e49c);}}}; \ No newline at end of file +var _0xb81d=['name','STRING','generate','ENUM','skebby','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x31b0fd,_0x5de8b1){var _0x4332f8=function(_0x2cd6d8){while(--_0x2cd6d8){_0x31b0fd['push'](_0x31b0fd['shift']());}};_0x4332f8(++_0x5de8b1);}(_0xb81d,0xd7));var _0xdb81=function(_0x506ff5,_0x1c5383){_0x506ff5=_0x506ff5-0x0;var _0x473909=_0xb81d[_0x506ff5];return _0x473909;};'use strict';var Sequelize=require(_0xdb81('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdb81('0x1'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xdb81('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdb81('0x3')]();}},'phone':{'type':Sequelize[_0xdb81('0x2')]},'type':{'type':Sequelize[_0xdb81('0x4')]('twilio',_0xdb81('0x5'),'connectel',_0xdb81('0x6'),_0xdb81('0x7'),'clickatell',_0xdb81('0x8'),_0xdb81('0x9'),_0xdb81('0xa'),_0xdb81('0xb'))},'accountSid':{'type':Sequelize[_0xdb81('0x2')]},'authId':{'type':Sequelize[_0xdb81('0x2')]},'authToken':{'type':Sequelize[_0xdb81('0x2')]},'smsMethod':{'type':Sequelize[_0xdb81('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xdb81('0x2')]},'password':{'type':Sequelize[_0xdb81('0x2')]},'apiKey':{'type':Sequelize[_0xdb81('0x2')]},'applicationId':{'type':Sequelize[_0xdb81('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xdb81('0x2')]},'deliveryReport':{'type':Sequelize[_0xdb81('0xc')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xdb81('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xdb81('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdb81('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdb81('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdb81('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdb81('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xdb81('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdb81('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdb81('0xc')],'defaultValue':![],'comment':_0xdb81('0xf'),'set':function(_0x3184b6){if(!_0x3184b6)this[_0xdb81('0x10')]('mandatoryDispositionPauseId',null);this[_0xdb81('0x10')](_0xdb81('0x11'),_0x3184b6);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9750f4a..aca9a98 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 _0xa54e=['Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','clicksend','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','state','message-id','ids','omit','emit','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','Pause','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','SmsAccountId','Disposition','getDispositions','findOne','order','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','SmsApplication','Applications','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','From','Body','MessageSid','skebby','sender','text','connectel','from','message_id','messageId','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','defaults','CmContact','contact','SmsInteraction','spread','interaction','created','autoclose','push','applications','close','unmanaged','AttachmentId','User','UserId','unshift','agent','*,*,*,*','startRouting','Start','receiveMessage','entity\x20found','twilio','Content-Type','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','SmsMessage','dataValues'];(function(_0x545c01,_0x475388){var _0x4492a3=function(_0x1fab9b){while(--_0x1fab9b){_0x545c01['push'](_0x545c01['shift']());}};_0x4492a3(++_0x475388);}(_0xa54e,0x100));var _0xea54=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa54e[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xea54('0x0'));var rimraf=require(_0xea54('0x1'));var zipdir=require(_0xea54('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea54('0x3'));var moment=require(_0xea54('0x4'));var BPromise=require(_0xea54('0x5'));var Mustache=require(_0xea54('0x6'));var util=require(_0xea54('0x7'));var path=require(_0xea54('0x8'));var sox=require(_0xea54('0x9'));var csv=require(_0xea54('0xa'));var ejs=require(_0xea54('0xb'));var fs=require('fs');var fs_extra=require(_0xea54('0xc'));var _=require(_0xea54('0xd'));var squel=require('squel');var crypto=require(_0xea54('0xe'));var jsforce=require(_0xea54('0xf'));var deskjs=require(_0xea54('0x10'));var toCsv=require(_0xea54('0xa'));var querystring=require(_0xea54('0x11'));var Papa=require(_0xea54('0x12'));var Redis=require(_0xea54('0x13'));var authService=require(_0xea54('0x14'));var qs=require(_0xea54('0x15'));var as=require(_0xea54('0x16'));var hardwareService=require(_0xea54('0x17'));var logger=require(_0xea54('0x18'))(_0xea54('0x19'));var utils=require(_0xea54('0x1a'));var config=require(_0xea54('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xea54('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xea54('0x1d'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xea54('0x1e')](socket);var jayson=require(_0xea54('0x1f'));var client=jayson[_0xea54('0x20')][_0xea54('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x164733,_0x1a5e12,_0x3707e2,_0x219f25){return new BPromise(function(_0x4b6171,_0x2a1deb){var _0x468ad0=_0x219f25||client;return _0x468ad0[_0xea54('0x22')](_0x164733,_0x3707e2)[_0xea54('0x23')](function(_0x46bdd4){logger[_0xea54('0x24')](_0xea54('0x25'),_0x1a5e12,'request\x20sent');logger[_0xea54('0x26')](_0xea54('0x27'),_0x1a5e12,_0xea54('0x28'),JSON[_0xea54('0x29')](_0x46bdd4));if(_0x46bdd4['error']){if(_0x46bdd4[_0xea54('0x2a')][_0xea54('0x2b')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x1a5e12,_0x46bdd4[_0xea54('0x2a')][_0xea54('0x2c')]);return _0x2a1deb(_0x46bdd4[_0xea54('0x2a')]['message']);}logger[_0xea54('0x2a')](_0xea54('0x25'),_0x1a5e12,_0x46bdd4[_0xea54('0x2a')][_0xea54('0x2c')]);return _0x4b6171(_0x46bdd4[_0xea54('0x2a')][_0xea54('0x2c')]);}else{logger[_0xea54('0x24')]('SmsAccount,\x20%s,\x20%s',_0x1a5e12,'request\x20sent');_0x4b6171(_0x46bdd4['result'][_0xea54('0x2c')]);}})[_0xea54('0x2d')](function(_0x8be44d){logger[_0xea54('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x1a5e12,_0x8be44d);_0x2a1deb(_0x8be44d);});});}function respondWithStatusCode(_0x294757,_0x5ac9ff){_0x5ac9ff=_0x5ac9ff||0xcc;return function(_0x3aabeb){if(_0x3aabeb){return _0x294757[_0xea54('0x2e')](_0x5ac9ff);}return _0x294757[_0xea54('0x2f')](_0x5ac9ff)[_0xea54('0x30')]();};}function respondWithResult(_0x42bc07,_0x50ca39){_0x50ca39=_0x50ca39||0xc8;return function(_0x5570a1){if(_0x5570a1){return _0x42bc07[_0xea54('0x2f')](_0x50ca39)[_0xea54('0x31')](_0x5570a1);}};}function respondWithFilteredResult(_0x1005b0,_0x1fff75){return function(_0xfa6961){if(_0xfa6961){var _0x9f10bf=typeof _0x1fff75['offset']==='undefined'&&typeof _0x1fff75[_0xea54('0x32')]===_0xea54('0x33');var _0x102434=_0xfa6961[_0xea54('0x34')];var _0x511bff=_0x9f10bf?0x0:_0x1fff75[_0xea54('0x35')];var _0x249a95=_0x9f10bf?_0xfa6961['count']:_0x1fff75[_0xea54('0x35')]+_0x1fff75[_0xea54('0x32')];var _0x5cbc48;if(_0x249a95>=_0x102434){_0x249a95=_0x102434;_0x5cbc48=0xc8;}else{_0x5cbc48=0xce;}_0x1005b0['status'](_0x5cbc48);return _0x1005b0[_0xea54('0x36')](_0xea54('0x37'),_0x511bff+'-'+_0x249a95+'/'+_0x102434)[_0xea54('0x31')](_0xfa6961);}return null;};}function patchUpdates(_0x21f68a){return function(_0x4c7f05){try{jsonpatch[_0xea54('0x38')](_0x4c7f05,_0x21f68a,!![]);}catch(_0x188a9d){return BPromise[_0xea54('0x39')](_0x188a9d);}return _0x4c7f05[_0xea54('0x3a')]();};}function saveUpdates(_0x4a0d50,_0x18247a){return function(_0x58ce57){if(_0x58ce57){return _0x58ce57[_0xea54('0x3b')](_0x4a0d50)['then'](function(_0x53a6cf){return _0x53a6cf;});}return null;};}function removeEntity(_0x42fa68,_0x2036f5){return function(_0x3a3e5d){if(_0x3a3e5d){return _0x3a3e5d['destroy']()['then'](function(){var _0x24a9d7=_0x3a3e5d[_0xea54('0x3c')]({'plain':!![]});var _0xd6ee30=_0xea54('0x3d');return db[_0xea54('0x3e')][_0xea54('0x3f')]({'where':{'type':_0xd6ee30,'resourceId':_0x24a9d7['id']}})['then'](function(){return _0x3a3e5d;});})[_0xea54('0x23')](function(){_0x42fa68[_0xea54('0x2f')](0xcc)[_0xea54('0x30')]();});}};}function handleEntityNotFound(_0x546388,_0x52e41a){return function(_0x21342a){if(!_0x21342a){_0x546388[_0xea54('0x2e')](0x194);}return _0x21342a;};}function handleError(_0x481510,_0x3575fb){_0x3575fb=_0x3575fb||0x1f4;return function(_0x497fc0){logger['error'](_0x497fc0[_0xea54('0x40')]);if(_0x497fc0[_0xea54('0x41')]){delete _0x497fc0[_0xea54('0x41')];}_0x481510[_0xea54('0x2f')](_0x3575fb)[_0xea54('0x42')](_0x497fc0);};}exports[_0xea54('0x43')]=function(_0xdf176c,_0x1af2bc){var _0x5e95e1={'include':[{'model':db['Pause'],'as':_0xea54('0x44')}]},_0x22a19a={},_0x4e335e={'count':0x0,'rows':[]};var _0x2d9e5c=_[_0xea54('0x45')](db[_0xea54('0x46')]['rawAttributes'],function(_0x52b691){return{'name':_0x52b691['fieldName'],'type':_0x52b691['type'][_0xea54('0x47')]};});_0x22a19a[_0xea54('0x48')]=_[_0xea54('0x45')](_0x2d9e5c,_0xea54('0x41'));_0x22a19a[_0xea54('0x49')]=_[_0xea54('0x4a')](_0xdf176c['query']);_0x22a19a[_0xea54('0x4b')]=_['intersection'](_0x22a19a[_0xea54('0x48')],_0x22a19a[_0xea54('0x49')]);_0x5e95e1[_0xea54('0x4c')]=_[_0xea54('0x4d')](_0x22a19a[_0xea54('0x48')],qs[_0xea54('0x4e')](_0xdf176c[_0xea54('0x49')]['fields']));_0x5e95e1[_0xea54('0x4c')]=_0x5e95e1[_0xea54('0x4c')][_0xea54('0x4f')]?_0x5e95e1[_0xea54('0x4c')]:_0x22a19a[_0xea54('0x48')];if(!_0xdf176c[_0xea54('0x49')]['hasOwnProperty'](_0xea54('0x50'))){_0x5e95e1['limit']=qs[_0xea54('0x32')](_0xdf176c['query']['limit']);_0x5e95e1[_0xea54('0x35')]=qs[_0xea54('0x35')](_0xdf176c[_0xea54('0x49')][_0xea54('0x35')]);}_0x5e95e1['order']=qs[_0xea54('0x51')](_0xdf176c[_0xea54('0x49')][_0xea54('0x51')]);_0x5e95e1[_0xea54('0x52')]=qs[_0xea54('0x4b')](_[_0xea54('0x53')](_0xdf176c[_0xea54('0x49')],_0x22a19a[_0xea54('0x4b')]),_0x2d9e5c);if(_0xdf176c[_0xea54('0x49')][_0xea54('0x54')]){_0x5e95e1[_0xea54('0x52')]=_[_0xea54('0x55')](_0x5e95e1[_0xea54('0x52')],{'$or':_[_0xea54('0x45')](_0x2d9e5c,function(_0x2e27f3){if(_0x2e27f3[_0xea54('0x56')]!==_0xea54('0x57')){var _0x11e5be={};_0x11e5be[_0x2e27f3[_0xea54('0x41')]]={'$like':'%'+_0xdf176c[_0xea54('0x49')][_0xea54('0x54')]+'%'};return _0x11e5be;}})});}_0x5e95e1=_[_0xea54('0x55')]({},_0x5e95e1,_0xdf176c[_0xea54('0x58')]);var _0x35ac19={'where':_0x5e95e1['where']};return db['SmsAccount'][_0xea54('0x34')](_0x35ac19)[_0xea54('0x23')](function(_0x56cf12){_0x4e335e[_0xea54('0x34')]=_0x56cf12;if(_0xdf176c[_0xea54('0x49')][_0xea54('0x59')]){_0x5e95e1[_0xea54('0x5a')]=[{'all':!![]}];}return db['SmsAccount'][_0xea54('0x5b')](_0x5e95e1);})[_0xea54('0x23')](function(_0x11aed4){_0x4e335e['rows']=_0x11aed4;return _0x4e335e;})[_0xea54('0x23')](respondWithFilteredResult(_0x1af2bc,_0x5e95e1))['catch'](handleError(_0x1af2bc,null));};exports[_0xea54('0x5c')]=function(_0x228f11,_0x2eb5cc){var _0x2ec8e3={'raw':![],'where':{'id':_0x228f11[_0xea54('0x5d')]['id']},'include':[{'model':db[_0xea54('0x5e')],'as':_0xea54('0x44')}]},_0x5ba1e0={};_0x5ba1e0[_0xea54('0x48')]=_[_0xea54('0x4a')](db[_0xea54('0x46')][_0xea54('0x5f')]);_0x5ba1e0['query']=_[_0xea54('0x4a')](_0x228f11['query']);_0x5ba1e0[_0xea54('0x4b')]=_[_0xea54('0x4d')](_0x5ba1e0[_0xea54('0x48')],_0x5ba1e0[_0xea54('0x49')]);_0x2ec8e3['attributes']=_[_0xea54('0x4d')](_0x5ba1e0['model'],qs['fields'](_0x228f11['query'][_0xea54('0x4e')]));_0x2ec8e3['attributes']=_0x2ec8e3[_0xea54('0x4c')][_0xea54('0x4f')]?_0x2ec8e3['attributes']:_0x5ba1e0['model'];if(_0x228f11[_0xea54('0x49')][_0xea54('0x59')]){_0x2ec8e3[_0xea54('0x5a')]=[{'all':!![]}];}_0x2ec8e3=_[_0xea54('0x55')]({},_0x2ec8e3,_0x228f11[_0xea54('0x58')]);return db['SmsAccount'][_0xea54('0x60')](_0x2ec8e3)[_0xea54('0x23')](handleEntityNotFound(_0x2eb5cc,null))[_0xea54('0x23')](respondWithResult(_0x2eb5cc,null))[_0xea54('0x2d')](handleError(_0x2eb5cc,null));};exports[_0xea54('0x61')]=function(_0x2c28cc,_0x5ec123){return db['SmsAccount'][_0xea54('0x61')](_0x2c28cc[_0xea54('0x62')],{})['then'](function(_0x58ab7a){var _0x2c3044=_0x2c28cc[_0xea54('0x63')][_0xea54('0x3c')]({'plain':!![]});if(!_0x2c3044)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c3044[_0xea54('0x64')]===_0xea54('0x63')){var _0x272118=_0x58ab7a['get']({'plain':!![]});var _0x70ec65=_0xea54('0x3d');return db[_0xea54('0x65')][_0xea54('0x60')]({'where':{'name':_0x70ec65,'userProfileId':_0x2c3044[_0xea54('0x66')]},'raw':!![]})['then'](function(_0x2a66b4){if(_0x2a66b4&&_0x2a66b4[_0xea54('0x67')]===0x0){return db[_0xea54('0x3e')]['create']({'name':_0x272118['name'],'resourceId':_0x272118['id'],'type':_0x2a66b4[_0xea54('0x41')],'sectionId':_0x2a66b4['id']},{})[_0xea54('0x23')](function(){return _0x58ab7a;});}else{return _0x58ab7a;}})[_0xea54('0x2d')](function(_0x2bc327){logger[_0xea54('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bc327);throw _0x2bc327;});}return _0x58ab7a;})['then'](respondWithResult(_0x5ec123,0xc9))[_0xea54('0x2d')](handleError(_0x5ec123,null));};exports[_0xea54('0x3b')]=function(_0x128692,_0x598735){if(_0x128692[_0xea54('0x62')]['id']){delete _0x128692[_0xea54('0x62')]['id'];}return db[_0xea54('0x46')]['find']({'where':{'id':_0x128692['params']['id']},'include':[{'model':db[_0xea54('0x5e')],'as':'mandatoryDispositionPause'}]})[_0xea54('0x23')](handleEntityNotFound(_0x598735,null))[_0xea54('0x23')](saveUpdates(_0x128692[_0xea54('0x62')],null))[_0xea54('0x23')](respondWithResult(_0x598735,null))[_0xea54('0x2d')](handleError(_0x598735,null));};exports['destroy']=function(_0x1e98cf,_0x1f8e55){return db[_0xea54('0x46')][_0xea54('0x60')]({'where':{'id':_0x1e98cf[_0xea54('0x5d')]['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x1f8e55,null))[_0xea54('0x23')](removeEntity(_0x1f8e55,null))[_0xea54('0x2d')](handleError(_0x1f8e55,null));};exports[_0xea54('0x68')]=function(_0x419d82,_0x4daa22){return db['SmsAccount'][_0xea54('0x68')]()[_0xea54('0x23')](respondWithResult(_0x4daa22,null))[_0xea54('0x2d')](handleError(_0x4daa22,null));};exports['addDisposition']=function(_0x367e65,_0x5e966e,_0x53f495){if(_0x367e65[_0xea54('0x62')]['id']){delete _0x367e65[_0xea54('0x62')]['id'];}return db[_0xea54('0x46')]['find']({'where':{'id':_0x367e65[_0xea54('0x5d')]['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x5e966e,null))[_0xea54('0x23')](function(_0x28f738){if(_0x28f738){_0x367e65[_0xea54('0x62')][_0xea54('0x69')]=_0x28f738['id'];return db[_0xea54('0x6a')][_0xea54('0x61')](_0x367e65['body']);}})[_0xea54('0x23')](respondWithResult(_0x5e966e,null))['catch'](handleError(_0x5e966e,null));};exports[_0xea54('0x6b')]=function(_0x15bb47,_0x1e7005,_0xc2168a){var _0xf015fb={'raw':![],'where':{}};var _0x2258e4={};var _0x53c8c2={'count':0x0,'rows':[]};return db['SmsAccount'][_0xea54('0x6c')]({'where':{'id':_0x15bb47['params']['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x1e7005,null))[_0xea54('0x23')](function(_0x311c02){if(_0x311c02){_0x2258e4[_0xea54('0x48')]=_[_0xea54('0x4a')](db[_0xea54('0x6a')][_0xea54('0x5f')]);_0x2258e4[_0xea54('0x49')]=_[_0xea54('0x4a')](_0x15bb47[_0xea54('0x49')]);_0x2258e4[_0xea54('0x4b')]=_[_0xea54('0x4d')](_0x2258e4[_0xea54('0x48')],_0x2258e4[_0xea54('0x49')]);_0xf015fb[_0xea54('0x4c')]=_['intersection'](_0x2258e4[_0xea54('0x48')],qs[_0xea54('0x4e')](_0x15bb47[_0xea54('0x49')][_0xea54('0x4e')]));_0xf015fb[_0xea54('0x4c')]=_0xf015fb['attributes'][_0xea54('0x4f')]?_0xf015fb['attributes']:_0x2258e4[_0xea54('0x48')];if(!_0x15bb47['query']['hasOwnProperty']('nolimit')){_0xf015fb['limit']=qs[_0xea54('0x32')](_0x15bb47[_0xea54('0x49')][_0xea54('0x32')]);_0xf015fb[_0xea54('0x35')]=qs[_0xea54('0x35')](_0x15bb47[_0xea54('0x49')][_0xea54('0x35')]);}_0xf015fb[_0xea54('0x6d')]=qs[_0xea54('0x51')](_0x15bb47[_0xea54('0x49')][_0xea54('0x51')]);_0xf015fb[_0xea54('0x52')]=qs[_0xea54('0x4b')](_[_0xea54('0x53')](_0x15bb47[_0xea54('0x49')],_0x2258e4['filters']));_0xf015fb[_0xea54('0x52')]['SmsAccountId']=_0x311c02['id'];if(_0x15bb47[_0xea54('0x49')][_0xea54('0x54')]){_0xf015fb[_0xea54('0x52')]=_[_0xea54('0x55')](_0xf015fb['where'],{'$or':_['map'](_0xf015fb[_0xea54('0x4c')],function(_0xa29c95){var _0x11651b={};_0x11651b[_0xa29c95]={'$like':'%'+_0x15bb47[_0xea54('0x49')][_0xea54('0x54')]+'%'};return _0x11651b;})});}_0xf015fb=_['merge']({},_0xf015fb,_0x15bb47[_0xea54('0x58')]);return db[_0xea54('0x6a')][_0xea54('0x34')]({'where':_0xf015fb[_0xea54('0x52')]})[_0xea54('0x23')](function(_0x27d0d1){_0x53c8c2[_0xea54('0x34')]=_0x27d0d1;if(_0x15bb47[_0xea54('0x49')]['includeAll']){_0xf015fb['include']=[{'all':!![]}];}return db[_0xea54('0x6a')][_0xea54('0x5b')](_0xf015fb);})[_0xea54('0x23')](function(_0x2ef0f0){_0x53c8c2[_0xea54('0x6e')]=_0x2ef0f0;return _0x53c8c2;});}})[_0xea54('0x23')](respondWithFilteredResult(_0x1e7005,_0xf015fb))[_0xea54('0x2d')](handleError(_0x1e7005,null));};exports[_0xea54('0x6f')]=function(_0x141cb0,_0x3d8ec4,_0x219b79){return db[_0xea54('0x46')]['find']({'where':{'id':_0x141cb0['params']['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x3d8ec4,null))['then'](function(_0x269e9b){if(_0x269e9b){return _0x269e9b[_0xea54('0x6f')](_0x141cb0[_0xea54('0x49')]['ids']);}})[_0xea54('0x23')](respondWithStatusCode(_0x3d8ec4,null))['catch'](handleError(_0x3d8ec4,null));};exports[_0xea54('0x70')]=function(_0x574c9d,_0x492540,_0x1850ae){if(_0x574c9d[_0xea54('0x62')]['id']){delete _0x574c9d[_0xea54('0x62')]['id'];}return db['SmsAccount'][_0xea54('0x60')]({'where':{'id':_0x574c9d[_0xea54('0x5d')]['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x492540,null))[_0xea54('0x23')](function(_0x37db16){if(_0x37db16){_0x574c9d['body'][_0xea54('0x69')]=_0x37db16['id'];return db[_0xea54('0x71')][_0xea54('0x61')](_0x574c9d[_0xea54('0x62')]);}})[_0xea54('0x23')](respondWithResult(_0x492540,null))[_0xea54('0x2d')](handleError(_0x492540,null));};exports[_0xea54('0x72')]=function(_0x3dd8b8,_0x8d567e,_0x5569a9){var _0xd09e3f={'raw':![],'where':{}};var _0xfdcf34={};var _0x3d3dcd={'count':0x0,'rows':[]};return db[_0xea54('0x46')][_0xea54('0x6c')]({'where':{'id':_0x3dd8b8['params']['id']}})['then'](handleEntityNotFound(_0x8d567e,null))['then'](function(_0x3a8d3c){if(_0x3a8d3c){_0xfdcf34[_0xea54('0x48')]=_[_0xea54('0x4a')](db[_0xea54('0x71')][_0xea54('0x5f')]);_0xfdcf34[_0xea54('0x49')]=_[_0xea54('0x4a')](_0x3dd8b8[_0xea54('0x49')]);_0xfdcf34[_0xea54('0x4b')]=_[_0xea54('0x4d')](_0xfdcf34['model'],_0xfdcf34[_0xea54('0x49')]);_0xd09e3f['attributes']=_[_0xea54('0x4d')](_0xfdcf34[_0xea54('0x48')],qs[_0xea54('0x4e')](_0x3dd8b8[_0xea54('0x49')][_0xea54('0x4e')]));_0xd09e3f[_0xea54('0x4c')]=_0xd09e3f[_0xea54('0x4c')][_0xea54('0x4f')]?_0xd09e3f[_0xea54('0x4c')]:_0xfdcf34[_0xea54('0x48')];if(!_0x3dd8b8[_0xea54('0x49')][_0xea54('0x73')](_0xea54('0x50'))){_0xd09e3f[_0xea54('0x32')]=qs[_0xea54('0x32')](_0x3dd8b8[_0xea54('0x49')][_0xea54('0x32')]);_0xd09e3f[_0xea54('0x35')]=qs[_0xea54('0x35')](_0x3dd8b8[_0xea54('0x49')]['offset']);}_0xd09e3f[_0xea54('0x6d')]=qs[_0xea54('0x51')](_0x3dd8b8['query'][_0xea54('0x51')]);_0xd09e3f[_0xea54('0x52')]=qs['filters'](_['pick'](_0x3dd8b8[_0xea54('0x49')],_0xfdcf34['filters']));_0xd09e3f['where'][_0xea54('0x69')]=_0x3a8d3c['id'];if(_0x3dd8b8['query'][_0xea54('0x54')]){_0xd09e3f[_0xea54('0x52')]=_[_0xea54('0x55')](_0xd09e3f[_0xea54('0x52')],{'$or':_[_0xea54('0x45')](_0xd09e3f['attributes'],function(_0x57bc02){var _0x53b472={};_0x53b472[_0x57bc02]={'$like':'%'+_0x3dd8b8[_0xea54('0x49')][_0xea54('0x54')]+'%'};return _0x53b472;})});}_0xd09e3f=_[_0xea54('0x55')]({},_0xd09e3f,_0x3dd8b8[_0xea54('0x58')]);return db[_0xea54('0x71')]['count']({'where':_0xd09e3f['where']})[_0xea54('0x23')](function(_0x2641e3){_0x3d3dcd['count']=_0x2641e3;if(_0x3dd8b8[_0xea54('0x49')]['includeAll']){_0xd09e3f['include']=[{'all':!![]}];}return db[_0xea54('0x71')]['findAll'](_0xd09e3f);})[_0xea54('0x23')](function(_0xe40001){_0x3d3dcd[_0xea54('0x6e')]=_0xe40001;return _0x3d3dcd;});}})[_0xea54('0x23')](respondWithFilteredResult(_0x8d567e,_0xd09e3f))['catch'](handleError(_0x8d567e,null));};exports[_0xea54('0x74')]=function(_0x4e7239,_0x4fb6c3,_0x1e3224){return db[_0xea54('0x46')][_0xea54('0x60')]({'where':{'id':_0x4e7239[_0xea54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4fb6c3,null))[_0xea54('0x23')](function(_0x44ec92){if(_0x44ec92){return _0x44ec92[_0xea54('0x74')](_0x4e7239[_0xea54('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x4fb6c3,null))['catch'](handleError(_0x4fb6c3,null));};exports[_0xea54('0x75')]=function(_0x1aabe1,_0x4b13ea,_0x18e245){var _0xb1705f={'channel':'sms'};var _0x57d915=[];var _0x23d88d=[];var _0x547551={};return db[_0xea54('0x46')][_0xea54('0x60')]({'where':{'id':_0x1aabe1['params']['id']},'include':[{'model':db[_0xea54('0x76')],'as':_0xea54('0x77')}]})['then'](handleEntityNotFound(_0x4b13ea,null))['then'](function(_0x194041){_0xb1705f['account']=_0x194041;_0xb1705f['applications']=_['orderBy'](_0x194041[_0xea54('0x77')],[_0xea54('0x78')],[_0xea54('0x79')]);if(_0xb1705f[_0xea54('0x7a')][_0xea54('0x77')]){delete _0xb1705f[_0xea54('0x7a')][_0xea54('0x77')];}return db['CmContact'][_0xea54('0x68')]();})['then'](function(_0x57605f){if(!_0x57605f){throw new db[(_0xea54('0x7b'))][(_0xea54('0x7c'))](_0xea54('0x7d'));}_0x57d915=_[_0xea54('0x7e')](_[_0xea54('0x4a')](_0x57605f),[_0xea54('0x7f'),_0xea54('0x80')]);_0x23d88d=_['difference'](_[_0xea54('0x4a')](_0x57605f),['createdAt',_0xea54('0x80'),'CompanyId',_0xea54('0x81')]);_0xb1705f[_0xea54('0x62')]={'mapKey':_0xea54('0x82')};if(_0xb1705f['account']['type']){switch(_0xb1705f[_0xea54('0x7a')]['type']){case'twilio':_0xb1705f['body']['from']=_0x1aabe1[_0xea54('0x62')][_0xea54('0x83')];_0xb1705f['body'][_0xea54('0x62')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x84')];_0xb1705f[_0xea54('0x62')]['messageId']=_0x1aabe1['body'][_0xea54('0x85')];break;case _0xea54('0x86'):_0xb1705f[_0xea54('0x62')]['from']='+'+_0x1aabe1['body'][_0xea54('0x87')];_0xb1705f[_0xea54('0x62')][_0xea54('0x62')]=_0x1aabe1['body'][_0xea54('0x88')];break;case _0xea54('0x89'):_0xb1705f['body'][_0xea54('0x8a')]=_0x1aabe1[_0xea54('0x62')]['from'];_0xb1705f[_0xea54('0x62')][_0xea54('0x62')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x2c')];break;case'clicksend':_0xb1705f[_0xea54('0x62')][_0xea54('0x8a')]=_0x1aabe1['body'][_0xea54('0x8a')];_0xb1705f[_0xea54('0x62')]['body']=_0x1aabe1[_0xea54('0x62')]['body'];_0xb1705f['body']['messageId']=_0x1aabe1['body'][_0xea54('0x8b')];break;case'plivo':_0xb1705f[_0xea54('0x62')][_0xea54('0x8a')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x83')];_0xb1705f[_0xea54('0x62')]['body']=_0x1aabe1[_0xea54('0x62')]['Text'];_0xb1705f[_0xea54('0x62')][_0xea54('0x8c')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x8d')];break;case _0xea54('0x8e'):_0xb1705f[_0xea54('0x62')]['from']='+'+_0x1aabe1[_0xea54('0x62')]['results'][0x0][_0xea54('0x8a')];_0xb1705f['body'][_0xea54('0x62')]=_0x1aabe1['body']['results'][0x0][_0xea54('0x88')];_0xb1705f['body'][_0xea54('0x8c')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x8f')][0x0][_0xea54('0x8c')];break;case'csc':_0xb1705f[_0xea54('0x62')][_0xea54('0x8a')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x90')];_0xb1705f['body'][_0xea54('0x62')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x91')][_0xea54('0x2c')];break;case _0xea54('0x92'):_0xb1705f[_0xea54('0x62')][_0xea54('0x8a')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x93')];_0xb1705f[_0xea54('0x62')][_0xea54('0x62')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x88')];_0xb1705f[_0xea54('0x62')][_0xea54('0x8c')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x94')];break;case _0xea54('0x95'):_0xb1705f[_0xea54('0x62')][_0xea54('0x8c')]=_0x1aabe1[_0xea54('0x62')][0x0][_0xea54('0x2c')]['id'];_0xb1705f[_0xea54('0x62')]['from']=_0x1aabe1[_0xea54('0x62')][0x0]['message'][_0xea54('0x8a')];_0xb1705f[_0xea54('0x62')][_0xea54('0x62')]=_0x1aabe1[_0xea54('0x62')][0x0][_0xea54('0x2c')][_0xea54('0x88')];break;case _0xea54('0x96'):_0xb1705f[_0xea54('0x62')][_0xea54('0x8a')]=_0x1aabe1['body'][_0xea54('0x8a')];_0xb1705f[_0xea54('0x62')][_0xea54('0x62')]=_0x1aabe1['body'][_0xea54('0x2c')];_0xb1705f[_0xea54('0x62')][_0xea54('0x8c')]=_0x1aabe1[_0xea54('0x62')][_0xea54('0x97')];break;}}if(_0xb1705f[_0xea54('0x62')]['id']){delete _0xb1705f[_0xea54('0x62')]['id'];}if(_[_0xea54('0x98')](_0xb1705f[_0xea54('0x62')][_0xea54('0x8a')])){throw new db[(_0xea54('0x7b'))][(_0xea54('0x7c'))](_0xea54('0x99'));}if(_[_0xea54('0x98')](_0xb1705f[_0xea54('0x62')]['body'])||_0xb1705f[_0xea54('0x62')][_0xea54('0x62')]===''){throw new db[(_0xea54('0x7b'))][(_0xea54('0x7c'))](_0xea54('0x9a'));}if(_[_0xea54('0x98')](_0xb1705f[_0xea54('0x62')][_0xea54('0x9b')])){throw new db['Sequelize']['ValidationError'](_0xea54('0x9c')+_0x23d88d);}if(!_['includes'](_0x23d88d,_0xb1705f[_0xea54('0x62')][_0xea54('0x9b')])){throw new db[(_0xea54('0x7b'))][(_0xea54('0x7c'))](_0xea54('0x9d')+_0x23d88d);}_0x547551[_0xb1705f[_0xea54('0x62')]['mapKey']]=_0xb1705f[_0xea54('0x62')][_0xea54('0x8a')];return db['CmList'][_0xea54('0x60')]({'where':{'id':_0xb1705f['account'][_0xea54('0x81')]},'include':[{'model':db['CmContact'],'as':_0xea54('0x9e'),'where':_0x547551,'limit':0x1,'order':[[_0xea54('0x80'),_0xea54('0x9f')]]}]});})[_0xea54('0x23')](handleEntityNotFound(_0x4b13ea,null))[_0xea54('0x23')](function(_0x8498e2){if(_0x8498e2){_0xb1705f[_0xea54('0xa0')]=_['omit'](_0x8498e2,[_0xea54('0x9e')]);if(_0x8498e2[_0xea54('0x9e')]['length']){return _0x8498e2[_0xea54('0x9e')][0x0];}var _0xc1fb0f=_[_0xea54('0xa1')](_0xb1705f['body'],{'firstName':_0xb1705f[_0xea54('0x62')][_0xea54('0x8a')],'ListId':_0x8498e2['id']});_0xc1fb0f[_0xb1705f[_0xea54('0x62')][_0xea54('0x9b')]]=_0xb1705f[_0xea54('0x62')]['from'];return db[_0xea54('0xa2')][_0xea54('0x61')](_0xc1fb0f,{'fields':_0x57d915,'raw':!![]});}})[_0xea54('0x23')](handleEntityNotFound(_0x4b13ea,null))[_0xea54('0x23')](function(_0x368cd0){if(_0x368cd0){_0xb1705f[_0xea54('0xa3')]=_0x368cd0;var _0x3f7d5a={'ContactId':_0x368cd0['id'],'phone':_0xb1705f[_0xea54('0x62')]['from'],'SmsAccountId':_0x1aabe1[_0xea54('0x5d')]['id']};var _0x3b92a0={'ContactId':_0x368cd0['id'],'SmsAccountId':_0x1aabe1[_0xea54('0x5d')]['id'],'closed':![]};return db[_0xea54('0xa4')]['find']({'where':_0x3b92a0})[_0xea54('0x23')](function(_0x4fbed3){if(_0x4fbed3){return[_0x4fbed3,![]];}return db[_0xea54('0xa4')]['create'](_0x3f7d5a)[_0xea54('0x23')](function(_0x3e6dbd){return[_0x3e6dbd,!![]];});});}})[_0xea54('0xa5')](function(_0xe5a716,_0x53fca1){_0xb1705f['interaction']=_0xe5a716[_0xea54('0x3c')]({'plain':!![]});_0xb1705f[_0xea54('0xa6')][_0xea54('0xa7')]=![];if(_0x53fca1){if(_0xb1705f[_0xea54('0x7a')][_0xea54('0xa8')]){_0xb1705f['applications'][_0xea54('0xa9')]({'id':0x0,'priority':_0xb1705f[_0xea54('0xaa')]['length']+0x1,'app':_0xea54('0xab'),'appdata':_0xea54('0xac'),'interval':'*,*,*,*'});}_0xb1705f[_0xea54('0xa6')][_0xea54('0xa7')]=!![];}return db['SmsMessage'][_0xea54('0x61')]({'phone':_0xb1705f['body']['from'],'messageId':_0xb1705f['body'][_0xea54('0x8c')],'body':_0xb1705f['body'][_0xea54('0x62')],'SmsAccountId':_0x1aabe1[_0xea54('0x5d')]['id'],'SmsInteractionId':_0xe5a716['id'],'direction':'in','ContactId':_0xe5a716['ContactId'],'AttachmentId':_0xb1705f[_0xea54('0x62')][_0xea54('0xad')]});})[_0xea54('0x23')](function(_0x3949ae){_0xb1705f[_0xea54('0x2c')]=_0x3949ae;if(_0xb1705f[_0xea54('0xa6')]['UserId']){return db[_0xea54('0xae')][_0xea54('0x60')]({'attributes':['id',_0xea54('0x41')],'where':{'id':_0xb1705f[_0xea54('0xa6')][_0xea54('0xaf')]}})[_0xea54('0x23')](function(_0x429c67){if(_0x429c67){_0xb1705f[_0xea54('0xaa')][_0xea54('0xb0')]({'id':0x0,'priority':0x0,'app':_0xea54('0xb1'),'appdata':_0x429c67['name']+','+(_0xb1705f[_0xea54('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':_0xea54('0xb2')});}return respondWithRpcPromise('Start',_0xea54('0xb3'),_0xb1705f);});}return respondWithRpcPromise(_0xea54('0xb4'),_0xea54('0xb3'),_0xb1705f);})['then'](function(_0x2e4f6a){if(_0x2e4f6a){var _0x109245=0xc8;var _0x44dd61=_0xea54('0xb5');logger['info'](_0xea54('0x27'),_0x44dd61,_0x109245,_0xea54('0xb6'));logger[_0xea54('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x44dd61,_0x109245,_0xea54('0xb6'),JSON['stringify'](_0x2e4f6a));if(_0xb1705f[_0xea54('0x7a')]['type']===_0xea54('0xb7')){return _0x4b13ea[_0xea54('0x2f')](_0x109245)[_0xea54('0x36')](_0xea54('0xb8'),'text/xml')['send']('\x0a');}else{return _0x4b13ea['status'](_0x109245)[_0xea54('0x31')](_0x2e4f6a);}}})[_0xea54('0x2d')](handleError(_0x4b13ea,null));};exports[_0xea54('0xb9')]=function(_0x3da9f2,_0x462066,_0x30d562){return db[_0xea54('0x46')][_0xea54('0x6c')]({'where':{'id':_0x3da9f2[_0xea54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x462066,null))[_0xea54('0x23')](function(_0x2ee68e){if(_0x2ee68e){return db['sequelize'][_0xea54('0xba')](function(_0x4aff99){return db[_0xea54('0x76')][_0xea54('0x3f')]({'where':{'SmsAccountId':_0x3da9f2[_0xea54('0x5d')]['id']},'transaction':_0x4aff99})['then'](function(_0x5c986a){var _0x129784=_['map'](_0x3da9f2[_0xea54('0x62')],function(_0x2ba5ef){_0x2ba5ef[_0xea54('0x69')]=_0x3da9f2[_0xea54('0x5d')]['id'];return _0x2ba5ef;});return db[_0xea54('0x76')][_0xea54('0xbb')](_0x129784,{'transaction':_0x4aff99});});})['then'](function(){return db[_0xea54('0x76')][_0xea54('0xbc')]({'where':{'SmsAccountId':_0x3da9f2['params']['id']},'order':_0xea54('0x78')});});}})['then'](respondWithResult(_0x462066,null))[_0xea54('0x2d')](handleError(_0x462066,null));};exports[_0xea54('0xbd')]=function(_0x32a5a3,_0x3b3a4a,_0x4f8d15){var _0x194942={};var _0x40b753={};var _0x4217cd;var _0x2e1d3c;return db[_0xea54('0x46')][_0xea54('0x6c')]({'where':{'id':_0x32a5a3[_0xea54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3b3a4a,null))[_0xea54('0x23')](function(_0x2c5d84){if(_0x2c5d84){_0x4217cd=_0x2c5d84;_0x40b753['model']=_[_0xea54('0x4a')](db[_0xea54('0x76')][_0xea54('0x5f')]);_0x40b753[_0xea54('0x49')]=_['keys'](_0x32a5a3[_0xea54('0x49')]);_0x40b753['filters']=_[_0xea54('0x4d')](_0x40b753[_0xea54('0x48')],_0x40b753[_0xea54('0x49')]);_0x194942[_0xea54('0x4c')]=_[_0xea54('0x4d')](_0x40b753[_0xea54('0x48')],qs[_0xea54('0x4e')](_0x32a5a3['query']['fields']));_0x194942[_0xea54('0x4c')]=_0x194942['attributes'][_0xea54('0x4f')]?_0x194942['attributes']:_0x40b753['model'];_0x194942[_0xea54('0x6d')]=qs[_0xea54('0x51')](_0x32a5a3[_0xea54('0x49')][_0xea54('0x51')]);_0x194942[_0xea54('0x52')]=qs[_0xea54('0x4b')](_[_0xea54('0x53')](_0x32a5a3[_0xea54('0x49')],_0x40b753[_0xea54('0x4b')]));if(_0x32a5a3['query'][_0xea54('0x54')]){_0x194942[_0xea54('0x52')]=_[_0xea54('0x55')](_0x194942['where'],{'$or':_[_0xea54('0x45')](_0x194942[_0xea54('0x4c')],function(_0x14cbf7){var _0x2c6ec7={};_0x2c6ec7[_0x14cbf7]={'$like':'%'+_0x32a5a3[_0xea54('0x49')][_0xea54('0x54')]+'%'};return _0x2c6ec7;})});}_0x194942=_[_0xea54('0x55')]({},_0x194942,_0x32a5a3[_0xea54('0x58')]);return _0x4217cd[_0xea54('0xbd')](_0x194942);}})[_0xea54('0x23')](function(_0x442d7b){if(_0x442d7b){_0x2e1d3c=_0x442d7b['length'];if(!_0x32a5a3[_0xea54('0x49')][_0xea54('0x73')](_0xea54('0x50'))){_0x194942[_0xea54('0x32')]=qs[_0xea54('0x32')](_0x32a5a3[_0xea54('0x49')][_0xea54('0x32')]);_0x194942[_0xea54('0x35')]=qs[_0xea54('0x35')](_0x32a5a3[_0xea54('0x49')][_0xea54('0x35')]);}return _0x4217cd[_0xea54('0xbd')](_0x194942);}})['then'](function(_0x309c33){if(_0x309c33){return _0x309c33?{'count':_0x2e1d3c,'rows':_0x309c33}:null;}})[_0xea54('0x23')](respondWithResult(_0x3b3a4a,null))[_0xea54('0x2d')](handleError(_0x3b3a4a,null));};exports[_0xea54('0xbe')]=function(_0x58bae1,_0x2da3cc,_0x58183c){var _0x579eb8={'raw':![],'where':{}};var _0x18e652={};var _0x153862={'count':0x0,'rows':[]};return db[_0xea54('0x46')][_0xea54('0x6c')]({'where':{'id':_0x58bae1[_0xea54('0x5d')]['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x2da3cc,null))[_0xea54('0x23')](function(_0x3c3396){if(_0x3c3396){_0x18e652[_0xea54('0x48')]=_[_0xea54('0x4a')](db[_0xea54('0xa4')]['rawAttributes']);_0x18e652['query']=_[_0xea54('0x4a')](_0x58bae1[_0xea54('0x49')]);_0x18e652[_0xea54('0x4b')]=_[_0xea54('0x4d')](_0x18e652['model'],_0x18e652[_0xea54('0x49')]);_0x579eb8[_0xea54('0x4c')]=_[_0xea54('0x4d')](_0x18e652[_0xea54('0x48')],qs[_0xea54('0x4e')](_0x58bae1[_0xea54('0x49')][_0xea54('0x4e')]));_0x579eb8[_0xea54('0x4c')]=_0x579eb8['attributes'][_0xea54('0x4f')]?_0x579eb8[_0xea54('0x4c')]:_0x18e652['model'];if(!_0x58bae1['query']['hasOwnProperty'](_0xea54('0x50'))){_0x579eb8[_0xea54('0x32')]=qs[_0xea54('0x32')](_0x58bae1[_0xea54('0x49')][_0xea54('0x32')]);_0x579eb8[_0xea54('0x35')]=qs[_0xea54('0x35')](_0x58bae1[_0xea54('0x49')][_0xea54('0x35')]);}_0x579eb8[_0xea54('0x6d')]=qs[_0xea54('0x51')](_0x58bae1[_0xea54('0x49')][_0xea54('0x51')]);_0x579eb8[_0xea54('0x52')]=qs[_0xea54('0x4b')](_['pick'](_0x58bae1[_0xea54('0x49')],_0x18e652[_0xea54('0x4b')]));_0x579eb8[_0xea54('0x52')][_0xea54('0x69')]=_0x3c3396['id'];if(_0x58bae1[_0xea54('0x49')][_0xea54('0x54')]){_0x579eb8[_0xea54('0x52')]=_[_0xea54('0x55')](_0x579eb8[_0xea54('0x52')],{'$or':_['map'](_0x579eb8['attributes'],function(_0x58b20c){var _0x3453da={};_0x3453da[_0x58b20c]={'$like':'%'+_0x58bae1['query']['filter']+'%'};return _0x3453da;})});}_0x579eb8=_[_0xea54('0x55')]({},_0x579eb8,_0x58bae1[_0xea54('0x58')]);return db[_0xea54('0xa4')][_0xea54('0x34')]({'where':_0x579eb8[_0xea54('0x52')]})[_0xea54('0x23')](function(_0x51e723){_0x153862[_0xea54('0x34')]=_0x51e723;if(_0x58bae1[_0xea54('0x49')][_0xea54('0x59')]){_0x579eb8[_0xea54('0x5a')]=[{'model':db[_0xea54('0xa2')],'as':_0xea54('0xbf'),'required':![]},{'model':db[_0xea54('0xae')],'as':'Owner','attributes':[_0xea54('0x41'),_0xea54('0xc0'),_0xea54('0xc1')],'required':![]},{'model':db[_0xea54('0xc2')],'as':_0xea54('0xc3'),'attributes':['id',_0xea54('0x41'),_0xea54('0xc4')],'where':_0x58bae1[_0xea54('0x49')][_0xea54('0xc5')]?{'id':_0x58bae1[_0xea54('0x49')]['tag']}:undefined,'required':_0x58bae1[_0xea54('0x49')][_0xea54('0xc5')]?!![]:![]}];}return db[_0xea54('0xa4')]['findAll'](_0x579eb8);})[_0xea54('0x23')](function(_0x27a80f){_0x153862['rows']=_0x27a80f;return _0x153862;});}})[_0xea54('0x23')](respondWithFilteredResult(_0x2da3cc,_0x579eb8))[_0xea54('0x2d')](handleError(_0x2da3cc,null));};exports[_0xea54('0x42')]=function(_0x4d5845,_0x156ab9,_0x1518c1){var _0x7458dd,_0x2080d0,_0x1f7dc2;if(_[_0xea54('0x98')](_0x4d5845['body'][_0xea54('0x62')])||_0x4d5845[_0xea54('0x62')]['body']===''){throw new db[(_0xea54('0x7b'))]['ValidationError'](_0xea54('0x9a'));}if(_['isNil'](_0x4d5845['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xea54('0xc6'));}_0x7458dd=_0x4d5845[_0xea54('0x62')]['to'];return db[_0xea54('0x46')][_0xea54('0x60')]({'where':{'id':_0x4d5845[_0xea54('0x5d')]['id']},'include':[{'model':db[_0xea54('0xc7')],'as':_0xea54('0xc8'),'include':[{'model':db[_0xea54('0xa2')],'as':_0xea54('0x9e'),'where':{'mobile':_0x7458dd},'limit':0x1,'order':[[_0xea54('0x80'),_0xea54('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x156ab9,null))['then'](function(_0x371806){if(_0x371806&&_0x371806[_0xea54('0xc8')]){_0x2080d0=_0x371806[_0xea54('0x3c')]({'plain':!![]});if(_0x2080d0['List']&&_0x2080d0[_0xea54('0xc8')][_0xea54('0x9e')][_0xea54('0x4f')]){return _0x2080d0[_0xea54('0xc8')]['Contacts'][0x0];}return db[_0xea54('0xa2')][_0xea54('0x61')](_[_0xea54('0xa1')](_0x4d5845[_0xea54('0x62')],{'firstName':_0x7458dd,'mobile':_0x7458dd,'phone':_0x7458dd,'ListId':_0x2080d0[_0xea54('0x81')]}));}})[_0xea54('0x23')](handleEntityNotFound(_0x156ab9,null))[_0xea54('0x23')](function(_0x5876a5){if(_0x5876a5){_0x1f7dc2=_0x5876a5;return db[_0xea54('0xa4')][_0xea54('0x60')]({'where':{'ContactId':_0x1f7dc2['id'],'closed':![],'SmsAccountId':_0x2080d0['id']}})[_0xea54('0x23')](function(_0x5efe49){if(_0x5efe49){return[_0x5efe49,![]];}return db['SmsInteraction'][_0xea54('0x61')]({'UserId':_0x4d5845[_0xea54('0x63')]['id'],'ContactId':_0x1f7dc2['id'],'SmsAccountId':_0x2080d0['id'],'phone':_0x7458dd,'firstMsgDirection':_0xea54('0xc9'),'Messages':[_[_0xea54('0x55')](_0x4d5845[_0xea54('0x62')],{'read':![],'body':_0x4d5845[_0xea54('0x62')][_0xea54('0x62')],'phone':_0x7458dd,'SmsAccountId':_0x2080d0['id'],'UserId':_0x4d5845['user']['id'],'ContactId':_0x1f7dc2['id']})]},{'include':[{'model':db[_0xea54('0xca')],'as':'Messages'}]})[_0xea54('0x23')](function(_0x1b6008){return[_0x1b6008,!![]];});});}})[_0xea54('0xa5')](function(_0x4d03ad,_0x2792cb){if(_0x2792cb){return _0x4d03ad;}return db[_0xea54('0xca')][_0xea54('0x61')](_['merge'](_0x4d5845[_0xea54('0x62')],{'read':![],'body':_0x4d5845[_0xea54('0x62')][_0xea54('0x62')],'phone':_0x7458dd,'SmsAccountId':_0x2080d0['id'],'SmsInteractionId':_0x4d03ad['id'],'UserId':_0x4d5845['user']['id'],'ContactId':_0x1f7dc2['id']}))[_0xea54('0x23')](function(_0x3f9f6b){_0x4d03ad[_0xea54('0xcb')][_0xea54('0xcc')]=[];_0x4d03ad[_0xea54('0xcb')][_0xea54('0xcc')][_0xea54('0xa9')](_0x3f9f6b[_0xea54('0xcb')]);return _0x4d03ad;});})[_0xea54('0x23')](respondWithResult(_0x156ab9,null))[_0xea54('0x2d')](handleError(_0x156ab9,null));};exports['status']=function(_0x8020a,_0x32f9e6,_0x5672d9){if(_0x8020a['body']['id']){delete _0x8020a[_0xea54('0x62')]['id'];}var _0x51cb14,_0x5ec2bd,_0x931588;return db['SmsAccount'][_0xea54('0x60')]({'where':{'id':_0x8020a[_0xea54('0x5d')]['id']}})['then'](handleEntityNotFound(_0x32f9e6,null))['then'](function(_0x279ab0){if(_0x279ab0){_0x931588=_0x279ab0;logger[_0xea54('0x26')](_0xea54('0x27'),_0xea54('0x2f'),_0xea54('0xcd'),_0x279ab0['type'],util[_0xea54('0xce')](_0x8020a['body'],{'showHidden':![],'depth':null}));switch(_0x279ab0[_0xea54('0x56')]){case _0xea54('0x86'):if(_0x8020a[_0xea54('0x62')][_0xea54('0xcf')]&&_0x8020a[_0xea54('0x62')]['status']){_0x5ec2bd=_0x8020a[_0xea54('0x62')][_0xea54('0x2f')];return db[_0xea54('0xca')]['find']({'where':{'messageId':_0x8020a[_0xea54('0x62')][_0xea54('0xcf')]}});}break;case _0xea54('0x89'):if(_0x8020a[_0xea54('0x62')][_0xea54('0xd0')]&&_0x8020a['body'][_0xea54('0xd1')]){_0x5ec2bd=_0x8020a[_0xea54('0x62')][_0xea54('0xd1')];return db[_0xea54('0xca')]['find']({'where':{'messageId':_0x8020a[_0xea54('0x62')][_0xea54('0xd0')]}});}break;case'clicksend':if(_0x8020a[_0xea54('0x62')][_0xea54('0x8b')]&&_0x8020a[_0xea54('0x62')][_0xea54('0xd2')]){_0x5ec2bd=_0x8020a['body'][_0xea54('0xd2')];return db[_0xea54('0xca')]['find']({'where':{'messageId':_0x8020a[_0xea54('0x62')][_0xea54('0x8b')]}});}break;case'infobip':var _0x3aefbf=_0x8020a[_0xea54('0x62')][_0xea54('0x8f')][0x0];if(_0x3aefbf[_0xea54('0x8c')]&&_0x3aefbf[_0xea54('0x2f')][_0xea54('0xd3')]===_0xea54('0xd4')){_0x5ec2bd=_0x3aefbf['status']['groupName'];return db[_0xea54('0xca')][_0xea54('0x60')]({'where':{'messageId':_0x3aefbf[_0xea54('0x8c')]}});}break;case _0xea54('0x92'):if(_0x8020a['body'][_0xea54('0x8c')]&&_0x8020a[_0xea54('0x62')][_0xea54('0x2f')]){_0x5ec2bd=_0x8020a[_0xea54('0x62')][_0xea54('0x2f')];return db[_0xea54('0xca')][_0xea54('0x60')]({'where':{'messageId':_0x8020a[_0xea54('0x62')][_0xea54('0x8c')]}});}break;case _0xea54('0x95'):if(_0x8020a[_0xea54('0x62')][0x0]['message']['id']){_0x5ec2bd=_0x8020a[_0xea54('0x62')][0x0][_0xea54('0x56')];return db[_0xea54('0xca')][_0xea54('0x60')]({'where':{'messageId':_0x8020a['body'][0x0]['message']['id']}});}break;case _0xea54('0x96'):if(_0x8020a[_0xea54('0x62')][_0xea54('0xd5')]&&_0x8020a[_0xea54('0x62')][_0xea54('0x2f')]){_0x5ec2bd=_0x8020a[_0xea54('0x62')]['status'];return db[_0xea54('0xca')][_0xea54('0x60')]({'where':{'messageId':_0x8020a[_0xea54('0x62')][_0xea54('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x32f9e6,null))[_0xea54('0x23')](function(_0x4c3a80){if(_0x4c3a80){_0x51cb14=_0x4c3a80;switch(_0x931588[_0xea54('0x56')]){case _0xea54('0x86'):if(_0x5ec2bd===_0xea54('0xd4')){return _0x51cb14['update']({'read':!![]});}else{logger['error'](_0xea54('0x27'),_0xea54('0x2f'),_0xea54('0x86'),util[_0xea54('0xce')](_0x8020a[_0xea54('0x62')],{'showHidden':![],'depth':null}));}break;case _0xea54('0x89'):if(_0x5ec2bd==='1'){return _0x51cb14[_0xea54('0x3b')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xea54('0xce')](_0x8020a[_0xea54('0x62')],{'showHidden':![],'depth':null}));}break;case _0xea54('0xd6'):if(!_0x8020a[_0xea54('0x62')]['error_code']&&_0x5ec2bd>=0xc8&&_0x5ec2bd<=0xce){return _0x51cb14[_0xea54('0x3b')]({'read':!![]});}else{logger[_0xea54('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea54('0x2f'),_0xea54('0xd6'),util[_0xea54('0xce')](_0x8020a[_0xea54('0x62')],{'showHidden':![],'depth':null}));}break;case _0xea54('0x8e'):var _0x4fb44f=_0x8020a[_0xea54('0x62')]['results'][0x0];if(_0x4fb44f[_0xea54('0x2f')]['groupName']===_0xea54('0xd4')){return _0x51cb14[_0xea54('0x3b')]({'read':!![]});}else{logger[_0xea54('0x2a')](_0xea54('0x27'),_0xea54('0x2f'),_0xea54('0x8e'),util[_0xea54('0xce')](_0x8020a['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5ec2bd==_0xea54('0xd7')||_0x5ec2bd==_0xea54('0xd8')){return _0x51cb14[_0xea54('0x3b')]({'read':!![]});}else{logger[_0xea54('0x2a')](_0xea54('0x27'),_0xea54('0x2f'),_0xea54('0x92'),util[_0xea54('0xce')](_0x8020a['body'],{'showHidden':![],'depth':null}));}break;case _0xea54('0x95'):if(_0x5ec2bd==_0xea54('0xd9')){return _0x51cb14[_0xea54('0x3b')]({'read':!![]});}else{logger[_0xea54('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea54('0x2f'),_0xea54('0x95'),util[_0xea54('0xce')](_0x8020a[_0xea54('0x62')],{'showHidden':![],'depth':null}));}break;case _0xea54('0x96'):if(_0x5ec2bd===_0xea54('0xda')||_0x5ec2bd===_0xea54('0xdb')){return _0x51cb14['update']({'read':!![]});}else{logger[_0xea54('0x2a')](_0xea54('0x27'),_0xea54('0x2f'),_0xea54('0x96'),util[_0xea54('0xce')](_0x8020a[_0xea54('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x51cb14;}})[_0xea54('0x23')](respondWithResult(_0x32f9e6,null))[_0xea54('0x2d')](handleError(_0x32f9e6,null));};exports[_0xea54('0xdc')]=function(_0x65d29a,_0x5409c3,_0x5de0f5){var _0x39e150,_0x246480,_0x15ea03;return db[_0xea54('0x46')]['find']({'where':{'id':_0x65d29a['params']['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x5409c3,null))[_0xea54('0x23')](function(_0x283109){if(_0x283109){_0x15ea03=_0x283109;logger[_0xea54('0x26')](_0xea54('0x27'),_0xea54('0x2f'),'received\x20delivery\x20report\x20from',_0x283109[_0xea54('0x56')],util[_0xea54('0xce')](_0x65d29a[_0xea54('0x49')],{'showHidden':![],'depth':null}));switch(_0x283109['type']){case _0xea54('0xdd'):if(_0x65d29a[_0xea54('0x49')]['message-id']&&_0x65d29a['query'][_0xea54('0xde')]){_0x246480=_0x65d29a[_0xea54('0x49')]['state'];return db[_0xea54('0xca')][_0xea54('0x60')]({'where':{'messageId':_0x65d29a[_0xea54('0x49')][_0xea54('0xdf')]}});}break;}}})['then'](handleEntityNotFound(_0x5409c3,null))[_0xea54('0x23')](function(_0x4ed561){if(_0x4ed561){_0x39e150=_0x4ed561;switch(_0x15ea03[_0xea54('0x56')]){case _0xea54('0xdd'):if(_0x246480==='2'||_0x246480==='6'){return _0x39e150[_0xea54('0x3b')]({'read':!![]});}else{logger[_0xea54('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea54('0x2f'),_0xea54('0xdd'),util['inspect'](_0x65d29a[_0xea54('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x39e150;}})[_0xea54('0x23')](respondWithResult(_0x5409c3,null))[_0xea54('0x2d')](handleError(_0x5409c3,null));};exports['addAgents']=function(_0x1482f9,_0x477a96,_0x2a62f8){return db[_0xea54('0x46')]['find']({'where':{'id':_0x1482f9['params']['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x477a96,null))[_0xea54('0x23')](function(_0x315655){if(_0x315655){return _0x315655['addAgents'](_0x1482f9[_0xea54('0x62')][_0xea54('0xe0')],_[_0xea54('0xe1')](_0x1482f9[_0xea54('0x62')],[_0xea54('0xe0'),'id'])||{})[_0xea54('0xa5')](function(_0x11a477){for(var _0x1d7063=0x0;_0x1d7063<_0x1482f9[_0xea54('0x62')][_0xea54('0xe0')][_0xea54('0x4f')];_0x1d7063+=0x1){socket[_0xea54('0xe2')]('userSmsAccount:save',{'UserId':Number(_0x1482f9['body'][_0xea54('0xe0')][_0x1d7063]),'SmsAccountId':Number(_0x1482f9[_0xea54('0x5d')]['id'])});}return _0x11a477;});}})[_0xea54('0x23')](respondWithResult(_0x477a96,null))[_0xea54('0x2d')](handleError(_0x477a96,null));};exports[_0xea54('0xe3')]=function(_0x433752,_0x3192af,_0x112d0f){return db['SmsAccount'][_0xea54('0x60')]({'where':{'id':_0x433752[_0xea54('0x5d')]['id']}})[_0xea54('0x23')](handleEntityNotFound(_0x3192af,null))[_0xea54('0x23')](function(_0x589e58){if(_0x589e58){return _0x589e58[_0xea54('0xe3')](_0x433752[_0xea54('0x49')][_0xea54('0xe0')])[_0xea54('0x23')](function(){if(_['isArray'](_0x433752[_0xea54('0x49')][_0xea54('0xe0')])){for(var _0x265a5b=0x0;_0x265a5b<_0x433752[_0xea54('0x49')][_0xea54('0xe0')][_0xea54('0x4f')];_0x265a5b+=0x1){socket['emit'](_0xea54('0xe4'),{'UserId':Number(_0x433752[_0xea54('0x49')]['ids'][_0x265a5b]),'SmsAccountId':Number(_0x433752[_0xea54('0x5d')]['id'])});}}else{socket[_0xea54('0xe2')](_0xea54('0xe4'),{'UserId':Number(_0x433752[_0xea54('0x49')][_0xea54('0xe0')]),'SmsAccountId':Number(_0x433752['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3192af,null))[_0xea54('0x2d')](handleError(_0x3192af,null));};exports[_0xea54('0xe5')]=function(_0x15169e,_0xc86560,_0x14777d){var _0x55caa0={};var _0x129d86={};var _0x10c1b6;var _0x1bf90b;return db[_0xea54('0x46')][_0xea54('0x6c')]({'where':{'id':_0x15169e[_0xea54('0x5d')]['id']}})['then'](handleEntityNotFound(_0xc86560,null))[_0xea54('0x23')](function(_0x58c1ba){if(_0x58c1ba){_0x10c1b6=_0x58c1ba;_0x129d86[_0xea54('0x48')]=_['keys'](db[_0xea54('0xae')][_0xea54('0x5f')]);_0x129d86[_0xea54('0x49')]=_[_0xea54('0x4a')](_0x15169e['query']);_0x129d86[_0xea54('0x4b')]=_[_0xea54('0x4d')](_0x129d86[_0xea54('0x48')],_0x129d86['query']);_0x55caa0[_0xea54('0x4c')]=_[_0xea54('0x4d')](_0x129d86[_0xea54('0x48')],qs[_0xea54('0x4e')](_0x15169e[_0xea54('0x49')]['fields']));_0x55caa0[_0xea54('0x4c')]=_0x55caa0['attributes']['length']?_0x55caa0[_0xea54('0x4c')]:_0x129d86[_0xea54('0x48')];_0x55caa0[_0xea54('0x6d')]=qs['sort'](_0x15169e['query']['sort']);_0x55caa0[_0xea54('0x52')]=qs['filters'](_[_0xea54('0x53')](_0x15169e['query'],_0x129d86[_0xea54('0x4b')]));if(_0x15169e[_0xea54('0x49')][_0xea54('0x54')]){_0x55caa0[_0xea54('0x52')]=_['merge'](_0x55caa0[_0xea54('0x52')],{'$or':_[_0xea54('0x45')](_0x55caa0[_0xea54('0x4c')],function(_0x3cf7fa){var _0x9bd429={};_0x9bd429[_0x3cf7fa]={'$like':'%'+_0x15169e[_0xea54('0x49')]['filter']+'%'};return _0x9bd429;})});}_0x55caa0=_[_0xea54('0x55')]({},_0x55caa0,_0x15169e[_0xea54('0x58')]);return _0x10c1b6['getAgents'](_0x55caa0);}})[_0xea54('0x23')](function(_0x316490){if(_0x316490){_0x1bf90b=_0x316490['length'];if(!_0x15169e[_0xea54('0x49')]['hasOwnProperty'](_0xea54('0x50'))){_0x55caa0[_0xea54('0x32')]=qs[_0xea54('0x32')](_0x15169e['query']['limit']);_0x55caa0[_0xea54('0x35')]=qs[_0xea54('0x35')](_0x15169e['query']['offset']);}return _0x10c1b6[_0xea54('0xe5')](_0x55caa0);}})[_0xea54('0x23')](function(_0x574343){if(_0x574343){return _0x574343?{'count':_0x1bf90b,'rows':_0x574343}:null;}})[_0xea54('0x23')](respondWithResult(_0xc86560,null))[_0xea54('0x2d')](handleError(_0xc86560,null));}; \ No newline at end of file +var _0x0d51=['client','http','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','sendStatus','stack','name','send','Pause','map','SmsAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','fields','catch','create','role','SmsAccounts','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','getDispositions','findOne','order','pick','removeDispositions','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','intelepeer','refid','isNil','ValidationError','includes','mapKey','CmList','ListId','CmContact','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','addApplications','bulkCreate','getApplications','Contact','User','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','SmsMessage','requestid','status_code','infobip','groupName','bandwidth','redif','inspect','error_code','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','ids','emit','removeAgents','userSmsAccount:remove','getAgents','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket'];(function(_0x5c65ee,_0x57b017){var _0x4b8689=function(_0x57dc88){while(--_0x57dc88){_0x5c65ee['push'](_0x5c65ee['shift']());}};_0x4b8689(++_0x57b017);}(_0x0d51,0xbd));var _0x10d5=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x0d51[_0x533e4e];return _0x1f14bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x10d5('0x0'));var rp=require(_0x10d5('0x1'));var moment=require('moment');var BPromise=require(_0x10d5('0x2'));var Mustache=require(_0x10d5('0x3'));var util=require(_0x10d5('0x4'));var path=require(_0x10d5('0x5'));var sox=require(_0x10d5('0x6'));var csv=require(_0x10d5('0x7'));var ejs=require(_0x10d5('0x8'));var fs=require('fs');var fs_extra=require(_0x10d5('0x9'));var _=require(_0x10d5('0xa'));var squel=require(_0x10d5('0xb'));var crypto=require(_0x10d5('0xc'));var jsforce=require(_0x10d5('0xd'));var deskjs=require(_0x10d5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x10d5('0xf'));var Papa=require(_0x10d5('0x10'));var Redis=require(_0x10d5('0x11'));var authService=require(_0x10d5('0x12'));var qs=require(_0x10d5('0x13'));var as=require(_0x10d5('0x14'));var hardwareService=require(_0x10d5('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x10d5('0x16'));var config=require(_0x10d5('0x17'));var licenseUtil=require(_0x10d5('0x18'));var db=require(_0x10d5('0x19'))['db'];config[_0x10d5('0x1a')]=_[_0x10d5('0x1b')](config[_0x10d5('0x1a')],{'host':_0x10d5('0x1c'),'port':0x18eb});var socket=require(_0x10d5('0x1d'))(new Redis(config[_0x10d5('0x1a')]));require(_0x10d5('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x10d5('0x1f')][_0x10d5('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x42bf92,_0x3bbb1b,_0x4d61a0,_0x4a8431){return new BPromise(function(_0x178a29,_0xebd6fa){var _0x45e5f3=_0x4a8431||client;return _0x45e5f3['request'](_0x42bf92,_0x4d61a0)[_0x10d5('0x21')](function(_0x8103b5){logger[_0x10d5('0x22')]('SmsAccount,\x20%s,\x20%s',_0x3bbb1b,_0x10d5('0x23'));logger[_0x10d5('0x24')](_0x10d5('0x25'),_0x3bbb1b,_0x10d5('0x23'),JSON[_0x10d5('0x26')](_0x8103b5));if(_0x8103b5['error']){if(_0x8103b5[_0x10d5('0x27')][_0x10d5('0x28')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3bbb1b,_0x8103b5[_0x10d5('0x27')]['message']);return _0xebd6fa(_0x8103b5[_0x10d5('0x27')][_0x10d5('0x29')]);}logger[_0x10d5('0x27')](_0x10d5('0x2a'),_0x3bbb1b,_0x8103b5['error'][_0x10d5('0x29')]);return _0x178a29(_0x8103b5['error'][_0x10d5('0x29')]);}else{logger[_0x10d5('0x22')](_0x10d5('0x2a'),_0x3bbb1b,_0x10d5('0x23'));_0x178a29(_0x8103b5['result']['message']);}})['catch'](function(_0x4dd1f9){logger['error'](_0x10d5('0x2a'),_0x3bbb1b,_0x4dd1f9);_0xebd6fa(_0x4dd1f9);});});}function respondWithStatusCode(_0x5a7b76,_0x556438){_0x556438=_0x556438||0xcc;return function(_0x4270f5){if(_0x4270f5){return _0x5a7b76['sendStatus'](_0x556438);}return _0x5a7b76['status'](_0x556438)[_0x10d5('0x2b')]();};}function respondWithResult(_0x490cf3,_0x4b6e51){_0x4b6e51=_0x4b6e51||0xc8;return function(_0x54fafb){if(_0x54fafb){return _0x490cf3[_0x10d5('0x2c')](_0x4b6e51)[_0x10d5('0x2d')](_0x54fafb);}};}function respondWithFilteredResult(_0x470207,_0x1ba233){return function(_0x621ee6){if(_0x621ee6){var _0x47cb5a=typeof _0x1ba233[_0x10d5('0x2e')]==='undefined'&&typeof _0x1ba233[_0x10d5('0x2f')]===_0x10d5('0x30');var _0x268075=_0x621ee6[_0x10d5('0x31')];var _0x28a425=_0x47cb5a?0x0:_0x1ba233['offset'];var _0x4a606b=_0x47cb5a?_0x621ee6[_0x10d5('0x31')]:_0x1ba233[_0x10d5('0x2e')]+_0x1ba233[_0x10d5('0x2f')];var _0x4ffa35;if(_0x4a606b>=_0x268075){_0x4a606b=_0x268075;_0x4ffa35=0xc8;}else{_0x4ffa35=0xce;}_0x470207['status'](_0x4ffa35);return _0x470207[_0x10d5('0x32')](_0x10d5('0x33'),_0x28a425+'-'+_0x4a606b+'/'+_0x268075)[_0x10d5('0x2d')](_0x621ee6);}return null;};}function patchUpdates(_0x20960c){return function(_0x4b6ff5){try{jsonpatch[_0x10d5('0x34')](_0x4b6ff5,_0x20960c,!![]);}catch(_0x341db1){return BPromise[_0x10d5('0x35')](_0x341db1);}return _0x4b6ff5[_0x10d5('0x36')]();};}function saveUpdates(_0x2b5134,_0x179011){return function(_0x1b6a32){if(_0x1b6a32){return _0x1b6a32[_0x10d5('0x37')](_0x2b5134)[_0x10d5('0x21')](function(_0x419cc7){return _0x419cc7;});}return null;};}function removeEntity(_0x8bfd6f,_0x4d5d9d){return function(_0x133b0c){if(_0x133b0c){return _0x133b0c[_0x10d5('0x38')]()['then'](function(){var _0x3b7766=_0x133b0c[_0x10d5('0x39')]({'plain':!![]});var _0x1fa6d3='SmsAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x1fa6d3,'resourceId':_0x3b7766['id']}})[_0x10d5('0x21')](function(){return _0x133b0c;});})[_0x10d5('0x21')](function(){_0x8bfd6f['status'](0xcc)[_0x10d5('0x2b')]();});}};}function handleEntityNotFound(_0xc3b193,_0x23d154){return function(_0x593e1c){if(!_0x593e1c){_0xc3b193[_0x10d5('0x3a')](0x194);}return _0x593e1c;};}function handleError(_0x4da173,_0x5b3712){_0x5b3712=_0x5b3712||0x1f4;return function(_0x457afe){logger['error'](_0x457afe[_0x10d5('0x3b')]);if(_0x457afe[_0x10d5('0x3c')]){delete _0x457afe[_0x10d5('0x3c')];}_0x4da173[_0x10d5('0x2c')](_0x5b3712)[_0x10d5('0x3d')](_0x457afe);};}exports['index']=function(_0x57cdfd,_0x4b451b){var _0x46478f={'include':[{'model':db[_0x10d5('0x3e')],'as':'mandatoryDispositionPause'}]},_0x15b697={},_0x490e10={'count':0x0,'rows':[]};var _0x5a323c=_[_0x10d5('0x3f')](db[_0x10d5('0x40')][_0x10d5('0x41')],function(_0xe68969){return{'name':_0xe68969[_0x10d5('0x42')],'type':_0xe68969[_0x10d5('0x43')]['key']};});_0x15b697[_0x10d5('0x44')]=_[_0x10d5('0x3f')](_0x5a323c,'name');_0x15b697['query']=_[_0x10d5('0x45')](_0x57cdfd[_0x10d5('0x46')]);_0x15b697[_0x10d5('0x47')]=_['intersection'](_0x15b697[_0x10d5('0x44')],_0x15b697[_0x10d5('0x46')]);_0x46478f['attributes']=_[_0x10d5('0x48')](_0x15b697[_0x10d5('0x44')],qs['fields'](_0x57cdfd[_0x10d5('0x46')]['fields']));_0x46478f[_0x10d5('0x49')]=_0x46478f[_0x10d5('0x49')][_0x10d5('0x4a')]?_0x46478f[_0x10d5('0x49')]:_0x15b697[_0x10d5('0x44')];if(!_0x57cdfd[_0x10d5('0x46')][_0x10d5('0x4b')](_0x10d5('0x4c'))){_0x46478f[_0x10d5('0x2f')]=qs[_0x10d5('0x2f')](_0x57cdfd[_0x10d5('0x46')][_0x10d5('0x2f')]);_0x46478f['offset']=qs['offset'](_0x57cdfd[_0x10d5('0x46')]['offset']);}_0x46478f['order']=qs[_0x10d5('0x4d')](_0x57cdfd[_0x10d5('0x46')][_0x10d5('0x4d')]);_0x46478f[_0x10d5('0x4e')]=qs[_0x10d5('0x47')](_['pick'](_0x57cdfd[_0x10d5('0x46')],_0x15b697[_0x10d5('0x47')]),_0x5a323c);if(_0x57cdfd[_0x10d5('0x46')]['filter']){_0x46478f[_0x10d5('0x4e')]=_[_0x10d5('0x4f')](_0x46478f[_0x10d5('0x4e')],{'$or':_[_0x10d5('0x3f')](_0x5a323c,function(_0x357635){if(_0x357635['type']!==_0x10d5('0x50')){var _0x2a821c={};_0x2a821c[_0x357635['name']]={'$like':'%'+_0x57cdfd['query'][_0x10d5('0x51')]+'%'};return _0x2a821c;}})});}_0x46478f=_[_0x10d5('0x4f')]({},_0x46478f,_0x57cdfd[_0x10d5('0x52')]);var _0x549896={'where':_0x46478f[_0x10d5('0x4e')]};return db[_0x10d5('0x40')][_0x10d5('0x31')](_0x549896)[_0x10d5('0x21')](function(_0x1ac1e9){_0x490e10['count']=_0x1ac1e9;if(_0x57cdfd[_0x10d5('0x46')][_0x10d5('0x53')]){_0x46478f[_0x10d5('0x54')]=[{'all':!![]}];}return db['SmsAccount'][_0x10d5('0x55')](_0x46478f);})[_0x10d5('0x21')](function(_0x34bbf7){_0x490e10[_0x10d5('0x56')]=_0x34bbf7;return _0x490e10;})[_0x10d5('0x21')](respondWithFilteredResult(_0x4b451b,_0x46478f))['catch'](handleError(_0x4b451b,null));};exports[_0x10d5('0x57')]=function(_0x5cf8e9,_0x1c401d){var _0x4344f={'raw':![],'where':{'id':_0x5cf8e9[_0x10d5('0x58')]['id']},'include':[{'model':db[_0x10d5('0x3e')],'as':_0x10d5('0x59')}]},_0x438186={};_0x438186[_0x10d5('0x44')]=_[_0x10d5('0x45')](db[_0x10d5('0x40')][_0x10d5('0x41')]);_0x438186[_0x10d5('0x46')]=_['keys'](_0x5cf8e9[_0x10d5('0x46')]);_0x438186[_0x10d5('0x47')]=_[_0x10d5('0x48')](_0x438186[_0x10d5('0x44')],_0x438186[_0x10d5('0x46')]);_0x4344f[_0x10d5('0x49')]=_[_0x10d5('0x48')](_0x438186[_0x10d5('0x44')],qs[_0x10d5('0x5a')](_0x5cf8e9[_0x10d5('0x46')][_0x10d5('0x5a')]));_0x4344f[_0x10d5('0x49')]=_0x4344f[_0x10d5('0x49')][_0x10d5('0x4a')]?_0x4344f['attributes']:_0x438186[_0x10d5('0x44')];if(_0x5cf8e9[_0x10d5('0x46')][_0x10d5('0x53')]){_0x4344f[_0x10d5('0x54')]=[{'all':!![]}];}_0x4344f=_['merge']({},_0x4344f,_0x5cf8e9[_0x10d5('0x52')]);return db[_0x10d5('0x40')]['find'](_0x4344f)[_0x10d5('0x21')](handleEntityNotFound(_0x1c401d,null))[_0x10d5('0x21')](respondWithResult(_0x1c401d,null))[_0x10d5('0x5b')](handleError(_0x1c401d,null));};exports[_0x10d5('0x5c')]=function(_0x32685f,_0x8ab46d){return db[_0x10d5('0x40')]['create'](_0x32685f['body'],{})[_0x10d5('0x21')](function(_0x585b19){var _0x37e133=_0x32685f['user'][_0x10d5('0x39')]({'plain':!![]});if(!_0x37e133)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37e133[_0x10d5('0x5d')]==='user'){var _0x1ac7dd=_0x585b19[_0x10d5('0x39')]({'plain':!![]});var _0x39fad1=_0x10d5('0x5e');return db[_0x10d5('0x5f')][_0x10d5('0x60')]({'where':{'name':_0x39fad1,'userProfileId':_0x37e133['userProfileId']},'raw':!![]})[_0x10d5('0x21')](function(_0x36c889){if(_0x36c889&&_0x36c889[_0x10d5('0x61')]===0x0){return db[_0x10d5('0x62')]['create']({'name':_0x1ac7dd[_0x10d5('0x3c')],'resourceId':_0x1ac7dd['id'],'type':_0x36c889[_0x10d5('0x3c')],'sectionId':_0x36c889['id']},{})[_0x10d5('0x21')](function(){return _0x585b19;});}else{return _0x585b19;}})['catch'](function(_0x9ba3ff){logger['error'](_0x10d5('0x63'),_0x9ba3ff);throw _0x9ba3ff;});}return _0x585b19;})[_0x10d5('0x21')](respondWithResult(_0x8ab46d,0xc9))[_0x10d5('0x5b')](handleError(_0x8ab46d,null));};exports[_0x10d5('0x37')]=function(_0x2ba857,_0x391df6){if(_0x2ba857[_0x10d5('0x64')]['id']){delete _0x2ba857['body']['id'];}return db[_0x10d5('0x40')]['find']({'where':{'id':_0x2ba857[_0x10d5('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x10d5('0x59')}]})[_0x10d5('0x21')](handleEntityNotFound(_0x391df6,null))['then'](saveUpdates(_0x2ba857[_0x10d5('0x64')],null))['then'](respondWithResult(_0x391df6,null))[_0x10d5('0x5b')](handleError(_0x391df6,null));};exports[_0x10d5('0x38')]=function(_0x3ad376,_0x5504e9){return db['SmsAccount'][_0x10d5('0x60')]({'where':{'id':_0x3ad376[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x5504e9,null))['then'](removeEntity(_0x5504e9,null))['catch'](handleError(_0x5504e9,null));};exports[_0x10d5('0x65')]=function(_0x246071,_0x3d09ca){return db[_0x10d5('0x40')]['describe']()[_0x10d5('0x21')](respondWithResult(_0x3d09ca,null))['catch'](handleError(_0x3d09ca,null));};exports['addDisposition']=function(_0x5f11b7,_0xb39684,_0x335cda){if(_0x5f11b7[_0x10d5('0x64')]['id']){delete _0x5f11b7[_0x10d5('0x64')]['id'];}return db[_0x10d5('0x40')][_0x10d5('0x60')]({'where':{'id':_0x5f11b7[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0xb39684,null))['then'](function(_0x2bbd92){if(_0x2bbd92){_0x5f11b7[_0x10d5('0x64')][_0x10d5('0x66')]=_0x2bbd92['id'];return db[_0x10d5('0x67')][_0x10d5('0x5c')](_0x5f11b7[_0x10d5('0x64')]);}})[_0x10d5('0x21')](respondWithResult(_0xb39684,null))[_0x10d5('0x5b')](handleError(_0xb39684,null));};exports[_0x10d5('0x68')]=function(_0xfc01db,_0x45d829,_0xa7729c){var _0x325b7b={'raw':![],'where':{}};var _0x202676={};var _0x176453={'count':0x0,'rows':[]};return db['SmsAccount'][_0x10d5('0x69')]({'where':{'id':_0xfc01db[_0x10d5('0x58')]['id']}})['then'](handleEntityNotFound(_0x45d829,null))[_0x10d5('0x21')](function(_0x4c1923){if(_0x4c1923){_0x202676[_0x10d5('0x44')]=_[_0x10d5('0x45')](db[_0x10d5('0x67')][_0x10d5('0x41')]);_0x202676[_0x10d5('0x46')]=_['keys'](_0xfc01db[_0x10d5('0x46')]);_0x202676['filters']=_[_0x10d5('0x48')](_0x202676[_0x10d5('0x44')],_0x202676[_0x10d5('0x46')]);_0x325b7b[_0x10d5('0x49')]=_['intersection'](_0x202676[_0x10d5('0x44')],qs['fields'](_0xfc01db[_0x10d5('0x46')][_0x10d5('0x5a')]));_0x325b7b['attributes']=_0x325b7b[_0x10d5('0x49')]['length']?_0x325b7b[_0x10d5('0x49')]:_0x202676[_0x10d5('0x44')];if(!_0xfc01db[_0x10d5('0x46')][_0x10d5('0x4b')](_0x10d5('0x4c'))){_0x325b7b[_0x10d5('0x2f')]=qs[_0x10d5('0x2f')](_0xfc01db[_0x10d5('0x46')]['limit']);_0x325b7b['offset']=qs[_0x10d5('0x2e')](_0xfc01db[_0x10d5('0x46')][_0x10d5('0x2e')]);}_0x325b7b[_0x10d5('0x6a')]=qs[_0x10d5('0x4d')](_0xfc01db[_0x10d5('0x46')][_0x10d5('0x4d')]);_0x325b7b[_0x10d5('0x4e')]=qs[_0x10d5('0x47')](_[_0x10d5('0x6b')](_0xfc01db[_0x10d5('0x46')],_0x202676['filters']));_0x325b7b[_0x10d5('0x4e')][_0x10d5('0x66')]=_0x4c1923['id'];if(_0xfc01db['query'][_0x10d5('0x51')]){_0x325b7b[_0x10d5('0x4e')]=_[_0x10d5('0x4f')](_0x325b7b['where'],{'$or':_[_0x10d5('0x3f')](_0x325b7b[_0x10d5('0x49')],function(_0x4a0e22){var _0x5939db={};_0x5939db[_0x4a0e22]={'$like':'%'+_0xfc01db[_0x10d5('0x46')][_0x10d5('0x51')]+'%'};return _0x5939db;})});}_0x325b7b=_[_0x10d5('0x4f')]({},_0x325b7b,_0xfc01db[_0x10d5('0x52')]);return db[_0x10d5('0x67')][_0x10d5('0x31')]({'where':_0x325b7b[_0x10d5('0x4e')]})[_0x10d5('0x21')](function(_0x1a9918){_0x176453[_0x10d5('0x31')]=_0x1a9918;if(_0xfc01db[_0x10d5('0x46')]['includeAll']){_0x325b7b[_0x10d5('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x10d5('0x55')](_0x325b7b);})[_0x10d5('0x21')](function(_0x20e55c){_0x176453[_0x10d5('0x56')]=_0x20e55c;return _0x176453;});}})[_0x10d5('0x21')](respondWithFilteredResult(_0x45d829,_0x325b7b))[_0x10d5('0x5b')](handleError(_0x45d829,null));};exports[_0x10d5('0x6c')]=function(_0x3952e7,_0x1a10f6,_0x5a59d3){return db[_0x10d5('0x40')]['find']({'where':{'id':_0x3952e7['params']['id']}})['then'](handleEntityNotFound(_0x1a10f6,null))['then'](function(_0x426609){if(_0x426609){return _0x426609[_0x10d5('0x6c')](_0x3952e7[_0x10d5('0x46')]['ids']);}})[_0x10d5('0x21')](respondWithStatusCode(_0x1a10f6,null))[_0x10d5('0x5b')](handleError(_0x1a10f6,null));};exports['addAnswer']=function(_0x3007f1,_0x500a53,_0x32cb23){if(_0x3007f1[_0x10d5('0x64')]['id']){delete _0x3007f1['body']['id'];}return db[_0x10d5('0x40')][_0x10d5('0x60')]({'where':{'id':_0x3007f1[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x500a53,null))[_0x10d5('0x21')](function(_0x1003ba){if(_0x1003ba){_0x3007f1['body']['SmsAccountId']=_0x1003ba['id'];return db[_0x10d5('0x6d')][_0x10d5('0x5c')](_0x3007f1[_0x10d5('0x64')]);}})[_0x10d5('0x21')](respondWithResult(_0x500a53,null))[_0x10d5('0x5b')](handleError(_0x500a53,null));};exports['getAnswers']=function(_0x2110f4,_0x39f7b2,_0x3717c9){var _0x4a94e7={'raw':![],'where':{}};var _0x485321={};var _0xaa15f9={'count':0x0,'rows':[]};return db[_0x10d5('0x40')][_0x10d5('0x69')]({'where':{'id':_0x2110f4[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x39f7b2,null))[_0x10d5('0x21')](function(_0xd14300){if(_0xd14300){_0x485321[_0x10d5('0x44')]=_[_0x10d5('0x45')](db['CannedAnswer'][_0x10d5('0x41')]);_0x485321[_0x10d5('0x46')]=_['keys'](_0x2110f4['query']);_0x485321[_0x10d5('0x47')]=_[_0x10d5('0x48')](_0x485321[_0x10d5('0x44')],_0x485321[_0x10d5('0x46')]);_0x4a94e7['attributes']=_['intersection'](_0x485321[_0x10d5('0x44')],qs[_0x10d5('0x5a')](_0x2110f4[_0x10d5('0x46')][_0x10d5('0x5a')]));_0x4a94e7[_0x10d5('0x49')]=_0x4a94e7['attributes'][_0x10d5('0x4a')]?_0x4a94e7[_0x10d5('0x49')]:_0x485321[_0x10d5('0x44')];if(!_0x2110f4['query'][_0x10d5('0x4b')]('nolimit')){_0x4a94e7[_0x10d5('0x2f')]=qs[_0x10d5('0x2f')](_0x2110f4[_0x10d5('0x46')][_0x10d5('0x2f')]);_0x4a94e7[_0x10d5('0x2e')]=qs[_0x10d5('0x2e')](_0x2110f4[_0x10d5('0x46')][_0x10d5('0x2e')]);}_0x4a94e7[_0x10d5('0x6a')]=qs[_0x10d5('0x4d')](_0x2110f4['query'][_0x10d5('0x4d')]);_0x4a94e7[_0x10d5('0x4e')]=qs[_0x10d5('0x47')](_[_0x10d5('0x6b')](_0x2110f4['query'],_0x485321[_0x10d5('0x47')]));_0x4a94e7[_0x10d5('0x4e')]['SmsAccountId']=_0xd14300['id'];if(_0x2110f4[_0x10d5('0x46')][_0x10d5('0x51')]){_0x4a94e7[_0x10d5('0x4e')]=_[_0x10d5('0x4f')](_0x4a94e7[_0x10d5('0x4e')],{'$or':_[_0x10d5('0x3f')](_0x4a94e7['attributes'],function(_0x39e80a){var _0xe53fe0={};_0xe53fe0[_0x39e80a]={'$like':'%'+_0x2110f4[_0x10d5('0x46')][_0x10d5('0x51')]+'%'};return _0xe53fe0;})});}_0x4a94e7=_[_0x10d5('0x4f')]({},_0x4a94e7,_0x2110f4['options']);return db['CannedAnswer'][_0x10d5('0x31')]({'where':_0x4a94e7['where']})[_0x10d5('0x21')](function(_0x13303c){_0xaa15f9[_0x10d5('0x31')]=_0x13303c;if(_0x2110f4['query'][_0x10d5('0x53')]){_0x4a94e7[_0x10d5('0x54')]=[{'all':!![]}];}return db[_0x10d5('0x6d')][_0x10d5('0x55')](_0x4a94e7);})[_0x10d5('0x21')](function(_0x14e3b8){_0xaa15f9[_0x10d5('0x56')]=_0x14e3b8;return _0xaa15f9;});}})['then'](respondWithFilteredResult(_0x39f7b2,_0x4a94e7))[_0x10d5('0x5b')](handleError(_0x39f7b2,null));};exports[_0x10d5('0x6e')]=function(_0x27210b,_0x402aed,_0x441936){return db['SmsAccount'][_0x10d5('0x60')]({'where':{'id':_0x27210b[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x402aed,null))['then'](function(_0x522910){if(_0x522910){return _0x522910['removeAnswers'](_0x27210b['query']['ids']);}})[_0x10d5('0x21')](respondWithStatusCode(_0x402aed,null))[_0x10d5('0x5b')](handleError(_0x402aed,null));};exports[_0x10d5('0x6f')]=function(_0x21add0,_0x420dc6,_0x2d5512){var _0x2a710f={'channel':_0x10d5('0x70')};var _0x14b496=[];var _0x47245c=[];var _0x28f164={};return db[_0x10d5('0x40')]['find']({'where':{'id':_0x21add0['params']['id']},'include':[{'model':db[_0x10d5('0x71')],'as':_0x10d5('0x72')}]})['then'](handleEntityNotFound(_0x420dc6,null))['then'](function(_0x3cc7fa){_0x2a710f[_0x10d5('0x73')]=_0x3cc7fa;_0x2a710f[_0x10d5('0x74')]=_[_0x10d5('0x75')](_0x3cc7fa[_0x10d5('0x72')],[_0x10d5('0x76')],[_0x10d5('0x77')]);if(_0x2a710f[_0x10d5('0x73')]['Applications']){delete _0x2a710f['account'][_0x10d5('0x72')];}return db['CmContact'][_0x10d5('0x65')]();})['then'](function(_0x5c55f3){if(!_0x5c55f3){throw new db[(_0x10d5('0x78'))]['ValidationError']('no\x20available\x20attributes');}_0x14b496=_[_0x10d5('0x79')](_[_0x10d5('0x45')](_0x5c55f3),[_0x10d5('0x7a'),'updatedAt']);_0x47245c=_[_0x10d5('0x79')](_[_0x10d5('0x45')](_0x5c55f3),[_0x10d5('0x7a'),_0x10d5('0x7b'),_0x10d5('0x7c'),'ListId']);_0x2a710f[_0x10d5('0x64')]={'mapKey':_0x10d5('0x7d')};if(_0x2a710f[_0x10d5('0x73')]['type']){switch(_0x2a710f[_0x10d5('0x73')][_0x10d5('0x43')]){case _0x10d5('0x7e'):_0x2a710f['body'][_0x10d5('0x7f')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x80')];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x64')]=_0x21add0[_0x10d5('0x64')]['Body'];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x81')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x82')];break;case _0x10d5('0x83'):_0x2a710f['body']['from']='+'+_0x21add0[_0x10d5('0x64')][_0x10d5('0x84')];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x64')]=_0x21add0['body'][_0x10d5('0x85')];break;case _0x10d5('0x86'):_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x7f')];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x64')]=_0x21add0['body'][_0x10d5('0x29')];break;case _0x10d5('0x87'):_0x2a710f[_0x10d5('0x64')]['from']=_0x21add0['body']['from'];_0x2a710f[_0x10d5('0x64')]['body']=_0x21add0[_0x10d5('0x64')]['body'];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x81')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x88')];break;case _0x10d5('0x89'):_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x80')];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x64')]=_0x21add0[_0x10d5('0x64')]['Text'];_0x2a710f[_0x10d5('0x64')]['messageId']=_0x21add0[_0x10d5('0x64')][_0x10d5('0x8a')];break;case'infobip':_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')]='+'+_0x21add0[_0x10d5('0x64')]['results'][0x0][_0x10d5('0x7f')];_0x2a710f['body']['body']=_0x21add0[_0x10d5('0x64')][_0x10d5('0x8b')][0x0][_0x10d5('0x85')];_0x2a710f['body'][_0x10d5('0x81')]=_0x21add0['body'][_0x10d5('0x8b')][0x0]['messageId'];break;case _0x10d5('0x8c'):_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')]=_0x21add0[_0x10d5('0x64')]['originatingAddress'];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x64')]=_0x21add0['body'][_0x10d5('0x8d')][_0x10d5('0x29')];break;case _0x10d5('0x8e'):_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x8f')];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x64')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x85')];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x81')]=_0x21add0[_0x10d5('0x64')]['replyMessageId'];break;case'bandwidth':_0x2a710f['body'][_0x10d5('0x81')]=_0x21add0[_0x10d5('0x64')][0x0][_0x10d5('0x29')]['id'];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')]=_0x21add0[_0x10d5('0x64')][0x0][_0x10d5('0x29')]['from'];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x64')]=_0x21add0[_0x10d5('0x64')][0x0][_0x10d5('0x29')]['text'];break;case _0x10d5('0x90'):_0x2a710f['body'][_0x10d5('0x7f')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x7f')];_0x2a710f[_0x10d5('0x64')][_0x10d5('0x64')]=_0x21add0[_0x10d5('0x64')][_0x10d5('0x29')];_0x2a710f['body'][_0x10d5('0x81')]=_0x21add0['body'][_0x10d5('0x91')];break;}}if(_0x2a710f[_0x10d5('0x64')]['id']){delete _0x2a710f['body']['id'];}if(_[_0x10d5('0x92')](_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')])){throw new db[(_0x10d5('0x78'))][(_0x10d5('0x93'))]('from\x20is\x20mandatory');}if(_[_0x10d5('0x92')](_0x2a710f[_0x10d5('0x64')]['body'])||_0x2a710f['body'][_0x10d5('0x64')]===''){throw new db[(_0x10d5('0x78'))][(_0x10d5('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x10d5('0x92')](_0x2a710f[_0x10d5('0x64')]['mapKey'])){throw new db[(_0x10d5('0x78'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47245c);}if(!_[_0x10d5('0x94')](_0x47245c,_0x2a710f['body']['mapKey'])){throw new db[(_0x10d5('0x78'))][(_0x10d5('0x93'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47245c);}_0x28f164[_0x2a710f['body'][_0x10d5('0x95')]]=_0x2a710f[_0x10d5('0x64')]['from'];return db[_0x10d5('0x96')][_0x10d5('0x60')]({'where':{'id':_0x2a710f[_0x10d5('0x73')][_0x10d5('0x97')]},'include':[{'model':db[_0x10d5('0x98')],'as':_0x10d5('0x99'),'where':_0x28f164,'limit':0x1,'order':[[_0x10d5('0x7b'),_0x10d5('0x9a')]]}]});})[_0x10d5('0x21')](handleEntityNotFound(_0x420dc6,null))[_0x10d5('0x21')](function(_0x35aebd){if(_0x35aebd){_0x2a710f['list']=_[_0x10d5('0x9b')](_0x35aebd,['Contacts']);if(_0x35aebd[_0x10d5('0x99')][_0x10d5('0x4a')]){return _0x35aebd[_0x10d5('0x99')][0x0];}var _0x50d0bd=_['defaults'](_0x2a710f[_0x10d5('0x64')],{'firstName':_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')],'ListId':_0x35aebd['id']});_0x50d0bd[_0x2a710f[_0x10d5('0x64')][_0x10d5('0x95')]]=_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')];return db[_0x10d5('0x98')][_0x10d5('0x5c')](_0x50d0bd,{'fields':_0x14b496,'raw':!![]});}})[_0x10d5('0x21')](handleEntityNotFound(_0x420dc6,null))[_0x10d5('0x21')](function(_0x460641){if(_0x460641){_0x2a710f[_0x10d5('0x9c')]=_0x460641;var _0x4a57b2={'ContactId':_0x460641['id'],'phone':_0x2a710f['body'][_0x10d5('0x7f')],'SmsAccountId':_0x21add0[_0x10d5('0x58')]['id']};var _0x22c01d={'ContactId':_0x460641['id'],'SmsAccountId':_0x21add0[_0x10d5('0x58')]['id'],'closed':![]};return db[_0x10d5('0x9d')][_0x10d5('0x60')]({'where':_0x22c01d})['then'](function(_0x474f8b){if(_0x474f8b){return[_0x474f8b,![]];}return db[_0x10d5('0x9d')][_0x10d5('0x5c')](_0x4a57b2)['then'](function(_0xa57b57){return[_0xa57b57,!![]];});});}})[_0x10d5('0x9e')](function(_0x23b992,_0x5c8d52){_0x2a710f[_0x10d5('0x9f')]=_0x23b992[_0x10d5('0x39')]({'plain':!![]});_0x2a710f[_0x10d5('0x9f')]['created']=![];if(_0x5c8d52){if(_0x2a710f['account'][_0x10d5('0xa0')]){_0x2a710f[_0x10d5('0x74')][_0x10d5('0xa1')]({'id':0x0,'priority':_0x2a710f['applications'][_0x10d5('0x4a')]+0x1,'app':_0x10d5('0xa2'),'appdata':_0x10d5('0xa3'),'interval':_0x10d5('0xa4')});}_0x2a710f['interaction'][_0x10d5('0xa5')]=!![];}return db['SmsMessage'][_0x10d5('0x5c')]({'phone':_0x2a710f[_0x10d5('0x64')][_0x10d5('0x7f')],'messageId':_0x2a710f[_0x10d5('0x64')][_0x10d5('0x81')],'body':_0x2a710f['body'][_0x10d5('0x64')],'SmsAccountId':_0x21add0[_0x10d5('0x58')]['id'],'SmsInteractionId':_0x23b992['id'],'direction':'in','ContactId':_0x23b992[_0x10d5('0xa6')],'AttachmentId':_0x2a710f[_0x10d5('0x64')][_0x10d5('0xa7')]});})['then'](function(_0x20f99b){_0x2a710f[_0x10d5('0x29')]=_0x20f99b;if(_0x2a710f['interaction']['UserId']){return db['User'][_0x10d5('0x60')]({'attributes':['id',_0x10d5('0x3c')],'where':{'id':_0x2a710f['interaction'][_0x10d5('0xa8')]}})['then'](function(_0x51bda5){if(_0x51bda5){_0x2a710f[_0x10d5('0x74')][_0x10d5('0xa9')]({'id':0x0,'priority':0x0,'app':_0x10d5('0xaa'),'appdata':_0x51bda5['name']+','+(_0x2a710f[_0x10d5('0x73')][_0x10d5('0xab')]||0xa),'interval':_0x10d5('0xa4')});}return respondWithRpcPromise(_0x10d5('0xac'),_0x10d5('0xad'),_0x2a710f);});}return respondWithRpcPromise(_0x10d5('0xac'),'startRouting',_0x2a710f);})[_0x10d5('0x21')](function(_0x4dd91e){if(_0x4dd91e){var _0x301162=0xc8;var _0x1eb714=_0x10d5('0xae');logger['info'](_0x10d5('0x25'),_0x1eb714,_0x301162,_0x10d5('0xaf'));logger[_0x10d5('0x24')](_0x10d5('0xb0'),_0x1eb714,_0x301162,_0x10d5('0xaf'),JSON[_0x10d5('0x26')](_0x4dd91e));if(_0x2a710f[_0x10d5('0x73')][_0x10d5('0x43')]===_0x10d5('0x7e')){return _0x420dc6[_0x10d5('0x2c')](_0x301162)[_0x10d5('0x32')]('Content-Type',_0x10d5('0xb1'))['send'](_0x10d5('0xb2'));}else{return _0x420dc6[_0x10d5('0x2c')](_0x301162)[_0x10d5('0x2d')](_0x4dd91e);}}})['catch'](handleError(_0x420dc6,null));};exports[_0x10d5('0xb3')]=function(_0x4019d9,_0x3bac67,_0x5e032b){return db['SmsAccount']['findOne']({'where':{'id':_0x4019d9[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x3bac67,null))['then'](function(_0x4a5145){if(_0x4a5145){return db['sequelize']['transaction'](function(_0x4888a5){return db['SmsApplication'][_0x10d5('0x38')]({'where':{'SmsAccountId':_0x4019d9[_0x10d5('0x58')]['id']},'transaction':_0x4888a5})[_0x10d5('0x21')](function(_0x900a01){var _0x4c49be=_[_0x10d5('0x3f')](_0x4019d9['body'],function(_0x19cc33){_0x19cc33[_0x10d5('0x66')]=_0x4019d9[_0x10d5('0x58')]['id'];return _0x19cc33;});return db['SmsApplication'][_0x10d5('0xb4')](_0x4c49be,{'transaction':_0x4888a5});});})[_0x10d5('0x21')](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x4019d9[_0x10d5('0x58')]['id']},'order':_0x10d5('0x76')});});}})[_0x10d5('0x21')](respondWithResult(_0x3bac67,null))[_0x10d5('0x5b')](handleError(_0x3bac67,null));};exports['getApplications']=function(_0x362327,_0x3c43de,_0x299ec7){var _0x42b001={};var _0x3d4cb9={};var _0x23fa13;var _0x4af675;return db[_0x10d5('0x40')][_0x10d5('0x69')]({'where':{'id':_0x362327[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x3c43de,null))[_0x10d5('0x21')](function(_0x17f37c){if(_0x17f37c){_0x23fa13=_0x17f37c;_0x3d4cb9['model']=_['keys'](db['SmsApplication'][_0x10d5('0x41')]);_0x3d4cb9['query']=_[_0x10d5('0x45')](_0x362327[_0x10d5('0x46')]);_0x3d4cb9[_0x10d5('0x47')]=_['intersection'](_0x3d4cb9[_0x10d5('0x44')],_0x3d4cb9[_0x10d5('0x46')]);_0x42b001['attributes']=_[_0x10d5('0x48')](_0x3d4cb9[_0x10d5('0x44')],qs[_0x10d5('0x5a')](_0x362327[_0x10d5('0x46')][_0x10d5('0x5a')]));_0x42b001[_0x10d5('0x49')]=_0x42b001[_0x10d5('0x49')][_0x10d5('0x4a')]?_0x42b001[_0x10d5('0x49')]:_0x3d4cb9[_0x10d5('0x44')];_0x42b001[_0x10d5('0x6a')]=qs['sort'](_0x362327[_0x10d5('0x46')][_0x10d5('0x4d')]);_0x42b001[_0x10d5('0x4e')]=qs['filters'](_[_0x10d5('0x6b')](_0x362327[_0x10d5('0x46')],_0x3d4cb9[_0x10d5('0x47')]));if(_0x362327['query'][_0x10d5('0x51')]){_0x42b001[_0x10d5('0x4e')]=_['merge'](_0x42b001['where'],{'$or':_[_0x10d5('0x3f')](_0x42b001[_0x10d5('0x49')],function(_0x32489a){var _0x658442={};_0x658442[_0x32489a]={'$like':'%'+_0x362327[_0x10d5('0x46')]['filter']+'%'};return _0x658442;})});}_0x42b001=_[_0x10d5('0x4f')]({},_0x42b001,_0x362327[_0x10d5('0x52')]);return _0x23fa13[_0x10d5('0xb5')](_0x42b001);}})[_0x10d5('0x21')](function(_0x4a9ebd){if(_0x4a9ebd){_0x4af675=_0x4a9ebd[_0x10d5('0x4a')];if(!_0x362327[_0x10d5('0x46')][_0x10d5('0x4b')](_0x10d5('0x4c'))){_0x42b001['limit']=qs['limit'](_0x362327[_0x10d5('0x46')][_0x10d5('0x2f')]);_0x42b001['offset']=qs[_0x10d5('0x2e')](_0x362327[_0x10d5('0x46')][_0x10d5('0x2e')]);}return _0x23fa13[_0x10d5('0xb5')](_0x42b001);}})[_0x10d5('0x21')](function(_0x5b0c01){if(_0x5b0c01){return _0x5b0c01?{'count':_0x4af675,'rows':_0x5b0c01}:null;}})[_0x10d5('0x21')](respondWithResult(_0x3c43de,null))[_0x10d5('0x5b')](handleError(_0x3c43de,null));};exports['getInteractions']=function(_0x503d9f,_0x1656c4,_0x150185){var _0x5ee76f={'raw':![],'where':{}};var _0x515cd0={};var _0x4fc6c5={'count':0x0,'rows':[]};return db[_0x10d5('0x40')][_0x10d5('0x69')]({'where':{'id':_0x503d9f[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x1656c4,null))[_0x10d5('0x21')](function(_0x4b5bf6){if(_0x4b5bf6){_0x515cd0[_0x10d5('0x44')]=_[_0x10d5('0x45')](db[_0x10d5('0x9d')][_0x10d5('0x41')]);_0x515cd0[_0x10d5('0x46')]=_['keys'](_0x503d9f[_0x10d5('0x46')]);_0x515cd0[_0x10d5('0x47')]=_[_0x10d5('0x48')](_0x515cd0['model'],_0x515cd0[_0x10d5('0x46')]);_0x5ee76f[_0x10d5('0x49')]=_[_0x10d5('0x48')](_0x515cd0['model'],qs[_0x10d5('0x5a')](_0x503d9f['query'][_0x10d5('0x5a')]));_0x5ee76f[_0x10d5('0x49')]=_0x5ee76f['attributes']['length']?_0x5ee76f[_0x10d5('0x49')]:_0x515cd0[_0x10d5('0x44')];if(!_0x503d9f['query'][_0x10d5('0x4b')](_0x10d5('0x4c'))){_0x5ee76f[_0x10d5('0x2f')]=qs['limit'](_0x503d9f['query'][_0x10d5('0x2f')]);_0x5ee76f[_0x10d5('0x2e')]=qs[_0x10d5('0x2e')](_0x503d9f[_0x10d5('0x46')][_0x10d5('0x2e')]);}_0x5ee76f['order']=qs[_0x10d5('0x4d')](_0x503d9f[_0x10d5('0x46')][_0x10d5('0x4d')]);_0x5ee76f['where']=qs['filters'](_[_0x10d5('0x6b')](_0x503d9f['query'],_0x515cd0[_0x10d5('0x47')]));_0x5ee76f['where'][_0x10d5('0x66')]=_0x4b5bf6['id'];if(_0x503d9f[_0x10d5('0x46')][_0x10d5('0x51')]){_0x5ee76f[_0x10d5('0x4e')]=_[_0x10d5('0x4f')](_0x5ee76f[_0x10d5('0x4e')],{'$or':_[_0x10d5('0x3f')](_0x5ee76f['attributes'],function(_0x21cd98){var _0x53d1a4={};_0x53d1a4[_0x21cd98]={'$like':'%'+_0x503d9f['query'][_0x10d5('0x51')]+'%'};return _0x53d1a4;})});}_0x5ee76f=_[_0x10d5('0x4f')]({},_0x5ee76f,_0x503d9f[_0x10d5('0x52')]);return db[_0x10d5('0x9d')][_0x10d5('0x31')]({'where':_0x5ee76f[_0x10d5('0x4e')]})[_0x10d5('0x21')](function(_0x30b918){_0x4fc6c5[_0x10d5('0x31')]=_0x30b918;if(_0x503d9f['query'][_0x10d5('0x53')]){_0x5ee76f[_0x10d5('0x54')]=[{'model':db[_0x10d5('0x98')],'as':_0x10d5('0xb6'),'required':![]},{'model':db[_0x10d5('0xb7')],'as':'Owner','attributes':[_0x10d5('0x3c'),_0x10d5('0xb8'),_0x10d5('0xb9')],'required':![]},{'model':db[_0x10d5('0xba')],'as':_0x10d5('0xbb'),'attributes':['id','name','color'],'where':_0x503d9f['query'][_0x10d5('0xbc')]?{'id':_0x503d9f['query'][_0x10d5('0xbc')]}:undefined,'required':_0x503d9f[_0x10d5('0x46')][_0x10d5('0xbc')]?!![]:![]}];}return db['SmsInteraction'][_0x10d5('0x55')](_0x5ee76f);})[_0x10d5('0x21')](function(_0x2415a7){_0x4fc6c5[_0x10d5('0x56')]=_0x2415a7;return _0x4fc6c5;});}})['then'](respondWithFilteredResult(_0x1656c4,_0x5ee76f))[_0x10d5('0x5b')](handleError(_0x1656c4,null));};exports[_0x10d5('0x3d')]=function(_0x471e0b,_0x8485f8,_0x4a39c7){var _0xf6fa51,_0x403ba7,_0xf2348;if(_[_0x10d5('0x92')](_0x471e0b['body'][_0x10d5('0x64')])||_0x471e0b['body'][_0x10d5('0x64')]===''){throw new db[(_0x10d5('0x78'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x10d5('0x92')](_0x471e0b[_0x10d5('0x64')]['to'])){throw new db['Sequelize'][(_0x10d5('0x93'))](_0x10d5('0xbd'));}_0xf6fa51=_0x471e0b[_0x10d5('0x64')]['to'];return db[_0x10d5('0x40')][_0x10d5('0x60')]({'where':{'id':_0x471e0b['params']['id']},'include':[{'model':db[_0x10d5('0x96')],'as':_0x10d5('0xbe'),'include':[{'model':db[_0x10d5('0x98')],'as':_0x10d5('0x99'),'where':{'mobile':_0xf6fa51},'limit':0x1,'order':[[_0x10d5('0x7b'),_0x10d5('0x9a')]]}]}]})['then'](handleEntityNotFound(_0x8485f8,null))[_0x10d5('0x21')](function(_0x7ba3a5){if(_0x7ba3a5&&_0x7ba3a5[_0x10d5('0xbe')]){_0x403ba7=_0x7ba3a5[_0x10d5('0x39')]({'plain':!![]});if(_0x403ba7[_0x10d5('0xbe')]&&_0x403ba7[_0x10d5('0xbe')]['Contacts'][_0x10d5('0x4a')]){return _0x403ba7[_0x10d5('0xbe')][_0x10d5('0x99')][0x0];}return db[_0x10d5('0x98')][_0x10d5('0x5c')](_[_0x10d5('0x1b')](_0x471e0b[_0x10d5('0x64')],{'firstName':_0xf6fa51,'mobile':_0xf6fa51,'phone':_0xf6fa51,'ListId':_0x403ba7[_0x10d5('0x97')]}));}})[_0x10d5('0x21')](handleEntityNotFound(_0x8485f8,null))['then'](function(_0x5a7802){if(_0x5a7802){_0xf2348=_0x5a7802;return db[_0x10d5('0x9d')]['find']({'where':{'ContactId':_0xf2348['id'],'closed':![],'SmsAccountId':_0x403ba7['id']}})[_0x10d5('0x21')](function(_0x2f7f42){if(_0x2f7f42){return[_0x2f7f42,![]];}return db[_0x10d5('0x9d')][_0x10d5('0x5c')]({'UserId':_0x471e0b[_0x10d5('0xbf')]['id'],'ContactId':_0xf2348['id'],'SmsAccountId':_0x403ba7['id'],'phone':_0xf6fa51,'firstMsgDirection':_0x10d5('0xc0'),'Messages':[_[_0x10d5('0x4f')](_0x471e0b[_0x10d5('0x64')],{'read':![],'body':_0x471e0b[_0x10d5('0x64')][_0x10d5('0x64')],'phone':_0xf6fa51,'SmsAccountId':_0x403ba7['id'],'UserId':_0x471e0b[_0x10d5('0xbf')]['id'],'ContactId':_0xf2348['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x10d5('0xc1')}]})[_0x10d5('0x21')](function(_0x286ef2){return[_0x286ef2,!![]];});});}})[_0x10d5('0x9e')](function(_0x41a967,_0x443290){if(_0x443290){return _0x41a967;}return db['SmsMessage'][_0x10d5('0x5c')](_[_0x10d5('0x4f')](_0x471e0b[_0x10d5('0x64')],{'read':![],'body':_0x471e0b['body'][_0x10d5('0x64')],'phone':_0xf6fa51,'SmsAccountId':_0x403ba7['id'],'SmsInteractionId':_0x41a967['id'],'UserId':_0x471e0b[_0x10d5('0xbf')]['id'],'ContactId':_0xf2348['id']}))[_0x10d5('0x21')](function(_0x34878f){_0x41a967[_0x10d5('0xc2')][_0x10d5('0xc1')]=[];_0x41a967[_0x10d5('0xc2')][_0x10d5('0xc1')]['push'](_0x34878f[_0x10d5('0xc2')]);return _0x41a967;});})[_0x10d5('0x21')](respondWithResult(_0x8485f8,null))[_0x10d5('0x5b')](handleError(_0x8485f8,null));};exports['status']=function(_0xc8b7af,_0x124ec3,_0x556268){if(_0xc8b7af[_0x10d5('0x64')]['id']){delete _0xc8b7af[_0x10d5('0x64')]['id'];}var _0xdbec72,_0x204572,_0x5c7329;return db[_0x10d5('0x40')][_0x10d5('0x60')]({'where':{'id':_0xc8b7af[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x124ec3,null))[_0x10d5('0x21')](function(_0x4ff061){if(_0x4ff061){_0x5c7329=_0x4ff061;logger[_0x10d5('0x24')](_0x10d5('0x25'),_0x10d5('0x2c'),_0x10d5('0xc3'),_0x4ff061['type'],util['inspect'](_0xc8b7af[_0x10d5('0x64')],{'showHidden':![],'depth':null}));switch(_0x4ff061[_0x10d5('0x43')]){case _0x10d5('0x83'):if(_0xc8b7af[_0x10d5('0x64')][_0x10d5('0xc4')]&&_0xc8b7af[_0x10d5('0x64')][_0x10d5('0x2c')]){_0x204572=_0xc8b7af[_0x10d5('0x64')][_0x10d5('0x2c')];return db[_0x10d5('0xc5')][_0x10d5('0x60')]({'where':{'messageId':_0xc8b7af['body'][_0x10d5('0xc4')]}});}break;case _0x10d5('0x86'):if(_0xc8b7af[_0x10d5('0x64')][_0x10d5('0xc6')]&&_0xc8b7af['body']['statusInt']){_0x204572=_0xc8b7af[_0x10d5('0x64')]['statusInt'];return db['SmsMessage'][_0x10d5('0x60')]({'where':{'messageId':_0xc8b7af[_0x10d5('0x64')]['requestid']}});}break;case'clicksend':if(_0xc8b7af[_0x10d5('0x64')]['message_id']&&_0xc8b7af[_0x10d5('0x64')][_0x10d5('0xc7')]){_0x204572=_0xc8b7af[_0x10d5('0x64')][_0x10d5('0xc7')];return db[_0x10d5('0xc5')][_0x10d5('0x60')]({'where':{'messageId':_0xc8b7af['body'][_0x10d5('0x88')]}});}break;case _0x10d5('0xc8'):var _0x235411=_0xc8b7af[_0x10d5('0x64')][_0x10d5('0x8b')][0x0];if(_0x235411[_0x10d5('0x81')]&&_0x235411[_0x10d5('0x2c')][_0x10d5('0xc9')]==='DELIVERED'){_0x204572=_0x235411['status'][_0x10d5('0xc9')];return db[_0x10d5('0xc5')][_0x10d5('0x60')]({'where':{'messageId':_0x235411['messageId']}});}break;case _0x10d5('0x8e'):if(_0xc8b7af[_0x10d5('0x64')][_0x10d5('0x81')]&&_0xc8b7af['body'][_0x10d5('0x2c')]){_0x204572=_0xc8b7af[_0x10d5('0x64')][_0x10d5('0x2c')];return db[_0x10d5('0xc5')]['find']({'where':{'messageId':_0xc8b7af[_0x10d5('0x64')]['messageId']}});}break;case _0x10d5('0xca'):if(_0xc8b7af['body'][0x0][_0x10d5('0x29')]['id']){_0x204572=_0xc8b7af['body'][0x0][_0x10d5('0x43')];return db[_0x10d5('0xc5')]['find']({'where':{'messageId':_0xc8b7af[_0x10d5('0x64')][0x0][_0x10d5('0x29')]['id']}});}break;case _0x10d5('0x90'):if(_0xc8b7af['body'][_0x10d5('0xcb')]&&_0xc8b7af[_0x10d5('0x64')][_0x10d5('0x2c')]){_0x204572=_0xc8b7af['body'][_0x10d5('0x2c')];return db['SmsMessage'][_0x10d5('0x60')]({'where':{'messageId':_0xc8b7af[_0x10d5('0x64')][_0x10d5('0xcb')]}});}break;}}})[_0x10d5('0x21')](handleEntityNotFound(_0x124ec3,null))[_0x10d5('0x21')](function(_0x5cd34d){if(_0x5cd34d){_0xdbec72=_0x5cd34d;switch(_0x5c7329['type']){case'skebby':if(_0x204572==='DELIVERED'){return _0xdbec72[_0x10d5('0x37')]({'read':!![]});}else{logger[_0x10d5('0x27')](_0x10d5('0x25'),_0x10d5('0x2c'),_0x10d5('0x83'),util[_0x10d5('0xcc')](_0xc8b7af[_0x10d5('0x64')],{'showHidden':![],'depth':null}));}break;case _0x10d5('0x86'):if(_0x204572==='1'){return _0xdbec72[_0x10d5('0x37')]({'read':!![]});}else{logger[_0x10d5('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10d5('0x2c'),_0x10d5('0x83'),util[_0x10d5('0xcc')](_0xc8b7af[_0x10d5('0x64')],{'showHidden':![],'depth':null}));}break;case _0x10d5('0x87'):if(!_0xc8b7af['body'][_0x10d5('0xcd')]&&_0x204572>=0xc8&&_0x204572<=0xce){return _0xdbec72[_0x10d5('0x37')]({'read':!![]});}else{logger[_0x10d5('0x27')](_0x10d5('0x25'),_0x10d5('0x2c'),_0x10d5('0x87'),util[_0x10d5('0xcc')](_0xc8b7af['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4f0ef4=_0xc8b7af[_0x10d5('0x64')][_0x10d5('0x8b')][0x0];if(_0x4f0ef4['status']['groupName']===_0x10d5('0xce')){return _0xdbec72[_0x10d5('0x37')]({'read':!![]});}else{logger['error'](_0x10d5('0x25'),_0x10d5('0x2c'),_0x10d5('0xc8'),util[_0x10d5('0xcc')](_0xc8b7af['body'],{'showHidden':![],'depth':null}));}break;case _0x10d5('0x8e'):if(_0x204572==_0x10d5('0xcf')||_0x204572==_0x10d5('0xd0')){return _0xdbec72[_0x10d5('0x37')]({'read':!![]});}else{logger[_0x10d5('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10d5('0x2c'),'clickatell',util['inspect'](_0xc8b7af[_0x10d5('0x64')],{'showHidden':![],'depth':null}));}break;case _0x10d5('0xca'):if(_0x204572==_0x10d5('0xd1')){return _0xdbec72[_0x10d5('0x37')]({'read':!![]});}else{logger[_0x10d5('0x27')](_0x10d5('0x25'),_0x10d5('0x2c'),_0x10d5('0xca'),util[_0x10d5('0xcc')](_0xc8b7af[_0x10d5('0x64')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x204572===_0x10d5('0xd2')||_0x204572==='ACCEPTD'){return _0xdbec72[_0x10d5('0x37')]({'read':!![]});}else{logger['error'](_0x10d5('0x25'),_0x10d5('0x2c'),_0x10d5('0x90'),util[_0x10d5('0xcc')](_0xc8b7af[_0x10d5('0x64')],{'showHidden':![],'depth':null}));}break;}return _0xdbec72;}})[_0x10d5('0x21')](respondWithResult(_0x124ec3,null))[_0x10d5('0x5b')](handleError(_0x124ec3,null));};exports[_0x10d5('0xd3')]=function(_0x1d2950,_0x397cf3,_0x1f1b4c){var _0x1264fd,_0x1adc4b,_0x5daa78;return db[_0x10d5('0x40')]['find']({'where':{'id':_0x1d2950['params']['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x397cf3,null))[_0x10d5('0x21')](function(_0x2d6040){if(_0x2d6040){_0x5daa78=_0x2d6040;logger['debug'](_0x10d5('0x25'),_0x10d5('0x2c'),_0x10d5('0xc3'),_0x2d6040[_0x10d5('0x43')],util['inspect'](_0x1d2950[_0x10d5('0x46')],{'showHidden':![],'depth':null}));switch(_0x2d6040['type']){case _0x10d5('0x8c'):if(_0x1d2950['query'][_0x10d5('0xd4')]&&_0x1d2950[_0x10d5('0x46')][_0x10d5('0xd5')]){_0x1adc4b=_0x1d2950[_0x10d5('0x46')][_0x10d5('0xd5')];return db[_0x10d5('0xc5')][_0x10d5('0x60')]({'where':{'messageId':_0x1d2950['query'][_0x10d5('0xd4')]}});}break;}}})[_0x10d5('0x21')](handleEntityNotFound(_0x397cf3,null))[_0x10d5('0x21')](function(_0x5ceb90){if(_0x5ceb90){_0x1264fd=_0x5ceb90;switch(_0x5daa78[_0x10d5('0x43')]){case _0x10d5('0x8c'):if(_0x1adc4b==='2'||_0x1adc4b==='6'){return _0x1264fd[_0x10d5('0x37')]({'read':!![]});}else{logger[_0x10d5('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10d5('0x2c'),'csc',util[_0x10d5('0xcc')](_0x1d2950[_0x10d5('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x1264fd;}})[_0x10d5('0x21')](respondWithResult(_0x397cf3,null))['catch'](handleError(_0x397cf3,null));};exports[_0x10d5('0xd6')]=function(_0x41e707,_0x16ea55,_0x173ddf){return db[_0x10d5('0x40')][_0x10d5('0x60')]({'where':{'id':_0x41e707[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x16ea55,null))[_0x10d5('0x21')](function(_0x3842d9){if(_0x3842d9){return _0x3842d9[_0x10d5('0xd6')](_0x41e707[_0x10d5('0x64')]['ids'],_[_0x10d5('0x9b')](_0x41e707[_0x10d5('0x64')],[_0x10d5('0xd7'),'id'])||{})[_0x10d5('0x9e')](function(_0x5276b3){for(var _0x2d4cf5=0x0;_0x2d4cf5<_0x41e707[_0x10d5('0x64')][_0x10d5('0xd7')]['length'];_0x2d4cf5+=0x1){socket[_0x10d5('0xd8')]('userSmsAccount:save',{'UserId':Number(_0x41e707['body']['ids'][_0x2d4cf5]),'SmsAccountId':Number(_0x41e707[_0x10d5('0x58')]['id'])});}return _0x5276b3;});}})[_0x10d5('0x21')](respondWithResult(_0x16ea55,null))[_0x10d5('0x5b')](handleError(_0x16ea55,null));};exports[_0x10d5('0xd9')]=function(_0x3fccf6,_0x39966c,_0x3313e9){return db['SmsAccount'][_0x10d5('0x60')]({'where':{'id':_0x3fccf6[_0x10d5('0x58')]['id']}})[_0x10d5('0x21')](handleEntityNotFound(_0x39966c,null))[_0x10d5('0x21')](function(_0x2f88ca){if(_0x2f88ca){return _0x2f88ca['removeAgents'](_0x3fccf6[_0x10d5('0x46')][_0x10d5('0xd7')])[_0x10d5('0x21')](function(){if(_['isArray'](_0x3fccf6['query']['ids'])){for(var _0x29fe39=0x0;_0x29fe39<_0x3fccf6[_0x10d5('0x46')][_0x10d5('0xd7')][_0x10d5('0x4a')];_0x29fe39+=0x1){socket[_0x10d5('0xd8')](_0x10d5('0xda'),{'UserId':Number(_0x3fccf6[_0x10d5('0x46')]['ids'][_0x29fe39]),'SmsAccountId':Number(_0x3fccf6[_0x10d5('0x58')]['id'])});}}else{socket['emit'](_0x10d5('0xda'),{'UserId':Number(_0x3fccf6[_0x10d5('0x46')]['ids']),'SmsAccountId':Number(_0x3fccf6[_0x10d5('0x58')]['id'])});}});}})[_0x10d5('0x21')](respondWithStatusCode(_0x39966c,null))[_0x10d5('0x5b')](handleError(_0x39966c,null));};exports[_0x10d5('0xdb')]=function(_0x120aed,_0x1752df,_0x576c36){var _0x2d42ff={};var _0x1a5d78={};var _0x37cfb8;var _0x209d79;return db[_0x10d5('0x40')]['findOne']({'where':{'id':_0x120aed['params']['id']}})['then'](handleEntityNotFound(_0x1752df,null))[_0x10d5('0x21')](function(_0x4895cc){if(_0x4895cc){_0x37cfb8=_0x4895cc;_0x1a5d78[_0x10d5('0x44')]=_[_0x10d5('0x45')](db[_0x10d5('0xb7')][_0x10d5('0x41')]);_0x1a5d78[_0x10d5('0x46')]=_['keys'](_0x120aed[_0x10d5('0x46')]);_0x1a5d78[_0x10d5('0x47')]=_[_0x10d5('0x48')](_0x1a5d78['model'],_0x1a5d78[_0x10d5('0x46')]);_0x2d42ff[_0x10d5('0x49')]=_[_0x10d5('0x48')](_0x1a5d78[_0x10d5('0x44')],qs['fields'](_0x120aed[_0x10d5('0x46')]['fields']));_0x2d42ff[_0x10d5('0x49')]=_0x2d42ff[_0x10d5('0x49')][_0x10d5('0x4a')]?_0x2d42ff[_0x10d5('0x49')]:_0x1a5d78[_0x10d5('0x44')];_0x2d42ff[_0x10d5('0x6a')]=qs[_0x10d5('0x4d')](_0x120aed[_0x10d5('0x46')][_0x10d5('0x4d')]);_0x2d42ff[_0x10d5('0x4e')]=qs['filters'](_[_0x10d5('0x6b')](_0x120aed['query'],_0x1a5d78['filters']));if(_0x120aed[_0x10d5('0x46')][_0x10d5('0x51')]){_0x2d42ff[_0x10d5('0x4e')]=_[_0x10d5('0x4f')](_0x2d42ff['where'],{'$or':_['map'](_0x2d42ff[_0x10d5('0x49')],function(_0x311dcd){var _0x54206b={};_0x54206b[_0x311dcd]={'$like':'%'+_0x120aed[_0x10d5('0x46')][_0x10d5('0x51')]+'%'};return _0x54206b;})});}_0x2d42ff=_[_0x10d5('0x4f')]({},_0x2d42ff,_0x120aed[_0x10d5('0x52')]);return _0x37cfb8[_0x10d5('0xdb')](_0x2d42ff);}})[_0x10d5('0x21')](function(_0x59cf77){if(_0x59cf77){_0x209d79=_0x59cf77['length'];if(!_0x120aed['query'][_0x10d5('0x4b')](_0x10d5('0x4c'))){_0x2d42ff['limit']=qs[_0x10d5('0x2f')](_0x120aed[_0x10d5('0x46')][_0x10d5('0x2f')]);_0x2d42ff[_0x10d5('0x2e')]=qs[_0x10d5('0x2e')](_0x120aed[_0x10d5('0x46')]['offset']);}return _0x37cfb8[_0x10d5('0xdb')](_0x2d42ff);}})[_0x10d5('0x21')](function(_0xbedde4){if(_0xbedde4){return _0xbedde4?{'count':_0x209d79,'rows':_0xbedde4}:null;}})[_0x10d5('0x21')](respondWithResult(_0x1752df,null))[_0x10d5('0x5b')](handleError(_0x1752df,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 00659d3..df3a14b 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 _0x4a22=['SmsAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xda501a,_0x159d6a){var _0x44be3a=function(_0x5c1c5f){while(--_0x5c1c5f){_0xda501a['push'](_0xda501a['shift']());}};_0x44be3a(++_0x159d6a);}(_0x4a22,0xd0));var _0x24a2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4a22[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0x24a2('0x0'));var SmsAccount=require(_0x24a2('0x1'))['db'][_0x24a2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x24a2('0x3')](0x0);var events={'afterCreate':_0x24a2('0x4'),'afterUpdate':'update','afterDestroy':_0x24a2('0x5')};function emitEvent(_0x55ab81){return function(_0x2cf0e4,_0x1fa003,_0x23eb7f){SmsAccountEvents[_0x24a2('0x6')](_0x55ab81+':'+_0x2cf0e4['id'],_0x2cf0e4);SmsAccountEvents[_0x24a2('0x6')](_0x55ab81,_0x2cf0e4);_0x23eb7f(null);};}for(var e in events){if(events[_0x24a2('0x7')](e)){var event=events[e];SmsAccount[_0x24a2('0x8')](e,emitEvent(event));}}module[_0x24a2('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x6c1e=['update','remove','emit','hasOwnProperty','exports','events','save'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6c1e,0x1da));var _0xe6c1=function(_0x1b7759,_0x2595e0){_0x1b7759=_0x1b7759-0x0;var _0x25e744=_0x6c1e[_0x1b7759];return _0x25e744;};'use strict';var EventEmitter=require(_0xe6c1('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe6c1('0x1'),'afterUpdate':_0xe6c1('0x2'),'afterDestroy':_0xe6c1('0x3')};function emitEvent(_0x561804){return function(_0x44cc14,_0x5476c9,_0x5e7397){SmsAccountEvents['emit'](_0x561804+':'+_0x44cc14['id'],_0x44cc14);SmsAccountEvents[_0xe6c1('0x4')](_0x561804,_0x44cc14);_0x5e7397(null);};}for(var e in events){if(events[_0xe6c1('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xe6c1('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 166420b..855c2de 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 _0x5a4d=['lodash','util','api','moment','bluebird','request-promise','path','./smsAccount.attributes','define'];(function(_0x20729c,_0x389a53){var _0xbf6003=function(_0x65b534){while(--_0x65b534){_0x20729c['push'](_0x20729c['shift']());}};_0xbf6003(++_0x389a53);}(_0x5a4d,0x1c2));var _0xd5a4=function(_0xd2f73d,_0x1deadf){_0xd2f73d=_0xd2f73d-0x0;var _0x5adfa7=_0x5a4d[_0xd2f73d];return _0x5adfa7;};'use strict';var _=require(_0xd5a4('0x0'));var util=require(_0xd5a4('0x1'));var logger=require('../../config/logger')(_0xd5a4('0x2'));var moment=require(_0xd5a4('0x3'));var BPromise=require(_0xd5a4('0x4'));var rp=require(_0xd5a4('0x5'));var fs=require('fs');var path=require(_0xd5a4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd5a4('0x7'));module['exports']=function(_0x25ad4e,_0x5cae9e){return _0x25ad4e[_0xd5a4('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22f7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts'];(function(_0x41b62a,_0x13d23e){var _0x429f38=function(_0x1d9198){while(--_0x1d9198){_0x41b62a['push'](_0x41b62a['shift']());}};_0x429f38(++_0x13d23e);}(_0x22f7,0x96));var _0x722f=function(_0x589be4,_0x5787ad){_0x589be4=_0x589be4-0x0;var _0x31de5d=_0x22f7[_0x589be4];return _0x31de5d;};'use strict';var _=require(_0x722f('0x0'));var util=require(_0x722f('0x1'));var logger=require(_0x722f('0x2'))(_0x722f('0x3'));var moment=require(_0x722f('0x4'));var BPromise=require(_0x722f('0x5'));var rp=require(_0x722f('0x6'));var fs=require('fs');var path=require(_0x722f('0x7'));var rimraf=require(_0x722f('0x8'));var config=require(_0x722f('0x9'));var attributes=require(_0x722f('0xa'));module[_0x722f('0xb')]=function(_0x56a345,_0x4b56be){return _0x56a345[_0x722f('0xc')](_0x722f('0xd'),attributes,{'tableName':_0x722f('0xe'),'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 8b7a3bb..da104b8 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 _0x14c7=['result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','attributes','model','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x14c7,0x1ee));var _0x714c=function(_0x4d660f,_0x39cbd2){_0x4d660f=_0x4d660f-0x0;var _0x2ead6=_0x14c7[_0x4d660f];return _0x2ead6;};'use strict';var _=require(_0x714c('0x0'));var util=require(_0x714c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x714c('0x2'));var fs=require('fs');var Redis=require(_0x714c('0x3'));var db=require(_0x714c('0x4'))['db'];var utils=require(_0x714c('0x5'));var logger=require(_0x714c('0x6'))(_0x714c('0x7'));var config=require(_0x714c('0x8'));var jayson=require(_0x714c('0x9'));var client=jayson[_0x714c('0xa')]['http']({'port':0x232a});config[_0x714c('0xb')]=_[_0x714c('0xc')](config[_0x714c('0xb')],{'host':_0x714c('0xd'),'port':0x18eb});var socket=require(_0x714c('0xe'))(new Redis(config[_0x714c('0xb')]));require('./smsAccount.socket')[_0x714c('0xf')](socket);function respondWithRpcPromise(_0x5e260a,_0x4d06ae,_0x14f9e5){return new BPromise(function(_0x243279,_0xc8831e){return client[_0x714c('0x10')](_0x5e260a,_0x14f9e5)[_0x714c('0x11')](function(_0x200f20){logger[_0x714c('0x12')](_0x714c('0x13'),_0x4d06ae,_0x714c('0x14'));logger['debug'](_0x714c('0x15'),_0x4d06ae,_0x714c('0x14'),JSON[_0x714c('0x16')](_0x200f20));if(_0x200f20[_0x714c('0x17')]){if(_0x200f20['error']['code']===0x1f4){logger[_0x714c('0x17')](_0x714c('0x13'),_0x4d06ae,_0x200f20[_0x714c('0x17')]['message']);return _0xc8831e(_0x200f20[_0x714c('0x17')]['message']);}logger[_0x714c('0x17')](_0x714c('0x13'),_0x4d06ae,_0x200f20['error']['message']);return _0x243279(_0x200f20[_0x714c('0x17')]['message']);}else{logger[_0x714c('0x12')]('SmsAccount,\x20%s,\x20%s',_0x4d06ae,_0x714c('0x14'));_0x243279(_0x200f20[_0x714c('0x18')]['message']);}})[_0x714c('0x19')](function(_0x214782){logger['error'](_0x714c('0x13'),_0x4d06ae,_0x214782);_0xc8831e(_0x214782);});});}exports[_0x714c('0x1a')]=function(_0x3ecb54){var _0x3b9cba=this;return new Promise(function(_0x246e56,_0x3370cb){return db[_0x714c('0x1b')][_0x714c('0x1c')]({'raw':_0x3ecb54[_0x714c('0x1d')]?_0x3ecb54['options'][_0x714c('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ecb54['options']?_0x3ecb54[_0x714c('0x1d')][_0x714c('0x1f')]||null:null,'attributes':_0x3ecb54[_0x714c('0x1d')]?_0x3ecb54[_0x714c('0x1d')]['attributes']||null:null,'include':_0x3ecb54[_0x714c('0x1d')]?_0x3ecb54[_0x714c('0x1d')][_0x714c('0x20')]?_[_0x714c('0x21')](_0x3ecb54[_0x714c('0x1d')][_0x714c('0x20')],function(_0x838752){return{'model':db[_0x838752['model']],'as':_0x838752['as'],'attributes':_0x838752[_0x714c('0x22')],'include':_0x838752[_0x714c('0x20')]?_['map'](_0x838752[_0x714c('0x20')],function(_0x2890b0){return{'model':db[_0x2890b0[_0x714c('0x23')]],'as':_0x2890b0['as'],'attributes':_0x2890b0['attributes'],'include':_0x2890b0[_0x714c('0x20')]?_['map'](_0x2890b0[_0x714c('0x20')],function(_0x530c6e){return{'model':db[_0x530c6e[_0x714c('0x23')]],'as':_0x530c6e['as'],'attributes':_0x530c6e['attributes']};}):[]};}):[]};}):[]:[]})[_0x714c('0x11')](function(_0x51d622){logger[_0x714c('0x12')]('ShowSmsAccount',_0x3ecb54);logger['debug'](_0x714c('0x1a'),_0x3ecb54,JSON[_0x714c('0x16')](_0x51d622));_0x246e56(_0x51d622);})[_0x714c('0x19')](function(_0x190468){logger['error'](_0x714c('0x1a'),_0x190468[_0x714c('0x24')],_0x3ecb54);_0x3370cb(_0x3b9cba[_0x714c('0x17')](0x1f4,_0x190468[_0x714c('0x24')]));});});}; \ No newline at end of file +var _0x8be7=['error','code','message','result','ShowSmsAccount','SmsAccount','options','where','attributes','map','include','model','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5a28a8,_0x2ff358){var _0x5ab787=function(_0x4b8b38){while(--_0x4b8b38){_0x5a28a8['push'](_0x5a28a8['shift']());}};_0x5ab787(++_0x2ff358);}(_0x8be7,0x1db));var _0x78be=function(_0x699072,_0x3aca68){_0x699072=_0x699072-0x0;var _0x44edc2=_0x8be7[_0x699072];return _0x44edc2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78be('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78be('0x1'));var db=require(_0x78be('0x2'))['db'];var utils=require(_0x78be('0x3'));var logger=require(_0x78be('0x4'))(_0x78be('0x5'));var config=require('../../config/environment');var jayson=require(_0x78be('0x6'));var client=jayson[_0x78be('0x7')][_0x78be('0x8')]({'port':0x232a});config['redis']=_[_0x78be('0x9')](config[_0x78be('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x78be('0xb'))(new Redis(config[_0x78be('0xa')]));require(_0x78be('0xc'))[_0x78be('0xd')](socket);function respondWithRpcPromise(_0x1b9e0a,_0xb82de5,_0x4d339f){return new BPromise(function(_0x2b438e,_0x597e6d){return client['request'](_0x1b9e0a,_0x4d339f)[_0x78be('0xe')](function(_0x25725d){logger[_0x78be('0xf')](_0x78be('0x10'),_0xb82de5,_0x78be('0x11'));logger[_0x78be('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb82de5,_0x78be('0x11'),JSON[_0x78be('0x13')](_0x25725d));if(_0x25725d['error']){if(_0x25725d[_0x78be('0x14')][_0x78be('0x15')]===0x1f4){logger[_0x78be('0x14')](_0x78be('0x10'),_0xb82de5,_0x25725d[_0x78be('0x14')][_0x78be('0x16')]);return _0x597e6d(_0x25725d[_0x78be('0x14')][_0x78be('0x16')]);}logger[_0x78be('0x14')](_0x78be('0x10'),_0xb82de5,_0x25725d[_0x78be('0x14')][_0x78be('0x16')]);return _0x2b438e(_0x25725d[_0x78be('0x14')][_0x78be('0x16')]);}else{logger[_0x78be('0xf')](_0x78be('0x10'),_0xb82de5,_0x78be('0x11'));_0x2b438e(_0x25725d[_0x78be('0x17')]['message']);}})['catch'](function(_0x33d20d){logger['error'](_0x78be('0x10'),_0xb82de5,_0x33d20d);_0x597e6d(_0x33d20d);});});}exports[_0x78be('0x18')]=function(_0x53cefa){var _0x5081d9=this;return new Promise(function(_0x15b4cc,_0x1d878a){return db[_0x78be('0x19')]['find']({'raw':_0x53cefa[_0x78be('0x1a')]?_0x53cefa[_0x78be('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x53cefa[_0x78be('0x1a')]?_0x53cefa['options'][_0x78be('0x1b')]||null:null,'attributes':_0x53cefa[_0x78be('0x1a')]?_0x53cefa[_0x78be('0x1a')][_0x78be('0x1c')]||null:null,'include':_0x53cefa[_0x78be('0x1a')]?_0x53cefa[_0x78be('0x1a')]['include']?_[_0x78be('0x1d')](_0x53cefa[_0x78be('0x1a')][_0x78be('0x1e')],function(_0xae1bbc){return{'model':db[_0xae1bbc['model']],'as':_0xae1bbc['as'],'attributes':_0xae1bbc[_0x78be('0x1c')],'include':_0xae1bbc[_0x78be('0x1e')]?_[_0x78be('0x1d')](_0xae1bbc[_0x78be('0x1e')],function(_0x3c5c08){return{'model':db[_0x3c5c08[_0x78be('0x1f')]],'as':_0x3c5c08['as'],'attributes':_0x3c5c08[_0x78be('0x1c')],'include':_0x3c5c08[_0x78be('0x1e')]?_[_0x78be('0x1d')](_0x3c5c08['include'],function(_0x4a812e){return{'model':db[_0x4a812e['model']],'as':_0x4a812e['as'],'attributes':_0x4a812e['attributes']};}):[]};}):[]};}):[]:[]})[_0x78be('0xe')](function(_0x419e72){logger[_0x78be('0xf')](_0x78be('0x18'),_0x53cefa);logger['debug']('ShowSmsAccount',_0x53cefa,JSON[_0x78be('0x13')](_0x419e72));_0x15b4cc(_0x419e72);})[_0x78be('0x20')](function(_0x2d64ee){logger[_0x78be('0x14')](_0x78be('0x18'),_0x2d64ee[_0x78be('0x16')],_0x53cefa);_0x1d878a(_0x5081d9[_0x78be('0x14')](0x1f4,_0x2d64ee[_0x78be('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b9862ff..e06144d 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 792cb83..a027697 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x4de83e,_0x1f5a30){var _0x30f579=function(_0x10a76c){while(--_0x10a76c){_0x4de83e['push'](_0x4de83e['shift']());}};_0x30f579(++_0x1f5a30);}(_0x55ca,0x126));var _0xa55c=function(_0xcc26d2,_0x20c921){_0xcc26d2=_0xcc26d2-0x0;var _0x3841e2=_0x55ca[_0xcc26d2];return _0x3841e2;};'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['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x401ca7,_0x4dbaea){var _0x184eea=function(_0x4f02ca){while(--_0x4f02ca){_0x401ca7['push'](_0x401ca7['shift']());}};_0x184eea(++_0x4dbaea);}(_0xedd9,0xfc));var _0x9edd=function(_0x18d997,_0x2d08ed){_0x18d997=_0x18d997-0x0;var _0x43ac1c=_0xedd9[_0x18d997];return _0x43ac1c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index e74d0f6..b7364b1 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 _0x5484=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x5484,0x11f));var _0x4548=function(_0xdc6281,_0x327b68){_0xdc6281=_0xdc6281-0x0;var _0x21c3aa=_0x5484[_0xdc6281];return _0x21c3aa;};'use strict';var Sequelize=require('sequelize');module[_0x4548('0x0')]={'priority':{'type':Sequelize[_0x4548('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4548('0x2')],'allowNull':![],'defaultValue':_0x4548('0x3')},'appdata':{'type':Sequelize[_0x4548('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4548('0x2')],'defaultValue':_0x4548('0x5')}}; \ No newline at end of file +var _0x92db=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x4c60aa,_0x13de95){var _0x3bcadc=function(_0x42d27d){while(--_0x42d27d){_0x4c60aa['push'](_0x4c60aa['shift']());}};_0x3bcadc(++_0x13de95);}(_0x92db,0x111));var _0xb92d=function(_0x5333d2,_0x18a49d){_0x5333d2=_0x5333d2-0x0;var _0x342179=_0x92db[_0x5333d2];return _0x342179;};'use strict';var Sequelize=require('sequelize');module[_0xb92d('0x0')]={'priority':{'type':Sequelize[_0xb92d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb92d('0x2')],'allowNull':![],'defaultValue':_0xb92d('0x3')},'appdata':{'type':Sequelize[_0xb92d('0x4')]()},'description':{'type':Sequelize[_0xb92d('0x2')]},'interval':{'type':Sequelize[_0xb92d('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 2b49dfc..ab20a80 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 _0xf435=['../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x2cb111,_0x3c5f83){var _0x52d31d=function(_0x39395e){while(--_0x39395e){_0x2cb111['push'](_0x2cb111['shift']());}};_0x52d31d(++_0x3c5f83);}(_0xf435,0x1df));var _0x5f43=function(_0x447e36,_0x5078a7){_0x447e36=_0x447e36-0x0;var _0x95f06=_0xf435[_0x447e36];return _0x95f06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f43('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f43('0x1'));var rp=require(_0x5f43('0x2'));var moment=require(_0x5f43('0x3'));var BPromise=require(_0x5f43('0x4'));var Mustache=require(_0x5f43('0x5'));var util=require(_0x5f43('0x6'));var path=require(_0x5f43('0x7'));var sox=require(_0x5f43('0x8'));var csv=require(_0x5f43('0x9'));var ejs=require(_0x5f43('0xa'));var fs=require('fs');var fs_extra=require(_0x5f43('0xb'));var _=require('lodash');var squel=require(_0x5f43('0xc'));var crypto=require('crypto');var jsforce=require(_0x5f43('0xd'));var deskjs=require(_0x5f43('0xe'));var toCsv=require(_0x5f43('0x9'));var querystring=require(_0x5f43('0xf'));var Papa=require('papaparse');var Redis=require(_0x5f43('0x10'));var authService=require(_0x5f43('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5f43('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f43('0x13'));var utils=require('../../config/utils');var config=require(_0x5f43('0x14'));var licenseUtil=require(_0x5f43('0x15'));var db=require(_0x5f43('0x16'))['db'];function respondWithStatusCode(_0xce46a8,_0x547da5){_0x547da5=_0x547da5||0xcc;return function(_0x4a6379){if(_0x4a6379){return _0xce46a8[_0x5f43('0x17')](_0x547da5);}return _0xce46a8[_0x5f43('0x18')](_0x547da5)[_0x5f43('0x19')]();};}function respondWithResult(_0x3a9227,_0x19277e){_0x19277e=_0x19277e||0xc8;return function(_0x46dbae){if(_0x46dbae){return _0x3a9227[_0x5f43('0x18')](_0x19277e)[_0x5f43('0x1a')](_0x46dbae);}};}function respondWithFilteredResult(_0xa92414,_0x4b1f2f){return function(_0x4193d1){if(_0x4193d1){var _0x3bd586=typeof _0x4b1f2f[_0x5f43('0x1b')]===_0x5f43('0x1c')&&typeof _0x4b1f2f[_0x5f43('0x1d')]==='undefined';var _0xa065b2=_0x4193d1[_0x5f43('0x1e')];var _0x5aff0d=_0x3bd586?0x0:_0x4b1f2f[_0x5f43('0x1b')];var _0x2f13df=_0x3bd586?_0x4193d1[_0x5f43('0x1e')]:_0x4b1f2f['offset']+_0x4b1f2f['limit'];var _0x231e49;if(_0x2f13df>=_0xa065b2){_0x2f13df=_0xa065b2;_0x231e49=0xc8;}else{_0x231e49=0xce;}_0xa92414[_0x5f43('0x18')](_0x231e49);return _0xa92414['set'](_0x5f43('0x1f'),_0x5aff0d+'-'+_0x2f13df+'/'+_0xa065b2)['json'](_0x4193d1);}return null;};}function patchUpdates(_0x2a1cfe){return function(_0x2e75a5){try{jsonpatch[_0x5f43('0x20')](_0x2e75a5,_0x2a1cfe,!![]);}catch(_0x3ed05c){return BPromise['reject'](_0x3ed05c);}return _0x2e75a5['save']();};}function saveUpdates(_0x830d1c,_0x1421a4){return function(_0x17cff8){if(_0x17cff8){return _0x17cff8[_0x5f43('0x21')](_0x830d1c)[_0x5f43('0x22')](function(_0x3efd2c){return _0x3efd2c;});}return null;};}function removeEntity(_0x543cb9,_0x10d71c){return function(_0xf5b4af){if(_0xf5b4af){return _0xf5b4af['destroy']()[_0x5f43('0x22')](function(){_0x543cb9[_0x5f43('0x18')](0xcc)[_0x5f43('0x19')]();});}};}function handleEntityNotFound(_0x1204c1,_0x4c2e5d){return function(_0x3af6d3){if(!_0x3af6d3){_0x1204c1[_0x5f43('0x17')](0x194);}return _0x3af6d3;};}function handleError(_0xc8409c,_0x359d39){_0x359d39=_0x359d39||0x1f4;return function(_0x568bd9){logger[_0x5f43('0x23')](_0x568bd9[_0x5f43('0x24')]);if(_0x568bd9[_0x5f43('0x25')]){delete _0x568bd9[_0x5f43('0x25')];}_0xc8409c[_0x5f43('0x18')](_0x359d39)[_0x5f43('0x26')](_0x568bd9);};}exports['index']=function(_0x23a986,_0x3792be){var _0x153d0c={},_0x2ccb9c={},_0xa7a8f={'count':0x0,'rows':[]};var _0x12f13b=_[_0x5f43('0x27')](db[_0x5f43('0x28')][_0x5f43('0x29')],function(_0xc163da){return{'name':_0xc163da[_0x5f43('0x2a')],'type':_0xc163da[_0x5f43('0x2b')][_0x5f43('0x2c')]};});_0x2ccb9c[_0x5f43('0x2d')]=_[_0x5f43('0x27')](_0x12f13b,_0x5f43('0x25'));_0x2ccb9c[_0x5f43('0x2e')]=_[_0x5f43('0x2f')](_0x23a986[_0x5f43('0x2e')]);_0x2ccb9c[_0x5f43('0x30')]=_['intersection'](_0x2ccb9c[_0x5f43('0x2d')],_0x2ccb9c[_0x5f43('0x2e')]);_0x153d0c['attributes']=_[_0x5f43('0x31')](_0x2ccb9c[_0x5f43('0x2d')],qs['fields'](_0x23a986['query'][_0x5f43('0x32')]));_0x153d0c['attributes']=_0x153d0c[_0x5f43('0x33')][_0x5f43('0x34')]?_0x153d0c[_0x5f43('0x33')]:_0x2ccb9c[_0x5f43('0x2d')];if(!_0x23a986[_0x5f43('0x2e')][_0x5f43('0x35')](_0x5f43('0x36'))){_0x153d0c[_0x5f43('0x1d')]=qs[_0x5f43('0x1d')](_0x23a986['query'][_0x5f43('0x1d')]);_0x153d0c[_0x5f43('0x1b')]=qs[_0x5f43('0x1b')](_0x23a986[_0x5f43('0x2e')][_0x5f43('0x1b')]);}_0x153d0c['order']=qs[_0x5f43('0x37')](_0x23a986['query'][_0x5f43('0x37')]);_0x153d0c[_0x5f43('0x38')]=qs['filters'](_['pick'](_0x23a986[_0x5f43('0x2e')],_0x2ccb9c['filters']),_0x12f13b);if(_0x23a986['query'][_0x5f43('0x39')]){_0x153d0c[_0x5f43('0x38')]=_[_0x5f43('0x3a')](_0x153d0c[_0x5f43('0x38')],{'$or':_['map'](_0x12f13b,function(_0x41ae6c){if(_0x41ae6c[_0x5f43('0x2b')]!==_0x5f43('0x3b')){var _0x2b9814={};_0x2b9814[_0x41ae6c[_0x5f43('0x25')]]={'$like':'%'+_0x23a986[_0x5f43('0x2e')][_0x5f43('0x39')]+'%'};return _0x2b9814;}})});}_0x153d0c=_['merge']({},_0x153d0c,_0x23a986[_0x5f43('0x3c')]);var _0x2e086={'where':_0x153d0c['where']};return db[_0x5f43('0x28')][_0x5f43('0x1e')](_0x2e086)['then'](function(_0x58a473){_0xa7a8f[_0x5f43('0x1e')]=_0x58a473;if(_0x23a986[_0x5f43('0x2e')][_0x5f43('0x3d')]){_0x153d0c[_0x5f43('0x3e')]=[{'all':!![]}];}return db[_0x5f43('0x28')][_0x5f43('0x3f')](_0x153d0c);})[_0x5f43('0x22')](function(_0x3b22ab){_0xa7a8f['rows']=_0x3b22ab;return _0xa7a8f;})[_0x5f43('0x22')](respondWithFilteredResult(_0x3792be,_0x153d0c))[_0x5f43('0x40')](handleError(_0x3792be,null));};exports[_0x5f43('0x41')]=function(_0x113aac,_0x41cf38){var _0x4e9f72={'raw':!![],'where':{'id':_0x113aac[_0x5f43('0x42')]['id']}},_0xdbd347={};_0xdbd347['model']=_[_0x5f43('0x2f')](db[_0x5f43('0x28')][_0x5f43('0x29')]);_0xdbd347[_0x5f43('0x2e')]=_[_0x5f43('0x2f')](_0x113aac[_0x5f43('0x2e')]);_0xdbd347[_0x5f43('0x30')]=_[_0x5f43('0x31')](_0xdbd347[_0x5f43('0x2d')],_0xdbd347['query']);_0x4e9f72[_0x5f43('0x33')]=_[_0x5f43('0x31')](_0xdbd347[_0x5f43('0x2d')],qs[_0x5f43('0x32')](_0x113aac[_0x5f43('0x2e')][_0x5f43('0x32')]));_0x4e9f72[_0x5f43('0x33')]=_0x4e9f72[_0x5f43('0x33')][_0x5f43('0x34')]?_0x4e9f72[_0x5f43('0x33')]:_0xdbd347[_0x5f43('0x2d')];if(_0x113aac['query']['includeAll']){_0x4e9f72[_0x5f43('0x3e')]=[{'all':!![]}];}_0x4e9f72=_[_0x5f43('0x3a')]({},_0x4e9f72,_0x113aac[_0x5f43('0x3c')]);return db[_0x5f43('0x28')]['find'](_0x4e9f72)[_0x5f43('0x22')](handleEntityNotFound(_0x41cf38,null))['then'](respondWithResult(_0x41cf38,null))[_0x5f43('0x40')](handleError(_0x41cf38,null));};exports[_0x5f43('0x43')]=function(_0x50a1b4,_0x4e933c){return db[_0x5f43('0x28')]['create'](_0x50a1b4[_0x5f43('0x44')],{})['then'](respondWithResult(_0x4e933c,0xc9))[_0x5f43('0x40')](handleError(_0x4e933c,null));};exports[_0x5f43('0x21')]=function(_0x57e800,_0xc38c43){if(_0x57e800[_0x5f43('0x44')]['id']){delete _0x57e800['body']['id'];}return db[_0x5f43('0x28')][_0x5f43('0x45')]({'where':{'id':_0x57e800[_0x5f43('0x42')]['id']}})[_0x5f43('0x22')](handleEntityNotFound(_0xc38c43,null))[_0x5f43('0x22')](saveUpdates(_0x57e800[_0x5f43('0x44')],null))[_0x5f43('0x22')](respondWithResult(_0xc38c43,null))[_0x5f43('0x40')](handleError(_0xc38c43,null));};exports[_0x5f43('0x46')]=function(_0x20da5a,_0x5df5e6){return db[_0x5f43('0x28')][_0x5f43('0x45')]({'where':{'id':_0x20da5a[_0x5f43('0x42')]['id']}})[_0x5f43('0x22')](handleEntityNotFound(_0x5df5e6,null))['then'](removeEntity(_0x5df5e6,null))[_0x5f43('0x40')](handleError(_0x5df5e6,null));}; \ No newline at end of file +var _0x3757=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','limit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','SmsApplication','params','include','catch','create','body','find','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x548664,_0x185bf3){var _0x443e62=function(_0x50f4ca){while(--_0x50f4ca){_0x548664['push'](_0x548664['shift']());}};_0x443e62(++_0x185bf3);}(_0x3757,0x152));var _0x7375=function(_0x2f806a,_0x357a90){_0x2f806a=_0x2f806a-0x0;var _0x323efa=_0x3757[_0x2f806a];return _0x323efa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7375('0x0'));var rp=require(_0x7375('0x1'));var moment=require(_0x7375('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7375('0x3'));var util=require(_0x7375('0x4'));var path=require(_0x7375('0x5'));var sox=require(_0x7375('0x6'));var csv=require(_0x7375('0x7'));var ejs=require(_0x7375('0x8'));var fs=require('fs');var fs_extra=require(_0x7375('0x9'));var _=require(_0x7375('0xa'));var squel=require(_0x7375('0xb'));var crypto=require(_0x7375('0xc'));var jsforce=require(_0x7375('0xd'));var deskjs=require(_0x7375('0xe'));var toCsv=require(_0x7375('0x7'));var querystring=require(_0x7375('0xf'));var Papa=require(_0x7375('0x10'));var Redis=require(_0x7375('0x11'));var authService=require(_0x7375('0x12'));var qs=require(_0x7375('0x13'));var as=require(_0x7375('0x14'));var hardwareService=require(_0x7375('0x15'));var logger=require(_0x7375('0x16'))(_0x7375('0x17'));var utils=require('../../config/utils');var config=require(_0x7375('0x18'));var licenseUtil=require(_0x7375('0x19'));var db=require(_0x7375('0x1a'))['db'];function respondWithStatusCode(_0x5ef9e2,_0x2fc4d3){_0x2fc4d3=_0x2fc4d3||0xcc;return function(_0x45f025){if(_0x45f025){return _0x5ef9e2['sendStatus'](_0x2fc4d3);}return _0x5ef9e2[_0x7375('0x1b')](_0x2fc4d3)[_0x7375('0x1c')]();};}function respondWithResult(_0x2b0460,_0x5064e4){_0x5064e4=_0x5064e4||0xc8;return function(_0x2f95f6){if(_0x2f95f6){return _0x2b0460[_0x7375('0x1b')](_0x5064e4)['json'](_0x2f95f6);}};}function respondWithFilteredResult(_0x57948a,_0x4051d5){return function(_0x46e9de){if(_0x46e9de){var _0x55d5b3=typeof _0x4051d5[_0x7375('0x1d')]===_0x7375('0x1e')&&typeof _0x4051d5['limit']===_0x7375('0x1e');var _0xdee941=_0x46e9de[_0x7375('0x1f')];var _0x1270f9=_0x55d5b3?0x0:_0x4051d5[_0x7375('0x1d')];var _0x4a9722=_0x55d5b3?_0x46e9de[_0x7375('0x1f')]:_0x4051d5[_0x7375('0x1d')]+_0x4051d5['limit'];var _0x3fc3e5;if(_0x4a9722>=_0xdee941){_0x4a9722=_0xdee941;_0x3fc3e5=0xc8;}else{_0x3fc3e5=0xce;}_0x57948a['status'](_0x3fc3e5);return _0x57948a[_0x7375('0x20')](_0x7375('0x21'),_0x1270f9+'-'+_0x4a9722+'/'+_0xdee941)[_0x7375('0x22')](_0x46e9de);}return null;};}function patchUpdates(_0x30e897){return function(_0x33fad2){try{jsonpatch[_0x7375('0x23')](_0x33fad2,_0x30e897,!![]);}catch(_0x4105b0){return BPromise[_0x7375('0x24')](_0x4105b0);}return _0x33fad2['save']();};}function saveUpdates(_0x29d881,_0x500240){return function(_0x4ef4f7){if(_0x4ef4f7){return _0x4ef4f7[_0x7375('0x25')](_0x29d881)[_0x7375('0x26')](function(_0x590db5){return _0x590db5;});}return null;};}function removeEntity(_0xaca2f1,_0x56e3fd){return function(_0x28fe7f){if(_0x28fe7f){return _0x28fe7f['destroy']()['then'](function(){_0xaca2f1[_0x7375('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc6425,_0x47586d){return function(_0x578a4e){if(!_0x578a4e){_0xfc6425['sendStatus'](0x194);}return _0x578a4e;};}function handleError(_0x49e08b,_0x2abd4c){_0x2abd4c=_0x2abd4c||0x1f4;return function(_0x5574dc){logger[_0x7375('0x27')](_0x5574dc[_0x7375('0x28')]);if(_0x5574dc[_0x7375('0x29')]){delete _0x5574dc[_0x7375('0x29')];}_0x49e08b[_0x7375('0x1b')](_0x2abd4c)[_0x7375('0x2a')](_0x5574dc);};}exports['index']=function(_0x3fd2bd,_0x42250d){var _0x1153c7={},_0x2b112a={},_0x22cdb5={'count':0x0,'rows':[]};var _0x4dc8a4=_[_0x7375('0x2b')](db['SmsApplication'][_0x7375('0x2c')],function(_0x4b610d){return{'name':_0x4b610d[_0x7375('0x2d')],'type':_0x4b610d[_0x7375('0x2e')]['key']};});_0x2b112a[_0x7375('0x2f')]=_[_0x7375('0x2b')](_0x4dc8a4,'name');_0x2b112a[_0x7375('0x30')]=_[_0x7375('0x31')](_0x3fd2bd['query']);_0x2b112a['filters']=_[_0x7375('0x32')](_0x2b112a[_0x7375('0x2f')],_0x2b112a[_0x7375('0x30')]);_0x1153c7[_0x7375('0x33')]=_[_0x7375('0x32')](_0x2b112a[_0x7375('0x2f')],qs[_0x7375('0x34')](_0x3fd2bd[_0x7375('0x30')][_0x7375('0x34')]));_0x1153c7[_0x7375('0x33')]=_0x1153c7['attributes'][_0x7375('0x35')]?_0x1153c7[_0x7375('0x33')]:_0x2b112a[_0x7375('0x2f')];if(!_0x3fd2bd[_0x7375('0x30')]['hasOwnProperty']('nolimit')){_0x1153c7['limit']=qs[_0x7375('0x36')](_0x3fd2bd[_0x7375('0x30')][_0x7375('0x36')]);_0x1153c7[_0x7375('0x1d')]=qs[_0x7375('0x1d')](_0x3fd2bd['query'][_0x7375('0x1d')]);}_0x1153c7[_0x7375('0x37')]=qs['sort'](_0x3fd2bd[_0x7375('0x30')][_0x7375('0x38')]);_0x1153c7['where']=qs[_0x7375('0x39')](_['pick'](_0x3fd2bd[_0x7375('0x30')],_0x2b112a['filters']),_0x4dc8a4);if(_0x3fd2bd[_0x7375('0x30')][_0x7375('0x3a')]){_0x1153c7[_0x7375('0x3b')]=_['merge'](_0x1153c7[_0x7375('0x3b')],{'$or':_[_0x7375('0x2b')](_0x4dc8a4,function(_0x156d2d){if(_0x156d2d[_0x7375('0x2e')]!==_0x7375('0x3c')){var _0x547229={};_0x547229[_0x156d2d[_0x7375('0x29')]]={'$like':'%'+_0x3fd2bd['query']['filter']+'%'};return _0x547229;}})});}_0x1153c7=_[_0x7375('0x3d')]({},_0x1153c7,_0x3fd2bd[_0x7375('0x3e')]);var _0x2cb95d={'where':_0x1153c7[_0x7375('0x3b')]};return db['SmsApplication']['count'](_0x2cb95d)[_0x7375('0x26')](function(_0x26f5e0){_0x22cdb5[_0x7375('0x1f')]=_0x26f5e0;if(_0x3fd2bd[_0x7375('0x30')][_0x7375('0x3f')]){_0x1153c7['include']=[{'all':!![]}];}return db[_0x7375('0x40')]['findAll'](_0x1153c7);})[_0x7375('0x26')](function(_0x49516b){_0x22cdb5['rows']=_0x49516b;return _0x22cdb5;})[_0x7375('0x26')](respondWithFilteredResult(_0x42250d,_0x1153c7))['catch'](handleError(_0x42250d,null));};exports['show']=function(_0x3cfe13,_0x4cf464){var _0x59835f={'raw':!![],'where':{'id':_0x3cfe13[_0x7375('0x41')]['id']}},_0x17ea78={};_0x17ea78['model']=_[_0x7375('0x31')](db['SmsApplication'][_0x7375('0x2c')]);_0x17ea78[_0x7375('0x30')]=_[_0x7375('0x31')](_0x3cfe13[_0x7375('0x30')]);_0x17ea78[_0x7375('0x39')]=_[_0x7375('0x32')](_0x17ea78[_0x7375('0x2f')],_0x17ea78[_0x7375('0x30')]);_0x59835f['attributes']=_['intersection'](_0x17ea78[_0x7375('0x2f')],qs[_0x7375('0x34')](_0x3cfe13[_0x7375('0x30')][_0x7375('0x34')]));_0x59835f['attributes']=_0x59835f[_0x7375('0x33')][_0x7375('0x35')]?_0x59835f[_0x7375('0x33')]:_0x17ea78[_0x7375('0x2f')];if(_0x3cfe13[_0x7375('0x30')][_0x7375('0x3f')]){_0x59835f[_0x7375('0x42')]=[{'all':!![]}];}_0x59835f=_[_0x7375('0x3d')]({},_0x59835f,_0x3cfe13[_0x7375('0x3e')]);return db[_0x7375('0x40')]['find'](_0x59835f)[_0x7375('0x26')](handleEntityNotFound(_0x4cf464,null))[_0x7375('0x26')](respondWithResult(_0x4cf464,null))[_0x7375('0x43')](handleError(_0x4cf464,null));};exports[_0x7375('0x44')]=function(_0x2690d7,_0x142a4f){return db[_0x7375('0x40')]['create'](_0x2690d7[_0x7375('0x45')],{})[_0x7375('0x26')](respondWithResult(_0x142a4f,0xc9))[_0x7375('0x43')](handleError(_0x142a4f,null));};exports[_0x7375('0x25')]=function(_0x4293c1,_0x3996c7){if(_0x4293c1[_0x7375('0x45')]['id']){delete _0x4293c1[_0x7375('0x45')]['id'];}return db['SmsApplication'][_0x7375('0x46')]({'where':{'id':_0x4293c1[_0x7375('0x41')]['id']}})['then'](handleEntityNotFound(_0x3996c7,null))[_0x7375('0x26')](saveUpdates(_0x4293c1[_0x7375('0x45')],null))[_0x7375('0x26')](respondWithResult(_0x3996c7,null))[_0x7375('0x43')](handleError(_0x3996c7,null));};exports['destroy']=function(_0x4ffd9d,_0x371280){return db[_0x7375('0x40')][_0x7375('0x46')]({'where':{'id':_0x4ffd9d[_0x7375('0x41')]['id']}})[_0x7375('0x26')](handleEntityNotFound(_0x371280,null))[_0x7375('0x26')](removeEntity(_0x371280,null))['catch'](handleError(_0x371280,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 887ceae..332e6ae 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 _0xac8b=['sms_applications','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x48e682,_0x50d65b){var _0x148afc=function(_0x4c7bd4){while(--_0x4c7bd4){_0x48e682['push'](_0x48e682['shift']());}};_0x148afc(++_0x50d65b);}(_0xac8b,0x1c2));var _0xbac8=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xac8b[_0x45f951];return _0x24756c;};'use strict';var _=require('lodash');var util=require(_0xbac8('0x0'));var logger=require(_0xbac8('0x1'))('api');var moment=require(_0xbac8('0x2'));var BPromise=require(_0xbac8('0x3'));var rp=require(_0xbac8('0x4'));var fs=require('fs');var path=require(_0xbac8('0x5'));var rimraf=require(_0xbac8('0x6'));var config=require(_0xbac8('0x7'));var attributes=require(_0xbac8('0x8'));module[_0xbac8('0x9')]=function(_0x329e46,_0x2c9733){return _0x329e46[_0xbac8('0xa')](_0xbac8('0xb'),attributes,{'tableName':_0xbac8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbac8('0xd')});}; \ No newline at end of file +var _0xb3a1=['api','moment','bluebird','request-promise','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x4ee936,_0x160661){var _0x22b4cb=function(_0x44268f){while(--_0x44268f){_0x4ee936['push'](_0x4ee936['shift']());}};_0x22b4cb(++_0x160661);}(_0xb3a1,0xf9));var _0x1b3a=function(_0x102a48,_0xa47f8a){_0x102a48=_0x102a48-0x0;var _0x4dddb6=_0xb3a1[_0x102a48];return _0x4dddb6;};'use strict';var _=require(_0x1b3a('0x0'));var util=require(_0x1b3a('0x1'));var logger=require(_0x1b3a('0x2'))(_0x1b3a('0x3'));var moment=require(_0x1b3a('0x4'));var BPromise=require(_0x1b3a('0x5'));var rp=require(_0x1b3a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x1b3a('0x7')]=function(_0x18cba9,_0x122a3a){return _0x18cba9[_0x1b3a('0x8')](_0x1b3a('0x9'),attributes,{'tableName':_0x1b3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1b3a('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ac50ef1..b8e1139 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 _0xd945=['debug','request\x20sent','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s'];(function(_0x5db2f5,_0x3b8114){var _0x2e8b6c=function(_0x7c1a7f){while(--_0x7c1a7f){_0x5db2f5['push'](_0x5db2f5['shift']());}};_0x2e8b6c(++_0x3b8114);}(_0xd945,0x84));var _0x5d94=function(_0x5c139e,_0x39620d){_0x5c139e=_0x5c139e-0x0;var _0x532106=_0xd945[_0x5c139e];return _0x532106;};'use strict';var _=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var moment=require(_0x5d94('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d94('0x3'));var fs=require('fs');var Redis=require(_0x5d94('0x4'));var db=require(_0x5d94('0x5'))['db'];var utils=require(_0x5d94('0x6'));var logger=require(_0x5d94('0x7'))('rpc');var config=require(_0x5d94('0x8'));var jayson=require(_0x5d94('0x9'));var client=jayson[_0x5d94('0xa')][_0x5d94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3635a6,_0x54af94,_0x430607){return new BPromise(function(_0x34fa30,_0x1117dc){return client['request'](_0x3635a6,_0x430607)[_0x5d94('0xc')](function(_0x3dd79e){logger[_0x5d94('0xd')](_0x5d94('0xe'),_0x54af94,'request\x20sent');logger[_0x5d94('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x54af94,_0x5d94('0x10'),JSON[_0x5d94('0x11')](_0x3dd79e));if(_0x3dd79e[_0x5d94('0x12')]){if(_0x3dd79e[_0x5d94('0x12')][_0x5d94('0x13')]===0x1f4){logger[_0x5d94('0x12')](_0x5d94('0xe'),_0x54af94,_0x3dd79e[_0x5d94('0x12')][_0x5d94('0x14')]);return _0x1117dc(_0x3dd79e[_0x5d94('0x12')]['message']);}logger[_0x5d94('0x12')](_0x5d94('0xe'),_0x54af94,_0x3dd79e['error'][_0x5d94('0x14')]);return _0x34fa30(_0x3dd79e[_0x5d94('0x12')][_0x5d94('0x14')]);}else{logger[_0x5d94('0xd')](_0x5d94('0xe'),_0x54af94,_0x5d94('0x10'));_0x34fa30(_0x3dd79e['result']['message']);}})['catch'](function(_0x38d3c7){logger[_0x5d94('0x12')](_0x5d94('0xe'),_0x54af94,_0x38d3c7);_0x1117dc(_0x38d3c7);});});} \ No newline at end of file +var _0x17a7=['SmsApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x29f82c,_0x5a6380){var _0x58a330=function(_0x1a4e82){while(--_0x1a4e82){_0x29f82c['push'](_0x29f82c['shift']());}};_0x58a330(++_0x5a6380);}(_0x17a7,0xc2));var _0x717a=function(_0xe5d1fb,_0x10aa64){_0xe5d1fb=_0xe5d1fb-0x0;var _0x9b974e=_0x17a7[_0xe5d1fb];return _0x9b974e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('SmsApplication,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 00744fa..0992e0c 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 _0x9348=['addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0x9348,0x10d));var _0x8934=function(_0x480bbd,_0x1cfb35){_0x480bbd=_0x480bbd-0x0;var _0x247460=_0x9348[_0x480bbd];return _0x247460;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/describe',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0x9')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0x11')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['post'](_0x8934('0xd'),auth[_0x8934('0xa')](),controller[_0x8934('0x13')]);router[_0x8934('0x11')](_0x8934('0x14'),auth[_0x8934('0xa')](),interaction['tracked'](_0x8934('0x15'),_0x8934('0x16')),controller[_0x8934('0x17')]);router[_0x8934('0x18')](_0x8934('0x19'),auth[_0x8934('0xa')](),interaction[_0x8934('0x1a')](_0x8934('0x15'),'smsinteraction:update'),controller[_0x8934('0x1b')]);router[_0x8934('0x1c')](_0x8934('0x19'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x8934('0x1d')),controller['destroy']);router[_0x8934('0x1c')](_0x8934('0x14'),auth[_0x8934('0xa')](),controller[_0x8934('0x1e')]);module[_0x8934('0x1f')]=router; \ No newline at end of file +var _0xf4f4=['/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy'];(function(_0x500670,_0x4bca27){var _0x18e165=function(_0x4efb3d){while(--_0x4efb3d){_0x500670['push'](_0x500670['shift']());}};_0x18e165(++_0x4bca27);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4b7c13,_0x2c5239){_0x4b7c13=_0x4b7c13-0x0;var _0x37e4ec=_0xf4f4[_0x4b7c13];return _0x37e4ec;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./smsInteraction.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0x8')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x8')](_0x4f4f('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x4f4f('0x11')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0x11')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller['addMessage']);router[_0x4f4f('0x11')]('/:id/tags',auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x15')),controller['addTags']);router[_0x4f4f('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x4f4f('0x14'),_0x4f4f('0x17')),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x19')](_0x4f4f('0x1a'),auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x1b')),controller[_0x4f4f('0x1c')]);router[_0x4f4f('0x19')](_0x4f4f('0x1d'),auth['isAuthenticated'](),controller[_0x4f4f('0x1e')]);module[_0x4f4f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 131f31a..8e30778 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 _0x5549=['DATE','STRING','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x57f3c2,_0x2d96d4){var _0x15b27c=function(_0x1b6c05){while(--_0x1b6c05){_0x57f3c2['push'](_0x57f3c2['shift']());}};_0x15b27c(++_0x2d96d4);}(_0x5549,0x1f4));var _0x9554=function(_0x3055d9,_0x446bff){_0x3055d9=_0x3055d9-0x0;var _0x2dc9f1=_0x5549[_0x3055d9];return _0x2dc9f1;};'use strict';var Sequelize=require(_0x9554('0x0'));var moment=require(_0x9554('0x1'));module[_0x9554('0x2')]={'closed':{'type':Sequelize[_0x9554('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9554('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9554('0x5')]},'thirdDisposition':{'type':Sequelize[_0x9554('0x5')]},'note':{'type':Sequelize[_0x9554('0x5')]},'phone':{'type':Sequelize[_0x9554('0x5')]},'read1stAt':{'type':Sequelize[_0x9554('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x9554('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9554('0x7')]('in',_0x9554('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9554('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4da5=['BOOLEAN','STRING','DATE','out','ENUM','moment','exports'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x4da5,0x1b7));var _0x54da=function(_0x5877c8,_0x39fdb3){_0x5877c8=_0x5877c8-0x0;var _0x290f51=_0x4da5[_0x5877c8];return _0x290f51;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x54da('0x0'));module[_0x54da('0x1')]={'closed':{'type':Sequelize[_0x54da('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x54da('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x54da('0x3')]},'note':{'type':Sequelize[_0x54da('0x3')]},'phone':{'type':Sequelize[_0x54da('0x3')]},'read1stAt':{'type':Sequelize[_0x54da('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x54da('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x54da('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x54da('0x6')]('in',_0x54da('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x54da('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 708384b..8e90a72 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 _0xf0bb=['search','sqlOperator','conditions','length','find','`\x20>\x200','Contact','operator','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','where','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','all','show','params','includeAll','include','create','body','update','destroy','addMessage','SmsMessage','ids','omit','findOne','keys','hasOwnProperty','nolimit','options','findAll','rows','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','lastName','Messages','createdAt','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','direction','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','error','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','model','query','intersection','attributes','fields','order','sort','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','it.SmsInteractionId\x20=\x20i.id','expr'];(function(_0xf3024f,_0x1c5d19){var _0x20ac83=function(_0x2fc3f3){while(--_0x2fc3f3){_0xf3024f['push'](_0xf3024f['shift']());}};_0x20ac83(++_0x1c5d19);}(_0xf0bb,0x170));var _0xbf0b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf0bb[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xbf0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf0b('0x1'));var jsonpatch=require(_0xbf0b('0x2'));var rp=require(_0xbf0b('0x3'));var moment=require(_0xbf0b('0x4'));var BPromise=require(_0xbf0b('0x5'));var Mustache=require(_0xbf0b('0x6'));var util=require(_0xbf0b('0x7'));var path=require(_0xbf0b('0x8'));var sox=require(_0xbf0b('0x9'));var csv=require(_0xbf0b('0xa'));var ejs=require(_0xbf0b('0xb'));var fs=require('fs');var fs_extra=require(_0xbf0b('0xc'));var _=require(_0xbf0b('0xd'));var squel=require(_0xbf0b('0xe'));var crypto=require(_0xbf0b('0xf'));var jsforce=require(_0xbf0b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbf0b('0xa'));var querystring=require(_0xbf0b('0x11'));var Papa=require(_0xbf0b('0x12'));var Redis=require(_0xbf0b('0x13'));var authService=require(_0xbf0b('0x14'));var qs=require(_0xbf0b('0x15'));var as=require(_0xbf0b('0x16'));var pdf=require(_0xbf0b('0x17'));var hardwareService=require(_0xbf0b('0x18'));var logger=require(_0xbf0b('0x19'))(_0xbf0b('0x1a'));var utils=require(_0xbf0b('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xbf0b('0x1c'));var db=require('../../mysqldb')['db'];config[_0xbf0b('0x1d')]=_['defaults'](config[_0xbf0b('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xbf0b('0x1e'))(new Redis(config[_0xbf0b('0x1d')]));require(_0xbf0b('0x1f'))[_0xbf0b('0x20')](socket);function respondWithStatusCode(_0x3f7537,_0x5d46f1){_0x5d46f1=_0x5d46f1||0xcc;return function(_0x525a34){if(_0x525a34){return _0x3f7537[_0xbf0b('0x21')](_0x5d46f1);}return _0x3f7537['status'](_0x5d46f1)[_0xbf0b('0x22')]();};}function respondWithResult(_0xd221ce,_0x563167){_0x563167=_0x563167||0xc8;return function(_0x5e9851){if(_0x5e9851){return _0xd221ce[_0xbf0b('0x23')](_0x563167)[_0xbf0b('0x24')](_0x5e9851);}};}function respondWithFilteredResult(_0x34c47a,_0x4f3287){return function(_0x262af4){if(_0x262af4){var _0x239167=typeof _0x4f3287['offset']==='undefined'&&typeof _0x4f3287[_0xbf0b('0x25')]===_0xbf0b('0x26');var _0xea822b=_0x262af4[_0xbf0b('0x27')];var _0x6a56aa=_0x239167?0x0:_0x4f3287[_0xbf0b('0x28')];var _0x44160a=_0x239167?_0x262af4[_0xbf0b('0x27')]:_0x4f3287[_0xbf0b('0x28')]+_0x4f3287['limit'];var _0x1f5daa;if(_0x44160a>=_0xea822b){_0x44160a=_0xea822b;_0x1f5daa=0xc8;}else{_0x1f5daa=0xce;}_0x34c47a[_0xbf0b('0x23')](_0x1f5daa);return _0x34c47a[_0xbf0b('0x29')](_0xbf0b('0x2a'),_0x6a56aa+'-'+_0x44160a+'/'+_0xea822b)['json'](_0x262af4);}return null;};}function patchUpdates(_0x53f6e8){return function(_0x3a25a5){try{jsonpatch['apply'](_0x3a25a5,_0x53f6e8,!![]);}catch(_0x543fbc){return BPromise[_0xbf0b('0x2b')](_0x543fbc);}return _0x3a25a5[_0xbf0b('0x2c')]();};}function saveUpdates(_0x24cf4a,_0x282767){return function(_0x483a3f){if(_0x483a3f){return _0x483a3f['update'](_0x24cf4a)[_0xbf0b('0x2d')](function(_0x5217c9){return _0x5217c9;});}return null;};}function removeEntity(_0x4bd5b0,_0x326854){return function(_0x494a1b){if(_0x494a1b){return _0x494a1b['destroy']()[_0xbf0b('0x2d')](function(){_0x4bd5b0[_0xbf0b('0x23')](0xcc)[_0xbf0b('0x22')]();});}};}function handleEntityNotFound(_0x34fc90,_0x31920b){return function(_0x1824ea){if(!_0x1824ea){_0x34fc90['sendStatus'](0x194);}return _0x1824ea;};}function handleError(_0x48e436,_0x5aad19){_0x5aad19=_0x5aad19||0x1f4;return function(_0x158d70){logger[_0xbf0b('0x2e')](_0x158d70['stack']);if(_0x158d70[_0xbf0b('0x2f')]){delete _0x158d70['name'];}_0x48e436[_0xbf0b('0x23')](_0x5aad19)[_0xbf0b('0x30')](_0x158d70);};}function getInteractionUsers(_0x2a3993,_0x43e06c){return new BPromise(function(_0x5cb32b,_0x18b1a6){try{if(_0x43e06c[_0x2a3993['id']]){_0x2a3993[_0xbf0b('0x31')]=_[_0xbf0b('0x32')](_0x43e06c[_0x2a3993['id']],function(_0x41b738){return{'id':_0x41b738['id'],'fullname':_0x41b738[_0xbf0b('0x33')]};});}}catch(_0x503075){_0x18b1a6(_0x503075);}_0x5cb32b(_0x2a3993);});}function getInteractionTags(_0x48e783,_0x6d92d1){return new BPromise(function(_0xf0ee48,_0x38336f){try{if(_0x48e783['TagIds']){_0x48e783[_0xbf0b('0x34')]=[];_0x48e783[_0xbf0b('0x35')][_0xbf0b('0x36')](',')[_0xbf0b('0x37')](function(_0x12b937){_0x48e783[_0xbf0b('0x34')][_0xbf0b('0x38')](_0x6d92d1[_0x12b937]);});}delete _0x48e783[_0xbf0b('0x35')];}catch(_0x5a594e){_0x38336f(_0x5a594e);}_0xf0ee48(_0x48e783);});}function updateSmsInteraction(_0x44d025,_0x46b3f8,_0x15dac1){return new BPromise(function(_0x65735f,_0xfcee20){return getInteractionUsers(_0x44d025,_0x15dac1)['then'](function(_0x89c5ae){return getInteractionTags(_0x89c5ae,_0x46b3f8);})[_0xbf0b('0x2d')](function(_0x40bf75){_0x65735f(_0x40bf75);})[_0xbf0b('0x39')](function(_0x50b21e){_0xfcee20(_0x50b21e);});});}exports['index']=function(_0x52ae1e,_0x2f11a6){var _0x556c40={},_0x3262cf={},_0x57baeb={'count':0x0,'rows':[]};var _0x11a487=_['map'](db['SmsInteraction'][_0xbf0b('0x3a')],function(_0x1d7e2e){return{'name':_0x1d7e2e['fieldName'],'type':_0x1d7e2e['type']['key']};});_0x3262cf[_0xbf0b('0x3b')]=_[_0xbf0b('0x32')](_0x11a487,_0xbf0b('0x2f'));_0x3262cf[_0xbf0b('0x3c')]=_['keys'](_0x52ae1e[_0xbf0b('0x3c')]);_0x3262cf['filters']=_[_0xbf0b('0x3d')](_0x3262cf['model'],_0x3262cf['query']);_0x556c40[_0xbf0b('0x3e')]=_[_0xbf0b('0x3d')](_0x3262cf[_0xbf0b('0x3b')],qs[_0xbf0b('0x3f')](_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x3f')]));_0x556c40[_0xbf0b('0x3e')]=_0x556c40['attributes']['length']?_0x556c40[_0xbf0b('0x3e')]:_0x3262cf[_0xbf0b('0x3b')];if(!_0x52ae1e[_0xbf0b('0x3c')]['hasOwnProperty']('nolimit')){_0x556c40[_0xbf0b('0x25')]=qs[_0xbf0b('0x25')](_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x25')]);_0x556c40[_0xbf0b('0x28')]=qs[_0xbf0b('0x28')](_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x28')]);}_0x556c40[_0xbf0b('0x40')]=qs[_0xbf0b('0x41')](_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x41')]);_0x556c40['where']=qs['filters'](_[_0xbf0b('0x42')](_0x52ae1e[_0xbf0b('0x3c')],_0x3262cf[_0xbf0b('0x43')]),_0x11a487);var _0x306a95=[];var _0x5e903e=squel[_0xbf0b('0x44')]()[_0xbf0b('0x45')]('id')[_0xbf0b('0x45')]('name')[_0xbf0b('0x45')](_0xbf0b('0x46'))[_0xbf0b('0x47')](_0xbf0b('0x48'));var _0xdb9c8e=squel[_0xbf0b('0x44')]()[_0xbf0b('0x45')](_0xbf0b('0x49'))[_0xbf0b('0x45')](_0xbf0b('0x4a'))[_0xbf0b('0x45')]('ui.SmsInteractionId')[_0xbf0b('0x47')](_0xbf0b('0x4b'),'ui')[_0xbf0b('0x4c')](_0xbf0b('0x4d'),'u',_0xbf0b('0x4e'));var _0x257a23=squel['select']()[_0xbf0b('0x47')](_0xbf0b('0x4f'),'i')[_0xbf0b('0x4c')](_0xbf0b('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xbf0b('0x4c')](_0xbf0b('0x4d'),'o',_0xbf0b('0x51'))[_0xbf0b('0x4c')]('sms_accounts','a',_0xbf0b('0x52'))['left_join'](_0xbf0b('0x53'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xbf0b('0x4c')]('sms_interaction_has_tags','it',_0xbf0b('0x54'))[_0xbf0b('0x4c')](_0xbf0b('0x48'),'t','t.id\x20=\x20it.TagId');var _0x48d4f7=squel[_0xbf0b('0x55')]();var _0x5d9862=[];var _0xd51afc=squel[_0xbf0b('0x55')]();var _0x5c2d66;if(_0x52ae1e['query'][_0xbf0b('0x56')]){_0x5c2d66=as['parseSearch'](_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x56')]);var _0x49773b=_0x5c2d66[_0xbf0b('0x57')];for(var _0x508ae4=0x0;_0x508ae4<_0x5c2d66[_0xbf0b('0x58')][_0xbf0b('0x59')];_0x508ae4++){var _0x3a303f=_0x5c2d66['conditions'][_0x508ae4];var _0x322266='i';var _0x10f5aa=_[_0xbf0b('0x5a')](_0x11a487,['name',_0x3a303f[_0xbf0b('0x45')]]);if(!_0x10f5aa){switch(_0x3a303f[_0xbf0b('0x45')]){case'unreadMessages':if(_0x3a303f['value']==0x1){_0x257a23['having']('`'+_0x3a303f[_0xbf0b('0x45')]+'`\x20=\x200');}else{_0x257a23['having']('`'+_0x3a303f['field']+_0xbf0b('0x5b'));}break;case _0xbf0b('0x5c'):if(_0x3a303f[_0xbf0b('0x5d')]==='$substring'){if(_0x3a303f['value'][_0xbf0b('0x36')]('\x20')[_0xbf0b('0x59')]>0x1){_0x48d4f7[_0x49773b]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbf0b('0x5e')](_0x3a303f[_0xbf0b('0x5f')]),null);}else{var _0x2bf9fc='%'+_0x3a303f[_0xbf0b('0x5f')]+'%';_0x48d4f7[_0x49773b](_0xbf0b('0x60'),_0x2bf9fc,_0x2bf9fc,_0x2bf9fc);}}else{_0x10f5aa=_[_0xbf0b('0x5a')](_0x11a487,['name',_0xbf0b('0x61')]);_0x3a303f[_0xbf0b('0x45')]='ContactId';_0x3ebb27=as[_0xbf0b('0x62')](_0x322266,_0x10f5aa['type'],_0x3a303f);_0x48d4f7[_0x49773b](_0x3ebb27[_0xbf0b('0x63')],_0x3ebb27[_0xbf0b('0x5f')][_0xbf0b('0x64')],_0x3ebb27[_0xbf0b('0x5f')][_0xbf0b('0x22')]);}break;case'Tag':var _0x2991bf=_0x3a303f[_0xbf0b('0x5f')][_0xbf0b('0x36')](',')[_0xbf0b('0x32')](function(_0x4a3f4c){return Number(_0x4a3f4c);});_0x2991bf['forEach'](function(_0x150489){_0xd51afc['or'](_0xbf0b('0x65'),'%,'+_0x150489+',%');});_0x5d9862=_[_0xbf0b('0x66')](_0x5d9862,_0x2991bf);break;case _0xbf0b('0x67'):if(_0x3a303f[_0xbf0b('0x5d')]===_0xbf0b('0x68')){_0x48d4f7[_0x49773b](_0xbf0b('0x69'),'%'+_0x3a303f[_0xbf0b('0x5f')]+'%',null);}else{_0x10f5aa=_[_0xbf0b('0x5a')](_0x11a487,['name','UserId']);_0x3a303f['field']='UserId';_0x3ebb27=as[_0xbf0b('0x62')](_0x322266,_0x10f5aa[_0xbf0b('0x6a')],_0x3a303f);_0x48d4f7[_0x49773b](_0x3ebb27[_0xbf0b('0x63')],_0x3ebb27[_0xbf0b('0x5f')][_0xbf0b('0x64')],_0x3ebb27[_0xbf0b('0x5f')][_0xbf0b('0x22')]);}break;case'body':_0x3ebb27=as[_0xbf0b('0x62')]('me',null,_0x3a303f);_0x48d4f7[_0x49773b](_0x3ebb27[_0xbf0b('0x63')],_0x3ebb27['value'][_0xbf0b('0x64')],_0x3ebb27[_0xbf0b('0x5f')][_0xbf0b('0x22')]);break;}}else{var _0x3ebb27=as[_0xbf0b('0x62')](_0x322266,_0x10f5aa['type'],_0x3a303f);_0x48d4f7[_0x49773b](_0x3ebb27[_0xbf0b('0x63')],_0x3ebb27[_0xbf0b('0x5f')][_0xbf0b('0x64')],_0x3ebb27['value'][_0xbf0b('0x22')]);}}}else{var _0x16b7d4=_(_0x52ae1e[_0xbf0b('0x3c')])['keys']()[_0xbf0b('0x32')](function(_0x2d89b0){return _[_0xbf0b('0x6b')](_0x11a487,['name',_0x2d89b0])?_0x2d89b0:undefined;})[_0xbf0b('0x6c')]()[_0xbf0b('0x5f')]();if(!_[_0xbf0b('0x6d')](_0x16b7d4)){_0x16b7d4[_0xbf0b('0x37')](function(_0x2bb6c6){if(_0x2bb6c6===_0xbf0b('0x6e')){_0x257a23['where'](_0xbf0b('0x6f'),[][_0xbf0b('0x70')](_0x52ae1e[_0xbf0b('0x3c')][_0x2bb6c6]));}else if(_0x2bb6c6==='createdAt'){var _0x1170a3=JSON[_0xbf0b('0x71')](_0x52ae1e[_0xbf0b('0x3c')][_0x2bb6c6])[_0xbf0b('0x72')];var _0x376731=JSON[_0xbf0b('0x71')](_0x52ae1e[_0xbf0b('0x3c')][_0x2bb6c6])[_0xbf0b('0x73')];_0x257a23['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1170a3,_0x376731);}else{if(_0x52ae1e['query'][_0x2bb6c6]==='null'){_0x257a23['where']('i.'+_0x2bb6c6+'\x20IS\x20NULL');}else{_0x257a23[_0xbf0b('0x74')]('i.'+_0x2bb6c6+_0xbf0b('0x75'),_0x52ae1e['query'][_0x2bb6c6]);}}});}if(_0x52ae1e['query']['read']){if(_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x76')]==0x1){_0x257a23[_0xbf0b('0x77')](_0xbf0b('0x78'));}else{_0x257a23[_0xbf0b('0x77')](_0xbf0b('0x79'));}}if(_0x52ae1e[_0xbf0b('0x3c')]['tag']){_0x5d9862=_[_0xbf0b('0x7a')](_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x7b')])?_0x52ae1e[_0xbf0b('0x3c')]['tag']:new Array(_0x52ae1e['query']['tag']);_0x5d9862[_0xbf0b('0x37')](function(_0x4e6f94){_0xd51afc['or'](_0xbf0b('0x65'),'%,'+_0x4e6f94+',%');});}if(_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x7c')]){var _0x4d3cea=_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x7c')][_0xbf0b('0x7d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xbf0b('0x7e')](_0x4d3cea)){_0x48d4f7['or'](_0xbf0b('0x7f'),_0x4d3cea+'%')['or']('i.phone\x20LIKE\x20?',_0x4d3cea+'%');}else{_0x48d4f7['or'](_0xbf0b('0x80'),qs[_0xbf0b('0x5e')](_0x4d3cea))['or'](_0xbf0b('0x81'),_0x4d3cea+'%');}}}_0x257a23[_0xbf0b('0x74')](_0x48d4f7);_0x257a23[_0xbf0b('0x82')](_0xbf0b('0x83'));var _0xb9c15b={'type':db[_0xbf0b('0x84')][_0xbf0b('0x85')][_0xbf0b('0x86')],'raw':!![]};var _0x431629=_0x257a23[_0xbf0b('0x87')]();_0x431629[_0xbf0b('0x45')]('i.id');_0x431629[_0xbf0b('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbf0b('0x88'));if(_0x556c40['order']){_0x556c40['order'][_0xbf0b('0x37')](function(_0x14cc07){var _0x15ec2d=_0x14cc07[0x0]===_0xbf0b('0x89')?_0x14cc07[0x0]:'i.'+_0x14cc07[0x0];_0x257a23[_0xbf0b('0x40')](_0x15ec2d,_0x14cc07[0x1]===_0xbf0b('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x5d9862)){_0x257a23[_0xbf0b('0x77')](_0xd51afc);_0x431629[_0xbf0b('0x74')](_0xbf0b('0x8b'),_0x5d9862);}BPromise['resolve']()[_0xbf0b('0x2d')](function(){if(!_0x5c2d66){if(_0x52ae1e[_0xbf0b('0x3c')][_0xbf0b('0x6e')])return;_0x431629[_0xbf0b('0x74')](_0xbf0b('0x8c'));_0x257a23[_0xbf0b('0x74')](_0xbf0b('0x8c'));return;}if(_0x52ae1e['user']['role']!==_0xbf0b('0x8d'))return;return _0x52ae1e[_0xbf0b('0x8e')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xbf0b('0x2d')](function(_0x4bd651){if(_['isEmpty'](_0x4bd651)){_0x431629[_0xbf0b('0x74')](_0xbf0b('0x8f'));_0x257a23[_0xbf0b('0x74')](_0xbf0b('0x8f'));}else{_0x431629[_0xbf0b('0x74')](_0xbf0b('0x6f'),_[_0xbf0b('0x32')](_0x4bd651,'id'));_0x257a23[_0xbf0b('0x74')]('i.SmsAccountId\x20IN\x20?',_[_0xbf0b('0x32')](_0x4bd651,'id'));}});})[_0xbf0b('0x2d')](function(){if(_0x52ae1e[_0xbf0b('0x8e')]['role']===_0xbf0b('0x8d')&&!_0x5c2d66&&!_0x52ae1e[_0xbf0b('0x3c')]['SmsAccountId'])return[];return db['sequelize'][_0xbf0b('0x3c')](_0x431629['toString'](),_0xb9c15b);})[_0xbf0b('0x2d')](function(_0xe2557c){_0x57baeb[_0xbf0b('0x27')]=_0xe2557c[_0xbf0b('0x59')];if(_0x57baeb[_0xbf0b('0x27')]===0x0)return[];return db[_0xbf0b('0x90')][_0xbf0b('0x3c')](_0x5e903e[_0xbf0b('0x91')](),_0xb9c15b)[_0xbf0b('0x2d')](function(_0x192707){_0x306a95=_[_0xbf0b('0x92')](_0x192707,'id');_0xb9c15b=_[_0xbf0b('0x93')](_0xb9c15b,{'model':db[_0xbf0b('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52ae1e['query'][_0xbf0b('0x3f')]){_0x556c40['attributes'][_0xbf0b('0x37')](function(_0x5dff37){_0x257a23[_0xbf0b('0x45')]('i.'+_0x5dff37);});}else{_0x257a23[_0xbf0b('0x45')](_0xbf0b('0x95'),_0xbf0b('0x88'));_0x257a23['field'](_0xbf0b('0x96'),'Account.key');_0x257a23['field'](_0xbf0b('0x97'),_0xbf0b('0x98'));_0x257a23[_0xbf0b('0x45')](_0xbf0b('0x99'),'contactName');_0x257a23[_0xbf0b('0x45')]('i.*');_0x257a23[_0xbf0b('0x45')](_0xbf0b('0x9a'),'Contact.firstName');_0x257a23[_0xbf0b('0x45')](_0xbf0b('0x9b'),_0xbf0b('0x9c'));_0x257a23[_0xbf0b('0x45')](_0xbf0b('0x9d'),'Contact.email');_0x257a23[_0xbf0b('0x45')](_0xbf0b('0x9e'),_0xbf0b('0x9f'));_0x257a23[_0xbf0b('0x45')](_0xbf0b('0xa0'),_0xbf0b('0xa1'));_0x257a23[_0xbf0b('0x45')](_0xbf0b('0xa2'),_0xbf0b('0xa3'));_0x257a23[_0xbf0b('0x45')](_0xbf0b('0xa4'),_0xbf0b('0xa5'));_0x257a23[_0xbf0b('0x45')](_0xbf0b('0xa6'),'Owner.internal');_0x257a23['field'](_0xbf0b('0xa7'),_0xbf0b('0x35'));}if(_0x556c40['limit'])_0x257a23['limit'](_0x556c40['limit']);if(_0x556c40['offset'])_0x257a23['offset'](_0x556c40[_0xbf0b('0x28')]);return db[_0xbf0b('0x90')][_0xbf0b('0x3c')](_0x257a23[_0xbf0b('0x91')](),_0xb9c15b);})[_0xbf0b('0x2d')](function(_0x3882d1){if(_0x3882d1[_0xbf0b('0x59')]>0x0)_0xdb9c8e[_0xbf0b('0x74')]('ui.SmsInteractionId\x20IN\x20?',_[_0xbf0b('0x32')](_0x3882d1,'id'));return db[_0xbf0b('0x90')]['query'](_0xdb9c8e[_0xbf0b('0x91')](),_0xb9c15b)['then'](function(_0x124b67){var _0x574d0d=_['groupBy'](_0x124b67,_0xbf0b('0xa8'));var _0x318bc7=[];_0x3882d1[_0xbf0b('0x37')](function(_0x24da9e){_0x318bc7[_0xbf0b('0x38')](updateSmsInteraction(_0x24da9e,_0x306a95,_0x574d0d));});return BPromise[_0xbf0b('0xa9')](_0x318bc7);});});})[_0xbf0b('0x2d')](function(_0x52f9e8){_0x57baeb['rows']=_0x52f9e8;return _0x57baeb;})['then'](respondWithFilteredResult(_0x2f11a6,_0x556c40))[_0xbf0b('0x39')](handleError(_0x2f11a6,null));};exports[_0xbf0b('0xaa')]=function(_0x3d8b7b,_0x542dcb){var _0x2b6151={'raw':![],'where':{'id':_0x3d8b7b[_0xbf0b('0xab')]['id']}},_0x1f0b26={};_0x1f0b26[_0xbf0b('0x3b')]=_['keys'](db[_0xbf0b('0x94')][_0xbf0b('0x3a')]);_0x1f0b26['query']=_['keys'](_0x3d8b7b[_0xbf0b('0x3c')]);_0x1f0b26[_0xbf0b('0x43')]=_[_0xbf0b('0x3d')](_0x1f0b26[_0xbf0b('0x3b')],_0x1f0b26[_0xbf0b('0x3c')]);_0x2b6151[_0xbf0b('0x3e')]=_[_0xbf0b('0x3d')](_0x1f0b26[_0xbf0b('0x3b')],qs[_0xbf0b('0x3f')](_0x3d8b7b[_0xbf0b('0x3c')][_0xbf0b('0x3f')]));_0x2b6151['attributes']=_0x2b6151[_0xbf0b('0x3e')][_0xbf0b('0x59')]?_0x2b6151['attributes']:_0x1f0b26[_0xbf0b('0x3b')];if(_0x3d8b7b['query'][_0xbf0b('0xac')]){_0x2b6151[_0xbf0b('0xad')]=[{'all':!![]}];}_0x2b6151=_[_0xbf0b('0x93')]({},_0x2b6151,_0x3d8b7b['options']);return db[_0xbf0b('0x94')]['find'](_0x2b6151)[_0xbf0b('0x2d')](handleEntityNotFound(_0x542dcb,null))[_0xbf0b('0x2d')](respondWithResult(_0x542dcb,null))[_0xbf0b('0x39')](handleError(_0x542dcb,null));};exports[_0xbf0b('0xae')]=function(_0x176b66,_0xe2d84d){return db['SmsInteraction'][_0xbf0b('0xae')](_0x176b66[_0xbf0b('0xaf')],{})[_0xbf0b('0x2d')](respondWithResult(_0xe2d84d,0xc9))['catch'](handleError(_0xe2d84d,null));};exports[_0xbf0b('0xb0')]=function(_0x21333b,_0x3bbb16){if(_0x21333b['body']['id']){delete _0x21333b[_0xbf0b('0xaf')]['id'];}return db[_0xbf0b('0x94')]['find']({'where':{'id':_0x21333b['params']['id']}})[_0xbf0b('0x2d')](handleEntityNotFound(_0x3bbb16,null))[_0xbf0b('0x2d')](saveUpdates(_0x21333b[_0xbf0b('0xaf')],null))[_0xbf0b('0x2d')](respondWithResult(_0x3bbb16,null))[_0xbf0b('0x39')](handleError(_0x3bbb16,null));};exports[_0xbf0b('0xb1')]=function(_0x12102b,_0x2bf3d2){return db[_0xbf0b('0x94')][_0xbf0b('0x5a')]({'where':{'id':_0x12102b['params']['id']}})[_0xbf0b('0x2d')](handleEntityNotFound(_0x2bf3d2,null))[_0xbf0b('0x2d')](removeEntity(_0x2bf3d2,null))[_0xbf0b('0x39')](handleError(_0x2bf3d2,null));};exports['describe']=function(_0x29d08b,_0x2eb156){return db[_0xbf0b('0x94')]['describe']()[_0xbf0b('0x2d')](respondWithResult(_0x2eb156,null))['catch'](handleError(_0x2eb156,null));};exports[_0xbf0b('0xb2')]=function(_0x5a2237,_0x25141c,_0x43cd1d){return db[_0xbf0b('0xb3')][_0xbf0b('0x5a')]({'where':{'id':_0x5a2237['params']['id']}})[_0xbf0b('0x2d')](handleEntityNotFound(_0x25141c,null))[_0xbf0b('0x2d')](function(_0x5ca282){if(_0x5ca282){return _0x5ca282['addMessage'](_0x5a2237[_0xbf0b('0xaf')][_0xbf0b('0xb4')],_[_0xbf0b('0xb5')](_0x5a2237[_0xbf0b('0xaf')],[_0xbf0b('0xb4'),'id'])||{});}})[_0xbf0b('0x2d')](respondWithResult(_0x25141c,null))['catch'](handleError(_0x25141c,null));};exports['getMessages']=function(_0x45f71d,_0x10f367,_0x53f2d2){var _0x31f3fb={'raw':![],'where':{}};var _0x21b203={};var _0x41869c={'count':0x0,'rows':[]};return db[_0xbf0b('0x94')][_0xbf0b('0xb6')]({'where':{'id':_0x45f71d[_0xbf0b('0xab')]['id']}})[_0xbf0b('0x2d')](handleEntityNotFound(_0x10f367,null))['then'](function(_0x333cb0){if(_0x333cb0){_0x21b203[_0xbf0b('0x3b')]=_[_0xbf0b('0xb7')](db[_0xbf0b('0xb3')][_0xbf0b('0x3a')]);_0x21b203[_0xbf0b('0x3c')]=_[_0xbf0b('0xb7')](_0x45f71d['query']);_0x21b203[_0xbf0b('0x43')]=_[_0xbf0b('0x3d')](_0x21b203[_0xbf0b('0x3b')],_0x21b203[_0xbf0b('0x3c')]);_0x31f3fb[_0xbf0b('0x3e')]=_[_0xbf0b('0x3d')](_0x21b203['model'],qs[_0xbf0b('0x3f')](_0x45f71d[_0xbf0b('0x3c')][_0xbf0b('0x3f')]));_0x31f3fb[_0xbf0b('0x3e')]=_0x31f3fb['attributes'][_0xbf0b('0x59')]?_0x31f3fb[_0xbf0b('0x3e')]:_0x21b203[_0xbf0b('0x3b')];if(!_0x45f71d[_0xbf0b('0x3c')][_0xbf0b('0xb8')](_0xbf0b('0xb9'))){_0x31f3fb[_0xbf0b('0x25')]=qs['limit'](_0x45f71d[_0xbf0b('0x3c')][_0xbf0b('0x25')]);_0x31f3fb['offset']=qs[_0xbf0b('0x28')](_0x45f71d[_0xbf0b('0x3c')][_0xbf0b('0x28')]);}_0x31f3fb['order']=qs[_0xbf0b('0x41')](_0x45f71d[_0xbf0b('0x3c')]['sort']);_0x31f3fb[_0xbf0b('0x74')]=qs[_0xbf0b('0x43')](_[_0xbf0b('0x42')](_0x45f71d[_0xbf0b('0x3c')],_0x21b203['filters']));_0x31f3fb[_0xbf0b('0x74')][_0xbf0b('0xa8')]=_0x333cb0['id'];if(_0x45f71d['query'][_0xbf0b('0x7c')]){_0x31f3fb[_0xbf0b('0x74')]=_[_0xbf0b('0x93')](_0x31f3fb[_0xbf0b('0x74')],{'$or':_[_0xbf0b('0x32')](_0x31f3fb[_0xbf0b('0x3e')],function(_0x1b2d5f){var _0xfae3eb={};_0xfae3eb[_0x1b2d5f]={'$like':'%'+_0x45f71d[_0xbf0b('0x3c')]['filter']+'%'};return _0xfae3eb;})});}if(_0x45f71d[_0xbf0b('0x3c')]['$gte']){var _0x5bd98f=_0x45f71d['query'][_0xbf0b('0x72')][_0xbf0b('0x36')](',');var _0x448778={};_0x448778[_0x5bd98f[0x0]]={'$gte':moment(_0x5bd98f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x31f3fb[_0xbf0b('0x74')]=_['merge'](_0x31f3fb[_0xbf0b('0x74')],_0x448778);}_0x31f3fb=_[_0xbf0b('0x93')]({},_0x31f3fb,_0x45f71d[_0xbf0b('0xba')]);return db[_0xbf0b('0xb3')]['count']({'where':_0x31f3fb[_0xbf0b('0x74')]})[_0xbf0b('0x2d')](function(_0x1e8d43){_0x41869c[_0xbf0b('0x27')]=_0x1e8d43;if(_0x45f71d['query'][_0xbf0b('0xac')]){_0x31f3fb[_0xbf0b('0xad')]=[{'all':!![]}];}return db['SmsMessage'][_0xbf0b('0xbb')](_0x31f3fb);})['then'](function(_0x25da1d){_0x41869c[_0xbf0b('0xbc')]=_0x25da1d;return _0x41869c;});}})[_0xbf0b('0x2d')](respondWithFilteredResult(_0x10f367,_0x31f3fb))[_0xbf0b('0x39')](handleError(_0x10f367,null));};exports['addTags']=function(_0x219000,_0x3d1c76,_0x137311){return db[_0xbf0b('0x94')][_0xbf0b('0x5a')]({'where':{'id':_0x219000[_0xbf0b('0xab')]['id']}})[_0xbf0b('0x2d')](handleEntityNotFound(_0x3d1c76,null))[_0xbf0b('0x2d')](function(_0x5dd5e7){if(_0x5dd5e7){return _0x5dd5e7[_0xbf0b('0xbd')](_0x219000[_0xbf0b('0xaf')][_0xbf0b('0xb4')],_['omit'](_0x219000[_0xbf0b('0xaf')],[_0xbf0b('0xb4'),'id'])||{})[_0xbf0b('0xbe')](function(){return db['Tag']['findAll']({'attributes':['id',_0xbf0b('0x2f'),'color'],'where':{'id':_0x219000[_0xbf0b('0xaf')][_0xbf0b('0xb4')]}});})[_0xbf0b('0x2d')](function(_0x2c8bfd){socket[_0xbf0b('0xbf')](_0xbf0b('0xc0'),{'id':Number(_0x219000[_0xbf0b('0xab')]['id']),'tags':_0x2c8bfd||[]});return{'id':Number(_0x219000[_0xbf0b('0xab')]['id']),'tags':_0x2c8bfd||[]};});}})[_0xbf0b('0x2d')](respondWithResult(_0x3d1c76,null))[_0xbf0b('0x39')](handleError(_0x3d1c76,null));};exports['removeTags']=function(_0x1488aa,_0x37a48c,_0x316af2){return db['SmsInteraction'][_0xbf0b('0x5a')]({'where':{'id':_0x1488aa[_0xbf0b('0xab')]['id']}})[_0xbf0b('0x2d')](handleEntityNotFound(_0x37a48c,null))[_0xbf0b('0x2d')](function(_0x33ef62){if(_0x33ef62){return _0x33ef62[_0xbf0b('0xc1')](_0x1488aa['query']['ids']);}})[_0xbf0b('0x2d')](respondWithStatusCode(_0x37a48c,null))[_0xbf0b('0x39')](handleError(_0x37a48c,null));};exports[_0xbf0b('0xc2')]=function(_0x1926cb,_0x4e4c50){var _0x40c116=moment()[_0xbf0b('0xc3')]()[_0xbf0b('0x91')]();var _0x60fc98=path[_0xbf0b('0xc4')](config[_0xbf0b('0xc5')],_0xbf0b('0xc6'),_0xbf0b('0xc7'),_0xbf0b('0xc8'));var _0x52a2ae=path[_0xbf0b('0xc4')](config[_0xbf0b('0xc5')],_0xbf0b('0xc6'),_0xbf0b('0xc7'),_0xbf0b('0xc9'));var _0x22188a=path['join'](_0x60fc98,_0x40c116);var _0x2f5323=util[_0xbf0b('0xca')](_0xbf0b('0xcb'),_0x1926cb[_0xbf0b('0xab')]['id'],_0x40c116);var _0x15ecdc=path[_0xbf0b('0xc4')](_0x60fc98,_0x2f5323);var _0x1566c6=[];_0x1566c6[_0xbf0b('0x38')]({'model':db[_0xbf0b('0x67')],'as':_0xbf0b('0x67'),'attributes':['id',_0xbf0b('0x33')],'raw':!![]});_0x1566c6[_0xbf0b('0x38')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xbf0b('0xcc')],'raw':!![]});var _0x1e1e3e=[{'model':db['SmsMessage'],'as':_0xbf0b('0xcd'),'attributes':['id',_0xbf0b('0xaf'),_0xbf0b('0xce'),'direction',_0xbf0b('0xcf'),_0xbf0b('0x76')],'include':_0x1566c6}];_0x1e1e3e['push']({'model':db[_0xbf0b('0xd0')],'as':_0xbf0b('0xd1'),'attributes':['id',_0xbf0b('0x2f')]});_0x1e1e3e[_0xbf0b('0x38')]({'model':db[_0xbf0b('0x67')],'as':_0xbf0b('0xd2'),'attributes':['id',_0xbf0b('0x33')]});return db[_0xbf0b('0x94')][_0xbf0b('0x5a')]({'where':{'id':_0x1926cb[_0xbf0b('0xab')]['id']},'include':_0x1e1e3e})[_0xbf0b('0x2d')](handleEntityNotFound(_0x4e4c50,null))['then'](function(_0x4663e3){if(_0x4663e3){var _0x2a40af=_0x4663e3['get']({'plain':!![]});fs[_0xbf0b('0xd3')](_0x22188a);var _0x52baf4={'channel':_0xbf0b('0xd4'),'account':_0x2a40af[_0xbf0b('0xd1')][_0xbf0b('0x2f')],'agent':_0x2a40af[_0xbf0b('0xd2')]?_0x2a40af[_0xbf0b('0xd2')][_0xbf0b('0x33')]:_0xbf0b('0xd5'),'createdAt':moment(_0x2a40af['createdAt'])['format'](_0xbf0b('0xd6'))[_0xbf0b('0x91')](),'closedAt':_0x2a40af['closed']?moment(_0x2a40af[_0xbf0b('0xd7')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbf0b('0x91')]():'','disposition':_0x2a40af[_0xbf0b('0xd8')],'messages':_(_0x2a40af[_0xbf0b('0xcd')])[_0xbf0b('0x7c')]({'secret':![]})[_0xbf0b('0x32')](function(_0x3274ff){return{'date':moment(_0x3274ff[_0xbf0b('0xce')])[_0xbf0b('0xca')](_0xbf0b('0xd6'))[_0xbf0b('0x91')](),'sender':_0x3274ff[_0xbf0b('0xd9')]==='out'?_0x3274ff[_0xbf0b('0x67')]?_0x3274ff[_0xbf0b('0x67')][_0xbf0b('0x33')]:_0xbf0b('0xda'):_0x3274ff[_0xbf0b('0x5c')][_0xbf0b('0xdb')]+(_0x3274ff['Contact'][_0xbf0b('0xcc')]?'\x20'+_0x3274ff[_0xbf0b('0x5c')][_0xbf0b('0xcc')]:''),'body':_0x3274ff[_0xbf0b('0xaf')],'direction':_0x3274ff['direction']==='out'?'A':'C','secret':_0x3274ff['secret'],'read':_0x3274ff[_0xbf0b('0x76')]};})[_0xbf0b('0x5f')]()};return ejs[_0xbf0b('0xdc')](path[_0xbf0b('0xc4')](config[_0xbf0b('0xc5')],_0xbf0b('0xc6'),_0xbf0b('0xdd'),_0xbf0b('0xde')),{'interaction':_0x52baf4})[_0xbf0b('0x2d')](function(_0x24a010){var _0x2bfb33=path['join'](_0x22188a,_0xbf0b('0xdf')+_0x2a40af['id']+'-'+_0x40c116+_0xbf0b('0xe0'));var _0x2e89d9={'path':_0x2bfb33,'channel':_0xbf0b('0xd4'),'interactionId':_0x2a40af['id']};return pdf[_0xbf0b('0xe1')](_0x24a010,_0x2e89d9);})[_0xbf0b('0x2d')](function(){return new BPromise(function(_0x25130f,_0x4f3657){zipdir(_0x22188a,{'saveTo':_0x15ecdc},function(_0x35354c,_0x372333){if(_0x35354c)return _0x4f3657(_0x35354c);return _0x25130f(_0x372333);});})['then'](function(){return new BPromise(function(_0x51a925,_0x10b9d7){rimraf(_0x22188a,function(_0x8a9d99){if(_0x8a9d99)_0x10b9d7(_0x8a9d99);return _0x51a925();});});})[_0xbf0b('0x2d')](function(){return _0x4e4c50[_0xbf0b('0xc2')](_0x15ecdc,_0x2f5323,function(_0x468379){if(_0x468379){console[_0xbf0b('0xe2')]('err',_0x468379);}else{fs['unlinkSync'](_0x15ecdc);}});});});}else{return _0x4e4c50[_0xbf0b('0x21')](0xc8);}})[_0xbf0b('0x39')](handleError(_0x4e4c50,null));}; \ No newline at end of file +var _0x43fa=['`\x20=\x200','having','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','body','type','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','show','keys','includeAll','merge','options','create','params','describe','addMessage','SmsMessage','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','omit','emit','removeTags','download','unix','root','server','files','join','attachments','transcript-%d-%s.zip','fullname','CmContact','Contact','firstName','lastName','Messages','direction','secret','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','System','out','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','TagIds','Tags','split','push','catch','SmsInteraction','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','ui.SmsInteractionId','user_has_sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages'];(function(_0x6202eb,_0x5e76fa){var _0x50520a=function(_0x405e5a){while(--_0x405e5a){_0x6202eb['push'](_0x6202eb['shift']());}};_0x50520a(++_0x5e76fa);}(_0x43fa,0x15c));var _0xa43f=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x43fa[_0x1b1a3b];return _0x385347;};'use strict';var emlformat=require(_0xa43f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa43f('0x1'));var rp=require(_0xa43f('0x2'));var moment=require('moment');var BPromise=require(_0xa43f('0x3'));var Mustache=require(_0xa43f('0x4'));var util=require(_0xa43f('0x5'));var path=require(_0xa43f('0x6'));var sox=require(_0xa43f('0x7'));var csv=require('to-csv');var ejs=require(_0xa43f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa43f('0x9'));var squel=require(_0xa43f('0xa'));var crypto=require(_0xa43f('0xb'));var jsforce=require(_0xa43f('0xc'));var deskjs=require(_0xa43f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa43f('0xe'));var Papa=require(_0xa43f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa43f('0x10'));var as=require(_0xa43f('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xa43f('0x12'));var logger=require(_0xa43f('0x13'))(_0xa43f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa43f('0x15'));var db=require(_0xa43f('0x16'))['db'];config[_0xa43f('0x17')]=_[_0xa43f('0x18')](config['redis'],{'host':_0xa43f('0x19'),'port':0x18eb});var socket=require(_0xa43f('0x1a'))(new Redis(config[_0xa43f('0x17')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2476c1,_0x3b9f37){_0x3b9f37=_0x3b9f37||0xcc;return function(_0x6354dd){if(_0x6354dd){return _0x2476c1['sendStatus'](_0x3b9f37);}return _0x2476c1[_0xa43f('0x1b')](_0x3b9f37)[_0xa43f('0x1c')]();};}function respondWithResult(_0x3ba1c6,_0x46699d){_0x46699d=_0x46699d||0xc8;return function(_0x543964){if(_0x543964){return _0x3ba1c6[_0xa43f('0x1b')](_0x46699d)[_0xa43f('0x1d')](_0x543964);}};}function respondWithFilteredResult(_0x5e0ec9,_0x3eca35){return function(_0x2baec9){if(_0x2baec9){var _0x4ff1cf=typeof _0x3eca35[_0xa43f('0x1e')]===_0xa43f('0x1f')&&typeof _0x3eca35[_0xa43f('0x20')]===_0xa43f('0x1f');var _0xecbb61=_0x2baec9[_0xa43f('0x21')];var _0x19692c=_0x4ff1cf?0x0:_0x3eca35['offset'];var _0x4c3ec4=_0x4ff1cf?_0x2baec9[_0xa43f('0x21')]:_0x3eca35[_0xa43f('0x1e')]+_0x3eca35[_0xa43f('0x20')];var _0x53e3f6;if(_0x4c3ec4>=_0xecbb61){_0x4c3ec4=_0xecbb61;_0x53e3f6=0xc8;}else{_0x53e3f6=0xce;}_0x5e0ec9[_0xa43f('0x1b')](_0x53e3f6);return _0x5e0ec9['set']('Content-Range',_0x19692c+'-'+_0x4c3ec4+'/'+_0xecbb61)[_0xa43f('0x1d')](_0x2baec9);}return null;};}function patchUpdates(_0x329c28){return function(_0x39408c){try{jsonpatch[_0xa43f('0x22')](_0x39408c,_0x329c28,!![]);}catch(_0xe572b6){return BPromise['reject'](_0xe572b6);}return _0x39408c[_0xa43f('0x23')]();};}function saveUpdates(_0x28ab06,_0x412d11){return function(_0x346fa8){if(_0x346fa8){return _0x346fa8[_0xa43f('0x24')](_0x28ab06)[_0xa43f('0x25')](function(_0x2403ba){return _0x2403ba;});}return null;};}function removeEntity(_0x47ba39,_0x3dd285){return function(_0x41baab){if(_0x41baab){return _0x41baab[_0xa43f('0x26')]()['then'](function(){_0x47ba39[_0xa43f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f234c,_0x7a7dd9){return function(_0x338863){if(!_0x338863){_0x2f234c[_0xa43f('0x27')](0x194);}return _0x338863;};}function handleError(_0x4282c4,_0x55414b){_0x55414b=_0x55414b||0x1f4;return function(_0x4e874c){logger[_0xa43f('0x28')](_0x4e874c[_0xa43f('0x29')]);if(_0x4e874c[_0xa43f('0x2a')]){delete _0x4e874c['name'];}_0x4282c4[_0xa43f('0x1b')](_0x55414b)[_0xa43f('0x2b')](_0x4e874c);};}function getInteractionUsers(_0xac7ca1,_0x39fedc){return new BPromise(function(_0x4ae1b4,_0x89aed7){try{if(_0x39fedc[_0xac7ca1['id']]){_0xac7ca1[_0xa43f('0x2c')]=_[_0xa43f('0x2d')](_0x39fedc[_0xac7ca1['id']],function(_0x1ffa4b){return{'id':_0x1ffa4b['id'],'fullname':_0x1ffa4b['fullname']};});}}catch(_0x52608c){_0x89aed7(_0x52608c);}_0x4ae1b4(_0xac7ca1);});}function getInteractionTags(_0x456eb5,_0x332c51){return new BPromise(function(_0x4c38f8,_0x3ce4b4){try{if(_0x456eb5[_0xa43f('0x2e')]){_0x456eb5[_0xa43f('0x2f')]=[];_0x456eb5[_0xa43f('0x2e')][_0xa43f('0x30')](',')['forEach'](function(_0x4cc5b5){_0x456eb5[_0xa43f('0x2f')][_0xa43f('0x31')](_0x332c51[_0x4cc5b5]);});}delete _0x456eb5[_0xa43f('0x2e')];}catch(_0x52eac0){_0x3ce4b4(_0x52eac0);}_0x4c38f8(_0x456eb5);});}function updateSmsInteraction(_0x58a69a,_0x3e3b53,_0x3abf57){return new BPromise(function(_0x405743,_0x4c1796){return getInteractionUsers(_0x58a69a,_0x3abf57)[_0xa43f('0x25')](function(_0x4bb603){return getInteractionTags(_0x4bb603,_0x3e3b53);})[_0xa43f('0x25')](function(_0x5e60db){_0x405743(_0x5e60db);})[_0xa43f('0x32')](function(_0x407b17){_0x4c1796(_0x407b17);});});}exports['index']=function(_0x1c3b24,_0x4af6b6){var _0xd732b4={},_0x1ff283={},_0x5aa72f={'count':0x0,'rows':[]};var _0x2743ea=_['map'](db[_0xa43f('0x33')][_0xa43f('0x34')],function(_0x405710){return{'name':_0x405710[_0xa43f('0x35')],'type':_0x405710['type']['key']};});_0x1ff283[_0xa43f('0x36')]=_[_0xa43f('0x2d')](_0x2743ea,_0xa43f('0x2a'));_0x1ff283['query']=_['keys'](_0x1c3b24[_0xa43f('0x37')]);_0x1ff283[_0xa43f('0x38')]=_[_0xa43f('0x39')](_0x1ff283[_0xa43f('0x36')],_0x1ff283['query']);_0xd732b4[_0xa43f('0x3a')]=_['intersection'](_0x1ff283[_0xa43f('0x36')],qs[_0xa43f('0x3b')](_0x1c3b24[_0xa43f('0x37')]['fields']));_0xd732b4[_0xa43f('0x3a')]=_0xd732b4[_0xa43f('0x3a')][_0xa43f('0x3c')]?_0xd732b4['attributes']:_0x1ff283['model'];if(!_0x1c3b24['query'][_0xa43f('0x3d')](_0xa43f('0x3e'))){_0xd732b4['limit']=qs['limit'](_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x20')]);_0xd732b4[_0xa43f('0x1e')]=qs[_0xa43f('0x1e')](_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x1e')]);}_0xd732b4[_0xa43f('0x3f')]=qs[_0xa43f('0x40')](_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x40')]);_0xd732b4[_0xa43f('0x41')]=qs['filters'](_[_0xa43f('0x42')](_0x1c3b24[_0xa43f('0x37')],_0x1ff283[_0xa43f('0x38')]),_0x2743ea);var _0x20c062=[];var _0x2fcdfd=squel['select']()[_0xa43f('0x43')]('id')[_0xa43f('0x43')]('name')[_0xa43f('0x43')](_0xa43f('0x44'))[_0xa43f('0x45')](_0xa43f('0x46'));var _0x5f5db3=squel[_0xa43f('0x47')]()[_0xa43f('0x43')]('u.id')[_0xa43f('0x43')]('u.fullname')[_0xa43f('0x43')](_0xa43f('0x48'))[_0xa43f('0x45')](_0xa43f('0x49'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x283757=squel[_0xa43f('0x47')]()['from']('sms_interactions','i')[_0xa43f('0x4a')](_0xa43f('0x4b'),'c',_0xa43f('0x4c'))[_0xa43f('0x4a')](_0xa43f('0x4d'),'o',_0xa43f('0x4e'))[_0xa43f('0x4a')]('sms_accounts','a',_0xa43f('0x4f'))['left_join'](_0xa43f('0x50'),'me',_0xa43f('0x51'))['left_join'](_0xa43f('0x52'),'it',_0xa43f('0x53'))[_0xa43f('0x4a')](_0xa43f('0x46'),'t',_0xa43f('0x54'));var _0x2d2f87=squel[_0xa43f('0x55')]();var _0x507704=[];var _0x3e88a3=squel['expr']();var _0x10bbc7;if(_0x1c3b24['query'][_0xa43f('0x56')]){_0x10bbc7=as[_0xa43f('0x57')](_0x1c3b24[_0xa43f('0x37')]['search']);var _0x4815eb=_0x10bbc7[_0xa43f('0x58')];for(var _0x558ea0=0x0;_0x558ea0<_0x10bbc7[_0xa43f('0x59')][_0xa43f('0x3c')];_0x558ea0++){var _0x16c5ba=_0x10bbc7[_0xa43f('0x59')][_0x558ea0];var _0x2ee9fb='i';var _0x1af0b7=_[_0xa43f('0x5a')](_0x2743ea,['name',_0x16c5ba['field']]);if(!_0x1af0b7){switch(_0x16c5ba[_0xa43f('0x43')]){case _0xa43f('0x5b'):if(_0x16c5ba['value']==0x1){_0x283757['having']('`'+_0x16c5ba['field']+_0xa43f('0x5c'));}else{_0x283757[_0xa43f('0x5d')]('`'+_0x16c5ba['field']+'`\x20>\x200');}break;case'Contact':if(_0x16c5ba[_0xa43f('0x5e')]===_0xa43f('0x5f')){if(_0x16c5ba[_0xa43f('0x60')][_0xa43f('0x30')]('\x20')[_0xa43f('0x3c')]>0x1){_0x2d2f87[_0x4815eb](_0xa43f('0x61'),qs[_0xa43f('0x62')](_0x16c5ba['value']),null);}else{var _0xa9e99b='%'+_0x16c5ba[_0xa43f('0x60')]+'%';_0x2d2f87[_0x4815eb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xa9e99b,_0xa9e99b,_0xa9e99b);}}else{_0x1af0b7=_[_0xa43f('0x5a')](_0x2743ea,[_0xa43f('0x2a'),_0xa43f('0x63')]);_0x16c5ba[_0xa43f('0x43')]='ContactId';_0x52fb00=as[_0xa43f('0x64')](_0x2ee9fb,_0x1af0b7['type'],_0x16c5ba);_0x2d2f87[_0x4815eb](_0x52fb00['text'],_0x52fb00[_0xa43f('0x60')][_0xa43f('0x65')],_0x52fb00[_0xa43f('0x60')][_0xa43f('0x1c')]);}break;case'Tag':var _0x247665=_0x16c5ba[_0xa43f('0x60')][_0xa43f('0x30')](',')[_0xa43f('0x2d')](function(_0x2ca10f){return Number(_0x2ca10f);});_0x247665[_0xa43f('0x66')](function(_0x1aaf96){_0x3e88a3['or'](_0xa43f('0x67'),'%,'+_0x1aaf96+',%');});_0x507704=_[_0xa43f('0x68')](_0x507704,_0x247665);break;case _0xa43f('0x69'):if(_0x16c5ba[_0xa43f('0x5e')]==='$substring'){_0x2d2f87[_0x4815eb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x16c5ba[_0xa43f('0x60')]+'%',null);}else{_0x1af0b7=_[_0xa43f('0x5a')](_0x2743ea,[_0xa43f('0x2a'),_0xa43f('0x6a')]);_0x16c5ba[_0xa43f('0x43')]='UserId';_0x52fb00=as[_0xa43f('0x64')](_0x2ee9fb,_0x1af0b7['type'],_0x16c5ba);_0x2d2f87[_0x4815eb](_0x52fb00[_0xa43f('0x6b')],_0x52fb00[_0xa43f('0x60')]['start'],_0x52fb00['value']['end']);}break;case _0xa43f('0x6c'):_0x52fb00=as[_0xa43f('0x64')]('me',null,_0x16c5ba);_0x2d2f87[_0x4815eb](_0x52fb00['text'],_0x52fb00[_0xa43f('0x60')][_0xa43f('0x65')],_0x52fb00[_0xa43f('0x60')][_0xa43f('0x1c')]);break;}}else{var _0x52fb00=as['buildExpression'](_0x2ee9fb,_0x1af0b7[_0xa43f('0x6d')],_0x16c5ba);_0x2d2f87[_0x4815eb](_0x52fb00[_0xa43f('0x6b')],_0x52fb00[_0xa43f('0x60')][_0xa43f('0x65')],_0x52fb00[_0xa43f('0x60')][_0xa43f('0x1c')]);}}}else{var _0x25be61=_(_0x1c3b24['query'])['keys']()[_0xa43f('0x2d')](function(_0x4b3e98){return _[_0xa43f('0x6e')](_0x2743ea,['name',_0x4b3e98])?_0x4b3e98:undefined;})[_0xa43f('0x6f')]()[_0xa43f('0x60')]();if(!_[_0xa43f('0x70')](_0x25be61)){_0x25be61[_0xa43f('0x66')](function(_0x29e54e){if(_0x29e54e==='SmsAccountId'){_0x283757[_0xa43f('0x41')](_0xa43f('0x71'),[][_0xa43f('0x72')](_0x1c3b24[_0xa43f('0x37')][_0x29e54e]));}else if(_0x29e54e===_0xa43f('0x73')){var _0x28137b=JSON[_0xa43f('0x74')](_0x1c3b24[_0xa43f('0x37')][_0x29e54e])['$gte'];var _0x428ddc=JSON['parse'](_0x1c3b24['query'][_0x29e54e])['$lte'];_0x283757['where'](_0xa43f('0x75'),_0x28137b,_0x428ddc);}else{if(_0x1c3b24[_0xa43f('0x37')][_0x29e54e]===_0xa43f('0x76')){_0x283757[_0xa43f('0x41')]('i.'+_0x29e54e+_0xa43f('0x77'));}else{_0x283757[_0xa43f('0x41')]('i.'+_0x29e54e+_0xa43f('0x78'),_0x1c3b24['query'][_0x29e54e]);}}});}if(_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x79')]){if(_0x1c3b24['query'][_0xa43f('0x79')]==0x1){_0x283757['having']('`unreadMessages`\x20=\x200');}else{_0x283757['having'](_0xa43f('0x7a'));}}if(_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x7b')]){_0x507704=_['isArray'](_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x7b')])?_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x7b')]:new Array(_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x7b')]);_0x507704[_0xa43f('0x66')](function(_0x185ddd){_0x3e88a3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x185ddd+',%');});}if(_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x7c')]){var _0xeaa686=_0x1c3b24[_0xa43f('0x37')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xa43f('0x7d')](_0xeaa686)){_0x2d2f87['or'](_0xa43f('0x7e'),_0xeaa686+'%')['or']('i.phone\x20LIKE\x20?',_0xeaa686+'%');}else{_0x2d2f87['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xeaa686))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xeaa686+'%');}}}_0x283757[_0xa43f('0x41')](_0x2d2f87);_0x283757[_0xa43f('0x7f')]('i.id');var _0x5264ff={'type':db[_0xa43f('0x80')][_0xa43f('0x81')][_0xa43f('0x82')],'raw':!![]};var _0x40f533=_0x283757['clone']();_0x40f533[_0xa43f('0x43')](_0xa43f('0x83'));_0x40f533['field'](_0xa43f('0x84'),_0xa43f('0x5b'));if(_0xd732b4['order']){_0xd732b4[_0xa43f('0x3f')]['forEach'](function(_0x2952b8){var _0x38726c=_0x2952b8[0x0]==='contactName'?_0x2952b8[0x0]:'i.'+_0x2952b8[0x0];_0x283757[_0xa43f('0x3f')](_0x38726c,_0x2952b8[0x1]===_0xa43f('0x85')?![]:!![]);});}if(!_[_0xa43f('0x70')](_0x507704)){_0x283757['having'](_0x3e88a3);_0x40f533[_0xa43f('0x41')](_0xa43f('0x86'),_0x507704);}BPromise['resolve']()[_0xa43f('0x25')](function(){if(!_0x10bbc7){if(_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x87')])return;_0x40f533['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x283757[_0xa43f('0x41')](_0xa43f('0x88'));return;}if(_0x1c3b24[_0xa43f('0x89')][_0xa43f('0x8a')]!==_0xa43f('0x8b'))return;return _0x1c3b24[_0xa43f('0x89')][_0xa43f('0x8c')]({'attributes':['id'],'raw':!![]})[_0xa43f('0x25')](function(_0x1d0b3a){if(_['isEmpty'](_0x1d0b3a)){_0x40f533[_0xa43f('0x41')](_0xa43f('0x8d'));_0x283757['where'](_0xa43f('0x8d'));}else{_0x40f533['where']('i.SmsAccountId\x20IN\x20?',_[_0xa43f('0x2d')](_0x1d0b3a,'id'));_0x283757[_0xa43f('0x41')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x1d0b3a,'id'));}});})[_0xa43f('0x25')](function(){if(_0x1c3b24[_0xa43f('0x89')][_0xa43f('0x8a')]===_0xa43f('0x8b')&&!_0x10bbc7&&!_0x1c3b24[_0xa43f('0x37')]['SmsAccountId'])return[];return db['sequelize'][_0xa43f('0x37')](_0x40f533[_0xa43f('0x8e')](),_0x5264ff);})[_0xa43f('0x25')](function(_0x652ba0){_0x5aa72f[_0xa43f('0x21')]=_0x652ba0[_0xa43f('0x3c')];if(_0x5aa72f[_0xa43f('0x21')]===0x0)return[];return db['sequelize']['query'](_0x2fcdfd['toString'](),_0x5264ff)[_0xa43f('0x25')](function(_0x148961){_0x20c062=_[_0xa43f('0x8f')](_0x148961,'id');_0x5264ff=_['merge'](_0x5264ff,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c3b24[_0xa43f('0x37')][_0xa43f('0x3b')]){_0xd732b4[_0xa43f('0x3a')]['forEach'](function(_0xe2b8c1){_0x283757[_0xa43f('0x43')]('i.'+_0xe2b8c1);});}else{_0x283757['field'](_0xa43f('0x84'),_0xa43f('0x5b'));_0x283757[_0xa43f('0x43')](_0xa43f('0x90'),_0xa43f('0x91'));_0x283757['field']('a.mandatoryDisposition',_0xa43f('0x92'));_0x283757[_0xa43f('0x43')]('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',_0xa43f('0x93'));_0x283757[_0xa43f('0x43')](_0xa43f('0x94'));_0x283757[_0xa43f('0x43')]('c.firstName',_0xa43f('0x95'));_0x283757[_0xa43f('0x43')]('c.lastName',_0xa43f('0x96'));_0x283757[_0xa43f('0x43')]('c.email',_0xa43f('0x97'));_0x283757['field'](_0xa43f('0x98'),'Contact.phone');_0x283757[_0xa43f('0x43')](_0xa43f('0x99'),_0xa43f('0x9a'));_0x283757[_0xa43f('0x43')]('c.fax',_0xa43f('0x9b'));_0x283757['field']('o.fullname',_0xa43f('0x9c'));_0x283757[_0xa43f('0x43')]('o.internal','Owner.internal');_0x283757['field'](_0xa43f('0x9d'),'TagIds');}if(_0xd732b4[_0xa43f('0x20')])_0x283757[_0xa43f('0x20')](_0xd732b4[_0xa43f('0x20')]);if(_0xd732b4[_0xa43f('0x1e')])_0x283757[_0xa43f('0x1e')](_0xd732b4[_0xa43f('0x1e')]);return db[_0xa43f('0x9e')][_0xa43f('0x37')](_0x283757[_0xa43f('0x8e')](),_0x5264ff);})[_0xa43f('0x25')](function(_0x3057e5){if(_0x3057e5[_0xa43f('0x3c')]>0x0)_0x5f5db3[_0xa43f('0x41')](_0xa43f('0x9f'),_[_0xa43f('0x2d')](_0x3057e5,'id'));return db[_0xa43f('0x9e')][_0xa43f('0x37')](_0x5f5db3[_0xa43f('0x8e')](),_0x5264ff)['then'](function(_0x273fa1){var _0x42763a=_[_0xa43f('0xa0')](_0x273fa1,_0xa43f('0xa1'));var _0x2c2013=[];_0x3057e5[_0xa43f('0x66')](function(_0x1d84fb){_0x2c2013[_0xa43f('0x31')](updateSmsInteraction(_0x1d84fb,_0x20c062,_0x42763a));});return BPromise['all'](_0x2c2013);});});})[_0xa43f('0x25')](function(_0x324f80){_0x5aa72f['rows']=_0x324f80;return _0x5aa72f;})[_0xa43f('0x25')](respondWithFilteredResult(_0x4af6b6,_0xd732b4))['catch'](handleError(_0x4af6b6,null));};exports[_0xa43f('0xa2')]=function(_0x5bb9fa,_0x36443b){var _0x4f581c={'raw':![],'where':{'id':_0x5bb9fa['params']['id']}},_0x39ea3d={};_0x39ea3d[_0xa43f('0x36')]=_[_0xa43f('0xa3')](db['SmsInteraction'][_0xa43f('0x34')]);_0x39ea3d[_0xa43f('0x37')]=_[_0xa43f('0xa3')](_0x5bb9fa[_0xa43f('0x37')]);_0x39ea3d[_0xa43f('0x38')]=_[_0xa43f('0x39')](_0x39ea3d[_0xa43f('0x36')],_0x39ea3d[_0xa43f('0x37')]);_0x4f581c[_0xa43f('0x3a')]=_[_0xa43f('0x39')](_0x39ea3d[_0xa43f('0x36')],qs['fields'](_0x5bb9fa['query']['fields']));_0x4f581c['attributes']=_0x4f581c['attributes'][_0xa43f('0x3c')]?_0x4f581c[_0xa43f('0x3a')]:_0x39ea3d[_0xa43f('0x36')];if(_0x5bb9fa[_0xa43f('0x37')][_0xa43f('0xa4')]){_0x4f581c['include']=[{'all':!![]}];}_0x4f581c=_[_0xa43f('0xa5')]({},_0x4f581c,_0x5bb9fa[_0xa43f('0xa6')]);return db['SmsInteraction']['find'](_0x4f581c)[_0xa43f('0x25')](handleEntityNotFound(_0x36443b,null))[_0xa43f('0x25')](respondWithResult(_0x36443b,null))['catch'](handleError(_0x36443b,null));};exports[_0xa43f('0xa7')]=function(_0x3424d1,_0x42339b){return db[_0xa43f('0x33')][_0xa43f('0xa7')](_0x3424d1['body'],{})[_0xa43f('0x25')](respondWithResult(_0x42339b,0xc9))[_0xa43f('0x32')](handleError(_0x42339b,null));};exports[_0xa43f('0x24')]=function(_0x4d53a5,_0x582cfc){if(_0x4d53a5[_0xa43f('0x6c')]['id']){delete _0x4d53a5[_0xa43f('0x6c')]['id'];}return db[_0xa43f('0x33')][_0xa43f('0x5a')]({'where':{'id':_0x4d53a5[_0xa43f('0xa8')]['id']}})[_0xa43f('0x25')](handleEntityNotFound(_0x582cfc,null))[_0xa43f('0x25')](saveUpdates(_0x4d53a5[_0xa43f('0x6c')],null))[_0xa43f('0x25')](respondWithResult(_0x582cfc,null))[_0xa43f('0x32')](handleError(_0x582cfc,null));};exports[_0xa43f('0x26')]=function(_0xe90411,_0x8e5069){return db['SmsInteraction'][_0xa43f('0x5a')]({'where':{'id':_0xe90411['params']['id']}})[_0xa43f('0x25')](handleEntityNotFound(_0x8e5069,null))[_0xa43f('0x25')](removeEntity(_0x8e5069,null))[_0xa43f('0x32')](handleError(_0x8e5069,null));};exports[_0xa43f('0xa9')]=function(_0x1110a7,_0x4d01d7){return db[_0xa43f('0x33')]['describe']()[_0xa43f('0x25')](respondWithResult(_0x4d01d7,null))[_0xa43f('0x32')](handleError(_0x4d01d7,null));};exports[_0xa43f('0xaa')]=function(_0x56dcdb,_0x4f305f,_0x94ecb8){return db[_0xa43f('0xab')][_0xa43f('0x5a')]({'where':{'id':_0x56dcdb[_0xa43f('0xa8')]['id']}})['then'](handleEntityNotFound(_0x4f305f,null))[_0xa43f('0x25')](function(_0x46f55c){if(_0x46f55c){return _0x46f55c[_0xa43f('0xaa')](_0x56dcdb['body'][_0xa43f('0xac')],_['omit'](_0x56dcdb[_0xa43f('0x6c')],[_0xa43f('0xac'),'id'])||{});}})[_0xa43f('0x25')](respondWithResult(_0x4f305f,null))[_0xa43f('0x32')](handleError(_0x4f305f,null));};exports[_0xa43f('0xad')]=function(_0x201837,_0x2b8822,_0x41257f){var _0x4f9bef={'raw':![],'where':{}};var _0x4c9205={};var _0x34ede0={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xa43f('0xae')]({'where':{'id':_0x201837['params']['id']}})[_0xa43f('0x25')](handleEntityNotFound(_0x2b8822,null))[_0xa43f('0x25')](function(_0x18816b){if(_0x18816b){_0x4c9205[_0xa43f('0x36')]=_['keys'](db['SmsMessage'][_0xa43f('0x34')]);_0x4c9205['query']=_[_0xa43f('0xa3')](_0x201837[_0xa43f('0x37')]);_0x4c9205[_0xa43f('0x38')]=_[_0xa43f('0x39')](_0x4c9205[_0xa43f('0x36')],_0x4c9205[_0xa43f('0x37')]);_0x4f9bef[_0xa43f('0x3a')]=_[_0xa43f('0x39')](_0x4c9205['model'],qs[_0xa43f('0x3b')](_0x201837[_0xa43f('0x37')][_0xa43f('0x3b')]));_0x4f9bef['attributes']=_0x4f9bef['attributes'][_0xa43f('0x3c')]?_0x4f9bef['attributes']:_0x4c9205[_0xa43f('0x36')];if(!_0x201837['query'][_0xa43f('0x3d')](_0xa43f('0x3e'))){_0x4f9bef[_0xa43f('0x20')]=qs[_0xa43f('0x20')](_0x201837[_0xa43f('0x37')][_0xa43f('0x20')]);_0x4f9bef[_0xa43f('0x1e')]=qs['offset'](_0x201837[_0xa43f('0x37')]['offset']);}_0x4f9bef[_0xa43f('0x3f')]=qs[_0xa43f('0x40')](_0x201837[_0xa43f('0x37')][_0xa43f('0x40')]);_0x4f9bef[_0xa43f('0x41')]=qs[_0xa43f('0x38')](_[_0xa43f('0x42')](_0x201837['query'],_0x4c9205[_0xa43f('0x38')]));_0x4f9bef[_0xa43f('0x41')][_0xa43f('0xa1')]=_0x18816b['id'];if(_0x201837[_0xa43f('0x37')][_0xa43f('0x7c')]){_0x4f9bef[_0xa43f('0x41')]=_[_0xa43f('0xa5')](_0x4f9bef[_0xa43f('0x41')],{'$or':_[_0xa43f('0x2d')](_0x4f9bef[_0xa43f('0x3a')],function(_0x3fb111){var _0x513674={};_0x513674[_0x3fb111]={'$like':'%'+_0x201837['query'][_0xa43f('0x7c')]+'%'};return _0x513674;})});}if(_0x201837[_0xa43f('0x37')][_0xa43f('0xaf')]){var _0x490f8=_0x201837[_0xa43f('0x37')][_0xa43f('0xaf')]['split'](',');var _0x36990c={};_0x36990c[_0x490f8[0x0]]={'$gte':moment(_0x490f8[0x1])[_0xa43f('0xb0')](_0xa43f('0xb1'))};_0x4f9bef[_0xa43f('0x41')]=_[_0xa43f('0xa5')](_0x4f9bef['where'],_0x36990c);}_0x4f9bef=_[_0xa43f('0xa5')]({},_0x4f9bef,_0x201837[_0xa43f('0xa6')]);return db[_0xa43f('0xab')][_0xa43f('0x21')]({'where':_0x4f9bef[_0xa43f('0x41')]})[_0xa43f('0x25')](function(_0x3b7cf2){_0x34ede0[_0xa43f('0x21')]=_0x3b7cf2;if(_0x201837['query']['includeAll']){_0x4f9bef[_0xa43f('0xb2')]=[{'all':!![]}];}return db[_0xa43f('0xab')][_0xa43f('0xb3')](_0x4f9bef);})['then'](function(_0x1dc22d){_0x34ede0[_0xa43f('0xb4')]=_0x1dc22d;return _0x34ede0;});}})[_0xa43f('0x25')](respondWithFilteredResult(_0x2b8822,_0x4f9bef))[_0xa43f('0x32')](handleError(_0x2b8822,null));};exports[_0xa43f('0xb5')]=function(_0x4a6d68,_0x1d8cf5,_0x4d90d4){return db['SmsInteraction']['find']({'where':{'id':_0x4a6d68[_0xa43f('0xa8')]['id']}})[_0xa43f('0x25')](handleEntityNotFound(_0x1d8cf5,null))[_0xa43f('0x25')](function(_0x5c1e16){if(_0x5c1e16){return _0x5c1e16[_0xa43f('0xb6')](_0x4a6d68[_0xa43f('0x6c')][_0xa43f('0xac')],_[_0xa43f('0xb7')](_0x4a6d68[_0xa43f('0x6c')],[_0xa43f('0xac'),'id'])||{})['spread'](function(){return db['Tag'][_0xa43f('0xb3')]({'attributes':['id','name',_0xa43f('0x44')],'where':{'id':_0x4a6d68[_0xa43f('0x6c')]['ids']}});})[_0xa43f('0x25')](function(_0x5cc46d){socket[_0xa43f('0xb8')]('smsInteractionTags:save',{'id':Number(_0x4a6d68[_0xa43f('0xa8')]['id']),'tags':_0x5cc46d||[]});return{'id':Number(_0x4a6d68['params']['id']),'tags':_0x5cc46d||[]};});}})[_0xa43f('0x25')](respondWithResult(_0x1d8cf5,null))[_0xa43f('0x32')](handleError(_0x1d8cf5,null));};exports['removeTags']=function(_0x552675,_0x5e7bd2,_0x4074ef){return db[_0xa43f('0x33')]['find']({'where':{'id':_0x552675[_0xa43f('0xa8')]['id']}})[_0xa43f('0x25')](handleEntityNotFound(_0x5e7bd2,null))['then'](function(_0x332112){if(_0x332112){return _0x332112[_0xa43f('0xb9')](_0x552675[_0xa43f('0x37')][_0xa43f('0xac')]);}})[_0xa43f('0x25')](respondWithStatusCode(_0x5e7bd2,null))[_0xa43f('0x32')](handleError(_0x5e7bd2,null));};exports[_0xa43f('0xba')]=function(_0x5acb62,_0x1b9866){var _0x54bccd=moment()[_0xa43f('0xbb')]()[_0xa43f('0x8e')]();var _0x215e3e=path['join'](config[_0xa43f('0xbc')],_0xa43f('0xbd'),_0xa43f('0xbe'),'tmp');var _0x5ecbd9=path[_0xa43f('0xbf')](config[_0xa43f('0xbc')],_0xa43f('0xbd'),_0xa43f('0xbe'),_0xa43f('0xc0'));var _0x135019=path[_0xa43f('0xbf')](_0x215e3e,_0x54bccd);var _0x389ac4=util[_0xa43f('0xb0')](_0xa43f('0xc1'),_0x5acb62[_0xa43f('0xa8')]['id'],_0x54bccd);var _0x55de25=path[_0xa43f('0xbf')](_0x215e3e,_0x389ac4);var _0x438fb5=[];_0x438fb5[_0xa43f('0x31')]({'model':db[_0xa43f('0x69')],'as':_0xa43f('0x69'),'attributes':['id',_0xa43f('0xc2')],'raw':!![]});_0x438fb5[_0xa43f('0x31')]({'model':db[_0xa43f('0xc3')],'as':_0xa43f('0xc4'),'attributes':['id',_0xa43f('0xc5'),_0xa43f('0xc6')],'raw':!![]});var _0x38b5b6=[{'model':db[_0xa43f('0xab')],'as':_0xa43f('0xc7'),'attributes':['id',_0xa43f('0x6c'),_0xa43f('0x73'),_0xa43f('0xc8'),_0xa43f('0xc9'),_0xa43f('0x79')],'include':_0x438fb5}];_0x38b5b6[_0xa43f('0x31')]({'model':db['SmsAccount'],'as':_0xa43f('0xca'),'attributes':['id',_0xa43f('0x2a')]});_0x38b5b6['push']({'model':db['User'],'as':_0xa43f('0xcb'),'attributes':['id',_0xa43f('0xc2')]});return db[_0xa43f('0x33')][_0xa43f('0x5a')]({'where':{'id':_0x5acb62['params']['id']},'include':_0x38b5b6})[_0xa43f('0x25')](handleEntityNotFound(_0x1b9866,null))[_0xa43f('0x25')](function(_0x227d26){if(_0x227d26){var _0x2d0ca3=_0x227d26[_0xa43f('0xcc')]({'plain':!![]});fs[_0xa43f('0xcd')](_0x135019);var _0x1388b3={'channel':_0xa43f('0xce'),'account':_0x2d0ca3[_0xa43f('0xca')][_0xa43f('0x2a')],'agent':_0x2d0ca3[_0xa43f('0xcb')]?_0x2d0ca3[_0xa43f('0xcb')][_0xa43f('0xc2')]:_0xa43f('0xcf'),'createdAt':moment(_0x2d0ca3[_0xa43f('0x73')])[_0xa43f('0xb0')](_0xa43f('0xb1'))[_0xa43f('0x8e')](),'closedAt':_0x2d0ca3[_0xa43f('0xd0')]?moment(_0x2d0ca3[_0xa43f('0xd1')])['format'](_0xa43f('0xb1'))[_0xa43f('0x8e')]():'','disposition':_0x2d0ca3[_0xa43f('0xd2')],'messages':_(_0x2d0ca3['Messages'])[_0xa43f('0x7c')]({'secret':![]})[_0xa43f('0x2d')](function(_0x321b8f){return{'date':moment(_0x321b8f['createdAt'])[_0xa43f('0xb0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa43f('0x8e')](),'sender':_0x321b8f[_0xa43f('0xc8')]==='out'?_0x321b8f[_0xa43f('0x69')]?_0x321b8f[_0xa43f('0x69')][_0xa43f('0xc2')]:_0xa43f('0xd3'):_0x321b8f['Contact']['firstName']+(_0x321b8f[_0xa43f('0xc4')]['lastName']?'\x20'+_0x321b8f[_0xa43f('0xc4')][_0xa43f('0xc6')]:''),'body':_0x321b8f[_0xa43f('0x6c')],'direction':_0x321b8f[_0xa43f('0xc8')]===_0xa43f('0xd4')?'A':'C','secret':_0x321b8f['secret'],'read':_0x321b8f[_0xa43f('0x79')]};})['value']()};return ejs[_0xa43f('0xd5')](path[_0xa43f('0xbf')](config[_0xa43f('0xbc')],'server',_0xa43f('0xd6'),_0xa43f('0xd7')),{'interaction':_0x1388b3})[_0xa43f('0x25')](function(_0x171e4e){var _0x5e4cfe=path['join'](_0x135019,_0xa43f('0xd8')+_0x2d0ca3['id']+'-'+_0x54bccd+'.pdf');var _0x2861af={'path':_0x5e4cfe,'channel':'Sms','interactionId':_0x2d0ca3['id']};return pdf[_0xa43f('0xd9')](_0x171e4e,_0x2861af);})[_0xa43f('0x25')](function(){return new BPromise(function(_0x56e71c,_0x210359){zipdir(_0x135019,{'saveTo':_0x55de25},function(_0x2b0ebb,_0x140a37){if(_0x2b0ebb)return _0x210359(_0x2b0ebb);return _0x56e71c(_0x140a37);});})[_0xa43f('0x25')](function(){return new BPromise(function(_0x5644ab,_0x2e16a5){rimraf(_0x135019,function(_0x31fa23){if(_0x31fa23)_0x2e16a5(_0x31fa23);return _0x5644ab();});});})[_0xa43f('0x25')](function(){return _0x1b9866[_0xa43f('0xba')](_0x55de25,_0x389ac4,function(_0x4250a3){if(_0x4250a3){console['log'](_0xa43f('0xda'),_0x4250a3);}else{fs[_0xa43f('0xdb')](_0x55de25);}});});});}else{return _0x1b9866[_0xa43f('0x27')](0xc8);}})[_0xa43f('0x32')](handleError(_0x1b9866,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 11328dd..840ab12 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 _0x4e2e=['unreadMessages','emit','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x1a7db4,_0x1731a5){var _0x558811=function(_0x5e70d4){while(--_0x5e70d4){_0x1a7db4['push'](_0x1a7db4['shift']());}};_0x558811(++_0x1731a5);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2e7c1,_0x44dc7e){_0x2e7c1=_0x2e7c1-0x0;var _0xc436d0=_0x4e2e[_0x2e7c1];return _0xc436d0;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xe4e2('0x0'))['db'][_0xe4e2('0x1')];var SmsMessage=require(_0xe4e2('0x0'))['db'][_0xe4e2('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe4e2('0x3')](0x0);var events={'afterCreate':_0xe4e2('0x4'),'afterUpdate':'update','afterDestroy':_0xe4e2('0x5')};function emitEvent(_0x417dd4){return function(_0x2fb128,_0x38c84c,_0x48e83d){_0x2fb128[_0xe4e2('0x6')]({'attributes':['id'],'raw':!![]})[_0xe4e2('0x7')](function(_0x1c4e64){_0x2fb128[_0xe4e2('0x8')](_0xe4e2('0x9'),_0x1c4e64[_0xe4e2('0xa')](function(_0x1e9508){return{'id':_0x1e9508['id']};}));return SmsMessage[_0xe4e2('0xb')]({'where':{'SmsInteractionId':_0x2fb128['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd81011){_0x2fb128[_0xe4e2('0x8')](_0xe4e2('0xc'),_0xd81011['length']);SmsInteractionEvents[_0xe4e2('0xd')](_0x417dd4+':'+_0x2fb128['id'],_0x2fb128);SmsInteractionEvents[_0xe4e2('0xd')](_0x417dd4,_0x2fb128);_0x48e83d(null);})[_0xe4e2('0xe')](_0x48e83d(null));};}for(var e in events){if(events[_0xe4e2('0xf')](e)){var event=events[e];SmsInteraction[_0xe4e2('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x2272=['findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x2227('0x0'));var SmsInteraction=require(_0x2227('0x1'))['db'][_0x2227('0x2')];var SmsMessage=require(_0x2227('0x1'))['db'][_0x2227('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2227('0x4'),'afterUpdate':_0x2227('0x5'),'afterDestroy':_0x2227('0x6')};function emitEvent(_0x4c17c2){return function(_0x4ebde3,_0x1e5a8a,_0x3b8661){_0x4ebde3[_0x2227('0x7')]({'attributes':['id'],'raw':!![]})[_0x2227('0x8')](function(_0xaec623){_0x4ebde3[_0x2227('0x9')](_0x2227('0xa'),_0xaec623[_0x2227('0xb')](function(_0x18094d){return{'id':_0x18094d['id']};}));return SmsMessage[_0x2227('0xc')]({'where':{'SmsInteractionId':_0x4ebde3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x799370){_0x4ebde3['setDataValue'](_0x2227('0xd'),_0x799370[_0x2227('0xe')]);SmsInteractionEvents[_0x2227('0xf')](_0x4c17c2+':'+_0x4ebde3['id'],_0x4ebde3);SmsInteractionEvents[_0x2227('0xf')](_0x4c17c2,_0x4ebde3);_0x3b8661(null);})[_0x2227('0x10')](_0x3b8661(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x2227('0x11')](e,emitEvent(event));}}module[_0x2227('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index f0b4c0d..b5ab321 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 _0x8101=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xa30c5d,_0x2934f6){var _0x280310=function(_0x2faa66){while(--_0x2faa66){_0xa30c5d['push'](_0xa30c5d['shift']());}};_0x280310(++_0x2934f6);}(_0x8101,0x1b7));var _0x1810=function(_0x112aa9,_0x51a391){_0x112aa9=_0x112aa9-0x0;var _0xebc169=_0x8101[_0x112aa9];return _0xebc169;};'use strict';var _=require(_0x1810('0x0'));var util=require(_0x1810('0x1'));var logger=require(_0x1810('0x2'))('api');var moment=require(_0x1810('0x3'));var BPromise=require(_0x1810('0x4'));var rp=require(_0x1810('0x5'));var fs=require('fs');var path=require(_0x1810('0x6'));var rimraf=require(_0x1810('0x7'));var config=require(_0x1810('0x8'));var attributes=require('./smsInteraction.attributes');module[_0x1810('0x9')]=function(_0x2d92b4,_0x2f61b8){return _0x2d92b4[_0x1810('0xa')](_0x1810('0xb'),attributes,{'tableName':_0x1810('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d665b,_0x32b29c,_0x3124d7){if(_0x2d665b[_0x1810('0xd')](_0x1810('0xe'))){_0x2d665b[_0x1810('0xf')]=moment()[_0x1810('0x10')](_0x1810('0x11'));}_0x3124d7(null,_0x2d665b);}}});}; \ No newline at end of file +var _0x3a84=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsInteraction','sms_interactions','changed','closed'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3a84,0xed));var _0x43a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a84[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x43a8('0x0'));var util=require(_0x43a8('0x1'));var logger=require(_0x43a8('0x2'))(_0x43a8('0x3'));var moment=require(_0x43a8('0x4'));var BPromise=require(_0x43a8('0x5'));var rp=require(_0x43a8('0x6'));var fs=require('fs');var path=require(_0x43a8('0x7'));var rimraf=require(_0x43a8('0x8'));var config=require(_0x43a8('0x9'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x137031,_0x190701){return _0x137031[_0x43a8('0xa')](_0x43a8('0xb'),attributes,{'tableName':_0x43a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2afe49,_0x404b6e,_0xccfcf5){if(_0x2afe49[_0x43a8('0xd')](_0x43a8('0xe'))){_0x2afe49[_0x43a8('0xf')]=moment()[_0x43a8('0x10')](_0x43a8('0x11'));}_0xccfcf5(null,_0x2afe49);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7749c2d..dbfabc3 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 _0x599d=['message','result','catch','UpdateSmsInteraction','body','options','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','ids','spread','AddTags','lodash','bluebird','randomstring','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x26c10f,_0x5411be){var _0x17e0b8=function(_0x535f1b){while(--_0x535f1b){_0x26c10f['push'](_0x26c10f['shift']());}};_0x17e0b8(++_0x5411be);}(_0x599d,0x137));var _0xd599=function(_0x29911c,_0x20f5fe){_0x29911c=_0x29911c-0x0;var _0x1549f1=_0x599d[_0x29911c];return _0x1549f1;};'use strict';var _=require(_0xd599('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd599('0x1'));var rs=require(_0xd599('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd599('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd599('0x4'));var client=jayson[_0xd599('0x5')][_0xd599('0x6')]({'port':0x232a});config[_0xd599('0x7')]=_[_0xd599('0x8')](config['redis'],{'host':_0xd599('0x9'),'port':0x18eb});var socket=require(_0xd599('0xa'))(new Redis(config[_0xd599('0x7')]));require(_0xd599('0xb'))['register'](socket);function respondWithRpcPromise(_0xf6d699,_0x551655,_0x3f052f){return new BPromise(function(_0x1da5be,_0x69fc88){return client[_0xd599('0xc')](_0xf6d699,_0x3f052f)[_0xd599('0xd')](function(_0xf6f49d){logger[_0xd599('0xe')](_0xd599('0xf'),_0x551655,_0xd599('0x10'));logger[_0xd599('0x11')](_0xd599('0x12'),_0x551655,_0xd599('0x10'),JSON[_0xd599('0x13')](_0xf6f49d));if(_0xf6f49d['error']){if(_0xf6f49d[_0xd599('0x14')][_0xd599('0x15')]===0x1f4){logger['error'](_0xd599('0xf'),_0x551655,_0xf6f49d[_0xd599('0x14')]['message']);return _0x69fc88(_0xf6f49d[_0xd599('0x14')][_0xd599('0x16')]);}logger[_0xd599('0x14')](_0xd599('0xf'),_0x551655,_0xf6f49d[_0xd599('0x14')][_0xd599('0x16')]);return _0x1da5be(_0xf6f49d[_0xd599('0x14')][_0xd599('0x16')]);}else{logger[_0xd599('0xe')]('SmsInteraction,\x20%s,\x20%s',_0x551655,_0xd599('0x10'));_0x1da5be(_0xf6f49d[_0xd599('0x17')][_0xd599('0x16')]);}})[_0xd599('0x18')](function(_0x27903f){logger[_0xd599('0x14')](_0xd599('0xf'),_0x551655,_0x27903f);_0x69fc88(_0x27903f);});});}exports[_0xd599('0x19')]=function(_0x2b5369){var _0x273a3c=this;return new Promise(function(_0x1de537,_0x48df65){return db['SmsInteraction']['update'](_0x2b5369[_0xd599('0x1a')],{'raw':_0x2b5369[_0xd599('0x1b')]?_0x2b5369['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5369[_0xd599('0x1b')]?_0x2b5369[_0xd599('0x1b')][_0xd599('0x1c')]||null:null,'attributes':_0x2b5369['options']?_0x2b5369[_0xd599('0x1b')][_0xd599('0x1d')]||null:null,'limit':_0x2b5369[_0xd599('0x1b')]?_0x2b5369[_0xd599('0x1b')][_0xd599('0x1e')]||null:null})[_0xd599('0xd')](function(_0x3209cf){logger[_0xd599('0xe')](_0xd599('0x19'),_0x2b5369);logger[_0xd599('0x11')](_0xd599('0x19'),_0x2b5369,JSON[_0xd599('0x13')](_0x3209cf));_0x1de537(_0x3209cf);})[_0xd599('0x18')](function(_0x30ee33){logger[_0xd599('0x14')](_0xd599('0x19'),_0x30ee33[_0xd599('0x16')],_0x2b5369);_0x48df65(_0x273a3c[_0xd599('0x14')](0x1f4,_0x30ee33[_0xd599('0x16')]));});});};exports[_0xd599('0x1f')]=function(_0x5c2780){return new Promise(function(_0x4aae1f,_0x46ab1c){return db[_0xd599('0x20')][_0xd599('0x21')]({'where':_0x5c2780['options']?_0x5c2780['options'][_0xd599('0x1c')]||null:null})[_0xd599('0xd')](function(_0x5558f6){if(_0x5558f6){return _0x5558f6['addTags'](_0x5c2780[_0xd599('0x1a')][_0xd599('0x22')],_['omit'](_0x5c2780[_0xd599('0x1a')],[_0xd599('0x22'),'id'])||{});}})[_0xd599('0x23')](function(_0x175fbb){logger[_0xd599('0xe')]('AddTags',_0x5c2780);logger[_0xd599('0x11')]('AddTags',_0x5c2780,JSON[_0xd599('0x13')](_0x175fbb));_0x4aae1f(_0x175fbb);})['catch'](function(_0x4237dd){logger[_0xd599('0x14')](_0xd599('0x24'),_0x4237dd[_0xd599('0x16')],_0x5c2780);_0x46ab1c(_this['error'](0x1f4,_0x4237dd[_0xd599('0x16')]));});});}; \ No newline at end of file +var _0x290a=['then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','./smsInteraction.socket','register','request'];(function(_0x2da45d,_0x35397b){var _0x1012a0=function(_0x2babc3){while(--_0x2babc3){_0x2da45d['push'](_0x2da45d['shift']());}};_0x1012a0(++_0x35397b);}(_0x290a,0x96));var _0xa290=function(_0x21f444,_0x4f7ba5){_0x21f444=_0x21f444-0x0;var _0x16da6e=_0x290a[_0x21f444];return _0x16da6e;};'use strict';var _=require(_0xa290('0x0'));var util=require(_0xa290('0x1'));var moment=require(_0xa290('0x2'));var BPromise=require(_0xa290('0x3'));var rs=require(_0xa290('0x4'));var fs=require('fs');var Redis=require(_0xa290('0x5'));var db=require(_0xa290('0x6'))['db'];var utils=require(_0xa290('0x7'));var logger=require(_0xa290('0x8'))(_0xa290('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa290('0xa')][_0xa290('0xb')]({'port':0x232a});config['redis']=_[_0xa290('0xc')](config[_0xa290('0xd')],{'host':_0xa290('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa290('0xd')]));require(_0xa290('0xf'))[_0xa290('0x10')](socket);function respondWithRpcPromise(_0x25b24d,_0x5f74dc,_0x755a9c){return new BPromise(function(_0x5579fa,_0x5d9bc2){return client[_0xa290('0x11')](_0x25b24d,_0x755a9c)[_0xa290('0x12')](function(_0x4d00a3){logger[_0xa290('0x13')](_0xa290('0x14'),_0x5f74dc,'request\x20sent');logger[_0xa290('0x15')](_0xa290('0x16'),_0x5f74dc,_0xa290('0x17'),JSON[_0xa290('0x18')](_0x4d00a3));if(_0x4d00a3[_0xa290('0x19')]){if(_0x4d00a3[_0xa290('0x19')]['code']===0x1f4){logger[_0xa290('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x5f74dc,_0x4d00a3['error'][_0xa290('0x1a')]);return _0x5d9bc2(_0x4d00a3[_0xa290('0x19')][_0xa290('0x1a')]);}logger['error'](_0xa290('0x14'),_0x5f74dc,_0x4d00a3['error'][_0xa290('0x1a')]);return _0x5579fa(_0x4d00a3[_0xa290('0x19')][_0xa290('0x1a')]);}else{logger['info'](_0xa290('0x14'),_0x5f74dc,_0xa290('0x17'));_0x5579fa(_0x4d00a3['result'][_0xa290('0x1a')]);}})[_0xa290('0x1b')](function(_0x34e35a){logger[_0xa290('0x19')](_0xa290('0x14'),_0x5f74dc,_0x34e35a);_0x5d9bc2(_0x34e35a);});});}exports[_0xa290('0x1c')]=function(_0x5f32c6){var _0x297c3d=this;return new Promise(function(_0x59f827,_0x3d260b){return db[_0xa290('0x1d')][_0xa290('0x1e')](_0x5f32c6[_0xa290('0x1f')],{'raw':_0x5f32c6[_0xa290('0x20')]?_0x5f32c6[_0xa290('0x20')][_0xa290('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f32c6[_0xa290('0x20')]?_0x5f32c6[_0xa290('0x20')][_0xa290('0x22')]||null:null,'attributes':_0x5f32c6[_0xa290('0x20')]?_0x5f32c6[_0xa290('0x20')][_0xa290('0x23')]||null:null,'limit':_0x5f32c6[_0xa290('0x20')]?_0x5f32c6['options'][_0xa290('0x24')]||null:null})[_0xa290('0x12')](function(_0x453995){logger[_0xa290('0x13')](_0xa290('0x1c'),_0x5f32c6);logger[_0xa290('0x15')](_0xa290('0x1c'),_0x5f32c6,JSON['stringify'](_0x453995));_0x59f827(_0x453995);})[_0xa290('0x1b')](function(_0x296e2a){logger[_0xa290('0x19')](_0xa290('0x1c'),_0x296e2a[_0xa290('0x1a')],_0x5f32c6);_0x3d260b(_0x297c3d['error'](0x1f4,_0x296e2a[_0xa290('0x1a')]));});});};exports[_0xa290('0x25')]=function(_0x459440){return new Promise(function(_0x56d38c,_0x4eccb3){return db[_0xa290('0x1d')]['find']({'where':_0x459440['options']?_0x459440[_0xa290('0x20')][_0xa290('0x22')]||null:null})[_0xa290('0x12')](function(_0x57343d){if(_0x57343d){return _0x57343d[_0xa290('0x26')](_0x459440[_0xa290('0x1f')][_0xa290('0x27')],_['omit'](_0x459440[_0xa290('0x1f')],[_0xa290('0x27'),'id'])||{});}})[_0xa290('0x28')](function(_0x20f7a1){logger[_0xa290('0x13')](_0xa290('0x29'),_0x459440);logger[_0xa290('0x15')]('AddTags',_0x459440,JSON['stringify'](_0x20f7a1));_0x56d38c(_0x20f7a1);})[_0xa290('0x1b')](function(_0x968f59){logger[_0xa290('0x19')](_0xa290('0x29'),_0x968f59[_0xa290('0x1a')],_0x459440);_0x4eccb3(_this['error'](0x1f4,_0x968f59[_0xa290('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 82f4fcb..34ea9ed 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 _0x8033=['remove','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0x8033,0x68));var _0x3803=function(_0x1aa436,_0x543367){_0x1aa436=_0x1aa436-0x0;var _0x44441d=_0x8033[_0x1aa436];return _0x44441d;};'use strict';var SmsInteractionEvents=require(_0x3803('0x0'));var events=['save',_0x3803('0x1'),'update'];function createListener(_0x576782,_0x8a07ba){return function(_0x4abe1b){_0x8a07ba[_0x3803('0x2')](_0x576782,_0x4abe1b);};}function removeListener(_0x2b22f1,_0x1bcf2c){return function(){SmsInteractionEvents[_0x3803('0x3')](_0x2b22f1,_0x1bcf2c);};}exports[_0x3803('0x4')]=function(_0x239aa7){for(var _0x228966=0x0,_0x3cc840=events[_0x3803('0x5')];_0x228966<_0x3cc840;_0x228966++){var _0x58f876=events[_0x228966];var _0x2ed985=createListener(_0x3803('0x6')+_0x58f876,_0x239aa7);SmsInteractionEvents['on'](_0x58f876,_0x2ed985);}}; \ No newline at end of file +var _0x3631=['update','emit','removeListener','register','smsInteraction:','./smsInteraction.events','save'];(function(_0x8d7b3c,_0x25d6f3){var _0x5af811=function(_0x13073e){while(--_0x13073e){_0x8d7b3c['push'](_0x8d7b3c['shift']());}};_0x5af811(++_0x25d6f3);}(_0x3631,0x155));var _0x1363=function(_0x5bdf8e,_0x45d970){_0x5bdf8e=_0x5bdf8e-0x0;var _0x3e0750=_0x3631[_0x5bdf8e];return _0x3e0750;};'use strict';var SmsInteractionEvents=require(_0x1363('0x0'));var events=[_0x1363('0x1'),'remove',_0x1363('0x2')];function createListener(_0x201716,_0x208d57){return function(_0x2d7d2b){_0x208d57[_0x1363('0x3')](_0x201716,_0x2d7d2b);};}function removeListener(_0x20f3c2,_0x660f9f){return function(){SmsInteractionEvents[_0x1363('0x4')](_0x20f3c2,_0x660f9f);};}exports[_0x1363('0x5')]=function(_0x1e1726){for(var _0x5b2e11=0x0,_0x214432=events['length'];_0x5b2e11<_0x214432;_0x5b2e11++){var _0x424721=events[_0x5b2e11];var _0x539027=createListener(_0x1363('0x6')+_0x424721,_0x1e1726);SmsInteractionEvents['on'](_0x424721,_0x539027);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 99b5436..3149508 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 _0x93dc=['sms','smsmessage:create','create','put','/:id/accept','reject','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x35e55b,_0xa497d1){var _0x4b7ad6=function(_0x31a166){while(--_0x31a166){_0x35e55b['push'](_0x35e55b['shift']());}};_0x4b7ad6(++_0xa497d1);}(_0x93dc,0x161));var _0xc93d=function(_0x1b8282,_0x546511){_0x1b8282=_0x1b8282-0x0;var _0x599fac=_0x93dc[_0x1b8282];return _0x599fac;};'use strict';var multer=require(_0xc93d('0x0'));var util=require(_0xc93d('0x1'));var path=require(_0xc93d('0x2'));var timeout=require('connect-timeout');var express=require(_0xc93d('0x3'));var router=express[_0xc93d('0x4')]();var fs_extra=require(_0xc93d('0x5'));var auth=require(_0xc93d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc93d('0x7'));var controller=require(_0xc93d('0x8'));router['get']('/',auth[_0xc93d('0x9')](),controller[_0xc93d('0xa')]);router[_0xc93d('0xb')]('/describe',auth[_0xc93d('0x9')](),controller['describe']);router[_0xc93d('0xb')](_0xc93d('0xc'),auth[_0xc93d('0x9')](),controller[_0xc93d('0xd')]);router[_0xc93d('0xe')]('/',auth[_0xc93d('0x9')](),interaction['tracked'](_0xc93d('0xf'),_0xc93d('0x10')),controller[_0xc93d('0x11')]);router[_0xc93d('0xe')]('/:id/status',controller['status']);router[_0xc93d('0x12')](_0xc93d('0xc'),auth[_0xc93d('0x9')](),controller['update']);router[_0xc93d('0x12')](_0xc93d('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0xc93d('0x12')]('/:id/reject',auth[_0xc93d('0x9')](),controller[_0xc93d('0x14')]);router[_0xc93d('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc93d('0x16')]=router; \ No newline at end of file +var _0xa9b2=['create','put','update','reject','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','/:id','tracked','sms','smsmessage:create'];(function(_0x174d8b,_0x30ed1c){var _0x2d271d=function(_0x425dac){while(--_0x425dac){_0x174d8b['push'](_0x174d8b['shift']());}};_0x2d271d(++_0x30ed1c);}(_0xa9b2,0xde));var _0x2a9b=function(_0x4b1434,_0x1fa900){_0x4b1434=_0x4b1434-0x0;var _0x9870da=_0xa9b2[_0x4b1434];return _0x9870da;};'use strict';var multer=require(_0x2a9b('0x0'));var util=require('util');var path=require(_0x2a9b('0x1'));var timeout=require(_0x2a9b('0x2'));var express=require(_0x2a9b('0x3'));var router=express[_0x2a9b('0x4')]();var fs_extra=require(_0x2a9b('0x5'));var auth=require(_0x2a9b('0x6'));var interaction=require(_0x2a9b('0x7'));var config=require(_0x2a9b('0x8'));var controller=require(_0x2a9b('0x9'));router[_0x2a9b('0xa')]('/',auth['isAuthenticated'](),controller[_0x2a9b('0xb')]);router[_0x2a9b('0xa')]('/describe',auth[_0x2a9b('0xc')](),controller[_0x2a9b('0xd')]);router[_0x2a9b('0xa')](_0x2a9b('0xe'),auth[_0x2a9b('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x2a9b('0xf')](_0x2a9b('0x10'),_0x2a9b('0x11')),controller[_0x2a9b('0x12')]);router['post']('/:id/status',controller['status']);router[_0x2a9b('0x13')](_0x2a9b('0xe'),auth[_0x2a9b('0xc')](),controller[_0x2a9b('0x14')]);router[_0x2a9b('0x13')]('/:id/accept',auth[_0x2a9b('0xc')](),controller['accept']);router[_0x2a9b('0x13')]('/:id/reject',auth[_0x2a9b('0xc')](),controller[_0x2a9b('0x15')]);router[_0x2a9b('0x16')](_0x2a9b('0xe'),auth[_0x2a9b('0xc')](),controller[_0x2a9b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 26f73d4..bab1560 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 _0xc01b=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0xea5aa6,_0x5f3ef5){var _0x546d48=function(_0x430598){while(--_0x430598){_0xea5aa6['push'](_0xea5aa6['shift']());}};_0x546d48(++_0x5f3ef5);}(_0xc01b,0x74));var _0xbc01=function(_0x2c5189,_0x5b5f5c){_0x2c5189=_0x2c5189-0x0;var _0x423feb=_0xc01b[_0x2c5189];return _0x423feb;};'use strict';var Sequelize=require(_0xbc01('0x0'));module[_0xbc01('0x1')]={'body':{'type':Sequelize[_0xbc01('0x2')](_0xbc01('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbc01('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbc01('0x5')]('in',_0xbc01('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbc01('0x7')](0xbe)},'phone':{'type':Sequelize[_0xbc01('0x7')]},'readAt':{'type':Sequelize[_0xbc01('0x8')]},'secret':{'type':Sequelize[_0xbc01('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbc01('0x7')]},'providerResponse':{'type':Sequelize[_0xbc01('0x2')]}}; \ No newline at end of file +var _0x289f=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','TEXT','medium'];(function(_0x36530f,_0x23cfbf){var _0x2be258=function(_0x1f44a5){while(--_0x1f44a5){_0x36530f['push'](_0x36530f['shift']());}};_0x2be258(++_0x23cfbf);}(_0x289f,0x7d));var _0xf289=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x289f[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0xf289('0x0'));module['exports']={'body':{'type':Sequelize[_0xf289('0x1')](_0xf289('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf289('0x3')]('in',_0xf289('0x4')),'defaultValue':_0xf289('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf289('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf289('0x5')]},'readAt':{'type':Sequelize[_0xf289('0x6')]},'secret':{'type':Sequelize[_0xf289('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf289('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index a9d159c..7d01af1 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 _0xa713=['VIRTUAL','includeAll','findAll','rows','catch','create','body','find','params','destroy','describe','sms-interactions','accept','read','readAt','format','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','contact','User','SmsAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','offset','undefined','count','limit','Content-Range','apply','update','then','stack','name','send','index','map','SmsMessage','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0xa713,0x1ed));var _0x3a71=function(_0x5b3f45,_0x22182a){_0x5b3f45=_0x5b3f45-0x0;var _0x2ac860=_0xa713[_0x5b3f45];return _0x2ac860;};'use strict';var emlformat=require(_0x3a71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a71('0x1'));var jsonpatch=require(_0x3a71('0x2'));var rp=require(_0x3a71('0x3'));var moment=require(_0x3a71('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3a71('0x5'));var util=require(_0x3a71('0x6'));var path=require(_0x3a71('0x7'));var sox=require(_0x3a71('0x8'));var csv=require('to-csv');var ejs=require(_0x3a71('0x9'));var fs=require('fs');var fs_extra=require(_0x3a71('0xa'));var _=require(_0x3a71('0xb'));var squel=require(_0x3a71('0xc'));var crypto=require(_0x3a71('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3a71('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3a71('0xf'));var Redis=require(_0x3a71('0x10'));var authService=require(_0x3a71('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a71('0x12'));var logger=require(_0x3a71('0x13'))(_0x3a71('0x14'));var utils=require(_0x3a71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3a71('0x16'));var db=require(_0x3a71('0x17'))['db'];config[_0x3a71('0x18')]=_[_0x3a71('0x19')](config[_0x3a71('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3a71('0x1a'))(new Redis(config['redis']));require(_0x3a71('0x1b'))[_0x3a71('0x1c')](socket);var jayson=require(_0x3a71('0x1d'));var client=jayson[_0x3a71('0x1e')][_0x3a71('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x3a71('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4696c3,_0x4cd4fe,_0x413b58,_0x29cd06){return new BPromise(function(_0x452bd1,_0x5aa75e){var _0x9bd447=_0x29cd06||client;return _0x9bd447['request'](_0x4696c3,_0x413b58)['then'](function(_0x278c89){logger[_0x3a71('0x20')](_0x3a71('0x21'),_0x4cd4fe,'request\x20sent');logger['debug'](_0x3a71('0x22'),_0x4cd4fe,_0x3a71('0x23'),JSON[_0x3a71('0x24')](_0x278c89));if(_0x278c89[_0x3a71('0x25')]){if(_0x278c89[_0x3a71('0x25')][_0x3a71('0x26')]===0x1f4){logger['error'](_0x3a71('0x21'),_0x4cd4fe,_0x278c89[_0x3a71('0x25')]['message']);return _0x5aa75e(_0x278c89['error'][_0x3a71('0x27')]);}logger[_0x3a71('0x25')]('SmsMessage,\x20%s,\x20%s',_0x4cd4fe,_0x278c89['error']['message']);return _0x452bd1(_0x278c89[_0x3a71('0x25')][_0x3a71('0x27')]);}else{logger[_0x3a71('0x20')](_0x3a71('0x21'),_0x4cd4fe,_0x3a71('0x23'));_0x452bd1(_0x278c89[_0x3a71('0x28')]['message']);}})['catch'](function(_0x2c86b1){logger[_0x3a71('0x25')](_0x3a71('0x21'),_0x4cd4fe,_0x2c86b1);_0x5aa75e(_0x2c86b1);});});}function respondWithStatusCode(_0x5b435f,_0x5f30f9){_0x5f30f9=_0x5f30f9||0xcc;return function(_0x3e75d8){if(_0x3e75d8){return _0x5b435f['sendStatus'](_0x5f30f9);}return _0x5b435f[_0x3a71('0x29')](_0x5f30f9)[_0x3a71('0x2a')]();};}function respondWithResult(_0x12740d,_0x4f9c79){_0x4f9c79=_0x4f9c79||0xc8;return function(_0x2cdcb1){if(_0x2cdcb1){return _0x12740d[_0x3a71('0x29')](_0x4f9c79)['json'](_0x2cdcb1);}};}function respondWithFilteredResult(_0xa1f528,_0x403ab3){return function(_0x542348){if(_0x542348){var _0x29cd7b=typeof _0x403ab3[_0x3a71('0x2b')]===_0x3a71('0x2c')&&typeof _0x403ab3['limit']===_0x3a71('0x2c');var _0x4b1795=_0x542348[_0x3a71('0x2d')];var _0x2219dc=_0x29cd7b?0x0:_0x403ab3[_0x3a71('0x2b')];var _0x3b1546=_0x29cd7b?_0x542348[_0x3a71('0x2d')]:_0x403ab3[_0x3a71('0x2b')]+_0x403ab3[_0x3a71('0x2e')];var _0x5bb18f;if(_0x3b1546>=_0x4b1795){_0x3b1546=_0x4b1795;_0x5bb18f=0xc8;}else{_0x5bb18f=0xce;}_0xa1f528[_0x3a71('0x29')](_0x5bb18f);return _0xa1f528['set'](_0x3a71('0x2f'),_0x2219dc+'-'+_0x3b1546+'/'+_0x4b1795)['json'](_0x542348);}return null;};}function patchUpdates(_0x142874){return function(_0x347bad){try{jsonpatch[_0x3a71('0x30')](_0x347bad,_0x142874,!![]);}catch(_0x427791){return BPromise['reject'](_0x427791);}return _0x347bad['save']();};}function saveUpdates(_0xa44e94,_0x3bbe78){return function(_0x2e8674){if(_0x2e8674){return _0x2e8674[_0x3a71('0x31')](_0xa44e94)[_0x3a71('0x32')](function(_0x44b06d){return _0x44b06d;});}return null;};}function removeEntity(_0x4a0c19,_0x4780db){return function(_0x545f36){if(_0x545f36){return _0x545f36['destroy']()[_0x3a71('0x32')](function(){_0x4a0c19[_0x3a71('0x29')](0xcc)[_0x3a71('0x2a')]();});}};}function handleEntityNotFound(_0x561e9b,_0x4abc63){return function(_0x1b788a){if(!_0x1b788a){_0x561e9b['sendStatus'](0x194);}return _0x1b788a;};}function handleError(_0x5732f5,_0x44ff3b){_0x44ff3b=_0x44ff3b||0x1f4;return function(_0x477ee9){logger[_0x3a71('0x25')](_0x477ee9[_0x3a71('0x33')]);if(_0x477ee9[_0x3a71('0x34')]){delete _0x477ee9[_0x3a71('0x34')];}_0x5732f5['status'](_0x44ff3b)[_0x3a71('0x35')](_0x477ee9);};}exports[_0x3a71('0x36')]=function(_0x2c3e59,_0x31b98b){var _0x30e7e1={},_0x39e31={},_0x111eff={'count':0x0,'rows':[]};var _0x358b84=_[_0x3a71('0x37')](db[_0x3a71('0x38')][_0x3a71('0x39')],function(_0x1c117d){return{'name':_0x1c117d['fieldName'],'type':_0x1c117d['type'][_0x3a71('0x3a')]};});_0x39e31[_0x3a71('0x3b')]=_[_0x3a71('0x37')](_0x358b84,_0x3a71('0x34'));_0x39e31[_0x3a71('0x3c')]=_[_0x3a71('0x3d')](_0x2c3e59[_0x3a71('0x3c')]);_0x39e31[_0x3a71('0x3e')]=_[_0x3a71('0x3f')](_0x39e31[_0x3a71('0x3b')],_0x39e31[_0x3a71('0x3c')]);_0x30e7e1[_0x3a71('0x40')]=_['intersection'](_0x39e31[_0x3a71('0x3b')],qs[_0x3a71('0x41')](_0x2c3e59[_0x3a71('0x3c')][_0x3a71('0x41')]));_0x30e7e1['attributes']=_0x30e7e1[_0x3a71('0x40')][_0x3a71('0x42')]?_0x30e7e1[_0x3a71('0x40')]:_0x39e31[_0x3a71('0x3b')];if(!_0x2c3e59[_0x3a71('0x3c')]['hasOwnProperty'](_0x3a71('0x43'))){_0x30e7e1[_0x3a71('0x2e')]=qs[_0x3a71('0x2e')](_0x2c3e59[_0x3a71('0x3c')][_0x3a71('0x2e')]);_0x30e7e1[_0x3a71('0x2b')]=qs[_0x3a71('0x2b')](_0x2c3e59[_0x3a71('0x3c')][_0x3a71('0x2b')]);}_0x30e7e1[_0x3a71('0x44')]=qs[_0x3a71('0x45')](_0x2c3e59[_0x3a71('0x3c')][_0x3a71('0x45')]);_0x30e7e1['where']=qs[_0x3a71('0x3e')](_[_0x3a71('0x46')](_0x2c3e59[_0x3a71('0x3c')],_0x39e31[_0x3a71('0x3e')]),_0x358b84);if(_0x2c3e59[_0x3a71('0x3c')][_0x3a71('0x47')]){_0x30e7e1[_0x3a71('0x48')]=_[_0x3a71('0x49')](_0x30e7e1[_0x3a71('0x48')],{'$or':_[_0x3a71('0x37')](_0x358b84,function(_0x5b28b2){if(_0x5b28b2[_0x3a71('0x4a')]!==_0x3a71('0x4b')){var _0x40fbac={};_0x40fbac[_0x5b28b2['name']]={'$like':'%'+_0x2c3e59[_0x3a71('0x3c')][_0x3a71('0x47')]+'%'};return _0x40fbac;}})});}_0x30e7e1=_[_0x3a71('0x49')]({},_0x30e7e1,_0x2c3e59['options']);var _0x4bce6c={'where':_0x30e7e1['where']};return db[_0x3a71('0x38')]['count'](_0x4bce6c)[_0x3a71('0x32')](function(_0x2896a3){_0x111eff[_0x3a71('0x2d')]=_0x2896a3;if(_0x2c3e59[_0x3a71('0x3c')][_0x3a71('0x4c')]){_0x30e7e1['include']=[{'all':!![]}];}return db[_0x3a71('0x38')][_0x3a71('0x4d')](_0x30e7e1);})[_0x3a71('0x32')](function(_0x5bddb4){_0x111eff[_0x3a71('0x4e')]=_0x5bddb4;return _0x111eff;})['then'](respondWithFilteredResult(_0x31b98b,_0x30e7e1))[_0x3a71('0x4f')](handleError(_0x31b98b,null));};exports['show']=function(_0x41be97,_0x2fa52e){var _0x5a9d9a={'raw':!![],'where':{'id':_0x41be97['params']['id']}},_0x592159={};_0x592159[_0x3a71('0x3b')]=_[_0x3a71('0x3d')](db[_0x3a71('0x38')][_0x3a71('0x39')]);_0x592159[_0x3a71('0x3c')]=_[_0x3a71('0x3d')](_0x41be97[_0x3a71('0x3c')]);_0x592159[_0x3a71('0x3e')]=_['intersection'](_0x592159['model'],_0x592159[_0x3a71('0x3c')]);_0x5a9d9a['attributes']=_[_0x3a71('0x3f')](_0x592159[_0x3a71('0x3b')],qs[_0x3a71('0x41')](_0x41be97[_0x3a71('0x3c')]['fields']));_0x5a9d9a[_0x3a71('0x40')]=_0x5a9d9a[_0x3a71('0x40')]['length']?_0x5a9d9a[_0x3a71('0x40')]:_0x592159[_0x3a71('0x3b')];if(_0x41be97[_0x3a71('0x3c')][_0x3a71('0x4c')]){_0x5a9d9a['include']=[{'all':!![]}];}_0x5a9d9a=_['merge']({},_0x5a9d9a,_0x41be97['options']);return db[_0x3a71('0x38')]['find'](_0x5a9d9a)['then'](handleEntityNotFound(_0x2fa52e,null))[_0x3a71('0x32')](respondWithResult(_0x2fa52e,null))[_0x3a71('0x4f')](handleError(_0x2fa52e,null));};exports[_0x3a71('0x50')]=function(_0x1f3255,_0x475f99){return db[_0x3a71('0x38')][_0x3a71('0x50')](_0x1f3255[_0x3a71('0x51')],{})['then'](respondWithResult(_0x475f99,0xc9))['catch'](handleError(_0x475f99,null));};exports[_0x3a71('0x31')]=function(_0x26a79d,_0x1c25f1){if(_0x26a79d[_0x3a71('0x51')]['id']){delete _0x26a79d[_0x3a71('0x51')]['id'];}return db[_0x3a71('0x38')][_0x3a71('0x52')]({'where':{'id':_0x26a79d[_0x3a71('0x53')]['id']}})[_0x3a71('0x32')](handleEntityNotFound(_0x1c25f1,null))[_0x3a71('0x32')](saveUpdates(_0x26a79d['body'],null))[_0x3a71('0x32')](respondWithResult(_0x1c25f1,null))['catch'](handleError(_0x1c25f1,null));};exports[_0x3a71('0x54')]=function(_0x39d1cf,_0x25abc0){return db['SmsMessage'][_0x3a71('0x52')]({'where':{'id':_0x39d1cf[_0x3a71('0x53')]['id']}})[_0x3a71('0x32')](handleEntityNotFound(_0x25abc0,null))[_0x3a71('0x32')](removeEntity(_0x25abc0,null))[_0x3a71('0x4f')](handleError(_0x25abc0,null));};exports[_0x3a71('0x55')]=function(_0xac7100,_0x56d129){return db[_0x3a71('0x38')]['describe']()['then'](respondWithResult(_0x56d129,null))[_0x3a71('0x4f')](handleError(_0x56d129,null));};var interaction_log=require(_0x3a71('0x13'))(_0x3a71('0x56'));exports[_0x3a71('0x57')]=function(_0x42a6a3,_0x209bd6,_0x21d892){var _0xce8eca={'agent':{},'channel':'sms'};if(_0x42a6a3[_0x3a71('0x51')]['id']){delete _0x42a6a3[_0x3a71('0x51')]['id'];}_0x42a6a3[_0x3a71('0x51')][_0x3a71('0x58')]=!![];_0x42a6a3[_0x3a71('0x51')][_0x3a71('0x59')]=moment()[_0x3a71('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x42a6a3[_0x3a71('0x51')][_0x3a71('0x5b')]=_0x42a6a3[_0x3a71('0x51')][_0x3a71('0x5b')]||_0x42a6a3[_0x3a71('0x5c')]['id'];_0xce8eca[_0x3a71('0x5d')]['id']=_0x42a6a3['body'][_0x3a71('0x5b')];return db['SmsMessage'][_0x3a71('0x52')]({'where':{'id':_0x42a6a3[_0x3a71('0x53')]['id'],'UserId':null}})[_0x3a71('0x32')](handleEntityNotFound(_0x209bd6,null))[_0x3a71('0x32')](saveUpdates(_0x42a6a3[_0x3a71('0x51')],null))[_0x3a71('0x32')](function(_0x513a62){if(_0x513a62){_0xce8eca[_0x3a71('0x27')]=_0x513a62[_0x3a71('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0x3a71('0x52')]({'where':{'id':_0x513a62[_0x3a71('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x209bd6,null))[_0x3a71('0x32')](function(_0x5eca61){if(_0x5eca61){return _0x5eca61[_0x3a71('0x31')]({'UserId':_0x42a6a3[_0x3a71('0x51')]['UserId'],'read1stAt':_[_0x3a71('0x60')](_0x5eca61[_0x3a71('0x61')])?moment()[_0x3a71('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3a71('0x32')](function(_0x67e42f){if(_0x67e42f){_0xce8eca['interaction']=_0x67e42f[_0x3a71('0x5e')]({'plain':!![]});interaction_log[_0x3a71('0x20')](_0x3a71('0x62'),_0x42a6a3[_0x3a71('0x5c')]['id'],_0x42a6a3[_0x3a71('0x5c')][_0x3a71('0x34')],_0x42a6a3[_0x3a71('0x5c')][_0x3a71('0x63')],_0xce8eca[_0x3a71('0x64')]['id'],_0x42a6a3['body']?JSON['stringify'](_0x42a6a3['body']):_0x3a71('0x65'));return respondWithRpcPromise(_0x3a71('0x66'),'acceptMessage',_0xce8eca);}return null;})[_0x3a71('0x32')](function(_0xb9ee07){var _0x82015f=_0x3a71('0x67')+_0xb9ee07[_0x3a71('0x27')][_0x3a71('0x68')];return db[_0x3a71('0x69')]['query'](_0x82015f,{'type':db[_0x3a71('0x6a')][_0x3a71('0x6b')]['SELECT'],'raw':!![]})[_0x3a71('0x32')](function(_0x53e478){return _0x53e478;});})[_0x3a71('0x32')](function(_0x24bcea){if(_0x24bcea){_0xce8eca['message']['contact']=_0x24bcea[0x0];if(!_0x42a6a3['body'][_0x3a71('0x5b')])return;return db['User'][_0x3a71('0x52')]({'where':{'id':_0x42a6a3[_0x3a71('0x51')]['UserId'],'role':_0x3a71('0x5d')},'attributes':['id','name',_0x3a71('0x6c'),_0x3a71('0x6d'),_0x3a71('0x6e')],'raw':!![]});}return null;})[_0x3a71('0x32')](function(_0x8d9b59){if(!_0x8d9b59)return null;_0xce8eca[_0x3a71('0x27')]['agent']=_0x8d9b59;return _0xce8eca;})[_0x3a71('0x32')](function(_0x4e58ab){if(_0x4e58ab){if(_0x42a6a3['body']['manual']){_0xce8eca[_0x3a71('0x27')][_0x3a71('0x6f')]=util[_0x3a71('0x5a')](_0x3a71('0x70'),_0x42a6a3[_0x3a71('0x5c')][_0x3a71('0x34')]);_0xce8eca[_0x3a71('0x27')]['channel']=_0xce8eca[_0x3a71('0x71')];_0xce8eca['message'][_0x3a71('0x72')]='accept';return respondWithRpcPromise(_0x3a71('0x73'),'EventManager',{'event':_0x3a71('0x74'),'message':_0xce8eca['message']},client9002)[_0x3a71('0x32')](function(){return _0xce8eca;});}return _0xce8eca;}return null;})[_0x3a71('0x32')](respondWithResult(_0x209bd6,null))[_0x3a71('0x4f')](handleError(_0x209bd6,null));};var interaction_log=require(_0x3a71('0x13'))(_0x3a71('0x56'));exports[_0x3a71('0x75')]=function(_0x5011d9,_0x13df7c,_0x390b1b){var _0x54c6a0={'agent':{},'channel':_0x3a71('0x76')};if(_0x5011d9[_0x3a71('0x51')]['id']){delete _0x5011d9[_0x3a71('0x51')]['id'];}_0x5011d9[_0x3a71('0x51')][_0x3a71('0x5b')]=_0x5011d9[_0x3a71('0x51')][_0x3a71('0x5b')]||_0x5011d9[_0x3a71('0x5c')]['id'];_0x54c6a0[_0x3a71('0x5d')]['id']=_0x5011d9['body'][_0x3a71('0x5b')];return db[_0x3a71('0x38')][_0x3a71('0x52')]({'where':{'id':_0x5011d9['params']['id'],'UserId':null}})[_0x3a71('0x32')](handleEntityNotFound(_0x13df7c,null))[_0x3a71('0x32')](function(_0x27e218){if(_0x27e218){_0x54c6a0[_0x3a71('0x27')]=_0x27e218['get']({'plain':!![]});return db['SmsInteraction'][_0x3a71('0x52')]({'where':{'id':_0x27e218['SmsInteractionId']}});}return null;})[_0x3a71('0x32')](handleEntityNotFound(_0x13df7c,null))[_0x3a71('0x32')](function(_0x45b089){if(_0x45b089){_0x54c6a0[_0x3a71('0x64')]=_0x45b089[_0x3a71('0x5e')]({'plain':!![]});interaction_log[_0x3a71('0x20')](_0x3a71('0x77'),_0x5011d9[_0x3a71('0x5c')]['id'],_0x5011d9['user'][_0x3a71('0x34')],_0x5011d9[_0x3a71('0x5c')][_0x3a71('0x63')],_0x54c6a0[_0x3a71('0x64')]['id'],_0x5011d9[_0x3a71('0x51')]?JSON[_0x3a71('0x24')](_0x5011d9['body']):'null');return respondWithRpcPromise(_0x3a71('0x78'),_0x3a71('0x79'),_0x54c6a0);}return null;})[_0x3a71('0x32')](function(_0xe96cb1){var _0x14823b=_0x3a71('0x67')+_0xe96cb1[_0x3a71('0x27')]['ContactId'];return db[_0x3a71('0x69')][_0x3a71('0x3c')](_0x14823b,{'type':db[_0x3a71('0x6a')][_0x3a71('0x6b')][_0x3a71('0x7a')],'raw':!![]})[_0x3a71('0x32')](function(_0x425b99){return _0x425b99;});})[_0x3a71('0x32')](function(_0x4db925){if(_0x4db925){_0x54c6a0[_0x3a71('0x27')][_0x3a71('0x7b')]=_0x4db925[0x0];if(!_0x5011d9[_0x3a71('0x51')][_0x3a71('0x5b')])return;return db[_0x3a71('0x7c')][_0x3a71('0x52')]({'where':{'id':_0x5011d9[_0x3a71('0x51')][_0x3a71('0x5b')],'role':_0x3a71('0x5d')},'attributes':['id',_0x3a71('0x34'),_0x3a71('0x6c'),_0x3a71('0x6d'),'internal'],'raw':!![]});}return null;})[_0x3a71('0x32')](function(_0x3bb66f){if(!_0x3bb66f)return null;_0x54c6a0[_0x3a71('0x27')][_0x3a71('0x5d')]=_0x3bb66f;return _0x54c6a0;})[_0x3a71('0x32')](function(_0x5d9b6b){if(_0x5d9b6b){_0x5d9b6b['message']['interface']=util['format'](_0x3a71('0x70'),_0x5011d9[_0x3a71('0x5c')][_0x3a71('0x34')]);_0x5d9b6b[_0x3a71('0x27')]['channel']=_0x54c6a0[_0x3a71('0x71')];_0x5d9b6b[_0x3a71('0x27')][_0x3a71('0x72')]=_0x3a71('0x75');respondWithRpcPromise('EventManager',_0x3a71('0x73'),{'event':'rejectmessage','message':_0x5d9b6b[_0x3a71('0x27')]},client9002);return _0x54c6a0;}return null;})[_0x3a71('0x32')](respondWithResult(_0x13df7c,null))[_0x3a71('0x4f')](handleError(_0x13df7c,null));};exports[_0x3a71('0x29')]=function(_0xe0c2da,_0x38441f,_0x2ea6ad){if(_0xe0c2da['body']['id']){delete _0xe0c2da[_0x3a71('0x51')]['id'];}var _0x278d9f;return db['SmsMessage'][_0x3a71('0x52')]({'where':{'id':_0xe0c2da[_0x3a71('0x53')]['id']}})[_0x3a71('0x32')](handleEntityNotFound(_0x38441f,null))[_0x3a71('0x32')](function(_0x19c78d){if(_0x19c78d){_0x278d9f=_0x19c78d;return db[_0x3a71('0x7d')]['find']({'where':{'id':_0x19c78d['SmsAccountId']}});}})[_0x3a71('0x32')](handleEntityNotFound(_0x38441f,null))[_0x3a71('0x32')](function(_0x267c9d){if(_0x267c9d){logger[_0x3a71('0x7e')](_0x3a71('0x22'),'status',_0x3a71('0x7f'),_0x267c9d[_0x3a71('0x4a')],util[_0x3a71('0x80')](_0xe0c2da[_0x3a71('0x51')],{'showHidden':![],'depth':null}));switch(_0x267c9d['type']){case _0x3a71('0x81'):if(_0xe0c2da[_0x3a71('0x51')][_0x3a71('0x82')]&&_0xe0c2da[_0x3a71('0x51')][_0x3a71('0x82')]===_0x278d9f[_0x3a71('0x83')]){return _0x278d9f[_0x3a71('0x31')]({'read':!![]});}else{logger[_0x3a71('0x25')](_0x3a71('0x84'),_0x3a71('0x29'),'twilio',util[_0x3a71('0x80')](_0xe0c2da[_0x3a71('0x51')],{'showHidden':![],'depth':null}));}break;case _0x3a71('0x85'):if(_0xe0c2da[_0x3a71('0x51')][_0x3a71('0x86')]&&_0xe0c2da['body'][_0x3a71('0x86')]===_0x278d9f[_0x3a71('0x83')]&&_['indexOf']([_0x3a71('0x87'),_0x3a71('0x88')],_0xe0c2da[_0x3a71('0x51')]['Status'])>=0x0){return _0x278d9f[_0x3a71('0x31')]({'read':!![]});}else{logger[_0x3a71('0x25')](_0x3a71('0x84'),_0x3a71('0x29'),_0x3a71('0x89'),util[_0x3a71('0x80')](_0xe0c2da[_0x3a71('0x51')],{'showHidden':![],'depth':null}));}break;case _0x3a71('0x8a'):var _0x198efa=_0xe0c2da['body'][_0x3a71('0x8b')][0x0];if(_0x198efa[_0x3a71('0x29')][_0x3a71('0x8c')]===_0x3a71('0x8d')){return _0x278d9f['update']({'read':!![]});}else{logger[_0x3a71('0x25')](_0x3a71('0x84'),_0x3a71('0x29'),_0x3a71('0x8a'),util[_0x3a71('0x80')](_0xe0c2da[_0x3a71('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x278d9f;}})[_0x3a71('0x32')](respondWithResult(_0x38441f,null))['catch'](handleError(_0x38441f,null));}; \ No newline at end of file +var _0x3148=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','SmsMessage','findAll','catch','show','params','keys','include','options','create','body','find','describe','../../config/logger','sms-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','QueryTypes','rejectmessage','SmsAccount','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','delivered','plivio','infobip','results','groupName','DELIVERED','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes'];(function(_0x455377,_0x3421b0){var _0x223b0e=function(_0x2e49c7){while(--_0x2e49c7){_0x455377['push'](_0x455377['shift']());}};_0x223b0e(++_0x3421b0);}(_0x3148,0x165));var _0x8314=function(_0xd413a4,_0x3120fe){_0xd413a4=_0xd413a4-0x0;var _0x9170f4=_0x3148[_0xd413a4];return _0x9170f4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8314('0x0'));var jsonpatch=require(_0x8314('0x1'));var rp=require(_0x8314('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8314('0x3'));var csv=require(_0x8314('0x4'));var ejs=require(_0x8314('0x5'));var fs=require('fs');var fs_extra=require(_0x8314('0x6'));var _=require(_0x8314('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8314('0x8'));var deskjs=require(_0x8314('0x9'));var toCsv=require('to-csv');var querystring=require(_0x8314('0xa'));var Papa=require(_0x8314('0xb'));var Redis=require(_0x8314('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8314('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x8314('0xe'));var config=require(_0x8314('0xf'));var licenseUtil=require(_0x8314('0x10'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x8314('0x11')],{'host':_0x8314('0x12'),'port':0x18eb});var socket=require(_0x8314('0x13'))(new Redis(config[_0x8314('0x11')]));require(_0x8314('0x14'))['register'](socket);var jayson=require(_0x8314('0x15'));var client=jayson[_0x8314('0x16')]['http']({'port':0x232c});var client9002=jayson[_0x8314('0x16')][_0x8314('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x40dba1,_0x2dafc9,_0x4dc12a,_0x51cffa){return new BPromise(function(_0x3e68c8,_0x220205){var _0x5b3d91=_0x51cffa||client;return _0x5b3d91[_0x8314('0x18')](_0x40dba1,_0x4dc12a)[_0x8314('0x19')](function(_0x23e551){logger[_0x8314('0x1a')](_0x8314('0x1b'),_0x2dafc9,_0x8314('0x1c'));logger[_0x8314('0x1d')](_0x8314('0x1e'),_0x2dafc9,'request\x20sent',JSON[_0x8314('0x1f')](_0x23e551));if(_0x23e551[_0x8314('0x20')]){if(_0x23e551[_0x8314('0x20')][_0x8314('0x21')]===0x1f4){logger[_0x8314('0x20')](_0x8314('0x1b'),_0x2dafc9,_0x23e551[_0x8314('0x20')][_0x8314('0x22')]);return _0x220205(_0x23e551['error'][_0x8314('0x22')]);}logger[_0x8314('0x20')](_0x8314('0x1b'),_0x2dafc9,_0x23e551[_0x8314('0x20')][_0x8314('0x22')]);return _0x3e68c8(_0x23e551[_0x8314('0x20')][_0x8314('0x22')]);}else{logger['info'](_0x8314('0x1b'),_0x2dafc9,_0x8314('0x1c'));_0x3e68c8(_0x23e551['result'][_0x8314('0x22')]);}})['catch'](function(_0x2a1e9b){logger[_0x8314('0x20')]('SmsMessage,\x20%s,\x20%s',_0x2dafc9,_0x2a1e9b);_0x220205(_0x2a1e9b);});});}function respondWithStatusCode(_0x403e0b,_0x1a25f3){_0x1a25f3=_0x1a25f3||0xcc;return function(_0x2e2ef2){if(_0x2e2ef2){return _0x403e0b[_0x8314('0x23')](_0x1a25f3);}return _0x403e0b[_0x8314('0x24')](_0x1a25f3)[_0x8314('0x25')]();};}function respondWithResult(_0x37776e,_0x3d969a){_0x3d969a=_0x3d969a||0xc8;return function(_0x3e5040){if(_0x3e5040){return _0x37776e[_0x8314('0x24')](_0x3d969a)[_0x8314('0x26')](_0x3e5040);}};}function respondWithFilteredResult(_0x5ef009,_0xce1787){return function(_0x37a5bb){if(_0x37a5bb){var _0x569028=typeof _0xce1787[_0x8314('0x27')]===_0x8314('0x28')&&typeof _0xce1787[_0x8314('0x29')]==='undefined';var _0x53a487=_0x37a5bb[_0x8314('0x2a')];var _0x28cc9e=_0x569028?0x0:_0xce1787[_0x8314('0x27')];var _0x29e514=_0x569028?_0x37a5bb[_0x8314('0x2a')]:_0xce1787['offset']+_0xce1787[_0x8314('0x29')];var _0x23fddf;if(_0x29e514>=_0x53a487){_0x29e514=_0x53a487;_0x23fddf=0xc8;}else{_0x23fddf=0xce;}_0x5ef009[_0x8314('0x24')](_0x23fddf);return _0x5ef009[_0x8314('0x2b')](_0x8314('0x2c'),_0x28cc9e+'-'+_0x29e514+'/'+_0x53a487)[_0x8314('0x26')](_0x37a5bb);}return null;};}function patchUpdates(_0x4a2fec){return function(_0x1620ba){try{jsonpatch[_0x8314('0x2d')](_0x1620ba,_0x4a2fec,!![]);}catch(_0x372187){return BPromise['reject'](_0x372187);}return _0x1620ba[_0x8314('0x2e')]();};}function saveUpdates(_0x21996e,_0x2630d5){return function(_0x3fbe7d){if(_0x3fbe7d){return _0x3fbe7d[_0x8314('0x2f')](_0x21996e)[_0x8314('0x19')](function(_0x1fbc12){return _0x1fbc12;});}return null;};}function removeEntity(_0x2afda2,_0x6e061a){return function(_0x20c737){if(_0x20c737){return _0x20c737[_0x8314('0x30')]()[_0x8314('0x19')](function(){_0x2afda2[_0x8314('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e59d3,_0x5f14e6){return function(_0x3b3694){if(!_0x3b3694){_0x2e59d3[_0x8314('0x23')](0x194);}return _0x3b3694;};}function handleError(_0xe9f877,_0x55f75c){_0x55f75c=_0x55f75c||0x1f4;return function(_0x6453e3){logger[_0x8314('0x20')](_0x6453e3[_0x8314('0x31')]);if(_0x6453e3[_0x8314('0x32')]){delete _0x6453e3[_0x8314('0x32')];}_0xe9f877['status'](_0x55f75c)[_0x8314('0x33')](_0x6453e3);};}exports[_0x8314('0x34')]=function(_0x3b2914,_0x3efd02){var _0x25593b={},_0x4a3231={},_0x5a51dc={'count':0x0,'rows':[]};var _0x1ce94d=_[_0x8314('0x35')](db['SmsMessage'][_0x8314('0x36')],function(_0x17169d){return{'name':_0x17169d[_0x8314('0x37')],'type':_0x17169d[_0x8314('0x38')][_0x8314('0x39')]};});_0x4a3231[_0x8314('0x3a')]=_[_0x8314('0x35')](_0x1ce94d,_0x8314('0x32'));_0x4a3231[_0x8314('0x3b')]=_['keys'](_0x3b2914[_0x8314('0x3b')]);_0x4a3231['filters']=_[_0x8314('0x3c')](_0x4a3231['model'],_0x4a3231[_0x8314('0x3b')]);_0x25593b['attributes']=_['intersection'](_0x4a3231[_0x8314('0x3a')],qs[_0x8314('0x3d')](_0x3b2914[_0x8314('0x3b')][_0x8314('0x3d')]));_0x25593b[_0x8314('0x3e')]=_0x25593b[_0x8314('0x3e')][_0x8314('0x3f')]?_0x25593b[_0x8314('0x3e')]:_0x4a3231['model'];if(!_0x3b2914[_0x8314('0x3b')][_0x8314('0x40')](_0x8314('0x41'))){_0x25593b[_0x8314('0x29')]=qs[_0x8314('0x29')](_0x3b2914[_0x8314('0x3b')][_0x8314('0x29')]);_0x25593b[_0x8314('0x27')]=qs[_0x8314('0x27')](_0x3b2914[_0x8314('0x3b')][_0x8314('0x27')]);}_0x25593b[_0x8314('0x42')]=qs[_0x8314('0x43')](_0x3b2914['query']['sort']);_0x25593b[_0x8314('0x44')]=qs[_0x8314('0x45')](_[_0x8314('0x46')](_0x3b2914['query'],_0x4a3231['filters']),_0x1ce94d);if(_0x3b2914[_0x8314('0x3b')][_0x8314('0x47')]){_0x25593b[_0x8314('0x44')]=_['merge'](_0x25593b['where'],{'$or':_['map'](_0x1ce94d,function(_0x4a5725){if(_0x4a5725[_0x8314('0x38')]!==_0x8314('0x48')){var _0x4cba6f={};_0x4cba6f[_0x4a5725['name']]={'$like':'%'+_0x3b2914[_0x8314('0x3b')][_0x8314('0x47')]+'%'};return _0x4cba6f;}})});}_0x25593b=_[_0x8314('0x49')]({},_0x25593b,_0x3b2914['options']);var _0x409065={'where':_0x25593b['where']};return db[_0x8314('0x4a')][_0x8314('0x2a')](_0x409065)['then'](function(_0x2617f7){_0x5a51dc[_0x8314('0x2a')]=_0x2617f7;if(_0x3b2914[_0x8314('0x3b')]['includeAll']){_0x25593b['include']=[{'all':!![]}];}return db[_0x8314('0x4a')][_0x8314('0x4b')](_0x25593b);})[_0x8314('0x19')](function(_0x3a54c2){_0x5a51dc['rows']=_0x3a54c2;return _0x5a51dc;})[_0x8314('0x19')](respondWithFilteredResult(_0x3efd02,_0x25593b))[_0x8314('0x4c')](handleError(_0x3efd02,null));};exports[_0x8314('0x4d')]=function(_0x54c2d4,_0x441158){var _0x2c17fc={'raw':!![],'where':{'id':_0x54c2d4[_0x8314('0x4e')]['id']}},_0x60f683={};_0x60f683['model']=_[_0x8314('0x4f')](db[_0x8314('0x4a')][_0x8314('0x36')]);_0x60f683[_0x8314('0x3b')]=_[_0x8314('0x4f')](_0x54c2d4[_0x8314('0x3b')]);_0x60f683[_0x8314('0x45')]=_[_0x8314('0x3c')](_0x60f683[_0x8314('0x3a')],_0x60f683[_0x8314('0x3b')]);_0x2c17fc[_0x8314('0x3e')]=_[_0x8314('0x3c')](_0x60f683['model'],qs['fields'](_0x54c2d4['query'][_0x8314('0x3d')]));_0x2c17fc['attributes']=_0x2c17fc['attributes'][_0x8314('0x3f')]?_0x2c17fc[_0x8314('0x3e')]:_0x60f683[_0x8314('0x3a')];if(_0x54c2d4[_0x8314('0x3b')]['includeAll']){_0x2c17fc[_0x8314('0x50')]=[{'all':!![]}];}_0x2c17fc=_[_0x8314('0x49')]({},_0x2c17fc,_0x54c2d4[_0x8314('0x51')]);return db['SmsMessage']['find'](_0x2c17fc)[_0x8314('0x19')](handleEntityNotFound(_0x441158,null))['then'](respondWithResult(_0x441158,null))[_0x8314('0x4c')](handleError(_0x441158,null));};exports[_0x8314('0x52')]=function(_0x1f0486,_0x4dd90d){return db['SmsMessage'][_0x8314('0x52')](_0x1f0486[_0x8314('0x53')],{})['then'](respondWithResult(_0x4dd90d,0xc9))['catch'](handleError(_0x4dd90d,null));};exports[_0x8314('0x2f')]=function(_0x47d47a,_0x3fcfd7){if(_0x47d47a[_0x8314('0x53')]['id']){delete _0x47d47a[_0x8314('0x53')]['id'];}return db['SmsMessage'][_0x8314('0x54')]({'where':{'id':_0x47d47a[_0x8314('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3fcfd7,null))['then'](saveUpdates(_0x47d47a[_0x8314('0x53')],null))['then'](respondWithResult(_0x3fcfd7,null))[_0x8314('0x4c')](handleError(_0x3fcfd7,null));};exports[_0x8314('0x30')]=function(_0x40b8c3,_0x2e6eb8){return db['SmsMessage']['find']({'where':{'id':_0x40b8c3[_0x8314('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2e6eb8,null))[_0x8314('0x19')](removeEntity(_0x2e6eb8,null))[_0x8314('0x4c')](handleError(_0x2e6eb8,null));};exports[_0x8314('0x55')]=function(_0x4a2ab4,_0x486e32){return db[_0x8314('0x4a')][_0x8314('0x55')]()['then'](respondWithResult(_0x486e32,null))[_0x8314('0x4c')](handleError(_0x486e32,null));};var interaction_log=require(_0x8314('0x56'))(_0x8314('0x57'));exports[_0x8314('0x58')]=function(_0x5868f1,_0x20169e,_0x5c307b){var _0x1d2959={'agent':{},'channel':'sms'};if(_0x5868f1[_0x8314('0x53')]['id']){delete _0x5868f1[_0x8314('0x53')]['id'];}_0x5868f1[_0x8314('0x53')]['read']=!![];_0x5868f1[_0x8314('0x53')]['readAt']=moment()[_0x8314('0x59')](_0x8314('0x5a'));_0x5868f1[_0x8314('0x53')][_0x8314('0x5b')]=_0x5868f1[_0x8314('0x53')][_0x8314('0x5b')]||_0x5868f1[_0x8314('0x5c')]['id'];_0x1d2959[_0x8314('0x5d')]['id']=_0x5868f1[_0x8314('0x53')][_0x8314('0x5b')];return db['SmsMessage'][_0x8314('0x54')]({'where':{'id':_0x5868f1[_0x8314('0x4e')]['id'],'UserId':null}})[_0x8314('0x19')](handleEntityNotFound(_0x20169e,null))[_0x8314('0x19')](saveUpdates(_0x5868f1[_0x8314('0x53')],null))[_0x8314('0x19')](function(_0x10237a){if(_0x10237a){_0x1d2959[_0x8314('0x22')]=_0x10237a[_0x8314('0x5e')]({'plain':!![]});return db[_0x8314('0x5f')][_0x8314('0x54')]({'where':{'id':_0x10237a[_0x8314('0x60')]}});}return null;})[_0x8314('0x19')](handleEntityNotFound(_0x20169e,null))[_0x8314('0x19')](function(_0x21b4b2){if(_0x21b4b2){return _0x21b4b2[_0x8314('0x2f')]({'UserId':_0x5868f1[_0x8314('0x53')][_0x8314('0x5b')],'read1stAt':_[_0x8314('0x61')](_0x21b4b2['read1stAt'])?moment()[_0x8314('0x59')](_0x8314('0x5a')):undefined});}return null;})[_0x8314('0x19')](function(_0x1df117){if(_0x1df117){_0x1d2959[_0x8314('0x62')]=_0x1df117[_0x8314('0x5e')]({'plain':!![]});interaction_log[_0x8314('0x1a')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5868f1[_0x8314('0x5c')]['id'],_0x5868f1[_0x8314('0x5c')]['name'],_0x5868f1['user']['role'],_0x1d2959['interaction']['id'],_0x5868f1['body']?JSON[_0x8314('0x1f')](_0x5868f1[_0x8314('0x53')]):_0x8314('0x63'));return respondWithRpcPromise(_0x8314('0x64'),_0x8314('0x65'),_0x1d2959);}return null;})[_0x8314('0x19')](function(_0x1eb97a){var _0x189fb8=_0x8314('0x66')+_0x1eb97a[_0x8314('0x22')][_0x8314('0x67')];return db['sequelize']['query'](_0x189fb8,{'type':db[_0x8314('0x68')]['QueryTypes'][_0x8314('0x69')],'raw':!![]})[_0x8314('0x19')](function(_0x1969b3){return _0x1969b3;});})['then'](function(_0x354a07){if(_0x354a07){_0x1d2959[_0x8314('0x22')][_0x8314('0x6a')]=_0x354a07[0x0];if(!_0x5868f1[_0x8314('0x53')]['UserId'])return;return db[_0x8314('0x6b')]['find']({'where':{'id':_0x5868f1[_0x8314('0x53')][_0x8314('0x5b')],'role':'agent'},'attributes':['id',_0x8314('0x32'),_0x8314('0x6c'),_0x8314('0x6d'),_0x8314('0x6e')],'raw':!![]});}return null;})[_0x8314('0x19')](function(_0x5b1647){if(!_0x5b1647)return null;_0x1d2959['message']['agent']=_0x5b1647;return _0x1d2959;})['then'](function(_0x247072){if(_0x247072){if(_0x5868f1[_0x8314('0x53')]['manual']){_0x1d2959[_0x8314('0x22')][_0x8314('0x6f')]=util[_0x8314('0x59')](_0x8314('0x70'),_0x5868f1[_0x8314('0x5c')]['name']);_0x1d2959['message'][_0x8314('0x71')]=_0x1d2959[_0x8314('0x71')];_0x1d2959[_0x8314('0x22')][_0x8314('0x72')]=_0x8314('0x58');return respondWithRpcPromise(_0x8314('0x73'),_0x8314('0x73'),{'event':_0x8314('0x74'),'message':_0x1d2959[_0x8314('0x22')]},client9002)[_0x8314('0x19')](function(){return _0x1d2959;});}return _0x1d2959;}return null;})[_0x8314('0x19')](respondWithResult(_0x20169e,null))[_0x8314('0x4c')](handleError(_0x20169e,null));};var interaction_log=require(_0x8314('0x56'))('sms-interactions');exports[_0x8314('0x75')]=function(_0x596721,_0x34584d,_0x4e110d){var _0x1fa65b={'agent':{},'channel':_0x8314('0x76')};if(_0x596721[_0x8314('0x53')]['id']){delete _0x596721['body']['id'];}_0x596721['body'][_0x8314('0x5b')]=_0x596721[_0x8314('0x53')][_0x8314('0x5b')]||_0x596721[_0x8314('0x5c')]['id'];_0x1fa65b[_0x8314('0x5d')]['id']=_0x596721[_0x8314('0x53')][_0x8314('0x5b')];return db[_0x8314('0x4a')]['find']({'where':{'id':_0x596721[_0x8314('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x34584d,null))['then'](function(_0x296863){if(_0x296863){_0x1fa65b[_0x8314('0x22')]=_0x296863[_0x8314('0x5e')]({'plain':!![]});return db[_0x8314('0x5f')][_0x8314('0x54')]({'where':{'id':_0x296863[_0x8314('0x60')]}});}return null;})[_0x8314('0x19')](handleEntityNotFound(_0x34584d,null))['then'](function(_0x2c6afb){if(_0x2c6afb){_0x1fa65b['interaction']=_0x2c6afb[_0x8314('0x5e')]({'plain':!![]});interaction_log[_0x8314('0x1a')](_0x8314('0x77'),_0x596721[_0x8314('0x5c')]['id'],_0x596721[_0x8314('0x5c')][_0x8314('0x32')],_0x596721[_0x8314('0x5c')][_0x8314('0x78')],_0x1fa65b['interaction']['id'],_0x596721[_0x8314('0x53')]?JSON['stringify'](_0x596721['body']):_0x8314('0x63'));return respondWithRpcPromise(_0x8314('0x79'),_0x8314('0x7a'),_0x1fa65b);}return null;})[_0x8314('0x19')](function(_0x28ea0a){var _0x220416=_0x8314('0x66')+_0x28ea0a[_0x8314('0x22')][_0x8314('0x67')];return db[_0x8314('0x7b')][_0x8314('0x3b')](_0x220416,{'type':db[_0x8314('0x68')][_0x8314('0x7c')][_0x8314('0x69')],'raw':!![]})['then'](function(_0x61cef9){return _0x61cef9;});})[_0x8314('0x19')](function(_0x1de5a6){if(_0x1de5a6){_0x1fa65b['message'][_0x8314('0x6a')]=_0x1de5a6[0x0];if(!_0x596721[_0x8314('0x53')]['UserId'])return;return db[_0x8314('0x6b')]['find']({'where':{'id':_0x596721[_0x8314('0x53')][_0x8314('0x5b')],'role':_0x8314('0x5d')},'attributes':['id','name',_0x8314('0x6c'),'email',_0x8314('0x6e')],'raw':!![]});}return null;})[_0x8314('0x19')](function(_0x519b09){if(!_0x519b09)return null;_0x1fa65b[_0x8314('0x22')][_0x8314('0x5d')]=_0x519b09;return _0x1fa65b;})['then'](function(_0x114760){if(_0x114760){_0x114760['message'][_0x8314('0x6f')]=util[_0x8314('0x59')]('SIP/%s',_0x596721['user'][_0x8314('0x32')]);_0x114760['message'][_0x8314('0x71')]=_0x1fa65b[_0x8314('0x71')];_0x114760[_0x8314('0x22')][_0x8314('0x72')]=_0x8314('0x75');respondWithRpcPromise(_0x8314('0x73'),_0x8314('0x73'),{'event':_0x8314('0x7d'),'message':_0x114760[_0x8314('0x22')]},client9002);return _0x1fa65b;}return null;})[_0x8314('0x19')](respondWithResult(_0x34584d,null))[_0x8314('0x4c')](handleError(_0x34584d,null));};exports[_0x8314('0x24')]=function(_0x5262f3,_0x36fb67,_0x4ec49b){if(_0x5262f3['body']['id']){delete _0x5262f3['body']['id'];}var _0x1fcb65;return db[_0x8314('0x4a')][_0x8314('0x54')]({'where':{'id':_0x5262f3[_0x8314('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36fb67,null))['then'](function(_0x2eea5e){if(_0x2eea5e){_0x1fcb65=_0x2eea5e;return db[_0x8314('0x7e')][_0x8314('0x54')]({'where':{'id':_0x2eea5e['SmsAccountId']}});}})[_0x8314('0x19')](handleEntityNotFound(_0x36fb67,null))[_0x8314('0x19')](function(_0x16deed){if(_0x16deed){logger[_0x8314('0x1d')](_0x8314('0x1e'),_0x8314('0x24'),'received\x20delivery\x20report\x20from',_0x16deed[_0x8314('0x38')],util[_0x8314('0x7f')](_0x5262f3[_0x8314('0x53')],{'showHidden':![],'depth':null}));switch(_0x16deed[_0x8314('0x38')]){case _0x8314('0x80'):if(_0x5262f3[_0x8314('0x53')][_0x8314('0x81')]&&_0x5262f3[_0x8314('0x53')][_0x8314('0x81')]===_0x1fcb65[_0x8314('0x82')]){return _0x1fcb65['update']({'read':!![]});}else{logger[_0x8314('0x20')](_0x8314('0x83'),_0x8314('0x24'),_0x8314('0x80'),util[_0x8314('0x7f')](_0x5262f3[_0x8314('0x53')],{'showHidden':![],'depth':null}));}break;case _0x8314('0x84'):if(_0x5262f3['body'][_0x8314('0x85')]&&_0x5262f3[_0x8314('0x53')][_0x8314('0x85')]===_0x1fcb65[_0x8314('0x82')]&&_['indexOf'](['sent',_0x8314('0x86')],_0x5262f3[_0x8314('0x53')]['Status'])>=0x0){return _0x1fcb65[_0x8314('0x2f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8314('0x24'),_0x8314('0x87'),util[_0x8314('0x7f')](_0x5262f3[_0x8314('0x53')],{'showHidden':![],'depth':null}));}break;case _0x8314('0x88'):var _0x3588b4=_0x5262f3['body'][_0x8314('0x89')][0x0];if(_0x3588b4['status'][_0x8314('0x8a')]===_0x8314('0x8b')){return _0x1fcb65['update']({'read':!![]});}else{logger[_0x8314('0x20')](_0x8314('0x83'),'status',_0x8314('0x88'),util[_0x8314('0x7f')](_0x5262f3[_0x8314('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x1fcb65;}})[_0x8314('0x19')](respondWithResult(_0x36fb67,null))[_0x8314('0x4c')](handleError(_0x36fb67,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 3010d23..f8ef97f 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 _0x4612=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x382c17,_0x251da8){var _0xefbd61=function(_0x210be5){while(--_0x210be5){_0x382c17['push'](_0x382c17['shift']());}};_0xefbd61(++_0x251da8);}(_0x4612,0x1eb));var _0x2461=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x4612[_0x297fd3];return _0x2af381;};'use strict';var EventEmitter=require(_0x2461('0x0'));var SmsMessage=require(_0x2461('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2461('0x2'),'afterUpdate':_0x2461('0x3'),'afterDestroy':_0x2461('0x4')};function emitEvent(_0x4d1857){return function(_0x5945ce,_0x2466f4,_0x4308cb){SmsMessageEvents[_0x2461('0x5')](_0x4d1857+':'+_0x5945ce['id'],_0x5945ce);SmsMessageEvents[_0x2461('0x5')](_0x4d1857,_0x5945ce);_0x4308cb(null);};}for(var e in events){if(events[_0x2461('0x6')](e)){var event=events[e];SmsMessage[_0x2461('0x7')](e,emitEvent(event));}}module[_0x2461('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xd6f2=['hook','events','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x10c8d2,_0x23e0d4){var _0x521419=function(_0x25bc55){while(--_0x25bc55){_0x10c8d2['push'](_0x10c8d2['shift']());}};_0x521419(++_0x23e0d4);}(_0xd6f2,0x1b1));var _0x2d6f=function(_0x34947e,_0x45c404){_0x34947e=_0x34947e-0x0;var _0x87404f=_0xd6f2[_0x34947e];return _0x87404f;};'use strict';var EventEmitter=require(_0x2d6f('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x2d6f('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2d6f('0x2')](0x0);var events={'afterCreate':_0x2d6f('0x3'),'afterUpdate':_0x2d6f('0x4'),'afterDestroy':_0x2d6f('0x5')};function emitEvent(_0x34c917){return function(_0x483a5b,_0x1fcd58,_0xaadd69){SmsMessageEvents[_0x2d6f('0x6')](_0x34c917+':'+_0x483a5b['id'],_0x483a5b);SmsMessageEvents['emit'](_0x34c917,_0x483a5b);_0xaadd69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x2d6f('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 0ce90e7..861b4fd 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 _0x4fdb=['Missing\x20parameters:\x20base_url','csc','login','sender','text','keys','sort','length','apiKey','md5','digest','hex','signature=','/external/get/send.php?','id_sms','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','error','secret','SmsAccount','find','SmsAccountId','twilio','accountSid','authToken','phone','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','login?username=','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','inspect','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','username','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/status?token=','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','remote','application/json','IBSSO\x20','messages','infobip'];(function(_0x1b96ee,_0x32ffef){var _0x1aef42=function(_0x62d6e0){while(--_0x62d6e0){_0x1b96ee['push'](_0x1b96ee['shift']());}};_0x1aef42(++_0x32ffef);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x2062fe,_0xf12be0){_0x2062fe=_0x2062fe-0x0;var _0x151aeb=_0x4fdb[_0x2062fe];return _0x151aeb;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[{'name':_0xb4fd('0xc'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xb4fd('0xd')],'type':_0xb4fd('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18c0f7,_0x4eb1ae,_0x1e1e16){var _0x17ac4b=_0x14052b[_0xb4fd('0xf')];var _0x23b08f=_0x18c0f7[_0xb4fd('0x10')]({'plain':!![]});if(_0x23b08f['direction'][_0xb4fd('0x11')]()==='in'||_0x23b08f[_0xb4fd('0x12')][_0xb4fd('0x11')]()===_0xb4fd('0x13')&&!_0x23b08f['secret']&&!_[_0xb4fd('0x14')](_0x23b08f[_0xb4fd('0x15')])){_0x17ac4b[_0xb4fd('0x16')]['findOne']({'where':{'id':_0x23b08f[_0xb4fd('0x17')]}})[_0xb4fd('0x18')](function(_0xc35d8d){if(_0xc35d8d){_0xc35d8d[_0xb4fd('0x19')]({'lastMsgAt':_0x23b08f[_0xb4fd('0x1a')],'lastMsgDirection':_0x23b08f[_0xb4fd('0x12')][_0xb4fd('0x11')]()});}})['catch'](function(_0x2076d5){console[_0xb4fd('0x1b')](_0x2076d5);});}if(_0x23b08f[_0xb4fd('0x12')]===_0xb4fd('0x13')&&!_0x23b08f[_0xb4fd('0x1c')]){var _0x137e51;_0x17ac4b[_0xb4fd('0x1d')][_0xb4fd('0x1e')]({'where':{'id':_0x23b08f[_0xb4fd('0x1f')]},'raw':!![]})[_0xb4fd('0x18')](function(_0x19f7b0){_0x137e51=_0x19f7b0;if(_0x137e51&&_0x137e51['type']){switch(_0x137e51['type']){case'twilio':var _0x5c14c0=require(_0xb4fd('0x20'));if(_0x137e51[_0xb4fd('0x21')]&&_0x137e51[_0xb4fd('0x22')]&&_0x137e51[_0xb4fd('0x23')]){var _0x458133=new _0x5c14c0(_0x137e51[_0xb4fd('0x21')],_0x137e51[_0xb4fd('0x22')]);_0x458133['messages']['create']({'body':_0x23b08f[_0xb4fd('0xd')],'to':_0x23b08f[_0xb4fd('0x23')],'from':_0x137e51[_0xb4fd('0x23')],'statusCallback':_0x137e51['remote']+_0xb4fd('0x24')+_0x23b08f['id']+'/status?token='+_0x137e51[_0xb4fd('0x25')]})['then'](function(_0x2a9c8c){if(_0x2a9c8c[_0xb4fd('0x26')]){return _0x18c0f7[_0xb4fd('0x19')]({'messageId':_0x2a9c8c[_0xb4fd('0x26')]});}})[_0xb4fd('0x27')](function(_0x456f35){logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),'afterCreate','twilio',util['inspect'](_0x456f35,{'showHidden':![],'depth':null}));});}else{logger[_0xb4fd('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4fd('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xb4fd('0x2a'):var _0x7c5313=_0xb4fd('0x2b');if(_0x137e51['username']&&_0x137e51[_0xb4fd('0x2c')]){var _0x477a53={'recipient':[_0x23b08f[_0xb4fd('0x23')]],'message':_0x23b08f[_0xb4fd('0xd')],'message_type':_0x137e51['smsMethod']};if(_0x137e51[_0xb4fd('0x2d')]&&_0x137e51[_0xb4fd('0x2d')]!=='SI'){_0x477a53['sender']=_0x137e51[_0xb4fd('0x23')];}var _0x57ce81={'url':_0x7c5313+_0xb4fd('0x2e')+_0x137e51['username']+_0xb4fd('0x2f')+_0x137e51[_0xb4fd('0x2c')],'method':_0xb4fd('0x30')};rp(_0x57ce81)['then'](function(_0x55eed3){var _0x4d7a63=_0x55eed3['split'](';');var _0x1eeb9c={'user_key':_0x4d7a63[0x0],'session_key':_0x4d7a63[0x1]};_0x57ce81={'url':_0x7c5313+_0xb4fd('0x31'),'method':_0xb4fd('0x32'),'headers':{'user_key':_0x1eeb9c[_0xb4fd('0x33')],'Session_key':_0x1eeb9c[_0xb4fd('0x34')]},'json':!![],'body':_0x477a53};return rp(_0x57ce81);})[_0xb4fd('0x18')](function(_0xbf95eb){if(_0xbf95eb[_0xb4fd('0x35')]>=0x1){var _0x16a08a={'messageId':_0xbf95eb[_0xb4fd('0x36')]};if(_0x137e51[_0xb4fd('0x2d')]!=='GP'||!_0x137e51[_0xb4fd('0x37')]){_0x16a08a[_0xb4fd('0x38')]=!![];}return _0x18c0f7[_0xb4fd('0x19')](_0x16a08a);}else{return logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x2a'),util['inspect'](_0xbf95eb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x930751){return logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x2a'),util['inspect'](_0x930751,{'showHidden':![],'depth':null}));});}else{logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x2a'),_0xb4fd('0x39'));}break;case'connectel':if(_0x137e51[_0xb4fd('0x22')]){var _0x4bc6b2={'recipient':_0x23b08f[_0xb4fd('0x23')],'message':_0x23b08f[_0xb4fd('0xd')],'sender':_0x137e51['senderString']||_0x137e51['phone'],'authorization':_0x137e51[_0xb4fd('0x22')]};var _0x4eb1ae={'method':_0xb4fd('0x32'),'uri':_0xb4fd('0x3a'),'body':_0x4bc6b2,'json':!![]};rp(_0x4eb1ae)[_0xb4fd('0x18')](function(_0x2718a0){var _0x478cf3={'messageId':_0x2718a0[_0xb4fd('0x3b')]};if(!_0x137e51[_0xb4fd('0x37')]){_0x478cf3['read']=!![];}return _0x18c0f7[_0xb4fd('0x19')](_0x478cf3);})[_0xb4fd('0x27')](function(_0x17e024){logger[_0xb4fd('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4fd('0x29'),_0xb4fd('0x3c'),util[_0xb4fd('0x3d')](_0x17e024,{'showHidden':![],'depth':null}));});}else{logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),'connectel',_0xb4fd('0x3e'));}break;case _0xb4fd('0x3f'):if(_0x137e51['username']&&_0x137e51[_0xb4fd('0x2c')]){var _0x4bc6b2={'messages':[{'source':_0xb4fd('0x40'),'to':_0x23b08f[_0xb4fd('0x23')],'body':_0x23b08f[_0xb4fd('0xd')],'from':_0x137e51['senderString']||_0x137e51[_0xb4fd('0x23')]}]};var _0x671ce5=util[_0xb4fd('0x41')]('%s:%s',_0x137e51[_0xb4fd('0x42')],_0x137e51['password']);var _0x4eb1ae={'method':_0xb4fd('0x32'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4bc6b2,'headers':{'Authorization':util[_0xb4fd('0x41')]('Basic\x20%s',new Buffer(_0x671ce5)[_0xb4fd('0x43')](_0xb4fd('0x44')))},'json':!![]};rp(_0x4eb1ae)[_0xb4fd('0x18')](function(_0x5500ef){if(_0x5500ef[_0xb4fd('0x45')]>=0xc8&&_0x5500ef[_0xb4fd('0x45')]<=0xce){if(_0x5500ef[_0xb4fd('0x46')]&&_0x5500ef[_0xb4fd('0x46')][_0xb4fd('0x47')]>0x0){var _0x3415cd=_[_0xb4fd('0x48')](_0x5500ef['data']['messages']);var _0x1595f2={'messageId':_0x3415cd[_0xb4fd('0x49')]};if(!_0x137e51[_0xb4fd('0x37')]){_0x1595f2[_0xb4fd('0x38')]=!![];}return _0x18c0f7['update'](_0x1595f2);}else{logger[_0xb4fd('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb4fd('0x4a'),util[_0xb4fd('0x3d')](_0x5500ef,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xb4fd('0x28'),_0xb4fd('0x29'),'clickSend',util[_0xb4fd('0x3d')](_0x5500ef,{'showHidden':![],'depth':null}));}})[_0xb4fd('0x27')](function(_0x3b6014){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4fd('0x29'),_0xb4fd('0x4a'),util[_0xb4fd('0x3d')](_0x3b6014,{'showHidden':![],'depth':null}));});}else{logger[_0xb4fd('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4fd('0x29'),_0xb4fd('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xb4fd('0x4b'):if(_0x137e51[_0xb4fd('0x4c')]&&_0x137e51[_0xb4fd('0x22')]){var _0x4bc6b2={'dst':_0x23b08f[_0xb4fd('0x23')],'text':_0x23b08f[_0xb4fd('0xd')],'src':_0x137e51['senderString']||_0x137e51[_0xb4fd('0x23')],'url':_0x137e51['remote']+'/api/sms/messages/'+_0x23b08f['id']+_0xb4fd('0x4d')+_0x137e51[_0xb4fd('0x25')]};var _0x671ce5=util[_0xb4fd('0x41')](_0xb4fd('0x4e'),_0x137e51[_0xb4fd('0x4c')],_0x137e51[_0xb4fd('0x22')]);var _0x4eb1ae={'method':_0xb4fd('0x32'),'uri':util[_0xb4fd('0x41')](_0xb4fd('0x4f'),_0x137e51[_0xb4fd('0x4c')]),'body':_0x4bc6b2,'headers':{'Authorization':util[_0xb4fd('0x41')](_0xb4fd('0x50'),new Buffer(_0x671ce5)[_0xb4fd('0x43')]('base64'))},'json':!![]};rp(_0x4eb1ae)['then'](function(_0x130a5b){var _0x7c85e8={'messageId':_0x130a5b[_0xb4fd('0x51')][0x0]};return _0x18c0f7[_0xb4fd('0x19')](_0x7c85e8);})[_0xb4fd('0x27')](function(_0x5d1625){logger['error'](_0xb4fd('0x28'),_0xb4fd('0x29'),'plivo',util['inspect'](_0x5d1625,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x4b'),_0xb4fd('0x52'));}break;case'infobip':if(_0x137e51['username']&&_0x137e51[_0xb4fd('0x2c')]){if(_0x137e51[_0xb4fd('0x53')]){var _0x22ec0d={'method':'POST','uri':_0x137e51[_0xb4fd('0x53')]+_0xb4fd('0x54'),'body':{'username':_0x137e51[_0xb4fd('0x42')],'password':_0x137e51[_0xb4fd('0x2c')]},'json':!![]};return rp(_0x22ec0d)['then'](function(_0x423112){var _0x16c8e6={'method':'POST','uri':_0x137e51[_0xb4fd('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x137e51[_0xb4fd('0x23')],'destinations':[{'to':_0x23b08f['phone']}],'text':_0x23b08f[_0xb4fd('0xd')],'notifyUrl':_0x137e51[_0xb4fd('0x55')]+_0xb4fd('0x24')+_0x23b08f['id']+_0xb4fd('0x4d')+_0x137e51[_0xb4fd('0x25')],'notifyContentType':_0xb4fd('0x56'),'callbackData':_0x137e51[_0xb4fd('0x23')]+';'+_0x23b08f[_0xb4fd('0xd')]}]},'headers':{'Authorization':_0xb4fd('0x57')+_0x423112[_0xb4fd('0x25')]},'json':!![]};return rp(_0x16c8e6)[_0xb4fd('0x18')](function(_0x40882b){if(_0x40882b[_0xb4fd('0x58')]){var _0x454acd={'messageId':_0x40882b['messages'][0x0][_0xb4fd('0xc')]};if(!_0x137e51['deliveryReport']){_0x454acd[_0xb4fd('0x38')]=!![];}return _0x18c0f7['update'](_0x454acd);}else{return logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x59'),util['inspect'](_0x40882b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x23333c){return logger['error'](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x59'),util['inspect'](_0x23333c,{'showHidden':![],'depth':null}));});}else{logger[_0xb4fd('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4fd('0x29'),_0xb4fd('0x59'),_0xb4fd('0x5a'));}}else{logger[_0xb4fd('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4fd('0x29'),'infobip',_0xb4fd('0x39'));}break;case _0xb4fd('0x5b'):var _0x28a12c=require('crypto');if(_0x137e51['apiKey']){var _0x571571={};_0x571571[_0xb4fd('0x5c')]=_0x137e51['username'];_0x571571[_0xb4fd('0x23')]=_0x23b08f['phone'];_0x571571[_0xb4fd('0x5d')]=_0x137e51[_0xb4fd('0x23')];_0x571571[_0xb4fd('0x5e')]=_0x23b08f[_0xb4fd('0xd')];_0x571571['timestamp']=+new Date();var _0x216173='';var _0x155942='';var _0x5b4ebe=Object[_0xb4fd('0x5f')](_0x571571);_0x5b4ebe[_0xb4fd('0x60')]();for(var _0x5a2bf1=0x0;_0x5a2bf1<_0x5b4ebe[_0xb4fd('0x61')];_0x5a2bf1++){if(_0x216173!=''){_0x216173+='&';}_0x216173+=_0x5b4ebe[_0x5a2bf1]+'='+encodeURIComponent(_0x571571[_0x5b4ebe[_0x5a2bf1]]);_0x155942+=_0x571571[_0x5b4ebe[_0x5a2bf1]];}_0x155942+=_0x137e51[_0xb4fd('0x62')];_0x155942=_0x28a12c['createHash'](_0xb4fd('0x63'))[_0xb4fd('0x19')](_0x155942)[_0xb4fd('0x64')](_0xb4fd('0x65'));if(_0x216173!==''){_0x216173+='&';}_0x216173+=_0xb4fd('0x66')+_0x155942;var _0x57ce81={'method':'GET','uri':_0x137e51[_0xb4fd('0x53')]+_0xb4fd('0x67')+_0x216173,'json':!![]};return rp(_0x57ce81)[_0xb4fd('0x18')](function(_0xb0c444){var _0x3596f7=Object[_0xb4fd('0x5f')](_0xb0c444);if(_0xb0c444[_0x3596f7[0x0]][_0xb4fd('0x1b')]&&parseInt(_0xb0c444[_0x3596f7[0x0]][_0xb4fd('0x1b')])===0x0){var _0x4042c1={'messageId':_0xb0c444[_0x3596f7[0x0]][_0xb4fd('0x68')]};if(!_0x137e51[_0xb4fd('0x37')]){_0x4042c1[_0xb4fd('0x38')]=!![];}return _0x18c0f7[_0xb4fd('0x19')](_0x4042c1);}else{return logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),'afterCreate',_0xb4fd('0x5b'),util[_0xb4fd('0x3d')](_0xb0c444[_0xb4fd('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x462ae3){return logger['error'](_0xb4fd('0x28'),'afterCreate','csc',util['inspect'](_0x462ae3,{'showHidden':![],'depth':null}));});}else{logger[_0xb4fd('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb4fd('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x137e51[_0xb4fd('0x62')]){var _0x53e09a={'method':_0xb4fd('0x32'),'uri':_0xb4fd('0x69'),'headers':{'Authorization':_0x137e51[_0xb4fd('0x62')]},'body':{'content':_0x23b08f[_0xb4fd('0xd')],'to':[_0x23b08f[_0xb4fd('0x23')]],'from':_0x137e51['phone'],'binary':![],'clientMessageId':'uuid','charset':_0xb4fd('0x6a')},'json':!![]};rp(_0x53e09a)[_0xb4fd('0x18')](function(_0x4d44ff){if(!_0x4d44ff[_0xb4fd('0x1b')]){var _0xc5c8b7={'messageId':_0x4d44ff[_0xb4fd('0x58')][0x0][_0xb4fd('0x6b')]};if(!_0x137e51['deliveryReport']){_0xc5c8b7[_0xb4fd('0x38')]=!![];}return _0x18c0f7[_0xb4fd('0x19')](_0xc5c8b7);}else{return logger[_0xb4fd('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb4fd('0x29'),_0xb4fd('0x6c'),util['inspect'](_0x4d44ff[_0xb4fd('0x1b')],{'showHidden':![],'depth':null}));}})[_0xb4fd('0x27')](function(_0xc171d9){return logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x6c'),util[_0xb4fd('0x3d')](_0xc171d9,{'showHidden':![],'depth':null}));});}else{logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),'afterCreate',_0xb4fd('0x6c'),'Missing\x20parameters:\x20apiKey');}break;case _0xb4fd('0x6d'):if(_0x137e51[_0xb4fd('0x42')]&&_0x137e51[_0xb4fd('0x2c')]){var _0x671ce5=util[_0xb4fd('0x41')](_0xb4fd('0x4e'),_0x137e51[_0xb4fd('0x42')],_0x137e51[_0xb4fd('0x2c')]);var _0x4eb1ae={'method':_0xb4fd('0x32'),'uri':_0xb4fd('0x6e')+_0x137e51[_0xb4fd('0x6f')]+_0xb4fd('0x70'),'body':{'to':[_0x23b08f[_0xb4fd('0x23')]],'text':_0x23b08f['body'],'from':_0x137e51[_0xb4fd('0x23')],'applicationId':_0x137e51['applicationId']},'headers':{'Authorization':util[_0xb4fd('0x41')]('Basic\x20%s',new Buffer(_0x671ce5)[_0xb4fd('0x43')]('base64'))},'json':!![]};rp(_0x4eb1ae)[_0xb4fd('0x18')](function(_0x57deab){if(_0x57deab['id']){var _0x3c5042={'messageId':_0x57deab['id']};return _0x18c0f7[_0xb4fd('0x19')](_0x3c5042);}else{logger['error'](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x6d'),util[_0xb4fd('0x3d')](_0x57deab,{'showHidden':![],'depth':null}));}})[_0xb4fd('0x27')](function(_0x9ead9e){logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x6d'),util['inspect'](_0x9ead9e,{'showHidden':![],'depth':null}));});}else{logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x6d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xb4fd('0x71'):if(_0x137e51[_0xb4fd('0x62')]){var _0x228d40={};var _0x57ce81={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x137e51[_0xb4fd('0x62')],'Content-Type':_0xb4fd('0x56')},'body':{'from':_0x137e51['phone'],'to':_0x23b08f[_0xb4fd('0x23')],'text':_0x23b08f[_0xb4fd('0xd')]},'json':!![]};return rp(_0x57ce81)[_0xb4fd('0x18')](function(_0x4b18f3){if(_0x4b18f3[_0xb4fd('0x72')]==0xca){_0x228d40[_0xb4fd('0x73')]=_0x4b18f3;var _0x2efa1a={'method':_0xb4fd('0x32'),'uri':_0xb4fd('0x74'),'headers':{'Authorization':_0xb4fd('0x75')+_0x137e51['apiKey'],'Content-Type':_0xb4fd('0x56')},'body':{'refid':_0x228d40[_0xb4fd('0x73')][_0xb4fd('0x76')]},'json':!![]};return rp(_0x2efa1a)[_0xb4fd('0x18')](function(_0x5b7898){_0x228d40[_0xb4fd('0x77')]=_0x5b7898;var _0x36241d={'messageId':_0x228d40[_0xb4fd('0x73')][_0xb4fd('0x76')],'read':!![]};return _0x18c0f7[_0xb4fd('0x19')](_0x36241d);});}else{return logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),'afterCreate',_0xb4fd('0x71'),util[_0xb4fd('0x3d')](_0x4b18f3,{'showHidden':![],'depth':null}));}})[_0xb4fd('0x27')](function(_0x8313a8){return logger[_0xb4fd('0x1b')](_0xb4fd('0x28'),_0xb4fd('0x29'),_0xb4fd('0x71'),util[_0xb4fd('0x3d')](_0x8313a8,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xb4fd('0x28'),_0xb4fd('0x29'),'intelepeer',_0xb4fd('0x78'));}break;}}})['finally'](function(){_0x1e1e16();});}else{_0x1e1e16();}}},'charset':_0xb4fd('0x79'),'collate':_0xb4fd('0x7a')});}; \ No newline at end of file +var _0x98e1=['application/json','code','message','refid','status','intelepeer','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','../../config/environment','./smsMessage.attributes','exports','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','secret','SmsInteractionId','then','createdAt','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','read','update','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','authId','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sort','length','md5','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20'];(function(_0x225ea0,_0x319f44){var _0x17324a=function(_0x32132d){while(--_0x32132d){_0x225ea0['push'](_0x225ea0['shift']());}};_0x17324a(++_0x319f44);}(_0x98e1,0x160));var _0x198e=function(_0xe20f77,_0x1f8bba){_0xe20f77=_0xe20f77-0x0;var _0xebce6d=_0x98e1[_0xe20f77];return _0xebce6d;};'use strict';var _=require('lodash');var util=require(_0x198e('0x0'));var logger=require(_0x198e('0x1'))(_0x198e('0x2'));var moment=require(_0x198e('0x3'));var BPromise=require('bluebird');var rp=require(_0x198e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x198e('0x5'));var attributes=require(_0x198e('0x6'));module[_0x198e('0x7')]=function(_0x317209,_0x551d31){return _0x317209['define'](_0x198e('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x198e('0x9'),'fields':['messageId']},{'name':_0x198e('0xa'),'fields':[_0x198e('0xb')],'type':_0x198e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e1226,_0x1ec4c9,_0x412f75){var _0x272f6b=_0x317209[_0x198e('0xd')];var _0x3fe902=_0x3e1226['get']({'plain':!![]});if(_0x3fe902[_0x198e('0xe')][_0x198e('0xf')]()==='in'||_0x3fe902['direction'][_0x198e('0xf')]()==='out'&&!_0x3fe902[_0x198e('0x10')]&&!_['isNil'](_0x3fe902['UserId'])){_0x272f6b['SmsInteraction']['findOne']({'where':{'id':_0x3fe902[_0x198e('0x11')]}})[_0x198e('0x12')](function(_0x10d24e){if(_0x10d24e){_0x10d24e['update']({'lastMsgAt':_0x3fe902[_0x198e('0x13')],'lastMsgDirection':_0x3fe902[_0x198e('0xe')][_0x198e('0xf')]()});}})['catch'](function(_0x53e4c1){console['error'](_0x53e4c1);});}if(_0x3fe902['direction']==='out'&&!_0x3fe902[_0x198e('0x10')]){var _0x58de5f;_0x272f6b['SmsAccount'][_0x198e('0x14')]({'where':{'id':_0x3fe902[_0x198e('0x15')]},'raw':!![]})[_0x198e('0x12')](function(_0x4cbf50){_0x58de5f=_0x4cbf50;if(_0x58de5f&&_0x58de5f[_0x198e('0x16')]){switch(_0x58de5f[_0x198e('0x16')]){case _0x198e('0x17'):var _0x10c4cd=require(_0x198e('0x17'));if(_0x58de5f['accountSid']&&_0x58de5f[_0x198e('0x18')]&&_0x58de5f[_0x198e('0x19')]){var _0x59814c=new _0x10c4cd(_0x58de5f[_0x198e('0x1a')],_0x58de5f[_0x198e('0x18')]);_0x59814c[_0x198e('0x1b')][_0x198e('0x1c')]({'body':_0x3fe902[_0x198e('0xb')],'to':_0x3fe902[_0x198e('0x19')],'from':_0x58de5f['phone'],'statusCallback':_0x58de5f[_0x198e('0x1d')]+_0x198e('0x1e')+_0x3fe902['id']+_0x198e('0x1f')+_0x58de5f[_0x198e('0x20')]})[_0x198e('0x12')](function(_0x2ab945){if(_0x2ab945[_0x198e('0x21')]){return _0x3e1226['update']({'messageId':_0x2ab945[_0x198e('0x21')]});}})[_0x198e('0x22')](function(_0x1fceba){logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x17'),util[_0x198e('0x26')](_0x1fceba,{'showHidden':![],'depth':null}));});}else{logger[_0x198e('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x198e('0x17'),_0x198e('0x27'));}break;case'skebby':var _0x5f20ef=_0x198e('0x28');if(_0x58de5f[_0x198e('0x29')]&&_0x58de5f[_0x198e('0x2a')]){var _0x505dd8={'recipient':[_0x3fe902[_0x198e('0x19')]],'message':_0x3fe902[_0x198e('0xb')],'message_type':_0x58de5f[_0x198e('0x2b')]};if(_0x58de5f[_0x198e('0x2b')]&&_0x58de5f[_0x198e('0x2b')]!=='SI'){_0x505dd8[_0x198e('0x2c')]=_0x58de5f[_0x198e('0x19')];}var _0x71e7d2={'url':_0x5f20ef+_0x198e('0x2d')+_0x58de5f['username']+_0x198e('0x2e')+_0x58de5f[_0x198e('0x2a')],'method':_0x198e('0x2f')};rp(_0x71e7d2)['then'](function(_0x538514){var _0x38db97=_0x538514[_0x198e('0x30')](';');var _0x520d81={'user_key':_0x38db97[0x0],'session_key':_0x38db97[0x1]};_0x71e7d2={'url':_0x5f20ef+_0x198e('0x31'),'method':_0x198e('0x32'),'headers':{'user_key':_0x520d81[_0x198e('0x33')],'Session_key':_0x520d81[_0x198e('0x34')]},'json':!![],'body':_0x505dd8};return rp(_0x71e7d2);})[_0x198e('0x12')](function(_0x5946a1){if(_0x5946a1['total_sent']>=0x1){var _0x157983={'messageId':_0x5946a1['internal_order_id']};if(_0x58de5f['smsMethod']!=='GP'||!_0x58de5f['deliveryReport']){_0x157983[_0x198e('0x35')]=!![];}return _0x3e1226[_0x198e('0x36')](_0x157983);}else{return logger['error'](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x37'),util['inspect'](_0x5946a1,{'showHidden':![],'depth':null}));}})[_0x198e('0x22')](function(_0x353ead){return logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x37'),util[_0x198e('0x26')](_0x353ead,{'showHidden':![],'depth':null}));});}else{logger[_0x198e('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x198e('0x25'),_0x198e('0x37'),_0x198e('0x38'));}break;case _0x198e('0x39'):if(_0x58de5f[_0x198e('0x18')]){var _0x42dbd7={'recipient':_0x3fe902[_0x198e('0x19')],'message':_0x3fe902[_0x198e('0xb')],'sender':_0x58de5f[_0x198e('0x3a')]||_0x58de5f[_0x198e('0x19')],'authorization':_0x58de5f['authToken']};var _0x1ec4c9={'method':_0x198e('0x32'),'uri':_0x198e('0x3b'),'body':_0x42dbd7,'json':!![]};rp(_0x1ec4c9)[_0x198e('0x12')](function(_0x3a6910){var _0x1e5ea8={'messageId':_0x3a6910[_0x198e('0x3c')]};if(!_0x58de5f['deliveryReport']){_0x1e5ea8[_0x198e('0x35')]=!![];}return _0x3e1226[_0x198e('0x36')](_0x1e5ea8);})['catch'](function(_0x2b0a8d){logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x39'),util['inspect'](_0x2b0a8d,{'showHidden':![],'depth':null}));});}else{logger[_0x198e('0x23')](_0x198e('0x24'),'afterCreate',_0x198e('0x39'),_0x198e('0x3d'));}break;case _0x198e('0x3e'):if(_0x58de5f['username']&&_0x58de5f['password']){var _0x42dbd7={'messages':[{'source':_0x198e('0x3f'),'to':_0x3fe902[_0x198e('0x19')],'body':_0x3fe902[_0x198e('0xb')],'from':_0x58de5f['senderString']||_0x58de5f['phone']}]};var _0x1cb3b8=util[_0x198e('0x40')](_0x198e('0x41'),_0x58de5f['username'],_0x58de5f['password']);var _0x1ec4c9={'method':_0x198e('0x32'),'uri':_0x198e('0x42'),'body':_0x42dbd7,'headers':{'Authorization':util[_0x198e('0x40')](_0x198e('0x43'),new Buffer(_0x1cb3b8)[_0x198e('0x44')](_0x198e('0x45')))},'json':!![]};rp(_0x1ec4c9)[_0x198e('0x12')](function(_0x178f2a){if(_0x178f2a[_0x198e('0x46')]>=0xc8&&_0x178f2a[_0x198e('0x46')]<=0xce){if(_0x178f2a[_0x198e('0x47')]&&_0x178f2a[_0x198e('0x47')][_0x198e('0x48')]>0x0){var _0x67c9a=_[_0x198e('0x49')](_0x178f2a['data'][_0x198e('0x1b')]);var _0x483a7e={'messageId':_0x67c9a[_0x198e('0x4a')]};if(!_0x58de5f[_0x198e('0x4b')]){_0x483a7e[_0x198e('0x35')]=!![];}return _0x3e1226['update'](_0x483a7e);}else{logger[_0x198e('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x198e('0x25'),_0x198e('0x4c'),util[_0x198e('0x26')](_0x178f2a,{'showHidden':![],'depth':null}));}}else{logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x4c'),util['inspect'](_0x178f2a,{'showHidden':![],'depth':null}));}})[_0x198e('0x22')](function(_0x40d587){logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x4c'),util[_0x198e('0x26')](_0x40d587,{'showHidden':![],'depth':null}));});}else{logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x4c'),_0x198e('0x38'));}break;case'plivo':if(_0x58de5f[_0x198e('0x4d')]&&_0x58de5f[_0x198e('0x18')]){var _0x42dbd7={'dst':_0x3fe902[_0x198e('0x19')],'text':_0x3fe902[_0x198e('0xb')],'src':_0x58de5f[_0x198e('0x3a')]||_0x58de5f[_0x198e('0x19')],'url':_0x58de5f[_0x198e('0x1d')]+'/api/sms/messages/'+_0x3fe902['id']+_0x198e('0x1f')+_0x58de5f[_0x198e('0x20')]};var _0x1cb3b8=util[_0x198e('0x40')]('%s:%s',_0x58de5f[_0x198e('0x4d')],_0x58de5f[_0x198e('0x18')]);var _0x1ec4c9={'method':_0x198e('0x32'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x58de5f[_0x198e('0x4d')]),'body':_0x42dbd7,'headers':{'Authorization':util[_0x198e('0x40')]('Basic\x20%s',new Buffer(_0x1cb3b8)[_0x198e('0x44')]('base64'))},'json':!![]};rp(_0x1ec4c9)['then'](function(_0x37fbdb){var _0x18c030={'messageId':_0x37fbdb[_0x198e('0x4e')][0x0]};return _0x3e1226[_0x198e('0x36')](_0x18c030);})[_0x198e('0x22')](function(_0x5536e6){logger['error'](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x4f'),util[_0x198e('0x26')](_0x5536e6,{'showHidden':![],'depth':null}));});}else{logger[_0x198e('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x198e('0x25'),_0x198e('0x4f'),_0x198e('0x50'));}break;case'infobip':if(_0x58de5f[_0x198e('0x29')]&&_0x58de5f[_0x198e('0x2a')]){if(_0x58de5f[_0x198e('0x51')]){var _0x39ebd8={'method':'POST','uri':_0x58de5f['baseUrl']+'/auth/1/session','body':{'username':_0x58de5f[_0x198e('0x29')],'password':_0x58de5f['password']},'json':!![]};return rp(_0x39ebd8)['then'](function(_0x414ac3){var _0xd6eba2={'method':_0x198e('0x32'),'uri':_0x58de5f['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x58de5f[_0x198e('0x19')],'destinations':[{'to':_0x3fe902['phone']}],'text':_0x3fe902[_0x198e('0xb')],'notifyUrl':_0x58de5f[_0x198e('0x1d')]+'/api/sms/messages/'+_0x3fe902['id']+'/status?token='+_0x58de5f['token'],'notifyContentType':'application/json','callbackData':_0x58de5f[_0x198e('0x19')]+';'+_0x3fe902[_0x198e('0xb')]}]},'headers':{'Authorization':_0x198e('0x52')+_0x414ac3[_0x198e('0x20')]},'json':!![]};return rp(_0xd6eba2)[_0x198e('0x12')](function(_0x548e93){if(_0x548e93[_0x198e('0x1b')]){var _0x2723b2={'messageId':_0x548e93['messages'][0x0][_0x198e('0x9')]};if(!_0x58de5f['deliveryReport']){_0x2723b2[_0x198e('0x35')]=!![];}return _0x3e1226[_0x198e('0x36')](_0x2723b2);}else{return logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x53'),util['inspect'](_0x548e93,{'showHidden':![],'depth':null}));}});})[_0x198e('0x22')](function(_0x3584e1){return logger['error'](_0x198e('0x24'),'afterCreate',_0x198e('0x53'),util[_0x198e('0x26')](_0x3584e1,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x198e('0x25'),_0x198e('0x53'),_0x198e('0x54'));}}else{logger[_0x198e('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x198e('0x25'),_0x198e('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x198e('0x55'):var _0x2f18dc=require(_0x198e('0x56'));if(_0x58de5f[_0x198e('0x57')]){var _0x7fdfe={};_0x7fdfe[_0x198e('0x58')]=_0x58de5f[_0x198e('0x29')];_0x7fdfe[_0x198e('0x19')]=_0x3fe902[_0x198e('0x19')];_0x7fdfe[_0x198e('0x2c')]=_0x58de5f['phone'];_0x7fdfe['text']=_0x3fe902[_0x198e('0xb')];_0x7fdfe['timestamp']=+new Date();var _0x221b47='';var _0x25957d='';var _0x854fce=Object['keys'](_0x7fdfe);_0x854fce[_0x198e('0x59')]();for(var _0x2fd40f=0x0;_0x2fd40f<_0x854fce[_0x198e('0x5a')];_0x2fd40f++){if(_0x221b47!=''){_0x221b47+='&';}_0x221b47+=_0x854fce[_0x2fd40f]+'='+encodeURIComponent(_0x7fdfe[_0x854fce[_0x2fd40f]]);_0x25957d+=_0x7fdfe[_0x854fce[_0x2fd40f]];}_0x25957d+=_0x58de5f[_0x198e('0x57')];_0x25957d=_0x2f18dc['createHash'](_0x198e('0x5b'))[_0x198e('0x36')](_0x25957d)['digest']('hex');if(_0x221b47!==''){_0x221b47+='&';}_0x221b47+=_0x198e('0x5c')+_0x25957d;var _0x71e7d2={'method':_0x198e('0x2f'),'uri':_0x58de5f[_0x198e('0x51')]+_0x198e('0x5d')+_0x221b47,'json':!![]};return rp(_0x71e7d2)[_0x198e('0x12')](function(_0x4d7ff8){var _0xbaa0f4=Object['keys'](_0x4d7ff8);if(_0x4d7ff8[_0xbaa0f4[0x0]]['error']&&parseInt(_0x4d7ff8[_0xbaa0f4[0x0]][_0x198e('0x23')])===0x0){var _0x204d6c={'messageId':_0x4d7ff8[_0xbaa0f4[0x0]][_0x198e('0x5e')]};if(!_0x58de5f[_0x198e('0x4b')]){_0x204d6c[_0x198e('0x35')]=!![];}return _0x3e1226[_0x198e('0x36')](_0x204d6c);}else{return logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x55'),util[_0x198e('0x26')](_0x4d7ff8['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x287e93){return logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x55'),util[_0x198e('0x26')](_0x287e93,{'showHidden':![],'depth':null}));});}else{logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x55'),_0x198e('0x5f'));}break;case _0x198e('0x60'):if(_0x58de5f[_0x198e('0x57')]){var _0x14f763={'method':_0x198e('0x32'),'uri':_0x198e('0x61'),'headers':{'Authorization':_0x58de5f[_0x198e('0x57')]},'body':{'content':_0x3fe902[_0x198e('0xb')],'to':[_0x3fe902[_0x198e('0x19')]],'from':_0x58de5f[_0x198e('0x19')],'binary':![],'clientMessageId':_0x198e('0x62'),'charset':_0x198e('0x63')},'json':!![]};rp(_0x14f763)['then'](function(_0xb3f4c1){if(!_0xb3f4c1[_0x198e('0x23')]){var _0x28884a={'messageId':_0xb3f4c1[_0x198e('0x1b')][0x0][_0x198e('0x64')]};if(!_0x58de5f[_0x198e('0x4b')]){_0x28884a['read']=!![];}return _0x3e1226['update'](_0x28884a);}else{return logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x60'),util[_0x198e('0x26')](_0xb3f4c1['error'],{'showHidden':![],'depth':null}));}})[_0x198e('0x22')](function(_0x101390){return logger[_0x198e('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x198e('0x25'),_0x198e('0x60'),util[_0x198e('0x26')](_0x101390,{'showHidden':![],'depth':null}));});}else{logger[_0x198e('0x23')](_0x198e('0x24'),'afterCreate',_0x198e('0x60'),_0x198e('0x5f'));}break;case _0x198e('0x65'):if(_0x58de5f[_0x198e('0x29')]&&_0x58de5f[_0x198e('0x2a')]){var _0x1cb3b8=util[_0x198e('0x40')](_0x198e('0x41'),_0x58de5f['username'],_0x58de5f[_0x198e('0x2a')]);var _0x1ec4c9={'method':_0x198e('0x32'),'uri':_0x198e('0x66')+_0x58de5f[_0x198e('0x67')]+_0x198e('0x68'),'body':{'to':[_0x3fe902[_0x198e('0x19')]],'text':_0x3fe902[_0x198e('0xb')],'from':_0x58de5f[_0x198e('0x19')],'applicationId':_0x58de5f[_0x198e('0x69')]},'headers':{'Authorization':util[_0x198e('0x40')](_0x198e('0x43'),new Buffer(_0x1cb3b8)[_0x198e('0x44')](_0x198e('0x45')))},'json':!![]};rp(_0x1ec4c9)[_0x198e('0x12')](function(_0x5e2757){if(_0x5e2757['id']){var _0x55db37={'messageId':_0x5e2757['id']};return _0x3e1226['update'](_0x55db37);}else{logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x65'),util[_0x198e('0x26')](_0x5e2757,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e0ad6){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x198e('0x25'),_0x198e('0x65'),util[_0x198e('0x26')](_0x4e0ad6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x65'),_0x198e('0x38'));}break;case'intelepeer':if(_0x58de5f[_0x198e('0x57')]){var _0x35bb16={};var _0x71e7d2={'method':_0x198e('0x32'),'uri':_0x198e('0x6a'),'headers':{'Authorization':_0x198e('0x6b')+_0x58de5f[_0x198e('0x57')],'Content-Type':_0x198e('0x6c')},'body':{'from':_0x58de5f['phone'],'to':_0x3fe902['phone'],'text':_0x3fe902[_0x198e('0xb')]},'json':!![]};return rp(_0x71e7d2)[_0x198e('0x12')](function(_0x1b497d){if(_0x1b497d[_0x198e('0x6d')]==0xca){_0x35bb16['message']=_0x1b497d;var _0x116556={'method':_0x198e('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x58de5f['apiKey'],'Content-Type':_0x198e('0x6c')},'body':{'refid':_0x35bb16[_0x198e('0x6e')][_0x198e('0x6f')]},'json':!![]};return rp(_0x116556)[_0x198e('0x12')](function(_0x3efc55){_0x35bb16[_0x198e('0x70')]=_0x3efc55;var _0xb243be={'messageId':_0x35bb16[_0x198e('0x6e')]['refid'],'read':!![]};return _0x3e1226[_0x198e('0x36')](_0xb243be);});}else{return logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x71'),util['inspect'](_0x1b497d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3f7d56){return logger[_0x198e('0x23')](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x71'),util[_0x198e('0x26')](_0x3f7d56,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x198e('0x24'),_0x198e('0x25'),_0x198e('0x71'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x412f75();});}else{_0x412f75();}}},'charset':'utf8mb4','collate':_0x198e('0x72')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b7a07f3..2c38e2b 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 _0xb685=['localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','debug','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x54c4c4,_0x240e00){var _0x59439c=function(_0x38a2ce){while(--_0x38a2ce){_0x54c4c4['push'](_0x54c4c4['shift']());}};_0x59439c(++_0x240e00);}(_0xb685,0xde));var _0x5b68=function(_0x1d0770,_0x4711d4){_0x1d0770=_0x1d0770-0x0;var _0x5bc7fa=_0xb685[_0x1d0770];return _0x5bc7fa;};'use strict';var _=require(_0x5b68('0x0'));var util=require(_0x5b68('0x1'));var moment=require(_0x5b68('0x2'));var BPromise=require(_0x5b68('0x3'));var rs=require(_0x5b68('0x4'));var fs=require('fs');var Redis=require(_0x5b68('0x5'));var db=require(_0x5b68('0x6'))['db'];var utils=require(_0x5b68('0x7'));var logger=require(_0x5b68('0x8'))(_0x5b68('0x9'));var config=require(_0x5b68('0xa'));var jayson=require(_0x5b68('0xb'));var client=jayson[_0x5b68('0xc')][_0x5b68('0xd')]({'port':0x232a});config[_0x5b68('0xe')]=_[_0x5b68('0xf')](config['redis'],{'host':_0x5b68('0x10'),'port':0x18eb});var socket=require(_0x5b68('0x11'))(new Redis(config[_0x5b68('0xe')]));require(_0x5b68('0x12'))[_0x5b68('0x13')](socket);function respondWithRpcPromise(_0x1ba3dc,_0x38343b,_0x3e5d80){return new BPromise(function(_0x1e9ebb,_0x3e80c3){return client[_0x5b68('0x14')](_0x1ba3dc,_0x3e5d80)[_0x5b68('0x15')](function(_0x2585c8){logger[_0x5b68('0x16')]('SmsMessage,\x20%s,\x20%s',_0x38343b,'request\x20sent');logger[_0x5b68('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x38343b,_0x5b68('0x18'),JSON['stringify'](_0x2585c8));if(_0x2585c8[_0x5b68('0x19')]){if(_0x2585c8[_0x5b68('0x19')][_0x5b68('0x1a')]===0x1f4){logger['error'](_0x5b68('0x1b'),_0x38343b,_0x2585c8[_0x5b68('0x19')]['message']);return _0x3e80c3(_0x2585c8[_0x5b68('0x19')][_0x5b68('0x1c')]);}logger[_0x5b68('0x19')]('SmsMessage,\x20%s,\x20%s',_0x38343b,_0x2585c8['error'][_0x5b68('0x1c')]);return _0x1e9ebb(_0x2585c8['error']['message']);}else{logger[_0x5b68('0x16')]('SmsMessage,\x20%s,\x20%s',_0x38343b,_0x5b68('0x18'));_0x1e9ebb(_0x2585c8[_0x5b68('0x1d')][_0x5b68('0x1c')]);}})[_0x5b68('0x1e')](function(_0x564b89){logger[_0x5b68('0x19')](_0x5b68('0x1b'),_0x38343b,_0x564b89);_0x3e80c3(_0x564b89);});});}exports['CreateSmsMessage']=function(_0x30916c){var _0x5ceb18=this;return new Promise(function(_0x123a6d,_0x3c0171){return db['SmsMessage'][_0x5b68('0x1f')](_0x30916c['body'],{'raw':_0x30916c[_0x5b68('0x20')]?_0x30916c['options'][_0x5b68('0x21')]===undefined?!![]:![]:!![]})[_0x5b68('0x15')](function(_0x1cf605){logger[_0x5b68('0x16')]('CreateSmsMessage',_0x30916c);logger[_0x5b68('0x17')]('CreateSmsMessage',_0x30916c,JSON['stringify'](_0x1cf605));_0x123a6d(_0x1cf605);})['catch'](function(_0xaafb7e){logger[_0x5b68('0x19')]('CreateSmsMessage',_0xaafb7e[_0x5b68('0x1c')],_0x30916c);_0x3c0171(_0x5ceb18[_0x5b68('0x19')](0x1f4,_0xaafb7e[_0x5b68('0x1c')]));});});}; \ No newline at end of file +var _0xc406=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','SmsMessage','create','body','raw','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc406,0xc5));var _0x6c40=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc406[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6c40('0x0'));var util=require('util');var moment=require(_0x6c40('0x1'));var BPromise=require(_0x6c40('0x2'));var rs=require(_0x6c40('0x3'));var fs=require('fs');var Redis=require(_0x6c40('0x4'));var db=require(_0x6c40('0x5'))['db'];var utils=require(_0x6c40('0x6'));var logger=require(_0x6c40('0x7'))(_0x6c40('0x8'));var config=require(_0x6c40('0x9'));var jayson=require(_0x6c40('0xa'));var client=jayson[_0x6c40('0xb')][_0x6c40('0xc')]({'port':0x232a});config[_0x6c40('0xd')]=_['defaults'](config['redis'],{'host':_0x6c40('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c40('0xd')]));require(_0x6c40('0xf'))[_0x6c40('0x10')](socket);function respondWithRpcPromise(_0x3b42f0,_0x3f4f4b,_0x7d7163){return new BPromise(function(_0x3992e3,_0x8d0ba1){return client[_0x6c40('0x11')](_0x3b42f0,_0x7d7163)['then'](function(_0x5c278a){logger[_0x6c40('0x12')]('SmsMessage,\x20%s,\x20%s',_0x3f4f4b,_0x6c40('0x13'));logger[_0x6c40('0x14')](_0x6c40('0x15'),_0x3f4f4b,'request\x20sent',JSON[_0x6c40('0x16')](_0x5c278a));if(_0x5c278a[_0x6c40('0x17')]){if(_0x5c278a[_0x6c40('0x17')][_0x6c40('0x18')]===0x1f4){logger[_0x6c40('0x17')](_0x6c40('0x19'),_0x3f4f4b,_0x5c278a[_0x6c40('0x17')][_0x6c40('0x1a')]);return _0x8d0ba1(_0x5c278a['error'][_0x6c40('0x1a')]);}logger[_0x6c40('0x17')](_0x6c40('0x19'),_0x3f4f4b,_0x5c278a[_0x6c40('0x17')][_0x6c40('0x1a')]);return _0x3992e3(_0x5c278a[_0x6c40('0x17')][_0x6c40('0x1a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x3f4f4b,_0x6c40('0x13'));_0x3992e3(_0x5c278a['result']['message']);}})['catch'](function(_0x9d7c30){logger[_0x6c40('0x17')]('SmsMessage,\x20%s,\x20%s',_0x3f4f4b,_0x9d7c30);_0x8d0ba1(_0x9d7c30);});});}exports[_0x6c40('0x1b')]=function(_0x10e166){var _0x45f037=this;return new Promise(function(_0x36638c,_0x4d6599){return db[_0x6c40('0x1c')][_0x6c40('0x1d')](_0x10e166[_0x6c40('0x1e')],{'raw':_0x10e166['options']?_0x10e166['options'][_0x6c40('0x1f')]===undefined?!![]:![]:!![]})[_0x6c40('0x20')](function(_0x2cce1d){logger[_0x6c40('0x12')](_0x6c40('0x1b'),_0x10e166);logger['debug'](_0x6c40('0x1b'),_0x10e166,JSON[_0x6c40('0x16')](_0x2cce1d));_0x36638c(_0x2cce1d);})[_0x6c40('0x21')](function(_0x3f971e){logger[_0x6c40('0x17')](_0x6c40('0x1b'),_0x3f971e[_0x6c40('0x1a')],_0x10e166);_0x4d6599(_0x45f037[_0x6c40('0x17')](0x1f4,_0x3f971e[_0x6c40('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index efd3c5e..7c3f505 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 _0xe5df=['./smsMessage.events','remove','emit','register'];(function(_0x66139b,_0x17a56b){var _0xeecedf=function(_0x2fe535){while(--_0x2fe535){_0x66139b['push'](_0x66139b['shift']());}};_0xeecedf(++_0x17a56b);}(_0xe5df,0x90));var _0xfe5d=function(_0x55df66,_0x4368e3){_0x55df66=_0x55df66-0x0;var _0x4dd344=_0xe5df[_0x55df66];return _0x4dd344;};'use strict';var SmsMessageEvents=require(_0xfe5d('0x0'));var events=['save',_0xfe5d('0x1'),'update'];function createListener(_0x2b9e55,_0x466283){return function(_0xf6a2d3){_0x466283[_0xfe5d('0x2')](_0x2b9e55,_0xf6a2d3);};}function removeListener(_0x52000d,_0xc5e17){return function(){SmsMessageEvents['removeListener'](_0x52000d,_0xc5e17);};}exports[_0xfe5d('0x3')]=function(_0x3fb069){for(var _0x2aed72=0x0,_0x184bc1=events['length'];_0x2aed72<_0x184bc1;_0x2aed72++){var _0x3abb28=events[_0x2aed72];var _0x33b32a=createListener('smsMessage:'+_0x3abb28,_0x3fb069);SmsMessageEvents['on'](_0x3abb28,_0x33b32a);}}; \ No newline at end of file +var _0xc64e=['save','remove','update','emit','removeListener','register','./smsMessage.events'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc64e,0x1c6));var _0xec64=function(_0x307e55,_0x242bfb){_0x307e55=_0x307e55-0x0;var _0x2a9852=_0xc64e[_0x307e55];return _0x2a9852;};'use strict';var SmsMessageEvents=require(_0xec64('0x0'));var events=[_0xec64('0x1'),_0xec64('0x2'),_0xec64('0x3')];function createListener(_0x12daaf,_0x1d1458){return function(_0x1dbf38){_0x1d1458[_0xec64('0x4')](_0x12daaf,_0x1dbf38);};}function removeListener(_0x3d634c,_0x4612f0){return function(){SmsMessageEvents[_0xec64('0x5')](_0x3d634c,_0x4612f0);};}exports[_0xec64('0x6')]=function(_0x35cbbd){for(var _0x242929=0x0,_0x4ed17d=events['length'];_0x242929<_0x4ed17d;_0x242929++){var _0x132490=events[_0x242929];var _0x2c57ec=createListener('smsMessage:'+_0x132490,_0x35cbbd);SmsMessageEvents['on'](_0x132490,_0x2c57ec);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index bb976d3..5162964 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 _0xb7d6=['getAgents','post','create','addTeams','addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueue.controller','get','isAuthenticated','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb7d6,0x124));var _0x6b7d=function(_0x317489,_0x4a8108){_0x317489=_0x317489-0x0;var _0x169ab9=_0xb7d6[_0x317489];return _0x169ab9;};'use strict';var multer=require(_0x6b7d('0x0'));var util=require(_0x6b7d('0x1'));var path=require(_0x6b7d('0x2'));var timeout=require(_0x6b7d('0x3'));var express=require(_0x6b7d('0x4'));var router=express[_0x6b7d('0x5')]();var fs_extra=require(_0x6b7d('0x6'));var auth=require(_0x6b7d('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b7d('0x8'));router[_0x6b7d('0x9')]('/',auth[_0x6b7d('0xa')](),controller['index']);router[_0x6b7d('0x9')](_0x6b7d('0xb'),auth['isAuthenticated'](),controller[_0x6b7d('0xc')]);router[_0x6b7d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b7d('0xd')]);router[_0x6b7d('0x9')]('/:id/members',auth[_0x6b7d('0xa')](),controller[_0x6b7d('0xe')]);router[_0x6b7d('0x9')](_0x6b7d('0xf'),auth[_0x6b7d('0xa')](),controller[_0x6b7d('0x10')]);router[_0x6b7d('0x9')](_0x6b7d('0x11'),auth[_0x6b7d('0xa')](),controller[_0x6b7d('0x12')]);router[_0x6b7d('0x13')]('/',auth[_0x6b7d('0xa')](),controller[_0x6b7d('0x14')]);router['post'](_0x6b7d('0xf'),auth[_0x6b7d('0xa')](),controller[_0x6b7d('0x15')]);router[_0x6b7d('0x13')](_0x6b7d('0x11'),auth['isAuthenticated'](),controller[_0x6b7d('0x16')]);router[_0x6b7d('0x17')](_0x6b7d('0x18'),auth[_0x6b7d('0xa')](),controller[_0x6b7d('0x19')]);router['delete']('/:id',auth[_0x6b7d('0xa')](),controller[_0x6b7d('0x1a')]);router[_0x6b7d('0x1b')](_0x6b7d('0xf'),auth[_0x6b7d('0xa')](),controller[_0x6b7d('0x1c')]);router[_0x6b7d('0x1b')]('/:id/users',auth[_0x6b7d('0xa')](),controller[_0x6b7d('0x1d')]);module[_0x6b7d('0x1e')]=router; \ No newline at end of file +var _0xfd8b=['../../components/interaction/service','../../config/environment','get','describe','show','/:id/members','isAuthenticated','getMembers','/:id/teams','/:id/users','getAgents','create','post','addAgents','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x85e219,_0x5447e3){var _0xef3547=function(_0x3315d6){while(--_0x3315d6){_0x85e219['push'](_0x85e219['shift']());}};_0xef3547(++_0x5447e3);}(_0xfd8b,0x18a));var _0xbfd8=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0xfd8b[_0x2cfb48];return _0xc4594f;};'use strict';var multer=require(_0xbfd8('0x0'));var util=require(_0xbfd8('0x1'));var path=require(_0xbfd8('0x2'));var timeout=require(_0xbfd8('0x3'));var express=require(_0xbfd8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbfd8('0x5'));var interaction=require(_0xbfd8('0x6'));var config=require(_0xbfd8('0x7'));var controller=require('./smsQueue.controller');router[_0xbfd8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbfd8('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xbfd8('0x9')]);router[_0xbfd8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbfd8('0xa')]);router[_0xbfd8('0x8')](_0xbfd8('0xb'),auth[_0xbfd8('0xc')](),controller[_0xbfd8('0xd')]);router[_0xbfd8('0x8')](_0xbfd8('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0xbfd8('0x8')](_0xbfd8('0xf'),auth['isAuthenticated'](),controller[_0xbfd8('0x10')]);router['post']('/',auth[_0xbfd8('0xc')](),controller[_0xbfd8('0x11')]);router[_0xbfd8('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xbfd8('0x12')](_0xbfd8('0xf'),auth['isAuthenticated'](),controller[_0xbfd8('0x13')]);router[_0xbfd8('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbfd8('0x15')](_0xbfd8('0x16'),auth[_0xbfd8('0xc')](),controller[_0xbfd8('0x17')]);router[_0xbfd8('0x15')](_0xbfd8('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xbfd8('0xf'),auth[_0xbfd8('0xc')](),controller['removeAgents']);module[_0xbfd8('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 62919bb..1cf8322 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 _0x3b21=['beepall','STRING','name','INTEGER','rrmemory'];(function(_0xbe05c8,_0x26be13){var _0xbd60ca=function(_0x202473){while(--_0x202473){_0xbe05c8['push'](_0xbe05c8['shift']());}};_0xbd60ca(++_0x26be13);}(_0x3b21,0x128));var _0x13b2=function(_0x56337b,_0x1c0416){_0x56337b=_0x56337b-0x0;var _0x47b70d=_0x3b21[_0x56337b];return _0x47b70d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x13b2('0x0')],'unique':_0x13b2('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x13b2('0x0')]},'timeout':{'type':Sequelize[_0x13b2('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x13b2('0x3'),_0x13b2('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x1dc0=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x17e07a,_0x257bca){var _0x2c9c84=function(_0x513dea){while(--_0x513dea){_0x17e07a['push'](_0x17e07a['shift']());}};_0x2c9c84(++_0x257bca);}(_0x1dc0,0xa2));var _0x01dc=function(_0x38edb5,_0xea1c12){_0x38edb5=_0x38edb5-0x0;var _0x43c8ee=_0x1dc0[_0x38edb5];return _0x43c8ee;};'use strict';var Sequelize=require('sequelize');module[_0x01dc('0x0')]={'name':{'type':Sequelize[_0x01dc('0x1')],'unique':_0x01dc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x01dc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x01dc('0x4')](_0x01dc('0x5'),'beepall',_0x01dc('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index e20df56..860d6c6 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 _0xd9f4=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','smsPause','updatedAt','Team','pick','getTeams','addTeams','online','voicePause','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','removeTeams','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','value','ids','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xab525b,_0x7e1cc1){var _0x3029e2=function(_0x554b62){while(--_0x554b62){_0xab525b['push'](_0xab525b['shift']());}};_0x3029e2(++_0x7e1cc1);}(_0xd9f4,0x7b));var _0x4d9f=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xd9f4[_0xb0f7c3];return _0x28ea68;};'use strict';var emlformat=require(_0x4d9f('0x0'));var rimraf=require(_0x4d9f('0x1'));var zipdir=require(_0x4d9f('0x2'));var jsonpatch=require(_0x4d9f('0x3'));var rp=require(_0x4d9f('0x4'));var moment=require(_0x4d9f('0x5'));var BPromise=require(_0x4d9f('0x6'));var Mustache=require(_0x4d9f('0x7'));var util=require(_0x4d9f('0x8'));var path=require(_0x4d9f('0x9'));var sox=require(_0x4d9f('0xa'));var csv=require(_0x4d9f('0xb'));var ejs=require(_0x4d9f('0xc'));var fs=require('fs');var fs_extra=require(_0x4d9f('0xd'));var _=require(_0x4d9f('0xe'));var squel=require(_0x4d9f('0xf'));var crypto=require(_0x4d9f('0x10'));var jsforce=require(_0x4d9f('0x11'));var deskjs=require(_0x4d9f('0x12'));var toCsv=require(_0x4d9f('0xb'));var querystring=require('querystring');var Papa=require(_0x4d9f('0x13'));var Redis=require(_0x4d9f('0x14'));var authService=require(_0x4d9f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x4d9f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d9f('0x17'))(_0x4d9f('0x18'));var utils=require(_0x4d9f('0x19'));var config=require(_0x4d9f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d9f('0x1b'))['db'];config[_0x4d9f('0x1c')]=_[_0x4d9f('0x1d')](config[_0x4d9f('0x1c')],{'host':_0x4d9f('0x1e'),'port':0x18eb});var socket=require(_0x4d9f('0x1f'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x4d9f('0x20')](socket);function respondWithStatusCode(_0x2344a6,_0x4c9808){_0x4c9808=_0x4c9808||0xcc;return function(_0x5b9a2c){if(_0x5b9a2c){return _0x2344a6[_0x4d9f('0x21')](_0x4c9808);}return _0x2344a6[_0x4d9f('0x22')](_0x4c9808)[_0x4d9f('0x23')]();};}function respondWithResult(_0x340f01,_0x8d2523){_0x8d2523=_0x8d2523||0xc8;return function(_0xa7ef26){if(_0xa7ef26){return _0x340f01[_0x4d9f('0x22')](_0x8d2523)[_0x4d9f('0x24')](_0xa7ef26);}};}function respondWithFilteredResult(_0x56c2d2,_0x1136e0){return function(_0x443fd3){if(_0x443fd3){var _0x260fdf=typeof _0x1136e0[_0x4d9f('0x25')]===_0x4d9f('0x26')&&typeof _0x1136e0[_0x4d9f('0x27')]===_0x4d9f('0x26');var _0x13762d=_0x443fd3['count'];var _0x41811e=_0x260fdf?0x0:_0x1136e0[_0x4d9f('0x25')];var _0x2c7843=_0x260fdf?_0x443fd3[_0x4d9f('0x28')]:_0x1136e0[_0x4d9f('0x25')]+_0x1136e0[_0x4d9f('0x27')];var _0x36d954;if(_0x2c7843>=_0x13762d){_0x2c7843=_0x13762d;_0x36d954=0xc8;}else{_0x36d954=0xce;}_0x56c2d2[_0x4d9f('0x22')](_0x36d954);return _0x56c2d2[_0x4d9f('0x29')](_0x4d9f('0x2a'),_0x41811e+'-'+_0x2c7843+'/'+_0x13762d)[_0x4d9f('0x24')](_0x443fd3);}return null;};}function patchUpdates(_0x103777){return function(_0x279eee){try{jsonpatch[_0x4d9f('0x2b')](_0x279eee,_0x103777,!![]);}catch(_0x3415fe){return BPromise[_0x4d9f('0x2c')](_0x3415fe);}return _0x279eee[_0x4d9f('0x2d')]();};}function saveUpdates(_0x226fd9,_0x253fdf){return function(_0x52b2e5){if(_0x52b2e5){return _0x52b2e5[_0x4d9f('0x2e')](_0x226fd9)['then'](function(_0x298115){return _0x298115;});}return null;};}function removeEntity(_0x24ba85,_0x329a48){return function(_0x4a8bd4){if(_0x4a8bd4){return _0x4a8bd4[_0x4d9f('0x2f')]()['then'](function(){var _0x40cc7c=_0x4a8bd4[_0x4d9f('0x30')]({'plain':!![]});var _0xe9d70d=_0x4d9f('0x31');return db[_0x4d9f('0x32')][_0x4d9f('0x2f')]({'where':{'type':_0xe9d70d,'resourceId':_0x40cc7c['id']}})['then'](function(){return _0x4a8bd4;});})['then'](function(){_0x24ba85[_0x4d9f('0x22')](0xcc)[_0x4d9f('0x23')]();});}};}function handleEntityNotFound(_0x4d035c,_0x2398fb){return function(_0x3fe1e3){if(!_0x3fe1e3){_0x4d035c[_0x4d9f('0x21')](0x194);}return _0x3fe1e3;};}function handleError(_0x59bf55,_0x1e0f9c){_0x1e0f9c=_0x1e0f9c||0x1f4;return function(_0x16dd90){logger[_0x4d9f('0x33')](_0x16dd90[_0x4d9f('0x34')]);if(_0x16dd90['name']){delete _0x16dd90[_0x4d9f('0x35')];}_0x59bf55[_0x4d9f('0x22')](_0x1e0f9c)[_0x4d9f('0x36')](_0x16dd90);};}exports['index']=function(_0x56c8bc,_0x38ec95){var _0x37bbf7={},_0x2363e5={},_0x6a9500={'count':0x0,'rows':[]};var _0x28cd80=_[_0x4d9f('0x37')](db[_0x4d9f('0x38')][_0x4d9f('0x39')],function(_0x4f5f66){return{'name':_0x4f5f66[_0x4d9f('0x3a')],'type':_0x4f5f66[_0x4d9f('0x3b')][_0x4d9f('0x3c')]};});_0x2363e5[_0x4d9f('0x3d')]=_[_0x4d9f('0x37')](_0x28cd80,'name');_0x2363e5[_0x4d9f('0x3e')]=_['keys'](_0x56c8bc['query']);_0x2363e5[_0x4d9f('0x3f')]=_[_0x4d9f('0x40')](_0x2363e5['model'],_0x2363e5[_0x4d9f('0x3e')]);_0x37bbf7[_0x4d9f('0x41')]=_[_0x4d9f('0x40')](_0x2363e5[_0x4d9f('0x3d')],qs[_0x4d9f('0x42')](_0x56c8bc['query'][_0x4d9f('0x42')]));_0x37bbf7['attributes']=_0x37bbf7[_0x4d9f('0x41')]['length']?_0x37bbf7['attributes']:_0x2363e5[_0x4d9f('0x3d')];if(!_0x56c8bc[_0x4d9f('0x3e')][_0x4d9f('0x43')](_0x4d9f('0x44'))){_0x37bbf7[_0x4d9f('0x27')]=qs[_0x4d9f('0x27')](_0x56c8bc[_0x4d9f('0x3e')]['limit']);_0x37bbf7['offset']=qs[_0x4d9f('0x25')](_0x56c8bc[_0x4d9f('0x3e')][_0x4d9f('0x25')]);}_0x37bbf7['order']=qs[_0x4d9f('0x45')](_0x56c8bc[_0x4d9f('0x3e')][_0x4d9f('0x45')]);_0x37bbf7['where']=qs[_0x4d9f('0x3f')](_['pick'](_0x56c8bc[_0x4d9f('0x3e')],_0x2363e5['filters']),_0x28cd80);if(_0x56c8bc[_0x4d9f('0x3e')]['filter']){_0x37bbf7[_0x4d9f('0x46')]=_['merge'](_0x37bbf7[_0x4d9f('0x46')],{'$or':_['map'](_0x28cd80,function(_0x1f58d6){if(_0x1f58d6[_0x4d9f('0x3b')]!==_0x4d9f('0x47')){var _0x4853fe={};_0x4853fe[_0x1f58d6['name']]={'$like':'%'+_0x56c8bc[_0x4d9f('0x3e')][_0x4d9f('0x48')]+'%'};return _0x4853fe;}})});}_0x37bbf7=_[_0x4d9f('0x49')]({},_0x37bbf7,_0x56c8bc[_0x4d9f('0x4a')]);var _0x5f5218={'where':_0x37bbf7[_0x4d9f('0x46')]};return db[_0x4d9f('0x38')]['count'](_0x5f5218)[_0x4d9f('0x4b')](function(_0x2b3a79){_0x6a9500[_0x4d9f('0x28')]=_0x2b3a79;if(_0x56c8bc[_0x4d9f('0x3e')][_0x4d9f('0x4c')]){_0x37bbf7[_0x4d9f('0x4d')]=[{'all':!![]}];}return db[_0x4d9f('0x38')][_0x4d9f('0x4e')](_0x37bbf7);})['then'](function(_0x53baf5){_0x6a9500[_0x4d9f('0x4f')]=_0x53baf5;return _0x6a9500;})[_0x4d9f('0x4b')](respondWithFilteredResult(_0x38ec95,_0x37bbf7))['catch'](handleError(_0x38ec95,null));};exports[_0x4d9f('0x50')]=function(_0x3ce31f,_0x5ef12e){var _0x961794={'raw':!![],'where':{'id':_0x3ce31f[_0x4d9f('0x51')]['id']}},_0x1d6f7a={};_0x1d6f7a['model']=_['keys'](db[_0x4d9f('0x38')][_0x4d9f('0x39')]);_0x1d6f7a['query']=_[_0x4d9f('0x52')](_0x3ce31f['query']);_0x1d6f7a[_0x4d9f('0x3f')]=_[_0x4d9f('0x40')](_0x1d6f7a[_0x4d9f('0x3d')],_0x1d6f7a[_0x4d9f('0x3e')]);_0x961794[_0x4d9f('0x41')]=_[_0x4d9f('0x40')](_0x1d6f7a['model'],qs[_0x4d9f('0x42')](_0x3ce31f[_0x4d9f('0x3e')][_0x4d9f('0x42')]));_0x961794['attributes']=_0x961794[_0x4d9f('0x41')][_0x4d9f('0x53')]?_0x961794['attributes']:_0x1d6f7a[_0x4d9f('0x3d')];if(_0x3ce31f[_0x4d9f('0x3e')][_0x4d9f('0x4c')]){_0x961794[_0x4d9f('0x4d')]=[{'all':!![]}];}_0x961794=_[_0x4d9f('0x49')]({},_0x961794,_0x3ce31f[_0x4d9f('0x4a')]);return db[_0x4d9f('0x38')][_0x4d9f('0x54')](_0x961794)[_0x4d9f('0x4b')](handleEntityNotFound(_0x5ef12e,null))[_0x4d9f('0x4b')](respondWithResult(_0x5ef12e,null))['catch'](handleError(_0x5ef12e,null));};exports['create']=function(_0xf1408f,_0x19f4ee){return db['SmsQueue'][_0x4d9f('0x55')](_0xf1408f[_0x4d9f('0x56')],{})[_0x4d9f('0x4b')](function(_0x246572){var _0x2493af=_0xf1408f[_0x4d9f('0x57')][_0x4d9f('0x30')]({'plain':!![]});if(!_0x2493af)throw new Error(_0x4d9f('0x58'));if(_0x2493af[_0x4d9f('0x59')]===_0x4d9f('0x57')){var _0x25e8c9=_0x246572[_0x4d9f('0x30')]({'plain':!![]});var _0x3a9c7b='SmsQueues';return db[_0x4d9f('0x5a')][_0x4d9f('0x54')]({'where':{'name':_0x3a9c7b,'userProfileId':_0x2493af[_0x4d9f('0x5b')]},'raw':!![]})[_0x4d9f('0x4b')](function(_0x156ddc){if(_0x156ddc&&_0x156ddc[_0x4d9f('0x5c')]===0x0){return db['UserProfileResource'][_0x4d9f('0x55')]({'name':_0x25e8c9[_0x4d9f('0x35')],'resourceId':_0x25e8c9['id'],'type':_0x156ddc['name'],'sectionId':_0x156ddc['id']},{})[_0x4d9f('0x4b')](function(){return _0x246572;});}else{return _0x246572;}})[_0x4d9f('0x5d')](function(_0x2597e6){logger[_0x4d9f('0x33')](_0x4d9f('0x5e'),_0x2597e6);throw _0x2597e6;});}return _0x246572;})[_0x4d9f('0x4b')](respondWithResult(_0x19f4ee,0xc9))[_0x4d9f('0x5d')](handleError(_0x19f4ee,null));};exports[_0x4d9f('0x2e')]=function(_0x5f30b7,_0x7f01a6){if(_0x5f30b7[_0x4d9f('0x56')]['id']){delete _0x5f30b7[_0x4d9f('0x56')]['id'];}return db[_0x4d9f('0x38')][_0x4d9f('0x54')]({'where':{'id':_0x5f30b7['params']['id']}})['then'](handleEntityNotFound(_0x7f01a6,null))[_0x4d9f('0x4b')](saveUpdates(_0x5f30b7[_0x4d9f('0x56')],null))[_0x4d9f('0x4b')](respondWithResult(_0x7f01a6,null))[_0x4d9f('0x5d')](handleError(_0x7f01a6,null));};exports[_0x4d9f('0x2f')]=function(_0x59ec2a,_0x13c80e){return db[_0x4d9f('0x38')][_0x4d9f('0x54')]({'where':{'id':_0x59ec2a[_0x4d9f('0x51')]['id']}})[_0x4d9f('0x4b')](handleEntityNotFound(_0x13c80e,null))[_0x4d9f('0x4b')](removeEntity(_0x13c80e,null))[_0x4d9f('0x5d')](handleError(_0x13c80e,null));};exports['describe']=function(_0x3f9878,_0x1b4c95){return db[_0x4d9f('0x38')][_0x4d9f('0x5f')]()[_0x4d9f('0x4b')](respondWithResult(_0x1b4c95,null))[_0x4d9f('0x5d')](handleError(_0x1b4c95,null));};exports['getMembers']=function(_0x370f4a,_0x5293c7,_0x3cc089){var _0x47d106={'raw':!![],'where':{}},_0x48f679={},_0x556beb;return db[_0x4d9f('0x38')][_0x4d9f('0x60')]({'where':{'id':_0x370f4a[_0x4d9f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5293c7,null))['then'](function(_0x5ccc56){if(_0x5ccc56){_0x556beb=_0x5ccc56['get']({'plain':!![]});_0x48f679[_0x4d9f('0x3d')]=_[_0x4d9f('0x52')](db[_0x4d9f('0x61')]['rawAttributes']);_0x48f679['query']=_[_0x4d9f('0x52')](_0x370f4a[_0x4d9f('0x3e')]);_0x48f679[_0x4d9f('0x3f')]=_['intersection'](_0x48f679[_0x4d9f('0x3d')],_0x48f679['query']);_0x47d106[_0x4d9f('0x41')]=_['intersection'](_0x48f679[_0x4d9f('0x3d')],qs[_0x4d9f('0x42')](_0x370f4a[_0x4d9f('0x3e')][_0x4d9f('0x42')]));_0x47d106[_0x4d9f('0x41')]=_0x47d106[_0x4d9f('0x41')][_0x4d9f('0x53')]?_0x47d106[_0x4d9f('0x41')]:_0x48f679[_0x4d9f('0x3d')];if(!_0x370f4a[_0x4d9f('0x3e')]['hasOwnProperty']('nolimit')){_0x47d106[_0x4d9f('0x27')]=qs[_0x4d9f('0x27')](_0x370f4a[_0x4d9f('0x3e')][_0x4d9f('0x27')]);_0x47d106[_0x4d9f('0x25')]=qs[_0x4d9f('0x25')](_0x370f4a[_0x4d9f('0x3e')][_0x4d9f('0x25')]);}_0x47d106[_0x4d9f('0x62')]=qs[_0x4d9f('0x45')](_0x370f4a['query']['sort']);_0x47d106['where']=qs[_0x4d9f('0x3f')](_['pick'](_0x370f4a['query'],_0x48f679['filters']));_0x47d106[_0x4d9f('0x46')][_0x4d9f('0x63')]=_0x5ccc56['id'];if(_0x370f4a[_0x4d9f('0x3e')][_0x4d9f('0x48')]){_0x47d106['where']=_[_0x4d9f('0x49')](_0x47d106['where'],{'$or':_[_0x4d9f('0x37')](_0x47d106[_0x4d9f('0x41')],function(_0x336a42){var _0x7d0a7d={};_0x7d0a7d[_0x336a42]={'$like':'%'+_0x370f4a['query'][_0x4d9f('0x48')]+'%'};return _0x7d0a7d;})});}_0x47d106=_[_0x4d9f('0x49')]({},_0x47d106,_0x370f4a[_0x4d9f('0x4a')]);return db[_0x4d9f('0x61')]['findAll'](_0x47d106);}})[_0x4d9f('0x4b')](function(_0x38bb9c){if(_0x38bb9c){return db[_0x4d9f('0x64')][_0x4d9f('0x65')]({'where':{'id':_[_0x4d9f('0x37')](_0x38bb9c,_0x4d9f('0x66')),'role':_0x4d9f('0x67')},'attributes':['id',_0x4d9f('0x35'),'smsPause','updatedAt',_0x4d9f('0x68')]});}})[_0x4d9f('0x4b')](function(_0xf8d34c){if(_0xf8d34c){return{'count':_0xf8d34c[_0x4d9f('0x28')],'rows':_[_0x4d9f('0x37')](_0xf8d34c['rows'],function(_0x22b4c7){return{'membername':_0x22b4c7[_0x4d9f('0x35')],'UserId':_0x22b4c7['id'],'queue_name':_0x556beb['name'],'SmsQueueId':_0x556beb['id'],'interface':util[_0x4d9f('0x69')](_0x4d9f('0x6a'),_0x4d9f('0x6b'),_0x22b4c7['name']),'penalty':0x0,'paused':_0x22b4c7[_0x4d9f('0x6c')],'createdAt':_0x22b4c7[_0x4d9f('0x68')],'updatedAt':_0x22b4c7[_0x4d9f('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4d9f('0x4b')](respondWithFilteredResult(_0x5293c7,_0x47d106))['catch'](handleError(_0x5293c7,null));};exports['getTeams']=function(_0x2ab8af,_0xedf84d,_0x24b38b){var _0x275248={};var _0x52209a={};var _0x282e60;var _0x3f8708;return db[_0x4d9f('0x38')]['findOne']({'where':{'id':_0x2ab8af[_0x4d9f('0x51')]['id']}})[_0x4d9f('0x4b')](handleEntityNotFound(_0xedf84d,null))['then'](function(_0x4c4930){if(_0x4c4930){_0x282e60=_0x4c4930;_0x52209a[_0x4d9f('0x3d')]=_[_0x4d9f('0x52')](db[_0x4d9f('0x6e')][_0x4d9f('0x39')]);_0x52209a[_0x4d9f('0x3e')]=_[_0x4d9f('0x52')](_0x2ab8af[_0x4d9f('0x3e')]);_0x52209a[_0x4d9f('0x3f')]=_[_0x4d9f('0x40')](_0x52209a[_0x4d9f('0x3d')],_0x52209a['query']);_0x275248[_0x4d9f('0x41')]=_['intersection'](_0x52209a[_0x4d9f('0x3d')],qs[_0x4d9f('0x42')](_0x2ab8af['query'][_0x4d9f('0x42')]));_0x275248[_0x4d9f('0x41')]=_0x275248[_0x4d9f('0x41')][_0x4d9f('0x53')]?_0x275248[_0x4d9f('0x41')]:_0x52209a['model'];_0x275248[_0x4d9f('0x62')]=qs['sort'](_0x2ab8af['query'][_0x4d9f('0x45')]);_0x275248[_0x4d9f('0x46')]=qs['filters'](_[_0x4d9f('0x6f')](_0x2ab8af[_0x4d9f('0x3e')],_0x52209a[_0x4d9f('0x3f')]));if(_0x2ab8af[_0x4d9f('0x3e')][_0x4d9f('0x48')]){_0x275248[_0x4d9f('0x46')]=_[_0x4d9f('0x49')](_0x275248[_0x4d9f('0x46')],{'$or':_[_0x4d9f('0x37')](_0x275248['attributes'],function(_0x4208ca){var _0x18750e={};_0x18750e[_0x4208ca]={'$like':'%'+_0x2ab8af[_0x4d9f('0x3e')][_0x4d9f('0x48')]+'%'};return _0x18750e;})});}_0x275248=_[_0x4d9f('0x49')]({},_0x275248,_0x2ab8af[_0x4d9f('0x4a')]);return _0x282e60['getTeams'](_0x275248);}})[_0x4d9f('0x4b')](function(_0x196938){if(_0x196938){_0x3f8708=_0x196938[_0x4d9f('0x53')];if(!_0x2ab8af[_0x4d9f('0x3e')][_0x4d9f('0x43')](_0x4d9f('0x44'))){_0x275248[_0x4d9f('0x27')]=qs[_0x4d9f('0x27')](_0x2ab8af[_0x4d9f('0x3e')]['limit']);_0x275248[_0x4d9f('0x25')]=qs[_0x4d9f('0x25')](_0x2ab8af['query']['offset']);}return _0x282e60[_0x4d9f('0x70')](_0x275248);}})['then'](function(_0x26cc81){if(_0x26cc81){return _0x26cc81?{'count':_0x3f8708,'rows':_0x26cc81}:null;}})[_0x4d9f('0x4b')](respondWithResult(_0xedf84d,null))[_0x4d9f('0x5d')](handleError(_0xedf84d,null));};exports[_0x4d9f('0x71')]=function(_0xe62ff6,_0x1f3399,_0x10d90c){var _0x33b5fb=_0xe62ff6[_0x4d9f('0x56')]['ids'];return db[_0x4d9f('0x6e')][_0x4d9f('0x4e')]({'where':{'id':_0x33b5fb},'attributes':['id'],'include':[{'model':db[_0x4d9f('0x64')],'as':'Agents','attributes':['id',_0x4d9f('0x35'),_0x4d9f('0x72'),_0x4d9f('0x73'),'interface'],'raw':!![]}]})['then'](function(_0x24645b){if(_0x24645b){var _0x13aa3b=_[_0x4d9f('0x74')](_0x24645b,function(_0x551376){var _0x478cc1=_0x551376['get']({'plain':!![]});return _0x478cc1[_0x4d9f('0x75')];});return db[_0x4d9f('0x38')][_0x4d9f('0x54')]({'where':{'id':_0xe62ff6[_0x4d9f('0x51')]['id']}})[_0x4d9f('0x4b')](function(_0x461ead){return db['sequelize'][_0x4d9f('0x76')](function(_0x5b271f){return _0x461ead['addTeams'](_0x33b5fb,{'transaction':_0x5b271f})['then'](function(){return BPromise[_0x4d9f('0x77')](_0x13aa3b,function(_0x41d387){return db[_0x4d9f('0x61')][_0x4d9f('0x78')]({'where':{'UserId':_0x41d387['id'],'SmsQueueId':_0xe62ff6[_0x4d9f('0x51')]['id']},'transaction':_0x5b271f});});})['then'](function(){_0x13aa3b[_0x4d9f('0x79')](function(_0x27a6ee){socket[_0x4d9f('0x7a')]('userSmsQueue:save',{'UserId':_0x27a6ee['id'],'SmsQueueId':_0x461ead['id']});});});});});}})['then'](respondWithStatusCode(_0x1f3399,null))[_0x4d9f('0x5d')](handleError(_0x1f3399,null));};exports[_0x4d9f('0x7b')]=function(_0x59ef1d,_0x33c07b,_0x137feb){return db[_0x4d9f('0x6e')][_0x4d9f('0x4e')]({'where':{'id':_0x59ef1d[_0x4d9f('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4d9f('0x64')],'as':_0x4d9f('0x75'),'attributes':['id'],'raw':!![]}]})[_0x4d9f('0x4b')](handleEntityNotFound(_0x33c07b,null))[_0x4d9f('0x4b')](function(_0x274fa1){var _0x90aaaf=_[_0x4d9f('0x37')](_0x274fa1,'id');var _0x33b68e=[];var _0x343c28=[];var _0x50777d=squel[_0x4d9f('0x7c')]();_0x50777d['field']('tq.TeamId')[_0x4d9f('0x7d')]('team_has_sms_queues','tq')[_0x4d9f('0x7e')](_0x4d9f('0x7f'),'ut',_0x4d9f('0x80'))[_0x4d9f('0x46')](_0x4d9f('0x81'),_0x59ef1d[_0x4d9f('0x51')]['id']);for(var _0x1a6e28=0x0;_0x1a6e28<_0x274fa1[_0x4d9f('0x53')];_0x1a6e28+=0x1){let _0x1e8550=_0x274fa1[_0x1a6e28];for(var _0x48eac0=0x0;_0x48eac0<_0x1e8550['Agents'][_0x4d9f('0x53')];_0x48eac0+=0x1){let _0x27a20d=_0x1e8550[_0x4d9f('0x75')][_0x48eac0];var _0x41fb44=_0x50777d['clone']();_0x41fb44['where'](_0x4d9f('0x82'),_0x27a20d['id']);_0x343c28['push'](db[_0x4d9f('0x83')][_0x4d9f('0x3e')](_0x41fb44[_0x4d9f('0x84')](),{'type':db[_0x4d9f('0x83')][_0x4d9f('0x85')][_0x4d9f('0x86')]})['then'](function(_0x803d3){if(_0x803d3[_0x4d9f('0x53')]===0x1){return _0x27a20d['id'];}else{var _0x4ed81b=_[_0x4d9f('0x87')](_[_0x4d9f('0x37')](_0x803d3,_0x4d9f('0x88')),function(_0x14e0d3){return _['includes'](_0x90aaaf,_0x14e0d3);});if(_0x4ed81b){return _0x27a20d['id'];}}}));}}return BPromise[_0x4d9f('0x89')](_0x343c28)['then'](function(_0x5411e9){_0x33b68e=_(_0x33b68e)[_0x4d9f('0x8a')](_0x5411e9)['compact']()[_0x4d9f('0x8b')]();return db[_0x4d9f('0x38')][_0x4d9f('0x54')]({'where':{'id':_0x59ef1d[_0x4d9f('0x51')]['id']}})['then'](function(_0xbfc387){return db[_0x4d9f('0x83')][_0x4d9f('0x76')](function(_0x11ec17){return _0xbfc387[_0x4d9f('0x7b')](_0x59ef1d[_0x4d9f('0x3e')][_0x4d9f('0x8c')],{'transaction':_0x11ec17})[_0x4d9f('0x4b')](function(){if(!_[_0x4d9f('0x8d')](_0x33b68e)){return _0xbfc387[_0x4d9f('0x8e')](_0x33b68e,{'transaction':_0x11ec17});}})[_0x4d9f('0x4b')](function(){_0x33b68e[_0x4d9f('0x79')](function(_0x6017b9){socket[_0x4d9f('0x7a')](_0x4d9f('0x8f'),{'UserId':_0x6017b9,'SmsQueueId':_0xbfc387['id']});});});});});});})[_0x4d9f('0x4b')](respondWithStatusCode(_0x33c07b,null))[_0x4d9f('0x5d')](handleError(_0x33c07b,null));};exports['addAgents']=function(_0x8f80aa,_0x51df6f,_0x357560){return db[_0x4d9f('0x38')][_0x4d9f('0x54')]({'where':{'id':_0x8f80aa['params']['id']}})[_0x4d9f('0x4b')](handleEntityNotFound(_0x51df6f,null))[_0x4d9f('0x4b')](function(_0x431218){if(_0x431218){return _0x431218[_0x4d9f('0x90')](_0x8f80aa[_0x4d9f('0x56')]['ids'],_[_0x4d9f('0x91')](_0x8f80aa[_0x4d9f('0x56')],[_0x4d9f('0x8c'),'id'])||{})[_0x4d9f('0x92')](function(_0x408673){for(var _0x5ee08f=0x0;_0x5ee08f<_0x8f80aa['body'][_0x4d9f('0x8c')][_0x4d9f('0x53')];_0x5ee08f+=0x1){socket[_0x4d9f('0x7a')](_0x4d9f('0x93'),{'UserId':Number(_0x8f80aa[_0x4d9f('0x56')]['ids'][_0x5ee08f]),'SmsQueueId':Number(_0x8f80aa[_0x4d9f('0x51')]['id'])});}return _0x408673;});}})[_0x4d9f('0x4b')](respondWithResult(_0x51df6f,null))[_0x4d9f('0x5d')](handleError(_0x51df6f,null));};exports[_0x4d9f('0x8e')]=function(_0x49c87d,_0xcdb171,_0x59bd6d){return db[_0x4d9f('0x38')]['find']({'where':{'id':_0x49c87d[_0x4d9f('0x51')]['id']}})[_0x4d9f('0x4b')](handleEntityNotFound(_0xcdb171,null))['then'](function(_0x25cd3a){if(_0x25cd3a){return _0x25cd3a[_0x4d9f('0x8e')](_0x49c87d[_0x4d9f('0x3e')][_0x4d9f('0x8c')])[_0x4d9f('0x4b')](function(){if(_[_0x4d9f('0x94')](_0x49c87d['query'][_0x4d9f('0x8c')])){for(var _0x4c3f5a=0x0;_0x4c3f5a<_0x49c87d[_0x4d9f('0x3e')]['ids'][_0x4d9f('0x53')];_0x4c3f5a+=0x1){socket[_0x4d9f('0x7a')](_0x4d9f('0x8f'),{'UserId':Number(_0x49c87d[_0x4d9f('0x3e')][_0x4d9f('0x8c')][_0x4c3f5a]),'SmsQueueId':Number(_0x49c87d[_0x4d9f('0x51')]['id'])});}}else{socket[_0x4d9f('0x7a')](_0x4d9f('0x8f'),{'UserId':Number(_0x49c87d[_0x4d9f('0x3e')][_0x4d9f('0x8c')]),'SmsQueueId':Number(_0x49c87d['params']['id'])});}});}})[_0x4d9f('0x4b')](respondWithStatusCode(_0xcdb171,null))[_0x4d9f('0x5d')](handleError(_0xcdb171,null));};exports[_0x4d9f('0x95')]=function(_0x4262e,_0x10e822,_0x273e99){var _0x12d031={};var _0x474401={};var _0x393bcc;var _0x21ac7a;return db[_0x4d9f('0x38')][_0x4d9f('0x60')]({'where':{'id':_0x4262e[_0x4d9f('0x51')]['id']}})[_0x4d9f('0x4b')](handleEntityNotFound(_0x10e822,null))[_0x4d9f('0x4b')](function(_0x5cbfcd){if(_0x5cbfcd){_0x393bcc=_0x5cbfcd;_0x474401[_0x4d9f('0x3d')]=_[_0x4d9f('0x52')](db['User'][_0x4d9f('0x39')]);_0x474401[_0x4d9f('0x3e')]=_['keys'](_0x4262e[_0x4d9f('0x3e')]);_0x474401[_0x4d9f('0x3f')]=_[_0x4d9f('0x40')](_0x474401[_0x4d9f('0x3d')],_0x474401[_0x4d9f('0x3e')]);_0x12d031[_0x4d9f('0x41')]=_['intersection'](_0x474401[_0x4d9f('0x3d')],qs['fields'](_0x4262e[_0x4d9f('0x3e')][_0x4d9f('0x42')]));_0x12d031['attributes']=_0x12d031[_0x4d9f('0x41')]['length']?_0x12d031[_0x4d9f('0x41')]:_0x474401[_0x4d9f('0x3d')];_0x12d031['order']=qs[_0x4d9f('0x45')](_0x4262e['query'][_0x4d9f('0x45')]);_0x12d031[_0x4d9f('0x46')]=qs['filters'](_[_0x4d9f('0x6f')](_0x4262e[_0x4d9f('0x3e')],_0x474401[_0x4d9f('0x3f')]));if(_0x4262e[_0x4d9f('0x3e')][_0x4d9f('0x48')]){_0x12d031[_0x4d9f('0x46')]=_[_0x4d9f('0x49')](_0x12d031[_0x4d9f('0x46')],{'$or':_[_0x4d9f('0x37')](_0x12d031[_0x4d9f('0x41')],function(_0x3f2180){var _0x44370d={};_0x44370d[_0x3f2180]={'$like':'%'+_0x4262e[_0x4d9f('0x3e')]['filter']+'%'};return _0x44370d;})});}_0x12d031=_['merge']({},_0x12d031,_0x4262e[_0x4d9f('0x4a')]);return _0x393bcc[_0x4d9f('0x95')](_0x12d031);}})[_0x4d9f('0x4b')](function(_0x34fa75){if(_0x34fa75){_0x21ac7a=_0x34fa75[_0x4d9f('0x53')];if(!_0x4262e[_0x4d9f('0x3e')][_0x4d9f('0x43')]('nolimit')){_0x12d031[_0x4d9f('0x27')]=qs['limit'](_0x4262e[_0x4d9f('0x3e')]['limit']);_0x12d031['offset']=qs[_0x4d9f('0x25')](_0x4262e['query']['offset']);}return _0x393bcc[_0x4d9f('0x95')](_0x12d031);}})[_0x4d9f('0x4b')](function(_0x4cec42){if(_0x4cec42){return _0x4cec42?{'count':_0x21ac7a,'rows':_0x4cec42}:null;}})['then'](respondWithResult(_0x10e822,null))[_0x4d9f('0x5d')](handleError(_0x10e822,null));}; \ No newline at end of file +var _0x5e36=['SmsQueues','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','agent','smsPause','updatedAt','rows','format','%s/%s','SIP','getTeams','Team','order','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','type','VIRTUAL','options','include','catch','keys','includeAll','merge','find','create','body','user','role','get'];(function(_0x9bced4,_0x31d257){var _0x2ea623=function(_0xa5b5ca){while(--_0xa5b5ca){_0x9bced4['push'](_0x9bced4['shift']());}};_0x2ea623(++_0x31d257);}(_0x5e36,0xc8));var _0x65e3=function(_0x3f0adf,_0x160933){_0x3f0adf=_0x3f0adf-0x0;var _0x1470dc=_0x5e36[_0x3f0adf];return _0x1470dc;};'use strict';var emlformat=require(_0x65e3('0x0'));var rimraf=require(_0x65e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65e3('0x2'));var rp=require(_0x65e3('0x3'));var moment=require(_0x65e3('0x4'));var BPromise=require(_0x65e3('0x5'));var Mustache=require(_0x65e3('0x6'));var util=require(_0x65e3('0x7'));var path=require(_0x65e3('0x8'));var sox=require(_0x65e3('0x9'));var csv=require(_0x65e3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65e3('0xb'));var _=require(_0x65e3('0xc'));var squel=require(_0x65e3('0xd'));var crypto=require(_0x65e3('0xe'));var jsforce=require(_0x65e3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x65e3('0xa'));var querystring=require(_0x65e3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x65e3('0x11'));var hardwareService=require(_0x65e3('0x12'));var logger=require('../../config/logger')(_0x65e3('0x13'));var utils=require('../../config/utils');var config=require(_0x65e3('0x14'));var licenseUtil=require(_0x65e3('0x15'));var db=require(_0x65e3('0x16'))['db'];config[_0x65e3('0x17')]=_[_0x65e3('0x18')](config[_0x65e3('0x17')],{'host':_0x65e3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65e3('0x17')]));require(_0x65e3('0x1a'))[_0x65e3('0x1b')](socket);function respondWithStatusCode(_0x4ca459,_0x5b40bb){_0x5b40bb=_0x5b40bb||0xcc;return function(_0x48624f){if(_0x48624f){return _0x4ca459[_0x65e3('0x1c')](_0x5b40bb);}return _0x4ca459['status'](_0x5b40bb)[_0x65e3('0x1d')]();};}function respondWithResult(_0x30fa8a,_0x4239cc){_0x4239cc=_0x4239cc||0xc8;return function(_0x43c9e5){if(_0x43c9e5){return _0x30fa8a[_0x65e3('0x1e')](_0x4239cc)[_0x65e3('0x1f')](_0x43c9e5);}};}function respondWithFilteredResult(_0x4e2097,_0xd5bfb3){return function(_0x47af07){if(_0x47af07){var _0x3ce241=typeof _0xd5bfb3[_0x65e3('0x20')]===_0x65e3('0x21')&&typeof _0xd5bfb3[_0x65e3('0x22')]==='undefined';var _0x5dc2d9=_0x47af07[_0x65e3('0x23')];var _0x1826ef=_0x3ce241?0x0:_0xd5bfb3[_0x65e3('0x20')];var _0x29efef=_0x3ce241?_0x47af07[_0x65e3('0x23')]:_0xd5bfb3['offset']+_0xd5bfb3[_0x65e3('0x22')];var _0x16aecb;if(_0x29efef>=_0x5dc2d9){_0x29efef=_0x5dc2d9;_0x16aecb=0xc8;}else{_0x16aecb=0xce;}_0x4e2097[_0x65e3('0x1e')](_0x16aecb);return _0x4e2097[_0x65e3('0x24')](_0x65e3('0x25'),_0x1826ef+'-'+_0x29efef+'/'+_0x5dc2d9)[_0x65e3('0x1f')](_0x47af07);}return null;};}function patchUpdates(_0x346cd4){return function(_0x210c40){try{jsonpatch[_0x65e3('0x26')](_0x210c40,_0x346cd4,!![]);}catch(_0x33cf2e){return BPromise[_0x65e3('0x27')](_0x33cf2e);}return _0x210c40['save']();};}function saveUpdates(_0x3049e9,_0x2a7373){return function(_0x205e0a){if(_0x205e0a){return _0x205e0a[_0x65e3('0x28')](_0x3049e9)[_0x65e3('0x29')](function(_0x57fb76){return _0x57fb76;});}return null;};}function removeEntity(_0xcb4215,_0x57e4a6){return function(_0x225a11){if(_0x225a11){return _0x225a11[_0x65e3('0x2a')]()['then'](function(){var _0x5481d7=_0x225a11['get']({'plain':!![]});var _0x5546b3='SmsQueues';return db[_0x65e3('0x2b')][_0x65e3('0x2a')]({'where':{'type':_0x5546b3,'resourceId':_0x5481d7['id']}})['then'](function(){return _0x225a11;});})['then'](function(){_0xcb4215[_0x65e3('0x1e')](0xcc)[_0x65e3('0x1d')]();});}};}function handleEntityNotFound(_0x273b82,_0x384dfd){return function(_0x21e7a5){if(!_0x21e7a5){_0x273b82['sendStatus'](0x194);}return _0x21e7a5;};}function handleError(_0x2695db,_0xbac588){_0xbac588=_0xbac588||0x1f4;return function(_0x20439a){logger[_0x65e3('0x2c')](_0x20439a[_0x65e3('0x2d')]);if(_0x20439a[_0x65e3('0x2e')]){delete _0x20439a[_0x65e3('0x2e')];}_0x2695db[_0x65e3('0x1e')](_0xbac588)[_0x65e3('0x2f')](_0x20439a);};}exports[_0x65e3('0x30')]=function(_0x328f30,_0x13d89a){var _0x5440ae={},_0x2cc499={},_0x5091ba={'count':0x0,'rows':[]};var _0x23167c=_['map'](db[_0x65e3('0x31')][_0x65e3('0x32')],function(_0x31a246){return{'name':_0x31a246[_0x65e3('0x33')],'type':_0x31a246['type'][_0x65e3('0x34')]};});_0x2cc499[_0x65e3('0x35')]=_[_0x65e3('0x36')](_0x23167c,'name');_0x2cc499[_0x65e3('0x37')]=_['keys'](_0x328f30['query']);_0x2cc499[_0x65e3('0x38')]=_['intersection'](_0x2cc499['model'],_0x2cc499[_0x65e3('0x37')]);_0x5440ae['attributes']=_[_0x65e3('0x39')](_0x2cc499[_0x65e3('0x35')],qs[_0x65e3('0x3a')](_0x328f30['query']['fields']));_0x5440ae[_0x65e3('0x3b')]=_0x5440ae[_0x65e3('0x3b')][_0x65e3('0x3c')]?_0x5440ae[_0x65e3('0x3b')]:_0x2cc499[_0x65e3('0x35')];if(!_0x328f30[_0x65e3('0x37')]['hasOwnProperty'](_0x65e3('0x3d'))){_0x5440ae[_0x65e3('0x22')]=qs['limit'](_0x328f30['query'][_0x65e3('0x22')]);_0x5440ae[_0x65e3('0x20')]=qs['offset'](_0x328f30[_0x65e3('0x37')][_0x65e3('0x20')]);}_0x5440ae['order']=qs['sort'](_0x328f30['query'][_0x65e3('0x3e')]);_0x5440ae[_0x65e3('0x3f')]=qs[_0x65e3('0x38')](_[_0x65e3('0x40')](_0x328f30[_0x65e3('0x37')],_0x2cc499[_0x65e3('0x38')]),_0x23167c);if(_0x328f30[_0x65e3('0x37')][_0x65e3('0x41')]){_0x5440ae[_0x65e3('0x3f')]=_['merge'](_0x5440ae[_0x65e3('0x3f')],{'$or':_[_0x65e3('0x36')](_0x23167c,function(_0x11ecb3){if(_0x11ecb3[_0x65e3('0x42')]!==_0x65e3('0x43')){var _0x44c8cc={};_0x44c8cc[_0x11ecb3[_0x65e3('0x2e')]]={'$like':'%'+_0x328f30['query'][_0x65e3('0x41')]+'%'};return _0x44c8cc;}})});}_0x5440ae=_['merge']({},_0x5440ae,_0x328f30[_0x65e3('0x44')]);var _0x1159ee={'where':_0x5440ae[_0x65e3('0x3f')]};return db[_0x65e3('0x31')][_0x65e3('0x23')](_0x1159ee)['then'](function(_0x48176b){_0x5091ba[_0x65e3('0x23')]=_0x48176b;if(_0x328f30[_0x65e3('0x37')]['includeAll']){_0x5440ae[_0x65e3('0x45')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x5440ae);})[_0x65e3('0x29')](function(_0x2713f9){_0x5091ba['rows']=_0x2713f9;return _0x5091ba;})[_0x65e3('0x29')](respondWithFilteredResult(_0x13d89a,_0x5440ae))[_0x65e3('0x46')](handleError(_0x13d89a,null));};exports['show']=function(_0x4f43f3,_0x127295){var _0x18c1ae={'raw':!![],'where':{'id':_0x4f43f3['params']['id']}},_0x541ca3={};_0x541ca3[_0x65e3('0x35')]=_[_0x65e3('0x47')](db['SmsQueue']['rawAttributes']);_0x541ca3['query']=_[_0x65e3('0x47')](_0x4f43f3[_0x65e3('0x37')]);_0x541ca3[_0x65e3('0x38')]=_[_0x65e3('0x39')](_0x541ca3['model'],_0x541ca3[_0x65e3('0x37')]);_0x18c1ae[_0x65e3('0x3b')]=_[_0x65e3('0x39')](_0x541ca3[_0x65e3('0x35')],qs[_0x65e3('0x3a')](_0x4f43f3[_0x65e3('0x37')][_0x65e3('0x3a')]));_0x18c1ae[_0x65e3('0x3b')]=_0x18c1ae[_0x65e3('0x3b')]['length']?_0x18c1ae[_0x65e3('0x3b')]:_0x541ca3['model'];if(_0x4f43f3[_0x65e3('0x37')][_0x65e3('0x48')]){_0x18c1ae[_0x65e3('0x45')]=[{'all':!![]}];}_0x18c1ae=_[_0x65e3('0x49')]({},_0x18c1ae,_0x4f43f3[_0x65e3('0x44')]);return db[_0x65e3('0x31')][_0x65e3('0x4a')](_0x18c1ae)[_0x65e3('0x29')](handleEntityNotFound(_0x127295,null))[_0x65e3('0x29')](respondWithResult(_0x127295,null))[_0x65e3('0x46')](handleError(_0x127295,null));};exports[_0x65e3('0x4b')]=function(_0x1955e6,_0x4e16f5){return db[_0x65e3('0x31')][_0x65e3('0x4b')](_0x1955e6[_0x65e3('0x4c')],{})[_0x65e3('0x29')](function(_0x201758){var _0x1b493b=_0x1955e6[_0x65e3('0x4d')]['get']({'plain':!![]});if(!_0x1b493b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b493b[_0x65e3('0x4e')]===_0x65e3('0x4d')){var _0xf477c7=_0x201758[_0x65e3('0x4f')]({'plain':!![]});var _0x958baa=_0x65e3('0x50');return db[_0x65e3('0x51')][_0x65e3('0x4a')]({'where':{'name':_0x958baa,'userProfileId':_0x1b493b[_0x65e3('0x52')]},'raw':!![]})['then'](function(_0x516e0b){if(_0x516e0b&&_0x516e0b[_0x65e3('0x53')]===0x0){return db[_0x65e3('0x2b')][_0x65e3('0x4b')]({'name':_0xf477c7[_0x65e3('0x2e')],'resourceId':_0xf477c7['id'],'type':_0x516e0b['name'],'sectionId':_0x516e0b['id']},{})['then'](function(){return _0x201758;});}else{return _0x201758;}})[_0x65e3('0x46')](function(_0x65731f){logger[_0x65e3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x65731f);throw _0x65731f;});}return _0x201758;})[_0x65e3('0x29')](respondWithResult(_0x4e16f5,0xc9))[_0x65e3('0x46')](handleError(_0x4e16f5,null));};exports[_0x65e3('0x28')]=function(_0x3992af,_0x1c05d3){if(_0x3992af[_0x65e3('0x4c')]['id']){delete _0x3992af['body']['id'];}return db[_0x65e3('0x31')][_0x65e3('0x4a')]({'where':{'id':_0x3992af[_0x65e3('0x54')]['id']}})[_0x65e3('0x29')](handleEntityNotFound(_0x1c05d3,null))[_0x65e3('0x29')](saveUpdates(_0x3992af[_0x65e3('0x4c')],null))['then'](respondWithResult(_0x1c05d3,null))['catch'](handleError(_0x1c05d3,null));};exports[_0x65e3('0x2a')]=function(_0x6bb2c9,_0x1f4a3b){return db['SmsQueue'][_0x65e3('0x4a')]({'where':{'id':_0x6bb2c9[_0x65e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x1f4a3b,null))['then'](removeEntity(_0x1f4a3b,null))[_0x65e3('0x46')](handleError(_0x1f4a3b,null));};exports[_0x65e3('0x55')]=function(_0x517d75,_0x11d8af){return db[_0x65e3('0x31')][_0x65e3('0x55')]()['then'](respondWithResult(_0x11d8af,null))[_0x65e3('0x46')](handleError(_0x11d8af,null));};exports[_0x65e3('0x56')]=function(_0x5411a4,_0x56ffef,_0x164498){var _0x161220={'raw':!![],'where':{}},_0x3f8da5={},_0xfe50cd;return db[_0x65e3('0x31')][_0x65e3('0x57')]({'where':{'id':_0x5411a4[_0x65e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x56ffef,null))[_0x65e3('0x29')](function(_0x465cec){if(_0x465cec){_0xfe50cd=_0x465cec[_0x65e3('0x4f')]({'plain':!![]});_0x3f8da5[_0x65e3('0x35')]=_[_0x65e3('0x47')](db[_0x65e3('0x58')][_0x65e3('0x32')]);_0x3f8da5[_0x65e3('0x37')]=_[_0x65e3('0x47')](_0x5411a4[_0x65e3('0x37')]);_0x3f8da5[_0x65e3('0x38')]=_[_0x65e3('0x39')](_0x3f8da5[_0x65e3('0x35')],_0x3f8da5[_0x65e3('0x37')]);_0x161220[_0x65e3('0x3b')]=_[_0x65e3('0x39')](_0x3f8da5[_0x65e3('0x35')],qs['fields'](_0x5411a4[_0x65e3('0x37')][_0x65e3('0x3a')]));_0x161220[_0x65e3('0x3b')]=_0x161220[_0x65e3('0x3b')][_0x65e3('0x3c')]?_0x161220['attributes']:_0x3f8da5[_0x65e3('0x35')];if(!_0x5411a4[_0x65e3('0x37')]['hasOwnProperty'](_0x65e3('0x3d'))){_0x161220['limit']=qs[_0x65e3('0x22')](_0x5411a4[_0x65e3('0x37')][_0x65e3('0x22')]);_0x161220['offset']=qs[_0x65e3('0x20')](_0x5411a4[_0x65e3('0x37')][_0x65e3('0x20')]);}_0x161220['order']=qs[_0x65e3('0x3e')](_0x5411a4[_0x65e3('0x37')]['sort']);_0x161220[_0x65e3('0x3f')]=qs[_0x65e3('0x38')](_['pick'](_0x5411a4['query'],_0x3f8da5[_0x65e3('0x38')]));_0x161220[_0x65e3('0x3f')][_0x65e3('0x59')]=_0x465cec['id'];if(_0x5411a4[_0x65e3('0x37')][_0x65e3('0x41')]){_0x161220[_0x65e3('0x3f')]=_['merge'](_0x161220[_0x65e3('0x3f')],{'$or':_[_0x65e3('0x36')](_0x161220[_0x65e3('0x3b')],function(_0x412dda){var _0x4eb57b={};_0x4eb57b[_0x412dda]={'$like':'%'+_0x5411a4[_0x65e3('0x37')][_0x65e3('0x41')]+'%'};return _0x4eb57b;})});}_0x161220=_['merge']({},_0x161220,_0x5411a4[_0x65e3('0x44')]);return db['UserSmsQueue'][_0x65e3('0x5a')](_0x161220);}})[_0x65e3('0x29')](function(_0x744890){if(_0x744890){return db[_0x65e3('0x5b')]['findAndCountAll']({'where':{'id':_[_0x65e3('0x36')](_0x744890,'UserId'),'role':_0x65e3('0x5c')},'attributes':['id',_0x65e3('0x2e'),_0x65e3('0x5d'),_0x65e3('0x5e'),'createdAt']});}})['then'](function(_0x3fbbaa){if(_0x3fbbaa){return{'count':_0x3fbbaa[_0x65e3('0x23')],'rows':_[_0x65e3('0x36')](_0x3fbbaa[_0x65e3('0x5f')],function(_0x173298){return{'membername':_0x173298[_0x65e3('0x2e')],'UserId':_0x173298['id'],'queue_name':_0xfe50cd[_0x65e3('0x2e')],'SmsQueueId':_0xfe50cd['id'],'interface':util[_0x65e3('0x60')](_0x65e3('0x61'),_0x65e3('0x62'),_0x173298[_0x65e3('0x2e')]),'penalty':0x0,'paused':_0x173298[_0x65e3('0x5d')],'createdAt':_0x173298['createdAt'],'updatedAt':_0x173298[_0x65e3('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x56ffef,_0x161220))['catch'](handleError(_0x56ffef,null));};exports[_0x65e3('0x63')]=function(_0x5e30b7,_0x1caee2,_0x526154){var _0x33ff96={};var _0x4a3ffc={};var _0x291c56;var _0x115f8c;return db['SmsQueue'][_0x65e3('0x57')]({'where':{'id':_0x5e30b7[_0x65e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x1caee2,null))[_0x65e3('0x29')](function(_0x319f10){if(_0x319f10){_0x291c56=_0x319f10;_0x4a3ffc[_0x65e3('0x35')]=_['keys'](db[_0x65e3('0x64')][_0x65e3('0x32')]);_0x4a3ffc[_0x65e3('0x37')]=_[_0x65e3('0x47')](_0x5e30b7[_0x65e3('0x37')]);_0x4a3ffc[_0x65e3('0x38')]=_['intersection'](_0x4a3ffc['model'],_0x4a3ffc['query']);_0x33ff96[_0x65e3('0x3b')]=_[_0x65e3('0x39')](_0x4a3ffc[_0x65e3('0x35')],qs[_0x65e3('0x3a')](_0x5e30b7['query']['fields']));_0x33ff96[_0x65e3('0x3b')]=_0x33ff96[_0x65e3('0x3b')]['length']?_0x33ff96[_0x65e3('0x3b')]:_0x4a3ffc['model'];_0x33ff96[_0x65e3('0x65')]=qs[_0x65e3('0x3e')](_0x5e30b7[_0x65e3('0x37')][_0x65e3('0x3e')]);_0x33ff96[_0x65e3('0x3f')]=qs[_0x65e3('0x38')](_[_0x65e3('0x40')](_0x5e30b7[_0x65e3('0x37')],_0x4a3ffc[_0x65e3('0x38')]));if(_0x5e30b7[_0x65e3('0x37')][_0x65e3('0x41')]){_0x33ff96[_0x65e3('0x3f')]=_[_0x65e3('0x49')](_0x33ff96[_0x65e3('0x3f')],{'$or':_[_0x65e3('0x36')](_0x33ff96[_0x65e3('0x3b')],function(_0x24c566){var _0x9b919a={};_0x9b919a[_0x24c566]={'$like':'%'+_0x5e30b7[_0x65e3('0x37')][_0x65e3('0x41')]+'%'};return _0x9b919a;})});}_0x33ff96=_[_0x65e3('0x49')]({},_0x33ff96,_0x5e30b7['options']);return _0x291c56[_0x65e3('0x63')](_0x33ff96);}})[_0x65e3('0x29')](function(_0x3e0192){if(_0x3e0192){_0x115f8c=_0x3e0192['length'];if(!_0x5e30b7[_0x65e3('0x37')][_0x65e3('0x66')](_0x65e3('0x3d'))){_0x33ff96['limit']=qs['limit'](_0x5e30b7[_0x65e3('0x37')][_0x65e3('0x22')]);_0x33ff96['offset']=qs['offset'](_0x5e30b7[_0x65e3('0x37')]['offset']);}return _0x291c56[_0x65e3('0x63')](_0x33ff96);}})[_0x65e3('0x29')](function(_0x46a035){if(_0x46a035){return _0x46a035?{'count':_0x115f8c,'rows':_0x46a035}:null;}})[_0x65e3('0x29')](respondWithResult(_0x1caee2,null))[_0x65e3('0x46')](handleError(_0x1caee2,null));};exports[_0x65e3('0x67')]=function(_0x34c0e4,_0xadd257,_0x1d9b98){var _0x1ab90f=_0x34c0e4[_0x65e3('0x4c')][_0x65e3('0x68')];return db[_0x65e3('0x64')][_0x65e3('0x5a')]({'where':{'id':_0x1ab90f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x65e3('0x69'),'attributes':['id','name','online',_0x65e3('0x6a'),_0x65e3('0x6b')],'raw':!![]}]})[_0x65e3('0x29')](function(_0x353bcd){if(_0x353bcd){var _0x547eb7=_[_0x65e3('0x6c')](_0x353bcd,function(_0x3065f7){var _0x54d13e=_0x3065f7['get']({'plain':!![]});return _0x54d13e[_0x65e3('0x69')];});return db[_0x65e3('0x31')][_0x65e3('0x4a')]({'where':{'id':_0x34c0e4['params']['id']}})[_0x65e3('0x29')](function(_0x17e49f){return db[_0x65e3('0x6d')]['transaction'](function(_0x174656){return _0x17e49f[_0x65e3('0x67')](_0x1ab90f,{'transaction':_0x174656})[_0x65e3('0x29')](function(){return BPromise[_0x65e3('0x6e')](_0x547eb7,function(_0x366f85){return db[_0x65e3('0x58')][_0x65e3('0x6f')]({'where':{'UserId':_0x366f85['id'],'SmsQueueId':_0x34c0e4[_0x65e3('0x54')]['id']},'transaction':_0x174656});});})[_0x65e3('0x29')](function(){_0x547eb7[_0x65e3('0x70')](function(_0x3089a0){socket[_0x65e3('0x71')](_0x65e3('0x72'),{'UserId':_0x3089a0['id'],'SmsQueueId':_0x17e49f['id']});});});});});}})[_0x65e3('0x29')](respondWithStatusCode(_0xadd257,null))[_0x65e3('0x46')](handleError(_0xadd257,null));};exports[_0x65e3('0x73')]=function(_0x4dc785,_0x286eb5,_0x246a71){return db['Team'][_0x65e3('0x5a')]({'where':{'id':_0x4dc785[_0x65e3('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x65e3('0x5b')],'as':_0x65e3('0x69'),'attributes':['id'],'raw':!![]}]})[_0x65e3('0x29')](handleEntityNotFound(_0x286eb5,null))[_0x65e3('0x29')](function(_0x3c4e46){var _0x3c868b=_['map'](_0x3c4e46,'id');var _0xc0adab=[];var _0x363f1b=[];var _0x409448=squel[_0x65e3('0x74')]();_0x409448[_0x65e3('0x75')](_0x65e3('0x76'))[_0x65e3('0x77')]('team_has_sms_queues','tq')[_0x65e3('0x78')]('user_has_teams','ut',_0x65e3('0x79'))['where'](_0x65e3('0x7a'),_0x4dc785['params']['id']);for(var _0x4734a6=0x0;_0x4734a6<_0x3c4e46['length'];_0x4734a6+=0x1){let _0x5844a8=_0x3c4e46[_0x4734a6];for(var _0x4843e0=0x0;_0x4843e0<_0x5844a8['Agents'][_0x65e3('0x3c')];_0x4843e0+=0x1){let _0x1569aa=_0x5844a8['Agents'][_0x4843e0];var _0x3a84b0=_0x409448[_0x65e3('0x7b')]();_0x3a84b0[_0x65e3('0x3f')](_0x65e3('0x7c'),_0x1569aa['id']);_0x363f1b[_0x65e3('0x7d')](db[_0x65e3('0x6d')][_0x65e3('0x37')](_0x3a84b0[_0x65e3('0x7e')](),{'type':db[_0x65e3('0x6d')][_0x65e3('0x7f')]['SELECT']})[_0x65e3('0x29')](function(_0x47de78){if(_0x47de78[_0x65e3('0x3c')]===0x1){return _0x1569aa['id'];}else{var _0x4e9c84=_[_0x65e3('0x80')](_[_0x65e3('0x36')](_0x47de78,_0x65e3('0x81')),function(_0x102ab0){return _[_0x65e3('0x82')](_0x3c868b,_0x102ab0);});if(_0x4e9c84){return _0x1569aa['id'];}}}));}}return BPromise['all'](_0x363f1b)[_0x65e3('0x29')](function(_0x4ac330){_0xc0adab=_(_0xc0adab)[_0x65e3('0x83')](_0x4ac330)['compact']()[_0x65e3('0x84')]();return db[_0x65e3('0x31')][_0x65e3('0x4a')]({'where':{'id':_0x4dc785[_0x65e3('0x54')]['id']}})[_0x65e3('0x29')](function(_0x377dac){return db['sequelize']['transaction'](function(_0x475fbb){return _0x377dac[_0x65e3('0x73')](_0x4dc785[_0x65e3('0x37')]['ids'],{'transaction':_0x475fbb})[_0x65e3('0x29')](function(){if(!_[_0x65e3('0x85')](_0xc0adab)){return _0x377dac[_0x65e3('0x86')](_0xc0adab,{'transaction':_0x475fbb});}})[_0x65e3('0x29')](function(){_0xc0adab[_0x65e3('0x70')](function(_0x24f877){socket[_0x65e3('0x71')](_0x65e3('0x87'),{'UserId':_0x24f877,'SmsQueueId':_0x377dac['id']});});});});});});})[_0x65e3('0x29')](respondWithStatusCode(_0x286eb5,null))[_0x65e3('0x46')](handleError(_0x286eb5,null));};exports[_0x65e3('0x88')]=function(_0x5f28e3,_0x4eb6b2,_0x195c0f){return db[_0x65e3('0x31')][_0x65e3('0x4a')]({'where':{'id':_0x5f28e3[_0x65e3('0x54')]['id']}})[_0x65e3('0x29')](handleEntityNotFound(_0x4eb6b2,null))[_0x65e3('0x29')](function(_0x4b1190){if(_0x4b1190){return _0x4b1190[_0x65e3('0x88')](_0x5f28e3[_0x65e3('0x4c')][_0x65e3('0x68')],_[_0x65e3('0x89')](_0x5f28e3[_0x65e3('0x4c')],['ids','id'])||{})[_0x65e3('0x8a')](function(_0x5399a3){for(var _0x4bae17=0x0;_0x4bae17<_0x5f28e3['body'][_0x65e3('0x68')][_0x65e3('0x3c')];_0x4bae17+=0x1){socket[_0x65e3('0x71')]('userSmsQueue:save',{'UserId':Number(_0x5f28e3[_0x65e3('0x4c')][_0x65e3('0x68')][_0x4bae17]),'SmsQueueId':Number(_0x5f28e3[_0x65e3('0x54')]['id'])});}return _0x5399a3;});}})[_0x65e3('0x29')](respondWithResult(_0x4eb6b2,null))[_0x65e3('0x46')](handleError(_0x4eb6b2,null));};exports[_0x65e3('0x86')]=function(_0x521711,_0x9e2f51,_0x182d50){return db[_0x65e3('0x31')]['find']({'where':{'id':_0x521711[_0x65e3('0x54')]['id']}})[_0x65e3('0x29')](handleEntityNotFound(_0x9e2f51,null))['then'](function(_0x584e9b){if(_0x584e9b){return _0x584e9b[_0x65e3('0x86')](_0x521711[_0x65e3('0x37')]['ids'])[_0x65e3('0x29')](function(){if(_['isArray'](_0x521711[_0x65e3('0x37')][_0x65e3('0x68')])){for(var _0x286b59=0x0;_0x286b59<_0x521711['query'][_0x65e3('0x68')][_0x65e3('0x3c')];_0x286b59+=0x1){socket[_0x65e3('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x521711[_0x65e3('0x37')]['ids'][_0x286b59]),'SmsQueueId':Number(_0x521711[_0x65e3('0x54')]['id'])});}}else{socket[_0x65e3('0x71')](_0x65e3('0x87'),{'UserId':Number(_0x521711[_0x65e3('0x37')]['ids']),'SmsQueueId':Number(_0x521711[_0x65e3('0x54')]['id'])});}});}})[_0x65e3('0x29')](respondWithStatusCode(_0x9e2f51,null))[_0x65e3('0x46')](handleError(_0x9e2f51,null));};exports[_0x65e3('0x8b')]=function(_0x290a90,_0x5e0e32,_0x1046d8){var _0x2da6f1={};var _0x75cccd={};var _0x11a510;var _0x55b1ed;return db[_0x65e3('0x31')][_0x65e3('0x57')]({'where':{'id':_0x290a90[_0x65e3('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e0e32,null))[_0x65e3('0x29')](function(_0x1679c0){if(_0x1679c0){_0x11a510=_0x1679c0;_0x75cccd[_0x65e3('0x35')]=_[_0x65e3('0x47')](db[_0x65e3('0x5b')][_0x65e3('0x32')]);_0x75cccd[_0x65e3('0x37')]=_[_0x65e3('0x47')](_0x290a90[_0x65e3('0x37')]);_0x75cccd[_0x65e3('0x38')]=_[_0x65e3('0x39')](_0x75cccd[_0x65e3('0x35')],_0x75cccd['query']);_0x2da6f1[_0x65e3('0x3b')]=_[_0x65e3('0x39')](_0x75cccd[_0x65e3('0x35')],qs[_0x65e3('0x3a')](_0x290a90['query'][_0x65e3('0x3a')]));_0x2da6f1['attributes']=_0x2da6f1['attributes'][_0x65e3('0x3c')]?_0x2da6f1[_0x65e3('0x3b')]:_0x75cccd[_0x65e3('0x35')];_0x2da6f1[_0x65e3('0x65')]=qs['sort'](_0x290a90[_0x65e3('0x37')][_0x65e3('0x3e')]);_0x2da6f1['where']=qs['filters'](_['pick'](_0x290a90[_0x65e3('0x37')],_0x75cccd[_0x65e3('0x38')]));if(_0x290a90[_0x65e3('0x37')][_0x65e3('0x41')]){_0x2da6f1[_0x65e3('0x3f')]=_[_0x65e3('0x49')](_0x2da6f1[_0x65e3('0x3f')],{'$or':_[_0x65e3('0x36')](_0x2da6f1[_0x65e3('0x3b')],function(_0x4608ad){var _0x504c1a={};_0x504c1a[_0x4608ad]={'$like':'%'+_0x290a90['query'][_0x65e3('0x41')]+'%'};return _0x504c1a;})});}_0x2da6f1=_[_0x65e3('0x49')]({},_0x2da6f1,_0x290a90[_0x65e3('0x44')]);return _0x11a510[_0x65e3('0x8b')](_0x2da6f1);}})['then'](function(_0x268c66){if(_0x268c66){_0x55b1ed=_0x268c66[_0x65e3('0x3c')];if(!_0x290a90[_0x65e3('0x37')][_0x65e3('0x66')](_0x65e3('0x3d'))){_0x2da6f1['limit']=qs[_0x65e3('0x22')](_0x290a90[_0x65e3('0x37')][_0x65e3('0x22')]);_0x2da6f1[_0x65e3('0x20')]=qs['offset'](_0x290a90[_0x65e3('0x37')][_0x65e3('0x20')]);}return _0x11a510[_0x65e3('0x8b')](_0x2da6f1);}})['then'](function(_0x2868cf){if(_0x2868cf){return _0x2868cf?{'count':_0x55b1ed,'rows':_0x2868cf}:null;}})[_0x65e3('0x29')](respondWithResult(_0x5e0e32,null))[_0x65e3('0x46')](handleError(_0x5e0e32,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b9429ba..24ba836 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 _0xe6dd=['save','update','remove','emit','exports','events','SmsQueue','setMaxListeners'];(function(_0x341ba0,_0x2831d9){var _0x12f7fe=function(_0x2fa8b7){while(--_0x2fa8b7){_0x341ba0['push'](_0x341ba0['shift']());}};_0x12f7fe(++_0x2831d9);}(_0xe6dd,0xed));var _0xde6d=function(_0x160d65,_0x3c1fdc){_0x160d65=_0x160d65-0x0;var _0x35d585=_0xe6dd[_0x160d65];return _0x35d585;};'use strict';var EventEmitter=require(_0xde6d('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xde6d('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xde6d('0x2')](0x0);var events={'afterCreate':_0xde6d('0x3'),'afterUpdate':_0xde6d('0x4'),'afterDestroy':_0xde6d('0x5')};function emitEvent(_0x12c894){return function(_0x12e9b6,_0x2a8879,_0x47880c){SmsQueueEvents['emit'](_0x12c894+':'+_0x12e9b6['id'],_0x12e9b6);SmsQueueEvents[_0xde6d('0x6')](_0x12c894,_0x12e9b6);_0x47880c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xde6d('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xefc8=['save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x33d673,_0x2a8511){var _0x2e0d3b=function(_0xda3f1){while(--_0xda3f1){_0x33d673['push'](_0x33d673['shift']());}};_0x2e0d3b(++_0x2a8511);}(_0xefc8,0x12b));var _0x8efc=function(_0x20b904,_0x31b7ce){_0x20b904=_0x20b904-0x0;var _0xe124cc=_0xefc8[_0x20b904];return _0xe124cc;};'use strict';var EventEmitter=require(_0x8efc('0x0'));var SmsQueue=require(_0x8efc('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8efc('0x2'),'afterUpdate':_0x8efc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x428321){return function(_0x35cd47,_0x238291,_0x41ba6a){SmsQueueEvents[_0x8efc('0x4')](_0x428321+':'+_0x35cd47['id'],_0x35cd47);SmsQueueEvents[_0x8efc('0x4')](_0x428321,_0x35cd47);_0x41ba6a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x8efc('0x5')](e,emitEvent(event));}}module[_0x8efc('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 6a8d1c1..8589a65 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 _0xbf4a=['../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x156b0e,_0x59fb02){var _0x4c353e=function(_0xe799cd){while(--_0xe799cd){_0x156b0e['push'](_0x156b0e['shift']());}};_0x4c353e(++_0x59fb02);}(_0xbf4a,0x157));var _0xabf4=function(_0x13c0c8,_0x13a2cb){_0x13c0c8=_0x13c0c8-0x0;var _0x43956e=_0xbf4a[_0x13c0c8];return _0x43956e;};'use strict';var _=require(_0xabf4('0x0'));var util=require(_0xabf4('0x1'));var logger=require(_0xabf4('0x2'))(_0xabf4('0x3'));var moment=require(_0xabf4('0x4'));var BPromise=require(_0xabf4('0x5'));var rp=require(_0xabf4('0x6'));var fs=require('fs');var path=require(_0xabf4('0x7'));var rimraf=require('rimraf');var config=require(_0xabf4('0x8'));var attributes=require(_0xabf4('0x9'));module[_0xabf4('0xa')]=function(_0x18fd67,_0x5e7975){return _0x18fd67[_0xabf4('0xb')]('SmsQueue',attributes,{'tableName':_0xabf4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06f9=['define','SmsQueue','sms_queues','lodash','util','moment','rimraf','./smsQueue.attributes','exports'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x06f9,0x93));var _0x906f=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x06f9[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x906f('0x0'));var util=require(_0x906f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x906f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x906f('0x3'));var config=require('../../config/environment');var attributes=require(_0x906f('0x4'));module[_0x906f('0x5')]=function(_0x44dd31,_0x3923b3){return _0x44dd31[_0x906f('0x6')](_0x906f('0x7'),attributes,{'tableName':_0x906f('0x8'),'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 ae5f88a..d32ec52 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 _0xa4f0=['./smsQueue.socket','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','include','map','model','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x155ce5,_0x240cf2){var _0x46f255=function(_0x4ba11d){while(--_0x4ba11d){_0x155ce5['push'](_0x155ce5['shift']());}};_0x46f255(++_0x240cf2);}(_0xa4f0,0x1b9));var _0x0a4f=function(_0x41e226,_0x5b6d61){_0x41e226=_0x41e226-0x0;var _0x87089d=_0xa4f0[_0x41e226];return _0x87089d;};'use strict';var _=require(_0x0a4f('0x0'));var util=require(_0x0a4f('0x1'));var moment=require(_0x0a4f('0x2'));var BPromise=require(_0x0a4f('0x3'));var rs=require(_0x0a4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a4f('0x5'));var logger=require(_0x0a4f('0x6'))(_0x0a4f('0x7'));var config=require(_0x0a4f('0x8'));var jayson=require(_0x0a4f('0x9'));var client=jayson[_0x0a4f('0xa')]['http']({'port':0x232a});config['redis']=_[_0x0a4f('0xb')](config[_0x0a4f('0xc')],{'host':_0x0a4f('0xd'),'port':0x18eb});var socket=require(_0x0a4f('0xe'))(new Redis(config['redis']));require(_0x0a4f('0xf'))['register'](socket);function respondWithRpcPromise(_0x44aca7,_0xd0b51,_0x9804b0){return new BPromise(function(_0x389b0f,_0x321394){return client['request'](_0x44aca7,_0x9804b0)[_0x0a4f('0x10')](function(_0x19d040){logger[_0x0a4f('0x11')](_0x0a4f('0x12'),_0xd0b51,_0x0a4f('0x13'));logger[_0x0a4f('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0xd0b51,_0x0a4f('0x13'),JSON[_0x0a4f('0x15')](_0x19d040));if(_0x19d040[_0x0a4f('0x16')]){if(_0x19d040['error'][_0x0a4f('0x17')]===0x1f4){logger[_0x0a4f('0x16')]('SmsQueue,\x20%s,\x20%s',_0xd0b51,_0x19d040[_0x0a4f('0x16')][_0x0a4f('0x18')]);return _0x321394(_0x19d040[_0x0a4f('0x16')][_0x0a4f('0x18')]);}logger[_0x0a4f('0x16')]('SmsQueue,\x20%s,\x20%s',_0xd0b51,_0x19d040[_0x0a4f('0x16')]['message']);return _0x389b0f(_0x19d040[_0x0a4f('0x16')]['message']);}else{logger[_0x0a4f('0x11')](_0x0a4f('0x12'),_0xd0b51,_0x0a4f('0x13'));_0x389b0f(_0x19d040['result'][_0x0a4f('0x18')]);}})[_0x0a4f('0x19')](function(_0x3c5405){logger[_0x0a4f('0x16')](_0x0a4f('0x12'),_0xd0b51,_0x3c5405);_0x321394(_0x3c5405);});});}exports[_0x0a4f('0x1a')]=function(_0x2227ac){var _0x7120fe=this;return new Promise(function(_0x3cebfd,_0x16adb4){return db[_0x0a4f('0x1b')][_0x0a4f('0x1c')]({'raw':_0x2227ac['options']?_0x2227ac[_0x0a4f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2227ac[_0x0a4f('0x1d')]?_0x2227ac['options'][_0x0a4f('0x1e')]||null:null,'attributes':_0x2227ac[_0x0a4f('0x1d')]?_0x2227ac[_0x0a4f('0x1d')][_0x0a4f('0x1f')]||null:null,'limit':_0x2227ac[_0x0a4f('0x1d')]?_0x2227ac['options']['limit']||null:null,'include':_0x2227ac[_0x0a4f('0x1d')]?_0x2227ac[_0x0a4f('0x1d')][_0x0a4f('0x20')]?_[_0x0a4f('0x21')](_0x2227ac[_0x0a4f('0x1d')]['include'],function(_0x395bff){return{'model':db[_0x395bff['model']],'as':_0x395bff['as'],'attributes':_0x395bff['attributes'],'include':_0x395bff[_0x0a4f('0x20')]?_[_0x0a4f('0x21')](_0x395bff[_0x0a4f('0x20')],function(_0xf40045){return{'model':db[_0xf40045[_0x0a4f('0x22')]],'as':_0xf40045['as'],'attributes':_0xf40045['attributes'],'include':_0xf40045[_0x0a4f('0x20')]?_[_0x0a4f('0x21')](_0xf40045[_0x0a4f('0x20')],function(_0x3ea513){return{'model':db[_0x3ea513['model']],'as':_0x3ea513['as'],'attributes':_0x3ea513['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a4f('0x10')](function(_0x32af82){logger['info'](_0x0a4f('0x1a'),_0x2227ac);logger[_0x0a4f('0x14')]('GetSmsQueue',_0x2227ac,JSON[_0x0a4f('0x15')](_0x32af82));_0x3cebfd(_0x32af82);})[_0x0a4f('0x19')](function(_0x1aa5ad){logger['error'](_0x0a4f('0x1a'),_0x1aa5ad[_0x0a4f('0x18')],_0x2227ac);_0x16adb4(_0x7120fe[_0x0a4f('0x16')](0x1f4,_0x1aa5ad[_0x0a4f('0x18')]));});});};exports[_0x0a4f('0x23')]=function(_0x15150e){var _0x40c81a=this;return new Promise(function(_0x39dc17,_0x4acbe2){return db['SmsQueue'][_0x0a4f('0x24')]({'raw':_0x15150e[_0x0a4f('0x1d')]?_0x15150e['options'][_0x0a4f('0x25')]===undefined?!![]:![]:!![],'where':_0x15150e[_0x0a4f('0x1d')]?_0x15150e[_0x0a4f('0x1d')][_0x0a4f('0x1e')]||null:null,'attributes':_0x15150e[_0x0a4f('0x1d')]?_0x15150e['options'][_0x0a4f('0x1f')]||null:null,'include':_0x15150e[_0x0a4f('0x1d')]?_0x15150e[_0x0a4f('0x1d')]['include']?_['map'](_0x15150e[_0x0a4f('0x1d')]['include'],function(_0x3c10ae){return{'model':db[_0x3c10ae[_0x0a4f('0x22')]],'as':_0x3c10ae['as'],'attributes':_0x3c10ae[_0x0a4f('0x1f')],'include':_0x3c10ae[_0x0a4f('0x20')]?_[_0x0a4f('0x21')](_0x3c10ae[_0x0a4f('0x20')],function(_0x160f42){return{'model':db[_0x160f42['model']],'as':_0x160f42['as'],'attributes':_0x160f42[_0x0a4f('0x1f')],'include':_0x160f42[_0x0a4f('0x20')]?_[_0x0a4f('0x21')](_0x160f42[_0x0a4f('0x20')],function(_0x2c02e1){return{'model':db[_0x2c02e1[_0x0a4f('0x22')]],'as':_0x2c02e1['as'],'attributes':_0x2c02e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a4f('0x10')](function(_0x904415){logger['info']('ShowSmsQueue',_0x15150e);logger[_0x0a4f('0x14')](_0x0a4f('0x23'),_0x15150e,JSON[_0x0a4f('0x15')](_0x904415));_0x39dc17(_0x904415);})[_0x0a4f('0x19')](function(_0x2ff295){logger[_0x0a4f('0x16')](_0x0a4f('0x23'),_0x2ff295['message'],_0x15150e);_0x4acbe2(_0x40c81a[_0x0a4f('0x16')](0x1f4,_0x2ff295[_0x0a4f('0x18')]));});});}; \ No newline at end of file +var _0x7a8e=['attributes','limit','include','map','model','then','GetSmsQueue','find','ShowSmsQueue','util','moment','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsQueue','findAll','options','where'];(function(_0x208b35,_0x29a837){var _0x4704c3=function(_0x2fbf91){while(--_0x2fbf91){_0x208b35['push'](_0x208b35['shift']());}};_0x4704c3(++_0x29a837);}(_0x7a8e,0xdb));var _0xe7a8=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x7a8e[_0x462999];return _0x4b1366;};'use strict';var _=require('lodash');var util=require(_0xe7a8('0x0'));var moment=require(_0xe7a8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe7a8('0x2'))(_0xe7a8('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe7a8('0x4')][_0xe7a8('0x5')]({'port':0x232a});config['redis']=_[_0xe7a8('0x6')](config[_0xe7a8('0x7')],{'host':_0xe7a8('0x8'),'port':0x18eb});var socket=require(_0xe7a8('0x9'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe7a8('0xa')](socket);function respondWithRpcPromise(_0x1b8af2,_0x45191a,_0x5527e3){return new BPromise(function(_0x5b5531,_0x410653){return client[_0xe7a8('0xb')](_0x1b8af2,_0x5527e3)['then'](function(_0x5ad1d9){logger[_0xe7a8('0xc')](_0xe7a8('0xd'),_0x45191a,_0xe7a8('0xe'));logger[_0xe7a8('0xf')](_0xe7a8('0x10'),_0x45191a,_0xe7a8('0xe'),JSON[_0xe7a8('0x11')](_0x5ad1d9));if(_0x5ad1d9[_0xe7a8('0x12')]){if(_0x5ad1d9[_0xe7a8('0x12')]['code']===0x1f4){logger[_0xe7a8('0x12')](_0xe7a8('0xd'),_0x45191a,_0x5ad1d9[_0xe7a8('0x12')][_0xe7a8('0x13')]);return _0x410653(_0x5ad1d9[_0xe7a8('0x12')]['message']);}logger[_0xe7a8('0x12')](_0xe7a8('0xd'),_0x45191a,_0x5ad1d9[_0xe7a8('0x12')][_0xe7a8('0x13')]);return _0x5b5531(_0x5ad1d9[_0xe7a8('0x12')][_0xe7a8('0x13')]);}else{logger[_0xe7a8('0xc')](_0xe7a8('0xd'),_0x45191a,_0xe7a8('0xe'));_0x5b5531(_0x5ad1d9[_0xe7a8('0x14')][_0xe7a8('0x13')]);}})[_0xe7a8('0x15')](function(_0x2a1a4e){logger[_0xe7a8('0x12')](_0xe7a8('0xd'),_0x45191a,_0x2a1a4e);_0x410653(_0x2a1a4e);});});}exports['GetSmsQueue']=function(_0x34c34f){var _0x483fd5=this;return new Promise(function(_0x4da1a4,_0x1679f6){return db[_0xe7a8('0x16')][_0xe7a8('0x17')]({'raw':_0x34c34f[_0xe7a8('0x18')]?_0x34c34f['options']['raw']===undefined?!![]:![]:!![],'where':_0x34c34f['options']?_0x34c34f[_0xe7a8('0x18')][_0xe7a8('0x19')]||null:null,'attributes':_0x34c34f[_0xe7a8('0x18')]?_0x34c34f[_0xe7a8('0x18')][_0xe7a8('0x1a')]||null:null,'limit':_0x34c34f['options']?_0x34c34f[_0xe7a8('0x18')][_0xe7a8('0x1b')]||null:null,'include':_0x34c34f[_0xe7a8('0x18')]?_0x34c34f[_0xe7a8('0x18')][_0xe7a8('0x1c')]?_[_0xe7a8('0x1d')](_0x34c34f[_0xe7a8('0x18')][_0xe7a8('0x1c')],function(_0x34d74b){return{'model':db[_0x34d74b[_0xe7a8('0x1e')]],'as':_0x34d74b['as'],'attributes':_0x34d74b[_0xe7a8('0x1a')],'include':_0x34d74b[_0xe7a8('0x1c')]?_[_0xe7a8('0x1d')](_0x34d74b['include'],function(_0x13d471){return{'model':db[_0x13d471[_0xe7a8('0x1e')]],'as':_0x13d471['as'],'attributes':_0x13d471[_0xe7a8('0x1a')],'include':_0x13d471[_0xe7a8('0x1c')]?_[_0xe7a8('0x1d')](_0x13d471['include'],function(_0x599103){return{'model':db[_0x599103[_0xe7a8('0x1e')]],'as':_0x599103['as'],'attributes':_0x599103[_0xe7a8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe7a8('0x1f')](function(_0x24eb0a){logger[_0xe7a8('0xc')](_0xe7a8('0x20'),_0x34c34f);logger['debug']('GetSmsQueue',_0x34c34f,JSON[_0xe7a8('0x11')](_0x24eb0a));_0x4da1a4(_0x24eb0a);})['catch'](function(_0x170e00){logger[_0xe7a8('0x12')](_0xe7a8('0x20'),_0x170e00[_0xe7a8('0x13')],_0x34c34f);_0x1679f6(_0x483fd5[_0xe7a8('0x12')](0x1f4,_0x170e00[_0xe7a8('0x13')]));});});};exports['ShowSmsQueue']=function(_0x969364){var _0x497daf=this;return new Promise(function(_0x2f55e2,_0x58e92b){return db[_0xe7a8('0x16')][_0xe7a8('0x21')]({'raw':_0x969364[_0xe7a8('0x18')]?_0x969364[_0xe7a8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x969364[_0xe7a8('0x18')]?_0x969364[_0xe7a8('0x18')][_0xe7a8('0x19')]||null:null,'attributes':_0x969364[_0xe7a8('0x18')]?_0x969364[_0xe7a8('0x18')][_0xe7a8('0x1a')]||null:null,'include':_0x969364['options']?_0x969364[_0xe7a8('0x18')][_0xe7a8('0x1c')]?_['map'](_0x969364[_0xe7a8('0x18')]['include'],function(_0x25650a){return{'model':db[_0x25650a[_0xe7a8('0x1e')]],'as':_0x25650a['as'],'attributes':_0x25650a[_0xe7a8('0x1a')],'include':_0x25650a['include']?_[_0xe7a8('0x1d')](_0x25650a['include'],function(_0x5d8271){return{'model':db[_0x5d8271[_0xe7a8('0x1e')]],'as':_0x5d8271['as'],'attributes':_0x5d8271[_0xe7a8('0x1a')],'include':_0x5d8271['include']?_[_0xe7a8('0x1d')](_0x5d8271['include'],function(_0x7724d3){return{'model':db[_0x7724d3['model']],'as':_0x7724d3['as'],'attributes':_0x7724d3[_0xe7a8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe7a8('0x1f')](function(_0x17a865){logger[_0xe7a8('0xc')](_0xe7a8('0x22'),_0x969364);logger[_0xe7a8('0xf')](_0xe7a8('0x22'),_0x969364,JSON[_0xe7a8('0x11')](_0x17a865));_0x2f55e2(_0x17a865);})['catch'](function(_0x1edc61){logger['error']('ShowSmsQueue',_0x1edc61['message'],_0x969364);_0x58e92b(_0x497daf[_0xe7a8('0x12')](0x1f4,_0x1edc61[_0xe7a8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2118153..0d2f340 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 _0xe972=['remove','update','removeListener','length','smsQueue:','./smsQueue.events'];(function(_0x19a173,_0x413f3a){var _0x197b3c=function(_0x188333){while(--_0x188333){_0x19a173['push'](_0x19a173['shift']());}};_0x197b3c(++_0x413f3a);}(_0xe972,0x125));var _0x2e97=function(_0x5b8881,_0x4932d6){_0x5b8881=_0x5b8881-0x0;var _0x50a07c=_0xe972[_0x5b8881];return _0x50a07c;};'use strict';var SmsQueueEvents=require(_0x2e97('0x0'));var events=['save',_0x2e97('0x1'),_0x2e97('0x2')];function createListener(_0x48a841,_0x52464e){return function(_0x1de887){_0x52464e['emit'](_0x48a841,_0x1de887);};}function removeListener(_0x31e07e,_0x2e258c){return function(){SmsQueueEvents[_0x2e97('0x3')](_0x31e07e,_0x2e258c);};}exports['register']=function(_0xecb2bb){for(var _0x14e2ca=0x0,_0x4876bd=events[_0x2e97('0x4')];_0x14e2ca<_0x4876bd;_0x14e2ca++){var _0xdde3a9=events[_0x14e2ca];var _0x35885e=createListener(_0x2e97('0x5')+_0xdde3a9,_0xecb2bb);SmsQueueEvents['on'](_0xdde3a9,_0x35885e);}}; \ No newline at end of file +var _0x2577=['save','remove','emit','register','length','./smsQueue.events'];(function(_0x1cf575,_0x3e3c18){var _0x1c3975=function(_0x50535f){while(--_0x50535f){_0x1cf575['push'](_0x1cf575['shift']());}};_0x1c3975(++_0x3e3c18);}(_0x2577,0x14f));var _0x7257=function(_0x35c4e8,_0x18ff04){_0x35c4e8=_0x35c4e8-0x0;var _0x4a958a=_0x2577[_0x35c4e8];return _0x4a958a;};'use strict';var SmsQueueEvents=require(_0x7257('0x0'));var events=[_0x7257('0x1'),_0x7257('0x2'),'update'];function createListener(_0x1a655d,_0x1ba48d){return function(_0x1e305b){_0x1ba48d[_0x7257('0x3')](_0x1a655d,_0x1e305b);};}function removeListener(_0x3d4128,_0x3149e2){return function(){SmsQueueEvents['removeListener'](_0x3d4128,_0x3149e2);};}exports[_0x7257('0x4')]=function(_0x1d05ce){for(var _0x11f204=0x0,_0x108607=events[_0x7257('0x5')];_0x11f204<_0x108607;_0x11f204++){var _0x3ddd54=events[_0x11f204];var _0x3faa69=createListener('smsQueue:'+_0x3ddd54,_0x1d05ce);SmsQueueEvents['on'](_0x3ddd54,_0x3faa69);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e1df3d3..135206d 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 _0xe008=['./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x392e68,_0x9f2bfb){var _0x4267df=function(_0x552bea){while(--_0x552bea){_0x392e68['push'](_0x392e68['shift']());}};_0x4267df(++_0x9f2bfb);}(_0xe008,0x14f));var _0x8e00=function(_0x7677c7,_0xefd24d){_0x7677c7=_0x7677c7-0x0;var _0x1d5e43=_0xe008[_0x7677c7];return _0x1d5e43;};'use strict';var multer=require('multer');var util=require(_0x8e00('0x0'));var path=require(_0x8e00('0x1'));var timeout=require(_0x8e00('0x2'));var express=require(_0x8e00('0x3'));var router=express[_0x8e00('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e00('0x5'));var interaction=require(_0x8e00('0x6'));var config=require('../../config/environment');var controller=require(_0x8e00('0x7'));router[_0x8e00('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e00('0x9')]);router[_0x8e00('0x8')](_0x8e00('0xa'),auth[_0x8e00('0xb')](),controller[_0x8e00('0xc')]);router['get'](_0x8e00('0xd'),auth[_0x8e00('0xb')](),controller[_0x8e00('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8e00('0xf')]);router[_0x8e00('0x10')]('/:id',auth[_0x8e00('0xb')](),controller['update']);router[_0x8e00('0x11')]('/:id',auth[_0x8e00('0xb')](),controller[_0x8e00('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3ef1=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','show','post','update','/:id','destroy','exports'];(function(_0x341126,_0x57b123){var _0x3d7d4b=function(_0x1cbcaf){while(--_0x1cbcaf){_0x341126['push'](_0x341126['shift']());}};_0x3d7d4b(++_0x57b123);}(_0x3ef1,0x99));var _0x13ef=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x3ef1[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require(_0x13ef('0x0'));var path=require(_0x13ef('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13ef('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x13ef('0x3'));var interaction=require(_0x13ef('0x4'));var config=require(_0x13ef('0x5'));var controller=require(_0x13ef('0x6'));router[_0x13ef('0x7')]('/',auth[_0x13ef('0x8')](),controller[_0x13ef('0x9')]);router[_0x13ef('0x7')]('/describe',auth[_0x13ef('0x8')](),controller[_0x13ef('0xa')]);router[_0x13ef('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x13ef('0xb')]);router[_0x13ef('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x13ef('0x8')](),controller[_0x13ef('0xd')]);router['delete'](_0x13ef('0xe'),auth[_0x13ef('0x8')](),controller[_0x13ef('0xf')]);module[_0x13ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ddd6f83..5955ec2 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 _0xf625=['DATE','moment','sequelize','exports','STRING'];(function(_0x373ea5,_0x7a2415){var _0x46ba03=function(_0x15696c){while(--_0x15696c){_0x373ea5['push'](_0x373ea5['shift']());}};_0x46ba03(++_0x7a2415);}(_0xf625,0x18c));var _0x5f62=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0xf625[_0x36bfe3];return _0x9b0436;};'use strict';var moment=require(_0x5f62('0x0'));var Sequelize=require(_0x5f62('0x1'));module[_0x5f62('0x2')]={'uniqueid':{'type':Sequelize[_0x5f62('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5f62('0x3')]},'joinAt':{'type':Sequelize[_0x5f62('0x4')]},'leaveAt':{'type':Sequelize[_0x5f62('0x4')]},'acceptAt':{'type':Sequelize[_0x5f62('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5f62('0x3')]}}; \ No newline at end of file +var _0x1f0e=['moment','sequelize','exports','STRING','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f0e,0xaf));var _0xe1f0=function(_0x22443c,_0x539a26){_0x22443c=_0x22443c-0x0;var _0x2ab368=_0x1f0e[_0x22443c];return _0x2ab368;};'use strict';var moment=require(_0xe1f0('0x0'));var Sequelize=require(_0xe1f0('0x1'));module[_0xe1f0('0x2')]={'uniqueid':{'type':Sequelize[_0xe1f0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe1f0('0x3')]},'joinAt':{'type':Sequelize[_0xe1f0('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe1f0('0x4')]},'exitAt':{'type':Sequelize[_0xe1f0('0x4')]},'reason':{'type':Sequelize[_0xe1f0('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index fc23ef2..3fed96a 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 _0xc3c5=['offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','end','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','SmsQueueReport','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0xc3c5,0x176));var _0x5c3c=function(_0x11d638,_0x321394){_0x11d638=_0x11d638-0x0;var _0x152a69=_0xc3c5[_0x11d638];return _0x152a69;};'use strict';var emlformat=require(_0x5c3c('0x0'));var rimraf=require(_0x5c3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c3c('0x2'));var rp=require(_0x5c3c('0x3'));var moment=require(_0x5c3c('0x4'));var BPromise=require(_0x5c3c('0x5'));var Mustache=require(_0x5c3c('0x6'));var util=require(_0x5c3c('0x7'));var path=require(_0x5c3c('0x8'));var sox=require(_0x5c3c('0x9'));var csv=require(_0x5c3c('0xa'));var ejs=require(_0x5c3c('0xb'));var fs=require('fs');var fs_extra=require(_0x5c3c('0xc'));var _=require(_0x5c3c('0xd'));var squel=require(_0x5c3c('0xe'));var crypto=require(_0x5c3c('0xf'));var jsforce=require(_0x5c3c('0x10'));var deskjs=require(_0x5c3c('0x11'));var toCsv=require(_0x5c3c('0xa'));var querystring=require(_0x5c3c('0x12'));var Papa=require('papaparse');var Redis=require(_0x5c3c('0x13'));var authService=require(_0x5c3c('0x14'));var qs=require(_0x5c3c('0x15'));var as=require(_0x5c3c('0x16'));var hardwareService=require(_0x5c3c('0x17'));var logger=require(_0x5c3c('0x18'))(_0x5c3c('0x19'));var utils=require(_0x5c3c('0x1a'));var config=require(_0x5c3c('0x1b'));var licenseUtil=require(_0x5c3c('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53b2ee,_0x50b93d){_0x50b93d=_0x50b93d||0xcc;return function(_0xfe46db){if(_0xfe46db){return _0x53b2ee[_0x5c3c('0x1d')](_0x50b93d);}return _0x53b2ee['status'](_0x50b93d)['end']();};}function respondWithResult(_0x3e327b,_0x2a8ed1){_0x2a8ed1=_0x2a8ed1||0xc8;return function(_0x58047c){if(_0x58047c){return _0x3e327b['status'](_0x2a8ed1)[_0x5c3c('0x1e')](_0x58047c);}};}function respondWithFilteredResult(_0x17dfc3,_0x5b21a8){return function(_0x4e3c79){if(_0x4e3c79){var _0x4013be=typeof _0x5b21a8[_0x5c3c('0x1f')]===_0x5c3c('0x20')&&typeof _0x5b21a8[_0x5c3c('0x21')]===_0x5c3c('0x20');var _0x44f714=_0x4e3c79[_0x5c3c('0x22')];var _0x150efb=_0x4013be?0x0:_0x5b21a8[_0x5c3c('0x1f')];var _0x726e25=_0x4013be?_0x4e3c79[_0x5c3c('0x22')]:_0x5b21a8[_0x5c3c('0x1f')]+_0x5b21a8['limit'];var _0x3d191a;if(_0x726e25>=_0x44f714){_0x726e25=_0x44f714;_0x3d191a=0xc8;}else{_0x3d191a=0xce;}_0x17dfc3[_0x5c3c('0x23')](_0x3d191a);return _0x17dfc3[_0x5c3c('0x24')](_0x5c3c('0x25'),_0x150efb+'-'+_0x726e25+'/'+_0x44f714)[_0x5c3c('0x1e')](_0x4e3c79);}return null;};}function patchUpdates(_0x1e9fce){return function(_0x22595c){try{jsonpatch[_0x5c3c('0x26')](_0x22595c,_0x1e9fce,!![]);}catch(_0x4726b8){return BPromise[_0x5c3c('0x27')](_0x4726b8);}return _0x22595c[_0x5c3c('0x28')]();};}function saveUpdates(_0x4b53bc,_0x59cb57){return function(_0x2ea4bf){if(_0x2ea4bf){return _0x2ea4bf[_0x5c3c('0x29')](_0x4b53bc)['then'](function(_0x2bb6de){return _0x2bb6de;});}return null;};}function removeEntity(_0x473c56,_0x471956){return function(_0xe27ecc){if(_0xe27ecc){return _0xe27ecc[_0x5c3c('0x2a')]()[_0x5c3c('0x2b')](function(){_0x473c56['status'](0xcc)[_0x5c3c('0x2c')]();});}};}function handleEntityNotFound(_0x595c28,_0x1a8aeb){return function(_0x409404){if(!_0x409404){_0x595c28[_0x5c3c('0x1d')](0x194);}return _0x409404;};}function handleError(_0x1958f2,_0x1e447c){_0x1e447c=_0x1e447c||0x1f4;return function(_0x1519b6){logger['error'](_0x1519b6['stack']);if(_0x1519b6[_0x5c3c('0x2d')]){delete _0x1519b6[_0x5c3c('0x2d')];}_0x1958f2[_0x5c3c('0x23')](_0x1e447c)[_0x5c3c('0x2e')](_0x1519b6);};}exports[_0x5c3c('0x2f')]=function(_0x222d75,_0x145791){var _0x3056f3={},_0x87cd32={},_0x1d0862={'count':0x0,'rows':[]};var _0x3e50c0=_[_0x5c3c('0x30')](db['SmsQueueReport'][_0x5c3c('0x31')],function(_0xc66f41){return{'name':_0xc66f41[_0x5c3c('0x32')],'type':_0xc66f41[_0x5c3c('0x33')][_0x5c3c('0x34')]};});_0x87cd32['model']=_[_0x5c3c('0x30')](_0x3e50c0,_0x5c3c('0x2d'));_0x87cd32[_0x5c3c('0x35')]=_[_0x5c3c('0x36')](_0x222d75[_0x5c3c('0x35')]);_0x87cd32[_0x5c3c('0x37')]=_['intersection'](_0x87cd32[_0x5c3c('0x38')],_0x87cd32['query']);_0x3056f3[_0x5c3c('0x39')]=_[_0x5c3c('0x3a')](_0x87cd32[_0x5c3c('0x38')],qs[_0x5c3c('0x3b')](_0x222d75[_0x5c3c('0x35')][_0x5c3c('0x3b')]));_0x3056f3['attributes']=_0x3056f3[_0x5c3c('0x39')]['length']?_0x3056f3['attributes']:_0x87cd32[_0x5c3c('0x38')];if(!_0x222d75[_0x5c3c('0x35')][_0x5c3c('0x3c')]('nolimit')){_0x3056f3[_0x5c3c('0x21')]=qs['limit'](_0x222d75[_0x5c3c('0x35')]['limit']);_0x3056f3[_0x5c3c('0x1f')]=qs[_0x5c3c('0x1f')](_0x222d75[_0x5c3c('0x35')][_0x5c3c('0x1f')]);}_0x3056f3[_0x5c3c('0x3d')]=qs[_0x5c3c('0x3e')](_0x222d75[_0x5c3c('0x35')][_0x5c3c('0x3e')]);_0x3056f3[_0x5c3c('0x3f')]=qs[_0x5c3c('0x37')](_[_0x5c3c('0x40')](_0x222d75[_0x5c3c('0x35')],_0x87cd32[_0x5c3c('0x37')]),_0x3e50c0);if(_0x222d75[_0x5c3c('0x35')][_0x5c3c('0x41')]){_0x3056f3[_0x5c3c('0x3f')]=_[_0x5c3c('0x42')](_0x3056f3['where'],{'$or':_['map'](_0x3e50c0,function(_0x22f595){if(_0x22f595['type']!=='VIRTUAL'){var _0x145f95={};_0x145f95[_0x22f595[_0x5c3c('0x2d')]]={'$like':'%'+_0x222d75[_0x5c3c('0x35')][_0x5c3c('0x41')]+'%'};return _0x145f95;}})});}_0x3056f3=_[_0x5c3c('0x42')]({},_0x3056f3,_0x222d75[_0x5c3c('0x43')]);var _0x13d5c3={'where':_0x3056f3[_0x5c3c('0x3f')]};return db[_0x5c3c('0x44')][_0x5c3c('0x22')](_0x13d5c3)[_0x5c3c('0x2b')](function(_0x1c16f9){_0x1d0862['count']=_0x1c16f9;if(_0x222d75[_0x5c3c('0x35')][_0x5c3c('0x45')]){_0x3056f3['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0x5c3c('0x46')](_0x3056f3);})[_0x5c3c('0x2b')](function(_0x31f2d4){_0x1d0862[_0x5c3c('0x47')]=_0x31f2d4;return _0x1d0862;})[_0x5c3c('0x2b')](respondWithFilteredResult(_0x145791,_0x3056f3))[_0x5c3c('0x48')](handleError(_0x145791,null));};exports[_0x5c3c('0x49')]=function(_0x32861a,_0x47f37a){var _0x130cf6={'raw':!![],'where':{'id':_0x32861a['params']['id']}},_0x31d62c={};_0x31d62c[_0x5c3c('0x38')]=_[_0x5c3c('0x36')](db['SmsQueueReport'][_0x5c3c('0x31')]);_0x31d62c['query']=_[_0x5c3c('0x36')](_0x32861a[_0x5c3c('0x35')]);_0x31d62c[_0x5c3c('0x37')]=_['intersection'](_0x31d62c[_0x5c3c('0x38')],_0x31d62c[_0x5c3c('0x35')]);_0x130cf6[_0x5c3c('0x39')]=_[_0x5c3c('0x3a')](_0x31d62c[_0x5c3c('0x38')],qs[_0x5c3c('0x3b')](_0x32861a['query'][_0x5c3c('0x3b')]));_0x130cf6['attributes']=_0x130cf6[_0x5c3c('0x39')][_0x5c3c('0x4a')]?_0x130cf6[_0x5c3c('0x39')]:_0x31d62c['model'];if(_0x32861a[_0x5c3c('0x35')][_0x5c3c('0x45')]){_0x130cf6[_0x5c3c('0x4b')]=[{'all':!![]}];}_0x130cf6=_[_0x5c3c('0x42')]({},_0x130cf6,_0x32861a[_0x5c3c('0x43')]);return db['SmsQueueReport'][_0x5c3c('0x4c')](_0x130cf6)[_0x5c3c('0x2b')](handleEntityNotFound(_0x47f37a,null))[_0x5c3c('0x2b')](respondWithResult(_0x47f37a,null))['catch'](handleError(_0x47f37a,null));};exports[_0x5c3c('0x4d')]=function(_0x5741dc,_0x58ae5d){return db['SmsQueueReport']['create'](_0x5741dc['body'],{})[_0x5c3c('0x2b')](respondWithResult(_0x58ae5d,0xc9))['catch'](handleError(_0x58ae5d,null));};exports[_0x5c3c('0x29')]=function(_0xc44d70,_0x4d012e){if(_0xc44d70[_0x5c3c('0x4e')]['id']){delete _0xc44d70[_0x5c3c('0x4e')]['id'];}return db[_0x5c3c('0x44')][_0x5c3c('0x4c')]({'where':{'id':_0xc44d70[_0x5c3c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4d012e,null))['then'](saveUpdates(_0xc44d70[_0x5c3c('0x4e')],null))[_0x5c3c('0x2b')](respondWithResult(_0x4d012e,null))[_0x5c3c('0x48')](handleError(_0x4d012e,null));};exports['destroy']=function(_0x50f148,_0x2b5e82){return db[_0x5c3c('0x44')][_0x5c3c('0x4c')]({'where':{'id':_0x50f148['params']['id']}})[_0x5c3c('0x2b')](handleEntityNotFound(_0x2b5e82,null))[_0x5c3c('0x2b')](removeEntity(_0x2b5e82,null))[_0x5c3c('0x48')](handleError(_0x2b5e82,null));};exports[_0x5c3c('0x50')]=function(_0x1436fe,_0x91af6a){return db[_0x5c3c('0x44')]['describe']()[_0x5c3c('0x2b')](respondWithResult(_0x91af6a,null))[_0x5c3c('0x48')](handleError(_0x91af6a,null));}; \ No newline at end of file +var _0xfe36=['create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find'];(function(_0x1dff52,_0x5d1d6a){var _0x442d01=function(_0x351a48){while(--_0x351a48){_0x1dff52['push'](_0x1dff52['shift']());}};_0x442d01(++_0x5d1d6a);}(_0xfe36,0xe2));var _0x6fe3=function(_0x47172e,_0x48119f){_0x47172e=_0x47172e-0x0;var _0x435934=_0xfe36[_0x47172e];return _0x435934;};'use strict';var emlformat=require(_0x6fe3('0x0'));var rimraf=require(_0x6fe3('0x1'));var zipdir=require(_0x6fe3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6fe3('0x3'));var BPromise=require(_0x6fe3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6fe3('0x5'));var csv=require(_0x6fe3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fe3('0x7'));var _=require(_0x6fe3('0x8'));var squel=require(_0x6fe3('0x9'));var crypto=require(_0x6fe3('0xa'));var jsforce=require(_0x6fe3('0xb'));var deskjs=require(_0x6fe3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6fe3('0xd'));var Papa=require(_0x6fe3('0xe'));var Redis=require('ioredis');var authService=require(_0x6fe3('0xf'));var qs=require(_0x6fe3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fe3('0x11'))(_0x6fe3('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6fe3('0x13'));var db=require(_0x6fe3('0x14'))['db'];function respondWithStatusCode(_0x15448d,_0x553d48){_0x553d48=_0x553d48||0xcc;return function(_0x57d288){if(_0x57d288){return _0x15448d[_0x6fe3('0x15')](_0x553d48);}return _0x15448d['status'](_0x553d48)[_0x6fe3('0x16')]();};}function respondWithResult(_0x35ca69,_0x52815b){_0x52815b=_0x52815b||0xc8;return function(_0x537a28){if(_0x537a28){return _0x35ca69['status'](_0x52815b)[_0x6fe3('0x17')](_0x537a28);}};}function respondWithFilteredResult(_0xa1a801,_0xc846aa){return function(_0x4a628b){if(_0x4a628b){var _0x17eed9=typeof _0xc846aa['offset']==='undefined'&&typeof _0xc846aa['limit']==='undefined';var _0xa3ce09=_0x4a628b[_0x6fe3('0x18')];var _0x3c14cf=_0x17eed9?0x0:_0xc846aa[_0x6fe3('0x19')];var _0xe9982=_0x17eed9?_0x4a628b[_0x6fe3('0x18')]:_0xc846aa[_0x6fe3('0x19')]+_0xc846aa[_0x6fe3('0x1a')];var _0x3179e8;if(_0xe9982>=_0xa3ce09){_0xe9982=_0xa3ce09;_0x3179e8=0xc8;}else{_0x3179e8=0xce;}_0xa1a801[_0x6fe3('0x1b')](_0x3179e8);return _0xa1a801[_0x6fe3('0x1c')]('Content-Range',_0x3c14cf+'-'+_0xe9982+'/'+_0xa3ce09)[_0x6fe3('0x17')](_0x4a628b);}return null;};}function patchUpdates(_0x598e8c){return function(_0x5c22c6){try{jsonpatch[_0x6fe3('0x1d')](_0x5c22c6,_0x598e8c,!![]);}catch(_0xd2d8){return BPromise[_0x6fe3('0x1e')](_0xd2d8);}return _0x5c22c6[_0x6fe3('0x1f')]();};}function saveUpdates(_0x570e48,_0x34a25a){return function(_0x4cc2ad){if(_0x4cc2ad){return _0x4cc2ad[_0x6fe3('0x20')](_0x570e48)[_0x6fe3('0x21')](function(_0x4acd0b){return _0x4acd0b;});}return null;};}function removeEntity(_0x302503,_0x339f7d){return function(_0x91d3b8){if(_0x91d3b8){return _0x91d3b8[_0x6fe3('0x22')]()['then'](function(){_0x302503[_0x6fe3('0x1b')](0xcc)[_0x6fe3('0x16')]();});}};}function handleEntityNotFound(_0x319219,_0x4562c6){return function(_0x48a6cd){if(!_0x48a6cd){_0x319219[_0x6fe3('0x15')](0x194);}return _0x48a6cd;};}function handleError(_0x4f8efb,_0x2fbfd4){_0x2fbfd4=_0x2fbfd4||0x1f4;return function(_0x2eb375){logger[_0x6fe3('0x23')](_0x2eb375[_0x6fe3('0x24')]);if(_0x2eb375[_0x6fe3('0x25')]){delete _0x2eb375['name'];}_0x4f8efb[_0x6fe3('0x1b')](_0x2fbfd4)[_0x6fe3('0x26')](_0x2eb375);};}exports[_0x6fe3('0x27')]=function(_0x4343fa,_0x20c944){var _0x9ac06={},_0x4b8464={},_0x16dc3c={'count':0x0,'rows':[]};var _0x59cbbc=_[_0x6fe3('0x28')](db[_0x6fe3('0x29')][_0x6fe3('0x2a')],function(_0x1cbc26){return{'name':_0x1cbc26[_0x6fe3('0x2b')],'type':_0x1cbc26[_0x6fe3('0x2c')][_0x6fe3('0x2d')]};});_0x4b8464[_0x6fe3('0x2e')]=_[_0x6fe3('0x28')](_0x59cbbc,'name');_0x4b8464[_0x6fe3('0x2f')]=_['keys'](_0x4343fa['query']);_0x4b8464['filters']=_[_0x6fe3('0x30')](_0x4b8464[_0x6fe3('0x2e')],_0x4b8464[_0x6fe3('0x2f')]);_0x9ac06[_0x6fe3('0x31')]=_[_0x6fe3('0x30')](_0x4b8464['model'],qs[_0x6fe3('0x32')](_0x4343fa[_0x6fe3('0x2f')][_0x6fe3('0x32')]));_0x9ac06['attributes']=_0x9ac06[_0x6fe3('0x31')][_0x6fe3('0x33')]?_0x9ac06[_0x6fe3('0x31')]:_0x4b8464[_0x6fe3('0x2e')];if(!_0x4343fa['query'][_0x6fe3('0x34')](_0x6fe3('0x35'))){_0x9ac06['limit']=qs[_0x6fe3('0x1a')](_0x4343fa['query'][_0x6fe3('0x1a')]);_0x9ac06[_0x6fe3('0x19')]=qs['offset'](_0x4343fa[_0x6fe3('0x2f')][_0x6fe3('0x19')]);}_0x9ac06[_0x6fe3('0x36')]=qs[_0x6fe3('0x37')](_0x4343fa[_0x6fe3('0x2f')]['sort']);_0x9ac06[_0x6fe3('0x38')]=qs[_0x6fe3('0x39')](_[_0x6fe3('0x3a')](_0x4343fa[_0x6fe3('0x2f')],_0x4b8464[_0x6fe3('0x39')]),_0x59cbbc);if(_0x4343fa[_0x6fe3('0x2f')][_0x6fe3('0x3b')]){_0x9ac06['where']=_[_0x6fe3('0x3c')](_0x9ac06[_0x6fe3('0x38')],{'$or':_[_0x6fe3('0x28')](_0x59cbbc,function(_0x319a2b){if(_0x319a2b[_0x6fe3('0x2c')]!=='VIRTUAL'){var _0x2b3b12={};_0x2b3b12[_0x319a2b[_0x6fe3('0x25')]]={'$like':'%'+_0x4343fa[_0x6fe3('0x2f')]['filter']+'%'};return _0x2b3b12;}})});}_0x9ac06=_['merge']({},_0x9ac06,_0x4343fa[_0x6fe3('0x3d')]);var _0x5a3500={'where':_0x9ac06['where']};return db[_0x6fe3('0x29')][_0x6fe3('0x18')](_0x5a3500)[_0x6fe3('0x21')](function(_0x1a9a4e){_0x16dc3c[_0x6fe3('0x18')]=_0x1a9a4e;if(_0x4343fa[_0x6fe3('0x2f')][_0x6fe3('0x3e')]){_0x9ac06[_0x6fe3('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x6fe3('0x40')](_0x9ac06);})[_0x6fe3('0x21')](function(_0x3066fc){_0x16dc3c[_0x6fe3('0x41')]=_0x3066fc;return _0x16dc3c;})[_0x6fe3('0x21')](respondWithFilteredResult(_0x20c944,_0x9ac06))[_0x6fe3('0x42')](handleError(_0x20c944,null));};exports[_0x6fe3('0x43')]=function(_0x29c28,_0x3d8b38){var _0x49b2b2={'raw':!![],'where':{'id':_0x29c28['params']['id']}},_0x38d649={};_0x38d649[_0x6fe3('0x2e')]=_['keys'](db[_0x6fe3('0x29')][_0x6fe3('0x2a')]);_0x38d649['query']=_[_0x6fe3('0x44')](_0x29c28[_0x6fe3('0x2f')]);_0x38d649[_0x6fe3('0x39')]=_[_0x6fe3('0x30')](_0x38d649['model'],_0x38d649[_0x6fe3('0x2f')]);_0x49b2b2[_0x6fe3('0x31')]=_[_0x6fe3('0x30')](_0x38d649[_0x6fe3('0x2e')],qs['fields'](_0x29c28[_0x6fe3('0x2f')]['fields']));_0x49b2b2[_0x6fe3('0x31')]=_0x49b2b2[_0x6fe3('0x31')][_0x6fe3('0x33')]?_0x49b2b2[_0x6fe3('0x31')]:_0x38d649[_0x6fe3('0x2e')];if(_0x29c28[_0x6fe3('0x2f')][_0x6fe3('0x3e')]){_0x49b2b2[_0x6fe3('0x3f')]=[{'all':!![]}];}_0x49b2b2=_[_0x6fe3('0x3c')]({},_0x49b2b2,_0x29c28['options']);return db[_0x6fe3('0x29')][_0x6fe3('0x45')](_0x49b2b2)[_0x6fe3('0x21')](handleEntityNotFound(_0x3d8b38,null))[_0x6fe3('0x21')](respondWithResult(_0x3d8b38,null))['catch'](handleError(_0x3d8b38,null));};exports[_0x6fe3('0x46')]=function(_0x4c6156,_0xb4ce24){return db['SmsQueueReport']['create'](_0x4c6156['body'],{})[_0x6fe3('0x21')](respondWithResult(_0xb4ce24,0xc9))[_0x6fe3('0x42')](handleError(_0xb4ce24,null));};exports[_0x6fe3('0x20')]=function(_0x27df51,_0x226d4a){if(_0x27df51[_0x6fe3('0x47')]['id']){delete _0x27df51[_0x6fe3('0x47')]['id'];}return db['SmsQueueReport'][_0x6fe3('0x45')]({'where':{'id':_0x27df51[_0x6fe3('0x48')]['id']}})[_0x6fe3('0x21')](handleEntityNotFound(_0x226d4a,null))['then'](saveUpdates(_0x27df51[_0x6fe3('0x47')],null))[_0x6fe3('0x21')](respondWithResult(_0x226d4a,null))[_0x6fe3('0x42')](handleError(_0x226d4a,null));};exports[_0x6fe3('0x22')]=function(_0x5e57ac,_0x3267f6){return db[_0x6fe3('0x29')][_0x6fe3('0x45')]({'where':{'id':_0x5e57ac[_0x6fe3('0x48')]['id']}})['then'](handleEntityNotFound(_0x3267f6,null))[_0x6fe3('0x21')](removeEntity(_0x3267f6,null))[_0x6fe3('0x42')](handleError(_0x3267f6,null));};exports[_0x6fe3('0x49')]=function(_0x14a00a,_0x436cd5){return db[_0x6fe3('0x29')][_0x6fe3('0x49')]()[_0x6fe3('0x21')](respondWithResult(_0x436cd5,null))[_0x6fe3('0x42')](handleError(_0x436cd5,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 616b75b..f1f430f 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x38ee2c,_0x1ffe8b){var _0x3d7c9c=function(_0x437b71){while(--_0x437b71){_0x38ee2c['push'](_0x38ee2c['shift']());}};_0x3d7c9c(++_0x1ffe8b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./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 +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3f6949b..486cb1d 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 _0x3ed2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','update','where','attributes','info','debug','stringify','lodash','util'];(function(_0x10ff8f,_0x22e815){var _0xaa8c14=function(_0x1f21f4){while(--_0x1f21f4){_0x10ff8f['push'](_0x10ff8f['shift']());}};_0xaa8c14(++_0x22e815);}(_0x3ed2,0x15c));var _0x23ed=function(_0x2c87dc,_0x139292){_0x2c87dc=_0x2c87dc-0x0;var _0x2b78ec=_0x3ed2[_0x2c87dc];return _0x2b78ec;};'use strict';var _=require(_0x23ed('0x0'));var util=require(_0x23ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x23ed('0x2'));var fs=require('fs');var Redis=require(_0x23ed('0x3'));var db=require(_0x23ed('0x4'))['db'];var utils=require(_0x23ed('0x5'));var logger=require(_0x23ed('0x6'))(_0x23ed('0x7'));var config=require(_0x23ed('0x8'));var jayson=require(_0x23ed('0x9'));var client=jayson[_0x23ed('0xa')][_0x23ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x329ac8,_0x197df7,_0x42e4a4){return new BPromise(function(_0x168474,_0x43fa71){return client[_0x23ed('0xc')](_0x329ac8,_0x42e4a4)[_0x23ed('0xd')](function(_0x6905dd){logger['info'](_0x23ed('0xe'),_0x197df7,_0x23ed('0xf'));logger['debug'](_0x23ed('0x10'),_0x197df7,_0x23ed('0xf'),JSON['stringify'](_0x6905dd));if(_0x6905dd['error']){if(_0x6905dd['error'][_0x23ed('0x11')]===0x1f4){logger[_0x23ed('0x12')](_0x23ed('0xe'),_0x197df7,_0x6905dd['error'][_0x23ed('0x13')]);return _0x43fa71(_0x6905dd[_0x23ed('0x12')][_0x23ed('0x13')]);}logger[_0x23ed('0x12')](_0x23ed('0xe'),_0x197df7,_0x6905dd[_0x23ed('0x12')][_0x23ed('0x13')]);return _0x168474(_0x6905dd[_0x23ed('0x12')][_0x23ed('0x13')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x197df7,_0x23ed('0xf'));_0x168474(_0x6905dd[_0x23ed('0x14')][_0x23ed('0x13')]);}})[_0x23ed('0x15')](function(_0x2736ed){logger[_0x23ed('0x12')](_0x23ed('0xe'),_0x197df7,_0x2736ed);_0x43fa71(_0x2736ed);});});}exports[_0x23ed('0x16')]=function(_0x2bf00d){var _0x553d18=this;return new Promise(function(_0x204fae,_0x2b537d){return db[_0x23ed('0x17')][_0x23ed('0x18')](_0x2bf00d[_0x23ed('0x19')],{'raw':_0x2bf00d[_0x23ed('0x1a')]?_0x2bf00d['options'][_0x23ed('0x1b')]===undefined?!![]:![]:!![]})[_0x23ed('0xd')](function(_0x3e49fa){logger['info'](_0x23ed('0x16'),_0x2bf00d);logger['debug'](_0x23ed('0x16'),_0x2bf00d,JSON['stringify'](_0x3e49fa));_0x204fae(_0x3e49fa);})['catch'](function(_0x45646f){logger[_0x23ed('0x12')]('CreateSmsQueueReport',_0x45646f['message'],_0x2bf00d);_0x2b537d(_0x553d18[_0x23ed('0x12')](0x1f4,_0x45646f[_0x23ed('0x13')]));});});};exports[_0x23ed('0x1c')]=function(_0x354b9a){var _0x4d866e=this;return new Promise(function(_0x188cd1,_0x305123){return db[_0x23ed('0x17')][_0x23ed('0x1d')](_0x354b9a['body'],{'raw':_0x354b9a[_0x23ed('0x1a')]?_0x354b9a[_0x23ed('0x1a')][_0x23ed('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354b9a[_0x23ed('0x1a')]?_0x354b9a[_0x23ed('0x1a')][_0x23ed('0x1e')]||null:null,'attributes':_0x354b9a['options']?_0x354b9a['options'][_0x23ed('0x1f')]||null:null,'limit':_0x354b9a[_0x23ed('0x1a')]?_0x354b9a[_0x23ed('0x1a')]['limit']||null:null})['then'](function(_0x5caf01){logger[_0x23ed('0x20')](_0x23ed('0x1c'),_0x354b9a);logger[_0x23ed('0x21')]('UpdateSmsQueueReport',_0x354b9a,JSON[_0x23ed('0x22')](_0x5caf01));_0x188cd1(_0x5caf01);})[_0x23ed('0x15')](function(_0x15ac45){logger['error'](_0x23ed('0x1c'),_0x15ac45[_0x23ed('0x13')],_0x354b9a);_0x305123(_0x4d866e['error'](0x1f4,_0x15ac45[_0x23ed('0x13')]));});});}; \ No newline at end of file +var _0xd679=['stringify','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','raw','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','create','body','options'];(function(_0x1d8a04,_0xbbb2b8){var _0x5e6111=function(_0x14a4d8){while(--_0x14a4d8){_0x1d8a04['push'](_0x1d8a04['shift']());}};_0x5e6111(++_0xbbb2b8);}(_0xd679,0x9d));var _0x9d67=function(_0x3cb703,_0x4b931e){_0x3cb703=_0x3cb703-0x0;var _0x454806=_0xd679[_0x3cb703];return _0x454806;};'use strict';var _=require(_0x9d67('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9d67('0x1'));var rs=require(_0x9d67('0x2'));var fs=require('fs');var Redis=require(_0x9d67('0x3'));var db=require(_0x9d67('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d67('0x5'))(_0x9d67('0x6'));var config=require(_0x9d67('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9d67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fdd95,_0x3fe3ae,_0x298950){return new BPromise(function(_0x376d64,_0x161241){return client[_0x9d67('0x9')](_0x2fdd95,_0x298950)[_0x9d67('0xa')](function(_0x32ca47){logger['info'](_0x9d67('0xb'),_0x3fe3ae,_0x9d67('0xc'));logger[_0x9d67('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3fe3ae,_0x9d67('0xc'),JSON['stringify'](_0x32ca47));if(_0x32ca47['error']){if(_0x32ca47[_0x9d67('0xe')][_0x9d67('0xf')]===0x1f4){logger[_0x9d67('0xe')](_0x9d67('0xb'),_0x3fe3ae,_0x32ca47[_0x9d67('0xe')][_0x9d67('0x10')]);return _0x161241(_0x32ca47[_0x9d67('0xe')]['message']);}logger[_0x9d67('0xe')](_0x9d67('0xb'),_0x3fe3ae,_0x32ca47[_0x9d67('0xe')][_0x9d67('0x10')]);return _0x376d64(_0x32ca47['error'][_0x9d67('0x10')]);}else{logger[_0x9d67('0x11')](_0x9d67('0xb'),_0x3fe3ae,_0x9d67('0xc'));_0x376d64(_0x32ca47[_0x9d67('0x12')][_0x9d67('0x10')]);}})[_0x9d67('0x13')](function(_0x312cea){logger['error'](_0x9d67('0xb'),_0x3fe3ae,_0x312cea);_0x161241(_0x312cea);});});}exports['CreateSmsQueueReport']=function(_0x598f54){var _0x2a3f01=this;return new Promise(function(_0xce9b9e,_0x54d926){return db['SmsQueueReport'][_0x9d67('0x14')](_0x598f54[_0x9d67('0x15')],{'raw':_0x598f54['options']?_0x598f54[_0x9d67('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x126bf0){logger[_0x9d67('0x11')]('CreateSmsQueueReport',_0x598f54);logger[_0x9d67('0xd')]('CreateSmsQueueReport',_0x598f54,JSON[_0x9d67('0x17')](_0x126bf0));_0xce9b9e(_0x126bf0);})[_0x9d67('0x13')](function(_0x2f9736){logger[_0x9d67('0xe')](_0x9d67('0x18'),_0x2f9736[_0x9d67('0x10')],_0x598f54);_0x54d926(_0x2a3f01[_0x9d67('0xe')](0x1f4,_0x2f9736['message']));});});};exports[_0x9d67('0x19')]=function(_0x902459){var _0x330c2c=this;return new Promise(function(_0xb147e0,_0x3a2048){return db[_0x9d67('0x1a')]['update'](_0x902459[_0x9d67('0x15')],{'raw':_0x902459[_0x9d67('0x16')]?_0x902459['options'][_0x9d67('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x902459[_0x9d67('0x16')]?_0x902459[_0x9d67('0x16')][_0x9d67('0x1c')]||null:null,'attributes':_0x902459['options']?_0x902459[_0x9d67('0x16')]['attributes']||null:null,'limit':_0x902459['options']?_0x902459[_0x9d67('0x16')][_0x9d67('0x1d')]||null:null})['then'](function(_0x34c270){logger[_0x9d67('0x11')](_0x9d67('0x19'),_0x902459);logger[_0x9d67('0xd')](_0x9d67('0x19'),_0x902459,JSON['stringify'](_0x34c270));_0xb147e0(_0x34c270);})[_0x9d67('0x13')](function(_0x231609){logger[_0x9d67('0xe')](_0x9d67('0x19'),_0x231609['message'],_0x902459);_0x3a2048(_0x330c2c['error'](0x1f4,_0x231609[_0x9d67('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 6f9fa2f..08b8c01 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x422104,_0x5c5f5f){var _0x568fb7=function(_0x4e13f5){while(--_0x4e13f5){_0x422104['push'](_0x422104['shift']());}};_0x568fb7(++_0x5c5f5f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x54985f,_0x424faa){_0x54985f=_0x54985f-0x0;var _0x8fe7e=_0x1cb9[_0x54985f];return _0x8fe7e;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0x50a6=['create','/:id','update','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get','/describe','isAuthenticated','show'];(function(_0x57e107,_0x1555cf){var _0x31d869=function(_0x5a0f0c){while(--_0x5a0f0c){_0x57e107['push'](_0x57e107['shift']());}};_0x31d869(++_0x1555cf);}(_0x50a6,0xa4));var _0x650a=function(_0x56f972,_0x49b459){_0x56f972=_0x56f972-0x0;var _0xf415ef=_0x50a6[_0x56f972];return _0xf415ef;};'use strict';var multer=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x650a('0x2'));var router=express['Router']();var fs_extra=require(_0x650a('0x3'));var auth=require(_0x650a('0x4'));var interaction=require(_0x650a('0x5'));var config=require('../../config/environment');var controller=require(_0x650a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x650a('0x7')]);router[_0x650a('0x8')](_0x650a('0x9'),auth[_0x650a('0xa')](),controller['describe']);router[_0x650a('0x8')]('/:id',auth[_0x650a('0xa')](),controller[_0x650a('0xb')]);router['post']('/',auth[_0x650a('0xa')](),controller[_0x650a('0xc')]);router['put'](_0x650a('0xd'),auth['isAuthenticated'](),controller[_0x650a('0xe')]);router['delete'](_0x650a('0xd'),auth['isAuthenticated'](),controller[_0x650a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2271afe..08dfc05 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x13f7fe,_0x694584){var _0x662449=function(_0x2cf065){while(--_0x2cf065){_0x13f7fe['push'](_0x13f7fe['shift']());}};_0x662449(++_0x694584);}(_0x008c,0x188));var _0xc008=function(_0x232eb7,_0x199b07){_0x232eb7=_0x232eb7-0x0;var _0xd7fb8=_0x008c[_0x232eb7];return _0xd7fb8;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x17ede9,_0x27d731){var _0x35b71d=function(_0x30f681){while(--_0x30f681){_0x17ede9['push'](_0x17ede9['shift']());}};_0x35b71d(++_0x27d731);}(_0x34e8,0x12c));var _0x834e=function(_0x2c0a7a,_0x40ab61){_0x2c0a7a=_0x2c0a7a-0x0;var _0x673914=_0x34e8[_0x2c0a7a];return _0x673914;};'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 0344277..b8ef40a 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 _0xce82=['destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','SmsTransferReport','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','apply','reject','save','update','then'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xce82,0x1cc));var _0x2ce8=function(_0x56d6af,_0x1d689){_0x56d6af=_0x56d6af-0x0;var _0x57d03f=_0xce82[_0x56d6af];return _0x57d03f;};'use strict';var emlformat=require(_0x2ce8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2ce8('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x2ce8('0x2'));var util=require(_0x2ce8('0x3'));var path=require('path');var sox=require(_0x2ce8('0x4'));var csv=require(_0x2ce8('0x5'));var ejs=require(_0x2ce8('0x6'));var fs=require('fs');var fs_extra=require(_0x2ce8('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ce8('0x8'));var jsforce=require(_0x2ce8('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2ce8('0x5'));var querystring=require('querystring');var Papa=require(_0x2ce8('0xa'));var Redis=require('ioredis');var authService=require(_0x2ce8('0xb'));var qs=require(_0x2ce8('0xc'));var as=require(_0x2ce8('0xd'));var hardwareService=require(_0x2ce8('0xe'));var logger=require(_0x2ce8('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x2ce8('0x10'));var licenseUtil=require(_0x2ce8('0x11'));var db=require(_0x2ce8('0x12'))['db'];function respondWithStatusCode(_0x3d0681,_0x43ba19){_0x43ba19=_0x43ba19||0xcc;return function(_0x59edb4){if(_0x59edb4){return _0x3d0681['sendStatus'](_0x43ba19);}return _0x3d0681[_0x2ce8('0x13')](_0x43ba19)['end']();};}function respondWithResult(_0x10382e,_0x3673cf){_0x3673cf=_0x3673cf||0xc8;return function(_0x4c0dcf){if(_0x4c0dcf){return _0x10382e[_0x2ce8('0x13')](_0x3673cf)['json'](_0x4c0dcf);}};}function respondWithFilteredResult(_0x5ad46b,_0x342328){return function(_0xfc1e7b){if(_0xfc1e7b){var _0x395d9d=typeof _0x342328[_0x2ce8('0x14')]===_0x2ce8('0x15')&&typeof _0x342328[_0x2ce8('0x16')]==='undefined';var _0x124e3e=_0xfc1e7b[_0x2ce8('0x17')];var _0x5eff19=_0x395d9d?0x0:_0x342328['offset'];var _0x59b7a9=_0x395d9d?_0xfc1e7b[_0x2ce8('0x17')]:_0x342328['offset']+_0x342328[_0x2ce8('0x16')];var _0x5dfcb5;if(_0x59b7a9>=_0x124e3e){_0x59b7a9=_0x124e3e;_0x5dfcb5=0xc8;}else{_0x5dfcb5=0xce;}_0x5ad46b[_0x2ce8('0x13')](_0x5dfcb5);return _0x5ad46b[_0x2ce8('0x18')]('Content-Range',_0x5eff19+'-'+_0x59b7a9+'/'+_0x124e3e)['json'](_0xfc1e7b);}return null;};}function patchUpdates(_0xb8ed7e){return function(_0x9c53c7){try{jsonpatch[_0x2ce8('0x19')](_0x9c53c7,_0xb8ed7e,!![]);}catch(_0x38de52){return BPromise[_0x2ce8('0x1a')](_0x38de52);}return _0x9c53c7[_0x2ce8('0x1b')]();};}function saveUpdates(_0x44cb9f,_0x5d3f94){return function(_0x12acc0){if(_0x12acc0){return _0x12acc0[_0x2ce8('0x1c')](_0x44cb9f)[_0x2ce8('0x1d')](function(_0x4b04ce){return _0x4b04ce;});}return null;};}function removeEntity(_0xa170b,_0x46209f){return function(_0x4da3cc){if(_0x4da3cc){return _0x4da3cc[_0x2ce8('0x1e')]()[_0x2ce8('0x1d')](function(){_0xa170b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e399,_0x23acbf){return function(_0x4296c4){if(!_0x4296c4){_0x38e399[_0x2ce8('0x1f')](0x194);}return _0x4296c4;};}function handleError(_0xc2cbd5,_0x11c188){_0x11c188=_0x11c188||0x1f4;return function(_0x29abf6){logger[_0x2ce8('0x20')](_0x29abf6[_0x2ce8('0x21')]);if(_0x29abf6[_0x2ce8('0x22')]){delete _0x29abf6[_0x2ce8('0x22')];}_0xc2cbd5[_0x2ce8('0x13')](_0x11c188)[_0x2ce8('0x23')](_0x29abf6);};}exports['index']=function(_0x13587c,_0x151caa){var _0x25b877={},_0xd406b2={},_0x3ec891={'count':0x0,'rows':[]};var _0xc98cf0=_[_0x2ce8('0x24')](db['SmsTransferReport'][_0x2ce8('0x25')],function(_0x1d2eca){return{'name':_0x1d2eca[_0x2ce8('0x26')],'type':_0x1d2eca[_0x2ce8('0x27')][_0x2ce8('0x28')]};});_0xd406b2['model']=_[_0x2ce8('0x24')](_0xc98cf0,_0x2ce8('0x22'));_0xd406b2[_0x2ce8('0x29')]=_[_0x2ce8('0x2a')](_0x13587c['query']);_0xd406b2[_0x2ce8('0x2b')]=_['intersection'](_0xd406b2[_0x2ce8('0x2c')],_0xd406b2[_0x2ce8('0x29')]);_0x25b877[_0x2ce8('0x2d')]=_[_0x2ce8('0x2e')](_0xd406b2[_0x2ce8('0x2c')],qs[_0x2ce8('0x2f')](_0x13587c[_0x2ce8('0x29')]['fields']));_0x25b877[_0x2ce8('0x2d')]=_0x25b877[_0x2ce8('0x2d')][_0x2ce8('0x30')]?_0x25b877[_0x2ce8('0x2d')]:_0xd406b2[_0x2ce8('0x2c')];if(!_0x13587c[_0x2ce8('0x29')]['hasOwnProperty'](_0x2ce8('0x31'))){_0x25b877[_0x2ce8('0x16')]=qs[_0x2ce8('0x16')](_0x13587c[_0x2ce8('0x29')][_0x2ce8('0x16')]);_0x25b877[_0x2ce8('0x14')]=qs['offset'](_0x13587c[_0x2ce8('0x29')][_0x2ce8('0x14')]);}_0x25b877[_0x2ce8('0x32')]=qs[_0x2ce8('0x33')](_0x13587c[_0x2ce8('0x29')][_0x2ce8('0x33')]);_0x25b877[_0x2ce8('0x34')]=qs[_0x2ce8('0x2b')](_[_0x2ce8('0x35')](_0x13587c['query'],_0xd406b2[_0x2ce8('0x2b')]),_0xc98cf0);if(_0x13587c[_0x2ce8('0x29')][_0x2ce8('0x36')]){_0x25b877[_0x2ce8('0x34')]=_['merge'](_0x25b877[_0x2ce8('0x34')],{'$or':_[_0x2ce8('0x24')](_0xc98cf0,function(_0x9fb1a6){if(_0x9fb1a6[_0x2ce8('0x27')]!==_0x2ce8('0x37')){var _0x3c1c6a={};_0x3c1c6a[_0x9fb1a6['name']]={'$like':'%'+_0x13587c[_0x2ce8('0x29')][_0x2ce8('0x36')]+'%'};return _0x3c1c6a;}})});}_0x25b877=_[_0x2ce8('0x38')]({},_0x25b877,_0x13587c[_0x2ce8('0x39')]);var _0x1e7f52={'where':_0x25b877[_0x2ce8('0x34')]};return db['SmsTransferReport'][_0x2ce8('0x17')](_0x1e7f52)[_0x2ce8('0x1d')](function(_0x55f0f6){_0x3ec891[_0x2ce8('0x17')]=_0x55f0f6;if(_0x13587c[_0x2ce8('0x29')]['includeAll']){_0x25b877[_0x2ce8('0x3a')]=[{'all':!![]}];}return db[_0x2ce8('0x3b')][_0x2ce8('0x3c')](_0x25b877);})[_0x2ce8('0x1d')](function(_0x37af60){_0x3ec891[_0x2ce8('0x3d')]=_0x37af60;return _0x3ec891;})['then'](respondWithFilteredResult(_0x151caa,_0x25b877))[_0x2ce8('0x3e')](handleError(_0x151caa,null));};exports[_0x2ce8('0x3f')]=function(_0x591b75,_0x417cdf){var _0x2efa08={'raw':!![],'where':{'id':_0x591b75['params']['id']}},_0x43df87={};_0x43df87[_0x2ce8('0x2c')]=_['keys'](db[_0x2ce8('0x3b')][_0x2ce8('0x25')]);_0x43df87[_0x2ce8('0x29')]=_['keys'](_0x591b75['query']);_0x43df87[_0x2ce8('0x2b')]=_[_0x2ce8('0x2e')](_0x43df87[_0x2ce8('0x2c')],_0x43df87['query']);_0x2efa08[_0x2ce8('0x2d')]=_[_0x2ce8('0x2e')](_0x43df87[_0x2ce8('0x2c')],qs[_0x2ce8('0x2f')](_0x591b75[_0x2ce8('0x29')][_0x2ce8('0x2f')]));_0x2efa08[_0x2ce8('0x2d')]=_0x2efa08[_0x2ce8('0x2d')]['length']?_0x2efa08[_0x2ce8('0x2d')]:_0x43df87[_0x2ce8('0x2c')];if(_0x591b75[_0x2ce8('0x29')][_0x2ce8('0x40')]){_0x2efa08['include']=[{'all':!![]}];}_0x2efa08=_[_0x2ce8('0x38')]({},_0x2efa08,_0x591b75['options']);return db[_0x2ce8('0x3b')][_0x2ce8('0x41')](_0x2efa08)['then'](handleEntityNotFound(_0x417cdf,null))[_0x2ce8('0x1d')](respondWithResult(_0x417cdf,null))[_0x2ce8('0x3e')](handleError(_0x417cdf,null));};exports[_0x2ce8('0x42')]=function(_0x2edc4c,_0xc3cf22){return db[_0x2ce8('0x3b')][_0x2ce8('0x42')](_0x2edc4c[_0x2ce8('0x43')],{})['then'](respondWithResult(_0xc3cf22,0xc9))[_0x2ce8('0x3e')](handleError(_0xc3cf22,null));};exports[_0x2ce8('0x1c')]=function(_0xcc63c,_0x4c055c){if(_0xcc63c[_0x2ce8('0x43')]['id']){delete _0xcc63c[_0x2ce8('0x43')]['id'];}return db[_0x2ce8('0x3b')][_0x2ce8('0x41')]({'where':{'id':_0xcc63c[_0x2ce8('0x44')]['id']}})[_0x2ce8('0x1d')](handleEntityNotFound(_0x4c055c,null))[_0x2ce8('0x1d')](saveUpdates(_0xcc63c[_0x2ce8('0x43')],null))['then'](respondWithResult(_0x4c055c,null))[_0x2ce8('0x3e')](handleError(_0x4c055c,null));};exports['destroy']=function(_0x5e65b7,_0x4ed5bc){return db[_0x2ce8('0x3b')]['find']({'where':{'id':_0x5e65b7[_0x2ce8('0x44')]['id']}})[_0x2ce8('0x1d')](handleEntityNotFound(_0x4ed5bc,null))['then'](removeEntity(_0x4ed5bc,null))[_0x2ce8('0x3e')](handleError(_0x4ed5bc,null));};exports[_0x2ce8('0x45')]=function(_0x554d71,_0x331383){return db['SmsTransferReport'][_0x2ce8('0x45')]()[_0x2ce8('0x1d')](respondWithResult(_0x331383,null))[_0x2ce8('0x3e')](handleError(_0x331383,null));}; \ No newline at end of file +var _0x03fa=['send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','SmsTransferReport','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name'];(function(_0x50e975,_0x502e61){var _0x1f2014=function(_0x94367c){while(--_0x94367c){_0x50e975['push'](_0x50e975['shift']());}};_0x1f2014(++_0x502e61);}(_0x03fa,0xfe));var _0xa03f=function(_0x3acd09,_0x5f3f91){_0x3acd09=_0x3acd09-0x0;var _0x399aef=_0x03fa[_0x3acd09];return _0x399aef;};'use strict';var emlformat=require(_0xa03f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa03f('0x1'));var jsonpatch=require(_0xa03f('0x2'));var rp=require(_0xa03f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa03f('0x4'));var path=require(_0xa03f('0x5'));var sox=require('sox');var csv=require(_0xa03f('0x6'));var ejs=require(_0xa03f('0x7'));var fs=require('fs');var fs_extra=require(_0xa03f('0x8'));var _=require('lodash');var squel=require(_0xa03f('0x9'));var crypto=require(_0xa03f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa03f('0xb'));var toCsv=require(_0xa03f('0x6'));var querystring=require(_0xa03f('0xc'));var Papa=require(_0xa03f('0xd'));var Redis=require(_0xa03f('0xe'));var authService=require(_0xa03f('0xf'));var qs=require(_0xa03f('0x10'));var as=require(_0xa03f('0x11'));var hardwareService=require(_0xa03f('0x12'));var logger=require(_0xa03f('0x13'))(_0xa03f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa03f('0x15'));var db=require(_0xa03f('0x16'))['db'];function respondWithStatusCode(_0x312d0e,_0x23c451){_0x23c451=_0x23c451||0xcc;return function(_0x2274c0){if(_0x2274c0){return _0x312d0e[_0xa03f('0x17')](_0x23c451);}return _0x312d0e[_0xa03f('0x18')](_0x23c451)[_0xa03f('0x19')]();};}function respondWithResult(_0xc1586,_0x1a6f0a){_0x1a6f0a=_0x1a6f0a||0xc8;return function(_0x4da84c){if(_0x4da84c){return _0xc1586[_0xa03f('0x18')](_0x1a6f0a)['json'](_0x4da84c);}};}function respondWithFilteredResult(_0x2a1b83,_0x4307e2){return function(_0x68049f){if(_0x68049f){var _0x42142b=typeof _0x4307e2[_0xa03f('0x1a')]===_0xa03f('0x1b')&&typeof _0x4307e2[_0xa03f('0x1c')]==='undefined';var _0x39c69f=_0x68049f[_0xa03f('0x1d')];var _0x3d89db=_0x42142b?0x0:_0x4307e2['offset'];var _0x231f02=_0x42142b?_0x68049f['count']:_0x4307e2['offset']+_0x4307e2[_0xa03f('0x1c')];var _0x6095c4;if(_0x231f02>=_0x39c69f){_0x231f02=_0x39c69f;_0x6095c4=0xc8;}else{_0x6095c4=0xce;}_0x2a1b83['status'](_0x6095c4);return _0x2a1b83['set'](_0xa03f('0x1e'),_0x3d89db+'-'+_0x231f02+'/'+_0x39c69f)['json'](_0x68049f);}return null;};}function patchUpdates(_0x53f5f3){return function(_0x41a4d5){try{jsonpatch['apply'](_0x41a4d5,_0x53f5f3,!![]);}catch(_0x56af25){return BPromise['reject'](_0x56af25);}return _0x41a4d5[_0xa03f('0x1f')]();};}function saveUpdates(_0x24a029,_0x2de3d1){return function(_0x58b171){if(_0x58b171){return _0x58b171[_0xa03f('0x20')](_0x24a029)[_0xa03f('0x21')](function(_0x2e4b39){return _0x2e4b39;});}return null;};}function removeEntity(_0x12dd07,_0xa1d7b5){return function(_0x169838){if(_0x169838){return _0x169838[_0xa03f('0x22')]()[_0xa03f('0x21')](function(){_0x12dd07[_0xa03f('0x18')](0xcc)[_0xa03f('0x19')]();});}};}function handleEntityNotFound(_0x493ee1,_0xa05c96){return function(_0xfeec58){if(!_0xfeec58){_0x493ee1[_0xa03f('0x17')](0x194);}return _0xfeec58;};}function handleError(_0x46110e,_0x5011bf){_0x5011bf=_0x5011bf||0x1f4;return function(_0x197490){logger[_0xa03f('0x23')](_0x197490[_0xa03f('0x24')]);if(_0x197490[_0xa03f('0x25')]){delete _0x197490[_0xa03f('0x25')];}_0x46110e[_0xa03f('0x18')](_0x5011bf)[_0xa03f('0x26')](_0x197490);};}exports[_0xa03f('0x27')]=function(_0x6d6d6,_0x1704ec){var _0x3e0fe5={},_0x4fc68b={},_0x348aeb={'count':0x0,'rows':[]};var _0x348cd7=_[_0xa03f('0x28')](db['SmsTransferReport'][_0xa03f('0x29')],function(_0x46126e){return{'name':_0x46126e[_0xa03f('0x2a')],'type':_0x46126e[_0xa03f('0x2b')][_0xa03f('0x2c')]};});_0x4fc68b[_0xa03f('0x2d')]=_[_0xa03f('0x28')](_0x348cd7,_0xa03f('0x25'));_0x4fc68b[_0xa03f('0x2e')]=_['keys'](_0x6d6d6[_0xa03f('0x2e')]);_0x4fc68b['filters']=_[_0xa03f('0x2f')](_0x4fc68b[_0xa03f('0x2d')],_0x4fc68b['query']);_0x3e0fe5[_0xa03f('0x30')]=_[_0xa03f('0x2f')](_0x4fc68b['model'],qs[_0xa03f('0x31')](_0x6d6d6[_0xa03f('0x2e')]['fields']));_0x3e0fe5[_0xa03f('0x30')]=_0x3e0fe5['attributes'][_0xa03f('0x32')]?_0x3e0fe5[_0xa03f('0x30')]:_0x4fc68b['model'];if(!_0x6d6d6[_0xa03f('0x2e')][_0xa03f('0x33')](_0xa03f('0x34'))){_0x3e0fe5['limit']=qs[_0xa03f('0x1c')](_0x6d6d6[_0xa03f('0x2e')][_0xa03f('0x1c')]);_0x3e0fe5[_0xa03f('0x1a')]=qs[_0xa03f('0x1a')](_0x6d6d6[_0xa03f('0x2e')]['offset']);}_0x3e0fe5['order']=qs[_0xa03f('0x35')](_0x6d6d6[_0xa03f('0x2e')]['sort']);_0x3e0fe5[_0xa03f('0x36')]=qs[_0xa03f('0x37')](_[_0xa03f('0x38')](_0x6d6d6[_0xa03f('0x2e')],_0x4fc68b[_0xa03f('0x37')]),_0x348cd7);if(_0x6d6d6[_0xa03f('0x2e')][_0xa03f('0x39')]){_0x3e0fe5[_0xa03f('0x36')]=_['merge'](_0x3e0fe5[_0xa03f('0x36')],{'$or':_[_0xa03f('0x28')](_0x348cd7,function(_0x313046){if(_0x313046[_0xa03f('0x2b')]!==_0xa03f('0x3a')){var _0x34e07b={};_0x34e07b[_0x313046[_0xa03f('0x25')]]={'$like':'%'+_0x6d6d6['query']['filter']+'%'};return _0x34e07b;}})});}_0x3e0fe5=_[_0xa03f('0x3b')]({},_0x3e0fe5,_0x6d6d6['options']);var _0x26b48f={'where':_0x3e0fe5[_0xa03f('0x36')]};return db[_0xa03f('0x3c')][_0xa03f('0x1d')](_0x26b48f)[_0xa03f('0x21')](function(_0x209320){_0x348aeb[_0xa03f('0x1d')]=_0x209320;if(_0x6d6d6[_0xa03f('0x2e')]['includeAll']){_0x3e0fe5[_0xa03f('0x3d')]=[{'all':!![]}];}return db[_0xa03f('0x3c')][_0xa03f('0x3e')](_0x3e0fe5);})[_0xa03f('0x21')](function(_0x5614f3){_0x348aeb[_0xa03f('0x3f')]=_0x5614f3;return _0x348aeb;})[_0xa03f('0x21')](respondWithFilteredResult(_0x1704ec,_0x3e0fe5))[_0xa03f('0x40')](handleError(_0x1704ec,null));};exports[_0xa03f('0x41')]=function(_0x26dab2,_0x183afe){var _0x41048c={'raw':!![],'where':{'id':_0x26dab2[_0xa03f('0x42')]['id']}},_0x972e59={};_0x972e59[_0xa03f('0x2d')]=_[_0xa03f('0x43')](db[_0xa03f('0x3c')][_0xa03f('0x29')]);_0x972e59[_0xa03f('0x2e')]=_[_0xa03f('0x43')](_0x26dab2[_0xa03f('0x2e')]);_0x972e59['filters']=_[_0xa03f('0x2f')](_0x972e59[_0xa03f('0x2d')],_0x972e59['query']);_0x41048c[_0xa03f('0x30')]=_[_0xa03f('0x2f')](_0x972e59[_0xa03f('0x2d')],qs[_0xa03f('0x31')](_0x26dab2['query']['fields']));_0x41048c[_0xa03f('0x30')]=_0x41048c[_0xa03f('0x30')][_0xa03f('0x32')]?_0x41048c[_0xa03f('0x30')]:_0x972e59[_0xa03f('0x2d')];if(_0x26dab2[_0xa03f('0x2e')][_0xa03f('0x44')]){_0x41048c[_0xa03f('0x3d')]=[{'all':!![]}];}_0x41048c=_[_0xa03f('0x3b')]({},_0x41048c,_0x26dab2['options']);return db[_0xa03f('0x3c')][_0xa03f('0x45')](_0x41048c)['then'](handleEntityNotFound(_0x183afe,null))[_0xa03f('0x21')](respondWithResult(_0x183afe,null))['catch'](handleError(_0x183afe,null));};exports[_0xa03f('0x46')]=function(_0x505212,_0x27cf80){return db[_0xa03f('0x3c')]['create'](_0x505212['body'],{})[_0xa03f('0x21')](respondWithResult(_0x27cf80,0xc9))[_0xa03f('0x40')](handleError(_0x27cf80,null));};exports[_0xa03f('0x20')]=function(_0x3791b8,_0x49a329){if(_0x3791b8[_0xa03f('0x47')]['id']){delete _0x3791b8['body']['id'];}return db[_0xa03f('0x3c')][_0xa03f('0x45')]({'where':{'id':_0x3791b8[_0xa03f('0x42')]['id']}})[_0xa03f('0x21')](handleEntityNotFound(_0x49a329,null))['then'](saveUpdates(_0x3791b8[_0xa03f('0x47')],null))[_0xa03f('0x21')](respondWithResult(_0x49a329,null))[_0xa03f('0x40')](handleError(_0x49a329,null));};exports[_0xa03f('0x22')]=function(_0x341aee,_0xfd9423){return db['SmsTransferReport'][_0xa03f('0x45')]({'where':{'id':_0x341aee[_0xa03f('0x42')]['id']}})['then'](handleEntityNotFound(_0xfd9423,null))[_0xa03f('0x21')](removeEntity(_0xfd9423,null))[_0xa03f('0x40')](handleError(_0xfd9423,null));};exports[_0xa03f('0x48')]=function(_0x39e938,_0x2d2390){return db['SmsTransferReport']['describe']()[_0xa03f('0x21')](respondWithResult(_0x2d2390,null))[_0xa03f('0x40')](handleError(_0x2d2390,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 511b61e..93c67e3 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 _0x4119=['define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsTransferReport.attributes','exports'];(function(_0x8e2397,_0x3cbb39){var _0x376ee0=function(_0x2b5117){while(--_0x2b5117){_0x8e2397['push'](_0x8e2397['shift']());}};_0x376ee0(++_0x3cbb39);}(_0x4119,0xfa));var _0x9411=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x4119[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x9411('0x0'));var util=require(_0x9411('0x1'));var logger=require(_0x9411('0x2'))(_0x9411('0x3'));var moment=require(_0x9411('0x4'));var BPromise=require(_0x9411('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9411('0x6'));var rimraf=require(_0x9411('0x7'));var config=require('../../config/environment');var attributes=require(_0x9411('0x8'));module[_0x9411('0x9')]=function(_0x2283c8,_0x1bd226){return _0x2283c8[_0x9411('0xa')](_0x9411('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x9411('0xc'),'fields':[_0x9411('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f93=['exports','define','SmsTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x3778cf,_0x155c2e){var _0x567e19=function(_0x7655b3){while(--_0x7655b3){_0x3778cf['push'](_0x3778cf['shift']());}};_0x567e19(++_0x155c2e);}(_0x0f93,0x66));var _0x30f9=function(_0x37d6dd,_0x5390ba){_0x37d6dd=_0x37d6dd-0x0;var _0x4bfc5f=_0x0f93[_0x37d6dd];return _0x4bfc5f;};'use strict';var _=require('lodash');var util=require(_0x30f9('0x0'));var logger=require(_0x30f9('0x1'))(_0x30f9('0x2'));var moment=require(_0x30f9('0x3'));var BPromise=require(_0x30f9('0x4'));var rp=require(_0x30f9('0x5'));var fs=require('fs');var path=require(_0x30f9('0x6'));var rimraf=require(_0x30f9('0x7'));var config=require(_0x30f9('0x8'));var attributes=require(_0x30f9('0x9'));module[_0x30f9('0xa')]=function(_0x4d6276,_0xaad949){return _0x4d6276[_0x30f9('0xb')](_0x30f9('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x30f9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a15c8d2..25bb8e6 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 _0xf1e1=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b44ec,_0x1f9dfa){var _0x3e6f28=function(_0x2cc4f7){while(--_0x2cc4f7){_0x1b44ec['push'](_0x1b44ec['shift']());}};_0x3e6f28(++_0x1f9dfa);}(_0xf1e1,0x102));var _0x1f1e=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0xf1e1[_0x96b6a];return _0x3e16f3;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var moment=require(_0x1f1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f1e('0x3'))['db'];var utils=require(_0x1f1e('0x4'));var logger=require(_0x1f1e('0x5'))(_0x1f1e('0x6'));var config=require(_0x1f1e('0x7'));var jayson=require(_0x1f1e('0x8'));var client=jayson[_0x1f1e('0x9')][_0x1f1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db643,_0x38585e,_0x46e32b){return new BPromise(function(_0x3699d2,_0x6ab45b){return client[_0x1f1e('0xb')](_0x1db643,_0x46e32b)['then'](function(_0x44e626){logger[_0x1f1e('0xc')](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));logger[_0x1f1e('0xf')](_0x1f1e('0x10'),_0x38585e,_0x1f1e('0xe'),JSON[_0x1f1e('0x11')](_0x44e626));if(_0x44e626[_0x1f1e('0x12')]){if(_0x44e626['error'][_0x1f1e('0x13')]===0x1f4){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);return _0x6ab45b(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}logger['error'](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')]['message']);return _0x3699d2(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}else{logger['info'](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));_0x3699d2(_0x44e626[_0x1f1e('0x15')][_0x1f1e('0x14')]);}})[_0x1f1e('0x16')](function(_0x3f978f){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x3f978f);_0x6ab45b(_0x3f978f);});});} \ No newline at end of file +var _0x6fc4=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x5a5675,_0x1ffcdb){_0x5a5675=_0x5a5675-0x0;var _0x5c2444=_0x6fc4[_0x5a5675];return _0x5c2444;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x46fc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46fc('0x3'))(_0x46fc('0x4'));var config=require(_0x46fc('0x5'));var jayson=require(_0x46fc('0x6'));var client=jayson[_0x46fc('0x7')][_0x46fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c4f75,_0x3951e9,_0x5ca981){return new BPromise(function(_0x4a7762,_0x149bf8){return client[_0x46fc('0x9')](_0x3c4f75,_0x5ca981)[_0x46fc('0xa')](function(_0x4594c1){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3951e9,_0x46fc('0xb'));logger[_0x46fc('0xc')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3951e9,_0x46fc('0xb'),JSON['stringify'](_0x4594c1));if(_0x4594c1[_0x46fc('0xd')]){if(_0x4594c1[_0x46fc('0xd')][_0x46fc('0xe')]===0x1f4){logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);return _0x149bf8(_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);}logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);return _0x4a7762(_0x4594c1[_0x46fc('0xd')][_0x46fc('0x10')]);}else{logger[_0x46fc('0x11')](_0x46fc('0xf'),_0x3951e9,_0x46fc('0xb'));_0x4a7762(_0x4594c1['result'][_0x46fc('0x10')]);}})[_0x46fc('0x12')](function(_0x1df938){logger[_0x46fc('0xd')](_0x46fc('0xf'),_0x3951e9,_0x1df938);_0x149bf8(_0x1df938);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 847e7aa..a0a8ff5 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 _0xfe01=['put','update','/:id','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','isAuthenticated','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','post','single','create'];(function(_0x260fab,_0x32d487){var _0x26d0e9=function(_0x15290e){while(--_0x15290e){_0x260fab['push'](_0x260fab['shift']());}};_0x26d0e9(++_0x32d487);}(_0xfe01,0x125));var _0x1fe0=function(_0x5c257e,_0x17e018){_0x5c257e=_0x5c257e-0x0;var _0x20cbd5=_0xfe01[_0x5c257e];return _0x20cbd5;};'use strict';var multer=require(_0x1fe0('0x0'));var util=require('util');var path=require(_0x1fe0('0x1'));var timeout=require(_0x1fe0('0x2'));var express=require(_0x1fe0('0x3'));var router=express[_0x1fe0('0x4')]();var fs_extra=require(_0x1fe0('0x5'));var auth=require(_0x1fe0('0x6'));var interaction=require(_0x1fe0('0x7'));var config=require(_0x1fe0('0x8'));var controller=require(_0x1fe0('0x9'));router[_0x1fe0('0xa')]('/',auth['isAuthenticated'](),controller[_0x1fe0('0xb')]);router['get']('/:id',auth[_0x1fe0('0xc')](),controller['show']);router[_0x1fe0('0xa')](_0x1fe0('0xd'),auth[_0x1fe0('0xc')](),controller[_0x1fe0('0xe')]);var upload=multer({'storage':multer[_0x1fe0('0xf')]({'destination':function(_0x58aeb9,_0x14eaf5,_0x56fd4e){_0x56fd4e(null,path['join'](config[_0x1fe0('0x10')],_0x1fe0('0x11')));},'filename':function(_0x31038e,_0x218669,_0x41098e){_0x218669[_0x1fe0('0x12')]=_0x218669[_0x1fe0('0x12')][_0x1fe0('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41098e(null,util['format'](_0x1fe0('0x14'),path[_0x1fe0('0x15')](_0x218669[_0x1fe0('0x12')],path['extname'](_0x218669['originalname'])),Date[_0x1fe0('0x16')](),path[_0x1fe0('0x17')](_0x218669[_0x1fe0('0x12')])));}})});router[_0x1fe0('0x18')]('/',upload[_0x1fe0('0x19')]('file'),controller[_0x1fe0('0x1a')]);router[_0x1fe0('0x1b')]('/:id',auth[_0x1fe0('0xc')](),controller[_0x1fe0('0x1c')]);router['delete'](_0x1fe0('0x1d'),auth[_0x1fe0('0xc')](),controller[_0x1fe0('0x1e')]);module[_0x1fe0('0x1f')]=router; \ No newline at end of file +var _0xee8e=['multer','path','connect-timeout','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','index','get','show','diskStorage','join','root','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create','put','/:id','update','delete','exports'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0xee8e,0x150));var _0xeee8=function(_0x399c0c,_0x44b8e2){_0x399c0c=_0x399c0c-0x0;var _0x491d0a=_0xee8e[_0x399c0c];return _0x491d0a;};'use strict';var multer=require(_0xeee8('0x0'));var util=require('util');var path=require(_0xeee8('0x1'));var timeout=require(_0xeee8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeee8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xeee8('0x4'));var controller=require(_0xeee8('0x5'));router['get']('/',auth[_0xeee8('0x6')](),controller[_0xeee8('0x7')]);router[_0xeee8('0x8')]('/:id',auth[_0xeee8('0x6')](),controller[_0xeee8('0x9')]);router[_0xeee8('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xeee8('0xa')]({'destination':function(_0x5ab8c3,_0x53512f,_0x344e61){_0x344e61(null,path[_0xeee8('0xb')](config[_0xeee8('0xc')],'server/files/sounds/original/'));},'filename':function(_0x3e231a,_0x47b86c,_0x522efa){_0x47b86c[_0xeee8('0xd')]=_0x47b86c['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x522efa(null,util[_0xeee8('0xe')](_0xeee8('0xf'),path[_0xeee8('0x10')](_0x47b86c[_0xeee8('0xd')],path[_0xeee8('0x11')](_0x47b86c[_0xeee8('0xd')])),Date[_0xeee8('0x12')](),path[_0xeee8('0x11')](_0x47b86c[_0xeee8('0xd')])));}})});router[_0xeee8('0x13')]('/',upload[_0xeee8('0x14')](_0xeee8('0x15')),controller[_0xeee8('0x16')]);router[_0xeee8('0x17')](_0xeee8('0x18'),auth[_0xeee8('0x6')](),controller[_0xeee8('0x19')]);router[_0xeee8('0x1a')](_0xeee8('0x18'),auth[_0xeee8('0x6')](),controller[_0xeee8('0x1a')]);module[_0xeee8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 2fd051d..0221d88 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 _0xfe55=['BIGINT','INTEGER','exports','STRING','FLOAT'];(function(_0x121c6f,_0x35c1c0){var _0x26f815=function(_0x2790e4){while(--_0x2790e4){_0x121c6f['push'](_0x121c6f['shift']());}};_0x26f815(++_0x35c1c0);}(_0xfe55,0x9d));var _0x5fe5=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xfe55[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require('sequelize');module[_0x5fe5('0x0')]={'name':{'type':Sequelize[_0x5fe5('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x5fe5('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x5fe5('0x1')]},'original_format':{'type':Sequelize[_0x5fe5('0x1')]},'original_duration':{'type':Sequelize[_0x5fe5('0x2')]},'original_sampleCount':{'type':Sequelize[_0x5fe5('0x3')]},'original_channelCount':{'type':Sequelize[_0x5fe5('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5fe5('0x4')]},'converted_format':{'type':Sequelize[_0x5fe5('0x1')]},'converted_duration':{'type':Sequelize[_0x5fe5('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x5fe5('0x3')]},'converted_channelCount':{'type':Sequelize[_0x5fe5('0x4')]},'converted_bitRate':{'type':Sequelize[_0x5fe5('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x5fe5('0x4')]}}; \ No newline at end of file +var _0x1dba=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x17bb25,_0x5bc624){var _0x30f276=function(_0xf794d8){while(--_0xf794d8){_0x17bb25['push'](_0x17bb25['shift']());}};_0x30f276(++_0x5bc624);}(_0x1dba,0x1c4));var _0xa1db=function(_0x6231e,_0x4871e0){_0x6231e=_0x6231e-0x0;var _0x23d94e=_0x1dba[_0x6231e];return _0x23d94e;};'use strict';var Sequelize=require(_0xa1db('0x0'));module[_0xa1db('0x1')]={'name':{'type':Sequelize[_0xa1db('0x2')],'unique':_0xa1db('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xa1db('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa1db('0x4')]},'original_sampleCount':{'type':Sequelize[_0xa1db('0x5')]},'original_channelCount':{'type':Sequelize[_0xa1db('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xa1db('0x5')]},'converted_channelCount':{'type':Sequelize[_0xa1db('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xa1db('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 4db5527..ba68077 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 _0xbe48=['sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','Sound','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','download','converted_format','existsSync','join','root','save_name','Sequelize','ValidationError','server/files/sounds/converted','%s.%s','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount'];(function(_0x2c1b6b,_0x5dfbc9){var _0x5d546a=function(_0x198611){while(--_0x198611){_0x2c1b6b['push'](_0x2c1b6b['shift']());}};_0x5d546a(++_0x5dfbc9);}(_0xbe48,0x91));var _0x8be4=function(_0x13fd47,_0x50315a){_0x13fd47=_0x13fd47-0x0;var _0x1a3c76=_0xbe48[_0x13fd47];return _0x1a3c76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8be4('0x0'));var jsonpatch=require(_0x8be4('0x1'));var rp=require(_0x8be4('0x2'));var moment=require('moment');var BPromise=require(_0x8be4('0x3'));var Mustache=require(_0x8be4('0x4'));var util=require(_0x8be4('0x5'));var path=require(_0x8be4('0x6'));var sox=require(_0x8be4('0x7'));var csv=require(_0x8be4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8be4('0x9'));var squel=require(_0x8be4('0xa'));var crypto=require('crypto');var jsforce=require(_0x8be4('0xb'));var deskjs=require(_0x8be4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8be4('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8be4('0xe'));var qs=require(_0x8be4('0xf'));var as=require(_0x8be4('0x10'));var hardwareService=require(_0x8be4('0x11'));var logger=require(_0x8be4('0x12'))(_0x8be4('0x13'));var utils=require(_0x8be4('0x14'));var config=require(_0x8be4('0x15'));var licenseUtil=require(_0x8be4('0x16'));var db=require(_0x8be4('0x17'))['db'];function respondWithStatusCode(_0x4d035b,_0x45acc9){_0x45acc9=_0x45acc9||0xcc;return function(_0x403de0){if(_0x403de0){return _0x4d035b['sendStatus'](_0x45acc9);}return _0x4d035b[_0x8be4('0x18')](_0x45acc9)[_0x8be4('0x19')]();};}function respondWithResult(_0xe4c500,_0x49ea21){_0x49ea21=_0x49ea21||0xc8;return function(_0x541e3b){if(_0x541e3b){return _0xe4c500[_0x8be4('0x18')](_0x49ea21)[_0x8be4('0x1a')](_0x541e3b);}};}function respondWithFilteredResult(_0x31be7e,_0x3b09f5){return function(_0x74905e){if(_0x74905e){var _0x5db11d=typeof _0x3b09f5['offset']===_0x8be4('0x1b')&&typeof _0x3b09f5[_0x8be4('0x1c')]===_0x8be4('0x1b');var _0x3997bc=_0x74905e[_0x8be4('0x1d')];var _0x111680=_0x5db11d?0x0:_0x3b09f5[_0x8be4('0x1e')];var _0x56f884=_0x5db11d?_0x74905e[_0x8be4('0x1d')]:_0x3b09f5[_0x8be4('0x1e')]+_0x3b09f5['limit'];var _0x33573e;if(_0x56f884>=_0x3997bc){_0x56f884=_0x3997bc;_0x33573e=0xc8;}else{_0x33573e=0xce;}_0x31be7e['status'](_0x33573e);return _0x31be7e[_0x8be4('0x1f')]('Content-Range',_0x111680+'-'+_0x56f884+'/'+_0x3997bc)[_0x8be4('0x1a')](_0x74905e);}return null;};}function patchUpdates(_0x3ef567){return function(_0x9bf313){try{jsonpatch[_0x8be4('0x20')](_0x9bf313,_0x3ef567,!![]);}catch(_0x12de76){return BPromise[_0x8be4('0x21')](_0x12de76);}return _0x9bf313[_0x8be4('0x22')]();};}function saveUpdates(_0x55f67b,_0x50bcea){return function(_0xb9e8b3){if(_0xb9e8b3){return _0xb9e8b3[_0x8be4('0x23')](_0x55f67b)[_0x8be4('0x24')](function(_0x40ecb3){return _0x40ecb3;});}return null;};}function removeEntity(_0x449883,_0x143f8e){return function(_0x2ead69){if(_0x2ead69){return _0x2ead69[_0x8be4('0x25')]()[_0x8be4('0x24')](function(){var _0x5d92bc=_0x2ead69[_0x8be4('0x26')]({'plain':!![]});var _0x433caf=_0x8be4('0x27');return db[_0x8be4('0x28')][_0x8be4('0x25')]({'where':{'type':_0x433caf,'resourceId':_0x5d92bc['id']}})[_0x8be4('0x24')](function(){return _0x2ead69;});})['then'](function(){_0x449883[_0x8be4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c52d6,_0x43ca83){return function(_0x569fc5){if(!_0x569fc5){_0x2c52d6[_0x8be4('0x29')](0x194);}return _0x569fc5;};}function handleError(_0x4f65ee,_0x253dbf){_0x253dbf=_0x253dbf||0x1f4;return function(_0x1649f1){logger[_0x8be4('0x2a')](_0x1649f1[_0x8be4('0x2b')]);if(_0x1649f1['name']){delete _0x1649f1[_0x8be4('0x2c')];}_0x4f65ee[_0x8be4('0x18')](_0x253dbf)[_0x8be4('0x2d')](_0x1649f1);};}exports[_0x8be4('0x2e')]=function(_0x1b6e63,_0xf82527){var _0x38403d={},_0x2a933f={},_0x5be735={'count':0x0,'rows':[]};var _0x1723a6=_['map'](db[_0x8be4('0x2f')]['rawAttributes'],function(_0x11f593){return{'name':_0x11f593[_0x8be4('0x30')],'type':_0x11f593['type'][_0x8be4('0x31')]};});_0x2a933f[_0x8be4('0x32')]=_['map'](_0x1723a6,_0x8be4('0x2c'));_0x2a933f[_0x8be4('0x33')]=_['keys'](_0x1b6e63[_0x8be4('0x33')]);_0x2a933f['filters']=_[_0x8be4('0x34')](_0x2a933f[_0x8be4('0x32')],_0x2a933f['query']);_0x38403d[_0x8be4('0x35')]=_[_0x8be4('0x34')](_0x2a933f[_0x8be4('0x32')],qs[_0x8be4('0x36')](_0x1b6e63[_0x8be4('0x33')]['fields']));_0x38403d[_0x8be4('0x35')]=_0x38403d['attributes']['length']?_0x38403d[_0x8be4('0x35')]:_0x2a933f[_0x8be4('0x32')];if(!_0x1b6e63[_0x8be4('0x33')][_0x8be4('0x37')]('nolimit')){_0x38403d[_0x8be4('0x1c')]=qs[_0x8be4('0x1c')](_0x1b6e63[_0x8be4('0x33')][_0x8be4('0x1c')]);_0x38403d[_0x8be4('0x1e')]=qs['offset'](_0x1b6e63['query'][_0x8be4('0x1e')]);}_0x38403d[_0x8be4('0x38')]=qs[_0x8be4('0x39')](_0x1b6e63[_0x8be4('0x33')][_0x8be4('0x39')]);_0x38403d[_0x8be4('0x3a')]=qs['filters'](_[_0x8be4('0x3b')](_0x1b6e63[_0x8be4('0x33')],_0x2a933f[_0x8be4('0x3c')]),_0x1723a6);if(_0x1b6e63[_0x8be4('0x33')][_0x8be4('0x3d')]){_0x38403d[_0x8be4('0x3a')]=_[_0x8be4('0x3e')](_0x38403d[_0x8be4('0x3a')],{'$or':_[_0x8be4('0x3f')](_0x1723a6,function(_0x4532b1){if(_0x4532b1['type']!=='VIRTUAL'){var _0x2fb010={};_0x2fb010[_0x4532b1[_0x8be4('0x2c')]]={'$like':'%'+_0x1b6e63[_0x8be4('0x33')][_0x8be4('0x3d')]+'%'};return _0x2fb010;}})});}_0x38403d=_[_0x8be4('0x3e')]({},_0x38403d,_0x1b6e63[_0x8be4('0x40')]);var _0x1078e6={'where':_0x38403d[_0x8be4('0x3a')]};return db[_0x8be4('0x2f')][_0x8be4('0x1d')](_0x1078e6)[_0x8be4('0x24')](function(_0x3f763f){_0x5be735[_0x8be4('0x1d')]=_0x3f763f;if(_0x1b6e63[_0x8be4('0x33')][_0x8be4('0x41')]){_0x38403d[_0x8be4('0x42')]=[{'all':!![]}];}return db[_0x8be4('0x2f')]['findAll'](_0x38403d);})[_0x8be4('0x24')](function(_0x4e33ef){_0x5be735[_0x8be4('0x43')]=_0x4e33ef;return _0x5be735;})[_0x8be4('0x24')](respondWithFilteredResult(_0xf82527,_0x38403d))[_0x8be4('0x44')](handleError(_0xf82527,null));};exports[_0x8be4('0x45')]=function(_0x37cf60,_0x42fce2){var _0x4d389a={'raw':!![],'where':{'id':_0x37cf60[_0x8be4('0x46')]['id']}},_0x190f7c={};_0x190f7c[_0x8be4('0x32')]=_[_0x8be4('0x47')](db[_0x8be4('0x2f')][_0x8be4('0x48')]);_0x190f7c[_0x8be4('0x33')]=_['keys'](_0x37cf60[_0x8be4('0x33')]);_0x190f7c[_0x8be4('0x3c')]=_[_0x8be4('0x34')](_0x190f7c[_0x8be4('0x32')],_0x190f7c[_0x8be4('0x33')]);_0x4d389a[_0x8be4('0x35')]=_[_0x8be4('0x34')](_0x190f7c['model'],qs[_0x8be4('0x36')](_0x37cf60['query'][_0x8be4('0x36')]));_0x4d389a[_0x8be4('0x35')]=_0x4d389a[_0x8be4('0x35')][_0x8be4('0x49')]?_0x4d389a[_0x8be4('0x35')]:_0x190f7c['model'];if(_0x37cf60[_0x8be4('0x33')][_0x8be4('0x41')]){_0x4d389a[_0x8be4('0x42')]=[{'all':!![]}];}_0x4d389a=_[_0x8be4('0x3e')]({},_0x4d389a,_0x37cf60[_0x8be4('0x40')]);return db[_0x8be4('0x2f')][_0x8be4('0x4a')](_0x4d389a)[_0x8be4('0x24')](handleEntityNotFound(_0x42fce2,null))['then'](respondWithResult(_0x42fce2,null))[_0x8be4('0x44')](handleError(_0x42fce2,null));};exports[_0x8be4('0x4b')]=function(_0x167364,_0x15625d,_0x3aab4a){return db[_0x8be4('0x2f')][_0x8be4('0x4a')]({'where':{'id':_0x167364[_0x8be4('0x46')]['id']},'attributes':[_0x8be4('0x2c'),'save_name',_0x8be4('0x4c')],'raw':!![]})[_0x8be4('0x24')](handleEntityNotFound(_0x15625d,null))['then'](function(_0x14d65d){if(_0x14d65d){if(!fs[_0x8be4('0x4d')](path[_0x8be4('0x4e')](config[_0x8be4('0x4f')],'server/files/sounds/converted',_0x14d65d[_0x8be4('0x50')]+'.'+_0x14d65d['converted_format']))){throw new db[(_0x8be4('0x51'))][(_0x8be4('0x52'))]('Sound\x20not\x20found');}return _0x15625d[_0x8be4('0x4b')](path[_0x8be4('0x4e')](config[_0x8be4('0x4f')],_0x8be4('0x53'),util['format'](_0x8be4('0x54'),_0x14d65d[_0x8be4('0x50')],_0x14d65d['converted_format'])),util[_0x8be4('0x55')](_0x8be4('0x54'),_0x14d65d[_0x8be4('0x2c')],_0x14d65d[_0x8be4('0x4c')]));}return null;})[_0x8be4('0x44')](handleError(_0x15625d,null));};exports[_0x8be4('0x56')]=function(_0x433abb,_0x5298ee,_0x5e5174){var _0x505a3d={'name':path[_0x8be4('0x57')](_0x433abb[_0x8be4('0x58')][_0x8be4('0x59')],path[_0x8be4('0x5a')](_0x433abb[_0x8be4('0x58')][_0x8be4('0x59')])),'save_name':path[_0x8be4('0x57')](_0x433abb[_0x8be4('0x58')][_0x8be4('0x5b')],path[_0x8be4('0x5a')](_0x433abb[_0x8be4('0x58')][_0x8be4('0x5b')])),'original_format':path[_0x8be4('0x5a')](_0x433abb[_0x8be4('0x58')][_0x8be4('0x59')])[_0x8be4('0x5c')](0x1),'converted_format':_0x8be4('0x5d')};var _0x4e9036=path[_0x8be4('0x4e')](config[_0x8be4('0x4f')],_0x8be4('0x5e'),_0x433abb[_0x8be4('0x58')]['filename']);var _0x485a5e=path[_0x8be4('0x4e')](config['root'],_0x8be4('0x53'),util[_0x8be4('0x55')](_0x8be4('0x54'),path['basename'](_0x433abb[_0x8be4('0x58')]['filename'],path['extname'](_0x433abb[_0x8be4('0x58')]['filename'])),_0x505a3d[_0x8be4('0x4c')]));logger[_0x8be4('0x5f')](_0x8be4('0x60'),_0x4e9036);logger['info'](_0x8be4('0x61'),_0x485a5e);try{fs[_0x8be4('0x62')](_0x4e9036,parseInt('0777',0x8));var _0xcc84f1=sox[_0x8be4('0x63')](_0x4e9036,_0x485a5e,{'sampleRate':0x1f40,'format':_0x8be4('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xcc84f1['on'](_0x8be4('0x2a'),function(_0x1e66bc){fs[_0x8be4('0x64')](_0x4e9036);_0x5298ee[_0x8be4('0x18')](0x1f4)[_0x8be4('0x2d')](_0x1e66bc);});_0xcc84f1['on'](_0x8be4('0x65'),function(_0x3e24bb){_0x505a3d[_0x8be4('0x66')]=isNaN(_0x3e24bb[_0x8be4('0x67')])?null:_0x3e24bb['duration']*0x3e8;_0x505a3d[_0x8be4('0x68')]=isNaN(_0x3e24bb[_0x8be4('0x69')])?null:_0x3e24bb['sampleCount'];_0x505a3d['original_channelCount']=isNaN(_0x3e24bb[_0x8be4('0x6a')])?null:_0x3e24bb[_0x8be4('0x6a')];_0x505a3d[_0x8be4('0x6b')]=isNaN(_0x3e24bb[_0x8be4('0x6c')])?null:_0x3e24bb[_0x8be4('0x6c')];_0x505a3d[_0x8be4('0x6d')]=isNaN(_0x3e24bb[_0x8be4('0x6e')])?null:_0x3e24bb[_0x8be4('0x6e')];});_0xcc84f1['on'](_0x8be4('0x6f'),function(_0xaddc3f){_0x505a3d['converted_duration']=isNaN(_0xaddc3f[_0x8be4('0x67')])?null:_0xaddc3f[_0x8be4('0x67')]*0x3e8;_0x505a3d[_0x8be4('0x70')]=isNaN(_0xaddc3f['sampleCount'])?null:_0xaddc3f['sampleCount'];_0x505a3d['converted_channelCount']=isNaN(_0xaddc3f['channelCount'])?null:_0xaddc3f['channelCount'];_0x505a3d[_0x8be4('0x71')]=isNaN(_0xaddc3f[_0x8be4('0x6c')])?null:_0xaddc3f['bitRate'];_0x505a3d['converted_sampleRate']=isNaN(_0xaddc3f[_0x8be4('0x6e')])?null:_0xaddc3f[_0x8be4('0x6e')];});_0xcc84f1['on'](_0x8be4('0x19'),function(){fs[_0x8be4('0x62')](_0x485a5e,parseInt(_0x8be4('0x72'),0x8));return db[_0x8be4('0x2f')][_0x8be4('0x56')](_0x505a3d)[_0x8be4('0x24')](function(_0x3586ed){var _0x49ec43={'role':_0x433abb[_0x8be4('0x73')][_0x8be4('0x74')],'userProfileId':_0x433abb['body'][_0x8be4('0x75')]};if(!_0x49ec43)throw new Error(_0x8be4('0x76'));if(_0x49ec43[_0x8be4('0x74')]==='user'){var _0xc001d0=_0x3586ed[_0x8be4('0x26')]({'plain':!![]});return db[_0x8be4('0x77')][_0x8be4('0x4a')]({'where':{'name':_0x8be4('0x27'),'userProfileId':_0x49ec43[_0x8be4('0x75')]},'raw':!![]})[_0x8be4('0x24')](function(_0x34946a){if(_0x34946a&&_0x34946a[_0x8be4('0x78')]===0x0){return db[_0x8be4('0x28')][_0x8be4('0x56')]({'name':_0xc001d0[_0x8be4('0x2c')],'resourceId':_0xc001d0['id'],'type':_0x34946a['name'],'sectionId':_0x34946a['id']},{})[_0x8be4('0x24')](function(){return _0x3586ed;});}else{return _0x3586ed;}})['catch'](function(_0x391890){logger['error'](_0x8be4('0x79'),_0x391890);throw _0x391890;});}return _0x3586ed;})[_0x8be4('0x24')](respondWithResult(_0x5298ee,null))[_0x8be4('0x44')](handleError(_0x5298ee,null));});_0xcc84f1[_0x8be4('0x7a')]();}catch(_0x33708e){_0x5298ee['status'](0x1f4)[_0x8be4('0x2d')](_0x33708e);}};exports[_0x8be4('0x23')]=function(_0x4655c6,_0x4afe90,_0x2d3724){return db[_0x8be4('0x2f')][_0x8be4('0x4a')]({'where':{'id':_0x4655c6[_0x8be4('0x46')]['id']}})[_0x8be4('0x24')](handleEntityNotFound(_0x4afe90,null))['then'](saveUpdates(_['pick'](_0x4655c6['body'],[_0x8be4('0x2c'),'description']),null))['then'](respondWithResult(_0x4afe90,null))['catch'](handleError(_0x4afe90,null));};exports[_0x8be4('0x7b')]=function(_0x5ea898,_0x3efd43,_0x5987df){return db[_0x8be4('0x2f')]['find']({'where':{'id':_0x5ea898['params']['id']}})['then'](function(_0x2b30d3){if(_0x2b30d3){return _0x2b30d3[_0x8be4('0x25')]();}})[_0x8be4('0x24')](function(_0x314506){var _0x1318fc=path[_0x8be4('0x4e')](config[_0x8be4('0x4f')],_0x8be4('0x5e'),util[_0x8be4('0x55')](_0x8be4('0x54'),_0x314506['save_name'],_0x314506[_0x8be4('0x7c')]));var _0x5a6046=path[_0x8be4('0x4e')](config['root'],_0x8be4('0x53'),util['format'](_0x8be4('0x54'),_0x314506[_0x8be4('0x50')],_0x314506[_0x8be4('0x4c')]));fs[_0x8be4('0x64')](_0x1318fc);fs[_0x8be4('0x64')](_0x5a6046);return _0x314506;})['then'](function(_0x1e9ea9){if(_0x1e9ea9){return _0x3efd43[_0x8be4('0x18')](0xcc)[_0x8be4('0x19')]();}})['then'](handleEntityNotFound(_0x3efd43,null))[_0x8be4('0x44')](handleError(_0x3efd43,null));}; \ No newline at end of file +var _0xc9ee=['existsSync','join','root','server/files/sounds/converted','save_name','ValidationError','Sound\x20not\x20found','download','format','%s.%s','catch','create','file','originalname','extname','filename','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','delete','server/files/sounds/original','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','params','intersection','find','converted_format'];(function(_0x3663e7,_0x384ff3){var _0x421d1b=function(_0x2fd77b){while(--_0x2fd77b){_0x3663e7['push'](_0x3663e7['shift']());}};_0x421d1b(++_0x384ff3);}(_0xc9ee,0x124));var _0xec9e=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0xc9ee[_0x22b8a3];return _0x199a0c;};'use strict';var emlformat=require(_0xec9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec9e('0x1'));var jsonpatch=require(_0xec9e('0x2'));var rp=require(_0xec9e('0x3'));var moment=require(_0xec9e('0x4'));var BPromise=require(_0xec9e('0x5'));var Mustache=require(_0xec9e('0x6'));var util=require(_0xec9e('0x7'));var path=require(_0xec9e('0x8'));var sox=require(_0xec9e('0x9'));var csv=require(_0xec9e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec9e('0xb'));var _=require(_0xec9e('0xc'));var squel=require(_0xec9e('0xd'));var crypto=require(_0xec9e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xec9e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xec9e('0x10'));var Papa=require(_0xec9e('0x11'));var Redis=require(_0xec9e('0x12'));var authService=require(_0xec9e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec9e('0x14'))(_0xec9e('0x15'));var utils=require('../../config/utils');var config=require(_0xec9e('0x16'));var licenseUtil=require(_0xec9e('0x17'));var db=require(_0xec9e('0x18'))['db'];function respondWithStatusCode(_0xa67032,_0x79eb90){_0x79eb90=_0x79eb90||0xcc;return function(_0x6f2735){if(_0x6f2735){return _0xa67032[_0xec9e('0x19')](_0x79eb90);}return _0xa67032[_0xec9e('0x1a')](_0x79eb90)[_0xec9e('0x1b')]();};}function respondWithResult(_0x43a38c,_0x392b95){_0x392b95=_0x392b95||0xc8;return function(_0x151984){if(_0x151984){return _0x43a38c[_0xec9e('0x1a')](_0x392b95)[_0xec9e('0x1c')](_0x151984);}};}function respondWithFilteredResult(_0x29d468,_0x520e8a){return function(_0x364412){if(_0x364412){var _0x260614=typeof _0x520e8a['offset']===_0xec9e('0x1d')&&typeof _0x520e8a[_0xec9e('0x1e')]==='undefined';var _0x4ee8fb=_0x364412[_0xec9e('0x1f')];var _0x547c21=_0x260614?0x0:_0x520e8a[_0xec9e('0x20')];var _0x27b9ac=_0x260614?_0x364412[_0xec9e('0x1f')]:_0x520e8a['offset']+_0x520e8a['limit'];var _0x21f9ff;if(_0x27b9ac>=_0x4ee8fb){_0x27b9ac=_0x4ee8fb;_0x21f9ff=0xc8;}else{_0x21f9ff=0xce;}_0x29d468[_0xec9e('0x1a')](_0x21f9ff);return _0x29d468[_0xec9e('0x21')]('Content-Range',_0x547c21+'-'+_0x27b9ac+'/'+_0x4ee8fb)[_0xec9e('0x1c')](_0x364412);}return null;};}function patchUpdates(_0xf88315){return function(_0xe4e724){try{jsonpatch['apply'](_0xe4e724,_0xf88315,!![]);}catch(_0x41d41b){return BPromise[_0xec9e('0x22')](_0x41d41b);}return _0xe4e724[_0xec9e('0x23')]();};}function saveUpdates(_0x364f10,_0x1d010c){return function(_0x291558){if(_0x291558){return _0x291558[_0xec9e('0x24')](_0x364f10)[_0xec9e('0x25')](function(_0xca4181){return _0xca4181;});}return null;};}function removeEntity(_0x71810,_0x2175f9){return function(_0x73979){if(_0x73979){return _0x73979[_0xec9e('0x26')]()['then'](function(){var _0x2b3758=_0x73979['get']({'plain':!![]});var _0x3b49a2=_0xec9e('0x27');return db[_0xec9e('0x28')][_0xec9e('0x26')]({'where':{'type':_0x3b49a2,'resourceId':_0x2b3758['id']}})['then'](function(){return _0x73979;});})[_0xec9e('0x25')](function(){_0x71810[_0xec9e('0x1a')](0xcc)[_0xec9e('0x1b')]();});}};}function handleEntityNotFound(_0xdf19da,_0x5ef839){return function(_0x441479){if(!_0x441479){_0xdf19da[_0xec9e('0x19')](0x194);}return _0x441479;};}function handleError(_0x55c0b1,_0x37d178){_0x37d178=_0x37d178||0x1f4;return function(_0x36e840){logger[_0xec9e('0x29')](_0x36e840[_0xec9e('0x2a')]);if(_0x36e840[_0xec9e('0x2b')]){delete _0x36e840[_0xec9e('0x2b')];}_0x55c0b1[_0xec9e('0x1a')](_0x37d178)[_0xec9e('0x2c')](_0x36e840);};}exports[_0xec9e('0x2d')]=function(_0x166fa7,_0x552704){var _0x56a041={},_0x1bf801={},_0x407acb={'count':0x0,'rows':[]};var _0x293c67=_[_0xec9e('0x2e')](db[_0xec9e('0x2f')][_0xec9e('0x30')],function(_0x1603c9){return{'name':_0x1603c9[_0xec9e('0x31')],'type':_0x1603c9[_0xec9e('0x32')][_0xec9e('0x33')]};});_0x1bf801[_0xec9e('0x34')]=_[_0xec9e('0x2e')](_0x293c67,'name');_0x1bf801[_0xec9e('0x35')]=_[_0xec9e('0x36')](_0x166fa7['query']);_0x1bf801['filters']=_['intersection'](_0x1bf801['model'],_0x1bf801[_0xec9e('0x35')]);_0x56a041[_0xec9e('0x37')]=_['intersection'](_0x1bf801[_0xec9e('0x34')],qs[_0xec9e('0x38')](_0x166fa7[_0xec9e('0x35')]['fields']));_0x56a041[_0xec9e('0x37')]=_0x56a041[_0xec9e('0x37')][_0xec9e('0x39')]?_0x56a041[_0xec9e('0x37')]:_0x1bf801[_0xec9e('0x34')];if(!_0x166fa7[_0xec9e('0x35')][_0xec9e('0x3a')]('nolimit')){_0x56a041[_0xec9e('0x1e')]=qs['limit'](_0x166fa7[_0xec9e('0x35')][_0xec9e('0x1e')]);_0x56a041['offset']=qs[_0xec9e('0x20')](_0x166fa7[_0xec9e('0x35')][_0xec9e('0x20')]);}_0x56a041[_0xec9e('0x3b')]=qs['sort'](_0x166fa7[_0xec9e('0x35')][_0xec9e('0x3c')]);_0x56a041[_0xec9e('0x3d')]=qs[_0xec9e('0x3e')](_['pick'](_0x166fa7['query'],_0x1bf801[_0xec9e('0x3e')]),_0x293c67);if(_0x166fa7[_0xec9e('0x35')][_0xec9e('0x3f')]){_0x56a041[_0xec9e('0x3d')]=_['merge'](_0x56a041[_0xec9e('0x3d')],{'$or':_[_0xec9e('0x2e')](_0x293c67,function(_0x384aea){if(_0x384aea[_0xec9e('0x32')]!=='VIRTUAL'){var _0x442abf={};_0x442abf[_0x384aea[_0xec9e('0x2b')]]={'$like':'%'+_0x166fa7['query'][_0xec9e('0x3f')]+'%'};return _0x442abf;}})});}_0x56a041=_[_0xec9e('0x40')]({},_0x56a041,_0x166fa7[_0xec9e('0x41')]);var _0x50017f={'where':_0x56a041[_0xec9e('0x3d')]};return db[_0xec9e('0x2f')][_0xec9e('0x1f')](_0x50017f)['then'](function(_0x566497){_0x407acb[_0xec9e('0x1f')]=_0x566497;if(_0x166fa7[_0xec9e('0x35')][_0xec9e('0x42')]){_0x56a041[_0xec9e('0x43')]=[{'all':!![]}];}return db['Sound'][_0xec9e('0x44')](_0x56a041);})[_0xec9e('0x25')](function(_0x47b8a2){_0x407acb[_0xec9e('0x45')]=_0x47b8a2;return _0x407acb;})[_0xec9e('0x25')](respondWithFilteredResult(_0x552704,_0x56a041))['catch'](handleError(_0x552704,null));};exports['show']=function(_0x59eec0,_0x298926){var _0x2b4895={'raw':!![],'where':{'id':_0x59eec0[_0xec9e('0x46')]['id']}},_0x19565b={};_0x19565b[_0xec9e('0x34')]=_[_0xec9e('0x36')](db[_0xec9e('0x2f')][_0xec9e('0x30')]);_0x19565b[_0xec9e('0x35')]=_[_0xec9e('0x36')](_0x59eec0[_0xec9e('0x35')]);_0x19565b['filters']=_[_0xec9e('0x47')](_0x19565b['model'],_0x19565b[_0xec9e('0x35')]);_0x2b4895[_0xec9e('0x37')]=_[_0xec9e('0x47')](_0x19565b[_0xec9e('0x34')],qs[_0xec9e('0x38')](_0x59eec0[_0xec9e('0x35')][_0xec9e('0x38')]));_0x2b4895[_0xec9e('0x37')]=_0x2b4895[_0xec9e('0x37')][_0xec9e('0x39')]?_0x2b4895[_0xec9e('0x37')]:_0x19565b[_0xec9e('0x34')];if(_0x59eec0[_0xec9e('0x35')]['includeAll']){_0x2b4895['include']=[{'all':!![]}];}_0x2b4895=_[_0xec9e('0x40')]({},_0x2b4895,_0x59eec0['options']);return db['Sound'][_0xec9e('0x48')](_0x2b4895)['then'](handleEntityNotFound(_0x298926,null))[_0xec9e('0x25')](respondWithResult(_0x298926,null))['catch'](handleError(_0x298926,null));};exports['download']=function(_0x5c526f,_0x46c70a,_0x11c54f){return db[_0xec9e('0x2f')][_0xec9e('0x48')]({'where':{'id':_0x5c526f[_0xec9e('0x46')]['id']},'attributes':[_0xec9e('0x2b'),'save_name',_0xec9e('0x49')],'raw':!![]})['then'](handleEntityNotFound(_0x46c70a,null))[_0xec9e('0x25')](function(_0x289880){if(_0x289880){if(!fs[_0xec9e('0x4a')](path[_0xec9e('0x4b')](config[_0xec9e('0x4c')],_0xec9e('0x4d'),_0x289880[_0xec9e('0x4e')]+'.'+_0x289880['converted_format']))){throw new db['Sequelize'][(_0xec9e('0x4f'))](_0xec9e('0x50'));}return _0x46c70a[_0xec9e('0x51')](path['join'](config[_0xec9e('0x4c')],'server/files/sounds/converted',util[_0xec9e('0x52')](_0xec9e('0x53'),_0x289880[_0xec9e('0x4e')],_0x289880[_0xec9e('0x49')])),util[_0xec9e('0x52')](_0xec9e('0x53'),_0x289880[_0xec9e('0x2b')],_0x289880[_0xec9e('0x49')]));}return null;})[_0xec9e('0x54')](handleError(_0x46c70a,null));};exports[_0xec9e('0x55')]=function(_0xb62972,_0x47a2cd,_0x2a5e13){var _0x6ddb4={'name':path['basename'](_0xb62972[_0xec9e('0x56')][_0xec9e('0x57')],path[_0xec9e('0x58')](_0xb62972[_0xec9e('0x56')][_0xec9e('0x57')])),'save_name':path['basename'](_0xb62972[_0xec9e('0x56')][_0xec9e('0x59')],path[_0xec9e('0x58')](_0xb62972['file'][_0xec9e('0x59')])),'original_format':path[_0xec9e('0x58')](_0xb62972[_0xec9e('0x56')][_0xec9e('0x57')])['substring'](0x1),'converted_format':'wav'};var _0x5a9618=path[_0xec9e('0x4b')](config[_0xec9e('0x4c')],'server/files/sounds/original',_0xb62972[_0xec9e('0x56')]['filename']);var _0x49f1d1=path['join'](config[_0xec9e('0x4c')],_0xec9e('0x4d'),util['format'](_0xec9e('0x53'),path['basename'](_0xb62972['file'][_0xec9e('0x59')],path[_0xec9e('0x58')](_0xb62972[_0xec9e('0x56')][_0xec9e('0x59')])),_0x6ddb4[_0xec9e('0x49')]));logger[_0xec9e('0x5a')](_0xec9e('0x5b'),_0x5a9618);logger[_0xec9e('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x49f1d1);try{fs[_0xec9e('0x5c')](_0x5a9618,parseInt(_0xec9e('0x5d'),0x8));var _0x4e5889=sox[_0xec9e('0x5e')](_0x5a9618,_0x49f1d1,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4e5889['on'](_0xec9e('0x29'),function(_0x2c9af2){fs[_0xec9e('0x5f')](_0x5a9618);_0x47a2cd[_0xec9e('0x1a')](0x1f4)[_0xec9e('0x2c')](_0x2c9af2);});_0x4e5889['on'](_0xec9e('0x60'),function(_0x28f402){_0x6ddb4[_0xec9e('0x61')]=isNaN(_0x28f402[_0xec9e('0x62')])?null:_0x28f402[_0xec9e('0x62')]*0x3e8;_0x6ddb4['original_sampleCount']=isNaN(_0x28f402[_0xec9e('0x63')])?null:_0x28f402[_0xec9e('0x63')];_0x6ddb4[_0xec9e('0x64')]=isNaN(_0x28f402['channelCount'])?null:_0x28f402[_0xec9e('0x65')];_0x6ddb4[_0xec9e('0x66')]=isNaN(_0x28f402[_0xec9e('0x67')])?null:_0x28f402[_0xec9e('0x67')];_0x6ddb4[_0xec9e('0x68')]=isNaN(_0x28f402[_0xec9e('0x69')])?null:_0x28f402['sampleRate'];});_0x4e5889['on'](_0xec9e('0x6a'),function(_0x3e1137){_0x6ddb4['converted_duration']=isNaN(_0x3e1137[_0xec9e('0x62')])?null:_0x3e1137[_0xec9e('0x62')]*0x3e8;_0x6ddb4[_0xec9e('0x6b')]=isNaN(_0x3e1137[_0xec9e('0x63')])?null:_0x3e1137[_0xec9e('0x63')];_0x6ddb4[_0xec9e('0x6c')]=isNaN(_0x3e1137[_0xec9e('0x65')])?null:_0x3e1137[_0xec9e('0x65')];_0x6ddb4[_0xec9e('0x6d')]=isNaN(_0x3e1137[_0xec9e('0x67')])?null:_0x3e1137[_0xec9e('0x67')];_0x6ddb4['converted_sampleRate']=isNaN(_0x3e1137['sampleRate'])?null:_0x3e1137[_0xec9e('0x69')];});_0x4e5889['on']('end',function(){fs[_0xec9e('0x5c')](_0x49f1d1,parseInt(_0xec9e('0x5d'),0x8));return db[_0xec9e('0x2f')][_0xec9e('0x55')](_0x6ddb4)[_0xec9e('0x25')](function(_0x150104){var _0x4280e2={'role':_0xb62972[_0xec9e('0x6e')][_0xec9e('0x6f')],'userProfileId':_0xb62972[_0xec9e('0x6e')][_0xec9e('0x70')]};if(!_0x4280e2)throw new Error(_0xec9e('0x71'));if(_0x4280e2[_0xec9e('0x6f')]==='user'){var _0x55aa30=_0x150104[_0xec9e('0x72')]({'plain':!![]});return db['UserProfileSection'][_0xec9e('0x48')]({'where':{'name':'Sounds','userProfileId':_0x4280e2[_0xec9e('0x70')]},'raw':!![]})[_0xec9e('0x25')](function(_0xda62d4){if(_0xda62d4&&_0xda62d4[_0xec9e('0x73')]===0x0){return db[_0xec9e('0x28')][_0xec9e('0x55')]({'name':_0x55aa30[_0xec9e('0x2b')],'resourceId':_0x55aa30['id'],'type':_0xda62d4[_0xec9e('0x2b')],'sectionId':_0xda62d4['id']},{})[_0xec9e('0x25')](function(){return _0x150104;});}else{return _0x150104;}})[_0xec9e('0x54')](function(_0x2baca2){logger[_0xec9e('0x29')](_0xec9e('0x74'),_0x2baca2);throw _0x2baca2;});}return _0x150104;})['then'](respondWithResult(_0x47a2cd,null))[_0xec9e('0x54')](handleError(_0x47a2cd,null));});_0x4e5889[_0xec9e('0x75')]();}catch(_0x455237){_0x47a2cd['status'](0x1f4)['send'](_0x455237);}};exports['update']=function(_0x2bff52,_0x4e2b4b,_0x586949){return db[_0xec9e('0x2f')]['find']({'where':{'id':_0x2bff52[_0xec9e('0x46')]['id']}})[_0xec9e('0x25')](handleEntityNotFound(_0x4e2b4b,null))[_0xec9e('0x25')](saveUpdates(_[_0xec9e('0x76')](_0x2bff52[_0xec9e('0x6e')],['name','description']),null))['then'](respondWithResult(_0x4e2b4b,null))[_0xec9e('0x54')](handleError(_0x4e2b4b,null));};exports[_0xec9e('0x77')]=function(_0x4ff361,_0x8a6849,_0x240089){return db[_0xec9e('0x2f')][_0xec9e('0x48')]({'where':{'id':_0x4ff361[_0xec9e('0x46')]['id']}})['then'](function(_0x336690){if(_0x336690){return _0x336690[_0xec9e('0x26')]();}})[_0xec9e('0x25')](function(_0x3d9928){var _0x4c1d57=path[_0xec9e('0x4b')](config[_0xec9e('0x4c')],_0xec9e('0x78'),util[_0xec9e('0x52')]('%s.%s',_0x3d9928[_0xec9e('0x4e')],_0x3d9928[_0xec9e('0x79')]));var _0x3c1a49=path[_0xec9e('0x4b')](config[_0xec9e('0x4c')],_0xec9e('0x4d'),util[_0xec9e('0x52')](_0xec9e('0x53'),_0x3d9928[_0xec9e('0x4e')],_0x3d9928[_0xec9e('0x49')]));fs[_0xec9e('0x5f')](_0x4c1d57);fs[_0xec9e('0x5f')](_0x3c1a49);return _0x3d9928;})[_0xec9e('0x25')](function(_0x4c01ce){if(_0x4c01ce){return _0x8a6849[_0xec9e('0x1a')](0xcc)[_0xec9e('0x1b')]();}})[_0xec9e('0x25')](handleEntityNotFound(_0x8a6849,null))[_0xec9e('0x54')](handleError(_0x8a6849,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b012408..ac7af6f 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 _0x95c2=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util'];(function(_0x149319,_0x4182b5){var _0x4637c9=function(_0x2ff6ce){while(--_0x2ff6ce){_0x149319['push'](_0x149319['shift']());}};_0x4637c9(++_0x4182b5);}(_0x95c2,0x142));var _0x295c=function(_0x37ab03,_0x11c1c5){_0x37ab03=_0x37ab03-0x0;var _0x97b59b=_0x95c2[_0x37ab03];return _0x97b59b;};'use strict';var _=require(_0x295c('0x0'));var util=require(_0x295c('0x1'));var logger=require(_0x295c('0x2'))(_0x295c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x295c('0x4'));var fs=require('fs');var path=require(_0x295c('0x5'));var rimraf=require(_0x295c('0x6'));var config=require(_0x295c('0x7'));var attributes=require(_0x295c('0x8'));module[_0x295c('0x9')]=function(_0xb36aeb,_0x2da0ed){return _0xb36aeb[_0x295c('0xa')](_0x295c('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x557a=['moment','bluebird','path','rimraf','./sound.attributes','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x5e5f7e,_0x3dce54){var _0x42010f=function(_0x15ad75){while(--_0x15ad75){_0x5e5f7e['push'](_0x5e5f7e['shift']());}};_0x42010f(++_0x3dce54);}(_0x557a,0x18d));var _0xa557=function(_0x5457f6,_0x36e0e4){_0x5457f6=_0x5457f6-0x0;var _0x57339d=_0x557a[_0x5457f6];return _0x57339d;};'use strict';var _=require(_0xa557('0x0'));var util=require(_0xa557('0x1'));var logger=require(_0xa557('0x2'))('api');var moment=require(_0xa557('0x3'));var BPromise=require(_0xa557('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa557('0x5'));var rimraf=require(_0xa557('0x6'));var config=require('../../config/environment');var attributes=require(_0xa557('0x7'));module['exports']=function(_0x32d45e,_0x349c6f){return _0x32d45e['define'](_0xa557('0x8'),attributes,{'tableName':_0xa557('0x9'),'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 1ca0602..af47dc9 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 _0x667d=['options','raw','where','attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSound','Sound'];(function(_0x1c2ac3,_0x328525){var _0x5afb18=function(_0x1f069e){while(--_0x1f069e){_0x1c2ac3['push'](_0x1c2ac3['shift']());}};_0x5afb18(++_0x328525);}(_0x667d,0xff));var _0xd667=function(_0x31f295,_0x27e9a7){_0x31f295=_0x31f295-0x0;var _0x64facf=_0x667d[_0x31f295];return _0x64facf;};'use strict';var _=require('lodash');var util=require(_0xd667('0x0'));var moment=require(_0xd667('0x1'));var BPromise=require(_0xd667('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd667('0x3'));var db=require(_0xd667('0x4'))['db'];var utils=require(_0xd667('0x5'));var logger=require(_0xd667('0x6'))(_0xd667('0x7'));var config=require('../../config/environment');var jayson=require(_0xd667('0x8'));var client=jayson[_0xd667('0x9')][_0xd667('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42b2f9,_0x2d901d,_0x25bd9e){return new BPromise(function(_0x565e90,_0x27e997){return client['request'](_0x42b2f9,_0x25bd9e)[_0xd667('0xb')](function(_0xac980f){logger[_0xd667('0xc')](_0xd667('0xd'),_0x2d901d,'request\x20sent');logger[_0xd667('0xe')](_0xd667('0xf'),_0x2d901d,_0xd667('0x10'),JSON[_0xd667('0x11')](_0xac980f));if(_0xac980f['error']){if(_0xac980f[_0xd667('0x12')][_0xd667('0x13')]===0x1f4){logger[_0xd667('0x12')](_0xd667('0xd'),_0x2d901d,_0xac980f[_0xd667('0x12')][_0xd667('0x14')]);return _0x27e997(_0xac980f[_0xd667('0x12')][_0xd667('0x14')]);}logger[_0xd667('0x12')](_0xd667('0xd'),_0x2d901d,_0xac980f['error'][_0xd667('0x14')]);return _0x565e90(_0xac980f[_0xd667('0x12')][_0xd667('0x14')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x2d901d,_0xd667('0x10'));_0x565e90(_0xac980f['result'][_0xd667('0x14')]);}})[_0xd667('0x15')](function(_0x4b974b){logger[_0xd667('0x12')](_0xd667('0xd'),_0x2d901d,_0x4b974b);_0x27e997(_0x4b974b);});});}exports[_0xd667('0x16')]=function(_0x464c1c){var _0x15e858=this;return new Promise(function(_0x111a2f,_0x5de5d4){return db[_0xd667('0x17')]['find']({'raw':_0x464c1c[_0xd667('0x18')]?_0x464c1c['options'][_0xd667('0x19')]===undefined?!![]:![]:!![],'where':_0x464c1c[_0xd667('0x18')]?_0x464c1c[_0xd667('0x18')][_0xd667('0x1a')]||null:null,'attributes':_0x464c1c[_0xd667('0x18')]?_0x464c1c[_0xd667('0x18')][_0xd667('0x1b')]||null:null,'include':_0x464c1c[_0xd667('0x18')]?_0x464c1c[_0xd667('0x18')][_0xd667('0x1c')]?_[_0xd667('0x1d')](_0x464c1c[_0xd667('0x18')]['include'],function(_0x390091){return{'model':db[_0x390091['model']],'as':_0x390091['as'],'attributes':_0x390091['attributes'],'include':_0x390091[_0xd667('0x1c')]?_[_0xd667('0x1d')](_0x390091[_0xd667('0x1c')],function(_0x472988){return{'model':db[_0x472988[_0xd667('0x1e')]],'as':_0x472988['as'],'attributes':_0x472988[_0xd667('0x1b')],'include':_0x472988['include']?_[_0xd667('0x1d')](_0x472988['include'],function(_0x94c4dd){return{'model':db[_0x94c4dd[_0xd667('0x1e')]],'as':_0x94c4dd['as'],'attributes':_0x94c4dd[_0xd667('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd667('0xb')](function(_0x397392){logger[_0xd667('0xc')](_0xd667('0x16'),_0x464c1c);logger[_0xd667('0xe')](_0xd667('0x16'),_0x464c1c,JSON[_0xd667('0x11')](_0x397392));_0x111a2f(_0x397392);})[_0xd667('0x15')](function(_0x1ba66e){logger[_0xd667('0x12')]('ShowSound',_0x1ba66e['message'],_0x464c1c);_0x5de5d4(_0x15e858[_0xd667('0x12')](0x1f4,_0x1ba66e['message']));});});}; \ No newline at end of file +var _0x80da=['stringify','error','code','message','info','result','find','options','raw','attributes','include','map','ShowSound','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x12e73c,_0x2cbe1d){var _0x4c41cb=function(_0x10283b){while(--_0x10283b){_0x12e73c['push'](_0x12e73c['shift']());}};_0x4c41cb(++_0x2cbe1d);}(_0x80da,0xce));var _0xa80d=function(_0xce1e4e,_0x2ebd32){_0xce1e4e=_0xce1e4e-0x0;var _0xa2a908=_0x80da[_0xce1e4e];return _0xa2a908;};'use strict';var _=require('lodash');var util=require(_0xa80d('0x0'));var moment=require(_0xa80d('0x1'));var BPromise=require(_0xa80d('0x2'));var rs=require(_0xa80d('0x3'));var fs=require('fs');var Redis=require(_0xa80d('0x4'));var db=require(_0xa80d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa80d('0x6'))(_0xa80d('0x7'));var config=require(_0xa80d('0x8'));var jayson=require(_0xa80d('0x9'));var client=jayson[_0xa80d('0xa')][_0xa80d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a24ca,_0x2ad8e6,_0x279c6f){return new BPromise(function(_0x2050ad,_0x3b31ca){return client[_0xa80d('0xc')](_0x1a24ca,_0x279c6f)[_0xa80d('0xd')](function(_0x15f506){logger['info'](_0xa80d('0xe'),_0x2ad8e6,_0xa80d('0xf'));logger[_0xa80d('0x10')](_0xa80d('0x11'),_0x2ad8e6,_0xa80d('0xf'),JSON[_0xa80d('0x12')](_0x15f506));if(_0x15f506[_0xa80d('0x13')]){if(_0x15f506[_0xa80d('0x13')][_0xa80d('0x14')]===0x1f4){logger[_0xa80d('0x13')](_0xa80d('0xe'),_0x2ad8e6,_0x15f506[_0xa80d('0x13')][_0xa80d('0x15')]);return _0x3b31ca(_0x15f506[_0xa80d('0x13')][_0xa80d('0x15')]);}logger[_0xa80d('0x13')]('Sound,\x20%s,\x20%s',_0x2ad8e6,_0x15f506[_0xa80d('0x13')][_0xa80d('0x15')]);return _0x2050ad(_0x15f506[_0xa80d('0x13')]['message']);}else{logger[_0xa80d('0x16')](_0xa80d('0xe'),_0x2ad8e6,_0xa80d('0xf'));_0x2050ad(_0x15f506[_0xa80d('0x17')][_0xa80d('0x15')]);}})['catch'](function(_0x4746c2){logger[_0xa80d('0x13')]('Sound,\x20%s,\x20%s',_0x2ad8e6,_0x4746c2);_0x3b31ca(_0x4746c2);});});}exports['ShowSound']=function(_0x3e2657){var _0x48990a=this;return new Promise(function(_0x2032aa,_0x5c7b33){return db['Sound'][_0xa80d('0x18')]({'raw':_0x3e2657[_0xa80d('0x19')]?_0x3e2657[_0xa80d('0x19')][_0xa80d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e2657[_0xa80d('0x19')]?_0x3e2657['options']['where']||null:null,'attributes':_0x3e2657[_0xa80d('0x19')]?_0x3e2657[_0xa80d('0x19')][_0xa80d('0x1b')]||null:null,'include':_0x3e2657[_0xa80d('0x19')]?_0x3e2657[_0xa80d('0x19')][_0xa80d('0x1c')]?_[_0xa80d('0x1d')](_0x3e2657[_0xa80d('0x19')]['include'],function(_0x47721d){return{'model':db[_0x47721d['model']],'as':_0x47721d['as'],'attributes':_0x47721d[_0xa80d('0x1b')],'include':_0x47721d[_0xa80d('0x1c')]?_[_0xa80d('0x1d')](_0x47721d[_0xa80d('0x1c')],function(_0x34bd62){return{'model':db[_0x34bd62['model']],'as':_0x34bd62['as'],'attributes':_0x34bd62[_0xa80d('0x1b')],'include':_0x34bd62[_0xa80d('0x1c')]?_[_0xa80d('0x1d')](_0x34bd62['include'],function(_0x584614){return{'model':db[_0x584614['model']],'as':_0x584614['as'],'attributes':_0x584614[_0xa80d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa80d('0xd')](function(_0x1bd8a9){logger[_0xa80d('0x16')]('ShowSound',_0x3e2657);logger[_0xa80d('0x10')](_0xa80d('0x1e'),_0x3e2657,JSON[_0xa80d('0x12')](_0x1bd8a9));_0x2032aa(_0x1bd8a9);})[_0xa80d('0x1f')](function(_0x416aaf){logger['error'](_0xa80d('0x1e'),_0x416aaf[_0xa80d('0x15')],_0x3e2657);_0x5c7b33(_0x48990a[_0xa80d('0x13')](0x1f4,_0x416aaf['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7e40ca7..5616f79 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x54bc5a,_0x4dc466){var _0x50ec1d=function(_0x414a45){while(--_0x414a45){_0x54bc5a['push'](_0x54bc5a['shift']());}};_0x50ec1d(++_0x4dc466);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x11dde4,_0x1d4852){var _0x6eea94=function(_0x182859){while(--_0x182859){_0x11dde4['push'](_0x11dde4['shift']());}};_0x6eea94(++_0x1d4852);}(_0x8603,0x190));var _0x3860=function(_0x1fbafd,_0x1ba0a5){_0x1fbafd=_0x1fbafd-0x0;var _0x2ccceb=_0x8603[_0x1fbafd];return _0x2ccceb;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0eaef04..dac0ab8 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 _0x6197=['out','exports','STRING','TEXT','medium','ENUM'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x6197,0xfd));var _0x7619=function(_0x36afe0,_0x23a089){_0x36afe0=_0x36afe0-0x0;var _0x247997=_0x6197[_0x36afe0];return _0x247997;};'use strict';var Sequelize=require('sequelize');module[_0x7619('0x0')]={'uniqueid':{'type':Sequelize[_0x7619('0x1')]},'body':{'type':Sequelize[_0x7619('0x2')](_0x7619('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x7619('0x4')]('in','out'),'defaultValue':_0x7619('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7619('0x1')]},'providerResponse':{'type':Sequelize[_0x7619('0x2')]}}; \ No newline at end of file +var _0x71df=['ENUM','STRING','TEXT'];(function(_0x1acabc,_0x2a41d6){var _0x425424=function(_0xe78aee){while(--_0xe78aee){_0x1acabc['push'](_0x1acabc['shift']());}};_0x425424(++_0x2a41d6);}(_0x71df,0x17e));var _0xf71d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71df[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf71d('0x0')]},'body':{'type':Sequelize[_0xf71d('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xf71d('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xf71d('0x0')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2608a53..440bd29 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 _0x8066=['sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','update','then','destroy','error','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util'];(function(_0x4b7d86,_0x3349bc){var _0x480c4f=function(_0x3416ce){while(--_0x3416ce){_0x4b7d86['push'](_0x4b7d86['shift']());}};_0x480c4f(++_0x3349bc);}(_0x8066,0x192));var _0x6806=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x8066[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0x6806('0x0'));var rimraf=require(_0x6806('0x1'));var zipdir=require(_0x6806('0x2'));var jsonpatch=require(_0x6806('0x3'));var rp=require(_0x6806('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6806('0x5'));var path=require('path');var sox=require(_0x6806('0x6'));var csv=require(_0x6806('0x7'));var ejs=require(_0x6806('0x8'));var fs=require('fs');var fs_extra=require(_0x6806('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6806('0xa'));var jsforce=require(_0x6806('0xb'));var deskjs=require(_0x6806('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6806('0xd'));var Papa=require(_0x6806('0xe'));var Redis=require('ioredis');var authService=require(_0x6806('0xf'));var qs=require(_0x6806('0x10'));var as=require(_0x6806('0x11'));var hardwareService=require(_0x6806('0x12'));var logger=require('../../config/logger')(_0x6806('0x13'));var utils=require(_0x6806('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13ea22,_0x5cee27){_0x5cee27=_0x5cee27||0xcc;return function(_0x4e6f0c){if(_0x4e6f0c){return _0x13ea22[_0x6806('0x15')](_0x5cee27);}return _0x13ea22[_0x6806('0x16')](_0x5cee27)[_0x6806('0x17')]();};}function respondWithResult(_0x307bde,_0x57682d){_0x57682d=_0x57682d||0xc8;return function(_0x162b71){if(_0x162b71){return _0x307bde[_0x6806('0x16')](_0x57682d)[_0x6806('0x18')](_0x162b71);}};}function respondWithFilteredResult(_0x1349a1,_0xeb02ab){return function(_0x3a2b45){if(_0x3a2b45){var _0xf74c17=typeof _0xeb02ab['offset']===_0x6806('0x19')&&typeof _0xeb02ab[_0x6806('0x1a')]===_0x6806('0x19');var _0x5caa19=_0x3a2b45['count'];var _0x32da07=_0xf74c17?0x0:_0xeb02ab[_0x6806('0x1b')];var _0x26f381=_0xf74c17?_0x3a2b45[_0x6806('0x1c')]:_0xeb02ab[_0x6806('0x1b')]+_0xeb02ab[_0x6806('0x1a')];var _0x218b2d;if(_0x26f381>=_0x5caa19){_0x26f381=_0x5caa19;_0x218b2d=0xc8;}else{_0x218b2d=0xce;}_0x1349a1[_0x6806('0x16')](_0x218b2d);return _0x1349a1['set'](_0x6806('0x1d'),_0x32da07+'-'+_0x26f381+'/'+_0x5caa19)[_0x6806('0x18')](_0x3a2b45);}return null;};}function patchUpdates(_0x3db6df){return function(_0x3ae33e){try{jsonpatch['apply'](_0x3ae33e,_0x3db6df,!![]);}catch(_0x2e51a7){return BPromise[_0x6806('0x1e')](_0x2e51a7);}return _0x3ae33e[_0x6806('0x1f')]();};}function saveUpdates(_0xfcb904,_0x20cb74){return function(_0x18ffd6){if(_0x18ffd6){return _0x18ffd6[_0x6806('0x20')](_0xfcb904)[_0x6806('0x21')](function(_0x184a17){return _0x184a17;});}return null;};}function removeEntity(_0x14bf72,_0x19c563){return function(_0x1b83f1){if(_0x1b83f1){return _0x1b83f1[_0x6806('0x22')]()[_0x6806('0x21')](function(){_0x14bf72[_0x6806('0x16')](0xcc)[_0x6806('0x17')]();});}};}function handleEntityNotFound(_0x59ba2a,_0x2f882c){return function(_0x5450a4){if(!_0x5450a4){_0x59ba2a[_0x6806('0x15')](0x194);}return _0x5450a4;};}function handleError(_0x12efd3,_0x14bc35){_0x14bc35=_0x14bc35||0x1f4;return function(_0x468f10){logger[_0x6806('0x23')](_0x468f10['stack']);if(_0x468f10['name']){delete _0x468f10['name'];}_0x12efd3['status'](_0x14bc35)[_0x6806('0x24')](_0x468f10);};}exports[_0x6806('0x25')]=function(_0xb67058,_0x3c85d8){var _0x41a0b5={},_0x37ff36={},_0x31da70={'count':0x0,'rows':[]};var _0x7ecaea=_['map'](db[_0x6806('0x26')][_0x6806('0x27')],function(_0x3f4358){return{'name':_0x3f4358[_0x6806('0x28')],'type':_0x3f4358[_0x6806('0x29')][_0x6806('0x2a')]};});_0x37ff36[_0x6806('0x2b')]=_[_0x6806('0x2c')](_0x7ecaea,_0x6806('0x2d'));_0x37ff36[_0x6806('0x2e')]=_[_0x6806('0x2f')](_0xb67058['query']);_0x37ff36[_0x6806('0x30')]=_[_0x6806('0x31')](_0x37ff36[_0x6806('0x2b')],_0x37ff36[_0x6806('0x2e')]);_0x41a0b5['attributes']=_[_0x6806('0x31')](_0x37ff36[_0x6806('0x2b')],qs['fields'](_0xb67058[_0x6806('0x2e')][_0x6806('0x32')]));_0x41a0b5[_0x6806('0x33')]=_0x41a0b5[_0x6806('0x33')][_0x6806('0x34')]?_0x41a0b5[_0x6806('0x33')]:_0x37ff36[_0x6806('0x2b')];if(!_0xb67058[_0x6806('0x2e')]['hasOwnProperty'](_0x6806('0x35'))){_0x41a0b5['limit']=qs['limit'](_0xb67058[_0x6806('0x2e')][_0x6806('0x1a')]);_0x41a0b5[_0x6806('0x1b')]=qs['offset'](_0xb67058['query'][_0x6806('0x1b')]);}_0x41a0b5['order']=qs[_0x6806('0x36')](_0xb67058['query'][_0x6806('0x36')]);_0x41a0b5[_0x6806('0x37')]=qs[_0x6806('0x30')](_['pick'](_0xb67058[_0x6806('0x2e')],_0x37ff36['filters']),_0x7ecaea);if(_0xb67058['query'][_0x6806('0x38')]){_0x41a0b5[_0x6806('0x37')]=_[_0x6806('0x39')](_0x41a0b5['where'],{'$or':_[_0x6806('0x2c')](_0x7ecaea,function(_0x159165){if(_0x159165[_0x6806('0x29')]!=='VIRTUAL'){var _0xf145a7={};_0xf145a7[_0x159165[_0x6806('0x2d')]]={'$like':'%'+_0xb67058[_0x6806('0x2e')][_0x6806('0x38')]+'%'};return _0xf145a7;}})});}_0x41a0b5=_[_0x6806('0x39')]({},_0x41a0b5,_0xb67058[_0x6806('0x3a')]);var _0x5a632e={'where':_0x41a0b5[_0x6806('0x37')]};return db['SquareMessage'][_0x6806('0x1c')](_0x5a632e)[_0x6806('0x21')](function(_0x20a2d2){_0x31da70[_0x6806('0x1c')]=_0x20a2d2;if(_0xb67058[_0x6806('0x2e')][_0x6806('0x3b')]){_0x41a0b5['include']=[{'all':!![]}];}return db[_0x6806('0x26')][_0x6806('0x3c')](_0x41a0b5);})[_0x6806('0x21')](function(_0x108eef){_0x31da70['rows']=_0x108eef;return _0x31da70;})[_0x6806('0x21')](respondWithFilteredResult(_0x3c85d8,_0x41a0b5))[_0x6806('0x3d')](handleError(_0x3c85d8,null));};exports[_0x6806('0x3e')]=function(_0xcedad,_0x5bdb86){var _0x185e1b={'raw':!![],'where':{'id':_0xcedad[_0x6806('0x3f')]['id']}},_0xa7c3={};_0xa7c3[_0x6806('0x2b')]=_['keys'](db[_0x6806('0x26')]['rawAttributes']);_0xa7c3['query']=_[_0x6806('0x2f')](_0xcedad[_0x6806('0x2e')]);_0xa7c3[_0x6806('0x30')]=_['intersection'](_0xa7c3[_0x6806('0x2b')],_0xa7c3['query']);_0x185e1b[_0x6806('0x33')]=_[_0x6806('0x31')](_0xa7c3[_0x6806('0x2b')],qs[_0x6806('0x32')](_0xcedad['query'][_0x6806('0x32')]));_0x185e1b[_0x6806('0x33')]=_0x185e1b[_0x6806('0x33')][_0x6806('0x34')]?_0x185e1b[_0x6806('0x33')]:_0xa7c3[_0x6806('0x2b')];if(_0xcedad[_0x6806('0x2e')][_0x6806('0x3b')]){_0x185e1b[_0x6806('0x40')]=[{'all':!![]}];}_0x185e1b=_['merge']({},_0x185e1b,_0xcedad[_0x6806('0x3a')]);return db['SquareMessage'][_0x6806('0x41')](_0x185e1b)[_0x6806('0x21')](handleEntityNotFound(_0x5bdb86,null))[_0x6806('0x21')](respondWithResult(_0x5bdb86,null))['catch'](handleError(_0x5bdb86,null));};exports['create']=function(_0x499444,_0x388442){return db[_0x6806('0x26')][_0x6806('0x42')](_0x499444[_0x6806('0x43')],{})[_0x6806('0x21')](respondWithResult(_0x388442,0xc9))[_0x6806('0x3d')](handleError(_0x388442,null));};exports[_0x6806('0x20')]=function(_0x1ffaca,_0x52537e){if(_0x1ffaca[_0x6806('0x43')]['id']){delete _0x1ffaca['body']['id'];}return db[_0x6806('0x26')][_0x6806('0x41')]({'where':{'id':_0x1ffaca[_0x6806('0x3f')]['id']}})[_0x6806('0x21')](handleEntityNotFound(_0x52537e,null))[_0x6806('0x21')](saveUpdates(_0x1ffaca[_0x6806('0x43')],null))[_0x6806('0x21')](respondWithResult(_0x52537e,null))[_0x6806('0x3d')](handleError(_0x52537e,null));};exports[_0x6806('0x22')]=function(_0x53f192,_0x391598){return db[_0x6806('0x26')][_0x6806('0x41')]({'where':{'id':_0x53f192[_0x6806('0x3f')]['id']}})[_0x6806('0x21')](handleEntityNotFound(_0x391598,null))[_0x6806('0x21')](removeEntity(_0x391598,null))[_0x6806('0x3d')](handleError(_0x391598,null));}; \ No newline at end of file +var _0xc264=['end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','map','SquareMessage','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','length','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2312db,_0x3c7c92){var _0x4a3c64=function(_0x59c96a){while(--_0x59c96a){_0x2312db['push'](_0x2312db['shift']());}};_0x4a3c64(++_0x3c7c92);}(_0xc264,0x1a6));var _0x4c26=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0xc264[_0x81e39d];return _0x548fbb;};'use strict';var emlformat=require(_0x4c26('0x0'));var rimraf=require(_0x4c26('0x1'));var zipdir=require(_0x4c26('0x2'));var jsonpatch=require(_0x4c26('0x3'));var rp=require(_0x4c26('0x4'));var moment=require(_0x4c26('0x5'));var BPromise=require(_0x4c26('0x6'));var Mustache=require(_0x4c26('0x7'));var util=require(_0x4c26('0x8'));var path=require('path');var sox=require(_0x4c26('0x9'));var csv=require(_0x4c26('0xa'));var ejs=require(_0x4c26('0xb'));var fs=require('fs');var fs_extra=require(_0x4c26('0xc'));var _=require(_0x4c26('0xd'));var squel=require('squel');var crypto=require(_0x4c26('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4c26('0xf'));var toCsv=require(_0x4c26('0xa'));var querystring=require(_0x4c26('0x10'));var Papa=require(_0x4c26('0x11'));var Redis=require(_0x4c26('0x12'));var authService=require(_0x4c26('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4c26('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4c26('0x15'));var utils=require(_0x4c26('0x16'));var config=require(_0x4c26('0x17'));var licenseUtil=require(_0x4c26('0x18'));var db=require(_0x4c26('0x19'))['db'];function respondWithStatusCode(_0x2e819d,_0x49a9a5){_0x49a9a5=_0x49a9a5||0xcc;return function(_0xd6e9dc){if(_0xd6e9dc){return _0x2e819d[_0x4c26('0x1a')](_0x49a9a5);}return _0x2e819d[_0x4c26('0x1b')](_0x49a9a5)[_0x4c26('0x1c')]();};}function respondWithResult(_0x9477e7,_0x2183cd){_0x2183cd=_0x2183cd||0xc8;return function(_0x2013dd){if(_0x2013dd){return _0x9477e7['status'](_0x2183cd)[_0x4c26('0x1d')](_0x2013dd);}};}function respondWithFilteredResult(_0x565772,_0x26cf4d){return function(_0x57c8a2){if(_0x57c8a2){var _0x6cb9c3=typeof _0x26cf4d[_0x4c26('0x1e')]===_0x4c26('0x1f')&&typeof _0x26cf4d[_0x4c26('0x20')]===_0x4c26('0x1f');var _0x5c9511=_0x57c8a2['count'];var _0x4bc348=_0x6cb9c3?0x0:_0x26cf4d['offset'];var _0x368cde=_0x6cb9c3?_0x57c8a2[_0x4c26('0x21')]:_0x26cf4d[_0x4c26('0x1e')]+_0x26cf4d[_0x4c26('0x20')];var _0x5183bc;if(_0x368cde>=_0x5c9511){_0x368cde=_0x5c9511;_0x5183bc=0xc8;}else{_0x5183bc=0xce;}_0x565772[_0x4c26('0x1b')](_0x5183bc);return _0x565772[_0x4c26('0x22')]('Content-Range',_0x4bc348+'-'+_0x368cde+'/'+_0x5c9511)[_0x4c26('0x1d')](_0x57c8a2);}return null;};}function patchUpdates(_0x2fca53){return function(_0x561a4c){try{jsonpatch[_0x4c26('0x23')](_0x561a4c,_0x2fca53,!![]);}catch(_0x4e39a2){return BPromise['reject'](_0x4e39a2);}return _0x561a4c[_0x4c26('0x24')]();};}function saveUpdates(_0x2f8e0e,_0x16eca3){return function(_0x3031f1){if(_0x3031f1){return _0x3031f1[_0x4c26('0x25')](_0x2f8e0e)[_0x4c26('0x26')](function(_0x5d5d5d){return _0x5d5d5d;});}return null;};}function removeEntity(_0xf90f8f,_0x3bb44c){return function(_0x64efe4){if(_0x64efe4){return _0x64efe4[_0x4c26('0x27')]()[_0x4c26('0x26')](function(){_0xf90f8f[_0x4c26('0x1b')](0xcc)[_0x4c26('0x1c')]();});}};}function handleEntityNotFound(_0xf081d0,_0x2b2b9a){return function(_0x394676){if(!_0x394676){_0xf081d0[_0x4c26('0x1a')](0x194);}return _0x394676;};}function handleError(_0x373215,_0x52745a){_0x52745a=_0x52745a||0x1f4;return function(_0x3e684a){logger[_0x4c26('0x28')](_0x3e684a[_0x4c26('0x29')]);if(_0x3e684a[_0x4c26('0x2a')]){delete _0x3e684a['name'];}_0x373215[_0x4c26('0x1b')](_0x52745a)[_0x4c26('0x2b')](_0x3e684a);};}exports['index']=function(_0x580ef7,_0x2810be){var _0x333770={},_0x4b68fb={},_0x4812fe={'count':0x0,'rows':[]};var _0x2736f8=_[_0x4c26('0x2c')](db[_0x4c26('0x2d')]['rawAttributes'],function(_0x7ae97c){return{'name':_0x7ae97c[_0x4c26('0x2e')],'type':_0x7ae97c[_0x4c26('0x2f')]['key']};});_0x4b68fb['model']=_[_0x4c26('0x2c')](_0x2736f8,'name');_0x4b68fb[_0x4c26('0x30')]=_[_0x4c26('0x31')](_0x580ef7[_0x4c26('0x30')]);_0x4b68fb[_0x4c26('0x32')]=_[_0x4c26('0x33')](_0x4b68fb[_0x4c26('0x34')],_0x4b68fb['query']);_0x333770[_0x4c26('0x35')]=_[_0x4c26('0x33')](_0x4b68fb[_0x4c26('0x34')],qs[_0x4c26('0x36')](_0x580ef7['query'][_0x4c26('0x36')]));_0x333770[_0x4c26('0x35')]=_0x333770['attributes']['length']?_0x333770[_0x4c26('0x35')]:_0x4b68fb[_0x4c26('0x34')];if(!_0x580ef7[_0x4c26('0x30')]['hasOwnProperty'](_0x4c26('0x37'))){_0x333770[_0x4c26('0x20')]=qs['limit'](_0x580ef7[_0x4c26('0x30')][_0x4c26('0x20')]);_0x333770[_0x4c26('0x1e')]=qs['offset'](_0x580ef7[_0x4c26('0x30')][_0x4c26('0x1e')]);}_0x333770[_0x4c26('0x38')]=qs[_0x4c26('0x39')](_0x580ef7[_0x4c26('0x30')][_0x4c26('0x39')]);_0x333770[_0x4c26('0x3a')]=qs[_0x4c26('0x32')](_[_0x4c26('0x3b')](_0x580ef7['query'],_0x4b68fb[_0x4c26('0x32')]),_0x2736f8);if(_0x580ef7[_0x4c26('0x30')][_0x4c26('0x3c')]){_0x333770[_0x4c26('0x3a')]=_[_0x4c26('0x3d')](_0x333770[_0x4c26('0x3a')],{'$or':_[_0x4c26('0x2c')](_0x2736f8,function(_0x3909ca){if(_0x3909ca[_0x4c26('0x2f')]!==_0x4c26('0x3e')){var _0x2de155={};_0x2de155[_0x3909ca[_0x4c26('0x2a')]]={'$like':'%'+_0x580ef7[_0x4c26('0x30')][_0x4c26('0x3c')]+'%'};return _0x2de155;}})});}_0x333770=_['merge']({},_0x333770,_0x580ef7[_0x4c26('0x3f')]);var _0x4fd2dd={'where':_0x333770['where']};return db['SquareMessage'][_0x4c26('0x21')](_0x4fd2dd)[_0x4c26('0x26')](function(_0xb956dc){_0x4812fe[_0x4c26('0x21')]=_0xb956dc;if(_0x580ef7[_0x4c26('0x30')]['includeAll']){_0x333770[_0x4c26('0x40')]=[{'all':!![]}];}return db[_0x4c26('0x2d')][_0x4c26('0x41')](_0x333770);})['then'](function(_0x563426){_0x4812fe['rows']=_0x563426;return _0x4812fe;})[_0x4c26('0x26')](respondWithFilteredResult(_0x2810be,_0x333770))['catch'](handleError(_0x2810be,null));};exports[_0x4c26('0x42')]=function(_0x5af6ad,_0x59653a){var _0x3358dd={'raw':!![],'where':{'id':_0x5af6ad[_0x4c26('0x43')]['id']}},_0x3b96f2={};_0x3b96f2[_0x4c26('0x34')]=_[_0x4c26('0x31')](db[_0x4c26('0x2d')][_0x4c26('0x44')]);_0x3b96f2['query']=_['keys'](_0x5af6ad[_0x4c26('0x30')]);_0x3b96f2[_0x4c26('0x32')]=_[_0x4c26('0x33')](_0x3b96f2['model'],_0x3b96f2[_0x4c26('0x30')]);_0x3358dd[_0x4c26('0x35')]=_[_0x4c26('0x33')](_0x3b96f2[_0x4c26('0x34')],qs[_0x4c26('0x36')](_0x5af6ad[_0x4c26('0x30')][_0x4c26('0x36')]));_0x3358dd[_0x4c26('0x35')]=_0x3358dd['attributes'][_0x4c26('0x45')]?_0x3358dd[_0x4c26('0x35')]:_0x3b96f2['model'];if(_0x5af6ad[_0x4c26('0x30')][_0x4c26('0x46')]){_0x3358dd[_0x4c26('0x40')]=[{'all':!![]}];}_0x3358dd=_[_0x4c26('0x3d')]({},_0x3358dd,_0x5af6ad[_0x4c26('0x3f')]);return db[_0x4c26('0x2d')][_0x4c26('0x47')](_0x3358dd)[_0x4c26('0x26')](handleEntityNotFound(_0x59653a,null))[_0x4c26('0x26')](respondWithResult(_0x59653a,null))[_0x4c26('0x48')](handleError(_0x59653a,null));};exports[_0x4c26('0x49')]=function(_0x1484ec,_0x3f9110){return db[_0x4c26('0x2d')][_0x4c26('0x49')](_0x1484ec[_0x4c26('0x4a')],{})['then'](respondWithResult(_0x3f9110,0xc9))['catch'](handleError(_0x3f9110,null));};exports[_0x4c26('0x25')]=function(_0x1db1da,_0x1b192b){if(_0x1db1da[_0x4c26('0x4a')]['id']){delete _0x1db1da['body']['id'];}return db[_0x4c26('0x2d')][_0x4c26('0x47')]({'where':{'id':_0x1db1da['params']['id']}})[_0x4c26('0x26')](handleEntityNotFound(_0x1b192b,null))[_0x4c26('0x26')](saveUpdates(_0x1db1da[_0x4c26('0x4a')],null))[_0x4c26('0x26')](respondWithResult(_0x1b192b,null))[_0x4c26('0x48')](handleError(_0x1b192b,null));};exports[_0x4c26('0x27')]=function(_0x2116eb,_0x273be7){return db[_0x4c26('0x2d')][_0x4c26('0x47')]({'where':{'id':_0x2116eb[_0x4c26('0x43')]['id']}})[_0x4c26('0x26')](handleEntityNotFound(_0x273be7,null))[_0x4c26('0x26')](removeEntity(_0x273be7,null))[_0x4c26('0x48')](handleError(_0x273be7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index a350c2b..309fa1d 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 _0x831c=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage'];(function(_0x4c4824,_0x42e0f6){var _0x185eb1=function(_0x12831c){while(--_0x12831c){_0x4c4824['push'](_0x4c4824['shift']());}};_0x185eb1(++_0x42e0f6);}(_0x831c,0x172));var _0xc831=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x831c[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0xc831('0x0'));var util=require(_0xc831('0x1'));var logger=require('../../config/logger')(_0xc831('0x2'));var moment=require(_0xc831('0x3'));var BPromise=require(_0xc831('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc831('0x5'));var rimraf=require(_0xc831('0x6'));var config=require(_0xc831('0x7'));var attributes=require(_0xc831('0x8'));module['exports']=function(_0x204bf9,_0x4d3b9a){return _0x204bf9['define'](_0xc831('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0d=['api','bluebird','path','rimraf','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x0b0d,0x1ec));var _0xd0b0=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0b0d[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xd0b0('0x0'));var util=require(_0xd0b0('0x1'));var logger=require(_0xd0b0('0x2'))(_0xd0b0('0x3'));var moment=require('moment');var BPromise=require(_0xd0b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0b0('0x5'));var rimraf=require(_0xd0b0('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xd0b0('0x7')]=function(_0x31d8f5,_0x474a35){return _0x31d8f5[_0xd0b0('0x8')](_0xd0b0('0x9'),attributes,{'tableName':_0xd0b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 524c1e2..24bc5d8 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 _0x05f9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','lodash','util'];(function(_0x373e7e,_0x3af2df){var _0x419a01=function(_0x51a18f){while(--_0x51a18f){_0x373e7e['push'](_0x373e7e['shift']());}};_0x419a01(++_0x3af2df);}(_0x05f9,0x1a2));var _0x905f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x05f9[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x905f('0x0'));var util=require(_0x905f('0x1'));var moment=require(_0x905f('0x2'));var BPromise=require(_0x905f('0x3'));var rs=require(_0x905f('0x4'));var fs=require('fs');var Redis=require(_0x905f('0x5'));var db=require(_0x905f('0x6'))['db'];var utils=require(_0x905f('0x7'));var logger=require(_0x905f('0x8'))(_0x905f('0x9'));var config=require(_0x905f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x905f('0xb')][_0x905f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x377b87,_0x4e33cd,_0xb818cb){return new BPromise(function(_0x446a3b,_0x3732a4){return client[_0x905f('0xd')](_0x377b87,_0xb818cb)[_0x905f('0xe')](function(_0x40b496){logger[_0x905f('0xf')](_0x905f('0x10'),_0x4e33cd,_0x905f('0x11'));logger[_0x905f('0x12')](_0x905f('0x13'),_0x4e33cd,_0x905f('0x11'),JSON[_0x905f('0x14')](_0x40b496));if(_0x40b496['error']){if(_0x40b496[_0x905f('0x15')]['code']===0x1f4){logger[_0x905f('0x15')](_0x905f('0x10'),_0x4e33cd,_0x40b496['error'][_0x905f('0x16')]);return _0x3732a4(_0x40b496[_0x905f('0x15')]['message']);}logger[_0x905f('0x15')](_0x905f('0x10'),_0x4e33cd,_0x40b496['error'][_0x905f('0x16')]);return _0x446a3b(_0x40b496[_0x905f('0x15')][_0x905f('0x16')]);}else{logger[_0x905f('0xf')]('SquareMessage,\x20%s,\x20%s',_0x4e33cd,'request\x20sent');_0x446a3b(_0x40b496[_0x905f('0x17')][_0x905f('0x16')]);}})[_0x905f('0x18')](function(_0x2d90bf){logger[_0x905f('0x15')]('SquareMessage,\x20%s,\x20%s',_0x4e33cd,_0x2d90bf);_0x3732a4(_0x2d90bf);});});}exports[_0x905f('0x19')]=function(_0x9cc670){var _0x4b9fbf=this;return new Promise(function(_0x1c885e,_0x455855){return db[_0x905f('0x1a')]['create'](_0x9cc670[_0x905f('0x1b')],{'raw':_0x9cc670['options']?_0x9cc670[_0x905f('0x1c')][_0x905f('0x1d')]===undefined?!![]:![]:!![]})[_0x905f('0xe')](function(_0x2f5f9b){logger[_0x905f('0xf')](_0x905f('0x19'),_0x9cc670);logger[_0x905f('0x12')](_0x905f('0x19'),_0x9cc670,JSON[_0x905f('0x14')](_0x2f5f9b));_0x1c885e(_0x2f5f9b);})[_0x905f('0x18')](function(_0x48f6ba){logger[_0x905f('0x15')](_0x905f('0x19'),_0x48f6ba[_0x905f('0x16')],_0x9cc670);_0x455855(_0x4b9fbf[_0x905f('0x15')](0x1f4,_0x48f6ba[_0x905f('0x16')]));});});}; \ No newline at end of file +var _0x1c38=['CreateSquareMessage','SquareMessage','create','body','options','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x463a03,_0x13914f){var _0x5baa30=function(_0xa6d459){while(--_0xa6d459){_0x463a03['push'](_0x463a03['shift']());}};_0x5baa30(++_0x13914f);}(_0x1c38,0xe6));var _0x81c3=function(_0x3550e8,_0x424fea){_0x3550e8=_0x3550e8-0x0;var _0x18eb61=_0x1c38[_0x3550e8];return _0x18eb61;};'use strict';var _=require('lodash');var util=require(_0x81c3('0x0'));var moment=require(_0x81c3('0x1'));var BPromise=require(_0x81c3('0x2'));var rs=require(_0x81c3('0x3'));var fs=require('fs');var Redis=require(_0x81c3('0x4'));var db=require(_0x81c3('0x5'))['db'];var utils=require(_0x81c3('0x6'));var logger=require(_0x81c3('0x7'))('rpc');var config=require(_0x81c3('0x8'));var jayson=require(_0x81c3('0x9'));var client=jayson[_0x81c3('0xa')][_0x81c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x131ccd,_0x404875,_0x4dace9){return new BPromise(function(_0x21a4ac,_0x56f26d){return client['request'](_0x131ccd,_0x4dace9)[_0x81c3('0xc')](function(_0x2941b6){logger[_0x81c3('0xd')](_0x81c3('0xe'),_0x404875,'request\x20sent');logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x404875,_0x81c3('0xf'),JSON[_0x81c3('0x10')](_0x2941b6));if(_0x2941b6['error']){if(_0x2941b6[_0x81c3('0x11')][_0x81c3('0x12')]===0x1f4){logger[_0x81c3('0x11')]('SquareMessage,\x20%s,\x20%s',_0x404875,_0x2941b6['error'][_0x81c3('0x13')]);return _0x56f26d(_0x2941b6['error'][_0x81c3('0x13')]);}logger['error'](_0x81c3('0xe'),_0x404875,_0x2941b6[_0x81c3('0x11')][_0x81c3('0x13')]);return _0x21a4ac(_0x2941b6['error'][_0x81c3('0x13')]);}else{logger[_0x81c3('0xd')](_0x81c3('0xe'),_0x404875,_0x81c3('0xf'));_0x21a4ac(_0x2941b6[_0x81c3('0x14')][_0x81c3('0x13')]);}})[_0x81c3('0x15')](function(_0x40ed87){logger[_0x81c3('0x11')](_0x81c3('0xe'),_0x404875,_0x40ed87);_0x56f26d(_0x40ed87);});});}exports[_0x81c3('0x16')]=function(_0x2d7d15){var _0x33d98e=this;return new Promise(function(_0x17d20d,_0x257f68){return db[_0x81c3('0x17')][_0x81c3('0x18')](_0x2d7d15[_0x81c3('0x19')],{'raw':_0x2d7d15[_0x81c3('0x1a')]?_0x2d7d15[_0x81c3('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x81c3('0xc')](function(_0x12cfa3){logger[_0x81c3('0xd')]('CreateSquareMessage',_0x2d7d15);logger[_0x81c3('0x1b')](_0x81c3('0x16'),_0x2d7d15,JSON[_0x81c3('0x10')](_0x12cfa3));_0x17d20d(_0x12cfa3);})['catch'](function(_0x7239a9){logger[_0x81c3('0x11')](_0x81c3('0x16'),_0x7239a9[_0x81c3('0x13')],_0x2d7d15);_0x257f68(_0x33d98e[_0x81c3('0x11')](0x1f4,_0x7239a9[_0x81c3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 11cc327..eec0216 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 _0x23bf=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareOdbc.controller','get','isAuthenticated','/:id/test','15s','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x39d7bc,_0x34b1ea){var _0x3706a6=function(_0x23fa2a){while(--_0x23fa2a){_0x39d7bc['push'](_0x39d7bc['shift']());}};_0x3706a6(++_0x34b1ea);}(_0x23bf,0x168));var _0xf23b=function(_0x5f2366,_0x54b340){_0x5f2366=_0x5f2366-0x0;var _0x16bc00=_0x23bf[_0x5f2366];return _0x16bc00;};'use strict';var multer=require('multer');var util=require(_0xf23b('0x0'));var path=require(_0xf23b('0x1'));var timeout=require(_0xf23b('0x2'));var express=require(_0xf23b('0x3'));var router=express[_0xf23b('0x4')]();var fs_extra=require(_0xf23b('0x5'));var auth=require(_0xf23b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf23b('0x7'));router[_0xf23b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf23b('0x8')]('/:id',auth[_0xf23b('0x9')](),controller['show']);router[_0xf23b('0x8')](_0xf23b('0xa'),auth[_0xf23b('0x9')](),timeout(_0xf23b('0xb')),controller['test']);router[_0xf23b('0xc')]('/',auth['isAuthenticated'](),controller[_0xf23b('0xd')]);router[_0xf23b('0xe')]('/:id',auth[_0xf23b('0x9')](),controller[_0xf23b('0xf')]);router[_0xf23b('0x10')](_0xf23b('0x11'),auth['isAuthenticated'](),controller[_0xf23b('0x12')]);module[_0xf23b('0x13')]=router; \ No newline at end of file +var _0x7b6c=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','isAuthenticated','show','/:id/test','15s','post','put','/:id','update','destroy','multer'];(function(_0x519b55,_0x1597a7){var _0x5baf3d=function(_0x5d3901){while(--_0x5d3901){_0x519b55['push'](_0x519b55['shift']());}};_0x5baf3d(++_0x1597a7);}(_0x7b6c,0x14f));var _0xc7b6=function(_0x301fe0,_0x53eb58){_0x301fe0=_0x301fe0-0x0;var _0x5dd27d=_0x7b6c[_0x301fe0];return _0x5dd27d;};'use strict';var multer=require(_0xc7b6('0x0'));var util=require(_0xc7b6('0x1'));var path=require(_0xc7b6('0x2'));var timeout=require(_0xc7b6('0x3'));var express=require(_0xc7b6('0x4'));var router=express[_0xc7b6('0x5')]();var fs_extra=require(_0xc7b6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc7b6('0x7'));var config=require(_0xc7b6('0x8'));var controller=require(_0xc7b6('0x9'));router[_0xc7b6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc7b6('0xb')]);router[_0xc7b6('0xa')]('/:id',auth[_0xc7b6('0xc')](),controller[_0xc7b6('0xd')]);router[_0xc7b6('0xa')](_0xc7b6('0xe'),auth[_0xc7b6('0xc')](),timeout(_0xc7b6('0xf')),controller['test']);router[_0xc7b6('0x10')]('/',auth[_0xc7b6('0xc')](),controller['create']);router[_0xc7b6('0x11')](_0xc7b6('0x12'),auth[_0xc7b6('0xc')](),controller[_0xc7b6('0x13')]);router['delete'](_0xc7b6('0x12'),auth[_0xc7b6('0xc')](),controller[_0xc7b6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d491d19..1366d51 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 _0x4891=['STRING','sequelize','name'];(function(_0x598184,_0x1fadb3){var _0x311be3=function(_0x395d77){while(--_0x395d77){_0x598184['push'](_0x598184['shift']());}};_0x311be3(++_0x1fadb3);}(_0x4891,0xe8));var _0x1489=function(_0x39deac,_0x50ac0d){_0x39deac=_0x39deac-0x0;var _0x2d6ebf=_0x4891[_0x39deac];return _0x2d6ebf;};'use strict';var Sequelize=require(_0x1489('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1489('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1489('0x2')]}}; \ No newline at end of file +var _0xefc9=['sequelize','STRING'];(function(_0x4b742c,_0x1ebc46){var _0x926a8=function(_0x1aa470){while(--_0x1aa470){_0x4b742c['push'](_0x4b742c['shift']());}};_0x926a8(++_0x1ebc46);}(_0xefc9,0xa0));var _0x9efc=function(_0x41057d,_0x4dfdab){_0x41057d=_0x41057d-0x0;var _0x4db21e=_0xefc9[_0x41057d];return _0x4db21e;};'use strict';var Sequelize=require(_0x9efc('0x0'));module['exports']={'name':{'type':Sequelize[_0x9efc('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x9efc('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 506b746..f96dc57 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 _0x527f=['filters','intersection','fields','length','attributes','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','zip-dir','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','UserProfileResource','destroy','error','name','send','map','SquareOdbc','model','query','keys'];(function(_0x4f89eb,_0x39a0d5){var _0x4cdede=function(_0x280d9f){while(--_0x280d9f){_0x4f89eb['push'](_0x4f89eb['shift']());}};_0x4cdede(++_0x39a0d5);}(_0x527f,0xc6));var _0xf527=function(_0x2cd976,_0x4b9d7f){_0x2cd976=_0x2cd976-0x0;var _0x2560fb=_0x527f[_0x2cd976];return _0x2560fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf527('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf527('0x1'));var util=require('util');var path=require(_0xf527('0x2'));var sox=require(_0xf527('0x3'));var csv=require(_0xf527('0x4'));var ejs=require(_0xf527('0x5'));var fs=require('fs');var fs_extra=require(_0xf527('0x6'));var _=require(_0xf527('0x7'));var squel=require(_0xf527('0x8'));var crypto=require(_0xf527('0x9'));var jsforce=require(_0xf527('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf527('0x4'));var querystring=require(_0xf527('0xb'));var Papa=require(_0xf527('0xc'));var Redis=require(_0xf527('0xd'));var authService=require(_0xf527('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf527('0xf'));var hardwareService=require(_0xf527('0x10'));var logger=require(_0xf527('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf527('0x12'));var licenseUtil=require(_0xf527('0x13'));var db=require(_0xf527('0x14'))['db'];function respondWithStatusCode(_0x196020,_0x5355b4){_0x5355b4=_0x5355b4||0xcc;return function(_0x41b1ca){if(_0x41b1ca){return _0x196020[_0xf527('0x15')](_0x5355b4);}return _0x196020['status'](_0x5355b4)[_0xf527('0x16')]();};}function respondWithResult(_0xa98b87,_0x13ac01){_0x13ac01=_0x13ac01||0xc8;return function(_0x2100f9){if(_0x2100f9){return _0xa98b87[_0xf527('0x17')](_0x13ac01)[_0xf527('0x18')](_0x2100f9);}};}function respondWithFilteredResult(_0x892929,_0x2e0ed7){return function(_0x3e3c87){if(_0x3e3c87){var _0x748964=typeof _0x2e0ed7[_0xf527('0x19')]===_0xf527('0x1a')&&typeof _0x2e0ed7[_0xf527('0x1b')]===_0xf527('0x1a');var _0x40be1a=_0x3e3c87[_0xf527('0x1c')];var _0x78b1f7=_0x748964?0x0:_0x2e0ed7['offset'];var _0x342b23=_0x748964?_0x3e3c87[_0xf527('0x1c')]:_0x2e0ed7[_0xf527('0x19')]+_0x2e0ed7[_0xf527('0x1b')];var _0x3f57e7;if(_0x342b23>=_0x40be1a){_0x342b23=_0x40be1a;_0x3f57e7=0xc8;}else{_0x3f57e7=0xce;}_0x892929['status'](_0x3f57e7);return _0x892929[_0xf527('0x1d')](_0xf527('0x1e'),_0x78b1f7+'-'+_0x342b23+'/'+_0x40be1a)['json'](_0x3e3c87);}return null;};}function patchUpdates(_0x38f2a9){return function(_0x42e4b1){try{jsonpatch[_0xf527('0x1f')](_0x42e4b1,_0x38f2a9,!![]);}catch(_0x129558){return BPromise[_0xf527('0x20')](_0x129558);}return _0x42e4b1['save']();};}function saveUpdates(_0x34607c,_0x542d95){return function(_0x51f593){if(_0x51f593){return _0x51f593[_0xf527('0x21')](_0x34607c)[_0xf527('0x22')](function(_0x2911e9){return _0x2911e9;});}return null;};}function removeEntity(_0x2d09b5,_0x523c99){return function(_0x4720c7){if(_0x4720c7){return _0x4720c7['destroy']()[_0xf527('0x22')](function(){var _0x533c0b=_0x4720c7['get']({'plain':!![]});var _0x3048db='ODBC';return db[_0xf527('0x23')][_0xf527('0x24')]({'where':{'type':_0x3048db,'resourceId':_0x533c0b['id']}})[_0xf527('0x22')](function(){return _0x4720c7;});})[_0xf527('0x22')](function(){_0x2d09b5[_0xf527('0x17')](0xcc)[_0xf527('0x16')]();});}};}function handleEntityNotFound(_0x3f6391,_0x275f44){return function(_0x235a5f){if(!_0x235a5f){_0x3f6391[_0xf527('0x15')](0x194);}return _0x235a5f;};}function handleError(_0x3c5ead,_0x2845ba){_0x2845ba=_0x2845ba||0x1f4;return function(_0x424590){logger[_0xf527('0x25')](_0x424590['stack']);if(_0x424590['name']){delete _0x424590[_0xf527('0x26')];}_0x3c5ead[_0xf527('0x17')](_0x2845ba)[_0xf527('0x27')](_0x424590);};}exports['index']=function(_0x1e6c21,_0x392b79){var _0x3d7a5c={},_0x1868ef={},_0x3e699c={'count':0x0,'rows':[]};var _0x3dbcf7=_[_0xf527('0x28')](db[_0xf527('0x29')]['rawAttributes'],function(_0x3c8568){return{'name':_0x3c8568['fieldName'],'type':_0x3c8568['type']['key']};});_0x1868ef[_0xf527('0x2a')]=_[_0xf527('0x28')](_0x3dbcf7,_0xf527('0x26'));_0x1868ef[_0xf527('0x2b')]=_[_0xf527('0x2c')](_0x1e6c21[_0xf527('0x2b')]);_0x1868ef[_0xf527('0x2d')]=_['intersection'](_0x1868ef[_0xf527('0x2a')],_0x1868ef['query']);_0x3d7a5c['attributes']=_[_0xf527('0x2e')](_0x1868ef[_0xf527('0x2a')],qs[_0xf527('0x2f')](_0x1e6c21[_0xf527('0x2b')][_0xf527('0x2f')]));_0x3d7a5c['attributes']=_0x3d7a5c['attributes'][_0xf527('0x30')]?_0x3d7a5c[_0xf527('0x31')]:_0x1868ef[_0xf527('0x2a')];if(!_0x1e6c21[_0xf527('0x2b')]['hasOwnProperty']('nolimit')){_0x3d7a5c[_0xf527('0x1b')]=qs['limit'](_0x1e6c21[_0xf527('0x2b')][_0xf527('0x1b')]);_0x3d7a5c[_0xf527('0x19')]=qs['offset'](_0x1e6c21[_0xf527('0x2b')][_0xf527('0x19')]);}_0x3d7a5c['order']=qs[_0xf527('0x32')](_0x1e6c21[_0xf527('0x2b')][_0xf527('0x32')]);_0x3d7a5c[_0xf527('0x33')]=qs[_0xf527('0x2d')](_[_0xf527('0x34')](_0x1e6c21[_0xf527('0x2b')],_0x1868ef[_0xf527('0x2d')]),_0x3dbcf7);if(_0x1e6c21[_0xf527('0x2b')]['filter']){_0x3d7a5c[_0xf527('0x33')]=_['merge'](_0x3d7a5c[_0xf527('0x33')],{'$or':_[_0xf527('0x28')](_0x3dbcf7,function(_0x539b22){if(_0x539b22['type']!==_0xf527('0x35')){var _0x10c384={};_0x10c384[_0x539b22[_0xf527('0x26')]]={'$like':'%'+_0x1e6c21[_0xf527('0x2b')][_0xf527('0x36')]+'%'};return _0x10c384;}})});}_0x3d7a5c=_[_0xf527('0x37')]({},_0x3d7a5c,_0x1e6c21[_0xf527('0x38')]);var _0x265621={'where':_0x3d7a5c[_0xf527('0x33')]};return db[_0xf527('0x29')][_0xf527('0x1c')](_0x265621)['then'](function(_0x3b37c6){_0x3e699c['count']=_0x3b37c6;if(_0x1e6c21[_0xf527('0x2b')][_0xf527('0x39')]){_0x3d7a5c[_0xf527('0x3a')]=[{'all':!![]}];}return db[_0xf527('0x29')][_0xf527('0x3b')](_0x3d7a5c);})[_0xf527('0x22')](function(_0x5286fc){_0x3e699c[_0xf527('0x3c')]=_0x5286fc;return _0x3e699c;})['then'](respondWithFilteredResult(_0x392b79,_0x3d7a5c))[_0xf527('0x3d')](handleError(_0x392b79,null));};exports[_0xf527('0x3e')]=function(_0x4940d4,_0x15f2b4){var _0x346adf={'raw':!![],'where':{'id':_0x4940d4[_0xf527('0x3f')]['id']}},_0x5d5b34={};_0x5d5b34[_0xf527('0x2a')]=_['keys'](db[_0xf527('0x29')][_0xf527('0x40')]);_0x5d5b34[_0xf527('0x2b')]=_['keys'](_0x4940d4[_0xf527('0x2b')]);_0x5d5b34[_0xf527('0x2d')]=_[_0xf527('0x2e')](_0x5d5b34[_0xf527('0x2a')],_0x5d5b34['query']);_0x346adf[_0xf527('0x31')]=_[_0xf527('0x2e')](_0x5d5b34[_0xf527('0x2a')],qs[_0xf527('0x2f')](_0x4940d4['query'][_0xf527('0x2f')]));_0x346adf['attributes']=_0x346adf['attributes']['length']?_0x346adf[_0xf527('0x31')]:_0x5d5b34[_0xf527('0x2a')];if(_0x4940d4[_0xf527('0x2b')][_0xf527('0x39')]){_0x346adf[_0xf527('0x3a')]=[{'all':!![]}];}_0x346adf=_[_0xf527('0x37')]({},_0x346adf,_0x4940d4[_0xf527('0x38')]);return db[_0xf527('0x29')][_0xf527('0x41')](_0x346adf)[_0xf527('0x22')](handleEntityNotFound(_0x15f2b4,null))['then'](respondWithResult(_0x15f2b4,null))[_0xf527('0x3d')](handleError(_0x15f2b4,null));};exports[_0xf527('0x42')]=function(_0xbbc46b,_0x10470c){return db[_0xf527('0x29')]['create'](_0xbbc46b[_0xf527('0x43')],{})['then'](function(_0x30bff7){var _0x189bda=_0xbbc46b[_0xf527('0x44')][_0xf527('0x45')]({'plain':!![]});if(!_0x189bda)throw new Error(_0xf527('0x46'));if(_0x189bda[_0xf527('0x47')]===_0xf527('0x44')){var _0x4e816f=_0x30bff7[_0xf527('0x45')]({'plain':!![]});var _0x1f6192=_0xf527('0x48');return db[_0xf527('0x49')][_0xf527('0x41')]({'where':{'name':_0x1f6192,'userProfileId':_0x189bda[_0xf527('0x4a')]},'raw':!![]})[_0xf527('0x22')](function(_0x5e0df3){if(_0x5e0df3&&_0x5e0df3[_0xf527('0x4b')]===0x0){return db[_0xf527('0x23')][_0xf527('0x42')]({'name':_0x4e816f[_0xf527('0x26')],'resourceId':_0x4e816f['id'],'type':_0x5e0df3[_0xf527('0x26')],'sectionId':_0x5e0df3['id']},{})[_0xf527('0x22')](function(){return _0x30bff7;});}else{return _0x30bff7;}})[_0xf527('0x3d')](function(_0xaf61e5){logger[_0xf527('0x25')](_0xf527('0x4c'),_0xaf61e5);throw _0xaf61e5;});}return _0x30bff7;})[_0xf527('0x22')](respondWithResult(_0x10470c,0xc9))[_0xf527('0x3d')](handleError(_0x10470c,null));};exports['update']=function(_0x129e3d,_0x4f90d0){if(_0x129e3d['body']['id']){delete _0x129e3d[_0xf527('0x43')]['id'];}return db[_0xf527('0x29')][_0xf527('0x41')]({'where':{'id':_0x129e3d[_0xf527('0x3f')]['id']}})[_0xf527('0x22')](handleEntityNotFound(_0x4f90d0,null))[_0xf527('0x22')](saveUpdates(_0x129e3d[_0xf527('0x43')],null))['then'](respondWithResult(_0x4f90d0,null))[_0xf527('0x3d')](handleError(_0x4f90d0,null));};exports[_0xf527('0x24')]=function(_0x4f8ed8,_0xf2314f){return db[_0xf527('0x29')][_0xf527('0x41')]({'where':{'id':_0x4f8ed8['params']['id']}})['then'](handleEntityNotFound(_0xf2314f,null))['then'](removeEntity(_0xf2314f,null))[_0xf527('0x3d')](handleError(_0xf2314f,null));};exports[_0xf527('0x4d')]=function(_0x5c1659,_0x97125d,_0x2c987e){var _0x35746e;return db[_0xf527('0x29')][_0xf527('0x41')]({'where':{'id':_0x5c1659[_0xf527('0x3f')]['id']},'attributes':['id',_0xf527('0x4e')]})[_0xf527('0x22')](handleEntityNotFound(_0x97125d,null))[_0xf527('0x22')](function(_0x2b91c5){if(_0x2b91c5){var _0x60d5f2=require('odbc')();_0x60d5f2[_0xf527('0x4f')](_0x2b91c5[_0xf527('0x4e')]);_0x60d5f2[_0xf527('0x50')]();return _0x2b91c5;}})['then'](respondWithResult(_0x97125d,null))[_0xf527('0x3d')](handleError(_0x97125d,null));}; \ No newline at end of file +var _0x788f=['../../config/license/hardware','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','include','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x34bd11,_0x322433){var _0x2a4f5c=function(_0x3296e3){while(--_0x3296e3){_0x34bd11['push'](_0x34bd11['shift']());}};_0x2a4f5c(++_0x322433);}(_0x788f,0x13a));var _0xf788=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x788f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf788('0x0'));var zipdir=require(_0xf788('0x1'));var jsonpatch=require(_0xf788('0x2'));var rp=require(_0xf788('0x3'));var moment=require(_0xf788('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf788('0x5'));var util=require(_0xf788('0x6'));var path=require('path');var sox=require(_0xf788('0x7'));var csv=require(_0xf788('0x8'));var ejs=require(_0xf788('0x9'));var fs=require('fs');var fs_extra=require(_0xf788('0xa'));var _=require(_0xf788('0xb'));var squel=require(_0xf788('0xc'));var crypto=require(_0xf788('0xd'));var jsforce=require(_0xf788('0xe'));var deskjs=require(_0xf788('0xf'));var toCsv=require(_0xf788('0x8'));var querystring=require(_0xf788('0x10'));var Papa=require(_0xf788('0x11'));var Redis=require(_0xf788('0x12'));var authService=require(_0xf788('0x13'));var qs=require(_0xf788('0x14'));var as=require(_0xf788('0x15'));var hardwareService=require(_0xf788('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf788('0x17'));var licenseUtil=require(_0xf788('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30d48b,_0x54a1da){_0x54a1da=_0x54a1da||0xcc;return function(_0x4b0cdd){if(_0x4b0cdd){return _0x30d48b['sendStatus'](_0x54a1da);}return _0x30d48b['status'](_0x54a1da)[_0xf788('0x19')]();};}function respondWithResult(_0x2b4fd3,_0x347dac){_0x347dac=_0x347dac||0xc8;return function(_0x3f3633){if(_0x3f3633){return _0x2b4fd3[_0xf788('0x1a')](_0x347dac)[_0xf788('0x1b')](_0x3f3633);}};}function respondWithFilteredResult(_0xaa121c,_0x3df69f){return function(_0x73f31c){if(_0x73f31c){var _0x367e31=typeof _0x3df69f[_0xf788('0x1c')]===_0xf788('0x1d')&&typeof _0x3df69f['limit']===_0xf788('0x1d');var _0x36f937=_0x73f31c['count'];var _0x180188=_0x367e31?0x0:_0x3df69f['offset'];var _0x4c4eaf=_0x367e31?_0x73f31c[_0xf788('0x1e')]:_0x3df69f[_0xf788('0x1c')]+_0x3df69f[_0xf788('0x1f')];var _0x45baa4;if(_0x4c4eaf>=_0x36f937){_0x4c4eaf=_0x36f937;_0x45baa4=0xc8;}else{_0x45baa4=0xce;}_0xaa121c[_0xf788('0x1a')](_0x45baa4);return _0xaa121c[_0xf788('0x20')](_0xf788('0x21'),_0x180188+'-'+_0x4c4eaf+'/'+_0x36f937)[_0xf788('0x1b')](_0x73f31c);}return null;};}function patchUpdates(_0x436585){return function(_0x4729d5){try{jsonpatch[_0xf788('0x22')](_0x4729d5,_0x436585,!![]);}catch(_0x3bf35c){return BPromise['reject'](_0x3bf35c);}return _0x4729d5[_0xf788('0x23')]();};}function saveUpdates(_0x58f8f4,_0x1ad7d1){return function(_0x48668c){if(_0x48668c){return _0x48668c[_0xf788('0x24')](_0x58f8f4)[_0xf788('0x25')](function(_0x4d04af){return _0x4d04af;});}return null;};}function removeEntity(_0x187d74,_0x143ad9){return function(_0x5dd173){if(_0x5dd173){return _0x5dd173[_0xf788('0x26')]()[_0xf788('0x25')](function(){var _0x3ab1e0=_0x5dd173[_0xf788('0x27')]({'plain':!![]});var _0x4e82ed=_0xf788('0x28');return db[_0xf788('0x29')][_0xf788('0x26')]({'where':{'type':_0x4e82ed,'resourceId':_0x3ab1e0['id']}})[_0xf788('0x25')](function(){return _0x5dd173;});})[_0xf788('0x25')](function(){_0x187d74[_0xf788('0x1a')](0xcc)[_0xf788('0x19')]();});}};}function handleEntityNotFound(_0x47bedb,_0x5c6e6b){return function(_0x80d40e){if(!_0x80d40e){_0x47bedb['sendStatus'](0x194);}return _0x80d40e;};}function handleError(_0x35d830,_0x28075b){_0x28075b=_0x28075b||0x1f4;return function(_0x5bdc6c){logger[_0xf788('0x2a')](_0x5bdc6c[_0xf788('0x2b')]);if(_0x5bdc6c[_0xf788('0x2c')]){delete _0x5bdc6c[_0xf788('0x2c')];}_0x35d830[_0xf788('0x1a')](_0x28075b)[_0xf788('0x2d')](_0x5bdc6c);};}exports[_0xf788('0x2e')]=function(_0x2d48b2,_0xcbbcbf){var _0x58f1ca={},_0x3980b6={},_0x37f020={'count':0x0,'rows':[]};var _0x52fc4a=_['map'](db[_0xf788('0x2f')][_0xf788('0x30')],function(_0x41ec85){return{'name':_0x41ec85[_0xf788('0x31')],'type':_0x41ec85[_0xf788('0x32')][_0xf788('0x33')]};});_0x3980b6[_0xf788('0x34')]=_[_0xf788('0x35')](_0x52fc4a,_0xf788('0x2c'));_0x3980b6[_0xf788('0x36')]=_[_0xf788('0x37')](_0x2d48b2['query']);_0x3980b6['filters']=_[_0xf788('0x38')](_0x3980b6[_0xf788('0x34')],_0x3980b6['query']);_0x58f1ca[_0xf788('0x39')]=_['intersection'](_0x3980b6['model'],qs[_0xf788('0x3a')](_0x2d48b2['query'][_0xf788('0x3a')]));_0x58f1ca['attributes']=_0x58f1ca[_0xf788('0x39')][_0xf788('0x3b')]?_0x58f1ca[_0xf788('0x39')]:_0x3980b6['model'];if(!_0x2d48b2['query'][_0xf788('0x3c')](_0xf788('0x3d'))){_0x58f1ca[_0xf788('0x1f')]=qs[_0xf788('0x1f')](_0x2d48b2[_0xf788('0x36')][_0xf788('0x1f')]);_0x58f1ca['offset']=qs[_0xf788('0x1c')](_0x2d48b2[_0xf788('0x36')][_0xf788('0x1c')]);}_0x58f1ca['order']=qs[_0xf788('0x3e')](_0x2d48b2['query'][_0xf788('0x3e')]);_0x58f1ca['where']=qs['filters'](_['pick'](_0x2d48b2['query'],_0x3980b6[_0xf788('0x3f')]),_0x52fc4a);if(_0x2d48b2[_0xf788('0x36')][_0xf788('0x40')]){_0x58f1ca[_0xf788('0x41')]=_[_0xf788('0x42')](_0x58f1ca['where'],{'$or':_[_0xf788('0x35')](_0x52fc4a,function(_0xf6f34a){if(_0xf6f34a[_0xf788('0x32')]!==_0xf788('0x43')){var _0xb5b185={};_0xb5b185[_0xf6f34a['name']]={'$like':'%'+_0x2d48b2[_0xf788('0x36')][_0xf788('0x40')]+'%'};return _0xb5b185;}})});}_0x58f1ca=_[_0xf788('0x42')]({},_0x58f1ca,_0x2d48b2['options']);var _0x323f05={'where':_0x58f1ca['where']};return db[_0xf788('0x2f')][_0xf788('0x1e')](_0x323f05)[_0xf788('0x25')](function(_0x153ad1){_0x37f020[_0xf788('0x1e')]=_0x153ad1;if(_0x2d48b2['query']['includeAll']){_0x58f1ca[_0xf788('0x44')]=[{'all':!![]}];}return db[_0xf788('0x2f')]['findAll'](_0x58f1ca);})[_0xf788('0x25')](function(_0x1ef0be){_0x37f020['rows']=_0x1ef0be;return _0x37f020;})[_0xf788('0x25')](respondWithFilteredResult(_0xcbbcbf,_0x58f1ca))['catch'](handleError(_0xcbbcbf,null));};exports[_0xf788('0x45')]=function(_0x416c9c,_0x4980c2){var _0x2e1a40={'raw':!![],'where':{'id':_0x416c9c[_0xf788('0x46')]['id']}},_0x24aea2={};_0x24aea2[_0xf788('0x34')]=_[_0xf788('0x37')](db[_0xf788('0x2f')]['rawAttributes']);_0x24aea2[_0xf788('0x36')]=_[_0xf788('0x37')](_0x416c9c[_0xf788('0x36')]);_0x24aea2[_0xf788('0x3f')]=_[_0xf788('0x38')](_0x24aea2[_0xf788('0x34')],_0x24aea2[_0xf788('0x36')]);_0x2e1a40['attributes']=_[_0xf788('0x38')](_0x24aea2['model'],qs[_0xf788('0x3a')](_0x416c9c['query'][_0xf788('0x3a')]));_0x2e1a40[_0xf788('0x39')]=_0x2e1a40[_0xf788('0x39')][_0xf788('0x3b')]?_0x2e1a40[_0xf788('0x39')]:_0x24aea2['model'];if(_0x416c9c[_0xf788('0x36')][_0xf788('0x47')]){_0x2e1a40[_0xf788('0x44')]=[{'all':!![]}];}_0x2e1a40=_['merge']({},_0x2e1a40,_0x416c9c['options']);return db[_0xf788('0x2f')][_0xf788('0x48')](_0x2e1a40)[_0xf788('0x25')](handleEntityNotFound(_0x4980c2,null))[_0xf788('0x25')](respondWithResult(_0x4980c2,null))['catch'](handleError(_0x4980c2,null));};exports[_0xf788('0x49')]=function(_0x278a4d,_0x50e959){return db[_0xf788('0x2f')][_0xf788('0x49')](_0x278a4d[_0xf788('0x4a')],{})[_0xf788('0x25')](function(_0x1ddfa0){var _0x1b17c8=_0x278a4d[_0xf788('0x4b')][_0xf788('0x27')]({'plain':!![]});if(!_0x1b17c8)throw new Error(_0xf788('0x4c'));if(_0x1b17c8[_0xf788('0x4d')]===_0xf788('0x4b')){var _0x3bec33=_0x1ddfa0['get']({'plain':!![]});var _0x234681=_0xf788('0x28');return db[_0xf788('0x4e')][_0xf788('0x48')]({'where':{'name':_0x234681,'userProfileId':_0x1b17c8[_0xf788('0x4f')]},'raw':!![]})[_0xf788('0x25')](function(_0x6e6281){if(_0x6e6281&&_0x6e6281['autoAssociation']===0x0){return db['UserProfileResource'][_0xf788('0x49')]({'name':_0x3bec33[_0xf788('0x2c')],'resourceId':_0x3bec33['id'],'type':_0x6e6281[_0xf788('0x2c')],'sectionId':_0x6e6281['id']},{})['then'](function(){return _0x1ddfa0;});}else{return _0x1ddfa0;}})[_0xf788('0x50')](function(_0x150ca2){logger['error'](_0xf788('0x51'),_0x150ca2);throw _0x150ca2;});}return _0x1ddfa0;})[_0xf788('0x25')](respondWithResult(_0x50e959,0xc9))[_0xf788('0x50')](handleError(_0x50e959,null));};exports['update']=function(_0x252eca,_0x2b8ab6){if(_0x252eca[_0xf788('0x4a')]['id']){delete _0x252eca[_0xf788('0x4a')]['id'];}return db[_0xf788('0x2f')][_0xf788('0x48')]({'where':{'id':_0x252eca[_0xf788('0x46')]['id']}})[_0xf788('0x25')](handleEntityNotFound(_0x2b8ab6,null))[_0xf788('0x25')](saveUpdates(_0x252eca[_0xf788('0x4a')],null))[_0xf788('0x25')](respondWithResult(_0x2b8ab6,null))[_0xf788('0x50')](handleError(_0x2b8ab6,null));};exports[_0xf788('0x26')]=function(_0x138ab,_0x2e647b){return db[_0xf788('0x2f')][_0xf788('0x48')]({'where':{'id':_0x138ab[_0xf788('0x46')]['id']}})[_0xf788('0x25')](handleEntityNotFound(_0x2e647b,null))[_0xf788('0x25')](removeEntity(_0x2e647b,null))['catch'](handleError(_0x2e647b,null));};exports['test']=function(_0x47896f,_0x1d5631,_0x2b3380){var _0x4590b4;return db['SquareOdbc']['find']({'where':{'id':_0x47896f['params']['id']},'attributes':['id',_0xf788('0x52')]})['then'](handleEntityNotFound(_0x1d5631,null))[_0xf788('0x25')](function(_0x3f60ad){if(_0x3f60ad){var _0x273f06=require(_0xf788('0x53'))();_0x273f06['openSync'](_0x3f60ad['dsn']);_0x273f06['closeSync']();return _0x3f60ad;}})[_0xf788('0x25')](respondWithResult(_0x1d5631,null))[_0xf788('0x50')](handleError(_0x1d5631,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 32bbd6a..6949920 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 _0x4940=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','lodash','../../config/logger','api','moment','bluebird'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4940,0xeb));var _0x0494=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x4940[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x0494('0x0'));var util=require('util');var logger=require(_0x0494('0x1'))(_0x0494('0x2'));var moment=require(_0x0494('0x3'));var BPromise=require(_0x0494('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0494('0x5'));var rimraf=require(_0x0494('0x6'));var config=require(_0x0494('0x7'));var attributes=require(_0x0494('0x8'));module[_0x0494('0x9')]=function(_0x39e650,_0x53f986){return _0x39e650['define']('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6220=['path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1591cc,_0x4a9fbf){var _0xf9286a=function(_0x3ed43d){while(--_0x3ed43d){_0x1591cc['push'](_0x1591cc['shift']());}};_0xf9286a(++_0x4a9fbf);}(_0x6220,0x66));var _0x0622=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6220[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x0622('0x0'));var util=require(_0x0622('0x1'));var logger=require(_0x0622('0x2'))(_0x0622('0x3'));var moment=require(_0x0622('0x4'));var BPromise=require(_0x0622('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0622('0x6'));var rimraf=require('rimraf');var config=require(_0x0622('0x7'));var attributes=require(_0x0622('0x8'));module[_0x0622('0x9')]=function(_0x13f4f0,_0x4c2e0b){return _0x13f4f0[_0x0622('0xa')]('SquareOdbc',attributes,{'tableName':_0x0622('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 f01e8ee..b08fc2a 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 _0xb9b9=['find','options','raw','attributes','include','model','stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareOdbc'];(function(_0x3e0a77,_0x47f6ee){var _0x4750b6=function(_0x310417){while(--_0x310417){_0x3e0a77['push'](_0x3e0a77['shift']());}};_0x4750b6(++_0x47f6ee);}(_0xb9b9,0x6b));var _0x9b9b=function(_0x141290,_0x340baf){_0x141290=_0x141290-0x0;var _0x3aff67=_0xb9b9[_0x141290];return _0x3aff67;};'use strict';var _=require(_0x9b9b('0x0'));var util=require(_0x9b9b('0x1'));var moment=require(_0x9b9b('0x2'));var BPromise=require(_0x9b9b('0x3'));var rs=require(_0x9b9b('0x4'));var fs=require('fs');var Redis=require(_0x9b9b('0x5'));var db=require(_0x9b9b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b9b('0x7'))(_0x9b9b('0x8'));var config=require(_0x9b9b('0x9'));var jayson=require(_0x9b9b('0xa'));var client=jayson[_0x9b9b('0xb')][_0x9b9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5791ee,_0x31aac5,_0x115ed0){return new BPromise(function(_0x36ad26,_0x471dde){return client[_0x9b9b('0xd')](_0x5791ee,_0x115ed0)[_0x9b9b('0xe')](function(_0x5957f3){logger[_0x9b9b('0xf')](_0x9b9b('0x10'),_0x31aac5,'request\x20sent');logger[_0x9b9b('0x11')](_0x9b9b('0x12'),_0x31aac5,'request\x20sent',JSON['stringify'](_0x5957f3));if(_0x5957f3['error']){if(_0x5957f3[_0x9b9b('0x13')][_0x9b9b('0x14')]===0x1f4){logger[_0x9b9b('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x31aac5,_0x5957f3['error'][_0x9b9b('0x15')]);return _0x471dde(_0x5957f3[_0x9b9b('0x13')][_0x9b9b('0x15')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x31aac5,_0x5957f3[_0x9b9b('0x13')][_0x9b9b('0x15')]);return _0x36ad26(_0x5957f3[_0x9b9b('0x13')][_0x9b9b('0x15')]);}else{logger[_0x9b9b('0xf')](_0x9b9b('0x10'),_0x31aac5,'request\x20sent');_0x36ad26(_0x5957f3[_0x9b9b('0x16')][_0x9b9b('0x15')]);}})[_0x9b9b('0x17')](function(_0x51ec71){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x31aac5,_0x51ec71);_0x471dde(_0x51ec71);});});}exports['ShowSquareOdbc']=function(_0x46be63){var _0x2e30cc=this;return new Promise(function(_0x333784,_0x4958de){return db[_0x9b9b('0x18')][_0x9b9b('0x19')]({'raw':_0x46be63[_0x9b9b('0x1a')]?_0x46be63[_0x9b9b('0x1a')][_0x9b9b('0x1b')]===undefined?!![]:![]:!![],'where':_0x46be63[_0x9b9b('0x1a')]?_0x46be63[_0x9b9b('0x1a')]['where']||null:null,'attributes':_0x46be63['options']?_0x46be63[_0x9b9b('0x1a')][_0x9b9b('0x1c')]||null:null,'include':_0x46be63[_0x9b9b('0x1a')]?_0x46be63[_0x9b9b('0x1a')][_0x9b9b('0x1d')]?_['map'](_0x46be63['options'][_0x9b9b('0x1d')],function(_0x2e99c8){return{'model':db[_0x2e99c8[_0x9b9b('0x1e')]],'as':_0x2e99c8['as'],'attributes':_0x2e99c8[_0x9b9b('0x1c')],'include':_0x2e99c8[_0x9b9b('0x1d')]?_['map'](_0x2e99c8['include'],function(_0x36fab1){return{'model':db[_0x36fab1[_0x9b9b('0x1e')]],'as':_0x36fab1['as'],'attributes':_0x36fab1['attributes'],'include':_0x36fab1[_0x9b9b('0x1d')]?_['map'](_0x36fab1[_0x9b9b('0x1d')],function(_0x5cdd48){return{'model':db[_0x5cdd48[_0x9b9b('0x1e')]],'as':_0x5cdd48['as'],'attributes':_0x5cdd48[_0x9b9b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9b9b('0xe')](function(_0xe3ebe){logger[_0x9b9b('0xf')]('ShowSquareOdbc',_0x46be63);logger[_0x9b9b('0x11')]('ShowSquareOdbc',_0x46be63,JSON[_0x9b9b('0x1f')](_0xe3ebe));_0x333784(_0xe3ebe);})[_0x9b9b('0x17')](function(_0x29cf1a){logger[_0x9b9b('0x13')](_0x9b9b('0x20'),_0x29cf1a[_0x9b9b('0x15')],_0x46be63);_0x4958de(_0x2e30cc[_0x9b9b('0x13')](0x1f4,_0x29cf1a[_0x9b9b('0x15')]));});});}; \ No newline at end of file +var _0x366d=['model','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','raw','options','where','attributes','include','map'];(function(_0x9a7461,_0x2feed6){var _0x4e74c2=function(_0x28b0c6){while(--_0x28b0c6){_0x9a7461['push'](_0x9a7461['shift']());}};_0x4e74c2(++_0x2feed6);}(_0x366d,0x101));var _0xd366=function(_0x3ff999,_0x25811d){_0x3ff999=_0x3ff999-0x0;var _0x5214eb=_0x366d[_0x3ff999];return _0x5214eb;};'use strict';var _=require(_0xd366('0x0'));var util=require(_0xd366('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd366('0x2'));var fs=require('fs');var Redis=require(_0xd366('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd366('0x4'));var logger=require('../../config/logger')(_0xd366('0x5'));var config=require(_0xd366('0x6'));var jayson=require(_0xd366('0x7'));var client=jayson[_0xd366('0x8')][_0xd366('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b773,_0x3b0c8e,_0x2f4481){return new BPromise(function(_0x1fcc72,_0x1be4a1){return client[_0xd366('0xa')](_0x52b773,_0x2f4481)[_0xd366('0xb')](function(_0x1b4ad5){logger['info'](_0xd366('0xc'),_0x3b0c8e,'request\x20sent');logger[_0xd366('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3b0c8e,_0xd366('0xe'),JSON[_0xd366('0xf')](_0x1b4ad5));if(_0x1b4ad5[_0xd366('0x10')]){if(_0x1b4ad5[_0xd366('0x10')][_0xd366('0x11')]===0x1f4){logger[_0xd366('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x3b0c8e,_0x1b4ad5['error'][_0xd366('0x12')]);return _0x1be4a1(_0x1b4ad5[_0xd366('0x10')]['message']);}logger[_0xd366('0x10')](_0xd366('0xc'),_0x3b0c8e,_0x1b4ad5[_0xd366('0x10')]['message']);return _0x1fcc72(_0x1b4ad5['error'][_0xd366('0x12')]);}else{logger[_0xd366('0x13')](_0xd366('0xc'),_0x3b0c8e,_0xd366('0xe'));_0x1fcc72(_0x1b4ad5[_0xd366('0x14')][_0xd366('0x12')]);}})[_0xd366('0x15')](function(_0x203e57){logger[_0xd366('0x10')](_0xd366('0xc'),_0x3b0c8e,_0x203e57);_0x1be4a1(_0x203e57);});});}exports[_0xd366('0x16')]=function(_0xb437c6){var _0x500802=this;return new Promise(function(_0x2466c9,_0x26658d){return db[_0xd366('0x17')][_0xd366('0x18')]({'raw':_0xb437c6['options']?_0xb437c6['options'][_0xd366('0x19')]===undefined?!![]:![]:!![],'where':_0xb437c6[_0xd366('0x1a')]?_0xb437c6[_0xd366('0x1a')][_0xd366('0x1b')]||null:null,'attributes':_0xb437c6[_0xd366('0x1a')]?_0xb437c6['options'][_0xd366('0x1c')]||null:null,'include':_0xb437c6[_0xd366('0x1a')]?_0xb437c6['options'][_0xd366('0x1d')]?_[_0xd366('0x1e')](_0xb437c6[_0xd366('0x1a')]['include'],function(_0x172569){return{'model':db[_0x172569[_0xd366('0x1f')]],'as':_0x172569['as'],'attributes':_0x172569[_0xd366('0x1c')],'include':_0x172569[_0xd366('0x1d')]?_['map'](_0x172569[_0xd366('0x1d')],function(_0x379ca1){return{'model':db[_0x379ca1[_0xd366('0x1f')]],'as':_0x379ca1['as'],'attributes':_0x379ca1['attributes'],'include':_0x379ca1[_0xd366('0x1d')]?_[_0xd366('0x1e')](_0x379ca1['include'],function(_0x3a859f){return{'model':db[_0x3a859f[_0xd366('0x1f')]],'as':_0x3a859f['as'],'attributes':_0x3a859f[_0xd366('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd366('0xb')](function(_0x1fc0a7){logger['info']('ShowSquareOdbc',_0xb437c6);logger[_0xd366('0xd')](_0xd366('0x16'),_0xb437c6,JSON[_0xd366('0xf')](_0x1fc0a7));_0x2466c9(_0x1fc0a7);})[_0xd366('0x15')](function(_0xd04111){logger[_0xd366('0x10')](_0xd366('0x16'),_0xd04111['message'],_0xb437c6);_0x26658d(_0x500802[_0xd366('0x10')](0x1f4,_0xd04111[_0xd366('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 173258b..053ca4b 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 _0x237d=['isAuthenticated','index','show','/:id/users','post','create','addUsers','put','/:id','update','delete','removeUsers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x3b28fc,_0x14a7a0){var _0x367786=function(_0x4b6e98){while(--_0x4b6e98){_0x3b28fc['push'](_0x3b28fc['shift']());}};_0x367786(++_0x14a7a0);}(_0x237d,0x1d9));var _0xd237=function(_0x27d6b8,_0x3fe47a){_0x27d6b8=_0x27d6b8-0x0;var _0x3ed811=_0x237d[_0x27d6b8];return _0x3ed811;};'use strict';var multer=require(_0xd237('0x0'));var util=require(_0xd237('0x1'));var path=require(_0xd237('0x2'));var timeout=require(_0xd237('0x3'));var express=require('express');var router=express[_0xd237('0x4')]();var fs_extra=require(_0xd237('0x5'));var auth=require(_0xd237('0x6'));var interaction=require(_0xd237('0x7'));var config=require(_0xd237('0x8'));var controller=require(_0xd237('0x9'));router['get']('/',auth[_0xd237('0xa')](),controller[_0xd237('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd237('0xc')]);router['get'](_0xd237('0xd'),auth[_0xd237('0xa')](),controller['getUsers']);router[_0xd237('0xe')]('/',auth[_0xd237('0xa')](),controller[_0xd237('0xf')]);router[_0xd237('0xe')](_0xd237('0xd'),auth[_0xd237('0xa')](),controller[_0xd237('0x10')]);router[_0xd237('0x11')](_0xd237('0x12'),auth['isAuthenticated'](),controller[_0xd237('0x13')]);router[_0xd237('0x14')](_0xd237('0x12'),auth[_0xd237('0xa')](),controller['destroy']);router[_0xd237('0x14')](_0xd237('0xd'),auth[_0xd237('0xa')](),controller[_0xd237('0x15')]);module[_0xd237('0x16')]=router; \ No newline at end of file +var _0xa184=['fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','show','getUsers','post','create','addUsers','put','update','delete','/:id','destroy','/:id/users','exports','multer','util','path','connect-timeout'];(function(_0x3b8e60,_0x30ad23){var _0x4cdc05=function(_0x2d8e16){while(--_0x2d8e16){_0x3b8e60['push'](_0x3b8e60['shift']());}};_0x4cdc05(++_0x30ad23);}(_0xa184,0x110));var _0x4a18=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0xa184[_0x5f6a8a];return _0x2cce4d;};'use strict';var multer=require(_0x4a18('0x0'));var util=require(_0x4a18('0x1'));var path=require(_0x4a18('0x2'));var timeout=require(_0x4a18('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4a18('0x4'));var auth=require(_0x4a18('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4a18('0x6'));var controller=require(_0x4a18('0x7'));router['get']('/',auth[_0x4a18('0x8')](),controller[_0x4a18('0x9')]);router[_0x4a18('0xa')]('/:id',auth[_0x4a18('0x8')](),controller[_0x4a18('0xb')]);router[_0x4a18('0xa')]('/:id/users',auth[_0x4a18('0x8')](),controller[_0x4a18('0xc')]);router[_0x4a18('0xd')]('/',auth[_0x4a18('0x8')](),controller[_0x4a18('0xe')]);router[_0x4a18('0xd')]('/:id/users',auth[_0x4a18('0x8')](),controller[_0x4a18('0xf')]);router[_0x4a18('0x10')]('/:id',auth[_0x4a18('0x8')](),controller[_0x4a18('0x11')]);router[_0x4a18('0x12')](_0x4a18('0x13'),auth[_0x4a18('0x8')](),controller[_0x4a18('0x14')]);router[_0x4a18('0x12')](_0x4a18('0x15'),auth[_0x4a18('0x8')](),controller['removeUsers']);module[_0x4a18('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 1ea486b..1a53c7f 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 _0xe9e9=['STRING','name','TEXT','long','preproduction','toString','utf8','BLOB','getDataValue','production','DATE','sequelize','exports'];(function(_0x195a5b,_0x17f4bf){var _0xfd6e86=function(_0x430723){while(--_0x430723){_0x195a5b['push'](_0x195a5b['shift']());}};_0xfd6e86(++_0x17f4bf);}(_0xe9e9,0x1b8));var _0x9e9e=function(_0x3f45d9,_0x83b8f7){_0x3f45d9=_0x3f45d9-0x0;var _0x303af1=_0xe9e9[_0x3f45d9];return _0x303af1;};'use strict';var Sequelize=require(_0x9e9e('0x0'));module[_0x9e9e('0x1')]={'name':{'type':Sequelize[_0x9e9e('0x2')],'unique':_0x9e9e('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x9e9e('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x9e9e('0x5')),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0x9e9e('0x6'))[_0x9e9e('0x7')](_0x9e9e('0x8'));}}},'production':{'type':Sequelize[_0x9e9e('0x9')](_0x9e9e('0x5')),'get':function(){if(this[_0x9e9e('0xa')](_0x9e9e('0xb'))){return this[_0x9e9e('0xa')]('production')['toString'](_0x9e9e('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x9e9e('0xc')]}}; \ No newline at end of file +var _0xccd4=['TEXT','BLOB','long','getDataValue','toString','utf8','production','DATE','sequelize','exports','STRING','name'];(function(_0x580785,_0x48200a){var _0xad9853=function(_0x191f08){while(--_0x191f08){_0x580785['push'](_0x580785['shift']());}};_0xad9853(++_0x48200a);}(_0xccd4,0xa4));var _0x4ccd=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xccd4[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x4ccd('0x0'));module[_0x4ccd('0x1')]={'name':{'type':Sequelize[_0x4ccd('0x2')],'unique':_0x4ccd('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4ccd('0x2')]},'notes':{'type':Sequelize[_0x4ccd('0x4')]},'preproduction':{'type':Sequelize[_0x4ccd('0x5')](_0x4ccd('0x6')),'get':function(){if(this[_0x4ccd('0x7')]('preproduction')){return this['getDataValue']('preproduction')[_0x4ccd('0x8')](_0x4ccd('0x9'));}}},'production':{'type':Sequelize[_0x4ccd('0x5')](_0x4ccd('0x6')),'get':function(){if(this[_0x4ccd('0x7')](_0x4ccd('0xa'))){return this['getDataValue'](_0x4ccd('0xa'))[_0x4ccd('0x8')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x4ccd('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 6685d08..c46e7ad 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 _0x643d=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','rawAttributes','intersection','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','params','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','getUsers','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','get','SquareProjects','UserProfileResource','destroy','error','stack','name','send','index','map','SquareProject','fieldName','type','key','keys','query','filters','attributes','fields','length','model','hasOwnProperty','nolimit'];(function(_0x4f2ef4,_0x4965ba){var _0x1d51f3=function(_0x5a0035){while(--_0x5a0035){_0x4f2ef4['push'](_0x4f2ef4['shift']());}};_0x1d51f3(++_0x4965ba);}(_0x643d,0x1aa));var _0xd643=function(_0x16cb55,_0x4ce3c1){_0x16cb55=_0x16cb55-0x0;var _0x3c5570=_0x643d[_0x16cb55];return _0x3c5570;};'use strict';var emlformat=require(_0xd643('0x0'));var rimraf=require(_0xd643('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd643('0x2'));var BPromise=require(_0xd643('0x3'));var Mustache=require(_0xd643('0x4'));var util=require(_0xd643('0x5'));var path=require('path');var sox=require(_0xd643('0x6'));var csv=require(_0xd643('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd643('0x8'));var _=require(_0xd643('0x9'));var squel=require(_0xd643('0xa'));var crypto=require('crypto');var jsforce=require(_0xd643('0xb'));var deskjs=require(_0xd643('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd643('0xd'));var Papa=require(_0xd643('0xe'));var Redis=require(_0xd643('0xf'));var authService=require(_0xd643('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd643('0x11'));var hardwareService=require(_0xd643('0x12'));var logger=require(_0xd643('0x13'))(_0xd643('0x14'));var utils=require(_0xd643('0x15'));var config=require(_0xd643('0x16'));var licenseUtil=require(_0xd643('0x17'));var db=require(_0xd643('0x18'))['db'];config[_0xd643('0x19')]=_[_0xd643('0x1a')](config[_0xd643('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xd643('0x1b'))(new Redis(config[_0xd643('0x19')]));require('./squareProject.socket')[_0xd643('0x1c')](socket);function respondWithStatusCode(_0xd660c4,_0xd8bd20){_0xd8bd20=_0xd8bd20||0xcc;return function(_0xab6295){if(_0xab6295){return _0xd660c4[_0xd643('0x1d')](_0xd8bd20);}return _0xd660c4[_0xd643('0x1e')](_0xd8bd20)[_0xd643('0x1f')]();};}function respondWithResult(_0x25ec50,_0x1f749f){_0x1f749f=_0x1f749f||0xc8;return function(_0x150b25){if(_0x150b25){return _0x25ec50['status'](_0x1f749f)[_0xd643('0x20')](_0x150b25);}};}function respondWithFilteredResult(_0x42baf2,_0x4ce505){return function(_0xaee02d){if(_0xaee02d){var _0x5d5ec8=typeof _0x4ce505[_0xd643('0x21')]==='undefined'&&typeof _0x4ce505[_0xd643('0x22')]==='undefined';var _0x4134b2=_0xaee02d[_0xd643('0x23')];var _0xe482df=_0x5d5ec8?0x0:_0x4ce505[_0xd643('0x21')];var _0x3dc76a=_0x5d5ec8?_0xaee02d[_0xd643('0x23')]:_0x4ce505[_0xd643('0x21')]+_0x4ce505['limit'];var _0x278357;if(_0x3dc76a>=_0x4134b2){_0x3dc76a=_0x4134b2;_0x278357=0xc8;}else{_0x278357=0xce;}_0x42baf2[_0xd643('0x1e')](_0x278357);return _0x42baf2['set'](_0xd643('0x24'),_0xe482df+'-'+_0x3dc76a+'/'+_0x4134b2)['json'](_0xaee02d);}return null;};}function patchUpdates(_0x240edb){return function(_0xafd20a){try{jsonpatch['apply'](_0xafd20a,_0x240edb,!![]);}catch(_0x26c0eb){return BPromise[_0xd643('0x25')](_0x26c0eb);}return _0xafd20a[_0xd643('0x26')]();};}function saveUpdates(_0x118320,_0x3d9b13){return function(_0x5f16fe){if(_0x5f16fe){return _0x5f16fe[_0xd643('0x27')](_0x118320)[_0xd643('0x28')](function(_0x308d94){return _0x308d94;});}return null;};}function removeEntity(_0x3ffb1c,_0x30d061){return function(_0x5bc598){if(_0x5bc598){return _0x5bc598['destroy']()['then'](function(){var _0x1bbb99=_0x5bc598[_0xd643('0x29')]({'plain':!![]});var _0x13d2a4=_0xd643('0x2a');return db[_0xd643('0x2b')][_0xd643('0x2c')]({'where':{'type':_0x13d2a4,'resourceId':_0x1bbb99['id']}})['then'](function(){return _0x5bc598;});})[_0xd643('0x28')](function(){_0x3ffb1c[_0xd643('0x1e')](0xcc)[_0xd643('0x1f')]();});}};}function handleEntityNotFound(_0x5ed46a,_0x918f65){return function(_0x388ebf){if(!_0x388ebf){_0x5ed46a[_0xd643('0x1d')](0x194);}return _0x388ebf;};}function handleError(_0x58c17a,_0x132fc8){_0x132fc8=_0x132fc8||0x1f4;return function(_0x41154d){logger[_0xd643('0x2d')](_0x41154d[_0xd643('0x2e')]);if(_0x41154d[_0xd643('0x2f')]){delete _0x41154d[_0xd643('0x2f')];}_0x58c17a[_0xd643('0x1e')](_0x132fc8)[_0xd643('0x30')](_0x41154d);};}exports[_0xd643('0x31')]=function(_0x19cd12,_0x39b066){var _0x3b4792={},_0x18cfa7={},_0x413f23={'count':0x0,'rows':[]};var _0x3ac32a=_[_0xd643('0x32')](db[_0xd643('0x33')]['rawAttributes'],function(_0xcef074){return{'name':_0xcef074[_0xd643('0x34')],'type':_0xcef074[_0xd643('0x35')][_0xd643('0x36')]};});_0x18cfa7['model']=_['map'](_0x3ac32a,'name');_0x18cfa7['query']=_[_0xd643('0x37')](_0x19cd12[_0xd643('0x38')]);_0x18cfa7[_0xd643('0x39')]=_['intersection'](_0x18cfa7['model'],_0x18cfa7[_0xd643('0x38')]);_0x3b4792[_0xd643('0x3a')]=_['intersection'](_0x18cfa7['model'],qs[_0xd643('0x3b')](_0x19cd12[_0xd643('0x38')][_0xd643('0x3b')]));_0x3b4792[_0xd643('0x3a')]=_0x3b4792[_0xd643('0x3a')][_0xd643('0x3c')]?_0x3b4792[_0xd643('0x3a')]:_0x18cfa7[_0xd643('0x3d')];if(!_0x19cd12[_0xd643('0x38')][_0xd643('0x3e')](_0xd643('0x3f'))){_0x3b4792[_0xd643('0x22')]=qs['limit'](_0x19cd12[_0xd643('0x38')][_0xd643('0x22')]);_0x3b4792[_0xd643('0x21')]=qs[_0xd643('0x21')](_0x19cd12[_0xd643('0x38')]['offset']);}_0x3b4792[_0xd643('0x40')]=qs[_0xd643('0x41')](_0x19cd12[_0xd643('0x38')][_0xd643('0x41')]);_0x3b4792[_0xd643('0x42')]=qs[_0xd643('0x39')](_[_0xd643('0x43')](_0x19cd12['query'],_0x18cfa7[_0xd643('0x39')]),_0x3ac32a);if(_0x19cd12['query'][_0xd643('0x44')]){_0x3b4792[_0xd643('0x42')]=_[_0xd643('0x45')](_0x3b4792[_0xd643('0x42')],{'$or':_[_0xd643('0x32')](_0x3ac32a,function(_0x38eab9){if(_0x38eab9[_0xd643('0x35')]!==_0xd643('0x46')){var _0x2366f5={};_0x2366f5[_0x38eab9['name']]={'$like':'%'+_0x19cd12[_0xd643('0x38')][_0xd643('0x44')]+'%'};return _0x2366f5;}})});}_0x3b4792=_['merge']({},_0x3b4792,_0x19cd12[_0xd643('0x47')]);var _0x16e1a9={'where':_0x3b4792[_0xd643('0x42')]};return db[_0xd643('0x33')][_0xd643('0x23')](_0x16e1a9)['then'](function(_0x102df4){_0x413f23[_0xd643('0x23')]=_0x102df4;if(_0x19cd12[_0xd643('0x38')]['includeAll']){_0x3b4792[_0xd643('0x48')]=[{'all':!![]}];}return db[_0xd643('0x33')][_0xd643('0x49')](_0x3b4792);})[_0xd643('0x28')](function(_0x2b8fc1){_0x413f23[_0xd643('0x4a')]=_0x2b8fc1;return _0x413f23;})[_0xd643('0x28')](respondWithFilteredResult(_0x39b066,_0x3b4792))[_0xd643('0x4b')](handleError(_0x39b066,null));};exports['show']=function(_0x40cba9,_0x151862){var _0x5bf2fb={'raw':![],'where':{'id':_0x40cba9['params']['id']}},_0x59ecf4={};_0x59ecf4[_0xd643('0x3d')]=_['keys'](db[_0xd643('0x33')][_0xd643('0x4c')]);_0x59ecf4['query']=_['keys'](_0x40cba9[_0xd643('0x38')]);_0x59ecf4[_0xd643('0x39')]=_['intersection'](_0x59ecf4[_0xd643('0x3d')],_0x59ecf4[_0xd643('0x38')]);_0x5bf2fb[_0xd643('0x3a')]=_[_0xd643('0x4d')](_0x59ecf4[_0xd643('0x3d')],qs['fields'](_0x40cba9[_0xd643('0x38')][_0xd643('0x3b')]));_0x5bf2fb['attributes']=_0x5bf2fb['attributes'][_0xd643('0x3c')]?_0x5bf2fb[_0xd643('0x3a')]:_0x59ecf4[_0xd643('0x3d')];if(_0x40cba9[_0xd643('0x38')]['includeAll']){_0x5bf2fb[_0xd643('0x48')]=[{'all':!![]}];}_0x5bf2fb=_[_0xd643('0x45')]({},_0x5bf2fb,_0x40cba9[_0xd643('0x47')]);return db[_0xd643('0x33')][_0xd643('0x4e')](_0x5bf2fb)['then'](handleEntityNotFound(_0x151862,null))[_0xd643('0x28')](respondWithResult(_0x151862,null))['catch'](handleError(_0x151862,null));};exports['create']=function(_0x48aa70,_0x3927e8){return db[_0xd643('0x33')][_0xd643('0x4f')](_0x48aa70['body'],{})['then'](function(_0x3a0b94){var _0x114c56=_0x48aa70[_0xd643('0x50')][_0xd643('0x29')]({'plain':!![]});if(!_0x114c56)throw new Error(_0xd643('0x51'));if(_0x114c56[_0xd643('0x52')]===_0xd643('0x50')){var _0xdcc4e8=_0x3a0b94[_0xd643('0x29')]({'plain':!![]});var _0x23d7e5=_0xd643('0x2a');return db[_0xd643('0x53')]['find']({'where':{'name':_0x23d7e5,'userProfileId':_0x114c56[_0xd643('0x54')]},'raw':!![]})[_0xd643('0x28')](function(_0xb10aca){if(_0xb10aca&&_0xb10aca[_0xd643('0x55')]===0x0){return db[_0xd643('0x2b')][_0xd643('0x4f')]({'name':_0xdcc4e8[_0xd643('0x2f')],'resourceId':_0xdcc4e8['id'],'type':_0xb10aca[_0xd643('0x2f')],'sectionId':_0xb10aca['id']},{})[_0xd643('0x28')](function(){return _0x3a0b94;});}else{return _0x3a0b94;}})[_0xd643('0x4b')](function(_0x184755){logger[_0xd643('0x2d')](_0xd643('0x56'),_0x184755);throw _0x184755;});}return _0x3a0b94;})[_0xd643('0x28')](respondWithResult(_0x3927e8,0xc9))[_0xd643('0x4b')](handleError(_0x3927e8,null));};exports[_0xd643('0x27')]=function(_0x37f96f,_0x4b7e3c){if(_0x37f96f[_0xd643('0x57')]['id']){delete _0x37f96f['body']['id'];}return db['SquareProject'][_0xd643('0x4e')]({'where':{'id':_0x37f96f[_0xd643('0x58')]['id']}})[_0xd643('0x28')](handleEntityNotFound(_0x4b7e3c,null))[_0xd643('0x28')](saveUpdates(_0x37f96f['body'],null))[_0xd643('0x28')](respondWithResult(_0x4b7e3c,null))[_0xd643('0x4b')](handleError(_0x4b7e3c,null));};exports[_0xd643('0x2c')]=function(_0x34a1da,_0x424afa){return db['SquareProject'][_0xd643('0x4e')]({'where':{'id':_0x34a1da[_0xd643('0x58')]['id']}})[_0xd643('0x28')](handleEntityNotFound(_0x424afa,null))[_0xd643('0x28')](removeEntity(_0x424afa,null))[_0xd643('0x4b')](handleError(_0x424afa,null));};exports[_0xd643('0x59')]=function(_0x5b9d8d,_0x3c7e84,_0xa7726f){return db[_0xd643('0x33')]['find']({'where':{'id':_0x5b9d8d[_0xd643('0x58')]['id']}})[_0xd643('0x28')](handleEntityNotFound(_0x3c7e84,null))[_0xd643('0x28')](function(_0xe8781c){if(_0xe8781c){return _0xe8781c[_0xd643('0x59')](_0x5b9d8d[_0xd643('0x57')]['ids'],_[_0xd643('0x5a')](_0x5b9d8d[_0xd643('0x57')],[_0xd643('0x5b'),'id'])||{});}})[_0xd643('0x28')](respondWithResult(_0x3c7e84,null))[_0xd643('0x4b')](handleError(_0x3c7e84,null));};exports[_0xd643('0x5c')]=function(_0x44150e,_0x3470fa,_0x4d27b8){return db[_0xd643('0x33')][_0xd643('0x4e')]({'where':{'id':_0x44150e[_0xd643('0x58')]['id']}})[_0xd643('0x28')](handleEntityNotFound(_0x3470fa,null))[_0xd643('0x28')](function(_0x461296){if(_0x461296){return _0x461296[_0xd643('0x5c')](_0x44150e[_0xd643('0x38')]['ids'])[_0xd643('0x28')](function(){if(_[_0xd643('0x5d')](_0x44150e[_0xd643('0x38')][_0xd643('0x5b')])){for(var _0x596f4=0x0;_0x596f4<_0x44150e[_0xd643('0x38')][_0xd643('0x5b')][_0xd643('0x3c')];_0x596f4+=0x1){socket[_0xd643('0x5e')]('userSquareProject:remove',{'UserId':Number(_0x44150e[_0xd643('0x38')][_0xd643('0x5b')][_0x596f4]),'SquareProjectId':Number(_0x44150e[_0xd643('0x58')]['id'])});}}else{socket[_0xd643('0x5e')](_0xd643('0x5f'),{'UserId':Number(_0x44150e[_0xd643('0x38')][_0xd643('0x5b')]),'SquareProjectId':Number(_0x44150e[_0xd643('0x58')]['id'])});}});}})[_0xd643('0x28')](respondWithStatusCode(_0x3470fa,null))[_0xd643('0x4b')](handleError(_0x3470fa,null));};exports['getUsers']=function(_0x4c5db6,_0x2c4ba2,_0x46f25a){var _0x1b8361={};var _0x2227a6={};var _0x598037;var _0x18c3d9;return db[_0xd643('0x33')][_0xd643('0x60')]({'where':{'id':_0x4c5db6[_0xd643('0x58')]['id']}})[_0xd643('0x28')](handleEntityNotFound(_0x2c4ba2,null))[_0xd643('0x28')](function(_0x7de704){if(_0x7de704){_0x598037=_0x7de704;_0x2227a6[_0xd643('0x3d')]=_[_0xd643('0x37')](db['User']['rawAttributes']);_0x2227a6[_0xd643('0x38')]=_[_0xd643('0x37')](_0x4c5db6['query']);_0x2227a6['filters']=_['intersection'](_0x2227a6['model'],_0x2227a6[_0xd643('0x38')]);_0x1b8361[_0xd643('0x3a')]=_[_0xd643('0x4d')](_0x2227a6[_0xd643('0x3d')],qs[_0xd643('0x3b')](_0x4c5db6[_0xd643('0x38')][_0xd643('0x3b')]));_0x1b8361[_0xd643('0x3a')]=_0x1b8361[_0xd643('0x3a')][_0xd643('0x3c')]?_0x1b8361[_0xd643('0x3a')]:_0x2227a6['model'];_0x1b8361['order']=qs[_0xd643('0x41')](_0x4c5db6[_0xd643('0x38')]['sort']);_0x1b8361[_0xd643('0x42')]=qs['filters'](_[_0xd643('0x43')](_0x4c5db6[_0xd643('0x38')],_0x2227a6[_0xd643('0x39')]));if(_0x4c5db6['query'][_0xd643('0x44')]){_0x1b8361[_0xd643('0x42')]=_[_0xd643('0x45')](_0x1b8361['where'],{'$or':_[_0xd643('0x32')](_0x1b8361['attributes'],function(_0x261b92){var _0x54ea02={};_0x54ea02[_0x261b92]={'$like':'%'+_0x4c5db6[_0xd643('0x38')][_0xd643('0x44')]+'%'};return _0x54ea02;})});}_0x1b8361=_[_0xd643('0x45')]({},_0x1b8361,_0x4c5db6[_0xd643('0x47')]);return _0x598037[_0xd643('0x61')](_0x1b8361);}})[_0xd643('0x28')](function(_0x247a7c){if(_0x247a7c){_0x18c3d9=_0x247a7c[_0xd643('0x3c')];if(!_0x4c5db6[_0xd643('0x38')][_0xd643('0x3e')](_0xd643('0x3f'))){_0x1b8361[_0xd643('0x22')]=qs['limit'](_0x4c5db6[_0xd643('0x38')][_0xd643('0x22')]);_0x1b8361[_0xd643('0x21')]=qs[_0xd643('0x21')](_0x4c5db6[_0xd643('0x38')][_0xd643('0x21')]);}return _0x598037[_0xd643('0x61')](_0x1b8361);}})[_0xd643('0x28')](function(_0x11578c){if(_0x11578c){return _0x11578c?{'count':_0x18c3d9,'rows':_0x11578c}:null;}})[_0xd643('0x28')](respondWithResult(_0x2c4ba2,null))[_0xd643('0x4b')](handleError(_0x2c4ba2,null));}; \ No newline at end of file +var _0x2fe5=['set','Content-Range','apply','save','then','get','error','stack','name','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','getUsers','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','sendStatus','status','end','json','undefined','count','offset','limit'];(function(_0x3839df,_0x1b66ab){var _0x27190c=function(_0x42645f){while(--_0x42645f){_0x3839df['push'](_0x3839df['shift']());}};_0x27190c(++_0x1b66ab);}(_0x2fe5,0x1bd));var _0x52fe=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2fe5[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x52fe('0x0'));var rimraf=require(_0x52fe('0x1'));var zipdir=require(_0x52fe('0x2'));var jsonpatch=require(_0x52fe('0x3'));var rp=require(_0x52fe('0x4'));var moment=require(_0x52fe('0x5'));var BPromise=require(_0x52fe('0x6'));var Mustache=require('mustache');var util=require(_0x52fe('0x7'));var path=require('path');var sox=require(_0x52fe('0x8'));var csv=require(_0x52fe('0x9'));var ejs=require(_0x52fe('0xa'));var fs=require('fs');var fs_extra=require(_0x52fe('0xb'));var _=require(_0x52fe('0xc'));var squel=require(_0x52fe('0xd'));var crypto=require(_0x52fe('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x52fe('0xf'));var toCsv=require('to-csv');var querystring=require(_0x52fe('0x10'));var Papa=require(_0x52fe('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x52fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52fe('0x13'));var logger=require(_0x52fe('0x14'))(_0x52fe('0x15'));var utils=require(_0x52fe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x52fe('0x17'));var db=require(_0x52fe('0x18'))['db'];config[_0x52fe('0x19')]=_[_0x52fe('0x1a')](config[_0x52fe('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x4cbeb6,_0x32cfcc){_0x32cfcc=_0x32cfcc||0xcc;return function(_0x419102){if(_0x419102){return _0x4cbeb6[_0x52fe('0x1b')](_0x32cfcc);}return _0x4cbeb6[_0x52fe('0x1c')](_0x32cfcc)[_0x52fe('0x1d')]();};}function respondWithResult(_0x23151b,_0x5c8b6e){_0x5c8b6e=_0x5c8b6e||0xc8;return function(_0x2e366b){if(_0x2e366b){return _0x23151b[_0x52fe('0x1c')](_0x5c8b6e)[_0x52fe('0x1e')](_0x2e366b);}};}function respondWithFilteredResult(_0x2e9ea2,_0x502883){return function(_0x1a7ff4){if(_0x1a7ff4){var _0x54c94d=typeof _0x502883['offset']==='undefined'&&typeof _0x502883['limit']===_0x52fe('0x1f');var _0x2c98da=_0x1a7ff4[_0x52fe('0x20')];var _0x1ea552=_0x54c94d?0x0:_0x502883['offset'];var _0x50866b=_0x54c94d?_0x1a7ff4[_0x52fe('0x20')]:_0x502883[_0x52fe('0x21')]+_0x502883[_0x52fe('0x22')];var _0x5b0a13;if(_0x50866b>=_0x2c98da){_0x50866b=_0x2c98da;_0x5b0a13=0xc8;}else{_0x5b0a13=0xce;}_0x2e9ea2[_0x52fe('0x1c')](_0x5b0a13);return _0x2e9ea2[_0x52fe('0x23')](_0x52fe('0x24'),_0x1ea552+'-'+_0x50866b+'/'+_0x2c98da)[_0x52fe('0x1e')](_0x1a7ff4);}return null;};}function patchUpdates(_0x4f4816){return function(_0x5b7b03){try{jsonpatch[_0x52fe('0x25')](_0x5b7b03,_0x4f4816,!![]);}catch(_0x3f1e7b){return BPromise['reject'](_0x3f1e7b);}return _0x5b7b03[_0x52fe('0x26')]();};}function saveUpdates(_0x10b865,_0xc50460){return function(_0x2282aa){if(_0x2282aa){return _0x2282aa['update'](_0x10b865)[_0x52fe('0x27')](function(_0x1ff3f7){return _0x1ff3f7;});}return null;};}function removeEntity(_0x257f6a,_0x310a10){return function(_0x56626e){if(_0x56626e){return _0x56626e['destroy']()[_0x52fe('0x27')](function(){var _0x39b39a=_0x56626e[_0x52fe('0x28')]({'plain':!![]});var _0x52cc89='SquareProjects';return db['UserProfileResource']['destroy']({'where':{'type':_0x52cc89,'resourceId':_0x39b39a['id']}})[_0x52fe('0x27')](function(){return _0x56626e;});})[_0x52fe('0x27')](function(){_0x257f6a[_0x52fe('0x1c')](0xcc)[_0x52fe('0x1d')]();});}};}function handleEntityNotFound(_0x268963,_0x4bd5f3){return function(_0x222b65){if(!_0x222b65){_0x268963['sendStatus'](0x194);}return _0x222b65;};}function handleError(_0x5d72dd,_0xef0945){_0xef0945=_0xef0945||0x1f4;return function(_0x457482){logger[_0x52fe('0x29')](_0x457482[_0x52fe('0x2a')]);if(_0x457482['name']){delete _0x457482[_0x52fe('0x2b')];}_0x5d72dd[_0x52fe('0x1c')](_0xef0945)['send'](_0x457482);};}exports[_0x52fe('0x2c')]=function(_0x313fba,_0xa94ad0){var _0x340663={},_0x2a6deb={},_0x834e26={'count':0x0,'rows':[]};var _0x2cfd40=_['map'](db[_0x52fe('0x2d')][_0x52fe('0x2e')],function(_0x120d08){return{'name':_0x120d08[_0x52fe('0x2f')],'type':_0x120d08[_0x52fe('0x30')][_0x52fe('0x31')]};});_0x2a6deb[_0x52fe('0x32')]=_[_0x52fe('0x33')](_0x2cfd40,_0x52fe('0x2b'));_0x2a6deb[_0x52fe('0x34')]=_[_0x52fe('0x35')](_0x313fba[_0x52fe('0x34')]);_0x2a6deb['filters']=_[_0x52fe('0x36')](_0x2a6deb[_0x52fe('0x32')],_0x2a6deb[_0x52fe('0x34')]);_0x340663[_0x52fe('0x37')]=_[_0x52fe('0x36')](_0x2a6deb[_0x52fe('0x32')],qs[_0x52fe('0x38')](_0x313fba[_0x52fe('0x34')]['fields']));_0x340663[_0x52fe('0x37')]=_0x340663[_0x52fe('0x37')][_0x52fe('0x39')]?_0x340663[_0x52fe('0x37')]:_0x2a6deb[_0x52fe('0x32')];if(!_0x313fba[_0x52fe('0x34')][_0x52fe('0x3a')]('nolimit')){_0x340663[_0x52fe('0x22')]=qs[_0x52fe('0x22')](_0x313fba[_0x52fe('0x34')][_0x52fe('0x22')]);_0x340663[_0x52fe('0x21')]=qs[_0x52fe('0x21')](_0x313fba[_0x52fe('0x34')][_0x52fe('0x21')]);}_0x340663[_0x52fe('0x3b')]=qs['sort'](_0x313fba[_0x52fe('0x34')][_0x52fe('0x3c')]);_0x340663[_0x52fe('0x3d')]=qs['filters'](_[_0x52fe('0x3e')](_0x313fba['query'],_0x2a6deb[_0x52fe('0x3f')]),_0x2cfd40);if(_0x313fba[_0x52fe('0x34')][_0x52fe('0x40')]){_0x340663[_0x52fe('0x3d')]=_[_0x52fe('0x41')](_0x340663['where'],{'$or':_[_0x52fe('0x33')](_0x2cfd40,function(_0x4419b1){if(_0x4419b1['type']!==_0x52fe('0x42')){var _0x39c14a={};_0x39c14a[_0x4419b1['name']]={'$like':'%'+_0x313fba[_0x52fe('0x34')][_0x52fe('0x40')]+'%'};return _0x39c14a;}})});}_0x340663=_[_0x52fe('0x41')]({},_0x340663,_0x313fba['options']);var _0x4f91db={'where':_0x340663['where']};return db[_0x52fe('0x2d')]['count'](_0x4f91db)[_0x52fe('0x27')](function(_0xab483a){_0x834e26[_0x52fe('0x20')]=_0xab483a;if(_0x313fba['query']['includeAll']){_0x340663[_0x52fe('0x43')]=[{'all':!![]}];}return db['SquareProject'][_0x52fe('0x44')](_0x340663);})[_0x52fe('0x27')](function(_0x5d3d27){_0x834e26[_0x52fe('0x45')]=_0x5d3d27;return _0x834e26;})[_0x52fe('0x27')](respondWithFilteredResult(_0xa94ad0,_0x340663))[_0x52fe('0x46')](handleError(_0xa94ad0,null));};exports[_0x52fe('0x47')]=function(_0x284d1b,_0x140445){var _0x497da7={'raw':![],'where':{'id':_0x284d1b[_0x52fe('0x48')]['id']}},_0x24cd1f={};_0x24cd1f['model']=_[_0x52fe('0x35')](db[_0x52fe('0x2d')]['rawAttributes']);_0x24cd1f[_0x52fe('0x34')]=_['keys'](_0x284d1b[_0x52fe('0x34')]);_0x24cd1f[_0x52fe('0x3f')]=_['intersection'](_0x24cd1f['model'],_0x24cd1f[_0x52fe('0x34')]);_0x497da7[_0x52fe('0x37')]=_[_0x52fe('0x36')](_0x24cd1f['model'],qs[_0x52fe('0x38')](_0x284d1b[_0x52fe('0x34')]['fields']));_0x497da7['attributes']=_0x497da7[_0x52fe('0x37')][_0x52fe('0x39')]?_0x497da7[_0x52fe('0x37')]:_0x24cd1f[_0x52fe('0x32')];if(_0x284d1b[_0x52fe('0x34')]['includeAll']){_0x497da7['include']=[{'all':!![]}];}_0x497da7=_[_0x52fe('0x41')]({},_0x497da7,_0x284d1b[_0x52fe('0x49')]);return db['SquareProject']['find'](_0x497da7)[_0x52fe('0x27')](handleEntityNotFound(_0x140445,null))[_0x52fe('0x27')](respondWithResult(_0x140445,null))[_0x52fe('0x46')](handleError(_0x140445,null));};exports[_0x52fe('0x4a')]=function(_0x1fbf92,_0x2646ed){return db[_0x52fe('0x2d')][_0x52fe('0x4a')](_0x1fbf92[_0x52fe('0x4b')],{})[_0x52fe('0x27')](function(_0x21178f){var _0x4c2bbd=_0x1fbf92['user'][_0x52fe('0x28')]({'plain':!![]});if(!_0x4c2bbd)throw new Error(_0x52fe('0x4c'));if(_0x4c2bbd['role']===_0x52fe('0x4d')){var _0x423da2=_0x21178f[_0x52fe('0x28')]({'plain':!![]});var _0x3e0482='SquareProjects';return db[_0x52fe('0x4e')][_0x52fe('0x4f')]({'where':{'name':_0x3e0482,'userProfileId':_0x4c2bbd[_0x52fe('0x50')]},'raw':!![]})[_0x52fe('0x27')](function(_0x2fc8c5){if(_0x2fc8c5&&_0x2fc8c5[_0x52fe('0x51')]===0x0){return db[_0x52fe('0x52')][_0x52fe('0x4a')]({'name':_0x423da2[_0x52fe('0x2b')],'resourceId':_0x423da2['id'],'type':_0x2fc8c5[_0x52fe('0x2b')],'sectionId':_0x2fc8c5['id']},{})[_0x52fe('0x27')](function(){return _0x21178f;});}else{return _0x21178f;}})[_0x52fe('0x46')](function(_0xfaabdf){logger[_0x52fe('0x29')](_0x52fe('0x53'),_0xfaabdf);throw _0xfaabdf;});}return _0x21178f;})[_0x52fe('0x27')](respondWithResult(_0x2646ed,0xc9))[_0x52fe('0x46')](handleError(_0x2646ed,null));};exports[_0x52fe('0x54')]=function(_0x42de2b,_0xc76f92){if(_0x42de2b['body']['id']){delete _0x42de2b[_0x52fe('0x4b')]['id'];}return db[_0x52fe('0x2d')]['find']({'where':{'id':_0x42de2b['params']['id']}})[_0x52fe('0x27')](handleEntityNotFound(_0xc76f92,null))[_0x52fe('0x27')](saveUpdates(_0x42de2b[_0x52fe('0x4b')],null))[_0x52fe('0x27')](respondWithResult(_0xc76f92,null))['catch'](handleError(_0xc76f92,null));};exports[_0x52fe('0x55')]=function(_0x1d2c7e,_0x12bc1b){return db[_0x52fe('0x2d')][_0x52fe('0x4f')]({'where':{'id':_0x1d2c7e[_0x52fe('0x48')]['id']}})[_0x52fe('0x27')](handleEntityNotFound(_0x12bc1b,null))['then'](removeEntity(_0x12bc1b,null))['catch'](handleError(_0x12bc1b,null));};exports[_0x52fe('0x56')]=function(_0x52cc84,_0x4b98ca,_0x36f37c){return db['SquareProject'][_0x52fe('0x4f')]({'where':{'id':_0x52cc84[_0x52fe('0x48')]['id']}})[_0x52fe('0x27')](handleEntityNotFound(_0x4b98ca,null))[_0x52fe('0x27')](function(_0x577e63){if(_0x577e63){return _0x577e63[_0x52fe('0x56')](_0x52cc84[_0x52fe('0x4b')]['ids'],_['omit'](_0x52cc84[_0x52fe('0x4b')],[_0x52fe('0x57'),'id'])||{});}})[_0x52fe('0x27')](respondWithResult(_0x4b98ca,null))[_0x52fe('0x46')](handleError(_0x4b98ca,null));};exports['removeUsers']=function(_0x4b3df4,_0x5b2642,_0x5b040c){return db[_0x52fe('0x2d')]['find']({'where':{'id':_0x4b3df4['params']['id']}})[_0x52fe('0x27')](handleEntityNotFound(_0x5b2642,null))['then'](function(_0x58c045){if(_0x58c045){return _0x58c045[_0x52fe('0x58')](_0x4b3df4['query']['ids'])[_0x52fe('0x27')](function(){if(_[_0x52fe('0x59')](_0x4b3df4[_0x52fe('0x34')][_0x52fe('0x57')])){for(var _0x531309=0x0;_0x531309<_0x4b3df4[_0x52fe('0x34')][_0x52fe('0x57')][_0x52fe('0x39')];_0x531309+=0x1){socket[_0x52fe('0x5a')](_0x52fe('0x5b'),{'UserId':Number(_0x4b3df4[_0x52fe('0x34')][_0x52fe('0x57')][_0x531309]),'SquareProjectId':Number(_0x4b3df4[_0x52fe('0x48')]['id'])});}}else{socket[_0x52fe('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x4b3df4[_0x52fe('0x34')][_0x52fe('0x57')]),'SquareProjectId':Number(_0x4b3df4['params']['id'])});}});}})[_0x52fe('0x27')](respondWithStatusCode(_0x5b2642,null))[_0x52fe('0x46')](handleError(_0x5b2642,null));};exports['getUsers']=function(_0x3b2d9e,_0x2a931f,_0x354d03){var _0x1f9f5e={};var _0x4c6588={};var _0x1264e7;var _0x3216c1;return db['SquareProject'][_0x52fe('0x5c')]({'where':{'id':_0x3b2d9e[_0x52fe('0x48')]['id']}})[_0x52fe('0x27')](handleEntityNotFound(_0x2a931f,null))[_0x52fe('0x27')](function(_0x5dd25a){if(_0x5dd25a){_0x1264e7=_0x5dd25a;_0x4c6588['model']=_['keys'](db[_0x52fe('0x5d')][_0x52fe('0x2e')]);_0x4c6588['query']=_[_0x52fe('0x35')](_0x3b2d9e['query']);_0x4c6588[_0x52fe('0x3f')]=_[_0x52fe('0x36')](_0x4c6588[_0x52fe('0x32')],_0x4c6588[_0x52fe('0x34')]);_0x1f9f5e[_0x52fe('0x37')]=_[_0x52fe('0x36')](_0x4c6588[_0x52fe('0x32')],qs[_0x52fe('0x38')](_0x3b2d9e[_0x52fe('0x34')][_0x52fe('0x38')]));_0x1f9f5e['attributes']=_0x1f9f5e[_0x52fe('0x37')][_0x52fe('0x39')]?_0x1f9f5e[_0x52fe('0x37')]:_0x4c6588[_0x52fe('0x32')];_0x1f9f5e[_0x52fe('0x3b')]=qs[_0x52fe('0x3c')](_0x3b2d9e[_0x52fe('0x34')]['sort']);_0x1f9f5e[_0x52fe('0x3d')]=qs[_0x52fe('0x3f')](_[_0x52fe('0x3e')](_0x3b2d9e[_0x52fe('0x34')],_0x4c6588[_0x52fe('0x3f')]));if(_0x3b2d9e[_0x52fe('0x34')][_0x52fe('0x40')]){_0x1f9f5e[_0x52fe('0x3d')]=_['merge'](_0x1f9f5e[_0x52fe('0x3d')],{'$or':_[_0x52fe('0x33')](_0x1f9f5e[_0x52fe('0x37')],function(_0xd79149){var _0x50f377={};_0x50f377[_0xd79149]={'$like':'%'+_0x3b2d9e[_0x52fe('0x34')]['filter']+'%'};return _0x50f377;})});}_0x1f9f5e=_[_0x52fe('0x41')]({},_0x1f9f5e,_0x3b2d9e[_0x52fe('0x49')]);return _0x1264e7[_0x52fe('0x5e')](_0x1f9f5e);}})[_0x52fe('0x27')](function(_0x175601){if(_0x175601){_0x3216c1=_0x175601[_0x52fe('0x39')];if(!_0x3b2d9e[_0x52fe('0x34')][_0x52fe('0x3a')](_0x52fe('0x5f'))){_0x1f9f5e[_0x52fe('0x22')]=qs[_0x52fe('0x22')](_0x3b2d9e[_0x52fe('0x34')][_0x52fe('0x22')]);_0x1f9f5e[_0x52fe('0x21')]=qs['offset'](_0x3b2d9e[_0x52fe('0x34')]['offset']);}return _0x1264e7['getUsers'](_0x1f9f5e);}})[_0x52fe('0x27')](function(_0x48e954){if(_0x48e954){return _0x48e954?{'count':_0x3216c1,'rows':_0x48e954}:null;}})[_0x52fe('0x27')](respondWithResult(_0x2a931f,null))[_0x52fe('0x46')](handleError(_0x2a931f,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 6dd4436..2d13254 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 _0xe2a5=['SquareProject','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0xe2a5,0xce));var _0x5e2a=function(_0x56439d,_0x58c311){_0x56439d=_0x56439d-0x0;var _0x30981e=_0xe2a5[_0x56439d];return _0x30981e;};'use strict';var EventEmitter=require(_0x5e2a('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x5e2a('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5e2a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e2a('0x3'),'afterDestroy':_0x5e2a('0x4')};function emitEvent(_0x3c063a){return function(_0x5100a6,_0x317b5f,_0x164b46){SquareProjectEvents[_0x5e2a('0x5')](_0x3c063a+':'+_0x5100a6['id'],_0x5100a6);SquareProjectEvents[_0x5e2a('0x5')](_0x3c063a,_0x5100a6);_0x164b46(null);};}for(var e in events){if(events[_0x5e2a('0x6')](e)){var event=events[e];SquareProject[_0x5e2a('0x7')](e,emitEvent(event));}}module[_0x5e2a('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x083f=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SquareProject'];(function(_0x53b07e,_0x3bc254){var _0x5490b7=function(_0xd2e262){while(--_0xd2e262){_0x53b07e['push'](_0x53b07e['shift']());}};_0x5490b7(++_0x3bc254);}(_0x083f,0xba));var _0xf083=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x083f[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0xf083('0x0'));var SquareProject=require(_0xf083('0x1'))['db'][_0xf083('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf083('0x3')](0x0);var events={'afterCreate':_0xf083('0x4'),'afterUpdate':'update','afterDestroy':_0xf083('0x5')};function emitEvent(_0x5c9e8a){return function(_0x38c7f4,_0x3568a2,_0x545a11){SquareProjectEvents[_0xf083('0x6')](_0x5c9e8a+':'+_0x38c7f4['id'],_0x38c7f4);SquareProjectEvents[_0xf083('0x6')](_0x5c9e8a,_0x38c7f4);_0x545a11(null);};}for(var e in events){if(events[_0xf083('0x7')](e)){var event=events[e];SquareProject[_0xf083('0x8')](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 c42fff2..4b25466 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 _0x811b=['SquareProject','square_projects','preproduction','savedAt','format','changed','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x510347,_0xdf770a){var _0x5cb84f=function(_0x4c35d7){while(--_0x4c35d7){_0x510347['push'](_0x510347['shift']());}};_0x5cb84f(++_0xdf770a);}(_0x811b,0x10c));var _0xb811=function(_0x2b70f8,_0x361789){_0x2b70f8=_0x2b70f8-0x0;var _0x2f741e=_0x811b[_0x2b70f8];return _0x2f741e;};'use strict';var _=require(_0xb811('0x0'));var util=require(_0xb811('0x1'));var logger=require('../../config/logger')(_0xb811('0x2'));var moment=require(_0xb811('0x3'));var BPromise=require(_0xb811('0x4'));var rp=require(_0xb811('0x5'));var fs=require('fs');var path=require(_0xb811('0x6'));var rimraf=require(_0xb811('0x7'));var config=require(_0xb811('0x8'));var attributes=require(_0xb811('0x9'));module[_0xb811('0xa')]=function(_0x2ad01f,_0x58b911){return _0x2ad01f[_0xb811('0xb')](_0xb811('0xc'),attributes,{'tableName':_0xb811('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e63ee,_0x2aed5d,_0x12d346){if(_0x3e63ee['changed'](_0xb811('0xe'))){_0x3e63ee[_0xb811('0xf')]=moment()[_0xb811('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3e63ee[_0xb811('0x11')](_0xb811('0x12'))){_0x3e63ee['publishedAt']=moment()[_0xb811('0x10')](_0xb811('0x13'));}_0x12d346(null,_0x3e63ee);}}});}; \ No newline at end of file +var _0x9ac1=['YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','square_projects','changed','preproduction','savedAt','format','production'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x9ac1,0x181));var _0x19ac=function(_0x5bb4a8,_0x579b16){_0x5bb4a8=_0x5bb4a8-0x0;var _0x1ac161=_0x9ac1[_0x5bb4a8];return _0x1ac161;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x19ac('0x0'))(_0x19ac('0x1'));var moment=require(_0x19ac('0x2'));var BPromise=require(_0x19ac('0x3'));var rp=require(_0x19ac('0x4'));var fs=require('fs');var path=require(_0x19ac('0x5'));var rimraf=require('rimraf');var config=require(_0x19ac('0x6'));var attributes=require('./squareProject.attributes');module[_0x19ac('0x7')]=function(_0xd5405b,_0x265b41){return _0xd5405b[_0x19ac('0x8')]('SquareProject',attributes,{'tableName':_0x19ac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10e4e1,_0xb06d2,_0x410b56){if(_0x10e4e1[_0x19ac('0xa')](_0x19ac('0xb'))){_0x10e4e1[_0x19ac('0xc')]=moment()[_0x19ac('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x10e4e1[_0x19ac('0xa')](_0x19ac('0xe'))){_0x10e4e1['publishedAt']=moment()[_0x19ac('0xd')](_0x19ac('0xf'));}_0x410b56(null,_0x10e4e1);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2093cf1..aec3f84 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 _0x4fd2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SquareProject,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','model','util','moment','bluebird'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x4fd2,0x15b));var _0x24fd=function(_0x6f96e6,_0x23ea02){_0x6f96e6=_0x6f96e6-0x0;var _0xec6891=_0x4fd2[_0x6f96e6];return _0xec6891;};'use strict';var _=require('lodash');var util=require(_0x24fd('0x0'));var moment=require(_0x24fd('0x1'));var BPromise=require(_0x24fd('0x2'));var rs=require(_0x24fd('0x3'));var fs=require('fs');var Redis=require(_0x24fd('0x4'));var db=require(_0x24fd('0x5'))['db'];var utils=require(_0x24fd('0x6'));var logger=require(_0x24fd('0x7'))(_0x24fd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x24fd('0x9')][_0x24fd('0xa')]({'port':0x232a});config[_0x24fd('0xb')]=_[_0x24fd('0xc')](config[_0x24fd('0xb')],{'host':_0x24fd('0xd'),'port':0x18eb});var socket=require(_0x24fd('0xe'))(new Redis(config['redis']));require('./squareProject.socket')[_0x24fd('0xf')](socket);function respondWithRpcPromise(_0x40f859,_0x2d8285,_0x571a5e){return new BPromise(function(_0x16397d,_0xec5b3a){return client['request'](_0x40f859,_0x571a5e)[_0x24fd('0x10')](function(_0x5c6d84){logger['info'](_0x24fd('0x11'),_0x2d8285,'request\x20sent');logger[_0x24fd('0x12')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x2d8285,_0x24fd('0x13'),JSON[_0x24fd('0x14')](_0x5c6d84));if(_0x5c6d84[_0x24fd('0x15')]){if(_0x5c6d84[_0x24fd('0x15')][_0x24fd('0x16')]===0x1f4){logger[_0x24fd('0x15')]('SquareProject,\x20%s,\x20%s',_0x2d8285,_0x5c6d84[_0x24fd('0x15')][_0x24fd('0x17')]);return _0xec5b3a(_0x5c6d84[_0x24fd('0x15')][_0x24fd('0x17')]);}logger[_0x24fd('0x15')](_0x24fd('0x11'),_0x2d8285,_0x5c6d84[_0x24fd('0x15')][_0x24fd('0x17')]);return _0x16397d(_0x5c6d84[_0x24fd('0x15')][_0x24fd('0x17')]);}else{logger[_0x24fd('0x18')](_0x24fd('0x11'),_0x2d8285,_0x24fd('0x13'));_0x16397d(_0x5c6d84[_0x24fd('0x19')]['message']);}})[_0x24fd('0x1a')](function(_0x4eda15){logger[_0x24fd('0x15')](_0x24fd('0x11'),_0x2d8285,_0x4eda15);_0xec5b3a(_0x4eda15);});});}exports[_0x24fd('0x1b')]=function(_0x699146){var _0x5cae3b=this;return new Promise(function(_0x4bd94b,_0x536537){return db[_0x24fd('0x1c')][_0x24fd('0x1d')]({'raw':_0x699146[_0x24fd('0x1e')]?_0x699146[_0x24fd('0x1e')][_0x24fd('0x1f')]===undefined?!![]:![]:!![],'where':_0x699146[_0x24fd('0x1e')]?_0x699146[_0x24fd('0x1e')][_0x24fd('0x20')]||null:null,'attributes':_0x699146[_0x24fd('0x1e')]?_0x699146[_0x24fd('0x1e')][_0x24fd('0x21')]||null:null,'include':_0x699146[_0x24fd('0x1e')]?_0x699146[_0x24fd('0x1e')]['include']?_['map'](_0x699146['options']['include'],function(_0x4051b9){return{'model':db[_0x4051b9[_0x24fd('0x22')]],'as':_0x4051b9['as'],'attributes':_0x4051b9[_0x24fd('0x21')],'include':_0x4051b9['include']?_['map'](_0x4051b9['include'],function(_0xf0f1e1){return{'model':db[_0xf0f1e1[_0x24fd('0x22')]],'as':_0xf0f1e1['as'],'attributes':_0xf0f1e1['attributes'],'include':_0xf0f1e1['include']?_['map'](_0xf0f1e1['include'],function(_0x214a82){return{'model':db[_0x214a82['model']],'as':_0x214a82['as'],'attributes':_0x214a82['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fd('0x10')](function(_0x1b3cd9){logger['info']('ShowSquareProject',_0x699146);logger[_0x24fd('0x12')](_0x24fd('0x1b'),_0x699146,JSON[_0x24fd('0x14')](_0x1b3cd9));_0x4bd94b(_0x1b3cd9);})['catch'](function(_0x198aa1){logger[_0x24fd('0x15')](_0x24fd('0x1b'),_0x198aa1['message'],_0x699146);_0x536537(_0x5cae3b[_0x24fd('0x15')](0x1f4,_0x198aa1[_0x24fd('0x17')]));});});}; \ No newline at end of file +var _0xf192=['then','request\x20sent','debug','stringify','error','code','message','SquareProject,\x20%s,\x20%s','info','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request'];(function(_0x618d0e,_0x57dd7a){var _0x1a901a=function(_0x3bf2db){while(--_0x3bf2db){_0x618d0e['push'](_0x618d0e['shift']());}};_0x1a901a(++_0x57dd7a);}(_0xf192,0xe6));var _0x2f19=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf192[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x2f19('0x0'));var util=require('util');var moment=require(_0x2f19('0x1'));var BPromise=require(_0x2f19('0x2'));var rs=require(_0x2f19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f19('0x4'))['db'];var utils=require(_0x2f19('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f19('0x6'));var jayson=require(_0x2f19('0x7'));var client=jayson[_0x2f19('0x8')][_0x2f19('0x9')]({'port':0x232a});config['redis']=_[_0x2f19('0xa')](config[_0x2f19('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2f19('0xc'))(new Redis(config[_0x2f19('0xb')]));require('./squareProject.socket')[_0x2f19('0xd')](socket);function respondWithRpcPromise(_0x192a63,_0x1578c1,_0x3c462f){return new BPromise(function(_0x26d856,_0x1bf7a1){return client[_0x2f19('0xe')](_0x192a63,_0x3c462f)[_0x2f19('0xf')](function(_0x48f063){logger['info']('SquareProject,\x20%s,\x20%s',_0x1578c1,_0x2f19('0x10'));logger[_0x2f19('0x11')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x1578c1,_0x2f19('0x10'),JSON[_0x2f19('0x12')](_0x48f063));if(_0x48f063[_0x2f19('0x13')]){if(_0x48f063['error'][_0x2f19('0x14')]===0x1f4){logger[_0x2f19('0x13')]('SquareProject,\x20%s,\x20%s',_0x1578c1,_0x48f063['error'][_0x2f19('0x15')]);return _0x1bf7a1(_0x48f063[_0x2f19('0x13')][_0x2f19('0x15')]);}logger[_0x2f19('0x13')](_0x2f19('0x16'),_0x1578c1,_0x48f063[_0x2f19('0x13')]['message']);return _0x26d856(_0x48f063[_0x2f19('0x13')][_0x2f19('0x15')]);}else{logger[_0x2f19('0x17')](_0x2f19('0x16'),_0x1578c1,_0x2f19('0x10'));_0x26d856(_0x48f063['result'][_0x2f19('0x15')]);}})[_0x2f19('0x18')](function(_0x5ed27c){logger[_0x2f19('0x13')](_0x2f19('0x16'),_0x1578c1,_0x5ed27c);_0x1bf7a1(_0x5ed27c);});});}exports[_0x2f19('0x19')]=function(_0x22c0fa){var _0x103c17=this;return new Promise(function(_0x1deecc,_0x1329b2){return db[_0x2f19('0x1a')][_0x2f19('0x1b')]({'raw':_0x22c0fa[_0x2f19('0x1c')]?_0x22c0fa[_0x2f19('0x1c')][_0x2f19('0x1d')]===undefined?!![]:![]:!![],'where':_0x22c0fa[_0x2f19('0x1c')]?_0x22c0fa[_0x2f19('0x1c')][_0x2f19('0x1e')]||null:null,'attributes':_0x22c0fa[_0x2f19('0x1c')]?_0x22c0fa[_0x2f19('0x1c')][_0x2f19('0x1f')]||null:null,'include':_0x22c0fa[_0x2f19('0x1c')]?_0x22c0fa[_0x2f19('0x1c')]['include']?_[_0x2f19('0x20')](_0x22c0fa[_0x2f19('0x1c')][_0x2f19('0x21')],function(_0x5e20ef){return{'model':db[_0x5e20ef['model']],'as':_0x5e20ef['as'],'attributes':_0x5e20ef[_0x2f19('0x1f')],'include':_0x5e20ef[_0x2f19('0x21')]?_[_0x2f19('0x20')](_0x5e20ef['include'],function(_0x5e1fda){return{'model':db[_0x5e1fda['model']],'as':_0x5e1fda['as'],'attributes':_0x5e1fda[_0x2f19('0x1f')],'include':_0x5e1fda[_0x2f19('0x21')]?_[_0x2f19('0x20')](_0x5e1fda[_0x2f19('0x21')],function(_0x1559f9){return{'model':db[_0x1559f9[_0x2f19('0x22')]],'as':_0x1559f9['as'],'attributes':_0x1559f9[_0x2f19('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2f19('0xf')](function(_0xbbcdb4){logger['info'](_0x2f19('0x19'),_0x22c0fa);logger[_0x2f19('0x11')]('ShowSquareProject',_0x22c0fa,JSON[_0x2f19('0x12')](_0xbbcdb4));_0x1deecc(_0xbbcdb4);})['catch'](function(_0x1c7557){logger[_0x2f19('0x13')](_0x2f19('0x19'),_0x1c7557[_0x2f19('0x15')],_0x22c0fa);_0x1329b2(_0x103c17[_0x2f19('0x13')](0x1f4,_0x1c7557['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index bd09860..11e426f 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 _0x1e5a=['register','length','squareProject:','./squareProject.events','remove','emit','removeListener'];(function(_0x1c288b,_0x377b72){var _0x5d9225=function(_0x3c1a9e){while(--_0x3c1a9e){_0x1c288b['push'](_0x1c288b['shift']());}};_0x5d9225(++_0x377b72);}(_0x1e5a,0x161));var _0xa1e5=function(_0xedc9ed,_0x18870a){_0xedc9ed=_0xedc9ed-0x0;var _0x174596=_0x1e5a[_0xedc9ed];return _0x174596;};'use strict';var SquareProjectEvents=require(_0xa1e5('0x0'));var events=['save',_0xa1e5('0x1'),'update'];function createListener(_0x297275,_0x2f14e6){return function(_0xa0e5ad){_0x2f14e6[_0xa1e5('0x2')](_0x297275,_0xa0e5ad);};}function removeListener(_0x3a0692,_0x446870){return function(){SquareProjectEvents[_0xa1e5('0x3')](_0x3a0692,_0x446870);};}exports[_0xa1e5('0x4')]=function(_0x1d4b92){for(var _0x2d851e=0x0,_0x565e7e=events[_0xa1e5('0x5')];_0x2d851e<_0x565e7e;_0x2d851e++){var _0x53b7f0=events[_0x2d851e];var _0xaa1dce=createListener(_0xa1e5('0x6')+_0x53b7f0,_0x1d4b92);SquareProjectEvents['on'](_0x53b7f0,_0xaa1dce);}}; \ No newline at end of file +var _0xeff4=['register','length','squareProject:','./squareProject.events','save','update','emit','removeListener'];(function(_0x5edb54,_0x4faac4){var _0x2babd4=function(_0x494748){while(--_0x494748){_0x5edb54['push'](_0x5edb54['shift']());}};_0x2babd4(++_0x4faac4);}(_0xeff4,0xd3));var _0x4eff=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0xeff4[_0x414f67];return _0x338537;};'use strict';var SquareProjectEvents=require(_0x4eff('0x0'));var events=[_0x4eff('0x1'),'remove',_0x4eff('0x2')];function createListener(_0x2f0e78,_0x83e5a4){return function(_0x498404){_0x83e5a4[_0x4eff('0x3')](_0x2f0e78,_0x498404);};}function removeListener(_0x25ed53,_0x40feca){return function(){SquareProjectEvents[_0x4eff('0x4')](_0x25ed53,_0x40feca);};}exports[_0x4eff('0x5')]=function(_0x831d33){for(var _0x206e54=0x0,_0x1f8920=events[_0x4eff('0x6')];_0x206e54<_0x1f8920;_0x206e54++){var _0x3b5b4c=events[_0x206e54];var _0x52a161=createListener(_0x4eff('0x7')+_0x3b5b4c,_0x831d33);SquareProjectEvents['on'](_0x3b5b4c,_0x52a161);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index fdb07b5..9ebb8b6 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x1318e3,_0x4b8b91){var _0x4bf7b5=function(_0x1cb810){while(--_0x1cb810){_0x1318e3['push'](_0x1318e3['shift']());}};_0x4bf7b5(++_0x4b8b91);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x3b202c,_0x3ec0b2){var _0x24b764=function(_0x1b0f0c){while(--_0x1b0f0c){_0x3b202c['push'](_0x3b202c['shift']());}};_0x24b764(++_0x3ec0b2);}(_0x5fab,0x177));var _0xb5fa=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x5fab[_0x64aff8];return _0x5488a3;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);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 53c4087..87a74c8 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 _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x20cd18,_0x29a452){var _0x6bfda6=function(_0x42f915){while(--_0x42f915){_0x20cd18['push'](_0x20cd18['shift']());}};_0x6bfda6(++_0x29a452);}(_0x814b,0x1a2));var _0xb814=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x814b[_0x13ed69];return _0x50c72e;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file +var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x394589,_0x82a0a9){var _0x4437b7=function(_0x178e69){while(--_0x178e69){_0x394589['push'](_0x394589['shift']());}};_0x4437b7(++_0x82a0a9);}(_0x7c09,0x102));var _0x97c0=function(_0x1c646b,_0x136136){_0x1c646b=_0x1c646b-0x0;var _0x4f2652=_0x7c09[_0x1c646b];return _0x4f2652;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index fa05f35..dd6ea82 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 _0x01da=['limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','keys','query','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x6373bd,_0x1b4d33){var _0x195f70=function(_0x328590){while(--_0x328590){_0x6373bd['push'](_0x6373bd['shift']());}};_0x195f70(++_0x1b4d33);}(_0x01da,0x1be));var _0xa01d=function(_0x3c4e1a,_0x1e1a26){_0x3c4e1a=_0x3c4e1a-0x0;var _0x5c3d95=_0x01da[_0x3c4e1a];return _0x5c3d95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa01d('0x0'));var zipdir=require(_0xa01d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa01d('0x2'));var moment=require(_0xa01d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa01d('0x4'));var util=require(_0xa01d('0x5'));var path=require(_0xa01d('0x6'));var sox=require('sox');var csv=require(_0xa01d('0x7'));var ejs=require(_0xa01d('0x8'));var fs=require('fs');var fs_extra=require(_0xa01d('0x9'));var _=require(_0xa01d('0xa'));var squel=require('squel');var crypto=require(_0xa01d('0xb'));var jsforce=require(_0xa01d('0xc'));var deskjs=require(_0xa01d('0xd'));var toCsv=require(_0xa01d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa01d('0xe'));var authService=require(_0xa01d('0xf'));var qs=require(_0xa01d('0x10'));var as=require(_0xa01d('0x11'));var hardwareService=require(_0xa01d('0x12'));var logger=require(_0xa01d('0x13'))('api');var utils=require(_0xa01d('0x14'));var config=require(_0xa01d('0x15'));var licenseUtil=require(_0xa01d('0x16'));var db=require(_0xa01d('0x17'))['db'];function respondWithStatusCode(_0x485574,_0x63fe5b){_0x63fe5b=_0x63fe5b||0xcc;return function(_0x5c7827){if(_0x5c7827){return _0x485574[_0xa01d('0x18')](_0x63fe5b);}return _0x485574[_0xa01d('0x19')](_0x63fe5b)[_0xa01d('0x1a')]();};}function respondWithResult(_0x125920,_0x4d9ce5){_0x4d9ce5=_0x4d9ce5||0xc8;return function(_0x555d0a){if(_0x555d0a){return _0x125920[_0xa01d('0x19')](_0x4d9ce5)['json'](_0x555d0a);}};}function respondWithFilteredResult(_0x228030,_0x4a2191){return function(_0x24a016){if(_0x24a016){var _0x2b9e9a=typeof _0x4a2191[_0xa01d('0x1b')]===_0xa01d('0x1c')&&typeof _0x4a2191[_0xa01d('0x1d')]===_0xa01d('0x1c');var _0x5c5caf=_0x24a016[_0xa01d('0x1e')];var _0x41638e=_0x2b9e9a?0x0:_0x4a2191[_0xa01d('0x1b')];var _0x2083d=_0x2b9e9a?_0x24a016[_0xa01d('0x1e')]:_0x4a2191[_0xa01d('0x1b')]+_0x4a2191[_0xa01d('0x1d')];var _0x2aa53d;if(_0x2083d>=_0x5c5caf){_0x2083d=_0x5c5caf;_0x2aa53d=0xc8;}else{_0x2aa53d=0xce;}_0x228030['status'](_0x2aa53d);return _0x228030[_0xa01d('0x1f')]('Content-Range',_0x41638e+'-'+_0x2083d+'/'+_0x5c5caf)['json'](_0x24a016);}return null;};}function patchUpdates(_0x120a98){return function(_0x4c19cd){try{jsonpatch[_0xa01d('0x20')](_0x4c19cd,_0x120a98,!![]);}catch(_0x490df9){return BPromise[_0xa01d('0x21')](_0x490df9);}return _0x4c19cd[_0xa01d('0x22')]();};}function saveUpdates(_0x56167d,_0x47cd10){return function(_0x5acdbc){if(_0x5acdbc){return _0x5acdbc[_0xa01d('0x23')](_0x56167d)[_0xa01d('0x24')](function(_0x4c9d8a){return _0x4c9d8a;});}return null;};}function removeEntity(_0x3e84d6,_0x2bbd86){return function(_0xe6838f){if(_0xe6838f){return _0xe6838f[_0xa01d('0x25')]()['then'](function(){_0x3e84d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0bdd,_0x3ba1b7){return function(_0x31298c){if(!_0x31298c){_0x3b0bdd[_0xa01d('0x18')](0x194);}return _0x31298c;};}function handleError(_0x342008,_0x2f5d23){_0x2f5d23=_0x2f5d23||0x1f4;return function(_0x5128d0){logger[_0xa01d('0x26')](_0x5128d0[_0xa01d('0x27')]);if(_0x5128d0[_0xa01d('0x28')]){delete _0x5128d0['name'];}_0x342008[_0xa01d('0x19')](_0x2f5d23)['send'](_0x5128d0);};}exports[_0xa01d('0x29')]=function(_0x2804f8,_0x24707d){var _0xfc0ab1={},_0x4c03ff={},_0x17402d={'count':0x0,'rows':[]};var _0x518d1b=_[_0xa01d('0x2a')](db['SquareRecording'][_0xa01d('0x2b')],function(_0x1435b6){return{'name':_0x1435b6['fieldName'],'type':_0x1435b6[_0xa01d('0x2c')]['key']};});_0x4c03ff['model']=_[_0xa01d('0x2a')](_0x518d1b,_0xa01d('0x28'));_0x4c03ff['query']=_[_0xa01d('0x2d')](_0x2804f8[_0xa01d('0x2e')]);_0x4c03ff[_0xa01d('0x2f')]=_[_0xa01d('0x30')](_0x4c03ff[_0xa01d('0x31')],_0x4c03ff[_0xa01d('0x2e')]);_0xfc0ab1['attributes']=_['intersection'](_0x4c03ff['model'],qs[_0xa01d('0x32')](_0x2804f8[_0xa01d('0x2e')]['fields']));_0xfc0ab1[_0xa01d('0x33')]=_0xfc0ab1[_0xa01d('0x33')]['length']?_0xfc0ab1[_0xa01d('0x33')]:_0x4c03ff['model'];if(!_0x2804f8['query']['hasOwnProperty']('nolimit')){_0xfc0ab1[_0xa01d('0x1d')]=qs['limit'](_0x2804f8[_0xa01d('0x2e')][_0xa01d('0x1d')]);_0xfc0ab1[_0xa01d('0x1b')]=qs[_0xa01d('0x1b')](_0x2804f8[_0xa01d('0x2e')][_0xa01d('0x1b')]);}_0xfc0ab1[_0xa01d('0x34')]=qs['sort'](_0x2804f8['query'][_0xa01d('0x35')]);_0xfc0ab1[_0xa01d('0x36')]=qs['filters'](_[_0xa01d('0x37')](_0x2804f8['query'],_0x4c03ff[_0xa01d('0x2f')]),_0x518d1b);if(_0x2804f8[_0xa01d('0x2e')][_0xa01d('0x38')]){_0xfc0ab1[_0xa01d('0x36')]=_[_0xa01d('0x39')](_0xfc0ab1[_0xa01d('0x36')],{'$or':_['map'](_0x518d1b,function(_0x201822){if(_0x201822['type']!==_0xa01d('0x3a')){var _0x2154fc={};_0x2154fc[_0x201822['name']]={'$like':'%'+_0x2804f8[_0xa01d('0x2e')][_0xa01d('0x38')]+'%'};return _0x2154fc;}})});}_0xfc0ab1=_[_0xa01d('0x39')]({},_0xfc0ab1,_0x2804f8[_0xa01d('0x3b')]);var _0x411b3d={'where':_0xfc0ab1['where']};return db[_0xa01d('0x3c')]['count'](_0x411b3d)[_0xa01d('0x24')](function(_0x1e1271){_0x17402d[_0xa01d('0x1e')]=_0x1e1271;if(_0x2804f8[_0xa01d('0x2e')][_0xa01d('0x3d')]){_0xfc0ab1[_0xa01d('0x3e')]=[{'all':!![]}];}return db[_0xa01d('0x3c')][_0xa01d('0x3f')](_0xfc0ab1);})[_0xa01d('0x24')](function(_0x2b75b6){_0x17402d[_0xa01d('0x40')]=_0x2b75b6;return _0x17402d;})[_0xa01d('0x24')](respondWithFilteredResult(_0x24707d,_0xfc0ab1))[_0xa01d('0x41')](handleError(_0x24707d,null));};exports[_0xa01d('0x42')]=function(_0x3fb7e9,_0xad9f2b){var _0x5797c1={'raw':!![],'where':{'id':_0x3fb7e9[_0xa01d('0x43')]['id']}},_0x577d69={};_0x577d69['model']=_[_0xa01d('0x2d')](db['SquareRecording'][_0xa01d('0x2b')]);_0x577d69[_0xa01d('0x2e')]=_[_0xa01d('0x2d')](_0x3fb7e9[_0xa01d('0x2e')]);_0x577d69[_0xa01d('0x2f')]=_[_0xa01d('0x30')](_0x577d69[_0xa01d('0x31')],_0x577d69[_0xa01d('0x2e')]);_0x5797c1['attributes']=_['intersection'](_0x577d69[_0xa01d('0x31')],qs['fields'](_0x3fb7e9[_0xa01d('0x2e')][_0xa01d('0x32')]));_0x5797c1[_0xa01d('0x33')]=_0x5797c1[_0xa01d('0x33')]['length']?_0x5797c1[_0xa01d('0x33')]:_0x577d69[_0xa01d('0x31')];if(_0x3fb7e9[_0xa01d('0x2e')][_0xa01d('0x3d')]){_0x5797c1[_0xa01d('0x3e')]=[{'all':!![]}];}_0x5797c1=_[_0xa01d('0x39')]({},_0x5797c1,_0x3fb7e9[_0xa01d('0x3b')]);return db[_0xa01d('0x3c')][_0xa01d('0x44')](_0x5797c1)[_0xa01d('0x24')](handleEntityNotFound(_0xad9f2b,null))['then'](respondWithResult(_0xad9f2b,null))[_0xa01d('0x41')](handleError(_0xad9f2b,null));};exports[_0xa01d('0x45')]=function(_0x4de0bd,_0x1878f7){return db[_0xa01d('0x3c')][_0xa01d('0x45')](_0x4de0bd['body'],{})[_0xa01d('0x24')](respondWithResult(_0x1878f7,0xc9))[_0xa01d('0x41')](handleError(_0x1878f7,null));};exports[_0xa01d('0x23')]=function(_0x21b87f,_0x350600){if(_0x21b87f['body']['id']){delete _0x21b87f[_0xa01d('0x46')]['id'];}return db[_0xa01d('0x3c')][_0xa01d('0x44')]({'where':{'id':_0x21b87f[_0xa01d('0x43')]['id']}})[_0xa01d('0x24')](handleEntityNotFound(_0x350600,null))['then'](saveUpdates(_0x21b87f[_0xa01d('0x46')],null))[_0xa01d('0x24')](respondWithResult(_0x350600,null))['catch'](handleError(_0x350600,null));};exports[_0xa01d('0x47')]=function(_0x39594a,_0x473eef,_0x3d831){var _0x1aea7b=require('../../components/encryptor');var _0x58764f=![];var _0x9aa99e={};if(_0x39594a[_0xa01d('0x2e')][_0xa01d('0x2c')]&&_0x39594a[_0xa01d('0x2e')]['type']===_0xa01d('0x48')){_0x9aa99e[_0xa01d('0x48')]=_0x39594a[_0xa01d('0x43')]['id'];}else{_0x9aa99e['id']=_0x39594a[_0xa01d('0x43')]['id'];}return db['SquareRecording'][_0xa01d('0x44')]({'where':_0x9aa99e,'attributes':['id',_0xa01d('0x49'),_0xa01d('0x4a')],'raw':!![]})[_0xa01d('0x24')](handleEntityNotFound(_0x473eef,null))[_0xa01d('0x24')](function(_0x156650){if(_0x156650){var _0x1a143b=_0x156650[_0xa01d('0x49')];var _0x359193=util[_0xa01d('0x4b')](_0xa01d('0x4c'),_0x1a143b);if(fs['existsSync'](_0x359193)){_0x58764f=!![];return _0x1aea7b[_0xa01d('0x4d')](_0x359193,_0x1a143b,config[_0xa01d('0x4e')]['recording'])['then'](function(){return _0x156650;});}return _0x156650;}})[_0xa01d('0x24')](function(_0x4c1bf){if(_0x4c1bf){var _0x3a0941=_0x4c1bf[_0xa01d('0x49')];if(!fs[_0xa01d('0x4f')](_0x3a0941)){throw new db[(_0xa01d('0x50'))][(_0xa01d('0x51'))](_0xa01d('0x52'));}if(_0x4c1bf[_0xa01d('0x4a')]){return _0x473eef[_0xa01d('0x47')](_0x3a0941,_0x4c1bf[_0xa01d('0x4a')]+path['extname'](_0x3a0941),function(){if(_0x58764f){fs['unlink'](_0x3a0941);}});}else{return _0x473eef[_0xa01d('0x47')](_0x3a0941,function(_0x2fe251){if(_0x58764f){fs[_0xa01d('0x53')](_0x3a0941);}});}}})[_0xa01d('0x41')](function(_0x288d3d){if(_0x288d3d[_0xa01d('0x54')]===_0xa01d('0x52')){_0x473eef[_0xa01d('0x19')](0x194)[_0xa01d('0x55')](_0xa01d('0x56'));}else{return handleError(_0x473eef,null);}});};exports['destroy']=function(_0x26e555,_0x41aa02){return db[_0xa01d('0x3c')][_0xa01d('0x44')]({'where':{'id':_0x26e555[_0xa01d('0x43')]['id']}})[_0xa01d('0x24')](function(_0x4e1f1b){if(_[_0xa01d('0x57')](_0x4e1f1b)){throw new ReferenceError(_0xa01d('0x58'));}return _0x4e1f1b;})[_0xa01d('0x24')](function(_0x18f5f0){var _0x337d95=_0x18f5f0[_0xa01d('0x49')];logger[_0xa01d('0x59')](_0xa01d('0x5a'),_0x337d95);if(!_[_0xa01d('0x57')](_0x18f5f0['savePath'])&&fs[_0xa01d('0x4f')](_0x337d95)){logger[_0xa01d('0x59')]('File:\x20\x22'+_0x337d95+_0xa01d('0x5b'));fs[_0xa01d('0x5c')](_0x337d95);}_0x337d95=_0x337d95+_0xa01d('0x5d');if(!_['isNil'](_0x18f5f0['savePath'])&&fs['existsSync'](_0x337d95)){logger[_0xa01d('0x59')](_0xa01d('0x5e')+_0x337d95+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa01d('0x5c')](_0x337d95);}return _0x18f5f0;})[_0xa01d('0x24')](function(_0x2861cf){if(!_0x2861cf)throw new InternalError();return _0x2861cf[_0xa01d('0x25')]();})[_0xa01d('0x24')](function(){_0x41aa02[_0xa01d('0x19')](0xcc)[_0xa01d('0x1a')]();})[_0xa01d('0x41')](handleError(_0x41aa02,null));}; \ No newline at end of file +var _0x92d5=['fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','update','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','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/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','then','destroy','name','send','index','map','SquareRecording','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x303ee8,_0x539eed){var _0x5ade59=function(_0x434f24){while(--_0x434f24){_0x303ee8['push'](_0x303ee8['shift']());}};_0x5ade59(++_0x539eed);}(_0x92d5,0x1a0));var _0x592d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x92d5[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x592d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x592d('0x1'));var jsonpatch=require(_0x592d('0x2'));var rp=require(_0x592d('0x3'));var moment=require(_0x592d('0x4'));var BPromise=require(_0x592d('0x5'));var Mustache=require(_0x592d('0x6'));var util=require(_0x592d('0x7'));var path=require(_0x592d('0x8'));var sox=require(_0x592d('0x9'));var csv=require(_0x592d('0xa'));var ejs=require(_0x592d('0xb'));var fs=require('fs');var fs_extra=require(_0x592d('0xc'));var _=require(_0x592d('0xd'));var squel=require(_0x592d('0xe'));var crypto=require(_0x592d('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x592d('0xa'));var querystring=require(_0x592d('0x10'));var Papa=require(_0x592d('0x11'));var Redis=require(_0x592d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x592d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x592d('0x14'))('api');var utils=require(_0x592d('0x15'));var config=require(_0x592d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x592d('0x17'))['db'];function respondWithStatusCode(_0x3584e2,_0x3405aa){_0x3405aa=_0x3405aa||0xcc;return function(_0x4c2223){if(_0x4c2223){return _0x3584e2[_0x592d('0x18')](_0x3405aa);}return _0x3584e2[_0x592d('0x19')](_0x3405aa)['end']();};}function respondWithResult(_0x338916,_0x38bb72){_0x38bb72=_0x38bb72||0xc8;return function(_0x45e59f){if(_0x45e59f){return _0x338916['status'](_0x38bb72)[_0x592d('0x1a')](_0x45e59f);}};}function respondWithFilteredResult(_0x1e2b75,_0x23c6cb){return function(_0xff4089){if(_0xff4089){var _0x5a975f=typeof _0x23c6cb[_0x592d('0x1b')]==='undefined'&&typeof _0x23c6cb[_0x592d('0x1c')]==='undefined';var _0x2d6ad2=_0xff4089['count'];var _0x2276dd=_0x5a975f?0x0:_0x23c6cb['offset'];var _0x4eef49=_0x5a975f?_0xff4089[_0x592d('0x1d')]:_0x23c6cb[_0x592d('0x1b')]+_0x23c6cb['limit'];var _0x2a59e9;if(_0x4eef49>=_0x2d6ad2){_0x4eef49=_0x2d6ad2;_0x2a59e9=0xc8;}else{_0x2a59e9=0xce;}_0x1e2b75['status'](_0x2a59e9);return _0x1e2b75[_0x592d('0x1e')](_0x592d('0x1f'),_0x2276dd+'-'+_0x4eef49+'/'+_0x2d6ad2)[_0x592d('0x1a')](_0xff4089);}return null;};}function patchUpdates(_0x27afbe){return function(_0x23d297){try{jsonpatch['apply'](_0x23d297,_0x27afbe,!![]);}catch(_0x401f36){return BPromise[_0x592d('0x20')](_0x401f36);}return _0x23d297['save']();};}function saveUpdates(_0x3b2789,_0x1001b4){return function(_0x3a020c){if(_0x3a020c){return _0x3a020c['update'](_0x3b2789)[_0x592d('0x21')](function(_0x35201f){return _0x35201f;});}return null;};}function removeEntity(_0x5776c5,_0x596298){return function(_0x1e655f){if(_0x1e655f){return _0x1e655f[_0x592d('0x22')]()[_0x592d('0x21')](function(){_0x5776c5[_0x592d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ab59,_0x4c4dbd){return function(_0x47db93){if(!_0x47db93){_0x41ab59['sendStatus'](0x194);}return _0x47db93;};}function handleError(_0x41cb1e,_0x3f3706){_0x3f3706=_0x3f3706||0x1f4;return function(_0x1627ce){logger['error'](_0x1627ce['stack']);if(_0x1627ce[_0x592d('0x23')]){delete _0x1627ce[_0x592d('0x23')];}_0x41cb1e[_0x592d('0x19')](_0x3f3706)[_0x592d('0x24')](_0x1627ce);};}exports[_0x592d('0x25')]=function(_0xcd6c59,_0x4ca4af){var _0x8f6c53={},_0x555bee={},_0x2382af={'count':0x0,'rows':[]};var _0x4cc71e=_[_0x592d('0x26')](db[_0x592d('0x27')]['rawAttributes'],function(_0x4a1120){return{'name':_0x4a1120[_0x592d('0x28')],'type':_0x4a1120[_0x592d('0x29')][_0x592d('0x2a')]};});_0x555bee['model']=_['map'](_0x4cc71e,'name');_0x555bee[_0x592d('0x2b')]=_[_0x592d('0x2c')](_0xcd6c59[_0x592d('0x2b')]);_0x555bee[_0x592d('0x2d')]=_[_0x592d('0x2e')](_0x555bee[_0x592d('0x2f')],_0x555bee[_0x592d('0x2b')]);_0x8f6c53[_0x592d('0x30')]=_[_0x592d('0x2e')](_0x555bee[_0x592d('0x2f')],qs[_0x592d('0x31')](_0xcd6c59[_0x592d('0x2b')][_0x592d('0x31')]));_0x8f6c53[_0x592d('0x30')]=_0x8f6c53['attributes'][_0x592d('0x32')]?_0x8f6c53['attributes']:_0x555bee[_0x592d('0x2f')];if(!_0xcd6c59[_0x592d('0x2b')][_0x592d('0x33')](_0x592d('0x34'))){_0x8f6c53[_0x592d('0x1c')]=qs[_0x592d('0x1c')](_0xcd6c59['query'][_0x592d('0x1c')]);_0x8f6c53[_0x592d('0x1b')]=qs['offset'](_0xcd6c59[_0x592d('0x2b')][_0x592d('0x1b')]);}_0x8f6c53['order']=qs[_0x592d('0x35')](_0xcd6c59['query'][_0x592d('0x35')]);_0x8f6c53[_0x592d('0x36')]=qs[_0x592d('0x2d')](_[_0x592d('0x37')](_0xcd6c59[_0x592d('0x2b')],_0x555bee[_0x592d('0x2d')]),_0x4cc71e);if(_0xcd6c59[_0x592d('0x2b')]['filter']){_0x8f6c53[_0x592d('0x36')]=_[_0x592d('0x38')](_0x8f6c53[_0x592d('0x36')],{'$or':_[_0x592d('0x26')](_0x4cc71e,function(_0xa2117b){if(_0xa2117b[_0x592d('0x29')]!==_0x592d('0x39')){var _0xe81509={};_0xe81509[_0xa2117b['name']]={'$like':'%'+_0xcd6c59[_0x592d('0x2b')][_0x592d('0x3a')]+'%'};return _0xe81509;}})});}_0x8f6c53=_['merge']({},_0x8f6c53,_0xcd6c59['options']);var _0x56fa15={'where':_0x8f6c53['where']};return db[_0x592d('0x27')][_0x592d('0x1d')](_0x56fa15)[_0x592d('0x21')](function(_0x15a1d4){_0x2382af[_0x592d('0x1d')]=_0x15a1d4;if(_0xcd6c59[_0x592d('0x2b')]['includeAll']){_0x8f6c53[_0x592d('0x3b')]=[{'all':!![]}];}return db[_0x592d('0x27')][_0x592d('0x3c')](_0x8f6c53);})[_0x592d('0x21')](function(_0x258a8b){_0x2382af[_0x592d('0x3d')]=_0x258a8b;return _0x2382af;})['then'](respondWithFilteredResult(_0x4ca4af,_0x8f6c53))[_0x592d('0x3e')](handleError(_0x4ca4af,null));};exports[_0x592d('0x3f')]=function(_0x3c9fd2,_0x26db38){var _0x425c32={'raw':!![],'where':{'id':_0x3c9fd2[_0x592d('0x40')]['id']}},_0x377d08={};_0x377d08[_0x592d('0x2f')]=_[_0x592d('0x2c')](db[_0x592d('0x27')][_0x592d('0x41')]);_0x377d08[_0x592d('0x2b')]=_[_0x592d('0x2c')](_0x3c9fd2[_0x592d('0x2b')]);_0x377d08[_0x592d('0x2d')]=_['intersection'](_0x377d08[_0x592d('0x2f')],_0x377d08['query']);_0x425c32[_0x592d('0x30')]=_[_0x592d('0x2e')](_0x377d08['model'],qs['fields'](_0x3c9fd2[_0x592d('0x2b')][_0x592d('0x31')]));_0x425c32[_0x592d('0x30')]=_0x425c32[_0x592d('0x30')][_0x592d('0x32')]?_0x425c32[_0x592d('0x30')]:_0x377d08[_0x592d('0x2f')];if(_0x3c9fd2['query'][_0x592d('0x42')]){_0x425c32[_0x592d('0x3b')]=[{'all':!![]}];}_0x425c32=_[_0x592d('0x38')]({},_0x425c32,_0x3c9fd2[_0x592d('0x43')]);return db[_0x592d('0x27')][_0x592d('0x44')](_0x425c32)['then'](handleEntityNotFound(_0x26db38,null))[_0x592d('0x21')](respondWithResult(_0x26db38,null))[_0x592d('0x3e')](handleError(_0x26db38,null));};exports[_0x592d('0x45')]=function(_0x3566f1,_0x1ec729){return db['SquareRecording'][_0x592d('0x45')](_0x3566f1[_0x592d('0x46')],{})['then'](respondWithResult(_0x1ec729,0xc9))[_0x592d('0x3e')](handleError(_0x1ec729,null));};exports[_0x592d('0x47')]=function(_0xf236cf,_0x50c506){if(_0xf236cf[_0x592d('0x46')]['id']){delete _0xf236cf[_0x592d('0x46')]['id'];}return db[_0x592d('0x27')][_0x592d('0x44')]({'where':{'id':_0xf236cf[_0x592d('0x40')]['id']}})['then'](handleEntityNotFound(_0x50c506,null))[_0x592d('0x21')](saveUpdates(_0xf236cf['body'],null))[_0x592d('0x21')](respondWithResult(_0x50c506,null))[_0x592d('0x3e')](handleError(_0x50c506,null));};exports[_0x592d('0x48')]=function(_0x436d4e,_0x149684,_0xf43c7){var _0x296280=require('../../components/encryptor');var _0x5bef0b=![];var _0x5cceac={};if(_0x436d4e[_0x592d('0x2b')][_0x592d('0x29')]&&_0x436d4e['query'][_0x592d('0x29')]===_0x592d('0x49')){_0x5cceac[_0x592d('0x49')]=_0x436d4e[_0x592d('0x40')]['id'];}else{_0x5cceac['id']=_0x436d4e[_0x592d('0x40')]['id'];}return db[_0x592d('0x27')][_0x592d('0x44')]({'where':_0x5cceac,'attributes':['id',_0x592d('0x4a'),'filename'],'raw':!![]})[_0x592d('0x21')](handleEntityNotFound(_0x149684,null))[_0x592d('0x21')](function(_0x4d95a2){if(_0x4d95a2){var _0x457aa9=_0x4d95a2['savePath'];var _0x5da522=util[_0x592d('0x4b')](_0x592d('0x4c'),_0x457aa9);if(fs[_0x592d('0x4d')](_0x5da522)){_0x5bef0b=!![];return _0x296280[_0x592d('0x4e')](_0x5da522,_0x457aa9,config[_0x592d('0x4f')][_0x592d('0x50')])['then'](function(){return _0x4d95a2;});}return _0x4d95a2;}})[_0x592d('0x21')](function(_0x440416){if(_0x440416){var _0x5af060=_0x440416[_0x592d('0x4a')];if(!fs[_0x592d('0x4d')](_0x5af060)){throw new db['Sequelize'][(_0x592d('0x51'))](_0x592d('0x52'));}if(_0x440416['filename']){return _0x149684['download'](_0x5af060,_0x440416['filename']+path['extname'](_0x5af060),function(){if(_0x5bef0b){fs[_0x592d('0x53')](_0x5af060);}});}else{return _0x149684[_0x592d('0x48')](_0x5af060,function(_0x5cf80d){if(_0x5bef0b){fs[_0x592d('0x53')](_0x5af060);}});}}})[_0x592d('0x3e')](function(_0x46586d){if(_0x46586d[_0x592d('0x54')]==='SquareRecording\x20not\x20found'){_0x149684['status'](0x194)[_0x592d('0x24')](_0x592d('0x55'));}else{return handleError(_0x149684,null);}});};exports[_0x592d('0x22')]=function(_0xb83a39,_0x26f034){return db[_0x592d('0x27')]['find']({'where':{'id':_0xb83a39['params']['id']}})[_0x592d('0x21')](function(_0x3f5972){if(_[_0x592d('0x56')](_0x3f5972)){throw new ReferenceError(_0x592d('0x57'));}return _0x3f5972;})['then'](function(_0x4ed109){var _0x168feb=_0x4ed109[_0x592d('0x4a')];logger[_0x592d('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x168feb);if(!_['isNil'](_0x4ed109[_0x592d('0x4a')])&&fs[_0x592d('0x4d')](_0x168feb)){logger[_0x592d('0x58')](_0x592d('0x59')+_0x168feb+_0x592d('0x5a'));fs[_0x592d('0x5b')](_0x168feb);}_0x168feb=_0x168feb+_0x592d('0x5c');if(!_[_0x592d('0x56')](_0x4ed109[_0x592d('0x4a')])&&fs[_0x592d('0x4d')](_0x168feb)){logger[_0x592d('0x58')](_0x592d('0x59')+_0x168feb+_0x592d('0x5a'));fs[_0x592d('0x5b')](_0x168feb);}return _0x4ed109;})[_0x592d('0x21')](function(_0x131ddf){if(!_0x131ddf)throw new InternalError();return _0x131ddf[_0x592d('0x22')]();})[_0x592d('0x21')](function(){_0x26f034[_0x592d('0x19')](0xcc)['end']();})['catch'](handleError(_0x26f034,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2c8ce99..b48ebe9 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 _0xb296=['request-promise','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3eb152,_0x554c71){var _0x3294c8=function(_0x8feeb3){while(--_0x8feeb3){_0x3eb152['push'](_0x3eb152['shift']());}};_0x3294c8(++_0x554c71);}(_0xb296,0xa3));var _0x6b29=function(_0x4d8fd7,_0x22e725){_0x4d8fd7=_0x4d8fd7-0x0;var _0x1b4eeb=_0xb296[_0x4d8fd7];return _0x1b4eeb;};'use strict';var _=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var logger=require(_0x6b29('0x2'))(_0x6b29('0x3'));var moment=require(_0x6b29('0x4'));var BPromise=require(_0x6b29('0x5'));var rp=require(_0x6b29('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b29('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b29('0x8'));module[_0x6b29('0x9')]=function(_0x5e0aa1,_0x327329){return _0x5e0aa1[_0x6b29('0xa')](_0x6b29('0xb'),attributes,{'tableName':_0x6b29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4279=['moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareRecording','square_recordings','util','../../config/logger'];(function(_0x3ee1fe,_0x59f2a1){var _0x1ae57a=function(_0x1ef0c4){while(--_0x1ef0c4){_0x3ee1fe['push'](_0x3ee1fe['shift']());}};_0x1ae57a(++_0x59f2a1);}(_0x4279,0x8d));var _0x9427=function(_0x301448,_0x33e028){_0x301448=_0x301448-0x0;var _0x4220da=_0x4279[_0x301448];return _0x4220da;};'use strict';var _=require('lodash');var util=require(_0x9427('0x0'));var logger=require(_0x9427('0x1'))('api');var moment=require(_0x9427('0x2'));var BPromise=require(_0x9427('0x3'));var rp=require(_0x9427('0x4'));var fs=require('fs');var path=require(_0x9427('0x5'));var rimraf=require('rimraf');var config=require(_0x9427('0x6'));var attributes=require('./squareRecording.attributes');module[_0x9427('0x7')]=function(_0x2a0b3e,_0x5e9d1e){return _0x2a0b3e[_0x9427('0x8')](_0x9427('0x9'),attributes,{'tableName':_0x9427('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 a61af42..1c77599 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 _0x9b97=['create','body','options','CreateSquareRecording','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x433d8f,_0x3a57e5){var _0x5a5d56=function(_0x17a6d6){while(--_0x17a6d6){_0x433d8f['push'](_0x433d8f['shift']());}};_0x5a5d56(++_0x3a57e5);}(_0x9b97,0x148));var _0x79b9=function(_0x598963,_0x5905e4){_0x598963=_0x598963-0x0;var _0x2305b0=_0x9b97[_0x598963];return _0x2305b0;};'use strict';var _=require(_0x79b9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x79b9('0x1'));var fs=require('fs');var Redis=require(_0x79b9('0x2'));var db=require(_0x79b9('0x3'))['db'];var utils=require(_0x79b9('0x4'));var logger=require(_0x79b9('0x5'))(_0x79b9('0x6'));var config=require(_0x79b9('0x7'));var jayson=require(_0x79b9('0x8'));var client=jayson[_0x79b9('0x9')][_0x79b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a25af,_0xf56d61,_0x55f840){return new BPromise(function(_0x1ae1c1,_0x44b0ca){return client['request'](_0x3a25af,_0x55f840)[_0x79b9('0xb')](function(_0x3b8949){logger[_0x79b9('0xc')](_0x79b9('0xd'),_0xf56d61,_0x79b9('0xe'));logger[_0x79b9('0xf')](_0x79b9('0x10'),_0xf56d61,_0x79b9('0xe'),JSON[_0x79b9('0x11')](_0x3b8949));if(_0x3b8949[_0x79b9('0x12')]){if(_0x3b8949[_0x79b9('0x12')][_0x79b9('0x13')]===0x1f4){logger[_0x79b9('0x12')](_0x79b9('0xd'),_0xf56d61,_0x3b8949[_0x79b9('0x12')][_0x79b9('0x14')]);return _0x44b0ca(_0x3b8949[_0x79b9('0x12')][_0x79b9('0x14')]);}logger[_0x79b9('0x12')](_0x79b9('0xd'),_0xf56d61,_0x3b8949[_0x79b9('0x12')]['message']);return _0x1ae1c1(_0x3b8949['error']['message']);}else{logger['info'](_0x79b9('0xd'),_0xf56d61,'request\x20sent');_0x1ae1c1(_0x3b8949[_0x79b9('0x15')][_0x79b9('0x14')]);}})[_0x79b9('0x16')](function(_0x1b3200){logger['error'](_0x79b9('0xd'),_0xf56d61,_0x1b3200);_0x44b0ca(_0x1b3200);});});}exports['CreateSquareRecording']=function(_0x3701b2){var _0x13c058=this;return new Promise(function(_0x360c7c,_0x198542){return db['SquareRecording'][_0x79b9('0x17')](_0x3701b2[_0x79b9('0x18')],{'raw':_0x3701b2['options']?_0x3701b2[_0x79b9('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x79b9('0xb')](function(_0x28d815){logger[_0x79b9('0xc')]('CreateSquareRecording',_0x3701b2);logger['debug'](_0x79b9('0x1a'),_0x3701b2,JSON[_0x79b9('0x11')](_0x28d815));_0x360c7c(_0x28d815);})[_0x79b9('0x16')](function(_0xac75b4){logger[_0x79b9('0x12')]('CreateSquareRecording',_0xac75b4[_0x79b9('0x14')],_0x3701b2);_0x198542(_0x13c058[_0x79b9('0x12')](0x1f4,_0xac75b4[_0x79b9('0x14')]));});});}; \ No newline at end of file +var _0xbf5f=['create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording'];(function(_0x2fddab,_0x59a0eb){var _0x478274=function(_0x49e4d7){while(--_0x49e4d7){_0x2fddab['push'](_0x2fddab['shift']());}};_0x478274(++_0x59a0eb);}(_0xbf5f,0x6c));var _0xfbf5=function(_0x2a9aaf,_0x435d7a){_0x2a9aaf=_0x2a9aaf-0x0;var _0x1b7173=_0xbf5f[_0x2a9aaf];return _0x1b7173;};'use strict';var _=require(_0xfbf5('0x0'));var util=require(_0xfbf5('0x1'));var moment=require(_0xfbf5('0x2'));var BPromise=require(_0xfbf5('0x3'));var rs=require(_0xfbf5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbf5('0x6'))(_0xfbf5('0x7'));var config=require('../../config/environment');var jayson=require(_0xfbf5('0x8'));var client=jayson[_0xfbf5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x384dee,_0x1d378b,_0x481fd6){return new BPromise(function(_0x42fec5,_0x255b23){return client[_0xfbf5('0xa')](_0x384dee,_0x481fd6)['then'](function(_0xf77ebc){logger[_0xfbf5('0xb')]('SquareRecording,\x20%s,\x20%s',_0x1d378b,'request\x20sent');logger[_0xfbf5('0xc')](_0xfbf5('0xd'),_0x1d378b,_0xfbf5('0xe'),JSON[_0xfbf5('0xf')](_0xf77ebc));if(_0xf77ebc['error']){if(_0xf77ebc[_0xfbf5('0x10')]['code']===0x1f4){logger[_0xfbf5('0x10')](_0xfbf5('0x11'),_0x1d378b,_0xf77ebc['error']['message']);return _0x255b23(_0xf77ebc[_0xfbf5('0x10')][_0xfbf5('0x12')]);}logger[_0xfbf5('0x10')](_0xfbf5('0x11'),_0x1d378b,_0xf77ebc[_0xfbf5('0x10')][_0xfbf5('0x12')]);return _0x42fec5(_0xf77ebc['error'][_0xfbf5('0x12')]);}else{logger[_0xfbf5('0xb')]('SquareRecording,\x20%s,\x20%s',_0x1d378b,'request\x20sent');_0x42fec5(_0xf77ebc[_0xfbf5('0x13')][_0xfbf5('0x12')]);}})[_0xfbf5('0x14')](function(_0x3f202d){logger[_0xfbf5('0x10')](_0xfbf5('0x11'),_0x1d378b,_0x3f202d);_0x255b23(_0x3f202d);});});}exports[_0xfbf5('0x15')]=function(_0xa3f284){var _0x3f1092=this;return new Promise(function(_0x32a48f,_0x32c82c){return db['SquareRecording'][_0xfbf5('0x16')](_0xa3f284[_0xfbf5('0x17')],{'raw':_0xa3f284[_0xfbf5('0x18')]?_0xa3f284['options'][_0xfbf5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x599e98){logger['info']('CreateSquareRecording',_0xa3f284);logger['debug']('CreateSquareRecording',_0xa3f284,JSON[_0xfbf5('0xf')](_0x599e98));_0x32a48f(_0x599e98);})[_0xfbf5('0x14')](function(_0x16411e){logger[_0xfbf5('0x10')](_0xfbf5('0x15'),_0x16411e[_0xfbf5('0x12')],_0xa3f284);_0x32c82c(_0x3f1092[_0xfbf5('0x10')](0x1f4,_0x16411e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1f1a801..c823f5f 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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x10dd56,_0x3c50b1){var _0x4ee4b7=function(_0xd6ae15){while(--_0xd6ae15){_0x10dd56['push'](_0x10dd56['shift']());}};_0x4ee4b7(++_0x3c50b1);}(_0xb10b,0x12a));var _0xbb10=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0xb10b[_0x446e61];return _0x4160a8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x265961,_0x210a67){var _0xd7c16b=function(_0x556628){while(--_0x556628){_0x265961['push'](_0x265961['shift']());}};_0xd7c16b(++_0x210a67);}(_0xb10b,0x12a));var _0xbb10=function(_0x413426,_0x4f7814){_0x413426=_0x413426-0x0;var _0x5576e2=_0xb10b[_0x413426];return _0x5576e2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d8dc3b4..114773c 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 _0xbf9c=['STRING','DATE','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xbf9c,0xe9));var _0xcbf9=function(_0x420d4f,_0x3326e6){_0x420d4f=_0x420d4f-0x0;var _0x368f96=_0xbf9c[_0x420d4f];return _0x368f96;};'use strict';var Sequelize=require('sequelize');module[_0xcbf9('0x0')]={'network':{'type':Sequelize[_0xcbf9('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xcbf9('0x1')]},'channel':{'type':Sequelize[_0xcbf9('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xcbf9('0x1')]},'calleridname':{'type':Sequelize[_0xcbf9('0x1')]},'callingpres':{'type':Sequelize[_0xcbf9('0x1')]},'callingani2':{'type':Sequelize[_0xcbf9('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xcbf9('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xcbf9('0x1')]},'context':{'type':Sequelize[_0xcbf9('0x1')]},'extension':{'type':Sequelize[_0xcbf9('0x1')]},'priority':{'type':Sequelize[_0xcbf9('0x1')]},'enhanced':{'type':Sequelize[_0xcbf9('0x1')]},'accountcode':{'type':Sequelize[_0xcbf9('0x1')]},'threadid':{'type':Sequelize[_0xcbf9('0x1')]},'project_name':{'type':Sequelize[_0xcbf9('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcbf9('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf211=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0xac3aa1,_0x2c961f){var _0x9f98bc=function(_0x182bb0){while(--_0x182bb0){_0xac3aa1['push'](_0xac3aa1['shift']());}};_0x9f98bc(++_0x2c961f);}(_0xf211,0x198));var _0x1f21=function(_0x5c3d11,_0x589686){_0x5c3d11=_0x5c3d11-0x0;var _0x31e455=_0xf211[_0x5c3d11];return _0x31e455;};'use strict';var Sequelize=require(_0x1f21('0x0'));module[_0x1f21('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x1f21('0x2')]},'request':{'type':Sequelize[_0x1f21('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1f21('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1f21('0x2')]},'version':{'type':Sequelize[_0x1f21('0x2')]},'callerid':{'type':Sequelize[_0x1f21('0x2')]},'calleridname':{'type':Sequelize[_0x1f21('0x2')]},'callingpres':{'type':Sequelize[_0x1f21('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x1f21('0x2')]},'dnid':{'type':Sequelize[_0x1f21('0x2')]},'rdnis':{'type':Sequelize[_0x1f21('0x2')]},'context':{'type':Sequelize[_0x1f21('0x2')]},'extension':{'type':Sequelize[_0x1f21('0x2')]},'priority':{'type':Sequelize[_0x1f21('0x2')]},'enhanced':{'type':Sequelize[_0x1f21('0x2')]},'accountcode':{'type':Sequelize[_0x1f21('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1f21('0x3')]},'bot':{'type':Sequelize[_0x1f21('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b27f66c..e92991c 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 _0xd946=['body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','SquareReport','findAll','rows','catch','params','intersection','find','create'];(function(_0x24fd11,_0x57c976){var _0x5da68f=function(_0x5a37d6){while(--_0x5a37d6){_0x24fd11['push'](_0x24fd11['shift']());}};_0x5da68f(++_0x57c976);}(_0xd946,0x98));var _0x6d94=function(_0xcfb68,_0x25217e){_0xcfb68=_0xcfb68-0x0;var _0x4f873d=_0xd946[_0xcfb68];return _0x4f873d;};'use strict';var emlformat=require(_0x6d94('0x0'));var rimraf=require(_0x6d94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d94('0x2'));var rp=require(_0x6d94('0x3'));var moment=require(_0x6d94('0x4'));var BPromise=require(_0x6d94('0x5'));var Mustache=require(_0x6d94('0x6'));var util=require(_0x6d94('0x7'));var path=require(_0x6d94('0x8'));var sox=require(_0x6d94('0x9'));var csv=require(_0x6d94('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d94('0xb'));var _=require(_0x6d94('0xc'));var squel=require(_0x6d94('0xd'));var crypto=require(_0x6d94('0xe'));var jsforce=require(_0x6d94('0xf'));var deskjs=require(_0x6d94('0x10'));var toCsv=require(_0x6d94('0xa'));var querystring=require('querystring');var Papa=require(_0x6d94('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d94('0x12'));var as=require(_0x6d94('0x13'));var hardwareService=require(_0x6d94('0x14'));var logger=require('../../config/logger')(_0x6d94('0x15'));var utils=require(_0x6d94('0x16'));var config=require(_0x6d94('0x17'));var licenseUtil=require(_0x6d94('0x18'));var db=require(_0x6d94('0x19'))['db'];function respondWithStatusCode(_0x4b476d,_0x33d4cc){_0x33d4cc=_0x33d4cc||0xcc;return function(_0x325cf7){if(_0x325cf7){return _0x4b476d[_0x6d94('0x1a')](_0x33d4cc);}return _0x4b476d[_0x6d94('0x1b')](_0x33d4cc)[_0x6d94('0x1c')]();};}function respondWithResult(_0x59cfbf,_0x5c2bb2){_0x5c2bb2=_0x5c2bb2||0xc8;return function(_0x1a7e67){if(_0x1a7e67){return _0x59cfbf[_0x6d94('0x1b')](_0x5c2bb2)[_0x6d94('0x1d')](_0x1a7e67);}};}function respondWithFilteredResult(_0x131a74,_0x4f1c80){return function(_0x2f73ef){if(_0x2f73ef){var _0x48f7b9=typeof _0x4f1c80[_0x6d94('0x1e')]===_0x6d94('0x1f')&&typeof _0x4f1c80[_0x6d94('0x20')]==='undefined';var _0x32af66=_0x2f73ef['count'];var _0x31044a=_0x48f7b9?0x0:_0x4f1c80['offset'];var _0x10c618=_0x48f7b9?_0x2f73ef[_0x6d94('0x21')]:_0x4f1c80[_0x6d94('0x1e')]+_0x4f1c80[_0x6d94('0x20')];var _0x2be5a4;if(_0x10c618>=_0x32af66){_0x10c618=_0x32af66;_0x2be5a4=0xc8;}else{_0x2be5a4=0xce;}_0x131a74[_0x6d94('0x1b')](_0x2be5a4);return _0x131a74[_0x6d94('0x22')]('Content-Range',_0x31044a+'-'+_0x10c618+'/'+_0x32af66)[_0x6d94('0x1d')](_0x2f73ef);}return null;};}function patchUpdates(_0x4c4c99){return function(_0x26ffc1){try{jsonpatch[_0x6d94('0x23')](_0x26ffc1,_0x4c4c99,!![]);}catch(_0x441fe8){return BPromise[_0x6d94('0x24')](_0x441fe8);}return _0x26ffc1['save']();};}function saveUpdates(_0x493f05,_0x195cc1){return function(_0x481e25){if(_0x481e25){return _0x481e25['update'](_0x493f05)[_0x6d94('0x25')](function(_0x3890f8){return _0x3890f8;});}return null;};}function removeEntity(_0x41a44d,_0x507899){return function(_0x309a5e){if(_0x309a5e){return _0x309a5e[_0x6d94('0x26')]()[_0x6d94('0x25')](function(){_0x41a44d[_0x6d94('0x1b')](0xcc)[_0x6d94('0x1c')]();});}};}function handleEntityNotFound(_0x33ddc7,_0x548c5a){return function(_0x420253){if(!_0x420253){_0x33ddc7[_0x6d94('0x1a')](0x194);}return _0x420253;};}function handleError(_0x1e4d9e,_0x74b252){_0x74b252=_0x74b252||0x1f4;return function(_0x3768c1){logger[_0x6d94('0x27')](_0x3768c1[_0x6d94('0x28')]);if(_0x3768c1[_0x6d94('0x29')]){delete _0x3768c1[_0x6d94('0x29')];}_0x1e4d9e[_0x6d94('0x1b')](_0x74b252)[_0x6d94('0x2a')](_0x3768c1);};}exports[_0x6d94('0x2b')]=function(_0x425160,_0x10980c){var _0x561162={},_0x9bd1e2={},_0x302d3d={'count':0x0,'rows':[]};var _0x511ec0=_[_0x6d94('0x2c')](db['SquareReport'][_0x6d94('0x2d')],function(_0x233854){return{'name':_0x233854[_0x6d94('0x2e')],'type':_0x233854[_0x6d94('0x2f')][_0x6d94('0x30')]};});_0x9bd1e2[_0x6d94('0x31')]=_['map'](_0x511ec0,_0x6d94('0x29'));_0x9bd1e2[_0x6d94('0x32')]=_[_0x6d94('0x33')](_0x425160['query']);_0x9bd1e2[_0x6d94('0x34')]=_['intersection'](_0x9bd1e2[_0x6d94('0x31')],_0x9bd1e2[_0x6d94('0x32')]);_0x561162['attributes']=_['intersection'](_0x9bd1e2[_0x6d94('0x31')],qs[_0x6d94('0x35')](_0x425160['query'][_0x6d94('0x35')]));_0x561162[_0x6d94('0x36')]=_0x561162['attributes'][_0x6d94('0x37')]?_0x561162['attributes']:_0x9bd1e2[_0x6d94('0x31')];if(!_0x425160['query']['hasOwnProperty']('nolimit')){_0x561162['limit']=qs[_0x6d94('0x20')](_0x425160[_0x6d94('0x32')][_0x6d94('0x20')]);_0x561162['offset']=qs[_0x6d94('0x1e')](_0x425160[_0x6d94('0x32')]['offset']);}_0x561162[_0x6d94('0x38')]=qs['sort'](_0x425160[_0x6d94('0x32')][_0x6d94('0x39')]);_0x561162[_0x6d94('0x3a')]=qs['filters'](_[_0x6d94('0x3b')](_0x425160[_0x6d94('0x32')],_0x9bd1e2[_0x6d94('0x34')]),_0x511ec0);if(_0x425160[_0x6d94('0x32')][_0x6d94('0x3c')]){_0x561162[_0x6d94('0x3a')]=_[_0x6d94('0x3d')](_0x561162[_0x6d94('0x3a')],{'$or':_[_0x6d94('0x2c')](_0x511ec0,function(_0x3533f6){if(_0x3533f6[_0x6d94('0x2f')]!==_0x6d94('0x3e')){var _0xa6c851={};_0xa6c851[_0x3533f6[_0x6d94('0x29')]]={'$like':'%'+_0x425160[_0x6d94('0x32')][_0x6d94('0x3c')]+'%'};return _0xa6c851;}})});}_0x561162=_['merge']({},_0x561162,_0x425160[_0x6d94('0x3f')]);var _0x401e05={'where':_0x561162[_0x6d94('0x3a')]};return db['SquareReport']['count'](_0x401e05)[_0x6d94('0x25')](function(_0x37f3c3){_0x302d3d[_0x6d94('0x21')]=_0x37f3c3;if(_0x425160[_0x6d94('0x32')]['includeAll']){_0x561162[_0x6d94('0x40')]=[{'all':!![]}];}return db[_0x6d94('0x41')][_0x6d94('0x42')](_0x561162);})[_0x6d94('0x25')](function(_0x220642){_0x302d3d[_0x6d94('0x43')]=_0x220642;return _0x302d3d;})[_0x6d94('0x25')](respondWithFilteredResult(_0x10980c,_0x561162))[_0x6d94('0x44')](handleError(_0x10980c,null));};exports['show']=function(_0x1c2156,_0x515dc6){var _0xbfff73={'raw':!![],'where':{'id':_0x1c2156[_0x6d94('0x45')]['id']}},_0x2e88f6={};_0x2e88f6[_0x6d94('0x31')]=_[_0x6d94('0x33')](db['SquareReport'][_0x6d94('0x2d')]);_0x2e88f6[_0x6d94('0x32')]=_['keys'](_0x1c2156[_0x6d94('0x32')]);_0x2e88f6[_0x6d94('0x34')]=_[_0x6d94('0x46')](_0x2e88f6[_0x6d94('0x31')],_0x2e88f6[_0x6d94('0x32')]);_0xbfff73['attributes']=_[_0x6d94('0x46')](_0x2e88f6[_0x6d94('0x31')],qs['fields'](_0x1c2156['query'][_0x6d94('0x35')]));_0xbfff73['attributes']=_0xbfff73[_0x6d94('0x36')][_0x6d94('0x37')]?_0xbfff73[_0x6d94('0x36')]:_0x2e88f6[_0x6d94('0x31')];if(_0x1c2156['query']['includeAll']){_0xbfff73['include']=[{'all':!![]}];}_0xbfff73=_[_0x6d94('0x3d')]({},_0xbfff73,_0x1c2156[_0x6d94('0x3f')]);return db[_0x6d94('0x41')][_0x6d94('0x47')](_0xbfff73)['then'](handleEntityNotFound(_0x515dc6,null))[_0x6d94('0x25')](respondWithResult(_0x515dc6,null))[_0x6d94('0x44')](handleError(_0x515dc6,null));};exports[_0x6d94('0x48')]=function(_0x5e8d6c,_0x1cbe1a){return db['SquareReport'][_0x6d94('0x48')](_0x5e8d6c[_0x6d94('0x49')],{})[_0x6d94('0x25')](respondWithResult(_0x1cbe1a,0xc9))[_0x6d94('0x44')](handleError(_0x1cbe1a,null));};exports['update']=function(_0x3de8b4,_0x49153a){if(_0x3de8b4[_0x6d94('0x49')]['id']){delete _0x3de8b4[_0x6d94('0x49')]['id'];}return db['SquareReport'][_0x6d94('0x47')]({'where':{'id':_0x3de8b4[_0x6d94('0x45')]['id']}})[_0x6d94('0x25')](handleEntityNotFound(_0x49153a,null))['then'](saveUpdates(_0x3de8b4['body'],null))[_0x6d94('0x25')](respondWithResult(_0x49153a,null))['catch'](handleError(_0x49153a,null));};exports['destroy']=function(_0x51a283,_0x3eaf87){return db['SquareReport'][_0x6d94('0x47')]({'where':{'id':_0x51a283[_0x6d94('0x45')]['id']}})[_0x6d94('0x25')](handleEntityNotFound(_0x3eaf87,null))[_0x6d94('0x25')](removeEntity(_0x3eaf87,null))[_0x6d94('0x44')](handleError(_0x3eaf87,null));};exports[_0x6d94('0x4a')]=function(_0x1d7065,_0x34ee62){return db['SquareReport'][_0x6d94('0x4a')]()[_0x6d94('0x25')](respondWithResult(_0x34ee62,null))[_0x6d94('0x44')](handleError(_0x34ee62,null));}; \ No newline at end of file +var _0xf33d=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','key','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','type','VIRTUAL','merge','options','where','includeAll','rows','catch','params','model','include','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x5a43d4,_0xec3b1f){var _0x499187=function(_0x483840){while(--_0x483840){_0x5a43d4['push'](_0x5a43d4['shift']());}};_0x499187(++_0xec3b1f);}(_0xf33d,0x113));var _0xdf33=function(_0x9085d3,_0x4302e8){_0x9085d3=_0x9085d3-0x0;var _0x3d07bd=_0xf33d[_0x9085d3];return _0x3d07bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf33('0x0'));var zipdir=require(_0xdf33('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf33('0x2'));var moment=require(_0xdf33('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdf33('0x4'));var util=require(_0xdf33('0x5'));var path=require(_0xdf33('0x6'));var sox=require('sox');var csv=require(_0xdf33('0x7'));var ejs=require(_0xdf33('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf33('0x9'));var squel=require(_0xdf33('0xa'));var crypto=require(_0xdf33('0xb'));var jsforce=require(_0xdf33('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf33('0x7'));var querystring=require('querystring');var Papa=require(_0xdf33('0xd'));var Redis=require(_0xdf33('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf33('0xf'));var hardwareService=require(_0xdf33('0x10'));var logger=require('../../config/logger')(_0xdf33('0x11'));var utils=require(_0xdf33('0x12'));var config=require(_0xdf33('0x13'));var licenseUtil=require(_0xdf33('0x14'));var db=require(_0xdf33('0x15'))['db'];function respondWithStatusCode(_0x2fa508,_0x3a7bf1){_0x3a7bf1=_0x3a7bf1||0xcc;return function(_0x1a43d4){if(_0x1a43d4){return _0x2fa508['sendStatus'](_0x3a7bf1);}return _0x2fa508[_0xdf33('0x16')](_0x3a7bf1)['end']();};}function respondWithResult(_0x51a875,_0x48cb73){_0x48cb73=_0x48cb73||0xc8;return function(_0x16be2f){if(_0x16be2f){return _0x51a875[_0xdf33('0x16')](_0x48cb73)[_0xdf33('0x17')](_0x16be2f);}};}function respondWithFilteredResult(_0x1dce7a,_0x3301f2){return function(_0x3eaed8){if(_0x3eaed8){var _0x1cdc55=typeof _0x3301f2[_0xdf33('0x18')]===_0xdf33('0x19')&&typeof _0x3301f2[_0xdf33('0x1a')]===_0xdf33('0x19');var _0x202c8f=_0x3eaed8[_0xdf33('0x1b')];var _0x4ac38e=_0x1cdc55?0x0:_0x3301f2[_0xdf33('0x18')];var _0x51964b=_0x1cdc55?_0x3eaed8[_0xdf33('0x1b')]:_0x3301f2[_0xdf33('0x18')]+_0x3301f2[_0xdf33('0x1a')];var _0x115c9a;if(_0x51964b>=_0x202c8f){_0x51964b=_0x202c8f;_0x115c9a=0xc8;}else{_0x115c9a=0xce;}_0x1dce7a[_0xdf33('0x16')](_0x115c9a);return _0x1dce7a[_0xdf33('0x1c')](_0xdf33('0x1d'),_0x4ac38e+'-'+_0x51964b+'/'+_0x202c8f)[_0xdf33('0x17')](_0x3eaed8);}return null;};}function patchUpdates(_0x3761fe){return function(_0x1eb95a){try{jsonpatch[_0xdf33('0x1e')](_0x1eb95a,_0x3761fe,!![]);}catch(_0x4dd443){return BPromise[_0xdf33('0x1f')](_0x4dd443);}return _0x1eb95a[_0xdf33('0x20')]();};}function saveUpdates(_0x202d10,_0x96a157){return function(_0x240548){if(_0x240548){return _0x240548[_0xdf33('0x21')](_0x202d10)[_0xdf33('0x22')](function(_0x51d8d9){return _0x51d8d9;});}return null;};}function removeEntity(_0xb572d7,_0x23f4b0){return function(_0x3c737c){if(_0x3c737c){return _0x3c737c['destroy']()[_0xdf33('0x22')](function(){_0xb572d7[_0xdf33('0x16')](0xcc)[_0xdf33('0x23')]();});}};}function handleEntityNotFound(_0x40000e,_0x1bbd65){return function(_0x4ccba8){if(!_0x4ccba8){_0x40000e[_0xdf33('0x24')](0x194);}return _0x4ccba8;};}function handleError(_0x395407,_0xf43229){_0xf43229=_0xf43229||0x1f4;return function(_0xa4016c){logger[_0xdf33('0x25')](_0xa4016c[_0xdf33('0x26')]);if(_0xa4016c['name']){delete _0xa4016c[_0xdf33('0x27')];}_0x395407[_0xdf33('0x16')](_0xf43229)[_0xdf33('0x28')](_0xa4016c);};}exports[_0xdf33('0x29')]=function(_0x23f7f2,_0x17f38a){var _0x230adc={},_0x502532={},_0x1babc3={'count':0x0,'rows':[]};var _0x31715b=_['map'](db[_0xdf33('0x2a')][_0xdf33('0x2b')],function(_0x51fb93){return{'name':_0x51fb93[_0xdf33('0x2c')],'type':_0x51fb93['type'][_0xdf33('0x2d')]};});_0x502532['model']=_[_0xdf33('0x2e')](_0x31715b,_0xdf33('0x27'));_0x502532[_0xdf33('0x2f')]=_[_0xdf33('0x30')](_0x23f7f2['query']);_0x502532[_0xdf33('0x31')]=_['intersection'](_0x502532['model'],_0x502532[_0xdf33('0x2f')]);_0x230adc[_0xdf33('0x32')]=_[_0xdf33('0x33')](_0x502532['model'],qs[_0xdf33('0x34')](_0x23f7f2[_0xdf33('0x2f')][_0xdf33('0x34')]));_0x230adc[_0xdf33('0x32')]=_0x230adc['attributes'][_0xdf33('0x35')]?_0x230adc[_0xdf33('0x32')]:_0x502532['model'];if(!_0x23f7f2[_0xdf33('0x2f')][_0xdf33('0x36')]('nolimit')){_0x230adc[_0xdf33('0x1a')]=qs[_0xdf33('0x1a')](_0x23f7f2['query'][_0xdf33('0x1a')]);_0x230adc[_0xdf33('0x18')]=qs[_0xdf33('0x18')](_0x23f7f2[_0xdf33('0x2f')][_0xdf33('0x18')]);}_0x230adc[_0xdf33('0x37')]=qs[_0xdf33('0x38')](_0x23f7f2[_0xdf33('0x2f')][_0xdf33('0x38')]);_0x230adc['where']=qs[_0xdf33('0x31')](_[_0xdf33('0x39')](_0x23f7f2[_0xdf33('0x2f')],_0x502532['filters']),_0x31715b);if(_0x23f7f2['query'][_0xdf33('0x3a')]){_0x230adc['where']=_['merge'](_0x230adc['where'],{'$or':_[_0xdf33('0x2e')](_0x31715b,function(_0x712415){if(_0x712415[_0xdf33('0x3b')]!==_0xdf33('0x3c')){var _0x30075f={};_0x30075f[_0x712415[_0xdf33('0x27')]]={'$like':'%'+_0x23f7f2['query'][_0xdf33('0x3a')]+'%'};return _0x30075f;}})});}_0x230adc=_[_0xdf33('0x3d')]({},_0x230adc,_0x23f7f2[_0xdf33('0x3e')]);var _0x140fb6={'where':_0x230adc[_0xdf33('0x3f')]};return db[_0xdf33('0x2a')]['count'](_0x140fb6)[_0xdf33('0x22')](function(_0x926f73){_0x1babc3[_0xdf33('0x1b')]=_0x926f73;if(_0x23f7f2[_0xdf33('0x2f')][_0xdf33('0x40')]){_0x230adc['include']=[{'all':!![]}];}return db[_0xdf33('0x2a')]['findAll'](_0x230adc);})['then'](function(_0x5495d5){_0x1babc3[_0xdf33('0x41')]=_0x5495d5;return _0x1babc3;})[_0xdf33('0x22')](respondWithFilteredResult(_0x17f38a,_0x230adc))[_0xdf33('0x42')](handleError(_0x17f38a,null));};exports['show']=function(_0x444304,_0x10ce19){var _0x197541={'raw':!![],'where':{'id':_0x444304[_0xdf33('0x43')]['id']}},_0xf31270={};_0xf31270[_0xdf33('0x44')]=_['keys'](db[_0xdf33('0x2a')][_0xdf33('0x2b')]);_0xf31270[_0xdf33('0x2f')]=_[_0xdf33('0x30')](_0x444304['query']);_0xf31270[_0xdf33('0x31')]=_['intersection'](_0xf31270[_0xdf33('0x44')],_0xf31270[_0xdf33('0x2f')]);_0x197541['attributes']=_[_0xdf33('0x33')](_0xf31270[_0xdf33('0x44')],qs[_0xdf33('0x34')](_0x444304[_0xdf33('0x2f')][_0xdf33('0x34')]));_0x197541[_0xdf33('0x32')]=_0x197541[_0xdf33('0x32')]['length']?_0x197541[_0xdf33('0x32')]:_0xf31270[_0xdf33('0x44')];if(_0x444304[_0xdf33('0x2f')]['includeAll']){_0x197541[_0xdf33('0x45')]=[{'all':!![]}];}_0x197541=_[_0xdf33('0x3d')]({},_0x197541,_0x444304[_0xdf33('0x3e')]);return db[_0xdf33('0x2a')][_0xdf33('0x46')](_0x197541)[_0xdf33('0x22')](handleEntityNotFound(_0x10ce19,null))[_0xdf33('0x22')](respondWithResult(_0x10ce19,null))[_0xdf33('0x42')](handleError(_0x10ce19,null));};exports[_0xdf33('0x47')]=function(_0x19b1f1,_0x855f73){return db[_0xdf33('0x2a')]['create'](_0x19b1f1[_0xdf33('0x48')],{})[_0xdf33('0x22')](respondWithResult(_0x855f73,0xc9))[_0xdf33('0x42')](handleError(_0x855f73,null));};exports['update']=function(_0x18a0ec,_0x3565b2){if(_0x18a0ec[_0xdf33('0x48')]['id']){delete _0x18a0ec[_0xdf33('0x48')]['id'];}return db[_0xdf33('0x2a')][_0xdf33('0x46')]({'where':{'id':_0x18a0ec[_0xdf33('0x43')]['id']}})[_0xdf33('0x22')](handleEntityNotFound(_0x3565b2,null))[_0xdf33('0x22')](saveUpdates(_0x18a0ec[_0xdf33('0x48')],null))[_0xdf33('0x22')](respondWithResult(_0x3565b2,null))['catch'](handleError(_0x3565b2,null));};exports[_0xdf33('0x49')]=function(_0x4846c8,_0x3df1d2){return db[_0xdf33('0x2a')][_0xdf33('0x46')]({'where':{'id':_0x4846c8[_0xdf33('0x43')]['id']}})[_0xdf33('0x22')](handleEntityNotFound(_0x3df1d2,null))[_0xdf33('0x22')](removeEntity(_0x3df1d2,null))[_0xdf33('0x42')](handleError(_0x3df1d2,null));};exports[_0xdf33('0x4a')]=function(_0x31d664,_0x1e2e68){return db[_0xdf33('0x2a')]['describe']()['then'](respondWithResult(_0x1e2e68,null))['catch'](handleError(_0x1e2e68,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0b0c4a4..2d7fbfd 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 _0xc121=['bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x2a6374,_0x131892){var _0x2bf330=function(_0x30750f){while(--_0x30750f){_0x2a6374['push'](_0x2a6374['shift']());}};_0x2bf330(++_0x131892);}(_0xc121,0xcb));var _0x1c12=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xc121[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0x1c12('0x0'));var util=require(_0x1c12('0x1'));var logger=require(_0x1c12('0x2'))(_0x1c12('0x3'));var moment=require(_0x1c12('0x4'));var BPromise=require(_0x1c12('0x5'));var rp=require(_0x1c12('0x6'));var fs=require('fs');var path=require(_0x1c12('0x7'));var rimraf=require(_0x1c12('0x8'));var config=require('../../config/environment');var attributes=require(_0x1c12('0x9'));module[_0x1c12('0xa')]=function(_0x1a6c91,_0x16ac34){return _0x1a6c91[_0x1c12('0xb')](_0x1c12('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x1c12('0xd'),'fields':['uniqueid',_0x1c12('0xe')]},{'name':_0x1c12('0xf'),'fields':[_0x1c12('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb52d=['report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0xb52d,0xa7));var _0xdb52=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xb52d[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xdb52('0x0'));var util=require(_0xdb52('0x1'));var logger=require(_0xdb52('0x2'))(_0xdb52('0x3'));var moment=require(_0xdb52('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb52('0x5'));var fs=require('fs');var path=require(_0xdb52('0x6'));var rimraf=require(_0xdb52('0x7'));var config=require(_0xdb52('0x8'));var attributes=require(_0xdb52('0x9'));module[_0xdb52('0xa')]=function(_0x456b73,_0x5c277a){return _0x456b73[_0xdb52('0xb')](_0xdb52('0xc'),attributes,{'tableName':_0xdb52('0xd'),'paranoid':![],'indexes':[{'name':_0xdb52('0xe'),'fields':[_0xdb52('0xf'),_0xdb52('0x10')]},{'name':'leaveAt','fields':[_0xdb52('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 57c836b..f81be56 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 _0x9d11=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45db8d,_0x4109fa){var _0x3cfdec=function(_0x5ad9f5){while(--_0x5ad9f5){_0x45db8d['push'](_0x45db8d['shift']());}};_0x3cfdec(++_0x4109fa);}(_0x9d11,0x9b));var _0x19d1=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x9d11[_0x3a0c4f];return _0x247049;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x19d1('0x0'));var rs=require(_0x19d1('0x1'));var fs=require('fs');var Redis=require(_0x19d1('0x2'));var db=require(_0x19d1('0x3'))['db'];var utils=require(_0x19d1('0x4'));var logger=require(_0x19d1('0x5'))(_0x19d1('0x6'));var config=require(_0x19d1('0x7'));var jayson=require(_0x19d1('0x8'));var client=jayson[_0x19d1('0x9')][_0x19d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ebb88,_0x29a73f,_0x5082d2){return new BPromise(function(_0x27c0a0,_0x30fd69){return client[_0x19d1('0xb')](_0x2ebb88,_0x5082d2)[_0x19d1('0xc')](function(_0x24fe86){logger[_0x19d1('0xd')](_0x19d1('0xe'),_0x29a73f,'request\x20sent');logger[_0x19d1('0xf')](_0x19d1('0x10'),_0x29a73f,_0x19d1('0x11'),JSON[_0x19d1('0x12')](_0x24fe86));if(_0x24fe86['error']){if(_0x24fe86[_0x19d1('0x13')][_0x19d1('0x14')]===0x1f4){logger[_0x19d1('0x13')](_0x19d1('0xe'),_0x29a73f,_0x24fe86[_0x19d1('0x13')][_0x19d1('0x15')]);return _0x30fd69(_0x24fe86[_0x19d1('0x13')]['message']);}logger[_0x19d1('0x13')](_0x19d1('0xe'),_0x29a73f,_0x24fe86[_0x19d1('0x13')]['message']);return _0x27c0a0(_0x24fe86['error'][_0x19d1('0x15')]);}else{logger[_0x19d1('0xd')]('SquareReport,\x20%s,\x20%s',_0x29a73f,_0x19d1('0x11'));_0x27c0a0(_0x24fe86[_0x19d1('0x16')][_0x19d1('0x15')]);}})[_0x19d1('0x17')](function(_0x2bdd53){logger['error']('SquareReport,\x20%s,\x20%s',_0x29a73f,_0x2bdd53);_0x30fd69(_0x2bdd53);});});}exports[_0x19d1('0x18')]=function(_0x15b36b){var _0x83a292=this;return new Promise(function(_0x39eddd,_0x27fb89){return db[_0x19d1('0x19')][_0x19d1('0x1a')](_0x15b36b[_0x19d1('0x1b')],{'raw':_0x15b36b['options']?_0x15b36b[_0x19d1('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x19d1('0xc')](function(_0x188677){logger[_0x19d1('0xd')](_0x19d1('0x18'),_0x15b36b);logger[_0x19d1('0xf')]('CreateSquareReport',_0x15b36b,JSON[_0x19d1('0x12')](_0x188677));_0x39eddd(_0x188677);})[_0x19d1('0x17')](function(_0x93ac42){logger[_0x19d1('0x13')](_0x19d1('0x18'),_0x93ac42[_0x19d1('0x15')],_0x15b36b);_0x27fb89(_0x83a292['error'](0x1f4,_0x93ac42['message']));});});};exports[_0x19d1('0x1d')]=function(_0x37df9d){var _0x3ad6b8=this;return new Promise(function(_0x557c13,_0x381920){return db[_0x19d1('0x19')]['update'](_0x37df9d['body'],{'raw':_0x37df9d[_0x19d1('0x1c')]?_0x37df9d[_0x19d1('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37df9d['options']?_0x37df9d[_0x19d1('0x1c')]['where']||null:null,'attributes':_0x37df9d[_0x19d1('0x1c')]?_0x37df9d['options'][_0x19d1('0x1e')]||null:null,'limit':_0x37df9d[_0x19d1('0x1c')]?_0x37df9d['options'][_0x19d1('0x1f')]||null:null})[_0x19d1('0xc')](function(_0x33863e){logger[_0x19d1('0xd')]('UpdateSquareReport',_0x37df9d);logger[_0x19d1('0xf')]('UpdateSquareReport',_0x37df9d,JSON[_0x19d1('0x12')](_0x33863e));_0x557c13(_0x33863e);})[_0x19d1('0x17')](function(_0x2f5423){logger[_0x19d1('0x13')](_0x19d1('0x1d'),_0x2f5423[_0x19d1('0x15')],_0x37df9d);_0x381920(_0x3ad6b8[_0x19d1('0x13')](0x1f4,_0x2f5423['message']));});});}; \ No newline at end of file +var _0xd506=['SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','debug'];(function(_0x505126,_0x3044cf){var _0x3e99ad=function(_0x3c6b4d){while(--_0x3c6b4d){_0x505126['push'](_0x505126['shift']());}};_0x3e99ad(++_0x3044cf);}(_0xd506,0x19f));var _0x6d50=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xd506[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x6d50('0x0'));var util=require(_0x6d50('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6d50('0x2'));var fs=require('fs');var Redis=require(_0x6d50('0x3'));var db=require(_0x6d50('0x4'))['db'];var utils=require(_0x6d50('0x5'));var logger=require('../../config/logger')(_0x6d50('0x6'));var config=require('../../config/environment');var jayson=require(_0x6d50('0x7'));var client=jayson[_0x6d50('0x8')][_0x6d50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e1176,_0x41db36,_0x31c90d){return new BPromise(function(_0x577dd5,_0x59a552){return client[_0x6d50('0xa')](_0x5e1176,_0x31c90d)[_0x6d50('0xb')](function(_0x5424b7){logger['info'](_0x6d50('0xc'),_0x41db36,'request\x20sent');logger[_0x6d50('0xd')](_0x6d50('0xe'),_0x41db36,_0x6d50('0xf'),JSON[_0x6d50('0x10')](_0x5424b7));if(_0x5424b7[_0x6d50('0x11')]){if(_0x5424b7[_0x6d50('0x11')][_0x6d50('0x12')]===0x1f4){logger[_0x6d50('0x11')]('SquareReport,\x20%s,\x20%s',_0x41db36,_0x5424b7[_0x6d50('0x11')]['message']);return _0x59a552(_0x5424b7[_0x6d50('0x11')][_0x6d50('0x13')]);}logger[_0x6d50('0x11')](_0x6d50('0xc'),_0x41db36,_0x5424b7[_0x6d50('0x11')]['message']);return _0x577dd5(_0x5424b7[_0x6d50('0x11')][_0x6d50('0x13')]);}else{logger[_0x6d50('0x14')]('SquareReport,\x20%s,\x20%s',_0x41db36,'request\x20sent');_0x577dd5(_0x5424b7['result'][_0x6d50('0x13')]);}})[_0x6d50('0x15')](function(_0x123480){logger[_0x6d50('0x11')](_0x6d50('0xc'),_0x41db36,_0x123480);_0x59a552(_0x123480);});});}exports[_0x6d50('0x16')]=function(_0x5b007f){var _0x587160=this;return new Promise(function(_0xd0ca13,_0x11f7bf){return db[_0x6d50('0x17')][_0x6d50('0x18')](_0x5b007f['body'],{'raw':_0x5b007f[_0x6d50('0x19')]?_0x5b007f['options'][_0x6d50('0x1a')]===undefined?!![]:![]:!![]})[_0x6d50('0xb')](function(_0x30eb97){logger['info'](_0x6d50('0x16'),_0x5b007f);logger[_0x6d50('0xd')](_0x6d50('0x16'),_0x5b007f,JSON[_0x6d50('0x10')](_0x30eb97));_0xd0ca13(_0x30eb97);})[_0x6d50('0x15')](function(_0x1c006d){logger[_0x6d50('0x11')](_0x6d50('0x16'),_0x1c006d['message'],_0x5b007f);_0x11f7bf(_0x587160[_0x6d50('0x11')](0x1f4,_0x1c006d[_0x6d50('0x13')]));});});};exports[_0x6d50('0x1b')]=function(_0x16b6ff){var _0x5278dd=this;return new Promise(function(_0x586074,_0x2407f7){return db[_0x6d50('0x17')][_0x6d50('0x1c')](_0x16b6ff[_0x6d50('0x1d')],{'raw':_0x16b6ff[_0x6d50('0x19')]?_0x16b6ff['options'][_0x6d50('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16b6ff[_0x6d50('0x19')]?_0x16b6ff[_0x6d50('0x19')][_0x6d50('0x1e')]||null:null,'attributes':_0x16b6ff['options']?_0x16b6ff[_0x6d50('0x19')][_0x6d50('0x1f')]||null:null,'limit':_0x16b6ff[_0x6d50('0x19')]?_0x16b6ff['options'][_0x6d50('0x20')]||null:null})[_0x6d50('0xb')](function(_0x4cbeea){logger[_0x6d50('0x14')]('UpdateSquareReport',_0x16b6ff);logger[_0x6d50('0xd')](_0x6d50('0x1b'),_0x16b6ff,JSON['stringify'](_0x4cbeea));_0x586074(_0x4cbeea);})[_0x6d50('0x15')](function(_0xe90bcf){logger['error'](_0x6d50('0x1b'),_0xe90bcf[_0x6d50('0x13')],_0x16b6ff);_0x2407f7(_0x5278dd[_0x6d50('0x11')](0x1f4,_0xe90bcf['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 885f22b..1976de3 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 _0x3b33=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','destroy'];(function(_0x49fe55,_0xbb77ed){var _0x1dc65c=function(_0x5a5622){while(--_0x5a5622){_0x49fe55['push'](_0x49fe55['shift']());}};_0x1dc65c(++_0xbb77ed);}(_0x3b33,0xa0));var _0x33b3=function(_0x397a00,_0x279163){_0x397a00=_0x397a00-0x0;var _0x55cc34=_0x3b33[_0x397a00];return _0x55cc34;};'use strict';var multer=require(_0x33b3('0x0'));var util=require(_0x33b3('0x1'));var path=require(_0x33b3('0x2'));var timeout=require(_0x33b3('0x3'));var express=require(_0x33b3('0x4'));var router=express[_0x33b3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x33b3('0x6'));var interaction=require(_0x33b3('0x7'));var config=require(_0x33b3('0x8'));var controller=require(_0x33b3('0x9'));router[_0x33b3('0xa')]('/',auth[_0x33b3('0xb')](),controller[_0x33b3('0xc')]);router['get'](_0x33b3('0xd'),auth[_0x33b3('0xb')](),controller[_0x33b3('0xe')]);router[_0x33b3('0xa')](_0x33b3('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x33b3('0xb')](),controller[_0x33b3('0x10')]);router[_0x33b3('0x11')](_0x33b3('0xf'),auth[_0x33b3('0xb')](),controller[_0x33b3('0x12')]);router['delete'](_0x33b3('0xf'),auth['isAuthenticated'](),controller[_0x33b3('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf9c4=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./squareReportDetail.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x1cc01a,_0x3b3407){var _0xff1d09=function(_0x5616fa){while(--_0x5616fa){_0x1cc01a['push'](_0x1cc01a['shift']());}};_0xff1d09(++_0x3b3407);}(_0xf9c4,0x134));var _0x4f9c=function(_0xe6cbf9,_0x6123c2){_0xe6cbf9=_0xe6cbf9-0x0;var _0x172772=_0xf9c4[_0xe6cbf9];return _0x172772;};'use strict';var multer=require('multer');var util=require(_0x4f9c('0x0'));var path=require(_0x4f9c('0x1'));var timeout=require(_0x4f9c('0x2'));var express=require(_0x4f9c('0x3'));var router=express[_0x4f9c('0x4')]();var fs_extra=require(_0x4f9c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4f9c('0x6'));router[_0x4f9c('0x7')]('/',auth['isAuthenticated'](),controller[_0x4f9c('0x8')]);router['get'](_0x4f9c('0x9'),auth[_0x4f9c('0xa')](),controller['describe']);router[_0x4f9c('0x7')](_0x4f9c('0xb'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0xc')]);router[_0x4f9c('0xd')]('/',auth[_0x4f9c('0xa')](),controller[_0x4f9c('0xe')]);router[_0x4f9c('0xf')](_0x4f9c('0xb'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x10')]);router[_0x4f9c('0x11')](_0x4f9c('0xb'),auth[_0x4f9c('0xa')](),controller[_0x4f9c('0x12')]);module[_0x4f9c('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 623a45a..ef6ebdd 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 _0xfd04=['STRING','TEXT','sequelize','exports'];(function(_0x52dd2d,_0x1d1b57){var _0xa07d84=function(_0x3e911c){while(--_0x3e911c){_0x52dd2d['push'](_0x52dd2d['shift']());}};_0xa07d84(++_0x1d1b57);}(_0xfd04,0xde));var _0x4fd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd04[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4fd0('0x0'));module[_0x4fd0('0x1')]={'uniqueid':{'type':Sequelize[_0x4fd0('0x2')]},'node':{'type':Sequelize[_0x4fd0('0x2')]},'application':{'type':Sequelize[_0x4fd0('0x2')]},'data':{'type':Sequelize[_0x4fd0('0x3')]},'project_name':{'type':Sequelize[_0x4fd0('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa1e9=['TEXT','sequelize','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa1e9,0xbe));var _0x9a1e=function(_0x1fd563,_0x196466){_0x1fd563=_0x1fd563-0x0;var _0x4673f3=_0xa1e9[_0x1fd563];return _0x4673f3;};'use strict';var Sequelize=require(_0x9a1e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x9a1e('0x1')]},'data':{'type':Sequelize[_0x9a1e('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9a1e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e28f804..3bc9611 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 _0x7f5f=['limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','index','SquareDetailsReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','status','end','json','offset','undefined'];(function(_0x109532,_0x449d66){var _0x3512d4=function(_0x31fc75){while(--_0x31fc75){_0x109532['push'](_0x109532['shift']());}};_0x3512d4(++_0x449d66);}(_0x7f5f,0x77));var _0xf7f5=function(_0x516ff0,_0x217cc1){_0x516ff0=_0x516ff0-0x0;var _0x2ec1df=_0x7f5f[_0x516ff0];return _0x2ec1df;};'use strict';var emlformat=require(_0xf7f5('0x0'));var rimraf=require(_0xf7f5('0x1'));var zipdir=require(_0xf7f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7f5('0x3'));var moment=require(_0xf7f5('0x4'));var BPromise=require(_0xf7f5('0x5'));var Mustache=require(_0xf7f5('0x6'));var util=require(_0xf7f5('0x7'));var path=require('path');var sox=require(_0xf7f5('0x8'));var csv=require('to-csv');var ejs=require(_0xf7f5('0x9'));var fs=require('fs');var fs_extra=require(_0xf7f5('0xa'));var _=require(_0xf7f5('0xb'));var squel=require(_0xf7f5('0xc'));var crypto=require(_0xf7f5('0xd'));var jsforce=require(_0xf7f5('0xe'));var deskjs=require(_0xf7f5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf7f5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf7f5('0x11'));var qs=require(_0xf7f5('0x12'));var as=require(_0xf7f5('0x13'));var hardwareService=require(_0xf7f5('0x14'));var logger=require('../../config/logger')(_0xf7f5('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x163ad9,_0x2f1655){_0x2f1655=_0x2f1655||0xcc;return function(_0x421a7b){if(_0x421a7b){return _0x163ad9['sendStatus'](_0x2f1655);}return _0x163ad9[_0xf7f5('0x16')](_0x2f1655)[_0xf7f5('0x17')]();};}function respondWithResult(_0x1db459,_0x56c0f9){_0x56c0f9=_0x56c0f9||0xc8;return function(_0x2fecee){if(_0x2fecee){return _0x1db459[_0xf7f5('0x16')](_0x56c0f9)[_0xf7f5('0x18')](_0x2fecee);}};}function respondWithFilteredResult(_0x50bf99,_0x3be656){return function(_0x3effdd){if(_0x3effdd){var _0x300287=typeof _0x3be656[_0xf7f5('0x19')]===_0xf7f5('0x1a')&&typeof _0x3be656[_0xf7f5('0x1b')]===_0xf7f5('0x1a');var _0x4c56c2=_0x3effdd['count'];var _0x2a9fe9=_0x300287?0x0:_0x3be656[_0xf7f5('0x19')];var _0x54ce82=_0x300287?_0x3effdd[_0xf7f5('0x1c')]:_0x3be656[_0xf7f5('0x19')]+_0x3be656[_0xf7f5('0x1b')];var _0x5a365e;if(_0x54ce82>=_0x4c56c2){_0x54ce82=_0x4c56c2;_0x5a365e=0xc8;}else{_0x5a365e=0xce;}_0x50bf99['status'](_0x5a365e);return _0x50bf99['set'](_0xf7f5('0x1d'),_0x2a9fe9+'-'+_0x54ce82+'/'+_0x4c56c2)['json'](_0x3effdd);}return null;};}function patchUpdates(_0x27ce59){return function(_0x222b9e){try{jsonpatch[_0xf7f5('0x1e')](_0x222b9e,_0x27ce59,!![]);}catch(_0x4087e6){return BPromise[_0xf7f5('0x1f')](_0x4087e6);}return _0x222b9e[_0xf7f5('0x20')]();};}function saveUpdates(_0x1b2078,_0x52d8d9){return function(_0x10fb59){if(_0x10fb59){return _0x10fb59['update'](_0x1b2078)[_0xf7f5('0x21')](function(_0x5aa976){return _0x5aa976;});}return null;};}function removeEntity(_0x59b6c4,_0x2f30d6){return function(_0x391743){if(_0x391743){return _0x391743[_0xf7f5('0x22')]()[_0xf7f5('0x21')](function(){_0x59b6c4['status'](0xcc)[_0xf7f5('0x17')]();});}};}function handleEntityNotFound(_0x4801a1,_0x118738){return function(_0x3db22d){if(!_0x3db22d){_0x4801a1['sendStatus'](0x194);}return _0x3db22d;};}function handleError(_0x3cad32,_0x5186d2){_0x5186d2=_0x5186d2||0x1f4;return function(_0x441b80){logger[_0xf7f5('0x23')](_0x441b80['stack']);if(_0x441b80[_0xf7f5('0x24')]){delete _0x441b80[_0xf7f5('0x24')];}_0x3cad32[_0xf7f5('0x16')](_0x5186d2)[_0xf7f5('0x25')](_0x441b80);};}exports[_0xf7f5('0x26')]=function(_0x34547c,_0x10be50){var _0x2b1815={},_0x3657f8={},_0xc68ba2={'count':0x0,'rows':[]};var _0x2cbb76=_['map'](db[_0xf7f5('0x27')]['rawAttributes'],function(_0x4d3752){return{'name':_0x4d3752[_0xf7f5('0x28')],'type':_0x4d3752['type'][_0xf7f5('0x29')]};});_0x3657f8['model']=_[_0xf7f5('0x2a')](_0x2cbb76,_0xf7f5('0x24'));_0x3657f8[_0xf7f5('0x2b')]=_[_0xf7f5('0x2c')](_0x34547c[_0xf7f5('0x2b')]);_0x3657f8[_0xf7f5('0x2d')]=_[_0xf7f5('0x2e')](_0x3657f8[_0xf7f5('0x2f')],_0x3657f8[_0xf7f5('0x2b')]);_0x2b1815[_0xf7f5('0x30')]=_[_0xf7f5('0x2e')](_0x3657f8[_0xf7f5('0x2f')],qs['fields'](_0x34547c[_0xf7f5('0x2b')][_0xf7f5('0x31')]));_0x2b1815[_0xf7f5('0x30')]=_0x2b1815['attributes']['length']?_0x2b1815[_0xf7f5('0x30')]:_0x3657f8[_0xf7f5('0x2f')];if(!_0x34547c[_0xf7f5('0x2b')][_0xf7f5('0x32')]('nolimit')){_0x2b1815['limit']=qs[_0xf7f5('0x1b')](_0x34547c[_0xf7f5('0x2b')][_0xf7f5('0x1b')]);_0x2b1815[_0xf7f5('0x19')]=qs[_0xf7f5('0x19')](_0x34547c['query'][_0xf7f5('0x19')]);}_0x2b1815[_0xf7f5('0x33')]=qs[_0xf7f5('0x34')](_0x34547c[_0xf7f5('0x2b')][_0xf7f5('0x34')]);_0x2b1815[_0xf7f5('0x35')]=qs[_0xf7f5('0x2d')](_[_0xf7f5('0x36')](_0x34547c[_0xf7f5('0x2b')],_0x3657f8[_0xf7f5('0x2d')]),_0x2cbb76);if(_0x34547c[_0xf7f5('0x2b')][_0xf7f5('0x37')]){_0x2b1815[_0xf7f5('0x35')]=_['merge'](_0x2b1815['where'],{'$or':_[_0xf7f5('0x2a')](_0x2cbb76,function(_0x34db6d){if(_0x34db6d[_0xf7f5('0x38')]!=='VIRTUAL'){var _0x3787e4={};_0x3787e4[_0x34db6d[_0xf7f5('0x24')]]={'$like':'%'+_0x34547c[_0xf7f5('0x2b')][_0xf7f5('0x37')]+'%'};return _0x3787e4;}})});}_0x2b1815=_[_0xf7f5('0x39')]({},_0x2b1815,_0x34547c[_0xf7f5('0x3a')]);var _0x337794={'where':_0x2b1815[_0xf7f5('0x35')]};return db['SquareDetailsReport']['count'](_0x337794)[_0xf7f5('0x21')](function(_0x1e9433){_0xc68ba2[_0xf7f5('0x1c')]=_0x1e9433;if(_0x34547c['query'][_0xf7f5('0x3b')]){_0x2b1815[_0xf7f5('0x3c')]=[{'all':!![]}];}return db[_0xf7f5('0x27')][_0xf7f5('0x3d')](_0x2b1815);})[_0xf7f5('0x21')](function(_0x109a3a){_0xc68ba2[_0xf7f5('0x3e')]=_0x109a3a;return _0xc68ba2;})['then'](respondWithFilteredResult(_0x10be50,_0x2b1815))[_0xf7f5('0x3f')](handleError(_0x10be50,null));};exports[_0xf7f5('0x40')]=function(_0x21f6e7,_0xc1e8d7){var _0x347a98={'raw':!![],'where':{'id':_0x21f6e7[_0xf7f5('0x41')]['id']}},_0x237617={};_0x237617[_0xf7f5('0x2f')]=_[_0xf7f5('0x2c')](db[_0xf7f5('0x27')][_0xf7f5('0x42')]);_0x237617[_0xf7f5('0x2b')]=_['keys'](_0x21f6e7['query']);_0x237617[_0xf7f5('0x2d')]=_[_0xf7f5('0x2e')](_0x237617[_0xf7f5('0x2f')],_0x237617['query']);_0x347a98[_0xf7f5('0x30')]=_[_0xf7f5('0x2e')](_0x237617['model'],qs[_0xf7f5('0x31')](_0x21f6e7['query'][_0xf7f5('0x31')]));_0x347a98[_0xf7f5('0x30')]=_0x347a98[_0xf7f5('0x30')][_0xf7f5('0x43')]?_0x347a98[_0xf7f5('0x30')]:_0x237617['model'];if(_0x21f6e7['query']['includeAll']){_0x347a98[_0xf7f5('0x3c')]=[{'all':!![]}];}_0x347a98=_[_0xf7f5('0x39')]({},_0x347a98,_0x21f6e7[_0xf7f5('0x3a')]);return db[_0xf7f5('0x27')][_0xf7f5('0x44')](_0x347a98)[_0xf7f5('0x21')](handleEntityNotFound(_0xc1e8d7,null))['then'](respondWithResult(_0xc1e8d7,null))[_0xf7f5('0x3f')](handleError(_0xc1e8d7,null));};exports['create']=function(_0x36ec77,_0x5753ca){return db[_0xf7f5('0x27')][_0xf7f5('0x45')](_0x36ec77[_0xf7f5('0x46')],{})[_0xf7f5('0x21')](respondWithResult(_0x5753ca,0xc9))['catch'](handleError(_0x5753ca,null));};exports[_0xf7f5('0x47')]=function(_0x393276,_0x25ecdd){if(_0x393276[_0xf7f5('0x46')]['id']){delete _0x393276[_0xf7f5('0x46')]['id'];}return db[_0xf7f5('0x27')]['find']({'where':{'id':_0x393276[_0xf7f5('0x41')]['id']}})[_0xf7f5('0x21')](handleEntityNotFound(_0x25ecdd,null))['then'](saveUpdates(_0x393276[_0xf7f5('0x46')],null))[_0xf7f5('0x21')](respondWithResult(_0x25ecdd,null))['catch'](handleError(_0x25ecdd,null));};exports[_0xf7f5('0x22')]=function(_0x2e4348,_0x388511){return db[_0xf7f5('0x27')][_0xf7f5('0x44')]({'where':{'id':_0x2e4348['params']['id']}})['then'](handleEntityNotFound(_0x388511,null))[_0xf7f5('0x21')](removeEntity(_0x388511,null))[_0xf7f5('0x3f')](handleError(_0x388511,null));};exports['describe']=function(_0x123a0f,_0x416415){return db[_0xf7f5('0x27')][_0xf7f5('0x48')]()[_0xf7f5('0x21')](respondWithResult(_0x416415,null))[_0xf7f5('0x3f')](handleError(_0x416415,null));}; \ No newline at end of file +var _0x6617=['options','includeAll','include','findAll','rows','catch','show','intersection','length','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','end','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x6617,0x133));var _0x7661=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x6617[_0x528575];return _0x3063b7;};'use strict';var emlformat=require(_0x7661('0x0'));var rimraf=require(_0x7661('0x1'));var zipdir=require(_0x7661('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7661('0x3'));var moment=require(_0x7661('0x4'));var BPromise=require(_0x7661('0x5'));var Mustache=require(_0x7661('0x6'));var util=require(_0x7661('0x7'));var path=require(_0x7661('0x8'));var sox=require(_0x7661('0x9'));var csv=require(_0x7661('0xa'));var ejs=require(_0x7661('0xb'));var fs=require('fs');var fs_extra=require(_0x7661('0xc'));var _=require('lodash');var squel=require(_0x7661('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7661('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7661('0xe'));var qs=require(_0x7661('0xf'));var as=require(_0x7661('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7661('0x11'))(_0x7661('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7661('0x13'));var db=require(_0x7661('0x14'))['db'];function respondWithStatusCode(_0x1d7bcd,_0x18debe){_0x18debe=_0x18debe||0xcc;return function(_0x5beb98){if(_0x5beb98){return _0x1d7bcd[_0x7661('0x15')](_0x18debe);}return _0x1d7bcd[_0x7661('0x16')](_0x18debe)['end']();};}function respondWithResult(_0x58e9fa,_0x26d27e){_0x26d27e=_0x26d27e||0xc8;return function(_0x4c684a){if(_0x4c684a){return _0x58e9fa[_0x7661('0x16')](_0x26d27e)[_0x7661('0x17')](_0x4c684a);}};}function respondWithFilteredResult(_0x4f47b7,_0x4519a0){return function(_0x5ab520){if(_0x5ab520){var _0xc49bf7=typeof _0x4519a0[_0x7661('0x18')]===_0x7661('0x19')&&typeof _0x4519a0[_0x7661('0x1a')]===_0x7661('0x19');var _0xc30c92=_0x5ab520[_0x7661('0x1b')];var _0x2fd781=_0xc49bf7?0x0:_0x4519a0[_0x7661('0x18')];var _0x73efb5=_0xc49bf7?_0x5ab520[_0x7661('0x1b')]:_0x4519a0[_0x7661('0x18')]+_0x4519a0[_0x7661('0x1a')];var _0x5b2162;if(_0x73efb5>=_0xc30c92){_0x73efb5=_0xc30c92;_0x5b2162=0xc8;}else{_0x5b2162=0xce;}_0x4f47b7[_0x7661('0x16')](_0x5b2162);return _0x4f47b7[_0x7661('0x1c')](_0x7661('0x1d'),_0x2fd781+'-'+_0x73efb5+'/'+_0xc30c92)[_0x7661('0x17')](_0x5ab520);}return null;};}function patchUpdates(_0x2b4f91){return function(_0x4df670){try{jsonpatch['apply'](_0x4df670,_0x2b4f91,!![]);}catch(_0x1367b1){return BPromise[_0x7661('0x1e')](_0x1367b1);}return _0x4df670['save']();};}function saveUpdates(_0x307b20,_0x426db2){return function(_0x1c918f){if(_0x1c918f){return _0x1c918f['update'](_0x307b20)['then'](function(_0xe6fbe2){return _0xe6fbe2;});}return null;};}function removeEntity(_0x137744,_0x454daa){return function(_0x59ec61){if(_0x59ec61){return _0x59ec61[_0x7661('0x1f')]()[_0x7661('0x20')](function(){_0x137744['status'](0xcc)[_0x7661('0x21')]();});}};}function handleEntityNotFound(_0x54ee97,_0x44d293){return function(_0x57fa10){if(!_0x57fa10){_0x54ee97[_0x7661('0x15')](0x194);}return _0x57fa10;};}function handleError(_0x2d3c98,_0x2ad4a7){_0x2ad4a7=_0x2ad4a7||0x1f4;return function(_0x153d68){logger['error'](_0x153d68[_0x7661('0x22')]);if(_0x153d68[_0x7661('0x23')]){delete _0x153d68['name'];}_0x2d3c98[_0x7661('0x16')](_0x2ad4a7)['send'](_0x153d68);};}exports[_0x7661('0x24')]=function(_0x28a27d,_0x471084){var _0x54c459={},_0x1490bb={},_0x4ccbbf={'count':0x0,'rows':[]};var _0x207525=_[_0x7661('0x25')](db[_0x7661('0x26')][_0x7661('0x27')],function(_0x332ec4){return{'name':_0x332ec4[_0x7661('0x28')],'type':_0x332ec4[_0x7661('0x29')][_0x7661('0x2a')]};});_0x1490bb[_0x7661('0x2b')]=_['map'](_0x207525,_0x7661('0x23'));_0x1490bb['query']=_[_0x7661('0x2c')](_0x28a27d[_0x7661('0x2d')]);_0x1490bb[_0x7661('0x2e')]=_['intersection'](_0x1490bb[_0x7661('0x2b')],_0x1490bb['query']);_0x54c459[_0x7661('0x2f')]=_['intersection'](_0x1490bb[_0x7661('0x2b')],qs[_0x7661('0x30')](_0x28a27d[_0x7661('0x2d')][_0x7661('0x30')]));_0x54c459['attributes']=_0x54c459[_0x7661('0x2f')]['length']?_0x54c459[_0x7661('0x2f')]:_0x1490bb[_0x7661('0x2b')];if(!_0x28a27d[_0x7661('0x2d')][_0x7661('0x31')](_0x7661('0x32'))){_0x54c459[_0x7661('0x1a')]=qs[_0x7661('0x1a')](_0x28a27d[_0x7661('0x2d')]['limit']);_0x54c459['offset']=qs['offset'](_0x28a27d['query']['offset']);}_0x54c459[_0x7661('0x33')]=qs[_0x7661('0x34')](_0x28a27d['query'][_0x7661('0x34')]);_0x54c459[_0x7661('0x35')]=qs[_0x7661('0x2e')](_[_0x7661('0x36')](_0x28a27d[_0x7661('0x2d')],_0x1490bb[_0x7661('0x2e')]),_0x207525);if(_0x28a27d['query'][_0x7661('0x37')]){_0x54c459['where']=_[_0x7661('0x38')](_0x54c459['where'],{'$or':_[_0x7661('0x25')](_0x207525,function(_0x3a2647){if(_0x3a2647['type']!==_0x7661('0x39')){var _0x5a3c49={};_0x5a3c49[_0x3a2647[_0x7661('0x23')]]={'$like':'%'+_0x28a27d['query'][_0x7661('0x37')]+'%'};return _0x5a3c49;}})});}_0x54c459=_['merge']({},_0x54c459,_0x28a27d[_0x7661('0x3a')]);var _0x170bac={'where':_0x54c459[_0x7661('0x35')]};return db[_0x7661('0x26')][_0x7661('0x1b')](_0x170bac)[_0x7661('0x20')](function(_0x428775){_0x4ccbbf[_0x7661('0x1b')]=_0x428775;if(_0x28a27d['query'][_0x7661('0x3b')]){_0x54c459[_0x7661('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x7661('0x3d')](_0x54c459);})[_0x7661('0x20')](function(_0x555364){_0x4ccbbf[_0x7661('0x3e')]=_0x555364;return _0x4ccbbf;})[_0x7661('0x20')](respondWithFilteredResult(_0x471084,_0x54c459))[_0x7661('0x3f')](handleError(_0x471084,null));};exports[_0x7661('0x40')]=function(_0x40f268,_0x3d41f3){var _0x2bdf0f={'raw':!![],'where':{'id':_0x40f268['params']['id']}},_0x4ab512={};_0x4ab512[_0x7661('0x2b')]=_[_0x7661('0x2c')](db[_0x7661('0x26')][_0x7661('0x27')]);_0x4ab512[_0x7661('0x2d')]=_[_0x7661('0x2c')](_0x40f268['query']);_0x4ab512[_0x7661('0x2e')]=_[_0x7661('0x41')](_0x4ab512['model'],_0x4ab512[_0x7661('0x2d')]);_0x2bdf0f[_0x7661('0x2f')]=_[_0x7661('0x41')](_0x4ab512[_0x7661('0x2b')],qs[_0x7661('0x30')](_0x40f268[_0x7661('0x2d')][_0x7661('0x30')]));_0x2bdf0f[_0x7661('0x2f')]=_0x2bdf0f[_0x7661('0x2f')][_0x7661('0x42')]?_0x2bdf0f[_0x7661('0x2f')]:_0x4ab512['model'];if(_0x40f268[_0x7661('0x2d')][_0x7661('0x3b')]){_0x2bdf0f[_0x7661('0x3c')]=[{'all':!![]}];}_0x2bdf0f=_['merge']({},_0x2bdf0f,_0x40f268['options']);return db[_0x7661('0x26')]['find'](_0x2bdf0f)[_0x7661('0x20')](handleEntityNotFound(_0x3d41f3,null))[_0x7661('0x20')](respondWithResult(_0x3d41f3,null))[_0x7661('0x3f')](handleError(_0x3d41f3,null));};exports['create']=function(_0x484140,_0x1062eb){return db['SquareDetailsReport'][_0x7661('0x43')](_0x484140[_0x7661('0x44')],{})[_0x7661('0x20')](respondWithResult(_0x1062eb,0xc9))[_0x7661('0x3f')](handleError(_0x1062eb,null));};exports[_0x7661('0x45')]=function(_0x16e4a1,_0x18e8af){if(_0x16e4a1[_0x7661('0x44')]['id']){delete _0x16e4a1['body']['id'];}return db[_0x7661('0x26')][_0x7661('0x46')]({'where':{'id':_0x16e4a1['params']['id']}})[_0x7661('0x20')](handleEntityNotFound(_0x18e8af,null))[_0x7661('0x20')](saveUpdates(_0x16e4a1[_0x7661('0x44')],null))[_0x7661('0x20')](respondWithResult(_0x18e8af,null))[_0x7661('0x3f')](handleError(_0x18e8af,null));};exports[_0x7661('0x1f')]=function(_0x3ddc09,_0x5d3bec){return db[_0x7661('0x26')]['find']({'where':{'id':_0x3ddc09[_0x7661('0x47')]['id']}})[_0x7661('0x20')](handleEntityNotFound(_0x5d3bec,null))[_0x7661('0x20')](removeEntity(_0x5d3bec,null))['catch'](handleError(_0x5d3bec,null));};exports[_0x7661('0x48')]=function(_0xfba31e,_0x4e57a2){return db[_0x7661('0x26')][_0x7661('0x48')]()[_0x7661('0x20')](respondWithResult(_0x4e57a2,null))[_0x7661('0x3f')](handleError(_0x4e57a2,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 7006a1d..7da5955 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 _0x47be=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','SquareDetailsReport','lodash','util'];(function(_0x4c39a0,_0xdcf1dd){var _0x310903=function(_0x191b8c){while(--_0x191b8c){_0x4c39a0['push'](_0x4c39a0['shift']());}};_0x310903(++_0xdcf1dd);}(_0x47be,0x8d));var _0xe47b=function(_0xf1b134,_0xb399dd){_0xf1b134=_0xf1b134-0x0;var _0x139dbb=_0x47be[_0xf1b134];return _0x139dbb;};'use strict';var _=require(_0xe47b('0x0'));var util=require(_0xe47b('0x1'));var logger=require(_0xe47b('0x2'))('api');var moment=require(_0xe47b('0x3'));var BPromise=require(_0xe47b('0x4'));var rp=require(_0xe47b('0x5'));var fs=require('fs');var path=require(_0xe47b('0x6'));var rimraf=require(_0xe47b('0x7'));var config=require(_0xe47b('0x8'));var attributes=require(_0xe47b('0x9'));module['exports']=function(_0x3dcf15,_0x2af61b){return _0x3dcf15['define'](_0xe47b('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d95=['util','api','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','lodash'];(function(_0x2f4369,_0x12a5be){var _0x1ba3b2=function(_0x2af47e){while(--_0x2af47e){_0x2f4369['push'](_0x2f4369['shift']());}};_0x1ba3b2(++_0x12a5be);}(_0x8d95,0xaa));var _0x58d9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d95[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x58d9('0x0'));var util=require(_0x58d9('0x1'));var logger=require('../../config/logger')(_0x58d9('0x2'));var moment=require('moment');var BPromise=require(_0x58d9('0x3'));var rp=require(_0x58d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58d9('0x5'));var config=require(_0x58d9('0x6'));var attributes=require(_0x58d9('0x7'));module[_0x58d9('0x8')]=function(_0x107ea5,_0x477f3b){return _0x107ea5['define']('SquareDetailsReport',attributes,{'tableName':'report_square_details','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 3597d0e..3d81d50 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 _0x3264=['http','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','SquareDetailsReport','create','body','options','raw','info','CreateSquareDetailsReport','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x36b552,_0x4b0ead){var _0x2f0470=function(_0x17f08d){while(--_0x17f08d){_0x36b552['push'](_0x36b552['shift']());}};_0x2f0470(++_0x4b0ead);}(_0x3264,0x7f));var _0x4326=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3264[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56bcce,_0x3a7544,_0x2993a1){return new BPromise(function(_0x22071c,_0x129365){return client[_0x4326('0x9')](_0x56bcce,_0x2993a1)[_0x4326('0xa')](function(_0x1609f){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3a7544,_0x4326('0xb'));logger[_0x4326('0xc')](_0x4326('0xd'),_0x3a7544,_0x4326('0xb'),JSON['stringify'](_0x1609f));if(_0x1609f['error']){if(_0x1609f[_0x4326('0xe')]['code']===0x1f4){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x1609f[_0x4326('0xe')]['message']);return _0x129365(_0x1609f['error'][_0x4326('0x10')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3a7544,_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);return _0x22071c(_0x1609f[_0x4326('0xe')][_0x4326('0x10')]);}else{logger['info'](_0x4326('0xf'),_0x3a7544,_0x4326('0xb'));_0x22071c(_0x1609f[_0x4326('0x11')]['message']);}})[_0x4326('0x12')](function(_0x40c169){logger[_0x4326('0xe')](_0x4326('0xf'),_0x3a7544,_0x40c169);_0x129365(_0x40c169);});});}exports['CreateSquareDetailsReport']=function(_0x425897){var _0x494d7b=this;return new Promise(function(_0x312f6d,_0x2b91b4){return db[_0x4326('0x13')][_0x4326('0x14')](_0x425897[_0x4326('0x15')],{'raw':_0x425897['options']?_0x425897[_0x4326('0x16')][_0x4326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x377a83){logger[_0x4326('0x18')](_0x4326('0x19'),_0x425897);logger['debug'](_0x4326('0x19'),_0x425897,JSON[_0x4326('0x1a')](_0x377a83));_0x312f6d(_0x377a83);})[_0x4326('0x12')](function(_0x40012e){logger[_0x4326('0xe')](_0x4326('0x19'),_0x40012e[_0x4326('0x10')],_0x425897);_0x2b91b4(_0x494d7b[_0x4326('0xe')](0x1f4,_0x40012e['message']));});});}; \ No newline at end of file +var _0xc7da=['code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x339d37,_0xcd8448){var _0x4b027e=function(_0x5a5bbf){while(--_0x5a5bbf){_0x339d37['push'](_0x339d37['shift']());}};_0x4b027e(++_0xcd8448);}(_0xc7da,0xf2));var _0xac7d=function(_0xb1e589,_0x3ca6e5){_0xb1e589=_0xb1e589-0x0;var _0x230e0f=_0xc7da[_0xb1e589];return _0x230e0f;};'use strict';var _=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var moment=require(_0xac7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xac7d('0x3'));var fs=require('fs');var Redis=require(_0xac7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac7d('0x5'));var logger=require(_0xac7d('0x6'))('rpc');var config=require(_0xac7d('0x7'));var jayson=require(_0xac7d('0x8'));var client=jayson[_0xac7d('0x9')][_0xac7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268265,_0x153ce5,_0x48ca59){return new BPromise(function(_0x44eb2b,_0x457e2d){return client[_0xac7d('0xb')](_0x268265,_0x48ca59)[_0xac7d('0xc')](function(_0x217811){logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');logger[_0xac7d('0xf')](_0xac7d('0x10'),_0x153ce5,_0xac7d('0x11'),JSON['stringify'](_0x217811));if(_0x217811[_0xac7d('0x12')]){if(_0x217811[_0xac7d('0x12')][_0xac7d('0x13')]===0x1f4){logger[_0xac7d('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);return _0x457e2d(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}logger[_0xac7d('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x153ce5,_0x217811[_0xac7d('0x12')]['message']);return _0x44eb2b(_0x217811[_0xac7d('0x12')][_0xac7d('0x14')]);}else{logger[_0xac7d('0xd')](_0xac7d('0xe'),_0x153ce5,'request\x20sent');_0x44eb2b(_0x217811[_0xac7d('0x15')][_0xac7d('0x14')]);}})[_0xac7d('0x16')](function(_0x12813a){logger[_0xac7d('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x153ce5,_0x12813a);_0x457e2d(_0x12813a);});});}exports[_0xac7d('0x17')]=function(_0x3cb12d){var _0x563634=this;return new Promise(function(_0x2e4790,_0x2d2494){return db[_0xac7d('0x18')][_0xac7d('0x19')](_0x3cb12d['body'],{'raw':_0x3cb12d[_0xac7d('0x1a')]?_0x3cb12d[_0xac7d('0x1a')][_0xac7d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xd42c40){logger['info'](_0xac7d('0x17'),_0x3cb12d);logger[_0xac7d('0xf')](_0xac7d('0x17'),_0x3cb12d,JSON[_0xac7d('0x1c')](_0xd42c40));_0x2e4790(_0xd42c40);})[_0xac7d('0x16')](function(_0x365269){logger['error']('CreateSquareDetailsReport',_0x365269[_0xac7d('0x14')],_0x3cb12d);_0x2d2494(_0x563634[_0xac7d('0x12')](0x1f4,_0x365269['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index dfe37ca..0406a39 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 _0x440b=['../../components/auth/service','./system.controller','get','/process/:pid/kill','exports','Router'];(function(_0x1bcfa9,_0x5b27fe){var _0xc48ca8=function(_0x82abd5){while(--_0x82abd5){_0x1bcfa9['push'](_0x1bcfa9['shift']());}};_0xc48ca8(++_0x5b27fe);}(_0x440b,0x11f));var _0xb440=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0x440b[_0x1fd9e7];return _0x1781f2;};'use strict';var express=require('express');var router=express[_0xb440('0x0')]();var auth=require(_0xb440('0x1'));var controller=require(_0xb440('0x2'));router[_0xb440('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb440('0x3')](_0xb440('0x4'),auth['isAuthenticated'](),controller['killProcess']);module[_0xb440('0x5')]=router; \ No newline at end of file +var _0x6327=['isAuthenticated','exports','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill'];(function(_0x423294,_0x175cfe){var _0x3c27b1=function(_0x495168){while(--_0x495168){_0x423294['push'](_0x423294['shift']());}};_0x3c27b1(++_0x175cfe);}(_0x6327,0x1ba));var _0x7632=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x6327[_0x1304c6];return _0x2e6654;};'use strict';var express=require('express');var router=express[_0x7632('0x0')]();var auth=require(_0x7632('0x1'));var controller=require(_0x7632('0x2'));router[_0x7632('0x3')]('/',auth['isAuthenticated'](),controller[_0x7632('0x4')]);router[_0x7632('0x3')](_0x7632('0x5'),auth[_0x7632('0x6')](),controller['killProcess']);module[_0x7632('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 1b21e87..3681bbc 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 _0xa1b8=['components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','index','getAllData','then','json','catch'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa1b8,0x119));var _0x8a1b=function(_0x5e39ed,_0x2f02bf){_0x5e39ed=_0x5e39ed-0x0;var _0x2b21f5=_0xa1b8[_0x5e39ed];return _0x2b21f5;};'use strict';var info=require('systeminformation');var exec=require(_0x8a1b('0x0'))[_0x8a1b('0x1')];var logger=require(_0x8a1b('0x2'))(_0x8a1b('0x3'));var util=require(_0x8a1b('0x4'));var BPromise=require(_0x8a1b('0x5'));var _=require(_0x8a1b('0x6'));function handleError(_0x4f7a26,_0x21f22b,_0x436d1a){_0x21f22b=_0x21f22b||0x1f4;return function(_0x559954){logger[_0x8a1b('0x7')](_0x8a1b('0x8'),_0x436d1a,_0x21f22b,util['inspect'](_0x559954,{'showHidden':![],'depth':null}));delete _0x559954[_0x8a1b('0x9')];_0x4f7a26[_0x8a1b('0xa')](_0x21f22b)['send'](_0x559954);};}exports[_0x8a1b('0xb')]=function(_0x4923b4,_0x197cc9){return info[_0x8a1b('0xc')]()[_0x8a1b('0xd')](function(_0x2a78b8){return _0x197cc9['status'](0xc8)[_0x8a1b('0xe')](_0x2a78b8);})[_0x8a1b('0xf')](function(_0x364032){return _0x197cc9[_0x8a1b('0xa')](0x1f4)[_0x8a1b('0xe')](_0x364032);});};exports['killProcess']=function(_0x22dcde,_0x20ef84){var _0x438cfe=[_0x8a1b('0x10')];return new BPromise(function(_0x11b954,_0x120e05){return exec(util['format'](_0x8a1b('0x11'),_0x22dcde[_0x8a1b('0x12')][_0x8a1b('0x13')]),function(_0x3ac50d,_0x11cc4d,_0x47722b){if(_0x3ac50d){return _0x120e05(_0x3ac50d);}return _0x11b954(_0x11cc4d);});})[_0x8a1b('0xd')](function(_0x32b26e){var _0xe1aa3b=![];var _0x55dd94=_0x32b26e[_0x8a1b('0x14')](/\n/);for(var _0x43c9df=0x0,_0x306a26=_0x438cfe[_0x8a1b('0x15')];_0x43c9df<_0x306a26,_0xe1aa3b===![];_0x43c9df+=0x1){if(_0x32b26e[_0x8a1b('0x16')](_0x438cfe[_0x43c9df])>=0x0){_0xe1aa3b=!![];}}if(!_0xe1aa3b){throw new Error(util[_0x8a1b('0x17')](_0x8a1b('0x18'),_0x22dcde['params']['pid']));}process['kill'](_0x22dcde[_0x8a1b('0x12')]['pid'],_0x8a1b('0x19'));return _0x20ef84[_0x8a1b('0xa')](0xc8)[_0x8a1b('0xe')]({'message':util[_0x8a1b('0x17')](_0x8a1b('0x1a'),_0x22dcde['params']['pid'])});})[_0x8a1b('0xf')](handleError(_0x20ef84,null,'killProcess'));}; \ No newline at end of file +var _0x6e43=['getAllData','then','json','status','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','api','util','bluebird','inspect','name','index'];(function(_0x3f59e1,_0x52ed63){var _0x225d22=function(_0x106f23){while(--_0x106f23){_0x3f59e1['push'](_0x3f59e1['shift']());}};_0x225d22(++_0x52ed63);}(_0x6e43,0x172));var _0x36e4=function(_0x14d5ba,_0x23a79c){_0x14d5ba=_0x14d5ba-0x0;var _0x4cc5e5=_0x6e43[_0x14d5ba];return _0x4cc5e5;};'use strict';var info=require(_0x36e4('0x0'));var exec=require(_0x36e4('0x1'))['exec'];var logger=require('../../config/logger')(_0x36e4('0x2'));var util=require(_0x36e4('0x3'));var BPromise=require(_0x36e4('0x4'));var _=require('lodash');function handleError(_0x4b5dc2,_0x3a1e91,_0x4234fd){_0x3a1e91=_0x3a1e91||0x1f4;return function(_0x3c72e9){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4234fd,_0x3a1e91,util[_0x36e4('0x5')](_0x3c72e9,{'showHidden':![],'depth':null}));delete _0x3c72e9[_0x36e4('0x6')];_0x4b5dc2['status'](_0x3a1e91)['send'](_0x3c72e9);};}exports[_0x36e4('0x7')]=function(_0x2eaf6d,_0x88f007){return info[_0x36e4('0x8')]()[_0x36e4('0x9')](function(_0x2cf7fd){return _0x88f007['status'](0xc8)[_0x36e4('0xa')](_0x2cf7fd);})['catch'](function(_0x4f5faa){return _0x88f007[_0x36e4('0xb')](0x1f4)[_0x36e4('0xa')](_0x4f5faa);});};exports['killProcess']=function(_0x5a0857,_0x5c984b){var _0x173563=['components/import/cm'];return new BPromise(function(_0x548a24,_0x1006cc){return exec(util[_0x36e4('0xc')](_0x36e4('0xd'),_0x5a0857['params'][_0x36e4('0xe')]),function(_0xd00873,_0x29674a,_0x3e7d20){if(_0xd00873){return _0x1006cc(_0xd00873);}return _0x548a24(_0x29674a);});})[_0x36e4('0x9')](function(_0x65de09){var _0x4d79ab=![];var _0x33fc9b=_0x65de09['split'](/\n/);for(var _0x1f0b86=0x0,_0x9d36c0=_0x173563[_0x36e4('0xf')];_0x1f0b86<_0x9d36c0,_0x4d79ab===![];_0x1f0b86+=0x1){if(_0x65de09[_0x36e4('0x10')](_0x173563[_0x1f0b86])>=0x0){_0x4d79ab=!![];}}if(!_0x4d79ab){throw new Error(util[_0x36e4('0xc')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5a0857[_0x36e4('0x11')][_0x36e4('0xe')]));}process[_0x36e4('0x12')](_0x5a0857[_0x36e4('0x11')]['pid'],_0x36e4('0x13'));return _0x5c984b[_0x36e4('0xb')](0xc8)[_0x36e4('0xa')]({'message':util[_0x36e4('0xc')](_0x36e4('0x14'),_0x5a0857[_0x36e4('0x11')][_0x36e4('0xe')])});})['catch'](handleError(_0x5c984b,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 63d5858..7258ac6 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 _0xa6d1=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','/:id','post','create','put','update','delete','destroy'];(function(_0x6853c0,_0x4a7b41){var _0x188db3=function(_0x5e0871){while(--_0x5e0871){_0x6853c0['push'](_0x6853c0['shift']());}};_0x188db3(++_0x4a7b41);}(_0xa6d1,0x1e1));var _0x1a6d=function(_0x5a1c43,_0x53d254){_0x5a1c43=_0x5a1c43-0x0;var _0x4bbbd3=_0xa6d1[_0x5a1c43];return _0x4bbbd3;};'use strict';var multer=require(_0x1a6d('0x0'));var util=require(_0x1a6d('0x1'));var path=require(_0x1a6d('0x2'));var timeout=require(_0x1a6d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1a6d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1a6d('0x5'));var controller=require(_0x1a6d('0x6'));router['get']('/',auth[_0x1a6d('0x7')](),controller['index']);router['get'](_0x1a6d('0x8'),auth[_0x1a6d('0x7')](),controller['show']);router[_0x1a6d('0x9')]('/',auth['isAuthenticated'](),controller[_0x1a6d('0xa')]);router[_0x1a6d('0xb')](_0x1a6d('0x8'),auth[_0x1a6d('0x7')](),controller[_0x1a6d('0xc')]);router[_0x1a6d('0xd')](_0x1a6d('0x8'),auth[_0x1a6d('0x7')](),controller[_0x1a6d('0xe')]);module[_0x1a6d('0xf')]=router; \ No newline at end of file +var _0x8c43=['get','isAuthenticated','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./tag.controller'];(function(_0x41aa41,_0x260667){var _0xb68502=function(_0x3d1905){while(--_0x3d1905){_0x41aa41['push'](_0x41aa41['shift']());}};_0xb68502(++_0x260667);}(_0x8c43,0x1e5));var _0x38c4=function(_0x5db597,_0xe15b2){_0x5db597=_0x5db597-0x0;var _0x79f46=_0x8c43[_0x5db597];return _0x79f46;};'use strict';var multer=require(_0x38c4('0x0'));var util=require(_0x38c4('0x1'));var path=require(_0x38c4('0x2'));var timeout=require(_0x38c4('0x3'));var express=require(_0x38c4('0x4'));var router=express['Router']();var fs_extra=require(_0x38c4('0x5'));var auth=require(_0x38c4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x38c4('0x7'));router[_0x38c4('0x8')]('/',auth[_0x38c4('0x9')](),controller['index']);router[_0x38c4('0x8')](_0x38c4('0xa'),auth[_0x38c4('0x9')](),controller[_0x38c4('0xb')]);router[_0x38c4('0xc')]('/',auth[_0x38c4('0x9')](),controller[_0x38c4('0xd')]);router[_0x38c4('0xe')]('/:id',auth[_0x38c4('0x9')](),controller['update']);router[_0x38c4('0xf')](_0x38c4('0xa'),auth[_0x38c4('0x9')](),controller[_0x38c4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 67723f6..ef4e098 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 _0x5eb1=['exports','STRING','name','#0091EA'];(function(_0x56de63,_0x274d1d){var _0x2e0cec=function(_0x363cdb){while(--_0x363cdb){_0x56de63['push'](_0x56de63['shift']());}};_0x2e0cec(++_0x274d1d);}(_0x5eb1,0x7c));var _0x15eb=function(_0x501ca1,_0x6c6edc){_0x501ca1=_0x501ca1-0x0;var _0x2a99c4=_0x5eb1[_0x501ca1];return _0x2a99c4;};'use strict';var Sequelize=require('sequelize');module[_0x15eb('0x0')]={'name':{'type':Sequelize[_0x15eb('0x1')],'unique':_0x15eb('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x15eb('0x1')],'defaultValue':_0x15eb('0x3')},'description':{'type':Sequelize[_0x15eb('0x1')]}}; \ No newline at end of file +var _0x38c9=['#0091EA','sequelize','exports','STRING'];(function(_0x163ce6,_0xd28635){var _0x22f998=function(_0x467539){while(--_0x467539){_0x163ce6['push'](_0x163ce6['shift']());}};_0x22f998(++_0xd28635);}(_0x38c9,0x199));var _0x938c=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x38c9[_0x2e9187];return _0x1fc3a8;};'use strict';var Sequelize=require(_0x938c('0x0'));module[_0x938c('0x1')]={'name':{'type':Sequelize[_0x938c('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x938c('0x2')],'defaultValue':_0x938c('0x3')},'description':{'type':Sequelize[_0x938c('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3a422d8..3b92cdb 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 _0x1be1=['bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Tags','destroy','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','fast-json-patch','moment'];(function(_0x1233a3,_0x3110fa){var _0x5c9b8f=function(_0x158275){while(--_0x158275){_0x1233a3['push'](_0x1233a3['shift']());}};_0x5c9b8f(++_0x3110fa);}(_0x1be1,0x192));var _0x11be=function(_0x5b115b,_0x401506){_0x5b115b=_0x5b115b-0x0;var _0x399dfd=_0x1be1[_0x5b115b];return _0x399dfd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':!![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['Tag'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));}; \ No newline at end of file +var _0x19ea=['findAll','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','type','key','keys','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','merge','options','includeAll','include'];(function(_0x1afbe9,_0x190135){var _0x5657a7=function(_0x468925){while(--_0x468925){_0x1afbe9['push'](_0x1afbe9['shift']());}};_0x5657a7(++_0x190135);}(_0x19ea,0xfe));var _0xa19e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x19ea[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0xa19e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa19e('0x1'));var rp=require('request-promise');var moment=require(_0xa19e('0x2'));var BPromise=require(_0xa19e('0x3'));var Mustache=require(_0xa19e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa19e('0x5'));var csv=require(_0xa19e('0x6'));var ejs=require(_0xa19e('0x7'));var fs=require('fs');var fs_extra=require(_0xa19e('0x8'));var _=require(_0xa19e('0x9'));var squel=require(_0xa19e('0xa'));var crypto=require(_0xa19e('0xb'));var jsforce=require(_0xa19e('0xc'));var deskjs=require(_0xa19e('0xd'));var toCsv=require(_0xa19e('0x6'));var querystring=require(_0xa19e('0xe'));var Papa=require('papaparse');var Redis=require(_0xa19e('0xf'));var authService=require(_0xa19e('0x10'));var qs=require(_0xa19e('0x11'));var as=require(_0xa19e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa19e('0x13'))(_0xa19e('0x14'));var utils=require(_0xa19e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa19e('0x16'));var db=require(_0xa19e('0x17'))['db'];function respondWithStatusCode(_0xc781a2,_0x1bd1f5){_0x1bd1f5=_0x1bd1f5||0xcc;return function(_0x35ca5b){if(_0x35ca5b){return _0xc781a2['sendStatus'](_0x1bd1f5);}return _0xc781a2[_0xa19e('0x18')](_0x1bd1f5)[_0xa19e('0x19')]();};}function respondWithResult(_0xa7e0c4,_0x28dedd){_0x28dedd=_0x28dedd||0xc8;return function(_0x564d2a){if(_0x564d2a){return _0xa7e0c4[_0xa19e('0x18')](_0x28dedd)[_0xa19e('0x1a')](_0x564d2a);}};}function respondWithFilteredResult(_0x245bcb,_0x3be281){return function(_0x1fdea2){if(_0x1fdea2){var _0x2598f5=typeof _0x3be281['offset']===_0xa19e('0x1b')&&typeof _0x3be281[_0xa19e('0x1c')]===_0xa19e('0x1b');var _0x256819=_0x1fdea2[_0xa19e('0x1d')];var _0x38e398=_0x2598f5?0x0:_0x3be281[_0xa19e('0x1e')];var _0x530a75=_0x2598f5?_0x1fdea2[_0xa19e('0x1d')]:_0x3be281['offset']+_0x3be281[_0xa19e('0x1c')];var _0x5d05fd;if(_0x530a75>=_0x256819){_0x530a75=_0x256819;_0x5d05fd=0xc8;}else{_0x5d05fd=0xce;}_0x245bcb['status'](_0x5d05fd);return _0x245bcb[_0xa19e('0x1f')](_0xa19e('0x20'),_0x38e398+'-'+_0x530a75+'/'+_0x256819)['json'](_0x1fdea2);}return null;};}function patchUpdates(_0x1cb9f9){return function(_0x3f2060){try{jsonpatch[_0xa19e('0x21')](_0x3f2060,_0x1cb9f9,!![]);}catch(_0x93eb86){return BPromise['reject'](_0x93eb86);}return _0x3f2060[_0xa19e('0x22')]();};}function saveUpdates(_0x33b588,_0x105874){return function(_0x301f6d){if(_0x301f6d){return _0x301f6d[_0xa19e('0x23')](_0x33b588)[_0xa19e('0x24')](function(_0x2a416e){return _0x2a416e;});}return null;};}function removeEntity(_0x20a649,_0xc16a44){return function(_0x536386){if(_0x536386){return _0x536386[_0xa19e('0x25')]()[_0xa19e('0x24')](function(){var _0x504437=_0x536386[_0xa19e('0x26')]({'plain':!![]});var _0x1d3ce6='Tags';return db[_0xa19e('0x27')][_0xa19e('0x25')]({'where':{'type':_0x1d3ce6,'resourceId':_0x504437['id']}})['then'](function(){return _0x536386;});})[_0xa19e('0x24')](function(){_0x20a649[_0xa19e('0x18')](0xcc)[_0xa19e('0x19')]();});}};}function handleEntityNotFound(_0x21c9ca,_0x2076c5){return function(_0x180407){if(!_0x180407){_0x21c9ca[_0xa19e('0x28')](0x194);}return _0x180407;};}function handleError(_0x3f5ac6,_0x18c96f){_0x18c96f=_0x18c96f||0x1f4;return function(_0x24dd51){logger[_0xa19e('0x29')](_0x24dd51[_0xa19e('0x2a')]);if(_0x24dd51[_0xa19e('0x2b')]){delete _0x24dd51[_0xa19e('0x2b')];}_0x3f5ac6[_0xa19e('0x18')](_0x18c96f)[_0xa19e('0x2c')](_0x24dd51);};}exports[_0xa19e('0x2d')]=function(_0x27f3a0,_0x3dcd74){var _0x114656={},_0x557439={},_0x121c37={'count':0x0,'rows':[]};var _0x1311c5=_[_0xa19e('0x2e')](db[_0xa19e('0x2f')][_0xa19e('0x30')],function(_0x355fd9){return{'name':_0x355fd9['fieldName'],'type':_0x355fd9[_0xa19e('0x31')][_0xa19e('0x32')]};});_0x557439['model']=_[_0xa19e('0x2e')](_0x1311c5,'name');_0x557439['query']=_[_0xa19e('0x33')](_0x27f3a0['query']);_0x557439['filters']=_['intersection'](_0x557439[_0xa19e('0x34')],_0x557439[_0xa19e('0x35')]);_0x114656[_0xa19e('0x36')]=_['intersection'](_0x557439[_0xa19e('0x34')],qs[_0xa19e('0x37')](_0x27f3a0[_0xa19e('0x35')][_0xa19e('0x37')]));_0x114656[_0xa19e('0x36')]=_0x114656[_0xa19e('0x36')]['length']?_0x114656[_0xa19e('0x36')]:_0x557439[_0xa19e('0x34')];if(!_0x27f3a0['query'][_0xa19e('0x38')](_0xa19e('0x39'))){_0x114656[_0xa19e('0x1c')]=qs['limit'](_0x27f3a0['query'][_0xa19e('0x1c')]);_0x114656['offset']=qs[_0xa19e('0x1e')](_0x27f3a0[_0xa19e('0x35')][_0xa19e('0x1e')]);}_0x114656[_0xa19e('0x3a')]=qs['sort'](_0x27f3a0[_0xa19e('0x35')][_0xa19e('0x3b')]);_0x114656['where']=qs[_0xa19e('0x3c')](_['pick'](_0x27f3a0[_0xa19e('0x35')],_0x557439[_0xa19e('0x3c')]),_0x1311c5);if(_0x27f3a0[_0xa19e('0x35')]['filter']){_0x114656[_0xa19e('0x3d')]=_[_0xa19e('0x3e')](_0x114656[_0xa19e('0x3d')],{'$or':_['map'](_0x1311c5,function(_0xfcf01a){if(_0xfcf01a[_0xa19e('0x31')]!=='VIRTUAL'){var _0x561608={};_0x561608[_0xfcf01a[_0xa19e('0x2b')]]={'$like':'%'+_0x27f3a0[_0xa19e('0x35')]['filter']+'%'};return _0x561608;}})});}_0x114656=_[_0xa19e('0x3e')]({},_0x114656,_0x27f3a0[_0xa19e('0x3f')]);var _0x4b64d7={'where':_0x114656[_0xa19e('0x3d')]};return db[_0xa19e('0x2f')][_0xa19e('0x1d')](_0x4b64d7)[_0xa19e('0x24')](function(_0x30fdfb){_0x121c37['count']=_0x30fdfb;if(_0x27f3a0[_0xa19e('0x35')][_0xa19e('0x40')]){_0x114656[_0xa19e('0x41')]=[{'all':!![]}];}return db[_0xa19e('0x2f')][_0xa19e('0x42')](_0x114656);})['then'](function(_0x315341){_0x121c37['rows']=_0x315341;return _0x121c37;})[_0xa19e('0x24')](respondWithFilteredResult(_0x3dcd74,_0x114656))[_0xa19e('0x43')](handleError(_0x3dcd74,null));};exports['show']=function(_0x8dfa7e,_0x19a712){var _0x48e370={'raw':!![],'where':{'id':_0x8dfa7e['params']['id']}},_0x41d7ae={};_0x41d7ae[_0xa19e('0x34')]=_[_0xa19e('0x33')](db[_0xa19e('0x2f')][_0xa19e('0x30')]);_0x41d7ae[_0xa19e('0x35')]=_[_0xa19e('0x33')](_0x8dfa7e[_0xa19e('0x35')]);_0x41d7ae[_0xa19e('0x3c')]=_['intersection'](_0x41d7ae[_0xa19e('0x34')],_0x41d7ae[_0xa19e('0x35')]);_0x48e370['attributes']=_['intersection'](_0x41d7ae[_0xa19e('0x34')],qs[_0xa19e('0x37')](_0x8dfa7e[_0xa19e('0x35')]['fields']));_0x48e370[_0xa19e('0x36')]=_0x48e370[_0xa19e('0x36')]['length']?_0x48e370[_0xa19e('0x36')]:_0x41d7ae[_0xa19e('0x34')];if(_0x8dfa7e[_0xa19e('0x35')]['includeAll']){_0x48e370[_0xa19e('0x41')]=[{'all':!![]}];}_0x48e370=_['merge']({},_0x48e370,_0x8dfa7e[_0xa19e('0x3f')]);return db[_0xa19e('0x2f')][_0xa19e('0x44')](_0x48e370)[_0xa19e('0x24')](handleEntityNotFound(_0x19a712,null))[_0xa19e('0x24')](respondWithResult(_0x19a712,null))['catch'](handleError(_0x19a712,null));};exports[_0xa19e('0x45')]=function(_0x4c90fe,_0x4779d8){return db['Tag'][_0xa19e('0x45')](_0x4c90fe[_0xa19e('0x46')],{})[_0xa19e('0x24')](function(_0x203c03){var _0x538c9a=_0x4c90fe[_0xa19e('0x47')][_0xa19e('0x26')]({'plain':!![]});if(!_0x538c9a)throw new Error(_0xa19e('0x48'));if(_0x538c9a[_0xa19e('0x49')]==='user'){var _0x454c9f=_0x203c03['get']({'plain':!![]});var _0x2c58c8=_0xa19e('0x4a');return db[_0xa19e('0x4b')]['find']({'where':{'name':_0x2c58c8,'userProfileId':_0x538c9a[_0xa19e('0x4c')]},'raw':!![]})[_0xa19e('0x24')](function(_0x5bd756){if(_0x5bd756&&_0x5bd756[_0xa19e('0x4d')]===0x0){return db[_0xa19e('0x27')][_0xa19e('0x45')]({'name':_0x454c9f[_0xa19e('0x2b')],'resourceId':_0x454c9f['id'],'type':_0x5bd756['name'],'sectionId':_0x5bd756['id']},{})['then'](function(){return _0x203c03;});}else{return _0x203c03;}})[_0xa19e('0x43')](function(_0x239a3b){logger['error'](_0xa19e('0x4e'),_0x239a3b);throw _0x239a3b;});}return _0x203c03;})[_0xa19e('0x24')](respondWithResult(_0x4779d8,0xc9))['catch'](handleError(_0x4779d8,null));};exports[_0xa19e('0x23')]=function(_0x68e0d1,_0x44a946){if(_0x68e0d1[_0xa19e('0x46')]['id']){delete _0x68e0d1[_0xa19e('0x46')]['id'];}return db[_0xa19e('0x2f')][_0xa19e('0x44')]({'where':{'id':_0x68e0d1[_0xa19e('0x4f')]['id']}})[_0xa19e('0x24')](handleEntityNotFound(_0x44a946,null))[_0xa19e('0x24')](saveUpdates(_0x68e0d1[_0xa19e('0x46')],null))['then'](respondWithResult(_0x44a946,null))['catch'](handleError(_0x44a946,null));};exports[_0xa19e('0x25')]=function(_0x1a41a0,_0x17ac29){return db['Tag']['find']({'where':{'id':_0x1a41a0['params']['id']}})[_0xa19e('0x24')](handleEntityNotFound(_0x17ac29,null))['then'](removeEntity(_0x17ac29,null))[_0xa19e('0x43')](handleError(_0x17ac29,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9e78e6a..9c74afa 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 _0xe29e=['Tag','tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xd6a35e,_0x39f4d4){var _0x2f1d39=function(_0x30c9a7){while(--_0x30c9a7){_0xd6a35e['push'](_0xd6a35e['shift']());}};_0x2f1d39(++_0x39f4d4);}(_0xe29e,0x188));var _0xee29=function(_0x5b4341,_0x4b1c30){_0x5b4341=_0x5b4341-0x0;var _0x241ef7=_0xe29e[_0x5b4341];return _0x241ef7;};'use strict';var _=require('lodash');var util=require(_0xee29('0x0'));var logger=require(_0xee29('0x1'))(_0xee29('0x2'));var moment=require(_0xee29('0x3'));var BPromise=require(_0xee29('0x4'));var rp=require(_0xee29('0x5'));var fs=require('fs');var path=require(_0xee29('0x6'));var rimraf=require(_0xee29('0x7'));var config=require(_0xee29('0x8'));var attributes=require('./tag.attributes');module[_0xee29('0x9')]=function(_0x15b7c1,_0x1f503a){return _0x15b7c1[_0xee29('0xa')](_0xee29('0xb'),attributes,{'tableName':_0xee29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7747=['bluebird','path','rimraf','./tag.attributes','Tag','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7747,0xc5));var _0x7774=function(_0x1f5cb5,_0x2329dc){_0x1f5cb5=_0x1f5cb5-0x0;var _0x13d4e2=_0x7747[_0x1f5cb5];return _0x13d4e2;};'use strict';var _=require(_0x7774('0x0'));var util=require(_0x7774('0x1'));var logger=require('../../config/logger')(_0x7774('0x2'));var moment=require('moment');var BPromise=require(_0x7774('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7774('0x4'));var rimraf=require(_0x7774('0x5'));var config=require('../../config/environment');var attributes=require(_0x7774('0x6'));module['exports']=function(_0x2aba33,_0x79e4db){return _0x2aba33['define'](_0x7774('0x7'),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 0568b6b..4ef25f6 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 _0xe5b3=['request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s'];(function(_0x117576,_0x1ced1a){var _0x4533f5=function(_0x19bc33){while(--_0x19bc33){_0x117576['push'](_0x117576['shift']());}};_0x4533f5(++_0x1ced1a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1f06c5,_0x28092b){_0x1f06c5=_0x1f06c5-0x0;var _0x1ec9b2=_0xe5b3[_0x1f06c5];return _0x1ec9b2;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('Tag,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('Tag,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0xf021=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Tag,\x20%s,\x20%s','result','catch'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xf021,0x18f));var _0x1f02=function(_0x331b08,_0x2c5937){_0x331b08=_0x331b08-0x0;var _0x5034d9=_0xf021[_0x331b08];return _0x5034d9;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var moment=require(_0x1f02('0x2'));var BPromise=require(_0x1f02('0x3'));var rs=require(_0x1f02('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f02('0x6'))(_0x1f02('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f02('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383d0b,_0x257d6a,_0x2a6c50){return new BPromise(function(_0x4193d2,_0x1f1cec){return client['request'](_0x383d0b,_0x2a6c50)[_0x1f02('0x9')](function(_0x5dc295){logger['info']('Tag,\x20%s,\x20%s',_0x257d6a,_0x1f02('0xa'));logger[_0x1f02('0xb')](_0x1f02('0xc'),_0x257d6a,_0x1f02('0xa'),JSON[_0x1f02('0xd')](_0x5dc295));if(_0x5dc295['error']){if(_0x5dc295[_0x1f02('0xe')][_0x1f02('0xf')]===0x1f4){logger[_0x1f02('0xe')]('Tag,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x1f1cec(_0x5dc295[_0x1f02('0xe')]['message']);}logger['error']('Tag,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x4193d2(_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);}else{logger[_0x1f02('0x11')](_0x1f02('0x12'),_0x257d6a,_0x1f02('0xa'));_0x4193d2(_0x5dc295[_0x1f02('0x13')]['message']);}})[_0x1f02('0x14')](function(_0x5cca16){logger['error']('Tag,\x20%s,\x20%s',_0x257d6a,_0x5cca16);_0x1f1cec(_0x5cca16);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d5d006a..7b72c1c 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 7f4c631..7e978b4 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0xf7c901,_0x45c81a){var _0x185a8c=function(_0x466ed6){while(--_0x466ed6){_0xf7c901['push'](_0xf7c901['shift']());}};_0x185a8c(++_0x45c81a);}(_0x2032,0xd9));var _0x2203=function(_0x14f875,_0x1afd8b){_0x14f875=_0x14f875-0x0;var _0x49f78b=_0x2032[_0x14f875];return _0x49f78b;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x2f47d7,_0x319783){var _0x432299=function(_0x2a5941){while(--_0x2a5941){_0x2f47d7['push'](_0x2f47d7['shift']());}};_0x432299(++_0x319783);}(_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 68abcc3..90f440e 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 _0x780c=['error','stack','name','send','index','map','Team','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','options','catch','show','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getQueues','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','findOne','ValidationError','add','ids','removeQueues','remove','addAgents','Voice','Chat','Openchannel','Whatsapp','sequelize','transaction','through','QueueId','penalty','User','findOrCreate','emit','Queue:save','online','UserVoiceQueueRt','upsert','isNil','interface','voicePause','all','spread','removeAgents','Mail','Sms','Fax','parse','Queue:remove','getAgents','filter','eml-format','rimraf','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','save','then','destroy','Teams','UserProfileResource'];(function(_0x845897,_0x42ef70){var _0x2d70c8=function(_0x32a33b){while(--_0x32a33b){_0x845897['push'](_0x845897['shift']());}};_0x2d70c8(++_0x42ef70);}(_0x780c,0x15a));var _0xc780=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x780c[_0x1573ea];return _0x51c0e2;};'use strict';var emlformat=require(_0xc780('0x0'));var rimraf=require(_0xc780('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc780('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc780('0x3'));var util=require('util');var path=require(_0xc780('0x4'));var sox=require(_0xc780('0x5'));var csv=require(_0xc780('0x6'));var ejs=require(_0xc780('0x7'));var fs=require('fs');var fs_extra=require(_0xc780('0x8'));var _=require(_0xc780('0x9'));var squel=require(_0xc780('0xa'));var crypto=require(_0xc780('0xb'));var jsforce=require(_0xc780('0xc'));var deskjs=require(_0xc780('0xd'));var toCsv=require(_0xc780('0x6'));var querystring=require(_0xc780('0xe'));var Papa=require(_0xc780('0xf'));var Redis=require(_0xc780('0x10'));var authService=require(_0xc780('0x11'));var qs=require(_0xc780('0x12'));var as=require(_0xc780('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc780('0x14'))(_0xc780('0x15'));var utils=require(_0xc780('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc780('0x17'));var db=require(_0xc780('0x18'))['db'];config['redis']=_[_0xc780('0x19')](config[_0xc780('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc780('0x1b'))(new Redis(config['redis']));require('./team.socket')[_0xc780('0x1c')](socket);function respondWithStatusCode(_0x49a560,_0x488a48){_0x488a48=_0x488a48||0xcc;return function(_0x48bf7d){if(_0x48bf7d){return _0x49a560[_0xc780('0x1d')](_0x488a48);}return _0x49a560[_0xc780('0x1e')](_0x488a48)[_0xc780('0x1f')]();};}function respondWithResult(_0x44281f,_0x1f287f){_0x1f287f=_0x1f287f||0xc8;return function(_0x45f506){if(_0x45f506){return _0x44281f[_0xc780('0x1e')](_0x1f287f)['json'](_0x45f506);}};}function respondWithFilteredResult(_0xb74638,_0x133406){return function(_0x321334){if(_0x321334){var _0x4dc161=typeof _0x133406[_0xc780('0x20')]==='undefined'&&typeof _0x133406[_0xc780('0x21')]===_0xc780('0x22');var _0x3dea2f=_0x321334[_0xc780('0x23')];var _0xd2611e=_0x4dc161?0x0:_0x133406['offset'];var _0x5f416d=_0x4dc161?_0x321334[_0xc780('0x23')]:_0x133406[_0xc780('0x20')]+_0x133406[_0xc780('0x21')];var _0x432ffd;if(_0x5f416d>=_0x3dea2f){_0x5f416d=_0x3dea2f;_0x432ffd=0xc8;}else{_0x432ffd=0xce;}_0xb74638['status'](_0x432ffd);return _0xb74638[_0xc780('0x24')](_0xc780('0x25'),_0xd2611e+'-'+_0x5f416d+'/'+_0x3dea2f)[_0xc780('0x26')](_0x321334);}return null;};}function patchUpdates(_0x50eec4){return function(_0x4ecdd2){try{jsonpatch['apply'](_0x4ecdd2,_0x50eec4,!![]);}catch(_0x8e0fda){return BPromise['reject'](_0x8e0fda);}return _0x4ecdd2[_0xc780('0x27')]();};}function saveUpdates(_0x44944e,_0x3ff905){return function(_0xe6f03){if(_0xe6f03){return _0xe6f03['update'](_0x44944e)[_0xc780('0x28')](function(_0x4e90e6){return _0x4e90e6;});}return null;};}function removeEntity(_0xee58fa,_0x15b599){return function(_0x2ef8be){if(_0x2ef8be){return _0x2ef8be[_0xc780('0x29')]()[_0xc780('0x28')](function(){var _0x322c6b=_0x2ef8be['get']({'plain':!![]});var _0x2c5501=_0xc780('0x2a');return db[_0xc780('0x2b')][_0xc780('0x29')]({'where':{'type':_0x2c5501,'resourceId':_0x322c6b['id']}})[_0xc780('0x28')](function(){return _0x2ef8be;});})[_0xc780('0x28')](function(){_0xee58fa[_0xc780('0x1e')](0xcc)[_0xc780('0x1f')]();});}};}function handleEntityNotFound(_0x4988d1,_0x17ec3c){return function(_0x42972c){if(!_0x42972c){_0x4988d1[_0xc780('0x1d')](0x194);}return _0x42972c;};}function handleError(_0x3d9b97,_0x422707){_0x422707=_0x422707||0x1f4;return function(_0x15c57e){logger[_0xc780('0x2c')](_0x15c57e[_0xc780('0x2d')]);if(_0x15c57e[_0xc780('0x2e')]){delete _0x15c57e[_0xc780('0x2e')];}_0x3d9b97[_0xc780('0x1e')](_0x422707)[_0xc780('0x2f')](_0x15c57e);};}exports[_0xc780('0x30')]=function(_0x158f33,_0x339631){var _0x1e8566={},_0x1417ff={},_0x482031={'count':0x0,'rows':[]};var _0xca68a=_[_0xc780('0x31')](db[_0xc780('0x32')][_0xc780('0x33')],function(_0x4d4fc1){return{'name':_0x4d4fc1[_0xc780('0x34')],'type':_0x4d4fc1['type']['key']};});_0x1417ff[_0xc780('0x35')]=_[_0xc780('0x31')](_0xca68a,'name');_0x1417ff[_0xc780('0x36')]=_[_0xc780('0x37')](_0x158f33[_0xc780('0x36')]);_0x1417ff[_0xc780('0x38')]=_[_0xc780('0x39')](_0x1417ff['model'],_0x1417ff['query']);_0x1e8566[_0xc780('0x3a')]=_['intersection'](_0x1417ff['model'],qs[_0xc780('0x3b')](_0x158f33[_0xc780('0x36')][_0xc780('0x3b')]));_0x1e8566[_0xc780('0x3a')]=_0x1e8566[_0xc780('0x3a')]['length']?_0x1e8566[_0xc780('0x3a')]:_0x1417ff[_0xc780('0x35')];if(!_0x158f33['query']['hasOwnProperty'](_0xc780('0x3c'))){_0x1e8566[_0xc780('0x21')]=qs[_0xc780('0x21')](_0x158f33[_0xc780('0x36')][_0xc780('0x21')]);_0x1e8566[_0xc780('0x20')]=qs[_0xc780('0x20')](_0x158f33['query'][_0xc780('0x20')]);}_0x1e8566['order']=qs[_0xc780('0x3d')](_0x158f33['query'][_0xc780('0x3d')]);_0x1e8566[_0xc780('0x3e')]=qs[_0xc780('0x38')](_[_0xc780('0x3f')](_0x158f33[_0xc780('0x36')],_0x1417ff[_0xc780('0x38')]),_0xca68a);if(_0x158f33[_0xc780('0x36')]['filter']){_0x1e8566['where']=_[_0xc780('0x40')](_0x1e8566[_0xc780('0x3e')],{'$or':_[_0xc780('0x31')](_0xca68a,function(_0x1334e3){if(_0x1334e3['type']!=='VIRTUAL'){var _0x44d336={};_0x44d336[_0x1334e3[_0xc780('0x2e')]]={'$like':'%'+_0x158f33[_0xc780('0x36')]['filter']+'%'};return _0x44d336;}})});}_0x1e8566=_['merge']({},_0x1e8566,_0x158f33[_0xc780('0x41')]);var _0x3fe27a={'where':_0x1e8566['where']};return db[_0xc780('0x32')][_0xc780('0x23')](_0x3fe27a)[_0xc780('0x28')](function(_0x4f7b91){_0x482031[_0xc780('0x23')]=_0x4f7b91;if(_0x158f33[_0xc780('0x36')]['includeAll']){_0x1e8566['include']=[{'all':!![]}];}return db[_0xc780('0x32')]['findAll'](_0x1e8566);})[_0xc780('0x28')](function(_0xb4c0bb){_0x482031['rows']=_0xb4c0bb;return _0x482031;})[_0xc780('0x28')](respondWithFilteredResult(_0x339631,_0x1e8566))[_0xc780('0x42')](handleError(_0x339631,null));};exports[_0xc780('0x43')]=function(_0x4ed47d,_0x277544){var _0x6e2975={'raw':![],'where':{'id':_0x4ed47d['params']['id']}},_0xbab2b6={};_0xbab2b6['model']=_[_0xc780('0x37')](db['Team'][_0xc780('0x33')]);_0xbab2b6[_0xc780('0x36')]=_[_0xc780('0x37')](_0x4ed47d['query']);_0xbab2b6[_0xc780('0x38')]=_[_0xc780('0x39')](_0xbab2b6['model'],_0xbab2b6['query']);_0x6e2975[_0xc780('0x3a')]=_[_0xc780('0x39')](_0xbab2b6[_0xc780('0x35')],qs[_0xc780('0x3b')](_0x4ed47d['query']['fields']));_0x6e2975[_0xc780('0x3a')]=_0x6e2975['attributes'][_0xc780('0x44')]?_0x6e2975[_0xc780('0x3a')]:_0xbab2b6[_0xc780('0x35')];if(_0x4ed47d['query'][_0xc780('0x45')]){_0x6e2975[_0xc780('0x46')]=[{'all':!![]}];}_0x6e2975=_[_0xc780('0x40')]({},_0x6e2975,_0x4ed47d['options']);return db[_0xc780('0x32')][_0xc780('0x47')](_0x6e2975)[_0xc780('0x28')](handleEntityNotFound(_0x277544,null))[_0xc780('0x28')](respondWithResult(_0x277544,null))[_0xc780('0x42')](handleError(_0x277544,null));};exports[_0xc780('0x48')]=function(_0x5c4313,_0x5d4a04){return db[_0xc780('0x32')][_0xc780('0x48')](_0x5c4313[_0xc780('0x49')],{})[_0xc780('0x28')](function(_0x3e936a){var _0xa6e4ef=_0x5c4313[_0xc780('0x4a')][_0xc780('0x4b')]({'plain':!![]});if(!_0xa6e4ef)throw new Error(_0xc780('0x4c'));if(_0xa6e4ef[_0xc780('0x4d')]===_0xc780('0x4a')){var _0x29ed50=_0x3e936a[_0xc780('0x4b')]({'plain':!![]});var _0x1edb77='Teams';return db['UserProfileSection'][_0xc780('0x47')]({'where':{'name':_0x1edb77,'userProfileId':_0xa6e4ef[_0xc780('0x4e')]},'raw':!![]})[_0xc780('0x28')](function(_0x27ed4a){if(_0x27ed4a&&_0x27ed4a[_0xc780('0x4f')]===0x0){return db[_0xc780('0x2b')][_0xc780('0x48')]({'name':_0x29ed50[_0xc780('0x2e')],'resourceId':_0x29ed50['id'],'type':_0x27ed4a['name'],'sectionId':_0x27ed4a['id']},{})[_0xc780('0x28')](function(){return _0x3e936a;});}else{return _0x3e936a;}})[_0xc780('0x42')](function(_0x327224){logger[_0xc780('0x2c')](_0xc780('0x50'),_0x327224);throw _0x327224;});}return _0x3e936a;})[_0xc780('0x28')](respondWithResult(_0x5d4a04,0xc9))['catch'](handleError(_0x5d4a04,null));};exports[_0xc780('0x51')]=function(_0x56aedb,_0x1e29c6){if(_0x56aedb[_0xc780('0x49')]['id']){delete _0x56aedb[_0xc780('0x49')]['id'];}return db[_0xc780('0x32')][_0xc780('0x47')]({'where':{'id':_0x56aedb[_0xc780('0x52')]['id']}})[_0xc780('0x28')](handleEntityNotFound(_0x1e29c6,null))[_0xc780('0x28')](saveUpdates(_0x56aedb[_0xc780('0x49')],null))[_0xc780('0x28')](respondWithResult(_0x1e29c6,null))[_0xc780('0x42')](handleError(_0x1e29c6,null));};exports['destroy']=function(_0xfcd279,_0x548a51){return db[_0xc780('0x32')][_0xc780('0x47')]({'where':{'id':_0xfcd279[_0xc780('0x52')]['id']}})[_0xc780('0x28')](handleEntityNotFound(_0x548a51,null))[_0xc780('0x28')](removeEntity(_0x548a51,null))[_0xc780('0x42')](handleError(_0x548a51,null));};exports[_0xc780('0x53')]=function(_0x2ba363,_0x24c860,_0x298912){return db[_0xc780('0x32')]['findOne']({'where':{'id':_0x2ba363['params']['id']}})[_0xc780('0x28')](handleEntityNotFound(_0x24c860,null))[_0xc780('0x28')](function(_0x2f3d33){if(!_0x2ba363['query'][_0xc780('0x54')]||!utils[_0xc780('0x55')](_0x2ba363[_0xc780('0x36')]['channel'])){throw new db[(_0xc780('0x56'))]['ValidationError'](_0xc780('0x57'));}var _0x3b07cc={};var _0xad411={};_0xad411['model']=_[_0xc780('0x37')](db[_[_0xc780('0x58')](_0x2ba363[_0xc780('0x36')][_0xc780('0x54')][_0xc780('0x59')]())+_0xc780('0x5a')][_0xc780('0x33')]);_0xad411['query']=_[_0xc780('0x37')](_0x2ba363[_0xc780('0x36')]);_0xad411[_0xc780('0x38')]=_[_0xc780('0x39')](_0xad411[_0xc780('0x35')],_0xad411[_0xc780('0x36')]);_0x3b07cc['attributes']=_['intersection'](_0xad411['model'],qs[_0xc780('0x3b')](_0x2ba363[_0xc780('0x36')]['fields']));_0x3b07cc[_0xc780('0x3a')]=_0x3b07cc['attributes'][_0xc780('0x44')]?_0x3b07cc[_0xc780('0x3a')]:_0xad411[_0xc780('0x35')];_0x3b07cc[_0xc780('0x21')]=qs[_0xc780('0x21')](_0x2ba363['query'][_0xc780('0x21')]);_0x3b07cc[_0xc780('0x20')]=qs[_0xc780('0x20')](_0x2ba363[_0xc780('0x36')][_0xc780('0x20')]);_0x3b07cc[_0xc780('0x5b')]=qs[_0xc780('0x3d')](_0x2ba363[_0xc780('0x36')][_0xc780('0x3d')]);_0x3b07cc[_0xc780('0x3e')]=qs[_0xc780('0x38')](_[_0xc780('0x3f')](_0x2ba363[_0xc780('0x36')],_0xad411['filters']));_0x3b07cc=_[_0xc780('0x40')]({},_0x3b07cc,_0x2ba363[_0xc780('0x41')]);return _0x2f3d33[_0xc780('0x4b')+_[_0xc780('0x58')](_0x2ba363[_0xc780('0x36')][_0xc780('0x54')]['toLowerCase']())+_0xc780('0x5c')](_0x3b07cc);})[_0xc780('0x28')](respondWithResult(_0x24c860,null))['catch'](handleError(_0x24c860,null));};exports[_0xc780('0x5d')]=function(_0xf8cd37,_0x1e017c,_0x25d777){return db[_0xc780('0x32')][_0xc780('0x5e')]({'where':{'id':_0xf8cd37[_0xc780('0x52')]['id']}})['then'](function(_0x2777fb){if(_0x2777fb){if(!_0xf8cd37['body'][_0xc780('0x54')]||!utils[_0xc780('0x55')](_0xf8cd37[_0xc780('0x49')][_0xc780('0x54')])){throw new db[(_0xc780('0x56'))][(_0xc780('0x5f'))](_0xc780('0x57'));}return _0x2777fb[_0xc780('0x60')+_[_0xc780('0x58')](_0xf8cd37[_0xc780('0x49')][_0xc780('0x54')]['toLowerCase']())+_0xc780('0x5c')](_0xf8cd37['body'][_0xc780('0x61')]);}return null;})[_0xc780('0x28')](handleEntityNotFound(_0x1e017c,null))[_0xc780('0x28')](respondWithStatusCode(_0x1e017c,null))['catch'](handleError(_0x1e017c,null));};exports[_0xc780('0x62')]=function(_0x47ebd0,_0x339494,_0x7c9957){return db[_0xc780('0x32')][_0xc780('0x5e')]({'where':{'id':_0x47ebd0[_0xc780('0x52')]['id']}})[_0xc780('0x28')](function(_0x1d167d){if(_0x1d167d){if(!_0x47ebd0[_0xc780('0x36')][_0xc780('0x54')]||!utils[_0xc780('0x55')](_0x47ebd0[_0xc780('0x36')]['channel'])){throw new db['Sequelize'][(_0xc780('0x5f'))](_0xc780('0x57'));}return _0x1d167d[_0xc780('0x63')+_[_0xc780('0x58')](_0x47ebd0[_0xc780('0x36')][_0xc780('0x54')]['toLowerCase']())+_0xc780('0x5c')](_0x47ebd0[_0xc780('0x36')][_0xc780('0x61')]);}return null;})['then'](handleEntityNotFound(_0x339494,null))[_0xc780('0x28')](respondWithStatusCode(_0x339494,null))[_0xc780('0x42')](handleError(_0x339494,null));};exports[_0xc780('0x64')]=function(_0x34dd6b,_0x4f73f7){return db['Team'][_0xc780('0x47')]({'where':{'id':_0x34dd6b[_0xc780('0x52')]['id']}})[_0xc780('0x28')](handleEntityNotFound(_0x4f73f7,null))[_0xc780('0x28')](function(_0x36393c){if(_0x36393c){var _0x5d511f=[_0xc780('0x65'),_0xc780('0x66'),'Mail','Sms','Fax',_0xc780('0x67'),_0xc780('0x68')];return db[_0xc780('0x69')][_0xc780('0x6a')](function(_0x44461d){var _0x4657f8=_[_0xc780('0x31')](_0x5d511f,function(_0x242190){var _0x5a15d1={'attributes':['id',_0xc780('0x2e')]};if(_0x242190===_0xc780('0x65')){_0x5a15d1[_0xc780('0x6b')]={'attributes':['penalty']};}return _0x36393c[_0xc780('0x4b')+_0x242190+_0xc780('0x5c')](_0x5a15d1)[_0xc780('0x28')](function(_0x4bb43c){var _0x215829=_['map'](_0x4bb43c,function(_0x2af6d5){var _0x767808=_['map'](_0x34dd6b[_0xc780('0x49')][_0xc780('0x61')],function(_0x59c6cb){var _0x53da0b={'where':{'UserId':_0x59c6cb,[_0x242190+_0xc780('0x6c')]:_0x2af6d5['id']},'transaction':_0x44461d};if(_0x242190===_0xc780('0x65')){_0x53da0b[_0xc780('0x19')]={'penalty':_0x2af6d5['TeamVoiceQueue'][_0xc780('0x6d')]};}return db[_0xc780('0x6e')+_0x242190+_0xc780('0x5a')][_0xc780('0x6f')](_0x53da0b)[_0xc780('0x28')](function(){socket[_0xc780('0x70')](_0xc780('0x4a')+_0x242190+_0xc780('0x71'),{'UserId':_0x59c6cb,[_0x242190+_0xc780('0x6c')]:_0x2af6d5['id']});if(_0x242190!=='Voice')return;return db[_0xc780('0x6e')]['findAll']({'where':{'id':_0x34dd6b[_0xc780('0x49')][_0xc780('0x61')],'online':0x1},'attributes':['id','name',_0xc780('0x72'),'voicePause','interface'],'raw':!![]})['then'](function(_0x5ca5b3){var _0x2d8a4d=_[_0xc780('0x31')](_0x5ca5b3,function(_0x45efec){return db[_0xc780('0x73')][_0xc780('0x74')]({'membername':_0x45efec[_0xc780('0x2e')],'UserId':_0x45efec['id'],'queue_name':_0x2af6d5[_0xc780('0x2e')],'VoiceQueueId':_0x2af6d5['id'],'interface':_[_0xc780('0x75')](_0x45efec[_0xc780('0x76')])?util['format']('SIP/%s',_0x45efec[_0xc780('0x2e')]):_0x45efec[_0xc780('0x76')],'paused':_0x45efec[_0xc780('0x77')]||![],'penalty':_0x2af6d5['TeamVoiceQueue'][_0xc780('0x6d')]},{'transaction':_0x44461d});});return Promise[_0xc780('0x78')](_0x2d8a4d);});});});return Promise[_0xc780('0x78')](_0x767808);});return Promise[_0xc780('0x78')](_0x215829);});});return Promise['all'](_0x4657f8)[_0xc780('0x28')](function(){return _0x36393c[_0xc780('0x64')](_0x34dd6b[_0xc780('0x49')][_0xc780('0x61')],{'transaction':_0x44461d})[_0xc780('0x79')](function(_0x222db0){return _0x222db0;});});});}})['then'](respondWithResult(_0x4f73f7,null))[_0xc780('0x42')](handleError(_0x4f73f7,null));};exports[_0xc780('0x7a')]=function(_0x43c033,_0x210303){return db['Team'][_0xc780('0x47')]({'where':{'id':_0x43c033[_0xc780('0x52')]['id']}})[_0xc780('0x28')](handleEntityNotFound(_0x210303,null))['then'](function(_0x5e05e8){if(_0x5e05e8){var _0x4d4935=[_0xc780('0x65'),'Chat',_0xc780('0x7b'),_0xc780('0x7c'),_0xc780('0x7d'),_0xc780('0x67'),_0xc780('0x68')];return db[_0xc780('0x69')]['transaction'](function(_0x43c206){var _0x3f08d9=_['map'](_0x4d4935,function(_0x278209){var _0x19262e={'attributes':['id',_0xc780('0x2e')]};return _0x5e05e8['get'+_0x278209+_0xc780('0x5c')](_0x19262e)[_0xc780('0x28')](function(_0x4bff1d){var _0x1d91df=_[_0xc780('0x31')](_0x4bff1d,function(_0x1a2f8a){return _0x1a2f8a['removeAgents'](_0x43c033[_0xc780('0x36')][_0xc780('0x61')],{'transaction':_0x43c206})['then'](function(){var _0x55d887=JSON[_0xc780('0x7e')]('['+_0x43c033['query']['ids']+']');var _0xbf3b27=_[_0xc780('0x31')](_0x55d887,function(_0x552ea9){socket[_0xc780('0x70')]('user'+_0x278209+_0xc780('0x7f'),{'UserId':Number(_0x552ea9),[_0x278209+_0xc780('0x6c')]:_0x1a2f8a['id']});if(_0x278209!==_0xc780('0x65'))return;return db['UserVoiceQueueRt'][_0xc780('0x29')]({'where':{'VoiceQueueId':_0x1a2f8a['id'],'UserId':_0x552ea9},'transaction':_0x43c206});});return Promise['all'](_0xbf3b27);});});return Promise[_0xc780('0x78')](_0x1d91df);});});return Promise[_0xc780('0x78')](_0x3f08d9)[_0xc780('0x28')](function(){return _0x5e05e8[_0xc780('0x7a')](_0x43c033[_0xc780('0x36')][_0xc780('0x61')],{'transaction':_0x43c206});});});}})[_0xc780('0x28')](respondWithStatusCode(_0x210303,null))[_0xc780('0x42')](handleError(_0x210303,null));};exports[_0xc780('0x80')]=function(_0x2e0382,_0x13c300,_0x54ad4f){var _0x163aaf={};var _0x30bc2b={};var _0x2d2dfa;var _0x6c2fc8;return db[_0xc780('0x32')]['findOne']({'where':{'id':_0x2e0382['params']['id']}})[_0xc780('0x28')](handleEntityNotFound(_0x13c300,null))[_0xc780('0x28')](function(_0x2169b5){if(_0x2169b5){_0x2d2dfa=_0x2169b5;_0x30bc2b[_0xc780('0x35')]=_[_0xc780('0x37')](db[_0xc780('0x6e')]['rawAttributes']);_0x30bc2b[_0xc780('0x36')]=_[_0xc780('0x37')](_0x2e0382[_0xc780('0x36')]);_0x30bc2b[_0xc780('0x38')]=_[_0xc780('0x39')](_0x30bc2b[_0xc780('0x35')],_0x30bc2b[_0xc780('0x36')]);_0x163aaf[_0xc780('0x3a')]=_[_0xc780('0x39')](_0x30bc2b[_0xc780('0x35')],qs['fields'](_0x2e0382['query'][_0xc780('0x3b')]));_0x163aaf[_0xc780('0x3a')]=_0x163aaf[_0xc780('0x3a')][_0xc780('0x44')]?_0x163aaf[_0xc780('0x3a')]:_0x30bc2b[_0xc780('0x35')];_0x163aaf[_0xc780('0x5b')]=qs['sort'](_0x2e0382['query'][_0xc780('0x3d')]);_0x163aaf[_0xc780('0x3e')]=qs[_0xc780('0x38')](_[_0xc780('0x3f')](_0x2e0382['query'],_0x30bc2b[_0xc780('0x38')]));if(_0x2e0382[_0xc780('0x36')]['filter']){_0x163aaf[_0xc780('0x3e')]=_[_0xc780('0x40')](_0x163aaf['where'],{'$or':_[_0xc780('0x31')](_0x163aaf['attributes'],function(_0x3dc1ce){var _0x547728={};_0x547728[_0x3dc1ce]={'$like':'%'+_0x2e0382['query'][_0xc780('0x81')]+'%'};return _0x547728;})});}_0x163aaf=_['merge']({},_0x163aaf,_0x2e0382[_0xc780('0x41')]);return _0x2d2dfa[_0xc780('0x80')](_0x163aaf);}})[_0xc780('0x28')](function(_0x37c706){if(_0x37c706){_0x6c2fc8=_0x37c706['length'];if(!_0x2e0382[_0xc780('0x36')]['hasOwnProperty']('nolimit')){_0x163aaf[_0xc780('0x21')]=qs[_0xc780('0x21')](_0x2e0382[_0xc780('0x36')][_0xc780('0x21')]);_0x163aaf[_0xc780('0x20')]=qs[_0xc780('0x20')](_0x2e0382[_0xc780('0x36')][_0xc780('0x20')]);}return _0x2d2dfa[_0xc780('0x80')](_0x163aaf);}})[_0xc780('0x28')](function(_0x2dc6ea){if(_0x2dc6ea){return _0x2dc6ea?{'count':_0x6c2fc8,'rows':_0x2dc6ea}:null;}})[_0xc780('0x28')](respondWithResult(_0x13c300,null))[_0xc780('0x42')](handleError(_0x13c300,null));}; \ No newline at end of file +var _0x9c3b=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','Queue','length','toLowerCase','Queues','addQueues','ids','removeQueues','Unknown\x20channel','addAgents','Chat','Mail','Sms','Fax','Openchannel','transaction','Voice','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','spread','removeAgents','Whatsapp','sequelize','Queue:remove','getAgents','hasOwnProperty','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','Team','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection'];(function(_0x1c407a,_0x52137b){var _0x1bf14c=function(_0x9593fb){while(--_0x9593fb){_0x1c407a['push'](_0x1c407a['shift']());}};_0x1bf14c(++_0x52137b);}(_0x9c3b,0x12f));var _0xb9c3=function(_0x5754c7,_0x28591e){_0x5754c7=_0x5754c7-0x0;var _0xfbf156=_0x9c3b[_0x5754c7];return _0xfbf156;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb9c3('0x0'));var jsonpatch=require(_0xb9c3('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb9c3('0x2'));var Mustache=require('mustache');var util=require(_0xb9c3('0x3'));var path=require(_0xb9c3('0x4'));var sox=require(_0xb9c3('0x5'));var csv=require(_0xb9c3('0x6'));var ejs=require(_0xb9c3('0x7'));var fs=require('fs');var fs_extra=require(_0xb9c3('0x8'));var _=require(_0xb9c3('0x9'));var squel=require(_0xb9c3('0xa'));var crypto=require(_0xb9c3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb9c3('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9c3('0xc'));var authService=require(_0xb9c3('0xd'));var qs=require(_0xb9c3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9c3('0xf'));var logger=require('../../config/logger')(_0xb9c3('0x10'));var utils=require(_0xb9c3('0x11'));var config=require(_0xb9c3('0x12'));var licenseUtil=require(_0xb9c3('0x13'));var db=require(_0xb9c3('0x14'))['db'];config[_0xb9c3('0x15')]=_[_0xb9c3('0x16')](config[_0xb9c3('0x15')],{'host':_0xb9c3('0x17'),'port':0x18eb});var socket=require(_0xb9c3('0x18'))(new Redis(config[_0xb9c3('0x15')]));require('./team.socket')[_0xb9c3('0x19')](socket);function respondWithStatusCode(_0x5211e2,_0x1b2f39){_0x1b2f39=_0x1b2f39||0xcc;return function(_0x230722){if(_0x230722){return _0x5211e2[_0xb9c3('0x1a')](_0x1b2f39);}return _0x5211e2[_0xb9c3('0x1b')](_0x1b2f39)['end']();};}function respondWithResult(_0x9ccfe,_0x1ecf02){_0x1ecf02=_0x1ecf02||0xc8;return function(_0xb4aa9a){if(_0xb4aa9a){return _0x9ccfe[_0xb9c3('0x1b')](_0x1ecf02)[_0xb9c3('0x1c')](_0xb4aa9a);}};}function respondWithFilteredResult(_0x1f5eff,_0x3ffb36){return function(_0x5f4c2e){if(_0x5f4c2e){var _0x3282d2=typeof _0x3ffb36[_0xb9c3('0x1d')]===_0xb9c3('0x1e')&&typeof _0x3ffb36['limit']===_0xb9c3('0x1e');var _0x30b012=_0x5f4c2e[_0xb9c3('0x1f')];var _0x3bb451=_0x3282d2?0x0:_0x3ffb36[_0xb9c3('0x1d')];var _0x36edc9=_0x3282d2?_0x5f4c2e[_0xb9c3('0x1f')]:_0x3ffb36['offset']+_0x3ffb36[_0xb9c3('0x20')];var _0x49a495;if(_0x36edc9>=_0x30b012){_0x36edc9=_0x30b012;_0x49a495=0xc8;}else{_0x49a495=0xce;}_0x1f5eff['status'](_0x49a495);return _0x1f5eff[_0xb9c3('0x21')]('Content-Range',_0x3bb451+'-'+_0x36edc9+'/'+_0x30b012)['json'](_0x5f4c2e);}return null;};}function patchUpdates(_0x559169){return function(_0xdb97ee){try{jsonpatch[_0xb9c3('0x22')](_0xdb97ee,_0x559169,!![]);}catch(_0xe108af){return BPromise[_0xb9c3('0x23')](_0xe108af);}return _0xdb97ee['save']();};}function saveUpdates(_0x5e94d9,_0x223e10){return function(_0x137a6e){if(_0x137a6e){return _0x137a6e[_0xb9c3('0x24')](_0x5e94d9)[_0xb9c3('0x25')](function(_0x58a561){return _0x58a561;});}return null;};}function removeEntity(_0x5448c1,_0x4ae7c5){return function(_0x67c226){if(_0x67c226){return _0x67c226[_0xb9c3('0x26')]()['then'](function(){var _0x916644=_0x67c226[_0xb9c3('0x27')]({'plain':!![]});var _0x4f424e='Teams';return db[_0xb9c3('0x28')][_0xb9c3('0x26')]({'where':{'type':_0x4f424e,'resourceId':_0x916644['id']}})['then'](function(){return _0x67c226;});})[_0xb9c3('0x25')](function(){_0x5448c1[_0xb9c3('0x1b')](0xcc)[_0xb9c3('0x29')]();});}};}function handleEntityNotFound(_0x417237,_0x42b024){return function(_0x286de4){if(!_0x286de4){_0x417237[_0xb9c3('0x1a')](0x194);}return _0x286de4;};}function handleError(_0x14b6d5,_0x261e3a){_0x261e3a=_0x261e3a||0x1f4;return function(_0x3d9dac){logger['error'](_0x3d9dac[_0xb9c3('0x2a')]);if(_0x3d9dac[_0xb9c3('0x2b')]){delete _0x3d9dac[_0xb9c3('0x2b')];}_0x14b6d5[_0xb9c3('0x1b')](_0x261e3a)[_0xb9c3('0x2c')](_0x3d9dac);};}exports[_0xb9c3('0x2d')]=function(_0x27953b,_0xd12bd1){var _0x55f288={},_0x2f4d02={},_0x5f1146={'count':0x0,'rows':[]};var _0x3a99fd=_[_0xb9c3('0x2e')](db[_0xb9c3('0x2f')][_0xb9c3('0x30')],function(_0x2d3991){return{'name':_0x2d3991['fieldName'],'type':_0x2d3991['type']['key']};});_0x2f4d02[_0xb9c3('0x31')]=_[_0xb9c3('0x2e')](_0x3a99fd,_0xb9c3('0x2b'));_0x2f4d02[_0xb9c3('0x32')]=_[_0xb9c3('0x33')](_0x27953b[_0xb9c3('0x32')]);_0x2f4d02[_0xb9c3('0x34')]=_[_0xb9c3('0x35')](_0x2f4d02['model'],_0x2f4d02[_0xb9c3('0x32')]);_0x55f288[_0xb9c3('0x36')]=_[_0xb9c3('0x35')](_0x2f4d02[_0xb9c3('0x31')],qs[_0xb9c3('0x37')](_0x27953b[_0xb9c3('0x32')][_0xb9c3('0x37')]));_0x55f288[_0xb9c3('0x36')]=_0x55f288[_0xb9c3('0x36')]['length']?_0x55f288[_0xb9c3('0x36')]:_0x2f4d02[_0xb9c3('0x31')];if(!_0x27953b[_0xb9c3('0x32')]['hasOwnProperty'](_0xb9c3('0x38'))){_0x55f288['limit']=qs[_0xb9c3('0x20')](_0x27953b[_0xb9c3('0x32')]['limit']);_0x55f288[_0xb9c3('0x1d')]=qs[_0xb9c3('0x1d')](_0x27953b[_0xb9c3('0x32')][_0xb9c3('0x1d')]);}_0x55f288[_0xb9c3('0x39')]=qs[_0xb9c3('0x3a')](_0x27953b[_0xb9c3('0x32')][_0xb9c3('0x3a')]);_0x55f288[_0xb9c3('0x3b')]=qs['filters'](_[_0xb9c3('0x3c')](_0x27953b[_0xb9c3('0x32')],_0x2f4d02[_0xb9c3('0x34')]),_0x3a99fd);if(_0x27953b[_0xb9c3('0x32')][_0xb9c3('0x3d')]){_0x55f288['where']=_['merge'](_0x55f288[_0xb9c3('0x3b')],{'$or':_[_0xb9c3('0x2e')](_0x3a99fd,function(_0x5605bb){if(_0x5605bb[_0xb9c3('0x3e')]!==_0xb9c3('0x3f')){var _0x245a5c={};_0x245a5c[_0x5605bb['name']]={'$like':'%'+_0x27953b[_0xb9c3('0x32')][_0xb9c3('0x3d')]+'%'};return _0x245a5c;}})});}_0x55f288=_[_0xb9c3('0x40')]({},_0x55f288,_0x27953b[_0xb9c3('0x41')]);var _0x48bc2e={'where':_0x55f288[_0xb9c3('0x3b')]};return db[_0xb9c3('0x2f')][_0xb9c3('0x1f')](_0x48bc2e)[_0xb9c3('0x25')](function(_0x240af3){_0x5f1146[_0xb9c3('0x1f')]=_0x240af3;if(_0x27953b[_0xb9c3('0x32')][_0xb9c3('0x42')]){_0x55f288[_0xb9c3('0x43')]=[{'all':!![]}];}return db[_0xb9c3('0x2f')][_0xb9c3('0x44')](_0x55f288);})[_0xb9c3('0x25')](function(_0x4b1666){_0x5f1146[_0xb9c3('0x45')]=_0x4b1666;return _0x5f1146;})[_0xb9c3('0x25')](respondWithFilteredResult(_0xd12bd1,_0x55f288))[_0xb9c3('0x46')](handleError(_0xd12bd1,null));};exports[_0xb9c3('0x47')]=function(_0x11f434,_0x30ed0e){var _0x2989e9={'raw':![],'where':{'id':_0x11f434['params']['id']}},_0x5b4a91={};_0x5b4a91[_0xb9c3('0x31')]=_[_0xb9c3('0x33')](db['Team'][_0xb9c3('0x30')]);_0x5b4a91['query']=_[_0xb9c3('0x33')](_0x11f434[_0xb9c3('0x32')]);_0x5b4a91[_0xb9c3('0x34')]=_[_0xb9c3('0x35')](_0x5b4a91['model'],_0x5b4a91[_0xb9c3('0x32')]);_0x2989e9[_0xb9c3('0x36')]=_[_0xb9c3('0x35')](_0x5b4a91['model'],qs['fields'](_0x11f434[_0xb9c3('0x32')][_0xb9c3('0x37')]));_0x2989e9['attributes']=_0x2989e9[_0xb9c3('0x36')]['length']?_0x2989e9[_0xb9c3('0x36')]:_0x5b4a91[_0xb9c3('0x31')];if(_0x11f434[_0xb9c3('0x32')]['includeAll']){_0x2989e9['include']=[{'all':!![]}];}_0x2989e9=_[_0xb9c3('0x40')]({},_0x2989e9,_0x11f434[_0xb9c3('0x41')]);return db[_0xb9c3('0x2f')][_0xb9c3('0x48')](_0x2989e9)[_0xb9c3('0x25')](handleEntityNotFound(_0x30ed0e,null))[_0xb9c3('0x25')](respondWithResult(_0x30ed0e,null))[_0xb9c3('0x46')](handleError(_0x30ed0e,null));};exports[_0xb9c3('0x49')]=function(_0x3ce8aa,_0x1c1cf9){return db[_0xb9c3('0x2f')][_0xb9c3('0x49')](_0x3ce8aa[_0xb9c3('0x4a')],{})['then'](function(_0xdfcfa0){var _0x44d0a5=_0x3ce8aa[_0xb9c3('0x4b')][_0xb9c3('0x27')]({'plain':!![]});if(!_0x44d0a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44d0a5[_0xb9c3('0x4c')]===_0xb9c3('0x4b')){var _0x16e969=_0xdfcfa0['get']({'plain':!![]});var _0xee036b='Teams';return db[_0xb9c3('0x4d')][_0xb9c3('0x48')]({'where':{'name':_0xee036b,'userProfileId':_0x44d0a5['userProfileId']},'raw':!![]})['then'](function(_0x2e4112){if(_0x2e4112&&_0x2e4112[_0xb9c3('0x4e')]===0x0){return db['UserProfileResource'][_0xb9c3('0x49')]({'name':_0x16e969[_0xb9c3('0x2b')],'resourceId':_0x16e969['id'],'type':_0x2e4112[_0xb9c3('0x2b')],'sectionId':_0x2e4112['id']},{})[_0xb9c3('0x25')](function(){return _0xdfcfa0;});}else{return _0xdfcfa0;}})[_0xb9c3('0x46')](function(_0x50818){logger[_0xb9c3('0x4f')](_0xb9c3('0x50'),_0x50818);throw _0x50818;});}return _0xdfcfa0;})['then'](respondWithResult(_0x1c1cf9,0xc9))[_0xb9c3('0x46')](handleError(_0x1c1cf9,null));};exports[_0xb9c3('0x24')]=function(_0x513e00,_0x3252fd){if(_0x513e00[_0xb9c3('0x4a')]['id']){delete _0x513e00[_0xb9c3('0x4a')]['id'];}return db[_0xb9c3('0x2f')][_0xb9c3('0x48')]({'where':{'id':_0x513e00[_0xb9c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x3252fd,null))['then'](saveUpdates(_0x513e00[_0xb9c3('0x4a')],null))[_0xb9c3('0x25')](respondWithResult(_0x3252fd,null))[_0xb9c3('0x46')](handleError(_0x3252fd,null));};exports[_0xb9c3('0x26')]=function(_0x4b4a00,_0x2dd3d6){return db[_0xb9c3('0x2f')][_0xb9c3('0x48')]({'where':{'id':_0x4b4a00[_0xb9c3('0x51')]['id']}})[_0xb9c3('0x25')](handleEntityNotFound(_0x2dd3d6,null))[_0xb9c3('0x25')](removeEntity(_0x2dd3d6,null))[_0xb9c3('0x46')](handleError(_0x2dd3d6,null));};exports['getQueues']=function(_0x3ead50,_0x54acfc,_0x159a19){return db['Team'][_0xb9c3('0x52')]({'where':{'id':_0x3ead50[_0xb9c3('0x51')]['id']}})[_0xb9c3('0x25')](handleEntityNotFound(_0x54acfc,null))[_0xb9c3('0x25')](function(_0xf50918){if(!_0x3ead50['query'][_0xb9c3('0x53')]||!utils[_0xb9c3('0x54')](_0x3ead50['query'][_0xb9c3('0x53')])){throw new db[(_0xb9c3('0x55'))][(_0xb9c3('0x56'))]('Unknown\x20channel');}var _0x17c2e7={};var _0x85dd72={};_0x85dd72[_0xb9c3('0x31')]=_[_0xb9c3('0x33')](db[_[_0xb9c3('0x57')](_0x3ead50[_0xb9c3('0x32')][_0xb9c3('0x53')]['toLowerCase']())+_0xb9c3('0x58')]['rawAttributes']);_0x85dd72['query']=_[_0xb9c3('0x33')](_0x3ead50[_0xb9c3('0x32')]);_0x85dd72[_0xb9c3('0x34')]=_['intersection'](_0x85dd72[_0xb9c3('0x31')],_0x85dd72[_0xb9c3('0x32')]);_0x17c2e7[_0xb9c3('0x36')]=_[_0xb9c3('0x35')](_0x85dd72['model'],qs[_0xb9c3('0x37')](_0x3ead50[_0xb9c3('0x32')][_0xb9c3('0x37')]));_0x17c2e7[_0xb9c3('0x36')]=_0x17c2e7[_0xb9c3('0x36')][_0xb9c3('0x59')]?_0x17c2e7['attributes']:_0x85dd72[_0xb9c3('0x31')];_0x17c2e7[_0xb9c3('0x20')]=qs[_0xb9c3('0x20')](_0x3ead50[_0xb9c3('0x32')][_0xb9c3('0x20')]);_0x17c2e7['offset']=qs[_0xb9c3('0x1d')](_0x3ead50['query'][_0xb9c3('0x1d')]);_0x17c2e7['order']=qs[_0xb9c3('0x3a')](_0x3ead50[_0xb9c3('0x32')][_0xb9c3('0x3a')]);_0x17c2e7['where']=qs[_0xb9c3('0x34')](_[_0xb9c3('0x3c')](_0x3ead50[_0xb9c3('0x32')],_0x85dd72[_0xb9c3('0x34')]));_0x17c2e7=_[_0xb9c3('0x40')]({},_0x17c2e7,_0x3ead50[_0xb9c3('0x41')]);return _0xf50918[_0xb9c3('0x27')+_[_0xb9c3('0x57')](_0x3ead50[_0xb9c3('0x32')]['channel'][_0xb9c3('0x5a')]())+_0xb9c3('0x5b')](_0x17c2e7);})[_0xb9c3('0x25')](respondWithResult(_0x54acfc,null))[_0xb9c3('0x46')](handleError(_0x54acfc,null));};exports[_0xb9c3('0x5c')]=function(_0xe1573d,_0x4ef15b,_0x38b128){return db[_0xb9c3('0x2f')][_0xb9c3('0x52')]({'where':{'id':_0xe1573d[_0xb9c3('0x51')]['id']}})['then'](function(_0x37c5a5){if(_0x37c5a5){if(!_0xe1573d[_0xb9c3('0x4a')][_0xb9c3('0x53')]||!utils[_0xb9c3('0x54')](_0xe1573d[_0xb9c3('0x4a')][_0xb9c3('0x53')])){throw new db[(_0xb9c3('0x55'))]['ValidationError']('Unknown\x20channel');}return _0x37c5a5['add'+_['capitalize'](_0xe1573d['body'][_0xb9c3('0x53')]['toLowerCase']())+'Queues'](_0xe1573d[_0xb9c3('0x4a')][_0xb9c3('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x4ef15b,null))[_0xb9c3('0x25')](respondWithStatusCode(_0x4ef15b,null))[_0xb9c3('0x46')](handleError(_0x4ef15b,null));};exports[_0xb9c3('0x5e')]=function(_0x14621b,_0x4e2758,_0x453329){return db[_0xb9c3('0x2f')][_0xb9c3('0x52')]({'where':{'id':_0x14621b[_0xb9c3('0x51')]['id']}})[_0xb9c3('0x25')](function(_0x419064){if(_0x419064){if(!_0x14621b[_0xb9c3('0x32')]['channel']||!utils[_0xb9c3('0x54')](_0x14621b[_0xb9c3('0x32')][_0xb9c3('0x53')])){throw new db[(_0xb9c3('0x55'))]['ValidationError'](_0xb9c3('0x5f'));}return _0x419064['remove'+_['capitalize'](_0x14621b['query'][_0xb9c3('0x53')]['toLowerCase']())+_0xb9c3('0x5b')](_0x14621b[_0xb9c3('0x32')][_0xb9c3('0x5d')]);}return null;})[_0xb9c3('0x25')](handleEntityNotFound(_0x4e2758,null))['then'](respondWithStatusCode(_0x4e2758,null))[_0xb9c3('0x46')](handleError(_0x4e2758,null));};exports[_0xb9c3('0x60')]=function(_0x383db4,_0x22b5e5){return db['Team'][_0xb9c3('0x48')]({'where':{'id':_0x383db4['params']['id']}})[_0xb9c3('0x25')](handleEntityNotFound(_0x22b5e5,null))['then'](function(_0x568be3){if(_0x568be3){var _0x26655c=['Voice',_0xb9c3('0x61'),_0xb9c3('0x62'),_0xb9c3('0x63'),_0xb9c3('0x64'),_0xb9c3('0x65'),'Whatsapp'];return db['sequelize'][_0xb9c3('0x66')](function(_0x3880ee){var _0x392819=_[_0xb9c3('0x2e')](_0x26655c,function(_0x42ca33){var _0x35a6ef={'attributes':['id',_0xb9c3('0x2b')]};if(_0x42ca33===_0xb9c3('0x67')){_0x35a6ef[_0xb9c3('0x68')]={'attributes':['penalty']};}return _0x568be3['get'+_0x42ca33+_0xb9c3('0x5b')](_0x35a6ef)[_0xb9c3('0x25')](function(_0x1baabf){var _0x2a603c=_['map'](_0x1baabf,function(_0x31e7dc){var _0x3f3015=_['map'](_0x383db4['body']['ids'],function(_0xa7c9f4){var _0x50f5d8={'where':{'UserId':_0xa7c9f4,[_0x42ca33+_0xb9c3('0x69')]:_0x31e7dc['id']},'transaction':_0x3880ee};if(_0x42ca33===_0xb9c3('0x67')){_0x50f5d8[_0xb9c3('0x16')]={'penalty':_0x31e7dc[_0xb9c3('0x6a')][_0xb9c3('0x6b')]};}return db[_0xb9c3('0x6c')+_0x42ca33+_0xb9c3('0x58')][_0xb9c3('0x6d')](_0x50f5d8)[_0xb9c3('0x25')](function(){socket[_0xb9c3('0x6e')](_0xb9c3('0x4b')+_0x42ca33+_0xb9c3('0x6f'),{'UserId':_0xa7c9f4,[_0x42ca33+_0xb9c3('0x69')]:_0x31e7dc['id']});if(_0x42ca33!==_0xb9c3('0x67'))return;return db['User'][_0xb9c3('0x44')]({'where':{'id':_0x383db4[_0xb9c3('0x4a')]['ids'],'online':0x1},'attributes':['id',_0xb9c3('0x2b'),_0xb9c3('0x70'),_0xb9c3('0x71'),_0xb9c3('0x72')],'raw':!![]})['then'](function(_0x235357){var _0x431a1c=_[_0xb9c3('0x2e')](_0x235357,function(_0x3e7cb5){return db[_0xb9c3('0x73')][_0xb9c3('0x74')]({'membername':_0x3e7cb5[_0xb9c3('0x2b')],'UserId':_0x3e7cb5['id'],'queue_name':_0x31e7dc[_0xb9c3('0x2b')],'VoiceQueueId':_0x31e7dc['id'],'interface':_[_0xb9c3('0x75')](_0x3e7cb5[_0xb9c3('0x72')])?util['format'](_0xb9c3('0x76'),_0x3e7cb5['name']):_0x3e7cb5[_0xb9c3('0x72')],'paused':_0x3e7cb5[_0xb9c3('0x71')]||![],'penalty':_0x31e7dc[_0xb9c3('0x6a')][_0xb9c3('0x6b')]},{'transaction':_0x3880ee});});return Promise['all'](_0x431a1c);});});});return Promise['all'](_0x3f3015);});return Promise[_0xb9c3('0x77')](_0x2a603c);});});return Promise['all'](_0x392819)[_0xb9c3('0x25')](function(){return _0x568be3[_0xb9c3('0x60')](_0x383db4[_0xb9c3('0x4a')][_0xb9c3('0x5d')],{'transaction':_0x3880ee})[_0xb9c3('0x78')](function(_0x33ca94){return _0x33ca94;});});});}})[_0xb9c3('0x25')](respondWithResult(_0x22b5e5,null))[_0xb9c3('0x46')](handleError(_0x22b5e5,null));};exports[_0xb9c3('0x79')]=function(_0x57408b,_0x48725b){return db[_0xb9c3('0x2f')][_0xb9c3('0x48')]({'where':{'id':_0x57408b[_0xb9c3('0x51')]['id']}})[_0xb9c3('0x25')](handleEntityNotFound(_0x48725b,null))[_0xb9c3('0x25')](function(_0x353310){if(_0x353310){var _0x2c8bb1=[_0xb9c3('0x67'),_0xb9c3('0x61'),_0xb9c3('0x62'),_0xb9c3('0x63'),_0xb9c3('0x64'),'Openchannel',_0xb9c3('0x7a')];return db[_0xb9c3('0x7b')][_0xb9c3('0x66')](function(_0x104f07){var _0x44fc55=_[_0xb9c3('0x2e')](_0x2c8bb1,function(_0x1bdb0c){var _0x3e2505={'attributes':['id',_0xb9c3('0x2b')]};return _0x353310[_0xb9c3('0x27')+_0x1bdb0c+_0xb9c3('0x5b')](_0x3e2505)[_0xb9c3('0x25')](function(_0x13f14e){var _0x3f287d=_[_0xb9c3('0x2e')](_0x13f14e,function(_0xb06544){return _0xb06544[_0xb9c3('0x79')](_0x57408b[_0xb9c3('0x32')]['ids'],{'transaction':_0x104f07})[_0xb9c3('0x25')](function(){var _0x186efb=JSON['parse']('['+_0x57408b[_0xb9c3('0x32')][_0xb9c3('0x5d')]+']');var _0x14b0eb=_['map'](_0x186efb,function(_0x24b01d){socket[_0xb9c3('0x6e')](_0xb9c3('0x4b')+_0x1bdb0c+_0xb9c3('0x7c'),{'UserId':Number(_0x24b01d),[_0x1bdb0c+'QueueId']:_0xb06544['id']});if(_0x1bdb0c!==_0xb9c3('0x67'))return;return db[_0xb9c3('0x73')][_0xb9c3('0x26')]({'where':{'VoiceQueueId':_0xb06544['id'],'UserId':_0x24b01d},'transaction':_0x104f07});});return Promise['all'](_0x14b0eb);});});return Promise[_0xb9c3('0x77')](_0x3f287d);});});return Promise[_0xb9c3('0x77')](_0x44fc55)[_0xb9c3('0x25')](function(){return _0x353310['removeAgents'](_0x57408b[_0xb9c3('0x32')][_0xb9c3('0x5d')],{'transaction':_0x104f07});});});}})['then'](respondWithStatusCode(_0x48725b,null))[_0xb9c3('0x46')](handleError(_0x48725b,null));};exports['getAgents']=function(_0x1869d0,_0xa984bb,_0x76781a){var _0x38a26a={};var _0x118d88={};var _0x4c1e75;var _0xba0f92;return db[_0xb9c3('0x2f')]['findOne']({'where':{'id':_0x1869d0[_0xb9c3('0x51')]['id']}})['then'](handleEntityNotFound(_0xa984bb,null))[_0xb9c3('0x25')](function(_0x158f87){if(_0x158f87){_0x4c1e75=_0x158f87;_0x118d88[_0xb9c3('0x31')]=_['keys'](db[_0xb9c3('0x6c')][_0xb9c3('0x30')]);_0x118d88[_0xb9c3('0x32')]=_[_0xb9c3('0x33')](_0x1869d0[_0xb9c3('0x32')]);_0x118d88[_0xb9c3('0x34')]=_[_0xb9c3('0x35')](_0x118d88['model'],_0x118d88[_0xb9c3('0x32')]);_0x38a26a[_0xb9c3('0x36')]=_[_0xb9c3('0x35')](_0x118d88[_0xb9c3('0x31')],qs[_0xb9c3('0x37')](_0x1869d0[_0xb9c3('0x32')][_0xb9c3('0x37')]));_0x38a26a['attributes']=_0x38a26a[_0xb9c3('0x36')][_0xb9c3('0x59')]?_0x38a26a[_0xb9c3('0x36')]:_0x118d88['model'];_0x38a26a['order']=qs[_0xb9c3('0x3a')](_0x1869d0[_0xb9c3('0x32')][_0xb9c3('0x3a')]);_0x38a26a[_0xb9c3('0x3b')]=qs[_0xb9c3('0x34')](_['pick'](_0x1869d0[_0xb9c3('0x32')],_0x118d88['filters']));if(_0x1869d0['query'][_0xb9c3('0x3d')]){_0x38a26a[_0xb9c3('0x3b')]=_['merge'](_0x38a26a[_0xb9c3('0x3b')],{'$or':_[_0xb9c3('0x2e')](_0x38a26a['attributes'],function(_0x2ddd06){var _0x464761={};_0x464761[_0x2ddd06]={'$like':'%'+_0x1869d0[_0xb9c3('0x32')][_0xb9c3('0x3d')]+'%'};return _0x464761;})});}_0x38a26a=_[_0xb9c3('0x40')]({},_0x38a26a,_0x1869d0['options']);return _0x4c1e75[_0xb9c3('0x7d')](_0x38a26a);}})[_0xb9c3('0x25')](function(_0x16370b){if(_0x16370b){_0xba0f92=_0x16370b[_0xb9c3('0x59')];if(!_0x1869d0[_0xb9c3('0x32')][_0xb9c3('0x7e')](_0xb9c3('0x38'))){_0x38a26a[_0xb9c3('0x20')]=qs['limit'](_0x1869d0['query']['limit']);_0x38a26a['offset']=qs['offset'](_0x1869d0[_0xb9c3('0x32')][_0xb9c3('0x1d')]);}return _0x4c1e75[_0xb9c3('0x7d')](_0x38a26a);}})[_0xb9c3('0x25')](function(_0x278791){if(_0x278791){return _0x278791?{'count':_0xba0f92,'rows':_0x278791}:null;}})[_0xb9c3('0x25')](respondWithResult(_0xa984bb,null))['catch'](handleError(_0xa984bb,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 1b47262..5ece7c9 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 _0x1c35=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','Team'];(function(_0x27b77c,_0x231ebf){var _0x2ae588=function(_0x3bd852){while(--_0x3bd852){_0x27b77c['push'](_0x27b77c['shift']());}};_0x2ae588(++_0x231ebf);}(_0x1c35,0x6e));var _0x51c3=function(_0x2c3c97,_0x14d33c){_0x2c3c97=_0x2c3c97-0x0;var _0x31362c=_0x1c35[_0x2c3c97];return _0x31362c;};'use strict';var EventEmitter=require('events');var Team=require(_0x51c3('0x0'))['db'][_0x51c3('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x51c3('0x2'),'afterDestroy':_0x51c3('0x3')};function emitEvent(_0x10bb3d){return function(_0x42a996,_0x1c5849,_0x47b6ae){TeamEvents[_0x51c3('0x4')](_0x10bb3d+':'+_0x42a996['id'],_0x42a996);TeamEvents['emit'](_0x10bb3d,_0x42a996);_0x47b6ae(null);};}for(var e in events){if(events[_0x51c3('0x5')](e)){var event=events[e];Team[_0x51c3('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xd8cf=['Team','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1a646b,_0x4f38d4){var _0x3950e0=function(_0x15441e){while(--_0x15441e){_0x1a646b['push'](_0x1a646b['shift']());}};_0x3950e0(++_0x4f38d4);}(_0xd8cf,0x1ed));var _0xfd8c=function(_0x24a015,_0x475a63){_0x24a015=_0x24a015-0x0;var _0x4af2cb=_0xd8cf[_0x24a015];return _0x4af2cb;};'use strict';var EventEmitter=require(_0xfd8c('0x0'));var Team=require(_0xfd8c('0x1'))['db'][_0xfd8c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xfd8c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd8c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ccf4c){return function(_0x25d331,_0x174959,_0x5d3bd5){TeamEvents[_0xfd8c('0x5')](_0x1ccf4c+':'+_0x25d331['id'],_0x25d331);TeamEvents['emit'](_0x1ccf4c,_0x25d331);_0x5d3bd5(null);};}for(var e in events){if(events[_0xfd8c('0x6')](e)){var event=events[e];Team[_0xfd8c('0x7')](e,emitEvent(event));}}module[_0xfd8c('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 b468179..3bb75c0 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 _0xb439=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','define','teams','lodash','util'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xb439,0x132));var _0x9b43=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb439[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x9b43('0x0'));var util=require(_0x9b43('0x1'));var logger=require(_0x9b43('0x2'))('api');var moment=require(_0x9b43('0x3'));var BPromise=require(_0x9b43('0x4'));var rp=require(_0x9b43('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b43('0x6'));var config=require(_0x9b43('0x7'));var attributes=require(_0x9b43('0x8'));module['exports']=function(_0x5cc90d,_0x1c0b4a){return _0x5cc90d[_0x9b43('0x9')]('Team',attributes,{'tableName':_0x9b43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x297c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./team.attributes','exports','define','Team','teams'];(function(_0x271b9c,_0x395006){var _0x272677=function(_0x2a1f1c){while(--_0x2a1f1c){_0x271b9c['push'](_0x271b9c['shift']());}};_0x272677(++_0x395006);}(_0x297c,0xf7));var _0xc297=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x297c[_0x46361e];return _0x14e302;};'use strict';var _=require(_0xc297('0x0'));var util=require(_0xc297('0x1'));var logger=require('../../config/logger')(_0xc297('0x2'));var moment=require(_0xc297('0x3'));var BPromise=require(_0xc297('0x4'));var rp=require(_0xc297('0x5'));var fs=require('fs');var path=require(_0xc297('0x6'));var rimraf=require(_0xc297('0x7'));var config=require('../../config/environment');var attributes=require(_0xc297('0x8'));module[_0xc297('0x9')]=function(_0x2b3b36,_0x51256e){return _0x2b3b36[_0xc297('0xa')](_0xc297('0xb'),attributes,{'tableName':_0xc297('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 2d41f0c..a8068b5 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 _0x3e00=['client','http','defaults','redis','socket.io-emitter','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x396e83,_0x2d51e2){var _0x4a42cc=function(_0x415496){while(--_0x415496){_0x396e83['push'](_0x396e83['shift']());}};_0x4a42cc(++_0x2d51e2);}(_0x3e00,0xe7));var _0x03e0=function(_0x24be21,_0xd8d7d6){_0x24be21=_0x24be21-0x0;var _0x163ba8=_0x3e00[_0x24be21];return _0x163ba8;};'use strict';var _=require('lodash');var util=require(_0x03e0('0x0'));var moment=require(_0x03e0('0x1'));var BPromise=require(_0x03e0('0x2'));var rs=require(_0x03e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03e0('0x4'))['db'];var utils=require(_0x03e0('0x5'));var logger=require(_0x03e0('0x6'))(_0x03e0('0x7'));var config=require(_0x03e0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x03e0('0x9')][_0x03e0('0xa')]({'port':0x232a});config['redis']=_[_0x03e0('0xb')](config[_0x03e0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x03e0('0xd'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x10c63b,_0x3dba43,_0x4da476){return new BPromise(function(_0x5ca175,_0x63789){return client['request'](_0x10c63b,_0x4da476)['then'](function(_0x555955){logger[_0x03e0('0xe')](_0x03e0('0xf'),_0x3dba43,_0x03e0('0x10'));logger['debug'](_0x03e0('0x11'),_0x3dba43,'request\x20sent',JSON[_0x03e0('0x12')](_0x555955));if(_0x555955[_0x03e0('0x13')]){if(_0x555955['error'][_0x03e0('0x14')]===0x1f4){logger[_0x03e0('0x13')]('Team,\x20%s,\x20%s',_0x3dba43,_0x555955[_0x03e0('0x13')][_0x03e0('0x15')]);return _0x63789(_0x555955[_0x03e0('0x13')][_0x03e0('0x15')]);}logger['error']('Team,\x20%s,\x20%s',_0x3dba43,_0x555955[_0x03e0('0x13')][_0x03e0('0x15')]);return _0x5ca175(_0x555955['error'][_0x03e0('0x15')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x3dba43,_0x03e0('0x10'));_0x5ca175(_0x555955[_0x03e0('0x16')]['message']);}})[_0x03e0('0x17')](function(_0xe67cc1){logger[_0x03e0('0x13')]('Team,\x20%s,\x20%s',_0x3dba43,_0xe67cc1);_0x63789(_0xe67cc1);});});} \ No newline at end of file +var _0xac8a=['register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xf96c59,_0x4a1f47){var _0x7cf1c4=function(_0x249c5b){while(--_0x249c5b){_0xf96c59['push'](_0xf96c59['shift']());}};_0x7cf1c4(++_0x4a1f47);}(_0xac8a,0x1f2));var _0xaac8=function(_0x11f404,_0x434321){_0x11f404=_0x11f404-0x0;var _0x493d6a=_0xac8a[_0x11f404];return _0x493d6a;};'use strict';var _=require(_0xaac8('0x0'));var util=require(_0xaac8('0x1'));var moment=require('moment');var BPromise=require(_0xaac8('0x2'));var rs=require(_0xaac8('0x3'));var fs=require('fs');var Redis=require(_0xaac8('0x4'));var db=require(_0xaac8('0x5'))['db'];var utils=require(_0xaac8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xaac8('0x7'));var jayson=require(_0xaac8('0x8'));var client=jayson[_0xaac8('0x9')][_0xaac8('0xa')]({'port':0x232a});config[_0xaac8('0xb')]=_[_0xaac8('0xc')](config[_0xaac8('0xb')],{'host':_0xaac8('0xd'),'port':0x18eb});var socket=require(_0xaac8('0xe'))(new Redis(config[_0xaac8('0xb')]));require('./team.socket')[_0xaac8('0xf')](socket);function respondWithRpcPromise(_0x374bec,_0x5e0f56,_0xabac48){return new BPromise(function(_0x4ef35c,_0x1d2eec){return client['request'](_0x374bec,_0xabac48)[_0xaac8('0x10')](function(_0x1e72da){logger[_0xaac8('0x11')](_0xaac8('0x12'),_0x5e0f56,_0xaac8('0x13'));logger[_0xaac8('0x14')](_0xaac8('0x15'),_0x5e0f56,_0xaac8('0x13'),JSON[_0xaac8('0x16')](_0x1e72da));if(_0x1e72da['error']){if(_0x1e72da[_0xaac8('0x17')]['code']===0x1f4){logger[_0xaac8('0x17')](_0xaac8('0x12'),_0x5e0f56,_0x1e72da['error'][_0xaac8('0x18')]);return _0x1d2eec(_0x1e72da['error'][_0xaac8('0x18')]);}logger['error'](_0xaac8('0x12'),_0x5e0f56,_0x1e72da['error']['message']);return _0x4ef35c(_0x1e72da[_0xaac8('0x17')][_0xaac8('0x18')]);}else{logger[_0xaac8('0x11')](_0xaac8('0x12'),_0x5e0f56,_0xaac8('0x13'));_0x4ef35c(_0x1e72da[_0xaac8('0x19')][_0xaac8('0x18')]);}})[_0xaac8('0x1a')](function(_0x3790fe){logger[_0xaac8('0x17')]('Team,\x20%s,\x20%s',_0x5e0f56,_0x3790fe);_0x1d2eec(_0x3790fe);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 89025f9..e85035a 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 _0x1d6a=['save','remove','update','emit','removeListener','register','length','team:'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x1d6a,0x190));var _0xa1d6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1d6a[_0x4b369d];return _0x571a98;};'use strict';var TeamEvents=require('./team.events');var events=[_0xa1d6('0x0'),_0xa1d6('0x1'),_0xa1d6('0x2')];function createListener(_0x5f1e9d,_0x26e3cb){return function(_0x5368d5){_0x26e3cb[_0xa1d6('0x3')](_0x5f1e9d,_0x5368d5);};}function removeListener(_0x40c58f,_0x4c4317){return function(){TeamEvents[_0xa1d6('0x4')](_0x40c58f,_0x4c4317);};}exports[_0xa1d6('0x5')]=function(_0x3eb7ca){for(var _0x5be9ff=0x0,_0x1452e7=events[_0xa1d6('0x6')];_0x5be9ff<_0x1452e7;_0x5be9ff++){var _0x5833e4=events[_0x5be9ff];var _0x4678f9=createListener(_0xa1d6('0x7')+_0x5833e4,_0x3eb7ca);TeamEvents['on'](_0x5833e4,_0x4678f9);}}; \ No newline at end of file +var _0x0373=['length','team:','./team.events','save','remove','update','removeListener','register'];(function(_0x53eba1,_0xcb4654){var _0x245822=function(_0x2a5622){while(--_0x2a5622){_0x53eba1['push'](_0x53eba1['shift']());}};_0x245822(++_0xcb4654);}(_0x0373,0x1c2));var _0x3037=function(_0x2bd0f3,_0x259957){_0x2bd0f3=_0x2bd0f3-0x0;var _0x1aad5a=_0x0373[_0x2bd0f3];return _0x1aad5a;};'use strict';var TeamEvents=require(_0x3037('0x0'));var events=[_0x3037('0x1'),_0x3037('0x2'),_0x3037('0x3')];function createListener(_0x624627,_0x3d86ba){return function(_0x3c74e7){_0x3d86ba['emit'](_0x624627,_0x3c74e7);};}function removeListener(_0x4b446c,_0x230b65){return function(){TeamEvents[_0x3037('0x4')](_0x4b446c,_0x230b65);};}exports[_0x3037('0x5')]=function(_0xb3e176){for(var _0x59fdcf=0x0,_0x1795c8=events[_0x3037('0x6')];_0x59fdcf<_0x1795c8;_0x59fdcf++){var _0x170fb5=events[_0x59fdcf];var _0x133da9=createListener(_0x3037('0x7')+_0x170fb5,_0xb3e176);TeamEvents['on'](_0x170fb5,_0x133da9);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index e09b692..ffa7e81 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1d0948,_0x29a5ad){var _0x405614=function(_0x1ac2af){while(--_0x1ac2af){_0x1d0948['push'](_0x1d0948['shift']());}};_0x405614(++_0x29a5ad);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x18e582,_0x10b50c){var _0x2f4188=function(_0x2c47d7){while(--_0x2c47d7){_0x18e582['push'](_0x18e582['shift']());}};_0x2f4188(++_0x10b50c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 0e8c466..730e2cf 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 _0x9a28=['exports','INTEGER','sequelize'];(function(_0x2d5d2a,_0x3b82fc){var _0x2bbcd7=function(_0x4ff25f){while(--_0x4ff25f){_0x2d5d2a['push'](_0x2d5d2a['shift']());}};_0x2bbcd7(++_0x3b82fc);}(_0x9a28,0x1bb));var _0x89a2=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x9a28[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0x89a2('0x0'));module[_0x89a2('0x1')]={'penalty':{'type':Sequelize[_0x89a2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7881=['INTEGER','exports'];(function(_0x2592a2,_0x2c0214){var _0x208d3f=function(_0x3a4eb6){while(--_0x3a4eb6){_0x2592a2['push'](_0x2592a2['shift']());}};_0x208d3f(++_0x2c0214);}(_0x7881,0x69));var _0x1788=function(_0x3bdb71,_0x4b45ff){_0x3bdb71=_0x3bdb71-0x0;var _0x1a9682=_0x7881[_0x3bdb71];return _0x1a9682;};'use strict';var Sequelize=require('sequelize');module[_0x1788('0x0')]={'penalty':{'type':Sequelize[_0x1788('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 9490ded..1743281 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 _0xd2ea=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xd2ea,0x15f));var _0xad2e=function(_0x19d625,_0x8a96e5){_0x19d625=_0x19d625-0x0;var _0x28807b=_0xd2ea[_0x19d625];return _0x28807b;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d0b=['../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4f7624,_0x4a883e){var _0x5bdefe=function(_0x2512be){while(--_0x2512be){_0x4f7624['push'](_0x4f7624['shift']());}};_0x5bdefe(++_0x4a883e);}(_0x6d0b,0x71));var _0xb6d0=function(_0x456724,_0x3f055f){_0x456724=_0x456724-0x0;var _0xf34397=_0x6d0b[_0x456724];return _0xf34397;};'use strict';var _=require(_0xb6d0('0x0'));var util=require('util');var logger=require(_0xb6d0('0x1'))('api');var moment=require(_0xb6d0('0x2'));var BPromise=require(_0xb6d0('0x3'));var rp=require(_0xb6d0('0x4'));var fs=require('fs');var path=require(_0xb6d0('0x5'));var rimraf=require(_0xb6d0('0x6'));var config=require(_0xb6d0('0x7'));var attributes=require(_0xb6d0('0x8'));module['exports']=function(_0x35142b,_0x3612ac){return _0x35142b[_0xb6d0('0x9')](_0xb6d0('0xa'),attributes,{'tableName':_0xb6d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 8e5068a..64d266e 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 _0xd90e=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x15ac06,_0x35d91f){var _0x54eec8=function(_0x451322){while(--_0x451322){_0x15ac06['push'](_0x15ac06['shift']());}};_0x54eec8(++_0x35d91f);}(_0xd90e,0x17c));var _0xed90=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd90e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xed90('0x0'));var util=require('util');var moment=require(_0xed90('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed90('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xed90('0x3'));var logger=require(_0xed90('0x4'))(_0xed90('0x5'));var config=require(_0xed90('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xed90('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12fbf8,_0x34c10f,_0x1df44e){return new BPromise(function(_0x2f917b,_0x25987d){return client['request'](_0x12fbf8,_0x1df44e)['then'](function(_0x7c9e1f){logger['info'](_0xed90('0x8'),_0x34c10f,_0xed90('0x9'));logger[_0xed90('0xa')](_0xed90('0xb'),_0x34c10f,'request\x20sent',JSON[_0xed90('0xc')](_0x7c9e1f));if(_0x7c9e1f['error']){if(_0x7c9e1f[_0xed90('0xd')][_0xed90('0xe')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x34c10f,_0x7c9e1f[_0xed90('0xd')][_0xed90('0xf')]);return _0x25987d(_0x7c9e1f['error'][_0xed90('0xf')]);}logger[_0xed90('0xd')](_0xed90('0x8'),_0x34c10f,_0x7c9e1f[_0xed90('0xd')][_0xed90('0xf')]);return _0x2f917b(_0x7c9e1f[_0xed90('0xd')][_0xed90('0xf')]);}else{logger['info'](_0xed90('0x8'),_0x34c10f,_0xed90('0x9'));_0x2f917b(_0x7c9e1f['result']['message']);}})[_0xed90('0x10')](function(_0xa87e97){logger['error'](_0xed90('0x8'),_0x34c10f,_0xa87e97);_0x25987d(_0xa87e97);});});} \ No newline at end of file +var _0xaaea=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x16e30d,_0x1ea416){var _0x679a8a=function(_0x33e5aa){while(--_0x33e5aa){_0x16e30d['push'](_0x16e30d['shift']());}};_0x679a8a(++_0x1ea416);}(_0xaaea,0x183));var _0xaaae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaaea[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xaaae('0x0'));var moment=require('moment');var BPromise=require(_0xaaae('0x1'));var rs=require(_0xaaae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaaae('0x3'));var logger=require(_0xaaae('0x4'))(_0xaaae('0x5'));var config=require(_0xaaae('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaaae('0x7')][_0xaaae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c2b87,_0x329b32,_0x5298d9){return new BPromise(function(_0x341e14,_0x1bb949){return client['request'](_0x2c2b87,_0x5298d9)[_0xaaae('0x9')](function(_0x3a1c61){logger['info'](_0xaaae('0xa'),_0x329b32,_0xaaae('0xb'));logger[_0xaaae('0xc')](_0xaaae('0xd'),_0x329b32,_0xaaae('0xb'),JSON[_0xaaae('0xe')](_0x3a1c61));if(_0x3a1c61[_0xaaae('0xf')]){if(_0x3a1c61[_0xaaae('0xf')][_0xaaae('0x10')]===0x1f4){logger[_0xaaae('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x329b32,_0x3a1c61[_0xaaae('0xf')]['message']);return _0x1bb949(_0x3a1c61[_0xaaae('0xf')][_0xaaae('0x11')]);}logger[_0xaaae('0xf')](_0xaaae('0xa'),_0x329b32,_0x3a1c61[_0xaaae('0xf')]['message']);return _0x341e14(_0x3a1c61['error']['message']);}else{logger['info'](_0xaaae('0xa'),_0x329b32,_0xaaae('0xb'));_0x341e14(_0x3a1c61[_0xaaae('0x12')][_0xaaae('0x11')]);}})[_0xaaae('0x13')](function(_0x2a72d2){logger[_0xaaae('0xf')](_0xaaae('0xa'),_0x329b32,_0x2a72d2);_0x1bb949(_0x2a72d2);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 775fcd2..17dc26f 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 _0x75b6=['../../components/interaction/service','../../config/environment','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4aeaf9,_0x9b70aa){var _0x168966=function(_0x3cb2bc){while(--_0x3cb2bc){_0x4aeaf9['push'](_0x4aeaf9['shift']());}};_0x168966(++_0x9b70aa);}(_0x75b6,0x1a4));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x675b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x675b('0x1'));var express=require(_0x675b('0x2'));var router=express[_0x675b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x675b('0x4'));var interaction=require(_0x675b('0x5'));var config=require(_0x675b('0x6'));var controller=require('./template.controller');router[_0x675b('0x7')]('/',auth['isAuthenticated'](),controller[_0x675b('0x8')]);router[_0x675b('0x7')](_0x675b('0x9'),auth['isAuthenticated'](),controller[_0x675b('0xa')]);router['post']('/',auth[_0x675b('0xb')](),controller[_0x675b('0xc')]);router[_0x675b('0xd')](_0x675b('0x9'),auth[_0x675b('0xb')](),controller[_0x675b('0xe')]);router[_0x675b('0xf')](_0x675b('0x9'),auth[_0x675b('0xb')](),controller[_0x675b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5a43=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5a43,0xf1));var _0x35a4=function(_0x3afec9,_0x5a4cc7){_0x3afec9=_0x3afec9-0x0;var _0x5602fa=_0x5a43[_0x3afec9];return _0x5602fa;};'use strict';var multer=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var path=require(_0x35a4('0x2'));var timeout=require(_0x35a4('0x3'));var express=require(_0x35a4('0x4'));var router=express[_0x35a4('0x5')]();var fs_extra=require(_0x35a4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./template.controller');router[_0x35a4('0x7')]('/',auth[_0x35a4('0x8')](),controller[_0x35a4('0x9')]);router[_0x35a4('0x7')](_0x35a4('0xa'),auth[_0x35a4('0x8')](),controller['show']);router[_0x35a4('0xb')]('/',auth[_0x35a4('0x8')](),controller[_0x35a4('0xc')]);router[_0x35a4('0xd')](_0x35a4('0xa'),auth[_0x35a4('0x8')](),controller['update']);router['delete']('/:id',auth[_0x35a4('0x8')](),controller['destroy']);module[_0x35a4('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c27e420..692b59c 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 _0x507b=['STRING','TEXT','sequelize','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x507b,0x92));var _0xb507=function(_0x185d4c,_0x207603){_0x185d4c=_0x185d4c-0x0;var _0x293f37=_0x507b[_0x185d4c];return _0x293f37;};'use strict';var Sequelize=require(_0xb507('0x0'));module[_0xb507('0x1')]={'name':{'type':Sequelize[_0xb507('0x2')]},'description':{'type':Sequelize[_0xb507('0x2')]},'html':{'type':Sequelize[_0xb507('0x3')]}}; \ No newline at end of file +var _0xd6f3=['STRING','sequelize','exports'];(function(_0x185f1e,_0x187fba){var _0x2fde15=function(_0x427093){while(--_0x427093){_0x185f1e['push'](_0x185f1e['shift']());}};_0x2fde15(++_0x187fba);}(_0xd6f3,0x163));var _0x3d6f=function(_0x5cedf4,_0x495890){_0x5cedf4=_0x5cedf4-0x0;var _0x269861=_0xd6f3[_0x5cedf4];return _0x269861;};'use strict';var Sequelize=require(_0x3d6f('0x0'));module[_0x3d6f('0x1')]={'name':{'type':Sequelize[_0x3d6f('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 28e6593..b6433c9 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 _0x9494=['key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','rawAttributes','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','get','sendStatus','error','name','send','index','map','Template','fieldName','type'];(function(_0x5072f2,_0x125bca){var _0xc0e70d=function(_0x466480){while(--_0x466480){_0x5072f2['push'](_0x5072f2['shift']());}};_0xc0e70d(++_0x125bca);}(_0x9494,0x1c0));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4949('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4949('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4949('0x2'));var moment=require('moment');var BPromise=require(_0x4949('0x3'));var Mustache=require(_0x4949('0x4'));var util=require(_0x4949('0x5'));var path=require(_0x4949('0x6'));var sox=require(_0x4949('0x7'));var csv=require(_0x4949('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4949('0x9'));var _=require(_0x4949('0xa'));var squel=require(_0x4949('0xb'));var crypto=require(_0x4949('0xc'));var jsforce=require(_0x4949('0xd'));var deskjs=require(_0x4949('0xe'));var toCsv=require(_0x4949('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4949('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4949('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4949('0x11'))(_0x4949('0x12'));var utils=require('../../config/utils');var config=require(_0x4949('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4949('0x14'))['db'];function respondWithStatusCode(_0x62c587,_0x3f7ceb){_0x3f7ceb=_0x3f7ceb||0xcc;return function(_0x1e3a06){if(_0x1e3a06){return _0x62c587['sendStatus'](_0x3f7ceb);}return _0x62c587['status'](_0x3f7ceb)[_0x4949('0x15')]();};}function respondWithResult(_0x378369,_0x5a7e04){_0x5a7e04=_0x5a7e04||0xc8;return function(_0x46e3cf){if(_0x46e3cf){return _0x378369[_0x4949('0x16')](_0x5a7e04)[_0x4949('0x17')](_0x46e3cf);}};}function respondWithFilteredResult(_0x51559a,_0x30ae43){return function(_0x49cdd8){if(_0x49cdd8){var _0x3e3149=typeof _0x30ae43[_0x4949('0x18')]===_0x4949('0x19')&&typeof _0x30ae43[_0x4949('0x1a')]===_0x4949('0x19');var _0x2dc271=_0x49cdd8['count'];var _0x9c0ad8=_0x3e3149?0x0:_0x30ae43[_0x4949('0x18')];var _0x5cd014=_0x3e3149?_0x49cdd8[_0x4949('0x1b')]:_0x30ae43['offset']+_0x30ae43[_0x4949('0x1a')];var _0x525283;if(_0x5cd014>=_0x2dc271){_0x5cd014=_0x2dc271;_0x525283=0xc8;}else{_0x525283=0xce;}_0x51559a[_0x4949('0x16')](_0x525283);return _0x51559a[_0x4949('0x1c')](_0x4949('0x1d'),_0x9c0ad8+'-'+_0x5cd014+'/'+_0x2dc271)[_0x4949('0x17')](_0x49cdd8);}return null;};}function patchUpdates(_0x114511){return function(_0x8416f7){try{jsonpatch['apply'](_0x8416f7,_0x114511,!![]);}catch(_0x44c681){return BPromise['reject'](_0x44c681);}return _0x8416f7[_0x4949('0x1e')]();};}function saveUpdates(_0x21734e,_0x2ec56e){return function(_0x58aca7){if(_0x58aca7){return _0x58aca7[_0x4949('0x1f')](_0x21734e)['then'](function(_0x113325){return _0x113325;});}return null;};}function removeEntity(_0x2ffc49,_0x225812){return function(_0x3c9186){if(_0x3c9186){return _0x3c9186[_0x4949('0x20')]()[_0x4949('0x21')](function(){var _0x1a7a81=_0x3c9186[_0x4949('0x22')]({'plain':!![]});var _0x3dbdf1='Templates';return db['UserProfileResource'][_0x4949('0x20')]({'where':{'type':_0x3dbdf1,'resourceId':_0x1a7a81['id']}})[_0x4949('0x21')](function(){return _0x3c9186;});})[_0x4949('0x21')](function(){_0x2ffc49[_0x4949('0x16')](0xcc)[_0x4949('0x15')]();});}};}function handleEntityNotFound(_0x2d7e29,_0x1c518e){return function(_0x474c54){if(!_0x474c54){_0x2d7e29[_0x4949('0x23')](0x194);}return _0x474c54;};}function handleError(_0x29acf9,_0x425bf8){_0x425bf8=_0x425bf8||0x1f4;return function(_0x24b6a6){logger[_0x4949('0x24')](_0x24b6a6['stack']);if(_0x24b6a6[_0x4949('0x25')]){delete _0x24b6a6[_0x4949('0x25')];}_0x29acf9[_0x4949('0x16')](_0x425bf8)[_0x4949('0x26')](_0x24b6a6);};}exports[_0x4949('0x27')]=function(_0x299c41,_0x5d4bfe){var _0x70abbb={},_0x3c96b5={},_0x2ca29d={'count':0x0,'rows':[]};var _0x5b86a6=_[_0x4949('0x28')](db[_0x4949('0x29')]['rawAttributes'],function(_0x3ce115){return{'name':_0x3ce115[_0x4949('0x2a')],'type':_0x3ce115[_0x4949('0x2b')][_0x4949('0x2c')]};});_0x3c96b5[_0x4949('0x2d')]=_[_0x4949('0x28')](_0x5b86a6,'name');_0x3c96b5[_0x4949('0x2e')]=_[_0x4949('0x2f')](_0x299c41[_0x4949('0x2e')]);_0x3c96b5[_0x4949('0x30')]=_['intersection'](_0x3c96b5['model'],_0x3c96b5[_0x4949('0x2e')]);_0x70abbb[_0x4949('0x31')]=_[_0x4949('0x32')](_0x3c96b5[_0x4949('0x2d')],qs['fields'](_0x299c41['query']['fields']));_0x70abbb[_0x4949('0x31')]=_0x70abbb[_0x4949('0x31')]['length']?_0x70abbb['attributes']:_0x3c96b5[_0x4949('0x2d')];if(!_0x299c41[_0x4949('0x2e')][_0x4949('0x33')](_0x4949('0x34'))){_0x70abbb[_0x4949('0x1a')]=qs['limit'](_0x299c41[_0x4949('0x2e')][_0x4949('0x1a')]);_0x70abbb[_0x4949('0x18')]=qs[_0x4949('0x18')](_0x299c41[_0x4949('0x2e')][_0x4949('0x18')]);}_0x70abbb[_0x4949('0x35')]=qs[_0x4949('0x36')](_0x299c41['query'][_0x4949('0x36')]);_0x70abbb[_0x4949('0x37')]=qs['filters'](_[_0x4949('0x38')](_0x299c41['query'],_0x3c96b5[_0x4949('0x30')]),_0x5b86a6);if(_0x299c41[_0x4949('0x2e')][_0x4949('0x39')]){_0x70abbb[_0x4949('0x37')]=_['merge'](_0x70abbb['where'],{'$or':_[_0x4949('0x28')](_0x5b86a6,function(_0x2670b8){if(_0x2670b8[_0x4949('0x2b')]!==_0x4949('0x3a')){var _0x32fec3={};_0x32fec3[_0x2670b8[_0x4949('0x25')]]={'$like':'%'+_0x299c41[_0x4949('0x2e')][_0x4949('0x39')]+'%'};return _0x32fec3;}})});}_0x70abbb=_[_0x4949('0x3b')]({},_0x70abbb,_0x299c41[_0x4949('0x3c')]);var _0xff77a5={'where':_0x70abbb[_0x4949('0x37')]};return db[_0x4949('0x29')][_0x4949('0x1b')](_0xff77a5)[_0x4949('0x21')](function(_0x15874d){_0x2ca29d['count']=_0x15874d;if(_0x299c41[_0x4949('0x2e')]['includeAll']){_0x70abbb[_0x4949('0x3d')]=[{'all':!![]}];}return db[_0x4949('0x29')][_0x4949('0x3e')](_0x70abbb);})['then'](function(_0x6f177a){_0x2ca29d[_0x4949('0x3f')]=_0x6f177a;return _0x2ca29d;})['then'](respondWithFilteredResult(_0x5d4bfe,_0x70abbb))[_0x4949('0x40')](handleError(_0x5d4bfe,null));};exports['show']=function(_0x492d97,_0x5d6f8b){var _0x495339={'raw':!![],'where':{'id':_0x492d97[_0x4949('0x41')]['id']}},_0x1f05c4={};_0x1f05c4[_0x4949('0x2d')]=_['keys'](db['Template'][_0x4949('0x42')]);_0x1f05c4[_0x4949('0x2e')]=_[_0x4949('0x2f')](_0x492d97[_0x4949('0x2e')]);_0x1f05c4['filters']=_[_0x4949('0x32')](_0x1f05c4[_0x4949('0x2d')],_0x1f05c4[_0x4949('0x2e')]);_0x495339[_0x4949('0x31')]=_[_0x4949('0x32')](_0x1f05c4[_0x4949('0x2d')],qs[_0x4949('0x43')](_0x492d97[_0x4949('0x2e')][_0x4949('0x43')]));_0x495339['attributes']=_0x495339[_0x4949('0x31')][_0x4949('0x44')]?_0x495339[_0x4949('0x31')]:_0x1f05c4[_0x4949('0x2d')];if(_0x492d97[_0x4949('0x2e')][_0x4949('0x45')]){_0x495339['include']=[{'all':!![]}];}_0x495339=_[_0x4949('0x3b')]({},_0x495339,_0x492d97[_0x4949('0x3c')]);return db['Template'][_0x4949('0x46')](_0x495339)[_0x4949('0x21')](handleEntityNotFound(_0x5d6f8b,null))[_0x4949('0x21')](respondWithResult(_0x5d6f8b,null))['catch'](handleError(_0x5d6f8b,null));};exports[_0x4949('0x47')]=function(_0x4eae8e,_0x503f04){return db['Template'][_0x4949('0x47')](_0x4eae8e[_0x4949('0x48')],{})[_0x4949('0x21')](function(_0x1b6dc1){var _0x5c18da=_0x4eae8e[_0x4949('0x49')][_0x4949('0x22')]({'plain':!![]});if(!_0x5c18da)throw new Error(_0x4949('0x4a'));if(_0x5c18da[_0x4949('0x4b')]==='user'){var _0x108387=_0x1b6dc1[_0x4949('0x22')]({'plain':!![]});var _0x150b5b=_0x4949('0x4c');return db[_0x4949('0x4d')]['find']({'where':{'name':_0x150b5b,'userProfileId':_0x5c18da[_0x4949('0x4e')]},'raw':!![]})['then'](function(_0x524eca){if(_0x524eca&&_0x524eca[_0x4949('0x4f')]===0x0){return db[_0x4949('0x50')]['create']({'name':_0x108387[_0x4949('0x25')],'resourceId':_0x108387['id'],'type':_0x524eca[_0x4949('0x25')],'sectionId':_0x524eca['id']},{})['then'](function(){return _0x1b6dc1;});}else{return _0x1b6dc1;}})[_0x4949('0x40')](function(_0x2c9478){logger[_0x4949('0x24')](_0x4949('0x51'),_0x2c9478);throw _0x2c9478;});}return _0x1b6dc1;})[_0x4949('0x21')](respondWithResult(_0x503f04,0xc9))[_0x4949('0x40')](handleError(_0x503f04,null));};exports[_0x4949('0x1f')]=function(_0x470715,_0x5e1e15){if(_0x470715['body']['id']){delete _0x470715[_0x4949('0x48')]['id'];}return db['Template']['find']({'where':{'id':_0x470715[_0x4949('0x41')]['id']}})[_0x4949('0x21')](handleEntityNotFound(_0x5e1e15,null))[_0x4949('0x21')](saveUpdates(_0x470715[_0x4949('0x48')],null))[_0x4949('0x21')](respondWithResult(_0x5e1e15,null))[_0x4949('0x40')](handleError(_0x5e1e15,null));};exports[_0x4949('0x20')]=function(_0x100da5,_0x39a066){return db[_0x4949('0x29')][_0x4949('0x46')]({'where':{'id':_0x100da5[_0x4949('0x41')]['id']}})[_0x4949('0x21')](handleEntityNotFound(_0x39a066,null))[_0x4949('0x21')](removeEntity(_0x39a066,null))[_0x4949('0x40')](handleError(_0x39a066,null));}; \ No newline at end of file +var _0x3b37=['update','then','destroy','error','stack','name','index','map','Template','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','type','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','save'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x3b37,0x120));var _0x73b3=function(_0x46fc24,_0x5c0cf4){_0x46fc24=_0x46fc24-0x0;var _0x13327b=_0x3b37[_0x46fc24];return _0x13327b;};'use strict';var emlformat=require(_0x73b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73b3('0x1'));var jsonpatch=require(_0x73b3('0x2'));var rp=require(_0x73b3('0x3'));var moment=require(_0x73b3('0x4'));var BPromise=require(_0x73b3('0x5'));var Mustache=require(_0x73b3('0x6'));var util=require(_0x73b3('0x7'));var path=require(_0x73b3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x73b3('0x9'));var fs=require('fs');var fs_extra=require(_0x73b3('0xa'));var _=require('lodash');var squel=require(_0x73b3('0xb'));var crypto=require(_0x73b3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x73b3('0xd'));var toCsv=require(_0x73b3('0xe'));var querystring=require(_0x73b3('0xf'));var Papa=require('papaparse');var Redis=require(_0x73b3('0x10'));var authService=require(_0x73b3('0x11'));var qs=require(_0x73b3('0x12'));var as=require(_0x73b3('0x13'));var hardwareService=require(_0x73b3('0x14'));var logger=require(_0x73b3('0x15'))(_0x73b3('0x16'));var utils=require('../../config/utils');var config=require(_0x73b3('0x17'));var licenseUtil=require(_0x73b3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x240602,_0x46e158){_0x46e158=_0x46e158||0xcc;return function(_0x55477f){if(_0x55477f){return _0x240602[_0x73b3('0x19')](_0x46e158);}return _0x240602[_0x73b3('0x1a')](_0x46e158)[_0x73b3('0x1b')]();};}function respondWithResult(_0x558d59,_0x51a93e){_0x51a93e=_0x51a93e||0xc8;return function(_0x53848b){if(_0x53848b){return _0x558d59['status'](_0x51a93e)['json'](_0x53848b);}};}function respondWithFilteredResult(_0x555db1,_0x5c9b0f){return function(_0x53d523){if(_0x53d523){var _0x11318b=typeof _0x5c9b0f['offset']===_0x73b3('0x1c')&&typeof _0x5c9b0f['limit']===_0x73b3('0x1c');var _0x1c5bae=_0x53d523[_0x73b3('0x1d')];var _0x3cfc73=_0x11318b?0x0:_0x5c9b0f[_0x73b3('0x1e')];var _0x50edfe=_0x11318b?_0x53d523['count']:_0x5c9b0f[_0x73b3('0x1e')]+_0x5c9b0f[_0x73b3('0x1f')];var _0x53f4de;if(_0x50edfe>=_0x1c5bae){_0x50edfe=_0x1c5bae;_0x53f4de=0xc8;}else{_0x53f4de=0xce;}_0x555db1[_0x73b3('0x1a')](_0x53f4de);return _0x555db1[_0x73b3('0x20')](_0x73b3('0x21'),_0x3cfc73+'-'+_0x50edfe+'/'+_0x1c5bae)[_0x73b3('0x22')](_0x53d523);}return null;};}function patchUpdates(_0x4f3c5f){return function(_0xca10ff){try{jsonpatch['apply'](_0xca10ff,_0x4f3c5f,!![]);}catch(_0x317ab1){return BPromise['reject'](_0x317ab1);}return _0xca10ff[_0x73b3('0x23')]();};}function saveUpdates(_0x3f0d84,_0x4f8de7){return function(_0x2fe942){if(_0x2fe942){return _0x2fe942[_0x73b3('0x24')](_0x3f0d84)[_0x73b3('0x25')](function(_0x36324a){return _0x36324a;});}return null;};}function removeEntity(_0x1c5e50,_0x3f15bb){return function(_0x48f3ef){if(_0x48f3ef){return _0x48f3ef[_0x73b3('0x26')]()[_0x73b3('0x25')](function(){var _0x47ae64=_0x48f3ef['get']({'plain':!![]});var _0x50fb36='Templates';return db['UserProfileResource'][_0x73b3('0x26')]({'where':{'type':_0x50fb36,'resourceId':_0x47ae64['id']}})[_0x73b3('0x25')](function(){return _0x48f3ef;});})[_0x73b3('0x25')](function(){_0x1c5e50[_0x73b3('0x1a')](0xcc)[_0x73b3('0x1b')]();});}};}function handleEntityNotFound(_0x3bffc2,_0x1e9986){return function(_0x560de4){if(!_0x560de4){_0x3bffc2[_0x73b3('0x19')](0x194);}return _0x560de4;};}function handleError(_0x62167,_0x2f9874){_0x2f9874=_0x2f9874||0x1f4;return function(_0xbd9cb9){logger[_0x73b3('0x27')](_0xbd9cb9[_0x73b3('0x28')]);if(_0xbd9cb9['name']){delete _0xbd9cb9[_0x73b3('0x29')];}_0x62167[_0x73b3('0x1a')](_0x2f9874)['send'](_0xbd9cb9);};}exports[_0x73b3('0x2a')]=function(_0x1120d2,_0x45100b){var _0x3da31b={},_0x4f8b13={},_0x18ec27={'count':0x0,'rows':[]};var _0x4b1a9d=_[_0x73b3('0x2b')](db[_0x73b3('0x2c')][_0x73b3('0x2d')],function(_0x1d8a76){return{'name':_0x1d8a76['fieldName'],'type':_0x1d8a76['type'][_0x73b3('0x2e')]};});_0x4f8b13[_0x73b3('0x2f')]=_['map'](_0x4b1a9d,'name');_0x4f8b13['query']=_[_0x73b3('0x30')](_0x1120d2[_0x73b3('0x31')]);_0x4f8b13[_0x73b3('0x32')]=_[_0x73b3('0x33')](_0x4f8b13[_0x73b3('0x2f')],_0x4f8b13[_0x73b3('0x31')]);_0x3da31b['attributes']=_[_0x73b3('0x33')](_0x4f8b13[_0x73b3('0x2f')],qs[_0x73b3('0x34')](_0x1120d2['query']['fields']));_0x3da31b[_0x73b3('0x35')]=_0x3da31b['attributes'][_0x73b3('0x36')]?_0x3da31b['attributes']:_0x4f8b13[_0x73b3('0x2f')];if(!_0x1120d2[_0x73b3('0x31')][_0x73b3('0x37')]('nolimit')){_0x3da31b[_0x73b3('0x1f')]=qs[_0x73b3('0x1f')](_0x1120d2[_0x73b3('0x31')][_0x73b3('0x1f')]);_0x3da31b[_0x73b3('0x1e')]=qs[_0x73b3('0x1e')](_0x1120d2['query'][_0x73b3('0x1e')]);}_0x3da31b[_0x73b3('0x38')]=qs[_0x73b3('0x39')](_0x1120d2[_0x73b3('0x31')][_0x73b3('0x39')]);_0x3da31b['where']=qs['filters'](_['pick'](_0x1120d2[_0x73b3('0x31')],_0x4f8b13['filters']),_0x4b1a9d);if(_0x1120d2[_0x73b3('0x31')][_0x73b3('0x3a')]){_0x3da31b[_0x73b3('0x3b')]=_['merge'](_0x3da31b[_0x73b3('0x3b')],{'$or':_['map'](_0x4b1a9d,function(_0x18ac5a){if(_0x18ac5a[_0x73b3('0x3c')]!=='VIRTUAL'){var _0x1e666b={};_0x1e666b[_0x18ac5a['name']]={'$like':'%'+_0x1120d2[_0x73b3('0x31')]['filter']+'%'};return _0x1e666b;}})});}_0x3da31b=_['merge']({},_0x3da31b,_0x1120d2[_0x73b3('0x3d')]);var _0x4d3b69={'where':_0x3da31b[_0x73b3('0x3b')]};return db[_0x73b3('0x2c')][_0x73b3('0x1d')](_0x4d3b69)[_0x73b3('0x25')](function(_0x420f29){_0x18ec27[_0x73b3('0x1d')]=_0x420f29;if(_0x1120d2['query']['includeAll']){_0x3da31b[_0x73b3('0x3e')]=[{'all':!![]}];}return db[_0x73b3('0x2c')][_0x73b3('0x3f')](_0x3da31b);})[_0x73b3('0x25')](function(_0x3f73f6){_0x18ec27[_0x73b3('0x40')]=_0x3f73f6;return _0x18ec27;})[_0x73b3('0x25')](respondWithFilteredResult(_0x45100b,_0x3da31b))[_0x73b3('0x41')](handleError(_0x45100b,null));};exports[_0x73b3('0x42')]=function(_0x45d343,_0x50350d){var _0xfedc04={'raw':!![],'where':{'id':_0x45d343['params']['id']}},_0x52c4b6={};_0x52c4b6[_0x73b3('0x2f')]=_[_0x73b3('0x30')](db[_0x73b3('0x2c')][_0x73b3('0x2d')]);_0x52c4b6[_0x73b3('0x31')]=_['keys'](_0x45d343['query']);_0x52c4b6[_0x73b3('0x32')]=_[_0x73b3('0x33')](_0x52c4b6[_0x73b3('0x2f')],_0x52c4b6[_0x73b3('0x31')]);_0xfedc04[_0x73b3('0x35')]=_[_0x73b3('0x33')](_0x52c4b6['model'],qs[_0x73b3('0x34')](_0x45d343['query']['fields']));_0xfedc04['attributes']=_0xfedc04[_0x73b3('0x35')]['length']?_0xfedc04[_0x73b3('0x35')]:_0x52c4b6[_0x73b3('0x2f')];if(_0x45d343[_0x73b3('0x31')][_0x73b3('0x43')]){_0xfedc04[_0x73b3('0x3e')]=[{'all':!![]}];}_0xfedc04=_['merge']({},_0xfedc04,_0x45d343[_0x73b3('0x3d')]);return db[_0x73b3('0x2c')][_0x73b3('0x44')](_0xfedc04)[_0x73b3('0x25')](handleEntityNotFound(_0x50350d,null))[_0x73b3('0x25')](respondWithResult(_0x50350d,null))[_0x73b3('0x41')](handleError(_0x50350d,null));};exports[_0x73b3('0x45')]=function(_0x311343,_0x2f26e8){return db[_0x73b3('0x2c')][_0x73b3('0x45')](_0x311343[_0x73b3('0x46')],{})[_0x73b3('0x25')](function(_0x500f7e){var _0x173edf=_0x311343[_0x73b3('0x47')][_0x73b3('0x48')]({'plain':!![]});if(!_0x173edf)throw new Error(_0x73b3('0x49'));if(_0x173edf[_0x73b3('0x4a')]===_0x73b3('0x47')){var _0x487b6e=_0x500f7e[_0x73b3('0x48')]({'plain':!![]});var _0x499057=_0x73b3('0x4b');return db[_0x73b3('0x4c')][_0x73b3('0x44')]({'where':{'name':_0x499057,'userProfileId':_0x173edf['userProfileId']},'raw':!![]})['then'](function(_0x57a4c2){if(_0x57a4c2&&_0x57a4c2[_0x73b3('0x4d')]===0x0){return db[_0x73b3('0x4e')]['create']({'name':_0x487b6e[_0x73b3('0x29')],'resourceId':_0x487b6e['id'],'type':_0x57a4c2['name'],'sectionId':_0x57a4c2['id']},{})[_0x73b3('0x25')](function(){return _0x500f7e;});}else{return _0x500f7e;}})[_0x73b3('0x41')](function(_0x5f0fb8){logger[_0x73b3('0x27')](_0x73b3('0x4f'),_0x5f0fb8);throw _0x5f0fb8;});}return _0x500f7e;})[_0x73b3('0x25')](respondWithResult(_0x2f26e8,0xc9))['catch'](handleError(_0x2f26e8,null));};exports['update']=function(_0x287c7e,_0x4db4f4){if(_0x287c7e[_0x73b3('0x46')]['id']){delete _0x287c7e[_0x73b3('0x46')]['id'];}return db[_0x73b3('0x2c')]['find']({'where':{'id':_0x287c7e[_0x73b3('0x50')]['id']}})['then'](handleEntityNotFound(_0x4db4f4,null))[_0x73b3('0x25')](saveUpdates(_0x287c7e['body'],null))['then'](respondWithResult(_0x4db4f4,null))[_0x73b3('0x41')](handleError(_0x4db4f4,null));};exports[_0x73b3('0x26')]=function(_0x55e916,_0x40f2f3){return db[_0x73b3('0x2c')]['find']({'where':{'id':_0x55e916[_0x73b3('0x50')]['id']}})['then'](handleEntityNotFound(_0x40f2f3,null))[_0x73b3('0x25')](removeEntity(_0x40f2f3,null))[_0x73b3('0x41')](handleError(_0x40f2f3,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d845ccc..de23702 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 _0xeaa7=['moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','util','../../config/logger','api'];(function(_0x12c8f3,_0x156300){var _0xbe3bf0=function(_0xffb75c){while(--_0xffb75c){_0x12c8f3['push'](_0x12c8f3['shift']());}};_0xbe3bf0(++_0x156300);}(_0xeaa7,0x141));var _0x7eaa=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0xeaa7[_0x1cd674];return _0x27928f;};'use strict';var _=require('lodash');var util=require(_0x7eaa('0x0'));var logger=require(_0x7eaa('0x1'))(_0x7eaa('0x2'));var moment=require(_0x7eaa('0x3'));var BPromise=require(_0x7eaa('0x4'));var rp=require(_0x7eaa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7eaa('0x6'));var config=require(_0x7eaa('0x7'));var attributes=require(_0x7eaa('0x8'));module[_0x7eaa('0x9')]=function(_0x2c1353,_0x72c572){return _0x2c1353['define'](_0x7eaa('0xa'),attributes,{'tableName':_0x7eaa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1d0=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x32d79f,_0x62176d){var _0x199b7a=function(_0x4e5160){while(--_0x4e5160){_0x32d79f['push'](_0x32d79f['shift']());}};_0x199b7a(++_0x62176d);}(_0xa1d0,0xdd));var _0x0a1d=function(_0x56ba2e,_0x123cb1){_0x56ba2e=_0x56ba2e-0x0;var _0x4a2eb6=_0xa1d0[_0x56ba2e];return _0x4a2eb6;};'use strict';var _=require(_0x0a1d('0x0'));var util=require(_0x0a1d('0x1'));var logger=require(_0x0a1d('0x2'))(_0x0a1d('0x3'));var moment=require(_0x0a1d('0x4'));var BPromise=require(_0x0a1d('0x5'));var rp=require(_0x0a1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a1d('0x7'));var config=require(_0x0a1d('0x8'));var attributes=require(_0x0a1d('0x9'));module[_0x0a1d('0xa')]=function(_0x507569,_0x409b20){return _0x507569[_0x0a1d('0xb')](_0x0a1d('0xc'),attributes,{'tableName':_0x0a1d('0xd'),'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 d573dad..7d593c0 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 _0xf24b=['GetTemplate','Template','findAll','options','raw','attributes','limit','map','include','model','debug','stringify','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','message','Template,\x20%s,\x20%s','result'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf24b,0xad));var _0xbf24=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0xf24b[_0x29dda1];return _0x21b0ef;};'use strict';var _=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var moment=require(_0xbf24('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf24('0x4'))['db'];var utils=require(_0xbf24('0x5'));var logger=require('../../config/logger')(_0xbf24('0x6'));var config=require(_0xbf24('0x7'));var jayson=require(_0xbf24('0x8'));var client=jayson[_0xbf24('0x9')][_0xbf24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd757,_0x10ae5f,_0x3e983e){return new BPromise(function(_0x455e1e,_0x519ad7){return client['request'](_0x4dd757,_0x3e983e)[_0xbf24('0xb')](function(_0x3a94e7){logger[_0xbf24('0xc')]('Template,\x20%s,\x20%s',_0x10ae5f,_0xbf24('0xd'));logger['debug'](_0xbf24('0xe'),_0x10ae5f,'request\x20sent',JSON['stringify'](_0x3a94e7));if(_0x3a94e7[_0xbf24('0xf')]){if(_0x3a94e7[_0xbf24('0xf')]['code']===0x1f4){logger[_0xbf24('0xf')]('Template,\x20%s,\x20%s',_0x10ae5f,_0x3a94e7[_0xbf24('0xf')][_0xbf24('0x10')]);return _0x519ad7(_0x3a94e7[_0xbf24('0xf')][_0xbf24('0x10')]);}logger['error'](_0xbf24('0x11'),_0x10ae5f,_0x3a94e7[_0xbf24('0xf')]['message']);return _0x455e1e(_0x3a94e7['error'][_0xbf24('0x10')]);}else{logger[_0xbf24('0xc')](_0xbf24('0x11'),_0x10ae5f,_0xbf24('0xd'));_0x455e1e(_0x3a94e7[_0xbf24('0x12')][_0xbf24('0x10')]);}})['catch'](function(_0x188217){logger['error'](_0xbf24('0x11'),_0x10ae5f,_0x188217);_0x519ad7(_0x188217);});});}exports[_0xbf24('0x13')]=function(_0x1897fe){var _0x3b761a=this;return new Promise(function(_0x4907b9,_0x126976){return db[_0xbf24('0x14')][_0xbf24('0x15')]({'raw':_0x1897fe[_0xbf24('0x16')]?_0x1897fe['options'][_0xbf24('0x17')]===undefined?!![]:![]:!![],'where':_0x1897fe[_0xbf24('0x16')]?_0x1897fe['options']['where']||null:null,'attributes':_0x1897fe[_0xbf24('0x16')]?_0x1897fe['options'][_0xbf24('0x18')]||null:null,'limit':_0x1897fe[_0xbf24('0x16')]?_0x1897fe['options'][_0xbf24('0x19')]||null:null,'include':_0x1897fe[_0xbf24('0x16')]?_0x1897fe[_0xbf24('0x16')]['include']?_[_0xbf24('0x1a')](_0x1897fe[_0xbf24('0x16')][_0xbf24('0x1b')],function(_0x375291){return{'model':db[_0x375291[_0xbf24('0x1c')]],'as':_0x375291['as'],'attributes':_0x375291[_0xbf24('0x18')],'include':_0x375291[_0xbf24('0x1b')]?_['map'](_0x375291['include'],function(_0x38d51c){return{'model':db[_0x38d51c[_0xbf24('0x1c')]],'as':_0x38d51c['as'],'attributes':_0x38d51c[_0xbf24('0x18')],'include':_0x38d51c[_0xbf24('0x1b')]?_[_0xbf24('0x1a')](_0x38d51c[_0xbf24('0x1b')],function(_0x400a95){return{'model':db[_0x400a95[_0xbf24('0x1c')]],'as':_0x400a95['as'],'attributes':_0x400a95[_0xbf24('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbf24('0xb')](function(_0x278428){logger[_0xbf24('0xc')](_0xbf24('0x13'),_0x1897fe);logger[_0xbf24('0x1d')](_0xbf24('0x13'),_0x1897fe,JSON[_0xbf24('0x1e')](_0x278428));_0x4907b9(_0x278428);})[_0xbf24('0x1f')](function(_0x11ec9b){logger[_0xbf24('0xf')]('GetTemplate',_0x11ec9b[_0xbf24('0x10')],_0x1897fe);_0x126976(_0x3b761a[_0xbf24('0xf')](0x1f4,_0x11ec9b[_0xbf24('0x10')]));});});}; \ No newline at end of file +var _0x0b94=['info','catch','Template','findAll','options','raw','where','attributes','limit','include','model','map','then','GetTemplate','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3869c8,_0x2ff137){var _0x4caf60=function(_0x224384){while(--_0x224384){_0x3869c8['push'](_0x3869c8['shift']());}};_0x4caf60(++_0x2ff137);}(_0x0b94,0xaf));var _0x40b9=function(_0x18fe48,_0x456105){_0x18fe48=_0x18fe48-0x0;var _0x277788=_0x0b94[_0x18fe48];return _0x277788;};'use strict';var _=require(_0x40b9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40b9('0x1'));var rs=require(_0x40b9('0x2'));var fs=require('fs');var Redis=require(_0x40b9('0x3'));var db=require(_0x40b9('0x4'))['db'];var utils=require(_0x40b9('0x5'));var logger=require(_0x40b9('0x6'))('rpc');var config=require(_0x40b9('0x7'));var jayson=require(_0x40b9('0x8'));var client=jayson[_0x40b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4625d1,_0x126e16,_0x36f834){return new BPromise(function(_0x230c1f,_0x244c8f){return client[_0x40b9('0xa')](_0x4625d1,_0x36f834)['then'](function(_0x18e683){logger['info'](_0x40b9('0xb'),_0x126e16,_0x40b9('0xc'));logger[_0x40b9('0xd')](_0x40b9('0xe'),_0x126e16,_0x40b9('0xc'),JSON['stringify'](_0x18e683));if(_0x18e683[_0x40b9('0xf')]){if(_0x18e683[_0x40b9('0xf')]['code']===0x1f4){logger['error'](_0x40b9('0xb'),_0x126e16,_0x18e683[_0x40b9('0xf')]['message']);return _0x244c8f(_0x18e683['error'][_0x40b9('0x10')]);}logger[_0x40b9('0xf')]('Template,\x20%s,\x20%s',_0x126e16,_0x18e683[_0x40b9('0xf')]['message']);return _0x230c1f(_0x18e683[_0x40b9('0xf')][_0x40b9('0x10')]);}else{logger[_0x40b9('0x11')]('Template,\x20%s,\x20%s',_0x126e16,_0x40b9('0xc'));_0x230c1f(_0x18e683['result'][_0x40b9('0x10')]);}})[_0x40b9('0x12')](function(_0x36678c){logger[_0x40b9('0xf')](_0x40b9('0xb'),_0x126e16,_0x36678c);_0x244c8f(_0x36678c);});});}exports['GetTemplate']=function(_0x4dd18f){var _0x53dabc=this;return new Promise(function(_0x13b697,_0x34ae51){return db[_0x40b9('0x13')][_0x40b9('0x14')]({'raw':_0x4dd18f[_0x40b9('0x15')]?_0x4dd18f['options'][_0x40b9('0x16')]===undefined?!![]:![]:!![],'where':_0x4dd18f[_0x40b9('0x15')]?_0x4dd18f[_0x40b9('0x15')][_0x40b9('0x17')]||null:null,'attributes':_0x4dd18f[_0x40b9('0x15')]?_0x4dd18f[_0x40b9('0x15')][_0x40b9('0x18')]||null:null,'limit':_0x4dd18f['options']?_0x4dd18f[_0x40b9('0x15')][_0x40b9('0x19')]||null:null,'include':_0x4dd18f['options']?_0x4dd18f['options']['include']?_['map'](_0x4dd18f['options'][_0x40b9('0x1a')],function(_0x4513b1){return{'model':db[_0x4513b1[_0x40b9('0x1b')]],'as':_0x4513b1['as'],'attributes':_0x4513b1['attributes'],'include':_0x4513b1[_0x40b9('0x1a')]?_[_0x40b9('0x1c')](_0x4513b1['include'],function(_0x2f2011){return{'model':db[_0x2f2011['model']],'as':_0x2f2011['as'],'attributes':_0x2f2011[_0x40b9('0x18')],'include':_0x2f2011[_0x40b9('0x1a')]?_[_0x40b9('0x1c')](_0x2f2011[_0x40b9('0x1a')],function(_0x5e0928){return{'model':db[_0x5e0928[_0x40b9('0x1b')]],'as':_0x5e0928['as'],'attributes':_0x5e0928[_0x40b9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x40b9('0x1d')](function(_0xb2e936){logger[_0x40b9('0x11')](_0x40b9('0x1e'),_0x4dd18f);logger[_0x40b9('0xd')](_0x40b9('0x1e'),_0x4dd18f,JSON[_0x40b9('0x1f')](_0xb2e936));_0x13b697(_0xb2e936);})['catch'](function(_0x29f568){logger['error']('GetTemplate',_0x29f568[_0x40b9('0x10')],_0x4dd18f);_0x34ae51(_0x53dabc[_0x40b9('0xf')](0x1f4,_0x29f568[_0x40b9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index efc748e..263d962 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 _0x31dc=['../../components/interaction/service','get','isAuthenticated','index','getAllConditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','/:id','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x450e59,_0x229917){var _0x16bce2=function(_0x381751){while(--_0x381751){_0x450e59['push'](_0x450e59['shift']());}};_0x16bce2(++_0x229917);}(_0x31dc,0x10f));var _0xc31d=function(_0x3b0656,_0x2c98ed){_0x3b0656=_0x3b0656-0x0;var _0x6352b2=_0x31dc[_0x3b0656];return _0x6352b2;};'use strict';var multer=require(_0xc31d('0x0'));var util=require(_0xc31d('0x1'));var path=require('path');var timeout=require(_0xc31d('0x2'));var express=require('express');var router=express[_0xc31d('0x3')]();var fs_extra=require(_0xc31d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc31d('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xc31d('0x6')]('/',auth[_0xc31d('0x7')](),controller[_0xc31d('0x8')]);router[_0xc31d('0x6')]('/:id',auth[_0xc31d('0x7')](),controller['show']);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xc31d('0x9')]);router[_0xc31d('0x6')]('/:id/any_conditions',auth['isAuthenticated'](),controller['getAnyConditions']);router['get'](_0xc31d('0xa'),auth[_0xc31d('0x7')](),controller[_0xc31d('0xb')]);router[_0xc31d('0xc')]('/',auth[_0xc31d('0x7')](),controller['create']);router[_0xc31d('0xc')](_0xc31d('0xd'),auth[_0xc31d('0x7')](),controller[_0xc31d('0xe')]);router[_0xc31d('0xc')](_0xc31d('0xf'),auth['isAuthenticated'](),controller[_0xc31d('0x10')]);router['post'](_0xc31d('0xa'),auth[_0xc31d('0x7')](),controller[_0xc31d('0x11')]);router[_0xc31d('0x12')](_0xc31d('0x13'),auth[_0xc31d('0x7')](),controller[_0xc31d('0x14')]);router['delete'](_0xc31d('0x13'),auth[_0xc31d('0x7')](),controller[_0xc31d('0x15')]);module[_0xc31d('0x16')]=router; \ No newline at end of file +var _0x5227=['addAllCondition','addAnyCondition','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post'];(function(_0x2a8da5,_0x274ea2){var _0x1c428d=function(_0x3b43b2){while(--_0x3b43b2){_0x2a8da5['push'](_0x2a8da5['shift']());}};_0x1c428d(++_0x274ea2);}(_0x5227,0x1d1));var _0x7522=function(_0x5230eb,_0x29ec8a){_0x5230eb=_0x5230eb-0x0;var _0x23e301=_0x5227[_0x5230eb];return _0x23e301;};'use strict';var multer=require(_0x7522('0x0'));var util=require(_0x7522('0x1'));var path=require(_0x7522('0x2'));var timeout=require(_0x7522('0x3'));var express=require(_0x7522('0x4'));var router=express[_0x7522('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7522('0x6'));var interaction=require(_0x7522('0x7'));var config=require(_0x7522('0x8'));var controller=require(_0x7522('0x9'));router['get']('/',auth[_0x7522('0xa')](),controller[_0x7522('0xb')]);router[_0x7522('0xc')](_0x7522('0xd'),auth[_0x7522('0xa')](),controller[_0x7522('0xe')]);router[_0x7522('0xc')](_0x7522('0xf'),auth[_0x7522('0xa')](),controller[_0x7522('0x10')]);router[_0x7522('0xc')](_0x7522('0x11'),auth[_0x7522('0xa')](),controller['getAnyConditions']);router[_0x7522('0xc')](_0x7522('0x12'),auth[_0x7522('0xa')](),controller[_0x7522('0x13')]);router[_0x7522('0x14')]('/',auth[_0x7522('0xa')](),controller['create']);router[_0x7522('0x14')](_0x7522('0xf'),auth[_0x7522('0xa')](),controller[_0x7522('0x15')]);router[_0x7522('0x14')](_0x7522('0x11'),auth[_0x7522('0xa')](),controller[_0x7522('0x16')]);router[_0x7522('0x14')](_0x7522('0x12'),auth['isAuthenticated'](),controller['addAction']);router[_0x7522('0x17')]('/:id',auth[_0x7522('0xa')](),controller[_0x7522('0x18')]);router[_0x7522('0x19')](_0x7522('0xd'),auth[_0x7522('0xa')](),controller[_0x7522('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0be9fbb..5cb825c 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 _0x6975=['STRING','BOOLEAN','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6975,0x182));var _0x5697=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x6975[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x5697('0x0'));module['exports']={'name':{'type':Sequelize[_0x5697('0x1')]},'channel':{'type':Sequelize[_0x5697('0x1')]},'description':{'type':Sequelize[_0x5697('0x1')]},'status':{'type':Sequelize[_0x5697('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x68f7=['BOOLEAN','exports','STRING'];(function(_0x3af92e,_0x2efd0a){var _0x55b0af=function(_0x5e7f35){while(--_0x5e7f35){_0x3af92e['push'](_0x3af92e['shift']());}};_0x55b0af(++_0x2efd0a);}(_0x68f7,0x1d8));var _0x768f=function(_0x269c25,_0xa710a3){_0x269c25=_0x269c25-0x0;var _0x1b80bb=_0x68f7[_0x269c25];return _0x1b80bb;};'use strict';var Sequelize=require('sequelize');module[_0x768f('0x0')]={'name':{'type':Sequelize[_0x768f('0x1')]},'channel':{'type':Sequelize[_0x768f('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x768f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index fb1a99a..3859386 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 _0x8e62=['map','filter','options','Trigger','includeAll','findAll','show','params','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','get','Triggers','UserProfileResource','destroy','end','sendStatus','error','index','rawAttributes','type','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x8e62,0x13d));var _0x28e6=function(_0x32d330,_0xe907c8){_0x32d330=_0x32d330-0x0;var _0xe81a43=_0x8e62[_0x32d330];return _0xe81a43;};'use strict';var emlformat=require(_0x28e6('0x0'));var rimraf=require(_0x28e6('0x1'));var zipdir=require(_0x28e6('0x2'));var jsonpatch=require(_0x28e6('0x3'));var rp=require(_0x28e6('0x4'));var moment=require(_0x28e6('0x5'));var BPromise=require(_0x28e6('0x6'));var Mustache=require(_0x28e6('0x7'));var util=require('util');var path=require('path');var sox=require(_0x28e6('0x8'));var csv=require(_0x28e6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28e6('0xa'));var _=require(_0x28e6('0xb'));var squel=require(_0x28e6('0xc'));var crypto=require(_0x28e6('0xd'));var jsforce=require(_0x28e6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28e6('0x9'));var querystring=require(_0x28e6('0xf'));var Papa=require(_0x28e6('0x10'));var Redis=require(_0x28e6('0x11'));var authService=require(_0x28e6('0x12'));var qs=require(_0x28e6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28e6('0x14'));var logger=require(_0x28e6('0x15'))(_0x28e6('0x16'));var utils=require('../../config/utils');var config=require(_0x28e6('0x17'));var licenseUtil=require(_0x28e6('0x18'));var db=require(_0x28e6('0x19'))['db'];function respondWithStatusCode(_0x1f03b2,_0x30472d){_0x30472d=_0x30472d||0xcc;return function(_0x32ac3a){if(_0x32ac3a){return _0x1f03b2['sendStatus'](_0x30472d);}return _0x1f03b2[_0x28e6('0x1a')](_0x30472d)['end']();};}function respondWithResult(_0x44c450,_0x467cd2){_0x467cd2=_0x467cd2||0xc8;return function(_0x1e3d8f){if(_0x1e3d8f){return _0x44c450[_0x28e6('0x1a')](_0x467cd2)[_0x28e6('0x1b')](_0x1e3d8f);}};}function respondWithFilteredResult(_0x22826c,_0x3c3b97){return function(_0x278121){if(_0x278121){var _0x21195d=typeof _0x3c3b97[_0x28e6('0x1c')]==='undefined'&&typeof _0x3c3b97[_0x28e6('0x1d')]===_0x28e6('0x1e');var _0x2e61b0=_0x278121[_0x28e6('0x1f')];var _0x7e1eda=_0x21195d?0x0:_0x3c3b97[_0x28e6('0x1c')];var _0x1f86bd=_0x21195d?_0x278121[_0x28e6('0x1f')]:_0x3c3b97[_0x28e6('0x1c')]+_0x3c3b97[_0x28e6('0x1d')];var _0x3d439a;if(_0x1f86bd>=_0x2e61b0){_0x1f86bd=_0x2e61b0;_0x3d439a=0xc8;}else{_0x3d439a=0xce;}_0x22826c['status'](_0x3d439a);return _0x22826c['set'](_0x28e6('0x20'),_0x7e1eda+'-'+_0x1f86bd+'/'+_0x2e61b0)[_0x28e6('0x1b')](_0x278121);}return null;};}function patchUpdates(_0x2e73e6){return function(_0x583b39){try{jsonpatch['apply'](_0x583b39,_0x2e73e6,!![]);}catch(_0x44e183){return BPromise[_0x28e6('0x21')](_0x44e183);}return _0x583b39[_0x28e6('0x22')]();};}function saveUpdates(_0x64556b,_0x4e3a22){return function(_0x444dad){if(_0x444dad){return _0x444dad[_0x28e6('0x23')](_0x64556b)[_0x28e6('0x24')](function(_0x5bbd48){return _0x5bbd48;});}return null;};}function removeEntity(_0x499b52,_0x3ac77e){return function(_0x474356){if(_0x474356){return _0x474356['destroy']()[_0x28e6('0x24')](function(){var _0x52ea8f=_0x474356[_0x28e6('0x25')]({'plain':!![]});var _0x57ea4f=_0x28e6('0x26');return db[_0x28e6('0x27')][_0x28e6('0x28')]({'where':{'type':_0x57ea4f,'resourceId':_0x52ea8f['id']}})[_0x28e6('0x24')](function(){return _0x474356;});})[_0x28e6('0x24')](function(){_0x499b52[_0x28e6('0x1a')](0xcc)[_0x28e6('0x29')]();});}};}function handleEntityNotFound(_0x49be5b,_0x559535){return function(_0x21cf06){if(!_0x21cf06){_0x49be5b[_0x28e6('0x2a')](0x194);}return _0x21cf06;};}function handleError(_0x511e32,_0x274b30){_0x274b30=_0x274b30||0x1f4;return function(_0x59b92f){logger[_0x28e6('0x2b')](_0x59b92f['stack']);if(_0x59b92f['name']){delete _0x59b92f['name'];}_0x511e32[_0x28e6('0x1a')](_0x274b30)['send'](_0x59b92f);};}exports[_0x28e6('0x2c')]=function(_0x5902da,_0x3dca64){var _0x54773b={},_0x3a56c5={},_0x5ebc18={'count':0x0,'rows':[]};var _0x40a928=_['map'](db['Trigger'][_0x28e6('0x2d')],function(_0x34fda4){return{'name':_0x34fda4['fieldName'],'type':_0x34fda4[_0x28e6('0x2e')][_0x28e6('0x2f')]};});_0x3a56c5[_0x28e6('0x30')]=_['map'](_0x40a928,_0x28e6('0x31'));_0x3a56c5[_0x28e6('0x32')]=_['keys'](_0x5902da[_0x28e6('0x32')]);_0x3a56c5[_0x28e6('0x33')]=_['intersection'](_0x3a56c5[_0x28e6('0x30')],_0x3a56c5['query']);_0x54773b[_0x28e6('0x34')]=_[_0x28e6('0x35')](_0x3a56c5[_0x28e6('0x30')],qs[_0x28e6('0x36')](_0x5902da[_0x28e6('0x32')][_0x28e6('0x36')]));_0x54773b[_0x28e6('0x34')]=_0x54773b[_0x28e6('0x34')][_0x28e6('0x37')]?_0x54773b['attributes']:_0x3a56c5['model'];if(!_0x5902da[_0x28e6('0x32')][_0x28e6('0x38')](_0x28e6('0x39'))){_0x54773b[_0x28e6('0x1d')]=qs[_0x28e6('0x1d')](_0x5902da['query']['limit']);_0x54773b[_0x28e6('0x1c')]=qs['offset'](_0x5902da['query'][_0x28e6('0x1c')]);}_0x54773b[_0x28e6('0x3a')]=qs[_0x28e6('0x3b')](_0x5902da[_0x28e6('0x32')][_0x28e6('0x3b')]);_0x54773b[_0x28e6('0x3c')]=qs[_0x28e6('0x33')](_[_0x28e6('0x3d')](_0x5902da[_0x28e6('0x32')],_0x3a56c5['filters']),_0x40a928);if(_0x5902da[_0x28e6('0x32')]['filter']){_0x54773b[_0x28e6('0x3c')]=_[_0x28e6('0x3e')](_0x54773b[_0x28e6('0x3c')],{'$or':_[_0x28e6('0x3f')](_0x40a928,function(_0x45402a){if(_0x45402a['type']!=='VIRTUAL'){var _0x473387={};_0x473387[_0x45402a[_0x28e6('0x31')]]={'$like':'%'+_0x5902da['query'][_0x28e6('0x40')]+'%'};return _0x473387;}})});}_0x54773b=_['merge']({},_0x54773b,_0x5902da[_0x28e6('0x41')]);var _0x14fde8={'where':_0x54773b[_0x28e6('0x3c')]};return db[_0x28e6('0x42')]['count'](_0x14fde8)[_0x28e6('0x24')](function(_0x3289a9){_0x5ebc18[_0x28e6('0x1f')]=_0x3289a9;if(_0x5902da[_0x28e6('0x32')][_0x28e6('0x43')]){_0x54773b['include']=[{'all':!![]}];}return db['Trigger'][_0x28e6('0x44')](_0x54773b);})['then'](function(_0x5bf485){_0x5ebc18['rows']=_0x5bf485;return _0x5ebc18;})['then'](respondWithFilteredResult(_0x3dca64,_0x54773b))['catch'](handleError(_0x3dca64,null));};exports[_0x28e6('0x45')]=function(_0x10a622,_0x3e941b){var _0x480fb2={'raw':![],'where':{'id':_0x10a622[_0x28e6('0x46')]['id']}},_0x45679d={};_0x45679d[_0x28e6('0x30')]=_[_0x28e6('0x47')](db['Trigger'][_0x28e6('0x2d')]);_0x45679d[_0x28e6('0x32')]=_[_0x28e6('0x47')](_0x10a622[_0x28e6('0x32')]);_0x45679d[_0x28e6('0x33')]=_[_0x28e6('0x35')](_0x45679d[_0x28e6('0x30')],_0x45679d[_0x28e6('0x32')]);_0x480fb2['attributes']=_[_0x28e6('0x35')](_0x45679d[_0x28e6('0x30')],qs[_0x28e6('0x36')](_0x10a622[_0x28e6('0x32')]['fields']));_0x480fb2[_0x28e6('0x34')]=_0x480fb2['attributes'][_0x28e6('0x37')]?_0x480fb2[_0x28e6('0x34')]:_0x45679d[_0x28e6('0x30')];if(_0x10a622[_0x28e6('0x32')][_0x28e6('0x43')]){_0x480fb2[_0x28e6('0x48')]=[{'all':!![]}];}_0x480fb2=_[_0x28e6('0x3e')]({},_0x480fb2,_0x10a622[_0x28e6('0x41')]);return db[_0x28e6('0x42')][_0x28e6('0x49')](_0x480fb2)[_0x28e6('0x24')](handleEntityNotFound(_0x3e941b,null))['then'](respondWithResult(_0x3e941b,null))[_0x28e6('0x4a')](handleError(_0x3e941b,null));};exports[_0x28e6('0x4b')]=function(_0x5be218,_0x354801){return db[_0x28e6('0x42')][_0x28e6('0x4b')](_0x5be218[_0x28e6('0x4c')],{})['then'](function(_0x599794){var _0x45341f=_0x5be218[_0x28e6('0x4d')][_0x28e6('0x25')]({'plain':!![]});if(!_0x45341f)throw new Error(_0x28e6('0x4e'));if(_0x45341f[_0x28e6('0x4f')]===_0x28e6('0x4d')){var _0x4de12c=_0x599794[_0x28e6('0x25')]({'plain':!![]});var _0x2a1b23=_0x28e6('0x26');return db[_0x28e6('0x50')]['find']({'where':{'name':_0x2a1b23,'userProfileId':_0x45341f['userProfileId']},'raw':!![]})[_0x28e6('0x24')](function(_0x29d521){if(_0x29d521&&_0x29d521[_0x28e6('0x51')]===0x0){return db[_0x28e6('0x27')]['create']({'name':_0x4de12c[_0x28e6('0x31')],'resourceId':_0x4de12c['id'],'type':_0x29d521[_0x28e6('0x31')],'sectionId':_0x29d521['id']},{})[_0x28e6('0x24')](function(){return _0x599794;});}else{return _0x599794;}})[_0x28e6('0x4a')](function(_0x49233e){logger['error'](_0x28e6('0x52'),_0x49233e);throw _0x49233e;});}return _0x599794;})[_0x28e6('0x24')](respondWithResult(_0x354801,0xc9))['catch'](handleError(_0x354801,null));};exports[_0x28e6('0x23')]=function(_0x227dbf,_0x37e0ab){if(_0x227dbf[_0x28e6('0x4c')]['id']){delete _0x227dbf[_0x28e6('0x4c')]['id'];}return db[_0x28e6('0x42')]['find']({'where':{'id':_0x227dbf[_0x28e6('0x46')]['id']}})[_0x28e6('0x24')](handleEntityNotFound(_0x37e0ab,null))[_0x28e6('0x24')](saveUpdates(_0x227dbf[_0x28e6('0x4c')],null))[_0x28e6('0x24')](respondWithResult(_0x37e0ab,null))['catch'](handleError(_0x37e0ab,null));};exports['destroy']=function(_0x2fe192,_0x496f9c){return db[_0x28e6('0x42')][_0x28e6('0x49')]({'where':{'id':_0x2fe192[_0x28e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x496f9c,null))[_0x28e6('0x24')](removeEntity(_0x496f9c,null))[_0x28e6('0x4a')](handleError(_0x496f9c,null));};exports[_0x28e6('0x53')]=function(_0x5eb8c1,_0x2e3a0b,_0x476229){if(_0x5eb8c1['body']['id']){delete _0x5eb8c1['body']['id'];}return db[_0x28e6('0x42')][_0x28e6('0x49')]({'where':{'id':_0x5eb8c1[_0x28e6('0x46')]['id']}})[_0x28e6('0x24')](handleEntityNotFound(_0x2e3a0b,null))[_0x28e6('0x24')](function(_0x2ca33d){if(_0x2ca33d){_0x5eb8c1['body'][_0x28e6('0x54')]=_0x2ca33d['id'];return db[_0x28e6('0x55')][_0x28e6('0x4b')](_0x5eb8c1[_0x28e6('0x4c')]);}})[_0x28e6('0x24')](respondWithResult(_0x2e3a0b,null))['catch'](handleError(_0x2e3a0b,null));};exports[_0x28e6('0x56')]=function(_0x54106a,_0x405b11,_0x1f0e09){if(_0x54106a[_0x28e6('0x4c')]['id']){delete _0x54106a[_0x28e6('0x4c')]['id'];}return db[_0x28e6('0x42')]['find']({'where':{'id':_0x54106a[_0x28e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x405b11,null))[_0x28e6('0x24')](function(_0x51df37){if(_0x51df37){_0x54106a[_0x28e6('0x4c')][_0x28e6('0x57')]=_0x51df37['id'];return db[_0x28e6('0x55')][_0x28e6('0x4b')](_0x54106a['body']);}})[_0x28e6('0x24')](respondWithResult(_0x405b11,null))[_0x28e6('0x4a')](handleError(_0x405b11,null));};exports['getAllConditions']=function(_0x4a03c1,_0x4a7dbd,_0x4574e6){var _0x1e1c7a={};var _0x45cc9d={};var _0x4e4b88;var _0x2de643;return db[_0x28e6('0x42')][_0x28e6('0x58')]({'where':{'id':_0x4a03c1[_0x28e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a7dbd,null))[_0x28e6('0x24')](function(_0x144f7b){if(_0x144f7b){_0x4e4b88=_0x144f7b;_0x45cc9d[_0x28e6('0x30')]=_[_0x28e6('0x47')](db[_0x28e6('0x55')][_0x28e6('0x2d')]);_0x45cc9d[_0x28e6('0x32')]=_['keys'](_0x4a03c1[_0x28e6('0x32')]);_0x45cc9d['filters']=_[_0x28e6('0x35')](_0x45cc9d[_0x28e6('0x30')],_0x45cc9d[_0x28e6('0x32')]);_0x1e1c7a[_0x28e6('0x34')]=_[_0x28e6('0x35')](_0x45cc9d[_0x28e6('0x30')],qs[_0x28e6('0x36')](_0x4a03c1[_0x28e6('0x32')][_0x28e6('0x36')]));_0x1e1c7a['attributes']=_0x1e1c7a[_0x28e6('0x34')][_0x28e6('0x37')]?_0x1e1c7a[_0x28e6('0x34')]:_0x45cc9d[_0x28e6('0x30')];_0x1e1c7a['order']=qs[_0x28e6('0x3b')](_0x4a03c1['query'][_0x28e6('0x3b')]);_0x1e1c7a[_0x28e6('0x3c')]=qs[_0x28e6('0x33')](_[_0x28e6('0x3d')](_0x4a03c1['query'],_0x45cc9d[_0x28e6('0x33')]));if(_0x4a03c1[_0x28e6('0x32')][_0x28e6('0x40')]){_0x1e1c7a['where']=_[_0x28e6('0x3e')](_0x1e1c7a[_0x28e6('0x3c')],{'$or':_[_0x28e6('0x3f')](_0x1e1c7a[_0x28e6('0x34')],function(_0xcf7f91){var _0x37a837={};_0x37a837[_0xcf7f91]={'$like':'%'+_0x4a03c1[_0x28e6('0x32')][_0x28e6('0x40')]+'%'};return _0x37a837;})});}_0x1e1c7a=_[_0x28e6('0x3e')]({},_0x1e1c7a,_0x4a03c1['options']);return _0x4e4b88[_0x28e6('0x59')](_0x1e1c7a);}})[_0x28e6('0x24')](function(_0x37fb43){if(_0x37fb43){_0x2de643=_0x37fb43[_0x28e6('0x37')];if(!_0x4a03c1[_0x28e6('0x32')]['hasOwnProperty']('nolimit')){_0x1e1c7a[_0x28e6('0x1d')]=qs['limit'](_0x4a03c1[_0x28e6('0x32')][_0x28e6('0x1d')]);_0x1e1c7a[_0x28e6('0x1c')]=qs[_0x28e6('0x1c')](_0x4a03c1[_0x28e6('0x32')]['offset']);}return _0x4e4b88[_0x28e6('0x59')](_0x1e1c7a);}})[_0x28e6('0x24')](function(_0x347b78){if(_0x347b78){return _0x347b78?{'count':_0x2de643,'rows':_0x347b78}:null;}})[_0x28e6('0x24')](respondWithResult(_0x4a7dbd,null))[_0x28e6('0x4a')](handleError(_0x4a7dbd,null));};exports[_0x28e6('0x5a')]=function(_0x7f7bb7,_0x57203c,_0x13e940){var _0x505822={};var _0x24e4d5={};var _0x214d68;var _0x3cfcac;return db['Trigger'][_0x28e6('0x58')]({'where':{'id':_0x7f7bb7[_0x28e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x57203c,null))[_0x28e6('0x24')](function(_0x408625){if(_0x408625){_0x214d68=_0x408625;_0x24e4d5[_0x28e6('0x30')]=_['keys'](db[_0x28e6('0x55')]['rawAttributes']);_0x24e4d5['query']=_[_0x28e6('0x47')](_0x7f7bb7[_0x28e6('0x32')]);_0x24e4d5[_0x28e6('0x33')]=_[_0x28e6('0x35')](_0x24e4d5['model'],_0x24e4d5['query']);_0x505822['attributes']=_['intersection'](_0x24e4d5[_0x28e6('0x30')],qs['fields'](_0x7f7bb7[_0x28e6('0x32')][_0x28e6('0x36')]));_0x505822[_0x28e6('0x34')]=_0x505822[_0x28e6('0x34')][_0x28e6('0x37')]?_0x505822[_0x28e6('0x34')]:_0x24e4d5[_0x28e6('0x30')];_0x505822[_0x28e6('0x3a')]=qs['sort'](_0x7f7bb7[_0x28e6('0x32')][_0x28e6('0x3b')]);_0x505822[_0x28e6('0x3c')]=qs[_0x28e6('0x33')](_[_0x28e6('0x3d')](_0x7f7bb7['query'],_0x24e4d5[_0x28e6('0x33')]));if(_0x7f7bb7[_0x28e6('0x32')][_0x28e6('0x40')]){_0x505822[_0x28e6('0x3c')]=_['merge'](_0x505822[_0x28e6('0x3c')],{'$or':_[_0x28e6('0x3f')](_0x505822[_0x28e6('0x34')],function(_0x49724a){var _0x20a055={};_0x20a055[_0x49724a]={'$like':'%'+_0x7f7bb7[_0x28e6('0x32')][_0x28e6('0x40')]+'%'};return _0x20a055;})});}_0x505822=_['merge']({},_0x505822,_0x7f7bb7[_0x28e6('0x41')]);return _0x214d68[_0x28e6('0x5a')](_0x505822);}})[_0x28e6('0x24')](function(_0x3f4f7a){if(_0x3f4f7a){_0x3cfcac=_0x3f4f7a[_0x28e6('0x37')];if(!_0x7f7bb7[_0x28e6('0x32')][_0x28e6('0x38')](_0x28e6('0x39'))){_0x505822[_0x28e6('0x1d')]=qs[_0x28e6('0x1d')](_0x7f7bb7['query'][_0x28e6('0x1d')]);_0x505822['offset']=qs[_0x28e6('0x1c')](_0x7f7bb7[_0x28e6('0x32')]['offset']);}return _0x214d68['getAnyConditions'](_0x505822);}})[_0x28e6('0x24')](function(_0x423a5f){if(_0x423a5f){return _0x423a5f?{'count':_0x3cfcac,'rows':_0x423a5f}:null;}})[_0x28e6('0x24')](respondWithResult(_0x57203c,null))[_0x28e6('0x4a')](handleError(_0x57203c,null));};exports[_0x28e6('0x5b')]=function(_0x4fd302,_0x59ac30,_0xb9e2f6){if(_0x4fd302['body']['id']){delete _0x4fd302['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x4fd302[_0x28e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x59ac30,null))[_0x28e6('0x24')](function(_0x35c29a){if(_0x35c29a){_0x4fd302['body'][_0x28e6('0x5c')]=_0x35c29a['id'];return db[_0x28e6('0x5d')][_0x28e6('0x4b')](_0x4fd302[_0x28e6('0x4c')]);}})[_0x28e6('0x24')](respondWithResult(_0x59ac30,null))['catch'](handleError(_0x59ac30,null));};exports[_0x28e6('0x5e')]=function(_0x2ab814,_0x46619f,_0x166424){var _0x483ed3={};var _0x2bccbc={};var _0x5eed92;var _0x53aa46;return db[_0x28e6('0x42')][_0x28e6('0x58')]({'where':{'id':_0x2ab814[_0x28e6('0x46')]['id']}})[_0x28e6('0x24')](handleEntityNotFound(_0x46619f,null))[_0x28e6('0x24')](function(_0x1bf291){if(_0x1bf291){_0x5eed92=_0x1bf291;_0x2bccbc[_0x28e6('0x30')]=_['keys'](db['Action'][_0x28e6('0x2d')]);_0x2bccbc[_0x28e6('0x32')]=_[_0x28e6('0x47')](_0x2ab814[_0x28e6('0x32')]);_0x2bccbc['filters']=_[_0x28e6('0x35')](_0x2bccbc['model'],_0x2bccbc[_0x28e6('0x32')]);_0x483ed3[_0x28e6('0x34')]=_[_0x28e6('0x35')](_0x2bccbc[_0x28e6('0x30')],qs[_0x28e6('0x36')](_0x2ab814[_0x28e6('0x32')][_0x28e6('0x36')]));_0x483ed3[_0x28e6('0x34')]=_0x483ed3[_0x28e6('0x34')][_0x28e6('0x37')]?_0x483ed3[_0x28e6('0x34')]:_0x2bccbc['model'];_0x483ed3['order']=qs['sort'](_0x2ab814[_0x28e6('0x32')]['sort']);_0x483ed3[_0x28e6('0x3c')]=qs[_0x28e6('0x33')](_['pick'](_0x2ab814['query'],_0x2bccbc['filters']));if(_0x2ab814['query'][_0x28e6('0x40')]){_0x483ed3[_0x28e6('0x3c')]=_['merge'](_0x483ed3[_0x28e6('0x3c')],{'$or':_['map'](_0x483ed3[_0x28e6('0x34')],function(_0x390bac){var _0x1a270f={};_0x1a270f[_0x390bac]={'$like':'%'+_0x2ab814[_0x28e6('0x32')][_0x28e6('0x40')]+'%'};return _0x1a270f;})});}_0x483ed3=_[_0x28e6('0x3e')]({},_0x483ed3,_0x2ab814[_0x28e6('0x41')]);return _0x5eed92[_0x28e6('0x5e')](_0x483ed3);}})[_0x28e6('0x24')](function(_0x2a30c6){if(_0x2a30c6){_0x53aa46=_0x2a30c6[_0x28e6('0x37')];if(!_0x2ab814[_0x28e6('0x32')]['hasOwnProperty'](_0x28e6('0x39'))){_0x483ed3[_0x28e6('0x1d')]=qs[_0x28e6('0x1d')](_0x2ab814[_0x28e6('0x32')][_0x28e6('0x1d')]);_0x483ed3[_0x28e6('0x1c')]=qs[_0x28e6('0x1c')](_0x2ab814[_0x28e6('0x32')][_0x28e6('0x1c')]);}return _0x5eed92['getActions'](_0x483ed3);}})['then'](function(_0x56bb8d){if(_0x56bb8d){return _0x56bb8d?{'count':_0x53aa46,'rows':_0x56bb8d}:null;}})[_0x28e6('0x24')](respondWithResult(_0x46619f,null))['catch'](handleError(_0x46619f,null));}; \ No newline at end of file +var _0x08dc=['fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Triggers','UserProfileResource','destroy','name','send','Trigger','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','body','addAllCondition','Condition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','rimraf','zip-dir'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x08dc,0xbc));var _0xc08d=function(_0x2fcb60,_0x51be6f){_0x2fcb60=_0x2fcb60-0x0;var _0x25bfd1=_0x08dc[_0x2fcb60];return _0x25bfd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc08d('0x0'));var zipdir=require(_0xc08d('0x1'));var jsonpatch=require(_0xc08d('0x2'));var rp=require(_0xc08d('0x3'));var moment=require(_0xc08d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc08d('0x5'));var util=require(_0xc08d('0x6'));var path=require('path');var sox=require(_0xc08d('0x7'));var csv=require(_0xc08d('0x8'));var ejs=require(_0xc08d('0x9'));var fs=require('fs');var fs_extra=require(_0xc08d('0xa'));var _=require(_0xc08d('0xb'));var squel=require(_0xc08d('0xc'));var crypto=require(_0xc08d('0xd'));var jsforce=require(_0xc08d('0xe'));var deskjs=require(_0xc08d('0xf'));var toCsv=require(_0xc08d('0x8'));var querystring=require(_0xc08d('0x10'));var Papa=require(_0xc08d('0x11'));var Redis=require(_0xc08d('0x12'));var authService=require(_0xc08d('0x13'));var qs=require(_0xc08d('0x14'));var as=require(_0xc08d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc08d('0x16'));var utils=require(_0xc08d('0x17'));var config=require(_0xc08d('0x18'));var licenseUtil=require(_0xc08d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ec0be,_0x26a052){_0x26a052=_0x26a052||0xcc;return function(_0x2d4d12){if(_0x2d4d12){return _0x1ec0be[_0xc08d('0x1a')](_0x26a052);}return _0x1ec0be[_0xc08d('0x1b')](_0x26a052)[_0xc08d('0x1c')]();};}function respondWithResult(_0x36c09d,_0x4b81b4){_0x4b81b4=_0x4b81b4||0xc8;return function(_0x48b191){if(_0x48b191){return _0x36c09d[_0xc08d('0x1b')](_0x4b81b4)[_0xc08d('0x1d')](_0x48b191);}};}function respondWithFilteredResult(_0x266d42,_0x325ea6){return function(_0x988f0){if(_0x988f0){var _0x1676ae=typeof _0x325ea6[_0xc08d('0x1e')]===_0xc08d('0x1f')&&typeof _0x325ea6[_0xc08d('0x20')]===_0xc08d('0x1f');var _0x3e4c12=_0x988f0['count'];var _0x27d118=_0x1676ae?0x0:_0x325ea6['offset'];var _0x136deb=_0x1676ae?_0x988f0[_0xc08d('0x21')]:_0x325ea6[_0xc08d('0x1e')]+_0x325ea6[_0xc08d('0x20')];var _0x465def;if(_0x136deb>=_0x3e4c12){_0x136deb=_0x3e4c12;_0x465def=0xc8;}else{_0x465def=0xce;}_0x266d42['status'](_0x465def);return _0x266d42['set'](_0xc08d('0x22'),_0x27d118+'-'+_0x136deb+'/'+_0x3e4c12)[_0xc08d('0x1d')](_0x988f0);}return null;};}function patchUpdates(_0x3644c9){return function(_0x508602){try{jsonpatch[_0xc08d('0x23')](_0x508602,_0x3644c9,!![]);}catch(_0x5d9e60){return BPromise[_0xc08d('0x24')](_0x5d9e60);}return _0x508602['save']();};}function saveUpdates(_0x29d947,_0x57cff2){return function(_0x45a9b5){if(_0x45a9b5){return _0x45a9b5[_0xc08d('0x25')](_0x29d947)[_0xc08d('0x26')](function(_0x117151){return _0x117151;});}return null;};}function removeEntity(_0x572cb5,_0x5e499f){return function(_0x34cef2){if(_0x34cef2){return _0x34cef2['destroy']()['then'](function(){var _0x180ab0=_0x34cef2[_0xc08d('0x27')]({'plain':!![]});var _0x3abedb=_0xc08d('0x28');return db[_0xc08d('0x29')][_0xc08d('0x2a')]({'where':{'type':_0x3abedb,'resourceId':_0x180ab0['id']}})[_0xc08d('0x26')](function(){return _0x34cef2;});})[_0xc08d('0x26')](function(){_0x572cb5[_0xc08d('0x1b')](0xcc)[_0xc08d('0x1c')]();});}};}function handleEntityNotFound(_0x4cd029,_0x506b05){return function(_0x10b8f7){if(!_0x10b8f7){_0x4cd029['sendStatus'](0x194);}return _0x10b8f7;};}function handleError(_0x3332e2,_0x50e4f2){_0x50e4f2=_0x50e4f2||0x1f4;return function(_0x4b32f0){logger['error'](_0x4b32f0['stack']);if(_0x4b32f0[_0xc08d('0x2b')]){delete _0x4b32f0[_0xc08d('0x2b')];}_0x3332e2[_0xc08d('0x1b')](_0x50e4f2)[_0xc08d('0x2c')](_0x4b32f0);};}exports['index']=function(_0xbe8297,_0x30fd8c){var _0x938214={},_0x371449={},_0x2053e3={'count':0x0,'rows':[]};var _0x28de8c=_['map'](db[_0xc08d('0x2d')]['rawAttributes'],function(_0x41ae61){return{'name':_0x41ae61[_0xc08d('0x2e')],'type':_0x41ae61[_0xc08d('0x2f')][_0xc08d('0x30')]};});_0x371449[_0xc08d('0x31')]=_[_0xc08d('0x32')](_0x28de8c,_0xc08d('0x2b'));_0x371449['query']=_[_0xc08d('0x33')](_0xbe8297[_0xc08d('0x34')]);_0x371449[_0xc08d('0x35')]=_['intersection'](_0x371449['model'],_0x371449[_0xc08d('0x34')]);_0x938214[_0xc08d('0x36')]=_[_0xc08d('0x37')](_0x371449['model'],qs[_0xc08d('0x38')](_0xbe8297[_0xc08d('0x34')][_0xc08d('0x38')]));_0x938214[_0xc08d('0x36')]=_0x938214[_0xc08d('0x36')][_0xc08d('0x39')]?_0x938214[_0xc08d('0x36')]:_0x371449[_0xc08d('0x31')];if(!_0xbe8297[_0xc08d('0x34')][_0xc08d('0x3a')](_0xc08d('0x3b'))){_0x938214[_0xc08d('0x20')]=qs[_0xc08d('0x20')](_0xbe8297['query'][_0xc08d('0x20')]);_0x938214[_0xc08d('0x1e')]=qs[_0xc08d('0x1e')](_0xbe8297[_0xc08d('0x34')][_0xc08d('0x1e')]);}_0x938214[_0xc08d('0x3c')]=qs[_0xc08d('0x3d')](_0xbe8297[_0xc08d('0x34')][_0xc08d('0x3d')]);_0x938214[_0xc08d('0x3e')]=qs[_0xc08d('0x35')](_[_0xc08d('0x3f')](_0xbe8297[_0xc08d('0x34')],_0x371449[_0xc08d('0x35')]),_0x28de8c);if(_0xbe8297[_0xc08d('0x34')][_0xc08d('0x40')]){_0x938214['where']=_[_0xc08d('0x41')](_0x938214[_0xc08d('0x3e')],{'$or':_[_0xc08d('0x32')](_0x28de8c,function(_0x5a5c6c){if(_0x5a5c6c[_0xc08d('0x2f')]!==_0xc08d('0x42')){var _0x4be144={};_0x4be144[_0x5a5c6c[_0xc08d('0x2b')]]={'$like':'%'+_0xbe8297['query']['filter']+'%'};return _0x4be144;}})});}_0x938214=_[_0xc08d('0x41')]({},_0x938214,_0xbe8297[_0xc08d('0x43')]);var _0xc35ace={'where':_0x938214[_0xc08d('0x3e')]};return db[_0xc08d('0x2d')][_0xc08d('0x21')](_0xc35ace)['then'](function(_0x43cb11){_0x2053e3[_0xc08d('0x21')]=_0x43cb11;if(_0xbe8297['query']['includeAll']){_0x938214[_0xc08d('0x44')]=[{'all':!![]}];}return db[_0xc08d('0x2d')][_0xc08d('0x45')](_0x938214);})['then'](function(_0x40b665){_0x2053e3[_0xc08d('0x46')]=_0x40b665;return _0x2053e3;})[_0xc08d('0x26')](respondWithFilteredResult(_0x30fd8c,_0x938214))['catch'](handleError(_0x30fd8c,null));};exports[_0xc08d('0x47')]=function(_0x258753,_0x4e2cd8){var _0x240257={'raw':![],'where':{'id':_0x258753[_0xc08d('0x48')]['id']}},_0x25e40a={};_0x25e40a['model']=_[_0xc08d('0x33')](db[_0xc08d('0x2d')][_0xc08d('0x49')]);_0x25e40a[_0xc08d('0x34')]=_[_0xc08d('0x33')](_0x258753[_0xc08d('0x34')]);_0x25e40a[_0xc08d('0x35')]=_['intersection'](_0x25e40a[_0xc08d('0x31')],_0x25e40a['query']);_0x240257[_0xc08d('0x36')]=_[_0xc08d('0x37')](_0x25e40a['model'],qs[_0xc08d('0x38')](_0x258753[_0xc08d('0x34')][_0xc08d('0x38')]));_0x240257['attributes']=_0x240257[_0xc08d('0x36')][_0xc08d('0x39')]?_0x240257['attributes']:_0x25e40a[_0xc08d('0x31')];if(_0x258753[_0xc08d('0x34')][_0xc08d('0x4a')]){_0x240257['include']=[{'all':!![]}];}_0x240257=_[_0xc08d('0x41')]({},_0x240257,_0x258753[_0xc08d('0x43')]);return db['Trigger']['find'](_0x240257)[_0xc08d('0x26')](handleEntityNotFound(_0x4e2cd8,null))[_0xc08d('0x26')](respondWithResult(_0x4e2cd8,null))[_0xc08d('0x4b')](handleError(_0x4e2cd8,null));};exports[_0xc08d('0x4c')]=function(_0x3187b3,_0x12a5d4){return db[_0xc08d('0x2d')][_0xc08d('0x4c')](_0x3187b3['body'],{})[_0xc08d('0x26')](function(_0x58161f){var _0xdc11c5=_0x3187b3['user'][_0xc08d('0x27')]({'plain':!![]});if(!_0xdc11c5)throw new Error(_0xc08d('0x4d'));if(_0xdc11c5[_0xc08d('0x4e')]===_0xc08d('0x4f')){var _0x2ebd3f=_0x58161f['get']({'plain':!![]});var _0x5834ae=_0xc08d('0x28');return db[_0xc08d('0x50')][_0xc08d('0x51')]({'where':{'name':_0x5834ae,'userProfileId':_0xdc11c5[_0xc08d('0x52')]},'raw':!![]})[_0xc08d('0x26')](function(_0x6588e1){if(_0x6588e1&&_0x6588e1[_0xc08d('0x53')]===0x0){return db[_0xc08d('0x29')][_0xc08d('0x4c')]({'name':_0x2ebd3f[_0xc08d('0x2b')],'resourceId':_0x2ebd3f['id'],'type':_0x6588e1[_0xc08d('0x2b')],'sectionId':_0x6588e1['id']},{})[_0xc08d('0x26')](function(){return _0x58161f;});}else{return _0x58161f;}})[_0xc08d('0x4b')](function(_0x6317ac){logger[_0xc08d('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6317ac);throw _0x6317ac;});}return _0x58161f;})['then'](respondWithResult(_0x12a5d4,0xc9))[_0xc08d('0x4b')](handleError(_0x12a5d4,null));};exports['update']=function(_0x2b3fff,_0x1be6e2){if(_0x2b3fff[_0xc08d('0x55')]['id']){delete _0x2b3fff[_0xc08d('0x55')]['id'];}return db[_0xc08d('0x2d')][_0xc08d('0x51')]({'where':{'id':_0x2b3fff[_0xc08d('0x48')]['id']}})[_0xc08d('0x26')](handleEntityNotFound(_0x1be6e2,null))['then'](saveUpdates(_0x2b3fff[_0xc08d('0x55')],null))[_0xc08d('0x26')](respondWithResult(_0x1be6e2,null))[_0xc08d('0x4b')](handleError(_0x1be6e2,null));};exports[_0xc08d('0x2a')]=function(_0x2f2b90,_0x36d9cc){return db[_0xc08d('0x2d')][_0xc08d('0x51')]({'where':{'id':_0x2f2b90['params']['id']}})['then'](handleEntityNotFound(_0x36d9cc,null))[_0xc08d('0x26')](removeEntity(_0x36d9cc,null))[_0xc08d('0x4b')](handleError(_0x36d9cc,null));};exports[_0xc08d('0x56')]=function(_0xedbea5,_0x555a1e,_0x4a6def){if(_0xedbea5[_0xc08d('0x55')]['id']){delete _0xedbea5['body']['id'];}return db[_0xc08d('0x2d')]['find']({'where':{'id':_0xedbea5['params']['id']}})[_0xc08d('0x26')](handleEntityNotFound(_0x555a1e,null))[_0xc08d('0x26')](function(_0x195506){if(_0x195506){_0xedbea5[_0xc08d('0x55')]['TriggerAllId']=_0x195506['id'];return db[_0xc08d('0x57')]['create'](_0xedbea5['body']);}})['then'](respondWithResult(_0x555a1e,null))[_0xc08d('0x4b')](handleError(_0x555a1e,null));};exports['addAnyCondition']=function(_0x3e9c53,_0xce954,_0x43184f){if(_0x3e9c53[_0xc08d('0x55')]['id']){delete _0x3e9c53[_0xc08d('0x55')]['id'];}return db[_0xc08d('0x2d')][_0xc08d('0x51')]({'where':{'id':_0x3e9c53[_0xc08d('0x48')]['id']}})['then'](handleEntityNotFound(_0xce954,null))[_0xc08d('0x26')](function(_0x25a3ae){if(_0x25a3ae){_0x3e9c53[_0xc08d('0x55')]['TriggerAnyId']=_0x25a3ae['id'];return db[_0xc08d('0x57')]['create'](_0x3e9c53[_0xc08d('0x55')]);}})['then'](respondWithResult(_0xce954,null))[_0xc08d('0x4b')](handleError(_0xce954,null));};exports[_0xc08d('0x58')]=function(_0x307b72,_0x2f5260,_0x556441){var _0xf118a4={};var _0x543822={};var _0x4c4b84;var _0x59bf58;return db['Trigger']['findOne']({'where':{'id':_0x307b72[_0xc08d('0x48')]['id']}})[_0xc08d('0x26')](handleEntityNotFound(_0x2f5260,null))[_0xc08d('0x26')](function(_0x3d5396){if(_0x3d5396){_0x4c4b84=_0x3d5396;_0x543822[_0xc08d('0x31')]=_[_0xc08d('0x33')](db[_0xc08d('0x57')][_0xc08d('0x49')]);_0x543822[_0xc08d('0x34')]=_['keys'](_0x307b72[_0xc08d('0x34')]);_0x543822[_0xc08d('0x35')]=_[_0xc08d('0x37')](_0x543822[_0xc08d('0x31')],_0x543822['query']);_0xf118a4[_0xc08d('0x36')]=_[_0xc08d('0x37')](_0x543822['model'],qs['fields'](_0x307b72[_0xc08d('0x34')][_0xc08d('0x38')]));_0xf118a4[_0xc08d('0x36')]=_0xf118a4[_0xc08d('0x36')][_0xc08d('0x39')]?_0xf118a4[_0xc08d('0x36')]:_0x543822[_0xc08d('0x31')];_0xf118a4[_0xc08d('0x3c')]=qs['sort'](_0x307b72['query']['sort']);_0xf118a4[_0xc08d('0x3e')]=qs['filters'](_['pick'](_0x307b72[_0xc08d('0x34')],_0x543822[_0xc08d('0x35')]));if(_0x307b72['query'][_0xc08d('0x40')]){_0xf118a4[_0xc08d('0x3e')]=_[_0xc08d('0x41')](_0xf118a4[_0xc08d('0x3e')],{'$or':_[_0xc08d('0x32')](_0xf118a4[_0xc08d('0x36')],function(_0x33df5e){var _0x19121b={};_0x19121b[_0x33df5e]={'$like':'%'+_0x307b72[_0xc08d('0x34')][_0xc08d('0x40')]+'%'};return _0x19121b;})});}_0xf118a4=_['merge']({},_0xf118a4,_0x307b72['options']);return _0x4c4b84[_0xc08d('0x58')](_0xf118a4);}})[_0xc08d('0x26')](function(_0x2c6e16){if(_0x2c6e16){_0x59bf58=_0x2c6e16[_0xc08d('0x39')];if(!_0x307b72[_0xc08d('0x34')][_0xc08d('0x3a')](_0xc08d('0x3b'))){_0xf118a4[_0xc08d('0x20')]=qs[_0xc08d('0x20')](_0x307b72[_0xc08d('0x34')][_0xc08d('0x20')]);_0xf118a4[_0xc08d('0x1e')]=qs[_0xc08d('0x1e')](_0x307b72['query'][_0xc08d('0x1e')]);}return _0x4c4b84[_0xc08d('0x58')](_0xf118a4);}})[_0xc08d('0x26')](function(_0x437c9b){if(_0x437c9b){return _0x437c9b?{'count':_0x59bf58,'rows':_0x437c9b}:null;}})[_0xc08d('0x26')](respondWithResult(_0x2f5260,null))[_0xc08d('0x4b')](handleError(_0x2f5260,null));};exports[_0xc08d('0x59')]=function(_0x37bc7c,_0x36f776,_0x45ee84){var _0x507189={};var _0x4ddf66={};var _0x5d0796;var _0x14605c;return db[_0xc08d('0x2d')][_0xc08d('0x5a')]({'where':{'id':_0x37bc7c[_0xc08d('0x48')]['id']}})['then'](handleEntityNotFound(_0x36f776,null))[_0xc08d('0x26')](function(_0x3c94a4){if(_0x3c94a4){_0x5d0796=_0x3c94a4;_0x4ddf66[_0xc08d('0x31')]=_[_0xc08d('0x33')](db[_0xc08d('0x57')]['rawAttributes']);_0x4ddf66[_0xc08d('0x34')]=_[_0xc08d('0x33')](_0x37bc7c[_0xc08d('0x34')]);_0x4ddf66[_0xc08d('0x35')]=_[_0xc08d('0x37')](_0x4ddf66['model'],_0x4ddf66[_0xc08d('0x34')]);_0x507189[_0xc08d('0x36')]=_[_0xc08d('0x37')](_0x4ddf66['model'],qs['fields'](_0x37bc7c['query'][_0xc08d('0x38')]));_0x507189[_0xc08d('0x36')]=_0x507189[_0xc08d('0x36')]['length']?_0x507189[_0xc08d('0x36')]:_0x4ddf66[_0xc08d('0x31')];_0x507189[_0xc08d('0x3c')]=qs[_0xc08d('0x3d')](_0x37bc7c[_0xc08d('0x34')]['sort']);_0x507189[_0xc08d('0x3e')]=qs['filters'](_[_0xc08d('0x3f')](_0x37bc7c[_0xc08d('0x34')],_0x4ddf66[_0xc08d('0x35')]));if(_0x37bc7c[_0xc08d('0x34')][_0xc08d('0x40')]){_0x507189[_0xc08d('0x3e')]=_['merge'](_0x507189[_0xc08d('0x3e')],{'$or':_[_0xc08d('0x32')](_0x507189['attributes'],function(_0x594203){var _0x24d874={};_0x24d874[_0x594203]={'$like':'%'+_0x37bc7c[_0xc08d('0x34')][_0xc08d('0x40')]+'%'};return _0x24d874;})});}_0x507189=_[_0xc08d('0x41')]({},_0x507189,_0x37bc7c[_0xc08d('0x43')]);return _0x5d0796[_0xc08d('0x59')](_0x507189);}})[_0xc08d('0x26')](function(_0x425ba6){if(_0x425ba6){_0x14605c=_0x425ba6[_0xc08d('0x39')];if(!_0x37bc7c[_0xc08d('0x34')]['hasOwnProperty']('nolimit')){_0x507189[_0xc08d('0x20')]=qs[_0xc08d('0x20')](_0x37bc7c['query'][_0xc08d('0x20')]);_0x507189['offset']=qs[_0xc08d('0x1e')](_0x37bc7c['query'][_0xc08d('0x1e')]);}return _0x5d0796[_0xc08d('0x59')](_0x507189);}})[_0xc08d('0x26')](function(_0x1e456d){if(_0x1e456d){return _0x1e456d?{'count':_0x14605c,'rows':_0x1e456d}:null;}})[_0xc08d('0x26')](respondWithResult(_0x36f776,null))[_0xc08d('0x4b')](handleError(_0x36f776,null));};exports[_0xc08d('0x5b')]=function(_0x4a1f5e,_0x40ab7a,_0x12b443){if(_0x4a1f5e[_0xc08d('0x55')]['id']){delete _0x4a1f5e[_0xc08d('0x55')]['id'];}return db[_0xc08d('0x2d')][_0xc08d('0x51')]({'where':{'id':_0x4a1f5e['params']['id']}})[_0xc08d('0x26')](handleEntityNotFound(_0x40ab7a,null))[_0xc08d('0x26')](function(_0x3dc3f0){if(_0x3dc3f0){_0x4a1f5e[_0xc08d('0x55')][_0xc08d('0x5c')]=_0x3dc3f0['id'];return db[_0xc08d('0x5d')][_0xc08d('0x4c')](_0x4a1f5e[_0xc08d('0x55')]);}})[_0xc08d('0x26')](respondWithResult(_0x40ab7a,null))[_0xc08d('0x4b')](handleError(_0x40ab7a,null));};exports['getActions']=function(_0x2d818b,_0x46c73f,_0x1690cb){var _0x335459={};var _0x2b762c={};var _0x287ab2;var _0x43c386;return db[_0xc08d('0x2d')][_0xc08d('0x5a')]({'where':{'id':_0x2d818b[_0xc08d('0x48')]['id']}})[_0xc08d('0x26')](handleEntityNotFound(_0x46c73f,null))[_0xc08d('0x26')](function(_0x46f610){if(_0x46f610){_0x287ab2=_0x46f610;_0x2b762c['model']=_['keys'](db['Action'][_0xc08d('0x49')]);_0x2b762c['query']=_['keys'](_0x2d818b[_0xc08d('0x34')]);_0x2b762c[_0xc08d('0x35')]=_[_0xc08d('0x37')](_0x2b762c['model'],_0x2b762c[_0xc08d('0x34')]);_0x335459[_0xc08d('0x36')]=_['intersection'](_0x2b762c[_0xc08d('0x31')],qs[_0xc08d('0x38')](_0x2d818b[_0xc08d('0x34')][_0xc08d('0x38')]));_0x335459[_0xc08d('0x36')]=_0x335459[_0xc08d('0x36')][_0xc08d('0x39')]?_0x335459[_0xc08d('0x36')]:_0x2b762c[_0xc08d('0x31')];_0x335459[_0xc08d('0x3c')]=qs[_0xc08d('0x3d')](_0x2d818b[_0xc08d('0x34')][_0xc08d('0x3d')]);_0x335459['where']=qs['filters'](_[_0xc08d('0x3f')](_0x2d818b['query'],_0x2b762c[_0xc08d('0x35')]));if(_0x2d818b['query'][_0xc08d('0x40')]){_0x335459['where']=_[_0xc08d('0x41')](_0x335459['where'],{'$or':_['map'](_0x335459[_0xc08d('0x36')],function(_0x4a1222){var _0x5b00af={};_0x5b00af[_0x4a1222]={'$like':'%'+_0x2d818b['query'][_0xc08d('0x40')]+'%'};return _0x5b00af;})});}_0x335459=_[_0xc08d('0x41')]({},_0x335459,_0x2d818b[_0xc08d('0x43')]);return _0x287ab2[_0xc08d('0x5e')](_0x335459);}})[_0xc08d('0x26')](function(_0x4af969){if(_0x4af969){_0x43c386=_0x4af969['length'];if(!_0x2d818b[_0xc08d('0x34')][_0xc08d('0x3a')](_0xc08d('0x3b'))){_0x335459[_0xc08d('0x20')]=qs[_0xc08d('0x20')](_0x2d818b['query']['limit']);_0x335459[_0xc08d('0x1e')]=qs['offset'](_0x2d818b[_0xc08d('0x34')][_0xc08d('0x1e')]);}return _0x287ab2[_0xc08d('0x5e')](_0x335459);}})[_0xc08d('0x26')](function(_0x4edd60){if(_0x4edd60){return _0x4edd60?{'count':_0x43c386,'rows':_0x4edd60}:null;}})['then'](respondWithResult(_0x46c73f,null))['catch'](handleError(_0x46c73f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 40e6eac..f6387f4 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 _0x8f1f=['bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','api','moment'];(function(_0x45f280,_0xd6d640){var _0x115e0a=function(_0x2d3664){while(--_0x2d3664){_0x45f280['push'](_0x45f280['shift']());}};_0x115e0a(++_0xd6d640);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x5b6405,_0x357964){_0x5b6405=_0x5b6405-0x0;var _0x484ee4=_0x8f1f[_0x5b6405];return _0x484ee4;};'use strict';var _=require(_0xf8f1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf8f1('0x1'));var moment=require(_0xf8f1('0x2'));var BPromise=require(_0xf8f1('0x3'));var rp=require(_0xf8f1('0x4'));var fs=require('fs');var path=require(_0xf8f1('0x5'));var rimraf=require(_0xf8f1('0x6'));var config=require(_0xf8f1('0x7'));var attributes=require(_0xf8f1('0x8'));module['exports']=function(_0x18a890,_0x1fee13){return _0x18a890[_0xf8f1('0x9')](_0xf8f1('0xa'),attributes,{'tableName':_0xf8f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff98=['request-promise','rimraf','./trigger.attributes','define','Trigger','tools_triggers','util','../../config/logger','api','moment'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xff98,0x9c));var _0x8ff9=function(_0x5757f5,_0x2d8065){_0x5757f5=_0x5757f5-0x0;var _0x58522e=_0xff98[_0x5757f5];return _0x58522e;};'use strict';var _=require('lodash');var util=require(_0x8ff9('0x0'));var logger=require(_0x8ff9('0x1'))(_0x8ff9('0x2'));var moment=require(_0x8ff9('0x3'));var BPromise=require('bluebird');var rp=require(_0x8ff9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ff9('0x5'));var config=require('../../config/environment');var attributes=require(_0x8ff9('0x6'));module['exports']=function(_0x7b1d31,_0x2c11a2){return _0x7b1d31[_0x8ff9('0x7')](_0x8ff9('0x8'),attributes,{'tableName':_0x8ff9('0x9'),'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 ac767ad..3cdfef2 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 _0x6eef=['request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','where','limit','include','attributes','model','GetTrigger','catch','ShowTrigger','find','map','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x551b1c,_0x3584f9){var _0x131273=function(_0x553185){while(--_0x553185){_0x551b1c['push'](_0x551b1c['shift']());}};_0x131273(++_0x3584f9);}(_0x6eef,0x153));var _0xf6ee=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0x6eef[_0x459b74];return _0x46cb16;};'use strict';var _=require('lodash');var util=require(_0xf6ee('0x0'));var moment=require(_0xf6ee('0x1'));var BPromise=require(_0xf6ee('0x2'));var rs=require(_0xf6ee('0x3'));var fs=require('fs');var Redis=require(_0xf6ee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6ee('0x5'));var logger=require(_0xf6ee('0x6'))(_0xf6ee('0x7'));var config=require(_0xf6ee('0x8'));var jayson=require(_0xf6ee('0x9'));var client=jayson[_0xf6ee('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x253ab0,_0xada913,_0x15b74d){return new BPromise(function(_0x58dfa6,_0x272aaa){return client[_0xf6ee('0xb')](_0x253ab0,_0x15b74d)[_0xf6ee('0xc')](function(_0x4f8559){logger[_0xf6ee('0xd')](_0xf6ee('0xe'),_0xada913,_0xf6ee('0xf'));logger[_0xf6ee('0x10')](_0xf6ee('0x11'),_0xada913,_0xf6ee('0xf'),JSON[_0xf6ee('0x12')](_0x4f8559));if(_0x4f8559[_0xf6ee('0x13')]){if(_0x4f8559[_0xf6ee('0x13')][_0xf6ee('0x14')]===0x1f4){logger[_0xf6ee('0x13')](_0xf6ee('0xe'),_0xada913,_0x4f8559[_0xf6ee('0x13')]['message']);return _0x272aaa(_0x4f8559['error'][_0xf6ee('0x15')]);}logger[_0xf6ee('0x13')](_0xf6ee('0xe'),_0xada913,_0x4f8559['error'][_0xf6ee('0x15')]);return _0x58dfa6(_0x4f8559['error'][_0xf6ee('0x15')]);}else{logger['info'](_0xf6ee('0xe'),_0xada913,'request\x20sent');_0x58dfa6(_0x4f8559[_0xf6ee('0x16')][_0xf6ee('0x15')]);}})['catch'](function(_0x206c77){logger[_0xf6ee('0x13')](_0xf6ee('0xe'),_0xada913,_0x206c77);_0x272aaa(_0x206c77);});});}exports['GetTrigger']=function(_0x21af4b){var _0x4c3c89=this;return new Promise(function(_0x39fda2,_0x121c53){return db['Trigger']['findAll']({'raw':_0x21af4b[_0xf6ee('0x17')]?_0x21af4b['options'][_0xf6ee('0x18')]===undefined?!![]:![]:!![],'where':_0x21af4b[_0xf6ee('0x17')]?_0x21af4b[_0xf6ee('0x17')][_0xf6ee('0x19')]||null:null,'attributes':_0x21af4b[_0xf6ee('0x17')]?_0x21af4b[_0xf6ee('0x17')]['attributes']||null:null,'limit':_0x21af4b[_0xf6ee('0x17')]?_0x21af4b[_0xf6ee('0x17')][_0xf6ee('0x1a')]||null:null,'include':_0x21af4b['options']?_0x21af4b[_0xf6ee('0x17')]['include']?_['map'](_0x21af4b[_0xf6ee('0x17')][_0xf6ee('0x1b')],function(_0x3bec12){return{'model':db[_0x3bec12['model']],'as':_0x3bec12['as'],'attributes':_0x3bec12[_0xf6ee('0x1c')],'include':_0x3bec12['include']?_['map'](_0x3bec12[_0xf6ee('0x1b')],function(_0xb7d01d){return{'model':db[_0xb7d01d[_0xf6ee('0x1d')]],'as':_0xb7d01d['as'],'attributes':_0xb7d01d[_0xf6ee('0x1c')],'include':_0xb7d01d[_0xf6ee('0x1b')]?_['map'](_0xb7d01d[_0xf6ee('0x1b')],function(_0x1c3daf){return{'model':db[_0x1c3daf[_0xf6ee('0x1d')]],'as':_0x1c3daf['as'],'attributes':_0x1c3daf[_0xf6ee('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c39d9){logger[_0xf6ee('0xd')](_0xf6ee('0x1e'),_0x21af4b);logger['debug']('GetTrigger',_0x21af4b,JSON[_0xf6ee('0x12')](_0x5c39d9));_0x39fda2(_0x5c39d9);})[_0xf6ee('0x1f')](function(_0x40d735){logger[_0xf6ee('0x13')](_0xf6ee('0x1e'),_0x40d735['message'],_0x21af4b);_0x121c53(_0x4c3c89['error'](0x1f4,_0x40d735['message']));});});};exports[_0xf6ee('0x20')]=function(_0x47a299){var _0x4571d0=this;return new Promise(function(_0x3908eb,_0x472dee){return db['Trigger'][_0xf6ee('0x21')]({'raw':_0x47a299[_0xf6ee('0x17')]?_0x47a299[_0xf6ee('0x17')][_0xf6ee('0x18')]===undefined?!![]:![]:!![],'where':_0x47a299[_0xf6ee('0x17')]?_0x47a299[_0xf6ee('0x17')][_0xf6ee('0x19')]||null:null,'attributes':_0x47a299['options']?_0x47a299[_0xf6ee('0x17')][_0xf6ee('0x1c')]||null:null,'include':_0x47a299[_0xf6ee('0x17')]?_0x47a299[_0xf6ee('0x17')][_0xf6ee('0x1b')]?_[_0xf6ee('0x22')](_0x47a299[_0xf6ee('0x17')]['include'],function(_0x587977){return{'model':db[_0x587977['model']],'as':_0x587977['as'],'attributes':_0x587977[_0xf6ee('0x1c')],'include':_0x587977[_0xf6ee('0x1b')]?_['map'](_0x587977['include'],function(_0x13e96c){return{'model':db[_0x13e96c[_0xf6ee('0x1d')]],'as':_0x13e96c['as'],'attributes':_0x13e96c[_0xf6ee('0x1c')],'include':_0x13e96c['include']?_['map'](_0x13e96c[_0xf6ee('0x1b')],function(_0x34d92b){return{'model':db[_0x34d92b['model']],'as':_0x34d92b['as'],'attributes':_0x34d92b[_0xf6ee('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf6ee('0xc')](function(_0x4d2e3c){logger['info'](_0xf6ee('0x20'),_0x47a299);logger[_0xf6ee('0x10')](_0xf6ee('0x20'),_0x47a299,JSON[_0xf6ee('0x12')](_0x4d2e3c));_0x3908eb(_0x4d2e3c);})[_0xf6ee('0x1f')](function(_0x3ecf86){logger['error'](_0xf6ee('0x20'),_0x3ecf86[_0xf6ee('0x15')],_0x47a299);_0x472dee(_0x4571d0[_0xf6ee('0x13')](0x1f4,_0x3ecf86[_0xf6ee('0x15')]));});});}; \ No newline at end of file +var _0x8545=['raw','where','attributes','limit','include','model','map','Trigger','ShowTrigger','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Trigger,\x20%s,\x20%s','result','catch','GetTrigger','findAll','options'];(function(_0x7880d2,_0x32e7d6){var _0x35ebbe=function(_0x5c27fa){while(--_0x5c27fa){_0x7880d2['push'](_0x7880d2['shift']());}};_0x35ebbe(++_0x32e7d6);}(_0x8545,0xb3));var _0x5854=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8545[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5854('0x0'));var BPromise=require(_0x5854('0x1'));var rs=require(_0x5854('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5854('0x3'))['db'];var utils=require(_0x5854('0x4'));var logger=require(_0x5854('0x5'))(_0x5854('0x6'));var config=require('../../config/environment');var jayson=require(_0x5854('0x7'));var client=jayson[_0x5854('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x322c57,_0xeb0e1f,_0x3e2914){return new BPromise(function(_0x5180f1,_0x37dec5){return client[_0x5854('0x9')](_0x322c57,_0x3e2914)[_0x5854('0xa')](function(_0x53db28){logger[_0x5854('0xb')]('Trigger,\x20%s,\x20%s',_0xeb0e1f,'request\x20sent');logger[_0x5854('0xc')](_0x5854('0xd'),_0xeb0e1f,_0x5854('0xe'),JSON[_0x5854('0xf')](_0x53db28));if(_0x53db28[_0x5854('0x10')]){if(_0x53db28[_0x5854('0x10')][_0x5854('0x11')]===0x1f4){logger[_0x5854('0x10')]('Trigger,\x20%s,\x20%s',_0xeb0e1f,_0x53db28[_0x5854('0x10')][_0x5854('0x12')]);return _0x37dec5(_0x53db28[_0x5854('0x10')][_0x5854('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0xeb0e1f,_0x53db28[_0x5854('0x10')]['message']);return _0x5180f1(_0x53db28['error'][_0x5854('0x12')]);}else{logger[_0x5854('0xb')](_0x5854('0x13'),_0xeb0e1f,_0x5854('0xe'));_0x5180f1(_0x53db28[_0x5854('0x14')][_0x5854('0x12')]);}})[_0x5854('0x15')](function(_0x2a96fb){logger[_0x5854('0x10')]('Trigger,\x20%s,\x20%s',_0xeb0e1f,_0x2a96fb);_0x37dec5(_0x2a96fb);});});}exports[_0x5854('0x16')]=function(_0x59f078){var _0x475dfc=this;return new Promise(function(_0xd9bab7,_0x565d5e){return db['Trigger'][_0x5854('0x17')]({'raw':_0x59f078[_0x5854('0x18')]?_0x59f078[_0x5854('0x18')][_0x5854('0x19')]===undefined?!![]:![]:!![],'where':_0x59f078['options']?_0x59f078[_0x5854('0x18')][_0x5854('0x1a')]||null:null,'attributes':_0x59f078[_0x5854('0x18')]?_0x59f078['options'][_0x5854('0x1b')]||null:null,'limit':_0x59f078[_0x5854('0x18')]?_0x59f078['options'][_0x5854('0x1c')]||null:null,'include':_0x59f078[_0x5854('0x18')]?_0x59f078[_0x5854('0x18')][_0x5854('0x1d')]?_['map'](_0x59f078[_0x5854('0x18')][_0x5854('0x1d')],function(_0x3b8006){return{'model':db[_0x3b8006['model']],'as':_0x3b8006['as'],'attributes':_0x3b8006[_0x5854('0x1b')],'include':_0x3b8006['include']?_['map'](_0x3b8006['include'],function(_0x457c1a){return{'model':db[_0x457c1a[_0x5854('0x1e')]],'as':_0x457c1a['as'],'attributes':_0x457c1a[_0x5854('0x1b')],'include':_0x457c1a['include']?_[_0x5854('0x1f')](_0x457c1a['include'],function(_0x495cda){return{'model':db[_0x495cda[_0x5854('0x1e')]],'as':_0x495cda['as'],'attributes':_0x495cda[_0x5854('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d93d3){logger[_0x5854('0xb')](_0x5854('0x16'),_0x59f078);logger['debug'](_0x5854('0x16'),_0x59f078,JSON[_0x5854('0xf')](_0x4d93d3));_0xd9bab7(_0x4d93d3);})[_0x5854('0x15')](function(_0x6d9c14){logger[_0x5854('0x10')](_0x5854('0x16'),_0x6d9c14[_0x5854('0x12')],_0x59f078);_0x565d5e(_0x475dfc[_0x5854('0x10')](0x1f4,_0x6d9c14[_0x5854('0x12')]));});});};exports['ShowTrigger']=function(_0x4ef0e7){var _0x21be6b=this;return new Promise(function(_0x2887bc,_0x39544a){return db[_0x5854('0x20')]['find']({'raw':_0x4ef0e7[_0x5854('0x18')]?_0x4ef0e7[_0x5854('0x18')][_0x5854('0x19')]===undefined?!![]:![]:!![],'where':_0x4ef0e7[_0x5854('0x18')]?_0x4ef0e7[_0x5854('0x18')][_0x5854('0x1a')]||null:null,'attributes':_0x4ef0e7['options']?_0x4ef0e7[_0x5854('0x18')][_0x5854('0x1b')]||null:null,'include':_0x4ef0e7[_0x5854('0x18')]?_0x4ef0e7[_0x5854('0x18')][_0x5854('0x1d')]?_[_0x5854('0x1f')](_0x4ef0e7[_0x5854('0x18')]['include'],function(_0x216182){return{'model':db[_0x216182['model']],'as':_0x216182['as'],'attributes':_0x216182['attributes'],'include':_0x216182[_0x5854('0x1d')]?_[_0x5854('0x1f')](_0x216182['include'],function(_0x4a71d7){return{'model':db[_0x4a71d7[_0x5854('0x1e')]],'as':_0x4a71d7['as'],'attributes':_0x4a71d7[_0x5854('0x1b')],'include':_0x4a71d7[_0x5854('0x1d')]?_[_0x5854('0x1f')](_0x4a71d7[_0x5854('0x1d')],function(_0x7d50d){return{'model':db[_0x7d50d['model']],'as':_0x7d50d['as'],'attributes':_0x7d50d[_0x5854('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5854('0xa')](function(_0x333818){logger[_0x5854('0xb')](_0x5854('0x21'),_0x4ef0e7);logger['debug'](_0x5854('0x21'),_0x4ef0e7,JSON[_0x5854('0xf')](_0x333818));_0x2887bc(_0x333818);})[_0x5854('0x15')](function(_0x190ff9){logger[_0x5854('0x10')](_0x5854('0x21'),_0x190ff9['message'],_0x4ef0e7);_0x39544a(_0x21be6b[_0x5854('0x10')](0x1f4,_0x190ff9[_0x5854('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6db1f58..06c2c4e 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 _0x10ae=['delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','post','clone','create','put','/:id','update'];(function(_0x10181b,_0x28a3a4){var _0x355732=function(_0x195e34){while(--_0x195e34){_0x10181b['push'](_0x10181b['shift']());}};_0x355732(++_0x28a3a4);}(_0x10ae,0x123));var _0xe10a=function(_0x1a2604,_0x1f0948){_0x1a2604=_0x1a2604-0x0;var _0x3d153d=_0x10ae[_0x1a2604];return _0x3d153d;};'use strict';var multer=require(_0xe10a('0x0'));var util=require('util');var path=require(_0xe10a('0x1'));var timeout=require(_0xe10a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe10a('0x3'));var auth=require(_0xe10a('0x4'));var interaction=require(_0xe10a('0x5'));var config=require('../../config/environment');var controller=require(_0xe10a('0x6'));router[_0xe10a('0x7')]('/',auth[_0xe10a('0x8')](),controller['index']);router[_0xe10a('0x7')]('/:id',auth[_0xe10a('0x8')](),controller['show']);router[_0xe10a('0x9')]('/:id/clone',auth['isAuthenticated'](),controller[_0xe10a('0xa')]);router[_0xe10a('0x9')]('/',auth[_0xe10a('0x8')](),controller[_0xe10a('0xb')]);router[_0xe10a('0xc')](_0xe10a('0xd'),auth[_0xe10a('0x8')](),controller[_0xe10a('0xe')]);router[_0xe10a('0xf')]('/:id',auth[_0xe10a('0x8')](),controller[_0xe10a('0x10')]);module[_0xe10a('0x11')]=router; \ No newline at end of file +var _0x0166=['multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id/clone','clone','post','create','update','/:id','destroy','exports'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0x0166,0xf0));var _0x6016=function(_0x46cfd0,_0x109ff3){_0x46cfd0=_0x46cfd0-0x0;var _0x18ab43=_0x0166[_0x46cfd0];return _0x18ab43;};'use strict';var multer=require(_0x6016('0x0'));var util=require(_0x6016('0x1'));var path=require(_0x6016('0x2'));var timeout=require('connect-timeout');var express=require(_0x6016('0x3'));var router=express['Router']();var fs_extra=require(_0x6016('0x4'));var auth=require(_0x6016('0x5'));var interaction=require(_0x6016('0x6'));var config=require(_0x6016('0x7'));var controller=require(_0x6016('0x8'));router[_0x6016('0x9')]('/',auth[_0x6016('0xa')](),controller[_0x6016('0xb')]);router[_0x6016('0x9')]('/:id',auth[_0x6016('0xa')](),controller['show']);router['post'](_0x6016('0xc'),auth[_0x6016('0xa')](),controller[_0x6016('0xd')]);router[_0x6016('0xe')]('/',auth[_0x6016('0xa')](),controller[_0x6016('0xf')]);router['put']('/:id',auth[_0x6016('0xa')](),controller[_0x6016('0x10')]);router['delete'](_0x6016('0x11'),auth[_0x6016('0xa')](),controller[_0x6016('0x12')]);module[_0x6016('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 1158466..a72a0af 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 _0x5f00=['from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','getDataValue','transport','split','rfc2833','info','inband','auto','yes','nonat','force_rport,comedia','nat','join','all','allow','ulaw;alaw;gsm','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','peer'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x5f00,0x120));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x05f0('0x0'));module[_0x05f0('0x1')]={'name':{'type':Sequelize[_0x05f0('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x4'),'user',_0x05f0('0x5')),'allowNull':![],'defaultValue':_0x05f0('0x4')},'context':{'type':Sequelize[_0x05f0('0x2')],'allowNull':![],'defaultValue':_0x05f0('0x6')},'callingpres':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x7'),_0x05f0('0x8'),_0x05f0('0x9'),_0x05f0('0xa'),_0x05f0('0xb'),_0x05f0('0xc'),'PROHIB_FAILED_SCREEN',_0x05f0('0xd'))},'deny':{'type':Sequelize[_0x05f0('0x2')]},'permit':{'type':Sequelize[_0x05f0('0x2')]},'secret':{'type':Sequelize[_0x05f0('0x2')]},'md5secret':{'type':Sequelize[_0x05f0('0x2')]},'remotesecret':{'type':Sequelize[_0x05f0('0x2')]},'transport':{'type':Sequelize[_0x05f0('0x2')],'defaultValue':_0x05f0('0xe'),'set':function(_0x786ad7){this[_0x05f0('0xf')]('transport',_0x786ad7?_0x786ad7['join'](','):null);},'get':function(){return this[_0x05f0('0x10')](_0x05f0('0x11'))?this['getDataValue'](_0x05f0('0x11'))[_0x05f0('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x13'),_0x05f0('0x14'),'shortinfo',_0x05f0('0x15'),_0x05f0('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no',_0x05f0('0x18'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x05f0('0x2')]},'nat':{'type':Sequelize[_0x05f0('0x2')],'defaultValue':_0x05f0('0x19'),'set':function(_0x35f917){this[_0x05f0('0xf')](_0x05f0('0x1a'),_0x35f917?_0x35f917[_0x05f0('0x1b')](','):null);},'get':function(){return this[_0x05f0('0x10')](_0x05f0('0x1a'))?this[_0x05f0('0x10')](_0x05f0('0x1a'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x05f0('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x05f0('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x05f0('0x2')]},'language':{'type':Sequelize[_0x05f0('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x05f0('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x05f0('0x2')],'defaultValue':_0x05f0('0x1c')},'allow':{'type':Sequelize[_0x05f0('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1efda8){this[_0x05f0('0xf')](_0x05f0('0x1d'),_0x1efda8?_0x1efda8[_0x05f0('0x1b')](';'):_0x05f0('0x1e'));},'get':function(){return this[_0x05f0('0x10')](_0x05f0('0x1d'))?this[_0x05f0('0x10')](_0x05f0('0x1d'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'insecure':{'type':Sequelize[_0x05f0('0x2')],'defaultValue':_0x05f0('0x1f'),'set':function(_0xcb3845){this['setDataValue'](_0x05f0('0x20'),_0xcb3845?_0xcb3845[_0x05f0('0x1b')](','):null);},'get':function(){return this['getDataValue'](_0x05f0('0x20'))?this[_0x05f0('0x10')]('insecure')[_0x05f0('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x05f0('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x05f0('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no',_0x05f0('0x21'))},'promiscredir':{'type':Sequelize['ENUM'](_0x05f0('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'accountcode':{'type':Sequelize[_0x05f0('0x22')](0xb)},'setvar':{'type':Sequelize[_0x05f0('0x2')]},'callerid':{'type':Sequelize[_0x05f0('0x2')],'defaultValue':_0x05f0('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x05f0('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x05f0('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x05f0('0x2')]},'videosupport':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no',_0x05f0('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x05f0('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x25'),'refuse',_0x05f0('0x26'))},'session_expires':{'type':Sequelize[_0x05f0('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x05f0('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x27'),_0x05f0('0x28')),'defaultValue':_0x05f0('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x05f0('0x2')]},'regexten':{'type':Sequelize[_0x05f0('0x2')]},'fromdomain':{'type':Sequelize[_0x05f0('0x2')]},'fromuser':{'type':Sequelize[_0x05f0('0x2')]},'port':{'type':Sequelize[_0x05f0('0x22')](0x5)},'qualify':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no'),'defaultValue':_0x05f0('0x17')},'keepalive':{'type':Sequelize[_0x05f0('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x05f0('0x2')]},'defaultuser':{'type':Sequelize[_0x05f0('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x05f0('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x05f0('0x22')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x05f0('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x05f0('0x2')]},'callbackextension':{'type':Sequelize[_0x05f0('0x2')]},'timert1':{'type':Sequelize[_0x05f0('0x22')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x05f0('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x05f0('0x2')]},'contactdeny':{'type':Sequelize[_0x05f0('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x05f0('0x2')]},'use_q850_reason':{'type':Sequelize[_0x05f0('0x2')]},'maxforwards':{'type':Sequelize[_0x05f0('0x22')](0xb)},'encryption':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'force_avp':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x05f0('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no','fingerprint',_0x05f0('0x29'))},'dtlsrekey':{'type':Sequelize[_0x05f0('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x05f0('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x05f0('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x2a'),_0x05f0('0x2b'),_0x05f0('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x05f0('0x2')]},'usereqphone':{'type':Sequelize[_0x05f0('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x05f0('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x05f0('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x05f0('0x3')](_0x05f0('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x05f0('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x05f0('0x2')]},'mohinterpret':{'type':Sequelize[_0x05f0('0x2')]},'mohsuggest':{'type':Sequelize[_0x05f0('0x2')]},'parkinglot':{'type':Sequelize[_0x05f0('0x2')]},'description':{'type':Sequelize[_0x05f0('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x05f0('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0x05f0('0x17'),'no',_0x05f0('0x18'),_0x05f0('0x2e'),_0x05f0('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x05f0('0x2')]},'otherFields':{'type':Sequelize[_0x05f0('0x2')]},'active':{'type':Sequelize[_0x05f0('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x05f0('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x93ee=['update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','force_rport,comedia','nat','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','INTEGER','accept','refuse','uas','fingerprint','passive','actpass'];(function(_0x224a93,_0x5ef65b){var _0x27c59c=function(_0x434048){while(--_0x434048){_0x224a93['push'](_0x224a93['shift']());}};_0x27c59c(++_0x5ef65b);}(_0x93ee,0x159));var _0xe93e=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x93ee[_0x5db313];return _0x36d503;};'use strict';var Sequelize=require(_0xe93e('0x0'));module[_0xe93e('0x1')]={'name':{'type':Sequelize[_0xe93e('0x2')],'allowNull':![],'unique':_0xe93e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x5'),_0xe93e('0x6'),_0xe93e('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe93e('0x2')],'allowNull':![],'defaultValue':_0xe93e('0x8')},'callingpres':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x9'),_0xe93e('0xa'),_0xe93e('0xb'),_0xe93e('0xc'),_0xe93e('0xd'),_0xe93e('0xe'),_0xe93e('0xf'),_0xe93e('0x10'))},'deny':{'type':Sequelize[_0xe93e('0x2')]},'permit':{'type':Sequelize[_0xe93e('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xe93e('0x2')]},'transport':{'type':Sequelize[_0xe93e('0x2')],'defaultValue':_0xe93e('0x11'),'set':function(_0xdcbd70){this[_0xe93e('0x12')](_0xe93e('0x13'),_0xdcbd70?_0xdcbd70[_0xe93e('0x14')](','):null);},'get':function(){return this[_0xe93e('0x15')](_0xe93e('0x13'))?this[_0xe93e('0x15')](_0xe93e('0x13'))[_0xe93e('0x16')](','):null;},'comment':_0xe93e('0x17')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xe93e('0x18'),_0xe93e('0x19'),_0xe93e('0x1a'),_0xe93e('0x1b')),'defaultValue':_0xe93e('0x1c')},'directmedia':{'type':Sequelize['ENUM'](_0xe93e('0x1d'),'no',_0xe93e('0x1e'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe93e('0x2')]},'directmediadeny':{'type':Sequelize[_0xe93e('0x2')]},'nat':{'type':Sequelize[_0xe93e('0x2')],'defaultValue':_0xe93e('0x1f'),'set':function(_0x89abec){this[_0xe93e('0x12')](_0xe93e('0x20'),_0x89abec?_0x89abec[_0xe93e('0x14')](','):null);},'get':function(){return this[_0xe93e('0x15')](_0xe93e('0x20'))?this[_0xe93e('0x15')](_0xe93e('0x20'))[_0xe93e('0x16')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe93e('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe93e('0x2')]},'pickupgroup':{'type':Sequelize[_0xe93e('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe93e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe93e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe93e('0x2')],'allowNull':![],'defaultValue':_0xe93e('0x21'),'set':function(_0x43caf8){this[_0xe93e('0x12')](_0xe93e('0x22'),_0x43caf8?_0x43caf8[_0xe93e('0x14')](';'):_0xe93e('0x21'));},'get':function(){return this['getDataValue'](_0xe93e('0x22'))?this[_0xe93e('0x15')](_0xe93e('0x22'))[_0xe93e('0x16')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xe93e('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xe93e('0x2')],'defaultValue':_0xe93e('0x23'),'set':function(_0x4cc7fc){this[_0xe93e('0x12')](_0xe93e('0x24'),_0x4cc7fc?_0x4cc7fc[_0xe93e('0x14')](','):null);},'get':function(){return this[_0xe93e('0x15')](_0xe93e('0x24'))?this['getDataValue'](_0xe93e('0x24'))[_0xe93e('0x16')](','):null;},'comment':_0xe93e('0x25')},'trustrpid':{'type':Sequelize[_0xe93e('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe93e('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xe93e('0x1d'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xe93e('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xe93e('0x26')},'amaflags':{'type':Sequelize[_0xe93e('0x2')]},'callcounter':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'allowsubscribe':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'allowtransfer':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'subscribecontext':{'type':Sequelize[_0xe93e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no',_0xe93e('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe93e('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x29'),_0xe93e('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0xe93e('0x28')](0xb)},'session_minse':{'type':Sequelize[_0xe93e('0x28')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xe93e('0x2b')),'defaultValue':_0xe93e('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xe93e('0x2')]},'regexten':{'type':Sequelize[_0xe93e('0x2')]},'fromdomain':{'type':Sequelize[_0xe93e('0x2')]},'fromuser':{'type':Sequelize[_0xe93e('0x2')]},'port':{'type':Sequelize[_0xe93e('0x28')](0x5)},'qualify':{'type':Sequelize[_0xe93e('0x4')]('yes','no'),'defaultValue':_0xe93e('0x1d')},'keepalive':{'type':Sequelize[_0xe93e('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xe93e('0x2')]},'defaultuser':{'type':Sequelize[_0xe93e('0x2')]},'rtptimeout':{'type':Sequelize[_0xe93e('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe93e('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe93e('0x2')]},'callbackextension':{'type':Sequelize[_0xe93e('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xe93e('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe93e('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xe93e('0x2')]},'contactdeny':{'type':Sequelize[_0xe93e('0x2')]},'contactacl':{'type':Sequelize[_0xe93e('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xe93e('0x2')]},'maxforwards':{'type':Sequelize[_0xe93e('0x28')](0xb)},'encryption':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xe93e('0x1d'),'no')},'icesupport':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xe93e('0x1d'),'no')},'dtlsverify':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no',_0xe93e('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xe93e('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xe93e('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xe93e('0x2d'),_0xe93e('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe93e('0x2')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xe93e('0x2')]},'call_limit':{'type':Sequelize[_0xe93e('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'subscribemwi':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no')},'vmexten':{'type':Sequelize[_0xe93e('0x2')]},'mohinterpret':{'type':Sequelize[_0xe93e('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xe93e('0x2')]},'description':{'type':Sequelize[_0xe93e('0x2')]},'host':{'type':Sequelize[_0xe93e('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xe93e('0x4')](_0xe93e('0x1d'),'no',_0xe93e('0x1e'),'update',_0xe93e('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xe93e('0x2')]},'active':{'type':Sequelize[_0xe93e('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe93e('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 372dc66..06e5aa0 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 _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x87107a,_0x3f6a1e){var _0x417412=function(_0x8f0fe9){while(--_0x8f0fe9){_0x87107a['push'](_0x87107a['shift']());}};_0x417412(++_0x3f6a1e);}(_0xbec5,0xe5));var _0x5bec=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xbec5[_0x8af54b];return _0x27d8f0;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x18e25f,_0x296baa){var _0x419f99=function(_0x5b5a3d){while(--_0x5b5a3d){_0x18e25f['push'](_0x18e25f['shift']());}};_0x419f99(++_0x296baa);}(_0x98a8,0x12c));var _0x898a=function(_0x450ae1,_0x19eb8d){_0x450ae1=_0x450ae1-0x0;var _0x130c27=_0x98a8[_0x450ae1];return _0x130c27;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 4baea5d..0a7ad8e 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 _0xd548=['rimraf','../../config/environment','tools_trunks','util','../../config/logger','api','bluebird','path'];(function(_0x2e2110,_0x592465){var _0x57db5f=function(_0x452d1b){while(--_0x452d1b){_0x2e2110['push'](_0x2e2110['shift']());}};_0x57db5f(++_0x592465);}(_0xd548,0x1a3));var _0x8d54=function(_0x15339a,_0x480de2){_0x15339a=_0x15339a-0x0;var _0x3e84bf=_0xd548[_0x15339a];return _0x3e84bf;};'use strict';var _=require('lodash');var util=require(_0x8d54('0x0'));var logger=require(_0x8d54('0x1'))(_0x8d54('0x2'));var moment=require('moment');var BPromise=require(_0x8d54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d54('0x4'));var rimraf=require(_0x8d54('0x5'));var config=require(_0x8d54('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x4841a9,_0x28fa30){return _0x4841a9['define']('Trunk',attributes,{'tableName':_0x8d54('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ac6=['moment','bluebird','request-promise','path','../../config/environment','define','tools_trunks','lodash','util','../../config/logger'];(function(_0x4ad09b,_0x5c13ad){var _0x4c7f5d=function(_0x89c1c7){while(--_0x89c1c7){_0x4ad09b['push'](_0x4ad09b['shift']());}};_0x4c7f5d(++_0x5c13ad);}(_0x9ac6,0xf7));var _0x69ac=function(_0x5e6e4e,_0x33305f){_0x5e6e4e=_0x5e6e4e-0x0;var _0x5e132e=_0x9ac6[_0x5e6e4e];return _0x5e132e;};'use strict';var _=require(_0x69ac('0x0'));var util=require(_0x69ac('0x1'));var logger=require(_0x69ac('0x2'))('api');var moment=require(_0x69ac('0x3'));var BPromise=require(_0x69ac('0x4'));var rp=require(_0x69ac('0x5'));var fs=require('fs');var path=require(_0x69ac('0x6'));var rimraf=require('rimraf');var config=require(_0x69ac('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0x3b4d54,_0xf21cba){return _0x3b4d54[_0x69ac('0x8')]('Trunk',attributes,{'tableName':_0x69ac('0x9'),'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 5d8eb34..a5e8d77 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 _0xf874=['findAll','options','where','attributes','include','model','map','then','GetTrunk','catch','ShowTrunk','find','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','Trunk'];(function(_0xc84b99,_0x53543a){var _0x23677f=function(_0x39c16f){while(--_0x39c16f){_0xc84b99['push'](_0xc84b99['shift']());}};_0x23677f(++_0x53543a);}(_0xf874,0x135));var _0x4f87=function(_0x33727f,_0x51756c){_0x33727f=_0x33727f-0x0;var _0x554715=_0xf874[_0x33727f];return _0x554715;};'use strict';var _=require('lodash');var util=require(_0x4f87('0x0'));var moment=require('moment');var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f87('0x5'));var config=require(_0x4f87('0x6'));var jayson=require(_0x4f87('0x7'));var client=jayson[_0x4f87('0x8')][_0x4f87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178536,_0x241730,_0x496c28){return new BPromise(function(_0x448ec0,_0x5d5caf){return client['request'](_0x178536,_0x496c28)['then'](function(_0x406789){logger[_0x4f87('0xa')]('Trunk,\x20%s,\x20%s',_0x241730,_0x4f87('0xb'));logger[_0x4f87('0xc')](_0x4f87('0xd'),_0x241730,'request\x20sent',JSON[_0x4f87('0xe')](_0x406789));if(_0x406789[_0x4f87('0xf')]){if(_0x406789['error'][_0x4f87('0x10')]===0x1f4){logger[_0x4f87('0xf')](_0x4f87('0x11'),_0x241730,_0x406789[_0x4f87('0xf')][_0x4f87('0x12')]);return _0x5d5caf(_0x406789[_0x4f87('0xf')][_0x4f87('0x12')]);}logger[_0x4f87('0xf')](_0x4f87('0x11'),_0x241730,_0x406789['error'][_0x4f87('0x12')]);return _0x448ec0(_0x406789[_0x4f87('0xf')][_0x4f87('0x12')]);}else{logger[_0x4f87('0xa')](_0x4f87('0x11'),_0x241730,_0x4f87('0xb'));_0x448ec0(_0x406789[_0x4f87('0x13')][_0x4f87('0x12')]);}})['catch'](function(_0x579a4e){logger[_0x4f87('0xf')](_0x4f87('0x11'),_0x241730,_0x579a4e);_0x5d5caf(_0x579a4e);});});}exports['GetTrunk']=function(_0x3d9f32){var _0x4ead3c=this;return new Promise(function(_0x577071,_0x4d4ab5){return db[_0x4f87('0x14')][_0x4f87('0x15')]({'raw':_0x3d9f32[_0x4f87('0x16')]?_0x3d9f32['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d9f32['options']?_0x3d9f32[_0x4f87('0x16')][_0x4f87('0x17')]||null:null,'attributes':_0x3d9f32[_0x4f87('0x16')]?_0x3d9f32[_0x4f87('0x16')][_0x4f87('0x18')]||null:null,'limit':_0x3d9f32[_0x4f87('0x16')]?_0x3d9f32['options']['limit']||null:null,'include':_0x3d9f32[_0x4f87('0x16')]?_0x3d9f32['options'][_0x4f87('0x19')]?_['map'](_0x3d9f32[_0x4f87('0x16')][_0x4f87('0x19')],function(_0x5ed3b2){return{'model':db[_0x5ed3b2[_0x4f87('0x1a')]],'as':_0x5ed3b2['as'],'attributes':_0x5ed3b2['attributes'],'include':_0x5ed3b2[_0x4f87('0x19')]?_[_0x4f87('0x1b')](_0x5ed3b2['include'],function(_0x30b07d){return{'model':db[_0x30b07d[_0x4f87('0x1a')]],'as':_0x30b07d['as'],'attributes':_0x30b07d['attributes'],'include':_0x30b07d[_0x4f87('0x19')]?_[_0x4f87('0x1b')](_0x30b07d[_0x4f87('0x19')],function(_0x550277){return{'model':db[_0x550277[_0x4f87('0x1a')]],'as':_0x550277['as'],'attributes':_0x550277[_0x4f87('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4f87('0x1c')](function(_0x416b0b){logger[_0x4f87('0xa')](_0x4f87('0x1d'),_0x3d9f32);logger['debug']('GetTrunk',_0x3d9f32,JSON[_0x4f87('0xe')](_0x416b0b));_0x577071(_0x416b0b);})[_0x4f87('0x1e')](function(_0x63ccd5){logger[_0x4f87('0xf')](_0x4f87('0x1d'),_0x63ccd5['message'],_0x3d9f32);_0x4d4ab5(_0x4ead3c[_0x4f87('0xf')](0x1f4,_0x63ccd5[_0x4f87('0x12')]));});});};exports[_0x4f87('0x1f')]=function(_0x34e9fd){var _0x4c58fd=this;return new Promise(function(_0x41e2da,_0x27498d){return db[_0x4f87('0x14')][_0x4f87('0x20')]({'raw':_0x34e9fd['options']?_0x34e9fd[_0x4f87('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x34e9fd[_0x4f87('0x16')]?_0x34e9fd[_0x4f87('0x16')][_0x4f87('0x17')]||null:null,'attributes':_0x34e9fd['options']?_0x34e9fd['options'][_0x4f87('0x18')]||null:null,'include':_0x34e9fd[_0x4f87('0x16')]?_0x34e9fd[_0x4f87('0x16')][_0x4f87('0x19')]?_[_0x4f87('0x1b')](_0x34e9fd[_0x4f87('0x16')][_0x4f87('0x19')],function(_0x261351){return{'model':db[_0x261351[_0x4f87('0x1a')]],'as':_0x261351['as'],'attributes':_0x261351[_0x4f87('0x18')],'include':_0x261351[_0x4f87('0x19')]?_['map'](_0x261351[_0x4f87('0x19')],function(_0x4025aa){return{'model':db[_0x4025aa[_0x4f87('0x1a')]],'as':_0x4025aa['as'],'attributes':_0x4025aa[_0x4f87('0x18')],'include':_0x4025aa[_0x4f87('0x19')]?_[_0x4f87('0x1b')](_0x4025aa[_0x4f87('0x19')],function(_0x49db8b){return{'model':db[_0x49db8b[_0x4f87('0x1a')]],'as':_0x49db8b['as'],'attributes':_0x49db8b[_0x4f87('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x559041){logger[_0x4f87('0xa')]('ShowTrunk',_0x34e9fd);logger[_0x4f87('0xc')](_0x4f87('0x1f'),_0x34e9fd,JSON[_0x4f87('0xe')](_0x559041));_0x41e2da(_0x559041);})['catch'](function(_0x79c916){logger[_0x4f87('0xf')](_0x4f87('0x1f'),_0x79c916['message'],_0x34e9fd);_0x27498d(_0x4c58fd['error'](0x1f4,_0x79c916[_0x4f87('0x12')]));});});}; \ No newline at end of file +var _0x696f=['request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','Trunk','findAll','options','raw','where','attributes','map','include','model','GetTrunk','debug','stringify','catch','ShowTrunk','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s'];(function(_0x1e2dc3,_0x3c5f99){var _0x143804=function(_0x2456e6){while(--_0x2456e6){_0x1e2dc3['push'](_0x1e2dc3['shift']());}};_0x143804(++_0x3c5f99);}(_0x696f,0x1b9));var _0xf696=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x696f[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf696('0x0'));var rs=require(_0xf696('0x1'));var fs=require('fs');var Redis=require(_0xf696('0x2'));var db=require(_0xf696('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf696('0x4'))(_0xf696('0x5'));var config=require(_0xf696('0x6'));var jayson=require(_0xf696('0x7'));var client=jayson[_0xf696('0x8')][_0xf696('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d63d9,_0x44ae1e,_0x7c5d18){return new BPromise(function(_0xbbec31,_0x55c280){return client[_0xf696('0xa')](_0x3d63d9,_0x7c5d18)[_0xf696('0xb')](function(_0x571f36){logger[_0xf696('0xc')](_0xf696('0xd'),_0x44ae1e,_0xf696('0xe'));logger['debug'](_0xf696('0xf'),_0x44ae1e,_0xf696('0xe'),JSON['stringify'](_0x571f36));if(_0x571f36[_0xf696('0x10')]){if(_0x571f36['error'][_0xf696('0x11')]===0x1f4){logger[_0xf696('0x10')](_0xf696('0xd'),_0x44ae1e,_0x571f36['error'][_0xf696('0x12')]);return _0x55c280(_0x571f36[_0xf696('0x10')][_0xf696('0x12')]);}logger[_0xf696('0x10')](_0xf696('0xd'),_0x44ae1e,_0x571f36[_0xf696('0x10')]['message']);return _0xbbec31(_0x571f36[_0xf696('0x10')][_0xf696('0x12')]);}else{logger[_0xf696('0xc')](_0xf696('0xd'),_0x44ae1e,_0xf696('0xe'));_0xbbec31(_0x571f36[_0xf696('0x13')]['message']);}})['catch'](function(_0x2f28fb){logger[_0xf696('0x10')](_0xf696('0xd'),_0x44ae1e,_0x2f28fb);_0x55c280(_0x2f28fb);});});}exports['GetTrunk']=function(_0x2692c6){var _0x4ea140=this;return new Promise(function(_0x45c879,_0x2a8daf){return db[_0xf696('0x14')][_0xf696('0x15')]({'raw':_0x2692c6[_0xf696('0x16')]?_0x2692c6[_0xf696('0x16')][_0xf696('0x17')]===undefined?!![]:![]:!![],'where':_0x2692c6[_0xf696('0x16')]?_0x2692c6['options'][_0xf696('0x18')]||null:null,'attributes':_0x2692c6['options']?_0x2692c6['options'][_0xf696('0x19')]||null:null,'limit':_0x2692c6[_0xf696('0x16')]?_0x2692c6[_0xf696('0x16')]['limit']||null:null,'include':_0x2692c6[_0xf696('0x16')]?_0x2692c6[_0xf696('0x16')]['include']?_[_0xf696('0x1a')](_0x2692c6[_0xf696('0x16')][_0xf696('0x1b')],function(_0x51df48){return{'model':db[_0x51df48['model']],'as':_0x51df48['as'],'attributes':_0x51df48['attributes'],'include':_0x51df48['include']?_[_0xf696('0x1a')](_0x51df48[_0xf696('0x1b')],function(_0x2776e2){return{'model':db[_0x2776e2[_0xf696('0x1c')]],'as':_0x2776e2['as'],'attributes':_0x2776e2[_0xf696('0x19')],'include':_0x2776e2['include']?_[_0xf696('0x1a')](_0x2776e2[_0xf696('0x1b')],function(_0x3cbeac){return{'model':db[_0x3cbeac[_0xf696('0x1c')]],'as':_0x3cbeac['as'],'attributes':_0x3cbeac[_0xf696('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d7fd9){logger[_0xf696('0xc')](_0xf696('0x1d'),_0x2692c6);logger[_0xf696('0x1e')]('GetTrunk',_0x2692c6,JSON[_0xf696('0x1f')](_0x4d7fd9));_0x45c879(_0x4d7fd9);})[_0xf696('0x20')](function(_0x2cb2b0){logger[_0xf696('0x10')](_0xf696('0x1d'),_0x2cb2b0[_0xf696('0x12')],_0x2692c6);_0x2a8daf(_0x4ea140[_0xf696('0x10')](0x1f4,_0x2cb2b0[_0xf696('0x12')]));});});};exports[_0xf696('0x21')]=function(_0xf9f747){var _0x4e35ae=this;return new Promise(function(_0x399344,_0x19bd39){return db[_0xf696('0x14')][_0xf696('0x22')]({'raw':_0xf9f747[_0xf696('0x16')]?_0xf9f747[_0xf696('0x16')][_0xf696('0x17')]===undefined?!![]:![]:!![],'where':_0xf9f747[_0xf696('0x16')]?_0xf9f747[_0xf696('0x16')][_0xf696('0x18')]||null:null,'attributes':_0xf9f747[_0xf696('0x16')]?_0xf9f747[_0xf696('0x16')][_0xf696('0x19')]||null:null,'include':_0xf9f747['options']?_0xf9f747[_0xf696('0x16')][_0xf696('0x1b')]?_[_0xf696('0x1a')](_0xf9f747[_0xf696('0x16')]['include'],function(_0xd87aca){return{'model':db[_0xd87aca[_0xf696('0x1c')]],'as':_0xd87aca['as'],'attributes':_0xd87aca[_0xf696('0x19')],'include':_0xd87aca['include']?_['map'](_0xd87aca['include'],function(_0x150e70){return{'model':db[_0x150e70['model']],'as':_0x150e70['as'],'attributes':_0x150e70[_0xf696('0x19')],'include':_0x150e70[_0xf696('0x1b')]?_['map'](_0x150e70[_0xf696('0x1b')],function(_0xd69a5d){return{'model':db[_0xd69a5d[_0xf696('0x1c')]],'as':_0xd69a5d['as'],'attributes':_0xd69a5d[_0xf696('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf696('0xb')](function(_0x4181ec){logger[_0xf696('0xc')](_0xf696('0x21'),_0xf9f747);logger[_0xf696('0x1e')](_0xf696('0x21'),_0xf9f747,JSON[_0xf696('0x1f')](_0x4181ec));_0x399344(_0x4181ec);})[_0xf696('0x20')](function(_0x58a279){logger[_0xf696('0x10')](_0xf696('0x21'),_0x58a279[_0xf696('0x12')],_0xf9f747);_0x19bd39(_0x4e35ae[_0xf696('0x10')](0x1f4,_0x58a279[_0xf696('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 620db47..e40f202 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 _0xe30e=['now','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addSquareProjects','put','/:id','update','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','/whoami','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','join','server/files/images/','format'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xe30e,0x1f4));var _0xee30=function(_0x4fb789,_0x6b8092){_0x4fb789=_0x4fb789-0x0;var _0x49b5e4=_0xe30e[_0x4fb789];return _0x49b5e4;};'use strict';var multer=require(_0xee30('0x0'));var util=require('util');var path=require(_0xee30('0x1'));var timeout=require(_0xee30('0x2'));var express=require('express');var router=express[_0xee30('0x3')]();var fs_extra=require(_0xee30('0x4'));var auth=require(_0xee30('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router[_0xee30('0x6')]('/',auth[_0xee30('0x7')](),controller['index']);router[_0xee30('0x6')](_0xee30('0x8'),auth[_0xee30('0x7')](),controller['describe']);router[_0xee30('0x6')](_0xee30('0x9'),auth[_0xee30('0x7')](),controller[_0xee30('0xa')]);router[_0xee30('0x6')](_0xee30('0xb'),auth[_0xee30('0x7')](),controller[_0xee30('0xc')]);router[_0xee30('0x6')]('/:id',auth[_0xee30('0x7')](),controller[_0xee30('0xd')]);router['get'](_0xee30('0xe'),controller[_0xee30('0xf')]);router[_0xee30('0x6')](_0xee30('0x10'),auth[_0xee30('0x7')](),controller['getOpenTabs']);router[_0xee30('0x6')](_0xee30('0x11'),auth[_0xee30('0x7')](),controller[_0xee30('0x12')]);router[_0xee30('0x6')](_0xee30('0x13'),auth['isAuthenticated'](),controller[_0xee30('0x14')]);router[_0xee30('0x6')](_0xee30('0x15'),auth[_0xee30('0x7')](),controller[_0xee30('0x16')]);router[_0xee30('0x6')](_0xee30('0x17'),auth[_0xee30('0x7')](),controller[_0xee30('0x18')]);router[_0xee30('0x6')](_0xee30('0x19'),auth[_0xee30('0x7')](),controller[_0xee30('0x1a')]);router[_0xee30('0x6')](_0xee30('0x1b'),auth[_0xee30('0x7')](),controller[_0xee30('0x1c')]);router['get'](_0xee30('0x1d'),auth[_0xee30('0x7')](),controller[_0xee30('0x1e')]);router['get'](_0xee30('0x1f'),auth[_0xee30('0x7')](),controller['getOpenchannelInteractions']);router[_0xee30('0x6')](_0xee30('0x20'),auth['isAuthenticated'](),controller[_0xee30('0x21')]);router[_0xee30('0x6')](_0xee30('0x22'),auth[_0xee30('0x7')](),controller[_0xee30('0x23')]);router['get'](_0xee30('0x24'),auth[_0xee30('0x7')](),controller[_0xee30('0x25')]);router['get'](_0xee30('0x26'),auth[_0xee30('0x7')](),controller[_0xee30('0x27')]);router['get'](_0xee30('0x28'),auth['isAuthenticated'](),controller['getTeams']);router[_0xee30('0x6')](_0xee30('0x29'),auth[_0xee30('0x7')](),controller[_0xee30('0x2a')]);router['get'](_0xee30('0x2b'),auth[_0xee30('0x7')](),controller[_0xee30('0x2c')]);router[_0xee30('0x6')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xee30('0x2d')]);router[_0xee30('0x6')](_0xee30('0x2e'),auth['isAuthenticated'](),controller[_0xee30('0x2f')]);router[_0xee30('0x6')](_0xee30('0x30'),auth[_0xee30('0x7')](),controller['getMailAccounts']);router[_0xee30('0x6')](_0xee30('0x31'),auth[_0xee30('0x7')](),controller[_0xee30('0x32')]);router[_0xee30('0x6')](_0xee30('0x33'),auth[_0xee30('0x7')](),controller[_0xee30('0x34')]);router[_0xee30('0x6')](_0xee30('0x35'),auth[_0xee30('0x7')](),controller[_0xee30('0x36')]);router[_0xee30('0x6')](_0xee30('0x37'),auth[_0xee30('0x7')](),controller[_0xee30('0x38')]);router['get'](_0xee30('0x39'),auth[_0xee30('0x7')](),controller[_0xee30('0x3a')]);router['get'](_0xee30('0x3b'),auth[_0xee30('0x7')](),controller[_0xee30('0x3c')]);router[_0xee30('0x6')](_0xee30('0x3d'),auth[_0xee30('0x7')](),controller['getApiKey']);router[_0xee30('0x3e')](_0xee30('0x11'),auth[_0xee30('0x7')](),controller[_0xee30('0x3f')]);router[_0xee30('0x3e')]('/',auth[_0xee30('0x7')](),controller[_0xee30('0x40')]);router[_0xee30('0x3e')](_0xee30('0x41'),auth[_0xee30('0x7')](),controller[_0xee30('0x42')]);router[_0xee30('0x3e')](_0xee30('0x13'),auth[_0xee30('0x7')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4dfab1,_0x55f3af,_0x465997){_0x465997(null,path[_0xee30('0x43')](config['root'],_0xee30('0x44')));},'filename':function(_0x2d8019,_0x59649c,_0x53a19c){_0x53a19c(null,util[_0xee30('0x45')]('%s-%s',Date[_0xee30('0x46')](),_0x59649c['originalname']));}})});router[_0xee30('0x3e')](_0xee30('0xe'),upload[_0xee30('0x47')](_0xee30('0x48')),controller[_0xee30('0x49')]);router[_0xee30('0x3e')](_0xee30('0x4a'),auth[_0xee30('0x7')](),controller[_0xee30('0x4b')]);router[_0xee30('0x3e')](_0xee30('0x4c'),auth[_0xee30('0x7')](),controller['logout']);router[_0xee30('0x3e')](_0xee30('0x4d'),auth[_0xee30('0x7')](),controller[_0xee30('0x4e')]);router['post']('/:id/unpause',auth[_0xee30('0x7')](),controller[_0xee30('0x4f')]);router[_0xee30('0x3e')](_0xee30('0x28'),auth['isAuthenticated'](),controller['addTeams']);router[_0xee30('0x3e')]('/:id/chat_interactions',auth[_0xee30('0x7')](),controller[_0xee30('0x50')]);router[_0xee30('0x3e')](_0xee30('0x51'),auth[_0xee30('0x7')](),controller[_0xee30('0x52')]);router[_0xee30('0x3e')](_0xee30('0x53'),auth[_0xee30('0x7')](),controller[_0xee30('0x54')]);router[_0xee30('0x3e')](_0xee30('0x55'),auth['isAuthenticated'](),controller[_0xee30('0x56')]);router['post'](_0xee30('0x57'),auth[_0xee30('0x7')](),controller['addOpenchannelInteractions']);router[_0xee30('0x3e')](_0xee30('0x58'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0xee30('0x3e')](_0xee30('0x2e'),auth[_0xee30('0x7')](),controller[_0xee30('0x59')]);router[_0xee30('0x3e')](_0xee30('0x30'),auth['isAuthenticated'](),controller[_0xee30('0x5a')]);router[_0xee30('0x3e')]('/:id/openchannel_accounts',auth[_0xee30('0x7')](),controller[_0xee30('0x5b')]);router[_0xee30('0x3e')](_0xee30('0x33'),auth[_0xee30('0x7')](),controller[_0xee30('0x5c')]);router[_0xee30('0x3e')](_0xee30('0x35'),auth[_0xee30('0x7')](),controller['addChatWebsites']);router[_0xee30('0x3e')]('/:id/whatsapp_accounts',auth[_0xee30('0x7')](),controller['addWhatsappAccounts']);router[_0xee30('0x3e')](_0xee30('0x39'),auth[_0xee30('0x7')](),controller[_0xee30('0x5d')]);router[_0xee30('0x3e')](_0xee30('0x3d'),auth[_0xee30('0x7')](),controller['createApiKey']);router[_0xee30('0x5e')](_0xee30('0x5f'),auth[_0xee30('0x7')](),controller[_0xee30('0x60')]);router['put'](_0xee30('0x61'),auth['isAuthenticated'](),controller['changePassword']);router[_0xee30('0x62')](_0xee30('0x13'),auth[_0xee30('0x7')](),controller[_0xee30('0x63')]);router[_0xee30('0x62')](_0xee30('0x28'),auth[_0xee30('0x7')](),controller[_0xee30('0x64')]);router[_0xee30('0x62')]('/:id',auth[_0xee30('0x7')](),controller[_0xee30('0x65')]);router['delete'](_0xee30('0x66'),auth['isAuthenticated'](),controller[_0xee30('0x67')]);router['delete'](_0xee30('0x51'),auth[_0xee30('0x7')](),controller[_0xee30('0x68')]);router[_0xee30('0x62')]('/:id/fax_interactions',auth[_0xee30('0x7')](),controller['removeFaxInteractions']);router[_0xee30('0x62')](_0xee30('0x55'),auth[_0xee30('0x7')](),controller[_0xee30('0x69')]);router[_0xee30('0x62')]('/:id/openchannel_interactions',auth[_0xee30('0x7')](),controller[_0xee30('0x6a')]);router[_0xee30('0x62')](_0xee30('0x58'),auth[_0xee30('0x7')](),controller[_0xee30('0x6b')]);router[_0xee30('0x62')](_0xee30('0x2e'),auth[_0xee30('0x7')](),controller[_0xee30('0x6c')]);router[_0xee30('0x62')](_0xee30('0x30'),auth[_0xee30('0x7')](),controller['removeMailAccounts']);router[_0xee30('0x62')]('/:id/openchannel_accounts',auth[_0xee30('0x7')](),controller[_0xee30('0x6d')]);router['delete']('/:id/sms_accounts',auth[_0xee30('0x7')](),controller[_0xee30('0x6e')]);router['delete'](_0xee30('0x35'),auth[_0xee30('0x7')](),controller[_0xee30('0x6f')]);router[_0xee30('0x62')](_0xee30('0x37'),auth[_0xee30('0x7')](),controller[_0xee30('0x70')]);router[_0xee30('0x62')](_0xee30('0x39'),auth['isAuthenticated'](),controller[_0xee30('0x71')]);router[_0xee30('0x62')](_0xee30('0x3d'),auth[_0xee30('0x7')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0xd2b2=['/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getApiKey','post','addContacts','create','addQueues','root','server/files/images/','format','%s-%s','/:id/avatar','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','update','put','changePassword','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','/presence','getPresence','/:id','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings'];(function(_0x3cf5cf,_0xbcf812){var _0x4650a6=function(_0x16fb01){while(--_0x16fb01){_0x3cf5cf['push'](_0x3cf5cf['shift']());}};_0x4650a6(++_0xbcf812);}(_0xd2b2,0x127));var _0x2d2b=function(_0x42e85c,_0x2dcc47){_0x42e85c=_0x42e85c-0x0;var _0xd3009a=_0xd2b2[_0x42e85c];return _0xd3009a;};'use strict';var multer=require(_0x2d2b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d2b('0x1'));var express=require('express');var router=express[_0x2d2b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d2b('0x3'));var interaction=require(_0x2d2b('0x4'));var config=require(_0x2d2b('0x5'));var controller=require(_0x2d2b('0x6'));router[_0x2d2b('0x7')]('/',auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x9')]);router[_0x2d2b('0x7')](_0x2d2b('0xa'),auth[_0x2d2b('0x8')](),controller['describe']);router['get'](_0x2d2b('0xb'),auth[_0x2d2b('0x8')](),controller['whoami']);router[_0x2d2b('0x7')](_0x2d2b('0xc'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0xd')]);router[_0x2d2b('0x7')](_0x2d2b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2d2b('0x7')]('/:id/avatar',controller['getAvatar']);router[_0x2d2b('0x7')](_0x2d2b('0xf'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x10')]);router[_0x2d2b('0x7')](_0x2d2b('0x11'),auth['isAuthenticated'](),controller[_0x2d2b('0x12')]);router[_0x2d2b('0x7')](_0x2d2b('0x13'),auth[_0x2d2b('0x8')](),controller['getQueues']);router['get'](_0x2d2b('0x14'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x15')]);router['get'](_0x2d2b('0x16'),auth[_0x2d2b('0x8')](),controller['getGroups']);router[_0x2d2b('0x7')](_0x2d2b('0x17'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x18')]);router[_0x2d2b('0x7')](_0x2d2b('0x19'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x2d2b('0x7')](_0x2d2b('0x1a'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x1b')]);router[_0x2d2b('0x7')]('/:id/openchannel/interactions',auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x1c')]);router[_0x2d2b('0x7')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x2d2b('0x1d')]);router[_0x2d2b('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x2d2b('0x7')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x2d2b('0x1e')]);router[_0x2d2b('0x7')](_0x2d2b('0x1f'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x20')]);router[_0x2d2b('0x7')](_0x2d2b('0x21'),auth['isAuthenticated'](),controller[_0x2d2b('0x22')]);router[_0x2d2b('0x7')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2d2b('0x23')]);router[_0x2d2b('0x7')](_0x2d2b('0x24'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x25')]);router['get'](_0x2d2b('0x26'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x27')]);router[_0x2d2b('0x7')](_0x2d2b('0x28'),auth[_0x2d2b('0x8')](),controller['getFaxAccounts']);router[_0x2d2b('0x7')](_0x2d2b('0x29'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x2a')]);router[_0x2d2b('0x7')](_0x2d2b('0x2b'),auth[_0x2d2b('0x8')](),controller['getOpenchannelAccounts']);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x2d2b('0x2c')]);router[_0x2d2b('0x7')](_0x2d2b('0x2d'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x2e')]);router['get'](_0x2d2b('0x2f'),auth['isAuthenticated'](),controller[_0x2d2b('0x30')]);router[_0x2d2b('0x7')](_0x2d2b('0x31'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x32')]);router[_0x2d2b('0x7')](_0x2d2b('0x33'),auth[_0x2d2b('0x8')](),controller['getScheduledCalls']);router[_0x2d2b('0x7')]('/:id/api_key',auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x34')]);router[_0x2d2b('0x35')](_0x2d2b('0x11'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x36')]);router[_0x2d2b('0x35')]('/',auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x37')]);router[_0x2d2b('0x35')]('/create_many',auth['isAuthenticated'](),controller['bulkCreate']);router['post']('/:id/queues',auth['isAuthenticated'](),controller[_0x2d2b('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x37e9a3,_0x4ea185,_0x3781e7){_0x3781e7(null,path['join'](config[_0x2d2b('0x39')],_0x2d2b('0x3a')));},'filename':function(_0x58f0f9,_0x2a1e55,_0x546118){_0x546118(null,util[_0x2d2b('0x3b')](_0x2d2b('0x3c'),Date['now'](),_0x2a1e55['originalname']));}})});router[_0x2d2b('0x35')](_0x2d2b('0x3d'),upload[_0x2d2b('0x3e')](_0x2d2b('0x3f')),controller[_0x2d2b('0x40')]);router[_0x2d2b('0x35')](_0x2d2b('0x41'),auth[_0x2d2b('0x8')](),controller['login']);router[_0x2d2b('0x35')](_0x2d2b('0x42'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x43')]);router['post'](_0x2d2b('0x44'),auth[_0x2d2b('0x8')](),controller['pause']);router['post'](_0x2d2b('0x45'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x46')]);router[_0x2d2b('0x35')](_0x2d2b('0x21'),auth['isAuthenticated'](),controller['addTeams']);router[_0x2d2b('0x35')]('/:id/chat_interactions',auth[_0x2d2b('0x8')](),controller['addChatInteractions']);router[_0x2d2b('0x35')](_0x2d2b('0x47'),auth['isAuthenticated'](),controller[_0x2d2b('0x48')]);router['post'](_0x2d2b('0x49'),auth['isAuthenticated'](),controller[_0x2d2b('0x4a')]);router['post'](_0x2d2b('0x4b'),auth['isAuthenticated'](),controller[_0x2d2b('0x4c')]);router['post'](_0x2d2b('0x4d'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x4e')]);router[_0x2d2b('0x35')](_0x2d2b('0x4f'),auth['isAuthenticated'](),controller[_0x2d2b('0x50')]);router[_0x2d2b('0x35')](_0x2d2b('0x28'),auth[_0x2d2b('0x8')](),controller['addFaxAccounts']);router[_0x2d2b('0x35')](_0x2d2b('0x29'),auth['isAuthenticated'](),controller[_0x2d2b('0x51')]);router[_0x2d2b('0x35')](_0x2d2b('0x2b'),auth['isAuthenticated'](),controller[_0x2d2b('0x52')]);router[_0x2d2b('0x35')](_0x2d2b('0x53'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x54')]);router['post'](_0x2d2b('0x2d'),auth[_0x2d2b('0x8')](),controller['addChatWebsites']);router['post'](_0x2d2b('0x2f'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x55')]);router[_0x2d2b('0x35')](_0x2d2b('0x31'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x56')]);router[_0x2d2b('0x35')](_0x2d2b('0x57'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x58')]);router['put'](_0x2d2b('0xe'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x59')]);router[_0x2d2b('0x5a')]('/:id/password',auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x5b')]);router[_0x2d2b('0x5c')](_0x2d2b('0x13'),auth['isAuthenticated'](),controller[_0x2d2b('0x5d')]);router[_0x2d2b('0x5c')]('/:id/teams',auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x5e')]);router['delete'](_0x2d2b('0xe'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x5f')]);router['delete'](_0x2d2b('0x60'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x61')]);router[_0x2d2b('0x5c')]('/:id/mail_interactions',auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x62')]);router[_0x2d2b('0x5c')](_0x2d2b('0x49'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x63')]);router[_0x2d2b('0x5c')](_0x2d2b('0x4b'),auth[_0x2d2b('0x8')](),controller['removeSmsInteractions']);router[_0x2d2b('0x5c')](_0x2d2b('0x4d'),auth['isAuthenticated'](),controller[_0x2d2b('0x64')]);router[_0x2d2b('0x5c')](_0x2d2b('0x4f'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x65')]);router['delete'](_0x2d2b('0x28'),auth['isAuthenticated'](),controller[_0x2d2b('0x66')]);router['delete'](_0x2d2b('0x29'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x67')]);router['delete'](_0x2d2b('0x2b'),auth[_0x2d2b('0x8')](),controller['removeOpenchannelAccounts']);router[_0x2d2b('0x5c')](_0x2d2b('0x53'),auth[_0x2d2b('0x8')](),controller['removeSmsAccounts']);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x2d2b('0x5c')](_0x2d2b('0x2f'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x68')]);router[_0x2d2b('0x5c')](_0x2d2b('0x31'),auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x69')]);router['delete']('/:id/api_key',auth[_0x2d2b('0x8')](),controller[_0x2d2b('0x6a')]);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 db23365..14ed1d1 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 _0xc6c0=['join','transport','split','info','inband','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','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','active','passive','update,nonat','TEXT','get','wss','encryption','force_avp','icesupport','dtlssetup','dtlscertfile','dtlsprivatekey','dtlsenable','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','user','agent','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp'];(function(_0xd92e0f,_0x4c28de){var _0x408a33=function(_0x35be94){while(--_0x35be94){_0xd92e0f['push'](_0xd92e0f['shift']());}};_0x408a33(++_0x4c28de);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xc6c0[_0x5e8c32];return _0x595f7b;};'use strict';var Sequelize=require(_0x0c6c('0x0'));var moment=require('moment');var util=require(_0x0c6c('0x1'));var _=require(_0x0c6c('0x2'));module[_0x0c6c('0x3')]={'name':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':![],'unique':_0x0c6c('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1d9169){this[_0x0c6c('0x6')](_0x0c6c('0x5'),_0x1d9169);this[_0x0c6c('0x6')](_0x0c6c('0x7'),_0x1d9169);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1791cb){this[_0x0c6c('0x6')](_0x0c6c('0x8'),_0x1791cb);this[_0x0c6c('0x6')](_0x0c6c('0x9'),util[_0x0c6c('0xa')](_0x0c6c('0xb'),_0x1791cb,this[_0x0c6c('0xc')](_0x0c6c('0xd'))));}},'alias':{'type':Sequelize[_0x0c6c('0x4')]},'email':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':![],'unique':_0x0c6c('0xe'),'validate':{'isEmail':!![]},'set':function(_0x238229){if(_0x238229){this[_0x0c6c('0x6')](_0x0c6c('0xe'),_0x238229['toLowerCase']());}}},'role':{'type':Sequelize[_0x0c6c('0xf')]('admin',_0x0c6c('0x10'),_0x0c6c('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0c6c('0x4')],'defaultValue':_0x0c6c('0x12')},'internal':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':![],'unique':_0x0c6c('0xd'),'set':function(_0x538b89){this[_0x0c6c('0x6')](_0x0c6c('0xd'),_0x538b89);this[_0x0c6c('0x6')](_0x0c6c('0x14'),_0x538b89);this[_0x0c6c('0x6')](_0x0c6c('0x9'),util[_0x0c6c('0xa')]('\x22%s\x22\x20<%s>',this[_0x0c6c('0xc')]('fullname'),_0x538b89));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x0c6c('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x0c6c('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x0c6c('0x4')]},'country':{'type':Sequelize[_0x0c6c('0x4')]},'online':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0c6c('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0c6c('0x4')],'defaultValue':_0x0c6c('0x17')},'lastPauseAt':{'type':Sequelize[_0x0c6c('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x0c6c('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0c6c('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0c6c('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0c6c('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0c6c('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0c6c('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0c6c('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![],'defaultValue':_0x0c6c('0x18')},'ipaddr':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x0c6c('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x0c6c('0x19'),_0x0c6c('0x10'),_0x0c6c('0x1a')),'allowNull':!![],'defaultValue':_0x0c6c('0x19')},'context':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![],'defaultValue':_0x0c6c('0x1b')},'callingpres':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x1c'),'ALLOWED_PASSED_SCREEN',_0x0c6c('0x1d'),_0x0c6c('0x1e'),'PROHIB_NOT_SCREENED',_0x0c6c('0x1f'),'PROHIB_FAILED_SCREEN',_0x0c6c('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![],'defaultValue':_0x0c6c('0x21'),'set':function(_0x391308){this['setDataValue']('transport',_0x391308?_0x391308[_0x0c6c('0x22')](','):null);},'get':function(){return this[_0x0c6c('0xc')](_0x0c6c('0x23'))?this[_0x0c6c('0xc')](_0x0c6c('0x23'))[_0x0c6c('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x0c6c('0xf')]('rfc2833',_0x0c6c('0x25'),'shortinfo',_0x0c6c('0x26'),_0x0c6c('0x27')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x0c6c('0x28'),'no',_0x0c6c('0x29'),_0x0c6c('0x2a'),_0x0c6c('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x0c6c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![],'defaultValue':_0x0c6c('0x2c'),'set':function(_0x3829e8){this['setDataValue'](_0x0c6c('0x2d'),_0x3829e8?_0x3829e8[_0x0c6c('0x22')](','):null);},'get':function(){return this[_0x0c6c('0xc')](_0x0c6c('0x2d'))?this[_0x0c6c('0xc')](_0x0c6c('0x2d'))[_0x0c6c('0x24')](','):null;},'comment':_0x0c6c('0x2e')},'callgroup':{'type':Sequelize[_0x0c6c('0x4')]},'namedcallgroup':{'type':Sequelize[_0x0c6c('0x4')]},'pickupgroup':{'type':Sequelize[_0x0c6c('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x0c6c('0x4')]},'language':{'type':Sequelize[_0x0c6c('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0c6c('0x4')]},'disallow':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':![],'defaultValue':_0x0c6c('0x2f')},'allow':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':![],'defaultValue':_0x0c6c('0x30'),'set':function(_0x42ce5c){this[_0x0c6c('0x6')](_0x0c6c('0x31'),_0x42ce5c?_0x42ce5c[_0x0c6c('0x22')](';'):_0x0c6c('0x30'));},'get':function(){return this[_0x0c6c('0xc')](_0x0c6c('0x31'))?this[_0x0c6c('0xc')]('allow')[_0x0c6c('0x24')](';'):null;},'comment':_0x0c6c('0x32')},'autoframing':{'type':Sequelize['ENUM'](_0x0c6c('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![],'set':function(_0x3685e1){this[_0x0c6c('0x6')](_0x0c6c('0x33'),_0x3685e1?_0x3685e1[_0x0c6c('0x22')](','):null);},'get':function(){return this[_0x0c6c('0xc')]('insecure')?this['getDataValue'](_0x0c6c('0x33'))[_0x0c6c('0x24')](','):null;},'comment':_0x0c6c('0x34')},'trustrpid':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x0c6c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no',_0x0c6c('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0c6c('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0c6c('0x36')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0c6c('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0c6c('0xf')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no',_0x0c6c('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0c6c('0xf')]('accept',_0x0c6c('0x38'),_0x0c6c('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x3a'),_0x0c6c('0x3b')),'allowNull':!![],'defaultValue':_0x0c6c('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0c6c('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0c6c('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no',_0x0c6c('0x3c'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x3d'),_0x0c6c('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x0c6c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x0c6c('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0c6c('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no',_0x0c6c('0x29'),_0x0c6c('0x2a'),_0x0c6c('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0c6c('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x0c6c('0x16')]},'passwordResetAt':{'type':Sequelize[_0x0c6c('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0c6c('0x40')]},'showWebBar':{'type':Sequelize[_0x0c6c('0x13')],'defaultValue':0x0,'set':function(_0x54dc3d){this[_0x0c6c('0x6')]('showWebBar',_0x54dc3d);var _0x420d8e=this[_0x0c6c('0x41')]({'plain':!![]});switch(_0x54dc3d){case 0x0:case 0x1:var _0x4dfea9=_0x420d8e[_0x0c6c('0x23')]?_['isArray'](_0x420d8e[_0x0c6c('0x23')])?_0x420d8e[_0x0c6c('0x23')][_0x0c6c('0x22')]():_0x420d8e[_0x0c6c('0x23')]:_0x0c6c('0x21');if(_0x4dfea9===_0x0c6c('0x42')){_0x4dfea9=_0x0c6c('0x21');}this[_0x0c6c('0x6')](_0x0c6c('0x23'),_0x4dfea9);this['setDataValue'](_0x0c6c('0x43'),'no');this[_0x0c6c('0x6')]('avpf',null);this[_0x0c6c('0x6')](_0x0c6c('0x44'),null);this[_0x0c6c('0x6')](_0x0c6c('0x45'),null);this[_0x0c6c('0x6')]('dtlsenable',null);this[_0x0c6c('0x6')]('dtlsverify',null);this[_0x0c6c('0x6')](_0x0c6c('0x46'),null);this[_0x0c6c('0x6')](_0x0c6c('0x47'),null);this['setDataValue'](_0x0c6c('0x48'),null);this[_0x0c6c('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x0c6c('0x6')](_0x0c6c('0x23'),'wss');this[_0x0c6c('0x6')](_0x0c6c('0x43'),_0x0c6c('0x28'));this['setDataValue']('avpf',_0x0c6c('0x28'));this[_0x0c6c('0x6')](_0x0c6c('0x44'),'yes');this['setDataValue'](_0x0c6c('0x45'),'yes');this[_0x0c6c('0x6')](_0x0c6c('0x49'),_0x0c6c('0x28'));this[_0x0c6c('0x6')](_0x0c6c('0x4a'),'no');this['setDataValue']('dtlssetup',_0x0c6c('0x4b'));this[_0x0c6c('0x6')](_0x0c6c('0x47'),_0x420d8e['dtlscertfile']||_0x0c6c('0x4c'));this[_0x0c6c('0x6')](_0x0c6c('0x48'),_0x420d8e[_0x0c6c('0x48')]||_0x0c6c('0x4d'));this['setDataValue'](_0x0c6c('0x4e'),_0x0c6c('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0c6c('0x40')],'set':function(_0x44a08b){this[_0x0c6c('0x6')](_0x0c6c('0x4f'),_0x44a08b?_0x44a08b['join'](','):[]);},'get':function(){return this['getDataValue'](_0x0c6c('0x4f'))?_[_0x0c6c('0x50')](this[_0x0c6c('0xc')](_0x0c6c('0x4f'))[_0x0c6c('0x24')](','),function(_0x423ac8){return parseInt(_0x423ac8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0c6c('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0c6c('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0c6c('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0c6c('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0c6c('0xf')](_0x0c6c('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0c6c('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0c6c('0x51')],'get':function(){return this[_0x0c6c('0xc')](_0x0c6c('0x52'))?this['getDataValue'](_0x0c6c('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0c6c('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0c6c('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![],'set':function(_0x1766cd){if(typeof _0x1766cd==='string'){var _0x58e8ff=_0x1766cd==='1'?!![]:_0x1766cd==='0'?![]:_0x1766cd===_0x0c6c('0x53')?!![]:_0x1766cd===_0x0c6c('0x54')?![]:![];this[_0x0c6c('0x6')]('screenrecording',_0x58e8ff);}else{this[_0x0c6c('0x6')](_0x0c6c('0x55'),_0x1766cd);}}},'blocked':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![],'set':function(_0x43e2c3){this['setDataValue']('blocked',_0x43e2c3);if(_0x43e2c3===!![]){this[_0x0c6c('0x6')](_0x0c6c('0x56'),moment());this[_0x0c6c('0x6')]('loginAttempts',0x0);}else{this['setDataValue'](_0x0c6c('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0c6c('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0c6c('0x13')](0x5)[_0x0c6c('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0c6c('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4fe0=['nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','get','isArray','wss','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','agent','telephone','internal','accountcode','fullname','BOOLEAN','DATE','INTEGER','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','update','outgoing','yes','force_rport,comedia'];(function(_0x24194a,_0x1fa100){var _0x94c7b9=function(_0x4e4090){while(--_0x4e4090){_0x24194a['push'](_0x24194a['shift']());}};_0x94c7b9(++_0x1fa100);}(_0x4fe0,0x195));var _0x04fe=function(_0xfe8d09,_0x6941ba){_0xfe8d09=_0xfe8d09-0x0;var _0x314e17=_0x4fe0[_0xfe8d09];return _0x314e17;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x04fe('0x0'));var util=require(_0x04fe('0x1'));var _=require(_0x04fe('0x2'));module[_0x04fe('0x3')]={'name':{'type':Sequelize[_0x04fe('0x4')],'allowNull':![],'unique':_0x04fe('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4de1fd){this[_0x04fe('0x6')]('name',_0x4de1fd);this[_0x04fe('0x6')](_0x04fe('0x7'),_0x4de1fd);},'comment':_0x04fe('0x8')},'fullname':{'type':Sequelize[_0x04fe('0x4')],'allowNull':![],'set':function(_0x51f4a3){this[_0x04fe('0x6')]('fullname',_0x51f4a3);this[_0x04fe('0x6')](_0x04fe('0x9'),util[_0x04fe('0xa')](_0x04fe('0xb'),_0x51f4a3,this[_0x04fe('0xc')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x04fe('0x4')],'allowNull':![],'unique':_0x04fe('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1ec224){if(_0x1ec224){this[_0x04fe('0x6')](_0x04fe('0xd'),_0x1ec224[_0x04fe('0xe')]());}}},'role':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x10'),_0x04fe('0x11'),_0x04fe('0x12'),_0x04fe('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x04fe('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x04fe('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x04fe('0x14'),'set':function(_0x2f5c41){this[_0x04fe('0x6')](_0x04fe('0x14'),_0x2f5c41);this[_0x04fe('0x6')](_0x04fe('0x15'),_0x2f5c41);this[_0x04fe('0x6')]('callerid',util['format'](_0x04fe('0xb'),this[_0x04fe('0xc')](_0x04fe('0x16')),_0x2f5c41));}},'salt':{'type':Sequelize[_0x04fe('0x4')]},'phone':{'type':Sequelize[_0x04fe('0x4')]},'mobile':{'type':Sequelize[_0x04fe('0x4')]},'address':{'type':Sequelize[_0x04fe('0x4')]},'zipcode':{'type':Sequelize[_0x04fe('0x4')]},'userpic':{'type':Sequelize[_0x04fe('0x4')]},'city':{'type':Sequelize[_0x04fe('0x4')]},'country':{'type':Sequelize[_0x04fe('0x4')]},'online':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x04fe('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x04fe('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x04fe('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x04fe('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x04fe('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x04fe('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x04fe('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x04fe('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x04fe('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x1a'),'user',_0x04fe('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![],'defaultValue':_0x04fe('0x1c')},'callingpres':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x1d'),_0x04fe('0x1e'),_0x04fe('0x1f'),_0x04fe('0x20'),_0x04fe('0x21'),_0x04fe('0x22'),_0x04fe('0x23'),_0x04fe('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![],'defaultValue':_0x04fe('0x25'),'set':function(_0x217473){this[_0x04fe('0x6')](_0x04fe('0x26'),_0x217473?_0x217473['join'](','):null);},'get':function(){return this[_0x04fe('0xc')](_0x04fe('0x26'))?this[_0x04fe('0xc')](_0x04fe('0x26'))[_0x04fe('0x27')](','):null;},'comment':_0x04fe('0x28')},'dtmfmode':{'type':Sequelize['ENUM'](_0x04fe('0x29'),_0x04fe('0x2a'),_0x04fe('0x2b'),'inband',_0x04fe('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x04fe('0xf')]('yes','no',_0x04fe('0x2d'),_0x04fe('0x2e'),_0x04fe('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![],'defaultValue':_0x04fe('0x31'),'set':function(_0x26cd25){this[_0x04fe('0x6')]('nat',_0x26cd25?_0x26cd25['join'](','):null);},'get':function(){return this[_0x04fe('0xc')](_0x04fe('0x32'))?this[_0x04fe('0xc')]('nat')[_0x04fe('0x27')](','):null;},'comment':_0x04fe('0x33')},'callgroup':{'type':Sequelize[_0x04fe('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x04fe('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x04fe('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x04fe('0x4')]},'disallow':{'type':Sequelize[_0x04fe('0x4')],'allowNull':![],'defaultValue':_0x04fe('0x34')},'allow':{'type':Sequelize[_0x04fe('0x4')],'allowNull':![],'defaultValue':_0x04fe('0x35'),'set':function(_0x17a6f7){this[_0x04fe('0x6')](_0x04fe('0x36'),_0x17a6f7?_0x17a6f7[_0x04fe('0x37')](';'):_0x04fe('0x35'));},'get':function(){return this[_0x04fe('0xc')]('allow')?this[_0x04fe('0xc')](_0x04fe('0x36'))[_0x04fe('0x27')](';'):null;},'comment':_0x04fe('0x38')},'autoframing':{'type':Sequelize[_0x04fe('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![],'set':function(_0x2691f4){this[_0x04fe('0x6')](_0x04fe('0x39'),_0x2691f4?_0x2691f4['join'](','):null);},'get':function(){return this[_0x04fe('0xc')]('insecure')?this[_0x04fe('0xc')](_0x04fe('0x39'))[_0x04fe('0x27')](','):null;},'comment':_0x04fe('0x3a')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x04fe('0x30'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![],'defaultValue':_0x04fe('0x3b')},'amaflags':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![],'defaultValue':_0x04fe('0x30')},'busylevel':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x04fe('0x30'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x04fe('0x30'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no',_0x04fe('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x04fe('0xf')]('accept','refuse',_0x04fe('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x3e'),_0x04fe('0x3f')),'allowNull':!![],'defaultValue':_0x04fe('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x04fe('0x30'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x04fe('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x04fe('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x04fe('0xf')]('yes','no',_0x04fe('0x40'),_0x04fe('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x04fe('0xf')]('active',_0x04fe('0x42'),_0x04fe('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x04fe('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no','nonat',_0x04fe('0x2e'),_0x04fe('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x04fe('0x18')]},'passwordResetAt':{'type':Sequelize[_0x04fe('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x04fe('0x45')]},'showWebBar':{'type':Sequelize[_0x04fe('0x19')],'defaultValue':0x0,'set':function(_0x404e59){this['setDataValue']('showWebBar',_0x404e59);var _0x62014=this[_0x04fe('0x46')]({'plain':!![]});switch(_0x404e59){case 0x0:case 0x1:var _0x1a4abf=_0x62014['transport']?_[_0x04fe('0x47')](_0x62014[_0x04fe('0x26')])?_0x62014['transport'][_0x04fe('0x37')]():_0x62014[_0x04fe('0x26')]:_0x04fe('0x25');if(_0x1a4abf===_0x04fe('0x48')){_0x1a4abf='udp';}this[_0x04fe('0x6')]('transport',_0x1a4abf);this[_0x04fe('0x6')]('encryption','no');this[_0x04fe('0x6')]('avpf',null);this[_0x04fe('0x6')](_0x04fe('0x49'),null);this[_0x04fe('0x6')](_0x04fe('0x4a'),null);this[_0x04fe('0x6')](_0x04fe('0x4b'),null);this['setDataValue'](_0x04fe('0x4c'),null);this[_0x04fe('0x6')](_0x04fe('0x4d'),null);this[_0x04fe('0x6')](_0x04fe('0x4e'),null);this[_0x04fe('0x6')](_0x04fe('0x4f'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x04fe('0x6')]('transport',_0x04fe('0x48'));this[_0x04fe('0x6')]('encryption','yes');this[_0x04fe('0x6')]('avpf',_0x04fe('0x30'));this['setDataValue'](_0x04fe('0x49'),_0x04fe('0x30'));this['setDataValue'](_0x04fe('0x4a'),_0x04fe('0x30'));this['setDataValue'](_0x04fe('0x4b'),_0x04fe('0x30'));this[_0x04fe('0x6')](_0x04fe('0x4c'),'no');this[_0x04fe('0x6')](_0x04fe('0x4d'),'actpass');this[_0x04fe('0x6')]('dtlscertfile',_0x62014[_0x04fe('0x4e')]||_0x04fe('0x50'));this[_0x04fe('0x6')](_0x04fe('0x4f'),_0x62014['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x04fe('0x6')](_0x04fe('0x51'),_0x04fe('0x30'));break;default:}}},'permissions':{'type':Sequelize[_0x04fe('0x45')],'set':function(_0x2dae90){this[_0x04fe('0x6')](_0x04fe('0x52'),_0x2dae90?_0x2dae90[_0x04fe('0x37')](','):[]);},'get':function(){return this[_0x04fe('0xc')](_0x04fe('0x52'))?_[_0x04fe('0x53')](this['getDataValue'](_0x04fe('0x52'))[_0x04fe('0x27')](','),function(_0x3ae91f){return parseInt(_0x3ae91f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x04fe('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x04fe('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x04fe('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x04fe('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x04fe('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x04fe('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x04fe('0xf')](_0x04fe('0x30'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x04fe('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x04fe('0x54')],'get':function(){return this[_0x04fe('0xc')](_0x04fe('0x55'))?this[_0x04fe('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x04fe('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x04fe('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![],'set':function(_0x517088){if(typeof _0x517088===_0x04fe('0x56')){var _0x3dc047=_0x517088==='1'?!![]:_0x517088==='0'?![]:_0x517088===_0x04fe('0x57')?!![]:_0x517088==='false'?![]:![];this[_0x04fe('0x6')](_0x04fe('0x58'),_0x3dc047);}else{this[_0x04fe('0x6')](_0x04fe('0x58'),_0x517088);}}},'blocked':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':![],'set':function(_0x9f6d6b){this[_0x04fe('0x6')](_0x04fe('0x59'),_0x9f6d6b);if(_0x9f6d6b===!![]){this[_0x04fe('0x6')]('blockedAt',moment());this[_0x04fe('0x6')]('loginAttempts',0x0);}else{this[_0x04fe('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x04fe('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x04fe('0x19')](0x5)[_0x04fe('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x04fe('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'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 582a256..b568478 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 _0xb7e7=['UserProfileSection','autoAssociation','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','findAll','isEmpty','map','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','Queues','penalty','toLowerCase','QueueId','emit','Queue:save','voice','online','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','chat','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','getContacts','CmContact','order','sort','pick','hasOwnProperty','CmList','List','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','MemberReport','bulkCreate','concat','LOGININPAUSE','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','QueuePause','manual','set','%s%s','Pause','getTeams','Team','addTeams','getVoiceQueues','setDataValue','Voice','getChatQueues','Chat','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','transaction','getDataValue','removeTeams','Mail','Fax','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notLike','$iLike','$like','$overlap','$contained','$any','CmHopper','firstName','lastName','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','queues','teams','inbound','lower','col','toString','asc','uniqBy','client','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','SELECT','select','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','lodash','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','./user.socket','register','defaults','localhost','http','request','info','request\x20sent','stringify','error','code','message','User,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','update','then','get','role','admin','Users','Agents','agent','Telephones','telephone','filter','ignore','value','includes','find','name','UserProfileResource','destroy','stack','send','index','User','rawAttributes','fieldName','type','key','password','where','query','includeAll','include','attributes','true','rows','length','push','dataValues','sms','mail','all','show','params','differenceBy','keys','filters','intersection','model','fields','merge','options','openTabs','openchannel','whatsapp','fax','body','describe','addContacts','omit','ids','internal','Setting','findById','max','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','isNil','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','105','106','107','109','100','111','115','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId'];(function(_0x49c027,_0x152ca6){var _0x130613=function(_0x3d5734){while(--_0x3d5734){_0x49c027['push'](_0x49c027['shift']());}};_0x130613(++_0x152ca6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xb7e7[_0x341e0f];return _0x59555a;};'use strict';var moment=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var util=require(_0x7b7e('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x7b7e('0x2'));var squel=require('squel');var jayson=require(_0x7b7e('0x3'));var Redis=require('ioredis');var authService=require(_0x7b7e('0x4'));var qs=require(_0x7b7e('0x5'));var logger=require(_0x7b7e('0x6'))('api');var utils=require('../../config/utils');var config=require(_0x7b7e('0x7'));var licenseUtil=require(_0x7b7e('0x8'));var db=require(_0x7b7e('0x9'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x7b7e('0xa')]));require(_0x7b7e('0xb'))[_0x7b7e('0xc')](socket);config[_0x7b7e('0xa')]=_[_0x7b7e('0xd')](config[_0x7b7e('0xa')],{'host':_0x7b7e('0xe'),'port':0x18eb});var client=jayson['client'][_0x7b7e('0xf')]({'port':0x232a});var values;function respondWithRpcPromise(_0x1eef0a,_0x10a666,_0x29b622,_0xd581fb){return new BPromise(function(_0x18a1de,_0x36d2a3){var _0x55620b=_0xd581fb||client;return _0x55620b[_0x7b7e('0x10')](_0x1eef0a,_0x29b622)['then'](function(_0x267446){logger[_0x7b7e('0x11')]('User,\x20%s,\x20%s',_0x10a666,_0x7b7e('0x12'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x10a666,_0x7b7e('0x12'),JSON[_0x7b7e('0x13')](_0x267446));if(_0x267446[_0x7b7e('0x14')]){if(_0x267446[_0x7b7e('0x14')][_0x7b7e('0x15')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x10a666,_0x267446[_0x7b7e('0x14')][_0x7b7e('0x16')]);return _0x36d2a3(_0x267446[_0x7b7e('0x14')][_0x7b7e('0x16')]);}logger[_0x7b7e('0x14')](_0x7b7e('0x17'),_0x10a666,_0x267446[_0x7b7e('0x14')][_0x7b7e('0x16')]);return _0x18a1de(_0x267446[_0x7b7e('0x14')][_0x7b7e('0x16')]);}else{logger[_0x7b7e('0x11')](_0x7b7e('0x17'),_0x10a666,_0x7b7e('0x12'));_0x18a1de(_0x267446[_0x7b7e('0x18')][_0x7b7e('0x16')]);}})[_0x7b7e('0x19')](function(_0x3a7b8b){logger['error'](_0x7b7e('0x17'),_0x10a666,_0x3a7b8b);_0x36d2a3(_0x3a7b8b);});});}function respondWithStatusCode(_0x43db4f,_0x24718c){_0x24718c=_0x24718c||0xcc;return function(_0x4c0647){if(_0x4c0647){return _0x43db4f[_0x7b7e('0x1a')](_0x24718c);}return _0x43db4f[_0x7b7e('0x1b')](_0x24718c)[_0x7b7e('0x1c')]();};}function respondWithResult(_0x200156,_0x2b7211){_0x2b7211=_0x2b7211||0xc8;return function(_0x303d8c){if(_0x303d8c){return _0x200156[_0x7b7e('0x1b')](_0x2b7211)[_0x7b7e('0x1d')](_0x303d8c);}};}function respondWithFilteredResult(_0x53bbb3,_0x5d6215){return function(_0x4a836a){if(_0x4a836a){var _0x26ee14=typeof _0x5d6215[_0x7b7e('0x1e')]===_0x7b7e('0x1f')&&typeof _0x5d6215['limit']==='undefined';var _0x5dadbb=_0x4a836a[_0x7b7e('0x20')];var _0x3c8192=_0x26ee14?0x0:_0x5d6215[_0x7b7e('0x1e')];var _0x7aa71=_0x26ee14?_0x4a836a[_0x7b7e('0x20')]:_0x5d6215['offset']+_0x5d6215[_0x7b7e('0x21')];var _0x21a15;if(_0x7aa71>=_0x5dadbb){_0x7aa71=_0x5dadbb;_0x21a15=0xc8;}else{_0x21a15=0xce;}_0x53bbb3['status'](_0x21a15);return _0x53bbb3['set']('Content-Range',_0x3c8192+'-'+_0x7aa71+'/'+_0x5dadbb)[_0x7b7e('0x1d')](_0x4a836a);}return null;};}function saveUpdates(_0x423832){return function(_0x503625){if(_0x503625){return _0x503625[_0x7b7e('0x22')](_0x423832)['then'](function(_0x1b4341){return _0x1b4341;});}return null;};}function removeEntity(_0xb9b6bf){return function(_0x27b525){if(_0x27b525){return _0x27b525['destroy']()[_0x7b7e('0x23')](function(){var _0xe31336=_0x27b525[_0x7b7e('0x24')]({'plain':!![]});if(_0xe31336[_0x7b7e('0x25')]===_0x7b7e('0x26'))return;var _0x5732ee=[{'name':_0x7b7e('0x27'),'value':'user','ignore':!![]},{'name':_0x7b7e('0x28'),'value':_0x7b7e('0x29'),'ignore':![]},{'name':_0x7b7e('0x2a'),'value':_0x7b7e('0x2b'),'ignore':![]}];var _0x378faa=_(_0x5732ee)[_0x7b7e('0x2c')](_0x7b7e('0x2d'))['map']('value')[_0x7b7e('0x2e')]();if(_[_0x7b7e('0x2f')](_0x378faa,_0xe31336['role'])){return;}var _0x3a3bc7=_[_0x7b7e('0x30')](_0x5732ee,[_0x7b7e('0x2e'),_0xe31336['role']])[_0x7b7e('0x31')];return db[_0x7b7e('0x32')][_0x7b7e('0x33')]({'where':{'type':_0x3a3bc7,'resourceId':_0xe31336['id']}})[_0x7b7e('0x23')](function(){return _0x27b525;});})[_0x7b7e('0x23')](function(){_0xb9b6bf[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1c')]();});}};}function handleEntityNotFound(_0x202f04){return function(_0x44497c){if(!_0x44497c){_0x202f04[_0x7b7e('0x1a')](0x194);}return _0x44497c;};}function handleError(_0xd5a64d,_0x2d0620){_0x2d0620=_0x2d0620||0x1f4;return function(_0x442366){logger[_0x7b7e('0x14')](_0x442366[_0x7b7e('0x34')]);if(_0x442366[_0x7b7e('0x31')]){delete _0x442366['name'];}_0xd5a64d[_0x7b7e('0x1b')](_0x2d0620)[_0x7b7e('0x35')](_0x442366);};}exports[_0x7b7e('0x36')]=function(_0x242609,_0x36abfc){var _0x909c65={},_0x7f15={'count':0x0,'rows':[]};var _0x1e6280=_(db[_0x7b7e('0x37')][_0x7b7e('0x38')])['map'](function(_0x3d6571){return{'name':_0x3d6571[_0x7b7e('0x39')],'type':_0x3d6571[_0x7b7e('0x3a')][_0x7b7e('0x3b')]};})['filter'](function(_0x280748){return!_[_0x7b7e('0x2f')]([_0x7b7e('0x3c'),'salt'],_0x280748['name']);})[_0x7b7e('0x2e')]();_0x909c65=qs['getOptions'](_0x1e6280,_0x242609);var _0x35382c={'where':_0x909c65[_0x7b7e('0x3d')]};return db['User'][_0x7b7e('0x20')](_0x35382c)[_0x7b7e('0x23')](function(_0x2a6f4d){_0x7f15[_0x7b7e('0x20')]=_0x2a6f4d;if(_0x242609[_0x7b7e('0x3e')][_0x7b7e('0x3f')]){_0x909c65[_0x7b7e('0x40')]=[{'all':!![]}];}if(!_[_0x7b7e('0x2f')](_0x909c65[_0x7b7e('0x41')],'id')){_0x909c65['attributes']['push']('id');}return db[_0x7b7e('0x37')]['findAll'](_0x909c65);})[_0x7b7e('0x23')](function(_0x5e8b5d){_0x7f15['rows']=_0x5e8b5d;if(_0x242609[_0x7b7e('0x3e')]['openTabs']===_0x7b7e('0x42')){var _0x52051c=[];for(var _0xa8521d=0x0;_0xa8521d<_0x7f15[_0x7b7e('0x43')][_0x7b7e('0x44')];_0xa8521d++){_0x52051c[_0x7b7e('0x45')](get_open_tabs('chat',_0x7f15[_0x7b7e('0x43')][_0xa8521d][_0x7b7e('0x46')]));_0x52051c[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0x47'),_0x7f15[_0x7b7e('0x43')][_0xa8521d][_0x7b7e('0x46')]));_0x52051c['push'](get_open_tabs('fax',_0x7f15['rows'][_0xa8521d][_0x7b7e('0x46')]));_0x52051c[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0x48'),_0x7f15[_0x7b7e('0x43')][_0xa8521d][_0x7b7e('0x46')]));_0x52051c[_0x7b7e('0x45')](get_open_tabs('openchannel',_0x7f15[_0x7b7e('0x43')][_0xa8521d][_0x7b7e('0x46')]));_0x52051c['push'](get_open_tabs('whatsapp',_0x7f15[_0x7b7e('0x43')][_0xa8521d][_0x7b7e('0x46')]));}return BPromise[_0x7b7e('0x49')](_0x52051c)[_0x7b7e('0x23')](function(_0x38b4d0){return _0x7f15;});}else{return _0x7f15;}})[_0x7b7e('0x23')](respondWithFilteredResult(_0x36abfc,_0x909c65))['catch'](handleError(_0x36abfc,null));};exports[_0x7b7e('0x4a')]=function(_0x4cc7db,_0x402793){var _0x1dad4c={'raw':![],'where':{'id':_0x4cc7db[_0x7b7e('0x4b')]['id']}},_0x2ea2b2={};_0x2ea2b2['model']=_[_0x7b7e('0x4c')](_[_0x7b7e('0x4d')](db[_0x7b7e('0x37')][_0x7b7e('0x38')]),[_0x7b7e('0x3c'),'salt']);_0x2ea2b2[_0x7b7e('0x3e')]=_[_0x7b7e('0x4d')](_0x4cc7db[_0x7b7e('0x3e')]);_0x2ea2b2[_0x7b7e('0x4e')]=_[_0x7b7e('0x4f')](_0x2ea2b2['model'],_0x2ea2b2[_0x7b7e('0x3e')]);_0x1dad4c[_0x7b7e('0x41')]=_[_0x7b7e('0x4f')](_0x2ea2b2[_0x7b7e('0x50')],qs[_0x7b7e('0x51')](_0x4cc7db[_0x7b7e('0x3e')][_0x7b7e('0x51')]));_0x1dad4c['attributes']=_0x1dad4c[_0x7b7e('0x41')]['length']?_0x1dad4c[_0x7b7e('0x41')]:_0x2ea2b2[_0x7b7e('0x50')];if(_0x4cc7db['query'][_0x7b7e('0x3f')]){_0x1dad4c[_0x7b7e('0x40')]=[{'all':!![]}];}_0x1dad4c=_[_0x7b7e('0x52')]({},_0x1dad4c,_0x4cc7db[_0x7b7e('0x53')]);if(!_[_0x7b7e('0x2f')](_0x1dad4c[_0x7b7e('0x41')],'id')){_0x1dad4c[_0x7b7e('0x41')]['push']('id');}return db[_0x7b7e('0x37')][_0x7b7e('0x30')](_0x1dad4c)[_0x7b7e('0x23')](handleEntityNotFound(_0x402793,null))[_0x7b7e('0x23')](function(_0x5b9ab5){var _0x527403=[];values=_0x5b9ab5;if(_0x4cc7db['query'][_0x7b7e('0x54')]===_0x7b7e('0x42')){_0x527403[_0x7b7e('0x45')](get_open_tabs('chat',_0x5b9ab5['dataValues']));_0x527403[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0x47'),_0x5b9ab5['dataValues']));_0x527403[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0x55'),_0x5b9ab5[_0x7b7e('0x46')]));_0x527403['push'](get_open_tabs(_0x7b7e('0x56'),_0x5b9ab5[_0x7b7e('0x46')]));_0x527403['push'](get_open_tabs(_0x7b7e('0x57'),_0x5b9ab5[_0x7b7e('0x46')]));_0x527403[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0x48'),_0x5b9ab5[_0x7b7e('0x46')]));return BPromise[_0x7b7e('0x49')](_0x527403);}else{return values;}})[_0x7b7e('0x23')](function(_0x2d1908){return values;})[_0x7b7e('0x23')](respondWithResult(_0x402793,null))['catch'](handleError(_0x402793,null));};exports[_0x7b7e('0x22')]=function(_0x20108a,_0x516e75){if(_0x20108a[_0x7b7e('0x58')]['id']){delete _0x20108a[_0x7b7e('0x58')]['id'];}delete _0x20108a[_0x7b7e('0x58')]['role'];return db[_0x7b7e('0x37')]['find']({'where':{'id':_0x20108a[_0x7b7e('0x4b')]['id']}})[_0x7b7e('0x23')](handleEntityNotFound(_0x516e75,null))['then'](saveUpdates(_0x20108a[_0x7b7e('0x58')],null))[_0x7b7e('0x23')](respondWithResult(_0x516e75,null))['catch'](handleError(_0x516e75,null));};exports[_0x7b7e('0x59')]=function(_0x369103,_0x1d43af){return db[_0x7b7e('0x37')]['describe']()[_0x7b7e('0x23')](respondWithResult(_0x1d43af,null))[_0x7b7e('0x19')](handleError(_0x1d43af,null));};exports[_0x7b7e('0x5a')]=function(_0x7f705c,_0x2dc7ad){return db[_0x7b7e('0x37')][_0x7b7e('0x30')]({'where':{'id':_0x7f705c[_0x7b7e('0x4b')]['id']}})[_0x7b7e('0x23')](handleEntityNotFound(_0x2dc7ad,null))[_0x7b7e('0x23')](function(_0x5b9010){if(_0x5b9010){return _0x5b9010[_0x7b7e('0x5a')](_0x7f705c['body']['ids'],_[_0x7b7e('0x5b')](_0x7f705c[_0x7b7e('0x58')],[_0x7b7e('0x5c'),'id'])||{});}})[_0x7b7e('0x23')](respondWithResult(_0x2dc7ad,null))['catch'](handleError(_0x2dc7ad,null));};function validateUser(_0x275998){return new BPromise(function(_0x45e714,_0x3f2825){if(_0x275998[_0x7b7e('0x5d')])return _0x45e714(_0x275998);return db[_0x7b7e('0x5e')][_0x7b7e('0x5f')](0x1)['then'](function(_0x1ebd58){if(_0x1ebd58['securePassword'])authService['validatePasswordPattern'](_0x275998[_0x7b7e('0x3c')]);db['User'][_0x7b7e('0x60')]('internal')[_0x7b7e('0x23')](function(_0x148dde){if(_['isNil'](_0x148dde)){_0x275998[_0x7b7e('0x5d')]=_0x1ebd58[_0x7b7e('0x61')]||0x1;return;}if(_['isNil'](_0x1ebd58[_0x7b7e('0x61')])||_0x1ebd58[_0x7b7e('0x61')]===_0x148dde){_0x275998[_0x7b7e('0x5d')]=_0x148dde+0x1;return;}if(_0x1ebd58[_0x7b7e('0x61')]>_0x148dde){_0x275998[_0x7b7e('0x5d')]=_0x1ebd58[_0x7b7e('0x61')];return;}return db[_0x7b7e('0x62')][_0x7b7e('0x3e')](_0x7b7e('0x63'),{'type':db[_0x7b7e('0x62')]['QueryTypes']['SELECT']})[_0x7b7e('0x23')](function(_0x46ac1f){if(_0x46ac1f&&_0x46ac1f[_0x7b7e('0x44')]){for(var _0x348c77=0x0,_0xea39fa=_0x46ac1f[_0x7b7e('0x44')];_0x348c77<_0xea39fa&&_[_0x7b7e('0x64')](_0x275998['internal']);_0x348c77++){if(_0x1ebd58[_0x7b7e('0x61')]<=_0x46ac1f[_0x348c77][_0x7b7e('0x65')]){_0x275998['internal']=_0x46ac1f[_0x348c77][_0x7b7e('0x65')];}else if(_0x1ebd58[_0x7b7e('0x61')]>_0x46ac1f[_0x348c77][_0x7b7e('0x65')]&&_0x1ebd58[_0x7b7e('0x61')]<=_0x46ac1f[_0x348c77]['to']){_0x275998[_0x7b7e('0x5d')]=_0x1ebd58[_0x7b7e('0x61')];}}}if(_[_0x7b7e('0x64')](_0x275998[_0x7b7e('0x5d')])){_0x275998[_0x7b7e('0x5d')]=_0x148dde+0x1;}return _0x45e714(_0x275998);});});})[_0x7b7e('0x19')](function(_0x81617c){_0x3f2825(_0x81617c);});});}function updateUser(_0x4dd6f5){return new BPromise(function(_0xf25350,_0x131ad5){try{if(_0x4dd6f5[_0x7b7e('0x66')]){_0x4dd6f5[_0x7b7e('0x67')]=_0x4dd6f5[_0x7b7e('0x5d')];_0x4dd6f5[_0x7b7e('0x68')]={'mailbox':_0x4dd6f5[_0x7b7e('0x5d')],'password':_0x4dd6f5['password'],'fullname':_0x4dd6f5[_0x7b7e('0x69')],'email':_0x4dd6f5[_0x7b7e('0x6a')]};}if(_0x4dd6f5[_0x7b7e('0x25')]==='agent'){if(!_0x4dd6f5[_0x7b7e('0x6b')])_0x4dd6f5[_0x7b7e('0x6b')]=[_0x7b7e('0x6c'),_0x7b7e('0x6d'),_0x7b7e('0x6e'),'113','110','104',_0x7b7e('0x6f'),_0x7b7e('0x70'),_0x7b7e('0x71'),'108',_0x7b7e('0x72'),_0x7b7e('0x73'),_0x7b7e('0x74'),'114',_0x7b7e('0x75')];}_0xf25350(_0x4dd6f5);}catch(_0x2b27ef){_0x131ad5(_0x2b27ef);}});}exports[_0x7b7e('0x76')]=function(_0x34a06c,_0x538c5f){if(_0x34a06c[_0x7b7e('0x77')][_0x7b7e('0x25')]===_0x7b7e('0x29'))throw new Error(_0x7b7e('0x78'));if(_0x34a06c['body']['role']===_0x7b7e('0x77')&&_0x34a06c['user'][_0x7b7e('0x25')]!==_0x7b7e('0x26')){throw new Error(_0x7b7e('0x79'));}if(_0x34a06c[_0x7b7e('0x58')]['role']===_0x7b7e('0x26')&&_0x34a06c[_0x7b7e('0x77')][_0x7b7e('0x25')]!==_0x7b7e('0x26')){throw new Error(_0x7b7e('0x7a'));}return licenseUtil[_0x7b7e('0x7b')]([_0x34a06c[_0x7b7e('0x58')]])[_0x7b7e('0x23')](function(){return validateUser(_0x34a06c[_0x7b7e('0x58')]);})[_0x7b7e('0x23')](function(_0x13f8e3){return updateUser(_0x13f8e3)[_0x7b7e('0x23')](function(_0xbdc4b9){if(_0xbdc4b9[_0x7b7e('0x25')]===_0x7b7e('0x26')){_0xbdc4b9[_0x7b7e('0x7c')]=_0x34a06c['user'][_0x7b7e('0x7c')];delete _0xbdc4b9[_0x7b7e('0x7d')];}return _0xbdc4b9;});})[_0x7b7e('0x23')](function(_0xa03d7a){return db[_0x7b7e('0x37')][_0x7b7e('0x76')](_0xa03d7a,{'include':[{'model':db[_0x7b7e('0x68')],'as':'VoiceMail'}]});})[_0x7b7e('0x23')](function(_0x3880be){if(_0x34a06c[_0x7b7e('0x58')][_0x7b7e('0x25')]===_0x7b7e('0x77'))return _0x3880be;if(_0x34a06c['user']['role']!==_0x7b7e('0x77'))return _0x3880be;return db[_0x7b7e('0x7e')][_0x7b7e('0x30')]({'where':{'name':_0x3880be[_0x7b7e('0x25')]===_0x7b7e('0x29')?_0x7b7e('0x28'):_0x7b7e('0x2a'),'userProfileId':_0x34a06c[_0x7b7e('0x77')][_0x7b7e('0x7d')]},'raw':!![]})[_0x7b7e('0x23')](function(_0x4ce589){if(!_0x4ce589||_0x4ce589[_0x7b7e('0x7f')]!=0x0)return _0x3880be;return db[_0x7b7e('0x32')][_0x7b7e('0x76')]({'name':_0x3880be[_0x7b7e('0x31')],'resourceId':_0x3880be['id'],'type':_0x4ce589[_0x7b7e('0x31')],'sectionId':_0x4ce589['id']},{})[_0x7b7e('0x23')](function(){return _0x3880be;});})[_0x7b7e('0x19')](function(_0x4fa49d){logger[_0x7b7e('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fa49d);throw _0x4fa49d;});})[_0x7b7e('0x23')](respondWithResult(_0x538c5f,0xc9))[_0x7b7e('0x19')](handleError(_0x538c5f,null));};exports['bulkCreate']=function(_0x61424f,_0x38fd40){var _0x28e81c=_0x61424f[_0x7b7e('0x58')];var _0x3faf4c=[];if(_0x61424f['user'][_0x7b7e('0x25')]==='agent')throw new Error('Unauthorized');if(_[_0x7b7e('0x80')](_0x28e81c,[_0x7b7e('0x25'),_0x7b7e('0x77')])&&_0x61424f[_0x7b7e('0x77')]['role']!==_0x7b7e('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x7b7e('0x80')](_0x28e81c,[_0x7b7e('0x25'),_0x7b7e('0x26')])&&_0x61424f[_0x7b7e('0x77')][_0x7b7e('0x25')]!==_0x7b7e('0x26')){throw new Error(_0x7b7e('0x81'));}return licenseUtil['checkUserLimits'](_0x28e81c)[_0x7b7e('0x23')](function(){return validateUser(_0x28e81c[0x0]);})[_0x7b7e('0x23')](function(){for(var _0x4acf8b=0x1;_0x4acf8b<_0x28e81c[_0x7b7e('0x44')];_0x4acf8b++){var _0x43c42e=_0x28e81c[_0x4acf8b-0x1][_0x7b7e('0x5d')];if(!_0x28e81c[_0x4acf8b][_0x7b7e('0x5d')])_0x28e81c[_0x4acf8b][_0x7b7e('0x5d')]=_0x43c42e+0x1;_0x3faf4c[_0x7b7e('0x45')](validateUser(_0x28e81c[_0x4acf8b]));}return BPromise[_0x7b7e('0x49')](_0x3faf4c);})[_0x7b7e('0x23')](function(){_0x3faf4c=[];for(var _0x41e2b5=0x0;_0x41e2b5<_0x28e81c[_0x7b7e('0x44')];_0x41e2b5++){_0x3faf4c[_0x7b7e('0x45')](updateUser(_0x28e81c[_0x41e2b5]));}return BPromise[_0x7b7e('0x49')](_0x3faf4c);})[_0x7b7e('0x23')](function(){return BPromise[_0x7b7e('0x82')](_0x28e81c,function(_0x12d0cb){return db[_0x7b7e('0x37')][_0x7b7e('0x76')](_0x12d0cb,{'include':[{'model':db[_0x7b7e('0x68')],'as':_0x7b7e('0x68')}]})[_0x7b7e('0x23')](function(_0x3628b2){_0x12d0cb['id']=_0x3628b2['id'];return _0x12d0cb;});});})[_0x7b7e('0x23')](function(_0x4a3ff7){if(_0x61424f[_0x7b7e('0x58')][_0x7b7e('0x25')]==='user')return _0x4a3ff7;if(_0x61424f[_0x7b7e('0x77')]['role']!=='user')return _0x4a3ff7;var _0x1871d2=_['some'](_0x4a3ff7,function(_0x4d91c6){return _0x4d91c6[_0x7b7e('0x25')]===_0x7b7e('0x29')||_0x4d91c6[_0x7b7e('0x25')]==='telephone';});if(!_0x1871d2)return _0x4a3ff7;return db[_0x7b7e('0x7e')][_0x7b7e('0x83')]({'where':{'name':{'$or':[_0x7b7e('0x28'),_0x7b7e('0x2a')]},'userProfileId':_0x61424f[_0x7b7e('0x77')][_0x7b7e('0x7d')]},'raw':!![]})[_0x7b7e('0x23')](function(_0xf71a04){if(_[_0x7b7e('0x84')](_0xf71a04)||!_['some'](_0xf71a04,[_0x7b7e('0x7f'),0x0]))return _0x4a3ff7;_0x3faf4c=[];var _0x1f79b9=_(_0xf71a04)[_0x7b7e('0x85')](function(_0x4f0042){if(_0x4f0042[_0x7b7e('0x7f')]===0x1)return;return _0x4f0042[_0x7b7e('0x31')]==='Agents'?_0x7b7e('0x29'):'telephone';})['compact']()[_0x7b7e('0x2e')]();for(var _0xf01f1a=0x0;_0xf01f1a<_0x4a3ff7['length'];_0xf01f1a++){if(!_[_0x7b7e('0x2f')](_0x1f79b9,_0x4a3ff7[_0xf01f1a]['role']))return;var _0x4c7158=_0x4a3ff7[_0xf01f1a][_0x7b7e('0x25')]===_0x7b7e('0x29')?_0x7b7e('0x28'):_0x7b7e('0x2a');_0x3faf4c[_0x7b7e('0x45')](db[_0x7b7e('0x32')][_0x7b7e('0x76')]({'name':_0x4a3ff7[_0xf01f1a][_0x7b7e('0x31')],'resourceId':_0x4a3ff7[_0xf01f1a]['id'],'type':_0x4c7158,'sectionId':_['find'](_0xf71a04,[_0x7b7e('0x31'),_0x4c7158])['id']},{}));}return BPromise[_0x7b7e('0x49')](_0x3faf4c);});})[_0x7b7e('0x23')](respondWithResult(_0x38fd40,0xc9))[_0x7b7e('0x19')](handleError(_0x38fd40,null));};exports[_0x7b7e('0x86')]=function(_0x13c910,_0xf16368){if(_0x13c910[_0x7b7e('0x58')]['id']){delete _0x13c910[_0x7b7e('0x58')]['id'];}return db[_0x7b7e('0x37')][_0x7b7e('0x30')]({'where':{'id':_0x13c910[_0x7b7e('0x4b')]['id']}})['then'](function(_0x493128){if(!_0x493128)return null;if(_0x493128['id']===_0x13c910[_0x7b7e('0x77')]['id']){if(!_0x13c910[_0x7b7e('0x58')][_0x7b7e('0x87')]||!_0x13c910[_0x7b7e('0x58')][_0x7b7e('0x88')]){throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x8a'))](_0x7b7e('0x8b'));}if(!_0x493128[_0x7b7e('0x8c')](_0x13c910[_0x7b7e('0x58')][_0x7b7e('0x87')])){throw new db[(_0x7b7e('0x89'))]['ValidationError'](_0x7b7e('0x8d'));}if(_0x13c910['body'][_0x7b7e('0x87')]===_0x13c910[_0x7b7e('0x58')][_0x7b7e('0x88')]){throw new db['Sequelize']['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x13c910[_0x7b7e('0x77')][_0x7b7e('0x25')]===_0x7b7e('0x26')){if(!_0x13c910[_0x7b7e('0x58')][_0x7b7e('0x88')]){throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x8a'))](_0x7b7e('0x8e'));}}else if(_0x13c910[_0x7b7e('0x77')][_0x7b7e('0x25')]===_0x7b7e('0x77')){if(!_0x13c910['body'][_0x7b7e('0x88')]){throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x8a'))](_0x7b7e('0x8e'));}if(_0x493128['role']!==_0x7b7e('0x29')){throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x8a'))](_0x7b7e('0x78'));}}else{throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x8a'))](_0x7b7e('0x78'));}return _0x493128;})[_0x7b7e('0x23')](handleEntityNotFound(_0xf16368,null))[_0x7b7e('0x23')](function(_0x34491e){return db[_0x7b7e('0x5e')][_0x7b7e('0x8f')]({'attributes':['id',_0x7b7e('0x90'),_0x7b7e('0x91'),_0x7b7e('0x92')]})[_0x7b7e('0x23')](function(_0x33243c){if(_0x33243c[_0x7b7e('0x90')])authService[_0x7b7e('0x93')](_0x13c910[_0x7b7e('0x58')][_0x7b7e('0x88')]);if(!_0x33243c[_0x7b7e('0x91')]||!_0x34491e[_0x7b7e('0x94')])return _0x34491e;authService[_0x7b7e('0x95')](_0x13c910[_0x7b7e('0x58')][_0x7b7e('0x88')],_0x34491e[_0x7b7e('0x94')],_0x33243c[_0x7b7e('0x92')]);return _0x34491e;})['then'](saveUpdates({'password':_0x13c910[_0x7b7e('0x58')]['newPassword'],'passwordResetAt':_0x13c910['user']['id']==_0x13c910['params']['id']?moment():null,'previousPasswords':authService[_0x7b7e('0x96')](_0x13c910[_0x7b7e('0x58')]['newPassword'],_0x34491e['previousPasswords'])},null));})[_0x7b7e('0x23')](respondWithResult(_0xf16368,null))[_0x7b7e('0x19')](handleError(_0xf16368,null));};exports[_0x7b7e('0x97')]=function(_0x5b0abe,_0xf128f8){var _0x587012=_0x5b0abe['body'][_0x7b7e('0x98')];return db['User']['find']({'where':{'id':_0x5b0abe[_0x7b7e('0x4b')]['id']},'attributes':['id',_0x7b7e('0x31'),_0x7b7e('0x25'),'online','loginInPause',_0x7b7e('0x99'),_0x7b7e('0x9a')]})[_0x7b7e('0x23')](handleEntityNotFound(_0xf128f8,null))[_0x7b7e('0x23')](function(_0x14310d){if(_0x14310d){if(!utils[_0x7b7e('0x9b')](_0x587012)){throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x8a'))](_0x7b7e('0x9c'));}return _0x14310d['add'+_[_0x7b7e('0x9d')](_0x587012['toLowerCase']())+_0x7b7e('0x9e')](_0x5b0abe[_0x7b7e('0x58')][_0x7b7e('0x5c')],{'penalty':_0x5b0abe[_0x7b7e('0x58')][_0x7b7e('0x9f')]||0x0})['spread'](function(_0x33b313){for(var _0x216de1=0x0;_0x216de1<_0x5b0abe[_0x7b7e('0x58')][_0x7b7e('0x5c')]['length'];_0x216de1+=0x1){var _0x137ba6={'UserId':Number(_0x5b0abe[_0x7b7e('0x4b')]['id'])};_0x137ba6[_['capitalize'](_0x587012[_0x7b7e('0xa0')]())+_0x7b7e('0xa1')]=Number(_0x5b0abe[_0x7b7e('0x58')][_0x7b7e('0x5c')][_0x216de1]);socket[_0x7b7e('0xa2')](_0x7b7e('0x77')+_[_0x7b7e('0x9d')](_0x587012[_0x7b7e('0xa0')]())+_0x7b7e('0xa3'),_0x137ba6);}return _0x33b313;})[_0x7b7e('0x23')](function(){if(_0x587012===_0x7b7e('0xa4')){return db['VoiceQueue'][_0x7b7e('0x83')]({'where':{'id':_0x5b0abe[_0x7b7e('0x58')]['ids']||[]},'raw':!![],'attributes':['id',_0x7b7e('0x31')]});}})['then'](function(_0x373d35){var _0x772419=_0x14310d[_0x7b7e('0x24')]({'plain':!![]});var _0x4feae0=[];if(_0x587012===_0x7b7e('0xa4')&&_0x772419[_0x7b7e('0x25')]===_0x7b7e('0x29')&&_0x772419[_0x7b7e('0xa5')]){for(var _0xeeaf19=0x0;_0xeeaf19<_0x373d35[_0x7b7e('0x44')];_0xeeaf19+=0x1){_0x4feae0[_0x7b7e('0x45')]({'membername':_0x772419[_0x7b7e('0x31')],'UserId':_0x772419['id'],'queue_name':_0x373d35[_0xeeaf19][_0x7b7e('0x31')],'VoiceQueueId':_0x373d35[_0xeeaf19]['id'],'interface':_[_0x7b7e('0x64')](_0x772419['interface'])?util[_0x7b7e('0xa6')](_0x7b7e('0xa7'),_0x772419[_0x7b7e('0x31')]):_0x772419['interface'],'paused':_0x772419['voicePause']||![],'penalty':_0x5b0abe[_0x7b7e('0x58')]['penalty']||0x0});}return BPromise['each'](_0x4feae0,function(_0x26aef0){return db[_0x7b7e('0xa8')][_0x7b7e('0xa9')](_0x26aef0);});}return _0x14310d;});}})['then'](respondWithStatusCode(_0xf128f8,null))[_0x7b7e('0x19')](handleError(_0xf128f8,null));};exports[_0x7b7e('0xaa')]=function(_0x26d962,_0x43f6f3){var _0x3da40c;return db['User'][_0x7b7e('0x30')]({'where':{'id':_0x26d962[_0x7b7e('0x4b')]['id']},'attributes':['id',_0x7b7e('0x31'),_0x7b7e('0x25')]})[_0x7b7e('0x23')](handleEntityNotFound(_0x43f6f3,null))[_0x7b7e('0x23')](function(_0x50dd97){if(_0x50dd97){_0x3da40c=_0x50dd97;if(!_0x26d962['query'][_0x7b7e('0x98')]||!utils['isValidChannel'](_0x26d962[_0x7b7e('0x3e')][_0x7b7e('0x98')])){throw new db[(_0x7b7e('0x89'))][(_0x7b7e('0x8a'))](_0x7b7e('0x9c'));}return _0x50dd97[_0x7b7e('0xab')+_[_0x7b7e('0x9d')](_0x26d962['query']['channel'][_0x7b7e('0xa0')]())+_0x7b7e('0x9e')](_0x26d962['query'][_0x7b7e('0x5c')]);}})[_0x7b7e('0x23')](function(_0x4f6c25){if(_['isArray'](_0x26d962[_0x7b7e('0x3e')][_0x7b7e('0x5c')])){for(var _0x1ac6ea=0x0;_0x1ac6ea<_0x26d962['query'][_0x7b7e('0x5c')][_0x7b7e('0x44')];_0x1ac6ea+=0x1){var _0x4c500b={'UserId':Number(_0x26d962[_0x7b7e('0x4b')]['id'])};_0x4c500b[_[_0x7b7e('0x9d')](_0x26d962[_0x7b7e('0x3e')][_0x7b7e('0x98')][_0x7b7e('0xa0')]())+_0x7b7e('0xa1')]=Number(_0x26d962[_0x7b7e('0x3e')]['ids'][_0x1ac6ea]);socket['emit']('user'+_[_0x7b7e('0x9d')](_0x26d962['query'][_0x7b7e('0x98')][_0x7b7e('0xa0')]())+_0x7b7e('0xac'),_0x4c500b);}}else{var _0x4c500b={'UserId':Number(_0x26d962[_0x7b7e('0x4b')]['id'])};_0x4c500b[_[_0x7b7e('0x9d')](_0x26d962[_0x7b7e('0x3e')][_0x7b7e('0x98')][_0x7b7e('0xa0')]())+_0x7b7e('0xa1')]=Number(_0x26d962[_0x7b7e('0x3e')]['ids']);socket['emit']('user'+_[_0x7b7e('0x9d')](_0x26d962[_0x7b7e('0x3e')][_0x7b7e('0x98')][_0x7b7e('0xa0')]())+_0x7b7e('0xac'),_0x4c500b);}return _0x4f6c25;})[_0x7b7e('0x23')](function(){if(_0x26d962[_0x7b7e('0x3e')][_0x7b7e('0x98')]===_0x7b7e('0xa4')){return db['UserVoiceQueueRt'][_0x7b7e('0x33')]({'where':{'UserId':_0x26d962[_0x7b7e('0x4b')]['id'],'VoiceQueueId':_0x26d962[_0x7b7e('0x3e')]['ids']},'individualHooks':!![]})[_0x7b7e('0x23')](function(){return _0x3da40c;});}return _0x3da40c;})['then'](respondWithStatusCode(_0x43f6f3,null))[_0x7b7e('0x19')](handleError(_0x43f6f3,null));};exports[_0x7b7e('0xad')]=function(_0x421ddc,_0x1e1a85){_0x421ddc['body'][_0x7b7e('0xae')]=_0x421ddc[_0x7b7e('0xaf')][_0x7b7e('0xb0')];return db[_0x7b7e('0x37')][_0x7b7e('0x30')]({'where':{'id':_0x421ddc['params']['id']}})[_0x7b7e('0x23')](handleEntityNotFound(_0x1e1a85,null))[_0x7b7e('0x23')](saveUpdates(_0x421ddc[_0x7b7e('0x58')],null))[_0x7b7e('0x23')](respondWithResult(_0x1e1a85,null))[_0x7b7e('0x19')](handleError(_0x1e1a85,null));};exports[_0x7b7e('0xb1')]=function(_0x2502c0,_0x1bb089){var _0x576d82=path[_0x7b7e('0xb2')](config[_0x7b7e('0xb3')],_0x7b7e('0xb4'));return db[_0x7b7e('0x37')][_0x7b7e('0x30')]({'where':{'id':_0x2502c0['params']['id']},'attributes':['id',_0x7b7e('0xae')],'raw':!![]})[_0x7b7e('0x23')](handleEntityNotFound(_0x1bb089,null))[_0x7b7e('0x23')](function(_0x3b972e){if(_0x3b972e){if(_[_0x7b7e('0x64')](_0x3b972e[_0x7b7e('0xae')])){return _0x1bb089[_0x7b7e('0xb5')](_0x576d82);}else{if(!fs[_0x7b7e('0xb6')](path[_0x7b7e('0xb2')](config[_0x7b7e('0xb3')],'server/files/images/',_0x3b972e[_0x7b7e('0xae')]))){return _0x1bb089['download'](_0x576d82);}return _0x1bb089[_0x7b7e('0xb5')](path[_0x7b7e('0xb2')](config[_0x7b7e('0xb3')],_0x7b7e('0xb7'),_0x3b972e[_0x7b7e('0xae')]));}}})[_0x7b7e('0x19')](handleError(_0x1bb089,null));};exports[_0x7b7e('0xb8')]=function(_0x38a9ae,_0x363882){return db[_0x7b7e('0x37')][_0x7b7e('0x30')]({'where':{'id':_0x38a9ae[_0x7b7e('0x4b')]['id']},'attributes':['id']})[_0x7b7e('0x23')](handleEntityNotFound(_0x363882,null))['then'](function(_0x5d04e0){var _0x1072f8=[];values=_0x5d04e0['dataValues'];_0x1072f8[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0xb9'),_0x5d04e0[_0x7b7e('0x46')]));_0x1072f8[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0x47'),_0x5d04e0['dataValues']));_0x1072f8[_0x7b7e('0x45')](get_open_tabs('openchannel',_0x5d04e0['dataValues']));_0x1072f8['push'](get_open_tabs(_0x7b7e('0x56'),_0x5d04e0[_0x7b7e('0x46')]));_0x1072f8[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0x57'),_0x5d04e0[_0x7b7e('0x46')]));_0x1072f8[_0x7b7e('0x45')](get_open_tabs(_0x7b7e('0x48'),_0x5d04e0['dataValues']));return BPromise[_0x7b7e('0x49')](_0x1072f8);})[_0x7b7e('0x23')](function(_0x19cbe0){var _0x176b1a=[];if(_0x19cbe0){for(var _0x355931=0x0;_0x355931=_0x21c898){_0x541ef1=_0x21c898;_0x1a33bb=0xc8;}else{_0x1a33bb=0xce;}_0x488f9f[_0x3e1e('0x1a')](_0x1a33bb);return _0x488f9f['set'](_0x3e1e('0x20'),_0x5d908e+'-'+_0x541ef1+'/'+_0x21c898)['json'](_0x56ae51);}return null;};}function saveUpdates(_0xdfcd93){return function(_0x176bb4){if(_0x176bb4){return _0x176bb4['update'](_0xdfcd93)[_0x3e1e('0x21')](function(_0x210a84){return _0x210a84;});}return null;};}function removeEntity(_0x45ed0e){return function(_0x4d3695){if(_0x4d3695){return _0x4d3695[_0x3e1e('0x22')]()['then'](function(){var _0x591c36=_0x4d3695['get']({'plain':!![]});if(_0x591c36[_0x3e1e('0x23')]==='admin')return;var _0x5c9b3f=[{'name':_0x3e1e('0x24'),'value':_0x3e1e('0x25'),'ignore':!![]},{'name':_0x3e1e('0x26'),'value':_0x3e1e('0x27'),'ignore':![]},{'name':_0x3e1e('0x28'),'value':'telephone','ignore':![]}];var _0x5522ba=_(_0x5c9b3f)['filter']('ignore')[_0x3e1e('0x29')](_0x3e1e('0x2a'))[_0x3e1e('0x2a')]();if(_[_0x3e1e('0x2b')](_0x5522ba,_0x591c36[_0x3e1e('0x23')])){return;}var _0x3b9c6e=_[_0x3e1e('0x2c')](_0x5c9b3f,[_0x3e1e('0x2a'),_0x591c36['role']])[_0x3e1e('0x2d')];return db[_0x3e1e('0x2e')]['destroy']({'where':{'type':_0x3b9c6e,'resourceId':_0x591c36['id']}})[_0x3e1e('0x21')](function(){return _0x4d3695;});})[_0x3e1e('0x21')](function(){_0x45ed0e[_0x3e1e('0x1a')](0xcc)[_0x3e1e('0x1b')]();});}};}function handleEntityNotFound(_0x55a082){return function(_0x597596){if(!_0x597596){_0x55a082[_0x3e1e('0x2f')](0x194);}return _0x597596;};}function handleError(_0x332f1e,_0x55ebaf){_0x55ebaf=_0x55ebaf||0x1f4;return function(_0x266958){logger[_0x3e1e('0x14')](_0x266958['stack']);if(_0x266958[_0x3e1e('0x2d')]){delete _0x266958[_0x3e1e('0x2d')];}_0x332f1e[_0x3e1e('0x1a')](_0x55ebaf)[_0x3e1e('0x30')](_0x266958);};}exports[_0x3e1e('0x31')]=function(_0x5ef730,_0x1da527){var _0x42556a={},_0x1c622e={'count':0x0,'rows':[]};var _0xc74497=_(db['User'][_0x3e1e('0x32')])[_0x3e1e('0x29')](function(_0x111da4){return{'name':_0x111da4[_0x3e1e('0x33')],'type':_0x111da4[_0x3e1e('0x34')][_0x3e1e('0x35')]};})[_0x3e1e('0x36')](function(_0x59ed99){return!_[_0x3e1e('0x2b')](['password','salt'],_0x59ed99[_0x3e1e('0x2d')]);})[_0x3e1e('0x2a')]();_0x42556a=qs[_0x3e1e('0x37')](_0xc74497,_0x5ef730);var _0x529ff3={'where':_0x42556a[_0x3e1e('0x38')]};return db[_0x3e1e('0x39')]['count'](_0x529ff3)[_0x3e1e('0x21')](function(_0x168dc1){_0x1c622e['count']=_0x168dc1;if(_0x5ef730['query'][_0x3e1e('0x3a')]){_0x42556a['include']=[{'all':!![]}];}if(!_['includes'](_0x42556a[_0x3e1e('0x3b')],'id')){_0x42556a[_0x3e1e('0x3b')][_0x3e1e('0x3c')]('id');}return db[_0x3e1e('0x39')][_0x3e1e('0x3d')](_0x42556a);})['then'](function(_0x5b32ad){_0x1c622e[_0x3e1e('0x3e')]=_0x5b32ad;if(_0x5ef730[_0x3e1e('0x3f')][_0x3e1e('0x40')]==='true'){var _0x1124d0=[];for(var _0x2dcce1=0x0;_0x2dcce1<_0x1c622e[_0x3e1e('0x3e')]['length'];_0x2dcce1++){_0x1124d0[_0x3e1e('0x3c')](get_open_tabs('chat',_0x1c622e['rows'][_0x2dcce1][_0x3e1e('0x41')]));_0x1124d0[_0x3e1e('0x3c')](get_open_tabs(_0x3e1e('0x42'),_0x1c622e[_0x3e1e('0x3e')][_0x2dcce1]['dataValues']));_0x1124d0['push'](get_open_tabs('fax',_0x1c622e['rows'][_0x2dcce1][_0x3e1e('0x41')]));_0x1124d0[_0x3e1e('0x3c')](get_open_tabs('mail',_0x1c622e['rows'][_0x2dcce1][_0x3e1e('0x41')]));_0x1124d0[_0x3e1e('0x3c')](get_open_tabs(_0x3e1e('0x43'),_0x1c622e['rows'][_0x2dcce1][_0x3e1e('0x41')]));_0x1124d0['push'](get_open_tabs(_0x3e1e('0x44'),_0x1c622e[_0x3e1e('0x3e')][_0x2dcce1][_0x3e1e('0x41')]));}return BPromise[_0x3e1e('0x45')](_0x1124d0)[_0x3e1e('0x21')](function(_0x3de309){return _0x1c622e;});}else{return _0x1c622e;}})['then'](respondWithFilteredResult(_0x1da527,_0x42556a))[_0x3e1e('0x19')](handleError(_0x1da527,null));};exports[_0x3e1e('0x46')]=function(_0x5f3064,_0x196da9){var _0x24d320={'raw':![],'where':{'id':_0x5f3064[_0x3e1e('0x47')]['id']}},_0x551573={};_0x551573[_0x3e1e('0x48')]=_[_0x3e1e('0x49')](_[_0x3e1e('0x4a')](db['User'][_0x3e1e('0x32')]),[_0x3e1e('0x4b'),_0x3e1e('0x4c')]);_0x551573[_0x3e1e('0x3f')]=_['keys'](_0x5f3064[_0x3e1e('0x3f')]);_0x551573[_0x3e1e('0x4d')]=_[_0x3e1e('0x4e')](_0x551573[_0x3e1e('0x48')],_0x551573[_0x3e1e('0x3f')]);_0x24d320[_0x3e1e('0x3b')]=_[_0x3e1e('0x4e')](_0x551573[_0x3e1e('0x48')],qs['fields'](_0x5f3064[_0x3e1e('0x3f')]['fields']));_0x24d320['attributes']=_0x24d320['attributes'][_0x3e1e('0x4f')]?_0x24d320[_0x3e1e('0x3b')]:_0x551573['model'];if(_0x5f3064[_0x3e1e('0x3f')]['includeAll']){_0x24d320['include']=[{'all':!![]}];}_0x24d320=_[_0x3e1e('0x50')]({},_0x24d320,_0x5f3064['options']);if(!_['includes'](_0x24d320['attributes'],'id')){_0x24d320[_0x3e1e('0x3b')][_0x3e1e('0x3c')]('id');}return db[_0x3e1e('0x39')][_0x3e1e('0x2c')](_0x24d320)[_0x3e1e('0x21')](handleEntityNotFound(_0x196da9,null))[_0x3e1e('0x21')](function(_0x3493d7){var _0x5b71a6=[];values=_0x3493d7;if(_0x5f3064[_0x3e1e('0x3f')]['openTabs']===_0x3e1e('0x51')){_0x5b71a6[_0x3e1e('0x3c')](get_open_tabs(_0x3e1e('0x52'),_0x3493d7['dataValues']));_0x5b71a6['push'](get_open_tabs(_0x3e1e('0x42'),_0x3493d7[_0x3e1e('0x41')]));_0x5b71a6['push'](get_open_tabs(_0x3e1e('0x43'),_0x3493d7['dataValues']));_0x5b71a6['push'](get_open_tabs(_0x3e1e('0x44'),_0x3493d7[_0x3e1e('0x41')]));_0x5b71a6['push'](get_open_tabs(_0x3e1e('0x53'),_0x3493d7['dataValues']));_0x5b71a6['push'](get_open_tabs(_0x3e1e('0x54'),_0x3493d7['dataValues']));return BPromise[_0x3e1e('0x45')](_0x5b71a6);}else{return values;}})['then'](function(_0x2054e1){return values;})['then'](respondWithResult(_0x196da9,null))[_0x3e1e('0x19')](handleError(_0x196da9,null));};exports[_0x3e1e('0x55')]=function(_0x48be40,_0x4dfc6d){if(_0x48be40['body']['id']){delete _0x48be40[_0x3e1e('0x56')]['id'];}delete _0x48be40[_0x3e1e('0x56')][_0x3e1e('0x23')];return db['User'][_0x3e1e('0x2c')]({'where':{'id':_0x48be40[_0x3e1e('0x47')]['id']}})[_0x3e1e('0x21')](handleEntityNotFound(_0x4dfc6d,null))['then'](saveUpdates(_0x48be40['body'],null))[_0x3e1e('0x21')](respondWithResult(_0x4dfc6d,null))['catch'](handleError(_0x4dfc6d,null));};exports[_0x3e1e('0x57')]=function(_0x6c0364,_0x13eefb){return db['User'][_0x3e1e('0x57')]()['then'](respondWithResult(_0x13eefb,null))[_0x3e1e('0x19')](handleError(_0x13eefb,null));};exports[_0x3e1e('0x58')]=function(_0x5c9b0d,_0x3b09b6){return db['User'][_0x3e1e('0x2c')]({'where':{'id':_0x5c9b0d['params']['id']}})[_0x3e1e('0x21')](handleEntityNotFound(_0x3b09b6,null))['then'](function(_0x31062e){if(_0x31062e){return _0x31062e[_0x3e1e('0x58')](_0x5c9b0d[_0x3e1e('0x56')]['ids'],_[_0x3e1e('0x59')](_0x5c9b0d[_0x3e1e('0x56')],['ids','id'])||{});}})[_0x3e1e('0x21')](respondWithResult(_0x3b09b6,null))['catch'](handleError(_0x3b09b6,null));};function validateUser(_0x4e328c){return new BPromise(function(_0x4fc07a,_0x182da4){if(_0x4e328c[_0x3e1e('0x5a')])return _0x4fc07a(_0x4e328c);return db[_0x3e1e('0x5b')][_0x3e1e('0x5c')](0x1)[_0x3e1e('0x21')](function(_0x1ca6ed){if(_0x1ca6ed[_0x3e1e('0x5d')])authService['validatePasswordPattern'](_0x4e328c[_0x3e1e('0x4b')]);db[_0x3e1e('0x39')][_0x3e1e('0x5e')](_0x3e1e('0x5a'))[_0x3e1e('0x21')](function(_0x37224a){if(_[_0x3e1e('0x5f')](_0x37224a)){_0x4e328c[_0x3e1e('0x5a')]=_0x1ca6ed['min_internal']||0x1;return;}if(_['isNil'](_0x1ca6ed[_0x3e1e('0x60')])||_0x1ca6ed[_0x3e1e('0x60')]===_0x37224a){_0x4e328c[_0x3e1e('0x5a')]=_0x37224a+0x1;return;}if(_0x1ca6ed[_0x3e1e('0x60')]>_0x37224a){_0x4e328c[_0x3e1e('0x5a')]=_0x1ca6ed[_0x3e1e('0x60')];return;}return db[_0x3e1e('0x61')][_0x3e1e('0x3f')](_0x3e1e('0x62'),{'type':db[_0x3e1e('0x61')][_0x3e1e('0x63')][_0x3e1e('0x64')]})['then'](function(_0x5581ee){if(_0x5581ee&&_0x5581ee[_0x3e1e('0x4f')]){for(var _0x29ddc4=0x0,_0x477e64=_0x5581ee[_0x3e1e('0x4f')];_0x29ddc4<_0x477e64&&_[_0x3e1e('0x5f')](_0x4e328c['internal']);_0x29ddc4++){if(_0x1ca6ed[_0x3e1e('0x60')]<=_0x5581ee[_0x29ddc4][_0x3e1e('0x65')]){_0x4e328c[_0x3e1e('0x5a')]=_0x5581ee[_0x29ddc4][_0x3e1e('0x65')];}else if(_0x1ca6ed[_0x3e1e('0x60')]>_0x5581ee[_0x29ddc4]['from']&&_0x1ca6ed[_0x3e1e('0x60')]<=_0x5581ee[_0x29ddc4]['to']){_0x4e328c[_0x3e1e('0x5a')]=_0x1ca6ed[_0x3e1e('0x60')];}}}if(_[_0x3e1e('0x5f')](_0x4e328c[_0x3e1e('0x5a')])){_0x4e328c[_0x3e1e('0x5a')]=_0x37224a+0x1;}return _0x4fc07a(_0x4e328c);});});})['catch'](function(_0x2692e8){_0x182da4(_0x2692e8);});});}function updateUser(_0x224ebe){return new BPromise(function(_0x34f093,_0x437c62){try{if(_0x224ebe[_0x3e1e('0x66')]){_0x224ebe[_0x3e1e('0x67')]=_0x224ebe['internal'];_0x224ebe[_0x3e1e('0x68')]={'mailbox':_0x224ebe[_0x3e1e('0x5a')],'password':_0x224ebe[_0x3e1e('0x4b')],'fullname':_0x224ebe[_0x3e1e('0x69')],'email':_0x224ebe[_0x3e1e('0x6a')]};}if(_0x224ebe[_0x3e1e('0x23')]==='agent'){if(!_0x224ebe[_0x3e1e('0x6b')])_0x224ebe['permissions']=[_0x3e1e('0x6c'),_0x3e1e('0x6d'),'103',_0x3e1e('0x6e'),_0x3e1e('0x6f'),_0x3e1e('0x70'),_0x3e1e('0x71'),'106',_0x3e1e('0x72'),'108',_0x3e1e('0x73'),_0x3e1e('0x74'),_0x3e1e('0x75'),_0x3e1e('0x76'),_0x3e1e('0x77')];}_0x34f093(_0x224ebe);}catch(_0x2083f2){_0x437c62(_0x2083f2);}});}exports['create']=function(_0x1714aa,_0x7aec78){if(_0x1714aa[_0x3e1e('0x25')][_0x3e1e('0x23')]==='agent')throw new Error(_0x3e1e('0x78'));if(_0x1714aa[_0x3e1e('0x56')][_0x3e1e('0x23')]===_0x3e1e('0x25')&&_0x1714aa['user'][_0x3e1e('0x23')]!==_0x3e1e('0x79')){throw new Error(_0x3e1e('0x7a'));}if(_0x1714aa[_0x3e1e('0x56')][_0x3e1e('0x23')]===_0x3e1e('0x79')&&_0x1714aa['user']['role']!=='admin'){throw new Error(_0x3e1e('0x7b'));}return licenseUtil['checkUserLimits']([_0x1714aa[_0x3e1e('0x56')]])['then'](function(){return validateUser(_0x1714aa[_0x3e1e('0x56')]);})[_0x3e1e('0x21')](function(_0x176c46){return updateUser(_0x176c46)[_0x3e1e('0x21')](function(_0x5a5d38){if(_0x5a5d38[_0x3e1e('0x23')]==='admin'){_0x5a5d38[_0x3e1e('0x7c')]=_0x1714aa['user'][_0x3e1e('0x7c')];delete _0x5a5d38[_0x3e1e('0x7d')];}return _0x5a5d38;});})['then'](function(_0x6e5919){return db[_0x3e1e('0x39')][_0x3e1e('0x7e')](_0x6e5919,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x3e1e('0x21')](function(_0x20bb6d){if(_0x1714aa[_0x3e1e('0x56')]['role']===_0x3e1e('0x25'))return _0x20bb6d;if(_0x1714aa['user']['role']!=='user')return _0x20bb6d;return db[_0x3e1e('0x7f')]['find']({'where':{'name':_0x20bb6d[_0x3e1e('0x23')]===_0x3e1e('0x27')?_0x3e1e('0x26'):_0x3e1e('0x28'),'userProfileId':_0x1714aa[_0x3e1e('0x25')][_0x3e1e('0x7d')]},'raw':!![]})[_0x3e1e('0x21')](function(_0x1198df){if(!_0x1198df||_0x1198df[_0x3e1e('0x80')]!=0x0)return _0x20bb6d;return db['UserProfileResource']['create']({'name':_0x20bb6d[_0x3e1e('0x2d')],'resourceId':_0x20bb6d['id'],'type':_0x1198df[_0x3e1e('0x2d')],'sectionId':_0x1198df['id']},{})[_0x3e1e('0x21')](function(){return _0x20bb6d;});})[_0x3e1e('0x19')](function(_0x3b497e){logger[_0x3e1e('0x14')](_0x3e1e('0x81'),_0x3b497e);throw _0x3b497e;});})[_0x3e1e('0x21')](respondWithResult(_0x7aec78,0xc9))[_0x3e1e('0x19')](handleError(_0x7aec78,null));};exports['bulkCreate']=function(_0x2bb374,_0x3b71ee){var _0x1b26b3=_0x2bb374[_0x3e1e('0x56')];var _0x328142=[];if(_0x2bb374[_0x3e1e('0x25')][_0x3e1e('0x23')]===_0x3e1e('0x27'))throw new Error(_0x3e1e('0x78'));if(_[_0x3e1e('0x82')](_0x1b26b3,[_0x3e1e('0x23'),_0x3e1e('0x25')])&&_0x2bb374['user'][_0x3e1e('0x23')]!==_0x3e1e('0x79')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x3e1e('0x82')](_0x1b26b3,[_0x3e1e('0x23'),_0x3e1e('0x79')])&&_0x2bb374[_0x3e1e('0x25')]['role']!==_0x3e1e('0x79')){throw new Error(_0x3e1e('0x83'));}return licenseUtil[_0x3e1e('0x84')](_0x1b26b3)[_0x3e1e('0x21')](function(){return validateUser(_0x1b26b3[0x0]);})[_0x3e1e('0x21')](function(){for(var _0x285f83=0x1;_0x285f83<_0x1b26b3[_0x3e1e('0x4f')];_0x285f83++){var _0x3b9913=_0x1b26b3[_0x285f83-0x1]['internal'];if(!_0x1b26b3[_0x285f83][_0x3e1e('0x5a')])_0x1b26b3[_0x285f83]['internal']=_0x3b9913+0x1;_0x328142[_0x3e1e('0x3c')](validateUser(_0x1b26b3[_0x285f83]));}return BPromise[_0x3e1e('0x45')](_0x328142);})[_0x3e1e('0x21')](function(){_0x328142=[];for(var _0x1ddb7c=0x0;_0x1ddb7c<_0x1b26b3['length'];_0x1ddb7c++){_0x328142[_0x3e1e('0x3c')](updateUser(_0x1b26b3[_0x1ddb7c]));}return BPromise['all'](_0x328142);})[_0x3e1e('0x21')](function(){return BPromise['each'](_0x1b26b3,function(_0x1be666){return db[_0x3e1e('0x39')]['create'](_0x1be666,{'include':[{'model':db[_0x3e1e('0x68')],'as':_0x3e1e('0x68')}]})['then'](function(_0x3d2406){_0x1be666['id']=_0x3d2406['id'];return _0x1be666;});});})[_0x3e1e('0x21')](function(_0x3b6af5){if(_0x2bb374[_0x3e1e('0x56')][_0x3e1e('0x23')]===_0x3e1e('0x25'))return _0x3b6af5;if(_0x2bb374[_0x3e1e('0x25')]['role']!==_0x3e1e('0x25'))return _0x3b6af5;var _0x3d9cbf=_['some'](_0x3b6af5,function(_0x11732a){return _0x11732a[_0x3e1e('0x23')]===_0x3e1e('0x27')||_0x11732a['role']===_0x3e1e('0x85');});if(!_0x3d9cbf)return _0x3b6af5;return db[_0x3e1e('0x7f')][_0x3e1e('0x3d')]({'where':{'name':{'$or':['Agents',_0x3e1e('0x28')]},'userProfileId':_0x2bb374['user'][_0x3e1e('0x7d')]},'raw':!![]})[_0x3e1e('0x21')](function(_0x27cdfb){if(_[_0x3e1e('0x86')](_0x27cdfb)||!_[_0x3e1e('0x82')](_0x27cdfb,['autoAssociation',0x0]))return _0x3b6af5;_0x328142=[];var _0x27c66a=_(_0x27cdfb)[_0x3e1e('0x29')](function(_0x1f02fe){if(_0x1f02fe[_0x3e1e('0x80')]===0x1)return;return _0x1f02fe[_0x3e1e('0x2d')]===_0x3e1e('0x26')?_0x3e1e('0x27'):_0x3e1e('0x85');})[_0x3e1e('0x87')]()['value']();for(var _0x2edd1a=0x0;_0x2edd1a<_0x3b6af5[_0x3e1e('0x4f')];_0x2edd1a++){if(!_[_0x3e1e('0x2b')](_0x27c66a,_0x3b6af5[_0x2edd1a][_0x3e1e('0x23')]))return;var _0x121fc8=_0x3b6af5[_0x2edd1a]['role']===_0x3e1e('0x27')?_0x3e1e('0x26'):_0x3e1e('0x28');_0x328142[_0x3e1e('0x3c')](db[_0x3e1e('0x2e')][_0x3e1e('0x7e')]({'name':_0x3b6af5[_0x2edd1a][_0x3e1e('0x2d')],'resourceId':_0x3b6af5[_0x2edd1a]['id'],'type':_0x121fc8,'sectionId':_[_0x3e1e('0x2c')](_0x27cdfb,[_0x3e1e('0x2d'),_0x121fc8])['id']},{}));}return BPromise['all'](_0x328142);});})[_0x3e1e('0x21')](respondWithResult(_0x3b71ee,0xc9))[_0x3e1e('0x19')](handleError(_0x3b71ee,null));};exports['changePassword']=function(_0x44c4a4,_0x537072){if(_0x44c4a4[_0x3e1e('0x56')]['id']){delete _0x44c4a4[_0x3e1e('0x56')]['id'];}return db[_0x3e1e('0x39')][_0x3e1e('0x2c')]({'where':{'id':_0x44c4a4[_0x3e1e('0x47')]['id']}})[_0x3e1e('0x21')](function(_0x2ca96b){if(!_0x2ca96b)return null;if(_0x2ca96b['id']===_0x44c4a4[_0x3e1e('0x25')]['id']){if(!_0x44c4a4[_0x3e1e('0x56')][_0x3e1e('0x88')]||!_0x44c4a4['body']['newPassword']){throw new db[(_0x3e1e('0x89'))][(_0x3e1e('0x8a'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2ca96b[_0x3e1e('0x8b')](_0x44c4a4[_0x3e1e('0x56')][_0x3e1e('0x88')])){throw new db['Sequelize']['ValidationError'](_0x3e1e('0x8c'));}if(_0x44c4a4[_0x3e1e('0x56')][_0x3e1e('0x88')]===_0x44c4a4['body'][_0x3e1e('0x8d')]){throw new db['Sequelize']['ValidationError'](_0x3e1e('0x8e'));}}else if(_0x44c4a4[_0x3e1e('0x25')]['role']===_0x3e1e('0x79')){if(!_0x44c4a4[_0x3e1e('0x56')][_0x3e1e('0x8d')]){throw new db[(_0x3e1e('0x89'))][(_0x3e1e('0x8a'))](_0x3e1e('0x8f'));}}else if(_0x44c4a4[_0x3e1e('0x25')][_0x3e1e('0x23')]===_0x3e1e('0x25')){if(!_0x44c4a4[_0x3e1e('0x56')][_0x3e1e('0x8d')]){throw new db['Sequelize']['ValidationError'](_0x3e1e('0x8f'));}if(_0x2ca96b[_0x3e1e('0x23')]!==_0x3e1e('0x27')){throw new db[(_0x3e1e('0x89'))]['ValidationError'](_0x3e1e('0x78'));}}else{throw new db[(_0x3e1e('0x89'))]['ValidationError']('Unauthorized');}return _0x2ca96b;})[_0x3e1e('0x21')](handleEntityNotFound(_0x537072,null))[_0x3e1e('0x21')](function(_0x490285){return db[_0x3e1e('0x5b')][_0x3e1e('0x90')]({'attributes':['id',_0x3e1e('0x5d'),_0x3e1e('0x91'),_0x3e1e('0x92')]})['then'](function(_0x2ebe03){if(_0x2ebe03[_0x3e1e('0x5d')])authService['validatePasswordPattern'](_0x44c4a4[_0x3e1e('0x56')]['newPassword']);if(!_0x2ebe03['enforcePasswordHistory']||!_0x490285[_0x3e1e('0x93')])return _0x490285;authService[_0x3e1e('0x94')](_0x44c4a4[_0x3e1e('0x56')][_0x3e1e('0x8d')],_0x490285[_0x3e1e('0x93')],_0x2ebe03[_0x3e1e('0x92')]);return _0x490285;})[_0x3e1e('0x21')](saveUpdates({'password':_0x44c4a4[_0x3e1e('0x56')][_0x3e1e('0x8d')],'passwordResetAt':_0x44c4a4[_0x3e1e('0x25')]['id']==_0x44c4a4[_0x3e1e('0x47')]['id']?moment():null,'previousPasswords':authService[_0x3e1e('0x95')](_0x44c4a4[_0x3e1e('0x56')]['newPassword'],_0x490285[_0x3e1e('0x93')])},null));})[_0x3e1e('0x21')](respondWithResult(_0x537072,null))[_0x3e1e('0x19')](handleError(_0x537072,null));};exports[_0x3e1e('0x96')]=function(_0x61318,_0x20fa70){var _0x472f0d=_0x61318['body'][_0x3e1e('0x97')];return db['User'][_0x3e1e('0x2c')]({'where':{'id':_0x61318[_0x3e1e('0x47')]['id']},'attributes':['id',_0x3e1e('0x2d'),_0x3e1e('0x23'),_0x3e1e('0x98'),'loginInPause',_0x3e1e('0x99'),_0x3e1e('0x9a')]})[_0x3e1e('0x21')](handleEntityNotFound(_0x20fa70,null))['then'](function(_0x37eb53){if(_0x37eb53){if(!utils[_0x3e1e('0x9b')](_0x472f0d)){throw new db['Sequelize'][(_0x3e1e('0x8a'))]('Unknown\x20channel');}return _0x37eb53[_0x3e1e('0x9c')+_[_0x3e1e('0x9d')](_0x472f0d[_0x3e1e('0x9e')]())+_0x3e1e('0x9f')](_0x61318['body'][_0x3e1e('0xa0')],{'penalty':_0x61318[_0x3e1e('0x56')][_0x3e1e('0xa1')]||0x0})[_0x3e1e('0xa2')](function(_0x1caf62){for(var _0x2faa81=0x0;_0x2faa81<_0x61318[_0x3e1e('0x56')][_0x3e1e('0xa0')][_0x3e1e('0x4f')];_0x2faa81+=0x1){var _0x187048={'UserId':Number(_0x61318[_0x3e1e('0x47')]['id'])};_0x187048[_[_0x3e1e('0x9d')](_0x472f0d['toLowerCase']())+_0x3e1e('0xa3')]=Number(_0x61318[_0x3e1e('0x56')][_0x3e1e('0xa0')][_0x2faa81]);socket[_0x3e1e('0xa4')]('user'+_[_0x3e1e('0x9d')](_0x472f0d[_0x3e1e('0x9e')]())+_0x3e1e('0xa5'),_0x187048);}return _0x1caf62;})[_0x3e1e('0x21')](function(){if(_0x472f0d==='voice'){return db[_0x3e1e('0xa6')][_0x3e1e('0x3d')]({'where':{'id':_0x61318['body'][_0x3e1e('0xa0')]||[]},'raw':!![],'attributes':['id',_0x3e1e('0x2d')]});}})['then'](function(_0x29499c){var _0x352671=_0x37eb53[_0x3e1e('0xa7')]({'plain':!![]});var _0x2f22d0=[];if(_0x472f0d===_0x3e1e('0xa8')&&_0x352671['role']===_0x3e1e('0x27')&&_0x352671[_0x3e1e('0x98')]){for(var _0x22d774=0x0;_0x22d774<_0x29499c['length'];_0x22d774+=0x1){_0x2f22d0[_0x3e1e('0x3c')]({'membername':_0x352671[_0x3e1e('0x2d')],'UserId':_0x352671['id'],'queue_name':_0x29499c[_0x22d774][_0x3e1e('0x2d')],'VoiceQueueId':_0x29499c[_0x22d774]['id'],'interface':_[_0x3e1e('0x5f')](_0x352671[_0x3e1e('0x9a')])?util[_0x3e1e('0xa9')](_0x3e1e('0xaa'),_0x352671[_0x3e1e('0x2d')]):_0x352671[_0x3e1e('0x9a')],'paused':_0x352671[_0x3e1e('0x99')]||![],'penalty':_0x61318[_0x3e1e('0x56')][_0x3e1e('0xa1')]||0x0});}return BPromise[_0x3e1e('0xab')](_0x2f22d0,function(_0x70ecd9){return db[_0x3e1e('0xac')][_0x3e1e('0xad')](_0x70ecd9);});}return _0x37eb53;});}})['then'](respondWithStatusCode(_0x20fa70,null))[_0x3e1e('0x19')](handleError(_0x20fa70,null));};exports[_0x3e1e('0xae')]=function(_0x2b2bec,_0x38cbc0){var _0xc69aaa;return db[_0x3e1e('0x39')]['find']({'where':{'id':_0x2b2bec[_0x3e1e('0x47')]['id']},'attributes':['id',_0x3e1e('0x2d'),_0x3e1e('0x23')]})[_0x3e1e('0x21')](handleEntityNotFound(_0x38cbc0,null))[_0x3e1e('0x21')](function(_0x5ee44d){if(_0x5ee44d){_0xc69aaa=_0x5ee44d;if(!_0x2b2bec[_0x3e1e('0x3f')]['channel']||!utils[_0x3e1e('0x9b')](_0x2b2bec['query'][_0x3e1e('0x97')])){throw new db[(_0x3e1e('0x89'))][(_0x3e1e('0x8a'))](_0x3e1e('0xaf'));}return _0x5ee44d[_0x3e1e('0xb0')+_['capitalize'](_0x2b2bec[_0x3e1e('0x3f')]['channel'][_0x3e1e('0x9e')]())+_0x3e1e('0x9f')](_0x2b2bec[_0x3e1e('0x3f')]['ids']);}})[_0x3e1e('0x21')](function(_0x406a7d){if(_['isArray'](_0x2b2bec['query'][_0x3e1e('0xa0')])){for(var _0x5c488d=0x0;_0x5c488d<_0x2b2bec['query'][_0x3e1e('0xa0')]['length'];_0x5c488d+=0x1){var _0x4c44a2={'UserId':Number(_0x2b2bec[_0x3e1e('0x47')]['id'])};_0x4c44a2[_['capitalize'](_0x2b2bec[_0x3e1e('0x3f')][_0x3e1e('0x97')][_0x3e1e('0x9e')]())+_0x3e1e('0xa3')]=Number(_0x2b2bec[_0x3e1e('0x3f')][_0x3e1e('0xa0')][_0x5c488d]);socket[_0x3e1e('0xa4')](_0x3e1e('0x25')+_[_0x3e1e('0x9d')](_0x2b2bec['query'][_0x3e1e('0x97')][_0x3e1e('0x9e')]())+_0x3e1e('0xb1'),_0x4c44a2);}}else{var _0x4c44a2={'UserId':Number(_0x2b2bec[_0x3e1e('0x47')]['id'])};_0x4c44a2[_['capitalize'](_0x2b2bec[_0x3e1e('0x3f')]['channel'][_0x3e1e('0x9e')]())+_0x3e1e('0xa3')]=Number(_0x2b2bec['query'][_0x3e1e('0xa0')]);socket['emit'](_0x3e1e('0x25')+_[_0x3e1e('0x9d')](_0x2b2bec[_0x3e1e('0x3f')]['channel'][_0x3e1e('0x9e')]())+_0x3e1e('0xb1'),_0x4c44a2);}return _0x406a7d;})[_0x3e1e('0x21')](function(){if(_0x2b2bec[_0x3e1e('0x3f')][_0x3e1e('0x97')]===_0x3e1e('0xa8')){return db[_0x3e1e('0xac')]['destroy']({'where':{'UserId':_0x2b2bec[_0x3e1e('0x47')]['id'],'VoiceQueueId':_0x2b2bec['query'][_0x3e1e('0xa0')]},'individualHooks':!![]})[_0x3e1e('0x21')](function(){return _0xc69aaa;});}return _0xc69aaa;})[_0x3e1e('0x21')](respondWithStatusCode(_0x38cbc0,null))[_0x3e1e('0x19')](handleError(_0x38cbc0,null));};exports[_0x3e1e('0xb2')]=function(_0xb6ad9c,_0x56b02f){_0xb6ad9c['body'][_0x3e1e('0xb3')]=_0xb6ad9c[_0x3e1e('0xb4')]['filename'];return db[_0x3e1e('0x39')][_0x3e1e('0x2c')]({'where':{'id':_0xb6ad9c['params']['id']}})['then'](handleEntityNotFound(_0x56b02f,null))[_0x3e1e('0x21')](saveUpdates(_0xb6ad9c[_0x3e1e('0x56')],null))[_0x3e1e('0x21')](respondWithResult(_0x56b02f,null))['catch'](handleError(_0x56b02f,null));};exports[_0x3e1e('0xb5')]=function(_0x2a9829,_0x79c6c5){var _0x26b025=path['join'](config['root'],_0x3e1e('0xb6'));return db[_0x3e1e('0x39')]['find']({'where':{'id':_0x2a9829[_0x3e1e('0x47')]['id']},'attributes':['id',_0x3e1e('0xb3')],'raw':!![]})[_0x3e1e('0x21')](handleEntityNotFound(_0x79c6c5,null))[_0x3e1e('0x21')](function(_0x3a1111){if(_0x3a1111){if(_[_0x3e1e('0x5f')](_0x3a1111[_0x3e1e('0xb3')])){return _0x79c6c5[_0x3e1e('0xb7')](_0x26b025);}else{if(!fs['existsSync'](path[_0x3e1e('0xb8')](config[_0x3e1e('0xb9')],'server/files/images/',_0x3a1111[_0x3e1e('0xb3')]))){return _0x79c6c5['download'](_0x26b025);}return _0x79c6c5['download'](path[_0x3e1e('0xb8')](config['root'],_0x3e1e('0xba'),_0x3a1111[_0x3e1e('0xb3')]));}}})[_0x3e1e('0x19')](handleError(_0x79c6c5,null));};exports[_0x3e1e('0xbb')]=function(_0x5a1d55,_0x1bc711){return db[_0x3e1e('0x39')][_0x3e1e('0x2c')]({'where':{'id':_0x5a1d55['params']['id']},'attributes':['id']})[_0x3e1e('0x21')](handleEntityNotFound(_0x1bc711,null))[_0x3e1e('0x21')](function(_0x1b32c1){var _0x2b7abb=[];values=_0x1b32c1[_0x3e1e('0x41')];_0x2b7abb[_0x3e1e('0x3c')](get_open_tabs(_0x3e1e('0x52'),_0x1b32c1[_0x3e1e('0x41')]));_0x2b7abb[_0x3e1e('0x3c')](get_open_tabs(_0x3e1e('0x42'),_0x1b32c1['dataValues']));_0x2b7abb[_0x3e1e('0x3c')](get_open_tabs(_0x3e1e('0x43'),_0x1b32c1[_0x3e1e('0x41')]));_0x2b7abb[_0x3e1e('0x3c')](get_open_tabs('whatsapp',_0x1b32c1[_0x3e1e('0x41')]));_0x2b7abb[_0x3e1e('0x3c')](get_open_tabs(_0x3e1e('0x53'),_0x1b32c1[_0x3e1e('0x41')]));_0x2b7abb['push'](get_open_tabs(_0x3e1e('0x54'),_0x1b32c1[_0x3e1e('0x41')]));return BPromise[_0x3e1e('0x45')](_0x2b7abb);})[_0x3e1e('0x21')](function(_0xb79c39){var _0x2fa2bd=[];if(_0xb79c39){for(var _0x26fdc3=0x0;_0x26fdc3=_0x3eb589[_0x4f28('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x2a835a){return db[_0x4f28('0x3c')]['destroy']({'where':{'membername':_0x2a835a[_0x4f28('0x2c')]},'individualHooks':!![]});}})['then'](function(){if(_0x2a835a){return _0x2a835a['getVoiceQueues']({'raw':!![]});}})[_0x4f28('0x10')](function(_0x301fac){if(_0x2a835a){if(_0x301fac){var _0x2fe8f2=[];_0x432202=_0x301fac;if(_0x432202[_0x4f28('0x2d')]){for(var _0x3abd73=0x0;_0x3abd73<_0x432202['length'];_0x3abd73++){_0x2fe8f2[_0x4f28('0x31')](db[_0x4f28('0x3c')][_0x4f28('0x4f')]({'membername':_0x2a835a[_0x4f28('0x2c')],'UserId':_0x2a835a['id'],'queue_name':_0x432202[_0x3abd73][_0x4f28('0x2c')],'VoiceQueueId':_0x432202[_0x3abd73]['id'],'interface':_0x3686a4,'paused':_0x2a835a[_0x4f28('0x4a')]||![],'penalty':_0x432202[_0x3abd73][_0x4f28('0x50')]||0x0}));}return BPromise[_0x4f28('0x45')](_0x2fe8f2);}}}})['then'](function(){if(_0x2a835a){return db['MemberReport'][_0x4f28('0x1d')]({'where':{'membername':_0x2a835a[_0x4f28('0x2c')],'exitAt':null}});}})[_0x4f28('0x10')](function(_0x46c2ba){if(_0x2a835a){if(_0x46c2ba&&_0x46c2ba[_0x4f28('0x2d')]){var _0x5bbfc9=[];_0x46c2ba['forEach'](function(_0x4592a9){_0x5bbfc9[_0x4f28('0x31')](_0x4592a9[_0x4f28('0x39')]({'exitAt':moment()['format'](_0x4f28('0x35'))}));});return BPromise['all'](_0x5bbfc9);}}})[_0x4f28('0x10')](function(_0x388df1){if(_0x2a835a){var _0xdf617b=[];var _0x17d034=[];var _0x4111f8=utils['getChannels']();var _0x3acb77={'membername':_0x2a835a['name'],'interface':_0x3686a4,'enterAt':moment()[_0x4f28('0x2e')](_0x4f28('0x35')),'role':_0x2a835a['role'],'internal':_0x2a835a[_0x4f28('0x29')]};_0x4111f8[_0x4f28('0x30')](function(_0x11627a){_0xdf617b['push'](_[_0x4f28('0x51')]({'channel':_0x11627a,'type':'LOGIN','data1':_0x4f28('0x52'),'data2':_0x3686a4},_0x3acb77));if(_0x2a835a[_0x4f28('0x4a')]){_0x17d034['push'](_[_0x4f28('0x51')]({'channel':_0x11627a,'type':_0x4f28('0x34'),'data1':_0x4f28('0x53')},_0x3acb77));}});return db[_0x4f28('0x2b')][_0x4f28('0x54')](_0xdf617b['concat'](_0x17d034),{'individualHooks':!![]});}})[_0x4f28('0x10')](function(){if(_0x2a835a){return _0x2a835a[_0x4f28('0x39')]({'online':!![],'lastLoginAt':moment()[_0x4f28('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2a835a[_0x4f28('0x4a')]||![],'mailPause':_0x2a835a['loginInPause']||![],'chatPause':_0x2a835a[_0x4f28('0x4a')]||![],'faxPause':_0x2a835a[_0x4f28('0x4a')]||![],'smsPause':_0x2a835a[_0x4f28('0x4a')]||![],'openchannelPause':_0x2a835a[_0x4f28('0x4a')]||![],'pauseType':_0x2a835a[_0x4f28('0x4a')]?_0x4f28('0x53'):null,'lastPauseAt':moment()[_0x4f28('0x2e')](_0x4f28('0x35')),'interface':_0x3686a4});}})[_0x4f28('0x10')](function(_0x5ad1b9){_0x126283(_0x5ad1b9);})['catch'](function(_0x57a384){_0x598e4c(_0x291c1d[_0x4f28('0x16')](0x1f4,_0x57a384[_0x4f28('0x18')]));});});}; \ No newline at end of file +var _0x2272=['UserVoiceQueue.penalty','merge','callysquare','concat','LOGININPAUSE','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','request','then','info','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','User,\x20%s,\x20%s','catch','GetUser','User','findAll','raw','options','where','include','model','map','attributes','ShowUser','find','debug','PauseUser','role','internal','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','getChannels','forEach','interface','format','SIP/%s','type','body','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','voice','mail','chat','fax','sms','openchannel','whatsapp','system','set','%s%s','Pause','UserVoiceQueueRt','name','push','destroy','all','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x2272,0x1cc));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require('bluebird');var rs=require(_0x2227('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x4'))['db'];var utils=require(_0x2227('0x5'));var logger=require(_0x2227('0x6'))(_0x2227('0x7'));var config=require(_0x2227('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});config[_0x2227('0xb')]=_[_0x2227('0xc')](config[_0x2227('0xb')],{'host':_0x2227('0xd'),'port':0x18eb});var socket=require(_0x2227('0xe'))(new Redis(config['redis']));require(_0x2227('0xf'))['register'](socket);function respondWithRpcPromise(_0x741360,_0x135b12,_0x567485){return new BPromise(function(_0x22c7ed,_0x3241c0){return client[_0x2227('0x10')](_0x741360,_0x567485)[_0x2227('0x11')](function(_0x4590d3){logger[_0x2227('0x12')]('User,\x20%s,\x20%s',_0x135b12,'request\x20sent');logger['debug'](_0x2227('0x13'),_0x135b12,_0x2227('0x14'),JSON[_0x2227('0x15')](_0x4590d3));if(_0x4590d3[_0x2227('0x16')]){if(_0x4590d3[_0x2227('0x16')][_0x2227('0x17')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x135b12,_0x4590d3[_0x2227('0x16')]['message']);return _0x3241c0(_0x4590d3[_0x2227('0x16')][_0x2227('0x18')]);}logger[_0x2227('0x16')](_0x2227('0x19'),_0x135b12,_0x4590d3['error'][_0x2227('0x18')]);return _0x22c7ed(_0x4590d3[_0x2227('0x16')]['message']);}else{logger[_0x2227('0x12')]('User,\x20%s,\x20%s',_0x135b12,_0x2227('0x14'));_0x22c7ed(_0x4590d3['result'][_0x2227('0x18')]);}})[_0x2227('0x1a')](function(_0x19453a){logger[_0x2227('0x16')](_0x2227('0x19'),_0x135b12,_0x19453a);_0x3241c0(_0x19453a);});});}exports[_0x2227('0x1b')]=function(_0x257477){var _0x20134c=this;return new Promise(function(_0x3832e6,_0xdb454d){return db[_0x2227('0x1c')][_0x2227('0x1d')]({'raw':_0x257477['options']?_0x257477['options'][_0x2227('0x1e')]===undefined?!![]:![]:!![],'where':_0x257477[_0x2227('0x1f')]?_0x257477[_0x2227('0x1f')][_0x2227('0x20')]||null:null,'attributes':_0x257477[_0x2227('0x1f')]?_0x257477[_0x2227('0x1f')]['attributes']||null:null,'limit':_0x257477[_0x2227('0x1f')]?_0x257477[_0x2227('0x1f')]['limit']||null:null,'include':_0x257477['options']?_0x257477[_0x2227('0x1f')]['include']?_['map'](_0x257477[_0x2227('0x1f')][_0x2227('0x21')],function(_0x106f7f){return{'model':db[_0x106f7f[_0x2227('0x22')]],'as':_0x106f7f['as'],'attributes':_0x106f7f['attributes'],'include':_0x106f7f[_0x2227('0x21')]?_[_0x2227('0x23')](_0x106f7f[_0x2227('0x21')],function(_0x50517a){return{'model':db[_0x50517a['model']],'as':_0x50517a['as'],'attributes':_0x50517a[_0x2227('0x24')],'include':_0x50517a[_0x2227('0x21')]?_[_0x2227('0x23')](_0x50517a[_0x2227('0x21')],function(_0x3a7497){return{'model':db[_0x3a7497[_0x2227('0x22')]],'as':_0x3a7497['as'],'attributes':_0x3a7497[_0x2227('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37fd85){logger[_0x2227('0x12')](_0x2227('0x1b'),_0x257477);logger['debug'](_0x2227('0x1b'),_0x257477,JSON[_0x2227('0x15')](_0x37fd85));_0x3832e6(_0x37fd85);})[_0x2227('0x1a')](function(_0x3f715b){logger['error'](_0x2227('0x1b'),_0x3f715b[_0x2227('0x18')],_0x257477);_0xdb454d(_0x20134c[_0x2227('0x16')](0x1f4,_0x3f715b[_0x2227('0x18')]));});});};exports[_0x2227('0x25')]=function(_0x57e64d){var _0x5b5f45=this;return new Promise(function(_0x1a005f,_0x4d4df8){return db[_0x2227('0x1c')][_0x2227('0x26')]({'raw':_0x57e64d[_0x2227('0x1f')]?_0x57e64d[_0x2227('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x57e64d[_0x2227('0x1f')]?_0x57e64d[_0x2227('0x1f')][_0x2227('0x20')]||null:null,'attributes':_0x57e64d['options']?_0x57e64d[_0x2227('0x1f')][_0x2227('0x24')]||null:null,'include':_0x57e64d['options']?_0x57e64d[_0x2227('0x1f')][_0x2227('0x21')]?_['map'](_0x57e64d[_0x2227('0x1f')]['include'],function(_0x4bcd10){return{'model':db[_0x4bcd10[_0x2227('0x22')]],'as':_0x4bcd10['as'],'attributes':_0x4bcd10[_0x2227('0x24')],'include':_0x4bcd10[_0x2227('0x21')]?_['map'](_0x4bcd10[_0x2227('0x21')],function(_0x5445b8){return{'model':db[_0x5445b8['model']],'as':_0x5445b8['as'],'attributes':_0x5445b8[_0x2227('0x24')],'include':_0x5445b8[_0x2227('0x21')]?_['map'](_0x5445b8[_0x2227('0x21')],function(_0x2c3306){return{'model':db[_0x2c3306[_0x2227('0x22')]],'as':_0x2c3306['as'],'attributes':_0x2c3306[_0x2227('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4598b2){logger['info']('ShowUser',_0x57e64d);logger[_0x2227('0x27')](_0x2227('0x25'),_0x57e64d,JSON['stringify'](_0x4598b2));_0x1a005f(_0x4598b2);})[_0x2227('0x1a')](function(_0xe627fc){logger['error'](_0x2227('0x25'),_0xe627fc[_0x2227('0x18')],_0x57e64d);_0x4d4df8(_0x5b5f45['error'](0x1f4,_0xe627fc[_0x2227('0x18')]));});});};exports[_0x2227('0x28')]=function(_0x199122){var _0x27fb30=this;return new Promise(function(_0x14d396,_0x3c9ea8){var _0x250af8;return db[_0x2227('0x1c')][_0x2227('0x26')]({'where':_0x199122[_0x2227('0x1f')][_0x2227('0x20')]||{},'attributes':['id','name',_0x2227('0x29'),_0x2227('0x2a'),'interface']})['then'](function(_0x588493){if(_0x588493){_0x250af8=_0x588493;return db['UserVoiceQueueRt'][_0x2227('0x2b')]({'paused':0x1},{'where':{'UserId':_0x250af8['id']},'individualHooks':!![]});}})['then'](function(){if(_0x250af8){return db[_0x2227('0x2c')][_0x2227('0x1d')]({'where':{'membername':_0x250af8['name'],'type':_0x2227('0x2d'),'exitAt':null}});}})[_0x2227('0x11')](function(_0x5e1b6c){if(_0x250af8){if(_0x5e1b6c&&_0x5e1b6c['length']){var _0x4d43d6=moment()['format'](_0x2227('0x2e'));for(var _0x2f37c6=0x0,_0x1b870c=_0x5e1b6c[_0x2227('0x2f')];_0x2f37c6<_0x1b870c;_0x2f37c6++){_0x5e1b6c[_0x2f37c6]['updateAttributes']({'exitAt':_0x4d43d6});}}}})[_0x2227('0x11')](function(){if(_0x250af8){var _0x593c1b=[];var _0x4b2b4b=utils[_0x2227('0x30')]();_0x4b2b4b[_0x2227('0x31')](function(_0x14081d){_0x593c1b['push']({'channel':_0x14081d,'membername':_0x250af8['name'],'interface':_['isNil'](_0x250af8[_0x2227('0x32')])?util[_0x2227('0x33')](_0x2227('0x34'),_0x250af8['name']):_0x250af8['interface'],'type':'PAUSE','enterAt':moment()[_0x2227('0x33')](_0x2227('0x2e')),'data1':_0x199122['body'][_0x2227('0x35')]||'DEFAULT\x20PAUSE','role':_0x250af8[_0x2227('0x29')],'internal':_0x250af8['internal'],'uniqueid':_0x199122[_0x2227('0x36')][_0x2227('0x37')]||null});});return db[_0x2227('0x2c')][_0x2227('0x38')](_0x593c1b,{'individualHooks':!![]});}})[_0x2227('0x11')](function(){if(_0x250af8){return _0x250af8[_0x2227('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x199122[_0x2227('0x36')]['type']||_0x2227('0x39'),'lastPauseAt':moment()[_0x2227('0x33')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x2227('0x11')](function(_0x3b316f){_0x14d396(_0x3b316f);})[_0x2227('0x1a')](function(_0x3db109){_0x3c9ea8(_0x27fb30['error'](0x1f4,_0x3db109[_0x2227('0x18')]));});});};exports[_0x2227('0x3a')]=function(_0x4750a0){var _0x293952=this;return new Promise(function(_0xb519a3,_0x1bf5b0){var _0x4a1209;return db[_0x2227('0x1c')][_0x2227('0x3b')]({'where':_0x4750a0['options'][_0x2227('0x20')]||{},'attributes':['id','name']})[_0x2227('0x11')](function(_0x57b927){if(_0x57b927){_0x4a1209=_0x57b927;if(_0x4750a0['body'][_0x2227('0x3c')]&&!utils[_0x2227('0x3d')](_0x4750a0['body'][_0x2227('0x3c')])){throw new Error('Unknown\x20channel');}switch(_0x4750a0[_0x2227('0x36')][_0x2227('0x3c')]){case _0x2227('0x3e'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x4a1209['id']}})[_0x2227('0x11')](function(){return db['MemberReport'][_0x2227('0x26')]({'where':{'channel':_0x4750a0[_0x2227('0x36')]['channel'],'membername':_0x4a1209['name'],'type':_0x2227('0x2d'),'exitAt':null}});})[_0x2227('0x11')](function(_0x2911ea){if(_0x2911ea){return _0x2911ea[_0x2227('0x2b')]({'exitAt':moment()['format'](_0x2227('0x2e')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x2227('0x11')](function(){return _0x4a1209[_0x2227('0x2b')]({'voicePause':![]});});case _0x2227('0x3f'):case _0x2227('0x40'):case _0x2227('0x41'):case _0x2227('0x42'):case _0x2227('0x43'):case _0x2227('0x44'):return db[_0x2227('0x2c')]['find']({'where':{'channel':_0x4750a0[_0x2227('0x36')][_0x2227('0x3c')],'membername':_0x4a1209['name'],'type':'PAUSE','exitAt':null}})[_0x2227('0x11')](function(_0x16cfe2){return _0x16cfe2['update']({'exitAt':moment()[_0x2227('0x33')](_0x2227('0x2e')),'data2':_0x2227('0x45')},{'individualHooks':!![]});})[_0x2227('0x11')](function(){var _0x103a3e={};_[_0x2227('0x46')](_0x103a3e,util[_0x2227('0x33')](_0x2227('0x47'),_0x4750a0[_0x2227('0x36')][_0x2227('0x3c')],_0x2227('0x48')),![]);return _0x4a1209[_0x2227('0x2b')](_0x103a3e);});default:return db[_0x2227('0x49')][_0x2227('0x2b')]({'paused':0x0},{'where':{'UserId':_0x4a1209['id']}})[_0x2227('0x11')](function(){return db[_0x2227('0x2c')][_0x2227('0x1d')]({'where':{'membername':_0x4a1209[_0x2227('0x4a')],'type':_0x2227('0x2d'),'exitAt':null}});})['then'](function(_0x4db0d8){var _0x1ff34b=[];_0x4db0d8['forEach'](function(_0x1f45c1){_0x1ff34b[_0x2227('0x4b')](_0x1f45c1[_0x2227('0x2b')]({'exitAt':moment()[_0x2227('0x33')](_0x2227('0x2e')),'data2':_0x2227('0x45')}));});return BPromise['all'](_0x1ff34b);})[_0x2227('0x11')](function(){return _0x4a1209[_0x2227('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x2227('0x11')](function(_0x503c5d){_0xb519a3(_0x503c5d);})[_0x2227('0x1a')](function(_0x32663f){_0x1bf5b0(_0x293952[_0x2227('0x16')](0x1f4,_0x32663f['message']));});});};exports['LogoutUser']=function(_0x39dad5){var _0x5510b6=this;return new Promise(function(_0x1f76c9,_0x3b854c){var _0x14dce8;return db[_0x2227('0x1c')][_0x2227('0x3b')]({'where':_0x39dad5['options'][_0x2227('0x20')]||{},'attributes':['id',_0x2227('0x4a')]})[_0x2227('0x11')](function(_0x3b4be9){if(_0x3b4be9){_0x14dce8=_0x3b4be9;return db[_0x2227('0x49')][_0x2227('0x4c')]({'where':{'membername':_0x14dce8[_0x2227('0x4a')]},'individualHooks':!![]});}})[_0x2227('0x11')](function(){if(_0x14dce8){return db[_0x2227('0x2c')][_0x2227('0x1d')]({'where':{'membername':_0x14dce8[_0x2227('0x4a')],'exitAt':null}});}})[_0x2227('0x11')](function(_0x9a8ab4){if(_0x14dce8){if(_0x9a8ab4&&_0x9a8ab4[_0x2227('0x2f')]){var _0x30402e=[];_0x9a8ab4[_0x2227('0x31')](function(_0x52e717){_0x30402e[_0x2227('0x4b')](_0x52e717[_0x2227('0x2b')]({'exitAt':moment()['format'](_0x2227('0x2e'))}));});return BPromise[_0x2227('0x4d')](_0x30402e);}}})[_0x2227('0x11')](function(){if(_0x14dce8){return _0x14dce8[_0x2227('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x2227('0x11')](function(_0x527d45){_0x1f76c9(_0x527d45);})[_0x2227('0x1a')](function(_0x1d6e31){_0x3b854c(_0x5510b6[_0x2227('0x16')](0x1f4,_0x1d6e31['message']));});});};exports['LoginUser']=function(_0x436b46){var _0x45dc6f=this;return new Promise(function(_0xb2a950,_0x4b277f){var _0x451d56;var _0x46a518;var _0xfaa951;var _0xbb2a16;return db[_0x2227('0x1c')][_0x2227('0x3b')]({'where':_0x436b46[_0x2227('0x1f')][_0x2227('0x20')]||{},'attributes':['id',_0x2227('0x4a'),_0x2227('0x29'),'mobile','phone','internal',_0x2227('0x4e'),'interface']})[_0x2227('0x11')](function(_0x4270c9){if(_0x4270c9){_0x451d56=_0x4270c9;_0xbb2a16=_0x436b46['body'][_0x2227('0x32')]?_0x436b46['body'][_0x2227('0x32')]:util[_0x2227('0x33')](_0x2227('0x34'),_0x451d56[_0x2227('0x4a')]);return db[_0x2227('0x1c')][_0x2227('0x4f')]({'where':{'role':_0x2227('0x50'),'online':!![],'id':{'$ne':_0x451d56['id']}}});}})['then'](function(_0x1ece31){if(_0x1ece31){_0xfaa951=_0x1ece31;return require(_0x2227('0x51'))[_0x2227('0x52')]();}})['then'](function(_0x3829c7){if(_0x3829c7&&_0x3829c7[_0x2227('0x53')]&&_0xfaa951>=_0x3829c7[_0x2227('0x53')]){throw new Error(_0x2227('0x54'));}})['then'](function(){if(_0x451d56){return db[_0x2227('0x49')][_0x2227('0x4c')]({'where':{'membername':_0x451d56[_0x2227('0x4a')]},'individualHooks':!![]});}})[_0x2227('0x11')](function(){if(_0x451d56){return _0x451d56[_0x2227('0x55')]({'raw':!![]});}})['then'](function(_0x38ab0b){if(_0x451d56){if(_0x38ab0b){var _0x55bdd4=[];_0x46a518=_0x38ab0b;if(_0x46a518[_0x2227('0x2f')]){for(var _0x47779e=0x0;_0x47779e<_0x46a518[_0x2227('0x2f')];_0x47779e++){_0x55bdd4[_0x2227('0x4b')](db['UserVoiceQueueRt']['upsert']({'membername':_0x451d56[_0x2227('0x4a')],'UserId':_0x451d56['id'],'queue_name':_0x46a518[_0x47779e][_0x2227('0x4a')],'VoiceQueueId':_0x46a518[_0x47779e]['id'],'interface':_0xbb2a16,'paused':_0x451d56[_0x2227('0x4e')]||![],'penalty':_0x46a518[_0x47779e][_0x2227('0x56')]||0x0}));}return BPromise[_0x2227('0x4d')](_0x55bdd4);}}}})[_0x2227('0x11')](function(){if(_0x451d56){return db[_0x2227('0x2c')][_0x2227('0x1d')]({'where':{'membername':_0x451d56['name'],'exitAt':null}});}})[_0x2227('0x11')](function(_0x12e50b){if(_0x451d56){if(_0x12e50b&&_0x12e50b[_0x2227('0x2f')]){var _0x145880=[];_0x12e50b[_0x2227('0x31')](function(_0x16b4b2){_0x145880['push'](_0x16b4b2[_0x2227('0x2b')]({'exitAt':moment()['format'](_0x2227('0x2e'))}));});return BPromise[_0x2227('0x4d')](_0x145880);}}})[_0x2227('0x11')](function(_0x58a3d7){if(_0x451d56){var _0x2991e0=[];var _0x425c7a=[];var _0x1c8b04=utils[_0x2227('0x30')]();var _0x4cbb17={'membername':_0x451d56['name'],'interface':_0xbb2a16,'enterAt':moment()['format'](_0x2227('0x2e')),'role':_0x451d56[_0x2227('0x29')],'internal':_0x451d56[_0x2227('0x2a')]};_0x1c8b04['forEach'](function(_0x1c0a7f){_0x2991e0[_0x2227('0x4b')](_[_0x2227('0x57')]({'channel':_0x1c0a7f,'type':'LOGIN','data1':_0x2227('0x58'),'data2':_0xbb2a16},_0x4cbb17));if(_0x451d56['loginInPause']){_0x425c7a['push'](_[_0x2227('0x57')]({'channel':_0x1c0a7f,'type':_0x2227('0x2d'),'data1':'LOGININPAUSE'},_0x4cbb17));}});return db[_0x2227('0x2c')][_0x2227('0x38')](_0x2991e0[_0x2227('0x59')](_0x425c7a),{'individualHooks':!![]});}})[_0x2227('0x11')](function(){if(_0x451d56){return _0x451d56['update']({'online':!![],'lastLoginAt':moment()[_0x2227('0x33')](_0x2227('0x2e')),'voicePause':_0x451d56['loginInPause']||![],'mailPause':_0x451d56['loginInPause']||![],'chatPause':_0x451d56['loginInPause']||![],'faxPause':_0x451d56[_0x2227('0x4e')]||![],'smsPause':_0x451d56[_0x2227('0x4e')]||![],'openchannelPause':_0x451d56[_0x2227('0x4e')]||![],'pauseType':_0x451d56['loginInPause']?_0x2227('0x5a'):null,'lastPauseAt':moment()[_0x2227('0x33')](_0x2227('0x2e')),'interface':_0xbb2a16});}})[_0x2227('0x11')](function(_0x22a620){_0xb2a950(_0x22a620);})[_0x2227('0x1a')](function(_0x32e5cd){_0x4b277f(_0x45dc6f[_0x2227('0x16')](0x1f4,_0x32e5cd['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f83aea4..be244e7 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 _0x0214=['removeListener','length','user:','./user.events','save','update','emit'];(function(_0x663d90,_0xab54e3){var _0x105308=function(_0x1d9020){while(--_0x1d9020){_0x663d90['push'](_0x663d90['shift']());}};_0x105308(++_0xab54e3);}(_0x0214,0x1ed));var _0x4021=function(_0x236912,_0x4167cd){_0x236912=_0x236912-0x0;var _0x582904=_0x0214[_0x236912];return _0x582904;};'use strict';var UserEvents=require(_0x4021('0x0'));var events=[_0x4021('0x1'),'remove',_0x4021('0x2')];function createListener(_0x5776d2,_0x16fc56){return function(_0x1d8542){_0x16fc56[_0x4021('0x3')](_0x5776d2,_0x1d8542);};}function removeListener(_0x309aaf,_0x5e4b2e){return function(){UserEvents[_0x4021('0x4')](_0x309aaf,_0x5e4b2e);};}exports['register']=function(_0x10b388){for(var _0x5cb94f=0x0,_0x1406c6=events[_0x4021('0x5')];_0x5cb94f<_0x1406c6;_0x5cb94f++){var _0x4da88b=events[_0x5cb94f];var _0x2f4fc8=createListener(_0x4021('0x6')+_0x4da88b,_0x10b388);UserEvents['on'](_0x4da88b,_0x2f4fc8);}}; \ No newline at end of file +var _0x78e5=['update','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x184e69,_0x39af04){var _0x57d8ad=function(_0x153dd9){while(--_0x153dd9){_0x184e69['push'](_0x184e69['shift']());}};_0x57d8ad(++_0x39af04);}(_0x78e5,0x125));var _0x578e=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x78e5[_0x1caf6a];return _0x1bf493;};'use strict';var UserEvents=require(_0x578e('0x0'));var events=[_0x578e('0x1'),_0x578e('0x2'),_0x578e('0x3')];function createListener(_0x16439e,_0xcfe8d5){return function(_0x39cdc9){_0xcfe8d5['emit'](_0x16439e,_0x39cdc9);};}function removeListener(_0x11f88a,_0x3f8deb){return function(){UserEvents[_0x578e('0x4')](_0x11f88a,_0x3f8deb);};}exports[_0x578e('0x5')]=function(_0x3b4a0d){for(var _0x58aa48=0x0,_0x57ae12=events[_0x578e('0x6')];_0x58aa48<_0x57ae12;_0x58aa48++){var _0x5f44e6=events[_0x58aa48];var _0x131c57=createListener(_0x578e('0x7')+_0x5f44e6,_0x3b4a0d);UserEvents['on'](_0x5f44e6,_0x131c57);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 59d6d55..1f2ae19 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x347aab,_0x70f5f8){var _0x45d493=function(_0x528dd6){while(--_0x528dd6){_0x347aab['push'](_0x347aab['shift']());}};_0x45d493(++_0x70f5f8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0xcb91[_0x35d775];return _0x59384d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xb85fd5,_0x3362ae){var _0x34228e=function(_0x1e62fa){while(--_0x1e62fa){_0xb85fd5['push'](_0xb85fd5['shift']());}};_0x34228e(++_0x3362ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 00e432a..20346b6 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 _0x4dd1=['sequelize','INTEGER'];(function(_0x4bce2d,_0x29dbb1){var _0x44f2ba=function(_0x2b99d2){while(--_0x2b99d2){_0x4bce2d['push'](_0x4bce2d['shift']());}};_0x44f2ba(++_0x29dbb1);}(_0x4dd1,0xb0));var _0x14dd=function(_0x305cca,_0x2dc9bb){_0x305cca=_0x305cca-0x0;var _0x2db8c5=_0x4dd1[_0x305cca];return _0x2db8c5;};'use strict';var Sequelize=require(_0x14dd('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x14dd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe806=['sequelize','exports','INTEGER'];(function(_0x537254,_0x2fdfec){var _0x5efd4c=function(_0x33b916){while(--_0x33b916){_0x537254['push'](_0x537254['shift']());}};_0x5efd4c(++_0x2fdfec);}(_0xe806,0x15c));var _0x6e80=function(_0xd07a71,_0x5a1eef){_0xd07a71=_0xd07a71-0x0;var _0x29721d=_0xe806[_0xd07a71];return _0x29721d;};'use strict';var Sequelize=require(_0x6e80('0x0'));module[_0x6e80('0x1')]={'penalty':{'type':Sequelize[_0x6e80('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index b4a6475..1e52d55 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 _0x773a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util'];(function(_0x1cd94e,_0x34f15e){var _0x1f2dad=function(_0x76e73d){while(--_0x76e73d){_0x1cd94e['push'](_0x1cd94e['shift']());}};_0x1f2dad(++_0x34f15e);}(_0x773a,0xfd));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa773('0x0'));var util=require(_0xa773('0x1'));var logger=require(_0xa773('0x2'))(_0xa773('0x3'));var moment=require(_0xa773('0x4'));var BPromise=require(_0xa773('0x5'));var rp=require(_0xa773('0x6'));var fs=require('fs');var path=require(_0xa773('0x7'));var rimraf=require(_0xa773('0x8'));var config=require(_0xa773('0x9'));var attributes=require(_0xa773('0xa'));module[_0xa773('0xb')]=function(_0x559c05,_0x121a9d){return _0x559c05[_0xa773('0xc')](_0xa773('0xd'),attributes,{'tableName':_0xa773('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19a8=['define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x21ce07,_0x25c2b0){var _0x264b4d=function(_0x4b304f){while(--_0x4b304f){_0x21ce07['push'](_0x21ce07['shift']());}};_0x264b4d(++_0x25c2b0);}(_0x19a8,0xdb));var _0x819a=function(_0x5381c6,_0x1af4b6){_0x5381c6=_0x5381c6-0x0;var _0x269ed1=_0x19a8[_0x5381c6];return _0x269ed1;};'use strict';var _=require(_0x819a('0x0'));var util=require(_0x819a('0x1'));var logger=require(_0x819a('0x2'))('api');var moment=require(_0x819a('0x3'));var BPromise=require('bluebird');var rp=require(_0x819a('0x4'));var fs=require('fs');var path=require(_0x819a('0x5'));var rimraf=require('rimraf');var config=require(_0x819a('0x6'));var attributes=require(_0x819a('0x7'));module[_0x819a('0x8')]=function(_0x35b6e9,_0x30dc93){return _0x35b6e9[_0x819a('0x9')](_0x819a('0xa'),attributes,{'tableName':_0x819a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 5766598..72a1fa1 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 _0x5281=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x14ed4e,_0x3dcf54){var _0x5c3d8a=function(_0x284a91){while(--_0x284a91){_0x14ed4e['push'](_0x14ed4e['shift']());}};_0x5c3d8a(++_0x3dcf54);}(_0x5281,0x149));var _0x1528=function(_0x5513a2,_0x468444){_0x5513a2=_0x5513a2-0x0;var _0x2374a5=_0x5281[_0x5513a2];return _0x2374a5;};'use strict';var _=require('lodash');var util=require(_0x1528('0x0'));var moment=require(_0x1528('0x1'));var BPromise=require(_0x1528('0x2'));var rs=require(_0x1528('0x3'));var fs=require('fs');var Redis=require(_0x1528('0x4'));var db=require(_0x1528('0x5'))['db'];var utils=require(_0x1528('0x6'));var logger=require(_0x1528('0x7'))(_0x1528('0x8'));var config=require(_0x1528('0x9'));var jayson=require(_0x1528('0xa'));var client=jayson['client'][_0x1528('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x429bb9,_0x21dd13,_0x31bf4b){return new BPromise(function(_0x1b2260,_0x1576f4){return client[_0x1528('0xc')](_0x429bb9,_0x31bf4b)['then'](function(_0x179b8f){logger[_0x1528('0xd')](_0x1528('0xe'),_0x21dd13,_0x1528('0xf'));logger[_0x1528('0x10')](_0x1528('0x11'),_0x21dd13,_0x1528('0xf'),JSON['stringify'](_0x179b8f));if(_0x179b8f[_0x1528('0x12')]){if(_0x179b8f[_0x1528('0x12')][_0x1528('0x13')]===0x1f4){logger['error'](_0x1528('0xe'),_0x21dd13,_0x179b8f[_0x1528('0x12')][_0x1528('0x14')]);return _0x1576f4(_0x179b8f[_0x1528('0x12')][_0x1528('0x14')]);}logger[_0x1528('0x12')](_0x1528('0xe'),_0x21dd13,_0x179b8f[_0x1528('0x12')]['message']);return _0x1b2260(_0x179b8f['error'][_0x1528('0x14')]);}else{logger['info'](_0x1528('0xe'),_0x21dd13,_0x1528('0xf'));_0x1b2260(_0x179b8f[_0x1528('0x15')]['message']);}})[_0x1528('0x16')](function(_0x13e500){logger[_0x1528('0x12')](_0x1528('0xe'),_0x21dd13,_0x13e500);_0x1576f4(_0x13e500);});});} \ No newline at end of file +var _0xe5f8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x1c59ed,_0x34ddbc){var _0x369f70=function(_0x9e9400){while(--_0x9e9400){_0x1c59ed['push'](_0x1c59ed['shift']());}};_0x369f70(++_0x34ddbc);}(_0xe5f8,0xc6));var _0x8e5f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe5f8[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x8e5f('0x0'));var moment=require(_0x8e5f('0x1'));var BPromise=require(_0x8e5f('0x2'));var rs=require(_0x8e5f('0x3'));var fs=require('fs');var Redis=require(_0x8e5f('0x4'));var db=require(_0x8e5f('0x5'))['db'];var utils=require(_0x8e5f('0x6'));var logger=require(_0x8e5f('0x7'))('rpc');var config=require(_0x8e5f('0x8'));var jayson=require(_0x8e5f('0x9'));var client=jayson[_0x8e5f('0xa')][_0x8e5f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c3c94,_0x4c38c1,_0x7be43e){return new BPromise(function(_0x160880,_0x380727){return client[_0x8e5f('0xc')](_0x1c3c94,_0x7be43e)[_0x8e5f('0xd')](function(_0x408308){logger[_0x8e5f('0xe')](_0x8e5f('0xf'),_0x4c38c1,_0x8e5f('0x10'));logger[_0x8e5f('0x11')](_0x8e5f('0x12'),_0x4c38c1,'request\x20sent',JSON[_0x8e5f('0x13')](_0x408308));if(_0x408308[_0x8e5f('0x14')]){if(_0x408308['error'][_0x8e5f('0x15')]===0x1f4){logger[_0x8e5f('0x14')](_0x8e5f('0xf'),_0x4c38c1,_0x408308[_0x8e5f('0x14')][_0x8e5f('0x16')]);return _0x380727(_0x408308[_0x8e5f('0x14')]['message']);}logger[_0x8e5f('0x14')](_0x8e5f('0xf'),_0x4c38c1,_0x408308[_0x8e5f('0x14')][_0x8e5f('0x16')]);return _0x160880(_0x408308[_0x8e5f('0x14')][_0x8e5f('0x16')]);}else{logger[_0x8e5f('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x4c38c1,'request\x20sent');_0x160880(_0x408308[_0x8e5f('0x17')][_0x8e5f('0x16')]);}})[_0x8e5f('0x18')](function(_0x450e71){logger[_0x8e5f('0x14')](_0x8e5f('0xf'),_0x4c38c1,_0x450e71);_0x380727(_0x450e71);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 4030d6c..39007ed 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x314ccb,_0x38886e){var _0x257b48=function(_0x381cf7){while(--_0x381cf7){_0x314ccb['push'](_0x314ccb['shift']());}};_0x257b48(++_0x38886e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2139b0,_0x353207){var _0x2e94c1=function(_0xe7d748){while(--_0xe7d748){_0x2139b0['push'](_0x2139b0['shift']());}};_0x2e94c1(++_0x353207);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ab89834..24ecc13 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 _0x601a=['INTEGER','STRING','sequelize','exports'];(function(_0x4d10e3,_0x5255df){var _0x81793f=function(_0x3b57f3){while(--_0x3b57f3){_0x4d10e3['push'](_0x4d10e3['shift']());}};_0x81793f(++_0x5255df);}(_0x601a,0x10a));var _0xa601=function(_0x456860,_0xae925c){_0x456860=_0x456860-0x0;var _0x23667c=_0x601a[_0x456860];return _0x23667c;};'use strict';var Sequelize=require(_0xa601('0x0'));module[_0xa601('0x1')]={'penalty':{'type':Sequelize[_0xa601('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa601('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xa601('0x3')]}}; \ No newline at end of file +var _0x8b75=['INTEGER','STRING','sequelize','exports'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8b75,0x66));var _0x58b7=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x8b75[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x58b7('0x0'));module[_0x58b7('0x1')]={'penalty':{'type':Sequelize[_0x58b7('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x58b7('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x58b7('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a696231..0fad066 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 _0x75f2=['UserFaxQueue','user_has_fax_queues','../../config/logger','api','moment','request-promise','rimraf','./userFaxQueue.attributes','define'];(function(_0x4dfb4a,_0x51d3e4){var _0x22b4e7=function(_0x18e08d){while(--_0x18e08d){_0x4dfb4a['push'](_0x4dfb4a['shift']());}};_0x22b4e7(++_0x51d3e4);}(_0x75f2,0x122));var _0x275f=function(_0x3cc24b,_0x5a928c){_0x3cc24b=_0x3cc24b-0x0;var _0x3370cc=_0x75f2[_0x3cc24b];return _0x3370cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x275f('0x0'))(_0x275f('0x1'));var moment=require(_0x275f('0x2'));var BPromise=require('bluebird');var rp=require(_0x275f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x275f('0x4'));var config=require('../../config/environment');var attributes=require(_0x275f('0x5'));module['exports']=function(_0x17c146,_0x3393e1){return _0x17c146[_0x275f('0x6')](_0x275f('0x7'),attributes,{'tableName':_0x275f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e81=['./userFaxQueue.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1947db,_0x2efa73){var _0x5b548e=function(_0x393105){while(--_0x393105){_0x1947db['push'](_0x1947db['shift']());}};_0x5b548e(++_0x2efa73);}(_0x7e81,0x12e));var _0x17e8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7e81[_0x432682];return _0x463d05;};'use strict';var _=require(_0x17e8('0x0'));var util=require(_0x17e8('0x1'));var logger=require(_0x17e8('0x2'))(_0x17e8('0x3'));var moment=require(_0x17e8('0x4'));var BPromise=require(_0x17e8('0x5'));var rp=require(_0x17e8('0x6'));var fs=require('fs');var path=require(_0x17e8('0x7'));var rimraf=require(_0x17e8('0x8'));var config=require(_0x17e8('0x9'));var attributes=require(_0x17e8('0xa'));module[_0x17e8('0xb')]=function(_0x41c578,_0x4e89ed){return _0x41c578[_0x17e8('0xc')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index fefc7e2..0afa3fc 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 _0x9dfe=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x1f07db,_0x5e977c){var _0x3209d1=function(_0x1ca455){while(--_0x1ca455){_0x1f07db['push'](_0x1f07db['shift']());}};_0x3209d1(++_0x5e977c);}(_0x9dfe,0x199));var _0xe9df=function(_0x91b572,_0x55bc7f){_0x91b572=_0x91b572-0x0;var _0x3696b7=_0x9dfe[_0x91b572];return _0x3696b7;};'use strict';var _=require(_0xe9df('0x0'));var util=require(_0xe9df('0x1'));var moment=require('moment');var BPromise=require(_0xe9df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9df('0x3'))['db'];var utils=require(_0xe9df('0x4'));var logger=require(_0xe9df('0x5'))(_0xe9df('0x6'));var config=require(_0xe9df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe9df('0x8')][_0xe9df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x170ba5,_0x242e30,_0x10014c){return new BPromise(function(_0x25b9fb,_0x273d15){return client[_0xe9df('0xa')](_0x170ba5,_0x10014c)[_0xe9df('0xb')](function(_0x265503){logger[_0xe9df('0xc')](_0xe9df('0xd'),_0x242e30,_0xe9df('0xe'));logger[_0xe9df('0xf')](_0xe9df('0x10'),_0x242e30,_0xe9df('0xe'),JSON[_0xe9df('0x11')](_0x265503));if(_0x265503[_0xe9df('0x12')]){if(_0x265503[_0xe9df('0x12')][_0xe9df('0x13')]===0x1f4){logger['error'](_0xe9df('0xd'),_0x242e30,_0x265503[_0xe9df('0x12')][_0xe9df('0x14')]);return _0x273d15(_0x265503[_0xe9df('0x12')][_0xe9df('0x14')]);}logger[_0xe9df('0x12')](_0xe9df('0xd'),_0x242e30,_0x265503['error'][_0xe9df('0x14')]);return _0x25b9fb(_0x265503[_0xe9df('0x12')][_0xe9df('0x14')]);}else{logger['info'](_0xe9df('0xd'),_0x242e30,_0xe9df('0xe'));_0x25b9fb(_0x265503[_0xe9df('0x15')][_0xe9df('0x14')]);}})[_0xe9df('0x16')](function(_0x317b5c){logger['error'](_0xe9df('0xd'),_0x242e30,_0x317b5c);_0x273d15(_0x317b5c);});});} \ No newline at end of file +var _0x26c0=['then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3eeba5,_0x11a4ac){var _0x182f01=function(_0x37a6dd){while(--_0x37a6dd){_0x3eeba5['push'](_0x3eeba5['shift']());}};_0x182f01(++_0x11a4ac);}(_0x26c0,0x1c1));var _0x026c=function(_0x185cc4,_0xf5b69b){_0x185cc4=_0x185cc4-0x0;var _0x1f34ee=_0x26c0[_0x185cc4];return _0x1f34ee;};'use strict';var _=require(_0x026c('0x0'));var util=require(_0x026c('0x1'));var moment=require('moment');var BPromise=require(_0x026c('0x2'));var rs=require(_0x026c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x026c('0x4'));var logger=require(_0x026c('0x5'))(_0x026c('0x6'));var config=require('../../config/environment');var jayson=require(_0x026c('0x7'));var client=jayson[_0x026c('0x8')][_0x026c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a665f,_0xf8c7a0,_0x45acdb){return new BPromise(function(_0xbabb80,_0x574e76){return client[_0x026c('0xa')](_0x3a665f,_0x45acdb)[_0x026c('0xb')](function(_0x8f4c13){logger['info'](_0x026c('0xc'),_0xf8c7a0,_0x026c('0xd'));logger[_0x026c('0xe')](_0x026c('0xf'),_0xf8c7a0,_0x026c('0xd'),JSON[_0x026c('0x10')](_0x8f4c13));if(_0x8f4c13['error']){if(_0x8f4c13[_0x026c('0x11')][_0x026c('0x12')]===0x1f4){logger[_0x026c('0x11')](_0x026c('0xc'),_0xf8c7a0,_0x8f4c13['error'][_0x026c('0x13')]);return _0x574e76(_0x8f4c13[_0x026c('0x11')]['message']);}logger[_0x026c('0x11')](_0x026c('0xc'),_0xf8c7a0,_0x8f4c13[_0x026c('0x11')][_0x026c('0x13')]);return _0xbabb80(_0x8f4c13[_0x026c('0x11')][_0x026c('0x13')]);}else{logger[_0x026c('0x14')](_0x026c('0xc'),_0xf8c7a0,_0x026c('0xd'));_0xbabb80(_0x8f4c13[_0x026c('0x15')][_0x026c('0x13')]);}})[_0x026c('0x16')](function(_0x1d9eef){logger[_0x026c('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0xf8c7a0,_0x1d9eef);_0x574e76(_0x1d9eef);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 5f3cc3f..025f77d 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4f9792,_0xdc683c){var _0x162f74=function(_0x21f5ac){while(--_0x21f5ac){_0x4f9792['push'](_0x4f9792['shift']());}};_0x162f74(++_0xdc683c);}(_0xe706,0xa3));var _0x6e70=function(_0x1e5b8b,_0x4937be){_0x1e5b8b=_0x1e5b8b-0x0;var _0x59393f=_0xe706[_0x1e5b8b];return _0x59393f;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x446186,_0x116e31){var _0x63b564=function(_0x590a14){while(--_0x590a14){_0x446186['push'](_0x446186['shift']());}};_0x63b564(++_0x116e31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0fe7c51..e1a63c1 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 _0x06bf=['sequelize','exports','INTEGER'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0x06bf,0x105));var _0xf06b=function(_0xdc70ef,_0x463508){_0xdc70ef=_0xdc70ef-0x0;var _0xebf625=_0x06bf[_0xdc70ef];return _0xebf625;};'use strict';var Sequelize=require(_0xf06b('0x0'));module[_0xf06b('0x1')]={'penalty':{'type':Sequelize[_0xf06b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x83ad=['exports','INTEGER','sequelize'];(function(_0x245b15,_0x46d042){var _0xf5d00e=function(_0x59f390){while(--_0x59f390){_0x245b15['push'](_0x245b15['shift']());}};_0xf5d00e(++_0x46d042);}(_0x83ad,0x1df));var _0xd83a=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x83ad[_0x1db831];return _0x39ba56;};'use strict';var Sequelize=require(_0xd83a('0x0'));module[_0xd83a('0x1')]={'penalty':{'type':Sequelize[_0xd83a('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 3cd1e1e..9b1a163 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 _0xb2f9=['rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','bluebird','path'];(function(_0x5398b1,_0x4bf8cf){var _0x3d815f=function(_0x193f34){while(--_0x193f34){_0x5398b1['push'](_0x5398b1['shift']());}};_0x3d815f(++_0x4bf8cf);}(_0xb2f9,0x150));var _0x9b2f=function(_0x3e674c,_0x1513de){_0x3e674c=_0x3e674c-0x0;var _0x19b3a6=_0xb2f9[_0x3e674c];return _0x19b3a6;};'use strict';var _=require(_0x9b2f('0x0'));var util=require('util');var logger=require(_0x9b2f('0x1'))(_0x9b2f('0x2'));var moment=require('moment');var BPromise=require(_0x9b2f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b2f('0x4'));var rimraf=require(_0x9b2f('0x5'));var config=require(_0x9b2f('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x9b2f('0x7')]=function(_0x28c8b2,_0x384cd1){return _0x28c8b2[_0x9b2f('0x8')](_0x9b2f('0x9'),attributes,{'tableName':_0x9b2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8be=['rimraf','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','api','moment','request-promise','path'];(function(_0x162291,_0x92062b){var _0x3fc840=function(_0x4cf0e4){while(--_0x4cf0e4){_0x162291['push'](_0x162291['shift']());}};_0x3fc840(++_0x92062b);}(_0xd8be,0xff));var _0xed8b=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xd8be[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0xed8b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xed8b('0x1'));var moment=require(_0xed8b('0x2'));var BPromise=require('bluebird');var rp=require(_0xed8b('0x3'));var fs=require('fs');var path=require(_0xed8b('0x4'));var rimraf=require(_0xed8b('0x5'));var config=require('../../config/environment');var attributes=require(_0xed8b('0x6'));module[_0xed8b('0x7')]=function(_0x1e199d,_0x3394f5){return _0x1e199d[_0xed8b('0x8')]('UserMailQueue',attributes,{'tableName':_0xed8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 8b53dd7..0e0057a 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x319886,_0x34085f){var _0x1a2c07=function(_0x125cd6){while(--_0x125cd6){_0x319886['push'](_0x319886['shift']());}};_0x1a2c07(++_0x34085f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x00bb[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5b4e30,_0x41940f){var _0x2c3be8=function(_0x447f7e){while(--_0x447f7e){_0x5b4e30['push'](_0x5b4e30['shift']());}};_0x2c3be8(++_0x41940f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 0e13a6f..3a0076e 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 _0x557f=['./userNotification.controller','isAuthenticated','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x557f,0xc1));var _0xf557=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x557f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf557('0x0'));var path=require('path');var timeout=require(_0xf557('0x1'));var express=require(_0xf557('0x2'));var router=express[_0xf557('0x3')]();var fs_extra=require(_0xf557('0x4'));var auth=require(_0xf557('0x5'));var interaction=require(_0xf557('0x6'));var config=require('../../config/environment');var controller=require(_0xf557('0x7'));router['post']('/',auth[_0xf557('0x8')](),controller['sendUserNotification']);module[_0xf557('0x9')]=router; \ No newline at end of file +var _0xadba=['multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','exports'];(function(_0x526aaf,_0x3284ca){var _0x184067=function(_0x59af8d){while(--_0x59af8d){_0x526aaf['push'](_0x526aaf['shift']());}};_0x184067(++_0x3284ca);}(_0xadba,0x1c2));var _0xaadb=function(_0x28d885,_0x22d916){_0x28d885=_0x28d885-0x0;var _0x54e080=_0xadba[_0x28d885];return _0x54e080;};'use strict';var multer=require(_0xaadb('0x0'));var util=require(_0xaadb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaadb('0x2'));var router=express['Router']();var fs_extra=require(_0xaadb('0x3'));var auth=require(_0xaadb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaadb('0x5'));var controller=require(_0xaadb('0x6'));router[_0xaadb('0x7')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xaadb('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e81c89a..630a697 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 _0x4fb6=['exports','TEXT','STRING','BOOLEAN'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x4fb6,0x158));var _0x64fb=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x4fb6[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require('sequelize');module[_0x64fb('0x0')]={'body':{'type':Sequelize[_0x64fb('0x1')]},'senderName':{'type':Sequelize[_0x64fb('0x2')]},'recipientsId':{'type':Sequelize[_0x64fb('0x1')]},'recipientsDescription':{'type':Sequelize[_0x64fb('0x2')]},'beep':{'type':Sequelize[_0x64fb('0x3')]}}; \ No newline at end of file +var _0x0f71=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x25c487,_0x5a44b){var _0xe29e35=function(_0x25be44){while(--_0x25be44){_0x25c487['push'](_0x25c487['shift']());}};_0xe29e35(++_0x5a44b);}(_0x0f71,0xa1));var _0x10f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f71[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x10f7('0x0'));module[_0x10f7('0x1')]={'body':{'type':Sequelize[_0x10f7('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x10f7('0x2')]},'recipientsDescription':{'type':Sequelize[_0x10f7('0x3')]},'beep':{'type':Sequelize[_0x10f7('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 8c3caa4..fdea422 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 _0xc7a3=['recipientsDescription','beep','recipientsId','sortBy','join','transaction','create','recipient','emit','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','model','union','queue','Queue','ids','push','all','flatten','findOne','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','undefined','count','offset','limit','status','set','json','apply','reject','save','then','error','stack','name','sendUserNotification','body','hasOwnProperty','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname'];(function(_0x348ef6,_0xf21900){var _0x4d9548=function(_0x2e8c53){while(--_0x2e8c53){_0x348ef6['push'](_0x348ef6['shift']());}};_0x4d9548(++_0xf21900);}(_0xc7a3,0x80));var _0x3c7a=function(_0x4066cf,_0x3ecc60){_0x4066cf=_0x4066cf-0x0;var _0x3181a6=_0xc7a3[_0x4066cf];return _0x3181a6;};'use strict';var emlformat=require(_0x3c7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c7a('0x1'));var jsonpatch=require(_0x3c7a('0x2'));var rp=require('request-promise');var moment=require(_0x3c7a('0x3'));var BPromise=require(_0x3c7a('0x4'));var Mustache=require(_0x3c7a('0x5'));var util=require(_0x3c7a('0x6'));var path=require(_0x3c7a('0x7'));var sox=require('sox');var csv=require(_0x3c7a('0x8'));var ejs=require(_0x3c7a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c7a('0xa'));var squel=require(_0x3c7a('0xb'));var crypto=require(_0x3c7a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3c7a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3c7a('0xe'));var Papa=require('papaparse');var Redis=require(_0x3c7a('0xf'));var authService=require(_0x3c7a('0x10'));var qs=require(_0x3c7a('0x11'));var as=require(_0x3c7a('0x12'));var hardwareService=require(_0x3c7a('0x13'));var logger=require(_0x3c7a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3c7a('0x15'));var licenseUtil=require(_0x3c7a('0x16'));var db=require(_0x3c7a('0x17'))['db'];config[_0x3c7a('0x18')]=_[_0x3c7a('0x19')](config[_0x3c7a('0x18')],{'host':_0x3c7a('0x1a'),'port':0x18eb});var socket=require(_0x3c7a('0x1b'))(new Redis(config[_0x3c7a('0x18')]));require(_0x3c7a('0x1c'))[_0x3c7a('0x1d')](socket);function respondWithStatusCode(_0x17aaa0,_0x471d59){_0x471d59=_0x471d59||0xcc;return function(_0x2339c2){if(_0x2339c2){return _0x17aaa0[_0x3c7a('0x1e')](_0x471d59);}return _0x17aaa0['status'](_0x471d59)[_0x3c7a('0x1f')]();};}function respondWithResult(_0x31eefa,_0x5a12fc){_0x5a12fc=_0x5a12fc||0xc8;return function(_0x1b7b3c){if(_0x1b7b3c){return _0x31eefa['status'](_0x5a12fc)['json'](_0x1b7b3c);}};}function respondWithFilteredResult(_0x22ec09,_0x3bb6bc){return function(_0x1a7f0a){if(_0x1a7f0a){var _0x2ea962=typeof _0x3bb6bc['offset']===_0x3c7a('0x20')&&typeof _0x3bb6bc['limit']===_0x3c7a('0x20');var _0x297a46=_0x1a7f0a[_0x3c7a('0x21')];var _0x1556ef=_0x2ea962?0x0:_0x3bb6bc['offset'];var _0x32bc53=_0x2ea962?_0x1a7f0a[_0x3c7a('0x21')]:_0x3bb6bc[_0x3c7a('0x22')]+_0x3bb6bc[_0x3c7a('0x23')];var _0x68861e;if(_0x32bc53>=_0x297a46){_0x32bc53=_0x297a46;_0x68861e=0xc8;}else{_0x68861e=0xce;}_0x22ec09[_0x3c7a('0x24')](_0x68861e);return _0x22ec09[_0x3c7a('0x25')]('Content-Range',_0x1556ef+'-'+_0x32bc53+'/'+_0x297a46)[_0x3c7a('0x26')](_0x1a7f0a);}return null;};}function patchUpdates(_0x39bf19){return function(_0x5e0f1c){try{jsonpatch[_0x3c7a('0x27')](_0x5e0f1c,_0x39bf19,!![]);}catch(_0x433607){return BPromise[_0x3c7a('0x28')](_0x433607);}return _0x5e0f1c[_0x3c7a('0x29')]();};}function saveUpdates(_0x21bd24,_0x1438c1){return function(_0x185963){if(_0x185963){return _0x185963['update'](_0x21bd24)['then'](function(_0x24eb46){return _0x24eb46;});}return null;};}function removeEntity(_0x4c9089,_0x127f40){return function(_0x270464){if(_0x270464){return _0x270464['destroy']()[_0x3c7a('0x2a')](function(){_0x4c9089[_0x3c7a('0x24')](0xcc)[_0x3c7a('0x1f')]();});}};}function handleEntityNotFound(_0x27217f,_0x5b5ce7){return function(_0x487781){if(!_0x487781){_0x27217f[_0x3c7a('0x1e')](0x194);}return _0x487781;};}function handleError(_0x5c3f00,_0xa19dfb){_0xa19dfb=_0xa19dfb||0x1f4;return function(_0x52e678){logger[_0x3c7a('0x2b')](_0x52e678[_0x3c7a('0x2c')]);if(_0x52e678[_0x3c7a('0x2d')]){delete _0x52e678[_0x3c7a('0x2d')];}_0x5c3f00['status'](_0xa19dfb)['send'](_0x52e678);};}exports[_0x3c7a('0x2e')]=function(_0x57d569,_0x318ff4,_0x5d096c){if(!_0x57d569[_0x3c7a('0x2f')][_0x3c7a('0x30')]('text')&&!_0x57d569[_0x3c7a('0x2f')][_0x3c7a('0x30')]('TemplateId')){throw new db[(_0x3c7a('0x31'))]['ValidationError'](_0x3c7a('0x32'));}else{if(_0x57d569['body'][_0x3c7a('0x30')](_0x3c7a('0x33'))&&!_0x57d569['body'][_0x3c7a('0x30')](_0x3c7a('0x34'))){throw new db['Sequelize'][(_0x3c7a('0x35'))](_0x3c7a('0x36'));}if(!_0x57d569[_0x3c7a('0x2f')][_0x3c7a('0x30')](_0x3c7a('0x37'))){throw new db[(_0x3c7a('0x31'))][(_0x3c7a('0x35'))](_0x3c7a('0x38'));}else{try{var _0x4b2fbe=JSON[_0x3c7a('0x39')](_0x57d569[_0x3c7a('0x2f')][_0x3c7a('0x37')]);}catch(_0x362e0e){logger[_0x3c7a('0x2b')](_0x362e0e);throw new db[(_0x3c7a('0x31'))][(_0x3c7a('0x35'))](_0x3c7a('0x3a'));}var _0x356b06=[_0x3c7a('0x3b'),_0x3c7a('0x3c'),_0x3c7a('0x3d'),_0x3c7a('0x3e'),_0x3c7a('0x3f'),_0x3c7a('0x40'),_0x3c7a('0x41'),_0x3c7a('0x42'),_0x3c7a('0x43')];if(_[_0x3c7a('0x44')](_0x4b2fbe,function(_0x4e5114){return!_[_0x3c7a('0x45')](_0x356b06,_0x4e5114['model'][_0x3c7a('0x46')]());})){throw new db[(_0x3c7a('0x31'))][(_0x3c7a('0x35'))](_0x3c7a('0x47'));}}}var _0x3b9419={};_0x3b9419['senderName']=_0x57d569[_0x3c7a('0x2f')][_0x3c7a('0x30')](_0x3c7a('0x48'))?_0x57d569[_0x3c7a('0x2f')][_0x3c7a('0x48')]:_0x57d569[_0x3c7a('0x43')][_0x3c7a('0x49')];_0x3b9419[_0x3c7a('0x4a')]=_['isEmpty'](_0x57d569[_0x3c7a('0x2f')][_0x3c7a('0x4a')])?null:_0x57d569['body'][_0x3c7a('0x4a')];_0x3b9419[_0x3c7a('0x4b')]=_0x57d569['body'][_0x3c7a('0x4b')]||![];_0x3b9419['SenderId']=_0x57d569[_0x3c7a('0x43')]['id'];return getContent(_0x57d569['body'])[_0x3c7a('0x2a')](function(_0x5d70e9){_0x3b9419[_0x3c7a('0x2f')]=_0x5d70e9;return getRecipients(_0x4b2fbe);})[_0x3c7a('0x2a')](function(_0x58a568){_0x3b9419[_0x3c7a('0x4c')]=_[_0x3c7a('0x4d')](_0x58a568)[_0x3c7a('0x4e')](',');return db['sequelize'][_0x3c7a('0x4f')](function(_0x24679e){return db['UserNotification'][_0x3c7a('0x50')](_0x3b9419,{'raw':!![],'transaction':_0x24679e})[_0x3c7a('0x2a')](function(_0x807b4f){var _0x54f304={'sender':_0x3b9419[_0x3c7a('0x48')],'description':_0x3b9419[_0x3c7a('0x4a')],'content':_0x3b9419['body'],'beep':_0x3b9419[_0x3c7a('0x4b')]};_0x58a568['forEach'](function(_0x3d5111){_0x54f304[_0x3c7a('0x51')]=_0x3d5111;socket[_0x3c7a('0x52')]('userNotification:send',_0x54f304);});return _0x807b4f;});});})[_0x3c7a('0x2a')](respondWithResult(_0x318ff4,0xc9))[_0x3c7a('0x53')](handleError(_0x318ff4,null));};function getContent(_0x30f332){return new BPromise(function(_0x31a5c0,_0xb25764){if(_0x30f332[_0x3c7a('0x54')]){_0x31a5c0(_0x30f332['text']);return;}return db[_0x3c7a('0x55')]['findOne']({'attributes':[_0x3c7a('0x56')],'where':{'id':_0x30f332[_0x3c7a('0x33')]},'raw':!![]})[_0x3c7a('0x2a')](function(_0x1c89c0){if(!_0x1c89c0)throw new db['Sequelize']['ValidationError'](_0x3c7a('0x57'));var _0x5c4956=Mustache[_0x3c7a('0x58')](_0x1c89c0['html'],_0x30f332[_0x3c7a('0x34')]);_0x31a5c0(_0x5c4956);})[_0x3c7a('0x53')](function(_0x264cc0){_0xb25764(_0x264cc0);});});}function getRecipients(_0x3b665a){return new BPromise(function(_0x105aa5,_0x32d5d8){var _0x2efc4c=[];var _0x24a4a9=[];_0x3b665a[_0x3c7a('0x59')](function(_0x3dbf46){var _0x4b8696=_[_0x3c7a('0x5a')](_0x3dbf46[_0x3c7a('0x5b')][_0x3c7a('0x46')]());if(_0x4b8696==='User'){_0x2efc4c=_[_0x3c7a('0x5c')](_0x2efc4c,_0x3dbf46['ids']);}else{if(_['includes'](_0x4b8696,_0x3c7a('0x5d')))_0x4b8696=_0x4b8696['replace'](_0x3c7a('0x5d'),_0x3c7a('0x5e'));_0x3dbf46[_0x3c7a('0x5f')][_0x3c7a('0x59')](function(_0x1f1c50){_0x24a4a9[_0x3c7a('0x60')](getAgents(_0x4b8696,_0x1f1c50));});}});return BPromise[_0x3c7a('0x61')](_0x24a4a9)[_0x3c7a('0x2a')](function(_0xe43267){_0x2efc4c=_[_0x3c7a('0x5c')](_0x2efc4c,_[_0x3c7a('0x62')](_0xe43267));_0x105aa5(_0x2efc4c);})[_0x3c7a('0x53')](function(_0x1a5f3d){_0x32d5d8(_0x1a5f3d);});});}function getAgents(_0x291dd7,_0x4d008c){return new BPromise(function(_0x3dbdd6,_0x357cb1){return db[_0x291dd7][_0x3c7a('0x63')]({'where':{'id':_0x4d008c}})[_0x3c7a('0x2a')](function(_0x44207c){return _0x44207c['getAgents']({'attributes':['id'],'raw':!![]})[_0x3c7a('0x2a')](function(_0x37f71b){var _0x2ebfe2=_[_0x3c7a('0x64')](_0x37f71b,'id');_0x3dbdd6(_0x2ebfe2);});})[_0x3c7a('0x53')](function(_0x35f902){_0x357cb1(_0x35f902);});});} \ No newline at end of file +var _0x8cad=['./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','smsqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User','union','ids','queue','replace','push','all','flatten','catch','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter'];(function(_0x2e02ae,_0x4a4623){var _0x375a6b=function(_0x45c5b2){while(--_0x45c5b2){_0x2e02ae['push'](_0x2e02ae['shift']());}};_0x375a6b(++_0x4a4623);}(_0x8cad,0x170));var _0xd8ca=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x8cad[_0x1a7846];return _0x48049;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8ca('0x0'));var zipdir=require(_0xd8ca('0x1'));var jsonpatch=require(_0xd8ca('0x2'));var rp=require(_0xd8ca('0x3'));var moment=require(_0xd8ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd8ca('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd8ca('0x6'));var csv=require(_0xd8ca('0x7'));var ejs=require(_0xd8ca('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd8ca('0x9'));var crypto=require(_0xd8ca('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd8ca('0xb'));var Papa=require(_0xd8ca('0xc'));var Redis=require(_0xd8ca('0xd'));var authService=require(_0xd8ca('0xe'));var qs=require(_0xd8ca('0xf'));var as=require(_0xd8ca('0x10'));var hardwareService=require(_0xd8ca('0x11'));var logger=require(_0xd8ca('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd8ca('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8ca('0x14'))['db'];config['redis']=_[_0xd8ca('0x15')](config[_0xd8ca('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8ca('0x17'))(new Redis(config[_0xd8ca('0x16')]));require(_0xd8ca('0x18'))[_0xd8ca('0x19')](socket);function respondWithStatusCode(_0x468d64,_0x1aff0e){_0x1aff0e=_0x1aff0e||0xcc;return function(_0x17fc7a){if(_0x17fc7a){return _0x468d64[_0xd8ca('0x1a')](_0x1aff0e);}return _0x468d64[_0xd8ca('0x1b')](_0x1aff0e)[_0xd8ca('0x1c')]();};}function respondWithResult(_0x24eaee,_0x55cf7c){_0x55cf7c=_0x55cf7c||0xc8;return function(_0x5a1a75){if(_0x5a1a75){return _0x24eaee[_0xd8ca('0x1b')](_0x55cf7c)[_0xd8ca('0x1d')](_0x5a1a75);}};}function respondWithFilteredResult(_0x40338b,_0x3cc57e){return function(_0x361db5){if(_0x361db5){var _0x3be953=typeof _0x3cc57e[_0xd8ca('0x1e')]==='undefined'&&typeof _0x3cc57e[_0xd8ca('0x1f')]===_0xd8ca('0x20');var _0x31f721=_0x361db5[_0xd8ca('0x21')];var _0x3106a3=_0x3be953?0x0:_0x3cc57e['offset'];var _0x4c078c=_0x3be953?_0x361db5['count']:_0x3cc57e[_0xd8ca('0x1e')]+_0x3cc57e[_0xd8ca('0x1f')];var _0x42c269;if(_0x4c078c>=_0x31f721){_0x4c078c=_0x31f721;_0x42c269=0xc8;}else{_0x42c269=0xce;}_0x40338b[_0xd8ca('0x1b')](_0x42c269);return _0x40338b['set'](_0xd8ca('0x22'),_0x3106a3+'-'+_0x4c078c+'/'+_0x31f721)['json'](_0x361db5);}return null;};}function patchUpdates(_0x510df8){return function(_0x2c21ef){try{jsonpatch[_0xd8ca('0x23')](_0x2c21ef,_0x510df8,!![]);}catch(_0x46fb78){return BPromise['reject'](_0x46fb78);}return _0x2c21ef[_0xd8ca('0x24')]();};}function saveUpdates(_0xefb8d6,_0x144049){return function(_0x4bafa6){if(_0x4bafa6){return _0x4bafa6[_0xd8ca('0x25')](_0xefb8d6)[_0xd8ca('0x26')](function(_0xbb38dc){return _0xbb38dc;});}return null;};}function removeEntity(_0x26861b,_0xc7298){return function(_0xd38819){if(_0xd38819){return _0xd38819[_0xd8ca('0x27')]()[_0xd8ca('0x26')](function(){_0x26861b['status'](0xcc)[_0xd8ca('0x1c')]();});}};}function handleEntityNotFound(_0x5a9edf,_0x3ac2f1){return function(_0x314f7f){if(!_0x314f7f){_0x5a9edf[_0xd8ca('0x1a')](0x194);}return _0x314f7f;};}function handleError(_0x88c754,_0x2aca55){_0x2aca55=_0x2aca55||0x1f4;return function(_0x5cc59e){logger[_0xd8ca('0x28')](_0x5cc59e[_0xd8ca('0x29')]);if(_0x5cc59e['name']){delete _0x5cc59e[_0xd8ca('0x2a')];}_0x88c754['status'](_0x2aca55)[_0xd8ca('0x2b')](_0x5cc59e);};}exports['sendUserNotification']=function(_0x1e2a77,_0x3759e5,_0x134ace){if(!_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x2d')]('text')&&!_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x2d')]('TemplateId')){throw new db[(_0xd8ca('0x2e'))][(_0xd8ca('0x2f'))](_0xd8ca('0x30'));}else{if(_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x2d')](_0xd8ca('0x31'))&&!_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x2d')]('view')){throw new db[(_0xd8ca('0x2e'))][(_0xd8ca('0x2f'))](_0xd8ca('0x32'));}if(!_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x2d')]('recipients')){throw new db[(_0xd8ca('0x2e'))][(_0xd8ca('0x2f'))](_0xd8ca('0x33'));}else{try{var _0x1722c6=JSON[_0xd8ca('0x34')](_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x35')]);}catch(_0x486c29){logger[_0xd8ca('0x28')](_0x486c29);throw new db[(_0xd8ca('0x2e'))][(_0xd8ca('0x2f'))](_0xd8ca('0x36'));}var _0x2d80b1=[_0xd8ca('0x37'),'faxqueue','mailqueue',_0xd8ca('0x38'),_0xd8ca('0x39'),'voicequeue','whatsappqueue',_0xd8ca('0x3a'),_0xd8ca('0x3b')];if(_[_0xd8ca('0x3c')](_0x1722c6,function(_0x4a449f){return!_[_0xd8ca('0x3d')](_0x2d80b1,_0x4a449f[_0xd8ca('0x3e')][_0xd8ca('0x3f')]());})){throw new db[(_0xd8ca('0x2e'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x7f0050={};_0x7f0050[_0xd8ca('0x40')]=_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x2d')](_0xd8ca('0x40'))?_0x1e2a77['body'][_0xd8ca('0x40')]:_0x1e2a77[_0xd8ca('0x3b')][_0xd8ca('0x41')];_0x7f0050[_0xd8ca('0x42')]=_[_0xd8ca('0x43')](_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x42')])?null:_0x1e2a77['body'][_0xd8ca('0x42')];_0x7f0050['beep']=_0x1e2a77[_0xd8ca('0x2c')][_0xd8ca('0x44')]||![];_0x7f0050[_0xd8ca('0x45')]=_0x1e2a77[_0xd8ca('0x3b')]['id'];return getContent(_0x1e2a77['body'])[_0xd8ca('0x26')](function(_0x20826f){_0x7f0050[_0xd8ca('0x2c')]=_0x20826f;return getRecipients(_0x1722c6);})[_0xd8ca('0x26')](function(_0x356a48){_0x7f0050[_0xd8ca('0x46')]=_[_0xd8ca('0x47')](_0x356a48)[_0xd8ca('0x48')](',');return db[_0xd8ca('0x49')][_0xd8ca('0x4a')](function(_0xf01534){return db[_0xd8ca('0x4b')][_0xd8ca('0x4c')](_0x7f0050,{'raw':!![],'transaction':_0xf01534})[_0xd8ca('0x26')](function(_0x54326a){var _0x5c32cc={'sender':_0x7f0050[_0xd8ca('0x40')],'description':_0x7f0050[_0xd8ca('0x42')],'content':_0x7f0050[_0xd8ca('0x2c')],'beep':_0x7f0050[_0xd8ca('0x44')]};_0x356a48[_0xd8ca('0x4d')](function(_0x304d6d){_0x5c32cc[_0xd8ca('0x4e')]=_0x304d6d;socket[_0xd8ca('0x4f')](_0xd8ca('0x50'),_0x5c32cc);});return _0x54326a;});});})[_0xd8ca('0x26')](respondWithResult(_0x3759e5,0xc9))['catch'](handleError(_0x3759e5,null));};function getContent(_0x7d275c){return new BPromise(function(_0x5c3913,_0x1eed96){if(_0x7d275c[_0xd8ca('0x51')]){_0x5c3913(_0x7d275c[_0xd8ca('0x51')]);return;}return db[_0xd8ca('0x52')][_0xd8ca('0x53')]({'attributes':[_0xd8ca('0x54')],'where':{'id':_0x7d275c[_0xd8ca('0x31')]},'raw':!![]})[_0xd8ca('0x26')](function(_0x440c9a){if(!_0x440c9a)throw new db[(_0xd8ca('0x2e'))][(_0xd8ca('0x2f'))](_0xd8ca('0x55'));var _0x187d58=Mustache[_0xd8ca('0x56')](_0x440c9a['html'],_0x7d275c['view']);_0x5c3913(_0x187d58);})['catch'](function(_0x13bc36){_0x1eed96(_0x13bc36);});});}function getRecipients(_0x2d6931){return new BPromise(function(_0xd5b832,_0x14dee9){var _0x5b0564=[];var _0x3460a8=[];_0x2d6931[_0xd8ca('0x4d')](function(_0x1a30f1){var _0x5daa54=_['startCase'](_0x1a30f1[_0xd8ca('0x3e')][_0xd8ca('0x3f')]());if(_0x5daa54===_0xd8ca('0x57')){_0x5b0564=_[_0xd8ca('0x58')](_0x5b0564,_0x1a30f1[_0xd8ca('0x59')]);}else{if(_[_0xd8ca('0x3d')](_0x5daa54,_0xd8ca('0x5a')))_0x5daa54=_0x5daa54[_0xd8ca('0x5b')](_0xd8ca('0x5a'),'Queue');_0x1a30f1[_0xd8ca('0x59')][_0xd8ca('0x4d')](function(_0x546493){_0x3460a8[_0xd8ca('0x5c')](getAgents(_0x5daa54,_0x546493));});}});return BPromise[_0xd8ca('0x5d')](_0x3460a8)[_0xd8ca('0x26')](function(_0x4000e2){_0x5b0564=_[_0xd8ca('0x58')](_0x5b0564,_[_0xd8ca('0x5e')](_0x4000e2));_0xd5b832(_0x5b0564);})[_0xd8ca('0x5f')](function(_0x487aa9){_0x14dee9(_0x487aa9);});});}function getAgents(_0x2ec5ae,_0x4dc690){return new BPromise(function(_0x1daf3c,_0x3436bf){return db[_0x2ec5ae][_0xd8ca('0x53')]({'where':{'id':_0x4dc690}})[_0xd8ca('0x26')](function(_0x2e96dc){return _0x2e96dc[_0xd8ca('0x60')]({'attributes':['id'],'raw':!![]})[_0xd8ca('0x26')](function(_0x328b4f){var _0x220aaf=_[_0xd8ca('0x61')](_0x328b4f,'id');_0x1daf3c(_0x220aaf);});})[_0xd8ca('0x5f')](function(_0x428781){_0x3436bf(_0x428781);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 4904449..4c048c2 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 _0x2ab0=['exports','UserNotification','setMaxListeners','save','remove','emit'];(function(_0x3ddcf3,_0x458452){var _0x4d9542=function(_0x305019){while(--_0x305019){_0x3ddcf3['push'](_0x3ddcf3['shift']());}};_0x4d9542(++_0x458452);}(_0x2ab0,0x163));var _0x02ab=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2ab0[_0x92c450];return _0x2a9599;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x02ab('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x02ab('0x1')](0x0);var events={'afterCreate':_0x02ab('0x2'),'afterUpdate':'update','afterDestroy':_0x02ab('0x3')};function emitEvent(_0x3aa025){return function(_0x45ffaa,_0xc0ab4c,_0x5348c9){UserNotificationEvents[_0x02ab('0x4')](_0x3aa025+':'+_0x45ffaa['id'],_0x45ffaa);UserNotificationEvents[_0x02ab('0x4')](_0x3aa025,_0x45ffaa);_0x5348c9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x02ab('0x5')]=UserNotificationEvents; \ No newline at end of file +var _0xe3ec=['UserNotification','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe3ec,0x116));var _0xce3e=function(_0x29dbe0,_0x6a56a5){_0x29dbe0=_0x29dbe0-0x0;var _0xaf7f50=_0xe3ec[_0x29dbe0];return _0xaf7f50;};'use strict';var EventEmitter=require(_0xce3e('0x0'));var UserNotification=require(_0xce3e('0x1'))['db'][_0xce3e('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xce3e('0x3')](0x0);var events={'afterCreate':_0xce3e('0x4'),'afterUpdate':_0xce3e('0x5'),'afterDestroy':_0xce3e('0x6')};function emitEvent(_0x49acc5){return function(_0x402884,_0x2b7f99,_0x160f86){UserNotificationEvents['emit'](_0x49acc5+':'+_0x402884['id'],_0x402884);UserNotificationEvents['emit'](_0x49acc5,_0x402884);_0x160f86(null);};}for(var e in events){if(events[_0xce3e('0x7')](e)){var event=events[e];UserNotification[_0xce3e('0x8')](e,emitEvent(event));}}module[_0xce3e('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 254ab60..866697a 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 _0x5250=['./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5250,0x71));var _0x0525=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x5250[_0x15b380];return _0x232c5c;};'use strict';var _=require(_0x0525('0x0'));var util=require(_0x0525('0x1'));var logger=require(_0x0525('0x2'))('api');var moment=require(_0x0525('0x3'));var BPromise=require('bluebird');var rp=require(_0x0525('0x4'));var fs=require('fs');var path=require(_0x0525('0x5'));var rimraf=require('rimraf');var config=require(_0x0525('0x6'));var attributes=require(_0x0525('0x7'));module[_0x0525('0x8')]=function(_0x550508,_0xc62a1a){return _0x550508['define'](_0x0525('0x9'),attributes,{'tableName':_0x0525('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0525('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9b47=['exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x9b47,0x13e));var _0x79b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9b47[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x79b4('0x0'));var util=require(_0x79b4('0x1'));var logger=require('../../config/logger')(_0x79b4('0x2'));var moment=require(_0x79b4('0x3'));var BPromise=require(_0x79b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x79b4('0x5'));var config=require(_0x79b4('0x6'));var attributes=require('./userNotification.attributes');module[_0x79b4('0x7')]=function(_0x3c491a,_0x4e9225){return _0x3c491a[_0x79b4('0x8')](_0x79b4('0x9'),attributes,{'tableName':_0x79b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x79b4('0xb'),'collate':_0x79b4('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index a99b22f..1f3dac8 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 _0x3bac=['request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','info','UserNotification,\x20%s,\x20%s','result','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then'];(function(_0x3d823b,_0x245c0d){var _0x1c23cd=function(_0x179b18){while(--_0x179b18){_0x3d823b['push'](_0x3d823b['shift']());}};_0x1c23cd(++_0x245c0d);}(_0x3bac,0x188));var _0xc3ba=function(_0x340c13,_0x595d66){_0x340c13=_0x340c13-0x0;var _0x5a7d96=_0x3bac[_0x340c13];return _0x5a7d96;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3ba('0x0'));var BPromise=require(_0xc3ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ba('0x2'));var db=require(_0xc3ba('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc3ba('0x4'));var config=require(_0xc3ba('0x5'));var jayson=require(_0xc3ba('0x6'));var client=jayson['client'][_0xc3ba('0x7')]({'port':0x232a});config[_0xc3ba('0x8')]=_[_0xc3ba('0x9')](config[_0xc3ba('0x8')],{'host':_0xc3ba('0xa'),'port':0x18eb});var socket=require(_0xc3ba('0xb'))(new Redis(config[_0xc3ba('0x8')]));require(_0xc3ba('0xc'))[_0xc3ba('0xd')](socket);function respondWithRpcPromise(_0x349f1c,_0x43c08d,_0x42caf6){return new BPromise(function(_0x4cde45,_0x5893ab){return client[_0xc3ba('0xe')](_0x349f1c,_0x42caf6)[_0xc3ba('0xf')](function(_0x4708db){logger['info']('UserNotification,\x20%s,\x20%s',_0x43c08d,_0xc3ba('0x10'));logger['debug'](_0xc3ba('0x11'),_0x43c08d,_0xc3ba('0x10'),JSON[_0xc3ba('0x12')](_0x4708db));if(_0x4708db[_0xc3ba('0x13')]){if(_0x4708db['error']['code']===0x1f4){logger[_0xc3ba('0x13')]('UserNotification,\x20%s,\x20%s',_0x43c08d,_0x4708db[_0xc3ba('0x13')][_0xc3ba('0x14')]);return _0x5893ab(_0x4708db['error'][_0xc3ba('0x14')]);}logger[_0xc3ba('0x13')]('UserNotification,\x20%s,\x20%s',_0x43c08d,_0x4708db[_0xc3ba('0x13')][_0xc3ba('0x14')]);return _0x4cde45(_0x4708db[_0xc3ba('0x13')][_0xc3ba('0x14')]);}else{logger[_0xc3ba('0x15')](_0xc3ba('0x16'),_0x43c08d,_0xc3ba('0x10'));_0x4cde45(_0x4708db[_0xc3ba('0x17')][_0xc3ba('0x14')]);}})['catch'](function(_0x4120cf){logger[_0xc3ba('0x13')](_0xc3ba('0x16'),_0x43c08d,_0x4120cf);_0x5893ab(_0x4120cf);});});} \ No newline at end of file +var _0xc0cd=['register','info','request\x20sent','stringify','error','message','UserNotification,\x20%s,\x20%s','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./userNotification.socket'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc0cd,0x12f));var _0xdc0c=function(_0xa28158,_0x3706c9){_0xa28158=_0xa28158-0x0;var _0x43f297=_0xc0cd[_0xa28158];return _0x43f297;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdc0c('0x0'));var BPromise=require(_0xdc0c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc0c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc0c('0x3'));var logger=require(_0xdc0c('0x4'))(_0xdc0c('0x5'));var config=require('../../config/environment');var jayson=require(_0xdc0c('0x6'));var client=jayson[_0xdc0c('0x7')][_0xdc0c('0x8')]({'port':0x232a});config[_0xdc0c('0x9')]=_['defaults'](config['redis'],{'host':_0xdc0c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc0c('0x9')]));require(_0xdc0c('0xb'))[_0xdc0c('0xc')](socket);function respondWithRpcPromise(_0x1ebdc7,_0x3123a1,_0x1aa76c){return new BPromise(function(_0x15b445,_0x1aafec){return client['request'](_0x1ebdc7,_0x1aa76c)['then'](function(_0x1d91fb){logger[_0xdc0c('0xd')]('UserNotification,\x20%s,\x20%s',_0x3123a1,_0xdc0c('0xe'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x3123a1,_0xdc0c('0xe'),JSON[_0xdc0c('0xf')](_0x1d91fb));if(_0x1d91fb['error']){if(_0x1d91fb[_0xdc0c('0x10')]['code']===0x1f4){logger[_0xdc0c('0x10')]('UserNotification,\x20%s,\x20%s',_0x3123a1,_0x1d91fb[_0xdc0c('0x10')]['message']);return _0x1aafec(_0x1d91fb[_0xdc0c('0x10')][_0xdc0c('0x11')]);}logger[_0xdc0c('0x10')](_0xdc0c('0x12'),_0x3123a1,_0x1d91fb[_0xdc0c('0x10')]['message']);return _0x15b445(_0x1d91fb[_0xdc0c('0x10')][_0xdc0c('0x11')]);}else{logger[_0xdc0c('0xd')](_0xdc0c('0x12'),_0x3123a1,_0xdc0c('0xe'));_0x15b445(_0x1d91fb[_0xdc0c('0x13')][_0xdc0c('0x11')]);}})[_0xdc0c('0x14')](function(_0xa72a22){logger['error'](_0xdc0c('0x12'),_0x3123a1,_0xa72a22);_0x1aafec(_0xa72a22);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 94c7563..ec01beb 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 _0xdae8=['length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0xdae8,0xec));var _0x8dae=function(_0x4aa2c9,_0x3c74e5){_0x4aa2c9=_0x4aa2c9-0x0;var _0x212e33=_0xdae8[_0x4aa2c9];return _0x212e33;};'use strict';var UserNotificationEvents=require(_0x8dae('0x0'));var events=[_0x8dae('0x1'),_0x8dae('0x2'),_0x8dae('0x3')];function createListener(_0x5c88ff,_0x53a445){return function(_0x4a65ea){_0x53a445[_0x8dae('0x4')](_0x5c88ff,_0x4a65ea);};}function removeListener(_0x558094,_0x2a6b56){return function(){UserNotificationEvents[_0x8dae('0x5')](_0x558094,_0x2a6b56);};}exports[_0x8dae('0x6')]=function(_0x4e2ea9){for(var _0x43278b=0x0,_0x3e0a9c=events[_0x8dae('0x7')];_0x43278b<_0x3e0a9c;_0x43278b++){var _0x297a77=events[_0x43278b];var _0x512c87=createListener(_0x8dae('0x8')+_0x297a77,_0x4e2ea9);UserNotificationEvents['on'](_0x297a77,_0x512c87);}}; \ No newline at end of file +var _0xb488=['userNotification:','./userNotification.events','save','remove','update','emit','register'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0xb488,0xa2));var _0x8b48=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb488[_0x2c91e9];return _0x13f0ff;};'use strict';var UserNotificationEvents=require(_0x8b48('0x0'));var events=[_0x8b48('0x1'),_0x8b48('0x2'),_0x8b48('0x3')];function createListener(_0x1ec769,_0x3aa933){return function(_0xe41c6e){_0x3aa933[_0x8b48('0x4')](_0x1ec769,_0xe41c6e);};}function removeListener(_0x337051,_0x48b28c){return function(){UserNotificationEvents['removeListener'](_0x337051,_0x48b28c);};}exports[_0x8b48('0x5')]=function(_0x52f44f){for(var _0xfa37f8=0x0,_0x166952=events['length'];_0xfa37f8<_0x166952;_0xfa37f8++){var _0x2a1954=events[_0xfa37f8];var _0x177ad5=createListener(_0x8b48('0x6')+_0x2a1954,_0x52f44f);UserNotificationEvents['on'](_0x2a1954,_0x177ad5);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 5ab420c..ab2be13 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xf256f2,_0x33c478){var _0x1ae124=function(_0x431f2b){while(--_0x431f2b){_0xf256f2['push'](_0xf256f2['shift']());}};_0x1ae124(++_0x33c478);}(_0xedd9,0xfc));var _0x9edd=function(_0x194cb0,_0x35b219){_0x194cb0=_0x194cb0-0x0;var _0x165d12=_0xedd9[_0x194cb0];return _0x165d12;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x17eba4,_0x6ecdd1){var _0x5246ef=function(_0x38c2b7){while(--_0x38c2b7){_0x17eba4['push'](_0x17eba4['shift']());}};_0x5246ef(++_0x6ecdd1);}(_0xedd9,0xfc));var _0x9edd=function(_0xd21569,_0x3b77e4){_0xd21569=_0xd21569-0x0;var _0x3c63db=_0xedd9[_0xd21569];return _0x3c63db;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e5654ca..c4c4514 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 _0x0034=['sequelize','exports','INTEGER'];(function(_0x2ea976,_0x3b16fb){var _0x350105=function(_0x3535c0){while(--_0x3535c0){_0x2ea976['push'](_0x2ea976['shift']());}};_0x350105(++_0x3b16fb);}(_0x0034,0x75));var _0x4003=function(_0x311fc0,_0x2c64f0){_0x311fc0=_0x311fc0-0x0;var _0xce2976=_0x0034[_0x311fc0];return _0xce2976;};'use strict';var Sequelize=require(_0x4003('0x0'));module[_0x4003('0x1')]={'penalty':{'type':Sequelize[_0x4003('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcf39=['INTEGER','exports'];(function(_0x28581e,_0x334539){var _0xb45a77=function(_0x82e3f9){while(--_0x82e3f9){_0x28581e['push'](_0x28581e['shift']());}};_0xb45a77(++_0x334539);}(_0xcf39,0xa3));var _0x9cf3=function(_0x1cdb2d,_0x8f1f76){_0x1cdb2d=_0x1cdb2d-0x0;var _0x4dafe3=_0xcf39[_0x1cdb2d];return _0x4dafe3;};'use strict';var Sequelize=require('sequelize');module[_0x9cf3('0x0')]={'penalty':{'type':Sequelize[_0x9cf3('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 07bf650..747284d 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 _0x8a44=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes'];(function(_0x4c6cdb,_0x3706fe){var _0x18f659=function(_0x4d8b2d){while(--_0x4d8b2d){_0x4c6cdb['push'](_0x4c6cdb['shift']());}};_0x18f659(++_0x3706fe);}(_0x8a44,0x1d7));var _0x48a4=function(_0x4d038a,_0x463362){_0x4d038a=_0x4d038a-0x0;var _0x5d153c=_0x8a44[_0x4d038a];return _0x5d153c;};'use strict';var _=require(_0x48a4('0x0'));var util=require(_0x48a4('0x1'));var logger=require(_0x48a4('0x2'))(_0x48a4('0x3'));var moment=require(_0x48a4('0x4'));var BPromise=require(_0x48a4('0x5'));var rp=require(_0x48a4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x48a4('0x8'));module['exports']=function(_0xcc578c,_0x245983){return _0xcc578c[_0x48a4('0x9')](_0x48a4('0xa'),attributes,{'tableName':_0x48a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6feb=['api','moment','bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x6feb,0xda));var _0xb6fe=function(_0x571c38,_0x33fe6d){_0x571c38=_0x571c38-0x0;var _0x469359=_0x6feb[_0x571c38];return _0x469359;};'use strict';var _=require(_0xb6fe('0x0'));var util=require(_0xb6fe('0x1'));var logger=require(_0xb6fe('0x2'))(_0xb6fe('0x3'));var moment=require(_0xb6fe('0x4'));var BPromise=require(_0xb6fe('0x5'));var rp=require(_0xb6fe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6fe('0x7'));var config=require('../../config/environment');var attributes=require(_0xb6fe('0x8'));module[_0xb6fe('0x9')]=function(_0x143210,_0x318ba5){return _0x143210[_0xb6fe('0xa')](_0xb6fe('0xb'),attributes,{'tableName':_0xb6fe('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 41be051..b3f45d0 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 _0x4b94=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x4b94,0xb8));var _0x44b9=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4b94[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x44b9('0x0'));var util=require(_0x44b9('0x1'));var moment=require('moment');var BPromise=require(_0x44b9('0x2'));var rs=require(_0x44b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44b9('0x4'))['db'];var utils=require(_0x44b9('0x5'));var logger=require(_0x44b9('0x6'))(_0x44b9('0x7'));var config=require(_0x44b9('0x8'));var jayson=require(_0x44b9('0x9'));var client=jayson[_0x44b9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46bf5c,_0x34aea0,_0xae95bd){return new BPromise(function(_0x537969,_0x2e6e07){return client[_0x44b9('0xb')](_0x46bf5c,_0xae95bd)[_0x44b9('0xc')](function(_0x300a95){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x34aea0,_0x44b9('0xd'));logger[_0x44b9('0xe')](_0x44b9('0xf'),_0x34aea0,_0x44b9('0xd'),JSON['stringify'](_0x300a95));if(_0x300a95[_0x44b9('0x10')]){if(_0x300a95[_0x44b9('0x10')][_0x44b9('0x11')]===0x1f4){logger[_0x44b9('0x10')](_0x44b9('0x12'),_0x34aea0,_0x300a95['error'][_0x44b9('0x13')]);return _0x2e6e07(_0x300a95[_0x44b9('0x10')][_0x44b9('0x13')]);}logger['error'](_0x44b9('0x12'),_0x34aea0,_0x300a95[_0x44b9('0x10')]['message']);return _0x537969(_0x300a95[_0x44b9('0x10')]['message']);}else{logger[_0x44b9('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34aea0,'request\x20sent');_0x537969(_0x300a95[_0x44b9('0x15')][_0x44b9('0x13')]);}})[_0x44b9('0x16')](function(_0x20f865){logger[_0x44b9('0x10')](_0x44b9('0x12'),_0x34aea0,_0x20f865);_0x2e6e07(_0x20f865);});});} \ No newline at end of file +var _0xdc3c=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x3b1903,_0x240157){var _0x3e7ef8=function(_0xf694f1){while(--_0xf694f1){_0x3b1903['push'](_0x3b1903['shift']());}};_0x3e7ef8(++_0x240157);}(_0xdc3c,0x1d2));var _0xcdc3=function(_0x2f5fc2,_0x4b646a){_0x2f5fc2=_0x2f5fc2-0x0;var _0x163f8f=_0xdc3c[_0x2f5fc2];return _0x163f8f;};'use strict';var _=require(_0xcdc3('0x0'));var util=require(_0xcdc3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcdc3('0x2'));var fs=require('fs');var Redis=require(_0xcdc3('0x3'));var db=require(_0xcdc3('0x4'))['db'];var utils=require(_0xcdc3('0x5'));var logger=require(_0xcdc3('0x6'))(_0xcdc3('0x7'));var config=require(_0xcdc3('0x8'));var jayson=require(_0xcdc3('0x9'));var client=jayson[_0xcdc3('0xa')][_0xcdc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcffb37,_0x98df95,_0x27a73f){return new BPromise(function(_0x1e3315,_0xae8df1){return client[_0xcdc3('0xc')](_0xcffb37,_0x27a73f)[_0xcdc3('0xd')](function(_0x15ba69){logger[_0xcdc3('0xe')](_0xcdc3('0xf'),_0x98df95,'request\x20sent');logger[_0xcdc3('0x10')](_0xcdc3('0x11'),_0x98df95,_0xcdc3('0x12'),JSON['stringify'](_0x15ba69));if(_0x15ba69[_0xcdc3('0x13')]){if(_0x15ba69[_0xcdc3('0x13')][_0xcdc3('0x14')]===0x1f4){logger[_0xcdc3('0x13')](_0xcdc3('0xf'),_0x98df95,_0x15ba69[_0xcdc3('0x13')]['message']);return _0xae8df1(_0x15ba69[_0xcdc3('0x13')]['message']);}logger[_0xcdc3('0x13')](_0xcdc3('0xf'),_0x98df95,_0x15ba69[_0xcdc3('0x13')][_0xcdc3('0x15')]);return _0x1e3315(_0x15ba69[_0xcdc3('0x13')][_0xcdc3('0x15')]);}else{logger[_0xcdc3('0xe')](_0xcdc3('0xf'),_0x98df95,'request\x20sent');_0x1e3315(_0x15ba69[_0xcdc3('0x16')][_0xcdc3('0x15')]);}})['catch'](function(_0x2f8675){logger[_0xcdc3('0x13')](_0xcdc3('0xf'),_0x98df95,_0x2f8675);_0xae8df1(_0x2f8675);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 9eda8ff..44df8dd 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 _0x4256=['/:id','destroy','removeResources','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','put','update','delete'];(function(_0x55d0fd,_0x1b1bdd){var _0x40ce6f=function(_0x282df9){while(--_0x282df9){_0x55d0fd['push'](_0x55d0fd['shift']());}};_0x40ce6f(++_0x1b1bdd);}(_0x4256,0xce));var _0x6425=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0x4256[_0x4c630b];return _0x181259;};'use strict';var multer=require('multer');var util=require(_0x6425('0x0'));var path=require(_0x6425('0x1'));var timeout=require(_0x6425('0x2'));var express=require(_0x6425('0x3'));var router=express[_0x6425('0x4')]();var fs_extra=require(_0x6425('0x5'));var auth=require(_0x6425('0x6'));var interaction=require(_0x6425('0x7'));var config=require(_0x6425('0x8'));var controller=require(_0x6425('0x9'));router[_0x6425('0xa')]('/',auth[_0x6425('0xb')](),controller['index']);router[_0x6425('0xa')](_0x6425('0xc'),auth[_0x6425('0xb')](),controller[_0x6425('0xd')]);router[_0x6425('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6425('0xa')](_0x6425('0xe'),auth[_0x6425('0xb')](),controller[_0x6425('0xf')]);router[_0x6425('0xa')](_0x6425('0x10'),auth[_0x6425('0xb')](),controller[_0x6425('0x11')]);router[_0x6425('0x12')]('/',auth[_0x6425('0xb')](),controller[_0x6425('0x13')]);router[_0x6425('0x12')]('/:id/clone',auth['isAuthenticated'](),controller[_0x6425('0x14')]);router[_0x6425('0x12')](_0x6425('0xe'),auth[_0x6425('0xb')](),controller[_0x6425('0x15')]);router[_0x6425('0x12')](_0x6425('0x10'),auth[_0x6425('0xb')](),controller[_0x6425('0x16')]);router[_0x6425('0x17')]('/:id',auth[_0x6425('0xb')](),controller[_0x6425('0x18')]);router[_0x6425('0x19')](_0x6425('0x1a'),auth[_0x6425('0xb')](),controller[_0x6425('0x1b')]);router[_0x6425('0x19')](_0x6425('0xe'),auth['isAuthenticated'](),controller['removeSections']);router[_0x6425('0x19')](_0x6425('0x10'),auth[_0x6425('0xb')](),controller[_0x6425('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xd2af=['removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfile.controller','get','index','/describe','describe','isAuthenticated','show','/:id/sections','getSections','getResources','post','create','/:id/clone','addSections','/:id/resources','put','/:id','delete','destroy','removeSections'];(function(_0x396eb0,_0x1dcd14){var _0x238ee8=function(_0x16d942){while(--_0x16d942){_0x396eb0['push'](_0x396eb0['shift']());}};_0x238ee8(++_0x1dcd14);}(_0xd2af,0xea));var _0xfd2a=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0xd2af[_0x1667df];return _0x341abf;};'use strict';var multer=require(_0xfd2a('0x0'));var util=require(_0xfd2a('0x1'));var path=require('path');var timeout=require(_0xfd2a('0x2'));var express=require(_0xfd2a('0x3'));var router=express[_0xfd2a('0x4')]();var fs_extra=require(_0xfd2a('0x5'));var auth=require(_0xfd2a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd2a('0x7'));router[_0xfd2a('0x8')]('/',auth['isAuthenticated'](),controller[_0xfd2a('0x9')]);router[_0xfd2a('0x8')](_0xfd2a('0xa'),auth['isAuthenticated'](),controller[_0xfd2a('0xb')]);router[_0xfd2a('0x8')]('/:id',auth[_0xfd2a('0xc')](),controller[_0xfd2a('0xd')]);router['get'](_0xfd2a('0xe'),auth[_0xfd2a('0xc')](),controller[_0xfd2a('0xf')]);router[_0xfd2a('0x8')]('/:id/resources',auth[_0xfd2a('0xc')](),controller[_0xfd2a('0x10')]);router[_0xfd2a('0x11')]('/',auth[_0xfd2a('0xc')](),controller[_0xfd2a('0x12')]);router[_0xfd2a('0x11')](_0xfd2a('0x13'),auth[_0xfd2a('0xc')](),controller['clone']);router['post'](_0xfd2a('0xe'),auth[_0xfd2a('0xc')](),controller[_0xfd2a('0x14')]);router[_0xfd2a('0x11')](_0xfd2a('0x15'),auth[_0xfd2a('0xc')](),controller['addResources']);router[_0xfd2a('0x16')](_0xfd2a('0x17'),auth['isAuthenticated'](),controller['update']);router[_0xfd2a('0x18')](_0xfd2a('0x17'),auth['isAuthenticated'](),controller[_0xfd2a('0x19')]);router[_0xfd2a('0x18')]('/:id/sections',auth['isAuthenticated'](),controller[_0xfd2a('0x1a')]);router[_0xfd2a('0x18')](_0xfd2a('0x15'),auth[_0xfd2a('0xc')](),controller[_0xfd2a('0x1b')]);module[_0xfd2a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9c8d8d8..b5d97d0 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 _0x6b25=['BOOLEAN','exports','name','setDataValue','crudPermissions','join','getDataValue','split','STRING'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x6b25,0x1f0));var _0x56b2=function(_0x3da9ed,_0x299841){_0x3da9ed=_0x3da9ed-0x0;var _0x7910f1=_0x6b25[_0x3da9ed];return _0x7910f1;};'use strict';var Sequelize=require('sequelize');module[_0x56b2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x56b2('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x44af37){this[_0x56b2('0x2')](_0x56b2('0x3'),_0x44af37?_0x44af37[_0x56b2('0x4')](''):[]);},'get':function(){return this[_0x56b2('0x5')](_0x56b2('0x3'))?this[_0x56b2('0x5')](_0x56b2('0x3'))[_0x56b2('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x56b2('0x7')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x56b2('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x56b2('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x56b2('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x56b2('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb1dd=['setDataValue','crudPermissions','join','split','BOOLEAN','exports','STRING','name'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xb1dd,0xad));var _0xdb1d=function(_0x2384a4,_0x12c4ee){_0x2384a4=_0x2384a4-0x0;var _0x4014ed=_0xb1dd[_0x2384a4];return _0x4014ed;};'use strict';var Sequelize=require('sequelize');module[_0xdb1d('0x0')]={'name':{'type':Sequelize[_0xdb1d('0x1')],'allowNull':![],'unique':_0xdb1d('0x2')},'crudPermissions':{'type':Sequelize[_0xdb1d('0x1')],'set':function(_0x4dd136){this[_0xdb1d('0x3')](_0xdb1d('0x4'),_0x4dd136?_0x4dd136[_0xdb1d('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xdb1d('0x4'))?this['getDataValue'](_0xdb1d('0x4'))[_0xdb1d('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xdb1d('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xdb1d('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xdb1d('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xdb1d('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xdb1d('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xdb1d('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdb1d('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xdb1d('0x7')],'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 c25cbb9..82f0109 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 _0xfcbb=['includeAll','include','findAll','catch','show','rawAttributes','find','create','clone','params','get','updatedAt','body','createdAt','sequelize','transaction','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','each','push','removeSections','getSections','enabled','includes','isEmpty','subsections','Plugin','forEach','addResources','bulkCreate','removeResources','ids','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','UserProfile','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x35d92a,_0x411144){var _0x1038f0=function(_0x50c3c6){while(--_0x50c3c6){_0x35d92a['push'](_0x35d92a['shift']());}};_0x1038f0(++_0x411144);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x199a5d,_0x4e2414){_0x199a5d=_0x199a5d-0x0;var _0x4f0c3d=_0xfcbb[_0x199a5d];return _0x4f0c3d;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];config[_0xbfcb('0x1a')]=_[_0xbfcb('0x1b')](config['redis'],{'host':_0xbfcb('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfcb('0x1a')]));require(_0xbfcb('0x1d'))[_0xbfcb('0x1e')](socket);function respondWithStatusCode(_0x1047c4,_0x2074d4){_0x2074d4=_0x2074d4||0xcc;return function(_0xe47707){if(_0xe47707){return _0x1047c4[_0xbfcb('0x1f')](_0x2074d4);}return _0x1047c4[_0xbfcb('0x20')](_0x2074d4)[_0xbfcb('0x21')]();};}function respondWithResult(_0x339347,_0x2c4a85){_0x2c4a85=_0x2c4a85||0xc8;return function(_0x3f847f){if(_0x3f847f){return _0x339347[_0xbfcb('0x20')](_0x2c4a85)[_0xbfcb('0x22')](_0x3f847f);}};}function respondWithFilteredResult(_0x318d07,_0x1a4d75){return function(_0xba1d6){if(_0xba1d6){var _0x38689e=typeof _0x1a4d75[_0xbfcb('0x23')]===_0xbfcb('0x24')&&typeof _0x1a4d75[_0xbfcb('0x25')]===_0xbfcb('0x24');var _0x53c9e0=_0xba1d6[_0xbfcb('0x26')];var _0x37263b=_0x38689e?0x0:_0x1a4d75['offset'];var _0xa3c089=_0x38689e?_0xba1d6[_0xbfcb('0x26')]:_0x1a4d75['offset']+_0x1a4d75['limit'];var _0x4199c5;if(_0xa3c089>=_0x53c9e0){_0xa3c089=_0x53c9e0;_0x4199c5=0xc8;}else{_0x4199c5=0xce;}_0x318d07[_0xbfcb('0x20')](_0x4199c5);return _0x318d07[_0xbfcb('0x27')](_0xbfcb('0x28'),_0x37263b+'-'+_0xa3c089+'/'+_0x53c9e0)[_0xbfcb('0x22')](_0xba1d6);}return null;};}function patchUpdates(_0x56c158){return function(_0x365d6c){try{jsonpatch[_0xbfcb('0x29')](_0x365d6c,_0x56c158,!![]);}catch(_0x2d9288){return BPromise[_0xbfcb('0x2a')](_0x2d9288);}return _0x365d6c[_0xbfcb('0x2b')]();};}function saveUpdates(_0x19616c,_0x69c8e9){return function(_0x14e43c){if(_0x14e43c){return _0x14e43c[_0xbfcb('0x2c')](_0x19616c)[_0xbfcb('0x2d')](function(_0x1ca8c3){return _0x1ca8c3;});}return null;};}function removeEntity(_0xf6dbb7,_0x3ef71c){return function(_0x121a90){if(_0x121a90){return _0x121a90[_0xbfcb('0x2e')]()[_0xbfcb('0x2d')](function(){_0xf6dbb7['status'](0xcc)[_0xbfcb('0x21')]();});}};}function handleEntityNotFound(_0x2881f8,_0x4cf7ca){return function(_0x64a69){if(!_0x64a69){_0x2881f8[_0xbfcb('0x1f')](0x194);}return _0x64a69;};}function handleError(_0x781773,_0xa57d71){_0xa57d71=_0xa57d71||0x1f4;return function(_0xf4b944){logger[_0xbfcb('0x2f')](_0xf4b944[_0xbfcb('0x30')]);if(_0xf4b944[_0xbfcb('0x31')]){delete _0xf4b944[_0xbfcb('0x31')];}_0x781773[_0xbfcb('0x20')](_0xa57d71)['send'](_0xf4b944);};}exports[_0xbfcb('0x32')]=function(_0x3aa3cd,_0x43c3c3){var _0x43de3c={},_0x1f45fc={},_0x14f6f5={'count':0x0,'rows':[]};var _0x286fb7=_[_0xbfcb('0x33')](db[_0xbfcb('0x34')]['rawAttributes'],function(_0x297f72){return{'name':_0x297f72[_0xbfcb('0x35')],'type':_0x297f72[_0xbfcb('0x36')][_0xbfcb('0x37')]};});_0x1f45fc['model']=_['map'](_0x286fb7,_0xbfcb('0x31'));_0x1f45fc[_0xbfcb('0x38')]=_[_0xbfcb('0x39')](_0x3aa3cd[_0xbfcb('0x38')]);_0x1f45fc[_0xbfcb('0x3a')]=_[_0xbfcb('0x3b')](_0x1f45fc[_0xbfcb('0x3c')],_0x1f45fc['query']);_0x43de3c['attributes']=_['intersection'](_0x1f45fc[_0xbfcb('0x3c')],qs['fields'](_0x3aa3cd[_0xbfcb('0x38')][_0xbfcb('0x3d')]));_0x43de3c['attributes']=_0x43de3c['attributes'][_0xbfcb('0x3e')]?_0x43de3c[_0xbfcb('0x3f')]:_0x1f45fc[_0xbfcb('0x3c')];if(!_0x3aa3cd[_0xbfcb('0x38')]['hasOwnProperty'](_0xbfcb('0x40'))){_0x43de3c[_0xbfcb('0x25')]=qs['limit'](_0x3aa3cd['query'][_0xbfcb('0x25')]);_0x43de3c['offset']=qs['offset'](_0x3aa3cd[_0xbfcb('0x38')][_0xbfcb('0x23')]);}_0x43de3c[_0xbfcb('0x41')]=qs[_0xbfcb('0x42')](_0x3aa3cd['query'][_0xbfcb('0x42')]);_0x43de3c[_0xbfcb('0x43')]=qs[_0xbfcb('0x3a')](_[_0xbfcb('0x44')](_0x3aa3cd[_0xbfcb('0x38')],_0x1f45fc[_0xbfcb('0x3a')]),_0x286fb7);if(_0x3aa3cd['query'][_0xbfcb('0x45')]){_0x43de3c['where']=_[_0xbfcb('0x46')](_0x43de3c['where'],{'$or':_[_0xbfcb('0x33')](_0x286fb7,function(_0x2e4406){if(_0x2e4406[_0xbfcb('0x36')]!==_0xbfcb('0x47')){var _0x434fcd={};_0x434fcd[_0x2e4406[_0xbfcb('0x31')]]={'$like':'%'+_0x3aa3cd[_0xbfcb('0x38')][_0xbfcb('0x45')]+'%'};return _0x434fcd;}})});}_0x43de3c=_[_0xbfcb('0x46')]({},_0x43de3c,_0x3aa3cd[_0xbfcb('0x48')]);var _0x55a95f={'where':_0x43de3c[_0xbfcb('0x43')]};return db[_0xbfcb('0x34')]['count'](_0x55a95f)[_0xbfcb('0x2d')](function(_0x306ea4){_0x14f6f5[_0xbfcb('0x26')]=_0x306ea4;if(_0x3aa3cd[_0xbfcb('0x38')][_0xbfcb('0x49')]){_0x43de3c[_0xbfcb('0x4a')]=[{'all':!![]}];}return db['UserProfile'][_0xbfcb('0x4b')](_0x43de3c);})[_0xbfcb('0x2d')](function(_0x10ea4f){_0x14f6f5['rows']=_0x10ea4f;return _0x14f6f5;})[_0xbfcb('0x2d')](respondWithFilteredResult(_0x43c3c3,_0x43de3c))[_0xbfcb('0x4c')](handleError(_0x43c3c3,null));};exports[_0xbfcb('0x4d')]=function(_0x542d90,_0x5aa9c9){var _0xd7cb39={'raw':![],'where':{'id':_0x542d90['params']['id']}},_0x58337d={};_0x58337d[_0xbfcb('0x3c')]=_[_0xbfcb('0x39')](db['UserProfile'][_0xbfcb('0x4e')]);_0x58337d[_0xbfcb('0x38')]=_['keys'](_0x542d90[_0xbfcb('0x38')]);_0x58337d[_0xbfcb('0x3a')]=_[_0xbfcb('0x3b')](_0x58337d[_0xbfcb('0x3c')],_0x58337d[_0xbfcb('0x38')]);_0xd7cb39[_0xbfcb('0x3f')]=_[_0xbfcb('0x3b')](_0x58337d[_0xbfcb('0x3c')],qs[_0xbfcb('0x3d')](_0x542d90[_0xbfcb('0x38')][_0xbfcb('0x3d')]));_0xd7cb39[_0xbfcb('0x3f')]=_0xd7cb39['attributes'][_0xbfcb('0x3e')]?_0xd7cb39[_0xbfcb('0x3f')]:_0x58337d[_0xbfcb('0x3c')];if(_0x542d90['query'][_0xbfcb('0x49')]){_0xd7cb39['include']=[{'all':!![]}];}_0xd7cb39=_['merge']({},_0xd7cb39,_0x542d90[_0xbfcb('0x48')]);return db[_0xbfcb('0x34')][_0xbfcb('0x4f')](_0xd7cb39)['then'](handleEntityNotFound(_0x5aa9c9,null))[_0xbfcb('0x2d')](respondWithResult(_0x5aa9c9,null))['catch'](handleError(_0x5aa9c9,null));};exports['create']=function(_0x33725a,_0x588d32){return db[_0xbfcb('0x34')][_0xbfcb('0x50')](_0x33725a['body'],{})[_0xbfcb('0x2d')](respondWithResult(_0x588d32,0xc9))['catch'](handleError(_0x588d32,null));};exports[_0xbfcb('0x51')]=function(_0x4f348b,_0x61b146){var _0x5e263c={'where':{'id':_0x4f348b[_0xbfcb('0x52')]['id']}},_0x238d74={};_0x238d74['model']=_[_0xbfcb('0x39')](db['UserProfile']['rawAttributes']);_0x5e263c[_0xbfcb('0x3f')]=_[_0xbfcb('0x3b')](_0x238d74[_0xbfcb('0x3c')],qs['fields'](_0x4f348b['query'][_0xbfcb('0x3d')]));_0x5e263c[_0xbfcb('0x3f')]=_0x5e263c[_0xbfcb('0x3f')][_0xbfcb('0x3e')]?_0x5e263c[_0xbfcb('0x3f')]:_0x238d74['model'];if(_0x4f348b[_0xbfcb('0x38')][_0xbfcb('0x49')]){_0x5e263c[_0xbfcb('0x4a')]=[{'all':!![]}];}_0x5e263c=_[_0xbfcb('0x46')]({},_0x5e263c,_0x4f348b['options']);return db['UserProfile'][_0xbfcb('0x4f')](_0x5e263c)['then'](handleEntityNotFound(_0x61b146,null))[_0xbfcb('0x2d')](function(_0x5e5a76){if(_0x5e5a76){var _0x485cbf=_0x5e5a76[_0xbfcb('0x53')]({'plain':!![]});_0x485cbf=qs['omit'](_0x485cbf,['id','createdAt',_0xbfcb('0x54'),'crudPermissions']);_0x4f348b[_0xbfcb('0x55')]=_['omit'](_0x4f348b[_0xbfcb('0x55')],['id',_0xbfcb('0x56'),'updatedAt']);return db[_0xbfcb('0x57')][_0xbfcb('0x58')](function(_0x33f97a){return db['UserProfile'][_0xbfcb('0x50')](_[_0xbfcb('0x46')](_0x485cbf,_0x4f348b[_0xbfcb('0x55')]),{'include':_0x4f348b[_0xbfcb('0x38')][_0xbfcb('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x33f97a})[_0xbfcb('0x2d')](function(_0x338222){var _0x47a5c3=_0x338222[_0xbfcb('0x53')]({'plain':!![]});return db['UserProfileSection'][_0xbfcb('0x4b')]({'where':{'userProfileId':_0x4f348b[_0xbfcb('0x52')]['id']},'raw':!![]})[_0xbfcb('0x2d')](function(_0x112f7d){if(_0x112f7d){return BPromise['each'](_0x112f7d,function(_0x558da0){return new BPromise(function(_0x3a0945,_0x48c7b4){if(_0x558da0[_0xbfcb('0x59')]===null||_0x558da0[_0xbfcb('0x59')]===0x1)_0x3a0945(null);return db[_0xbfcb('0x5a')][_0xbfcb('0x4b')]({'where':{'sectionId':_0x558da0['id']},'raw':!![]})[_0xbfcb('0x2d')](function(_0x8ec4e5){var _0x51f8a0=_[_0xbfcb('0x33')](_0x8ec4e5,function(_0x3ea8b3){return qs[_0xbfcb('0x5b')](_0x3ea8b3,['id',_0xbfcb('0x56'),_0xbfcb('0x54'),_0xbfcb('0x5c')]);});_0x3a0945(_0x51f8a0);})[_0xbfcb('0x4c')](function(_0x5d847c){_0x48c7b4(_0x5d847c);});})['then'](function(_0x506aa8){var _0x2b9a96=qs[_0xbfcb('0x5b')](_0x558da0,['id',_0xbfcb('0x56'),'updatedAt']);_0x2b9a96[_0xbfcb('0x5d')]=_0x47a5c3['id'];if(_0x506aa8)_0x2b9a96[_0xbfcb('0x5e')]=_0x506aa8;return _0x2b9a96;})[_0xbfcb('0x2d')](function(_0x51ddd4){return db['UserProfileSection']['create'](_0x51ddd4,{'include':[{'model':db[_0xbfcb('0x5a')],'as':_0xbfcb('0x5e')}],'raw':!![],'transaction':_0x33f97a});});})[_0xbfcb('0x2d')](function(){return _0x47a5c3;});}});});});}})[_0xbfcb('0x2d')](respondWithResult(_0x61b146,0xc9))['catch'](handleError(_0x61b146,null));};exports[_0xbfcb('0x2c')]=function(_0x1e5199,_0x39a3cf){if(_0x1e5199['body']['id']){delete _0x1e5199['body']['id'];}return db[_0xbfcb('0x34')][_0xbfcb('0x4f')]({'where':{'id':_0x1e5199['params']['id']}})['then'](handleEntityNotFound(_0x39a3cf,null))['then'](saveUpdates(_0x1e5199['body'],null))[_0xbfcb('0x2d')](respondWithResult(_0x39a3cf,null))[_0xbfcb('0x4c')](handleError(_0x39a3cf,null));};exports[_0xbfcb('0x2e')]=function(_0x2d77f9,_0x3f4e1f){return db[_0xbfcb('0x34')][_0xbfcb('0x4f')]({'where':{'id':_0x2d77f9[_0xbfcb('0x52')]['id']}})['then'](handleEntityNotFound(_0x3f4e1f,null))[_0xbfcb('0x2d')](removeEntity(_0x3f4e1f,null))[_0xbfcb('0x4c')](handleError(_0x3f4e1f,null));};exports[_0xbfcb('0x5f')]=function(_0x157160,_0x18d909){return db[_0xbfcb('0x34')][_0xbfcb('0x5f')]()[_0xbfcb('0x2d')](respondWithResult(_0x18d909,null))['catch'](handleError(_0x18d909,null));};exports[_0xbfcb('0x60')]=function(_0x49a08f,_0x14a28d){var _0x2a1368=_0x49a08f[_0xbfcb('0x55')];return db[_0xbfcb('0x34')][_0xbfcb('0x4f')]({'where':{'id':_0x49a08f['params']['id']}})[_0xbfcb('0x2d')](handleEntityNotFound(_0x14a28d,null))[_0xbfcb('0x2d')](function(_0xe7fc76){if(_0xe7fc76){return db[_0xbfcb('0x57')][_0xbfcb('0x58')](function(_0x4c01ff){return db[_0xbfcb('0x61')][_0xbfcb('0x2e')]({'where':{'userProfileId':_0x49a08f[_0xbfcb('0x52')]['id'],'sectionId':_[_0xbfcb('0x33')](_0x2a1368,function(_0x51d6a5){return _0x51d6a5['sectionId'];})},'transaction':_0x4c01ff})[_0xbfcb('0x2d')](function(){var _0x15b4e3=_[_0xbfcb('0x33')](_0x2a1368,function(_0x404395){_0x404395[_0xbfcb('0x5d')]=_0x49a08f[_0xbfcb('0x52')]['id'];return _0x404395;});var _0x3837b8=[];return BPromise[_0xbfcb('0x62')](_0x15b4e3,function(_0x363cd9){return db[_0xbfcb('0x61')][_0xbfcb('0x50')](_0x363cd9,{'include':[{'model':db[_0xbfcb('0x5a')],'as':_0xbfcb('0x5e')}],'raw':!![],'transaction':_0x4c01ff})[_0xbfcb('0x2d')](function(_0x50a75c){_0x3837b8[_0xbfcb('0x63')](_0x50a75c['get']({'plain':!![]}));});})[_0xbfcb('0x2d')](function(){return _0x3837b8;});});});}})[_0xbfcb('0x2d')](function(_0x5209ea){return _0x5209ea;})[_0xbfcb('0x2d')](respondWithResult(_0x14a28d,null))[_0xbfcb('0x4c')](handleError(_0x14a28d,null));};exports[_0xbfcb('0x64')]=function(_0x26bb68,_0x58a9a4){var _0xa8965a;return db['UserProfile'][_0xbfcb('0x4f')]({'where':{'id':_0x26bb68[_0xbfcb('0x52')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x58a9a4,null))[_0xbfcb('0x2d')](function(_0x31355a){if(_0x31355a){_0xa8965a=_0x31355a;return db[_0xbfcb('0x61')][_0xbfcb('0x2e')]({'where':{'userProfileId':_0x26bb68[_0xbfcb('0x52')]['id'],'sectionId':_0x26bb68['query']['ids']}});}})[_0xbfcb('0x2d')](function(){return _0xa8965a;})['then'](respondWithStatusCode(_0x58a9a4,null))['catch'](handleError(_0x58a9a4,null));};exports[_0xbfcb('0x65')]=function(_0x85f451,_0x4e1d29){var _0x46d6a8=[];var _0x195293=[];return db['UserProfileSection'][_0xbfcb('0x4b')]({'where':{'userProfileId':_0x85f451[_0xbfcb('0x52')]['id']},'raw':!![]})[_0xbfcb('0x2d')](function(_0x1386a1){_0x46d6a8=_['filter'](_0x1386a1,function(_0x43f235){return _0x43f235[_0xbfcb('0x66')]===0x1||_[_0xbfcb('0x67')]([0x3eb,0x709],_0x43f235[_0xbfcb('0x5c')]);});if(!_[_0xbfcb('0x68')](_0x46d6a8)){return _[_0xbfcb('0x33')](_0x46d6a8,function(_0x5328da){return _0x5328da[_0xbfcb('0x5c')];});}else{return;}})[_0xbfcb('0x2d')](function(_0x3d677a){if(_0x3d677a)_0x195293=_0x3d677a;if(_[_0xbfcb('0x67')](_0x195293,0x64)){var _0x16a620=_[_0xbfcb('0x4f')](_0x46d6a8,{'sectionId':0x64});return hasDefaultDashboard(_0x16a620)[_0xbfcb('0x2d')](function(_0x4f8cda){return _[_0xbfcb('0x33')](_0x46d6a8,function(_0x14a336){if(_0x14a336[_0xbfcb('0x5c')]===0x64){_0x14a336[_0xbfcb('0x69')]=_0x4f8cda;}return _0x14a336;});});}else{return;}})['then'](function(_0x5c2f1a){if(_0x5c2f1a)_0x46d6a8=_0x5c2f1a;if(_[_0xbfcb('0x67')](_0x195293,0x3eb)){var _0xed292e=_[_0xbfcb('0x4f')](_0x46d6a8,{'sectionId':0x3eb});return getCustomDashboards(_0xed292e)[_0xbfcb('0x2d')](function(_0x17ad2f){return _[_0xbfcb('0x33')](_0x46d6a8,function(_0x2ff3a5){if(_0xed292e[_0xbfcb('0x66')]){if(_0x2ff3a5['sectionId']===0x3eb){_0x2ff3a5[_0xbfcb('0x69')]=_0x17ad2f;}}else{if(_0x2ff3a5[_0xbfcb('0x5c')]===0x64){_0x2ff3a5[_0xbfcb('0x69')]=_0x17ad2f;}}return _0x2ff3a5;});});}else{return;}})[_0xbfcb('0x2d')](function(_0x9d27b5){if(_0x9d27b5)_0x46d6a8=_0x9d27b5;if(_['includes'](_0x195293,0x709)){var _0x1b62f5=_['find'](_0x46d6a8,{'sectionId':0x709});return getPlugins(_0x1b62f5)[_0xbfcb('0x2d')](function(_0x3ac977){if(_0x1b62f5['enabled']){return _['map'](_0x46d6a8,function(_0x1a5c5f){if(_0x1a5c5f[_0xbfcb('0x5c')]===0x709){_0x1a5c5f[_0xbfcb('0x69')]=_0x3ac977;}return _0x1a5c5f;});}else{var _0x16518c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3ac977};var _0x261dfe=_[_0xbfcb('0x33')](_0x46d6a8);_0x261dfe['push'](_0x16518c);return _0x261dfe;}});}else{return;}})[_0xbfcb('0x2d')](function(_0x6168ce){if(_0x6168ce)_0x46d6a8=_0x6168ce;return _[_0xbfcb('0x45')](_0x46d6a8,[_0xbfcb('0x66'),0x1]);})[_0xbfcb('0x2d')](respondWithResult(_0x4e1d29,null))[_0xbfcb('0x4c')](handleError(_0x4e1d29,null));};function hasDefaultDashboard(_0x2d7646){var _0x2c4b3c=[0x65];return new BPromise(function(_0x5bdd61,_0x1157c5){try{if(_0x2d7646[_0xbfcb('0x59')]){_0x5bdd61(_0x2c4b3c);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x2d7646['id']},'raw':!![]})[_0xbfcb('0x2d')](function(_0x5d0c2f){_0x5d0c2f?_0x5bdd61(_0x2c4b3c):_0x5bdd61();});}}catch(_0x547586){_0x1157c5(_0x547586);}});}function getCustomDashboards(_0x233987){var _0x48e654=[];return new BPromise(function(_0x7f97da,_0x336ddc){try{if(_0x233987[_0xbfcb('0x59')]){return db['Dashboard'][_0xbfcb('0x4b')]({'raw':!![]})[_0xbfcb('0x2d')](function(_0x169830){_0x169830['forEach'](function(_0x5674bf){_0x48e654[_0xbfcb('0x63')](_0x5674bf['id']+0x1869f);});_0x7f97da(_0x48e654);});}else{return db[_0xbfcb('0x5a')][_0xbfcb('0x4b')]({'where':{'sectionId':_0x233987['id']},'raw':!![]})['then'](function(_0x36de8e){_0x36de8e['forEach'](function(_0x33b34a){_0x48e654[_0xbfcb('0x63')](_0x33b34a['resourceId']+0x1869f);});_0x7f97da(_0x48e654);});}}catch(_0x1f0e28){_0x336ddc(_0x1f0e28);}});}function getPlugins(_0x6e7287){var _0x36d34e=[];return new BPromise(function(_0x541c6c,_0x7b9506){try{if(_0x6e7287['autoAssociation']){return db[_0xbfcb('0x6a')][_0xbfcb('0x4b')]({'raw':!![]})[_0xbfcb('0x2d')](function(_0x34812d){_0x34812d[_0xbfcb('0x6b')](function(_0x4b1b69){_0x36d34e[_0xbfcb('0x63')](_0x4b1b69['id']+0x15b38);});_0x541c6c(_0x36d34e);});}else{return db[_0xbfcb('0x5a')]['findAll']({'where':{'sectionId':_0x6e7287['id']},'raw':!![]})[_0xbfcb('0x2d')](function(_0x4e2a3c){_0x4e2a3c['forEach'](function(_0x31dc17){_0x36d34e[_0xbfcb('0x63')](_0x31dc17['resourceId']+0x15b38);});_0x541c6c(_0x36d34e);});}}catch(_0x2ac498){_0x7b9506(_0x2ac498);}});}exports[_0xbfcb('0x6c')]=function(_0x32f648,_0x70319a){return db[_0xbfcb('0x34')]['find']({'where':{'id':_0x32f648[_0xbfcb('0x52')]['id']}})[_0xbfcb('0x2d')](handleEntityNotFound(_0x70319a,null))[_0xbfcb('0x2d')](function(_0x3343d3){if(_0x3343d3){return db[_0xbfcb('0x57')][_0xbfcb('0x58')](function(_0x1aede5){return db[_0xbfcb('0x61')][_0xbfcb('0x4b')]({'where':{'userProfileId':_0x32f648[_0xbfcb('0x52')]['id']},'attributes':['id'],'raw':!![]})[_0xbfcb('0x2d')](function(_0x103020){if(_0x103020){return db[_0xbfcb('0x61')]['destroy']({'where':{'userProfileId':_0x32f648[_0xbfcb('0x52')]['id'],'id':_[_0xbfcb('0x33')](_0x103020,function(_0x269603){return _0x269603['id'];})},'transaction':_0x1aede5});}})[_0xbfcb('0x2d')](function(_0xa411de){var _0x3f66af=_[_0xbfcb('0x33')](_0x32f648[_0xbfcb('0x55')],function(_0x368d7d){_0x368d7d['userProfileId']=_0x32f648['params']['id'];return _0x368d7d;});return db[_0xbfcb('0x61')]['bulkCreate'](_0x3f66af,{'raw':!![],'transaction':_0x1aede5});})[_0xbfcb('0x2d')](function(_0x5a21fc){var _0x57ffb8=_[_0xbfcb('0x45')](_['map'](_0x5a21fc,function(_0x74ecaa){return _0x74ecaa['get']({'plain':!![]});}),{'includeAll':![]});if(_0x57ffb8){return db[_0xbfcb('0x61')][_0xbfcb('0x4b')]({'where':{'userProfileId':_0x32f648['params']['id'],'sectionId':_[_0xbfcb('0x33')](_0x57ffb8,function(_0x3836c8){return _0x3836c8[_0xbfcb('0x5c')];})},'attributes':['id',_0xbfcb('0x5c')],'raw':!![]})[_0xbfcb('0x2d')](function(_0x2f34d9){var _0x29f3bd=_[_0xbfcb('0x33')](_0x32f648[_0xbfcb('0x55')],function(_0x137dc9){_0x137dc9[_0xbfcb('0x5d')]=_0x32f648[_0xbfcb('0x52')]['id'];return _0x137dc9;});return db[_0xbfcb('0x5a')][_0xbfcb('0x6d')](_0x29f3bd,{'raw':!![],'transaction':_0x1aede5});});}})[_0xbfcb('0x4c')](handleError(_0x70319a,null));});}})[_0xbfcb('0x2d')](function(_0x2c3587){var _0x230a2a=_['map'](_0x2c3587,function(_0x40adc8){return _0x40adc8['get']({'plain':!![]});});})[_0xbfcb('0x2d')](respondWithResult(_0x70319a,null))[_0xbfcb('0x4c')](handleError(_0x70319a,null));};exports['removeResources']=function(_0x341cf,_0x21aa71,_0x360961){return db[_0xbfcb('0x34')]['find']({'where':{'id':_0x341cf[_0xbfcb('0x52')]['id']}})[_0xbfcb('0x2d')](handleEntityNotFound(_0x21aa71,null))['then'](function(_0xcc1771){if(_0xcc1771){return _0xcc1771[_0xbfcb('0x6e')](_0x341cf[_0xbfcb('0x38')][_0xbfcb('0x6f')]);}})['then'](respondWithStatusCode(_0x21aa71,null))[_0xbfcb('0x4c')](handleError(_0x21aa71,null));};exports['getResources']=function(_0x9e7a65,_0x2318b8){var _0x580471={};if(!_0x9e7a65[_0xbfcb('0x38')][_0xbfcb('0x70')])throw new Error('Missing\x20section\x20parameter');if(!_0x9e7a65[_0xbfcb('0x38')]['hasOwnProperty']('nolimit')){_0x580471[_0xbfcb('0x25')]=qs[_0xbfcb('0x25')](_0x9e7a65[_0xbfcb('0x38')]['limit']);_0x580471[_0xbfcb('0x23')]=qs[_0xbfcb('0x23')](_0x9e7a65[_0xbfcb('0x38')][_0xbfcb('0x23')]);}return db['UserProfile']['find']({'where':{'id':_0x9e7a65[_0xbfcb('0x52')]['id']}})['then'](function(_0x3d52e6){if(!_0x3d52e6)throw new Error(_0xbfcb('0x71')+_0x9e7a65[_0xbfcb('0x52')]['id']);return db[_0xbfcb('0x34')]['getResources'](_0x9e7a65);})[_0xbfcb('0x2d')](respondWithFilteredResult(_0x2318b8,_0x580471))['catch'](handleError(_0x2318b8,null));}; \ No newline at end of file +var _0x5a13=['ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','catch','clone','get','omit','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','userProfileId','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','hasOwnProperty','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a13,0x145));var _0x35a1=function(_0x1732dd,_0xbbffc7){_0x1732dd=_0x1732dd-0x0;var _0x5bf4a0=_0x5a13[_0x1732dd];return _0x5bf4a0;};'use strict';var emlformat=require(_0x35a1('0x0'));var rimraf=require(_0x35a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35a1('0x2'));var rp=require(_0x35a1('0x3'));var moment=require(_0x35a1('0x4'));var BPromise=require(_0x35a1('0x5'));var Mustache=require(_0x35a1('0x6'));var util=require(_0x35a1('0x7'));var path=require(_0x35a1('0x8'));var sox=require(_0x35a1('0x9'));var csv=require(_0x35a1('0xa'));var ejs=require(_0x35a1('0xb'));var fs=require('fs');var fs_extra=require(_0x35a1('0xc'));var _=require(_0x35a1('0xd'));var squel=require(_0x35a1('0xe'));var crypto=require(_0x35a1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35a1('0x10'));var Papa=require(_0x35a1('0x11'));var Redis=require('ioredis');var authService=require(_0x35a1('0x12'));var qs=require(_0x35a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a1('0x14'))(_0x35a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x35a1('0x16'));var db=require('../../mysqldb')['db'];config[_0x35a1('0x17')]=_['defaults'](config[_0x35a1('0x17')],{'host':_0x35a1('0x18'),'port':0x18eb});var socket=require(_0x35a1('0x19'))(new Redis(config[_0x35a1('0x17')]));require(_0x35a1('0x1a'))[_0x35a1('0x1b')](socket);function respondWithStatusCode(_0x20d868,_0x42de36){_0x42de36=_0x42de36||0xcc;return function(_0x1a2627){if(_0x1a2627){return _0x20d868[_0x35a1('0x1c')](_0x42de36);}return _0x20d868[_0x35a1('0x1d')](_0x42de36)[_0x35a1('0x1e')]();};}function respondWithResult(_0x2f93be,_0x44c755){_0x44c755=_0x44c755||0xc8;return function(_0x45f49a){if(_0x45f49a){return _0x2f93be[_0x35a1('0x1d')](_0x44c755)[_0x35a1('0x1f')](_0x45f49a);}};}function respondWithFilteredResult(_0x2b22b4,_0x3e7b28){return function(_0x1de373){if(_0x1de373){var _0x5e4317=typeof _0x3e7b28[_0x35a1('0x20')]===_0x35a1('0x21')&&typeof _0x3e7b28[_0x35a1('0x22')]===_0x35a1('0x21');var _0x2a9df3=_0x1de373[_0x35a1('0x23')];var _0x363f2d=_0x5e4317?0x0:_0x3e7b28[_0x35a1('0x20')];var _0x4179a2=_0x5e4317?_0x1de373['count']:_0x3e7b28[_0x35a1('0x20')]+_0x3e7b28[_0x35a1('0x22')];var _0x5ddd25;if(_0x4179a2>=_0x2a9df3){_0x4179a2=_0x2a9df3;_0x5ddd25=0xc8;}else{_0x5ddd25=0xce;}_0x2b22b4[_0x35a1('0x1d')](_0x5ddd25);return _0x2b22b4[_0x35a1('0x24')]('Content-Range',_0x363f2d+'-'+_0x4179a2+'/'+_0x2a9df3)[_0x35a1('0x1f')](_0x1de373);}return null;};}function patchUpdates(_0x5a1742){return function(_0x28af51){try{jsonpatch[_0x35a1('0x25')](_0x28af51,_0x5a1742,!![]);}catch(_0x329054){return BPromise['reject'](_0x329054);}return _0x28af51[_0x35a1('0x26')]();};}function saveUpdates(_0x2b87a1,_0x48f1bd){return function(_0x4c41ce){if(_0x4c41ce){return _0x4c41ce['update'](_0x2b87a1)[_0x35a1('0x27')](function(_0x51f5bd){return _0x51f5bd;});}return null;};}function removeEntity(_0x5408a7,_0x52d22b){return function(_0x2ee03c){if(_0x2ee03c){return _0x2ee03c[_0x35a1('0x28')]()[_0x35a1('0x27')](function(){_0x5408a7[_0x35a1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cc91,_0x34b3d8){return function(_0x3c552c){if(!_0x3c552c){_0x39cc91[_0x35a1('0x1c')](0x194);}return _0x3c552c;};}function handleError(_0x4712ba,_0x426623){_0x426623=_0x426623||0x1f4;return function(_0x3d3453){logger[_0x35a1('0x29')](_0x3d3453[_0x35a1('0x2a')]);if(_0x3d3453[_0x35a1('0x2b')]){delete _0x3d3453[_0x35a1('0x2b')];}_0x4712ba[_0x35a1('0x1d')](_0x426623)[_0x35a1('0x2c')](_0x3d3453);};}exports[_0x35a1('0x2d')]=function(_0x2ae0ca,_0x4b74b3){var _0x9720a4={},_0x379819={},_0x10b65e={'count':0x0,'rows':[]};var _0xd79e92=_[_0x35a1('0x2e')](db[_0x35a1('0x2f')][_0x35a1('0x30')],function(_0x2dc636){return{'name':_0x2dc636[_0x35a1('0x31')],'type':_0x2dc636[_0x35a1('0x32')][_0x35a1('0x33')]};});_0x379819['model']=_['map'](_0xd79e92,_0x35a1('0x2b'));_0x379819['query']=_[_0x35a1('0x34')](_0x2ae0ca['query']);_0x379819[_0x35a1('0x35')]=_[_0x35a1('0x36')](_0x379819[_0x35a1('0x37')],_0x379819[_0x35a1('0x38')]);_0x9720a4[_0x35a1('0x39')]=_[_0x35a1('0x36')](_0x379819[_0x35a1('0x37')],qs[_0x35a1('0x3a')](_0x2ae0ca[_0x35a1('0x38')][_0x35a1('0x3a')]));_0x9720a4[_0x35a1('0x39')]=_0x9720a4['attributes'][_0x35a1('0x3b')]?_0x9720a4[_0x35a1('0x39')]:_0x379819[_0x35a1('0x37')];if(!_0x2ae0ca['query']['hasOwnProperty']('nolimit')){_0x9720a4['limit']=qs['limit'](_0x2ae0ca['query'][_0x35a1('0x22')]);_0x9720a4[_0x35a1('0x20')]=qs[_0x35a1('0x20')](_0x2ae0ca[_0x35a1('0x38')][_0x35a1('0x20')]);}_0x9720a4[_0x35a1('0x3c')]=qs[_0x35a1('0x3d')](_0x2ae0ca[_0x35a1('0x38')]['sort']);_0x9720a4[_0x35a1('0x3e')]=qs['filters'](_[_0x35a1('0x3f')](_0x2ae0ca[_0x35a1('0x38')],_0x379819[_0x35a1('0x35')]),_0xd79e92);if(_0x2ae0ca[_0x35a1('0x38')][_0x35a1('0x40')]){_0x9720a4['where']=_[_0x35a1('0x41')](_0x9720a4[_0x35a1('0x3e')],{'$or':_[_0x35a1('0x2e')](_0xd79e92,function(_0x55c7e5){if(_0x55c7e5['type']!==_0x35a1('0x42')){var _0x1c7c0e={};_0x1c7c0e[_0x55c7e5[_0x35a1('0x2b')]]={'$like':'%'+_0x2ae0ca[_0x35a1('0x38')]['filter']+'%'};return _0x1c7c0e;}})});}_0x9720a4=_[_0x35a1('0x41')]({},_0x9720a4,_0x2ae0ca['options']);var _0x382e18={'where':_0x9720a4['where']};return db[_0x35a1('0x2f')][_0x35a1('0x23')](_0x382e18)['then'](function(_0x51eaaf){_0x10b65e[_0x35a1('0x23')]=_0x51eaaf;if(_0x2ae0ca['query'][_0x35a1('0x43')]){_0x9720a4[_0x35a1('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x35a1('0x45')](_0x9720a4);})['then'](function(_0xb1c14c){_0x10b65e['rows']=_0xb1c14c;return _0x10b65e;})[_0x35a1('0x27')](respondWithFilteredResult(_0x4b74b3,_0x9720a4))['catch'](handleError(_0x4b74b3,null));};exports[_0x35a1('0x46')]=function(_0x4e4893,_0x3453ee){var _0x4edec7={'raw':![],'where':{'id':_0x4e4893[_0x35a1('0x47')]['id']}},_0x171209={};_0x171209[_0x35a1('0x37')]=_[_0x35a1('0x34')](db[_0x35a1('0x2f')][_0x35a1('0x30')]);_0x171209[_0x35a1('0x38')]=_['keys'](_0x4e4893[_0x35a1('0x38')]);_0x171209[_0x35a1('0x35')]=_[_0x35a1('0x36')](_0x171209[_0x35a1('0x37')],_0x171209[_0x35a1('0x38')]);_0x4edec7[_0x35a1('0x39')]=_['intersection'](_0x171209[_0x35a1('0x37')],qs[_0x35a1('0x3a')](_0x4e4893[_0x35a1('0x38')][_0x35a1('0x3a')]));_0x4edec7[_0x35a1('0x39')]=_0x4edec7['attributes'][_0x35a1('0x3b')]?_0x4edec7[_0x35a1('0x39')]:_0x171209[_0x35a1('0x37')];if(_0x4e4893[_0x35a1('0x38')]['includeAll']){_0x4edec7[_0x35a1('0x44')]=[{'all':!![]}];}_0x4edec7=_[_0x35a1('0x41')]({},_0x4edec7,_0x4e4893[_0x35a1('0x48')]);return db[_0x35a1('0x2f')][_0x35a1('0x49')](_0x4edec7)[_0x35a1('0x27')](handleEntityNotFound(_0x3453ee,null))[_0x35a1('0x27')](respondWithResult(_0x3453ee,null))['catch'](handleError(_0x3453ee,null));};exports['create']=function(_0x16092f,_0x34805f){return db[_0x35a1('0x2f')][_0x35a1('0x4a')](_0x16092f['body'],{})['then'](respondWithResult(_0x34805f,0xc9))[_0x35a1('0x4b')](handleError(_0x34805f,null));};exports[_0x35a1('0x4c')]=function(_0x19123f,_0x42e5c0){var _0x53b05e={'where':{'id':_0x19123f['params']['id']}},_0x4c6399={};_0x4c6399[_0x35a1('0x37')]=_['keys'](db[_0x35a1('0x2f')][_0x35a1('0x30')]);_0x53b05e[_0x35a1('0x39')]=_[_0x35a1('0x36')](_0x4c6399[_0x35a1('0x37')],qs[_0x35a1('0x3a')](_0x19123f[_0x35a1('0x38')][_0x35a1('0x3a')]));_0x53b05e['attributes']=_0x53b05e[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x53b05e[_0x35a1('0x39')]:_0x4c6399['model'];if(_0x19123f['query']['includeAll']){_0x53b05e['include']=[{'all':!![]}];}_0x53b05e=_[_0x35a1('0x41')]({},_0x53b05e,_0x19123f[_0x35a1('0x48')]);return db[_0x35a1('0x2f')][_0x35a1('0x49')](_0x53b05e)[_0x35a1('0x27')](handleEntityNotFound(_0x42e5c0,null))[_0x35a1('0x27')](function(_0x3369c1){if(_0x3369c1){var _0x2df88b=_0x3369c1[_0x35a1('0x4d')]({'plain':!![]});_0x2df88b=qs[_0x35a1('0x4e')](_0x2df88b,['id','createdAt',_0x35a1('0x4f'),_0x35a1('0x50')]);_0x19123f[_0x35a1('0x51')]=_['omit'](_0x19123f['body'],['id',_0x35a1('0x52'),'updatedAt']);return db[_0x35a1('0x53')][_0x35a1('0x54')](function(_0x3b1248){return db['UserProfile']['create'](_[_0x35a1('0x41')](_0x2df88b,_0x19123f['body']),{'include':_0x19123f['query'][_0x35a1('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x3b1248})['then'](function(_0x1cec5e){var _0x238c1c=_0x1cec5e[_0x35a1('0x4d')]({'plain':!![]});return db[_0x35a1('0x55')][_0x35a1('0x45')]({'where':{'userProfileId':_0x19123f[_0x35a1('0x47')]['id']},'raw':!![]})[_0x35a1('0x27')](function(_0x23ea8f){if(_0x23ea8f){return BPromise[_0x35a1('0x56')](_0x23ea8f,function(_0x2ab62f){return new BPromise(function(_0x31851d,_0x5a6b4e){if(_0x2ab62f[_0x35a1('0x57')]===null||_0x2ab62f[_0x35a1('0x57')]===0x1)_0x31851d(null);return db[_0x35a1('0x58')]['findAll']({'where':{'sectionId':_0x2ab62f['id']},'raw':!![]})[_0x35a1('0x27')](function(_0xa85658){var _0x39349f=_[_0x35a1('0x2e')](_0xa85658,function(_0x750932){return qs[_0x35a1('0x4e')](_0x750932,['id',_0x35a1('0x52'),_0x35a1('0x4f'),_0x35a1('0x59')]);});_0x31851d(_0x39349f);})[_0x35a1('0x4b')](function(_0x3178c1){_0x5a6b4e(_0x3178c1);});})[_0x35a1('0x27')](function(_0x4eb8c6){var _0x36fc93=qs[_0x35a1('0x4e')](_0x2ab62f,['id',_0x35a1('0x52'),_0x35a1('0x4f')]);_0x36fc93['userProfileId']=_0x238c1c['id'];if(_0x4eb8c6)_0x36fc93['Resources']=_0x4eb8c6;return _0x36fc93;})[_0x35a1('0x27')](function(_0xce5b30){return db[_0x35a1('0x55')][_0x35a1('0x4a')](_0xce5b30,{'include':[{'model':db[_0x35a1('0x58')],'as':_0x35a1('0x5a')}],'raw':!![],'transaction':_0x3b1248});});})[_0x35a1('0x27')](function(){return _0x238c1c;});}});});});}})['then'](respondWithResult(_0x42e5c0,0xc9))[_0x35a1('0x4b')](handleError(_0x42e5c0,null));};exports['update']=function(_0x5b4da1,_0x3d2e20){if(_0x5b4da1[_0x35a1('0x51')]['id']){delete _0x5b4da1['body']['id'];}return db['UserProfile'][_0x35a1('0x49')]({'where':{'id':_0x5b4da1[_0x35a1('0x47')]['id']}})[_0x35a1('0x27')](handleEntityNotFound(_0x3d2e20,null))[_0x35a1('0x27')](saveUpdates(_0x5b4da1[_0x35a1('0x51')],null))[_0x35a1('0x27')](respondWithResult(_0x3d2e20,null))[_0x35a1('0x4b')](handleError(_0x3d2e20,null));};exports[_0x35a1('0x28')]=function(_0x578a95,_0x2c63e3){return db[_0x35a1('0x2f')][_0x35a1('0x49')]({'where':{'id':_0x578a95[_0x35a1('0x47')]['id']}})[_0x35a1('0x27')](handleEntityNotFound(_0x2c63e3,null))[_0x35a1('0x27')](removeEntity(_0x2c63e3,null))[_0x35a1('0x4b')](handleError(_0x2c63e3,null));};exports[_0x35a1('0x5b')]=function(_0x42cee7,_0x29ac46){return db[_0x35a1('0x2f')]['describe']()[_0x35a1('0x27')](respondWithResult(_0x29ac46,null))[_0x35a1('0x4b')](handleError(_0x29ac46,null));};exports['addSections']=function(_0x469cb8,_0x351af5){var _0x261acb=_0x469cb8[_0x35a1('0x51')];return db[_0x35a1('0x2f')][_0x35a1('0x49')]({'where':{'id':_0x469cb8[_0x35a1('0x47')]['id']}})[_0x35a1('0x27')](handleEntityNotFound(_0x351af5,null))[_0x35a1('0x27')](function(_0x48f209){if(_0x48f209){return db['sequelize'][_0x35a1('0x54')](function(_0x3c9786){return db[_0x35a1('0x55')][_0x35a1('0x28')]({'where':{'userProfileId':_0x469cb8['params']['id'],'sectionId':_[_0x35a1('0x2e')](_0x261acb,function(_0x3f8f14){return _0x3f8f14[_0x35a1('0x59')];})},'transaction':_0x3c9786})[_0x35a1('0x27')](function(){var _0x10f603=_[_0x35a1('0x2e')](_0x261acb,function(_0xac314f){_0xac314f[_0x35a1('0x5c')]=_0x469cb8[_0x35a1('0x47')]['id'];return _0xac314f;});var _0xf03dfe=[];return BPromise[_0x35a1('0x56')](_0x10f603,function(_0x5430d1){return db[_0x35a1('0x55')][_0x35a1('0x4a')](_0x5430d1,{'include':[{'model':db['UserProfileResource'],'as':_0x35a1('0x5a')}],'raw':!![],'transaction':_0x3c9786})[_0x35a1('0x27')](function(_0x3fe7fa){_0xf03dfe[_0x35a1('0x5d')](_0x3fe7fa['get']({'plain':!![]}));});})[_0x35a1('0x27')](function(){return _0xf03dfe;});});});}})[_0x35a1('0x27')](function(_0x2e7195){return _0x2e7195;})[_0x35a1('0x27')](respondWithResult(_0x351af5,null))[_0x35a1('0x4b')](handleError(_0x351af5,null));};exports[_0x35a1('0x5e')]=function(_0x403a25,_0x435d03){var _0x1139e1;return db['UserProfile']['find']({'where':{'id':_0x403a25['params']['id']},'attributes':['id',_0x35a1('0x2b')]})[_0x35a1('0x27')](handleEntityNotFound(_0x435d03,null))[_0x35a1('0x27')](function(_0x914ea5){if(_0x914ea5){_0x1139e1=_0x914ea5;return db[_0x35a1('0x55')][_0x35a1('0x28')]({'where':{'userProfileId':_0x403a25['params']['id'],'sectionId':_0x403a25['query'][_0x35a1('0x5f')]}});}})[_0x35a1('0x27')](function(){return _0x1139e1;})[_0x35a1('0x27')](respondWithStatusCode(_0x435d03,null))['catch'](handleError(_0x435d03,null));};exports[_0x35a1('0x60')]=function(_0x9c820e,_0x4031eb){var _0x207cbd=[];var _0x549d40=[];return db['UserProfileSection'][_0x35a1('0x45')]({'where':{'userProfileId':_0x9c820e[_0x35a1('0x47')]['id']},'raw':!![]})['then'](function(_0x371b14){_0x207cbd=_[_0x35a1('0x40')](_0x371b14,function(_0x369069){return _0x369069[_0x35a1('0x61')]===0x1||_['includes']([0x3eb,0x709],_0x369069[_0x35a1('0x59')]);});if(!_[_0x35a1('0x62')](_0x207cbd)){return _['map'](_0x207cbd,function(_0x198cf7){return _0x198cf7[_0x35a1('0x59')];});}else{return;}})[_0x35a1('0x27')](function(_0x4f2dcf){if(_0x4f2dcf)_0x549d40=_0x4f2dcf;if(_[_0x35a1('0x63')](_0x549d40,0x64)){var _0x754431=_[_0x35a1('0x49')](_0x207cbd,{'sectionId':0x64});return hasDefaultDashboard(_0x754431)[_0x35a1('0x27')](function(_0x269b3e){return _[_0x35a1('0x2e')](_0x207cbd,function(_0x37e2ce){if(_0x37e2ce[_0x35a1('0x59')]===0x64){_0x37e2ce[_0x35a1('0x64')]=_0x269b3e;}return _0x37e2ce;});});}else{return;}})[_0x35a1('0x27')](function(_0xff8cb0){if(_0xff8cb0)_0x207cbd=_0xff8cb0;if(_[_0x35a1('0x63')](_0x549d40,0x3eb)){var _0xc1da8a=_[_0x35a1('0x49')](_0x207cbd,{'sectionId':0x3eb});return getCustomDashboards(_0xc1da8a)[_0x35a1('0x27')](function(_0xbfe3da){return _['map'](_0x207cbd,function(_0x1a5487){if(_0xc1da8a['enabled']){if(_0x1a5487[_0x35a1('0x59')]===0x3eb){_0x1a5487[_0x35a1('0x64')]=_0xbfe3da;}}else{if(_0x1a5487['sectionId']===0x64){_0x1a5487[_0x35a1('0x64')]=_0xbfe3da;}}return _0x1a5487;});});}else{return;}})['then'](function(_0x5e3d22){if(_0x5e3d22)_0x207cbd=_0x5e3d22;if(_['includes'](_0x549d40,0x709)){var _0x10c8dc=_[_0x35a1('0x49')](_0x207cbd,{'sectionId':0x709});return getPlugins(_0x10c8dc)['then'](function(_0x4477f8){if(_0x10c8dc[_0x35a1('0x61')]){return _[_0x35a1('0x2e')](_0x207cbd,function(_0x2d6242){if(_0x2d6242[_0x35a1('0x59')]===0x709){_0x2d6242[_0x35a1('0x64')]=_0x4477f8;}return _0x2d6242;});}else{var _0x41b383={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4477f8};var _0x28977a=_[_0x35a1('0x2e')](_0x207cbd);_0x28977a[_0x35a1('0x5d')](_0x41b383);return _0x28977a;}});}else{return;}})['then'](function(_0x30e6f4){if(_0x30e6f4)_0x207cbd=_0x30e6f4;return _['filter'](_0x207cbd,[_0x35a1('0x61'),0x1]);})[_0x35a1('0x27')](respondWithResult(_0x4031eb,null))[_0x35a1('0x4b')](handleError(_0x4031eb,null));};function hasDefaultDashboard(_0x403115){var _0x38d8c1=[0x65];return new BPromise(function(_0x2687cb,_0x365f44){try{if(_0x403115[_0x35a1('0x57')]){_0x2687cb(_0x38d8c1);}else{return db[_0x35a1('0x58')][_0x35a1('0x65')]({'where':{'sectionId':_0x403115['id']},'raw':!![]})[_0x35a1('0x27')](function(_0xbac00){_0xbac00?_0x2687cb(_0x38d8c1):_0x2687cb();});}}catch(_0x12337b){_0x365f44(_0x12337b);}});}function getCustomDashboards(_0x57c7ff){var _0x5e735d=[];return new BPromise(function(_0x186cd5,_0x4dd2a2){try{if(_0x57c7ff[_0x35a1('0x57')]){return db[_0x35a1('0x66')][_0x35a1('0x45')]({'raw':!![]})[_0x35a1('0x27')](function(_0x497838){_0x497838['forEach'](function(_0x59ca9e){_0x5e735d[_0x35a1('0x5d')](_0x59ca9e['id']+0x1869f);});_0x186cd5(_0x5e735d);});}else{return db[_0x35a1('0x58')][_0x35a1('0x45')]({'where':{'sectionId':_0x57c7ff['id']},'raw':!![]})[_0x35a1('0x27')](function(_0x41eb9a){_0x41eb9a[_0x35a1('0x67')](function(_0x5af910){_0x5e735d[_0x35a1('0x5d')](_0x5af910[_0x35a1('0x68')]+0x1869f);});_0x186cd5(_0x5e735d);});}}catch(_0xe32c07){_0x4dd2a2(_0xe32c07);}});}function getPlugins(_0x10984e){var _0x2c08e9=[];return new BPromise(function(_0x5730dc,_0x142602){try{if(_0x10984e['autoAssociation']){return db[_0x35a1('0x69')][_0x35a1('0x45')]({'raw':!![]})[_0x35a1('0x27')](function(_0x563505){_0x563505[_0x35a1('0x67')](function(_0x4ca0f5){_0x2c08e9[_0x35a1('0x5d')](_0x4ca0f5['id']+0x15b38);});_0x5730dc(_0x2c08e9);});}else{return db[_0x35a1('0x58')][_0x35a1('0x45')]({'where':{'sectionId':_0x10984e['id']},'raw':!![]})[_0x35a1('0x27')](function(_0xb60e1){_0xb60e1[_0x35a1('0x67')](function(_0x22751b){_0x2c08e9[_0x35a1('0x5d')](_0x22751b['resourceId']+0x15b38);});_0x5730dc(_0x2c08e9);});}}catch(_0x5725d9){_0x142602(_0x5725d9);}});}exports['addResources']=function(_0xa5544e,_0x17fc3c){return db[_0x35a1('0x2f')][_0x35a1('0x49')]({'where':{'id':_0xa5544e[_0x35a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x17fc3c,null))['then'](function(_0x2f6860){if(_0x2f6860){return db[_0x35a1('0x53')][_0x35a1('0x54')](function(_0x2010db){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0xa5544e[_0x35a1('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x35a1('0x27')](function(_0x2bfce5){if(_0x2bfce5){return db[_0x35a1('0x55')][_0x35a1('0x28')]({'where':{'userProfileId':_0xa5544e[_0x35a1('0x47')]['id'],'id':_[_0x35a1('0x2e')](_0x2bfce5,function(_0x3605f5){return _0x3605f5['id'];})},'transaction':_0x2010db});}})[_0x35a1('0x27')](function(_0x6e5d1d){var _0x1fe465=_[_0x35a1('0x2e')](_0xa5544e[_0x35a1('0x51')],function(_0x6c1e15){_0x6c1e15[_0x35a1('0x5c')]=_0xa5544e[_0x35a1('0x47')]['id'];return _0x6c1e15;});return db['UserProfileSection'][_0x35a1('0x6a')](_0x1fe465,{'raw':!![],'transaction':_0x2010db});})[_0x35a1('0x27')](function(_0xf655f1){var _0x5eab4e=_[_0x35a1('0x40')](_[_0x35a1('0x2e')](_0xf655f1,function(_0x348c87){return _0x348c87[_0x35a1('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x5eab4e){return db['UserProfileSection'][_0x35a1('0x45')]({'where':{'userProfileId':_0xa5544e[_0x35a1('0x47')]['id'],'sectionId':_[_0x35a1('0x2e')](_0x5eab4e,function(_0x2788f1){return _0x2788f1['sectionId'];})},'attributes':['id',_0x35a1('0x59')],'raw':!![]})[_0x35a1('0x27')](function(_0x4dea99){var _0x234d1b=_['map'](_0xa5544e[_0x35a1('0x51')],function(_0x339bab){_0x339bab[_0x35a1('0x5c')]=_0xa5544e[_0x35a1('0x47')]['id'];return _0x339bab;});return db[_0x35a1('0x58')][_0x35a1('0x6a')](_0x234d1b,{'raw':!![],'transaction':_0x2010db});});}})[_0x35a1('0x4b')](handleError(_0x17fc3c,null));});}})[_0x35a1('0x27')](function(_0x3766db){var _0x36b65f=_[_0x35a1('0x2e')](_0x3766db,function(_0x28db5f){return _0x28db5f[_0x35a1('0x4d')]({'plain':!![]});});})[_0x35a1('0x27')](respondWithResult(_0x17fc3c,null))[_0x35a1('0x4b')](handleError(_0x17fc3c,null));};exports[_0x35a1('0x6b')]=function(_0xa94fd,_0x562db2,_0x326c33){return db['UserProfile'][_0x35a1('0x49')]({'where':{'id':_0xa94fd['params']['id']}})[_0x35a1('0x27')](handleEntityNotFound(_0x562db2,null))[_0x35a1('0x27')](function(_0x30b832){if(_0x30b832){return _0x30b832[_0x35a1('0x6b')](_0xa94fd[_0x35a1('0x38')][_0x35a1('0x5f')]);}})[_0x35a1('0x27')](respondWithStatusCode(_0x562db2,null))[_0x35a1('0x4b')](handleError(_0x562db2,null));};exports[_0x35a1('0x6c')]=function(_0x366512,_0x2b450b){var _0x4b995c={};if(!_0x366512[_0x35a1('0x38')][_0x35a1('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x366512['query'][_0x35a1('0x6e')](_0x35a1('0x6f'))){_0x4b995c[_0x35a1('0x22')]=qs['limit'](_0x366512[_0x35a1('0x38')]['limit']);_0x4b995c[_0x35a1('0x20')]=qs[_0x35a1('0x20')](_0x366512[_0x35a1('0x38')][_0x35a1('0x20')]);}return db[_0x35a1('0x2f')][_0x35a1('0x49')]({'where':{'id':_0x366512[_0x35a1('0x47')]['id']}})[_0x35a1('0x27')](function(_0x16baa2){if(!_0x16baa2)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x366512[_0x35a1('0x47')]['id']);return db[_0x35a1('0x2f')][_0x35a1('0x6c')](_0x366512);})['then'](respondWithFilteredResult(_0x2b450b,_0x4b995c))['catch'](handleError(_0x2b450b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index aaa445f..0689a7b 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 _0x1883=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x1e493c,_0x38ed59){var _0x504d8e=function(_0x5f0341){while(--_0x5f0341){_0x1e493c['push'](_0x1e493c['shift']());}};_0x504d8e(++_0x38ed59);}(_0x1883,0xab));var _0x3188=function(_0x48ada1,_0x3c1384){_0x48ada1=_0x48ada1-0x0;var _0x532f9d=_0x1883[_0x48ada1];return _0x532f9d;};'use strict';var EventEmitter=require(_0x3188('0x0'));var UserProfile=require(_0x3188('0x1'))['db'][_0x3188('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3188('0x3')](0x0);var events={'afterCreate':_0x3188('0x4'),'afterUpdate':_0x3188('0x5'),'afterDestroy':_0x3188('0x6')};function emitEvent(_0x408500){return function(_0x1c7c86,_0x44afb8,_0x46216d){UserProfileEvents[_0x3188('0x7')](_0x408500+':'+_0x1c7c86['id'],_0x1c7c86);UserProfileEvents[_0x3188('0x7')](_0x408500,_0x1c7c86);_0x46216d(null);};}for(var e in events){if(events[_0x3188('0x8')](e)){var event=events[e];UserProfile[_0x3188('0x9')](e,emitEvent(event));}}module[_0x3188('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x8ace=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update'];(function(_0x4e7642,_0x7ea8fb){var _0x50f819=function(_0x34090c){while(--_0x34090c){_0x4e7642['push'](_0x4e7642['shift']());}};_0x50f819(++_0x7ea8fb);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x1e8756,_0x431463){_0x1e8756=_0x1e8756-0x0;var _0x41a0f4=_0x8ace[_0x1e8756];return _0x41a0f4;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var UserProfile=require(_0xe8ac('0x1'))['db'][_0xe8ac('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe8ac('0x3')](0x0);var events={'afterCreate':_0xe8ac('0x4'),'afterUpdate':_0xe8ac('0x5'),'afterDestroy':_0xe8ac('0x6')};function emitEvent(_0x274d7d){return function(_0x114351,_0xf6af00,_0x199794){UserProfileEvents[_0xe8ac('0x7')](_0x274d7d+':'+_0x114351['id'],_0x114351);UserProfileEvents[_0xe8ac('0x7')](_0x274d7d,_0x114351);_0x199794(null);};}for(var e in events){if(events[_0xe8ac('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xe8ac('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 456c25f..7abf5d3 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 _0x3831=['faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceContext','voicemails','VoiceRecording','membername','User','role','agent','telephone','VoiceQueues','queue','QueueCampaigns','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','MailQueue','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','Agents','Telephones','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','ui.createdAt','from','user_has_','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','UserProfileSection','find','all','ignore','isEmpty','union','push','autoAssociation','length','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','offset','order','sort','where','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','DefaultReports','CustomReports','count','rows','tag','ThroughTags','color','true','chat','dataValues','fax','mail','openchannel','lodash','../../components/parsers/qs','squel','exports','filter','field','value','findAll','then','associatedResources','map','model','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareProjects','name','projectName','projects','JscriptyProject','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3831,0x14c));var _0x1383=function(_0x337229,_0x390e5e){_0x337229=_0x337229-0x0;var _0x5c639a=_0x3831[_0x337229];return _0x5c639a;};'use strict';var _=require(_0x1383('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x1383('0x1'));var squel=require(_0x1383('0x2'));module[_0x1383('0x3')]=function(_0x15e6b5){var _0x391bef=_0x15e6b5['models'];function _0x2fdf72(_0x573874,_0x21ea2c){return new Promise(function(_0x53b708,_0x5b64b1){if(!_0x21ea2c)return _0x53b708(null);var _0x5eb4d8=_0x21ea2c[_0x1383('0x4')]?{[_0x21ea2c['filter'][_0x1383('0x5')]]:_0x21ea2c[_0x1383('0x4')][_0x1383('0x6')]}:undefined;return _0x391bef[_0x573874][_0x1383('0x7')]({'where':_0x5eb4d8,'raw':!![]})[_0x1383('0x8')](function(_0x7cb670){_0x21ea2c[_0x1383('0x9')]=_[_0x1383('0xa')](_0x7cb670,'id');_0x53b708(_0x21ea2c);})['catch'](function(_0x998e2f){_0x5b64b1(_0x998e2f);});});}function _0x34be26(_0x627ec3,_0xb11599){return new Promise(function(_0x3675cb,_0x5d5ee2){var _0x275046=_0x627ec3[_0x1383('0x4')]?{[_0x627ec3[_0x1383('0x4')]['field']]:_0x627ec3['filter'][_0x1383('0x6')]}:undefined;return _0x391bef[_0x627ec3[_0x1383('0xb')]][_0x1383('0x7')]({'where':_0x275046,'raw':!![]})[_0x1383('0x8')](function(_0x1e02d7){_0xb11599[_0x1383('0x9')]=_[_0x1383('0xa')](_0x1e02d7,function(_0x22895c){return _0x22895c['name'];});_0x3675cb(_0xb11599);})[_0x1383('0xc')](function(_0x1f46de){_0x5d5ee2(_0x1f46de);});});}function _0x41d895(_0x1c6d7b,_0x29fbd7,_0x388b94){if(!_0x29fbd7)return Promise[_0x1383('0xd')](null);return new Promise(function(_0x5ca7fc,_0x564e3f){return _0x391bef[_0x1383('0xe')]['findAll']({'where':{'sectionId':_0x29fbd7['id']},'raw':!![]})[_0x1383('0x8')](function(_0x5b3705){if(_0x1c6d7b['field']&&_0x1c6d7b['field']!=='id'){_0x29fbd7[_0x1383('0x9')]=_['map'](_0x5b3705,function(_0x2aa3b6){return _0x2aa3b6[_0x1c6d7b['field']];});}else{if(_0x388b94===_0x1383('0xf')){_0x29fbd7[_0x1383('0x9')]=_[_0x1383('0xa')](_0x5b3705,function(_0x39884b){return{'id':_0x39884b[_0x1383('0x10')],'type':_0x39884b[_0x1383('0x11')]};});}else{_0x29fbd7[_0x1383('0x9')]=_[_0x1383('0xa')](_0x5b3705,function(_0x2afbd2){return _0x2afbd2['resourceId'];});}}_0x5ca7fc(_0x29fbd7);})[_0x1383('0xc')](function(_0x24f914){_0x564e3f(_0x24f914);});});}function _0x39fea2(_0x241c3d,_0x186524){var _0x2a9502={'parentSections':[]};switch(_0x241c3d[_0x1383('0x12')]()){case'squareprojects':_0x2a9502['childModel']=_0x1383('0x13');break;case _0x1383('0x14'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x16');break;case _0x1383('0x17'):_0x2a9502['childModel']='SquareRecording';_0x2a9502['parentSections']=[{'name':_0x1383('0x18'),'field':_0x1383('0x19'),'foreignKey':_0x1383('0x1a')}];break;case _0x1383('0x1b'):_0x2a9502['childModel']=_0x1383('0x1c');break;case'contacts':_0x2a9502[_0x1383('0x15')]=_0x1383('0x1d');_0x2a9502[_0x1383('0x1e')]=[{'name':_0x1383('0x1f'),'field':'id','foreignKey':_0x1383('0x20')}];break;case _0x1383('0x21'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x22');break;case _0x1383('0x23'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x24');break;case _0x1383('0x25'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x26');break;case'chatqueues':_0x2a9502[_0x1383('0x15')]=_0x1383('0x27');break;case _0x1383('0x28'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x29');break;case _0x1383('0x2a'):_0x2a9502['childModel']=_0x1383('0x2b');break;case _0x1383('0x2c'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x2d');break;case _0x1383('0x2e'):case _0x1383('0x2f'):case'outboundroutes':_0x2a9502[_0x1383('0x15')]='VoiceExtension';break;case'contexts':_0x2a9502[_0x1383('0x15')]=_0x1383('0x30');break;case _0x1383('0x31'):_0x2a9502['childModel']='VoiceMail';break;case'voicerecordings':_0x2a9502[_0x1383('0x15')]=_0x1383('0x32');_0x2a9502[_0x1383('0x1e')]=[{'name':'Agents','field':'name','foreignKey':_0x1383('0x33'),'model':_0x1383('0x34'),'filter':{'field':_0x1383('0x35'),'value':[_0x1383('0x36')]}},{'name':'Telephones','field':'name','foreignKey':_0x1383('0x33'),'model':_0x1383('0x34'),'filter':{'field':_0x1383('0x35'),'value':[_0x1383('0x37')]}},{'name':_0x1383('0x38'),'field':_0x1383('0x19'),'foreignKey':_0x1383('0x39'),'model':'VoiceQueue','filter':{'field':_0x1383('0x11'),'value':['inbound']}},{'name':_0x1383('0x3a'),'field':_0x1383('0x19'),'foreignKey':_0x1383('0x39'),'model':'VoiceQueue','filter':{'field':_0x1383('0x11'),'value':['outbound']}}];break;case'musiconholds':_0x2a9502[_0x1383('0x15')]=_0x1383('0x3b');break;case _0x1383('0x3c'):_0x2a9502['childModel']=_0x1383('0x3d');break;case _0x1383('0x3e'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x3f');break;case'ivrcampaigns':_0x2a9502[_0x1383('0x15')]='Campaign';break;case'mailqueues':_0x2a9502[_0x1383('0x15')]=_0x1383('0x40');break;case'mailaccounts':_0x2a9502['childModel']='MailAccount';break;case _0x1383('0x41'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x42');break;case _0x1383('0x43'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x44');break;case _0x1383('0x45'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x46');break;case'smsqueues':_0x2a9502[_0x1383('0x15')]=_0x1383('0x47');break;case _0x1383('0x48'):_0x2a9502['childModel']=_0x1383('0x49');break;case'whatsappqueues':_0x2a9502[_0x1383('0x15')]=_0x1383('0x4a');break;case _0x1383('0x4b'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x4c');break;case _0x1383('0x4d'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x4e');break;case _0x1383('0x4f'):case'queuecampaigns':_0x2a9502['childModel']='VoiceQueue';if(_0x186524){_0x2a9502[_0x1383('0x1e')]=[{'name':_0x1383('0x38')},{'name':_0x1383('0x3a')}];}break;case _0x1383('0x50'):case _0x1383('0x51'):case _0x1383('0x52'):_0x2a9502['childModel']=_0x1383('0x34');if(_0x186524){_0x2a9502[_0x1383('0x1e')]=[{'name':_0x1383('0x53'),'filter':{'field':'role','value':[_0x1383('0x54'),_0x1383('0x55')]},'ignore':!![]},{'name':_0x1383('0x56')},{'name':_0x1383('0x57')}];}break;case _0x1383('0x58'):_0x2a9502['childModel']=_0x1383('0x59');break;case'salesforceaccounts':_0x2a9502[_0x1383('0x15')]=_0x1383('0x5a');break;case'freshdeskaccounts':_0x2a9502[_0x1383('0x15')]=_0x1383('0x5b');break;case _0x1383('0x5c'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x5d');break;case _0x1383('0x5e'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x5f');break;case _0x1383('0x60'):_0x2a9502[_0x1383('0x15')]='ZohoAccount';break;case _0x1383('0x61'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x34');break;case _0x1383('0x62'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x63');break;case _0x1383('0x64'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x65');break;case'customdashboards':_0x2a9502[_0x1383('0x15')]=_0x1383('0x66');break;case _0x1383('0x67'):_0x2a9502['childModel']=_0x1383('0x68');break;case _0x1383('0x69'):_0x2a9502['childModel']=_0x1383('0x6a');break;case _0x1383('0x6b'):_0x2a9502['childModel']='Schedule';break;case _0x1383('0x6c'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x6d');break;case'tags':_0x2a9502[_0x1383('0x15')]=_0x1383('0x6e');break;case'templates':_0x2a9502[_0x1383('0x15')]='Template';break;case _0x1383('0x6f'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x70');break;case _0x1383('0x71'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x72');break;case _0x1383('0x73'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x74');break;case _0x1383('0x75'):_0x2a9502[_0x1383('0x15')]=_0x1383('0x76');break;case _0x1383('0x77'):_0x2a9502[_0x1383('0x15')]=_0x1383('0xf');_0x2a9502[_0x1383('0x1e')]=[{'name':_0x1383('0x78'),'field':'id','foreignKey':_0x1383('0x79')}];break;case'metrics':_0x2a9502[_0x1383('0x15')]=_0x1383('0x7a');break;}return _0x2a9502;}function _0x316e36(_0x1f78b2,_0x255db9){var _0x1b9eda=_0x1f78b2[_0x1383('0x7b')](0x0)[_0x1383('0x7c')]()+_0x1f78b2[_0x1383('0x7d')](0x1);var _0x32a9fb={'type':_0x391bef[_0x1383('0x7e')][_0x1383('0x7f')][_0x1383('0x80')],'raw':!![]};return new Promise(function(_0xcae0c2,_0x4f6a51){var _0x1f1b08=squel['select']()[_0x1383('0x5')](_0x1383('0x81')+_0x1b9eda+'InteractionId','id')[_0x1383('0x5')](_0x1383('0x82'))[_0x1383('0x83')](_0x1383('0x84')+_0x1f78b2+'_interactions','ui')['where'](_0x1383('0x85'),_0x255db9['id']);return _0x391bef[_0x1383('0x86')][_0x1383('0x87')](_0x1f1b08[_0x1383('0x88')](),_0x32a9fb)['then'](function(_0x69e495){_0x255db9[_0x1b9eda+_0x1383('0x89')]=_0x69e495;_0xcae0c2(_0x69e495);})[_0x1383('0xc')](function(_0x58a80b){_0x4f6a51(_0x58a80b);});});}return _0x15e6b5[_0x1383('0x8a')]('UserProfile',attributes,{'tableName':_0x1383('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4ae832){var _0x200e76={'raw':![],'where':{}};var _0x45363e={};var _0x15b538={'count':0x0,'rows':[]};var _0x1cd59b=_0x4ae832[_0x1383('0x87')][_0x1383('0x8c')];var _0x15a08e=_0x4ae832[_0x1383('0x87')][_0x1383('0x8d')]||![];var _0x448e13=_0x39fea2(_0x1cd59b,_0x15a08e);if(!_0x448e13[_0x1383('0x15')])throw new Error(_0x1383('0x8e')+_0x1cd59b+'\x27');var _0x38b24b=[{'name':_0x1cd59b}];if(!_['isEmpty'](_0x448e13[_0x1383('0x1e')]))_0x38b24b=_0x448e13[_0x1383('0x1e')];var _0x11f612=[];for(var _0x2db88e=0x0;_0x2db88e<_0x38b24b['length'];_0x2db88e++){_0x11f612['push'](_0x391bef[_0x1383('0x8f')][_0x1383('0x90')]({'where':{'userProfileId':_0x4ae832['params']['id'],'name':_0x38b24b[_0x2db88e]['name']},'raw':!![]}));}return Promise[_0x1383('0x91')](_0x11f612)[_0x1383('0x8')](function(_0x1be3bd){var _0x27351e=_[_0x1383('0x4')](_0x1be3bd,function(_0x5b9a0c){return _0x5b9a0c?_0x5b9a0c:undefined;});var _0x3fcc3f=_[_0x1383('0x4')](_0x38b24b,[_0x1383('0x92'),!![]]);var _0x13d830=_[_0x1383('0x93')](_0x27351e)&&_[_0x1383('0x93')](_0x3fcc3f)?null:_[_0x1383('0x94')](_0x3fcc3f,_0x27351e);if(!_0x13d830)return null;var _0x574641=[];for(var _0x337df8=0x0;_0x337df8<_0x13d830['length'];_0x337df8++){var _0x32e44a=_['find'](_0x38b24b,function(_0x7feade){return _0x13d830[_0x337df8]?_0x7feade['name']===_0x13d830[_0x337df8][_0x1383('0x19')]:null;});if(_0x32e44a){if(_0x13d830[_0x337df8][_0x1383('0x92')]){_0x574641[_0x1383('0x95')](_0x2fdf72(_0x448e13['childModel'],_0x13d830[_0x337df8]));}else{if(!_0x13d830[_0x337df8][_0x1383('0x96')]){_0x574641['push'](_0x41d895(_0x32e44a,_0x13d830[_0x337df8],_0x448e13[_0x1383('0x15')]));}else{if(_0x32e44a['model']){_0x574641[_0x1383('0x95')](_0x34be26(_0x32e44a,_0x13d830[_0x337df8]));}}}}}return Promise['all'](_0x574641);})['then'](function(_0x357ab1){var _0x2a1aa8=_0x357ab1;var _0x42e576=null;if(_0x2a1aa8){_0x42e576=_0x2a1aa8[_0x1383('0x97')]===0x1?_0x2a1aa8[0x0]:null;}if(!_0x42e576&&!_0x2a1aa8)return _0x15b538;var _0x20ee6b=_0x391bef[_0x448e13[_0x1383('0x15')]][_0x1383('0x98')];_0x45363e[_0x1383('0xb')]=_[_0x1383('0x99')](_0x20ee6b);_0x45363e[_0x1383('0x87')]=_[_0x1383('0x99')](_0x4ae832[_0x1383('0x87')]);_0x45363e[_0x1383('0x9a')]=_['intersection'](_0x45363e[_0x1383('0xb')],_0x45363e[_0x1383('0x87')]);_0x200e76[_0x1383('0x9b')]=_[_0x1383('0x9c')](_0x45363e[_0x1383('0xb')],qs[_0x1383('0x9d')](_0x4ae832[_0x1383('0x87')][_0x1383('0x9d')]));_0x200e76[_0x1383('0x9b')]=_0x200e76[_0x1383('0x9b')][_0x1383('0x97')]?_0x200e76[_0x1383('0x9b')]:_0x45363e[_0x1383('0xb')];if(!_0x4ae832['query'][_0x1383('0x9e')]('nolimit')){_0x200e76[_0x1383('0x9f')]=qs['limit'](_0x4ae832['query'][_0x1383('0x9f')]);_0x200e76[_0x1383('0xa0')]=qs['offset'](_0x4ae832['query'][_0x1383('0xa0')]);}_0x200e76[_0x1383('0xa1')]=qs[_0x1383('0xa2')](_0x4ae832['query'][_0x1383('0xa2')]);_0x200e76[_0x1383('0xa3')]=qs['filters'](_[_0x1383('0xa4')](_0x4ae832[_0x1383('0x87')],_0x45363e['filters']));if(_0x4ae832[_0x1383('0x87')][_0x1383('0x4')]){_0x200e76[_0x1383('0xa3')]=_[_0x1383('0xa5')](_0x200e76[_0x1383('0xa3')],{'$or':_[_0x1383('0xa')](_0x20ee6b,function(_0x452dc9){if(_0x452dc9['type'][_0x1383('0xa6')]!==_0x1383('0xa7')){var _0x50815e={};_0x50815e[_0x452dc9['field']]={'$like':'%'+_0x4ae832[_0x1383('0x87')][_0x1383('0x4')]+'%'};return _0x50815e;}})});}var _0x1f247d=[];var _0x35d60f=null;var _0x5f079d={};if(_0x42e576){_0x35d60f=_[_0x1383('0x90')](_0x38b24b,[_0x1383('0x19'),_0x42e576[_0x1383('0x19')]]);if(_0x35d60f[_0x1383('0x5')]){_0x5f079d={};if(_0x448e13[_0x1383('0x15')]===_0x1383('0xf')){_0x5f079d[_0x35d60f[_0x1383('0xa8')]]=_[_0x1383('0xa')](_0x42e576[_0x1383('0x9')],'id');}else{_0x5f079d[_0x35d60f[_0x1383('0xa8')]]=_0x42e576['associatedResources'];}_0x1f247d['push'](_0x5f079d);}else{_0x200e76[_0x1383('0xa3')]['id']=_0x42e576[_0x1383('0x9')];}}else{for(var _0x540924=0x0;_0x540924<_0x2a1aa8[_0x1383('0x97')];_0x540924++){_0x35d60f=_[_0x1383('0x90')](_0x38b24b,[_0x1383('0x19'),_0x2a1aa8[_0x540924][_0x1383('0x19')]]);if(_0x35d60f[_0x1383('0x5')]){_0x5f079d={};_0x5f079d[_0x35d60f[_0x1383('0xa8')]]=_0x2a1aa8[_0x540924][_0x1383('0x9')];_0x1f247d[_0x1383('0x95')](_0x5f079d);}else{if(!_0x200e76[_0x1383('0xa3')]['id'])_0x200e76[_0x1383('0xa3')]['id']=[];_0x2a1aa8[_0x540924][_0x1383('0x9')][_0x1383('0xa9')](function(_0xe10b76){_0x200e76[_0x1383('0xa3')]['id'][_0x1383('0x95')](_0xe10b76);});}}}if(!_['isEmpty'](_0x1f247d)){_0x200e76[_0x1383('0xa3')]=_['merge'](_0x200e76[_0x1383('0xa3')],{'$and':{'$or':_0x1f247d}});}_0x200e76=_[_0x1383('0xa5')]({},_0x200e76,_0x4ae832['options']);if(_0x42e576&&!_0x42e576[_0x1383('0x96')]&&_0x448e13['childModel']===_0x1383('0xf')){if(_0x4ae832[_0x1383('0x87')][_0x1383('0xaa')]){_0x200e76[_0x1383('0xab')]=[{'all':!![]}];}return _0x391bef[_0x448e13['childModel']][_0x1383('0x7')](_0x200e76)['then'](function(_0x1aeef5){var _0x39ad3b=[];_0x1aeef5[_0x1383('0xa9')](function(_0x51217b){var _0x2026fd;switch(_0x51217b[_0x1383('0xac')]){case _0x1383('0xad'):_0x2026fd=_[_0x1383('0x90')](_0x42e576['associatedResources'],function(_0x5cd5c8){return _0x5cd5c8['id']===_0x51217b['reportId']&&_0x5cd5c8['type']===_0x1383('0xae');});break;case'custom':_0x2026fd=_['find'](_0x42e576[_0x1383('0x9')],function(_0x1b10fe){return _0x1b10fe['id']===_0x51217b[_0x1383('0x79')]&&_0x1b10fe[_0x1383('0x11')]===_0x1383('0xaf');});break;}if(_0x2026fd)_0x39ad3b[_0x1383('0x95')](_0x51217b);});_0x15b538[_0x1383('0xb0')]=_0x39ad3b[_0x1383('0x97')];_0x15b538[_0x1383('0xb1')]=_0x39ad3b;return _0x15b538;});}else{return _0x391bef[_0x448e13[_0x1383('0x15')]]['count']({'where':_0x200e76['where']})[_0x1383('0x8')](function(_0x56aaa7){_0x15b538[_0x1383('0xb0')]=_0x56aaa7;if(_0x4ae832[_0x1383('0x87')]['includeAll']){if(_0x448e13['childModel']===_0x1383('0x1d')){_0x200e76[_0x1383('0xab')]=[{'model':_0x391bef[_0x1383('0x6e')],'as':'Tags','attributes':['id',_0x1383('0x19'),'color'],'required':_0x4ae832[_0x1383('0x87')][_0x1383('0xb2')]?!![]:![]},{'model':_0x391bef['Tag'],'as':_0x1383('0xb3'),'attributes':['id',_0x1383('0x19'),_0x1383('0xb4')],'through':_0x4ae832['query'][_0x1383('0xb2')]?{'attributes':[],'where':{'TagId':_0x4ae832['query'][_0x1383('0xb2')]||undefined}}:{},'required':_0x4ae832['query'][_0x1383('0xb2')]?!![]:![]}];}else{_0x200e76[_0x1383('0xab')]=[{'all':!![]}];}}return _0x391bef[_0x448e13['childModel']][_0x1383('0x7')](_0x200e76);})['then'](function(_0x337243){_0x15b538[_0x1383('0xb1')]=_0x337243;if(_0x1cd59b===_0x1383('0x56')&&_0x4ae832[_0x1383('0x87')]['openTabs']===_0x1383('0xb5')){var _0x10b1d2=[];for(var _0x1790bf=0x0;_0x1790bf<_0x15b538[_0x1383('0xb1')][_0x1383('0x97')];_0x1790bf++){_0x10b1d2[_0x1383('0x95')](_0x316e36(_0x1383('0xb6'),_0x15b538[_0x1383('0xb1')][_0x1790bf][_0x1383('0xb7')]));_0x10b1d2[_0x1383('0x95')](_0x316e36('sms',_0x15b538[_0x1383('0xb1')][_0x1790bf][_0x1383('0xb7')]));_0x10b1d2[_0x1383('0x95')](_0x316e36(_0x1383('0xb8'),_0x15b538['rows'][_0x1790bf][_0x1383('0xb7')]));_0x10b1d2[_0x1383('0x95')](_0x316e36(_0x1383('0xb9'),_0x15b538[_0x1383('0xb1')][_0x1790bf][_0x1383('0xb7')]));_0x10b1d2[_0x1383('0x95')](_0x316e36(_0x1383('0xba'),_0x15b538[_0x1383('0xb1')][_0x1790bf][_0x1383('0xb7')]));_0x10b1d2[_0x1383('0x95')](_0x316e36('whatsapp',_0x15b538[_0x1383('0xb1')][_0x1790bf]['dataValues']));}return Promise[_0x1383('0x91')](_0x10b1d2)['then'](function(){return _0x15b538;});}return _0x15b538;});}});}}});}; \ No newline at end of file +var _0xd8fb=['CmList','companies','CmCompany','CmCustomField','chatqueues','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','agent','Telephones','membername','User','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','Trigger','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','ui.','InteractionId','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','mergeResources','length','UserProfileSection','find','all','ignore','isEmpty','push','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','key','foreignKey','autoAssociation','includeAll','include','forEach','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','ThroughTags','tag','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','value','associatedResources','map','field','model','findAll','then','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','ListId','lists'];(function(_0x36f789,_0x508744){var _0x1806d9=function(_0x3ca73d){while(--_0x3ca73d){_0x36f789['push'](_0x36f789['shift']());}};_0x1806d9(++_0x508744);}(_0xd8fb,0x99));var _0xbd8f=function(_0x36001a,_0x4e1e27){_0x36001a=_0x36001a-0x0;var _0x48c96d=_0xd8fb[_0x36001a];return _0x48c96d;};'use strict';var _=require(_0xbd8f('0x0'));var attributes=require(_0xbd8f('0x1'));var qs=require(_0xbd8f('0x2'));var squel=require(_0xbd8f('0x3'));module['exports']=function(_0x5ea933){var _0x4e9545=_0x5ea933[_0xbd8f('0x4')];function _0x43d177(_0x53cccc,_0x400dfb){return new Promise(function(_0x2343bf,_0x5543b2){if(!_0x400dfb)return _0x2343bf(null);var _0x33d541=_0x400dfb['filter']?{[_0x400dfb[_0xbd8f('0x5')]['field']]:_0x400dfb[_0xbd8f('0x5')][_0xbd8f('0x6')]}:undefined;return _0x4e9545[_0x53cccc]['findAll']({'where':_0x33d541,'raw':!![]})['then'](function(_0x3caa93){_0x400dfb[_0xbd8f('0x7')]=_[_0xbd8f('0x8')](_0x3caa93,'id');_0x2343bf(_0x400dfb);})['catch'](function(_0x255af3){_0x5543b2(_0x255af3);});});}function _0x42ae20(_0x5b834b,_0x4ac253){return new Promise(function(_0x342bcb,_0x40a5bc){var _0x12dcac=_0x5b834b['filter']?{[_0x5b834b[_0xbd8f('0x5')][_0xbd8f('0x9')]]:_0x5b834b[_0xbd8f('0x5')][_0xbd8f('0x6')]}:undefined;return _0x4e9545[_0x5b834b[_0xbd8f('0xa')]][_0xbd8f('0xb')]({'where':_0x12dcac,'raw':!![]})[_0xbd8f('0xc')](function(_0x29ffe8){_0x4ac253[_0xbd8f('0x7')]=_['map'](_0x29ffe8,function(_0x31573c){return _0x31573c[_0xbd8f('0xd')];});_0x342bcb(_0x4ac253);})[_0xbd8f('0xe')](function(_0x10d72e){_0x40a5bc(_0x10d72e);});});}function _0x4da96f(_0x174929,_0x63db18,_0x5ebf8b){if(!_0x63db18)return Promise[_0xbd8f('0xf')](null);return new Promise(function(_0xf5e7a,_0x504adb){return _0x4e9545[_0xbd8f('0x10')][_0xbd8f('0xb')]({'where':{'sectionId':_0x63db18['id']},'raw':!![]})['then'](function(_0x5a572b){if(_0x174929[_0xbd8f('0x9')]&&_0x174929['field']!=='id'){_0x63db18['associatedResources']=_[_0xbd8f('0x8')](_0x5a572b,function(_0x4b5fac){return _0x4b5fac[_0x174929[_0xbd8f('0x9')]];});}else{if(_0x5ebf8b===_0xbd8f('0x11')){_0x63db18[_0xbd8f('0x7')]=_[_0xbd8f('0x8')](_0x5a572b,function(_0xdc11cc){return{'id':_0xdc11cc[_0xbd8f('0x12')],'type':_0xdc11cc[_0xbd8f('0x13')]};});}else{_0x63db18[_0xbd8f('0x7')]=_[_0xbd8f('0x8')](_0x5a572b,function(_0x775acc){return _0x775acc[_0xbd8f('0x12')];});}}_0xf5e7a(_0x63db18);})[_0xbd8f('0xe')](function(_0x2f7c45){_0x504adb(_0x2f7c45);});});}function _0x15c4a9(_0x320ede,_0xd11ae){var _0x395b1b={'parentSections':[]};switch(_0x320ede['toLowerCase']()){case _0xbd8f('0x14'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x16');break;case _0xbd8f('0x17'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x18');break;case _0xbd8f('0x19'):_0x395b1b[_0xbd8f('0x15')]='SquareRecording';_0x395b1b[_0xbd8f('0x1a')]=[{'name':_0xbd8f('0x1b'),'field':'name','foreignKey':_0xbd8f('0x1c')}];break;case'projects':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x1d');break;case _0xbd8f('0x1e'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x1f');_0x395b1b[_0xbd8f('0x1a')]=[{'name':'Lists','field':'id','foreignKey':_0xbd8f('0x20')}];break;case _0xbd8f('0x21'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x22');break;case _0xbd8f('0x23'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x24');break;case'globalcustomfields':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x25');break;case _0xbd8f('0x26'):_0x395b1b[_0xbd8f('0x15')]='ChatQueue';break;case'chatwebsites':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x27');break;case _0xbd8f('0x28'):_0x395b1b[_0xbd8f('0x15')]='FaxQueue';break;case _0xbd8f('0x29'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x2a');break;case _0xbd8f('0x2b'):case _0xbd8f('0x2c'):case'outboundroutes':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x2d');break;case _0xbd8f('0x2e'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x2f');break;case'voicemails':_0x395b1b[_0xbd8f('0x15')]='VoiceMail';break;case _0xbd8f('0x30'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x31');_0x395b1b[_0xbd8f('0x1a')]=[{'name':_0xbd8f('0x32'),'field':_0xbd8f('0xd'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0xbd8f('0x33')]}},{'name':_0xbd8f('0x34'),'field':_0xbd8f('0xd'),'foreignKey':_0xbd8f('0x35'),'model':_0xbd8f('0x36'),'filter':{'field':_0xbd8f('0x37'),'value':[_0xbd8f('0x38')]}},{'name':_0xbd8f('0x39'),'field':_0xbd8f('0xd'),'foreignKey':_0xbd8f('0x3a'),'model':_0xbd8f('0x3b'),'filter':{'field':_0xbd8f('0x13'),'value':[_0xbd8f('0x3c')]}},{'name':_0xbd8f('0x3d'),'field':_0xbd8f('0xd'),'foreignKey':'queue','model':_0xbd8f('0x3b'),'filter':{'field':_0xbd8f('0x13'),'value':['outbound']}}];break;case _0xbd8f('0x3e'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x3f');break;case'chanspies':_0x395b1b[_0xbd8f('0x15')]='VoiceChanSpy';break;case _0xbd8f('0x40'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x41');break;case'ivrcampaigns':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x42');break;case _0xbd8f('0x43'):_0x395b1b['childModel']=_0xbd8f('0x44');break;case _0xbd8f('0x45'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x46');break;case _0xbd8f('0x47'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x48');break;case _0xbd8f('0x49'):_0x395b1b[_0xbd8f('0x15')]='OpenchannelQueue';break;case'openchannelaccounts':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x4a');break;case _0xbd8f('0x4b'):_0x395b1b[_0xbd8f('0x15')]='SmsQueue';break;case _0xbd8f('0x4c'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x4d');break;case _0xbd8f('0x4e'):_0x395b1b[_0xbd8f('0x15')]='WhatsappQueue';break;case'whatsappaccounts':_0x395b1b[_0xbd8f('0x15')]='WhatsappAccount';break;case _0xbd8f('0x4f'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x50');break;case _0xbd8f('0x51'):case _0xbd8f('0x52'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x3b');if(_0xd11ae){_0x395b1b[_0xbd8f('0x1a')]=[{'name':'VoiceQueues'},{'name':_0xbd8f('0x3d')}];}break;case _0xbd8f('0x53'):case _0xbd8f('0x54'):case _0xbd8f('0x55'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x36');if(_0xd11ae){_0x395b1b[_0xbd8f('0x1a')]=[{'name':_0xbd8f('0x56'),'filter':{'field':'role','value':[_0xbd8f('0x57'),_0xbd8f('0x58')]},'ignore':!![]},{'name':_0xbd8f('0x32')},{'name':_0xbd8f('0x34')}];}break;case _0xbd8f('0x59'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x5a');break;case _0xbd8f('0x5b'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x5c');break;case _0xbd8f('0x5d'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x5e');break;case _0xbd8f('0x5f'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x60');break;case _0xbd8f('0x61'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x62');break;case'zohoaccounts':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x63');break;case _0xbd8f('0x64'):_0x395b1b[_0xbd8f('0x15')]='User';break;case _0xbd8f('0x65'):_0x395b1b['childModel']=_0xbd8f('0x66');break;case _0xbd8f('0x67'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x68');break;case'customdashboards':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x69');break;case _0xbd8f('0x6a'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x6b');break;case _0xbd8f('0x6c'):_0x395b1b['childModel']=_0xbd8f('0x6d');break;case'scheduler':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x6e');break;case _0xbd8f('0x6f'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x70');break;case _0xbd8f('0x71'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x72');break;case _0xbd8f('0x73'):_0x395b1b['childModel']=_0xbd8f('0x74');break;case'triggers':_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x75');break;case'trunks':_0x395b1b[_0xbd8f('0x15')]='Trunk';break;case'variables':_0x395b1b['childModel']='Variable';break;case _0xbd8f('0x76'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x77');break;case _0xbd8f('0x78'):_0x395b1b[_0xbd8f('0x15')]='AnalyticExtractedReport';_0x395b1b['parentSections']=[{'name':_0xbd8f('0x79'),'field':'id','foreignKey':_0xbd8f('0x7a')}];break;case _0xbd8f('0x7b'):_0x395b1b[_0xbd8f('0x15')]=_0xbd8f('0x7c');break;}return _0x395b1b;}function _0x576970(_0x4d2b28,_0x55a99b){var _0x9cf2d5=_0x4d2b28[_0xbd8f('0x7d')](0x0)[_0xbd8f('0x7e')]()+_0x4d2b28['slice'](0x1);var _0x3255be={'type':_0x4e9545[_0xbd8f('0x7f')][_0xbd8f('0x80')][_0xbd8f('0x81')],'raw':!![]};return new Promise(function(_0x50622d,_0x5327f2){var _0x388af8=squel['select']()[_0xbd8f('0x9')](_0xbd8f('0x82')+_0x9cf2d5+_0xbd8f('0x83'),'id')[_0xbd8f('0x9')]('ui.createdAt')['from'](_0xbd8f('0x84')+_0x4d2b28+_0xbd8f('0x85'),'ui')[_0xbd8f('0x86')](_0xbd8f('0x87'),_0x55a99b['id']);return _0x4e9545[_0xbd8f('0x88')][_0xbd8f('0x89')](_0x388af8[_0xbd8f('0x8a')](),_0x3255be)[_0xbd8f('0xc')](function(_0x2b9ba3){_0x55a99b[_0x9cf2d5+_0xbd8f('0x8b')]=_0x2b9ba3;_0x50622d(_0x2b9ba3);})[_0xbd8f('0xe')](function(_0x5c69c6){_0x5327f2(_0x5c69c6);});});}return _0x5ea933[_0xbd8f('0x8c')](_0xbd8f('0x8d'),attributes,{'tableName':_0xbd8f('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x12ee82){var _0x3b43f7={'raw':![],'where':{}};var _0xbbe096={};var _0x50e345={'count':0x0,'rows':[]};var _0x46c686=_0x12ee82[_0xbd8f('0x89')]['section'];var _0x5e18fc=_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0x8f')]||![];var _0x109616=_0x15c4a9(_0x46c686,_0x5e18fc);if(!_0x109616['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x46c686+'\x27');var _0x118f1a=[{'name':_0x46c686}];if(!_['isEmpty'](_0x109616['parentSections']))_0x118f1a=_0x109616['parentSections'];var _0x5a858e=[];for(var _0x5b26eb=0x0;_0x5b26eb<_0x118f1a[_0xbd8f('0x90')];_0x5b26eb++){_0x5a858e['push'](_0x4e9545[_0xbd8f('0x91')][_0xbd8f('0x92')]({'where':{'userProfileId':_0x12ee82['params']['id'],'name':_0x118f1a[_0x5b26eb][_0xbd8f('0xd')]},'raw':!![]}));}return Promise[_0xbd8f('0x93')](_0x5a858e)[_0xbd8f('0xc')](function(_0xeabb79){var _0x199d7d=_['filter'](_0xeabb79,function(_0x583d7a){return _0x583d7a?_0x583d7a:undefined;});var _0x378e72=_[_0xbd8f('0x5')](_0x118f1a,[_0xbd8f('0x94'),!![]]);var _0x296794=_[_0xbd8f('0x95')](_0x199d7d)&&_[_0xbd8f('0x95')](_0x378e72)?null:_['union'](_0x378e72,_0x199d7d);if(!_0x296794)return null;var _0x4eddf2=[];for(var _0x467b0f=0x0;_0x467b0f<_0x296794[_0xbd8f('0x90')];_0x467b0f++){var _0x528b29=_[_0xbd8f('0x92')](_0x118f1a,function(_0x372386){return _0x296794[_0x467b0f]?_0x372386['name']===_0x296794[_0x467b0f][_0xbd8f('0xd')]:null;});if(_0x528b29){if(_0x296794[_0x467b0f][_0xbd8f('0x94')]){_0x4eddf2[_0xbd8f('0x96')](_0x43d177(_0x109616['childModel'],_0x296794[_0x467b0f]));}else{if(!_0x296794[_0x467b0f]['autoAssociation']){_0x4eddf2[_0xbd8f('0x96')](_0x4da96f(_0x528b29,_0x296794[_0x467b0f],_0x109616[_0xbd8f('0x15')]));}else{if(_0x528b29[_0xbd8f('0xa')]){_0x4eddf2[_0xbd8f('0x96')](_0x42ae20(_0x528b29,_0x296794[_0x467b0f]));}}}}}return Promise[_0xbd8f('0x93')](_0x4eddf2);})['then'](function(_0x200718){var _0x27ec14=_0x200718;var _0x400bf6=null;if(_0x27ec14){_0x400bf6=_0x27ec14[_0xbd8f('0x90')]===0x1?_0x27ec14[0x0]:null;}if(!_0x400bf6&&!_0x27ec14)return _0x50e345;var _0x1efdf4=_0x4e9545[_0x109616[_0xbd8f('0x15')]][_0xbd8f('0x97')];_0xbbe096[_0xbd8f('0xa')]=_[_0xbd8f('0x98')](_0x1efdf4);_0xbbe096[_0xbd8f('0x89')]=_[_0xbd8f('0x98')](_0x12ee82[_0xbd8f('0x89')]);_0xbbe096[_0xbd8f('0x99')]=_[_0xbd8f('0x9a')](_0xbbe096[_0xbd8f('0xa')],_0xbbe096[_0xbd8f('0x89')]);_0x3b43f7[_0xbd8f('0x9b')]=_[_0xbd8f('0x9a')](_0xbbe096['model'],qs[_0xbd8f('0x9c')](_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0x9c')]));_0x3b43f7[_0xbd8f('0x9b')]=_0x3b43f7[_0xbd8f('0x9b')][_0xbd8f('0x90')]?_0x3b43f7['attributes']:_0xbbe096['model'];if(!_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0x9d')]('nolimit')){_0x3b43f7[_0xbd8f('0x9e')]=qs['limit'](_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0x9e')]);_0x3b43f7[_0xbd8f('0x9f')]=qs[_0xbd8f('0x9f')](_0x12ee82['query'][_0xbd8f('0x9f')]);}_0x3b43f7[_0xbd8f('0xa0')]=qs[_0xbd8f('0xa1')](_0x12ee82['query'][_0xbd8f('0xa1')]);_0x3b43f7[_0xbd8f('0x86')]=qs[_0xbd8f('0x99')](_[_0xbd8f('0xa2')](_0x12ee82['query'],_0xbbe096[_0xbd8f('0x99')]));if(_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0x5')]){_0x3b43f7[_0xbd8f('0x86')]=_[_0xbd8f('0xa3')](_0x3b43f7[_0xbd8f('0x86')],{'$or':_[_0xbd8f('0x8')](_0x1efdf4,function(_0x3a320c){if(_0x3a320c['type'][_0xbd8f('0xa4')]!=='VIRTUAL'){var _0x3da31b={};_0x3da31b[_0x3a320c['field']]={'$like':'%'+_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0x5')]+'%'};return _0x3da31b;}})});}var _0x5465e5=[];var _0x3d015f=null;var _0x87191={};if(_0x400bf6){_0x3d015f=_[_0xbd8f('0x92')](_0x118f1a,[_0xbd8f('0xd'),_0x400bf6['name']]);if(_0x3d015f[_0xbd8f('0x9')]){_0x87191={};if(_0x109616[_0xbd8f('0x15')]===_0xbd8f('0x11')){_0x87191[_0x3d015f[_0xbd8f('0xa5')]]=_['map'](_0x400bf6['associatedResources'],'id');}else{_0x87191[_0x3d015f[_0xbd8f('0xa5')]]=_0x400bf6[_0xbd8f('0x7')];}_0x5465e5[_0xbd8f('0x96')](_0x87191);}else{_0x3b43f7[_0xbd8f('0x86')]['id']=_0x400bf6[_0xbd8f('0x7')];}}else{for(var _0x53076d=0x0;_0x53076d<_0x27ec14[_0xbd8f('0x90')];_0x53076d++){_0x3d015f=_[_0xbd8f('0x92')](_0x118f1a,[_0xbd8f('0xd'),_0x27ec14[_0x53076d][_0xbd8f('0xd')]]);if(_0x3d015f[_0xbd8f('0x9')]){_0x87191={};_0x87191[_0x3d015f['foreignKey']]=_0x27ec14[_0x53076d]['associatedResources'];_0x5465e5['push'](_0x87191);}else{if(!_0x3b43f7[_0xbd8f('0x86')]['id'])_0x3b43f7['where']['id']=[];_0x27ec14[_0x53076d]['associatedResources']['forEach'](function(_0x63c20c){_0x3b43f7[_0xbd8f('0x86')]['id'][_0xbd8f('0x96')](_0x63c20c);});}}}if(!_[_0xbd8f('0x95')](_0x5465e5)){_0x3b43f7[_0xbd8f('0x86')]=_[_0xbd8f('0xa3')](_0x3b43f7[_0xbd8f('0x86')],{'$and':{'$or':_0x5465e5}});}_0x3b43f7=_[_0xbd8f('0xa3')]({},_0x3b43f7,_0x12ee82['options']);if(_0x400bf6&&!_0x400bf6[_0xbd8f('0xa6')]&&_0x109616[_0xbd8f('0x15')]===_0xbd8f('0x11')){if(_0x12ee82['query'][_0xbd8f('0xa7')]){_0x3b43f7[_0xbd8f('0xa8')]=[{'all':!![]}];}return _0x4e9545[_0x109616[_0xbd8f('0x15')]][_0xbd8f('0xb')](_0x3b43f7)[_0xbd8f('0xc')](function(_0x44ee0d){var _0x1d3c63=[];_0x44ee0d[_0xbd8f('0xa9')](function(_0x3aa33a){var _0x9e2f8a;switch(_0x3aa33a['reportType']){case _0xbd8f('0xaa'):_0x9e2f8a=_[_0xbd8f('0x92')](_0x400bf6[_0xbd8f('0x7')],function(_0x5c9c3a){return _0x5c9c3a['id']===_0x3aa33a[_0xbd8f('0x7a')]&&_0x5c9c3a['type']===_0xbd8f('0xab');});break;case _0xbd8f('0xac'):_0x9e2f8a=_[_0xbd8f('0x92')](_0x400bf6[_0xbd8f('0x7')],function(_0x351caa){return _0x351caa['id']===_0x3aa33a['reportId']&&_0x351caa[_0xbd8f('0x13')]===_0xbd8f('0xad');});break;}if(_0x9e2f8a)_0x1d3c63[_0xbd8f('0x96')](_0x3aa33a);});_0x50e345[_0xbd8f('0xae')]=_0x1d3c63[_0xbd8f('0x90')];_0x50e345[_0xbd8f('0xaf')]=_0x1d3c63;return _0x50e345;});}else{return _0x4e9545[_0x109616['childModel']][_0xbd8f('0xae')]({'where':_0x3b43f7[_0xbd8f('0x86')]})['then'](function(_0x49e15e){_0x50e345[_0xbd8f('0xae')]=_0x49e15e;if(_0x12ee82['query']['includeAll']){if(_0x109616['childModel']===_0xbd8f('0x1f')){_0x3b43f7[_0xbd8f('0xa8')]=[{'model':_0x4e9545[_0xbd8f('0x72')],'as':_0xbd8f('0xb0'),'attributes':['id','name',_0xbd8f('0xb1')],'required':_0x12ee82[_0xbd8f('0x89')]['tag']?!![]:![]},{'model':_0x4e9545['Tag'],'as':_0xbd8f('0xb2'),'attributes':['id','name',_0xbd8f('0xb1')],'through':_0x12ee82['query']['tag']?{'attributes':[],'where':{'TagId':_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0xb3')]||undefined}}:{},'required':_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0xb3')]?!![]:![]}];}else{_0x3b43f7[_0xbd8f('0xa8')]=[{'all':!![]}];}}return _0x4e9545[_0x109616['childModel']][_0xbd8f('0xb')](_0x3b43f7);})[_0xbd8f('0xc')](function(_0x3a6ec4){_0x50e345['rows']=_0x3a6ec4;if(_0x46c686===_0xbd8f('0x32')&&_0x12ee82[_0xbd8f('0x89')][_0xbd8f('0xb4')]===_0xbd8f('0xb5')){var _0x11fb11=[];for(var _0xc7a57c=0x0;_0xc7a57c<_0x50e345[_0xbd8f('0xaf')][_0xbd8f('0x90')];_0xc7a57c++){_0x11fb11[_0xbd8f('0x96')](_0x576970(_0xbd8f('0xb6'),_0x50e345['rows'][_0xc7a57c]['dataValues']));_0x11fb11['push'](_0x576970('sms',_0x50e345[_0xbd8f('0xaf')][_0xc7a57c][_0xbd8f('0xb7')]));_0x11fb11['push'](_0x576970('fax',_0x50e345['rows'][_0xc7a57c]['dataValues']));_0x11fb11[_0xbd8f('0x96')](_0x576970(_0xbd8f('0xb8'),_0x50e345[_0xbd8f('0xaf')][_0xc7a57c]['dataValues']));_0x11fb11[_0xbd8f('0x96')](_0x576970(_0xbd8f('0xb9'),_0x50e345[_0xbd8f('0xaf')][_0xc7a57c][_0xbd8f('0xb7')]));_0x11fb11['push'](_0x576970(_0xbd8f('0xba'),_0x50e345[_0xbd8f('0xaf')][_0xc7a57c][_0xbd8f('0xb7')]));}return Promise['all'](_0x11fb11)[_0xbd8f('0xc')](function(){return _0x50e345;});}return _0x50e345;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 03b0945..bb41636 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 _0x58c9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0x58c9,0x1bc));var _0x958c=function(_0x303f07,_0x1ffdb3){_0x303f07=_0x303f07-0x0;var _0x45f2da=_0x58c9[_0x303f07];return _0x45f2da;};'use strict';var _=require(_0x958c('0x0'));var util=require(_0x958c('0x1'));var moment=require(_0x958c('0x2'));var BPromise=require(_0x958c('0x3'));var rs=require(_0x958c('0x4'));var fs=require('fs');var Redis=require(_0x958c('0x5'));var db=require(_0x958c('0x6'))['db'];var utils=require(_0x958c('0x7'));var logger=require(_0x958c('0x8'))(_0x958c('0x9'));var config=require(_0x958c('0xa'));var jayson=require(_0x958c('0xb'));var client=jayson[_0x958c('0xc')]['http']({'port':0x232a});config[_0x958c('0xd')]=_[_0x958c('0xe')](config[_0x958c('0xd')],{'host':_0x958c('0xf'),'port':0x18eb});var socket=require(_0x958c('0x10'))(new Redis(config[_0x958c('0xd')]));require(_0x958c('0x11'))[_0x958c('0x12')](socket);function respondWithRpcPromise(_0x86f976,_0xac53f0,_0xba69db){return new BPromise(function(_0x553f00,_0x34bb7e){return client[_0x958c('0x13')](_0x86f976,_0xba69db)[_0x958c('0x14')](function(_0x1140e7){logger[_0x958c('0x15')](_0x958c('0x16'),_0xac53f0,_0x958c('0x17'));logger['debug'](_0x958c('0x18'),_0xac53f0,_0x958c('0x17'),JSON['stringify'](_0x1140e7));if(_0x1140e7[_0x958c('0x19')]){if(_0x1140e7[_0x958c('0x19')]['code']===0x1f4){logger[_0x958c('0x19')](_0x958c('0x16'),_0xac53f0,_0x1140e7['error']['message']);return _0x34bb7e(_0x1140e7[_0x958c('0x19')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0xac53f0,_0x1140e7[_0x958c('0x19')][_0x958c('0x1a')]);return _0x553f00(_0x1140e7[_0x958c('0x19')][_0x958c('0x1a')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0xac53f0,'request\x20sent');_0x553f00(_0x1140e7['result']['message']);}})[_0x958c('0x1b')](function(_0xfc649a){logger[_0x958c('0x19')](_0x958c('0x16'),_0xac53f0,_0xfc649a);_0x34bb7e(_0xfc649a);});});} \ No newline at end of file +var _0x2525=['socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0x27bc6e,_0x202d0f){var _0x3c60e1=function(_0x495f82){while(--_0x495f82){_0x27bc6e['push'](_0x27bc6e['shift']());}};_0x3c60e1(++_0x202d0f);}(_0x2525,0x1f0));var _0x5252=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x2525[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x5252('0x0'));var util=require(_0x5252('0x1'));var moment=require(_0x5252('0x2'));var BPromise=require(_0x5252('0x3'));var rs=require(_0x5252('0x4'));var fs=require('fs');var Redis=require(_0x5252('0x5'));var db=require(_0x5252('0x6'))['db'];var utils=require(_0x5252('0x7'));var logger=require(_0x5252('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5252('0x9'));var client=jayson[_0x5252('0xa')][_0x5252('0xb')]({'port':0x232a});config[_0x5252('0xc')]=_[_0x5252('0xd')](config[_0x5252('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5252('0xe'))(new Redis(config['redis']));require(_0x5252('0xf'))[_0x5252('0x10')](socket);function respondWithRpcPromise(_0x4aee12,_0x52356d,_0xbe2997){return new BPromise(function(_0x5289ce,_0x3949d4){return client[_0x5252('0x11')](_0x4aee12,_0xbe2997)[_0x5252('0x12')](function(_0x1a1de4){logger[_0x5252('0x13')](_0x5252('0x14'),_0x52356d,_0x5252('0x15'));logger[_0x5252('0x16')](_0x5252('0x17'),_0x52356d,_0x5252('0x15'),JSON[_0x5252('0x18')](_0x1a1de4));if(_0x1a1de4[_0x5252('0x19')]){if(_0x1a1de4[_0x5252('0x19')][_0x5252('0x1a')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x52356d,_0x1a1de4[_0x5252('0x19')][_0x5252('0x1b')]);return _0x3949d4(_0x1a1de4[_0x5252('0x19')][_0x5252('0x1b')]);}logger[_0x5252('0x19')](_0x5252('0x14'),_0x52356d,_0x1a1de4[_0x5252('0x19')]['message']);return _0x5289ce(_0x1a1de4['error']['message']);}else{logger[_0x5252('0x13')](_0x5252('0x14'),_0x52356d,_0x5252('0x15'));_0x5289ce(_0x1a1de4[_0x5252('0x1c')][_0x5252('0x1b')]);}})[_0x5252('0x1d')](function(_0x3f8983){logger['error'](_0x5252('0x14'),_0x52356d,_0x3f8983);_0x3949d4(_0x3f8983);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 4dbff6a..1cce592 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 _0xd27c=['length','./userProfile.events','save','update','emit','removeListener'];(function(_0x566a7c,_0x989746){var _0x505227=function(_0x37d764){while(--_0x37d764){_0x566a7c['push'](_0x566a7c['shift']());}};_0x505227(++_0x989746);}(_0xd27c,0x1e1));var _0xcd27=function(_0x23629f,_0x4b37fa){_0x23629f=_0x23629f-0x0;var _0x4d810a=_0xd27c[_0x23629f];return _0x4d810a;};'use strict';var UserProfileEvents=require(_0xcd27('0x0'));var events=[_0xcd27('0x1'),'remove',_0xcd27('0x2')];function createListener(_0x50d73a,_0x5b63e1){return function(_0x3799bf){_0x5b63e1[_0xcd27('0x3')](_0x50d73a,_0x3799bf);};}function removeListener(_0x470b39,_0x40cb15){return function(){UserProfileEvents[_0xcd27('0x4')](_0x470b39,_0x40cb15);};}exports['register']=function(_0x1c8110){for(var _0x2de5d6=0x0,_0x26788a=events[_0xcd27('0x5')];_0x2de5d6<_0x26788a;_0x2de5d6++){var _0x2f1708=events[_0x2de5d6];var _0xa0866a=createListener('userProfile:'+_0x2f1708,_0x1c8110);UserProfileEvents['on'](_0x2f1708,_0xa0866a);}}; \ No newline at end of file +var _0x3464=['remove','update','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x3464,0x16a));var _0x4346=function(_0x28ea69,_0x5d4dbd){_0x28ea69=_0x28ea69-0x0;var _0x477cc8=_0x3464[_0x28ea69];return _0x477cc8;};'use strict';var UserProfileEvents=require(_0x4346('0x0'));var events=[_0x4346('0x1'),_0x4346('0x2'),_0x4346('0x3')];function createListener(_0x5cc095,_0x4fc9b2){return function(_0x4de0e8){_0x4fc9b2['emit'](_0x5cc095,_0x4de0e8);};}function removeListener(_0x4395ab,_0x134d01){return function(){UserProfileEvents[_0x4346('0x4')](_0x4395ab,_0x134d01);};}exports['register']=function(_0x3e69f1){for(var _0x8005bf=0x0,_0x451b2d=events[_0x4346('0x5')];_0x8005bf<_0x451b2d;_0x8005bf++){var _0x34efda=events[_0x8005bf];var _0x4c30a6=createListener(_0x4346('0x6')+_0x34efda,_0x3e69f1);UserProfileEvents['on'](_0x34efda,_0x4c30a6);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 75dbcca..84f1b44 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 _0x7798=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf3b06f,_0x489959){var _0x531640=function(_0x50f1ba){while(--_0x50f1ba){_0xf3b06f['push'](_0xf3b06f['shift']());}};_0x531640(++_0x489959);}(_0x7798,0x175));var _0x8779=function(_0x4e6bd9,_0x3e5d9f){_0x4e6bd9=_0x4e6bd9-0x0;var _0x479e81=_0x7798[_0x4e6bd9];return _0x479e81;};'use strict';var multer=require(_0x8779('0x0'));var util=require('util');var path=require(_0x8779('0x1'));var timeout=require(_0x8779('0x2'));var express=require(_0x8779('0x3'));var router=express[_0x8779('0x4')]();var fs_extra=require(_0x8779('0x5'));var auth=require(_0x8779('0x6'));var interaction=require(_0x8779('0x7'));var config=require(_0x8779('0x8'));var controller=require(_0x8779('0x9'));router[_0x8779('0xa')]('/',auth[_0x8779('0xb')](),controller[_0x8779('0xc')]);router[_0x8779('0xa')](_0x8779('0xd'),auth['isAuthenticated'](),controller[_0x8779('0xe')]);router[_0x8779('0xa')](_0x8779('0xf'),auth[_0x8779('0xb')](),controller[_0x8779('0x10')]);router[_0x8779('0x11')]('/',auth[_0x8779('0xb')](),controller['create']);router['put'](_0x8779('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8779('0x12')](_0x8779('0xf'),auth[_0x8779('0xb')](),controller[_0x8779('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7f91=['get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller'];(function(_0x41821b,_0x121ffc){var _0x243ab0=function(_0x58177b){while(--_0x58177b){_0x41821b['push'](_0x41821b['shift']());}};_0x243ab0(++_0x121ffc);}(_0x7f91,0x172));var _0x17f9=function(_0x4c4fbe,_0x483482){_0x4c4fbe=_0x4c4fbe-0x0;var _0x39b3b9=_0x7f91[_0x4c4fbe];return _0x39b3b9;};'use strict';var multer=require(_0x17f9('0x0'));var util=require(_0x17f9('0x1'));var path=require(_0x17f9('0x2'));var timeout=require(_0x17f9('0x3'));var express=require(_0x17f9('0x4'));var router=express['Router']();var fs_extra=require(_0x17f9('0x5'));var auth=require(_0x17f9('0x6'));var interaction=require(_0x17f9('0x7'));var config=require(_0x17f9('0x8'));var controller=require(_0x17f9('0x9'));router[_0x17f9('0xa')]('/',auth[_0x17f9('0xb')](),controller['index']);router[_0x17f9('0xa')](_0x17f9('0xc'),auth[_0x17f9('0xb')](),controller[_0x17f9('0xd')]);router[_0x17f9('0xa')](_0x17f9('0xe'),auth[_0x17f9('0xb')](),controller['show']);router['post']('/',auth[_0x17f9('0xb')](),controller[_0x17f9('0xf')]);router[_0x17f9('0x10')](_0x17f9('0xe'),auth[_0x17f9('0xb')](),controller[_0x17f9('0x11')]);router[_0x17f9('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x17f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index b126640..099dd17 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 _0x2373=['exports','STRING','INTEGER','sequelize'];(function(_0x2aa7a0,_0x4ebc4d){var _0x45598f=function(_0x5b0e80){while(--_0x5b0e80){_0x2aa7a0['push'](_0x2aa7a0['shift']());}};_0x45598f(++_0x4ebc4d);}(_0x2373,0xb3));var _0x3237=function(_0xe1292b,_0x52d37e){_0xe1292b=_0xe1292b-0x0;var _0x2e1883=_0x2373[_0xe1292b];return _0x2e1883;};'use strict';var Sequelize=require(_0x3237('0x0'));module[_0x3237('0x1')]={'name':{'type':Sequelize[_0x3237('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3237('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x761a=['STRING','sequelize','INTEGER'];(function(_0x18fec3,_0x5ad3c9){var _0x7b0f6b=function(_0x5f2d4b){while(--_0x5f2d4b){_0x18fec3['push'](_0x18fec3['shift']());}};_0x7b0f6b(++_0x5ad3c9);}(_0x761a,0x115));var _0xa761=function(_0x17a9a4,_0x103238){_0x17a9a4=_0x17a9a4-0x0;var _0x148d98=_0x761a[_0x17a9a4];return _0x148d98;};'use strict';var Sequelize=require(_0xa761('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa761('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa761('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7b40ffc..cc6df9d 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 _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0xc9041f,_0x2dd019){var _0x5dda55=function(_0x4a1846){while(--_0x4a1846){_0xc9041f['push'](_0xc9041f['shift']());}};_0x5dda55(++_0x2dd019);}(_0xc2c7,0x134));var _0x7c2c=function(_0x364326,_0x17b6b4){_0x364326=_0x364326-0x0;var _0x1ee193=_0xc2c7[_0x364326];return _0x1ee193;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['UserProfileResource'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['UserProfileResource'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['UserProfileResource'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file +var _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2df7d2,_0x369d7c){_0x2df7d2=_0x2df7d2-0x0;var _0x4a4d1d=_0x9f0e[_0x2df7d2];return _0x4a4d1d;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 228b5a7..f00dd78 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 _0x979d=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x3d3570,_0x116247){var _0x5741d6=function(_0x11510c){while(--_0x11510c){_0x3d3570['push'](_0x3d3570['shift']());}};_0x5741d6(++_0x116247);}(_0x979d,0xb0));var _0xd979=function(_0x4bcd2d,_0xcfceb){_0x4bcd2d=_0x4bcd2d-0x0;var _0x5cc6d7=_0x979d[_0x4bcd2d];return _0x5cc6d7;};'use strict';var _=require(_0xd979('0x0'));var util=require(_0xd979('0x1'));var logger=require(_0xd979('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd979('0x3'));var rp=require(_0xd979('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd979('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xd979('0x6')]=function(_0x5efecd,_0x4a85ad){return _0x5efecd[_0xd979('0x7')](_0xd979('0x8'),attributes,{'tableName':_0xd979('0x9'),'paranoid':![],'indexes':[{'name':_0xd979('0xa'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0799=['../../config/environment','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xec5993,_0x5adf37){var _0x40b2d6=function(_0x4a82b8){while(--_0x4a82b8){_0xec5993['push'](_0xec5993['shift']());}};_0x40b2d6(++_0x5adf37);}(_0x0799,0x172));var _0x9079=function(_0x4e11d5,_0x1ce514){_0x4e11d5=_0x4e11d5-0x0;var _0x5e4e4c=_0x0799[_0x4e11d5];return _0x5e4e4c;};'use strict';var _=require(_0x9079('0x0'));var util=require(_0x9079('0x1'));var logger=require(_0x9079('0x2'))(_0x9079('0x3'));var moment=require(_0x9079('0x4'));var BPromise=require(_0x9079('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9079('0x6'));var rimraf=require(_0x9079('0x7'));var config=require(_0x9079('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x17e29e,_0x47b834){return _0x17e29e[_0x9079('0x9')](_0x9079('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x9079('0xb'),'fields':[_0x9079('0xc'),_0x9079('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 39a2402..e570d58 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 _0xf77a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','moment','bluebird'];(function(_0x4af1fd,_0x166611){var _0x2acc3a=function(_0x32aa97){while(--_0x32aa97){_0x4af1fd['push'](_0x4af1fd['shift']());}};_0x2acc3a(++_0x166611);}(_0xf77a,0x9e));var _0xaf77=function(_0x36959a,_0x4329d8){_0x36959a=_0x36959a-0x0;var _0x47ba49=_0xf77a[_0x36959a];return _0x47ba49;};'use strict';var _=require(_0xaf77('0x0'));var util=require('util');var moment=require(_0xaf77('0x1'));var BPromise=require(_0xaf77('0x2'));var rs=require(_0xaf77('0x3'));var fs=require('fs');var Redis=require(_0xaf77('0x4'));var db=require(_0xaf77('0x5'))['db'];var utils=require(_0xaf77('0x6'));var logger=require(_0xaf77('0x7'))(_0xaf77('0x8'));var config=require(_0xaf77('0x9'));var jayson=require(_0xaf77('0xa'));var client=jayson[_0xaf77('0xb')][_0xaf77('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f196d,_0x20dbbe,_0x13d31c){return new BPromise(function(_0x4ed096,_0x42cf71){return client['request'](_0x2f196d,_0x13d31c)['then'](function(_0x403b5c){logger['info'](_0xaf77('0xd'),_0x20dbbe,'request\x20sent');logger[_0xaf77('0xe')](_0xaf77('0xf'),_0x20dbbe,'request\x20sent',JSON[_0xaf77('0x10')](_0x403b5c));if(_0x403b5c[_0xaf77('0x11')]){if(_0x403b5c[_0xaf77('0x11')][_0xaf77('0x12')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x20dbbe,_0x403b5c['error']['message']);return _0x42cf71(_0x403b5c['error'][_0xaf77('0x13')]);}logger['error'](_0xaf77('0xd'),_0x20dbbe,_0x403b5c[_0xaf77('0x11')][_0xaf77('0x13')]);return _0x4ed096(_0x403b5c[_0xaf77('0x11')][_0xaf77('0x13')]);}else{logger[_0xaf77('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x20dbbe,_0xaf77('0x15'));_0x4ed096(_0x403b5c['result'][_0xaf77('0x13')]);}})[_0xaf77('0x16')](function(_0x1084aa){logger[_0xaf77('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x20dbbe,_0x1084aa);_0x42cf71(_0x1084aa);});});} \ No newline at end of file +var _0x7a85=['UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0xed29f3,_0x58a766){var _0x120445=function(_0x2cdb8d){while(--_0x2cdb8d){_0xed29f3['push'](_0xed29f3['shift']());}};_0x120445(++_0x58a766);}(_0x7a85,0x16e));var _0x57a8=function(_0x2b3935,_0x227828){_0x2b3935=_0x2b3935-0x0;var _0x1866fc=_0x7a85[_0x2b3935];return _0x1866fc;};'use strict';var _=require(_0x57a8('0x0'));var util=require('util');var moment=require(_0x57a8('0x1'));var BPromise=require('bluebird');var rs=require(_0x57a8('0x2'));var fs=require('fs');var Redis=require(_0x57a8('0x3'));var db=require(_0x57a8('0x4'))['db'];var utils=require(_0x57a8('0x5'));var logger=require(_0x57a8('0x6'))(_0x57a8('0x7'));var config=require('../../config/environment');var jayson=require(_0x57a8('0x8'));var client=jayson[_0x57a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe7e5ce,_0x1479e8,_0x51146d){return new BPromise(function(_0x282af6,_0x59197f){return client[_0x57a8('0xa')](_0xe7e5ce,_0x51146d)[_0x57a8('0xb')](function(_0x990a03){logger['info'](_0x57a8('0xc'),_0x1479e8,_0x57a8('0xd'));logger['debug'](_0x57a8('0xe'),_0x1479e8,_0x57a8('0xd'),JSON['stringify'](_0x990a03));if(_0x990a03[_0x57a8('0xf')]){if(_0x990a03['error'][_0x57a8('0x10')]===0x1f4){logger[_0x57a8('0xf')](_0x57a8('0xc'),_0x1479e8,_0x990a03[_0x57a8('0xf')][_0x57a8('0x11')]);return _0x59197f(_0x990a03['error'][_0x57a8('0x11')]);}logger['error'](_0x57a8('0xc'),_0x1479e8,_0x990a03['error'][_0x57a8('0x11')]);return _0x282af6(_0x990a03[_0x57a8('0xf')][_0x57a8('0x11')]);}else{logger['info'](_0x57a8('0xc'),_0x1479e8,_0x57a8('0xd'));_0x282af6(_0x990a03[_0x57a8('0x12')][_0x57a8('0x11')]);}})[_0x57a8('0x13')](function(_0x5596db){logger[_0x57a8('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x1479e8,_0x5596db);_0x59197f(_0x5596db);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e5b05f0..4976f15 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 _0x1bae=['put','update','delete','path','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create'];(function(_0x90883f,_0x3b431f){var _0x51dc6b=function(_0x4bfb63){while(--_0x4bfb63){_0x90883f['push'](_0x90883f['shift']());}};_0x51dc6b(++_0x3b431f);}(_0x1bae,0xa3));var _0xe1ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1bae[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe1ba('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe1ba('0x1'));var auth=require(_0xe1ba('0x2'));var interaction=require(_0xe1ba('0x3'));var config=require('../../config/environment');var controller=require(_0xe1ba('0x4'));router[_0xe1ba('0x5')]('/',auth['isAuthenticated'](),controller[_0xe1ba('0x6')]);router[_0xe1ba('0x5')](_0xe1ba('0x7'),auth['isAuthenticated'](),controller[_0xe1ba('0x8')]);router[_0xe1ba('0x5')](_0xe1ba('0x9'),auth[_0xe1ba('0xa')](),controller['show']);router[_0xe1ba('0xb')]('/',auth[_0xe1ba('0xa')](),controller[_0xe1ba('0xc')]);router[_0xe1ba('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe1ba('0xe')]);router[_0xe1ba('0xf')](_0xe1ba('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xebc2=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','/:id','update'];(function(_0x14005c,_0x33beca){var _0x43d65d=function(_0x5d0caa){while(--_0x5d0caa){_0x14005c['push'](_0x14005c['shift']());}};_0x43d65d(++_0x33beca);}(_0xebc2,0x1e5));var _0x2ebc=function(_0x5f086b,_0x364bee){_0x5f086b=_0x5f086b-0x0;var _0x506c2a=_0xebc2[_0x5f086b];return _0x506c2a;};'use strict';var multer=require(_0x2ebc('0x0'));var util=require(_0x2ebc('0x1'));var path=require(_0x2ebc('0x2'));var timeout=require(_0x2ebc('0x3'));var express=require(_0x2ebc('0x4'));var router=express[_0x2ebc('0x5')]();var fs_extra=require(_0x2ebc('0x6'));var auth=require(_0x2ebc('0x7'));var interaction=require(_0x2ebc('0x8'));var config=require(_0x2ebc('0x9'));var controller=require('./userProfileSection.controller');router[_0x2ebc('0xa')]('/',auth[_0x2ebc('0xb')](),controller[_0x2ebc('0xc')]);router[_0x2ebc('0xa')](_0x2ebc('0xd'),auth[_0x2ebc('0xb')](),controller[_0x2ebc('0xe')]);router['get']('/:id',auth[_0x2ebc('0xb')](),controller['show']);router[_0x2ebc('0xf')]('/',auth[_0x2ebc('0xb')](),controller[_0x2ebc('0x10')]);router['put'](_0x2ebc('0x11'),auth['isAuthenticated'](),controller[_0x2ebc('0x12')]);router[_0x2ebc('0x13')](_0x2ebc('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x2ebc('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 880f3a4..5494bde 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 _0x9c00=['STRING','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9c00,0x1a0));var _0x09c0=function(_0x180e11,_0x24bfb8){_0x180e11=_0x180e11-0x0;var _0x330930=_0x9c00[_0x180e11];return _0x330930;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x09c0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x09c0('0x4')],'set':function(_0x2c702c){this[_0x09c0('0x5')](_0x09c0('0x6'),_0x2c702c?_0x2c702c[_0x09c0('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x09c0('0x8')](_0x09c0('0x6'))[_0x09c0('0x9')](''):[];}}}; \ No newline at end of file +var _0x02ce=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x2b13e1,_0x53a72f){var _0x2c5c59=function(_0x34d7f7){while(--_0x34d7f7){_0x2b13e1['push'](_0x2b13e1['shift']());}};_0x2c5c59(++_0x53a72f);}(_0x02ce,0x1ac));var _0xe02c=function(_0x360e0a,_0x80644b){_0x360e0a=_0x360e0a-0x0;var _0x30df55=_0x02ce[_0x360e0a];return _0x30df55;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe02c('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe02c('0x2')],'set':function(_0x46475c){this[_0xe02c('0x5')](_0xe02c('0x6'),_0x46475c?_0x46475c[_0xe02c('0x7')](''):[]);},'get':function(){return this[_0xe02c('0x8')](_0xe02c('0x6'))?this[_0xe02c('0x8')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 5d627da..de0d176 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 _0x6043=['hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','UserProfileSection','includeAll','include','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','length'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0x6043,0x196));var _0x3604=function(_0x2e8660,_0x5ca0c2){_0x2e8660=_0x2e8660-0x0;var _0x3dc331=_0x6043[_0x2e8660];return _0x3dc331;};'use strict';var emlformat=require(_0x3604('0x0'));var rimraf=require(_0x3604('0x1'));var zipdir=require(_0x3604('0x2'));var jsonpatch=require(_0x3604('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3604('0x4'));var Mustache=require(_0x3604('0x5'));var util=require(_0x3604('0x6'));var path=require(_0x3604('0x7'));var sox=require(_0x3604('0x8'));var csv=require(_0x3604('0x9'));var ejs=require(_0x3604('0xa'));var fs=require('fs');var fs_extra=require(_0x3604('0xb'));var _=require(_0x3604('0xc'));var squel=require(_0x3604('0xd'));var crypto=require(_0x3604('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3604('0xf'));var Redis=require(_0x3604('0x10'));var authService=require(_0x3604('0x11'));var qs=require(_0x3604('0x12'));var as=require(_0x3604('0x13'));var hardwareService=require(_0x3604('0x14'));var logger=require(_0x3604('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3604('0x16'));var licenseUtil=require(_0x3604('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8a1d,_0x46bb53){_0x46bb53=_0x46bb53||0xcc;return function(_0x29910c){if(_0x29910c){return _0x3a8a1d[_0x3604('0x18')](_0x46bb53);}return _0x3a8a1d[_0x3604('0x19')](_0x46bb53)[_0x3604('0x1a')]();};}function respondWithResult(_0x270284,_0x1e6c27){_0x1e6c27=_0x1e6c27||0xc8;return function(_0x111ebd){if(_0x111ebd){return _0x270284['status'](_0x1e6c27)[_0x3604('0x1b')](_0x111ebd);}};}function respondWithFilteredResult(_0xc9df55,_0x1c0ff1){return function(_0x193708){if(_0x193708){var _0x53238a=typeof _0x1c0ff1[_0x3604('0x1c')]===_0x3604('0x1d')&&typeof _0x1c0ff1[_0x3604('0x1e')]===_0x3604('0x1d');var _0x562b3f=_0x193708[_0x3604('0x1f')];var _0x40deb3=_0x53238a?0x0:_0x1c0ff1['offset'];var _0x42d7dc=_0x53238a?_0x193708['count']:_0x1c0ff1[_0x3604('0x1c')]+_0x1c0ff1[_0x3604('0x1e')];var _0x3c4e82;if(_0x42d7dc>=_0x562b3f){_0x42d7dc=_0x562b3f;_0x3c4e82=0xc8;}else{_0x3c4e82=0xce;}_0xc9df55[_0x3604('0x19')](_0x3c4e82);return _0xc9df55[_0x3604('0x20')](_0x3604('0x21'),_0x40deb3+'-'+_0x42d7dc+'/'+_0x562b3f)['json'](_0x193708);}return null;};}function patchUpdates(_0xd097d2){return function(_0x1b4107){try{jsonpatch[_0x3604('0x22')](_0x1b4107,_0xd097d2,!![]);}catch(_0x155e20){return BPromise[_0x3604('0x23')](_0x155e20);}return _0x1b4107[_0x3604('0x24')]();};}function saveUpdates(_0x293ddc,_0x4692eb){return function(_0x2607c1){if(_0x2607c1){return _0x2607c1['update'](_0x293ddc)[_0x3604('0x25')](function(_0x19d455){return _0x19d455;});}return null;};}function removeEntity(_0x4f9f94,_0x15bfd4){return function(_0x4abf5e){if(_0x4abf5e){return _0x4abf5e[_0x3604('0x26')]()['then'](function(){_0x4f9f94[_0x3604('0x19')](0xcc)[_0x3604('0x1a')]();});}};}function handleEntityNotFound(_0xc8d61a,_0x2f42e9){return function(_0x5ebf4b){if(!_0x5ebf4b){_0xc8d61a[_0x3604('0x18')](0x194);}return _0x5ebf4b;};}function handleError(_0x5f0e25,_0x17b640){_0x17b640=_0x17b640||0x1f4;return function(_0xd7b0e9){logger[_0x3604('0x27')](_0xd7b0e9[_0x3604('0x28')]);if(_0xd7b0e9[_0x3604('0x29')]){delete _0xd7b0e9['name'];}_0x5f0e25[_0x3604('0x19')](_0x17b640)['send'](_0xd7b0e9);};}exports[_0x3604('0x2a')]=function(_0x1bef5b,_0x54b2c3){var _0x3e56f2={},_0x56cd51={},_0x3816c1={'count':0x0,'rows':[]};var _0x27901b=_['map'](db['UserProfileSection'][_0x3604('0x2b')],function(_0x1ac766){return{'name':_0x1ac766[_0x3604('0x2c')],'type':_0x1ac766[_0x3604('0x2d')][_0x3604('0x2e')]};});_0x56cd51[_0x3604('0x2f')]=_[_0x3604('0x30')](_0x27901b,_0x3604('0x29'));_0x56cd51['query']=_[_0x3604('0x31')](_0x1bef5b['query']);_0x56cd51[_0x3604('0x32')]=_[_0x3604('0x33')](_0x56cd51[_0x3604('0x2f')],_0x56cd51[_0x3604('0x34')]);_0x3e56f2['attributes']=_[_0x3604('0x33')](_0x56cd51[_0x3604('0x2f')],qs[_0x3604('0x35')](_0x1bef5b[_0x3604('0x34')]['fields']));_0x3e56f2['attributes']=_0x3e56f2[_0x3604('0x36')][_0x3604('0x37')]?_0x3e56f2['attributes']:_0x56cd51['model'];if(!_0x1bef5b[_0x3604('0x34')][_0x3604('0x38')](_0x3604('0x39'))){_0x3e56f2[_0x3604('0x1e')]=qs[_0x3604('0x1e')](_0x1bef5b[_0x3604('0x34')][_0x3604('0x1e')]);_0x3e56f2[_0x3604('0x1c')]=qs[_0x3604('0x1c')](_0x1bef5b[_0x3604('0x34')]['offset']);}_0x3e56f2['order']=qs[_0x3604('0x3a')](_0x1bef5b['query'][_0x3604('0x3a')]);_0x3e56f2['where']=qs[_0x3604('0x32')](_[_0x3604('0x3b')](_0x1bef5b[_0x3604('0x34')],_0x56cd51[_0x3604('0x32')]),_0x27901b);if(_0x1bef5b[_0x3604('0x34')][_0x3604('0x3c')]){_0x3e56f2[_0x3604('0x3d')]=_[_0x3604('0x3e')](_0x3e56f2[_0x3604('0x3d')],{'$or':_[_0x3604('0x30')](_0x27901b,function(_0x2b0b6d){if(_0x2b0b6d[_0x3604('0x2d')]!==_0x3604('0x3f')){var _0x344486={};_0x344486[_0x2b0b6d[_0x3604('0x29')]]={'$like':'%'+_0x1bef5b[_0x3604('0x34')][_0x3604('0x3c')]+'%'};return _0x344486;}})});}_0x3e56f2=_[_0x3604('0x3e')]({},_0x3e56f2,_0x1bef5b[_0x3604('0x40')]);var _0x1cb961={'where':_0x3e56f2[_0x3604('0x3d')]};return db[_0x3604('0x41')][_0x3604('0x1f')](_0x1cb961)[_0x3604('0x25')](function(_0x37f723){_0x3816c1[_0x3604('0x1f')]=_0x37f723;if(_0x1bef5b[_0x3604('0x34')][_0x3604('0x42')]){_0x3e56f2[_0x3604('0x43')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x3e56f2);})[_0x3604('0x25')](function(_0x327dbf){_0x3816c1[_0x3604('0x44')]=_0x327dbf;return _0x3816c1;})[_0x3604('0x25')](respondWithFilteredResult(_0x54b2c3,_0x3e56f2))[_0x3604('0x45')](handleError(_0x54b2c3,null));};exports[_0x3604('0x46')]=function(_0xa37a80,_0x1a3547){var _0xce8aaa={'raw':![],'where':{'id':_0xa37a80[_0x3604('0x47')]['id']}},_0xe603c8={};_0xe603c8['model']=_['keys'](db[_0x3604('0x41')]['rawAttributes']);_0xe603c8[_0x3604('0x34')]=_[_0x3604('0x31')](_0xa37a80[_0x3604('0x34')]);_0xe603c8['filters']=_['intersection'](_0xe603c8[_0x3604('0x2f')],_0xe603c8[_0x3604('0x34')]);_0xce8aaa[_0x3604('0x36')]=_['intersection'](_0xe603c8[_0x3604('0x2f')],qs[_0x3604('0x35')](_0xa37a80[_0x3604('0x34')][_0x3604('0x35')]));_0xce8aaa[_0x3604('0x36')]=_0xce8aaa[_0x3604('0x36')][_0x3604('0x37')]?_0xce8aaa[_0x3604('0x36')]:_0xe603c8[_0x3604('0x2f')];if(_0xa37a80[_0x3604('0x34')][_0x3604('0x42')]){_0xce8aaa['include']=[{'all':!![]}];}_0xce8aaa=_['merge']({},_0xce8aaa,_0xa37a80[_0x3604('0x40')]);return db[_0x3604('0x41')][_0x3604('0x48')](_0xce8aaa)['then'](handleEntityNotFound(_0x1a3547,null))[_0x3604('0x25')](respondWithResult(_0x1a3547,null))[_0x3604('0x45')](handleError(_0x1a3547,null));};exports[_0x3604('0x49')]=function(_0x5252e7,_0x3178da){return db[_0x3604('0x41')]['create'](_0x5252e7[_0x3604('0x4a')],{})[_0x3604('0x25')](respondWithResult(_0x3178da,0xc9))[_0x3604('0x45')](handleError(_0x3178da,null));};exports[_0x3604('0x4b')]=function(_0xecad47,_0x1afa13){if(_0xecad47[_0x3604('0x4a')]['id']){delete _0xecad47[_0x3604('0x4a')]['id'];}return db[_0x3604('0x41')]['find']({'where':{'id':_0xecad47[_0x3604('0x47')]['id']}})[_0x3604('0x25')](handleEntityNotFound(_0x1afa13,null))[_0x3604('0x25')](saveUpdates(_0xecad47[_0x3604('0x4a')],null))['then'](respondWithResult(_0x1afa13,null))[_0x3604('0x45')](handleError(_0x1afa13,null));};exports[_0x3604('0x26')]=function(_0x424a7e,_0x1c4826){return db[_0x3604('0x41')][_0x3604('0x48')]({'where':{'id':_0x424a7e[_0x3604('0x47')]['id']}})[_0x3604('0x25')](handleEntityNotFound(_0x1c4826,null))[_0x3604('0x25')](removeEntity(_0x1c4826,null))[_0x3604('0x45')](handleError(_0x1c4826,null));};exports[_0x3604('0x4c')]=function(_0x5b4dbe,_0x1b1bcc){return db['UserProfileSection'][_0x3604('0x4c')]()['then'](respondWithResult(_0x1b1bcc,null))[_0x3604('0x45')](handleError(_0x1b1bcc,null));}; \ No newline at end of file +var _0xddb6=['type','VIRTUAL','options','UserProfileSection','count','includeAll','include','rows','catch','show','params','fields','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','status','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','sort','where','pick','filter','merge'];(function(_0x376c18,_0x2bf6ba){var _0x4aee4c=function(_0x3b04d4){while(--_0x3b04d4){_0x376c18['push'](_0x376c18['shift']());}};_0x4aee4c(++_0x2bf6ba);}(_0xddb6,0x188));var _0x6ddb=function(_0x4fd8b3,_0x54901e){_0x4fd8b3=_0x4fd8b3-0x0;var _0x3f1cb5=_0xddb6[_0x4fd8b3];return _0x3f1cb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6ddb('0x0'));var zipdir=require(_0x6ddb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ddb('0x2'));var moment=require(_0x6ddb('0x3'));var BPromise=require(_0x6ddb('0x4'));var Mustache=require(_0x6ddb('0x5'));var util=require(_0x6ddb('0x6'));var path=require('path');var sox=require(_0x6ddb('0x7'));var csv=require(_0x6ddb('0x8'));var ejs=require(_0x6ddb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ddb('0xa'));var squel=require(_0x6ddb('0xb'));var crypto=require(_0x6ddb('0xc'));var jsforce=require(_0x6ddb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6ddb('0x8'));var querystring=require(_0x6ddb('0xe'));var Papa=require('papaparse');var Redis=require(_0x6ddb('0xf'));var authService=require(_0x6ddb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6ddb('0x11'));var hardwareService=require(_0x6ddb('0x12'));var logger=require(_0x6ddb('0x13'))(_0x6ddb('0x14'));var utils=require(_0x6ddb('0x15'));var config=require(_0x6ddb('0x16'));var licenseUtil=require(_0x6ddb('0x17'));var db=require(_0x6ddb('0x18'))['db'];function respondWithStatusCode(_0x171a0e,_0x537698){_0x537698=_0x537698||0xcc;return function(_0x3f3f2d){if(_0x3f3f2d){return _0x171a0e['sendStatus'](_0x537698);}return _0x171a0e['status'](_0x537698)[_0x6ddb('0x19')]();};}function respondWithResult(_0x2ec16d,_0x108e9f){_0x108e9f=_0x108e9f||0xc8;return function(_0x5c1616){if(_0x5c1616){return _0x2ec16d['status'](_0x108e9f)[_0x6ddb('0x1a')](_0x5c1616);}};}function respondWithFilteredResult(_0x5c2727,_0x468d0b){return function(_0xdfbe5f){if(_0xdfbe5f){var _0x4eab51=typeof _0x468d0b[_0x6ddb('0x1b')]==='undefined'&&typeof _0x468d0b['limit']===_0x6ddb('0x1c');var _0x46501c=_0xdfbe5f['count'];var _0x2de395=_0x4eab51?0x0:_0x468d0b[_0x6ddb('0x1b')];var _0x24e7a5=_0x4eab51?_0xdfbe5f['count']:_0x468d0b['offset']+_0x468d0b[_0x6ddb('0x1d')];var _0x2f94a8;if(_0x24e7a5>=_0x46501c){_0x24e7a5=_0x46501c;_0x2f94a8=0xc8;}else{_0x2f94a8=0xce;}_0x5c2727[_0x6ddb('0x1e')](_0x2f94a8);return _0x5c2727[_0x6ddb('0x1f')](_0x6ddb('0x20'),_0x2de395+'-'+_0x24e7a5+'/'+_0x46501c)[_0x6ddb('0x1a')](_0xdfbe5f);}return null;};}function patchUpdates(_0xb1bf5a){return function(_0x1071c7){try{jsonpatch[_0x6ddb('0x21')](_0x1071c7,_0xb1bf5a,!![]);}catch(_0x43eaaf){return BPromise['reject'](_0x43eaaf);}return _0x1071c7[_0x6ddb('0x22')]();};}function saveUpdates(_0x453a05,_0x332589){return function(_0x5a03ec){if(_0x5a03ec){return _0x5a03ec['update'](_0x453a05)[_0x6ddb('0x23')](function(_0x4e6393){return _0x4e6393;});}return null;};}function removeEntity(_0x26f4bb,_0xb5c46){return function(_0x4fe28a){if(_0x4fe28a){return _0x4fe28a[_0x6ddb('0x24')]()[_0x6ddb('0x23')](function(){_0x26f4bb[_0x6ddb('0x1e')](0xcc)[_0x6ddb('0x19')]();});}};}function handleEntityNotFound(_0x23ccda,_0x3c166d){return function(_0x32f9cd){if(!_0x32f9cd){_0x23ccda[_0x6ddb('0x25')](0x194);}return _0x32f9cd;};}function handleError(_0x3de825,_0x4619ae){_0x4619ae=_0x4619ae||0x1f4;return function(_0x428250){logger[_0x6ddb('0x26')](_0x428250[_0x6ddb('0x27')]);if(_0x428250['name']){delete _0x428250[_0x6ddb('0x28')];}_0x3de825[_0x6ddb('0x1e')](_0x4619ae)['send'](_0x428250);};}exports[_0x6ddb('0x29')]=function(_0x192115,_0x5df9f9){var _0x1d6738={},_0x2b4f34={},_0x28d5f7={'count':0x0,'rows':[]};var _0x5e7249=_[_0x6ddb('0x2a')](db['UserProfileSection'][_0x6ddb('0x2b')],function(_0x5a6eb0){return{'name':_0x5a6eb0[_0x6ddb('0x2c')],'type':_0x5a6eb0['type'][_0x6ddb('0x2d')]};});_0x2b4f34[_0x6ddb('0x2e')]=_[_0x6ddb('0x2a')](_0x5e7249,_0x6ddb('0x28'));_0x2b4f34[_0x6ddb('0x2f')]=_[_0x6ddb('0x30')](_0x192115[_0x6ddb('0x2f')]);_0x2b4f34[_0x6ddb('0x31')]=_[_0x6ddb('0x32')](_0x2b4f34[_0x6ddb('0x2e')],_0x2b4f34[_0x6ddb('0x2f')]);_0x1d6738[_0x6ddb('0x33')]=_[_0x6ddb('0x32')](_0x2b4f34[_0x6ddb('0x2e')],qs['fields'](_0x192115[_0x6ddb('0x2f')]['fields']));_0x1d6738['attributes']=_0x1d6738[_0x6ddb('0x33')][_0x6ddb('0x34')]?_0x1d6738[_0x6ddb('0x33')]:_0x2b4f34[_0x6ddb('0x2e')];if(!_0x192115[_0x6ddb('0x2f')]['hasOwnProperty']('nolimit')){_0x1d6738[_0x6ddb('0x1d')]=qs['limit'](_0x192115[_0x6ddb('0x2f')][_0x6ddb('0x1d')]);_0x1d6738[_0x6ddb('0x1b')]=qs[_0x6ddb('0x1b')](_0x192115[_0x6ddb('0x2f')][_0x6ddb('0x1b')]);}_0x1d6738['order']=qs[_0x6ddb('0x35')](_0x192115[_0x6ddb('0x2f')][_0x6ddb('0x35')]);_0x1d6738[_0x6ddb('0x36')]=qs['filters'](_[_0x6ddb('0x37')](_0x192115[_0x6ddb('0x2f')],_0x2b4f34['filters']),_0x5e7249);if(_0x192115['query'][_0x6ddb('0x38')]){_0x1d6738[_0x6ddb('0x36')]=_[_0x6ddb('0x39')](_0x1d6738['where'],{'$or':_[_0x6ddb('0x2a')](_0x5e7249,function(_0x3b8404){if(_0x3b8404[_0x6ddb('0x3a')]!==_0x6ddb('0x3b')){var _0x23d57d={};_0x23d57d[_0x3b8404[_0x6ddb('0x28')]]={'$like':'%'+_0x192115[_0x6ddb('0x2f')]['filter']+'%'};return _0x23d57d;}})});}_0x1d6738=_[_0x6ddb('0x39')]({},_0x1d6738,_0x192115[_0x6ddb('0x3c')]);var _0x44d9d0={'where':_0x1d6738[_0x6ddb('0x36')]};return db[_0x6ddb('0x3d')][_0x6ddb('0x3e')](_0x44d9d0)['then'](function(_0x391773){_0x28d5f7['count']=_0x391773;if(_0x192115[_0x6ddb('0x2f')][_0x6ddb('0x3f')]){_0x1d6738[_0x6ddb('0x40')]=[{'all':!![]}];}return db[_0x6ddb('0x3d')]['findAll'](_0x1d6738);})[_0x6ddb('0x23')](function(_0x5f2be9){_0x28d5f7[_0x6ddb('0x41')]=_0x5f2be9;return _0x28d5f7;})[_0x6ddb('0x23')](respondWithFilteredResult(_0x5df9f9,_0x1d6738))[_0x6ddb('0x42')](handleError(_0x5df9f9,null));};exports[_0x6ddb('0x43')]=function(_0x280e41,_0x51ec26){var _0x4eaff6={'raw':![],'where':{'id':_0x280e41[_0x6ddb('0x44')]['id']}},_0x13f024={};_0x13f024[_0x6ddb('0x2e')]=_['keys'](db[_0x6ddb('0x3d')][_0x6ddb('0x2b')]);_0x13f024[_0x6ddb('0x2f')]=_[_0x6ddb('0x30')](_0x280e41['query']);_0x13f024[_0x6ddb('0x31')]=_['intersection'](_0x13f024[_0x6ddb('0x2e')],_0x13f024[_0x6ddb('0x2f')]);_0x4eaff6[_0x6ddb('0x33')]=_[_0x6ddb('0x32')](_0x13f024['model'],qs[_0x6ddb('0x45')](_0x280e41[_0x6ddb('0x2f')][_0x6ddb('0x45')]));_0x4eaff6[_0x6ddb('0x33')]=_0x4eaff6['attributes'][_0x6ddb('0x34')]?_0x4eaff6[_0x6ddb('0x33')]:_0x13f024[_0x6ddb('0x2e')];if(_0x280e41['query']['includeAll']){_0x4eaff6[_0x6ddb('0x40')]=[{'all':!![]}];}_0x4eaff6=_[_0x6ddb('0x39')]({},_0x4eaff6,_0x280e41[_0x6ddb('0x3c')]);return db[_0x6ddb('0x3d')][_0x6ddb('0x46')](_0x4eaff6)[_0x6ddb('0x23')](handleEntityNotFound(_0x51ec26,null))['then'](respondWithResult(_0x51ec26,null))[_0x6ddb('0x42')](handleError(_0x51ec26,null));};exports[_0x6ddb('0x47')]=function(_0x34843b,_0x39330a){return db[_0x6ddb('0x3d')][_0x6ddb('0x47')](_0x34843b[_0x6ddb('0x48')],{})['then'](respondWithResult(_0x39330a,0xc9))['catch'](handleError(_0x39330a,null));};exports[_0x6ddb('0x49')]=function(_0xb9559b,_0xa10073){if(_0xb9559b[_0x6ddb('0x48')]['id']){delete _0xb9559b[_0x6ddb('0x48')]['id'];}return db['UserProfileSection'][_0x6ddb('0x46')]({'where':{'id':_0xb9559b[_0x6ddb('0x44')]['id']}})[_0x6ddb('0x23')](handleEntityNotFound(_0xa10073,null))[_0x6ddb('0x23')](saveUpdates(_0xb9559b[_0x6ddb('0x48')],null))[_0x6ddb('0x23')](respondWithResult(_0xa10073,null))[_0x6ddb('0x42')](handleError(_0xa10073,null));};exports[_0x6ddb('0x24')]=function(_0x47d327,_0x146c6e){return db['UserProfileSection'][_0x6ddb('0x46')]({'where':{'id':_0x47d327['params']['id']}})[_0x6ddb('0x23')](handleEntityNotFound(_0x146c6e,null))['then'](removeEntity(_0x146c6e,null))[_0x6ddb('0x42')](handleError(_0x146c6e,null));};exports[_0x6ddb('0x4a')]=function(_0x5d260e,_0x512cbf){return db['UserProfileSection'][_0x6ddb('0x4a')]()[_0x6ddb('0x23')](respondWithResult(_0x512cbf,null))[_0x6ddb('0x42')](handleError(_0x512cbf,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6612566..faab9e1 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 _0xc67f=['userProfileId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId'];(function(_0xc350,_0x2fb0f8){var _0x126021=function(_0x3f0b9e){while(--_0x3f0b9e){_0xc350['push'](_0xc350['shift']());}};_0x126021(++_0x2fb0f8);}(_0xc67f,0x1d5));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc67('0x0'));var util=require(_0xfc67('0x1'));var logger=require(_0xfc67('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfc67('0x3'));var rp=require(_0xfc67('0x4'));var fs=require('fs');var path=require(_0xfc67('0x5'));var rimraf=require('rimraf');var config=require(_0xfc67('0x6'));var attributes=require(_0xfc67('0x7'));module['exports']=function(_0x2a6f1e,_0x9a5593){return _0x2a6f1e[_0xfc67('0x8')]('UserProfileSection',attributes,{'tableName':_0xfc67('0x9'),'paranoid':![],'indexes':[{'name':_0xfc67('0xa'),'fields':[_0xfc67('0xb'),_0xfc67('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba31=['bluebird','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','api'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xba31,0x1b6));var _0x1ba3=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xba31[_0x34d275];return _0x1379cc;};'use strict';var _=require(_0x1ba3('0x0'));var util=require(_0x1ba3('0x1'));var logger=require(_0x1ba3('0x2'))(_0x1ba3('0x3'));var moment=require('moment');var BPromise=require(_0x1ba3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1ba3('0x5'));var attributes=require(_0x1ba3('0x6'));module[_0x1ba3('0x7')]=function(_0x1f91b6,_0x3bb555){return _0x1f91b6[_0x1ba3('0x8')](_0x1ba3('0x9'),attributes,{'tableName':_0x1ba3('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1ba3('0xb'),_0x1ba3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 3c9d0e9..5ecd17b 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 _0xbb29=['message','request\x20sent','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x7e71eb,_0x3b5437){var _0x1717cd=function(_0x491e4a){while(--_0x491e4a){_0x7e71eb['push'](_0x7e71eb['shift']());}};_0x1717cd(++_0x3b5437);}(_0xbb29,0x15a));var _0x9bb2=function(_0x5b154f,_0x54130a){_0x5b154f=_0x5b154f-0x0;var _0x187b86=_0xbb29[_0x5b154f];return _0x187b86;};'use strict';var _=require(_0x9bb2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9bb2('0x1'));var rs=require(_0x9bb2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bb2('0x3'))['db'];var utils=require(_0x9bb2('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9bb2('0x5'));var jayson=require(_0x9bb2('0x6'));var client=jayson[_0x9bb2('0x7')][_0x9bb2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x72d7cb,_0x8f63b4,_0xe11cc6){return new BPromise(function(_0xaafe5f,_0x57be2c){return client['request'](_0x72d7cb,_0xe11cc6)[_0x9bb2('0x9')](function(_0x2c3d53){logger[_0x9bb2('0xa')](_0x9bb2('0xb'),_0x8f63b4,'request\x20sent');logger['debug'](_0x9bb2('0xc'),_0x8f63b4,'request\x20sent',JSON[_0x9bb2('0xd')](_0x2c3d53));if(_0x2c3d53[_0x9bb2('0xe')]){if(_0x2c3d53['error']['code']===0x1f4){logger[_0x9bb2('0xe')](_0x9bb2('0xb'),_0x8f63b4,_0x2c3d53['error'][_0x9bb2('0xf')]);return _0x57be2c(_0x2c3d53[_0x9bb2('0xe')][_0x9bb2('0xf')]);}logger[_0x9bb2('0xe')](_0x9bb2('0xb'),_0x8f63b4,_0x2c3d53[_0x9bb2('0xe')][_0x9bb2('0xf')]);return _0xaafe5f(_0x2c3d53[_0x9bb2('0xe')]['message']);}else{logger[_0x9bb2('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x8f63b4,_0x9bb2('0x10'));_0xaafe5f(_0x2c3d53[_0x9bb2('0x11')][_0x9bb2('0xf')]);}})[_0x9bb2('0x12')](function(_0x4651ac){logger['error'](_0x9bb2('0xb'),_0x8f63b4,_0x4651ac);_0x57be2c(_0x4651ac);});});} \ No newline at end of file +var _0x849d=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1bb427,_0x47a4be){var _0x179a0a=function(_0x4a2d39){while(--_0x4a2d39){_0x1bb427['push'](_0x1bb427['shift']());}};_0x179a0a(++_0x47a4be);}(_0x849d,0x181));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd849('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd849('0x1'));var rs=require(_0xd849('0x2'));var fs=require('fs');var Redis=require(_0xd849('0x3'));var db=require(_0xd849('0x4'))['db'];var utils=require(_0xd849('0x5'));var logger=require(_0xd849('0x6'))('rpc');var config=require(_0xd849('0x7'));var jayson=require(_0xd849('0x8'));var client=jayson[_0xd849('0x9')][_0xd849('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x464f3c,_0x6524bc,_0x2ca92d){return new BPromise(function(_0x2423a8,_0x45338f){return client[_0xd849('0xb')](_0x464f3c,_0x2ca92d)[_0xd849('0xc')](function(_0x4a65b9){logger[_0xd849('0xd')](_0xd849('0xe'),_0x6524bc,_0xd849('0xf'));logger[_0xd849('0x10')](_0xd849('0x11'),_0x6524bc,_0xd849('0xf'),JSON[_0xd849('0x12')](_0x4a65b9));if(_0x4a65b9[_0xd849('0x13')]){if(_0x4a65b9[_0xd849('0x13')][_0xd849('0x14')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x6524bc,_0x4a65b9[_0xd849('0x13')][_0xd849('0x15')]);return _0x45338f(_0x4a65b9[_0xd849('0x13')][_0xd849('0x15')]);}logger[_0xd849('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x6524bc,_0x4a65b9[_0xd849('0x13')][_0xd849('0x15')]);return _0x2423a8(_0x4a65b9['error'][_0xd849('0x15')]);}else{logger[_0xd849('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x6524bc,_0xd849('0xf'));_0x2423a8(_0x4a65b9['result'][_0xd849('0x15')]);}})[_0xd849('0x16')](function(_0x1e2fac){logger[_0xd849('0x13')](_0xd849('0xe'),_0x6524bc,_0x1e2fac);_0x45338f(_0x1e2fac);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 1091a1c..293950a 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(_0x37a03d,_0xbb072c){var _0x55bfeb=function(_0x5c4efd){while(--_0x5c4efd){_0x37a03d['push'](_0x37a03d['shift']());}};_0x55bfeb(++_0xbb072c);}(_0xe706,0xa3));var _0x6e70=function(_0x1b0c08,_0xd7531f){_0x1b0c08=_0x1b0c08-0x0;var _0x123dbf=_0xe706[_0x1b0c08];return _0x123dbf;};'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(_0x1a6a25,_0x2394f6){var _0x592ccb=function(_0x4f6994){while(--_0x4f6994){_0x1a6a25['push'](_0x1a6a25['shift']());}};_0x592ccb(++_0x2394f6);}(_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 9006424..27026e6 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe57c=['exports','sequelize'];(function(_0x4c71f0,_0x52151f){var _0x2ceb53=function(_0x882b0e){while(--_0x882b0e){_0x4c71f0['push'](_0x4c71f0['shift']());}};_0x2ceb53(++_0x52151f);}(_0xe57c,0xeb));var _0xce57=function(_0x363a10,_0x4ec1c1){_0x363a10=_0x363a10-0x0;var _0x169280=_0xe57c[_0x363a10];return _0x169280;};'use strict';var Sequelize=require(_0xce57('0x0'));module[_0xce57('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 609b18a..3c81dd0 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 _0x8085=['define','UserSmsQueue','user_has_sms_queues','lodash','api','moment','bluebird','request-promise','../../config/environment','./userSmsQueue.attributes'];(function(_0x13c5a9,_0x547d90){var _0x25f7dc=function(_0x1fe88e){while(--_0x1fe88e){_0x13c5a9['push'](_0x13c5a9['shift']());}};_0x25f7dc(++_0x547d90);}(_0x8085,0x71));var _0x5808=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x8085[_0x31eb67];return _0x2a8cb8;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5808('0x1'));var moment=require(_0x5808('0x2'));var BPromise=require(_0x5808('0x3'));var rp=require(_0x5808('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5808('0x5'));var attributes=require(_0x5808('0x6'));module['exports']=function(_0x17f899,_0x749306){return _0x17f899[_0x5808('0x7')](_0x5808('0x8'),attributes,{'tableName':_0x5808('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5232=['user_has_sms_queues','lodash','util','../../config/logger','api','moment','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x3a2382,_0x2c9a5c){var _0x184958=function(_0x348822){while(--_0x348822){_0x3a2382['push'](_0x3a2382['shift']());}};_0x184958(++_0x2c9a5c);}(_0x5232,0x1c9));var _0x2523=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0x5232[_0x2caaef];return _0xd011f8;};'use strict';var _=require(_0x2523('0x0'));var util=require(_0x2523('0x1'));var logger=require(_0x2523('0x2'))(_0x2523('0x3'));var moment=require(_0x2523('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2523('0x5'));var rimraf=require(_0x2523('0x6'));var config=require('../../config/environment');var attributes=require(_0x2523('0x7'));module[_0x2523('0x8')]=function(_0x1c3b74,_0x45ae69){return _0x1c3b74[_0x2523('0x9')](_0x2523('0xa'),attributes,{'tableName':_0x2523('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 5ca4ee5..aa6ba7b 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 _0x9dad=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','request','then','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x5f3dff,_0x4e7615){var _0x53a169=function(_0x109f23){while(--_0x109f23){_0x5f3dff['push'](_0x5f3dff['shift']());}};_0x53a169(++_0x4e7615);}(_0x9dad,0xb0));var _0xd9da=function(_0x10e349,_0x38f280){_0x10e349=_0x10e349-0x0;var _0x5774da=_0x9dad[_0x10e349];return _0x5774da;};'use strict';var _=require(_0xd9da('0x0'));var util=require(_0xd9da('0x1'));var moment=require(_0xd9da('0x2'));var BPromise=require(_0xd9da('0x3'));var rs=require(_0xd9da('0x4'));var fs=require('fs');var Redis=require(_0xd9da('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd9da('0x6'))(_0xd9da('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd9da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2564eb,_0x581af0,_0x4fb328){return new BPromise(function(_0x13f186,_0x43f5c0){return client[_0xd9da('0x9')](_0x2564eb,_0x4fb328)[_0xd9da('0xa')](function(_0x556364){logger[_0xd9da('0xb')](_0xd9da('0xc'),_0x581af0,'request\x20sent');logger[_0xd9da('0xd')](_0xd9da('0xe'),_0x581af0,'request\x20sent',JSON[_0xd9da('0xf')](_0x556364));if(_0x556364[_0xd9da('0x10')]){if(_0x556364[_0xd9da('0x10')][_0xd9da('0x11')]===0x1f4){logger[_0xd9da('0x10')](_0xd9da('0xc'),_0x581af0,_0x556364[_0xd9da('0x10')][_0xd9da('0x12')]);return _0x43f5c0(_0x556364[_0xd9da('0x10')][_0xd9da('0x12')]);}logger[_0xd9da('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x581af0,_0x556364['error']['message']);return _0x13f186(_0x556364['error']['message']);}else{logger['info'](_0xd9da('0xc'),_0x581af0,_0xd9da('0x13'));_0x13f186(_0x556364['result'][_0xd9da('0x12')]);}})[_0xd9da('0x14')](function(_0x4a3eb0){logger['error'](_0xd9da('0xc'),_0x581af0,_0x4a3eb0);_0x43f5c0(_0x4a3eb0);});});} \ No newline at end of file +var _0xc117=['randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','stringify','error','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1b5c7d,_0x9d1a10){var _0x4ed443=function(_0x310a7f){while(--_0x310a7f){_0x1b5c7d['push'](_0x1b5c7d['shift']());}};_0x4ed443(++_0x9d1a10);}(_0xc117,0xd8));var _0x7c11=function(_0x17e6c1,_0x3a3db8){_0x17e6c1=_0x17e6c1-0x0;var _0x3c9517=_0xc117[_0x17e6c1];return _0x3c9517;};'use strict';var _=require(_0x7c11('0x0'));var util=require(_0x7c11('0x1'));var moment=require(_0x7c11('0x2'));var BPromise=require(_0x7c11('0x3'));var rs=require(_0x7c11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c11('0x5'));var logger=require('../../config/logger')(_0x7c11('0x6'));var config=require(_0x7c11('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c11('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f71fd,_0x36eb52,_0x2252d8){return new BPromise(function(_0x4bfd9c,_0x32dc6b){return client[_0x7c11('0x9')](_0x3f71fd,_0x2252d8)[_0x7c11('0xa')](function(_0x4ffbcd){logger[_0x7c11('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x36eb52,_0x7c11('0xc'));logger[_0x7c11('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x36eb52,_0x7c11('0xc'),JSON[_0x7c11('0xe')](_0x4ffbcd));if(_0x4ffbcd[_0x7c11('0xf')]){if(_0x4ffbcd[_0x7c11('0xf')]['code']===0x1f4){logger[_0x7c11('0xf')](_0x7c11('0x10'),_0x36eb52,_0x4ffbcd[_0x7c11('0xf')]['message']);return _0x32dc6b(_0x4ffbcd[_0x7c11('0xf')][_0x7c11('0x11')]);}logger[_0x7c11('0xf')](_0x7c11('0x10'),_0x36eb52,_0x4ffbcd[_0x7c11('0xf')]['message']);return _0x4bfd9c(_0x4ffbcd['error']['message']);}else{logger[_0x7c11('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x36eb52,'request\x20sent');_0x4bfd9c(_0x4ffbcd[_0x7c11('0x12')]['message']);}})[_0x7c11('0x13')](function(_0x8fec3){logger[_0x7c11('0xf')](_0x7c11('0x10'),_0x36eb52,_0x8fec3);_0x32dc6b(_0x8fec3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index b25328e..e92c824 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x111120,_0x3c67cd){var _0x3e5981=function(_0x1b7ad5){while(--_0x1b7ad5){_0x111120['push'](_0x111120['shift']());}};_0x3e5981(++_0x3c67cd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0xcb91[_0x5d9867];return _0x7d2118;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x9f897b,_0x2bc0f7){var _0x595177=function(_0x45f07f){while(--_0x45f07f){_0x9f897b['push'](_0x9f897b['shift']());}};_0x595177(++_0x2bc0f7);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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 613b7b2..8722cc4 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 _0x1a01=['exports','INTEGER'];(function(_0x2356e3,_0x3c1521){var _0x12e9f7=function(_0x47acc9){while(--_0x47acc9){_0x2356e3['push'](_0x2356e3['shift']());}};_0x12e9f7(++_0x3c1521);}(_0x1a01,0x162));var _0x11a0=function(_0x47e68c,_0x4d6cd5){_0x47e68c=_0x47e68c-0x0;var _0x5fade6=_0x1a01[_0x47e68c];return _0x5fade6;};'use strict';var Sequelize=require('sequelize');module[_0x11a0('0x0')]={'penalty':{'type':Sequelize[_0x11a0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2126=['exports','sequelize'];(function(_0x4bfe6f,_0x2a4e4c){var _0x388d9e=function(_0x357b8a){while(--_0x357b8a){_0x4bfe6f['push'](_0x4bfe6f['shift']());}};_0x388d9e(++_0x2a4e4c);}(_0x2126,0x151));var _0x6212=function(_0x584b1a,_0x5b4d87){_0x584b1a=_0x584b1a-0x0;var _0x1a72aa=_0x2126[_0x584b1a];return _0x1a72aa;};'use strict';var Sequelize=require(_0x6212('0x0'));module[_0x6212('0x1')]={'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 11e4bf8..ffa138b 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 _0x70e0=['user_has_voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes'];(function(_0x4ee0ba,_0x340d2c){var _0x52917f=function(_0x4b6de8){while(--_0x4b6de8){_0x4ee0ba['push'](_0x4ee0ba['shift']());}};_0x52917f(++_0x340d2c);}(_0x70e0,0x17b));var _0x070e=function(_0x2d9a93,_0xa80306){_0x2d9a93=_0x2d9a93-0x0;var _0x258dc6=_0x70e0[_0x2d9a93];return _0x258dc6;};'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']('UserVoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x663e=['../../config/environment','define','UserVoiceQueue','user_has_voice_queues','util','api','moment','path','rimraf'];(function(_0xa405f4,_0xa916db){var _0x920fb2=function(_0x4d17fb){while(--_0x4d17fb){_0xa405f4['push'](_0xa405f4['shift']());}};_0x920fb2(++_0xa916db);}(_0x663e,0x109));var _0xe663=function(_0x488dcc,_0x295fa1){_0x488dcc=_0x488dcc-0x0;var _0x47959e=_0x663e[_0x488dcc];return _0x47959e;};'use strict';var _=require('lodash');var util=require(_0xe663('0x0'));var logger=require('../../config/logger')(_0xe663('0x1'));var moment=require(_0xe663('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe663('0x3'));var rimraf=require(_0xe663('0x4'));var config=require(_0xe663('0x5'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x4da513,_0x12e43b){return _0x4da513[_0xe663('0x6')](_0xe663('0x7'),attributes,{'tableName':_0xe663('0x8'),'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 d927f41..14b2a14 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 _0x6a5d=['info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x277607,_0x345a06){var _0x15fe23=function(_0x336de7){while(--_0x336de7){_0x277607['push'](_0x277607['shift']());}};_0x15fe23(++_0x345a06);}(_0x6a5d,0x121));var _0xd6a5=function(_0x183ca3,_0x494231){_0x183ca3=_0x183ca3-0x0;var _0x735fa=_0x6a5d[_0x183ca3];return _0x735fa;};'use strict';var _=require('lodash');var util=require(_0xd6a5('0x0'));var moment=require(_0xd6a5('0x1'));var BPromise=require('bluebird');var rs=require(_0xd6a5('0x2'));var fs=require('fs');var Redis=require(_0xd6a5('0x3'));var db=require(_0xd6a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6a5('0x5'))(_0xd6a5('0x6'));var config=require(_0xd6a5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd6a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e8cdb,_0x534582,_0x263780){return new BPromise(function(_0x12725a,_0x38c8aa){return client[_0xd6a5('0x9')](_0x5e8cdb,_0x263780)[_0xd6a5('0xa')](function(_0x4cd66a){logger['info'](_0xd6a5('0xb'),_0x534582,_0xd6a5('0xc'));logger[_0xd6a5('0xd')](_0xd6a5('0xe'),_0x534582,'request\x20sent',JSON[_0xd6a5('0xf')](_0x4cd66a));if(_0x4cd66a['error']){if(_0x4cd66a[_0xd6a5('0x10')][_0xd6a5('0x11')]===0x1f4){logger[_0xd6a5('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x534582,_0x4cd66a[_0xd6a5('0x10')][_0xd6a5('0x12')]);return _0x38c8aa(_0x4cd66a['error'][_0xd6a5('0x12')]);}logger[_0xd6a5('0x10')](_0xd6a5('0xb'),_0x534582,_0x4cd66a[_0xd6a5('0x10')][_0xd6a5('0x12')]);return _0x12725a(_0x4cd66a[_0xd6a5('0x10')]['message']);}else{logger[_0xd6a5('0x13')](_0xd6a5('0xb'),_0x534582,_0xd6a5('0xc'));_0x12725a(_0x4cd66a[_0xd6a5('0x14')][_0xd6a5('0x12')]);}})[_0xd6a5('0x15')](function(_0x2407fb){logger[_0xd6a5('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x534582,_0x2407fb);_0x38c8aa(_0x2407fb);});});} \ No newline at end of file +var _0xa431=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x130899,_0x47bc29){var _0x253db1=function(_0x248011){while(--_0x248011){_0x130899['push'](_0x130899['shift']());}};_0x253db1(++_0x47bc29);}(_0xa431,0xba));var _0x1a43=function(_0x170425,_0x42e521){_0x170425=_0x170425-0x0;var _0x227aaa=_0xa431[_0x170425];return _0x227aaa;};'use strict';var _=require(_0x1a43('0x0'));var util=require(_0x1a43('0x1'));var moment=require(_0x1a43('0x2'));var BPromise=require(_0x1a43('0x3'));var rs=require(_0x1a43('0x4'));var fs=require('fs');var Redis=require(_0x1a43('0x5'));var db=require(_0x1a43('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a43('0x7'))('rpc');var config=require(_0x1a43('0x8'));var jayson=require(_0x1a43('0x9'));var client=jayson[_0x1a43('0xa')][_0x1a43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e862b,_0x9dffa3,_0x2d2e9c){return new BPromise(function(_0x8bf3fc,_0x2d3fa9){return client[_0x1a43('0xc')](_0x4e862b,_0x2d2e9c)[_0x1a43('0xd')](function(_0x49d0d5){logger[_0x1a43('0xe')](_0x1a43('0xf'),_0x9dffa3,_0x1a43('0x10'));logger[_0x1a43('0x11')](_0x1a43('0x12'),_0x9dffa3,_0x1a43('0x10'),JSON['stringify'](_0x49d0d5));if(_0x49d0d5['error']){if(_0x49d0d5[_0x1a43('0x13')][_0x1a43('0x14')]===0x1f4){logger[_0x1a43('0x13')](_0x1a43('0xf'),_0x9dffa3,_0x49d0d5[_0x1a43('0x13')][_0x1a43('0x15')]);return _0x2d3fa9(_0x49d0d5['error']['message']);}logger[_0x1a43('0x13')](_0x1a43('0xf'),_0x9dffa3,_0x49d0d5['error'][_0x1a43('0x15')]);return _0x8bf3fc(_0x49d0d5[_0x1a43('0x13')]['message']);}else{logger['info'](_0x1a43('0xf'),_0x9dffa3,_0x1a43('0x10'));_0x8bf3fc(_0x49d0d5['result'][_0x1a43('0x15')]);}})[_0x1a43('0x16')](function(_0x1af411){logger[_0x1a43('0x13')](_0x1a43('0xf'),_0x9dffa3,_0x1af411);_0x2d3fa9(_0x1af411);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 39fc981..5e98544 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(_0x1d6278,_0x373bef){var _0x311895=function(_0xea5e0d){while(--_0xea5e0d){_0x1d6278['push'](_0x1d6278['shift']());}};_0x311895(++_0x373bef);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x48a280,_0xe22cfe){var _0x2f31be=function(_0x2b8397){while(--_0x2b8397){_0x48a280['push'](_0x48a280['shift']());}};_0x2f31be(++_0xe22cfe);}(_0xe706,0xa3));var _0x6e70=function(_0x465c3b,_0x384cf1){_0x465c3b=_0x465c3b-0x0;var _0x67f5d8=_0xe706[_0x465c3b];return _0x67f5d8;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9e0a73e..e895b6a 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 _0xf1c7=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','INTEGER'];(function(_0x7275c4,_0x3df218){var _0x7df0c2=function(_0x253f17){while(--_0x253f17){_0x7275c4['push'](_0x7275c4['shift']());}};_0x7df0c2(++_0x3df218);}(_0xf1c7,0x193));var _0x7f1c=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0xf1c7[_0x237546];return _0x233e29;};'use strict';var Sequelize=require(_0x7f1c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7f1c('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x7f1c('0x2')],'allowNull':![],'comment':_0x7f1c('0x3')},'UserId':{'type':Sequelize[_0x7f1c('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7f1c('0x2')],'allowNull':![],'unique':_0x7f1c('0x4'),'comment':_0x7f1c('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7f1c('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x7f1c('0x2')],'allowNull':![],'unique':_0x7f1c('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x7f1c('0x3')},'paused':{'type':Sequelize[_0x7f1c('0x1')](0xb),'defaultValue':0x0,'comment':_0x7f1c('0x3')}}; \ No newline at end of file +var _0x38ec=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x38ec,0xfa));var _0xc38e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x38ec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc38e('0x0'));module[_0xc38e('0x1')]={'uniqueid':{'type':Sequelize[_0xc38e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc38e('0x3')},'membername':{'type':Sequelize[_0xc38e('0x4')],'allowNull':![],'comment':_0xc38e('0x3')},'UserId':{'type':Sequelize[_0xc38e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc38e('0x4')],'allowNull':![],'unique':_0xc38e('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xc38e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xc38e('0x4')],'allowNull':![],'unique':_0xc38e('0x5'),'comment':_0xc38e('0x3')},'penalty':{'type':Sequelize[_0xc38e('0x2')](0xb),'defaultValue':0x0,'comment':_0xc38e('0x3')},'paused':{'type':Sequelize[_0xc38e('0x2')](0xb),'defaultValue':0x0,'comment':_0xc38e('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 1101f26..3e82a09 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 _0x6629=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x555b48,_0x27365a){var _0x537d2f=function(_0x458cd1){while(--_0x458cd1){_0x555b48['push'](_0x555b48['shift']());}};_0x537d2f(++_0x27365a);}(_0x6629,0x172));var _0x9662=function(_0x122839,_0x2bcaeb){_0x122839=_0x122839-0x0;var _0x6724b3=_0x6629[_0x122839];return _0x6724b3;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x9662('0x0'))['db'][_0x9662('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9662('0x2')](0x0);var events={'afterCreate':_0x9662('0x3'),'afterUpdate':_0x9662('0x4'),'afterDestroy':_0x9662('0x5')};function emitEvent(_0x361f9d){return function(_0x4b2c3d,_0x253d08,_0x2a2cdd){UserVoiceQueueRtEvents['emit'](_0x361f9d+':'+_0x4b2c3d['id'],_0x4b2c3d);UserVoiceQueueRtEvents[_0x9662('0x6')](_0x361f9d,_0x4b2c3d);_0x2a2cdd(null);};}for(var e in events){if(events[_0x9662('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x9662('0x8')](e,emitEvent(event));}}module[_0x9662('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3ffc=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x1a32e7,_0x408b28){var _0x5466f5=function(_0xa34865){while(--_0xa34865){_0x1a32e7['push'](_0x1a32e7['shift']());}};_0x5466f5(++_0x408b28);}(_0x3ffc,0x192));var _0xc3ff=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x3ffc[_0x476bf4];return _0x788ffe;};'use strict';var EventEmitter=require(_0xc3ff('0x0'));var UserVoiceQueueRt=require(_0xc3ff('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc3ff('0x2')](0x0);var events={'afterCreate':_0xc3ff('0x3'),'afterUpdate':_0xc3ff('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c8188){return function(_0x335c55,_0x3975bc,_0x17e467){UserVoiceQueueRtEvents['emit'](_0x2c8188+':'+_0x335c55['id'],_0x335c55);UserVoiceQueueRtEvents[_0xc3ff('0x5')](_0x2c8188,_0x335c55);_0x17e467(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xc3ff('0x6')](e,emitEvent(event));}}module[_0xc3ff('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index fe9d002..20115ea 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 _0x2bd5=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','request-promise','path','rimraf','define','UserVoiceQueueRt'];(function(_0x48562d,_0x3ca202){var _0x658f0a=function(_0x52b83f){while(--_0x52b83f){_0x48562d['push'](_0x48562d['shift']());}};_0x658f0a(++_0x3ca202);}(_0x2bd5,0x169));var _0x52bd=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x2bd5[_0x2ac5f8];return _0x3b8229;};'use strict';var _=require(_0x52bd('0x0'));var util=require(_0x52bd('0x1'));var logger=require(_0x52bd('0x2'))(_0x52bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52bd('0x4'));var fs=require('fs');var path=require(_0x52bd('0x5'));var rimraf=require(_0x52bd('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x3cdb64,_0x3e550f){return _0x3cdb64[_0x52bd('0x7')](_0x52bd('0x8'),attributes,{'tableName':_0x52bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc110=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0xc110,0x1ab));var _0x0c11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc110[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c11('0x0'));var util=require(_0x0c11('0x1'));var logger=require(_0x0c11('0x2'))(_0x0c11('0x3'));var moment=require(_0x0c11('0x4'));var BPromise=require(_0x0c11('0x5'));var rp=require(_0x0c11('0x6'));var fs=require('fs');var path=require(_0x0c11('0x7'));var rimraf=require(_0x0c11('0x8'));var config=require(_0x0c11('0x9'));var attributes=require(_0x0c11('0xa'));module[_0x0c11('0xb')]=function(_0x56dabc,_0x2367f){return _0x56dabc['define'](_0x0c11('0xc'),attributes,{'tableName':_0x0c11('0xd'),'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 a3a7950..f04a69e 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 _0x8ecf=['error','code','message','info','result','catch','GetVoiceQueueRtPauses','findAll','options','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x18d9cf,_0x48e82c){var _0x1850b8=function(_0x4598d4){while(--_0x4598d4){_0x18d9cf['push'](_0x18d9cf['shift']());}};_0x1850b8(++_0x48e82c);}(_0x8ecf,0x7a));var _0xf8ec=function(_0x20b1e,_0x670e43){_0x20b1e=_0x20b1e-0x0;var _0x35d4e=_0x8ecf[_0x20b1e];return _0x35d4e;};'use strict';var _=require(_0xf8ec('0x0'));var util=require(_0xf8ec('0x1'));var moment=require(_0xf8ec('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8ec('0x3'));var fs=require('fs');var Redis=require(_0xf8ec('0x4'));var db=require(_0xf8ec('0x5'))['db'];var utils=require(_0xf8ec('0x6'));var logger=require(_0xf8ec('0x7'))(_0xf8ec('0x8'));var config=require(_0xf8ec('0x9'));var jayson=require(_0xf8ec('0xa'));var client=jayson[_0xf8ec('0xb')][_0xf8ec('0xc')]({'port':0x232a});config[_0xf8ec('0xd')]=_['defaults'](config[_0xf8ec('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8ec('0xe'))(new Redis(config[_0xf8ec('0xd')]));require('./userVoiceQueueRt.socket')[_0xf8ec('0xf')](socket);function respondWithRpcPromise(_0x2eb71f,_0x39c60e,_0x1ae595){return new BPromise(function(_0xb31083,_0x109649){return client[_0xf8ec('0x10')](_0x2eb71f,_0x1ae595)[_0xf8ec('0x11')](function(_0x48bb37){logger['info'](_0xf8ec('0x12'),_0x39c60e,'request\x20sent');logger[_0xf8ec('0x13')](_0xf8ec('0x14'),_0x39c60e,_0xf8ec('0x15'),JSON['stringify'](_0x48bb37));if(_0x48bb37[_0xf8ec('0x16')]){if(_0x48bb37['error'][_0xf8ec('0x17')]===0x1f4){logger[_0xf8ec('0x16')](_0xf8ec('0x12'),_0x39c60e,_0x48bb37['error']['message']);return _0x109649(_0x48bb37['error'][_0xf8ec('0x18')]);}logger[_0xf8ec('0x16')](_0xf8ec('0x12'),_0x39c60e,_0x48bb37[_0xf8ec('0x16')][_0xf8ec('0x18')]);return _0xb31083(_0x48bb37[_0xf8ec('0x16')]['message']);}else{logger[_0xf8ec('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x39c60e,_0xf8ec('0x15'));_0xb31083(_0x48bb37[_0xf8ec('0x1a')][_0xf8ec('0x18')]);}})[_0xf8ec('0x1b')](function(_0x568ecf){logger[_0xf8ec('0x16')](_0xf8ec('0x12'),_0x39c60e,_0x568ecf);_0x109649(_0x568ecf);});});}exports[_0xf8ec('0x1c')]=function(_0x16c722){var _0x538248=this;return new Promise(function(_0x5be10c,_0x21aed3){return db['UserVoiceQueueRt'][_0xf8ec('0x1d')]({'raw':_0x16c722['options']?_0x16c722[_0xf8ec('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x16c722[_0xf8ec('0x1e')]?_0x16c722['options'][_0xf8ec('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf8ec('0x20'),db[_0xf8ec('0x21')]['fn']('IF',db[_0xf8ec('0x21')][_0xf8ec('0x22')](_0xf8ec('0x23')))),'outboundQueuePauses']]})[_0xf8ec('0x11')](function(_0x3dae7e){logger['info'](_0xf8ec('0x1c'),_0x16c722);logger[_0xf8ec('0x13')](_0xf8ec('0x1c'),_0x16c722,JSON['stringify'](_0x3dae7e));_0x5be10c(_0x3dae7e);})['catch'](function(_0x3ecf8f){logger[_0xf8ec('0x16')](_0xf8ec('0x1c'),_0x3ecf8f[_0xf8ec('0x18')],_0x16c722);_0x21aed3(_0x538248[_0xf8ec('0x16')](0x1f4,_0x3ecf8f[_0xf8ec('0x18')]));});});}; \ No newline at end of file +var _0xbdda=['then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request'];(function(_0x3241ee,_0x56ff99){var _0x407773=function(_0x16d6c4){while(--_0x16d6c4){_0x3241ee['push'](_0x3241ee['shift']());}};_0x407773(++_0x56ff99);}(_0xbdda,0x19f));var _0xabdd=function(_0x121791,_0x4d426a){_0x121791=_0x121791-0x0;var _0x59ae49=_0xbdda[_0x121791];return _0x59ae49;};'use strict';var _=require(_0xabdd('0x0'));var util=require(_0xabdd('0x1'));var moment=require('moment');var BPromise=require(_0xabdd('0x2'));var rs=require(_0xabdd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabdd('0x4'))['db'];var utils=require(_0xabdd('0x5'));var logger=require(_0xabdd('0x6'))(_0xabdd('0x7'));var config=require('../../config/environment');var jayson=require(_0xabdd('0x8'));var client=jayson[_0xabdd('0x9')][_0xabdd('0xa')]({'port':0x232a});config[_0xabdd('0xb')]=_[_0xabdd('0xc')](config[_0xabdd('0xb')],{'host':_0xabdd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabdd('0xb')]));require(_0xabdd('0xe'))[_0xabdd('0xf')](socket);function respondWithRpcPromise(_0x58ba56,_0x42a2f7,_0x303e19){return new BPromise(function(_0x1dcce5,_0x31c110){return client[_0xabdd('0x10')](_0x58ba56,_0x303e19)[_0xabdd('0x11')](function(_0x44ca74){logger[_0xabdd('0x12')](_0xabdd('0x13'),_0x42a2f7,_0xabdd('0x14'));logger[_0xabdd('0x15')](_0xabdd('0x16'),_0x42a2f7,'request\x20sent',JSON[_0xabdd('0x17')](_0x44ca74));if(_0x44ca74['error']){if(_0x44ca74['error']['code']===0x1f4){logger[_0xabdd('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42a2f7,_0x44ca74['error']['message']);return _0x31c110(_0x44ca74[_0xabdd('0x18')][_0xabdd('0x19')]);}logger['error'](_0xabdd('0x13'),_0x42a2f7,_0x44ca74['error'][_0xabdd('0x19')]);return _0x1dcce5(_0x44ca74[_0xabdd('0x18')][_0xabdd('0x19')]);}else{logger[_0xabdd('0x12')](_0xabdd('0x13'),_0x42a2f7,_0xabdd('0x14'));_0x1dcce5(_0x44ca74[_0xabdd('0x1a')][_0xabdd('0x19')]);}})[_0xabdd('0x1b')](function(_0x1a6243){logger[_0xabdd('0x18')](_0xabdd('0x13'),_0x42a2f7,_0x1a6243);_0x31c110(_0x1a6243);});});}exports[_0xabdd('0x1c')]=function(_0x11b105){var _0x501d2d=this;return new Promise(function(_0x495360,_0x478bfe){return db['UserVoiceQueueRt']['findAll']({'raw':_0x11b105[_0xabdd('0x1d')]?_0x11b105[_0xabdd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x11b105[_0xabdd('0x1d')]?_0x11b105[_0xabdd('0x1d')][_0xabdd('0x1e')]||null:null,'attributes':[[db[_0xabdd('0x1f')]['fn'](_0xabdd('0x20'),db[_0xabdd('0x1f')]['fn']('IF',db['sequelize'][_0xabdd('0x21')](_0xabdd('0x22')))),_0xabdd('0x23')]]})[_0xabdd('0x11')](function(_0x3857f7){logger['info'](_0xabdd('0x1c'),_0x11b105);logger['debug'](_0xabdd('0x1c'),_0x11b105,JSON['stringify'](_0x3857f7));_0x495360(_0x3857f7);})['catch'](function(_0x2901e4){logger[_0xabdd('0x18')]('GetVoiceQueueRtPauses',_0x2901e4['message'],_0x11b105);_0x478bfe(_0x501d2d['error'](0x1f4,_0x2901e4['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 3e48f21..7d9e54e 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 _0x0b3d=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x0b3d,0x76));var _0xd0b3=function(_0x1bc59a,_0x22d2c3){_0x1bc59a=_0x1bc59a-0x0;var _0x3ab7a4=_0x0b3d[_0x1bc59a];return _0x3ab7a4;};'use strict';var UserVoiceQueueRtEvents=require(_0xd0b3('0x0'));var events=['save',_0xd0b3('0x1'),'update'];function createListener(_0x44585b,_0x5cd26e){return function(_0x2e82a6){_0x5cd26e['emit'](_0x44585b,_0x2e82a6);};}function removeListener(_0x372f08,_0x50faaa){return function(){UserVoiceQueueRtEvents[_0xd0b3('0x2')](_0x372f08,_0x50faaa);};}exports[_0xd0b3('0x3')]=function(_0x5b80df){for(var _0x2968c9=0x0,_0x5bc883=events[_0xd0b3('0x4')];_0x2968c9<_0x5bc883;_0x2968c9++){var _0x5f3196=events[_0x2968c9];var _0x5ab5b2=createListener(_0xd0b3('0x5')+_0x5f3196,_0x5b80df);UserVoiceQueueRtEvents['on'](_0x5f3196,_0x5ab5b2);}}; \ No newline at end of file +var _0xd8af=['length','./userVoiceQueueRt.events','save','remove','update','removeListener'];(function(_0x5b58da,_0x24e26e){var _0x1d3f87=function(_0x5d64e2){while(--_0x5d64e2){_0x5b58da['push'](_0x5b58da['shift']());}};_0x1d3f87(++_0x24e26e);}(_0xd8af,0x18d));var _0xfd8a=function(_0x2a7ae2,_0x136299){_0x2a7ae2=_0x2a7ae2-0x0;var _0x40c0a5=_0xd8af[_0x2a7ae2];return _0x40c0a5;};'use strict';var UserVoiceQueueRtEvents=require(_0xfd8a('0x0'));var events=[_0xfd8a('0x1'),_0xfd8a('0x2'),_0xfd8a('0x3')];function createListener(_0xe6bc6c,_0x58728d){return function(_0x307508){_0x58728d['emit'](_0xe6bc6c,_0x307508);};}function removeListener(_0x1252b1,_0x151b88){return function(){UserVoiceQueueRtEvents[_0xfd8a('0x4')](_0x1252b1,_0x151b88);};}exports['register']=function(_0x44c7ed){for(var _0x4c7603=0x0,_0x8b725c=events[_0xfd8a('0x5')];_0x4c7603<_0x8b725c;_0x4c7603++){var _0x31fdfc=events[_0x4c7603];var _0x1d1fb4=createListener('userVoiceQueueRt:'+_0x31fdfc,_0x44c7ed);UserVoiceQueueRtEvents['on'](_0x31fdfc,_0x1d1fb4);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a5b2ef5..8f580a1 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5d7574,_0x48ccff){var _0x3270ce=function(_0x27379d){while(--_0x27379d){_0x5d7574['push'](_0x5d7574['shift']());}};_0x3270ce(++_0x48ccff);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0xcb91[_0x199c03];return _0x11a7d4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x451d28,_0x1bca56){var _0x3a4497=function(_0x30bdb5){while(--_0x30bdb5){_0x451d28['push'](_0x451d28['shift']());}};_0x3a4497(++_0x1bca56);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 4108df5..17d6652 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 _0xd4a5=['exports','INTEGER'];(function(_0x2f8af8,_0x2c67fa){var _0x46a209=function(_0x5761d5){while(--_0x5761d5){_0x2f8af8['push'](_0x2f8af8['shift']());}};_0x46a209(++_0x2c67fa);}(_0xd4a5,0x166));var _0x5d4a=function(_0x10973d,_0x394a27){_0x10973d=_0x10973d-0x0;var _0x685fc5=_0xd4a5[_0x10973d];return _0x685fc5;};'use strict';var Sequelize=require('sequelize');module[_0x5d4a('0x0')]={'penalty':{'type':Sequelize[_0x5d4a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa969=['sequelize','exports','INTEGER'];(function(_0x514a57,_0x3f68f0){var _0x5814ac=function(_0x538d37){while(--_0x538d37){_0x514a57['push'](_0x514a57['shift']());}};_0x5814ac(++_0x3f68f0);}(_0xa969,0x114));var _0x9a96=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0xa969[_0x870b62];return _0x2dcb39;};'use strict';var Sequelize=require(_0x9a96('0x0'));module[_0x9a96('0x1')]={'penalty':{'type':Sequelize[_0x9a96('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 af9c950..51364cc 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 _0x961a=['./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x173afd,_0x17ba6c){var _0x2fee60=function(_0x53dc66){while(--_0x53dc66){_0x173afd['push'](_0x173afd['shift']());}};_0x2fee60(++_0x17ba6c);}(_0x961a,0x197));var _0xa961=function(_0x27d158,_0x47b847){_0x27d158=_0x27d158-0x0;var _0x1a7017=_0x961a[_0x27d158];return _0x1a7017;};'use strict';var _=require(_0xa961('0x0'));var util=require(_0xa961('0x1'));var logger=require('../../config/logger')(_0xa961('0x2'));var moment=require(_0xa961('0x3'));var BPromise=require(_0xa961('0x4'));var rp=require(_0xa961('0x5'));var fs=require('fs');var path=require(_0xa961('0x6'));var rimraf=require(_0xa961('0x7'));var config=require(_0xa961('0x8'));var attributes=require(_0xa961('0x9'));module[_0xa961('0xa')]=function(_0x18f2bf,_0x3b5a05){return _0x18f2bf['define'](_0xa961('0xb'),attributes,{'tableName':_0xa961('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92f8=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2b6b92,_0x57303d){var _0x2233dc=function(_0x310e88){while(--_0x310e88){_0x2b6b92['push'](_0x2b6b92['shift']());}};_0x2233dc(++_0x57303d);}(_0x92f8,0x1aa));var _0x892f=function(_0x17156d,_0x27443a){_0x17156d=_0x17156d-0x0;var _0x22f8cd=_0x92f8[_0x17156d];return _0x22f8cd;};'use strict';var _=require(_0x892f('0x0'));var util=require(_0x892f('0x1'));var logger=require(_0x892f('0x2'))(_0x892f('0x3'));var moment=require(_0x892f('0x4'));var BPromise=require(_0x892f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x892f('0x6'));var rimraf=require(_0x892f('0x7'));var config=require(_0x892f('0x8'));var attributes=require(_0x892f('0x9'));module['exports']=function(_0x1a57c6,_0x475584){return _0x1a57c6[_0x892f('0xa')](_0x892f('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index f03ff68..e55de61 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 _0x6af0=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xecb200,_0x349441){var _0x3dce03=function(_0x4a6a51){while(--_0x4a6a51){_0xecb200['push'](_0xecb200['shift']());}};_0x3dce03(++_0x349441);}(_0x6af0,0xdc));var _0x06af=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x6af0[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x06af('0x0'));var util=require(_0x06af('0x1'));var moment=require('moment');var BPromise=require(_0x06af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x06af('0x4'));var logger=require('../../config/logger')(_0x06af('0x5'));var config=require(_0x06af('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x06af('0x7')][_0x06af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1677f5,_0x5d9372,_0x28e834){return new BPromise(function(_0xf4d499,_0x17a416){return client[_0x06af('0x9')](_0x1677f5,_0x28e834)[_0x06af('0xa')](function(_0x967e15){logger['info'](_0x06af('0xb'),_0x5d9372,_0x06af('0xc'));logger[_0x06af('0xd')](_0x06af('0xe'),_0x5d9372,_0x06af('0xc'),JSON[_0x06af('0xf')](_0x967e15));if(_0x967e15[_0x06af('0x10')]){if(_0x967e15[_0x06af('0x10')][_0x06af('0x11')]===0x1f4){logger[_0x06af('0x10')](_0x06af('0xb'),_0x5d9372,_0x967e15[_0x06af('0x10')]['message']);return _0x17a416(_0x967e15['error']['message']);}logger[_0x06af('0x10')](_0x06af('0xb'),_0x5d9372,_0x967e15[_0x06af('0x10')][_0x06af('0x12')]);return _0xf4d499(_0x967e15[_0x06af('0x10')]['message']);}else{logger['info'](_0x06af('0xb'),_0x5d9372,'request\x20sent');_0xf4d499(_0x967e15[_0x06af('0x13')][_0x06af('0x12')]);}})['catch'](function(_0x4d1d68){logger[_0x06af('0x10')](_0x06af('0xb'),_0x5d9372,_0x4d1d68);_0x17a416(_0x4d1d68);});});} \ No newline at end of file +var _0xd7b8=['UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xb32865,_0x6b382b){var _0x225ff3=function(_0x15cb13){while(--_0x15cb13){_0xb32865['push'](_0xb32865['shift']());}};_0x225ff3(++_0x6b382b);}(_0xd7b8,0xc0));var _0x8d7b=function(_0x35756b,_0x275521){_0x35756b=_0x35756b-0x0;var _0x16bc18=_0xd7b8[_0x35756b];return _0x16bc18;};'use strict';var _=require(_0x8d7b('0x0'));var util=require(_0x8d7b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d7b('0x2'));var fs=require('fs');var Redis=require(_0x8d7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d7b('0x4'));var logger=require(_0x8d7b('0x5'))('rpc');var config=require(_0x8d7b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8d7b('0x7')][_0x8d7b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x182471,_0x2e385d,_0x14ff9f){return new BPromise(function(_0x451fec,_0x3227ec){return client[_0x8d7b('0x9')](_0x182471,_0x14ff9f)[_0x8d7b('0xa')](function(_0x203629){logger[_0x8d7b('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2e385d,_0x8d7b('0xc'));logger[_0x8d7b('0xd')](_0x8d7b('0xe'),_0x2e385d,_0x8d7b('0xc'),JSON[_0x8d7b('0xf')](_0x203629));if(_0x203629[_0x8d7b('0x10')]){if(_0x203629[_0x8d7b('0x10')]['code']===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x2e385d,_0x203629[_0x8d7b('0x10')][_0x8d7b('0x11')]);return _0x3227ec(_0x203629[_0x8d7b('0x10')]['message']);}logger[_0x8d7b('0x10')](_0x8d7b('0x12'),_0x2e385d,_0x203629[_0x8d7b('0x10')][_0x8d7b('0x11')]);return _0x451fec(_0x203629[_0x8d7b('0x10')][_0x8d7b('0x11')]);}else{logger[_0x8d7b('0xb')](_0x8d7b('0x12'),_0x2e385d,_0x8d7b('0xc'));_0x451fec(_0x203629[_0x8d7b('0x13')]['message']);}})[_0x8d7b('0x14')](function(_0x5f1573){logger[_0x8d7b('0x10')](_0x8d7b('0x12'),_0x2e385d,_0x5f1573);_0x3227ec(_0x5f1573);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c625d81..6f59564 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 _0xec56=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x18ef8e,_0x470e81){var _0x50cb94=function(_0xfb6e46){while(--_0xfb6e46){_0x18ef8e['push'](_0x18ef8e['shift']());}};_0x50cb94(++_0x470e81);}(_0xec56,0x1bd));var _0x6ec5=function(_0x172802,_0x595403){_0x172802=_0x172802-0x0;var _0x44f658=_0xec56[_0x172802];return _0x44f658;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0xe')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router[_0x6ec5('0x10')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x13')]);module[_0x6ec5('0x14')]=router; \ No newline at end of file +var _0x6c6f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x47070e,_0x45185d){_0x47070e=_0x47070e-0x0;var _0x144d4e=_0x6c6f[_0x47070e];return _0x144d4e;};'use strict';var multer=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var path=require(_0xf6c6('0x2'));var timeout=require(_0xf6c6('0x3'));var express=require(_0xf6c6('0x4'));var router=express[_0xf6c6('0x5')]();var fs_extra=require(_0xf6c6('0x6'));var auth=require(_0xf6c6('0x7'));var interaction=require(_0xf6c6('0x8'));var config=require(_0xf6c6('0x9'));var controller=require(_0xf6c6('0xa'));router['get']('/',auth[_0xf6c6('0xb')](),controller['index']);router['get'](_0xf6c6('0xc'),auth['isAuthenticated'](),controller[_0xf6c6('0xd')]);router[_0xf6c6('0xe')]('/',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0xf')]);router[_0xf6c6('0x10')]('/:id',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x11')]);router['delete'](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3f4dd7d..1851a58 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 _0xb95d=['exports','STRING','name','sequelize'];(function(_0x248778,_0x441293){var _0x5c7850=function(_0x1511d8){while(--_0x1511d8){_0x248778['push'](_0x248778['shift']());}};_0x5c7850(++_0x441293);}(_0xb95d,0x13f));var _0xdb95=function(_0xaad974,_0x396049){_0xaad974=_0xaad974-0x0;var _0x3801e9=_0xb95d[_0xaad974];return _0x3801e9;};'use strict';var Sequelize=require(_0xdb95('0x0'));module[_0xdb95('0x1')]={'name':{'type':Sequelize[_0xdb95('0x2')],'unique':_0xdb95('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdb95('0x2')]}}; \ No newline at end of file +var _0x3e1f=['name','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e1f,0x18a));var _0xf3e1=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x3e1f[_0x5ebc04];return _0x17845c;};'use strict';var Sequelize=require('sequelize');module[_0xf3e1('0x0')]={'name':{'type':Sequelize[_0xf3e1('0x1')],'unique':_0xf3e1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4805f07..064a340 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 _0x657d=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','rows','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x657d,0xe1));var _0xd657=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x657d[_0x53fe97];return _0x5c49a2;};'use strict';var emlformat=require(_0xd657('0x0'));var rimraf=require(_0xd657('0x1'));var zipdir=require(_0xd657('0x2'));var jsonpatch=require(_0xd657('0x3'));var rp=require('request-promise');var moment=require(_0xd657('0x4'));var BPromise=require(_0xd657('0x5'));var Mustache=require('mustache');var util=require(_0xd657('0x6'));var path=require('path');var sox=require(_0xd657('0x7'));var csv=require('to-csv');var ejs=require(_0xd657('0x8'));var fs=require('fs');var fs_extra=require(_0xd657('0x9'));var _=require(_0xd657('0xa'));var squel=require(_0xd657('0xb'));var crypto=require(_0xd657('0xc'));var jsforce=require(_0xd657('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd657('0xe'));var Papa=require(_0xd657('0xf'));var Redis=require('ioredis');var authService=require(_0xd657('0x10'));var qs=require(_0xd657('0x11'));var as=require(_0xd657('0x12'));var hardwareService=require(_0xd657('0x13'));var logger=require(_0xd657('0x14'))(_0xd657('0x15'));var utils=require(_0xd657('0x16'));var config=require(_0xd657('0x17'));var licenseUtil=require(_0xd657('0x18'));var db=require(_0xd657('0x19'))['db'];function respondWithStatusCode(_0x18618d,_0x534f68){_0x534f68=_0x534f68||0xcc;return function(_0x55c5af){if(_0x55c5af){return _0x18618d[_0xd657('0x1a')](_0x534f68);}return _0x18618d[_0xd657('0x1b')](_0x534f68)[_0xd657('0x1c')]();};}function respondWithResult(_0x36ddac,_0x21dd26){_0x21dd26=_0x21dd26||0xc8;return function(_0x56bcb7){if(_0x56bcb7){return _0x36ddac[_0xd657('0x1b')](_0x21dd26)[_0xd657('0x1d')](_0x56bcb7);}};}function respondWithFilteredResult(_0x33124c,_0x48ad8a){return function(_0x256a9a){if(_0x256a9a){var _0x3ce6cd=typeof _0x48ad8a[_0xd657('0x1e')]===_0xd657('0x1f')&&typeof _0x48ad8a[_0xd657('0x20')]===_0xd657('0x1f');var _0x44d890=_0x256a9a['count'];var _0x507cd2=_0x3ce6cd?0x0:_0x48ad8a[_0xd657('0x1e')];var _0x23c90c=_0x3ce6cd?_0x256a9a[_0xd657('0x21')]:_0x48ad8a[_0xd657('0x1e')]+_0x48ad8a[_0xd657('0x20')];var _0x59f6cb;if(_0x23c90c>=_0x44d890){_0x23c90c=_0x44d890;_0x59f6cb=0xc8;}else{_0x59f6cb=0xce;}_0x33124c[_0xd657('0x1b')](_0x59f6cb);return _0x33124c[_0xd657('0x22')](_0xd657('0x23'),_0x507cd2+'-'+_0x23c90c+'/'+_0x44d890)['json'](_0x256a9a);}return null;};}function patchUpdates(_0x3475bb){return function(_0x18153b){try{jsonpatch[_0xd657('0x24')](_0x18153b,_0x3475bb,!![]);}catch(_0x240b8f){return BPromise['reject'](_0x240b8f);}return _0x18153b[_0xd657('0x25')]();};}function saveUpdates(_0x159fba,_0x42d193){return function(_0x5ac4a2){if(_0x5ac4a2){return _0x5ac4a2['update'](_0x159fba)[_0xd657('0x26')](function(_0xc1d7f1){return _0xc1d7f1;});}return null;};}function removeEntity(_0x50380e,_0x349c83){return function(_0x5e6604){if(_0x5e6604){return _0x5e6604[_0xd657('0x27')]()[_0xd657('0x26')](function(){var _0x4d2bcf=_0x5e6604[_0xd657('0x28')]({'plain':!![]});var _0x20840b='Variables';return db[_0xd657('0x29')]['destroy']({'where':{'type':_0x20840b,'resourceId':_0x4d2bcf['id']}})[_0xd657('0x26')](function(){return _0x5e6604;});})[_0xd657('0x26')](function(){_0x50380e[_0xd657('0x1b')](0xcc)[_0xd657('0x1c')]();});}};}function handleEntityNotFound(_0x383bee,_0x27bab5){return function(_0x48f90){if(!_0x48f90){_0x383bee[_0xd657('0x1a')](0x194);}return _0x48f90;};}function handleError(_0x57b8bc,_0x47fd99){_0x47fd99=_0x47fd99||0x1f4;return function(_0xb4013a){logger[_0xd657('0x2a')](_0xb4013a[_0xd657('0x2b')]);if(_0xb4013a['name']){delete _0xb4013a[_0xd657('0x2c')];}_0x57b8bc['status'](_0x47fd99)[_0xd657('0x2d')](_0xb4013a);};}exports[_0xd657('0x2e')]=function(_0xef964a,_0x599fc2){var _0x57e15d={},_0x4f2a9a={},_0x1975be={'count':0x0,'rows':[]};var _0x320ba2=_[_0xd657('0x2f')](db[_0xd657('0x30')][_0xd657('0x31')],function(_0x38894c){return{'name':_0x38894c[_0xd657('0x32')],'type':_0x38894c[_0xd657('0x33')][_0xd657('0x34')]};});_0x4f2a9a[_0xd657('0x35')]=_[_0xd657('0x2f')](_0x320ba2,_0xd657('0x2c'));_0x4f2a9a[_0xd657('0x36')]=_[_0xd657('0x37')](_0xef964a[_0xd657('0x36')]);_0x4f2a9a[_0xd657('0x38')]=_[_0xd657('0x39')](_0x4f2a9a[_0xd657('0x35')],_0x4f2a9a[_0xd657('0x36')]);_0x57e15d['attributes']=_[_0xd657('0x39')](_0x4f2a9a[_0xd657('0x35')],qs['fields'](_0xef964a[_0xd657('0x36')][_0xd657('0x3a')]));_0x57e15d[_0xd657('0x3b')]=_0x57e15d[_0xd657('0x3b')][_0xd657('0x3c')]?_0x57e15d['attributes']:_0x4f2a9a[_0xd657('0x35')];if(!_0xef964a[_0xd657('0x36')][_0xd657('0x3d')](_0xd657('0x3e'))){_0x57e15d[_0xd657('0x20')]=qs[_0xd657('0x20')](_0xef964a['query'][_0xd657('0x20')]);_0x57e15d['offset']=qs[_0xd657('0x1e')](_0xef964a[_0xd657('0x36')]['offset']);}_0x57e15d[_0xd657('0x3f')]=qs[_0xd657('0x40')](_0xef964a[_0xd657('0x36')][_0xd657('0x40')]);_0x57e15d[_0xd657('0x41')]=qs[_0xd657('0x38')](_['pick'](_0xef964a['query'],_0x4f2a9a['filters']),_0x320ba2);if(_0xef964a[_0xd657('0x36')][_0xd657('0x42')]){_0x57e15d[_0xd657('0x41')]=_['merge'](_0x57e15d[_0xd657('0x41')],{'$or':_[_0xd657('0x2f')](_0x320ba2,function(_0x391a28){if(_0x391a28['type']!==_0xd657('0x43')){var _0x5b0f66={};_0x5b0f66[_0x391a28[_0xd657('0x2c')]]={'$like':'%'+_0xef964a[_0xd657('0x36')][_0xd657('0x42')]+'%'};return _0x5b0f66;}})});}_0x57e15d=_[_0xd657('0x44')]({},_0x57e15d,_0xef964a[_0xd657('0x45')]);var _0x59a56e={'where':_0x57e15d[_0xd657('0x41')]};return db[_0xd657('0x30')][_0xd657('0x21')](_0x59a56e)[_0xd657('0x26')](function(_0x557d15){_0x1975be[_0xd657('0x21')]=_0x557d15;if(_0xef964a['query']['includeAll']){_0x57e15d[_0xd657('0x46')]=[{'all':!![]}];}return db[_0xd657('0x30')]['findAll'](_0x57e15d);})[_0xd657('0x26')](function(_0x373331){_0x1975be[_0xd657('0x47')]=_0x373331;return _0x1975be;})[_0xd657('0x26')](respondWithFilteredResult(_0x599fc2,_0x57e15d))['catch'](handleError(_0x599fc2,null));};exports['show']=function(_0x5e0be1,_0x378493){var _0x45a38a={'raw':!![],'where':{'id':_0x5e0be1['params']['id']}},_0x390d01={};_0x390d01[_0xd657('0x35')]=_['keys'](db[_0xd657('0x30')][_0xd657('0x31')]);_0x390d01[_0xd657('0x36')]=_[_0xd657('0x37')](_0x5e0be1[_0xd657('0x36')]);_0x390d01[_0xd657('0x38')]=_[_0xd657('0x39')](_0x390d01[_0xd657('0x35')],_0x390d01[_0xd657('0x36')]);_0x45a38a['attributes']=_[_0xd657('0x39')](_0x390d01[_0xd657('0x35')],qs[_0xd657('0x3a')](_0x5e0be1['query'][_0xd657('0x3a')]));_0x45a38a['attributes']=_0x45a38a[_0xd657('0x3b')][_0xd657('0x3c')]?_0x45a38a['attributes']:_0x390d01[_0xd657('0x35')];if(_0x5e0be1[_0xd657('0x36')]['includeAll']){_0x45a38a[_0xd657('0x46')]=[{'all':!![]}];}_0x45a38a=_[_0xd657('0x44')]({},_0x45a38a,_0x5e0be1['options']);return db[_0xd657('0x30')][_0xd657('0x48')](_0x45a38a)[_0xd657('0x26')](handleEntityNotFound(_0x378493,null))[_0xd657('0x26')](respondWithResult(_0x378493,null))['catch'](handleError(_0x378493,null));};exports[_0xd657('0x49')]=function(_0x2e77a5,_0x273b0b){return db[_0xd657('0x30')][_0xd657('0x49')](_0x2e77a5[_0xd657('0x4a')],{})[_0xd657('0x26')](function(_0x1be5f8){var _0x2de916=_0x2e77a5[_0xd657('0x4b')][_0xd657('0x28')]({'plain':!![]});if(!_0x2de916)throw new Error(_0xd657('0x4c'));if(_0x2de916['role']==='user'){var _0xc188d8=_0x1be5f8[_0xd657('0x28')]({'plain':!![]});var _0x49b057=_0xd657('0x4d');return db[_0xd657('0x4e')][_0xd657('0x48')]({'where':{'name':_0x49b057,'userProfileId':_0x2de916[_0xd657('0x4f')]},'raw':!![]})['then'](function(_0x131488){if(_0x131488&&_0x131488[_0xd657('0x50')]===0x0){return db['UserProfileResource'][_0xd657('0x49')]({'name':_0xc188d8['name'],'resourceId':_0xc188d8['id'],'type':_0x131488[_0xd657('0x2c')],'sectionId':_0x131488['id']},{})[_0xd657('0x26')](function(){return _0x1be5f8;});}else{return _0x1be5f8;}})[_0xd657('0x51')](function(_0x593148){logger[_0xd657('0x2a')](_0xd657('0x52'),_0x593148);throw _0x593148;});}return _0x1be5f8;})[_0xd657('0x26')](respondWithResult(_0x273b0b,0xc9))['catch'](handleError(_0x273b0b,null));};exports['update']=function(_0x43a658,_0x3f8679){if(_0x43a658[_0xd657('0x4a')]['id']){delete _0x43a658[_0xd657('0x4a')]['id'];}return db[_0xd657('0x30')][_0xd657('0x48')]({'where':{'id':_0x43a658[_0xd657('0x53')]['id']}})[_0xd657('0x26')](handleEntityNotFound(_0x3f8679,null))['then'](saveUpdates(_0x43a658[_0xd657('0x4a')],null))['then'](respondWithResult(_0x3f8679,null))['catch'](handleError(_0x3f8679,null));};exports[_0xd657('0x27')]=function(_0x54cb30,_0x14bec8){return db['Variable'][_0xd657('0x48')]({'where':{'id':_0x54cb30[_0xd657('0x53')]['id']}})[_0xd657('0x26')](handleEntityNotFound(_0x14bec8,null))[_0xd657('0x26')](removeEntity(_0x14bec8,null))[_0xd657('0x51')](handleError(_0x14bec8,null));}; \ No newline at end of file +var _0xb15f=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','Variables','destroy','error','stack','name','index','Variable','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x5c9f91,_0x270a7a){var _0x53b55e=function(_0x7a32a5){while(--_0x7a32a5){_0x5c9f91['push'](_0x5c9f91['shift']());}};_0x53b55e(++_0x270a7a);}(_0xb15f,0xf7));var _0xfb15=function(_0x5e92e5,_0x106da3){_0x5e92e5=_0x5e92e5-0x0;var _0x1f871d=_0xb15f[_0x5e92e5];return _0x1f871d;};'use strict';var emlformat=require(_0xfb15('0x0'));var rimraf=require(_0xfb15('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb15('0x2'));var rp=require(_0xfb15('0x3'));var moment=require(_0xfb15('0x4'));var BPromise=require(_0xfb15('0x5'));var Mustache=require(_0xfb15('0x6'));var util=require(_0xfb15('0x7'));var path=require('path');var sox=require(_0xfb15('0x8'));var csv=require(_0xfb15('0x9'));var ejs=require(_0xfb15('0xa'));var fs=require('fs');var fs_extra=require(_0xfb15('0xb'));var _=require(_0xfb15('0xc'));var squel=require(_0xfb15('0xd'));var crypto=require('crypto');var jsforce=require(_0xfb15('0xe'));var deskjs=require(_0xfb15('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfb15('0x10'));var Papa=require(_0xfb15('0x11'));var Redis=require(_0xfb15('0x12'));var authService=require(_0xfb15('0x13'));var qs=require(_0xfb15('0x14'));var as=require(_0xfb15('0x15'));var hardwareService=require(_0xfb15('0x16'));var logger=require('../../config/logger')(_0xfb15('0x17'));var utils=require(_0xfb15('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfb15('0x19'))['db'];function respondWithStatusCode(_0x3155b7,_0x4394ac){_0x4394ac=_0x4394ac||0xcc;return function(_0x3ff60d){if(_0x3ff60d){return _0x3155b7[_0xfb15('0x1a')](_0x4394ac);}return _0x3155b7[_0xfb15('0x1b')](_0x4394ac)[_0xfb15('0x1c')]();};}function respondWithResult(_0x23df71,_0x3ea0f0){_0x3ea0f0=_0x3ea0f0||0xc8;return function(_0x499cb0){if(_0x499cb0){return _0x23df71[_0xfb15('0x1b')](_0x3ea0f0)[_0xfb15('0x1d')](_0x499cb0);}};}function respondWithFilteredResult(_0x2ab983,_0x142d95){return function(_0x451b0a){if(_0x451b0a){var _0x541b86=typeof _0x142d95[_0xfb15('0x1e')]===_0xfb15('0x1f')&&typeof _0x142d95[_0xfb15('0x20')]===_0xfb15('0x1f');var _0x121eac=_0x451b0a['count'];var _0x10b062=_0x541b86?0x0:_0x142d95[_0xfb15('0x1e')];var _0x26d37f=_0x541b86?_0x451b0a[_0xfb15('0x21')]:_0x142d95[_0xfb15('0x1e')]+_0x142d95[_0xfb15('0x20')];var _0x2f770b;if(_0x26d37f>=_0x121eac){_0x26d37f=_0x121eac;_0x2f770b=0xc8;}else{_0x2f770b=0xce;}_0x2ab983[_0xfb15('0x1b')](_0x2f770b);return _0x2ab983[_0xfb15('0x22')](_0xfb15('0x23'),_0x10b062+'-'+_0x26d37f+'/'+_0x121eac)[_0xfb15('0x1d')](_0x451b0a);}return null;};}function patchUpdates(_0x4a0d9c){return function(_0x43c055){try{jsonpatch['apply'](_0x43c055,_0x4a0d9c,!![]);}catch(_0x170d08){return BPromise[_0xfb15('0x24')](_0x170d08);}return _0x43c055['save']();};}function saveUpdates(_0x4ff2f5,_0x408068){return function(_0x366f50){if(_0x366f50){return _0x366f50[_0xfb15('0x25')](_0x4ff2f5)[_0xfb15('0x26')](function(_0x517a14){return _0x517a14;});}return null;};}function removeEntity(_0xe75ec6,_0x133789){return function(_0x1bf99c){if(_0x1bf99c){return _0x1bf99c['destroy']()['then'](function(){var _0x2f449a=_0x1bf99c[_0xfb15('0x27')]({'plain':!![]});var _0x193d34=_0xfb15('0x28');return db['UserProfileResource'][_0xfb15('0x29')]({'where':{'type':_0x193d34,'resourceId':_0x2f449a['id']}})['then'](function(){return _0x1bf99c;});})[_0xfb15('0x26')](function(){_0xe75ec6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0e67,_0x34ca2b){return function(_0xdb8542){if(!_0xdb8542){_0x3b0e67[_0xfb15('0x1a')](0x194);}return _0xdb8542;};}function handleError(_0x160385,_0x2b7ae9){_0x2b7ae9=_0x2b7ae9||0x1f4;return function(_0x54ba1c){logger[_0xfb15('0x2a')](_0x54ba1c[_0xfb15('0x2b')]);if(_0x54ba1c[_0xfb15('0x2c')]){delete _0x54ba1c[_0xfb15('0x2c')];}_0x160385['status'](_0x2b7ae9)['send'](_0x54ba1c);};}exports[_0xfb15('0x2d')]=function(_0x429689,_0x6cb16d){var _0x44c1f9={},_0x587676={},_0x45db8e={'count':0x0,'rows':[]};var _0x351276=_['map'](db[_0xfb15('0x2e')][_0xfb15('0x2f')],function(_0x3a2afc){return{'name':_0x3a2afc[_0xfb15('0x30')],'type':_0x3a2afc[_0xfb15('0x31')][_0xfb15('0x32')]};});_0x587676[_0xfb15('0x33')]=_['map'](_0x351276,_0xfb15('0x2c'));_0x587676[_0xfb15('0x34')]=_[_0xfb15('0x35')](_0x429689[_0xfb15('0x34')]);_0x587676['filters']=_[_0xfb15('0x36')](_0x587676[_0xfb15('0x33')],_0x587676[_0xfb15('0x34')]);_0x44c1f9[_0xfb15('0x37')]=_['intersection'](_0x587676[_0xfb15('0x33')],qs[_0xfb15('0x38')](_0x429689[_0xfb15('0x34')][_0xfb15('0x38')]));_0x44c1f9[_0xfb15('0x37')]=_0x44c1f9[_0xfb15('0x37')][_0xfb15('0x39')]?_0x44c1f9['attributes']:_0x587676['model'];if(!_0x429689['query'][_0xfb15('0x3a')](_0xfb15('0x3b'))){_0x44c1f9[_0xfb15('0x20')]=qs[_0xfb15('0x20')](_0x429689[_0xfb15('0x34')][_0xfb15('0x20')]);_0x44c1f9[_0xfb15('0x1e')]=qs['offset'](_0x429689[_0xfb15('0x34')][_0xfb15('0x1e')]);}_0x44c1f9[_0xfb15('0x3c')]=qs[_0xfb15('0x3d')](_0x429689['query'][_0xfb15('0x3d')]);_0x44c1f9[_0xfb15('0x3e')]=qs['filters'](_[_0xfb15('0x3f')](_0x429689[_0xfb15('0x34')],_0x587676[_0xfb15('0x40')]),_0x351276);if(_0x429689[_0xfb15('0x34')][_0xfb15('0x41')]){_0x44c1f9[_0xfb15('0x3e')]=_[_0xfb15('0x42')](_0x44c1f9[_0xfb15('0x3e')],{'$or':_[_0xfb15('0x43')](_0x351276,function(_0x278011){if(_0x278011[_0xfb15('0x31')]!==_0xfb15('0x44')){var _0x57ba2d={};_0x57ba2d[_0x278011[_0xfb15('0x2c')]]={'$like':'%'+_0x429689['query'][_0xfb15('0x41')]+'%'};return _0x57ba2d;}})});}_0x44c1f9=_[_0xfb15('0x42')]({},_0x44c1f9,_0x429689['options']);var _0x27729b={'where':_0x44c1f9[_0xfb15('0x3e')]};return db[_0xfb15('0x2e')][_0xfb15('0x21')](_0x27729b)[_0xfb15('0x26')](function(_0x473a3e){_0x45db8e['count']=_0x473a3e;if(_0x429689[_0xfb15('0x34')][_0xfb15('0x45')]){_0x44c1f9[_0xfb15('0x46')]=[{'all':!![]}];}return db[_0xfb15('0x2e')][_0xfb15('0x47')](_0x44c1f9);})['then'](function(_0x1a0a41){_0x45db8e[_0xfb15('0x48')]=_0x1a0a41;return _0x45db8e;})[_0xfb15('0x26')](respondWithFilteredResult(_0x6cb16d,_0x44c1f9))[_0xfb15('0x49')](handleError(_0x6cb16d,null));};exports[_0xfb15('0x4a')]=function(_0x5be48a,_0x3f93e2){var _0x18ce83={'raw':!![],'where':{'id':_0x5be48a[_0xfb15('0x4b')]['id']}},_0x3d4c00={};_0x3d4c00[_0xfb15('0x33')]=_[_0xfb15('0x35')](db[_0xfb15('0x2e')][_0xfb15('0x2f')]);_0x3d4c00[_0xfb15('0x34')]=_['keys'](_0x5be48a['query']);_0x3d4c00[_0xfb15('0x40')]=_[_0xfb15('0x36')](_0x3d4c00[_0xfb15('0x33')],_0x3d4c00['query']);_0x18ce83[_0xfb15('0x37')]=_[_0xfb15('0x36')](_0x3d4c00[_0xfb15('0x33')],qs['fields'](_0x5be48a[_0xfb15('0x34')][_0xfb15('0x38')]));_0x18ce83[_0xfb15('0x37')]=_0x18ce83[_0xfb15('0x37')]['length']?_0x18ce83[_0xfb15('0x37')]:_0x3d4c00[_0xfb15('0x33')];if(_0x5be48a[_0xfb15('0x34')][_0xfb15('0x45')]){_0x18ce83[_0xfb15('0x46')]=[{'all':!![]}];}_0x18ce83=_['merge']({},_0x18ce83,_0x5be48a['options']);return db[_0xfb15('0x2e')][_0xfb15('0x4c')](_0x18ce83)['then'](handleEntityNotFound(_0x3f93e2,null))['then'](respondWithResult(_0x3f93e2,null))[_0xfb15('0x49')](handleError(_0x3f93e2,null));};exports['create']=function(_0x10ee8c,_0x5e4af8){return db[_0xfb15('0x2e')][_0xfb15('0x4d')](_0x10ee8c[_0xfb15('0x4e')],{})[_0xfb15('0x26')](function(_0x1264a){var _0x5e63dc=_0x10ee8c[_0xfb15('0x4f')][_0xfb15('0x27')]({'plain':!![]});if(!_0x5e63dc)throw new Error(_0xfb15('0x50'));if(_0x5e63dc[_0xfb15('0x51')]===_0xfb15('0x4f')){var _0x5ad1ce=_0x1264a[_0xfb15('0x27')]({'plain':!![]});var _0x42ba12=_0xfb15('0x28');return db[_0xfb15('0x52')][_0xfb15('0x4c')]({'where':{'name':_0x42ba12,'userProfileId':_0x5e63dc[_0xfb15('0x53')]},'raw':!![]})[_0xfb15('0x26')](function(_0x17dfee){if(_0x17dfee&&_0x17dfee[_0xfb15('0x54')]===0x0){return db[_0xfb15('0x55')][_0xfb15('0x4d')]({'name':_0x5ad1ce[_0xfb15('0x2c')],'resourceId':_0x5ad1ce['id'],'type':_0x17dfee['name'],'sectionId':_0x17dfee['id']},{})[_0xfb15('0x26')](function(){return _0x1264a;});}else{return _0x1264a;}})[_0xfb15('0x49')](function(_0x549d34){logger['error'](_0xfb15('0x56'),_0x549d34);throw _0x549d34;});}return _0x1264a;})[_0xfb15('0x26')](respondWithResult(_0x5e4af8,0xc9))[_0xfb15('0x49')](handleError(_0x5e4af8,null));};exports[_0xfb15('0x25')]=function(_0x329a80,_0x5d7d4a){if(_0x329a80[_0xfb15('0x4e')]['id']){delete _0x329a80['body']['id'];}return db[_0xfb15('0x2e')][_0xfb15('0x4c')]({'where':{'id':_0x329a80[_0xfb15('0x4b')]['id']}})[_0xfb15('0x26')](handleEntityNotFound(_0x5d7d4a,null))['then'](saveUpdates(_0x329a80[_0xfb15('0x4e')],null))[_0xfb15('0x26')](respondWithResult(_0x5d7d4a,null))[_0xfb15('0x49')](handleError(_0x5d7d4a,null));};exports[_0xfb15('0x29')]=function(_0x3e9d6a,_0x2808e2){return db[_0xfb15('0x2e')][_0xfb15('0x4c')]({'where':{'id':_0x3e9d6a[_0xfb15('0x4b')]['id']}})[_0xfb15('0x26')](handleEntityNotFound(_0x2808e2,null))[_0xfb15('0x26')](removeEntity(_0x2808e2,null))[_0xfb15('0x49')](handleError(_0x2808e2,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 71179af..01d5414 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 _0x3264=['path','rimraf','../../config/environment','./variable.attributes','define','tools_variables','lodash','util','api','moment','request-promise'];(function(_0x4bb0d4,_0x52c88f){var _0x3fd954=function(_0x6ef3bf){while(--_0x6ef3bf){_0x4bb0d4['push'](_0x4bb0d4['shift']());}};_0x3fd954(++_0x52c88f);}(_0x3264,0xab));var _0x4326=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x3264[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x4326('0x0'));var util=require(_0x4326('0x1'));var logger=require('../../config/logger')(_0x4326('0x2'));var moment=require(_0x4326('0x3'));var BPromise=require('bluebird');var rp=require(_0x4326('0x4'));var fs=require('fs');var path=require(_0x4326('0x5'));var rimraf=require(_0x4326('0x6'));var config=require(_0x4326('0x7'));var attributes=require(_0x4326('0x8'));module['exports']=function(_0x49461e,_0x1b20cb){return _0x49461e[_0x4326('0x9')]('Variable',attributes,{'tableName':_0x4326('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5efa=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','define','Variable','lodash'];(function(_0x1038ef,_0x29d678){var _0x51e2b7=function(_0x1056e5){while(--_0x1056e5){_0x1038ef['push'](_0x1038ef['shift']());}};_0x51e2b7(++_0x29d678);}(_0x5efa,0xa7));var _0xa5ef=function(_0x55beae,_0x235898){_0x55beae=_0x55beae-0x0;var _0x15f45e=_0x5efa[_0x55beae];return _0x15f45e;};'use strict';var _=require(_0xa5ef('0x0'));var util=require('util');var logger=require(_0xa5ef('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa5ef('0x2'));var rp=require(_0xa5ef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5ef('0x4'));var config=require(_0xa5ef('0x5'));var attributes=require('./variable.attributes');module['exports']=function(_0x5166c7,_0x251653){return _0x5166c7[_0xa5ef('0x6')](_0xa5ef('0x7'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index b37833c..f58f143 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x407506,_0x4c1797){var _0x5d5ac9=function(_0x346067){while(--_0x346067){_0x407506['push'](_0x407506['shift']());}};_0x5d5ac9(++_0x4c1797);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2d7827,_0x5afb3d){_0x2d7827=_0x2d7827-0x0;var _0x2ef080=_0x7fbe[_0x2d7827];return _0x2ef080;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x28b83a,_0x401d6f){var _0x5985d9=function(_0x37d489){while(--_0x37d489){_0x28b83a['push'](_0x28b83a['shift']());}};_0x5985d9(++_0x401d6f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3e0670,_0x3c384d){_0x3e0670=_0x3e0670-0x0;var _0xb920a4=_0x1cb9[_0x3e0670];return _0xb920a4;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 2df4c73..5c5c918 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 _0x0541=['migrations','exports','express','Router','../../components/auth/service','index','get','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','restart'];(function(_0x33511e,_0x404cdf){var _0x38ed2b=function(_0x2d6c0d){while(--_0x2d6c0d){_0x33511e['push'](_0x33511e['shift']());}};_0x38ed2b(++_0x404cdf);}(_0x0541,0x7a));var _0x1054=function(_0xb1c5d5,_0x3a2038){_0xb1c5d5=_0xb1c5d5-0x0;var _0x3766dc=_0x0541[_0xb1c5d5];return _0x3766dc;};'use strict';var express=require(_0x1054('0x0'));var router=express[_0x1054('0x1')]();var auth=require(_0x1054('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0x1054('0x3')]);router[_0x1054('0x4')](_0x1054('0x5'),auth[_0x1054('0x6')](),auth[_0x1054('0x7')](),controller['fetch']);router[_0x1054('0x4')](_0x1054('0x8'),auth[_0x1054('0x6')](),auth[_0x1054('0x7')](),controller[_0x1054('0x9')]);router[_0x1054('0x4')](_0x1054('0xa'),auth[_0x1054('0x6')](),auth[_0x1054('0x7')](),controller[_0x1054('0xb')]);router['get']('/restart',auth['isAuthenticated'](),controller[_0x1054('0xc')]);router['get']('/migrations',controller[_0x1054('0xd')]);module[_0x1054('0xe')]=router; \ No newline at end of file +var _0x84eb=['Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','/reset','pull','/restart','migrations','exports','express'];(function(_0x38bc23,_0x4b7762){var _0x469ac4=function(_0x4c8a73){while(--_0x4c8a73){_0x38bc23['push'](_0x38bc23['shift']());}};_0x469ac4(++_0x4b7762);}(_0x84eb,0x195));var _0xb84e=function(_0x1dfc28,_0x46fa1c){_0x1dfc28=_0x1dfc28-0x0;var _0x57a91f=_0x84eb[_0x1dfc28];return _0x57a91f;};'use strict';var express=require(_0xb84e('0x0'));var router=express[_0xb84e('0x1')]();var auth=require(_0xb84e('0x2'));var controller=require(_0xb84e('0x3'));router[_0xb84e('0x4')]('/',controller[_0xb84e('0x5')]);router[_0xb84e('0x4')](_0xb84e('0x6'),auth['isAuthenticated'](),auth[_0xb84e('0x7')](),controller[_0xb84e('0x8')]);router['get'](_0xb84e('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router[_0xb84e('0x4')]('/pull',auth['isAuthenticated'](),auth[_0xb84e('0x7')](),controller[_0xb84e('0xa')]);router[_0xb84e('0x4')](_0xb84e('0xb'),auth['isAuthenticated'](),controller['restart']);router[_0xb84e('0x4')]('/migrations',controller[_0xb84e('0xc')]);module[_0xb84e('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 237d54e..ac98940 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 _0xff4b=['Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','server','replace','.js','push','sort','Migration','sequelize','getQueryInterface','migrations','map'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0xff4b,0xdc));var _0xbff4=function(_0x32eadb,_0x1d103e){_0x32eadb=_0x32eadb-0x0;var _0x8a64d4=_0xff4b[_0x32eadb];return _0x8a64d4;};'use strict';var Umzug=require(_0xbff4('0x0'));var path=require(_0xbff4('0x1'));var fs=require('fs');var _=require(_0xbff4('0x2'));var pkginfo=require(_0xbff4('0x3'))(module,'version');var compareVersions=require(_0xbff4('0x4'));var exec=require(_0xbff4('0x5'))['exec'];var db=require(_0xbff4('0x6'))['db'];var config=require(_0xbff4('0x7'));var pm2=require(_0xbff4('0x8'));var logger=require(_0xbff4('0x9'))(_0xbff4('0xa'));var git=require(_0xbff4('0xb'))(config[_0xbff4('0xc')]);exports[_0xbff4('0xd')]=function(_0x56e82b,_0x395f87){var _0x172e9a={'current':module[_0xbff4('0xe')][_0xbff4('0xf')],'phonebar':0x2};if(_0x56e82b[_0xbff4('0x10')]&&_0x56e82b[_0xbff4('0x10')][_0xbff4('0x11')]){return git[_0xbff4('0x12')]()['tags'](function(_0xd8dd10,_0x576a82){_0x172e9a[_0xbff4('0x11')]=(_0xd8dd10?module[_0xbff4('0xe')][_0xbff4('0xf')]:_0x576a82[_0xbff4('0x11')])||_0xbff4('0x13');return _0x395f87[_0xbff4('0x14')](0xc8)[_0xbff4('0x15')](_0x172e9a);});}else{return _0x395f87['status'](0xc8)[_0xbff4('0x15')](_0x172e9a);}};exports[_0xbff4('0x12')]=function(_0x3bb6c6,_0x9f975f){return git[_0xbff4('0x12')]([_0xbff4('0x16'),_0xbff4('0x17')],function(_0x1c16b5){if(_0x1c16b5){logger[_0xbff4('0x18')](_0x1c16b5);return _0x9f975f[_0xbff4('0x14')](0x1f4)[_0xbff4('0x15')](_0x1c16b5);}logger[_0xbff4('0x19')]('git\x20fetch');return _0x9f975f[_0xbff4('0x14')](0xc8)[_0xbff4('0x15')]({'output':_0xbff4('0x1a')});});};exports[_0xbff4('0x1b')]=function(_0x3929d7,_0x23733a){return git[_0xbff4('0x1b')]([_0xbff4('0x1c'),_0xbff4('0x1d')],function(_0x13f0f2){if(_0x13f0f2){logger[_0xbff4('0x18')](_0x13f0f2);return _0x23733a['status'](0x1f4)[_0xbff4('0x15')](_0x13f0f2);}logger[_0xbff4('0x19')](_0xbff4('0x1e'));return _0x23733a[_0xbff4('0x14')](0xc8)[_0xbff4('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0xbff4('0x1f')]=function(_0x9b3c6d,_0x14d484){exec(_0xbff4('0x20'),function(_0x506d4d,_0x1f0cbb,_0x3e6139){logger['info'](_0x1f0cbb);logger[_0xbff4('0x19')](_0x3e6139);if(_0x506d4d){logger[_0xbff4('0x18')](_0x506d4d);return _0x14d484[_0xbff4('0x14')](0x1f4)[_0xbff4('0x15')](_0x506d4d);}return _0x14d484[_0xbff4('0x14')](0xc8)[_0xbff4('0x15')]({'output':_0x1f0cbb});});};exports[_0xbff4('0x21')]=function(_0x218ed5,_0x2aa79e){return pm2['restart'](_0xbff4('0x22'))[_0xbff4('0x23')](function(_0x3d0b5b){logger[_0xbff4('0x19')](_0xbff4('0x24'),_0x3d0b5b);return _0x2aa79e['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xbff4('0x25')](function(_0x35148b){logger[_0xbff4('0x18')](_0x35148b);return _0x2aa79e[_0xbff4('0x14')](0x1f4)[_0xbff4('0x15')](_0x35148b);});};exports['migrations']=function(_0x172183,_0x3cec36){var _0x4f5516=fs[_0xbff4('0x26')](path[_0xbff4('0x27')](config[_0xbff4('0xc')],_0xbff4('0x28'),'migrations'));var _0x4bb0ea=[];for(var _0x5c2c75=0x0;_0x5c2c75<_0x4f5516['length'];_0x5c2c75++){var _0x37900f=_0x4f5516[_0x5c2c75][_0xbff4('0x29')](_0xbff4('0x2a'),'');if(compareVersions(module[_0xbff4('0xe')][_0xbff4('0xf')],_0x37900f)===-0x1){_0x4bb0ea[_0xbff4('0x2b')](_0x37900f);}}if(_0x4bb0ea['length']){var _0x1005a9=_0x4bb0ea[_0xbff4('0x2c')](compareVersions);var _0x45af85=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xbff4('0x2d')],'modelName':_0xbff4('0x2d'),'columnName':_0xbff4('0xf')},'migrations':{'params':[db[_0xbff4('0x2e')][_0xbff4('0x2f')](),db[_0xbff4('0x2e')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xbff4('0x27')](config[_0xbff4('0xc')],_0xbff4('0x28'),_0xbff4('0x30')),'pattern':/\.js$/}});_0x45af85['up']({'migrations':_[_0xbff4('0x31')](_0x1005a9,function(_0x52577d){return _0x52577d+_0xbff4('0x2a');})})['then'](function(){return _0x3cec36['status'](0xc8)[_0xbff4('0x15')]({'output':_0xbff4('0x32')+module[_0xbff4('0xe')][_0xbff4('0xf')]+_0xbff4('0x33')+_[_0xbff4('0x34')](_0x1005a9),'migrations':_[_0xbff4('0x27')](_0x1005a9)});})[_0xbff4('0x25')](function(_0x32291e){if(_0x32291e instanceof db[_0xbff4('0x2e')]['UniqueConstraintError']){return _0x3cec36['status'](0xc8)[_0xbff4('0x15')]({'output':_0xbff4('0x35')});}else{return _0x3cec36['status'](0x1f4)[_0xbff4('0x15')](_0x32291e);}});}else{return _0x3cec36['status'](0xc8)[_0xbff4('0x15')]({'output':_0xbff4('0x35')});}}; \ No newline at end of file +var _0x3f63=['FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','motion2','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','update','simple-git','root','exports','version','query','latest','fetch','tags','2.0.0','json','status','origin','master','info','git\x20fetch\x20origin\x20master','reset','--hard'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3f63,0xec));var _0x33f6=function(_0x137fac,_0x5cf907){_0x137fac=_0x137fac-0x0;var _0x8f8e2a=_0x3f63[_0x137fac];return _0x8f8e2a;};'use strict';var Umzug=require(_0x33f6('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x33f6('0x1'));var pkginfo=require(_0x33f6('0x2'))(module,'version');var compareVersions=require(_0x33f6('0x3'));var exec=require(_0x33f6('0x4'))[_0x33f6('0x5')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x33f6('0x6'));var git=require(_0x33f6('0x7'))(config[_0x33f6('0x8')]);exports['index']=function(_0x91274,_0x580fac){var _0x534d3e={'current':module[_0x33f6('0x9')][_0x33f6('0xa')],'phonebar':0x2};if(_0x91274[_0x33f6('0xb')]&&_0x91274[_0x33f6('0xb')][_0x33f6('0xc')]){return git[_0x33f6('0xd')]()[_0x33f6('0xe')](function(_0x10ea39,_0x5d3645){_0x534d3e[_0x33f6('0xc')]=(_0x10ea39?module[_0x33f6('0x9')][_0x33f6('0xa')]:_0x5d3645[_0x33f6('0xc')])||_0x33f6('0xf');return _0x580fac['status'](0xc8)[_0x33f6('0x10')](_0x534d3e);});}else{return _0x580fac[_0x33f6('0x11')](0xc8)[_0x33f6('0x10')](_0x534d3e);}};exports[_0x33f6('0xd')]=function(_0x39716a,_0x116c5c){return git['fetch']([_0x33f6('0x12'),_0x33f6('0x13')],function(_0x420333){if(_0x420333){logger['error'](_0x420333);return _0x116c5c['status'](0x1f4)[_0x33f6('0x10')](_0x420333);}logger[_0x33f6('0x14')]('git\x20fetch');return _0x116c5c[_0x33f6('0x11')](0xc8)['json']({'output':_0x33f6('0x15')});});};exports[_0x33f6('0x16')]=function(_0x4924fc,_0x3a1108){return git['reset']([_0x33f6('0x17'),_0x33f6('0x18')],function(_0x429596){if(_0x429596){logger[_0x33f6('0x19')](_0x429596);return _0x3a1108[_0x33f6('0x11')](0x1f4)['json'](_0x429596);}logger[_0x33f6('0x14')](_0x33f6('0x1a'));return _0x3a1108[_0x33f6('0x11')](0xc8)[_0x33f6('0x10')]({'output':_0x33f6('0x1b')});});};exports[_0x33f6('0x1c')]=function(_0x46b192,_0x18b480){exec(_0x33f6('0x1d'),function(_0x575497,_0x4281e9,_0x34f3cf){logger[_0x33f6('0x14')](_0x4281e9);logger[_0x33f6('0x14')](_0x34f3cf);if(_0x575497){logger['error'](_0x575497);return _0x18b480[_0x33f6('0x11')](0x1f4)[_0x33f6('0x10')](_0x575497);}return _0x18b480[_0x33f6('0x11')](0xc8)[_0x33f6('0x10')]({'output':_0x4281e9});});};exports['restart']=function(_0x4a5281,_0x58af19){return pm2['restart'](_0x33f6('0x1e'))['then'](function(_0x5e7305){logger[_0x33f6('0x14')](_0x33f6('0x1f'),_0x5e7305);return _0x58af19['status'](0xc8)[_0x33f6('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x33f6('0x20')](function(_0x5f2be8){logger['error'](_0x5f2be8);return _0x58af19[_0x33f6('0x11')](0x1f4)[_0x33f6('0x10')](_0x5f2be8);});};exports[_0x33f6('0x21')]=function(_0x3fc169,_0x1fe3b7){var _0x219b1c=fs[_0x33f6('0x22')](path['join'](config[_0x33f6('0x8')],_0x33f6('0x23'),_0x33f6('0x21')));var _0x5f1132=[];for(var _0xfd0c3e=0x0;_0xfd0c3e<_0x219b1c[_0x33f6('0x24')];_0xfd0c3e++){var _0xb3e555=_0x219b1c[_0xfd0c3e][_0x33f6('0x25')](_0x33f6('0x26'),'');if(compareVersions(module[_0x33f6('0x9')][_0x33f6('0xa')],_0xb3e555)===-0x1){_0x5f1132[_0x33f6('0x27')](_0xb3e555);}}if(_0x5f1132[_0x33f6('0x24')]){var _0x5d79d3=_0x5f1132[_0x33f6('0x28')](compareVersions);var _0x4fadb7=new Umzug({'storage':_0x33f6('0x29'),'storageOptions':{'model':db[_0x33f6('0x2a')],'modelName':_0x33f6('0x2a'),'columnName':_0x33f6('0xa')},'migrations':{'params':[db[_0x33f6('0x29')]['getQueryInterface'](),db['sequelize'][_0x33f6('0x2b')],function(){throw new Error(_0x33f6('0x2c'));}],'path':path[_0x33f6('0x2d')](config[_0x33f6('0x8')],_0x33f6('0x23'),_0x33f6('0x21')),'pattern':/\.js$/}});_0x4fadb7['up']({'migrations':_[_0x33f6('0x2e')](_0x5d79d3,function(_0x4f1522){return _0x4f1522+_0x33f6('0x26');})})[_0x33f6('0x2f')](function(){return _0x1fe3b7[_0x33f6('0x11')](0xc8)['json']({'output':_0x33f6('0x30')+module[_0x33f6('0x9')][_0x33f6('0xa')]+'\x20to\x20'+_[_0x33f6('0x31')](_0x5d79d3),'migrations':_[_0x33f6('0x2d')](_0x5d79d3)});})[_0x33f6('0x20')](function(_0x40a7db){if(_0x40a7db instanceof db[_0x33f6('0x29')][_0x33f6('0x32')]){return _0x1fe3b7[_0x33f6('0x11')](0xc8)['json']({'output':_0x33f6('0x33')});}else{return _0x1fe3b7[_0x33f6('0x11')](0x1f4)['json'](_0x40a7db);}});}else{return _0x1fe3b7[_0x33f6('0x11')](0xc8)[_0x33f6('0x10')]({'output':_0x33f6('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 20abb39..870d9a4 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 _0x2ed3=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x356ea6,_0x8e835d){var _0x30ceed=function(_0x3ae6cb){while(--_0x3ae6cb){_0x356ea6['push'](_0x356ea6['shift']());}};_0x30ceed(++_0x8e835d);}(_0x2ed3,0x96));var _0x32ed=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x2ed3[_0x5f6a8a];return _0x2cce4d;};'use strict';var multer=require(_0x32ed('0x0'));var util=require(_0x32ed('0x1'));var path=require(_0x32ed('0x2'));var timeout=require(_0x32ed('0x3'));var express=require(_0x32ed('0x4'));var router=express[_0x32ed('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32ed('0x6'));router[_0x32ed('0x7')]('/',auth[_0x32ed('0x8')](),controller['index']);router[_0x32ed('0x7')](_0x32ed('0x9'),auth[_0x32ed('0x8')](),controller[_0x32ed('0xa')]);router[_0x32ed('0x7')](_0x32ed('0xb'),auth['isAuthenticated'](),controller[_0x32ed('0xc')]);router['post']('/',auth[_0x32ed('0x8')](),controller['create']);router[_0x32ed('0xd')](_0x32ed('0xb'),auth[_0x32ed('0x8')](),controller[_0x32ed('0xe')]);router[_0x32ed('0xf')]('/:id',auth[_0x32ed('0x8')](),controller[_0x32ed('0x10')]);module[_0x32ed('0x11')]=router; \ No newline at end of file +var _0x43fb=['show','post','create','put','update','/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe'];(function(_0x696af9,_0x425598){var _0x3a0c3a=function(_0x2e8bfc){while(--_0x2e8bfc){_0x696af9['push'](_0x696af9['shift']());}};_0x3a0c3a(++_0x425598);}(_0x43fb,0x146));var _0xb43f=function(_0x2d9b44,_0x665a45){_0x2d9b44=_0x2d9b44-0x0;var _0x17d283=_0x43fb[_0x2d9b44];return _0x17d283;};'use strict';var multer=require(_0xb43f('0x0'));var util=require(_0xb43f('0x1'));var path=require(_0xb43f('0x2'));var timeout=require(_0xb43f('0x3'));var express=require(_0xb43f('0x4'));var router=express[_0xb43f('0x5')]();var fs_extra=require(_0xb43f('0x6'));var auth=require(_0xb43f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb43f('0x8'));var controller=require(_0xb43f('0x9'));router[_0xb43f('0xa')]('/',auth[_0xb43f('0xb')](),controller[_0xb43f('0xc')]);router['get']('/describe',auth[_0xb43f('0xb')](),controller[_0xb43f('0xd')]);router[_0xb43f('0xa')]('/:id',auth[_0xb43f('0xb')](),controller[_0xb43f('0xe')]);router[_0xb43f('0xf')]('/',auth[_0xb43f('0xb')](),controller[_0xb43f('0x10')]);router[_0xb43f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb43f('0x12')]);router['delete'](_0xb43f('0x13'),auth[_0xb43f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index cef17aa..d01f5a0 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 _0x6b19=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0x6b19,0xf4));var _0x96b1=function(_0x43d1df,_0x2a0b4e){_0x43d1df=_0x43d1df-0x0;var _0x149264=_0x6b19[_0x43d1df];return _0x149264;};'use strict';var Sequelize=require(_0x96b1('0x0'));module['exports']={'type':{'type':Sequelize[_0x96b1('0x1')]},'uniqueid':{'type':Sequelize[_0x96b1('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x96b1('0x1')]},'queue':{'type':Sequelize[_0x96b1('0x1')]},'interface':{'type':Sequelize[_0x96b1('0x1')]},'membername':{'type':Sequelize[_0x96b1('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x96b1('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x96b1('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x96b1('0x3')]},'agentcomplete':{'type':Sequelize[_0x96b1('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x96b1('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x96b1('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x96b1('0x3')]},'reason':{'type':Sequelize[_0x96b1('0x1')]},'lastevent':{'type':Sequelize[_0x96b1('0x1')]},'channel':{'type':Sequelize[_0x96b1('0x1')]},'channelstate':{'type':Sequelize[_0x96b1('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x96b1('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x96b1('0x1')]},'priority':{'type':Sequelize[_0x96b1('0x1')]},'destchannel':{'type':Sequelize[_0x96b1('0x1')]},'destchannelstate':{'type':Sequelize[_0x96b1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x96b1('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x96b1('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x96b1('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x96b1('0x1')]},'destlanguage':{'type':Sequelize[_0x96b1('0x1')]},'destaccountcode':{'type':Sequelize[_0x96b1('0x1')]},'destcontext':{'type':Sequelize[_0x96b1('0x1')]},'destexten':{'type':Sequelize[_0x96b1('0x1')]},'destpriority':{'type':Sequelize[_0x96b1('0x1')]},'destuniqueid':{'type':Sequelize[_0x96b1('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x96b1('0x1')]},'transfer':{'type':Sequelize[_0x96b1('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x96b1('0x1')],'comment':_0x96b1('0x5')},'transferexten':{'type':Sequelize[_0x96b1('0x1')]},'transferuniqueid':{'type':Sequelize[_0x96b1('0x1')]},'agententerreason':{'type':Sequelize[_0x96b1('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x215d=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x1631b3,_0x4afc82){var _0x1d91c3=function(_0x27fdfe){while(--_0x27fdfe){_0x1631b3['push'](_0x1631b3['shift']());}};_0x1d91c3(++_0x4afc82);}(_0x215d,0x187));var _0xd215=function(_0x26e661,_0x2e879e){_0x26e661=_0x26e661-0x0;var _0x42b999=_0x215d[_0x26e661];return _0x42b999;};'use strict';var Sequelize=require(_0xd215('0x0'));module['exports']={'type':{'type':Sequelize[_0xd215('0x1')]},'uniqueid':{'type':Sequelize[_0xd215('0x1')]},'calleridnum':{'type':Sequelize[_0xd215('0x1')]},'calleridname':{'type':Sequelize[_0xd215('0x1')]},'queue':{'type':Sequelize[_0xd215('0x1')]},'interface':{'type':Sequelize[_0xd215('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd215('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xd215('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd215('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd215('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd215('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd215('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd215('0x4')]},'agentacw':{'type':Sequelize[_0xd215('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd215('0x1')]},'lastevent':{'type':Sequelize[_0xd215('0x1')]},'channel':{'type':Sequelize[_0xd215('0x1')]},'channelstate':{'type':Sequelize[_0xd215('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd215('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd215('0x1')]},'language':{'type':Sequelize[_0xd215('0x1')]},'accountcode':{'type':Sequelize[_0xd215('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd215('0x1')]},'priority':{'type':Sequelize[_0xd215('0x1')]},'destchannel':{'type':Sequelize[_0xd215('0x1')]},'destchannelstate':{'type':Sequelize[_0xd215('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd215('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd215('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd215('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd215('0x1')]},'destlanguage':{'type':Sequelize[_0xd215('0x1')]},'destaccountcode':{'type':Sequelize[_0xd215('0x1')]},'destcontext':{'type':Sequelize[_0xd215('0x1')]},'destexten':{'type':Sequelize[_0xd215('0x1')]},'destpriority':{'type':Sequelize[_0xd215('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd215('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd215('0x1')]},'transfer':{'type':Sequelize[_0xd215('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd215('0x1')],'comment':_0xd215('0x5')},'transferexten':{'type':Sequelize[_0xd215('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd215('0x1')]},'agententerreason':{'type':Sequelize[_0xd215('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 32a334a..281b869 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 6d00410..34220cf 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 _0x2d17=['api','moment','request-promise','path','../../config/environment','exports','define','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x54ab9e,_0x529a19){var _0x716660=function(_0xc3ced8){while(--_0xc3ced8){_0x54ab9e['push'](_0x54ab9e['shift']());}};_0x716660(++_0x529a19);}(_0x2d17,0x17e));var _0x72d1=function(_0x48cdb0,_0x411478){_0x48cdb0=_0x48cdb0-0x0;var _0x15f292=_0x2d17[_0x48cdb0];return _0x15f292;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[{'fields':[_0x72d1('0xa'),_0x72d1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d55=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x51b6dc,_0x5a079b){var _0x70be33=function(_0x37584c){while(--_0x37584c){_0x51b6dc['push'](_0x51b6dc['shift']());}};_0x70be33(++_0x5a079b);}(_0x7d55,0x1bc));var _0x57d5=function(_0xdefc15,_0x55d3ec){_0xdefc15=_0xdefc15-0x0;var _0x30e52c=_0x7d55[_0xdefc15];return _0x30e52c;};'use strict';var _=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var logger=require(_0x57d5('0x2'))(_0x57d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x57d5('0x4'));var fs=require('fs');var path=require(_0x57d5('0x5'));var rimraf=require(_0x57d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x57d5('0x7'));module[_0x57d5('0x8')]=function(_0x15c349,_0x30fcfe){return _0x15c349[_0x57d5('0x9')](_0x57d5('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 2d9cebd..3199fcc 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 _0x9014=['then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x230232,_0x2b9dbd){var _0x2b947b=function(_0x59b042){while(--_0x59b042){_0x230232['push'](_0x230232['shift']());}};_0x2b947b(++_0x2b9dbd);}(_0x9014,0xa1));var _0x4901=function(_0x548b1e,_0x81af92){_0x548b1e=_0x548b1e-0x0;var _0xde2fbd=_0x9014[_0x548b1e];return _0xde2fbd;};'use strict';var _=require(_0x4901('0x0'));var util=require(_0x4901('0x1'));var moment=require(_0x4901('0x2'));var BPromise=require(_0x4901('0x3'));var rs=require(_0x4901('0x4'));var fs=require('fs');var Redis=require(_0x4901('0x5'));var db=require(_0x4901('0x6'))['db'];var utils=require(_0x4901('0x7'));var logger=require(_0x4901('0x8'))('rpc');var config=require(_0x4901('0x9'));var jayson=require(_0x4901('0xa'));var client=jayson[_0x4901('0xb')][_0x4901('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c8677,_0x2b0009,_0x201d72){return new BPromise(function(_0x135d04,_0x1c560a){return client[_0x4901('0xd')](_0x2c8677,_0x201d72)[_0x4901('0xe')](function(_0xc0dba6){logger[_0x4901('0xf')](_0x4901('0x10'),_0x2b0009,_0x4901('0x11'));logger['debug'](_0x4901('0x12'),_0x2b0009,_0x4901('0x11'),JSON[_0x4901('0x13')](_0xc0dba6));if(_0xc0dba6[_0x4901('0x14')]){if(_0xc0dba6['error']['code']===0x1f4){logger[_0x4901('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x2b0009,_0xc0dba6['error'][_0x4901('0x15')]);return _0x1c560a(_0xc0dba6[_0x4901('0x14')][_0x4901('0x15')]);}logger[_0x4901('0x14')](_0x4901('0x10'),_0x2b0009,_0xc0dba6[_0x4901('0x14')][_0x4901('0x15')]);return _0x135d04(_0xc0dba6[_0x4901('0x14')][_0x4901('0x15')]);}else{logger[_0x4901('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x2b0009,'request\x20sent');_0x135d04(_0xc0dba6[_0x4901('0x16')][_0x4901('0x15')]);}})[_0x4901('0x17')](function(_0x21c3e2){logger['error'](_0x4901('0x10'),_0x2b0009,_0x21c3e2);_0x1c560a(_0x21c3e2);});});}exports[_0x4901('0x18')]=function(_0x8b47ed){var _0x94bde=this;return new Promise(function(_0x6e5d13,_0xdc2ac3){return db[_0x4901('0x19')][_0x4901('0x1a')](_0x8b47ed[_0x4901('0x1b')],{'raw':_0x8b47ed[_0x4901('0x1c')]?_0x8b47ed[_0x4901('0x1c')][_0x4901('0x1d')]===undefined?!![]:![]:!![]})[_0x4901('0xe')](function(_0x228ad2){logger[_0x4901('0xf')]('CreateVoiceAgentReport',_0x8b47ed);logger['debug'](_0x4901('0x18'),_0x8b47ed,JSON[_0x4901('0x13')](_0x228ad2));_0x6e5d13(_0x228ad2);})[_0x4901('0x17')](function(_0x2dd719){logger[_0x4901('0x14')]('CreateVoiceAgentReport',_0x2dd719[_0x4901('0x15')],_0x8b47ed);_0xdc2ac3(_0x94bde['error'](0x1f4,_0x2dd719[_0x4901('0x15')]));});});};exports[_0x4901('0x1e')]=function(_0x310dbb){var _0x57beab=this;return new Promise(function(_0x4db7ad,_0xdc85a9){return db[_0x4901('0x19')]['update'](_0x310dbb['body'],{'raw':_0x310dbb[_0x4901('0x1c')]?_0x310dbb[_0x4901('0x1c')][_0x4901('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x310dbb[_0x4901('0x1c')]?_0x310dbb[_0x4901('0x1c')][_0x4901('0x1f')]||null:null,'attributes':_0x310dbb[_0x4901('0x1c')]?_0x310dbb['options'][_0x4901('0x20')]||null:null,'limit':_0x310dbb[_0x4901('0x1c')]?_0x310dbb[_0x4901('0x1c')][_0x4901('0x21')]||null:null})[_0x4901('0xe')](function(_0xc94e9e){logger[_0x4901('0xf')]('UpdateVoiceAgentReport',_0x310dbb);logger[_0x4901('0x22')]('UpdateVoiceAgentReport',_0x310dbb,JSON[_0x4901('0x13')](_0xc94e9e));_0x4db7ad(_0xc94e9e);})['catch'](function(_0x119b4c){logger[_0x4901('0x14')](_0x4901('0x1e'),_0x119b4c[_0x4901('0x15')],_0x310dbb);_0xdc85a9(_0x57beab['error'](0x1f4,_0x119b4c[_0x4901('0x15')]));});});}; \ No newline at end of file +var _0x42a1=['update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','debug','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport'];(function(_0x277ad4,_0x4ea52a){var _0x2f57c8=function(_0x587f90){while(--_0x587f90){_0x277ad4['push'](_0x277ad4['shift']());}};_0x2f57c8(++_0x4ea52a);}(_0x42a1,0x1e0));var _0x142a=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x42a1[_0x2cc8bb];return _0x140e40;};'use strict';var _=require('lodash');var util=require(_0x142a('0x0'));var moment=require(_0x142a('0x1'));var BPromise=require(_0x142a('0x2'));var rs=require(_0x142a('0x3'));var fs=require('fs');var Redis=require(_0x142a('0x4'));var db=require(_0x142a('0x5'))['db'];var utils=require(_0x142a('0x6'));var logger=require(_0x142a('0x7'))(_0x142a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x142a('0x9')][_0x142a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x494dbe,_0x2daefb,_0x18f94c){return new BPromise(function(_0xc7e3a2,_0x517676){return client[_0x142a('0xb')](_0x494dbe,_0x18f94c)[_0x142a('0xc')](function(_0x4298aa){logger[_0x142a('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x2daefb,'request\x20sent');logger[_0x142a('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x2daefb,'request\x20sent',JSON[_0x142a('0xf')](_0x4298aa));if(_0x4298aa['error']){if(_0x4298aa[_0x142a('0x10')][_0x142a('0x11')]===0x1f4){logger[_0x142a('0x10')](_0x142a('0x12'),_0x2daefb,_0x4298aa[_0x142a('0x10')][_0x142a('0x13')]);return _0x517676(_0x4298aa[_0x142a('0x10')][_0x142a('0x13')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x2daefb,_0x4298aa[_0x142a('0x10')][_0x142a('0x13')]);return _0xc7e3a2(_0x4298aa[_0x142a('0x10')][_0x142a('0x13')]);}else{logger[_0x142a('0xd')](_0x142a('0x12'),_0x2daefb,_0x142a('0x14'));_0xc7e3a2(_0x4298aa[_0x142a('0x15')]['message']);}})[_0x142a('0x16')](function(_0x3ebd84){logger[_0x142a('0x10')](_0x142a('0x12'),_0x2daefb,_0x3ebd84);_0x517676(_0x3ebd84);});});}exports[_0x142a('0x17')]=function(_0x5541bf){var _0x7abd02=this;return new Promise(function(_0xee16de,_0x4b6758){return db[_0x142a('0x18')][_0x142a('0x19')](_0x5541bf[_0x142a('0x1a')],{'raw':_0x5541bf[_0x142a('0x1b')]?_0x5541bf[_0x142a('0x1b')][_0x142a('0x1c')]===undefined?!![]:![]:!![]})[_0x142a('0xc')](function(_0x40ab57){logger[_0x142a('0xd')](_0x142a('0x17'),_0x5541bf);logger[_0x142a('0xe')](_0x142a('0x17'),_0x5541bf,JSON[_0x142a('0xf')](_0x40ab57));_0xee16de(_0x40ab57);})[_0x142a('0x16')](function(_0x470c93){logger[_0x142a('0x10')]('CreateVoiceAgentReport',_0x470c93['message'],_0x5541bf);_0x4b6758(_0x7abd02[_0x142a('0x10')](0x1f4,_0x470c93[_0x142a('0x13')]));});});};exports[_0x142a('0x1d')]=function(_0x4289a1){var _0x193633=this;return new Promise(function(_0x588580,_0xa66b5d){return db['VoiceAgentReport'][_0x142a('0x1e')](_0x4289a1[_0x142a('0x1a')],{'raw':_0x4289a1[_0x142a('0x1b')]?_0x4289a1[_0x142a('0x1b')][_0x142a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4289a1[_0x142a('0x1b')]?_0x4289a1[_0x142a('0x1b')][_0x142a('0x1f')]||null:null,'attributes':_0x4289a1[_0x142a('0x1b')]?_0x4289a1[_0x142a('0x1b')][_0x142a('0x20')]||null:null,'limit':_0x4289a1[_0x142a('0x1b')]?_0x4289a1[_0x142a('0x1b')][_0x142a('0x21')]||null:null})[_0x142a('0xc')](function(_0x28dd10){logger[_0x142a('0xd')](_0x142a('0x1d'),_0x4289a1);logger[_0x142a('0xe')](_0x142a('0x1d'),_0x4289a1,JSON[_0x142a('0xf')](_0x28dd10));_0x588580(_0x28dd10);})[_0x142a('0x16')](function(_0x32da30){logger[_0x142a('0x10')](_0x142a('0x1d'),_0x32da30['message'],_0x4289a1);_0xa66b5d(_0x193633['error'](0x1f4,_0x32da30['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 346d661..8a0d412 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 _0x826a=['post','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x44fbf9,_0x3f1576){var _0x8dd30c=function(_0x5097d7){while(--_0x5097d7){_0x44fbf9['push'](_0x44fbf9['shift']());}};_0x8dd30c(++_0x3f1576);}(_0x826a,0x1aa));var _0xa826=function(_0x35bd02,_0x5b6c43){_0x35bd02=_0x35bd02-0x0;var _0x35f5b1=_0x826a[_0x35bd02];return _0x35f5b1;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var fs_extra=require(_0xa826('0x3'));var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router[_0xa826('0x7')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0x9')]);router[_0xa826('0x7')](_0xa826('0xa'),auth[_0xa826('0x8')](),controller[_0xa826('0xb')]);router[_0xa826('0x7')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0xd')]);router[_0xa826('0xe')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);router[_0xa826('0x10')]('/:id',auth[_0xa826('0x8')](),controller['update']);router[_0xa826('0x11')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0x12')]);module[_0xa826('0x13')]=router; \ No newline at end of file +var _0xaba6=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x21930e,_0x21dc4c){var _0x5bb1d1=function(_0x19d38e){while(--_0x19d38e){_0x21930e['push'](_0x21930e['shift']());}};_0x5bb1d1(++_0x21dc4c);}(_0xaba6,0xe2));var _0x6aba=function(_0x1a160d,_0x57fd51){_0x1a160d=_0x1a160d-0x0;var _0x3be03b=_0xaba6[_0x1a160d];return _0x3be03b;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/describe',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['get'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller['show']);router[_0x6aba('0xa')]('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);router['delete'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xe')]);module[_0x6aba('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 16a7c35..1e8ac0e 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 _0x6acc=['exports','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x2b41e8,_0x86e285){var _0x396ab3=function(_0x4eca77){while(--_0x4eca77){_0x2b41e8['push'](_0x2b41e8['shift']());}};_0x396ab3(++_0x86e285);}(_0x6acc,0x167));var _0xc6ac=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x6acc[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require(_0xc6ac('0x0'));module[_0xc6ac('0x1')]={'uniqueid':{'type':Sequelize[_0xc6ac('0x2')]},'type':{'type':Sequelize[_0xc6ac('0x3')](_0xc6ac('0x4'),'internal',_0xc6ac('0x5'),_0xc6ac('0x6'),_0xc6ac('0x7'),_0xc6ac('0x8'))},'tag':{'type':Sequelize[_0xc6ac('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xc6ac('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc6ac('0x2')]},'callerid':{'type':Sequelize[_0xc6ac('0x2')]},'channel':{'type':Sequelize[_0xc6ac('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xc6ac('0x2')]},'lastdata':{'type':Sequelize[_0xc6ac('0x9')]},'starttime':{'type':Sequelize[_0xc6ac('0xa')]},'systemanswertime':{'type':Sequelize[_0xc6ac('0xa')]},'answertime':{'type':Sequelize[_0xc6ac('0xa')]},'endtime':{'type':Sequelize[_0xc6ac('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xc6ac('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc6ac('0x2')]},'amaflags':{'type':Sequelize[_0xc6ac('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xc6ac('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc6ac('0x2')]},'note':{'type':Sequelize[_0xc6ac('0x2')]},'prefix':{'type':Sequelize[_0xc6ac('0x2')]},'routeid':{'type':Sequelize[_0xc6ac('0xb')]},'sipcallid':{'type':Sequelize[_0xc6ac('0x2')]}}; \ No newline at end of file +var _0x315e=['outbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING','inbound','internal','outbound','inbound-fax'];(function(_0x321600,_0x31dabb){var _0x4a42ee=function(_0x59328b){while(--_0x59328b){_0x321600['push'](_0x321600['shift']());}};_0x4a42ee(++_0x31dabb);}(_0x315e,0x1dd));var _0xe315=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x315e[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xe315('0x0'));module[_0xe315('0x1')]={'uniqueid':{'type':Sequelize[_0xe315('0x2')]},'type':{'type':Sequelize['ENUM'](_0xe315('0x3'),_0xe315('0x4'),_0xe315('0x5'),_0xe315('0x6'),_0xe315('0x7'),_0xe315('0x8'))},'tag':{'type':Sequelize[_0xe315('0x2')]},'accountcode':{'type':Sequelize[_0xe315('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xe315('0x2')]},'destinationcontext':{'type':Sequelize[_0xe315('0x2')]},'callerid':{'type':Sequelize[_0xe315('0x2')]},'channel':{'type':Sequelize[_0xe315('0x2')]},'destinationchannel':{'type':Sequelize[_0xe315('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xe315('0x9')]},'systemanswertime':{'type':Sequelize[_0xe315('0x9')]},'answertime':{'type':Sequelize[_0xe315('0x9')]},'endtime':{'type':Sequelize[_0xe315('0x9')]},'duration':{'type':Sequelize[_0xe315('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xe315('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe315('0x2')]},'amaflags':{'type':Sequelize[_0xe315('0x2')]},'userfield':{'type':Sequelize[_0xe315('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xe315('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xe315('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xe315('0xa')]},'sipcallid':{'type':Sequelize[_0xe315('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2204c2d..b9b3f0e 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0xadb5,0xad));var _0x5adb=function(_0x3949f1,_0x19e2ad){_0x3949f1=_0x3949f1-0x0;var _0x5158b2=_0xadb5[_0x3949f1];return _0x5158b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x123599,_0x374e14){var _0x3bf01d=function(_0x60b9bc){while(--_0x60b9bc){_0x123599['push'](_0x123599['shift']());}};_0x3bf01d(++_0x374e14);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x0b0e[_0x2867d8];return _0x3b8176;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d30e413..0c15902 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 _0x9100=['report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','./voiceCallReport.attributes','define','VoiceCallReport'];(function(_0x2067cb,_0x112ee2){var _0x12c048=function(_0x3ac00e){while(--_0x3ac00e){_0x2067cb['push'](_0x2067cb['shift']());}};_0x12c048(++_0x112ee2);}(_0x9100,0x1e6));var _0x0910=function(_0x1d80d8,_0x18871b){_0x1d80d8=_0x1d80d8-0x0;var _0x2787ea=_0x9100[_0x1d80d8];return _0x2787ea;};'use strict';var _=require(_0x0910('0x0'));var util=require(_0x0910('0x1'));var logger=require(_0x0910('0x2'))('api');var moment=require(_0x0910('0x3'));var BPromise=require(_0x0910('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0910('0x5'));var config=require('../../config/environment');var attributes=require(_0x0910('0x6'));module['exports']=function(_0x23985c,_0x275d4d){return _0x23985c[_0x0910('0x7')](_0x0910('0x8'),attributes,{'tableName':_0x0910('0x9'),'paranoid':![],'indexes':[{'fields':[_0x0910('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7433=['lodash','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x52d71a,_0x41638b){var _0x4ebf53=function(_0x2603cb){while(--_0x2603cb){_0x52d71a['push'](_0x52d71a['shift']());}};_0x4ebf53(++_0x41638b);}(_0x7433,0x140));var _0x3743=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x7433[_0x12b683];return _0xfb150b;};'use strict';var _=require(_0x3743('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3743('0x1'));var fs=require('fs');var path=require(_0x3743('0x2'));var rimraf=require('rimraf');var config=require(_0x3743('0x3'));var attributes=require(_0x3743('0x4'));module[_0x3743('0x5')]=function(_0x52ebf8,_0x1daaef){return _0x52ebf8[_0x3743('0x6')](_0x3743('0x7'),attributes,{'tableName':_0x3743('0x8'),'paranoid':![],'indexes':[{'fields':[_0x3743('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index cad1e7b..a917d19 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 _0x48e9=['catch','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','VoiceCallReport','options','raw','include','map','model','attributes','GetVoiceCallReport'];(function(_0x42fb29,_0x477df6){var _0x2ed8db=function(_0x4254bd){while(--_0x4254bd){_0x42fb29['push'](_0x42fb29['shift']());}};_0x2ed8db(++_0x477df6);}(_0x48e9,0xfc));var _0x948e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x48e9[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x948e('0x0'));var util=require('util');var moment=require(_0x948e('0x1'));var BPromise=require(_0x948e('0x2'));var rs=require(_0x948e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x948e('0x4'));var logger=require(_0x948e('0x5'))(_0x948e('0x6'));var config=require(_0x948e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x948e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5747dd,_0x43397e,_0x29a4c){return new BPromise(function(_0x27da0f,_0x339531){return client[_0x948e('0x9')](_0x5747dd,_0x29a4c)[_0x948e('0xa')](function(_0x30c21f){logger[_0x948e('0xb')](_0x948e('0xc'),_0x43397e,'request\x20sent');logger[_0x948e('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x43397e,_0x948e('0xe'),JSON[_0x948e('0xf')](_0x30c21f));if(_0x30c21f[_0x948e('0x10')]){if(_0x30c21f['error'][_0x948e('0x11')]===0x1f4){logger[_0x948e('0x10')](_0x948e('0xc'),_0x43397e,_0x30c21f[_0x948e('0x10')][_0x948e('0x12')]);return _0x339531(_0x30c21f['error'][_0x948e('0x12')]);}logger['error'](_0x948e('0xc'),_0x43397e,_0x30c21f[_0x948e('0x10')][_0x948e('0x12')]);return _0x27da0f(_0x30c21f['error'][_0x948e('0x12')]);}else{logger[_0x948e('0xb')](_0x948e('0xc'),_0x43397e,'request\x20sent');_0x27da0f(_0x30c21f[_0x948e('0x13')][_0x948e('0x12')]);}})['catch'](function(_0x3576d1){logger[_0x948e('0x10')](_0x948e('0xc'),_0x43397e,_0x3576d1);_0x339531(_0x3576d1);});});}exports['GetVoiceCallReport']=function(_0x546f0f){var _0x377435=this;return new Promise(function(_0x288365,_0x1661c7){return db[_0x948e('0x14')]['findAll']({'raw':_0x546f0f[_0x948e('0x15')]?_0x546f0f[_0x948e('0x15')][_0x948e('0x16')]===undefined?!![]:![]:!![],'where':_0x546f0f[_0x948e('0x15')]?_0x546f0f[_0x948e('0x15')]['where']||null:null,'attributes':_0x546f0f[_0x948e('0x15')]?_0x546f0f[_0x948e('0x15')]['attributes']||null:null,'limit':_0x546f0f[_0x948e('0x15')]?_0x546f0f[_0x948e('0x15')]['limit']||null:null,'include':_0x546f0f[_0x948e('0x15')]?_0x546f0f['options'][_0x948e('0x17')]?_[_0x948e('0x18')](_0x546f0f[_0x948e('0x15')][_0x948e('0x17')],function(_0x376a46){return{'model':db[_0x376a46['model']],'as':_0x376a46['as'],'attributes':_0x376a46['attributes'],'include':_0x376a46[_0x948e('0x17')]?_[_0x948e('0x18')](_0x376a46[_0x948e('0x17')],function(_0x8b0372){return{'model':db[_0x8b0372[_0x948e('0x19')]],'as':_0x8b0372['as'],'attributes':_0x8b0372[_0x948e('0x1a')],'include':_0x8b0372[_0x948e('0x17')]?_['map'](_0x8b0372[_0x948e('0x17')],function(_0xe5bc81){return{'model':db[_0xe5bc81['model']],'as':_0xe5bc81['as'],'attributes':_0xe5bc81[_0x948e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x948e('0xa')](function(_0x22e612){logger['info'](_0x948e('0x1b'),_0x546f0f);logger[_0x948e('0xd')]('GetVoiceCallReport',_0x546f0f,JSON[_0x948e('0xf')](_0x22e612));_0x288365(_0x22e612);})[_0x948e('0x1c')](function(_0x97cd3b){logger[_0x948e('0x10')](_0x948e('0x1b'),_0x97cd3b[_0x948e('0x12')],_0x546f0f);_0x1661c7(_0x377435[_0x948e('0x10')](0x1f4,_0x97cd3b['message']));});});};exports[_0x948e('0x1d')]=function(_0x3f44fc){var _0x525aa0=this;return new Promise(function(_0x476e1c,_0x2eeb19){return db[_0x948e('0x14')][_0x948e('0x1e')](_0x3f44fc['body'],{'raw':_0x3f44fc[_0x948e('0x15')]?_0x3f44fc[_0x948e('0x15')][_0x948e('0x16')]===undefined?!![]:![]:!![]})[_0x948e('0xa')](function(_0x142181){logger['info'](_0x948e('0x1d'),_0x3f44fc);logger[_0x948e('0xd')]('CreateVoiceCallReport',_0x3f44fc,JSON[_0x948e('0xf')](_0x142181));_0x476e1c(_0x142181);})[_0x948e('0x1c')](function(_0x13a032){logger[_0x948e('0x10')](_0x948e('0x1d'),_0x13a032[_0x948e('0x12')],_0x3f44fc);_0x2eeb19(_0x525aa0['error'](0x1f4,_0x13a032[_0x948e('0x12')]));});});};exports[_0x948e('0x1f')]=function(_0x56b059){var _0x3ecbdc=this;return new Promise(function(_0x42a4c2,_0xcf0ca7){return db[_0x948e('0x14')][_0x948e('0x20')](_0x56b059[_0x948e('0x21')],{'raw':_0x56b059[_0x948e('0x15')]?_0x56b059[_0x948e('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56b059['options']?_0x56b059[_0x948e('0x15')]['where']||null:null,'attributes':_0x56b059[_0x948e('0x15')]?_0x56b059['options'][_0x948e('0x1a')]||null:null,'limit':_0x56b059['options']?_0x56b059[_0x948e('0x15')][_0x948e('0x22')]||null:null})[_0x948e('0xa')](function(_0x284565){logger[_0x948e('0xb')](_0x948e('0x1f'),_0x56b059);logger[_0x948e('0xd')](_0x948e('0x1f'),_0x56b059,JSON[_0x948e('0xf')](_0x284565));_0x42a4c2(_0x284565);})[_0x948e('0x1c')](function(_0x37a4e0){logger['error'](_0x948e('0x1f'),_0x37a4e0[_0x948e('0x12')],_0x56b059);_0xcf0ca7(_0x3ecbdc[_0x948e('0x10')](0x1f4,_0x37a4e0[_0x948e('0x12')]));});});}; \ No newline at end of file +var _0x1d6c=['model','VoiceCallReport','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','lodash','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','findAll','options','raw','attributes','limit','include','map'];(function(_0xcf5df,_0x4d30ad){var _0x2176d1=function(_0x27923a){while(--_0x27923a){_0xcf5df['push'](_0xcf5df['shift']());}};_0x2176d1(++_0x4d30ad);}(_0x1d6c,0x1f1));var _0xc1d6=function(_0xfc84ed,_0x32ee8a){_0xfc84ed=_0xfc84ed-0x0;var _0xb5fba1=_0x1d6c[_0xfc84ed];return _0xb5fba1;};'use strict';var _=require(_0xc1d6('0x0'));var util=require(_0xc1d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1d6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc1d6('0x3'));var logger=require('../../config/logger')(_0xc1d6('0x4'));var config=require(_0xc1d6('0x5'));var jayson=require(_0xc1d6('0x6'));var client=jayson['client'][_0xc1d6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ebae2,_0x4a2688,_0x16c9df){return new BPromise(function(_0x242d1e,_0x13f076){return client[_0xc1d6('0x8')](_0x3ebae2,_0x16c9df)[_0xc1d6('0x9')](function(_0x29c85e){logger[_0xc1d6('0xa')](_0xc1d6('0xb'),_0x4a2688,'request\x20sent');logger[_0xc1d6('0xc')](_0xc1d6('0xd'),_0x4a2688,_0xc1d6('0xe'),JSON[_0xc1d6('0xf')](_0x29c85e));if(_0x29c85e['error']){if(_0x29c85e[_0xc1d6('0x10')]['code']===0x1f4){logger[_0xc1d6('0x10')](_0xc1d6('0xb'),_0x4a2688,_0x29c85e[_0xc1d6('0x10')][_0xc1d6('0x11')]);return _0x13f076(_0x29c85e['error'][_0xc1d6('0x11')]);}logger[_0xc1d6('0x10')](_0xc1d6('0xb'),_0x4a2688,_0x29c85e[_0xc1d6('0x10')][_0xc1d6('0x11')]);return _0x242d1e(_0x29c85e['error'][_0xc1d6('0x11')]);}else{logger[_0xc1d6('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x4a2688,_0xc1d6('0xe'));_0x242d1e(_0x29c85e[_0xc1d6('0x12')][_0xc1d6('0x11')]);}})[_0xc1d6('0x13')](function(_0x419965){logger[_0xc1d6('0x10')](_0xc1d6('0xb'),_0x4a2688,_0x419965);_0x13f076(_0x419965);});});}exports[_0xc1d6('0x14')]=function(_0x3157c6){var _0x2eab05=this;return new Promise(function(_0x2a9c0f,_0x382e8e){return db['VoiceCallReport'][_0xc1d6('0x15')]({'raw':_0x3157c6[_0xc1d6('0x16')]?_0x3157c6[_0xc1d6('0x16')][_0xc1d6('0x17')]===undefined?!![]:![]:!![],'where':_0x3157c6[_0xc1d6('0x16')]?_0x3157c6[_0xc1d6('0x16')]['where']||null:null,'attributes':_0x3157c6[_0xc1d6('0x16')]?_0x3157c6['options'][_0xc1d6('0x18')]||null:null,'limit':_0x3157c6[_0xc1d6('0x16')]?_0x3157c6[_0xc1d6('0x16')][_0xc1d6('0x19')]||null:null,'include':_0x3157c6[_0xc1d6('0x16')]?_0x3157c6['options'][_0xc1d6('0x1a')]?_[_0xc1d6('0x1b')](_0x3157c6['options'][_0xc1d6('0x1a')],function(_0x2b261c){return{'model':db[_0x2b261c[_0xc1d6('0x1c')]],'as':_0x2b261c['as'],'attributes':_0x2b261c[_0xc1d6('0x18')],'include':_0x2b261c[_0xc1d6('0x1a')]?_[_0xc1d6('0x1b')](_0x2b261c[_0xc1d6('0x1a')],function(_0x2006aa){return{'model':db[_0x2006aa[_0xc1d6('0x1c')]],'as':_0x2006aa['as'],'attributes':_0x2006aa['attributes'],'include':_0x2006aa[_0xc1d6('0x1a')]?_[_0xc1d6('0x1b')](_0x2006aa[_0xc1d6('0x1a')],function(_0x50fa58){return{'model':db[_0x50fa58[_0xc1d6('0x1c')]],'as':_0x50fa58['as'],'attributes':_0x50fa58[_0xc1d6('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc1d6('0x9')](function(_0x149a60){logger['info']('GetVoiceCallReport',_0x3157c6);logger[_0xc1d6('0xc')](_0xc1d6('0x14'),_0x3157c6,JSON[_0xc1d6('0xf')](_0x149a60));_0x2a9c0f(_0x149a60);})[_0xc1d6('0x13')](function(_0x2a8731){logger['error']('GetVoiceCallReport',_0x2a8731[_0xc1d6('0x11')],_0x3157c6);_0x382e8e(_0x2eab05['error'](0x1f4,_0x2a8731[_0xc1d6('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x1c96f3){var _0x48786c=this;return new Promise(function(_0x2c5f61,_0xecb96e){return db[_0xc1d6('0x1d')][_0xc1d6('0x1e')](_0x1c96f3['body'],{'raw':_0x1c96f3['options']?_0x1c96f3['options'][_0xc1d6('0x17')]===undefined?!![]:![]:!![]})[_0xc1d6('0x9')](function(_0x4b3ace){logger['info'](_0xc1d6('0x1f'),_0x1c96f3);logger[_0xc1d6('0xc')]('CreateVoiceCallReport',_0x1c96f3,JSON['stringify'](_0x4b3ace));_0x2c5f61(_0x4b3ace);})[_0xc1d6('0x13')](function(_0x3f37d8){logger[_0xc1d6('0x10')](_0xc1d6('0x1f'),_0x3f37d8['message'],_0x1c96f3);_0xecb96e(_0x48786c[_0xc1d6('0x10')](0x1f4,_0x3f37d8['message']));});});};exports[_0xc1d6('0x20')]=function(_0x2936ef){var _0x1d791a=this;return new Promise(function(_0x36a931,_0x14dd51){return db[_0xc1d6('0x1d')][_0xc1d6('0x21')](_0x2936ef['body'],{'raw':_0x2936ef[_0xc1d6('0x16')]?_0x2936ef['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2936ef[_0xc1d6('0x16')]?_0x2936ef['options'][_0xc1d6('0x22')]||null:null,'attributes':_0x2936ef[_0xc1d6('0x16')]?_0x2936ef[_0xc1d6('0x16')][_0xc1d6('0x18')]||null:null,'limit':_0x2936ef[_0xc1d6('0x16')]?_0x2936ef[_0xc1d6('0x16')][_0xc1d6('0x19')]||null:null})['then'](function(_0x124f81){logger['info'](_0xc1d6('0x20'),_0x2936ef);logger[_0xc1d6('0xc')]('UpdateVoiceCallReport',_0x2936ef,JSON['stringify'](_0x124f81));_0x36a931(_0x124f81);})[_0xc1d6('0x13')](function(_0x4c5f0f){logger['error'](_0xc1d6('0x20'),_0x4c5f0f[_0xc1d6('0x11')],_0x2936ef);_0x14dd51(_0x1d791a[_0xc1d6('0x10')](0x1f4,_0x4c5f0f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index a85222e..dbd1d0a 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 _0x061a=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3ab188,_0x5b452b){var _0x5af86e=function(_0x5514f5){while(--_0x5514f5){_0x3ab188['push'](_0x3ab188['shift']());}};_0x5af86e(++_0x5b452b);}(_0x061a,0x13e));var _0xa061=function(_0x19d635,_0x25b29f){_0x19d635=_0x19d635-0x0;var _0x24c58f=_0x061a[_0x19d635];return _0x24c58f;};'use strict';var multer=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var path=require(_0xa061('0x2'));var timeout=require(_0xa061('0x3'));var express=require(_0xa061('0x4'));var router=express[_0xa061('0x5')]();var fs_extra=require(_0xa061('0x6'));var auth=require(_0xa061('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa061('0x8'));var controller=require(_0xa061('0x9'));router['get']('/',auth[_0xa061('0xa')](),controller[_0xa061('0xb')]);router[_0xa061('0xc')](_0xa061('0xd'),auth[_0xa061('0xa')](),controller['show']);router[_0xa061('0xe')]('/',auth[_0xa061('0xa')](),controller[_0xa061('0xf')]);router['put']('/:id',auth[_0xa061('0xa')](),controller['update']);router[_0xa061('0x10')](_0xa061('0xd'),auth[_0xa061('0xa')](),controller[_0xa061('0x11')]);module[_0xa061('0x12')]=router; \ No newline at end of file +var _0x5b57=['post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5b57,0x1ec));var _0x75b5=function(_0x56b6f6,_0x582f1c){_0x56b6f6=_0x56b6f6-0x0;var _0x405b3b=_0x5b57[_0x56b6f6];return _0x405b3b;};'use strict';var multer=require(_0x75b5('0x0'));var util=require('util');var path=require(_0x75b5('0x1'));var timeout=require(_0x75b5('0x2'));var express=require(_0x75b5('0x3'));var router=express[_0x75b5('0x4')]();var fs_extra=require(_0x75b5('0x5'));var auth=require(_0x75b5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x75b5('0x7'));var controller=require('./voiceChanSpy.controller');router[_0x75b5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x75b5('0x8')](_0x75b5('0x9'),auth[_0x75b5('0xa')](),controller[_0x75b5('0xb')]);router[_0x75b5('0xc')]('/',auth[_0x75b5('0xa')](),controller[_0x75b5('0xd')]);router[_0x75b5('0xe')](_0x75b5('0x9'),auth[_0x75b5('0xa')](),controller[_0x75b5('0xf')]);router[_0x75b5('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x75b5('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6f587fd..eae7f76 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 _0xae6c=['options','join','getDataValue','split','BOOLEAN','STRING','name','setDataValue'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xae6c,0xbd));var _0xcae6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcae6('0x0')]},'prefix':{'type':Sequelize[_0xcae6('0x0')],'unique':_0xcae6('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xcae6('0x0')],'set':function(_0x45fc1a){this[_0xcae6('0x2')](_0xcae6('0x3'),_0x45fc1a?_0x45fc1a[_0xcae6('0x4')](''):[]);},'get':function(){return this[_0xcae6('0x5')](_0xcae6('0x3'))?this[_0xcae6('0x5')](_0xcae6('0x3'))[_0xcae6('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xcae6('0x0')]},'record':{'type':Sequelize[_0xcae6('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcae6('0x0')]}}; \ No newline at end of file +var _0xcb96=['exports','STRING','name','setDataValue','getDataValue','options','split','sequelize'];(function(_0x14f593,_0x29bc8d){var _0x3d5f1f=function(_0x3efefb){while(--_0x3efefb){_0x14f593['push'](_0x14f593['shift']());}};_0x3d5f1f(++_0x29bc8d);}(_0xcb96,0xe7));var _0x6cb9=function(_0x45e095,_0xc46d74){_0x45e095=_0x45e095-0x0;var _0x5b93b8=_0xcb96[_0x45e095];return _0x5b93b8;};'use strict';var Sequelize=require(_0x6cb9('0x0'));module[_0x6cb9('0x1')]={'name':{'type':Sequelize[_0x6cb9('0x2')]},'prefix':{'type':Sequelize[_0x6cb9('0x2')],'unique':_0x6cb9('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x434912){this[_0x6cb9('0x4')]('options',_0x434912?_0x434912['join'](''):[]);},'get':function(){return this[_0x6cb9('0x5')]('options')?this[_0x6cb9('0x5')](_0x6cb9('0x6'))[_0x6cb9('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6cb9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e51e7fe..0807dcf 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 _0xbf6e=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch','request-promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbf6e,0x149));var _0xebf6=function(_0x4b6420,_0x126201){_0x4b6420=_0x4b6420-0x0;var _0x37076f=_0xbf6e[_0x4b6420];return _0x37076f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];function respondWithStatusCode(_0xedc361,_0x4919f1){_0x4919f1=_0x4919f1||0xcc;return function(_0x332ca0){if(_0x332ca0){return _0xedc361[_0xebf6('0x19')](_0x4919f1);}return _0xedc361[_0xebf6('0x1a')](_0x4919f1)[_0xebf6('0x1b')]();};}function respondWithResult(_0x3f69e6,_0x4dbf51){_0x4dbf51=_0x4dbf51||0xc8;return function(_0x4c01f4){if(_0x4c01f4){return _0x3f69e6['status'](_0x4dbf51)[_0xebf6('0x1c')](_0x4c01f4);}};}function respondWithFilteredResult(_0x1ae2f7,_0x50d80f){return function(_0x35570e){if(_0x35570e){var _0x2c980f=typeof _0x50d80f[_0xebf6('0x1d')]===_0xebf6('0x1e')&&typeof _0x50d80f[_0xebf6('0x1f')]===_0xebf6('0x1e');var _0x219621=_0x35570e[_0xebf6('0x20')];var _0x2d3984=_0x2c980f?0x0:_0x50d80f[_0xebf6('0x1d')];var _0x55fa31=_0x2c980f?_0x35570e['count']:_0x50d80f[_0xebf6('0x1d')]+_0x50d80f[_0xebf6('0x1f')];var _0x10051e;if(_0x55fa31>=_0x219621){_0x55fa31=_0x219621;_0x10051e=0xc8;}else{_0x10051e=0xce;}_0x1ae2f7[_0xebf6('0x1a')](_0x10051e);return _0x1ae2f7[_0xebf6('0x21')](_0xebf6('0x22'),_0x2d3984+'-'+_0x55fa31+'/'+_0x219621)[_0xebf6('0x1c')](_0x35570e);}return null;};}function patchUpdates(_0x80f523){return function(_0x4fb497){try{jsonpatch[_0xebf6('0x23')](_0x4fb497,_0x80f523,!![]);}catch(_0x81fdb3){return BPromise[_0xebf6('0x24')](_0x81fdb3);}return _0x4fb497[_0xebf6('0x25')]();};}function saveUpdates(_0x6303ac,_0x14c8ac){return function(_0x2f419e){if(_0x2f419e){return _0x2f419e[_0xebf6('0x26')](_0x6303ac)[_0xebf6('0x27')](function(_0x2e32c6){return _0x2e32c6;});}return null;};}function removeEntity(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(_0x43c4e2){return _0x43c4e2[_0xebf6('0x28')]()[_0xebf6('0x27')](function(){var _0x1d0078=_0x43c4e2[_0xebf6('0x29')]({'plain':!![]});var _0x1534b2=_0xebf6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x1534b2,'resourceId':_0x1d0078['id']}})[_0xebf6('0x27')](function(){return _0x43c4e2;});})['then'](function(){_0x232074[_0xebf6('0x1a')](0xcc)[_0xebf6('0x1b')]();});}};}function handleEntityNotFound(_0x5a01ea,_0x4f39eb){return function(_0x37950c){if(!_0x37950c){_0x5a01ea[_0xebf6('0x19')](0x194);}return _0x37950c;};}function handleError(_0x3c3d5c,_0x7959c8){_0x7959c8=_0x7959c8||0x1f4;return function(_0xedaaeb){logger[_0xebf6('0x2b')](_0xedaaeb[_0xebf6('0x2c')]);if(_0xedaaeb[_0xebf6('0x2d')]){delete _0xedaaeb['name'];}_0x3c3d5c[_0xebf6('0x1a')](_0x7959c8)[_0xebf6('0x2e')](_0xedaaeb);};}exports['index']=function(_0x2fe3ee,_0x28bbea){var _0x5ea6b2={},_0x2901fc={},_0x1fa407={'count':0x0,'rows':[]};var _0x32afa3=_[_0xebf6('0x2f')](db[_0xebf6('0x30')][_0xebf6('0x31')],function(_0x4907d0){return{'name':_0x4907d0[_0xebf6('0x32')],'type':_0x4907d0[_0xebf6('0x33')]['key']};});_0x2901fc['model']=_[_0xebf6('0x2f')](_0x32afa3,_0xebf6('0x2d'));_0x2901fc['query']=_[_0xebf6('0x34')](_0x2fe3ee[_0xebf6('0x35')]);_0x2901fc['filters']=_[_0xebf6('0x36')](_0x2901fc[_0xebf6('0x37')],_0x2901fc[_0xebf6('0x35')]);_0x5ea6b2['attributes']=_[_0xebf6('0x36')](_0x2901fc[_0xebf6('0x37')],qs[_0xebf6('0x38')](_0x2fe3ee[_0xebf6('0x35')]['fields']));_0x5ea6b2['attributes']=_0x5ea6b2[_0xebf6('0x39')][_0xebf6('0x3a')]?_0x5ea6b2['attributes']:_0x2901fc[_0xebf6('0x37')];if(!_0x2fe3ee[_0xebf6('0x35')]['hasOwnProperty'](_0xebf6('0x3b'))){_0x5ea6b2[_0xebf6('0x1f')]=qs[_0xebf6('0x1f')](_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x1f')]);_0x5ea6b2['offset']=qs[_0xebf6('0x1d')](_0x2fe3ee['query'][_0xebf6('0x1d')]);}_0x5ea6b2['order']=qs[_0xebf6('0x3c')](_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x3c')]);_0x5ea6b2[_0xebf6('0x3d')]=qs[_0xebf6('0x3e')](_[_0xebf6('0x3f')](_0x2fe3ee['query'],_0x2901fc[_0xebf6('0x3e')]),_0x32afa3);if(_0x2fe3ee[_0xebf6('0x35')][_0xebf6('0x40')]){_0x5ea6b2[_0xebf6('0x3d')]=_[_0xebf6('0x41')](_0x5ea6b2[_0xebf6('0x3d')],{'$or':_['map'](_0x32afa3,function(_0xcbe240){if(_0xcbe240[_0xebf6('0x33')]!==_0xebf6('0x42')){var _0x111ff7={};_0x111ff7[_0xcbe240[_0xebf6('0x2d')]]={'$like':'%'+_0x2fe3ee[_0xebf6('0x35')]['filter']+'%'};return _0x111ff7;}})});}_0x5ea6b2=_['merge']({},_0x5ea6b2,_0x2fe3ee['options']);var _0xd4d5f4={'where':_0x5ea6b2[_0xebf6('0x3d')]};return db[_0xebf6('0x30')]['count'](_0xd4d5f4)[_0xebf6('0x27')](function(_0x1c3809){_0x1fa407[_0xebf6('0x20')]=_0x1c3809;if(_0x2fe3ee['query'][_0xebf6('0x43')]){_0x5ea6b2[_0xebf6('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xebf6('0x45')](_0x5ea6b2);})[_0xebf6('0x27')](function(_0x17c4af){_0x1fa407['rows']=_0x17c4af;return _0x1fa407;})[_0xebf6('0x27')](respondWithFilteredResult(_0x28bbea,_0x5ea6b2))['catch'](handleError(_0x28bbea,null));};exports['show']=function(_0x256552,_0x470f62){var _0x10ca29={'raw':![],'where':{'id':_0x256552['params']['id']}},_0x2ac140={};_0x2ac140[_0xebf6('0x37')]=_['keys'](db[_0xebf6('0x30')][_0xebf6('0x31')]);_0x2ac140[_0xebf6('0x35')]=_[_0xebf6('0x34')](_0x256552[_0xebf6('0x35')]);_0x2ac140['filters']=_['intersection'](_0x2ac140[_0xebf6('0x37')],_0x2ac140[_0xebf6('0x35')]);_0x10ca29[_0xebf6('0x39')]=_[_0xebf6('0x36')](_0x2ac140['model'],qs[_0xebf6('0x38')](_0x256552[_0xebf6('0x35')][_0xebf6('0x38')]));_0x10ca29[_0xebf6('0x39')]=_0x10ca29[_0xebf6('0x39')][_0xebf6('0x3a')]?_0x10ca29[_0xebf6('0x39')]:_0x2ac140['model'];if(_0x256552[_0xebf6('0x35')][_0xebf6('0x43')]){_0x10ca29[_0xebf6('0x44')]=[{'all':!![]}];}_0x10ca29=_[_0xebf6('0x41')]({},_0x10ca29,_0x256552[_0xebf6('0x46')]);return db[_0xebf6('0x30')][_0xebf6('0x47')](_0x10ca29)['then'](handleEntityNotFound(_0x470f62,null))[_0xebf6('0x27')](respondWithResult(_0x470f62,null))['catch'](handleError(_0x470f62,null));};exports[_0xebf6('0x48')]=function(_0x31d8ba,_0x5d84ac){return db[_0xebf6('0x30')]['create'](_0x31d8ba[_0xebf6('0x49')],{})[_0xebf6('0x27')](function(_0x186655){var _0x32c8b1=_0x31d8ba[_0xebf6('0x4a')]['get']({'plain':!![]});if(!_0x32c8b1)throw new Error(_0xebf6('0x4b'));if(_0x32c8b1[_0xebf6('0x4c')]==='user'){var _0x1f98fd=_0x186655[_0xebf6('0x29')]({'plain':!![]});var _0x1455c4=_0xebf6('0x2a');return db[_0xebf6('0x4d')]['find']({'where':{'name':_0x1455c4,'userProfileId':_0x32c8b1[_0xebf6('0x4e')]},'raw':!![]})[_0xebf6('0x27')](function(_0x212414){if(_0x212414&&_0x212414[_0xebf6('0x4f')]===0x0){return db['UserProfileResource'][_0xebf6('0x48')]({'name':_0x1f98fd[_0xebf6('0x2d')],'resourceId':_0x1f98fd['id'],'type':_0x212414[_0xebf6('0x2d')],'sectionId':_0x212414['id']},{})[_0xebf6('0x27')](function(){return _0x186655;});}else{return _0x186655;}})[_0xebf6('0x50')](function(_0x2e7e30){logger[_0xebf6('0x2b')](_0xebf6('0x51'),_0x2e7e30);throw _0x2e7e30;});}return _0x186655;})[_0xebf6('0x27')](respondWithResult(_0x5d84ac,0xc9))['catch'](handleError(_0x5d84ac,null));};exports[_0xebf6('0x26')]=function(_0xe78fe5,_0x24ed4e){if(_0xe78fe5['body']['id']){delete _0xe78fe5[_0xebf6('0x49')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0xe78fe5[_0xebf6('0x52')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x24ed4e,null))[_0xebf6('0x27')](saveUpdates(_0xe78fe5[_0xebf6('0x49')],null))[_0xebf6('0x27')](respondWithResult(_0x24ed4e,null))['catch'](handleError(_0x24ed4e,null));};exports[_0xebf6('0x28')]=function(_0x5a1b51,_0x4ed306){return db['VoiceChanSpy'][_0xebf6('0x47')]({'where':{'id':_0x5a1b51[_0xebf6('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ed306,null))[_0xebf6('0x27')](removeEntity(_0x4ed306,null))[_0xebf6('0x50')](handleError(_0x4ed306,null));}; \ No newline at end of file +var _0x9b87=['end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9b87,0x8e));var _0x79b8=function(_0x2fcf59,_0x5e50a3){_0x2fcf59=_0x2fcf59-0x0;var _0x909aa1=_0x9b87[_0x2fcf59];return _0x909aa1;};'use strict';var emlformat=require(_0x79b8('0x0'));var rimraf=require(_0x79b8('0x1'));var zipdir=require(_0x79b8('0x2'));var jsonpatch=require(_0x79b8('0x3'));var rp=require(_0x79b8('0x4'));var moment=require(_0x79b8('0x5'));var BPromise=require(_0x79b8('0x6'));var Mustache=require(_0x79b8('0x7'));var util=require(_0x79b8('0x8'));var path=require(_0x79b8('0x9'));var sox=require(_0x79b8('0xa'));var csv=require(_0x79b8('0xb'));var ejs=require(_0x79b8('0xc'));var fs=require('fs');var fs_extra=require(_0x79b8('0xd'));var _=require(_0x79b8('0xe'));var squel=require(_0x79b8('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79b8('0x10'));var Papa=require(_0x79b8('0x11'));var Redis=require(_0x79b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x79b8('0x13'));var as=require(_0x79b8('0x14'));var hardwareService=require(_0x79b8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x79b8('0x16'));var config=require(_0x79b8('0x17'));var licenseUtil=require(_0x79b8('0x18'));var db=require(_0x79b8('0x19'))['db'];function respondWithStatusCode(_0x21ad20,_0x33227b){_0x33227b=_0x33227b||0xcc;return function(_0x41095c){if(_0x41095c){return _0x21ad20[_0x79b8('0x1a')](_0x33227b);}return _0x21ad20[_0x79b8('0x1b')](_0x33227b)[_0x79b8('0x1c')]();};}function respondWithResult(_0x43ec09,_0x59e229){_0x59e229=_0x59e229||0xc8;return function(_0x150fb7){if(_0x150fb7){return _0x43ec09['status'](_0x59e229)['json'](_0x150fb7);}};}function respondWithFilteredResult(_0x3142e9,_0x21aae0){return function(_0x57a248){if(_0x57a248){var _0x5ddab5=typeof _0x21aae0[_0x79b8('0x1d')]==='undefined'&&typeof _0x21aae0['limit']===_0x79b8('0x1e');var _0x24c02f=_0x57a248[_0x79b8('0x1f')];var _0x2ae2d5=_0x5ddab5?0x0:_0x21aae0[_0x79b8('0x1d')];var _0x23d771=_0x5ddab5?_0x57a248['count']:_0x21aae0[_0x79b8('0x1d')]+_0x21aae0['limit'];var _0x53d386;if(_0x23d771>=_0x24c02f){_0x23d771=_0x24c02f;_0x53d386=0xc8;}else{_0x53d386=0xce;}_0x3142e9[_0x79b8('0x1b')](_0x53d386);return _0x3142e9[_0x79b8('0x20')](_0x79b8('0x21'),_0x2ae2d5+'-'+_0x23d771+'/'+_0x24c02f)[_0x79b8('0x22')](_0x57a248);}return null;};}function patchUpdates(_0x1e24cf){return function(_0x1e7507){try{jsonpatch[_0x79b8('0x23')](_0x1e7507,_0x1e24cf,!![]);}catch(_0x261c48){return BPromise[_0x79b8('0x24')](_0x261c48);}return _0x1e7507['save']();};}function saveUpdates(_0x3e9d83,_0x255207){return function(_0x4dbfcf){if(_0x4dbfcf){return _0x4dbfcf[_0x79b8('0x25')](_0x3e9d83)[_0x79b8('0x26')](function(_0x54c605){return _0x54c605;});}return null;};}function removeEntity(_0x28be4b,_0x4f543f){return function(_0x5e8228){if(_0x5e8228){return _0x5e8228[_0x79b8('0x27')]()[_0x79b8('0x26')](function(){var _0x262b48=_0x5e8228[_0x79b8('0x28')]({'plain':!![]});var _0x9deb6c='ChanSpies';return db[_0x79b8('0x29')][_0x79b8('0x27')]({'where':{'type':_0x9deb6c,'resourceId':_0x262b48['id']}})[_0x79b8('0x26')](function(){return _0x5e8228;});})[_0x79b8('0x26')](function(){_0x28be4b['status'](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x2b6fad,_0x14a4d6){return function(_0x4aa92c){if(!_0x4aa92c){_0x2b6fad[_0x79b8('0x1a')](0x194);}return _0x4aa92c;};}function handleError(_0x4a4ef6,_0x43058e){_0x43058e=_0x43058e||0x1f4;return function(_0x2942e9){logger[_0x79b8('0x2a')](_0x2942e9[_0x79b8('0x2b')]);if(_0x2942e9['name']){delete _0x2942e9[_0x79b8('0x2c')];}_0x4a4ef6['status'](_0x43058e)[_0x79b8('0x2d')](_0x2942e9);};}exports['index']=function(_0x3b6a05,_0x1090d2){var _0x300755={},_0x55c631={},_0x1e03c1={'count':0x0,'rows':[]};var _0xc2decd=_[_0x79b8('0x2e')](db[_0x79b8('0x2f')]['rawAttributes'],function(_0x4cb644){return{'name':_0x4cb644['fieldName'],'type':_0x4cb644['type'][_0x79b8('0x30')]};});_0x55c631[_0x79b8('0x31')]=_['map'](_0xc2decd,_0x79b8('0x2c'));_0x55c631['query']=_['keys'](_0x3b6a05[_0x79b8('0x32')]);_0x55c631['filters']=_[_0x79b8('0x33')](_0x55c631[_0x79b8('0x31')],_0x55c631['query']);_0x300755[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x55c631[_0x79b8('0x31')],qs[_0x79b8('0x35')](_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x35')]));_0x300755['attributes']=_0x300755[_0x79b8('0x34')][_0x79b8('0x36')]?_0x300755[_0x79b8('0x34')]:_0x55c631[_0x79b8('0x31')];if(!_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x37')](_0x79b8('0x38'))){_0x300755[_0x79b8('0x39')]=qs[_0x79b8('0x39')](_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x39')]);_0x300755['offset']=qs[_0x79b8('0x1d')](_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x1d')]);}_0x300755['order']=qs[_0x79b8('0x3a')](_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x3a')]);_0x300755[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_[_0x79b8('0x3d')](_0x3b6a05['query'],_0x55c631[_0x79b8('0x3c')]),_0xc2decd);if(_0x3b6a05['query']['filter']){_0x300755[_0x79b8('0x3b')]=_['merge'](_0x300755['where'],{'$or':_[_0x79b8('0x2e')](_0xc2decd,function(_0x1f211a){if(_0x1f211a[_0x79b8('0x3e')]!==_0x79b8('0x3f')){var _0x43d795={};_0x43d795[_0x1f211a[_0x79b8('0x2c')]]={'$like':'%'+_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x40')]+'%'};return _0x43d795;}})});}_0x300755=_[_0x79b8('0x41')]({},_0x300755,_0x3b6a05[_0x79b8('0x42')]);var _0x10f8e1={'where':_0x300755[_0x79b8('0x3b')]};return db[_0x79b8('0x2f')]['count'](_0x10f8e1)[_0x79b8('0x26')](function(_0x13b041){_0x1e03c1['count']=_0x13b041;if(_0x3b6a05[_0x79b8('0x32')][_0x79b8('0x43')]){_0x300755['include']=[{'all':!![]}];}return db[_0x79b8('0x2f')][_0x79b8('0x44')](_0x300755);})[_0x79b8('0x26')](function(_0x28d4e4){_0x1e03c1[_0x79b8('0x45')]=_0x28d4e4;return _0x1e03c1;})[_0x79b8('0x26')](respondWithFilteredResult(_0x1090d2,_0x300755))[_0x79b8('0x46')](handleError(_0x1090d2,null));};exports[_0x79b8('0x47')]=function(_0xb10351,_0x37ca43){var _0x31a1c1={'raw':![],'where':{'id':_0xb10351['params']['id']}},_0x379217={};_0x379217['model']=_[_0x79b8('0x48')](db[_0x79b8('0x2f')][_0x79b8('0x49')]);_0x379217[_0x79b8('0x32')]=_['keys'](_0xb10351[_0x79b8('0x32')]);_0x379217[_0x79b8('0x3c')]=_[_0x79b8('0x33')](_0x379217[_0x79b8('0x31')],_0x379217['query']);_0x31a1c1[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x379217[_0x79b8('0x31')],qs[_0x79b8('0x35')](_0xb10351['query'][_0x79b8('0x35')]));_0x31a1c1[_0x79b8('0x34')]=_0x31a1c1[_0x79b8('0x34')][_0x79b8('0x36')]?_0x31a1c1[_0x79b8('0x34')]:_0x379217[_0x79b8('0x31')];if(_0xb10351['query'][_0x79b8('0x43')]){_0x31a1c1[_0x79b8('0x4a')]=[{'all':!![]}];}_0x31a1c1=_[_0x79b8('0x41')]({},_0x31a1c1,_0xb10351[_0x79b8('0x42')]);return db['VoiceChanSpy']['find'](_0x31a1c1)[_0x79b8('0x26')](handleEntityNotFound(_0x37ca43,null))[_0x79b8('0x26')](respondWithResult(_0x37ca43,null))[_0x79b8('0x46')](handleError(_0x37ca43,null));};exports[_0x79b8('0x4b')]=function(_0x32e7ea,_0x19272d){return db[_0x79b8('0x2f')][_0x79b8('0x4b')](_0x32e7ea[_0x79b8('0x4c')],{})['then'](function(_0x19ad75){var _0x374fe9=_0x32e7ea[_0x79b8('0x4d')]['get']({'plain':!![]});if(!_0x374fe9)throw new Error(_0x79b8('0x4e'));if(_0x374fe9['role']==='user'){var _0x24ebb2=_0x19ad75[_0x79b8('0x28')]({'plain':!![]});var _0x5b4d56=_0x79b8('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x5b4d56,'userProfileId':_0x374fe9[_0x79b8('0x50')]},'raw':!![]})[_0x79b8('0x26')](function(_0x14f722){if(_0x14f722&&_0x14f722[_0x79b8('0x51')]===0x0){return db[_0x79b8('0x29')][_0x79b8('0x4b')]({'name':_0x24ebb2[_0x79b8('0x2c')],'resourceId':_0x24ebb2['id'],'type':_0x14f722[_0x79b8('0x2c')],'sectionId':_0x14f722['id']},{})[_0x79b8('0x26')](function(){return _0x19ad75;});}else{return _0x19ad75;}})[_0x79b8('0x46')](function(_0x2455c6){logger[_0x79b8('0x2a')](_0x79b8('0x52'),_0x2455c6);throw _0x2455c6;});}return _0x19ad75;})[_0x79b8('0x26')](respondWithResult(_0x19272d,0xc9))['catch'](handleError(_0x19272d,null));};exports[_0x79b8('0x25')]=function(_0x16f272,_0x2eb440){if(_0x16f272[_0x79b8('0x4c')]['id']){delete _0x16f272['body']['id'];}return db['VoiceChanSpy'][_0x79b8('0x53')]({'where':{'id':_0x16f272[_0x79b8('0x54')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x2eb440,null))[_0x79b8('0x26')](saveUpdates(_0x16f272['body'],null))[_0x79b8('0x26')](respondWithResult(_0x2eb440,null))[_0x79b8('0x46')](handleError(_0x2eb440,null));};exports['destroy']=function(_0x8e0f70,_0x43efcf){return db[_0x79b8('0x2f')]['find']({'where':{'id':_0x8e0f70[_0x79b8('0x54')]['id']}})['then'](handleEntityNotFound(_0x43efcf,null))[_0x79b8('0x26')](removeEntity(_0x43efcf,null))[_0x79b8('0x46')](handleError(_0x43efcf,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 0c7c945..0ced1f8 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 _0x359c=['prefix','push','merge','Set','chanspy','record','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','findAll','agent','then','catch','exports','models','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','context','%s%s'];(function(_0x432d65,_0x1cb101){var _0x4669dc=function(_0x3c067c){while(--_0x3c067c){_0x432d65['push'](_0x432d65['shift']());}};_0x4669dc(++_0x1cb101);}(_0x359c,0x64));var _0xc359=function(_0x6be190,_0x25e8dd){_0x6be190=_0x6be190-0x0;var _0x3867df=_0x359c[_0x6be190];return _0x3867df;};'use strict';var _=require(_0xc359('0x0'));var util=require(_0xc359('0x1'));var BPromise=require(_0xc359('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x26ac24,_0x13b9fc,_0x3d30c6){var _0x7f7a02=0x1;var _0xaa9c40=[];var _0x35dc25={'context':_0x13b9fc[_0xc359('0x3')]||'from-sip','exten':util['format'](_0xc359('0x4'),_0x26ac24[_0xc359('0x5')],_0x3d30c6),'type':'system','isApp':![],'ChanSpyId':_0x26ac24['id'],'UserId':_0x13b9fc['id']};_0xaa9c40[_0xc359('0x6')](_[_0xc359('0x7')]({'app':_0xc359('0x8'),'appdata':util['format']('CDR(type)=%s',_0xc359('0x9')),'priority':_0x7f7a02++},_0x35dc25));if(_0x26ac24[_0xc359('0xa')]){_0xaa9c40['push'](_[_0xc359('0x7')]({'app':_0xc359('0xb'),'appdata':util[_0xc359('0xc')](_0xc359('0xd'),_0x26ac24[_0xc359('0xe')]),'priority':_0x7f7a02++},_0x35dc25));}if(_0x26ac24[_0xc359('0xf')]){_0xaa9c40[_0xc359('0x6')](_[_0xc359('0x7')]({'app':_0xc359('0x10'),'appdata':_0x26ac24[_0xc359('0x11')],'priority':_0x7f7a02++},_0x35dc25));}_0xaa9c40[_0xc359('0x6')](_[_0xc359('0x7')]({'app':_0xc359('0x12'),'appdata':util[_0xc359('0xc')](_0xc359('0x13'),_0x13b9fc[_0xc359('0x14')],_0x26ac24[_0xc359('0x15')]?_0x26ac24[_0xc359('0x15')][_0xc359('0x16')](''):''),'priority':_0x7f7a02++},_0x35dc25));if(_0x26ac24[_0xc359('0xa')]){_0xaa9c40[_0xc359('0x6')](_['merge']({'app':_0xc359('0x17'),'priority':_0x7f7a02++},_0x35dc25));}return _0xaa9c40;};var getChanSpyApplications=function(_0xea4578,_0x4030aa){var _0x3703ed=[];for(var _0x52d3b0=0x0,_0x5c5a5f=0x1;_0x52d3b0<_0x4030aa[_0xc359('0x18')];_0x52d3b0++,_0x5c5a5f=0x1){_0x3703ed=_0x3703ed['concat'](getUserApplications(_0xea4578,_0x4030aa[_0x52d3b0],_0x4030aa[_0x52d3b0][_0xc359('0x19')]));if(_0x4030aa[_0x52d3b0][_0xc359('0x19')]!=_0x4030aa[_0x52d3b0][_0xc359('0x14')]){_0x3703ed=_0x3703ed['concat'](getUserApplications(_0xea4578,_0x4030aa[_0x52d3b0],_0x4030aa[_0x52d3b0][_0xc359('0x14')]));}}return _0x3703ed;};var getChanSpyPromise=function(_0x2ec0bd,_0x573164){return new BPromise(function(_0x3dca5d,_0x441e22){return _0x2ec0bd['User'][_0xc359('0x1a')]({'attributes':['id','name',_0xc359('0x19')],'where':{'role':_0xc359('0x1b'),'chanspy':!![]},'raw':!![]})[_0xc359('0x1c')](function(_0x3a2eca){if(_0x3a2eca){return _0x3dca5d(getChanSpyApplications(_0x573164,_0x3a2eca));}return _0x3dca5d([]);})[_0xc359('0x1d')](function(_0x5e08e3){_0x441e22(_0x5e08e3);});});};module[_0xc359('0x1e')]=function(_0x3a4c38,_0x3d7569){var _0x4d5cf7=_0x3a4c38[_0xc359('0x1f')];return _0x3a4c38['define']('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x22e44a,_0x594650,_0x3fa66f){return getChanSpyPromise(_0x4d5cf7,_0x22e44a)[_0xc359('0x1c')](function(_0x52f829){if(_0x52f829&&_0x52f829['length']){return _0x4d5cf7[_0xc359('0x20')]['bulkCreate'](_0x52f829);}})['then'](function(){_0x3fa66f();})[_0xc359('0x1d')](function(_0x3bf725){_0x3fa66f(_0x3bf725);});},'afterUpdate':function(_0x283952,_0x33da74,_0x5e2e6c){return _0x4d5cf7[_0xc359('0x20')]['destroy']({'where':{'ChanSpyId':_0x283952['id']}})['then'](function(){return getChanSpyPromise(_0x4d5cf7,_0x283952);})[_0xc359('0x1c')](function(_0x2830b3){if(_0x2830b3&&_0x2830b3[_0xc359('0x18')]){return _0x4d5cf7[_0xc359('0x20')][_0xc359('0x21')](_0x2830b3);}})[_0xc359('0x1c')](function(){_0x5e2e6c();})[_0xc359('0x1d')](function(_0x6227da){_0x5e2e6c(_0x6227da);});},'afterDestroy':function(_0x5b26bf,_0xd58606,_0x577467){return _0x4d5cf7['VoiceExtension'][_0xc359('0x22')]({'where':{'ChanSpyId':_0x5b26bf['id']}})[_0xc359('0x1c')](function(){_0x577467();})[_0xc359('0x1d')](function(_0x24ebf4){_0x577467(_0x24ebf4);});}}});}; \ No newline at end of file +var _0xefcb=['context','%s%s','system','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','format','${UNIQUEID}.%s,a','auth','push','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','agent','then','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','catch','lodash','util','bluebird','./voiceChanSpy.attributes'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xefcb,0xe0));var _0xbefc=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xefcb[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xbefc('0x0'));var util=require(_0xbefc('0x1'));var BPromise=require(_0xbefc('0x2'));var attributes=require(_0xbefc('0x3'));var getUserApplications=function(_0x1b8912,_0x5a02c9,_0x88f7b7){var _0x3b3dd7=0x1;var _0x1b4311=[];var _0x3e3497={'context':_0x5a02c9[_0xbefc('0x4')]||'from-sip','exten':util['format'](_0xbefc('0x5'),_0x1b8912['prefix'],_0x88f7b7),'type':_0xbefc('0x6'),'isApp':![],'ChanSpyId':_0x1b8912['id'],'UserId':_0x5a02c9['id']};_0x1b4311['push'](_[_0xbefc('0x7')]({'app':_0xbefc('0x8'),'appdata':util['format'](_0xbefc('0x9'),_0xbefc('0xa')),'priority':_0x3b3dd7++},_0x3e3497));if(_0x1b8912[_0xbefc('0xb')]){_0x1b4311['push'](_['merge']({'app':_0xbefc('0xc'),'appdata':util[_0xbefc('0xd')](_0xbefc('0xe'),_0x1b8912['recordingFormat']),'priority':_0x3b3dd7++},_0x3e3497));}if(_0x1b8912[_0xbefc('0xf')]){_0x1b4311[_0xbefc('0x10')](_[_0xbefc('0x7')]({'app':'Authenticate','appdata':_0x1b8912[_0xbefc('0x11')],'priority':_0x3b3dd7++},_0x3e3497));}_0x1b4311['push'](_['merge']({'app':_0xbefc('0x12'),'appdata':util[_0xbefc('0xd')](_0xbefc('0x13'),_0x5a02c9[_0xbefc('0x14')],_0x1b8912['options']?_0x1b8912[_0xbefc('0x15')][_0xbefc('0x16')](''):''),'priority':_0x3b3dd7++},_0x3e3497));if(_0x1b8912[_0xbefc('0xb')]){_0x1b4311[_0xbefc('0x10')](_[_0xbefc('0x7')]({'app':_0xbefc('0x17'),'priority':_0x3b3dd7++},_0x3e3497));}return _0x1b4311;};var getChanSpyApplications=function(_0x3d32fc,_0x10541c){var _0xed1678=[];for(var _0x24a12d=0x0,_0x37f755=0x1;_0x24a12d<_0x10541c[_0xbefc('0x18')];_0x24a12d++,_0x37f755=0x1){_0xed1678=_0xed1678['concat'](getUserApplications(_0x3d32fc,_0x10541c[_0x24a12d],_0x10541c[_0x24a12d][_0xbefc('0x19')]));if(_0x10541c[_0x24a12d][_0xbefc('0x19')]!=_0x10541c[_0x24a12d][_0xbefc('0x14')]){_0xed1678=_0xed1678[_0xbefc('0x1a')](getUserApplications(_0x3d32fc,_0x10541c[_0x24a12d],_0x10541c[_0x24a12d][_0xbefc('0x14')]));}}return _0xed1678;};var getChanSpyPromise=function(_0xc53cd6,_0x5d2406){return new BPromise(function(_0x4bf756,_0x5c893e){return _0xc53cd6[_0xbefc('0x1b')]['findAll']({'attributes':['id',_0xbefc('0x14'),'internal'],'where':{'role':_0xbefc('0x1c'),'chanspy':!![]},'raw':!![]})[_0xbefc('0x1d')](function(_0x481ad7){if(_0x481ad7){return _0x4bf756(getChanSpyApplications(_0x5d2406,_0x481ad7));}return _0x4bf756([]);})['catch'](function(_0x42b523){_0x5c893e(_0x42b523);});});};module[_0xbefc('0x1e')]=function(_0x198667,_0x53c52f){var _0x3ce651=_0x198667[_0xbefc('0x1f')];return _0x198667[_0xbefc('0x20')](_0xbefc('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a778c,_0xae29f1,_0x3991aa){return getChanSpyPromise(_0x3ce651,_0x5a778c)[_0xbefc('0x1d')](function(_0x4b9ecb){if(_0x4b9ecb&&_0x4b9ecb[_0xbefc('0x18')]){return _0x3ce651[_0xbefc('0x22')][_0xbefc('0x23')](_0x4b9ecb);}})['then'](function(){_0x3991aa();})['catch'](function(_0x4b623f){_0x3991aa(_0x4b623f);});},'afterUpdate':function(_0x2525ed,_0x325f6c,_0x346c2c){return _0x3ce651[_0xbefc('0x22')][_0xbefc('0x24')]({'where':{'ChanSpyId':_0x2525ed['id']}})[_0xbefc('0x1d')](function(){return getChanSpyPromise(_0x3ce651,_0x2525ed);})['then'](function(_0x4ccde8){if(_0x4ccde8&&_0x4ccde8[_0xbefc('0x18')]){return _0x3ce651['VoiceExtension']['bulkCreate'](_0x4ccde8);}})[_0xbefc('0x1d')](function(){_0x346c2c();})[_0xbefc('0x25')](function(_0x159b80){_0x346c2c(_0x159b80);});},'afterDestroy':function(_0x591ae3,_0x28d4b9,_0xf74b90){return _0x3ce651[_0xbefc('0x22')][_0xbefc('0x24')]({'where':{'ChanSpyId':_0x591ae3['id']}})[_0xbefc('0x1d')](function(){_0xf74b90();})['catch'](function(_0x2094a4){_0xf74b90(_0x2094a4);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b28ca28..a6a8888 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 _0xe739=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger'];(function(_0x1d6a6c,_0x1f0fca){var _0x320a67=function(_0x56e64a){while(--_0x56e64a){_0x1d6a6c['push'](_0x1d6a6c['shift']());}};_0x320a67(++_0x1f0fca);}(_0xe739,0x105));var _0x9e73=function(_0x15a720,_0x285add){_0x15a720=_0x15a720-0x0;var _0x10233b=_0xe739[_0x15a720];return _0x10233b;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var moment=require(_0x9e73('0x1'));var BPromise=require(_0x9e73('0x2'));var rs=require(_0x9e73('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e73('0x4'))(_0x9e73('0x5'));var config=require(_0x9e73('0x6'));var jayson=require(_0x9e73('0x7'));var client=jayson['client'][_0x9e73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26cb5b,_0xb37872,_0x5e46e7){return new BPromise(function(_0xa49f86,_0x1ee042){return client[_0x9e73('0x9')](_0x26cb5b,_0x5e46e7)[_0x9e73('0xa')](function(_0x14de8a){logger[_0x9e73('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0xb37872,_0x9e73('0xc'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0xb37872,_0x9e73('0xc'),JSON['stringify'](_0x14de8a));if(_0x14de8a[_0x9e73('0xd')]){if(_0x14de8a[_0x9e73('0xd')][_0x9e73('0xe')]===0x1f4){logger['error'](_0x9e73('0xf'),_0xb37872,_0x14de8a[_0x9e73('0xd')][_0x9e73('0x10')]);return _0x1ee042(_0x14de8a[_0x9e73('0xd')]['message']);}logger[_0x9e73('0xd')](_0x9e73('0xf'),_0xb37872,_0x14de8a[_0x9e73('0xd')]['message']);return _0xa49f86(_0x14de8a[_0x9e73('0xd')][_0x9e73('0x10')]);}else{logger['info'](_0x9e73('0xf'),_0xb37872,_0x9e73('0xc'));_0xa49f86(_0x14de8a[_0x9e73('0x11')]['message']);}})[_0x9e73('0x12')](function(_0x51968a){logger[_0x9e73('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0xb37872,_0x51968a);_0x1ee042(_0x51968a);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceChanSpy,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x1d3114,_0x48f12e){var _0x3e7a64=function(_0x127751){while(--_0x127751){_0x1d3114['push'](_0x1d3114['shift']());}};_0x3e7a64(++_0x48f12e);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 93227f0..8dfb9a7 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 _0x5906=['./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','path','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x5906,0x10a));var _0x6590=function(_0x2a83d8,_0xe190c9){_0x2a83d8=_0x2a83d8-0x0;var _0x29ae0f=_0x5906[_0x2a83d8];return _0x29ae0f;};'use strict';var multer=require(_0x6590('0x0'));var util=require(_0x6590('0x1'));var path=require(_0x6590('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6590('0x3'));var auth=require(_0x6590('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6590('0x5'));var controller=require(_0x6590('0x6'));router[_0x6590('0x7')]('/',auth[_0x6590('0x8')](),controller[_0x6590('0x9')]);router[_0x6590('0x7')](_0x6590('0xa'),auth[_0x6590('0x8')](),controller[_0x6590('0xb')]);router[_0x6590('0xc')]('/',auth[_0x6590('0x8')](),controller['create']);router[_0x6590('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6590('0xe')]);router[_0x6590('0xf')]('/:id',auth[_0x6590('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaed9=['get','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','../../config/environment','./voiceContext.controller','isAuthenticated','index'];(function(_0x23cc08,_0x32d5cb){var _0x168fb6=function(_0x2a0d63){while(--_0x2a0d63){_0x23cc08['push'](_0x23cc08['shift']());}};_0x168fb6(++_0x32d5cb);}(_0xaed9,0x119));var _0x9aed=function(_0x9cbf0c,_0x3a07f3){_0x9cbf0c=_0x9cbf0c-0x0;var _0x5202c1=_0xaed9[_0x9cbf0c];return _0x5202c1;};'use strict';var multer=require(_0x9aed('0x0'));var util=require(_0x9aed('0x1'));var path=require('path');var timeout=require(_0x9aed('0x2'));var express=require(_0x9aed('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9aed('0x4'));var controller=require(_0x9aed('0x5'));router['get']('/',auth[_0x9aed('0x6')](),controller[_0x9aed('0x7')]);router[_0x9aed('0x8')](_0x9aed('0x9'),auth[_0x9aed('0x6')](),controller[_0x9aed('0xa')]);router[_0x9aed('0xb')]('/',auth[_0x9aed('0x6')](),controller[_0x9aed('0xc')]);router[_0x9aed('0xd')](_0x9aed('0x9'),auth['isAuthenticated'](),controller[_0x9aed('0xe')]);router[_0x9aed('0xf')](_0x9aed('0x9'),auth[_0x9aed('0x6')](),controller['destroy']);module[_0x9aed('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2fb37b3..0c0f09b 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 _0xacc2=['sequelize','exports','STRING','name'];(function(_0x57935b,_0x58a5a8){var _0x553104=function(_0x30ca25){while(--_0x30ca25){_0x57935b['push'](_0x57935b['shift']());}};_0x553104(++_0x58a5a8);}(_0xacc2,0xf8));var _0x2acc=function(_0x3d0b13,_0x3c3598){_0x3d0b13=_0x3d0b13-0x0;var _0x30cc19=_0xacc2[_0x3d0b13];return _0x30cc19;};'use strict';var Sequelize=require(_0x2acc('0x0'));module[_0x2acc('0x1')]={'name':{'type':Sequelize[_0x2acc('0x2')],'unique':_0x2acc('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7767=['STRING','name','BOOLEAN','sequelize'];(function(_0x3bf337,_0x4804b3){var _0x255244=function(_0x24783a){while(--_0x24783a){_0x3bf337['push'](_0x3bf337['shift']());}};_0x255244(++_0x4804b3);}(_0x7767,0x16f));var _0x7776=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x7767[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0x7776('0x0'));module['exports']={'name':{'type':Sequelize[_0x7776('0x1')],'unique':_0x7776('0x2')},'description':{'type':Sequelize[_0x7776('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7776('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 949ec36..b212350 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 _0x0941=['fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','create','body','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/context.ejs','update','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes'];(function(_0x86f10a,_0xe3ff52){var _0x3143b6=function(_0x27b711){while(--_0x27b711){_0x86f10a['push'](_0x86f10a['shift']());}};_0x3143b6(++_0xe3ff52);}(_0x0941,0xf6));var _0x1094=function(_0x452502,_0x4a26f5){_0x452502=_0x452502-0x0;var _0x15904f=_0x0941[_0x452502];return _0x15904f;};'use strict';var emlformat=require(_0x1094('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1094('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1094('0x2'));var BPromise=require(_0x1094('0x3'));var Mustache=require(_0x1094('0x4'));var util=require(_0x1094('0x5'));var path=require(_0x1094('0x6'));var sox=require(_0x1094('0x7'));var csv=require(_0x1094('0x8'));var ejs=require(_0x1094('0x9'));var fs=require('fs');var fs_extra=require(_0x1094('0xa'));var _=require(_0x1094('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1094('0x8'));var querystring=require('querystring');var Papa=require(_0x1094('0xc'));var Redis=require(_0x1094('0xd'));var authService=require(_0x1094('0xe'));var qs=require(_0x1094('0xf'));var as=require(_0x1094('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1094('0x11'))(_0x1094('0x12'));var utils=require(_0x1094('0x13'));var config=require(_0x1094('0x14'));var licenseUtil=require(_0x1094('0x15'));var db=require(_0x1094('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1094('0x17')][_0x1094('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x30d73c,_0x22d100,_0x6cabcb,_0x210a78){return new BPromise(function(_0x5254d2,_0x9ed1b){var _0x239502=_0x210a78||client;return _0x239502[_0x1094('0x19')](_0x30d73c,_0x6cabcb)['then'](function(_0x235002){logger[_0x1094('0x1a')](_0x1094('0x1b'),_0x22d100,'request\x20sent');logger[_0x1094('0x1c')](_0x1094('0x1d'),_0x22d100,'request\x20sent',JSON[_0x1094('0x1e')](_0x235002));if(_0x235002[_0x1094('0x1f')]){if(_0x235002[_0x1094('0x1f')][_0x1094('0x20')]===0x1f4){logger[_0x1094('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x22d100,_0x235002['error'][_0x1094('0x21')]);return _0x9ed1b(_0x235002[_0x1094('0x1f')][_0x1094('0x21')]);}logger[_0x1094('0x1f')](_0x1094('0x1b'),_0x22d100,_0x235002[_0x1094('0x1f')][_0x1094('0x21')]);return _0x5254d2(_0x235002[_0x1094('0x1f')]['message']);}else{logger[_0x1094('0x1a')](_0x1094('0x1b'),_0x22d100,_0x1094('0x22'));_0x5254d2(_0x235002['result']['message']);}})[_0x1094('0x23')](function(_0x377909){logger[_0x1094('0x1f')](_0x1094('0x1b'),_0x22d100,_0x377909);_0x9ed1b(_0x377909);});});}function respondWithStatusCode(_0x3d9a03,_0x5c1f6a){_0x5c1f6a=_0x5c1f6a||0xcc;return function(_0x2cd9d2){if(_0x2cd9d2){return _0x3d9a03[_0x1094('0x24')](_0x5c1f6a);}return _0x3d9a03[_0x1094('0x25')](_0x5c1f6a)[_0x1094('0x26')]();};}function respondWithResult(_0xe061c5,_0x59ef6d){_0x59ef6d=_0x59ef6d||0xc8;return function(_0x33233d){if(_0x33233d){return _0xe061c5[_0x1094('0x25')](_0x59ef6d)[_0x1094('0x27')](_0x33233d);}};}function respondWithFilteredResult(_0x42ff4d,_0x325fac){return function(_0x1ebecb){if(_0x1ebecb){var _0xaf4770=typeof _0x325fac[_0x1094('0x28')]===_0x1094('0x29')&&typeof _0x325fac[_0x1094('0x2a')]===_0x1094('0x29');var _0x2aa770=_0x1ebecb['count'];var _0x2fbb12=_0xaf4770?0x0:_0x325fac[_0x1094('0x28')];var _0x55a60c=_0xaf4770?_0x1ebecb['count']:_0x325fac[_0x1094('0x28')]+_0x325fac['limit'];var _0x2037d5;if(_0x55a60c>=_0x2aa770){_0x55a60c=_0x2aa770;_0x2037d5=0xc8;}else{_0x2037d5=0xce;}_0x42ff4d[_0x1094('0x25')](_0x2037d5);return _0x42ff4d[_0x1094('0x2b')](_0x1094('0x2c'),_0x2fbb12+'-'+_0x55a60c+'/'+_0x2aa770)[_0x1094('0x27')](_0x1ebecb);}return null;};}function patchUpdates(_0x3f121c){return function(_0x31bebc){try{jsonpatch[_0x1094('0x2d')](_0x31bebc,_0x3f121c,!![]);}catch(_0x1c0462){return BPromise['reject'](_0x1c0462);}return _0x31bebc[_0x1094('0x2e')]();};}function saveUpdates(_0x513d1e,_0x504db6){return function(_0x41e76b){if(_0x41e76b){return _0x41e76b['update'](_0x513d1e)[_0x1094('0x2f')](function(_0x1d5566){return _0x1d5566;});}return null;};}function removeEntity(_0x1e8bab,_0x495409){return function(_0x33b883){if(_0x33b883){return _0x33b883[_0x1094('0x30')]()[_0x1094('0x2f')](function(){var _0x416d8c=_0x33b883[_0x1094('0x31')]({'plain':!![]});var _0x59f57a='Contexts';return db[_0x1094('0x32')]['destroy']({'where':{'type':_0x59f57a,'resourceId':_0x416d8c['id']}})[_0x1094('0x2f')](function(){return _0x33b883;});})[_0x1094('0x2f')](function(){_0x1e8bab[_0x1094('0x25')](0xcc)[_0x1094('0x26')]();});}};}function handleEntityNotFound(_0x4ff563,_0x1f18bb){return function(_0x4e64f3){if(!_0x4e64f3){_0x4ff563[_0x1094('0x24')](0x194);}return _0x4e64f3;};}function handleError(_0x559e30,_0x5ca859){_0x5ca859=_0x5ca859||0x1f4;return function(_0x24e177){logger[_0x1094('0x1f')](_0x24e177[_0x1094('0x33')]);if(_0x24e177[_0x1094('0x34')]){delete _0x24e177[_0x1094('0x34')];}_0x559e30[_0x1094('0x25')](_0x5ca859)[_0x1094('0x35')](_0x24e177);};}exports[_0x1094('0x36')]=function(_0x3cf241,_0x359326){var _0x297eca={},_0x33860c={},_0x3c1211={'count':0x0,'rows':[]};var _0x4bec4c=_[_0x1094('0x37')](db[_0x1094('0x38')][_0x1094('0x39')],function(_0x3beaa0){return{'name':_0x3beaa0[_0x1094('0x3a')],'type':_0x3beaa0[_0x1094('0x3b')][_0x1094('0x3c')]};});_0x33860c['model']=_[_0x1094('0x37')](_0x4bec4c,_0x1094('0x34'));_0x33860c[_0x1094('0x3d')]=_[_0x1094('0x3e')](_0x3cf241[_0x1094('0x3d')]);_0x33860c[_0x1094('0x3f')]=_[_0x1094('0x40')](_0x33860c['model'],_0x33860c[_0x1094('0x3d')]);_0x297eca[_0x1094('0x41')]=_[_0x1094('0x40')](_0x33860c['model'],qs['fields'](_0x3cf241[_0x1094('0x3d')][_0x1094('0x42')]));_0x297eca[_0x1094('0x41')]=_0x297eca[_0x1094('0x41')][_0x1094('0x43')]?_0x297eca[_0x1094('0x41')]:_0x33860c[_0x1094('0x44')];if(!_0x3cf241[_0x1094('0x3d')][_0x1094('0x45')](_0x1094('0x46'))){_0x297eca[_0x1094('0x2a')]=qs[_0x1094('0x2a')](_0x3cf241['query'][_0x1094('0x2a')]);_0x297eca[_0x1094('0x28')]=qs['offset'](_0x3cf241[_0x1094('0x3d')][_0x1094('0x28')]);}_0x297eca[_0x1094('0x47')]=qs[_0x1094('0x48')](_0x3cf241[_0x1094('0x3d')]['sort']);_0x297eca[_0x1094('0x49')]=qs['filters'](_[_0x1094('0x4a')](_0x3cf241[_0x1094('0x3d')],_0x33860c[_0x1094('0x3f')]),_0x4bec4c);if(_0x3cf241[_0x1094('0x3d')]['filter']){_0x297eca[_0x1094('0x49')]=_[_0x1094('0x4b')](_0x297eca['where'],{'$or':_['map'](_0x4bec4c,function(_0x2a4a06){if(_0x2a4a06[_0x1094('0x3b')]!==_0x1094('0x4c')){var _0x33baf6={};_0x33baf6[_0x2a4a06['name']]={'$like':'%'+_0x3cf241[_0x1094('0x3d')]['filter']+'%'};return _0x33baf6;}})});}_0x297eca=_['merge']({},_0x297eca,_0x3cf241[_0x1094('0x4d')]);var _0x10b9c4={'where':_0x297eca[_0x1094('0x49')]};return db[_0x1094('0x38')][_0x1094('0x4e')](_0x10b9c4)[_0x1094('0x2f')](function(_0x9458a2){_0x3c1211[_0x1094('0x4e')]=_0x9458a2;if(_0x3cf241[_0x1094('0x3d')][_0x1094('0x4f')]){_0x297eca['include']=[{'all':!![]}];}return db[_0x1094('0x38')][_0x1094('0x50')](_0x297eca);})[_0x1094('0x2f')](function(_0x44e2c9){_0x3c1211[_0x1094('0x51')]=_0x44e2c9;return _0x3c1211;})[_0x1094('0x2f')](respondWithFilteredResult(_0x359326,_0x297eca))[_0x1094('0x23')](handleError(_0x359326,null));};exports[_0x1094('0x52')]=function(_0x5a3d53,_0x2bd490){var _0x26741f={'raw':![],'where':{'id':_0x5a3d53[_0x1094('0x53')]['id']}},_0x2f911c={};_0x2f911c[_0x1094('0x44')]=_[_0x1094('0x3e')](db['VoiceContext'][_0x1094('0x39')]);_0x2f911c[_0x1094('0x3d')]=_[_0x1094('0x3e')](_0x5a3d53[_0x1094('0x3d')]);_0x2f911c[_0x1094('0x3f')]=_[_0x1094('0x40')](_0x2f911c[_0x1094('0x44')],_0x2f911c[_0x1094('0x3d')]);_0x26741f[_0x1094('0x41')]=_[_0x1094('0x40')](_0x2f911c['model'],qs[_0x1094('0x42')](_0x5a3d53[_0x1094('0x3d')][_0x1094('0x42')]));_0x26741f[_0x1094('0x41')]=_0x26741f[_0x1094('0x41')][_0x1094('0x43')]?_0x26741f[_0x1094('0x41')]:_0x2f911c['model'];if(_0x5a3d53[_0x1094('0x3d')][_0x1094('0x4f')]){_0x26741f[_0x1094('0x54')]=[{'all':!![]}];}_0x26741f=_['merge']({},_0x26741f,_0x5a3d53[_0x1094('0x4d')]);return db[_0x1094('0x38')]['find'](_0x26741f)['then'](handleEntityNotFound(_0x2bd490,null))[_0x1094('0x2f')](respondWithResult(_0x2bd490,null))[_0x1094('0x23')](handleError(_0x2bd490,null));};exports[_0x1094('0x55')]=function(_0xe37d1d,_0x6f8358,_0x35d0c5){var _0x37ac0e;return db[_0x1094('0x38')]['create'](_0xe37d1d[_0x1094('0x56')],{'raw':!![]})['then'](function(_0xc46604){_0x37ac0e=_0xc46604;return db[_0x1094('0x38')]['findAll']({'raw':!![]});})[_0x1094('0x2f')](function(_0x16f59e){var _0x5981e7=fs[_0x1094('0x57')](path['join'](config[_0x1094('0x58')],'server/files/templates/context.ejs'),_0x1094('0x59'));var _0x43f4b4=ejs[_0x1094('0x5a')](_0x5981e7,{'contexts':_0x16f59e||[]});fs[_0x1094('0x5b')](_0x1094('0x5c'),_0x43f4b4);})[_0x1094('0x2f')](function(){return respondWithRpcPromise(_0x1094('0x5d'),_0x1094('0x55'),{'module':_0x1094('0x5e')});})[_0x1094('0x2f')](function(){var _0x319b77=_0xe37d1d['user'][_0x1094('0x31')]({'plain':!![]});if(!_0x319b77)throw new Error(_0x1094('0x5f'));if(_0x319b77[_0x1094('0x60')]===_0x1094('0x61')){var _0x5bee65=_0x37ac0e[_0x1094('0x31')]({'plain':!![]});return db['UserProfileSection'][_0x1094('0x62')]({'where':{'name':'Contexts','userProfileId':_0x319b77[_0x1094('0x63')]},'raw':!![]})[_0x1094('0x2f')](function(_0x5cd79b){if(_0x5cd79b&&_0x5cd79b[_0x1094('0x64')]===0x0){return db[_0x1094('0x32')]['create']({'name':_0x5bee65[_0x1094('0x34')],'resourceId':_0x5bee65['id'],'type':_0x5cd79b[_0x1094('0x34')],'sectionId':_0x5cd79b['id']},{})['then'](function(){return _0x37ac0e;});}else{return _0x37ac0e;}})[_0x1094('0x23')](function(_0x4c9782){logger[_0x1094('0x1f')](_0x1094('0x65'),_0x4c9782);throw _0x4c9782;});}return _0x37ac0e;})[_0x1094('0x2f')](respondWithResult(_0x6f8358,0xc9))['catch'](handleError(_0x6f8358,null));};exports['update']=function(_0x3f16fe,_0x3cac59,_0x34b2e6){var _0x48a33a;return db['VoiceContext']['find']({'where':{'id':_0x3f16fe[_0x1094('0x53')]['id']}})[_0x1094('0x2f')](handleEntityNotFound(_0x3cac59,null))[_0x1094('0x2f')](saveUpdates(_0x3f16fe[_0x1094('0x56')],null))[_0x1094('0x2f')](function(_0xe7d7d){if(_0xe7d7d){_0x48a33a=_0xe7d7d;return db[_0x1094('0x38')][_0x1094('0x50')]({'raw':!![]});}})[_0x1094('0x2f')](function(_0x1c4917){var _0x1b8b49=fs['readFileSync'](path['join'](config['root'],_0x1094('0x66')),_0x1094('0x59'));var _0x4ff5cf=ejs[_0x1094('0x5a')](_0x1b8b49,{'contexts':_0x1c4917||[]});fs[_0x1094('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4ff5cf);})[_0x1094('0x2f')](function(){return respondWithRpcPromise(_0x1094('0x5d'),_0x1094('0x67'),{'module':_0x1094('0x5e')});})[_0x1094('0x2f')](function(){return _0x48a33a;})[_0x1094('0x2f')](respondWithResult(_0x3cac59,null))[_0x1094('0x23')](handleError(_0x3cac59,null));};exports['destroy']=function(_0x25a433,_0x55d236,_0x1e24f6){var _0xe4d448;return db[_0x1094('0x38')]['find']({'where':{'id':_0x25a433[_0x1094('0x53')]['id']}})[_0x1094('0x2f')](handleEntityNotFound(_0x55d236,null))[_0x1094('0x2f')](removeEntity(_0x55d236,null))[_0x1094('0x2f')](function(){return db[_0x1094('0x38')][_0x1094('0x50')]({'raw':!![]});})[_0x1094('0x2f')](function(_0x20dace){var _0x1ca7d2=fs['readFileSync'](path['join'](config[_0x1094('0x58')],_0x1094('0x66')),_0x1094('0x59'));var _0x1438d7=ejs[_0x1094('0x5a')](_0x1ca7d2,{'contexts':_0x20dace});fs[_0x1094('0x5b')](_0x1094('0x5c'),_0x1438d7);return respondWithRpcPromise(_0x1094('0x5d'),_0x1094('0x30'),{'module':_0x1094('0x5e')});})[_0x1094('0x23')](handleError(_0x55d236,null));}; \ No newline at end of file +var _0xe729=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','get','Contexts','then','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','utf8','render','writeFileSync','Reload','chan_sip.so','user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','readFileSync','root','/etc/asterisk/extensions_xcally_contexts.conf','join','server/files/templates/context.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x15f77c,_0x597261){var _0x2833ac=function(_0x204aa1){while(--_0x204aa1){_0x15f77c['push'](_0x15f77c['shift']());}};_0x2833ac(++_0x597261);}(_0xe729,0x191));var _0x9e72=function(_0x210efb,_0x1a81dc){_0x210efb=_0x210efb-0x0;var _0x539300=_0xe729[_0x210efb];return _0x539300;};'use strict';var emlformat=require(_0x9e72('0x0'));var rimraf=require(_0x9e72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e72('0x2'));var rp=require(_0x9e72('0x3'));var moment=require(_0x9e72('0x4'));var BPromise=require(_0x9e72('0x5'));var Mustache=require(_0x9e72('0x6'));var util=require(_0x9e72('0x7'));var path=require(_0x9e72('0x8'));var sox=require(_0x9e72('0x9'));var csv=require(_0x9e72('0xa'));var ejs=require(_0x9e72('0xb'));var fs=require('fs');var fs_extra=require(_0x9e72('0xc'));var _=require('lodash');var squel=require(_0x9e72('0xd'));var crypto=require(_0x9e72('0xe'));var jsforce=require(_0x9e72('0xf'));var deskjs=require(_0x9e72('0x10'));var toCsv=require(_0x9e72('0xa'));var querystring=require(_0x9e72('0x11'));var Papa=require(_0x9e72('0x12'));var Redis=require(_0x9e72('0x13'));var authService=require(_0x9e72('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9e72('0x15'));var hardwareService=require(_0x9e72('0x16'));var logger=require(_0x9e72('0x17'))(_0x9e72('0x18'));var utils=require(_0x9e72('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9e72('0x1a'));var db=require(_0x9e72('0x1b'))['db'];var jayson=require(_0x9e72('0x1c'));var client=jayson['client'][_0x9e72('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xd31d55,_0xbb768a,_0x3a0516,_0x9716a1){return new BPromise(function(_0x34275b,_0x3c8ae9){var _0x235bfc=_0x9716a1||client;return _0x235bfc['request'](_0xd31d55,_0x3a0516)['then'](function(_0x53d904){logger['info'](_0x9e72('0x1e'),_0xbb768a,_0x9e72('0x1f'));logger[_0x9e72('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xbb768a,_0x9e72('0x1f'),JSON[_0x9e72('0x21')](_0x53d904));if(_0x53d904[_0x9e72('0x22')]){if(_0x53d904['error']['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0xbb768a,_0x53d904[_0x9e72('0x22')]['message']);return _0x3c8ae9(_0x53d904[_0x9e72('0x22')][_0x9e72('0x23')]);}logger[_0x9e72('0x22')](_0x9e72('0x1e'),_0xbb768a,_0x53d904['error'][_0x9e72('0x23')]);return _0x34275b(_0x53d904[_0x9e72('0x22')][_0x9e72('0x23')]);}else{logger[_0x9e72('0x24')](_0x9e72('0x1e'),_0xbb768a,_0x9e72('0x1f'));_0x34275b(_0x53d904[_0x9e72('0x25')][_0x9e72('0x23')]);}})['catch'](function(_0x29ae2f){logger['error'](_0x9e72('0x1e'),_0xbb768a,_0x29ae2f);_0x3c8ae9(_0x29ae2f);});});}function respondWithStatusCode(_0x1d753b,_0x46d710){_0x46d710=_0x46d710||0xcc;return function(_0x1cb566){if(_0x1cb566){return _0x1d753b[_0x9e72('0x26')](_0x46d710);}return _0x1d753b[_0x9e72('0x27')](_0x46d710)[_0x9e72('0x28')]();};}function respondWithResult(_0x387251,_0xba861b){_0xba861b=_0xba861b||0xc8;return function(_0x28cb29){if(_0x28cb29){return _0x387251[_0x9e72('0x27')](_0xba861b)[_0x9e72('0x29')](_0x28cb29);}};}function respondWithFilteredResult(_0x14b4fd,_0x31f8c3){return function(_0x426b90){if(_0x426b90){var _0x1d54fa=typeof _0x31f8c3['offset']===_0x9e72('0x2a')&&typeof _0x31f8c3[_0x9e72('0x2b')]==='undefined';var _0x457fea=_0x426b90[_0x9e72('0x2c')];var _0x2b7170=_0x1d54fa?0x0:_0x31f8c3['offset'];var _0x407728=_0x1d54fa?_0x426b90[_0x9e72('0x2c')]:_0x31f8c3[_0x9e72('0x2d')]+_0x31f8c3[_0x9e72('0x2b')];var _0x3264d6;if(_0x407728>=_0x457fea){_0x407728=_0x457fea;_0x3264d6=0xc8;}else{_0x3264d6=0xce;}_0x14b4fd['status'](_0x3264d6);return _0x14b4fd[_0x9e72('0x2e')](_0x9e72('0x2f'),_0x2b7170+'-'+_0x407728+'/'+_0x457fea)[_0x9e72('0x29')](_0x426b90);}return null;};}function patchUpdates(_0x174dff){return function(_0x16c2b2){try{jsonpatch[_0x9e72('0x30')](_0x16c2b2,_0x174dff,!![]);}catch(_0x1d5659){return BPromise[_0x9e72('0x31')](_0x1d5659);}return _0x16c2b2['save']();};}function saveUpdates(_0x2b55e8,_0x284092){return function(_0x192db8){if(_0x192db8){return _0x192db8['update'](_0x2b55e8)['then'](function(_0x345554){return _0x345554;});}return null;};}function removeEntity(_0x3f55ca,_0x421abf){return function(_0x109421){if(_0x109421){return _0x109421[_0x9e72('0x32')]()['then'](function(){var _0x3dbb51=_0x109421[_0x9e72('0x33')]({'plain':!![]});var _0x4161a1=_0x9e72('0x34');return db['UserProfileResource'][_0x9e72('0x32')]({'where':{'type':_0x4161a1,'resourceId':_0x3dbb51['id']}})['then'](function(){return _0x109421;});})[_0x9e72('0x35')](function(){_0x3f55ca[_0x9e72('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xad43bf,_0x16c1f8){return function(_0x14c16c){if(!_0x14c16c){_0xad43bf[_0x9e72('0x26')](0x194);}return _0x14c16c;};}function handleError(_0xdb5429,_0x7b02b1){_0x7b02b1=_0x7b02b1||0x1f4;return function(_0xb89a67){logger[_0x9e72('0x22')](_0xb89a67[_0x9e72('0x36')]);if(_0xb89a67[_0x9e72('0x37')]){delete _0xb89a67['name'];}_0xdb5429[_0x9e72('0x27')](_0x7b02b1)[_0x9e72('0x38')](_0xb89a67);};}exports['index']=function(_0x10498c,_0x2efb83){var _0x3faa7f={},_0x394e06={},_0x4f87ee={'count':0x0,'rows':[]};var _0xa2b9bb=_[_0x9e72('0x39')](db[_0x9e72('0x3a')][_0x9e72('0x3b')],function(_0x9eed2f){return{'name':_0x9eed2f[_0x9e72('0x3c')],'type':_0x9eed2f[_0x9e72('0x3d')][_0x9e72('0x3e')]};});_0x394e06[_0x9e72('0x3f')]=_[_0x9e72('0x39')](_0xa2b9bb,_0x9e72('0x37'));_0x394e06[_0x9e72('0x40')]=_[_0x9e72('0x41')](_0x10498c['query']);_0x394e06[_0x9e72('0x42')]=_[_0x9e72('0x43')](_0x394e06[_0x9e72('0x3f')],_0x394e06[_0x9e72('0x40')]);_0x3faa7f['attributes']=_[_0x9e72('0x43')](_0x394e06['model'],qs[_0x9e72('0x44')](_0x10498c[_0x9e72('0x40')][_0x9e72('0x44')]));_0x3faa7f['attributes']=_0x3faa7f[_0x9e72('0x45')]['length']?_0x3faa7f[_0x9e72('0x45')]:_0x394e06[_0x9e72('0x3f')];if(!_0x10498c[_0x9e72('0x40')][_0x9e72('0x46')](_0x9e72('0x47'))){_0x3faa7f[_0x9e72('0x2b')]=qs[_0x9e72('0x2b')](_0x10498c[_0x9e72('0x40')][_0x9e72('0x2b')]);_0x3faa7f['offset']=qs['offset'](_0x10498c['query'][_0x9e72('0x2d')]);}_0x3faa7f[_0x9e72('0x48')]=qs[_0x9e72('0x49')](_0x10498c['query'][_0x9e72('0x49')]);_0x3faa7f['where']=qs[_0x9e72('0x42')](_[_0x9e72('0x4a')](_0x10498c[_0x9e72('0x40')],_0x394e06['filters']),_0xa2b9bb);if(_0x10498c['query']['filter']){_0x3faa7f[_0x9e72('0x4b')]=_['merge'](_0x3faa7f[_0x9e72('0x4b')],{'$or':_[_0x9e72('0x39')](_0xa2b9bb,function(_0x2fab26){if(_0x2fab26[_0x9e72('0x3d')]!=='VIRTUAL'){var _0x1a0887={};_0x1a0887[_0x2fab26[_0x9e72('0x37')]]={'$like':'%'+_0x10498c[_0x9e72('0x40')][_0x9e72('0x4c')]+'%'};return _0x1a0887;}})});}_0x3faa7f=_[_0x9e72('0x4d')]({},_0x3faa7f,_0x10498c[_0x9e72('0x4e')]);var _0x4bf55a={'where':_0x3faa7f['where']};return db[_0x9e72('0x3a')]['count'](_0x4bf55a)['then'](function(_0x29bfb3){_0x4f87ee['count']=_0x29bfb3;if(_0x10498c[_0x9e72('0x40')][_0x9e72('0x4f')]){_0x3faa7f[_0x9e72('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x9e72('0x51')](_0x3faa7f);})[_0x9e72('0x35')](function(_0x3763bc){_0x4f87ee['rows']=_0x3763bc;return _0x4f87ee;})['then'](respondWithFilteredResult(_0x2efb83,_0x3faa7f))['catch'](handleError(_0x2efb83,null));};exports[_0x9e72('0x52')]=function(_0x8cae5b,_0x3b6a00){var _0x563ebe={'raw':![],'where':{'id':_0x8cae5b[_0x9e72('0x53')]['id']}},_0x530b2f={};_0x530b2f[_0x9e72('0x3f')]=_[_0x9e72('0x41')](db[_0x9e72('0x3a')]['rawAttributes']);_0x530b2f[_0x9e72('0x40')]=_[_0x9e72('0x41')](_0x8cae5b['query']);_0x530b2f[_0x9e72('0x42')]=_['intersection'](_0x530b2f['model'],_0x530b2f[_0x9e72('0x40')]);_0x563ebe[_0x9e72('0x45')]=_[_0x9e72('0x43')](_0x530b2f[_0x9e72('0x3f')],qs[_0x9e72('0x44')](_0x8cae5b['query'][_0x9e72('0x44')]));_0x563ebe[_0x9e72('0x45')]=_0x563ebe['attributes'][_0x9e72('0x54')]?_0x563ebe[_0x9e72('0x45')]:_0x530b2f[_0x9e72('0x3f')];if(_0x8cae5b[_0x9e72('0x40')]['includeAll']){_0x563ebe[_0x9e72('0x50')]=[{'all':!![]}];}_0x563ebe=_['merge']({},_0x563ebe,_0x8cae5b[_0x9e72('0x4e')]);return db['VoiceContext'][_0x9e72('0x55')](_0x563ebe)[_0x9e72('0x35')](handleEntityNotFound(_0x3b6a00,null))[_0x9e72('0x35')](respondWithResult(_0x3b6a00,null))[_0x9e72('0x56')](handleError(_0x3b6a00,null));};exports['create']=function(_0x2e6117,_0x132dbb,_0x516c63){var _0x55f7d6;return db['VoiceContext'][_0x9e72('0x57')](_0x2e6117['body'],{'raw':!![]})['then'](function(_0x269837){_0x55f7d6=_0x269837;return db['VoiceContext'][_0x9e72('0x51')]({'raw':!![]});})[_0x9e72('0x35')](function(_0x51c12b){var _0x2c006c=fs['readFileSync'](path['join'](config['root'],'server/files/templates/context.ejs'),_0x9e72('0x58'));var _0x2b9457=ejs[_0x9e72('0x59')](_0x2c006c,{'contexts':_0x51c12b||[]});fs[_0x9e72('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2b9457);})[_0x9e72('0x35')](function(){return respondWithRpcPromise(_0x9e72('0x5b'),'create',{'module':_0x9e72('0x5c')});})[_0x9e72('0x35')](function(){var _0x1b9216=_0x2e6117[_0x9e72('0x5d')][_0x9e72('0x33')]({'plain':!![]});if(!_0x1b9216)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b9216[_0x9e72('0x5e')]===_0x9e72('0x5d')){var _0x1d8de2=_0x55f7d6['get']({'plain':!![]});return db[_0x9e72('0x5f')][_0x9e72('0x55')]({'where':{'name':'Contexts','userProfileId':_0x1b9216['userProfileId']},'raw':!![]})[_0x9e72('0x35')](function(_0x3b2942){if(_0x3b2942&&_0x3b2942['autoAssociation']===0x0){return db[_0x9e72('0x60')][_0x9e72('0x57')]({'name':_0x1d8de2['name'],'resourceId':_0x1d8de2['id'],'type':_0x3b2942[_0x9e72('0x37')],'sectionId':_0x3b2942['id']},{})[_0x9e72('0x35')](function(){return _0x55f7d6;});}else{return _0x55f7d6;}})[_0x9e72('0x56')](function(_0xdbb704){logger[_0x9e72('0x22')](_0x9e72('0x61'),_0xdbb704);throw _0xdbb704;});}return _0x55f7d6;})[_0x9e72('0x35')](respondWithResult(_0x132dbb,0xc9))[_0x9e72('0x56')](handleError(_0x132dbb,null));};exports[_0x9e72('0x62')]=function(_0x32642e,_0x272427,_0x334827){var _0x2c255e;return db[_0x9e72('0x3a')][_0x9e72('0x55')]({'where':{'id':_0x32642e[_0x9e72('0x53')]['id']}})['then'](handleEntityNotFound(_0x272427,null))[_0x9e72('0x35')](saveUpdates(_0x32642e['body'],null))[_0x9e72('0x35')](function(_0x4ef48e){if(_0x4ef48e){_0x2c255e=_0x4ef48e;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x420bed){var _0x10edff=fs[_0x9e72('0x63')](path['join'](config[_0x9e72('0x64')],'server/files/templates/context.ejs'),_0x9e72('0x58'));var _0x3e474f=ejs['render'](_0x10edff,{'contexts':_0x420bed||[]});fs['writeFileSync'](_0x9e72('0x65'),_0x3e474f);})[_0x9e72('0x35')](function(){return respondWithRpcPromise('Reload',_0x9e72('0x62'),{'module':_0x9e72('0x5c')});})[_0x9e72('0x35')](function(){return _0x2c255e;})['then'](respondWithResult(_0x272427,null))['catch'](handleError(_0x272427,null));};exports['destroy']=function(_0x4e775e,_0x314d9e,_0x3e1daf){var _0x19ea99;return db[_0x9e72('0x3a')]['find']({'where':{'id':_0x4e775e[_0x9e72('0x53')]['id']}})[_0x9e72('0x35')](handleEntityNotFound(_0x314d9e,null))[_0x9e72('0x35')](removeEntity(_0x314d9e,null))[_0x9e72('0x35')](function(){return db[_0x9e72('0x3a')]['findAll']({'raw':!![]});})[_0x9e72('0x35')](function(_0x46aa6f){var _0x553697=fs[_0x9e72('0x63')](path[_0x9e72('0x66')](config[_0x9e72('0x64')],_0x9e72('0x67')),_0x9e72('0x58'));var _0x5af2af=ejs[_0x9e72('0x59')](_0x553697,{'contexts':_0x46aa6f});fs[_0x9e72('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5af2af);return respondWithRpcPromise(_0x9e72('0x5b'),'destroy',{'module':_0x9e72('0x5c')});})[_0x9e72('0x56')](handleError(_0x314d9e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index fda8d9b..09bf682 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 _0xc496=['./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x540c6f,_0x279c48){var _0xb3e5b9=function(_0x337add){while(--_0x337add){_0x540c6f['push'](_0x540c6f['shift']());}};_0xb3e5b9(++_0x279c48);}(_0xc496,0x170));var _0x6c49=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0xc496[_0x4e4519];return _0x340044;};'use strict';var _=require(_0x6c49('0x0'));var util=require(_0x6c49('0x1'));var logger=require(_0x6c49('0x2'))(_0x6c49('0x3'));var moment=require(_0x6c49('0x4'));var BPromise=require(_0x6c49('0x5'));var rp=require(_0x6c49('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c49('0x7'));var config=require(_0x6c49('0x8'));var attributes=require(_0x6c49('0x9'));module[_0x6c49('0xa')]=function(_0x55e97a,_0x40970a){return _0x55e97a['define'](_0x6c49('0xb'),attributes,{'tableName':_0x6c49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60a8=['util','../../config/logger','api','bluebird','path','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash'];(function(_0x3f50d1,_0x4f05e5){var _0x27b311=function(_0x2eaa81){while(--_0x2eaa81){_0x3f50d1['push'](_0x3f50d1['shift']());}};_0x27b311(++_0x4f05e5);}(_0x60a8,0x16a));var _0x860a=function(_0x54b8be,_0x215d7c){_0x54b8be=_0x54b8be-0x0;var _0x464cee=_0x60a8[_0x54b8be];return _0x464cee;};'use strict';var _=require(_0x860a('0x0'));var util=require(_0x860a('0x1'));var logger=require(_0x860a('0x2'))(_0x860a('0x3'));var moment=require('moment');var BPromise=require(_0x860a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x860a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x860a('0x6'));module[_0x860a('0x7')]=function(_0x22086e,_0x12c8a7){return _0x22086e[_0x860a('0x8')](_0x860a('0x9'),attributes,{'tableName':_0x860a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 70da797..be7b997 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 _0x3870=['VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x3870,0x146));var _0x0387=function(_0x12a02e,_0x3b226c){_0x12a02e=_0x12a02e-0x0;var _0x49a3a3=_0x3870[_0x12a02e];return _0x49a3a3;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var moment=require(_0x0387('0x2'));var BPromise=require('bluebird');var rs=require(_0x0387('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0387('0x4'))['db'];var utils=require(_0x0387('0x5'));var logger=require('../../config/logger')(_0x0387('0x6'));var config=require(_0x0387('0x7'));var jayson=require(_0x0387('0x8'));var client=jayson['client'][_0x0387('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25209b,_0x3169b6,_0x13073a){return new BPromise(function(_0x594efe,_0x46bbf2){return client[_0x0387('0xa')](_0x25209b,_0x13073a)[_0x0387('0xb')](function(_0x566566){logger[_0x0387('0xc')]('VoiceContext,\x20%s,\x20%s',_0x3169b6,'request\x20sent');logger[_0x0387('0xd')](_0x0387('0xe'),_0x3169b6,_0x0387('0xf'),JSON[_0x0387('0x10')](_0x566566));if(_0x566566[_0x0387('0x11')]){if(_0x566566['error'][_0x0387('0x12')]===0x1f4){logger[_0x0387('0x11')](_0x0387('0x13'),_0x3169b6,_0x566566['error']['message']);return _0x46bbf2(_0x566566[_0x0387('0x11')][_0x0387('0x14')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x3169b6,_0x566566[_0x0387('0x11')][_0x0387('0x14')]);return _0x594efe(_0x566566[_0x0387('0x11')]['message']);}else{logger['info'](_0x0387('0x13'),_0x3169b6,'request\x20sent');_0x594efe(_0x566566[_0x0387('0x15')]['message']);}})[_0x0387('0x16')](function(_0x246fd0){logger[_0x0387('0x11')](_0x0387('0x13'),_0x3169b6,_0x246fd0);_0x46bbf2(_0x246fd0);});});} \ No newline at end of file +var _0x536f=['http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 292485e..0789e73 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 _0x8145=['create','put','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8145,0xb8));var _0x5814=function(_0x5fb0f1,_0x18deb0){_0x5fb0f1=_0x5fb0f1-0x0;var _0x617eaf=_0x8145[_0x5fb0f1];return _0x617eaf;};'use strict';var multer=require(_0x5814('0x0'));var util=require(_0x5814('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5814('0x2'));var router=express[_0x5814('0x3')]();var fs_extra=require(_0x5814('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5814('0x5'));var config=require('../../config/environment');var controller=require(_0x5814('0x6'));router[_0x5814('0x7')]('/',auth[_0x5814('0x8')](),controller[_0x5814('0x9')]);router[_0x5814('0x7')](_0x5814('0xa'),auth[_0x5814('0x8')](),controller[_0x5814('0xb')]);router[_0x5814('0x7')](_0x5814('0xc'),auth[_0x5814('0x8')](),controller[_0x5814('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5814('0xe')]);router[_0x5814('0xf')]('/:id',auth[_0x5814('0x8')](),controller['update']);router[_0x5814('0x10')]('/:id',auth[_0x5814('0x8')](),controller[_0x5814('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3bc8=['/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','index','/describe','describe','isAuthenticated','show','create','put'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x3bc8,0x1f3));var _0x83bc=function(_0x19c315,_0x2b2e84){_0x19c315=_0x19c315-0x0;var _0x3dc378=_0x3bc8[_0x19c315];return _0x3dc378;};'use strict';var multer=require('multer');var util=require(_0x83bc('0x0'));var path=require(_0x83bc('0x1'));var timeout=require(_0x83bc('0x2'));var express=require('express');var router=express[_0x83bc('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x83bc('0x4'));var config=require(_0x83bc('0x5'));var controller=require(_0x83bc('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x83bc('0x7')]);router['get'](_0x83bc('0x8'),auth['isAuthenticated'](),controller[_0x83bc('0x9')]);router['get']('/:id',auth[_0x83bc('0xa')](),controller[_0x83bc('0xb')]);router['post']('/',auth[_0x83bc('0xa')](),controller[_0x83bc('0xc')]);router[_0x83bc('0xd')](_0x83bc('0xe'),auth['isAuthenticated'](),controller[_0x83bc('0xf')]);router[_0x83bc('0x10')]('/:id',auth[_0x83bc('0xa')](),controller[_0x83bc('0x11')]);module[_0x83bc('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8841a8a..73e3537 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 _0x8d0e=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x512da6,_0x30eb6b){var _0xe7823b=function(_0x17ecac){while(--_0x17ecac){_0x512da6['push'](_0x512da6['shift']());}};_0xe7823b(++_0x30eb6b);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1860d6,_0x3cc831){_0x1860d6=_0x1860d6-0x0;var _0x21556a=_0x8d0e[_0x1860d6];return _0x21556a;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'privilege':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x3')]},'channelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x3')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'linkedid':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize[_0xe8d0('0x2')]},'destchannelstate':{'type':Sequelize[_0xe8d0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x3')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'destlinkedid':{'type':Sequelize[_0xe8d0('0x2')]},'dialstring':{'type':Sequelize[_0xe8d0('0x2')]},'dialstatus':{'type':Sequelize[_0xe8d0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe8d0('0x4')]},'endtime':{'type':Sequelize[_0xe8d0('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe8d0('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe8d0('0x3')]},'billableseconds':{'type':Sequelize[_0xe8d0('0x3')]}}; \ No newline at end of file +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x54ef,0x112));var _0xf54e=function(_0x7c980,_0x4600a8){_0x7c980=_0x7c980-0x0;var _0xdb5824=_0x54ef[_0x7c980];return _0xdb5824;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5efa771..bc7ec3c 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 _0x2aa6=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce'];(function(_0x3f88f9,_0x68e080){var _0xcab2d6=function(_0x44aae4){while(--_0x44aae4){_0x3f88f9['push'](_0x3f88f9['shift']());}};_0xcab2d6(++_0x68e080);}(_0x2aa6,0xde));var _0x62aa=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x2aa6[_0x236c89];return _0x3b2a15;};'use strict';var emlformat=require(_0x62aa('0x0'));var rimraf=require(_0x62aa('0x1'));var zipdir=require(_0x62aa('0x2'));var jsonpatch=require(_0x62aa('0x3'));var rp=require(_0x62aa('0x4'));var moment=require(_0x62aa('0x5'));var BPromise=require(_0x62aa('0x6'));var Mustache=require(_0x62aa('0x7'));var util=require(_0x62aa('0x8'));var path=require(_0x62aa('0x9'));var sox=require(_0x62aa('0xa'));var csv=require('to-csv');var ejs=require(_0x62aa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62aa('0xc'));var squel=require('squel');var crypto=require(_0x62aa('0xd'));var jsforce=require(_0x62aa('0xe'));var deskjs=require(_0x62aa('0xf'));var toCsv=require(_0x62aa('0x10'));var querystring=require(_0x62aa('0x11'));var Papa=require(_0x62aa('0x12'));var Redis=require(_0x62aa('0x13'));var authService=require(_0x62aa('0x14'));var qs=require(_0x62aa('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62aa('0x16'));var logger=require(_0x62aa('0x17'))(_0x62aa('0x18'));var utils=require(_0x62aa('0x19'));var config=require(_0x62aa('0x1a'));var licenseUtil=require(_0x62aa('0x1b'));var db=require(_0x62aa('0x1c'))['db'];function respondWithStatusCode(_0x35dfaf,_0xa3dcdd){_0xa3dcdd=_0xa3dcdd||0xcc;return function(_0x4154e1){if(_0x4154e1){return _0x35dfaf[_0x62aa('0x1d')](_0xa3dcdd);}return _0x35dfaf[_0x62aa('0x1e')](_0xa3dcdd)[_0x62aa('0x1f')]();};}function respondWithResult(_0x160f5f,_0x50d3e0){_0x50d3e0=_0x50d3e0||0xc8;return function(_0x161b03){if(_0x161b03){return _0x160f5f[_0x62aa('0x1e')](_0x50d3e0)[_0x62aa('0x20')](_0x161b03);}};}function respondWithFilteredResult(_0x455b87,_0x31ba9f){return function(_0x372065){if(_0x372065){var _0x24fa06=typeof _0x31ba9f['offset']==='undefined'&&typeof _0x31ba9f[_0x62aa('0x21')]==='undefined';var _0x122f8b=_0x372065['count'];var _0x1e8fbe=_0x24fa06?0x0:_0x31ba9f[_0x62aa('0x22')];var _0x2811cc=_0x24fa06?_0x372065['count']:_0x31ba9f[_0x62aa('0x22')]+_0x31ba9f[_0x62aa('0x21')];var _0x359f6e;if(_0x2811cc>=_0x122f8b){_0x2811cc=_0x122f8b;_0x359f6e=0xc8;}else{_0x359f6e=0xce;}_0x455b87[_0x62aa('0x1e')](_0x359f6e);return _0x455b87[_0x62aa('0x23')](_0x62aa('0x24'),_0x1e8fbe+'-'+_0x2811cc+'/'+_0x122f8b)[_0x62aa('0x20')](_0x372065);}return null;};}function patchUpdates(_0x2d8146){return function(_0x2c2cd0){try{jsonpatch[_0x62aa('0x25')](_0x2c2cd0,_0x2d8146,!![]);}catch(_0x4641db){return BPromise[_0x62aa('0x26')](_0x4641db);}return _0x2c2cd0[_0x62aa('0x27')]();};}function saveUpdates(_0x57c7b4,_0x3104f8){return function(_0x319522){if(_0x319522){return _0x319522[_0x62aa('0x28')](_0x57c7b4)[_0x62aa('0x29')](function(_0x19df65){return _0x19df65;});}return null;};}function removeEntity(_0x2f5853,_0x46c85a){return function(_0x1c6894){if(_0x1c6894){return _0x1c6894['destroy']()['then'](function(){_0x2f5853[_0x62aa('0x1e')](0xcc)[_0x62aa('0x1f')]();});}};}function handleEntityNotFound(_0x5bd533,_0x55a80c){return function(_0x5e84ba){if(!_0x5e84ba){_0x5bd533['sendStatus'](0x194);}return _0x5e84ba;};}function handleError(_0x4ed4f3,_0x2bad72){_0x2bad72=_0x2bad72||0x1f4;return function(_0x233e45){logger['error'](_0x233e45[_0x62aa('0x2a')]);if(_0x233e45[_0x62aa('0x2b')]){delete _0x233e45['name'];}_0x4ed4f3[_0x62aa('0x1e')](_0x2bad72)[_0x62aa('0x2c')](_0x233e45);};}exports[_0x62aa('0x2d')]=function(_0x42a69a,_0x23ede9){var _0x373d58={},_0x4c5c22={},_0x1679ea={'count':0x0,'rows':[]};var _0x1f8895=_[_0x62aa('0x2e')](db[_0x62aa('0x2f')][_0x62aa('0x30')],function(_0x52c407){return{'name':_0x52c407[_0x62aa('0x31')],'type':_0x52c407[_0x62aa('0x32')][_0x62aa('0x33')]};});_0x4c5c22[_0x62aa('0x34')]=_[_0x62aa('0x2e')](_0x1f8895,_0x62aa('0x2b'));_0x4c5c22['query']=_[_0x62aa('0x35')](_0x42a69a[_0x62aa('0x36')]);_0x4c5c22[_0x62aa('0x37')]=_[_0x62aa('0x38')](_0x4c5c22['model'],_0x4c5c22[_0x62aa('0x36')]);_0x373d58['attributes']=_[_0x62aa('0x38')](_0x4c5c22[_0x62aa('0x34')],qs['fields'](_0x42a69a[_0x62aa('0x36')][_0x62aa('0x39')]));_0x373d58['attributes']=_0x373d58['attributes'][_0x62aa('0x3a')]?_0x373d58[_0x62aa('0x3b')]:_0x4c5c22['model'];if(!_0x42a69a[_0x62aa('0x36')][_0x62aa('0x3c')]('nolimit')){_0x373d58[_0x62aa('0x21')]=qs[_0x62aa('0x21')](_0x42a69a[_0x62aa('0x36')][_0x62aa('0x21')]);_0x373d58[_0x62aa('0x22')]=qs[_0x62aa('0x22')](_0x42a69a[_0x62aa('0x36')]['offset']);}_0x373d58['order']=qs['sort'](_0x42a69a[_0x62aa('0x36')][_0x62aa('0x3d')]);_0x373d58[_0x62aa('0x3e')]=qs[_0x62aa('0x37')](_['pick'](_0x42a69a[_0x62aa('0x36')],_0x4c5c22[_0x62aa('0x37')]),_0x1f8895);if(_0x42a69a[_0x62aa('0x36')][_0x62aa('0x3f')]){_0x373d58[_0x62aa('0x3e')]=_[_0x62aa('0x40')](_0x373d58[_0x62aa('0x3e')],{'$or':_[_0x62aa('0x2e')](_0x1f8895,function(_0x22ecf7){if(_0x22ecf7[_0x62aa('0x32')]!==_0x62aa('0x41')){var _0x372bef={};_0x372bef[_0x22ecf7[_0x62aa('0x2b')]]={'$like':'%'+_0x42a69a[_0x62aa('0x36')]['filter']+'%'};return _0x372bef;}})});}_0x373d58=_[_0x62aa('0x40')]({},_0x373d58,_0x42a69a[_0x62aa('0x42')]);var _0x4fd68d={'where':_0x373d58[_0x62aa('0x3e')]};return db[_0x62aa('0x2f')]['count'](_0x4fd68d)[_0x62aa('0x29')](function(_0x31066a){_0x1679ea[_0x62aa('0x43')]=_0x31066a;if(_0x42a69a[_0x62aa('0x36')][_0x62aa('0x44')]){_0x373d58[_0x62aa('0x45')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x62aa('0x46')](_0x373d58);})[_0x62aa('0x29')](function(_0x2e1f40){_0x1679ea[_0x62aa('0x47')]=_0x2e1f40;return _0x1679ea;})['then'](respondWithFilteredResult(_0x23ede9,_0x373d58))[_0x62aa('0x48')](handleError(_0x23ede9,null));};exports[_0x62aa('0x49')]=function(_0x38496f,_0x338fdd){var _0x42a77d={'raw':!![],'where':{'id':_0x38496f[_0x62aa('0x4a')]['id']}},_0x2e9141={};_0x2e9141['model']=_[_0x62aa('0x35')](db[_0x62aa('0x2f')][_0x62aa('0x30')]);_0x2e9141['query']=_[_0x62aa('0x35')](_0x38496f[_0x62aa('0x36')]);_0x2e9141[_0x62aa('0x37')]=_[_0x62aa('0x38')](_0x2e9141[_0x62aa('0x34')],_0x2e9141[_0x62aa('0x36')]);_0x42a77d[_0x62aa('0x3b')]=_[_0x62aa('0x38')](_0x2e9141['model'],qs[_0x62aa('0x39')](_0x38496f[_0x62aa('0x36')][_0x62aa('0x39')]));_0x42a77d[_0x62aa('0x3b')]=_0x42a77d[_0x62aa('0x3b')][_0x62aa('0x3a')]?_0x42a77d['attributes']:_0x2e9141[_0x62aa('0x34')];if(_0x38496f[_0x62aa('0x36')][_0x62aa('0x44')]){_0x42a77d[_0x62aa('0x45')]=[{'all':!![]}];}_0x42a77d=_['merge']({},_0x42a77d,_0x38496f[_0x62aa('0x42')]);return db[_0x62aa('0x2f')][_0x62aa('0x4b')](_0x42a77d)[_0x62aa('0x29')](handleEntityNotFound(_0x338fdd,null))[_0x62aa('0x29')](respondWithResult(_0x338fdd,null))['catch'](handleError(_0x338fdd,null));};exports[_0x62aa('0x4c')]=function(_0x474b70,_0x208db6){return db[_0x62aa('0x2f')][_0x62aa('0x4c')](_0x474b70[_0x62aa('0x4d')],{})[_0x62aa('0x29')](respondWithResult(_0x208db6,0xc9))[_0x62aa('0x48')](handleError(_0x208db6,null));};exports[_0x62aa('0x28')]=function(_0x512ffa,_0x57122d){if(_0x512ffa[_0x62aa('0x4d')]['id']){delete _0x512ffa[_0x62aa('0x4d')]['id'];}return db['VoiceDialReport'][_0x62aa('0x4b')]({'where':{'id':_0x512ffa[_0x62aa('0x4a')]['id']}})[_0x62aa('0x29')](handleEntityNotFound(_0x57122d,null))[_0x62aa('0x29')](saveUpdates(_0x512ffa[_0x62aa('0x4d')],null))['then'](respondWithResult(_0x57122d,null))['catch'](handleError(_0x57122d,null));};exports[_0x62aa('0x4e')]=function(_0x4a32bc,_0x511dfe){return db[_0x62aa('0x2f')][_0x62aa('0x4b')]({'where':{'id':_0x4a32bc[_0x62aa('0x4a')]['id']}})[_0x62aa('0x29')](handleEntityNotFound(_0x511dfe,null))[_0x62aa('0x29')](removeEntity(_0x511dfe,null))['catch'](handleError(_0x511dfe,null));};exports['describe']=function(_0x370757,_0x191088){return db[_0x62aa('0x2f')]['describe']()[_0x62aa('0x29')](respondWithResult(_0x191088,null))[_0x62aa('0x48')](handleError(_0x191088,null));}; \ No newline at end of file +var _0xc5d3=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc5d3,0x1cc));var _0x3c5d=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0xc5d3[_0x406e46];return _0x4a3742;};'use strict';var emlformat=require(_0x3c5d('0x0'));var rimraf=require(_0x3c5d('0x1'));var zipdir=require(_0x3c5d('0x2'));var jsonpatch=require(_0x3c5d('0x3'));var rp=require(_0x3c5d('0x4'));var moment=require('moment');var BPromise=require(_0x3c5d('0x5'));var Mustache=require(_0x3c5d('0x6'));var util=require(_0x3c5d('0x7'));var path=require(_0x3c5d('0x8'));var sox=require(_0x3c5d('0x9'));var csv=require('to-csv');var ejs=require(_0x3c5d('0xa'));var fs=require('fs');var fs_extra=require(_0x3c5d('0xb'));var _=require(_0x3c5d('0xc'));var squel=require(_0x3c5d('0xd'));var crypto=require(_0x3c5d('0xe'));var jsforce=require(_0x3c5d('0xf'));var deskjs=require(_0x3c5d('0x10'));var toCsv=require(_0x3c5d('0x11'));var querystring=require(_0x3c5d('0x12'));var Papa=require(_0x3c5d('0x13'));var Redis=require(_0x3c5d('0x14'));var authService=require(_0x3c5d('0x15'));var qs=require(_0x3c5d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c5d('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x3c5d('0x18'));var config=require(_0x3c5d('0x19'));var licenseUtil=require(_0x3c5d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16e9c0,_0x480a06){_0x480a06=_0x480a06||0xcc;return function(_0x47ae2b){if(_0x47ae2b){return _0x16e9c0['sendStatus'](_0x480a06);}return _0x16e9c0[_0x3c5d('0x1b')](_0x480a06)[_0x3c5d('0x1c')]();};}function respondWithResult(_0x5c33b4,_0x381603){_0x381603=_0x381603||0xc8;return function(_0x5e70c0){if(_0x5e70c0){return _0x5c33b4[_0x3c5d('0x1b')](_0x381603)['json'](_0x5e70c0);}};}function respondWithFilteredResult(_0x464875,_0x20f179){return function(_0x3de216){if(_0x3de216){var _0x4e3e64=typeof _0x20f179[_0x3c5d('0x1d')]===_0x3c5d('0x1e')&&typeof _0x20f179[_0x3c5d('0x1f')]==='undefined';var _0x830db9=_0x3de216['count'];var _0x4792ae=_0x4e3e64?0x0:_0x20f179['offset'];var _0x273c4f=_0x4e3e64?_0x3de216[_0x3c5d('0x20')]:_0x20f179['offset']+_0x20f179[_0x3c5d('0x1f')];var _0x19d2fe;if(_0x273c4f>=_0x830db9){_0x273c4f=_0x830db9;_0x19d2fe=0xc8;}else{_0x19d2fe=0xce;}_0x464875[_0x3c5d('0x1b')](_0x19d2fe);return _0x464875[_0x3c5d('0x21')](_0x3c5d('0x22'),_0x4792ae+'-'+_0x273c4f+'/'+_0x830db9)[_0x3c5d('0x23')](_0x3de216);}return null;};}function patchUpdates(_0x336a0c){return function(_0x1e476f){try{jsonpatch[_0x3c5d('0x24')](_0x1e476f,_0x336a0c,!![]);}catch(_0x890dd4){return BPromise[_0x3c5d('0x25')](_0x890dd4);}return _0x1e476f[_0x3c5d('0x26')]();};}function saveUpdates(_0xfee1b8,_0x39f802){return function(_0x3c4f3f){if(_0x3c4f3f){return _0x3c4f3f[_0x3c5d('0x27')](_0xfee1b8)['then'](function(_0x494c74){return _0x494c74;});}return null;};}function removeEntity(_0x206b33,_0x3568d7){return function(_0x1b631d){if(_0x1b631d){return _0x1b631d[_0x3c5d('0x28')]()[_0x3c5d('0x29')](function(){_0x206b33[_0x3c5d('0x1b')](0xcc)[_0x3c5d('0x1c')]();});}};}function handleEntityNotFound(_0x4d7e88,_0x53c5f6){return function(_0x2bf8b5){if(!_0x2bf8b5){_0x4d7e88[_0x3c5d('0x2a')](0x194);}return _0x2bf8b5;};}function handleError(_0x5a7c74,_0x23cdc1){_0x23cdc1=_0x23cdc1||0x1f4;return function(_0x13b627){logger['error'](_0x13b627[_0x3c5d('0x2b')]);if(_0x13b627['name']){delete _0x13b627[_0x3c5d('0x2c')];}_0x5a7c74[_0x3c5d('0x1b')](_0x23cdc1)[_0x3c5d('0x2d')](_0x13b627);};}exports['index']=function(_0x37adb8,_0x47bbc5){var _0x3d3b67={},_0x568683={},_0x4fcf82={'count':0x0,'rows':[]};var _0xe7ca78=_[_0x3c5d('0x2e')](db[_0x3c5d('0x2f')][_0x3c5d('0x30')],function(_0x3a474a){return{'name':_0x3a474a[_0x3c5d('0x31')],'type':_0x3a474a[_0x3c5d('0x32')][_0x3c5d('0x33')]};});_0x568683['model']=_[_0x3c5d('0x2e')](_0xe7ca78,_0x3c5d('0x2c'));_0x568683[_0x3c5d('0x34')]=_[_0x3c5d('0x35')](_0x37adb8[_0x3c5d('0x34')]);_0x568683[_0x3c5d('0x36')]=_['intersection'](_0x568683[_0x3c5d('0x37')],_0x568683[_0x3c5d('0x34')]);_0x3d3b67['attributes']=_[_0x3c5d('0x38')](_0x568683[_0x3c5d('0x37')],qs[_0x3c5d('0x39')](_0x37adb8[_0x3c5d('0x34')]['fields']));_0x3d3b67['attributes']=_0x3d3b67['attributes'][_0x3c5d('0x3a')]?_0x3d3b67[_0x3c5d('0x3b')]:_0x568683[_0x3c5d('0x37')];if(!_0x37adb8['query'][_0x3c5d('0x3c')](_0x3c5d('0x3d'))){_0x3d3b67[_0x3c5d('0x1f')]=qs[_0x3c5d('0x1f')](_0x37adb8[_0x3c5d('0x34')][_0x3c5d('0x1f')]);_0x3d3b67[_0x3c5d('0x1d')]=qs[_0x3c5d('0x1d')](_0x37adb8['query'][_0x3c5d('0x1d')]);}_0x3d3b67[_0x3c5d('0x3e')]=qs[_0x3c5d('0x3f')](_0x37adb8[_0x3c5d('0x34')]['sort']);_0x3d3b67['where']=qs[_0x3c5d('0x36')](_[_0x3c5d('0x40')](_0x37adb8[_0x3c5d('0x34')],_0x568683['filters']),_0xe7ca78);if(_0x37adb8[_0x3c5d('0x34')][_0x3c5d('0x41')]){_0x3d3b67[_0x3c5d('0x42')]=_[_0x3c5d('0x43')](_0x3d3b67[_0x3c5d('0x42')],{'$or':_[_0x3c5d('0x2e')](_0xe7ca78,function(_0x3dfe9c){if(_0x3dfe9c[_0x3c5d('0x32')]!=='VIRTUAL'){var _0x170e10={};_0x170e10[_0x3dfe9c[_0x3c5d('0x2c')]]={'$like':'%'+_0x37adb8['query'][_0x3c5d('0x41')]+'%'};return _0x170e10;}})});}_0x3d3b67=_['merge']({},_0x3d3b67,_0x37adb8['options']);var _0x28205c={'where':_0x3d3b67[_0x3c5d('0x42')]};return db[_0x3c5d('0x2f')][_0x3c5d('0x20')](_0x28205c)['then'](function(_0x7cfab){_0x4fcf82[_0x3c5d('0x20')]=_0x7cfab;if(_0x37adb8['query'][_0x3c5d('0x44')]){_0x3d3b67[_0x3c5d('0x45')]=[{'all':!![]}];}return db[_0x3c5d('0x2f')][_0x3c5d('0x46')](_0x3d3b67);})[_0x3c5d('0x29')](function(_0x32f607){_0x4fcf82[_0x3c5d('0x47')]=_0x32f607;return _0x4fcf82;})[_0x3c5d('0x29')](respondWithFilteredResult(_0x47bbc5,_0x3d3b67))['catch'](handleError(_0x47bbc5,null));};exports[_0x3c5d('0x48')]=function(_0x745a01,_0x1786b9){var _0x43dfab={'raw':!![],'where':{'id':_0x745a01[_0x3c5d('0x49')]['id']}},_0x59b25f={};_0x59b25f[_0x3c5d('0x37')]=_['keys'](db['VoiceDialReport'][_0x3c5d('0x30')]);_0x59b25f[_0x3c5d('0x34')]=_[_0x3c5d('0x35')](_0x745a01['query']);_0x59b25f[_0x3c5d('0x36')]=_[_0x3c5d('0x38')](_0x59b25f[_0x3c5d('0x37')],_0x59b25f[_0x3c5d('0x34')]);_0x43dfab['attributes']=_['intersection'](_0x59b25f[_0x3c5d('0x37')],qs['fields'](_0x745a01[_0x3c5d('0x34')][_0x3c5d('0x39')]));_0x43dfab[_0x3c5d('0x3b')]=_0x43dfab['attributes'][_0x3c5d('0x3a')]?_0x43dfab[_0x3c5d('0x3b')]:_0x59b25f[_0x3c5d('0x37')];if(_0x745a01['query'][_0x3c5d('0x44')]){_0x43dfab[_0x3c5d('0x45')]=[{'all':!![]}];}_0x43dfab=_['merge']({},_0x43dfab,_0x745a01['options']);return db[_0x3c5d('0x2f')][_0x3c5d('0x4a')](_0x43dfab)['then'](handleEntityNotFound(_0x1786b9,null))[_0x3c5d('0x29')](respondWithResult(_0x1786b9,null))[_0x3c5d('0x4b')](handleError(_0x1786b9,null));};exports[_0x3c5d('0x4c')]=function(_0x14330f,_0x14e038){return db[_0x3c5d('0x2f')]['create'](_0x14330f['body'],{})[_0x3c5d('0x29')](respondWithResult(_0x14e038,0xc9))[_0x3c5d('0x4b')](handleError(_0x14e038,null));};exports[_0x3c5d('0x27')]=function(_0x2c7c3e,_0x3de028){if(_0x2c7c3e[_0x3c5d('0x4d')]['id']){delete _0x2c7c3e['body']['id'];}return db[_0x3c5d('0x2f')][_0x3c5d('0x4a')]({'where':{'id':_0x2c7c3e[_0x3c5d('0x49')]['id']}})[_0x3c5d('0x29')](handleEntityNotFound(_0x3de028,null))[_0x3c5d('0x29')](saveUpdates(_0x2c7c3e[_0x3c5d('0x4d')],null))[_0x3c5d('0x29')](respondWithResult(_0x3de028,null))[_0x3c5d('0x4b')](handleError(_0x3de028,null));};exports[_0x3c5d('0x28')]=function(_0x55c692,_0x3787f5){return db['VoiceDialReport'][_0x3c5d('0x4a')]({'where':{'id':_0x55c692[_0x3c5d('0x49')]['id']}})[_0x3c5d('0x29')](handleEntityNotFound(_0x3787f5,null))[_0x3c5d('0x29')](removeEntity(_0x3787f5,null))[_0x3c5d('0x4b')](handleError(_0x3787f5,null));};exports[_0x3c5d('0x4e')]=function(_0xe578c7,_0x503907){return db[_0x3c5d('0x2f')][_0x3c5d('0x4e')]()[_0x3c5d('0x29')](respondWithResult(_0x503907,null))[_0x3c5d('0x4b')](handleError(_0x503907,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1bbde86..728f8aa 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 _0x19d1=['exports','define','VoiceDialReport','uniqueid','lodash','util','api','moment','bluebird','path','../../config/environment','./voiceDialReport.attributes'];(function(_0xc1efca,_0x44f193){var _0x17c8b8=function(_0x4cda2d){while(--_0x4cda2d){_0xc1efca['push'](_0xc1efca['shift']());}};_0x17c8b8(++_0x44f193);}(_0x19d1,0x16c));var _0x119d=function(_0x3c6ce5,_0x5d225b){_0x3c6ce5=_0x3c6ce5-0x0;var _0xd66f4=_0x19d1[_0x3c6ce5];return _0xd66f4;};'use strict';var _=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var logger=require('../../config/logger')(_0x119d('0x2'));var moment=require(_0x119d('0x3'));var BPromise=require(_0x119d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x119d('0x5'));var rimraf=require('rimraf');var config=require(_0x119d('0x6'));var attributes=require(_0x119d('0x7'));module[_0x119d('0x8')]=function(_0x3db3d9,_0x1a58d5){return _0x3db3d9[_0x119d('0x9')](_0x119d('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x119d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38ca=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','report_dial','uniqueid'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x38ca,0xb0));var _0xa38c=function(_0x79f54c,_0x5b410c){_0x79f54c=_0x79f54c-0x0;var _0x14c057=_0x38ca[_0x79f54c];return _0x14c057;};'use strict';var _=require(_0xa38c('0x0'));var util=require('util');var logger=require(_0xa38c('0x1'))(_0xa38c('0x2'));var moment=require(_0xa38c('0x3'));var BPromise=require(_0xa38c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa38c('0x5'));var rimraf=require(_0xa38c('0x6'));var config=require(_0xa38c('0x7'));var attributes=require(_0xa38c('0x8'));module['exports']=function(_0xe4cde2,_0x4487ef){return _0xe4cde2['define']('VoiceDialReport',attributes,{'tableName':_0xa38c('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa38c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 2245d8b..89d150c 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 _0xd1c7=['http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','body','options','raw','update','UpdateVoiceDialReport','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x333b3a,_0x5de9f1){var _0x5205cd=function(_0x137708){while(--_0x137708){_0x333b3a['push'](_0x333b3a['shift']());}};_0x5205cd(++_0x5de9f1);}(_0xd1c7,0x189));var _0x7d1c=function(_0x4610f6,_0x5fe8c3){_0x4610f6=_0x4610f6-0x0;var _0x422a4d=_0xd1c7[_0x4610f6];return _0x422a4d;};'use strict';var _=require('lodash');var util=require(_0x7d1c('0x0'));var moment=require('moment');var BPromise=require(_0x7d1c('0x1'));var rs=require(_0x7d1c('0x2'));var fs=require('fs');var Redis=require(_0x7d1c('0x3'));var db=require(_0x7d1c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d1c('0x5'));var config=require('../../config/environment');var jayson=require(_0x7d1c('0x6'));var client=jayson['client'][_0x7d1c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d08b7,_0x2d86f5,_0x1b06d6){return new BPromise(function(_0x2146b1,_0x15af4c){return client['request'](_0x5d08b7,_0x1b06d6)[_0x7d1c('0x8')](function(_0x4104e2){logger[_0x7d1c('0x9')](_0x7d1c('0xa'),_0x2d86f5,_0x7d1c('0xb'));logger[_0x7d1c('0xc')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2d86f5,_0x7d1c('0xb'),JSON[_0x7d1c('0xd')](_0x4104e2));if(_0x4104e2[_0x7d1c('0xe')]){if(_0x4104e2[_0x7d1c('0xe')][_0x7d1c('0xf')]===0x1f4){logger[_0x7d1c('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x2d86f5,_0x4104e2[_0x7d1c('0xe')]['message']);return _0x15af4c(_0x4104e2[_0x7d1c('0xe')][_0x7d1c('0x10')]);}logger[_0x7d1c('0xe')](_0x7d1c('0xa'),_0x2d86f5,_0x4104e2[_0x7d1c('0xe')][_0x7d1c('0x10')]);return _0x2146b1(_0x4104e2[_0x7d1c('0xe')][_0x7d1c('0x10')]);}else{logger['info'](_0x7d1c('0xa'),_0x2d86f5,_0x7d1c('0xb'));_0x2146b1(_0x4104e2[_0x7d1c('0x11')][_0x7d1c('0x10')]);}})[_0x7d1c('0x12')](function(_0x1d3b17){logger[_0x7d1c('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x2d86f5,_0x1d3b17);_0x15af4c(_0x1d3b17);});});}exports[_0x7d1c('0x13')]=function(_0xd34246){var _0xdad527=this;return new Promise(function(_0x5529c8,_0xec9ac2){return db['VoiceDialReport']['create'](_0xd34246[_0x7d1c('0x14')],{'raw':_0xd34246[_0x7d1c('0x15')]?_0xd34246[_0x7d1c('0x15')][_0x7d1c('0x16')]===undefined?!![]:![]:!![]})[_0x7d1c('0x8')](function(_0x337587){logger['info']('CreateVoiceDialReport',_0xd34246);logger['debug'](_0x7d1c('0x13'),_0xd34246,JSON[_0x7d1c('0xd')](_0x337587));_0x5529c8(_0x337587);})[_0x7d1c('0x12')](function(_0x260bd4){logger['error'](_0x7d1c('0x13'),_0x260bd4['message'],_0xd34246);_0xec9ac2(_0xdad527['error'](0x1f4,_0x260bd4[_0x7d1c('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x160a72){var _0x88850f=this;return new Promise(function(_0xd1c242,_0x3f1bc0){return db['VoiceDialReport'][_0x7d1c('0x17')](_0x160a72['body'],{'raw':_0x160a72[_0x7d1c('0x15')]?_0x160a72[_0x7d1c('0x15')][_0x7d1c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x160a72[_0x7d1c('0x15')]?_0x160a72[_0x7d1c('0x15')]['where']||null:null,'attributes':_0x160a72[_0x7d1c('0x15')]?_0x160a72[_0x7d1c('0x15')]['attributes']||null:null,'limit':_0x160a72['options']?_0x160a72[_0x7d1c('0x15')]['limit']||null:null})['then'](function(_0x2d0ade){logger[_0x7d1c('0x9')]('UpdateVoiceDialReport',_0x160a72);logger[_0x7d1c('0xc')]('UpdateVoiceDialReport',_0x160a72,JSON[_0x7d1c('0xd')](_0x2d0ade));_0xd1c242(_0x2d0ade);})['catch'](function(_0x20ede1){logger[_0x7d1c('0xe')](_0x7d1c('0x18'),_0x20ede1[_0x7d1c('0x10')],_0x160a72);_0x3f1bc0(_0x88850f[_0x7d1c('0xe')](0x1f4,_0x20ede1[_0x7d1c('0x10')]));});});}; \ No newline at end of file +var _0xbd84=['UpdateVoiceDialReport','body','raw','where','attributes','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','stringify'];(function(_0x5e5b5c,_0x133fae){var _0x473034=function(_0x232d85){while(--_0x232d85){_0x5e5b5c['push'](_0x5e5b5c['shift']());}};_0x473034(++_0x133fae);}(_0xbd84,0xf3));var _0x4bd8=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xbd84[_0x1b7368];return _0x25d54c;};'use strict';var _=require('lodash');var util=require(_0x4bd8('0x0'));var moment=require(_0x4bd8('0x1'));var BPromise=require('bluebird');var rs=require(_0x4bd8('0x2'));var fs=require('fs');var Redis=require(_0x4bd8('0x3'));var db=require(_0x4bd8('0x4'))['db'];var utils=require(_0x4bd8('0x5'));var logger=require(_0x4bd8('0x6'))(_0x4bd8('0x7'));var config=require(_0x4bd8('0x8'));var jayson=require(_0x4bd8('0x9'));var client=jayson[_0x4bd8('0xa')][_0x4bd8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x567c25,_0x3c3de3,_0x3287e2){return new BPromise(function(_0x4c0e19,_0x283bcc){return client[_0x4bd8('0xc')](_0x567c25,_0x3287e2)[_0x4bd8('0xd')](function(_0x543d47){logger[_0x4bd8('0xe')](_0x4bd8('0xf'),_0x3c3de3,'request\x20sent');logger[_0x4bd8('0x10')](_0x4bd8('0x11'),_0x3c3de3,_0x4bd8('0x12'),JSON['stringify'](_0x543d47));if(_0x543d47[_0x4bd8('0x13')]){if(_0x543d47[_0x4bd8('0x13')][_0x4bd8('0x14')]===0x1f4){logger[_0x4bd8('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x3c3de3,_0x543d47[_0x4bd8('0x13')]['message']);return _0x283bcc(_0x543d47[_0x4bd8('0x13')]['message']);}logger['error'](_0x4bd8('0xf'),_0x3c3de3,_0x543d47[_0x4bd8('0x13')][_0x4bd8('0x15')]);return _0x4c0e19(_0x543d47[_0x4bd8('0x13')][_0x4bd8('0x15')]);}else{logger[_0x4bd8('0xe')](_0x4bd8('0xf'),_0x3c3de3,_0x4bd8('0x12'));_0x4c0e19(_0x543d47[_0x4bd8('0x16')][_0x4bd8('0x15')]);}})[_0x4bd8('0x17')](function(_0xbe9b1e){logger[_0x4bd8('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x3c3de3,_0xbe9b1e);_0x283bcc(_0xbe9b1e);});});}exports[_0x4bd8('0x18')]=function(_0xc3499e){var _0xbed4a5=this;return new Promise(function(_0x36ffc0,_0x34fbeb){return db[_0x4bd8('0x19')][_0x4bd8('0x1a')](_0xc3499e['body'],{'raw':_0xc3499e[_0x4bd8('0x1b')]?_0xc3499e[_0x4bd8('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x4bd8('0xd')](function(_0x3bcef1){logger[_0x4bd8('0xe')](_0x4bd8('0x18'),_0xc3499e);logger[_0x4bd8('0x10')]('CreateVoiceDialReport',_0xc3499e,JSON[_0x4bd8('0x1c')](_0x3bcef1));_0x36ffc0(_0x3bcef1);})[_0x4bd8('0x17')](function(_0x5cbffc){logger[_0x4bd8('0x13')](_0x4bd8('0x18'),_0x5cbffc[_0x4bd8('0x15')],_0xc3499e);_0x34fbeb(_0xbed4a5[_0x4bd8('0x13')](0x1f4,_0x5cbffc['message']));});});};exports[_0x4bd8('0x1d')]=function(_0x39d70a){var _0x4aeee9=this;return new Promise(function(_0x264ef8,_0x2261e1){return db[_0x4bd8('0x19')]['update'](_0x39d70a[_0x4bd8('0x1e')],{'raw':_0x39d70a[_0x4bd8('0x1b')]?_0x39d70a[_0x4bd8('0x1b')][_0x4bd8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39d70a[_0x4bd8('0x1b')]?_0x39d70a[_0x4bd8('0x1b')][_0x4bd8('0x20')]||null:null,'attributes':_0x39d70a['options']?_0x39d70a['options'][_0x4bd8('0x21')]||null:null,'limit':_0x39d70a[_0x4bd8('0x1b')]?_0x39d70a['options']['limit']||null:null})[_0x4bd8('0xd')](function(_0x5567a8){logger[_0x4bd8('0xe')](_0x4bd8('0x1d'),_0x39d70a);logger['debug'](_0x4bd8('0x1d'),_0x39d70a,JSON[_0x4bd8('0x1c')](_0x5567a8));_0x264ef8(_0x5567a8);})[_0x4bd8('0x17')](function(_0x654f7a){logger[_0x4bd8('0x13')](_0x4bd8('0x1d'),_0x654f7a[_0x4bd8('0x15')],_0x39d70a);_0x2261e1(_0x4aeee9['error'](0x1f4,_0x654f7a[_0x4bd8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 49373aa..2cc7806 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 _0xcc19=['isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4fdaa6,_0x345755){var _0x18f73d=function(_0x32e5bb){while(--_0x32e5bb){_0x4fdaa6['push'](_0x4fdaa6['shift']());}};_0x18f73d(++_0x345755);}(_0xcc19,0x1c3));var _0x9cc1=function(_0x2e440b,_0x540f27){_0x2e440b=_0x2e440b-0x0;var _0x46e1a4=_0xcc19[_0x2e440b];return _0x46e1a4;};'use strict';var multer=require(_0x9cc1('0x0'));var util=require(_0x9cc1('0x1'));var path=require(_0x9cc1('0x2'));var timeout=require(_0x9cc1('0x3'));var express=require(_0x9cc1('0x4'));var router=express[_0x9cc1('0x5')]();var fs_extra=require(_0x9cc1('0x6'));var auth=require(_0x9cc1('0x7'));var interaction=require(_0x9cc1('0x8'));var config=require(_0x9cc1('0x9'));var controller=require('./voiceExtension.controller');router[_0x9cc1('0xa')]('/',auth[_0x9cc1('0xb')](),controller[_0x9cc1('0xc')]);router[_0x9cc1('0xa')](_0x9cc1('0xd'),auth[_0x9cc1('0xb')](),controller['show']);router[_0x9cc1('0xe')]('/',auth[_0x9cc1('0xb')](),controller[_0x9cc1('0xf')]);router['post'](_0x9cc1('0x10'),auth[_0x9cc1('0xb')](),controller[_0x9cc1('0x11')]);router[_0x9cc1('0x12')](_0x9cc1('0xd'),auth[_0x9cc1('0xb')](),controller['update']);router[_0x9cc1('0x13')](_0x9cc1('0xd'),auth[_0x9cc1('0xb')](),controller[_0x9cc1('0x14')]);module[_0x9cc1('0x15')]=router; \ No newline at end of file +var _0x51b9=['isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','put','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x51b9,0x1ae));var _0x951b=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x51b9[_0x2d48fa];return _0x4645b7;};'use strict';var multer=require(_0x951b('0x0'));var util=require(_0x951b('0x1'));var path=require('path');var timeout=require(_0x951b('0x2'));var express=require('express');var router=express[_0x951b('0x3')]();var fs_extra=require(_0x951b('0x4'));var auth=require(_0x951b('0x5'));var interaction=require(_0x951b('0x6'));var config=require(_0x951b('0x7'));var controller=require(_0x951b('0x8'));router[_0x951b('0x9')]('/',auth[_0x951b('0xa')](),controller[_0x951b('0xb')]);router[_0x951b('0x9')](_0x951b('0xc'),auth[_0x951b('0xa')](),controller['show']);router[_0x951b('0xd')]('/',auth[_0x951b('0xa')](),controller[_0x951b('0xe')]);router[_0x951b('0xd')](_0x951b('0xf'),auth[_0x951b('0xa')](),controller[_0x951b('0x10')]);router[_0x951b('0x11')]('/:id',auth[_0x951b('0xa')](),controller['update']);router['delete'](_0x951b('0xc'),auth[_0x951b('0xa')](),controller[_0x951b('0x12')]);module[_0x951b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 0882e9e..835e708 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 _0x4461=['exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL'];(function(_0x2cb6d4,_0x471a92){var _0x53c00f=function(_0x44ca79){while(--_0x44ca79){_0x2cb6d4['push'](_0x2cb6d4['shift']());}};_0x53c00f(++_0x471a92);}(_0x4461,0x121));var _0x1446=function(_0x5becd6,_0x13e651){_0x5becd6=_0x5becd6-0x0;var _0x3b7b78=_0x4461[_0x5becd6];return _0x3b7b78;};'use strict';var Sequelize=require(_0x1446('0x0'));module[_0x1446('0x1')]={'context':{'type':Sequelize[_0x1446('0x2')],'allowNull':![],'unique':_0x1446('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1446('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x1446('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1446('0x4')},'appdata':{'type':Sequelize[_0x1446('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x1446('0x5')](_0x1446('0x6'),_0x1446('0x7'),_0x1446('0x8'),_0x1446('0x9'),'outbound-fax','system','any'),'allowNull':![]},'description':{'type':Sequelize[_0x1446('0x2')]},'interval':{'type':Sequelize[_0x1446('0x2')],'allowNull':![],'defaultValue':_0x1446('0xa')},'IntervalId':{'type':Sequelize[_0x1446('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1446('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x1446('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1446('0xb')]},'recordingFormat':{'type':Sequelize[_0x1446('0x2')],'defaultValue':_0x1446('0xd')},'answer':{'type':Sequelize[_0x1446('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1446('0xe')],'get':function(_0x35962f){return this['getDataValue'](_0x1446('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xa835=['wav','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','outbound-fax','system','*,*,*,*','INTEGER'];(function(_0x1c1c03,_0x3d1e61){var _0x4abe9a=function(_0x186cf4){while(--_0x186cf4){_0x1c1c03['push'](_0x1c1c03['shift']());}};_0x4abe9a(++_0x3d1e61);}(_0xa835,0x67));var _0x5a83=function(_0x6d22b1,_0x35eb3d){_0x6d22b1=_0x6d22b1-0x0;var _0x5cf8fe=_0xa835[_0x6d22b1];return _0x5cf8fe;};'use strict';var Sequelize=require(_0x5a83('0x0'));module[_0x5a83('0x1')]={'context':{'type':Sequelize[_0x5a83('0x2')],'allowNull':![],'unique':_0x5a83('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5a83('0x2')],'allowNull':![],'unique':_0x5a83('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x5a83('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5a83('0x4')},'appdata':{'type':Sequelize[_0x5a83('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound','outbound','internal','inbound-fax',_0x5a83('0x5'),_0x5a83('0x6'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x5a83('0x2')]},'interval':{'type':Sequelize[_0x5a83('0x2')],'allowNull':![],'defaultValue':_0x5a83('0x7')},'IntervalId':{'type':Sequelize[_0x5a83('0x8')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x5a83('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5a83('0x8')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x5a83('0x9')},'answer':{'type':Sequelize[_0x5a83('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5a83('0xb')],'get':function(_0x537505){return this[_0x5a83('0xc')](_0x5a83('0xd'));}},'alias':{'type':Sequelize[_0x5a83('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 5b5d881..0d2e8f7 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 _0x819d=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','inbound','internal','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','pick','context','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','rewriteDial','toLowerCase','true','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','name','error','send','index','VoiceExtension','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','VIRTUAL','merge','options','includeAll','include','show','find','catch','create','body','startsWith','exten','concat','user'];(function(_0x25b831,_0x4d25fa){var _0x2b31b3=function(_0x28431a){while(--_0x28431a){_0x25b831['push'](_0x25b831['shift']());}};_0x2b31b3(++_0x4d25fa);}(_0x819d,0x1cb));var _0xd819=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x819d[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xd819('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd819('0x1'));var rp=require(_0xd819('0x2'));var moment=require(_0xd819('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd819('0x4'));var util=require(_0xd819('0x5'));var path=require(_0xd819('0x6'));var sox=require(_0xd819('0x7'));var csv=require('to-csv');var ejs=require(_0xd819('0x8'));var fs=require('fs');var fs_extra=require(_0xd819('0x9'));var _=require(_0xd819('0xa'));var squel=require(_0xd819('0xb'));var crypto=require(_0xd819('0xc'));var jsforce=require(_0xd819('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd819('0xe'));var querystring=require(_0xd819('0xf'));var Papa=require(_0xd819('0x10'));var Redis=require('ioredis');var authService=require(_0xd819('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd819('0x12'));var utils=require(_0xd819('0x13'));var config=require(_0xd819('0x14'));var licenseUtil=require(_0xd819('0x15'));var db=require('../../mysqldb')['db'];config[_0xd819('0x16')]=_[_0xd819('0x17')](config[_0xd819('0x16')],{'host':_0xd819('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd819('0x16')]));require('./voiceExtension.socket')[_0xd819('0x19')](socket);function respondWithStatusCode(_0x53c961,_0x4fce92){_0x4fce92=_0x4fce92||0xcc;return function(_0x106e2f){if(_0x106e2f){return _0x53c961[_0xd819('0x1a')](_0x4fce92);}return _0x53c961[_0xd819('0x1b')](_0x4fce92)[_0xd819('0x1c')]();};}function respondWithResult(_0x162d4b,_0x1a3c71){_0x1a3c71=_0x1a3c71||0xc8;return function(_0xe8df05){if(_0xe8df05){return _0x162d4b[_0xd819('0x1b')](_0x1a3c71)[_0xd819('0x1d')](_0xe8df05);}};}function respondWithFilteredResult(_0x54a26f,_0x539690){return function(_0x368469){if(_0x368469){var _0x15a936=typeof _0x539690['offset']===_0xd819('0x1e')&&typeof _0x539690[_0xd819('0x1f')]===_0xd819('0x1e');var _0x24b512=_0x368469[_0xd819('0x20')];var _0x2bb891=_0x15a936?0x0:_0x539690['offset'];var _0x177380=_0x15a936?_0x368469[_0xd819('0x20')]:_0x539690[_0xd819('0x21')]+_0x539690['limit'];var _0xd30827;if(_0x177380>=_0x24b512){_0x177380=_0x24b512;_0xd30827=0xc8;}else{_0xd30827=0xce;}_0x54a26f[_0xd819('0x1b')](_0xd30827);return _0x54a26f['set'](_0xd819('0x22'),_0x2bb891+'-'+_0x177380+'/'+_0x24b512)[_0xd819('0x1d')](_0x368469);}return null;};}function patchUpdates(_0x538f88){return function(_0x3f6561){try{jsonpatch[_0xd819('0x23')](_0x3f6561,_0x538f88,!![]);}catch(_0xb2a8d){return BPromise[_0xd819('0x24')](_0xb2a8d);}return _0x3f6561[_0xd819('0x25')]();};}function saveUpdates(_0x59ba31,_0x2552ca){return function(_0x46346d){if(_0x46346d){return _0x46346d[_0xd819('0x26')](_0x59ba31)[_0xd819('0x27')](function(_0xe9d503){return _0xe9d503;});}return null;};}function removeEntity(_0x1e2651,_0x23cef6){return function(_0x4c34e3){if(_0x4c34e3){return _0x4c34e3[_0xd819('0x28')]()[_0xd819('0x27')](function(){var _0x50bd23=_0x4c34e3['get']({'plain':!![]});var _0x35d332=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xd819('0x29'),'value':_0xd819('0x2a'),'ignore':![]},{'name':_0xd819('0x2b'),'value':'internal','ignore':![]}];var _0x5197c1=_(_0x35d332)[_0xd819('0x2c')](_0xd819('0x2d'))[_0xd819('0x2e')](_0xd819('0x2f'))[_0xd819('0x2f')]();if(_[_0xd819('0x30')](_0x5197c1,_0x50bd23[_0xd819('0x31')])){return;}var _0x4bf6cf=_['find'](_0x35d332,[_0xd819('0x2f'),_0x50bd23['type']])[_0xd819('0x32')];return db['UserProfileResource']['destroy']({'where':{'type':_0x4bf6cf,'resourceId':_0x50bd23['id']}})[_0xd819('0x27')](function(){return _0x4c34e3;});})[_0xd819('0x27')](function(){_0x1e2651[_0xd819('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cdfbb,_0x464cae){return function(_0x3d03f6){if(!_0x3d03f6){_0x2cdfbb[_0xd819('0x1a')](0x194);}return _0x3d03f6;};}function handleError(_0x3217fa,_0x351432){_0x351432=_0x351432||0x1f4;return function(_0x335efb){logger[_0xd819('0x33')](_0x335efb['stack']);if(_0x335efb[_0xd819('0x32')]){delete _0x335efb['name'];}_0x3217fa['status'](_0x351432)[_0xd819('0x34')](_0x335efb);};}exports[_0xd819('0x35')]=function(_0x11347d,_0x1afc18){var _0x58cbb1={},_0x4db01c={},_0xb109fa={'count':0x0,'rows':[]};var _0x25704d=_['map'](db[_0xd819('0x36')]['rawAttributes'],function(_0x36f7df){return{'name':_0x36f7df[_0xd819('0x37')],'type':_0x36f7df[_0xd819('0x31')]['key']};});_0x4db01c[_0xd819('0x38')]=_[_0xd819('0x2e')](_0x25704d,_0xd819('0x32'));_0x4db01c['query']=_[_0xd819('0x39')](_0x11347d[_0xd819('0x3a')]);_0x4db01c[_0xd819('0x3b')]=_[_0xd819('0x3c')](_0x4db01c[_0xd819('0x38')],_0x4db01c[_0xd819('0x3a')]);_0x58cbb1[_0xd819('0x3d')]=_[_0xd819('0x3c')](_0x4db01c[_0xd819('0x38')],qs[_0xd819('0x3e')](_0x11347d[_0xd819('0x3a')][_0xd819('0x3e')]));_0x58cbb1['attributes']=_0x58cbb1[_0xd819('0x3d')][_0xd819('0x3f')]?_0x58cbb1['attributes']:_0x4db01c['model'];if(!_0x11347d[_0xd819('0x3a')][_0xd819('0x40')](_0xd819('0x41'))){_0x58cbb1[_0xd819('0x1f')]=qs[_0xd819('0x1f')](_0x11347d[_0xd819('0x3a')][_0xd819('0x1f')]);_0x58cbb1[_0xd819('0x21')]=qs[_0xd819('0x21')](_0x11347d[_0xd819('0x3a')][_0xd819('0x21')]);}_0x58cbb1['order']=qs['sort'](_0x11347d['query']['sort']);_0x58cbb1[_0xd819('0x42')]=qs[_0xd819('0x3b')](_['pick'](_0x11347d[_0xd819('0x3a')],_0x4db01c[_0xd819('0x3b')]),_0x25704d);if(_0x11347d['query'][_0xd819('0x2c')]){_0x58cbb1['where']=_['merge'](_0x58cbb1[_0xd819('0x42')],{'$or':_[_0xd819('0x2e')](_0x25704d,function(_0x462afc){if(_0x462afc[_0xd819('0x31')]!==_0xd819('0x43')){var _0x321dfd={};_0x321dfd[_0x462afc[_0xd819('0x32')]]={'$like':'%'+_0x11347d[_0xd819('0x3a')][_0xd819('0x2c')]+'%'};return _0x321dfd;}})});}_0x58cbb1=_[_0xd819('0x44')]({},_0x58cbb1,_0x11347d[_0xd819('0x45')]);var _0x2bf9dc={'where':_0x58cbb1['where']};return db['VoiceExtension'][_0xd819('0x20')](_0x2bf9dc)[_0xd819('0x27')](function(_0x54a7b8){_0xb109fa[_0xd819('0x20')]=_0x54a7b8;if(_0x11347d[_0xd819('0x3a')][_0xd819('0x46')]){_0x58cbb1[_0xd819('0x47')]=[{'all':!![]}];}return db[_0xd819('0x36')]['findAll'](_0x58cbb1);})[_0xd819('0x27')](function(_0x5cf77b){_0xb109fa['rows']=_0x5cf77b;return _0xb109fa;})[_0xd819('0x27')](respondWithFilteredResult(_0x1afc18,_0x58cbb1))['catch'](handleError(_0x1afc18,null));};exports[_0xd819('0x48')]=function(_0x1dca9a,_0x5b8958){var _0x1b2860={'raw':![],'where':{'id':_0x1dca9a['params']['id']}},_0x533a93={};_0x533a93[_0xd819('0x38')]=_[_0xd819('0x39')](db[_0xd819('0x36')]['rawAttributes']);_0x533a93[_0xd819('0x3a')]=_[_0xd819('0x39')](_0x1dca9a['query']);_0x533a93[_0xd819('0x3b')]=_[_0xd819('0x3c')](_0x533a93[_0xd819('0x38')],_0x533a93['query']);_0x1b2860['attributes']=_[_0xd819('0x3c')](_0x533a93[_0xd819('0x38')],qs[_0xd819('0x3e')](_0x1dca9a[_0xd819('0x3a')]['fields']));_0x1b2860[_0xd819('0x3d')]=_0x1b2860[_0xd819('0x3d')][_0xd819('0x3f')]?_0x1b2860[_0xd819('0x3d')]:_0x533a93['model'];if(_0x1dca9a[_0xd819('0x3a')][_0xd819('0x46')]){_0x1b2860['include']=[{'all':!![]}];}_0x1b2860=_[_0xd819('0x44')]({},_0x1b2860,_0x1dca9a[_0xd819('0x45')]);return db[_0xd819('0x36')][_0xd819('0x49')](_0x1b2860)[_0xd819('0x27')](handleEntityNotFound(_0x5b8958,null))['then'](respondWithResult(_0x5b8958,null))['catch'](handleError(_0x5b8958,null));};exports['destroy']=function(_0x5e0f33,_0x4e3892){return db['VoiceExtension']['find']({'where':{'id':_0x5e0f33['params']['id']}})[_0xd819('0x27')](handleEntityNotFound(_0x4e3892,null))['then'](removeEntity(_0x4e3892,null))[_0xd819('0x4a')](handleError(_0x4e3892,null));};exports[_0xd819('0x4b')]=function(_0x34237f,_0x2b8a0f){if(_0x34237f[_0xd819('0x4c')][_0xd819('0x31')]==='outbound'&&!_[_0xd819('0x4d')](_0x34237f[_0xd819('0x4c')][_0xd819('0x4e')],'_')){_0x34237f['body'][_0xd819('0x4e')]='_'[_0xd819('0x4f')](_0x34237f[_0xd819('0x4c')][_0xd819('0x4e')]);}return db[_0xd819('0x36')][_0xd819('0x4b')](_0x34237f[_0xd819('0x4c')],{'raw':![]})[_0xd819('0x27')](function(_0x3197aa){var _0x35edd4=_0x34237f[_0xd819('0x50')]['get']({'plain':!![]});if(!_0x35edd4)throw new Error(_0xd819('0x51'));if(_0x35edd4[_0xd819('0x52')]===_0xd819('0x50')){var _0x3ebb2d=_0x3197aa['get']({'plain':!![]});var _0x3e251a=[{'name':_0xd819('0x53'),'value':_0xd819('0x54')},{'name':'OutboundRoutes','value':_0xd819('0x2a')},{'name':_0xd819('0x2b'),'value':_0xd819('0x55')}];var _0x291b81=_[_0xd819('0x49')](_0x3e251a,[_0xd819('0x2f'),_0x3ebb2d['type']])['name'];return db[_0xd819('0x56')][_0xd819('0x49')]({'where':{'name':_0x291b81,'userProfileId':_0x35edd4[_0xd819('0x57')]},'raw':!![]})[_0xd819('0x27')](function(_0x47d71c){if(_0x47d71c&&_0x47d71c[_0xd819('0x58')]===0x0){return db[_0xd819('0x59')][_0xd819('0x4b')]({'name':_0x3ebb2d['name'],'resourceId':_0x3ebb2d['id'],'type':_0x47d71c['name'],'sectionId':_0x47d71c['id']},{})['then'](function(){return _0x3197aa;});}else{return _0x3197aa;}})[_0xd819('0x4a')](function(_0x4ce670){logger[_0xd819('0x33')](_0xd819('0x5a'),_0x4ce670);throw _0x4ce670;});}return _0x3197aa;})[_0xd819('0x27')](respondWithResult(_0x2b8a0f,0xc9))['catch'](handleError(_0x2b8a0f,null));};exports['update']=function(_0x218d58,_0x17f4da){if(_0x218d58['body']['id']){delete _0x218d58[_0xd819('0x4c')]['id'];}return db[_0xd819('0x36')][_0xd819('0x49')]({'where':{'id':_0x218d58[_0xd819('0x5b')]['id']}})['then'](handleEntityNotFound(_0x17f4da,null))[_0xd819('0x27')](function(_0x4f5444){if(_0x4f5444){return db['VoiceExtension'][_0xd819('0x26')](_[_0xd819('0x5c')](_0x218d58[_0xd819('0x4c')],[_0xd819('0x4e'),_0xd819('0x5d'),'description','recordingFormat',_0xd819('0x5e'),_0xd819('0x5f'),_0xd819('0x60')]),{'where':{'context':_0x4f5444[_0xd819('0x5d')],'exten':_0x4f5444['exten']},'individualHooks':!![]})['then'](function(_0x49b196){return _0x49b196;});}return null;})[_0xd819('0x27')](respondWithStatusCode(_0x17f4da,null))[_0xd819('0x4a')](handleError(_0x17f4da,null));};exports[_0xd819('0x61')]=function(_0x24bfa1,_0x1b5195){return db['VoiceExtension'][_0xd819('0x62')]({'where':{'id':_0x24bfa1['params']['id']}})[_0xd819('0x27')](function(_0x41efcf){if(_0x41efcf){return db[_0xd819('0x63')][_0xd819('0x64')](function(_0x2f78e2){return db['VoiceExtension'][_0xd819('0x28')]({'where':{'VoiceExtensionId':_0x24bfa1[_0xd819('0x5b')]['id']},'transaction':_0x2f78e2})['then'](function(){var _0x1bb31f=_['map'](_0x24bfa1[_0xd819('0x4c')],function(_0x4d634d){_0x4d634d[_0xd819('0x65')]=_0x24bfa1[_0xd819('0x5b')]['id'];_0x4d634d['isApp']=!![];return _0x4d634d;});var _0x3808b1=_0x24bfa1[_0xd819('0x3a')][_0xd819('0x66')]&&_0x24bfa1['query'][_0xd819('0x66')][_0xd819('0x67')]()===_0xd819('0x68')?!![]:![];return _0x41efcf['createRouting'](_0x1bb31f,_0x3808b1);})[_0xd819('0x27')](function(_0x4e4e81){return db[_0xd819('0x36')][_0xd819('0x69')](_0x4e4e81,{'transaction':_0x2f78e2});});})['then'](function(){return db[_0xd819('0x36')][_0xd819('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x24bfa1[_0xd819('0x5b')]['id']},'order':_0xd819('0x6b')});});}})['then'](respondWithResult(_0x1b5195,null))[_0xd819('0x4a')](handleError(_0x1b5195,null));}; \ No newline at end of file +var _0x8a71=['findAll','catch','params','create','outbound','startsWith','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','findOne','sequelize','transaction','VoiceExtensionId','rewriteDial','true','createRouting','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','internal','filter','ignore','map','value','includes','find','UserProfileResource','error','name','send','index','VoiceExtension','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','includeAll','include'];(function(_0xc9e5d1,_0xbc9e53){var _0x412d25=function(_0x5309b4){while(--_0x5309b4){_0xc9e5d1['push'](_0xc9e5d1['shift']());}};_0x412d25(++_0xbc9e53);}(_0x8a71,0x84));var _0x18a7=function(_0x1c18af,_0x92af3a){_0x1c18af=_0x1c18af-0x0;var _0x52e1f0=_0x8a71[_0x1c18af];return _0x52e1f0;};'use strict';var emlformat=require(_0x18a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x18a7('0x1'));var jsonpatch=require(_0x18a7('0x2'));var rp=require(_0x18a7('0x3'));var moment=require(_0x18a7('0x4'));var BPromise=require(_0x18a7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x18a7('0x6'));var csv=require(_0x18a7('0x7'));var ejs=require(_0x18a7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18a7('0x9'));var squel=require(_0x18a7('0xa'));var crypto=require('crypto');var jsforce=require(_0x18a7('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x18a7('0xc'));var Papa=require(_0x18a7('0xd'));var Redis=require(_0x18a7('0xe'));var authService=require(_0x18a7('0xf'));var qs=require(_0x18a7('0x10'));var as=require(_0x18a7('0x11'));var hardwareService=require(_0x18a7('0x12'));var logger=require(_0x18a7('0x13'))(_0x18a7('0x14'));var utils=require(_0x18a7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x18a7('0x16'));var db=require(_0x18a7('0x17'))['db'];config[_0x18a7('0x18')]=_['defaults'](config[_0x18a7('0x18')],{'host':_0x18a7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x18a7('0x1a')](socket);function respondWithStatusCode(_0x35e7f0,_0x1dcd7d){_0x1dcd7d=_0x1dcd7d||0xcc;return function(_0x28d1b6){if(_0x28d1b6){return _0x35e7f0[_0x18a7('0x1b')](_0x1dcd7d);}return _0x35e7f0[_0x18a7('0x1c')](_0x1dcd7d)[_0x18a7('0x1d')]();};}function respondWithResult(_0x31baf2,_0x105892){_0x105892=_0x105892||0xc8;return function(_0xe47f5){if(_0xe47f5){return _0x31baf2[_0x18a7('0x1c')](_0x105892)[_0x18a7('0x1e')](_0xe47f5);}};}function respondWithFilteredResult(_0x243198,_0x42d349){return function(_0xc8d03b){if(_0xc8d03b){var _0x217b95=typeof _0x42d349[_0x18a7('0x1f')]===_0x18a7('0x20')&&typeof _0x42d349['limit']===_0x18a7('0x20');var _0x72fe02=_0xc8d03b[_0x18a7('0x21')];var _0x3c751e=_0x217b95?0x0:_0x42d349[_0x18a7('0x1f')];var _0x439f8d=_0x217b95?_0xc8d03b[_0x18a7('0x21')]:_0x42d349[_0x18a7('0x1f')]+_0x42d349[_0x18a7('0x22')];var _0x5ea6fb;if(_0x439f8d>=_0x72fe02){_0x439f8d=_0x72fe02;_0x5ea6fb=0xc8;}else{_0x5ea6fb=0xce;}_0x243198[_0x18a7('0x1c')](_0x5ea6fb);return _0x243198[_0x18a7('0x23')]('Content-Range',_0x3c751e+'-'+_0x439f8d+'/'+_0x72fe02)[_0x18a7('0x1e')](_0xc8d03b);}return null;};}function patchUpdates(_0x467910){return function(_0x3cebdb){try{jsonpatch[_0x18a7('0x24')](_0x3cebdb,_0x467910,!![]);}catch(_0x45f4c7){return BPromise[_0x18a7('0x25')](_0x45f4c7);}return _0x3cebdb['save']();};}function saveUpdates(_0x5ecde0,_0x3ecaa1){return function(_0x1a2325){if(_0x1a2325){return _0x1a2325[_0x18a7('0x26')](_0x5ecde0)[_0x18a7('0x27')](function(_0x2f321f){return _0x2f321f;});}return null;};}function removeEntity(_0x5b1ae0,_0x5238a8){return function(_0x36c52){if(_0x36c52){return _0x36c52[_0x18a7('0x28')]()['then'](function(){var _0x1f311a=_0x36c52[_0x18a7('0x29')]({'plain':!![]});var _0x358c2d=[{'name':_0x18a7('0x2a'),'value':_0x18a7('0x2b'),'ignore':![]},{'name':_0x18a7('0x2c'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x18a7('0x2d'),'ignore':![]}];var _0x26f926=_(_0x358c2d)[_0x18a7('0x2e')](_0x18a7('0x2f'))[_0x18a7('0x30')](_0x18a7('0x31'))[_0x18a7('0x31')]();if(_[_0x18a7('0x32')](_0x26f926,_0x1f311a['type'])){return;}var _0xcc4a21=_[_0x18a7('0x33')](_0x358c2d,[_0x18a7('0x31'),_0x1f311a['type']])['name'];return db[_0x18a7('0x34')][_0x18a7('0x28')]({'where':{'type':_0xcc4a21,'resourceId':_0x1f311a['id']}})[_0x18a7('0x27')](function(){return _0x36c52;});})[_0x18a7('0x27')](function(){_0x5b1ae0[_0x18a7('0x1c')](0xcc)[_0x18a7('0x1d')]();});}};}function handleEntityNotFound(_0xa33b8f,_0x1c541b){return function(_0x3610db){if(!_0x3610db){_0xa33b8f[_0x18a7('0x1b')](0x194);}return _0x3610db;};}function handleError(_0x9a871f,_0x5c1064){_0x5c1064=_0x5c1064||0x1f4;return function(_0x32b1bd){logger[_0x18a7('0x35')](_0x32b1bd['stack']);if(_0x32b1bd[_0x18a7('0x36')]){delete _0x32b1bd['name'];}_0x9a871f['status'](_0x5c1064)[_0x18a7('0x37')](_0x32b1bd);};}exports[_0x18a7('0x38')]=function(_0x575dfd,_0x427605){var _0x583783={},_0x51fc5e={},_0x27e186={'count':0x0,'rows':[]};var _0x666444=_[_0x18a7('0x30')](db[_0x18a7('0x39')][_0x18a7('0x3a')],function(_0x232d30){return{'name':_0x232d30[_0x18a7('0x3b')],'type':_0x232d30[_0x18a7('0x3c')][_0x18a7('0x3d')]};});_0x51fc5e[_0x18a7('0x3e')]=_[_0x18a7('0x30')](_0x666444,_0x18a7('0x36'));_0x51fc5e[_0x18a7('0x3f')]=_[_0x18a7('0x40')](_0x575dfd[_0x18a7('0x3f')]);_0x51fc5e['filters']=_[_0x18a7('0x41')](_0x51fc5e[_0x18a7('0x3e')],_0x51fc5e[_0x18a7('0x3f')]);_0x583783[_0x18a7('0x42')]=_[_0x18a7('0x41')](_0x51fc5e[_0x18a7('0x3e')],qs[_0x18a7('0x43')](_0x575dfd[_0x18a7('0x3f')][_0x18a7('0x43')]));_0x583783[_0x18a7('0x42')]=_0x583783['attributes'][_0x18a7('0x44')]?_0x583783[_0x18a7('0x42')]:_0x51fc5e[_0x18a7('0x3e')];if(!_0x575dfd[_0x18a7('0x3f')][_0x18a7('0x45')](_0x18a7('0x46'))){_0x583783['limit']=qs[_0x18a7('0x22')](_0x575dfd[_0x18a7('0x3f')]['limit']);_0x583783[_0x18a7('0x1f')]=qs[_0x18a7('0x1f')](_0x575dfd[_0x18a7('0x3f')][_0x18a7('0x1f')]);}_0x583783['order']=qs[_0x18a7('0x47')](_0x575dfd['query'][_0x18a7('0x47')]);_0x583783[_0x18a7('0x48')]=qs[_0x18a7('0x49')](_[_0x18a7('0x4a')](_0x575dfd[_0x18a7('0x3f')],_0x51fc5e['filters']),_0x666444);if(_0x575dfd[_0x18a7('0x3f')][_0x18a7('0x2e')]){_0x583783['where']=_[_0x18a7('0x4b')](_0x583783['where'],{'$or':_[_0x18a7('0x30')](_0x666444,function(_0x38bc23){if(_0x38bc23[_0x18a7('0x3c')]!=='VIRTUAL'){var _0x54fc85={};_0x54fc85[_0x38bc23['name']]={'$like':'%'+_0x575dfd[_0x18a7('0x3f')][_0x18a7('0x2e')]+'%'};return _0x54fc85;}})});}_0x583783=_[_0x18a7('0x4b')]({},_0x583783,_0x575dfd['options']);var _0x2aa00e={'where':_0x583783[_0x18a7('0x48')]};return db[_0x18a7('0x39')][_0x18a7('0x21')](_0x2aa00e)['then'](function(_0x3b17ee){_0x27e186[_0x18a7('0x21')]=_0x3b17ee;if(_0x575dfd[_0x18a7('0x3f')][_0x18a7('0x4c')]){_0x583783[_0x18a7('0x4d')]=[{'all':!![]}];}return db[_0x18a7('0x39')][_0x18a7('0x4e')](_0x583783);})[_0x18a7('0x27')](function(_0x1c719c){_0x27e186['rows']=_0x1c719c;return _0x27e186;})[_0x18a7('0x27')](respondWithFilteredResult(_0x427605,_0x583783))[_0x18a7('0x4f')](handleError(_0x427605,null));};exports['show']=function(_0x1ee2a0,_0x4b6a1c){var _0xe5b7bb={'raw':![],'where':{'id':_0x1ee2a0[_0x18a7('0x50')]['id']}},_0x2ccdb0={};_0x2ccdb0[_0x18a7('0x3e')]=_[_0x18a7('0x40')](db[_0x18a7('0x39')]['rawAttributes']);_0x2ccdb0[_0x18a7('0x3f')]=_[_0x18a7('0x40')](_0x1ee2a0[_0x18a7('0x3f')]);_0x2ccdb0[_0x18a7('0x49')]=_[_0x18a7('0x41')](_0x2ccdb0['model'],_0x2ccdb0['query']);_0xe5b7bb['attributes']=_[_0x18a7('0x41')](_0x2ccdb0[_0x18a7('0x3e')],qs[_0x18a7('0x43')](_0x1ee2a0[_0x18a7('0x3f')]['fields']));_0xe5b7bb[_0x18a7('0x42')]=_0xe5b7bb[_0x18a7('0x42')][_0x18a7('0x44')]?_0xe5b7bb['attributes']:_0x2ccdb0['model'];if(_0x1ee2a0[_0x18a7('0x3f')][_0x18a7('0x4c')]){_0xe5b7bb['include']=[{'all':!![]}];}_0xe5b7bb=_[_0x18a7('0x4b')]({},_0xe5b7bb,_0x1ee2a0['options']);return db[_0x18a7('0x39')]['find'](_0xe5b7bb)[_0x18a7('0x27')](handleEntityNotFound(_0x4b6a1c,null))[_0x18a7('0x27')](respondWithResult(_0x4b6a1c,null))['catch'](handleError(_0x4b6a1c,null));};exports['destroy']=function(_0x3b85f2,_0x1a3715){return db['VoiceExtension']['find']({'where':{'id':_0x3b85f2[_0x18a7('0x50')]['id']}})['then'](handleEntityNotFound(_0x1a3715,null))[_0x18a7('0x27')](removeEntity(_0x1a3715,null))[_0x18a7('0x4f')](handleError(_0x1a3715,null));};exports[_0x18a7('0x51')]=function(_0x4d9a0b,_0x2b5fef){if(_0x4d9a0b['body'][_0x18a7('0x3c')]===_0x18a7('0x52')&&!_[_0x18a7('0x53')](_0x4d9a0b[_0x18a7('0x54')][_0x18a7('0x55')],'_')){_0x4d9a0b['body'][_0x18a7('0x55')]='_'[_0x18a7('0x56')](_0x4d9a0b[_0x18a7('0x54')][_0x18a7('0x55')]);}return db['VoiceExtension']['create'](_0x4d9a0b['body'],{'raw':![]})[_0x18a7('0x27')](function(_0xb0a5a1){var _0x160bff=_0x4d9a0b['user'][_0x18a7('0x29')]({'plain':!![]});if(!_0x160bff)throw new Error(_0x18a7('0x57'));if(_0x160bff[_0x18a7('0x58')]===_0x18a7('0x59')){var _0x12bbb8=_0xb0a5a1[_0x18a7('0x29')]({'plain':!![]});var _0x3d236c=[{'name':_0x18a7('0x2a'),'value':_0x18a7('0x2b')},{'name':_0x18a7('0x2c'),'value':_0x18a7('0x52')},{'name':_0x18a7('0x5a'),'value':'internal'}];var _0x583105=_['find'](_0x3d236c,[_0x18a7('0x31'),_0x12bbb8[_0x18a7('0x3c')]])[_0x18a7('0x36')];return db[_0x18a7('0x5b')][_0x18a7('0x33')]({'where':{'name':_0x583105,'userProfileId':_0x160bff[_0x18a7('0x5c')]},'raw':!![]})['then'](function(_0x4f049f){if(_0x4f049f&&_0x4f049f[_0x18a7('0x5d')]===0x0){return db[_0x18a7('0x34')][_0x18a7('0x51')]({'name':_0x12bbb8[_0x18a7('0x36')],'resourceId':_0x12bbb8['id'],'type':_0x4f049f['name'],'sectionId':_0x4f049f['id']},{})[_0x18a7('0x27')](function(){return _0xb0a5a1;});}else{return _0xb0a5a1;}})[_0x18a7('0x4f')](function(_0x2625c9){logger[_0x18a7('0x35')](_0x18a7('0x5e'),_0x2625c9);throw _0x2625c9;});}return _0xb0a5a1;})[_0x18a7('0x27')](respondWithResult(_0x2b5fef,0xc9))[_0x18a7('0x4f')](handleError(_0x2b5fef,null));};exports[_0x18a7('0x26')]=function(_0x435216,_0x1673f2){if(_0x435216[_0x18a7('0x54')]['id']){delete _0x435216['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x435216[_0x18a7('0x50')]['id']}})[_0x18a7('0x27')](handleEntityNotFound(_0x1673f2,null))[_0x18a7('0x27')](function(_0x4fd686){if(_0x4fd686){return db[_0x18a7('0x39')][_0x18a7('0x26')](_['pick'](_0x435216[_0x18a7('0x54')],[_0x18a7('0x55'),'context',_0x18a7('0x5f'),_0x18a7('0x60'),'cutdigits','mandatoryDisposition','alias']),{'where':{'context':_0x4fd686['context'],'exten':_0x4fd686[_0x18a7('0x55')]},'individualHooks':!![]})['then'](function(_0x3f159d){return _0x3f159d;});}return null;})[_0x18a7('0x27')](respondWithStatusCode(_0x1673f2,null))[_0x18a7('0x4f')](handleError(_0x1673f2,null));};exports['addApplications']=function(_0x541870,_0xc66102){return db[_0x18a7('0x39')][_0x18a7('0x61')]({'where':{'id':_0x541870[_0x18a7('0x50')]['id']}})['then'](function(_0x40dc30){if(_0x40dc30){return db[_0x18a7('0x62')][_0x18a7('0x63')](function(_0x2ba5da){return db[_0x18a7('0x39')][_0x18a7('0x28')]({'where':{'VoiceExtensionId':_0x541870[_0x18a7('0x50')]['id']},'transaction':_0x2ba5da})[_0x18a7('0x27')](function(){var _0x2a5a9a=_['map'](_0x541870[_0x18a7('0x54')],function(_0x26f4ca){_0x26f4ca[_0x18a7('0x64')]=_0x541870['params']['id'];_0x26f4ca['isApp']=!![];return _0x26f4ca;});var _0x1edfbe=_0x541870[_0x18a7('0x3f')][_0x18a7('0x65')]&&_0x541870[_0x18a7('0x3f')][_0x18a7('0x65')]['toLowerCase']()===_0x18a7('0x66')?!![]:![];return _0x40dc30[_0x18a7('0x67')](_0x2a5a9a,_0x1edfbe);})[_0x18a7('0x27')](function(_0x21c9b8){return db[_0x18a7('0x39')]['bulkCreate'](_0x21c9b8,{'transaction':_0x2ba5da});});})['then'](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x541870[_0x18a7('0x50')]['id']},'order':_0x18a7('0x68')});});}})[_0x18a7('0x27')](respondWithResult(_0xc66102,null))['catch'](handleError(_0xc66102,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index d4275d3..0a50a15 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 _0xfa92=['hasOwnProperty','hook','exports','events','setMaxListeners','update','emit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfa92,0x1ca));var _0x2fa9=function(_0x31d772,_0x327fa2){_0x31d772=_0x31d772-0x0;var _0xada0e4=_0xfa92[_0x31d772];return _0xada0e4;};'use strict';var EventEmitter=require(_0x2fa9('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2fa9('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2fa9('0x2'),'afterDestroy':'remove'};function emitEvent(_0x55c4a0){return function(_0x4c278b,_0xf8bcd0,_0x528137){VoiceExtensionEvents[_0x2fa9('0x3')](_0x55c4a0+':'+_0x4c278b['id'],_0x4c278b);VoiceExtensionEvents['emit'](_0x55c4a0,_0x4c278b);_0x528137(null);};}for(var e in events){if(events[_0x2fa9('0x4')](e)){var event=events[e];VoiceExtension[_0x2fa9('0x5')](e,emitEvent(event));}}module[_0x2fa9('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x8421=['VoiceExtension','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x8421,0x15d));var _0x1842=function(_0x3f154d,_0x5c217d){_0x3f154d=_0x3f154d-0x0;var _0x5ada82=_0x8421[_0x3f154d];return _0x5ada82;};'use strict';var EventEmitter=require(_0x1842('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x1842('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1842('0x2')](0x0);var events={'afterCreate':_0x1842('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ba6fa){return function(_0x307675,_0x24fa5e,_0x3f4206){VoiceExtensionEvents['emit'](_0x3ba6fa+':'+_0x307675['id'],_0x307675);VoiceExtensionEvents[_0x1842('0x4')](_0x3ba6fa,_0x307675);_0x3f4206(null);};}for(var e in events){if(events[_0x1842('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x1842('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index fd5c615..5c99e8e 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 _0x5874=['outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','length','name','trunk','param','split','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','IntervalId','interval','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','appdata','priority','last','concat','catch','then','Hangup','lodash','exports','models','Set','CDR(type)=','context','exten','type','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab'];(function(_0x712115,_0x11f026){var _0xa6c12e=function(_0xe360ea){while(--_0xe360ea){_0x712115['push'](_0x712115['shift']());}};_0xa6c12e(++_0x11f026);}(_0x5874,0x1c4));var _0x4587=function(_0xe088c9,_0x29ce0a){_0xe088c9=_0xe088c9-0x0;var _0x278ae6=_0x5874[_0xe088c9];return _0x278ae6;};'use strict';var util=require('util');var _=require(_0x4587('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x4587('0x1')]=function(_0x2365fb){var _0x5681d0=_0x2365fb[_0x4587('0x2')];function _0x1e2603(_0x2f6cb6){var _0x23fed2=0x2;var _0x447da5=[{'type':_0x2f6cb6['type'],'app':_0x4587('0x3'),'appdata':_0x4587('0x4')+_0x2f6cb6['type'],'context':_0x2f6cb6[_0x4587('0x5')],'exten':_0x2f6cb6[_0x4587('0x6')],'priority':_0x23fed2++,'VoiceExtensionId':_0x2f6cb6['id']},{'type':_0x2f6cb6[_0x4587('0x7')],'app':_0x2f6cb6['alias']?_0x4587('0x3'):_0x4587('0x8'),'appdata':_0x2f6cb6[_0x4587('0x9')]?_0x4587('0xa')+_0x2f6cb6[_0x4587('0x9')]:_0x4587('0xb'),'context':_0x2f6cb6['context'],'exten':_0x2f6cb6[_0x4587('0x6')],'priority':_0x23fed2++,'VoiceExtensionId':_0x2f6cb6['id']}];if(_0x2f6cb6[_0x4587('0x7')]===_0x4587('0xc')){_0x447da5[_0x4587('0xd')]({'type':'inbound','app':'Set','appdata':_0x4587('0xe')+_0x2f6cb6['id'],'context':_0x2f6cb6['context'],'exten':_0x2f6cb6['exten'],'priority':_0x23fed2++,'VoiceExtensionId':_0x2f6cb6['id']});}_0x447da5[_0x4587('0xd')]({'type':_0x2f6cb6[_0x4587('0x7')],'app':_0x4587('0x3'),'appdata':_0x4587('0xf'),'context':_0x2f6cb6['context'],'exten':_0x2f6cb6[_0x4587('0x6')],'priority':_0x23fed2++,'VoiceExtensionId':_0x2f6cb6['id']},{'type':_0x2f6cb6['type'],'app':_0x4587('0x3'),'appdata':_0x4587('0x10'),'context':_0x2f6cb6[_0x4587('0x5')],'exten':_0x2f6cb6[_0x4587('0x6')],'priority':_0x23fed2++,'VoiceExtensionId':_0x2f6cb6['id']},{'type':_0x2f6cb6[_0x4587('0x7')],'app':_0x4587('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2f6cb6[_0x4587('0x5')],'exten':_0x2f6cb6[_0x4587('0x6')],'priority':_0x23fed2++,'VoiceExtensionId':_0x2f6cb6['id']});return _0x447da5;}function _0x21f604(_0x2162b5){var _0xde595c=0x2;var _0x3dc400=[{'type':_0x4587('0x11'),'app':_0x4587('0x3'),'appdata':_0x4587('0x12'),'context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5['exten'],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':_0x4587('0x11'),'app':_0x2162b5[_0x4587('0x9')]?_0x4587('0x3'):_0x4587('0x8'),'appdata':_0x2162b5[_0x4587('0x9')]?'CDR(routeAlias)='+_0x2162b5[_0x4587('0x9')]:'No\x20alias\x20set','context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':_0x4587('0x11'),'app':_0x4587('0x3'),'appdata':_0x4587('0x13')+(_0x2162b5[_0x4587('0x14')]?_0x4587('0x15')+_0x2162b5[_0x4587('0x14')]+'}':_0x4587('0x16')),'context':_0x2162b5['context'],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':_0x4587('0x11'),'app':_0x4587('0x3'),'appdata':_0x4587('0xe')+_0x2162b5['id'],'context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':_0x4587('0x11'),'app':_0x4587('0x17'),'appdata':_0x4587('0x18')+(_0xde595c+0x2)+'):Goto('+(_0xde595c+0x1)+')','context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':'outbound','app':_0x4587('0x3'),'appdata':_0x2162b5[_0x4587('0x14')]?_0x4587('0x19')+_0x2162b5[_0x4587('0x14')]+'}':_0x4587('0x1a'),'context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5['exten'],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':'outbound','app':_0x4587('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':_0x4587('0x11'),'app':_0x4587('0x3'),'appdata':_0x4587('0x10'),'context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':_0x4587('0x11'),'app':_0x4587('0x3'),'appdata':_0x4587('0x1b'),'context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':_0x4587('0x11'),'app':_0x4587('0x3'),'appdata':_0x4587('0x1c')+_0x2162b5['id'],'context':_0x2162b5['context'],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']}];if(_0x2162b5[_0x4587('0x1d')]('recordingFormat')&&_0x2162b5[_0x4587('0x1e')]!==_0x4587('0x1f')){_0x3dc400[_0x4587('0xd')]({'type':'outbound','app':_0x4587('0x3'),'appdata':_0x4587('0x20'),'context':_0x2162b5['context'],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']},{'type':_0x4587('0x11'),'app':_0x4587('0x3'),'appdata':_0x4587('0x21')+_0x2162b5[_0x4587('0x1e')]||'wav','context':_0x2162b5[_0x4587('0x5')],'exten':_0x2162b5[_0x4587('0x6')],'priority':_0xde595c++,'VoiceExtensionId':_0x2162b5['id']});}return _0x3dc400;}function _0x3bf799(_0x1462ea){var _0x1ec658=[{'name':'trunk','param':0x0},{'name':_0x4587('0x22'),'param':0x1},{'name':_0x4587('0x23'),'param':0x2},{'name':_0x4587('0x24'),'param':0x3}];var _0x5072ae={};var _0x6a0652=_0x1462ea['split'](',');var _0x384d2e=[];for(var _0x29e88a=0x0;_0x29e88a<_0x1ec658[_0x4587('0x25')];_0x29e88a++){switch(_0x1ec658[_0x29e88a][_0x4587('0x26')]){case _0x4587('0x27'):_0x5072ae['trunk']=_0x6a0652[_0x1ec658[_0x29e88a][_0x4587('0x28')]]['split']('/')[0x1];_0x5072ae['phone']=_0x6a0652[_0x1ec658[_0x29e88a][_0x4587('0x28')]][_0x4587('0x29')]('/')[0x2];_0x5072ae['prefix']=_0x5072ae[_0x4587('0x2a')]?_0x5072ae[_0x4587('0x2a')]['split']('$')[0x0]:undefined;_0x5072ae[_0x4587('0x2a')]=route[_0x4587('0x14')]?(_0x5072ae[_0x4587('0x2b')]||'')+_0x4587('0x15')+route[_0x4587('0x14')]+'}':(_0x5072ae['prefix']||'')+_0x4587('0x16');_0x384d2e[_0x1ec658[_0x29e88a][_0x4587('0x28')]]=[_0x4587('0x2c'),_0x5072ae[_0x4587('0x27')],_0x5072ae[_0x4587('0x2a')]][_0x4587('0x2d')]('/');break;case _0x4587('0x23'):_0x5072ae['options']=_0x6a0652[_0x1ec658[_0x29e88a][_0x4587('0x28')]];if(route[_0x4587('0x1e')]!==_0x4587('0x1f')){if(_0x5072ae['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x5072ae[_0x4587('0x23')]+=_0x4587('0x2e');}}else{_0x5072ae[_0x4587('0x23')]=_0x5072ae['options'][_0x4587('0x2f')](_0x4587('0x2e'),'');}_0x384d2e[_0x1ec658[_0x29e88a][_0x4587('0x28')]]=_0x5072ae[_0x4587('0x23')];break;default:_0x384d2e[_0x1ec658[_0x29e88a][_0x4587('0x28')]]=_0x6a0652[_0x1ec658[_0x29e88a][_0x4587('0x28')]];}}return _0x384d2e['join'](',');}function _0x1aaf2a(_0x2edfea,_0x21b885,_0x1fb3c8,_0x2d52c6){return new Promise(function(_0x24a329,_0x2bcffc){var _0xb97422=[];if(_[_0x4587('0x30')](_0x21b885))return _0x24a329(_0xb97422);_0x5681d0['Interval'][_0x4587('0x31')]({'attributes':['id','interval',_0x4587('0x32')],'raw':!![]})['then'](function(_0x5bef84){for(var _0x218b76=0x0,_0x279d31=0x0;_0x218b76<_0x21b885[_0x4587('0x25')];_0x218b76++,_0x279d31=0x0){var _0x9f46c8=_0x21b885[_0x218b76];var _0x25091b=[];var _0x503301=[];if(_0x9f46c8[_0x4587('0x33')]!=='*,*,*,*'){_0x9f46c8[_0x4587('0x34')]=[_0x9f46c8['interval']];}else{_0x9f46c8['intervals']=_0x9f46c8[_0x4587('0x32')]?_[_0x4587('0x35')](_[_0x4587('0x36')](_0x5bef84,{'IntervalId':_0x9f46c8[_0x4587('0x32')]}),_0x4587('0x33')):[];}_0x9f46c8[_0x4587('0x5')]=_0x2edfea['context'];_0x9f46c8['exten']=_0x2edfea[_0x4587('0x6')];if(_0x9f46c8['type'])_0x9f46c8[_0x4587('0x7')]=_0x9f46c8[_0x4587('0x7')]['toLowerCase']();if(_0x2edfea['type']==='outbound'){if(_0x9f46c8[_0x4587('0x1d')](_0x4587('0x37'))&&_0x9f46c8[_0x4587('0x37')]&&_0x9f46c8[_0x4587('0x37')]!=='--'){_0x25091b[_0x4587('0xd')]({'type':_0x9f46c8['type'][_0x4587('0x38')](),'app':_0x4587('0x3'),'appdata':_0x4587('0x39')+_0x9f46c8[_0x4587('0x37')],'context':_0x2edfea[_0x4587('0x5')],'exten':_0x2edfea[_0x4587('0x6')],'priority':_0x9f46c8[_0x4587('0x34')][_0x4587('0x25')]+_0x1fb3c8+_0x279d31++,'VoiceExtensionId':_0x2edfea['id']});}_0x25091b[_0x4587('0xd')]({'type':_0x9f46c8['type']['toLowerCase'](),'app':_0x4587('0x17'),'appdata':_0x4587('0x3a')+(_0x9f46c8[_0x4587('0x3b')]?_0x4587('0x3c')+_0x9f46c8['callerID']+')':_0x4587('0x3d')),'context':_0x2edfea[_0x4587('0x5')],'exten':_0x2edfea[_0x4587('0x6')],'priority':_0x9f46c8[_0x4587('0x34')][_0x4587('0x25')]+_0x1fb3c8+_0x279d31++,'VoiceExtensionId':_0x2edfea['id']});}else{if(_0x9f46c8[_0x4587('0x1d')]('answer')){if([_0x4587('0x3e'),_0x4587('0x3f')][_0x4587('0x40')](_0x9f46c8[_0x4587('0x41')][_0x4587('0x38')]())&&_0x9f46c8['appType']!==_0x4587('0x42')){if(_0x9f46c8['answer']){_0x25091b[_0x4587('0xd')]({'type':_0x9f46c8[_0x4587('0x7')][_0x4587('0x38')](),'app':_0x4587('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2edfea['context'],'exten':_0x2edfea[_0x4587('0x6')],'priority':_0x9f46c8[_0x4587('0x34')]['length']+_0x1fb3c8+_0x279d31++,'VoiceExtensionId':_0x2edfea['id']});_0x25091b[_0x4587('0xd')]({'type':_0x9f46c8[_0x4587('0x7')][_0x4587('0x38')](),'app':_0x4587('0x3'),'appdata':_0x4587('0x43'),'context':_0x2edfea['context'],'exten':_0x2edfea[_0x4587('0x6')],'priority':_0x9f46c8[_0x4587('0x34')]['length']+_0x1fb3c8+_0x279d31++,'VoiceExtensionId':_0x2edfea['id']});}else{_0x25091b[_0x4587('0xd')]({'type':_0x9f46c8[_0x4587('0x7')][_0x4587('0x38')](),'app':'ExecIf','appdata':_0x4587('0x44'),'context':_0x2edfea['context'],'exten':_0x2edfea['exten'],'priority':_0x9f46c8[_0x4587('0x34')][_0x4587('0x25')]+_0x1fb3c8+_0x279d31++,'VoiceExtensionId':_0x2edfea['id']});_0x25091b[_0x4587('0xd')]({'type':_0x9f46c8['type']['toLowerCase'](),'app':_0x4587('0x3'),'appdata':_0x4587('0x45'),'context':_0x2edfea['context'],'exten':_0x2edfea[_0x4587('0x6')],'priority':_0x9f46c8[_0x4587('0x34')]['length']+_0x1fb3c8+_0x279d31++,'VoiceExtensionId':_0x2edfea['id']});}}}}for(var _0x4fcd5e=0x0;_0x4fcd5e<_0x9f46c8[_0x4587('0x34')]['length'];_0x4fcd5e++){var _0x271c33=_0x1fb3c8+_0x9f46c8[_0x4587('0x34')][_0x4587('0x25')];var _0x33f357=_0x4fcd5e===_0x9f46c8[_0x4587('0x34')][_0x4587('0x25')]-0x1?_0x1fb3c8+_0x25091b[_0x4587('0x25')]+_0x503301[_0x4587('0x25')]+0x2:_0x1fb3c8+_0x4fcd5e+0x1;_0x25091b['splice'](_0x4fcd5e,0x0,{'type':_0x2edfea[_0x4587('0x7')],'app':_0x4587('0x46'),'appdata':_0x9f46c8[_0x4587('0x34')][_0x4fcd5e]+'?'+_0x2edfea[_0x4587('0x5')]+_0x4587('0x47')+_0x271c33+':'+_0x2edfea[_0x4587('0x5')]+_0x4587('0x47')+_0x33f357,'exten':_0x2edfea[_0x4587('0x6')],'context':_0x2edfea[_0x4587('0x5')],'priority':_0x1fb3c8+_0x4fcd5e,'VoiceExtensionId':_0x2edfea['id']});}if(_0x2d52c6&&_0x9f46c8[_0x4587('0x48')]==='outboundDial')_0x9f46c8[_0x4587('0x49')]=_0x3bf799(_0x9f46c8[_0x4587('0x49')]);_0x9f46c8[_0x4587('0x4a')]=_0x25091b[_0x4587('0x25')]?_[_0x4587('0x4b')](_0x25091b)[_0x4587('0x4a')]+0x1:_0x1fb3c8;_0xb97422=_[_0x4587('0x4c')](_0xb97422,_0x25091b,[_0x9f46c8],_0x503301);_0x1fb3c8=_['last'](_0xb97422)['priority']+0x1;}return _0x24a329(_0xb97422);})[_0x4587('0x4d')](function(_0x5c7a05){_0x2bcffc(_0x5c7a05);});});}return _0x2365fb['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5cf327,_0x4765fe){var _0x4a27a8=this;var _0x160a97=_0x4a27a8[_0x4587('0x7')]===_0x4587('0x11')?_0x21f604(_0x4a27a8):_0x1e2603(_0x4a27a8);return _0x1aaf2a(_0x4a27a8,_0x5cf327,_[_0x4587('0x4b')](_0x160a97)[_0x4587('0x4a')]+0x1,_0x4765fe)[_0x4587('0x4e')](function(_0xb80f22){var _0x3a78dd=_[_0x4587('0x4c')](_0x160a97,_0xb80f22);_0x3a78dd[_0x4587('0xd')]({'type':_0x4a27a8[_0x4587('0x7')],'app':_0x4587('0x4f'),'exten':_0x4a27a8[_0x4587('0x6')],'context':_0x4a27a8[_0x4587('0x5')],'priority':_['last'](_0x3a78dd)[_0x4587('0x4a')]+0x1,'VoiceExtensionId':_0x4a27a8['id']});return _0x3a78dd;});}}});}; \ No newline at end of file +var _0xc037=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','length','name','trunk','param','split','phone','prefix','cutdigits','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','playback','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','priority','last','define','VoiceExtension','voice_extensions','Hangup','lodash','exports','type','Set','context','exten','NoOp','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','${EXTEN:','ExecIf'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xc037,0x119));var _0x7c03=function(_0x5a5b20,_0x7a830c){_0x5a5b20=_0x5a5b20-0x0;var _0x8cf293=_0xc037[_0x5a5b20];return _0x8cf293;};'use strict';var util=require('util');var _=require(_0x7c03('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x7c03('0x1')]=function(_0x10c17c){var _0x44d89a=_0x10c17c['models'];function _0x2884ad(_0xcbd521){var _0x45309a=0x2;var _0x567e1c=[{'type':_0xcbd521[_0x7c03('0x2')],'app':_0x7c03('0x3'),'appdata':'CDR(type)='+_0xcbd521[_0x7c03('0x2')],'context':_0xcbd521[_0x7c03('0x4')],'exten':_0xcbd521[_0x7c03('0x5')],'priority':_0x45309a++,'VoiceExtensionId':_0xcbd521['id']},{'type':_0xcbd521['type'],'app':_0xcbd521['alias']?_0x7c03('0x3'):_0x7c03('0x6'),'appdata':_0xcbd521[_0x7c03('0x7')]?'CDR(routeAlias)='+_0xcbd521[_0x7c03('0x7')]:_0x7c03('0x8'),'context':_0xcbd521[_0x7c03('0x4')],'exten':_0xcbd521[_0x7c03('0x5')],'priority':_0x45309a++,'VoiceExtensionId':_0xcbd521['id']}];if(_0xcbd521[_0x7c03('0x2')]===_0x7c03('0x9')){_0x567e1c[_0x7c03('0xa')]({'type':_0x7c03('0x9'),'app':'Set','appdata':_0x7c03('0xb')+_0xcbd521['id'],'context':_0xcbd521[_0x7c03('0x4')],'exten':_0xcbd521['exten'],'priority':_0x45309a++,'VoiceExtensionId':_0xcbd521['id']});}_0x567e1c[_0x7c03('0xa')]({'type':_0xcbd521[_0x7c03('0x2')],'app':_0x7c03('0x3'),'appdata':_0x7c03('0xc'),'context':_0xcbd521[_0x7c03('0x4')],'exten':_0xcbd521[_0x7c03('0x5')],'priority':_0x45309a++,'VoiceExtensionId':_0xcbd521['id']},{'type':_0xcbd521['type'],'app':_0x7c03('0x3'),'appdata':_0x7c03('0xd'),'context':_0xcbd521[_0x7c03('0x4')],'exten':_0xcbd521[_0x7c03('0x5')],'priority':_0x45309a++,'VoiceExtensionId':_0xcbd521['id']},{'type':_0xcbd521[_0x7c03('0x2')],'app':_0x7c03('0x3'),'appdata':_0x7c03('0xe'),'context':_0xcbd521[_0x7c03('0x4')],'exten':_0xcbd521[_0x7c03('0x5')],'priority':_0x45309a++,'VoiceExtensionId':_0xcbd521['id']});return _0x567e1c;}function _0x17f359(_0x8d93d){var _0x5404ff=0x2;var _0xf8222a=[{'type':'outbound','app':_0x7c03('0x3'),'appdata':_0x7c03('0xf'),'context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':_0x8d93d[_0x7c03('0x7')]?'Set':_0x7c03('0x6'),'appdata':_0x8d93d[_0x7c03('0x7')]?'CDR(routeAlias)='+_0x8d93d[_0x7c03('0x7')]:_0x7c03('0x8'),'context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':'Set','appdata':'CDR(destination)='+(_0x8d93d['cutdigits']?_0x7c03('0x11')+_0x8d93d['cutdigits']+'}':'${EXTEN}'),'context':_0x8d93d['context'],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':_0x7c03('0x3'),'appdata':_0x7c03('0xb')+_0x8d93d['id'],'context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':_0x7c03('0x12'),'appdata':_0x7c03('0x13')+(_0x5404ff+0x2)+_0x7c03('0x14')+(_0x5404ff+0x1)+')','context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':'Set','appdata':_0x8d93d['cutdigits']?_0x7c03('0x15')+_0x8d93d['cutdigits']+'}':_0x7c03('0x16'),'context':_0x8d93d['context'],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':_0x7c03('0x3'),'appdata':_0x7c03('0xc'),'context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':_0x7c03('0x3'),'appdata':_0x7c03('0xd'),'context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':_0x7c03('0x3'),'appdata':_0x7c03('0xe'),'context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':'outbound','app':'Set','appdata':_0x7c03('0x17')+_0x8d93d['id'],'context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d['exten'],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']}];if(_0x8d93d[_0x7c03('0x18')](_0x7c03('0x19'))&&_0x8d93d[_0x7c03('0x19')]!=='none'){_0xf8222a[_0x7c03('0xa')]({'type':_0x7c03('0x10'),'app':_0x7c03('0x3'),'appdata':_0x7c03('0x1a'),'context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']},{'type':_0x7c03('0x10'),'app':_0x7c03('0x3'),'appdata':_0x7c03('0x1b')+_0x8d93d['recordingFormat']||'wav','context':_0x8d93d[_0x7c03('0x4')],'exten':_0x8d93d[_0x7c03('0x5')],'priority':_0x5404ff++,'VoiceExtensionId':_0x8d93d['id']});}return _0xf8222a;}function _0x47f4f2(_0xb50fd){var _0x4c709e=[{'name':'trunk','param':0x0},{'name':_0x7c03('0x1c'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x2eb4fc={};var _0x251a5f=_0xb50fd['split'](',');var _0x157d26=[];for(var _0x2fa25e=0x0;_0x2fa25e<_0x4c709e[_0x7c03('0x1d')];_0x2fa25e++){switch(_0x4c709e[_0x2fa25e][_0x7c03('0x1e')]){case _0x7c03('0x1f'):_0x2eb4fc[_0x7c03('0x1f')]=_0x251a5f[_0x4c709e[_0x2fa25e][_0x7c03('0x20')]][_0x7c03('0x21')]('/')[0x1];_0x2eb4fc[_0x7c03('0x22')]=_0x251a5f[_0x4c709e[_0x2fa25e][_0x7c03('0x20')]][_0x7c03('0x21')]('/')[0x2];_0x2eb4fc[_0x7c03('0x23')]=_0x2eb4fc[_0x7c03('0x22')]?_0x2eb4fc[_0x7c03('0x22')][_0x7c03('0x21')]('$')[0x0]:undefined;_0x2eb4fc[_0x7c03('0x22')]=route[_0x7c03('0x24')]?(_0x2eb4fc[_0x7c03('0x23')]||'')+_0x7c03('0x11')+route[_0x7c03('0x24')]+'}':(_0x2eb4fc[_0x7c03('0x23')]||'')+'${EXTEN}';_0x157d26[_0x4c709e[_0x2fa25e][_0x7c03('0x20')]]=[_0x7c03('0x25'),_0x2eb4fc[_0x7c03('0x1f')],_0x2eb4fc[_0x7c03('0x22')]][_0x7c03('0x26')]('/');break;case _0x7c03('0x27'):_0x2eb4fc[_0x7c03('0x27')]=_0x251a5f[_0x4c709e[_0x2fa25e][_0x7c03('0x20')]];if(route['recordingFormat']!==_0x7c03('0x28')){if(_0x2eb4fc[_0x7c03('0x27')][_0x7c03('0x29')](_0x7c03('0x2a'))<0x0){_0x2eb4fc[_0x7c03('0x27')]+=_0x7c03('0x2a');}}else{_0x2eb4fc['options']=_0x2eb4fc[_0x7c03('0x27')]['replace'](_0x7c03('0x2a'),'');}_0x157d26[_0x4c709e[_0x2fa25e][_0x7c03('0x20')]]=_0x2eb4fc[_0x7c03('0x27')];break;default:_0x157d26[_0x4c709e[_0x2fa25e][_0x7c03('0x20')]]=_0x251a5f[_0x4c709e[_0x2fa25e][_0x7c03('0x20')]];}}return _0x157d26[_0x7c03('0x26')](',');}function _0x223189(_0x1039bc,_0x5dc5e7,_0x48cff6,_0x45199c){return new Promise(function(_0x2909bc,_0x3414f1){var _0x2b8f4e=[];if(_[_0x7c03('0x2b')](_0x5dc5e7))return _0x2909bc(_0x2b8f4e);_0x44d89a[_0x7c03('0x2c')]['findAll']({'attributes':['id',_0x7c03('0x2d'),_0x7c03('0x2e')],'raw':!![]})[_0x7c03('0x2f')](function(_0x3e4288){for(var _0x2f5a31=0x0,_0x25da6d=0x0;_0x2f5a31<_0x5dc5e7[_0x7c03('0x1d')];_0x2f5a31++,_0x25da6d=0x0){var _0x273722=_0x5dc5e7[_0x2f5a31];var _0x421eda=[];var _0x44f6df=[];if(_0x273722['interval']!==_0x7c03('0x30')){_0x273722[_0x7c03('0x31')]=[_0x273722['interval']];}else{_0x273722[_0x7c03('0x31')]=_0x273722[_0x7c03('0x2e')]?_[_0x7c03('0x32')](_[_0x7c03('0x33')](_0x3e4288,{'IntervalId':_0x273722[_0x7c03('0x2e')]}),'interval'):[];}_0x273722[_0x7c03('0x4')]=_0x1039bc['context'];_0x273722[_0x7c03('0x5')]=_0x1039bc['exten'];if(_0x273722[_0x7c03('0x2')])_0x273722[_0x7c03('0x2')]=_0x273722[_0x7c03('0x2')][_0x7c03('0x34')]();if(_0x1039bc[_0x7c03('0x2')]==='outbound'){if(_0x273722['hasOwnProperty'](_0x7c03('0x35'))&&_0x273722[_0x7c03('0x35')]&&_0x273722[_0x7c03('0x35')]!=='--'){_0x421eda[_0x7c03('0xa')]({'type':_0x273722[_0x7c03('0x2')][_0x7c03('0x34')](),'app':_0x7c03('0x3'),'appdata':_0x7c03('0x36')+_0x273722[_0x7c03('0x35')],'context':_0x1039bc[_0x7c03('0x4')],'exten':_0x1039bc[_0x7c03('0x5')],'priority':_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')]+_0x48cff6+_0x25da6d++,'VoiceExtensionId':_0x1039bc['id']});}_0x421eda[_0x7c03('0xa')]({'type':_0x273722[_0x7c03('0x2')][_0x7c03('0x34')](),'app':'ExecIf','appdata':_0x7c03('0x37')+(_0x273722[_0x7c03('0x38')]?'Set(CALLERID(all)='+_0x273722[_0x7c03('0x38')]+')':'NoOp(No\x20number\x20available)'),'context':_0x1039bc[_0x7c03('0x4')],'exten':_0x1039bc['exten'],'priority':_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')]+_0x48cff6+_0x25da6d++,'VoiceExtensionId':_0x1039bc['id']});}else{if(_0x273722[_0x7c03('0x18')](_0x7c03('0x39'))){if(['queue',_0x7c03('0x3a')]['includes'](_0x273722[_0x7c03('0x3b')][_0x7c03('0x34')]())&&_0x273722['appType']!==_0x7c03('0x3c')){if(_0x273722[_0x7c03('0x39')]){_0x421eda[_0x7c03('0xa')]({'type':_0x273722['type'][_0x7c03('0x34')](),'app':_0x7c03('0x12'),'appdata':_0x7c03('0x3d'),'context':_0x1039bc[_0x7c03('0x4')],'exten':_0x1039bc[_0x7c03('0x5')],'priority':_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')]+_0x48cff6+_0x25da6d++,'VoiceExtensionId':_0x1039bc['id']});_0x421eda[_0x7c03('0xa')]({'type':_0x273722[_0x7c03('0x2')][_0x7c03('0x34')](),'app':_0x7c03('0x3'),'appdata':_0x7c03('0x3e'),'context':_0x1039bc[_0x7c03('0x4')],'exten':_0x1039bc[_0x7c03('0x5')],'priority':_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')]+_0x48cff6+_0x25da6d++,'VoiceExtensionId':_0x1039bc['id']});}else{_0x421eda[_0x7c03('0xa')]({'type':_0x273722[_0x7c03('0x2')][_0x7c03('0x34')](),'app':_0x7c03('0x12'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1039bc[_0x7c03('0x4')],'exten':_0x1039bc[_0x7c03('0x5')],'priority':_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')]+_0x48cff6+_0x25da6d++,'VoiceExtensionId':_0x1039bc['id']});_0x421eda[_0x7c03('0xa')]({'type':_0x273722[_0x7c03('0x2')][_0x7c03('0x34')](),'app':_0x7c03('0x3'),'appdata':_0x7c03('0x3f'),'context':_0x1039bc[_0x7c03('0x4')],'exten':_0x1039bc[_0x7c03('0x5')],'priority':_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')]+_0x48cff6+_0x25da6d++,'VoiceExtensionId':_0x1039bc['id']});}}}}for(var _0x4f9b4e=0x0;_0x4f9b4e<_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')];_0x4f9b4e++){var _0x3efd9f=_0x48cff6+_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')];var _0xf4c2d3=_0x4f9b4e===_0x273722[_0x7c03('0x31')][_0x7c03('0x1d')]-0x1?_0x48cff6+_0x421eda[_0x7c03('0x1d')]+_0x44f6df[_0x7c03('0x1d')]+0x2:_0x48cff6+_0x4f9b4e+0x1;_0x421eda[_0x7c03('0x40')](_0x4f9b4e,0x0,{'type':_0x1039bc[_0x7c03('0x2')],'app':'GotoIfTime','appdata':_0x273722[_0x7c03('0x31')][_0x4f9b4e]+'?'+_0x1039bc[_0x7c03('0x4')]+_0x7c03('0x41')+_0x3efd9f+':'+_0x1039bc[_0x7c03('0x4')]+_0x7c03('0x41')+_0xf4c2d3,'exten':_0x1039bc[_0x7c03('0x5')],'context':_0x1039bc[_0x7c03('0x4')],'priority':_0x48cff6+_0x4f9b4e,'VoiceExtensionId':_0x1039bc['id']});}if(_0x45199c&&_0x273722[_0x7c03('0x42')]===_0x7c03('0x43'))_0x273722[_0x7c03('0x44')]=_0x47f4f2(_0x273722[_0x7c03('0x44')]);_0x273722[_0x7c03('0x45')]=_0x421eda['length']?_[_0x7c03('0x46')](_0x421eda)['priority']+0x1:_0x48cff6;_0x2b8f4e=_['concat'](_0x2b8f4e,_0x421eda,[_0x273722],_0x44f6df);_0x48cff6=_['last'](_0x2b8f4e)[_0x7c03('0x45')]+0x1;}return _0x2909bc(_0x2b8f4e);})['catch'](function(_0x660be6){_0x3414f1(_0x660be6);});});}return _0x10c17c[_0x7c03('0x47')](_0x7c03('0x48'),attributes,{'tableName':_0x7c03('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xf9612c,_0xa1a354){var _0x4f662a=this;var _0x2c0a7d=_0x4f662a[_0x7c03('0x2')]===_0x7c03('0x10')?_0x17f359(_0x4f662a):_0x2884ad(_0x4f662a);return _0x223189(_0x4f662a,_0xf9612c,_['last'](_0x2c0a7d)['priority']+0x1,_0xa1a354)[_0x7c03('0x2f')](function(_0x2fa441){var _0x376ddd=_['concat'](_0x2c0a7d,_0x2fa441);_0x376ddd[_0x7c03('0xa')]({'type':_0x4f662a['type'],'app':_0x7c03('0x4a'),'exten':_0x4f662a[_0x7c03('0x5')],'context':_0x4f662a[_0x7c03('0x4')],'priority':_['last'](_0x376ddd)[_0x7c03('0x45')]+0x1,'VoiceExtensionId':_0x4f662a['id']});return _0x376ddd;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 11ec0d2..3d3b25b 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 _0x1203=['localhost','socket.io-emitter','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceExtension','options','where','attributes','limit','map','model','include','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3a9815,_0x47eb16){var _0x188653=function(_0x203e84){while(--_0x203e84){_0x3a9815['push'](_0x3a9815['shift']());}};_0x188653(++_0x47eb16);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3120('0x0'));var util=require(_0x3120('0x1'));var moment=require(_0x3120('0x2'));var BPromise=require(_0x3120('0x3'));var rs=require(_0x3120('0x4'));var fs=require('fs');var Redis=require(_0x3120('0x5'));var db=require(_0x3120('0x6'))['db'];var utils=require(_0x3120('0x7'));var logger=require(_0x3120('0x8'))(_0x3120('0x9'));var config=require(_0x3120('0xa'));var jayson=require(_0x3120('0xb'));var client=jayson[_0x3120('0xc')][_0x3120('0xd')]({'port':0x232a});config[_0x3120('0xe')]=_[_0x3120('0xf')](config['redis'],{'host':_0x3120('0x10'),'port':0x18eb});var socket=require(_0x3120('0x11'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x6ee01b,_0x39f834,_0x5b2ae3){return new BPromise(function(_0x1493fd,_0x5d0ba8){return client[_0x3120('0x12')](_0x6ee01b,_0x5b2ae3)[_0x3120('0x13')](function(_0x492cda){logger[_0x3120('0x14')](_0x3120('0x15'),_0x39f834,'request\x20sent');logger['debug'](_0x3120('0x16'),_0x39f834,_0x3120('0x17'),JSON[_0x3120('0x18')](_0x492cda));if(_0x492cda[_0x3120('0x19')]){if(_0x492cda[_0x3120('0x19')][_0x3120('0x1a')]===0x1f4){logger[_0x3120('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x39f834,_0x492cda[_0x3120('0x19')][_0x3120('0x1b')]);return _0x5d0ba8(_0x492cda[_0x3120('0x19')][_0x3120('0x1b')]);}logger[_0x3120('0x19')](_0x3120('0x15'),_0x39f834,_0x492cda[_0x3120('0x19')]['message']);return _0x1493fd(_0x492cda[_0x3120('0x19')]['message']);}else{logger[_0x3120('0x14')](_0x3120('0x15'),_0x39f834,_0x3120('0x17'));_0x1493fd(_0x492cda[_0x3120('0x1c')][_0x3120('0x1b')]);}})[_0x3120('0x1d')](function(_0x50429){logger['error'](_0x3120('0x15'),_0x39f834,_0x50429);_0x5d0ba8(_0x50429);});});}exports['GetVoiceExtension']=function(_0x3b7e31){var _0x41d73f=this;return new Promise(function(_0x3bc524,_0x5bfd37){return db[_0x3120('0x1e')]['findAll']({'raw':_0x3b7e31[_0x3120('0x1f')]?_0x3b7e31[_0x3120('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3b7e31[_0x3120('0x1f')]?_0x3b7e31[_0x3120('0x1f')][_0x3120('0x20')]||null:null,'attributes':_0x3b7e31[_0x3120('0x1f')]?_0x3b7e31['options'][_0x3120('0x21')]||null:null,'limit':_0x3b7e31['options']?_0x3b7e31[_0x3120('0x1f')][_0x3120('0x22')]||null:null,'include':_0x3b7e31[_0x3120('0x1f')]?_0x3b7e31['options']['include']?_[_0x3120('0x23')](_0x3b7e31[_0x3120('0x1f')]['include'],function(_0xc88506){return{'model':db[_0xc88506[_0x3120('0x24')]],'as':_0xc88506['as'],'attributes':_0xc88506[_0x3120('0x21')],'include':_0xc88506['include']?_[_0x3120('0x23')](_0xc88506[_0x3120('0x25')],function(_0x4412f9){return{'model':db[_0x4412f9[_0x3120('0x24')]],'as':_0x4412f9['as'],'attributes':_0x4412f9['attributes'],'include':_0x4412f9['include']?_['map'](_0x4412f9[_0x3120('0x25')],function(_0x5444ec){return{'model':db[_0x5444ec[_0x3120('0x24')]],'as':_0x5444ec['as'],'attributes':_0x5444ec[_0x3120('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3120('0x13')](function(_0x3399fd){logger[_0x3120('0x14')](_0x3120('0x26'),_0x3b7e31);logger['debug'](_0x3120('0x26'),_0x3b7e31,JSON[_0x3120('0x18')](_0x3399fd));_0x3bc524(_0x3399fd);})[_0x3120('0x1d')](function(_0x1ee7bc){logger[_0x3120('0x19')](_0x3120('0x26'),_0x1ee7bc[_0x3120('0x1b')],_0x3b7e31);_0x5bfd37(_0x41d73f[_0x3120('0x19')](0x1f4,_0x1ee7bc['message']));});});}; \ No newline at end of file +var _0x7c09=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','map','model','include','util'];(function(_0x1d6072,_0x456be4){var _0x4c1d0e=function(_0x1b167a){while(--_0x1b167a){_0x1d6072['push'](_0x1d6072['shift']());}};_0x4c1d0e(++_0x456be4);}(_0x7c09,0x102));var _0x97c0=function(_0x21c4a9,_0x5a62af){_0x21c4a9=_0x21c4a9-0x0;var _0x53187a=_0x7c09[_0x21c4a9];return _0x53187a;};'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});config[_0x97c0('0x9')]=_[_0x97c0('0xa')](config[_0x97c0('0x9')],{'host':_0x97c0('0xb'),'port':0x18eb});var socket=require(_0x97c0('0xc'))(new Redis(config['redis']));require(_0x97c0('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d5507,_0x28cac4,_0x52bce2){return new BPromise(function(_0x50412f,_0x3ba42b){return client[_0x97c0('0xe')](_0x2d5507,_0x52bce2)[_0x97c0('0xf')](function(_0x238ed9){logger[_0x97c0('0x10')](_0x97c0('0x11'),_0x28cac4,_0x97c0('0x12'));logger[_0x97c0('0x13')](_0x97c0('0x14'),_0x28cac4,_0x97c0('0x12'),JSON[_0x97c0('0x15')](_0x238ed9));if(_0x238ed9[_0x97c0('0x16')]){if(_0x238ed9[_0x97c0('0x16')]['code']===0x1f4){logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x238ed9[_0x97c0('0x16')]['message']);return _0x3ba42b(_0x238ed9[_0x97c0('0x16')][_0x97c0('0x17')]);}logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x238ed9[_0x97c0('0x16')][_0x97c0('0x17')]);return _0x50412f(_0x238ed9['error'][_0x97c0('0x17')]);}else{logger[_0x97c0('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x28cac4,_0x97c0('0x12'));_0x50412f(_0x238ed9[_0x97c0('0x18')][_0x97c0('0x17')]);}})[_0x97c0('0x19')](function(_0x183e2e){logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x183e2e);_0x3ba42b(_0x183e2e);});});}exports[_0x97c0('0x1a')]=function(_0x432705){var _0x323863=this;return new Promise(function(_0x4ca20a,_0x554122){return db[_0x97c0('0x1b')][_0x97c0('0x1c')]({'raw':_0x432705[_0x97c0('0x1d')]?_0x432705['options'][_0x97c0('0x1e')]===undefined?!![]:![]:!![],'where':_0x432705[_0x97c0('0x1d')]?_0x432705[_0x97c0('0x1d')][_0x97c0('0x1f')]||null:null,'attributes':_0x432705[_0x97c0('0x1d')]?_0x432705[_0x97c0('0x1d')][_0x97c0('0x20')]||null:null,'limit':_0x432705['options']?_0x432705[_0x97c0('0x1d')][_0x97c0('0x21')]||null:null,'include':_0x432705[_0x97c0('0x1d')]?_0x432705[_0x97c0('0x1d')]['include']?_[_0x97c0('0x22')](_0x432705[_0x97c0('0x1d')]['include'],function(_0x2ec9d6){return{'model':db[_0x2ec9d6[_0x97c0('0x23')]],'as':_0x2ec9d6['as'],'attributes':_0x2ec9d6[_0x97c0('0x20')],'include':_0x2ec9d6['include']?_['map'](_0x2ec9d6['include'],function(_0x11b8ad){return{'model':db[_0x11b8ad[_0x97c0('0x23')]],'as':_0x11b8ad['as'],'attributes':_0x11b8ad[_0x97c0('0x20')],'include':_0x11b8ad[_0x97c0('0x24')]?_[_0x97c0('0x22')](_0x11b8ad[_0x97c0('0x24')],function(_0x4a3645){return{'model':db[_0x4a3645[_0x97c0('0x23')]],'as':_0x4a3645['as'],'attributes':_0x4a3645[_0x97c0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x97c0('0xf')](function(_0x4ad645){logger[_0x97c0('0x10')](_0x97c0('0x1a'),_0x432705);logger[_0x97c0('0x13')](_0x97c0('0x1a'),_0x432705,JSON[_0x97c0('0x15')](_0x4ad645));_0x4ca20a(_0x4ad645);})['catch'](function(_0x59abbb){logger[_0x97c0('0x16')](_0x97c0('0x1a'),_0x59abbb[_0x97c0('0x17')],_0x432705);_0x554122(_0x323863['error'](0x1f4,_0x59abbb[_0x97c0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8260cd5..f250dec 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x35a0e2,_0x302ad1){var _0x31ea9a=function(_0x356d7d){while(--_0x356d7d){_0x35a0e2['push'](_0x35a0e2['shift']());}};_0x31ea9a(++_0x302ad1);}(_0xe14b,0x93));var _0xbe14=function(_0x3072fb,_0x17b49f){_0x3072fb=_0x3072fb-0x0;var _0x5d7f80=_0xe14b[_0x3072fb];return _0x5d7f80;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0xe7e5fe,_0x385394){var _0x1ca065=function(_0x32139a){while(--_0x32139a){_0xe7e5fe['push'](_0xe7e5fe['shift']());}};_0x1ca065(++_0x385394);}(_0xf494,0x1c6));var _0x4f49=function(_0x59e7e1,_0x1dd647){_0x59e7e1=_0x59e7e1-0x0;var _0x38e773=_0xf494[_0x59e7e1];return _0x38e773;};'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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index db4d5fa..7062afb 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 _0xa456=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','post','create','put','delete','multer'];(function(_0xeb254a,_0x1c1fc9){var _0x78e431=function(_0x1499d3){while(--_0x1499d3){_0xeb254a['push'](_0xeb254a['shift']());}};_0x78e431(++_0x1c1fc9);}(_0xa456,0x142));var _0x6a45=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xa456[_0x3305de];return _0x3b5a84;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var fs_extra=require(_0x6a45('0x5'));var auth=require(_0x6a45('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6a45('0x7'));var controller=require(_0x6a45('0x8'));router[_0x6a45('0x9')]('/',auth[_0x6a45('0xa')](),controller['index']);router[_0x6a45('0x9')](_0x6a45('0xb'),auth[_0x6a45('0xa')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x9')]('/:id/messages',auth[_0x6a45('0xa')](),controller['getMessages']);router[_0x6a45('0xd')]('/',auth[_0x6a45('0xa')](),controller[_0x6a45('0xe')]);router[_0x6a45('0xf')](_0x6a45('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6a45('0x10')](_0x6a45('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5fdc=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id/messages','getMessages','create','put','/:id','update'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x5fdc,0x127));var _0xc5fd=function(_0x43273e,_0x29c55b){_0x43273e=_0x43273e-0x0;var _0x5d1c07=_0x5fdc[_0x43273e];return _0x5d1c07;};'use strict';var multer=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var path=require(_0xc5fd('0x2'));var timeout=require(_0xc5fd('0x3'));var express=require(_0xc5fd('0x4'));var router=express[_0xc5fd('0x5')]();var fs_extra=require(_0xc5fd('0x6'));var auth=require(_0xc5fd('0x7'));var interaction=require(_0xc5fd('0x8'));var config=require(_0xc5fd('0x9'));var controller=require(_0xc5fd('0xa'));router[_0xc5fd('0xb')]('/',auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xd')]);router[_0xc5fd('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5fd('0xb')](_0xc5fd('0xe'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc5fd('0x10')]);router[_0xc5fd('0x11')](_0xc5fd('0x12'),auth[_0xc5fd('0xc')](),controller[_0xc5fd('0x13')]);router[_0xc5fd('0x14')]('/:id',auth[_0xc5fd('0xc')](),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 2ffac10..68bd2b7 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 _0xe514=['VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','STRING','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xe514,0x1c7));var _0x4e51=function(_0x4cddc7,_0x4aa299){_0x4cddc7=_0x4cddc7-0x0;var _0x5c39e2=_0xe514[_0x4cddc7];return _0x5c39e2;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x4e51('0x0')]},'context':{'type':Sequelize[_0x4e51('0x0')],'defaultValue':'from-voicemail','unique':_0x4e51('0x1')},'mailbox':{'type':Sequelize[_0x4e51('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x4e51('0x0')]},'fullname':{'type':Sequelize[_0x4e51('0x0')]},'email':{'type':Sequelize[_0x4e51('0x0')],'validate':{'isEmail':!![]},'set':function(_0x5de4ad){this['setDataValue']('email',typeof _0x5de4ad===_0x4e51('0x2')&&_0x5de4ad[_0x4e51('0x3')]()?_0x5de4ad['trim']():null);}},'pager':{'type':Sequelize[_0x4e51('0x0')]},'tz':{'type':Sequelize[_0x4e51('0x0')],'defaultValue':_0x4e51('0x4')},'attach':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':_0x4e51('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':_0x4e51('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4e51('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x4e51('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x4e51('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4e51('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4e51('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':_0x4e51('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4e51('0x5')](_0x4e51('0x6'),'no'),'defaultValue':_0x4e51('0x6'),'allowNull':![]},'stamp':{'type':_0x4e51('0x8')},'emailsubject':{'type':Sequelize[_0x4e51('0x0')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x4e51('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x4e51('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4e51('0xa')],'get':function(){return this[_0x4e51('0xb')](_0x4e51('0xc'))+_0x4e51('0xd')+this['getDataValue'](_0x4e51('0xe'));}}}; \ No newline at end of file +var _0xa7b7=['STRING','from-voicemail','setDataValue','email','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','sequelize'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0xa7b7,0xb5));var _0x7a7b=function(_0x301deb,_0x177266){_0x301deb=_0x301deb-0x0;var _0x1e587e=_0xa7b7[_0x301deb];return _0x1e587e;};'use strict';var Sequelize=require(_0x7a7b('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7a7b('0x1')],'defaultValue':_0x7a7b('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x7a7b('0x1')]},'fullname':{'type':Sequelize[_0x7a7b('0x1')]},'email':{'type':Sequelize[_0x7a7b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x188afe){this[_0x7a7b('0x3')](_0x7a7b('0x4'),typeof _0x188afe==='string'&&_0x188afe['trim']()?_0x188afe[_0x7a7b('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x7a7b('0x1')],'defaultValue':_0x7a7b('0x6')},'attach':{'type':Sequelize['ENUM'](_0x7a7b('0x7'),'no'),'defaultValue':_0x7a7b('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':_0x7a7b('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7a7b('0x1')]},'callback':{'type':Sequelize[_0x7a7b('0x1')]},'review':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':_0x7a7b('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7a7b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7a7b('0x8')](_0x7a7b('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x7a7b('0x7'),'allowNull':![]},'stamp':{'type':_0x7a7b('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7a7b('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7a7b('0xb')],'get':function(){return this[_0x7a7b('0xc')](_0x7a7b('0xd'))+'\x20-\x20'+this['getDataValue']('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b2f023c..71fe9c7 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 _0xbee3=['map','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','rawAttributes','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','nolimit','order','mailbox','findAndCountAll','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index'];(function(_0x1f55b4,_0x4e3352){var _0xcb82a6=function(_0x3c1a9d){while(--_0x3c1a9d){_0x1f55b4['push'](_0x1f55b4['shift']());}};_0xcb82a6(++_0x4e3352);}(_0xbee3,0xd5));var _0x3bee=function(_0x1f45e3,_0x121eed){_0x1f45e3=_0x1f45e3-0x0;var _0x503b36=_0xbee3[_0x1f45e3];return _0x503b36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){var _0x45249c=_0x1fed5a[_0x3bee('0x26')]({'plain':!![]});var _0x1e0111='Voicemails';return db['UserProfileResource'][_0x3bee('0x25')]({'where':{'type':_0x1e0111,'resourceId':_0x45249c['id']}})[_0x3bee('0x24')](function(){return _0x1fed5a;});})['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x27')]();});}};}function handleEntityNotFound(_0x2e666a,_0x5b1eec){return function(_0x1984c4){if(!_0x1984c4){_0x2e666a[_0x3bee('0x17')](0x194);}return _0x1984c4;};}function handleError(_0x150766,_0x4f2066){_0x4f2066=_0x4f2066||0x1f4;return function(_0x239fa4){logger[_0x3bee('0x28')](_0x239fa4[_0x3bee('0x29')]);if(_0x239fa4['name']){delete _0x239fa4[_0x3bee('0x2a')];}_0x150766[_0x3bee('0x18')](_0x4f2066)[_0x3bee('0x2b')](_0x239fa4);};}exports[_0x3bee('0x2c')]=function(_0x3433aa,_0x559c2b){var _0x564e45={},_0x3fbc8c={},_0x1e1529={'count':0x0,'rows':[]};var _0x10bae0=_[_0x3bee('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x38f93c){return{'name':_0x38f93c[_0x3bee('0x2e')],'type':_0x38f93c['type']['key']};});_0x3fbc8c[_0x3bee('0x2f')]=_[_0x3bee('0x2d')](_0x10bae0,_0x3bee('0x2a'));_0x3fbc8c[_0x3bee('0x30')]=_[_0x3bee('0x31')](_0x3433aa[_0x3bee('0x30')]);_0x3fbc8c[_0x3bee('0x32')]=_[_0x3bee('0x33')](_0x3fbc8c[_0x3bee('0x2f')],_0x3fbc8c[_0x3bee('0x30')]);_0x564e45['attributes']=_['intersection'](_0x3fbc8c[_0x3bee('0x2f')],qs['fields'](_0x3433aa['query'][_0x3bee('0x34')]));_0x564e45[_0x3bee('0x35')]=_0x564e45[_0x3bee('0x35')][_0x3bee('0x36')]?_0x564e45[_0x3bee('0x35')]:_0x3fbc8c[_0x3bee('0x2f')];if(!_0x3433aa[_0x3bee('0x30')][_0x3bee('0x37')]('nolimit')){_0x564e45[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x3433aa['query'][_0x3bee('0x1d')]);_0x564e45[_0x3bee('0x1a')]=qs[_0x3bee('0x1a')](_0x3433aa[_0x3bee('0x30')][_0x3bee('0x1a')]);}_0x564e45['order']=qs['sort'](_0x3433aa[_0x3bee('0x30')][_0x3bee('0x38')]);_0x564e45[_0x3bee('0x39')]=qs[_0x3bee('0x32')](_[_0x3bee('0x3a')](_0x3433aa[_0x3bee('0x30')],_0x3fbc8c[_0x3bee('0x32')]),_0x10bae0);if(_0x3433aa[_0x3bee('0x30')][_0x3bee('0x3b')]){_0x564e45[_0x3bee('0x39')]=_[_0x3bee('0x3c')](_0x564e45[_0x3bee('0x39')],{'$or':_['map'](_0x10bae0,function(_0xaceed4){if(_0xaceed4[_0x3bee('0x3d')]!==_0x3bee('0x3e')){var _0x45cf81={};_0x45cf81[_0xaceed4[_0x3bee('0x2a')]]={'$like':'%'+_0x3433aa[_0x3bee('0x30')][_0x3bee('0x3b')]+'%'};return _0x45cf81;}})});}_0x564e45=_[_0x3bee('0x3c')]({},_0x564e45,_0x3433aa[_0x3bee('0x3f')]);var _0x12ba6f={'where':_0x564e45[_0x3bee('0x39')]};return db[_0x3bee('0x40')][_0x3bee('0x1c')](_0x12ba6f)['then'](function(_0x2b773d){_0x1e1529[_0x3bee('0x1c')]=_0x2b773d;if(_0x3433aa[_0x3bee('0x30')][_0x3bee('0x41')]){_0x564e45[_0x3bee('0x42')]=[{'all':!![]}];}return db[_0x3bee('0x40')][_0x3bee('0x43')](_0x564e45);})[_0x3bee('0x24')](function(_0x5d9e1b){_0x1e1529[_0x3bee('0x44')]=_0x5d9e1b;return _0x1e1529;})[_0x3bee('0x24')](respondWithFilteredResult(_0x559c2b,_0x564e45))[_0x3bee('0x45')](handleError(_0x559c2b,null));};exports['show']=function(_0x4567f2,_0x57113b){var _0x2b1677={'raw':!![],'where':{'id':_0x4567f2['params']['id']}},_0x48325e={};_0x48325e[_0x3bee('0x2f')]=_[_0x3bee('0x31')](db[_0x3bee('0x40')][_0x3bee('0x46')]);_0x48325e[_0x3bee('0x30')]=_['keys'](_0x4567f2['query']);_0x48325e[_0x3bee('0x32')]=_['intersection'](_0x48325e[_0x3bee('0x2f')],_0x48325e['query']);_0x2b1677[_0x3bee('0x35')]=_['intersection'](_0x48325e[_0x3bee('0x2f')],qs[_0x3bee('0x34')](_0x4567f2[_0x3bee('0x30')][_0x3bee('0x34')]));_0x2b1677['attributes']=_0x2b1677['attributes'][_0x3bee('0x36')]?_0x2b1677['attributes']:_0x48325e['model'];if(_0x4567f2['query'][_0x3bee('0x41')]){_0x2b1677['include']=[{'all':!![]}];}_0x2b1677=_[_0x3bee('0x3c')]({},_0x2b1677,_0x4567f2[_0x3bee('0x3f')]);return db[_0x3bee('0x40')]['find'](_0x2b1677)[_0x3bee('0x24')](handleEntityNotFound(_0x57113b,null))['then'](respondWithResult(_0x57113b,null))[_0x3bee('0x45')](handleError(_0x57113b,null));};exports['create']=function(_0x26ccd7,_0x16b096){return db[_0x3bee('0x40')]['create'](_0x26ccd7[_0x3bee('0x47')],{})[_0x3bee('0x24')](function(_0x477de2){var _0x504382=_0x26ccd7['user'][_0x3bee('0x26')]({'plain':!![]});if(!_0x504382)throw new Error(_0x3bee('0x48'));if(_0x504382[_0x3bee('0x49')]===_0x3bee('0x4a')){var _0x3b5d7a=_0x477de2[_0x3bee('0x26')]({'plain':!![]});var _0x4005a3='Voicemails';return db[_0x3bee('0x4b')][_0x3bee('0x4c')]({'where':{'name':_0x4005a3,'userProfileId':_0x504382['userProfileId']},'raw':!![]})['then'](function(_0x3730c5){if(_0x3730c5&&_0x3730c5['autoAssociation']===0x0){return db[_0x3bee('0x4d')][_0x3bee('0x4e')]({'name':_0x3b5d7a[_0x3bee('0x2a')],'resourceId':_0x3b5d7a['id'],'type':_0x3730c5['name'],'sectionId':_0x3730c5['id']},{})[_0x3bee('0x24')](function(){return _0x477de2;});}else{return _0x477de2;}})[_0x3bee('0x45')](function(_0x127cb8){logger['error'](_0x3bee('0x4f'),_0x127cb8);throw _0x127cb8;});}return _0x477de2;})[_0x3bee('0x24')](respondWithResult(_0x16b096,0xc9))['catch'](handleError(_0x16b096,null));};exports[_0x3bee('0x23')]=function(_0x14940e,_0x53c881){if(_0x14940e[_0x3bee('0x47')]['id']){delete _0x14940e[_0x3bee('0x47')]['id'];}return db[_0x3bee('0x40')][_0x3bee('0x4c')]({'where':{'id':_0x14940e[_0x3bee('0x50')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x53c881,null))[_0x3bee('0x24')](saveUpdates(_0x14940e[_0x3bee('0x47')],null))['then'](respondWithResult(_0x53c881,null))['catch'](handleError(_0x53c881,null));};exports[_0x3bee('0x25')]=function(_0x5e13e8,_0x38b82a){return db[_0x3bee('0x40')][_0x3bee('0x4c')]({'where':{'id':_0x5e13e8['params']['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x38b82a,null))[_0x3bee('0x24')](removeEntity(_0x38b82a,null))[_0x3bee('0x45')](handleError(_0x38b82a,null));};exports['getMessages']=function(_0x19cbb8,_0x52a327,_0x3cb900){return db[_0x3bee('0x40')][_0x3bee('0x51')]({'where':{'id':_0x19cbb8['params']['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x52a327,null))[_0x3bee('0x24')](function(_0x282300){var _0x526551;var _0x5d95a7={},_0xb9f53e={};_0xb9f53e[_0x3bee('0x2f')]=_[_0x3bee('0x31')](db['VoiceMailMessage']['rawAttributes']);_0xb9f53e[_0x3bee('0x30')]=_['keys'](_0x19cbb8['query']);_0xb9f53e[_0x3bee('0x32')]=_[_0x3bee('0x33')](_0xb9f53e[_0x3bee('0x2f')],_0xb9f53e['query']);_0x5d95a7['attributes']=_[_0x3bee('0x33')](_0xb9f53e[_0x3bee('0x2f')],qs['fields'](_0x19cbb8[_0x3bee('0x30')]['fields']));_0x5d95a7[_0x3bee('0x35')]=_0x5d95a7[_0x3bee('0x35')][_0x3bee('0x36')]?_0x5d95a7[_0x3bee('0x35')]:_0xb9f53e[_0x3bee('0x2f')];if(!_0x19cbb8[_0x3bee('0x30')][_0x3bee('0x37')](_0x3bee('0x52'))){_0x5d95a7[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x19cbb8[_0x3bee('0x30')]['limit']);_0x5d95a7['offset']=qs['offset'](_0x19cbb8[_0x3bee('0x30')][_0x3bee('0x1a')]);}_0x5d95a7[_0x3bee('0x53')]=qs[_0x3bee('0x38')](_0x19cbb8['query'][_0x3bee('0x38')]);_0x5d95a7[_0x3bee('0x39')]=qs['filters'](_['pick'](_0x19cbb8[_0x3bee('0x30')],_0xb9f53e[_0x3bee('0x32')]));if(_0x19cbb8[_0x3bee('0x30')]['filter']){_0x5d95a7[_0x3bee('0x39')]=_[_0x3bee('0x3c')](_0x5d95a7[_0x3bee('0x39')],{'$or':_['map'](_0x5d95a7[_0x3bee('0x35')],function(_0x412e0d){var _0x1bfb3a={};_0x1bfb3a[_0x412e0d]={'$like':'%'+_0x19cbb8[_0x3bee('0x30')]['filter']+'%'};return _0x1bfb3a;})});}_0x5d95a7['where']=_[_0x3bee('0x3c')](_0x5d95a7[_0x3bee('0x39')],{'mailboxuser':_0x282300[_0x3bee('0x54')]});_0x5d95a7=_[_0x3bee('0x3c')]({},_0x5d95a7,_0x19cbb8[_0x3bee('0x3f')]);return db['VoiceMailMessage'][_0x3bee('0x55')](_0x5d95a7)['then'](respondWithFilteredResult(_0x52a327,_0x5d95a7));})[_0x3bee('0x45')](handleError(_0x52a327,null));}; \ No newline at end of file +var _0x6b20=['filter','where','merge','VIRTUAL','options','includeAll','include','VoiceMail','findAll','rows','catch','show','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b20,0xd1));var _0x06b2=function(_0x41dd24,_0x116556){_0x41dd24=_0x41dd24-0x0;var _0x196842=_0x6b20[_0x41dd24];return _0x196842;};'use strict';var emlformat=require(_0x06b2('0x0'));var rimraf=require(_0x06b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b2('0x2'));var rp=require('request-promise');var moment=require(_0x06b2('0x3'));var BPromise=require(_0x06b2('0x4'));var Mustache=require(_0x06b2('0x5'));var util=require('util');var path=require(_0x06b2('0x6'));var sox=require(_0x06b2('0x7'));var csv=require(_0x06b2('0x8'));var ejs=require(_0x06b2('0x9'));var fs=require('fs');var fs_extra=require(_0x06b2('0xa'));var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x8'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var licenseUtil=require(_0x06b2('0x15'));var db=require(_0x06b2('0x16'))['db'];function respondWithStatusCode(_0x44a9b4,_0x810a12){_0x810a12=_0x810a12||0xcc;return function(_0x3039c9){if(_0x3039c9){return _0x44a9b4[_0x06b2('0x17')](_0x810a12);}return _0x44a9b4[_0x06b2('0x18')](_0x810a12)[_0x06b2('0x19')]();};}function respondWithResult(_0xa81f11,_0x2822e9){_0x2822e9=_0x2822e9||0xc8;return function(_0x26faee){if(_0x26faee){return _0xa81f11['status'](_0x2822e9)[_0x06b2('0x1a')](_0x26faee);}};}function respondWithFilteredResult(_0xaee98c,_0x47496c){return function(_0x3830e9){if(_0x3830e9){var _0xef0466=typeof _0x47496c[_0x06b2('0x1b')]==='undefined'&&typeof _0x47496c[_0x06b2('0x1c')]===_0x06b2('0x1d');var _0x525945=_0x3830e9[_0x06b2('0x1e')];var _0x594b48=_0xef0466?0x0:_0x47496c['offset'];var _0x192270=_0xef0466?_0x3830e9[_0x06b2('0x1e')]:_0x47496c[_0x06b2('0x1b')]+_0x47496c[_0x06b2('0x1c')];var _0x4c4e21;if(_0x192270>=_0x525945){_0x192270=_0x525945;_0x4c4e21=0xc8;}else{_0x4c4e21=0xce;}_0xaee98c[_0x06b2('0x18')](_0x4c4e21);return _0xaee98c[_0x06b2('0x1f')](_0x06b2('0x20'),_0x594b48+'-'+_0x192270+'/'+_0x525945)[_0x06b2('0x1a')](_0x3830e9);}return null;};}function patchUpdates(_0xe28985){return function(_0x368ad8){try{jsonpatch[_0x06b2('0x21')](_0x368ad8,_0xe28985,!![]);}catch(_0x5ca622){return BPromise[_0x06b2('0x22')](_0x5ca622);}return _0x368ad8[_0x06b2('0x23')]();};}function saveUpdates(_0xb05f65,_0x208384){return function(_0x4e2a4c){if(_0x4e2a4c){return _0x4e2a4c['update'](_0xb05f65)[_0x06b2('0x24')](function(_0xb5231e){return _0xb5231e;});}return null;};}function removeEntity(_0x4fc95f,_0x39659f){return function(_0x5e40f2){if(_0x5e40f2){return _0x5e40f2[_0x06b2('0x25')]()[_0x06b2('0x24')](function(){var _0x2a0645=_0x5e40f2['get']({'plain':!![]});var _0x4382ce=_0x06b2('0x26');return db[_0x06b2('0x27')][_0x06b2('0x25')]({'where':{'type':_0x4382ce,'resourceId':_0x2a0645['id']}})[_0x06b2('0x24')](function(){return _0x5e40f2;});})['then'](function(){_0x4fc95f[_0x06b2('0x18')](0xcc)[_0x06b2('0x19')]();});}};}function handleEntityNotFound(_0x40a73f,_0x1a99c1){return function(_0x1976ac){if(!_0x1976ac){_0x40a73f[_0x06b2('0x17')](0x194);}return _0x1976ac;};}function handleError(_0x5ba3c4,_0x44a95e){_0x44a95e=_0x44a95e||0x1f4;return function(_0x2a3228){logger[_0x06b2('0x28')](_0x2a3228[_0x06b2('0x29')]);if(_0x2a3228[_0x06b2('0x2a')]){delete _0x2a3228[_0x06b2('0x2a')];}_0x5ba3c4[_0x06b2('0x18')](_0x44a95e)['send'](_0x2a3228);};}exports[_0x06b2('0x2b')]=function(_0x32eeea,_0x1637c2){var _0x15a78b={},_0x1cc725={},_0x37d391={'count':0x0,'rows':[]};var _0x401551=_[_0x06b2('0x2c')](db['VoiceMail'][_0x06b2('0x2d')],function(_0x2737ad){return{'name':_0x2737ad[_0x06b2('0x2e')],'type':_0x2737ad[_0x06b2('0x2f')][_0x06b2('0x30')]};});_0x1cc725[_0x06b2('0x31')]=_[_0x06b2('0x2c')](_0x401551,'name');_0x1cc725['query']=_[_0x06b2('0x32')](_0x32eeea[_0x06b2('0x33')]);_0x1cc725[_0x06b2('0x34')]=_['intersection'](_0x1cc725[_0x06b2('0x31')],_0x1cc725[_0x06b2('0x33')]);_0x15a78b[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x1cc725[_0x06b2('0x31')],qs[_0x06b2('0x37')](_0x32eeea['query'][_0x06b2('0x37')]));_0x15a78b[_0x06b2('0x35')]=_0x15a78b[_0x06b2('0x35')]['length']?_0x15a78b[_0x06b2('0x35')]:_0x1cc725[_0x06b2('0x31')];if(!_0x32eeea['query'][_0x06b2('0x38')](_0x06b2('0x39'))){_0x15a78b[_0x06b2('0x1c')]=qs[_0x06b2('0x1c')](_0x32eeea[_0x06b2('0x33')][_0x06b2('0x1c')]);_0x15a78b[_0x06b2('0x1b')]=qs[_0x06b2('0x1b')](_0x32eeea[_0x06b2('0x33')][_0x06b2('0x1b')]);}_0x15a78b[_0x06b2('0x3a')]=qs[_0x06b2('0x3b')](_0x32eeea['query'][_0x06b2('0x3b')]);_0x15a78b['where']=qs['filters'](_[_0x06b2('0x3c')](_0x32eeea['query'],_0x1cc725[_0x06b2('0x34')]),_0x401551);if(_0x32eeea['query'][_0x06b2('0x3d')]){_0x15a78b[_0x06b2('0x3e')]=_[_0x06b2('0x3f')](_0x15a78b[_0x06b2('0x3e')],{'$or':_[_0x06b2('0x2c')](_0x401551,function(_0x51ee32){if(_0x51ee32[_0x06b2('0x2f')]!==_0x06b2('0x40')){var _0x4d5ebd={};_0x4d5ebd[_0x51ee32[_0x06b2('0x2a')]]={'$like':'%'+_0x32eeea[_0x06b2('0x33')][_0x06b2('0x3d')]+'%'};return _0x4d5ebd;}})});}_0x15a78b=_['merge']({},_0x15a78b,_0x32eeea[_0x06b2('0x41')]);var _0x41e74e={'where':_0x15a78b['where']};return db['VoiceMail'][_0x06b2('0x1e')](_0x41e74e)[_0x06b2('0x24')](function(_0x286c9b){_0x37d391[_0x06b2('0x1e')]=_0x286c9b;if(_0x32eeea[_0x06b2('0x33')][_0x06b2('0x42')]){_0x15a78b[_0x06b2('0x43')]=[{'all':!![]}];}return db[_0x06b2('0x44')][_0x06b2('0x45')](_0x15a78b);})[_0x06b2('0x24')](function(_0x1d7750){_0x37d391[_0x06b2('0x46')]=_0x1d7750;return _0x37d391;})[_0x06b2('0x24')](respondWithFilteredResult(_0x1637c2,_0x15a78b))[_0x06b2('0x47')](handleError(_0x1637c2,null));};exports[_0x06b2('0x48')]=function(_0x190781,_0x36ef08){var _0xc68724={'raw':!![],'where':{'id':_0x190781['params']['id']}},_0x38fb0e={};_0x38fb0e[_0x06b2('0x31')]=_[_0x06b2('0x32')](db[_0x06b2('0x44')][_0x06b2('0x2d')]);_0x38fb0e['query']=_[_0x06b2('0x32')](_0x190781[_0x06b2('0x33')]);_0x38fb0e['filters']=_[_0x06b2('0x36')](_0x38fb0e[_0x06b2('0x31')],_0x38fb0e['query']);_0xc68724[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x38fb0e['model'],qs['fields'](_0x190781['query'][_0x06b2('0x37')]));_0xc68724[_0x06b2('0x35')]=_0xc68724[_0x06b2('0x35')][_0x06b2('0x49')]?_0xc68724[_0x06b2('0x35')]:_0x38fb0e['model'];if(_0x190781['query'][_0x06b2('0x42')]){_0xc68724[_0x06b2('0x43')]=[{'all':!![]}];}_0xc68724=_[_0x06b2('0x3f')]({},_0xc68724,_0x190781[_0x06b2('0x41')]);return db[_0x06b2('0x44')][_0x06b2('0x4a')](_0xc68724)['then'](handleEntityNotFound(_0x36ef08,null))[_0x06b2('0x24')](respondWithResult(_0x36ef08,null))[_0x06b2('0x47')](handleError(_0x36ef08,null));};exports[_0x06b2('0x4b')]=function(_0x33f72e,_0x146c5c){return db[_0x06b2('0x44')]['create'](_0x33f72e[_0x06b2('0x4c')],{})[_0x06b2('0x24')](function(_0x324a38){var _0x46920d=_0x33f72e['user'][_0x06b2('0x4d')]({'plain':!![]});if(!_0x46920d)throw new Error(_0x06b2('0x4e'));if(_0x46920d[_0x06b2('0x4f')]===_0x06b2('0x50')){var _0x546c9e=_0x324a38[_0x06b2('0x4d')]({'plain':!![]});var _0x8cf9fe=_0x06b2('0x26');return db[_0x06b2('0x51')][_0x06b2('0x4a')]({'where':{'name':_0x8cf9fe,'userProfileId':_0x46920d[_0x06b2('0x52')]},'raw':!![]})[_0x06b2('0x24')](function(_0x33290b){if(_0x33290b&&_0x33290b['autoAssociation']===0x0){return db[_0x06b2('0x27')][_0x06b2('0x4b')]({'name':_0x546c9e[_0x06b2('0x2a')],'resourceId':_0x546c9e['id'],'type':_0x33290b[_0x06b2('0x2a')],'sectionId':_0x33290b['id']},{})[_0x06b2('0x24')](function(){return _0x324a38;});}else{return _0x324a38;}})[_0x06b2('0x47')](function(_0x4fba4c){logger['error'](_0x06b2('0x53'),_0x4fba4c);throw _0x4fba4c;});}return _0x324a38;})['then'](respondWithResult(_0x146c5c,0xc9))['catch'](handleError(_0x146c5c,null));};exports[_0x06b2('0x54')]=function(_0x5899c1,_0x2dac1c){if(_0x5899c1[_0x06b2('0x4c')]['id']){delete _0x5899c1[_0x06b2('0x4c')]['id'];}return db[_0x06b2('0x44')][_0x06b2('0x4a')]({'where':{'id':_0x5899c1[_0x06b2('0x55')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x2dac1c,null))[_0x06b2('0x24')](saveUpdates(_0x5899c1[_0x06b2('0x4c')],null))[_0x06b2('0x24')](respondWithResult(_0x2dac1c,null))['catch'](handleError(_0x2dac1c,null));};exports['destroy']=function(_0x17d95c,_0x46e4b9){return db['VoiceMail'][_0x06b2('0x4a')]({'where':{'id':_0x17d95c[_0x06b2('0x55')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x46e4b9,null))[_0x06b2('0x24')](removeEntity(_0x46e4b9,null))['catch'](handleError(_0x46e4b9,null));};exports['getMessages']=function(_0x58f519,_0xf058,_0x594dbe){return db['VoiceMail'][_0x06b2('0x56')]({'where':{'id':_0x58f519[_0x06b2('0x55')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0xf058,null))[_0x06b2('0x24')](function(_0x2b2de5){var _0x388d8b;var _0x513650={},_0x119096={};_0x119096[_0x06b2('0x31')]=_['keys'](db[_0x06b2('0x57')][_0x06b2('0x2d')]);_0x119096[_0x06b2('0x33')]=_[_0x06b2('0x32')](_0x58f519[_0x06b2('0x33')]);_0x119096[_0x06b2('0x34')]=_[_0x06b2('0x36')](_0x119096[_0x06b2('0x31')],_0x119096[_0x06b2('0x33')]);_0x513650[_0x06b2('0x35')]=_[_0x06b2('0x36')](_0x119096[_0x06b2('0x31')],qs['fields'](_0x58f519[_0x06b2('0x33')][_0x06b2('0x37')]));_0x513650['attributes']=_0x513650[_0x06b2('0x35')][_0x06b2('0x49')]?_0x513650[_0x06b2('0x35')]:_0x119096[_0x06b2('0x31')];if(!_0x58f519['query'][_0x06b2('0x38')](_0x06b2('0x39'))){_0x513650[_0x06b2('0x1c')]=qs['limit'](_0x58f519[_0x06b2('0x33')][_0x06b2('0x1c')]);_0x513650[_0x06b2('0x1b')]=qs[_0x06b2('0x1b')](_0x58f519[_0x06b2('0x33')][_0x06b2('0x1b')]);}_0x513650[_0x06b2('0x3a')]=qs[_0x06b2('0x3b')](_0x58f519[_0x06b2('0x33')]['sort']);_0x513650['where']=qs['filters'](_['pick'](_0x58f519[_0x06b2('0x33')],_0x119096['filters']));if(_0x58f519[_0x06b2('0x33')][_0x06b2('0x3d')]){_0x513650[_0x06b2('0x3e')]=_[_0x06b2('0x3f')](_0x513650[_0x06b2('0x3e')],{'$or':_[_0x06b2('0x2c')](_0x513650['attributes'],function(_0x57e00d){var _0x1fb8fa={};_0x1fb8fa[_0x57e00d]={'$like':'%'+_0x58f519[_0x06b2('0x33')]['filter']+'%'};return _0x1fb8fa;})});}_0x513650[_0x06b2('0x3e')]=_[_0x06b2('0x3f')](_0x513650[_0x06b2('0x3e')],{'mailboxuser':_0x2b2de5[_0x06b2('0x58')]});_0x513650=_[_0x06b2('0x3f')]({},_0x513650,_0x58f519[_0x06b2('0x41')]);return db['VoiceMailMessage'][_0x06b2('0x59')](_0x513650)['then'](respondWithFilteredResult(_0xf058,_0x513650));})[_0x06b2('0x47')](handleError(_0xf058,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 8baedca..ea88903 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 _0xe28e=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceMail','mailbox_context','context','lodash'];(function(_0x2197ba,_0x5677fc){var _0x4820ad=function(_0x31846d){while(--_0x31846d){_0x2197ba['push'](_0x2197ba['shift']());}};_0x4820ad(++_0x5677fc);}(_0xe28e,0x1ac));var _0xee28=function(_0x186179,_0xf3318d){_0x186179=_0x186179-0x0;var _0x4aca18=_0xe28e[_0x186179];return _0x4aca18;};'use strict';var _=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var logger=require(_0xee28('0x2'))(_0xee28('0x3'));var moment=require('moment');var BPromise=require(_0xee28('0x4'));var rp=require(_0xee28('0x5'));var fs=require('fs');var path=require(_0xee28('0x6'));var rimraf=require(_0xee28('0x7'));var config=require(_0xee28('0x8'));var attributes=require('./voiceMail.attributes');module[_0xee28('0x9')]=function(_0x21f55f,_0xff97db){return _0x21f55f['define'](_0xee28('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xee28('0xb'),'fields':['mailbox',_0xee28('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6347=['request-promise','path','rimraf','../../config/environment','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment'];(function(_0x44a323,_0x13256c){var _0x21b6de=function(_0x1a2a3e){while(--_0x1a2a3e){_0x44a323['push'](_0x44a323['shift']());}};_0x21b6de(++_0x13256c);}(_0x6347,0x87));var _0x7634=function(_0x4a7a7a,_0xcb5124){_0x4a7a7a=_0x4a7a7a-0x0;var _0x1c8a5e=_0x6347[_0x4a7a7a];return _0x1c8a5e;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require(_0x7634('0x2'))(_0x7634('0x3'));var moment=require(_0x7634('0x4'));var BPromise=require('bluebird');var rp=require(_0x7634('0x5'));var fs=require('fs');var path=require(_0x7634('0x6'));var rimraf=require(_0x7634('0x7'));var config=require(_0x7634('0x8'));var attributes=require('./voiceMail.attributes');module[_0x7634('0x9')]=function(_0x2eaf4d,_0x7bf1c1){return _0x2eaf4d['define'](_0x7634('0xa'),attributes,{'tableName':_0x7634('0xb'),'paranoid':![],'indexes':[{'name':_0x7634('0xc'),'fields':[_0x7634('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index b724f05..c7fc6fc 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 _0xd850=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3df93e,_0x5af13a){var _0x2d4f2a=function(_0x14c85c){while(--_0x14c85c){_0x3df93e['push'](_0x3df93e['shift']());}};_0x2d4f2a(++_0x5af13a);}(_0xd850,0x1d0));var _0x0d85=function(_0x15d756,_0x2d57ff){_0x15d756=_0x15d756-0x0;var _0x486a0c=_0xd850[_0x15d756];return _0x486a0c;};'use strict';var _=require(_0x0d85('0x0'));var util=require(_0x0d85('0x1'));var moment=require(_0x0d85('0x2'));var BPromise=require(_0x0d85('0x3'));var rs=require(_0x0d85('0x4'));var fs=require('fs');var Redis=require(_0x0d85('0x5'));var db=require(_0x0d85('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d85('0x7'))(_0x0d85('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x473c26,_0x341c82,_0x3c4a51){return new BPromise(function(_0x5daa40,_0x164779){return client[_0x0d85('0x9')](_0x473c26,_0x3c4a51)[_0x0d85('0xa')](function(_0x47a718){logger[_0x0d85('0xb')](_0x0d85('0xc'),_0x341c82,_0x0d85('0xd'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x341c82,_0x0d85('0xd'),JSON[_0x0d85('0xe')](_0x47a718));if(_0x47a718[_0x0d85('0xf')]){if(_0x47a718['error'][_0x0d85('0x10')]===0x1f4){logger['error'](_0x0d85('0xc'),_0x341c82,_0x47a718[_0x0d85('0xf')]['message']);return _0x164779(_0x47a718[_0x0d85('0xf')]['message']);}logger['error'](_0x0d85('0xc'),_0x341c82,_0x47a718[_0x0d85('0xf')]['message']);return _0x5daa40(_0x47a718[_0x0d85('0xf')][_0x0d85('0x11')]);}else{logger[_0x0d85('0xb')](_0x0d85('0xc'),_0x341c82,_0x0d85('0xd'));_0x5daa40(_0x47a718[_0x0d85('0x12')][_0x0d85('0x11')]);}})[_0x0d85('0x13')](function(_0x477265){logger[_0x0d85('0xf')]('VoiceMail,\x20%s,\x20%s',_0x341c82,_0x477265);_0x164779(_0x477265);});});} \ No newline at end of file +var _0x931d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x931d,0x1b4));var _0xd931=function(_0x13cd99,_0x50bd8d){_0x13cd99=_0x13cd99-0x0;var _0x1d42c7=_0x931d[_0x13cd99];return _0x1d42c7;};'use strict';var _=require('lodash');var util=require(_0xd931('0x0'));var moment=require(_0xd931('0x1'));var BPromise=require(_0xd931('0x2'));var rs=require(_0xd931('0x3'));var fs=require('fs');var Redis=require(_0xd931('0x4'));var db=require(_0xd931('0x5'))['db'];var utils=require(_0xd931('0x6'));var logger=require(_0xd931('0x7'))(_0xd931('0x8'));var config=require(_0xd931('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd931('0xa')][_0xd931('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c266e,_0x2edb0d,_0x48913f){return new BPromise(function(_0x48b7a6,_0x1d4005){return client[_0xd931('0xc')](_0x2c266e,_0x48913f)[_0xd931('0xd')](function(_0x2ee7f0){logger[_0xd931('0xe')](_0xd931('0xf'),_0x2edb0d,_0xd931('0x10'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2edb0d,_0xd931('0x10'),JSON[_0xd931('0x11')](_0x2ee7f0));if(_0x2ee7f0[_0xd931('0x12')]){if(_0x2ee7f0[_0xd931('0x12')][_0xd931('0x13')]===0x1f4){logger[_0xd931('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2edb0d,_0x2ee7f0['error'][_0xd931('0x14')]);return _0x1d4005(_0x2ee7f0[_0xd931('0x12')][_0xd931('0x14')]);}logger[_0xd931('0x12')](_0xd931('0xf'),_0x2edb0d,_0x2ee7f0['error'][_0xd931('0x14')]);return _0x48b7a6(_0x2ee7f0[_0xd931('0x12')][_0xd931('0x14')]);}else{logger[_0xd931('0xe')](_0xd931('0xf'),_0x2edb0d,'request\x20sent');_0x48b7a6(_0x2ee7f0[_0xd931('0x15')][_0xd931('0x14')]);}})[_0xd931('0x16')](function(_0x488b01){logger[_0xd931('0x12')](_0xd931('0xf'),_0x2edb0d,_0x488b01);_0x1d4005(_0x488b01);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c464a8a..b074ebe 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 _0xda33=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','download','post','create','put','delete','destroy','util','path','express'];(function(_0x4d02cf,_0x245f68){var _0x543b18=function(_0x4bb088){while(--_0x4bb088){_0x4d02cf['push'](_0x4d02cf['shift']());}};_0x543b18(++_0x245f68);}(_0xda33,0x7b));var _0x3da3=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xda33[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x3da3('0x0'));var path=require(_0x3da3('0x1'));var timeout=require('connect-timeout');var express=require(_0x3da3('0x2'));var router=express[_0x3da3('0x3')]();var fs_extra=require(_0x3da3('0x4'));var auth=require(_0x3da3('0x5'));var interaction=require(_0x3da3('0x6'));var config=require(_0x3da3('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x3da3('0x8')]('/',auth[_0x3da3('0x9')](),controller[_0x3da3('0xa')]);router[_0x3da3('0x8')](_0x3da3('0xb'),auth[_0x3da3('0x9')](),controller['show']);router[_0x3da3('0x8')]('/:id/download',auth[_0x3da3('0x9')](),controller[_0x3da3('0xc')]);router[_0x3da3('0xd')]('/',auth[_0x3da3('0x9')](),controller[_0x3da3('0xe')]);router[_0x3da3('0xf')](_0x3da3('0xb'),auth[_0x3da3('0x9')](),controller['update']);router[_0x3da3('0x10')](_0x3da3('0xb'),auth[_0x3da3('0x9')](),controller[_0x3da3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5a49=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x1345b7,_0x208c1b){var _0x71a04=function(_0x1de94b){while(--_0x1de94b){_0x1345b7['push'](_0x1345b7['shift']());}};_0x71a04(++_0x208c1b);}(_0x5a49,0x97));var _0x95a4=function(_0x2af608,_0x4cf17b){_0x2af608=_0x2af608-0x0;var _0x2eef5a=_0x5a49[_0x2af608];return _0x2eef5a;};'use strict';var multer=require('multer');var util=require(_0x95a4('0x0'));var path=require('path');var timeout=require(_0x95a4('0x1'));var express=require(_0x95a4('0x2'));var router=express[_0x95a4('0x3')]();var fs_extra=require(_0x95a4('0x4'));var auth=require(_0x95a4('0x5'));var interaction=require(_0x95a4('0x6'));var config=require(_0x95a4('0x7'));var controller=require(_0x95a4('0x8'));router[_0x95a4('0x9')]('/',auth[_0x95a4('0xa')](),controller[_0x95a4('0xb')]);router['get'](_0x95a4('0xc'),auth[_0x95a4('0xa')](),controller[_0x95a4('0xd')]);router['get']('/:id/download',auth[_0x95a4('0xa')](),controller[_0x95a4('0xe')]);router[_0x95a4('0xf')]('/',auth[_0x95a4('0xa')](),controller[_0x95a4('0x10')]);router[_0x95a4('0x11')](_0x95a4('0xc'),auth[_0x95a4('0xa')](),controller[_0x95a4('0x12')]);router[_0x95a4('0x13')](_0x95a4('0xc'),auth[_0x95a4('0xa')](),controller[_0x95a4('0x14')]);module[_0x95a4('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 894864b..f594693 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 _0x80a0=['VIRTUAL','INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports'];(function(_0x491068,_0x5dbeab){var _0x232830=function(_0x359704){while(--_0x359704){_0x491068['push'](_0x491068['shift']());}};_0x232830(++_0x5dbeab);}(_0x80a0,0x164));var _0x080a=function(_0x42c0ed,_0x5248aa){_0x42c0ed=_0x42c0ed-0x0;var _0x4ad9b0=_0x80a0[_0x42c0ed];return _0x4ad9b0;};'use strict';var Sequelize=require('sequelize');module[_0x080a('0x0')]={'name':{'type':Sequelize[_0x080a('0x1')],'get':function(_0x51750c){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x080a('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x080a('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x080a('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x080a('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x080a('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x080a('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x080a('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x080a('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x080a('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x080a('0x5')](_0x080a('0x6'))}}; \ No newline at end of file +var _0x4b7e=['STRING','long','TIMESTAMP','literal','sequelize','VIRTUAL','getDataValue'];(function(_0x1fa738,_0x212b61){var _0x7388e0=function(_0x80983b){while(--_0x80983b){_0x1fa738['push'](_0x1fa738['shift']());}};_0x7388e0(++_0x212b61);}(_0x4b7e,0x138));var _0xe4b7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4b7e[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xe4b7('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4b7('0x1')],'get':function(_0x49b90e){return this[_0xe4b7('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe4b7('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe4b7('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe4b7('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe4b7('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xe4b7('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xe4b7('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xe4b7('0x5'),'defaultValue':Sequelize[_0xe4b7('0x6')]('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 16b1430..2f2be49 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 _0xd7e9=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','body','update','download','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash','squel','crypto','jsforce'];(function(_0x2a974b,_0x5524bf){var _0x3879e9=function(_0x1ec9d6){while(--_0x1ec9d6){_0x2a974b['push'](_0x2a974b['shift']());}};_0x3879e9(++_0x5524bf);}(_0xd7e9,0x1c2));var _0x9d7e=function(_0x1c071f,_0x4f284c){_0x1c071f=_0x1c071f-0x0;var _0x3007a6=_0xd7e9[_0x1c071f];return _0x3007a6;};'use strict';var emlformat=require(_0x9d7e('0x0'));var rimraf=require(_0x9d7e('0x1'));var zipdir=require(_0x9d7e('0x2'));var jsonpatch=require(_0x9d7e('0x3'));var rp=require(_0x9d7e('0x4'));var moment=require('moment');var BPromise=require(_0x9d7e('0x5'));var Mustache=require(_0x9d7e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d7e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d7e('0x8'));var squel=require(_0x9d7e('0x9'));var crypto=require(_0x9d7e('0xa'));var jsforce=require(_0x9d7e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9d7e('0xc'));var querystring=require('querystring');var Papa=require(_0x9d7e('0xd'));var Redis=require(_0x9d7e('0xe'));var authService=require(_0x9d7e('0xf'));var qs=require(_0x9d7e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d7e('0x11'));var logger=require('../../config/logger')(_0x9d7e('0x12'));var utils=require('../../config/utils');var config=require(_0x9d7e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cafa7,_0x143cc7){_0x143cc7=_0x143cc7||0xcc;return function(_0x3e5114){if(_0x3e5114){return _0x4cafa7[_0x9d7e('0x14')](_0x143cc7);}return _0x4cafa7[_0x9d7e('0x15')](_0x143cc7)[_0x9d7e('0x16')]();};}function respondWithResult(_0x509614,_0x1a49c7){_0x1a49c7=_0x1a49c7||0xc8;return function(_0x188c41){if(_0x188c41){return _0x509614[_0x9d7e('0x15')](_0x1a49c7)[_0x9d7e('0x17')](_0x188c41);}};}function respondWithFilteredResult(_0x486f5d,_0x2a0789){return function(_0x580812){if(_0x580812){var _0x41211d=typeof _0x2a0789[_0x9d7e('0x18')]===_0x9d7e('0x19')&&typeof _0x2a0789[_0x9d7e('0x1a')]===_0x9d7e('0x19');var _0x2e98fb=_0x580812[_0x9d7e('0x1b')];var _0x12d05c=_0x41211d?0x0:_0x2a0789[_0x9d7e('0x18')];var _0xd03b4f=_0x41211d?_0x580812['count']:_0x2a0789['offset']+_0x2a0789['limit'];var _0x2f89a7;if(_0xd03b4f>=_0x2e98fb){_0xd03b4f=_0x2e98fb;_0x2f89a7=0xc8;}else{_0x2f89a7=0xce;}_0x486f5d[_0x9d7e('0x15')](_0x2f89a7);return _0x486f5d['set'](_0x9d7e('0x1c'),_0x12d05c+'-'+_0xd03b4f+'/'+_0x2e98fb)[_0x9d7e('0x17')](_0x580812);}return null;};}function patchUpdates(_0x307c04){return function(_0x4bb4e0){try{jsonpatch[_0x9d7e('0x1d')](_0x4bb4e0,_0x307c04,!![]);}catch(_0x528ed7){return BPromise[_0x9d7e('0x1e')](_0x528ed7);}return _0x4bb4e0['save']();};}function saveUpdates(_0x12e0dd,_0x2fe16b){return function(_0x5e68f6){if(_0x5e68f6){return _0x5e68f6['update'](_0x12e0dd)[_0x9d7e('0x1f')](function(_0x537bc7){return _0x537bc7;});}return null;};}function removeEntity(_0xe83ffe,_0xcfea2b){return function(_0x3d08e3){if(_0x3d08e3){return _0x3d08e3[_0x9d7e('0x20')]()['then'](function(){_0xe83ffe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ca035,_0x356bd6){return function(_0x2a7f2f){if(!_0x2a7f2f){_0x1ca035['sendStatus'](0x194);}return _0x2a7f2f;};}function handleError(_0x2aef98,_0x859619){_0x859619=_0x859619||0x1f4;return function(_0x15f4a3){logger['error'](_0x15f4a3['stack']);if(_0x15f4a3['name']){delete _0x15f4a3[_0x9d7e('0x21')];}_0x2aef98[_0x9d7e('0x15')](_0x859619)[_0x9d7e('0x22')](_0x15f4a3);};}exports[_0x9d7e('0x23')]=function(_0x168996,_0x335238){var _0x15f928={},_0x249af6={},_0x30240c={'count':0x0,'rows':[]};var _0x30a46e=_['map'](db[_0x9d7e('0x24')][_0x9d7e('0x25')],function(_0x1e09b3){return{'name':_0x1e09b3[_0x9d7e('0x26')],'type':_0x1e09b3[_0x9d7e('0x27')]['key']};});_0x249af6['model']=_['differenceBy'](_['map'](_0x30a46e,'name'),[_0x9d7e('0x21')]);_0x249af6[_0x9d7e('0x28')]=_['keys'](_0x168996['query']);_0x249af6[_0x9d7e('0x29')]=_['intersection'](_0x249af6[_0x9d7e('0x2a')],_0x249af6[_0x9d7e('0x28')]);_0x15f928[_0x9d7e('0x2b')]=_['intersection'](_0x249af6[_0x9d7e('0x2a')],qs['fields'](_0x168996[_0x9d7e('0x28')][_0x9d7e('0x2c')]));_0x15f928[_0x9d7e('0x2b')]=_0x15f928['attributes']['length']?_0x15f928[_0x9d7e('0x2b')]:_0x249af6[_0x9d7e('0x2a')];if(!_0x168996[_0x9d7e('0x28')][_0x9d7e('0x2d')](_0x9d7e('0x2e'))){_0x15f928[_0x9d7e('0x1a')]=qs['limit'](_0x168996[_0x9d7e('0x28')][_0x9d7e('0x1a')]);_0x15f928[_0x9d7e('0x18')]=qs[_0x9d7e('0x18')](_0x168996['query'][_0x9d7e('0x18')]);}_0x15f928[_0x9d7e('0x2f')]=qs['sort'](_0x168996['query'][_0x9d7e('0x30')]);_0x15f928[_0x9d7e('0x31')]=qs[_0x9d7e('0x29')](_[_0x9d7e('0x32')](_0x168996[_0x9d7e('0x28')],_0x249af6[_0x9d7e('0x29')]),_0x30a46e);if(_0x168996[_0x9d7e('0x28')]['filter']){_0x15f928[_0x9d7e('0x31')]=_['merge'](_0x15f928[_0x9d7e('0x31')],{'$or':_[_0x9d7e('0x33')](_0x30a46e,function(_0x839a91){if(_0x839a91[_0x9d7e('0x27')]!=='VIRTUAL'){var _0x6dbdb5={};_0x6dbdb5[_0x839a91[_0x9d7e('0x21')]]={'$like':'%'+_0x168996['query'][_0x9d7e('0x34')]+'%'};return _0x6dbdb5;}})});}_0x15f928=_[_0x9d7e('0x35')]({},_0x15f928,_0x168996[_0x9d7e('0x36')]);var _0xd63bda={'where':_0x15f928[_0x9d7e('0x31')]};return db[_0x9d7e('0x24')][_0x9d7e('0x1b')](_0xd63bda)[_0x9d7e('0x1f')](function(_0x32428e){_0x30240c[_0x9d7e('0x1b')]=_0x32428e;if(_0x168996[_0x9d7e('0x28')][_0x9d7e('0x37')]){_0x15f928[_0x9d7e('0x38')]=[{'all':!![]}];}return db[_0x9d7e('0x24')][_0x9d7e('0x39')](_0x15f928);})[_0x9d7e('0x1f')](function(_0x1ec57c){_0x30240c[_0x9d7e('0x3a')]=_0x1ec57c;return _0x30240c;})['then'](respondWithFilteredResult(_0x335238,_0x15f928))[_0x9d7e('0x3b')](handleError(_0x335238,null));};exports['show']=function(_0x3f9168,_0x4f2788){var _0x4a597e={'raw':!![],'where':{'id':_0x3f9168[_0x9d7e('0x3c')]['id']}},_0x40d6f6={};_0x40d6f6[_0x9d7e('0x2a')]=_[_0x9d7e('0x3d')](db[_0x9d7e('0x24')][_0x9d7e('0x25')]);_0x40d6f6[_0x9d7e('0x28')]=_['keys'](_0x3f9168[_0x9d7e('0x28')]);_0x40d6f6[_0x9d7e('0x29')]=_[_0x9d7e('0x3e')](_0x40d6f6[_0x9d7e('0x2a')],_0x40d6f6[_0x9d7e('0x28')]);_0x4a597e['attributes']=_[_0x9d7e('0x3e')](_0x40d6f6[_0x9d7e('0x2a')],qs[_0x9d7e('0x2c')](_0x3f9168[_0x9d7e('0x28')][_0x9d7e('0x2c')]));_0x4a597e['attributes']=_0x4a597e[_0x9d7e('0x2b')]['length']?_0x4a597e[_0x9d7e('0x2b')]:_0x40d6f6[_0x9d7e('0x2a')];if(_0x3f9168[_0x9d7e('0x28')][_0x9d7e('0x37')]){_0x4a597e[_0x9d7e('0x38')]=[{'all':!![]}];}_0x4a597e=_['merge']({},_0x4a597e,_0x3f9168[_0x9d7e('0x36')]);return db[_0x9d7e('0x24')][_0x9d7e('0x3f')](_0x4a597e)[_0x9d7e('0x1f')](handleEntityNotFound(_0x4f2788,null))[_0x9d7e('0x1f')](respondWithResult(_0x4f2788,null))['catch'](handleError(_0x4f2788,null));};exports[_0x9d7e('0x40')]=function(_0x597cb3,_0x238017){return db[_0x9d7e('0x24')][_0x9d7e('0x40')](_0x597cb3[_0x9d7e('0x41')],{})['then'](respondWithResult(_0x238017,0xc9))[_0x9d7e('0x3b')](handleError(_0x238017,null));};exports[_0x9d7e('0x42')]=function(_0x4d1418,_0x33f368){if(_0x4d1418[_0x9d7e('0x41')]['id']){delete _0x4d1418[_0x9d7e('0x41')]['id'];}return db[_0x9d7e('0x24')]['find']({'where':{'id':_0x4d1418[_0x9d7e('0x3c')]['id']}})[_0x9d7e('0x1f')](handleEntityNotFound(_0x33f368,null))[_0x9d7e('0x1f')](saveUpdates(_0x4d1418['body'],null))[_0x9d7e('0x1f')](respondWithResult(_0x33f368,null))[_0x9d7e('0x3b')](handleError(_0x33f368,null));};exports[_0x9d7e('0x20')]=function(_0xc9cc3f,_0x1000df){return db[_0x9d7e('0x24')]['find']({'where':{'id':_0xc9cc3f[_0x9d7e('0x3c')]['id']}})[_0x9d7e('0x1f')](handleEntityNotFound(_0x1000df,null))['then'](removeEntity(_0x1000df,null))[_0x9d7e('0x3b')](handleError(_0x1000df,null));};exports[_0x9d7e('0x43')]=function(_0x3bee97,_0x14671d,_0x9697dc){return db[_0x9d7e('0x24')][_0x9d7e('0x3f')]({'where':{'id':_0x3bee97[_0x9d7e('0x3c')]['id']},'attributes':['id',_0x9d7e('0x44'),_0x9d7e('0x45')]})[_0x9d7e('0x1f')](handleEntityNotFound(_0x14671d,null))[_0x9d7e('0x1f')](function(_0x5293b8){if(_0x5293b8){if(!_0x5293b8['recording']){throw new db['Sequelize']['ValidationError'](_0x9d7e('0x46'));}var _0x468122={'Content-Type':_0x9d7e('0x47'),'Content-Disposition':_0x9d7e('0x48')};if(_0x5293b8[_0x9d7e('0x45')]){_0x468122[_0x9d7e('0x49')]=_0x9d7e('0x4a')+_0x5293b8[_0x9d7e('0x45')]+_0x9d7e('0x4b');}_0x14671d[_0x9d7e('0x4c')](_0x468122);return _0x14671d[_0x9d7e('0x22')](new Buffer(_0x5293b8['recording']));}})[_0x9d7e('0x3b')](handleError(_0x14671d,null));}; \ No newline at end of file +var _0xb851=['model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','keys','rawAttributes','find','create','body','download','recording','msg_id','Sequelize','ValidationError','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','fieldName','type','query','intersection','attributes'];(function(_0x3778d8,_0x5ce417){var _0x45a1b3=function(_0x28488a){while(--_0x28488a){_0x3778d8['push'](_0x3778d8['shift']());}};_0x45a1b3(++_0x5ce417);}(_0xb851,0x168));var _0x1b85=function(_0xedb98e,_0x2c69d3){_0xedb98e=_0xedb98e-0x0;var _0x3c3e3f=_0xb851[_0xedb98e];return _0x3c3e3f;};'use strict';var emlformat=require(_0x1b85('0x0'));var rimraf=require(_0x1b85('0x1'));var zipdir=require(_0x1b85('0x2'));var jsonpatch=require(_0x1b85('0x3'));var rp=require('request-promise');var moment=require(_0x1b85('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1b85('0x5'));var sox=require(_0x1b85('0x6'));var csv=require(_0x1b85('0x7'));var ejs=require(_0x1b85('0x8'));var fs=require('fs');var fs_extra=require(_0x1b85('0x9'));var _=require('lodash');var squel=require(_0x1b85('0xa'));var crypto=require(_0x1b85('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1b85('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1b85('0xd'));var Papa=require(_0x1b85('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1b85('0xf'));var as=require(_0x1b85('0x10'));var hardwareService=require(_0x1b85('0x11'));var logger=require(_0x1b85('0x12'))(_0x1b85('0x13'));var utils=require(_0x1b85('0x14'));var config=require(_0x1b85('0x15'));var licenseUtil=require(_0x1b85('0x16'));var db=require(_0x1b85('0x17'))['db'];function respondWithStatusCode(_0x5b616a,_0xb37298){_0xb37298=_0xb37298||0xcc;return function(_0x3acff4){if(_0x3acff4){return _0x5b616a[_0x1b85('0x18')](_0xb37298);}return _0x5b616a[_0x1b85('0x19')](_0xb37298)[_0x1b85('0x1a')]();};}function respondWithResult(_0x3e6632,_0x47f6fa){_0x47f6fa=_0x47f6fa||0xc8;return function(_0x508025){if(_0x508025){return _0x3e6632['status'](_0x47f6fa)[_0x1b85('0x1b')](_0x508025);}};}function respondWithFilteredResult(_0x2d28e9,_0x147edc){return function(_0x2af281){if(_0x2af281){var _0x21087b=typeof _0x147edc[_0x1b85('0x1c')]===_0x1b85('0x1d')&&typeof _0x147edc[_0x1b85('0x1e')]===_0x1b85('0x1d');var _0x16b793=_0x2af281[_0x1b85('0x1f')];var _0x339b46=_0x21087b?0x0:_0x147edc['offset'];var _0x5e5fc2=_0x21087b?_0x2af281['count']:_0x147edc[_0x1b85('0x1c')]+_0x147edc[_0x1b85('0x1e')];var _0x2c3eed;if(_0x5e5fc2>=_0x16b793){_0x5e5fc2=_0x16b793;_0x2c3eed=0xc8;}else{_0x2c3eed=0xce;}_0x2d28e9[_0x1b85('0x19')](_0x2c3eed);return _0x2d28e9[_0x1b85('0x20')](_0x1b85('0x21'),_0x339b46+'-'+_0x5e5fc2+'/'+_0x16b793)[_0x1b85('0x1b')](_0x2af281);}return null;};}function patchUpdates(_0x306335){return function(_0x431932){try{jsonpatch['apply'](_0x431932,_0x306335,!![]);}catch(_0x1a6059){return BPromise[_0x1b85('0x22')](_0x1a6059);}return _0x431932[_0x1b85('0x23')]();};}function saveUpdates(_0x556095,_0x57b60d){return function(_0x3ff465){if(_0x3ff465){return _0x3ff465[_0x1b85('0x24')](_0x556095)[_0x1b85('0x25')](function(_0x467b23){return _0x467b23;});}return null;};}function removeEntity(_0x4b3783,_0x80e749){return function(_0x214bee){if(_0x214bee){return _0x214bee[_0x1b85('0x26')]()[_0x1b85('0x25')](function(){_0x4b3783['status'](0xcc)[_0x1b85('0x1a')]();});}};}function handleEntityNotFound(_0x36f3d9,_0x5174ea){return function(_0x19539a){if(!_0x19539a){_0x36f3d9[_0x1b85('0x18')](0x194);}return _0x19539a;};}function handleError(_0xab8dac,_0x1816c9){_0x1816c9=_0x1816c9||0x1f4;return function(_0x20e0e2){logger[_0x1b85('0x27')](_0x20e0e2[_0x1b85('0x28')]);if(_0x20e0e2['name']){delete _0x20e0e2[_0x1b85('0x29')];}_0xab8dac['status'](_0x1816c9)[_0x1b85('0x2a')](_0x20e0e2);};}exports['index']=function(_0x23680c,_0x1c3c93){var _0xc9f6d5={},_0x39f676={},_0xac6c81={'count':0x0,'rows':[]};var _0x506d82=_[_0x1b85('0x2b')](db[_0x1b85('0x2c')]['rawAttributes'],function(_0x13f10d){return{'name':_0x13f10d[_0x1b85('0x2d')],'type':_0x13f10d[_0x1b85('0x2e')]['key']};});_0x39f676['model']=_['differenceBy'](_[_0x1b85('0x2b')](_0x506d82,_0x1b85('0x29')),['name']);_0x39f676[_0x1b85('0x2f')]=_['keys'](_0x23680c[_0x1b85('0x2f')]);_0x39f676['filters']=_[_0x1b85('0x30')](_0x39f676['model'],_0x39f676[_0x1b85('0x2f')]);_0xc9f6d5[_0x1b85('0x31')]=_['intersection'](_0x39f676[_0x1b85('0x32')],qs[_0x1b85('0x33')](_0x23680c[_0x1b85('0x2f')][_0x1b85('0x33')]));_0xc9f6d5[_0x1b85('0x31')]=_0xc9f6d5[_0x1b85('0x31')][_0x1b85('0x34')]?_0xc9f6d5['attributes']:_0x39f676[_0x1b85('0x32')];if(!_0x23680c[_0x1b85('0x2f')][_0x1b85('0x35')](_0x1b85('0x36'))){_0xc9f6d5[_0x1b85('0x1e')]=qs[_0x1b85('0x1e')](_0x23680c['query'][_0x1b85('0x1e')]);_0xc9f6d5['offset']=qs[_0x1b85('0x1c')](_0x23680c[_0x1b85('0x2f')][_0x1b85('0x1c')]);}_0xc9f6d5[_0x1b85('0x37')]=qs['sort'](_0x23680c['query'][_0x1b85('0x38')]);_0xc9f6d5['where']=qs[_0x1b85('0x39')](_[_0x1b85('0x3a')](_0x23680c[_0x1b85('0x2f')],_0x39f676[_0x1b85('0x39')]),_0x506d82);if(_0x23680c[_0x1b85('0x2f')]['filter']){_0xc9f6d5['where']=_['merge'](_0xc9f6d5[_0x1b85('0x3b')],{'$or':_[_0x1b85('0x2b')](_0x506d82,function(_0x435efa){if(_0x435efa['type']!==_0x1b85('0x3c')){var _0x5b2c3d={};_0x5b2c3d[_0x435efa[_0x1b85('0x29')]]={'$like':'%'+_0x23680c[_0x1b85('0x2f')][_0x1b85('0x3d')]+'%'};return _0x5b2c3d;}})});}_0xc9f6d5=_[_0x1b85('0x3e')]({},_0xc9f6d5,_0x23680c[_0x1b85('0x3f')]);var _0x3edc8d={'where':_0xc9f6d5[_0x1b85('0x3b')]};return db['VoiceMailMessage'][_0x1b85('0x1f')](_0x3edc8d)[_0x1b85('0x25')](function(_0x44269a){_0xac6c81[_0x1b85('0x1f')]=_0x44269a;if(_0x23680c['query'][_0x1b85('0x40')]){_0xc9f6d5[_0x1b85('0x41')]=[{'all':!![]}];}return db[_0x1b85('0x2c')]['findAll'](_0xc9f6d5);})[_0x1b85('0x25')](function(_0x39d7d6){_0xac6c81['rows']=_0x39d7d6;return _0xac6c81;})[_0x1b85('0x25')](respondWithFilteredResult(_0x1c3c93,_0xc9f6d5))[_0x1b85('0x42')](handleError(_0x1c3c93,null));};exports[_0x1b85('0x43')]=function(_0x1066b,_0x25ea6a){var _0x4eca43={'raw':!![],'where':{'id':_0x1066b[_0x1b85('0x44')]['id']}},_0x307bbd={};_0x307bbd[_0x1b85('0x32')]=_[_0x1b85('0x45')](db[_0x1b85('0x2c')][_0x1b85('0x46')]);_0x307bbd['query']=_[_0x1b85('0x45')](_0x1066b[_0x1b85('0x2f')]);_0x307bbd['filters']=_[_0x1b85('0x30')](_0x307bbd['model'],_0x307bbd[_0x1b85('0x2f')]);_0x4eca43[_0x1b85('0x31')]=_['intersection'](_0x307bbd[_0x1b85('0x32')],qs[_0x1b85('0x33')](_0x1066b['query'][_0x1b85('0x33')]));_0x4eca43[_0x1b85('0x31')]=_0x4eca43[_0x1b85('0x31')]['length']?_0x4eca43[_0x1b85('0x31')]:_0x307bbd[_0x1b85('0x32')];if(_0x1066b[_0x1b85('0x2f')][_0x1b85('0x40')]){_0x4eca43[_0x1b85('0x41')]=[{'all':!![]}];}_0x4eca43=_[_0x1b85('0x3e')]({},_0x4eca43,_0x1066b[_0x1b85('0x3f')]);return db[_0x1b85('0x2c')][_0x1b85('0x47')](_0x4eca43)['then'](handleEntityNotFound(_0x25ea6a,null))[_0x1b85('0x25')](respondWithResult(_0x25ea6a,null))[_0x1b85('0x42')](handleError(_0x25ea6a,null));};exports[_0x1b85('0x48')]=function(_0x43cec9,_0x48a738){return db[_0x1b85('0x2c')][_0x1b85('0x48')](_0x43cec9[_0x1b85('0x49')],{})[_0x1b85('0x25')](respondWithResult(_0x48a738,0xc9))[_0x1b85('0x42')](handleError(_0x48a738,null));};exports[_0x1b85('0x24')]=function(_0x500b2c,_0x184294){if(_0x500b2c['body']['id']){delete _0x500b2c[_0x1b85('0x49')]['id'];}return db[_0x1b85('0x2c')][_0x1b85('0x47')]({'where':{'id':_0x500b2c[_0x1b85('0x44')]['id']}})[_0x1b85('0x25')](handleEntityNotFound(_0x184294,null))[_0x1b85('0x25')](saveUpdates(_0x500b2c[_0x1b85('0x49')],null))['then'](respondWithResult(_0x184294,null))['catch'](handleError(_0x184294,null));};exports[_0x1b85('0x26')]=function(_0x3257c0,_0x3c475e){return db[_0x1b85('0x2c')][_0x1b85('0x47')]({'where':{'id':_0x3257c0['params']['id']}})['then'](handleEntityNotFound(_0x3c475e,null))[_0x1b85('0x25')](removeEntity(_0x3c475e,null))['catch'](handleError(_0x3c475e,null));};exports[_0x1b85('0x4a')]=function(_0x1760ec,_0x2ffb8d,_0x27fc5f){return db['VoiceMailMessage']['find']({'where':{'id':_0x1760ec[_0x1b85('0x44')]['id']},'attributes':['id',_0x1b85('0x4b'),_0x1b85('0x4c')]})[_0x1b85('0x25')](handleEntityNotFound(_0x2ffb8d,null))['then'](function(_0x298620){if(_0x298620){if(!_0x298620[_0x1b85('0x4b')]){throw new db[(_0x1b85('0x4d'))][(_0x1b85('0x4e'))]('VoiceMailMessage\x20not\x20found');}var _0x46639d={'Content-Type':'audio/wav','Content-Disposition':_0x1b85('0x4f')};if(_0x298620[_0x1b85('0x4c')]){_0x46639d[_0x1b85('0x50')]=_0x1b85('0x51')+_0x298620[_0x1b85('0x4c')]+'.wav\x22';}_0x2ffb8d[_0x1b85('0x20')](_0x46639d);return _0x2ffb8d[_0x1b85('0x2a')](new Buffer(_0x298620[_0x1b85('0x4b')]));}})[_0x1b85('0x42')](handleError(_0x2ffb8d,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f377237..84268e5 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 _0xdce9=['path','rimraf','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird'];(function(_0x509922,_0x26eb07){var _0xb79ff0=function(_0x5f6ffe){while(--_0x5f6ffe){_0x509922['push'](_0x509922['shift']());}};_0xb79ff0(++_0x26eb07);}(_0xdce9,0x7f));var _0x9dce=function(_0x2d1b78,_0x1d1226){_0x2d1b78=_0x2d1b78-0x0;var _0x4a3d66=_0xdce9[_0x2d1b78];return _0x4a3d66;};'use strict';var _=require(_0x9dce('0x0'));var util=require('util');var logger=require(_0x9dce('0x1'))(_0x9dce('0x2'));var moment=require(_0x9dce('0x3'));var BPromise=require(_0x9dce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dce('0x5'));var rimraf=require(_0x9dce('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x4da016,_0x13a4e7){return _0x4da016[_0x9dce('0x7')](_0x9dce('0x8'),attributes,{'tableName':_0x9dce('0x9'),'paranoid':![],'indexes':[{'name':_0x9dce('0xa'),'fields':[_0x9dce('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf784=['api','bluebird','request-promise','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0xf784,0x6c));var _0x4f78=function(_0x84f6fc,_0x43c41f){_0x84f6fc=_0x84f6fc-0x0;var _0x2678eb=_0xf784[_0x84f6fc];return _0x2678eb;};'use strict';var _=require(_0x4f78('0x0'));var util=require('util');var logger=require(_0x4f78('0x1'))(_0x4f78('0x2'));var moment=require('moment');var BPromise=require(_0x4f78('0x3'));var rp=require(_0x4f78('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f78('0x5'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x4f78('0x6')]=function(_0x3ba756,_0x56a06c){return _0x3ba756[_0x4f78('0x7')](_0x4f78('0x8'),attributes,{'tableName':_0x4f78('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x4f78('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index dcb56d7..3beebe1 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 _0x89f4=['request','then','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89f4,0x140));var _0x489f=function(_0x6c5aa2,_0x56a2e1){_0x6c5aa2=_0x6c5aa2-0x0;var _0x27a143=_0x89f4[_0x6c5aa2];return _0x27a143;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x489f('0x0'));var BPromise=require(_0x489f('0x1'));var rs=require(_0x489f('0x2'));var fs=require('fs');var Redis=require(_0x489f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x489f('0x4'));var logger=require(_0x489f('0x5'))(_0x489f('0x6'));var config=require('../../config/environment');var jayson=require(_0x489f('0x7'));var client=jayson[_0x489f('0x8')][_0x489f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x986dbb,_0x55c37a,_0x401937){return new BPromise(function(_0x4d8301,_0x4ca485){return client[_0x489f('0xa')](_0x986dbb,_0x401937)[_0x489f('0xb')](function(_0x4910ee){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x55c37a,'request\x20sent');logger[_0x489f('0xc')](_0x489f('0xd'),_0x55c37a,_0x489f('0xe'),JSON[_0x489f('0xf')](_0x4910ee));if(_0x4910ee['error']){if(_0x4910ee[_0x489f('0x10')][_0x489f('0x11')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x55c37a,_0x4910ee[_0x489f('0x10')]['message']);return _0x4ca485(_0x4910ee[_0x489f('0x10')][_0x489f('0x12')]);}logger[_0x489f('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x55c37a,_0x4910ee['error'][_0x489f('0x12')]);return _0x4d8301(_0x4910ee[_0x489f('0x10')][_0x489f('0x12')]);}else{logger['info'](_0x489f('0x13'),_0x55c37a,'request\x20sent');_0x4d8301(_0x4910ee[_0x489f('0x14')][_0x489f('0x12')]);}})[_0x489f('0x15')](function(_0x5b3c99){logger[_0x489f('0x10')](_0x489f('0x13'),_0x55c37a,_0x5b3c99);_0x4ca485(_0x5b3c99);});});} \ No newline at end of file +var _0xf11e=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf11e,0x108));var _0xef11=function(_0x1bbd51,_0x5e592d){_0x1bbd51=_0x1bbd51-0x0;var _0x43dbdd=_0xf11e[_0x1bbd51];return _0x43dbdd;};'use strict';var _=require(_0xef11('0x0'));var util=require(_0xef11('0x1'));var moment=require(_0xef11('0x2'));var BPromise=require('bluebird');var rs=require(_0xef11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef11('0x4'))['db'];var utils=require(_0xef11('0x5'));var logger=require(_0xef11('0x6'))(_0xef11('0x7'));var config=require(_0xef11('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef11('0x9')][_0xef11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x284ca6,_0x3af3f,_0x5c58c6){return new BPromise(function(_0x59e094,_0x36f0f1){return client['request'](_0x284ca6,_0x5c58c6)['then'](function(_0x5bd683){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x3af3f,_0xef11('0xb'));logger[_0xef11('0xc')](_0xef11('0xd'),_0x3af3f,'request\x20sent',JSON[_0xef11('0xe')](_0x5bd683));if(_0x5bd683[_0xef11('0xf')]){if(_0x5bd683[_0xef11('0xf')][_0xef11('0x10')]===0x1f4){logger[_0xef11('0xf')](_0xef11('0x11'),_0x3af3f,_0x5bd683[_0xef11('0xf')]['message']);return _0x36f0f1(_0x5bd683[_0xef11('0xf')][_0xef11('0x12')]);}logger[_0xef11('0xf')](_0xef11('0x11'),_0x3af3f,_0x5bd683[_0xef11('0xf')]['message']);return _0x59e094(_0x5bd683[_0xef11('0xf')][_0xef11('0x12')]);}else{logger[_0xef11('0x13')](_0xef11('0x11'),_0x3af3f,'request\x20sent');_0x59e094(_0x5bd683[_0xef11('0x14')][_0xef11('0x12')]);}})[_0xef11('0x15')](function(_0x51dabe){logger[_0xef11('0xf')](_0xef11('0x11'),_0x3af3f,_0x51dabe);_0x36f0f1(_0x51dabe);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8ff5bf8..f4d19a9 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 _0xb657=['removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2'];(function(_0x179d19,_0x3f63fc){var _0x1ca47f=function(_0x42ef71){while(--_0x42ef71){_0x179d19['push'](_0x179d19['shift']());}};_0x1ca47f(++_0x3f63fc);}(_0xb657,0xec));var _0x7b65=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xb657[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require('multer');var util=require(_0x7b65('0x0'));var path=require(_0x7b65('0x1'));var timeout=require(_0x7b65('0x2'));var express=require(_0x7b65('0x3'));var router=express[_0x7b65('0x4')]();var fs_extra=require(_0x7b65('0x5'));var auth=require(_0x7b65('0x6'));var interaction=require(_0x7b65('0x7'));var config=require(_0x7b65('0x8'));var controller=require(_0x7b65('0x9'));router[_0x7b65('0xa')]('/',auth[_0x7b65('0xb')](),controller[_0x7b65('0xc')]);router[_0x7b65('0xa')](_0x7b65('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7b65('0xe'),auth[_0x7b65('0xb')](),controller[_0x7b65('0xf')]);router[_0x7b65('0x10')]('/',auth[_0x7b65('0xb')](),controller[_0x7b65('0x11')]);router[_0x7b65('0x10')](_0x7b65('0xe'),auth['isAuthenticated'](),controller[_0x7b65('0x12')]);router[_0x7b65('0x13')](_0x7b65('0xd'),auth[_0x7b65('0xb')](),controller[_0x7b65('0x14')]);router[_0x7b65('0x15')](_0x7b65('0xd'),auth['isAuthenticated'](),controller[_0x7b65('0x16')]);router['delete'](_0x7b65('0x17'),auth[_0x7b65('0xb')](),controller[_0x7b65('0x18')]);module[_0x7b65('0x19')]=router; \ No newline at end of file +var _0x1bfd=['removeSound','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','destroy','delete','/:id/sounds/:id2'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1bfd,0x172));var _0xd1bf=function(_0x510ef9,_0x58f37b){_0x510ef9=_0x510ef9-0x0;var _0x3c6558=_0x1bfd[_0x510ef9];return _0x3c6558;};'use strict';var multer=require(_0xd1bf('0x0'));var util=require('util');var path=require(_0xd1bf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd1bf('0x2')]();var fs_extra=require(_0xd1bf('0x3'));var auth=require(_0xd1bf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd1bf('0x5'));var controller=require(_0xd1bf('0x6'));router[_0xd1bf('0x7')]('/',auth[_0xd1bf('0x8')](),controller['index']);router[_0xd1bf('0x7')](_0xd1bf('0x9'),auth['isAuthenticated'](),controller[_0xd1bf('0xa')]);router[_0xd1bf('0x7')](_0xd1bf('0xb'),auth['isAuthenticated'](),controller[_0xd1bf('0xc')]);router[_0xd1bf('0xd')]('/',auth['isAuthenticated'](),controller[_0xd1bf('0xe')]);router[_0xd1bf('0xd')](_0xd1bf('0xb'),auth[_0xd1bf('0x8')](),controller[_0xd1bf('0xf')]);router[_0xd1bf('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd1bf('0x11')]);router['delete'](_0xd1bf('0x9'),auth[_0xd1bf('0x8')](),controller[_0xd1bf('0x12')]);router[_0xd1bf('0x13')](_0xd1bf('0x14'),auth[_0xd1bf('0x8')](),controller[_0xd1bf('0x15')]);module[_0xd1bf('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 4b2203d..4e05af2 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 _0xa9eb=['BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb','mp3','TIMESTAMP'];(function(_0x292037,_0x442f7c){var _0x4bd506=function(_0x2c73ce){while(--_0x2c73ce){_0x292037['push'](_0x292037['shift']());}};_0x4bd506(++_0x442f7c);}(_0xa9eb,0xd2));var _0xba9e=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xa9eb[_0x381589];return _0x2a075d;};'use strict';var Sequelize=require(_0xba9e('0x0'));module[_0xba9e('0x1')]={'name':{'type':Sequelize[_0xba9e('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xba9e('0x3')](_0xba9e('0x4'),_0xba9e('0x5'),_0xba9e('0x6'),_0xba9e('0x7'),'quietmp3',_0xba9e('0x8')),'allowNull':!![],'defaultValue':_0xba9e('0x5')},'directory':{'type':Sequelize[_0xba9e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xba9e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xba9e('0x9')},'defaultEntry':{'type':Sequelize[_0xba9e('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x796f=['STRING','name','ENUM','custom','mp3nb','quietmp3nb','mp3','TIMESTAMP','BOOLEAN','exports'];(function(_0x284ff3,_0x2b8f6a){var _0x2477fd=function(_0x1b158c){while(--_0x1b158c){_0x284ff3['push'](_0x284ff3['shift']());}};_0x2477fd(++_0x2b8f6a);}(_0x796f,0xf9));var _0xf796=function(_0x12b404,_0x480fb4){_0x12b404=_0x12b404-0x0;var _0x57960b=_0x796f[_0x12b404];return _0x57960b;};'use strict';var Sequelize=require('sequelize');module[_0xf796('0x0')]={'name':{'type':Sequelize[_0xf796('0x1')],'allowNull':![],'unique':_0xf796('0x2')},'mode':{'type':Sequelize[_0xf796('0x3')](_0xf796('0x4'),'files',_0xf796('0x5'),_0xf796('0x6'),'quietmp3',_0xf796('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xf796('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xf796('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf796('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf796('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xf796('0x1')],'allowNull':!![]},'stamp':{'type':_0xf796('0x8')},'defaultEntry':{'type':Sequelize[_0xf796('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index dc93702..b42b7c8 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 _0xcfbb=['key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','params','keys','length','includeAll','find','body','create','sequelize','directory','join','root','server/files/moh','mode','files','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MusicOnHolds','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','%s.%s','symlinkSync','removeSound','findOne','id2','Sound','getSounds','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','type'];(function(_0x4c6a59,_0x4cd744){var _0x48edde=function(_0x4536b1){while(--_0x4536b1){_0x4c6a59['push'](_0x4c6a59['shift']());}};_0x48edde(++_0x4cd744);}(_0xcfbb,0xaf));var _0xbcfb=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0xcfbb[_0x2e2104];return _0x1280c5;};'use strict';var emlformat=require(_0xbcfb('0x0'));var rimraf=require(_0xbcfb('0x1'));var zipdir=require(_0xbcfb('0x2'));var jsonpatch=require(_0xbcfb('0x3'));var rp=require('request-promise');var moment=require(_0xbcfb('0x4'));var BPromise=require(_0xbcfb('0x5'));var Mustache=require(_0xbcfb('0x6'));var util=require('util');var path=require(_0xbcfb('0x7'));var sox=require('sox');var csv=require(_0xbcfb('0x8'));var ejs=require(_0xbcfb('0x9'));var fs=require('fs');var fs_extra=require(_0xbcfb('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbcfb('0xb'));var jsforce=require(_0xbcfb('0xc'));var deskjs=require(_0xbcfb('0xd'));var toCsv=require(_0xbcfb('0x8'));var querystring=require(_0xbcfb('0xe'));var Papa=require(_0xbcfb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbcfb('0x10'));var hardwareService=require(_0xbcfb('0x11'));var logger=require(_0xbcfb('0x12'))(_0xbcfb('0x13'));var utils=require(_0xbcfb('0x14'));var config=require(_0xbcfb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcfb('0x16'))['db'];function respondWithStatusCode(_0x5171f3,_0x6efa4f){_0x6efa4f=_0x6efa4f||0xcc;return function(_0x402446){if(_0x402446){return _0x5171f3[_0xbcfb('0x17')](_0x6efa4f);}return _0x5171f3['status'](_0x6efa4f)[_0xbcfb('0x18')]();};}function respondWithResult(_0x110048,_0x4599de){_0x4599de=_0x4599de||0xc8;return function(_0x117965){if(_0x117965){return _0x110048['status'](_0x4599de)[_0xbcfb('0x19')](_0x117965);}};}function respondWithFilteredResult(_0x159c79,_0x24e598){return function(_0x1ce09a){if(_0x1ce09a){var _0xf830e6=typeof _0x24e598['offset']===_0xbcfb('0x1a')&&typeof _0x24e598['limit']==='undefined';var _0x1451c4=_0x1ce09a[_0xbcfb('0x1b')];var _0x1c4f8b=_0xf830e6?0x0:_0x24e598[_0xbcfb('0x1c')];var _0x27b3c5=_0xf830e6?_0x1ce09a[_0xbcfb('0x1b')]:_0x24e598['offset']+_0x24e598[_0xbcfb('0x1d')];var _0x5e85a3;if(_0x27b3c5>=_0x1451c4){_0x27b3c5=_0x1451c4;_0x5e85a3=0xc8;}else{_0x5e85a3=0xce;}_0x159c79[_0xbcfb('0x1e')](_0x5e85a3);return _0x159c79[_0xbcfb('0x1f')](_0xbcfb('0x20'),_0x1c4f8b+'-'+_0x27b3c5+'/'+_0x1451c4)[_0xbcfb('0x19')](_0x1ce09a);}return null;};}function patchUpdates(_0x2d01fd){return function(_0x1f44f5){try{jsonpatch[_0xbcfb('0x21')](_0x1f44f5,_0x2d01fd,!![]);}catch(_0x38b784){return BPromise['reject'](_0x38b784);}return _0x1f44f5[_0xbcfb('0x22')]();};}function saveUpdates(_0xca44b8,_0x4c9d80){return function(_0x3303bd){if(_0x3303bd){return _0x3303bd[_0xbcfb('0x23')](_0xca44b8)[_0xbcfb('0x24')](function(_0x2dcbe2){return _0x2dcbe2;});}return null;};}function removeEntity(_0x2cab52,_0x55d46a){return function(_0xd07fe4){if(_0xd07fe4){return _0xd07fe4[_0xbcfb('0x25')]()[_0xbcfb('0x24')](function(){var _0x17a27c=_0xd07fe4['get']({'plain':!![]});var _0x38a5ca='MusicOnHolds';return db[_0xbcfb('0x26')][_0xbcfb('0x25')]({'where':{'type':_0x38a5ca,'resourceId':_0x17a27c['id']}})[_0xbcfb('0x24')](function(){return _0xd07fe4;});})[_0xbcfb('0x24')](function(){_0x2cab52[_0xbcfb('0x1e')](0xcc)[_0xbcfb('0x18')]();});}};}function handleEntityNotFound(_0x1b28bf,_0x77ef57){return function(_0x56811f){if(!_0x56811f){_0x1b28bf[_0xbcfb('0x17')](0x194);}return _0x56811f;};}function handleError(_0xacdd6,_0x3fba01){_0x3fba01=_0x3fba01||0x1f4;return function(_0x2986ed){logger[_0xbcfb('0x27')](_0x2986ed[_0xbcfb('0x28')]);if(_0x2986ed[_0xbcfb('0x29')]){delete _0x2986ed['name'];}_0xacdd6[_0xbcfb('0x1e')](_0x3fba01)[_0xbcfb('0x2a')](_0x2986ed);};}exports[_0xbcfb('0x2b')]=function(_0x46fb62,_0x26be1b){var _0x1b576b={},_0x442101={},_0x10fc16={'count':0x0,'rows':[]};var _0x1f3b02=_['map'](db[_0xbcfb('0x2c')][_0xbcfb('0x2d')],function(_0x1f9fde){return{'name':_0x1f9fde['fieldName'],'type':_0x1f9fde[_0xbcfb('0x2e')][_0xbcfb('0x2f')]};});_0x442101[_0xbcfb('0x30')]=_['map'](_0x1f3b02,_0xbcfb('0x29'));_0x442101[_0xbcfb('0x31')]=_['keys'](_0x46fb62['query']);_0x442101[_0xbcfb('0x32')]=_[_0xbcfb('0x33')](_0x442101[_0xbcfb('0x30')],_0x442101['query']);_0x1b576b[_0xbcfb('0x34')]=_[_0xbcfb('0x33')](_0x442101['model'],qs[_0xbcfb('0x35')](_0x46fb62[_0xbcfb('0x31')][_0xbcfb('0x35')]));_0x1b576b[_0xbcfb('0x34')]=_0x1b576b[_0xbcfb('0x34')]['length']?_0x1b576b[_0xbcfb('0x34')]:_0x442101[_0xbcfb('0x30')];if(!_0x46fb62[_0xbcfb('0x31')][_0xbcfb('0x36')](_0xbcfb('0x37'))){_0x1b576b[_0xbcfb('0x1d')]=qs[_0xbcfb('0x1d')](_0x46fb62['query']['limit']);_0x1b576b[_0xbcfb('0x1c')]=qs[_0xbcfb('0x1c')](_0x46fb62[_0xbcfb('0x31')][_0xbcfb('0x1c')]);}_0x1b576b[_0xbcfb('0x38')]=qs[_0xbcfb('0x39')](_0x46fb62[_0xbcfb('0x31')]['sort']);delete _0x46fb62[_0xbcfb('0x31')][_0xbcfb('0x39')];_0x1b576b[_0xbcfb('0x3a')]=qs['filters'](_[_0xbcfb('0x3b')](_0x46fb62[_0xbcfb('0x31')],_0x442101[_0xbcfb('0x32')]),_0x1f3b02);if(_0x46fb62[_0xbcfb('0x31')][_0xbcfb('0x3c')]){_0x1b576b[_0xbcfb('0x3a')]=_[_0xbcfb('0x3d')](_0x1b576b[_0xbcfb('0x3a')],{'$or':_['map'](_0x1f3b02,function(_0x2e66fd){if(_0x2e66fd[_0xbcfb('0x2e')]!=='VIRTUAL'){var _0x47684c={};_0x47684c[_0x2e66fd[_0xbcfb('0x29')]]={'$like':'%'+_0x46fb62[_0xbcfb('0x31')][_0xbcfb('0x3c')]+'%'};return _0x47684c;}})});}_0x1b576b=_[_0xbcfb('0x3d')]({},_0x1b576b,_0x46fb62[_0xbcfb('0x3e')]);var _0x5b7515={'where':_0x1b576b[_0xbcfb('0x3a')]};return db['VoiceMusicOnHold'][_0xbcfb('0x1b')](_0x5b7515)['then'](function(_0x479e79){_0x10fc16[_0xbcfb('0x1b')]=_0x479e79;if(_0x46fb62[_0xbcfb('0x31')]['includeAll']){_0x1b576b[_0xbcfb('0x3f')]=[{'all':!![]}];}return db[_0xbcfb('0x2c')]['findAll'](_0x1b576b);})['then'](function(_0x5cb872){_0x10fc16[_0xbcfb('0x40')]=_0x5cb872;return _0x10fc16;})['then'](respondWithFilteredResult(_0x26be1b,_0x1b576b))['catch'](handleError(_0x26be1b,null));};exports['show']=function(_0x345ad5,_0x38c374){var _0x3abb0b={'raw':![],'where':{'id':_0x345ad5[_0xbcfb('0x41')]['id']}},_0x3342b7={};_0x3342b7[_0xbcfb('0x30')]=_[_0xbcfb('0x42')](db[_0xbcfb('0x2c')][_0xbcfb('0x2d')]);_0x3342b7['query']=_[_0xbcfb('0x42')](_0x345ad5[_0xbcfb('0x31')]);_0x3342b7['filters']=_['intersection'](_0x3342b7['model'],_0x3342b7['query']);_0x3abb0b['attributes']=_[_0xbcfb('0x33')](_0x3342b7[_0xbcfb('0x30')],qs[_0xbcfb('0x35')](_0x345ad5[_0xbcfb('0x31')][_0xbcfb('0x35')]));_0x3abb0b[_0xbcfb('0x34')]=_0x3abb0b[_0xbcfb('0x34')][_0xbcfb('0x43')]?_0x3abb0b[_0xbcfb('0x34')]:_0x3342b7['model'];if(_0x345ad5['query'][_0xbcfb('0x44')]){_0x3abb0b[_0xbcfb('0x3f')]=[{'all':!![]}];}_0x3abb0b=_[_0xbcfb('0x3d')]({},_0x3abb0b,_0x345ad5['options']);return db['VoiceMusicOnHold'][_0xbcfb('0x45')](_0x3abb0b)[_0xbcfb('0x24')](handleEntityNotFound(_0x38c374,null))[_0xbcfb('0x24')](respondWithResult(_0x38c374,null))['catch'](handleError(_0x38c374,null));};exports[_0xbcfb('0x23')]=function(_0x2ee35f,_0x4558f1){if(_0x2ee35f[_0xbcfb('0x46')]['id']){delete _0x2ee35f['body']['id'];}return db['VoiceMusicOnHold'][_0xbcfb('0x45')]({'where':{'id':_0x2ee35f[_0xbcfb('0x41')]['id']}})[_0xbcfb('0x24')](handleEntityNotFound(_0x4558f1,null))[_0xbcfb('0x24')](saveUpdates(_0x2ee35f[_0xbcfb('0x46')],null))[_0xbcfb('0x24')](respondWithResult(_0x4558f1,null))['catch'](handleError(_0x4558f1,null));};exports[_0xbcfb('0x47')]=function(_0x2ed9de,_0x2e76bb,_0x13d5d6){return db[_0xbcfb('0x48')]['transaction'](function(_0x13d2a5){if(_0x2ed9de[_0xbcfb('0x46')]['mode']==='files'){_0x2ed9de[_0xbcfb('0x46')][_0xbcfb('0x49')]=path[_0xbcfb('0x4a')](config[_0xbcfb('0x4b')],_0xbcfb('0x4c'),_0x2ed9de['body'][_0xbcfb('0x29')]);}return db[_0xbcfb('0x2c')]['create'](_0x2ed9de['body'],{'transaction':_0x13d2a5})['then'](function(_0x567198){if(_0x2ed9de['body'][_0xbcfb('0x4d')]===_0xbcfb('0x4e')){fs['mkdirSync'](_0x567198[_0xbcfb('0x49')],parseInt(_0xbcfb('0x4f'),0x8));}var _0x5c66d8=_0x2ed9de[_0xbcfb('0x50')][_0xbcfb('0x51')]({'plain':!![]});if(!_0x5c66d8)throw new Error(_0xbcfb('0x52'));if(_0x5c66d8[_0xbcfb('0x53')]==='user'){var _0x42fc2f=_0x567198[_0xbcfb('0x51')]({'plain':!![]});return db['UserProfileSection'][_0xbcfb('0x45')]({'where':{'name':_0xbcfb('0x54'),'userProfileId':_0x5c66d8[_0xbcfb('0x55')]},'raw':!![]})[_0xbcfb('0x24')](function(_0x562bc7){if(_0x562bc7&&_0x562bc7['autoAssociation']===0x0){return db[_0xbcfb('0x26')][_0xbcfb('0x47')]({'name':_0x42fc2f[_0xbcfb('0x29')],'resourceId':_0x42fc2f['id'],'type':_0x562bc7[_0xbcfb('0x29')],'sectionId':_0x562bc7['id']},{})[_0xbcfb('0x24')](function(){return _0x567198;});}else{return _0x567198;}})[_0xbcfb('0x56')](function(_0x52d9d6){logger[_0xbcfb('0x27')](_0xbcfb('0x57'),_0x52d9d6);});}return _0x567198;});})['then'](respondWithResult(_0x2e76bb,0xc9))[_0xbcfb('0x56')](handleError(_0x2e76bb,null));};exports[_0xbcfb('0x25')]=function(_0x468d8a,_0x2e0d9b,_0x191b07){var _0x63c2e4;return db[_0xbcfb('0x2c')][_0xbcfb('0x45')]({'where':{'id':_0x468d8a['params']['id']}})[_0xbcfb('0x24')](function(_0x16188c){if(_0x16188c){return db['sequelize'][_0xbcfb('0x58')](function(_0x25c618){return _0x16188c[_0xbcfb('0x25')]({'transaction':_0x25c618,'raw':!![]})[_0xbcfb('0x24')](function(_0x2886ad){if(_0x2886ad['directory']){fs[_0xbcfb('0x59')](_0x2886ad['directory'])[_0xbcfb('0x5a')](function(_0x16c36e){fs[_0xbcfb('0x5b')](path[_0xbcfb('0x4a')](_0x2886ad[_0xbcfb('0x49')],_0x16c36e));});fs[_0xbcfb('0x5c')](_0x2886ad[_0xbcfb('0x49')]);}return _0x2886ad;});})['catch'](function(_0xe7d5bc){throw new db[(_0xbcfb('0x5d'))][(_0xbcfb('0x5e'))](_0xe7d5bc[_0xbcfb('0x5f')]);});}})[_0xbcfb('0x24')](handleEntityNotFound(_0x2e0d9b,null))[_0xbcfb('0x24')](removeEntity(_0x2e0d9b,null))[_0xbcfb('0x56')](handleError(_0x2e0d9b,null));};exports['addSound']=function(_0x2aff69,_0x45cd9a,_0x1db723){return db[_0xbcfb('0x48')][_0xbcfb('0x58')](function(_0x338d2d){var _0x36f183;return db['VoiceMusicOnHold'][_0xbcfb('0x45')]({'where':{'id':_0x2aff69[_0xbcfb('0x41')]['id']}})['then'](function(_0x40296d){if(_0x40296d){_0x36f183=_0x40296d;return _0x40296d[_0xbcfb('0x60')](_0x2aff69['body']['id'],{'transaction':_0x338d2d});}})[_0xbcfb('0x24')](function(_0x2634e6){if(_0x2634e6){return db['Sound']['findOne']({'where':{'id':_0x2aff69[_0xbcfb('0x46')]['id']},'attributes':['id','name','save_name',_0xbcfb('0x61'),_0xbcfb('0x62')],'raw':!![]});}})[_0xbcfb('0x24')](function(_0x1e2324){if(_0x1e2324){var _0x4a775a=path['join'](config[_0xbcfb('0x4b')],_0xbcfb('0x63'),util[_0xbcfb('0x64')]('%s.%s',path[_0xbcfb('0x65')](_0x1e2324[_0xbcfb('0x66')],path['extname'](_0x1e2324[_0xbcfb('0x66')])),_0x1e2324['converted_format']));var _0x413b5a=path['join'](config[_0xbcfb('0x4b')],_0xbcfb('0x4c'),_0x36f183['name'],util[_0xbcfb('0x64')](_0xbcfb('0x67'),_0x1e2324[_0xbcfb('0x29')],_0x1e2324['converted_format']));fs[_0xbcfb('0x68')](_0x4a775a,_0x413b5a);return _0x1e2324;}})[_0xbcfb('0x56')](function(_0x43d6e6){throw new db[(_0xbcfb('0x5d'))][(_0xbcfb('0x5e'))](_0x43d6e6['message']);});})[_0xbcfb('0x24')](handleEntityNotFound(_0x45cd9a,null))['then'](respondWithResult(_0x45cd9a,0xc9))[_0xbcfb('0x56')](handleError(_0x45cd9a,null));};exports[_0xbcfb('0x69')]=function(_0x405aa9,_0x215f2d,_0x1ccc67){return db[_0xbcfb('0x48')][_0xbcfb('0x58')](function(_0x2eb7d2){var _0x3db122;return db[_0xbcfb('0x2c')][_0xbcfb('0x6a')]({'where':{'id':_0x405aa9[_0xbcfb('0x41')]['id']}})[_0xbcfb('0x24')](handleEntityNotFound(_0x215f2d,null))['then'](function(_0x2b8b62){if(_0x2b8b62){_0x3db122=_0x2b8b62;return _0x2b8b62[_0xbcfb('0x69')](_0x405aa9['params'][_0xbcfb('0x6b')]);}})[_0xbcfb('0x24')](function(_0x27e7d8){if(_0x27e7d8){return db[_0xbcfb('0x6c')][_0xbcfb('0x6a')]({'where':{'id':_0x405aa9[_0xbcfb('0x41')][_0xbcfb('0x6b')]},'attributes':['id',_0xbcfb('0x29'),_0xbcfb('0x66'),_0xbcfb('0x61'),_0xbcfb('0x62')],'raw':!![]});}})['then'](function(_0x41ef07){if(_0x41ef07){fs[_0xbcfb('0x5b')](path[_0xbcfb('0x4a')](_0x3db122['directory'],util[_0xbcfb('0x64')]('%s.%s',_0x41ef07['name'],_0x41ef07['converted_format'])));return _0x41ef07;}})[_0xbcfb('0x56')](function(_0x871d85){throw new db['Sequelize']['ValidationError'](_0x871d85['message']);});})[_0xbcfb('0x24')](handleEntityNotFound(_0x215f2d,null))[_0xbcfb('0x24')](respondWithStatusCode(_0x215f2d,0xcc))[_0xbcfb('0x56')](handleError(_0x215f2d,null));};exports[_0xbcfb('0x6d')]=function(_0x35e6c1,_0x10ee6a,_0x2a89ae){var _0x42e751={};var _0x1dd831={};var _0x2f3f75;var _0x653a41;return db[_0xbcfb('0x2c')][_0xbcfb('0x6a')]({'where':{'id':_0x35e6c1['params']['id']}})[_0xbcfb('0x24')](handleEntityNotFound(_0x10ee6a,null))[_0xbcfb('0x24')](function(_0xceb19d){if(_0xceb19d){_0x2f3f75=_0xceb19d;_0x1dd831[_0xbcfb('0x30')]=_['keys'](db['Sound'][_0xbcfb('0x2d')]);_0x1dd831['query']=_['keys'](_0x35e6c1[_0xbcfb('0x31')]);_0x1dd831['filters']=_[_0xbcfb('0x33')](_0x1dd831['model'],_0x1dd831[_0xbcfb('0x31')]);_0x42e751['attributes']=_[_0xbcfb('0x33')](_0x1dd831[_0xbcfb('0x30')],qs[_0xbcfb('0x35')](_0x35e6c1[_0xbcfb('0x31')]['fields']));_0x42e751['attributes']=_0x42e751[_0xbcfb('0x34')][_0xbcfb('0x43')]?_0x42e751[_0xbcfb('0x34')]:_0x1dd831[_0xbcfb('0x30')];_0x42e751[_0xbcfb('0x38')]=qs[_0xbcfb('0x39')](_0x35e6c1[_0xbcfb('0x31')][_0xbcfb('0x39')]);_0x42e751['where']=qs[_0xbcfb('0x32')](_['pick'](_0x35e6c1['query'],_0x1dd831[_0xbcfb('0x32')]));if(_0x35e6c1[_0xbcfb('0x31')][_0xbcfb('0x3c')]){_0x42e751['where']=_[_0xbcfb('0x3d')](_0x42e751[_0xbcfb('0x3a')],{'$or':_[_0xbcfb('0x6e')](_0x42e751[_0xbcfb('0x34')],function(_0x52c783){var _0x1f9c5e={};_0x1f9c5e[_0x52c783]={'$like':'%'+_0x35e6c1['query'][_0xbcfb('0x3c')]+'%'};return _0x1f9c5e;})});}_0x42e751=_['merge']({},_0x42e751,_0x35e6c1['options']);return _0x2f3f75[_0xbcfb('0x6d')](_0x42e751);}})[_0xbcfb('0x24')](function(_0x159f3c){if(_0x159f3c){_0x653a41=_0x159f3c[_0xbcfb('0x43')];if(!_0x35e6c1['query'][_0xbcfb('0x36')](_0xbcfb('0x37'))){_0x42e751[_0xbcfb('0x1d')]=qs[_0xbcfb('0x1d')](_0x35e6c1['query']['limit']);_0x42e751['offset']=qs[_0xbcfb('0x1c')](_0x35e6c1['query'][_0xbcfb('0x1c')]);}return _0x2f3f75['getSounds'](_0x42e751);}})[_0xbcfb('0x24')](function(_0x175c4f){if(_0x175c4f){return _0x175c4f?{'count':_0x653a41,'rows':_0x175c4f}:null;}})[_0xbcfb('0x24')](respondWithResult(_0x10ee6a,null))[_0xbcfb('0x56')](handleError(_0x10ee6a,null));}; \ No newline at end of file +var _0x002b=['Sound','findOne','save_name','converted_format','createdAt','%s.%s','basename','extname','format','symlinkSync','transaction','removeSound','id2','unlinkSync','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','include','findAll','catch','show','find','body','create','mode','files','directory','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','params','readdirSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize'];(function(_0x11e81c,_0x553f40){var _0x111f3d=function(_0xa7e7e4){while(--_0xa7e7e4){_0x11e81c['push'](_0x11e81c['shift']());}};_0x111f3d(++_0x553f40);}(_0x002b,0x7e));var _0xb002=function(_0x58fa29,_0x1135f2){_0x58fa29=_0x58fa29-0x0;var _0x59044e=_0x002b[_0x58fa29];return _0x59044e;};'use strict';var emlformat=require(_0xb002('0x0'));var rimraf=require(_0xb002('0x1'));var zipdir=require(_0xb002('0x2'));var jsonpatch=require(_0xb002('0x3'));var rp=require(_0xb002('0x4'));var moment=require(_0xb002('0x5'));var BPromise=require(_0xb002('0x6'));var Mustache=require(_0xb002('0x7'));var util=require(_0xb002('0x8'));var path=require(_0xb002('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb002('0xa'));var _=require(_0xb002('0xb'));var squel=require(_0xb002('0xc'));var crypto=require(_0xb002('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb002('0xe'));var toCsv=require(_0xb002('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb002('0x10'));var qs=require(_0xb002('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb002('0x12'));var logger=require('../../config/logger')(_0xb002('0x13'));var utils=require(_0xb002('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb002('0x15'))['db'];function respondWithStatusCode(_0x4deb8a,_0x87de47){_0x87de47=_0x87de47||0xcc;return function(_0x1fb068){if(_0x1fb068){return _0x4deb8a[_0xb002('0x16')](_0x87de47);}return _0x4deb8a[_0xb002('0x17')](_0x87de47)[_0xb002('0x18')]();};}function respondWithResult(_0x54c489,_0x4db9eb){_0x4db9eb=_0x4db9eb||0xc8;return function(_0x594248){if(_0x594248){return _0x54c489[_0xb002('0x17')](_0x4db9eb)[_0xb002('0x19')](_0x594248);}};}function respondWithFilteredResult(_0x129bf5,_0x1913cc){return function(_0x21ea8a){if(_0x21ea8a){var _0x32322a=typeof _0x1913cc[_0xb002('0x1a')]==='undefined'&&typeof _0x1913cc[_0xb002('0x1b')]==='undefined';var _0x4b36fc=_0x21ea8a[_0xb002('0x1c')];var _0x4af4bf=_0x32322a?0x0:_0x1913cc[_0xb002('0x1a')];var _0x5d99e4=_0x32322a?_0x21ea8a[_0xb002('0x1c')]:_0x1913cc[_0xb002('0x1a')]+_0x1913cc[_0xb002('0x1b')];var _0x49f4e0;if(_0x5d99e4>=_0x4b36fc){_0x5d99e4=_0x4b36fc;_0x49f4e0=0xc8;}else{_0x49f4e0=0xce;}_0x129bf5[_0xb002('0x17')](_0x49f4e0);return _0x129bf5[_0xb002('0x1d')](_0xb002('0x1e'),_0x4af4bf+'-'+_0x5d99e4+'/'+_0x4b36fc)[_0xb002('0x19')](_0x21ea8a);}return null;};}function patchUpdates(_0x5cf0f6){return function(_0x153632){try{jsonpatch['apply'](_0x153632,_0x5cf0f6,!![]);}catch(_0x2f78fc){return BPromise[_0xb002('0x1f')](_0x2f78fc);}return _0x153632[_0xb002('0x20')]();};}function saveUpdates(_0x425da3,_0x10452a){return function(_0xd7d666){if(_0xd7d666){return _0xd7d666[_0xb002('0x21')](_0x425da3)['then'](function(_0xcc5f04){return _0xcc5f04;});}return null;};}function removeEntity(_0x2c1e61,_0x436752){return function(_0x388dac){if(_0x388dac){return _0x388dac[_0xb002('0x22')]()[_0xb002('0x23')](function(){var _0x2ae94b=_0x388dac[_0xb002('0x24')]({'plain':!![]});var _0x43dbd7='MusicOnHolds';return db[_0xb002('0x25')][_0xb002('0x22')]({'where':{'type':_0x43dbd7,'resourceId':_0x2ae94b['id']}})[_0xb002('0x23')](function(){return _0x388dac;});})[_0xb002('0x23')](function(){_0x2c1e61['status'](0xcc)[_0xb002('0x18')]();});}};}function handleEntityNotFound(_0x21b572,_0x3ac735){return function(_0x3feeb2){if(!_0x3feeb2){_0x21b572[_0xb002('0x16')](0x194);}return _0x3feeb2;};}function handleError(_0x3a8517,_0x2dc8d4){_0x2dc8d4=_0x2dc8d4||0x1f4;return function(_0x17b42b){logger[_0xb002('0x26')](_0x17b42b[_0xb002('0x27')]);if(_0x17b42b['name']){delete _0x17b42b[_0xb002('0x28')];}_0x3a8517[_0xb002('0x17')](_0x2dc8d4)[_0xb002('0x29')](_0x17b42b);};}exports['index']=function(_0x1bc42e,_0x509fb0){var _0x6426f6={},_0x365895={},_0x5aa767={'count':0x0,'rows':[]};var _0xd49d8c=_[_0xb002('0x2a')](db[_0xb002('0x2b')][_0xb002('0x2c')],function(_0x1aa110){return{'name':_0x1aa110[_0xb002('0x2d')],'type':_0x1aa110[_0xb002('0x2e')][_0xb002('0x2f')]};});_0x365895[_0xb002('0x30')]=_[_0xb002('0x2a')](_0xd49d8c,_0xb002('0x28'));_0x365895[_0xb002('0x31')]=_[_0xb002('0x32')](_0x1bc42e[_0xb002('0x31')]);_0x365895[_0xb002('0x33')]=_[_0xb002('0x34')](_0x365895['model'],_0x365895[_0xb002('0x31')]);_0x6426f6[_0xb002('0x35')]=_[_0xb002('0x34')](_0x365895[_0xb002('0x30')],qs[_0xb002('0x36')](_0x1bc42e[_0xb002('0x31')][_0xb002('0x36')]));_0x6426f6[_0xb002('0x35')]=_0x6426f6['attributes'][_0xb002('0x37')]?_0x6426f6[_0xb002('0x35')]:_0x365895[_0xb002('0x30')];if(!_0x1bc42e['query'][_0xb002('0x38')]('nolimit')){_0x6426f6[_0xb002('0x1b')]=qs[_0xb002('0x1b')](_0x1bc42e[_0xb002('0x31')]['limit']);_0x6426f6[_0xb002('0x1a')]=qs[_0xb002('0x1a')](_0x1bc42e[_0xb002('0x31')][_0xb002('0x1a')]);}_0x6426f6[_0xb002('0x39')]=qs[_0xb002('0x3a')](_0x1bc42e['query'][_0xb002('0x3a')]);delete _0x1bc42e['query'][_0xb002('0x3a')];_0x6426f6[_0xb002('0x3b')]=qs[_0xb002('0x33')](_['pick'](_0x1bc42e['query'],_0x365895[_0xb002('0x33')]),_0xd49d8c);if(_0x1bc42e[_0xb002('0x31')]['filter']){_0x6426f6[_0xb002('0x3b')]=_[_0xb002('0x3c')](_0x6426f6[_0xb002('0x3b')],{'$or':_[_0xb002('0x2a')](_0xd49d8c,function(_0x264285){if(_0x264285[_0xb002('0x2e')]!=='VIRTUAL'){var _0x9725da={};_0x9725da[_0x264285[_0xb002('0x28')]]={'$like':'%'+_0x1bc42e[_0xb002('0x31')][_0xb002('0x3d')]+'%'};return _0x9725da;}})});}_0x6426f6=_[_0xb002('0x3c')]({},_0x6426f6,_0x1bc42e[_0xb002('0x3e')]);var _0x3848c0={'where':_0x6426f6[_0xb002('0x3b')]};return db['VoiceMusicOnHold'][_0xb002('0x1c')](_0x3848c0)['then'](function(_0x5f0108){_0x5aa767['count']=_0x5f0108;if(_0x1bc42e[_0xb002('0x31')][_0xb002('0x3f')]){_0x6426f6[_0xb002('0x40')]=[{'all':!![]}];}return db[_0xb002('0x2b')][_0xb002('0x41')](_0x6426f6);})[_0xb002('0x23')](function(_0x417875){_0x5aa767['rows']=_0x417875;return _0x5aa767;})[_0xb002('0x23')](respondWithFilteredResult(_0x509fb0,_0x6426f6))[_0xb002('0x42')](handleError(_0x509fb0,null));};exports[_0xb002('0x43')]=function(_0x1a93e9,_0x178b68){var _0x446806={'raw':![],'where':{'id':_0x1a93e9['params']['id']}},_0x20e0bc={};_0x20e0bc[_0xb002('0x30')]=_[_0xb002('0x32')](db[_0xb002('0x2b')][_0xb002('0x2c')]);_0x20e0bc[_0xb002('0x31')]=_[_0xb002('0x32')](_0x1a93e9[_0xb002('0x31')]);_0x20e0bc[_0xb002('0x33')]=_['intersection'](_0x20e0bc[_0xb002('0x30')],_0x20e0bc[_0xb002('0x31')]);_0x446806[_0xb002('0x35')]=_['intersection'](_0x20e0bc[_0xb002('0x30')],qs['fields'](_0x1a93e9[_0xb002('0x31')]['fields']));_0x446806['attributes']=_0x446806[_0xb002('0x35')]['length']?_0x446806[_0xb002('0x35')]:_0x20e0bc['model'];if(_0x1a93e9[_0xb002('0x31')]['includeAll']){_0x446806[_0xb002('0x40')]=[{'all':!![]}];}_0x446806=_['merge']({},_0x446806,_0x1a93e9['options']);return db[_0xb002('0x2b')][_0xb002('0x44')](_0x446806)[_0xb002('0x23')](handleEntityNotFound(_0x178b68,null))[_0xb002('0x23')](respondWithResult(_0x178b68,null))['catch'](handleError(_0x178b68,null));};exports[_0xb002('0x21')]=function(_0x5b3fe1,_0x30fa1b){if(_0x5b3fe1[_0xb002('0x45')]['id']){delete _0x5b3fe1['body']['id'];}return db[_0xb002('0x2b')][_0xb002('0x44')]({'where':{'id':_0x5b3fe1['params']['id']}})[_0xb002('0x23')](handleEntityNotFound(_0x30fa1b,null))[_0xb002('0x23')](saveUpdates(_0x5b3fe1[_0xb002('0x45')],null))[_0xb002('0x23')](respondWithResult(_0x30fa1b,null))[_0xb002('0x42')](handleError(_0x30fa1b,null));};exports[_0xb002('0x46')]=function(_0x5bee46,_0x567ec7,_0x5315f6){return db['sequelize']['transaction'](function(_0x43c142){if(_0x5bee46[_0xb002('0x45')][_0xb002('0x47')]===_0xb002('0x48')){_0x5bee46[_0xb002('0x45')][_0xb002('0x49')]=path['join'](config[_0xb002('0x4a')],_0xb002('0x4b'),_0x5bee46[_0xb002('0x45')][_0xb002('0x28')]);}return db[_0xb002('0x2b')][_0xb002('0x46')](_0x5bee46[_0xb002('0x45')],{'transaction':_0x43c142})[_0xb002('0x23')](function(_0x5e0635){if(_0x5bee46[_0xb002('0x45')][_0xb002('0x47')]===_0xb002('0x48')){fs[_0xb002('0x4c')](_0x5e0635[_0xb002('0x49')],parseInt(_0xb002('0x4d'),0x8));}var _0x23eb32=_0x5bee46[_0xb002('0x4e')][_0xb002('0x24')]({'plain':!![]});if(!_0x23eb32)throw new Error(_0xb002('0x4f'));if(_0x23eb32[_0xb002('0x50')]===_0xb002('0x4e')){var _0x2f78ca=_0x5e0635['get']({'plain':!![]});return db[_0xb002('0x51')]['find']({'where':{'name':_0xb002('0x52'),'userProfileId':_0x23eb32[_0xb002('0x53')]},'raw':!![]})['then'](function(_0x47dbb5){if(_0x47dbb5&&_0x47dbb5[_0xb002('0x54')]===0x0){return db[_0xb002('0x25')]['create']({'name':_0x2f78ca[_0xb002('0x28')],'resourceId':_0x2f78ca['id'],'type':_0x47dbb5[_0xb002('0x28')],'sectionId':_0x47dbb5['id']},{})[_0xb002('0x23')](function(){return _0x5e0635;});}else{return _0x5e0635;}})[_0xb002('0x42')](function(_0x5013a6){logger[_0xb002('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5013a6);});}return _0x5e0635;});})[_0xb002('0x23')](respondWithResult(_0x567ec7,0xc9))[_0xb002('0x42')](handleError(_0x567ec7,null));};exports['destroy']=function(_0x12bfb2,_0x4e2eed,_0x50f0e5){var _0x173b51;return db[_0xb002('0x2b')][_0xb002('0x44')]({'where':{'id':_0x12bfb2[_0xb002('0x55')]['id']}})[_0xb002('0x23')](function(_0xe476e7){if(_0xe476e7){return db['sequelize']['transaction'](function(_0x80beed){return _0xe476e7[_0xb002('0x22')]({'transaction':_0x80beed,'raw':!![]})[_0xb002('0x23')](function(_0x3be2d5){if(_0x3be2d5[_0xb002('0x49')]){fs[_0xb002('0x56')](_0x3be2d5[_0xb002('0x49')])['forEach'](function(_0x205c91){fs['unlinkSync'](path[_0xb002('0x57')](_0x3be2d5[_0xb002('0x49')],_0x205c91));});fs[_0xb002('0x58')](_0x3be2d5[_0xb002('0x49')]);}return _0x3be2d5;});})[_0xb002('0x42')](function(_0x3f832c){throw new db[(_0xb002('0x59'))][(_0xb002('0x5a'))](_0x3f832c[_0xb002('0x5b')]);});}})['then'](handleEntityNotFound(_0x4e2eed,null))[_0xb002('0x23')](removeEntity(_0x4e2eed,null))[_0xb002('0x42')](handleError(_0x4e2eed,null));};exports[_0xb002('0x5c')]=function(_0x1d4d26,_0x59f1c4,_0x142da4){return db[_0xb002('0x5d')]['transaction'](function(_0x171b9d){var _0x100c74;return db[_0xb002('0x2b')][_0xb002('0x44')]({'where':{'id':_0x1d4d26[_0xb002('0x55')]['id']}})['then'](function(_0x2d6b84){if(_0x2d6b84){_0x100c74=_0x2d6b84;return _0x2d6b84[_0xb002('0x5c')](_0x1d4d26['body']['id'],{'transaction':_0x171b9d});}})['then'](function(_0x101ce3){if(_0x101ce3){return db[_0xb002('0x5e')][_0xb002('0x5f')]({'where':{'id':_0x1d4d26['body']['id']},'attributes':['id',_0xb002('0x28'),_0xb002('0x60'),_0xb002('0x61'),_0xb002('0x62')],'raw':!![]});}})[_0xb002('0x23')](function(_0x4bb252){if(_0x4bb252){var _0x53a221=path[_0xb002('0x57')](config[_0xb002('0x4a')],'server/files/sounds/converted',util['format'](_0xb002('0x63'),path[_0xb002('0x64')](_0x4bb252[_0xb002('0x60')],path[_0xb002('0x65')](_0x4bb252[_0xb002('0x60')])),_0x4bb252[_0xb002('0x61')]));var _0x11c2ec=path[_0xb002('0x57')](config[_0xb002('0x4a')],_0xb002('0x4b'),_0x100c74[_0xb002('0x28')],util[_0xb002('0x66')]('%s.%s',_0x4bb252[_0xb002('0x28')],_0x4bb252[_0xb002('0x61')]));fs[_0xb002('0x67')](_0x53a221,_0x11c2ec);return _0x4bb252;}})['catch'](function(_0x3c03a5){throw new db[(_0xb002('0x59'))][(_0xb002('0x5a'))](_0x3c03a5[_0xb002('0x5b')]);});})[_0xb002('0x23')](handleEntityNotFound(_0x59f1c4,null))[_0xb002('0x23')](respondWithResult(_0x59f1c4,0xc9))[_0xb002('0x42')](handleError(_0x59f1c4,null));};exports['removeSound']=function(_0x2dc965,_0x1b3f9a,_0x5d747e){return db[_0xb002('0x5d')][_0xb002('0x68')](function(_0x1b86de){var _0x54722b;return db['VoiceMusicOnHold'][_0xb002('0x5f')]({'where':{'id':_0x2dc965[_0xb002('0x55')]['id']}})[_0xb002('0x23')](handleEntityNotFound(_0x1b3f9a,null))[_0xb002('0x23')](function(_0x535637){if(_0x535637){_0x54722b=_0x535637;return _0x535637[_0xb002('0x69')](_0x2dc965[_0xb002('0x55')][_0xb002('0x6a')]);}})['then'](function(_0x4ee7f1){if(_0x4ee7f1){return db[_0xb002('0x5e')][_0xb002('0x5f')]({'where':{'id':_0x2dc965[_0xb002('0x55')][_0xb002('0x6a')]},'attributes':['id',_0xb002('0x28'),'save_name',_0xb002('0x61'),_0xb002('0x62')],'raw':!![]});}})[_0xb002('0x23')](function(_0x32529d){if(_0x32529d){fs[_0xb002('0x6b')](path[_0xb002('0x57')](_0x54722b[_0xb002('0x49')],util[_0xb002('0x66')](_0xb002('0x63'),_0x32529d[_0xb002('0x28')],_0x32529d[_0xb002('0x61')])));return _0x32529d;}})[_0xb002('0x42')](function(_0x272432){throw new db['Sequelize'][(_0xb002('0x5a'))](_0x272432[_0xb002('0x5b')]);});})[_0xb002('0x23')](handleEntityNotFound(_0x1b3f9a,null))[_0xb002('0x23')](respondWithStatusCode(_0x1b3f9a,0xcc))[_0xb002('0x42')](handleError(_0x1b3f9a,null));};exports[_0xb002('0x6c')]=function(_0xca82a5,_0x162ab5,_0x4261db){var _0x23d3bc={};var _0xece4d4={};var _0x3a36b3;var _0x4e722c;return db[_0xb002('0x2b')][_0xb002('0x5f')]({'where':{'id':_0xca82a5['params']['id']}})[_0xb002('0x23')](handleEntityNotFound(_0x162ab5,null))[_0xb002('0x23')](function(_0x700d21){if(_0x700d21){_0x3a36b3=_0x700d21;_0xece4d4[_0xb002('0x30')]=_[_0xb002('0x32')](db[_0xb002('0x5e')][_0xb002('0x2c')]);_0xece4d4[_0xb002('0x31')]=_[_0xb002('0x32')](_0xca82a5[_0xb002('0x31')]);_0xece4d4[_0xb002('0x33')]=_[_0xb002('0x34')](_0xece4d4['model'],_0xece4d4[_0xb002('0x31')]);_0x23d3bc[_0xb002('0x35')]=_['intersection'](_0xece4d4['model'],qs[_0xb002('0x36')](_0xca82a5[_0xb002('0x31')][_0xb002('0x36')]));_0x23d3bc[_0xb002('0x35')]=_0x23d3bc[_0xb002('0x35')][_0xb002('0x37')]?_0x23d3bc[_0xb002('0x35')]:_0xece4d4[_0xb002('0x30')];_0x23d3bc[_0xb002('0x39')]=qs['sort'](_0xca82a5[_0xb002('0x31')][_0xb002('0x3a')]);_0x23d3bc[_0xb002('0x3b')]=qs[_0xb002('0x33')](_['pick'](_0xca82a5[_0xb002('0x31')],_0xece4d4['filters']));if(_0xca82a5[_0xb002('0x31')][_0xb002('0x3d')]){_0x23d3bc[_0xb002('0x3b')]=_[_0xb002('0x3c')](_0x23d3bc['where'],{'$or':_[_0xb002('0x2a')](_0x23d3bc[_0xb002('0x35')],function(_0x379efa){var _0x32c0af={};_0x32c0af[_0x379efa]={'$like':'%'+_0xca82a5[_0xb002('0x31')][_0xb002('0x3d')]+'%'};return _0x32c0af;})});}_0x23d3bc=_[_0xb002('0x3c')]({},_0x23d3bc,_0xca82a5[_0xb002('0x3e')]);return _0x3a36b3[_0xb002('0x6c')](_0x23d3bc);}})[_0xb002('0x23')](function(_0x1444b1){if(_0x1444b1){_0x4e722c=_0x1444b1[_0xb002('0x37')];if(!_0xca82a5[_0xb002('0x31')][_0xb002('0x38')](_0xb002('0x6d'))){_0x23d3bc[_0xb002('0x1b')]=qs[_0xb002('0x1b')](_0xca82a5[_0xb002('0x31')][_0xb002('0x1b')]);_0x23d3bc[_0xb002('0x1a')]=qs[_0xb002('0x1a')](_0xca82a5[_0xb002('0x31')][_0xb002('0x1a')]);}return _0x3a36b3[_0xb002('0x6c')](_0x23d3bc);}})[_0xb002('0x23')](function(_0xe9d16b){if(_0xe9d16b){return _0xe9d16b?{'count':_0x4e722c,'rows':_0xe9d16b}:null;}})[_0xb002('0x23')](respondWithResult(_0x162ab5,null))[_0xb002('0x42')](handleError(_0x162ab5,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b69019d..8b4211b 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 _0x0587=['path','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','lodash','util','api','bluebird','request-promise'];(function(_0x3be801,_0x3abd88){var _0x107c60=function(_0x426d0a){while(--_0x426d0a){_0x3be801['push'](_0x3be801['shift']());}};_0x107c60(++_0x3abd88);}(_0x0587,0x181));var _0x7058=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x0587[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0x7058('0x0'));var util=require(_0x7058('0x1'));var logger=require('../../config/logger')(_0x7058('0x2'));var moment=require('moment');var BPromise=require(_0x7058('0x3'));var rp=require(_0x7058('0x4'));var fs=require('fs');var path=require(_0x7058('0x5'));var rimraf=require('rimraf');var config=require(_0x7058('0x6'));var attributes=require(_0x7058('0x7'));module['exports']=function(_0x2efca6,_0x4d7022){return _0x2efca6[_0x7058('0x8')](_0x7058('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e90=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','util','api','moment','request-promise','../../config/environment'];(function(_0x4da681,_0x36adfe){var _0x5ae40d=function(_0x377250){while(--_0x377250){_0x4da681['push'](_0x4da681['shift']());}};_0x5ae40d(++_0x36adfe);}(_0x6e90,0x94));var _0x06e9=function(_0x522065,_0x3e8f15){_0x522065=_0x522065-0x0;var _0x55532b=_0x6e90[_0x522065];return _0x55532b;};'use strict';var _=require('lodash');var util=require(_0x06e9('0x0'));var logger=require('../../config/logger')(_0x06e9('0x1'));var moment=require(_0x06e9('0x2'));var BPromise=require('bluebird');var rp=require(_0x06e9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x06e9('0x4'));var attributes=require(_0x06e9('0x5'));module[_0x06e9('0x6')]=function(_0x1d6e89,_0x5e4648){return _0x1d6e89[_0x06e9('0x7')](_0x06e9('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 9211426..ff0ab37 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 _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(_0x51c333,_0x515495){var _0x5551ab=function(_0x338f37){while(--_0x338f37){_0x51c333['push'](_0x51c333['shift']());}};_0x5551ab(++_0x515495);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x53c41e,_0x38f29b){var _0x4554da=function(_0x169fbc){while(--_0x169fbc){_0x53c41e['push'](_0x53c41e['shift']());}};_0x4554da(++_0x38f29b);}(_0x70e0,0x17b));var _0x070e=function(_0x5caaac,_0x409fba){_0x5caaac=_0x5caaac-0x0;var _0xea1d84=_0x70e0[_0x5caaac];return _0xea1d84;};'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')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3a8d41e..67c1d64 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 _0x4b6c=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports'];(function(_0x1ce9ea,_0x32e6f4){var _0x2a95b9=function(_0x1a0496){while(--_0x1a0496){_0x1ce9ea['push'](_0x1ce9ea['shift']());}};_0x2a95b9(++_0x32e6f4);}(_0x4b6c,0xaf));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc4b6('0x0'));var util=require('util');var path=require(_0xc4b6('0x1'));var timeout=require(_0xc4b6('0x2'));var express=require(_0xc4b6('0x3'));var router=express[_0xc4b6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc4b6('0x5'));var interaction=require(_0xc4b6('0x6'));var config=require(_0xc4b6('0x7'));var controller=require('./voicePrefix.controller');router[_0xc4b6('0x8')]('/',auth[_0xc4b6('0x9')](),controller[_0xc4b6('0xa')]);router[_0xc4b6('0x8')](_0xc4b6('0xb'),auth[_0xc4b6('0x9')](),controller['describe']);router[_0xc4b6('0x8')](_0xc4b6('0xc'),auth['isAuthenticated'](),controller[_0xc4b6('0xd')]);router['get'](_0xc4b6('0xe'),auth[_0xc4b6('0x9')](),controller[_0xc4b6('0xf')]);router[_0xc4b6('0x10')]('/',auth['isAuthenticated'](),controller[_0xc4b6('0x11')]);router[_0xc4b6('0x10')](_0xc4b6('0xe'),auth['isAuthenticated'](),controller[_0xc4b6('0x12')]);router[_0xc4b6('0x13')](_0xc4b6('0xc'),auth[_0xc4b6('0x9')](),controller[_0xc4b6('0x14')]);router[_0xc4b6('0x15')](_0xc4b6('0xc'),auth[_0xc4b6('0x9')](),controller[_0xc4b6('0x16')]);router[_0xc4b6('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xc4b6('0x17')]);module[_0xc4b6('0x18')]=router; \ No newline at end of file +var _0x58ce=['/:id/users','getAgents','post','create','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x58ce,0x14e));var _0xe58c=function(_0x257b6e,_0xddbfb8){_0x257b6e=_0x257b6e-0x0;var _0x17251d=_0x58ce[_0x257b6e];return _0x17251d;};'use strict';var multer=require(_0xe58c('0x0'));var util=require(_0xe58c('0x1'));var path=require(_0xe58c('0x2'));var timeout=require(_0xe58c('0x3'));var express=require(_0xe58c('0x4'));var router=express['Router']();var fs_extra=require(_0xe58c('0x5'));var auth=require(_0xe58c('0x6'));var interaction=require(_0xe58c('0x7'));var config=require(_0xe58c('0x8'));var controller=require(_0xe58c('0x9'));router[_0xe58c('0xa')]('/',auth['isAuthenticated'](),controller[_0xe58c('0xb')]);router['get'](_0xe58c('0xc'),auth['isAuthenticated'](),controller[_0xe58c('0xd')]);router[_0xe58c('0xa')](_0xe58c('0xe'),auth[_0xe58c('0xf')](),controller[_0xe58c('0x10')]);router[_0xe58c('0xa')](_0xe58c('0x11'),auth[_0xe58c('0xf')](),controller[_0xe58c('0x12')]);router[_0xe58c('0x13')]('/',auth[_0xe58c('0xf')](),controller[_0xe58c('0x14')]);router[_0xe58c('0x13')](_0xe58c('0x11'),auth[_0xe58c('0xf')](),controller['addAgents']);router[_0xe58c('0x15')]('/:id',auth[_0xe58c('0xf')](),controller[_0xe58c('0x16')]);router[_0xe58c('0x17')]('/:id',auth[_0xe58c('0xf')](),controller[_0xe58c('0x18')]);router[_0xe58c('0x17')]('/:id/users',auth[_0xe58c('0xf')](),controller[_0xe58c('0x19')]);module[_0xe58c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d17881c..c845059 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 _0xc496=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x58bdd8,_0x1de16f){var _0x7870ad=function(_0x294bf6){while(--_0x294bf6){_0x58bdd8['push'](_0x58bdd8['shift']());}};_0x7870ad(++_0x1de16f);}(_0xc496,0xba));var _0x6c49=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0xc496[_0x219fa0];return _0xc603fb;};'use strict';var Sequelize=require(_0x6c49('0x0'));module[_0x6c49('0x1')]={'name':{'type':Sequelize[_0x6c49('0x2')],'allowNull':![],'unique':_0x6c49('0x3')},'prefix':{'type':Sequelize[_0x6c49('0x4')],'get':function(_0x54e0af){return _0x6c49('0x5')+this[_0x6c49('0x6')](_0x6c49('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x6c49('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x6c49('0x7')]}}; \ No newline at end of file +var _0x28d7=['exports','STRING','name','system-','getDataValue','sequelize'];(function(_0x222708,_0x1ab3d4){var _0x28581e=function(_0x3efe2c){while(--_0x3efe2c){_0x222708['push'](_0x222708['shift']());}};_0x28581e(++_0x1ab3d4);}(_0x28d7,0x9b));var _0x728d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28d7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x728d('0x0'));module[_0x728d('0x1')]={'name':{'type':Sequelize[_0x728d('0x2')],'allowNull':![],'unique':_0x728d('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1f254e){return _0x728d('0x4')+this[_0x728d('0x5')](_0x728d('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x728d('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 6d81991..4b0f06c 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 _0xe7a0=['push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','emit','ids','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','nolimit','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','VoicePrefixes','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VoicePrefix','rows','catch','show','params','keys','includeAll','include','options','find','create','sequelize','transaction','body','VoiceExtensionId','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed'];(function(_0x42541e,_0xc98824){var _0x1325e4=function(_0x25c7a3){while(--_0x25c7a3){_0x42541e['push'](_0x42541e['shift']());}};_0x1325e4(++_0xc98824);}(_0xe7a0,0x10d));var _0x0e7a=function(_0x48eaa0,_0x3b4a47){_0x48eaa0=_0x48eaa0-0x0;var _0x492ed8=_0xe7a0[_0x48eaa0];return _0x492ed8;};'use strict';var emlformat=require(_0x0e7a('0x0'));var rimraf=require(_0x0e7a('0x1'));var zipdir=require(_0x0e7a('0x2'));var jsonpatch=require(_0x0e7a('0x3'));var rp=require(_0x0e7a('0x4'));var moment=require(_0x0e7a('0x5'));var BPromise=require(_0x0e7a('0x6'));var Mustache=require(_0x0e7a('0x7'));var util=require('util');var path=require(_0x0e7a('0x8'));var sox=require(_0x0e7a('0x9'));var csv=require(_0x0e7a('0xa'));var ejs=require(_0x0e7a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e7a('0xc'));var squel=require(_0x0e7a('0xd'));var crypto=require(_0x0e7a('0xe'));var jsforce=require(_0x0e7a('0xf'));var deskjs=require(_0x0e7a('0x10'));var toCsv=require(_0x0e7a('0xa'));var querystring=require(_0x0e7a('0x11'));var Papa=require(_0x0e7a('0x12'));var Redis=require('ioredis');var authService=require(_0x0e7a('0x13'));var qs=require(_0x0e7a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e7a('0x15'));var logger=require(_0x0e7a('0x16'))(_0x0e7a('0x17'));var utils=require(_0x0e7a('0x18'));var config=require(_0x0e7a('0x19'));var licenseUtil=require(_0x0e7a('0x1a'));var db=require(_0x0e7a('0x1b'))['db'];config['redis']=_[_0x0e7a('0x1c')](config[_0x0e7a('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e7a('0x1e'))(new Redis(config[_0x0e7a('0x1d')]));require(_0x0e7a('0x1f'))[_0x0e7a('0x20')](socket);function respondWithStatusCode(_0x3caf70,_0x233a44){_0x233a44=_0x233a44||0xcc;return function(_0x4e7ff7){if(_0x4e7ff7){return _0x3caf70[_0x0e7a('0x21')](_0x233a44);}return _0x3caf70[_0x0e7a('0x22')](_0x233a44)[_0x0e7a('0x23')]();};}function respondWithResult(_0x45b7f5,_0x1f2a37){_0x1f2a37=_0x1f2a37||0xc8;return function(_0xd7fe58){if(_0xd7fe58){return _0x45b7f5[_0x0e7a('0x22')](_0x1f2a37)['json'](_0xd7fe58);}};}function respondWithFilteredResult(_0x4f2195,_0x47b18f){return function(_0x3e637c){if(_0x3e637c){var _0x55d8ea=typeof _0x47b18f[_0x0e7a('0x24')]===_0x0e7a('0x25')&&typeof _0x47b18f[_0x0e7a('0x26')]===_0x0e7a('0x25');var _0x387c88=_0x3e637c['count'];var _0x33ec17=_0x55d8ea?0x0:_0x47b18f['offset'];var _0x217c59=_0x55d8ea?_0x3e637c[_0x0e7a('0x27')]:_0x47b18f[_0x0e7a('0x24')]+_0x47b18f[_0x0e7a('0x26')];var _0xf09810;if(_0x217c59>=_0x387c88){_0x217c59=_0x387c88;_0xf09810=0xc8;}else{_0xf09810=0xce;}_0x4f2195[_0x0e7a('0x22')](_0xf09810);return _0x4f2195[_0x0e7a('0x28')]('Content-Range',_0x33ec17+'-'+_0x217c59+'/'+_0x387c88)[_0x0e7a('0x29')](_0x3e637c);}return null;};}function patchUpdates(_0x233fb5){return function(_0x3e722b){try{jsonpatch[_0x0e7a('0x2a')](_0x3e722b,_0x233fb5,!![]);}catch(_0x19d5eb){return BPromise['reject'](_0x19d5eb);}return _0x3e722b[_0x0e7a('0x2b')]();};}function saveUpdates(_0x37d7e9,_0x47c5a7){return function(_0xaa1482){if(_0xaa1482){return _0xaa1482[_0x0e7a('0x2c')](_0x37d7e9)[_0x0e7a('0x2d')](function(_0x33d8d3){return _0x33d8d3;});}return null;};}function removeEntity(_0x132af0,_0x4b01f6){return function(_0x59bc3c){if(_0x59bc3c){return _0x59bc3c[_0x0e7a('0x2e')]()[_0x0e7a('0x2d')](function(){var _0x1ca380=_0x59bc3c['get']({'plain':!![]});var _0x1bf4b1=_0x0e7a('0x2f');return db[_0x0e7a('0x30')][_0x0e7a('0x2e')]({'where':{'type':_0x1bf4b1,'resourceId':_0x1ca380['id']}})[_0x0e7a('0x2d')](function(){return _0x59bc3c;});})['then'](function(){_0x132af0[_0x0e7a('0x22')](0xcc)[_0x0e7a('0x23')]();});}};}function handleEntityNotFound(_0x1c95bd,_0x81d6b){return function(_0x236b21){if(!_0x236b21){_0x1c95bd[_0x0e7a('0x21')](0x194);}return _0x236b21;};}function handleError(_0x3335b3,_0x3aaef6){_0x3aaef6=_0x3aaef6||0x1f4;return function(_0x488a33){logger[_0x0e7a('0x31')](_0x488a33['stack']);if(_0x488a33[_0x0e7a('0x32')]){delete _0x488a33[_0x0e7a('0x32')];}_0x3335b3[_0x0e7a('0x22')](_0x3aaef6)['send'](_0x488a33);};}exports[_0x0e7a('0x33')]=function(_0x3fe9a5,_0x1043c1){var _0xe4e32c={},_0x2b2272={},_0x49a36a={'count':0x0,'rows':[]};var _0x4d64c4=_[_0x0e7a('0x34')](db['VoicePrefix'][_0x0e7a('0x35')],function(_0x25ab16){return{'name':_0x25ab16[_0x0e7a('0x36')],'type':_0x25ab16[_0x0e7a('0x37')][_0x0e7a('0x38')]};});_0x2b2272[_0x0e7a('0x39')]=_[_0x0e7a('0x34')](_0x4d64c4,_0x0e7a('0x32'));_0x2b2272[_0x0e7a('0x3a')]=_['keys'](_0x3fe9a5['query']);_0x2b2272[_0x0e7a('0x3b')]=_[_0x0e7a('0x3c')](_0x2b2272[_0x0e7a('0x39')],_0x2b2272[_0x0e7a('0x3a')]);_0xe4e32c[_0x0e7a('0x3d')]=_[_0x0e7a('0x3c')](_0x2b2272[_0x0e7a('0x39')],qs[_0x0e7a('0x3e')](_0x3fe9a5['query'][_0x0e7a('0x3e')]));_0xe4e32c[_0x0e7a('0x3d')]=_0xe4e32c[_0x0e7a('0x3d')][_0x0e7a('0x3f')]?_0xe4e32c['attributes']:_0x2b2272[_0x0e7a('0x39')];if(!_0x3fe9a5[_0x0e7a('0x3a')][_0x0e7a('0x40')]('nolimit')){_0xe4e32c[_0x0e7a('0x26')]=qs[_0x0e7a('0x26')](_0x3fe9a5[_0x0e7a('0x3a')][_0x0e7a('0x26')]);_0xe4e32c['offset']=qs[_0x0e7a('0x24')](_0x3fe9a5['query']['offset']);}_0xe4e32c[_0x0e7a('0x41')]=qs[_0x0e7a('0x42')](_0x3fe9a5[_0x0e7a('0x3a')][_0x0e7a('0x42')]);_0xe4e32c['where']=qs[_0x0e7a('0x3b')](_[_0x0e7a('0x43')](_0x3fe9a5[_0x0e7a('0x3a')],_0x2b2272['filters']),_0x4d64c4);if(_0x3fe9a5[_0x0e7a('0x3a')][_0x0e7a('0x44')]){_0xe4e32c[_0x0e7a('0x45')]=_[_0x0e7a('0x46')](_0xe4e32c[_0x0e7a('0x45')],{'$or':_[_0x0e7a('0x34')](_0x4d64c4,function(_0xb14778){if(_0xb14778[_0x0e7a('0x37')]!=='VIRTUAL'){var _0x20d269={};_0x20d269[_0xb14778[_0x0e7a('0x32')]]={'$like':'%'+_0x3fe9a5[_0x0e7a('0x3a')][_0x0e7a('0x44')]+'%'};return _0x20d269;}})});}_0xe4e32c=_['merge']({},_0xe4e32c,_0x3fe9a5['options']);var _0x1f983a={'where':_0xe4e32c['where']};return db[_0x0e7a('0x47')][_0x0e7a('0x27')](_0x1f983a)[_0x0e7a('0x2d')](function(_0x21ee37){_0x49a36a['count']=_0x21ee37;if(_0x3fe9a5['query']['includeAll']){_0xe4e32c['include']=[{'all':!![]}];}return db[_0x0e7a('0x47')]['findAll'](_0xe4e32c);})['then'](function(_0x4c57c7){_0x49a36a[_0x0e7a('0x48')]=_0x4c57c7;return _0x49a36a;})[_0x0e7a('0x2d')](respondWithFilteredResult(_0x1043c1,_0xe4e32c))[_0x0e7a('0x49')](handleError(_0x1043c1,null));};exports[_0x0e7a('0x4a')]=function(_0x57a36b,_0x5dd6ef){var _0x567fda={'raw':![],'where':{'id':_0x57a36b[_0x0e7a('0x4b')]['id']}},_0x141b6d={};_0x141b6d[_0x0e7a('0x39')]=_['keys'](db[_0x0e7a('0x47')]['rawAttributes']);_0x141b6d[_0x0e7a('0x3a')]=_[_0x0e7a('0x4c')](_0x57a36b[_0x0e7a('0x3a')]);_0x141b6d[_0x0e7a('0x3b')]=_[_0x0e7a('0x3c')](_0x141b6d[_0x0e7a('0x39')],_0x141b6d[_0x0e7a('0x3a')]);_0x567fda[_0x0e7a('0x3d')]=_[_0x0e7a('0x3c')](_0x141b6d[_0x0e7a('0x39')],qs[_0x0e7a('0x3e')](_0x57a36b['query']['fields']));_0x567fda['attributes']=_0x567fda['attributes'][_0x0e7a('0x3f')]?_0x567fda[_0x0e7a('0x3d')]:_0x141b6d[_0x0e7a('0x39')];if(_0x57a36b[_0x0e7a('0x3a')][_0x0e7a('0x4d')]){_0x567fda[_0x0e7a('0x4e')]=[{'all':!![]}];}_0x567fda=_[_0x0e7a('0x46')]({},_0x567fda,_0x57a36b[_0x0e7a('0x4f')]);return db[_0x0e7a('0x47')][_0x0e7a('0x50')](_0x567fda)['then'](handleEntityNotFound(_0x5dd6ef,null))[_0x0e7a('0x2d')](respondWithResult(_0x5dd6ef,null))[_0x0e7a('0x49')](handleError(_0x5dd6ef,null));};exports[_0x0e7a('0x2e')]=function(_0x585726,_0x5b859a){return db[_0x0e7a('0x47')][_0x0e7a('0x50')]({'where':{'id':_0x585726['params']['id']}})['then'](handleEntityNotFound(_0x5b859a,null))['then'](removeEntity(_0x5b859a,null))[_0x0e7a('0x49')](handleError(_0x5b859a,null));};exports['describe']=function(_0xc79496,_0x9a0357){return db[_0x0e7a('0x47')]['describe']()['then'](respondWithResult(_0x9a0357,null))['catch'](handleError(_0x9a0357,null));};exports[_0x0e7a('0x51')]=function(_0x2e0b49,_0x227f62){var _0x5837da;return db[_0x0e7a('0x52')][_0x0e7a('0x53')](function(_0x48e040){return db['VoicePrefix'][_0x0e7a('0x51')](_0x2e0b49[_0x0e7a('0x54')],{'transaction':_0x48e040})['then'](function(_0x308833){_0x5837da=_0x308833['get']({'plain':!![]});return db['VoiceExtension'][_0x0e7a('0x50')]({'where':{'id':_0x5837da[_0x0e7a('0x55')]},'raw':!![]})[_0x0e7a('0x2d')](function(_0x376c37){return createVoicePrefixExtensions(_0x5837da,_0x376c37,_0x48e040);});});})[_0x0e7a('0x2d')](function(){var _0x174c76=_0x2e0b49[_0x0e7a('0x56')][_0x0e7a('0x57')]({'plain':!![]});if(!_0x174c76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x174c76[_0x0e7a('0x58')]===_0x0e7a('0x56')){var _0x19ab6e=_0x5837da;return db[_0x0e7a('0x59')]['find']({'where':{'name':_0x0e7a('0x2f'),'userProfileId':_0x174c76[_0x0e7a('0x5a')]},'raw':!![]})[_0x0e7a('0x2d')](function(_0x31d58d){if(_0x31d58d&&_0x31d58d[_0x0e7a('0x5b')]===0x0){return db['UserProfileResource'][_0x0e7a('0x51')]({'name':_0x19ab6e[_0x0e7a('0x32')],'resourceId':_0x19ab6e['id'],'type':_0x31d58d['name'],'sectionId':_0x31d58d['id']},{})[_0x0e7a('0x2d')](function(){return _0x5837da;});}else{return _0x5837da;}})[_0x0e7a('0x49')](function(_0x210d78){logger[_0x0e7a('0x31')](_0x0e7a('0x5c'),_0x210d78);throw _0x210d78;});}return _0x5837da;})['then'](respondWithResult(_0x227f62,null))[_0x0e7a('0x49')](handleError(_0x227f62,null));};function Extension(_0x5344e7,_0x5f1bec,_0x240206,_0x1ff689){this[_0x0e7a('0x5d')]=_0x0e7a('0x5e');this['exten']=_0x5344e7;this['app']=_0x240206;this[_0x0e7a('0x37')]='system';this['description']=_0x0e7a('0x5f');this[_0x0e7a('0x60')]=_0x5f1bec;this['appdata']=_0x1ff689;}function createVoicePrefixExtensions(_0x178a65,_0x34f02d,_0x1840a9){return new BPromise(function(_0x19e790,_0x161ac7){var _0x594781=new Extension(formatPrefixName(_0x178a65[_0x0e7a('0x61')]),0x1,'NoOp',_0x0e7a('0x62'));_0x594781[_0x0e7a('0x63')]=_0x178a65['id'];return db[_0x0e7a('0x64')][_0x0e7a('0x51')](_0x594781,{'transaction':_0x1840a9})[_0x0e7a('0x2d')](function(_0xd1c6e0){var _0x48c6e1=_0xd1c6e0['get']({'plain':!![]});var _0x5ddec9=_[_0x0e7a('0x34')](addVoicePrefixExtensions(_0x178a65,_0x34f02d),function(_0x25abff){_0x25abff['VoiceExtensionId']=_0x48c6e1['id'];_0x25abff[_0x0e7a('0x63')]=_0x178a65['id'];return _0x25abff;});return db[_0x0e7a('0x64')][_0x0e7a('0x65')](_0x5ddec9,{'transaction':_0x1840a9})['then'](function(_0xcc9cef){if(!_0xcc9cef){return _0x161ac7(_0x0e7a('0x66'));}else{return _0x19e790(_0xcc9cef);}})[_0x0e7a('0x49')](function(_0x246efd){return _0x161ac7(_0x246efd);});});;});};function addVoicePrefixExtensions(_0x74bc0a,_0x30bd3a){var _0x1c6ea7=[];var _0x393037=formatPrefixName(_0x74bc0a[_0x0e7a('0x61')]);_0x1c6ea7[_0x0e7a('0x67')](new Extension(_0x393037,0x2,'Set',_0x0e7a('0x68')+_0x74bc0a[_0x0e7a('0x32')]));if(_0x74bc0a[_0x0e7a('0x69')]){_0x1c6ea7['push'](new Extension(_0x393037,0x3,_0x0e7a('0x6a'),_0x0e7a('0x6b')+_0x74bc0a[_0x0e7a('0x69')]));}else{_0x1c6ea7[_0x0e7a('0x67')](new Extension(_0x393037,0x3,'NoOp',_0x0e7a('0x6c')));}_0x1c6ea7[_0x0e7a('0x67')](new Extension(_0x393037,0x4,_0x0e7a('0x6d'),_0x30bd3a[_0x0e7a('0x5d')]+','+_0x0e7a('0x6e')+(0x8+_0x74bc0a['name']['length'])+'}'+','+0x1));return _0x1c6ea7;}function formatPrefixName(_0x4f4a9){var _0x1d6d53='_';for(var _0x44d7dd=0x0;_0x44d7dd<_0x4f4a9[_0x0e7a('0x3f')];_0x44d7dd++){if(_0x4f4a9[_0x0e7a('0x6f')](_0x44d7dd)=='-'){_0x1d6d53+=_0x4f4a9[_0x0e7a('0x6f')](_0x44d7dd);}else{_0x1d6d53+='['+_0x4f4a9[_0x0e7a('0x6f')](_0x44d7dd)+']';}}_0x1d6d53+='.';return _0x1d6d53;}exports[_0x0e7a('0x2c')]=function(_0x250f4c,_0x5b6b3b,_0x4f5b56){var _0x192d66=_0x250f4c[_0x0e7a('0x54')];_0x192d66[_0x0e7a('0x61')]=_0x0e7a('0x70')+_0x192d66[_0x0e7a('0x32')]+'-';return db[_0x0e7a('0x52')][_0x0e7a('0x53')](function(_0x5d1ce9){return db[_0x0e7a('0x47')][_0x0e7a('0x2c')](_0x192d66,{'where':{'id':_0x192d66['id']},'transaction':_0x5d1ce9})[_0x0e7a('0x2d')](function(){return db[_0x0e7a('0x64')]['destroy']({'where':{'VoicePrefixId':_0x192d66['id']},'transaction':_0x5d1ce9})[_0x0e7a('0x2d')](function(){return db[_0x0e7a('0x64')][_0x0e7a('0x50')]({'where':{'id':_0x192d66['VoiceExtensionId']},'raw':!![]})[_0x0e7a('0x2d')](function(_0x5aa54c){return createVoicePrefixExtensions(_0x192d66,_0x5aa54c,_0x5d1ce9);});});});})[_0x0e7a('0x2d')](function(){return db[_0x0e7a('0x47')][_0x0e7a('0x71')](_0x192d66['id']);})[_0x0e7a('0x2d')](respondWithResult(_0x5b6b3b,null))[_0x0e7a('0x49')](handleError(_0x5b6b3b,null));};exports[_0x0e7a('0x72')]=function(_0x1193e2,_0xe886aa,_0x727f97){return db[_0x0e7a('0x47')][_0x0e7a('0x50')]({'where':{'id':_0x1193e2[_0x0e7a('0x4b')]['id']}})[_0x0e7a('0x2d')](handleEntityNotFound(_0xe886aa,null))['then'](function(_0x4537c0){if(_0x4537c0){return _0x4537c0[_0x0e7a('0x72')](_0x1193e2[_0x0e7a('0x54')]['ids'],_['omit'](_0x1193e2[_0x0e7a('0x54')],['ids','id'])||{})['spread'](function(_0x1caa80){for(var _0x543792=0x0;_0x543792<_0x1193e2[_0x0e7a('0x54')]['ids'][_0x0e7a('0x3f')];_0x543792+=0x1){socket[_0x0e7a('0x73')]('userVoicePrefix:save',{'UserId':Number(_0x1193e2['body'][_0x0e7a('0x74')][_0x543792]),'VoicePrefixId':Number(_0x1193e2[_0x0e7a('0x4b')]['id'])});}return _0x1caa80;});}})[_0x0e7a('0x2d')](respondWithResult(_0xe886aa,null))[_0x0e7a('0x49')](handleError(_0xe886aa,null));};exports[_0x0e7a('0x75')]=function(_0x5b1260,_0x490c33,_0x44cc34){return db[_0x0e7a('0x47')][_0x0e7a('0x50')]({'where':{'id':_0x5b1260['params']['id']}})[_0x0e7a('0x2d')](handleEntityNotFound(_0x490c33,null))[_0x0e7a('0x2d')](function(_0x1ca85e){if(_0x1ca85e){return _0x1ca85e[_0x0e7a('0x75')](_0x5b1260[_0x0e7a('0x3a')][_0x0e7a('0x74')])[_0x0e7a('0x2d')](function(){if(_[_0x0e7a('0x76')](_0x5b1260[_0x0e7a('0x3a')][_0x0e7a('0x74')])){for(var _0x3c2d1e=0x0;_0x3c2d1e<_0x5b1260[_0x0e7a('0x3a')]['ids'][_0x0e7a('0x3f')];_0x3c2d1e+=0x1){socket[_0x0e7a('0x73')](_0x0e7a('0x77'),{'UserId':Number(_0x5b1260['query'][_0x0e7a('0x74')][_0x3c2d1e]),'VoicePrefixId':Number(_0x5b1260[_0x0e7a('0x4b')]['id'])});}}else{socket[_0x0e7a('0x73')](_0x0e7a('0x77'),{'UserId':Number(_0x5b1260['query']['ids']),'VoicePrefixId':Number(_0x5b1260[_0x0e7a('0x4b')]['id'])});}});}})[_0x0e7a('0x2d')](respondWithStatusCode(_0x490c33,null))[_0x0e7a('0x49')](handleError(_0x490c33,null));};exports['getAgents']=function(_0x54bc20,_0x442785,_0x34b94c){var _0x1e8f93={};var _0x402e24={};var _0x5d6a88;var _0x299c6d;return db['VoicePrefix'][_0x0e7a('0x78')]({'where':{'id':_0x54bc20['params']['id']}})['then'](handleEntityNotFound(_0x442785,null))[_0x0e7a('0x2d')](function(_0x336a14){if(_0x336a14){_0x5d6a88=_0x336a14;_0x402e24[_0x0e7a('0x39')]=_[_0x0e7a('0x4c')](db[_0x0e7a('0x79')][_0x0e7a('0x35')]);_0x402e24[_0x0e7a('0x3a')]=_['keys'](_0x54bc20['query']);_0x402e24[_0x0e7a('0x3b')]=_[_0x0e7a('0x3c')](_0x402e24[_0x0e7a('0x39')],_0x402e24[_0x0e7a('0x3a')]);_0x1e8f93['attributes']=_[_0x0e7a('0x3c')](_0x402e24[_0x0e7a('0x39')],qs['fields'](_0x54bc20[_0x0e7a('0x3a')][_0x0e7a('0x3e')]));_0x1e8f93[_0x0e7a('0x3d')]=_0x1e8f93[_0x0e7a('0x3d')][_0x0e7a('0x3f')]?_0x1e8f93[_0x0e7a('0x3d')]:_0x402e24['model'];_0x1e8f93[_0x0e7a('0x41')]=qs['sort'](_0x54bc20['query'][_0x0e7a('0x42')]);_0x1e8f93[_0x0e7a('0x45')]=qs['filters'](_['pick'](_0x54bc20[_0x0e7a('0x3a')],_0x402e24[_0x0e7a('0x3b')]));if(_0x54bc20[_0x0e7a('0x3a')][_0x0e7a('0x44')]){_0x1e8f93[_0x0e7a('0x45')]=_[_0x0e7a('0x46')](_0x1e8f93['where'],{'$or':_['map'](_0x1e8f93[_0x0e7a('0x3d')],function(_0xf82628){var _0xe6ea0f={};_0xe6ea0f[_0xf82628]={'$like':'%'+_0x54bc20[_0x0e7a('0x3a')]['filter']+'%'};return _0xe6ea0f;})});}_0x1e8f93=_['merge']({},_0x1e8f93,_0x54bc20['options']);return _0x5d6a88[_0x0e7a('0x7a')](_0x1e8f93);}})['then'](function(_0x3f8339){if(_0x3f8339){_0x299c6d=_0x3f8339['length'];if(!_0x54bc20[_0x0e7a('0x3a')]['hasOwnProperty'](_0x0e7a('0x7b'))){_0x1e8f93[_0x0e7a('0x26')]=qs[_0x0e7a('0x26')](_0x54bc20[_0x0e7a('0x3a')][_0x0e7a('0x26')]);_0x1e8f93[_0x0e7a('0x24')]=qs['offset'](_0x54bc20[_0x0e7a('0x3a')]['offset']);}return _0x5d6a88[_0x0e7a('0x7a')](_0x1e8f93);}})['then'](function(_0x31759f){if(_0x31759f){return _0x31759f?{'count':_0x299c6d,'rows':_0x31759f}:null;}})[_0x0e7a('0x2d')](respondWithResult(_0x442785,null))[_0x0e7a('0x49')](handleError(_0x442785,null));}; \ No newline at end of file +var _0xf53d=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','NoOp','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','update','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','keys','length','include','find','catch','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x4e2364,_0x2f36f3){var _0x3d15ab=function(_0x546e21){while(--_0x546e21){_0x4e2364['push'](_0x4e2364['shift']());}};_0x3d15ab(++_0x2f36f3);}(_0xf53d,0x199));var _0xdf53=function(_0x4f8dcd,_0x259ae4){_0x4f8dcd=_0x4f8dcd-0x0;var _0x45a96b=_0xf53d[_0x4f8dcd];return _0x45a96b;};'use strict';var emlformat=require(_0xdf53('0x0'));var rimraf=require(_0xdf53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf53('0x2'));var rp=require(_0xdf53('0x3'));var moment=require(_0xdf53('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdf53('0x5'));var util=require('util');var path=require(_0xdf53('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdf53('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf53('0x8'));var squel=require(_0xdf53('0x9'));var crypto=require(_0xdf53('0xa'));var jsforce=require(_0xdf53('0xb'));var deskjs=require(_0xdf53('0xc'));var toCsv=require(_0xdf53('0xd'));var querystring=require(_0xdf53('0xe'));var Papa=require(_0xdf53('0xf'));var Redis=require('ioredis');var authService=require(_0xdf53('0x10'));var qs=require(_0xdf53('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf53('0x12'));var logger=require('../../config/logger')(_0xdf53('0x13'));var utils=require(_0xdf53('0x14'));var config=require(_0xdf53('0x15'));var licenseUtil=require(_0xdf53('0x16'));var db=require(_0xdf53('0x17'))['db'];config[_0xdf53('0x18')]=_['defaults'](config[_0xdf53('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdf53('0x19'))[_0xdf53('0x1a')](socket);function respondWithStatusCode(_0x1cca6c,_0x5a5b4b){_0x5a5b4b=_0x5a5b4b||0xcc;return function(_0x68531c){if(_0x68531c){return _0x1cca6c[_0xdf53('0x1b')](_0x5a5b4b);}return _0x1cca6c[_0xdf53('0x1c')](_0x5a5b4b)[_0xdf53('0x1d')]();};}function respondWithResult(_0x22deb2,_0x413151){_0x413151=_0x413151||0xc8;return function(_0x3359c6){if(_0x3359c6){return _0x22deb2[_0xdf53('0x1c')](_0x413151)[_0xdf53('0x1e')](_0x3359c6);}};}function respondWithFilteredResult(_0x5965a3,_0x24f9b2){return function(_0x92b79f){if(_0x92b79f){var _0x47b4b3=typeof _0x24f9b2[_0xdf53('0x1f')]==='undefined'&&typeof _0x24f9b2[_0xdf53('0x20')]===_0xdf53('0x21');var _0x1040ac=_0x92b79f['count'];var _0x351048=_0x47b4b3?0x0:_0x24f9b2[_0xdf53('0x1f')];var _0x341a5e=_0x47b4b3?_0x92b79f['count']:_0x24f9b2[_0xdf53('0x1f')]+_0x24f9b2['limit'];var _0x528861;if(_0x341a5e>=_0x1040ac){_0x341a5e=_0x1040ac;_0x528861=0xc8;}else{_0x528861=0xce;}_0x5965a3[_0xdf53('0x1c')](_0x528861);return _0x5965a3['set'](_0xdf53('0x22'),_0x351048+'-'+_0x341a5e+'/'+_0x1040ac)[_0xdf53('0x1e')](_0x92b79f);}return null;};}function patchUpdates(_0x213703){return function(_0x193b74){try{jsonpatch[_0xdf53('0x23')](_0x193b74,_0x213703,!![]);}catch(_0xd5f7f8){return BPromise[_0xdf53('0x24')](_0xd5f7f8);}return _0x193b74['save']();};}function saveUpdates(_0x3fa668,_0x344936){return function(_0x17b3f1){if(_0x17b3f1){return _0x17b3f1[_0xdf53('0x25')](_0x3fa668)['then'](function(_0x35a387){return _0x35a387;});}return null;};}function removeEntity(_0x311792,_0x4127c5){return function(_0x42a64e){if(_0x42a64e){return _0x42a64e[_0xdf53('0x26')]()[_0xdf53('0x27')](function(){var _0x305de7=_0x42a64e[_0xdf53('0x28')]({'plain':!![]});var _0x159942=_0xdf53('0x29');return db[_0xdf53('0x2a')][_0xdf53('0x26')]({'where':{'type':_0x159942,'resourceId':_0x305de7['id']}})[_0xdf53('0x27')](function(){return _0x42a64e;});})[_0xdf53('0x27')](function(){_0x311792[_0xdf53('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1687d1,_0x5b2877){return function(_0x4e9056){if(!_0x4e9056){_0x1687d1[_0xdf53('0x1b')](0x194);}return _0x4e9056;};}function handleError(_0x2526fa,_0x1d1611){_0x1d1611=_0x1d1611||0x1f4;return function(_0x442d88){logger[_0xdf53('0x2b')](_0x442d88[_0xdf53('0x2c')]);if(_0x442d88[_0xdf53('0x2d')]){delete _0x442d88[_0xdf53('0x2d')];}_0x2526fa['status'](_0x1d1611)[_0xdf53('0x2e')](_0x442d88);};}exports[_0xdf53('0x2f')]=function(_0x2afa60,_0x1268a7){var _0x23aef4={},_0x1b5e0e={},_0x429667={'count':0x0,'rows':[]};var _0x295f60=_[_0xdf53('0x30')](db[_0xdf53('0x31')][_0xdf53('0x32')],function(_0x188dfe){return{'name':_0x188dfe[_0xdf53('0x33')],'type':_0x188dfe[_0xdf53('0x34')]['key']};});_0x1b5e0e[_0xdf53('0x35')]=_['map'](_0x295f60,_0xdf53('0x2d'));_0x1b5e0e[_0xdf53('0x36')]=_['keys'](_0x2afa60[_0xdf53('0x36')]);_0x1b5e0e['filters']=_[_0xdf53('0x37')](_0x1b5e0e['model'],_0x1b5e0e[_0xdf53('0x36')]);_0x23aef4[_0xdf53('0x38')]=_[_0xdf53('0x37')](_0x1b5e0e['model'],qs[_0xdf53('0x39')](_0x2afa60['query']['fields']));_0x23aef4[_0xdf53('0x38')]=_0x23aef4['attributes']['length']?_0x23aef4[_0xdf53('0x38')]:_0x1b5e0e[_0xdf53('0x35')];if(!_0x2afa60[_0xdf53('0x36')][_0xdf53('0x3a')]('nolimit')){_0x23aef4[_0xdf53('0x20')]=qs['limit'](_0x2afa60[_0xdf53('0x36')]['limit']);_0x23aef4[_0xdf53('0x1f')]=qs[_0xdf53('0x1f')](_0x2afa60['query'][_0xdf53('0x1f')]);}_0x23aef4[_0xdf53('0x3b')]=qs[_0xdf53('0x3c')](_0x2afa60[_0xdf53('0x36')][_0xdf53('0x3c')]);_0x23aef4[_0xdf53('0x3d')]=qs[_0xdf53('0x3e')](_[_0xdf53('0x3f')](_0x2afa60[_0xdf53('0x36')],_0x1b5e0e[_0xdf53('0x3e')]),_0x295f60);if(_0x2afa60[_0xdf53('0x36')][_0xdf53('0x40')]){_0x23aef4['where']=_[_0xdf53('0x41')](_0x23aef4[_0xdf53('0x3d')],{'$or':_[_0xdf53('0x30')](_0x295f60,function(_0x35ee87){if(_0x35ee87[_0xdf53('0x34')]!==_0xdf53('0x42')){var _0x191f9f={};_0x191f9f[_0x35ee87[_0xdf53('0x2d')]]={'$like':'%'+_0x2afa60['query']['filter']+'%'};return _0x191f9f;}})});}_0x23aef4=_[_0xdf53('0x41')]({},_0x23aef4,_0x2afa60[_0xdf53('0x43')]);var _0x4a5b42={'where':_0x23aef4['where']};return db[_0xdf53('0x31')][_0xdf53('0x44')](_0x4a5b42)['then'](function(_0x296362){_0x429667[_0xdf53('0x44')]=_0x296362;if(_0x2afa60[_0xdf53('0x36')][_0xdf53('0x45')]){_0x23aef4['include']=[{'all':!![]}];}return db[_0xdf53('0x31')][_0xdf53('0x46')](_0x23aef4);})[_0xdf53('0x27')](function(_0x16e3be){_0x429667[_0xdf53('0x47')]=_0x16e3be;return _0x429667;})[_0xdf53('0x27')](respondWithFilteredResult(_0x1268a7,_0x23aef4))['catch'](handleError(_0x1268a7,null));};exports['show']=function(_0x2d339f,_0x47c147){var _0x552a4b={'raw':![],'where':{'id':_0x2d339f[_0xdf53('0x48')]['id']}},_0x23d558={};_0x23d558['model']=_[_0xdf53('0x49')](db[_0xdf53('0x31')][_0xdf53('0x32')]);_0x23d558[_0xdf53('0x36')]=_['keys'](_0x2d339f[_0xdf53('0x36')]);_0x23d558[_0xdf53('0x3e')]=_[_0xdf53('0x37')](_0x23d558['model'],_0x23d558[_0xdf53('0x36')]);_0x552a4b[_0xdf53('0x38')]=_['intersection'](_0x23d558['model'],qs['fields'](_0x2d339f[_0xdf53('0x36')][_0xdf53('0x39')]));_0x552a4b[_0xdf53('0x38')]=_0x552a4b[_0xdf53('0x38')][_0xdf53('0x4a')]?_0x552a4b[_0xdf53('0x38')]:_0x23d558[_0xdf53('0x35')];if(_0x2d339f['query']['includeAll']){_0x552a4b[_0xdf53('0x4b')]=[{'all':!![]}];}_0x552a4b=_[_0xdf53('0x41')]({},_0x552a4b,_0x2d339f[_0xdf53('0x43')]);return db[_0xdf53('0x31')][_0xdf53('0x4c')](_0x552a4b)[_0xdf53('0x27')](handleEntityNotFound(_0x47c147,null))[_0xdf53('0x27')](respondWithResult(_0x47c147,null))[_0xdf53('0x4d')](handleError(_0x47c147,null));};exports[_0xdf53('0x26')]=function(_0x20fcc1,_0x6c753a){return db[_0xdf53('0x31')][_0xdf53('0x4c')]({'where':{'id':_0x20fcc1[_0xdf53('0x48')]['id']}})[_0xdf53('0x27')](handleEntityNotFound(_0x6c753a,null))[_0xdf53('0x27')](removeEntity(_0x6c753a,null))[_0xdf53('0x4d')](handleError(_0x6c753a,null));};exports[_0xdf53('0x4e')]=function(_0x2ecc55,_0x503bca){return db[_0xdf53('0x31')][_0xdf53('0x4e')]()[_0xdf53('0x27')](respondWithResult(_0x503bca,null))['catch'](handleError(_0x503bca,null));};exports[_0xdf53('0x4f')]=function(_0x21ddfc,_0x5981bb){var _0x2b12c5;return db['sequelize'][_0xdf53('0x50')](function(_0x33853b){return db['VoicePrefix'][_0xdf53('0x4f')](_0x21ddfc[_0xdf53('0x51')],{'transaction':_0x33853b})[_0xdf53('0x27')](function(_0x46a7ed){_0x2b12c5=_0x46a7ed[_0xdf53('0x28')]({'plain':!![]});return db[_0xdf53('0x52')][_0xdf53('0x4c')]({'where':{'id':_0x2b12c5[_0xdf53('0x53')]},'raw':!![]})['then'](function(_0x5cbfc3){return createVoicePrefixExtensions(_0x2b12c5,_0x5cbfc3,_0x33853b);});});})[_0xdf53('0x27')](function(){var _0x19d2cd=_0x21ddfc[_0xdf53('0x54')][_0xdf53('0x28')]({'plain':!![]});if(!_0x19d2cd)throw new Error(_0xdf53('0x55'));if(_0x19d2cd['role']==='user'){var _0x4e96ac=_0x2b12c5;return db[_0xdf53('0x56')]['find']({'where':{'name':_0xdf53('0x29'),'userProfileId':_0x19d2cd[_0xdf53('0x57')]},'raw':!![]})[_0xdf53('0x27')](function(_0x18c716){if(_0x18c716&&_0x18c716[_0xdf53('0x58')]===0x0){return db[_0xdf53('0x2a')][_0xdf53('0x4f')]({'name':_0x4e96ac[_0xdf53('0x2d')],'resourceId':_0x4e96ac['id'],'type':_0x18c716[_0xdf53('0x2d')],'sectionId':_0x18c716['id']},{})[_0xdf53('0x27')](function(){return _0x2b12c5;});}else{return _0x2b12c5;}})[_0xdf53('0x4d')](function(_0x17ef50){logger[_0xdf53('0x2b')](_0xdf53('0x59'),_0x17ef50);throw _0x17ef50;});}return _0x2b12c5;})['then'](respondWithResult(_0x5981bb,null))[_0xdf53('0x4d')](handleError(_0x5981bb,null));};function Extension(_0x18ca7f,_0x49c069,_0x2b3370,_0x3e6b33){this[_0xdf53('0x5a')]='from-sip';this[_0xdf53('0x5b')]=_0x18ca7f;this[_0xdf53('0x5c')]=_0x2b3370;this[_0xdf53('0x34')]=_0xdf53('0x5d');this[_0xdf53('0x5e')]=_0xdf53('0x5f');this[_0xdf53('0x60')]=_0x49c069;this[_0xdf53('0x61')]=_0x3e6b33;}function createVoicePrefixExtensions(_0x5d9dd4,_0x46e5ca,_0x180f5c){return new BPromise(function(_0x1330a6,_0x1d29b8){var _0x58f66=new Extension(formatPrefixName(_0x5d9dd4[_0xdf53('0x62')]),0x1,'NoOp','Voice\x20Prefix');_0x58f66[_0xdf53('0x63')]=_0x5d9dd4['id'];return db[_0xdf53('0x52')]['create'](_0x58f66,{'transaction':_0x180f5c})[_0xdf53('0x27')](function(_0x211541){var _0x1fb1f3=_0x211541['get']({'plain':!![]});var _0x4dc662=_[_0xdf53('0x30')](addVoicePrefixExtensions(_0x5d9dd4,_0x46e5ca),function(_0x64ef87){_0x64ef87[_0xdf53('0x53')]=_0x1fb1f3['id'];_0x64ef87['VoicePrefixId']=_0x5d9dd4['id'];return _0x64ef87;});return db[_0xdf53('0x52')]['bulkCreate'](_0x4dc662,{'transaction':_0x180f5c})[_0xdf53('0x27')](function(_0xfcc470){if(!_0xfcc470){return _0x1d29b8(_0xdf53('0x64'));}else{return _0x1330a6(_0xfcc470);}})['catch'](function(_0x581161){return _0x1d29b8(_0x581161);});});;});};function addVoicePrefixExtensions(_0x1df342,_0x5e105a){var _0x25ff8b=[];var _0x4a2039=formatPrefixName(_0x1df342['prefix']);_0x25ff8b['push'](new Extension(_0x4a2039,0x2,_0xdf53('0x65'),_0xdf53('0x66')+_0x1df342[_0xdf53('0x2d')]));if(_0x1df342[_0xdf53('0x67')]){_0x25ff8b['push'](new Extension(_0x4a2039,0x3,_0xdf53('0x65'),_0xdf53('0x68')+_0x1df342[_0xdf53('0x67')]));}else{_0x25ff8b[_0xdf53('0x69')](new Extension(_0x4a2039,0x3,_0xdf53('0x6a'),_0xdf53('0x6b')));}_0x25ff8b[_0xdf53('0x69')](new Extension(_0x4a2039,0x4,_0xdf53('0x6c'),_0x5e105a['context']+','+'${EXTEN:'+(0x8+_0x1df342[_0xdf53('0x2d')]['length'])+'}'+','+0x1));return _0x25ff8b;}function formatPrefixName(_0x33d516){var _0x23be71='_';for(var _0x33a653=0x0;_0x33a653<_0x33d516[_0xdf53('0x4a')];_0x33a653++){if(_0x33d516[_0xdf53('0x6d')](_0x33a653)=='-'){_0x23be71+=_0x33d516[_0xdf53('0x6d')](_0x33a653);}else{_0x23be71+='['+_0x33d516[_0xdf53('0x6d')](_0x33a653)+']';}}_0x23be71+='.';return _0x23be71;}exports[_0xdf53('0x25')]=function(_0x32cbd7,_0x46ef2e,_0x466e8a){var _0x29dafc=_0x32cbd7['body'];_0x29dafc[_0xdf53('0x62')]=_0xdf53('0x6e')+_0x29dafc['name']+'-';return db[_0xdf53('0x6f')][_0xdf53('0x50')](function(_0x3e725d){return db['VoicePrefix'][_0xdf53('0x25')](_0x29dafc,{'where':{'id':_0x29dafc['id']},'transaction':_0x3e725d})[_0xdf53('0x27')](function(){return db[_0xdf53('0x52')]['destroy']({'where':{'VoicePrefixId':_0x29dafc['id']},'transaction':_0x3e725d})[_0xdf53('0x27')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x29dafc[_0xdf53('0x53')]},'raw':!![]})[_0xdf53('0x27')](function(_0x48351c){return createVoicePrefixExtensions(_0x29dafc,_0x48351c,_0x3e725d);});});});})['then'](function(){return db[_0xdf53('0x31')][_0xdf53('0x70')](_0x29dafc['id']);})[_0xdf53('0x27')](respondWithResult(_0x46ef2e,null))[_0xdf53('0x4d')](handleError(_0x46ef2e,null));};exports[_0xdf53('0x71')]=function(_0x57cfa7,_0x261c80,_0x273f87){return db[_0xdf53('0x31')][_0xdf53('0x4c')]({'where':{'id':_0x57cfa7[_0xdf53('0x48')]['id']}})['then'](handleEntityNotFound(_0x261c80,null))[_0xdf53('0x27')](function(_0x199928){if(_0x199928){return _0x199928[_0xdf53('0x71')](_0x57cfa7[_0xdf53('0x51')][_0xdf53('0x72')],_['omit'](_0x57cfa7['body'],['ids','id'])||{})[_0xdf53('0x73')](function(_0x2ce288){for(var _0x2d16cc=0x0;_0x2d16cc<_0x57cfa7[_0xdf53('0x51')]['ids'][_0xdf53('0x4a')];_0x2d16cc+=0x1){socket[_0xdf53('0x74')](_0xdf53('0x75'),{'UserId':Number(_0x57cfa7[_0xdf53('0x51')][_0xdf53('0x72')][_0x2d16cc]),'VoicePrefixId':Number(_0x57cfa7[_0xdf53('0x48')]['id'])});}return _0x2ce288;});}})[_0xdf53('0x27')](respondWithResult(_0x261c80,null))[_0xdf53('0x4d')](handleError(_0x261c80,null));};exports['removeAgents']=function(_0xf3916f,_0x57d973,_0xde857b){return db[_0xdf53('0x31')]['find']({'where':{'id':_0xf3916f[_0xdf53('0x48')]['id']}})[_0xdf53('0x27')](handleEntityNotFound(_0x57d973,null))['then'](function(_0x203e27){if(_0x203e27){return _0x203e27['removeAgents'](_0xf3916f[_0xdf53('0x36')][_0xdf53('0x72')])[_0xdf53('0x27')](function(){if(_[_0xdf53('0x76')](_0xf3916f[_0xdf53('0x36')][_0xdf53('0x72')])){for(var _0xbec1bf=0x0;_0xbec1bf<_0xf3916f['query'][_0xdf53('0x72')][_0xdf53('0x4a')];_0xbec1bf+=0x1){socket[_0xdf53('0x74')](_0xdf53('0x77'),{'UserId':Number(_0xf3916f[_0xdf53('0x36')]['ids'][_0xbec1bf]),'VoicePrefixId':Number(_0xf3916f[_0xdf53('0x48')]['id'])});}}else{socket[_0xdf53('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0xf3916f['query'][_0xdf53('0x72')]),'VoicePrefixId':Number(_0xf3916f[_0xdf53('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x57d973,null))[_0xdf53('0x4d')](handleError(_0x57d973,null));};exports[_0xdf53('0x78')]=function(_0x635ba8,_0x256b12,_0x487139){var _0x52ac87={};var _0x440b1d={};var _0x1c655c;var _0x48658d;return db[_0xdf53('0x31')][_0xdf53('0x79')]({'where':{'id':_0x635ba8[_0xdf53('0x48')]['id']}})[_0xdf53('0x27')](handleEntityNotFound(_0x256b12,null))[_0xdf53('0x27')](function(_0x565710){if(_0x565710){_0x1c655c=_0x565710;_0x440b1d[_0xdf53('0x35')]=_[_0xdf53('0x49')](db[_0xdf53('0x7a')][_0xdf53('0x32')]);_0x440b1d[_0xdf53('0x36')]=_[_0xdf53('0x49')](_0x635ba8[_0xdf53('0x36')]);_0x440b1d[_0xdf53('0x3e')]=_[_0xdf53('0x37')](_0x440b1d[_0xdf53('0x35')],_0x440b1d['query']);_0x52ac87['attributes']=_[_0xdf53('0x37')](_0x440b1d[_0xdf53('0x35')],qs[_0xdf53('0x39')](_0x635ba8[_0xdf53('0x36')]['fields']));_0x52ac87[_0xdf53('0x38')]=_0x52ac87[_0xdf53('0x38')][_0xdf53('0x4a')]?_0x52ac87[_0xdf53('0x38')]:_0x440b1d[_0xdf53('0x35')];_0x52ac87[_0xdf53('0x3b')]=qs[_0xdf53('0x3c')](_0x635ba8[_0xdf53('0x36')]['sort']);_0x52ac87[_0xdf53('0x3d')]=qs[_0xdf53('0x3e')](_[_0xdf53('0x3f')](_0x635ba8[_0xdf53('0x36')],_0x440b1d['filters']));if(_0x635ba8[_0xdf53('0x36')][_0xdf53('0x40')]){_0x52ac87[_0xdf53('0x3d')]=_[_0xdf53('0x41')](_0x52ac87[_0xdf53('0x3d')],{'$or':_[_0xdf53('0x30')](_0x52ac87[_0xdf53('0x38')],function(_0x11dbce){var _0x577d47={};_0x577d47[_0x11dbce]={'$like':'%'+_0x635ba8[_0xdf53('0x36')]['filter']+'%'};return _0x577d47;})});}_0x52ac87=_[_0xdf53('0x41')]({},_0x52ac87,_0x635ba8[_0xdf53('0x43')]);return _0x1c655c[_0xdf53('0x78')](_0x52ac87);}})[_0xdf53('0x27')](function(_0x47ff76){if(_0x47ff76){_0x48658d=_0x47ff76[_0xdf53('0x4a')];if(!_0x635ba8[_0xdf53('0x36')]['hasOwnProperty'](_0xdf53('0x7b'))){_0x52ac87[_0xdf53('0x20')]=qs['limit'](_0x635ba8[_0xdf53('0x36')][_0xdf53('0x20')]);_0x52ac87[_0xdf53('0x1f')]=qs[_0xdf53('0x1f')](_0x635ba8[_0xdf53('0x36')][_0xdf53('0x1f')]);}return _0x1c655c[_0xdf53('0x78')](_0x52ac87);}})[_0xdf53('0x27')](function(_0x3ff7d8){if(_0x3ff7d8){return _0x3ff7d8?{'count':_0x48658d,'rows':_0x3ff7d8}:null;}})[_0xdf53('0x27')](respondWithResult(_0x256b12,null))[_0xdf53('0x4d')](handleError(_0x256b12,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b061a7e..18426c4 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 _0x2c1a=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x386d00,_0x268007){var _0x3e4697=function(_0x12dc35){while(--_0x12dc35){_0x386d00['push'](_0x386d00['shift']());}};_0x3e4697(++_0x268007);}(_0x2c1a,0x13b));var _0xa2c1=function(_0x58238f,_0x3a35e9){_0x58238f=_0x58238f-0x0;var _0x5abc74=_0x2c1a[_0x58238f];return _0x5abc74;};'use strict';var EventEmitter=require(_0xa2c1('0x0'));var VoicePrefix=require(_0xa2c1('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xa2c1('0x2')](0x0);var events={'afterCreate':_0xa2c1('0x3'),'afterUpdate':_0xa2c1('0x4'),'afterDestroy':_0xa2c1('0x5')};function emitEvent(_0x3d9f2e){return function(_0xcd8ccc,_0x40f0c1,_0x35a1b0){VoicePrefixEvents[_0xa2c1('0x6')](_0x3d9f2e+':'+_0xcd8ccc['id'],_0xcd8ccc);VoicePrefixEvents[_0xa2c1('0x6')](_0x3d9f2e,_0xcd8ccc);_0x35a1b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xa2c1('0x7')](e,emitEvent(event));}}module[_0xa2c1('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x52a5=['exports','events','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4f5042,_0x149582){var _0x15406b=function(_0x4880c3){while(--_0x4880c3){_0x4f5042['push'](_0x4f5042['shift']());}};_0x15406b(++_0x149582);}(_0x52a5,0x191));var _0x552a=function(_0x463d7c,_0x25c80d){_0x463d7c=_0x463d7c-0x0;var _0x1784c8=_0x52a5[_0x463d7c];return _0x1784c8;};'use strict';var EventEmitter=require(_0x552a('0x0'));var VoicePrefix=require(_0x552a('0x1'))['db'][_0x552a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x552a('0x3'),'afterUpdate':_0x552a('0x4'),'afterDestroy':_0x552a('0x5')};function emitEvent(_0x5c2270){return function(_0x4be91d,_0x21e87b,_0x508d86){VoicePrefixEvents[_0x552a('0x6')](_0x5c2270+':'+_0x4be91d['id'],_0x4be91d);VoicePrefixEvents['emit'](_0x5c2270,_0x4be91d);_0x508d86(null);};}for(var e in events){if(events[_0x552a('0x7')](e)){var event=events[e];VoicePrefix[_0x552a('0x8')](e,emitEvent(event));}}module[_0x552a('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 41d22ed..9f32659 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 _0x0de4=['voice_prefixes','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x0de4,0x6d));var _0x40de=function(_0x1ac608,_0x41f4f6){_0x1ac608=_0x1ac608-0x0;var _0x3bdd98=_0x0de4[_0x1ac608];return _0x3bdd98;};'use strict';var _=require('lodash');var util=require(_0x40de('0x0'));var logger=require(_0x40de('0x1'))(_0x40de('0x2'));var moment=require(_0x40de('0x3'));var BPromise=require(_0x40de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40de('0x5'));var config=require(_0x40de('0x6'));var attributes=require(_0x40de('0x7'));module[_0x40de('0x8')]=function(_0x1ca3d0,_0x4a2c90){return _0x1ca3d0[_0x40de('0x9')](_0x40de('0xa'),attributes,{'tableName':_0x40de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ca=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes'];(function(_0x11fcbc,_0x24ad3a){var _0x27bad5=function(_0x1e4cd4){while(--_0x1e4cd4){_0x11fcbc['push'](_0x11fcbc['shift']());}};_0x27bad5(++_0x24ad3a);}(_0x54ca,0x1c3));var _0xa54c=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x54ca[_0x5d1044];return _0x3cd90e;};'use strict';var _=require(_0xa54c('0x0'));var util=require('util');var logger=require(_0xa54c('0x1'))('api');var moment=require(_0xa54c('0x2'));var BPromise=require(_0xa54c('0x3'));var rp=require(_0xa54c('0x4'));var fs=require('fs');var path=require(_0xa54c('0x5'));var rimraf=require('rimraf');var config=require(_0xa54c('0x6'));var attributes=require(_0xa54c('0x7'));module[_0xa54c('0x8')]=function(_0x2614f0,_0x3ac199){return _0x2614f0['define'](_0xa54c('0x9'),attributes,{'tableName':_0xa54c('0xa'),'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 9b58be3..45b3bf5 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 _0x55c3=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','error','code','message','VoicePrefix,\x20%s,\x20%s'];(function(_0x37e232,_0x1b3ba5){var _0x15201b=function(_0x42a6b6){while(--_0x42a6b6){_0x37e232['push'](_0x37e232['shift']());}};_0x15201b(++_0x1b3ba5);}(_0x55c3,0x189));var _0x355c=function(_0x550a44,_0xe5d0f2){_0x550a44=_0x550a44-0x0;var _0x1df11b=_0x55c3[_0x550a44];return _0x1df11b;};'use strict';var _=require('lodash');var util=require(_0x355c('0x0'));var moment=require(_0x355c('0x1'));var BPromise=require(_0x355c('0x2'));var rs=require(_0x355c('0x3'));var fs=require('fs');var Redis=require(_0x355c('0x4'));var db=require(_0x355c('0x5'))['db'];var utils=require(_0x355c('0x6'));var logger=require(_0x355c('0x7'))(_0x355c('0x8'));var config=require(_0x355c('0x9'));var jayson=require(_0x355c('0xa'));var client=jayson[_0x355c('0xb')][_0x355c('0xc')]({'port':0x232a});config[_0x355c('0xd')]=_['defaults'](config['redis'],{'host':_0x355c('0xe'),'port':0x18eb});var socket=require(_0x355c('0xf'))(new Redis(config[_0x355c('0xd')]));require(_0x355c('0x10'))[_0x355c('0x11')](socket);function respondWithRpcPromise(_0x3ca52d,_0x4d91bc,_0x12fe87){return new BPromise(function(_0x3cdc28,_0xf40017){return client[_0x355c('0x12')](_0x3ca52d,_0x12fe87)[_0x355c('0x13')](function(_0x386a36){logger[_0x355c('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x4d91bc,_0x355c('0x15'));logger[_0x355c('0x16')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4d91bc,_0x355c('0x15'),JSON['stringify'](_0x386a36));if(_0x386a36[_0x355c('0x17')]){if(_0x386a36[_0x355c('0x17')][_0x355c('0x18')]===0x1f4){logger[_0x355c('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4d91bc,_0x386a36[_0x355c('0x17')]['message']);return _0xf40017(_0x386a36['error'][_0x355c('0x19')]);}logger[_0x355c('0x17')](_0x355c('0x1a'),_0x4d91bc,_0x386a36[_0x355c('0x17')][_0x355c('0x19')]);return _0x3cdc28(_0x386a36[_0x355c('0x17')][_0x355c('0x19')]);}else{logger[_0x355c('0x14')](_0x355c('0x1a'),_0x4d91bc,'request\x20sent');_0x3cdc28(_0x386a36[_0x355c('0x1b')][_0x355c('0x19')]);}})['catch'](function(_0x4fabef){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4d91bc,_0x4fabef);_0xf40017(_0x4fabef);});});} \ No newline at end of file +var _0xa280=['http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xa280,0xc4));var _0x0a28=function(_0xc9c21,_0x46e750){_0xc9c21=_0xc9c21-0x0;var _0x582b2b=_0xa280[_0xc9c21];return _0x582b2b;};'use strict';var _=require(_0x0a28('0x0'));var util=require(_0x0a28('0x1'));var moment=require('moment');var BPromise=require(_0x0a28('0x2'));var rs=require(_0x0a28('0x3'));var fs=require('fs');var Redis=require(_0x0a28('0x4'));var db=require(_0x0a28('0x5'))['db'];var utils=require(_0x0a28('0x6'));var logger=require(_0x0a28('0x7'))(_0x0a28('0x8'));var config=require(_0x0a28('0x9'));var jayson=require(_0x0a28('0xa'));var client=jayson[_0x0a28('0xb')][_0x0a28('0xc')]({'port':0x232a});config[_0x0a28('0xd')]=_[_0x0a28('0xe')](config[_0x0a28('0xd')],{'host':_0x0a28('0xf'),'port':0x18eb});var socket=require(_0x0a28('0x10'))(new Redis(config[_0x0a28('0xd')]));require(_0x0a28('0x11'))['register'](socket);function respondWithRpcPromise(_0x11b36e,_0x28bca7,_0x48cbf1){return new BPromise(function(_0x30e340,_0x1ad1ef){return client['request'](_0x11b36e,_0x48cbf1)['then'](function(_0x1a8ad4){logger[_0x0a28('0x12')](_0x0a28('0x13'),_0x28bca7,_0x0a28('0x14'));logger[_0x0a28('0x15')](_0x0a28('0x16'),_0x28bca7,_0x0a28('0x14'),JSON['stringify'](_0x1a8ad4));if(_0x1a8ad4[_0x0a28('0x17')]){if(_0x1a8ad4[_0x0a28('0x17')]['code']===0x1f4){logger[_0x0a28('0x17')](_0x0a28('0x13'),_0x28bca7,_0x1a8ad4[_0x0a28('0x17')][_0x0a28('0x18')]);return _0x1ad1ef(_0x1a8ad4['error'][_0x0a28('0x18')]);}logger[_0x0a28('0x17')](_0x0a28('0x13'),_0x28bca7,_0x1a8ad4[_0x0a28('0x17')]['message']);return _0x30e340(_0x1a8ad4[_0x0a28('0x17')][_0x0a28('0x18')]);}else{logger[_0x0a28('0x12')](_0x0a28('0x13'),_0x28bca7,'request\x20sent');_0x30e340(_0x1a8ad4['result'][_0x0a28('0x18')]);}})[_0x0a28('0x19')](function(_0x169bb6){logger['error'](_0x0a28('0x13'),_0x28bca7,_0x169bb6);_0x1ad1ef(_0x169bb6);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index bc78f9d..956ea2b 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 _0xa20a=['removeListener','register','length','voicePrefix:','remove','update','emit'];(function(_0x4af3b7,_0x30c116){var _0x24727c=function(_0x3ae9a0){while(--_0x3ae9a0){_0x4af3b7['push'](_0x4af3b7['shift']());}};_0x24727c(++_0x30c116);}(_0xa20a,0x74));var _0xaa20=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xa20a[_0x5627e1];return _0x2f013f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xaa20('0x0'),_0xaa20('0x1')];function createListener(_0x39481d,_0x1d1b40){return function(_0x5d88f1){_0x1d1b40[_0xaa20('0x2')](_0x39481d,_0x5d88f1);};}function removeListener(_0x20a8ad,_0x1497a0){return function(){VoicePrefixEvents[_0xaa20('0x3')](_0x20a8ad,_0x1497a0);};}exports[_0xaa20('0x4')]=function(_0x5ac74e){for(var _0x54ecbc=0x0,_0x413b88=events[_0xaa20('0x5')];_0x54ecbc<_0x413b88;_0x54ecbc++){var _0x23a712=events[_0x54ecbc];var _0x181df0=createListener(_0xaa20('0x6')+_0x23a712,_0x5ac74e);VoicePrefixEvents['on'](_0x23a712,_0x181df0);}}; \ No newline at end of file +var _0x9b00=['voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener','length'];(function(_0xc8d092,_0x6e0b73){var _0x2c7fcd=function(_0x4d941a){while(--_0x4d941a){_0xc8d092['push'](_0xc8d092['shift']());}};_0x2c7fcd(++_0x6e0b73);}(_0x9b00,0xcc));var _0x09b0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9b00[_0x432682];return _0x463d05;};'use strict';var VoicePrefixEvents=require(_0x09b0('0x0'));var events=[_0x09b0('0x1'),_0x09b0('0x2'),'update'];function createListener(_0x1737fd,_0x2bf951){return function(_0x18bb45){_0x2bf951[_0x09b0('0x3')](_0x1737fd,_0x18bb45);};}function removeListener(_0x405978,_0x3c02c5){return function(){VoicePrefixEvents[_0x09b0('0x4')](_0x405978,_0x3c02c5);};}exports['register']=function(_0x79bc56){for(var _0x57b9e0=0x0,_0x20c971=events[_0x09b0('0x5')];_0x57b9e0<_0x20c971;_0x57b9e0++){var _0x396bd6=events[_0x57b9e0];var _0x4290c7=createListener(_0x09b0('0x6')+_0x396bd6,_0x79bc56);VoicePrefixEvents['on'](_0x396bd6,_0x4290c7);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 1de74c4..80fddb1 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 _0x8c75=['../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','/:id/lists','/:id/blacklists','put','update','destroy','delete','removeAgents','removeLists','removeBlackLists','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3cd2f9,_0x4989dc){var _0xf53d13=function(_0x132a3d){while(--_0x132a3d){_0x3cd2f9['push'](_0x3cd2f9['shift']());}};_0xf53d13(++_0x4989dc);}(_0x8c75,0x9a));var _0x58c7=function(_0x314746,_0x498636){_0x314746=_0x314746-0x0;var _0x130324=_0x8c75[_0x314746];return _0x130324;};'use strict';var multer=require(_0x58c7('0x0'));var util=require('util');var path=require(_0x58c7('0x1'));var timeout=require(_0x58c7('0x2'));var express=require(_0x58c7('0x3'));var router=express[_0x58c7('0x4')]();var fs_extra=require(_0x58c7('0x5'));var auth=require(_0x58c7('0x6'));var interaction=require(_0x58c7('0x7'));var config=require('../../config/environment');var controller=require(_0x58c7('0x8'));router[_0x58c7('0x9')]('/',auth[_0x58c7('0xa')](),controller[_0x58c7('0xb')]);router['get'](_0x58c7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x58c7('0x9')](_0x58c7('0xd'),auth['isAuthenticated'](),controller[_0x58c7('0xe')]);router['get'](_0x58c7('0xf'),auth[_0x58c7('0xa')](),controller[_0x58c7('0x10')]);router['get']('/:id/hopper_finals',auth[_0x58c7('0xa')](),controller['getHopperFinals']);router[_0x58c7('0x9')]('/:id/hopper_black',auth[_0x58c7('0xa')](),controller[_0x58c7('0x11')]);router[_0x58c7('0x9')](_0x58c7('0x12'),auth[_0x58c7('0xa')](),controller[_0x58c7('0x13')]);router[_0x58c7('0x9')](_0x58c7('0x14'),auth['isAuthenticated'](),controller[_0x58c7('0x15')]);router[_0x58c7('0x9')](_0x58c7('0x16'),auth[_0x58c7('0xa')](),controller[_0x58c7('0x17')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x58c7('0x9')]('/:id/blacklists',auth[_0x58c7('0xa')](),controller[_0x58c7('0x18')]);router[_0x58c7('0x19')]('/',auth[_0x58c7('0xa')](),controller[_0x58c7('0x1a')]);router[_0x58c7('0x19')](_0x58c7('0x1b'),auth[_0x58c7('0xa')](),controller[_0x58c7('0x1c')]);router[_0x58c7('0x19')]('/:id/teams',auth[_0x58c7('0xa')](),controller[_0x58c7('0x1d')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x58c7('0x1e')]);router[_0x58c7('0x19')](_0x58c7('0x1f'),auth[_0x58c7('0xa')](),controller['addLists']);router[_0x58c7('0x19')](_0x58c7('0x20'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x58c7('0x21')]('/:id',auth[_0x58c7('0xa')](),controller[_0x58c7('0x22')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x58c7('0x23')]);router['delete'](_0x58c7('0x12'),auth[_0x58c7('0xa')](),controller['removeTeams']);router[_0x58c7('0x24')](_0x58c7('0x14'),auth['isAuthenticated'](),controller[_0x58c7('0x25')]);router[_0x58c7('0x24')](_0x58c7('0x1f'),auth[_0x58c7('0xa')](),controller[_0x58c7('0x26')]);router[_0x58c7('0x24')](_0x58c7('0x20'),auth[_0x58c7('0xa')](),controller[_0x58c7('0x27')]);module['exports']=router; \ No newline at end of file +var _0x5ccc=['/:id/lists','getLists','/:id/blacklists','getBlackLists','post','clone','addLists','addBlackLists','put','/:id','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','/:id/users','getMembers'];(function(_0x3323e4,_0x5e3c61){var _0x1bcc8e=function(_0x4cb831){while(--_0x4cb831){_0x3323e4['push'](_0x3323e4['shift']());}};_0x1bcc8e(++_0x5e3c61);}(_0x5ccc,0x127));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc5cc('0x0'));var path=require(_0xc5cc('0x1'));var timeout=require(_0xc5cc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc5cc('0x3'));var interaction=require(_0xc5cc('0x4'));var config=require('../../config/environment');var controller=require(_0xc5cc('0x5'));router[_0xc5cc('0x6')]('/',auth['isAuthenticated'](),controller[_0xc5cc('0x7')]);router[_0xc5cc('0x6')]('/:id',auth[_0xc5cc('0x8')](),controller[_0xc5cc('0x9')]);router[_0xc5cc('0x6')](_0xc5cc('0xa'),auth[_0xc5cc('0x8')](),controller[_0xc5cc('0xb')]);router[_0xc5cc('0x6')](_0xc5cc('0xc'),auth[_0xc5cc('0x8')](),controller['getHopperHistories']);router[_0xc5cc('0x6')](_0xc5cc('0xd'),auth[_0xc5cc('0x8')](),controller[_0xc5cc('0xe')]);router['get'](_0xc5cc('0xf'),auth[_0xc5cc('0x8')](),controller['getHopperBlacks']);router[_0xc5cc('0x6')](_0xc5cc('0x10'),auth['isAuthenticated'](),controller[_0xc5cc('0x11')]);router['get'](_0xc5cc('0x12'),auth[_0xc5cc('0x8')](),controller['getAgents']);router['get']('/:id/members',auth[_0xc5cc('0x8')](),controller[_0xc5cc('0x13')]);router[_0xc5cc('0x6')](_0xc5cc('0x14'),auth[_0xc5cc('0x8')](),controller[_0xc5cc('0x15')]);router[_0xc5cc('0x6')](_0xc5cc('0x16'),auth['isAuthenticated'](),controller[_0xc5cc('0x17')]);router[_0xc5cc('0x18')]('/',auth[_0xc5cc('0x8')](),controller['create']);router[_0xc5cc('0x18')]('/:id/clone',auth['isAuthenticated'](),controller[_0xc5cc('0x19')]);router[_0xc5cc('0x18')](_0xc5cc('0x10'),auth[_0xc5cc('0x8')](),controller['addTeams']);router['post'](_0xc5cc('0x12'),auth[_0xc5cc('0x8')](),controller['addAgents']);router[_0xc5cc('0x18')]('/:id/lists',auth[_0xc5cc('0x8')](),controller[_0xc5cc('0x1a')]);router[_0xc5cc('0x18')](_0xc5cc('0x16'),auth[_0xc5cc('0x8')](),controller[_0xc5cc('0x1b')]);router[_0xc5cc('0x1c')](_0xc5cc('0x1d'),auth[_0xc5cc('0x8')](),controller['update']);router[_0xc5cc('0x1e')](_0xc5cc('0x1d'),auth['isAuthenticated'](),controller[_0xc5cc('0x1f')]);router['delete']('/:id/teams',auth[_0xc5cc('0x8')](),controller[_0xc5cc('0x20')]);router[_0xc5cc('0x1e')](_0xc5cc('0x12'),auth[_0xc5cc('0x8')](),controller[_0xc5cc('0x21')]);router['delete']('/:id/lists',auth[_0xc5cc('0x8')](),controller['removeLists']);router[_0xc5cc('0x1e')](_0xc5cc('0x16'),auth[_0xc5cc('0x8')](),controller['removeBlackLists']);module[_0xc5cc('0x22')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 693bb08..71b3d54 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 _0xf3d0=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','name','ENUM','inbound','outbound','STRING','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','getDataValue','type','dialMethod','roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT','periodic_announce','join','joinempty','split','setDataValue','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Cut\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x5eb821,_0x65873){var _0x4e9bc8=function(_0x5f3252){while(--_0x5f3252){_0x5eb821['push'](_0x5eb821['shift']());}};_0x4e9bc8(++_0x65873);}(_0xf3d0,0x18e));var _0x0f3d=function(_0x2ca0d4,_0x4fe48e){_0x2ca0d4=_0x2ca0d4-0x0;var _0x4ed40d=_0xf3d0[_0x2ca0d4];return _0x4ed40d;};'use strict';var Sequelize=require(_0x0f3d('0x0'));module[_0x0f3d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0f3d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x4'),_0x0f3d('0x5')),'allowNull':![],'defaultValue':_0x0f3d('0x4')},'musiconhold':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x0f3d('0x3')]('rr',_0x0f3d('0x7'),_0x0f3d('0x8'),_0x0f3d('0x9'),_0x0f3d('0xa'),_0x0f3d('0xb'),_0x0f3d('0xc'),_0x0f3d('0xd'),_0x0f3d('0xe')),'allowNull':![],'defaultValue':_0x0f3d('0x7'),'set':function(_0x3e9a5a){this['setDataValue']('strategy',_0x3e9a5a?_0x3e9a5a:'rrmemory');},'get':function(){var _0x14f01a=this[_0x0f3d('0xf')](_0x0f3d('0x10'));var _0x2b4c0f=this['getDataValue'](_0x0f3d('0x11'));var _0x22b6be=this[_0x0f3d('0xf')]('strategy');if(_0x14f01a===_0x0f3d('0x4')){return _0x22b6be;}if(_0x2b4c0f==='booked'&&_0x22b6be===_0x0f3d('0xb')||_0x2b4c0f==='booked'&&_0x22b6be===_0x0f3d('0x12')){return _0x22b6be;}if(_0x2b4c0f===_0x0f3d('0x13')||_0x2b4c0f===_0x0f3d('0x14')||_0x2b4c0f===_0x0f3d('0x15')){return _0x22b6be;}return null;}},'servicelevel':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0f3d('0x16')](0xb)},'timeout':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0f3d('0x6')]},'weight':{'type':Sequelize[_0x0f3d('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x17'),'no'),'defaultValue':_0x0f3d('0x17')},'autopause':{'type':Sequelize['ENUM'](_0x0f3d('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0f3d('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0f3d('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0f3d('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x0f3d('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x0f3d('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0f3d('0x17'),'no'),'defaultValue':_0x0f3d('0x17')},'announce_holdtime':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x17'),'no',_0x0f3d('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0f3d('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0f3d('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0f3d('0x6')]},'queue_youarenext':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0f3d('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x0f3d('0x6')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x0f3d('0x6')]},'periodic_announce':{'type':Sequelize[_0x0f3d('0x19')],'set':function(_0x1ace46){this['setDataValue'](_0x0f3d('0x1a'),_0x1ace46?_0x1ace46[_0x0f3d('0x1b')](','):[]);},'get':function(){return this['getDataValue'](_0x0f3d('0x1a'))?this[_0x0f3d('0xf')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':_0x0f3d('0x17'),'set':function(_0x46334d){this['setDataValue']('joinempty',_0x46334d?_0x46334d[_0x0f3d('0x1b')](','):undefined);},'get':function(){return this[_0x0f3d('0xf')](_0x0f3d('0x1c'))?this[_0x0f3d('0xf')](_0x0f3d('0x1c'))[_0x0f3d('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':'no','set':function(_0x1a8b97){this[_0x0f3d('0x1e')](_0x0f3d('0x1f'),_0x1a8b97?_0x1a8b97[_0x0f3d('0x1b')](','):undefined);},'get':function(){return this[_0x0f3d('0xf')](_0x0f3d('0x1f'))?this[_0x0f3d('0xf')]('leavewhenempty')[_0x0f3d('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0f3d('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0f3d('0x6')]},'description':{'type':Sequelize[_0x0f3d('0x6')]},'acw':{'type':Sequelize[_0x0f3d('0x20')],'defaultValue':0x0,'set':function(_0x58ff7c){this[_0x0f3d('0x1e')](_0x0f3d('0x21'),_0x58ff7c);if(_0x58ff7c){if(this[_0x0f3d('0xf')](_0x0f3d('0x22'))<0x2){this[_0x0f3d('0x1e')](_0x0f3d('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0f3d('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0f3d('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x0f3d('0x23'),_0x0f3d('0x13'),_0x0f3d('0x15'),_0x0f3d('0x14'),'booked'),'defaultValue':'progressive','comment':_0x0f3d('0x24')},'dialLimitChannel':{'type':Sequelize[_0x0f3d('0x16')](0x4)[_0x0f3d('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0f3d('0x26')},'dialLimitQueue':{'type':Sequelize[_0x0f3d('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0f3d('0x27')},'dialPowerLevel':{'type':Sequelize[_0x0f3d('0x28')](0x2)[_0x0f3d('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0f3d('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x0f3d('0x2a'),_0x0f3d('0x2b')),'defaultValue':_0x0f3d('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0f3d('0x28')](0x2)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0f3d('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0f3d('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0f3d('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0f3d('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x0f3d('0x2e'),'comment':_0x0f3d('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3d('0x30')},'dialQueueProject':{'type':Sequelize[_0x0f3d('0x6')],'comment':_0x0f3d('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3d('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0f3d('0x16')](0x5)[_0x0f3d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3d('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3d('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0f3d('0x16')](0x5)[_0x0f3d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3d('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0f3d('0x16')](0x5)[_0x0f3d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3d('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0f3d('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0f3d('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':_0x0f3d('0x38')},'dialPrefix':{'type':Sequelize[_0x0f3d('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0f3d('0x3')](_0x0f3d('0x39'),'never',_0x0f3d('0x3a')),'defaultValue':_0x0f3d('0x39')},'dialAMDActive':{'type':Sequelize[_0x0f3d('0x20')],'defaultValue':0x0,'comment':_0x0f3d('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x0f3d('0x16')](0x9)[_0x0f3d('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0f3d('0x16')](0x9)[_0x0f3d('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0f3d('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0f3d('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0f3d('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x0f3d('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0f3d('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x0f3d('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0f3d('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0f3d('0x16')](0x9)[_0x0f3d('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0f3d('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0f3d('0x16')](0x9)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0f3d('0x16')](0x5)[_0x0f3d('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0f3d('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0f3d('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x0f3d('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0f3d('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x0f3d('0x20')],'defaultValue':0x0,'comment':_0x0f3d('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0f3d('0x3')]('DESC','ASC'),'defaultValue':_0x0f3d('0x44')},'dialQueueProject2':{'type':Sequelize[_0x0f3d('0x6')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0f3d('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0f3d('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x0f3d('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0f3d('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0f3d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3d('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3d('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x0f3d('0x16')](0x5)[_0x0f3d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3d('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0f3d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3d('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0f3d('0x16')](0x5)[_0x0f3d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3d('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0f3d('0x16')](0x3)[_0x0f3d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0f3d('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0f3d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0f3d('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0f3d('0x16')],'allowNull':!![],'comment':_0x0f3d('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x0f3d('0x20')],'defaultValue':![],'comment':_0x0f3d('0x4e'),'set':function(_0x5ea6e6){if(!_0x5ea6e6)this[_0x0f3d('0x1e')]('mandatoryDispositionPauseId',null);this[_0x0f3d('0x1e')]('mandatoryDisposition',_0x5ea6e6);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0f3d('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0f3d('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x950a=['Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','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\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','inbound','outbound','ENUM','leastrecent','fewestcalls','linear','wrandom','rrordered','ringall','setDataValue','getDataValue','dialMethod','booked','rrmemory','roundrobin','progressive','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x145b72,_0x420ac7){var _0x4cea38=function(_0x24baf0){while(--_0x24baf0){_0x145b72['push'](_0x145b72['shift']());}};_0x4cea38(++_0x420ac7);}(_0x950a,0x111));var _0xa950=function(_0x48600b,_0x867081){_0x48600b=_0x48600b-0x0;var _0x4e6e60=_0x950a[_0x48600b];return _0x4e6e60;};'use strict';var Sequelize=require(_0xa950('0x0'));module[_0xa950('0x1')]={'name':{'type':Sequelize[_0xa950('0x2')],'allowNull':![],'unique':_0xa950('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xa950('0x4'),_0xa950('0x5')),'allowNull':![],'defaultValue':_0xa950('0x4')},'musiconhold':{'type':Sequelize[_0xa950('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xa950('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xa950('0x6')]('rr','ringall',_0xa950('0x7'),_0xa950('0x8'),'random','rrmemory',_0xa950('0x9'),_0xa950('0xa'),_0xa950('0xb')),'allowNull':![],'defaultValue':_0xa950('0xc'),'set':function(_0x274d9a){this[_0xa950('0xd')]('strategy',_0x274d9a?_0x274d9a:'rrmemory');},'get':function(){var _0x546c08=this[_0xa950('0xe')]('type');var _0x37990f=this[_0xa950('0xe')](_0xa950('0xf'));var _0x524c56=this[_0xa950('0xe')]('strategy');if(_0x546c08===_0xa950('0x4')){return _0x524c56;}if(_0x37990f===_0xa950('0x10')&&_0x524c56===_0xa950('0x11')||_0x37990f==='booked'&&_0x524c56===_0xa950('0x12')){return _0x524c56;}if(_0x37990f===_0xa950('0x13')||_0x37990f===_0xa950('0x14')||_0x37990f==='power'){return _0x524c56;}return null;}},'servicelevel':{'type':Sequelize[_0xa950('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa950('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa950('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa950('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa950('0x2')]},'weight':{'type':Sequelize[_0xa950('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no'),'defaultValue':_0xa950('0x16')},'autopause':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no',_0xa950('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xa950('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa950('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa950('0x6')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xa950('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xa950('0x6')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa950('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa950('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa950('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xa950('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa950('0x6')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no'),'defaultValue':_0xa950('0x16')},'announce_holdtime':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no',_0xa950('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa950('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xa950('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa950('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xa950('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa950('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xa950('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa950('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa950('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa950('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa950('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa950('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xa950('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xa950('0x2')]},'queue_quantity2':{'type':Sequelize[_0xa950('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xa950('0x2')]},'periodic_announce':{'type':Sequelize[_0xa950('0x19')],'set':function(_0x3e5915){this[_0xa950('0xd')](_0xa950('0x1a'),_0x3e5915?_0x3e5915[_0xa950('0x1b')](','):[]);},'get':function(){return this[_0xa950('0xe')](_0xa950('0x1a'))?this[_0xa950('0xe')](_0xa950('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xa950('0x2')],'defaultValue':'yes','set':function(_0x565933){this[_0xa950('0xd')]('joinempty',_0x565933?_0x565933[_0xa950('0x1b')](','):undefined);},'get':function(){return this[_0xa950('0xe')](_0xa950('0x1c'))?this[_0xa950('0xe')]('joinempty')[_0xa950('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x45846c){this[_0xa950('0xd')]('leavewhenempty',_0x45846c?_0x45846c['join'](','):undefined);},'get':function(){return this[_0xa950('0xe')](_0xa950('0x1e'))?this[_0xa950('0xe')](_0xa950('0x1e'))[_0xa950('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa950('0x6')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xa950('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa950('0x2')]},'description':{'type':Sequelize[_0xa950('0x2')]},'acw':{'type':Sequelize[_0xa950('0x1f')],'defaultValue':0x0,'set':function(_0xe3aeb){this[_0xa950('0xd')](_0xa950('0x20'),_0xe3aeb);if(_0xe3aeb){if(this[_0xa950('0xe')](_0xa950('0x21'))<0x2){this['setDataValue'](_0xa950('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa950('0x1f')],'defaultValue':0x0,'comment':_0xa950('0x22')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xa950('0x13'),_0xa950('0x23'),'predictive',_0xa950('0x10')),'defaultValue':_0xa950('0x13'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xa950('0x15')](0x4)[_0xa950('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa950('0x25')},'dialLimitQueue':{'type':Sequelize[_0xa950('0x15')](0x4)[_0xa950('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa950('0x26')},'dialPowerLevel':{'type':Sequelize[_0xa950('0x27')](0x2)[_0xa950('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xa950('0x6')](_0xa950('0x28'),'dropRate'),'defaultValue':_0xa950('0x29'),'comment':_0xa950('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa950('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa950('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xa950('0x15')](0x3)[_0xa950('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa950('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xa950('0x15')](0x3)[_0xa950('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xa950('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0xa950('0x15')](0x3)[_0xa950('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa950('0x2d')},'dialQueueProject':{'type':Sequelize[_0xa950('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xa950('0x15')](0x3)[_0xa950('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa950('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa950('0x2e')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa950('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa950('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xa950('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa950('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa950('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa950('0x15')](0x3)[_0xa950('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa950('0x32')},'dialTimezone':{'type':Sequelize[_0xa950('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa950('0x2')],'defaultValue':_0xa950('0x33')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa950('0x6')]('always',_0xa950('0x34'),_0xa950('0x35')),'defaultValue':_0xa950('0x36')},'dialAMDActive':{'type':Sequelize[_0xa950('0x1f')],'defaultValue':0x0,'comment':_0xa950('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0xa950('0x15')](0x9)[_0xa950('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa950('0x38')},'dialAMDGreeting':{'type':Sequelize[_0xa950('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa950('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa950('0x15')](0x9)[_0xa950('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa950('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa950('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa950('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0xa950('0x15')](0x9)[_0xa950('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa950('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa950('0x15')](0x9)[_0xa950('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa950('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xa950('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa950('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa950('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa950('0x15')](0x9)[_0xa950('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa950('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0xa950('0x15')](0x5)[_0xa950('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa950('0x40')},'dialRecallInQueue':{'type':Sequelize[_0xa950('0x1f')],'defaultValue':0x0,'comment':_0xa950('0x41')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xa950('0x42'),_0xa950('0x43')),'defaultValue':_0xa950('0x42')},'dialQueueProject2':{'type':Sequelize[_0xa950('0x2')],'comment':_0xa950('0x44')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa950('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xa950('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa950('0x45')},'dialCutDigit':{'type':Sequelize[_0xa950('0x15')](0x3)[_0xa950('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa950('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa950('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa950('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa950('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0xa950('0x15')](0x3)[_0xa950('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa950('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0xa950('0x15')](0x5)[_0xa950('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa950('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa950('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa950('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa950('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa950('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa950('0x15')](0x5)[_0xa950('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa950('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa950('0x15')](0x3)[_0xa950('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa950('0x15')](0x5)[_0xa950('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa950('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa950('0x15')],'allowNull':!![],'comment':_0xa950('0x4d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa950('0x4e'),'set':function(_0x117a56){if(!_0x117a56)this[_0xa950('0xd')](_0xa950('0x4f'),null);this[_0xa950('0xd')]('mandatoryDisposition',_0x117a56);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xa950('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa950('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 418edcc..3f82492 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 _0xd727=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ListId','phone','NOW()','scheduledAt','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','ContactId','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','VoiceQueues','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','sendStatus','error','stack','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','show','params','keys','options','find','create','body','user','get','inbound','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','findOne','CmHopper','order','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','addTeams','teams','voicePause','interface','Agents','forEach','penalty','transaction','each','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','User'];(function(_0x1070ff,_0x1ddf83){var _0x4b53a9=function(_0x19d722){while(--_0x19d722){_0x1070ff['push'](_0x1070ff['shift']());}};_0x4b53a9(++_0x1ddf83);}(_0xd727,0x1a1));var _0x7d72=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd727[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x7d72('0x0'));var rimraf=require(_0x7d72('0x1'));var zipdir=require(_0x7d72('0x2'));var jsonpatch=require(_0x7d72('0x3'));var rp=require(_0x7d72('0x4'));var moment=require(_0x7d72('0x5'));var BPromise=require(_0x7d72('0x6'));var Mustache=require(_0x7d72('0x7'));var util=require(_0x7d72('0x8'));var path=require('path');var sox=require(_0x7d72('0x9'));var csv=require('to-csv');var ejs=require(_0x7d72('0xa'));var fs=require('fs');var fs_extra=require(_0x7d72('0xb'));var _=require(_0x7d72('0xc'));var squel=require('squel');var crypto=require(_0x7d72('0xd'));var jsforce=require(_0x7d72('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d72('0xf'));var querystring=require(_0x7d72('0x10'));var Papa=require(_0x7d72('0x11'));var Redis=require(_0x7d72('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7d72('0x13'));var as=require(_0x7d72('0x14'));var hardwareService=require(_0x7d72('0x15'));var logger=require(_0x7d72('0x16'))(_0x7d72('0x17'));var utils=require('../../config/utils');var config=require(_0x7d72('0x18'));var licenseUtil=require(_0x7d72('0x19'));var db=require(_0x7d72('0x1a'))['db'];config[_0x7d72('0x1b')]=_['defaults'](config[_0x7d72('0x1b')],{'host':_0x7d72('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d72('0x1b')]));require(_0x7d72('0x1d'))[_0x7d72('0x1e')](socket);function respondWithStatusCode(_0x1f4101,_0x1a4d7d){_0x1a4d7d=_0x1a4d7d||0xcc;return function(_0x2c370b){if(_0x2c370b){return _0x1f4101['sendStatus'](_0x1a4d7d);}return _0x1f4101[_0x7d72('0x1f')](_0x1a4d7d)[_0x7d72('0x20')]();};}function respondWithResult(_0x14d453,_0x390901){_0x390901=_0x390901||0xc8;return function(_0x4bd097){if(_0x4bd097){return _0x14d453[_0x7d72('0x1f')](_0x390901)[_0x7d72('0x21')](_0x4bd097);}};}function respondWithFilteredResult(_0x251317,_0x66d124){return function(_0x3d5f5a){if(_0x3d5f5a){var _0x25b1ba=typeof _0x66d124[_0x7d72('0x22')]===_0x7d72('0x23')&&typeof _0x66d124[_0x7d72('0x24')]===_0x7d72('0x23');var _0x348ebc=_0x3d5f5a[_0x7d72('0x25')];var _0xb87262=_0x25b1ba?0x0:_0x66d124[_0x7d72('0x22')];var _0x1601fb=_0x25b1ba?_0x3d5f5a[_0x7d72('0x25')]:_0x66d124['offset']+_0x66d124[_0x7d72('0x24')];var _0x2c0671;if(_0x1601fb>=_0x348ebc){_0x1601fb=_0x348ebc;_0x2c0671=0xc8;}else{_0x2c0671=0xce;}_0x251317[_0x7d72('0x1f')](_0x2c0671);return _0x251317[_0x7d72('0x26')](_0x7d72('0x27'),_0xb87262+'-'+_0x1601fb+'/'+_0x348ebc)['json'](_0x3d5f5a);}return null;};}function patchUpdates(_0x3e11a3){return function(_0x18de50){try{jsonpatch['apply'](_0x18de50,_0x3e11a3,!![]);}catch(_0x6dd956){return BPromise[_0x7d72('0x28')](_0x6dd956);}return _0x18de50[_0x7d72('0x29')]();};}function saveUpdates(_0x9a6181,_0x118898){return function(_0x5291ad){if(_0x5291ad){return _0x5291ad[_0x7d72('0x2a')](_0x9a6181)[_0x7d72('0x2b')](function(_0x9461ee){return _0x9461ee;});}return null;};}function removeEntity(_0x396770,_0x291dc4){return function(_0x31c08f){if(_0x31c08f){return _0x31c08f[_0x7d72('0x2c')]()[_0x7d72('0x2b')](function(){var _0xca33b5=_0x31c08f['get']({'plain':!![]});var _0x2241b0=[{'name':_0x7d72('0x2d'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x7d72('0x2e'),'ignore':![]}];var _0x341558=_(_0x2241b0)[_0x7d72('0x2f')](_0x7d72('0x30'))[_0x7d72('0x31')]('value')[_0x7d72('0x32')]();if(_[_0x7d72('0x33')](_0x341558,_0xca33b5[_0x7d72('0x34')])){return;}var _0xb5258c=_['find'](_0x2241b0,[_0x7d72('0x32'),_0xca33b5['type']])[_0x7d72('0x35')];return db[_0x7d72('0x36')][_0x7d72('0x2c')]({'where':{'type':_0xb5258c,'resourceId':_0xca33b5['id']}})[_0x7d72('0x2b')](function(){return _0x31c08f;});})[_0x7d72('0x2b')](function(){_0x396770['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12d6db,_0x174e48){return function(_0x511366){if(!_0x511366){_0x12d6db[_0x7d72('0x37')](0x194);}return _0x511366;};}function handleError(_0x558e9e,_0x15f58f){_0x15f58f=_0x15f58f||0x1f4;return function(_0x373ef0){logger[_0x7d72('0x38')](_0x373ef0[_0x7d72('0x39')]);if(_0x373ef0['name']){delete _0x373ef0['name'];}_0x558e9e[_0x7d72('0x1f')](_0x15f58f)['send'](_0x373ef0);};}exports['index']=function(_0x4d2739,_0x23b6db){var _0x430c93={},_0x92ac77={},_0x432211={'count':0x0,'rows':[]};var _0xcfb285=_[_0x7d72('0x31')](db[_0x7d72('0x3a')][_0x7d72('0x3b')],function(_0x4a9f04){return{'name':_0x4a9f04[_0x7d72('0x3c')],'type':_0x4a9f04[_0x7d72('0x34')][_0x7d72('0x3d')]};});_0x92ac77[_0x7d72('0x3e')]=_['map'](_0xcfb285,_0x7d72('0x35'));_0x92ac77[_0x7d72('0x3f')]=_['keys'](_0x4d2739[_0x7d72('0x3f')]);_0x92ac77[_0x7d72('0x40')]=_[_0x7d72('0x41')](_0x92ac77['model'],_0x92ac77[_0x7d72('0x3f')]);_0x430c93[_0x7d72('0x42')]=_[_0x7d72('0x41')](_0x92ac77['model'],qs[_0x7d72('0x43')](_0x4d2739[_0x7d72('0x3f')][_0x7d72('0x43')]));_0x430c93[_0x7d72('0x42')]=_0x430c93[_0x7d72('0x42')][_0x7d72('0x44')]?_0x430c93[_0x7d72('0x42')]:_0x92ac77[_0x7d72('0x3e')];if(!_0x4d2739[_0x7d72('0x3f')][_0x7d72('0x45')](_0x7d72('0x46'))){_0x430c93[_0x7d72('0x24')]=qs[_0x7d72('0x24')](_0x4d2739[_0x7d72('0x3f')][_0x7d72('0x24')]);_0x430c93['offset']=qs['offset'](_0x4d2739['query'][_0x7d72('0x22')]);}_0x430c93['order']=qs[_0x7d72('0x47')](_0x4d2739[_0x7d72('0x3f')][_0x7d72('0x47')]);_0x430c93[_0x7d72('0x48')]=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0x4d2739['query'],_0x92ac77[_0x7d72('0x40')]),_0xcfb285);if(_0x4d2739[_0x7d72('0x3f')][_0x7d72('0x2f')]){_0x430c93['where']=_[_0x7d72('0x4a')](_0x430c93['where'],{'$or':_['map'](_0xcfb285,function(_0x41fab3){if(_0x41fab3[_0x7d72('0x34')]!=='VIRTUAL'){var _0x3028df={};_0x3028df[_0x41fab3['name']]={'$like':'%'+_0x4d2739['query']['filter']+'%'};return _0x3028df;}})});}_0x430c93=_[_0x7d72('0x4a')]({},_0x430c93,_0x4d2739['options']);var _0x5cd93f={'where':_0x430c93['where']};return db[_0x7d72('0x3a')]['count'](_0x5cd93f)[_0x7d72('0x2b')](function(_0x580d1a){_0x432211[_0x7d72('0x25')]=_0x580d1a;if(_0x4d2739[_0x7d72('0x3f')][_0x7d72('0x4b')]){_0x430c93[_0x7d72('0x4c')]=[{'all':!![]}];}return db[_0x7d72('0x3a')][_0x7d72('0x4d')](_0x430c93);})[_0x7d72('0x2b')](function(_0x59de21){_0x432211['rows']=_0x59de21;return _0x432211;})['then'](respondWithFilteredResult(_0x23b6db,_0x430c93))['catch'](handleError(_0x23b6db,null));};exports[_0x7d72('0x4e')]=function(_0x42141c,_0x50ea46){var _0x186df4={'raw':![],'where':{'id':_0x42141c[_0x7d72('0x4f')]['id']}},_0xda9b15={};_0xda9b15[_0x7d72('0x3e')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0xda9b15[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0x42141c[_0x7d72('0x3f')]);_0xda9b15[_0x7d72('0x40')]=_[_0x7d72('0x41')](_0xda9b15['model'],_0xda9b15['query']);_0x186df4['attributes']=_[_0x7d72('0x41')](_0xda9b15[_0x7d72('0x3e')],qs[_0x7d72('0x43')](_0x42141c[_0x7d72('0x3f')][_0x7d72('0x43')]));_0x186df4['attributes']=_0x186df4[_0x7d72('0x42')]['length']?_0x186df4[_0x7d72('0x42')]:_0xda9b15['model'];if(_0x42141c[_0x7d72('0x3f')]['includeAll']){_0x186df4[_0x7d72('0x4c')]=[{'all':!![]}];}_0x186df4=_[_0x7d72('0x4a')]({},_0x186df4,_0x42141c[_0x7d72('0x51')]);return db[_0x7d72('0x3a')][_0x7d72('0x52')](_0x186df4)[_0x7d72('0x2b')](handleEntityNotFound(_0x50ea46,null))[_0x7d72('0x2b')](respondWithResult(_0x50ea46,null))['catch'](handleError(_0x50ea46,null));};exports[_0x7d72('0x53')]=function(_0x40c18a,_0x1e39c7){return db[_0x7d72('0x3a')]['create'](_0x40c18a[_0x7d72('0x54')],{})[_0x7d72('0x2b')](function(_0x4ff982){var _0x144794=_0x40c18a[_0x7d72('0x55')][_0x7d72('0x56')]({'plain':!![]});if(!_0x144794)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x144794['role']==='user'){var _0x55a3a9=_0x4ff982[_0x7d72('0x56')]({'plain':!![]});var _0x4ec2c9=[{'name':_0x7d72('0x2d'),'value':_0x7d72('0x57')},{'name':'QueueCampaigns','value':'outbound'}];var _0x462a44=_[_0x7d72('0x52')](_0x4ec2c9,[_0x7d72('0x32'),_0x55a3a9[_0x7d72('0x34')]])[_0x7d72('0x35')];return db[_0x7d72('0x58')][_0x7d72('0x52')]({'where':{'name':_0x462a44,'userProfileId':_0x144794[_0x7d72('0x59')]},'raw':!![]})[_0x7d72('0x2b')](function(_0x258dd1){if(_0x258dd1&&_0x258dd1[_0x7d72('0x5a')]===0x0){return db[_0x7d72('0x36')]['create']({'name':_0x55a3a9[_0x7d72('0x35')],'resourceId':_0x55a3a9['id'],'type':_0x258dd1['name'],'sectionId':_0x258dd1['id']},{})[_0x7d72('0x2b')](function(){return _0x4ff982;});}else{return _0x4ff982;}})[_0x7d72('0x5b')](function(_0x5b4ee4){logger[_0x7d72('0x38')](_0x7d72('0x5c'),_0x5b4ee4);throw _0x5b4ee4;});}return _0x4ff982;})[_0x7d72('0x2b')](respondWithResult(_0x1e39c7,0xc9))[_0x7d72('0x5b')](handleError(_0x1e39c7,null));};exports[_0x7d72('0x5d')]=function(_0x25bcef,_0x2f8e69){var _0x5546e2={'where':{'id':_0x25bcef[_0x7d72('0x4f')]['id']}},_0x475129={};_0x475129['model']=_[_0x7d72('0x50')](db['VoiceQueue'][_0x7d72('0x3b')]);_0x5546e2[_0x7d72('0x42')]=_[_0x7d72('0x41')](_0x475129[_0x7d72('0x3e')],qs['fields'](_0x25bcef[_0x7d72('0x3f')][_0x7d72('0x43')]));_0x5546e2['attributes']=_0x5546e2[_0x7d72('0x42')]['length']?_0x5546e2['attributes']:_0x475129[_0x7d72('0x3e')];if(_0x25bcef[_0x7d72('0x3f')]['includeAll']){_0x5546e2[_0x7d72('0x4c')]=[{'all':!![]}];}_0x5546e2=_[_0x7d72('0x4a')]({},_0x5546e2,_0x25bcef[_0x7d72('0x51')]);return db[_0x7d72('0x3a')][_0x7d72('0x52')](_0x5546e2)[_0x7d72('0x2b')](handleEntityNotFound(_0x2f8e69,null))[_0x7d72('0x2b')](function(_0x29bc89){if(_0x29bc89){var _0x24f8b6=_0x29bc89[_0x7d72('0x56')]({'plain':!![]});_0x24f8b6=qs[_0x7d72('0x5e')](_0x24f8b6,['id',_0x7d72('0x5f'),_0x7d72('0x60')]);_0x25bcef[_0x7d72('0x54')]=_[_0x7d72('0x5e')](_0x25bcef[_0x7d72('0x54')],['id','createdAt','updatedAt']);return db[_0x7d72('0x3a')][_0x7d72('0x53')](_[_0x7d72('0x4a')](_0x24f8b6,_0x25bcef[_0x7d72('0x54')]),{'include':_0x25bcef[_0x7d72('0x3f')][_0x7d72('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x9317bb){var _0x357a16=_0x25bcef['user'][_0x7d72('0x56')]({'plain':!![]});if(!_0x357a16)throw new Error(_0x7d72('0x61'));if(_0x357a16['role']==='user'){var _0x2c841b=_0x9317bb[_0x7d72('0x56')]({'plain':!![]});var _0x3d68b7=[{'name':'VoiceQueues','value':_0x7d72('0x57')},{'name':_0x7d72('0x62'),'value':_0x7d72('0x2e')}];var _0x91f079=_[_0x7d72('0x52')](_0x3d68b7,['value',_0x2c841b[_0x7d72('0x34')]])[_0x7d72('0x35')];return db[_0x7d72('0x58')][_0x7d72('0x52')]({'where':{'name':_0x91f079,'userProfileId':_0x357a16[_0x7d72('0x59')]},'raw':!![]})[_0x7d72('0x2b')](function(_0xd49c14){if(_0xd49c14&&_0xd49c14['autoAssociation']===0x0){return db[_0x7d72('0x36')][_0x7d72('0x53')]({'name':_0x2c841b[_0x7d72('0x35')],'resourceId':_0x2c841b['id'],'type':_0xd49c14[_0x7d72('0x35')],'sectionId':_0xd49c14['id']},{})[_0x7d72('0x2b')](function(){return _0x9317bb;});}else{return _0x9317bb;}})[_0x7d72('0x5b')](function(_0x276678){logger['error'](_0x7d72('0x5c'),_0x276678);throw _0x276678;});}return _0x9317bb;});}})['then'](respondWithResult(_0x2f8e69,0xc9))[_0x7d72('0x5b')](handleError(_0x2f8e69,null));};exports[_0x7d72('0x2a')]=function(_0x3bb389,_0x14cfea){if(_0x3bb389[_0x7d72('0x54')]['id']){delete _0x3bb389[_0x7d72('0x54')]['id'];}return db[_0x7d72('0x3a')][_0x7d72('0x52')]({'where':{'id':_0x3bb389[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x14cfea,null))[_0x7d72('0x2b')](saveUpdates(_0x3bb389[_0x7d72('0x54')],null))[_0x7d72('0x2b')](respondWithResult(_0x14cfea,null))[_0x7d72('0x5b')](handleError(_0x14cfea,null));};exports[_0x7d72('0x2c')]=function(_0x4e6398,_0x399e2e){return db[_0x7d72('0x3a')][_0x7d72('0x52')]({'where':{'id':_0x4e6398[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x399e2e,null))['then'](removeEntity(_0x399e2e,null))['catch'](handleError(_0x399e2e,null));};exports['getHoppers']=function(_0x820ea4,_0x169d25,_0x3cdbbb){var _0x10aba4={'raw':![],'where':{}};var _0x474683={};var _0x320568={'count':0x0,'rows':[]};return db[_0x7d72('0x3a')][_0x7d72('0x63')]({'where':{'id':_0x820ea4[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x169d25,null))[_0x7d72('0x2b')](function(_0x2ab1c2){if(_0x2ab1c2){_0x474683[_0x7d72('0x3e')]=_[_0x7d72('0x50')](db[_0x7d72('0x64')][_0x7d72('0x3b')]);_0x474683[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0x820ea4[_0x7d72('0x3f')]);_0x474683[_0x7d72('0x40')]=_[_0x7d72('0x41')](_0x474683[_0x7d72('0x3e')],_0x474683[_0x7d72('0x3f')]);_0x10aba4[_0x7d72('0x42')]=_[_0x7d72('0x41')](_0x474683[_0x7d72('0x3e')],qs[_0x7d72('0x43')](_0x820ea4[_0x7d72('0x3f')][_0x7d72('0x43')]));_0x10aba4[_0x7d72('0x42')]=_0x10aba4[_0x7d72('0x42')][_0x7d72('0x44')]?_0x10aba4[_0x7d72('0x42')]:_0x474683[_0x7d72('0x3e')];if(!_0x820ea4['query'][_0x7d72('0x45')](_0x7d72('0x46'))){_0x10aba4['limit']=qs[_0x7d72('0x24')](_0x820ea4[_0x7d72('0x3f')][_0x7d72('0x24')]);_0x10aba4[_0x7d72('0x22')]=qs['offset'](_0x820ea4[_0x7d72('0x3f')]['offset']);}_0x10aba4[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0x820ea4['query'][_0x7d72('0x47')]);_0x10aba4[_0x7d72('0x48')]=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0x820ea4[_0x7d72('0x3f')],_0x474683[_0x7d72('0x40')]));_0x10aba4['where'][_0x7d72('0x66')]=_0x2ab1c2['id'];if(_0x820ea4['query'][_0x7d72('0x2f')]){_0x10aba4[_0x7d72('0x48')]=_[_0x7d72('0x4a')](_0x10aba4[_0x7d72('0x48')],{'$or':_[_0x7d72('0x31')](_0x10aba4[_0x7d72('0x42')],function(_0x1ad0c0){var _0xc846a9={};_0xc846a9[_0x1ad0c0]={'$like':'%'+_0x820ea4[_0x7d72('0x3f')][_0x7d72('0x2f')]+'%'};return _0xc846a9;})});}_0x10aba4=_['merge']({},_0x10aba4,_0x820ea4[_0x7d72('0x51')]);return db[_0x7d72('0x64')][_0x7d72('0x25')]({'where':_0x10aba4['where']})[_0x7d72('0x2b')](function(_0x32a609){_0x320568[_0x7d72('0x25')]=_0x32a609;if(_0x820ea4[_0x7d72('0x3f')][_0x7d72('0x4b')]){_0x10aba4['include']=[{'all':!![]}];}return db[_0x7d72('0x64')]['findAll'](_0x10aba4);})[_0x7d72('0x2b')](function(_0x381df4){_0x320568[_0x7d72('0x67')]=_0x381df4;return _0x320568;});}})[_0x7d72('0x2b')](respondWithFilteredResult(_0x169d25,_0x10aba4))[_0x7d72('0x5b')](handleError(_0x169d25,null));};exports[_0x7d72('0x68')]=function(_0x152e1b,_0x2a593c,_0x22942c){var _0x1aea60={'raw':!![],'where':{}};var _0x4f61ef={};var _0x132c31={'count':0x0,'rows':[]};return db[_0x7d72('0x3a')][_0x7d72('0x63')]({'where':{'id':_0x152e1b[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x2a593c,null))[_0x7d72('0x2b')](function(_0x59703e){if(_0x59703e){_0x4f61ef[_0x7d72('0x3e')]=_['keys'](db[_0x7d72('0x69')][_0x7d72('0x3b')]);_0x4f61ef[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0x152e1b['query']);_0x4f61ef['filters']=_[_0x7d72('0x41')](_0x4f61ef[_0x7d72('0x3e')],_0x4f61ef['query']);_0x1aea60['attributes']=_['intersection'](_0x4f61ef[_0x7d72('0x3e')],qs[_0x7d72('0x43')](_0x152e1b[_0x7d72('0x3f')][_0x7d72('0x43')]));_0x1aea60[_0x7d72('0x42')]=_0x1aea60[_0x7d72('0x42')][_0x7d72('0x44')]?_0x1aea60[_0x7d72('0x42')]:_0x4f61ef[_0x7d72('0x3e')];if(!_0x152e1b[_0x7d72('0x3f')]['hasOwnProperty'](_0x7d72('0x46'))){_0x1aea60[_0x7d72('0x24')]=qs[_0x7d72('0x24')](_0x152e1b['query'][_0x7d72('0x24')]);_0x1aea60['offset']=qs['offset'](_0x152e1b['query'][_0x7d72('0x22')]);}_0x1aea60[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0x152e1b[_0x7d72('0x3f')]['sort']);_0x1aea60['where']=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0x152e1b[_0x7d72('0x3f')],_0x4f61ef[_0x7d72('0x40')]));_0x1aea60['where']['VoiceQueueId']=_0x59703e['id'];if(_0x152e1b[_0x7d72('0x3f')][_0x7d72('0x2f')]){_0x1aea60[_0x7d72('0x48')]=_['merge'](_0x1aea60[_0x7d72('0x48')],{'$or':_['map'](_0x1aea60['attributes'],function(_0x2e2d4a){var _0x16c493={};_0x16c493[_0x2e2d4a]={'$like':'%'+_0x152e1b[_0x7d72('0x3f')][_0x7d72('0x2f')]+'%'};return _0x16c493;})});}_0x1aea60=_['merge']({},_0x1aea60,_0x152e1b[_0x7d72('0x51')]);return db['CmHopperHistory'][_0x7d72('0x25')]({'where':_0x1aea60[_0x7d72('0x48')]})[_0x7d72('0x2b')](function(_0x2b82d4){_0x132c31[_0x7d72('0x25')]=_0x2b82d4;if(_0x152e1b['query']['includeAll']){_0x1aea60[_0x7d72('0x4c')]=[{'all':!![]}];}return db[_0x7d72('0x69')][_0x7d72('0x4d')](_0x1aea60);})[_0x7d72('0x2b')](function(_0x2b56c9){_0x132c31[_0x7d72('0x67')]=_0x2b56c9;return _0x132c31;});}})[_0x7d72('0x2b')](respondWithFilteredResult(_0x2a593c,_0x1aea60))['catch'](handleError(_0x2a593c,null));};exports[_0x7d72('0x6a')]=function(_0x1feaba,_0xbcca1f,_0x2aebd9){var _0x1adeb3={'raw':!![],'where':{}};var _0x463725={};var _0x3fa7b6={'count':0x0,'rows':[]};return db[_0x7d72('0x3a')][_0x7d72('0x63')]({'where':{'id':_0x1feaba[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0xbcca1f,null))[_0x7d72('0x2b')](function(_0x4448a8){if(_0x4448a8){_0x463725[_0x7d72('0x3e')]=_[_0x7d72('0x50')](db['CmHopperFinal']['rawAttributes']);_0x463725[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0x1feaba[_0x7d72('0x3f')]);_0x463725[_0x7d72('0x40')]=_['intersection'](_0x463725['model'],_0x463725[_0x7d72('0x3f')]);_0x1adeb3[_0x7d72('0x42')]=_[_0x7d72('0x41')](_0x463725[_0x7d72('0x3e')],qs[_0x7d72('0x43')](_0x1feaba['query'][_0x7d72('0x43')]));_0x1adeb3['attributes']=_0x1adeb3[_0x7d72('0x42')]['length']?_0x1adeb3['attributes']:_0x463725[_0x7d72('0x3e')];if(!_0x1feaba[_0x7d72('0x3f')][_0x7d72('0x45')](_0x7d72('0x46'))){_0x1adeb3[_0x7d72('0x24')]=qs[_0x7d72('0x24')](_0x1feaba[_0x7d72('0x3f')][_0x7d72('0x24')]);_0x1adeb3[_0x7d72('0x22')]=qs[_0x7d72('0x22')](_0x1feaba[_0x7d72('0x3f')]['offset']);}_0x1adeb3[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0x1feaba['query']['sort']);_0x1adeb3[_0x7d72('0x48')]=qs['filters'](_[_0x7d72('0x49')](_0x1feaba[_0x7d72('0x3f')],_0x463725['filters']));_0x1adeb3[_0x7d72('0x48')]['VoiceQueueId']=_0x4448a8['id'];if(_0x1feaba[_0x7d72('0x3f')]['filter']){_0x1adeb3['where']=_['merge'](_0x1adeb3[_0x7d72('0x48')],{'$or':_[_0x7d72('0x31')](_0x1adeb3[_0x7d72('0x42')],function(_0x317970){var _0x404a32={};_0x404a32[_0x317970]={'$like':'%'+_0x1feaba['query'][_0x7d72('0x2f')]+'%'};return _0x404a32;})});}_0x1adeb3=_[_0x7d72('0x4a')]({},_0x1adeb3,_0x1feaba[_0x7d72('0x51')]);return db[_0x7d72('0x6b')][_0x7d72('0x25')]({'where':_0x1adeb3['where']})[_0x7d72('0x2b')](function(_0x20a4dc){_0x3fa7b6['count']=_0x20a4dc;if(_0x1feaba[_0x7d72('0x3f')]['includeAll']){_0x1adeb3['include']=[{'all':!![]}];}return db[_0x7d72('0x6b')][_0x7d72('0x4d')](_0x1adeb3);})[_0x7d72('0x2b')](function(_0x58d73f){_0x3fa7b6[_0x7d72('0x67')]=_0x58d73f;return _0x3fa7b6;});}})[_0x7d72('0x2b')](respondWithFilteredResult(_0xbcca1f,_0x1adeb3))[_0x7d72('0x5b')](handleError(_0xbcca1f,null));};exports[_0x7d72('0x6c')]=function(_0x46b52e,_0x278a86,_0x29f1a3){var _0x5c44de={'raw':!![],'where':{}};var _0x1b00a3={};var _0x2d93ed={'count':0x0,'rows':[]};return db[_0x7d72('0x3a')][_0x7d72('0x63')]({'where':{'id':_0x46b52e[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x278a86,null))['then'](function(_0x1d662b){if(_0x1d662b){_0x1b00a3[_0x7d72('0x3e')]=_['keys'](db[_0x7d72('0x6d')]['rawAttributes']);_0x1b00a3[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0x46b52e[_0x7d72('0x3f')]);_0x1b00a3[_0x7d72('0x40')]=_['intersection'](_0x1b00a3[_0x7d72('0x3e')],_0x1b00a3[_0x7d72('0x3f')]);_0x5c44de['attributes']=_[_0x7d72('0x41')](_0x1b00a3[_0x7d72('0x3e')],qs[_0x7d72('0x43')](_0x46b52e[_0x7d72('0x3f')]['fields']));_0x5c44de['attributes']=_0x5c44de[_0x7d72('0x42')][_0x7d72('0x44')]?_0x5c44de[_0x7d72('0x42')]:_0x1b00a3[_0x7d72('0x3e')];if(!_0x46b52e[_0x7d72('0x3f')][_0x7d72('0x45')](_0x7d72('0x46'))){_0x5c44de[_0x7d72('0x24')]=qs[_0x7d72('0x24')](_0x46b52e[_0x7d72('0x3f')][_0x7d72('0x24')]);_0x5c44de[_0x7d72('0x22')]=qs[_0x7d72('0x22')](_0x46b52e[_0x7d72('0x3f')][_0x7d72('0x22')]);}_0x5c44de[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0x46b52e['query'][_0x7d72('0x47')]);_0x5c44de[_0x7d72('0x48')]=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0x46b52e['query'],_0x1b00a3[_0x7d72('0x40')]));_0x5c44de['where'][_0x7d72('0x66')]=_0x1d662b['id'];if(_0x46b52e[_0x7d72('0x3f')]['filter']){_0x5c44de[_0x7d72('0x48')]=_[_0x7d72('0x4a')](_0x5c44de[_0x7d72('0x48')],{'$or':_['map'](_0x5c44de['attributes'],function(_0x36e599){var _0x4b0cfd={};_0x4b0cfd[_0x36e599]={'$like':'%'+_0x46b52e[_0x7d72('0x3f')][_0x7d72('0x2f')]+'%'};return _0x4b0cfd;})});}_0x5c44de=_['merge']({},_0x5c44de,_0x46b52e[_0x7d72('0x51')]);return db['CmHopperBlack']['count']({'where':_0x5c44de[_0x7d72('0x48')]})[_0x7d72('0x2b')](function(_0x4609c7){_0x2d93ed[_0x7d72('0x25')]=_0x4609c7;if(_0x46b52e[_0x7d72('0x3f')][_0x7d72('0x4b')]){_0x5c44de['include']=[{'all':!![]}];}return db[_0x7d72('0x6d')][_0x7d72('0x4d')](_0x5c44de);})[_0x7d72('0x2b')](function(_0x5c9154){_0x2d93ed['rows']=_0x5c9154;return _0x2d93ed;});}})[_0x7d72('0x2b')](respondWithFilteredResult(_0x278a86,_0x5c44de))[_0x7d72('0x5b')](handleError(_0x278a86,null));};exports['getTeams']=function(_0xe9afb5,_0x5e4e49,_0x3a48cd){var _0x82a31={};var _0x56e790={};var _0x445bc5;var _0x1051bb;return db[_0x7d72('0x3a')][_0x7d72('0x63')]({'where':{'id':_0xe9afb5[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x5e4e49,null))['then'](function(_0x106fae){if(_0x106fae){_0x445bc5=_0x106fae;_0x56e790[_0x7d72('0x3e')]=_[_0x7d72('0x50')](db[_0x7d72('0x6e')]['rawAttributes']);_0x56e790[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0xe9afb5['query']);_0x56e790['filters']=_[_0x7d72('0x41')](_0x56e790[_0x7d72('0x3e')],_0x56e790['query']);_0x82a31[_0x7d72('0x42')]=_[_0x7d72('0x41')](_0x56e790['model'],qs[_0x7d72('0x43')](_0xe9afb5[_0x7d72('0x3f')]['fields']));_0x82a31[_0x7d72('0x42')]=_0x82a31['attributes']['length']?_0x82a31[_0x7d72('0x42')]:_0x56e790[_0x7d72('0x3e')];_0x82a31[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0xe9afb5[_0x7d72('0x3f')][_0x7d72('0x47')]);_0x82a31[_0x7d72('0x48')]=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0xe9afb5[_0x7d72('0x3f')],_0x56e790[_0x7d72('0x40')]));if(_0xe9afb5[_0x7d72('0x3f')][_0x7d72('0x2f')]){_0x82a31[_0x7d72('0x48')]=_[_0x7d72('0x4a')](_0x82a31[_0x7d72('0x48')],{'$or':_[_0x7d72('0x31')](_0x82a31[_0x7d72('0x42')],function(_0x4f0cfe){var _0x41da85={};_0x41da85[_0x4f0cfe]={'$like':'%'+_0xe9afb5[_0x7d72('0x3f')][_0x7d72('0x2f')]+'%'};return _0x41da85;})});}_0x82a31=_[_0x7d72('0x4a')]({},_0x82a31,_0xe9afb5['options']);return _0x445bc5['getTeams'](_0x82a31);}})['then'](function(_0x5c12a8){if(_0x5c12a8){_0x1051bb=_0x5c12a8['length'];if(!_0xe9afb5['query'][_0x7d72('0x45')](_0x7d72('0x46'))){_0x82a31[_0x7d72('0x24')]=qs[_0x7d72('0x24')](_0xe9afb5['query']['limit']);_0x82a31[_0x7d72('0x22')]=qs[_0x7d72('0x22')](_0xe9afb5['query'][_0x7d72('0x22')]);}return _0x445bc5['getTeams'](_0x82a31);}})[_0x7d72('0x2b')](function(_0xb76e8e){if(_0xb76e8e){return _0xb76e8e?{'count':_0x1051bb,'rows':_0xb76e8e}:null;}})['then'](respondWithResult(_0x5e4e49,null))[_0x7d72('0x5b')](handleError(_0x5e4e49,null));};exports[_0x7d72('0x6f')]=function(_0xfa8925,_0x54b0f3,_0x3164db){var _0x59802d=_0xfa8925[_0x7d72('0x54')][_0x7d72('0x70')];var _0x50a0a5=_[_0x7d72('0x31')](_0x59802d,'id');return db[_0x7d72('0x6e')][_0x7d72('0x4d')]({'where':{'id':_0x50a0a5},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7d72('0x35'),'online',_0x7d72('0x71'),_0x7d72('0x72')],'raw':!![]}]})['then'](function(_0x540fcf){if(_0x540fcf){var _0xbcfe51=_['flatMap'](_0x540fcf,function(_0x2f46d7){var _0x500f00=_0x2f46d7[_0x7d72('0x56')]({'plain':!![]});_0x500f00[_0x7d72('0x73')][_0x7d72('0x74')](function(_0x2dcbdc){_0x2dcbdc[_0x7d72('0x75')]=_[_0x7d72('0x52')](_0x59802d,{'id':_0x500f00['id']})[_0x7d72('0x75')];});return _0x500f00[_0x7d72('0x73')];});return db['VoiceQueue']['find']({'where':{'id':_0xfa8925['params']['id']}})['then'](function(_0x223ec3){return db['sequelize'][_0x7d72('0x76')](function(_0x23c57f){return _0x223ec3[_0x7d72('0x6f')](_0x50a0a5,{'transaction':_0x23c57f})[_0x7d72('0x2b')](function(){return BPromise[_0x7d72('0x77')](_0x59802d,function(_0x38ead3){return db['TeamVoiceQueue'][_0x7d72('0x78')]({'TeamId':_0x38ead3['id'],'VoiceQueueId':_0xfa8925[_0x7d72('0x4f')]['id'],'penalty':_0x38ead3[_0x7d72('0x75')]},{'transaction':_0x23c57f});});})['then'](function(){return BPromise['each'](_0xbcfe51,function(_0x1af354){return db['UserVoiceQueue'][_0x7d72('0x79')]({'where':{'UserId':_0x1af354['id'],'VoiceQueueId':_0xfa8925[_0x7d72('0x4f')]['id']},'defaults':{'penalty':_0x1af354[_0x7d72('0x75')]},'transaction':_0x23c57f});});})[_0x7d72('0x2b')](function(){return BPromise['each'](_[_0x7d72('0x2f')](_0xbcfe51,{'online':!![]}),function(_0x2795c7){return db[_0x7d72('0x7a')]['upsert']({'membername':_0x2795c7['name'],'UserId':_0x2795c7['id'],'queue_name':_0x223ec3['name'],'VoiceQueueId':_0x223ec3['id'],'interface':_[_0x7d72('0x7b')](_0x2795c7[_0x7d72('0x72')])?util[_0x7d72('0x7c')](_0x7d72('0x7d'),_0x2795c7[_0x7d72('0x35')]):_0x2795c7['interface'],'paused':_0x2795c7[_0x7d72('0x71')]||![],'penalty':_0x2795c7[_0x7d72('0x75')]},{'transaction':_0x23c57f});});})['then'](function(){_0xbcfe51['forEach'](function(_0x1832b6){socket[_0x7d72('0x7e')](_0x7d72('0x7f'),{'UserId':_0x1832b6['id'],'VoiceQueueId':_0x223ec3['id']});});});});});}})[_0x7d72('0x2b')](respondWithStatusCode(_0x54b0f3,null))['catch'](handleError(_0x54b0f3,null));};exports['removeTeams']=function(_0x566a1d,_0x5455b1,_0x3a3831){return db[_0x7d72('0x6e')][_0x7d72('0x4d')]({'where':{'id':_0x566a1d['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x7d72('0x80')],'as':_0x7d72('0x73'),'attributes':['id'],'raw':!![]}]})[_0x7d72('0x2b')](handleEntityNotFound(_0x5455b1,null))[_0x7d72('0x2b')](function(_0x2eddb7){var _0x56149b=_['map'](_0x2eddb7,'id');var _0xe5cf4f=[];var _0x226a25=[];var _0x26f819=squel[_0x7d72('0x81')]();_0x26f819[_0x7d72('0x82')](_0x7d72('0x83'))[_0x7d72('0x84')](_0x7d72('0x85'),'tq')[_0x7d72('0x86')](_0x7d72('0x87'),'ut',_0x7d72('0x88'))[_0x7d72('0x48')](_0x7d72('0x89'),_0x566a1d[_0x7d72('0x4f')]['id']);for(var _0x175e73=0x0;_0x175e73<_0x2eddb7[_0x7d72('0x44')];_0x175e73+=0x1){let _0x28fa35=_0x2eddb7[_0x175e73];for(var _0x3a310e=0x0;_0x3a310e<_0x28fa35[_0x7d72('0x73')]['length'];_0x3a310e+=0x1){let _0x1c5bf9=_0x28fa35['Agents'][_0x3a310e];var _0x56fe55=_0x26f819[_0x7d72('0x5d')]();_0x56fe55['where']('ut.UserId\x20=\x20?',_0x1c5bf9['id']);_0x226a25[_0x7d72('0x8a')](db[_0x7d72('0x8b')][_0x7d72('0x3f')](_0x56fe55[_0x7d72('0x8c')](),{'type':db['sequelize'][_0x7d72('0x8d')][_0x7d72('0x8e')]})[_0x7d72('0x2b')](function(_0x5814be){if(_0x5814be[_0x7d72('0x44')]===0x1){return _0x1c5bf9['id'];}else{var _0x44e6b5=_[_0x7d72('0x8f')](_[_0x7d72('0x31')](_0x5814be,'TeamId'),function(_0x3553f2){return _[_0x7d72('0x33')](_0x56149b,_0x3553f2);});if(_0x44e6b5){return _0x1c5bf9['id'];}}}));}}return BPromise[_0x7d72('0x90')](_0x226a25)[_0x7d72('0x2b')](function(_0x212aa2){_0xe5cf4f=_(_0xe5cf4f)[_0x7d72('0x91')](_0x212aa2)[_0x7d72('0x92')]()[_0x7d72('0x32')]();return db['VoiceQueue'][_0x7d72('0x52')]({'where':{'id':_0x566a1d[_0x7d72('0x4f')]['id']}})['then'](function(_0x516301){return db[_0x7d72('0x8b')][_0x7d72('0x76')](function(_0x5d4535){return _0x516301['removeTeams'](_0x566a1d[_0x7d72('0x3f')][_0x7d72('0x93')],{'transaction':_0x5d4535})[_0x7d72('0x2b')](function(){if(!_[_0x7d72('0x94')](_0xe5cf4f)){return _0x516301[_0x7d72('0x95')](_0xe5cf4f,{'transaction':_0x5d4535})[_0x7d72('0x2b')](function(){return db['UserVoiceQueueRt'][_0x7d72('0x2c')]({'where':{'VoiceQueueId':_0x566a1d[_0x7d72('0x4f')]['id'],'UserId':_0xe5cf4f},'transaction':_0x5d4535});});}})[_0x7d72('0x2b')](function(){_0xe5cf4f[_0x7d72('0x74')](function(_0x5968b7){socket[_0x7d72('0x7e')](_0x7d72('0x96'),{'UserId':_0x5968b7,'VoiceQueueId':_0x516301['id']});});});});});});})[_0x7d72('0x2b')](respondWithStatusCode(_0x5455b1,null))['catch'](handleError(_0x5455b1,null));};exports[_0x7d72('0x97')]=function(_0x279ece,_0x2f9a90,_0x28b59e){var _0x1d1c06,_0x407350;return db[_0x7d72('0x3a')][_0x7d72('0x52')]({'where':{'id':_0x279ece[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x2f9a90,null))['then'](function(_0x1eb334){if(_0x1eb334){_0x407350=_0x1eb334;return _0x1eb334[_0x7d72('0x97')](_0x279ece[_0x7d72('0x54')][_0x7d72('0x93')],_['omit'](_0x279ece[_0x7d72('0x54')],[_0x7d72('0x93'),'id'])||{})[_0x7d72('0x98')](function(_0x12d479){for(var _0x9a2485=0x0;_0x9a2485<_0x279ece[_0x7d72('0x54')][_0x7d72('0x93')]['length'];_0x9a2485+=0x1){socket[_0x7d72('0x7e')](_0x7d72('0x7f'),{'UserId':Number(_0x279ece[_0x7d72('0x54')][_0x7d72('0x93')][_0x9a2485]),'VoiceQueueId':Number(_0x279ece[_0x7d72('0x4f')]['id'])});}return _0x12d479;});}})[_0x7d72('0x2b')](function(_0x457971){_0x1d1c06=_0x457971||[];if(_0x407350){return db[_0x7d72('0x80')]['findAll']({'where':{'id':_0x279ece[_0x7d72('0x54')]['ids']},'attributes':['id',_0x7d72('0x35'),_0x7d72('0x99'),_0x7d72('0x71'),_0x7d72('0x72')],'raw':!![]});}})[_0x7d72('0x2b')](function(_0x5db0a0){if(!_['isEmpty'](_0x5db0a0)){var _0x1065e3=[];for(var _0x41907f=0x0;_0x41907f<_0x5db0a0[_0x7d72('0x44')];_0x41907f++){if(_0x5db0a0[_0x41907f]['online']){_0x1065e3['push'](db[_0x7d72('0x7a')][_0x7d72('0x78')]({'membername':_0x5db0a0[_0x41907f][_0x7d72('0x35')],'UserId':_0x5db0a0[_0x41907f]['id'],'queue_name':_0x407350[_0x7d72('0x35')],'VoiceQueueId':_0x407350['id'],'interface':_[_0x7d72('0x7b')](_0x5db0a0[_0x41907f][_0x7d72('0x72')])?util[_0x7d72('0x7c')](_0x7d72('0x7d'),_0x5db0a0[_0x41907f][_0x7d72('0x35')]):_0x5db0a0[_0x41907f][_0x7d72('0x72')],'paused':_0x5db0a0[_0x41907f]['voicePause']||![],'penalty':_0x279ece[_0x7d72('0x54')]['penalty']||0x0}));}}return BPromise[_0x7d72('0x90')](_0x1065e3);}})[_0x7d72('0x2b')](function(){return _0x1d1c06;})['then'](respondWithResult(_0x2f9a90,null))[_0x7d72('0x5b')](handleError(_0x2f9a90,null));};exports[_0x7d72('0x95')]=function(_0x4cdd8f,_0x5793c5,_0x152513){return db[_0x7d72('0x3a')][_0x7d72('0x52')]({'where':{'id':_0x4cdd8f[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x5793c5,null))[_0x7d72('0x2b')](function(_0x10fcec){if(_0x10fcec){return _0x10fcec[_0x7d72('0x95')](_0x4cdd8f['query'][_0x7d72('0x93')])['then'](function(){if(_[_0x7d72('0x9a')](_0x4cdd8f['query']['ids'])){for(var _0x21542f=0x0;_0x21542f<_0x4cdd8f[_0x7d72('0x3f')]['ids'][_0x7d72('0x44')];_0x21542f+=0x1){socket[_0x7d72('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x4cdd8f[_0x7d72('0x3f')]['ids'][_0x21542f]),'VoiceQueueId':Number(_0x4cdd8f['params']['id'])});}}else{socket[_0x7d72('0x7e')](_0x7d72('0x96'),{'UserId':Number(_0x4cdd8f['query'][_0x7d72('0x93')]),'VoiceQueueId':Number(_0x4cdd8f[_0x7d72('0x4f')]['id'])});}});}})['then'](function(_0x5880c7){return db['UserVoiceQueueRt'][_0x7d72('0x2c')]({'where':{'VoiceQueueId':_0x4cdd8f['params']['id'],'UserId':_0x4cdd8f['query']['ids']}})['then'](function(){return _0x5880c7;});})[_0x7d72('0x2b')](respondWithStatusCode(_0x5793c5,null))[_0x7d72('0x5b')](handleError(_0x5793c5,null));};exports[_0x7d72('0x9b')]=function(_0x416254,_0xee5814,_0x361170){var _0x339471={};var _0x181f93={};var _0xac6678;var _0xa74688;return db[_0x7d72('0x3a')]['findOne']({'where':{'id':_0x416254[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0xee5814,null))[_0x7d72('0x2b')](function(_0x329f9a){if(_0x329f9a){_0xac6678=_0x329f9a;_0x181f93['model']=_['keys'](db[_0x7d72('0x80')]['rawAttributes']);_0x181f93['query']=_[_0x7d72('0x50')](_0x416254[_0x7d72('0x3f')]);_0x181f93[_0x7d72('0x40')]=_[_0x7d72('0x41')](_0x181f93['model'],_0x181f93[_0x7d72('0x3f')]);_0x339471['attributes']=_[_0x7d72('0x41')](_0x181f93[_0x7d72('0x3e')],qs[_0x7d72('0x43')](_0x416254[_0x7d72('0x3f')][_0x7d72('0x43')]));_0x339471['attributes']=_0x339471[_0x7d72('0x42')]['length']?_0x339471[_0x7d72('0x42')]:_0x181f93[_0x7d72('0x3e')];_0x339471[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0x416254[_0x7d72('0x3f')][_0x7d72('0x47')]);_0x339471[_0x7d72('0x48')]=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0x416254[_0x7d72('0x3f')],_0x181f93['filters']));if(_0x416254[_0x7d72('0x3f')][_0x7d72('0x2f')]){_0x339471[_0x7d72('0x48')]=_[_0x7d72('0x4a')](_0x339471[_0x7d72('0x48')],{'$or':_[_0x7d72('0x31')](_0x339471['attributes'],function(_0xc39e2c){var _0x4e0bc9={};_0x4e0bc9[_0xc39e2c]={'$like':'%'+_0x416254['query'][_0x7d72('0x2f')]+'%'};return _0x4e0bc9;})});}_0x339471=_[_0x7d72('0x4a')]({},_0x339471,_0x416254['options']);return _0xac6678[_0x7d72('0x9b')](_0x339471);}})[_0x7d72('0x2b')](function(_0x565587){if(_0x565587){_0xa74688=_0x565587[_0x7d72('0x44')];if(!_0x416254[_0x7d72('0x3f')][_0x7d72('0x45')](_0x7d72('0x46'))){_0x339471[_0x7d72('0x24')]=qs['limit'](_0x416254[_0x7d72('0x3f')]['limit']);_0x339471[_0x7d72('0x22')]=qs[_0x7d72('0x22')](_0x416254[_0x7d72('0x3f')][_0x7d72('0x22')]);}return _0xac6678['getAgents'](_0x339471);}})['then'](function(_0x2412f6){if(_0x2412f6){return _0x2412f6?{'count':_0xa74688,'rows':_0x2412f6}:null;}})[_0x7d72('0x2b')](respondWithResult(_0xee5814,null))[_0x7d72('0x5b')](handleError(_0xee5814,null));};exports[_0x7d72('0x9c')]=function(_0x5d9570,_0x1dfff1,_0x425cd1){var _0x19594e={};var _0x18ce24={};var _0x5b3eb9;var _0x4bcd80;return db[_0x7d72('0x3a')][_0x7d72('0x63')]({'where':{'id':_0x5d9570[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x1dfff1,null))[_0x7d72('0x2b')](function(_0x4a85f5){if(_0x4a85f5){_0x5b3eb9=_0x4a85f5;_0x18ce24[_0x7d72('0x3e')]=_[_0x7d72('0x50')](db[_0x7d72('0x7a')][_0x7d72('0x3b')]);_0x18ce24[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0x5d9570[_0x7d72('0x3f')]);_0x18ce24[_0x7d72('0x40')]=_['intersection'](_0x18ce24[_0x7d72('0x3e')],_0x18ce24[_0x7d72('0x3f')]);_0x19594e[_0x7d72('0x42')]=_[_0x7d72('0x41')](_0x18ce24[_0x7d72('0x3e')],qs[_0x7d72('0x43')](_0x5d9570['query']['fields']));_0x19594e['attributes']=_0x19594e['attributes'][_0x7d72('0x44')]?_0x19594e[_0x7d72('0x42')]:_0x18ce24[_0x7d72('0x3e')];_0x19594e[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0x5d9570['query'][_0x7d72('0x47')]);_0x19594e['where']=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0x5d9570['query'],_0x18ce24[_0x7d72('0x40')]));if(_0x5d9570['query']['filter']){_0x19594e[_0x7d72('0x48')]=_[_0x7d72('0x4a')](_0x19594e[_0x7d72('0x48')],{'$or':_[_0x7d72('0x31')](_0x19594e[_0x7d72('0x42')],function(_0x4e0b98){var _0xc100f5={};_0xc100f5[_0x4e0b98]={'$like':'%'+_0x5d9570[_0x7d72('0x3f')][_0x7d72('0x2f')]+'%'};return _0xc100f5;})});}_0x19594e=_[_0x7d72('0x4a')]({},_0x19594e,_0x5d9570[_0x7d72('0x51')]);return _0x5b3eb9['getMembers'](_0x19594e);}})['then'](function(_0x2977c1){if(_0x2977c1){_0x4bcd80=_0x2977c1[_0x7d72('0x44')];if(!_0x5d9570[_0x7d72('0x3f')][_0x7d72('0x45')]('nolimit')){_0x19594e[_0x7d72('0x24')]=qs[_0x7d72('0x24')](_0x5d9570['query']['limit']);_0x19594e[_0x7d72('0x22')]=qs['offset'](_0x5d9570['query'][_0x7d72('0x22')]);}return _0x5b3eb9['getMembers'](_0x19594e);}})[_0x7d72('0x2b')](function(_0x3b9425){return _0x3b9425?{'count':_0x4bcd80,'rows':_0x3b9425}:null;})['then'](respondWithResult(_0x1dfff1,null))[_0x7d72('0x5b')](handleError(_0x1dfff1,null));};exports[_0x7d72('0x9d')]=function(_0x26c6e1,_0x5085a4,_0x187d1a){var _0xc9fff4={};var _0x445bd4={};var _0x5e8301;var _0x3294b4;return db[_0x7d72('0x3a')][_0x7d72('0x63')]({'where':{'id':_0x26c6e1[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x5085a4,null))[_0x7d72('0x2b')](function(_0x106fb){if(_0x106fb){_0x5e8301=_0x106fb;_0x445bd4[_0x7d72('0x3e')]=_['keys'](db[_0x7d72('0x9e')]['rawAttributes']);_0x445bd4[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0x26c6e1['query']);_0x445bd4[_0x7d72('0x40')]=_[_0x7d72('0x41')](_0x445bd4['model'],_0x445bd4[_0x7d72('0x3f')]);_0xc9fff4[_0x7d72('0x42')]=_[_0x7d72('0x41')](_0x445bd4[_0x7d72('0x3e')],qs[_0x7d72('0x43')](_0x26c6e1[_0x7d72('0x3f')][_0x7d72('0x43')]));_0xc9fff4[_0x7d72('0x42')]=_0xc9fff4[_0x7d72('0x42')][_0x7d72('0x44')]?_0xc9fff4[_0x7d72('0x42')]:_0x445bd4[_0x7d72('0x3e')];_0xc9fff4[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0x26c6e1[_0x7d72('0x3f')][_0x7d72('0x47')]);_0xc9fff4[_0x7d72('0x48')]=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0x26c6e1['query'],_0x445bd4[_0x7d72('0x40')]));if(_0x26c6e1['query'][_0x7d72('0x2f')]){_0xc9fff4['where']=_['merge'](_0xc9fff4[_0x7d72('0x48')],{'$or':_[_0x7d72('0x31')](_0xc9fff4[_0x7d72('0x42')],function(_0x4cb2eb){var _0x26a747={};_0x26a747[_0x4cb2eb]={'$like':'%'+_0x26c6e1[_0x7d72('0x3f')]['filter']+'%'};return _0x26a747;})});}_0xc9fff4=_[_0x7d72('0x4a')]({},_0xc9fff4,_0x26c6e1[_0x7d72('0x51')]);return _0x5e8301[_0x7d72('0x9d')](_0xc9fff4);}})[_0x7d72('0x2b')](function(_0x58cbf3){if(_0x58cbf3){_0x3294b4=_0x58cbf3[_0x7d72('0x44')];if(!_0x26c6e1[_0x7d72('0x3f')][_0x7d72('0x45')](_0x7d72('0x46'))){_0xc9fff4['limit']=qs[_0x7d72('0x24')](_0x26c6e1[_0x7d72('0x3f')][_0x7d72('0x24')]);_0xc9fff4['offset']=qs['offset'](_0x26c6e1[_0x7d72('0x3f')][_0x7d72('0x22')]);}return _0x5e8301['getLists'](_0xc9fff4);}})[_0x7d72('0x2b')](function(_0x3e70dd){if(_0x3e70dd){return _0x3e70dd?{'count':_0x3294b4,'rows':_0x3e70dd}:null;}})[_0x7d72('0x2b')](respondWithResult(_0x5085a4,null))[_0x7d72('0x5b')](handleError(_0x5085a4,null));};exports['addLists']=function(_0x50cda8,_0x3e2976,_0x19c938){var _0x521f8d,_0xe7b8b2;return db['VoiceQueue']['find']({'where':{'id':_0x50cda8[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x3e2976,null))[_0x7d72('0x2b')](function(_0x3ef3aa){if(_0x3ef3aa){_0xe7b8b2=_0x3ef3aa;return _0x3ef3aa['addLists'](_0x50cda8[_0x7d72('0x54')]['ids'],_['omit'](_0x50cda8['body'],[_0x7d72('0x93'),'id'])||{});}return null;})['spread'](function(_0x3c286b){var _0x480068;_0x521f8d=_0x3c286b||[];var _0x48068a=[];if(_0x3c286b){for(var _0x828c46=0x0;_0x828c46<_0x3c286b['length'];_0x828c46+=0x1){var _0x114275=_0x3c286b[_0x828c46][_0x7d72('0x56')]({'plain':!![]});_0xe7b8b2[_0x7d72('0x9f')]=_0x50cda8[_0x7d72('0x54')][_0x7d72('0x9f')]?_0x50cda8['body'][_0x7d72('0x9f')]:_0xe7b8b2[_0x7d72('0x9f')];switch(_0xe7b8b2['dialCheckDuplicateType']){case'always':_0x480068=squel[_0x7d72('0xa0')]()[_0x7d72('0xa1')](_0x7d72('0xa2'))[_0x7d72('0xa3')](['phone','scheduledAt','ContactId',_0x7d72('0xa4'),_0x7d72('0x66'),'createdAt',_0x7d72('0x60')],squel[_0x7d72('0x81')]()[_0x7d72('0x82')](_0x7d72('0xa5'),'phone')[_0x7d72('0x82')](_0x7d72('0xa6'),_0x7d72('0xa7'))[_0x7d72('0x82')]('id','ContactId')[_0x7d72('0x82')](_0x114275[_0x7d72('0xa8')][_0x7d72('0x8c')](),_0x7d72('0xa4'))[_0x7d72('0x82')](_0x50cda8[_0x7d72('0x4f')]['id']['toString'](),_0x7d72('0x66'))[_0x7d72('0x82')](_0x7d72('0xa6'),_0x7d72('0x5f'))[_0x7d72('0x82')](_0x7d72('0xa6'),_0x7d72('0x60'))['from']('cm_contacts')[_0x7d72('0x48')](_0x7d72('0xa9'))[_0x7d72('0x48')](_0x7d72('0xaa'),_0x114275[_0x7d72('0xa8')]['toString']())['where'](_0x7d72('0xab'))[_0x7d72('0x48')](_0x7d72('0xac'),squel[_0x7d72('0x81')]()[_0x7d72('0x82')](_0x7d72('0xad'))[_0x7d72('0x84')]('cm_hopper_final')['where'](_0x7d72('0x89'),_0x50cda8[_0x7d72('0x4f')]['id'][_0x7d72('0x8c')]()))[_0x7d72('0x48')](_0x7d72('0xac'),squel[_0x7d72('0x81')]()[_0x7d72('0x82')](_0x7d72('0xae'))[_0x7d72('0x84')](_0x7d72('0xa2'))[_0x7d72('0x48')](_0x7d72('0x89'),_0x50cda8[_0x7d72('0x4f')]['id'][_0x7d72('0x8c')]())))[_0x7d72('0x8c')]();break;case'onlyIfOpen':_0x480068=squel[_0x7d72('0xa0')]()['into'](_0x7d72('0xa2'))[_0x7d72('0xa3')]([_0x7d72('0xa5'),_0x7d72('0xa7'),_0x7d72('0xaf'),_0x7d72('0xa4'),_0x7d72('0x66'),_0x7d72('0x5f'),_0x7d72('0x60')],squel[_0x7d72('0x81')]()[_0x7d72('0x82')](_0x7d72('0xa5'),_0x7d72('0xa5'))[_0x7d72('0x82')]('NOW()','scheduledAt')[_0x7d72('0x82')]('id',_0x7d72('0xaf'))[_0x7d72('0x82')](_0x114275[_0x7d72('0xa8')][_0x7d72('0x8c')](),'ListId')[_0x7d72('0x82')](_0x50cda8[_0x7d72('0x4f')]['id']['toString'](),'VoiceQueueId')['field'](_0x7d72('0xa6'),_0x7d72('0x5f'))[_0x7d72('0x82')](_0x7d72('0xa6'),'updatedAt')[_0x7d72('0x84')](_0x7d72('0xb0'))[_0x7d72('0x48')](_0x7d72('0xa9'))['where'](_0x7d72('0xaa'),_0x114275[_0x7d72('0xa8')][_0x7d72('0x8c')]())['where'](_0x7d72('0xab'))[_0x7d72('0x48')](_0x7d72('0xac'),squel[_0x7d72('0x81')]()[_0x7d72('0x82')](_0x7d72('0xae'))[_0x7d72('0x84')](_0x7d72('0xa2'))[_0x7d72('0x48')](_0x7d72('0x89'),_0x50cda8[_0x7d72('0x4f')]['id'][_0x7d72('0x8c')]())))['toString']();break;default:_0x480068=squel[_0x7d72('0xa0')]()[_0x7d72('0xa1')](_0x7d72('0xa2'))[_0x7d72('0xa3')]([_0x7d72('0xa5'),_0x7d72('0xa7'),_0x7d72('0xaf'),'ListId','VoiceQueueId',_0x7d72('0x5f'),_0x7d72('0x60')],squel[_0x7d72('0x81')]()[_0x7d72('0x82')]('phone','phone')[_0x7d72('0x82')]('NOW()',_0x7d72('0xa7'))[_0x7d72('0x82')]('id','ContactId')[_0x7d72('0x82')](_0x114275['CmListId']['toString'](),_0x7d72('0xa4'))[_0x7d72('0x82')](_0x50cda8[_0x7d72('0x4f')]['id'][_0x7d72('0x8c')](),_0x7d72('0x66'))[_0x7d72('0x82')](_0x7d72('0xa6'),_0x7d72('0x5f'))['field']('NOW()','updatedAt')[_0x7d72('0x84')](_0x7d72('0xb0'))[_0x7d72('0x48')]('deletedAt\x20IS\x20NULL')[_0x7d72('0x48')]('ListId\x20=\x20?',_0x114275[_0x7d72('0xa8')][_0x7d72('0x8c')]())[_0x7d72('0x48')](_0x7d72('0xab')))[_0x7d72('0x8c')]();}_0x48068a[_0x7d72('0x8a')](db[_0x7d72('0x8b')]['query'](_0x480068));}return BPromise[_0x7d72('0x90')](_0x48068a);}})[_0x7d72('0x2b')](function(){return _0x521f8d;})[_0x7d72('0x2b')](respondWithResult(_0x3e2976,null))[_0x7d72('0x5b')](handleError(_0x3e2976,null));};exports[_0x7d72('0xb1')]=function(_0x3a25f7,_0x5e08b9,_0xcad791){return db['VoiceQueue'][_0x7d72('0x52')]({'where':{'id':_0x3a25f7[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x5e08b9,null))['then'](function(_0x52b9d9){if(_0x52b9d9){return _0x52b9d9[_0x7d72('0xb1')](_0x3a25f7[_0x7d72('0x3f')][_0x7d72('0x93')]);}})[_0x7d72('0x2b')](function(_0xd2b12d){if(_0xd2b12d){return db[_0x7d72('0x64')][_0x7d72('0x2c')]({'where':{'ListId':_0x3a25f7['query'][_0x7d72('0x93')],'VoiceQueueId':_0x3a25f7[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](function(){return _0xd2b12d;});}})[_0x7d72('0x2b')](respondWithStatusCode(_0x5e08b9,null))[_0x7d72('0x5b')](handleError(_0x5e08b9,null));};exports[_0x7d72('0xb2')]=function(_0x415693,_0x2de216,_0x32a698){var _0x1560e2={};var _0x4168ee={};var _0x5f552e;var _0x5c494a;return db[_0x7d72('0x3a')][_0x7d72('0x63')]({'where':{'id':_0x415693[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x2de216,null))['then'](function(_0x276080){if(_0x276080){_0x5f552e=_0x276080;_0x4168ee['model']=_[_0x7d72('0x50')](db[_0x7d72('0x9e')][_0x7d72('0x3b')]);_0x4168ee[_0x7d72('0x3f')]=_[_0x7d72('0x50')](_0x415693[_0x7d72('0x3f')]);_0x4168ee['filters']=_['intersection'](_0x4168ee[_0x7d72('0x3e')],_0x4168ee[_0x7d72('0x3f')]);_0x1560e2[_0x7d72('0x42')]=_[_0x7d72('0x41')](_0x4168ee[_0x7d72('0x3e')],qs['fields'](_0x415693[_0x7d72('0x3f')][_0x7d72('0x43')]));_0x1560e2[_0x7d72('0x42')]=_0x1560e2[_0x7d72('0x42')][_0x7d72('0x44')]?_0x1560e2[_0x7d72('0x42')]:_0x4168ee[_0x7d72('0x3e')];_0x1560e2[_0x7d72('0x65')]=qs[_0x7d72('0x47')](_0x415693[_0x7d72('0x3f')][_0x7d72('0x47')]);_0x1560e2[_0x7d72('0x48')]=qs[_0x7d72('0x40')](_[_0x7d72('0x49')](_0x415693[_0x7d72('0x3f')],_0x4168ee['filters']));if(_0x415693[_0x7d72('0x3f')][_0x7d72('0x2f')]){_0x1560e2[_0x7d72('0x48')]=_[_0x7d72('0x4a')](_0x1560e2[_0x7d72('0x48')],{'$or':_[_0x7d72('0x31')](_0x1560e2['attributes'],function(_0x302cb0){var _0x1d5f1e={};_0x1d5f1e[_0x302cb0]={'$like':'%'+_0x415693[_0x7d72('0x3f')]['filter']+'%'};return _0x1d5f1e;})});}_0x1560e2=_['merge']({},_0x1560e2,_0x415693[_0x7d72('0x51')]);return _0x5f552e[_0x7d72('0xb2')](_0x1560e2);}})[_0x7d72('0x2b')](function(_0x4a0338){if(_0x4a0338){_0x5c494a=_0x4a0338['length'];if(!_0x415693['query'][_0x7d72('0x45')]('nolimit')){_0x1560e2['limit']=qs[_0x7d72('0x24')](_0x415693[_0x7d72('0x3f')][_0x7d72('0x24')]);_0x1560e2[_0x7d72('0x22')]=qs[_0x7d72('0x22')](_0x415693[_0x7d72('0x3f')][_0x7d72('0x22')]);}return _0x5f552e['getBlackLists'](_0x1560e2);}})[_0x7d72('0x2b')](function(_0x46aef4){if(_0x46aef4){return _0x46aef4?{'count':_0x5c494a,'rows':_0x46aef4}:null;}})[_0x7d72('0x2b')](respondWithResult(_0x2de216,null))[_0x7d72('0x5b')](handleError(_0x2de216,null));};exports['addBlackLists']=function(_0x4242ea,_0x52fcfb,_0x4455d0){var _0x126aad,_0x3eedab;return db[_0x7d72('0x3a')][_0x7d72('0x52')]({'where':{'id':_0x4242ea[_0x7d72('0x4f')]['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x52fcfb,null))['then'](function(_0x199d2a){if(_0x199d2a){_0x3eedab=_0x199d2a;return _0x199d2a[_0x7d72('0xb3')](_0x4242ea[_0x7d72('0x54')][_0x7d72('0x93')],_['omit'](_0x4242ea[_0x7d72('0x54')],[_0x7d72('0x93'),'id'])||{});}return null;})[_0x7d72('0x98')](function(_0x1fbe7f){var _0x41dafe;_0x126aad=_0x1fbe7f||[];var _0x24cd27=[];if(_0x1fbe7f){for(var _0x3467ce=0x0;_0x3467ce<_0x1fbe7f[_0x7d72('0x44')];_0x3467ce+=0x1){var _0x459937=_0x1fbe7f[_0x3467ce][_0x7d72('0x56')]({'plain':!![]});_0x41dafe=squel['insert']()[_0x7d72('0xa1')](_0x7d72('0xb4'))[_0x7d72('0xa3')]([_0x7d72('0xa5'),'ContactId',_0x7d72('0xa4'),_0x7d72('0x66'),'createdAt','updatedAt'],squel[_0x7d72('0x81')]()[_0x7d72('0x82')](_0x7d72('0xa5'),_0x7d72('0xa5'))[_0x7d72('0x82')]('id','ContactId')['field'](_0x459937[_0x7d72('0xa8')]['toString'](),_0x7d72('0xa4'))[_0x7d72('0x82')](_0x4242ea[_0x7d72('0x4f')]['id'][_0x7d72('0x8c')](),_0x7d72('0x66'))['field'](_0x7d72('0xa6'),_0x7d72('0x5f'))['field'](_0x7d72('0xa6'),_0x7d72('0x60'))[_0x7d72('0x84')]('cm_contacts')['where'](_0x7d72('0xa9'))['where'](_0x7d72('0xaa'),_0x459937[_0x7d72('0xa8')][_0x7d72('0x8c')]())[_0x7d72('0x48')](_0x7d72('0xab')))[_0x7d72('0x8c')]();_0x24cd27[_0x7d72('0x8a')](db[_0x7d72('0x8b')][_0x7d72('0x3f')](_0x41dafe));}return BPromise['all'](_0x24cd27);}})[_0x7d72('0x2b')](function(){return _0x126aad;})[_0x7d72('0x2b')](respondWithResult(_0x52fcfb,null))[_0x7d72('0x5b')](handleError(_0x52fcfb,null));};exports[_0x7d72('0xb5')]=function(_0x1d7762,_0x229f80,_0x163ffc){return db[_0x7d72('0x3a')][_0x7d72('0x52')]({'where':{'id':_0x1d7762['params']['id']}})[_0x7d72('0x2b')](handleEntityNotFound(_0x229f80,null))[_0x7d72('0x2b')](function(_0x16a2b0){if(_0x16a2b0){return _0x16a2b0[_0x7d72('0xb5')](_0x1d7762[_0x7d72('0x3f')][_0x7d72('0x93')]);}})[_0x7d72('0x2b')](function(_0x4e93c0){if(_0x4e93c0){return db[_0x7d72('0x6d')][_0x7d72('0x2c')]({'where':{'ListId':_0x1d7762[_0x7d72('0x3f')][_0x7d72('0x93')],'VoiceQueueId':_0x1d7762[_0x7d72('0x4f')]['id']}})['then'](function(){return _0x4e93c0;});}})[_0x7d72('0x2b')](respondWithStatusCode(_0x229f80,null))['catch'](handleError(_0x229f80,null));}; \ No newline at end of file +var _0x3f6a=['omit','dialCheckDuplicateType','into','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','insert','removeLists','getBlackLists','addBlackLists','cm_hopper_black','cm_contacts','removeBlackLists','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./voiceQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','name','end','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','createdAt','userProfileId','UserProfileResource','findOne','CmHopper','nolimit','order','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','UserVoiceQueue','each','UserVoiceQueueRt','upsert','format','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.UserId\x20=\x20?','push','SELECT','all','union','compact','isEmpty','removeAgents','emit','addAgents','spread','isNil','SIP/%s','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList'];(function(_0x4270af,_0x179677){var _0x1b04ae=function(_0x1105d6){while(--_0x1105d6){_0x4270af['push'](_0x4270af['shift']());}};_0x1b04ae(++_0x179677);}(_0x3f6a,0x18a));var _0xa3f6=function(_0x8a74ea,_0x57cb19){_0x8a74ea=_0x8a74ea-0x0;var _0x29ae8e=_0x3f6a[_0x8a74ea];return _0x29ae8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3f6('0x0'));var zipdir=require(_0xa3f6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3f6('0x2'));var BPromise=require(_0xa3f6('0x3'));var Mustache=require(_0xa3f6('0x4'));var util=require('util');var path=require(_0xa3f6('0x5'));var sox=require(_0xa3f6('0x6'));var csv=require(_0xa3f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3f6('0x8'));var _=require(_0xa3f6('0x9'));var squel=require(_0xa3f6('0xa'));var crypto=require(_0xa3f6('0xb'));var jsforce=require(_0xa3f6('0xc'));var deskjs=require(_0xa3f6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa3f6('0xe'));var Papa=require(_0xa3f6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa3f6('0x10'));var as=require(_0xa3f6('0x11'));var hardwareService=require(_0xa3f6('0x12'));var logger=require(_0xa3f6('0x13'))(_0xa3f6('0x14'));var utils=require('../../config/utils');var config=require(_0xa3f6('0x15'));var licenseUtil=require(_0xa3f6('0x16'));var db=require(_0xa3f6('0x17'))['db'];config['redis']=_[_0xa3f6('0x18')](config[_0xa3f6('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3f6('0x19')]));require(_0xa3f6('0x1a'))[_0xa3f6('0x1b')](socket);function respondWithStatusCode(_0x9654c5,_0x54ad5e){_0x54ad5e=_0x54ad5e||0xcc;return function(_0x4ac7a9){if(_0x4ac7a9){return _0x9654c5[_0xa3f6('0x1c')](_0x54ad5e);}return _0x9654c5[_0xa3f6('0x1d')](_0x54ad5e)['end']();};}function respondWithResult(_0x49c5ee,_0x5d47cc){_0x5d47cc=_0x5d47cc||0xc8;return function(_0x496548){if(_0x496548){return _0x49c5ee[_0xa3f6('0x1d')](_0x5d47cc)[_0xa3f6('0x1e')](_0x496548);}};}function respondWithFilteredResult(_0x4a999b,_0x5b1b56){return function(_0x49ad1b){if(_0x49ad1b){var _0x13f019=typeof _0x5b1b56['offset']===_0xa3f6('0x1f')&&typeof _0x5b1b56[_0xa3f6('0x20')]===_0xa3f6('0x1f');var _0x259e60=_0x49ad1b[_0xa3f6('0x21')];var _0x36bde7=_0x13f019?0x0:_0x5b1b56[_0xa3f6('0x22')];var _0x399569=_0x13f019?_0x49ad1b[_0xa3f6('0x21')]:_0x5b1b56[_0xa3f6('0x22')]+_0x5b1b56['limit'];var _0x46fe56;if(_0x399569>=_0x259e60){_0x399569=_0x259e60;_0x46fe56=0xc8;}else{_0x46fe56=0xce;}_0x4a999b[_0xa3f6('0x1d')](_0x46fe56);return _0x4a999b[_0xa3f6('0x23')]('Content-Range',_0x36bde7+'-'+_0x399569+'/'+_0x259e60)['json'](_0x49ad1b);}return null;};}function patchUpdates(_0x1370e3){return function(_0x2775e3){try{jsonpatch['apply'](_0x2775e3,_0x1370e3,!![]);}catch(_0xa5c36c){return BPromise[_0xa3f6('0x24')](_0xa5c36c);}return _0x2775e3[_0xa3f6('0x25')]();};}function saveUpdates(_0x474ea3,_0x2cfab0){return function(_0x509e17){if(_0x509e17){return _0x509e17[_0xa3f6('0x26')](_0x474ea3)[_0xa3f6('0x27')](function(_0x23db39){return _0x23db39;});}return null;};}function removeEntity(_0x704b3,_0x4ecc25){return function(_0x4b50ab){if(_0x4b50ab){return _0x4b50ab[_0xa3f6('0x28')]()[_0xa3f6('0x27')](function(){var _0x543e10=_0x4b50ab[_0xa3f6('0x29')]({'plain':!![]});var _0x5e73aa=[{'name':'VoiceQueues','value':_0xa3f6('0x2a'),'ignore':![]},{'name':_0xa3f6('0x2b'),'value':_0xa3f6('0x2c'),'ignore':![]}];var _0x37b3fe=_(_0x5e73aa)['filter'](_0xa3f6('0x2d'))[_0xa3f6('0x2e')](_0xa3f6('0x2f'))[_0xa3f6('0x2f')]();if(_[_0xa3f6('0x30')](_0x37b3fe,_0x543e10['type'])){return;}var _0xa58a87=_['find'](_0x5e73aa,[_0xa3f6('0x2f'),_0x543e10[_0xa3f6('0x31')]])[_0xa3f6('0x32')];return db['UserProfileResource'][_0xa3f6('0x28')]({'where':{'type':_0xa58a87,'resourceId':_0x543e10['id']}})['then'](function(){return _0x4b50ab;});})[_0xa3f6('0x27')](function(){_0x704b3[_0xa3f6('0x1d')](0xcc)[_0xa3f6('0x33')]();});}};}function handleEntityNotFound(_0x3b8387,_0xff408e){return function(_0x444089){if(!_0x444089){_0x3b8387[_0xa3f6('0x1c')](0x194);}return _0x444089;};}function handleError(_0xec7826,_0x58a722){_0x58a722=_0x58a722||0x1f4;return function(_0x5bba36){logger[_0xa3f6('0x34')](_0x5bba36[_0xa3f6('0x35')]);if(_0x5bba36[_0xa3f6('0x32')]){delete _0x5bba36[_0xa3f6('0x32')];}_0xec7826[_0xa3f6('0x1d')](_0x58a722)[_0xa3f6('0x36')](_0x5bba36);};}exports[_0xa3f6('0x37')]=function(_0x203d37,_0x1e8b39){var _0x44771d={},_0x5651d6={},_0x48af48={'count':0x0,'rows':[]};var _0x1be152=_[_0xa3f6('0x2e')](db[_0xa3f6('0x38')][_0xa3f6('0x39')],function(_0x3c3220){return{'name':_0x3c3220[_0xa3f6('0x3a')],'type':_0x3c3220[_0xa3f6('0x31')][_0xa3f6('0x3b')]};});_0x5651d6[_0xa3f6('0x3c')]=_[_0xa3f6('0x2e')](_0x1be152,_0xa3f6('0x32'));_0x5651d6['query']=_[_0xa3f6('0x3d')](_0x203d37[_0xa3f6('0x3e')]);_0x5651d6[_0xa3f6('0x3f')]=_[_0xa3f6('0x40')](_0x5651d6[_0xa3f6('0x3c')],_0x5651d6[_0xa3f6('0x3e')]);_0x44771d[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0x5651d6[_0xa3f6('0x3c')],qs['fields'](_0x203d37[_0xa3f6('0x3e')][_0xa3f6('0x42')]));_0x44771d[_0xa3f6('0x41')]=_0x44771d[_0xa3f6('0x41')][_0xa3f6('0x43')]?_0x44771d['attributes']:_0x5651d6[_0xa3f6('0x3c')];if(!_0x203d37['query'][_0xa3f6('0x44')]('nolimit')){_0x44771d[_0xa3f6('0x20')]=qs[_0xa3f6('0x20')](_0x203d37[_0xa3f6('0x3e')][_0xa3f6('0x20')]);_0x44771d[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0x203d37[_0xa3f6('0x3e')]['offset']);}_0x44771d['order']=qs[_0xa3f6('0x45')](_0x203d37[_0xa3f6('0x3e')]['sort']);_0x44771d[_0xa3f6('0x46')]=qs[_0xa3f6('0x3f')](_[_0xa3f6('0x47')](_0x203d37[_0xa3f6('0x3e')],_0x5651d6['filters']),_0x1be152);if(_0x203d37['query']['filter']){_0x44771d[_0xa3f6('0x46')]=_[_0xa3f6('0x48')](_0x44771d[_0xa3f6('0x46')],{'$or':_[_0xa3f6('0x2e')](_0x1be152,function(_0x31d41f){if(_0x31d41f[_0xa3f6('0x31')]!=='VIRTUAL'){var _0x259e62={};_0x259e62[_0x31d41f[_0xa3f6('0x32')]]={'$like':'%'+_0x203d37['query'][_0xa3f6('0x49')]+'%'};return _0x259e62;}})});}_0x44771d=_[_0xa3f6('0x48')]({},_0x44771d,_0x203d37[_0xa3f6('0x4a')]);var _0x60e1f6={'where':_0x44771d[_0xa3f6('0x46')]};return db['VoiceQueue'][_0xa3f6('0x21')](_0x60e1f6)[_0xa3f6('0x27')](function(_0x594631){_0x48af48[_0xa3f6('0x21')]=_0x594631;if(_0x203d37[_0xa3f6('0x3e')][_0xa3f6('0x4b')]){_0x44771d[_0xa3f6('0x4c')]=[{'all':!![]}];}return db[_0xa3f6('0x38')][_0xa3f6('0x4d')](_0x44771d);})[_0xa3f6('0x27')](function(_0x2904e7){_0x48af48[_0xa3f6('0x4e')]=_0x2904e7;return _0x48af48;})[_0xa3f6('0x27')](respondWithFilteredResult(_0x1e8b39,_0x44771d))[_0xa3f6('0x4f')](handleError(_0x1e8b39,null));};exports[_0xa3f6('0x50')]=function(_0x4ab417,_0x9491b1){var _0x370ef5={'raw':![],'where':{'id':_0x4ab417[_0xa3f6('0x51')]['id']}},_0x26997a={};_0x26997a[_0xa3f6('0x3c')]=_[_0xa3f6('0x3d')](db[_0xa3f6('0x38')][_0xa3f6('0x39')]);_0x26997a[_0xa3f6('0x3e')]=_[_0xa3f6('0x3d')](_0x4ab417[_0xa3f6('0x3e')]);_0x26997a['filters']=_['intersection'](_0x26997a[_0xa3f6('0x3c')],_0x26997a['query']);_0x370ef5[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0x26997a[_0xa3f6('0x3c')],qs[_0xa3f6('0x42')](_0x4ab417['query'][_0xa3f6('0x42')]));_0x370ef5[_0xa3f6('0x41')]=_0x370ef5[_0xa3f6('0x41')]['length']?_0x370ef5[_0xa3f6('0x41')]:_0x26997a['model'];if(_0x4ab417[_0xa3f6('0x3e')][_0xa3f6('0x4b')]){_0x370ef5[_0xa3f6('0x4c')]=[{'all':!![]}];}_0x370ef5=_[_0xa3f6('0x48')]({},_0x370ef5,_0x4ab417[_0xa3f6('0x4a')]);return db['VoiceQueue'][_0xa3f6('0x52')](_0x370ef5)[_0xa3f6('0x27')](handleEntityNotFound(_0x9491b1,null))[_0xa3f6('0x27')](respondWithResult(_0x9491b1,null))[_0xa3f6('0x4f')](handleError(_0x9491b1,null));};exports[_0xa3f6('0x53')]=function(_0x5aa07e,_0x1a2cd9){return db[_0xa3f6('0x38')][_0xa3f6('0x53')](_0x5aa07e[_0xa3f6('0x54')],{})[_0xa3f6('0x27')](function(_0x449dd9){var _0x49093d=_0x5aa07e[_0xa3f6('0x55')][_0xa3f6('0x29')]({'plain':!![]});if(!_0x49093d)throw new Error(_0xa3f6('0x56'));if(_0x49093d[_0xa3f6('0x57')]==='user'){var _0x19f3e8=_0x449dd9[_0xa3f6('0x29')]({'plain':!![]});var _0x4d103c=[{'name':_0xa3f6('0x58'),'value':_0xa3f6('0x2a')},{'name':'QueueCampaigns','value':_0xa3f6('0x2c')}];var _0x412503=_[_0xa3f6('0x52')](_0x4d103c,[_0xa3f6('0x2f'),_0x19f3e8[_0xa3f6('0x31')]])[_0xa3f6('0x32')];return db[_0xa3f6('0x59')][_0xa3f6('0x52')]({'where':{'name':_0x412503,'userProfileId':_0x49093d['userProfileId']},'raw':!![]})['then'](function(_0x26e4b4){if(_0x26e4b4&&_0x26e4b4[_0xa3f6('0x5a')]===0x0){return db['UserProfileResource'][_0xa3f6('0x53')]({'name':_0x19f3e8['name'],'resourceId':_0x19f3e8['id'],'type':_0x26e4b4[_0xa3f6('0x32')],'sectionId':_0x26e4b4['id']},{})[_0xa3f6('0x27')](function(){return _0x449dd9;});}else{return _0x449dd9;}})[_0xa3f6('0x4f')](function(_0x37101f){logger[_0xa3f6('0x34')](_0xa3f6('0x5b'),_0x37101f);throw _0x37101f;});}return _0x449dd9;})[_0xa3f6('0x27')](respondWithResult(_0x1a2cd9,0xc9))[_0xa3f6('0x4f')](handleError(_0x1a2cd9,null));};exports[_0xa3f6('0x5c')]=function(_0x41b663,_0x129ac1){var _0x3d5124={'where':{'id':_0x41b663['params']['id']}},_0x727923={};_0x727923[_0xa3f6('0x3c')]=_[_0xa3f6('0x3d')](db['VoiceQueue'][_0xa3f6('0x39')]);_0x3d5124['attributes']=_[_0xa3f6('0x40')](_0x727923[_0xa3f6('0x3c')],qs['fields'](_0x41b663['query']['fields']));_0x3d5124[_0xa3f6('0x41')]=_0x3d5124[_0xa3f6('0x41')][_0xa3f6('0x43')]?_0x3d5124[_0xa3f6('0x41')]:_0x727923['model'];if(_0x41b663[_0xa3f6('0x3e')]['includeAll']){_0x3d5124['include']=[{'all':!![]}];}_0x3d5124=_[_0xa3f6('0x48')]({},_0x3d5124,_0x41b663[_0xa3f6('0x4a')]);return db['VoiceQueue']['find'](_0x3d5124)[_0xa3f6('0x27')](handleEntityNotFound(_0x129ac1,null))[_0xa3f6('0x27')](function(_0x415310){if(_0x415310){var _0xe7c48e=_0x415310[_0xa3f6('0x29')]({'plain':!![]});_0xe7c48e=qs['omit'](_0xe7c48e,['id','createdAt',_0xa3f6('0x5d')]);_0x41b663['body']=_['omit'](_0x41b663['body'],['id',_0xa3f6('0x5e'),_0xa3f6('0x5d')]);return db[_0xa3f6('0x38')][_0xa3f6('0x53')](_[_0xa3f6('0x48')](_0xe7c48e,_0x41b663[_0xa3f6('0x54')]),{'include':_0x41b663[_0xa3f6('0x3e')][_0xa3f6('0x4b')]?[{'all':!![]}]:undefined})[_0xa3f6('0x27')](function(_0x4a71ed){var _0x181c5b=_0x41b663[_0xa3f6('0x55')][_0xa3f6('0x29')]({'plain':!![]});if(!_0x181c5b)throw new Error(_0xa3f6('0x56'));if(_0x181c5b[_0xa3f6('0x57')]==='user'){var _0x3502b4=_0x4a71ed['get']({'plain':!![]});var _0x276a96=[{'name':_0xa3f6('0x58'),'value':'inbound'},{'name':_0xa3f6('0x2b'),'value':_0xa3f6('0x2c')}];var _0x462083=_[_0xa3f6('0x52')](_0x276a96,[_0xa3f6('0x2f'),_0x3502b4[_0xa3f6('0x31')]])[_0xa3f6('0x32')];return db[_0xa3f6('0x59')][_0xa3f6('0x52')]({'where':{'name':_0x462083,'userProfileId':_0x181c5b[_0xa3f6('0x5f')]},'raw':!![]})[_0xa3f6('0x27')](function(_0x4bf0b5){if(_0x4bf0b5&&_0x4bf0b5[_0xa3f6('0x5a')]===0x0){return db[_0xa3f6('0x60')][_0xa3f6('0x53')]({'name':_0x3502b4[_0xa3f6('0x32')],'resourceId':_0x3502b4['id'],'type':_0x4bf0b5['name'],'sectionId':_0x4bf0b5['id']},{})[_0xa3f6('0x27')](function(){return _0x4a71ed;});}else{return _0x4a71ed;}})[_0xa3f6('0x4f')](function(_0x18a586){logger[_0xa3f6('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18a586);throw _0x18a586;});}return _0x4a71ed;});}})[_0xa3f6('0x27')](respondWithResult(_0x129ac1,0xc9))[_0xa3f6('0x4f')](handleError(_0x129ac1,null));};exports['update']=function(_0x389ee7,_0x276b7d){if(_0x389ee7['body']['id']){delete _0x389ee7['body']['id'];}return db[_0xa3f6('0x38')][_0xa3f6('0x52')]({'where':{'id':_0x389ee7[_0xa3f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x276b7d,null))[_0xa3f6('0x27')](saveUpdates(_0x389ee7['body'],null))[_0xa3f6('0x27')](respondWithResult(_0x276b7d,null))[_0xa3f6('0x4f')](handleError(_0x276b7d,null));};exports[_0xa3f6('0x28')]=function(_0x5d5079,_0x4db7b2){return db[_0xa3f6('0x38')]['find']({'where':{'id':_0x5d5079[_0xa3f6('0x51')]['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0x4db7b2,null))[_0xa3f6('0x27')](removeEntity(_0x4db7b2,null))['catch'](handleError(_0x4db7b2,null));};exports['getHoppers']=function(_0x4b1838,_0x4ef14f,_0x5c98f8){var _0x1e4fd0={'raw':![],'where':{}};var _0x1a7c7d={};var _0x36bb81={'count':0x0,'rows':[]};return db[_0xa3f6('0x38')][_0xa3f6('0x61')]({'where':{'id':_0x4b1838['params']['id']}})['then'](handleEntityNotFound(_0x4ef14f,null))['then'](function(_0x1061b1){if(_0x1061b1){_0x1a7c7d[_0xa3f6('0x3c')]=_['keys'](db[_0xa3f6('0x62')][_0xa3f6('0x39')]);_0x1a7c7d[_0xa3f6('0x3e')]=_['keys'](_0x4b1838['query']);_0x1a7c7d['filters']=_[_0xa3f6('0x40')](_0x1a7c7d[_0xa3f6('0x3c')],_0x1a7c7d[_0xa3f6('0x3e')]);_0x1e4fd0[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0x1a7c7d[_0xa3f6('0x3c')],qs[_0xa3f6('0x42')](_0x4b1838[_0xa3f6('0x3e')]['fields']));_0x1e4fd0[_0xa3f6('0x41')]=_0x1e4fd0['attributes'][_0xa3f6('0x43')]?_0x1e4fd0['attributes']:_0x1a7c7d[_0xa3f6('0x3c')];if(!_0x4b1838['query'][_0xa3f6('0x44')](_0xa3f6('0x63'))){_0x1e4fd0[_0xa3f6('0x20')]=qs[_0xa3f6('0x20')](_0x4b1838['query'][_0xa3f6('0x20')]);_0x1e4fd0[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0x4b1838[_0xa3f6('0x3e')]['offset']);}_0x1e4fd0[_0xa3f6('0x64')]=qs[_0xa3f6('0x45')](_0x4b1838[_0xa3f6('0x3e')][_0xa3f6('0x45')]);_0x1e4fd0[_0xa3f6('0x46')]=qs['filters'](_['pick'](_0x4b1838[_0xa3f6('0x3e')],_0x1a7c7d['filters']));_0x1e4fd0[_0xa3f6('0x46')]['VoiceQueueId']=_0x1061b1['id'];if(_0x4b1838['query'][_0xa3f6('0x49')]){_0x1e4fd0[_0xa3f6('0x46')]=_['merge'](_0x1e4fd0[_0xa3f6('0x46')],{'$or':_[_0xa3f6('0x2e')](_0x1e4fd0['attributes'],function(_0x202b33){var _0x2dc898={};_0x2dc898[_0x202b33]={'$like':'%'+_0x4b1838['query'][_0xa3f6('0x49')]+'%'};return _0x2dc898;})});}_0x1e4fd0=_[_0xa3f6('0x48')]({},_0x1e4fd0,_0x4b1838[_0xa3f6('0x4a')]);return db['CmHopper'][_0xa3f6('0x21')]({'where':_0x1e4fd0[_0xa3f6('0x46')]})[_0xa3f6('0x27')](function(_0x5e3805){_0x36bb81[_0xa3f6('0x21')]=_0x5e3805;if(_0x4b1838['query'][_0xa3f6('0x4b')]){_0x1e4fd0[_0xa3f6('0x4c')]=[{'all':!![]}];}return db[_0xa3f6('0x62')][_0xa3f6('0x4d')](_0x1e4fd0);})[_0xa3f6('0x27')](function(_0x59a8f1){_0x36bb81[_0xa3f6('0x4e')]=_0x59a8f1;return _0x36bb81;});}})['then'](respondWithFilteredResult(_0x4ef14f,_0x1e4fd0))[_0xa3f6('0x4f')](handleError(_0x4ef14f,null));};exports[_0xa3f6('0x65')]=function(_0xfb00b0,_0x49a060,_0x413153){var _0x598f72={'raw':!![],'where':{}};var _0x52da52={};var _0x4eaee4={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfb00b0[_0xa3f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x49a060,null))[_0xa3f6('0x27')](function(_0x1dcb1f){if(_0x1dcb1f){_0x52da52[_0xa3f6('0x3c')]=_[_0xa3f6('0x3d')](db[_0xa3f6('0x66')][_0xa3f6('0x39')]);_0x52da52[_0xa3f6('0x3e')]=_['keys'](_0xfb00b0[_0xa3f6('0x3e')]);_0x52da52[_0xa3f6('0x3f')]=_[_0xa3f6('0x40')](_0x52da52[_0xa3f6('0x3c')],_0x52da52[_0xa3f6('0x3e')]);_0x598f72[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0x52da52[_0xa3f6('0x3c')],qs['fields'](_0xfb00b0[_0xa3f6('0x3e')][_0xa3f6('0x42')]));_0x598f72[_0xa3f6('0x41')]=_0x598f72['attributes'][_0xa3f6('0x43')]?_0x598f72[_0xa3f6('0x41')]:_0x52da52[_0xa3f6('0x3c')];if(!_0xfb00b0[_0xa3f6('0x3e')]['hasOwnProperty'](_0xa3f6('0x63'))){_0x598f72[_0xa3f6('0x20')]=qs['limit'](_0xfb00b0[_0xa3f6('0x3e')][_0xa3f6('0x20')]);_0x598f72[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0xfb00b0[_0xa3f6('0x3e')][_0xa3f6('0x22')]);}_0x598f72[_0xa3f6('0x64')]=qs[_0xa3f6('0x45')](_0xfb00b0[_0xa3f6('0x3e')]['sort']);_0x598f72[_0xa3f6('0x46')]=qs['filters'](_[_0xa3f6('0x47')](_0xfb00b0[_0xa3f6('0x3e')],_0x52da52[_0xa3f6('0x3f')]));_0x598f72['where'][_0xa3f6('0x67')]=_0x1dcb1f['id'];if(_0xfb00b0[_0xa3f6('0x3e')][_0xa3f6('0x49')]){_0x598f72['where']=_[_0xa3f6('0x48')](_0x598f72['where'],{'$or':_[_0xa3f6('0x2e')](_0x598f72[_0xa3f6('0x41')],function(_0x5a29c5){var _0x6a7dee={};_0x6a7dee[_0x5a29c5]={'$like':'%'+_0xfb00b0['query']['filter']+'%'};return _0x6a7dee;})});}_0x598f72=_[_0xa3f6('0x48')]({},_0x598f72,_0xfb00b0[_0xa3f6('0x4a')]);return db[_0xa3f6('0x66')][_0xa3f6('0x21')]({'where':_0x598f72['where']})[_0xa3f6('0x27')](function(_0x56367b){_0x4eaee4[_0xa3f6('0x21')]=_0x56367b;if(_0xfb00b0[_0xa3f6('0x3e')][_0xa3f6('0x4b')]){_0x598f72['include']=[{'all':!![]}];}return db[_0xa3f6('0x66')][_0xa3f6('0x4d')](_0x598f72);})[_0xa3f6('0x27')](function(_0x138430){_0x4eaee4['rows']=_0x138430;return _0x4eaee4;});}})[_0xa3f6('0x27')](respondWithFilteredResult(_0x49a060,_0x598f72))[_0xa3f6('0x4f')](handleError(_0x49a060,null));};exports[_0xa3f6('0x68')]=function(_0x21e0a5,_0xd36710,_0x57f458){var _0x29d8bf={'raw':!![],'where':{}};var _0x413274={};var _0x429cc3={'count':0x0,'rows':[]};return db[_0xa3f6('0x38')][_0xa3f6('0x61')]({'where':{'id':_0x21e0a5[_0xa3f6('0x51')]['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0xd36710,null))[_0xa3f6('0x27')](function(_0x2f977b){if(_0x2f977b){_0x413274[_0xa3f6('0x3c')]=_[_0xa3f6('0x3d')](db[_0xa3f6('0x69')][_0xa3f6('0x39')]);_0x413274[_0xa3f6('0x3e')]=_[_0xa3f6('0x3d')](_0x21e0a5[_0xa3f6('0x3e')]);_0x413274[_0xa3f6('0x3f')]=_[_0xa3f6('0x40')](_0x413274[_0xa3f6('0x3c')],_0x413274[_0xa3f6('0x3e')]);_0x29d8bf[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0x413274['model'],qs[_0xa3f6('0x42')](_0x21e0a5[_0xa3f6('0x3e')][_0xa3f6('0x42')]));_0x29d8bf['attributes']=_0x29d8bf[_0xa3f6('0x41')][_0xa3f6('0x43')]?_0x29d8bf['attributes']:_0x413274[_0xa3f6('0x3c')];if(!_0x21e0a5[_0xa3f6('0x3e')]['hasOwnProperty'](_0xa3f6('0x63'))){_0x29d8bf['limit']=qs[_0xa3f6('0x20')](_0x21e0a5['query'][_0xa3f6('0x20')]);_0x29d8bf[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0x21e0a5['query']['offset']);}_0x29d8bf['order']=qs[_0xa3f6('0x45')](_0x21e0a5[_0xa3f6('0x3e')]['sort']);_0x29d8bf[_0xa3f6('0x46')]=qs[_0xa3f6('0x3f')](_[_0xa3f6('0x47')](_0x21e0a5['query'],_0x413274[_0xa3f6('0x3f')]));_0x29d8bf[_0xa3f6('0x46')][_0xa3f6('0x67')]=_0x2f977b['id'];if(_0x21e0a5['query'][_0xa3f6('0x49')]){_0x29d8bf[_0xa3f6('0x46')]=_[_0xa3f6('0x48')](_0x29d8bf[_0xa3f6('0x46')],{'$or':_[_0xa3f6('0x2e')](_0x29d8bf['attributes'],function(_0x2f3cbc){var _0xba845={};_0xba845[_0x2f3cbc]={'$like':'%'+_0x21e0a5['query'][_0xa3f6('0x49')]+'%'};return _0xba845;})});}_0x29d8bf=_['merge']({},_0x29d8bf,_0x21e0a5['options']);return db[_0xa3f6('0x69')]['count']({'where':_0x29d8bf[_0xa3f6('0x46')]})[_0xa3f6('0x27')](function(_0x5d177a){_0x429cc3['count']=_0x5d177a;if(_0x21e0a5[_0xa3f6('0x3e')][_0xa3f6('0x4b')]){_0x29d8bf['include']=[{'all':!![]}];}return db[_0xa3f6('0x69')][_0xa3f6('0x4d')](_0x29d8bf);})[_0xa3f6('0x27')](function(_0x28a49d){_0x429cc3[_0xa3f6('0x4e')]=_0x28a49d;return _0x429cc3;});}})['then'](respondWithFilteredResult(_0xd36710,_0x29d8bf))[_0xa3f6('0x4f')](handleError(_0xd36710,null));};exports[_0xa3f6('0x6a')]=function(_0xe1c41a,_0x389765,_0xe8ceee){var _0x8e6726={'raw':!![],'where':{}};var _0x1b4257={};var _0x401a6e={'count':0x0,'rows':[]};return db[_0xa3f6('0x38')]['findOne']({'where':{'id':_0xe1c41a[_0xa3f6('0x51')]['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0x389765,null))[_0xa3f6('0x27')](function(_0x151873){if(_0x151873){_0x1b4257[_0xa3f6('0x3c')]=_[_0xa3f6('0x3d')](db[_0xa3f6('0x6b')][_0xa3f6('0x39')]);_0x1b4257[_0xa3f6('0x3e')]=_[_0xa3f6('0x3d')](_0xe1c41a['query']);_0x1b4257[_0xa3f6('0x3f')]=_[_0xa3f6('0x40')](_0x1b4257[_0xa3f6('0x3c')],_0x1b4257['query']);_0x8e6726[_0xa3f6('0x41')]=_['intersection'](_0x1b4257[_0xa3f6('0x3c')],qs[_0xa3f6('0x42')](_0xe1c41a['query'][_0xa3f6('0x42')]));_0x8e6726['attributes']=_0x8e6726[_0xa3f6('0x41')][_0xa3f6('0x43')]?_0x8e6726[_0xa3f6('0x41')]:_0x1b4257[_0xa3f6('0x3c')];if(!_0xe1c41a[_0xa3f6('0x3e')][_0xa3f6('0x44')](_0xa3f6('0x63'))){_0x8e6726[_0xa3f6('0x20')]=qs[_0xa3f6('0x20')](_0xe1c41a[_0xa3f6('0x3e')][_0xa3f6('0x20')]);_0x8e6726[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0xe1c41a[_0xa3f6('0x3e')][_0xa3f6('0x22')]);}_0x8e6726[_0xa3f6('0x64')]=qs[_0xa3f6('0x45')](_0xe1c41a[_0xa3f6('0x3e')]['sort']);_0x8e6726[_0xa3f6('0x46')]=qs[_0xa3f6('0x3f')](_[_0xa3f6('0x47')](_0xe1c41a['query'],_0x1b4257[_0xa3f6('0x3f')]));_0x8e6726[_0xa3f6('0x46')][_0xa3f6('0x67')]=_0x151873['id'];if(_0xe1c41a[_0xa3f6('0x3e')][_0xa3f6('0x49')]){_0x8e6726[_0xa3f6('0x46')]=_['merge'](_0x8e6726[_0xa3f6('0x46')],{'$or':_[_0xa3f6('0x2e')](_0x8e6726[_0xa3f6('0x41')],function(_0x2a3635){var _0x119830={};_0x119830[_0x2a3635]={'$like':'%'+_0xe1c41a[_0xa3f6('0x3e')][_0xa3f6('0x49')]+'%'};return _0x119830;})});}_0x8e6726=_[_0xa3f6('0x48')]({},_0x8e6726,_0xe1c41a['options']);return db[_0xa3f6('0x6b')][_0xa3f6('0x21')]({'where':_0x8e6726[_0xa3f6('0x46')]})[_0xa3f6('0x27')](function(_0x3419f2){_0x401a6e[_0xa3f6('0x21')]=_0x3419f2;if(_0xe1c41a[_0xa3f6('0x3e')][_0xa3f6('0x4b')]){_0x8e6726[_0xa3f6('0x4c')]=[{'all':!![]}];}return db[_0xa3f6('0x6b')][_0xa3f6('0x4d')](_0x8e6726);})[_0xa3f6('0x27')](function(_0x7ac377){_0x401a6e[_0xa3f6('0x4e')]=_0x7ac377;return _0x401a6e;});}})[_0xa3f6('0x27')](respondWithFilteredResult(_0x389765,_0x8e6726))[_0xa3f6('0x4f')](handleError(_0x389765,null));};exports['getTeams']=function(_0x5f2663,_0x43a6e0,_0x33ebad){var _0x5ef7db={};var _0xddfa12={};var _0x2ca246;var _0x133e9b;return db[_0xa3f6('0x38')][_0xa3f6('0x61')]({'where':{'id':_0x5f2663['params']['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0x43a6e0,null))['then'](function(_0x171c62){if(_0x171c62){_0x2ca246=_0x171c62;_0xddfa12[_0xa3f6('0x3c')]=_['keys'](db[_0xa3f6('0x6c')]['rawAttributes']);_0xddfa12['query']=_[_0xa3f6('0x3d')](_0x5f2663[_0xa3f6('0x3e')]);_0xddfa12[_0xa3f6('0x3f')]=_[_0xa3f6('0x40')](_0xddfa12[_0xa3f6('0x3c')],_0xddfa12['query']);_0x5ef7db[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0xddfa12[_0xa3f6('0x3c')],qs[_0xa3f6('0x42')](_0x5f2663[_0xa3f6('0x3e')][_0xa3f6('0x42')]));_0x5ef7db[_0xa3f6('0x41')]=_0x5ef7db[_0xa3f6('0x41')][_0xa3f6('0x43')]?_0x5ef7db[_0xa3f6('0x41')]:_0xddfa12['model'];_0x5ef7db[_0xa3f6('0x64')]=qs[_0xa3f6('0x45')](_0x5f2663[_0xa3f6('0x3e')][_0xa3f6('0x45')]);_0x5ef7db[_0xa3f6('0x46')]=qs[_0xa3f6('0x3f')](_[_0xa3f6('0x47')](_0x5f2663[_0xa3f6('0x3e')],_0xddfa12[_0xa3f6('0x3f')]));if(_0x5f2663[_0xa3f6('0x3e')][_0xa3f6('0x49')]){_0x5ef7db[_0xa3f6('0x46')]=_[_0xa3f6('0x48')](_0x5ef7db[_0xa3f6('0x46')],{'$or':_[_0xa3f6('0x2e')](_0x5ef7db['attributes'],function(_0x48ebcc){var _0x5de2e2={};_0x5de2e2[_0x48ebcc]={'$like':'%'+_0x5f2663['query'][_0xa3f6('0x49')]+'%'};return _0x5de2e2;})});}_0x5ef7db=_[_0xa3f6('0x48')]({},_0x5ef7db,_0x5f2663[_0xa3f6('0x4a')]);return _0x2ca246[_0xa3f6('0x6d')](_0x5ef7db);}})['then'](function(_0xae5a31){if(_0xae5a31){_0x133e9b=_0xae5a31[_0xa3f6('0x43')];if(!_0x5f2663[_0xa3f6('0x3e')][_0xa3f6('0x44')](_0xa3f6('0x63'))){_0x5ef7db[_0xa3f6('0x20')]=qs['limit'](_0x5f2663['query'][_0xa3f6('0x20')]);_0x5ef7db[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0x5f2663[_0xa3f6('0x3e')][_0xa3f6('0x22')]);}return _0x2ca246[_0xa3f6('0x6d')](_0x5ef7db);}})[_0xa3f6('0x27')](function(_0x33ceb6){if(_0x33ceb6){return _0x33ceb6?{'count':_0x133e9b,'rows':_0x33ceb6}:null;}})[_0xa3f6('0x27')](respondWithResult(_0x43a6e0,null))[_0xa3f6('0x4f')](handleError(_0x43a6e0,null));};exports[_0xa3f6('0x6e')]=function(_0x5bb7fa,_0x5540c3,_0x315a27){var _0x53bacf=_0x5bb7fa['body'][_0xa3f6('0x6f')];var _0x48b228=_[_0xa3f6('0x2e')](_0x53bacf,'id');return db[_0xa3f6('0x6c')]['findAll']({'where':{'id':_0x48b228},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa3f6('0x70'),'attributes':['id',_0xa3f6('0x32'),_0xa3f6('0x71'),_0xa3f6('0x72'),_0xa3f6('0x73')],'raw':!![]}]})[_0xa3f6('0x27')](function(_0x16ed63){if(_0x16ed63){var _0x14cd42=_[_0xa3f6('0x74')](_0x16ed63,function(_0x495f5b){var _0x3ca43b=_0x495f5b[_0xa3f6('0x29')]({'plain':!![]});_0x3ca43b[_0xa3f6('0x70')][_0xa3f6('0x75')](function(_0x5d6d14){_0x5d6d14[_0xa3f6('0x76')]=_[_0xa3f6('0x52')](_0x53bacf,{'id':_0x3ca43b['id']})[_0xa3f6('0x76')];});return _0x3ca43b[_0xa3f6('0x70')];});return db[_0xa3f6('0x38')]['find']({'where':{'id':_0x5bb7fa[_0xa3f6('0x51')]['id']}})[_0xa3f6('0x27')](function(_0x52ac31){return db[_0xa3f6('0x77')][_0xa3f6('0x78')](function(_0x538cd4){return _0x52ac31[_0xa3f6('0x6e')](_0x48b228,{'transaction':_0x538cd4})[_0xa3f6('0x27')](function(){return BPromise['each'](_0x53bacf,function(_0x358fa9){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x358fa9['id'],'VoiceQueueId':_0x5bb7fa[_0xa3f6('0x51')]['id'],'penalty':_0x358fa9[_0xa3f6('0x76')]},{'transaction':_0x538cd4});});})[_0xa3f6('0x27')](function(){return BPromise['each'](_0x14cd42,function(_0x4faf88){return db[_0xa3f6('0x79')]['findOrCreate']({'where':{'UserId':_0x4faf88['id'],'VoiceQueueId':_0x5bb7fa['params']['id']},'defaults':{'penalty':_0x4faf88[_0xa3f6('0x76')]},'transaction':_0x538cd4});});})[_0xa3f6('0x27')](function(){return BPromise[_0xa3f6('0x7a')](_[_0xa3f6('0x49')](_0x14cd42,{'online':!![]}),function(_0x30c5b5){return db[_0xa3f6('0x7b')][_0xa3f6('0x7c')]({'membername':_0x30c5b5[_0xa3f6('0x32')],'UserId':_0x30c5b5['id'],'queue_name':_0x52ac31[_0xa3f6('0x32')],'VoiceQueueId':_0x52ac31['id'],'interface':_['isNil'](_0x30c5b5[_0xa3f6('0x73')])?util[_0xa3f6('0x7d')]('SIP/%s',_0x30c5b5[_0xa3f6('0x32')]):_0x30c5b5['interface'],'paused':_0x30c5b5['voicePause']||![],'penalty':_0x30c5b5[_0xa3f6('0x76')]},{'transaction':_0x538cd4});});})[_0xa3f6('0x27')](function(){_0x14cd42[_0xa3f6('0x75')](function(_0x6e2848){socket['emit'](_0xa3f6('0x7e'),{'UserId':_0x6e2848['id'],'VoiceQueueId':_0x52ac31['id']});});});});});}})[_0xa3f6('0x27')](respondWithStatusCode(_0x5540c3,null))[_0xa3f6('0x4f')](handleError(_0x5540c3,null));};exports[_0xa3f6('0x7f')]=function(_0x21ab07,_0x205c72,_0x44a36b){return db[_0xa3f6('0x6c')][_0xa3f6('0x4d')]({'where':{'id':_0x21ab07[_0xa3f6('0x3e')][_0xa3f6('0x80')]},'attributes':['id'],'include':[{'model':db[_0xa3f6('0x81')],'as':_0xa3f6('0x70'),'attributes':['id'],'raw':!![]}]})[_0xa3f6('0x27')](handleEntityNotFound(_0x205c72,null))[_0xa3f6('0x27')](function(_0x359be3){var _0x1bf8f1=_[_0xa3f6('0x2e')](_0x359be3,'id');var _0x13df38=[];var _0x182cff=[];var _0xd7a3b=squel[_0xa3f6('0x82')]();_0xd7a3b[_0xa3f6('0x83')](_0xa3f6('0x84'))[_0xa3f6('0x85')](_0xa3f6('0x86'),'tq')['join'](_0xa3f6('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa3f6('0x46')]('VoiceQueueId\x20=\x20?',_0x21ab07[_0xa3f6('0x51')]['id']);for(var _0xfd5390=0x0;_0xfd5390<_0x359be3[_0xa3f6('0x43')];_0xfd5390+=0x1){let _0x1bd005=_0x359be3[_0xfd5390];for(var _0x143253=0x0;_0x143253<_0x1bd005[_0xa3f6('0x70')][_0xa3f6('0x43')];_0x143253+=0x1){let _0x572484=_0x1bd005['Agents'][_0x143253];var _0x5961c6=_0xd7a3b['clone']();_0x5961c6[_0xa3f6('0x46')](_0xa3f6('0x88'),_0x572484['id']);_0x182cff[_0xa3f6('0x89')](db[_0xa3f6('0x77')][_0xa3f6('0x3e')](_0x5961c6['toString'](),{'type':db['sequelize']['QueryTypes'][_0xa3f6('0x8a')]})[_0xa3f6('0x27')](function(_0x4c44a5){if(_0x4c44a5[_0xa3f6('0x43')]===0x1){return _0x572484['id'];}else{var _0x3c7f74=_['every'](_[_0xa3f6('0x2e')](_0x4c44a5,'TeamId'),function(_0x22caeb){return _[_0xa3f6('0x30')](_0x1bf8f1,_0x22caeb);});if(_0x3c7f74){return _0x572484['id'];}}}));}}return BPromise[_0xa3f6('0x8b')](_0x182cff)[_0xa3f6('0x27')](function(_0x193d9e){_0x13df38=_(_0x13df38)[_0xa3f6('0x8c')](_0x193d9e)[_0xa3f6('0x8d')]()['value']();return db[_0xa3f6('0x38')]['find']({'where':{'id':_0x21ab07['params']['id']}})['then'](function(_0x1ef0c4){return db[_0xa3f6('0x77')][_0xa3f6('0x78')](function(_0x115431){return _0x1ef0c4[_0xa3f6('0x7f')](_0x21ab07[_0xa3f6('0x3e')][_0xa3f6('0x80')],{'transaction':_0x115431})[_0xa3f6('0x27')](function(){if(!_[_0xa3f6('0x8e')](_0x13df38)){return _0x1ef0c4[_0xa3f6('0x8f')](_0x13df38,{'transaction':_0x115431})[_0xa3f6('0x27')](function(){return db[_0xa3f6('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x21ab07[_0xa3f6('0x51')]['id'],'UserId':_0x13df38},'transaction':_0x115431});});}})[_0xa3f6('0x27')](function(){_0x13df38[_0xa3f6('0x75')](function(_0x103172){socket[_0xa3f6('0x90')]('userVoiceQueue:remove',{'UserId':_0x103172,'VoiceQueueId':_0x1ef0c4['id']});});});});});});})[_0xa3f6('0x27')](respondWithStatusCode(_0x205c72,null))[_0xa3f6('0x4f')](handleError(_0x205c72,null));};exports[_0xa3f6('0x91')]=function(_0x277b14,_0x3d7ea1,_0x559942){var _0x44ad73,_0x5fcb3a;return db[_0xa3f6('0x38')][_0xa3f6('0x52')]({'where':{'id':_0x277b14[_0xa3f6('0x51')]['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0x3d7ea1,null))['then'](function(_0x55dda4){if(_0x55dda4){_0x5fcb3a=_0x55dda4;return _0x55dda4[_0xa3f6('0x91')](_0x277b14['body'][_0xa3f6('0x80')],_['omit'](_0x277b14['body'],[_0xa3f6('0x80'),'id'])||{})[_0xa3f6('0x92')](function(_0x29e8f1){for(var _0x12e342=0x0;_0x12e342<_0x277b14[_0xa3f6('0x54')][_0xa3f6('0x80')]['length'];_0x12e342+=0x1){socket[_0xa3f6('0x90')](_0xa3f6('0x7e'),{'UserId':Number(_0x277b14['body'][_0xa3f6('0x80')][_0x12e342]),'VoiceQueueId':Number(_0x277b14[_0xa3f6('0x51')]['id'])});}return _0x29e8f1;});}})[_0xa3f6('0x27')](function(_0x1f1346){_0x44ad73=_0x1f1346||[];if(_0x5fcb3a){return db['User'][_0xa3f6('0x4d')]({'where':{'id':_0x277b14[_0xa3f6('0x54')][_0xa3f6('0x80')]},'attributes':['id',_0xa3f6('0x32'),_0xa3f6('0x71'),_0xa3f6('0x72'),_0xa3f6('0x73')],'raw':!![]});}})['then'](function(_0x3fb003){if(!_[_0xa3f6('0x8e')](_0x3fb003)){var _0x8e29b7=[];for(var _0x45b6c7=0x0;_0x45b6c7<_0x3fb003[_0xa3f6('0x43')];_0x45b6c7++){if(_0x3fb003[_0x45b6c7][_0xa3f6('0x71')]){_0x8e29b7[_0xa3f6('0x89')](db[_0xa3f6('0x7b')]['upsert']({'membername':_0x3fb003[_0x45b6c7][_0xa3f6('0x32')],'UserId':_0x3fb003[_0x45b6c7]['id'],'queue_name':_0x5fcb3a[_0xa3f6('0x32')],'VoiceQueueId':_0x5fcb3a['id'],'interface':_[_0xa3f6('0x93')](_0x3fb003[_0x45b6c7]['interface'])?util[_0xa3f6('0x7d')](_0xa3f6('0x94'),_0x3fb003[_0x45b6c7][_0xa3f6('0x32')]):_0x3fb003[_0x45b6c7][_0xa3f6('0x73')],'paused':_0x3fb003[_0x45b6c7][_0xa3f6('0x72')]||![],'penalty':_0x277b14[_0xa3f6('0x54')][_0xa3f6('0x76')]||0x0}));}}return BPromise[_0xa3f6('0x8b')](_0x8e29b7);}})[_0xa3f6('0x27')](function(){return _0x44ad73;})[_0xa3f6('0x27')](respondWithResult(_0x3d7ea1,null))['catch'](handleError(_0x3d7ea1,null));};exports[_0xa3f6('0x8f')]=function(_0x2bd68c,_0x54e1ce,_0x289b30){return db['VoiceQueue'][_0xa3f6('0x52')]({'where':{'id':_0x2bd68c[_0xa3f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x54e1ce,null))[_0xa3f6('0x27')](function(_0x2a4697){if(_0x2a4697){return _0x2a4697[_0xa3f6('0x8f')](_0x2bd68c[_0xa3f6('0x3e')][_0xa3f6('0x80')])[_0xa3f6('0x27')](function(){if(_[_0xa3f6('0x95')](_0x2bd68c[_0xa3f6('0x3e')][_0xa3f6('0x80')])){for(var _0x5b9582=0x0;_0x5b9582<_0x2bd68c[_0xa3f6('0x3e')]['ids'][_0xa3f6('0x43')];_0x5b9582+=0x1){socket[_0xa3f6('0x90')](_0xa3f6('0x96'),{'UserId':Number(_0x2bd68c['query'][_0xa3f6('0x80')][_0x5b9582]),'VoiceQueueId':Number(_0x2bd68c[_0xa3f6('0x51')]['id'])});}}else{socket[_0xa3f6('0x90')](_0xa3f6('0x96'),{'UserId':Number(_0x2bd68c[_0xa3f6('0x3e')][_0xa3f6('0x80')]),'VoiceQueueId':Number(_0x2bd68c[_0xa3f6('0x51')]['id'])});}});}})[_0xa3f6('0x27')](function(_0x51cbb6){return db[_0xa3f6('0x7b')][_0xa3f6('0x28')]({'where':{'VoiceQueueId':_0x2bd68c['params']['id'],'UserId':_0x2bd68c[_0xa3f6('0x3e')][_0xa3f6('0x80')]}})[_0xa3f6('0x27')](function(){return _0x51cbb6;});})['then'](respondWithStatusCode(_0x54e1ce,null))['catch'](handleError(_0x54e1ce,null));};exports[_0xa3f6('0x97')]=function(_0x288012,_0x60201b,_0xc9182e){var _0x191e4f={};var _0x4db2e6={};var _0xb16516;var _0x3b11fc;return db[_0xa3f6('0x38')][_0xa3f6('0x61')]({'where':{'id':_0x288012[_0xa3f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x60201b,null))[_0xa3f6('0x27')](function(_0x5d69fd){if(_0x5d69fd){_0xb16516=_0x5d69fd;_0x4db2e6['model']=_[_0xa3f6('0x3d')](db[_0xa3f6('0x81')][_0xa3f6('0x39')]);_0x4db2e6[_0xa3f6('0x3e')]=_[_0xa3f6('0x3d')](_0x288012[_0xa3f6('0x3e')]);_0x4db2e6[_0xa3f6('0x3f')]=_['intersection'](_0x4db2e6[_0xa3f6('0x3c')],_0x4db2e6[_0xa3f6('0x3e')]);_0x191e4f[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0x4db2e6[_0xa3f6('0x3c')],qs['fields'](_0x288012[_0xa3f6('0x3e')][_0xa3f6('0x42')]));_0x191e4f[_0xa3f6('0x41')]=_0x191e4f[_0xa3f6('0x41')]['length']?_0x191e4f[_0xa3f6('0x41')]:_0x4db2e6['model'];_0x191e4f['order']=qs[_0xa3f6('0x45')](_0x288012[_0xa3f6('0x3e')]['sort']);_0x191e4f[_0xa3f6('0x46')]=qs[_0xa3f6('0x3f')](_['pick'](_0x288012[_0xa3f6('0x3e')],_0x4db2e6[_0xa3f6('0x3f')]));if(_0x288012[_0xa3f6('0x3e')][_0xa3f6('0x49')]){_0x191e4f[_0xa3f6('0x46')]=_['merge'](_0x191e4f[_0xa3f6('0x46')],{'$or':_[_0xa3f6('0x2e')](_0x191e4f['attributes'],function(_0x1d6245){var _0x381350={};_0x381350[_0x1d6245]={'$like':'%'+_0x288012[_0xa3f6('0x3e')][_0xa3f6('0x49')]+'%'};return _0x381350;})});}_0x191e4f=_['merge']({},_0x191e4f,_0x288012['options']);return _0xb16516[_0xa3f6('0x97')](_0x191e4f);}})[_0xa3f6('0x27')](function(_0x26f0b0){if(_0x26f0b0){_0x3b11fc=_0x26f0b0[_0xa3f6('0x43')];if(!_0x288012[_0xa3f6('0x3e')]['hasOwnProperty'](_0xa3f6('0x63'))){_0x191e4f['limit']=qs[_0xa3f6('0x20')](_0x288012[_0xa3f6('0x3e')][_0xa3f6('0x20')]);_0x191e4f[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0x288012[_0xa3f6('0x3e')][_0xa3f6('0x22')]);}return _0xb16516[_0xa3f6('0x97')](_0x191e4f);}})[_0xa3f6('0x27')](function(_0x428826){if(_0x428826){return _0x428826?{'count':_0x3b11fc,'rows':_0x428826}:null;}})['then'](respondWithResult(_0x60201b,null))[_0xa3f6('0x4f')](handleError(_0x60201b,null));};exports[_0xa3f6('0x98')]=function(_0x5b2f0e,_0x1b8846,_0x2b563f){var _0x485292={};var _0x146b00={};var _0x460133;var _0x54a924;return db[_0xa3f6('0x38')][_0xa3f6('0x61')]({'where':{'id':_0x5b2f0e[_0xa3f6('0x51')]['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0x1b8846,null))[_0xa3f6('0x27')](function(_0x2bc9d7){if(_0x2bc9d7){_0x460133=_0x2bc9d7;_0x146b00[_0xa3f6('0x3c')]=_[_0xa3f6('0x3d')](db[_0xa3f6('0x7b')][_0xa3f6('0x39')]);_0x146b00[_0xa3f6('0x3e')]=_['keys'](_0x5b2f0e['query']);_0x146b00[_0xa3f6('0x3f')]=_[_0xa3f6('0x40')](_0x146b00[_0xa3f6('0x3c')],_0x146b00[_0xa3f6('0x3e')]);_0x485292[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0x146b00[_0xa3f6('0x3c')],qs[_0xa3f6('0x42')](_0x5b2f0e[_0xa3f6('0x3e')]['fields']));_0x485292[_0xa3f6('0x41')]=_0x485292[_0xa3f6('0x41')][_0xa3f6('0x43')]?_0x485292[_0xa3f6('0x41')]:_0x146b00[_0xa3f6('0x3c')];_0x485292[_0xa3f6('0x64')]=qs[_0xa3f6('0x45')](_0x5b2f0e[_0xa3f6('0x3e')]['sort']);_0x485292['where']=qs['filters'](_[_0xa3f6('0x47')](_0x5b2f0e[_0xa3f6('0x3e')],_0x146b00[_0xa3f6('0x3f')]));if(_0x5b2f0e[_0xa3f6('0x3e')][_0xa3f6('0x49')]){_0x485292[_0xa3f6('0x46')]=_[_0xa3f6('0x48')](_0x485292[_0xa3f6('0x46')],{'$or':_['map'](_0x485292[_0xa3f6('0x41')],function(_0x33332c){var _0x21d67e={};_0x21d67e[_0x33332c]={'$like':'%'+_0x5b2f0e[_0xa3f6('0x3e')]['filter']+'%'};return _0x21d67e;})});}_0x485292=_[_0xa3f6('0x48')]({},_0x485292,_0x5b2f0e[_0xa3f6('0x4a')]);return _0x460133[_0xa3f6('0x98')](_0x485292);}})[_0xa3f6('0x27')](function(_0x2b10d7){if(_0x2b10d7){_0x54a924=_0x2b10d7[_0xa3f6('0x43')];if(!_0x5b2f0e[_0xa3f6('0x3e')][_0xa3f6('0x44')](_0xa3f6('0x63'))){_0x485292[_0xa3f6('0x20')]=qs['limit'](_0x5b2f0e['query'][_0xa3f6('0x20')]);_0x485292[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0x5b2f0e[_0xa3f6('0x3e')][_0xa3f6('0x22')]);}return _0x460133[_0xa3f6('0x98')](_0x485292);}})[_0xa3f6('0x27')](function(_0x1183e8){return _0x1183e8?{'count':_0x54a924,'rows':_0x1183e8}:null;})[_0xa3f6('0x27')](respondWithResult(_0x1b8846,null))[_0xa3f6('0x4f')](handleError(_0x1b8846,null));};exports[_0xa3f6('0x99')]=function(_0x5618f0,_0x48439d,_0x3d2e44){var _0x30a482={};var _0x37bbca={};var _0x4416c1;var _0x292c8d;return db[_0xa3f6('0x38')][_0xa3f6('0x61')]({'where':{'id':_0x5618f0[_0xa3f6('0x51')]['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0x48439d,null))[_0xa3f6('0x27')](function(_0x57e381){if(_0x57e381){_0x4416c1=_0x57e381;_0x37bbca['model']=_[_0xa3f6('0x3d')](db[_0xa3f6('0x9a')]['rawAttributes']);_0x37bbca[_0xa3f6('0x3e')]=_['keys'](_0x5618f0['query']);_0x37bbca[_0xa3f6('0x3f')]=_[_0xa3f6('0x40')](_0x37bbca[_0xa3f6('0x3c')],_0x37bbca[_0xa3f6('0x3e')]);_0x30a482[_0xa3f6('0x41')]=_['intersection'](_0x37bbca['model'],qs[_0xa3f6('0x42')](_0x5618f0['query']['fields']));_0x30a482[_0xa3f6('0x41')]=_0x30a482['attributes'][_0xa3f6('0x43')]?_0x30a482[_0xa3f6('0x41')]:_0x37bbca[_0xa3f6('0x3c')];_0x30a482['order']=qs['sort'](_0x5618f0[_0xa3f6('0x3e')][_0xa3f6('0x45')]);_0x30a482['where']=qs[_0xa3f6('0x3f')](_[_0xa3f6('0x47')](_0x5618f0[_0xa3f6('0x3e')],_0x37bbca['filters']));if(_0x5618f0[_0xa3f6('0x3e')][_0xa3f6('0x49')]){_0x30a482[_0xa3f6('0x46')]=_[_0xa3f6('0x48')](_0x30a482[_0xa3f6('0x46')],{'$or':_[_0xa3f6('0x2e')](_0x30a482[_0xa3f6('0x41')],function(_0x387d8f){var _0x5f39e8={};_0x5f39e8[_0x387d8f]={'$like':'%'+_0x5618f0[_0xa3f6('0x3e')][_0xa3f6('0x49')]+'%'};return _0x5f39e8;})});}_0x30a482=_[_0xa3f6('0x48')]({},_0x30a482,_0x5618f0[_0xa3f6('0x4a')]);return _0x4416c1[_0xa3f6('0x99')](_0x30a482);}})[_0xa3f6('0x27')](function(_0x12f59f){if(_0x12f59f){_0x292c8d=_0x12f59f[_0xa3f6('0x43')];if(!_0x5618f0[_0xa3f6('0x3e')][_0xa3f6('0x44')]('nolimit')){_0x30a482[_0xa3f6('0x20')]=qs[_0xa3f6('0x20')](_0x5618f0['query']['limit']);_0x30a482['offset']=qs[_0xa3f6('0x22')](_0x5618f0[_0xa3f6('0x3e')][_0xa3f6('0x22')]);}return _0x4416c1[_0xa3f6('0x99')](_0x30a482);}})['then'](function(_0x3c968f){if(_0x3c968f){return _0x3c968f?{'count':_0x292c8d,'rows':_0x3c968f}:null;}})[_0xa3f6('0x27')](respondWithResult(_0x48439d,null))[_0xa3f6('0x4f')](handleError(_0x48439d,null));};exports['addLists']=function(_0x48dfb7,_0x17ddb6,_0x428b2c){var _0x3faa62,_0x5d7a51;return db[_0xa3f6('0x38')][_0xa3f6('0x52')]({'where':{'id':_0x48dfb7[_0xa3f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x17ddb6,null))[_0xa3f6('0x27')](function(_0x2524a7){if(_0x2524a7){_0x5d7a51=_0x2524a7;return _0x2524a7['addLists'](_0x48dfb7['body']['ids'],_[_0xa3f6('0x9b')](_0x48dfb7['body'],[_0xa3f6('0x80'),'id'])||{});}return null;})[_0xa3f6('0x92')](function(_0x1ccee7){var _0x5de551;_0x3faa62=_0x1ccee7||[];var _0xa15df4=[];if(_0x1ccee7){for(var _0x3d8b85=0x0;_0x3d8b85<_0x1ccee7[_0xa3f6('0x43')];_0x3d8b85+=0x1){var _0x188017=_0x1ccee7[_0x3d8b85][_0xa3f6('0x29')]({'plain':!![]});_0x5d7a51[_0xa3f6('0x9c')]=_0x48dfb7[_0xa3f6('0x54')][_0xa3f6('0x9c')]?_0x48dfb7[_0xa3f6('0x54')]['dialCheckDuplicateType']:_0x5d7a51[_0xa3f6('0x9c')];switch(_0x5d7a51[_0xa3f6('0x9c')]){case'always':_0x5de551=squel['insert']()[_0xa3f6('0x9d')]('cm_hopper')[_0xa3f6('0x9e')]([_0xa3f6('0x9f'),_0xa3f6('0xa0'),'ContactId',_0xa3f6('0xa1'),_0xa3f6('0x67'),'createdAt','updatedAt'],squel[_0xa3f6('0x82')]()[_0xa3f6('0x83')]('phone',_0xa3f6('0x9f'))[_0xa3f6('0x83')](_0xa3f6('0xa2'),'scheduledAt')['field']('id',_0xa3f6('0xa3'))[_0xa3f6('0x83')](_0x188017[_0xa3f6('0xa4')][_0xa3f6('0xa5')](),_0xa3f6('0xa1'))['field'](_0x48dfb7[_0xa3f6('0x51')]['id'][_0xa3f6('0xa5')](),_0xa3f6('0x67'))['field'](_0xa3f6('0xa2'),_0xa3f6('0x5e'))[_0xa3f6('0x83')](_0xa3f6('0xa2'),_0xa3f6('0x5d'))[_0xa3f6('0x85')]('cm_contacts')[_0xa3f6('0x46')](_0xa3f6('0xa6'))[_0xa3f6('0x46')](_0xa3f6('0xa7'),_0x188017[_0xa3f6('0xa4')]['toString']())[_0xa3f6('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0xa3f6('0x46')](_0xa3f6('0xa8'),squel[_0xa3f6('0x82')]()[_0xa3f6('0x83')](_0xa3f6('0xa9'))[_0xa3f6('0x85')](_0xa3f6('0xaa'))['where'](_0xa3f6('0xab'),_0x48dfb7[_0xa3f6('0x51')]['id'][_0xa3f6('0xa5')]()))[_0xa3f6('0x46')](_0xa3f6('0xa8'),squel[_0xa3f6('0x82')]()[_0xa3f6('0x83')](_0xa3f6('0xac'))[_0xa3f6('0x85')](_0xa3f6('0xad'))['where'](_0xa3f6('0xab'),_0x48dfb7[_0xa3f6('0x51')]['id'][_0xa3f6('0xa5')]())))['toString']();break;case _0xa3f6('0xae'):_0x5de551=squel['insert']()[_0xa3f6('0x9d')](_0xa3f6('0xad'))['fromQuery'](['phone',_0xa3f6('0xa0'),_0xa3f6('0xa3'),_0xa3f6('0xa1'),'VoiceQueueId',_0xa3f6('0x5e'),_0xa3f6('0x5d')],squel[_0xa3f6('0x82')]()[_0xa3f6('0x83')]('phone','phone')[_0xa3f6('0x83')](_0xa3f6('0xa2'),_0xa3f6('0xa0'))[_0xa3f6('0x83')]('id',_0xa3f6('0xa3'))['field'](_0x188017[_0xa3f6('0xa4')][_0xa3f6('0xa5')](),_0xa3f6('0xa1'))['field'](_0x48dfb7[_0xa3f6('0x51')]['id']['toString'](),'VoiceQueueId')['field'](_0xa3f6('0xa2'),_0xa3f6('0x5e'))[_0xa3f6('0x83')](_0xa3f6('0xa2'),_0xa3f6('0x5d'))['from']('cm_contacts')['where'](_0xa3f6('0xa6'))[_0xa3f6('0x46')](_0xa3f6('0xa7'),_0x188017[_0xa3f6('0xa4')][_0xa3f6('0xa5')]())[_0xa3f6('0x46')](_0xa3f6('0xaf'))[_0xa3f6('0x46')](_0xa3f6('0xa8'),squel[_0xa3f6('0x82')]()[_0xa3f6('0x83')](_0xa3f6('0xac'))[_0xa3f6('0x85')](_0xa3f6('0xad'))[_0xa3f6('0x46')]('VoiceQueueId\x20=\x20?',_0x48dfb7['params']['id'][_0xa3f6('0xa5')]())))['toString']();break;default:_0x5de551=squel[_0xa3f6('0xb0')]()['into'](_0xa3f6('0xad'))[_0xa3f6('0x9e')](['phone',_0xa3f6('0xa0'),_0xa3f6('0xa3'),_0xa3f6('0xa1'),'VoiceQueueId','createdAt',_0xa3f6('0x5d')],squel[_0xa3f6('0x82')]()['field'](_0xa3f6('0x9f'),_0xa3f6('0x9f'))[_0xa3f6('0x83')](_0xa3f6('0xa2'),'scheduledAt')[_0xa3f6('0x83')]('id',_0xa3f6('0xa3'))['field'](_0x188017[_0xa3f6('0xa4')][_0xa3f6('0xa5')](),_0xa3f6('0xa1'))[_0xa3f6('0x83')](_0x48dfb7[_0xa3f6('0x51')]['id'][_0xa3f6('0xa5')](),'VoiceQueueId')[_0xa3f6('0x83')](_0xa3f6('0xa2'),_0xa3f6('0x5e'))[_0xa3f6('0x83')](_0xa3f6('0xa2'),_0xa3f6('0x5d'))[_0xa3f6('0x85')]('cm_contacts')[_0xa3f6('0x46')]('deletedAt\x20IS\x20NULL')[_0xa3f6('0x46')](_0xa3f6('0xa7'),_0x188017[_0xa3f6('0xa4')]['toString']())[_0xa3f6('0x46')](_0xa3f6('0xaf')))[_0xa3f6('0xa5')]();}_0xa15df4[_0xa3f6('0x89')](db['sequelize'][_0xa3f6('0x3e')](_0x5de551));}return BPromise['all'](_0xa15df4);}})[_0xa3f6('0x27')](function(){return _0x3faa62;})[_0xa3f6('0x27')](respondWithResult(_0x17ddb6,null))[_0xa3f6('0x4f')](handleError(_0x17ddb6,null));};exports['removeLists']=function(_0x31ec4e,_0x73092c,_0x15f7bf){return db[_0xa3f6('0x38')][_0xa3f6('0x52')]({'where':{'id':_0x31ec4e[_0xa3f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x73092c,null))[_0xa3f6('0x27')](function(_0x21858f){if(_0x21858f){return _0x21858f[_0xa3f6('0xb1')](_0x31ec4e[_0xa3f6('0x3e')]['ids']);}})[_0xa3f6('0x27')](function(_0x28acc7){if(_0x28acc7){return db[_0xa3f6('0x62')][_0xa3f6('0x28')]({'where':{'ListId':_0x31ec4e[_0xa3f6('0x3e')][_0xa3f6('0x80')],'VoiceQueueId':_0x31ec4e[_0xa3f6('0x51')]['id']}})['then'](function(){return _0x28acc7;});}})[_0xa3f6('0x27')](respondWithStatusCode(_0x73092c,null))[_0xa3f6('0x4f')](handleError(_0x73092c,null));};exports['getBlackLists']=function(_0x55da6b,_0x542789,_0x485222){var _0x3e3906={};var _0x33ae36={};var _0x5882ce;var _0x32eec5;return db[_0xa3f6('0x38')][_0xa3f6('0x61')]({'where':{'id':_0x55da6b[_0xa3f6('0x51')]['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0x542789,null))[_0xa3f6('0x27')](function(_0x2b95b5){if(_0x2b95b5){_0x5882ce=_0x2b95b5;_0x33ae36[_0xa3f6('0x3c')]=_[_0xa3f6('0x3d')](db['CmList'][_0xa3f6('0x39')]);_0x33ae36[_0xa3f6('0x3e')]=_[_0xa3f6('0x3d')](_0x55da6b[_0xa3f6('0x3e')]);_0x33ae36[_0xa3f6('0x3f')]=_[_0xa3f6('0x40')](_0x33ae36[_0xa3f6('0x3c')],_0x33ae36['query']);_0x3e3906[_0xa3f6('0x41')]=_[_0xa3f6('0x40')](_0x33ae36[_0xa3f6('0x3c')],qs[_0xa3f6('0x42')](_0x55da6b[_0xa3f6('0x3e')][_0xa3f6('0x42')]));_0x3e3906[_0xa3f6('0x41')]=_0x3e3906['attributes'][_0xa3f6('0x43')]?_0x3e3906[_0xa3f6('0x41')]:_0x33ae36['model'];_0x3e3906['order']=qs[_0xa3f6('0x45')](_0x55da6b['query'][_0xa3f6('0x45')]);_0x3e3906[_0xa3f6('0x46')]=qs[_0xa3f6('0x3f')](_[_0xa3f6('0x47')](_0x55da6b[_0xa3f6('0x3e')],_0x33ae36[_0xa3f6('0x3f')]));if(_0x55da6b[_0xa3f6('0x3e')]['filter']){_0x3e3906['where']=_[_0xa3f6('0x48')](_0x3e3906[_0xa3f6('0x46')],{'$or':_['map'](_0x3e3906[_0xa3f6('0x41')],function(_0x4d1994){var _0x513d3d={};_0x513d3d[_0x4d1994]={'$like':'%'+_0x55da6b[_0xa3f6('0x3e')][_0xa3f6('0x49')]+'%'};return _0x513d3d;})});}_0x3e3906=_[_0xa3f6('0x48')]({},_0x3e3906,_0x55da6b['options']);return _0x5882ce[_0xa3f6('0xb2')](_0x3e3906);}})[_0xa3f6('0x27')](function(_0x44e406){if(_0x44e406){_0x32eec5=_0x44e406[_0xa3f6('0x43')];if(!_0x55da6b[_0xa3f6('0x3e')][_0xa3f6('0x44')](_0xa3f6('0x63'))){_0x3e3906[_0xa3f6('0x20')]=qs[_0xa3f6('0x20')](_0x55da6b['query'][_0xa3f6('0x20')]);_0x3e3906['offset']=qs['offset'](_0x55da6b[_0xa3f6('0x3e')][_0xa3f6('0x22')]);}return _0x5882ce[_0xa3f6('0xb2')](_0x3e3906);}})['then'](function(_0x3de819){if(_0x3de819){return _0x3de819?{'count':_0x32eec5,'rows':_0x3de819}:null;}})[_0xa3f6('0x27')](respondWithResult(_0x542789,null))[_0xa3f6('0x4f')](handleError(_0x542789,null));};exports[_0xa3f6('0xb3')]=function(_0x29a80c,_0x457618,_0x53f526){var _0x12f1f7,_0x2087ed;return db['VoiceQueue'][_0xa3f6('0x52')]({'where':{'id':_0x29a80c[_0xa3f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x457618,null))['then'](function(_0x38a869){if(_0x38a869){_0x2087ed=_0x38a869;return _0x38a869[_0xa3f6('0xb3')](_0x29a80c['body'][_0xa3f6('0x80')],_[_0xa3f6('0x9b')](_0x29a80c['body'],[_0xa3f6('0x80'),'id'])||{});}return null;})['spread'](function(_0x262577){var _0x2d1496;_0x12f1f7=_0x262577||[];var _0x1ffb92=[];if(_0x262577){for(var _0xcf5724=0x0;_0xcf5724<_0x262577[_0xa3f6('0x43')];_0xcf5724+=0x1){var _0x1406e6=_0x262577[_0xcf5724]['get']({'plain':!![]});_0x2d1496=squel['insert']()[_0xa3f6('0x9d')](_0xa3f6('0xb4'))[_0xa3f6('0x9e')]([_0xa3f6('0x9f'),_0xa3f6('0xa3'),'ListId',_0xa3f6('0x67'),'createdAt',_0xa3f6('0x5d')],squel['select']()[_0xa3f6('0x83')](_0xa3f6('0x9f'),_0xa3f6('0x9f'))[_0xa3f6('0x83')]('id',_0xa3f6('0xa3'))[_0xa3f6('0x83')](_0x1406e6[_0xa3f6('0xa4')][_0xa3f6('0xa5')](),'ListId')['field'](_0x29a80c[_0xa3f6('0x51')]['id']['toString'](),_0xa3f6('0x67'))[_0xa3f6('0x83')](_0xa3f6('0xa2'),_0xa3f6('0x5e'))[_0xa3f6('0x83')]('NOW()',_0xa3f6('0x5d'))[_0xa3f6('0x85')](_0xa3f6('0xb5'))['where']('deletedAt\x20IS\x20NULL')[_0xa3f6('0x46')](_0xa3f6('0xa7'),_0x1406e6[_0xa3f6('0xa4')][_0xa3f6('0xa5')]())['where'](_0xa3f6('0xaf')))['toString']();_0x1ffb92[_0xa3f6('0x89')](db[_0xa3f6('0x77')][_0xa3f6('0x3e')](_0x2d1496));}return BPromise['all'](_0x1ffb92);}})[_0xa3f6('0x27')](function(){return _0x12f1f7;})[_0xa3f6('0x27')](respondWithResult(_0x457618,null))[_0xa3f6('0x4f')](handleError(_0x457618,null));};exports[_0xa3f6('0xb6')]=function(_0x3546c5,_0x34480a,_0x2b012){return db[_0xa3f6('0x38')][_0xa3f6('0x52')]({'where':{'id':_0x3546c5['params']['id']}})[_0xa3f6('0x27')](handleEntityNotFound(_0x34480a,null))['then'](function(_0x211b5e){if(_0x211b5e){return _0x211b5e[_0xa3f6('0xb6')](_0x3546c5[_0xa3f6('0x3e')][_0xa3f6('0x80')]);}})['then'](function(_0x3eb531){if(_0x3eb531){return db['CmHopperBlack'][_0xa3f6('0x28')]({'where':{'ListId':_0x3546c5[_0xa3f6('0x3e')][_0xa3f6('0x80')],'VoiceQueueId':_0x3546c5[_0xa3f6('0x51')]['id']}})['then'](function(){return _0x3eb531;});}})[_0xa3f6('0x27')](respondWithStatusCode(_0x34480a,null))[_0xa3f6('0x4f')](handleError(_0x34480a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index bce9180..98926eb 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 _0x1844=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x1844,0x178));var _0x4184=function(_0x1f453e,_0x2f2569){_0x1f453e=_0x1f453e-0x0;var _0x390021=_0x1844[_0x1f453e];return _0x390021;};'use strict';var EventEmitter=require(_0x4184('0x0'));var VoiceQueue=require(_0x4184('0x1'))['db'][_0x4184('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4184('0x3')](0x0);var events={'afterCreate':_0x4184('0x4'),'afterUpdate':_0x4184('0x5'),'afterDestroy':_0x4184('0x6')};function emitEvent(_0x10bd02){return function(_0x1f9f9a,_0x5d9d68,_0x3500ce){VoiceQueueEvents[_0x4184('0x7')](_0x10bd02+':'+_0x1f9f9a['id'],_0x1f9f9a);VoiceQueueEvents[_0x4184('0x7')](_0x10bd02,_0x1f9f9a);_0x3500ce(null);};}for(var e in events){if(events[_0x4184('0x8')](e)){var event=events[e];VoiceQueue[_0x4184('0x9')](e,emitEvent(event));}}module[_0x4184('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x0ada=['VoiceQueue','setMaxListeners','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ada,0x137));var _0xa0ad=function(_0x2cd1de,_0x38289c){_0x2cd1de=_0x2cd1de-0x0;var _0xd44908=_0x0ada[_0x2cd1de];return _0xd44908;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xa0ad('0x0'))['db'][_0xa0ad('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa0ad('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0ad('0x3'),'afterDestroy':_0xa0ad('0x4')};function emitEvent(_0x3415c5){return function(_0x1c5e16,_0x479ebd,_0x26931c){VoiceQueueEvents[_0xa0ad('0x5')](_0x3415c5+':'+_0x1c5e16['id'],_0x1c5e16);VoiceQueueEvents[_0xa0ad('0x5')](_0x3415c5,_0x1c5e16);_0x26931c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xa0ad('0x6')](e,emitEvent(event));}}module[_0xa0ad('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 7874cd4..d3ba54e 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x1e1678,_0x8f58c5){var _0x203c2c=function(_0x2eb69e){while(--_0x2eb69e){_0x1e1678['push'](_0x1e1678['shift']());}};_0x203c2c(++_0x8f58c5);}(_0x34e8,0x12c));var _0x834e=function(_0x24c38e,_0x4074a8){_0x24c38e=_0x24c38e-0x0;var _0x1d5f02=_0x34e8[_0x24c38e];return _0x1d5f02;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x55b460,_0x497077){var _0x3ac537=function(_0xd709b3){while(--_0xd709b3){_0x55b460['push'](_0x55b460['shift']());}};_0x3ac537(++_0x497077);}(_0x008c,0x188));var _0xc008=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x008c[_0x352d28];return _0x387d7e;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index e06a1e3..95f6c5e 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 _0x4ffa=['ShowVoiceQueue','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueue,\x20%s,\x20%s','result','catch','VoiceQueue','findAll','options','where','limit','include','model','map','attributes','GetVoiceQueue'];(function(_0xa143ba,_0x43505e){var _0x1ce0ac=function(_0x12d44b){while(--_0x12d44b){_0xa143ba['push'](_0xa143ba['shift']());}};_0x1ce0ac(++_0x43505e);}(_0x4ffa,0x7e));var _0xa4ff=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4ffa[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xa4ff('0x0'));var util=require('util');var moment=require(_0xa4ff('0x1'));var BPromise=require(_0xa4ff('0x2'));var rs=require(_0xa4ff('0x3'));var fs=require('fs');var Redis=require(_0xa4ff('0x4'));var db=require(_0xa4ff('0x5'))['db'];var utils=require(_0xa4ff('0x6'));var logger=require(_0xa4ff('0x7'))('rpc');var config=require(_0xa4ff('0x8'));var jayson=require(_0xa4ff('0x9'));var client=jayson[_0xa4ff('0xa')][_0xa4ff('0xb')]({'port':0x232a});config[_0xa4ff('0xc')]=_['defaults'](config[_0xa4ff('0xc')],{'host':_0xa4ff('0xd'),'port':0x18eb});var socket=require(_0xa4ff('0xe'))(new Redis(config[_0xa4ff('0xc')]));require('./voiceQueue.socket')[_0xa4ff('0xf')](socket);function respondWithRpcPromise(_0x2f08f9,_0x7b8cf1,_0x3536f3){return new BPromise(function(_0x3ad500,_0x49b312){return client['request'](_0x2f08f9,_0x3536f3)[_0xa4ff('0x10')](function(_0xb9b289){logger[_0xa4ff('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x7b8cf1,_0xa4ff('0x12'));logger[_0xa4ff('0x13')](_0xa4ff('0x14'),_0x7b8cf1,'request\x20sent',JSON[_0xa4ff('0x15')](_0xb9b289));if(_0xb9b289[_0xa4ff('0x16')]){if(_0xb9b289[_0xa4ff('0x16')][_0xa4ff('0x17')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x7b8cf1,_0xb9b289[_0xa4ff('0x16')]['message']);return _0x49b312(_0xb9b289[_0xa4ff('0x16')][_0xa4ff('0x18')]);}logger[_0xa4ff('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x7b8cf1,_0xb9b289['error'][_0xa4ff('0x18')]);return _0x3ad500(_0xb9b289['error'][_0xa4ff('0x18')]);}else{logger[_0xa4ff('0x11')](_0xa4ff('0x19'),_0x7b8cf1,'request\x20sent');_0x3ad500(_0xb9b289[_0xa4ff('0x1a')][_0xa4ff('0x18')]);}})[_0xa4ff('0x1b')](function(_0x21006a){logger[_0xa4ff('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x7b8cf1,_0x21006a);_0x49b312(_0x21006a);});});}exports['GetVoiceQueue']=function(_0x3340d5){var _0x10c98a=this;return new Promise(function(_0x33b7ee,_0x584eef){return db[_0xa4ff('0x1c')][_0xa4ff('0x1d')]({'raw':_0x3340d5[_0xa4ff('0x1e')]?_0x3340d5[_0xa4ff('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3340d5[_0xa4ff('0x1e')]?_0x3340d5[_0xa4ff('0x1e')][_0xa4ff('0x1f')]||null:null,'attributes':_0x3340d5['options']?_0x3340d5[_0xa4ff('0x1e')]['attributes']||null:null,'limit':_0x3340d5[_0xa4ff('0x1e')]?_0x3340d5[_0xa4ff('0x1e')][_0xa4ff('0x20')]||null:null,'include':_0x3340d5[_0xa4ff('0x1e')]?_0x3340d5['options'][_0xa4ff('0x21')]?_['map'](_0x3340d5[_0xa4ff('0x1e')][_0xa4ff('0x21')],function(_0x54de14){return{'model':db[_0x54de14[_0xa4ff('0x22')]],'as':_0x54de14['as'],'attributes':_0x54de14['attributes'],'include':_0x54de14[_0xa4ff('0x21')]?_[_0xa4ff('0x23')](_0x54de14[_0xa4ff('0x21')],function(_0x5d1167){return{'model':db[_0x5d1167[_0xa4ff('0x22')]],'as':_0x5d1167['as'],'attributes':_0x5d1167[_0xa4ff('0x24')],'include':_0x5d1167[_0xa4ff('0x21')]?_[_0xa4ff('0x23')](_0x5d1167[_0xa4ff('0x21')],function(_0x2cd820){return{'model':db[_0x2cd820['model']],'as':_0x2cd820['as'],'attributes':_0x2cd820[_0xa4ff('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa4ff('0x10')](function(_0x367fcc){logger['info'](_0xa4ff('0x25'),_0x3340d5);logger[_0xa4ff('0x13')](_0xa4ff('0x25'),_0x3340d5,JSON[_0xa4ff('0x15')](_0x367fcc));_0x33b7ee(_0x367fcc);})['catch'](function(_0x275127){logger[_0xa4ff('0x16')]('GetVoiceQueue',_0x275127['message'],_0x3340d5);_0x584eef(_0x10c98a[_0xa4ff('0x16')](0x1f4,_0x275127[_0xa4ff('0x18')]));});});};exports[_0xa4ff('0x26')]=function(_0x314a1c){var _0x565f25=this;return new Promise(function(_0x1c0c63,_0x2b6554){return db[_0xa4ff('0x1c')][_0xa4ff('0x27')]({'raw':_0x314a1c[_0xa4ff('0x1e')]?_0x314a1c['options'][_0xa4ff('0x28')]===undefined?!![]:![]:!![],'where':_0x314a1c[_0xa4ff('0x1e')]?_0x314a1c[_0xa4ff('0x1e')][_0xa4ff('0x1f')]||null:null,'attributes':_0x314a1c[_0xa4ff('0x1e')]?_0x314a1c['options']['attributes']||null:null,'include':_0x314a1c[_0xa4ff('0x1e')]?_0x314a1c[_0xa4ff('0x1e')][_0xa4ff('0x21')]?_[_0xa4ff('0x23')](_0x314a1c['options'][_0xa4ff('0x21')],function(_0x194d9e){return{'model':db[_0x194d9e['model']],'as':_0x194d9e['as'],'attributes':_0x194d9e[_0xa4ff('0x24')],'include':_0x194d9e[_0xa4ff('0x21')]?_['map'](_0x194d9e[_0xa4ff('0x21')],function(_0x5d2e02){return{'model':db[_0x5d2e02['model']],'as':_0x5d2e02['as'],'attributes':_0x5d2e02[_0xa4ff('0x24')],'include':_0x5d2e02[_0xa4ff('0x21')]?_[_0xa4ff('0x23')](_0x5d2e02['include'],function(_0x5df885){return{'model':db[_0x5df885[_0xa4ff('0x22')]],'as':_0x5df885['as'],'attributes':_0x5df885[_0xa4ff('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa4ff('0x10')](function(_0x55b5b6){logger[_0xa4ff('0x11')](_0xa4ff('0x26'),_0x314a1c);logger['debug'](_0xa4ff('0x26'),_0x314a1c,JSON[_0xa4ff('0x15')](_0x55b5b6));_0x1c0c63(_0x55b5b6);})['catch'](function(_0x20323d){logger[_0xa4ff('0x16')](_0xa4ff('0x26'),_0x20323d[_0xa4ff('0x18')],_0x314a1c);_0x2b6554(_0x565f25[_0xa4ff('0x16')](0x1f4,_0x20323d[_0xa4ff('0x18')]));});});}; \ No newline at end of file +var _0x5990=['catch','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','register','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','map','include','model','info','debug'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x5990,0x78));var _0x0599=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5990[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0599('0x0'));var util=require(_0x0599('0x1'));var moment=require(_0x0599('0x2'));var BPromise=require(_0x0599('0x3'));var rs=require(_0x0599('0x4'));var fs=require('fs');var Redis=require(_0x0599('0x5'));var db=require(_0x0599('0x6'))['db'];var utils=require(_0x0599('0x7'));var logger=require(_0x0599('0x8'))(_0x0599('0x9'));var config=require(_0x0599('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0599('0xb')]['http']({'port':0x232a});config['redis']=_[_0x0599('0xc')](config['redis'],{'host':_0x0599('0xd'),'port':0x18eb});var socket=require(_0x0599('0xe'))(new Redis(config[_0x0599('0xf')]));require('./voiceQueue.socket')[_0x0599('0x10')](socket);function respondWithRpcPromise(_0x47b04a,_0x571c43,_0x4f2e42){return new BPromise(function(_0x2ad9d4,_0x1fd349){return client['request'](_0x47b04a,_0x4f2e42)[_0x0599('0x11')](function(_0x11f3d9){logger['info'](_0x0599('0x12'),_0x571c43,_0x0599('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x571c43,_0x0599('0x13'),JSON[_0x0599('0x14')](_0x11f3d9));if(_0x11f3d9[_0x0599('0x15')]){if(_0x11f3d9[_0x0599('0x15')][_0x0599('0x16')]===0x1f4){logger[_0x0599('0x15')](_0x0599('0x12'),_0x571c43,_0x11f3d9[_0x0599('0x15')][_0x0599('0x17')]);return _0x1fd349(_0x11f3d9[_0x0599('0x15')][_0x0599('0x17')]);}logger[_0x0599('0x15')](_0x0599('0x12'),_0x571c43,_0x11f3d9['error'][_0x0599('0x17')]);return _0x2ad9d4(_0x11f3d9[_0x0599('0x15')]['message']);}else{logger['info'](_0x0599('0x12'),_0x571c43,_0x0599('0x13'));_0x2ad9d4(_0x11f3d9[_0x0599('0x18')][_0x0599('0x17')]);}})['catch'](function(_0x491d48){logger[_0x0599('0x15')](_0x0599('0x12'),_0x571c43,_0x491d48);_0x1fd349(_0x491d48);});});}exports[_0x0599('0x19')]=function(_0x5df560){var _0x748c3e=this;return new Promise(function(_0x3c26c,_0x586676){return db[_0x0599('0x1a')][_0x0599('0x1b')]({'raw':_0x5df560[_0x0599('0x1c')]?_0x5df560[_0x0599('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5df560['options']?_0x5df560[_0x0599('0x1c')][_0x0599('0x1d')]||null:null,'attributes':_0x5df560[_0x0599('0x1c')]?_0x5df560['options'][_0x0599('0x1e')]||null:null,'limit':_0x5df560[_0x0599('0x1c')]?_0x5df560['options']['limit']||null:null,'include':_0x5df560[_0x0599('0x1c')]?_0x5df560[_0x0599('0x1c')]['include']?_[_0x0599('0x1f')](_0x5df560[_0x0599('0x1c')]['include'],function(_0x53e38a){return{'model':db[_0x53e38a['model']],'as':_0x53e38a['as'],'attributes':_0x53e38a[_0x0599('0x1e')],'include':_0x53e38a[_0x0599('0x20')]?_['map'](_0x53e38a['include'],function(_0x37739e){return{'model':db[_0x37739e[_0x0599('0x21')]],'as':_0x37739e['as'],'attributes':_0x37739e[_0x0599('0x1e')],'include':_0x37739e[_0x0599('0x20')]?_[_0x0599('0x1f')](_0x37739e[_0x0599('0x20')],function(_0x271fe8){return{'model':db[_0x271fe8[_0x0599('0x21')]],'as':_0x271fe8['as'],'attributes':_0x271fe8[_0x0599('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0599('0x11')](function(_0x57a966){logger[_0x0599('0x22')](_0x0599('0x19'),_0x5df560);logger[_0x0599('0x23')](_0x0599('0x19'),_0x5df560,JSON[_0x0599('0x14')](_0x57a966));_0x3c26c(_0x57a966);})[_0x0599('0x24')](function(_0x310042){logger[_0x0599('0x15')](_0x0599('0x19'),_0x310042[_0x0599('0x17')],_0x5df560);_0x586676(_0x748c3e[_0x0599('0x15')](0x1f4,_0x310042[_0x0599('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x511077){var _0x2cdcf7=this;return new Promise(function(_0x2b0708,_0x5289fe){return db[_0x0599('0x1a')][_0x0599('0x25')]({'raw':_0x511077[_0x0599('0x1c')]?_0x511077[_0x0599('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x511077['options']?_0x511077[_0x0599('0x1c')][_0x0599('0x1d')]||null:null,'attributes':_0x511077['options']?_0x511077[_0x0599('0x1c')]['attributes']||null:null,'include':_0x511077[_0x0599('0x1c')]?_0x511077['options']['include']?_[_0x0599('0x1f')](_0x511077[_0x0599('0x1c')][_0x0599('0x20')],function(_0x509b8){return{'model':db[_0x509b8['model']],'as':_0x509b8['as'],'attributes':_0x509b8[_0x0599('0x1e')],'include':_0x509b8['include']?_[_0x0599('0x1f')](_0x509b8['include'],function(_0x2d043e){return{'model':db[_0x2d043e[_0x0599('0x21')]],'as':_0x2d043e['as'],'attributes':_0x2d043e['attributes'],'include':_0x2d043e[_0x0599('0x20')]?_[_0x0599('0x1f')](_0x2d043e[_0x0599('0x20')],function(_0x5f0c44){return{'model':db[_0x5f0c44[_0x0599('0x21')]],'as':_0x5f0c44['as'],'attributes':_0x5f0c44[_0x0599('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0599('0x11')](function(_0x5d03ee){logger[_0x0599('0x22')](_0x0599('0x26'),_0x511077);logger[_0x0599('0x23')](_0x0599('0x26'),_0x511077,JSON[_0x0599('0x14')](_0x5d03ee));_0x2b0708(_0x5d03ee);})['catch'](function(_0x7ca3e8){logger[_0x0599('0x15')](_0x0599('0x26'),_0x7ca3e8[_0x0599('0x17')],_0x511077);_0x5289fe(_0x2cdcf7['error'](0x1f4,_0x7ca3e8[_0x0599('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 443451f..c6b977f 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 _0xd04b=['removeListener','register','length','voiceQueue:','save','remove','update','emit'];(function(_0x42a0f9,_0x34d305){var _0x355739=function(_0x1166e3){while(--_0x1166e3){_0x42a0f9['push'](_0x42a0f9['shift']());}};_0x355739(++_0x34d305);}(_0xd04b,0x154));var _0xbd04=function(_0xb2c5e3,_0x3ae5df){_0xb2c5e3=_0xb2c5e3-0x0;var _0x1fc16d=_0xd04b[_0xb2c5e3];return _0x1fc16d;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xbd04('0x0'),_0xbd04('0x1'),_0xbd04('0x2')];function createListener(_0x1c4000,_0xe6efc7){return function(_0x1816ff){_0xe6efc7[_0xbd04('0x3')](_0x1c4000,_0x1816ff);};}function removeListener(_0x2e6631,_0x15a3e9){return function(){VoiceQueueEvents[_0xbd04('0x4')](_0x2e6631,_0x15a3e9);};}exports[_0xbd04('0x5')]=function(_0x476bbc){for(var _0x8e7a15=0x0,_0x54ec24=events[_0xbd04('0x6')];_0x8e7a15<_0x54ec24;_0x8e7a15++){var _0x1b50bb=events[_0x8e7a15];var _0x322c7b=createListener(_0xbd04('0x7')+_0x1b50bb,_0x476bbc);VoiceQueueEvents['on'](_0x1b50bb,_0x322c7b);}}; \ No newline at end of file +var _0x328b=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x845bcb,_0x322c12){var _0x279593=function(_0x26f4be){while(--_0x26f4be){_0x845bcb['push'](_0x845bcb['shift']());}};_0x279593(++_0x322c12);}(_0x328b,0x1ea));var _0xb328=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x328b[_0x3ff4a3];return _0x38676f;};'use strict';var VoiceQueueEvents=require(_0xb328('0x0'));var events=[_0xb328('0x1'),_0xb328('0x2'),_0xb328('0x3')];function createListener(_0x3d64dd,_0x1eba42){return function(_0x3e83e0){_0x1eba42[_0xb328('0x4')](_0x3d64dd,_0x3e83e0);};}function removeListener(_0x3081a8,_0x11146e){return function(){VoiceQueueEvents['removeListener'](_0x3081a8,_0x11146e);};}exports[_0xb328('0x5')]=function(_0x447e43){for(var _0x46f5c1=0x0,_0x58faa=events[_0xb328('0x6')];_0x46f5c1<_0x58faa;_0x46f5c1++){var _0x211766=events[_0x46f5c1];var _0x520baa=createListener(_0xb328('0x7')+_0x211766,_0x447e43);VoiceQueueEvents['on'](_0x211766,_0x520baa);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 91b6a94..870cc52 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 _0x8a77=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8a77,0xa8));var _0x78a7=function(_0xbc56a3,_0x326af7){_0xbc56a3=_0xbc56a3-0x0;var _0x1cec75=_0x8a77[_0xbc56a3];return _0x1cec75;};'use strict';var multer=require(_0x78a7('0x0'));var util=require(_0x78a7('0x1'));var path=require('path');var timeout=require(_0x78a7('0x2'));var express=require(_0x78a7('0x3'));var router=express[_0x78a7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x78a7('0x5'));var config=require(_0x78a7('0x6'));var controller=require(_0x78a7('0x7'));router['get']('/',auth[_0x78a7('0x8')](),controller[_0x78a7('0x9')]);router[_0x78a7('0xa')](_0x78a7('0xb'),auth[_0x78a7('0x8')](),controller[_0x78a7('0xc')]);router[_0x78a7('0xa')](_0x78a7('0xd'),auth[_0x78a7('0x8')](),controller[_0x78a7('0xe')]);router[_0x78a7('0xa')](_0x78a7('0xf'),auth[_0x78a7('0x8')](),controller[_0x78a7('0x10')]);router[_0x78a7('0x11')]('/',auth[_0x78a7('0x8')](),controller[_0x78a7('0x12')]);router[_0x78a7('0x13')](_0x78a7('0xf'),auth[_0x78a7('0x8')](),controller[_0x78a7('0x14')]);router[_0x78a7('0x15')]('/:id',auth[_0x78a7('0x8')](),controller[_0x78a7('0x16')]);module[_0x78a7('0x17')]=router; \ No newline at end of file +var _0x4d7f=['create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','show','post'];(function(_0x33d581,_0x2da6d0){var _0x3320da=function(_0x17d76a){while(--_0x17d76a){_0x33d581['push'](_0x33d581['shift']());}};_0x3320da(++_0x2da6d0);}(_0x4d7f,0xec));var _0xf4d7=function(_0x3e4b55,_0x247d85){_0x3e4b55=_0x3e4b55-0x0;var _0x4ff9d2=_0x4d7f[_0x3e4b55];return _0x4ff9d2;};'use strict';var multer=require(_0xf4d7('0x0'));var util=require(_0xf4d7('0x1'));var path=require(_0xf4d7('0x2'));var timeout=require('connect-timeout');var express=require(_0xf4d7('0x3'));var router=express[_0xf4d7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf4d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4d7('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xf4d7('0x7')]('/',auth[_0xf4d7('0x8')](),controller[_0xf4d7('0x9')]);router[_0xf4d7('0x7')](_0xf4d7('0xa'),auth[_0xf4d7('0x8')](),controller['describe']);router[_0xf4d7('0x7')](_0xf4d7('0xb'),auth[_0xf4d7('0x8')](),controller[_0xf4d7('0xc')]);router[_0xf4d7('0x7')](_0xf4d7('0xd'),auth[_0xf4d7('0x8')](),controller[_0xf4d7('0xe')]);router[_0xf4d7('0xf')]('/',auth['isAuthenticated'](),controller[_0xf4d7('0x10')]);router[_0xf4d7('0x11')](_0xf4d7('0xd'),auth['isAuthenticated'](),controller[_0xf4d7('0x12')]);router[_0xf4d7('0x13')](_0xf4d7('0xd'),auth[_0xf4d7('0x8')](),controller[_0xf4d7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ba9b546..b4f4fc7 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 _0xa8e3=['sequelize','moment','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','INTEGER','BOOLEAN'];(function(_0x5aec97,_0x24ea35){var _0x380238=function(_0x5a4c1f){while(--_0x5a4c1f){_0x5aec97['push'](_0x5aec97['shift']());}};_0x380238(++_0x24ea35);}(_0xa8e3,0x1cc));var _0x3a8e=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0xa8e3[_0x12d951];return _0x44de17;};'use strict';var Sequelize=require(_0x3a8e('0x0'));var moment=require(_0x3a8e('0x1'));module['exports']={'type':{'type':Sequelize[_0x3a8e('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a8e('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3a8e('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x63045d){var _0x59486f=moment(_0x63045d);var _0x1f1e95=moment(this['getDataValue'](_0x3a8e('0x4')))['format'](_0x3a8e('0x5'));var _0x12ca4b=_0x59486f['diff'](_0x1f1e95,_0x3a8e('0x6'));this['setDataValue'](_0x3a8e('0x7'),_0x63045d);this['setDataValue']('holdtime',_0x12ca4b||null);}},'position':{'type':Sequelize[_0x3a8e('0x8')]},'count':{'type':Sequelize[_0x3a8e('0x8')]},'queuecallerabandon':{'type':Sequelize[_0x3a8e('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3a8e('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3a8e('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3a8e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x3a8e('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x3a8e('0x8')]},'channel':{'type':Sequelize[_0x3a8e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3a8e('0x2')]},'connectedlinename':{'type':Sequelize[_0x3a8e('0x2')]},'accountcode':{'type':Sequelize[_0x3a8e('0x2')]},'context':{'type':Sequelize[_0x3a8e('0x2')]},'exten':{'type':Sequelize[_0x3a8e('0x2')]},'priority':{'type':Sequelize[_0x3a8e('0x2')]},'holdtime':{'type':Sequelize[_0x3a8e('0x8')]},'mohtime':{'type':Sequelize[_0x3a8e('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3a8e('0x2')]},'transfer':{'type':Sequelize[_0x3a8e('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x3a8e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x3a8e('0x2')]},'disposition':{'type':Sequelize[_0x3a8e('0x2')]},'secondDisposition':{'type':Sequelize[_0x3a8e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3a8e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x3a8e('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4647=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt'];(function(_0x267b2b,_0x5da6b8){var _0x408d42=function(_0xcba770){while(--_0xcba770){_0x267b2b['push'](_0x267b2b['shift']());}};_0x408d42(++_0x5da6b8);}(_0x4647,0xff));var _0x7464=function(_0x190c1d,_0x1b7e11){_0x190c1d=_0x190c1d-0x0;var _0x16c6e0=_0x4647[_0x190c1d];return _0x16c6e0;};'use strict';var Sequelize=require(_0x7464('0x0'));var moment=require(_0x7464('0x1'));module[_0x7464('0x2')]={'type':{'type':Sequelize[_0x7464('0x3')]},'uniqueid':{'type':Sequelize[_0x7464('0x3')]},'calleridnum':{'type':Sequelize[_0x7464('0x3')]},'calleridname':{'type':Sequelize[_0x7464('0x3')]},'queue':{'type':Sequelize[_0x7464('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x7464('0x4')],'set':function(_0x1f1078){var _0x41f934=moment(_0x1f1078);var _0xcba294=moment(this[_0x7464('0x5')](_0x7464('0x6')))[_0x7464('0x7')](_0x7464('0x8'));var _0x5c34af=_0x41f934['diff'](_0xcba294,'seconds');this[_0x7464('0x9')](_0x7464('0xa'),_0x1f1078);this[_0x7464('0x9')]('holdtime',_0x5c34af||null);}},'position':{'type':Sequelize[_0x7464('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x7464('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7464('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x7464('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7464('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x7464('0x3')],'comment':_0x7464('0xd')},'originalposition':{'type':Sequelize[_0x7464('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7464('0x3')]},'accountcode':{'type':Sequelize[_0x7464('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7464('0x3')]},'holdtime':{'type':Sequelize[_0x7464('0xb')]},'mohtime':{'type':Sequelize[_0x7464('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7464('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7464('0x3')]},'transfer':{'type':Sequelize[_0x7464('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7464('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7464('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x7464('0x3')]},'secondDisposition':{'type':Sequelize[_0x7464('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7464('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 3e8171e..d5f9b52 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 _0xbebd=['stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','length','include','create','body','catch','find','params','describe','sort','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error'];(function(_0x42b707,_0x22e9c4){var _0x343135=function(_0x53961b){while(--_0x53961b){_0x42b707['push'](_0x42b707['shift']());}};_0x343135(++_0x22e9c4);}(_0xbebd,0x1c7));var _0xdbeb=function(_0x177185,_0x23c06f){_0x177185=_0x177185-0x0;var _0x116610=_0xbebd[_0x177185];return _0x116610;};'use strict';var emlformat=require(_0xdbeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbeb('0x1'));var jsonpatch=require(_0xdbeb('0x2'));var rp=require(_0xdbeb('0x3'));var moment=require('moment');var BPromise=require(_0xdbeb('0x4'));var Mustache=require(_0xdbeb('0x5'));var util=require(_0xdbeb('0x6'));var path=require(_0xdbeb('0x7'));var sox=require(_0xdbeb('0x8'));var csv=require(_0xdbeb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbeb('0xa'));var squel=require('squel');var crypto=require(_0xdbeb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdbeb('0x9'));var querystring=require(_0xdbeb('0xc'));var Papa=require(_0xdbeb('0xd'));var Redis=require(_0xdbeb('0xe'));var authService=require(_0xdbeb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdbeb('0x10'));var hardwareService=require(_0xdbeb('0x11'));var logger=require(_0xdbeb('0x12'))('api');var utils=require(_0xdbeb('0x13'));var config=require(_0xdbeb('0x14'));var licenseUtil=require(_0xdbeb('0x15'));var db=require(_0xdbeb('0x16'))['db'];config['redis']=_['defaults'](config[_0xdbeb('0x17')],{'host':_0xdbeb('0x18'),'port':0x18eb});var socket=require(_0xdbeb('0x19'))(new Redis(config['redis']));require(_0xdbeb('0x1a'))[_0xdbeb('0x1b')](socket);function respondWithStatusCode(_0x1c55c0,_0x102ee3){_0x102ee3=_0x102ee3||0xcc;return function(_0x20a6d9){if(_0x20a6d9){return _0x1c55c0[_0xdbeb('0x1c')](_0x102ee3);}return _0x1c55c0[_0xdbeb('0x1d')](_0x102ee3)[_0xdbeb('0x1e')]();};}function respondWithResult(_0x3b9847,_0xc5c9ab){_0xc5c9ab=_0xc5c9ab||0xc8;return function(_0x76dd71){if(_0x76dd71){return _0x3b9847['status'](_0xc5c9ab)[_0xdbeb('0x1f')](_0x76dd71);}};}function respondWithFilteredResult(_0x3da209,_0x3ecbb3){return function(_0x270385){if(_0x270385){var _0x1cae04=typeof _0x3ecbb3[_0xdbeb('0x20')]===_0xdbeb('0x21')&&typeof _0x3ecbb3[_0xdbeb('0x22')]===_0xdbeb('0x21');var _0x2aadab=_0x270385['count'];var _0x44e6e9=_0x1cae04?0x0:_0x3ecbb3[_0xdbeb('0x20')];var _0x14ab46=_0x1cae04?_0x270385[_0xdbeb('0x23')]:_0x3ecbb3['offset']+_0x3ecbb3['limit'];var _0x471d80;if(_0x14ab46>=_0x2aadab){_0x14ab46=_0x2aadab;_0x471d80=0xc8;}else{_0x471d80=0xce;}_0x3da209[_0xdbeb('0x1d')](_0x471d80);return _0x3da209['set'](_0xdbeb('0x24'),_0x44e6e9+'-'+_0x14ab46+'/'+_0x2aadab)['json'](_0x270385);}return null;};}function patchUpdates(_0x6d093a){return function(_0x5bb8f2){try{jsonpatch[_0xdbeb('0x25')](_0x5bb8f2,_0x6d093a,!![]);}catch(_0x3abe93){return BPromise['reject'](_0x3abe93);}return _0x5bb8f2[_0xdbeb('0x26')]();};}function saveUpdates(_0x187c6e,_0x289938){return function(_0xd287a3){if(_0xd287a3){return _0xd287a3[_0xdbeb('0x27')](_0x187c6e)[_0xdbeb('0x28')](function(_0x496a63){return _0x496a63;});}return null;};}function removeEntity(_0xb0ace3,_0x5b3247){return function(_0x77990){if(_0x77990){return _0x77990[_0xdbeb('0x29')]()[_0xdbeb('0x28')](function(){_0xb0ace3[_0xdbeb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2455f8,_0x42d2c7){return function(_0x57dc4f){if(!_0x57dc4f){_0x2455f8[_0xdbeb('0x1c')](0x194);}return _0x57dc4f;};}function handleError(_0x1d6dba,_0x532317){_0x532317=_0x532317||0x1f4;return function(_0x1e554a){logger[_0xdbeb('0x2a')](_0x1e554a[_0xdbeb('0x2b')]);if(_0x1e554a[_0xdbeb('0x2c')]){delete _0x1e554a['name'];}_0x1d6dba['status'](_0x532317)[_0xdbeb('0x2d')](_0x1e554a);};}exports[_0xdbeb('0x2e')]=function(_0x46c7b2,_0x5e8cd6){var _0x47f4d7={},_0x19bc33={},_0x28a3ca={'count':0x0,'rows':[]};var _0x31a0c4=_[_0xdbeb('0x2f')](db[_0xdbeb('0x30')][_0xdbeb('0x31')],function(_0x111c28){return{'name':_0x111c28[_0xdbeb('0x32')],'type':_0x111c28[_0xdbeb('0x33')][_0xdbeb('0x34')]};});_0x19bc33['model']=_[_0xdbeb('0x2f')](_0x31a0c4,'name');_0x19bc33[_0xdbeb('0x35')]=_[_0xdbeb('0x36')](_0x46c7b2[_0xdbeb('0x35')]);_0x19bc33[_0xdbeb('0x37')]=_[_0xdbeb('0x38')](_0x19bc33['model'],_0x19bc33[_0xdbeb('0x35')]);_0x47f4d7[_0xdbeb('0x39')]=_['intersection'](_0x19bc33[_0xdbeb('0x3a')],qs[_0xdbeb('0x3b')](_0x46c7b2[_0xdbeb('0x35')][_0xdbeb('0x3b')]));_0x47f4d7[_0xdbeb('0x39')]=_0x47f4d7[_0xdbeb('0x39')]['length']?_0x47f4d7[_0xdbeb('0x39')]:_0x19bc33['model'];if(!_0x46c7b2[_0xdbeb('0x35')][_0xdbeb('0x3c')](_0xdbeb('0x3d'))){_0x47f4d7['limit']=qs[_0xdbeb('0x22')](_0x46c7b2['query'][_0xdbeb('0x22')]);_0x47f4d7['offset']=qs[_0xdbeb('0x20')](_0x46c7b2[_0xdbeb('0x35')][_0xdbeb('0x20')]);}_0x47f4d7[_0xdbeb('0x3e')]=qs['sort'](_0x46c7b2[_0xdbeb('0x35')]['sort']);_0x47f4d7[_0xdbeb('0x3f')]=qs['filters'](_[_0xdbeb('0x40')](_0x46c7b2[_0xdbeb('0x35')],_0x19bc33[_0xdbeb('0x37')]),_0x31a0c4);if(_0x46c7b2[_0xdbeb('0x35')][_0xdbeb('0x41')]){_0x47f4d7[_0xdbeb('0x3f')]=_[_0xdbeb('0x42')](_0x47f4d7[_0xdbeb('0x3f')],{'$or':_['map'](_0x31a0c4,function(_0x450b83){if(_0x450b83['type']!==_0xdbeb('0x43')){var _0x4afc90={};_0x4afc90[_0x450b83[_0xdbeb('0x2c')]]={'$like':'%'+_0x46c7b2[_0xdbeb('0x35')][_0xdbeb('0x41')]+'%'};return _0x4afc90;}})});}_0x47f4d7=_[_0xdbeb('0x42')]({},_0x47f4d7,_0x46c7b2[_0xdbeb('0x44')]);var _0x4262fb={'where':_0x47f4d7[_0xdbeb('0x3f')]};return db['VoiceQueueReport'][_0xdbeb('0x23')](_0x4262fb)[_0xdbeb('0x28')](function(_0x5576e1){_0x28a3ca[_0xdbeb('0x23')]=_0x5576e1;if(_0x46c7b2['query'][_0xdbeb('0x45')]){_0x47f4d7['include']=[{'all':!![]}];}return db[_0xdbeb('0x30')][_0xdbeb('0x46')](_0x47f4d7);})[_0xdbeb('0x28')](function(_0xf1acaf){_0x28a3ca[_0xdbeb('0x47')]=_0xf1acaf;return _0x28a3ca;})[_0xdbeb('0x28')](respondWithFilteredResult(_0x5e8cd6,_0x47f4d7))['catch'](handleError(_0x5e8cd6,null));};exports[_0xdbeb('0x48')]=function(_0x6bc1a2,_0x71c401){var _0x33e33e={'raw':![],'where':{'id':_0x6bc1a2['params']['id']}},_0x450fec={};_0x450fec[_0xdbeb('0x3a')]=_[_0xdbeb('0x36')](db[_0xdbeb('0x30')][_0xdbeb('0x31')]);_0x450fec['query']=_[_0xdbeb('0x36')](_0x6bc1a2[_0xdbeb('0x35')]);_0x450fec['filters']=_[_0xdbeb('0x38')](_0x450fec['model'],_0x450fec[_0xdbeb('0x35')]);_0x33e33e[_0xdbeb('0x39')]=_[_0xdbeb('0x38')](_0x450fec['model'],qs[_0xdbeb('0x3b')](_0x6bc1a2[_0xdbeb('0x35')][_0xdbeb('0x3b')]));_0x33e33e[_0xdbeb('0x39')]=_0x33e33e[_0xdbeb('0x39')][_0xdbeb('0x49')]?_0x33e33e[_0xdbeb('0x39')]:_0x450fec[_0xdbeb('0x3a')];if(_0x6bc1a2[_0xdbeb('0x35')][_0xdbeb('0x45')]){_0x33e33e[_0xdbeb('0x4a')]=[{'all':!![]}];}_0x33e33e=_[_0xdbeb('0x42')]({},_0x33e33e,_0x6bc1a2[_0xdbeb('0x44')]);return db[_0xdbeb('0x30')]['find'](_0x33e33e)[_0xdbeb('0x28')](handleEntityNotFound(_0x71c401,null))[_0xdbeb('0x28')](respondWithResult(_0x71c401,null))['catch'](handleError(_0x71c401,null));};exports[_0xdbeb('0x4b')]=function(_0xb548cc,_0x537d6f){return db[_0xdbeb('0x30')][_0xdbeb('0x4b')](_0xb548cc[_0xdbeb('0x4c')],{})['then'](respondWithResult(_0x537d6f,0xc9))[_0xdbeb('0x4d')](handleError(_0x537d6f,null));};exports[_0xdbeb('0x27')]=function(_0x4942b4,_0x332f55){if(_0x4942b4[_0xdbeb('0x4c')]['id']){delete _0x4942b4[_0xdbeb('0x4c')]['id'];}return db[_0xdbeb('0x30')][_0xdbeb('0x4e')]({'where':{'id':_0x4942b4['params']['id']}})[_0xdbeb('0x28')](handleEntityNotFound(_0x332f55,null))[_0xdbeb('0x28')](saveUpdates(_0x4942b4[_0xdbeb('0x4c')],null))[_0xdbeb('0x28')](respondWithResult(_0x332f55,null))[_0xdbeb('0x4d')](handleError(_0x332f55,null));};exports[_0xdbeb('0x29')]=function(_0x7a39f6,_0x43c60e){return db[_0xdbeb('0x30')][_0xdbeb('0x4e')]({'where':{'id':_0x7a39f6[_0xdbeb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x43c60e,null))[_0xdbeb('0x28')](removeEntity(_0x43c60e,null))[_0xdbeb('0x4d')](handleError(_0x43c60e,null));};exports[_0xdbeb('0x50')]=function(_0x102b87,_0x104540){return db['VoiceQueueReport']['describe']()[_0xdbeb('0x28')](respondWithResult(_0x104540,null))[_0xdbeb('0x4d')](handleError(_0x104540,null));};exports['getVoiceQueuesReport']=function(_0x1ad161,_0x5a5544){var _0x2e89a6={},_0xad91cc={},_0x23804f={'count':0x0,'rows':[]};_0xad91cc['model']=_[_0xdbeb('0x36')](db[_0xdbeb('0x30')]['rawAttributes']);_0xad91cc[_0xdbeb('0x35')]=_[_0xdbeb('0x36')](_0x1ad161[_0xdbeb('0x35')]);_0xad91cc['filters']=_[_0xdbeb('0x38')](_0xad91cc[_0xdbeb('0x3a')],_0xad91cc[_0xdbeb('0x35')]);_0x2e89a6[_0xdbeb('0x39')]=_['intersection'](_0xad91cc[_0xdbeb('0x3a')],qs[_0xdbeb('0x3b')](_0x1ad161[_0xdbeb('0x35')][_0xdbeb('0x3b')]));_0x2e89a6['attributes']=_0x2e89a6['attributes'][_0xdbeb('0x49')]?_0x2e89a6[_0xdbeb('0x39')]:_0xad91cc[_0xdbeb('0x3a')];if(!_0x1ad161[_0xdbeb('0x35')]['hasOwnProperty'](_0xdbeb('0x3d'))){_0x2e89a6[_0xdbeb('0x22')]=qs[_0xdbeb('0x22')](_0x1ad161[_0xdbeb('0x35')]['limit']);_0x2e89a6[_0xdbeb('0x20')]=qs[_0xdbeb('0x20')](_0x1ad161[_0xdbeb('0x35')]['offset']);}_0x2e89a6['order']=qs[_0xdbeb('0x51')](_0x1ad161[_0xdbeb('0x35')][_0xdbeb('0x51')]);_0x2e89a6[_0xdbeb('0x3f')]=qs['filters'](_[_0xdbeb('0x40')](_0x1ad161[_0xdbeb('0x35')],_0xad91cc[_0xdbeb('0x37')]));if(_0x1ad161[_0xdbeb('0x35')][_0xdbeb('0x41')]){_0x2e89a6[_0xdbeb('0x3f')]=_[_0xdbeb('0x42')](_0x2e89a6[_0xdbeb('0x3f')],{'$or':_[_0xdbeb('0x2f')](_0x2e89a6[_0xdbeb('0x39')],function(_0x15dc68){var _0x558ab7={};_0x558ab7[_0x15dc68]={'$like':'%'+_0x1ad161[_0xdbeb('0x35')][_0xdbeb('0x41')]+'%'};return _0x558ab7;})});}_0x2e89a6=_[_0xdbeb('0x42')]({},_0x2e89a6,_0x1ad161['options']);var _0x141fe3={'where':_0x2e89a6[_0xdbeb('0x3f')]};return db['VoiceQueueReport'][_0xdbeb('0x23')](_0x141fe3)[_0xdbeb('0x28')](function(_0x5f5138){_0x23804f[_0xdbeb('0x23')]=_0x5f5138;if(_0x1ad161[_0xdbeb('0x35')][_0xdbeb('0x45')]){_0x2e89a6[_0xdbeb('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xdbeb('0x46')](_0x2e89a6);})[_0xdbeb('0x28')](function(_0x4dea25){_0x23804f[_0xdbeb('0x47')]=_0x4dea25;return _0x23804f;})[_0xdbeb('0x28')](respondWithFilteredResult(_0x5a5544,_0x2e89a6,_0xdbeb('0x52')))['catch'](handleError(_0x5a5544,null,_0xdbeb('0x52')));}; \ No newline at end of file +var _0x95dc=['request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','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','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','length','find','catch','create','body','describe','findAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4ab8d3,_0x242916){var _0x347819=function(_0x19356c){while(--_0x19356c){_0x4ab8d3['push'](_0x4ab8d3['shift']());}};_0x347819(++_0x242916);}(_0x95dc,0xa0));var _0xc95d=function(_0xe65c25,_0x4786e0){_0xe65c25=_0xe65c25-0x0;var _0x43cfc4=_0x95dc[_0xe65c25];return _0x43cfc4;};'use strict';var emlformat=require(_0xc95d('0x0'));var rimraf=require(_0xc95d('0x1'));var zipdir=require(_0xc95d('0x2'));var jsonpatch=require(_0xc95d('0x3'));var rp=require(_0xc95d('0x4'));var moment=require('moment');var BPromise=require(_0xc95d('0x5'));var Mustache=require('mustache');var util=require(_0xc95d('0x6'));var path=require(_0xc95d('0x7'));var sox=require('sox');var csv=require(_0xc95d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc95d('0x9'));var _=require(_0xc95d('0xa'));var squel=require(_0xc95d('0xb'));var crypto=require('crypto');var jsforce=require(_0xc95d('0xc'));var deskjs=require(_0xc95d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc95d('0xe'));var Papa=require(_0xc95d('0xf'));var Redis=require(_0xc95d('0x10'));var authService=require(_0xc95d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc95d('0x12'));var hardwareService=require(_0xc95d('0x13'));var logger=require(_0xc95d('0x14'))('api');var utils=require(_0xc95d('0x15'));var config=require(_0xc95d('0x16'));var licenseUtil=require(_0xc95d('0x17'));var db=require(_0xc95d('0x18'))['db'];config['redis']=_['defaults'](config[_0xc95d('0x19')],{'host':_0xc95d('0x1a'),'port':0x18eb});var socket=require(_0xc95d('0x1b'))(new Redis(config[_0xc95d('0x19')]));require(_0xc95d('0x1c'))[_0xc95d('0x1d')](socket);function respondWithStatusCode(_0x32ea1d,_0x44a324){_0x44a324=_0x44a324||0xcc;return function(_0x3544d9){if(_0x3544d9){return _0x32ea1d['sendStatus'](_0x44a324);}return _0x32ea1d[_0xc95d('0x1e')](_0x44a324)['end']();};}function respondWithResult(_0x1f75fb,_0x460fc8){_0x460fc8=_0x460fc8||0xc8;return function(_0x1165da){if(_0x1165da){return _0x1f75fb[_0xc95d('0x1e')](_0x460fc8)[_0xc95d('0x1f')](_0x1165da);}};}function respondWithFilteredResult(_0x5a6857,_0x1eb5fa){return function(_0x3853f2){if(_0x3853f2){var _0x2021cc=typeof _0x1eb5fa['offset']===_0xc95d('0x20')&&typeof _0x1eb5fa[_0xc95d('0x21')]===_0xc95d('0x20');var _0x5cebd8=_0x3853f2[_0xc95d('0x22')];var _0x58f096=_0x2021cc?0x0:_0x1eb5fa['offset'];var _0x160000=_0x2021cc?_0x3853f2[_0xc95d('0x22')]:_0x1eb5fa[_0xc95d('0x23')]+_0x1eb5fa[_0xc95d('0x21')];var _0x4c2b92;if(_0x160000>=_0x5cebd8){_0x160000=_0x5cebd8;_0x4c2b92=0xc8;}else{_0x4c2b92=0xce;}_0x5a6857[_0xc95d('0x1e')](_0x4c2b92);return _0x5a6857['set'](_0xc95d('0x24'),_0x58f096+'-'+_0x160000+'/'+_0x5cebd8)[_0xc95d('0x1f')](_0x3853f2);}return null;};}function patchUpdates(_0x12376f){return function(_0x491723){try{jsonpatch[_0xc95d('0x25')](_0x491723,_0x12376f,!![]);}catch(_0x440ddd){return BPromise['reject'](_0x440ddd);}return _0x491723[_0xc95d('0x26')]();};}function saveUpdates(_0x72f921,_0x16bb67){return function(_0x56966d){if(_0x56966d){return _0x56966d[_0xc95d('0x27')](_0x72f921)[_0xc95d('0x28')](function(_0x106db2){return _0x106db2;});}return null;};}function removeEntity(_0x5688a0,_0x16ea36){return function(_0x219b97){if(_0x219b97){return _0x219b97[_0xc95d('0x29')]()[_0xc95d('0x28')](function(){_0x5688a0[_0xc95d('0x1e')](0xcc)[_0xc95d('0x2a')]();});}};}function handleEntityNotFound(_0x28809f,_0x56fc02){return function(_0x445d29){if(!_0x445d29){_0x28809f[_0xc95d('0x2b')](0x194);}return _0x445d29;};}function handleError(_0x70578b,_0x33f39d){_0x33f39d=_0x33f39d||0x1f4;return function(_0x157375){logger[_0xc95d('0x2c')](_0x157375[_0xc95d('0x2d')]);if(_0x157375[_0xc95d('0x2e')]){delete _0x157375[_0xc95d('0x2e')];}_0x70578b['status'](_0x33f39d)[_0xc95d('0x2f')](_0x157375);};}exports['index']=function(_0x38666a,_0x3ea038){var _0x978d10={},_0x1af508={},_0xe6ff65={'count':0x0,'rows':[]};var _0x8b3465=_[_0xc95d('0x30')](db[_0xc95d('0x31')][_0xc95d('0x32')],function(_0x5807ee){return{'name':_0x5807ee[_0xc95d('0x33')],'type':_0x5807ee[_0xc95d('0x34')][_0xc95d('0x35')]};});_0x1af508[_0xc95d('0x36')]=_['map'](_0x8b3465,_0xc95d('0x2e'));_0x1af508[_0xc95d('0x37')]=_['keys'](_0x38666a['query']);_0x1af508[_0xc95d('0x38')]=_[_0xc95d('0x39')](_0x1af508[_0xc95d('0x36')],_0x1af508[_0xc95d('0x37')]);_0x978d10[_0xc95d('0x3a')]=_[_0xc95d('0x39')](_0x1af508[_0xc95d('0x36')],qs[_0xc95d('0x3b')](_0x38666a[_0xc95d('0x37')][_0xc95d('0x3b')]));_0x978d10['attributes']=_0x978d10[_0xc95d('0x3a')]['length']?_0x978d10['attributes']:_0x1af508[_0xc95d('0x36')];if(!_0x38666a['query']['hasOwnProperty'](_0xc95d('0x3c'))){_0x978d10[_0xc95d('0x21')]=qs[_0xc95d('0x21')](_0x38666a[_0xc95d('0x37')][_0xc95d('0x21')]);_0x978d10[_0xc95d('0x23')]=qs[_0xc95d('0x23')](_0x38666a[_0xc95d('0x37')][_0xc95d('0x23')]);}_0x978d10[_0xc95d('0x3d')]=qs[_0xc95d('0x3e')](_0x38666a[_0xc95d('0x37')][_0xc95d('0x3e')]);_0x978d10[_0xc95d('0x3f')]=qs[_0xc95d('0x38')](_[_0xc95d('0x40')](_0x38666a[_0xc95d('0x37')],_0x1af508[_0xc95d('0x38')]),_0x8b3465);if(_0x38666a[_0xc95d('0x37')][_0xc95d('0x41')]){_0x978d10[_0xc95d('0x3f')]=_[_0xc95d('0x42')](_0x978d10[_0xc95d('0x3f')],{'$or':_[_0xc95d('0x30')](_0x8b3465,function(_0x281513){if(_0x281513[_0xc95d('0x34')]!==_0xc95d('0x43')){var _0x31389d={};_0x31389d[_0x281513['name']]={'$like':'%'+_0x38666a['query'][_0xc95d('0x41')]+'%'};return _0x31389d;}})});}_0x978d10=_[_0xc95d('0x42')]({},_0x978d10,_0x38666a[_0xc95d('0x44')]);var _0x204a2c={'where':_0x978d10[_0xc95d('0x3f')]};return db[_0xc95d('0x31')]['count'](_0x204a2c)[_0xc95d('0x28')](function(_0x597f83){_0xe6ff65[_0xc95d('0x22')]=_0x597f83;if(_0x38666a[_0xc95d('0x37')][_0xc95d('0x45')]){_0x978d10[_0xc95d('0x46')]=[{'all':!![]}];}return db[_0xc95d('0x31')]['findAll'](_0x978d10);})[_0xc95d('0x28')](function(_0xcc32c2){_0xe6ff65[_0xc95d('0x47')]=_0xcc32c2;return _0xe6ff65;})[_0xc95d('0x28')](respondWithFilteredResult(_0x3ea038,_0x978d10))['catch'](handleError(_0x3ea038,null));};exports['show']=function(_0x4a4ca3,_0x1e2b27){var _0x146313={'raw':![],'where':{'id':_0x4a4ca3[_0xc95d('0x48')]['id']}},_0x368bc1={};_0x368bc1[_0xc95d('0x36')]=_[_0xc95d('0x49')](db['VoiceQueueReport'][_0xc95d('0x32')]);_0x368bc1[_0xc95d('0x37')]=_[_0xc95d('0x49')](_0x4a4ca3['query']);_0x368bc1[_0xc95d('0x38')]=_[_0xc95d('0x39')](_0x368bc1[_0xc95d('0x36')],_0x368bc1[_0xc95d('0x37')]);_0x146313[_0xc95d('0x3a')]=_[_0xc95d('0x39')](_0x368bc1[_0xc95d('0x36')],qs[_0xc95d('0x3b')](_0x4a4ca3[_0xc95d('0x37')][_0xc95d('0x3b')]));_0x146313['attributes']=_0x146313[_0xc95d('0x3a')][_0xc95d('0x4a')]?_0x146313[_0xc95d('0x3a')]:_0x368bc1[_0xc95d('0x36')];if(_0x4a4ca3[_0xc95d('0x37')][_0xc95d('0x45')]){_0x146313[_0xc95d('0x46')]=[{'all':!![]}];}_0x146313=_[_0xc95d('0x42')]({},_0x146313,_0x4a4ca3[_0xc95d('0x44')]);return db[_0xc95d('0x31')][_0xc95d('0x4b')](_0x146313)[_0xc95d('0x28')](handleEntityNotFound(_0x1e2b27,null))[_0xc95d('0x28')](respondWithResult(_0x1e2b27,null))[_0xc95d('0x4c')](handleError(_0x1e2b27,null));};exports[_0xc95d('0x4d')]=function(_0x465577,_0x28c8e0){return db[_0xc95d('0x31')][_0xc95d('0x4d')](_0x465577[_0xc95d('0x4e')],{})['then'](respondWithResult(_0x28c8e0,0xc9))['catch'](handleError(_0x28c8e0,null));};exports['update']=function(_0x2bf419,_0x3daf4b){if(_0x2bf419[_0xc95d('0x4e')]['id']){delete _0x2bf419[_0xc95d('0x4e')]['id'];}return db[_0xc95d('0x31')][_0xc95d('0x4b')]({'where':{'id':_0x2bf419[_0xc95d('0x48')]['id']}})[_0xc95d('0x28')](handleEntityNotFound(_0x3daf4b,null))[_0xc95d('0x28')](saveUpdates(_0x2bf419[_0xc95d('0x4e')],null))[_0xc95d('0x28')](respondWithResult(_0x3daf4b,null))[_0xc95d('0x4c')](handleError(_0x3daf4b,null));};exports['destroy']=function(_0x4d4d80,_0x4e7f67){return db[_0xc95d('0x31')][_0xc95d('0x4b')]({'where':{'id':_0x4d4d80[_0xc95d('0x48')]['id']}})[_0xc95d('0x28')](handleEntityNotFound(_0x4e7f67,null))['then'](removeEntity(_0x4e7f67,null))[_0xc95d('0x4c')](handleError(_0x4e7f67,null));};exports[_0xc95d('0x4f')]=function(_0x5f20bf,_0x4d9eaf){return db[_0xc95d('0x31')][_0xc95d('0x4f')]()[_0xc95d('0x28')](respondWithResult(_0x4d9eaf,null))[_0xc95d('0x4c')](handleError(_0x4d9eaf,null));};exports['getVoiceQueuesReport']=function(_0x485e14,_0x38e25c){var _0x3d872c={},_0x521e05={},_0x16008f={'count':0x0,'rows':[]};_0x521e05[_0xc95d('0x36')]=_[_0xc95d('0x49')](db['VoiceQueueReport'][_0xc95d('0x32')]);_0x521e05[_0xc95d('0x37')]=_[_0xc95d('0x49')](_0x485e14[_0xc95d('0x37')]);_0x521e05['filters']=_[_0xc95d('0x39')](_0x521e05['model'],_0x521e05[_0xc95d('0x37')]);_0x3d872c['attributes']=_[_0xc95d('0x39')](_0x521e05[_0xc95d('0x36')],qs[_0xc95d('0x3b')](_0x485e14[_0xc95d('0x37')][_0xc95d('0x3b')]));_0x3d872c[_0xc95d('0x3a')]=_0x3d872c['attributes']['length']?_0x3d872c[_0xc95d('0x3a')]:_0x521e05[_0xc95d('0x36')];if(!_0x485e14['query']['hasOwnProperty'](_0xc95d('0x3c'))){_0x3d872c[_0xc95d('0x21')]=qs[_0xc95d('0x21')](_0x485e14[_0xc95d('0x37')][_0xc95d('0x21')]);_0x3d872c[_0xc95d('0x23')]=qs['offset'](_0x485e14[_0xc95d('0x37')][_0xc95d('0x23')]);}_0x3d872c[_0xc95d('0x3d')]=qs[_0xc95d('0x3e')](_0x485e14[_0xc95d('0x37')][_0xc95d('0x3e')]);_0x3d872c[_0xc95d('0x3f')]=qs[_0xc95d('0x38')](_[_0xc95d('0x40')](_0x485e14[_0xc95d('0x37')],_0x521e05[_0xc95d('0x38')]));if(_0x485e14['query'][_0xc95d('0x41')]){_0x3d872c[_0xc95d('0x3f')]=_['merge'](_0x3d872c[_0xc95d('0x3f')],{'$or':_[_0xc95d('0x30')](_0x3d872c['attributes'],function(_0x5818ef){var _0xcf6962={};_0xcf6962[_0x5818ef]={'$like':'%'+_0x485e14[_0xc95d('0x37')][_0xc95d('0x41')]+'%'};return _0xcf6962;})});}_0x3d872c=_['merge']({},_0x3d872c,_0x485e14[_0xc95d('0x44')]);var _0x282983={'where':_0x3d872c[_0xc95d('0x3f')]};return db[_0xc95d('0x31')][_0xc95d('0x22')](_0x282983)[_0xc95d('0x28')](function(_0xc8b507){_0x16008f[_0xc95d('0x22')]=_0xc8b507;if(_0x485e14[_0xc95d('0x37')][_0xc95d('0x45')]){_0x3d872c[_0xc95d('0x46')]=[{'all':!![]}];}return db[_0xc95d('0x31')][_0xc95d('0x50')](_0x3d872c);})[_0xc95d('0x28')](function(_0x5e5216){_0x16008f['rows']=_0x5e5216;return _0x16008f;})[_0xc95d('0x28')](respondWithFilteredResult(_0x38e25c,_0x3d872c,_0xc95d('0x51')))['catch'](handleError(_0x38e25c,null,_0xc95d('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ada0a4c..cb46ee7 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 _0x0c07=['hook','exports','events','../../mysqldb','save','update','emit'];(function(_0xc43f28,_0x1ba36d){var _0xc33e50=function(_0x185740){while(--_0x185740){_0xc43f28['push'](_0xc43f28['shift']());}};_0xc33e50(++_0x1ba36d);}(_0x0c07,0x9c));var _0x70c0=function(_0x5e84bd,_0xd485f7){_0x5e84bd=_0x5e84bd-0x0;var _0x110526=_0x0c07[_0x5e84bd];return _0x110526;};'use strict';var EventEmitter=require(_0x70c0('0x0'));var VoiceQueueReport=require(_0x70c0('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x70c0('0x2'),'afterUpdate':_0x70c0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x146ac6){return function(_0x519e5a,_0x395f0f,_0x4447d7){VoiceQueueReportEvents[_0x70c0('0x4')](_0x146ac6+':'+_0x519e5a['id'],_0x519e5a);VoiceQueueReportEvents[_0x70c0('0x4')](_0x146ac6,_0x519e5a);_0x4447d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x70c0('0x5')](e,emitEvent(event));}}module[_0x70c0('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x3cdd=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x33e4a7,_0x2e80a2){var _0x598620=function(_0x65d618){while(--_0x65d618){_0x33e4a7['push'](_0x33e4a7['shift']());}};_0x598620(++_0x2e80a2);}(_0x3cdd,0xa4));var _0xd3cd=function(_0x1c857f,_0x4b957e){_0x1c857f=_0x1c857f-0x0;var _0x30667f=_0x3cdd[_0x1c857f];return _0x30667f;};'use strict';var EventEmitter=require(_0xd3cd('0x0'));var VoiceQueueReport=require(_0xd3cd('0x1'))['db'][_0xd3cd('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd3cd('0x3')](0x0);var events={'afterCreate':_0xd3cd('0x4'),'afterUpdate':_0xd3cd('0x5'),'afterDestroy':_0xd3cd('0x6')};function emitEvent(_0x226241){return function(_0x3c7a4c,_0x2eaf8e,_0x193850){VoiceQueueReportEvents[_0xd3cd('0x7')](_0x226241+':'+_0x3c7a4c['id'],_0x3c7a4c);VoiceQueueReportEvents[_0xd3cd('0x7')](_0x226241,_0x3c7a4c);_0x193850(null);};}for(var e in events){if(events[_0xd3cd('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xd3cd('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8c175ff..acdf954 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 _0x6666=['request-promise','path','rimraf','../../config/environment','define','report_queue','uniqueid','lodash','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6666,0xa0));var _0x6666=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x6666[_0x571c1d];return _0x33c609;};'use strict';var _=require(_0x6666('0x0'));var util=require('util');var logger=require(_0x6666('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6666('0x2'));var fs=require('fs');var path=require(_0x6666('0x3'));var rimraf=require(_0x6666('0x4'));var config=require(_0x6666('0x5'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x20e63c,_0xa8f0ed){return _0x20e63c[_0x6666('0x6')]('VoiceQueueReport',attributes,{'tableName':_0x6666('0x7'),'paranoid':![],'indexes':[{'fields':[_0x6666('0x8')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x993e=['../../config/environment','exports','define','VoiceQueueReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1c5fa1,_0x438dc2){var _0x1960e8=function(_0x428587){while(--_0x428587){_0x1c5fa1['push'](_0x1c5fa1['shift']());}};_0x1960e8(++_0x438dc2);}(_0x993e,0xa1));var _0xe993=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x993e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe993('0x0'));var util=require(_0xe993('0x1'));var logger=require(_0xe993('0x2'))(_0xe993('0x3'));var moment=require('moment');var BPromise=require(_0xe993('0x4'));var rp=require(_0xe993('0x5'));var fs=require('fs');var path=require(_0xe993('0x6'));var rimraf=require(_0xe993('0x7'));var config=require(_0xe993('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0xe993('0x9')]=function(_0x449882,_0x32c67b){return _0x449882[_0xe993('0xa')](_0xe993('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe993('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6eea5bf..002daad 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 _0xa7d7=['where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','raw'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0xa7d7,0x139));var _0x7a7d=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xa7d7[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var moment=require(_0x7a7d('0x2'));var BPromise=require(_0x7a7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a7d('0x4'));var db=require(_0x7a7d('0x5'))['db'];var utils=require(_0x7a7d('0x6'));var logger=require('../../config/logger')(_0x7a7d('0x7'));var config=require(_0x7a7d('0x8'));var jayson=require(_0x7a7d('0x9'));var client=jayson[_0x7a7d('0xa')]['http']({'port':0x232a});config[_0x7a7d('0xb')]=_[_0x7a7d('0xc')](config[_0x7a7d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a7d('0xd'))(new Redis(config[_0x7a7d('0xb')]));require(_0x7a7d('0xe'))[_0x7a7d('0xf')](socket);function respondWithRpcPromise(_0x4fa4da,_0x276977,_0x182ef0){return new BPromise(function(_0x365710,_0x5c4ddb){return client[_0x7a7d('0x10')](_0x4fa4da,_0x182ef0)[_0x7a7d('0x11')](function(_0x5b1193){logger[_0x7a7d('0x12')](_0x7a7d('0x13'),_0x276977,_0x7a7d('0x14'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x276977,'request\x20sent',JSON[_0x7a7d('0x15')](_0x5b1193));if(_0x5b1193[_0x7a7d('0x16')]){if(_0x5b1193[_0x7a7d('0x16')][_0x7a7d('0x17')]===0x1f4){logger[_0x7a7d('0x16')](_0x7a7d('0x13'),_0x276977,_0x5b1193[_0x7a7d('0x16')][_0x7a7d('0x18')]);return _0x5c4ddb(_0x5b1193[_0x7a7d('0x16')][_0x7a7d('0x18')]);}logger[_0x7a7d('0x16')](_0x7a7d('0x13'),_0x276977,_0x5b1193['error'][_0x7a7d('0x18')]);return _0x365710(_0x5b1193['error'][_0x7a7d('0x18')]);}else{logger[_0x7a7d('0x12')](_0x7a7d('0x13'),_0x276977,_0x7a7d('0x14'));_0x365710(_0x5b1193[_0x7a7d('0x19')][_0x7a7d('0x18')]);}})[_0x7a7d('0x1a')](function(_0x1db62b){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x276977,_0x1db62b);_0x5c4ddb(_0x1db62b);});});}exports['GetVoiceQueueReport']=function(_0x5a1194){var _0x3d7993=this;return new Promise(function(_0xd2cb0a,_0x527d54){return db[_0x7a7d('0x1b')][_0x7a7d('0x1c')]({'raw':_0x5a1194[_0x7a7d('0x1d')]?_0x5a1194[_0x7a7d('0x1d')][_0x7a7d('0x1e')]===undefined?!![]:![]:!![],'where':_0x5a1194[_0x7a7d('0x1d')]?_0x5a1194[_0x7a7d('0x1d')][_0x7a7d('0x1f')]||null:null,'attributes':_0x5a1194['options']?_0x5a1194[_0x7a7d('0x1d')][_0x7a7d('0x20')]||null:null,'limit':_0x5a1194[_0x7a7d('0x1d')]?_0x5a1194[_0x7a7d('0x1d')][_0x7a7d('0x21')]||null:null,'include':_0x5a1194[_0x7a7d('0x1d')]?_0x5a1194['options'][_0x7a7d('0x22')]?_[_0x7a7d('0x23')](_0x5a1194['options'][_0x7a7d('0x22')],function(_0x596741){return{'model':db[_0x596741[_0x7a7d('0x24')]],'as':_0x596741['as'],'attributes':_0x596741[_0x7a7d('0x20')],'include':_0x596741[_0x7a7d('0x22')]?_[_0x7a7d('0x23')](_0x596741[_0x7a7d('0x22')],function(_0x531518){return{'model':db[_0x531518['model']],'as':_0x531518['as'],'attributes':_0x531518[_0x7a7d('0x20')],'include':_0x531518['include']?_[_0x7a7d('0x23')](_0x531518[_0x7a7d('0x22')],function(_0xe8b93d){return{'model':db[_0xe8b93d[_0x7a7d('0x24')]],'as':_0xe8b93d['as'],'attributes':_0xe8b93d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a7d('0x11')](function(_0x534fde){logger['info']('GetVoiceQueueReport',_0x5a1194);logger['debug'](_0x7a7d('0x25'),_0x5a1194,JSON[_0x7a7d('0x15')](_0x534fde));_0xd2cb0a(_0x534fde);})[_0x7a7d('0x1a')](function(_0x6a3aa4){logger[_0x7a7d('0x16')](_0x7a7d('0x25'),_0x6a3aa4['message'],_0x5a1194);_0x527d54(_0x3d7993[_0x7a7d('0x16')](0x1f4,_0x6a3aa4['message']));});});};exports[_0x7a7d('0x26')]=function(_0x182a4b){var _0x553619=this;return new Promise(function(_0x251d46,_0x58e1a6){return db[_0x7a7d('0x1b')]['create'](_0x182a4b[_0x7a7d('0x27')],{'raw':_0x182a4b['options']?_0x182a4b[_0x7a7d('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x7a7d('0x11')](function(_0x4533a9){logger[_0x7a7d('0x12')](_0x7a7d('0x26'),_0x182a4b);logger['debug'](_0x7a7d('0x26'),_0x182a4b,JSON[_0x7a7d('0x15')](_0x4533a9));_0x251d46(_0x4533a9);})[_0x7a7d('0x1a')](function(_0xadcc92){logger[_0x7a7d('0x16')](_0x7a7d('0x26'),_0xadcc92[_0x7a7d('0x18')],_0x182a4b);_0x58e1a6(_0x553619[_0x7a7d('0x16')](0x1f4,_0xadcc92[_0x7a7d('0x18')]));});});};exports[_0x7a7d('0x28')]=function(_0x3db946){var _0x3fdba0=this;return new Promise(function(_0x2bdd5a,_0x3ab577){return db[_0x7a7d('0x1b')][_0x7a7d('0x29')](_0x3db946['body'],{'raw':_0x3db946[_0x7a7d('0x1d')]?_0x3db946['options'][_0x7a7d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3db946[_0x7a7d('0x1d')]?_0x3db946['options'][_0x7a7d('0x1f')]||null:null,'attributes':_0x3db946[_0x7a7d('0x1d')]?_0x3db946['options'][_0x7a7d('0x20')]||null:null,'limit':_0x3db946[_0x7a7d('0x1d')]?_0x3db946[_0x7a7d('0x1d')][_0x7a7d('0x21')]||null:null})['then'](function(_0x2213ba){logger[_0x7a7d('0x12')](_0x7a7d('0x28'),_0x3db946);logger[_0x7a7d('0x2a')](_0x7a7d('0x28'),_0x3db946,JSON[_0x7a7d('0x15')](_0x2213ba));_0x2bdd5a(_0x2213ba);})[_0x7a7d('0x1a')](function(_0x52591d){logger['error']('UpdateVoiceQueueReport',_0x52591d[_0x7a7d('0x18')],_0x3db946);_0x3ab577(_0x3fdba0[_0x7a7d('0x16')](0x1f4,_0x52591d[_0x7a7d('0x18')]));});});}; \ No newline at end of file +var _0xb6f6=['redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b440c,_0x4d9678){var _0x562257=function(_0x595a9c){while(--_0x595a9c){_0x3b440c['push'](_0x3b440c['shift']());}};_0x562257(++_0x4d9678);}(_0xb6f6,0xf2));var _0x6b6f=function(_0x53beef,_0x52f917){_0x53beef=_0x53beef-0x0;var _0xd6dc85=_0xb6f6[_0x53beef];return _0xd6dc85;};'use strict';var _=require(_0x6b6f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b6f('0x1'));var rs=require(_0x6b6f('0x2'));var fs=require('fs');var Redis=require(_0x6b6f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b6f('0x4'));var logger=require(_0x6b6f('0x5'))(_0x6b6f('0x6'));var config=require(_0x6b6f('0x7'));var jayson=require(_0x6b6f('0x8'));var client=jayson['client'][_0x6b6f('0x9')]({'port':0x232a});config[_0x6b6f('0xa')]=_[_0x6b6f('0xb')](config['redis'],{'host':_0x6b6f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b6f('0xa')]));require(_0x6b6f('0xd'))[_0x6b6f('0xe')](socket);function respondWithRpcPromise(_0x130a0b,_0x4bd145,_0x5c3d95){return new BPromise(function(_0xcd9008,_0x4e80b3){return client[_0x6b6f('0xf')](_0x130a0b,_0x5c3d95)[_0x6b6f('0x10')](function(_0x3ee3f9){logger[_0x6b6f('0x11')](_0x6b6f('0x12'),_0x4bd145,'request\x20sent');logger[_0x6b6f('0x13')](_0x6b6f('0x14'),_0x4bd145,_0x6b6f('0x15'),JSON[_0x6b6f('0x16')](_0x3ee3f9));if(_0x3ee3f9[_0x6b6f('0x17')]){if(_0x3ee3f9[_0x6b6f('0x17')][_0x6b6f('0x18')]===0x1f4){logger[_0x6b6f('0x17')](_0x6b6f('0x12'),_0x4bd145,_0x3ee3f9[_0x6b6f('0x17')][_0x6b6f('0x19')]);return _0x4e80b3(_0x3ee3f9[_0x6b6f('0x17')]['message']);}logger[_0x6b6f('0x17')](_0x6b6f('0x12'),_0x4bd145,_0x3ee3f9['error'][_0x6b6f('0x19')]);return _0xcd9008(_0x3ee3f9[_0x6b6f('0x17')][_0x6b6f('0x19')]);}else{logger[_0x6b6f('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x4bd145,_0x6b6f('0x15'));_0xcd9008(_0x3ee3f9['result'][_0x6b6f('0x19')]);}})[_0x6b6f('0x1a')](function(_0x381653){logger[_0x6b6f('0x17')](_0x6b6f('0x12'),_0x4bd145,_0x381653);_0x4e80b3(_0x381653);});});}exports[_0x6b6f('0x1b')]=function(_0x500faa){var _0x2a83c8=this;return new Promise(function(_0x94a088,_0xdf3931){return db[_0x6b6f('0x1c')][_0x6b6f('0x1d')]({'raw':_0x500faa[_0x6b6f('0x1e')]?_0x500faa[_0x6b6f('0x1e')][_0x6b6f('0x1f')]===undefined?!![]:![]:!![],'where':_0x500faa[_0x6b6f('0x1e')]?_0x500faa[_0x6b6f('0x1e')][_0x6b6f('0x20')]||null:null,'attributes':_0x500faa['options']?_0x500faa[_0x6b6f('0x1e')][_0x6b6f('0x21')]||null:null,'limit':_0x500faa[_0x6b6f('0x1e')]?_0x500faa[_0x6b6f('0x1e')][_0x6b6f('0x22')]||null:null,'include':_0x500faa[_0x6b6f('0x1e')]?_0x500faa[_0x6b6f('0x1e')]['include']?_[_0x6b6f('0x23')](_0x500faa[_0x6b6f('0x1e')][_0x6b6f('0x24')],function(_0xbf420d){return{'model':db[_0xbf420d['model']],'as':_0xbf420d['as'],'attributes':_0xbf420d['attributes'],'include':_0xbf420d[_0x6b6f('0x24')]?_[_0x6b6f('0x23')](_0xbf420d[_0x6b6f('0x24')],function(_0x22396f){return{'model':db[_0x22396f[_0x6b6f('0x25')]],'as':_0x22396f['as'],'attributes':_0x22396f[_0x6b6f('0x21')],'include':_0x22396f[_0x6b6f('0x24')]?_['map'](_0x22396f[_0x6b6f('0x24')],function(_0x33e99e){return{'model':db[_0x33e99e['model']],'as':_0x33e99e['as'],'attributes':_0x33e99e[_0x6b6f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6b6f('0x10')](function(_0x21c06a){logger[_0x6b6f('0x11')](_0x6b6f('0x1b'),_0x500faa);logger[_0x6b6f('0x13')]('GetVoiceQueueReport',_0x500faa,JSON['stringify'](_0x21c06a));_0x94a088(_0x21c06a);})[_0x6b6f('0x1a')](function(_0x4c611e){logger[_0x6b6f('0x17')](_0x6b6f('0x1b'),_0x4c611e[_0x6b6f('0x19')],_0x500faa);_0xdf3931(_0x2a83c8[_0x6b6f('0x17')](0x1f4,_0x4c611e[_0x6b6f('0x19')]));});});};exports[_0x6b6f('0x26')]=function(_0x44e6c8){var _0x46c512=this;return new Promise(function(_0x489b1c,_0x4b69e7){return db[_0x6b6f('0x1c')]['create'](_0x44e6c8[_0x6b6f('0x27')],{'raw':_0x44e6c8[_0x6b6f('0x1e')]?_0x44e6c8[_0x6b6f('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x6b6f('0x10')](function(_0x6581bf){logger[_0x6b6f('0x11')]('CreateVoiceQueueReport',_0x44e6c8);logger[_0x6b6f('0x13')](_0x6b6f('0x26'),_0x44e6c8,JSON[_0x6b6f('0x16')](_0x6581bf));_0x489b1c(_0x6581bf);})['catch'](function(_0x25fed4){logger[_0x6b6f('0x17')](_0x6b6f('0x26'),_0x25fed4['message'],_0x44e6c8);_0x4b69e7(_0x46c512[_0x6b6f('0x17')](0x1f4,_0x25fed4[_0x6b6f('0x19')]));});});};exports[_0x6b6f('0x28')]=function(_0x5356dd){var _0x593957=this;return new Promise(function(_0x50de63,_0x3882f9){return db['VoiceQueueReport'][_0x6b6f('0x29')](_0x5356dd['body'],{'raw':_0x5356dd[_0x6b6f('0x1e')]?_0x5356dd[_0x6b6f('0x1e')][_0x6b6f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5356dd[_0x6b6f('0x1e')]?_0x5356dd[_0x6b6f('0x1e')][_0x6b6f('0x20')]||null:null,'attributes':_0x5356dd[_0x6b6f('0x1e')]?_0x5356dd[_0x6b6f('0x1e')][_0x6b6f('0x21')]||null:null,'limit':_0x5356dd[_0x6b6f('0x1e')]?_0x5356dd[_0x6b6f('0x1e')][_0x6b6f('0x22')]||null:null})['then'](function(_0x16ee48){logger[_0x6b6f('0x11')](_0x6b6f('0x28'),_0x5356dd);logger[_0x6b6f('0x13')]('UpdateVoiceQueueReport',_0x5356dd,JSON[_0x6b6f('0x16')](_0x16ee48));_0x50de63(_0x16ee48);})['catch'](function(_0x3b1c16){logger[_0x6b6f('0x17')](_0x6b6f('0x28'),_0x3b1c16[_0x6b6f('0x19')],_0x5356dd);_0x3882f9(_0x593957['error'](0x1f4,_0x3b1c16[_0x6b6f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 7578f63..dda03dd 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14d8=['./voiceQueueReport.events','save','update','emit','register','length','voiceQueueReport:'];(function(_0x330f17,_0x3c19be){var _0x40527c=function(_0x4b9373){while(--_0x4b9373){_0x330f17['push'](_0x330f17['shift']());}};_0x40527c(++_0x3c19be);}(_0x14d8,0x19d));var _0x814d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x14d8[_0x4565bf];return _0x5610ba;};'use strict';var VoiceQueueReportEvents=require(_0x814d('0x0'));var events=[_0x814d('0x1'),'remove',_0x814d('0x2')];function createListener(_0x4e8753,_0xfff5ac){return function(_0x43d8df){_0xfff5ac[_0x814d('0x3')](_0x4e8753,_0x43d8df);};}function removeListener(_0x3e07cd,_0x18917c){return function(){VoiceQueueReportEvents['removeListener'](_0x3e07cd,_0x18917c);};}exports[_0x814d('0x4')]=function(_0x2e1be8){for(var _0x1268c9=0x0,_0x214b1b=events[_0x814d('0x5')];_0x1268c9<_0x214b1b;_0x1268c9++){var _0x3e40f3=events[_0x1268c9];var _0x434320=createListener(_0x814d('0x6')+_0x3e40f3,_0x2e1be8);VoiceQueueReportEvents['on'](_0x3e40f3,_0x434320);}}; \ No newline at end of file +var _0xa1db=['emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x26395f,_0x5e1068){var _0x153ad1=function(_0x56ae05){while(--_0x56ae05){_0x26395f['push'](_0x26395f['shift']());}};_0x153ad1(++_0x5e1068);}(_0xa1db,0xb0));var _0xba1d=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xa1db[_0x4cd690];return _0x4a74a9;};'use strict';var VoiceQueueReportEvents=require(_0xba1d('0x0'));var events=[_0xba1d('0x1'),_0xba1d('0x2'),_0xba1d('0x3')];function createListener(_0x578e63,_0x4ae0dd){return function(_0x476b7f){_0x4ae0dd[_0xba1d('0x4')](_0x578e63,_0x476b7f);};}function removeListener(_0x5c8c8b,_0x256502){return function(){VoiceQueueReportEvents[_0xba1d('0x5')](_0x5c8c8b,_0x256502);};}exports[_0xba1d('0x6')]=function(_0xf79440){for(var _0xea5887=0x0,_0x1941e6=events[_0xba1d('0x7')];_0xea5887<_0x1941e6;_0xea5887++){var _0xcf383b=events[_0xea5887];var _0x3ce8c6=createListener(_0xba1d('0x8')+_0xcf383b,_0xf79440);VoiceQueueReportEvents['on'](_0xcf383b,_0x3ce8c6);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f3e83d5..94f974b 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 _0x9ac5=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports'];(function(_0x1de2f5,_0x1b9da6){var _0x47d19b=function(_0x25b8af){while(--_0x25b8af){_0x1de2f5['push'](_0x1de2f5['shift']());}};_0x47d19b(++_0x1b9da6);}(_0x9ac5,0xdd));var _0x59ac=function(_0x565c8c,_0xedc663){_0x565c8c=_0x565c8c-0x0;var _0x1312b3=_0x9ac5[_0x565c8c];return _0x1312b3;};'use strict';var multer=require(_0x59ac('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x59ac('0x1'));var express=require(_0x59ac('0x2'));var router=express['Router']();var fs_extra=require(_0x59ac('0x3'));var auth=require(_0x59ac('0x4'));var interaction=require(_0x59ac('0x5'));var config=require(_0x59ac('0x6'));var controller=require(_0x59ac('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x59ac('0x8')](_0x59ac('0x9'),auth[_0x59ac('0xa')](),controller[_0x59ac('0xb')]);router[_0x59ac('0xc')]('/',auth[_0x59ac('0xa')](),controller['create']);router[_0x59ac('0xd')](_0x59ac('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x59ac('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x59ac('0xf')]);module[_0x59ac('0x10')]=router; \ No newline at end of file +var _0x5a8c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','multer','util'];(function(_0x231ad2,_0x3cc870){var _0xd995d=function(_0x17a831){while(--_0x17a831){_0x231ad2['push'](_0x231ad2['shift']());}};_0xd995d(++_0x3cc870);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x4525d0,_0x51701a){_0x4525d0=_0x4525d0-0x0;var _0x530fcb=_0x5a8c[_0x4525d0];return _0x530fcb;};'use strict';var multer=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var path=require('path');var timeout=require(_0xc5a8('0x2'));var express=require(_0xc5a8('0x3'));var router=express[_0xc5a8('0x4')]();var fs_extra=require(_0xc5a8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc5a8('0x6'));var config=require(_0xc5a8('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0xc5a8('0x8')]('/',auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xa')]);router[_0xc5a8('0x8')](_0xc5a8('0xb'),auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xc')]);router[_0xc5a8('0xd')]('/',auth[_0xc5a8('0x9')](),controller[_0xc5a8('0xe')]);router[_0xc5a8('0xf')]('/:id',auth[_0xc5a8('0x9')](),controller['update']);router[_0xc5a8('0x10')](_0xc5a8('0xb'),auth[_0xc5a8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 9eac88f..8eecdd6 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 _0x213f=['moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x213f,0x1c7));var _0xf213=function(_0x2c71da,_0x15c863){_0x2c71da=_0x2c71da-0x0;var _0x1481dd=_0x213f[_0x2c71da];return _0x1481dd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf213('0x0'));module[_0xf213('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xf213('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xf213('0x3')](_0xf213('0x4'))}}; \ No newline at end of file +var _0x6746=['YYYY-MM-DD\x20HH:mm:ss','sequelize','STRING','DATE','format'];(function(_0x23b2b4,_0x1af875){var _0x4918ae=function(_0x17829a){while(--_0x17829a){_0x23b2b4['push'](_0x23b2b4['shift']());}};_0x4918ae(++_0x1af875);}(_0x6746,0xb5));var _0x6674=function(_0xfb9aaa,_0x37935d){_0xfb9aaa=_0xfb9aaa-0x0;var _0x103bf7=_0x6746[_0xfb9aaa];return _0x103bf7;};'use strict';var Sequelize=require(_0x6674('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x6674('0x1')]},'callid':{'type':Sequelize[_0x6674('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6674('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6674('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6674('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6674('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6674('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6674('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6674('0x2')],'allowNull':![],'defaultValue':moment()[_0x6674('0x3')](_0x6674('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b61c95f..f7f8be1 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 _0x4d79=['../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','options','VoiceQueuesLog','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x4f9882,_0x37a058){var _0x2f5d86=function(_0x56ab9a){while(--_0x56ab9a){_0x4f9882['push'](_0x4f9882['shift']());}};_0x2f5d86(++_0x37a058);}(_0x4d79,0x72));var _0x94d7=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x4d79[_0x225f50];return _0x19d003;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94d7('0x0'));var zipdir=require(_0x94d7('0x1'));var jsonpatch=require(_0x94d7('0x2'));var rp=require(_0x94d7('0x3'));var moment=require('moment');var BPromise=require(_0x94d7('0x4'));var Mustache=require('mustache');var util=require(_0x94d7('0x5'));var path=require(_0x94d7('0x6'));var sox=require(_0x94d7('0x7'));var csv=require(_0x94d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94d7('0x9'));var _=require(_0x94d7('0xa'));var squel=require('squel');var crypto=require(_0x94d7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x94d7('0xc'));var toCsv=require(_0x94d7('0x8'));var querystring=require(_0x94d7('0xd'));var Papa=require(_0x94d7('0xe'));var Redis=require(_0x94d7('0xf'));var authService=require(_0x94d7('0x10'));var qs=require(_0x94d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94d7('0x12'));var logger=require('../../config/logger')(_0x94d7('0x13'));var utils=require('../../config/utils');var config=require(_0x94d7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b57ef,_0x554d18){_0x554d18=_0x554d18||0xcc;return function(_0x2747b1){if(_0x2747b1){return _0x4b57ef[_0x94d7('0x15')](_0x554d18);}return _0x4b57ef[_0x94d7('0x16')](_0x554d18)[_0x94d7('0x17')]();};}function respondWithResult(_0x55c881,_0x551adb){_0x551adb=_0x551adb||0xc8;return function(_0x6a59e1){if(_0x6a59e1){return _0x55c881[_0x94d7('0x16')](_0x551adb)[_0x94d7('0x18')](_0x6a59e1);}};}function respondWithFilteredResult(_0x453ee1,_0x5d02d7){return function(_0x51d52a){if(_0x51d52a){var _0x10c30d=typeof _0x5d02d7[_0x94d7('0x19')]===_0x94d7('0x1a')&&typeof _0x5d02d7[_0x94d7('0x1b')]==='undefined';var _0x4dcaeb=_0x51d52a[_0x94d7('0x1c')];var _0x1bf90c=_0x10c30d?0x0:_0x5d02d7[_0x94d7('0x19')];var _0x743617=_0x10c30d?_0x51d52a['count']:_0x5d02d7[_0x94d7('0x19')]+_0x5d02d7[_0x94d7('0x1b')];var _0x589914;if(_0x743617>=_0x4dcaeb){_0x743617=_0x4dcaeb;_0x589914=0xc8;}else{_0x589914=0xce;}_0x453ee1[_0x94d7('0x16')](_0x589914);return _0x453ee1[_0x94d7('0x1d')](_0x94d7('0x1e'),_0x1bf90c+'-'+_0x743617+'/'+_0x4dcaeb)['json'](_0x51d52a);}return null;};}function patchUpdates(_0x39e2a4){return function(_0x18ea22){try{jsonpatch['apply'](_0x18ea22,_0x39e2a4,!![]);}catch(_0x67c6e5){return BPromise['reject'](_0x67c6e5);}return _0x18ea22['save']();};}function saveUpdates(_0x1680e8,_0x32df3d){return function(_0xc197ae){if(_0xc197ae){return _0xc197ae[_0x94d7('0x1f')](_0x1680e8)[_0x94d7('0x20')](function(_0x585f17){return _0x585f17;});}return null;};}function removeEntity(_0x5cea76,_0x47fc3b){return function(_0x7439a6){if(_0x7439a6){return _0x7439a6[_0x94d7('0x21')]()[_0x94d7('0x20')](function(){_0x5cea76['status'](0xcc)[_0x94d7('0x17')]();});}};}function handleEntityNotFound(_0x199e1a,_0x1f8ecb){return function(_0x579044){if(!_0x579044){_0x199e1a[_0x94d7('0x15')](0x194);}return _0x579044;};}function handleError(_0x302f16,_0x13ea81){_0x13ea81=_0x13ea81||0x1f4;return function(_0x84cc9b){logger[_0x94d7('0x22')](_0x84cc9b[_0x94d7('0x23')]);if(_0x84cc9b['name']){delete _0x84cc9b['name'];}_0x302f16['status'](_0x13ea81)[_0x94d7('0x24')](_0x84cc9b);};}exports['index']=function(_0x527cb5,_0x1939c6){var _0x34475b={},_0x2da43c={},_0x6a14e5={'count':0x0,'rows':[]};var _0x36b7be=_[_0x94d7('0x25')](db['VoiceQueuesLog'][_0x94d7('0x26')],function(_0x5d251a){return{'name':_0x5d251a[_0x94d7('0x27')],'type':_0x5d251a[_0x94d7('0x28')]['key']};});_0x2da43c[_0x94d7('0x29')]=_['map'](_0x36b7be,_0x94d7('0x2a'));_0x2da43c[_0x94d7('0x2b')]=_['keys'](_0x527cb5[_0x94d7('0x2b')]);_0x2da43c[_0x94d7('0x2c')]=_[_0x94d7('0x2d')](_0x2da43c[_0x94d7('0x29')],_0x2da43c[_0x94d7('0x2b')]);_0x34475b[_0x94d7('0x2e')]=_['intersection'](_0x2da43c[_0x94d7('0x29')],qs[_0x94d7('0x2f')](_0x527cb5[_0x94d7('0x2b')][_0x94d7('0x2f')]));_0x34475b['attributes']=_0x34475b['attributes']['length']?_0x34475b[_0x94d7('0x2e')]:_0x2da43c[_0x94d7('0x29')];if(!_0x527cb5[_0x94d7('0x2b')][_0x94d7('0x30')]('nolimit')){_0x34475b[_0x94d7('0x1b')]=qs['limit'](_0x527cb5[_0x94d7('0x2b')][_0x94d7('0x1b')]);_0x34475b[_0x94d7('0x19')]=qs[_0x94d7('0x19')](_0x527cb5[_0x94d7('0x2b')][_0x94d7('0x19')]);}_0x34475b['order']=qs[_0x94d7('0x31')](_0x527cb5['query'][_0x94d7('0x31')]);_0x34475b['where']=qs['filters'](_[_0x94d7('0x32')](_0x527cb5[_0x94d7('0x2b')],_0x2da43c[_0x94d7('0x2c')]),_0x36b7be);if(_0x527cb5[_0x94d7('0x2b')][_0x94d7('0x33')]){_0x34475b[_0x94d7('0x34')]=_[_0x94d7('0x35')](_0x34475b[_0x94d7('0x34')],{'$or':_['map'](_0x36b7be,function(_0x2297a5){if(_0x2297a5[_0x94d7('0x28')]!=='VIRTUAL'){var _0x30a6cc={};_0x30a6cc[_0x2297a5[_0x94d7('0x2a')]]={'$like':'%'+_0x527cb5['query'][_0x94d7('0x33')]+'%'};return _0x30a6cc;}})});}_0x34475b=_[_0x94d7('0x35')]({},_0x34475b,_0x527cb5[_0x94d7('0x36')]);var _0x5d3a71={'where':_0x34475b['where']};return db[_0x94d7('0x37')][_0x94d7('0x1c')](_0x5d3a71)[_0x94d7('0x20')](function(_0x43d5c9){_0x6a14e5[_0x94d7('0x1c')]=_0x43d5c9;if(_0x527cb5[_0x94d7('0x2b')][_0x94d7('0x38')]){_0x34475b[_0x94d7('0x39')]=[{'all':!![]}];}return db[_0x94d7('0x37')][_0x94d7('0x3a')](_0x34475b);})[_0x94d7('0x20')](function(_0x1084d8){_0x6a14e5['rows']=_0x1084d8;return _0x6a14e5;})[_0x94d7('0x20')](respondWithFilteredResult(_0x1939c6,_0x34475b))[_0x94d7('0x3b')](handleError(_0x1939c6,null));};exports[_0x94d7('0x3c')]=function(_0x3c07a4,_0x4f791b){var _0xd60046={'raw':!![],'where':{'id':_0x3c07a4[_0x94d7('0x3d')]['id']}},_0x3af2d1={};_0x3af2d1[_0x94d7('0x29')]=_[_0x94d7('0x3e')](db[_0x94d7('0x37')][_0x94d7('0x26')]);_0x3af2d1['query']=_[_0x94d7('0x3e')](_0x3c07a4[_0x94d7('0x2b')]);_0x3af2d1[_0x94d7('0x2c')]=_[_0x94d7('0x2d')](_0x3af2d1[_0x94d7('0x29')],_0x3af2d1[_0x94d7('0x2b')]);_0xd60046[_0x94d7('0x2e')]=_['intersection'](_0x3af2d1[_0x94d7('0x29')],qs[_0x94d7('0x2f')](_0x3c07a4[_0x94d7('0x2b')]['fields']));_0xd60046[_0x94d7('0x2e')]=_0xd60046['attributes'][_0x94d7('0x3f')]?_0xd60046[_0x94d7('0x2e')]:_0x3af2d1[_0x94d7('0x29')];if(_0x3c07a4[_0x94d7('0x2b')][_0x94d7('0x38')]){_0xd60046[_0x94d7('0x39')]=[{'all':!![]}];}_0xd60046=_['merge']({},_0xd60046,_0x3c07a4[_0x94d7('0x36')]);return db[_0x94d7('0x37')][_0x94d7('0x40')](_0xd60046)[_0x94d7('0x20')](handleEntityNotFound(_0x4f791b,null))['then'](respondWithResult(_0x4f791b,null))['catch'](handleError(_0x4f791b,null));};exports[_0x94d7('0x41')]=function(_0x48dd4b,_0x4b4e5d){return db['VoiceQueuesLog'][_0x94d7('0x41')](_0x48dd4b[_0x94d7('0x42')],{})[_0x94d7('0x20')](respondWithResult(_0x4b4e5d,0xc9))[_0x94d7('0x3b')](handleError(_0x4b4e5d,null));};exports[_0x94d7('0x1f')]=function(_0x6ed7ee,_0x563d90){if(_0x6ed7ee[_0x94d7('0x42')]['id']){delete _0x6ed7ee[_0x94d7('0x42')]['id'];}return db['VoiceQueuesLog'][_0x94d7('0x40')]({'where':{'id':_0x6ed7ee[_0x94d7('0x3d')]['id']}})[_0x94d7('0x20')](handleEntityNotFound(_0x563d90,null))[_0x94d7('0x20')](saveUpdates(_0x6ed7ee[_0x94d7('0x42')],null))[_0x94d7('0x20')](respondWithResult(_0x563d90,null))[_0x94d7('0x3b')](handleError(_0x563d90,null));};exports['destroy']=function(_0x5610d6,_0x4d3427){return db[_0x94d7('0x37')][_0x94d7('0x40')]({'where':{'id':_0x5610d6[_0x94d7('0x3d')]['id']}})[_0x94d7('0x20')](handleEntityNotFound(_0x4d3427,null))['then'](removeEntity(_0x4d3427,null))[_0x94d7('0x3b')](handleError(_0x4d3427,null));}; \ No newline at end of file +var _0xdda5=['rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x582b3d,_0x1ca035){var _0x42ea5a=function(_0x200238){while(--_0x200238){_0x582b3d['push'](_0x582b3d['shift']());}};_0x42ea5a(++_0x1ca035);}(_0xdda5,0x189));var _0x5dda=function(_0x349a1e,_0x4321ba){_0x349a1e=_0x349a1e-0x0;var _0x24e719=_0xdda5[_0x349a1e];return _0x24e719;};'use strict';var emlformat=require(_0x5dda('0x0'));var rimraf=require(_0x5dda('0x1'));var zipdir=require(_0x5dda('0x2'));var jsonpatch=require(_0x5dda('0x3'));var rp=require(_0x5dda('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5dda('0x5'));var util=require(_0x5dda('0x6'));var path=require('path');var sox=require(_0x5dda('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5dda('0x8'));var _=require(_0x5dda('0x9'));var squel=require(_0x5dda('0xa'));var crypto=require(_0x5dda('0xb'));var jsforce=require(_0x5dda('0xc'));var deskjs=require(_0x5dda('0xd'));var toCsv=require(_0x5dda('0xe'));var querystring=require('querystring');var Papa=require(_0x5dda('0xf'));var Redis=require(_0x5dda('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5dda('0x11'));var as=require(_0x5dda('0x12'));var hardwareService=require(_0x5dda('0x13'));var logger=require(_0x5dda('0x14'))(_0x5dda('0x15'));var utils=require(_0x5dda('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5dda('0x17'));var db=require(_0x5dda('0x18'))['db'];function respondWithStatusCode(_0x58c971,_0x58e6a0){_0x58e6a0=_0x58e6a0||0xcc;return function(_0x3e77e2){if(_0x3e77e2){return _0x58c971[_0x5dda('0x19')](_0x58e6a0);}return _0x58c971['status'](_0x58e6a0)['end']();};}function respondWithResult(_0x722574,_0x51ff3f){_0x51ff3f=_0x51ff3f||0xc8;return function(_0x52a3cc){if(_0x52a3cc){return _0x722574[_0x5dda('0x1a')](_0x51ff3f)[_0x5dda('0x1b')](_0x52a3cc);}};}function respondWithFilteredResult(_0x129ee6,_0x276878){return function(_0x50973d){if(_0x50973d){var _0x274e2c=typeof _0x276878['offset']==='undefined'&&typeof _0x276878[_0x5dda('0x1c')]===_0x5dda('0x1d');var _0x514bc1=_0x50973d[_0x5dda('0x1e')];var _0x2bcca8=_0x274e2c?0x0:_0x276878['offset'];var _0x110792=_0x274e2c?_0x50973d[_0x5dda('0x1e')]:_0x276878[_0x5dda('0x1f')]+_0x276878[_0x5dda('0x1c')];var _0x6ad269;if(_0x110792>=_0x514bc1){_0x110792=_0x514bc1;_0x6ad269=0xc8;}else{_0x6ad269=0xce;}_0x129ee6[_0x5dda('0x1a')](_0x6ad269);return _0x129ee6[_0x5dda('0x20')](_0x5dda('0x21'),_0x2bcca8+'-'+_0x110792+'/'+_0x514bc1)[_0x5dda('0x1b')](_0x50973d);}return null;};}function patchUpdates(_0x4288bf){return function(_0x2ea32a){try{jsonpatch[_0x5dda('0x22')](_0x2ea32a,_0x4288bf,!![]);}catch(_0x6b85ee){return BPromise[_0x5dda('0x23')](_0x6b85ee);}return _0x2ea32a[_0x5dda('0x24')]();};}function saveUpdates(_0x34bbff,_0x58900e){return function(_0x1373ab){if(_0x1373ab){return _0x1373ab[_0x5dda('0x25')](_0x34bbff)[_0x5dda('0x26')](function(_0x431ff3){return _0x431ff3;});}return null;};}function removeEntity(_0x30b203,_0xe3400c){return function(_0x448aff){if(_0x448aff){return _0x448aff['destroy']()[_0x5dda('0x26')](function(){_0x30b203['status'](0xcc)[_0x5dda('0x27')]();});}};}function handleEntityNotFound(_0x5d738b,_0x2898a8){return function(_0x2c4b85){if(!_0x2c4b85){_0x5d738b[_0x5dda('0x19')](0x194);}return _0x2c4b85;};}function handleError(_0x299f14,_0x405f3c){_0x405f3c=_0x405f3c||0x1f4;return function(_0x10d78d){logger[_0x5dda('0x28')](_0x10d78d['stack']);if(_0x10d78d[_0x5dda('0x29')]){delete _0x10d78d[_0x5dda('0x29')];}_0x299f14['status'](_0x405f3c)[_0x5dda('0x2a')](_0x10d78d);};}exports[_0x5dda('0x2b')]=function(_0x4206e6,_0x16d72c){var _0x3591e4={},_0x4451f4={},_0x4b4dbf={'count':0x0,'rows':[]};var _0x3e0a77=_[_0x5dda('0x2c')](db[_0x5dda('0x2d')][_0x5dda('0x2e')],function(_0x4457c7){return{'name':_0x4457c7[_0x5dda('0x2f')],'type':_0x4457c7[_0x5dda('0x30')][_0x5dda('0x31')]};});_0x4451f4[_0x5dda('0x32')]=_['map'](_0x3e0a77,_0x5dda('0x29'));_0x4451f4[_0x5dda('0x33')]=_[_0x5dda('0x34')](_0x4206e6[_0x5dda('0x33')]);_0x4451f4['filters']=_[_0x5dda('0x35')](_0x4451f4['model'],_0x4451f4[_0x5dda('0x33')]);_0x3591e4['attributes']=_[_0x5dda('0x35')](_0x4451f4['model'],qs[_0x5dda('0x36')](_0x4206e6['query'][_0x5dda('0x36')]));_0x3591e4[_0x5dda('0x37')]=_0x3591e4[_0x5dda('0x37')][_0x5dda('0x38')]?_0x3591e4[_0x5dda('0x37')]:_0x4451f4[_0x5dda('0x32')];if(!_0x4206e6[_0x5dda('0x33')][_0x5dda('0x39')](_0x5dda('0x3a'))){_0x3591e4[_0x5dda('0x1c')]=qs['limit'](_0x4206e6[_0x5dda('0x33')][_0x5dda('0x1c')]);_0x3591e4[_0x5dda('0x1f')]=qs[_0x5dda('0x1f')](_0x4206e6[_0x5dda('0x33')][_0x5dda('0x1f')]);}_0x3591e4['order']=qs['sort'](_0x4206e6[_0x5dda('0x33')][_0x5dda('0x3b')]);_0x3591e4[_0x5dda('0x3c')]=qs[_0x5dda('0x3d')](_['pick'](_0x4206e6[_0x5dda('0x33')],_0x4451f4[_0x5dda('0x3d')]),_0x3e0a77);if(_0x4206e6[_0x5dda('0x33')][_0x5dda('0x3e')]){_0x3591e4[_0x5dda('0x3c')]=_[_0x5dda('0x3f')](_0x3591e4[_0x5dda('0x3c')],{'$or':_['map'](_0x3e0a77,function(_0x2f5450){if(_0x2f5450[_0x5dda('0x30')]!==_0x5dda('0x40')){var _0x2b4cc6={};_0x2b4cc6[_0x2f5450[_0x5dda('0x29')]]={'$like':'%'+_0x4206e6[_0x5dda('0x33')][_0x5dda('0x3e')]+'%'};return _0x2b4cc6;}})});}_0x3591e4=_[_0x5dda('0x3f')]({},_0x3591e4,_0x4206e6[_0x5dda('0x41')]);var _0x2f7561={'where':_0x3591e4[_0x5dda('0x3c')]};return db[_0x5dda('0x2d')][_0x5dda('0x1e')](_0x2f7561)[_0x5dda('0x26')](function(_0x1fc56a){_0x4b4dbf[_0x5dda('0x1e')]=_0x1fc56a;if(_0x4206e6[_0x5dda('0x33')][_0x5dda('0x42')]){_0x3591e4[_0x5dda('0x43')]=[{'all':!![]}];}return db[_0x5dda('0x2d')][_0x5dda('0x44')](_0x3591e4);})['then'](function(_0xd5c621){_0x4b4dbf[_0x5dda('0x45')]=_0xd5c621;return _0x4b4dbf;})[_0x5dda('0x26')](respondWithFilteredResult(_0x16d72c,_0x3591e4))[_0x5dda('0x46')](handleError(_0x16d72c,null));};exports[_0x5dda('0x47')]=function(_0x57a26e,_0xc0e59a){var _0x51e1cd={'raw':!![],'where':{'id':_0x57a26e[_0x5dda('0x48')]['id']}},_0x5054d8={};_0x5054d8[_0x5dda('0x32')]=_['keys'](db[_0x5dda('0x2d')]['rawAttributes']);_0x5054d8['query']=_[_0x5dda('0x34')](_0x57a26e[_0x5dda('0x33')]);_0x5054d8[_0x5dda('0x3d')]=_[_0x5dda('0x35')](_0x5054d8['model'],_0x5054d8['query']);_0x51e1cd[_0x5dda('0x37')]=_['intersection'](_0x5054d8['model'],qs[_0x5dda('0x36')](_0x57a26e[_0x5dda('0x33')][_0x5dda('0x36')]));_0x51e1cd[_0x5dda('0x37')]=_0x51e1cd[_0x5dda('0x37')]['length']?_0x51e1cd[_0x5dda('0x37')]:_0x5054d8[_0x5dda('0x32')];if(_0x57a26e[_0x5dda('0x33')][_0x5dda('0x42')]){_0x51e1cd[_0x5dda('0x43')]=[{'all':!![]}];}_0x51e1cd=_['merge']({},_0x51e1cd,_0x57a26e['options']);return db[_0x5dda('0x2d')][_0x5dda('0x49')](_0x51e1cd)[_0x5dda('0x26')](handleEntityNotFound(_0xc0e59a,null))[_0x5dda('0x26')](respondWithResult(_0xc0e59a,null))[_0x5dda('0x46')](handleError(_0xc0e59a,null));};exports[_0x5dda('0x4a')]=function(_0x4f3e16,_0x3f6822){return db[_0x5dda('0x2d')]['create'](_0x4f3e16[_0x5dda('0x4b')],{})['then'](respondWithResult(_0x3f6822,0xc9))[_0x5dda('0x46')](handleError(_0x3f6822,null));};exports[_0x5dda('0x25')]=function(_0x3c1b9f,_0x198df0){if(_0x3c1b9f[_0x5dda('0x4b')]['id']){delete _0x3c1b9f[_0x5dda('0x4b')]['id'];}return db[_0x5dda('0x2d')][_0x5dda('0x49')]({'where':{'id':_0x3c1b9f[_0x5dda('0x48')]['id']}})[_0x5dda('0x26')](handleEntityNotFound(_0x198df0,null))['then'](saveUpdates(_0x3c1b9f[_0x5dda('0x4b')],null))[_0x5dda('0x26')](respondWithResult(_0x198df0,null))[_0x5dda('0x46')](handleError(_0x198df0,null));};exports[_0x5dda('0x4c')]=function(_0x199f8b,_0x554af0){return db[_0x5dda('0x2d')]['find']({'where':{'id':_0x199f8b[_0x5dda('0x48')]['id']}})[_0x5dda('0x26')](handleEntityNotFound(_0x554af0,null))['then'](removeEntity(_0x554af0,null))[_0x5dda('0x46')](handleError(_0x554af0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 861182d..e85ccfb 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 _0xd5b9=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','util'];(function(_0x505289,_0x423747){var _0x2d752=function(_0x184a6f){while(--_0x184a6f){_0x505289['push'](_0x505289['shift']());}};_0x2d752(++_0x423747);}(_0xd5b9,0xe0));var _0x9d5b=function(_0x500f52,_0x11d448){_0x500f52=_0x500f52-0x0;var _0x55ac2e=_0xd5b9[_0x500f52];return _0x55ac2e;};'use strict';var _=require('lodash');var util=require(_0x9d5b('0x0'));var logger=require(_0x9d5b('0x1'))('api');var moment=require(_0x9d5b('0x2'));var BPromise=require(_0x9d5b('0x3'));var rp=require(_0x9d5b('0x4'));var fs=require('fs');var path=require(_0x9d5b('0x5'));var rimraf=require(_0x9d5b('0x6'));var config=require(_0x9d5b('0x7'));var attributes=require(_0x9d5b('0x8'));module[_0x9d5b('0x9')]=function(_0x5cbac5,_0x1c3702){return _0x5cbac5[_0x9d5b('0xa')](_0x9d5b('0xb'),attributes,{'tableName':_0x9d5b('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x9d5b('0xd'),_0x9d5b('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x21ca=['moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','event_dtm','event','dtm','util','../../config/logger'];(function(_0x3e04ec,_0x5e48ae){var _0x2cac63=function(_0x2f5b49){while(--_0x2f5b49){_0x3e04ec['push'](_0x3e04ec['shift']());}};_0x2cac63(++_0x5e48ae);}(_0x21ca,0x14e));var _0xa21c=function(_0x260615,_0x1687f2){_0x260615=_0x260615-0x0;var _0x139992=_0x21ca[_0x260615];return _0x139992;};'use strict';var _=require('lodash');var util=require(_0xa21c('0x0'));var logger=require(_0xa21c('0x1'))('api');var moment=require(_0xa21c('0x2'));var BPromise=require(_0xa21c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa21c('0x4'));var rimraf=require(_0xa21c('0x5'));var config=require(_0xa21c('0x6'));var attributes=require(_0xa21c('0x7'));module['exports']=function(_0x29c9f5,_0x24efd2){return _0x29c9f5['define'](_0xa21c('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xa21c('0x9'),'fields':[_0xa21c('0xa'),_0xa21c('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 62e84f7..1724142 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 _0x2fc7=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x26b48d,_0x5a7ebb){var _0x338016=function(_0x49678d){while(--_0x49678d){_0x26b48d['push'](_0x26b48d['shift']());}};_0x338016(++_0x5a7ebb);}(_0x2fc7,0x19d));var _0x72fc=function(_0x364b23,_0xdfd2ff){_0x364b23=_0x364b23-0x0;var _0x381239=_0x2fc7[_0x364b23];return _0x381239;};'use strict';var _=require('lodash');var util=require(_0x72fc('0x0'));var moment=require('moment');var BPromise=require(_0x72fc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72fc('0x2'));var db=require(_0x72fc('0x3'))['db'];var utils=require(_0x72fc('0x4'));var logger=require(_0x72fc('0x5'))(_0x72fc('0x6'));var config=require(_0x72fc('0x7'));var jayson=require(_0x72fc('0x8'));var client=jayson[_0x72fc('0x9')][_0x72fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11079d,_0x3fb428,_0x81d4b8){return new BPromise(function(_0x4bdc31,_0x14143d){return client[_0x72fc('0xb')](_0x11079d,_0x81d4b8)[_0x72fc('0xc')](function(_0x1374f7){logger[_0x72fc('0xd')](_0x72fc('0xe'),_0x3fb428,'request\x20sent');logger[_0x72fc('0xf')](_0x72fc('0x10'),_0x3fb428,_0x72fc('0x11'),JSON[_0x72fc('0x12')](_0x1374f7));if(_0x1374f7[_0x72fc('0x13')]){if(_0x1374f7[_0x72fc('0x13')][_0x72fc('0x14')]===0x1f4){logger[_0x72fc('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3fb428,_0x1374f7['error'][_0x72fc('0x15')]);return _0x14143d(_0x1374f7[_0x72fc('0x13')][_0x72fc('0x15')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3fb428,_0x1374f7[_0x72fc('0x13')][_0x72fc('0x15')]);return _0x4bdc31(_0x1374f7['error'][_0x72fc('0x15')]);}else{logger[_0x72fc('0xd')](_0x72fc('0xe'),_0x3fb428,'request\x20sent');_0x4bdc31(_0x1374f7[_0x72fc('0x16')]['message']);}})['catch'](function(_0x44f6d0){logger['error'](_0x72fc('0xe'),_0x3fb428,_0x44f6d0);_0x14143d(_0x44f6d0);});});} \ No newline at end of file +var _0xd96b=['jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x156e44,_0x570e8b){var _0x59b1c1=function(_0x22799d){while(--_0x22799d){_0x156e44['push'](_0x156e44['shift']());}};_0x59b1c1(++_0x570e8b);}(_0xd96b,0x109));var _0xbd96=function(_0x4ef475,_0x1d6abe){_0x4ef475=_0x4ef475-0x0;var _0x59be05=_0xd96b[_0x4ef475];return _0x59be05;};'use strict';var _=require(_0xbd96('0x0'));var util=require(_0xbd96('0x1'));var moment=require(_0xbd96('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd96('0x3'));var fs=require('fs');var Redis=require(_0xbd96('0x4'));var db=require(_0xbd96('0x5'))['db'];var utils=require(_0xbd96('0x6'));var logger=require(_0xbd96('0x7'))(_0xbd96('0x8'));var config=require(_0xbd96('0x9'));var jayson=require(_0xbd96('0xa'));var client=jayson[_0xbd96('0xb')][_0xbd96('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62b9a5,_0x2a4c30,_0x1c8d9a){return new BPromise(function(_0x5e3a88,_0x7d18a9){return client[_0xbd96('0xd')](_0x62b9a5,_0x1c8d9a)[_0xbd96('0xe')](function(_0x5b8cb1){logger[_0xbd96('0xf')](_0xbd96('0x10'),_0x2a4c30,_0xbd96('0x11'));logger[_0xbd96('0x12')](_0xbd96('0x13'),_0x2a4c30,_0xbd96('0x11'),JSON['stringify'](_0x5b8cb1));if(_0x5b8cb1[_0xbd96('0x14')]){if(_0x5b8cb1[_0xbd96('0x14')][_0xbd96('0x15')]===0x1f4){logger['error'](_0xbd96('0x10'),_0x2a4c30,_0x5b8cb1[_0xbd96('0x14')]['message']);return _0x7d18a9(_0x5b8cb1[_0xbd96('0x14')][_0xbd96('0x16')]);}logger['error'](_0xbd96('0x10'),_0x2a4c30,_0x5b8cb1[_0xbd96('0x14')][_0xbd96('0x16')]);return _0x5e3a88(_0x5b8cb1['error'][_0xbd96('0x16')]);}else{logger[_0xbd96('0xf')](_0xbd96('0x10'),_0x2a4c30,_0xbd96('0x11'));_0x5e3a88(_0x5b8cb1[_0xbd96('0x17')][_0xbd96('0x16')]);}})[_0xbd96('0x18')](function(_0xe28d48){logger[_0xbd96('0x14')](_0xbd96('0x10'),_0x2a4c30,_0xe28d48);_0x7d18a9(_0xe28d48);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 12ee80b..4da9faa 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 _0x70b5=['downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download'];(function(_0x16cf18,_0x248d91){var _0xe9f480=function(_0x436b21){while(--_0x436b21){_0x16cf18['push'](_0x16cf18['shift']());}};_0xe9f480(++_0x248d91);}(_0x70b5,0x105));var _0x570b=function(_0xa5a920,_0x2d8772){_0xa5a920=_0xa5a920-0x0;var _0x596618=_0x70b5[_0xa5a920];return _0x596618;};'use strict';var multer=require(_0x570b('0x0'));var util=require(_0x570b('0x1'));var path=require('path');var timeout=require(_0x570b('0x2'));var express=require(_0x570b('0x3'));var router=express[_0x570b('0x4')]();var fs_extra=require(_0x570b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x570b('0x6')](),controller[_0x570b('0x7')]);router[_0x570b('0x8')](_0x570b('0x9'),auth['isAuthenticated'](),controller[_0x570b('0xa')]);router[_0x570b('0x8')](_0x570b('0xb'),auth[_0x570b('0x6')](),controller[_0x570b('0xc')]);router['get'](_0x570b('0xd'),auth[_0x570b('0x6')](),controller[_0x570b('0xe')]);router[_0x570b('0x8')]('/:id/downloads',controller[_0x570b('0xf')]);router[_0x570b('0x8')](_0x570b('0x10'),auth[_0x570b('0x6')](),controller[_0x570b('0x11')]);router[_0x570b('0x12')]('/',auth[_0x570b('0x6')](),controller['create']);router[_0x570b('0x12')](_0x570b('0x10'),auth['isAuthenticated'](),controller[_0x570b('0x13')]);router['put']('/:id',auth[_0x570b('0x6')](),controller[_0x570b('0x14')]);router[_0x570b('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x570b('0x16')]=router; \ No newline at end of file +var _0x0f7d=['show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','runTranscribe','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x1e36e1,_0x2e6621){var _0x53a29e=function(_0x48a52b){while(--_0x48a52b){_0x1e36e1['push'](_0x1e36e1['shift']());}};_0x53a29e(++_0x2e6621);}(_0x0f7d,0x137));var _0xd0f7=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x0f7d[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0xd0f7('0x0'));var util=require(_0xd0f7('0x1'));var path=require('path');var timeout=require(_0xd0f7('0x2'));var express=require(_0xd0f7('0x3'));var router=express[_0xd0f7('0x4')]();var fs_extra=require(_0xd0f7('0x5'));var auth=require(_0xd0f7('0x6'));var interaction=require(_0xd0f7('0x7'));var config=require('../../config/environment');var controller=require(_0xd0f7('0x8'));router[_0xd0f7('0x9')]('/',auth[_0xd0f7('0xa')](),controller['index']);router[_0xd0f7('0x9')](_0xd0f7('0xb'),auth[_0xd0f7('0xa')](),controller[_0xd0f7('0xc')]);router[_0xd0f7('0x9')](_0xd0f7('0xd'),auth['isAuthenticated'](),controller[_0xd0f7('0xe')]);router['get'](_0xd0f7('0xf'),auth[_0xd0f7('0xa')](),controller[_0xd0f7('0x10')]);router[_0xd0f7('0x9')](_0xd0f7('0x11'),controller[_0xd0f7('0x12')]);router['get'](_0xd0f7('0x13'),auth[_0xd0f7('0xa')](),controller['downloadTranscribe']);router[_0xd0f7('0x14')]('/',auth[_0xd0f7('0xa')](),controller['create']);router[_0xd0f7('0x14')]('/:id/transcribe',auth[_0xd0f7('0xa')](),controller[_0xd0f7('0x15')]);router[_0xd0f7('0x16')](_0xd0f7('0xd'),auth[_0xd0f7('0xa')](),controller[_0xd0f7('0x17')]);router[_0xd0f7('0x18')](_0xd0f7('0xd'),auth[_0xd0f7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 2d4bd0b..218a5c2 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(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 fa0c276..26bfb3a 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 _0xf74f=['then','destroy','end','error','name','send','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','download','extname','unlink','Not\x20found','downloads','sequelize','MD5','col','$and','push','filename','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','.txt','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x5b2eaa,_0x51ffea){var _0x348c10=function(_0x4de557){while(--_0x4de557){_0x5b2eaa['push'](_0x5b2eaa['shift']());}};_0x348c10(++_0x51ffea);}(_0xf74f,0x10c));var _0xff74=function(_0x572165,_0x6a45cc){_0x572165=_0x572165-0x0;var _0x8c8709=_0xf74f[_0x572165];return _0x8c8709;};'use strict';var emlformat=require(_0xff74('0x0'));var rimraf=require(_0xff74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff74('0x2'));var rp=require(_0xff74('0x3'));var moment=require(_0xff74('0x4'));var BPromise=require(_0xff74('0x5'));var Mustache=require(_0xff74('0x6'));var util=require(_0xff74('0x7'));var path=require(_0xff74('0x8'));var sox=require('sox');var csv=require(_0xff74('0x9'));var ejs=require(_0xff74('0xa'));var fs=require('fs');var fs_extra=require(_0xff74('0xb'));var _=require('lodash');var squel=require(_0xff74('0xc'));var crypto=require(_0xff74('0xd'));var jsforce=require(_0xff74('0xe'));var deskjs=require(_0xff74('0xf'));var toCsv=require(_0xff74('0x9'));var querystring=require(_0xff74('0x10'));var Papa=require('papaparse');var AWS=require(_0xff74('0x11'));var uuidv4=require(_0xff74('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff74('0x13'));var as=require(_0xff74('0x14'));var hardwareService=require(_0xff74('0x15'));var logger=require(_0xff74('0x16'))(_0xff74('0x17'));var utils=require('../../config/utils');var config=require(_0xff74('0x18'));var licenseUtil=require(_0xff74('0x19'));var db=require(_0xff74('0x1a'))['db'];function respondWithStatusCode(_0x1df73d,_0x198bd8){_0x198bd8=_0x198bd8||0xcc;return function(_0x35aa16){if(_0x35aa16){return _0x1df73d[_0xff74('0x1b')](_0x198bd8);}return _0x1df73d[_0xff74('0x1c')](_0x198bd8)['end']();};}function respondWithResult(_0x21f3f1,_0x1949c3){_0x1949c3=_0x1949c3||0xc8;return function(_0x300adc){if(_0x300adc){return _0x21f3f1[_0xff74('0x1c')](_0x1949c3)[_0xff74('0x1d')](_0x300adc);}};}function respondWithFilteredResult(_0xb30604,_0x5ab812){return function(_0x32cf04){if(_0x32cf04){var _0x5a691c=typeof _0x5ab812[_0xff74('0x1e')]===_0xff74('0x1f')&&typeof _0x5ab812[_0xff74('0x20')]===_0xff74('0x1f');var _0x284551=_0x32cf04[_0xff74('0x21')];var _0x448f72=_0x5a691c?0x0:_0x5ab812[_0xff74('0x1e')];var _0x302c1d=_0x5a691c?_0x32cf04[_0xff74('0x21')]:_0x5ab812[_0xff74('0x1e')]+_0x5ab812[_0xff74('0x20')];var _0x4da996;if(_0x302c1d>=_0x284551){_0x302c1d=_0x284551;_0x4da996=0xc8;}else{_0x4da996=0xce;}_0xb30604[_0xff74('0x1c')](_0x4da996);return _0xb30604[_0xff74('0x22')](_0xff74('0x23'),_0x448f72+'-'+_0x302c1d+'/'+_0x284551)[_0xff74('0x1d')](_0x32cf04);}return null;};}function patchUpdates(_0x29499f){return function(_0x47ecaf){try{jsonpatch[_0xff74('0x24')](_0x47ecaf,_0x29499f,!![]);}catch(_0x12c6d3){return BPromise[_0xff74('0x25')](_0x12c6d3);}return _0x47ecaf[_0xff74('0x26')]();};}function saveUpdates(_0x4dfb89,_0x5c1718){return function(_0x124c31){if(_0x124c31){return _0x124c31[_0xff74('0x27')](_0x4dfb89)[_0xff74('0x28')](function(_0x4bebfe){return _0x4bebfe;});}return null;};}function removeEntity(_0x38d5f5,_0x2a1110){return function(_0x1e1e5d){if(_0x1e1e5d){return _0x1e1e5d[_0xff74('0x29')]()[_0xff74('0x28')](function(){_0x38d5f5[_0xff74('0x1c')](0xcc)[_0xff74('0x2a')]();});}};}function handleEntityNotFound(_0x5aecfd,_0x3bce41){return function(_0x5e48cf){if(!_0x5e48cf){_0x5aecfd[_0xff74('0x1b')](0x194);}return _0x5e48cf;};}function handleError(_0x50f0e5,_0x3092d8){_0x3092d8=_0x3092d8||0x1f4;return function(_0x181f9a){logger[_0xff74('0x2b')](_0x181f9a['stack']);if(_0x181f9a[_0xff74('0x2c')]){delete _0x181f9a[_0xff74('0x2c')];}_0x50f0e5[_0xff74('0x1c')](_0x3092d8)[_0xff74('0x2d')](_0x181f9a);};}exports['index']=function(_0x3b9b93,_0xff9093){var _0x3c1678={},_0x50c331={},_0x1a49b9={'count':0x0,'rows':[]};var _0xb099e7=_[_0xff74('0x2e')](db[_0xff74('0x2f')]['rawAttributes'],function(_0x232835){return{'name':_0x232835[_0xff74('0x30')],'type':_0x232835[_0xff74('0x31')][_0xff74('0x32')]};});_0x50c331[_0xff74('0x33')]=_[_0xff74('0x34')](_[_0xff74('0x2e')](_0xb099e7,_0xff74('0x2c')),[_0xff74('0x35')]);_0x50c331[_0xff74('0x36')]=_[_0xff74('0x37')](_0x3b9b93[_0xff74('0x36')]);_0x50c331['filters']=_['intersection'](_0x50c331[_0xff74('0x33')],_0x50c331[_0xff74('0x36')]);_0x3c1678[_0xff74('0x38')]=_['intersection'](_0x50c331[_0xff74('0x33')],qs[_0xff74('0x39')](_0x3b9b93[_0xff74('0x36')][_0xff74('0x39')]));_0x3c1678['attributes']=_0x3c1678[_0xff74('0x38')][_0xff74('0x3a')]?_0x3c1678['attributes']:_0x50c331[_0xff74('0x33')];if(!_0x3b9b93[_0xff74('0x36')][_0xff74('0x3b')](_0xff74('0x3c'))){_0x3c1678[_0xff74('0x20')]=qs['limit'](_0x3b9b93[_0xff74('0x36')]['limit']);_0x3c1678['offset']=qs['offset'](_0x3b9b93[_0xff74('0x36')][_0xff74('0x1e')]);}_0x3c1678[_0xff74('0x3d')]=qs[_0xff74('0x3e')](_0x3b9b93[_0xff74('0x36')][_0xff74('0x3e')]);_0x3c1678[_0xff74('0x3f')]=qs[_0xff74('0x40')](_['pick'](_0x3b9b93[_0xff74('0x36')],_0x50c331[_0xff74('0x40')]),_0xb099e7);if(_0x3b9b93[_0xff74('0x36')][_0xff74('0x41')]){_0x3c1678[_0xff74('0x3f')]=_[_0xff74('0x42')](_0x3c1678[_0xff74('0x3f')],{'$or':_[_0xff74('0x2e')](_0xb099e7,function(_0x48dac4){if(_0x48dac4[_0xff74('0x31')]!==_0xff74('0x43')){var _0x4e29e3={};_0x4e29e3[_0x48dac4[_0xff74('0x2c')]]={'$like':'%'+_0x3b9b93['query'][_0xff74('0x41')]+'%'};return _0x4e29e3;}})});}_0x3c1678=_[_0xff74('0x42')]({},_0x3c1678,_0x3b9b93[_0xff74('0x44')]);var _0x297f3f={'where':_0x3c1678[_0xff74('0x3f')]};return db['VoiceRecording'][_0xff74('0x21')](_0x297f3f)['then'](function(_0x42434e){_0x1a49b9[_0xff74('0x21')]=_0x42434e;if(_0x3b9b93['query'][_0xff74('0x45')]){_0x3c1678[_0xff74('0x46')]=[{'all':!![]}];}return db['VoiceRecording'][_0xff74('0x47')](_0x3c1678);})[_0xff74('0x28')](function(_0xbc261c){_0x1a49b9['rows']=_0xbc261c;return _0x1a49b9;})[_0xff74('0x28')](respondWithFilteredResult(_0xff9093,_0x3c1678))[_0xff74('0x48')](handleError(_0xff9093,null));};exports[_0xff74('0x49')]=function(_0xde3d7f,_0x5a3fc2){var _0x295b68={'raw':![],'where':{'id':_0xde3d7f[_0xff74('0x4a')]['id']}},_0x3c03d8={};_0x3c03d8['model']=_['keys'](db[_0xff74('0x2f')][_0xff74('0x4b')]);_0x3c03d8['query']=_[_0xff74('0x37')](_0xde3d7f[_0xff74('0x36')]);_0x3c03d8[_0xff74('0x40')]=_[_0xff74('0x4c')](_0x3c03d8[_0xff74('0x33')],_0x3c03d8[_0xff74('0x36')]);_0x295b68[_0xff74('0x38')]=_[_0xff74('0x4c')](_0x3c03d8[_0xff74('0x33')],qs[_0xff74('0x39')](_0xde3d7f[_0xff74('0x36')][_0xff74('0x39')]));_0x295b68[_0xff74('0x38')]=_0x295b68[_0xff74('0x38')][_0xff74('0x3a')]?_0x295b68[_0xff74('0x38')]:_0x3c03d8[_0xff74('0x33')];if(_0xde3d7f['query'][_0xff74('0x45')]){_0x295b68[_0xff74('0x46')]=[{'all':!![]}];}_0x295b68=_[_0xff74('0x42')]({},_0x295b68,_0xde3d7f[_0xff74('0x44')]);return db[_0xff74('0x2f')][_0xff74('0x4d')](_0x295b68)[_0xff74('0x28')](handleEntityNotFound(_0x5a3fc2,null))['then'](respondWithResult(_0x5a3fc2,null))['catch'](handleError(_0x5a3fc2,null));};exports[_0xff74('0x4e')]=function(_0x46e4ee,_0x25b612){return db[_0xff74('0x2f')]['create'](_0x46e4ee[_0xff74('0x4f')],{})['then'](respondWithResult(_0x25b612,0xc9))['catch'](handleError(_0x25b612,null));};exports[_0xff74('0x27')]=function(_0x4f417b,_0x339440){if(_0x4f417b['body']['id']){delete _0x4f417b[_0xff74('0x4f')]['id'];}return db[_0xff74('0x2f')][_0xff74('0x4d')]({'where':{'id':_0x4f417b[_0xff74('0x4a')]['id']}})[_0xff74('0x28')](handleEntityNotFound(_0x339440,null))['then'](saveUpdates(_0x4f417b[_0xff74('0x4f')],null))['then'](respondWithResult(_0x339440,null))[_0xff74('0x48')](handleError(_0x339440,null));};exports[_0xff74('0x50')]=function(_0x586eb7,_0x5528d7){return db[_0xff74('0x2f')]['describe']()[_0xff74('0x28')](respondWithResult(_0x5528d7,null))[_0xff74('0x48')](handleError(_0x5528d7,null));};exports['download']=function(_0x260284,_0xfd21a3,_0x5d9b93){var _0x13d1f5=require(_0xff74('0x51'));var _0x32c13e=![];var _0x5b799f={};if(_0x260284[_0xff74('0x36')][_0xff74('0x31')]&&_0x260284['query'][_0xff74('0x31')]===_0xff74('0x52')){_0x5b799f[_0xff74('0x52')]=_0x260284[_0xff74('0x4a')]['id'];}else{_0x5b799f['id']=_0x260284[_0xff74('0x4a')]['id'];}return db[_0xff74('0x2f')][_0xff74('0x4d')]({'where':_0x5b799f,'attributes':['id','value'],'raw':!![]})[_0xff74('0x28')](handleEntityNotFound(_0xfd21a3,null))[_0xff74('0x28')](function(_0x36855d){if(_0x36855d){var _0x2778a0=_0x36855d[_0xff74('0x53')];var _0x25dab6=util[_0xff74('0x35')](_0xff74('0x54'),_0x2778a0);if(fs[_0xff74('0x55')](_0x25dab6)){_0x32c13e=!![];return _0x13d1f5[_0xff74('0x56')](_0x25dab6,_0x2778a0,config[_0xff74('0x57')][_0xff74('0x58')])[_0xff74('0x28')](function(){return _0x36855d;});}return _0x36855d;}})[_0xff74('0x28')](function(_0xa9e478){if(_0xa9e478){var _0x4941e7=_0xa9e478[_0xff74('0x53')];if(!fs[_0xff74('0x55')](_0x4941e7)){throw new db[(_0xff74('0x59'))][(_0xff74('0x5a'))](_0xff74('0x5b'));}if(_0xa9e478['filename']){return _0xfd21a3[_0xff74('0x5c')](_0x4941e7,_0xa9e478['filename']+path[_0xff74('0x5d')](_0x4941e7),function(){if(_0x32c13e){fs[_0xff74('0x5e')](_0x4941e7);}});}else{return _0xfd21a3[_0xff74('0x5c')](_0x4941e7,function(_0xcf7b7e){if(_0x32c13e){fs[_0xff74('0x5e')](_0x4941e7);}});}}})[_0xff74('0x48')](function(_0x12ef14){if(_0x12ef14['message']===_0xff74('0x5b')){_0xfd21a3['status'](0x194)[_0xff74('0x2d')](_0xff74('0x5f'));}else{return handleError(_0xfd21a3,null);}});};exports[_0xff74('0x60')]=function(_0x901a80,_0x5068f2,_0x4bc190){var _0x31fb67=require(_0xff74('0x51'));var _0x3e8360=![];var _0x2a318d={'$and':[db[_0xff74('0x61')]['where'](db[_0xff74('0x61')]['fn'](_0xff74('0x62'),db[_0xff74('0x61')][_0xff74('0x63')]('uniqueid')),_0x901a80['query']['token'])]};if(_0x901a80['query']['type']&&_0x901a80['query'][_0xff74('0x31')]===_0xff74('0x52')){_0x2a318d[_0xff74('0x64')][_0xff74('0x65')]({'uniqueid':_0x901a80[_0xff74('0x4a')]['id']});}else{_0x2a318d[_0xff74('0x64')][_0xff74('0x65')]({'id':_0x901a80['params']['id']});}return db[_0xff74('0x2f')][_0xff74('0x4d')]({'where':_0x2a318d,'attributes':['id','value'],'raw':!![]})[_0xff74('0x28')](handleEntityNotFound(_0x5068f2,null))[_0xff74('0x28')](function(_0x17d1b7){if(_0x17d1b7){var _0x29c14b=util[_0xff74('0x35')](_0xff74('0x54'),_0x17d1b7[_0xff74('0x53')]);if(fs[_0xff74('0x55')](_0x29c14b)){_0x3e8360=!![];return _0x31fb67['decryptFile'](_0x29c14b,_0x17d1b7[_0xff74('0x53')],config[_0xff74('0x57')][_0xff74('0x58')])[_0xff74('0x28')](function(){return _0x17d1b7;});}return _0x17d1b7;}})[_0xff74('0x28')](function(_0x5d6c63){if(_0x5d6c63){if(!fs[_0xff74('0x55')](_0x5d6c63[_0xff74('0x53')])){throw new db[(_0xff74('0x59'))][(_0xff74('0x5a'))]('VoiceRecording\x20not\x20found');}if(_0x5d6c63[_0xff74('0x66')]){return _0x5068f2['download'](_0x5d6c63[_0xff74('0x53')],_0x5d6c63['filename']+path[_0xff74('0x5d')](_0x5d6c63[_0xff74('0x53')]),function(){if(_0x3e8360){fs[_0xff74('0x5e')](_0x5d6c63[_0xff74('0x53')]);}});}else{return _0x5068f2[_0xff74('0x5c')](_0x5d6c63['value'],function(_0x25cbd9){if(_0x3e8360){fs[_0xff74('0x5e')](_0x5d6c63[_0xff74('0x53')]);}});}}})[_0xff74('0x48')](handleError(_0x5068f2,null));};exports['destroy']=function(_0xbac0a8,_0x3cb334){return db[_0xff74('0x2f')][_0xff74('0x4d')]({'where':{'id':_0xbac0a8[_0xff74('0x4a')]['id']}})[_0xff74('0x28')](function(_0x2ede84){if(_[_0xff74('0x67')](_0x2ede84)){throw new ReferenceError(_0xff74('0x68'));}return _0x2ede84;})['then'](function(_0x111338){var _0xc4a7bd=_0x111338[_0xff74('0x53')];logger[_0xff74('0x69')](_0xff74('0x6a'),_0xc4a7bd);if(!_[_0xff74('0x67')](_0x111338['value'])&&fs[_0xff74('0x55')](_0xc4a7bd)){logger[_0xff74('0x69')](_0xff74('0x6b')+_0xc4a7bd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xff74('0x6c')](_0xc4a7bd);}_0xc4a7bd=_0xc4a7bd+_0xff74('0x6d');if(!_[_0xff74('0x67')](_0x111338[_0xff74('0x53')])&&fs[_0xff74('0x55')](_0xc4a7bd)){logger[_0xff74('0x69')](_0xff74('0x6b')+_0xc4a7bd+_0xff74('0x6e'));fs[_0xff74('0x6c')](_0xc4a7bd);}return _0x111338;})['then'](function(_0x3f8e15){if(!_0x3f8e15)throw new InternalError();return _0x3f8e15[_0xff74('0x29')]();})[_0xff74('0x28')](function(){_0x3cb334[_0xff74('0x1c')](0xcc)[_0xff74('0x2a')]();})[_0xff74('0x48')](handleError(_0x3cb334,null));};function getBucketslist(_0x4d37c5,_0x56010d,_0x50689d){return new Promise(function(_0x43fb72,_0x3fbb35){var _0x4f5849=new AWS['S3']({'accessKeyId':_0x56010d,'secretAccessKey':_0x4d37c5,'region':_0x50689d});_0x4f5849[_0xff74('0x6f')]({},function(_0x7b8a8f,_0x4c4d89){if(_0x7b8a8f){return _0x3fbb35(_0x7b8a8f);}else{return _0x43fb72(_0x4c4d89);}});});}function createBucket(_0x169b77,_0x33df8d,_0x598574,_0x2af029){return new Promise(function(_0x4ed289,_0x1044b2){var _0x2de2fc=new AWS['S3']({'accessKeyId':_0x33df8d,'secretAccessKey':_0x169b77,'region':_0x598574});_0x2de2fc[_0xff74('0x70')]({'Bucket':_0x2af029},function(_0x4837ea,_0x38ebcd){if(_0x4837ea){return _0x1044b2(_0x4837ea);}else{return _0x4ed289(_0x38ebcd);}});});}function uploadFile(_0x4eea03,_0x4ec92a,_0x4b6961,_0x31d9e9,_0x3fc6ea,_0x470ae2){return new Promise(function(_0x237abc,_0x12741e){var _0x1a3265=new AWS['S3']({'accessKeyId':_0x4ec92a,'secretAccessKey':_0x4eea03,'region':_0x4b6961});_0x1a3265[_0xff74('0x71')]({'Bucket':_0x31d9e9,'Key':_0x3fc6ea,'Body':_0x470ae2},function(_0x4c1191,_0x24d920){if(_0x4c1191){return _0x12741e(_0x4c1191);}else{return _0x237abc(_0x24d920);}});});}function startTranscribe(_0x1319c1,_0x231104,_0x8da99d,_0x33633c,_0x44e00d,_0x33d7e5){return new Promise(function(_0x6e235f,_0x3f9e1e){var _0x5c77fa=new AWS[(_0xff74('0x72'))]({'accessKeyId':_0x231104,'secretAccessKey':_0x1319c1,'region':_0x8da99d});_0x5c77fa[_0xff74('0x73')]({'TranscriptionJobName':_0x33633c,'LanguageCode':_0x44e00d,'Media':{'MediaFileUri':_0x33d7e5}},function(_0xedb856,_0x11e125){if(_0xedb856){return _0x3f9e1e(_0xedb856);}else{return _0x6e235f(_0x11e125);}});});}function transcribe(_0x16f4cf,_0x3b9e22,_0x19bd83,_0x278792,_0x477227,_0x213352,_0x58945d){return new Promise(function(_0x2a63fc,_0x455ddf){var _0x59cc23={};logger[_0xff74('0x69')](util[_0xff74('0x35')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x16f4cf,_0x477227));return uploadFile(_0x3b9e22,_0x19bd83,_0x278792,_0x477227,path[_0xff74('0x74')](_0x213352),fs['readFileSync'](_0x213352))[_0xff74('0x28')](function(_0x974e91){logger[_0xff74('0x69')](util[_0xff74('0x35')](_0xff74('0x75'),_0x16f4cf,_0x477227,_0x974e91['Location']));_0x59cc23[_0xff74('0x76')]=_0x974e91['Bucket'];_0x59cc23['location']=_0x974e91[_0xff74('0x77')];logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x16f4cf));return startTranscribe(_0x3b9e22,_0x19bd83,_0x278792,uuidv4(),_0x58945d,_0x974e91['Location']);})[_0xff74('0x28')](function(_0x30422f){logger[_0xff74('0x69')](util['format'](_0xff74('0x78'),_0x16f4cf,_0x30422f[_0xff74('0x79')][_0xff74('0x7a')]));_0x59cc23[_0xff74('0x7b')]=_0x30422f['TranscriptionJob'][_0xff74('0x7a')];_0x59cc23[_0xff74('0x7c')]=_0x30422f['TranscriptionJob'][_0xff74('0x7d')];return _0x2a63fc(_0x59cc23);})['catch'](function(_0x5520b9){return _0x455ddf(_0x5520b9);});});}exports[_0xff74('0x7e')]=function(_0xb506eb,_0x3788ee,_0x3357c8){var _0x2d0a6e;var _0x1cebe5;var _0x1a36b3;var _0xdf1802=require('../../components/encryptor');return db[_0xff74('0x2f')][_0xff74('0x7f')]({'where':{'id':_0xb506eb[_0xff74('0x4a')]['id']}})[_0xff74('0x28')](function(_0xa85195){if(_0xa85195){var _0x32e820=util[_0xff74('0x35')]('%s.cypher',_0xa85195[_0xff74('0x53')]);if(fs[_0xff74('0x55')](_0x32e820)){cypher=!![];return _0xdf1802[_0xff74('0x56')](_0x32e820,_0xa85195[_0xff74('0x53')],config[_0xff74('0x57')]['recording'])['then'](function(){return _0xa85195;});}return _0xa85195;}})[_0xff74('0x28')](function(_0x4bfefe){if(!_0x4bfefe){throw new db[(_0xff74('0x59'))][(_0xff74('0x5a'))]('Voice\x20Recording\x20not\x20found');}_0x1cebe5=_0x4bfefe;return db[_0xff74('0x80')][_0xff74('0x7f')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x3788ee,null))[_0xff74('0x28')](function(_0x3096d3){if(_0x3096d3){_0x2d0a6e=_0x3096d3;if(!_0x2d0a6e[_0xff74('0x81')]||!_0x2d0a6e['transcribeAccountId']||!_0x2d0a6e[_0xff74('0x82')]||!_0x2d0a6e['language']||!_0x2d0a6e[_0xff74('0x76')]){throw new db[(_0xff74('0x59'))]['ValidationError'](_0xff74('0x83'));}if(_0xb506eb[_0xff74('0x4f')][_0xff74('0x84')]&&(!_0x2d0a6e['sentiment']||!_0x2d0a6e[_0xff74('0x85')]||!_0x2d0a6e[_0xff74('0x86')]||!_0x2d0a6e[_0xff74('0x87')]||!_0x2d0a6e['bucket'])){throw new db[(_0xff74('0x59'))][(_0xff74('0x5a'))](_0xff74('0x88'));}return db['CloudProvider'][_0xff74('0x7f')]({'where':{'id':_0x2d0a6e[_0xff74('0x89')]}});}})['then'](function(_0x30c64c){if(!_0x30c64c){throw new db[(_0xff74('0x59'))][(_0xff74('0x5a'))](_0xff74('0x8a'));}if(!_0x30c64c[_0xff74('0x8b')]||!_0x30c64c[_0xff74('0x8c')]){throw new db[(_0xff74('0x59'))][(_0xff74('0x5a'))](_0xff74('0x8d'));}_0x1a36b3=_0x30c64c;return getBucketslist(_0x1a36b3[_0xff74('0x8b')],_0x1a36b3[_0xff74('0x8c')],_0x2d0a6e['transcribeRegion']);})['then'](function(_0x2ebca2){if(_0x2ebca2&&_0x2ebca2[_0xff74('0x8e')]){var _0x1eb6e2=_[_0xff74('0x4d')](_0x2ebca2[_0xff74('0x8e')],function(_0x2a0d42){return _0x2a0d42[_0xff74('0x8f')]===_0x2d0a6e[_0xff74('0x76')];});if(!_0x1eb6e2){logger['info'](util[_0xff74('0x35')](_0xff74('0x90'),_0xb506eb[_0xff74('0x4a')]['id'],_0x2d0a6e['bucket']));return createBucket(_0x1a36b3[_0xff74('0x8b')],_0x1a36b3[_0xff74('0x8c')],_0x2d0a6e[_0xff74('0x82')],_0x2d0a6e[_0xff74('0x76')]);}logger[_0xff74('0x69')](util[_0xff74('0x35')](_0xff74('0x91'),_0xb506eb[_0xff74('0x4a')]['id'],_0x2d0a6e['bucket']));return;}})[_0xff74('0x28')](function(_0x2c36b0){if(_0x1cebe5[_0xff74('0x7c')]===_0xff74('0x92')){return transcribe(_0xb506eb[_0xff74('0x4a')]['id'],_0x1a36b3[_0xff74('0x8b')],_0x1a36b3[_0xff74('0x8c')],_0x2d0a6e[_0xff74('0x82')],_0x2d0a6e['bucket'],_0x1cebe5[_0xff74('0x53')],_0x2d0a6e[_0xff74('0x87')]);}else{logger['info'](util[_0xff74('0x35')](_0xff74('0x93'),_0xb506eb[_0xff74('0x4a')]['id']));return{'transcribeStatus':_0xff74('0x94')};}})[_0xff74('0x28')](function(_0x2516de){if(_0x2516de){_0x2516de[_0xff74('0x95')]=_0xb506eb[_0xff74('0x4f')]['runSentiment'];return _0x1cebe5[_0xff74('0x96')](_0x2516de);}})['then'](respondWithResult(_0x3788ee,null))[_0xff74('0x48')](handleError(_0x3788ee,null));};function writeFile(_0x3d07e4,_0x2a9e4b){return new Promise(function(_0x177136,_0x3b9dbb){fs['writeFile'](_0x2a9e4b,_0x3d07e4,function(_0x29d151,_0x284e36){if(_0x29d151){return _0x3b9dbb(_0x29d151);}else{return _0x177136(_0x284e36);}});});}exports[_0xff74('0x97')]=function(_0x168885,_0x5c0e9f,_0x21f96f){return db[_0xff74('0x2f')][_0xff74('0x7f')]({'where':{'id':_0x168885['params']['id']}})[_0xff74('0x28')](handleEntityNotFound(_0x5c0e9f))[_0xff74('0x28')](function(_0x5f3304){if(_0x5f3304&&_0x5f3304[_0xff74('0x98')]){var _0x34cd35=_0x5f3304[_0xff74('0x98')];var _0x14a6b0=config['root']+'/server/files/transcribes/transcribe_'+_0x5f3304['id']+_0xff74('0x99');if(fs[_0xff74('0x55')](_0x14a6b0)){return _0x14a6b0;}return writeFile(_0x34cd35,_0x14a6b0)[_0xff74('0x28')](function(){return _0x14a6b0;});}else{throw new db[(_0xff74('0x59'))][(_0xff74('0x5a'))]('Transcript\x20not\x20available');}})[_0xff74('0x28')](function(_0xaa82b3){return _0x5c0e9f['download'](_0xaa82b3);})[_0xff74('0x48')](handleError(_0x5c0e9f));}; \ No newline at end of file +var _0xec69=['includeAll','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','recording','Sequelize','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','createBucket','upload','TranscribeService','startTranscriptionJob','[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]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','Setting','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x2df01d,_0x558c69){var _0x2c77de=function(_0x34b4ef){while(--_0x34b4ef){_0x2df01d['push'](_0x2df01d['shift']());}};_0x2c77de(++_0x558c69);}(_0xec69,0x184));var _0x9ec6=function(_0x1c73b1,_0x5c6f36){_0x1c73b1=_0x1c73b1-0x0;var _0x4b9c7c=_0xec69[_0x1c73b1];return _0x4b9c7c;};'use strict';var emlformat=require(_0x9ec6('0x0'));var rimraf=require(_0x9ec6('0x1'));var zipdir=require(_0x9ec6('0x2'));var jsonpatch=require(_0x9ec6('0x3'));var rp=require(_0x9ec6('0x4'));var moment=require(_0x9ec6('0x5'));var BPromise=require(_0x9ec6('0x6'));var Mustache=require(_0x9ec6('0x7'));var util=require('util');var path=require(_0x9ec6('0x8'));var sox=require('sox');var csv=require(_0x9ec6('0x9'));var ejs=require(_0x9ec6('0xa'));var fs=require('fs');var fs_extra=require(_0x9ec6('0xb'));var _=require(_0x9ec6('0xc'));var squel=require('squel');var crypto=require(_0x9ec6('0xd'));var jsforce=require(_0x9ec6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9ec6('0x9'));var querystring=require(_0x9ec6('0xf'));var Papa=require(_0x9ec6('0x10'));var AWS=require(_0x9ec6('0x11'));var uuidv4=require(_0x9ec6('0x12'));var Redis=require(_0x9ec6('0x13'));var authService=require(_0x9ec6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9ec6('0x15'));var hardwareService=require(_0x9ec6('0x16'));var logger=require(_0x9ec6('0x17'))(_0x9ec6('0x18'));var utils=require(_0x9ec6('0x19'));var config=require(_0x9ec6('0x1a'));var licenseUtil=require(_0x9ec6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb6d1f3,_0xef2ab4){_0xef2ab4=_0xef2ab4||0xcc;return function(_0x54486d){if(_0x54486d){return _0xb6d1f3[_0x9ec6('0x1c')](_0xef2ab4);}return _0xb6d1f3[_0x9ec6('0x1d')](_0xef2ab4)[_0x9ec6('0x1e')]();};}function respondWithResult(_0x5e26e4,_0x11142e){_0x11142e=_0x11142e||0xc8;return function(_0x769bc1){if(_0x769bc1){return _0x5e26e4[_0x9ec6('0x1d')](_0x11142e)[_0x9ec6('0x1f')](_0x769bc1);}};}function respondWithFilteredResult(_0x1feaf6,_0xc87648){return function(_0x5d840e){if(_0x5d840e){var _0x1dc817=typeof _0xc87648[_0x9ec6('0x20')]==='undefined'&&typeof _0xc87648['limit']==='undefined';var _0x25bceb=_0x5d840e[_0x9ec6('0x21')];var _0x4cebfb=_0x1dc817?0x0:_0xc87648['offset'];var _0x3ccbba=_0x1dc817?_0x5d840e['count']:_0xc87648[_0x9ec6('0x20')]+_0xc87648[_0x9ec6('0x22')];var _0x1dd6bc;if(_0x3ccbba>=_0x25bceb){_0x3ccbba=_0x25bceb;_0x1dd6bc=0xc8;}else{_0x1dd6bc=0xce;}_0x1feaf6[_0x9ec6('0x1d')](_0x1dd6bc);return _0x1feaf6[_0x9ec6('0x23')]('Content-Range',_0x4cebfb+'-'+_0x3ccbba+'/'+_0x25bceb)[_0x9ec6('0x1f')](_0x5d840e);}return null;};}function patchUpdates(_0x560f45){return function(_0x2a89f4){try{jsonpatch[_0x9ec6('0x24')](_0x2a89f4,_0x560f45,!![]);}catch(_0x487d5f){return BPromise[_0x9ec6('0x25')](_0x487d5f);}return _0x2a89f4[_0x9ec6('0x26')]();};}function saveUpdates(_0x53163d,_0x431450){return function(_0x14c332){if(_0x14c332){return _0x14c332[_0x9ec6('0x27')](_0x53163d)['then'](function(_0x59e8b2){return _0x59e8b2;});}return null;};}function removeEntity(_0x576ad1,_0x1ab61d){return function(_0x1c2485){if(_0x1c2485){return _0x1c2485[_0x9ec6('0x28')]()[_0x9ec6('0x29')](function(){_0x576ad1[_0x9ec6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ddddd,_0x1d8fb3){return function(_0x5d78a7){if(!_0x5d78a7){_0x3ddddd[_0x9ec6('0x1c')](0x194);}return _0x5d78a7;};}function handleError(_0x3f89f1,_0x2c52be){_0x2c52be=_0x2c52be||0x1f4;return function(_0x9d1d8b){logger[_0x9ec6('0x2a')](_0x9d1d8b[_0x9ec6('0x2b')]);if(_0x9d1d8b[_0x9ec6('0x2c')]){delete _0x9d1d8b[_0x9ec6('0x2c')];}_0x3f89f1[_0x9ec6('0x1d')](_0x2c52be)['send'](_0x9d1d8b);};}exports[_0x9ec6('0x2d')]=function(_0xae9df5,_0x37c4df){var _0x3f4ec0={},_0x295a5c={},_0x507c26={'count':0x0,'rows':[]};var _0x5deeb1=_[_0x9ec6('0x2e')](db[_0x9ec6('0x2f')][_0x9ec6('0x30')],function(_0x1f2b98){return{'name':_0x1f2b98[_0x9ec6('0x31')],'type':_0x1f2b98[_0x9ec6('0x32')]['key']};});_0x295a5c['model']=_[_0x9ec6('0x33')](_[_0x9ec6('0x2e')](_0x5deeb1,'name'),[_0x9ec6('0x34')]);_0x295a5c[_0x9ec6('0x35')]=_[_0x9ec6('0x36')](_0xae9df5[_0x9ec6('0x35')]);_0x295a5c[_0x9ec6('0x37')]=_['intersection'](_0x295a5c[_0x9ec6('0x38')],_0x295a5c[_0x9ec6('0x35')]);_0x3f4ec0['attributes']=_[_0x9ec6('0x39')](_0x295a5c['model'],qs[_0x9ec6('0x3a')](_0xae9df5[_0x9ec6('0x35')][_0x9ec6('0x3a')]));_0x3f4ec0[_0x9ec6('0x3b')]=_0x3f4ec0[_0x9ec6('0x3b')][_0x9ec6('0x3c')]?_0x3f4ec0[_0x9ec6('0x3b')]:_0x295a5c[_0x9ec6('0x38')];if(!_0xae9df5[_0x9ec6('0x35')][_0x9ec6('0x3d')](_0x9ec6('0x3e'))){_0x3f4ec0[_0x9ec6('0x22')]=qs[_0x9ec6('0x22')](_0xae9df5['query']['limit']);_0x3f4ec0['offset']=qs['offset'](_0xae9df5['query'][_0x9ec6('0x20')]);}_0x3f4ec0[_0x9ec6('0x3f')]=qs['sort'](_0xae9df5[_0x9ec6('0x35')][_0x9ec6('0x40')]);_0x3f4ec0[_0x9ec6('0x41')]=qs[_0x9ec6('0x37')](_[_0x9ec6('0x42')](_0xae9df5[_0x9ec6('0x35')],_0x295a5c[_0x9ec6('0x37')]),_0x5deeb1);if(_0xae9df5[_0x9ec6('0x35')][_0x9ec6('0x43')]){_0x3f4ec0['where']=_[_0x9ec6('0x44')](_0x3f4ec0[_0x9ec6('0x41')],{'$or':_[_0x9ec6('0x2e')](_0x5deeb1,function(_0x2b0209){if(_0x2b0209[_0x9ec6('0x32')]!==_0x9ec6('0x45')){var _0x1a2722={};_0x1a2722[_0x2b0209[_0x9ec6('0x2c')]]={'$like':'%'+_0xae9df5[_0x9ec6('0x35')][_0x9ec6('0x43')]+'%'};return _0x1a2722;}})});}_0x3f4ec0=_[_0x9ec6('0x44')]({},_0x3f4ec0,_0xae9df5[_0x9ec6('0x46')]);var _0x4faf6d={'where':_0x3f4ec0['where']};return db['VoiceRecording'][_0x9ec6('0x21')](_0x4faf6d)['then'](function(_0x48560a){_0x507c26[_0x9ec6('0x21')]=_0x48560a;if(_0xae9df5[_0x9ec6('0x35')]['includeAll']){_0x3f4ec0[_0x9ec6('0x47')]=[{'all':!![]}];}return db[_0x9ec6('0x2f')][_0x9ec6('0x48')](_0x3f4ec0);})['then'](function(_0x9584d0){_0x507c26[_0x9ec6('0x49')]=_0x9584d0;return _0x507c26;})[_0x9ec6('0x29')](respondWithFilteredResult(_0x37c4df,_0x3f4ec0))[_0x9ec6('0x4a')](handleError(_0x37c4df,null));};exports[_0x9ec6('0x4b')]=function(_0x228628,_0x174420){var _0x247172={'raw':![],'where':{'id':_0x228628[_0x9ec6('0x4c')]['id']}},_0x2a9301={};_0x2a9301[_0x9ec6('0x38')]=_[_0x9ec6('0x36')](db[_0x9ec6('0x2f')][_0x9ec6('0x30')]);_0x2a9301[_0x9ec6('0x35')]=_[_0x9ec6('0x36')](_0x228628[_0x9ec6('0x35')]);_0x2a9301['filters']=_[_0x9ec6('0x39')](_0x2a9301[_0x9ec6('0x38')],_0x2a9301['query']);_0x247172[_0x9ec6('0x3b')]=_[_0x9ec6('0x39')](_0x2a9301[_0x9ec6('0x38')],qs['fields'](_0x228628[_0x9ec6('0x35')][_0x9ec6('0x3a')]));_0x247172[_0x9ec6('0x3b')]=_0x247172[_0x9ec6('0x3b')][_0x9ec6('0x3c')]?_0x247172[_0x9ec6('0x3b')]:_0x2a9301['model'];if(_0x228628[_0x9ec6('0x35')][_0x9ec6('0x4d')]){_0x247172['include']=[{'all':!![]}];}_0x247172=_[_0x9ec6('0x44')]({},_0x247172,_0x228628[_0x9ec6('0x46')]);return db[_0x9ec6('0x2f')][_0x9ec6('0x4e')](_0x247172)[_0x9ec6('0x29')](handleEntityNotFound(_0x174420,null))[_0x9ec6('0x29')](respondWithResult(_0x174420,null))['catch'](handleError(_0x174420,null));};exports[_0x9ec6('0x4f')]=function(_0x55607b,_0x47c9a6){return db[_0x9ec6('0x2f')][_0x9ec6('0x4f')](_0x55607b['body'],{})[_0x9ec6('0x29')](respondWithResult(_0x47c9a6,0xc9))[_0x9ec6('0x4a')](handleError(_0x47c9a6,null));};exports[_0x9ec6('0x27')]=function(_0x138991,_0x37b730){if(_0x138991[_0x9ec6('0x50')]['id']){delete _0x138991[_0x9ec6('0x50')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x138991[_0x9ec6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37b730,null))['then'](saveUpdates(_0x138991[_0x9ec6('0x50')],null))['then'](respondWithResult(_0x37b730,null))[_0x9ec6('0x4a')](handleError(_0x37b730,null));};exports[_0x9ec6('0x51')]=function(_0x4b536c,_0x37a401){return db[_0x9ec6('0x2f')][_0x9ec6('0x51')]()[_0x9ec6('0x29')](respondWithResult(_0x37a401,null))['catch'](handleError(_0x37a401,null));};exports[_0x9ec6('0x52')]=function(_0x22aad4,_0xecacd0,_0x3a3b30){var _0x41a96b=require('../../components/encryptor');var _0x842b47=![];var _0x4855ff={};if(_0x22aad4[_0x9ec6('0x35')][_0x9ec6('0x32')]&&_0x22aad4[_0x9ec6('0x35')][_0x9ec6('0x32')]===_0x9ec6('0x53')){_0x4855ff[_0x9ec6('0x53')]=_0x22aad4['params']['id'];}else{_0x4855ff['id']=_0x22aad4[_0x9ec6('0x4c')]['id'];}return db['VoiceRecording'][_0x9ec6('0x4e')]({'where':_0x4855ff,'attributes':['id','value'],'raw':!![]})[_0x9ec6('0x29')](handleEntityNotFound(_0xecacd0,null))[_0x9ec6('0x29')](function(_0x235aaf){if(_0x235aaf){var _0x3f180f=_0x235aaf[_0x9ec6('0x54')];var _0x16d242=util['format'](_0x9ec6('0x55'),_0x3f180f);if(fs[_0x9ec6('0x56')](_0x16d242)){_0x842b47=!![];return _0x41a96b[_0x9ec6('0x57')](_0x16d242,_0x3f180f,config[_0x9ec6('0x58')]['recording'])[_0x9ec6('0x29')](function(){return _0x235aaf;});}return _0x235aaf;}})['then'](function(_0x450668){if(_0x450668){var _0x13ef36=_0x450668[_0x9ec6('0x54')];if(!fs[_0x9ec6('0x56')](_0x13ef36)){throw new db['Sequelize'][(_0x9ec6('0x59'))](_0x9ec6('0x5a'));}if(_0x450668[_0x9ec6('0x5b')]){return _0xecacd0[_0x9ec6('0x52')](_0x13ef36,_0x450668[_0x9ec6('0x5b')]+path[_0x9ec6('0x5c')](_0x13ef36),function(){if(_0x842b47){fs[_0x9ec6('0x5d')](_0x13ef36);}});}else{return _0xecacd0['download'](_0x13ef36,function(_0x2e2130){if(_0x842b47){fs[_0x9ec6('0x5d')](_0x13ef36);}});}}})['catch'](function(_0x4155bb){if(_0x4155bb['message']==='VoiceRecording\x20not\x20found'){_0xecacd0[_0x9ec6('0x1d')](0x194)[_0x9ec6('0x5e')]('Not\x20found');}else{return handleError(_0xecacd0,null);}});};exports[_0x9ec6('0x5f')]=function(_0x5e7f97,_0x73ed01,_0x453bef){var _0x1dc2e4=require(_0x9ec6('0x60'));var _0x1608a5=![];var _0x251814={'$and':[db[_0x9ec6('0x61')][_0x9ec6('0x41')](db[_0x9ec6('0x61')]['fn'](_0x9ec6('0x62'),db['sequelize'][_0x9ec6('0x63')](_0x9ec6('0x53'))),_0x5e7f97[_0x9ec6('0x35')][_0x9ec6('0x64')])]};if(_0x5e7f97[_0x9ec6('0x35')][_0x9ec6('0x32')]&&_0x5e7f97[_0x9ec6('0x35')][_0x9ec6('0x32')]===_0x9ec6('0x53')){_0x251814[_0x9ec6('0x65')]['push']({'uniqueid':_0x5e7f97[_0x9ec6('0x4c')]['id']});}else{_0x251814['$and']['push']({'id':_0x5e7f97['params']['id']});}return db[_0x9ec6('0x2f')][_0x9ec6('0x4e')]({'where':_0x251814,'attributes':['id',_0x9ec6('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x73ed01,null))['then'](function(_0x40efe4){if(_0x40efe4){var _0xe4ad7a=util[_0x9ec6('0x34')](_0x9ec6('0x55'),_0x40efe4[_0x9ec6('0x54')]);if(fs['existsSync'](_0xe4ad7a)){_0x1608a5=!![];return _0x1dc2e4[_0x9ec6('0x57')](_0xe4ad7a,_0x40efe4[_0x9ec6('0x54')],config[_0x9ec6('0x58')][_0x9ec6('0x66')])[_0x9ec6('0x29')](function(){return _0x40efe4;});}return _0x40efe4;}})['then'](function(_0x240fcf){if(_0x240fcf){if(!fs[_0x9ec6('0x56')](_0x240fcf[_0x9ec6('0x54')])){throw new db[(_0x9ec6('0x67'))][(_0x9ec6('0x59'))](_0x9ec6('0x5a'));}if(_0x240fcf['filename']){return _0x73ed01['download'](_0x240fcf[_0x9ec6('0x54')],_0x240fcf[_0x9ec6('0x5b')]+path[_0x9ec6('0x5c')](_0x240fcf[_0x9ec6('0x54')]),function(){if(_0x1608a5){fs[_0x9ec6('0x5d')](_0x240fcf[_0x9ec6('0x54')]);}});}else{return _0x73ed01['download'](_0x240fcf[_0x9ec6('0x54')],function(_0x4f4b52){if(_0x1608a5){fs[_0x9ec6('0x5d')](_0x240fcf[_0x9ec6('0x54')]);}});}}})['catch'](handleError(_0x73ed01,null));};exports['destroy']=function(_0x4c0020,_0x552a97){return db['VoiceRecording']['find']({'where':{'id':_0x4c0020['params']['id']}})[_0x9ec6('0x29')](function(_0x53b32c){if(_[_0x9ec6('0x68')](_0x53b32c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x53b32c;})[_0x9ec6('0x29')](function(_0x245e0a){var _0x1e6199=_0x245e0a[_0x9ec6('0x54')];logger[_0x9ec6('0x69')](_0x9ec6('0x6a'),_0x1e6199);if(!_[_0x9ec6('0x68')](_0x245e0a[_0x9ec6('0x54')])&&fs[_0x9ec6('0x56')](_0x1e6199)){logger[_0x9ec6('0x69')]('File:\x20\x22'+_0x1e6199+_0x9ec6('0x6b'));fs[_0x9ec6('0x6c')](_0x1e6199);}_0x1e6199=_0x1e6199+_0x9ec6('0x6d');if(!_[_0x9ec6('0x68')](_0x245e0a[_0x9ec6('0x54')])&&fs[_0x9ec6('0x56')](_0x1e6199)){logger['info'](_0x9ec6('0x6e')+_0x1e6199+_0x9ec6('0x6b'));fs[_0x9ec6('0x6c')](_0x1e6199);}return _0x245e0a;})[_0x9ec6('0x29')](function(_0x5165af){if(!_0x5165af)throw new InternalError();return _0x5165af[_0x9ec6('0x28')]();})[_0x9ec6('0x29')](function(){_0x552a97['status'](0xcc)[_0x9ec6('0x1e')]();})[_0x9ec6('0x4a')](handleError(_0x552a97,null));};function getBucketslist(_0x5ccbcb,_0x2357e3,_0x525e87){return new Promise(function(_0x4d40b6,_0x280c6c){var _0x5be4ad=new AWS['S3']({'accessKeyId':_0x2357e3,'secretAccessKey':_0x5ccbcb,'region':_0x525e87});_0x5be4ad['listBuckets']({},function(_0x2de1ec,_0x4d913d){if(_0x2de1ec){return _0x280c6c(_0x2de1ec);}else{return _0x4d40b6(_0x4d913d);}});});}function createBucket(_0x1b7457,_0x407477,_0x3feff6,_0x22437b){return new Promise(function(_0x50af1b,_0x1870a){var _0x11d199=new AWS['S3']({'accessKeyId':_0x407477,'secretAccessKey':_0x1b7457,'region':_0x3feff6});_0x11d199[_0x9ec6('0x6f')]({'Bucket':_0x22437b},function(_0x1f8fe1,_0x507418){if(_0x1f8fe1){return _0x1870a(_0x1f8fe1);}else{return _0x50af1b(_0x507418);}});});}function uploadFile(_0x2d76f4,_0x3a0e05,_0x354f07,_0x22e04d,_0x4caa69,_0x26be15){return new Promise(function(_0x5ad503,_0x2e95fe){var _0x546c4a=new AWS['S3']({'accessKeyId':_0x3a0e05,'secretAccessKey':_0x2d76f4,'region':_0x354f07});_0x546c4a[_0x9ec6('0x70')]({'Bucket':_0x22e04d,'Key':_0x4caa69,'Body':_0x26be15},function(_0x2814bc,_0xf6015d){if(_0x2814bc){return _0x2e95fe(_0x2814bc);}else{return _0x5ad503(_0xf6015d);}});});}function startTranscribe(_0x84993d,_0x1aeba2,_0x5dbdd3,_0x526bdb,_0x25ead0,_0x36acda){return new Promise(function(_0x433e22,_0x2a55c7){var _0x34a7dd=new AWS[(_0x9ec6('0x71'))]({'accessKeyId':_0x1aeba2,'secretAccessKey':_0x84993d,'region':_0x5dbdd3});_0x34a7dd[_0x9ec6('0x72')]({'TranscriptionJobName':_0x526bdb,'LanguageCode':_0x25ead0,'Media':{'MediaFileUri':_0x36acda}},function(_0x38ad33,_0x2629e3){if(_0x38ad33){return _0x2a55c7(_0x38ad33);}else{return _0x433e22(_0x2629e3);}});});}function transcribe(_0x5ad9f4,_0x5a2078,_0x27c147,_0x53a340,_0x3f63d5,_0x43bb96,_0x2ddd5d){return new Promise(function(_0x273f1a,_0x482f28){var _0x58add0={};logger[_0x9ec6('0x69')](util[_0x9ec6('0x34')](_0x9ec6('0x73'),_0x5ad9f4,_0x3f63d5));return uploadFile(_0x5a2078,_0x27c147,_0x53a340,_0x3f63d5,path[_0x9ec6('0x74')](_0x43bb96),fs['readFileSync'](_0x43bb96))[_0x9ec6('0x29')](function(_0x1e9c12){logger[_0x9ec6('0x69')](util[_0x9ec6('0x34')](_0x9ec6('0x75'),_0x5ad9f4,_0x3f63d5,_0x1e9c12[_0x9ec6('0x76')]));_0x58add0[_0x9ec6('0x77')]=_0x1e9c12[_0x9ec6('0x78')];_0x58add0[_0x9ec6('0x79')]=_0x1e9c12[_0x9ec6('0x76')];logger[_0x9ec6('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x5ad9f4));return startTranscribe(_0x5a2078,_0x27c147,_0x53a340,uuidv4(),_0x2ddd5d,_0x1e9c12['Location']);})[_0x9ec6('0x29')](function(_0x3db964){logger[_0x9ec6('0x69')](util[_0x9ec6('0x34')](_0x9ec6('0x7a'),_0x5ad9f4,_0x3db964[_0x9ec6('0x7b')][_0x9ec6('0x7c')]));_0x58add0[_0x9ec6('0x7d')]=_0x3db964['TranscriptionJob'][_0x9ec6('0x7c')];_0x58add0['transcribeStatus']=_0x3db964[_0x9ec6('0x7b')][_0x9ec6('0x7e')];return _0x273f1a(_0x58add0);})[_0x9ec6('0x4a')](function(_0x4c2a99){return _0x482f28(_0x4c2a99);});});}exports['runTranscribe']=function(_0x9c70a6,_0x4ed232,_0x232dc7){var _0x11fa0a;var _0x2190d2;var _0x10f02f;var _0x863917=require(_0x9ec6('0x60'));return db[_0x9ec6('0x2f')]['findOne']({'where':{'id':_0x9c70a6[_0x9ec6('0x4c')]['id']}})[_0x9ec6('0x29')](function(_0x5686af){if(_0x5686af){var _0xf95b89=util[_0x9ec6('0x34')](_0x9ec6('0x55'),_0x5686af['value']);if(fs[_0x9ec6('0x56')](_0xf95b89)){cypher=!![];return _0x863917['decryptFile'](_0xf95b89,_0x5686af[_0x9ec6('0x54')],config[_0x9ec6('0x58')][_0x9ec6('0x66')])['then'](function(){return _0x5686af;});}return _0x5686af;}})[_0x9ec6('0x29')](function(_0x35e687){if(!_0x35e687){throw new db['Sequelize']['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x2190d2=_0x35e687;return db[_0x9ec6('0x7f')][_0x9ec6('0x80')]({'where':{'id':0x1}});})[_0x9ec6('0x29')](handleEntityNotFound(_0x4ed232,null))['then'](function(_0x2a94ec){if(_0x2a94ec){_0x11fa0a=_0x2a94ec;if(!_0x11fa0a['transcribe']||!_0x11fa0a[_0x9ec6('0x81')]||!_0x11fa0a[_0x9ec6('0x82')]||!_0x11fa0a[_0x9ec6('0x83')]||!_0x11fa0a[_0x9ec6('0x77')]){throw new db['Sequelize'][(_0x9ec6('0x59'))](_0x9ec6('0x84'));}if(_0x9c70a6[_0x9ec6('0x50')]['runSentiment']&&(!_0x11fa0a[_0x9ec6('0x85')]||!_0x11fa0a[_0x9ec6('0x86')]||!_0x11fa0a[_0x9ec6('0x87')]||!_0x11fa0a[_0x9ec6('0x83')]||!_0x11fa0a[_0x9ec6('0x77')])){throw new db[(_0x9ec6('0x67'))][(_0x9ec6('0x59'))](_0x9ec6('0x88'));}return db[_0x9ec6('0x89')][_0x9ec6('0x80')]({'where':{'id':_0x11fa0a[_0x9ec6('0x81')]}});}})[_0x9ec6('0x29')](function(_0x218e0f){if(!_0x218e0f){throw new db[(_0x9ec6('0x67'))][(_0x9ec6('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x218e0f[_0x9ec6('0x8a')]||!_0x218e0f[_0x9ec6('0x8b')]){throw new db['Sequelize'][(_0x9ec6('0x59'))](_0x9ec6('0x8c'));}_0x10f02f=_0x218e0f;return getBucketslist(_0x10f02f[_0x9ec6('0x8a')],_0x10f02f['data2'],_0x11fa0a[_0x9ec6('0x82')]);})[_0x9ec6('0x29')](function(_0x945d7f){if(_0x945d7f&&_0x945d7f[_0x9ec6('0x8d')]){var _0x4522f3=_[_0x9ec6('0x4e')](_0x945d7f[_0x9ec6('0x8d')],function(_0x3148d8){return _0x3148d8[_0x9ec6('0x8e')]===_0x11fa0a[_0x9ec6('0x77')];});if(!_0x4522f3){logger[_0x9ec6('0x69')](util['format'](_0x9ec6('0x8f'),_0x9c70a6['params']['id'],_0x11fa0a[_0x9ec6('0x77')]));return createBucket(_0x10f02f[_0x9ec6('0x8a')],_0x10f02f[_0x9ec6('0x8b')],_0x11fa0a[_0x9ec6('0x82')],_0x11fa0a[_0x9ec6('0x77')]);}logger[_0x9ec6('0x69')](util[_0x9ec6('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x9c70a6[_0x9ec6('0x4c')]['id'],_0x11fa0a[_0x9ec6('0x77')]));return;}})['then'](function(_0x793fa8){if(_0x2190d2[_0x9ec6('0x90')]==='NEW'){return transcribe(_0x9c70a6[_0x9ec6('0x4c')]['id'],_0x10f02f['data1'],_0x10f02f[_0x9ec6('0x8b')],_0x11fa0a['transcribeRegion'],_0x11fa0a['bucket'],_0x2190d2[_0x9ec6('0x54')],_0x11fa0a[_0x9ec6('0x83')]);}else{logger[_0x9ec6('0x69')](util[_0x9ec6('0x34')](_0x9ec6('0x91'),_0x9c70a6[_0x9ec6('0x4c')]['id']));return{'transcribeStatus':_0x9ec6('0x92')};}})[_0x9ec6('0x29')](function(_0xf8293c){if(_0xf8293c){_0xf8293c[_0x9ec6('0x93')]=_0x9c70a6[_0x9ec6('0x50')][_0x9ec6('0x94')];return _0x2190d2[_0x9ec6('0x95')](_0xf8293c);}})[_0x9ec6('0x29')](respondWithResult(_0x4ed232,null))[_0x9ec6('0x4a')](handleError(_0x4ed232,null));};function writeFile(_0x195656,_0x1cf4fe){return new Promise(function(_0x23e436,_0x1135b5){fs[_0x9ec6('0x96')](_0x1cf4fe,_0x195656,function(_0x4f50c,_0x4984ac){if(_0x4f50c){return _0x1135b5(_0x4f50c);}else{return _0x23e436(_0x4984ac);}});});}exports['downloadTranscribe']=function(_0x5eb5c6,_0x34e23f,_0xfdf21f){return db[_0x9ec6('0x2f')][_0x9ec6('0x80')]({'where':{'id':_0x5eb5c6[_0x9ec6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34e23f))[_0x9ec6('0x29')](function(_0x2c9bdb){if(_0x2c9bdb&&_0x2c9bdb[_0x9ec6('0x97')]){var _0xb91acd=_0x2c9bdb['fileText'];var _0x42e970=config[_0x9ec6('0x98')]+'/server/files/transcribes/transcribe_'+_0x2c9bdb['id']+_0x9ec6('0x99');if(fs[_0x9ec6('0x56')](_0x42e970)){return _0x42e970;}return writeFile(_0xb91acd,_0x42e970)[_0x9ec6('0x29')](function(){return _0x42e970;});}else{throw new db[(_0x9ec6('0x67'))][(_0x9ec6('0x59'))](_0x9ec6('0x9a'));}})[_0x9ec6('0x29')](function(_0x496e74){return _0x34e23f[_0x9ec6('0x52')](_0x496e74);})[_0x9ec6('0x4a')](handleError(_0x34e23f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5dfd3cd..381e65f 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 _0x41d5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x508926,_0xa05b4f){var _0x49ab00=function(_0x360b74){while(--_0x360b74){_0x508926['push'](_0x508926['shift']());}};_0x49ab00(++_0xa05b4f);}(_0x41d5,0x7e));var _0x541d=function(_0x10ed34,_0x133ee2){_0x10ed34=_0x10ed34-0x0;var _0x1ebc77=_0x41d5[_0x10ed34];return _0x1ebc77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x541d('0x0'))(_0x541d('0x1'));var moment=require(_0x541d('0x2'));var BPromise=require(_0x541d('0x3'));var rp=require(_0x541d('0x4'));var fs=require('fs');var path=require(_0x541d('0x5'));var rimraf=require(_0x541d('0x6'));var config=require(_0x541d('0x7'));var attributes=require(_0x541d('0x8'));module[_0x541d('0x9')]=function(_0x48614c,_0x4933a5){return _0x48614c[_0x541d('0xa')](_0x541d('0xb'),attributes,{'tableName':_0x541d('0xc'),'paranoid':![],'indexes':[{'name':_0x541d('0xd'),'fields':[_0x541d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4959=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceRecording','voice_recordings','uniqueid','../../config/logger'];(function(_0x1299ef,_0x1489b2){var _0xfea73a=function(_0x3d002d){while(--_0x3d002d){_0x1299ef['push'](_0x1299ef['shift']());}};_0xfea73a(++_0x1489b2);}(_0x4959,0x9b));var _0x9495=function(_0x2175fc,_0x3060e8){_0x2175fc=_0x2175fc-0x0;var _0x21dac1=_0x4959[_0x2175fc];return _0x21dac1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9495('0x0'))(_0x9495('0x1'));var moment=require(_0x9495('0x2'));var BPromise=require('bluebird');var rp=require(_0x9495('0x3'));var fs=require('fs');var path=require(_0x9495('0x4'));var rimraf=require(_0x9495('0x5'));var config=require(_0x9495('0x6'));var attributes=require('./voiceRecording.attributes');module[_0x9495('0x7')]=function(_0x2225a0,_0x2c716d){return _0x2225a0[_0x9495('0x8')](_0x9495('0x9'),attributes,{'tableName':_0x9495('0xa'),'paranoid':![],'indexes':[{'name':_0x9495('0xb'),'fields':[_0x9495('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e1f7265..c349039 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 _0x896e=['body','options','raw','where','attributes','limit','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update'];(function(_0x3db66c,_0x387885){var _0x56ea11=function(_0x12a8a8){while(--_0x12a8a8){_0x3db66c['push'](_0x3db66c['shift']());}};_0x56ea11(++_0x387885);}(_0x896e,0x1e9));var _0xe896=function(_0x100546,_0x5d79de){_0x100546=_0x100546-0x0;var _0xceec26=_0x896e[_0x100546];return _0xceec26;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});}exports[_0xe896('0x18')]=function(_0x32f86d){var _0x2d4cf0=this;return new Promise(function(_0x5dc89d,_0x782813){return db[_0xe896('0x19')][_0xe896('0x1a')](_0x32f86d[_0xe896('0x1b')],{'raw':_0x32f86d[_0xe896('0x1c')]?_0x32f86d[_0xe896('0x1c')][_0xe896('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32f86d[_0xe896('0x1c')]?_0x32f86d['options'][_0xe896('0x1e')]||null:null,'attributes':_0x32f86d['options']?_0x32f86d['options'][_0xe896('0x1f')]||null:null,'limit':_0x32f86d[_0xe896('0x1c')]?_0x32f86d[_0xe896('0x1c')][_0xe896('0x20')]||null:null})['then'](function(_0x468479){logger['info']('UpdateVoiceRecording',_0x32f86d);logger[_0xe896('0x10')](_0xe896('0x18'),_0x32f86d,JSON[_0xe896('0x12')](_0x468479));_0x5dc89d(_0x468479);})[_0xe896('0x17')](function(_0x20e295){logger[_0xe896('0x13')](_0xe896('0x18'),_0x20e295['message'],_0x32f86d);_0x782813(_0x2d4cf0[_0xe896('0x13')](0x1f4,_0x20e295[_0xe896('0x15')]));});});};exports[_0xe896('0x21')]=function(_0x569d5f){var _0x26635e=this;return new Promise(function(_0xd50fe2,_0x2bc11d){var _0xe93aa0=require(_0xe896('0x22'));var _0x3f8ceb;return db['Setting'][_0xe896('0x23')]({'attributes':['id',_0xe896('0x24')],'where':{'id':0x1},'raw':!![]})[_0xe896('0xe')](function(_0xbfb15b){_0x3f8ceb=_0xbfb15b;return db[_0xe896('0x19')]['create'](_0x569d5f['body']);})['then'](function(_0x504d7c){if(_0x3f8ceb['callRecordingEncryption']&&fs[_0xe896('0x25')](_0x504d7c[_0xe896('0x26')])){var _0x10fd26=util[_0xe896('0x27')](_0xe896('0x28'),_0x504d7c[_0xe896('0x26')]);return _0xe93aa0[_0xe896('0x29')](_0x504d7c[_0xe896('0x26')],_0x10fd26,config['secrets']['recording'])[_0xe896('0xe')](function(){fs[_0xe896('0x2a')](_0x504d7c[_0xe896('0x26')]);logger[_0xe896('0x16')]('CreateVoiceRecording\x20file\x20encrypted');return _0x504d7c;});}return _0x504d7c;})[_0xe896('0xe')](function(_0x571e4d){logger['info'](_0xe896('0x21'),_0x569d5f);logger[_0xe896('0x10')](_0xe896('0x21'),_0x569d5f,JSON['stringify'](_0x571e4d));_0xd50fe2(_0x571e4d);})['catch'](function(_0x567589){logger[_0xe896('0x13')](_0xe896('0x21'),_0x567589[_0xe896('0x15')],_0x569d5f);_0x2bc11d(_0x26635e[_0xe896('0x13')](0x1f4,_0x567589[_0xe896('0x15')]));});});}; \ No newline at end of file +var _0x4e2e=['error','message','result','VoiceRecording','update','body','options','raw','attributes','limit','UpdateVoiceRecording','debug','catch','../../components/encryptor','findOne','create','callRecordingEncryption','format','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x265c66,_0x388aee){var _0x580720=function(_0x260e7d){while(--_0x260e7d){_0x265c66['push'](_0x265c66['shift']());}};_0x580720(++_0x388aee);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x42e431,_0x582b69){_0x42e431=_0x42e431-0x0;var _0x4eedf1=_0x4e2e[_0x42e431];return _0x4eedf1;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['UpdateVoiceRecording']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')]['where']||null:null,'attributes':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1a')]||null:null,'limit':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x1b')]||null:null})[_0xe4e2('0xc')](function(_0x51c67e){logger[_0xe4e2('0xd')](_0xe4e2('0x1c'),_0x196f16);logger[_0xe4e2('0x1d')]('UpdateVoiceRecording',_0x196f16,JSON[_0xe4e2('0x11')](_0x51c67e));_0x1d5e9d(_0x51c67e);})[_0xe4e2('0x1e')](function(_0x598fa3){logger[_0xe4e2('0x12')](_0xe4e2('0x1c'),_0x598fa3[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x598fa3[_0xe4e2('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x166610){var _0x357903=this;return new Promise(function(_0x1f6d1f,_0x5120fd){var _0x3a31b8=require(_0xe4e2('0x1f'));var _0x31f651;return db['Setting'][_0xe4e2('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xe4e2('0xc')](function(_0x1e21c0){_0x31f651=_0x1e21c0;return db['VoiceRecording'][_0xe4e2('0x21')](_0x166610[_0xe4e2('0x17')]);})[_0xe4e2('0xc')](function(_0x41500b){if(_0x31f651[_0xe4e2('0x22')]&&fs['existsSync'](_0x41500b['value'])){var _0x2cb235=util[_0xe4e2('0x23')](_0xe4e2('0x24'),_0x41500b[_0xe4e2('0x25')]);return _0x3a31b8[_0xe4e2('0x26')](_0x41500b[_0xe4e2('0x25')],_0x2cb235,config[_0xe4e2('0x27')][_0xe4e2('0x28')])[_0xe4e2('0xc')](function(){fs[_0xe4e2('0x29')](_0x41500b[_0xe4e2('0x25')]);logger[_0xe4e2('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x41500b;});}return _0x41500b;})[_0xe4e2('0xc')](function(_0x8ffc6){logger[_0xe4e2('0xd')](_0xe4e2('0x2a'),_0x166610);logger[_0xe4e2('0x1d')](_0xe4e2('0x2a'),_0x166610,JSON['stringify'](_0x8ffc6));_0x1f6d1f(_0x8ffc6);})[_0xe4e2('0x1e')](function(_0x286714){logger[_0xe4e2('0x12')](_0xe4e2('0x2a'),_0x286714[_0xe4e2('0x13')],_0x166610);_0x5120fd(_0x357903[_0xe4e2('0x12')](0x1f4,_0x286714[_0xe4e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8f59e06..47ab50b 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 _0x9988=['create','put','/:id','update','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','post'];(function(_0x7a3237,_0x56fa08){var _0x341cb1=function(_0x406495){while(--_0x406495){_0x7a3237['push'](_0x7a3237['shift']());}};_0x341cb1(++_0x56fa08);}(_0x9988,0x1ae));var _0x8998=function(_0x1d9e40,_0x1c44db){_0x1d9e40=_0x1d9e40-0x0;var _0x2ee94f=_0x9988[_0x1d9e40];return _0x2ee94f;};'use strict';var multer=require(_0x8998('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8998('0x1'));var express=require(_0x8998('0x2'));var router=express[_0x8998('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8998('0x4'));var interaction=require(_0x8998('0x5'));var config=require(_0x8998('0x6'));var controller=require(_0x8998('0x7'));router[_0x8998('0x8')]('/',auth[_0x8998('0x9')](),controller['index']);router[_0x8998('0x8')]('/describe',auth[_0x8998('0x9')](),controller[_0x8998('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8998('0xb')]('/',auth['isAuthenticated'](),controller[_0x8998('0xc')]);router[_0x8998('0xd')](_0x8998('0xe'),auth['isAuthenticated'](),controller[_0x8998('0xf')]);router['delete'](_0x8998('0xe'),auth[_0x8998('0x9')](),controller[_0x8998('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8ad0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','update','destroy'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x8ad0,0x1ed));var _0x08ad=function(_0x34c6a1,_0x3e0f02){_0x34c6a1=_0x34c6a1-0x0;var _0x366f6f=_0x8ad0[_0x34c6a1];return _0x366f6f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x08ad('0x0'));var express=require('express');var router=express[_0x08ad('0x1')]();var fs_extra=require(_0x08ad('0x2'));var auth=require(_0x08ad('0x3'));var interaction=require(_0x08ad('0x4'));var config=require('../../config/environment');var controller=require(_0x08ad('0x5'));router['get']('/',auth[_0x08ad('0x6')](),controller[_0x08ad('0x7')]);router[_0x08ad('0x8')](_0x08ad('0x9'),auth[_0x08ad('0x6')](),controller[_0x08ad('0xa')]);router[_0x08ad('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x08ad('0xb')]);router[_0x08ad('0xc')]('/',auth[_0x08ad('0x6')](),controller[_0x08ad('0xd')]);router[_0x08ad('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x08ad('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x08ad('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 1d69b0c..173be24 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 _0xe67c=['ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x3841a2,_0x41f93b){var _0x3baf87=function(_0x42d31b){while(--_0x42d31b){_0x3841a2['push'](_0x3841a2['shift']());}};_0x3baf87(++_0x41f93b);}(_0xe67c,0x178));var _0xce67=function(_0x1319b1,_0x589002){_0x1319b1=_0x1319b1-0x0;var _0x5419b0=_0xe67c[_0x1319b1];return _0x5419b0;};'use strict';var Sequelize=require(_0xce67('0x0'));var moment=require(_0xce67('0x1'));module['exports']={'type':{'type':Sequelize[_0xce67('0x2')](_0xce67('0x3'),_0xce67('0x4'))},'result':{'type':Sequelize[_0xce67('0x5')]},'transfererchannel':{'type':Sequelize[_0xce67('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xce67('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xce67('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xce67('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xce67('0x5')]},'transferercontext':{'type':Sequelize[_0xce67('0x5')]},'transfererexten':{'type':Sequelize[_0xce67('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xce67('0x5')]},'transfereechannel':{'type':Sequelize[_0xce67('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xce67('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xce67('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xce67('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xce67('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xce67('0x6'),'No')},'context':{'type':Sequelize[_0xce67('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf975=['exports','ENUM','blind','attended','STRING','moment'];(function(_0x10a904,_0x2bf292){var _0x53815a=function(_0x2e6ce4){while(--_0x2e6ce4){_0x10a904['push'](_0x10a904['shift']());}};_0x53815a(++_0x2bf292);}(_0xf975,0x161));var _0x5f97=function(_0x2f2e0e,_0x21a555){_0x2f2e0e=_0x2f2e0e-0x0;var _0xe1467c=_0xf975[_0x2f2e0e];return _0xe1467c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5f97('0x0'));module[_0x5f97('0x1')]={'type':{'type':Sequelize[_0x5f97('0x2')](_0x5f97('0x3'),_0x5f97('0x4'))},'result':{'type':Sequelize[_0x5f97('0x5')]},'transfererchannel':{'type':Sequelize[_0x5f97('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x5f97('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x5f97('0x5')]},'transferercontext':{'type':Sequelize[_0x5f97('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x5f97('0x5')]},'transfereechannel':{'type':Sequelize[_0x5f97('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x5f97('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5f97('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x5f97('0x5')]},'transfereecontext':{'type':Sequelize[_0x5f97('0x5')]},'transfereeexten':{'type':Sequelize[_0x5f97('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x5f97('0x5')]},'isexternal':{'type':Sequelize[_0x5f97('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x5f97('0x5')]},'extension':{'type':Sequelize[_0x5f97('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8df4c47..08ec3de 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 _0xa054=['sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','VoiceTransferReport','includeAll','include','findAll','catch','show','params','length','merge','find','create','body','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xa054,0x1dc));var _0x4a05=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xa054[_0x117f4c];return _0x2b24e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a05('0x0'));var zipdir=require(_0x4a05('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a05('0x2'));var moment=require('moment');var BPromise=require(_0x4a05('0x3'));var Mustache=require(_0x4a05('0x4'));var util=require(_0x4a05('0x5'));var path=require(_0x4a05('0x6'));var sox=require(_0x4a05('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a05('0x8'));var _=require(_0x4a05('0x9'));var squel=require(_0x4a05('0xa'));var crypto=require(_0x4a05('0xb'));var jsforce=require(_0x4a05('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4a05('0xd'));var querystring=require(_0x4a05('0xe'));var Papa=require('papaparse');var Redis=require(_0x4a05('0xf'));var authService=require(_0x4a05('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a05('0x11'));var utils=require(_0x4a05('0x12'));var config=require(_0x4a05('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a05('0x14'))['db'];function respondWithStatusCode(_0x39fcd3,_0x38e1d5){_0x38e1d5=_0x38e1d5||0xcc;return function(_0x2960f1){if(_0x2960f1){return _0x39fcd3['sendStatus'](_0x38e1d5);}return _0x39fcd3['status'](_0x38e1d5)[_0x4a05('0x15')]();};}function respondWithResult(_0xd77daa,_0xcd0747){_0xcd0747=_0xcd0747||0xc8;return function(_0x5d1f01){if(_0x5d1f01){return _0xd77daa[_0x4a05('0x16')](_0xcd0747)[_0x4a05('0x17')](_0x5d1f01);}};}function respondWithFilteredResult(_0x2ac069,_0x17e9b2){return function(_0x4a1493){if(_0x4a1493){var _0x166bc1=typeof _0x17e9b2[_0x4a05('0x18')]===_0x4a05('0x19')&&typeof _0x17e9b2['limit']===_0x4a05('0x19');var _0x2e2547=_0x4a1493[_0x4a05('0x1a')];var _0x58a163=_0x166bc1?0x0:_0x17e9b2[_0x4a05('0x18')];var _0x2c4ce1=_0x166bc1?_0x4a1493['count']:_0x17e9b2[_0x4a05('0x18')]+_0x17e9b2[_0x4a05('0x1b')];var _0x104991;if(_0x2c4ce1>=_0x2e2547){_0x2c4ce1=_0x2e2547;_0x104991=0xc8;}else{_0x104991=0xce;}_0x2ac069[_0x4a05('0x16')](_0x104991);return _0x2ac069['set'](_0x4a05('0x1c'),_0x58a163+'-'+_0x2c4ce1+'/'+_0x2e2547)[_0x4a05('0x17')](_0x4a1493);}return null;};}function patchUpdates(_0x3cbf47){return function(_0x504d85){try{jsonpatch[_0x4a05('0x1d')](_0x504d85,_0x3cbf47,!![]);}catch(_0x167f4a){return BPromise[_0x4a05('0x1e')](_0x167f4a);}return _0x504d85[_0x4a05('0x1f')]();};}function saveUpdates(_0x193ed9,_0x4bca61){return function(_0x101acb){if(_0x101acb){return _0x101acb['update'](_0x193ed9)[_0x4a05('0x20')](function(_0x230f66){return _0x230f66;});}return null;};}function removeEntity(_0x5cb8db,_0x4e926c){return function(_0x13485f){if(_0x13485f){return _0x13485f[_0x4a05('0x21')]()[_0x4a05('0x20')](function(){_0x5cb8db[_0x4a05('0x16')](0xcc)[_0x4a05('0x15')]();});}};}function handleEntityNotFound(_0x3cd2fa,_0x532f9f){return function(_0x3173a3){if(!_0x3173a3){_0x3cd2fa[_0x4a05('0x22')](0x194);}return _0x3173a3;};}function handleError(_0x36e77a,_0x5d40ff){_0x5d40ff=_0x5d40ff||0x1f4;return function(_0x5a68ce){logger[_0x4a05('0x23')](_0x5a68ce[_0x4a05('0x24')]);if(_0x5a68ce[_0x4a05('0x25')]){delete _0x5a68ce['name'];}_0x36e77a['status'](_0x5d40ff)['send'](_0x5a68ce);};}exports['index']=function(_0x46e3fb,_0x40b229){var _0x3598d7={},_0x455483={},_0x5a6b9e={'count':0x0,'rows':[]};var _0x4d6d1f=_[_0x4a05('0x26')](db['VoiceTransferReport'][_0x4a05('0x27')],function(_0x4f47c7){return{'name':_0x4f47c7['fieldName'],'type':_0x4f47c7[_0x4a05('0x28')]['key']};});_0x455483[_0x4a05('0x29')]=_[_0x4a05('0x26')](_0x4d6d1f,_0x4a05('0x25'));_0x455483[_0x4a05('0x2a')]=_[_0x4a05('0x2b')](_0x46e3fb['query']);_0x455483[_0x4a05('0x2c')]=_[_0x4a05('0x2d')](_0x455483['model'],_0x455483['query']);_0x3598d7['attributes']=_[_0x4a05('0x2d')](_0x455483[_0x4a05('0x29')],qs[_0x4a05('0x2e')](_0x46e3fb[_0x4a05('0x2a')]['fields']));_0x3598d7[_0x4a05('0x2f')]=_0x3598d7[_0x4a05('0x2f')]['length']?_0x3598d7[_0x4a05('0x2f')]:_0x455483['model'];if(!_0x46e3fb[_0x4a05('0x2a')][_0x4a05('0x30')](_0x4a05('0x31'))){_0x3598d7[_0x4a05('0x1b')]=qs[_0x4a05('0x1b')](_0x46e3fb['query']['limit']);_0x3598d7['offset']=qs[_0x4a05('0x18')](_0x46e3fb[_0x4a05('0x2a')][_0x4a05('0x18')]);}_0x3598d7[_0x4a05('0x32')]=qs[_0x4a05('0x33')](_0x46e3fb[_0x4a05('0x2a')][_0x4a05('0x33')]);_0x3598d7[_0x4a05('0x34')]=qs['filters'](_['pick'](_0x46e3fb[_0x4a05('0x2a')],_0x455483[_0x4a05('0x2c')]),_0x4d6d1f);if(_0x46e3fb[_0x4a05('0x2a')]['filter']){_0x3598d7[_0x4a05('0x34')]=_['merge'](_0x3598d7[_0x4a05('0x34')],{'$or':_[_0x4a05('0x26')](_0x4d6d1f,function(_0x363fc1){if(_0x363fc1['type']!==_0x4a05('0x35')){var _0x59643d={};_0x59643d[_0x363fc1[_0x4a05('0x25')]]={'$like':'%'+_0x46e3fb[_0x4a05('0x2a')][_0x4a05('0x36')]+'%'};return _0x59643d;}})});}_0x3598d7=_['merge']({},_0x3598d7,_0x46e3fb[_0x4a05('0x37')]);var _0x10be55={'where':_0x3598d7[_0x4a05('0x34')]};return db[_0x4a05('0x38')][_0x4a05('0x1a')](_0x10be55)[_0x4a05('0x20')](function(_0x385730){_0x5a6b9e[_0x4a05('0x1a')]=_0x385730;if(_0x46e3fb[_0x4a05('0x2a')][_0x4a05('0x39')]){_0x3598d7[_0x4a05('0x3a')]=[{'all':!![]}];}return db[_0x4a05('0x38')][_0x4a05('0x3b')](_0x3598d7);})[_0x4a05('0x20')](function(_0x331d42){_0x5a6b9e['rows']=_0x331d42;return _0x5a6b9e;})[_0x4a05('0x20')](respondWithFilteredResult(_0x40b229,_0x3598d7))[_0x4a05('0x3c')](handleError(_0x40b229,null));};exports[_0x4a05('0x3d')]=function(_0x44003a,_0x18bd7c){var _0x3207b5={'raw':!![],'where':{'id':_0x44003a[_0x4a05('0x3e')]['id']}},_0x42a1ab={};_0x42a1ab['model']=_['keys'](db[_0x4a05('0x38')][_0x4a05('0x27')]);_0x42a1ab[_0x4a05('0x2a')]=_['keys'](_0x44003a[_0x4a05('0x2a')]);_0x42a1ab[_0x4a05('0x2c')]=_[_0x4a05('0x2d')](_0x42a1ab[_0x4a05('0x29')],_0x42a1ab['query']);_0x3207b5['attributes']=_['intersection'](_0x42a1ab[_0x4a05('0x29')],qs[_0x4a05('0x2e')](_0x44003a[_0x4a05('0x2a')][_0x4a05('0x2e')]));_0x3207b5['attributes']=_0x3207b5[_0x4a05('0x2f')][_0x4a05('0x3f')]?_0x3207b5[_0x4a05('0x2f')]:_0x42a1ab[_0x4a05('0x29')];if(_0x44003a[_0x4a05('0x2a')][_0x4a05('0x39')]){_0x3207b5[_0x4a05('0x3a')]=[{'all':!![]}];}_0x3207b5=_[_0x4a05('0x40')]({},_0x3207b5,_0x44003a['options']);return db[_0x4a05('0x38')][_0x4a05('0x41')](_0x3207b5)[_0x4a05('0x20')](handleEntityNotFound(_0x18bd7c,null))[_0x4a05('0x20')](respondWithResult(_0x18bd7c,null))[_0x4a05('0x3c')](handleError(_0x18bd7c,null));};exports[_0x4a05('0x42')]=function(_0x26571a,_0x14db39){return db['VoiceTransferReport'][_0x4a05('0x42')](_0x26571a[_0x4a05('0x43')],{})[_0x4a05('0x20')](respondWithResult(_0x14db39,0xc9))[_0x4a05('0x3c')](handleError(_0x14db39,null));};exports['update']=function(_0x24dbd2,_0x5ca766){if(_0x24dbd2[_0x4a05('0x43')]['id']){delete _0x24dbd2[_0x4a05('0x43')]['id'];}return db['VoiceTransferReport'][_0x4a05('0x41')]({'where':{'id':_0x24dbd2[_0x4a05('0x3e')]['id']}})[_0x4a05('0x20')](handleEntityNotFound(_0x5ca766,null))[_0x4a05('0x20')](saveUpdates(_0x24dbd2['body'],null))[_0x4a05('0x20')](respondWithResult(_0x5ca766,null))[_0x4a05('0x3c')](handleError(_0x5ca766,null));};exports['destroy']=function(_0x2895db,_0x471895){return db[_0x4a05('0x38')][_0x4a05('0x41')]({'where':{'id':_0x2895db['params']['id']}})['then'](handleEntityNotFound(_0x471895,null))['then'](removeEntity(_0x471895,null))[_0x4a05('0x3c')](handleError(_0x471895,null));};exports[_0x4a05('0x44')]=function(_0x187e14,_0x170981){return db[_0x4a05('0x38')][_0x4a05('0x44')]()[_0x4a05('0x20')](respondWithResult(_0x170981,null))[_0x4a05('0x3c')](handleError(_0x170981,null));}; \ No newline at end of file +var _0x3eed=['path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','fieldName','type','map','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','VoiceTransferReport','findAll','rows','catch','params','keys','rawAttributes','length','create','body','find','describe','rimraf','bluebird','mustache','util'];(function(_0x2b83cf,_0xce40bf){var _0x13899d=function(_0xc4cb17){while(--_0xc4cb17){_0x2b83cf['push'](_0x2b83cf['shift']());}};_0x13899d(++_0xce40bf);}(_0x3eed,0x15f));var _0xd3ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3eed[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3ee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3ee('0x1'));var Mustache=require(_0xd3ee('0x2'));var util=require(_0xd3ee('0x3'));var path=require(_0xd3ee('0x4'));var sox=require(_0xd3ee('0x5'));var csv=require('to-csv');var ejs=require(_0xd3ee('0x6'));var fs=require('fs');var fs_extra=require(_0xd3ee('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd3ee('0x8'));var deskjs=require(_0xd3ee('0x9'));var toCsv=require(_0xd3ee('0xa'));var querystring=require(_0xd3ee('0xb'));var Papa=require(_0xd3ee('0xc'));var Redis=require(_0xd3ee('0xd'));var authService=require(_0xd3ee('0xe'));var qs=require(_0xd3ee('0xf'));var as=require(_0xd3ee('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd3ee('0x11'));var utils=require(_0xd3ee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd3ee('0x13'));var db=require(_0xd3ee('0x14'))['db'];function respondWithStatusCode(_0x426f73,_0x368776){_0x368776=_0x368776||0xcc;return function(_0x8abe15){if(_0x8abe15){return _0x426f73[_0xd3ee('0x15')](_0x368776);}return _0x426f73[_0xd3ee('0x16')](_0x368776)[_0xd3ee('0x17')]();};}function respondWithResult(_0x1cc73a,_0x5ac1e1){_0x5ac1e1=_0x5ac1e1||0xc8;return function(_0x4d81b0){if(_0x4d81b0){return _0x1cc73a[_0xd3ee('0x16')](_0x5ac1e1)[_0xd3ee('0x18')](_0x4d81b0);}};}function respondWithFilteredResult(_0x5ddef3,_0x435f61){return function(_0x39a544){if(_0x39a544){var _0x4fc3ef=typeof _0x435f61['offset']===_0xd3ee('0x19')&&typeof _0x435f61[_0xd3ee('0x1a')]===_0xd3ee('0x19');var _0x3630f2=_0x39a544[_0xd3ee('0x1b')];var _0xf03cc3=_0x4fc3ef?0x0:_0x435f61['offset'];var _0x492e7c=_0x4fc3ef?_0x39a544[_0xd3ee('0x1b')]:_0x435f61[_0xd3ee('0x1c')]+_0x435f61[_0xd3ee('0x1a')];var _0x346f7e;if(_0x492e7c>=_0x3630f2){_0x492e7c=_0x3630f2;_0x346f7e=0xc8;}else{_0x346f7e=0xce;}_0x5ddef3[_0xd3ee('0x16')](_0x346f7e);return _0x5ddef3[_0xd3ee('0x1d')](_0xd3ee('0x1e'),_0xf03cc3+'-'+_0x492e7c+'/'+_0x3630f2)['json'](_0x39a544);}return null;};}function patchUpdates(_0x95c3eb){return function(_0x31cf87){try{jsonpatch[_0xd3ee('0x1f')](_0x31cf87,_0x95c3eb,!![]);}catch(_0x17f921){return BPromise[_0xd3ee('0x20')](_0x17f921);}return _0x31cf87[_0xd3ee('0x21')]();};}function saveUpdates(_0x19d5ef,_0x1b299a){return function(_0xe08519){if(_0xe08519){return _0xe08519[_0xd3ee('0x22')](_0x19d5ef)['then'](function(_0x5781dd){return _0x5781dd;});}return null;};}function removeEntity(_0x4b81db,_0x54ef83){return function(_0x86e0e){if(_0x86e0e){return _0x86e0e[_0xd3ee('0x23')]()[_0xd3ee('0x24')](function(){_0x4b81db[_0xd3ee('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2177f3,_0x38807c){return function(_0xa45da7){if(!_0xa45da7){_0x2177f3[_0xd3ee('0x15')](0x194);}return _0xa45da7;};}function handleError(_0x1f1125,_0x4bbbcf){_0x4bbbcf=_0x4bbbcf||0x1f4;return function(_0x384652){logger['error'](_0x384652[_0xd3ee('0x25')]);if(_0x384652[_0xd3ee('0x26')]){delete _0x384652[_0xd3ee('0x26')];}_0x1f1125['status'](_0x4bbbcf)['send'](_0x384652);};}exports[_0xd3ee('0x27')]=function(_0xb582ed,_0x33de92){var _0x1dc18b={},_0x31bcdc={},_0x179556={'count':0x0,'rows':[]};var _0x3f983f=_['map'](db['VoiceTransferReport']['rawAttributes'],function(_0x59d209){return{'name':_0x59d209[_0xd3ee('0x28')],'type':_0x59d209[_0xd3ee('0x29')]['key']};});_0x31bcdc['model']=_[_0xd3ee('0x2a')](_0x3f983f,_0xd3ee('0x26'));_0x31bcdc['query']=_['keys'](_0xb582ed[_0xd3ee('0x2b')]);_0x31bcdc[_0xd3ee('0x2c')]=_['intersection'](_0x31bcdc[_0xd3ee('0x2d')],_0x31bcdc['query']);_0x1dc18b['attributes']=_[_0xd3ee('0x2e')](_0x31bcdc[_0xd3ee('0x2d')],qs[_0xd3ee('0x2f')](_0xb582ed[_0xd3ee('0x2b')][_0xd3ee('0x2f')]));_0x1dc18b['attributes']=_0x1dc18b[_0xd3ee('0x30')]['length']?_0x1dc18b[_0xd3ee('0x30')]:_0x31bcdc[_0xd3ee('0x2d')];if(!_0xb582ed[_0xd3ee('0x2b')][_0xd3ee('0x31')](_0xd3ee('0x32'))){_0x1dc18b['limit']=qs[_0xd3ee('0x1a')](_0xb582ed[_0xd3ee('0x2b')][_0xd3ee('0x1a')]);_0x1dc18b[_0xd3ee('0x1c')]=qs[_0xd3ee('0x1c')](_0xb582ed[_0xd3ee('0x2b')][_0xd3ee('0x1c')]);}_0x1dc18b['order']=qs[_0xd3ee('0x33')](_0xb582ed[_0xd3ee('0x2b')]['sort']);_0x1dc18b[_0xd3ee('0x34')]=qs[_0xd3ee('0x2c')](_[_0xd3ee('0x35')](_0xb582ed[_0xd3ee('0x2b')],_0x31bcdc[_0xd3ee('0x2c')]),_0x3f983f);if(_0xb582ed['query'][_0xd3ee('0x36')]){_0x1dc18b['where']=_[_0xd3ee('0x37')](_0x1dc18b[_0xd3ee('0x34')],{'$or':_[_0xd3ee('0x2a')](_0x3f983f,function(_0x378f10){if(_0x378f10['type']!=='VIRTUAL'){var _0x290b89={};_0x290b89[_0x378f10['name']]={'$like':'%'+_0xb582ed[_0xd3ee('0x2b')]['filter']+'%'};return _0x290b89;}})});}_0x1dc18b=_[_0xd3ee('0x37')]({},_0x1dc18b,_0xb582ed[_0xd3ee('0x38')]);var _0x3407cd={'where':_0x1dc18b['where']};return db['VoiceTransferReport'][_0xd3ee('0x1b')](_0x3407cd)[_0xd3ee('0x24')](function(_0x46dff6){_0x179556[_0xd3ee('0x1b')]=_0x46dff6;if(_0xb582ed[_0xd3ee('0x2b')][_0xd3ee('0x39')]){_0x1dc18b[_0xd3ee('0x3a')]=[{'all':!![]}];}return db[_0xd3ee('0x3b')][_0xd3ee('0x3c')](_0x1dc18b);})['then'](function(_0x122549){_0x179556[_0xd3ee('0x3d')]=_0x122549;return _0x179556;})[_0xd3ee('0x24')](respondWithFilteredResult(_0x33de92,_0x1dc18b))[_0xd3ee('0x3e')](handleError(_0x33de92,null));};exports['show']=function(_0x19081d,_0x12c8d9){var _0x1057a3={'raw':!![],'where':{'id':_0x19081d[_0xd3ee('0x3f')]['id']}},_0x3da84f={};_0x3da84f[_0xd3ee('0x2d')]=_[_0xd3ee('0x40')](db[_0xd3ee('0x3b')][_0xd3ee('0x41')]);_0x3da84f[_0xd3ee('0x2b')]=_['keys'](_0x19081d[_0xd3ee('0x2b')]);_0x3da84f[_0xd3ee('0x2c')]=_[_0xd3ee('0x2e')](_0x3da84f[_0xd3ee('0x2d')],_0x3da84f[_0xd3ee('0x2b')]);_0x1057a3['attributes']=_[_0xd3ee('0x2e')](_0x3da84f[_0xd3ee('0x2d')],qs[_0xd3ee('0x2f')](_0x19081d['query'][_0xd3ee('0x2f')]));_0x1057a3['attributes']=_0x1057a3['attributes'][_0xd3ee('0x42')]?_0x1057a3[_0xd3ee('0x30')]:_0x3da84f[_0xd3ee('0x2d')];if(_0x19081d[_0xd3ee('0x2b')][_0xd3ee('0x39')]){_0x1057a3[_0xd3ee('0x3a')]=[{'all':!![]}];}_0x1057a3=_[_0xd3ee('0x37')]({},_0x1057a3,_0x19081d[_0xd3ee('0x38')]);return db[_0xd3ee('0x3b')]['find'](_0x1057a3)[_0xd3ee('0x24')](handleEntityNotFound(_0x12c8d9,null))[_0xd3ee('0x24')](respondWithResult(_0x12c8d9,null))[_0xd3ee('0x3e')](handleError(_0x12c8d9,null));};exports[_0xd3ee('0x43')]=function(_0x529ea9,_0x2ca135){return db['VoiceTransferReport'][_0xd3ee('0x43')](_0x529ea9['body'],{})[_0xd3ee('0x24')](respondWithResult(_0x2ca135,0xc9))['catch'](handleError(_0x2ca135,null));};exports[_0xd3ee('0x22')]=function(_0x4f28f0,_0x395984){if(_0x4f28f0[_0xd3ee('0x44')]['id']){delete _0x4f28f0[_0xd3ee('0x44')]['id'];}return db[_0xd3ee('0x3b')]['find']({'where':{'id':_0x4f28f0[_0xd3ee('0x3f')]['id']}})[_0xd3ee('0x24')](handleEntityNotFound(_0x395984,null))[_0xd3ee('0x24')](saveUpdates(_0x4f28f0[_0xd3ee('0x44')],null))[_0xd3ee('0x24')](respondWithResult(_0x395984,null))['catch'](handleError(_0x395984,null));};exports['destroy']=function(_0x2f6dd7,_0x1fdebd){return db[_0xd3ee('0x3b')][_0xd3ee('0x45')]({'where':{'id':_0x2f6dd7[_0xd3ee('0x3f')]['id']}})[_0xd3ee('0x24')](handleEntityNotFound(_0x1fdebd,null))[_0xd3ee('0x24')](removeEntity(_0x1fdebd,null))['catch'](handleError(_0x1fdebd,null));};exports[_0xd3ee('0x46')]=function(_0x4a0a63,_0x3c933a){return db[_0xd3ee('0x3b')][_0xd3ee('0x46')]()[_0xd3ee('0x24')](respondWithResult(_0x3c933a,null))[_0xd3ee('0x3e')](handleError(_0x3c933a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index de3685e..e99db9c 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 _0x6d55=['report_call_transfer','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6d55,0x1c9));var _0x56d5=function(_0x560cae,_0x33c770){_0x560cae=_0x560cae-0x0;var _0x4e3c5d=_0x6d55[_0x560cae];return _0x4e3c5d;};'use strict';var _=require('lodash');var util=require(_0x56d5('0x0'));var logger=require(_0x56d5('0x1'))(_0x56d5('0x2'));var moment=require('moment');var BPromise=require(_0x56d5('0x3'));var rp=require(_0x56d5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56d5('0x5'));var config=require(_0x56d5('0x6'));var attributes=require(_0x56d5('0x7'));module[_0x56d5('0x8')]=function(_0xc7b785,_0x2bfd6a){return _0xc7b785[_0x56d5('0x9')](_0x56d5('0xa'),attributes,{'tableName':_0x56d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71d5=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x4567c2,_0x1e5880){var _0x5f0ec2=function(_0xa30478){while(--_0xa30478){_0x4567c2['push'](_0x4567c2['shift']());}};_0x5f0ec2(++_0x1e5880);}(_0x71d5,0xaa));var _0x571d=function(_0x467cb1,_0x1fca21){_0x467cb1=_0x467cb1-0x0;var _0x584cd1=_0x71d5[_0x467cb1];return _0x584cd1;};'use strict';var _=require(_0x571d('0x0'));var util=require(_0x571d('0x1'));var logger=require(_0x571d('0x2'))(_0x571d('0x3'));var moment=require(_0x571d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x571d('0x5'));var rimraf=require(_0x571d('0x6'));var config=require(_0x571d('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x571d('0x8')]=function(_0x1b868f,_0x567e81){return _0x1b868f[_0x571d('0x9')](_0x571d('0xa'),attributes,{'tableName':_0x571d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index b2189a0..3563d0e 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 _0x49ab=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','VoiceTransferReport','create','options','CreateVoiceTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49ab,0x150));var _0xb49a=function(_0x350ebd,_0x3259f9){_0x350ebd=_0x350ebd-0x0;var _0x1b5d2b=_0x49ab[_0x350ebd];return _0x1b5d2b;};'use strict';var _=require(_0xb49a('0x0'));var util=require('util');var moment=require(_0xb49a('0x1'));var BPromise=require(_0xb49a('0x2'));var rs=require(_0xb49a('0x3'));var fs=require('fs');var Redis=require(_0xb49a('0x4'));var db=require(_0xb49a('0x5'))['db'];var utils=require(_0xb49a('0x6'));var logger=require(_0xb49a('0x7'))('rpc');var config=require(_0xb49a('0x8'));var jayson=require(_0xb49a('0x9'));var client=jayson[_0xb49a('0xa')][_0xb49a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c954b,_0x5aec26,_0x319fa0){return new BPromise(function(_0x59a9c0,_0x3a3a48){return client[_0xb49a('0xc')](_0x3c954b,_0x319fa0)[_0xb49a('0xd')](function(_0x4100bc){logger[_0xb49a('0xe')](_0xb49a('0xf'),_0x5aec26,_0xb49a('0x10'));logger[_0xb49a('0x11')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5aec26,_0xb49a('0x10'),JSON[_0xb49a('0x12')](_0x4100bc));if(_0x4100bc[_0xb49a('0x13')]){if(_0x4100bc[_0xb49a('0x13')][_0xb49a('0x14')]===0x1f4){logger[_0xb49a('0x13')](_0xb49a('0xf'),_0x5aec26,_0x4100bc['error'][_0xb49a('0x15')]);return _0x3a3a48(_0x4100bc[_0xb49a('0x13')]['message']);}logger[_0xb49a('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x5aec26,_0x4100bc[_0xb49a('0x13')][_0xb49a('0x15')]);return _0x59a9c0(_0x4100bc[_0xb49a('0x13')]['message']);}else{logger['info'](_0xb49a('0xf'),_0x5aec26,'request\x20sent');_0x59a9c0(_0x4100bc[_0xb49a('0x16')][_0xb49a('0x15')]);}})[_0xb49a('0x17')](function(_0x37c98d){logger[_0xb49a('0x13')](_0xb49a('0xf'),_0x5aec26,_0x37c98d);_0x3a3a48(_0x37c98d);});});}exports['CreateVoiceTransferReport']=function(_0x45ead6){var _0x9ba810=this;return new Promise(function(_0x4603b4,_0x410983){return db[_0xb49a('0x18')][_0xb49a('0x19')](_0x45ead6['body'],{'raw':_0x45ead6[_0xb49a('0x1a')]?_0x45ead6[_0xb49a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb49a('0xd')](function(_0x501381){logger[_0xb49a('0xe')](_0xb49a('0x1b'),_0x45ead6);logger[_0xb49a('0x11')]('CreateVoiceTransferReport',_0x45ead6,JSON[_0xb49a('0x12')](_0x501381));_0x4603b4(_0x501381);})[_0xb49a('0x17')](function(_0x29a641){logger[_0xb49a('0x13')](_0xb49a('0x1b'),_0x29a641['message'],_0x45ead6);_0x410983(_0x9ba810[_0xb49a('0x13')](0x1f4,_0x29a641['message']));});});}; \ No newline at end of file +var _0x2476=['message','request\x20sent','catch','create','body','options','raw','CreateVoiceTransferReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','code','error','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x7ea1fb,_0x2f0b74){var _0x478241=function(_0xd06b3a){while(--_0xd06b3a){_0x7ea1fb['push'](_0x7ea1fb['shift']());}};_0x478241(++_0x2f0b74);}(_0x2476,0x15e));var _0x6247=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2476[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6247('0x0'));var util=require(_0x6247('0x1'));var moment=require(_0x6247('0x2'));var BPromise=require(_0x6247('0x3'));var rs=require(_0x6247('0x4'));var fs=require('fs');var Redis=require(_0x6247('0x5'));var db=require(_0x6247('0x6'))['db'];var utils=require(_0x6247('0x7'));var logger=require(_0x6247('0x8'))(_0x6247('0x9'));var config=require(_0x6247('0xa'));var jayson=require(_0x6247('0xb'));var client=jayson[_0x6247('0xc')][_0x6247('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xb4d290,_0x2e4773,_0x489d30){return new BPromise(function(_0x4afed3,_0x3e181d){return client[_0x6247('0xe')](_0xb4d290,_0x489d30)[_0x6247('0xf')](function(_0x133944){logger[_0x6247('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e4773,'request\x20sent');logger[_0x6247('0x11')](_0x6247('0x12'),_0x2e4773,'request\x20sent',JSON['stringify'](_0x133944));if(_0x133944['error']){if(_0x133944['error'][_0x6247('0x13')]===0x1f4){logger[_0x6247('0x14')](_0x6247('0x15'),_0x2e4773,_0x133944['error'][_0x6247('0x16')]);return _0x3e181d(_0x133944[_0x6247('0x14')]['message']);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x2e4773,_0x133944['error'][_0x6247('0x16')]);return _0x4afed3(_0x133944['error'][_0x6247('0x16')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x2e4773,_0x6247('0x17'));_0x4afed3(_0x133944['result'][_0x6247('0x16')]);}})[_0x6247('0x18')](function(_0x2c530b){logger[_0x6247('0x14')](_0x6247('0x15'),_0x2e4773,_0x2c530b);_0x3e181d(_0x2c530b);});});}exports['CreateVoiceTransferReport']=function(_0x4d71aa){var _0x2c367d=this;return new Promise(function(_0x269524,_0xefb723){return db['VoiceTransferReport'][_0x6247('0x19')](_0x4d71aa[_0x6247('0x1a')],{'raw':_0x4d71aa[_0x6247('0x1b')]?_0x4d71aa[_0x6247('0x1b')][_0x6247('0x1c')]===undefined?!![]:![]:!![]})[_0x6247('0xf')](function(_0x5264a3){logger[_0x6247('0x10')](_0x6247('0x1d'),_0x4d71aa);logger['debug']('CreateVoiceTransferReport',_0x4d71aa,JSON[_0x6247('0x1e')](_0x5264a3));_0x269524(_0x5264a3);})[_0x6247('0x18')](function(_0x482c34){logger[_0x6247('0x14')]('CreateVoiceTransferReport',_0x482c34[_0x6247('0x16')],_0x4d71aa);_0xefb723(_0x2c367d['error'](0x1f4,_0x482c34[_0x6247('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d716199..50c75b0 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 _0x2067=['/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','/hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x2067,0x67));var _0x7206=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x2067[_0x29df9a];return _0x3a8e96;};'use strict';var express=require(_0x7206('0x0'));var router=express[_0x7206('0x1')]();var auth=require(_0x7206('0x2'));var controller=require(_0x7206('0x3'));router[_0x7206('0x4')](_0x7206('0x5'),auth[_0x7206('0x6')](),auth[_0x7206('0x7')](),controller['originate']);router['post'](_0x7206('0x8'),auth['isAuthenticated'](),auth[_0x7206('0x7')](),controller['hangup']);router['post'](_0x7206('0x9'),auth[_0x7206('0x6')](),auth[_0x7206('0x7')](),controller[_0x7206('0xa')]);router[_0x7206('0x4')](_0x7206('0xb'),auth[_0x7206('0x6')](),auth['canUpdate'](),controller[_0x7206('0xc')]);router[_0x7206('0x4')](_0x7206('0xd'),auth['isAuthenticated'](),auth[_0x7206('0x7')](),controller[_0x7206('0xe')]);router[_0x7206('0x4')](_0x7206('0xf'),auth[_0x7206('0x6')](),auth['canUpdate'](),controller[_0x7206('0x10')]);router[_0x7206('0x4')](_0x7206('0x11'),auth[_0x7206('0x6')](),auth[_0x7206('0x7')](),controller[_0x7206('0x12')]);module[_0x7206('0x13')]=router; \ No newline at end of file +var _0xf70c=['/originate','canUpdate','originate','post','/hangup','isAuthenticated','hangup','answer','/hold','unhold','/calls','calls','/transfer','transfer','exports','express','./webbar.controller'];(function(_0x26ea79,_0x4108ba){var _0x3bf0a4=function(_0x21cc23){while(--_0x21cc23){_0x26ea79['push'](_0x26ea79['shift']());}};_0x3bf0a4(++_0x4108ba);}(_0xf70c,0x163));var _0xcf70=function(_0x1dc98b,_0x4fca1f){_0x1dc98b=_0x1dc98b-0x0;var _0x4fc026=_0xf70c[_0x1dc98b];return _0x4fc026;};'use strict';var express=require(_0xcf70('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xcf70('0x1'));router['post'](_0xcf70('0x2'),auth['isAuthenticated'](),auth[_0xcf70('0x3')](),controller[_0xcf70('0x4')]);router[_0xcf70('0x5')](_0xcf70('0x6'),auth[_0xcf70('0x7')](),auth[_0xcf70('0x3')](),controller[_0xcf70('0x8')]);router[_0xcf70('0x5')]('/answer',auth['isAuthenticated'](),auth[_0xcf70('0x3')](),controller[_0xcf70('0x9')]);router[_0xcf70('0x5')](_0xcf70('0xa'),auth[_0xcf70('0x7')](),auth[_0xcf70('0x3')](),controller['hold']);router['post']('/unhold',auth[_0xcf70('0x7')](),auth[_0xcf70('0x3')](),controller[_0xcf70('0xb')]);router[_0xcf70('0x5')](_0xcf70('0xc'),auth[_0xcf70('0x7')](),auth['canUpdate'](),controller[_0xcf70('0xd')]);router[_0xcf70('0x5')](_0xcf70('0xe'),auth[_0xcf70('0x7')](),auth[_0xcf70('0x3')](),controller[_0xcf70('0xf')]);module[_0xcf70('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 802aced..f42dcb0 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 _0x3140=['answer\x20executed!','hold','sessionId','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','callerId','entityFound:','format','originate\x20executed!','hangup\x20fired:','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer'];(function(_0x26cf07,_0x28c64a){var _0xec3c66=function(_0x523cde){while(--_0x523cde){_0x26cf07['push'](_0x26cf07['shift']());}};_0xec3c66(++_0x28c64a);}(_0x3140,0xaf));var _0x0314=function(_0x2e2a10,_0x55f9f5){_0x2e2a10=_0x2e2a10-0x0;var _0x5ad6cd=_0x3140[_0x2e2a10];return _0x5ad6cd;};'use strict';var path=require(_0x0314('0x0'));var fs=require('fs');var _=require(_0x0314('0x1'));var db=require(_0x0314('0x2'))['db'];var config=require(_0x0314('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x0314('0x4'));var amiClient=jayson[_0x0314('0x5')][_0x0314('0x6')]({'port':0x232a});var logger=require(_0x0314('0x7'))(_0x0314('0x8'));var Redis=require(_0x0314('0x9'));config[_0x0314('0xa')]=_[_0x0314('0xb')](config[_0x0314('0xa')],{'host':_0x0314('0xc'),'port':0x18eb});var io=require(_0x0314('0xd'))(new Redis(config['redis']));var Schema=require(_0x0314('0xe'));var originateValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x0314('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x0314('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':[!![],_0x0314('0x13')]},'transferNumber':{'type':_0x0314('0x11'),'required':[!![],_0x0314('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]},'sessionId':{'type':_0x0314('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0314('0xf'),'required':[!![],_0x0314('0x12')]}});function emit(_0x5e460f,_0xb9730b,_0x24cd42){logger[_0x0314('0x15')](_0x5e460f,_0xb9730b,JSON['stringify'](_0x24cd42));io['to'](_0x5e460f)[_0x0314('0x16')](_0xb9730b,_0x24cd42);}function handleError(_0x5f2e82){return function(_0x575b68){console[_0x0314('0x17')](_0x0314('0x18'),_0x575b68,_0x575b68 instanceof RangeError);logger['error'](_0x575b68[_0x0314('0x19')]);if(_0x575b68 instanceof RangeError){if(_0x575b68[_0x0314('0x1a')]){delete _0x575b68['name'];}_0x5f2e82[_0x0314('0x1b')](0x194)['send'](_0x575b68);}else{if(_0x575b68[_0x0314('0x1a')]){delete _0x575b68[_0x0314('0x1a')];}_0x5f2e82[_0x0314('0x1b')](0x1f4)[_0x0314('0x1c')](_0x575b68);}};}function checkError(){return function(_0x3bdb1){if(!_0x3bdb1){throw new RangeError(_0x0314('0x1d'));}return _0x3bdb1;};}function respondWithRpcPromise(_0x4d3bc6,_0x56ef33){return new BPromise(function(_0x20305b,_0xbd3ad0){var _0x1945f8=amiClient;return _0x1945f8[_0x0314('0x1e')](_0x4d3bc6,_0x56ef33)[_0x0314('0x1f')](function(_0xd7638b){if(_0xd7638b['error']){if(_0xd7638b[_0x0314('0x20')][_0x0314('0x21')]===0x1f4){return _0xbd3ad0(_0xd7638b['error'][_0x0314('0x22')]);}return _0x20305b(_0xd7638b[_0x0314('0x20')][_0x0314('0x22')]);}else{_0x20305b(_0xd7638b[_0x0314('0x23')]);}})[_0x0314('0x24')](function(_0x3af9d3){_0xbd3ad0(_0x3af9d3);});});}function getAgent(_0x5d5b13){return db[_0x0314('0x25')][_0x0314('0x26')]({'where':{'id':_0x5d5b13,'role':_0x0314('0x27')}})['then'](checkError());}function getAgentCheckSession(_0x29b4b5,_0x5e3eba){return new BPromise(function(_0x47c102,_0x5da2c7){var _0x2fc520=respondWithRpcPromise(_0x0314('0x28'));var _0x550dc4=getAgent(_0x29b4b5);Promise[_0x0314('0x29')]([_0x2fc520,_0x550dc4])[_0x0314('0x1f')](function(_0x5291c2){var _0x547ab3=_0x5291c2[0x0];var _0x15fbfb=_0x5291c2[0x1];var _0x345cef=_['filter'](_0x547ab3[_0x0314('0x2a')],function(_0x16e74a){return _0x16e74a[_0x0314('0x2b')]==_0x15fbfb['id']&&_0x16e74a['sessionId']==_0x5e3eba;});if(_0x345cef[_0x0314('0x2c')]==0x1){_0x47c102(_0x15fbfb);}else{_0x5da2c7(new RangeError(_0x0314('0x2d')+_0x5e3eba+_0x0314('0x2e')));}});});}exports[_0x0314('0x2f')]=function(_0x549b0b,_0x1d01b5){logger['info']('originate\x20fired:',_0x549b0b[_0x0314('0x30')]);var _0x14d3b4=originateValidation[_0x0314('0xe')](_0x549b0b['body']);if(_0x14d3b4[_0x0314('0x2c')]>0x0){return _0x1d01b5['status'](0x190)[_0x0314('0x31')](_0x14d3b4);}var _0x5a0767=_0x549b0b['body'][_0x0314('0x32')];var _0x5d3b0e=_0x549b0b[_0x0314('0x30')][_0x0314('0x33')];var _0x2990ea=_0x549b0b[_0x0314('0x30')][_0x0314('0x34')];var _0x1a9ff7=_0x549b0b[_0x0314('0x30')]['callbackUrl'];return getAgent(_0x5a0767)[_0x0314('0x1f')](function(_0x28c6d0){logger[_0x0314('0x15')](_0x0314('0x35'),_0x28c6d0[_0x0314('0x1a')]);emit(util[_0x0314('0x36')]('user:%s',_0x28c6d0[_0x0314('0x1a')]),'webbar:originate',{'callNumber':_0x5d3b0e,'callerId':_0x2990ea,'callbackUrl':_0x1a9ff7});return _0x1d01b5[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':_0x0314('0x37')});})['catch'](handleError(_0x1d01b5));};exports['hangup']=function(_0x58c701,_0x1765d7){logger[_0x0314('0x15')](_0x0314('0x38'),_0x58c701[_0x0314('0x30')]);var _0x986315=hangupValidation['validate'](_0x58c701[_0x0314('0x30')]);if(_0x986315[_0x0314('0x2c')]>0x0){return _0x1765d7[_0x0314('0x1b')](0x190)['json'](_0x986315);}var _0x273f2c=_0x58c701['body'][_0x0314('0x32')];var _0x5b034a=_0x58c701[_0x0314('0x30')]['sessionId'];return getAgent(_0x273f2c)['then'](function(_0x370539){logger[_0x0314('0x15')]('entityFound:',_0x370539[_0x0314('0x1a')]);emit(util['format'](_0x0314('0x39'),_0x370539[_0x0314('0x1a')]),_0x0314('0x3a'),{'sessionId':_0x5b034a});return _0x1765d7[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x0314('0x24')](handleError(_0x1765d7));};exports[_0x0314('0x3b')]=function(_0x3b070a,_0x5f33cd){logger[_0x0314('0x15')](_0x0314('0x3c'),_0x3b070a[_0x0314('0x30')]);var _0x599473=answerValidation[_0x0314('0xe')](_0x3b070a['body']);if(_0x599473[_0x0314('0x2c')]>0x0){return _0x5f33cd[_0x0314('0x1b')](0x190)[_0x0314('0x31')](_0x599473);}var _0x583aba=_0x3b070a[_0x0314('0x30')][_0x0314('0x32')];var _0x588e65=_0x3b070a['body']['sessionId'];return getAgent(_0x583aba)[_0x0314('0x1f')](function(_0x70bcd){logger[_0x0314('0x15')]('entityFound:',_0x70bcd[_0x0314('0x1a')]);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x70bcd[_0x0314('0x1a')]),_0x0314('0x3d'),{'sessionId':_0x588e65});return _0x5f33cd['status'](0xc8)[_0x0314('0x31')]({'error':![],'message':_0x0314('0x3e')});})[_0x0314('0x24')](handleError(_0x5f33cd));};exports[_0x0314('0x3f')]=function(_0x1b7292,_0x209ea9){logger[_0x0314('0x15')]('hold\x20fired:',_0x1b7292[_0x0314('0x30')]);var _0x1d72f6=holdValidation['validate'](_0x1b7292[_0x0314('0x30')]);if(_0x1d72f6[_0x0314('0x2c')]>0x0){return _0x209ea9[_0x0314('0x1b')](0x190)['json'](_0x1d72f6);}var _0x4a1850=_0x1b7292[_0x0314('0x30')][_0x0314('0x32')];var _0x2cbed3=_0x1b7292[_0x0314('0x30')][_0x0314('0x40')];return getAgent(_0x4a1850)[_0x0314('0x1f')](function(_0x36a72a){logger['info'](_0x0314('0x35'),_0x36a72a['name']);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x36a72a[_0x0314('0x1a')]),_0x0314('0x41'),{'sessionId':_0x2cbed3});return _0x209ea9[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x0314('0x24')](handleError(_0x209ea9));};exports[_0x0314('0x42')]=function(_0x20070c,_0x26ecb7){logger['info'](_0x0314('0x43'),_0x20070c[_0x0314('0x30')]);var _0x2b601a=unholdValidation[_0x0314('0xe')](_0x20070c[_0x0314('0x30')]);if(_0x2b601a[_0x0314('0x2c')]>0x0){return _0x26ecb7[_0x0314('0x1b')](0x190)['json'](_0x2b601a);}var _0x28ca8f=_0x20070c[_0x0314('0x30')][_0x0314('0x32')];var _0x577a91=_0x20070c[_0x0314('0x30')][_0x0314('0x40')];return getAgent(_0x28ca8f)['then'](function(_0x92cb75){logger[_0x0314('0x15')](_0x0314('0x35'),_0x92cb75[_0x0314('0x1a')]);emit(util['format'](_0x0314('0x39'),_0x92cb75[_0x0314('0x1a')]),_0x0314('0x44'),{'sessionId':_0x577a91});return _0x26ecb7[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'error':![],'message':_0x0314('0x45')});})[_0x0314('0x24')](handleError(_0x26ecb7));};exports[_0x0314('0x46')]=function(_0x166154,_0xa8dc19){logger['info'](_0x0314('0x47'),_0xa8dc19[_0x0314('0x30')]);var _0xf29a33=callsValidation[_0x0314('0xe')](_0x166154[_0x0314('0x30')]);if(_0xf29a33[_0x0314('0x2c')]>0x0){return _0xa8dc19[_0x0314('0x1b')](0x190)['json'](_0xf29a33);}var _0x5c4e26=_0x166154['body'][_0x0314('0x32')];var _0x3c292c=respondWithRpcPromise('VoiceChannels');var _0xda9a80=getAgent(_0x5c4e26);return Promise[_0x0314('0x29')]([_0x3c292c,_0xda9a80])[_0x0314('0x1f')](function(_0x4b35d8){var _0x50e8dc=_0x4b35d8[0x0];var _0x2e29ce=_0x4b35d8[0x1];var _0x40a4d8=_['filter'](_0x50e8dc[_0x0314('0x2a')],function(_0x4b022a){return _0x4b022a[_0x0314('0x2b')]==_0x2e29ce['id'];});return _0xa8dc19[_0x0314('0x1b')](0xc8)[_0x0314('0x31')]({'count':_0x40a4d8[_0x0314('0x2c')],'rows':_0x40a4d8});})['catch'](handleError(_0xa8dc19));};exports[_0x0314('0x48')]=function(_0x3fc295,_0x549f4c){logger['info'](_0x0314('0x49'),_0x3fc295[_0x0314('0x30')]);var _0x1cca34=conferenceValidation[_0x0314('0xe')](_0x3fc295[_0x0314('0x30')]);if(_0x1cca34[_0x0314('0x2c')]>0x0){return _0x549f4c[_0x0314('0x1b')](0x190)['json'](_0x1cca34);}var _0x340676=_0x3fc295['body']['userId'];return getAgent(_0x340676)[_0x0314('0x1f')](function(_0x5521dd){logger[_0x0314('0x15')](_0x0314('0x35'),_0x5521dd[_0x0314('0x1a')]);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x5521dd[_0x0314('0x1a')]),_0x0314('0x4a'));return _0x549f4c[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x0314('0x24')](handleError(_0x549f4c));};exports[_0x0314('0x4b')]=function(_0xf480fe,_0x582451){logger['info']('transfer\x20fired:',_0xf480fe[_0x0314('0x30')]);var _0x17dbb9=transferValidation['validate'](_0xf480fe[_0x0314('0x30')]);if(_0x17dbb9[_0x0314('0x2c')]>0x0){return _0x582451[_0x0314('0x1b')](0x190)[_0x0314('0x31')](_0x17dbb9);}var _0x19d14b=_0xf480fe[_0x0314('0x30')]['userId'];var _0x41ec80=_0xf480fe[_0x0314('0x30')][_0x0314('0x40')];var _0x5a69ac=_0xf480fe[_0x0314('0x30')][_0x0314('0x4c')];return getAgent(_0x19d14b)[_0x0314('0x1f')](function(_0x51632e){logger[_0x0314('0x15')](_0x0314('0x35'),_0x51632e['name']);emit(util[_0x0314('0x36')](_0x0314('0x39'),_0x51632e[_0x0314('0x1a')]),_0x0314('0x4d'),{'sessionId':_0x41ec80,'transferNumber':_0x5a69ac});return _0x582451[_0x0314('0x1b')](0xc8)['json']({'error':![],'message':_0x0314('0x4e')});})[_0x0314('0x24')](handleError(_0x582451));}; \ No newline at end of file +var _0x593e=['number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','name','status','send','NotFound','request','code','message','catch','findOne','agent','then','all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x53349f,_0x46d6be){var _0x1d8a05=function(_0x2a4a6d){while(--_0x2a4a6d){_0x53349f['push'](_0x53349f['shift']());}};_0x1d8a05(++_0x46d6be);}(_0x593e,0xcb));var _0xe593=function(_0x5d63db,_0x586999){_0x5d63db=_0x5d63db-0x0;var _0x254c15=_0x593e[_0x5d63db];return _0x254c15;};'use strict';var path=require(_0xe593('0x0'));var fs=require('fs');var _=require(_0xe593('0x1'));var db=require(_0xe593('0x2'))['db'];var config=require(_0xe593('0x3'));var util=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var jayson=require(_0xe593('0x6'));var amiClient=jayson[_0xe593('0x7')]['http']({'port':0x232a});var logger=require(_0xe593('0x8'))(_0xe593('0x9'));var Redis=require(_0xe593('0xa'));config[_0xe593('0xb')]=_[_0xe593('0xc')](config[_0xe593('0xb')],{'host':_0xe593('0xd'),'port':0x18eb});var io=require(_0xe593('0xe'))(new Redis(config[_0xe593('0xb')]));var Schema=require(_0xe593('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]},'callNumber':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x14')]},'transferNumber':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]}});function emit(_0x40416c,_0x1c6de3,_0x2d525c){logger[_0xe593('0x16')](_0x40416c,_0x1c6de3,JSON[_0xe593('0x17')](_0x2d525c));io['to'](_0x40416c)['emit'](_0x1c6de3,_0x2d525c);}function handleError(_0xfbc79f){return function(_0x470d07){console['log'](_0xe593('0x18'),_0x470d07,_0x470d07 instanceof RangeError);logger[_0xe593('0x19')](_0x470d07['stack']);if(_0x470d07 instanceof RangeError){if(_0x470d07[_0xe593('0x1a')]){delete _0x470d07[_0xe593('0x1a')];}_0xfbc79f[_0xe593('0x1b')](0x194)[_0xe593('0x1c')](_0x470d07);}else{if(_0x470d07[_0xe593('0x1a')]){delete _0x470d07[_0xe593('0x1a')];}_0xfbc79f[_0xe593('0x1b')](0x1f4)['send'](_0x470d07);}};}function checkError(){return function(_0x4af4c8){if(!_0x4af4c8){throw new RangeError(_0xe593('0x1d'));}return _0x4af4c8;};}function respondWithRpcPromise(_0x5d4895,_0x56c23f){return new BPromise(function(_0x1bb8e8,_0x3c65b5){var _0x57379d=amiClient;return _0x57379d[_0xe593('0x1e')](_0x5d4895,_0x56c23f)['then'](function(_0x1672bf){if(_0x1672bf[_0xe593('0x19')]){if(_0x1672bf[_0xe593('0x19')][_0xe593('0x1f')]===0x1f4){return _0x3c65b5(_0x1672bf[_0xe593('0x19')][_0xe593('0x20')]);}return _0x1bb8e8(_0x1672bf[_0xe593('0x19')][_0xe593('0x20')]);}else{_0x1bb8e8(_0x1672bf['result']);}})[_0xe593('0x21')](function(_0x347d7d){_0x3c65b5(_0x347d7d);});});}function getAgent(_0x480218){return db['User'][_0xe593('0x22')]({'where':{'id':_0x480218,'role':_0xe593('0x23')}})[_0xe593('0x24')](checkError());}function getAgentCheckSession(_0x43699d,_0x3b66bc){return new BPromise(function(_0x27a3d2,_0x5918cd){var _0x350e2b=respondWithRpcPromise('VoiceChannels');var _0x1dacf6=getAgent(_0x43699d);Promise[_0xe593('0x25')]([_0x350e2b,_0x1dacf6])['then'](function(_0x337ee0){var _0x561a01=_0x337ee0[0x0];var _0x44a68c=_0x337ee0[0x1];var _0x1c147b=_[_0xe593('0x26')](_0x561a01['rows'],function(_0x1ae8d9){return _0x1ae8d9[_0xe593('0x27')]==_0x44a68c['id']&&_0x1ae8d9[_0xe593('0x28')]==_0x3b66bc;});if(_0x1c147b[_0xe593('0x29')]==0x1){_0x27a3d2(_0x44a68c);}else{_0x5918cd(new RangeError(_0xe593('0x2a')+_0x3b66bc+_0xe593('0x2b')));}});});}exports[_0xe593('0x2c')]=function(_0x4efc93,_0x4098a9){logger[_0xe593('0x16')]('originate\x20fired:',_0x4efc93[_0xe593('0x2d')]);var _0x571995=originateValidation[_0xe593('0xf')](_0x4efc93[_0xe593('0x2d')]);if(_0x571995[_0xe593('0x29')]>0x0){return _0x4098a9[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x571995);}var _0x24a560=_0x4efc93[_0xe593('0x2d')][_0xe593('0x2f')];var _0x11f287=_0x4efc93[_0xe593('0x2d')]['callNumber'];var _0x27a563=_0x4efc93[_0xe593('0x2d')][_0xe593('0x30')];var _0x5a55c0=_0x4efc93['body'][_0xe593('0x31')];return getAgent(_0x24a560)['then'](function(_0x232bf1){logger[_0xe593('0x16')](_0xe593('0x32'),_0x232bf1[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x232bf1[_0xe593('0x1a')]),'webbar:originate',{'callNumber':_0x11f287,'callerId':_0x27a563,'callbackUrl':_0x5a55c0});return _0x4098a9['status'](0xc8)[_0xe593('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xe593('0x21')](handleError(_0x4098a9));};exports['hangup']=function(_0x206775,_0x5b9589){logger['info'](_0xe593('0x35'),_0x206775[_0xe593('0x2d')]);var _0x2aa9d8=hangupValidation['validate'](_0x206775['body']);if(_0x2aa9d8['length']>0x0){return _0x5b9589[_0xe593('0x1b')](0x190)['json'](_0x2aa9d8);}var _0x37ba0e=_0x206775[_0xe593('0x2d')][_0xe593('0x2f')];var _0x475207=_0x206775['body'][_0xe593('0x28')];return getAgent(_0x37ba0e)['then'](function(_0x36c08e){logger['info']('entityFound:',_0x36c08e['name']);emit(util[_0xe593('0x33')]('user:%s',_0x36c08e[_0xe593('0x1a')]),_0xe593('0x36'),{'sessionId':_0x475207});return _0x5b9589[_0xe593('0x1b')](0xc8)['json']({'error':![],'message':_0xe593('0x37')});})[_0xe593('0x21')](handleError(_0x5b9589));};exports[_0xe593('0x38')]=function(_0x4655dd,_0x26ff41){logger[_0xe593('0x16')](_0xe593('0x39'),_0x4655dd[_0xe593('0x2d')]);var _0x4b36e1=answerValidation[_0xe593('0xf')](_0x4655dd[_0xe593('0x2d')]);if(_0x4b36e1[_0xe593('0x29')]>0x0){return _0x26ff41[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x4b36e1);}var _0x4d3018=_0x4655dd['body'][_0xe593('0x2f')];var _0x380429=_0x4655dd[_0xe593('0x2d')]['sessionId'];return getAgent(_0x4d3018)[_0xe593('0x24')](function(_0x8a4c26){logger['info']('entityFound:',_0x8a4c26[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x8a4c26['name']),_0xe593('0x3a'),{'sessionId':_0x380429});return _0x26ff41[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x3b')});})['catch'](handleError(_0x26ff41));};exports['hold']=function(_0x4a7434,_0x4c8d14){logger[_0xe593('0x16')]('hold\x20fired:',_0x4a7434[_0xe593('0x2d')]);var _0xd016b3=holdValidation[_0xe593('0xf')](_0x4a7434[_0xe593('0x2d')]);if(_0xd016b3[_0xe593('0x29')]>0x0){return _0x4c8d14[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0xd016b3);}var _0x297c3e=_0x4a7434['body'][_0xe593('0x2f')];var _0x1a5e0f=_0x4a7434[_0xe593('0x2d')]['sessionId'];return getAgent(_0x297c3e)[_0xe593('0x24')](function(_0x5dfdb1){logger[_0xe593('0x16')](_0xe593('0x32'),_0x5dfdb1[_0xe593('0x1a')]);emit(util['format']('user:%s',_0x5dfdb1[_0xe593('0x1a')]),_0xe593('0x3c'),{'sessionId':_0x1a5e0f});return _0x4c8d14['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x4c8d14));};exports['unhold']=function(_0x383645,_0x1e48d8){logger[_0xe593('0x16')](_0xe593('0x3d'),_0x383645[_0xe593('0x2d')]);var _0x44201e=unholdValidation[_0xe593('0xf')](_0x383645[_0xe593('0x2d')]);if(_0x44201e[_0xe593('0x29')]>0x0){return _0x1e48d8[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x44201e);}var _0x1ea4ef=_0x383645[_0xe593('0x2d')][_0xe593('0x2f')];var _0xa25aa8=_0x383645[_0xe593('0x2d')]['sessionId'];return getAgent(_0x1ea4ef)[_0xe593('0x24')](function(_0x12e2ac){logger[_0xe593('0x16')](_0xe593('0x32'),_0x12e2ac[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x12e2ac[_0xe593('0x1a')]),_0xe593('0x3e'),{'sessionId':_0xa25aa8});return _0x1e48d8[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x3f')});})[_0xe593('0x21')](handleError(_0x1e48d8));};exports[_0xe593('0x40')]=function(_0x93ca5e,_0x5e8f9c){logger[_0xe593('0x16')](_0xe593('0x41'),_0x5e8f9c[_0xe593('0x2d')]);var _0x24d061=callsValidation[_0xe593('0xf')](_0x93ca5e['body']);if(_0x24d061['length']>0x0){return _0x5e8f9c[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x24d061);}var _0x318dd2=_0x93ca5e[_0xe593('0x2d')][_0xe593('0x2f')];var _0x1e49ed=respondWithRpcPromise(_0xe593('0x42'));var _0x518b6f=getAgent(_0x318dd2);return Promise['all']([_0x1e49ed,_0x518b6f])[_0xe593('0x24')](function(_0x23ee3b){var _0x4ff51d=_0x23ee3b[0x0];var _0x103403=_0x23ee3b[0x1];var _0xf8ed1d=_[_0xe593('0x26')](_0x4ff51d[_0xe593('0x43')],function(_0x3a3d7b){return _0x3a3d7b[_0xe593('0x27')]==_0x103403['id'];});return _0x5e8f9c[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'count':_0xf8ed1d[_0xe593('0x29')],'rows':_0xf8ed1d});})[_0xe593('0x21')](handleError(_0x5e8f9c));};exports['conference']=function(_0x36f38e,_0x13e368){logger[_0xe593('0x16')](_0xe593('0x44'),_0x36f38e[_0xe593('0x2d')]);var _0x202b18=conferenceValidation[_0xe593('0xf')](_0x36f38e['body']);if(_0x202b18[_0xe593('0x29')]>0x0){return _0x13e368[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x202b18);}var _0x14f8e1=_0x36f38e['body'][_0xe593('0x2f')];return getAgent(_0x14f8e1)[_0xe593('0x24')](function(_0x207c3d){logger[_0xe593('0x16')](_0xe593('0x32'),_0x207c3d['name']);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x207c3d[_0xe593('0x1a')]),_0xe593('0x45'));return _0x13e368[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x46')});})[_0xe593('0x21')](handleError(_0x13e368));};exports['transfer']=function(_0x2145c0,_0x16f9fc){logger[_0xe593('0x16')](_0xe593('0x47'),_0x2145c0[_0xe593('0x2d')]);var _0x9f1813=transferValidation[_0xe593('0xf')](_0x2145c0[_0xe593('0x2d')]);if(_0x9f1813[_0xe593('0x29')]>0x0){return _0x16f9fc[_0xe593('0x1b')](0x190)['json'](_0x9f1813);}var _0x190e90=_0x2145c0[_0xe593('0x2d')][_0xe593('0x2f')];var _0x492a9e=_0x2145c0[_0xe593('0x2d')][_0xe593('0x28')];var _0x4001b7=_0x2145c0[_0xe593('0x2d')][_0xe593('0x48')];return getAgent(_0x190e90)['then'](function(_0x17a1bc){logger[_0xe593('0x16')]('entityFound:',_0x17a1bc[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x17a1bc[_0xe593('0x1a')]),'webbar:transfer',{'sessionId':_0x492a9e,'transferNumber':_0x4001b7});return _0x16f9fc[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x49')});})['catch'](handleError(_0x16f9fc));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c6191a3..32dfe9e 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','destroy'];(function(_0x6ce72b,_0xb24cb2){var _0xf54833=function(_0x432487){while(--_0x432487){_0x6ce72b['push'](_0x6ce72b['shift']());}};_0xf54833(++_0xb24cb2);}(_0xdb28,0x106));var _0x8db2=function(_0x3f6f0e,_0x103f6c){_0x3f6f0e=_0x3f6f0e-0x0;var _0x583cb1=_0xdb28[_0x3f6f0e];return _0x583cb1;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./whatsappAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x15')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x15')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x17')]);router[_0x8db2('0x15')](_0x8db2('0x11'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x15')]('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x19')]);router[_0x8db2('0x15')](_0x8db2('0x1a'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['post']('/:id/notify',controller[_0x8db2('0x1c')]);router[_0x8db2('0x15')](_0x8db2('0x1d'),auth[_0x8db2('0xa')](),controller['send']);router[_0x8db2('0x1e')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x20')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x22')]);router[_0x8db2('0x20')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8db2('0x23')]);module[_0x8db2('0x24')]=router; \ No newline at end of file +var _0x33af=['getAnswers','/:id/users','/:id/applications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions'];(function(_0x5aa1ed,_0x51eee9){var _0xa9931a=function(_0x2cc38e){while(--_0x2cc38e){_0x5aa1ed['push'](_0x5aa1ed['shift']());}};_0xa9931a(++_0x51eee9);}(_0x33af,0xec));var _0xf33a=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x33af[_0x5e28c2];return _0x1a8cc6;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/canned_answers',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x8')](_0xf33a('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf33a('0x13')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x13')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x13')]('/:id/canned_answers',auth[_0xf33a('0xb')](),controller['addAnswer']);router[_0xf33a('0x13')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x16')]);router[_0xf33a('0x13')]('/:id/applications',auth[_0xf33a('0xb')](),controller[_0xf33a('0x17')]);router[_0xf33a('0x13')](_0xf33a('0x18'),controller['notify']);router[_0xf33a('0x13')](_0xf33a('0x19'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x1b')](_0xf33a('0x1c'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1d')]);router[_0xf33a('0x1e')](_0xf33a('0x1c'),auth['isAuthenticated'](),controller[_0xf33a('0x1f')]);router[_0xf33a('0x1e')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x20')]);router['delete'](_0xf33a('0x21'),auth['isAuthenticated'](),controller[_0xf33a('0x22')]);router[_0xf33a('0x1e')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a285924..80ffc52 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 _0x36d3=['sequelize','exports','name','STRING','ENUM','twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x4e6fb2,_0x3cf23e){var _0x2f1636=function(_0x53c7eb){while(--_0x53c7eb){_0x4e6fb2['push'](_0x4e6fb2['shift']());}};_0x2f1636(++_0x3cf23e);}(_0x36d3,0x6c));var _0x336d=function(_0x3f8e54,_0x3267f0){_0x3f8e54=_0x3f8e54-0x0;var _0x4fbcbf=_0x36d3[_0x3f8e54];return _0x4fbcbf;};'use strict';var Sequelize=require(_0x336d('0x0'));var rs=require('randomstring');module[_0x336d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x336d('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x336d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x336d('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x336d('0x3')]},'type':{'type':Sequelize[_0x336d('0x4')](_0x336d('0x5'))},'accountSid':{'type':Sequelize[_0x336d('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x336d('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x336d('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x336d('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x336d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x336d('0x7')],'comment':_0x336d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x336d('0x6')],'defaultValue':![],'comment':_0x336d('0x9'),'set':function(_0x17c859){if(!_0x17c859){this[_0x336d('0xa')]('mandatoryDispositionPauseId',null);}this[_0x336d('0xa')](_0x336d('0xb'),_0x17c859);}},'description':{'type':Sequelize[_0x336d('0x3')]}}; \ No newline at end of file +var _0x0e32=['ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x3df983,_0x46d7fa){var _0x2cc27c=function(_0x554643){while(--_0x554643){_0x3df983['push'](_0x3df983['shift']());}};_0x2cc27c(++_0x46d7fa);}(_0x0e32,0x136));var _0x20e3=function(_0x3a118f,_0x4a84a4){_0x3a118f=_0x3a118f-0x0;var _0x49d4c0=_0x0e32[_0x3a118f];return _0x49d4c0;};'use strict';var Sequelize=require(_0x20e3('0x0'));var rs=require(_0x20e3('0x1'));module[_0x20e3('0x2')]={'name':{'type':Sequelize[_0x20e3('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x20e3('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x20e3('0x3')],'defaultValue':function(){return rs[_0x20e3('0x4')]();}},'phone':{'type':Sequelize[_0x20e3('0x3')]},'type':{'type':Sequelize[_0x20e3('0x5')](_0x20e3('0x6'))},'accountSid':{'type':Sequelize[_0x20e3('0x3')]},'authToken':{'type':Sequelize[_0x20e3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x20e3('0x7')],'defaultValue':function(){return _0x20e3('0x8');}},'notificationSound':{'type':Sequelize[_0x20e3('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x20e3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x20e3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x20e3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x20e3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x20e3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20e3('0xa')],'comment':_0x20e3('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x20e3('0x9')],'defaultValue':![],'comment':_0x20e3('0xc'),'set':function(_0x1d168c){if(!_0x1d168c){this['setDataValue'](_0x20e3('0xd'),null);}this['setDataValue'](_0x20e3('0xe'),_0x1d168c);}},'description':{'type':Sequelize[_0x20e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index fda1923..ef96d81 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 _0x177e=['userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','findAndCountAll','priority','notify','whatsapp','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','mobile','From','whatsapp:','Body','messageId','MessageSid','isNil','ValidationError','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','ListId','Contacts','list','contact','WhatsappInteraction','interaction','created','push','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','to\x20is\x20mandatory','List','DESC','user','out','Messages','spread','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','show','params','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray'];(function(_0xbb2a49,_0x3df491){var _0x1bc3ee=function(_0x252aa6){while(--_0x252aa6){_0xbb2a49['push'](_0xbb2a49['shift']());}};_0x1bc3ee(++_0x3df491);}(_0x177e,0x1b8));var _0xe177=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x177e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xe177('0x0'));var rimraf=require(_0xe177('0x1'));var zipdir=require(_0xe177('0x2'));var jsonpatch=require(_0xe177('0x3'));var rp=require(_0xe177('0x4'));var moment=require(_0xe177('0x5'));var BPromise=require(_0xe177('0x6'));var Mustache=require(_0xe177('0x7'));var util=require('util');var path=require(_0xe177('0x8'));var sox=require(_0xe177('0x9'));var csv=require(_0xe177('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe177('0xb'));var _=require(_0xe177('0xc'));var squel=require('squel');var crypto=require(_0xe177('0xd'));var jsforce=require(_0xe177('0xe'));var deskjs=require(_0xe177('0xf'));var toCsv=require(_0xe177('0xa'));var querystring=require(_0xe177('0x10'));var Papa=require(_0xe177('0x11'));var Redis=require(_0xe177('0x12'));var authService=require(_0xe177('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe177('0x14'));var hardwareService=require(_0xe177('0x15'));var logger=require('../../config/logger')(_0xe177('0x16'));var utils=require(_0xe177('0x17'));var config=require(_0xe177('0x18'));var licenseUtil=require(_0xe177('0x19'));var db=require(_0xe177('0x1a'))['db'];config[_0xe177('0x1b')]=_[_0xe177('0x1c')](config[_0xe177('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe177('0x1d'))(new Redis(config[_0xe177('0x1b')]));require(_0xe177('0x1e'))['register'](socket);var jayson=require(_0xe177('0x1f'));var client=jayson['client'][_0xe177('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x9a53b7,_0x27afaf,_0x396656,_0x10cddf){return new BPromise(function(_0x30e708,_0x79d000){var _0x387783=_0x10cddf||client;return _0x387783[_0xe177('0x21')](_0x9a53b7,_0x396656)['then'](function(_0x4541d9){logger['info'](_0xe177('0x22'),_0x27afaf,_0xe177('0x23'));logger['debug'](_0xe177('0x24'),_0x27afaf,'request\x20sent',JSON[_0xe177('0x25')](_0x4541d9));if(_0x4541d9['error']){if(_0x4541d9[_0xe177('0x26')][_0xe177('0x27')]===0x1f4){logger[_0xe177('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x27afaf,_0x4541d9['error'][_0xe177('0x28')]);return _0x79d000(_0x4541d9[_0xe177('0x26')][_0xe177('0x28')]);}logger['error'](_0xe177('0x22'),_0x27afaf,_0x4541d9['error'][_0xe177('0x28')]);return _0x30e708(_0x4541d9[_0xe177('0x26')]['message']);}else{logger[_0xe177('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x27afaf,'request\x20sent');_0x30e708(_0x4541d9[_0xe177('0x2a')]['message']);}})[_0xe177('0x2b')](function(_0x29578b){logger[_0xe177('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x27afaf,_0x29578b);_0x79d000(_0x29578b);});});}function respondWithStatusCode(_0x53472b,_0x4ddc4d){_0x4ddc4d=_0x4ddc4d||0xcc;return function(_0x5d964e){if(_0x5d964e){return _0x53472b[_0xe177('0x2c')](_0x4ddc4d);}return _0x53472b[_0xe177('0x2d')](_0x4ddc4d)['end']();};}function respondWithResult(_0x566744,_0x19d8ad){_0x19d8ad=_0x19d8ad||0xc8;return function(_0x2e5277){if(_0x2e5277){return _0x566744[_0xe177('0x2d')](_0x19d8ad)[_0xe177('0x2e')](_0x2e5277);}};}function respondWithFilteredResult(_0x150f01,_0xf89df7){return function(_0x3b2796){if(_0x3b2796){var _0x1f661d=typeof _0xf89df7['offset']===_0xe177('0x2f')&&typeof _0xf89df7[_0xe177('0x30')]===_0xe177('0x2f');var _0x49206e=_0x3b2796[_0xe177('0x31')];var _0x52d01f=_0x1f661d?0x0:_0xf89df7['offset'];var _0x51ed9a=_0x1f661d?_0x3b2796[_0xe177('0x31')]:_0xf89df7[_0xe177('0x32')]+_0xf89df7[_0xe177('0x30')];var _0x4e50d5;if(_0x51ed9a>=_0x49206e){_0x51ed9a=_0x49206e;_0x4e50d5=0xc8;}else{_0x4e50d5=0xce;}_0x150f01['status'](_0x4e50d5);return _0x150f01[_0xe177('0x33')](_0xe177('0x34'),_0x52d01f+'-'+_0x51ed9a+'/'+_0x49206e)[_0xe177('0x2e')](_0x3b2796);}return null;};}function patchUpdates(_0x34e2a9){return function(_0x3773f9){try{jsonpatch['apply'](_0x3773f9,_0x34e2a9,!![]);}catch(_0x193d68){return BPromise['reject'](_0x193d68);}return _0x3773f9['save']();};}function saveUpdates(_0x492089,_0x43ce4d){return function(_0x2d3456){if(_0x2d3456){return _0x2d3456[_0xe177('0x35')](_0x492089)[_0xe177('0x36')](function(_0x1c81f4){return _0x1c81f4;});}return null;};}function removeEntity(_0x9ce389,_0x17400e){return function(_0x2dd7e1){if(_0x2dd7e1){return _0x2dd7e1[_0xe177('0x37')]()['then'](function(){var _0x2b8d33=_0x2dd7e1[_0xe177('0x38')]({'plain':!![]});var _0x3f4f53='WhatsappAccounts';return db[_0xe177('0x39')][_0xe177('0x37')]({'where':{'type':_0x3f4f53,'resourceId':_0x2b8d33['id']}})[_0xe177('0x36')](function(){return _0x2dd7e1;});})[_0xe177('0x36')](function(){_0x9ce389[_0xe177('0x2d')](0xcc)[_0xe177('0x3a')]();});}};}function handleEntityNotFound(_0x12d949,_0x40f992){return function(_0x5c3c11){if(!_0x5c3c11){_0x12d949[_0xe177('0x2c')](0x194);}return _0x5c3c11;};}function handleError(_0x35b904,_0x3ca6df){_0x3ca6df=_0x3ca6df||0x1f4;return function(_0x4b7581){logger['error'](_0x4b7581[_0xe177('0x3b')]);if(_0x4b7581['name']){delete _0x4b7581[_0xe177('0x3c')];}_0x35b904['status'](_0x3ca6df)[_0xe177('0x3d')](_0x4b7581);};}exports[_0xe177('0x3e')]=function(_0x29f0fd,_0x513223){var _0x32f420={'include':[{'model':db[_0xe177('0x3f')],'as':_0xe177('0x40')}]},_0x132fee={},_0x3200ea={'count':0x0,'rows':[]};var _0x4ba5cb=_[_0xe177('0x41')](db[_0xe177('0x42')][_0xe177('0x43')],function(_0x1bd9ca){return{'name':_0x1bd9ca[_0xe177('0x44')],'type':_0x1bd9ca[_0xe177('0x45')]['key']};});_0x132fee['model']=_[_0xe177('0x41')](_0x4ba5cb,_0xe177('0x3c'));_0x132fee[_0xe177('0x46')]=_[_0xe177('0x47')](_0x29f0fd[_0xe177('0x46')]);_0x132fee[_0xe177('0x48')]=_[_0xe177('0x49')](_0x132fee[_0xe177('0x4a')],_0x132fee[_0xe177('0x46')]);_0x32f420[_0xe177('0x4b')]=_['intersection'](_0x132fee[_0xe177('0x4a')],qs[_0xe177('0x4c')](_0x29f0fd[_0xe177('0x46')]['fields']));_0x32f420['attributes']=_0x32f420['attributes'][_0xe177('0x4d')]?_0x32f420[_0xe177('0x4b')]:_0x132fee[_0xe177('0x4a')];if(!_0x29f0fd[_0xe177('0x46')][_0xe177('0x4e')](_0xe177('0x4f'))){_0x32f420[_0xe177('0x30')]=qs[_0xe177('0x30')](_0x29f0fd[_0xe177('0x46')]['limit']);_0x32f420[_0xe177('0x32')]=qs[_0xe177('0x32')](_0x29f0fd[_0xe177('0x46')]['offset']);}_0x32f420[_0xe177('0x50')]=qs[_0xe177('0x51')](_0x29f0fd['query'][_0xe177('0x51')]);_0x32f420['where']=qs[_0xe177('0x48')](_[_0xe177('0x52')](_0x29f0fd[_0xe177('0x46')],_0x132fee[_0xe177('0x48')]),_0x4ba5cb);if(_0x29f0fd['query'][_0xe177('0x53')]){_0x32f420['where']=_['merge'](_0x32f420[_0xe177('0x54')],{'$or':_['map'](_0x4ba5cb,function(_0x77abc0){if(_0x77abc0[_0xe177('0x45')]!==_0xe177('0x55')){var _0x527938={};_0x527938[_0x77abc0[_0xe177('0x3c')]]={'$like':'%'+_0x29f0fd['query'][_0xe177('0x53')]+'%'};return _0x527938;}})});}_0x32f420=_['merge']({},_0x32f420,_0x29f0fd[_0xe177('0x56')]);var _0x561bf3={'where':_0x32f420['where']};return db[_0xe177('0x42')][_0xe177('0x31')](_0x561bf3)[_0xe177('0x36')](function(_0x4a4988){_0x3200ea[_0xe177('0x31')]=_0x4a4988;if(_0x29f0fd[_0xe177('0x46')]['includeAll']){_0x32f420[_0xe177('0x57')]=[{'all':!![]}];}return db[_0xe177('0x42')][_0xe177('0x58')](_0x32f420);})[_0xe177('0x36')](function(_0x206497){_0x3200ea[_0xe177('0x59')]=_0x206497;return _0x3200ea;})[_0xe177('0x36')](respondWithFilteredResult(_0x513223,_0x32f420))[_0xe177('0x2b')](handleError(_0x513223,null));};exports[_0xe177('0x5a')]=function(_0x52efc9,_0x71709){var _0x372030={'raw':![],'where':{'id':_0x52efc9[_0xe177('0x5b')]['id']},'include':[{'model':db[_0xe177('0x3f')],'as':_0xe177('0x40')}]},_0x19a675={};_0x19a675['model']=_[_0xe177('0x47')](db['WhatsappAccount'][_0xe177('0x43')]);_0x19a675[_0xe177('0x46')]=_[_0xe177('0x47')](_0x52efc9['query']);_0x19a675[_0xe177('0x48')]=_[_0xe177('0x49')](_0x19a675['model'],_0x19a675[_0xe177('0x46')]);_0x372030[_0xe177('0x4b')]=_['intersection'](_0x19a675[_0xe177('0x4a')],qs[_0xe177('0x4c')](_0x52efc9['query'][_0xe177('0x4c')]));_0x372030[_0xe177('0x4b')]=_0x372030[_0xe177('0x4b')]['length']?_0x372030[_0xe177('0x4b')]:_0x19a675[_0xe177('0x4a')];if(_0x52efc9[_0xe177('0x46')][_0xe177('0x5c')]){_0x372030[_0xe177('0x57')]=[{'all':!![]}];}_0x372030=_[_0xe177('0x5d')]({},_0x372030,_0x52efc9[_0xe177('0x56')]);return db[_0xe177('0x42')][_0xe177('0x5e')](_0x372030)[_0xe177('0x36')](handleEntityNotFound(_0x71709,null))[_0xe177('0x36')](respondWithResult(_0x71709,null))[_0xe177('0x2b')](handleError(_0x71709,null));};exports['create']=function(_0x47db1b,_0x2854b2){return db[_0xe177('0x42')][_0xe177('0x5f')](_0x47db1b[_0xe177('0x60')],{})[_0xe177('0x36')](function(_0x423ddd){var _0x54e646=_0x47db1b['user']['get']({'plain':!![]});if(!_0x54e646)throw new Error(_0xe177('0x61'));if(_0x54e646[_0xe177('0x62')]==='user'){var _0x3333b6=_0x423ddd[_0xe177('0x38')]({'plain':!![]});var _0x3604d4='WhatsappAccounts';return db[_0xe177('0x63')][_0xe177('0x5e')]({'where':{'name':_0x3604d4,'userProfileId':_0x54e646[_0xe177('0x64')]},'raw':!![]})[_0xe177('0x36')](function(_0x6ef1d9){if(_0x6ef1d9&&_0x6ef1d9[_0xe177('0x65')]===0x0){return db[_0xe177('0x39')]['create']({'name':_0x3333b6['name'],'resourceId':_0x3333b6['id'],'type':_0x6ef1d9['name'],'sectionId':_0x6ef1d9['id']},{})[_0xe177('0x36')](function(){return _0x423ddd;});}else{return _0x423ddd;}})['catch'](function(_0x407092){logger[_0xe177('0x26')](_0xe177('0x66'),_0x407092);throw _0x407092;});}return _0x423ddd;})[_0xe177('0x36')](respondWithResult(_0x2854b2,0xc9))[_0xe177('0x2b')](handleError(_0x2854b2,null));};exports[_0xe177('0x35')]=function(_0x2a3b7e,_0x225639){if(_0x2a3b7e[_0xe177('0x60')]['id']){delete _0x2a3b7e[_0xe177('0x60')]['id'];}return db[_0xe177('0x42')]['find']({'where':{'id':_0x2a3b7e[_0xe177('0x5b')]['id']},'include':[{'model':db[_0xe177('0x3f')],'as':_0xe177('0x40')}]})[_0xe177('0x36')](handleEntityNotFound(_0x225639,null))[_0xe177('0x36')](saveUpdates(_0x2a3b7e['body'],null))[_0xe177('0x36')](respondWithResult(_0x225639,null))[_0xe177('0x2b')](handleError(_0x225639,null));};exports[_0xe177('0x37')]=function(_0x3e7ae1,_0x4abecc){return db['WhatsappAccount'][_0xe177('0x5e')]({'where':{'id':_0x3e7ae1[_0xe177('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4abecc,null))[_0xe177('0x36')](removeEntity(_0x4abecc,null))[_0xe177('0x2b')](handleError(_0x4abecc,null));};exports['describe']=function(_0xa608a2,_0x5e6cee){return db[_0xe177('0x42')][_0xe177('0x67')]()[_0xe177('0x36')](respondWithResult(_0x5e6cee,null))[_0xe177('0x2b')](handleError(_0x5e6cee,null));};exports[_0xe177('0x68')]=function(_0x439530,_0x82988,_0x2b597a){if(_0x439530['body']['id']){delete _0x439530[_0xe177('0x60')]['id'];}return db[_0xe177('0x42')][_0xe177('0x5e')]({'where':{'id':_0x439530['params']['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x82988,null))[_0xe177('0x36')](function(_0x256534){if(_0x256534){_0x439530[_0xe177('0x60')][_0xe177('0x69')]=_0x256534['id'];return db[_0xe177('0x6a')][_0xe177('0x5f')](_0x439530[_0xe177('0x60')]);}})[_0xe177('0x36')](respondWithResult(_0x82988,null))[_0xe177('0x2b')](handleError(_0x82988,null));};exports[_0xe177('0x6b')]=function(_0x3daa26,_0x34e243,_0x3bed8d){var _0x43a1f4={'raw':![],'where':{}};var _0xc6d685={};var _0x527f5c={'count':0x0,'rows':[]};return db[_0xe177('0x42')][_0xe177('0x6c')]({'where':{'id':_0x3daa26[_0xe177('0x5b')]['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x34e243,null))[_0xe177('0x36')](function(_0x29332e){if(_0x29332e){_0xc6d685[_0xe177('0x4a')]=_[_0xe177('0x47')](db[_0xe177('0x6a')][_0xe177('0x43')]);_0xc6d685['query']=_[_0xe177('0x47')](_0x3daa26[_0xe177('0x46')]);_0xc6d685[_0xe177('0x48')]=_[_0xe177('0x49')](_0xc6d685['model'],_0xc6d685['query']);_0x43a1f4[_0xe177('0x4b')]=_[_0xe177('0x49')](_0xc6d685[_0xe177('0x4a')],qs['fields'](_0x3daa26['query'][_0xe177('0x4c')]));_0x43a1f4[_0xe177('0x4b')]=_0x43a1f4['attributes'][_0xe177('0x4d')]?_0x43a1f4['attributes']:_0xc6d685[_0xe177('0x4a')];if(!_0x3daa26[_0xe177('0x46')][_0xe177('0x4e')]('nolimit')){_0x43a1f4[_0xe177('0x30')]=qs[_0xe177('0x30')](_0x3daa26[_0xe177('0x46')][_0xe177('0x30')]);_0x43a1f4[_0xe177('0x32')]=qs[_0xe177('0x32')](_0x3daa26[_0xe177('0x46')]['offset']);}_0x43a1f4[_0xe177('0x50')]=qs[_0xe177('0x51')](_0x3daa26[_0xe177('0x46')][_0xe177('0x51')]);_0x43a1f4[_0xe177('0x54')]=qs[_0xe177('0x48')](_[_0xe177('0x52')](_0x3daa26['query'],_0xc6d685['filters']));_0x43a1f4[_0xe177('0x54')][_0xe177('0x69')]=_0x29332e['id'];if(_0x3daa26[_0xe177('0x46')][_0xe177('0x53')]){_0x43a1f4[_0xe177('0x54')]=_[_0xe177('0x5d')](_0x43a1f4[_0xe177('0x54')],{'$or':_['map'](_0x43a1f4[_0xe177('0x4b')],function(_0x30b92c){var _0x44e041={};_0x44e041[_0x30b92c]={'$like':'%'+_0x3daa26[_0xe177('0x46')]['filter']+'%'};return _0x44e041;})});}_0x43a1f4=_[_0xe177('0x5d')]({},_0x43a1f4,_0x3daa26[_0xe177('0x56')]);return db[_0xe177('0x6a')][_0xe177('0x31')]({'where':_0x43a1f4[_0xe177('0x54')]})[_0xe177('0x36')](function(_0x5e2e6b){_0x527f5c[_0xe177('0x31')]=_0x5e2e6b;if(_0x3daa26['query'][_0xe177('0x5c')]){_0x43a1f4[_0xe177('0x57')]=[{'all':!![]}];}return db[_0xe177('0x6a')]['findAll'](_0x43a1f4);})[_0xe177('0x36')](function(_0x19c550){_0x527f5c[_0xe177('0x59')]=_0x19c550;return _0x527f5c;});}})[_0xe177('0x36')](respondWithFilteredResult(_0x34e243,_0x43a1f4))[_0xe177('0x2b')](handleError(_0x34e243,null));};exports[_0xe177('0x6d')]=function(_0x4b3b11,_0x59488c,_0x5a7b3a){return db[_0xe177('0x42')]['find']({'where':{'id':_0x4b3b11[_0xe177('0x5b')]['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x59488c,null))[_0xe177('0x36')](function(_0x4a5a75){if(_0x4a5a75){return _0x4a5a75[_0xe177('0x6d')](_0x4b3b11['query'][_0xe177('0x6e')]);}})['then'](respondWithStatusCode(_0x59488c,null))[_0xe177('0x2b')](handleError(_0x59488c,null));};exports[_0xe177('0x6f')]=function(_0x157933,_0x5a5a41,_0x931f5){if(_0x157933[_0xe177('0x60')]['id']){delete _0x157933[_0xe177('0x60')]['id'];}return db['WhatsappAccount'][_0xe177('0x5e')]({'where':{'id':_0x157933['params']['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x5a5a41,null))[_0xe177('0x36')](function(_0x271e6b){if(_0x271e6b){_0x157933[_0xe177('0x60')][_0xe177('0x69')]=_0x271e6b['id'];return db[_0xe177('0x70')][_0xe177('0x5f')](_0x157933[_0xe177('0x60')]);}})['then'](respondWithResult(_0x5a5a41,null))[_0xe177('0x2b')](handleError(_0x5a5a41,null));};exports[_0xe177('0x71')]=function(_0x293f95,_0x3b6c1d,_0x12b97b){var _0x2393b9={'raw':![],'where':{}};var _0x11c3ac={};var _0x265789={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xe177('0x6c')]({'where':{'id':_0x293f95[_0xe177('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b6c1d,null))['then'](function(_0x592c76){if(_0x592c76){_0x11c3ac['model']=_['keys'](db['CannedAnswer'][_0xe177('0x43')]);_0x11c3ac[_0xe177('0x46')]=_[_0xe177('0x47')](_0x293f95[_0xe177('0x46')]);_0x11c3ac[_0xe177('0x48')]=_[_0xe177('0x49')](_0x11c3ac[_0xe177('0x4a')],_0x11c3ac[_0xe177('0x46')]);_0x2393b9[_0xe177('0x4b')]=_[_0xe177('0x49')](_0x11c3ac[_0xe177('0x4a')],qs[_0xe177('0x4c')](_0x293f95[_0xe177('0x46')]['fields']));_0x2393b9[_0xe177('0x4b')]=_0x2393b9[_0xe177('0x4b')][_0xe177('0x4d')]?_0x2393b9[_0xe177('0x4b')]:_0x11c3ac[_0xe177('0x4a')];if(!_0x293f95[_0xe177('0x46')][_0xe177('0x4e')](_0xe177('0x4f'))){_0x2393b9[_0xe177('0x30')]=qs[_0xe177('0x30')](_0x293f95[_0xe177('0x46')][_0xe177('0x30')]);_0x2393b9[_0xe177('0x32')]=qs['offset'](_0x293f95['query']['offset']);}_0x2393b9[_0xe177('0x50')]=qs[_0xe177('0x51')](_0x293f95['query'][_0xe177('0x51')]);_0x2393b9['where']=qs[_0xe177('0x48')](_[_0xe177('0x52')](_0x293f95[_0xe177('0x46')],_0x11c3ac[_0xe177('0x48')]));_0x2393b9['where'][_0xe177('0x69')]=_0x592c76['id'];if(_0x293f95['query'][_0xe177('0x53')]){_0x2393b9[_0xe177('0x54')]=_[_0xe177('0x5d')](_0x2393b9[_0xe177('0x54')],{'$or':_['map'](_0x2393b9[_0xe177('0x4b')],function(_0x43c63a){var _0x2d8cbd={};_0x2d8cbd[_0x43c63a]={'$like':'%'+_0x293f95['query'][_0xe177('0x53')]+'%'};return _0x2d8cbd;})});}_0x2393b9=_[_0xe177('0x5d')]({},_0x2393b9,_0x293f95[_0xe177('0x56')]);return db['CannedAnswer']['count']({'where':_0x2393b9[_0xe177('0x54')]})[_0xe177('0x36')](function(_0x3e8d20){_0x265789[_0xe177('0x31')]=_0x3e8d20;if(_0x293f95[_0xe177('0x46')][_0xe177('0x5c')]){_0x2393b9[_0xe177('0x57')]=[{'all':!![]}];}return db[_0xe177('0x70')][_0xe177('0x58')](_0x2393b9);})[_0xe177('0x36')](function(_0x2f5d15){_0x265789[_0xe177('0x59')]=_0x2f5d15;return _0x265789;});}})[_0xe177('0x36')](respondWithFilteredResult(_0x3b6c1d,_0x2393b9))[_0xe177('0x2b')](handleError(_0x3b6c1d,null));};exports[_0xe177('0x72')]=function(_0x438068,_0x3f901a,_0x41d120){return db['WhatsappAccount'][_0xe177('0x5e')]({'where':{'id':_0x438068[_0xe177('0x5b')]['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x3f901a,null))['then'](function(_0x28382e){if(_0x28382e){return _0x28382e[_0xe177('0x72')](_0x438068[_0xe177('0x46')]['ids']);}})[_0xe177('0x36')](respondWithStatusCode(_0x3f901a,null))[_0xe177('0x2b')](handleError(_0x3f901a,null));};exports[_0xe177('0x73')]=function(_0x564fe3,_0x1a672a,_0x562aaa){return db[_0xe177('0x42')][_0xe177('0x5e')]({'where':{'id':_0x564fe3[_0xe177('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1a672a,null))[_0xe177('0x36')](function(_0x43273d){if(_0x43273d){return _0x43273d[_0xe177('0x73')](_0x564fe3[_0xe177('0x60')][_0xe177('0x6e')],_[_0xe177('0x74')](_0x564fe3[_0xe177('0x60')],[_0xe177('0x6e'),'id'])||{})['spread'](function(_0x1ef815){for(var _0x2465d9=0x0;_0x2465d9<_0x564fe3[_0xe177('0x60')][_0xe177('0x6e')][_0xe177('0x4d')];_0x2465d9+=0x1){socket[_0xe177('0x75')](_0xe177('0x76'),{'UserId':Number(_0x564fe3[_0xe177('0x60')][_0xe177('0x6e')][_0x2465d9]),'WhatsappAccountId':Number(_0x564fe3['params']['id'])});}return _0x1ef815;});}})[_0xe177('0x36')](respondWithResult(_0x1a672a,null))[_0xe177('0x2b')](handleError(_0x1a672a,null));};exports[_0xe177('0x77')]=function(_0x2f6a96,_0x4cf205,_0x591916){return db[_0xe177('0x42')][_0xe177('0x5e')]({'where':{'id':_0x2f6a96[_0xe177('0x5b')]['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x4cf205,null))['then'](function(_0x51cbfd){if(_0x51cbfd){return _0x51cbfd[_0xe177('0x77')](_0x2f6a96['query'][_0xe177('0x6e')])[_0xe177('0x36')](function(){if(_[_0xe177('0x78')](_0x2f6a96[_0xe177('0x46')]['ids'])){for(var _0x4f276d=0x0;_0x4f276d<_0x2f6a96[_0xe177('0x46')][_0xe177('0x6e')][_0xe177('0x4d')];_0x4f276d+=0x1){socket[_0xe177('0x75')](_0xe177('0x79'),{'UserId':Number(_0x2f6a96[_0xe177('0x46')]['ids'][_0x4f276d]),'WhatsappAccountId':Number(_0x2f6a96[_0xe177('0x5b')]['id'])});}}else{socket[_0xe177('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x2f6a96[_0xe177('0x46')][_0xe177('0x6e')]),'WhatsappAccountId':Number(_0x2f6a96[_0xe177('0x5b')]['id'])});}});}})[_0xe177('0x36')](respondWithStatusCode(_0x4cf205,null))[_0xe177('0x2b')](handleError(_0x4cf205,null));};exports[_0xe177('0x7a')]=function(_0x1f861f,_0x2b4c40,_0x5d848c){var _0x47c76d={};var _0x3f6f7c={};var _0x39a63e;var _0x4bcddb;return db[_0xe177('0x42')][_0xe177('0x6c')]({'where':{'id':_0x1f861f[_0xe177('0x5b')]['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x2b4c40,null))[_0xe177('0x36')](function(_0x48e031){if(_0x48e031){_0x39a63e=_0x48e031;_0x3f6f7c[_0xe177('0x4a')]=_[_0xe177('0x47')](db['User'][_0xe177('0x43')]);_0x3f6f7c[_0xe177('0x46')]=_['keys'](_0x1f861f['query']);_0x3f6f7c[_0xe177('0x48')]=_[_0xe177('0x49')](_0x3f6f7c[_0xe177('0x4a')],_0x3f6f7c[_0xe177('0x46')]);_0x47c76d['attributes']=_['intersection'](_0x3f6f7c[_0xe177('0x4a')],qs[_0xe177('0x4c')](_0x1f861f['query'][_0xe177('0x4c')]));_0x47c76d['attributes']=_0x47c76d[_0xe177('0x4b')][_0xe177('0x4d')]?_0x47c76d[_0xe177('0x4b')]:_0x3f6f7c[_0xe177('0x4a')];_0x47c76d['order']=qs[_0xe177('0x51')](_0x1f861f['query']['sort']);_0x47c76d['where']=qs[_0xe177('0x48')](_[_0xe177('0x52')](_0x1f861f['query'],_0x3f6f7c[_0xe177('0x48')]));if(_0x1f861f[_0xe177('0x46')][_0xe177('0x53')]){_0x47c76d['where']=_[_0xe177('0x5d')](_0x47c76d[_0xe177('0x54')],{'$or':_[_0xe177('0x41')](_0x47c76d[_0xe177('0x4b')],function(_0x52e046){var _0x2a6c03={};_0x2a6c03[_0x52e046]={'$like':'%'+_0x1f861f[_0xe177('0x46')][_0xe177('0x53')]+'%'};return _0x2a6c03;})});}_0x47c76d=_[_0xe177('0x5d')]({},_0x47c76d,_0x1f861f[_0xe177('0x56')]);return _0x39a63e[_0xe177('0x7a')](_0x47c76d);}})['then'](function(_0x2b58f4){if(_0x2b58f4){_0x4bcddb=_0x2b58f4[_0xe177('0x4d')];if(!_0x1f861f[_0xe177('0x46')][_0xe177('0x4e')](_0xe177('0x4f'))){_0x47c76d[_0xe177('0x30')]=qs[_0xe177('0x30')](_0x1f861f[_0xe177('0x46')][_0xe177('0x30')]);_0x47c76d[_0xe177('0x32')]=qs['offset'](_0x1f861f[_0xe177('0x46')][_0xe177('0x32')]);}return _0x39a63e[_0xe177('0x7a')](_0x47c76d);}})[_0xe177('0x36')](function(_0x497668){if(_0x497668){return _0x497668?{'count':_0x4bcddb,'rows':_0x497668}:null;}})[_0xe177('0x36')](respondWithResult(_0x2b4c40,null))['catch'](handleError(_0x2b4c40,null));};exports[_0xe177('0x7b')]=function(_0x3d3725,_0x4b4704,_0x441991){return db[_0xe177('0x42')][_0xe177('0x6c')]({'where':{'id':_0x3d3725[_0xe177('0x5b')]['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x4b4704,null))['then'](function(_0x1ed1a2){if(_0x1ed1a2){return db[_0xe177('0x7c')]['transaction'](function(_0x3f88f5){return db[_0xe177('0x7d')][_0xe177('0x37')]({'where':{'WhatsappAccountId':_0x3d3725[_0xe177('0x5b')]['id']},'transaction':_0x3f88f5})[_0xe177('0x36')](function(_0x286e0f){var _0x41146b=_['map'](_0x3d3725[_0xe177('0x60')],function(_0x9df915){_0x9df915['WhatsappAccountId']=_0x3d3725[_0xe177('0x5b')]['id'];return _0x9df915;});return db['WhatsappApplication']['bulkCreate'](_0x41146b,{'transaction':_0x3f88f5});});})[_0xe177('0x36')](function(){return db[_0xe177('0x7d')][_0xe177('0x7e')]({'where':{'WhatsappAccountId':_0x3d3725[_0xe177('0x5b')]['id']},'order':_0xe177('0x7f')});});}})['then'](respondWithResult(_0x4b4704,null))['catch'](handleError(_0x4b4704,null));};exports['getApplications']=function(_0x44d719,_0x25b8f7,_0x43f222){var _0x338f17={};var _0x3a09df={};var _0x5a4fdd;var _0x370422;return db[_0xe177('0x42')][_0xe177('0x6c')]({'where':{'id':_0x44d719[_0xe177('0x5b')]['id']}})[_0xe177('0x36')](handleEntityNotFound(_0x25b8f7,null))[_0xe177('0x36')](function(_0x4a4c0d){if(_0x4a4c0d){_0x5a4fdd=_0x4a4c0d;_0x3a09df[_0xe177('0x4a')]=_[_0xe177('0x47')](db[_0xe177('0x7d')][_0xe177('0x43')]);_0x3a09df[_0xe177('0x46')]=_[_0xe177('0x47')](_0x44d719[_0xe177('0x46')]);_0x3a09df[_0xe177('0x48')]=_[_0xe177('0x49')](_0x3a09df[_0xe177('0x4a')],_0x3a09df[_0xe177('0x46')]);_0x338f17[_0xe177('0x4b')]=_['intersection'](_0x3a09df[_0xe177('0x4a')],qs[_0xe177('0x4c')](_0x44d719[_0xe177('0x46')][_0xe177('0x4c')]));_0x338f17[_0xe177('0x4b')]=_0x338f17[_0xe177('0x4b')]['length']?_0x338f17[_0xe177('0x4b')]:_0x3a09df['model'];_0x338f17[_0xe177('0x50')]=qs['sort'](_0x44d719[_0xe177('0x46')][_0xe177('0x51')]);_0x338f17[_0xe177('0x54')]=qs[_0xe177('0x48')](_[_0xe177('0x52')](_0x44d719[_0xe177('0x46')],_0x3a09df['filters']));if(_0x44d719[_0xe177('0x46')][_0xe177('0x53')]){_0x338f17[_0xe177('0x54')]=_[_0xe177('0x5d')](_0x338f17[_0xe177('0x54')],{'$or':_[_0xe177('0x41')](_0x338f17[_0xe177('0x4b')],function(_0x43bbef){var _0x59fca1={};_0x59fca1[_0x43bbef]={'$like':'%'+_0x44d719[_0xe177('0x46')]['filter']+'%'};return _0x59fca1;})});}_0x338f17=_[_0xe177('0x5d')]({},_0x338f17,_0x44d719[_0xe177('0x56')]);return _0x5a4fdd['getApplications'](_0x338f17);}})[_0xe177('0x36')](function(_0x2b1422){if(_0x2b1422){_0x370422=_0x2b1422['length'];if(!_0x44d719[_0xe177('0x46')][_0xe177('0x4e')](_0xe177('0x4f'))){_0x338f17[_0xe177('0x30')]=qs['limit'](_0x44d719[_0xe177('0x46')][_0xe177('0x30')]);_0x338f17[_0xe177('0x32')]=qs[_0xe177('0x32')](_0x44d719[_0xe177('0x46')][_0xe177('0x32')]);}return _0x5a4fdd['getApplications'](_0x338f17);}})[_0xe177('0x36')](function(_0x122469){if(_0x122469){return _0x122469?{'count':_0x370422,'rows':_0x122469}:null;}})['then'](respondWithResult(_0x25b8f7,null))[_0xe177('0x2b')](handleError(_0x25b8f7,null));};exports[_0xe177('0x80')]=function(_0x1bda60,_0x97f2b,_0x2559a5){var _0xa72d0f={'channel':_0xe177('0x81')};var _0x27973d=[];var _0x1c61a6=[];var _0x3146a5={};return db[_0xe177('0x42')][_0xe177('0x5e')]({'where':{'id':_0x1bda60[_0xe177('0x5b')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xe177('0x36')](handleEntityNotFound(_0x97f2b,null))[_0xe177('0x36')](function(_0x5e9303){_0xa72d0f[_0xe177('0x82')]=_0x5e9303;_0xa72d0f[_0xe177('0x83')]=_[_0xe177('0x84')](_0x5e9303[_0xe177('0x85')],[_0xe177('0x7f')],[_0xe177('0x86')]);if(_0xa72d0f[_0xe177('0x82')][_0xe177('0x85')]){delete _0xa72d0f[_0xe177('0x82')][_0xe177('0x85')];}return db[_0xe177('0x87')][_0xe177('0x67')]();})[_0xe177('0x36')](function(_0x16fac8){if(!_0x16fac8){throw new db[(_0xe177('0x88'))]['ValidationError'](_0xe177('0x89'));}_0x27973d=_[_0xe177('0x8a')](_[_0xe177('0x47')](_0x16fac8),['createdAt',_0xe177('0x8b')]);_0x1c61a6=_[_0xe177('0x8a')](_[_0xe177('0x47')](_0x16fac8),[_0xe177('0x8c'),_0xe177('0x8b'),_0xe177('0x8d'),'ListId']);_0xa72d0f[_0xe177('0x60')]={'mapKey':_0xe177('0x8e')};if(_0xa72d0f[_0xe177('0x82')]['type']&&_0xa72d0f[_0xe177('0x82')][_0xe177('0x45')]==='twilio'){_0xa72d0f[_0xe177('0x60')]['from']=_0x1bda60['body'][_0xe177('0x8f')]['replace'](_0xe177('0x90'),'');_0xa72d0f[_0xe177('0x60')]['body']=_0x1bda60['body'][_0xe177('0x91')];_0xa72d0f[_0xe177('0x60')][_0xe177('0x92')]=_0x1bda60['body'][_0xe177('0x93')];}if(_0xa72d0f[_0xe177('0x60')]['id']){delete _0xa72d0f['body']['id'];}if(_[_0xe177('0x94')](_0xa72d0f[_0xe177('0x60')]['from'])){throw new db[(_0xe177('0x88'))][(_0xe177('0x95'))]('from\x20is\x20mandatory');}if(_[_0xe177('0x94')](_0xa72d0f[_0xe177('0x60')][_0xe177('0x60')])||_0xa72d0f[_0xe177('0x60')][_0xe177('0x60')]===''){throw new db[(_0xe177('0x88'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xa72d0f[_0xe177('0x60')]['mapKey'])){throw new db[(_0xe177('0x88'))][(_0xe177('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c61a6);}if(!_[_0xe177('0x96')](_0x1c61a6,_0xa72d0f[_0xe177('0x60')][_0xe177('0x97')])){throw new db[(_0xe177('0x88'))][(_0xe177('0x95'))](_0xe177('0x98')+_0x1c61a6);}_0x3146a5[_0xa72d0f[_0xe177('0x60')][_0xe177('0x97')]]=_0xa72d0f[_0xe177('0x60')][_0xe177('0x99')];return db[_0xe177('0x9a')][_0xe177('0x5e')]({'where':{'id':_0xa72d0f[_0xe177('0x82')][_0xe177('0x9b')]},'include':[{'model':db['CmContact'],'as':_0xe177('0x9c'),'where':_0x3146a5,'limit':0x1,'order':[[_0xe177('0x8b'),'DESC']]}]});})[_0xe177('0x36')](handleEntityNotFound(_0x97f2b,null))[_0xe177('0x36')](function(_0x129868){if(_0x129868){_0xa72d0f[_0xe177('0x9d')]=_['omit'](_0x129868,['Contacts']);if(_0x129868[_0xe177('0x9c')]['length']){return _0x129868[_0xe177('0x9c')][0x0];}var _0x39e116=_['defaults'](_0xa72d0f[_0xe177('0x60')],{'firstName':_0xa72d0f['body'][_0xe177('0x99')],'ListId':_0x129868['id']});_0x39e116[_0xa72d0f[_0xe177('0x60')][_0xe177('0x97')]]=_0xa72d0f[_0xe177('0x60')]['from'];return db[_0xe177('0x87')][_0xe177('0x5f')](_0x39e116,{'fields':_0x27973d,'raw':!![]});}})[_0xe177('0x36')](handleEntityNotFound(_0x97f2b,null))[_0xe177('0x36')](function(_0x311b77){if(_0x311b77){_0xa72d0f[_0xe177('0x9e')]=_0x311b77;var _0x40fc74={'ContactId':_0x311b77['id'],'phone':_0xa72d0f[_0xe177('0x60')][_0xe177('0x99')],'WhatsappAccountId':_0x1bda60[_0xe177('0x5b')]['id']};var _0x2da465={'ContactId':_0x311b77['id'],'WhatsappAccountId':_0x1bda60[_0xe177('0x5b')]['id'],'closed':![]};return db[_0xe177('0x9f')][_0xe177('0x5e')]({'where':_0x2da465})[_0xe177('0x36')](function(_0x42d0af){if(_0x42d0af){return[_0x42d0af,![]];}return db[_0xe177('0x9f')]['create'](_0x40fc74)[_0xe177('0x36')](function(_0x1c253a){return[_0x1c253a,!![]];});});}})['spread'](function(_0x4e381a,_0x440602){_0xa72d0f[_0xe177('0xa0')]=_0x4e381a[_0xe177('0x38')]({'plain':!![]});_0xa72d0f[_0xe177('0xa0')][_0xe177('0xa1')]=![];if(_0x440602){if(_0xa72d0f['account']['autoclose']){_0xa72d0f['applications'][_0xe177('0xa2')]({'id':0x0,'priority':_0xa72d0f[_0xe177('0x83')][_0xe177('0x4d')]+0x1,'app':'close','appdata':_0xe177('0xa3'),'interval':_0xe177('0xa4')});}_0xa72d0f['interaction'][_0xe177('0xa1')]=!![];}return db[_0xe177('0xa5')]['create']({'phone':_0xa72d0f[_0xe177('0x60')][_0xe177('0x99')],'messageId':_0xa72d0f[_0xe177('0x60')][_0xe177('0x92')],'body':_0xa72d0f[_0xe177('0x60')]['body'],'WhatsappAccountId':_0x1bda60[_0xe177('0x5b')]['id'],'WhatsappInteractionId':_0x4e381a['id'],'direction':'in','ContactId':_0x4e381a[_0xe177('0xa6')],'AttachmentId':_0xa72d0f[_0xe177('0x60')][_0xe177('0xa7')]});})[_0xe177('0x36')](function(_0x4875c4){_0xa72d0f[_0xe177('0x28')]=_0x4875c4;if(_0xa72d0f['interaction']['UserId']){return db[_0xe177('0xa8')][_0xe177('0x5e')]({'attributes':['id','name'],'where':{'id':_0xa72d0f[_0xe177('0xa0')][_0xe177('0xa9')]}})['then'](function(_0x285a1f){if(_0x285a1f){_0xa72d0f[_0xe177('0x83')][_0xe177('0xaa')]({'id':0x0,'priority':0x0,'app':_0xe177('0xab'),'appdata':_0x285a1f[_0xe177('0x3c')]+','+(_0xa72d0f[_0xe177('0x82')][_0xe177('0xac')]||0xa),'interval':_0xe177('0xa4')});}return respondWithRpcPromise('Start',_0xe177('0xad'),_0xa72d0f);});}return respondWithRpcPromise(_0xe177('0xae'),_0xe177('0xad'),_0xa72d0f);})[_0xe177('0x36')](function(_0x21eba1){if(_0x21eba1){var _0x4abe12=0xc8;var _0x2453e2='receiveMessage';logger[_0xe177('0x29')](_0xe177('0x24'),_0x2453e2,_0x4abe12,'entity\x20found');logger['debug'](_0xe177('0xaf'),_0x2453e2,_0x4abe12,'entity\x20found',JSON[_0xe177('0x25')](_0x21eba1));if(_0xa72d0f[_0xe177('0x82')][_0xe177('0x45')]===_0xe177('0xb0')){return _0x97f2b[_0xe177('0x2d')](_0x4abe12)[_0xe177('0x33')](_0xe177('0xb1'),_0xe177('0xb2'))[_0xe177('0x3d')]('\x0a');}else{return _0x97f2b[_0xe177('0x2d')](_0x4abe12)[_0xe177('0x2e')](_0x21eba1);}}})['catch'](handleError(_0x97f2b,null));};exports[_0xe177('0x3d')]=function(_0x75af23,_0x1c4390,_0x280eb1){var _0x3a6e0d,_0x30699b,_0x1beb7b;if(_[_0xe177('0x94')](_0x75af23[_0xe177('0x60')][_0xe177('0x60')])||_0x75af23[_0xe177('0x60')][_0xe177('0x60')]===''){throw new db[(_0xe177('0x88'))][(_0xe177('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x75af23['body']['to'])){throw new db[(_0xe177('0x88'))][(_0xe177('0x95'))](_0xe177('0xb3'));}_0x3a6e0d=_0x75af23[_0xe177('0x60')]['to'];return db['WhatsappAccount'][_0xe177('0x5e')]({'where':{'id':_0x75af23['params']['id']},'include':[{'model':db['CmList'],'as':_0xe177('0xb4'),'include':[{'model':db[_0xe177('0x87')],'as':_0xe177('0x9c'),'where':{'mobile':_0x3a6e0d},'limit':0x1,'order':[[_0xe177('0x8b'),_0xe177('0xb5')]]}]}]})['then'](handleEntityNotFound(_0x1c4390,null))[_0xe177('0x36')](function(_0x5f42ca){if(_0x5f42ca&&_0x5f42ca[_0xe177('0xb4')]){_0x30699b=_0x5f42ca['get']({'plain':!![]});if(_0x30699b[_0xe177('0xb4')]&&_0x30699b['List']['Contacts'][_0xe177('0x4d')]){return _0x30699b[_0xe177('0xb4')]['Contacts'][0x0];}return db[_0xe177('0x87')][_0xe177('0x5f')](_[_0xe177('0x1c')](_0x75af23['body'],{'firstName':_0x3a6e0d,'mobile':_0x3a6e0d,'phone':_0x3a6e0d,'ListId':_0x30699b[_0xe177('0x9b')]}));}})['then'](handleEntityNotFound(_0x1c4390,null))[_0xe177('0x36')](function(_0x3987f6){if(_0x3987f6){_0x1beb7b=_0x3987f6;return db['WhatsappInteraction'][_0xe177('0x5e')]({'where':{'ContactId':_0x1beb7b['id'],'closed':![],'WhatsappAccountId':_0x30699b['id']}})[_0xe177('0x36')](function(_0x6bbe56){if(_0x6bbe56){return[_0x6bbe56,![]];}return db[_0xe177('0x9f')][_0xe177('0x5f')]({'UserId':_0x75af23[_0xe177('0xb6')]['id'],'ContactId':_0x1beb7b['id'],'WhatsappAccountId':_0x30699b['id'],'phone':_0x3a6e0d,'firstMsgDirection':_0xe177('0xb7'),'Messages':[_['merge'](_0x75af23[_0xe177('0x60')],{'read':![],'body':_0x75af23[_0xe177('0x60')][_0xe177('0x60')],'phone':_0x3a6e0d,'WhatsappAccountId':_0x30699b['id'],'UserId':_0x75af23[_0xe177('0xb6')]['id'],'ContactId':_0x1beb7b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xe177('0xb8')}]})['then'](function(_0x29f619){return[_0x29f619,!![]];});});}})[_0xe177('0xb9')](function(_0x13a2ba,_0x3d9db4){if(_0x3d9db4){return _0x13a2ba;}return db[_0xe177('0xa5')][_0xe177('0x5f')](_['merge'](_0x75af23[_0xe177('0x60')],{'read':![],'body':_0x75af23['body']['body'],'phone':_0x3a6e0d,'WhatsappAccountId':_0x30699b['id'],'WhatsappInteractionId':_0x13a2ba['id'],'UserId':_0x75af23[_0xe177('0xb6')]['id'],'ContactId':_0x1beb7b['id']}))[_0xe177('0x36')](function(_0x392d0c){_0x13a2ba[_0xe177('0xba')][_0xe177('0xb8')]=[];_0x13a2ba[_0xe177('0xba')][_0xe177('0xb8')]['push'](_0x392d0c[_0xe177('0xba')]);return _0x13a2ba;});})[_0xe177('0x36')](respondWithResult(_0x1c4390,null))['catch'](handleError(_0x1c4390,null));}; \ No newline at end of file +var _0x2d0d=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','save','update','destroy','get','WhatsappAccounts','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Pause','describe','Disposition','getDispositions','WhatsappAccountId','filter','ids','addAnswer','CannedAnswer','getAnswers','findOne','pick','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','WhatsappApplication','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','whatsapp:','Body','MessageSid','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Contacts','CmContact','contact','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x218c39,_0x31de32){var _0x100e20=function(_0x281f5c){while(--_0x281f5c){_0x218c39['push'](_0x218c39['shift']());}};_0x100e20(++_0x31de32);}(_0x2d0d,0xbd));var _0xd2d0=function(_0x446186,_0x116e31){_0x446186=_0x446186-0x0;var _0x63b564=_0x2d0d[_0x446186];return _0x63b564;};'use strict';var emlformat=require(_0xd2d0('0x0'));var rimraf=require(_0xd2d0('0x1'));var zipdir=require(_0xd2d0('0x2'));var jsonpatch=require(_0xd2d0('0x3'));var rp=require(_0xd2d0('0x4'));var moment=require(_0xd2d0('0x5'));var BPromise=require(_0xd2d0('0x6'));var Mustache=require(_0xd2d0('0x7'));var util=require(_0xd2d0('0x8'));var path=require(_0xd2d0('0x9'));var sox=require(_0xd2d0('0xa'));var csv=require(_0xd2d0('0xb'));var ejs=require(_0xd2d0('0xc'));var fs=require('fs');var fs_extra=require(_0xd2d0('0xd'));var _=require(_0xd2d0('0xe'));var squel=require(_0xd2d0('0xf'));var crypto=require('crypto');var jsforce=require(_0xd2d0('0x10'));var deskjs=require(_0xd2d0('0x11'));var toCsv=require(_0xd2d0('0xb'));var querystring=require('querystring');var Papa=require(_0xd2d0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd2d0('0x13'));var as=require(_0xd2d0('0x14'));var hardwareService=require(_0xd2d0('0x15'));var logger=require(_0xd2d0('0x16'))(_0xd2d0('0x17'));var utils=require(_0xd2d0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd2d0('0x19'));var db=require(_0xd2d0('0x1a'))['db'];config['redis']=_[_0xd2d0('0x1b')](config[_0xd2d0('0x1c')],{'host':_0xd2d0('0x1d'),'port':0x18eb});var socket=require(_0xd2d0('0x1e'))(new Redis(config[_0xd2d0('0x1c')]));require(_0xd2d0('0x1f'))[_0xd2d0('0x20')](socket);var jayson=require(_0xd2d0('0x21'));var client=jayson[_0xd2d0('0x22')][_0xd2d0('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x6379e2,_0x7663cc,_0x4b7585,_0x1faa9b){return new BPromise(function(_0x4e64d5,_0x113972){var _0x9c152d=_0x1faa9b||client;return _0x9c152d[_0xd2d0('0x24')](_0x6379e2,_0x4b7585)[_0xd2d0('0x25')](function(_0x143b0a){logger['info'](_0xd2d0('0x26'),_0x7663cc,_0xd2d0('0x27'));logger[_0xd2d0('0x28')](_0xd2d0('0x29'),_0x7663cc,'request\x20sent',JSON['stringify'](_0x143b0a));if(_0x143b0a['error']){if(_0x143b0a[_0xd2d0('0x2a')]['code']===0x1f4){logger['error'](_0xd2d0('0x26'),_0x7663cc,_0x143b0a['error'][_0xd2d0('0x2b')]);return _0x113972(_0x143b0a[_0xd2d0('0x2a')][_0xd2d0('0x2b')]);}logger[_0xd2d0('0x2a')](_0xd2d0('0x26'),_0x7663cc,_0x143b0a['error'][_0xd2d0('0x2b')]);return _0x4e64d5(_0x143b0a[_0xd2d0('0x2a')][_0xd2d0('0x2b')]);}else{logger[_0xd2d0('0x2c')](_0xd2d0('0x26'),_0x7663cc,'request\x20sent');_0x4e64d5(_0x143b0a[_0xd2d0('0x2d')]['message']);}})[_0xd2d0('0x2e')](function(_0x5b88c9){logger[_0xd2d0('0x2a')](_0xd2d0('0x26'),_0x7663cc,_0x5b88c9);_0x113972(_0x5b88c9);});});}function respondWithStatusCode(_0x555487,_0x98f144){_0x98f144=_0x98f144||0xcc;return function(_0x5f0bfe){if(_0x5f0bfe){return _0x555487[_0xd2d0('0x2f')](_0x98f144);}return _0x555487[_0xd2d0('0x30')](_0x98f144)[_0xd2d0('0x31')]();};}function respondWithResult(_0x52f714,_0x56fd0c){_0x56fd0c=_0x56fd0c||0xc8;return function(_0x2b0d4b){if(_0x2b0d4b){return _0x52f714[_0xd2d0('0x30')](_0x56fd0c)['json'](_0x2b0d4b);}};}function respondWithFilteredResult(_0x1bfaa7,_0x2b2316){return function(_0x5232a5){if(_0x5232a5){var _0x281a46=typeof _0x2b2316['offset']===_0xd2d0('0x32')&&typeof _0x2b2316['limit']===_0xd2d0('0x32');var _0x10a392=_0x5232a5['count'];var _0x31ecbf=_0x281a46?0x0:_0x2b2316[_0xd2d0('0x33')];var _0xbf3bf0=_0x281a46?_0x5232a5[_0xd2d0('0x34')]:_0x2b2316[_0xd2d0('0x33')]+_0x2b2316[_0xd2d0('0x35')];var _0x5ddf95;if(_0xbf3bf0>=_0x10a392){_0xbf3bf0=_0x10a392;_0x5ddf95=0xc8;}else{_0x5ddf95=0xce;}_0x1bfaa7['status'](_0x5ddf95);return _0x1bfaa7[_0xd2d0('0x36')](_0xd2d0('0x37'),_0x31ecbf+'-'+_0xbf3bf0+'/'+_0x10a392)[_0xd2d0('0x38')](_0x5232a5);}return null;};}function patchUpdates(_0x29e2d5){return function(_0x2c3c01){try{jsonpatch[_0xd2d0('0x39')](_0x2c3c01,_0x29e2d5,!![]);}catch(_0x59bea8){return BPromise['reject'](_0x59bea8);}return _0x2c3c01[_0xd2d0('0x3a')]();};}function saveUpdates(_0x2d56dc,_0x5a113a){return function(_0x1a8399){if(_0x1a8399){return _0x1a8399[_0xd2d0('0x3b')](_0x2d56dc)[_0xd2d0('0x25')](function(_0x271a99){return _0x271a99;});}return null;};}function removeEntity(_0x4da808,_0x1bf9d3){return function(_0x3bd09b){if(_0x3bd09b){return _0x3bd09b[_0xd2d0('0x3c')]()['then'](function(){var _0x4a7e9e=_0x3bd09b[_0xd2d0('0x3d')]({'plain':!![]});var _0x109d9a=_0xd2d0('0x3e');return db['UserProfileResource'][_0xd2d0('0x3c')]({'where':{'type':_0x109d9a,'resourceId':_0x4a7e9e['id']}})[_0xd2d0('0x25')](function(){return _0x3bd09b;});})[_0xd2d0('0x25')](function(){_0x4da808[_0xd2d0('0x30')](0xcc)[_0xd2d0('0x31')]();});}};}function handleEntityNotFound(_0x26428e,_0x220d4d){return function(_0x56c580){if(!_0x56c580){_0x26428e['sendStatus'](0x194);}return _0x56c580;};}function handleError(_0x1cc7a8,_0x299c9f){_0x299c9f=_0x299c9f||0x1f4;return function(_0x961f45){logger[_0xd2d0('0x2a')](_0x961f45[_0xd2d0('0x3f')]);if(_0x961f45[_0xd2d0('0x40')]){delete _0x961f45[_0xd2d0('0x40')];}_0x1cc7a8[_0xd2d0('0x30')](_0x299c9f)[_0xd2d0('0x41')](_0x961f45);};}exports[_0xd2d0('0x42')]=function(_0x8986f2,_0x29d5bd){var _0x28c7aa={'include':[{'model':db['Pause'],'as':_0xd2d0('0x43')}]},_0x20393b={},_0x5c3c6c={'count':0x0,'rows':[]};var _0x3eb630=_[_0xd2d0('0x44')](db[_0xd2d0('0x45')][_0xd2d0('0x46')],function(_0x26b99d){return{'name':_0x26b99d[_0xd2d0('0x47')],'type':_0x26b99d[_0xd2d0('0x48')][_0xd2d0('0x49')]};});_0x20393b[_0xd2d0('0x4a')]=_[_0xd2d0('0x44')](_0x3eb630,_0xd2d0('0x40'));_0x20393b[_0xd2d0('0x4b')]=_[_0xd2d0('0x4c')](_0x8986f2[_0xd2d0('0x4b')]);_0x20393b[_0xd2d0('0x4d')]=_[_0xd2d0('0x4e')](_0x20393b[_0xd2d0('0x4a')],_0x20393b[_0xd2d0('0x4b')]);_0x28c7aa['attributes']=_[_0xd2d0('0x4e')](_0x20393b['model'],qs[_0xd2d0('0x4f')](_0x8986f2['query'][_0xd2d0('0x4f')]));_0x28c7aa[_0xd2d0('0x50')]=_0x28c7aa['attributes'][_0xd2d0('0x51')]?_0x28c7aa[_0xd2d0('0x50')]:_0x20393b['model'];if(!_0x8986f2[_0xd2d0('0x4b')][_0xd2d0('0x52')](_0xd2d0('0x53'))){_0x28c7aa[_0xd2d0('0x35')]=qs[_0xd2d0('0x35')](_0x8986f2[_0xd2d0('0x4b')][_0xd2d0('0x35')]);_0x28c7aa[_0xd2d0('0x33')]=qs[_0xd2d0('0x33')](_0x8986f2[_0xd2d0('0x4b')][_0xd2d0('0x33')]);}_0x28c7aa[_0xd2d0('0x54')]=qs[_0xd2d0('0x55')](_0x8986f2[_0xd2d0('0x4b')][_0xd2d0('0x55')]);_0x28c7aa[_0xd2d0('0x56')]=qs['filters'](_['pick'](_0x8986f2[_0xd2d0('0x4b')],_0x20393b[_0xd2d0('0x4d')]),_0x3eb630);if(_0x8986f2[_0xd2d0('0x4b')]['filter']){_0x28c7aa[_0xd2d0('0x56')]=_[_0xd2d0('0x57')](_0x28c7aa[_0xd2d0('0x56')],{'$or':_[_0xd2d0('0x44')](_0x3eb630,function(_0x11196f){if(_0x11196f[_0xd2d0('0x48')]!==_0xd2d0('0x58')){var _0x2cef73={};_0x2cef73[_0x11196f[_0xd2d0('0x40')]]={'$like':'%'+_0x8986f2['query']['filter']+'%'};return _0x2cef73;}})});}_0x28c7aa=_['merge']({},_0x28c7aa,_0x8986f2[_0xd2d0('0x59')]);var _0x537669={'where':_0x28c7aa[_0xd2d0('0x56')]};return db[_0xd2d0('0x45')][_0xd2d0('0x34')](_0x537669)[_0xd2d0('0x25')](function(_0x463bdf){_0x5c3c6c[_0xd2d0('0x34')]=_0x463bdf;if(_0x8986f2[_0xd2d0('0x4b')][_0xd2d0('0x5a')]){_0x28c7aa[_0xd2d0('0x5b')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xd2d0('0x5c')](_0x28c7aa);})[_0xd2d0('0x25')](function(_0x146c21){_0x5c3c6c[_0xd2d0('0x5d')]=_0x146c21;return _0x5c3c6c;})[_0xd2d0('0x25')](respondWithFilteredResult(_0x29d5bd,_0x28c7aa))[_0xd2d0('0x2e')](handleError(_0x29d5bd,null));};exports[_0xd2d0('0x5e')]=function(_0x1eac47,_0x147fc5){var _0x5729c8={'raw':![],'where':{'id':_0x1eac47[_0xd2d0('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0xd2d0('0x43')}]},_0x3cca3d={};_0x3cca3d[_0xd2d0('0x4a')]=_[_0xd2d0('0x4c')](db[_0xd2d0('0x45')][_0xd2d0('0x46')]);_0x3cca3d[_0xd2d0('0x4b')]=_['keys'](_0x1eac47[_0xd2d0('0x4b')]);_0x3cca3d[_0xd2d0('0x4d')]=_[_0xd2d0('0x4e')](_0x3cca3d[_0xd2d0('0x4a')],_0x3cca3d['query']);_0x5729c8[_0xd2d0('0x50')]=_[_0xd2d0('0x4e')](_0x3cca3d['model'],qs[_0xd2d0('0x4f')](_0x1eac47[_0xd2d0('0x4b')]['fields']));_0x5729c8[_0xd2d0('0x50')]=_0x5729c8[_0xd2d0('0x50')][_0xd2d0('0x51')]?_0x5729c8[_0xd2d0('0x50')]:_0x3cca3d[_0xd2d0('0x4a')];if(_0x1eac47[_0xd2d0('0x4b')]['includeAll']){_0x5729c8[_0xd2d0('0x5b')]=[{'all':!![]}];}_0x5729c8=_[_0xd2d0('0x57')]({},_0x5729c8,_0x1eac47[_0xd2d0('0x59')]);return db['WhatsappAccount']['find'](_0x5729c8)[_0xd2d0('0x25')](handleEntityNotFound(_0x147fc5,null))['then'](respondWithResult(_0x147fc5,null))[_0xd2d0('0x2e')](handleError(_0x147fc5,null));};exports[_0xd2d0('0x60')]=function(_0x5916b4,_0x34b565){return db[_0xd2d0('0x45')]['create'](_0x5916b4[_0xd2d0('0x61')],{})[_0xd2d0('0x25')](function(_0x3bc5f3){var _0x242678=_0x5916b4[_0xd2d0('0x62')][_0xd2d0('0x3d')]({'plain':!![]});if(!_0x242678)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x242678[_0xd2d0('0x63')]===_0xd2d0('0x62')){var _0x17246a=_0x3bc5f3[_0xd2d0('0x3d')]({'plain':!![]});var _0x5d7857=_0xd2d0('0x3e');return db[_0xd2d0('0x64')][_0xd2d0('0x65')]({'where':{'name':_0x5d7857,'userProfileId':_0x242678[_0xd2d0('0x66')]},'raw':!![]})[_0xd2d0('0x25')](function(_0x2db7d1){if(_0x2db7d1&&_0x2db7d1[_0xd2d0('0x67')]===0x0){return db['UserProfileResource'][_0xd2d0('0x60')]({'name':_0x17246a[_0xd2d0('0x40')],'resourceId':_0x17246a['id'],'type':_0x2db7d1[_0xd2d0('0x40')],'sectionId':_0x2db7d1['id']},{})['then'](function(){return _0x3bc5f3;});}else{return _0x3bc5f3;}})[_0xd2d0('0x2e')](function(_0x11bdeb){logger[_0xd2d0('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11bdeb);throw _0x11bdeb;});}return _0x3bc5f3;})[_0xd2d0('0x25')](respondWithResult(_0x34b565,0xc9))[_0xd2d0('0x2e')](handleError(_0x34b565,null));};exports[_0xd2d0('0x3b')]=function(_0x57342f,_0x2fd062){if(_0x57342f[_0xd2d0('0x61')]['id']){delete _0x57342f[_0xd2d0('0x61')]['id'];}return db[_0xd2d0('0x45')]['find']({'where':{'id':_0x57342f[_0xd2d0('0x5f')]['id']},'include':[{'model':db[_0xd2d0('0x68')],'as':'mandatoryDispositionPause'}]})[_0xd2d0('0x25')](handleEntityNotFound(_0x2fd062,null))['then'](saveUpdates(_0x57342f['body'],null))[_0xd2d0('0x25')](respondWithResult(_0x2fd062,null))[_0xd2d0('0x2e')](handleError(_0x2fd062,null));};exports[_0xd2d0('0x3c')]=function(_0x4a7a9a,_0x1c42e4){return db[_0xd2d0('0x45')]['find']({'where':{'id':_0x4a7a9a['params']['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x1c42e4,null))[_0xd2d0('0x25')](removeEntity(_0x1c42e4,null))[_0xd2d0('0x2e')](handleError(_0x1c42e4,null));};exports[_0xd2d0('0x69')]=function(_0x371ba3,_0x3711aa){return db['WhatsappAccount'][_0xd2d0('0x69')]()[_0xd2d0('0x25')](respondWithResult(_0x3711aa,null))[_0xd2d0('0x2e')](handleError(_0x3711aa,null));};exports['addDisposition']=function(_0x57c5e4,_0x4e12ba,_0x1de391){if(_0x57c5e4[_0xd2d0('0x61')]['id']){delete _0x57c5e4[_0xd2d0('0x61')]['id'];}return db[_0xd2d0('0x45')][_0xd2d0('0x65')]({'where':{'id':_0x57c5e4[_0xd2d0('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4e12ba,null))['then'](function(_0x550a6d){if(_0x550a6d){_0x57c5e4[_0xd2d0('0x61')]['WhatsappAccountId']=_0x550a6d['id'];return db[_0xd2d0('0x6a')][_0xd2d0('0x60')](_0x57c5e4['body']);}})[_0xd2d0('0x25')](respondWithResult(_0x4e12ba,null))['catch'](handleError(_0x4e12ba,null));};exports[_0xd2d0('0x6b')]=function(_0x4db146,_0x13593a,_0x3001d6){var _0x2105e4={'raw':![],'where':{}};var _0x56bc32={};var _0x5e6002={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x4db146[_0xd2d0('0x5f')]['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x13593a,null))['then'](function(_0x384838){if(_0x384838){_0x56bc32['model']=_['keys'](db[_0xd2d0('0x6a')][_0xd2d0('0x46')]);_0x56bc32['query']=_['keys'](_0x4db146[_0xd2d0('0x4b')]);_0x56bc32[_0xd2d0('0x4d')]=_[_0xd2d0('0x4e')](_0x56bc32[_0xd2d0('0x4a')],_0x56bc32[_0xd2d0('0x4b')]);_0x2105e4['attributes']=_['intersection'](_0x56bc32[_0xd2d0('0x4a')],qs[_0xd2d0('0x4f')](_0x4db146[_0xd2d0('0x4b')][_0xd2d0('0x4f')]));_0x2105e4[_0xd2d0('0x50')]=_0x2105e4[_0xd2d0('0x50')]['length']?_0x2105e4[_0xd2d0('0x50')]:_0x56bc32[_0xd2d0('0x4a')];if(!_0x4db146['query'][_0xd2d0('0x52')](_0xd2d0('0x53'))){_0x2105e4['limit']=qs[_0xd2d0('0x35')](_0x4db146[_0xd2d0('0x4b')]['limit']);_0x2105e4[_0xd2d0('0x33')]=qs[_0xd2d0('0x33')](_0x4db146[_0xd2d0('0x4b')][_0xd2d0('0x33')]);}_0x2105e4[_0xd2d0('0x54')]=qs[_0xd2d0('0x55')](_0x4db146[_0xd2d0('0x4b')][_0xd2d0('0x55')]);_0x2105e4[_0xd2d0('0x56')]=qs['filters'](_['pick'](_0x4db146['query'],_0x56bc32[_0xd2d0('0x4d')]));_0x2105e4[_0xd2d0('0x56')][_0xd2d0('0x6c')]=_0x384838['id'];if(_0x4db146[_0xd2d0('0x4b')][_0xd2d0('0x6d')]){_0x2105e4[_0xd2d0('0x56')]=_[_0xd2d0('0x57')](_0x2105e4['where'],{'$or':_[_0xd2d0('0x44')](_0x2105e4[_0xd2d0('0x50')],function(_0x5bdcfd){var _0x1d381b={};_0x1d381b[_0x5bdcfd]={'$like':'%'+_0x4db146[_0xd2d0('0x4b')][_0xd2d0('0x6d')]+'%'};return _0x1d381b;})});}_0x2105e4=_['merge']({},_0x2105e4,_0x4db146['options']);return db['Disposition']['count']({'where':_0x2105e4[_0xd2d0('0x56')]})[_0xd2d0('0x25')](function(_0x357e7f){_0x5e6002[_0xd2d0('0x34')]=_0x357e7f;if(_0x4db146[_0xd2d0('0x4b')]['includeAll']){_0x2105e4[_0xd2d0('0x5b')]=[{'all':!![]}];}return db[_0xd2d0('0x6a')][_0xd2d0('0x5c')](_0x2105e4);})[_0xd2d0('0x25')](function(_0x5d4f88){_0x5e6002['rows']=_0x5d4f88;return _0x5e6002;});}})[_0xd2d0('0x25')](respondWithFilteredResult(_0x13593a,_0x2105e4))[_0xd2d0('0x2e')](handleError(_0x13593a,null));};exports['removeDispositions']=function(_0x3f658b,_0xd05c0,_0x30cbb7){return db[_0xd2d0('0x45')][_0xd2d0('0x65')]({'where':{'id':_0x3f658b[_0xd2d0('0x5f')]['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0xd05c0,null))[_0xd2d0('0x25')](function(_0x295a9c){if(_0x295a9c){return _0x295a9c['removeDispositions'](_0x3f658b[_0xd2d0('0x4b')][_0xd2d0('0x6e')]);}})[_0xd2d0('0x25')](respondWithStatusCode(_0xd05c0,null))[_0xd2d0('0x2e')](handleError(_0xd05c0,null));};exports[_0xd2d0('0x6f')]=function(_0x22013a,_0x4552dd,_0x5e8c73){if(_0x22013a['body']['id']){delete _0x22013a[_0xd2d0('0x61')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x22013a[_0xd2d0('0x5f')]['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x4552dd,null))[_0xd2d0('0x25')](function(_0x2dea1a){if(_0x2dea1a){_0x22013a[_0xd2d0('0x61')][_0xd2d0('0x6c')]=_0x2dea1a['id'];return db[_0xd2d0('0x70')]['create'](_0x22013a[_0xd2d0('0x61')]);}})[_0xd2d0('0x25')](respondWithResult(_0x4552dd,null))[_0xd2d0('0x2e')](handleError(_0x4552dd,null));};exports[_0xd2d0('0x71')]=function(_0x3c9752,_0x3c7ec3,_0x10449c){var _0x518692={'raw':![],'where':{}};var _0x54ee7e={};var _0xde80a2={'count':0x0,'rows':[]};return db[_0xd2d0('0x45')][_0xd2d0('0x72')]({'where':{'id':_0x3c9752['params']['id']}})['then'](handleEntityNotFound(_0x3c7ec3,null))[_0xd2d0('0x25')](function(_0x1da5a9){if(_0x1da5a9){_0x54ee7e[_0xd2d0('0x4a')]=_[_0xd2d0('0x4c')](db[_0xd2d0('0x70')]['rawAttributes']);_0x54ee7e[_0xd2d0('0x4b')]=_[_0xd2d0('0x4c')](_0x3c9752[_0xd2d0('0x4b')]);_0x54ee7e[_0xd2d0('0x4d')]=_['intersection'](_0x54ee7e[_0xd2d0('0x4a')],_0x54ee7e[_0xd2d0('0x4b')]);_0x518692['attributes']=_[_0xd2d0('0x4e')](_0x54ee7e[_0xd2d0('0x4a')],qs['fields'](_0x3c9752['query'][_0xd2d0('0x4f')]));_0x518692[_0xd2d0('0x50')]=_0x518692['attributes']['length']?_0x518692['attributes']:_0x54ee7e[_0xd2d0('0x4a')];if(!_0x3c9752[_0xd2d0('0x4b')][_0xd2d0('0x52')]('nolimit')){_0x518692[_0xd2d0('0x35')]=qs['limit'](_0x3c9752[_0xd2d0('0x4b')][_0xd2d0('0x35')]);_0x518692[_0xd2d0('0x33')]=qs['offset'](_0x3c9752[_0xd2d0('0x4b')]['offset']);}_0x518692[_0xd2d0('0x54')]=qs[_0xd2d0('0x55')](_0x3c9752['query'][_0xd2d0('0x55')]);_0x518692[_0xd2d0('0x56')]=qs[_0xd2d0('0x4d')](_[_0xd2d0('0x73')](_0x3c9752[_0xd2d0('0x4b')],_0x54ee7e['filters']));_0x518692['where'][_0xd2d0('0x6c')]=_0x1da5a9['id'];if(_0x3c9752[_0xd2d0('0x4b')][_0xd2d0('0x6d')]){_0x518692[_0xd2d0('0x56')]=_[_0xd2d0('0x57')](_0x518692[_0xd2d0('0x56')],{'$or':_['map'](_0x518692['attributes'],function(_0x1f37bf){var _0xdea8ed={};_0xdea8ed[_0x1f37bf]={'$like':'%'+_0x3c9752[_0xd2d0('0x4b')][_0xd2d0('0x6d')]+'%'};return _0xdea8ed;})});}_0x518692=_['merge']({},_0x518692,_0x3c9752[_0xd2d0('0x59')]);return db[_0xd2d0('0x70')][_0xd2d0('0x34')]({'where':_0x518692[_0xd2d0('0x56')]})[_0xd2d0('0x25')](function(_0x2eba48){_0xde80a2[_0xd2d0('0x34')]=_0x2eba48;if(_0x3c9752[_0xd2d0('0x4b')][_0xd2d0('0x5a')]){_0x518692[_0xd2d0('0x5b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x518692);})[_0xd2d0('0x25')](function(_0x579fde){_0xde80a2['rows']=_0x579fde;return _0xde80a2;});}})[_0xd2d0('0x25')](respondWithFilteredResult(_0x3c7ec3,_0x518692))[_0xd2d0('0x2e')](handleError(_0x3c7ec3,null));};exports[_0xd2d0('0x74')]=function(_0x3fa71d,_0x4721ef,_0x4771d2){return db['WhatsappAccount'][_0xd2d0('0x65')]({'where':{'id':_0x3fa71d['params']['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x4721ef,null))[_0xd2d0('0x25')](function(_0x2c7d42){if(_0x2c7d42){return _0x2c7d42['removeAnswers'](_0x3fa71d[_0xd2d0('0x4b')][_0xd2d0('0x6e')]);}})[_0xd2d0('0x25')](respondWithStatusCode(_0x4721ef,null))['catch'](handleError(_0x4721ef,null));};exports[_0xd2d0('0x75')]=function(_0xde751,_0x2eee72,_0x555ed6){return db[_0xd2d0('0x45')][_0xd2d0('0x65')]({'where':{'id':_0xde751[_0xd2d0('0x5f')]['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x2eee72,null))[_0xd2d0('0x25')](function(_0x4251ba){if(_0x4251ba){return _0x4251ba[_0xd2d0('0x75')](_0xde751[_0xd2d0('0x61')][_0xd2d0('0x6e')],_[_0xd2d0('0x76')](_0xde751['body'],[_0xd2d0('0x6e'),'id'])||{})[_0xd2d0('0x77')](function(_0x291deb){for(var _0x18c7e4=0x0;_0x18c7e4<_0xde751[_0xd2d0('0x61')][_0xd2d0('0x6e')][_0xd2d0('0x51')];_0x18c7e4+=0x1){socket[_0xd2d0('0x78')](_0xd2d0('0x79'),{'UserId':Number(_0xde751['body'][_0xd2d0('0x6e')][_0x18c7e4]),'WhatsappAccountId':Number(_0xde751[_0xd2d0('0x5f')]['id'])});}return _0x291deb;});}})['then'](respondWithResult(_0x2eee72,null))[_0xd2d0('0x2e')](handleError(_0x2eee72,null));};exports[_0xd2d0('0x7a')]=function(_0x28dee4,_0x24068d,_0x26bf0c){return db[_0xd2d0('0x45')][_0xd2d0('0x65')]({'where':{'id':_0x28dee4['params']['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x24068d,null))['then'](function(_0x115f65){if(_0x115f65){return _0x115f65[_0xd2d0('0x7a')](_0x28dee4[_0xd2d0('0x4b')][_0xd2d0('0x6e')])[_0xd2d0('0x25')](function(){if(_[_0xd2d0('0x7b')](_0x28dee4[_0xd2d0('0x4b')][_0xd2d0('0x6e')])){for(var _0x4db96a=0x0;_0x4db96a<_0x28dee4[_0xd2d0('0x4b')]['ids'][_0xd2d0('0x51')];_0x4db96a+=0x1){socket[_0xd2d0('0x78')](_0xd2d0('0x7c'),{'UserId':Number(_0x28dee4[_0xd2d0('0x4b')]['ids'][_0x4db96a]),'WhatsappAccountId':Number(_0x28dee4['params']['id'])});}}else{socket['emit'](_0xd2d0('0x7c'),{'UserId':Number(_0x28dee4[_0xd2d0('0x4b')]['ids']),'WhatsappAccountId':Number(_0x28dee4[_0xd2d0('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x24068d,null))[_0xd2d0('0x2e')](handleError(_0x24068d,null));};exports['getAgents']=function(_0x32697c,_0x2b8440,_0x2f8fd4){var _0x11aeab={};var _0x5ea2a8={};var _0x2ba5a9;var _0x4c5c39;return db[_0xd2d0('0x45')][_0xd2d0('0x72')]({'where':{'id':_0x32697c['params']['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x2b8440,null))[_0xd2d0('0x25')](function(_0x31bff5){if(_0x31bff5){_0x2ba5a9=_0x31bff5;_0x5ea2a8[_0xd2d0('0x4a')]=_[_0xd2d0('0x4c')](db[_0xd2d0('0x7d')][_0xd2d0('0x46')]);_0x5ea2a8['query']=_['keys'](_0x32697c[_0xd2d0('0x4b')]);_0x5ea2a8[_0xd2d0('0x4d')]=_[_0xd2d0('0x4e')](_0x5ea2a8[_0xd2d0('0x4a')],_0x5ea2a8[_0xd2d0('0x4b')]);_0x11aeab[_0xd2d0('0x50')]=_[_0xd2d0('0x4e')](_0x5ea2a8['model'],qs['fields'](_0x32697c['query']['fields']));_0x11aeab[_0xd2d0('0x50')]=_0x11aeab['attributes'][_0xd2d0('0x51')]?_0x11aeab[_0xd2d0('0x50')]:_0x5ea2a8[_0xd2d0('0x4a')];_0x11aeab[_0xd2d0('0x54')]=qs[_0xd2d0('0x55')](_0x32697c['query'][_0xd2d0('0x55')]);_0x11aeab['where']=qs[_0xd2d0('0x4d')](_['pick'](_0x32697c['query'],_0x5ea2a8[_0xd2d0('0x4d')]));if(_0x32697c[_0xd2d0('0x4b')][_0xd2d0('0x6d')]){_0x11aeab[_0xd2d0('0x56')]=_['merge'](_0x11aeab[_0xd2d0('0x56')],{'$or':_[_0xd2d0('0x44')](_0x11aeab['attributes'],function(_0x5aed21){var _0x4650a1={};_0x4650a1[_0x5aed21]={'$like':'%'+_0x32697c[_0xd2d0('0x4b')][_0xd2d0('0x6d')]+'%'};return _0x4650a1;})});}_0x11aeab=_[_0xd2d0('0x57')]({},_0x11aeab,_0x32697c[_0xd2d0('0x59')]);return _0x2ba5a9[_0xd2d0('0x7e')](_0x11aeab);}})[_0xd2d0('0x25')](function(_0x2e8f11){if(_0x2e8f11){_0x4c5c39=_0x2e8f11['length'];if(!_0x32697c[_0xd2d0('0x4b')][_0xd2d0('0x52')](_0xd2d0('0x53'))){_0x11aeab['limit']=qs[_0xd2d0('0x35')](_0x32697c[_0xd2d0('0x4b')]['limit']);_0x11aeab[_0xd2d0('0x33')]=qs['offset'](_0x32697c[_0xd2d0('0x4b')][_0xd2d0('0x33')]);}return _0x2ba5a9['getAgents'](_0x11aeab);}})['then'](function(_0x418d09){if(_0x418d09){return _0x418d09?{'count':_0x4c5c39,'rows':_0x418d09}:null;}})[_0xd2d0('0x25')](respondWithResult(_0x2b8440,null))[_0xd2d0('0x2e')](handleError(_0x2b8440,null));};exports[_0xd2d0('0x7f')]=function(_0x32f442,_0x5856f1,_0x3731e0){return db[_0xd2d0('0x45')][_0xd2d0('0x72')]({'where':{'id':_0x32f442['params']['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x5856f1,null))[_0xd2d0('0x25')](function(_0x1bf8b6){if(_0x1bf8b6){return db[_0xd2d0('0x80')]['transaction'](function(_0x2ee776){return db[_0xd2d0('0x81')][_0xd2d0('0x3c')]({'where':{'WhatsappAccountId':_0x32f442[_0xd2d0('0x5f')]['id']},'transaction':_0x2ee776})[_0xd2d0('0x25')](function(_0x534832){var _0x4c70c9=_[_0xd2d0('0x44')](_0x32f442[_0xd2d0('0x61')],function(_0x27a531){_0x27a531[_0xd2d0('0x6c')]=_0x32f442['params']['id'];return _0x27a531;});return db['WhatsappApplication']['bulkCreate'](_0x4c70c9,{'transaction':_0x2ee776});});})[_0xd2d0('0x25')](function(){return db[_0xd2d0('0x81')][_0xd2d0('0x82')]({'where':{'WhatsappAccountId':_0x32f442['params']['id']},'order':_0xd2d0('0x83')});});}})[_0xd2d0('0x25')](respondWithResult(_0x5856f1,null))[_0xd2d0('0x2e')](handleError(_0x5856f1,null));};exports['getApplications']=function(_0x575e59,_0x33f04a,_0x1ffc2f){var _0x360eb8={};var _0x24f1a1={};var _0x5f1b6f;var _0x3b77b9;return db['WhatsappAccount'][_0xd2d0('0x72')]({'where':{'id':_0x575e59[_0xd2d0('0x5f')]['id']}})[_0xd2d0('0x25')](handleEntityNotFound(_0x33f04a,null))[_0xd2d0('0x25')](function(_0x119b8f){if(_0x119b8f){_0x5f1b6f=_0x119b8f;_0x24f1a1[_0xd2d0('0x4a')]=_[_0xd2d0('0x4c')](db[_0xd2d0('0x81')][_0xd2d0('0x46')]);_0x24f1a1[_0xd2d0('0x4b')]=_['keys'](_0x575e59[_0xd2d0('0x4b')]);_0x24f1a1['filters']=_['intersection'](_0x24f1a1[_0xd2d0('0x4a')],_0x24f1a1[_0xd2d0('0x4b')]);_0x360eb8[_0xd2d0('0x50')]=_[_0xd2d0('0x4e')](_0x24f1a1[_0xd2d0('0x4a')],qs[_0xd2d0('0x4f')](_0x575e59['query']['fields']));_0x360eb8[_0xd2d0('0x50')]=_0x360eb8['attributes'][_0xd2d0('0x51')]?_0x360eb8[_0xd2d0('0x50')]:_0x24f1a1[_0xd2d0('0x4a')];_0x360eb8[_0xd2d0('0x54')]=qs[_0xd2d0('0x55')](_0x575e59['query'][_0xd2d0('0x55')]);_0x360eb8['where']=qs[_0xd2d0('0x4d')](_[_0xd2d0('0x73')](_0x575e59[_0xd2d0('0x4b')],_0x24f1a1[_0xd2d0('0x4d')]));if(_0x575e59[_0xd2d0('0x4b')][_0xd2d0('0x6d')]){_0x360eb8[_0xd2d0('0x56')]=_[_0xd2d0('0x57')](_0x360eb8['where'],{'$or':_[_0xd2d0('0x44')](_0x360eb8[_0xd2d0('0x50')],function(_0xf4853){var _0x2fdf98={};_0x2fdf98[_0xf4853]={'$like':'%'+_0x575e59[_0xd2d0('0x4b')][_0xd2d0('0x6d')]+'%'};return _0x2fdf98;})});}_0x360eb8=_[_0xd2d0('0x57')]({},_0x360eb8,_0x575e59[_0xd2d0('0x59')]);return _0x5f1b6f[_0xd2d0('0x84')](_0x360eb8);}})[_0xd2d0('0x25')](function(_0x615b0c){if(_0x615b0c){_0x3b77b9=_0x615b0c[_0xd2d0('0x51')];if(!_0x575e59[_0xd2d0('0x4b')][_0xd2d0('0x52')](_0xd2d0('0x53'))){_0x360eb8[_0xd2d0('0x35')]=qs[_0xd2d0('0x35')](_0x575e59['query'][_0xd2d0('0x35')]);_0x360eb8['offset']=qs[_0xd2d0('0x33')](_0x575e59[_0xd2d0('0x4b')][_0xd2d0('0x33')]);}return _0x5f1b6f[_0xd2d0('0x84')](_0x360eb8);}})[_0xd2d0('0x25')](function(_0x31002b){if(_0x31002b){return _0x31002b?{'count':_0x3b77b9,'rows':_0x31002b}:null;}})[_0xd2d0('0x25')](respondWithResult(_0x33f04a,null))['catch'](handleError(_0x33f04a,null));};exports[_0xd2d0('0x85')]=function(_0x4f273c,_0x5e9963,_0x4e9794){var _0x486ace={'channel':_0xd2d0('0x86')};var _0x37fc2a=[];var _0x27fa49=[];var _0x2aa15d={};return db[_0xd2d0('0x45')]['find']({'where':{'id':_0x4f273c[_0xd2d0('0x5f')]['id']},'include':[{'model':db[_0xd2d0('0x81')],'as':_0xd2d0('0x87')}]})[_0xd2d0('0x25')](handleEntityNotFound(_0x5e9963,null))[_0xd2d0('0x25')](function(_0x3e3092){_0x486ace[_0xd2d0('0x88')]=_0x3e3092;_0x486ace[_0xd2d0('0x89')]=_[_0xd2d0('0x8a')](_0x3e3092[_0xd2d0('0x87')],['priority'],['asc']);if(_0x486ace[_0xd2d0('0x88')][_0xd2d0('0x87')]){delete _0x486ace[_0xd2d0('0x88')][_0xd2d0('0x87')];}return db['CmContact'][_0xd2d0('0x69')]();})[_0xd2d0('0x25')](function(_0x567533){if(!_0x567533){throw new db[(_0xd2d0('0x8b'))]['ValidationError'](_0xd2d0('0x8c'));}_0x37fc2a=_[_0xd2d0('0x8d')](_[_0xd2d0('0x4c')](_0x567533),[_0xd2d0('0x8e'),'updatedAt']);_0x27fa49=_[_0xd2d0('0x8d')](_[_0xd2d0('0x4c')](_0x567533),[_0xd2d0('0x8e'),_0xd2d0('0x8f'),_0xd2d0('0x90'),_0xd2d0('0x91')]);_0x486ace['body']={'mapKey':_0xd2d0('0x92')};if(_0x486ace[_0xd2d0('0x88')][_0xd2d0('0x48')]&&_0x486ace[_0xd2d0('0x88')][_0xd2d0('0x48')]===_0xd2d0('0x93')){_0x486ace[_0xd2d0('0x61')]['from']=_0x4f273c['body'][_0xd2d0('0x94')]['replace'](_0xd2d0('0x95'),'');_0x486ace['body'][_0xd2d0('0x61')]=_0x4f273c[_0xd2d0('0x61')][_0xd2d0('0x96')];_0x486ace['body']['messageId']=_0x4f273c['body'][_0xd2d0('0x97')];}if(_0x486ace['body']['id']){delete _0x486ace[_0xd2d0('0x61')]['id'];}if(_['isNil'](_0x486ace[_0xd2d0('0x61')][_0xd2d0('0x98')])){throw new db[(_0xd2d0('0x8b'))][(_0xd2d0('0x99'))](_0xd2d0('0x9a'));}if(_[_0xd2d0('0x9b')](_0x486ace['body'][_0xd2d0('0x61')])||_0x486ace[_0xd2d0('0x61')]['body']===''){throw new db[(_0xd2d0('0x8b'))][(_0xd2d0('0x99'))](_0xd2d0('0x9c'));}if(_[_0xd2d0('0x9b')](_0x486ace[_0xd2d0('0x61')][_0xd2d0('0x9d')])){throw new db[(_0xd2d0('0x8b'))][(_0xd2d0('0x99'))](_0xd2d0('0x9e')+_0x27fa49);}if(!_[_0xd2d0('0x9f')](_0x27fa49,_0x486ace[_0xd2d0('0x61')][_0xd2d0('0x9d')])){throw new db[(_0xd2d0('0x8b'))]['ValidationError'](_0xd2d0('0xa0')+_0x27fa49);}_0x2aa15d[_0x486ace[_0xd2d0('0x61')]['mapKey']]=_0x486ace[_0xd2d0('0x61')]['from'];return db[_0xd2d0('0xa1')][_0xd2d0('0x65')]({'where':{'id':_0x486ace[_0xd2d0('0x88')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2aa15d,'limit':0x1,'order':[[_0xd2d0('0x8f'),_0xd2d0('0xa2')]]}]});})[_0xd2d0('0x25')](handleEntityNotFound(_0x5e9963,null))['then'](function(_0x34434b){if(_0x34434b){_0x486ace['list']=_['omit'](_0x34434b,['Contacts']);if(_0x34434b[_0xd2d0('0xa3')][_0xd2d0('0x51')]){return _0x34434b[_0xd2d0('0xa3')][0x0];}var _0x23ef61=_[_0xd2d0('0x1b')](_0x486ace[_0xd2d0('0x61')],{'firstName':_0x486ace[_0xd2d0('0x61')][_0xd2d0('0x98')],'ListId':_0x34434b['id']});_0x23ef61[_0x486ace['body'][_0xd2d0('0x9d')]]=_0x486ace['body'][_0xd2d0('0x98')];return db[_0xd2d0('0xa4')][_0xd2d0('0x60')](_0x23ef61,{'fields':_0x37fc2a,'raw':!![]});}})[_0xd2d0('0x25')](handleEntityNotFound(_0x5e9963,null))[_0xd2d0('0x25')](function(_0x50fa38){if(_0x50fa38){_0x486ace[_0xd2d0('0xa5')]=_0x50fa38;var _0x487f89={'ContactId':_0x50fa38['id'],'phone':_0x486ace['body'][_0xd2d0('0x98')],'WhatsappAccountId':_0x4f273c['params']['id']};var _0x5acbad={'ContactId':_0x50fa38['id'],'WhatsappAccountId':_0x4f273c[_0xd2d0('0x5f')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xd2d0('0x65')]({'where':_0x5acbad})[_0xd2d0('0x25')](function(_0x260ece){if(_0x260ece){return[_0x260ece,![]];}return db['WhatsappInteraction'][_0xd2d0('0x60')](_0x487f89)[_0xd2d0('0x25')](function(_0x3d9a72){return[_0x3d9a72,!![]];});});}})[_0xd2d0('0x77')](function(_0x4768e,_0x326f96){_0x486ace[_0xd2d0('0xa6')]=_0x4768e['get']({'plain':!![]});_0x486ace[_0xd2d0('0xa6')][_0xd2d0('0xa7')]=![];if(_0x326f96){if(_0x486ace[_0xd2d0('0x88')][_0xd2d0('0xa8')]){_0x486ace['applications'][_0xd2d0('0xa9')]({'id':0x0,'priority':_0x486ace[_0xd2d0('0x89')]['length']+0x1,'app':_0xd2d0('0xaa'),'appdata':_0xd2d0('0xab'),'interval':_0xd2d0('0xac')});}_0x486ace[_0xd2d0('0xa6')][_0xd2d0('0xa7')]=!![];}return db[_0xd2d0('0xad')][_0xd2d0('0x60')]({'phone':_0x486ace[_0xd2d0('0x61')]['from'],'messageId':_0x486ace[_0xd2d0('0x61')][_0xd2d0('0xae')],'body':_0x486ace[_0xd2d0('0x61')][_0xd2d0('0x61')],'WhatsappAccountId':_0x4f273c[_0xd2d0('0x5f')]['id'],'WhatsappInteractionId':_0x4768e['id'],'direction':'in','ContactId':_0x4768e[_0xd2d0('0xaf')],'AttachmentId':_0x486ace['body']['AttachmentId']});})[_0xd2d0('0x25')](function(_0x1d7e06){_0x486ace['message']=_0x1d7e06;if(_0x486ace[_0xd2d0('0xa6')][_0xd2d0('0xb0')]){return db[_0xd2d0('0x7d')]['find']({'attributes':['id',_0xd2d0('0x40')],'where':{'id':_0x486ace[_0xd2d0('0xa6')][_0xd2d0('0xb0')]}})['then'](function(_0x13ea09){if(_0x13ea09){_0x486ace[_0xd2d0('0x89')][_0xd2d0('0xb1')]({'id':0x0,'priority':0x0,'app':_0xd2d0('0xb2'),'appdata':_0x13ea09['name']+','+(_0x486ace[_0xd2d0('0x88')][_0xd2d0('0xb3')]||0xa),'interval':_0xd2d0('0xac')});}return respondWithRpcPromise('Start','startRouting',_0x486ace);});}return respondWithRpcPromise('Start',_0xd2d0('0xb4'),_0x486ace);})[_0xd2d0('0x25')](function(_0x271660){if(_0x271660){var _0x5109=0xc8;var _0x49ee48=_0xd2d0('0xb5');logger[_0xd2d0('0x2c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x49ee48,_0x5109,'entity\x20found');logger['debug'](_0xd2d0('0xb6'),_0x49ee48,_0x5109,_0xd2d0('0xb7'),JSON[_0xd2d0('0xb8')](_0x271660));if(_0x486ace[_0xd2d0('0x88')][_0xd2d0('0x48')]===_0xd2d0('0x93')){return _0x5e9963[_0xd2d0('0x30')](_0x5109)[_0xd2d0('0x36')](_0xd2d0('0xb9'),_0xd2d0('0xba'))['send']('\x0a');}else{return _0x5e9963[_0xd2d0('0x30')](_0x5109)[_0xd2d0('0x38')](_0x271660);}}})[_0xd2d0('0x2e')](handleError(_0x5e9963,null));};exports['send']=function(_0xad28a1,_0x344714,_0x44ace9){var _0x2544a6,_0x325b9e,_0x17f880;if(_[_0xd2d0('0x9b')](_0xad28a1[_0xd2d0('0x61')][_0xd2d0('0x61')])||_0xad28a1[_0xd2d0('0x61')][_0xd2d0('0x61')]===''){throw new db[(_0xd2d0('0x8b'))][(_0xd2d0('0x99'))](_0xd2d0('0x9c'));}if(_['isNil'](_0xad28a1[_0xd2d0('0x61')]['to'])){throw new db['Sequelize'][(_0xd2d0('0x99'))](_0xd2d0('0xbb'));}_0x2544a6=_0xad28a1[_0xd2d0('0x61')]['to'];return db['WhatsappAccount'][_0xd2d0('0x65')]({'where':{'id':_0xad28a1[_0xd2d0('0x5f')]['id']},'include':[{'model':db[_0xd2d0('0xa1')],'as':_0xd2d0('0xbc'),'include':[{'model':db[_0xd2d0('0xa4')],'as':_0xd2d0('0xa3'),'where':{'mobile':_0x2544a6},'limit':0x1,'order':[[_0xd2d0('0x8f'),_0xd2d0('0xa2')]]}]}]})[_0xd2d0('0x25')](handleEntityNotFound(_0x344714,null))[_0xd2d0('0x25')](function(_0x56454b){if(_0x56454b&&_0x56454b[_0xd2d0('0xbc')]){_0x325b9e=_0x56454b[_0xd2d0('0x3d')]({'plain':!![]});if(_0x325b9e[_0xd2d0('0xbc')]&&_0x325b9e[_0xd2d0('0xbc')][_0xd2d0('0xa3')][_0xd2d0('0x51')]){return _0x325b9e[_0xd2d0('0xbc')][_0xd2d0('0xa3')][0x0];}return db[_0xd2d0('0xa4')][_0xd2d0('0x60')](_[_0xd2d0('0x1b')](_0xad28a1[_0xd2d0('0x61')],{'firstName':_0x2544a6,'mobile':_0x2544a6,'phone':_0x2544a6,'ListId':_0x325b9e[_0xd2d0('0x91')]}));}})['then'](handleEntityNotFound(_0x344714,null))[_0xd2d0('0x25')](function(_0x4dba1a){if(_0x4dba1a){_0x17f880=_0x4dba1a;return db[_0xd2d0('0xbd')][_0xd2d0('0x65')]({'where':{'ContactId':_0x17f880['id'],'closed':![],'WhatsappAccountId':_0x325b9e['id']}})['then'](function(_0x9cdfd8){if(_0x9cdfd8){return[_0x9cdfd8,![]];}return db[_0xd2d0('0xbd')][_0xd2d0('0x60')]({'UserId':_0xad28a1['user']['id'],'ContactId':_0x17f880['id'],'WhatsappAccountId':_0x325b9e['id'],'phone':_0x2544a6,'firstMsgDirection':_0xd2d0('0xbe'),'Messages':[_[_0xd2d0('0x57')](_0xad28a1['body'],{'read':![],'body':_0xad28a1[_0xd2d0('0x61')][_0xd2d0('0x61')],'phone':_0x2544a6,'WhatsappAccountId':_0x325b9e['id'],'UserId':_0xad28a1[_0xd2d0('0x62')]['id'],'ContactId':_0x17f880['id']})]},{'include':[{'model':db[_0xd2d0('0xad')],'as':_0xd2d0('0xbf')}]})[_0xd2d0('0x25')](function(_0x238bc4){return[_0x238bc4,!![]];});});}})['spread'](function(_0x50cd51,_0x47a4ef){if(_0x47a4ef){return _0x50cd51;}return db[_0xd2d0('0xad')]['create'](_['merge'](_0xad28a1[_0xd2d0('0x61')],{'read':![],'body':_0xad28a1[_0xd2d0('0x61')]['body'],'phone':_0x2544a6,'WhatsappAccountId':_0x325b9e['id'],'WhatsappInteractionId':_0x50cd51['id'],'UserId':_0xad28a1['user']['id'],'ContactId':_0x17f880['id']}))[_0xd2d0('0x25')](function(_0x54e3c7){_0x50cd51[_0xd2d0('0xc0')][_0xd2d0('0xbf')]=[];_0x50cd51[_0xd2d0('0xc0')][_0xd2d0('0xbf')][_0xd2d0('0xa9')](_0x54e3c7['dataValues']);return _0x50cd51;});})[_0xd2d0('0x25')](respondWithResult(_0x344714,null))[_0xd2d0('0x2e')](handleError(_0x344714,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 09c2a50..ef75b17 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 _0xb24d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount'];(function(_0x3c53a2,_0x11b05f){var _0x140454=function(_0x16ac5b){while(--_0x16ac5b){_0x3c53a2['push'](_0x3c53a2['shift']());}};_0x140454(++_0x11b05f);}(_0xb24d,0x7c));var _0xdb24=function(_0x32bb81,_0xa5f4db){_0x32bb81=_0x32bb81-0x0;var _0x2f4e50=_0xb24d[_0x32bb81];return _0x2f4e50;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xdb24('0x0'))['db'][_0xdb24('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdb24('0x2')](0x0);var events={'afterCreate':_0xdb24('0x3'),'afterUpdate':'update','afterDestroy':_0xdb24('0x4')};function emitEvent(_0x530524){return function(_0x46870e,_0x195f1a,_0x2b2936){WhatsappAccountEvents[_0xdb24('0x5')](_0x530524+':'+_0x46870e['id'],_0x46870e);WhatsappAccountEvents[_0xdb24('0x5')](_0x530524,_0x46870e);_0x2b2936(null);};}for(var e in events){if(events[_0xdb24('0x6')](e)){var event=events[e];WhatsappAccount[_0xdb24('0x7')](e,emitEvent(event));}}module[_0xdb24('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x942d=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x320362,_0x19438e){var _0x40ef57=function(_0x52f3f9){while(--_0x52f3f9){_0x320362['push'](_0x320362['shift']());}};_0x40ef57(++_0x19438e);}(_0x942d,0xf3));var _0xd942=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x942d[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xd942('0x0'));var WhatsappAccount=require(_0xd942('0x1'))['db'][_0xd942('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd942('0x3')](0x0);var events={'afterCreate':_0xd942('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c8487){return function(_0x600885,_0x3c6283,_0x44063c){WhatsappAccountEvents[_0xd942('0x5')](_0x5c8487+':'+_0x600885['id'],_0x600885);WhatsappAccountEvents[_0xd942('0x5')](_0x5c8487,_0x600885);_0x44063c(null);};}for(var e in events){if(events[_0xd942('0x6')](e)){var event=events[e];WhatsappAccount[_0xd942('0x7')](e,emitEvent(event));}}module[_0xd942('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 0a2b98e..1dc275b 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 _0xf67d=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','WhatsappAccount','whatsapp_accounts'];(function(_0x1313b2,_0x1b0889){var _0x1146f5=function(_0x46e8c4){while(--_0x46e8c4){_0x1313b2['push'](_0x1313b2['shift']());}};_0x1146f5(++_0x1b0889);}(_0xf67d,0xfd));var _0xdf67=function(_0x14fc6e,_0x252589){_0x14fc6e=_0x14fc6e-0x0;var _0xed54e0=_0xf67d[_0x14fc6e];return _0xed54e0;};'use strict';var _=require(_0xdf67('0x0'));var util=require(_0xdf67('0x1'));var logger=require(_0xdf67('0x2'))(_0xdf67('0x3'));var moment=require(_0xdf67('0x4'));var BPromise=require(_0xdf67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdf67('0x6'));var config=require(_0xdf67('0x7'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x410663,_0x39fe6a){return _0x410663[_0xdf67('0x8')](_0xdf67('0x9'),attributes,{'tableName':_0xdf67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b64=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x3b0503,_0x180001){var _0x3189e8=function(_0x501153){while(--_0x501153){_0x3b0503['push'](_0x3b0503['shift']());}};_0x3189e8(++_0x180001);}(_0x0b64,0x1a0));var _0x40b6=function(_0x43cc7d,_0x569be0){_0x43cc7d=_0x43cc7d-0x0;var _0x4a1ce4=_0x0b64[_0x43cc7d];return _0x4a1ce4;};'use strict';var _=require(_0x40b6('0x0'));var util=require(_0x40b6('0x1'));var logger=require(_0x40b6('0x2'))(_0x40b6('0x3'));var moment=require(_0x40b6('0x4'));var BPromise=require('bluebird');var rp=require(_0x40b6('0x5'));var fs=require('fs');var path=require(_0x40b6('0x6'));var rimraf=require('rimraf');var config=require(_0x40b6('0x7'));var attributes=require(_0x40b6('0x8'));module[_0x40b6('0x9')]=function(_0xf39334,_0x35d3f5){return _0xf39334[_0x40b6('0xa')](_0x40b6('0xb'),attributes,{'tableName':_0x40b6('0xc'),'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 62de14f..c182207 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 _0xeecc=['map','model','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0xeecc,0x146));var _0xceec=function(_0xc2adf7,_0xd55f45){_0xc2adf7=_0xc2adf7-0x0;var _0x464209=_0xeecc[_0xc2adf7];return _0x464209;};'use strict';var _=require(_0xceec('0x0'));var util=require('util');var moment=require(_0xceec('0x1'));var BPromise=require(_0xceec('0x2'));var rs=require(_0xceec('0x3'));var fs=require('fs');var Redis=require(_0xceec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xceec('0x5'));var logger=require(_0xceec('0x6'))('rpc');var config=require(_0xceec('0x7'));var jayson=require(_0xceec('0x8'));var client=jayson[_0xceec('0x9')][_0xceec('0xa')]({'port':0x232a});config['redis']=_[_0xceec('0xb')](config[_0xceec('0xc')],{'host':_0xceec('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xceec('0xc')]));require(_0xceec('0xe'))[_0xceec('0xf')](socket);function respondWithRpcPromise(_0x42e572,_0x2d35ef,_0x17f2bb){return new BPromise(function(_0x341ae8,_0x152d07){return client[_0xceec('0x10')](_0x42e572,_0x17f2bb)[_0xceec('0x11')](function(_0xc9a442){logger[_0xceec('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x2d35ef,_0xceec('0x13'));logger[_0xceec('0x14')](_0xceec('0x15'),_0x2d35ef,_0xceec('0x13'),JSON['stringify'](_0xc9a442));if(_0xc9a442['error']){if(_0xc9a442[_0xceec('0x16')]['code']===0x1f4){logger[_0xceec('0x16')](_0xceec('0x17'),_0x2d35ef,_0xc9a442[_0xceec('0x16')][_0xceec('0x18')]);return _0x152d07(_0xc9a442['error'][_0xceec('0x18')]);}logger[_0xceec('0x16')](_0xceec('0x17'),_0x2d35ef,_0xc9a442[_0xceec('0x16')][_0xceec('0x18')]);return _0x341ae8(_0xc9a442[_0xceec('0x16')][_0xceec('0x18')]);}else{logger[_0xceec('0x12')](_0xceec('0x17'),_0x2d35ef,'request\x20sent');_0x341ae8(_0xc9a442[_0xceec('0x19')][_0xceec('0x18')]);}})[_0xceec('0x1a')](function(_0x268cbc){logger[_0xceec('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x2d35ef,_0x268cbc);_0x152d07(_0x268cbc);});});}exports[_0xceec('0x1b')]=function(_0x262968){var _0x3deaf1=this;return new Promise(function(_0x116707,_0x52ff3a){return db[_0xceec('0x1c')][_0xceec('0x1d')]({'raw':_0x262968['options']?_0x262968[_0xceec('0x1e')][_0xceec('0x1f')]===undefined?!![]:![]:!![],'where':_0x262968[_0xceec('0x1e')]?_0x262968[_0xceec('0x1e')]['where']||null:null,'attributes':_0x262968[_0xceec('0x1e')]?_0x262968[_0xceec('0x1e')][_0xceec('0x20')]||null:null,'include':_0x262968[_0xceec('0x1e')]?_0x262968['options'][_0xceec('0x21')]?_[_0xceec('0x22')](_0x262968['options'][_0xceec('0x21')],function(_0x134e41){return{'model':db[_0x134e41[_0xceec('0x23')]],'as':_0x134e41['as'],'attributes':_0x134e41['attributes'],'include':_0x134e41[_0xceec('0x21')]?_[_0xceec('0x22')](_0x134e41[_0xceec('0x21')],function(_0x4e0228){return{'model':db[_0x4e0228['model']],'as':_0x4e0228['as'],'attributes':_0x4e0228[_0xceec('0x20')],'include':_0x4e0228[_0xceec('0x21')]?_[_0xceec('0x22')](_0x4e0228[_0xceec('0x21')],function(_0x5acd38){return{'model':db[_0x5acd38[_0xceec('0x23')]],'as':_0x5acd38['as'],'attributes':_0x5acd38[_0xceec('0x20')]};}):[]};}):[]};}):[]:[]})[_0xceec('0x11')](function(_0x368c6d){logger['info']('ShowWhatsappAccount',_0x262968);logger[_0xceec('0x14')](_0xceec('0x1b'),_0x262968,JSON['stringify'](_0x368c6d));_0x116707(_0x368c6d);})['catch'](function(_0x34af62){logger[_0xceec('0x16')](_0xceec('0x1b'),_0x34af62[_0xceec('0x18')],_0x262968);_0x52ff3a(_0x3deaf1[_0xceec('0x16')](0x1f4,_0x34af62['message']));});});}; \ No newline at end of file +var _0x75d4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','WhatsappAccount','find','raw','options','where','attributes','map','include','model','info','ShowWhatsappAccount','lodash','util','moment','bluebird'];(function(_0x37c267,_0x1afbf0){var _0x3a2289=function(_0x56e220){while(--_0x56e220){_0x37c267['push'](_0x37c267['shift']());}};_0x3a2289(++_0x1afbf0);}(_0x75d4,0x16e));var _0x475d=function(_0x5afff0,_0x4ec994){_0x5afff0=_0x5afff0-0x0;var _0x39a8da=_0x75d4[_0x5afff0];return _0x39a8da;};'use strict';var _=require(_0x475d('0x0'));var util=require(_0x475d('0x1'));var moment=require(_0x475d('0x2'));var BPromise=require(_0x475d('0x3'));var rs=require(_0x475d('0x4'));var fs=require('fs');var Redis=require(_0x475d('0x5'));var db=require(_0x475d('0x6'))['db'];var utils=require(_0x475d('0x7'));var logger=require(_0x475d('0x8'))(_0x475d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x475d('0xa')]({'port':0x232a});config[_0x475d('0xb')]=_[_0x475d('0xc')](config['redis'],{'host':_0x475d('0xd'),'port':0x18eb});var socket=require(_0x475d('0xe'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x475d('0xf')](socket);function respondWithRpcPromise(_0x34d16d,_0x477ce7,_0x42dbe4){return new BPromise(function(_0x1d7a25,_0x64e08){return client[_0x475d('0x10')](_0x34d16d,_0x42dbe4)[_0x475d('0x11')](function(_0x2321bc){logger['info'](_0x475d('0x12'),_0x477ce7,_0x475d('0x13'));logger[_0x475d('0x14')](_0x475d('0x15'),_0x477ce7,_0x475d('0x13'),JSON[_0x475d('0x16')](_0x2321bc));if(_0x2321bc['error']){if(_0x2321bc['error']['code']===0x1f4){logger['error'](_0x475d('0x12'),_0x477ce7,_0x2321bc['error']['message']);return _0x64e08(_0x2321bc[_0x475d('0x17')][_0x475d('0x18')]);}logger[_0x475d('0x17')](_0x475d('0x12'),_0x477ce7,_0x2321bc[_0x475d('0x17')][_0x475d('0x18')]);return _0x1d7a25(_0x2321bc[_0x475d('0x17')][_0x475d('0x18')]);}else{logger['info'](_0x475d('0x12'),_0x477ce7,_0x475d('0x13'));_0x1d7a25(_0x2321bc['result']['message']);}})[_0x475d('0x19')](function(_0x4de340){logger[_0x475d('0x17')](_0x475d('0x12'),_0x477ce7,_0x4de340);_0x64e08(_0x4de340);});});}exports['ShowWhatsappAccount']=function(_0x3ecf1c){var _0x1d411e=this;return new Promise(function(_0x19f59b,_0x21f491){return db[_0x475d('0x1a')][_0x475d('0x1b')]({'raw':_0x3ecf1c['options']?_0x3ecf1c['options'][_0x475d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ecf1c['options']?_0x3ecf1c[_0x475d('0x1d')][_0x475d('0x1e')]||null:null,'attributes':_0x3ecf1c[_0x475d('0x1d')]?_0x3ecf1c['options'][_0x475d('0x1f')]||null:null,'include':_0x3ecf1c[_0x475d('0x1d')]?_0x3ecf1c[_0x475d('0x1d')]['include']?_[_0x475d('0x20')](_0x3ecf1c[_0x475d('0x1d')][_0x475d('0x21')],function(_0x54922a){return{'model':db[_0x54922a[_0x475d('0x22')]],'as':_0x54922a['as'],'attributes':_0x54922a[_0x475d('0x1f')],'include':_0x54922a[_0x475d('0x21')]?_[_0x475d('0x20')](_0x54922a[_0x475d('0x21')],function(_0x45aceb){return{'model':db[_0x45aceb[_0x475d('0x22')]],'as':_0x45aceb['as'],'attributes':_0x45aceb[_0x475d('0x1f')],'include':_0x45aceb['include']?_[_0x475d('0x20')](_0x45aceb[_0x475d('0x21')],function(_0x5c0c91){return{'model':db[_0x5c0c91[_0x475d('0x22')]],'as':_0x5c0c91['as'],'attributes':_0x5c0c91[_0x475d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x475d('0x11')](function(_0x3ee84d){logger[_0x475d('0x23')](_0x475d('0x24'),_0x3ecf1c);logger['debug'](_0x475d('0x24'),_0x3ecf1c,JSON[_0x475d('0x16')](_0x3ee84d));_0x19f59b(_0x3ee84d);})[_0x475d('0x19')](function(_0x2f746b){logger[_0x475d('0x17')](_0x475d('0x24'),_0x2f746b[_0x475d('0x18')],_0x3ecf1c);_0x21f491(_0x1d411e[_0x475d('0x17')](0x1f4,_0x2f746b[_0x475d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 8dded46..570b2b3 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 _0x1546=['length','whatsappAccount:','save','remove','update','removeListener','register'];(function(_0x2e66b3,_0x12ec8a){var _0x3fa749=function(_0x57cd0d){while(--_0x57cd0d){_0x2e66b3['push'](_0x2e66b3['shift']());}};_0x3fa749(++_0x12ec8a);}(_0x1546,0xcd));var _0x6154=function(_0x20616f,_0x3181e5){_0x20616f=_0x20616f-0x0;var _0x48040d=_0x1546[_0x20616f];return _0x48040d;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x6154('0x0'),_0x6154('0x1'),_0x6154('0x2')];function createListener(_0x517bc8,_0x41123d){return function(_0x40df96){_0x41123d['emit'](_0x517bc8,_0x40df96);};}function removeListener(_0x5e47d5,_0x546914){return function(){WhatsappAccountEvents[_0x6154('0x3')](_0x5e47d5,_0x546914);};}exports[_0x6154('0x4')]=function(_0x2a9d5b){for(var _0x179fb4=0x0,_0x1a1a06=events[_0x6154('0x5')];_0x179fb4<_0x1a1a06;_0x179fb4++){var _0x51a0e7=events[_0x179fb4];var _0x284533=createListener(_0x6154('0x6')+_0x51a0e7,_0x2a9d5b);WhatsappAccountEvents['on'](_0x51a0e7,_0x284533);}}; \ No newline at end of file +var _0x17e2=['emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0xf2267d,_0x10c87c){var _0x207e0d=function(_0x12b23d){while(--_0x12b23d){_0xf2267d['push'](_0xf2267d['shift']());}};_0x207e0d(++_0x10c87c);}(_0x17e2,0xec));var _0x217e=function(_0x190dd9,_0x29dd5d){_0x190dd9=_0x190dd9-0x0;var _0x143939=_0x17e2[_0x190dd9];return _0x143939;};'use strict';var WhatsappAccountEvents=require(_0x217e('0x0'));var events=[_0x217e('0x1'),_0x217e('0x2'),_0x217e('0x3')];function createListener(_0x189209,_0x3cb2b1){return function(_0xac104b){_0x3cb2b1[_0x217e('0x4')](_0x189209,_0xac104b);};}function removeListener(_0x1babed,_0x171064){return function(){WhatsappAccountEvents[_0x217e('0x5')](_0x1babed,_0x171064);};}exports['register']=function(_0x18fbbf){for(var _0x161e16=0x0,_0x58b357=events[_0x217e('0x6')];_0x161e16<_0x58b357;_0x161e16++){var _0x29a85c=events[_0x161e16];var _0xf2ec9d=createListener(_0x217e('0x7')+_0x29a85c,_0x18fbbf);WhatsappAccountEvents['on'](_0x29a85c,_0xf2ec9d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 2d6ac17..1ae9233 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 _0xc561=['index','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0xc561,0xbc));var _0x1c56=function(_0x1a12c8,_0x2df4dc){_0x1a12c8=_0x1a12c8-0x0;var _0x305109=_0xc561[_0x1a12c8];return _0x305109;};'use strict';var multer=require(_0x1c56('0x0'));var util=require('util');var path=require(_0x1c56('0x1'));var timeout=require(_0x1c56('0x2'));var express=require('express');var router=express[_0x1c56('0x3')]();var fs_extra=require(_0x1c56('0x4'));var auth=require(_0x1c56('0x5'));var interaction=require(_0x1c56('0x6'));var config=require(_0x1c56('0x7'));var controller=require('./whatsappApplication.controller');router[_0x1c56('0x8')]('/',auth[_0x1c56('0x9')](),controller[_0x1c56('0xa')]);router[_0x1c56('0x8')](_0x1c56('0xb'),auth[_0x1c56('0x9')](),controller['show']);router[_0x1c56('0xc')]('/',auth[_0x1c56('0x9')](),controller['create']);router[_0x1c56('0xd')](_0x1c56('0xb'),auth[_0x1c56('0x9')](),controller[_0x1c56('0xe')]);router[_0x1c56('0xf')](_0x1c56('0xb'),auth['isAuthenticated'](),controller[_0x1c56('0x10')]);module[_0x1c56('0x11')]=router; \ No newline at end of file +var _0x4bcc=['index','/:id','show','create','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x34ac25,_0xdd548e){var _0x4fccf7=function(_0x46dab2){while(--_0x46dab2){_0x34ac25['push'](_0x34ac25['shift']());}};_0x4fccf7(++_0xdd548e);}(_0x4bcc,0x103));var _0xc4bc=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x4bcc[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0xc4bc('0x0'));var util=require('util');var path=require(_0xc4bc('0x1'));var timeout=require(_0xc4bc('0x2'));var express=require(_0xc4bc('0x3'));var router=express[_0xc4bc('0x4')]();var fs_extra=require(_0xc4bc('0x5'));var auth=require(_0xc4bc('0x6'));var interaction=require(_0xc4bc('0x7'));var config=require('../../config/environment');var controller=require(_0xc4bc('0x8'));router[_0xc4bc('0x9')]('/',auth[_0xc4bc('0xa')](),controller[_0xc4bc('0xb')]);router[_0xc4bc('0x9')](_0xc4bc('0xc'),auth[_0xc4bc('0xa')](),controller[_0xc4bc('0xd')]);router['post']('/',auth[_0xc4bc('0xa')](),controller[_0xc4bc('0xe')]);router[_0xc4bc('0xf')]('/:id',auth[_0xc4bc('0xa')](),controller[_0xc4bc('0x10')]);router['delete'](_0xc4bc('0xc'),auth[_0xc4bc('0xa')](),controller['destroy']);module[_0xc4bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 6df406a..9544e04 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 _0x92bd=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92bd,0xde));var _0xd92b=function(_0x446377,_0x303043){_0x446377=_0x446377-0x0;var _0x20e753=_0x92bd[_0x446377];return _0x20e753;};'use strict';var Sequelize=require(_0xd92b('0x0'));module[_0xd92b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd92b('0x2')],'allowNull':![],'defaultValue':_0xd92b('0x3')},'appdata':{'type':Sequelize[_0xd92b('0x4')]()},'description':{'type':Sequelize[_0xd92b('0x2')]},'interval':{'type':Sequelize[_0xd92b('0x2')],'defaultValue':_0xd92b('0x5')}}; \ No newline at end of file +var _0xf86b=['STRING','noop','TEXT','INTEGER'];(function(_0x36c431,_0x538aa7){var _0x465592=function(_0x3cdc25){while(--_0x3cdc25){_0x36c431['push'](_0x36c431['shift']());}};_0x465592(++_0x538aa7);}(_0xf86b,0xd7));var _0xbf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xbf86('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xbf86('0x1')],'allowNull':![],'defaultValue':_0xbf86('0x2')},'appdata':{'type':Sequelize[_0xbf86('0x3')]()},'description':{'type':Sequelize[_0xbf86('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1285e10..048b713 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 _0x17a7=['crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','count','json','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','WhatsappApplication','rawAttributes','type','key','map','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','find','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel'];(function(_0x309504,_0x50286e){var _0x41ff1e=function(_0x5e92e1){while(--_0x5e92e1){_0x309504['push'](_0x309504['shift']());}};_0x41ff1e(++_0x50286e);}(_0x17a7,0xc2));var _0x717a=function(_0x6324,_0x5e8def){_0x6324=_0x6324-0x0;var _0x461899=_0x17a7[_0x6324];return _0x461899;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x717a('0x0'));var rp=require(_0x717a('0x1'));var moment=require(_0x717a('0x2'));var BPromise=require(_0x717a('0x3'));var Mustache=require('mustache');var util=require(_0x717a('0x4'));var path=require('path');var sox=require(_0x717a('0x5'));var csv=require(_0x717a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x717a('0x7'));var _=require(_0x717a('0x8'));var squel=require(_0x717a('0x9'));var crypto=require(_0x717a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x717a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x717a('0xc'));var Papa=require('papaparse');var Redis=require(_0x717a('0xd'));var authService=require(_0x717a('0xe'));var qs=require(_0x717a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x717a('0x10'))(_0x717a('0x11'));var utils=require(_0x717a('0x12'));var config=require(_0x717a('0x13'));var licenseUtil=require(_0x717a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45eb68,_0x588baf){_0x588baf=_0x588baf||0xcc;return function(_0x2e2e95){if(_0x2e2e95){return _0x45eb68['sendStatus'](_0x588baf);}return _0x45eb68['status'](_0x588baf)['end']();};}function respondWithResult(_0x4a11bb,_0x295862){_0x295862=_0x295862||0xc8;return function(_0x546495){if(_0x546495){return _0x4a11bb[_0x717a('0x15')](_0x295862)['json'](_0x546495);}};}function respondWithFilteredResult(_0x1eca09,_0x58e33a){return function(_0xb85066){if(_0xb85066){var _0x6ae1be=typeof _0x58e33a[_0x717a('0x16')]==='undefined'&&typeof _0x58e33a[_0x717a('0x17')]==='undefined';var _0x130cb2=_0xb85066[_0x717a('0x18')];var _0x152e10=_0x6ae1be?0x0:_0x58e33a[_0x717a('0x16')];var _0x45dc38=_0x6ae1be?_0xb85066[_0x717a('0x18')]:_0x58e33a[_0x717a('0x16')]+_0x58e33a[_0x717a('0x17')];var _0x1e798f;if(_0x45dc38>=_0x130cb2){_0x45dc38=_0x130cb2;_0x1e798f=0xc8;}else{_0x1e798f=0xce;}_0x1eca09[_0x717a('0x15')](_0x1e798f);return _0x1eca09['set']('Content-Range',_0x152e10+'-'+_0x45dc38+'/'+_0x130cb2)[_0x717a('0x19')](_0xb85066);}return null;};}function patchUpdates(_0x1d7ebd){return function(_0x3ac808){try{jsonpatch[_0x717a('0x1a')](_0x3ac808,_0x1d7ebd,!![]);}catch(_0x2ef0e9){return BPromise[_0x717a('0x1b')](_0x2ef0e9);}return _0x3ac808[_0x717a('0x1c')]();};}function saveUpdates(_0x50847f,_0x4e95dc){return function(_0x3fc2be){if(_0x3fc2be){return _0x3fc2be[_0x717a('0x1d')](_0x50847f)[_0x717a('0x1e')](function(_0x33947c){return _0x33947c;});}return null;};}function removeEntity(_0x29a64c,_0x594e9c){return function(_0x345d54){if(_0x345d54){return _0x345d54[_0x717a('0x1f')]()[_0x717a('0x1e')](function(){_0x29a64c['status'](0xcc)[_0x717a('0x20')]();});}};}function handleEntityNotFound(_0x36a145,_0x5e394f){return function(_0x3f443a){if(!_0x3f443a){_0x36a145[_0x717a('0x21')](0x194);}return _0x3f443a;};}function handleError(_0x3eb06d,_0x16fbce){_0x16fbce=_0x16fbce||0x1f4;return function(_0x2c0cb3){logger['error'](_0x2c0cb3[_0x717a('0x22')]);if(_0x2c0cb3[_0x717a('0x23')]){delete _0x2c0cb3[_0x717a('0x23')];}_0x3eb06d[_0x717a('0x15')](_0x16fbce)[_0x717a('0x24')](_0x2c0cb3);};}exports[_0x717a('0x25')]=function(_0x40f3ac,_0x5dccb8){var _0x3621dc={},_0x292cfe={},_0xc189b={'count':0x0,'rows':[]};var _0x47e24b=_['map'](db[_0x717a('0x26')][_0x717a('0x27')],function(_0x97d7a1){return{'name':_0x97d7a1['fieldName'],'type':_0x97d7a1[_0x717a('0x28')][_0x717a('0x29')]};});_0x292cfe['model']=_[_0x717a('0x2a')](_0x47e24b,'name');_0x292cfe[_0x717a('0x2b')]=_[_0x717a('0x2c')](_0x40f3ac[_0x717a('0x2b')]);_0x292cfe[_0x717a('0x2d')]=_['intersection'](_0x292cfe['model'],_0x292cfe['query']);_0x3621dc[_0x717a('0x2e')]=_['intersection'](_0x292cfe[_0x717a('0x2f')],qs[_0x717a('0x30')](_0x40f3ac[_0x717a('0x2b')][_0x717a('0x30')]));_0x3621dc['attributes']=_0x3621dc['attributes'][_0x717a('0x31')]?_0x3621dc[_0x717a('0x2e')]:_0x292cfe['model'];if(!_0x40f3ac[_0x717a('0x2b')][_0x717a('0x32')](_0x717a('0x33'))){_0x3621dc[_0x717a('0x17')]=qs['limit'](_0x40f3ac[_0x717a('0x2b')][_0x717a('0x17')]);_0x3621dc[_0x717a('0x16')]=qs[_0x717a('0x16')](_0x40f3ac['query'][_0x717a('0x16')]);}_0x3621dc['order']=qs['sort'](_0x40f3ac['query']['sort']);_0x3621dc[_0x717a('0x34')]=qs[_0x717a('0x2d')](_['pick'](_0x40f3ac['query'],_0x292cfe['filters']),_0x47e24b);if(_0x40f3ac[_0x717a('0x2b')][_0x717a('0x35')]){_0x3621dc[_0x717a('0x34')]=_['merge'](_0x3621dc[_0x717a('0x34')],{'$or':_['map'](_0x47e24b,function(_0x5c2e80){if(_0x5c2e80[_0x717a('0x28')]!==_0x717a('0x36')){var _0x176d5f={};_0x176d5f[_0x5c2e80[_0x717a('0x23')]]={'$like':'%'+_0x40f3ac[_0x717a('0x2b')][_0x717a('0x35')]+'%'};return _0x176d5f;}})});}_0x3621dc=_[_0x717a('0x37')]({},_0x3621dc,_0x40f3ac[_0x717a('0x38')]);var _0x30ff72={'where':_0x3621dc['where']};return db[_0x717a('0x26')][_0x717a('0x18')](_0x30ff72)[_0x717a('0x1e')](function(_0x879271){_0xc189b['count']=_0x879271;if(_0x40f3ac['query'][_0x717a('0x39')]){_0x3621dc[_0x717a('0x3a')]=[{'all':!![]}];}return db[_0x717a('0x26')][_0x717a('0x3b')](_0x3621dc);})[_0x717a('0x1e')](function(_0x52b944){_0xc189b[_0x717a('0x3c')]=_0x52b944;return _0xc189b;})['then'](respondWithFilteredResult(_0x5dccb8,_0x3621dc))[_0x717a('0x3d')](handleError(_0x5dccb8,null));};exports[_0x717a('0x3e')]=function(_0x516f31,_0x429e84){var _0x34edd5={'raw':!![],'where':{'id':_0x516f31[_0x717a('0x3f')]['id']}},_0x684c41={};_0x684c41[_0x717a('0x2f')]=_[_0x717a('0x2c')](db[_0x717a('0x26')][_0x717a('0x27')]);_0x684c41[_0x717a('0x2b')]=_[_0x717a('0x2c')](_0x516f31[_0x717a('0x2b')]);_0x684c41[_0x717a('0x2d')]=_[_0x717a('0x40')](_0x684c41['model'],_0x684c41['query']);_0x34edd5[_0x717a('0x2e')]=_[_0x717a('0x40')](_0x684c41[_0x717a('0x2f')],qs[_0x717a('0x30')](_0x516f31[_0x717a('0x2b')][_0x717a('0x30')]));_0x34edd5[_0x717a('0x2e')]=_0x34edd5[_0x717a('0x2e')][_0x717a('0x31')]?_0x34edd5[_0x717a('0x2e')]:_0x684c41[_0x717a('0x2f')];if(_0x516f31[_0x717a('0x2b')][_0x717a('0x39')]){_0x34edd5[_0x717a('0x3a')]=[{'all':!![]}];}_0x34edd5=_[_0x717a('0x37')]({},_0x34edd5,_0x516f31['options']);return db[_0x717a('0x26')]['find'](_0x34edd5)[_0x717a('0x1e')](handleEntityNotFound(_0x429e84,null))['then'](respondWithResult(_0x429e84,null))[_0x717a('0x3d')](handleError(_0x429e84,null));};exports[_0x717a('0x41')]=function(_0x17859e,_0x4698c4){return db[_0x717a('0x26')][_0x717a('0x41')](_0x17859e[_0x717a('0x42')],{})[_0x717a('0x1e')](respondWithResult(_0x4698c4,0xc9))[_0x717a('0x3d')](handleError(_0x4698c4,null));};exports[_0x717a('0x1d')]=function(_0x3914f4,_0x20c865){if(_0x3914f4[_0x717a('0x42')]['id']){delete _0x3914f4[_0x717a('0x42')]['id'];}return db['WhatsappApplication'][_0x717a('0x43')]({'where':{'id':_0x3914f4['params']['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x20c865,null))[_0x717a('0x1e')](saveUpdates(_0x3914f4[_0x717a('0x42')],null))[_0x717a('0x1e')](respondWithResult(_0x20c865,null))[_0x717a('0x3d')](handleError(_0x20c865,null));};exports[_0x717a('0x1f')]=function(_0x2e07eb,_0x1910ff){return db[_0x717a('0x26')][_0x717a('0x43')]({'where':{'id':_0x2e07eb['params']['id']}})[_0x717a('0x1e')](handleEntityNotFound(_0x1910ff,null))[_0x717a('0x1e')](removeEntity(_0x1910ff,null))[_0x717a('0x3d')](handleError(_0x1910ff,null));}; \ No newline at end of file +var _0x02ca=['includeAll','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','type','options','include','WhatsappApplication','findAll','rows','catch','params'];(function(_0x542e6d,_0x278048){var _0x225edc=function(_0x365db7){while(--_0x365db7){_0x542e6d['push'](_0x542e6d['shift']());}};_0x225edc(++_0x278048);}(_0x02ca,0x97));var _0xa02c=function(_0x5dac37,_0x430287){_0x5dac37=_0x5dac37-0x0;var _0x4cb576=_0x02ca[_0x5dac37];return _0x4cb576;};'use strict';var emlformat=require(_0xa02c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa02c('0x1'));var jsonpatch=require(_0xa02c('0x2'));var rp=require(_0xa02c('0x3'));var moment=require(_0xa02c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa02c('0x5'));var util=require(_0xa02c('0x6'));var path=require(_0xa02c('0x7'));var sox=require(_0xa02c('0x8'));var csv=require(_0xa02c('0x9'));var ejs=require(_0xa02c('0xa'));var fs=require('fs');var fs_extra=require(_0xa02c('0xb'));var _=require(_0xa02c('0xc'));var squel=require(_0xa02c('0xd'));var crypto=require(_0xa02c('0xe'));var jsforce=require(_0xa02c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa02c('0x9'));var querystring=require(_0xa02c('0x10'));var Papa=require(_0xa02c('0x11'));var Redis=require(_0xa02c('0x12'));var authService=require(_0xa02c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa02c('0x14'));var utils=require(_0xa02c('0x15'));var config=require(_0xa02c('0x16'));var licenseUtil=require(_0xa02c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456fd5,_0x3719d4){_0x3719d4=_0x3719d4||0xcc;return function(_0x9cb7ba){if(_0x9cb7ba){return _0x456fd5[_0xa02c('0x18')](_0x3719d4);}return _0x456fd5['status'](_0x3719d4)[_0xa02c('0x19')]();};}function respondWithResult(_0xefaee9,_0x3b24e5){_0x3b24e5=_0x3b24e5||0xc8;return function(_0x546729){if(_0x546729){return _0xefaee9[_0xa02c('0x1a')](_0x3b24e5)[_0xa02c('0x1b')](_0x546729);}};}function respondWithFilteredResult(_0x5eeece,_0x35f533){return function(_0x2a3604){if(_0x2a3604){var _0x4bc36d=typeof _0x35f533[_0xa02c('0x1c')]===_0xa02c('0x1d')&&typeof _0x35f533[_0xa02c('0x1e')]==='undefined';var _0x3c1bba=_0x2a3604['count'];var _0x4d7cb5=_0x4bc36d?0x0:_0x35f533['offset'];var _0x3fcc66=_0x4bc36d?_0x2a3604[_0xa02c('0x1f')]:_0x35f533[_0xa02c('0x1c')]+_0x35f533['limit'];var _0x12688a;if(_0x3fcc66>=_0x3c1bba){_0x3fcc66=_0x3c1bba;_0x12688a=0xc8;}else{_0x12688a=0xce;}_0x5eeece['status'](_0x12688a);return _0x5eeece[_0xa02c('0x20')](_0xa02c('0x21'),_0x4d7cb5+'-'+_0x3fcc66+'/'+_0x3c1bba)[_0xa02c('0x1b')](_0x2a3604);}return null;};}function patchUpdates(_0x476777){return function(_0x56406d){try{jsonpatch[_0xa02c('0x22')](_0x56406d,_0x476777,!![]);}catch(_0x4fb1db){return BPromise[_0xa02c('0x23')](_0x4fb1db);}return _0x56406d[_0xa02c('0x24')]();};}function saveUpdates(_0x45f7b0,_0x5b10b4){return function(_0x4787c7){if(_0x4787c7){return _0x4787c7['update'](_0x45f7b0)[_0xa02c('0x25')](function(_0x2ee242){return _0x2ee242;});}return null;};}function removeEntity(_0x2e4e9d,_0x514ef1){return function(_0x4ba050){if(_0x4ba050){return _0x4ba050[_0xa02c('0x26')]()[_0xa02c('0x25')](function(){_0x2e4e9d[_0xa02c('0x1a')](0xcc)[_0xa02c('0x19')]();});}};}function handleEntityNotFound(_0x437308,_0x58496c){return function(_0x4de358){if(!_0x4de358){_0x437308[_0xa02c('0x18')](0x194);}return _0x4de358;};}function handleError(_0x2277d2,_0x320a8d){_0x320a8d=_0x320a8d||0x1f4;return function(_0x39124e){logger[_0xa02c('0x27')](_0x39124e[_0xa02c('0x28')]);if(_0x39124e[_0xa02c('0x29')]){delete _0x39124e[_0xa02c('0x29')];}_0x2277d2['status'](_0x320a8d)[_0xa02c('0x2a')](_0x39124e);};}exports[_0xa02c('0x2b')]=function(_0x31b520,_0x67d524){var _0x267ab4={},_0x402f72={},_0x19f1c9={'count':0x0,'rows':[]};var _0x1dfc2c=_[_0xa02c('0x2c')](db['WhatsappApplication'][_0xa02c('0x2d')],function(_0xb9f91){return{'name':_0xb9f91[_0xa02c('0x2e')],'type':_0xb9f91['type']['key']};});_0x402f72[_0xa02c('0x2f')]=_[_0xa02c('0x2c')](_0x1dfc2c,_0xa02c('0x29'));_0x402f72[_0xa02c('0x30')]=_[_0xa02c('0x31')](_0x31b520[_0xa02c('0x30')]);_0x402f72[_0xa02c('0x32')]=_[_0xa02c('0x33')](_0x402f72[_0xa02c('0x2f')],_0x402f72[_0xa02c('0x30')]);_0x267ab4['attributes']=_['intersection'](_0x402f72[_0xa02c('0x2f')],qs[_0xa02c('0x34')](_0x31b520[_0xa02c('0x30')][_0xa02c('0x34')]));_0x267ab4[_0xa02c('0x35')]=_0x267ab4[_0xa02c('0x35')][_0xa02c('0x36')]?_0x267ab4[_0xa02c('0x35')]:_0x402f72[_0xa02c('0x2f')];if(!_0x31b520[_0xa02c('0x30')][_0xa02c('0x37')]('nolimit')){_0x267ab4[_0xa02c('0x1e')]=qs[_0xa02c('0x1e')](_0x31b520[_0xa02c('0x30')][_0xa02c('0x1e')]);_0x267ab4['offset']=qs['offset'](_0x31b520[_0xa02c('0x30')][_0xa02c('0x1c')]);}_0x267ab4['order']=qs['sort'](_0x31b520['query']['sort']);_0x267ab4[_0xa02c('0x38')]=qs[_0xa02c('0x32')](_[_0xa02c('0x39')](_0x31b520[_0xa02c('0x30')],_0x402f72['filters']),_0x1dfc2c);if(_0x31b520[_0xa02c('0x30')][_0xa02c('0x3a')]){_0x267ab4[_0xa02c('0x38')]=_[_0xa02c('0x3b')](_0x267ab4[_0xa02c('0x38')],{'$or':_[_0xa02c('0x2c')](_0x1dfc2c,function(_0x2ab794){if(_0x2ab794[_0xa02c('0x3c')]!=='VIRTUAL'){var _0x5b957b={};_0x5b957b[_0x2ab794[_0xa02c('0x29')]]={'$like':'%'+_0x31b520[_0xa02c('0x30')][_0xa02c('0x3a')]+'%'};return _0x5b957b;}})});}_0x267ab4=_[_0xa02c('0x3b')]({},_0x267ab4,_0x31b520[_0xa02c('0x3d')]);var _0x2a491b={'where':_0x267ab4[_0xa02c('0x38')]};return db['WhatsappApplication'][_0xa02c('0x1f')](_0x2a491b)[_0xa02c('0x25')](function(_0x33a9a3){_0x19f1c9[_0xa02c('0x1f')]=_0x33a9a3;if(_0x31b520['query']['includeAll']){_0x267ab4[_0xa02c('0x3e')]=[{'all':!![]}];}return db[_0xa02c('0x3f')][_0xa02c('0x40')](_0x267ab4);})['then'](function(_0x5d2ca0){_0x19f1c9[_0xa02c('0x41')]=_0x5d2ca0;return _0x19f1c9;})['then'](respondWithFilteredResult(_0x67d524,_0x267ab4))[_0xa02c('0x42')](handleError(_0x67d524,null));};exports['show']=function(_0x43b52a,_0x48996d){var _0x5ab62c={'raw':!![],'where':{'id':_0x43b52a[_0xa02c('0x43')]['id']}},_0x4a84c4={};_0x4a84c4['model']=_['keys'](db['WhatsappApplication'][_0xa02c('0x2d')]);_0x4a84c4['query']=_['keys'](_0x43b52a[_0xa02c('0x30')]);_0x4a84c4[_0xa02c('0x32')]=_[_0xa02c('0x33')](_0x4a84c4[_0xa02c('0x2f')],_0x4a84c4[_0xa02c('0x30')]);_0x5ab62c['attributes']=_[_0xa02c('0x33')](_0x4a84c4[_0xa02c('0x2f')],qs[_0xa02c('0x34')](_0x43b52a[_0xa02c('0x30')]['fields']));_0x5ab62c[_0xa02c('0x35')]=_0x5ab62c[_0xa02c('0x35')][_0xa02c('0x36')]?_0x5ab62c[_0xa02c('0x35')]:_0x4a84c4['model'];if(_0x43b52a[_0xa02c('0x30')][_0xa02c('0x44')]){_0x5ab62c['include']=[{'all':!![]}];}_0x5ab62c=_[_0xa02c('0x3b')]({},_0x5ab62c,_0x43b52a[_0xa02c('0x3d')]);return db[_0xa02c('0x3f')]['find'](_0x5ab62c)[_0xa02c('0x25')](handleEntityNotFound(_0x48996d,null))[_0xa02c('0x25')](respondWithResult(_0x48996d,null))[_0xa02c('0x42')](handleError(_0x48996d,null));};exports[_0xa02c('0x45')]=function(_0x282f1e,_0x4f11b2){return db['WhatsappApplication'][_0xa02c('0x45')](_0x282f1e[_0xa02c('0x46')],{})[_0xa02c('0x25')](respondWithResult(_0x4f11b2,0xc9))[_0xa02c('0x42')](handleError(_0x4f11b2,null));};exports[_0xa02c('0x47')]=function(_0x128a87,_0x538df7){if(_0x128a87[_0xa02c('0x46')]['id']){delete _0x128a87[_0xa02c('0x46')]['id'];}return db[_0xa02c('0x3f')][_0xa02c('0x48')]({'where':{'id':_0x128a87[_0xa02c('0x43')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x538df7,null))['then'](saveUpdates(_0x128a87['body'],null))['then'](respondWithResult(_0x538df7,null))[_0xa02c('0x42')](handleError(_0x538df7,null));};exports['destroy']=function(_0x115c9f,_0x1cae2a){return db[_0xa02c('0x3f')][_0xa02c('0x48')]({'where':{'id':_0x115c9f[_0xa02c('0x43')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x1cae2a,null))[_0xa02c('0x25')](removeEntity(_0x1cae2a,null))['catch'](handleError(_0x1cae2a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 0b75923..4bc24df 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 _0xae1c=['WhatsappApplication','whatsapp_applications','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x218e9c,_0x3982e5){var _0x3b3ea4=function(_0xa13c0b){while(--_0xa13c0b){_0x218e9c['push'](_0x218e9c['shift']());}};_0x3b3ea4(++_0x3982e5);}(_0xae1c,0xff));var _0xcae1=function(_0x1e9341,_0x53ff67){_0x1e9341=_0x1e9341-0x0;var _0x344f8c=_0xae1c[_0x1e9341];return _0x344f8c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcae1('0x0'));var BPromise=require(_0xcae1('0x1'));var rp=require(_0xcae1('0x2'));var fs=require('fs');var path=require(_0xcae1('0x3'));var rimraf=require(_0xcae1('0x4'));var config=require(_0xcae1('0x5'));var attributes=require(_0xcae1('0x6'));module[_0xcae1('0x7')]=function(_0x3513e5,_0x40fcec){return _0x3513e5[_0xcae1('0x8')](_0xcae1('0x9'),attributes,{'tableName':_0xcae1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xee39=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0xef39bc,_0x596b6e){var _0x5208ac=function(_0x144ad8){while(--_0x144ad8){_0xef39bc['push'](_0xef39bc['shift']());}};_0x5208ac(++_0x596b6e);}(_0xee39,0x1e6));var _0x9ee3=function(_0x2d5fb2,_0xaf808e){_0x2d5fb2=_0x2d5fb2-0x0;var _0x383161=_0xee39[_0x2d5fb2];return _0x383161;};'use strict';var _=require(_0x9ee3('0x0'));var util=require(_0x9ee3('0x1'));var logger=require(_0x9ee3('0x2'))('api');var moment=require(_0x9ee3('0x3'));var BPromise=require(_0x9ee3('0x4'));var rp=require(_0x9ee3('0x5'));var fs=require('fs');var path=require(_0x9ee3('0x6'));var rimraf=require(_0x9ee3('0x7'));var config=require(_0x9ee3('0x8'));var attributes=require(_0x9ee3('0x9'));module[_0x9ee3('0xa')]=function(_0x24d93e,_0x2689bb){return _0x24d93e['define'](_0x9ee3('0xb'),attributes,{'tableName':_0x9ee3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ee3('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index abb490f..72c3a79 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x5e235e,_0x4be335){var _0x34974a=function(_0x42d0f3){while(--_0x42d0f3){_0x5e235e['push'](_0x5e235e['shift']());}};_0x34974a(++_0x4be335);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x00bb[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result'];(function(_0x1d5b3d,_0x5c7145){var _0xc810b9=function(_0x2b11fa){while(--_0x2b11fa){_0x1d5b3d['push'](_0x1d5b3d['shift']());}};_0xc810b9(++_0x5c7145);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0xf3cd[_0x408d22];return _0x58effd;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index bf780df..89c8136 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 _0x2bd8=['delete','whatsappinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','put','tracked','whatsappinteraction:update','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2bd8,0x130));var _0x82bd=function(_0x47bffd,_0xbf560a){_0x47bffd=_0x47bffd-0x0;var _0x226e7b=_0x2bd8[_0x47bffd];return _0x226e7b;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x82bd('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x82bd('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x82bd('0xf')]);router[_0x82bd('0x10')]('/',auth['isAuthenticated'](),controller[_0x82bd('0x11')]);router['post'](_0x82bd('0xe'),auth['isAuthenticated'](),controller[_0x82bd('0x12')]);router[_0x82bd('0x10')](_0x82bd('0x13'),auth[_0x82bd('0xa')](),interaction['tracked'](_0x82bd('0x14'),_0x82bd('0x15')),controller['addTags']);router[_0x82bd('0x16')]('/:id',auth[_0x82bd('0xa')](),interaction[_0x82bd('0x17')](_0x82bd('0x14'),_0x82bd('0x18')),controller[_0x82bd('0x19')]);router[_0x82bd('0x1a')](_0x82bd('0xd'),auth[_0x82bd('0xa')](),interaction[_0x82bd('0x17')](_0x82bd('0x14'),_0x82bd('0x1b')),controller[_0x82bd('0x1c')]);router[_0x82bd('0x1a')](_0x82bd('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0x82bd('0x1d')]=router; \ No newline at end of file +var _0x5075=['describe','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get','isAuthenticated'];(function(_0xb8eba7,_0x26663e){var _0x52cf51=function(_0x1e53a6){while(--_0x1e53a6){_0xb8eba7['push'](_0xb8eba7['shift']());}};_0x52cf51(++_0x26663e);}(_0x5075,0x73));var _0x5507=function(_0x29db14,_0x4fcd9f){_0x29db14=_0x29db14-0x0;var _0x5cfc55=_0x5075[_0x29db14];return _0x5cfc55;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5507('0xa')]);router[_0x5507('0xb')]('/describe',auth[_0x5507('0xc')](),controller[_0x5507('0xd')]);router[_0x5507('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xb')](_0x5507('0xf'),auth[_0x5507('0xc')](),controller['getMessages']);router[_0x5507('0xb')](_0x5507('0x10'),auth['isAuthenticated'](),controller[_0x5507('0x11')]);router[_0x5507('0x12')]('/',auth['isAuthenticated'](),controller[_0x5507('0x13')]);router[_0x5507('0x12')](_0x5507('0xf'),auth[_0x5507('0xc')](),controller[_0x5507('0x14')]);router[_0x5507('0x12')]('/:id/tags',auth[_0x5507('0xc')](),interaction[_0x5507('0x15')](_0x5507('0x16'),_0x5507('0x17')),controller['addTags']);router[_0x5507('0x18')](_0x5507('0x19'),auth[_0x5507('0xc')](),interaction[_0x5507('0x15')](_0x5507('0x16'),_0x5507('0x1a')),controller[_0x5507('0x1b')]);router[_0x5507('0x1c')](_0x5507('0x19'),auth[_0x5507('0xc')](),interaction[_0x5507('0x15')](_0x5507('0x16'),_0x5507('0x1d')),controller['destroy']);router[_0x5507('0x1c')](_0x5507('0x1e'),auth[_0x5507('0xc')](),controller[_0x5507('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c25a2ca..3720533 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 _0x88d5=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x2b846e,_0x31515f){var _0x32d19f=function(_0xc2e7dd){while(--_0xc2e7dd){_0x2b846e['push'](_0x2b846e['shift']());}};_0x32d19f(++_0x31515f);}(_0x88d5,0x76));var _0x588d=function(_0x36bc58,_0x27f03c){_0x36bc58=_0x36bc58-0x0;var _0x4a547e=_0x88d5[_0x36bc58];return _0x4a547e;};'use strict';var Sequelize=require(_0x588d('0x0'));var moment=require(_0x588d('0x1'));module[_0x588d('0x2')]={'closed':{'type':Sequelize[_0x588d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x588d('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x588d('0x5')]},'thirdDisposition':{'type':Sequelize[_0x588d('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x588d('0x5')]},'read1stAt':{'type':Sequelize[_0x588d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x588d('0x6')]('in',_0x588d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x588d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x588d('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x746f=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x32fcd6,_0x2018e1){var _0x4fdbd9=function(_0x4e073a){while(--_0x4e073a){_0x32fcd6['push'](_0x32fcd6['shift']());}};_0x4fdbd9(++_0x2018e1);}(_0x746f,0x9c));var _0xf746=function(_0x21bd55,_0x47d03c){_0x21bd55=_0x21bd55-0x0;var _0x146945=_0x746f[_0x21bd55];return _0x146945;};'use strict';var Sequelize=require(_0xf746('0x0'));var moment=require(_0xf746('0x1'));module[_0xf746('0x2')]={'closed':{'type':Sequelize[_0xf746('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf746('0x4')]},'disposition':{'type':Sequelize[_0xf746('0x5')]},'secondDisposition':{'type':Sequelize[_0xf746('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf746('0x5')]},'note':{'type':Sequelize[_0xf746('0x5')]},'phone':{'type':Sequelize[_0xf746('0x5')]},'read1stAt':{'type':Sequelize[_0xf746('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf746('0x6')]('in',_0xf746('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf746('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf746('0x6')]('in',_0xf746('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf746('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 37c876f..1691463 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 _0xdbad=['conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','body','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','sequelize','toString','merge','WhatsappInteraction','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','params','includeAll','include','options','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','nolimit','sort','format','findAll','setTags','omit','spread','whatsappInteractionTags:save','removeTags','download','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','fullname','CmContact','lastName','Attachment','Messages','secret','WhatsappAccount','Account','get','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','direction','out','System','firstName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','Users','map','TagIds','split','forEach','catch','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xdbad,0x8d));var _0xddba=function(_0x1f7e42,_0x32a1b6){_0x1f7e42=_0x1f7e42-0x0;var _0x1f5e9c=_0xdbad[_0x1f7e42];return _0x1f5e9c;};'use strict';var emlformat=require(_0xddba('0x0'));var rimraf=require(_0xddba('0x1'));var zipdir=require(_0xddba('0x2'));var jsonpatch=require(_0xddba('0x3'));var rp=require(_0xddba('0x4'));var moment=require('moment');var BPromise=require(_0xddba('0x5'));var Mustache=require(_0xddba('0x6'));var util=require('util');var path=require('path');var sox=require(_0xddba('0x7'));var csv=require(_0xddba('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddba('0x9'));var _=require(_0xddba('0xa'));var squel=require(_0xddba('0xb'));var crypto=require(_0xddba('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xddba('0x8'));var querystring=require(_0xddba('0xd'));var Papa=require(_0xddba('0xe'));var Redis=require(_0xddba('0xf'));var authService=require(_0xddba('0x10'));var qs=require(_0xddba('0x11'));var as=require(_0xddba('0x12'));var pdf=require(_0xddba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddba('0x14'))(_0xddba('0x15'));var utils=require('../../config/utils');var config=require(_0xddba('0x16'));var licenseUtil=require(_0xddba('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xddba('0x18')](config[_0xddba('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xddba('0x1a'))(new Redis(config[_0xddba('0x19')]));require(_0xddba('0x1b'))[_0xddba('0x1c')](socket);function respondWithStatusCode(_0x2d75c8,_0x12d971){_0x12d971=_0x12d971||0xcc;return function(_0x4c66e3){if(_0x4c66e3){return _0x2d75c8[_0xddba('0x1d')](_0x12d971);}return _0x2d75c8[_0xddba('0x1e')](_0x12d971)[_0xddba('0x1f')]();};}function respondWithResult(_0x3cc67e,_0xa15f4){_0xa15f4=_0xa15f4||0xc8;return function(_0x2663d9){if(_0x2663d9){return _0x3cc67e[_0xddba('0x1e')](_0xa15f4)['json'](_0x2663d9);}};}function respondWithFilteredResult(_0xd9ba53,_0x47da5b){return function(_0x28eb79){if(_0x28eb79){var _0x56677a=typeof _0x47da5b[_0xddba('0x20')]===_0xddba('0x21')&&typeof _0x47da5b['limit']===_0xddba('0x21');var _0x55f5fc=_0x28eb79[_0xddba('0x22')];var _0x28d3f3=_0x56677a?0x0:_0x47da5b['offset'];var _0x29fb4a=_0x56677a?_0x28eb79[_0xddba('0x22')]:_0x47da5b[_0xddba('0x20')]+_0x47da5b['limit'];var _0x4a24c4;if(_0x29fb4a>=_0x55f5fc){_0x29fb4a=_0x55f5fc;_0x4a24c4=0xc8;}else{_0x4a24c4=0xce;}_0xd9ba53[_0xddba('0x1e')](_0x4a24c4);return _0xd9ba53[_0xddba('0x23')](_0xddba('0x24'),_0x28d3f3+'-'+_0x29fb4a+'/'+_0x55f5fc)[_0xddba('0x25')](_0x28eb79);}return null;};}function patchUpdates(_0x4688ff){return function(_0x458c60){try{jsonpatch[_0xddba('0x26')](_0x458c60,_0x4688ff,!![]);}catch(_0x42a672){return BPromise[_0xddba('0x27')](_0x42a672);}return _0x458c60[_0xddba('0x28')]();};}function saveUpdates(_0x11e6bd,_0xe0deb4){return function(_0x1f7525){if(_0x1f7525){return _0x1f7525['update'](_0x11e6bd)[_0xddba('0x29')](function(_0x4fcc72){return _0x4fcc72;});}return null;};}function removeEntity(_0x2a5413,_0xe42647){return function(_0x5a1f2b){if(_0x5a1f2b){return _0x5a1f2b[_0xddba('0x2a')]()['then'](function(){_0x2a5413[_0xddba('0x1e')](0xcc)[_0xddba('0x1f')]();});}};}function handleEntityNotFound(_0x5275e1,_0xf63696){return function(_0x333a64){if(!_0x333a64){_0x5275e1[_0xddba('0x1d')](0x194);}return _0x333a64;};}function handleError(_0x1a23bf,_0x197552){_0x197552=_0x197552||0x1f4;return function(_0x40d5ef){logger['error'](_0x40d5ef[_0xddba('0x2b')]);if(_0x40d5ef['name']){delete _0x40d5ef[_0xddba('0x2c')];}_0x1a23bf['status'](_0x197552)[_0xddba('0x2d')](_0x40d5ef);};}function getInteractionUsers(_0x537e79,_0x325d33){return new BPromise(function(_0x290798,_0x1ec6a6){try{if(_0x325d33[_0x537e79['id']]){_0x537e79[_0xddba('0x2e')]=_[_0xddba('0x2f')](_0x325d33[_0x537e79['id']],function(_0xf90ba1){return{'id':_0xf90ba1['id'],'fullname':_0xf90ba1['fullname']};});}}catch(_0x176975){_0x1ec6a6(_0x176975);}_0x290798(_0x537e79);});}function getInteractionTags(_0x2b1f22,_0xd3e96b){return new BPromise(function(_0x4f4358,_0x4d560c){try{if(_0x2b1f22[_0xddba('0x30')]){_0x2b1f22['Tags']=[];_0x2b1f22[_0xddba('0x30')][_0xddba('0x31')](',')[_0xddba('0x32')](function(_0x59a9f2){_0x2b1f22['Tags']['push'](_0xd3e96b[_0x59a9f2]);});}delete _0x2b1f22[_0xddba('0x30')];}catch(_0x507e84){_0x4d560c(_0x507e84);}_0x4f4358(_0x2b1f22);});}function updateWhatsappInteraction(_0x13c3d2,_0x25f712,_0x42ccd6){return new BPromise(function(_0x5192e4,_0x50e4de){return getInteractionUsers(_0x13c3d2,_0x42ccd6)[_0xddba('0x29')](function(_0x5ab742){return getInteractionTags(_0x5ab742,_0x25f712);})[_0xddba('0x29')](function(_0x420006){_0x5192e4(_0x420006);})[_0xddba('0x33')](function(_0x221cbf){_0x50e4de(_0x221cbf);});});}exports[_0xddba('0x34')]=function(_0x47631e,_0x4810b3){var _0x2d72d2={},_0x31abea={},_0x4eca38={'count':0x0,'rows':[]};var _0x1f4f69=_['map'](db['WhatsappInteraction'][_0xddba('0x35')],function(_0x4b569c){return{'name':_0x4b569c[_0xddba('0x36')],'type':_0x4b569c[_0xddba('0x37')][_0xddba('0x38')]};});_0x31abea[_0xddba('0x39')]=_['map'](_0x1f4f69,_0xddba('0x2c'));_0x31abea[_0xddba('0x3a')]=_[_0xddba('0x3b')](_0x47631e[_0xddba('0x3a')]);_0x31abea[_0xddba('0x3c')]=_[_0xddba('0x3d')](_0x31abea[_0xddba('0x39')],_0x31abea[_0xddba('0x3a')]);_0x2d72d2[_0xddba('0x3e')]=_[_0xddba('0x3d')](_0x31abea[_0xddba('0x39')],qs[_0xddba('0x3f')](_0x47631e[_0xddba('0x3a')][_0xddba('0x3f')]));_0x2d72d2[_0xddba('0x3e')]=_0x2d72d2[_0xddba('0x3e')][_0xddba('0x40')]?_0x2d72d2[_0xddba('0x3e')]:_0x31abea[_0xddba('0x39')];if(!_0x47631e[_0xddba('0x3a')][_0xddba('0x41')]('nolimit')){_0x2d72d2[_0xddba('0x42')]=qs['limit'](_0x47631e['query'][_0xddba('0x42')]);_0x2d72d2['offset']=qs['offset'](_0x47631e[_0xddba('0x3a')][_0xddba('0x20')]);}_0x2d72d2[_0xddba('0x43')]=qs['sort'](_0x47631e[_0xddba('0x3a')]['sort']);_0x2d72d2[_0xddba('0x44')]=qs[_0xddba('0x3c')](_[_0xddba('0x45')](_0x47631e[_0xddba('0x3a')],_0x31abea[_0xddba('0x3c')]),_0x1f4f69);var _0xe3b966=[];var _0x4b7a2d=squel['select']()['field']('id')[_0xddba('0x46')](_0xddba('0x2c'))[_0xddba('0x46')](_0xddba('0x47'))[_0xddba('0x48')](_0xddba('0x49'));var _0x3bb208=squel[_0xddba('0x4a')]()[_0xddba('0x46')](_0xddba('0x4b'))['field'](_0xddba('0x4c'))[_0xddba('0x46')](_0xddba('0x4d'))['from'](_0xddba('0x4e'),'ui')[_0xddba('0x4f')](_0xddba('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x30b71c=squel[_0xddba('0x4a')]()[_0xddba('0x48')](_0xddba('0x51'),'i')['left_join']('cm_contacts','c',_0xddba('0x52'))[_0xddba('0x4f')](_0xddba('0x50'),'o',_0xddba('0x53'))[_0xddba('0x4f')]('whatsapp_accounts','a',_0xddba('0x54'))[_0xddba('0x4f')](_0xddba('0x55'),'me',_0xddba('0x56'))[_0xddba('0x4f')](_0xddba('0x57'),'it',_0xddba('0x58'))[_0xddba('0x4f')](_0xddba('0x49'),'t','t.id\x20=\x20it.TagId');var _0x3e9f95=squel[_0xddba('0x59')]();var _0x2e1ee5=[];var _0x105409=squel[_0xddba('0x59')]();var _0x3236d9;if(_0x47631e['query'][_0xddba('0x5a')]){_0x3236d9=as[_0xddba('0x5b')](_0x47631e['query'][_0xddba('0x5a')]);var _0x84a4b2=_0x3236d9['sqlOperator'];for(var _0x239fd9=0x0;_0x239fd9<_0x3236d9['conditions'][_0xddba('0x40')];_0x239fd9++){var _0x1f723a=_0x3236d9[_0xddba('0x5c')][_0x239fd9];var _0x314dc4='i';var _0x1b2bb2=_[_0xddba('0x5d')](_0x1f4f69,[_0xddba('0x2c'),_0x1f723a[_0xddba('0x46')]]);if(!_0x1b2bb2){switch(_0x1f723a[_0xddba('0x46')]){case _0xddba('0x5e'):if(_0x1f723a[_0xddba('0x5f')]==0x1){_0x30b71c['having']('`'+_0x1f723a['field']+_0xddba('0x60'));}else{_0x30b71c[_0xddba('0x61')]('`'+_0x1f723a[_0xddba('0x46')]+_0xddba('0x62'));}break;case _0xddba('0x63'):if(_0x1f723a[_0xddba('0x64')]===_0xddba('0x65')){if(_0x1f723a[_0xddba('0x5f')][_0xddba('0x31')]('\x20')[_0xddba('0x40')]>0x1){_0x3e9f95[_0x84a4b2](_0xddba('0x66'),qs[_0xddba('0x67')](_0x1f723a[_0xddba('0x5f')]),null);}else{var _0x3ed89f='%'+_0x1f723a[_0xddba('0x5f')]+'%';_0x3e9f95[_0x84a4b2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3ed89f,_0x3ed89f,_0x3ed89f);}}else{_0x1b2bb2=_[_0xddba('0x5d')](_0x1f4f69,['name',_0xddba('0x68')]);_0x1f723a[_0xddba('0x46')]=_0xddba('0x68');_0x7ac96=as[_0xddba('0x69')](_0x314dc4,_0x1b2bb2[_0xddba('0x37')],_0x1f723a);_0x3e9f95[_0x84a4b2](_0x7ac96[_0xddba('0x6a')],_0x7ac96[_0xddba('0x5f')][_0xddba('0x6b')],_0x7ac96[_0xddba('0x5f')][_0xddba('0x1f')]);}break;case _0xddba('0x6c'):var _0x47929d=_0x1f723a[_0xddba('0x5f')][_0xddba('0x31')](',')[_0xddba('0x2f')](function(_0x1c3b17){return Number(_0x1c3b17);});_0x47929d['forEach'](function(_0x4b699f){_0x105409['or'](_0xddba('0x6d'),'%,'+_0x4b699f+',%');});_0x2e1ee5=_['union'](_0x2e1ee5,_0x47929d);break;case _0xddba('0x6e'):if(_0x1f723a[_0xddba('0x64')]===_0xddba('0x65')){_0x3e9f95[_0x84a4b2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1f723a[_0xddba('0x5f')]+'%',null);}else{_0x1b2bb2=_[_0xddba('0x5d')](_0x1f4f69,['name',_0xddba('0x6f')]);_0x1f723a['field']='UserId';_0x7ac96=as[_0xddba('0x69')](_0x314dc4,_0x1b2bb2[_0xddba('0x37')],_0x1f723a);_0x3e9f95[_0x84a4b2](_0x7ac96[_0xddba('0x6a')],_0x7ac96[_0xddba('0x5f')][_0xddba('0x6b')],_0x7ac96[_0xddba('0x5f')]['end']);}break;case _0xddba('0x70'):_0x7ac96=as[_0xddba('0x69')]('me',null,_0x1f723a);_0x3e9f95[_0x84a4b2](_0x7ac96['text'],_0x7ac96[_0xddba('0x5f')]['start'],_0x7ac96[_0xddba('0x5f')][_0xddba('0x1f')]);break;}}else{var _0x7ac96=as['buildExpression'](_0x314dc4,_0x1b2bb2[_0xddba('0x37')],_0x1f723a);_0x3e9f95[_0x84a4b2](_0x7ac96[_0xddba('0x6a')],_0x7ac96['value']['start'],_0x7ac96[_0xddba('0x5f')][_0xddba('0x1f')]);}}}else{var _0x2f12ff=_(_0x47631e['query'])[_0xddba('0x3b')]()[_0xddba('0x2f')](function(_0x2c10dd){return _[_0xddba('0x71')](_0x1f4f69,[_0xddba('0x2c'),_0x2c10dd])?_0x2c10dd:undefined;})[_0xddba('0x72')]()[_0xddba('0x5f')]();if(!_[_0xddba('0x73')](_0x2f12ff)){_0x2f12ff[_0xddba('0x32')](function(_0x3872dd){if(_0x3872dd==='WhatsappAccountId'){_0x30b71c['where'](_0xddba('0x74'),[][_0xddba('0x75')](_0x47631e[_0xddba('0x3a')][_0x3872dd]));}else if(_0x3872dd===_0xddba('0x76')){var _0xa0168=JSON['parse'](_0x47631e['query'][_0x3872dd])[_0xddba('0x77')];var _0xc3a801=JSON[_0xddba('0x78')](_0x47631e['query'][_0x3872dd])[_0xddba('0x79')];_0x30b71c[_0xddba('0x44')](_0xddba('0x7a'),_0xa0168,_0xc3a801);}else{if(_0x47631e['query'][_0x3872dd]===_0xddba('0x7b')){_0x30b71c[_0xddba('0x44')]('i.'+_0x3872dd+_0xddba('0x7c'));}else{_0x30b71c[_0xddba('0x44')]('i.'+_0x3872dd+_0xddba('0x7d'),_0x47631e[_0xddba('0x3a')][_0x3872dd]);}}});}if(_0x47631e[_0xddba('0x3a')][_0xddba('0x7e')]){if(_0x47631e[_0xddba('0x3a')]['read']==0x1){_0x30b71c[_0xddba('0x61')]('`unreadMessages`\x20=\x200');}else{_0x30b71c[_0xddba('0x61')](_0xddba('0x7f'));}}if(_0x47631e[_0xddba('0x3a')][_0xddba('0x80')]){_0x2e1ee5=_[_0xddba('0x81')](_0x47631e[_0xddba('0x3a')]['tag'])?_0x47631e[_0xddba('0x3a')][_0xddba('0x80')]:new Array(_0x47631e[_0xddba('0x3a')]['tag']);_0x2e1ee5['forEach'](function(_0x55c646){_0x105409['or'](_0xddba('0x6d'),'%,'+_0x55c646+',%');});}if(_0x47631e[_0xddba('0x3a')][_0xddba('0x82')]){var _0x485c5a=_0x47631e[_0xddba('0x3a')][_0xddba('0x82')][_0xddba('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x485c5a)){_0x3e9f95['or']('i.id\x20LIKE\x20?',_0x485c5a+'%')['or'](_0xddba('0x84'),_0x485c5a+'%');}else{_0x3e9f95['or'](_0xddba('0x85'),qs['getFullTextValue'](_0x485c5a))['or'](_0xddba('0x86'),_0x485c5a+'%');}}}_0x30b71c['where'](_0x3e9f95);_0x30b71c[_0xddba('0x87')](_0xddba('0x88'));var _0xcf54c6={'type':db['Sequelize'][_0xddba('0x89')][_0xddba('0x8a')],'raw':!![]};var _0x5c5802=_0x30b71c[_0xddba('0x8b')]();_0x5c5802[_0xddba('0x46')](_0xddba('0x88'));_0x5c5802[_0xddba('0x46')](_0xddba('0x8c'),_0xddba('0x5e'));if(_0x2d72d2['order']){_0x2d72d2[_0xddba('0x43')][_0xddba('0x32')](function(_0x3c017b){var _0x37d06b=_0x3c017b[0x0]==='contactName'?_0x3c017b[0x0]:'i.'+_0x3c017b[0x0];_0x30b71c[_0xddba('0x43')](_0x37d06b,_0x3c017b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xddba('0x73')](_0x2e1ee5)){_0x30b71c['having'](_0x105409);_0x5c5802[_0xddba('0x44')](_0xddba('0x8d'),_0x2e1ee5);}BPromise[_0xddba('0x8e')]()[_0xddba('0x29')](function(){if(!_0x3236d9){if(_0x47631e[_0xddba('0x3a')][_0xddba('0x8f')])return;_0x5c5802[_0xddba('0x44')](_0xddba('0x90'));_0x30b71c['where'](_0xddba('0x90'));return;}if(_0x47631e[_0xddba('0x91')]['role']!==_0xddba('0x92'))return;return _0x47631e[_0xddba('0x91')][_0xddba('0x93')]({'attributes':['id'],'raw':!![]})[_0xddba('0x29')](function(_0x171083){if(_[_0xddba('0x73')](_0x171083)){_0x5c5802[_0xddba('0x44')](_0xddba('0x94'));_0x30b71c[_0xddba('0x44')](_0xddba('0x94'));}else{_0x5c5802[_0xddba('0x44')](_0xddba('0x74'),_[_0xddba('0x2f')](_0x171083,'id'));_0x30b71c[_0xddba('0x44')](_0xddba('0x74'),_[_0xddba('0x2f')](_0x171083,'id'));}});})[_0xddba('0x29')](function(){if(_0x47631e['user'][_0xddba('0x95')]===_0xddba('0x92')&&!_0x3236d9&&!_0x47631e['query'][_0xddba('0x8f')])return[];return db[_0xddba('0x96')]['query'](_0x5c5802[_0xddba('0x97')](),_0xcf54c6);})['then'](function(_0x27881c){_0x4eca38[_0xddba('0x22')]=_0x27881c[_0xddba('0x40')];if(_0x4eca38[_0xddba('0x22')]===0x0)return[];return db[_0xddba('0x96')][_0xddba('0x3a')](_0x4b7a2d[_0xddba('0x97')](),_0xcf54c6)[_0xddba('0x29')](function(_0x3f27f8){_0xe3b966=_['keyBy'](_0x3f27f8,'id');_0xcf54c6=_[_0xddba('0x98')](_0xcf54c6,{'model':db[_0xddba('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47631e[_0xddba('0x3a')][_0xddba('0x3f')]){_0x2d72d2['attributes'][_0xddba('0x32')](function(_0xfb0e1b){_0x30b71c[_0xddba('0x46')]('i.'+_0xfb0e1b);});}else{_0x30b71c[_0xddba('0x46')](_0xddba('0x8c'),_0xddba('0x5e'));_0x30b71c['field'](_0xddba('0x9a'),_0xddba('0x9b'));_0x30b71c['field']('a.mandatoryDisposition',_0xddba('0x9c'));_0x30b71c[_0xddba('0x46')]('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',_0xddba('0x9d'));_0x30b71c[_0xddba('0x46')](_0xddba('0x9e'));_0x30b71c[_0xddba('0x46')](_0xddba('0x9f'),_0xddba('0xa0'));_0x30b71c['field']('c.lastName','Contact.lastName');_0x30b71c[_0xddba('0x46')](_0xddba('0xa1'),'Contact.email');_0x30b71c[_0xddba('0x46')]('c.phone',_0xddba('0xa2'));_0x30b71c[_0xddba('0x46')]('c.mobile',_0xddba('0xa3'));_0x30b71c[_0xddba('0x46')](_0xddba('0xa4'),_0xddba('0xa5'));_0x30b71c[_0xddba('0x46')](_0xddba('0xa6'),_0xddba('0xa7'));_0x30b71c[_0xddba('0x46')](_0xddba('0xa8'),_0xddba('0xa9'));_0x30b71c[_0xddba('0x46')](_0xddba('0xaa'),_0xddba('0x30'));}if(_0x2d72d2[_0xddba('0x42')])_0x30b71c[_0xddba('0x42')](_0x2d72d2['limit']);if(_0x2d72d2[_0xddba('0x20')])_0x30b71c[_0xddba('0x20')](_0x2d72d2[_0xddba('0x20')]);return db['sequelize'][_0xddba('0x3a')](_0x30b71c[_0xddba('0x97')](),_0xcf54c6);})['then'](function(_0x410e85){if(_0x410e85[_0xddba('0x40')]>0x0)_0x3bb208[_0xddba('0x44')](_0xddba('0xab'),_[_0xddba('0x2f')](_0x410e85,'id'));return db[_0xddba('0x96')][_0xddba('0x3a')](_0x3bb208[_0xddba('0x97')](),_0xcf54c6)[_0xddba('0x29')](function(_0x35bf49){var _0x2ceaf4=_[_0xddba('0xac')](_0x35bf49,_0xddba('0xad'));var _0x4b0e72=[];_0x410e85[_0xddba('0x32')](function(_0x2cf384){_0x4b0e72[_0xddba('0xae')](updateWhatsappInteraction(_0x2cf384,_0xe3b966,_0x2ceaf4));});return BPromise[_0xddba('0xaf')](_0x4b0e72);});});})[_0xddba('0x29')](function(_0x557b9f){_0x4eca38['rows']=_0x557b9f;return _0x4eca38;})[_0xddba('0x29')](respondWithFilteredResult(_0x4810b3,_0x2d72d2))[_0xddba('0x33')](handleError(_0x4810b3,null));};exports['show']=function(_0x2cd93e,_0x2983cb){var _0x21b4c6={'raw':![],'where':{'id':_0x2cd93e[_0xddba('0xb0')]['id']}},_0x45e54f={};_0x45e54f[_0xddba('0x39')]=_[_0xddba('0x3b')](db[_0xddba('0x99')][_0xddba('0x35')]);_0x45e54f[_0xddba('0x3a')]=_[_0xddba('0x3b')](_0x2cd93e[_0xddba('0x3a')]);_0x45e54f[_0xddba('0x3c')]=_['intersection'](_0x45e54f[_0xddba('0x39')],_0x45e54f[_0xddba('0x3a')]);_0x21b4c6[_0xddba('0x3e')]=_[_0xddba('0x3d')](_0x45e54f['model'],qs[_0xddba('0x3f')](_0x2cd93e[_0xddba('0x3a')][_0xddba('0x3f')]));_0x21b4c6[_0xddba('0x3e')]=_0x21b4c6['attributes'][_0xddba('0x40')]?_0x21b4c6['attributes']:_0x45e54f[_0xddba('0x39')];if(_0x2cd93e[_0xddba('0x3a')][_0xddba('0xb1')]){_0x21b4c6[_0xddba('0xb2')]=[{'all':!![]}];}_0x21b4c6=_[_0xddba('0x98')]({},_0x21b4c6,_0x2cd93e[_0xddba('0xb3')]);return db[_0xddba('0x99')]['find'](_0x21b4c6)[_0xddba('0x29')](handleEntityNotFound(_0x2983cb,null))[_0xddba('0x29')](respondWithResult(_0x2983cb,null))[_0xddba('0x33')](handleError(_0x2983cb,null));};exports['create']=function(_0x366039,_0x4f1609){return db[_0xddba('0x99')]['create'](_0x366039['body'],{})[_0xddba('0x29')](respondWithResult(_0x4f1609,0xc9))[_0xddba('0x33')](handleError(_0x4f1609,null));};exports['update']=function(_0x463f19,_0x527ce3){if(_0x463f19[_0xddba('0x70')]['id']){delete _0x463f19[_0xddba('0x70')]['id'];}return db['WhatsappInteraction'][_0xddba('0x5d')]({'where':{'id':_0x463f19[_0xddba('0xb0')]['id']}})[_0xddba('0x29')](handleEntityNotFound(_0x527ce3,null))[_0xddba('0x29')](saveUpdates(_0x463f19[_0xddba('0x70')],null))[_0xddba('0x29')](respondWithResult(_0x527ce3,null))[_0xddba('0x33')](handleError(_0x527ce3,null));};exports[_0xddba('0x2a')]=function(_0x192014,_0x50287c){return db[_0xddba('0x99')][_0xddba('0x5d')]({'where':{'id':_0x192014[_0xddba('0xb0')]['id']}})['then'](handleEntityNotFound(_0x50287c,null))[_0xddba('0x29')](removeEntity(_0x50287c,null))[_0xddba('0x33')](handleError(_0x50287c,null));};exports['describe']=function(_0x5a8310,_0x49e0b0){return db[_0xddba('0x99')][_0xddba('0xb4')]()[_0xddba('0x29')](respondWithResult(_0x49e0b0,null))[_0xddba('0x33')](handleError(_0x49e0b0,null));};exports[_0xddba('0xb5')]=function(_0x1cd609,_0x113cf5,_0x44a805){return db[_0xddba('0xb6')][_0xddba('0x5d')]({'where':{'id':_0x1cd609['params']['id']}})[_0xddba('0x29')](handleEntityNotFound(_0x113cf5,null))[_0xddba('0x29')](function(_0x3b8b8e){if(_0x3b8b8e){return _0x3b8b8e[_0xddba('0xb5')](_0x1cd609[_0xddba('0x70')][_0xddba('0xb7')],_['omit'](_0x1cd609[_0xddba('0x70')],['ids','id'])||{});}})[_0xddba('0x29')](respondWithResult(_0x113cf5,null))['catch'](handleError(_0x113cf5,null));};exports[_0xddba('0xb8')]=function(_0xdedbdd,_0x4b5d55,_0x28c3e4){var _0x13e5e7={'raw':![],'where':{}};var _0x4ca125={};var _0x419faa={'count':0x0,'rows':[]};return db[_0xddba('0x99')][_0xddba('0xb9')]({'where':{'id':_0xdedbdd[_0xddba('0xb0')]['id']}})[_0xddba('0x29')](handleEntityNotFound(_0x4b5d55,null))['then'](function(_0x11ea64){if(_0x11ea64){_0x4ca125[_0xddba('0x39')]=_[_0xddba('0x3b')](db[_0xddba('0xb6')]['rawAttributes']);_0x4ca125['query']=_[_0xddba('0x3b')](_0xdedbdd[_0xddba('0x3a')]);_0x4ca125[_0xddba('0x3c')]=_['intersection'](_0x4ca125['model'],_0x4ca125[_0xddba('0x3a')]);_0x13e5e7[_0xddba('0x3e')]=_[_0xddba('0x3d')](_0x4ca125[_0xddba('0x39')],qs['fields'](_0xdedbdd['query'][_0xddba('0x3f')]));_0x13e5e7[_0xddba('0x3e')]=_0x13e5e7[_0xddba('0x3e')][_0xddba('0x40')]?_0x13e5e7[_0xddba('0x3e')]:_0x4ca125[_0xddba('0x39')];if(!_0xdedbdd[_0xddba('0x3a')][_0xddba('0x41')](_0xddba('0xba'))){_0x13e5e7[_0xddba('0x42')]=qs[_0xddba('0x42')](_0xdedbdd[_0xddba('0x3a')][_0xddba('0x42')]);_0x13e5e7['offset']=qs[_0xddba('0x20')](_0xdedbdd[_0xddba('0x3a')][_0xddba('0x20')]);}_0x13e5e7['order']=qs[_0xddba('0xbb')](_0xdedbdd[_0xddba('0x3a')]['sort']);_0x13e5e7[_0xddba('0x44')]=qs['filters'](_[_0xddba('0x45')](_0xdedbdd['query'],_0x4ca125['filters']));_0x13e5e7[_0xddba('0x44')]['WhatsappInteractionId']=_0x11ea64['id'];if(_0xdedbdd[_0xddba('0x3a')]['filter']){_0x13e5e7[_0xddba('0x44')]=_[_0xddba('0x98')](_0x13e5e7[_0xddba('0x44')],{'$or':_['map'](_0x13e5e7[_0xddba('0x3e')],function(_0x305d5e){var _0x70e13d={};_0x70e13d[_0x305d5e]={'$like':'%'+_0xdedbdd[_0xddba('0x3a')][_0xddba('0x82')]+'%'};return _0x70e13d;})});}if(_0xdedbdd[_0xddba('0x3a')][_0xddba('0x77')]){var _0x23d05f=_0xdedbdd[_0xddba('0x3a')][_0xddba('0x77')][_0xddba('0x31')](',');var _0x11e436={};_0x11e436[_0x23d05f[0x0]]={'$gte':moment(_0x23d05f[0x1])[_0xddba('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13e5e7[_0xddba('0x44')]=_['merge'](_0x13e5e7[_0xddba('0x44')],_0x11e436);}_0x13e5e7=_[_0xddba('0x98')]({},_0x13e5e7,_0xdedbdd[_0xddba('0xb3')]);return db[_0xddba('0xb6')][_0xddba('0x22')]({'where':_0x13e5e7[_0xddba('0x44')]})[_0xddba('0x29')](function(_0x2c9ecc){_0x419faa['count']=_0x2c9ecc;if(_0xdedbdd[_0xddba('0x3a')][_0xddba('0xb1')]){_0x13e5e7['include']=[{'all':!![]}];}return db[_0xddba('0xb6')][_0xddba('0xbd')](_0x13e5e7);})[_0xddba('0x29')](function(_0xae87c3){_0x419faa['rows']=_0xae87c3;return _0x419faa;});}})[_0xddba('0x29')](respondWithFilteredResult(_0x4b5d55,_0x13e5e7))[_0xddba('0x33')](handleError(_0x4b5d55,null));};exports['addTags']=function(_0x1a9d82,_0x596408,_0xd35049){return db[_0xddba('0x99')]['find']({'where':{'id':_0x1a9d82[_0xddba('0xb0')]['id']}})[_0xddba('0x29')](handleEntityNotFound(_0x596408,null))[_0xddba('0x29')](function(_0x5ea44d){if(_0x5ea44d){return _0x5ea44d[_0xddba('0xbe')](_0x1a9d82[_0xddba('0x70')][_0xddba('0xb7')],_[_0xddba('0xbf')](_0x1a9d82[_0xddba('0x70')],['ids','id'])||{})[_0xddba('0xc0')](function(){return db['Tag']['findAll']({'attributes':['id',_0xddba('0x2c'),_0xddba('0x47')],'where':{'id':_0x1a9d82['body'][_0xddba('0xb7')]}});})[_0xddba('0x29')](function(_0x57afc4){socket['emit'](_0xddba('0xc1'),{'id':Number(_0x1a9d82['params']['id']),'tags':_0x57afc4||[]});return{'id':Number(_0x1a9d82['params']['id']),'tags':_0x57afc4||[]};});}})[_0xddba('0x29')](respondWithResult(_0x596408,null))[_0xddba('0x33')](handleError(_0x596408,null));};exports[_0xddba('0xc2')]=function(_0x68560e,_0x5bcb25,_0x4b30bd){return db[_0xddba('0x99')]['find']({'where':{'id':_0x68560e[_0xddba('0xb0')]['id']}})['then'](handleEntityNotFound(_0x5bcb25,null))['then'](function(_0x2603a6){if(_0x2603a6){return _0x2603a6['removeTags'](_0x68560e[_0xddba('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x5bcb25,null))[_0xddba('0x33')](handleError(_0x5bcb25,null));};exports[_0xddba('0xc3')]=function(_0x1d9594,_0xc674a5){var _0x4082e8=moment()['unix']()[_0xddba('0x97')]();var _0x29c674=path[_0xddba('0xc4')](config[_0xddba('0xc5')],'server',_0xddba('0xc6'),_0xddba('0xc7'));var _0x5a6ff8=path[_0xddba('0xc4')](config[_0xddba('0xc5')],_0xddba('0xc8'),_0xddba('0xc6'),_0xddba('0xc9'));var _0x365813=path[_0xddba('0xc4')](_0x29c674,_0x4082e8);var _0x191641=util[_0xddba('0xbc')](_0xddba('0xca'),_0x1d9594['params']['id'],_0x4082e8);var _0x32531b=path[_0xddba('0xc4')](_0x29c674,_0x191641);var _0x3f7713=[];_0x3f7713[_0xddba('0xae')]({'model':db[_0xddba('0x6e')],'as':_0xddba('0x6e'),'attributes':['id',_0xddba('0xcb')],'raw':!![]});_0x3f7713[_0xddba('0xae')]({'model':db[_0xddba('0xcc')],'as':_0xddba('0x63'),'attributes':['id','firstName',_0xddba('0xcd')],'raw':!![]});if(_0x1d9594[_0xddba('0x3a')]['attachments']){_0x3f7713['push']({'model':db[_0xddba('0xce')],'as':'Attachment','raw':!![]});}var _0x23cd91=[{'model':db['WhatsappMessage'],'as':_0xddba('0xcf'),'attributes':['id',_0xddba('0x70'),_0xddba('0x76'),'direction',_0xddba('0xd0'),'read'],'include':_0x3f7713}];_0x23cd91[_0xddba('0xae')]({'model':db[_0xddba('0xd1')],'as':_0xddba('0xd2'),'attributes':['id',_0xddba('0x2c')]});_0x23cd91['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xddba('0xcb')]});return db[_0xddba('0x99')][_0xddba('0x5d')]({'where':{'id':_0x1d9594[_0xddba('0xb0')]['id']},'include':_0x23cd91})[_0xddba('0x29')](handleEntityNotFound(_0xc674a5,null))['then'](function(_0x438a2c){if(_0x438a2c){var _0x4a2ef5=_0x438a2c[_0xddba('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x365813);var _0xcf70={'channel':'Whatsapp','account':_0x4a2ef5[_0xddba('0xd2')][_0xddba('0x2c')],'agent':_0x4a2ef5['Owner']?_0x4a2ef5[_0xddba('0xd4')][_0xddba('0xcb')]:_0xddba('0xd5'),'createdAt':moment(_0x4a2ef5[_0xddba('0x76')])[_0xddba('0xbc')](_0xddba('0xd6'))[_0xddba('0x97')](),'closedAt':_0x4a2ef5[_0xddba('0xd7')]?moment(_0x4a2ef5[_0xddba('0xd8')])[_0xddba('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x4a2ef5[_0xddba('0xd9')],'messages':_(_0x4a2ef5['Messages'])['filter']({'secret':![]})[_0xddba('0x2f')](function(_0x2e8da5){if(_0x2e8da5[_0xddba('0xce')]){var _0x1d3e2e=path[_0xddba('0xc4')](_0x5a6ff8,_0x2e8da5[_0xddba('0xce')][_0xddba('0xda')]);if(fs[_0xddba('0xdb')](_0x1d3e2e)){fs['createReadStream'](_0x1d3e2e)[_0xddba('0xdc')](fs[_0xddba('0xdd')](path[_0xddba('0xc4')](_0x365813,_0x2e8da5['Attachment']['basename'])));}}return{'date':moment(_0x2e8da5[_0xddba('0x76')])[_0xddba('0xbc')](_0xddba('0xd6'))[_0xddba('0x97')](),'sender':_0x2e8da5[_0xddba('0xde')]===_0xddba('0xdf')?_0x2e8da5[_0xddba('0x6e')]?_0x2e8da5[_0xddba('0x6e')][_0xddba('0xcb')]:_0xddba('0xe0'):_0x2e8da5[_0xddba('0x63')][_0xddba('0xe1')]+(_0x2e8da5[_0xddba('0x63')][_0xddba('0xcd')]?'\x20'+_0x2e8da5[_0xddba('0x63')][_0xddba('0xcd')]:''),'body':_0x2e8da5[_0xddba('0xce')]?_0x2e8da5[_0xddba('0xce')][_0xddba('0xda')]:_0x2e8da5[_0xddba('0x70')],'direction':_0x2e8da5[_0xddba('0xde')]===_0xddba('0xdf')?'A':'C','secret':_0x2e8da5[_0xddba('0xd0')],'read':_0x2e8da5[_0xddba('0x7e')],'attachment':_0x2e8da5[_0xddba('0xce')]};})[_0xddba('0x5f')]()};return ejs['renderFile'](path[_0xddba('0xc4')](config[_0xddba('0xc5')],'server',_0xddba('0xe2'),_0xddba('0xe3')),{'interaction':_0xcf70})[_0xddba('0x29')](function(_0x2ae25e){var _0x14ccdb=path['join'](_0x365813,_0xddba('0xe4')+_0x4a2ef5['id']+'-'+_0x4082e8+_0xddba('0xe5'));var _0x5de125={'path':_0x14ccdb,'channel':'Whatsapp','interactionId':_0x4a2ef5['id']};return pdf[_0xddba('0xe6')](_0x2ae25e,_0x5de125);})[_0xddba('0x29')](function(){return new BPromise(function(_0x1149a5,_0x62f15e){zipdir(_0x365813,{'saveTo':_0x32531b},function(_0x369921,_0x43840e){if(_0x369921)return _0x62f15e(_0x369921);return _0x1149a5(_0x43840e);});})[_0xddba('0x29')](function(){return new BPromise(function(_0x200812,_0x5e9de9){rimraf(_0x365813,function(_0x21e961){if(_0x21e961)_0x5e9de9(_0x21e961);return _0x200812();});});})[_0xddba('0x29')](function(){return _0xc674a5[_0xddba('0xc3')](_0x32531b,_0x191641,function(_0x632556){if(_0x632556){console[_0xddba('0xe7')]('err',_0x632556);}else{fs[_0xddba('0xe8')](_0x32531b);}});});});}else{return _0xc674a5[_0xddba('0x1d')](0xc8);}})[_0xddba('0x33')](handleError(_0xc674a5,null));}; \ No newline at end of file +var _0xb2b3=['parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','WhatsappInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','rows','show','includeAll','include','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','spread','findAll','color','emit','removeTags','unix','join','server','files','tmp','root','attachments','CmContact','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Whatsapp','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','direction','out','System','views','downloadInteraction.ejs','transcript-','.pdf','download','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','stack','name','send','fullname','TagIds','Tags','split','push','catch','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','select','field','from','u.id','user_has_whatsapp_interactions','users','whatsapp_interactions','left_join','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','getFullTextValue','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2b3,0x71));var _0x3b2b=function(_0x50f78b,_0x28e4af){_0x50f78b=_0x50f78b-0x0;var _0x1bf01a=_0xb2b3[_0x50f78b];return _0x1bf01a;};'use strict';var emlformat=require(_0x3b2b('0x0'));var rimraf=require(_0x3b2b('0x1'));var zipdir=require(_0x3b2b('0x2'));var jsonpatch=require(_0x3b2b('0x3'));var rp=require(_0x3b2b('0x4'));var moment=require(_0x3b2b('0x5'));var BPromise=require(_0x3b2b('0x6'));var Mustache=require('mustache');var util=require(_0x3b2b('0x7'));var path=require(_0x3b2b('0x8'));var sox=require(_0x3b2b('0x9'));var csv=require(_0x3b2b('0xa'));var ejs=require(_0x3b2b('0xb'));var fs=require('fs');var fs_extra=require(_0x3b2b('0xc'));var _=require(_0x3b2b('0xd'));var squel=require(_0x3b2b('0xe'));var crypto=require(_0x3b2b('0xf'));var jsforce=require(_0x3b2b('0x10'));var deskjs=require(_0x3b2b('0x11'));var toCsv=require(_0x3b2b('0xa'));var querystring=require('querystring');var Papa=require(_0x3b2b('0x12'));var Redis=require(_0x3b2b('0x13'));var authService=require(_0x3b2b('0x14'));var qs=require(_0x3b2b('0x15'));var as=require(_0x3b2b('0x16'));var pdf=require(_0x3b2b('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3b2b('0x18'));var utils=require(_0x3b2b('0x19'));var config=require(_0x3b2b('0x1a'));var licenseUtil=require(_0x3b2b('0x1b'));var db=require('../../mysqldb')['db'];config[_0x3b2b('0x1c')]=_[_0x3b2b('0x1d')](config[_0x3b2b('0x1c')],{'host':_0x3b2b('0x1e'),'port':0x18eb});var socket=require(_0x3b2b('0x1f'))(new Redis(config[_0x3b2b('0x1c')]));require('./whatsappInteraction.socket')[_0x3b2b('0x20')](socket);function respondWithStatusCode(_0x1787cc,_0x5130fd){_0x5130fd=_0x5130fd||0xcc;return function(_0x3224ec){if(_0x3224ec){return _0x1787cc[_0x3b2b('0x21')](_0x5130fd);}return _0x1787cc[_0x3b2b('0x22')](_0x5130fd)['end']();};}function respondWithResult(_0x2ab175,_0x4d17c5){_0x4d17c5=_0x4d17c5||0xc8;return function(_0x21743d){if(_0x21743d){return _0x2ab175[_0x3b2b('0x22')](_0x4d17c5)['json'](_0x21743d);}};}function respondWithFilteredResult(_0x4a04e4,_0x1a3bfb){return function(_0x52bba5){if(_0x52bba5){var _0x157155=typeof _0x1a3bfb[_0x3b2b('0x23')]==='undefined'&&typeof _0x1a3bfb[_0x3b2b('0x24')]==='undefined';var _0x26f83=_0x52bba5[_0x3b2b('0x25')];var _0x56e2f4=_0x157155?0x0:_0x1a3bfb['offset'];var _0x1d786b=_0x157155?_0x52bba5[_0x3b2b('0x25')]:_0x1a3bfb[_0x3b2b('0x23')]+_0x1a3bfb[_0x3b2b('0x24')];var _0x3ad0b1;if(_0x1d786b>=_0x26f83){_0x1d786b=_0x26f83;_0x3ad0b1=0xc8;}else{_0x3ad0b1=0xce;}_0x4a04e4[_0x3b2b('0x22')](_0x3ad0b1);return _0x4a04e4[_0x3b2b('0x26')](_0x3b2b('0x27'),_0x56e2f4+'-'+_0x1d786b+'/'+_0x26f83)[_0x3b2b('0x28')](_0x52bba5);}return null;};}function patchUpdates(_0x36a9d2){return function(_0x18a8b8){try{jsonpatch['apply'](_0x18a8b8,_0x36a9d2,!![]);}catch(_0x20c1bc){return BPromise[_0x3b2b('0x29')](_0x20c1bc);}return _0x18a8b8[_0x3b2b('0x2a')]();};}function saveUpdates(_0x50e95c,_0x306739){return function(_0x5ef8cf){if(_0x5ef8cf){return _0x5ef8cf[_0x3b2b('0x2b')](_0x50e95c)['then'](function(_0x3ec4f0){return _0x3ec4f0;});}return null;};}function removeEntity(_0x5df93e,_0x52da06){return function(_0x399d72){if(_0x399d72){return _0x399d72[_0x3b2b('0x2c')]()[_0x3b2b('0x2d')](function(){_0x5df93e[_0x3b2b('0x22')](0xcc)[_0x3b2b('0x2e')]();});}};}function handleEntityNotFound(_0x156a3c,_0x30574a){return function(_0x185830){if(!_0x185830){_0x156a3c[_0x3b2b('0x21')](0x194);}return _0x185830;};}function handleError(_0x4f79ac,_0x4ed952){_0x4ed952=_0x4ed952||0x1f4;return function(_0x4fc420){logger['error'](_0x4fc420[_0x3b2b('0x2f')]);if(_0x4fc420[_0x3b2b('0x30')]){delete _0x4fc420[_0x3b2b('0x30')];}_0x4f79ac[_0x3b2b('0x22')](_0x4ed952)[_0x3b2b('0x31')](_0x4fc420);};}function getInteractionUsers(_0x34fc22,_0x3acb5b){return new BPromise(function(_0x4fe900,_0x2351db){try{if(_0x3acb5b[_0x34fc22['id']]){_0x34fc22['Users']=_['map'](_0x3acb5b[_0x34fc22['id']],function(_0x196157){return{'id':_0x196157['id'],'fullname':_0x196157[_0x3b2b('0x32')]};});}}catch(_0x281f1a){_0x2351db(_0x281f1a);}_0x4fe900(_0x34fc22);});}function getInteractionTags(_0x107285,_0x5040e2){return new BPromise(function(_0x5f32d0,_0x2e63c1){try{if(_0x107285[_0x3b2b('0x33')]){_0x107285[_0x3b2b('0x34')]=[];_0x107285[_0x3b2b('0x33')][_0x3b2b('0x35')](',')['forEach'](function(_0x208b9f){_0x107285['Tags'][_0x3b2b('0x36')](_0x5040e2[_0x208b9f]);});}delete _0x107285[_0x3b2b('0x33')];}catch(_0x134e84){_0x2e63c1(_0x134e84);}_0x5f32d0(_0x107285);});}function updateWhatsappInteraction(_0x36d69a,_0xca0678,_0x3fd26f){return new BPromise(function(_0x340f97,_0x2a9db0){return getInteractionUsers(_0x36d69a,_0x3fd26f)['then'](function(_0x5598af){return getInteractionTags(_0x5598af,_0xca0678);})[_0x3b2b('0x2d')](function(_0x4e603a){_0x340f97(_0x4e603a);})[_0x3b2b('0x37')](function(_0x2696b1){_0x2a9db0(_0x2696b1);});});}exports[_0x3b2b('0x38')]=function(_0x2cf03a,_0x100ba5){var _0xfd7335={},_0xcc9441={},_0x431777={'count':0x0,'rows':[]};var _0x41b2af=_[_0x3b2b('0x39')](db['WhatsappInteraction'][_0x3b2b('0x3a')],function(_0x26c013){return{'name':_0x26c013[_0x3b2b('0x3b')],'type':_0x26c013[_0x3b2b('0x3c')][_0x3b2b('0x3d')]};});_0xcc9441[_0x3b2b('0x3e')]=_[_0x3b2b('0x39')](_0x41b2af,_0x3b2b('0x30'));_0xcc9441[_0x3b2b('0x3f')]=_[_0x3b2b('0x40')](_0x2cf03a[_0x3b2b('0x3f')]);_0xcc9441[_0x3b2b('0x41')]=_[_0x3b2b('0x42')](_0xcc9441[_0x3b2b('0x3e')],_0xcc9441['query']);_0xfd7335[_0x3b2b('0x43')]=_[_0x3b2b('0x42')](_0xcc9441[_0x3b2b('0x3e')],qs[_0x3b2b('0x44')](_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x44')]));_0xfd7335[_0x3b2b('0x43')]=_0xfd7335['attributes']['length']?_0xfd7335[_0x3b2b('0x43')]:_0xcc9441['model'];if(!_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x45')](_0x3b2b('0x46'))){_0xfd7335[_0x3b2b('0x24')]=qs[_0x3b2b('0x24')](_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x24')]);_0xfd7335[_0x3b2b('0x23')]=qs['offset'](_0x2cf03a['query']['offset']);}_0xfd7335[_0x3b2b('0x47')]=qs[_0x3b2b('0x48')](_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x48')]);_0xfd7335[_0x3b2b('0x49')]=qs[_0x3b2b('0x41')](_['pick'](_0x2cf03a[_0x3b2b('0x3f')],_0xcc9441['filters']),_0x41b2af);var _0x1462a0=[];var _0xece0c7=squel[_0x3b2b('0x4a')]()[_0x3b2b('0x4b')]('id')[_0x3b2b('0x4b')]('name')[_0x3b2b('0x4b')]('color')[_0x3b2b('0x4c')]('tools_tags');var _0xede34=squel[_0x3b2b('0x4a')]()[_0x3b2b('0x4b')](_0x3b2b('0x4d'))['field']('u.fullname')[_0x3b2b('0x4b')]('ui.WhatsappInteractionId')[_0x3b2b('0x4c')](_0x3b2b('0x4e'),'ui')['left_join'](_0x3b2b('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x3db4a4=squel[_0x3b2b('0x4a')]()[_0x3b2b('0x4c')](_0x3b2b('0x50'),'i')[_0x3b2b('0x51')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3b2b('0x51')](_0x3b2b('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x3b2b('0x51')](_0x3b2b('0x52'),'a',_0x3b2b('0x53'))[_0x3b2b('0x51')](_0x3b2b('0x54'),'me',_0x3b2b('0x55'))[_0x3b2b('0x51')](_0x3b2b('0x56'),'it',_0x3b2b('0x57'))[_0x3b2b('0x51')](_0x3b2b('0x58'),'t',_0x3b2b('0x59'));var _0x2573ef=squel['expr']();var _0x44087e=[];var _0x16e85a=squel[_0x3b2b('0x5a')]();var _0xc6d4c7;if(_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x5b')]){_0xc6d4c7=as[_0x3b2b('0x5c')](_0x2cf03a['query'][_0x3b2b('0x5b')]);var _0x32c5e2=_0xc6d4c7[_0x3b2b('0x5d')];for(var _0x2b2753=0x0;_0x2b2753<_0xc6d4c7[_0x3b2b('0x5e')][_0x3b2b('0x5f')];_0x2b2753++){var _0x1eb9a4=_0xc6d4c7[_0x3b2b('0x5e')][_0x2b2753];var _0x196404='i';var _0x77cddd=_[_0x3b2b('0x60')](_0x41b2af,[_0x3b2b('0x30'),_0x1eb9a4[_0x3b2b('0x4b')]]);if(!_0x77cddd){switch(_0x1eb9a4['field']){case _0x3b2b('0x61'):if(_0x1eb9a4[_0x3b2b('0x62')]==0x1){_0x3db4a4['having']('`'+_0x1eb9a4[_0x3b2b('0x4b')]+_0x3b2b('0x63'));}else{_0x3db4a4[_0x3b2b('0x64')]('`'+_0x1eb9a4[_0x3b2b('0x4b')]+_0x3b2b('0x65'));}break;case _0x3b2b('0x66'):if(_0x1eb9a4['operator']==='$substring'){if(_0x1eb9a4[_0x3b2b('0x62')][_0x3b2b('0x35')]('\x20')[_0x3b2b('0x5f')]>0x1){_0x2573ef[_0x32c5e2]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b2b('0x67')](_0x1eb9a4[_0x3b2b('0x62')]),null);}else{var _0x1a4987='%'+_0x1eb9a4[_0x3b2b('0x62')]+'%';_0x2573ef[_0x32c5e2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1a4987,_0x1a4987,_0x1a4987);}}else{_0x77cddd=_[_0x3b2b('0x60')](_0x41b2af,[_0x3b2b('0x30'),_0x3b2b('0x68')]);_0x1eb9a4[_0x3b2b('0x4b')]=_0x3b2b('0x68');_0x5e9fab=as[_0x3b2b('0x69')](_0x196404,_0x77cddd['type'],_0x1eb9a4);_0x2573ef[_0x32c5e2](_0x5e9fab[_0x3b2b('0x6a')],_0x5e9fab[_0x3b2b('0x62')]['start'],_0x5e9fab['value'][_0x3b2b('0x2e')]);}break;case _0x3b2b('0x6b'):var _0x2e63ae=_0x1eb9a4[_0x3b2b('0x62')][_0x3b2b('0x35')](',')[_0x3b2b('0x39')](function(_0x457df8){return Number(_0x457df8);});_0x2e63ae[_0x3b2b('0x6c')](function(_0xe98449){_0x16e85a['or'](_0x3b2b('0x6d'),'%,'+_0xe98449+',%');});_0x44087e=_['union'](_0x44087e,_0x2e63ae);break;case _0x3b2b('0x6e'):if(_0x1eb9a4['operator']===_0x3b2b('0x6f')){_0x2573ef[_0x32c5e2](_0x3b2b('0x70'),'%'+_0x1eb9a4['value']+'%',null);}else{_0x77cddd=_['find'](_0x41b2af,[_0x3b2b('0x30'),'UserId']);_0x1eb9a4['field']=_0x3b2b('0x71');_0x5e9fab=as['buildExpression'](_0x196404,_0x77cddd[_0x3b2b('0x3c')],_0x1eb9a4);_0x2573ef[_0x32c5e2](_0x5e9fab['text'],_0x5e9fab[_0x3b2b('0x62')][_0x3b2b('0x72')],_0x5e9fab[_0x3b2b('0x62')][_0x3b2b('0x2e')]);}break;case'body':_0x5e9fab=as['buildExpression']('me',null,_0x1eb9a4);_0x2573ef[_0x32c5e2](_0x5e9fab[_0x3b2b('0x6a')],_0x5e9fab[_0x3b2b('0x62')]['start'],_0x5e9fab[_0x3b2b('0x62')][_0x3b2b('0x2e')]);break;}}else{var _0x5e9fab=as[_0x3b2b('0x69')](_0x196404,_0x77cddd[_0x3b2b('0x3c')],_0x1eb9a4);_0x2573ef[_0x32c5e2](_0x5e9fab['text'],_0x5e9fab[_0x3b2b('0x62')][_0x3b2b('0x72')],_0x5e9fab[_0x3b2b('0x62')][_0x3b2b('0x2e')]);}}}else{var _0x4582ac=_(_0x2cf03a[_0x3b2b('0x3f')])[_0x3b2b('0x40')]()['map'](function(_0x363662){return _[_0x3b2b('0x73')](_0x41b2af,['name',_0x363662])?_0x363662:undefined;})['compact']()[_0x3b2b('0x62')]();if(!_['isEmpty'](_0x4582ac)){_0x4582ac[_0x3b2b('0x6c')](function(_0x191c6c){if(_0x191c6c===_0x3b2b('0x74')){_0x3db4a4[_0x3b2b('0x49')](_0x3b2b('0x75'),[][_0x3b2b('0x76')](_0x2cf03a[_0x3b2b('0x3f')][_0x191c6c]));}else if(_0x191c6c===_0x3b2b('0x77')){var _0x427a16=JSON[_0x3b2b('0x78')](_0x2cf03a[_0x3b2b('0x3f')][_0x191c6c])['$gte'];var _0x14eeac=JSON[_0x3b2b('0x78')](_0x2cf03a[_0x3b2b('0x3f')][_0x191c6c])[_0x3b2b('0x79')];_0x3db4a4[_0x3b2b('0x49')](_0x3b2b('0x7a'),_0x427a16,_0x14eeac);}else{if(_0x2cf03a[_0x3b2b('0x3f')][_0x191c6c]==='null'){_0x3db4a4[_0x3b2b('0x49')]('i.'+_0x191c6c+_0x3b2b('0x7b'));}else{_0x3db4a4['where']('i.'+_0x191c6c+_0x3b2b('0x7c'),_0x2cf03a[_0x3b2b('0x3f')][_0x191c6c]);}}});}if(_0x2cf03a['query'][_0x3b2b('0x7d')]){if(_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x7d')]==0x1){_0x3db4a4['having'](_0x3b2b('0x7e'));}else{_0x3db4a4[_0x3b2b('0x64')](_0x3b2b('0x7f'));}}if(_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x80')]){_0x44087e=_[_0x3b2b('0x81')](_0x2cf03a['query'][_0x3b2b('0x80')])?_0x2cf03a[_0x3b2b('0x3f')]['tag']:new Array(_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x80')]);_0x44087e[_0x3b2b('0x6c')](function(_0x3a8317){_0x16e85a['or'](_0x3b2b('0x6d'),'%,'+_0x3a8317+',%');});}if(_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x82')]){var _0x13c8a3=_0x2cf03a[_0x3b2b('0x3f')]['filter'][_0x3b2b('0x83')]('\x5c','\x5c\x5c')[_0x3b2b('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x13c8a3)){_0x2573ef['or']('i.id\x20LIKE\x20?',_0x13c8a3+'%')['or'](_0x3b2b('0x84'),_0x13c8a3+'%');}else{_0x2573ef['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3b2b('0x67')](_0x13c8a3))['or'](_0x3b2b('0x85'),_0x13c8a3+'%');}}}_0x3db4a4['where'](_0x2573ef);_0x3db4a4[_0x3b2b('0x86')](_0x3b2b('0x87'));var _0x5094c9={'type':db[_0x3b2b('0x88')][_0x3b2b('0x89')][_0x3b2b('0x8a')],'raw':!![]};var _0x4da778=_0x3db4a4['clone']();_0x4da778[_0x3b2b('0x4b')](_0x3b2b('0x87'));_0x4da778[_0x3b2b('0x4b')](_0x3b2b('0x8b'),_0x3b2b('0x61'));if(_0xfd7335['order']){_0xfd7335[_0x3b2b('0x47')]['forEach'](function(_0x23a911){var _0x3e3f52=_0x23a911[0x0]==='contactName'?_0x23a911[0x0]:'i.'+_0x23a911[0x0];_0x3db4a4[_0x3b2b('0x47')](_0x3e3f52,_0x23a911[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3b2b('0x8c')](_0x44087e)){_0x3db4a4[_0x3b2b('0x64')](_0x16e85a);_0x4da778[_0x3b2b('0x49')](_0x3b2b('0x8d'),_0x44087e);}BPromise[_0x3b2b('0x8e')]()[_0x3b2b('0x2d')](function(){if(!_0xc6d4c7){if(_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x74')])return;_0x4da778[_0x3b2b('0x49')](_0x3b2b('0x8f'));_0x3db4a4[_0x3b2b('0x49')](_0x3b2b('0x8f'));return;}if(_0x2cf03a['user'][_0x3b2b('0x90')]!=='agent')return;return _0x2cf03a[_0x3b2b('0x91')][_0x3b2b('0x92')]({'attributes':['id'],'raw':!![]})[_0x3b2b('0x2d')](function(_0x16cdbe){if(_[_0x3b2b('0x8c')](_0x16cdbe)){_0x4da778[_0x3b2b('0x49')](_0x3b2b('0x93'));_0x3db4a4[_0x3b2b('0x49')](_0x3b2b('0x93'));}else{_0x4da778[_0x3b2b('0x49')](_0x3b2b('0x75'),_[_0x3b2b('0x39')](_0x16cdbe,'id'));_0x3db4a4['where'](_0x3b2b('0x75'),_[_0x3b2b('0x39')](_0x16cdbe,'id'));}});})[_0x3b2b('0x2d')](function(){if(_0x2cf03a[_0x3b2b('0x91')]['role']===_0x3b2b('0x94')&&!_0xc6d4c7&&!_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x74')])return[];return db[_0x3b2b('0x95')][_0x3b2b('0x3f')](_0x4da778[_0x3b2b('0x96')](),_0x5094c9);})['then'](function(_0x432c3e){_0x431777['count']=_0x432c3e[_0x3b2b('0x5f')];if(_0x431777[_0x3b2b('0x25')]===0x0)return[];return db[_0x3b2b('0x95')][_0x3b2b('0x3f')](_0xece0c7[_0x3b2b('0x96')](),_0x5094c9)[_0x3b2b('0x2d')](function(_0x18b995){_0x1462a0=_[_0x3b2b('0x97')](_0x18b995,'id');_0x5094c9=_[_0x3b2b('0x98')](_0x5094c9,{'model':db[_0x3b2b('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2cf03a[_0x3b2b('0x3f')][_0x3b2b('0x44')]){_0xfd7335['attributes'][_0x3b2b('0x6c')](function(_0x145b5e){_0x3db4a4[_0x3b2b('0x4b')]('i.'+_0x145b5e);});}else{_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0x8b'),_0x3b2b('0x61'));_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0x9a'),'Account.key');_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0x9b'),_0x3b2b('0x9c'));_0x3db4a4[_0x3b2b('0x4b')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0x9d'));_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0x9e'),'Contact.firstName');_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0x9f'),_0x3b2b('0xa0'));_0x3db4a4['field'](_0x3b2b('0xa1'),_0x3b2b('0xa2'));_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0xa3'),_0x3b2b('0xa4'));_0x3db4a4[_0x3b2b('0x4b')]('c.mobile',_0x3b2b('0xa5'));_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0xa6'),_0x3b2b('0xa7'));_0x3db4a4['field']('o.fullname',_0x3b2b('0xa8'));_0x3db4a4[_0x3b2b('0x4b')](_0x3b2b('0xa9'),_0x3b2b('0xaa'));_0x3db4a4['field'](_0x3b2b('0xab'),'TagIds');}if(_0xfd7335['limit'])_0x3db4a4[_0x3b2b('0x24')](_0xfd7335[_0x3b2b('0x24')]);if(_0xfd7335[_0x3b2b('0x23')])_0x3db4a4['offset'](_0xfd7335['offset']);return db[_0x3b2b('0x95')]['query'](_0x3db4a4['toString'](),_0x5094c9);})['then'](function(_0x16681f){if(_0x16681f['length']>0x0)_0xede34[_0x3b2b('0x49')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x3b2b('0x39')](_0x16681f,'id'));return db[_0x3b2b('0x95')][_0x3b2b('0x3f')](_0xede34[_0x3b2b('0x96')](),_0x5094c9)['then'](function(_0x29d9f0){var _0x2c856e=_[_0x3b2b('0xac')](_0x29d9f0,_0x3b2b('0xad'));var _0x1909cd=[];_0x16681f['forEach'](function(_0x50447d){_0x1909cd[_0x3b2b('0x36')](updateWhatsappInteraction(_0x50447d,_0x1462a0,_0x2c856e));});return BPromise['all'](_0x1909cd);});});})[_0x3b2b('0x2d')](function(_0x192650){_0x431777[_0x3b2b('0xae')]=_0x192650;return _0x431777;})[_0x3b2b('0x2d')](respondWithFilteredResult(_0x100ba5,_0xfd7335))[_0x3b2b('0x37')](handleError(_0x100ba5,null));};exports[_0x3b2b('0xaf')]=function(_0x1e884a,_0x4deb42){var _0x34ac3c={'raw':![],'where':{'id':_0x1e884a['params']['id']}},_0x5eb2a3={};_0x5eb2a3['model']=_[_0x3b2b('0x40')](db[_0x3b2b('0x99')][_0x3b2b('0x3a')]);_0x5eb2a3['query']=_[_0x3b2b('0x40')](_0x1e884a[_0x3b2b('0x3f')]);_0x5eb2a3[_0x3b2b('0x41')]=_[_0x3b2b('0x42')](_0x5eb2a3[_0x3b2b('0x3e')],_0x5eb2a3[_0x3b2b('0x3f')]);_0x34ac3c[_0x3b2b('0x43')]=_[_0x3b2b('0x42')](_0x5eb2a3['model'],qs['fields'](_0x1e884a['query'][_0x3b2b('0x44')]));_0x34ac3c['attributes']=_0x34ac3c[_0x3b2b('0x43')]['length']?_0x34ac3c[_0x3b2b('0x43')]:_0x5eb2a3[_0x3b2b('0x3e')];if(_0x1e884a[_0x3b2b('0x3f')][_0x3b2b('0xb0')]){_0x34ac3c[_0x3b2b('0xb1')]=[{'all':!![]}];}_0x34ac3c=_[_0x3b2b('0x98')]({},_0x34ac3c,_0x1e884a['options']);return db['WhatsappInteraction'][_0x3b2b('0x60')](_0x34ac3c)[_0x3b2b('0x2d')](handleEntityNotFound(_0x4deb42,null))[_0x3b2b('0x2d')](respondWithResult(_0x4deb42,null))[_0x3b2b('0x37')](handleError(_0x4deb42,null));};exports['create']=function(_0x4a040e,_0x3a0b9e){return db[_0x3b2b('0x99')][_0x3b2b('0xb2')](_0x4a040e[_0x3b2b('0xb3')],{})[_0x3b2b('0x2d')](respondWithResult(_0x3a0b9e,0xc9))[_0x3b2b('0x37')](handleError(_0x3a0b9e,null));};exports['update']=function(_0x46f284,_0x495003){if(_0x46f284[_0x3b2b('0xb3')]['id']){delete _0x46f284[_0x3b2b('0xb3')]['id'];}return db[_0x3b2b('0x99')]['find']({'where':{'id':_0x46f284['params']['id']}})['then'](handleEntityNotFound(_0x495003,null))[_0x3b2b('0x2d')](saveUpdates(_0x46f284[_0x3b2b('0xb3')],null))['then'](respondWithResult(_0x495003,null))[_0x3b2b('0x37')](handleError(_0x495003,null));};exports[_0x3b2b('0x2c')]=function(_0x16ce93,_0x106d78){return db['WhatsappInteraction'][_0x3b2b('0x60')]({'where':{'id':_0x16ce93[_0x3b2b('0xb4')]['id']}})[_0x3b2b('0x2d')](handleEntityNotFound(_0x106d78,null))[_0x3b2b('0x2d')](removeEntity(_0x106d78,null))[_0x3b2b('0x37')](handleError(_0x106d78,null));};exports[_0x3b2b('0xb5')]=function(_0x2bd94c,_0x195412){return db[_0x3b2b('0x99')][_0x3b2b('0xb5')]()[_0x3b2b('0x2d')](respondWithResult(_0x195412,null))[_0x3b2b('0x37')](handleError(_0x195412,null));};exports[_0x3b2b('0xb6')]=function(_0x1c28d5,_0x422061,_0x35bfb6){return db[_0x3b2b('0xb7')][_0x3b2b('0x60')]({'where':{'id':_0x1c28d5['params']['id']}})[_0x3b2b('0x2d')](handleEntityNotFound(_0x422061,null))[_0x3b2b('0x2d')](function(_0x8f2abf){if(_0x8f2abf){return _0x8f2abf[_0x3b2b('0xb6')](_0x1c28d5[_0x3b2b('0xb3')][_0x3b2b('0xb8')],_[_0x3b2b('0xb9')](_0x1c28d5[_0x3b2b('0xb3')],[_0x3b2b('0xb8'),'id'])||{});}})[_0x3b2b('0x2d')](respondWithResult(_0x422061,null))[_0x3b2b('0x37')](handleError(_0x422061,null));};exports[_0x3b2b('0xba')]=function(_0x291fb9,_0x18e867,_0x312b08){var _0x269eb0={'raw':![],'where':{}};var _0x24abfa={};var _0x498aaa={'count':0x0,'rows':[]};return db[_0x3b2b('0x99')][_0x3b2b('0xbb')]({'where':{'id':_0x291fb9['params']['id']}})[_0x3b2b('0x2d')](handleEntityNotFound(_0x18e867,null))[_0x3b2b('0x2d')](function(_0xa2161d){if(_0xa2161d){_0x24abfa[_0x3b2b('0x3e')]=_[_0x3b2b('0x40')](db['WhatsappMessage'][_0x3b2b('0x3a')]);_0x24abfa['query']=_['keys'](_0x291fb9['query']);_0x24abfa[_0x3b2b('0x41')]=_[_0x3b2b('0x42')](_0x24abfa[_0x3b2b('0x3e')],_0x24abfa[_0x3b2b('0x3f')]);_0x269eb0[_0x3b2b('0x43')]=_[_0x3b2b('0x42')](_0x24abfa[_0x3b2b('0x3e')],qs[_0x3b2b('0x44')](_0x291fb9[_0x3b2b('0x3f')][_0x3b2b('0x44')]));_0x269eb0[_0x3b2b('0x43')]=_0x269eb0[_0x3b2b('0x43')]['length']?_0x269eb0[_0x3b2b('0x43')]:_0x24abfa[_0x3b2b('0x3e')];if(!_0x291fb9[_0x3b2b('0x3f')][_0x3b2b('0x45')](_0x3b2b('0x46'))){_0x269eb0[_0x3b2b('0x24')]=qs[_0x3b2b('0x24')](_0x291fb9['query'][_0x3b2b('0x24')]);_0x269eb0['offset']=qs[_0x3b2b('0x23')](_0x291fb9[_0x3b2b('0x3f')]['offset']);}_0x269eb0[_0x3b2b('0x47')]=qs[_0x3b2b('0x48')](_0x291fb9[_0x3b2b('0x3f')][_0x3b2b('0x48')]);_0x269eb0[_0x3b2b('0x49')]=qs['filters'](_['pick'](_0x291fb9['query'],_0x24abfa['filters']));_0x269eb0[_0x3b2b('0x49')][_0x3b2b('0xad')]=_0xa2161d['id'];if(_0x291fb9[_0x3b2b('0x3f')][_0x3b2b('0x82')]){_0x269eb0[_0x3b2b('0x49')]=_[_0x3b2b('0x98')](_0x269eb0['where'],{'$or':_['map'](_0x269eb0[_0x3b2b('0x43')],function(_0x4b9c32){var _0x2888a3={};_0x2888a3[_0x4b9c32]={'$like':'%'+_0x291fb9[_0x3b2b('0x3f')]['filter']+'%'};return _0x2888a3;})});}if(_0x291fb9[_0x3b2b('0x3f')][_0x3b2b('0xbc')]){var _0xe0ce62=_0x291fb9['query'][_0x3b2b('0xbc')][_0x3b2b('0x35')](',');var _0x3ebcd9={};_0x3ebcd9[_0xe0ce62[0x0]]={'$gte':moment(_0xe0ce62[0x1])[_0x3b2b('0xbd')](_0x3b2b('0xbe'))};_0x269eb0['where']=_[_0x3b2b('0x98')](_0x269eb0['where'],_0x3ebcd9);}_0x269eb0=_['merge']({},_0x269eb0,_0x291fb9[_0x3b2b('0xbf')]);return db['WhatsappMessage'][_0x3b2b('0x25')]({'where':_0x269eb0[_0x3b2b('0x49')]})[_0x3b2b('0x2d')](function(_0x350a78){_0x498aaa[_0x3b2b('0x25')]=_0x350a78;if(_0x291fb9[_0x3b2b('0x3f')][_0x3b2b('0xb0')]){_0x269eb0[_0x3b2b('0xb1')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x269eb0);})[_0x3b2b('0x2d')](function(_0x346a0f){_0x498aaa[_0x3b2b('0xae')]=_0x346a0f;return _0x498aaa;});}})[_0x3b2b('0x2d')](respondWithFilteredResult(_0x18e867,_0x269eb0))[_0x3b2b('0x37')](handleError(_0x18e867,null));};exports[_0x3b2b('0xc0')]=function(_0x23eb6e,_0x63717c,_0x1e9901){return db['WhatsappInteraction'][_0x3b2b('0x60')]({'where':{'id':_0x23eb6e['params']['id']}})['then'](handleEntityNotFound(_0x63717c,null))[_0x3b2b('0x2d')](function(_0x2e94e2){if(_0x2e94e2){return _0x2e94e2['setTags'](_0x23eb6e[_0x3b2b('0xb3')][_0x3b2b('0xb8')],_[_0x3b2b('0xb9')](_0x23eb6e['body'],[_0x3b2b('0xb8'),'id'])||{})[_0x3b2b('0xc1')](function(){return db[_0x3b2b('0x6b')][_0x3b2b('0xc2')]({'attributes':['id',_0x3b2b('0x30'),_0x3b2b('0xc3')],'where':{'id':_0x23eb6e[_0x3b2b('0xb3')][_0x3b2b('0xb8')]}});})[_0x3b2b('0x2d')](function(_0x26875f){socket[_0x3b2b('0xc4')]('whatsappInteractionTags:save',{'id':Number(_0x23eb6e[_0x3b2b('0xb4')]['id']),'tags':_0x26875f||[]});return{'id':Number(_0x23eb6e['params']['id']),'tags':_0x26875f||[]};});}})[_0x3b2b('0x2d')](respondWithResult(_0x63717c,null))[_0x3b2b('0x37')](handleError(_0x63717c,null));};exports[_0x3b2b('0xc5')]=function(_0x39d626,_0x2f8b47,_0x5aa196){return db[_0x3b2b('0x99')]['find']({'where':{'id':_0x39d626['params']['id']}})[_0x3b2b('0x2d')](handleEntityNotFound(_0x2f8b47,null))[_0x3b2b('0x2d')](function(_0xc09832){if(_0xc09832){return _0xc09832[_0x3b2b('0xc5')](_0x39d626[_0x3b2b('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x2f8b47,null))[_0x3b2b('0x37')](handleError(_0x2f8b47,null));};exports['download']=function(_0x175ff3,_0x530e3f){var _0x57100b=moment()[_0x3b2b('0xc6')]()[_0x3b2b('0x96')]();var _0x5d21cc=path[_0x3b2b('0xc7')](config['root'],_0x3b2b('0xc8'),_0x3b2b('0xc9'),_0x3b2b('0xca'));var _0x18402b=path[_0x3b2b('0xc7')](config[_0x3b2b('0xcb')],_0x3b2b('0xc8'),_0x3b2b('0xc9'),_0x3b2b('0xcc'));var _0x17834a=path['join'](_0x5d21cc,_0x57100b);var _0xb57545=util['format']('transcript-%d-%s.zip',_0x175ff3[_0x3b2b('0xb4')]['id'],_0x57100b);var _0x21f583=path[_0x3b2b('0xc7')](_0x5d21cc,_0xb57545);var _0x436b14=[];_0x436b14[_0x3b2b('0x36')]({'model':db[_0x3b2b('0x6e')],'as':_0x3b2b('0x6e'),'attributes':['id',_0x3b2b('0x32')],'raw':!![]});_0x436b14[_0x3b2b('0x36')]({'model':db[_0x3b2b('0xcd')],'as':_0x3b2b('0x66'),'attributes':['id',_0x3b2b('0xce'),_0x3b2b('0xcf')],'raw':!![]});if(_0x175ff3['query'][_0x3b2b('0xcc')]){_0x436b14[_0x3b2b('0x36')]({'model':db[_0x3b2b('0xd0')],'as':_0x3b2b('0xd0'),'raw':!![]});}var _0x32787c=[{'model':db[_0x3b2b('0xb7')],'as':_0x3b2b('0xd1'),'attributes':['id',_0x3b2b('0xb3'),'createdAt','direction',_0x3b2b('0xd2'),_0x3b2b('0x7d')],'include':_0x436b14}];_0x32787c['push']({'model':db[_0x3b2b('0xd3')],'as':_0x3b2b('0xd4'),'attributes':['id',_0x3b2b('0x30')]});_0x32787c['push']({'model':db[_0x3b2b('0x6e')],'as':'Owner','attributes':['id',_0x3b2b('0x32')]});return db['WhatsappInteraction'][_0x3b2b('0x60')]({'where':{'id':_0x175ff3['params']['id']},'include':_0x32787c})[_0x3b2b('0x2d')](handleEntityNotFound(_0x530e3f,null))[_0x3b2b('0x2d')](function(_0x2c0d1e){if(_0x2c0d1e){var _0x38d000=_0x2c0d1e['get']({'plain':!![]});fs['mkdirSync'](_0x17834a);var _0x11bc7a={'channel':_0x3b2b('0xd5'),'account':_0x38d000[_0x3b2b('0xd4')][_0x3b2b('0x30')],'agent':_0x38d000[_0x3b2b('0xd6')]?_0x38d000[_0x3b2b('0xd6')][_0x3b2b('0x32')]:_0x3b2b('0xd7'),'createdAt':moment(_0x38d000[_0x3b2b('0x77')])['format'](_0x3b2b('0xbe'))[_0x3b2b('0x96')](),'closedAt':_0x38d000[_0x3b2b('0xd8')]?moment(_0x38d000[_0x3b2b('0xd9')])[_0x3b2b('0xbd')](_0x3b2b('0xbe'))[_0x3b2b('0x96')]():'','disposition':_0x38d000[_0x3b2b('0xda')],'messages':_(_0x38d000[_0x3b2b('0xd1')])['filter']({'secret':![]})['map'](function(_0x3e3354){if(_0x3e3354[_0x3b2b('0xd0')]){var _0x366f6d=path[_0x3b2b('0xc7')](_0x18402b,_0x3e3354['Attachment'][_0x3b2b('0xdb')]);if(fs[_0x3b2b('0xdc')](_0x366f6d)){fs['createReadStream'](_0x366f6d)[_0x3b2b('0xdd')](fs[_0x3b2b('0xde')](path[_0x3b2b('0xc7')](_0x17834a,_0x3e3354['Attachment'][_0x3b2b('0xdb')])));}}return{'date':moment(_0x3e3354[_0x3b2b('0x77')])[_0x3b2b('0xbd')](_0x3b2b('0xbe'))[_0x3b2b('0x96')](),'sender':_0x3e3354[_0x3b2b('0xdf')]===_0x3b2b('0xe0')?_0x3e3354[_0x3b2b('0x6e')]?_0x3e3354[_0x3b2b('0x6e')][_0x3b2b('0x32')]:_0x3b2b('0xe1'):_0x3e3354['Contact'][_0x3b2b('0xce')]+(_0x3e3354[_0x3b2b('0x66')][_0x3b2b('0xcf')]?'\x20'+_0x3e3354['Contact'][_0x3b2b('0xcf')]:''),'body':_0x3e3354['Attachment']?_0x3e3354['Attachment']['basename']:_0x3e3354[_0x3b2b('0xb3')],'direction':_0x3e3354[_0x3b2b('0xdf')]===_0x3b2b('0xe0')?'A':'C','secret':_0x3e3354[_0x3b2b('0xd2')],'read':_0x3e3354['read'],'attachment':_0x3e3354[_0x3b2b('0xd0')]};})['value']()};return ejs['renderFile'](path[_0x3b2b('0xc7')](config[_0x3b2b('0xcb')],_0x3b2b('0xc8'),_0x3b2b('0xe2'),_0x3b2b('0xe3')),{'interaction':_0x11bc7a})['then'](function(_0x43a07b){var _0xb1e335=path['join'](_0x17834a,_0x3b2b('0xe4')+_0x38d000['id']+'-'+_0x57100b+_0x3b2b('0xe5'));var _0x28de3d={'path':_0xb1e335,'channel':_0x3b2b('0xd5'),'interactionId':_0x38d000['id']};return pdf['createPdfFromHTML'](_0x43a07b,_0x28de3d);})[_0x3b2b('0x2d')](function(){return new BPromise(function(_0x29813e,_0x1c7915){zipdir(_0x17834a,{'saveTo':_0x21f583},function(_0x6310ff,_0xda69a8){if(_0x6310ff)return _0x1c7915(_0x6310ff);return _0x29813e(_0xda69a8);});})[_0x3b2b('0x2d')](function(){return new BPromise(function(_0x38dd66,_0x1d8911){rimraf(_0x17834a,function(_0x75e4ff){if(_0x75e4ff)_0x1d8911(_0x75e4ff);return _0x38dd66();});});})[_0x3b2b('0x2d')](function(){return _0x530e3f[_0x3b2b('0xe6')](_0x21f583,_0xb57545,function(_0x37af0c){if(_0x37af0c){console['log'](_0x3b2b('0xe7'),_0x37af0c);}else{fs[_0x3b2b('0xe8')](_0x21f583);}});});});}else{return _0x530e3f[_0x3b2b('0x21')](0xc8);}})[_0x3b2b('0x37')](handleError(_0x530e3f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5b75988..9ac85a6 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 _0x8ba2=['save','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0x259f4f,_0x15b277){var _0x5e7bd4=function(_0x4d8964){while(--_0x4d8964){_0x259f4f['push'](_0x259f4f['shift']());}};_0x5e7bd4(++_0x15b277);}(_0x8ba2,0x13f));var _0x28ba=function(_0x250cfb,_0x3b907f){_0x250cfb=_0x250cfb-0x0;var _0x45a9de=_0x8ba2[_0x250cfb];return _0x45a9de;};'use strict';var EventEmitter=require(_0x28ba('0x0'));var WhatsappInteraction=require(_0x28ba('0x1'))['db'][_0x28ba('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x28ba('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x28ba('0x4')](0x0);var events={'afterCreate':_0x28ba('0x5'),'afterUpdate':'update','afterDestroy':_0x28ba('0x6')};function emitEvent(_0x1d7725){return function(_0x10d57d,_0xe89367,_0x3d039d){_0x10d57d[_0x28ba('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5aa8bf){_0x10d57d[_0x28ba('0x8')](_0x28ba('0x9'),_0x5aa8bf['map'](function(_0x3d98c8){return{'id':_0x3d98c8['id']};}));return WhatsappMessage[_0x28ba('0xa')]({'where':{'WhatsappInteractionId':_0x10d57d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x28ba('0xb')](function(_0x3a9740){_0x10d57d[_0x28ba('0x8')](_0x28ba('0xc'),_0x3a9740[_0x28ba('0xd')]);WhatsappInteractionEvents[_0x28ba('0xe')](_0x1d7725+':'+_0x10d57d['id'],_0x10d57d);WhatsappInteractionEvents[_0x28ba('0xe')](_0x1d7725,_0x10d57d);_0x3d039d(null);})[_0x28ba('0xf')](_0x3d039d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x28ba('0x10')](e,emitEvent(event));}}module[_0x28ba('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x115a=['hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x115a,0x91));var _0xa115=function(_0x5a0e34,_0x54b497){_0x5a0e34=_0x5a0e34-0x0;var _0x3ae9ae=_0x115a[_0x5a0e34];return _0x3ae9ae;};'use strict';var EventEmitter=require(_0xa115('0x0'));var WhatsappInteraction=require(_0xa115('0x1'))['db'][_0xa115('0x2')];var WhatsappMessage=require(_0xa115('0x1'))['db'][_0xa115('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa115('0x4'),'afterUpdate':'update','afterDestroy':_0xa115('0x5')};function emitEvent(_0x217a8e){return function(_0x41bb3f,_0x40901a,_0x1ab6f9){_0x41bb3f[_0xa115('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2499eb){_0x41bb3f[_0xa115('0x7')](_0xa115('0x8'),_0x2499eb[_0xa115('0x9')](function(_0x2499fd){return{'id':_0x2499fd['id']};}));return WhatsappMessage[_0xa115('0xa')]({'where':{'WhatsappInteractionId':_0x41bb3f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa115('0xb')](function(_0xc66b44){_0x41bb3f[_0xa115('0x7')](_0xa115('0xc'),_0xc66b44[_0xa115('0xd')]);WhatsappInteractionEvents['emit'](_0x217a8e+':'+_0x41bb3f['id'],_0x41bb3f);WhatsappInteractionEvents[_0xa115('0xe')](_0x217a8e,_0x41bb3f);_0x1ab6f9(null);})[_0xa115('0xf')](_0x1ab6f9(null));};}for(var e in events){if(events[_0xa115('0x10')](e)){var event=events[e];WhatsappInteraction[_0xa115('0x11')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index a5d94dd..c009900 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 _0xb396=['rimraf','../../config/environment','./whatsappInteraction.attributes','define','changed','closed','closedAt','format','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x299f73,_0x3efc1f){var _0x4b200b=function(_0x2b2151){while(--_0x2b2151){_0x299f73['push'](_0x299f73['shift']());}};_0x4b200b(++_0x3efc1f);}(_0xb396,0x1e8));var _0x6b39=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb396[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6b39('0x0'));var util=require(_0x6b39('0x1'));var logger=require(_0x6b39('0x2'))(_0x6b39('0x3'));var moment=require('moment');var BPromise=require(_0x6b39('0x4'));var rp=require(_0x6b39('0x5'));var fs=require('fs');var path=require(_0x6b39('0x6'));var rimraf=require(_0x6b39('0x7'));var config=require(_0x6b39('0x8'));var attributes=require(_0x6b39('0x9'));module['exports']=function(_0x474aa8,_0x48fbca){return _0x474aa8[_0x6b39('0xa')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa5a6e0,_0x42d428,_0x3ea913){if(_0xa5a6e0[_0x6b39('0xb')](_0x6b39('0xc'))){_0xa5a6e0[_0x6b39('0xd')]=moment()[_0x6b39('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3ea913(null,_0xa5a6e0);}}});}; \ No newline at end of file +var _0xf6ca=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions'];(function(_0x5399bc,_0x43f9be){var _0x252367=function(_0x1a339f){while(--_0x1a339f){_0x5399bc['push'](_0x5399bc['shift']());}};_0x252367(++_0x43f9be);}(_0xf6ca,0xef));var _0xaf6c=function(_0x2d617f,_0x182066){_0x2d617f=_0x2d617f-0x0;var _0x38aa15=_0xf6ca[_0x2d617f];return _0x38aa15;};'use strict';var _=require(_0xaf6c('0x0'));var util=require('util');var logger=require(_0xaf6c('0x1'))(_0xaf6c('0x2'));var moment=require(_0xaf6c('0x3'));var BPromise=require(_0xaf6c('0x4'));var rp=require(_0xaf6c('0x5'));var fs=require('fs');var path=require(_0xaf6c('0x6'));var rimraf=require(_0xaf6c('0x7'));var config=require(_0xaf6c('0x8'));var attributes=require(_0xaf6c('0x9'));module[_0xaf6c('0xa')]=function(_0x1a3bde,_0x25269c){return _0x1a3bde[_0xaf6c('0xb')]('WhatsappInteraction',attributes,{'tableName':_0xaf6c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bc168,_0xef999c,_0xc9532c){if(_0x1bc168[_0xaf6c('0xd')](_0xaf6c('0xe'))){_0x1bc168[_0xaf6c('0xf')]=moment()[_0xaf6c('0x10')](_0xaf6c('0x11'));}_0xc9532c(null,_0x1bc168);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f5ac3f9..5dc74ca 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 _0x8dca=['limit','AddTagsToWhatsappInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where'];(function(_0x53a10e,_0x551de1){var _0x2af861=function(_0x541ffb){while(--_0x541ffb){_0x53a10e['push'](_0x53a10e['shift']());}};_0x2af861(++_0x551de1);}(_0x8dca,0x80));var _0xa8dc=function(_0x379f34,_0x36b269){_0x379f34=_0x379f34-0x0;var _0x567949=_0x8dca[_0x379f34];return _0x567949;};'use strict';var _=require(_0xa8dc('0x0'));var util=require(_0xa8dc('0x1'));var moment=require(_0xa8dc('0x2'));var BPromise=require(_0xa8dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8dc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8dc('0x5'));var logger=require('../../config/logger')(_0xa8dc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa8dc('0x7')]({'port':0x232a});config[_0xa8dc('0x8')]=_[_0xa8dc('0x9')](config['redis'],{'host':_0xa8dc('0xa'),'port':0x18eb});var socket=require(_0xa8dc('0xb'))(new Redis(config[_0xa8dc('0x8')]));require(_0xa8dc('0xc'))[_0xa8dc('0xd')](socket);function respondWithRpcPromise(_0x486044,_0x29498c,_0x50cb1b){return new BPromise(function(_0x308cd6,_0x14442a){return client[_0xa8dc('0xe')](_0x486044,_0x50cb1b)[_0xa8dc('0xf')](function(_0x5253dd){logger[_0xa8dc('0x10')](_0xa8dc('0x11'),_0x29498c,'request\x20sent');logger[_0xa8dc('0x12')](_0xa8dc('0x13'),_0x29498c,_0xa8dc('0x14'),JSON[_0xa8dc('0x15')](_0x5253dd));if(_0x5253dd[_0xa8dc('0x16')]){if(_0x5253dd[_0xa8dc('0x16')]['code']===0x1f4){logger['error'](_0xa8dc('0x11'),_0x29498c,_0x5253dd[_0xa8dc('0x16')]['message']);return _0x14442a(_0x5253dd[_0xa8dc('0x16')]['message']);}logger['error'](_0xa8dc('0x11'),_0x29498c,_0x5253dd[_0xa8dc('0x16')][_0xa8dc('0x17')]);return _0x308cd6(_0x5253dd[_0xa8dc('0x16')][_0xa8dc('0x17')]);}else{logger[_0xa8dc('0x10')](_0xa8dc('0x11'),_0x29498c,_0xa8dc('0x14'));_0x308cd6(_0x5253dd[_0xa8dc('0x18')][_0xa8dc('0x17')]);}})[_0xa8dc('0x19')](function(_0x1c66ed){logger['error'](_0xa8dc('0x11'),_0x29498c,_0x1c66ed);_0x14442a(_0x1c66ed);});});}exports[_0xa8dc('0x1a')]=function(_0x59db54){var _0x40a5bc=this;return new Promise(function(_0xab6cca,_0xa9ad02){return db[_0xa8dc('0x1b')][_0xa8dc('0x1c')](_0x59db54['body'],{'raw':_0x59db54[_0xa8dc('0x1d')]?_0x59db54[_0xa8dc('0x1d')][_0xa8dc('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59db54[_0xa8dc('0x1d')]?_0x59db54[_0xa8dc('0x1d')][_0xa8dc('0x1f')]||null:null,'attributes':_0x59db54[_0xa8dc('0x1d')]?_0x59db54[_0xa8dc('0x1d')]['attributes']||null:null,'limit':_0x59db54[_0xa8dc('0x1d')]?_0x59db54[_0xa8dc('0x1d')][_0xa8dc('0x20')]||null:null})[_0xa8dc('0xf')](function(_0x33b590){logger[_0xa8dc('0x10')]('UpdateWhatsappInteraction',_0x59db54);logger[_0xa8dc('0x12')](_0xa8dc('0x1a'),_0x59db54,JSON[_0xa8dc('0x15')](_0x33b590));_0xab6cca(_0x33b590);})['catch'](function(_0x24ac28){logger[_0xa8dc('0x16')](_0xa8dc('0x1a'),_0x24ac28['message'],_0x59db54);_0xa9ad02(_0x40a5bc[_0xa8dc('0x16')](0x1f4,_0x24ac28['message']));});});};exports[_0xa8dc('0x21')]=function(_0xb5f55f){return new Promise(function(_0xc5cd93,_0x41156b){return db[_0xa8dc('0x1b')][_0xa8dc('0x22')]({'where':_0xb5f55f['options']?_0xb5f55f[_0xa8dc('0x1d')][_0xa8dc('0x1f')]||null:null})[_0xa8dc('0xf')](function(_0x222607){if(_0x222607){return _0x222607[_0xa8dc('0x23')](_0xb5f55f[_0xa8dc('0x24')][_0xa8dc('0x25')],_[_0xa8dc('0x26')](_0xb5f55f[_0xa8dc('0x24')],[_0xa8dc('0x25'),'id'])||{});}})['spread'](function(_0x55692e){logger[_0xa8dc('0x10')](_0xa8dc('0x27'),_0xb5f55f);logger['debug']('AddTags',_0xb5f55f,JSON[_0xa8dc('0x15')](_0x55692e));_0xc5cd93(_0x55692e);})[_0xa8dc('0x19')](function(_0x30b304){logger['error']('AddTags',_0x30b304[_0xa8dc('0x17')],_0xb5f55f);_0x41156b(_this[_0xa8dc('0x16')](0x1f4,_0x30b304[_0xa8dc('0x17')]));});});}; \ No newline at end of file +var _0x517b=['options','raw','where','limit','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateWhatsappInteraction'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x517b,0x1ed));var _0xb517=function(_0xefe124,_0x4a446e){_0xefe124=_0xefe124-0x0;var _0x40d6cf=_0x517b[_0xefe124];return _0x40d6cf;};'use strict';var _=require(_0xb517('0x0'));var util=require(_0xb517('0x1'));var moment=require(_0xb517('0x2'));var BPromise=require(_0xb517('0x3'));var rs=require(_0xb517('0x4'));var fs=require('fs');var Redis=require(_0xb517('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb517('0x6'));var logger=require('../../config/logger')(_0xb517('0x7'));var config=require(_0xb517('0x8'));var jayson=require(_0xb517('0x9'));var client=jayson[_0xb517('0xa')][_0xb517('0xb')]({'port':0x232a});config[_0xb517('0xc')]=_[_0xb517('0xd')](config[_0xb517('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb517('0xc')]));require(_0xb517('0xe'))[_0xb517('0xf')](socket);function respondWithRpcPromise(_0x3f36d6,_0x1c67c4,_0x4c9045){return new BPromise(function(_0x2ab689,_0x2e0106){return client[_0xb517('0x10')](_0x3f36d6,_0x4c9045)[_0xb517('0x11')](function(_0x198405){logger[_0xb517('0x12')](_0xb517('0x13'),_0x1c67c4,_0xb517('0x14'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1c67c4,'request\x20sent',JSON[_0xb517('0x15')](_0x198405));if(_0x198405[_0xb517('0x16')]){if(_0x198405['error']['code']===0x1f4){logger[_0xb517('0x16')](_0xb517('0x13'),_0x1c67c4,_0x198405[_0xb517('0x16')][_0xb517('0x17')]);return _0x2e0106(_0x198405[_0xb517('0x16')]['message']);}logger[_0xb517('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x1c67c4,_0x198405[_0xb517('0x16')][_0xb517('0x17')]);return _0x2ab689(_0x198405[_0xb517('0x16')]['message']);}else{logger['info'](_0xb517('0x13'),_0x1c67c4,'request\x20sent');_0x2ab689(_0x198405[_0xb517('0x18')][_0xb517('0x17')]);}})[_0xb517('0x19')](function(_0x4c1c31){logger[_0xb517('0x16')](_0xb517('0x13'),_0x1c67c4,_0x4c1c31);_0x2e0106(_0x4c1c31);});});}exports[_0xb517('0x1a')]=function(_0x22b29b){var _0x4183c9=this;return new Promise(function(_0x18391a,_0x31b3f5){return db['WhatsappInteraction']['update'](_0x22b29b['body'],{'raw':_0x22b29b[_0xb517('0x1b')]?_0x22b29b[_0xb517('0x1b')][_0xb517('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22b29b['options']?_0x22b29b['options'][_0xb517('0x1d')]||null:null,'attributes':_0x22b29b[_0xb517('0x1b')]?_0x22b29b[_0xb517('0x1b')]['attributes']||null:null,'limit':_0x22b29b[_0xb517('0x1b')]?_0x22b29b[_0xb517('0x1b')][_0xb517('0x1e')]||null:null})[_0xb517('0x11')](function(_0xf394e1){logger[_0xb517('0x12')](_0xb517('0x1a'),_0x22b29b);logger[_0xb517('0x1f')](_0xb517('0x1a'),_0x22b29b,JSON[_0xb517('0x15')](_0xf394e1));_0x18391a(_0xf394e1);})[_0xb517('0x19')](function(_0x1fc283){logger[_0xb517('0x16')]('UpdateWhatsappInteraction',_0x1fc283[_0xb517('0x17')],_0x22b29b);_0x31b3f5(_0x4183c9[_0xb517('0x16')](0x1f4,_0x1fc283['message']));});});};exports[_0xb517('0x20')]=function(_0x517379){return new Promise(function(_0x29d7fe,_0x3c4680){return db[_0xb517('0x21')][_0xb517('0x22')]({'where':_0x517379[_0xb517('0x1b')]?_0x517379['options']['where']||null:null})['then'](function(_0x27a6da){if(_0x27a6da){return _0x27a6da[_0xb517('0x23')](_0x517379[_0xb517('0x24')][_0xb517('0x25')],_['omit'](_0x517379[_0xb517('0x24')],['ids','id'])||{});}})[_0xb517('0x26')](function(_0x591f47){logger[_0xb517('0x12')](_0xb517('0x27'),_0x517379);logger[_0xb517('0x1f')](_0xb517('0x27'),_0x517379,JSON[_0xb517('0x15')](_0x591f47));_0x29d7fe(_0x591f47);})['catch'](function(_0x5a1277){logger[_0xb517('0x16')](_0xb517('0x27'),_0x5a1277['message'],_0x517379);_0x3c4680(_this[_0xb517('0x16')](0x1f4,_0x5a1277[_0xb517('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index a838b38..8bbb74e 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 _0xb293=['save','remove','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x1be3fe,_0x2016c3){var _0x2c5162=function(_0x3a6531){while(--_0x3a6531){_0x1be3fe['push'](_0x1be3fe['shift']());}};_0x2c5162(++_0x2016c3);}(_0xb293,0xfc));var _0x3b29=function(_0x36cee6,_0x22c2fd){_0x36cee6=_0x36cee6-0x0;var _0x23c57e=_0xb293[_0x36cee6];return _0x23c57e;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x3b29('0x0'),_0x3b29('0x1'),'update'];function createListener(_0x485351,_0x28b373){return function(_0x4003ad){_0x28b373[_0x3b29('0x2')](_0x485351,_0x4003ad);};}function removeListener(_0x1409dd,_0x4beafc){return function(){WhatsappInteractionEvents[_0x3b29('0x3')](_0x1409dd,_0x4beafc);};}exports[_0x3b29('0x4')]=function(_0x5562d3){for(var _0x32ebf0=0x0,_0x34c0e2=events[_0x3b29('0x5')];_0x32ebf0<_0x34c0e2;_0x32ebf0++){var _0x409904=events[_0x32ebf0];var _0xfc27b3=createListener(_0x3b29('0x6')+_0x409904,_0x5562d3);WhatsappInteractionEvents['on'](_0x409904,_0xfc27b3);}}; \ No newline at end of file +var _0xa264=['removeListener','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0xa264,0xa4));var _0x4a26=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xa264[_0x38537f];return _0x141e23;};'use strict';var WhatsappInteractionEvents=require(_0x4a26('0x0'));var events=[_0x4a26('0x1'),_0x4a26('0x2'),'update'];function createListener(_0x3c5ddf,_0x597487){return function(_0x49273d){_0x597487[_0x4a26('0x3')](_0x3c5ddf,_0x49273d);};}function removeListener(_0x105764,_0x25b105){return function(){WhatsappInteractionEvents[_0x4a26('0x4')](_0x105764,_0x25b105);};}exports['register']=function(_0x3bca44){for(var _0x4ce536=0x0,_0xbdcc79=events['length'];_0x4ce536<_0xbdcc79;_0x4ce536++){var _0x57e9bd=events[_0x4ce536];var _0x37807e=createListener(_0x4a26('0x5')+_0x57e9bd,_0x3bca44);WhatsappInteractionEvents['on'](_0x57e9bd,_0x37807e);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b9d8246..2014bf3 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 _0xa191=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','path','express','Router','../../components/auth/service'];(function(_0x360584,_0x4d5cbc){var _0x3d18c3=function(_0x561aa7){while(--_0x561aa7){_0x360584['push'](_0x360584['shift']());}};_0x3d18c3(++_0x4d5cbc);}(_0xa191,0x1dc));var _0x1a19=function(_0x4b574b,_0x132efc){_0x4b574b=_0x4b574b-0x0;var _0x32cd68=_0xa191[_0x4b574b];return _0x32cd68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a19('0x0'));var timeout=require('connect-timeout');var express=require(_0x1a19('0x1'));var router=express[_0x1a19('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1a19('0x3'));var interaction=require(_0x1a19('0x4'));var config=require(_0x1a19('0x5'));var controller=require('./whatsappMessage.controller');router[_0x1a19('0x6')]('/',auth[_0x1a19('0x7')](),controller[_0x1a19('0x8')]);router[_0x1a19('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1a19('0x6')](_0x1a19('0x9'),auth[_0x1a19('0x7')](),controller[_0x1a19('0xa')]);router[_0x1a19('0xb')]('/',auth['isAuthenticated'](),interaction[_0x1a19('0xc')](_0x1a19('0xd'),'whatsappmessage:create'),controller[_0x1a19('0xe')]);router[_0x1a19('0xb')](_0x1a19('0xf'),controller[_0x1a19('0x10')]);router[_0x1a19('0x11')](_0x1a19('0x9'),auth[_0x1a19('0x7')](),controller[_0x1a19('0x12')]);router[_0x1a19('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x1a19('0x13')]);router[_0x1a19('0x11')](_0x1a19('0x14'),auth[_0x1a19('0x7')](),controller[_0x1a19('0x15')]);router[_0x1a19('0x16')](_0x1a19('0x9'),auth['isAuthenticated'](),controller[_0x1a19('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5e20=['put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status'];(function(_0x4216b5,_0x223a32){var _0x597f33=function(_0x3e0819){while(--_0x3e0819){_0x4216b5['push'](_0x4216b5['shift']());}};_0x597f33(++_0x223a32);}(_0x5e20,0xaa));var _0x05e2=function(_0x4be5a9,_0x4a188c){_0x4be5a9=_0x4be5a9-0x0;var _0x287ab4=_0x5e20[_0x4be5a9];return _0x287ab4;};'use strict';var multer=require(_0x05e2('0x0'));var util=require(_0x05e2('0x1'));var path=require(_0x05e2('0x2'));var timeout=require(_0x05e2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x05e2('0x4'));var auth=require(_0x05e2('0x5'));var interaction=require(_0x05e2('0x6'));var config=require(_0x05e2('0x7'));var controller=require(_0x05e2('0x8'));router[_0x05e2('0x9')]('/',auth[_0x05e2('0xa')](),controller[_0x05e2('0xb')]);router[_0x05e2('0x9')](_0x05e2('0xc'),auth[_0x05e2('0xa')](),controller[_0x05e2('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x05e2('0xe')]);router['post']('/',auth[_0x05e2('0xa')](),interaction[_0x05e2('0xf')](_0x05e2('0x10'),_0x05e2('0x11')),controller[_0x05e2('0x12')]);router[_0x05e2('0x13')](_0x05e2('0x14'),controller[_0x05e2('0x15')]);router[_0x05e2('0x16')](_0x05e2('0x17'),auth[_0x05e2('0xa')](),controller[_0x05e2('0x18')]);router['put'](_0x05e2('0x19'),auth[_0x05e2('0xa')](),controller[_0x05e2('0x1a')]);router[_0x05e2('0x16')](_0x05e2('0x1b'),auth['isAuthenticated'](),controller[_0x05e2('0x1c')]);router[_0x05e2('0x1d')](_0x05e2('0x17'),auth[_0x05e2('0xa')](),controller[_0x05e2('0x1e')]);module[_0x05e2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 0196585..c9e8cce 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 _0x6a93=['exports','TEXT','ENUM','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x136056,_0x1b9194){var _0x34252f=function(_0x31d6cb){while(--_0x31d6cb){_0x136056['push'](_0x136056['shift']());}};_0x34252f(++_0x1b9194);}(_0x6a93,0x1d7));var _0x36a9=function(_0x9a29e7,_0x57b3ba){_0x9a29e7=_0x9a29e7-0x0;var _0x423e0d=_0x6a93[_0x9a29e7];return _0x423e0d;};'use strict';var Sequelize=require(_0x36a9('0x0'));module[_0x36a9('0x1')]={'body':{'type':Sequelize[_0x36a9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x36a9('0x3')]('in',_0x36a9('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x36a9('0x5')](0xbe)},'phone':{'type':Sequelize[_0x36a9('0x5')]},'readAt':{'type':Sequelize[_0x36a9('0x6')]},'secret':{'type':Sequelize[_0x36a9('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x36a9('0x5')]},'providerResponse':{'type':Sequelize[_0x36a9('0x2')]}}; \ No newline at end of file +var _0x96b2=['TEXT','medium','ENUM','out','STRING','DATE','BOOLEAN','exports'];(function(_0x809144,_0x4e5c53){var _0x52244c=function(_0x34a042){while(--_0x34a042){_0x809144['push'](_0x809144['shift']());}};_0x52244c(++_0x4e5c53);}(_0x96b2,0x1cf));var _0x296b=function(_0x31170d,_0x3326a5){_0x31170d=_0x31170d-0x0;var _0x80ca68=_0x96b2[_0x31170d];return _0x80ca68;};'use strict';var Sequelize=require('sequelize');module[_0x296b('0x0')]={'body':{'type':Sequelize[_0x296b('0x1')](_0x296b('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x296b('0x3')]('in',_0x296b('0x4')),'defaultValue':_0x296b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x296b('0x5')]},'readAt':{'type':Sequelize[_0x296b('0x6')]},'secret':{'type':Sequelize[_0x296b('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x296b('0x5')]},'providerResponse':{'type':Sequelize[_0x296b('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 87fb3d3..d7a9449 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 _0x1da9=['interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','end','stack','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','findAll','params','include','find','create','body','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x3923a9,_0x1a55ee){var _0xa7b4f1=function(_0x5ec904){while(--_0x5ec904){_0x3923a9['push'](_0x3923a9['shift']());}};_0xa7b4f1(++_0x1a55ee);}(_0x1da9,0x141));var _0x91da=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x1da9[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x91da('0x0'));var rimraf=require(_0x91da('0x1'));var zipdir=require(_0x91da('0x2'));var jsonpatch=require(_0x91da('0x3'));var rp=require(_0x91da('0x4'));var moment=require(_0x91da('0x5'));var BPromise=require(_0x91da('0x6'));var Mustache=require(_0x91da('0x7'));var util=require(_0x91da('0x8'));var path=require(_0x91da('0x9'));var sox=require(_0x91da('0xa'));var csv=require(_0x91da('0xb'));var ejs=require(_0x91da('0xc'));var fs=require('fs');var fs_extra=require(_0x91da('0xd'));var _=require(_0x91da('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x91da('0xf'));var deskjs=require(_0x91da('0x10'));var toCsv=require(_0x91da('0xb'));var querystring=require('querystring');var Papa=require(_0x91da('0x11'));var Redis=require(_0x91da('0x12'));var authService=require(_0x91da('0x13'));var qs=require(_0x91da('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91da('0x15'));var logger=require(_0x91da('0x16'))('api');var utils=require(_0x91da('0x17'));var config=require(_0x91da('0x18'));var licenseUtil=require(_0x91da('0x19'));var db=require(_0x91da('0x1a'))['db'];config[_0x91da('0x1b')]=_[_0x91da('0x1c')](config[_0x91da('0x1b')],{'host':_0x91da('0x1d'),'port':0x18eb});var socket=require(_0x91da('0x1e'))(new Redis(config[_0x91da('0x1b')]));require('./whatsappMessage.socket')[_0x91da('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x91da('0x20')][_0x91da('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x91da('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xc1e865,_0x36c0c9,_0x404abe,_0x3a9044){return new BPromise(function(_0x40dd9f,_0x3c2593){var _0xde7544=_0x3a9044||client;return _0xde7544[_0x91da('0x22')](_0xc1e865,_0x404abe)[_0x91da('0x23')](function(_0xe024bd){logger[_0x91da('0x24')](_0x91da('0x25'),_0x36c0c9,_0x91da('0x26'));logger[_0x91da('0x27')](_0x91da('0x28'),_0x36c0c9,'request\x20sent',JSON[_0x91da('0x29')](_0xe024bd));if(_0xe024bd[_0x91da('0x2a')]){if(_0xe024bd['error'][_0x91da('0x2b')]===0x1f4){logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0xe024bd['error'][_0x91da('0x2c')]);return _0x3c2593(_0xe024bd[_0x91da('0x2a')][_0x91da('0x2c')]);}logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0xe024bd['error'][_0x91da('0x2c')]);return _0x40dd9f(_0xe024bd[_0x91da('0x2a')][_0x91da('0x2c')]);}else{logger[_0x91da('0x24')](_0x91da('0x25'),_0x36c0c9,_0x91da('0x26'));_0x40dd9f(_0xe024bd[_0x91da('0x2d')][_0x91da('0x2c')]);}})[_0x91da('0x2e')](function(_0x263463){logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0x263463);_0x3c2593(_0x263463);});});}function respondWithStatusCode(_0x3deb73,_0x1a9b87){_0x1a9b87=_0x1a9b87||0xcc;return function(_0x4269f2){if(_0x4269f2){return _0x3deb73[_0x91da('0x2f')](_0x1a9b87);}return _0x3deb73[_0x91da('0x30')](_0x1a9b87)['end']();};}function respondWithResult(_0x275d54,_0x572320){_0x572320=_0x572320||0xc8;return function(_0x2afa22){if(_0x2afa22){return _0x275d54['status'](_0x572320)['json'](_0x2afa22);}};}function respondWithFilteredResult(_0x3d37c4,_0x274c82){return function(_0x74a4cf){if(_0x74a4cf){var _0x5ebd61=typeof _0x274c82[_0x91da('0x31')]===_0x91da('0x32')&&typeof _0x274c82[_0x91da('0x33')]===_0x91da('0x32');var _0x15c96c=_0x74a4cf['count'];var _0x51968d=_0x5ebd61?0x0:_0x274c82[_0x91da('0x31')];var _0x304b3c=_0x5ebd61?_0x74a4cf[_0x91da('0x34')]:_0x274c82[_0x91da('0x31')]+_0x274c82[_0x91da('0x33')];var _0x5d1faa;if(_0x304b3c>=_0x15c96c){_0x304b3c=_0x15c96c;_0x5d1faa=0xc8;}else{_0x5d1faa=0xce;}_0x3d37c4[_0x91da('0x30')](_0x5d1faa);return _0x3d37c4[_0x91da('0x35')](_0x91da('0x36'),_0x51968d+'-'+_0x304b3c+'/'+_0x15c96c)['json'](_0x74a4cf);}return null;};}function patchUpdates(_0x466b67){return function(_0x13d7af){try{jsonpatch['apply'](_0x13d7af,_0x466b67,!![]);}catch(_0x5e9adb){return BPromise[_0x91da('0x37')](_0x5e9adb);}return _0x13d7af[_0x91da('0x38')]();};}function saveUpdates(_0x41a0a5,_0x367c42){return function(_0x3e3268){if(_0x3e3268){return _0x3e3268[_0x91da('0x39')](_0x41a0a5)['then'](function(_0x175384){return _0x175384;});}return null;};}function removeEntity(_0x96b8da,_0x425e9d){return function(_0x29597f){if(_0x29597f){return _0x29597f[_0x91da('0x3a')]()[_0x91da('0x23')](function(){_0x96b8da[_0x91da('0x30')](0xcc)[_0x91da('0x3b')]();});}};}function handleEntityNotFound(_0x77a081,_0x1ffaa8){return function(_0x596f1a){if(!_0x596f1a){_0x77a081[_0x91da('0x2f')](0x194);}return _0x596f1a;};}function handleError(_0x44a2a9,_0x313547){_0x313547=_0x313547||0x1f4;return function(_0x2f41c5){logger[_0x91da('0x2a')](_0x2f41c5[_0x91da('0x3c')]);if(_0x2f41c5['name']){delete _0x2f41c5['name'];}_0x44a2a9[_0x91da('0x30')](_0x313547)[_0x91da('0x3d')](_0x2f41c5);};}exports[_0x91da('0x3e')]=function(_0xc94277,_0x441ab0){var _0x512f64={},_0x3c455a={},_0xe7c3ae={'count':0x0,'rows':[]};var _0x2be2bf=_[_0x91da('0x3f')](db[_0x91da('0x40')][_0x91da('0x41')],function(_0x264356){return{'name':_0x264356[_0x91da('0x42')],'type':_0x264356[_0x91da('0x43')][_0x91da('0x44')]};});_0x3c455a['model']=_['map'](_0x2be2bf,_0x91da('0x45'));_0x3c455a[_0x91da('0x46')]=_[_0x91da('0x47')](_0xc94277[_0x91da('0x46')]);_0x3c455a[_0x91da('0x48')]=_[_0x91da('0x49')](_0x3c455a[_0x91da('0x4a')],_0x3c455a['query']);_0x512f64[_0x91da('0x4b')]=_[_0x91da('0x49')](_0x3c455a[_0x91da('0x4a')],qs['fields'](_0xc94277[_0x91da('0x46')][_0x91da('0x4c')]));_0x512f64[_0x91da('0x4b')]=_0x512f64[_0x91da('0x4b')][_0x91da('0x4d')]?_0x512f64[_0x91da('0x4b')]:_0x3c455a['model'];if(!_0xc94277[_0x91da('0x46')][_0x91da('0x4e')](_0x91da('0x4f'))){_0x512f64[_0x91da('0x33')]=qs[_0x91da('0x33')](_0xc94277[_0x91da('0x46')]['limit']);_0x512f64[_0x91da('0x31')]=qs[_0x91da('0x31')](_0xc94277[_0x91da('0x46')][_0x91da('0x31')]);}_0x512f64[_0x91da('0x50')]=qs['sort'](_0xc94277['query']['sort']);_0x512f64[_0x91da('0x51')]=qs[_0x91da('0x48')](_[_0x91da('0x52')](_0xc94277[_0x91da('0x46')],_0x3c455a[_0x91da('0x48')]),_0x2be2bf);if(_0xc94277[_0x91da('0x46')][_0x91da('0x53')]){_0x512f64[_0x91da('0x51')]=_[_0x91da('0x54')](_0x512f64['where'],{'$or':_[_0x91da('0x3f')](_0x2be2bf,function(_0x275930){if(_0x275930[_0x91da('0x43')]!=='VIRTUAL'){var _0x5f38bc={};_0x5f38bc[_0x275930[_0x91da('0x45')]]={'$like':'%'+_0xc94277[_0x91da('0x46')][_0x91da('0x53')]+'%'};return _0x5f38bc;}})});}_0x512f64=_[_0x91da('0x54')]({},_0x512f64,_0xc94277[_0x91da('0x55')]);var _0x5a3690={'where':_0x512f64[_0x91da('0x51')]};return db[_0x91da('0x40')]['count'](_0x5a3690)[_0x91da('0x23')](function(_0x4c9f7c){_0xe7c3ae[_0x91da('0x34')]=_0x4c9f7c;if(_0xc94277[_0x91da('0x46')][_0x91da('0x56')]){_0x512f64['include']=[{'all':!![]}];}return db[_0x91da('0x40')][_0x91da('0x57')](_0x512f64);})[_0x91da('0x23')](function(_0x176e9d){_0xe7c3ae['rows']=_0x176e9d;return _0xe7c3ae;})[_0x91da('0x23')](respondWithFilteredResult(_0x441ab0,_0x512f64))[_0x91da('0x2e')](handleError(_0x441ab0,null));};exports['show']=function(_0x5b33fc,_0x32ed7d){var _0x63fbe6={'raw':!![],'where':{'id':_0x5b33fc[_0x91da('0x58')]['id']}},_0x1c2078={};_0x1c2078[_0x91da('0x4a')]=_[_0x91da('0x47')](db['WhatsappMessage'][_0x91da('0x41')]);_0x1c2078[_0x91da('0x46')]=_[_0x91da('0x47')](_0x5b33fc['query']);_0x1c2078[_0x91da('0x48')]=_[_0x91da('0x49')](_0x1c2078['model'],_0x1c2078[_0x91da('0x46')]);_0x63fbe6[_0x91da('0x4b')]=_[_0x91da('0x49')](_0x1c2078[_0x91da('0x4a')],qs[_0x91da('0x4c')](_0x5b33fc[_0x91da('0x46')][_0x91da('0x4c')]));_0x63fbe6['attributes']=_0x63fbe6[_0x91da('0x4b')]['length']?_0x63fbe6[_0x91da('0x4b')]:_0x1c2078[_0x91da('0x4a')];if(_0x5b33fc[_0x91da('0x46')][_0x91da('0x56')]){_0x63fbe6[_0x91da('0x59')]=[{'all':!![]}];}_0x63fbe6=_[_0x91da('0x54')]({},_0x63fbe6,_0x5b33fc['options']);return db['WhatsappMessage'][_0x91da('0x5a')](_0x63fbe6)[_0x91da('0x23')](handleEntityNotFound(_0x32ed7d,null))[_0x91da('0x23')](respondWithResult(_0x32ed7d,null))[_0x91da('0x2e')](handleError(_0x32ed7d,null));};exports[_0x91da('0x5b')]=function(_0x478ff9,_0x1aae97){return db[_0x91da('0x40')][_0x91da('0x5b')](_0x478ff9[_0x91da('0x5c')],{})[_0x91da('0x23')](respondWithResult(_0x1aae97,0xc9))[_0x91da('0x2e')](handleError(_0x1aae97,null));};exports[_0x91da('0x39')]=function(_0x49a114,_0x278502){if(_0x49a114[_0x91da('0x5c')]['id']){delete _0x49a114['body']['id'];}return db['WhatsappMessage'][_0x91da('0x5a')]({'where':{'id':_0x49a114[_0x91da('0x58')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x278502,null))[_0x91da('0x23')](saveUpdates(_0x49a114[_0x91da('0x5c')],null))[_0x91da('0x23')](respondWithResult(_0x278502,null))[_0x91da('0x2e')](handleError(_0x278502,null));};exports[_0x91da('0x3a')]=function(_0xd13d41,_0xc880b6){return db[_0x91da('0x40')][_0x91da('0x5a')]({'where':{'id':_0xd13d41[_0x91da('0x58')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0xc880b6,null))[_0x91da('0x23')](removeEntity(_0xc880b6,null))['catch'](handleError(_0xc880b6,null));};exports[_0x91da('0x5d')]=function(_0xcc828b,_0x214c86){return db[_0x91da('0x40')]['describe']()['then'](respondWithResult(_0x214c86,null))['catch'](handleError(_0x214c86,null));};var interaction_log=require(_0x91da('0x16'))('whatsapp-interactions');exports['accept']=function(_0x5b74b9,_0x2baeee,_0x6354fd){var _0x2c2052={'agent':{},'channel':_0x91da('0x5e')};if(_0x5b74b9['body']['id']){delete _0x5b74b9[_0x91da('0x5c')]['id'];}_0x5b74b9[_0x91da('0x5c')][_0x91da('0x5f')]=!![];_0x5b74b9[_0x91da('0x5c')][_0x91da('0x60')]=moment()[_0x91da('0x61')](_0x91da('0x62'));_0x5b74b9[_0x91da('0x5c')][_0x91da('0x63')]=_0x5b74b9[_0x91da('0x5c')][_0x91da('0x63')]||_0x5b74b9[_0x91da('0x64')]['id'];_0x2c2052[_0x91da('0x65')]['id']=_0x5b74b9['body'][_0x91da('0x63')];return db[_0x91da('0x40')][_0x91da('0x5a')]({'where':{'id':_0x5b74b9['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2baeee,null))[_0x91da('0x23')](saveUpdates(_0x5b74b9[_0x91da('0x5c')],null))[_0x91da('0x23')](function(_0x53d795){if(_0x53d795){_0x2c2052[_0x91da('0x2c')]=_0x53d795[_0x91da('0x66')]({'plain':!![]});return db[_0x91da('0x67')]['find']({'where':{'id':_0x53d795[_0x91da('0x68')]}});}return null;})[_0x91da('0x23')](handleEntityNotFound(_0x2baeee,null))['then'](function(_0x3203dd){if(_0x3203dd){return _0x3203dd['update']({'UserId':_0x5b74b9['body']['UserId'],'read1stAt':_[_0x91da('0x69')](_0x3203dd['read1stAt'])?moment()[_0x91da('0x61')](_0x91da('0x62')):undefined});}return null;})['then'](function(_0xb35925){if(_0xb35925){_0x2c2052['interaction']=_0xb35925[_0x91da('0x66')]({'plain':!![]});interaction_log[_0x91da('0x24')](_0x91da('0x6a'),_0x5b74b9[_0x91da('0x64')]['id'],_0x5b74b9[_0x91da('0x64')][_0x91da('0x45')],_0x5b74b9[_0x91da('0x64')][_0x91da('0x6b')],_0x2c2052[_0x91da('0x6c')]['id'],_0x5b74b9[_0x91da('0x5c')]?JSON['stringify'](_0x5b74b9[_0x91da('0x5c')]):_0x91da('0x6d'));return respondWithRpcPromise(_0x91da('0x6e'),_0x91da('0x6f'),_0x2c2052);}return null;})['then'](function(_0x21c428){var _0x1d1238=_0x91da('0x70')+_0x21c428[_0x91da('0x2c')][_0x91da('0x71')];return db[_0x91da('0x72')]['query'](_0x1d1238,{'type':db[_0x91da('0x73')][_0x91da('0x74')][_0x91da('0x75')],'raw':!![]})[_0x91da('0x23')](function(_0x2696e0){return _0x2696e0;});})[_0x91da('0x23')](function(_0x54bf2){if(_0x54bf2){_0x2c2052[_0x91da('0x2c')][_0x91da('0x76')]=_0x54bf2[0x0];if(!_0x5b74b9[_0x91da('0x5c')][_0x91da('0x63')])return;return db[_0x91da('0x77')][_0x91da('0x5a')]({'where':{'id':_0x5b74b9[_0x91da('0x5c')][_0x91da('0x63')],'role':_0x91da('0x65')},'attributes':['id',_0x91da('0x45'),_0x91da('0x78'),'email','internal'],'raw':!![]});}return null;})[_0x91da('0x23')](function(_0x3a9361){if(!_0x3a9361)return null;_0x2c2052[_0x91da('0x2c')][_0x91da('0x65')]=_0x3a9361;return _0x2c2052;})[_0x91da('0x23')](function(_0x311ea1){if(_0x311ea1){if(_0x5b74b9[_0x91da('0x5c')]['manual']){_0x2c2052['message'][_0x91da('0x79')]=util['format'](_0x91da('0x7a'),_0x5b74b9[_0x91da('0x64')][_0x91da('0x45')]);_0x2c2052[_0x91da('0x2c')][_0x91da('0x7b')]=_0x2c2052[_0x91da('0x7b')];_0x2c2052['message'][_0x91da('0x7c')]=_0x91da('0x7d');return respondWithRpcPromise(_0x91da('0x7e'),_0x91da('0x7e'),{'event':_0x91da('0x7f'),'message':_0x2c2052[_0x91da('0x2c')]},client9002)['then'](function(){return _0x2c2052;});}return _0x2c2052;}return null;})['then'](respondWithResult(_0x2baeee,null))['catch'](handleError(_0x2baeee,null));};var interaction_log=require(_0x91da('0x16'))(_0x91da('0x80'));exports[_0x91da('0x37')]=function(_0x58da30,_0x559064,_0x176823){var _0x2b559d={'agent':{},'channel':'whatsapp'};if(_0x58da30[_0x91da('0x5c')]['id']){delete _0x58da30[_0x91da('0x5c')]['id'];}_0x58da30[_0x91da('0x5c')][_0x91da('0x63')]=_0x58da30['body']['UserId']||_0x58da30['user']['id'];_0x2b559d[_0x91da('0x65')]['id']=_0x58da30[_0x91da('0x5c')]['UserId'];return db[_0x91da('0x40')][_0x91da('0x5a')]({'where':{'id':_0x58da30[_0x91da('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x559064,null))[_0x91da('0x23')](function(_0x171b84){if(_0x171b84){_0x2b559d[_0x91da('0x2c')]=_0x171b84[_0x91da('0x66')]({'plain':!![]});return db[_0x91da('0x67')][_0x91da('0x5a')]({'where':{'id':_0x171b84['WhatsappInteractionId']}});}return null;})[_0x91da('0x23')](handleEntityNotFound(_0x559064,null))[_0x91da('0x23')](function(_0x5309af){if(_0x5309af){_0x2b559d[_0x91da('0x6c')]=_0x5309af[_0x91da('0x66')]({'plain':!![]});interaction_log[_0x91da('0x24')](_0x91da('0x81'),_0x58da30['user']['id'],_0x58da30['user'][_0x91da('0x45')],_0x58da30['user']['role'],_0x2b559d[_0x91da('0x6c')]['id'],_0x58da30[_0x91da('0x5c')]?JSON['stringify'](_0x58da30['body']):'null');return respondWithRpcPromise(_0x91da('0x82'),_0x91da('0x83'),_0x2b559d);}return null;})[_0x91da('0x23')](function(_0x5077f1){var _0x4bcfeb=_0x91da('0x70')+_0x5077f1[_0x91da('0x2c')][_0x91da('0x71')];return db[_0x91da('0x72')][_0x91da('0x46')](_0x4bcfeb,{'type':db[_0x91da('0x73')][_0x91da('0x74')][_0x91da('0x75')],'raw':!![]})[_0x91da('0x23')](function(_0x31c49d){return _0x31c49d;});})[_0x91da('0x23')](function(_0x140eb0){if(_0x140eb0){_0x2b559d['message'][_0x91da('0x76')]=_0x140eb0[0x0];if(!_0x58da30['body'][_0x91da('0x63')])return;return db[_0x91da('0x77')][_0x91da('0x5a')]({'where':{'id':_0x58da30[_0x91da('0x5c')][_0x91da('0x63')],'role':_0x91da('0x65')},'attributes':['id',_0x91da('0x45'),'fullname',_0x91da('0x84'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3d99a8){if(!_0x3d99a8)return null;_0x2b559d[_0x91da('0x2c')][_0x91da('0x65')]=_0x3d99a8;return _0x2b559d;})[_0x91da('0x23')](function(_0x18108e){if(_0x18108e){_0x18108e['message'][_0x91da('0x79')]=util[_0x91da('0x61')](_0x91da('0x7a'),_0x58da30[_0x91da('0x64')][_0x91da('0x45')]);_0x18108e[_0x91da('0x2c')][_0x91da('0x7b')]=_0x2b559d[_0x91da('0x7b')];_0x18108e[_0x91da('0x2c')][_0x91da('0x7c')]=_0x91da('0x37');respondWithRpcPromise(_0x91da('0x7e'),_0x91da('0x7e'),{'event':'rejectmessage','message':_0x18108e[_0x91da('0x2c')]},client9002);return _0x2b559d;}return null;})[_0x91da('0x23')](respondWithResult(_0x559064,null))[_0x91da('0x2e')](handleError(_0x559064,null));};exports['status']=function(_0x191605,_0x27e39c,_0x5bebc0){if(_0x191605['body']['id']){delete _0x191605[_0x91da('0x5c')]['id'];}var _0x17e72b;return db[_0x91da('0x40')][_0x91da('0x5a')]({'where':{'id':_0x191605[_0x91da('0x58')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x27e39c,null))[_0x91da('0x23')](function(_0x47567b){if(_0x47567b){_0x17e72b=_0x47567b;return db[_0x91da('0x85')][_0x91da('0x5a')]({'where':{'id':_0x47567b[_0x91da('0x86')]}});}})['then'](handleEntityNotFound(_0x27e39c,null))[_0x91da('0x23')](function(_0x430724){if(_0x430724){logger[_0x91da('0x27')](_0x91da('0x87'),_0x91da('0x30'),_0x91da('0x88'),_0x430724[_0x91da('0x43')],util[_0x91da('0x89')](_0x191605['body'],{'showHidden':![],'depth':null}));switch(_0x430724[_0x91da('0x43')]){case'twilio':if(_0x191605[_0x91da('0x5c')][_0x91da('0x8a')]&&_0x191605[_0x91da('0x5c')][_0x91da('0x8a')]===_0x17e72b[_0x91da('0x8b')]&&_0x191605[_0x91da('0x5c')][_0x91da('0x8c')]&&_0x191605['body'][_0x91da('0x8c')]===_0x91da('0x5f')){return _0x17e72b[_0x91da('0x39')]({'read':!![]});}else{logger[_0x91da('0x2a')](_0x91da('0x8d'),'status',_0x91da('0x8e'),util[_0x91da('0x89')](_0x191605[_0x91da('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x17e72b;}})[_0x91da('0x23')](respondWithResult(_0x27e39c,null))[_0x91da('0x2e')](handleError(_0x27e39c,null));}; \ No newline at end of file +var _0x3456=['WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','channel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','internal','agent','interface','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info'];(function(_0x450db1,_0x496bf8){var _0x4c5aeb=function(_0x88fd3a){while(--_0x88fd3a){_0x450db1['push'](_0x450db1['shift']());}};_0x4c5aeb(++_0x496bf8);}(_0x3456,0x67));var _0x6345=function(_0x20c290,_0x47e736){_0x20c290=_0x20c290-0x0;var _0x3d7b3b=_0x3456[_0x20c290];return _0x3d7b3b;};'use strict';var emlformat=require(_0x6345('0x0'));var rimraf=require(_0x6345('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6345('0x2'));var moment=require(_0x6345('0x3'));var BPromise=require(_0x6345('0x4'));var Mustache=require(_0x6345('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6345('0x6'));var csv=require(_0x6345('0x7'));var ejs=require(_0x6345('0x8'));var fs=require('fs');var fs_extra=require(_0x6345('0x9'));var _=require(_0x6345('0xa'));var squel=require(_0x6345('0xb'));var crypto=require(_0x6345('0xc'));var jsforce=require(_0x6345('0xd'));var deskjs=require(_0x6345('0xe'));var toCsv=require(_0x6345('0x7'));var querystring=require(_0x6345('0xf'));var Papa=require('papaparse');var Redis=require(_0x6345('0x10'));var authService=require(_0x6345('0x11'));var qs=require(_0x6345('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6345('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6345('0x14'));var config=require(_0x6345('0x15'));var licenseUtil=require(_0x6345('0x16'));var db=require(_0x6345('0x17'))['db'];config['redis']=_['defaults'](config[_0x6345('0x18')],{'host':_0x6345('0x19'),'port':0x18eb});var socket=require(_0x6345('0x1a'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x6345('0x1b')](socket);var jayson=require(_0x6345('0x1c'));var client=jayson[_0x6345('0x1d')][_0x6345('0x1e')]({'port':0x232c});var client9002=jayson[_0x6345('0x1d')][_0x6345('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5cd892,_0x4e1b23,_0x19ad0a,_0xfc2f35){return new BPromise(function(_0x1f3bc2,_0x17f304){var _0xfaa800=_0xfc2f35||client;return _0xfaa800[_0x6345('0x1f')](_0x5cd892,_0x19ad0a)[_0x6345('0x20')](function(_0x21f3be){logger[_0x6345('0x21')](_0x6345('0x22'),_0x4e1b23,'request\x20sent');logger[_0x6345('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4e1b23,_0x6345('0x24'),JSON[_0x6345('0x25')](_0x21f3be));if(_0x21f3be[_0x6345('0x26')]){if(_0x21f3be[_0x6345('0x26')][_0x6345('0x27')]===0x1f4){logger['error'](_0x6345('0x22'),_0x4e1b23,_0x21f3be[_0x6345('0x26')][_0x6345('0x28')]);return _0x17f304(_0x21f3be[_0x6345('0x26')][_0x6345('0x28')]);}logger['error'](_0x6345('0x22'),_0x4e1b23,_0x21f3be[_0x6345('0x26')][_0x6345('0x28')]);return _0x1f3bc2(_0x21f3be['error'][_0x6345('0x28')]);}else{logger[_0x6345('0x21')](_0x6345('0x22'),_0x4e1b23,_0x6345('0x24'));_0x1f3bc2(_0x21f3be[_0x6345('0x29')]['message']);}})[_0x6345('0x2a')](function(_0x45d780){logger[_0x6345('0x26')](_0x6345('0x22'),_0x4e1b23,_0x45d780);_0x17f304(_0x45d780);});});}function respondWithStatusCode(_0x195216,_0x422fb4){_0x422fb4=_0x422fb4||0xcc;return function(_0x33a4d2){if(_0x33a4d2){return _0x195216[_0x6345('0x2b')](_0x422fb4);}return _0x195216[_0x6345('0x2c')](_0x422fb4)[_0x6345('0x2d')]();};}function respondWithResult(_0x569238,_0x17c84e){_0x17c84e=_0x17c84e||0xc8;return function(_0xfd7247){if(_0xfd7247){return _0x569238['status'](_0x17c84e)[_0x6345('0x2e')](_0xfd7247);}};}function respondWithFilteredResult(_0x1c8b66,_0x39073b){return function(_0x2c905d){if(_0x2c905d){var _0x19d289=typeof _0x39073b[_0x6345('0x2f')]===_0x6345('0x30')&&typeof _0x39073b[_0x6345('0x31')]===_0x6345('0x30');var _0x313be2=_0x2c905d[_0x6345('0x32')];var _0x12d587=_0x19d289?0x0:_0x39073b[_0x6345('0x2f')];var _0x41917a=_0x19d289?_0x2c905d['count']:_0x39073b[_0x6345('0x2f')]+_0x39073b[_0x6345('0x31')];var _0x4c08bd;if(_0x41917a>=_0x313be2){_0x41917a=_0x313be2;_0x4c08bd=0xc8;}else{_0x4c08bd=0xce;}_0x1c8b66[_0x6345('0x2c')](_0x4c08bd);return _0x1c8b66[_0x6345('0x33')]('Content-Range',_0x12d587+'-'+_0x41917a+'/'+_0x313be2)[_0x6345('0x2e')](_0x2c905d);}return null;};}function patchUpdates(_0x3790a){return function(_0xc0eeec){try{jsonpatch[_0x6345('0x34')](_0xc0eeec,_0x3790a,!![]);}catch(_0x1231e6){return BPromise['reject'](_0x1231e6);}return _0xc0eeec[_0x6345('0x35')]();};}function saveUpdates(_0x2619d7,_0x79c8d6){return function(_0x574f28){if(_0x574f28){return _0x574f28['update'](_0x2619d7)['then'](function(_0x5eb51a){return _0x5eb51a;});}return null;};}function removeEntity(_0x16430b,_0x1791b4){return function(_0x2cb4ae){if(_0x2cb4ae){return _0x2cb4ae[_0x6345('0x36')]()[_0x6345('0x20')](function(){_0x16430b['status'](0xcc)[_0x6345('0x2d')]();});}};}function handleEntityNotFound(_0x11cedb,_0x34bbed){return function(_0x10cb74){if(!_0x10cb74){_0x11cedb['sendStatus'](0x194);}return _0x10cb74;};}function handleError(_0x780d9,_0x543124){_0x543124=_0x543124||0x1f4;return function(_0x1f1fd3){logger[_0x6345('0x26')](_0x1f1fd3['stack']);if(_0x1f1fd3[_0x6345('0x37')]){delete _0x1f1fd3['name'];}_0x780d9[_0x6345('0x2c')](_0x543124)[_0x6345('0x38')](_0x1f1fd3);};}exports[_0x6345('0x39')]=function(_0x34e2e3,_0x13d063){var _0x1f8b68={},_0x518dba={},_0x5aad84={'count':0x0,'rows':[]};var _0x3ee781=_[_0x6345('0x3a')](db[_0x6345('0x3b')][_0x6345('0x3c')],function(_0x2e1da1){return{'name':_0x2e1da1[_0x6345('0x3d')],'type':_0x2e1da1[_0x6345('0x3e')][_0x6345('0x3f')]};});_0x518dba[_0x6345('0x40')]=_['map'](_0x3ee781,_0x6345('0x37'));_0x518dba['query']=_[_0x6345('0x41')](_0x34e2e3['query']);_0x518dba[_0x6345('0x42')]=_['intersection'](_0x518dba[_0x6345('0x40')],_0x518dba[_0x6345('0x43')]);_0x1f8b68[_0x6345('0x44')]=_[_0x6345('0x45')](_0x518dba[_0x6345('0x40')],qs[_0x6345('0x46')](_0x34e2e3[_0x6345('0x43')][_0x6345('0x46')]));_0x1f8b68[_0x6345('0x44')]=_0x1f8b68['attributes'][_0x6345('0x47')]?_0x1f8b68['attributes']:_0x518dba['model'];if(!_0x34e2e3[_0x6345('0x43')][_0x6345('0x48')](_0x6345('0x49'))){_0x1f8b68[_0x6345('0x31')]=qs['limit'](_0x34e2e3['query'][_0x6345('0x31')]);_0x1f8b68['offset']=qs[_0x6345('0x2f')](_0x34e2e3['query'][_0x6345('0x2f')]);}_0x1f8b68['order']=qs[_0x6345('0x4a')](_0x34e2e3[_0x6345('0x43')]['sort']);_0x1f8b68[_0x6345('0x4b')]=qs[_0x6345('0x42')](_[_0x6345('0x4c')](_0x34e2e3[_0x6345('0x43')],_0x518dba[_0x6345('0x42')]),_0x3ee781);if(_0x34e2e3['query'][_0x6345('0x4d')]){_0x1f8b68['where']=_[_0x6345('0x4e')](_0x1f8b68[_0x6345('0x4b')],{'$or':_[_0x6345('0x3a')](_0x3ee781,function(_0xa1114f){if(_0xa1114f[_0x6345('0x3e')]!=='VIRTUAL'){var _0x28b087={};_0x28b087[_0xa1114f[_0x6345('0x37')]]={'$like':'%'+_0x34e2e3[_0x6345('0x43')][_0x6345('0x4d')]+'%'};return _0x28b087;}})});}_0x1f8b68=_[_0x6345('0x4e')]({},_0x1f8b68,_0x34e2e3[_0x6345('0x4f')]);var _0x46d7e9={'where':_0x1f8b68[_0x6345('0x4b')]};return db['WhatsappMessage'][_0x6345('0x32')](_0x46d7e9)[_0x6345('0x20')](function(_0x157f7b){_0x5aad84['count']=_0x157f7b;if(_0x34e2e3['query'][_0x6345('0x50')]){_0x1f8b68[_0x6345('0x51')]=[{'all':!![]}];}return db[_0x6345('0x3b')][_0x6345('0x52')](_0x1f8b68);})[_0x6345('0x20')](function(_0x3482d1){_0x5aad84[_0x6345('0x53')]=_0x3482d1;return _0x5aad84;})[_0x6345('0x20')](respondWithFilteredResult(_0x13d063,_0x1f8b68))['catch'](handleError(_0x13d063,null));};exports[_0x6345('0x54')]=function(_0x34a02d,_0x4123aa){var _0x163c26={'raw':!![],'where':{'id':_0x34a02d[_0x6345('0x55')]['id']}},_0xdbddcc={};_0xdbddcc[_0x6345('0x40')]=_[_0x6345('0x41')](db[_0x6345('0x3b')][_0x6345('0x3c')]);_0xdbddcc['query']=_['keys'](_0x34a02d[_0x6345('0x43')]);_0xdbddcc[_0x6345('0x42')]=_['intersection'](_0xdbddcc[_0x6345('0x40')],_0xdbddcc[_0x6345('0x43')]);_0x163c26[_0x6345('0x44')]=_['intersection'](_0xdbddcc[_0x6345('0x40')],qs[_0x6345('0x46')](_0x34a02d[_0x6345('0x43')][_0x6345('0x46')]));_0x163c26[_0x6345('0x44')]=_0x163c26['attributes'][_0x6345('0x47')]?_0x163c26[_0x6345('0x44')]:_0xdbddcc[_0x6345('0x40')];if(_0x34a02d[_0x6345('0x43')][_0x6345('0x50')]){_0x163c26['include']=[{'all':!![]}];}_0x163c26=_[_0x6345('0x4e')]({},_0x163c26,_0x34a02d[_0x6345('0x4f')]);return db[_0x6345('0x3b')][_0x6345('0x56')](_0x163c26)[_0x6345('0x20')](handleEntityNotFound(_0x4123aa,null))['then'](respondWithResult(_0x4123aa,null))[_0x6345('0x2a')](handleError(_0x4123aa,null));};exports['create']=function(_0xf807ed,_0x3d96cf){return db[_0x6345('0x3b')][_0x6345('0x57')](_0xf807ed[_0x6345('0x58')],{})['then'](respondWithResult(_0x3d96cf,0xc9))[_0x6345('0x2a')](handleError(_0x3d96cf,null));};exports['update']=function(_0xaab307,_0x2b1bce){if(_0xaab307['body']['id']){delete _0xaab307[_0x6345('0x58')]['id'];}return db[_0x6345('0x3b')]['find']({'where':{'id':_0xaab307[_0x6345('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b1bce,null))[_0x6345('0x20')](saveUpdates(_0xaab307[_0x6345('0x58')],null))[_0x6345('0x20')](respondWithResult(_0x2b1bce,null))['catch'](handleError(_0x2b1bce,null));};exports[_0x6345('0x36')]=function(_0x5c8d60,_0x4bd7f1){return db[_0x6345('0x3b')]['find']({'where':{'id':_0x5c8d60[_0x6345('0x55')]['id']}})[_0x6345('0x20')](handleEntityNotFound(_0x4bd7f1,null))[_0x6345('0x20')](removeEntity(_0x4bd7f1,null))['catch'](handleError(_0x4bd7f1,null));};exports[_0x6345('0x59')]=function(_0x2df4b3,_0x25089){return db[_0x6345('0x3b')][_0x6345('0x59')]()['then'](respondWithResult(_0x25089,null))['catch'](handleError(_0x25089,null));};var interaction_log=require(_0x6345('0x5a'))(_0x6345('0x5b'));exports[_0x6345('0x5c')]=function(_0x1fe768,_0x3dcbab,_0xf46b5e){var _0x17ea52={'agent':{},'channel':_0x6345('0x5d')};if(_0x1fe768[_0x6345('0x58')]['id']){delete _0x1fe768[_0x6345('0x58')]['id'];}_0x1fe768[_0x6345('0x58')][_0x6345('0x5e')]=!![];_0x1fe768[_0x6345('0x58')][_0x6345('0x5f')]=moment()[_0x6345('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fe768[_0x6345('0x58')]['UserId']=_0x1fe768[_0x6345('0x58')][_0x6345('0x61')]||_0x1fe768[_0x6345('0x62')]['id'];_0x17ea52['agent']['id']=_0x1fe768['body'][_0x6345('0x61')];return db[_0x6345('0x3b')][_0x6345('0x56')]({'where':{'id':_0x1fe768[_0x6345('0x55')]['id'],'UserId':null}})[_0x6345('0x20')](handleEntityNotFound(_0x3dcbab,null))[_0x6345('0x20')](saveUpdates(_0x1fe768['body'],null))[_0x6345('0x20')](function(_0x34bbba){if(_0x34bbba){_0x17ea52['message']=_0x34bbba[_0x6345('0x63')]({'plain':!![]});return db[_0x6345('0x64')][_0x6345('0x56')]({'where':{'id':_0x34bbba['WhatsappInteractionId']}});}return null;})[_0x6345('0x20')](handleEntityNotFound(_0x3dcbab,null))[_0x6345('0x20')](function(_0x32aaf5){if(_0x32aaf5){return _0x32aaf5['update']({'UserId':_0x1fe768['body'][_0x6345('0x61')],'read1stAt':_[_0x6345('0x65')](_0x32aaf5[_0x6345('0x66')])?moment()[_0x6345('0x60')](_0x6345('0x67')):undefined});}return null;})['then'](function(_0x28dda6){if(_0x28dda6){_0x17ea52['interaction']=_0x28dda6[_0x6345('0x63')]({'plain':!![]});interaction_log[_0x6345('0x21')](_0x6345('0x68'),_0x1fe768[_0x6345('0x62')]['id'],_0x1fe768['user'][_0x6345('0x37')],_0x1fe768[_0x6345('0x62')][_0x6345('0x69')],_0x17ea52[_0x6345('0x6a')]['id'],_0x1fe768['body']?JSON[_0x6345('0x25')](_0x1fe768['body']):'null');return respondWithRpcPromise(_0x6345('0x6b'),_0x6345('0x6c'),_0x17ea52);}return null;})['then'](function(_0x3ccdb6){var _0x36f50d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3ccdb6[_0x6345('0x28')][_0x6345('0x6d')];return db[_0x6345('0x6e')][_0x6345('0x43')](_0x36f50d,{'type':db[_0x6345('0x6f')][_0x6345('0x70')][_0x6345('0x71')],'raw':!![]})[_0x6345('0x20')](function(_0x3b9d97){return _0x3b9d97;});})['then'](function(_0x4d2a1b){if(_0x4d2a1b){_0x17ea52[_0x6345('0x28')][_0x6345('0x72')]=_0x4d2a1b[0x0];if(!_0x1fe768[_0x6345('0x58')]['UserId'])return;return db[_0x6345('0x73')][_0x6345('0x56')]({'where':{'id':_0x1fe768[_0x6345('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x6345('0x37'),'fullname',_0x6345('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x29328e){if(!_0x29328e)return null;_0x17ea52[_0x6345('0x28')]['agent']=_0x29328e;return _0x17ea52;})[_0x6345('0x20')](function(_0x53996f){if(_0x53996f){if(_0x1fe768[_0x6345('0x58')][_0x6345('0x75')]){_0x17ea52['message']['interface']=util[_0x6345('0x60')]('SIP/%s',_0x1fe768[_0x6345('0x62')]['name']);_0x17ea52[_0x6345('0x28')][_0x6345('0x76')]=_0x17ea52[_0x6345('0x76')];_0x17ea52['message'][_0x6345('0x77')]=_0x6345('0x5c');return respondWithRpcPromise(_0x6345('0x78'),'EventManager',{'event':_0x6345('0x79'),'message':_0x17ea52[_0x6345('0x28')]},client9002)[_0x6345('0x20')](function(){return _0x17ea52;});}return _0x17ea52;}return null;})['then'](respondWithResult(_0x3dcbab,null))[_0x6345('0x2a')](handleError(_0x3dcbab,null));};var interaction_log=require('../../config/logger')(_0x6345('0x5b'));exports[_0x6345('0x7a')]=function(_0x59e390,_0x390012,_0x401307){var _0x1a965a={'agent':{},'channel':_0x6345('0x5d')};if(_0x59e390['body']['id']){delete _0x59e390[_0x6345('0x58')]['id'];}_0x59e390[_0x6345('0x58')][_0x6345('0x61')]=_0x59e390['body'][_0x6345('0x61')]||_0x59e390[_0x6345('0x62')]['id'];_0x1a965a['agent']['id']=_0x59e390[_0x6345('0x58')][_0x6345('0x61')];return db[_0x6345('0x3b')][_0x6345('0x56')]({'where':{'id':_0x59e390[_0x6345('0x55')]['id'],'UserId':null}})[_0x6345('0x20')](handleEntityNotFound(_0x390012,null))[_0x6345('0x20')](function(_0x58c9d6){if(_0x58c9d6){_0x1a965a[_0x6345('0x28')]=_0x58c9d6[_0x6345('0x63')]({'plain':!![]});return db[_0x6345('0x64')][_0x6345('0x56')]({'where':{'id':_0x58c9d6['WhatsappInteractionId']}});}return null;})[_0x6345('0x20')](handleEntityNotFound(_0x390012,null))[_0x6345('0x20')](function(_0x2a3278){if(_0x2a3278){_0x1a965a[_0x6345('0x6a')]=_0x2a3278[_0x6345('0x63')]({'plain':!![]});interaction_log[_0x6345('0x21')](_0x6345('0x7b'),_0x59e390[_0x6345('0x62')]['id'],_0x59e390['user']['name'],_0x59e390[_0x6345('0x62')]['role'],_0x1a965a['interaction']['id'],_0x59e390[_0x6345('0x58')]?JSON[_0x6345('0x25')](_0x59e390[_0x6345('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0x6345('0x7c'),_0x1a965a);}return null;})['then'](function(_0x56aed1){var _0x2d9ed9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x56aed1[_0x6345('0x28')][_0x6345('0x6d')];return db[_0x6345('0x6e')][_0x6345('0x43')](_0x2d9ed9,{'type':db[_0x6345('0x6f')][_0x6345('0x70')]['SELECT'],'raw':!![]})[_0x6345('0x20')](function(_0x37e2af){return _0x37e2af;});})[_0x6345('0x20')](function(_0x5c4b92){if(_0x5c4b92){_0x1a965a[_0x6345('0x28')][_0x6345('0x72')]=_0x5c4b92[0x0];if(!_0x59e390[_0x6345('0x58')]['UserId'])return;return db[_0x6345('0x73')][_0x6345('0x56')]({'where':{'id':_0x59e390[_0x6345('0x58')][_0x6345('0x61')],'role':'agent'},'attributes':['id',_0x6345('0x37'),_0x6345('0x7d'),'email',_0x6345('0x7e')],'raw':!![]});}return null;})[_0x6345('0x20')](function(_0x3a2794){if(!_0x3a2794)return null;_0x1a965a[_0x6345('0x28')][_0x6345('0x7f')]=_0x3a2794;return _0x1a965a;})['then'](function(_0x152aa4){if(_0x152aa4){_0x152aa4[_0x6345('0x28')][_0x6345('0x80')]=util[_0x6345('0x60')]('SIP/%s',_0x59e390['user'][_0x6345('0x37')]);_0x152aa4[_0x6345('0x28')][_0x6345('0x76')]=_0x1a965a['channel'];_0x152aa4[_0x6345('0x28')][_0x6345('0x77')]=_0x6345('0x7a');respondWithRpcPromise(_0x6345('0x78'),_0x6345('0x78'),{'event':'rejectmessage','message':_0x152aa4[_0x6345('0x28')]},client9002);return _0x1a965a;}return null;})[_0x6345('0x20')](respondWithResult(_0x390012,null))[_0x6345('0x2a')](handleError(_0x390012,null));};exports[_0x6345('0x2c')]=function(_0x16f251,_0x5e8b92,_0x31c522){if(_0x16f251[_0x6345('0x58')]['id']){delete _0x16f251['body']['id'];}var _0x5c2ea8;return db[_0x6345('0x3b')][_0x6345('0x56')]({'where':{'id':_0x16f251[_0x6345('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e8b92,null))[_0x6345('0x20')](function(_0x1f4a7a){if(_0x1f4a7a){_0x5c2ea8=_0x1f4a7a;return db[_0x6345('0x81')][_0x6345('0x56')]({'where':{'id':_0x1f4a7a[_0x6345('0x82')]}});}})['then'](handleEntityNotFound(_0x5e8b92,null))[_0x6345('0x20')](function(_0x1c3710){if(_0x1c3710){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x6345('0x83'),_0x1c3710['type'],util[_0x6345('0x84')](_0x16f251[_0x6345('0x58')],{'showHidden':![],'depth':null}));switch(_0x1c3710[_0x6345('0x3e')]){case _0x6345('0x85'):if(_0x16f251[_0x6345('0x58')][_0x6345('0x86')]&&_0x16f251[_0x6345('0x58')][_0x6345('0x86')]===_0x5c2ea8[_0x6345('0x87')]&&_0x16f251['body']['MessageStatus']&&_0x16f251[_0x6345('0x58')]['MessageStatus']===_0x6345('0x5e')){return _0x5c2ea8['update']({'read':!![]});}else{logger[_0x6345('0x26')](_0x6345('0x88'),_0x6345('0x2c'),_0x6345('0x85'),util[_0x6345('0x84')](_0x16f251['body'],{'showHidden':![],'depth':null}));}break;}return _0x5c2ea8;}})[_0x6345('0x20')](respondWithResult(_0x5e8b92,null))[_0x6345('0x2a')](handleError(_0x5e8b92,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 23c3955..c3aff9b 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 _0x8caf=['remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x4f2bc2,_0x1520ed){_0x4f2bc2=_0x4f2bc2-0x0;var _0x45e3e1=_0x8caf[_0x4f2bc2];return _0x45e3e1;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf8ca('0x0'))['db'][_0xf8ca('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf8ca('0x2')](0x0);var events={'afterCreate':_0xf8ca('0x3'),'afterUpdate':_0xf8ca('0x4'),'afterDestroy':_0xf8ca('0x5')};function emitEvent(_0x4e6684){return function(_0x129ca9,_0x23939c,_0x2a9691){WhatsappMessageEvents[_0xf8ca('0x6')](_0x4e6684+':'+_0x129ca9['id'],_0x129ca9);WhatsappMessageEvents[_0xf8ca('0x6')](_0x4e6684,_0x129ca9);_0x2a9691(null);};}for(var e in events){if(events[_0xf8ca('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xf8ca('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x422f=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x422f,0x1c7));var _0xf422=function(_0x2480b5,_0x1899e9){_0x2480b5=_0x2480b5-0x0;var _0x108649=_0x422f[_0x2480b5];return _0x108649;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf422('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf422('0x1')](0x0);var events={'afterCreate':_0xf422('0x2'),'afterUpdate':'update','afterDestroy':_0xf422('0x3')};function emitEvent(_0x172a93){return function(_0x312bc8,_0x444ad5,_0x16047c){WhatsappMessageEvents[_0xf422('0x4')](_0x172a93+':'+_0x312bc8['id'],_0x312bc8);WhatsappMessageEvents[_0xf422('0x4')](_0x172a93,_0x312bc8);_0x16047c(null);};}for(var e in events){if(events[_0xf422('0x5')](e)){var event=events[e];WhatsappMessage[_0xf422('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index f2d66b6..d10b724 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 _0xb81d=['then','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','token','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','WhatsappInteractionId'];(function(_0x53c364,_0x25afb7){var _0x3ef64e=function(_0x5aa2c6){while(--_0x5aa2c6){_0x53c364['push'](_0x53c364['shift']());}};_0x3ef64e(++_0x25afb7);}(_0xb81d,0x73));var _0xdb81=function(_0x47e462,_0x57135f){_0x47e462=_0x47e462-0x0;var _0xf45f50=_0xb81d[_0x47e462];return _0xf45f50;};'use strict';var _=require(_0xdb81('0x0'));var util=require('util');var logger=require(_0xdb81('0x1'))(_0xdb81('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb81('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb81('0x4'));var config=require(_0xdb81('0x5'));var attributes=require(_0xdb81('0x6'));module[_0xdb81('0x7')]=function(_0x8cb016,_0x12deb8){return _0x8cb016[_0xdb81('0x8')]('WhatsappMessage',attributes,{'tableName':_0xdb81('0x9'),'paranoid':![],'indexes':[{'name':_0xdb81('0xa'),'fields':[_0xdb81('0xa')]},{'name':_0xdb81('0xb'),'fields':[_0xdb81('0xc')],'type':_0xdb81('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3080b7,_0x55d998,_0x317875){var _0x33cf45=_0x8cb016[_0xdb81('0xe')];var _0x4ace36=_0x3080b7[_0xdb81('0xf')]({'plain':!![]});if(_0x4ace36[_0xdb81('0x10')][_0xdb81('0x11')]()==='in'||_0x4ace36[_0xdb81('0x10')][_0xdb81('0x11')]()===_0xdb81('0x12')&&!_0x4ace36[_0xdb81('0x13')]&&!_['isNil'](_0x4ace36[_0xdb81('0x14')])){_0x33cf45['WhatsappInteraction'][_0xdb81('0x15')]({'where':{'id':_0x4ace36[_0xdb81('0x16')]}})[_0xdb81('0x17')](function(_0x13af37){if(_0x13af37){_0x13af37[_0xdb81('0x18')]({'lastMsgAt':_0x4ace36[_0xdb81('0x19')],'lastMsgDirection':_0x4ace36[_0xdb81('0x10')][_0xdb81('0x11')]()});}})[_0xdb81('0x1a')](function(_0x172e3e){console[_0xdb81('0x1b')](_0x172e3e);});}if(_0x4ace36[_0xdb81('0x10')]===_0xdb81('0x12')&&!_0x4ace36['secret']){var _0x59743e;_0x33cf45[_0xdb81('0x1c')]['find']({'where':{'id':_0x4ace36[_0xdb81('0x1d')]},'raw':!![]})[_0xdb81('0x17')](function(_0x5545e3){_0x59743e=_0x5545e3;if(_0x59743e&&_0x59743e[_0xdb81('0x1e')]){switch(_0x59743e[_0xdb81('0x1e')]){case _0xdb81('0x1f'):var _0x418f09=require(_0xdb81('0x1f'));if(_0x59743e[_0xdb81('0x20')]&&_0x59743e[_0xdb81('0x21')]&&_0x59743e[_0xdb81('0x22')]){var _0x446491=new _0x418f09(_0x59743e[_0xdb81('0x20')],_0x59743e[_0xdb81('0x21')]);_0x446491[_0xdb81('0x23')]['create']({'body':_0x4ace36[_0xdb81('0xc')],'to':'whatsapp:'+_0x4ace36[_0xdb81('0x22')],'from':_0xdb81('0x24')+_0x59743e[_0xdb81('0x22')],'statusCallback':_0x59743e[_0xdb81('0x25')]+_0xdb81('0x26')+_0x4ace36['id']+'/status?token='+_0x59743e[_0xdb81('0x27')]})['then'](function(_0x5a286c){if(_0x5a286c['sid']){return _0x3080b7['update']({'messageId':_0x5a286c['sid']});}})[_0xdb81('0x1a')](function(_0x473514){logger[_0xdb81('0x1b')](_0xdb81('0x28'),'afterCreate',_0xdb81('0x1f'),util[_0xdb81('0x29')](_0x473514,{'showHidden':![],'depth':null}));});}else{logger[_0xdb81('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xdb81('0x2a'),_0xdb81('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xdb81('0x2b')](function(){_0x317875();});}else{_0x317875();}}},'charset':_0xdb81('0x2c'),'collate':_0xdb81('0x2d')});}; \ No newline at end of file +var _0x2f78=['catch','error','out','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','UserId','findOne','WhatsappInteractionId','then','update','createdAt'];(function(_0x555e5c,_0x3adc08){var _0x4104a1=function(_0x38af15){while(--_0x38af15){_0x555e5c['push'](_0x555e5c['shift']());}};_0x4104a1(++_0x3adc08);}(_0x2f78,0x19f));var _0x82f7=function(_0x32ab9c,_0x34b6e7){_0x32ab9c=_0x32ab9c-0x0;var _0x1cc479=_0x2f78[_0x32ab9c];return _0x1cc479;};'use strict';var _=require(_0x82f7('0x0'));var util=require('util');var logger=require(_0x82f7('0x1'))('api');var moment=require(_0x82f7('0x2'));var BPromise=require(_0x82f7('0x3'));var rp=require(_0x82f7('0x4'));var fs=require('fs');var path=require(_0x82f7('0x5'));var rimraf=require(_0x82f7('0x6'));var config=require(_0x82f7('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x82f7('0x8')]=function(_0x2887ba,_0xcae3f2){return _0x2887ba[_0x82f7('0x9')](_0x82f7('0xa'),attributes,{'tableName':_0x82f7('0xb'),'paranoid':![],'indexes':[{'name':_0x82f7('0xc'),'fields':[_0x82f7('0xc')]},{'name':_0x82f7('0xd'),'fields':[_0x82f7('0xe')],'type':_0x82f7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x476420,_0x2e8d29,_0x318020){var _0x44745c=_0x2887ba[_0x82f7('0x10')];var _0xeb84eb=_0x476420['get']({'plain':!![]});if(_0xeb84eb[_0x82f7('0x11')]['toLowerCase']()==='in'||_0xeb84eb[_0x82f7('0x11')][_0x82f7('0x12')]()==='out'&&!_0xeb84eb[_0x82f7('0x13')]&&!_['isNil'](_0xeb84eb[_0x82f7('0x14')])){_0x44745c['WhatsappInteraction'][_0x82f7('0x15')]({'where':{'id':_0xeb84eb[_0x82f7('0x16')]}})[_0x82f7('0x17')](function(_0x5a37de){if(_0x5a37de){_0x5a37de[_0x82f7('0x18')]({'lastMsgAt':_0xeb84eb[_0x82f7('0x19')],'lastMsgDirection':_0xeb84eb[_0x82f7('0x11')][_0x82f7('0x12')]()});}})[_0x82f7('0x1a')](function(_0x11539b){console[_0x82f7('0x1b')](_0x11539b);});}if(_0xeb84eb[_0x82f7('0x11')]===_0x82f7('0x1c')&&!_0xeb84eb[_0x82f7('0x13')]){var _0x2cc643;_0x44745c[_0x82f7('0x1d')][_0x82f7('0x1e')]({'where':{'id':_0xeb84eb['WhatsappAccountId']},'raw':!![]})['then'](function(_0x30af30){_0x2cc643=_0x30af30;if(_0x2cc643&&_0x2cc643[_0x82f7('0x1f')]){switch(_0x2cc643['type']){case _0x82f7('0x20'):var _0x1fa904=require(_0x82f7('0x20'));if(_0x2cc643[_0x82f7('0x21')]&&_0x2cc643[_0x82f7('0x22')]&&_0x2cc643[_0x82f7('0x23')]){var _0x2c51ad=new _0x1fa904(_0x2cc643[_0x82f7('0x21')],_0x2cc643[_0x82f7('0x22')]);_0x2c51ad[_0x82f7('0x24')][_0x82f7('0x25')]({'body':_0xeb84eb[_0x82f7('0xe')],'to':_0x82f7('0x26')+_0xeb84eb['phone'],'from':_0x82f7('0x26')+_0x2cc643[_0x82f7('0x23')],'statusCallback':_0x2cc643[_0x82f7('0x27')]+_0x82f7('0x28')+_0xeb84eb['id']+_0x82f7('0x29')+_0x2cc643[_0x82f7('0x2a')]})[_0x82f7('0x17')](function(_0x100ef1){if(_0x100ef1[_0x82f7('0x2b')]){return _0x476420[_0x82f7('0x18')]({'messageId':_0x100ef1['sid']});}})[_0x82f7('0x1a')](function(_0x4b24ed){logger[_0x82f7('0x1b')](_0x82f7('0x2c'),'afterCreate',_0x82f7('0x20'),util[_0x82f7('0x2d')](_0x4b24ed,{'showHidden':![],'depth':null}));});}else{logger[_0x82f7('0x1b')](_0x82f7('0x2c'),_0x82f7('0x2e'),_0x82f7('0x20'),_0x82f7('0x2f'));}break;}}})['finally'](function(){_0x318020();});}else{_0x318020();}}},'charset':_0x82f7('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index cceb8c0..008d3ef 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 _0x4969=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent'];(function(_0x4a5caf,_0x17fd3d){var _0x181eab=function(_0x5a76d2){while(--_0x5a76d2){_0x4a5caf['push'](_0x4a5caf['shift']());}};_0x181eab(++_0x17fd3d);}(_0x4969,0x137));var _0x9496=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x4969[_0x4dab14];return _0xf41aa;};'use strict';var _=require(_0x9496('0x0'));var util=require(_0x9496('0x1'));var moment=require(_0x9496('0x2'));var BPromise=require(_0x9496('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9496('0x4'));var db=require(_0x9496('0x5'))['db'];var utils=require(_0x9496('0x6'));var logger=require(_0x9496('0x7'))(_0x9496('0x8'));var config=require('../../config/environment');var jayson=require(_0x9496('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x9496('0xa')]=_['defaults'](config[_0x9496('0xa')],{'host':_0x9496('0xb'),'port':0x18eb});var socket=require(_0x9496('0xc'))(new Redis(config[_0x9496('0xa')]));require(_0x9496('0xd'))[_0x9496('0xe')](socket);function respondWithRpcPromise(_0x2fa696,_0x4efa9c,_0x177d2d){return new BPromise(function(_0x38249a,_0x59ea0e){return client[_0x9496('0xf')](_0x2fa696,_0x177d2d)[_0x9496('0x10')](function(_0x20f7e7){logger[_0x9496('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x4efa9c,_0x9496('0x12'));logger[_0x9496('0x13')](_0x9496('0x14'),_0x4efa9c,_0x9496('0x12'),JSON['stringify'](_0x20f7e7));if(_0x20f7e7[_0x9496('0x15')]){if(_0x20f7e7[_0x9496('0x15')][_0x9496('0x16')]===0x1f4){logger[_0x9496('0x15')](_0x9496('0x17'),_0x4efa9c,_0x20f7e7[_0x9496('0x15')][_0x9496('0x18')]);return _0x59ea0e(_0x20f7e7['error'][_0x9496('0x18')]);}logger[_0x9496('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x4efa9c,_0x20f7e7[_0x9496('0x15')][_0x9496('0x18')]);return _0x38249a(_0x20f7e7[_0x9496('0x15')][_0x9496('0x18')]);}else{logger[_0x9496('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x4efa9c,_0x9496('0x12'));_0x38249a(_0x20f7e7[_0x9496('0x19')][_0x9496('0x18')]);}})['catch'](function(_0x1b9b00){logger['error'](_0x9496('0x17'),_0x4efa9c,_0x1b9b00);_0x59ea0e(_0x1b9b00);});});}exports['CreateWhatsappMessage']=function(_0x48210d){var _0x3a5dba=this;return new Promise(function(_0x25a9d6,_0x11e787){return db[_0x9496('0x1a')][_0x9496('0x1b')](_0x48210d[_0x9496('0x1c')],{'raw':_0x48210d[_0x9496('0x1d')]?_0x48210d['options'][_0x9496('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2058ab){logger[_0x9496('0x11')](_0x9496('0x1f'),_0x48210d);logger[_0x9496('0x13')](_0x9496('0x1f'),_0x48210d,JSON[_0x9496('0x20')](_0x2058ab));_0x25a9d6(_0x2058ab);})['catch'](function(_0x35ea82){logger[_0x9496('0x15')](_0x9496('0x1f'),_0x35ea82['message'],_0x48210d);_0x11e787(_0x3a5dba[_0x9496('0x15')](0x1f4,_0x35ea82[_0x9496('0x18')]));});});}; \ No newline at end of file +var _0xe34d=['error','code','message','info','result','CreateWhatsappMessage','WhatsappMessage','options','raw','catch','util','moment','randomstring','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe34d,0xb2));var _0xde34=function(_0x46dfd3,_0x67f102){_0x46dfd3=_0x46dfd3-0x0;var _0x2a4d07=_0xe34d[_0x46dfd3];return _0x2a4d07;};'use strict';var _=require('lodash');var util=require(_0xde34('0x0'));var moment=require(_0xde34('0x1'));var BPromise=require('bluebird');var rs=require(_0xde34('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xde34('0x3'));var logger=require('../../config/logger')(_0xde34('0x4'));var config=require('../../config/environment');var jayson=require(_0xde34('0x5'));var client=jayson[_0xde34('0x6')][_0xde34('0x7')]({'port':0x232a});config[_0xde34('0x8')]=_[_0xde34('0x9')](config[_0xde34('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xde34('0xa'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x47b112,_0xc7da25,_0x17acb4){return new BPromise(function(_0x3b0a3b,_0x20323e){return client[_0xde34('0xb')](_0x47b112,_0x17acb4)[_0xde34('0xc')](function(_0x1e5ec0){logger['info'](_0xde34('0xd'),_0xc7da25,'request\x20sent');logger[_0xde34('0xe')](_0xde34('0xf'),_0xc7da25,_0xde34('0x10'),JSON[_0xde34('0x11')](_0x1e5ec0));if(_0x1e5ec0['error']){if(_0x1e5ec0[_0xde34('0x12')][_0xde34('0x13')]===0x1f4){logger[_0xde34('0x12')](_0xde34('0xd'),_0xc7da25,_0x1e5ec0['error']['message']);return _0x20323e(_0x1e5ec0[_0xde34('0x12')][_0xde34('0x14')]);}logger[_0xde34('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0xc7da25,_0x1e5ec0[_0xde34('0x12')]['message']);return _0x3b0a3b(_0x1e5ec0['error']['message']);}else{logger[_0xde34('0x15')](_0xde34('0xd'),_0xc7da25,_0xde34('0x10'));_0x3b0a3b(_0x1e5ec0[_0xde34('0x16')]['message']);}})['catch'](function(_0x2ea90e){logger[_0xde34('0x12')](_0xde34('0xd'),_0xc7da25,_0x2ea90e);_0x20323e(_0x2ea90e);});});}exports[_0xde34('0x17')]=function(_0x21bd77){var _0xa8c24e=this;return new Promise(function(_0x15dbd5,_0x44bdfc){return db[_0xde34('0x18')]['create'](_0x21bd77['body'],{'raw':_0x21bd77[_0xde34('0x19')]?_0x21bd77[_0xde34('0x19')][_0xde34('0x1a')]===undefined?!![]:![]:!![]})[_0xde34('0xc')](function(_0x236386){logger[_0xde34('0x15')](_0xde34('0x17'),_0x21bd77);logger[_0xde34('0xe')](_0xde34('0x17'),_0x21bd77,JSON['stringify'](_0x236386));_0x15dbd5(_0x236386);})[_0xde34('0x1b')](function(_0x8f1e4b){logger[_0xde34('0x12')](_0xde34('0x17'),_0x8f1e4b['message'],_0x21bd77);_0x44bdfc(_0xa8c24e['error'](0x1f4,_0x8f1e4b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 09bd811..c214a27 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 _0xf486=['register','length','./whatsappMessage.events','save','remove','update','emit'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xf486,0x167));var _0x6f48=function(_0x19360a,_0x3a13c8){_0x19360a=_0x19360a-0x0;var _0x5107b4=_0xf486[_0x19360a];return _0x5107b4;};'use strict';var WhatsappMessageEvents=require(_0x6f48('0x0'));var events=[_0x6f48('0x1'),_0x6f48('0x2'),_0x6f48('0x3')];function createListener(_0x3acd25,_0x1a36b4){return function(_0x17fafc){_0x1a36b4[_0x6f48('0x4')](_0x3acd25,_0x17fafc);};}function removeListener(_0x5ea4d5,_0x1d9850){return function(){WhatsappMessageEvents['removeListener'](_0x5ea4d5,_0x1d9850);};}exports[_0x6f48('0x5')]=function(_0x1093fd){for(var _0x45ab57=0x0,_0x5290e9=events[_0x6f48('0x6')];_0x45ab57<_0x5290e9;_0x45ab57++){var _0x51a7b2=events[_0x45ab57];var _0x4b1d88=createListener('whatsappMessage:'+_0x51a7b2,_0x1093fd);WhatsappMessageEvents['on'](_0x51a7b2,_0x4b1d88);}}; \ No newline at end of file +var _0x2adb=['register','length','whatsappMessage:','save','remove','update','removeListener'];(function(_0x2a8045,_0x521c3a){var _0x1175f5=function(_0x456298){while(--_0x456298){_0x2a8045['push'](_0x2a8045['shift']());}};_0x1175f5(++_0x521c3a);}(_0x2adb,0xce));var _0xb2ad=function(_0x16a63e,_0x248057){_0x16a63e=_0x16a63e-0x0;var _0x4c5a15=_0x2adb[_0x16a63e];return _0x4c5a15;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xb2ad('0x0'),_0xb2ad('0x1'),_0xb2ad('0x2')];function createListener(_0x30006a,_0x47b468){return function(_0x271c98){_0x47b468['emit'](_0x30006a,_0x271c98);};}function removeListener(_0x3df055,_0x170b55){return function(){WhatsappMessageEvents[_0xb2ad('0x3')](_0x3df055,_0x170b55);};}exports[_0xb2ad('0x4')]=function(_0x52e6de){for(var _0x59c92c=0x0,_0x54fe30=events[_0xb2ad('0x5')];_0x59c92c<_0x54fe30;_0x59c92c++){var _0x58733a=events[_0x59c92c];var _0x18d653=createListener(_0xb2ad('0x6')+_0x58733a,_0x52e6de);WhatsappMessageEvents['on'](_0x58733a,_0x18d653);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 500bd44..c5ffc9e 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 _0xb541=['/:id/teams','getTeams','getAgents','create','post','/:id/users','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/members'];(function(_0x5e5aaa,_0x13e296){var _0x4f9986=function(_0x34d409){while(--_0x34d409){_0x5e5aaa['push'](_0x5e5aaa['shift']());}};_0x4f9986(++_0x13e296);}(_0xb541,0x1b5));var _0x1b54=function(_0x2f1c13,_0xde1e3d){_0x2f1c13=_0x2f1c13-0x0;var _0x3de6d6=_0xb541[_0x2f1c13];return _0x3de6d6;};'use strict';var multer=require(_0x1b54('0x0'));var util=require(_0x1b54('0x1'));var path=require(_0x1b54('0x2'));var timeout=require(_0x1b54('0x3'));var express=require(_0x1b54('0x4'));var router=express[_0x1b54('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1b54('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1b54('0x7'));var controller=require('./whatsappQueue.controller');router[_0x1b54('0x8')]('/',auth[_0x1b54('0x9')](),controller['index']);router[_0x1b54('0x8')](_0x1b54('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1b54('0x8')]('/:id',auth[_0x1b54('0x9')](),controller[_0x1b54('0xb')]);router[_0x1b54('0x8')](_0x1b54('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x1b54('0x8')](_0x1b54('0xd'),auth[_0x1b54('0x9')](),controller[_0x1b54('0xe')]);router['get']('/:id/users',auth[_0x1b54('0x9')](),controller[_0x1b54('0xf')]);router['post']('/',auth[_0x1b54('0x9')](),controller[_0x1b54('0x10')]);router[_0x1b54('0x11')](_0x1b54('0xd'),auth[_0x1b54('0x9')](),controller['addTeams']);router['post'](_0x1b54('0x12'),auth[_0x1b54('0x9')](),controller['addAgents']);router['put'](_0x1b54('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x1b54('0x14')](_0x1b54('0x13'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x15')]);router[_0x1b54('0x14')](_0x1b54('0xd'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x16')]);router[_0x1b54('0x14')](_0x1b54('0x12'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x17')]);module[_0x1b54('0x18')]=router; \ No newline at end of file +var _0x8687=['update','destroy','delete','removeTeams','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','put'];(function(_0x185c3f,_0x1aff1f){var _0x13e62b=function(_0x1b5461){while(--_0x1b5461){_0x185c3f['push'](_0x185c3f['shift']());}};_0x13e62b(++_0x1aff1f);}(_0x8687,0x13a));var _0x7868=function(_0x5b5875,_0x355604){_0x5b5875=_0x5b5875-0x0;var _0x4510ff=_0x8687[_0x5b5875];return _0x4510ff;};'use strict';var multer=require(_0x7868('0x0'));var util=require('util');var path=require(_0x7868('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7868('0x2')]();var fs_extra=require(_0x7868('0x3'));var auth=require(_0x7868('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7868('0x5'));var controller=require(_0x7868('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7868('0x7')]);router[_0x7868('0x8')](_0x7868('0x9'),auth[_0x7868('0xa')](),controller[_0x7868('0xb')]);router[_0x7868('0x8')](_0x7868('0xc'),auth[_0x7868('0xa')](),controller[_0x7868('0xd')]);router[_0x7868('0x8')]('/:id/members',auth[_0x7868('0xa')](),controller[_0x7868('0xe')]);router[_0x7868('0x8')]('/:id/teams',auth[_0x7868('0xa')](),controller[_0x7868('0xf')]);router[_0x7868('0x8')](_0x7868('0x10'),auth[_0x7868('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7868('0x11')]);router[_0x7868('0x12')](_0x7868('0x13'),auth[_0x7868('0xa')](),controller[_0x7868('0x14')]);router[_0x7868('0x12')](_0x7868('0x10'),auth[_0x7868('0xa')](),controller['addAgents']);router[_0x7868('0x15')](_0x7868('0xc'),auth[_0x7868('0xa')](),controller[_0x7868('0x16')]);router['delete'](_0x7868('0xc'),auth['isAuthenticated'](),controller[_0x7868('0x17')]);router[_0x7868('0x18')]('/:id/teams',auth[_0x7868('0xa')](),controller[_0x7868('0x19')]);router[_0x7868('0x18')](_0x7868('0x10'),auth[_0x7868('0xa')](),controller[_0x7868('0x1a')]);module[_0x7868('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index a3ca167..a4d95fa 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 _0xab26=['sequelize','exports','STRING','INTEGER','ENUM','roundrobin'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xab26,0xd2));var _0x6ab2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xab26[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x6ab2('0x0'));module[_0x6ab2('0x1')]={'name':{'type':Sequelize[_0x6ab2('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6ab2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6ab2('0x4')]('rrmemory','beepall',_0x6ab2('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c76=['STRING','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x31e77e,_0x206a92){var _0x4a5b34=function(_0x2f1bb4){while(--_0x2f1bb4){_0x31e77e['push'](_0x31e77e['shift']());}};_0x4a5b34(++_0x206a92);}(_0x6c76,0x184));var _0x66c7=function(_0x35936e,_0x3666c0){_0x35936e=_0x35936e-0x0;var _0x3edb71=_0x6c76[_0x35936e];return _0x3edb71;};'use strict';var Sequelize=require(_0x66c7('0x0'));module[_0x66c7('0x1')]={'name':{'type':Sequelize[_0x66c7('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x66c7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x66c7('0x4')]('rrmemory','beepall',_0x66c7('0x5'))},'description':{'type':Sequelize[_0x66c7('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 49e649c..8a07fce 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 _0x5a96=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','name','filter','options','WhatsappQueue','includeAll','include','findAll','catch','find','create','user','get','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','rows','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userWhatsappQueue:save','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','TeamId','includes','all','compact','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','offset','undefined','limit','count','status','set','json','apply','reject','update','then','destroy','WhatsappQueues','end','error','stack','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields'];(function(_0x5de385,_0x2638c3){var _0x306007=function(_0x50a60b){while(--_0x50a60b){_0x5de385['push'](_0x5de385['shift']());}};_0x306007(++_0x2638c3);}(_0x5a96,0x1ee));var _0x65a9=function(_0x64d2f5,_0x19327e){_0x64d2f5=_0x64d2f5-0x0;var _0x334968=_0x5a96[_0x64d2f5];return _0x334968;};'use strict';var emlformat=require(_0x65a9('0x0'));var rimraf=require(_0x65a9('0x1'));var zipdir=require(_0x65a9('0x2'));var jsonpatch=require(_0x65a9('0x3'));var rp=require(_0x65a9('0x4'));var moment=require(_0x65a9('0x5'));var BPromise=require(_0x65a9('0x6'));var Mustache=require(_0x65a9('0x7'));var util=require(_0x65a9('0x8'));var path=require(_0x65a9('0x9'));var sox=require('sox');var csv=require(_0x65a9('0xa'));var ejs=require(_0x65a9('0xb'));var fs=require('fs');var fs_extra=require(_0x65a9('0xc'));var _=require('lodash');var squel=require(_0x65a9('0xd'));var crypto=require(_0x65a9('0xe'));var jsforce=require(_0x65a9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x65a9('0xa'));var querystring=require('querystring');var Papa=require(_0x65a9('0x10'));var Redis=require(_0x65a9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x65a9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65a9('0x13'));var logger=require(_0x65a9('0x14'))(_0x65a9('0x15'));var utils=require(_0x65a9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x65a9('0x17'));var db=require(_0x65a9('0x18'))['db'];config[_0x65a9('0x19')]=_[_0x65a9('0x1a')](config[_0x65a9('0x19')],{'host':_0x65a9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65a9('0x19')]));require('./whatsappQueue.socket')[_0x65a9('0x1c')](socket);function respondWithStatusCode(_0x56dbeb,_0xb00bde){_0xb00bde=_0xb00bde||0xcc;return function(_0x15aded){if(_0x15aded){return _0x56dbeb['sendStatus'](_0xb00bde);}return _0x56dbeb['status'](_0xb00bde)['end']();};}function respondWithResult(_0xeb312d,_0x464e0d){_0x464e0d=_0x464e0d||0xc8;return function(_0x31302f){if(_0x31302f){return _0xeb312d['status'](_0x464e0d)['json'](_0x31302f);}};}function respondWithFilteredResult(_0x5a98ea,_0x208e9b){return function(_0x3dd4c6){if(_0x3dd4c6){var _0x48d660=typeof _0x208e9b[_0x65a9('0x1d')]===_0x65a9('0x1e')&&typeof _0x208e9b[_0x65a9('0x1f')]===_0x65a9('0x1e');var _0x282a00=_0x3dd4c6[_0x65a9('0x20')];var _0xf4538b=_0x48d660?0x0:_0x208e9b['offset'];var _0x32ee76=_0x48d660?_0x3dd4c6[_0x65a9('0x20')]:_0x208e9b['offset']+_0x208e9b[_0x65a9('0x1f')];var _0x577911;if(_0x32ee76>=_0x282a00){_0x32ee76=_0x282a00;_0x577911=0xc8;}else{_0x577911=0xce;}_0x5a98ea[_0x65a9('0x21')](_0x577911);return _0x5a98ea[_0x65a9('0x22')]('Content-Range',_0xf4538b+'-'+_0x32ee76+'/'+_0x282a00)[_0x65a9('0x23')](_0x3dd4c6);}return null;};}function patchUpdates(_0x55a873){return function(_0x3e9434){try{jsonpatch[_0x65a9('0x24')](_0x3e9434,_0x55a873,!![]);}catch(_0x180f6e){return BPromise[_0x65a9('0x25')](_0x180f6e);}return _0x3e9434['save']();};}function saveUpdates(_0x254a55,_0x3b9f0c){return function(_0x2a1e0d){if(_0x2a1e0d){return _0x2a1e0d[_0x65a9('0x26')](_0x254a55)[_0x65a9('0x27')](function(_0x419890){return _0x419890;});}return null;};}function removeEntity(_0x46c2da,_0x5686c3){return function(_0x18beb9){if(_0x18beb9){return _0x18beb9[_0x65a9('0x28')]()[_0x65a9('0x27')](function(){var _0x5c2687=_0x18beb9['get']({'plain':!![]});var _0x23bd74=_0x65a9('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x23bd74,'resourceId':_0x5c2687['id']}})[_0x65a9('0x27')](function(){return _0x18beb9;});})[_0x65a9('0x27')](function(){_0x46c2da[_0x65a9('0x21')](0xcc)[_0x65a9('0x2a')]();});}};}function handleEntityNotFound(_0x1726a5,_0x479700){return function(_0x149d9e){if(!_0x149d9e){_0x1726a5['sendStatus'](0x194);}return _0x149d9e;};}function handleError(_0x380a16,_0x5ccc8c){_0x5ccc8c=_0x5ccc8c||0x1f4;return function(_0x549ef9){logger[_0x65a9('0x2b')](_0x549ef9[_0x65a9('0x2c')]);if(_0x549ef9['name']){delete _0x549ef9['name'];}_0x380a16['status'](_0x5ccc8c)[_0x65a9('0x2d')](_0x549ef9);};}exports[_0x65a9('0x2e')]=function(_0x5aacba,_0x425705){var _0x59a865={},_0x42d385={},_0x548f4c={'count':0x0,'rows':[]};var _0x46a04d=_['map'](db['WhatsappQueue'][_0x65a9('0x2f')],function(_0x321236){return{'name':_0x321236[_0x65a9('0x30')],'type':_0x321236[_0x65a9('0x31')][_0x65a9('0x32')]};});_0x42d385['model']=_[_0x65a9('0x33')](_0x46a04d,'name');_0x42d385[_0x65a9('0x34')]=_[_0x65a9('0x35')](_0x5aacba[_0x65a9('0x34')]);_0x42d385[_0x65a9('0x36')]=_[_0x65a9('0x37')](_0x42d385[_0x65a9('0x38')],_0x42d385[_0x65a9('0x34')]);_0x59a865['attributes']=_[_0x65a9('0x37')](_0x42d385[_0x65a9('0x38')],qs['fields'](_0x5aacba[_0x65a9('0x34')][_0x65a9('0x39')]));_0x59a865[_0x65a9('0x3a')]=_0x59a865[_0x65a9('0x3a')][_0x65a9('0x3b')]?_0x59a865[_0x65a9('0x3a')]:_0x42d385[_0x65a9('0x38')];if(!_0x5aacba[_0x65a9('0x34')][_0x65a9('0x3c')](_0x65a9('0x3d'))){_0x59a865[_0x65a9('0x1f')]=qs[_0x65a9('0x1f')](_0x5aacba[_0x65a9('0x34')][_0x65a9('0x1f')]);_0x59a865[_0x65a9('0x1d')]=qs[_0x65a9('0x1d')](_0x5aacba[_0x65a9('0x34')][_0x65a9('0x1d')]);}_0x59a865[_0x65a9('0x3e')]=qs[_0x65a9('0x3f')](_0x5aacba['query'][_0x65a9('0x3f')]);_0x59a865[_0x65a9('0x40')]=qs[_0x65a9('0x36')](_[_0x65a9('0x41')](_0x5aacba[_0x65a9('0x34')],_0x42d385[_0x65a9('0x36')]),_0x46a04d);if(_0x5aacba[_0x65a9('0x34')]['filter']){_0x59a865[_0x65a9('0x40')]=_[_0x65a9('0x42')](_0x59a865['where'],{'$or':_[_0x65a9('0x33')](_0x46a04d,function(_0x21b793){if(_0x21b793[_0x65a9('0x31')]!=='VIRTUAL'){var _0xd34c8c={};_0xd34c8c[_0x21b793[_0x65a9('0x43')]]={'$like':'%'+_0x5aacba[_0x65a9('0x34')][_0x65a9('0x44')]+'%'};return _0xd34c8c;}})});}_0x59a865=_[_0x65a9('0x42')]({},_0x59a865,_0x5aacba[_0x65a9('0x45')]);var _0x897b51={'where':_0x59a865[_0x65a9('0x40')]};return db[_0x65a9('0x46')][_0x65a9('0x20')](_0x897b51)[_0x65a9('0x27')](function(_0x48e5c3){_0x548f4c[_0x65a9('0x20')]=_0x48e5c3;if(_0x5aacba[_0x65a9('0x34')][_0x65a9('0x47')]){_0x59a865[_0x65a9('0x48')]=[{'all':!![]}];}return db[_0x65a9('0x46')][_0x65a9('0x49')](_0x59a865);})[_0x65a9('0x27')](function(_0x1ded5c){_0x548f4c['rows']=_0x1ded5c;return _0x548f4c;})['then'](respondWithFilteredResult(_0x425705,_0x59a865))[_0x65a9('0x4a')](handleError(_0x425705,null));};exports['show']=function(_0x5bd830,_0x2b16c2){var _0x2958b3={'raw':!![],'where':{'id':_0x5bd830['params']['id']}},_0xca4591={};_0xca4591[_0x65a9('0x38')]=_[_0x65a9('0x35')](db[_0x65a9('0x46')][_0x65a9('0x2f')]);_0xca4591[_0x65a9('0x34')]=_['keys'](_0x5bd830[_0x65a9('0x34')]);_0xca4591[_0x65a9('0x36')]=_[_0x65a9('0x37')](_0xca4591[_0x65a9('0x38')],_0xca4591[_0x65a9('0x34')]);_0x2958b3['attributes']=_[_0x65a9('0x37')](_0xca4591['model'],qs['fields'](_0x5bd830[_0x65a9('0x34')]['fields']));_0x2958b3['attributes']=_0x2958b3[_0x65a9('0x3a')][_0x65a9('0x3b')]?_0x2958b3[_0x65a9('0x3a')]:_0xca4591[_0x65a9('0x38')];if(_0x5bd830[_0x65a9('0x34')][_0x65a9('0x47')]){_0x2958b3[_0x65a9('0x48')]=[{'all':!![]}];}_0x2958b3=_[_0x65a9('0x42')]({},_0x2958b3,_0x5bd830[_0x65a9('0x45')]);return db[_0x65a9('0x46')][_0x65a9('0x4b')](_0x2958b3)[_0x65a9('0x27')](handleEntityNotFound(_0x2b16c2,null))['then'](respondWithResult(_0x2b16c2,null))['catch'](handleError(_0x2b16c2,null));};exports[_0x65a9('0x4c')]=function(_0x5368bc,_0x1ce5c5){return db[_0x65a9('0x46')][_0x65a9('0x4c')](_0x5368bc['body'],{})[_0x65a9('0x27')](function(_0xcf9838){var _0x446666=_0x5368bc[_0x65a9('0x4d')][_0x65a9('0x4e')]({'plain':!![]});if(!_0x446666)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x446666[_0x65a9('0x4f')]==='user'){var _0x306dc0=_0xcf9838[_0x65a9('0x4e')]({'plain':!![]});var _0x50e08c=_0x65a9('0x29');return db[_0x65a9('0x50')][_0x65a9('0x4b')]({'where':{'name':_0x50e08c,'userProfileId':_0x446666[_0x65a9('0x51')]},'raw':!![]})[_0x65a9('0x27')](function(_0x23fa8b){if(_0x23fa8b&&_0x23fa8b['autoAssociation']===0x0){return db[_0x65a9('0x52')][_0x65a9('0x4c')]({'name':_0x306dc0[_0x65a9('0x43')],'resourceId':_0x306dc0['id'],'type':_0x23fa8b['name'],'sectionId':_0x23fa8b['id']},{})[_0x65a9('0x27')](function(){return _0xcf9838;});}else{return _0xcf9838;}})[_0x65a9('0x4a')](function(_0x9c907c){logger[_0x65a9('0x2b')](_0x65a9('0x53'),_0x9c907c);throw _0x9c907c;});}return _0xcf9838;})[_0x65a9('0x27')](respondWithResult(_0x1ce5c5,0xc9))['catch'](handleError(_0x1ce5c5,null));};exports[_0x65a9('0x26')]=function(_0x1425ab,_0x828a6f){if(_0x1425ab[_0x65a9('0x54')]['id']){delete _0x1425ab[_0x65a9('0x54')]['id'];}return db[_0x65a9('0x46')]['find']({'where':{'id':_0x1425ab[_0x65a9('0x55')]['id']}})[_0x65a9('0x27')](handleEntityNotFound(_0x828a6f,null))[_0x65a9('0x27')](saveUpdates(_0x1425ab[_0x65a9('0x54')],null))[_0x65a9('0x27')](respondWithResult(_0x828a6f,null))[_0x65a9('0x4a')](handleError(_0x828a6f,null));};exports['destroy']=function(_0x5d7d8b,_0x5afc67){return db['WhatsappQueue'][_0x65a9('0x4b')]({'where':{'id':_0x5d7d8b['params']['id']}})[_0x65a9('0x27')](handleEntityNotFound(_0x5afc67,null))[_0x65a9('0x27')](removeEntity(_0x5afc67,null))['catch'](handleError(_0x5afc67,null));};exports[_0x65a9('0x56')]=function(_0x4bdcd4,_0x10d496){return db[_0x65a9('0x46')][_0x65a9('0x56')]()['then'](respondWithResult(_0x10d496,null))[_0x65a9('0x4a')](handleError(_0x10d496,null));};exports[_0x65a9('0x57')]=function(_0x59b08f,_0x32139f,_0x5a5c7f){var _0xfdb09b={'raw':!![],'where':{}},_0x527858={},_0x8b1c9a;return db[_0x65a9('0x46')][_0x65a9('0x58')]({'where':{'id':_0x59b08f[_0x65a9('0x55')]['id']}})[_0x65a9('0x27')](handleEntityNotFound(_0x32139f,null))[_0x65a9('0x27')](function(_0x16d51b){if(_0x16d51b){_0x8b1c9a=_0x16d51b[_0x65a9('0x4e')]({'plain':!![]});_0x527858[_0x65a9('0x38')]=_[_0x65a9('0x35')](db['UserWhatsappQueue'][_0x65a9('0x2f')]);_0x527858[_0x65a9('0x34')]=_[_0x65a9('0x35')](_0x59b08f['query']);_0x527858['filters']=_[_0x65a9('0x37')](_0x527858[_0x65a9('0x38')],_0x527858[_0x65a9('0x34')]);_0xfdb09b[_0x65a9('0x3a')]=_[_0x65a9('0x37')](_0x527858[_0x65a9('0x38')],qs[_0x65a9('0x39')](_0x59b08f[_0x65a9('0x34')][_0x65a9('0x39')]));_0xfdb09b['attributes']=_0xfdb09b[_0x65a9('0x3a')][_0x65a9('0x3b')]?_0xfdb09b['attributes']:_0x527858['model'];if(!_0x59b08f[_0x65a9('0x34')][_0x65a9('0x3c')](_0x65a9('0x3d'))){_0xfdb09b['limit']=qs['limit'](_0x59b08f['query']['limit']);_0xfdb09b['offset']=qs[_0x65a9('0x1d')](_0x59b08f[_0x65a9('0x34')][_0x65a9('0x1d')]);}_0xfdb09b[_0x65a9('0x3e')]=qs[_0x65a9('0x3f')](_0x59b08f[_0x65a9('0x34')][_0x65a9('0x3f')]);_0xfdb09b[_0x65a9('0x40')]=qs['filters'](_[_0x65a9('0x41')](_0x59b08f['query'],_0x527858[_0x65a9('0x36')]));_0xfdb09b['where'][_0x65a9('0x59')]=_0x16d51b['id'];if(_0x59b08f[_0x65a9('0x34')][_0x65a9('0x44')]){_0xfdb09b[_0x65a9('0x40')]=_[_0x65a9('0x42')](_0xfdb09b[_0x65a9('0x40')],{'$or':_[_0x65a9('0x33')](_0xfdb09b['attributes'],function(_0x2f0cff){var _0x1e365a={};_0x1e365a[_0x2f0cff]={'$like':'%'+_0x59b08f[_0x65a9('0x34')][_0x65a9('0x44')]+'%'};return _0x1e365a;})});}_0xfdb09b=_[_0x65a9('0x42')]({},_0xfdb09b,_0x59b08f[_0x65a9('0x45')]);return db[_0x65a9('0x5a')]['findAll'](_0xfdb09b);}})[_0x65a9('0x27')](function(_0x14f92e){if(_0x14f92e){return db[_0x65a9('0x5b')][_0x65a9('0x5c')]({'where':{'id':_['map'](_0x14f92e,_0x65a9('0x5d')),'role':'agent'},'attributes':['id',_0x65a9('0x43'),_0x65a9('0x5e'),_0x65a9('0x5f'),_0x65a9('0x60')]});}})[_0x65a9('0x27')](function(_0x2b3c00){if(_0x2b3c00){return{'count':_0x2b3c00[_0x65a9('0x20')],'rows':_[_0x65a9('0x33')](_0x2b3c00[_0x65a9('0x61')],function(_0x3157cd){return{'membername':_0x3157cd[_0x65a9('0x43')],'UserId':_0x3157cd['id'],'queue_name':_0x8b1c9a[_0x65a9('0x43')],'WhatsappQueueId':_0x8b1c9a['id'],'interface':util['format']('%s/%s',_0x65a9('0x62'),_0x3157cd[_0x65a9('0x43')]),'penalty':0x0,'paused':_0x3157cd['whatsappPause'],'createdAt':_0x3157cd[_0x65a9('0x60')],'updatedAt':_0x3157cd[_0x65a9('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65a9('0x27')](respondWithFilteredResult(_0x32139f,_0xfdb09b))[_0x65a9('0x4a')](handleError(_0x32139f,null));};exports[_0x65a9('0x63')]=function(_0x2cadb7,_0x4f3c57,_0x4378b1){var _0x4c0cff={};var _0x37b920={};var _0xd7c425;var _0x538b66;return db[_0x65a9('0x46')][_0x65a9('0x58')]({'where':{'id':_0x2cadb7[_0x65a9('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f3c57,null))['then'](function(_0x48a1d0){if(_0x48a1d0){_0xd7c425=_0x48a1d0;_0x37b920[_0x65a9('0x38')]=_['keys'](db[_0x65a9('0x64')][_0x65a9('0x2f')]);_0x37b920[_0x65a9('0x34')]=_['keys'](_0x2cadb7[_0x65a9('0x34')]);_0x37b920['filters']=_[_0x65a9('0x37')](_0x37b920[_0x65a9('0x38')],_0x37b920[_0x65a9('0x34')]);_0x4c0cff[_0x65a9('0x3a')]=_[_0x65a9('0x37')](_0x37b920[_0x65a9('0x38')],qs[_0x65a9('0x39')](_0x2cadb7['query'][_0x65a9('0x39')]));_0x4c0cff[_0x65a9('0x3a')]=_0x4c0cff[_0x65a9('0x3a')]['length']?_0x4c0cff[_0x65a9('0x3a')]:_0x37b920[_0x65a9('0x38')];_0x4c0cff[_0x65a9('0x3e')]=qs[_0x65a9('0x3f')](_0x2cadb7[_0x65a9('0x34')][_0x65a9('0x3f')]);_0x4c0cff[_0x65a9('0x40')]=qs[_0x65a9('0x36')](_[_0x65a9('0x41')](_0x2cadb7[_0x65a9('0x34')],_0x37b920[_0x65a9('0x36')]));if(_0x2cadb7[_0x65a9('0x34')]['filter']){_0x4c0cff['where']=_['merge'](_0x4c0cff['where'],{'$or':_['map'](_0x4c0cff[_0x65a9('0x3a')],function(_0x591a80){var _0x13f925={};_0x13f925[_0x591a80]={'$like':'%'+_0x2cadb7[_0x65a9('0x34')][_0x65a9('0x44')]+'%'};return _0x13f925;})});}_0x4c0cff=_[_0x65a9('0x42')]({},_0x4c0cff,_0x2cadb7['options']);return _0xd7c425[_0x65a9('0x63')](_0x4c0cff);}})[_0x65a9('0x27')](function(_0x3b123c){if(_0x3b123c){_0x538b66=_0x3b123c[_0x65a9('0x3b')];if(!_0x2cadb7[_0x65a9('0x34')]['hasOwnProperty'](_0x65a9('0x3d'))){_0x4c0cff[_0x65a9('0x1f')]=qs[_0x65a9('0x1f')](_0x2cadb7[_0x65a9('0x34')][_0x65a9('0x1f')]);_0x4c0cff[_0x65a9('0x1d')]=qs[_0x65a9('0x1d')](_0x2cadb7[_0x65a9('0x34')]['offset']);}return _0xd7c425[_0x65a9('0x63')](_0x4c0cff);}})[_0x65a9('0x27')](function(_0x1ad5b9){if(_0x1ad5b9){return _0x1ad5b9?{'count':_0x538b66,'rows':_0x1ad5b9}:null;}})['then'](respondWithResult(_0x4f3c57,null))[_0x65a9('0x4a')](handleError(_0x4f3c57,null));};exports[_0x65a9('0x65')]=function(_0x262831,_0x153467,_0x54a485){var _0x13d8fa=_0x262831['body'][_0x65a9('0x66')];return db['Team'][_0x65a9('0x49')]({'where':{'id':_0x13d8fa},'attributes':['id'],'include':[{'model':db[_0x65a9('0x5b')],'as':_0x65a9('0x67'),'attributes':['id','name',_0x65a9('0x68'),_0x65a9('0x69'),_0x65a9('0x6a')],'raw':!![]}]})[_0x65a9('0x27')](function(_0x1af012){if(_0x1af012){var _0x5d58bb=_[_0x65a9('0x6b')](_0x1af012,function(_0x3290ec){var _0x5bca0d=_0x3290ec[_0x65a9('0x4e')]({'plain':!![]});return _0x5bca0d[_0x65a9('0x67')];});return db[_0x65a9('0x46')]['find']({'where':{'id':_0x262831[_0x65a9('0x55')]['id']}})[_0x65a9('0x27')](function(_0x30cbef){return db['sequelize']['transaction'](function(_0x2af623){return _0x30cbef[_0x65a9('0x65')](_0x13d8fa,{'transaction':_0x2af623})['then'](function(){return BPromise[_0x65a9('0x6c')](_0x5d58bb,function(_0x86d22e){return db['UserWhatsappQueue'][_0x65a9('0x6d')]({'where':{'UserId':_0x86d22e['id'],'WhatsappQueueId':_0x262831[_0x65a9('0x55')]['id']},'transaction':_0x2af623});});})[_0x65a9('0x27')](function(){_0x5d58bb[_0x65a9('0x6e')](function(_0x5c9ad7){socket[_0x65a9('0x6f')](_0x65a9('0x70'),{'UserId':_0x5c9ad7['id'],'WhatsappQueueId':_0x30cbef['id']});});});});});}})[_0x65a9('0x27')](respondWithStatusCode(_0x153467,null))['catch'](handleError(_0x153467,null));};exports['removeTeams']=function(_0xeda97a,_0x1cbf65,_0x32bd9c){return db[_0x65a9('0x64')]['findAll']({'where':{'id':_0xeda97a['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x65a9('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1cbf65,null))[_0x65a9('0x27')](function(_0x3b20ac){var _0x2e562c=_[_0x65a9('0x33')](_0x3b20ac,'id');var _0x24e085=[];var _0x2c36d2=[];var _0x5b2ef7=squel['select']();_0x5b2ef7[_0x65a9('0x71')](_0x65a9('0x72'))[_0x65a9('0x73')](_0x65a9('0x74'),'tq')[_0x65a9('0x75')]('user_has_teams','ut',_0x65a9('0x76'))['where'](_0x65a9('0x77'),_0xeda97a['params']['id']);for(var _0x3a51bf=0x0;_0x3a51bf<_0x3b20ac[_0x65a9('0x3b')];_0x3a51bf+=0x1){let _0x3a30bb=_0x3b20ac[_0x3a51bf];for(var _0x5d6567=0x0;_0x5d6567<_0x3a30bb[_0x65a9('0x67')]['length'];_0x5d6567+=0x1){let _0x369db8=_0x3a30bb[_0x65a9('0x67')][_0x5d6567];var _0xa602de=_0x5b2ef7[_0x65a9('0x78')]();_0xa602de[_0x65a9('0x40')]('ut.UserId\x20=\x20?',_0x369db8['id']);_0x2c36d2[_0x65a9('0x79')](db[_0x65a9('0x7a')]['query'](_0xa602de[_0x65a9('0x7b')](),{'type':db[_0x65a9('0x7a')][_0x65a9('0x7c')]['SELECT']})[_0x65a9('0x27')](function(_0xf80c1d){if(_0xf80c1d[_0x65a9('0x3b')]===0x1){return _0x369db8['id'];}else{var _0x20d161=_['every'](_[_0x65a9('0x33')](_0xf80c1d,_0x65a9('0x7d')),function(_0x582931){return _[_0x65a9('0x7e')](_0x2e562c,_0x582931);});if(_0x20d161){return _0x369db8['id'];}}}));}}return BPromise[_0x65a9('0x7f')](_0x2c36d2)[_0x65a9('0x27')](function(_0x55608a){_0x24e085=_(_0x24e085)['union'](_0x55608a)[_0x65a9('0x80')]()[_0x65a9('0x81')]();return db[_0x65a9('0x46')][_0x65a9('0x4b')]({'where':{'id':_0xeda97a[_0x65a9('0x55')]['id']}})[_0x65a9('0x27')](function(_0x2e398c){return db['sequelize'][_0x65a9('0x82')](function(_0x412b52){return _0x2e398c['removeTeams'](_0xeda97a['query'][_0x65a9('0x66')],{'transaction':_0x412b52})['then'](function(){if(!_[_0x65a9('0x83')](_0x24e085)){return _0x2e398c['removeAgents'](_0x24e085,{'transaction':_0x412b52});}})[_0x65a9('0x27')](function(){_0x24e085['forEach'](function(_0x992449){socket[_0x65a9('0x6f')](_0x65a9('0x84'),{'UserId':_0x992449,'WhatsappQueueId':_0x2e398c['id']});});});});});});})[_0x65a9('0x27')](respondWithStatusCode(_0x1cbf65,null))[_0x65a9('0x4a')](handleError(_0x1cbf65,null));};exports[_0x65a9('0x85')]=function(_0x1adc81,_0x5c72ff,_0x1a0d40){return db[_0x65a9('0x46')][_0x65a9('0x4b')]({'where':{'id':_0x1adc81[_0x65a9('0x55')]['id']}})[_0x65a9('0x27')](handleEntityNotFound(_0x5c72ff,null))[_0x65a9('0x27')](function(_0x416e48){if(_0x416e48){return _0x416e48[_0x65a9('0x85')](_0x1adc81[_0x65a9('0x54')][_0x65a9('0x66')],_[_0x65a9('0x86')](_0x1adc81[_0x65a9('0x54')],['ids','id'])||{})[_0x65a9('0x87')](function(_0x11d3a2){for(var _0x4526f7=0x0;_0x4526f7<_0x1adc81['body'][_0x65a9('0x66')][_0x65a9('0x3b')];_0x4526f7+=0x1){socket[_0x65a9('0x6f')]('userWhatsappQueue:save',{'UserId':Number(_0x1adc81[_0x65a9('0x54')][_0x65a9('0x66')][_0x4526f7]),'WhatsappQueueId':Number(_0x1adc81['params']['id'])});}return _0x11d3a2;});}})[_0x65a9('0x27')](respondWithResult(_0x5c72ff,null))[_0x65a9('0x4a')](handleError(_0x5c72ff,null));};exports['removeAgents']=function(_0x52a97f,_0x139883,_0x33f042){return db[_0x65a9('0x46')]['find']({'where':{'id':_0x52a97f[_0x65a9('0x55')]['id']}})[_0x65a9('0x27')](handleEntityNotFound(_0x139883,null))[_0x65a9('0x27')](function(_0x3d25f5){if(_0x3d25f5){return _0x3d25f5['removeAgents'](_0x52a97f[_0x65a9('0x34')][_0x65a9('0x66')])['then'](function(){if(_[_0x65a9('0x88')](_0x52a97f[_0x65a9('0x34')][_0x65a9('0x66')])){for(var _0x4c5314=0x0;_0x4c5314<_0x52a97f[_0x65a9('0x34')][_0x65a9('0x66')][_0x65a9('0x3b')];_0x4c5314+=0x1){socket[_0x65a9('0x6f')](_0x65a9('0x84'),{'UserId':Number(_0x52a97f[_0x65a9('0x34')][_0x65a9('0x66')][_0x4c5314]),'WhatsappQueueId':Number(_0x52a97f['params']['id'])});}}else{socket[_0x65a9('0x6f')](_0x65a9('0x84'),{'UserId':Number(_0x52a97f[_0x65a9('0x34')][_0x65a9('0x66')]),'WhatsappQueueId':Number(_0x52a97f[_0x65a9('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x139883,null))['catch'](handleError(_0x139883,null));};exports[_0x65a9('0x89')]=function(_0x33ddd2,_0x43342c,_0x3dfaff){var _0x53885c={};var _0x2da3d2={};var _0x540ffd;var _0x114c4c;return db['WhatsappQueue']['findOne']({'where':{'id':_0x33ddd2['params']['id']}})[_0x65a9('0x27')](handleEntityNotFound(_0x43342c,null))[_0x65a9('0x27')](function(_0x41e3cf){if(_0x41e3cf){_0x540ffd=_0x41e3cf;_0x2da3d2[_0x65a9('0x38')]=_[_0x65a9('0x35')](db[_0x65a9('0x5b')][_0x65a9('0x2f')]);_0x2da3d2[_0x65a9('0x34')]=_[_0x65a9('0x35')](_0x33ddd2['query']);_0x2da3d2[_0x65a9('0x36')]=_[_0x65a9('0x37')](_0x2da3d2[_0x65a9('0x38')],_0x2da3d2[_0x65a9('0x34')]);_0x53885c[_0x65a9('0x3a')]=_[_0x65a9('0x37')](_0x2da3d2[_0x65a9('0x38')],qs[_0x65a9('0x39')](_0x33ddd2[_0x65a9('0x34')]['fields']));_0x53885c[_0x65a9('0x3a')]=_0x53885c[_0x65a9('0x3a')][_0x65a9('0x3b')]?_0x53885c[_0x65a9('0x3a')]:_0x2da3d2[_0x65a9('0x38')];_0x53885c['order']=qs[_0x65a9('0x3f')](_0x33ddd2[_0x65a9('0x34')][_0x65a9('0x3f')]);_0x53885c['where']=qs[_0x65a9('0x36')](_[_0x65a9('0x41')](_0x33ddd2[_0x65a9('0x34')],_0x2da3d2['filters']));if(_0x33ddd2[_0x65a9('0x34')][_0x65a9('0x44')]){_0x53885c[_0x65a9('0x40')]=_['merge'](_0x53885c[_0x65a9('0x40')],{'$or':_[_0x65a9('0x33')](_0x53885c[_0x65a9('0x3a')],function(_0x52c58f){var _0x10cfe7={};_0x10cfe7[_0x52c58f]={'$like':'%'+_0x33ddd2[_0x65a9('0x34')]['filter']+'%'};return _0x10cfe7;})});}_0x53885c=_[_0x65a9('0x42')]({},_0x53885c,_0x33ddd2[_0x65a9('0x45')]);return _0x540ffd[_0x65a9('0x89')](_0x53885c);}})['then'](function(_0x391dce){if(_0x391dce){_0x114c4c=_0x391dce[_0x65a9('0x3b')];if(!_0x33ddd2[_0x65a9('0x34')][_0x65a9('0x3c')](_0x65a9('0x3d'))){_0x53885c[_0x65a9('0x1f')]=qs[_0x65a9('0x1f')](_0x33ddd2['query']['limit']);_0x53885c[_0x65a9('0x1d')]=qs[_0x65a9('0x1d')](_0x33ddd2[_0x65a9('0x34')]['offset']);}return _0x540ffd['getAgents'](_0x53885c);}})['then'](function(_0x5e2125){if(_0x5e2125){return _0x5e2125?{'count':_0x114c4c,'rows':_0x5e2125}:null;}})[_0x65a9('0x27')](respondWithResult(_0x43342c,null))[_0x65a9('0x4a')](handleError(_0x43342c,null));}; \ No newline at end of file +var _0x75e7=['every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','stack','name','index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x75e7,0x9e));var _0x775e=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x75e7[_0x40bffc];return _0x3007e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x775e('0x0'));var zipdir=require(_0x775e('0x1'));var jsonpatch=require(_0x775e('0x2'));var rp=require(_0x775e('0x3'));var moment=require(_0x775e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x775e('0x5'));var sox=require(_0x775e('0x6'));var csv=require(_0x775e('0x7'));var ejs=require(_0x775e('0x8'));var fs=require('fs');var fs_extra=require(_0x775e('0x9'));var _=require(_0x775e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x775e('0xb'));var deskjs=require(_0x775e('0xc'));var toCsv=require(_0x775e('0x7'));var querystring=require(_0x775e('0xd'));var Papa=require(_0x775e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x775e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x775e('0x10'));var logger=require(_0x775e('0x11'))(_0x775e('0x12'));var utils=require(_0x775e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x775e('0x14'));var db=require(_0x775e('0x15'))['db'];config[_0x775e('0x16')]=_[_0x775e('0x17')](config[_0x775e('0x16')],{'host':_0x775e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x775e('0x19'))[_0x775e('0x1a')](socket);function respondWithStatusCode(_0x5f2064,_0x36a81f){_0x36a81f=_0x36a81f||0xcc;return function(_0x574c0a){if(_0x574c0a){return _0x5f2064[_0x775e('0x1b')](_0x36a81f);}return _0x5f2064[_0x775e('0x1c')](_0x36a81f)['end']();};}function respondWithResult(_0xbf7cce,_0x45030d){_0x45030d=_0x45030d||0xc8;return function(_0x1c68fc){if(_0x1c68fc){return _0xbf7cce[_0x775e('0x1c')](_0x45030d)[_0x775e('0x1d')](_0x1c68fc);}};}function respondWithFilteredResult(_0x132855,_0x7e77ac){return function(_0x1632be){if(_0x1632be){var _0x3c06df=typeof _0x7e77ac[_0x775e('0x1e')]===_0x775e('0x1f')&&typeof _0x7e77ac[_0x775e('0x20')]===_0x775e('0x1f');var _0x3c531a=_0x1632be['count'];var _0xcf64a4=_0x3c06df?0x0:_0x7e77ac[_0x775e('0x1e')];var _0x34419b=_0x3c06df?_0x1632be[_0x775e('0x21')]:_0x7e77ac['offset']+_0x7e77ac[_0x775e('0x20')];var _0x166264;if(_0x34419b>=_0x3c531a){_0x34419b=_0x3c531a;_0x166264=0xc8;}else{_0x166264=0xce;}_0x132855[_0x775e('0x1c')](_0x166264);return _0x132855[_0x775e('0x22')](_0x775e('0x23'),_0xcf64a4+'-'+_0x34419b+'/'+_0x3c531a)[_0x775e('0x1d')](_0x1632be);}return null;};}function patchUpdates(_0x5eaf4a){return function(_0x826098){try{jsonpatch[_0x775e('0x24')](_0x826098,_0x5eaf4a,!![]);}catch(_0x5e89cc){return BPromise[_0x775e('0x25')](_0x5e89cc);}return _0x826098[_0x775e('0x26')]();};}function saveUpdates(_0x3b1203,_0x71edb9){return function(_0x504e19){if(_0x504e19){return _0x504e19[_0x775e('0x27')](_0x3b1203)[_0x775e('0x28')](function(_0x53f837){return _0x53f837;});}return null;};}function removeEntity(_0x49e84e,_0x465a70){return function(_0x9099c9){if(_0x9099c9){return _0x9099c9[_0x775e('0x29')]()['then'](function(){var _0x461a91=_0x9099c9[_0x775e('0x2a')]({'plain':!![]});var _0x2e0dcf=_0x775e('0x2b');return db[_0x775e('0x2c')]['destroy']({'where':{'type':_0x2e0dcf,'resourceId':_0x461a91['id']}})[_0x775e('0x28')](function(){return _0x9099c9;});})[_0x775e('0x28')](function(){_0x49e84e[_0x775e('0x1c')](0xcc)[_0x775e('0x2d')]();});}};}function handleEntityNotFound(_0x4bd3e5,_0x586db4){return function(_0x539cbf){if(!_0x539cbf){_0x4bd3e5[_0x775e('0x1b')](0x194);}return _0x539cbf;};}function handleError(_0x4aac17,_0x3dc500){_0x3dc500=_0x3dc500||0x1f4;return function(_0x25f336){logger['error'](_0x25f336[_0x775e('0x2e')]);if(_0x25f336[_0x775e('0x2f')]){delete _0x25f336['name'];}_0x4aac17[_0x775e('0x1c')](_0x3dc500)['send'](_0x25f336);};}exports[_0x775e('0x30')]=function(_0x22925b,_0x3d6436){var _0x1c89a2={},_0x47411c={},_0x5a45ec={'count':0x0,'rows':[]};var _0xd0c390=_['map'](db[_0x775e('0x31')][_0x775e('0x32')],function(_0xac1a67){return{'name':_0xac1a67[_0x775e('0x33')],'type':_0xac1a67[_0x775e('0x34')][_0x775e('0x35')]};});_0x47411c[_0x775e('0x36')]=_[_0x775e('0x37')](_0xd0c390,_0x775e('0x2f'));_0x47411c[_0x775e('0x38')]=_[_0x775e('0x39')](_0x22925b[_0x775e('0x38')]);_0x47411c[_0x775e('0x3a')]=_[_0x775e('0x3b')](_0x47411c[_0x775e('0x36')],_0x47411c[_0x775e('0x38')]);_0x1c89a2[_0x775e('0x3c')]=_[_0x775e('0x3b')](_0x47411c[_0x775e('0x36')],qs[_0x775e('0x3d')](_0x22925b[_0x775e('0x38')][_0x775e('0x3d')]));_0x1c89a2[_0x775e('0x3c')]=_0x1c89a2[_0x775e('0x3c')][_0x775e('0x3e')]?_0x1c89a2[_0x775e('0x3c')]:_0x47411c[_0x775e('0x36')];if(!_0x22925b[_0x775e('0x38')][_0x775e('0x3f')](_0x775e('0x40'))){_0x1c89a2[_0x775e('0x20')]=qs[_0x775e('0x20')](_0x22925b[_0x775e('0x38')]['limit']);_0x1c89a2['offset']=qs[_0x775e('0x1e')](_0x22925b[_0x775e('0x38')]['offset']);}_0x1c89a2[_0x775e('0x41')]=qs[_0x775e('0x42')](_0x22925b['query'][_0x775e('0x42')]);_0x1c89a2[_0x775e('0x43')]=qs[_0x775e('0x3a')](_[_0x775e('0x44')](_0x22925b['query'],_0x47411c[_0x775e('0x3a')]),_0xd0c390);if(_0x22925b[_0x775e('0x38')][_0x775e('0x45')]){_0x1c89a2[_0x775e('0x43')]=_[_0x775e('0x46')](_0x1c89a2['where'],{'$or':_[_0x775e('0x37')](_0xd0c390,function(_0x48edc7){if(_0x48edc7[_0x775e('0x34')]!==_0x775e('0x47')){var _0x2441f9={};_0x2441f9[_0x48edc7[_0x775e('0x2f')]]={'$like':'%'+_0x22925b[_0x775e('0x38')][_0x775e('0x45')]+'%'};return _0x2441f9;}})});}_0x1c89a2=_[_0x775e('0x46')]({},_0x1c89a2,_0x22925b[_0x775e('0x48')]);var _0x290d90={'where':_0x1c89a2[_0x775e('0x43')]};return db[_0x775e('0x31')]['count'](_0x290d90)['then'](function(_0x22c978){_0x5a45ec[_0x775e('0x21')]=_0x22c978;if(_0x22925b[_0x775e('0x38')][_0x775e('0x49')]){_0x1c89a2['include']=[{'all':!![]}];}return db[_0x775e('0x31')][_0x775e('0x4a')](_0x1c89a2);})[_0x775e('0x28')](function(_0x52d2e9){_0x5a45ec[_0x775e('0x4b')]=_0x52d2e9;return _0x5a45ec;})['then'](respondWithFilteredResult(_0x3d6436,_0x1c89a2))[_0x775e('0x4c')](handleError(_0x3d6436,null));};exports[_0x775e('0x4d')]=function(_0x49e283,_0x30c75e){var _0x4ff58a={'raw':!![],'where':{'id':_0x49e283['params']['id']}},_0x36db38={};_0x36db38[_0x775e('0x36')]=_[_0x775e('0x39')](db[_0x775e('0x31')][_0x775e('0x32')]);_0x36db38[_0x775e('0x38')]=_[_0x775e('0x39')](_0x49e283[_0x775e('0x38')]);_0x36db38['filters']=_[_0x775e('0x3b')](_0x36db38['model'],_0x36db38['query']);_0x4ff58a[_0x775e('0x3c')]=_[_0x775e('0x3b')](_0x36db38[_0x775e('0x36')],qs[_0x775e('0x3d')](_0x49e283[_0x775e('0x38')][_0x775e('0x3d')]));_0x4ff58a[_0x775e('0x3c')]=_0x4ff58a[_0x775e('0x3c')]['length']?_0x4ff58a['attributes']:_0x36db38['model'];if(_0x49e283[_0x775e('0x38')][_0x775e('0x49')]){_0x4ff58a['include']=[{'all':!![]}];}_0x4ff58a=_[_0x775e('0x46')]({},_0x4ff58a,_0x49e283['options']);return db[_0x775e('0x31')]['find'](_0x4ff58a)[_0x775e('0x28')](handleEntityNotFound(_0x30c75e,null))[_0x775e('0x28')](respondWithResult(_0x30c75e,null))[_0x775e('0x4c')](handleError(_0x30c75e,null));};exports['create']=function(_0x3fbf89,_0x422157){return db['WhatsappQueue']['create'](_0x3fbf89[_0x775e('0x4e')],{})['then'](function(_0x24e9fa){var _0x9f3c0f=_0x3fbf89[_0x775e('0x4f')][_0x775e('0x2a')]({'plain':!![]});if(!_0x9f3c0f)throw new Error(_0x775e('0x50'));if(_0x9f3c0f[_0x775e('0x51')]===_0x775e('0x4f')){var _0x500cd3=_0x24e9fa[_0x775e('0x2a')]({'plain':!![]});var _0xfca54=_0x775e('0x2b');return db['UserProfileSection'][_0x775e('0x52')]({'where':{'name':_0xfca54,'userProfileId':_0x9f3c0f[_0x775e('0x53')]},'raw':!![]})[_0x775e('0x28')](function(_0x357d70){if(_0x357d70&&_0x357d70[_0x775e('0x54')]===0x0){return db[_0x775e('0x2c')][_0x775e('0x55')]({'name':_0x500cd3[_0x775e('0x2f')],'resourceId':_0x500cd3['id'],'type':_0x357d70['name'],'sectionId':_0x357d70['id']},{})['then'](function(){return _0x24e9fa;});}else{return _0x24e9fa;}})[_0x775e('0x4c')](function(_0x1ec649){logger['error'](_0x775e('0x56'),_0x1ec649);throw _0x1ec649;});}return _0x24e9fa;})[_0x775e('0x28')](respondWithResult(_0x422157,0xc9))['catch'](handleError(_0x422157,null));};exports[_0x775e('0x27')]=function(_0x179fb7,_0x49119e){if(_0x179fb7[_0x775e('0x4e')]['id']){delete _0x179fb7[_0x775e('0x4e')]['id'];}return db['WhatsappQueue'][_0x775e('0x52')]({'where':{'id':_0x179fb7[_0x775e('0x57')]['id']}})[_0x775e('0x28')](handleEntityNotFound(_0x49119e,null))['then'](saveUpdates(_0x179fb7[_0x775e('0x4e')],null))['then'](respondWithResult(_0x49119e,null))[_0x775e('0x4c')](handleError(_0x49119e,null));};exports[_0x775e('0x29')]=function(_0x2c5eb8,_0x204c77){return db[_0x775e('0x31')][_0x775e('0x52')]({'where':{'id':_0x2c5eb8[_0x775e('0x57')]['id']}})['then'](handleEntityNotFound(_0x204c77,null))[_0x775e('0x28')](removeEntity(_0x204c77,null))['catch'](handleError(_0x204c77,null));};exports['describe']=function(_0x1f99f9,_0x2ed798){return db['WhatsappQueue'][_0x775e('0x58')]()['then'](respondWithResult(_0x2ed798,null))[_0x775e('0x4c')](handleError(_0x2ed798,null));};exports[_0x775e('0x59')]=function(_0x1d1c6a,_0x3e1a73,_0xfcdef0){var _0x2b56c8={'raw':!![],'where':{}},_0x489b07={},_0x56c905;return db[_0x775e('0x31')][_0x775e('0x5a')]({'where':{'id':_0x1d1c6a[_0x775e('0x57')]['id']}})[_0x775e('0x28')](handleEntityNotFound(_0x3e1a73,null))[_0x775e('0x28')](function(_0x233247){if(_0x233247){_0x56c905=_0x233247['get']({'plain':!![]});_0x489b07[_0x775e('0x36')]=_[_0x775e('0x39')](db[_0x775e('0x5b')][_0x775e('0x32')]);_0x489b07['query']=_[_0x775e('0x39')](_0x1d1c6a[_0x775e('0x38')]);_0x489b07['filters']=_[_0x775e('0x3b')](_0x489b07[_0x775e('0x36')],_0x489b07[_0x775e('0x38')]);_0x2b56c8[_0x775e('0x3c')]=_[_0x775e('0x3b')](_0x489b07['model'],qs['fields'](_0x1d1c6a['query']['fields']));_0x2b56c8[_0x775e('0x3c')]=_0x2b56c8[_0x775e('0x3c')][_0x775e('0x3e')]?_0x2b56c8[_0x775e('0x3c')]:_0x489b07[_0x775e('0x36')];if(!_0x1d1c6a[_0x775e('0x38')][_0x775e('0x3f')](_0x775e('0x40'))){_0x2b56c8[_0x775e('0x20')]=qs['limit'](_0x1d1c6a[_0x775e('0x38')][_0x775e('0x20')]);_0x2b56c8['offset']=qs[_0x775e('0x1e')](_0x1d1c6a[_0x775e('0x38')][_0x775e('0x1e')]);}_0x2b56c8[_0x775e('0x41')]=qs['sort'](_0x1d1c6a[_0x775e('0x38')][_0x775e('0x42')]);_0x2b56c8[_0x775e('0x43')]=qs['filters'](_[_0x775e('0x44')](_0x1d1c6a['query'],_0x489b07['filters']));_0x2b56c8['where'][_0x775e('0x5c')]=_0x233247['id'];if(_0x1d1c6a[_0x775e('0x38')][_0x775e('0x45')]){_0x2b56c8['where']=_[_0x775e('0x46')](_0x2b56c8[_0x775e('0x43')],{'$or':_['map'](_0x2b56c8['attributes'],function(_0x3570b1){var _0x4f853a={};_0x4f853a[_0x3570b1]={'$like':'%'+_0x1d1c6a[_0x775e('0x38')]['filter']+'%'};return _0x4f853a;})});}_0x2b56c8=_[_0x775e('0x46')]({},_0x2b56c8,_0x1d1c6a[_0x775e('0x48')]);return db[_0x775e('0x5b')][_0x775e('0x4a')](_0x2b56c8);}})[_0x775e('0x28')](function(_0x5d6f29){if(_0x5d6f29){return db['User'][_0x775e('0x5d')]({'where':{'id':_[_0x775e('0x37')](_0x5d6f29,_0x775e('0x5e')),'role':_0x775e('0x5f')},'attributes':['id','name',_0x775e('0x60'),_0x775e('0x61'),_0x775e('0x62')]});}})[_0x775e('0x28')](function(_0x2d4429){if(_0x2d4429){return{'count':_0x2d4429[_0x775e('0x21')],'rows':_['map'](_0x2d4429[_0x775e('0x4b')],function(_0x2072ef){return{'membername':_0x2072ef[_0x775e('0x2f')],'UserId':_0x2072ef['id'],'queue_name':_0x56c905[_0x775e('0x2f')],'WhatsappQueueId':_0x56c905['id'],'interface':util[_0x775e('0x63')](_0x775e('0x64'),'SIP',_0x2072ef['name']),'penalty':0x0,'paused':_0x2072ef[_0x775e('0x60')],'createdAt':_0x2072ef[_0x775e('0x62')],'updatedAt':_0x2072ef[_0x775e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x775e('0x28')](respondWithFilteredResult(_0x3e1a73,_0x2b56c8))['catch'](handleError(_0x3e1a73,null));};exports[_0x775e('0x65')]=function(_0x3e483f,_0x1dfebc,_0x5c6e53){var _0x1dfeda={};var _0x795a47={};var _0x4abc46;var _0x59b333;return db[_0x775e('0x31')][_0x775e('0x5a')]({'where':{'id':_0x3e483f[_0x775e('0x57')]['id']}})['then'](handleEntityNotFound(_0x1dfebc,null))[_0x775e('0x28')](function(_0x304061){if(_0x304061){_0x4abc46=_0x304061;_0x795a47[_0x775e('0x36')]=_[_0x775e('0x39')](db[_0x775e('0x66')][_0x775e('0x32')]);_0x795a47[_0x775e('0x38')]=_[_0x775e('0x39')](_0x3e483f[_0x775e('0x38')]);_0x795a47[_0x775e('0x3a')]=_[_0x775e('0x3b')](_0x795a47[_0x775e('0x36')],_0x795a47['query']);_0x1dfeda[_0x775e('0x3c')]=_[_0x775e('0x3b')](_0x795a47[_0x775e('0x36')],qs[_0x775e('0x3d')](_0x3e483f[_0x775e('0x38')][_0x775e('0x3d')]));_0x1dfeda[_0x775e('0x3c')]=_0x1dfeda[_0x775e('0x3c')][_0x775e('0x3e')]?_0x1dfeda[_0x775e('0x3c')]:_0x795a47[_0x775e('0x36')];_0x1dfeda['order']=qs['sort'](_0x3e483f[_0x775e('0x38')][_0x775e('0x42')]);_0x1dfeda[_0x775e('0x43')]=qs[_0x775e('0x3a')](_[_0x775e('0x44')](_0x3e483f[_0x775e('0x38')],_0x795a47[_0x775e('0x3a')]));if(_0x3e483f[_0x775e('0x38')][_0x775e('0x45')]){_0x1dfeda[_0x775e('0x43')]=_[_0x775e('0x46')](_0x1dfeda[_0x775e('0x43')],{'$or':_[_0x775e('0x37')](_0x1dfeda[_0x775e('0x3c')],function(_0x30d24d){var _0x393741={};_0x393741[_0x30d24d]={'$like':'%'+_0x3e483f[_0x775e('0x38')][_0x775e('0x45')]+'%'};return _0x393741;})});}_0x1dfeda=_['merge']({},_0x1dfeda,_0x3e483f['options']);return _0x4abc46[_0x775e('0x65')](_0x1dfeda);}})['then'](function(_0x5bf444){if(_0x5bf444){_0x59b333=_0x5bf444[_0x775e('0x3e')];if(!_0x3e483f[_0x775e('0x38')][_0x775e('0x3f')](_0x775e('0x40'))){_0x1dfeda[_0x775e('0x20')]=qs[_0x775e('0x20')](_0x3e483f['query'][_0x775e('0x20')]);_0x1dfeda['offset']=qs['offset'](_0x3e483f[_0x775e('0x38')]['offset']);}return _0x4abc46[_0x775e('0x65')](_0x1dfeda);}})[_0x775e('0x28')](function(_0x29b1c0){if(_0x29b1c0){return _0x29b1c0?{'count':_0x59b333,'rows':_0x29b1c0}:null;}})['then'](respondWithResult(_0x1dfebc,null))[_0x775e('0x4c')](handleError(_0x1dfebc,null));};exports[_0x775e('0x67')]=function(_0x163a24,_0x58cf31,_0x2f6f9b){var _0x1ed531=_0x163a24[_0x775e('0x4e')][_0x775e('0x68')];return db['Team'][_0x775e('0x4a')]({'where':{'id':_0x1ed531},'attributes':['id'],'include':[{'model':db[_0x775e('0x69')],'as':_0x775e('0x6a'),'attributes':['id',_0x775e('0x2f'),_0x775e('0x6b'),'voicePause',_0x775e('0x6c')],'raw':!![]}]})['then'](function(_0x45d534){if(_0x45d534){var _0x3da4ce=_[_0x775e('0x6d')](_0x45d534,function(_0x315b04){var _0x3971c3=_0x315b04[_0x775e('0x2a')]({'plain':!![]});return _0x3971c3[_0x775e('0x6a')];});return db[_0x775e('0x31')][_0x775e('0x52')]({'where':{'id':_0x163a24[_0x775e('0x57')]['id']}})[_0x775e('0x28')](function(_0x44c5b0){return db[_0x775e('0x6e')][_0x775e('0x6f')](function(_0x5f2a86){return _0x44c5b0[_0x775e('0x67')](_0x1ed531,{'transaction':_0x5f2a86})[_0x775e('0x28')](function(){return BPromise[_0x775e('0x70')](_0x3da4ce,function(_0x2d34e6){return db[_0x775e('0x5b')]['findOrCreate']({'where':{'UserId':_0x2d34e6['id'],'WhatsappQueueId':_0x163a24[_0x775e('0x57')]['id']},'transaction':_0x5f2a86});});})['then'](function(){_0x3da4ce[_0x775e('0x71')](function(_0x554f39){socket[_0x775e('0x72')](_0x775e('0x73'),{'UserId':_0x554f39['id'],'WhatsappQueueId':_0x44c5b0['id']});});});});});}})[_0x775e('0x28')](respondWithStatusCode(_0x58cf31,null))[_0x775e('0x4c')](handleError(_0x58cf31,null));};exports[_0x775e('0x74')]=function(_0xfd3743,_0x4e9caf,_0x32172){return db[_0x775e('0x66')]['findAll']({'where':{'id':_0xfd3743[_0x775e('0x38')][_0x775e('0x68')]},'attributes':['id'],'include':[{'model':db[_0x775e('0x69')],'as':_0x775e('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x775e('0x28')](handleEntityNotFound(_0x4e9caf,null))[_0x775e('0x28')](function(_0x255829){var _0xf41e2a=_[_0x775e('0x37')](_0x255829,'id');var _0xf4d510=[];var _0x2da56c=[];var _0x161532=squel[_0x775e('0x75')]();_0x161532[_0x775e('0x76')](_0x775e('0x77'))[_0x775e('0x78')](_0x775e('0x79'),'tq')[_0x775e('0x7a')]('user_has_teams','ut',_0x775e('0x7b'))['where'](_0x775e('0x7c'),_0xfd3743[_0x775e('0x57')]['id']);for(var _0xc36c47=0x0;_0xc36c47<_0x255829[_0x775e('0x3e')];_0xc36c47+=0x1){let _0xfa6e07=_0x255829[_0xc36c47];for(var _0x21c241=0x0;_0x21c241<_0xfa6e07[_0x775e('0x6a')]['length'];_0x21c241+=0x1){let _0x3500d8=_0xfa6e07[_0x775e('0x6a')][_0x21c241];var _0x16f41e=_0x161532[_0x775e('0x7d')]();_0x16f41e[_0x775e('0x43')](_0x775e('0x7e'),_0x3500d8['id']);_0x2da56c[_0x775e('0x7f')](db[_0x775e('0x6e')][_0x775e('0x38')](_0x16f41e[_0x775e('0x80')](),{'type':db[_0x775e('0x6e')]['QueryTypes'][_0x775e('0x81')]})[_0x775e('0x28')](function(_0x3f750e){if(_0x3f750e[_0x775e('0x3e')]===0x1){return _0x3500d8['id'];}else{var _0x328f23=_[_0x775e('0x82')](_[_0x775e('0x37')](_0x3f750e,_0x775e('0x83')),function(_0x55d141){return _[_0x775e('0x84')](_0xf41e2a,_0x55d141);});if(_0x328f23){return _0x3500d8['id'];}}}));}}return BPromise[_0x775e('0x85')](_0x2da56c)[_0x775e('0x28')](function(_0x5d97d6){_0xf4d510=_(_0xf4d510)[_0x775e('0x86')](_0x5d97d6)[_0x775e('0x87')]()[_0x775e('0x88')]();return db[_0x775e('0x31')][_0x775e('0x52')]({'where':{'id':_0xfd3743[_0x775e('0x57')]['id']}})[_0x775e('0x28')](function(_0xb0a677){return db[_0x775e('0x6e')][_0x775e('0x6f')](function(_0x4de121){return _0xb0a677['removeTeams'](_0xfd3743[_0x775e('0x38')][_0x775e('0x68')],{'transaction':_0x4de121})[_0x775e('0x28')](function(){if(!_[_0x775e('0x89')](_0xf4d510)){return _0xb0a677[_0x775e('0x8a')](_0xf4d510,{'transaction':_0x4de121});}})[_0x775e('0x28')](function(){_0xf4d510['forEach'](function(_0x5b972d){socket[_0x775e('0x72')](_0x775e('0x8b'),{'UserId':_0x5b972d,'WhatsappQueueId':_0xb0a677['id']});});});});});});})[_0x775e('0x28')](respondWithStatusCode(_0x4e9caf,null))[_0x775e('0x4c')](handleError(_0x4e9caf,null));};exports[_0x775e('0x8c')]=function(_0x1b022a,_0x2ba37b,_0xa6cd){return db[_0x775e('0x31')][_0x775e('0x52')]({'where':{'id':_0x1b022a[_0x775e('0x57')]['id']}})['then'](handleEntityNotFound(_0x2ba37b,null))[_0x775e('0x28')](function(_0x54d54e){if(_0x54d54e){return _0x54d54e[_0x775e('0x8c')](_0x1b022a[_0x775e('0x4e')][_0x775e('0x68')],_[_0x775e('0x8d')](_0x1b022a[_0x775e('0x4e')],[_0x775e('0x68'),'id'])||{})['spread'](function(_0x2d528c){for(var _0x32b36d=0x0;_0x32b36d<_0x1b022a['body'][_0x775e('0x68')][_0x775e('0x3e')];_0x32b36d+=0x1){socket[_0x775e('0x72')]('userWhatsappQueue:save',{'UserId':Number(_0x1b022a['body'][_0x775e('0x68')][_0x32b36d]),'WhatsappQueueId':Number(_0x1b022a[_0x775e('0x57')]['id'])});}return _0x2d528c;});}})[_0x775e('0x28')](respondWithResult(_0x2ba37b,null))[_0x775e('0x4c')](handleError(_0x2ba37b,null));};exports[_0x775e('0x8a')]=function(_0x3cf678,_0x56ad9a,_0xd817f8){return db[_0x775e('0x31')][_0x775e('0x52')]({'where':{'id':_0x3cf678[_0x775e('0x57')]['id']}})['then'](handleEntityNotFound(_0x56ad9a,null))[_0x775e('0x28')](function(_0x2fd2cf){if(_0x2fd2cf){return _0x2fd2cf['removeAgents'](_0x3cf678['query']['ids'])[_0x775e('0x28')](function(){if(_[_0x775e('0x8e')](_0x3cf678['query']['ids'])){for(var _0x4121fc=0x0;_0x4121fc<_0x3cf678['query']['ids']['length'];_0x4121fc+=0x1){socket[_0x775e('0x72')](_0x775e('0x8b'),{'UserId':Number(_0x3cf678[_0x775e('0x38')][_0x775e('0x68')][_0x4121fc]),'WhatsappQueueId':Number(_0x3cf678[_0x775e('0x57')]['id'])});}}else{socket[_0x775e('0x72')](_0x775e('0x8b'),{'UserId':Number(_0x3cf678[_0x775e('0x38')]['ids']),'WhatsappQueueId':Number(_0x3cf678['params']['id'])});}});}})[_0x775e('0x28')](respondWithStatusCode(_0x56ad9a,null))['catch'](handleError(_0x56ad9a,null));};exports[_0x775e('0x8f')]=function(_0x1f5024,_0x527ff5,_0x474341){var _0x5b7fcc={};var _0x3393de={};var _0x2026d6;var _0x343199;return db[_0x775e('0x31')][_0x775e('0x5a')]({'where':{'id':_0x1f5024[_0x775e('0x57')]['id']}})[_0x775e('0x28')](handleEntityNotFound(_0x527ff5,null))[_0x775e('0x28')](function(_0x1e67ef){if(_0x1e67ef){_0x2026d6=_0x1e67ef;_0x3393de['model']=_[_0x775e('0x39')](db['User']['rawAttributes']);_0x3393de[_0x775e('0x38')]=_['keys'](_0x1f5024['query']);_0x3393de[_0x775e('0x3a')]=_[_0x775e('0x3b')](_0x3393de['model'],_0x3393de[_0x775e('0x38')]);_0x5b7fcc['attributes']=_[_0x775e('0x3b')](_0x3393de['model'],qs['fields'](_0x1f5024[_0x775e('0x38')][_0x775e('0x3d')]));_0x5b7fcc[_0x775e('0x3c')]=_0x5b7fcc[_0x775e('0x3c')][_0x775e('0x3e')]?_0x5b7fcc[_0x775e('0x3c')]:_0x3393de[_0x775e('0x36')];_0x5b7fcc[_0x775e('0x41')]=qs[_0x775e('0x42')](_0x1f5024[_0x775e('0x38')][_0x775e('0x42')]);_0x5b7fcc[_0x775e('0x43')]=qs[_0x775e('0x3a')](_[_0x775e('0x44')](_0x1f5024[_0x775e('0x38')],_0x3393de[_0x775e('0x3a')]));if(_0x1f5024[_0x775e('0x38')][_0x775e('0x45')]){_0x5b7fcc[_0x775e('0x43')]=_[_0x775e('0x46')](_0x5b7fcc[_0x775e('0x43')],{'$or':_[_0x775e('0x37')](_0x5b7fcc[_0x775e('0x3c')],function(_0x21cefe){var _0x50e7ad={};_0x50e7ad[_0x21cefe]={'$like':'%'+_0x1f5024['query'][_0x775e('0x45')]+'%'};return _0x50e7ad;})});}_0x5b7fcc=_[_0x775e('0x46')]({},_0x5b7fcc,_0x1f5024[_0x775e('0x48')]);return _0x2026d6['getAgents'](_0x5b7fcc);}})[_0x775e('0x28')](function(_0x1092aa){if(_0x1092aa){_0x343199=_0x1092aa[_0x775e('0x3e')];if(!_0x1f5024[_0x775e('0x38')][_0x775e('0x3f')](_0x775e('0x40'))){_0x5b7fcc['limit']=qs[_0x775e('0x20')](_0x1f5024['query']['limit']);_0x5b7fcc[_0x775e('0x1e')]=qs[_0x775e('0x1e')](_0x1f5024['query'][_0x775e('0x1e')]);}return _0x2026d6[_0x775e('0x8f')](_0x5b7fcc);}})[_0x775e('0x28')](function(_0x47350f){if(_0x47350f){return _0x47350f?{'count':_0x343199,'rows':_0x47350f}:null;}})[_0x775e('0x28')](respondWithResult(_0x527ff5,null))[_0x775e('0x4c')](handleError(_0x527ff5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b34270a..1dbdc49 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 _0x99ea=['events','../../mysqldb','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x46371f,_0x282e44){var _0x317e58=function(_0x1fdc94){while(--_0x1fdc94){_0x46371f['push'](_0x46371f['shift']());}};_0x317e58(++_0x282e44);}(_0x99ea,0x1b0));var _0xa99e=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0x99ea[_0x15797a];return _0x3e2618;};'use strict';var EventEmitter=require(_0xa99e('0x0'));var WhatsappQueue=require(_0xa99e('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa99e('0x2')](0x0);var events={'afterCreate':_0xa99e('0x3'),'afterUpdate':'update','afterDestroy':_0xa99e('0x4')};function emitEvent(_0x11ff13){return function(_0xf5bdb4,_0x594d7b,_0xcde8d4){WhatsappQueueEvents['emit'](_0x11ff13+':'+_0xf5bdb4['id'],_0xf5bdb4);WhatsappQueueEvents[_0xa99e('0x5')](_0x11ff13,_0xf5bdb4);_0xcde8d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xa99e('0x6')](e,emitEvent(event));}}module[_0xa99e('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x2dc3=['hook','../../mysqldb','WhatsappQueue','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x2b9a5f,_0x38b555){var _0x43237f=function(_0x34b8c4){while(--_0x34b8c4){_0x2b9a5f['push'](_0x2b9a5f['shift']());}};_0x43237f(++_0x38b555);}(_0x2dc3,0x14a));var _0x32dc=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2dc3[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x32dc('0x0'))['db'][_0x32dc('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x32dc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x32dc('0x3')};function emitEvent(_0xd38526){return function(_0x64f8d1,_0x236578,_0x4fc4ad){WhatsappQueueEvents[_0x32dc('0x4')](_0xd38526+':'+_0x64f8d1['id'],_0x64f8d1);WhatsappQueueEvents[_0x32dc('0x4')](_0xd38526,_0x64f8d1);_0x4fc4ad(null);};}for(var e in events){if(events[_0x32dc('0x5')](e)){var event=events[e];WhatsappQueue[_0x32dc('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index e6a6aec..6ee87bc 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 _0x6a10=['moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6a10,0x129));var _0x06a1=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x6a10[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x06a1('0x0'));var util=require('util');var logger=require(_0x06a1('0x1'))(_0x06a1('0x2'));var moment=require(_0x06a1('0x3'));var BPromise=require(_0x06a1('0x4'));var rp=require(_0x06a1('0x5'));var fs=require('fs');var path=require(_0x06a1('0x6'));var rimraf=require(_0x06a1('0x7'));var config=require('../../config/environment');var attributes=require(_0x06a1('0x8'));module[_0x06a1('0x9')]=function(_0x6299c4,_0x62a320){return _0x6299c4[_0x06a1('0xa')](_0x06a1('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcac3=['whatsapp_queues','lodash','util','../../config/logger','api','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x38e2cd,_0x5c9ee9){var _0x21008b=function(_0x3ec738){while(--_0x3ec738){_0x38e2cd['push'](_0x38e2cd['shift']());}};_0x21008b(++_0x5c9ee9);}(_0xcac3,0x119));var _0x3cac=function(_0xc1136d,_0x3d339f){_0xc1136d=_0xc1136d-0x0;var _0x3ba510=_0xcac3[_0xc1136d];return _0x3ba510;};'use strict';var _=require(_0x3cac('0x0'));var util=require(_0x3cac('0x1'));var logger=require(_0x3cac('0x2'))(_0x3cac('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(_0x3cac('0x4'));var config=require('../../config/environment');var attributes=require(_0x3cac('0x5'));module[_0x3cac('0x6')]=function(_0x3a7f14,_0x3e9905){return _0x3a7f14[_0x3cac('0x7')](_0x3cac('0x8'),attributes,{'tableName':_0x3cac('0x9'),'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 c4acd0e..c87bfff 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 _0x7adc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','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','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','include','model','map','attributes','stringify','ShowWhatsappQueue','find','lodash','util','randomstring'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7adc,0x1d6));var _0xc7ad=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7adc[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xc7ad('0x0'));var util=require(_0xc7ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc7ad('0x2'));var fs=require('fs');var Redis=require(_0xc7ad('0x3'));var db=require(_0xc7ad('0x4'))['db'];var utils=require(_0xc7ad('0x5'));var logger=require(_0xc7ad('0x6'))(_0xc7ad('0x7'));var config=require(_0xc7ad('0x8'));var jayson=require(_0xc7ad('0x9'));var client=jayson[_0xc7ad('0xa')][_0xc7ad('0xb')]({'port':0x232a});config[_0xc7ad('0xc')]=_[_0xc7ad('0xd')](config[_0xc7ad('0xc')],{'host':_0xc7ad('0xe'),'port':0x18eb});var socket=require(_0xc7ad('0xf'))(new Redis(config[_0xc7ad('0xc')]));require(_0xc7ad('0x10'))[_0xc7ad('0x11')](socket);function respondWithRpcPromise(_0x1f6e2a,_0x560621,_0x2552ae){return new BPromise(function(_0x5d4726,_0x1fe4ca){return client[_0xc7ad('0x12')](_0x1f6e2a,_0x2552ae)[_0xc7ad('0x13')](function(_0x51fb2f){logger[_0xc7ad('0x14')](_0xc7ad('0x15'),_0x560621,_0xc7ad('0x16'));logger[_0xc7ad('0x17')](_0xc7ad('0x18'),_0x560621,_0xc7ad('0x16'),JSON['stringify'](_0x51fb2f));if(_0x51fb2f[_0xc7ad('0x19')]){if(_0x51fb2f['error'][_0xc7ad('0x1a')]===0x1f4){logger[_0xc7ad('0x19')](_0xc7ad('0x15'),_0x560621,_0x51fb2f[_0xc7ad('0x19')][_0xc7ad('0x1b')]);return _0x1fe4ca(_0x51fb2f[_0xc7ad('0x19')][_0xc7ad('0x1b')]);}logger[_0xc7ad('0x19')](_0xc7ad('0x15'),_0x560621,_0x51fb2f[_0xc7ad('0x19')]['message']);return _0x5d4726(_0x51fb2f[_0xc7ad('0x19')]['message']);}else{logger[_0xc7ad('0x14')](_0xc7ad('0x15'),_0x560621,'request\x20sent');_0x5d4726(_0x51fb2f[_0xc7ad('0x1c')][_0xc7ad('0x1b')]);}})[_0xc7ad('0x1d')](function(_0x116f75){logger['error'](_0xc7ad('0x15'),_0x560621,_0x116f75);_0x1fe4ca(_0x116f75);});});}exports[_0xc7ad('0x1e')]=function(_0x40ac49){var _0x2b675e=this;return new Promise(function(_0x3fe233,_0x18376d){return db[_0xc7ad('0x1f')][_0xc7ad('0x20')]({'raw':_0x40ac49[_0xc7ad('0x21')]?_0x40ac49[_0xc7ad('0x21')][_0xc7ad('0x22')]===undefined?!![]:![]:!![],'where':_0x40ac49['options']?_0x40ac49['options'][_0xc7ad('0x23')]||null:null,'attributes':_0x40ac49[_0xc7ad('0x21')]?_0x40ac49[_0xc7ad('0x21')]['attributes']||null:null,'limit':_0x40ac49[_0xc7ad('0x21')]?_0x40ac49[_0xc7ad('0x21')]['limit']||null:null,'include':_0x40ac49[_0xc7ad('0x21')]?_0x40ac49[_0xc7ad('0x21')][_0xc7ad('0x24')]?_['map'](_0x40ac49[_0xc7ad('0x21')][_0xc7ad('0x24')],function(_0x53dab4){return{'model':db[_0x53dab4[_0xc7ad('0x25')]],'as':_0x53dab4['as'],'attributes':_0x53dab4['attributes'],'include':_0x53dab4['include']?_[_0xc7ad('0x26')](_0x53dab4[_0xc7ad('0x24')],function(_0x530e7b){return{'model':db[_0x530e7b['model']],'as':_0x530e7b['as'],'attributes':_0x530e7b[_0xc7ad('0x27')],'include':_0x530e7b['include']?_['map'](_0x530e7b[_0xc7ad('0x24')],function(_0x196dd4){return{'model':db[_0x196dd4[_0xc7ad('0x25')]],'as':_0x196dd4['as'],'attributes':_0x196dd4[_0xc7ad('0x27')]};}):[]};}):[]};}):[]:[]})[_0xc7ad('0x13')](function(_0x199a2c){logger[_0xc7ad('0x14')]('GetWhatsappQueue',_0x40ac49);logger['debug']('GetWhatsappQueue',_0x40ac49,JSON[_0xc7ad('0x28')](_0x199a2c));_0x3fe233(_0x199a2c);})[_0xc7ad('0x1d')](function(_0x20855f){logger['error']('GetWhatsappQueue',_0x20855f[_0xc7ad('0x1b')],_0x40ac49);_0x18376d(_0x2b675e['error'](0x1f4,_0x20855f[_0xc7ad('0x1b')]));});});};exports[_0xc7ad('0x29')]=function(_0x28366a){var _0x3631b6=this;return new Promise(function(_0x54e1a8,_0x3cfab7){return db[_0xc7ad('0x1f')][_0xc7ad('0x2a')]({'raw':_0x28366a[_0xc7ad('0x21')]?_0x28366a[_0xc7ad('0x21')][_0xc7ad('0x22')]===undefined?!![]:![]:!![],'where':_0x28366a[_0xc7ad('0x21')]?_0x28366a['options'][_0xc7ad('0x23')]||null:null,'attributes':_0x28366a[_0xc7ad('0x21')]?_0x28366a['options']['attributes']||null:null,'include':_0x28366a[_0xc7ad('0x21')]?_0x28366a[_0xc7ad('0x21')][_0xc7ad('0x24')]?_['map'](_0x28366a[_0xc7ad('0x21')][_0xc7ad('0x24')],function(_0x401cfa){return{'model':db[_0x401cfa['model']],'as':_0x401cfa['as'],'attributes':_0x401cfa[_0xc7ad('0x27')],'include':_0x401cfa['include']?_['map'](_0x401cfa[_0xc7ad('0x24')],function(_0x162547){return{'model':db[_0x162547[_0xc7ad('0x25')]],'as':_0x162547['as'],'attributes':_0x162547[_0xc7ad('0x27')],'include':_0x162547[_0xc7ad('0x24')]?_[_0xc7ad('0x26')](_0x162547[_0xc7ad('0x24')],function(_0x45b3bc){return{'model':db[_0x45b3bc['model']],'as':_0x45b3bc['as'],'attributes':_0x45b3bc[_0xc7ad('0x27')]};}):[]};}):[]};}):[]:[]})[_0xc7ad('0x13')](function(_0x48b4c2){logger[_0xc7ad('0x14')]('ShowWhatsappQueue',_0x28366a);logger[_0xc7ad('0x17')](_0xc7ad('0x29'),_0x28366a,JSON[_0xc7ad('0x28')](_0x48b4c2));_0x54e1a8(_0x48b4c2);})[_0xc7ad('0x1d')](function(_0x565dde){logger[_0xc7ad('0x19')]('ShowWhatsappQueue',_0x565dde[_0xc7ad('0x1b')],_0x28366a);_0x3cfab7(_0x3631b6['error'](0x1f4,_0x565dde['message']));});});}; \ No newline at end of file +var _0xcae7=['http','redis','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','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','include','model','map','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x284885,_0x34b143){var _0x3a9710=function(_0x31eda3){while(--_0x31eda3){_0x284885['push'](_0x284885['shift']());}};_0x3a9710(++_0x34b143);}(_0xcae7,0x185));var _0x7cae=function(_0x508926,_0xa05b4f){_0x508926=_0x508926-0x0;var _0x49ab00=_0xcae7[_0x508926];return _0x49ab00;};'use strict';var _=require('lodash');var util=require(_0x7cae('0x0'));var moment=require(_0x7cae('0x1'));var BPromise=require(_0x7cae('0x2'));var rs=require(_0x7cae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cae('0x4'))['db'];var utils=require(_0x7cae('0x5'));var logger=require(_0x7cae('0x6'))(_0x7cae('0x7'));var config=require(_0x7cae('0x8'));var jayson=require(_0x7cae('0x9'));var client=jayson[_0x7cae('0xa')][_0x7cae('0xb')]({'port':0x232a});config[_0x7cae('0xc')]=_['defaults'](config['redis'],{'host':_0x7cae('0xd'),'port':0x18eb});var socket=require(_0x7cae('0xe'))(new Redis(config['redis']));require(_0x7cae('0xf'))[_0x7cae('0x10')](socket);function respondWithRpcPromise(_0x5994e4,_0x301fc9,_0x2f9966){return new BPromise(function(_0xa0b8b2,_0xf0466e){return client[_0x7cae('0x11')](_0x5994e4,_0x2f9966)[_0x7cae('0x12')](function(_0x4ada48){logger[_0x7cae('0x13')](_0x7cae('0x14'),_0x301fc9,_0x7cae('0x15'));logger[_0x7cae('0x16')](_0x7cae('0x17'),_0x301fc9,_0x7cae('0x15'),JSON[_0x7cae('0x18')](_0x4ada48));if(_0x4ada48['error']){if(_0x4ada48[_0x7cae('0x19')]['code']===0x1f4){logger['error'](_0x7cae('0x14'),_0x301fc9,_0x4ada48[_0x7cae('0x19')][_0x7cae('0x1a')]);return _0xf0466e(_0x4ada48[_0x7cae('0x19')]['message']);}logger[_0x7cae('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x301fc9,_0x4ada48[_0x7cae('0x19')]['message']);return _0xa0b8b2(_0x4ada48[_0x7cae('0x19')][_0x7cae('0x1a')]);}else{logger['info'](_0x7cae('0x14'),_0x301fc9,'request\x20sent');_0xa0b8b2(_0x4ada48[_0x7cae('0x1b')][_0x7cae('0x1a')]);}})[_0x7cae('0x1c')](function(_0x3d4efe){logger[_0x7cae('0x19')](_0x7cae('0x14'),_0x301fc9,_0x3d4efe);_0xf0466e(_0x3d4efe);});});}exports[_0x7cae('0x1d')]=function(_0x16c98e){var _0xa849ad=this;return new Promise(function(_0x202369,_0x2a0b1d){return db[_0x7cae('0x1e')]['findAll']({'raw':_0x16c98e[_0x7cae('0x1f')]?_0x16c98e[_0x7cae('0x1f')][_0x7cae('0x20')]===undefined?!![]:![]:!![],'where':_0x16c98e['options']?_0x16c98e['options'][_0x7cae('0x21')]||null:null,'attributes':_0x16c98e[_0x7cae('0x1f')]?_0x16c98e[_0x7cae('0x1f')][_0x7cae('0x22')]||null:null,'limit':_0x16c98e[_0x7cae('0x1f')]?_0x16c98e['options']['limit']||null:null,'include':_0x16c98e[_0x7cae('0x1f')]?_0x16c98e[_0x7cae('0x1f')]['include']?_['map'](_0x16c98e[_0x7cae('0x1f')][_0x7cae('0x23')],function(_0x3bde62){return{'model':db[_0x3bde62[_0x7cae('0x24')]],'as':_0x3bde62['as'],'attributes':_0x3bde62['attributes'],'include':_0x3bde62[_0x7cae('0x23')]?_[_0x7cae('0x25')](_0x3bde62[_0x7cae('0x23')],function(_0x38721d){return{'model':db[_0x38721d[_0x7cae('0x24')]],'as':_0x38721d['as'],'attributes':_0x38721d[_0x7cae('0x22')],'include':_0x38721d['include']?_['map'](_0x38721d[_0x7cae('0x23')],function(_0x16586c){return{'model':db[_0x16586c[_0x7cae('0x24')]],'as':_0x16586c['as'],'attributes':_0x16586c[_0x7cae('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14520c){logger[_0x7cae('0x13')](_0x7cae('0x1d'),_0x16c98e);logger[_0x7cae('0x16')](_0x7cae('0x1d'),_0x16c98e,JSON['stringify'](_0x14520c));_0x202369(_0x14520c);})[_0x7cae('0x1c')](function(_0x699a9){logger[_0x7cae('0x19')](_0x7cae('0x1d'),_0x699a9[_0x7cae('0x1a')],_0x16c98e);_0x2a0b1d(_0xa849ad[_0x7cae('0x19')](0x1f4,_0x699a9[_0x7cae('0x1a')]));});});};exports[_0x7cae('0x26')]=function(_0x43d7cc){var _0x4b4ab8=this;return new Promise(function(_0x5bf795,_0x415e4d){return db[_0x7cae('0x1e')][_0x7cae('0x27')]({'raw':_0x43d7cc[_0x7cae('0x1f')]?_0x43d7cc['options'][_0x7cae('0x20')]===undefined?!![]:![]:!![],'where':_0x43d7cc[_0x7cae('0x1f')]?_0x43d7cc['options'][_0x7cae('0x21')]||null:null,'attributes':_0x43d7cc['options']?_0x43d7cc[_0x7cae('0x1f')][_0x7cae('0x22')]||null:null,'include':_0x43d7cc['options']?_0x43d7cc[_0x7cae('0x1f')][_0x7cae('0x23')]?_[_0x7cae('0x25')](_0x43d7cc[_0x7cae('0x1f')]['include'],function(_0x10bd8e){return{'model':db[_0x10bd8e[_0x7cae('0x24')]],'as':_0x10bd8e['as'],'attributes':_0x10bd8e[_0x7cae('0x22')],'include':_0x10bd8e[_0x7cae('0x23')]?_['map'](_0x10bd8e[_0x7cae('0x23')],function(_0x36730d){return{'model':db[_0x36730d[_0x7cae('0x24')]],'as':_0x36730d['as'],'attributes':_0x36730d['attributes'],'include':_0x36730d['include']?_[_0x7cae('0x25')](_0x36730d['include'],function(_0x15411d){return{'model':db[_0x15411d[_0x7cae('0x24')]],'as':_0x15411d['as'],'attributes':_0x15411d[_0x7cae('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7cae('0x12')](function(_0x239a3a){logger[_0x7cae('0x13')](_0x7cae('0x26'),_0x43d7cc);logger[_0x7cae('0x16')](_0x7cae('0x26'),_0x43d7cc,JSON[_0x7cae('0x18')](_0x239a3a));_0x5bf795(_0x239a3a);})['catch'](function(_0x582e47){logger['error']('ShowWhatsappQueue',_0x582e47[_0x7cae('0x1a')],_0x43d7cc);_0x415e4d(_0x4b4ab8[_0x7cae('0x19')](0x1f4,_0x582e47['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7cd0ea7..5c6f8ed 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 _0xe43a=['removeListener','register','whatsappQueue:','remove','emit'];(function(_0x5277bc,_0x288570){var _0x5a44f1=function(_0x566d1d){while(--_0x566d1d){_0x5277bc['push'](_0x5277bc['shift']());}};_0x5a44f1(++_0x288570);}(_0xe43a,0x184));var _0xae43=function(_0x1ff22f,_0x14e658){_0x1ff22f=_0x1ff22f-0x0;var _0x4a174a=_0xe43a[_0x1ff22f];return _0x4a174a;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0xae43('0x0'),'update'];function createListener(_0x156365,_0x4c0515){return function(_0x27c27e){_0x4c0515[_0xae43('0x1')](_0x156365,_0x27c27e);};}function removeListener(_0x1dd12d,_0x56285f){return function(){WhatsappQueueEvents[_0xae43('0x2')](_0x1dd12d,_0x56285f);};}exports[_0xae43('0x3')]=function(_0x1ea610){for(var _0x3791b7=0x0,_0x68c02b=events['length'];_0x3791b7<_0x68c02b;_0x3791b7++){var _0x144938=events[_0x3791b7];var _0x359db8=createListener(_0xae43('0x4')+_0x144938,_0x1ea610);WhatsappQueueEvents['on'](_0x144938,_0x359db8);}}; \ No newline at end of file +var _0xa3c3=['remove','update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x37449d,_0x21e8e4){var _0x51d188=function(_0x154573){while(--_0x154573){_0x37449d['push'](_0x37449d['shift']());}};_0x51d188(++_0x21e8e4);}(_0xa3c3,0xf1));var _0x3a3c=function(_0x3fe204,_0x3e1c6e){_0x3fe204=_0x3fe204-0x0;var _0x56c64f=_0xa3c3[_0x3fe204];return _0x56c64f;};'use strict';var WhatsappQueueEvents=require(_0x3a3c('0x0'));var events=[_0x3a3c('0x1'),_0x3a3c('0x2'),_0x3a3c('0x3')];function createListener(_0x2e8fbf,_0x59376a){return function(_0x442ae9){_0x59376a[_0x3a3c('0x4')](_0x2e8fbf,_0x442ae9);};}function removeListener(_0x21c8b6,_0xc2ec9a){return function(){WhatsappQueueEvents[_0x3a3c('0x5')](_0x21c8b6,_0xc2ec9a);};}exports[_0x3a3c('0x6')]=function(_0xcda906){for(var _0x2dc871=0x0,_0x2ffeaf=events[_0x3a3c('0x7')];_0x2dc871<_0x2ffeaf;_0x2dc871++){var _0x5e3a91=events[_0x2dc871];var _0x5d1c9a=createListener(_0x3a3c('0x8')+_0x5e3a91,_0xcda906);WhatsappQueueEvents['on'](_0x5e3a91,_0x5d1c9a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index d8a8176..8411ad9 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 _0xd020=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd020,0xab));var _0x0d02=function(_0x2fb704,_0x322d48){_0x2fb704=_0x2fb704-0x0;var _0x10cdfd=_0xd020[_0x2fb704];return _0x10cdfd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0d02('0x0'));var timeout=require(_0x0d02('0x1'));var express=require('express');var router=express[_0x0d02('0x2')]();var fs_extra=require(_0x0d02('0x3'));var auth=require(_0x0d02('0x4'));var interaction=require(_0x0d02('0x5'));var config=require(_0x0d02('0x6'));var controller=require(_0x0d02('0x7'));router['get']('/',auth[_0x0d02('0x8')](),controller[_0x0d02('0x9')]);router['get']('/describe',auth[_0x0d02('0x8')](),controller['describe']);router[_0x0d02('0xa')]('/:id',auth[_0x0d02('0x8')](),controller['show']);router[_0x0d02('0xb')]('/',auth['isAuthenticated'](),controller[_0x0d02('0xc')]);router[_0x0d02('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x0d02('0xe')]);router[_0x0d02('0xf')](_0x0d02('0x10'),auth[_0x0d02('0x8')](),controller[_0x0d02('0x11')]);module[_0x0d02('0x12')]=router; \ No newline at end of file +var _0xed59=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','create','update','destroy','multer','util','path','express'];(function(_0x47cb15,_0x30289e){var _0xa62dbe=function(_0x3250ff){while(--_0x3250ff){_0x47cb15['push'](_0x47cb15['shift']());}};_0xa62dbe(++_0x30289e);}(_0xed59,0xec));var _0x9ed5=function(_0x51a0f8,_0x5f9857){_0x51a0f8=_0x51a0f8-0x0;var _0x32ca9b=_0xed59[_0x51a0f8];return _0x32ca9b;};'use strict';var multer=require(_0x9ed5('0x0'));var util=require(_0x9ed5('0x1'));var path=require(_0x9ed5('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ed5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ed5('0x4'));var interaction=require(_0x9ed5('0x5'));var config=require(_0x9ed5('0x6'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x9ed5('0x7')](),controller['index']);router[_0x9ed5('0x8')](_0x9ed5('0x9'),auth[_0x9ed5('0x7')](),controller[_0x9ed5('0xa')]);router[_0x9ed5('0x8')](_0x9ed5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9ed5('0x7')](),controller[_0x9ed5('0xc')]);router['put'](_0x9ed5('0xb'),auth[_0x9ed5('0x7')](),controller[_0x9ed5('0xd')]);router['delete'](_0x9ed5('0xb'),auth[_0x9ed5('0x7')](),controller[_0x9ed5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 421a51f..8f1f06a 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1ce37a,_0x97cb60){var _0x235c99=function(_0x315958){while(--_0x315958){_0x1ce37a['push'](_0x1ce37a['shift']());}};_0x235c99(++_0x97cb60);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x50565e,_0x300250){var _0x4e8575=function(_0x5ef2e3){while(--_0x5ef2e3){_0x50565e['push'](_0x50565e['shift']());}};_0x4e8575(++_0x300250);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index dbe5014..79e872c 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 _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x464fc9,_0x4289a3){var _0xb4ddd0=function(_0x4d1506){while(--_0x4d1506){_0x464fc9['push'](_0x464fc9['shift']());}};_0xb4ddd0(++_0x4289a3);}(_0xa902,0x8d));var _0x2a90=function(_0xc48d84,_0x42352d){_0xc48d84=_0xc48d84-0x0;var _0xa68c33=_0xa902[_0xc48d84];return _0xa68c33;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file +var _0x4b17=['save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply'];(function(_0x13fc3c,_0x2d78d0){var _0x284b80=function(_0x543dde){while(--_0x543dde){_0x13fc3c['push'](_0x13fc3c['shift']());}};_0x284b80(++_0x2d78d0);}(_0x4b17,0x10f));var _0x74b1=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x4b17[_0x1ae491];return _0x4958a5;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];function respondWithStatusCode(_0x5cfe85,_0x5f2865){_0x5f2865=_0x5f2865||0xcc;return function(_0x239d04){if(_0x239d04){return _0x5cfe85[_0x74b1('0x17')](_0x5f2865);}return _0x5cfe85['status'](_0x5f2865)['end']();};}function respondWithResult(_0x500ce2,_0x86390){_0x86390=_0x86390||0xc8;return function(_0x5c12eb){if(_0x5c12eb){return _0x500ce2['status'](_0x86390)[_0x74b1('0x18')](_0x5c12eb);}};}function respondWithFilteredResult(_0x12a2c0,_0x3779c5){return function(_0x420662){if(_0x420662){var _0x16b147=typeof _0x3779c5[_0x74b1('0x19')]==='undefined'&&typeof _0x3779c5[_0x74b1('0x1a')]===_0x74b1('0x1b');var _0x1a0851=_0x420662[_0x74b1('0x1c')];var _0xde2736=_0x16b147?0x0:_0x3779c5[_0x74b1('0x19')];var _0x1ab838=_0x16b147?_0x420662['count']:_0x3779c5[_0x74b1('0x19')]+_0x3779c5[_0x74b1('0x1a')];var _0x524ece;if(_0x1ab838>=_0x1a0851){_0x1ab838=_0x1a0851;_0x524ece=0xc8;}else{_0x524ece=0xce;}_0x12a2c0[_0x74b1('0x1d')](_0x524ece);return _0x12a2c0[_0x74b1('0x1e')](_0x74b1('0x1f'),_0xde2736+'-'+_0x1ab838+'/'+_0x1a0851)[_0x74b1('0x18')](_0x420662);}return null;};}function patchUpdates(_0x13bb44){return function(_0x33fee9){try{jsonpatch[_0x74b1('0x20')](_0x33fee9,_0x13bb44,!![]);}catch(_0xaac5f7){return BPromise['reject'](_0xaac5f7);}return _0x33fee9[_0x74b1('0x21')]();};}function saveUpdates(_0x4f1ec9,_0x5da0f7){return function(_0x481bf2){if(_0x481bf2){return _0x481bf2[_0x74b1('0x22')](_0x4f1ec9)[_0x74b1('0x23')](function(_0x405a22){return _0x405a22;});}return null;};}function removeEntity(_0x44bf7e,_0x563781){return function(_0x4ee88b){if(_0x4ee88b){return _0x4ee88b[_0x74b1('0x24')]()['then'](function(){_0x44bf7e[_0x74b1('0x1d')](0xcc)[_0x74b1('0x25')]();});}};}function handleEntityNotFound(_0xb5af0,_0x14a651){return function(_0x3239d8){if(!_0x3239d8){_0xb5af0[_0x74b1('0x17')](0x194);}return _0x3239d8;};}function handleError(_0x115918,_0x33fa8e){_0x33fa8e=_0x33fa8e||0x1f4;return function(_0x4c7f05){logger[_0x74b1('0x26')](_0x4c7f05[_0x74b1('0x27')]);if(_0x4c7f05[_0x74b1('0x28')]){delete _0x4c7f05['name'];}_0x115918[_0x74b1('0x1d')](_0x33fa8e)[_0x74b1('0x29')](_0x4c7f05);};}exports[_0x74b1('0x2a')]=function(_0x1b011a,_0x26d9f1){var _0x273ff1={},_0x436eda={},_0x3ce043={'count':0x0,'rows':[]};var _0x4fbe3d=_[_0x74b1('0x2b')](db[_0x74b1('0x2c')]['rawAttributes'],function(_0x543b5){return{'name':_0x543b5[_0x74b1('0x2d')],'type':_0x543b5[_0x74b1('0x2e')]['key']};});_0x436eda[_0x74b1('0x2f')]=_[_0x74b1('0x2b')](_0x4fbe3d,'name');_0x436eda[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x1b011a[_0x74b1('0x30')]);_0x436eda[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x436eda[_0x74b1('0x2f')],_0x436eda[_0x74b1('0x30')]);_0x273ff1[_0x74b1('0x34')]=_['intersection'](_0x436eda[_0x74b1('0x2f')],qs['fields'](_0x1b011a['query'][_0x74b1('0x35')]));_0x273ff1['attributes']=_0x273ff1['attributes'][_0x74b1('0x36')]?_0x273ff1[_0x74b1('0x34')]:_0x436eda[_0x74b1('0x2f')];if(!_0x1b011a[_0x74b1('0x30')][_0x74b1('0x37')](_0x74b1('0x38'))){_0x273ff1[_0x74b1('0x1a')]=qs[_0x74b1('0x1a')](_0x1b011a['query']['limit']);_0x273ff1['offset']=qs[_0x74b1('0x19')](_0x1b011a['query']['offset']);}_0x273ff1[_0x74b1('0x39')]=qs[_0x74b1('0x3a')](_0x1b011a[_0x74b1('0x30')]['sort']);_0x273ff1[_0x74b1('0x3b')]=qs['filters'](_[_0x74b1('0x3c')](_0x1b011a[_0x74b1('0x30')],_0x436eda['filters']),_0x4fbe3d);if(_0x1b011a['query'][_0x74b1('0x3d')]){_0x273ff1[_0x74b1('0x3b')]=_['merge'](_0x273ff1['where'],{'$or':_[_0x74b1('0x2b')](_0x4fbe3d,function(_0x5298f6){if(_0x5298f6[_0x74b1('0x2e')]!==_0x74b1('0x3e')){var _0x15e695={};_0x15e695[_0x5298f6[_0x74b1('0x28')]]={'$like':'%'+_0x1b011a[_0x74b1('0x30')]['filter']+'%'};return _0x15e695;}})});}_0x273ff1=_[_0x74b1('0x3f')]({},_0x273ff1,_0x1b011a['options']);var _0x41a78b={'where':_0x273ff1['where']};return db[_0x74b1('0x2c')]['count'](_0x41a78b)['then'](function(_0xcdb873){_0x3ce043[_0x74b1('0x1c')]=_0xcdb873;if(_0x1b011a[_0x74b1('0x30')]['includeAll']){_0x273ff1[_0x74b1('0x40')]=[{'all':!![]}];}return db[_0x74b1('0x2c')][_0x74b1('0x41')](_0x273ff1);})['then'](function(_0xfecdc){_0x3ce043[_0x74b1('0x42')]=_0xfecdc;return _0x3ce043;})['then'](respondWithFilteredResult(_0x26d9f1,_0x273ff1))['catch'](handleError(_0x26d9f1,null));};exports[_0x74b1('0x43')]=function(_0x2dcaf6,_0x416c8d){var _0x444870={'raw':!![],'where':{'id':_0x2dcaf6[_0x74b1('0x44')]['id']}},_0x1d9f5b={};_0x1d9f5b[_0x74b1('0x2f')]=_['keys'](db[_0x74b1('0x2c')][_0x74b1('0x45')]);_0x1d9f5b[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x2dcaf6[_0x74b1('0x30')]);_0x1d9f5b['filters']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],_0x1d9f5b['query']);_0x444870['attributes']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],qs['fields'](_0x2dcaf6[_0x74b1('0x30')][_0x74b1('0x35')]));_0x444870[_0x74b1('0x34')]=_0x444870[_0x74b1('0x34')][_0x74b1('0x36')]?_0x444870[_0x74b1('0x34')]:_0x1d9f5b[_0x74b1('0x2f')];if(_0x2dcaf6['query']['includeAll']){_0x444870['include']=[{'all':!![]}];}_0x444870=_[_0x74b1('0x3f')]({},_0x444870,_0x2dcaf6[_0x74b1('0x46')]);return db[_0x74b1('0x2c')][_0x74b1('0x47')](_0x444870)[_0x74b1('0x23')](handleEntityNotFound(_0x416c8d,null))['then'](respondWithResult(_0x416c8d,null))[_0x74b1('0x48')](handleError(_0x416c8d,null));};exports[_0x74b1('0x49')]=function(_0x18687c,_0x33c215){return db[_0x74b1('0x2c')][_0x74b1('0x49')](_0x18687c[_0x74b1('0x4a')],{})[_0x74b1('0x23')](respondWithResult(_0x33c215,0xc9))[_0x74b1('0x48')](handleError(_0x33c215,null));};exports[_0x74b1('0x22')]=function(_0x186516,_0x3038f9){if(_0x186516['body']['id']){delete _0x186516[_0x74b1('0x4a')]['id'];}return db[_0x74b1('0x2c')]['find']({'where':{'id':_0x186516[_0x74b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3038f9,null))[_0x74b1('0x23')](saveUpdates(_0x186516[_0x74b1('0x4a')],null))['then'](respondWithResult(_0x3038f9,null))[_0x74b1('0x48')](handleError(_0x3038f9,null));};exports[_0x74b1('0x24')]=function(_0x326b98,_0x549f03){return db[_0x74b1('0x2c')][_0x74b1('0x47')]({'where':{'id':_0x326b98[_0x74b1('0x44')]['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x549f03,null))[_0x74b1('0x23')](removeEntity(_0x549f03,null))['catch'](handleError(_0x549f03,null));};exports[_0x74b1('0x4b')]=function(_0x594411,_0x11bfca){return db[_0x74b1('0x2c')]['describe']()[_0x74b1('0x23')](respondWithResult(_0x11bfca,null))[_0x74b1('0x48')](handleError(_0x11bfca,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 05f9329..30fbdf1 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 _0x548b=['uniqueid','lodash','util','../../config/logger','api','moment','path','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x10eb3c,_0x35fdc9){var _0x5122d8=function(_0x528f8c){while(--_0x528f8c){_0x10eb3c['push'](_0x10eb3c['shift']());}};_0x5122d8(++_0x35fdc9);}(_0x548b,0x14b));var _0xb548=function(_0x520c0f,_0x28dcdc){_0x520c0f=_0x520c0f-0x0;var _0x44cf48=_0x548b[_0x520c0f];return _0x44cf48;};'use strict';var _=require(_0xb548('0x0'));var util=require(_0xb548('0x1'));var logger=require(_0xb548('0x2'))(_0xb548('0x3'));var moment=require(_0xb548('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb548('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb548('0x6'));module[_0xb548('0x7')]=function(_0x4b080f,_0x43ae6e){return _0x4b080f[_0xb548('0x8')](_0xb548('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb548('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0b8=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xc0b8,0x12e));var _0x8c0b=function(_0x1777e6,_0x572127){_0x1777e6=_0x1777e6-0x0;var _0x557e36=_0xc0b8[_0x1777e6];return _0x557e36;};'use strict';var _=require(_0x8c0b('0x0'));var util=require(_0x8c0b('0x1'));var logger=require('../../config/logger')(_0x8c0b('0x2'));var moment=require(_0x8c0b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c0b('0x4'));var rimraf=require(_0x8c0b('0x5'));var config=require(_0x8c0b('0x6'));var attributes=require(_0x8c0b('0x7'));module[_0x8c0b('0x8')]=function(_0x21c23e,_0x10f70a){return _0x21c23e[_0x8c0b('0x9')](_0x8c0b('0xa'),attributes,{'tableName':_0x8c0b('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8c0b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7446e99..f51cb55 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 _0xb881=['attributes','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','UpdateWhatsappQueueReport','update','options','where'];(function(_0x2f3be0,_0x3f00e6){var _0x3b0a49=function(_0x321fd9){while(--_0x321fd9){_0x2f3be0['push'](_0x2f3be0['shift']());}};_0x3b0a49(++_0x3f00e6);}(_0xb881,0x119));var _0x1b88=function(_0x1278b6,_0x24252e){_0x1278b6=_0x1278b6-0x0;var _0x2cff42=_0xb881[_0x1278b6];return _0x2cff42;};'use strict';var _=require('lodash');var util=require(_0x1b88('0x0'));var moment=require(_0x1b88('0x1'));var BPromise=require(_0x1b88('0x2'));var rs=require(_0x1b88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b88('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1b88('0x5'));var config=require(_0x1b88('0x6'));var jayson=require(_0x1b88('0x7'));var client=jayson['client'][_0x1b88('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33f00a,_0x3a3618,_0x3583d8){return new BPromise(function(_0x5d0b97,_0x50971d){return client['request'](_0x33f00a,_0x3583d8)[_0x1b88('0x9')](function(_0x5ba92a){logger[_0x1b88('0xa')](_0x1b88('0xb'),_0x3a3618,_0x1b88('0xc'));logger[_0x1b88('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3a3618,_0x1b88('0xc'),JSON['stringify'](_0x5ba92a));if(_0x5ba92a[_0x1b88('0xe')]){if(_0x5ba92a['error']['code']===0x1f4){logger[_0x1b88('0xe')](_0x1b88('0xb'),_0x3a3618,_0x5ba92a[_0x1b88('0xe')][_0x1b88('0xf')]);return _0x50971d(_0x5ba92a['error'][_0x1b88('0xf')]);}logger[_0x1b88('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3a3618,_0x5ba92a[_0x1b88('0xe')]['message']);return _0x5d0b97(_0x5ba92a[_0x1b88('0xe')][_0x1b88('0xf')]);}else{logger[_0x1b88('0xa')](_0x1b88('0xb'),_0x3a3618,'request\x20sent');_0x5d0b97(_0x5ba92a[_0x1b88('0x10')][_0x1b88('0xf')]);}})[_0x1b88('0x11')](function(_0x31f041){logger['error'](_0x1b88('0xb'),_0x3a3618,_0x31f041);_0x50971d(_0x31f041);});});}exports[_0x1b88('0x12')]=function(_0x352d39){var _0xb8a784=this;return new Promise(function(_0x2c24a7,_0x18811f){return db[_0x1b88('0x13')][_0x1b88('0x14')](_0x352d39[_0x1b88('0x15')],{'raw':_0x352d39['options']?_0x352d39['options'][_0x1b88('0x16')]===undefined?!![]:![]:!![]})[_0x1b88('0x9')](function(_0x324647){logger[_0x1b88('0xa')](_0x1b88('0x12'),_0x352d39);logger[_0x1b88('0xd')](_0x1b88('0x12'),_0x352d39,JSON['stringify'](_0x324647));_0x2c24a7(_0x324647);})['catch'](function(_0x338952){logger['error'](_0x1b88('0x12'),_0x338952[_0x1b88('0xf')],_0x352d39);_0x18811f(_0xb8a784[_0x1b88('0xe')](0x1f4,_0x338952[_0x1b88('0xf')]));});});};exports[_0x1b88('0x17')]=function(_0x1f6499){var _0x353ae1=this;return new Promise(function(_0x4cabb9,_0x435bc5){return db[_0x1b88('0x13')][_0x1b88('0x18')](_0x1f6499['body'],{'raw':_0x1f6499['options']?_0x1f6499[_0x1b88('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f6499[_0x1b88('0x19')]?_0x1f6499[_0x1b88('0x19')][_0x1b88('0x1a')]||null:null,'attributes':_0x1f6499[_0x1b88('0x19')]?_0x1f6499['options'][_0x1b88('0x1b')]||null:null,'limit':_0x1f6499[_0x1b88('0x19')]?_0x1f6499['options']['limit']||null:null})['then'](function(_0x569e80){logger['info'](_0x1b88('0x17'),_0x1f6499);logger[_0x1b88('0xd')]('UpdateWhatsappQueueReport',_0x1f6499,JSON['stringify'](_0x569e80));_0x4cabb9(_0x569e80);})[_0x1b88('0x11')](function(_0x34a016){logger[_0x1b88('0xe')](_0x1b88('0x17'),_0x34a016['message'],_0x1f6499);_0x435bc5(_0x353ae1['error'](0x1f4,_0x34a016[_0x1b88('0xf')]));});});}; \ No newline at end of file +var _0xaefc=['attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','debug','UpdateWhatsappQueueReport','update','where'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xaefc,0xe9));var _0xcaef=function(_0x321985,_0x15180c){_0x321985=_0x321985-0x0;var _0x1f09f5=_0xaefc[_0x321985];return _0x1f09f5;};'use strict';var _=require(_0xcaef('0x0'));var util=require(_0xcaef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcaef('0x2'));var fs=require('fs');var Redis=require(_0xcaef('0x3'));var db=require(_0xcaef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaef('0x5'))(_0xcaef('0x6'));var config=require(_0xcaef('0x7'));var jayson=require(_0xcaef('0x8'));var client=jayson[_0xcaef('0x9')][_0xcaef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5452d1,_0x189fe1,_0x2dc529){return new BPromise(function(_0x58a340,_0x5b0ac2){return client[_0xcaef('0xb')](_0x5452d1,_0x2dc529)[_0xcaef('0xc')](function(_0x3e8266){logger[_0xcaef('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x189fe1,_0xcaef('0xe'));logger['debug'](_0xcaef('0xf'),_0x189fe1,_0xcaef('0xe'),JSON[_0xcaef('0x10')](_0x3e8266));if(_0x3e8266[_0xcaef('0x11')]){if(_0x3e8266['error']['code']===0x1f4){logger['error'](_0xcaef('0x12'),_0x189fe1,_0x3e8266[_0xcaef('0x11')][_0xcaef('0x13')]);return _0x5b0ac2(_0x3e8266[_0xcaef('0x11')][_0xcaef('0x13')]);}logger[_0xcaef('0x11')](_0xcaef('0x12'),_0x189fe1,_0x3e8266['error']['message']);return _0x58a340(_0x3e8266['error'][_0xcaef('0x13')]);}else{logger[_0xcaef('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x189fe1,'request\x20sent');_0x58a340(_0x3e8266[_0xcaef('0x14')][_0xcaef('0x13')]);}})[_0xcaef('0x15')](function(_0x4e052e){logger[_0xcaef('0x11')](_0xcaef('0x12'),_0x189fe1,_0x4e052e);_0x5b0ac2(_0x4e052e);});});}exports['CreateWhatsappQueueReport']=function(_0x272c8c){var _0x5599a1=this;return new Promise(function(_0x22100f,_0x560d25){return db[_0xcaef('0x16')]['create'](_0x272c8c[_0xcaef('0x17')],{'raw':_0x272c8c[_0xcaef('0x18')]?_0x272c8c[_0xcaef('0x18')][_0xcaef('0x19')]===undefined?!![]:![]:!![]})[_0xcaef('0xc')](function(_0x4a477e){logger[_0xcaef('0xd')](_0xcaef('0x1a'),_0x272c8c);logger[_0xcaef('0x1b')](_0xcaef('0x1a'),_0x272c8c,JSON[_0xcaef('0x10')](_0x4a477e));_0x22100f(_0x4a477e);})[_0xcaef('0x15')](function(_0x3ed082){logger['error'](_0xcaef('0x1a'),_0x3ed082[_0xcaef('0x13')],_0x272c8c);_0x560d25(_0x5599a1[_0xcaef('0x11')](0x1f4,_0x3ed082[_0xcaef('0x13')]));});});};exports[_0xcaef('0x1c')]=function(_0x3707b0){var _0x319aa8=this;return new Promise(function(_0x28afcb,_0x208f4f){return db[_0xcaef('0x16')][_0xcaef('0x1d')](_0x3707b0[_0xcaef('0x17')],{'raw':_0x3707b0['options']?_0x3707b0['options'][_0xcaef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3707b0[_0xcaef('0x18')]?_0x3707b0[_0xcaef('0x18')][_0xcaef('0x1e')]||null:null,'attributes':_0x3707b0[_0xcaef('0x18')]?_0x3707b0[_0xcaef('0x18')][_0xcaef('0x1f')]||null:null,'limit':_0x3707b0[_0xcaef('0x18')]?_0x3707b0[_0xcaef('0x18')][_0xcaef('0x20')]||null:null})[_0xcaef('0xc')](function(_0x303204){logger[_0xcaef('0xd')](_0xcaef('0x1c'),_0x3707b0);logger[_0xcaef('0x1b')](_0xcaef('0x1c'),_0x3707b0,JSON[_0xcaef('0x10')](_0x303204));_0x28afcb(_0x303204);})[_0xcaef('0x15')](function(_0x360f32){logger[_0xcaef('0x11')](_0xcaef('0x1c'),_0x360f32[_0xcaef('0x13')],_0x3707b0);_0x208f4f(_0x319aa8['error'](0x1f4,_0x360f32[_0xcaef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index ea399dd..071d416 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 _0x4e5c=['/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','describe'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4e5c,0x16f));var _0xc4e5=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x4e5c[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0xc4e5('0x0'));var util=require(_0xc4e5('0x1'));var path=require(_0xc4e5('0x2'));var timeout=require('connect-timeout');var express=require(_0xc4e5('0x3'));var router=express[_0xc4e5('0x4')]();var fs_extra=require(_0xc4e5('0x5'));var auth=require(_0xc4e5('0x6'));var interaction=require(_0xc4e5('0x7'));var config=require(_0xc4e5('0x8'));var controller=require(_0xc4e5('0x9'));router[_0xc4e5('0xa')]('/',auth[_0xc4e5('0xb')](),controller['index']);router[_0xc4e5('0xa')]('/describe',auth[_0xc4e5('0xb')](),controller[_0xc4e5('0xc')]);router[_0xc4e5('0xa')](_0xc4e5('0xd'),auth[_0xc4e5('0xb')](),controller['show']);router[_0xc4e5('0xe')]('/',auth[_0xc4e5('0xb')](),controller['create']);router[_0xc4e5('0xf')](_0xc4e5('0xd'),auth[_0xc4e5('0xb')](),controller[_0xc4e5('0x10')]);router[_0xc4e5('0x11')](_0xc4e5('0xd'),auth['isAuthenticated'](),controller[_0xc4e5('0x12')]);module[_0xc4e5('0x13')]=router; \ No newline at end of file +var _0x921b=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','show','put','/:id','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x237a99,_0x3e4ff9){var _0x2ae3ca=function(_0x27efc1){while(--_0x27efc1){_0x237a99['push'](_0x237a99['shift']());}};_0x2ae3ca(++_0x3e4ff9);}(_0x921b,0x184));var _0xb921=function(_0x193b3c,_0x336b1){_0x193b3c=_0x193b3c-0x0;var _0x4bac60=_0x921b[_0x193b3c];return _0x4bac60;};'use strict';var multer=require(_0xb921('0x0'));var util=require('util');var path=require(_0xb921('0x1'));var timeout=require(_0xb921('0x2'));var express=require(_0xb921('0x3'));var router=express[_0xb921('0x4')]();var fs_extra=require(_0xb921('0x5'));var auth=require(_0xb921('0x6'));var interaction=require(_0xb921('0x7'));var config=require(_0xb921('0x8'));var controller=require(_0xb921('0x9'));router[_0xb921('0xa')]('/',auth[_0xb921('0xb')](),controller[_0xb921('0xc')]);router['get'](_0xb921('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xb921('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb921('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb921('0xf')](_0xb921('0x10'),auth[_0xb921('0xb')](),controller[_0xb921('0x11')]);router['delete'](_0xb921('0x10'),auth[_0xb921('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 87a46b7..d18e957 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 _0xc35f=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x487daf,_0x2c8a74){var _0x8e2c53=function(_0x213bb2){while(--_0x213bb2){_0x487daf['push'](_0x487daf['shift']());}};_0x8e2c53(++_0x2c8a74);}(_0xc35f,0x1ca));var _0xfc35=function(_0x2d513e,_0x5152b9){_0x2d513e=_0x2d513e-0x0;var _0x67db68=_0xc35f[_0x2d513e];return _0x67db68;};'use strict';var Sequelize=require(_0xfc35('0x0'));module[_0xfc35('0x1')]={'uniqueid':{'type':Sequelize[_0xfc35('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfc35('0x3')]('account',_0xfc35('0x4'),_0xfc35('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfc35('0x6')]}}; \ No newline at end of file +var _0xa321=['queue','sequelize','exports','STRING','ENUM','agent'];(function(_0x2a7546,_0x4be87a){var _0x5dc914=function(_0x5ccef2){while(--_0x5ccef2){_0x2a7546['push'](_0x2a7546['shift']());}};_0x5dc914(++_0x4be87a);}(_0xa321,0x9d));var _0x1a32=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xa321[_0x52666e];return _0x515330;};'use strict';var Sequelize=require(_0x1a32('0x0'));module[_0x1a32('0x1')]={'uniqueid':{'type':Sequelize[_0x1a32('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1a32('0x3')]('account',_0x1a32('0x4'),_0x1a32('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6175e93..4fd30ef 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 _0x64b8=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../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','index','WhatsappTransferReport','rawAttributes','fieldName','type','name','query','filters','intersection','model'];(function(_0x406053,_0x3366c7){var _0x2d1875=function(_0x1eb73f){while(--_0x1eb73f){_0x406053['push'](_0x406053['shift']());}};_0x2d1875(++_0x3366c7);}(_0x64b8,0x14b));var _0x864b=function(_0x32774f,_0x6f7f11){_0x32774f=_0x32774f-0x0;var _0x432db8=_0x64b8[_0x32774f];return _0x432db8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x864b('0x0'));var zipdir=require(_0x864b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x864b('0x2'));var moment=require(_0x864b('0x3'));var BPromise=require(_0x864b('0x4'));var Mustache=require(_0x864b('0x5'));var util=require(_0x864b('0x6'));var path=require(_0x864b('0x7'));var sox=require(_0x864b('0x8'));var csv=require(_0x864b('0x9'));var ejs=require(_0x864b('0xa'));var fs=require('fs');var fs_extra=require(_0x864b('0xb'));var _=require(_0x864b('0xc'));var squel=require(_0x864b('0xd'));var crypto=require(_0x864b('0xe'));var jsforce=require(_0x864b('0xf'));var deskjs=require(_0x864b('0x10'));var toCsv=require(_0x864b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x864b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x864b('0x12'));var as=require(_0x864b('0x13'));var hardwareService=require(_0x864b('0x14'));var logger=require('../../config/logger')(_0x864b('0x15'));var utils=require(_0x864b('0x16'));var config=require(_0x864b('0x17'));var licenseUtil=require(_0x864b('0x18'));var db=require(_0x864b('0x19'))['db'];function respondWithStatusCode(_0x2f3f5c,_0x18e3bb){_0x18e3bb=_0x18e3bb||0xcc;return function(_0x263d14){if(_0x263d14){return _0x2f3f5c[_0x864b('0x1a')](_0x18e3bb);}return _0x2f3f5c['status'](_0x18e3bb)[_0x864b('0x1b')]();};}function respondWithResult(_0x1fbea2,_0x3f9376){_0x3f9376=_0x3f9376||0xc8;return function(_0x33986e){if(_0x33986e){return _0x1fbea2[_0x864b('0x1c')](_0x3f9376)[_0x864b('0x1d')](_0x33986e);}};}function respondWithFilteredResult(_0x4c2118,_0x445196){return function(_0x3152a9){if(_0x3152a9){var _0x154a27=typeof _0x445196[_0x864b('0x1e')]===_0x864b('0x1f')&&typeof _0x445196[_0x864b('0x20')]===_0x864b('0x1f');var _0x3240d6=_0x3152a9[_0x864b('0x21')];var _0x17e830=_0x154a27?0x0:_0x445196[_0x864b('0x1e')];var _0x3233b2=_0x154a27?_0x3152a9[_0x864b('0x21')]:_0x445196[_0x864b('0x1e')]+_0x445196[_0x864b('0x20')];var _0x8297b;if(_0x3233b2>=_0x3240d6){_0x3233b2=_0x3240d6;_0x8297b=0xc8;}else{_0x8297b=0xce;}_0x4c2118[_0x864b('0x1c')](_0x8297b);return _0x4c2118[_0x864b('0x22')](_0x864b('0x23'),_0x17e830+'-'+_0x3233b2+'/'+_0x3240d6)[_0x864b('0x1d')](_0x3152a9);}return null;};}function patchUpdates(_0x3048b1){return function(_0x3371f4){try{jsonpatch[_0x864b('0x24')](_0x3371f4,_0x3048b1,!![]);}catch(_0x96bc4b){return BPromise[_0x864b('0x25')](_0x96bc4b);}return _0x3371f4[_0x864b('0x26')]();};}function saveUpdates(_0x434738,_0x1dec91){return function(_0x45c816){if(_0x45c816){return _0x45c816[_0x864b('0x27')](_0x434738)[_0x864b('0x28')](function(_0x28e1b4){return _0x28e1b4;});}return null;};}function removeEntity(_0x28f941,_0x1eff9b){return function(_0x501ffc){if(_0x501ffc){return _0x501ffc[_0x864b('0x29')]()[_0x864b('0x28')](function(){_0x28f941['status'](0xcc)[_0x864b('0x1b')]();});}};}function handleEntityNotFound(_0x3476ec,_0x1175ab){return function(_0x4284eb){if(!_0x4284eb){_0x3476ec['sendStatus'](0x194);}return _0x4284eb;};}function handleError(_0x578ac5,_0x464dcf){_0x464dcf=_0x464dcf||0x1f4;return function(_0x2dec87){logger[_0x864b('0x2a')](_0x2dec87[_0x864b('0x2b')]);if(_0x2dec87['name']){delete _0x2dec87['name'];}_0x578ac5[_0x864b('0x1c')](_0x464dcf)['send'](_0x2dec87);};}exports[_0x864b('0x2c')]=function(_0x7adf04,_0x36926e){var _0x53ef17={},_0x39f9c4={},_0x65d18f={'count':0x0,'rows':[]};var _0x2d5c94=_['map'](db[_0x864b('0x2d')][_0x864b('0x2e')],function(_0x2c15bb){return{'name':_0x2c15bb[_0x864b('0x2f')],'type':_0x2c15bb[_0x864b('0x30')]['key']};});_0x39f9c4['model']=_['map'](_0x2d5c94,_0x864b('0x31'));_0x39f9c4[_0x864b('0x32')]=_['keys'](_0x7adf04[_0x864b('0x32')]);_0x39f9c4[_0x864b('0x33')]=_[_0x864b('0x34')](_0x39f9c4[_0x864b('0x35')],_0x39f9c4[_0x864b('0x32')]);_0x53ef17[_0x864b('0x36')]=_[_0x864b('0x34')](_0x39f9c4[_0x864b('0x35')],qs[_0x864b('0x37')](_0x7adf04[_0x864b('0x32')]['fields']));_0x53ef17['attributes']=_0x53ef17[_0x864b('0x36')][_0x864b('0x38')]?_0x53ef17[_0x864b('0x36')]:_0x39f9c4[_0x864b('0x35')];if(!_0x7adf04[_0x864b('0x32')][_0x864b('0x39')](_0x864b('0x3a'))){_0x53ef17[_0x864b('0x20')]=qs[_0x864b('0x20')](_0x7adf04['query'][_0x864b('0x20')]);_0x53ef17[_0x864b('0x1e')]=qs[_0x864b('0x1e')](_0x7adf04['query'][_0x864b('0x1e')]);}_0x53ef17['order']=qs['sort'](_0x7adf04['query'][_0x864b('0x3b')]);_0x53ef17[_0x864b('0x3c')]=qs[_0x864b('0x33')](_[_0x864b('0x3d')](_0x7adf04['query'],_0x39f9c4[_0x864b('0x33')]),_0x2d5c94);if(_0x7adf04[_0x864b('0x32')]['filter']){_0x53ef17['where']=_[_0x864b('0x3e')](_0x53ef17[_0x864b('0x3c')],{'$or':_[_0x864b('0x3f')](_0x2d5c94,function(_0x2ec55b){if(_0x2ec55b[_0x864b('0x30')]!==_0x864b('0x40')){var _0x4f7967={};_0x4f7967[_0x2ec55b['name']]={'$like':'%'+_0x7adf04[_0x864b('0x32')][_0x864b('0x41')]+'%'};return _0x4f7967;}})});}_0x53ef17=_[_0x864b('0x3e')]({},_0x53ef17,_0x7adf04[_0x864b('0x42')]);var _0x5947c8={'where':_0x53ef17[_0x864b('0x3c')]};return db[_0x864b('0x2d')][_0x864b('0x21')](_0x5947c8)[_0x864b('0x28')](function(_0x46dc50){_0x65d18f[_0x864b('0x21')]=_0x46dc50;if(_0x7adf04['query'][_0x864b('0x43')]){_0x53ef17[_0x864b('0x44')]=[{'all':!![]}];}return db[_0x864b('0x2d')][_0x864b('0x45')](_0x53ef17);})[_0x864b('0x28')](function(_0x4a913a){_0x65d18f[_0x864b('0x46')]=_0x4a913a;return _0x65d18f;})[_0x864b('0x28')](respondWithFilteredResult(_0x36926e,_0x53ef17))[_0x864b('0x47')](handleError(_0x36926e,null));};exports['show']=function(_0x53e685,_0xfed0c){var _0x4cda8d={'raw':!![],'where':{'id':_0x53e685['params']['id']}},_0x11b2ca={};_0x11b2ca[_0x864b('0x35')]=_[_0x864b('0x48')](db[_0x864b('0x2d')]['rawAttributes']);_0x11b2ca[_0x864b('0x32')]=_['keys'](_0x53e685['query']);_0x11b2ca[_0x864b('0x33')]=_[_0x864b('0x34')](_0x11b2ca[_0x864b('0x35')],_0x11b2ca[_0x864b('0x32')]);_0x4cda8d['attributes']=_[_0x864b('0x34')](_0x11b2ca[_0x864b('0x35')],qs[_0x864b('0x37')](_0x53e685[_0x864b('0x32')][_0x864b('0x37')]));_0x4cda8d['attributes']=_0x4cda8d['attributes'][_0x864b('0x38')]?_0x4cda8d[_0x864b('0x36')]:_0x11b2ca[_0x864b('0x35')];if(_0x53e685[_0x864b('0x32')][_0x864b('0x43')]){_0x4cda8d[_0x864b('0x44')]=[{'all':!![]}];}_0x4cda8d=_[_0x864b('0x3e')]({},_0x4cda8d,_0x53e685[_0x864b('0x42')]);return db[_0x864b('0x2d')][_0x864b('0x49')](_0x4cda8d)[_0x864b('0x28')](handleEntityNotFound(_0xfed0c,null))[_0x864b('0x28')](respondWithResult(_0xfed0c,null))[_0x864b('0x47')](handleError(_0xfed0c,null));};exports[_0x864b('0x4a')]=function(_0xa752b4,_0x88c3ce){return db[_0x864b('0x2d')][_0x864b('0x4a')](_0xa752b4['body'],{})['then'](respondWithResult(_0x88c3ce,0xc9))[_0x864b('0x47')](handleError(_0x88c3ce,null));};exports[_0x864b('0x27')]=function(_0x1d51d7,_0x35f3da){if(_0x1d51d7[_0x864b('0x4b')]['id']){delete _0x1d51d7[_0x864b('0x4b')]['id'];}return db['WhatsappTransferReport'][_0x864b('0x49')]({'where':{'id':_0x1d51d7['params']['id']}})['then'](handleEntityNotFound(_0x35f3da,null))[_0x864b('0x28')](saveUpdates(_0x1d51d7['body'],null))[_0x864b('0x28')](respondWithResult(_0x35f3da,null))[_0x864b('0x47')](handleError(_0x35f3da,null));};exports[_0x864b('0x29')]=function(_0x48c455,_0x2b8fb9){return db[_0x864b('0x2d')][_0x864b('0x49')]({'where':{'id':_0x48c455[_0x864b('0x4c')]['id']}})[_0x864b('0x28')](handleEntityNotFound(_0x2b8fb9,null))['then'](removeEntity(_0x2b8fb9,null))['catch'](handleError(_0x2b8fb9,null));};exports['describe']=function(_0x4f3d2d,_0x24e2ea){return db[_0x864b('0x2d')]['describe']()[_0x864b('0x28')](respondWithResult(_0x24e2ea,null))[_0x864b('0x47')](handleError(_0x24e2ea,null));}; \ No newline at end of file +var _0x7381=['include','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','fast-json-patch','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','type','VIRTUAL','merge','includeAll'];(function(_0xaff6e6,_0x9b17a1){var _0x43c779=function(_0x420a51){while(--_0x420a51){_0xaff6e6['push'](_0xaff6e6['shift']());}};_0x43c779(++_0x9b17a1);}(_0x7381,0x133));var _0x1738=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x7381[_0x291aaf];return _0x5571e6;};'use strict';var emlformat=require(_0x1738('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1738('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1738('0x2'));var sox=require(_0x1738('0x3'));var csv=require('to-csv');var ejs=require(_0x1738('0x4'));var fs=require('fs');var fs_extra=require(_0x1738('0x5'));var _=require(_0x1738('0x6'));var squel=require(_0x1738('0x7'));var crypto=require(_0x1738('0x8'));var jsforce=require(_0x1738('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x1738('0xa'));var querystring=require(_0x1738('0xb'));var Papa=require(_0x1738('0xc'));var Redis=require(_0x1738('0xd'));var authService=require(_0x1738('0xe'));var qs=require(_0x1738('0xf'));var as=require(_0x1738('0x10'));var hardwareService=require(_0x1738('0x11'));var logger=require('../../config/logger')(_0x1738('0x12'));var utils=require(_0x1738('0x13'));var config=require(_0x1738('0x14'));var licenseUtil=require(_0x1738('0x15'));var db=require(_0x1738('0x16'))['db'];function respondWithStatusCode(_0x52c168,_0x192979){_0x192979=_0x192979||0xcc;return function(_0x5d2fe6){if(_0x5d2fe6){return _0x52c168['sendStatus'](_0x192979);}return _0x52c168[_0x1738('0x17')](_0x192979)[_0x1738('0x18')]();};}function respondWithResult(_0x1cf395,_0x103e32){_0x103e32=_0x103e32||0xc8;return function(_0xb1c1d6){if(_0xb1c1d6){return _0x1cf395[_0x1738('0x17')](_0x103e32)[_0x1738('0x19')](_0xb1c1d6);}};}function respondWithFilteredResult(_0x1f512c,_0xf28a16){return function(_0x3f2543){if(_0x3f2543){var _0x4bd619=typeof _0xf28a16[_0x1738('0x1a')]==='undefined'&&typeof _0xf28a16[_0x1738('0x1b')]===_0x1738('0x1c');var _0x547362=_0x3f2543[_0x1738('0x1d')];var _0x1cf209=_0x4bd619?0x0:_0xf28a16['offset'];var _0x5583ef=_0x4bd619?_0x3f2543['count']:_0xf28a16['offset']+_0xf28a16[_0x1738('0x1b')];var _0x20d42d;if(_0x5583ef>=_0x547362){_0x5583ef=_0x547362;_0x20d42d=0xc8;}else{_0x20d42d=0xce;}_0x1f512c[_0x1738('0x17')](_0x20d42d);return _0x1f512c[_0x1738('0x1e')](_0x1738('0x1f'),_0x1cf209+'-'+_0x5583ef+'/'+_0x547362)[_0x1738('0x19')](_0x3f2543);}return null;};}function patchUpdates(_0x3cab1b){return function(_0x559fd1){try{jsonpatch[_0x1738('0x20')](_0x559fd1,_0x3cab1b,!![]);}catch(_0x5014d1){return BPromise[_0x1738('0x21')](_0x5014d1);}return _0x559fd1['save']();};}function saveUpdates(_0x3e06d3,_0x285ad5){return function(_0x3190b2){if(_0x3190b2){return _0x3190b2[_0x1738('0x22')](_0x3e06d3)[_0x1738('0x23')](function(_0x54f780){return _0x54f780;});}return null;};}function removeEntity(_0x251a3b,_0x250dca){return function(_0x3317d5){if(_0x3317d5){return _0x3317d5[_0x1738('0x24')]()['then'](function(){_0x251a3b[_0x1738('0x17')](0xcc)[_0x1738('0x18')]();});}};}function handleEntityNotFound(_0x30404c,_0x301c30){return function(_0x2dc423){if(!_0x2dc423){_0x30404c['sendStatus'](0x194);}return _0x2dc423;};}function handleError(_0x314a46,_0x548e9c){_0x548e9c=_0x548e9c||0x1f4;return function(_0x23f7c3){logger['error'](_0x23f7c3[_0x1738('0x25')]);if(_0x23f7c3[_0x1738('0x26')]){delete _0x23f7c3[_0x1738('0x26')];}_0x314a46[_0x1738('0x17')](_0x548e9c)[_0x1738('0x27')](_0x23f7c3);};}exports[_0x1738('0x28')]=function(_0x4831d2,_0x5d35f4){var _0x274c35={},_0x128a7b={},_0x1c11ad={'count':0x0,'rows':[]};var _0x866a95=_[_0x1738('0x29')](db[_0x1738('0x2a')][_0x1738('0x2b')],function(_0x3ac684){return{'name':_0x3ac684[_0x1738('0x2c')],'type':_0x3ac684['type'][_0x1738('0x2d')]};});_0x128a7b[_0x1738('0x2e')]=_[_0x1738('0x29')](_0x866a95,'name');_0x128a7b[_0x1738('0x2f')]=_[_0x1738('0x30')](_0x4831d2[_0x1738('0x2f')]);_0x128a7b['filters']=_[_0x1738('0x31')](_0x128a7b[_0x1738('0x2e')],_0x128a7b[_0x1738('0x2f')]);_0x274c35['attributes']=_['intersection'](_0x128a7b[_0x1738('0x2e')],qs[_0x1738('0x32')](_0x4831d2[_0x1738('0x2f')]['fields']));_0x274c35[_0x1738('0x33')]=_0x274c35[_0x1738('0x33')][_0x1738('0x34')]?_0x274c35[_0x1738('0x33')]:_0x128a7b[_0x1738('0x2e')];if(!_0x4831d2[_0x1738('0x2f')][_0x1738('0x35')]('nolimit')){_0x274c35[_0x1738('0x1b')]=qs['limit'](_0x4831d2[_0x1738('0x2f')][_0x1738('0x1b')]);_0x274c35[_0x1738('0x1a')]=qs[_0x1738('0x1a')](_0x4831d2['query'][_0x1738('0x1a')]);}_0x274c35['order']=qs[_0x1738('0x36')](_0x4831d2['query'][_0x1738('0x36')]);_0x274c35[_0x1738('0x37')]=qs['filters'](_[_0x1738('0x38')](_0x4831d2[_0x1738('0x2f')],_0x128a7b[_0x1738('0x39')]),_0x866a95);if(_0x4831d2[_0x1738('0x2f')][_0x1738('0x3a')]){_0x274c35[_0x1738('0x37')]=_['merge'](_0x274c35[_0x1738('0x37')],{'$or':_[_0x1738('0x29')](_0x866a95,function(_0x15bacb){if(_0x15bacb[_0x1738('0x3b')]!==_0x1738('0x3c')){var _0xbd0dd1={};_0xbd0dd1[_0x15bacb[_0x1738('0x26')]]={'$like':'%'+_0x4831d2['query'][_0x1738('0x3a')]+'%'};return _0xbd0dd1;}})});}_0x274c35=_[_0x1738('0x3d')]({},_0x274c35,_0x4831d2['options']);var _0x476573={'where':_0x274c35[_0x1738('0x37')]};return db[_0x1738('0x2a')]['count'](_0x476573)['then'](function(_0x342efd){_0x1c11ad[_0x1738('0x1d')]=_0x342efd;if(_0x4831d2[_0x1738('0x2f')][_0x1738('0x3e')]){_0x274c35[_0x1738('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x1738('0x40')](_0x274c35);})[_0x1738('0x23')](function(_0x7067f4){_0x1c11ad[_0x1738('0x41')]=_0x7067f4;return _0x1c11ad;})[_0x1738('0x23')](respondWithFilteredResult(_0x5d35f4,_0x274c35))[_0x1738('0x42')](handleError(_0x5d35f4,null));};exports[_0x1738('0x43')]=function(_0x53c6af,_0x58e899){var _0xd8c769={'raw':!![],'where':{'id':_0x53c6af['params']['id']}},_0x33655a={};_0x33655a[_0x1738('0x2e')]=_['keys'](db[_0x1738('0x2a')][_0x1738('0x2b')]);_0x33655a[_0x1738('0x2f')]=_['keys'](_0x53c6af['query']);_0x33655a[_0x1738('0x39')]=_[_0x1738('0x31')](_0x33655a[_0x1738('0x2e')],_0x33655a[_0x1738('0x2f')]);_0xd8c769[_0x1738('0x33')]=_[_0x1738('0x31')](_0x33655a[_0x1738('0x2e')],qs[_0x1738('0x32')](_0x53c6af[_0x1738('0x2f')][_0x1738('0x32')]));_0xd8c769[_0x1738('0x33')]=_0xd8c769[_0x1738('0x33')]['length']?_0xd8c769[_0x1738('0x33')]:_0x33655a[_0x1738('0x2e')];if(_0x53c6af[_0x1738('0x2f')][_0x1738('0x3e')]){_0xd8c769['include']=[{'all':!![]}];}_0xd8c769=_[_0x1738('0x3d')]({},_0xd8c769,_0x53c6af[_0x1738('0x44')]);return db['WhatsappTransferReport'][_0x1738('0x45')](_0xd8c769)['then'](handleEntityNotFound(_0x58e899,null))[_0x1738('0x23')](respondWithResult(_0x58e899,null))['catch'](handleError(_0x58e899,null));};exports[_0x1738('0x46')]=function(_0x4f28e5,_0x37b4c6){return db['WhatsappTransferReport'][_0x1738('0x46')](_0x4f28e5[_0x1738('0x47')],{})[_0x1738('0x23')](respondWithResult(_0x37b4c6,0xc9))['catch'](handleError(_0x37b4c6,null));};exports[_0x1738('0x22')]=function(_0x247040,_0x2f6928){if(_0x247040[_0x1738('0x47')]['id']){delete _0x247040['body']['id'];}return db[_0x1738('0x2a')][_0x1738('0x45')]({'where':{'id':_0x247040['params']['id']}})[_0x1738('0x23')](handleEntityNotFound(_0x2f6928,null))['then'](saveUpdates(_0x247040[_0x1738('0x47')],null))[_0x1738('0x23')](respondWithResult(_0x2f6928,null))[_0x1738('0x42')](handleError(_0x2f6928,null));};exports[_0x1738('0x24')]=function(_0x503b6d,_0x5bb73e){return db[_0x1738('0x2a')]['find']({'where':{'id':_0x503b6d[_0x1738('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bb73e,null))[_0x1738('0x23')](removeEntity(_0x5bb73e,null))[_0x1738('0x42')](handleError(_0x5bb73e,null));};exports['describe']=function(_0x3ea1c7,_0x9ccfbf){return db['WhatsappTransferReport'][_0x1738('0x49')]()[_0x1738('0x23')](respondWithResult(_0x9ccfbf,null))[_0x1738('0x42')](handleError(_0x9ccfbf,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 749dd0c..794dae1 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 _0x70ee=['moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api'];(function(_0x669be3,_0x1871ff){var _0x3a1a61=function(_0x56fc34){while(--_0x56fc34){_0x669be3['push'](_0x669be3['shift']());}};_0x3a1a61(++_0x1871ff);}(_0x70ee,0x15c));var _0xe70e=function(_0x3dddb9,_0x3b2f73){_0x3dddb9=_0x3dddb9-0x0;var _0x4df584=_0x70ee[_0x3dddb9];return _0x4df584;};'use strict';var _=require(_0xe70e('0x0'));var util=require(_0xe70e('0x1'));var logger=require('../../config/logger')(_0xe70e('0x2'));var moment=require(_0xe70e('0x3'));var BPromise=require(_0xe70e('0x4'));var rp=require(_0xe70e('0x5'));var fs=require('fs');var path=require(_0xe70e('0x6'));var rimraf=require('rimraf');var config=require(_0xe70e('0x7'));var attributes=require(_0xe70e('0x8'));module['exports']=function(_0x35595f,_0x3e7b95){return _0x35595f[_0xe70e('0x9')](_0xe70e('0xa'),attributes,{'tableName':_0xe70e('0xb'),'paranoid':![],'indexes':[{'name':_0xe70e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0xc4aa,0x9b));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require('util');var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var moment=require(_0xac4a('0x3'));var BPromise=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var fs=require('fs');var path=require(_0xac4a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0xac4a('0x7')]=function(_0xe058f9,_0x3fd48d){return _0xe058f9[_0xac4a('0x8')](_0xac4a('0x9'),attributes,{'tableName':_0xac4a('0xa'),'paranoid':![],'indexes':[{'name':_0xac4a('0xb'),'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 19869df..c2f4f79 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 _0x26e5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','moment'];(function(_0x2ea076,_0xa59a85){var _0x1e0867=function(_0x4d5ae2){while(--_0x4d5ae2){_0x2ea076['push'](_0x2ea076['shift']());}};_0x1e0867(++_0xa59a85);}(_0x26e5,0x1c9));var _0x526e=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x26e5[_0x496738];return _0xee1381;};'use strict';var _=require(_0x526e('0x0'));var util=require(_0x526e('0x1'));var moment=require(_0x526e('0x2'));var BPromise=require(_0x526e('0x3'));var rs=require(_0x526e('0x4'));var fs=require('fs');var Redis=require(_0x526e('0x5'));var db=require(_0x526e('0x6'))['db'];var utils=require(_0x526e('0x7'));var logger=require(_0x526e('0x8'))(_0x526e('0x9'));var config=require('../../config/environment');var jayson=require(_0x526e('0xa'));var client=jayson['client'][_0x526e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfda1b6,_0xddccda,_0x253ae4){return new BPromise(function(_0x40f964,_0x462129){return client[_0x526e('0xc')](_0xfda1b6,_0x253ae4)[_0x526e('0xd')](function(_0x29e0df){logger['info'](_0x526e('0xe'),_0xddccda,'request\x20sent');logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xddccda,_0x526e('0xf'),JSON['stringify'](_0x29e0df));if(_0x29e0df[_0x526e('0x10')]){if(_0x29e0df[_0x526e('0x10')]['code']===0x1f4){logger[_0x526e('0x10')](_0x526e('0xe'),_0xddccda,_0x29e0df['error']['message']);return _0x462129(_0x29e0df[_0x526e('0x10')][_0x526e('0x11')]);}logger[_0x526e('0x10')](_0x526e('0xe'),_0xddccda,_0x29e0df[_0x526e('0x10')]['message']);return _0x40f964(_0x29e0df[_0x526e('0x10')]['message']);}else{logger[_0x526e('0x12')](_0x526e('0xe'),_0xddccda,_0x526e('0xf'));_0x40f964(_0x29e0df[_0x526e('0x13')][_0x526e('0x11')]);}})['catch'](function(_0x2f4766){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0xddccda,_0x2f4766);_0x462129(_0x2f4766);});});} \ No newline at end of file +var _0x7e1d=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fbe86,_0x21a723){var _0x45bc12=function(_0x30f18e){while(--_0x30f18e){_0x4fbe86['push'](_0x4fbe86['shift']());}};_0x45bc12(++_0x21a723);}(_0x7e1d,0x15a));var _0xd7e1=function(_0x1f0fb7,_0xacf72d){_0x1f0fb7=_0x1f0fb7-0x0;var _0x4dc2de=_0x7e1d[_0x1f0fb7];return _0x4dc2de;};'use strict';var _=require(_0xd7e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd7e1('0x1'));var rs=require(_0xd7e1('0x2'));var fs=require('fs');var Redis=require(_0xd7e1('0x3'));var db=require(_0xd7e1('0x4'))['db'];var utils=require(_0xd7e1('0x5'));var logger=require(_0xd7e1('0x6'))('rpc');var config=require(_0xd7e1('0x7'));var jayson=require(_0xd7e1('0x8'));var client=jayson[_0xd7e1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397680,_0x7c8266,_0x18c178){return new BPromise(function(_0x3bcb45,_0x158be6){return client[_0xd7e1('0xa')](_0x397680,_0x18c178)[_0xd7e1('0xb')](function(_0x51cb1d){logger[_0xd7e1('0xc')](_0xd7e1('0xd'),_0x7c8266,_0xd7e1('0xe'));logger[_0xd7e1('0xf')](_0xd7e1('0x10'),_0x7c8266,'request\x20sent',JSON[_0xd7e1('0x11')](_0x51cb1d));if(_0x51cb1d[_0xd7e1('0x12')]){if(_0x51cb1d['error'][_0xd7e1('0x13')]===0x1f4){logger[_0xd7e1('0x12')](_0xd7e1('0xd'),_0x7c8266,_0x51cb1d[_0xd7e1('0x12')]['message']);return _0x158be6(_0x51cb1d[_0xd7e1('0x12')]['message']);}logger[_0xd7e1('0x12')](_0xd7e1('0xd'),_0x7c8266,_0x51cb1d[_0xd7e1('0x12')][_0xd7e1('0x14')]);return _0x3bcb45(_0x51cb1d[_0xd7e1('0x12')]['message']);}else{logger['info'](_0xd7e1('0xd'),_0x7c8266,'request\x20sent');_0x3bcb45(_0x51cb1d[_0xd7e1('0x15')][_0xd7e1('0x14')]);}})['catch'](function(_0x741d58){logger['error'](_0xd7e1('0xd'),_0x7c8266,_0x741d58);_0x158be6(_0x741d58);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 7419f0a..31ddccd 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22a0=['name','join','None','seedDB','./config/seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','listen','start','info','Online\x20apps:','map','filter','online'];(function(_0x53ea78,_0x415cba){var _0x3e24c9=function(_0x11a49b){while(--_0x11a49b){_0x53ea78['push'](_0x53ea78['shift']());}};_0x3e24c9(++_0x415cba);}(_0x22a0,0x117));var _0x022a=function(_0x4d971e,_0x4e6d1c){_0x4d971e=_0x4d971e-0x0;var _0x171201=_0x22a0[_0x4d971e];return _0x171201;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x022a('0x0'));var config=require(_0x022a('0x1'));var logger=require(_0x022a('0x2'))(_0x022a('0x3'));var pm2=require(_0x022a('0x4'));var pm2Config=require(_0x022a('0x5'));var schedule=require('./config/schedule');var chat=require(_0x022a('0x6'));var whatsapp=require(_0x022a('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x022a('0x8')][_0x022a('0x9')]()[_0x022a('0xa')](function(){return rpc[_0x022a('0xb')]();})['then'](function(_0x38ba55){logger['info'](_0x38ba55);return chat[_0x022a('0xc')]();})[_0x022a('0xa')](function(){return whatsapp[_0x022a('0xc')]();})[_0x022a('0xa')](function(){return schedule[_0x022a('0xc')]();})['then'](function(){return transcribe['start']();})[_0x022a('0xa')](function(_0x2e1c80){logger['info'](_0x2e1c80);return pm2[_0x022a('0xc')](pm2Config);})[_0x022a('0xa')](function(_0x448080){logger[_0x022a('0xd')](_0x022a('0xe'),_[_0x022a('0xf')](_[_0x022a('0x10')](_0x448080,{'status':_0x022a('0x11')}),_0x022a('0x12'))[_0x022a('0x13')]());logger['info']('Offline\x20apps:',_['map'](_['filter'](_0x448080,function(_0x3aa927){return _0x3aa927['status']!==_0x022a('0x11');}),_0x022a('0x12'))[_0x022a('0x13')]()||_0x022a('0x14'));config[_0x022a('0x15')]&&require(_0x022a('0x16'))['default']();require('./config/license')[_0x022a('0x17')]();})[_0x022a('0x18')](function(_0x143647){logger[_0x022a('0x19')](_0x022a('0x1a'),_0x143647);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x064d=['./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','listen','then','start','info','Online\x20apps:','map','filter','online','name','Offline\x20apps:','status','join','None','seedDB','./config/seedDB','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment'];(function(_0x1c5968,_0x68d40c){var _0x290441=function(_0x5e2f4b){while(--_0x5e2f4b){_0x1c5968['push'](_0x1c5968['shift']());}};_0x290441(++_0x68d40c);}(_0x064d,0x170));var _0xd064=function(_0x416fcb,_0x896f52){_0x416fcb=_0x416fcb-0x0;var _0x323dc5=_0x064d[_0x416fcb];return _0x323dc5;};'use strict';var _=require(_0xd064('0x0'));var mysqldb=require(_0xd064('0x1'));var rpc=require(_0xd064('0x2'));var config=require(_0xd064('0x3'));var logger=require(_0xd064('0x4'))(_0xd064('0x5'));var pm2=require(_0xd064('0x6'));var pm2Config=require(_0xd064('0x7'));var schedule=require(_0xd064('0x8'));var chat=require(_0xd064('0x9'));var whatsapp=require(_0xd064('0xa'));var transcribe=require(_0xd064('0xb'));function main(){return mysqldb['db'][_0xd064('0xc')]['sync']()['then'](function(){return rpc[_0xd064('0xd')]();})[_0xd064('0xe')](function(_0x4c8e48){logger['info'](_0x4c8e48);return chat[_0xd064('0xf')]();})[_0xd064('0xe')](function(){return whatsapp['start']();})[_0xd064('0xe')](function(){return schedule['start']();})['then'](function(){return transcribe['start']();})[_0xd064('0xe')](function(_0x432014){logger[_0xd064('0x10')](_0x432014);return pm2[_0xd064('0xf')](pm2Config);})['then'](function(_0x16829c){logger[_0xd064('0x10')](_0xd064('0x11'),_[_0xd064('0x12')](_[_0xd064('0x13')](_0x16829c,{'status':_0xd064('0x14')}),_0xd064('0x15'))['join']());logger['info'](_0xd064('0x16'),_[_0xd064('0x12')](_[_0xd064('0x13')](_0x16829c,function(_0x3b77e2){return _0x3b77e2[_0xd064('0x17')]!==_0xd064('0x14');}),_0xd064('0x15'))[_0xd064('0x18')]()||_0xd064('0x19'));config[_0xd064('0x1a')]&&require(_0xd064('0x1b'))[_0xd064('0x1c')]();require('./config/license')[_0xd064('0x1c')]();})[_0xd064('0x1d')](function(_0x4d550c){logger['error'](_0xd064('0x1e'),_0x4d550c);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 97a406f..823994f 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 _0xb94d=['disposition','then','status','json','unmanaged','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','ValidationError','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','length','splice','unshift','join','promisify','sign','secret','payload','options','randomBytes','toString','hex','floor','HS512','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isAuthenticated','findOne','params'];(function(_0x3b8f99,_0x718933){var _0x104c8a=function(_0x13b53f){while(--_0x13b53f){_0x3b8f99['push'](_0x3b8f99['shift']());}};_0x104c8a(++_0x718933);}(_0xb94d,0x147));var _0xdb94=function(_0x4287fe,_0x14ad49){_0x4287fe=_0x4287fe-0x0;var _0x329a39=_0xb94d[_0x4287fe];return _0x329a39;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xdb94('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xdb94('0x1'));var encryptor=require(_0xdb94('0x2'));var _=require(_0xdb94('0x3'));var jwt=require(_0xdb94('0x4'));var expressJwt=require(_0xdb94('0x5'));var compose=require(_0xdb94('0x6'));var basicAuth=require(_0xdb94('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xdb94('0x8')][_0xdb94('0x9')]});var userAttributes=['id','role',_0xdb94('0xa'),_0xdb94('0xb'),_0xdb94('0xc'),_0xdb94('0xd'),_0xdb94('0xe'),_0xdb94('0xf'),_0xdb94('0x10'),'voicePause',_0xdb94('0x11'),_0xdb94('0x12'),_0xdb94('0x13'),_0xdb94('0x14'),_0xdb94('0x15'),_0xdb94('0x16'),_0xdb94('0x17'),_0xdb94('0x18'),_0xdb94('0x19'),_0xdb94('0x1a'),_0xdb94('0x1b'),_0xdb94('0x1c'),'alias',_0xdb94('0x1d'),_0xdb94('0x1e'),_0xdb94('0x1f'),'phoneBarEnableRecording',_0xdb94('0x20'),_0xdb94('0x21'),_0xdb94('0x22'),_0xdb94('0x23'),_0xdb94('0x24'),_0xdb94('0x25'),_0xdb94('0x26'),'interface',_0xdb94('0x27'),_0xdb94('0x28'),_0xdb94('0x29'),'wssPort',_0xdb94('0x2a'),_0xdb94('0x2b'),_0xdb94('0x2c')];exports['isChatInteractionAuthorized']=function(){return this[_0xdb94('0x2d')](!![])['use'](function(_0x16f98e,_0x1160f6,_0x35acea){if(_0x16f98e['user']){_0x35acea();}else{return db['ChatInteraction'][_0xdb94('0x2e')]({'where':{'id':_0x16f98e[_0xdb94('0x2f')]['id']},'attributes':['id','closed',_0xdb94('0x30')],'raw':!![]})[_0xdb94('0x31')](function(_0x53fea1){if(_0x53fea1&&_0x53fea1['closed']){return _0x1160f6[_0xdb94('0x32')](_0x53fea1[_0xdb94('0x30')]==='unmanaged'?0x195:0x193)[_0xdb94('0x33')]({'message':_0x53fea1[_0xdb94('0x30')]===_0xdb94('0x34')?'Unmanaged.':_0xdb94('0x35')});}else{_0x35acea();}})[_0xdb94('0x36')](function(_0x25c6bd){_0x35acea(_0x25c6bd);});}});};exports[_0xdb94('0x2d')]=function isAuthenticated(_0x28a8fa){return compose()[_0xdb94('0x37')](function(_0x2acab3,_0x345479,_0x46beed){var _0x74c341;if(_0x2acab3[_0xdb94('0x38')][_0xdb94('0x39')]){if(_[_0xdb94('0x3a')](_0x2acab3[_0xdb94('0x38')][_0xdb94('0x39')],_0xdb94('0x3b'))){var _0x535263=basicAuth(_0x2acab3);db[_0xdb94('0x3c')][_0xdb94('0x3d')]({'where':{'name':_0x535263[_0xdb94('0xb')]}})['then'](function(_0x242251){if(!_0x242251||!_0x242251[_0xdb94('0x3e')](_0x535263[_0xdb94('0x3f')])){return _0x345479[_0xdb94('0x32')](0x191)['json']({'message':_0xdb94('0x40')});}_0x2acab3[_0xdb94('0x41')]={'id':_0x242251['id']};_0x46beed();})['catch'](function(_0x108781){_0x46beed(_0x108781);});}else if(_[_0xdb94('0x3a')](_0x2acab3[_0xdb94('0x38')][_0xdb94('0x39')],_0xdb94('0x42'))){validateJwt(_0x2acab3,_0x345479,_0x46beed);}else{if(_0x28a8fa){_0x46beed();}else{return _0x345479['status'](0x193)['json']({'message':_0xdb94('0x43')});}}}else if(_0x2acab3[_0xdb94('0x44')][_0xdb94('0x45')]){try{var _0x2944c7={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdb94('0x46')]()};verifyJwt(_0x2acab3['query']['apikey'],_0x2944c7)['then'](function(_0x3de672){return db['User']['find']({'where':{'id':_0x3de672['sub']}})[_0xdb94('0x31')](function(_0x376663){_0x74c341=_0x376663;return db[_0xdb94('0x47')][_0xdb94('0x2e')]({'where':{'id':0x1},'attributes':[_0xdb94('0x48'),_0xdb94('0x49')],'raw':!![]});})['then'](function(_0x28667d){if(!_0x74c341||!_[_0xdb94('0x4a')](_0x74c341['apiKeyNonce'],_0x3de672[_0xdb94('0x4b')])){return _0x345479['status'](0x191)['json']({'message':_0xdb94('0x4c')});}if(_0x74c341[_0xdb94('0x4d')]){return _0x345479[_0xdb94('0x32')](0x191)[_0xdb94('0x33')]({'message':_0xdb94('0x4e')});}if(_0x74c341['blocked']){if(_0x28667d[_0xdb94('0x49')]>0x0){if(moment(_0x74c341[_0xdb94('0x4f')])['add'](_0x28667d[_0xdb94('0x49')],_0xdb94('0x50'))>moment()){return _0x345479['status'](0x191)[_0xdb94('0x33')]({'message':_0xdb94('0x4e')});}}else{return _0x345479['status'](0x191)[_0xdb94('0x33')]({'message':_0xdb94('0x4e')});}}_0x2acab3[_0xdb94('0x41')]={'id':_0x74c341['id']};_0x46beed();});})[_0xdb94('0x36')](function(){return _0x345479['status'](0x191)['json']({'message':_0xdb94('0x4e')});});}catch(_0x5027e4){_0x46beed(_0x5027e4);}}else if(_0x28a8fa){_0x46beed();}else{return _0x345479[_0xdb94('0x32')](0x193)[_0xdb94('0x33')]({'message':_0xdb94('0x43')});}})[_0xdb94('0x37')](function(_0x2bbc1e,_0x469851,_0x377035){if(_0x2bbc1e[_0xdb94('0x41')]){db[_0xdb94('0x3c')][_0xdb94('0x3d')]({'where':{'id':_0x2bbc1e[_0xdb94('0x41')]['id']},'attributes':userAttributes})[_0xdb94('0x31')](function(_0x3d7967){if(!_0x3d7967){return _0x469851[_0xdb94('0x32')](0x194)['json']({'message':_0xdb94('0x51')});}_0x2bbc1e[_0xdb94('0x41')]=_0x3d7967;_0x377035();})['catch'](function(_0x538007){_0x377035(_0x538007);});}else if(_0x28a8fa){_0x377035();}else{return _0x469851[_0xdb94('0x32')](0x194)[_0xdb94('0x33')]({'message':_0xdb94('0x52')});}});};exports[_0xdb94('0x53')]=function canUpdate(){return compose()[_0xdb94('0x37')](function(_0x4002e8,_0x4823f7,_0x4b1563){return licenseUtil[_0xdb94('0x54')]()[_0xdb94('0x31')](function(_0x4a43f2){if(_0x4a43f2[_0xdb94('0x55')]){_0x4b1563();}else{return _0x4823f7[_0xdb94('0x32')](0x193)['json']({'message':_0xdb94('0x56')});}})[_0xdb94('0x36')](function(_0x54fc62){_0x4b1563(_0x54fc62);});});};exports['isMiddleware']=function(_0x4070bb,_0x113bf1,_0x6ad513){_0x4070bb['isMiddleware']=!![];return _0x6ad513();};exports[_0xdb94('0x57')]=function signToken(_0x558634){return signJwt(_0x558634);};exports[_0xdb94('0x58')]=function(_0x4d3195,_0x1a4832){if(!_0x4d3195[_0xdb94('0x41')]){return _0x1a4832[_0xdb94('0x32')](0x194)[_0xdb94('0x33')]({'message':_0xdb94('0x59')});}var _0x30f2bc={'payload':{'id':_0x4d3195[_0xdb94('0x41')]['id'],'role':_0x4d3195[_0xdb94('0x41')][_0xdb94('0x5a')]},'options':{'expiresIn':0x15180}};return signJwt(_0x30f2bc)[_0xdb94('0x31')](function(_0x5bb579){_0x1a4832[_0xdb94('0x5b')](_0xdb94('0x5c'),_0x5bb579);_0x1a4832[_0xdb94('0x5d')](_0xdb94('0x5e'));})[_0xdb94('0x36')](function(_0x2fba59){return _0x1a4832['status'](0x1f4)['send'](_0x2fba59);});};exports['retrieveApiKey']=function(_0x2cd8c9){if(_[_0xdb94('0x5f')](_0x2cd8c9[_0xdb94('0x60')])||_[_0xdb94('0x5f')](_0x2cd8c9[_0xdb94('0x61')])){return null;}else{return createJwt(_0x2cd8c9);}};exports[_0xdb94('0x62')]=function(_0x378f3a){_0x378f3a[_0xdb94('0x60')]=generateNonce();_0x378f3a[_0xdb94('0x61')]=generateIssuedAt();return createJwt(_0x378f3a);};exports[_0xdb94('0x63')]=function(_0x49da34,_0x58e0b5){var _0x21825a=_0x49da34[_0xdb94('0x44')]['apikey'];if(_0x21825a){var _0x33c871={'nonce':_0x58e0b5[_0xdb94('0x60')],'iat':_0x58e0b5[_0xdb94('0x61')],'audience':hardwareConf[_0xdb94('0x46')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x21825a,_0x33c871)[_0xdb94('0x31')](function(){return generateApiKey(_0x58e0b5);});}else{throw{'message':_0xdb94('0x64')};}};exports['validatePasswordPattern']=function(_0x190a94){var _0x4d59c8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4d59c8['test'](_0x190a94))throw new db['Sequelize'][(_0xdb94('0x65'))]('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[_0xdb94('0x66')]=function(_0x368615,_0x3289d0,_0x25e265){var _0x129fa0=encryptor[_0xdb94('0x67')](_0x3289d0)['split'](',');for(var _0x5113c5=0x0;_0x5113c5<_0x25e265;_0x5113c5++){if(!_0x129fa0[_0x5113c5])break;if(_0x368615[_0xdb94('0x68')]()===_0x129fa0[_0x5113c5][_0xdb94('0x68')]()){var _0x207576=util[_0xdb94('0x69')](_0xdb94('0x6a'),_0x25e265);if(_0x25e265===0x1){_0x207576=_0xdb94('0x6b');}throw new db[(_0xdb94('0x6c'))][(_0xdb94('0x65'))](_0x207576);}}return;};exports[_0xdb94('0x6d')]=function(_0x182e79,_0x70d245){var _0x46e460=_0x70d245?encryptor[_0xdb94('0x67')](_0x70d245)[_0xdb94('0x6e')](','):[];if(_0x46e460[_0xdb94('0x6f')]===0x5){_0x46e460[_0xdb94('0x70')](-0x1,0x1);}_0x46e460[_0xdb94('0x71')](_0x182e79);return encryptor['encryptString'](_0x46e460[_0xdb94('0x72')](','));};function signJwt(_0xdfc6ec){var _0x3a27db=BPromise[_0xdb94('0x73')](jwt[_0xdb94('0x74')],{'context':jwt});var _0x543e0d=_0xdfc6ec[_0xdb94('0x75')]||config[_0xdb94('0x8')][_0xdb94('0x9')];return new BPromise(function(_0xfef2ee,_0x510775){_0x3a27db(_0xdfc6ec[_0xdb94('0x76')],_0x543e0d,_0xdfc6ec[_0xdb94('0x77')])[_0xdb94('0x31')](function(_0x50ab58){_0xfef2ee(_0x50ab58);})[_0xdb94('0x36')](function(_0x598b49){_0x510775(_0x598b49);});});}function verifyJwt(_0x2c33c8,_0x143e81,_0x31bb8b){var _0x4eeec9=BPromise[_0xdb94('0x73')](jwt['verify'],{'context':jwt});var _0x3bdb5e=_0x31bb8b||config['secrets']['session'];return new BPromise(function(_0x4a964e,_0x14d0d4){_0x4eeec9(_0x2c33c8,_0x3bdb5e,_0x143e81)[_0xdb94('0x31')](function(_0x53f149){_0x4a964e(_0x53f149);})['catch'](function(_0x2e1aac){_0x14d0d4(_0x2e1aac);});});}function generateNonce(){return crypto[_0xdb94('0x78')](0x10)[_0xdb94('0x79')](_0xdb94('0x7a'));}function generateIssuedAt(){return Math[_0xdb94('0x7b')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x4d2c0b){var _0x50321c={'payload':{'iat':_0x4d2c0b[_0xdb94('0x61')],'nonce':_0x4d2c0b['apiKeyNonce']},'options':{'algorithm':_0xdb94('0x7c'),'subject':_0x4d2c0b['id'][_0xdb94('0x79')](),'issuer':hardwareConf[_0xdb94('0x46')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x50321c)[_0xdb94('0x31')](function(_0x4cc45a){return{'iat':_0x4d2c0b[_0xdb94('0x61')],'nonce':_0x4d2c0b['apiKeyNonce'],'token':_0x4cc45a};});} \ No newline at end of file +var _0xec2a=['verify','randomBytes','hex','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','then','closed','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','find','authenticate','pass','Wrong\x20credentials.','user','Unknown\x20authorization\x20format','query','apikey','getUuid','User','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','redirect','/dashboards/general','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','payload'];(function(_0xce4c29,_0x4029e5){var _0x3e7922=function(_0x17c742){while(--_0x17c742){_0xce4c29['push'](_0xce4c29['shift']());}};_0x3e7922(++_0x4029e5);}(_0xec2a,0x18d));var _0xaec2=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0xec2a[_0x5c1cdc];return _0x2e8317;};'use strict';var db=require(_0xaec2('0x0'))['db'];var config=require(_0xaec2('0x1'));var hardwareConf=require(_0xaec2('0x2'));var licenseUtil=require(_0xaec2('0x3'));var encryptor=require(_0xaec2('0x4'));var _=require('lodash');var jwt=require(_0xaec2('0x5'));var expressJwt=require(_0xaec2('0x6'));var compose=require(_0xaec2('0x7'));var basicAuth=require(_0xaec2('0x8'));var crypto=require(_0xaec2('0x9'));var BPromise=require(_0xaec2('0xa'));var util=require(_0xaec2('0xb'));var moment=require(_0xaec2('0xc'));var validateJwt=expressJwt({'secret':config[_0xaec2('0xd')][_0xaec2('0xe')]});var userAttributes=['id',_0xaec2('0xf'),_0xaec2('0x10'),_0xaec2('0x11'),'internal',_0xaec2('0x12'),_0xaec2('0x13'),_0xaec2('0x14'),_0xaec2('0x15'),_0xaec2('0x16'),_0xaec2('0x17'),'mailPause',_0xaec2('0x18'),_0xaec2('0x19'),_0xaec2('0x1a'),'pauseType',_0xaec2('0x1b'),_0xaec2('0x1c'),_0xaec2('0x1d'),_0xaec2('0x1e'),'allowmessenger',_0xaec2('0x1f'),_0xaec2('0x20'),_0xaec2('0x21'),_0xaec2('0x22'),_0xaec2('0x23'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xaec2('0x24'),'phoneBarExpires',_0xaec2('0x25'),_0xaec2('0x26'),_0xaec2('0x27'),_0xaec2('0x28'),'interface',_0xaec2('0x29'),_0xaec2('0x2a'),_0xaec2('0x2b'),_0xaec2('0x2c'),_0xaec2('0x2d'),_0xaec2('0x2e'),_0xaec2('0x2f')];exports[_0xaec2('0x30')]=function(){return this[_0xaec2('0x31')](!![])[_0xaec2('0x32')](function(_0x2f6ca8,_0x122f2c,_0x18adc1){if(_0x2f6ca8['user']){_0x18adc1();}else{return db[_0xaec2('0x33')][_0xaec2('0x34')]({'where':{'id':_0x2f6ca8[_0xaec2('0x35')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xaec2('0x36')](function(_0x10abfd){if(_0x10abfd&&_0x10abfd[_0xaec2('0x37')]){return _0x122f2c[_0xaec2('0x38')](_0x10abfd[_0xaec2('0x39')]===_0xaec2('0x3a')?0x195:0x193)[_0xaec2('0x3b')]({'message':_0x10abfd['disposition']===_0xaec2('0x3a')?_0xaec2('0x3c'):_0xaec2('0x3d')});}else{_0x18adc1();}})[_0xaec2('0x3e')](function(_0x54c353){_0x18adc1(_0x54c353);});}});};exports['isAuthenticated']=function isAuthenticated(_0x1644b7){return compose()['use'](function(_0x41cb28,_0x5ef332,_0x49ced4){var _0x4b256a;if(_0x41cb28[_0xaec2('0x3f')][_0xaec2('0x40')]){if(_[_0xaec2('0x41')](_0x41cb28[_0xaec2('0x3f')][_0xaec2('0x40')],'Basic')){var _0x2e48f1=basicAuth(_0x41cb28);db['User'][_0xaec2('0x42')]({'where':{'name':_0x2e48f1[_0xaec2('0x11')]}})['then'](function(_0x1b7ace){if(!_0x1b7ace||!_0x1b7ace[_0xaec2('0x43')](_0x2e48f1[_0xaec2('0x44')])){return _0x5ef332['status'](0x191)[_0xaec2('0x3b')]({'message':_0xaec2('0x45')});}_0x41cb28[_0xaec2('0x46')]={'id':_0x1b7ace['id']};_0x49ced4();})[_0xaec2('0x3e')](function(_0xa34e6b){_0x49ced4(_0xa34e6b);});}else if(_[_0xaec2('0x41')](_0x41cb28['headers'][_0xaec2('0x40')],'Bearer')){validateJwt(_0x41cb28,_0x5ef332,_0x49ced4);}else{if(_0x1644b7){_0x49ced4();}else{return _0x5ef332[_0xaec2('0x38')](0x193)[_0xaec2('0x3b')]({'message':_0xaec2('0x47')});}}}else if(_0x41cb28[_0xaec2('0x48')][_0xaec2('0x49')]){try{var _0x2da79f={'audience':hardwareConf[_0xaec2('0x4a')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x41cb28[_0xaec2('0x48')][_0xaec2('0x49')],_0x2da79f)[_0xaec2('0x36')](function(_0x5f1c13){return db[_0xaec2('0x4b')][_0xaec2('0x42')]({'where':{'id':_0x5f1c13['sub']}})['then'](function(_0x156705){_0x4b256a=_0x156705;return db[_0xaec2('0x4c')][_0xaec2('0x34')]({'where':{'id':0x1},'attributes':[_0xaec2('0x4d'),_0xaec2('0x4e')],'raw':!![]});})[_0xaec2('0x36')](function(_0x240e4f){if(!_0x4b256a||!_[_0xaec2('0x4f')](_0x4b256a[_0xaec2('0x50')],_0x5f1c13[_0xaec2('0x51')])){return _0x5ef332[_0xaec2('0x38')](0x191)['json']({'message':_0xaec2('0x52')});}if(_0x4b256a['disabled']){return _0x5ef332[_0xaec2('0x38')](0x191)[_0xaec2('0x3b')]({'message':_0xaec2('0x53')});}if(_0x4b256a[_0xaec2('0x54')]){if(_0x240e4f[_0xaec2('0x4e')]>0x0){if(moment(_0x4b256a[_0xaec2('0x55')])[_0xaec2('0x56')](_0x240e4f['blockDuration'],'minutes')>moment()){return _0x5ef332['status'](0x191)[_0xaec2('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5ef332[_0xaec2('0x38')](0x191)[_0xaec2('0x3b')]({'message':_0xaec2('0x53')});}}_0x41cb28[_0xaec2('0x46')]={'id':_0x4b256a['id']};_0x49ced4();});})[_0xaec2('0x3e')](function(){return _0x5ef332[_0xaec2('0x38')](0x191)[_0xaec2('0x3b')]({'message':_0xaec2('0x53')});});}catch(_0x4aa99f){_0x49ced4(_0x4aa99f);}}else if(_0x1644b7){_0x49ced4();}else{return _0x5ef332['status'](0x193)[_0xaec2('0x3b')]({'message':_0xaec2('0x47')});}})['use'](function(_0x30c58c,_0x1dfbd0,_0x30d87a){if(_0x30c58c[_0xaec2('0x46')]){db[_0xaec2('0x4b')][_0xaec2('0x42')]({'where':{'id':_0x30c58c['user']['id']},'attributes':userAttributes})['then'](function(_0x4ceab){if(!_0x4ceab){return _0x1dfbd0[_0xaec2('0x38')](0x194)[_0xaec2('0x3b')]({'message':_0xaec2('0x57')});}_0x30c58c['user']=_0x4ceab;_0x30d87a();})[_0xaec2('0x3e')](function(_0x158750){_0x30d87a(_0x158750);});}else if(_0x1644b7){_0x30d87a();}else{return _0x1dfbd0[_0xaec2('0x38')](0x194)[_0xaec2('0x3b')]({'message':_0xaec2('0x58')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x229d55,_0xb050c9,_0x19b8d5){return licenseUtil['getLicense']()[_0xaec2('0x36')](function(_0x5d9e30){if(_0x5d9e30[_0xaec2('0x59')]){_0x19b8d5();}else{return _0xb050c9[_0xaec2('0x38')](0x193)[_0xaec2('0x3b')]({'message':_0xaec2('0x5a')});}})[_0xaec2('0x3e')](function(_0x251e00){_0x19b8d5(_0x251e00);});});};exports[_0xaec2('0x5b')]=function(_0x499590,_0x57d1e3,_0x516be8){_0x499590[_0xaec2('0x5b')]=!![];return _0x516be8();};exports[_0xaec2('0x5c')]=function signToken(_0x3da078){return signJwt(_0x3da078);};exports[_0xaec2('0x5d')]=function(_0xd8e2d1,_0xc2d830){if(!_0xd8e2d1['user']){return _0xc2d830[_0xaec2('0x38')](0x194)[_0xaec2('0x3b')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x177829={'payload':{'id':_0xd8e2d1[_0xaec2('0x46')]['id'],'role':_0xd8e2d1['user'][_0xaec2('0xf')]},'options':{'expiresIn':0x15180}};return signJwt(_0x177829)[_0xaec2('0x36')](function(_0x3c49e7){_0xc2d830[_0xaec2('0x5e')]('motion.token',_0x3c49e7);_0xc2d830[_0xaec2('0x5f')](_0xaec2('0x60'));})[_0xaec2('0x3e')](function(_0x56107a){return _0xc2d830[_0xaec2('0x38')](0x1f4)['send'](_0x56107a);});};exports['retrieveApiKey']=function(_0x4361dd){if(_[_0xaec2('0x61')](_0x4361dd[_0xaec2('0x50')])||_['isNil'](_0x4361dd[_0xaec2('0x62')])){return null;}else{return createJwt(_0x4361dd);}};exports[_0xaec2('0x63')]=function(_0x1901dd){_0x1901dd['apiKeyNonce']=generateNonce();_0x1901dd[_0xaec2('0x62')]=generateIssuedAt();return createJwt(_0x1901dd);};exports[_0xaec2('0x64')]=function(_0x415ad7,_0x5508f0){var _0x44e700=_0x415ad7[_0xaec2('0x48')]['apikey'];if(_0x44e700){var _0x2a8d38={'nonce':_0x5508f0[_0xaec2('0x50')],'iat':_0x5508f0[_0xaec2('0x62')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xaec2('0x4a')]()};return verifyJwt(_0x44e700,_0x2a8d38)['then'](function(){return generateApiKey(_0x5508f0);});}else{throw{'message':_0xaec2('0x65')};}};exports[_0xaec2('0x66')]=function(_0x536131){var _0x3eb0a2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3eb0a2['test'](_0x536131))throw new db[(_0xaec2('0x67'))]['ValidationError'](_0xaec2('0x68'));return;};exports[_0xaec2('0x69')]=function(_0x48af53,_0x3a234e,_0x3288bc){var _0x493024=encryptor[_0xaec2('0x6a')](_0x3a234e)[_0xaec2('0x6b')](',');for(var _0x5d8e10=0x0;_0x5d8e10<_0x3288bc;_0x5d8e10++){if(!_0x493024[_0x5d8e10])break;if(_0x48af53[_0xaec2('0x6c')]()===_0x493024[_0x5d8e10][_0xaec2('0x6c')]()){var _0x577c5b=util[_0xaec2('0x6d')](_0xaec2('0x6e'),_0x3288bc);if(_0x3288bc===0x1){_0x577c5b=_0xaec2('0x6f');}throw new db[(_0xaec2('0x67'))][(_0xaec2('0x70'))](_0x577c5b);}}return;};exports[_0xaec2('0x71')]=function(_0x48a162,_0x57c5e0){var _0x2ba0c0=_0x57c5e0?encryptor[_0xaec2('0x6a')](_0x57c5e0)[_0xaec2('0x6b')](','):[];if(_0x2ba0c0[_0xaec2('0x72')]===0x5){_0x2ba0c0[_0xaec2('0x73')](-0x1,0x1);}_0x2ba0c0[_0xaec2('0x74')](_0x48a162);return encryptor[_0xaec2('0x75')](_0x2ba0c0[_0xaec2('0x76')](','));};function signJwt(_0x51b089){var _0x395798=BPromise[_0xaec2('0x77')](jwt[_0xaec2('0x78')],{'context':jwt});var _0x19e67a=_0x51b089[_0xaec2('0x79')]||config[_0xaec2('0xd')][_0xaec2('0xe')];return new BPromise(function(_0x4dd976,_0xd36434){_0x395798(_0x51b089[_0xaec2('0x7a')],_0x19e67a,_0x51b089['options'])[_0xaec2('0x36')](function(_0x4d36d2){_0x4dd976(_0x4d36d2);})['catch'](function(_0xf4627a){_0xd36434(_0xf4627a);});});}function verifyJwt(_0x366752,_0x985c1b,_0x351ee3){var _0x35ac7a=BPromise[_0xaec2('0x77')](jwt[_0xaec2('0x7b')],{'context':jwt});var _0x198419=_0x351ee3||config['secrets'][_0xaec2('0xe')];return new BPromise(function(_0x5d80fe,_0x18ff10){_0x35ac7a(_0x366752,_0x198419,_0x985c1b)[_0xaec2('0x36')](function(_0x8ace55){_0x5d80fe(_0x8ace55);})['catch'](function(_0x344dcc){_0x18ff10(_0x344dcc);});});}function generateNonce(){return crypto[_0xaec2('0x7c')](0x10)['toString'](_0xaec2('0x7d'));}function generateIssuedAt(){return Math[_0xaec2('0x7e')](Date[_0xaec2('0x7f')]()/0x3e8)[_0xaec2('0x80')]();}function createJwt(_0x33562c){var _0x21654b={'payload':{'iat':_0x33562c[_0xaec2('0x62')],'nonce':_0x33562c[_0xaec2('0x50')]},'options':{'algorithm':_0xaec2('0x81'),'subject':_0x33562c['id'][_0xaec2('0x80')](),'issuer':hardwareConf[_0xaec2('0x4a')](),'audience':hardwareConf[_0xaec2('0x4a')]()}};return signJwt(_0x21654b)[_0xaec2('0x36')](function(_0xdf0505){return{'iat':_0x33562c[_0xaec2('0x62')],'nonce':_0x33562c[_0xaec2('0x50')],'token':_0xdf0505};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 8cf70b4..463ef0c 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 _0x36f7=['close','unlink','encryptString','utf8','base64','decryptString','secret','crypto','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','update','binary','end','final','write','decryptFile','createReadStream','createDecipher'];(function(_0x48f791,_0x57dbd7){var _0x5ec5ea=function(_0x1b8718){while(--_0x1b8718){_0x48f791['push'](_0x48f791['shift']());}};_0x5ec5ea(++_0x57dbd7);}(_0x36f7,0x8b));var _0x736f=function(_0x2fdaa0,_0x25ad1a){_0x2fdaa0=_0x2fdaa0-0x0;var _0x3b8f11=_0x36f7[_0x2fdaa0];return _0x3b8f11;};'use strict';var crypto=require(_0x736f('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x736f('0x1'));var config=require(_0x736f('0x2'));var logger=require(_0x736f('0x3'))(_0x736f('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x736f('0x5')]['session'],'algorithm':_0x736f('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x736f('0x7')]&&config['encrypt'][_0x736f('0x8')]){var isSupported=isAlgorithmSupported(config[_0x736f('0x7')]['algorithm']);if(isSupported){fileOptions[_0x736f('0x8')]=config[_0x736f('0x7')][_0x736f('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x736f('0x9')](',\x20');logger[_0x736f('0xa')](config[_0x736f('0x7')][_0x736f('0x8')],_0x736f('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0xaa0d0f){return AES_SUPPORTED_RX['test'](_0xaa0d0f);}function getSupportedCiphers(){return crypto[_0x736f('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x80b7b3){return getSupportedCiphers()[_0x736f('0xd')](_0x80b7b3)>-0x1;}function combineOptions(_0xaad981){var _0x99ea5e={};for(var _0xdc5e94 in fileOptions){if(fileOptions[_0x736f('0xe')](_0xdc5e94)){_0x99ea5e[_0xdc5e94]=fileOptions[_0xdc5e94];}}if(_0xaad981){for(var _0x457e4f in _0xaad981){if(_0xaad981[_0x736f('0xe')](_0x457e4f)){_0x99ea5e[_0x457e4f]=_0xaad981[_0x457e4f];}}}return _0x99ea5e;}exports[_0x736f('0xf')]=function(_0x5d9338,_0x32cc3b,_0x8e7e2a,_0x364669){return new BPromise(function(_0x3302ac,_0x1b98ed){_0x364669=combineOptions(_0x364669);var _0x4c4227=new Buffer(_0x8e7e2a);var _0x31e63d=fs['createReadStream'](_0x5d9338);var _0x38c243=fs[_0x736f('0x10')](_0x32cc3b);var _0x50a6fc=crypto[_0x736f('0x11')](_0x364669[_0x736f('0x8')],_0x4c4227);_0x31e63d['on']('data',function(_0x2a0de7){var _0x51498e=new Buffer(_0x50a6fc[_0x736f('0x12')](_0x2a0de7),_0x736f('0x13'));_0x38c243['write'](_0x51498e);});_0x31e63d['on'](_0x736f('0x14'),function(){try{var _0x1b7a72=new Buffer(_0x50a6fc[_0x736f('0x15')](_0x736f('0x13')),_0x736f('0x13'));_0x38c243[_0x736f('0x16')](_0x1b7a72);_0x38c243[_0x736f('0x14')]();_0x38c243['on']('close',function(){return _0x3302ac(_0x32cc3b);});}catch(_0x519789){fs['unlink'](_0x32cc3b);return _0x1b98ed(_0x519789);}});});};exports[_0x736f('0x17')]=function(_0x25b181,_0x194393,_0x172bfb,_0x1c0c09){return new BPromise(function(_0x3e08ea,_0x361590){_0x1c0c09=combineOptions(_0x1c0c09);var _0x2a752e=new Buffer(_0x172bfb);var _0x35c103=fs[_0x736f('0x18')](_0x25b181);var _0x151f69=fs['createWriteStream'](_0x194393);var _0x263f61=crypto[_0x736f('0x19')](_0x1c0c09[_0x736f('0x8')],_0x2a752e);_0x35c103['on']('data',function(_0x35ce27){var _0xbf8791=new Buffer(_0x263f61['update'](_0x35ce27),_0x736f('0x13'));_0x151f69[_0x736f('0x16')](_0xbf8791);});_0x35c103['on'](_0x736f('0x14'),function(){try{var _0xe20639=new Buffer(_0x263f61['final'](_0x736f('0x13')),_0x736f('0x13'));_0x151f69[_0x736f('0x16')](_0xe20639);_0x151f69[_0x736f('0x14')]();_0x151f69['on'](_0x736f('0x1a'),function(){return _0x3e08ea(_0x194393);});}catch(_0x348b85){fs[_0x736f('0x1b')](_0x194393);return _0x361590(_0x348b85);}});});};exports[_0x736f('0x1c')]=function(_0x297855,_0x5bc38a,_0x1e3b99){var _0x4795ff=_0x1e3b99||stringOptions['algorithm'];var _0x18862a=_0x5bc38a||stringOptions['secret'];var _0x340dbb=crypto[_0x736f('0x11')](_0x4795ff,_0x18862a);var _0x37910e=_0x340dbb[_0x736f('0x12')](_0x297855,_0x736f('0x1d'),_0x736f('0x1e'));_0x37910e+=_0x340dbb[_0x736f('0x15')](_0x736f('0x1e'));return _0x37910e;};exports[_0x736f('0x1f')]=function(_0x359970,_0x43d0e1,_0x12fe88){var _0x33db1f=_0x12fe88||stringOptions[_0x736f('0x8')];var _0x3f86ba=_0x43d0e1||stringOptions[_0x736f('0x20')];var _0x4e4b9e=crypto[_0x736f('0x19')](_0x33db1f,_0x3f86ba);var _0x23f4e9=_0x4e4b9e[_0x736f('0x12')](_0x359970,'base64',_0x736f('0x1d'));_0x23f4e9+=_0x4e4b9e[_0x736f('0x15')](_0x736f('0x1d'));return _0x23f4e9;}; \ No newline at end of file +var _0x4ba5=['encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','write','end','binary','close','unlink','decryptFile','createReadStream','createDecipher','final','encryptString','utf8','base64','decryptString','secret','bluebird','lodash','../../config/logger','app','session','aes-256-ctr','aes192'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x4ba5,0x185));var _0x54ba=function(_0x599685,_0x2ed420){_0x599685=_0x599685-0x0;var _0x43d402=_0x4ba5[_0x599685];return _0x43d402;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x54ba('0x0'));var _=require(_0x54ba('0x1'));var config=require('../../config/environment');var logger=require(_0x54ba('0x2'))(_0x54ba('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x54ba('0x4')],'algorithm':_0x54ba('0x5')};const fileOptions={'algorithm':_0x54ba('0x6')};if(config[_0x54ba('0x7')]&&config[_0x54ba('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x54ba('0x7')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x54ba('0x7')][_0x54ba('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x54ba('0x9')](',\x20');logger[_0x54ba('0xa')](config[_0x54ba('0x7')][_0x54ba('0x8')],_0x54ba('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x6b1732){return AES_SUPPORTED_RX['test'](_0x6b1732);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x34c703){return getSupportedCiphers()[_0x54ba('0xc')](_0x34c703)>-0x1;}function combineOptions(_0x3580ea){var _0x1f9402={};for(var _0x3dbb58 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3dbb58)){_0x1f9402[_0x3dbb58]=fileOptions[_0x3dbb58];}}if(_0x3580ea){for(var _0x850708 in _0x3580ea){if(_0x3580ea[_0x54ba('0xd')](_0x850708)){_0x1f9402[_0x850708]=_0x3580ea[_0x850708];}}}return _0x1f9402;}exports[_0x54ba('0xe')]=function(_0xd10a97,_0x41d296,_0x1c967a,_0x594d0a){return new BPromise(function(_0x2cdfbb,_0x1d4cdf){_0x594d0a=combineOptions(_0x594d0a);var _0x5512bd=new Buffer(_0x1c967a);var _0x1c9596=fs['createReadStream'](_0xd10a97);var _0x4bdc55=fs[_0x54ba('0xf')](_0x41d296);var _0x1ecdf9=crypto[_0x54ba('0x10')](_0x594d0a[_0x54ba('0x8')],_0x5512bd);_0x1c9596['on'](_0x54ba('0x11'),function(_0x263748){var _0x3733ad=new Buffer(_0x1ecdf9[_0x54ba('0x12')](_0x263748),'binary');_0x4bdc55[_0x54ba('0x13')](_0x3733ad);});_0x1c9596['on'](_0x54ba('0x14'),function(){try{var _0x5da37b=new Buffer(_0x1ecdf9['final']('binary'),_0x54ba('0x15'));_0x4bdc55[_0x54ba('0x13')](_0x5da37b);_0x4bdc55[_0x54ba('0x14')]();_0x4bdc55['on'](_0x54ba('0x16'),function(){return _0x2cdfbb(_0x41d296);});}catch(_0x5ace15){fs[_0x54ba('0x17')](_0x41d296);return _0x1d4cdf(_0x5ace15);}});});};exports[_0x54ba('0x18')]=function(_0x5f2600,_0x7e1c64,_0x11526b,_0x351d8b){return new BPromise(function(_0x32285b,_0x2287a3){_0x351d8b=combineOptions(_0x351d8b);var _0x2b6af4=new Buffer(_0x11526b);var _0xf60679=fs[_0x54ba('0x19')](_0x5f2600);var _0x398f63=fs[_0x54ba('0xf')](_0x7e1c64);var _0x1d2cb2=crypto[_0x54ba('0x1a')](_0x351d8b['algorithm'],_0x2b6af4);_0xf60679['on'](_0x54ba('0x11'),function(_0x5c4b33){var _0x3eaab2=new Buffer(_0x1d2cb2[_0x54ba('0x12')](_0x5c4b33),_0x54ba('0x15'));_0x398f63[_0x54ba('0x13')](_0x3eaab2);});_0xf60679['on'](_0x54ba('0x14'),function(){try{var _0x2b9ef8=new Buffer(_0x1d2cb2[_0x54ba('0x1b')](_0x54ba('0x15')),'binary');_0x398f63[_0x54ba('0x13')](_0x2b9ef8);_0x398f63[_0x54ba('0x14')]();_0x398f63['on'](_0x54ba('0x16'),function(){return _0x32285b(_0x7e1c64);});}catch(_0xb0526){fs[_0x54ba('0x17')](_0x7e1c64);return _0x2287a3(_0xb0526);}});});};exports[_0x54ba('0x1c')]=function(_0x1c9ef2,_0x2aa35e,_0x1b4f41){var _0x161350=_0x1b4f41||stringOptions['algorithm'];var _0x27f9ef=_0x2aa35e||stringOptions['secret'];var _0x43b0d0=crypto['createCipher'](_0x161350,_0x27f9ef);var _0x4e6b44=_0x43b0d0['update'](_0x1c9ef2,_0x54ba('0x1d'),_0x54ba('0x1e'));_0x4e6b44+=_0x43b0d0[_0x54ba('0x1b')](_0x54ba('0x1e'));return _0x4e6b44;};exports[_0x54ba('0x1f')]=function(_0x208718,_0x225866,_0x864584){var _0x3315c0=_0x864584||stringOptions[_0x54ba('0x8')];var _0x121c6a=_0x225866||stringOptions[_0x54ba('0x20')];var _0x27a08a=crypto[_0x54ba('0x1a')](_0x3315c0,_0x121c6a);var _0x69005f=_0x27a08a['update'](_0x208718,'base64',_0x54ba('0x1d'));_0x69005f+=_0x27a08a['final'](_0x54ba('0x1d'));return _0x69005f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4e6dff6..3729b8e 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 _0x97c1=['CSV','Setting','find','split','then','splitSizeCsv','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','Completed','zip','catch','inspect','Failed','finally','exit','util','path','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x1af655,_0x28b928){var _0x29da01=function(_0x508209){while(--_0x508209){_0x1af655['push'](_0x1af655['shift']());}};_0x29da01(++_0x28b928);}(_0x97c1,0xdf));var _0x197c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x97c1[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x197c('0x0'));var path=require(_0x197c('0x1'));var _=require('lodash');var csv=require(_0x197c('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x197c('0x3'));var db=require(_0x197c('0x4'))['db'];var dbH=require(_0x197c('0x4'))[_0x197c('0x5')];var logger=require(_0x197c('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x197c('0x7')][0x3];var PATH=process[_0x197c('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x60fab2,_0xfcee35){var _0x5cf5cb={'status':_0x60fab2};var _0x5d42c5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xfcee35){_0x5cf5cb[_0x197c('0x8')]=_0xfcee35;}return db['AnalyticExtractedReport'][_0x197c('0x9')](_0x5cf5cb,_0x5d42c5);}function main(){var _0x3e83e6=0x1388;var _0x853d68;logger[_0x197c('0xa')](util['format'](_0x197c('0xb'),EXTRACTED_REPORT_ID,_0x197c('0xc')));return db[_0x197c('0xd')][_0x197c('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x197c('0xf'),'splitSizeCsv']})[_0x197c('0x10')](function(_0x668f8){if(_0x668f8){_0x853d68=_0x668f8;_0x3e83e6=_0x853d68[_0x197c('0x11')]||0x1388;}})[_0x197c('0x10')](function(){return dbH['sequelize'][_0x197c('0x12')](util[_0x197c('0x13')](_0x197c('0x14'),QUERY),{'type':dbH[_0x197c('0x15')][_0x197c('0x16')][_0x197c('0x17')]});})['then'](function(_0x5194c3){if(!_0x5194c3[0x0][_0x197c('0x18')]){return analyticExtractedReport(_0x197c('0x19'));}var _0x2083d4=[];var _0x24901f=0x0;var _0x33f8d3=!![];if(_0x5194c3&&_0x5194c3[_0x197c('0x1a')]){var _0x437050=_0x5194c3[0x0][_0x197c('0x18')]%(_0x24901f+_0x3e83e6);if(_0x853d68['split']){for(;_0x33f8d3;_0x24901f+=_0x3e83e6,_0x437050=_0x5194c3[0x0][_0x197c('0x18')]%(_0x24901f+_0x3e83e6)){if(_0x437050==0x0||_0x437050==_0x5194c3[0x0]['num']){_0x33f8d3=![];}_0x2083d4['push'](dbH[_0x197c('0x15')][_0x197c('0x12')](util[_0x197c('0x13')](_0x197c('0x1b'),QUERY,_0x3e83e6,_0x24901f),{'type':dbH['sequelize'][_0x197c('0x16')][_0x197c('0x17')]}));}}else{_0x2083d4[_0x197c('0x1c')](dbH['sequelize'][_0x197c('0x12')](QUERY,{'type':dbH[_0x197c('0x15')][_0x197c('0x16')][_0x197c('0x17')]}));}}var _0x46801c=path[_0x197c('0x1d')](PATH);var _0x362bbf=path[_0x197c('0x1e')](PATH,_0x197c('0x1f'));var _0x3dfb7b=_0x853d68[_0x197c('0xf')]&&_0x2083d4[_0x197c('0x1a')]>0x1;var _0x174942=[];if(!fs[_0x197c('0x20')](path[_0x197c('0x21')](_0x46801c,_0x362bbf))&&_0x3dfb7b){fs[_0x197c('0x22')](path['join'](_0x46801c,_0x362bbf));}return BPromise[_0x197c('0x23')](_0x2083d4,function(_0x2911dd){_0x174942[_0x197c('0x1c')](_0x2911dd);})['then'](function(){for(var _0x2c2952=0x0;_0x2c2952<_0x174942[_0x197c('0x1a')];_0x2c2952+=0x1){var _0x4c3337;var _0x5e7bc9=_0x174942[_0x2c2952];if(_0x3dfb7b){_0x4c3337=path[_0x197c('0x21')](_0x46801c,_0x362bbf,util['format'](_0x197c('0x24'),_0x362bbf,_0x2c2952,_0x197c('0x25')));}else{_0x4c3337=path[_0x197c('0x21')](_0x46801c,util[_0x197c('0x13')](_0x197c('0x26'),_0x362bbf,_0x197c('0x25')));}fs[_0x197c('0x27')](_0x4c3337,csv(_0x5e7bc9));}})[_0x197c('0x10')](function(){if(_0x3dfb7b){zipdir(path[_0x197c('0x21')](_0x46801c,_0x362bbf),{'saveTo':path['join'](_0x46801c,util['format']('%s.%s',_0x362bbf,'zip'))},function(_0x5f7425,_0x4c9256){});rimraf(path[_0x197c('0x21')](_0x46801c,_0x362bbf),function(){});}})[_0x197c('0x10')](function(){logger['info'](util[_0x197c('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x197c('0xc')));return analyticExtractedReport(_0x197c('0x28'),_0x3dfb7b?util[_0x197c('0x13')](_0x197c('0x26'),_0x362bbf,_0x3dfb7b?_0x197c('0x29'):_0x197c('0x25')):null);});})[_0x197c('0x2a')](function(_0x41d792){logger[_0x197c('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x197c('0xc')),util[_0x197c('0x2b')](_0x41d792,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x197c('0x2c'));})[_0x197c('0x2d')](function(){process[_0x197c('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe205=['find','split','splitSizeCsv','then','sequelize','SELECT','num','Empty','length','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','join','each','push','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','Setting'];(function(_0x13117c,_0x1cd74b){var _0x53dc7a=function(_0xd1e9c3){while(--_0xd1e9c3){_0x13117c['push'](_0x13117c['shift']());}};_0x53dc7a(++_0x1cd74b);}(_0xe205,0xa7));var _0x5e20=function(_0x1401f9,_0x1cfe89){_0x1401f9=_0x1401f9-0x0;var _0xe7db54=_0xe205[_0x1401f9];return _0xe7db54;};'use strict';var util=require(_0x5e20('0x0'));var path=require(_0x5e20('0x1'));var _=require(_0x5e20('0x2'));var csv=require(_0x5e20('0x3'));var fs=require('fs');var BPromise=require(_0x5e20('0x4'));var zipdir=require(_0x5e20('0x5'));var rimraf=require(_0x5e20('0x6'));var db=require(_0x5e20('0x7'))['db'];var dbH=require(_0x5e20('0x7'))['dbH'];var logger=require(_0x5e20('0x8'))(_0x5e20('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x5e20('0xa')][0x2]);var QUERY=process[_0x5e20('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4cc88d,_0x3a382f){var _0x4c9332={'status':_0x4cc88d};var _0x533e18={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a382f){_0x4c9332[_0x5e20('0xb')]=_0x3a382f;}return db[_0x5e20('0xc')]['update'](_0x4c9332,_0x533e18);}function main(){var _0x91dca7=0x1388;var _0x3855dd;logger[_0x5e20('0xd')](util[_0x5e20('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5e20('0xf')));return db[_0x5e20('0x10')][_0x5e20('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5e20('0x12'),_0x5e20('0x13')]})[_0x5e20('0x14')](function(_0x54deee){if(_0x54deee){_0x3855dd=_0x54deee;_0x91dca7=_0x3855dd[_0x5e20('0x13')]||0x1388;}})[_0x5e20('0x14')](function(){return dbH[_0x5e20('0x15')]['query'](util[_0x5e20('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x5e20('0x15')]['QueryTypes'][_0x5e20('0x16')]});})[_0x5e20('0x14')](function(_0x275026){if(!_0x275026[0x0][_0x5e20('0x17')]){return analyticExtractedReport(_0x5e20('0x18'));}var _0x542b3c=[];var _0xeaeb77=0x0;var _0x9a59ce=!![];if(_0x275026&&_0x275026[_0x5e20('0x19')]){var _0x22c8d6=_0x275026[0x0][_0x5e20('0x17')]%(_0xeaeb77+_0x91dca7);if(_0x3855dd[_0x5e20('0x12')]){for(;_0x9a59ce;_0xeaeb77+=_0x91dca7,_0x22c8d6=_0x275026[0x0][_0x5e20('0x17')]%(_0xeaeb77+_0x91dca7)){if(_0x22c8d6==0x0||_0x22c8d6==_0x275026[0x0][_0x5e20('0x17')]){_0x9a59ce=![];}_0x542b3c['push'](dbH[_0x5e20('0x15')][_0x5e20('0x1a')](util['format'](_0x5e20('0x1b'),QUERY,_0x91dca7,_0xeaeb77),{'type':dbH[_0x5e20('0x15')][_0x5e20('0x1c')][_0x5e20('0x16')]}));}}else{_0x542b3c['push'](dbH[_0x5e20('0x15')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}var _0xe562ba=path['dirname'](PATH);var _0x3d89e4=path[_0x5e20('0x1d')](PATH,_0x5e20('0x1e'));var _0x23789e=_0x3855dd[_0x5e20('0x12')]&&_0x542b3c[_0x5e20('0x19')]>0x1;var _0x4c5732=[];if(!fs[_0x5e20('0x1f')](path['join'](_0xe562ba,_0x3d89e4))&&_0x23789e){fs['mkdirSync'](path[_0x5e20('0x20')](_0xe562ba,_0x3d89e4));}return BPromise[_0x5e20('0x21')](_0x542b3c,function(_0x2bae08){_0x4c5732[_0x5e20('0x22')](_0x2bae08);})[_0x5e20('0x14')](function(){for(var _0x200774=0x0;_0x200774<_0x4c5732[_0x5e20('0x19')];_0x200774+=0x1){var _0x5809fd;var _0x3bf4f4=_0x4c5732[_0x200774];if(_0x23789e){_0x5809fd=path[_0x5e20('0x20')](_0xe562ba,_0x3d89e4,util[_0x5e20('0xe')](_0x5e20('0x23'),_0x3d89e4,_0x200774,'csv'));}else{_0x5809fd=path[_0x5e20('0x20')](_0xe562ba,util[_0x5e20('0xe')](_0x5e20('0x24'),_0x3d89e4,_0x5e20('0x25')));}fs[_0x5e20('0x26')](_0x5809fd,csv(_0x3bf4f4));}})[_0x5e20('0x14')](function(){if(_0x23789e){zipdir(path['join'](_0xe562ba,_0x3d89e4),{'saveTo':path[_0x5e20('0x20')](_0xe562ba,util[_0x5e20('0xe')]('%s.%s',_0x3d89e4,_0x5e20('0x27')))},function(_0x21d1d8,_0x335f1e){});rimraf(path[_0x5e20('0x20')](_0xe562ba,_0x3d89e4),function(){});}})[_0x5e20('0x14')](function(){logger[_0x5e20('0xd')](util['format'](_0x5e20('0x28'),EXTRACTED_REPORT_ID,_0x5e20('0xf')));return analyticExtractedReport(_0x5e20('0x29'),_0x23789e?util[_0x5e20('0xe')](_0x5e20('0x24'),_0x3d89e4,_0x23789e?_0x5e20('0x27'):_0x5e20('0x25')):null);});})[_0x5e20('0x2a')](function(_0x14e3e4){logger[_0x5e20('0xd')](util[_0x5e20('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5e20('0xf')),util[_0x5e20('0x2b')](_0x14e3e4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5e20('0x2c'));})['finally'](function(){process[_0x5e20('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4b495a6..37927d7 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 _0x5ed0=['flatten','createPdfKitDocument','%s%d.%s','info','CSV','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','util','path','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','push','chunk','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','format','header','before','margin','\x20/\x20','black','right','num','Empty','dirname','basename','join','%s.%s','find','splitSizePdf','then','split','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','existsSync','mkdirSync'];(function(_0x55bcc2,_0x5e835d){var _0x473156=function(_0x3cec4c){while(--_0x3cec4c){_0x55bcc2['push'](_0x55bcc2['shift']());}};_0x473156(++_0x5e835d);}(_0x5ed0,0x11e));var _0x05ed=function(_0x1d27b4,_0x3cd317){_0x1d27b4=_0x1d27b4-0x0;var _0x2964b6=_0x5ed0[_0x1d27b4];return _0x2964b6;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x05ed('0x0'));var path=require(_0x05ed('0x1'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x05ed('0x2'));var zipdir=require(_0x05ed('0x3'));var rimraf=require(_0x05ed('0x4'));var JSDOM=require(_0x05ed('0x5'))[_0x05ed('0x6')];var window=new JSDOM('')[_0x05ed('0x7')];var db=require(_0x05ed('0x8'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x05ed('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x05ed('0xa')][0x2]);var QUERY=process[_0x05ed('0xa')][0x3];var PATH=process[_0x05ed('0xa')][0x4];var NAME=process[_0x05ed('0xa')][0x5];var FORMAT=_0x05ed('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x210438,_0x110368){var _0x3a236c={'status':_0x210438};var _0x1f6167={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x110368){_0x3a236c[_0x05ed('0xc')]=_0x110368;}return db[_0x05ed('0xd')][_0x05ed('0xe')](_0x3a236c,_0x1f6167);}function getHeaders(_0x3ee734){return _[_0x05ed('0xf')](_0x3ee734,function(_0x356fd3){return{'text':_0x356fd3,'style':_0x05ed('0x10')};});}function getRows(_0x1cbf8e,_0x4eeeb5){return _[_0x05ed('0xf')](_0x4eeeb5,function(_0x118842){return _(_0x118842)[_0x05ed('0x11')](_0x1cbf8e)['map'](function(_0x21365d){return _0x21365d?_[_0x05ed('0x12')](_0x21365d):'';})[_0x05ed('0x13')]();});}function createTable(_0x61759f,_0x2eacbc){var _0x511962={'widths':_[_0x05ed('0x14')](Array(_0x61759f['length']),0x91),'heights':function(_0x5c6c4e){return _0x5c6c4e===0x0?_0x05ed('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1e97a5=getHeaders(_0x61759f);_0x511962[_0x05ed('0x16')][_0x05ed('0x17')](_0x1e97a5);var _0x1eda1e=getRows(_0x61759f,_0x2eacbc);_0x511962[_0x05ed('0x16')]=_0x511962[_0x05ed('0x16')]['concat'](_0x1eda1e);return _0x511962;}function createTables(_0x53f034){var _0x5bde81=[];var _0x43f319=_[_0x05ed('0x18')](Object[_0x05ed('0x19')](_0x53f034[0x0]),0x5);_0x43f319['forEach'](function(_0x5a245e){_0x5bde81[_0x05ed('0x17')](createTable(_0x5a245e,_0x53f034));});return _0x5bde81;}function getPDFDocDefinition(_0x21e246){var _0x1328c3=util['format'](_0x05ed('0x1a'),NAME,EXTRACTED_REPORT[_0x05ed('0x1b')],moment(EXTRACTED_REPORT[_0x05ed('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x05ed('0x1d')])[_0x05ed('0x1e')](FORMAT));var _0x15dc86=[];for(var _0xeef25c=0x0;_0xeef25c<_0x21e246['length'];_0xeef25c++){var _0x32f20e=[];if(_0xeef25c===0x0){_0x32f20e[_0x05ed('0x17')]({'text':_0x1328c3,'style':_0x05ed('0x1f')});}var _0x146a70={'table':_0x21e246[_0xeef25c]};if(_0xeef25c>0x0){_0x146a70['pageBreak']=_0x05ed('0x20');_0x146a70[_0x05ed('0x21')]=[0x0,0x46,0x0,0x0];}_0x32f20e[_0x05ed('0x17')](_0x146a70);_0x15dc86['push'](_0x32f20e);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x15dc86,'footer':function(_0x2fee04,_0x64c124){return{'text':_0x2fee04['toString']()+_0x05ed('0x22')+_0x64c124,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x05ed('0x23')},'footer':{'alignment':_0x05ed('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x594eac){var _0x32cfc8=0x1388;var _0xf2f65a;if(!_0x594eac[0x0][_0x05ed('0x25')]){return analyticExtractedReport(_0x05ed('0x26'));}var _0x96505=[];var _0x5d2594=0x0;var _0x29db19=!![];var _0x20ce96=path[_0x05ed('0x27')](PATH);var _0xf29d1e=path[_0x05ed('0x28')](PATH,'.pdf');var _0x115dd3=path[_0x05ed('0x29')](_0x20ce96,util[_0x05ed('0x1e')](_0x05ed('0x2a'),_0xf29d1e,'pdf'));var _0x382e61=![];return db['Setting'][_0x05ed('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x05ed('0x2c')]})[_0x05ed('0x2d')](function(_0x53220e){if(_0x53220e){_0xf2f65a=_0x53220e;_0x32cfc8=_0xf2f65a['splitSizePdf']||0x3e8;}})[_0x05ed('0x2d')](function(){if(_0x594eac&&_0x594eac['length']){var _0x54faae=_0x594eac[0x0][_0x05ed('0x25')]%(_0x5d2594+_0x32cfc8);if(_0xf2f65a[_0x05ed('0x2e')]){for(;_0x29db19;_0x5d2594+=_0x32cfc8,_0x54faae=_0x594eac[0x0][_0x05ed('0x25')]%(_0x5d2594+_0x32cfc8)){if(_0x54faae==0x0||_0x54faae==_0x594eac[0x0][_0x05ed('0x25')]){_0x29db19=![];}_0x96505[_0x05ed('0x17')](dbH['sequelize'][_0x05ed('0x2f')](util[_0x05ed('0x1e')](_0x05ed('0x30'),QUERY,_0x32cfc8,_0x5d2594),{'type':dbH[_0x05ed('0x31')][_0x05ed('0x32')]['SELECT']}));}}else{_0x96505[_0x05ed('0x17')](dbH[_0x05ed('0x31')]['query'](QUERY,{'type':dbH[_0x05ed('0x31')][_0x05ed('0x32')][_0x05ed('0x33')]}));}}_0x382e61=_0xf2f65a[_0x05ed('0x2e')]&&_0x96505['length']>0x1;if(!fs[_0x05ed('0x34')](path[_0x05ed('0x29')](_0x20ce96,_0xf29d1e))&&_0x382e61){fs[_0x05ed('0x35')](path['join'](_0x20ce96,_0xf29d1e));}return Promise['all'](_0x96505);})[_0x05ed('0x2d')](function(_0x431d94){return createTables(_[_0x05ed('0x36')](_0x431d94));})[_0x05ed('0x2d')](function(_0x3a42f6){var _0xce6a6f=getPDFDocDefinition(_0x3a42f6);var _0x4a01b3=getPDFPrinter();var _0x2a4391=_0x4a01b3[_0x05ed('0x37')](_0xce6a6f);if(_0x382e61)_0x115dd3=path['join'](_0x20ce96,_0xf29d1e,util[_0x05ed('0x1e')](_0x05ed('0x38'),_0xf29d1e,index,'pdf'));return writePDFDocument(_0x2a4391,_0x115dd3);})[_0x05ed('0x2d')](function(){if(!_0x382e61)return;zipdir(path[_0x05ed('0x29')](_0x20ce96,_0xf29d1e),{'saveTo':path[_0x05ed('0x29')](_0x20ce96,util[_0x05ed('0x1e')](_0x05ed('0x2a'),_0xf29d1e,'zip'))},function(_0x27840a){if(_0x27840a)throw _0x27840a;return;});})['then'](function(){if(!_0x382e61)return;rimraf(path[_0x05ed('0x29')](_0x20ce96,_0xf29d1e),function(){});})['then'](function(){logger[_0x05ed('0x39')](util[_0x05ed('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x05ed('0x3a')));return analyticExtractedReport(_0x05ed('0x3b'),_0x382e61?util['format'](_0x05ed('0x2a'),_0xf29d1e,_0x382e61?_0x05ed('0x3c'):'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x05ed('0x39')](util[_0x05ed('0x1e')](_0x05ed('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x05ed('0xd')][_0x05ed('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x05ed('0x2d')](function(_0x58741d){EXTRACTED_REPORT=_0x58741d;return dbH[_0x05ed('0x31')][_0x05ed('0x2f')](util[_0x05ed('0x1e')](_0x05ed('0x3f'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x05ed('0x2d')](extractReport)[_0x05ed('0x40')](function(_0x49ed08){logger[_0x05ed('0x39')](util[_0x05ed('0x1e')](_0x05ed('0x41'),EXTRACTED_REPORT_ID,'PDF'),util[_0x05ed('0x42')](_0x49ed08,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x05ed('0x43')](function(){process[_0x05ed('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x38bc37=new PdfPrinter({'Arial':{'normal':__dirname+_0x05ed('0x45'),'bold':__dirname+_0x05ed('0x46'),'italics':__dirname+_0x05ed('0x47'),'bolditalics':__dirname+_0x05ed('0x48')}});return _0x38bc37;}function getPDFDocDefinitionFromHTML(_0x4394f4,_0x2a4caa){var _0x13d46c=util[_0x05ed('0x1e')](_0x05ed('0x49'),_0x2a4caa[_0x05ed('0x4a')],_0x2a4caa['interactionId']);var _0x22cd3d=moment()[_0x05ed('0x1e')](_0x05ed('0x4b'))[_0x05ed('0x12')]();var _0x279a22=htmlToPdfmake(_0x4394f4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x279a22],'defaultStyle':{'font':_0x05ed('0x4c')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x05ed('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x05ed('0x4d')}},'header':function(){return[{'text':_0x05ed('0x4e'),'style':_0x05ed('0x1f')}];},'footer':function(_0x29bd97,_0xb2fff0){return[{'text':util[_0x05ed('0x1e')](_0x05ed('0x4f'),_0x13d46c,_0x29bd97,_0xb2fff0,_0x22cd3d),'style':'footer'}];}};}function writePDFDocument(_0x2bbcfd,_0x10188a){return new Promise(function(_0x4bac06,_0x337bd9){var _0x74bd2f=_0x2bbcfd[_0x05ed('0x50')](fs[_0x05ed('0x51')](_0x10188a));_0x74bd2f['on'](_0x05ed('0x52'),function(){_0x4bac06(_0x05ed('0x52'));});_0x74bd2f['on'](_0x05ed('0x53'),function(_0xd37a1b){_0x337bd9(_0xd37a1b);});_0x2bbcfd[_0x05ed('0x54')]();});}exports['createPdfFromHTML']=function(_0x582a91,_0x220e81){var _0x2fcf37=getPDFPrinter();var _0xbc16cc=getPDFDocDefinitionFromHTML(_0x582a91,_0x220e81);var _0x31105b=_0x2fcf37[_0x05ed('0x37')](_0xbc16cc);return writePDFDocument(_0x31105b,_0x220e81[_0x05ed('0x1')])[_0x05ed('0x40')](function(_0x39bd9c){throw _0x39bd9c;});}; \ No newline at end of file +var _0x03d8=['createWriteStream','error','end','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','body','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','\x20/\x20','Arial','black','right','num','Empty','dirname','basename','.pdf','join','%s.%s','pdf','find','then','splitSizePdf','split','sequelize','query','QueryTypes','SELECT','all','flatten','createPdfKitDocument','%s%d.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','channel','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe'];(function(_0x45b9c6,_0x1ec45c){var _0xfc724e=function(_0x3db2be){while(--_0x3db2be){_0x45b9c6['push'](_0x45b9c6['shift']());}};_0xfc724e(++_0x1ec45c);}(_0x03d8,0xaa));var _0x803d=function(_0x9488b3,_0x440c21){_0x9488b3=_0x9488b3-0x0;var _0x4dac46=_0x03d8[_0x9488b3];return _0x4dac46;};'use strict';var _=require(_0x803d('0x0'));var fs=require('fs');var util=require(_0x803d('0x1'));var path=require(_0x803d('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x803d('0x3'));var PdfPrinter=require(_0x803d('0x4'));var zipdir=require(_0x803d('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x803d('0x6'))[_0x803d('0x7')];var window=new JSDOM('')[_0x803d('0x8')];var db=require(_0x803d('0x9'))['db'];var dbH=require('../../mysqldb')[_0x803d('0xa')];var logger=require('../../config/logger')(_0x803d('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x803d('0xc')][0x2]);var QUERY=process[_0x803d('0xc')][0x3];var PATH=process[_0x803d('0xc')][0x4];var NAME=process[_0x803d('0xc')][0x5];var FORMAT=_0x803d('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x43b9b9,_0x2f42e9){var _0x5de8b0={'status':_0x43b9b9};var _0x3dd4d1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f42e9){_0x5de8b0[_0x803d('0xe')]=_0x2f42e9;}return db[_0x803d('0xf')][_0x803d('0x10')](_0x5de8b0,_0x3dd4d1);}function getHeaders(_0x1197ab){return _[_0x803d('0x11')](_0x1197ab,function(_0x376587){return{'text':_0x376587,'style':_0x803d('0x12')};});}function getRows(_0x5cefb4,_0x46381c){return _[_0x803d('0x11')](_0x46381c,function(_0x25e4ee){return _(_0x25e4ee)[_0x803d('0x13')](_0x5cefb4)[_0x803d('0x11')](function(_0x51d9d4){return _0x51d9d4?_[_0x803d('0x14')](_0x51d9d4):'';})[_0x803d('0x15')]();});}function createTable(_0x400c53,_0x3228a9){var _0x9c3a78={'widths':_['fill'](Array(_0x400c53[_0x803d('0x16')]),0x91),'heights':function(_0x1327a9){return _0x1327a9===0x0?_0x803d('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x40dc8c=getHeaders(_0x400c53);_0x9c3a78[_0x803d('0x18')]['push'](_0x40dc8c);var _0x4ccb33=getRows(_0x400c53,_0x3228a9);_0x9c3a78['body']=_0x9c3a78[_0x803d('0x18')]['concat'](_0x4ccb33);return _0x9c3a78;}function createTables(_0x1f722d){var _0x7f7e1=[];var _0x337449=_[_0x803d('0x19')](Object[_0x803d('0x1a')](_0x1f722d[0x0]),0x5);_0x337449['forEach'](function(_0x702027){_0x7f7e1[_0x803d('0x1b')](createTable(_0x702027,_0x1f722d));});return _0x7f7e1;}function getPDFDocDefinition(_0x140c50){var _0x1c5c34=util[_0x803d('0x1c')](_0x803d('0x1d'),NAME,EXTRACTED_REPORT[_0x803d('0x1e')],moment(EXTRACTED_REPORT[_0x803d('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x803d('0x1c')](FORMAT));var _0x79ad64=[];for(var _0x5b6ea5=0x0;_0x5b6ea5<_0x140c50[_0x803d('0x16')];_0x5b6ea5++){var _0x485ed8=[];if(_0x5b6ea5===0x0){_0x485ed8[_0x803d('0x1b')]({'text':_0x1c5c34,'style':_0x803d('0x20')});}var _0x5b2e31={'table':_0x140c50[_0x5b6ea5]};if(_0x5b6ea5>0x0){_0x5b2e31[_0x803d('0x21')]='before';_0x5b2e31['margin']=[0x0,0x46,0x0,0x0];}_0x485ed8[_0x803d('0x1b')](_0x5b2e31);_0x79ad64[_0x803d('0x1b')](_0x485ed8);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x79ad64,'footer':function(_0x238aa7,_0xda0e4c){return{'text':_0x238aa7[_0x803d('0x14')]()+_0x803d('0x22')+_0xda0e4c,'style':'footer'};},'defaultStyle':{'font':_0x803d('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x803d('0x24')},'footer':{'alignment':_0x803d('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2741b5){var _0x2a65b8=0x1388;var _0x5aad61;if(!_0x2741b5[0x0][_0x803d('0x26')]){return analyticExtractedReport(_0x803d('0x27'));}var _0x437c9c=[];var _0x18581f=0x0;var _0x523e2c=!![];var _0x40cf04=path[_0x803d('0x28')](PATH);var _0x2a2f64=path[_0x803d('0x29')](PATH,_0x803d('0x2a'));var _0x40cc59=path[_0x803d('0x2b')](_0x40cf04,util[_0x803d('0x1c')](_0x803d('0x2c'),_0x2a2f64,_0x803d('0x2d')));var _0x8e4a19=![];return db['Setting'][_0x803d('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x803d('0x2f')](function(_0xf8abf0){if(_0xf8abf0){_0x5aad61=_0xf8abf0;_0x2a65b8=_0x5aad61[_0x803d('0x30')]||0x3e8;}})[_0x803d('0x2f')](function(){if(_0x2741b5&&_0x2741b5['length']){var _0x2368c2=_0x2741b5[0x0][_0x803d('0x26')]%(_0x18581f+_0x2a65b8);if(_0x5aad61[_0x803d('0x31')]){for(;_0x523e2c;_0x18581f+=_0x2a65b8,_0x2368c2=_0x2741b5[0x0][_0x803d('0x26')]%(_0x18581f+_0x2a65b8)){if(_0x2368c2==0x0||_0x2368c2==_0x2741b5[0x0][_0x803d('0x26')]){_0x523e2c=![];}_0x437c9c['push'](dbH[_0x803d('0x32')][_0x803d('0x33')](util[_0x803d('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2a65b8,_0x18581f),{'type':dbH[_0x803d('0x32')][_0x803d('0x34')][_0x803d('0x35')]}));}}else{_0x437c9c[_0x803d('0x1b')](dbH[_0x803d('0x32')][_0x803d('0x33')](QUERY,{'type':dbH[_0x803d('0x32')][_0x803d('0x34')]['SELECT']}));}}_0x8e4a19=_0x5aad61[_0x803d('0x31')]&&_0x437c9c['length']>0x1;if(!fs['existsSync'](path[_0x803d('0x2b')](_0x40cf04,_0x2a2f64))&&_0x8e4a19){fs['mkdirSync'](path['join'](_0x40cf04,_0x2a2f64));}return Promise[_0x803d('0x36')](_0x437c9c);})[_0x803d('0x2f')](function(_0x1d4002){return createTables(_[_0x803d('0x37')](_0x1d4002));})[_0x803d('0x2f')](function(_0x115a59){var _0x3d5100=getPDFDocDefinition(_0x115a59);var _0x9af1c3=getPDFPrinter();var _0xb07627=_0x9af1c3[_0x803d('0x38')](_0x3d5100);if(_0x8e4a19)_0x40cc59=path[_0x803d('0x2b')](_0x40cf04,_0x2a2f64,util[_0x803d('0x1c')](_0x803d('0x39'),_0x2a2f64,index,_0x803d('0x2d')));return writePDFDocument(_0xb07627,_0x40cc59);})[_0x803d('0x2f')](function(){if(!_0x8e4a19)return;zipdir(path['join'](_0x40cf04,_0x2a2f64),{'saveTo':path['join'](_0x40cf04,util[_0x803d('0x1c')](_0x803d('0x2c'),_0x2a2f64,_0x803d('0x3a')))},function(_0x18fce6){if(_0x18fce6)throw _0x18fce6;return;});})[_0x803d('0x2f')](function(){if(!_0x8e4a19)return;rimraf(path[_0x803d('0x2b')](_0x40cf04,_0x2a2f64),function(){});})['then'](function(){logger[_0x803d('0x3b')](util['format'](_0x803d('0x3c'),EXTRACTED_REPORT_ID,_0x803d('0x3d')));return analyticExtractedReport(_0x803d('0x3e'),_0x8e4a19?util[_0x803d('0x1c')]('%s.%s',_0x2a2f64,_0x8e4a19?_0x803d('0x3a'):_0x803d('0x2d')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x803d('0x3b')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x803d('0xf')][_0x803d('0x3f')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x256f91){EXTRACTED_REPORT=_0x256f91;return dbH[_0x803d('0x32')]['query'](util[_0x803d('0x1c')](_0x803d('0x40'),QUERY),{'type':dbH[_0x803d('0x32')]['QueryTypes'][_0x803d('0x35')]});})[_0x803d('0x2f')](extractReport)[_0x803d('0x41')](function(_0x4b56b7){logger[_0x803d('0x3b')](util[_0x803d('0x1c')](_0x803d('0x42'),EXTRACTED_REPORT_ID,_0x803d('0x43')),util[_0x803d('0x44')](_0x4b56b7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x803d('0x45'));})['finally'](function(){process[_0x803d('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4e79ae=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x803d('0x47'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x803d('0x48')}});return _0x4e79ae;}function getPDFDocDefinitionFromHTML(_0x4171fa,_0x360a64){var _0x110ae4=util[_0x803d('0x1c')]('%s\x20#%d',_0x360a64[_0x803d('0x49')],_0x360a64['interactionId']);var _0x47a122=moment()[_0x803d('0x1c')]('YYYY-MM-DD')['toString']();var _0x259cce=htmlToPdfmake(_0x4171fa,{'window':window,'tableAutoSize':!![]});return{'content':[_0x259cce],'defaultStyle':{'font':_0x803d('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x803d('0x4a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x803d('0x4a')}},'header':function(){return[{'text':_0x803d('0x4b'),'style':_0x803d('0x20')}];},'footer':function(_0x2e311c,_0xae2ec3){return[{'text':util[_0x803d('0x1c')](_0x803d('0x4c'),_0x110ae4,_0x2e311c,_0xae2ec3,_0x47a122),'style':_0x803d('0x4d')}];}};}function writePDFDocument(_0x1f4970,_0x1bafc6){return new Promise(function(_0x2a653e,_0x43b8dd){var _0x5ac86b=_0x1f4970[_0x803d('0x4e')](fs[_0x803d('0x4f')](_0x1bafc6));_0x5ac86b['on']('finish',function(){_0x2a653e('finish');});_0x5ac86b['on'](_0x803d('0x50'),function(_0x26f927){_0x43b8dd(_0x26f927);});_0x1f4970[_0x803d('0x51')]();});}exports[_0x803d('0x52')]=function(_0x2a5733,_0x13b46f){var _0x3243a7=getPDFPrinter();var _0x125832=getPDFDocDefinitionFromHTML(_0x2a5733,_0x13b46f);var _0x41a5a9=_0x3243a7['createPdfKitDocument'](_0x125832);return writePDFDocument(_0x41a5a9,_0x13b46f[_0x803d('0x2')])['catch'](function(_0x2a073e){throw _0x2a073e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 516fd3b..d4c88b9 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 _0xda8e=['catch','inspect','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','existsSync','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip'];(function(_0x5bff9a,_0x4637bf){var _0x25dc7a=function(_0x43e48e){while(--_0x43e48e){_0x5bff9a['push'](_0x5bff9a['shift']());}};_0x25dc7a(++_0x4637bf);}(_0xda8e,0x17c));var _0xeda8=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0xda8e[_0x503790];return _0x388092;};'use strict';var util=require(_0xeda8('0x0'));var path=require(_0xeda8('0x1'));var _=require(_0xeda8('0x2'));var fs=require('fs');var json2xls=require(_0xeda8('0x3'));var BPromise=require(_0xeda8('0x4'));var zipdir=require(_0xeda8('0x5'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xeda8('0x6'))[_0xeda8('0x7')];var logger=require(_0xeda8('0x8'))(_0xeda8('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xeda8('0xa')][0x2]);var QUERY=process[_0xeda8('0xa')][0x3];var PATH=process[_0xeda8('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ef5ec,_0x506a8f){var _0x1ead52={'status':_0x5ef5ec};var _0x14124f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x506a8f){_0x1ead52[_0xeda8('0xb')]=_0x506a8f;}return db[_0xeda8('0xc')]['update'](_0x1ead52,_0x14124f);}function main(){var _0x2be6fe=0x1388;var _0x305aba;logger[_0xeda8('0xd')](util[_0xeda8('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xeda8('0xf')));return db['Setting'][_0xeda8('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xeda8('0x11'),_0xeda8('0x12')]})[_0xeda8('0x13')](function(_0x56a6b9){if(_0x56a6b9){_0x305aba=_0x56a6b9;_0x2be6fe=_0x305aba[_0xeda8('0x12')]||0x1388;}})[_0xeda8('0x13')](function(){return dbH[_0xeda8('0x14')][_0xeda8('0x15')](util[_0xeda8('0xe')](_0xeda8('0x16'),QUERY),{'type':dbH['sequelize'][_0xeda8('0x17')][_0xeda8('0x18')]});})[_0xeda8('0x13')](function(_0x379bbb){if(!_0x379bbb[0x0][_0xeda8('0x19')]){return analyticExtractedReport(_0xeda8('0x1a'));}var _0x18fd15=[];var _0x1f00ea=0x0;var _0x3ab293=!![];if(_0x305aba[_0xeda8('0x11')]){if(_0x379bbb&&_0x379bbb[_0xeda8('0x1b')]){var _0x1538f7=_0x379bbb[0x0][_0xeda8('0x19')]%(_0x1f00ea+_0x2be6fe);for(;_0x3ab293;_0x1f00ea+=_0x2be6fe,_0x1538f7=_0x379bbb[0x0]['num']%(_0x1f00ea+_0x2be6fe)){if(_0x1538f7==0x0||_0x1538f7==_0x379bbb[0x0][_0xeda8('0x19')]){_0x3ab293=![];}_0x18fd15['push'](dbH[_0xeda8('0x14')][_0xeda8('0x15')](util[_0xeda8('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2be6fe,_0x1f00ea),{'type':dbH['sequelize'][_0xeda8('0x17')][_0xeda8('0x18')]}));}}}else{_0x18fd15[_0xeda8('0x1c')](dbH[_0xeda8('0x14')][_0xeda8('0x15')](QUERY,{'type':dbH[_0xeda8('0x14')][_0xeda8('0x17')][_0xeda8('0x18')]}));}var _0x12dd37=path[_0xeda8('0x1d')](PATH);var _0x599401=path[_0xeda8('0x1e')](PATH,'.xlsx');var _0x2de79b=_0x305aba[_0xeda8('0x11')]&&_0x18fd15[_0xeda8('0x1b')]>0x1;var _0xc5607c=[];if(!fs[_0xeda8('0x1f')](path[_0xeda8('0x20')](_0x12dd37,_0x599401))&&_0x2de79b){fs[_0xeda8('0x21')](path['join'](_0x12dd37,_0x599401));}return BPromise['each'](_0x18fd15,function(_0x1b7d9a){_0xc5607c[_0xeda8('0x1c')](_0x1b7d9a);})['then'](function(){for(var _0x393f61=0x0;_0x393f61<_0xc5607c[_0xeda8('0x1b')];_0x393f61+=0x1){var _0x648a82;var _0x360638=_0xc5607c[_0x393f61];if(_0x2de79b){_0x648a82=path['join'](_0x12dd37,_0x599401,util[_0xeda8('0xe')](_0xeda8('0x22'),_0x599401,_0x393f61,'xlsx'));}else{_0x648a82=path[_0xeda8('0x20')](_0x12dd37,util['format']('%s.%s',_0x599401,_0xeda8('0x23')));}fs[_0xeda8('0x24')](_0x648a82,json2xls(_0x360638),_0xeda8('0x25'));}})[_0xeda8('0x13')](function(){if(_0x2de79b){zipdir(path[_0xeda8('0x20')](_0x12dd37,_0x599401),{'saveTo':path[_0xeda8('0x20')](_0x12dd37,util[_0xeda8('0xe')](_0xeda8('0x26'),_0x599401,_0xeda8('0x27')))},function(_0x46748,_0x3e21e4){});rimraf(path[_0xeda8('0x20')](_0x12dd37,_0x599401),function(){});}})[_0xeda8('0x13')](function(){logger[_0xeda8('0xd')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xeda8('0xf')));return analyticExtractedReport('Completed',_0x2de79b?util[_0xeda8('0xe')]('%s.%s',_0x599401,_0x2de79b?'zip':'xlsx'):null);});})[_0xeda8('0x28')](function(_0x166d91){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xeda8('0xf')),util[_0xeda8('0x29')](_0x166d91,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9cd3=['argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','.xlsx','existsSync','join','each','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger'];(function(_0x381cb2,_0x5f41b4){var _0x39e2ab=function(_0x52aa1a){while(--_0x52aa1a){_0x381cb2['push'](_0x381cb2['shift']());}};_0x39e2ab(++_0x5f41b4);}(_0x9cd3,0x178));var _0x39cd=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0x9cd3[_0x18b191];return _0x43e146;};'use strict';var util=require(_0x39cd('0x0'));var path=require('path');var _=require(_0x39cd('0x1'));var fs=require('fs');var json2xls=require(_0x39cd('0x2'));var BPromise=require(_0x39cd('0x3'));var zipdir=require(_0x39cd('0x4'));var rimraf=require(_0x39cd('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x39cd('0x6'))['dbH'];var logger=require(_0x39cd('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x39cd('0x8')][0x2]);var QUERY=process[_0x39cd('0x8')][0x3];var PATH=process[_0x39cd('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e2e08,_0x4c1308){var _0x2546ae={'status':_0x2e2e08};var _0x577036={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4c1308){_0x2546ae[_0x39cd('0x9')]=_0x4c1308;}return db[_0x39cd('0xa')][_0x39cd('0xb')](_0x2546ae,_0x577036);}function main(){var _0x6de0bb=0x1388;var _0x51536e;logger[_0x39cd('0xc')](util[_0x39cd('0xd')](_0x39cd('0xe'),EXTRACTED_REPORT_ID,_0x39cd('0xf')));return db['Setting'][_0x39cd('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x39cd('0x11'),_0x39cd('0x12')]})['then'](function(_0x5d042a){if(_0x5d042a){_0x51536e=_0x5d042a;_0x6de0bb=_0x51536e[_0x39cd('0x12')]||0x1388;}})[_0x39cd('0x13')](function(){return dbH[_0x39cd('0x14')]['query'](util['format'](_0x39cd('0x15'),QUERY),{'type':dbH[_0x39cd('0x14')][_0x39cd('0x16')]['SELECT']});})[_0x39cd('0x13')](function(_0x3a042b){if(!_0x3a042b[0x0][_0x39cd('0x17')]){return analyticExtractedReport(_0x39cd('0x18'));}var _0x1ce9fe=[];var _0x58652f=0x0;var _0x18b095=!![];if(_0x51536e[_0x39cd('0x11')]){if(_0x3a042b&&_0x3a042b[_0x39cd('0x19')]){var _0x25324f=_0x3a042b[0x0][_0x39cd('0x17')]%(_0x58652f+_0x6de0bb);for(;_0x18b095;_0x58652f+=_0x6de0bb,_0x25324f=_0x3a042b[0x0]['num']%(_0x58652f+_0x6de0bb)){if(_0x25324f==0x0||_0x25324f==_0x3a042b[0x0][_0x39cd('0x17')]){_0x18b095=![];}_0x1ce9fe['push'](dbH[_0x39cd('0x14')][_0x39cd('0x1a')](util[_0x39cd('0xd')](_0x39cd('0x1b'),QUERY,_0x6de0bb,_0x58652f),{'type':dbH[_0x39cd('0x14')][_0x39cd('0x16')][_0x39cd('0x1c')]}));}}}else{_0x1ce9fe[_0x39cd('0x1d')](dbH['sequelize'][_0x39cd('0x1a')](QUERY,{'type':dbH['sequelize'][_0x39cd('0x16')][_0x39cd('0x1c')]}));}var _0x3ba6e4=path[_0x39cd('0x1e')](PATH);var _0x558f43=path[_0x39cd('0x1f')](PATH,_0x39cd('0x20'));var _0x2342d9=_0x51536e['split']&&_0x1ce9fe[_0x39cd('0x19')]>0x1;var _0x29c38b=[];if(!fs[_0x39cd('0x21')](path[_0x39cd('0x22')](_0x3ba6e4,_0x558f43))&&_0x2342d9){fs['mkdirSync'](path[_0x39cd('0x22')](_0x3ba6e4,_0x558f43));}return BPromise[_0x39cd('0x23')](_0x1ce9fe,function(_0x5a30cd){_0x29c38b[_0x39cd('0x1d')](_0x5a30cd);})['then'](function(){for(var _0xb12fb4=0x0;_0xb12fb4<_0x29c38b['length'];_0xb12fb4+=0x1){var _0x235737;var _0x3db735=_0x29c38b[_0xb12fb4];if(_0x2342d9){_0x235737=path[_0x39cd('0x22')](_0x3ba6e4,_0x558f43,util[_0x39cd('0xd')]('%s%d.%s',_0x558f43,_0xb12fb4,_0x39cd('0x24')));}else{_0x235737=path[_0x39cd('0x22')](_0x3ba6e4,util[_0x39cd('0xd')](_0x39cd('0x25'),_0x558f43,_0x39cd('0x24')));}fs[_0x39cd('0x26')](_0x235737,json2xls(_0x3db735),'binary');}})[_0x39cd('0x13')](function(){if(_0x2342d9){zipdir(path[_0x39cd('0x22')](_0x3ba6e4,_0x558f43),{'saveTo':path[_0x39cd('0x22')](_0x3ba6e4,util[_0x39cd('0xd')]('%s.%s',_0x558f43,'zip'))},function(_0x4d66c7,_0x5a3e1d){});rimraf(path[_0x39cd('0x22')](_0x3ba6e4,_0x558f43),function(){});}})[_0x39cd('0x13')](function(){logger[_0x39cd('0xc')](util[_0x39cd('0xd')](_0x39cd('0x27'),EXTRACTED_REPORT_ID,_0x39cd('0xf')));return analyticExtractedReport(_0x39cd('0x28'),_0x2342d9?util[_0x39cd('0xd')]('%s.%s',_0x558f43,_0x2342d9?_0x39cd('0x29'):_0x39cd('0x24')):null);});})[_0x39cd('0x2a')](function(_0x2fbf69){logger['info'](util[_0x39cd('0xd')](_0x39cd('0x2b'),EXTRACTED_REPORT_ID,_0x39cd('0xf')),util[_0x39cd('0x2c')](_0x2fbf69,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x39cd('0x2d'));})[_0x39cd('0x2e')](function(){process[_0x39cd('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 4d592c3..78e7aed 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 _0x2399=['ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','find','type','format','CDR(type)=%s','VoiceExtensionId','inbound','push','Set','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0x2399,0xf6));var _0x9239=function(_0x5c3dbe,_0x42c3a8){_0x5c3dbe=_0x5c3dbe-0x0;var _0x49086d=_0x2399[_0x5c3dbe];return _0x49086d;};'use strict';var _=require(_0x9239('0x0'));var util=require(_0x9239('0x1'));function rewrite(_0x3cfd0c,_0x5c3214){var _0x2520a0=this;return _0x3cfd0c[_0x9239('0x2')][_0x9239('0x3')][_0x9239('0x4')]({'raw':!![]})[_0x9239('0x5')](function(_0x3e93fa){_0x2520a0['intervals']=_0x3e93fa;return _0x3cfd0c['models'][_0x9239('0x6')][_0x9239('0x4')]({'where':{'IntervalId':_0x5c3214[_0x9239('0x7')]},'raw':!![]});})[_0x9239('0x5')](function(_0xe36e1d){return _0x3cfd0c[_0x9239('0x2')][_0x9239('0x6')][_0x9239('0x4')]({'where':{'exten':{'$in':_[_0x9239('0x8')](_[_0x9239('0x9')](_0xe36e1d,_0x9239('0xa')))}},'order':[{'raw':_0x9239('0xb')}],'raw':!![]});})[_0x9239('0x5')](function(_0x1e53c8){var _0x386f1c=_[_0x9239('0xc')](_0x1e53c8,{'priority':'1'});var _0x30ef50=_[_0x9239('0xc')](_0x1e53c8,{'isApp':0x1});var _0x3af860=_[_0x9239('0xd')](_0x30ef50,_0x9239('0xa'));var _0x40288a=[_0x9239('0xe'),_0x9239('0xf')];var _0x2f17f9=[];var _0x549b52=[];for(var _0x213515 in _0x3af860){if(_0x3af860['hasOwnProperty'](_0x213515)){_0x2520a0[_0x9239('0x10')]=0x2;_0x2520a0[_0x9239('0x11')]=[];_0x2520a0['extension']=_[_0x9239('0x12')](_0x386f1c,{'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')]});_0x2520a0[_0x9239('0x11')]['push']({'type':_0x3af860[_0x213515][0x0][_0x9239('0x13')],'app':'Set','appdata':util[_0x9239('0x14')](_0x9239('0x15'),_0x3af860[_0x213515][0x0]['type']),'context':_0x3af860[_0x213515][0x0]['context'],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0['priority']++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});if(_0x3af860[_0x213515][0x0][_0x9239('0x13')]===_0x9239('0x17')){_0x2520a0['extensions'][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0]['type'],'app':_0x9239('0x19'),'appdata':_0x9239('0x1a')+_0x3af860[_0x213515][0x0]['VoiceExtensionId'],'context':_0x3af860[_0x213515][0x0]['context'],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});}else if(_0x3af860[_0x213515][0x0][_0x9239('0x13')]===_0x9239('0x1b')){if(_0x2520a0[_0x9239('0x1c')]){_0x2520a0[_0x9239('0x11')]['push']({'type':_0x3af860[_0x213515][0x0][_0x9239('0x13')],'app':_0x9239('0x19'),'appdata':_0x9239('0x1d')+(_0x2520a0[_0x9239('0x1c')][_0x9239('0x1e')]?_0x9239('0x1f')+_0x2520a0[_0x9239('0x1c')][_0x9239('0x1e')]+'}':_0x9239('0x20')),'context':_0x3af860[_0x213515][0x0][_0x9239('0x21')],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});}_0x2520a0[_0x9239('0x11')][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0][_0x9239('0x13')],'app':_0x9239('0x19'),'appdata':_0x9239('0x1a')+_0x3af860[_0x213515][0x0][_0x9239('0x16')],'context':_0x3af860[_0x213515][0x0]['context'],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});var _0xfcbee6=_0x2520a0['priority']++;_0x2520a0[_0x9239('0x11')][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0]['type'],'app':_0x9239('0x22'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xfcbee6+0x2)+_0x9239('0x23')+(_0xfcbee6+0x1)+')','context':_0x3af860[_0x213515][0x0][_0x9239('0x21')],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0xfcbee6,'VoiceExtensionId':_0x3af860[_0x213515][0x0]['VoiceExtensionId']});if(_0x2520a0[_0x9239('0x1c')]){_0x2520a0[_0x9239('0x11')][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0][_0x9239('0x13')],'app':_0x9239('0x19'),'appdata':_0x2520a0[_0x9239('0x1c')][_0x9239('0x1e')]?_0x9239('0x24')+_0x2520a0[_0x9239('0x1c')]['cutdigits']+'}':_0x9239('0x25'),'context':_0x3af860[_0x213515][0x0]['context'],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});}_0x2520a0['extensions'][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0][_0x9239('0x13')],'app':_0x9239('0x19'),'appdata':'outboundrouteid='+_0x3af860[_0x213515][0x0]['VoiceExtensionId'],'context':_0x3af860[_0x213515][0x0][_0x9239('0x21')],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});if(_0x2520a0[_0x9239('0x1c')]&&_0x2520a0['extension'][_0x9239('0x26')]('recordingFormat')&&_0x2520a0[_0x9239('0x1c')][_0x9239('0x27')]!==_0x9239('0x28')){_0x2520a0[_0x9239('0x11')][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0]['type'],'app':_0x9239('0x19'),'appdata':_0x9239('0x29'),'context':_0x3af860[_0x213515][0x0][_0x9239('0x21')],'exten':_0x3af860[_0x213515][0x0]['exten'],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});_0x2520a0[_0x9239('0x11')][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0]['type'],'app':_0x9239('0x19'),'appdata':_0x9239('0x2a')+_0x2520a0[_0x9239('0x1c')]['recordingFormat']||_0x9239('0x2b'),'context':_0x3af860[_0x213515][0x0]['context'],'exten':_0x3af860[_0x213515][0x0]['exten'],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});}}_0x2520a0[_0x9239('0x11')]['push']({'type':_0x3af860[_0x213515][0x0]['type'],'app':'Set','appdata':_0x9239('0x2c'),'context':_0x3af860[_0x213515][0x0]['context'],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0['priority']++,'VoiceExtensionId':_0x3af860[_0x213515][0x0]['VoiceExtensionId']});_0x2520a0[_0x9239('0x11')][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0][_0x9239('0x13')],'app':_0x9239('0x19'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3af860[_0x213515][0x0][_0x9239('0x21')],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});_0x2520a0[_0x9239('0x11')]['push']({'type':_0x3af860[_0x213515][0x0][_0x9239('0x13')],'app':'Set','appdata':_0x9239('0x2d'),'context':_0x3af860[_0x213515][0x0][_0x9239('0x21')],'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'priority':_0x2520a0[_0x9239('0x10')]++,'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});for(var _0x24e169=0x0,_0x50815d=0x0;_0x24e169<_0x3af860[_0x213515][_0x9239('0x2e')];_0x24e169+=0x1,_0x50815d=0x0){var _0x3f6891=_0x3af860[_0x213515][_0x24e169];if(_0x3f6891['type']){_0x3f6891[_0x9239('0x13')]=_0x3f6891[_0x9239('0x13')][_0x9239('0x2f')]();}var _0xbdef5d=[];var _0x9499f5=[];delete _0x3f6891['id'];delete _0x3f6891[_0x9239('0x30')];delete _0x3f6891[_0x9239('0x31')];var _0x2f4751=_0x3f6891['interval']!==_0x9239('0x32')?[_0x3f6891['interval']]:_0x3f6891[_0x9239('0x7')]?_[_0x9239('0x9')](_['filter'](_0x2520a0['intervals'],{'IntervalId':_0x3f6891['IntervalId']}),'interval'):[];if(_0x3f6891['hasOwnProperty'](_0x9239('0x33'))){if(_0x3f6891[_0x9239('0x33')]&&_0x3f6891[_0x9239('0x33')]!=='--'){_0xbdef5d[_0x9239('0x18')]({'type':_0x3f6891[_0x9239('0x13')],'app':'Set','appdata':_0x9239('0x34')+_0x3f6891[_0x9239('0x33')],'context':_0x3f6891[_0x9239('0x21')],'exten':_0x3f6891[_0x9239('0xa')],'priority':_0x2f4751[_0x9239('0x2e')]+_0x2520a0[_0x9239('0x10')]+_0x50815d++,'VoiceExtensionId':_0x3f6891[_0x9239('0x16')]});}}if(_0x3f6891[_0x9239('0x13')]===_0x9239('0x1b')&&_0x3f6891[_0x9239('0x26')](_0x9239('0x35'))){if(_0x3f6891['callerID']){_0xbdef5d[_0x9239('0x18')]({'type':_0x3f6891['type'],'app':_0x9239('0x22'),'appdata':_0x9239('0x36')+_0x3f6891[_0x9239('0x35')]+')','context':_0x3f6891[_0x9239('0x21')],'exten':_0x3f6891[_0x9239('0xa')],'priority':_0x2f4751['length']+_0x2520a0[_0x9239('0x10')]+_0x50815d++,'VoiceExtensionId':_0x3f6891[_0x9239('0x16')]});}else{_0xbdef5d['push']({'type':_0x3f6891[_0x9239('0x13')],'app':_0x9239('0x22'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3f6891['context'],'exten':_0x3f6891[_0x9239('0xa')],'priority':_0x2f4751[_0x9239('0x2e')]+_0x2520a0['priority']+_0x50815d++,'VoiceExtensionId':_0x3f6891[_0x9239('0x16')]});}}if(_0x3f6891[_0x9239('0x26')]('answer')){if(_0x40288a['indexOf'](_0x3f6891[_0x9239('0x37')][_0x9239('0x2f')]())>=0x0&&_0x3f6891['appType']!=='custom'){if(_0x3f6891['answer']){_0xbdef5d[_0x9239('0x18')]({'type':_0x3f6891[_0x9239('0x13')],'app':_0x9239('0x22'),'appdata':_0x9239('0x38'),'context':_0x3f6891[_0x9239('0x21')],'exten':_0x3f6891['exten'],'priority':_0x2f4751[_0x9239('0x2e')]+_0x2520a0[_0x9239('0x10')]+_0x50815d++,'VoiceExtensionId':_0x3f6891[_0x9239('0x16')]});_0xbdef5d[_0x9239('0x18')]({'type':_0x3f6891['type'],'app':_0x9239('0x19'),'appdata':_0x9239('0x39'),'context':_0x3f6891[_0x9239('0x21')],'exten':_0x3f6891[_0x9239('0xa')],'priority':_0x2f4751[_0x9239('0x2e')]+_0x2520a0['priority']+_0x50815d++,'VoiceExtensionId':_0x3f6891['VoiceExtensionId']});}else{_0xbdef5d[_0x9239('0x18')]({'type':_0x3f6891[_0x9239('0x13')],'app':_0x9239('0x22'),'appdata':_0x9239('0x3a'),'context':_0x3f6891['context'],'exten':_0x3f6891['exten'],'priority':_0x2f4751[_0x9239('0x2e')]+_0x2520a0[_0x9239('0x10')]+_0x50815d++,'VoiceExtensionId':_0x3f6891[_0x9239('0x16')]});_0xbdef5d[_0x9239('0x18')]({'type':_0x3f6891[_0x9239('0x13')],'app':'Set','appdata':_0x9239('0x3b'),'context':_0x3f6891[_0x9239('0x21')],'exten':_0x3f6891['exten'],'priority':_0x2f4751[_0x9239('0x2e')]+_0x2520a0['priority']+_0x50815d++,'VoiceExtensionId':_0x3f6891[_0x9239('0x16')]});}}}for(var _0x177ab2=0x0;_0x177ab2<_0x2f4751['length'];_0x177ab2+=0x1){var _0x404f88=_0x2520a0[_0x9239('0x10')]+_0x2f4751[_0x9239('0x2e')];var _0x47843a=_0x177ab2===_0x2f4751[_0x9239('0x2e')]-0x1?_0x2520a0[_0x9239('0x10')]+_0xbdef5d[_0x9239('0x2e')]+_0x9499f5[_0x9239('0x2e')]+0x2:_0x2520a0[_0x9239('0x10')]+_0x177ab2+0x1;_0xbdef5d[_0x9239('0x3c')](_0x177ab2,0x0,{'type':_0x3f6891[_0x9239('0x13')],'app':_0x9239('0x3d'),'appdata':_0x2f4751[_0x177ab2]+'?'+_0x3f6891[_0x9239('0x21')]+_0x9239('0x3e')+_0x404f88+':'+_0x3f6891['context']+_0x9239('0x3e')+_0x47843a,'exten':_0x3f6891[_0x9239('0xa')],'context':_0x3f6891[_0x9239('0x21')],'priority':_0x2520a0['priority']+_0x177ab2,'VoiceExtensionId':_0x3af860[_0x213515][0x0]['VoiceExtensionId']});}_0x3f6891[_0x9239('0x10')]=_0xbdef5d[_0x9239('0x2e')]?_[_0x9239('0x3f')](_0xbdef5d)[_0x9239('0x10')]+0x1:_0x2520a0[_0x9239('0x10')];_0x2520a0[_0x9239('0x10')]=(_0x9499f5[_0x9239('0x2e')]?_['last'](_0x9499f5)[_0x9239('0x10')]:_0x3f6891[_0x9239('0x10')])+0x1;_0x2520a0[_0x9239('0x11')]=_[_0x9239('0x40')](_0x2520a0[_0x9239('0x11')],_0xbdef5d,[_0x3f6891],_0x9499f5);}_0x2520a0['extensions'][_0x9239('0x18')]({'type':_0x3af860[_0x213515][0x0][_0x9239('0x13')],'app':_0x9239('0x41'),'exten':_0x3af860[_0x213515][0x0][_0x9239('0xa')],'context':_0x3af860[_0x213515][0x0][_0x9239('0x21')],'priority':_0x2520a0[_0x9239('0x10')],'VoiceExtensionId':_0x3af860[_0x213515][0x0][_0x9239('0x16')]});_0x2f17f9[_0x9239('0x18')](_0x3af860[_0x213515][0x0][_0x9239('0x16')]);_0x549b52=_[_0x9239('0x40')](_0x549b52,_0x2520a0[_0x9239('0x11')]);}}return _0x3cfd0c['transaction'](function(_0x3d7d6a){return _0x3cfd0c[_0x9239('0x2')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x2f17f9}},'transaction':_0x3d7d6a})['then'](function(_0x406c30){return _0x3cfd0c[_0x9239('0x2')][_0x9239('0x6')][_0x9239('0x42')](_[_0x9239('0x43')](_0x549b52,'priority'),{'transaction':_0x3d7d6a});});});})['catch'](function(_0xc89e33){console[_0x9239('0x44')](_0xc89e33);});}exports[_0x9239('0x45')]=rewrite; \ No newline at end of file +var _0x7582=['type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','intervals','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','VoiceExtension','IntervalId','then','uniq','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','extensions','push'];(function(_0x1e3923,_0x477ce9){var _0x36cd0f=function(_0x48e77d){while(--_0x48e77d){_0x1e3923['push'](_0x1e3923['shift']());}};_0x36cd0f(++_0x477ce9);}(_0x7582,0x7c));var _0x2758=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0x7582[_0x4ffa64];return _0x5da001;};'use strict';var _=require(_0x2758('0x0'));var util=require('util');function rewrite(_0x3ec018,_0x7fbc72){var _0x1aad60=this;return _0x3ec018[_0x2758('0x1')][_0x2758('0x2')][_0x2758('0x3')]({'raw':!![]})['then'](function(_0x3baa49){_0x1aad60['intervals']=_0x3baa49;return _0x3ec018[_0x2758('0x1')][_0x2758('0x4')]['findAll']({'where':{'IntervalId':_0x7fbc72[_0x2758('0x5')]},'raw':!![]});})[_0x2758('0x6')](function(_0xd658e3){return _0x3ec018[_0x2758('0x1')][_0x2758('0x4')]['findAll']({'where':{'exten':{'$in':_[_0x2758('0x7')](_['map'](_0xd658e3,_0x2758('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x2758('0x6')](function(_0xd14258){var _0x587740=_['filter'](_0xd14258,{'priority':'1'});var _0x239e60=_[_0x2758('0x9')](_0xd14258,{'isApp':0x1});var _0x22b431=_[_0x2758('0xa')](_0x239e60,_0x2758('0x8'));var _0x3217d8=[_0x2758('0xb'),_0x2758('0xc')];var _0x20792e=[];var _0x414eb9=[];for(var _0x9c2341 in _0x22b431){if(_0x22b431[_0x2758('0xd')](_0x9c2341)){_0x1aad60[_0x2758('0xe')]=0x2;_0x1aad60['extensions']=[];_0x1aad60[_0x2758('0xf')]=_['find'](_0x587740,{'exten':_0x22b431[_0x9c2341][0x0][_0x2758('0x8')]});_0x1aad60[_0x2758('0x10')][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':util[_0x2758('0x14')](_0x2758('0x15'),_0x22b431[_0x9c2341][0x0][_0x2758('0x12')]),'context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0][_0x2758('0x8')],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});if(_0x22b431[_0x9c2341][0x0][_0x2758('0x12')]===_0x2758('0x18')){_0x1aad60['extensions'][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':_0x2758('0x19')+_0x22b431[_0x9c2341][0x0]['VoiceExtensionId'],'context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0][_0x2758('0x8')],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});}else if(_0x22b431[_0x9c2341][0x0][_0x2758('0x12')]===_0x2758('0x1a')){if(_0x1aad60[_0x2758('0xf')]){_0x1aad60['extensions'][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':_0x2758('0x1b')+(_0x1aad60[_0x2758('0xf')][_0x2758('0x1c')]?'${EXTEN:'+_0x1aad60[_0x2758('0xf')]['cutdigits']+'}':_0x2758('0x1d')),'context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0]['exten'],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});}_0x1aad60['extensions'][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':_0x2758('0x19')+_0x22b431[_0x9c2341][0x0][_0x2758('0x17')],'context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0][_0x2758('0x8')],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});var _0x83a033=_0x1aad60[_0x2758('0xe')]++;_0x1aad60[_0x2758('0x10')][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':'ExecIf','appdata':_0x2758('0x1e')+(_0x83a033+0x2)+_0x2758('0x1f')+(_0x83a033+0x1)+')','context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0][_0x2758('0x8')],'priority':_0x83a033,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});if(_0x1aad60[_0x2758('0xf')]){_0x1aad60['extensions']['push']({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':_0x1aad60[_0x2758('0xf')][_0x2758('0x1c')]?_0x2758('0x20')+_0x1aad60[_0x2758('0xf')][_0x2758('0x1c')]+'}':_0x2758('0x21'),'context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0]['exten'],'priority':_0x1aad60['priority']++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});}_0x1aad60[_0x2758('0x10')][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':'Set','appdata':_0x2758('0x22')+_0x22b431[_0x9c2341][0x0]['VoiceExtensionId'],'context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0]['exten'],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0]['VoiceExtensionId']});if(_0x1aad60['extension']&&_0x1aad60[_0x2758('0xf')][_0x2758('0xd')](_0x2758('0x23'))&&_0x1aad60[_0x2758('0xf')][_0x2758('0x23')]!==_0x2758('0x24')){_0x1aad60[_0x2758('0x10')][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':'Set','appdata':_0x2758('0x25'),'context':_0x22b431[_0x9c2341][0x0]['context'],'exten':_0x22b431[_0x9c2341][0x0]['exten'],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0]['VoiceExtensionId']});_0x1aad60[_0x2758('0x10')][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':_0x2758('0x26')+_0x1aad60[_0x2758('0xf')][_0x2758('0x23')]||'wav','context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0][_0x2758('0x8')],'priority':_0x1aad60['priority']++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});}}_0x1aad60[_0x2758('0x10')][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0][_0x2758('0x8')],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});_0x1aad60[_0x2758('0x10')][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0]['exten'],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});_0x1aad60['extensions']['push']({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':_0x2758('0x27'),'context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'exten':_0x22b431[_0x9c2341][0x0]['exten'],'priority':_0x1aad60[_0x2758('0xe')]++,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});for(var _0x4a972e=0x0,_0x430bc4=0x0;_0x4a972e<_0x22b431[_0x9c2341][_0x2758('0x28')];_0x4a972e+=0x1,_0x430bc4=0x0){var _0x52d277=_0x22b431[_0x9c2341][_0x4a972e];if(_0x52d277[_0x2758('0x12')]){_0x52d277['type']=_0x52d277['type'][_0x2758('0x29')]();}var _0x255737=[];var _0x2318c9=[];delete _0x52d277['id'];delete _0x52d277[_0x2758('0x2a')];delete _0x52d277[_0x2758('0x2b')];var _0x545db1=_0x52d277[_0x2758('0x2c')]!==_0x2758('0x2d')?[_0x52d277['interval']]:_0x52d277[_0x2758('0x5')]?_[_0x2758('0x2e')](_[_0x2758('0x9')](_0x1aad60[_0x2758('0x2f')],{'IntervalId':_0x52d277[_0x2758('0x5')]}),_0x2758('0x2c')):[];if(_0x52d277[_0x2758('0xd')]('tag')){if(_0x52d277[_0x2758('0x30')]&&_0x52d277['tag']!=='--'){_0x255737[_0x2758('0x11')]({'type':_0x52d277['type'],'app':_0x2758('0x13'),'appdata':_0x2758('0x31')+_0x52d277['tag'],'context':_0x52d277[_0x2758('0x16')],'exten':_0x52d277[_0x2758('0x8')],'priority':_0x545db1['length']+_0x1aad60[_0x2758('0xe')]+_0x430bc4++,'VoiceExtensionId':_0x52d277[_0x2758('0x17')]});}}if(_0x52d277[_0x2758('0x12')]==='outbound'&&_0x52d277[_0x2758('0xd')](_0x2758('0x32'))){if(_0x52d277[_0x2758('0x32')]){_0x255737['push']({'type':_0x52d277[_0x2758('0x12')],'app':_0x2758('0x33'),'appdata':_0x2758('0x34')+_0x52d277[_0x2758('0x32')]+')','context':_0x52d277['context'],'exten':_0x52d277[_0x2758('0x8')],'priority':_0x545db1[_0x2758('0x28')]+_0x1aad60[_0x2758('0xe')]+_0x430bc4++,'VoiceExtensionId':_0x52d277[_0x2758('0x17')]});}else{_0x255737[_0x2758('0x11')]({'type':_0x52d277[_0x2758('0x12')],'app':'ExecIf','appdata':_0x2758('0x35'),'context':_0x52d277['context'],'exten':_0x52d277[_0x2758('0x8')],'priority':_0x545db1['length']+_0x1aad60[_0x2758('0xe')]+_0x430bc4++,'VoiceExtensionId':_0x52d277['VoiceExtensionId']});}}if(_0x52d277[_0x2758('0xd')](_0x2758('0x36'))){if(_0x3217d8[_0x2758('0x37')](_0x52d277['app'][_0x2758('0x29')]())>=0x0&&_0x52d277['appType']!==_0x2758('0x38')){if(_0x52d277[_0x2758('0x36')]){_0x255737[_0x2758('0x11')]({'type':_0x52d277[_0x2758('0x12')],'app':_0x2758('0x33'),'appdata':_0x2758('0x39'),'context':_0x52d277[_0x2758('0x16')],'exten':_0x52d277[_0x2758('0x8')],'priority':_0x545db1[_0x2758('0x28')]+_0x1aad60['priority']+_0x430bc4++,'VoiceExtensionId':_0x52d277[_0x2758('0x17')]});_0x255737[_0x2758('0x11')]({'type':_0x52d277[_0x2758('0x12')],'app':'Set','appdata':_0x2758('0x3a'),'context':_0x52d277[_0x2758('0x16')],'exten':_0x52d277[_0x2758('0x8')],'priority':_0x545db1[_0x2758('0x28')]+_0x1aad60[_0x2758('0xe')]+_0x430bc4++,'VoiceExtensionId':_0x52d277['VoiceExtensionId']});}else{_0x255737['push']({'type':_0x52d277['type'],'app':_0x2758('0x33'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x52d277[_0x2758('0x16')],'exten':_0x52d277[_0x2758('0x8')],'priority':_0x545db1[_0x2758('0x28')]+_0x1aad60[_0x2758('0xe')]+_0x430bc4++,'VoiceExtensionId':_0x52d277[_0x2758('0x17')]});_0x255737[_0x2758('0x11')]({'type':_0x52d277[_0x2758('0x12')],'app':_0x2758('0x13'),'appdata':_0x2758('0x3b'),'context':_0x52d277[_0x2758('0x16')],'exten':_0x52d277['exten'],'priority':_0x545db1[_0x2758('0x28')]+_0x1aad60[_0x2758('0xe')]+_0x430bc4++,'VoiceExtensionId':_0x52d277[_0x2758('0x17')]});}}}for(var _0x2aef42=0x0;_0x2aef42<_0x545db1[_0x2758('0x28')];_0x2aef42+=0x1){var _0x3ff638=_0x1aad60[_0x2758('0xe')]+_0x545db1[_0x2758('0x28')];var _0xcba1f5=_0x2aef42===_0x545db1[_0x2758('0x28')]-0x1?_0x1aad60[_0x2758('0xe')]+_0x255737[_0x2758('0x28')]+_0x2318c9['length']+0x2:_0x1aad60[_0x2758('0xe')]+_0x2aef42+0x1;_0x255737['splice'](_0x2aef42,0x0,{'type':_0x52d277[_0x2758('0x12')],'app':_0x2758('0x3c'),'appdata':_0x545db1[_0x2aef42]+'?'+_0x52d277[_0x2758('0x16')]+_0x2758('0x3d')+_0x3ff638+':'+_0x52d277[_0x2758('0x16')]+',${EXTEN},'+_0xcba1f5,'exten':_0x52d277[_0x2758('0x8')],'context':_0x52d277[_0x2758('0x16')],'priority':_0x1aad60[_0x2758('0xe')]+_0x2aef42,'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});}_0x52d277['priority']=_0x255737[_0x2758('0x28')]?_[_0x2758('0x3e')](_0x255737)[_0x2758('0xe')]+0x1:_0x1aad60[_0x2758('0xe')];_0x1aad60[_0x2758('0xe')]=(_0x2318c9[_0x2758('0x28')]?_[_0x2758('0x3e')](_0x2318c9)[_0x2758('0xe')]:_0x52d277[_0x2758('0xe')])+0x1;_0x1aad60[_0x2758('0x10')]=_['concat'](_0x1aad60[_0x2758('0x10')],_0x255737,[_0x52d277],_0x2318c9);}_0x1aad60[_0x2758('0x10')][_0x2758('0x11')]({'type':_0x22b431[_0x9c2341][0x0][_0x2758('0x12')],'app':_0x2758('0x3f'),'exten':_0x22b431[_0x9c2341][0x0][_0x2758('0x8')],'context':_0x22b431[_0x9c2341][0x0][_0x2758('0x16')],'priority':_0x1aad60['priority'],'VoiceExtensionId':_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]});_0x20792e['push'](_0x22b431[_0x9c2341][0x0][_0x2758('0x17')]);_0x414eb9=_['concat'](_0x414eb9,_0x1aad60[_0x2758('0x10')]);}}return _0x3ec018[_0x2758('0x40')](function(_0x256b57){return _0x3ec018[_0x2758('0x1')][_0x2758('0x4')][_0x2758('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x20792e}},'transaction':_0x256b57})[_0x2758('0x6')](function(_0x2ce6ea){return _0x3ec018[_0x2758('0x1')]['VoiceExtension'][_0x2758('0x42')](_[_0x2758('0x43')](_0x414eb9,_0x2758('0xe')),{'transaction':_0x256b57});});});})[_0x2758('0x44')](function(_0x19a516){console[_0x2758('0x45')](_0x19a516);});}exports[_0x2758('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 583361b..de60741 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 _0x96d9=['str','calleridnum','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','CmList','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','toString'];(function(_0x3c56a5,_0x4a176b){var _0x153199=function(_0x21672b){while(--_0x21672b){_0x3c56a5['push'](_0x3c56a5['shift']());}};_0x153199(++_0x4a176b);}(_0x96d9,0xfa));var _0x996d=function(_0x27a477,_0x172fa5){_0x27a477=_0x27a477-0x0;var _0x4340e1=_0x96d9[_0x27a477];return _0x4340e1;};'use strict';var BPromise=require(_0x996d('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x996d('0x1'));var Papa=require(_0x996d('0x2'));var Redis=require('ioredis');var db=require(_0x996d('0x3'))['db'];var config=require(_0x996d('0x4'));var logger=require(_0x996d('0x5'))(_0x996d('0x6'));config[_0x996d('0x7')]=_['defaults'](config[_0x996d('0x7')],{'host':_0x996d('0x8'),'port':0x18eb});var socket=require(_0x996d('0x9'))(new Redis(config[_0x996d('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0x996d('0xa')](socket);try{if(!process['argv'][0x2]||process[_0x996d('0xb')][0x2]==='undefined'||process[_0x996d('0xb')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x996d('0xb')][0x3]===_0x996d('0xc')||process[_0x996d('0xb')][0x3]===_0x996d('0xd')||!process[_0x996d('0xb')][0x4]||process['argv'][0x4]===_0x996d('0xc')||process[_0x996d('0xb')][0x4]===_0x996d('0xd')){throw new Error(_0x996d('0xe'));}var FIELDS=_[_0x996d('0xf')](process['argv'][0x3]['split'](','),process['argv'][0x4][_0x996d('0x10')](','));if(!process[_0x996d('0xb')][0x5]||process[_0x996d('0xb')][0x5]===_0x996d('0xc')||process[_0x996d('0xb')][0x5]===_0x996d('0xd')){throw new Error(_0x996d('0x11'));}var LISTID=process[_0x996d('0xb')][0x5];var COMPANYID=process[_0x996d('0xb')][0x6]&&process[_0x996d('0xb')][0x6]!==_0x996d('0xc')&&process['argv'][0x6]!=='null'?process[_0x996d('0xb')][0x6]:null;var DUPLICATES=process[_0x996d('0xb')][0x7]&&process['argv'][0x7]!==_0x996d('0xc')&&process[_0x996d('0xb')][0x7]!==_0x996d('0xd')?process[_0x996d('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0x996d('0xb')][0x8]===_0x996d('0xc')||process[_0x996d('0xb')][0x8]===_0x996d('0xd')){throw new Error(_0x996d('0x12'));}var SOCKET_TIMESTAMP=process[_0x996d('0xb')][0x8];}catch(_0x453937){logger['error'](_0x453937);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(_0x3d1e9e,_0xaa8bf8,_0x5ddf13,_0x327918){var _0x5e0805={'message':_0xaa8bf8};_0x5e0805[_0x3d1e9e]=!![];if(_0x5ddf13){_0x5e0805[_0x996d('0x13')]=_0x5ddf13;}if(_0x327918){_0x5e0805[_0x996d('0x14')]=_0x327918;}return _0x5e0805;}function isEmail(_0x2293ac){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))*$/[_0x996d('0x15')](_0x2293ac);}function checkRow(_0x57f2ad,_0x21d44e,_0x40ec88){return new BPromise(function(_0x5dd90d,_0x9ae14){if(_['isNil'](_0x57f2ad)){return _0x9ae14(handleCheckRowError(_0x996d('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x40ec88));}if(_0x57f2ad[_0x996d('0x17')]&&_0x57f2ad['errors']['length']){var _0x43021b=_['map'](_0x57f2ad[_0x996d('0x17')],_0x996d('0x18'))[_0x996d('0x19')](';');return _0x9ae14(handleCheckRowError(_0x996d('0x16'),_0x43021b,null,_0x40ec88));}var _0x450288={};for(var _0x229213 in FIELDS){if(FIELDS[_0x996d('0x1a')](_0x229213)&&FIELDS[_0x229213]){_0x450288[_0x229213]=_0x57f2ad['data'][0x0][FIELDS[_0x229213]]||_0x57f2ad[_0x996d('0x1b')][0x0]['\ufeff'+FIELDS[_0x229213]];}}if(!_0x450288[_0x996d('0x1c')]){return _0x9ae14(handleCheckRowError(_0x996d('0x16'),_0x996d('0x1d'),null,_0x40ec88));}if(!_0x450288[_0x996d('0x1e')]){return _0x9ae14(handleCheckRowError(_0x996d('0x16'),_0x996d('0x1f'),null,_0x40ec88));}if(_0x450288['birthDate']){var _0x1e525f=moment(_0x450288['birthDate'],'YYYY-MM-DD');if(!_0x1e525f[_0x996d('0x20')]()){return _0x9ae14(handleCheckRowError(_0x996d('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x40ec88));}}if(_0x450288[_0x996d('0x21')]){if(!isEmail(_0x450288['email'])){return _0x9ae14(handleCheckRowError(_0x996d('0x16'),_0x996d('0x22'),null,_0x40ec88));}}_0x450288['ListId']=LISTID;_0x450288[_0x996d('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x996d('0x24')]&&_0x21d44e){var _0x3f7d89={};for(var _0x4f3bc7=0x0,_0x4d6629=DUPLICATES[_0x996d('0x24')];_0x4f3bc7<_0x4d6629;_0x4f3bc7+=0x1){_0x3f7d89[DUPLICATES[_0x4f3bc7]]=_0x450288[DUPLICATES[_0x4f3bc7]];}var _0x1f9e4e=_[_0x996d('0x25')](_0x21d44e,_0x3f7d89);if(_0x1f9e4e){return _0x9ae14(handleCheckRowError(_0x996d('0x26'),_0x996d('0x27'),_0x1f9e4e,_0x40ec88));}}return db[_0x996d('0x28')][_0x996d('0x29')](_0x450288,{'raw':!![],'hooks':![],'fields':_[_0x996d('0x2a')](_0x450288)})[_0x996d('0x2b')](function(_0x2a0e4b){if(DUPLICATES&&DUPLICATES[_0x996d('0x24')]&&_0x21d44e){_0x21d44e[_0x996d('0x2c')](_[_0x996d('0x2d')](_0x450288,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2a0e4b['id'];return _0x5dd90d();})[_0x996d('0x2e')](function(_0xf3f020){return _0x9ae14(handleCheckRowError('error',_0x996d('0x2f')+(_0xf3f020[_0x996d('0x18')]||JSON['stringify'](_0xf3f020)),null,_0x40ec88));});});}function checkHopper(){function _0x4e8624(){return function(_0x403e34){logger['error'](_0x996d('0x30'),'checkHopper',util[_0x996d('0x31')](_0x403e34,{'showHidden':![],'depth':null}));};}var _0x493d49=function(_0x55b1d5,_0x3c2029){var _0x48e30a=squel[_0x996d('0x32')]()[_0x996d('0x33')](_0x996d('0x34'))[_0x996d('0x35')]([_0x996d('0x1e'),_0x996d('0x36'),_0x996d('0x37'),_0x996d('0x38'),_0x3c2029,_0x996d('0x39'),_0x996d('0x3a')],squel[_0x996d('0x3b')]()[_0x996d('0x3c')](_0x996d('0x1e'),_0x996d('0x1e'))[_0x996d('0x3c')](_0x996d('0x3d'),'scheduledAt')[_0x996d('0x3c')]('id',_0x996d('0x37'))[_0x996d('0x3c')](LISTID['toString'](),'ListId')[_0x996d('0x3c')](_0x55b1d5['id']['toString'](),_0x3c2029)[_0x996d('0x3c')](_0x996d('0x3d'),_0x996d('0x39'))[_0x996d('0x3c')](_0x996d('0x3d'),_0x996d('0x3a'))[_0x996d('0x3e')](_0x996d('0x3f'))['where'](_0x996d('0x40'))[_0x996d('0x41')](_0x996d('0x42'),LISTID['toString']())[_0x996d('0x41')](_0x996d('0x43'))[_0x996d('0x41')](_0x996d('0x44'),squel[_0x996d('0x3b')]()[_0x996d('0x3c')]('phone')[_0x996d('0x3e')](_0x996d('0x34'))['where'](_0x3c2029+_0x996d('0x45'),_0x55b1d5['id'][_0x996d('0x46')]())))[_0x996d('0x46')]();return _0x48e30a;};var _0x524f78=function(_0xf4265,_0x340c1b){var _0x129344=squel[_0x996d('0x32')]()[_0x996d('0x33')]('cm_hopper')[_0x996d('0x35')]([_0x996d('0x1e'),_0x996d('0x36'),_0x996d('0x37'),_0x996d('0x38'),_0x340c1b,_0x996d('0x39'),_0x996d('0x3a')],squel[_0x996d('0x3b')]()[_0x996d('0x3c')]('phone',_0x996d('0x1e'))[_0x996d('0x3c')](_0x996d('0x3d'),_0x996d('0x36'))[_0x996d('0x3c')]('id',_0x996d('0x37'))[_0x996d('0x3c')](LISTID[_0x996d('0x46')](),_0x996d('0x38'))[_0x996d('0x3c')](_0xf4265['id'][_0x996d('0x46')](),_0x340c1b)[_0x996d('0x3c')](_0x996d('0x3d'),_0x996d('0x39'))[_0x996d('0x3c')]('NOW()',_0x996d('0x3a'))[_0x996d('0x3e')](_0x996d('0x3f'))[_0x996d('0x41')](_0x996d('0x40'))['where']('ListId\x20=\x20?',LISTID[_0x996d('0x46')]())[_0x996d('0x41')]('id\x20IN\x20?',squel[_0x996d('0x47')](hopperContacts))[_0x996d('0x41')](_0x996d('0x43'))['where'](_0x996d('0x44'),squel['select']()['field'](_0x996d('0x48'))[_0x996d('0x3e')]('cm_hopper_final')['where'](_0x340c1b+_0x996d('0x45'),_0xf4265['id']['toString']()))[_0x996d('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x996d('0x3b')]()[_0x996d('0x3c')](_0x996d('0x1e'))[_0x996d('0x3e')](_0x996d('0x34'))[_0x996d('0x41')](_0x340c1b+_0x996d('0x45'),_0xf4265['id']['toString']())))[_0x996d('0x46')]();return _0x129344;};function _0x160e5c(_0x12987b,_0x17a7dc){var _0x307e07=squel['insert']()['into'](_0x996d('0x34'))[_0x996d('0x35')]([_0x996d('0x1e'),_0x996d('0x36'),'ContactId',_0x996d('0x38'),_0x17a7dc,'createdAt',_0x996d('0x3a')],squel[_0x996d('0x3b')]()[_0x996d('0x3c')](_0x996d('0x1e'),_0x996d('0x1e'))[_0x996d('0x3c')](_0x996d('0x3d'),_0x996d('0x36'))[_0x996d('0x3c')]('id',_0x996d('0x37'))[_0x996d('0x3c')](LISTID[_0x996d('0x46')](),_0x996d('0x38'))[_0x996d('0x3c')](_0x12987b['id'][_0x996d('0x46')](),_0x17a7dc)[_0x996d('0x3c')]('NOW()','createdAt')[_0x996d('0x3c')](_0x996d('0x3d'),_0x996d('0x3a'))[_0x996d('0x3e')](_0x996d('0x3f'))[_0x996d('0x41')]('deletedAt\x20IS\x20NULL')[_0x996d('0x41')](_0x996d('0x42'),LISTID[_0x996d('0x46')]())[_0x996d('0x41')](_0x996d('0x49'),squel[_0x996d('0x47')](hopperContacts))[_0x996d('0x41')](_0x996d('0x43')))[_0x996d('0x46')]();return _0x307e07;}function _0x26436c(_0x1324a5,_0x3c49fe){var _0x29481a=squel[_0x996d('0x32')]()[_0x996d('0x33')](_0x996d('0x4a'))[_0x996d('0x35')]([_0x996d('0x1e'),_0x996d('0x37'),'ListId',_0x3c49fe,_0x996d('0x39'),_0x996d('0x3a')],squel[_0x996d('0x3b')]()[_0x996d('0x3c')]('phone',_0x996d('0x1e'))[_0x996d('0x3c')]('id',_0x996d('0x37'))['field'](LISTID[_0x996d('0x46')](),_0x996d('0x38'))[_0x996d('0x3c')](_0x1324a5['id'][_0x996d('0x46')](),_0x3c49fe)[_0x996d('0x3c')]('NOW()',_0x996d('0x39'))[_0x996d('0x3c')](_0x996d('0x3d'),_0x996d('0x3a'))[_0x996d('0x3e')](_0x996d('0x3f'))[_0x996d('0x41')]('deletedAt\x20IS\x20NULL')[_0x996d('0x41')]('ListId\x20=\x20?',LISTID[_0x996d('0x46')]())['where'](_0x996d('0x49'),squel['str'](hopperContacts))[_0x996d('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x996d('0x46')]();return _0x29481a;}return db[_0x996d('0x4b')][_0x996d('0x4c')]({'where':{'type':_0x996d('0x4d')},'attributes':['id',_0x996d('0x4e')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x996d('0x2b')](function(_0x4767c1){var _0x214dc6=[];if(_0x4767c1){var _0x1f3073;for(var _0x59e8c3=0x0,_0x5c189d;_0x59e8c3<_0x4767c1[_0x996d('0x24')];_0x59e8c3+=0x1){_0x5c189d=_0x4767c1[_0x59e8c3][_0x996d('0x4f')]({'plain':!![]});switch(_0x5c189d['dialCheckDuplicateType']){case _0x996d('0x50'):_0x214dc6[_0x996d('0x2c')](db[_0x996d('0x51')][_0x996d('0x52')](_0x524f78(_0x5c189d,_0x996d('0x53')))[_0x996d('0x2b')](function(){})[_0x996d('0x2e')](_0x4e8624()));break;case _0x996d('0x54'):_0x214dc6[_0x996d('0x2c')](db[_0x996d('0x51')][_0x996d('0x52')](_0x493d49(_0x5c189d,_0x996d('0x53')))[_0x996d('0x2b')](function(){})['catch'](_0x4e8624()));break;default:_0x214dc6['push'](db[_0x996d('0x51')][_0x996d('0x52')](_0x160e5c(_0x5c189d,_0x996d('0x53')))[_0x996d('0x2b')](function(){})['catch'](_0x4e8624()));}}}return _0x214dc6;})[_0x996d('0x55')]()[_0x996d('0x2b')](function(){return db[_0x996d('0x4b')][_0x996d('0x4c')]({'where':{'type':_0x996d('0x4d')},'attributes':['id'],'include':[{'model':db[_0x996d('0x56')],'as':_0x996d('0x57'),'where':{'id':LISTID}}]})[_0x996d('0x2b')](function(_0x43ea6a){var _0x4d736f=[];if(_0x43ea6a){var _0x2180a7;for(var _0x4c009f=0x0,_0x51d50a;_0x4c009f<_0x43ea6a['length'];_0x4c009f+=0x1){_0x51d50a=_0x43ea6a[_0x4c009f]['get']({'plain':!![]});_0x4d736f[_0x996d('0x2c')](db[_0x996d('0x51')][_0x996d('0x52')](_0x26436c(_0x51d50a,_0x996d('0x53')))['then'](function(){})[_0x996d('0x2e')](_0x4e8624()));}}return _0x4d736f;})['all']();})[_0x996d('0x2b')](function(){return db[_0x996d('0x58')][_0x996d('0x4c')]({'attributes':['id',_0x996d('0x4e')],'include':[{'model':db[_0x996d('0x56')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x1dd944){var _0xa3925e=[];if(_0x1dd944){for(var _0x20ebc1=0x0,_0x3ec0d0;_0x20ebc1<_0x1dd944[_0x996d('0x24')];_0x20ebc1+=0x1){_0x3ec0d0=_0x1dd944[_0x20ebc1][_0x996d('0x4f')]({'plain':!![]});switch(_0x3ec0d0[_0x996d('0x4e')]){case _0x996d('0x50'):_0xa3925e[_0x996d('0x2c')](db[_0x996d('0x51')][_0x996d('0x52')](_0x524f78(_0x3ec0d0,'CampaignId'))[_0x996d('0x2b')](function(){})[_0x996d('0x2e')](_0x4e8624()));break;case _0x996d('0x54'):_0xa3925e['push'](db[_0x996d('0x51')][_0x996d('0x52')](_0x493d49(_0x3ec0d0,_0x996d('0x59')))[_0x996d('0x2b')](function(){})['catch'](_0x4e8624()));break;default:_0xa3925e[_0x996d('0x2c')](db[_0x996d('0x51')][_0x996d('0x52')](_0x160e5c(_0x3ec0d0,'CampaignId'))['then'](function(){})[_0x996d('0x2e')](_0x4e8624()));}}}return _0xa3925e;})['all']();})[_0x996d('0x2b')](function(){return db[_0x996d('0x58')][_0x996d('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x996d('0x56')],'as':_0x996d('0x57'),'where':{'id':LISTID}}]})[_0x996d('0x2b')](function(_0x205a40){var _0x4369fc=[];if(_0x205a40){for(var _0x19cf57=0x0,_0x3d99fa;_0x19cf57<_0x205a40[_0x996d('0x24')];_0x19cf57+=0x1){_0x3d99fa=_0x205a40[_0x19cf57]['get']({'plain':!![]});_0x4369fc[_0x996d('0x2c')](db[_0x996d('0x51')]['query'](_0x26436c(_0x3d99fa,_0x996d('0x59')))['then'](function(){})[_0x996d('0x2e')](_0x4e8624()));}}return _0x4369fc;})['all']();})['catch'](function(_0x122eb8){logger[_0x996d('0x16')](_0x996d('0x5a'),'generalCheckHopper',_0x122eb8[_0x996d('0x18')]);});}var processPromises=function(_0x519360){return BPromise['all'](promises)['then'](function(_0x3a3d48){})[_0x996d('0x2e')](function(_0x23bbc0){logger[_0x996d('0x16')](_0x996d('0x5b'),JSON[_0x996d('0x5c')](_0x23bbc0));})[_0x996d('0x5d')](function(){socket[_0x996d('0x5e')](_0x996d('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x519360){return _0x519360[_0x996d('0x60')]();}});};var endCsv=function(){return BPromise[_0x996d('0x61')]()[_0x996d('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x996d('0x2b')](function(){socket[_0x996d('0x5e')](_0x996d('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x996d('0x62')](FILEPATH);}catch(_0x5380d9){logger[_0x996d('0x16')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x5380d9));}finally{process[_0x996d('0x63')](0x0);}});};process['on'](_0x996d('0x64'),function(){logger[_0x996d('0x65')](_0x996d('0x66'));endCsv();});function main(){return BPromise[_0x996d('0x61')]()[_0x996d('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x996d('0x10')](',');return db[_0x996d('0x28')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x996d('0x2b')](function(_0xce31db){var _0x296427=fs[_0x996d('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x996d('0x68')](_0x296427,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bb670,_0x35491d){total+=0x1;var _0x3f06e1=total;promises[_0x996d('0x2c')](checkRow(_0x1bb670,_0xce31db,_0x3f06e1)[_0x996d('0x2b')](function(){success+=0x1;})['catch'](function(_0x133892){if(_0x133892[_0x996d('0x16')]){errors+=0x1;delete _0x133892[_0x996d('0x16')];}else if(_0x133892[_0x996d('0x26')]){duplicates+=0x1;delete _0x133892[_0x996d('0x26')];}rows[_0x996d('0x2c')](_0x133892);}));if(total%0xc8===0x0){_0x35491d['pause']();return processPromises(_0x35491d);}},'complete':function(){return processPromises()['then'](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3bce9d,_0x190721){logger['info'](_0x996d('0x69'),JSON['stringify'](_0x3bce9d));endCsv();}});})[_0x996d('0x2e')](function(_0x5207fb){logger[_0x996d('0x16')](_0x996d('0x6a'),JSON[_0x996d('0x5c')](_0x5207fb));});}main(); \ No newline at end of file +var _0x8051=['VoiceQueueId','onlyIfOpen','query','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','select','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','cm_hopper_final','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize'];(function(_0x1690f9,_0x2a9858){var _0x460e19=function(_0xe37ed3){while(--_0xe37ed3){_0x1690f9['push'](_0x1690f9['shift']());}};_0x460e19(++_0x2a9858);}(_0x8051,0x86));var _0x1805=function(_0x5ae57a,_0x150c42){_0x5ae57a=_0x5ae57a-0x0;var _0x27885e=_0x8051[_0x5ae57a];return _0x27885e;};'use strict';var BPromise=require(_0x1805('0x0'));var util=require('util');var _=require(_0x1805('0x1'));var fs=require('fs');var squel=require(_0x1805('0x2'));var Papa=require(_0x1805('0x3'));var Redis=require('ioredis');var db=require(_0x1805('0x4'))['db'];var config=require(_0x1805('0x5'));var logger=require('../../../config/logger')('api');config[_0x1805('0x6')]=_['defaults'](config['redis'],{'host':_0x1805('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1805('0x6')]));require(_0x1805('0x8'))['register'](socket);try{if(!process[_0x1805('0x9')][0x2]||process[_0x1805('0x9')][0x2]===_0x1805('0xa')||process[_0x1805('0x9')][0x2]===_0x1805('0xb')){throw new Error(_0x1805('0xc'));}var FILEPATH=process[_0x1805('0x9')][0x2];if(!process[_0x1805('0x9')][0x3]||process[_0x1805('0x9')][0x3]==='undefined'||process[_0x1805('0x9')][0x3]===_0x1805('0xb')||!process[_0x1805('0x9')][0x4]||process[_0x1805('0x9')][0x4]===_0x1805('0xa')||process[_0x1805('0x9')][0x4]===_0x1805('0xb')){throw new Error(_0x1805('0xd'));}var FIELDS=_[_0x1805('0xe')](process[_0x1805('0x9')][0x3][_0x1805('0xf')](','),process[_0x1805('0x9')][0x4]['split'](','));if(!process[_0x1805('0x9')][0x5]||process[_0x1805('0x9')][0x5]===_0x1805('0xa')||process[_0x1805('0x9')][0x5]==='null'){throw new Error(_0x1805('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1805('0x9')][0x6]&&process[_0x1805('0x9')][0x6]!==_0x1805('0xa')&&process['argv'][0x6]!=='null'?process[_0x1805('0x9')][0x6]:null;var DUPLICATES=process[_0x1805('0x9')][0x7]&&process[_0x1805('0x9')][0x7]!==_0x1805('0xa')&&process[_0x1805('0x9')][0x7]!==_0x1805('0xb')?process[_0x1805('0x9')][0x7]:null;if(!process['argv'][0x8]||process[_0x1805('0x9')][0x8]===_0x1805('0xa')||process[_0x1805('0x9')][0x8]===_0x1805('0xb')){throw new Error(_0x1805('0x11'));}var SOCKET_TIMESTAMP=process[_0x1805('0x9')][0x8];}catch(_0xdb8793){logger[_0x1805('0x12')](_0xdb8793);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(_0x556fee,_0x56a9ab,_0x214dc6,_0x43f5c8){var _0x27c53f={'message':_0x56a9ab};_0x27c53f[_0x556fee]=!![];if(_0x214dc6){_0x27c53f[_0x1805('0x13')]=_0x214dc6;}if(_0x43f5c8){_0x27c53f[_0x1805('0x14')]=_0x43f5c8;}return _0x27c53f;}function isEmail(_0x29801e){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))*$/[_0x1805('0x15')](_0x29801e);}function checkRow(_0x1229c2,_0x59eb97,_0x72ba6d){return new BPromise(function(_0x3ce8cc,_0x4db5e7){if(_['isNil'](_0x1229c2)){return _0x4db5e7(handleCheckRowError(_0x1805('0x12'),_0x1805('0x16'),null,_0x72ba6d));}if(_0x1229c2[_0x1805('0x17')]&&_0x1229c2[_0x1805('0x17')]['length']){var _0x2ca096=_[_0x1805('0x18')](_0x1229c2['errors'],_0x1805('0x19'))[_0x1805('0x1a')](';');return _0x4db5e7(handleCheckRowError(_0x1805('0x12'),_0x2ca096,null,_0x72ba6d));}var _0xbb250e={};for(var _0x5cc62 in FIELDS){if(FIELDS['hasOwnProperty'](_0x5cc62)&&FIELDS[_0x5cc62]){_0xbb250e[_0x5cc62]=_0x1229c2[_0x1805('0x1b')][0x0][FIELDS[_0x5cc62]]||_0x1229c2[_0x1805('0x1b')][0x0]['\ufeff'+FIELDS[_0x5cc62]];}}if(!_0xbb250e['firstName']){return _0x4db5e7(handleCheckRowError(_0x1805('0x12'),'firstName\x20not\x20specified!',null,_0x72ba6d));}if(!_0xbb250e[_0x1805('0x1c')]){return _0x4db5e7(handleCheckRowError('error',_0x1805('0x1d'),null,_0x72ba6d));}if(_0xbb250e[_0x1805('0x1e')]){var _0x4ca23e=moment(_0xbb250e[_0x1805('0x1e')],_0x1805('0x1f'));if(!_0x4ca23e[_0x1805('0x20')]()){return _0x4db5e7(handleCheckRowError('error',_0x1805('0x21'),null,_0x72ba6d));}}if(_0xbb250e['email']){if(!isEmail(_0xbb250e[_0x1805('0x22')])){return _0x4db5e7(handleCheckRowError(_0x1805('0x12'),_0x1805('0x23'),null,_0x72ba6d));}}_0xbb250e['ListId']=LISTID;_0xbb250e[_0x1805('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1805('0x25')]&&_0x59eb97){var _0x53f250={};for(var _0x22ccb3=0x0,_0x520c8f=DUPLICATES['length'];_0x22ccb3<_0x520c8f;_0x22ccb3+=0x1){_0x53f250[DUPLICATES[_0x22ccb3]]=_0xbb250e[DUPLICATES[_0x22ccb3]];}var _0x231066=_[_0x1805('0x26')](_0x59eb97,_0x53f250);if(_0x231066){return _0x4db5e7(handleCheckRowError('duplicate',_0x1805('0x27'),_0x231066,_0x72ba6d));}}return db[_0x1805('0x28')]['create'](_0xbb250e,{'raw':!![],'hooks':![],'fields':_[_0x1805('0x29')](_0xbb250e)})[_0x1805('0x2a')](function(_0x584d84){if(DUPLICATES&&DUPLICATES[_0x1805('0x25')]&&_0x59eb97){_0x59eb97[_0x1805('0x2b')](_[_0x1805('0x2c')](_0xbb250e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x584d84['id'];return _0x3ce8cc();})[_0x1805('0x2d')](function(_0xfb28a1){return _0x4db5e7(handleCheckRowError(_0x1805('0x12'),_0x1805('0x2e')+(_0xfb28a1['message']||JSON[_0x1805('0x2f')](_0xfb28a1)),null,_0x72ba6d));});});}function checkHopper(){function _0x375693(){return function(_0x497ad1){logger['error']('cmContact','checkHopper',util[_0x1805('0x30')](_0x497ad1,{'showHidden':![],'depth':null}));};}var _0x2d80f7=function(_0x3f7871,_0x4df4fe){var _0x3e3e98=squel[_0x1805('0x31')]()[_0x1805('0x32')](_0x1805('0x33'))[_0x1805('0x34')]([_0x1805('0x1c'),_0x1805('0x35'),_0x1805('0x36'),_0x1805('0x37'),_0x4df4fe,_0x1805('0x38'),_0x1805('0x39')],squel['select']()[_0x1805('0x3a')]('phone','phone')[_0x1805('0x3a')](_0x1805('0x3b'),_0x1805('0x35'))[_0x1805('0x3a')]('id',_0x1805('0x36'))[_0x1805('0x3a')](LISTID[_0x1805('0x3c')](),_0x1805('0x37'))[_0x1805('0x3a')](_0x3f7871['id'][_0x1805('0x3c')](),_0x4df4fe)[_0x1805('0x3a')](_0x1805('0x3b'),_0x1805('0x38'))[_0x1805('0x3a')](_0x1805('0x3b'),'updatedAt')[_0x1805('0x3d')]('cm_contacts')[_0x1805('0x3e')](_0x1805('0x3f'))[_0x1805('0x3e')]('ListId\x20=\x20?',LISTID[_0x1805('0x3c')]())[_0x1805('0x3e')](_0x1805('0x40'))['where'](_0x1805('0x41'),squel['select']()[_0x1805('0x3a')](_0x1805('0x1c'))['from'](_0x1805('0x33'))[_0x1805('0x3e')](_0x4df4fe+_0x1805('0x42'),_0x3f7871['id']['toString']())))[_0x1805('0x3c')]();return _0x3e3e98;};var _0x1316b7=function(_0x154536,_0x1aa88c){var _0x3e47d3=squel[_0x1805('0x31')]()[_0x1805('0x32')]('cm_hopper')[_0x1805('0x34')]([_0x1805('0x1c'),_0x1805('0x35'),_0x1805('0x36'),_0x1805('0x37'),_0x1aa88c,_0x1805('0x38'),_0x1805('0x39')],squel[_0x1805('0x43')]()[_0x1805('0x3a')]('phone',_0x1805('0x1c'))[_0x1805('0x3a')](_0x1805('0x3b'),_0x1805('0x35'))[_0x1805('0x3a')]('id','ContactId')[_0x1805('0x3a')](LISTID[_0x1805('0x3c')](),_0x1805('0x37'))[_0x1805('0x3a')](_0x154536['id'][_0x1805('0x3c')](),_0x1aa88c)[_0x1805('0x3a')](_0x1805('0x3b'),_0x1805('0x38'))[_0x1805('0x3a')](_0x1805('0x3b'),_0x1805('0x39'))[_0x1805('0x3d')](_0x1805('0x44'))['where'](_0x1805('0x3f'))[_0x1805('0x3e')](_0x1805('0x45'),LISTID['toString']())[_0x1805('0x3e')](_0x1805('0x46'),squel['str'](hopperContacts))[_0x1805('0x3e')](_0x1805('0x40'))['where'](_0x1805('0x41'),squel[_0x1805('0x43')]()[_0x1805('0x3a')]('calleridnum')[_0x1805('0x3d')](_0x1805('0x47'))['where'](_0x1aa88c+_0x1805('0x42'),_0x154536['id']['toString']()))[_0x1805('0x3e')](_0x1805('0x41'),squel[_0x1805('0x43')]()['field'](_0x1805('0x1c'))['from'](_0x1805('0x33'))[_0x1805('0x3e')](_0x1aa88c+_0x1805('0x42'),_0x154536['id'][_0x1805('0x3c')]())))['toString']();return _0x3e47d3;};function _0x66b638(_0x541f7b,_0x241b6a){var _0x1f0130=squel[_0x1805('0x31')]()[_0x1805('0x32')](_0x1805('0x33'))['fromQuery']([_0x1805('0x1c'),_0x1805('0x35'),_0x1805('0x36'),_0x1805('0x37'),_0x241b6a,'createdAt',_0x1805('0x39')],squel[_0x1805('0x43')]()['field'](_0x1805('0x1c'),_0x1805('0x1c'))[_0x1805('0x3a')](_0x1805('0x3b'),_0x1805('0x35'))[_0x1805('0x3a')]('id',_0x1805('0x36'))['field'](LISTID[_0x1805('0x3c')](),_0x1805('0x37'))[_0x1805('0x3a')](_0x541f7b['id'][_0x1805('0x3c')](),_0x241b6a)[_0x1805('0x3a')](_0x1805('0x3b'),_0x1805('0x38'))['field'](_0x1805('0x3b'),_0x1805('0x39'))['from'](_0x1805('0x44'))['where'](_0x1805('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0x1805('0x3c')]())[_0x1805('0x3e')](_0x1805('0x46'),squel[_0x1805('0x48')](hopperContacts))[_0x1805('0x3e')](_0x1805('0x40')))[_0x1805('0x3c')]();return _0x1f0130;}function _0x395f61(_0x1f3f15,_0x231586){var _0x585e7c=squel[_0x1805('0x31')]()[_0x1805('0x32')]('cm_hopper_black')[_0x1805('0x34')]([_0x1805('0x1c'),'ContactId',_0x1805('0x37'),_0x231586,_0x1805('0x38'),_0x1805('0x39')],squel[_0x1805('0x43')]()[_0x1805('0x3a')]('phone',_0x1805('0x1c'))[_0x1805('0x3a')]('id',_0x1805('0x36'))[_0x1805('0x3a')](LISTID['toString'](),_0x1805('0x37'))['field'](_0x1f3f15['id'][_0x1805('0x3c')](),_0x231586)[_0x1805('0x3a')]('NOW()',_0x1805('0x38'))['field'](_0x1805('0x3b'),_0x1805('0x39'))[_0x1805('0x3d')](_0x1805('0x44'))['where']('deletedAt\x20IS\x20NULL')[_0x1805('0x3e')]('ListId\x20=\x20?',LISTID[_0x1805('0x3c')]())[_0x1805('0x3e')](_0x1805('0x46'),squel[_0x1805('0x48')](hopperContacts))[_0x1805('0x3e')](_0x1805('0x40')))[_0x1805('0x3c')]();return _0x585e7c;}return db[_0x1805('0x49')][_0x1805('0x4a')]({'where':{'type':_0x1805('0x4b')},'attributes':['id',_0x1805('0x4c')],'include':[{'model':db[_0x1805('0x4d')],'as':_0x1805('0x4e'),'where':{'id':LISTID}}]})[_0x1805('0x2a')](function(_0xa2a517){var _0x46a191=[];if(_0xa2a517){var _0x569f79;for(var _0x4f2a90=0x0,_0x4a2a45;_0x4f2a90<_0xa2a517[_0x1805('0x25')];_0x4f2a90+=0x1){_0x4a2a45=_0xa2a517[_0x4f2a90][_0x1805('0x4f')]({'plain':!![]});switch(_0x4a2a45[_0x1805('0x4c')]){case _0x1805('0x50'):_0x46a191[_0x1805('0x2b')](db[_0x1805('0x51')]['query'](_0x1316b7(_0x4a2a45,_0x1805('0x52')))[_0x1805('0x2a')](function(){})[_0x1805('0x2d')](_0x375693()));break;case _0x1805('0x53'):_0x46a191[_0x1805('0x2b')](db[_0x1805('0x51')][_0x1805('0x54')](_0x2d80f7(_0x4a2a45,_0x1805('0x52')))[_0x1805('0x2a')](function(){})[_0x1805('0x2d')](_0x375693()));break;default:_0x46a191['push'](db[_0x1805('0x51')][_0x1805('0x54')](_0x66b638(_0x4a2a45,_0x1805('0x52')))[_0x1805('0x2a')](function(){})[_0x1805('0x2d')](_0x375693()));}}}return _0x46a191;})[_0x1805('0x55')]()[_0x1805('0x2a')](function(){return db[_0x1805('0x49')][_0x1805('0x4a')]({'where':{'type':_0x1805('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1805('0x4d')],'as':_0x1805('0x56'),'where':{'id':LISTID}}]})[_0x1805('0x2a')](function(_0x359df5){var _0x2433bc=[];if(_0x359df5){var _0x3d64d9;for(var _0x2b38c5=0x0,_0x5f3c0f;_0x2b38c5<_0x359df5[_0x1805('0x25')];_0x2b38c5+=0x1){_0x5f3c0f=_0x359df5[_0x2b38c5][_0x1805('0x4f')]({'plain':!![]});_0x2433bc['push'](db[_0x1805('0x51')][_0x1805('0x54')](_0x395f61(_0x5f3c0f,_0x1805('0x52')))[_0x1805('0x2a')](function(){})[_0x1805('0x2d')](_0x375693()));}}return _0x2433bc;})['all']();})[_0x1805('0x2a')](function(){return db[_0x1805('0x57')][_0x1805('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x1805('0x4e'),'where':{'id':LISTID}}]})[_0x1805('0x2a')](function(_0x54e3f5){var _0x40b479=[];if(_0x54e3f5){for(var _0x3e2814=0x0,_0x4690c0;_0x3e2814<_0x54e3f5[_0x1805('0x25')];_0x3e2814+=0x1){_0x4690c0=_0x54e3f5[_0x3e2814][_0x1805('0x4f')]({'plain':!![]});switch(_0x4690c0[_0x1805('0x4c')]){case _0x1805('0x50'):_0x40b479[_0x1805('0x2b')](db[_0x1805('0x51')][_0x1805('0x54')](_0x1316b7(_0x4690c0,'CampaignId'))[_0x1805('0x2a')](function(){})[_0x1805('0x2d')](_0x375693()));break;case _0x1805('0x53'):_0x40b479[_0x1805('0x2b')](db['sequelize'][_0x1805('0x54')](_0x2d80f7(_0x4690c0,'CampaignId'))[_0x1805('0x2a')](function(){})[_0x1805('0x2d')](_0x375693()));break;default:_0x40b479[_0x1805('0x2b')](db['sequelize'][_0x1805('0x54')](_0x66b638(_0x4690c0,_0x1805('0x58')))['then'](function(){})['catch'](_0x375693()));}}}return _0x40b479;})[_0x1805('0x55')]();})[_0x1805('0x2a')](function(){return db[_0x1805('0x57')][_0x1805('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1805('0x4d')],'as':_0x1805('0x56'),'where':{'id':LISTID}}]})[_0x1805('0x2a')](function(_0x2a2c28){var _0x3e4c69=[];if(_0x2a2c28){for(var _0x5198d2=0x0,_0x1d956f;_0x5198d2<_0x2a2c28[_0x1805('0x25')];_0x5198d2+=0x1){_0x1d956f=_0x2a2c28[_0x5198d2][_0x1805('0x4f')]({'plain':!![]});_0x3e4c69['push'](db[_0x1805('0x51')][_0x1805('0x54')](_0x395f61(_0x1d956f,_0x1805('0x58')))['then'](function(){})[_0x1805('0x2d')](_0x375693()));}}return _0x3e4c69;})['all']();})[_0x1805('0x2d')](function(_0x400abf){logger['error'](_0x1805('0x59'),_0x1805('0x5a'),_0x400abf['message']);});}var processPromises=function(_0x28738c){return BPromise[_0x1805('0x55')](promises)[_0x1805('0x2a')](function(_0x21f7c0){})['catch'](function(_0x109cca){logger[_0x1805('0x12')](_0x1805('0x5b'),JSON[_0x1805('0x2f')](_0x109cca));})[_0x1805('0x5c')](function(){socket[_0x1805('0x5d')](_0x1805('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x28738c){return _0x28738c[_0x1805('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x1805('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x1805('0x2a')](function(){socket[_0x1805('0x5d')](_0x1805('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1805('0x60')](FILEPATH);}catch(_0x4e2a0a){logger[_0x1805('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1805('0x2f')](_0x4e2a0a));}finally{process[_0x1805('0x61')](0x0);}});};process['on'](_0x1805('0x62'),function(){logger[_0x1805('0x63')](_0x1805('0x64'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1805('0xf')](',');return db[_0x1805('0x28')][_0x1805('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1805('0x2a')](function(_0x2ba505){var _0x25fef5=fs[_0x1805('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1805('0x66')](_0x25fef5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5de900,_0x184f38){total+=0x1;var _0x497141=total;promises[_0x1805('0x2b')](checkRow(_0x5de900,_0x2ba505,_0x497141)['then'](function(){success+=0x1;})['catch'](function(_0x27f85b){if(_0x27f85b[_0x1805('0x12')]){errors+=0x1;delete _0x27f85b[_0x1805('0x12')];}else if(_0x27f85b[_0x1805('0x67')]){duplicates+=0x1;delete _0x27f85b[_0x1805('0x67')];}rows['push'](_0x27f85b);}));if(total%0xc8===0x0){_0x184f38[_0x1805('0x68')]();return processPromises(_0x184f38);}},'complete':function(){return processPromises()[_0x1805('0x2a')](function(){logger[_0x1805('0x63')](_0x1805('0x69'));endCsv();});},'error':function(_0x538cb8,_0x2e99fd){logger[_0x1805('0x63')](_0x1805('0x6a'),JSON[_0x1805('0x2f')](_0x538cb8));endCsv();}});})[_0x1805('0x2d')](function(_0x480769){logger[_0x1805('0x12')](_0x1805('0x6b'),JSON[_0x1805('0x2f')](_0x480769));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0f0224e..b276206 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 _0x760b=['.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_hopper_black','ListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','stringify','start','binding','socket_timestamp','server/files/tmp','.csv','header','parse','createReadStream','data','length','rows','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','then','affectedRows','emit','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','socket.io-emitter','format','test','select','field','from','join','where','\x20=\x20','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20'];(function(_0x24a24f,_0x4da1eb){var _0x25e2e5=function(_0x1c76de){while(--_0x1c76de){_0x24a24f['push'](_0x24a24f['shift']());}};_0x25e2e5(++_0x4da1eb);}(_0x760b,0x1dc));var _0xb760=function(_0x461ef9,_0x3c082a){_0x461ef9=_0x461ef9-0x0;var _0x2b4c4f=_0x760b[_0x461ef9];return _0x2b4c4f;};'use strict';var fs=require('fs');var path=require(_0xb760('0x0'));var _=require(_0xb760('0x1'));var Papa=require('papaparse');var util=require(_0xb760('0x2'));var BPromise=require(_0xb760('0x3'));var moment=require(_0xb760('0x4'));var squel=require(_0xb760('0x5'));var Redis=require(_0xb760('0x6'));var db=require(_0xb760('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xb760('0x8'))(_0xb760('0x9'));config[_0xb760('0xa')]=_[_0xb760('0xb')](config[_0xb760('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb760('0xc'))(new Redis(config[_0xb760('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xb760('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x41439c){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))*$/[_0xb760('0xe')](_0x41439c);}function selectNotIn(_0x36b66c,_0x518eff,_0x4d577e,_0x3a8c47,_0x3d229a){return squel[_0xb760('0xf')]()[_0xb760('0x10')]('phone')[_0xb760('0x11')](_0x3a8c47)[_0xb760('0x12')](_0x518eff,null,_0x518eff+'.id\x20=\x20'+_0x3a8c47+'.'+_0x4d577e)[_0xb760('0x13')](_0x3a8c47+'.'+_0x4d577e+_0xb760('0x14')+_0x36b66c+'.'+_0x4d577e)[_0xb760('0x13')](_0x518eff+'.dialCheckDuplicateType\x20IN\x20('+_0x3d229a[_0xb760('0x12')]()+')');}function insertCmHopper(_0x1f84d6,_0x149c3d,_0x369d43,_0x4f91f9,_0x2d5fee){var _0x28f59c=[_0xb760('0x15'),'cm_contacts.scheduledat',_0xb760('0x16'),'cm_contacts.ListId',_0x149c3d+'.'+_0x4f91f9,_0xb760('0x17'),_0xb760('0x18'),'cm_contacts.priority',_0xb760('0x19'),'\x22'+_0x2d5fee+'\x22'];return squel[_0xb760('0x1a')]()[_0xb760('0x1b')](_0xb760('0x1c'))[_0xb760('0x1d')]([_0xb760('0x1e'),_0xb760('0x1f'),'ContactId','ListId',_0x4f91f9,_0xb760('0x20'),_0xb760('0x21'),_0xb760('0x22'),_0xb760('0x23'),_0xb760('0x24')],squel['select']()[_0xb760('0x25')](_0x28f59c)[_0xb760('0x11')](_0x149c3d)[_0xb760('0x12')](_0xb760('0x26'),null,_0xb760('0x27')+_0x149c3d+_0xb760('0x28'))['join'](_0x369d43,null,_0x369d43+_0xb760('0x29')+_0x149c3d+'.'+_0x4f91f9)[_0xb760('0x13')](_0x149c3d+_0xb760('0x2a'),_0x1f84d6)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xb760('0x2b'),selectNotIn(_0x149c3d,_0x369d43,_0x4f91f9,_0xb760('0x1c'),[_0xb760('0x2c'),_0xb760('0x2d')]))[_0xb760('0x13')](_0xb760('0x2b'),selectNotIn(_0x149c3d,_0x369d43,_0x4f91f9,_0xb760('0x1c'),['\x22always\x22'])))[_0xb760('0x2e')]();}function insertCmHopperBlack(_0x33b0e5,_0x105e94,_0x566093,_0xa8eda5){var _0x480836=[_0xb760('0x15'),'cm_contacts.id',_0xb760('0x2f'),_0x105e94+'.'+_0xa8eda5,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xb760('0x1a')]()[_0xb760('0x1b')](_0xb760('0x30'))['fromQuery']([_0xb760('0x1e'),'ContactId',_0xb760('0x31'),_0xa8eda5,_0xb760('0x20'),_0xb760('0x21')],squel[_0xb760('0xf')]()['fields'](_0x480836)['from'](_0x105e94)[_0xb760('0x12')]('cm_contacts',null,_0xb760('0x27')+_0x105e94+_0xb760('0x28'))[_0xb760('0x12')](_0x566093,null,_0x566093+_0xb760('0x29')+_0x105e94+'.'+_0xa8eda5)['where'](_0x105e94+_0xb760('0x2a'),_0x33b0e5)['where'](_0xb760('0x32'),NOW)[_0xb760('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb760('0xf')]()[_0xb760('0x10')](_0xb760('0x1e'))[_0xb760('0x11')](_0xb760('0x30'))[_0xb760('0x13')](_0xb760('0x33'),_0x33b0e5)[_0xb760('0x13')](_0xa8eda5+_0xb760('0x34'),_0x105e94+'.'+_0xa8eda5)))[_0xb760('0x2e')]();}function insertCmContact(_0x58a52c,_0x3415f0,_0x2b8493,_0x1fe8a6){var _0x586ac0=_[_0xb760('0x35')](_['keys'](_0x1fe8a6),[_0xb760('0x31'),_0xb760('0x36'),'createdAt',_0xb760('0x21')]);return squel['insert']()[_0xb760('0x1b')](_0xb760('0x26'))[_0xb760('0x1d')](_0x586ac0,squel[_0xb760('0xf')]()[_0xb760('0x25')](_0x586ac0)[_0xb760('0x11')](_0x3415f0)[_0xb760('0x13')]('('+_0x2b8493['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xb760('0xf')]()['fields'](_0x2b8493)[_0xb760('0x11')](_0xb760('0x26'))[_0xb760('0x13')]('ListId\x20=\x20?',_0x58a52c)[_0xb760('0x13')](_0xb760('0x37')))['where'](_0xb760('0x38'),squel['select']()[_0xb760('0x10')]('MIN(id)',_0xb760('0x39'))[_0xb760('0x11')](_0x3415f0)[_0xb760('0x3a')](_0x2b8493[_0xb760('0x12')](','))))[_0xb760('0x2e')]();}function handleStop(){logger[_0xb760('0x3b')](_0xb760('0x3c'));stopped=!![];}function handleUncaughtException(_0x42e215){logger[_0xb760('0x3d')](_0x42e215[_0xb760('0x3e')]);process[_0xb760('0x3f')](0x1);}function handleError(_0x426451,_0xf3dbe5){stats[_0xb760('0x40')][_0xb760('0x41')]({'name':_0xf3dbe5[_0xb760('0x42')],'message':_0xf3dbe5[_0xb760('0x3e')],'row':_0x426451});}function handleQuery(_0x1cb96d){logger[_0xb760('0x3b')](_0x1cb96d);return db[_0xb760('0x43')][_0xb760('0x44')](_0x1cb96d)[_0xb760('0x45')](function(_0x59b88d){results[_0xb760('0x41')](_0x59b88d);})[_0xb760('0x46')](function(_0x1b12ae){logger[_0xb760('0x3d')](_0x1b12ae[_0xb760('0x3e')]);});}function main(_0x5f10f8,_0x5be6c2,_0x129bbb,_0x460dab){logger[_0xb760('0x3b')]('main',_0x5f10f8,JSON[_0xb760('0x47')](_0x5be6c2));process['send'](_0xb760('0x48'));var _0x4c07af=_0x5be6c2[_0xb760('0x49')];var _0x403086=_0x5be6c2[_0xb760('0x4a')];var _0x17c3a1=path['join'](config['root'],_0xb760('0x4b'),_0x403086+_0xb760('0x4c'));var _0x1d1e63=_['keys'](_0x4c07af)[_0xb760('0x12')]();logger[_0xb760('0x3b')](_0xb760('0x4d'),_0x1d1e63);fs['writeFileSync'](_0x17c3a1,_0x1d1e63+'\x0a');Papa[_0xb760('0x4e')](fs[_0xb760('0x4f')](_0x5f10f8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x52ef01,_0x353297){try{for(var _0x4d23d5=0x0,_0x3f325c=[];_0x4d23d5<_0x52ef01[_0xb760('0x50')][_0xb760('0x51')];_0x4d23d5++){stats[_0xb760('0x52')]+=0x1;if(_0x52ef01['errors'][_0x4d23d5]){handleError(_0x52ef01[_0xb760('0x50')][_0x4d23d5],_0x52ef01[_0xb760('0x40')][_0x4d23d5]);}else{var _0x568ae2=[];for(var _0x1c9d84 in _0x4c07af){if(_0x4c07af[_0xb760('0x53')](_0x1c9d84)){if(_0x52ef01[_0xb760('0x50')][_0x4d23d5][_0x4c07af[_0x1c9d84]]){var _0x15fd05=_[_0xb760('0x54')](_0x52ef01['data'][_0x4d23d5][_0x4c07af[_0x1c9d84]]['replace'](/"/g,'\x27'));switch(_0x1c9d84){case _0xb760('0x1f'):var _0x32b3de=moment(_0x15fd05,_0xb760('0x55'),!![]);if(_0x32b3de[_0xb760('0x56')]()){_0x3f325c['push']('\x22'+_0x15fd05+'\x22');}else{_0x568ae2[_0xb760('0x41')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb760('0x22'):var _0x1eaec0=parseInt(_0x15fd05);_0x15fd05=_[_0xb760('0x57')](_0x1eaec0)||_0x1eaec0<0x0||_0x1eaec0>0x4?_0x460dab?0x3:0x2:_0x1eaec0;_0x3f325c[_0xb760('0x41')]('\x22'+_0x15fd05+'\x22');break;case _0xb760('0x23'):var _0x50d4a4=parseInt(_0x15fd05);if(_[_0xb760('0x58')](_0x50d4a4)&&_[_0xb760('0x59')](_0x129bbb,_0x50d4a4)){_0x3f325c[_0xb760('0x41')]('\x22'+_0x50d4a4+'\x22');}else{_0x568ae2[_0xb760('0x41')](_0xb760('0x5a'));}break;case _0xb760('0x5b'):if(isEmail(_0x15fd05)){_0x3f325c[_0xb760('0x41')]('\x22'+_0x15fd05+'\x22');}else{_0x568ae2[_0xb760('0x41')](_0xb760('0x5c'));}break;case _0xb760('0x5d'):var _0xba8797=moment(_0x15fd05,_0xb760('0x5e'),!![]);if(_0xba8797[_0xb760('0x56')]()){_0x3f325c[_0xb760('0x41')]('\x22'+_0x15fd05+'\x22');}else{_0x568ae2[_0xb760('0x41')](_0xb760('0x5f'));}break;default:_0x3f325c[_0xb760('0x41')]('\x22'+_0x15fd05+'\x22');}}else{switch(_0x1c9d84){case'firstName':case _0xb760('0x1e'):_0x568ae2['push'](_0x1c9d84+_0xb760('0x60'));break;default:_0x3f325c[_0xb760('0x41')]('\x22\x22');}}}}if(_0x568ae2[_0xb760('0x51')]){handleError(_0x52ef01[_0xb760('0x50')][_0x4d23d5],{'code':'SystemRow','message':_0x568ae2[_0xb760('0x12')]()});}else{fs[_0xb760('0x61')](_0x17c3a1,_0x3f325c[_0xb760('0x12')]()+'\x0a');}_0x3f325c=[];}if(!(stats[_0xb760('0x52')]%0xc8)){socket['emit'](_0xb760('0x62')+_0x403086,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xb760('0x63'));_0x353297['abort']();}}catch(_0x5f1661){handleError(_0x52ef01[_0xb760('0x50')][_0x4d23d5],{'code':_0xb760('0x64'),'message':_0x5f1661[_0xb760('0x3e')]});logger[_0xb760('0x3d')](_0xb760('0x65'),_0x5f1661[_0xb760('0x3e')]);}},'complete':function(){try{var _0x2b24fc=[];var _0xedf5a2=_0xb760('0x26');if(_0x5be6c2[_0xb760('0x66')]&&_0x5be6c2['duplicates']['length']){_0xedf5a2=_0xb760('0x67')+_0x403086;_0x2b24fc[_0xb760('0x41')]('CREATE\x20TABLE\x20'+_0xedf5a2+_0xb760('0x68'));}var _0x45f8e3=util[_0xb760('0xd')](_0xb760('0x69'),_0x17c3a1,_0xedf5a2,_0x1d1e63,_0x5be6c2[_0xb760('0x31')],_0x5be6c2[_0xb760('0x36')]||null,NOW,NOW);if(_[_0xb760('0x6a')](_0x4c07af[_0xb760('0x1f')])){_0x45f8e3+=',\x20scheduledAt\x20=\x20NOW()';}_0x2b24fc[_0xb760('0x41')](_0x45f8e3);if(_0x5be6c2['duplicates']&&_0x5be6c2[_0xb760('0x66')][_0xb760('0x51')]){_0x2b24fc[_0xb760('0x41')](insertCmContact(_0x5be6c2[_0xb760('0x31')],_0xedf5a2,_0x5be6c2[_0xb760('0x66')],_0x4c07af));_0x2b24fc[_0xb760('0x41')]('DROP\x20TABLE\x20'+_0xedf5a2+';');}_0x2b24fc[_0xb760('0x41')](insertCmHopper(_0x5be6c2[_0xb760('0x31')],_0xb760('0x6b'),_0xb760('0x6c'),_0xb760('0x6d'),_0x460dab));_0x2b24fc['push'](insertCmHopperBlack(_0x5be6c2['ListId'],_0xb760('0x6e'),_0xb760('0x6c'),_0xb760('0x6d')));_0x2b24fc[_0xb760('0x41')](insertCmHopper(_0x5be6c2[_0xb760('0x31')],_0xb760('0x6f'),_0xb760('0x70'),'CampaignId',_0x460dab));_0x2b24fc[_0xb760('0x41')](insertCmHopperBlack(_0x5be6c2[_0xb760('0x31')],'campaigns_has_cm_blacklists',_0xb760('0x70'),_0xb760('0x71')));BPromise['each'](_0x2b24fc,handleQuery)[_0xb760('0x72')](function(_0xfef049){stats['finish']=!![];stats['affectedRows']=_0x5be6c2[_0xb760('0x66')]&&_0x5be6c2[_0xb760('0x66')][_0xb760('0x51')]?results[0x2][_0xb760('0x73')]:results[0x0][_0xb760('0x73')];socket[_0xb760('0x74')](_0xb760('0x62')+_0x403086,stats);fs['unlink'](_0x5f10f8);fs['unlink'](_0x17c3a1);process['exit'](0x0);})[_0xb760('0x46')](function(_0x4dd8a0){logger[_0xb760('0x3d')](_0x4dd8a0[_0xb760('0x3e')]);process[_0xb760('0x3f')](0x1);});}catch(_0x1abcad){logger['error'](_0xb760('0x75'),_0x1abcad[_0xb760('0x3e')]);process[_0xb760('0x3f')](0x1);}},'error':function(_0x291e03,_0x61d55f,_0x7c1fe0,_0x178204){throw new Error(_0x178204);}});}function validate(){if(process[_0xb760('0x76')]&&process['argv'][_0xb760('0x51')]<0x4){throw new Error(_0xb760('0x77'));}var _0xb5df1a=path['join'](config[_0xb760('0x78')],_0xb760('0x4b'),process[_0xb760('0x76')][0x2]);if(!fs[_0xb760('0x79')](_0xb5df1a)){throw new Error(_0xb760('0x7a'));}var _0x5854b6={};try{_0x5854b6=JSON[_0xb760('0x4e')](process[_0xb760('0x76')][0x3]);if(!_0x5854b6[_0xb760('0x49')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x5854b6[_0xb760('0x49')]['phone']){throw new Error(_0xb760('0x7b'));}if(!_0x5854b6[_0xb760('0x49')][_0xb760('0x7c')]){throw new Error(_0xb760('0x7d'));}var _0x343bc7=0x0;if(_0x5854b6[_0xb760('0x49')][_0xb760('0x23')]){_0x343bc7=0x1;}if(!_0x5854b6['ListId']){throw new Error(_0xb760('0x7e'));}}catch(_0xc6a41a){throw new Error(_0xb760('0x7f'));}var _0x3a7d18=[];try{_0x3a7d18=_[_0xb760('0x80')](JSON[_0xb760('0x4e')](process[_0xb760('0x76')][0x4]),'id');}catch(_0x494ea8){logger[_0xb760('0x3b')]('No\x20agent\x20available');}main(_0xb5df1a,_0x5854b6,_0x3a7d18,_0x343bc7);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xddc1=['each','affectedRows','unlink','complete','argv','file\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','from','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','fromQuery','fields','cm_contacts.ListId\x20=\x20','cm_hopper_black','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','info','Received\x20SIGINT','message','exit','push','code','sequelize','query','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','length','rows','errors','data','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','error','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xddc1,0x192));var _0x1ddc=function(_0x100bcd,_0x1778a5){_0x100bcd=_0x100bcd-0x0;var _0x41f251=_0xddc1[_0x100bcd];return _0x41f251;};'use strict';var fs=require('fs');var path=require(_0x1ddc('0x0'));var _=require(_0x1ddc('0x1'));var Papa=require('papaparse');var util=require(_0x1ddc('0x2'));var BPromise=require(_0x1ddc('0x3'));var moment=require(_0x1ddc('0x4'));var squel=require(_0x1ddc('0x5'));var Redis=require('ioredis');var db=require(_0x1ddc('0x6'))['db'];var config=require(_0x1ddc('0x7'));var logger=require(_0x1ddc('0x8'))('import');config[_0x1ddc('0x9')]=_[_0x1ddc('0xa')](config['redis'],{'host':_0x1ddc('0xb'),'port':0x18eb});var socket=require(_0x1ddc('0xc'))(new Redis(config[_0x1ddc('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x1ddc('0xd'));function isEmail(_0x29207b){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'](_0x29207b);}function selectNotIn(_0x8cdfcf,_0x3c376a,_0x2002d2,_0x29d95c,_0x485003){return squel[_0x1ddc('0xe')]()[_0x1ddc('0xf')](_0x1ddc('0x10'))['from'](_0x29d95c)[_0x1ddc('0x11')](_0x3c376a,null,_0x3c376a+_0x1ddc('0x12')+_0x29d95c+'.'+_0x2002d2)[_0x1ddc('0x13')](_0x29d95c+'.'+_0x2002d2+_0x1ddc('0x14')+_0x8cdfcf+'.'+_0x2002d2)['where'](_0x3c376a+_0x1ddc('0x15')+_0x485003[_0x1ddc('0x11')]()+')');}function insertCmHopper(_0x4e4b82,_0x5d74a0,_0x266ab5,_0x3237e1,_0x113cb8){var _0x41987d=[_0x1ddc('0x16'),_0x1ddc('0x17'),_0x1ddc('0x18'),'cm_contacts.ListId',_0x5d74a0+'.'+_0x3237e1,_0x1ddc('0x19'),_0x1ddc('0x1a'),'cm_contacts.priority',_0x1ddc('0x1b'),'\x22'+_0x113cb8+'\x22'];return squel[_0x1ddc('0x1c')]()[_0x1ddc('0x1d')](_0x1ddc('0x1e'))['fromQuery']([_0x1ddc('0x10'),_0x1ddc('0x1f'),_0x1ddc('0x20'),_0x1ddc('0x21'),_0x3237e1,_0x1ddc('0x22'),_0x1ddc('0x23'),_0x1ddc('0x24'),'UserId','recallme'],squel['select']()['fields'](_0x41987d)[_0x1ddc('0x25')](_0x5d74a0)[_0x1ddc('0x11')](_0x1ddc('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5d74a0+_0x1ddc('0x27'))['join'](_0x266ab5,null,_0x266ab5+_0x1ddc('0x12')+_0x5d74a0+'.'+_0x3237e1)['where'](_0x5d74a0+_0x1ddc('0x28'),_0x4e4b82)[_0x1ddc('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1ddc('0x13')](_0x1ddc('0x29'),selectNotIn(_0x5d74a0,_0x266ab5,_0x3237e1,_0x1ddc('0x1e'),[_0x1ddc('0x2a'),_0x1ddc('0x2b')]))[_0x1ddc('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5d74a0,_0x266ab5,_0x3237e1,_0x1ddc('0x1e'),[_0x1ddc('0x2a')])))[_0x1ddc('0x2c')]();}function insertCmHopperBlack(_0x231525,_0x528f01,_0x250d8e,_0x2a758b){var _0x17f503=[_0x1ddc('0x16'),_0x1ddc('0x18'),_0x1ddc('0x2d'),_0x528f01+'.'+_0x2a758b,_0x1ddc('0x19'),_0x1ddc('0x1a')];return squel['insert']()[_0x1ddc('0x1d')]('cm_hopper_black')[_0x1ddc('0x2e')]([_0x1ddc('0x10'),_0x1ddc('0x20'),_0x1ddc('0x21'),_0x2a758b,_0x1ddc('0x22'),'updatedAt'],squel['select']()[_0x1ddc('0x2f')](_0x17f503)[_0x1ddc('0x25')](_0x528f01)[_0x1ddc('0x11')](_0x1ddc('0x26'),null,_0x1ddc('0x30')+_0x528f01+'.CmListId')[_0x1ddc('0x11')](_0x250d8e,null,_0x250d8e+'.id\x20=\x20'+_0x528f01+'.'+_0x2a758b)[_0x1ddc('0x13')](_0x528f01+_0x1ddc('0x28'),_0x231525)[_0x1ddc('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1ddc('0x13')](_0x1ddc('0x29'),squel['select']()[_0x1ddc('0xf')](_0x1ddc('0x10'))[_0x1ddc('0x25')](_0x1ddc('0x31'))[_0x1ddc('0x13')](_0x1ddc('0x32'),_0x231525)[_0x1ddc('0x13')](_0x2a758b+'\x20=\x20?',_0x528f01+'.'+_0x2a758b)))[_0x1ddc('0x2c')]();}function insertCmContact(_0x53acd5,_0x58e6fd,_0xc3bf9a,_0x46e693){var _0x4d45c2=_[_0x1ddc('0x33')](_[_0x1ddc('0x34')](_0x46e693),[_0x1ddc('0x21'),_0x1ddc('0x35'),_0x1ddc('0x22'),'updatedAt']);return squel[_0x1ddc('0x1c')]()[_0x1ddc('0x1d')](_0x1ddc('0x26'))[_0x1ddc('0x2e')](_0x4d45c2,squel[_0x1ddc('0xe')]()[_0x1ddc('0x2f')](_0x4d45c2)[_0x1ddc('0x25')](_0x58e6fd)[_0x1ddc('0x13')]('('+_0xc3bf9a[_0x1ddc('0x11')](',')+_0x1ddc('0x36'),squel[_0x1ddc('0xe')]()[_0x1ddc('0x2f')](_0xc3bf9a)[_0x1ddc('0x25')](_0x1ddc('0x26'))[_0x1ddc('0x13')](_0x1ddc('0x32'),_0x53acd5)['where'](_0x1ddc('0x37')))[_0x1ddc('0x13')]('id\x20IN\x20?',squel[_0x1ddc('0xe')]()[_0x1ddc('0xf')](_0x1ddc('0x38'),'min_id')[_0x1ddc('0x25')](_0x58e6fd)[_0x1ddc('0x39')](_0xc3bf9a[_0x1ddc('0x11')](','))))[_0x1ddc('0x2c')]();}function handleStop(){logger[_0x1ddc('0x3a')](_0x1ddc('0x3b'));stopped=!![];}function handleUncaughtException(_0x282007){logger['error'](_0x282007[_0x1ddc('0x3c')]);process[_0x1ddc('0x3d')](0x1);}function handleError(_0x2983b0,_0x5ac5d2){stats['errors'][_0x1ddc('0x3e')]({'name':_0x5ac5d2[_0x1ddc('0x3f')],'message':_0x5ac5d2[_0x1ddc('0x3c')],'row':_0x2983b0});}function handleQuery(_0x54088a){logger[_0x1ddc('0x3a')](_0x54088a);return db[_0x1ddc('0x40')][_0x1ddc('0x41')](_0x54088a)['spread'](function(_0x22a5ab){results[_0x1ddc('0x3e')](_0x22a5ab);})[_0x1ddc('0x42')](function(_0x329f58){logger['error'](_0x329f58[_0x1ddc('0x3c')]);});}function main(_0x289c3e,_0x1ac59a,_0x5131e3,_0x464f90){logger[_0x1ddc('0x3a')](_0x1ddc('0x43'),_0x289c3e,JSON[_0x1ddc('0x44')](_0x1ac59a));process[_0x1ddc('0x45')](_0x1ddc('0x46'));var _0xca8c78=_0x1ac59a[_0x1ddc('0x47')];var _0x1d10b7=_0x1ac59a[_0x1ddc('0x48')];var _0x52ead6=path[_0x1ddc('0x11')](config[_0x1ddc('0x49')],_0x1ddc('0x4a'),_0x1d10b7+_0x1ddc('0x4b'));var _0x515c90=_[_0x1ddc('0x34')](_0xca8c78)[_0x1ddc('0x11')]();logger[_0x1ddc('0x3a')](_0x1ddc('0x4c'),_0x515c90);fs[_0x1ddc('0x4d')](_0x52ead6,_0x515c90+'\x0a');Papa[_0x1ddc('0x4e')](fs[_0x1ddc('0x4f')](_0x289c3e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4f210a,_0x1ad000){try{for(var _0x592d4b=0x0,_0xfd5208=[];_0x592d4b<_0x4f210a['data'][_0x1ddc('0x50')];_0x592d4b++){stats[_0x1ddc('0x51')]+=0x1;if(_0x4f210a[_0x1ddc('0x52')][_0x592d4b]){handleError(_0x4f210a[_0x1ddc('0x53')][_0x592d4b],_0x4f210a['errors'][_0x592d4b]);}else{var _0x3171be=[];for(var _0x1b885e in _0xca8c78){if(_0xca8c78[_0x1ddc('0x54')](_0x1b885e)){if(_0x4f210a[_0x1ddc('0x53')][_0x592d4b][_0xca8c78[_0x1b885e]]){var _0x55f454=_[_0x1ddc('0x55')](_0x4f210a[_0x1ddc('0x53')][_0x592d4b][_0xca8c78[_0x1b885e]][_0x1ddc('0x56')](/"/g,'\x27'));switch(_0x1b885e){case _0x1ddc('0x1f'):var _0x5276a1=moment(_0x55f454,_0x1ddc('0xd'),!![]);if(_0x5276a1['isValid']()){_0xfd5208['push']('\x22'+_0x55f454+'\x22');}else{_0x3171be[_0x1ddc('0x3e')](_0x1ddc('0x57'));}break;case _0x1ddc('0x24'):var _0x4f005e=parseInt(_0x55f454);_0x55f454=_[_0x1ddc('0x58')](_0x4f005e)||_0x4f005e<0x0||_0x4f005e>0x4?_0x464f90?0x3:0x2:_0x4f005e;_0xfd5208[_0x1ddc('0x3e')]('\x22'+_0x55f454+'\x22');break;case _0x1ddc('0x59'):var _0x3180a0=parseInt(_0x55f454);if(_['isNumber'](_0x3180a0)&&_[_0x1ddc('0x5a')](_0x5131e3,_0x3180a0)){_0xfd5208['push']('\x22'+_0x3180a0+'\x22');}else{_0x3171be['push'](_0x1ddc('0x5b'));}break;case _0x1ddc('0x5c'):if(isEmail(_0x55f454)){_0xfd5208[_0x1ddc('0x3e')]('\x22'+_0x55f454+'\x22');}else{_0x3171be[_0x1ddc('0x3e')](_0x1ddc('0x5d'));}break;case _0x1ddc('0x5e'):var _0x401589=moment(_0x55f454,_0x1ddc('0x5f'),!![]);if(_0x401589['isValid']()){_0xfd5208[_0x1ddc('0x3e')]('\x22'+_0x55f454+'\x22');}else{_0x3171be[_0x1ddc('0x3e')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0xfd5208['push']('\x22'+_0x55f454+'\x22');}}else{switch(_0x1b885e){case'firstName':case'phone':_0x3171be[_0x1ddc('0x3e')](_0x1b885e+_0x1ddc('0x60'));break;default:_0xfd5208['push']('\x22\x22');}}}}if(_0x3171be[_0x1ddc('0x50')]){handleError(_0x4f210a[_0x1ddc('0x53')][_0x592d4b],{'code':_0x1ddc('0x61'),'message':_0x3171be['join']()});}else{fs[_0x1ddc('0x62')](_0x52ead6,_0xfd5208[_0x1ddc('0x11')]()+'\x0a');}_0xfd5208=[];}if(!(stats['rows']%0xc8)){socket[_0x1ddc('0x63')](_0x1ddc('0x64')+_0x1d10b7,stats);stats[_0x1ddc('0x52')]=[];}}if(stopped){logger[_0x1ddc('0x3a')](_0x1ddc('0x65'));_0x1ad000[_0x1ddc('0x66')]();}}catch(_0x17d503){handleError(_0x4f210a[_0x1ddc('0x53')][_0x592d4b],{'code':'SystemError','message':_0x17d503[_0x1ddc('0x3c')]});logger[_0x1ddc('0x67')](_0x1ddc('0x68'),_0x17d503[_0x1ddc('0x3c')]);}},'complete':function(){try{var _0x47d78d=[];var _0x3a06d3=_0x1ddc('0x26');if(_0x1ac59a[_0x1ddc('0x69')]&&_0x1ac59a[_0x1ddc('0x69')][_0x1ddc('0x50')]){_0x3a06d3=_0x1ddc('0x6a')+_0x1d10b7;_0x47d78d[_0x1ddc('0x3e')](_0x1ddc('0x6b')+_0x3a06d3+_0x1ddc('0x6c'));}var _0x26e854=util[_0x1ddc('0x6d')](_0x1ddc('0x6e'),_0x52ead6,_0x3a06d3,_0x515c90,_0x1ac59a[_0x1ddc('0x21')],_0x1ac59a['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xca8c78[_0x1ddc('0x1f')])){_0x26e854+=',\x20scheduledAt\x20=\x20NOW()';}_0x47d78d[_0x1ddc('0x3e')](_0x26e854);if(_0x1ac59a[_0x1ddc('0x69')]&&_0x1ac59a[_0x1ddc('0x69')][_0x1ddc('0x50')]){_0x47d78d[_0x1ddc('0x3e')](insertCmContact(_0x1ac59a[_0x1ddc('0x21')],_0x3a06d3,_0x1ac59a[_0x1ddc('0x69')],_0xca8c78));_0x47d78d[_0x1ddc('0x3e')]('DROP\x20TABLE\x20'+_0x3a06d3+';');}_0x47d78d[_0x1ddc('0x3e')](insertCmHopper(_0x1ac59a[_0x1ddc('0x21')],'voice_queues_has_cm_lists',_0x1ddc('0x6f'),_0x1ddc('0x70'),_0x464f90));_0x47d78d['push'](insertCmHopperBlack(_0x1ac59a['ListId'],_0x1ddc('0x71'),_0x1ddc('0x6f'),'VoiceQueueId'));_0x47d78d['push'](insertCmHopper(_0x1ac59a[_0x1ddc('0x21')],_0x1ddc('0x72'),_0x1ddc('0x73'),'CampaignId',_0x464f90));_0x47d78d[_0x1ddc('0x3e')](insertCmHopperBlack(_0x1ac59a[_0x1ddc('0x21')],_0x1ddc('0x74'),_0x1ddc('0x73'),_0x1ddc('0x75')));BPromise[_0x1ddc('0x76')](_0x47d78d,handleQuery)['then'](function(_0x459af3){stats['finish']=!![];stats[_0x1ddc('0x77')]=_0x1ac59a[_0x1ddc('0x69')]&&_0x1ac59a[_0x1ddc('0x69')]['length']?results[0x2]['affectedRows']:results[0x0][_0x1ddc('0x77')];socket[_0x1ddc('0x63')]('contact:import:'+_0x1d10b7,stats);fs[_0x1ddc('0x78')](_0x289c3e);fs[_0x1ddc('0x78')](_0x52ead6);process[_0x1ddc('0x3d')](0x0);})[_0x1ddc('0x42')](function(_0x3b3e0f){logger[_0x1ddc('0x67')](_0x3b3e0f[_0x1ddc('0x3c')]);process[_0x1ddc('0x3d')](0x1);});}catch(_0x514279){logger[_0x1ddc('0x67')](_0x1ddc('0x79'),_0x514279['message']);process[_0x1ddc('0x3d')](0x1);}},'error':function(_0x435fab,_0x1a1208,_0x5de44e,_0x22e201){throw new Error(_0x22e201);}});}function validate(){if(process[_0x1ddc('0x7a')]&&process[_0x1ddc('0x7a')][_0x1ddc('0x50')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x2d2f19=path[_0x1ddc('0x11')](config[_0x1ddc('0x49')],_0x1ddc('0x4a'),process[_0x1ddc('0x7a')][0x2]);if(!fs['existsSync'](_0x2d2f19)){throw new Error(_0x1ddc('0x7b'));}var _0x2feb1e={};try{_0x2feb1e=JSON[_0x1ddc('0x4e')](process['argv'][0x3]);if(!_0x2feb1e[_0x1ddc('0x47')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2feb1e[_0x1ddc('0x47')][_0x1ddc('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x2feb1e[_0x1ddc('0x47')][_0x1ddc('0x7c')]){throw new Error(_0x1ddc('0x7d'));}var _0x3ce82a=0x0;if(_0x2feb1e[_0x1ddc('0x47')][_0x1ddc('0x59')]){_0x3ce82a=0x1;}if(!_0x2feb1e[_0x1ddc('0x21')]){throw new Error(_0x1ddc('0x7e'));}}catch(_0x3eb171){throw new Error(_0x1ddc('0x7f'));}var _0x26f245=[];try{_0x26f245=_['map'](JSON[_0x1ddc('0x4e')](process[_0x1ddc('0x7a')][0x4]),'id');}catch(_0xda23ca){logger[_0x1ddc('0x3a')](_0x1ddc('0x80'));}main(_0x2d2f19,_0x2feb1e,_0x26f245,_0x3ce82a);}validate();process['on'](_0x1ddc('0x81'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 9b38bcf..88b0129 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 _0x8ab1=['keyValue','Caller\x20Number','Call\x20To','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','membername','starttime','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','voice','inbound','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***'];(function(_0x27119e,_0x26a916){var _0x352012=function(_0x15cd0a){while(--_0x15cd0a){_0x27119e['push'](_0x27119e['shift']());}};_0x352012(++_0x26a916);}(_0x8ab1,0x12b));var _0x18ab=function(_0x3242f8,_0x452998){_0x3242f8=_0x3242f8-0x0;var _0x47e17f=_0x8ab1[_0x3242f8];return _0x47e17f;};'use strict';exports[_0x18ab('0x0')]=function(_0x2a65b7,_0x537b77){var _0x31caea=[{'type':_0x18ab('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x2a65b7[_0x18ab('0x2')]()){case _0x18ab('0x3'):switch(_0x537b77[_0x18ab('0x2')]()){case _0x18ab('0x4'):_0x31caea[_0x18ab('0x5')]({'type':_0x18ab('0x6'),'content':'','variableName':_0x18ab('0x7')});_0x31caea[_0x18ab('0x5')]({'type':'variable','content':'','variableName':_0x18ab('0x8')});break;case'outbound':_0x31caea[_0x18ab('0x5')]({'type':_0x18ab('0x1'),'content':_0x18ab('0x9'),'variableName':null});_0x31caea['push']({'type':'variable','content':'','variableName':_0x18ab('0xa')});break;}}return _0x31caea;};exports[_0x18ab('0xb')]=function(_0x545737,_0x113373){var _0x144347=[];switch(_0x545737['toLowerCase']()){case _0x18ab('0x3'):switch(_0x113373[_0x18ab('0x2')]()){case _0x18ab('0x4'):_0x144347=[{'type':_0x18ab('0x1'),'content':_0x18ab('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0xe'),'keyType':_0x18ab('0x6'),'variableName':_0x18ab('0x8')},{'type':_0x18ab('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x18ab('0x6'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0x18ab('0xf'),'keyType':_0x18ab('0x6'),'variableName':_0x18ab('0x10')},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0x11'),'keyType':_0x18ab('0x6'),'variableName':_0x18ab('0x7')},{'type':'keyValue','content':'','key':_0x18ab('0x12'),'keyType':'variable','variableName':_0x18ab('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x18ab('0x6'),'variableName':_0x18ab('0x14')},{'type':'string','content':_0x18ab('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x18ab('0x16')},{'type':'keyValue','content':'','key':_0x18ab('0x17'),'keyType':'variable','variableName':_0x18ab('0xa')},{'type':'string','content':_0x18ab('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x18ab('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0x18ab('0x6'),'variableName':'agentcalledAt'},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0x19'),'keyType':'variable','variableName':_0x18ab('0x1a')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0x18ab('0x6'),'variableName':'agentcompleteAt'},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0x1b'),'keyType':_0x18ab('0x6'),'variableName':_0x18ab('0x1c')},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0x1d'),'keyType':_0x18ab('0x6'),'variableName':'talktime'}];break;case'outbound':_0x144347=[{'type':'string','content':_0x18ab('0xc'),'variableName':null},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0x1e'),'keyType':_0x18ab('0x6'),'keyContent':'','variableName':_0x18ab('0xa')},{'type':_0x18ab('0xd'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x18ab('0x1f')},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0x12'),'keyType':_0x18ab('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x18ab('0x6'),'keyContent':'','variableName':_0x18ab('0x20')},{'type':_0x18ab('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x18ab('0xd'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x18ab('0x21')},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0x22'),'keyType':_0x18ab('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0x18ab('0xd'),'content':'','key':_0x18ab('0x23'),'keyType':_0x18ab('0x6'),'keyContent':'','variableName':_0x18ab('0x24')},{'type':'keyValue','content':'','key':_0x18ab('0x25'),'keyType':_0x18ab('0x6'),'keyContent':'','variableName':_0x18ab('0x26')}];break;}}return _0x144347;}; \ No newline at end of file +var _0x1cfa=['***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','Date','answertime','Complete\x20Time','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','calleridname','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime'];(function(_0x5bc95c,_0xfed759){var _0x3721fc=function(_0x49fca7){while(--_0x49fca7){_0x5bc95c['push'](_0x5bc95c['shift']());}};_0x3721fc(++_0xfed759);}(_0x1cfa,0x8b));var _0xa1cf=function(_0x46516f,_0x1e14f3){_0x46516f=_0x46516f-0x0;var _0x5d03c0=_0x1cfa[_0x46516f];return _0x5d03c0;};'use strict';exports[_0xa1cf('0x0')]=function(_0x1f97b9,_0x22eda4){var _0x112c53=[{'type':'string','content':_0xa1cf('0x1'),'variableName':null}];switch(_0x1f97b9[_0xa1cf('0x2')]()){case _0xa1cf('0x3'):switch(_0x22eda4[_0xa1cf('0x2')]()){case _0xa1cf('0x4'):_0x112c53[_0xa1cf('0x5')]({'type':_0xa1cf('0x6'),'content':'','variableName':_0xa1cf('0x7')});_0x112c53[_0xa1cf('0x5')]({'type':_0xa1cf('0x6'),'content':'','variableName':_0xa1cf('0x8')});break;case _0xa1cf('0x9'):_0x112c53[_0xa1cf('0x5')]({'type':_0xa1cf('0xa'),'content':_0xa1cf('0xb'),'variableName':null});_0x112c53[_0xa1cf('0x5')]({'type':_0xa1cf('0x6'),'content':'','variableName':_0xa1cf('0xc')});break;}}return _0x112c53;};exports[_0xa1cf('0xd')]=function(_0x24cb7c,_0x405406){var _0x49d733=[];switch(_0x24cb7c[_0xa1cf('0x2')]()){case _0xa1cf('0x3'):switch(_0x405406[_0xa1cf('0x2')]()){case _0xa1cf('0x4'):_0x49d733=[{'type':_0xa1cf('0xa'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0xf'),'keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0x8')},{'type':_0xa1cf('0xe'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0xa1cf('0x10')},{'type':_0xa1cf('0xe'),'content':'','key':'Call\x20To','keyType':'variable','variableName':_0xa1cf('0x11')},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x12'),'keyType':'variable','variableName':_0xa1cf('0x7')},{'type':'keyValue','content':'','key':_0xa1cf('0x13'),'keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0x14')},{'type':_0xa1cf('0xe'),'content':'','key':'Date','keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0x15')},{'type':'string','content':_0xa1cf('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xa1cf('0xe'),'content':'','key':'Agent\x20Name','keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0x17')},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x18'),'keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0xc')},{'type':'string','content':_0xa1cf('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x1a'),'keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0x15')},{'type':_0xa1cf('0xe'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':'agentconnectAt'},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x1b'),'keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0x1c')},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x1d'),'keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0x1e')},{'type':'keyValue','content':'','key':_0xa1cf('0x1f'),'keyType':_0xa1cf('0x6'),'variableName':_0xa1cf('0x20')}];break;case'outbound':_0x49d733=[{'type':'string','content':_0xa1cf('0x21'),'variableName':null},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x22'),'keyType':_0xa1cf('0x6'),'keyContent':'','variableName':_0xa1cf('0xc')},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x23'),'keyType':_0xa1cf('0x6'),'keyContent':'','variableName':_0xa1cf('0x24')},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x13'),'keyType':'variable','keyContent':'','variableName':_0xa1cf('0x14')},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x25'),'keyType':_0xa1cf('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0xa1cf('0xa'),'content':_0xa1cf('0x19')},{'type':_0xa1cf('0xe'),'content':'','key':'Answer\x20Time','keyType':_0xa1cf('0x6'),'keyContent':'','variableName':_0xa1cf('0x26')},{'type':_0xa1cf('0xe'),'content':'','key':_0xa1cf('0x27'),'keyType':_0xa1cf('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xa1cf('0xe'),'content':'','key':'Duration','keyType':_0xa1cf('0x6'),'keyContent':'','variableName':_0xa1cf('0x28')},{'type':'keyValue','content':'','key':_0xa1cf('0x29'),'keyType':_0xa1cf('0x6'),'keyContent':'','variableName':_0xa1cf('0x2a')}];break;}}return _0x49d733;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index c42e2ac..53adb34 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 _0x636e=['then','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile','lodash','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','Interaction','findOne','update'];(function(_0x23a8f7,_0x768747){var _0x5a1fc3=function(_0x238a39){while(--_0x238a39){_0x23a8f7['push'](_0x23a8f7['shift']());}};_0x5a1fc3(++_0x768747);}(_0x636e,0x11b));var _0xe636=function(_0x4eed43,_0x498e7d){_0x4eed43=_0x4eed43-0x0;var _0x38bf43=_0x636e[_0x4eed43];return _0x38bf43;};'use strict';var _=require(_0xe636('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xe636('0x1'))('openchannel-interactions'),'mail':require('../../config/logger')(_0xe636('0x2')),'fax':require(_0xe636('0x1'))(_0xe636('0x3')),'sms':require('../../config/logger')(_0xe636('0x4')),'chat':require(_0xe636('0x1'))(_0xe636('0x5')),'whatsapp':require('../../config/logger')(_0xe636('0x6'))};function getInteractionId(_0x4a4de1,_0xb9c102,_0x558168){if(_0x4a4de1&&_0x4a4de1[_[_0xe636('0x7')](_0x558168)+_0xe636('0x8')]){return _0x4a4de1[_['upperFirst'](_0x558168)+_0xe636('0x8')];}else if(_0x4a4de1&&_0x4a4de1['id']){return _0x4a4de1['id'];}else if(_0xb9c102&&_0xb9c102['id']){return _0xb9c102['id'];}else{return _0xe636('0x9');}}function log(_0x34649a,_0x1694fd,_0x4f2201,_0x483dfd,_0x134016,_0xd35ed9){loggers[_0x134016[_0xe636('0xa')]()][_0x34649a](_0xe636('0xb'),_0xd35ed9['toUpperCase'](),_0x1694fd?_0x1694fd['id']:null,_0x1694fd?_0x1694fd['name']:null,_0x1694fd?_0x1694fd[_0xe636('0xc')]:null,getInteractionId(_0x4f2201,_0x483dfd,_0x134016),_0x4f2201?JSON[_0xe636('0xd')](_0x4f2201):'null');}function updateUser(_0x3b5bf8,_0x4c02ac,_0x4e9592,_0x12b9a0,_0x49aec9){db[_[_0xe636('0x7')](_0x12b9a0)+_0xe636('0xe')][_0xe636('0xf')]({'where':{'id':getInteractionId(_0x4c02ac,_0x4e9592,_0x12b9a0)}})['then'](function(_0x1e9d84){if(_0x1e9d84){return _0x1e9d84[_0xe636('0x10')]({'UserId':_0x3b5bf8?_0x3b5bf8['id']:null});}})[_0xe636('0x11')](function(_0xbe21f5){if(_0xbe21f5){log('info',_0x3b5bf8,_0x4c02ac,_0x4e9592,_0x12b9a0,_0x49aec9);}})[_0xe636('0x12')](function(){log(_0xe636('0x13'),_0x3b5bf8,_0x4c02ac,_0x4e9592,_0x12b9a0,_0x49aec9);});}exports[_0xe636('0x14')]=function(_0x516b84,_0x21f88a){return function(_0x1c2648,_0x3369e8,_0x5c8876){var _0x4bc0af=_0x1c2648[_0xe636('0x15')];var _0x4a0d74={};var _0x2b6740=_0x1c2648[_0xe636('0x16')];if(_0x4a0d74){_0x4a0d74=_[_0xe636('0x17')](_0x1c2648[_0xe636('0x18')]);_0x4a0d74=_[_0xe636('0x19')](_0x4a0d74,[_0xe636('0x18'),_0xe636('0x1a'),_0xe636('0x1b'),_0xe636('0x1c'),_0xe636('0x1d')]);}updateUser(_0x4bc0af,_0x4a0d74,_0x2b6740,_0x516b84,_0x21f88a);_0x5c8876(null);};}; \ No newline at end of file +var _0x9728=['user','clone','body','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toUpperCase','role','stringify','null','Interaction','findOne','update','info','catch','error','tracked'];(function(_0x3c3755,_0xa08779){var _0x5dffb4=function(_0x4b7724){while(--_0x4b7724){_0x3c3755['push'](_0x3c3755['shift']());}};_0x5dffb4(++_0xa08779);}(_0x9728,0xca));var _0x8972=function(_0xcaca00,_0x4259e7){_0xcaca00=_0xcaca00-0x0;var _0x557338=_0x9728[_0xcaca00];return _0x557338;};'use strict';var _=require(_0x8972('0x0'));var db=require(_0x8972('0x1'))['db'];var loggers={'openchannel':require(_0x8972('0x2'))(_0x8972('0x3')),'mail':require(_0x8972('0x2'))(_0x8972('0x4')),'fax':require(_0x8972('0x2'))(_0x8972('0x5')),'sms':require(_0x8972('0x2'))(_0x8972('0x6')),'chat':require(_0x8972('0x2'))(_0x8972('0x7')),'whatsapp':require(_0x8972('0x2'))('whatsapp-interactions')};function getInteractionId(_0x293e23,_0xc77d5d,_0x18d992){if(_0x293e23&&_0x293e23[_[_0x8972('0x8')](_0x18d992)+_0x8972('0x9')]){return _0x293e23[_[_0x8972('0x8')](_0x18d992)+_0x8972('0x9')];}else if(_0x293e23&&_0x293e23['id']){return _0x293e23['id'];}else if(_0xc77d5d&&_0xc77d5d['id']){return _0xc77d5d['id'];}else{return _0x8972('0xa');}}function log(_0x497ba7,_0x28fcc5,_0x2da3a0,_0x2e4983,_0x3ed52f,_0x2a964b){loggers[_0x3ed52f['toLowerCase']()][_0x497ba7]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a964b[_0x8972('0xb')](),_0x28fcc5?_0x28fcc5['id']:null,_0x28fcc5?_0x28fcc5['name']:null,_0x28fcc5?_0x28fcc5[_0x8972('0xc')]:null,getInteractionId(_0x2da3a0,_0x2e4983,_0x3ed52f),_0x2da3a0?JSON[_0x8972('0xd')](_0x2da3a0):_0x8972('0xe'));}function updateUser(_0x1d13d8,_0x2156f6,_0x1da7c5,_0x147e4b,_0x33fc42){db[_['upperFirst'](_0x147e4b)+_0x8972('0xf')][_0x8972('0x10')]({'where':{'id':getInteractionId(_0x2156f6,_0x1da7c5,_0x147e4b)}})['then'](function(_0x2105e7){if(_0x2105e7){return _0x2105e7[_0x8972('0x11')]({'UserId':_0x1d13d8?_0x1d13d8['id']:null});}})['then'](function(_0x5e7e6c){if(_0x5e7e6c){log(_0x8972('0x12'),_0x1d13d8,_0x2156f6,_0x1da7c5,_0x147e4b,_0x33fc42);}})[_0x8972('0x13')](function(){log(_0x8972('0x14'),_0x1d13d8,_0x2156f6,_0x1da7c5,_0x147e4b,_0x33fc42);});}exports[_0x8972('0x15')]=function(_0x44c88f,_0x242930){return function(_0x569840,_0x77b3f,_0x1d7701){var _0x1ccd09=_0x569840[_0x8972('0x16')];var _0x411005={};var _0x39e969=_0x569840['query'];if(_0x411005){_0x411005=_[_0x8972('0x17')](_0x569840[_0x8972('0x18')]);_0x411005=_['omit'](_0x411005,[_0x8972('0x18'),'html',_0x8972('0x19'),_0x8972('0x1a'),_0x8972('0x1b')]);}updateUser(_0x1ccd09,_0x411005,_0x39e969,_0x44c88f,_0x242930);_0x1d7701(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 9337e0e..2675c9d 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 _0xf512=['use','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','util','../../mysqldb','../../config/environment','data1','license','createDecipher','aes-256-ctr','format','update','base64','utf8','parse','hasOwnProperty'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf512,0x1d3));var _0x2f51=function(_0x472cc1,_0x3ab6b9){_0x472cc1=_0x472cc1-0x0;var _0x3c4b67=_0xf512[_0x472cc1];return _0x3c4b67;};'use strict';var crypto=require('crypto');var util=require(_0x2f51('0x0'));var compose=require('composable-middleware');var db=require(_0x2f51('0x1'))['db'];var config=require(_0x2f51('0x2'));function getValueFromLicense(_0x3a2433,_0x566402){if(_0x3a2433&&_0x566402){if(_0x566402[_0x2f51('0x3')]&&_0x566402[_0x2f51('0x4')]){var _0x4123af=_0x566402[_0x2f51('0x3')];var _0x75cc36=_0x566402[_0x2f51('0x4')];var _0x4d6c14=_0x4123af['split']('-')[0x4];var _0x54d728=_0x4123af['split']('-')[0x0];var _0x22ff9a=crypto[_0x2f51('0x5')](_0x2f51('0x6'),util[_0x2f51('0x7')]('%s:%s:%s',_0x4d6c14,_0x4123af,_0x54d728));var _0x43ab48=_0x22ff9a[_0x2f51('0x8')](_0x75cc36,_0x2f51('0x9'),_0x2f51('0xa'));_0x43ab48+=_0x22ff9a['final']('utf8');var _0x1e8145=JSON[_0x2f51('0xb')](_0x43ab48);return _0x1e8145[_0x2f51('0xc')](_0x3a2433)?_0x1e8145[_0x3a2433]:null;}}return null;}function isLimit(_0x45d2fc,_0x3ef398,_0xc82054,_0x2895db){var _0x53e075=_0x3ef398;return compose()[_0x2f51('0xd')](function(_0x3b1af1,_0x517e2b,_0x2b97ca){return db[_0x2f51('0xe')][_0x2f51('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x2f51('0x10')](function(_0x3b0cdb){var _0x2732a1=getValueFromLicense(_0x45d2fc,_0x3b0cdb);return _0x2732a1?_0x2732a1:_0x53e075;})[_0x2f51('0x10')](function(_0x1e6b4e){_0x53e075=_0x1e6b4e;return _0xc82054[_0x2f51('0x11')](_0x2895db);})['then'](function(_0x3d5265){if(_0x3d5265>=_0x53e075){return _0x517e2b['status'](0x193)['json']({'message':util['format'](_0x2f51('0x12'),_0x45d2fc)});}_0x2b97ca();})[_0x2f51('0x13')](function(_0x128a0c){_0x2b97ca(_0x128a0c);});});}function isUserLimit(){return isLimit(_0x2f51('0x14'),0x1,db[_0x2f51('0x15')],{'where':{'$or':[{'role':_0x2f51('0x16')},{'role':'user'}]}});}exports[_0x2f51('0x17')]=isUserLimit; \ No newline at end of file +var _0xdd66=['License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','isUserLimit','crypto','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','base64','final','utf8','parse','use'];(function(_0x5f2035,_0x513874){var _0xa1300=function(_0x16577c){while(--_0x16577c){_0x5f2035['push'](_0x5f2035['shift']());}};_0xa1300(++_0x513874);}(_0xdd66,0x9a));var _0x6dd6=function(_0x4213fc,_0x37f967){_0x4213fc=_0x4213fc-0x0;var _0x3b3ec4=_0xdd66[_0x4213fc];return _0x3b3ec4;};'use strict';var crypto=require(_0x6dd6('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x6dd6('0x1'))['db'];var config=require(_0x6dd6('0x2'));function getValueFromLicense(_0x300174,_0x478f28){if(_0x300174&&_0x478f28){if(_0x478f28[_0x6dd6('0x3')]&&_0x478f28['license']){var _0x20c82b=_0x478f28['data1'];var _0x158504=_0x478f28[_0x6dd6('0x4')];var _0x2934cf=_0x20c82b[_0x6dd6('0x5')]('-')[0x4];var _0x214f79=_0x20c82b[_0x6dd6('0x5')]('-')[0x0];var _0x2eb3ca=crypto['createDecipher'](_0x6dd6('0x6'),util[_0x6dd6('0x7')]('%s:%s:%s',_0x2934cf,_0x20c82b,_0x214f79));var _0x13e8c6=_0x2eb3ca[_0x6dd6('0x8')](_0x158504,_0x6dd6('0x9'),'utf8');_0x13e8c6+=_0x2eb3ca[_0x6dd6('0xa')](_0x6dd6('0xb'));var _0x4569f2=JSON[_0x6dd6('0xc')](_0x13e8c6);return _0x4569f2['hasOwnProperty'](_0x300174)?_0x4569f2[_0x300174]:null;}}return null;}function isLimit(_0x10842e,_0x308f64,_0x3c94ff,_0x149b22){var _0x2fc9f4=_0x308f64;return compose()[_0x6dd6('0xd')](function(_0x114517,_0x447af8,_0xcfd308){return db[_0x6dd6('0xe')][_0x6dd6('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x6dd6('0x10')](function(_0x4c487a){var _0x9578be=getValueFromLicense(_0x10842e,_0x4c487a);return _0x9578be?_0x9578be:_0x2fc9f4;})[_0x6dd6('0x10')](function(_0x499a50){_0x2fc9f4=_0x499a50;return _0x3c94ff['count'](_0x149b22);})[_0x6dd6('0x10')](function(_0x285141){if(_0x285141>=_0x2fc9f4){return _0x447af8[_0x6dd6('0x11')](0x193)[_0x6dd6('0x12')]({'message':util[_0x6dd6('0x7')](_0x6dd6('0x13'),_0x10842e)});}_0xcfd308();})[_0x6dd6('0x14')](function(_0x38baca){_0xcfd308(_0x38baca);});});}function isUserLimit(){return isLimit(_0x6dd6('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0x6dd6('0x16')},{'role':'user'}]}});}exports[_0x6dd6('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index cd7b479..56cf57d 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 _0xed79=['$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','<>\x20?','$startsWith','$lt','<\x20?','$gt','>\x20?','$lte','<=\x20?','$gte','start','$substring','$endsWith','shift','utcOffset','hours','minutes','seconds','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','match','filter','indexOf','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','add','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$ne'];(function(_0x3a6687,_0x401c5c){var _0x49735c=function(_0x360b2a){while(--_0x360b2a){_0x3a6687['push'](_0x3a6687['shift']());}};_0x49735c(++_0x401c5c);}(_0xed79,0xb2));var _0x9ed7=function(_0x3e3949,_0x146286){_0x3e3949=_0x3e3949-0x0;var _0x4ca465=_0xed79[_0x3e3949];return _0x4ca465;};'use strict';var _=require('lodash');var moment=require(_0x9ed7('0x0'));exports['parseSearch']=function(_0x13b304){var _0x4e57f8={'conditions':[]};_0x4e57f8[_0x9ed7('0x1')]=_[_0x9ed7('0x2')](_0x13b304,_0x9ed7('0x3'))?'or':_0x9ed7('0x4');var _0x4f7f92=_0x13b304[_0x9ed7('0x5')](_0x9ed7('0x6'),'')[_0x9ed7('0x5')](_0x9ed7('0x3'),'')[_0x9ed7('0x7')]('||');for(var _0x48a152=0x0;_0x48a152<_0x4f7f92['length'];_0x48a152++){var _0x424fb0=_0x4f7f92[_0x48a152][_0x9ed7('0x7')](':=');var _0xe380=_0x424fb0[0x0];var _0x4ccc2c=_0x424fb0[_0x9ed7('0x8')](0x1);_0x4ccc2c[_0x9ed7('0x9')](function(_0x28cf92){var _0x5cf2ab=_0x28cf92[_0x9ed7('0x7')]('[')['shift']();var _0x47280c=_0x28cf92[_0x9ed7('0xa')](/\[(.*?)\]/g);_0x47280c[_0x9ed7('0x9')](function(_0x588264){var _0x936c5e=_0x588264[_0x9ed7('0x7')]('[')[_0x9ed7('0xb')](function(_0x4ede54){return _0x4ede54[_0x9ed7('0xc')](']')>-0x1;})[_0x9ed7('0xd')](function(_0xfa7c6c){return _0xfa7c6c['split'](']')[0x0];})[0x0];_0x4e57f8['conditions'][_0x9ed7('0xe')]({'field':_0xe380,'operator':_0x5cf2ab,'value':_0x936c5e});});});}return _0x4e57f8;};exports[_0x9ed7('0xf')]=function(_0x261d97,_0x195dc9,_0x395319){var _0x5d38d6={};if(_0x195dc9===_0x9ed7('0x10')){if(_0x395319[_0x9ed7('0x11')]===_0x9ed7('0x12')){_0x395319[_0x9ed7('0x11')]=_0x9ed7('0x13');_0x395319[_0x9ed7('0x14')]+=','+_0x395319['value'];}else if(_[_0x9ed7('0x15')](['$gt','$lte'],_0x395319[_0x9ed7('0x11')])){_0x395319['value']=moment(_0x395319[_0x9ed7('0x14')])[_0x9ed7('0x16')](0x1,'days')[_0x9ed7('0x17')](_0x9ed7('0x18'));}}if(_0x395319[_0x9ed7('0x19')]){_0x195dc9=_0x395319[_0x9ed7('0x19')];_0x5d38d6['text']=_0x9ed7('0x1a')+_0x261d97+'.'+_0x395319[_0x9ed7('0x1b')]+_0x9ed7('0x1c')+_0x395319[_0x9ed7('0x19')]+')\x20'+parseOperator(_0x395319[_0x9ed7('0x11')]);}else{_0x5d38d6['text']=_0x261d97+'.'+_0x395319[_0x9ed7('0x1b')]+'\x20'+parseOperator(_0x395319[_0x9ed7('0x11')]);}if(_[_0x9ed7('0x15')]([_0x9ed7('0x1d'),_0x9ed7('0x1e')],_0x395319['operator']))_0x5d38d6['text']='('+_0x5d38d6['text']+_0x9ed7('0x1f')+_0x261d97+'.'+_0x395319[_0x9ed7('0x1b')]+_0x9ed7('0x20');_0x5d38d6[_0x9ed7('0x14')]=parseValue(_0x195dc9,_0x395319[_0x9ed7('0x11')],_0x395319[_0x9ed7('0x14')]);return _0x5d38d6;};function parseOperator(_0x5ed6d8){var _0x1d3139;switch(_0x5ed6d8){case _0x9ed7('0x21'):_0x1d3139='IN\x20?';break;case'$notIn':_0x1d3139=_0x9ed7('0x22');break;case'$eq':_0x1d3139='=\x20?';break;case'$ne':_0x1d3139=_0x9ed7('0x23');break;case'$substring':case _0x9ed7('0x24'):case'$endsWith':_0x1d3139='LIKE\x20?';break;case _0x9ed7('0x25'):_0x1d3139=_0x9ed7('0x26');break;case _0x9ed7('0x27'):_0x1d3139=_0x9ed7('0x28');break;case _0x9ed7('0x29'):_0x1d3139=_0x9ed7('0x2a');break;case _0x9ed7('0x2b'):_0x1d3139='>=\x20?';break;case _0x9ed7('0x13'):_0x1d3139='BETWEEN\x20?\x20AND\x20?';break;}return _0x1d3139;}function parseValue(_0x37f23c,_0x4f3cdd,_0x225253){var _0x485c92={'start':undefined,'end':undefined};switch(_0x4f3cdd){case _0x9ed7('0x21'):case _0x9ed7('0x1e'):_0x485c92[_0x9ed7('0x2c')]=_0x225253[_0x9ed7('0x7')](',');break;case _0x9ed7('0x2d'):_0x485c92[_0x9ed7('0x2c')]='%'+_0x225253+'%';break;case'$startsWith':_0x485c92[_0x9ed7('0x2c')]=_0x225253+'%';break;case _0x9ed7('0x2e'):_0x485c92['start']='%'+_0x225253;break;case _0x9ed7('0x13'):var _0x3704ec=_0x225253[_0x9ed7('0x7')](',');var _0x225253=_0x3704ec[_0x9ed7('0x2f')]();var _0x4d9b0c=_0x3704ec['pop']();if(_0x37f23c==='DATE'){_0x225253=moment(_0x225253)[_0x9ed7('0x30')](0x0,!![])['format']();_0x4d9b0c=moment(_0x4d9b0c)['utcOffset'](0x0,!![])[_0x9ed7('0x16')](0x17,_0x9ed7('0x31'))[_0x9ed7('0x16')](0x3b,_0x9ed7('0x32'))[_0x9ed7('0x16')](0x3b,_0x9ed7('0x33'))[_0x9ed7('0x17')]();}_0x485c92={'start':_0x225253,'end':_0x4d9b0c};break;default:_0x485c92['start']=_0x225253;break;}return _0x485c92;} \ No newline at end of file +var _0x4d54=['seconds','lodash','moment','startsWith','[$or]','and','replace','split','slice','forEach','shift','filter','indexOf','map','conditions','push','buildExpression','$eq','$between','value','includes','$gt','$lte','operator','add','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$in','$notIn','start','pop','utcOffset','format','hours'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d54,0xd9));var _0x44d5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d54[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x44d5('0x0'));var moment=require(_0x44d5('0x1'));exports['parseSearch']=function(_0x5582eb){var _0x34d81d={'conditions':[]};_0x34d81d['sqlOperator']=_[_0x44d5('0x2')](_0x5582eb,_0x44d5('0x3'))?'or':_0x44d5('0x4');var _0x3a6c2f=_0x5582eb[_0x44d5('0x5')]('[$and]','')[_0x44d5('0x5')](_0x44d5('0x3'),'')['split']('||');for(var _0x4224ae=0x0;_0x4224ae<_0x3a6c2f['length'];_0x4224ae++){var _0x34c333=_0x3a6c2f[_0x4224ae][_0x44d5('0x6')](':=');var _0x3d8fb1=_0x34c333[0x0];var _0x1c5b04=_0x34c333[_0x44d5('0x7')](0x1);_0x1c5b04[_0x44d5('0x8')](function(_0x2e877e){var _0x53062c=_0x2e877e[_0x44d5('0x6')]('[')[_0x44d5('0x9')]();var _0x32b811=_0x2e877e['match'](/\[(.*?)\]/g);_0x32b811[_0x44d5('0x8')](function(_0x51841c){var _0x4162de=_0x51841c['split']('[')[_0x44d5('0xa')](function(_0x10d840){return _0x10d840[_0x44d5('0xb')](']')>-0x1;})[_0x44d5('0xc')](function(_0x1f79e5){return _0x1f79e5[_0x44d5('0x6')](']')[0x0];})[0x0];_0x34d81d[_0x44d5('0xd')][_0x44d5('0xe')]({'field':_0x3d8fb1,'operator':_0x53062c,'value':_0x4162de});});});}return _0x34d81d;};exports[_0x44d5('0xf')]=function(_0x474680,_0x248b2c,_0x5e00eb){var _0x46a93a={};if(_0x248b2c==='DATE'){if(_0x5e00eb['operator']===_0x44d5('0x10')){_0x5e00eb['operator']=_0x44d5('0x11');_0x5e00eb[_0x44d5('0x12')]+=','+_0x5e00eb['value'];}else if(_[_0x44d5('0x13')]([_0x44d5('0x14'),_0x44d5('0x15')],_0x5e00eb[_0x44d5('0x16')])){_0x5e00eb['value']=moment(_0x5e00eb[_0x44d5('0x12')])[_0x44d5('0x17')](0x1,'days')['format'](_0x44d5('0x18'));}}if(_0x5e00eb[_0x44d5('0x19')]){_0x248b2c=_0x5e00eb[_0x44d5('0x19')];_0x46a93a[_0x44d5('0x1a')]=_0x44d5('0x1b')+_0x474680+'.'+_0x5e00eb[_0x44d5('0x1c')]+_0x44d5('0x1d')+_0x5e00eb['castTo']+')\x20'+parseOperator(_0x5e00eb[_0x44d5('0x16')]);}else{_0x46a93a[_0x44d5('0x1a')]=_0x474680+'.'+_0x5e00eb[_0x44d5('0x1c')]+'\x20'+parseOperator(_0x5e00eb[_0x44d5('0x16')]);}if(_[_0x44d5('0x13')]([_0x44d5('0x1e'),'$notIn'],_0x5e00eb['operator']))_0x46a93a['text']='('+_0x46a93a[_0x44d5('0x1a')]+_0x44d5('0x1f')+_0x474680+'.'+_0x5e00eb[_0x44d5('0x1c')]+_0x44d5('0x20');_0x46a93a[_0x44d5('0x12')]=parseValue(_0x248b2c,_0x5e00eb[_0x44d5('0x16')],_0x5e00eb['value']);return _0x46a93a;};function parseOperator(_0x605be1){var _0x39438c;switch(_0x605be1){case'$in':_0x39438c=_0x44d5('0x21');break;case'$notIn':_0x39438c=_0x44d5('0x22');break;case _0x44d5('0x10'):_0x39438c=_0x44d5('0x23');break;case _0x44d5('0x1e'):_0x39438c=_0x44d5('0x24');break;case _0x44d5('0x25'):case _0x44d5('0x26'):case _0x44d5('0x27'):_0x39438c=_0x44d5('0x28');break;case _0x44d5('0x29'):_0x39438c=_0x44d5('0x2a');break;case _0x44d5('0x14'):_0x39438c=_0x44d5('0x2b');break;case _0x44d5('0x15'):_0x39438c=_0x44d5('0x2c');break;case'$gte':_0x39438c=_0x44d5('0x2d');break;case'$between':_0x39438c='BETWEEN\x20?\x20AND\x20?';break;}return _0x39438c;}function parseValue(_0x430d70,_0x54f37d,_0x1e0fdd){var _0x2646a6={'start':undefined,'end':undefined};switch(_0x54f37d){case _0x44d5('0x2e'):case _0x44d5('0x2f'):_0x2646a6['start']=_0x1e0fdd[_0x44d5('0x6')](',');break;case _0x44d5('0x25'):_0x2646a6['start']='%'+_0x1e0fdd+'%';break;case _0x44d5('0x26'):_0x2646a6[_0x44d5('0x30')]=_0x1e0fdd+'%';break;case _0x44d5('0x27'):_0x2646a6[_0x44d5('0x30')]='%'+_0x1e0fdd;break;case _0x44d5('0x11'):var _0x2f40da=_0x1e0fdd[_0x44d5('0x6')](',');var _0x1e0fdd=_0x2f40da[_0x44d5('0x9')]();var _0x2fb7a7=_0x2f40da[_0x44d5('0x31')]();if(_0x430d70==='DATE'){_0x1e0fdd=moment(_0x1e0fdd)[_0x44d5('0x32')](0x0,!![])[_0x44d5('0x33')]();_0x2fb7a7=moment(_0x2fb7a7)['utcOffset'](0x0,!![])[_0x44d5('0x17')](0x17,_0x44d5('0x34'))[_0x44d5('0x17')](0x3b,'minutes')['add'](0x3b,_0x44d5('0x35'))[_0x44d5('0x33')]();}_0x2646a6={'start':_0x1e0fdd,'end':_0x2fb7a7};break;default:_0x2646a6['start']=_0x1e0fdd;break;}return _0x2646a6;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 5c27668..89e8e55 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 _0x4910=['limit','split','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','isEmpty','isObject','isString','length','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','query','$id','model','attributes','intersection','nolimit','offset','order','pick','filter','where','VIRTUAL','lower','merge','options','lodash','sequelize','keys','includes','parse','fields','filters','find','type','DATE','isPlainObject','$gte','utc','format','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray'];(function(_0x646b70,_0x53d1e8){var _0x3c921a=function(_0x3dbee3){while(--_0x3dbee3){_0x646b70['push'](_0x646b70['shift']());}};_0x3c921a(++_0x53d1e8);}(_0x4910,0x97));var _0x0491=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4910[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x0491('0x0'));var sequelize=require(_0x0491('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5da89f){var _0x19db4b=['ne'];try{var _0x321252=JSON['parse'](_0x5da89f);var _0x6fe30b=Object[_0x0491('0x2')](_0x321252)[0x0];return _0x19db4b[_0x0491('0x3')](_0x6fe30b);}catch(_0x15f590){return![];}}function getOperatorValue(_0x237e9d){var _0x16f3da=JSON[_0x0491('0x4')](_0x237e9d);var _0xad28f5=Object[_0x0491('0x2')](_0x16f3da)[0x0];var _0x4e6e74=_0x16f3da[_0xad28f5];return{['$'+_0xad28f5]:_0x4e6e74};}exports[_0x0491('0x5')]=function(_0x3e402d){var _0x1874a7=null;if(_0x3e402d){_0x1874a7=_0x3e402d['split'](',');}return _0x1874a7;};exports[_0x0491('0x6')]=function(_0x4c5bc0,_0x2a8198){var _0x17a3f1={};if(!_['isEmpty'](_0x4c5bc0)){_['forOwn'](_0x4c5bc0,function(_0x1470a4,_0x124190){try{if(_0x2a8198){var _0x1d43e8=_[_0x0491('0x7')](_0x2a8198,{'name':_0x124190})||{};if(hasSequelizeOperator(_0x1470a4)){_0x17a3f1[_0x124190]=getOperatorValue(_0x1470a4);}else if(_0x1d43e8[_0x0491('0x8')]===_0x0491('0x9')&&_[_0x0491('0xa')](_0x1470a4)){var _0x2dca79=JSON[_0x0491('0x4')](_0x1470a4);var _0x1ee6db={'$gte':moment(moment(_0x2dca79[_0x0491('0xb')])['format']('YYYY-MM-DD'))[_0x0491('0xc')]()[_0x0491('0xd')](),'$lte':moment(moment(_0x2dca79[_0x0491('0xe')])[_0x0491('0xd')](_0x0491('0xf')))[_0x0491('0xc')]()[_0x0491('0x10')](0x1,'s')['format']()};_0x17a3f1[_0x124190]=_0x1ee6db;}else if(_0x1d43e8[_0x0491('0x11')]===_0x0491('0x12')){_0x17a3f1[_0x124190]=_0x1470a4;}else{_0x17a3f1[_0x124190]=_[_0x0491('0x13')](_0x1470a4)?_0x1470a4:JSON[_0x0491('0x4')](_0x1470a4);}}else{_0x17a3f1[_0x124190]=_[_0x0491('0x13')](_0x1470a4)?_0x1470a4:JSON[_0x0491('0x4')](_0x1470a4);}}catch(_0x1e6564){_0x17a3f1[_0x124190]=_0x1470a4['split'](',');}});}return _0x17a3f1;};exports[_0x0491('0x14')]=function(_0x4d05a7){_0x4d05a7=parseInt(_0x4d05a7,0xa);if(!_0x4d05a7||_0x4d05a7<0x0){_0x4d05a7=LIMIT_VALUE;}return _0x4d05a7;};exports['offset']=function(_0x125b4c){_0x125b4c=parseInt(_0x125b4c,0xa);if(!_0x125b4c||_0x125b4c<0x0){_0x125b4c=0x0;}return _0x125b4c;};exports['sort']=function(_0x532a0f){var _0x337072,_0x37d045=null;if(_0x532a0f){_0x337072=_0x532a0f[_0x0491('0x15')](',');_0x37d045=_[_0x0491('0x16')](_0x337072,function(_0x1c7834){if(_0x1c7834[_0x0491('0x17')]('-')===0x0){return[_0x1c7834===_0x0491('0x18')?sequelize[_0x0491('0x19')](sequelize[_0x0491('0x1a')](_0x0491('0x18')),_0x0491('0x1b')):_0x1c7834[_0x0491('0x1c')](0x1),'DESC'];}else{return[_0x1c7834==='priority'?sequelize['cast'](sequelize['col'](_0x0491('0x18')),_0x0491('0x1b')):_0x1c7834,_0x0491('0x1d')];}});}return _0x37d045;};exports[_0x0491('0x1e')]=function(_0x3b846c,_0x2dd549){if(_[_0x0491('0x1f')](_0x3b846c)){return _0x3b846c;}if(_['isArray'](_0x3b846c)){for(var _0x4da3fe=0x0;_0x4da3fe<_0x3b846c['length'];_0x4da3fe+=0x1){_0x3b846c[_0x4da3fe]=this[_0x0491('0x1e')](_0x3b846c[_0x4da3fe],_0x2dd549);}return _0x3b846c;}if(!_[_0x0491('0x20')](_0x3b846c)){return _0x3b846c;}if(_[_0x0491('0x21')](_0x2dd549)){_0x2dd549=[_0x2dd549];}if(!_[_0x0491('0x13')](_0x2dd549)){return _0x3b846c;}for(var _0x258cce=0x0;_0x258cce<_0x2dd549[_0x0491('0x22')];_0x258cce+=0x1){_['unset'](_0x3b846c,_0x2dd549[_0x258cce]);}for(var _0x355177 in _0x3b846c){if(_0x3b846c[_0x0491('0x23')](_0x355177)){_0x3b846c[_0x355177]=this[_0x0491('0x1e')](_0x3b846c[_0x355177],_0x2dd549);}}return _0x3b846c;};exports['isNumeric']=function(_0x3c7de6){return _0x3c7de6[_0x0491('0x24')](RegExp(_0x0491('0x25')))?!![]:![];};exports[_0x0491('0x26')]=function(_0x4e2ef6){return _0x4e2ef6[_0x0491('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x0491('0x27')]=function(_0x159d53){var _0x49acc9=[];_0x159d53[_0x0491('0x15')](/[ ,]+/)[_0x0491('0x28')](function(_0x4e2dff){_0x4e2dff=_0x4e2dff[_0x0491('0x29')](/([^:]")"+/g,'$1');_0x4e2dff='+'+_0x4e2dff+'*';if(_0x4e2dff[_0x0491('0x3')]('@'))_0x4e2dff='\x22'+_0x4e2dff+'\x22';_0x49acc9['push'](_0x4e2dff);});return _0x49acc9['join']('\x20');};exports['getOptions']=function(_0x46404e,_0x19fe77,_0x5bec46){var _0x3d8a59={},_0x185953={};if(_0x19fe77[_0x0491('0x2a')][_0x0491('0x2b')]){_0x19fe77[_0x0491('0x2a')]['id']=_0x19fe77[_0x0491('0x2a')][_0x0491('0x2b')];delete _0x19fe77[_0x0491('0x2a')][_0x0491('0x2b')];}_0x3d8a59['model']=_[_0x0491('0x16')](_0x46404e,_0x0491('0x11'));_0x3d8a59[_0x0491('0x2a')]=_[_0x0491('0x2')](_0x19fe77[_0x0491('0x2a')]);_0x3d8a59[_0x0491('0x6')]=_['intersection'](_0x3d8a59[_0x0491('0x2c')],_0x3d8a59[_0x0491('0x2a')]);_0x185953[_0x0491('0x2d')]=_[_0x0491('0x2e')](_0x3d8a59[_0x0491('0x2c')],this[_0x0491('0x5')](_0x19fe77[_0x0491('0x2a')][_0x0491('0x5')]));_0x185953['attributes']=_0x185953[_0x0491('0x2d')][_0x0491('0x22')]?_0x185953[_0x0491('0x2d')]:_0x3d8a59[_0x0491('0x2c')];if(!_0x19fe77[_0x0491('0x2a')][_0x0491('0x23')](_0x0491('0x2f'))){_0x185953[_0x0491('0x14')]=this[_0x0491('0x14')](_0x19fe77[_0x0491('0x2a')]['limit']);_0x185953['offset']=this[_0x0491('0x30')](_0x19fe77[_0x0491('0x2a')][_0x0491('0x30')]);}_0x185953[_0x0491('0x31')]=this['sort'](_0x19fe77[_0x0491('0x2a')]['sort']);_0x185953['where']=this['filters'](_[_0x0491('0x32')](_0x19fe77['query'],_0x3d8a59[_0x0491('0x6')]),_0x46404e);if(_0x19fe77[_0x0491('0x2a')][_0x0491('0x33')]){_0x185953[_0x0491('0x34')]=_['merge'](_0x185953[_0x0491('0x34')],{'$or':_[_0x0491('0x16')](_0x46404e,function(_0x380432){if(_0x380432['type']!==_0x0491('0x35')){if(_0x5bec46){return sequelize['where'](sequelize['fn'](_0x0491('0x36'),sequelize[_0x0491('0x1a')](_0x380432[_0x0491('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x19fe77[_0x0491('0x2a')]['filter']+'%')});}else{var _0x1e7347={};_0x1e7347[_0x380432[_0x0491('0x11')]]={'$like':'%'+_0x19fe77['query'][_0x0491('0x33')]+'%'};return _0x1e7347;}}})});}_0x185953=_[_0x0491('0x37')]({},_0x185953,_0x19fe77[_0x0491('0x38')]);return _0x185953;}; \ No newline at end of file +var _0x0671=['unsigned','substr','priority','omit','isEmpty','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','includes','query','$id','model','filters','intersection','fields','attributes','nolimit','offset','order','where','pick','filter','lower','merge','options','lodash','sequelize','moment','parse','keys','split','forOwn','type','DATE','isPlainObject','$gte','format','$lte','name','uniqueid','isArray','limit','sort','map','indexOf','cast','col'];(function(_0x122fe6,_0x4ac758){var _0x36b7d2=function(_0x12fca2){while(--_0x12fca2){_0x122fe6['push'](_0x122fe6['shift']());}};_0x36b7d2(++_0x4ac758);}(_0x0671,0xc6));var _0x1067=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x0671[_0x490be3];return _0x3f5140;};'use strict';var _=require(_0x1067('0x0'));var sequelize=require(_0x1067('0x1'));var moment=require(_0x1067('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x204d6f){var _0x32714d=['ne'];try{var _0xb6cc3a=JSON[_0x1067('0x3')](_0x204d6f);var _0x4bc940=Object[_0x1067('0x4')](_0xb6cc3a)[0x0];return _0x32714d['includes'](_0x4bc940);}catch(_0x30ad86){return![];}}function getOperatorValue(_0x146409){var _0x36e29e=JSON[_0x1067('0x3')](_0x146409);var _0x12bb5b=Object[_0x1067('0x4')](_0x36e29e)[0x0];var _0x511117=_0x36e29e[_0x12bb5b];return{['$'+_0x12bb5b]:_0x511117};}exports['fields']=function(_0x3c9a5b){var _0x1721f5=null;if(_0x3c9a5b){_0x1721f5=_0x3c9a5b[_0x1067('0x5')](',');}return _0x1721f5;};exports['filters']=function(_0x14e5fc,_0xd06bb1){var _0x2963a8={};if(!_['isEmpty'](_0x14e5fc)){_[_0x1067('0x6')](_0x14e5fc,function(_0x599e87,_0x111f3a){try{if(_0xd06bb1){var _0x415a6a=_['find'](_0xd06bb1,{'name':_0x111f3a})||{};if(hasSequelizeOperator(_0x599e87)){_0x2963a8[_0x111f3a]=getOperatorValue(_0x599e87);}else if(_0x415a6a[_0x1067('0x7')]===_0x1067('0x8')&&_[_0x1067('0x9')](_0x599e87)){var _0x4edb7e=JSON[_0x1067('0x3')](_0x599e87);var _0x3f291d={'$gte':moment(moment(_0x4edb7e[_0x1067('0xa')])[_0x1067('0xb')]('YYYY-MM-DD'))['utc']()[_0x1067('0xb')](),'$lte':moment(moment(_0x4edb7e[_0x1067('0xc')])[_0x1067('0xb')]('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0x1067('0xb')]()};_0x2963a8[_0x111f3a]=_0x3f291d;}else if(_0x415a6a[_0x1067('0xd')]===_0x1067('0xe')){_0x2963a8[_0x111f3a]=_0x599e87;}else{_0x2963a8[_0x111f3a]=_[_0x1067('0xf')](_0x599e87)?_0x599e87:JSON[_0x1067('0x3')](_0x599e87);}}else{_0x2963a8[_0x111f3a]=_[_0x1067('0xf')](_0x599e87)?_0x599e87:JSON[_0x1067('0x3')](_0x599e87);}}catch(_0x152e92){_0x2963a8[_0x111f3a]=_0x599e87[_0x1067('0x5')](',');}});}return _0x2963a8;};exports[_0x1067('0x10')]=function(_0x9d5312){_0x9d5312=parseInt(_0x9d5312,0xa);if(!_0x9d5312||_0x9d5312<0x0){_0x9d5312=LIMIT_VALUE;}return _0x9d5312;};exports['offset']=function(_0x40a350){_0x40a350=parseInt(_0x40a350,0xa);if(!_0x40a350||_0x40a350<0x0){_0x40a350=0x0;}return _0x40a350;};exports[_0x1067('0x11')]=function(_0xbac774){var _0x3f2d9e,_0x20b523=null;if(_0xbac774){_0x3f2d9e=_0xbac774[_0x1067('0x5')](',');_0x20b523=_[_0x1067('0x12')](_0x3f2d9e,function(_0x386ace){if(_0x386ace[_0x1067('0x13')]('-')===0x0){return[_0x386ace==='priority'?sequelize[_0x1067('0x14')](sequelize[_0x1067('0x15')]('priority'),_0x1067('0x16')):_0x386ace[_0x1067('0x17')](0x1),'DESC'];}else{return[_0x386ace===_0x1067('0x18')?sequelize[_0x1067('0x14')](sequelize[_0x1067('0x15')](_0x1067('0x18')),'unsigned'):_0x386ace,'ASC'];}});}return _0x20b523;};exports[_0x1067('0x19')]=function(_0x51972a,_0x1639d7){if(_[_0x1067('0x1a')](_0x51972a)){return _0x51972a;}if(_[_0x1067('0xf')](_0x51972a)){for(var _0x1df9d2=0x0;_0x1df9d2<_0x51972a[_0x1067('0x1b')];_0x1df9d2+=0x1){_0x51972a[_0x1df9d2]=this[_0x1067('0x19')](_0x51972a[_0x1df9d2],_0x1639d7);}return _0x51972a;}if(!_[_0x1067('0x1c')](_0x51972a)){return _0x51972a;}if(_[_0x1067('0x1d')](_0x1639d7)){_0x1639d7=[_0x1639d7];}if(!_['isArray'](_0x1639d7)){return _0x51972a;}for(var _0x5af9c5=0x0;_0x5af9c5<_0x1639d7['length'];_0x5af9c5+=0x1){_[_0x1067('0x1e')](_0x51972a,_0x1639d7[_0x5af9c5]);}for(var _0x167808 in _0x51972a){if(_0x51972a[_0x1067('0x1f')](_0x167808)){_0x51972a[_0x167808]=this['omit'](_0x51972a[_0x167808],_0x1639d7);}}return _0x51972a;};exports[_0x1067('0x20')]=function(_0x31099b){return _0x31099b[_0x1067('0x21')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x1067('0x22')]=function(_0xde7203){return _0xde7203[_0x1067('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x1067('0x23')]=function(_0x5e11f8){var _0xa56003=[];_0x5e11f8[_0x1067('0x5')](/[ ,]+/)[_0x1067('0x24')](function(_0x479670){_0x479670=_0x479670[_0x1067('0x25')](/([^:]")"+/g,'$1');_0x479670='+'+_0x479670+'*';if(_0x479670[_0x1067('0x26')]('@'))_0x479670='\x22'+_0x479670+'\x22';_0xa56003['push'](_0x479670);});return _0xa56003['join']('\x20');};exports['getOptions']=function(_0x15754e,_0x1eb009,_0x547895){var _0x3316d9={},_0x37e959={};if(_0x1eb009[_0x1067('0x27')]['$id']){_0x1eb009[_0x1067('0x27')]['id']=_0x1eb009[_0x1067('0x27')][_0x1067('0x28')];delete _0x1eb009['query'][_0x1067('0x28')];}_0x3316d9[_0x1067('0x29')]=_['map'](_0x15754e,'name');_0x3316d9['query']=_[_0x1067('0x4')](_0x1eb009['query']);_0x3316d9[_0x1067('0x2a')]=_[_0x1067('0x2b')](_0x3316d9[_0x1067('0x29')],_0x3316d9[_0x1067('0x27')]);_0x37e959['attributes']=_[_0x1067('0x2b')](_0x3316d9[_0x1067('0x29')],this[_0x1067('0x2c')](_0x1eb009[_0x1067('0x27')][_0x1067('0x2c')]));_0x37e959['attributes']=_0x37e959[_0x1067('0x2d')][_0x1067('0x1b')]?_0x37e959[_0x1067('0x2d')]:_0x3316d9[_0x1067('0x29')];if(!_0x1eb009[_0x1067('0x27')][_0x1067('0x1f')](_0x1067('0x2e'))){_0x37e959[_0x1067('0x10')]=this[_0x1067('0x10')](_0x1eb009['query'][_0x1067('0x10')]);_0x37e959[_0x1067('0x2f')]=this[_0x1067('0x2f')](_0x1eb009[_0x1067('0x27')][_0x1067('0x2f')]);}_0x37e959[_0x1067('0x30')]=this['sort'](_0x1eb009['query'][_0x1067('0x11')]);_0x37e959[_0x1067('0x31')]=this[_0x1067('0x2a')](_[_0x1067('0x32')](_0x1eb009[_0x1067('0x27')],_0x3316d9[_0x1067('0x2a')]),_0x15754e);if(_0x1eb009[_0x1067('0x27')][_0x1067('0x33')]){_0x37e959[_0x1067('0x31')]=_['merge'](_0x37e959[_0x1067('0x31')],{'$or':_['map'](_0x15754e,function(_0x2ab516){if(_0x2ab516[_0x1067('0x7')]!=='VIRTUAL'){if(_0x547895){return sequelize['where'](sequelize['fn']('lower',sequelize['col'](_0x2ab516[_0x1067('0xd')])),{'$like':sequelize['fn'](_0x1067('0x34'),'%'+_0x1eb009[_0x1067('0x27')]['filter']+'%')});}else{var _0x5def85={};_0x5def85[_0x2ab516[_0x1067('0xd')]]={'$like':'%'+_0x1eb009[_0x1067('0x27')][_0x1067('0x33')]+'%'};return _0x5def85;}}})});}_0x37e959=_[_0x1067('0x35')]({},_0x37e959,_0x1eb009[_0x1067('0x36')]);return _0x37e959;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6143e8e..c245d01 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ba8=['serve-favicon','body-parser','cookie-parser','errorhandler','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','public','client','use','json\x20replacer','split','views','engine','html','renderFile','view\x20engine','urlencoded','json','50mb','initialize','express'];(function(_0x32fdc0,_0x261cf3){var _0x15edda=function(_0x150e05){while(--_0x150e05){_0x32fdc0['push'](_0x32fdc0['shift']());}};_0x15edda(++_0x261cf3);}(_0x8ba8,0x192));var _0x88ba=function(_0x1537f1,_0x562bf5){_0x1537f1=_0x1537f1-0x0;var _0xe4452=_0x8ba8[_0x1537f1];return _0xe4452;};'use strict';var express=require(_0x88ba('0x0'));var favicon=require(_0x88ba('0x1'));var bodyParser=require(_0x88ba('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x88ba('0x3'));var errorHandler=require(_0x88ba('0x4'));var path=require('path');var passport=require('passport');var cors=require(_0x88ba('0x5'));var moment=require(_0x88ba('0x6'));var config=require(_0x88ba('0x7'));var db=require(_0x88ba('0x8'))['db'];exports[_0x88ba('0x9')]=function(_0x458c1a){var _0x2d07d6=_0x458c1a[_0x88ba('0xa')](_0x88ba('0xb'));if(_0x2d07d6===_0x88ba('0xc')){_0x458c1a[_0x88ba('0xd')](_0x88ba('0xe'),path[_0x88ba('0xf')](config[_0x88ba('0x10')],_0x88ba('0x11')));}if(_0x2d07d6==='development'||_0x2d07d6==='test'){_0x458c1a[_0x88ba('0xd')]('appPath',path[_0x88ba('0xf')](config[_0x88ba('0x10')],_0x88ba('0x12')));_0x458c1a[_0x88ba('0x13')](errorHandler());}_0x458c1a[_0x88ba('0xd')](_0x88ba('0x14'),function(_0x5bdf17,_0x1e5164){if(this[_0x5bdf17]instanceof Date){_0x1e5164=this[_0x5bdf17]['toISOString']()[_0x88ba('0x15')]('.')[0x0]+'Z';}return _0x1e5164;});_0x458c1a[_0x88ba('0x13')](express['static'](_0x458c1a[_0x88ba('0xa')](_0x88ba('0xe'))));_0x458c1a['set'](_0x88ba('0x16'),config[_0x88ba('0x10')]+'/server/views');_0x458c1a[_0x88ba('0x17')](_0x88ba('0x18'),require('ejs')[_0x88ba('0x19')]);_0x458c1a[_0x88ba('0xd')](_0x88ba('0x1a'),_0x88ba('0x18'));_0x458c1a['use'](bodyParser[_0x88ba('0x1b')]({'limit':'50mb','extended':!![]}));_0x458c1a[_0x88ba('0x13')](bodyParser[_0x88ba('0x1c')]({'limit':_0x88ba('0x1d')}));_0x458c1a[_0x88ba('0x13')](cors());_0x458c1a[_0x88ba('0x13')](methodOverride());_0x458c1a['use'](cookieParser());_0x458c1a['use'](passport[_0x88ba('0x1e')]());}; \ No newline at end of file +var _0x4998=['test','set','root','client','use','json\x20replacer','split','static','appPath','views','engine','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','moment','./environment','../mysqldb','default','get','env','production','join'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0x4998,0x91));var _0x8499=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x4998[_0x5e9a69];return _0x5979c8;};'use strict';var express=require(_0x8499('0x0'));var favicon=require(_0x8499('0x1'));var bodyParser=require(_0x8499('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x8499('0x3'));var errorHandler=require(_0x8499('0x4'));var path=require(_0x8499('0x5'));var passport=require(_0x8499('0x6'));var cors=require('cors');var moment=require(_0x8499('0x7'));var config=require(_0x8499('0x8'));var db=require(_0x8499('0x9'))['db'];exports[_0x8499('0xa')]=function(_0x4269d7){var _0x2f7a9b=_0x4269d7[_0x8499('0xb')](_0x8499('0xc'));if(_0x2f7a9b===_0x8499('0xd')){_0x4269d7['set']('appPath',path[_0x8499('0xe')](config['root'],'public'));}if(_0x2f7a9b==='development'||_0x2f7a9b===_0x8499('0xf')){_0x4269d7[_0x8499('0x10')]('appPath',path['join'](config[_0x8499('0x11')],_0x8499('0x12')));_0x4269d7[_0x8499('0x13')](errorHandler());}_0x4269d7[_0x8499('0x10')](_0x8499('0x14'),function(_0x4cc593,_0x2f7b7d){if(this[_0x4cc593]instanceof Date){_0x2f7b7d=this[_0x4cc593]['toISOString']()[_0x8499('0x15')]('.')[0x0]+'Z';}return _0x2f7b7d;});_0x4269d7['use'](express[_0x8499('0x16')](_0x4269d7[_0x8499('0xb')](_0x8499('0x17'))));_0x4269d7[_0x8499('0x10')](_0x8499('0x18'),config[_0x8499('0x11')]+'/server/views');_0x4269d7[_0x8499('0x19')]('html',require('ejs')[_0x8499('0x1a')]);_0x4269d7[_0x8499('0x10')](_0x8499('0x1b'),'html');_0x4269d7[_0x8499('0x13')](bodyParser[_0x8499('0x1c')]({'limit':_0x8499('0x1d'),'extended':!![]}));_0x4269d7[_0x8499('0x13')](bodyParser[_0x8499('0x1e')]({'limit':'50mb'}));_0x4269d7[_0x8499('0x13')](cors());_0x4269d7[_0x8499('0x13')](methodOverride());_0x4269d7['use'](cookieParser());_0x4269d7['use'](passport[_0x8499('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index cc1f6f5..28b5110 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 _0xfd51=['substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','internal','head','mac','address','cpus','map','model','createHash','md5','update','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress','digest'];(function(_0x35ed69,_0x1b09f2){var _0x1d53bb=function(_0x22a13f){while(--_0x22a13f){_0x35ed69['push'](_0x35ed69['shift']());}};_0x1d53bb(++_0x1b09f2);}(_0xfd51,0x118));var _0x1fd5=function(_0x141a86,_0x343c1a){_0x141a86=_0x141a86-0x0;var _0x306338=_0xfd51[_0x141a86];return _0x306338;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x1fd5('0x0'));var machine=require(_0x1fd5('0x1'));var exec=require(_0x1fd5('0x2'))[_0x1fd5('0x3')];var config=require(_0x1fd5('0x4'));function getInterfaces(){var _0x4884a7=[];var _0x56fd07=os[_0x1fd5('0x5')]();var _0x2f85d5=_[_0x1fd5('0x6')](_['keys'](_0x56fd07));for(var _0x124af0=0x0;_0x124af0<_0x2f85d5[_0x1fd5('0x7')];_0x124af0++){var _0x3aa6dd=_0x56fd07[_0x2f85d5[_0x124af0]][_0x1fd5('0x8')](function(_0x1b6e04){return _0x1b6e04[_0x1fd5('0x9')]==='IPv4'&&_0x1b6e04[_0x1fd5('0xa')]===![];});_0x4884a7=_0x4884a7['concat'](_0x3aa6dd);}return _0x4884a7;}function getFirstInterface(){var _0x439711=_[_0x1fd5('0xb')](getInterfaces());return{'macAddress':_0x439711&&_0x439711[_0x1fd5('0xc')]?_0x439711[_0x1fd5('0xc')]:'00:00:00:00:00:00','ipAddress':_0x439711&&_0x439711[_0x1fd5('0xd')]?_0x439711[_0x1fd5('0xd')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xb08d95=_[_0x1fd5('0x6')](os[_0x1fd5('0xe')]()[_0x1fd5('0xf')](function(_0x175c65){return _0x175c65[_0x1fd5('0x10')];}))['join'](':');return crypto[_0x1fd5('0x11')](_0x1fd5('0x12'))[_0x1fd5('0x13')](_0xb08d95)['digest'](_0x1fd5('0x14'));}exports[_0x1fd5('0x15')]=function(){var _0x141722=os[_0x1fd5('0x16')]();var _0x45cf0f=/[0-9a-f-]{36}/;if(config[_0x1fd5('0x17')]&&_0x45cf0f['test'](config[_0x1fd5('0x17')])){return config[_0x1fd5('0x17')];}else if(_0x141722===_0x1fd5('0x18')){return exec(_0x1fd5('0x19'),{'encoding':'utf8'})[_0x1fd5('0x1a')]('\x0d\x0a','');}else{var _0x443019=getFirstInterface();var _0x2a7060=getCPUhash();var _0x248c16=_0x2a7060+'|'+os['hostname']()+'|'+_0x443019[_0x1fd5('0x1b')]+'|'+_0x443019[_0x1fd5('0x1c')];var _0x510da4=crypto['createHash'](_0x1fd5('0x12'))[_0x1fd5('0x13')](_0x248c16)[_0x1fd5('0x1d')](_0x1fd5('0x14'));return _0x510da4[_0x1fd5('0x1e')](0x0,0x8)+'-'+_0x510da4[_0x1fd5('0x1e')](0x8,0xc)+'-'+_0x510da4[_0x1fd5('0x1e')](0xc,0x10)+'-'+_0x510da4[_0x1fd5('0x1e')](0x10,0x14)+'-'+_0x510da4[_0x1fd5('0x1e')](0x14);}}; \ No newline at end of file +var _0x49a0=['substring','lodash','crypto','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','model','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x49a0,0xe1));var _0x049a=function(_0x2587ca,_0x231303){_0x2587ca=_0x2587ca-0x0;var _0x5aada1=_0x49a0[_0x2587ca];return _0x5aada1;};'use strict';var _=require(_0x049a('0x0'));var os=require('os');var crypto=require(_0x049a('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x049a('0x2')];var config=require(_0x049a('0x3'));function getInterfaces(){var _0x41b014=[];var _0x4e2a75=os[_0x049a('0x4')]();var _0x125ff6=_[_0x049a('0x5')](_[_0x049a('0x6')](_0x4e2a75));for(var _0x22d61d=0x0;_0x22d61d<_0x125ff6[_0x049a('0x7')];_0x22d61d++){var _0x120be4=_0x4e2a75[_0x125ff6[_0x22d61d]][_0x049a('0x8')](function(_0x46d8a5){return _0x46d8a5[_0x049a('0x9')]===_0x049a('0xa')&&_0x46d8a5['internal']===![];});_0x41b014=_0x41b014[_0x049a('0xb')](_0x120be4);}return _0x41b014;}function getFirstInterface(){var _0x294ee2=_[_0x049a('0xc')](getInterfaces());return{'macAddress':_0x294ee2&&_0x294ee2[_0x049a('0xd')]?_0x294ee2['mac']:_0x049a('0xe'),'ipAddress':_0x294ee2&&_0x294ee2[_0x049a('0xf')]?_0x294ee2['address']:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x67f048=_[_0x049a('0x5')](os['cpus']()['map'](function(_0x2c817a){return _0x2c817a[_0x049a('0x10')];}))['join'](':');return crypto[_0x049a('0x11')](_0x049a('0x12'))[_0x049a('0x13')](_0x67f048)[_0x049a('0x14')](_0x049a('0x15'));}exports[_0x049a('0x16')]=function(){var _0x1ee2cc=os[_0x049a('0x17')]();var _0x234e0a=/[0-9a-f-]{36}/;if(config[_0x049a('0x18')]&&_0x234e0a[_0x049a('0x19')](config[_0x049a('0x18')])){return config[_0x049a('0x18')];}else if(_0x1ee2cc===_0x049a('0x1a')){return exec(_0x049a('0x1b'),{'encoding':_0x049a('0x1c')})[_0x049a('0x1d')]('\x0d\x0a','');}else{var _0x4dfc3b=getFirstInterface();var _0x154074=getCPUhash();var _0x25d478=_0x154074+'|'+os['hostname']()+'|'+_0x4dfc3b[_0x049a('0x1e')]+'|'+_0x4dfc3b['ipAddress'];var _0x18931b=crypto[_0x049a('0x11')](_0x049a('0x12'))[_0x049a('0x13')](_0x25d478)['digest']('hex');return _0x18931b[_0x049a('0x1f')](0x0,0x8)+'-'+_0x18931b[_0x049a('0x1f')](0x8,0xc)+'-'+_0x18931b['substring'](0xc,0x10)+'-'+_0x18931b['substring'](0x10,0x14)+'-'+_0x18931b[_0x049a('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9fd9bf2..ae67b5e 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 _0x4b25=['YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','error','message','finally','getUuid','License','spread','default','moment','request-promise','bluebird','pkginfo','version','../logger','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0x1b3224,_0x3351d9){var _0x5dae4f=function(_0x22894a){while(--_0x22894a){_0x1b3224['push'](_0x1b3224['shift']());}};_0x5dae4f(++_0x3351d9);}(_0x4b25,0x13b));var _0x54b2=function(_0x4a3f67,_0x346a43){_0x4a3f67=_0x4a3f67-0x0;var _0x3874ee=_0x4b25[_0x4a3f67];return _0x3874ee;};'use strict';var util=require('util');var moment=require(_0x54b2('0x0'));var rp=require(_0x54b2('0x1'));var BPromise=require(_0x54b2('0x2'));var pkginfo=require(_0x54b2('0x3'))(module,_0x54b2('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x54b2('0x5'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1db335){return new BPromise(function(_0x5e6196,_0x3f0bf5){var _0x581880=util[_0x54b2('0x6')](_0x54b2('0x7'),HOST,_0x1db335,module[_0x54b2('0x8')][_0x54b2('0x4')]);if(oldToken){_0x581880=util[_0x54b2('0x6')](_0x54b2('0x9'),HOST,_0x1db335,module[_0x54b2('0x8')][_0x54b2('0x4')],oldToken);}var _0x9fd3d2={'uri':_0x581880,'method':_0x54b2('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x9fd3d2)[_0x54b2('0xb')](function(_0x1a5d46){_0x5e6196(_0x1a5d46);})[_0x54b2('0xc')](function(_0x2200c3){_0x3f0bf5(_0x2200c3);});});}function manageLicense(_0x3bc1e2,_0x221b9){var _0x2e8e77=_0x221b9[_0x54b2('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x2e8e77[_0x54b2('0xe')]!==_0x3bc1e2&&!_0x2e8e77[_0x54b2('0xf')]){oldToken=_0x2e8e77['data1'];}httpRequest(_0x3bc1e2)['then'](function(_0x442e02){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x442e02['active']){isOldTokenSent=![];if(!_0x2e8e77[_0x54b2('0x10')]&&_0x2e8e77[_0x54b2('0x10')]!=_0x442e02[_0x54b2('0x10')]||_0x2e8e77[_0x54b2('0x10')]&&_0x2e8e77['data2']){logger['info'](_0x54b2('0x11'));}if(_0x2e8e77['license']&&!_0x2e8e77['data2']&&_0x2e8e77[_0x54b2('0x10')]!=_0x442e02[_0x54b2('0x10')]){logger[_0x54b2('0x12')](_0x54b2('0x13'));}if(_0x2e8e77[_0x54b2('0x10')]&&!_0x2e8e77['data2']&&_0x2e8e77[_0x54b2('0x10')]==_0x442e02[_0x54b2('0x10')]){return _0x221b9;}return _0x221b9[_0x54b2('0x14')]({'data1':_0x3bc1e2,'data2':null,'license':_0x442e02[_0x54b2('0x10')]});}else{if(_0x442e02[_0x54b2('0x10')]||_0x2e8e77['license']){if(!_0x2e8e77['data2']){if(_0x2e8e77['data1']==_0x3bc1e2){GRAY_PERIOD_REASON=_0x54b2('0x15');logger[_0x54b2('0x12')](_0x54b2('0x16'));}else{GRAY_PERIOD_REASON=_0x54b2('0x17');logger[_0x54b2('0x12')](_0x54b2('0x18'),_0x2e8e77['data1'],_0x3bc1e2);}logger[_0x54b2('0x12')](_0x54b2('0x19'),GRAY_PERIOD_REASON[_0x54b2('0x1a')](),moment()['format'](_0x54b2('0x1b')));return _0x221b9['update']({'data2':encryptor[_0x54b2('0x1c')](moment()[_0x54b2('0x6')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x54b2('0x1d')](_0x2e8e77[_0x54b2('0xf')]),_0x54b2('0x1e'))>DAYS){logger[_0x54b2('0x12')]('DEMO\x20START\x20AT\x20%s',moment()[_0x54b2('0x6')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x221b9[_0x54b2('0x14')]({'data1':_0x3bc1e2,'data2':null,'license':null});}}}else{if(_0x2e8e77[_0x54b2('0xe')]!=_0x3bc1e2){logger[_0x54b2('0x12')](_0x54b2('0x18'),_0x2e8e77[_0x54b2('0xe')],_0x3bc1e2);return _0x221b9['update']({'data1':_0x3bc1e2,'data2':null,'license':null});}}}return _0x221b9;})[_0x54b2('0xb')](function(_0x2b83b3){_0x221b9=_0x2b83b3;})['catch'](function(_0x2c5074){logger[_0x54b2('0x1f')](_0x2c5074[_0x54b2('0x20')]);})[_0x54b2('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x221b9);},TIME);});}function defaultLicense(){var _0x75f3f3=hardware[_0x54b2('0x22')]();if(_0x75f3f3){return db[_0x54b2('0x23')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x75f3f3}})[_0x54b2('0x24')](function(_0xf3be84,_0x27304c){logger[_0x54b2('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x75f3f3);manageLicense(_0x75f3f3,_0xf3be84);})[_0x54b2('0xc')](function(_0xa06e6d){logger[_0x54b2('0x1f')](_0xa06e6d[_0x54b2('0x20')]);});}}exports[_0x54b2('0x25')]=defaultLicense; \ No newline at end of file +var _0x983a=['update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x1c1fe4,_0x389a69){var _0x52ef36=function(_0x15a595){while(--_0x15a595){_0x1c1fe4['push'](_0x1c1fe4['shift']());}};_0x52ef36(++_0x389a69);}(_0x983a,0xbf));var _0xa983=function(_0x418625,_0x417f64){_0x418625=_0x418625-0x0;var _0x56fd79=_0x983a[_0x418625];return _0x56fd79;};'use strict';var util=require(_0xa983('0x0'));var moment=require(_0xa983('0x1'));var rp=require(_0xa983('0x2'));var BPromise=require(_0xa983('0x3'));var pkginfo=require('pkginfo')(module,_0xa983('0x4'));var db=require(_0xa983('0x5'))['db'];var encryptor=require(_0xa983('0x6'));var hardware=require(_0xa983('0x7'));var logger=require('../logger')(_0xa983('0x8'));var HOST=_0xa983('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3236ac){return new BPromise(function(_0x22c708,_0x576425){var _0x1fa68e=util[_0xa983('0xa')](_0xa983('0xb'),HOST,_0x3236ac,module[_0xa983('0xc')]['version']);if(oldToken){_0x1fa68e=util[_0xa983('0xa')](_0xa983('0xd'),HOST,_0x3236ac,module['exports'][_0xa983('0x4')],oldToken);}var _0xd6d731={'uri':_0x1fa68e,'method':_0xa983('0xe'),'timeout':0xea60,'json':!![]};return rp(_0xd6d731)['then'](function(_0x514976){_0x22c708(_0x514976);})[_0xa983('0xf')](function(_0x5803b1){_0x576425(_0x5803b1);});});}function manageLicense(_0x45c8dd,_0x3595d4){var _0x4fbcad=_0x3595d4[_0xa983('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x4fbcad[_0xa983('0x11')]!==_0x45c8dd&&!_0x4fbcad[_0xa983('0x12')]){oldToken=_0x4fbcad[_0xa983('0x11')];}httpRequest(_0x45c8dd)[_0xa983('0x13')](function(_0x481a2f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x481a2f[_0xa983('0x14')]){isOldTokenSent=![];if(!_0x4fbcad[_0xa983('0x8')]&&_0x4fbcad[_0xa983('0x8')]!=_0x481a2f[_0xa983('0x8')]||_0x4fbcad[_0xa983('0x8')]&&_0x4fbcad['data2']){logger[_0xa983('0x15')](_0xa983('0x16'));}if(_0x4fbcad[_0xa983('0x8')]&&!_0x4fbcad[_0xa983('0x12')]&&_0x4fbcad[_0xa983('0x8')]!=_0x481a2f[_0xa983('0x8')]){logger[_0xa983('0x15')](_0xa983('0x17'));}if(_0x4fbcad[_0xa983('0x8')]&&!_0x4fbcad[_0xa983('0x12')]&&_0x4fbcad[_0xa983('0x8')]==_0x481a2f['license']){return _0x3595d4;}return _0x3595d4[_0xa983('0x18')]({'data1':_0x45c8dd,'data2':null,'license':_0x481a2f[_0xa983('0x8')]});}else{if(_0x481a2f['license']||_0x4fbcad[_0xa983('0x8')]){if(!_0x4fbcad['data2']){if(_0x4fbcad['data1']==_0x45c8dd){GRAY_PERIOD_REASON=_0xa983('0x19');logger[_0xa983('0x15')](_0xa983('0x1a'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xa983('0x15')](_0xa983('0x1b'),_0x4fbcad[_0xa983('0x11')],_0x45c8dd);}logger[_0xa983('0x15')](_0xa983('0x1c'),GRAY_PERIOD_REASON[_0xa983('0x1d')](),moment()[_0xa983('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x3595d4[_0xa983('0x18')]({'data2':encryptor['encryptString'](moment()[_0xa983('0xa')](_0xa983('0x1e')))});}else{if(moment()[_0xa983('0x1f')](encryptor[_0xa983('0x20')](_0x4fbcad[_0xa983('0x12')]),'days')>DAYS){logger[_0xa983('0x15')](_0xa983('0x21'),moment()['format'](_0xa983('0x1e')));isOldTokenSent=![];return _0x3595d4['update']({'data1':_0x45c8dd,'data2':null,'license':null});}}}else{if(_0x4fbcad[_0xa983('0x11')]!=_0x45c8dd){logger[_0xa983('0x15')](_0xa983('0x1b'),_0x4fbcad[_0xa983('0x11')],_0x45c8dd);return _0x3595d4[_0xa983('0x18')]({'data1':_0x45c8dd,'data2':null,'license':null});}}}return _0x3595d4;})['then'](function(_0x569409){_0x3595d4=_0x569409;})['catch'](function(_0x40ce01){logger['error'](_0x40ce01[_0xa983('0x22')]);})[_0xa983('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xa983('0x24')](),_0x3595d4);},TIME);});}function defaultLicense(){var _0x3012fa=hardware[_0xa983('0x24')]();if(_0x3012fa){return db[_0xa983('0x25')][_0xa983('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x3012fa}})[_0xa983('0x27')](function(_0x246802,_0x1d6ee7){logger[_0xa983('0x15')](_0xa983('0x28'),_0x3012fa);manageLicense(_0x3012fa,_0x246802);})[_0xa983('0xf')](function(_0x2e8de1){logger[_0xa983('0x29')](_0x2e8de1[_0xa983('0x22')]);});}}exports[_0xa983('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3151d56..0d258fd 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 _0x4289=['forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','grayReason','machineUuid','disabled','message','User','findAll','sequelize','COUNT','col','role','count','admin','user','telephone','users','telephones'];(function(_0x47235c,_0x3190fc){var _0x43efc6=function(_0x385c70){while(--_0x385c70){_0x47235c['push'](_0x47235c['shift']());}};_0x43efc6(++_0x3190fc);}(_0x4289,0x15e));var _0x9428=function(_0x22eb6d,_0xe01b3){_0x22eb6d=_0x22eb6d-0x0;var _0x41ca31=_0x4289[_0x22eb6d];return _0x41ca31;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9428('0x0'));var BPromise=require(_0x9428('0x1'));var hardware=require(_0x9428('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x9428('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9428('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9428('0x5'),'machineUuid':hardware[_0x9428('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x248d20){return new BPromise(function(_0x5bba24,_0x58567e){return db[_0x9428('0x7')]['find'](_[_0x9428('0x8')](_0x248d20,{'raw':!![],'where':{'id':0x1}}))[_0x9428('0x9')](function(_0x52cd43){return checkLicense(_0x52cd43,null);})[_0x9428('0x9')](function(_0x346fe2){_0x5bba24(_0x346fe2);return;})[_0x9428('0xa')](function(_0x5a401c){_0x58567e(_0x5a401c);});});}function checkLicense(_0x408bab,_0x4174c6){if(!_0x408bab){demoLicense[_0x9428('0xb')]=_0x408bab[_0x9428('0xc')];return demoLicense;}try{var _0x36ba85=_0x4174c6||_0x408bab['license'];if(_[_0x9428('0xd')](_0x36ba85)){throw new Error(_0x9428('0xe'));}var _0x1a12c7=_0x408bab['data1'];var _0xf99a41=_0x408bab['data2'];var _0x1d53d3=_0x1a12c7['split']('-')[0x4];var _0x2feed8=_0x1a12c7[_0x9428('0xf')]('-')[0x0];var _0x52e1d8=encryptor[_0x9428('0x10')](_0x36ba85,util[_0x9428('0x11')](_0x9428('0x12'),_0x1d53d3,_0x1a12c7,_0x2feed8));var _0x218bb2=JSON[_0x9428('0x13')](_0x52e1d8);_0x218bb2[_0x9428('0x14')]=![];_0x218bb2[_0x9428('0xb')]=_0x1a12c7;_0x218bb2['machineUuid']=hardware['getUuid']();if(_0xf99a41){var _0x5cfcff=encryptor['decryptString'](_0xf99a41);_0x218bb2['gray']=_0x5cfcff;_0x218bb2['deadline']=moment(_0x5cfcff)['add'](0x7,'days')[_0x9428('0x11')]();_0x218bb2[_0x9428('0x15')]=_0x218bb2[_0x9428('0xb')]!=_0x218bb2[_0x9428('0x16')]?'changed':_0x9428('0x17');}return _0x218bb2;}catch(_0x3a0919){breakingLicense[_0x9428('0xb')]=_0x408bab[_0x9428('0xc')];breakingLicense[_0x9428('0x18')]=_0x3a0919['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2c3620,_0x1622b0){getLicense()[_0x9428('0x9')](function(_0x314980){return db[_0x9428('0x19')][_0x9428('0x1a')]({'attributes':['role',[db[_0x9428('0x1b')]['fn'](_0x9428('0x1c'),db['sequelize'][_0x9428('0x1d')](_0x9428('0x1e'))),_0x9428('0x1f')]],'group':'role','where':{'role':{'$or':[_0x9428('0x20'),_0x9428('0x21'),_0x9428('0x22')]}},'raw':!![]})[_0x9428('0x9')](function(_0x2997c5){var _0x42b17d={'user':_0x314980[_0x9428('0x23')]||0x0,'telephone':_0x314980[_0x9428('0x24')]||0x0};_0x2997c5[_0x9428('0x25')](function(_0x1bdfaa){var _0x2f2391=_0x1bdfaa[_0x9428('0x1e')]===_0x9428('0x20')?_0x9428('0x21'):_0x1bdfaa[_0x9428('0x1e')];_0x42b17d[_0x2f2391]-=_0x1bdfaa[_0x9428('0x1f')];if(_0x42b17d[_0x2f2391]<0x0)_0x42b17d[_0x2f2391]=0x0;});_0x2c3620(_0x42b17d);return;});})[_0x9428('0xa')](function(_0x2baf8c){_0x1622b0(_0x2baf8c);});});}function checkUserLimits(_0x2dad2b){return new BPromise(function(_0x18eec1,_0x4f7f6d){getLimits()['then'](function(_0x14fed9){var _0x198fa4=_[_0x9428('0x26')](_[_0x9428('0x27')](_0x2dad2b,_0x9428('0x1e')),[_0x9428('0x20'),_0x9428('0x21'),_0x9428('0x22')]);var _0x1f2893=(_0x198fa4[_0x9428('0x20')]||0x0)+(_0x198fa4[_0x9428('0x21')]||0x0);var _0x382ee5=_0x198fa4[_0x9428('0x22')]||0x0;if(_0x1f2893>_0x14fed9[_0x9428('0x21')])return _0x4f7f6d(_0x9428('0x28'));if(_0x382ee5>_0x14fed9[_0x9428('0x22')])return _0x4f7f6d(_0x9428('0x29'));return _0x18eec1();})['catch'](function(_0x1e5f8c){_0x4f7f6d(_0x1e5f8c);});});}module[_0x9428('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf66d=['gray','deadline','add','days','machineUuid','changed','message','findAll','role','sequelize','col','count','admin','telephone','users','telephones','catch','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','License','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf66d,0x177));var _0xdf66=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xf66d[_0x18a79d];return _0x4f8848;};'use strict';var util=require(_0xdf66('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xdf66('0x1'));var hardware=require(_0xdf66('0x2'));var encryptor=require(_0xdf66('0x3'));var db=require(_0xdf66('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdf66('0x5'),'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':_0xdf66('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xdf66('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x8efbde){return new BPromise(function(_0x470562,_0x5dfe79){return db[_0xdf66('0x7')][_0xdf66('0x8')](_[_0xdf66('0x9')](_0x8efbde,{'raw':!![],'where':{'id':0x1}}))[_0xdf66('0xa')](function(_0x1db27d){return checkLicense(_0x1db27d,null);})[_0xdf66('0xa')](function(_0x2ec7c3){_0x470562(_0x2ec7c3);return;})['catch'](function(_0x214435){_0x5dfe79(_0x214435);});});}function checkLicense(_0x14ed74,_0x49f2db){if(!_0x14ed74){demoLicense[_0xdf66('0xb')]=_0x14ed74[_0xdf66('0xc')];return demoLicense;}try{var _0x55fcbb=_0x49f2db||_0x14ed74[_0xdf66('0xd')];if(_[_0xdf66('0xe')](_0x55fcbb)){throw new Error(_0xdf66('0xf'));}var _0x678d39=_0x14ed74[_0xdf66('0xc')];var _0x60a4fa=_0x14ed74['data2'];var _0x577682=_0x678d39['split']('-')[0x4];var _0x222c95=_0x678d39[_0xdf66('0x10')]('-')[0x0];var _0xf3e92a=encryptor[_0xdf66('0x11')](_0x55fcbb,util[_0xdf66('0x12')](_0xdf66('0x13'),_0x577682,_0x678d39,_0x222c95));var _0x1cf336=JSON[_0xdf66('0x14')](_0xf3e92a);_0x1cf336['demo']=![];_0x1cf336[_0xdf66('0xb')]=_0x678d39;_0x1cf336['machineUuid']=hardware[_0xdf66('0x6')]();if(_0x60a4fa){var _0x3ae06a=encryptor[_0xdf66('0x11')](_0x60a4fa);_0x1cf336[_0xdf66('0x15')]=_0x3ae06a;_0x1cf336[_0xdf66('0x16')]=moment(_0x3ae06a)[_0xdf66('0x17')](0x7,_0xdf66('0x18'))[_0xdf66('0x12')]();_0x1cf336['grayReason']=_0x1cf336[_0xdf66('0xb')]!=_0x1cf336[_0xdf66('0x19')]?_0xdf66('0x1a'):'disabled';}return _0x1cf336;}catch(_0x2d7c9f){breakingLicense['uuid']=_0x14ed74[_0xdf66('0xc')];breakingLicense[_0xdf66('0x1b')]=_0x2d7c9f['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x45e677,_0xbc5c41){getLicense()['then'](function(_0x1804a1){return db['User'][_0xdf66('0x1c')]({'attributes':[_0xdf66('0x1d'),[db[_0xdf66('0x1e')]['fn']('COUNT',db['sequelize'][_0xdf66('0x1f')](_0xdf66('0x1d'))),_0xdf66('0x20')]],'group':_0xdf66('0x1d'),'where':{'role':{'$or':[_0xdf66('0x21'),'user',_0xdf66('0x22')]}},'raw':!![]})['then'](function(_0x33c2f5){var _0x291bf7={'user':_0x1804a1[_0xdf66('0x23')]||0x0,'telephone':_0x1804a1[_0xdf66('0x24')]||0x0};_0x33c2f5['forEach'](function(_0x24c248){var _0x5b09bb=_0x24c248[_0xdf66('0x1d')]===_0xdf66('0x21')?'user':_0x24c248[_0xdf66('0x1d')];_0x291bf7[_0x5b09bb]-=_0x24c248[_0xdf66('0x20')];if(_0x291bf7[_0x5b09bb]<0x0)_0x291bf7[_0x5b09bb]=0x0;});_0x45e677(_0x291bf7);return;});})[_0xdf66('0x25')](function(_0x54aa19){_0xbc5c41(_0x54aa19);});});}function checkUserLimits(_0x3fc904){return new BPromise(function(_0x305c51,_0x5e9ecf){getLimits()['then'](function(_0x1773dc){var _0xbd757d=_[_0xdf66('0x26')](_[_0xdf66('0x27')](_0x3fc904,_0xdf66('0x1d')),['admin',_0xdf66('0x28'),'telephone']);var _0x190777=(_0xbd757d[_0xdf66('0x21')]||0x0)+(_0xbd757d[_0xdf66('0x28')]||0x0);var _0x50c93d=_0xbd757d['telephone']||0x0;if(_0x190777>_0x1773dc[_0xdf66('0x28')])return _0x5e9ecf(_0xdf66('0x29'));if(_0x50c93d>_0x1773dc[_0xdf66('0x22')])return _0x5e9ecf(_0xdf66('0x2a'));return _0x305c51();})[_0xdf66('0x25')](function(_0x2572eb){_0x5e9ecf(_0x2572eb);});});}module[_0xdf66('0x2b')]={'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 e93ed89..d4d0aac 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 _0x1775=['myappanuglar-secret','app-id','secret','http://localhost:9000'];(function(_0x2d649c,_0x5656bd){var _0x498e3b=function(_0x46d566){while(--_0x46d566){_0x2d649c['push'](_0x2d649c['shift']());}};_0x498e3b(++_0x5656bd);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';module['exports']={'DOMAIN':_0x5177('0x0'),'SESSION_SECRET':_0x5177('0x1'),'GOOGLE_ID':_0x5177('0x2'),'GOOGLE_SECRET':_0x5177('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x8f59=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8f59,0x11d));var _0x98f5=function(_0x5d60d1,_0x325ad0){_0x5d60d1=_0x5d60d1-0x0;var _0x5e94a7=_0x8f59[_0x5d60d1];return _0x5e94a7;};'use strict';module[_0x98f5('0x0')]={'DOMAIN':_0x98f5('0x1'),'SESSION_SECRET':_0x98f5('0x2'),'GOOGLE_ID':_0x98f5('0x3'),'GOOGLE_SECRET':_0x98f5('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 4f90e85..c72fd70 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a59=['path','INFO','join','/var','log','xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util'];(function(_0x4952a9,_0xad0ba1){var _0x1c0399=function(_0x86f54f){while(--_0x86f54f){_0x4952a9['push'](_0x4952a9['shift']());}};_0x1c0399(++_0xad0ba1);}(_0x4a59,0x1e3));var _0x94a5=function(_0x5e6ed6,_0x4708ed){_0x5e6ed6=_0x5e6ed6-0x0;var _0x333751=_0x4a59[_0x5e6ed6];return _0x333751;};'use strict';var moment=require(_0x94a5('0x0'));var winston=require(_0x94a5('0x1'));var util=require(_0x94a5('0x2'));var path=require(_0x94a5('0x3'));var debugLevel=_0x94a5('0x4');function filename(_0x4ceae6,_0xd6aaf8){return path[_0x94a5('0x5')](_0x94a5('0x6'),_0x94a5('0x7'),_0x94a5('0x8'),util[_0x94a5('0x9')]('%s-%s.log',_0x4ceae6,_0xd6aaf8));}function formatter(_0x201b9a,_0x38ab6e){_0x38ab6e['message']=_0x38ab6e[_0x94a5('0xa')][_0x94a5('0xb')](/@@{/g,_0x94a5('0xc'))['replace'](/}@@/g,_0x94a5('0xd'))[_0x94a5('0xb')](/@{/g,'{{')[_0x94a5('0xb')](/}@/g,'}}');return util['format'](_0x94a5('0xe'),moment()[_0x94a5('0x9')](_0x94a5('0xf')),_0x38ab6e[_0x94a5('0x10')][_0x94a5('0x11')](),_0x201b9a,_0x38ab6e['message']);}module['exports']=function(_0x15d6ee){return new winston[(_0x94a5('0x12'))]({'transports':[new winston[(_0x94a5('0x13'))][(_0x94a5('0x14'))]({'name':util[_0x94a5('0x9')](_0x94a5('0x15'),_0x15d6ee,_0x94a5('0x16')),'filename':filename(_0x15d6ee,'error'),'level':_0x94a5('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x475d14){return formatter(_0x15d6ee,_0x475d14);}}),new winston['transports'][(_0x94a5('0x14'))]({'name':util[_0x94a5('0x9')](_0x94a5('0x15'),_0x15d6ee,'info'),'filename':filename(_0x15d6ee,'info'),'level':_0x94a5('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d7e25){return formatter(_0x15d6ee,_0x5d7e25);}}),new winston[(_0x94a5('0x13'))][(_0x94a5('0x18'))]({'level':process[_0x94a5('0x19')][_0x94a5('0x1a')]||debugLevel,'json':![],'formatter':function(_0x2747fe){return formatter(_0x15d6ee,_0x2747fe);}})]});}; \ No newline at end of file +var _0x3bef=['error','File','info','env','moment','winston','util','path','INFO','/var','xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','%s-%s'];(function(_0x14e565,_0x53bde4){var _0x58db3c=function(_0x40ab60){while(--_0x40ab60){_0x14e565['push'](_0x14e565['shift']());}};_0x58db3c(++_0x53bde4);}(_0x3bef,0x1cc));var _0xf3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bef[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xf3be('0x0'));var winston=require(_0xf3be('0x1'));var util=require(_0xf3be('0x2'));var path=require(_0xf3be('0x3'));var debugLevel=_0xf3be('0x4');function filename(_0x486fe7,_0x46fde5){return path['join'](_0xf3be('0x5'),'log',_0xf3be('0x6'),util[_0xf3be('0x7')](_0xf3be('0x8'),_0x486fe7,_0x46fde5));}function formatter(_0x215cea,_0x50183e){_0x50183e[_0xf3be('0x9')]=_0x50183e[_0xf3be('0x9')][_0xf3be('0xa')](/@@{/g,_0xf3be('0xb'))[_0xf3be('0xa')](/}@@/g,_0xf3be('0xc'))['replace'](/@{/g,'{{')[_0xf3be('0xa')](/}@/g,'}}');return util[_0xf3be('0x7')](_0xf3be('0xd'),moment()[_0xf3be('0x7')](_0xf3be('0xe')),_0x50183e[_0xf3be('0xf')][_0xf3be('0x10')](),_0x215cea,_0x50183e['message']);}module['exports']=function(_0xd7c160){return new winston[(_0xf3be('0x11'))]({'transports':[new winston[(_0xf3be('0x12'))]['File']({'name':util[_0xf3be('0x7')](_0xf3be('0x13'),_0xd7c160,_0xf3be('0x14')),'filename':filename(_0xd7c160,_0xf3be('0x14')),'level':_0xf3be('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1fc663){return formatter(_0xd7c160,_0x1fc663);}}),new winston[(_0xf3be('0x12'))][(_0xf3be('0x15'))]({'name':util[_0xf3be('0x7')](_0xf3be('0x13'),_0xd7c160,_0xf3be('0x16')),'filename':filename(_0xd7c160,_0xf3be('0x16')),'level':_0xf3be('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5c53e8){return formatter(_0xd7c160,_0x5c53e8);}}),new winston[(_0xf3be('0x12'))]['Console']({'level':process[_0xf3be('0x17')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x864b2c){return formatter(_0xd7c160,_0x864b2c);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5024ec3..8b13241 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 _0x505e=['email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x2857d8,_0x1b9b78){var _0x31569b=function(_0xbc4a2c){while(--_0xbc4a2c){_0x2857d8['push'](_0x2857d8['shift']());}};_0x31569b(++_0x1b9b78);}(_0x505e,0x199));var _0xe505=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x505e[_0x45bf86];return _0x1f02b7;};'use strict';var path=require(_0xe505('0x0'));var os=require('os');var config={'apps':[{'name':_0xe505('0x1'),'script':path[_0xe505('0x2')](__dirname,_0xe505('0x3'))},{'name':_0xe505('0x4'),'script':path[_0xe505('0x2')](__dirname,_0xe505('0x5'))},{'name':_0xe505('0x6'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0xe505('0x7'),'script':path['join'](__dirname,_0xe505('0x8'))},{'name':_0xe505('0x9'),'script':path[_0xe505('0x2')](__dirname,_0xe505('0xa'))},{'name':_0xe505('0xb'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0xe505('0xc')]=config; \ No newline at end of file +var _0x8dd8=['join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','path','express'];(function(_0x482009,_0x4bd81e){var _0xaad693=function(_0x204cdf){while(--_0x204cdf){_0x482009['push'](_0x482009['shift']());}};_0xaad693(++_0x4bd81e);}(_0x8dd8,0xee));var _0x88dd=function(_0x2f20e4,_0x456f48){_0x2f20e4=_0x2f20e4-0x0;var _0x3812cc=_0x8dd8[_0x2f20e4];return _0x3812cc;};'use strict';var path=require(_0x88dd('0x0'));var os=require('os');var config={'apps':[{'name':_0x88dd('0x1'),'script':path[_0x88dd('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x88dd('0x3'),'script':path[_0x88dd('0x2')](__dirname,_0x88dd('0x4'))},{'name':_0x88dd('0x5'),'script':path['join'](__dirname,_0x88dd('0x6'))},{'name':'email','script':path[_0x88dd('0x2')](__dirname,_0x88dd('0x7'))},{'name':'routing','script':path[_0x88dd('0x2')](__dirname,_0x88dd('0x8'))},{'name':'xdr','script':path[_0x88dd('0x2')](__dirname,_0x88dd('0x9'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5450b2c..67a9030 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 _0x8feb=['./config','connect','start','disconnect','stop','then','list','describe','delete','dump','saved','pm2','bluebird'];(function(_0x595a6b,_0x222a50){var _0x262fdd=function(_0x24f51c){while(--_0x24f51c){_0x595a6b['push'](_0x595a6b['shift']());}};_0x262fdd(++_0x222a50);}(_0x8feb,0x150));var _0xb8fe=function(_0x5d0990,_0x41d3ea){_0x5d0990=_0x5d0990-0x0;var _0x55271f=_0x8feb[_0x5d0990];return _0x55271f;};'use strict';var pm2=require(_0xb8fe('0x0'));var BPromise=require(_0xb8fe('0x1'));var config=require(_0xb8fe('0x2'));function connect(){return new BPromise(function(_0x252be1,_0x42aa2e){return pm2[_0xb8fe('0x3')](function(_0x3650e0){if(_0x3650e0){return _0x42aa2e(_0x3650e0);}return _0x252be1('connected');});});};exports['start']=function(_0x1d272d){return connect()['then'](function(){return new BPromise(function(_0x4fb5f8,_0x1f81a2){return pm2[_0xb8fe('0x4')](_0x1d272d,function(_0x4d8a8c,_0x1dd0cc){if(_0x4d8a8c){return _0x1f81a2(_0x4d8a8c);}pm2[_0xb8fe('0x5')]();return _0x4fb5f8(_0x1dd0cc);});});});};exports[_0xb8fe('0x6')]=function(_0x16aa45){return connect()[_0xb8fe('0x7')](function(){return new BPromise(function(_0xda9c8e,_0x17e428){return pm2['stop'](_0x16aa45,function(_0x259512,_0x205bc4){if(_0x259512){return _0x17e428(_0x259512);}pm2[_0xb8fe('0x5')]();return _0xda9c8e(_0x205bc4);});});});};exports['restart']=function(_0xb6b423){return connect()[_0xb8fe('0x7')](function(){return new BPromise(function(_0x26797b,_0x5bc1ce){return pm2['restart'](_0xb6b423,function(_0x292c08,_0x4dd931){if(_0x292c08){return _0x5bc1ce(_0x292c08);}pm2[_0xb8fe('0x5')]();return _0x26797b(_0x4dd931);});});});};exports['list']=function(){return connect()[_0xb8fe('0x7')](function(){return new BPromise(function(_0x56c7ff,_0x500c98){return pm2[_0xb8fe('0x8')](function(_0x14715f,_0x426977){if(_0x14715f){return _0x500c98(_0x14715f);}pm2[_0xb8fe('0x5')]();return _0x56c7ff(_0x426977);});});});};exports[_0xb8fe('0x9')]=function(_0x349c79){return connect()[_0xb8fe('0x7')](function(){return new BPromise(function(_0x5ac705,_0x299c41){return pm2[_0xb8fe('0x9')](_0x349c79,function(_0x59addd,_0x3383bb){if(_0x59addd){return _0x299c41(_0x59addd);}pm2[_0xb8fe('0x5')]();return _0x5ac705(_0x3383bb);});});});};exports[_0xb8fe('0xa')]=function(_0x23233e){return connect()[_0xb8fe('0x7')](function(){return new BPromise(function(_0x2aa954,_0x47c8f8){return pm2[_0xb8fe('0xa')](_0x23233e,function(_0x275bb8,_0x112fdc){if(_0x275bb8){return _0x47c8f8(_0x275bb8);}pm2['disconnect']();return _0x2aa954(_0x112fdc);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x5b6b70,_0x5148c6){return pm2[_0xb8fe('0xb')](function(_0x39a806){if(_0x39a806){return _0x5148c6(_0x39a806);}return _0x5b6b70(_0xb8fe('0xc'));});});});}; \ No newline at end of file +var _0x7a28=['./config','connected','then','disconnect','stop','restart','list','describe','delete','dump','pm2'];(function(_0xaae2de,_0x4e113b){var _0x454b8e=function(_0x5f0f4c){while(--_0x5f0f4c){_0xaae2de['push'](_0xaae2de['shift']());}};_0x454b8e(++_0x4e113b);}(_0x7a28,0x6d));var _0x87a2=function(_0x262065,_0x16d147){_0x262065=_0x262065-0x0;var _0x3221dc=_0x7a28[_0x262065];return _0x3221dc;};'use strict';var pm2=require(_0x87a2('0x0'));var BPromise=require('bluebird');var config=require(_0x87a2('0x1'));function connect(){return new BPromise(function(_0xf3de12,_0x29d32f){return pm2['connect'](function(_0x2062bb){if(_0x2062bb){return _0x29d32f(_0x2062bb);}return _0xf3de12(_0x87a2('0x2'));});});};exports['start']=function(_0x2f0345){return connect()[_0x87a2('0x3')](function(){return new BPromise(function(_0x35c25f,_0x4ebf2e){return pm2['start'](_0x2f0345,function(_0x1694a1,_0x5efd9a){if(_0x1694a1){return _0x4ebf2e(_0x1694a1);}pm2[_0x87a2('0x4')]();return _0x35c25f(_0x5efd9a);});});});};exports[_0x87a2('0x5')]=function(_0x31cd38){return connect()[_0x87a2('0x3')](function(){return new BPromise(function(_0x44835c,_0xa1adb2){return pm2[_0x87a2('0x5')](_0x31cd38,function(_0x46ea6d,_0x4247e5){if(_0x46ea6d){return _0xa1adb2(_0x46ea6d);}pm2['disconnect']();return _0x44835c(_0x4247e5);});});});};exports[_0x87a2('0x6')]=function(_0x7d63ac){return connect()[_0x87a2('0x3')](function(){return new BPromise(function(_0x97a478,_0x118192){return pm2[_0x87a2('0x6')](_0x7d63ac,function(_0x5cd31f,_0x249153){if(_0x5cd31f){return _0x118192(_0x5cd31f);}pm2['disconnect']();return _0x97a478(_0x249153);});});});};exports['list']=function(){return connect()[_0x87a2('0x3')](function(){return new BPromise(function(_0xeb101d,_0x299b97){return pm2[_0x87a2('0x7')](function(_0x4bcc88,_0x35ec3d){if(_0x4bcc88){return _0x299b97(_0x4bcc88);}pm2[_0x87a2('0x4')]();return _0xeb101d(_0x35ec3d);});});});};exports['describe']=function(_0x46d013){return connect()['then'](function(){return new BPromise(function(_0x3ec788,_0x147fe6){return pm2[_0x87a2('0x8')](_0x46d013,function(_0x457a1e,_0x42c5d6){if(_0x457a1e){return _0x147fe6(_0x457a1e);}pm2[_0x87a2('0x4')]();return _0x3ec788(_0x42c5d6);});});});};exports[_0x87a2('0x9')]=function(_0x22f916){return connect()['then'](function(){return new BPromise(function(_0xa01c3c,_0x5154f3){return pm2[_0x87a2('0x9')](_0x22f916,function(_0x257cd3,_0x41906c){if(_0x257cd3){return _0x5154f3(_0x257cd3);}pm2[_0x87a2('0x4')]();return _0xa01c3c(_0x41906c);});});});};exports[_0x87a2('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5477a7,_0x4c1545){return pm2['dump'](function(_0x391bfb){if(_0x391bfb){return _0x4c1545(_0x391bfb);}return _0x5477a7('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c7c30ad..15fe871 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 _0x022a=['length','map','info','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','chatTimeout','then','findAll','lastMsgAt'];(function(_0x35e648,_0x498216){var _0x19135f=function(_0x42e07d){while(--_0x42e07d){_0x35e648['push'](_0x35e648['shift']());}};_0x19135f(++_0x498216);}(_0x022a,0xef));var _0xa022=function(_0x3e5608,_0x8b6979){_0x3e5608=_0x3e5608-0x0;var _0x4128d3=_0x022a[_0x3e5608];return _0x4128d3;};'use strict';var _=require('lodash');var moment=require(_0xa022('0x0'));var Redis=require(_0xa022('0x1'));var util=require(_0xa022('0x2'));var config=require(_0xa022('0x3'));var db=require(_0xa022('0x4'))['db'];var logger=require('../logger')(_0xa022('0x5'));config[_0xa022('0x6')]=_['defaults'](config[_0xa022('0x6')],{'host':_0xa022('0x7'),'port':0x18eb});var io=require(_0xa022('0x8'))(new Redis(config[_0xa022('0x6')]));function closeInteractions(){var _0x473c01=0x0;var _0x2f93bf=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0xa022('0x9')],'where':{'id':0x1}})[_0xa022('0xa')](function(_0x521cf4){_0x473c01=_0x521cf4[_0xa022('0x9')];if(_0x473c01){return db['ChatInteraction'][_0xa022('0xb')]({'raw':!![],'attributes':['id',_0xa022('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x521cf4['chatTimeout'],'minutes')}}});}else{return[];}})[_0xa022('0xa')](function(_0x243c7c){if(_0x243c7c&&_0x243c7c[_0xa022('0xd')]){_0x2f93bf=_[_0xa022('0xe')](_0x243c7c||[],'id');logger[_0xa022('0xf')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2f93bf[_0xa022('0x10')]());return db[_0xa022('0x11')][_0xa022('0x12')]({'closeReason':_0xa022('0x13'),'disposition':_0xa022('0x14'),'closed':!![],'closedAt':moment()[_0xa022('0x15')](_0xa022('0x16'))},{'where':{'id':_0x2f93bf}});}})[_0xa022('0xa')](function(){if(_0x2f93bf&&_0x2f93bf[_0xa022('0xd')]){logger[_0xa022('0xf')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2f93bf['join']());for(var _0x4d7bb3=0x0;_0x4d7bb3<_0x2f93bf['length'];_0x4d7bb3++){io['emit'](_0xa022('0x17'),{'id':_0x2f93bf[_0x4d7bb3],'closed':!![]});}}})[_0xa022('0x18')](function(_0x577031){logger['error'](_0xa022('0x19'),_0x577031?util[_0xa022('0x1a')](_0x577031,{'showHidden':![],'depth':null}):'');});}exports[_0xa022('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x61bd=['emit','chatInteraction:update','catch','inspect','lodash','moment','ioredis','util','../../mysqldb','../logger','redis','defaults','localhost','Setting','find','then','ChatInteraction','findAll','lastMsgAt','chatTimeout','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61bd,0xc4));var _0xd61b=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x61bd[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xd61b('0x0'));var moment=require(_0xd61b('0x1'));var Redis=require(_0xd61b('0x2'));var util=require(_0xd61b('0x3'));var config=require('../../config/environment');var db=require(_0xd61b('0x4'))['db'];var logger=require(_0xd61b('0x5'))('schedule');config[_0xd61b('0x6')]=_[_0xd61b('0x7')](config[_0xd61b('0x6')],{'host':_0xd61b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd61b('0x6')]));function closeInteractions(){var _0x266fac=0x0;var _0x188959=[];return db[_0xd61b('0x9')][_0xd61b('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xd61b('0xb')](function(_0x26d401){_0x266fac=_0x26d401['chatTimeout'];if(_0x266fac){return db[_0xd61b('0xc')][_0xd61b('0xd')]({'raw':!![],'attributes':['id',_0xd61b('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x26d401[_0xd61b('0xf')],_0xd61b('0x10'))}}});}else{return[];}})[_0xd61b('0xb')](function(_0x53730d){if(_0x53730d&&_0x53730d[_0xd61b('0x11')]){_0x188959=_[_0xd61b('0x12')](_0x53730d||[],'id');logger[_0xd61b('0x13')](_0xd61b('0x14'),_0x188959[_0xd61b('0x15')]());return db[_0xd61b('0xc')][_0xd61b('0x16')]({'closeReason':_0xd61b('0x17'),'disposition':_0xd61b('0x18'),'closed':!![],'closedAt':moment()[_0xd61b('0x19')](_0xd61b('0x1a'))},{'where':{'id':_0x188959}});}})['then'](function(){if(_0x188959&&_0x188959['length']){logger[_0xd61b('0x13')](_0xd61b('0x1b'),_0x188959[_0xd61b('0x15')]());for(var _0xb938f1=0x0;_0xb938f1<_0x188959[_0xd61b('0x11')];_0xb938f1++){io[_0xd61b('0x1c')](_0xd61b('0x1d'),{'id':_0x188959[_0xb938f1],'closed':!![]});}}})[_0xd61b('0x1e')](function(_0x3f56a4){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x3f56a4?util[_0xd61b('0x1f')](_0x3f56a4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 64256d0..996534d 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 _0x7e01=['moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','pass','format','\x22%s\x22\x20<%s>','name','email','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','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','request','SendMail','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','then','findAll','MailServerOut','jobs','toString','keyBy','difference','intersection','length','exists','stop','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','update','update\x20cron','deleteJob','stop\x20cron','start','util','path','lodash'];(function(_0x3f0140,_0x1a2ee7){var _0x247246=function(_0xbdf77b){while(--_0xbdf77b){_0x3f0140['push'](_0x3f0140['shift']());}};_0x247246(++_0x1a2ee7);}(_0x7e01,0x108));var _0x17e0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7e01[_0x1facfa];return _0x9ec701;};'use strict';var fs=require('fs');var util=require(_0x17e0('0x0'));var path=require(_0x17e0('0x1'));var _=require(_0x17e0('0x2'));var moment=require(_0x17e0('0x3'));var CronJobManager=require(_0x17e0('0x4'));var jayson=require(_0x17e0('0x5'));var BPromise=require(_0x17e0('0x6'));var logger=require(_0x17e0('0x7'))(_0x17e0('0x8'));var db=require(_0x17e0('0x9'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x17e0('0xa'));var client=jayson['client'][_0x17e0('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x332a52,_0x1623af){return function(){logger[_0x17e0('0xc')](_0x17e0('0xd'),_0x332a52['email']);var _0x1c56c2=!![];var _0x33077f={'tls':{'rejectUnauthorized':![]}};if(_0x332a52[_0x17e0('0xe')][_0x17e0('0xf')][_0x17e0('0x10')]){_0x33077f[_0x17e0('0x10')]=_0x332a52['MailAccount'][_0x17e0('0xf')][_0x17e0('0x10')];}else{_0x33077f[_0x17e0('0x11')]=_0x332a52['MailAccount'][_0x17e0('0xf')]['host'];_0x33077f[_0x17e0('0x12')]=_0x332a52[_0x17e0('0xe')][_0x17e0('0xf')][_0x17e0('0x12')];_0x33077f[_0x17e0('0x13')]=_0x332a52['MailAccount']['Smtp']['secure'];}if(_0x332a52['MailAccount'][_0x17e0('0xf')]['authentication']){_0x33077f['auth']={'user':_0x332a52['MailAccount'][_0x17e0('0xf')]['user'],'pass':_0x332a52[_0x17e0('0xe')]['Smtp'][_0x17e0('0x14')]};}var _0x3b3c90={'account':_0x33077f,'message':{'from':util[_0x17e0('0x15')](_0x17e0('0x16'),_0x332a52[_0x17e0('0xe')][_0x17e0('0x17')],_0x332a52['MailAccount'][_0x17e0('0x18')]||_0x332a52[_0x17e0('0xe')][_0x17e0('0xf')][_0x17e0('0x19')]),'to':_0x332a52[_0x17e0('0x18')],'cc':_0x332a52['cc'],'bcc':_0x332a52[_0x17e0('0x1a')],'subject':util[_0x17e0('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x1623af['name'],_0x332a52[_0x17e0('0x1b')],_0x332a52[_0x17e0('0x1c')])}};var _0x3d9fd3=path[_0x17e0('0x1d')](__dirname,_0x17e0('0x1e'));var _0x30d46a=_0x1623af[_0x17e0('0x1f')];var _0x3dbc69=util[_0x17e0('0x15')](_0x17e0('0x20'),path[_0x17e0('0x21')](_0x1623af[_0x17e0('0x1f')],path[_0x17e0('0x22')](_0x1623af[_0x17e0('0x1f')])),_0x17e0('0x23'));var _0x46f11d=path['join'](_0x3d9fd3,_0x30d46a);var _0x28161e=path['join'](_0x3d9fd3,_0x3dbc69);if(fs[_0x17e0('0x24')](_0x46f11d)){_0x1623af[_0x17e0('0x25')]=_0x17e0('0x26');_0x3b3c90[_0x17e0('0x27')][_0x17e0('0x28')]=[{'filename':_0x30d46a,'path':_0x46f11d}];_0x3b3c90[_0x17e0('0x27')][_0x17e0('0x29')]=util[_0x17e0('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x17e0('0x2a')](_0x1623af,null,0x2));}else if(fs[_0x17e0('0x24')](_0x28161e)){_0x1623af[_0x17e0('0x25')]=_0x17e0('0x26');_0x3b3c90[_0x17e0('0x27')]['attachments']=[{'filename':_0x3dbc69,'path':_0x28161e}];}else{_0x3b3c90['message'][_0x17e0('0x29')]=_0x17e0('0x2b');if(!_0x332a52[_0x17e0('0x2c')]){_0x1c56c2=![];logger['info'](_0x17e0('0x2d'));}}if(_0x1c56c2){return client[_0x17e0('0x2e')](_0x17e0('0x2f'),_0x3b3c90)['then'](function(_0xe03fd){if(_0xe03fd[_0x17e0('0x30')]){return logger[_0x17e0('0x30')](_0x17e0('0x31'),JSON[_0x17e0('0x2a')](_0xe03fd));}return logger[_0x17e0('0xc')]('email\x20sent');})[_0x17e0('0x32')](function(_0x2f2db4){return logger[_0x17e0('0x30')](_0x17e0('0x31'),JSON[_0x17e0('0x2a')](_0x2f2db4));});}};}function handleError(){return function(_0x1953ab){return logger[_0x17e0('0x30')](JSON[_0x17e0('0x2a')](_0x1953ab));};}function handleResult(_0x5b8680){return function(_0x25b787){logger[_0x17e0('0xc')](_0x17e0('0x33'),JSON['stringify'](_0x25b787));if(_0x5b8680[_0x17e0('0xe')]&&_0x5b8680[_0x17e0('0xe')][_0x17e0('0xf')]&&!_[_0x17e0('0x34')](_0x5b8680[_0x17e0('0x18')])){setTimeout(handleSendEmail(_0x5b8680,_0x25b787),0x3c*0x3e8);}};}function handleJob(_0x23e078){return function(){try{if(_['isNil'](_0x23e078[_0x17e0('0x1b')])){return logger[_0x17e0('0xc')](_0x17e0('0x35'));}if(_['isNil'](_0x23e078[_0x17e0('0x1c')])){return logger[_0x17e0('0xc')](_0x17e0('0x36'));}var _0x2ee8e2={'startDate':moment()[_0x17e0('0x37')](_0x23e078[_0x17e0('0x1b')],_0x23e078['subtractUnit'])[_0x17e0('0x15')](_0x17e0('0x38')),'endDate':moment()[_0x17e0('0x15')](_0x17e0('0x38')),'type':_0x17e0('0x39'),'output':_0x23e078['output'],'name':_0x23e078[_0x17e0('0x17')]};if(!_[_0x17e0('0x34')](_0x23e078['DefaultReportId'])){logger[_0x17e0('0xc')](_0x17e0('0x3a'),_0x23e078['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x23e078['DefaultReportId']},_0x2ee8e2)['then'](handleResult(_0x23e078))[_0x17e0('0x32')](handleError());}if(!_[_0x17e0('0x34')](_0x23e078[_0x17e0('0x3b')])){logger[_0x17e0('0xc')](_0x17e0('0x3c'),_0x23e078[_0x17e0('0x3b')]);return analyticCustomReportController[_0x17e0('0x3d')]({'id':_0x23e078[_0x17e0('0x3b')]},_0x2ee8e2)[_0x17e0('0x3e')](handleResult(_0x23e078))[_0x17e0('0x32')](handleError());}}catch(_0x501dc0){logger[_0x17e0('0x30')](JSON[_0x17e0('0x2a')](_0x501dc0));}return logger[_0x17e0('0xc')]('no\x20report\x20id');};}function getJobs(_0x44caec){var _0xb5597b={};if(_0x44caec){_0xb5597b['id']=_0x44caec;}return db['Schedule'][_0x17e0('0x3f')]({'where':_0xb5597b,'include':[{'model':db[_0x17e0('0xe')],'attributes':['id','name',_0x17e0('0x18')],'include':[{'model':db[_0x17e0('0x40')],'as':_0x17e0('0xf')}]}]})[_0x17e0('0x3e')](function(_0x523cdd){var _0x3b417b=_['keys'](manager[_0x17e0('0x41')]);var _0x7d27e0=_['map'](_0x523cdd,function(_0x10091b){return _0x10091b['id'][_0x17e0('0x42')]();});var _0x19e5ba=_[_0x17e0('0x43')](_0x523cdd,function(_0x21008c){return _0x21008c['id']['toString']();});var _0x2c68a3=_0x44caec?_0x7d27e0:_[_0x17e0('0x44')](_0x7d27e0,_0x3b417b);var _0x3998d4=_[_0x17e0('0x45')](_0x7d27e0,_0x3b417b);var _0x2de72f=_[_0x17e0('0x44')](_0x3b417b,_0x7d27e0);var _0x456436;var _0x1e9cd0;for(_0x456436=0x0;_0x456436<_0x2de72f[_0x17e0('0x46')]&&!_0x44caec;_0x456436+=0x1){_0x1e9cd0=_0x2de72f[_0x456436][_0x17e0('0x42')]();if(manager[_0x17e0('0x47')](_0x1e9cd0)){manager[_0x17e0('0x48')](_0x1e9cd0);manager['deleteJob'](_0x1e9cd0);logger['info']('delete\x20cron',_0x1e9cd0);}}logger['info'](_0x17e0('0x49'),JSON[_0x17e0('0x2a')](_0x2c68a3));for(_0x456436=0x0;_0x456436<_0x2c68a3[_0x17e0('0x46')];_0x456436+=0x1){_0x1e9cd0=_0x2c68a3[_0x456436][_0x17e0('0x42')]();logger[_0x17e0('0xc')](_0x17e0('0x4a'),_0x1e9cd0);if(_0x44caec){logger[_0x17e0('0xc')](_0x17e0('0x4b'),_0x44caec);logger['info'](JSON[_0x17e0('0x2a')](_0x19e5ba[_0x1e9cd0]));BPromise['resolve']()['then'](handleJob(_0x19e5ba[_0x1e9cd0]));logger[_0x17e0('0xc')](_0x17e0('0x4c'),_0x19e5ba[_0x1e9cd0][_0x17e0('0x17')],_0x19e5ba[_0x1e9cd0][_0x17e0('0x4d')]);}else if(_0x19e5ba[_0x1e9cd0][_0x17e0('0x4d')]&&_0x19e5ba[_0x1e9cd0][_0x17e0('0x4e')]&&moment()[_0x17e0('0x4f')](_0x19e5ba[_0x1e9cd0][_0x17e0('0x50')],_0x19e5ba[_0x1e9cd0][_0x17e0('0x51')])){manager[_0x17e0('0x52')](_0x1e9cd0,_0x19e5ba[_0x1e9cd0][_0x17e0('0x4d')],handleJob(_0x19e5ba[_0x1e9cd0]));manager['start'](_0x1e9cd0);logger['info'](_0x17e0('0x53'),_0x19e5ba[_0x1e9cd0]['name'],_0x19e5ba[_0x1e9cd0]['cron']);}else if(manager[_0x17e0('0x47')](_0x1e9cd0)){manager[_0x17e0('0x48')](_0x1e9cd0);manager['deleteJob'](_0x1e9cd0);logger['info']('stop\x20cron',_0x19e5ba[_0x1e9cd0][_0x17e0('0x17')],_0x19e5ba[_0x1e9cd0]['cron']);}}for(_0x456436=0x0,_0x1e9cd0;_0x456436<_0x3998d4[_0x17e0('0x46')]&&!_0x44caec;_0x456436+=0x1){_0x1e9cd0=_0x3998d4[_0x456436][_0x17e0('0x42')]();if(manager[_0x17e0('0x47')](_0x1e9cd0)){if(_0x19e5ba[_0x1e9cd0][_0x17e0('0x4d')]&&_0x19e5ba[_0x1e9cd0][_0x17e0('0x4e')]&&moment()[_0x17e0('0x4f')](_0x19e5ba[_0x1e9cd0][_0x17e0('0x50')],_0x19e5ba[_0x1e9cd0]['endAt'])){manager[_0x17e0('0x54')](_0x1e9cd0,_0x19e5ba[_0x1e9cd0]['cron'],handleJob(_0x19e5ba[_0x1e9cd0]));logger[_0x17e0('0xc')](_0x17e0('0x55'),_0x19e5ba[_0x1e9cd0]['name'],_0x19e5ba[_0x1e9cd0][_0x17e0('0x4d')]);}else{manager[_0x17e0('0x48')](_0x1e9cd0);manager[_0x17e0('0x56')](_0x1e9cd0);logger[_0x17e0('0xc')](_0x17e0('0x57'),_0x19e5ba[_0x1e9cd0][_0x17e0('0x17')],_0x19e5ba[_0x1e9cd0][_0x17e0('0x4d')]);}}}})[_0x17e0('0x32')](function(_0x4da3d6){logger['error'](JSON[_0x17e0('0x2a')](_0x4da3d6));});}exports['run']=function(_0x582a3c){return getJobs(_0x582a3c);};exports[_0x17e0('0x58')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x011a=['intersection','difference','length','exists','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','add','add\x20cron','stop','stop\x20cron','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','MailAccount','Smtp','service','host','port','authentication','auth','user','pass','format','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','info','email\x20sent','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','keyBy','toString'];(function(_0x193f67,_0x28fbd2){var _0x278982=function(_0x30298c){while(--_0x30298c){_0x193f67['push'](_0x193f67['shift']());}};_0x278982(++_0x28fbd2);}(_0x011a,0x1c7));var _0xa011=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x011a[_0x3a3c17];return _0xd07f21;};'use strict';var fs=require('fs');var util=require(_0xa011('0x0'));var path=require(_0xa011('0x1'));var _=require(_0xa011('0x2'));var moment=require('moment');var CronJobManager=require(_0xa011('0x3'));var jayson=require(_0xa011('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0xa011('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xa011('0x6'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xa011('0x7')][_0xa011('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x36497e,_0x1f270c){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x36497e['email']);var _0x6db9de=!![];var _0x2681dc={'tls':{'rejectUnauthorized':![]}};if(_0x36497e[_0xa011('0x9')][_0xa011('0xa')]['service']){_0x2681dc[_0xa011('0xb')]=_0x36497e['MailAccount']['Smtp'][_0xa011('0xb')];}else{_0x2681dc[_0xa011('0xc')]=_0x36497e[_0xa011('0x9')][_0xa011('0xa')][_0xa011('0xc')];_0x2681dc[_0xa011('0xd')]=_0x36497e[_0xa011('0x9')][_0xa011('0xa')][_0xa011('0xd')];_0x2681dc['secure']=_0x36497e[_0xa011('0x9')][_0xa011('0xa')]['secure'];}if(_0x36497e['MailAccount'][_0xa011('0xa')][_0xa011('0xe')]){_0x2681dc[_0xa011('0xf')]={'user':_0x36497e[_0xa011('0x9')][_0xa011('0xa')][_0xa011('0x10')],'pass':_0x36497e[_0xa011('0x9')][_0xa011('0xa')][_0xa011('0x11')]};}var _0x365228={'account':_0x2681dc,'message':{'from':util[_0xa011('0x12')]('\x22%s\x22\x20<%s>',_0x36497e[_0xa011('0x9')][_0xa011('0x13')],_0x36497e[_0xa011('0x9')][_0xa011('0x14')]||_0x36497e[_0xa011('0x9')]['Smtp']['user']),'to':_0x36497e[_0xa011('0x14')],'cc':_0x36497e['cc'],'bcc':_0x36497e[_0xa011('0x15')],'subject':util[_0xa011('0x12')](_0xa011('0x16'),_0x1f270c[_0xa011('0x13')],_0x36497e[_0xa011('0x17')],_0x36497e[_0xa011('0x18')])}};var _0x38088d=path[_0xa011('0x19')](__dirname,'../../files/reports');var _0x89ff40=_0x1f270c[_0xa011('0x1a')];var _0x10c32b=util[_0xa011('0x12')](_0xa011('0x1b'),path[_0xa011('0x1c')](_0x1f270c[_0xa011('0x1a')],path[_0xa011('0x1d')](_0x1f270c[_0xa011('0x1a')])),_0xa011('0x1e'));var _0xca32ba=path[_0xa011('0x19')](_0x38088d,_0x89ff40);var _0x2a614f=path['join'](_0x38088d,_0x10c32b);if(fs['existsSync'](_0xca32ba)){_0x1f270c['status']='Sent';_0x365228[_0xa011('0x1f')][_0xa011('0x20')]=[{'filename':_0x89ff40,'path':_0xca32ba}];_0x365228[_0xa011('0x1f')][_0xa011('0x21')]=util[_0xa011('0x12')](_0xa011('0x22'),JSON[_0xa011('0x23')](_0x1f270c,null,0x2));}else if(fs[_0xa011('0x24')](_0x2a614f)){_0x1f270c[_0xa011('0x25')]=_0xa011('0x26');_0x365228[_0xa011('0x1f')]['attachments']=[{'filename':_0x10c32b,'path':_0x2a614f}];}else{_0x365228[_0xa011('0x1f')]['text']=_0xa011('0x27');if(!_0x36497e[_0xa011('0x28')]){_0x6db9de=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x6db9de){return client[_0xa011('0x29')](_0xa011('0x2a'),_0x365228)[_0xa011('0x2b')](function(_0x4b9372){if(_0x4b9372['error']){return logger[_0xa011('0x2c')]('error\x20mail',JSON['stringify'](_0x4b9372));}return logger[_0xa011('0x2d')](_0xa011('0x2e'));})['catch'](function(_0xc3cbf){return logger[_0xa011('0x2c')](_0xa011('0x2f'),JSON['stringify'](_0xc3cbf));});}};}function handleError(){return function(_0x28b0ac){return logger[_0xa011('0x2c')](JSON[_0xa011('0x23')](_0x28b0ac));};}function handleResult(_0x565683){return function(_0x3b4a94){logger['info'](_0xa011('0x30'),JSON['stringify'](_0x3b4a94));if(_0x565683[_0xa011('0x9')]&&_0x565683[_0xa011('0x9')][_0xa011('0xa')]&&!_['isNil'](_0x565683[_0xa011('0x14')])){setTimeout(handleSendEmail(_0x565683,_0x3b4a94),0x3c*0x3e8);}};}function handleJob(_0x31b829){return function(){try{if(_[_0xa011('0x31')](_0x31b829['subtractNumber'])){return logger['info'](_0xa011('0x32'));}if(_[_0xa011('0x31')](_0x31b829[_0xa011('0x18')])){return logger[_0xa011('0x2d')](_0xa011('0x33'));}var _0x513abc={'startDate':moment()['subtract'](_0x31b829[_0xa011('0x17')],_0x31b829['subtractUnit'])[_0xa011('0x12')](_0xa011('0x34')),'endDate':moment()[_0xa011('0x12')](_0xa011('0x34')),'type':'scheduled','output':_0x31b829[_0xa011('0x35')],'name':_0x31b829['name']};if(!_[_0xa011('0x31')](_0x31b829[_0xa011('0x36')])){logger[_0xa011('0x2d')]('exec\x20defaul\x20report\x20id:%s',_0x31b829[_0xa011('0x36')]);return analyticDefaultReportController[_0xa011('0x37')]({'id':_0x31b829[_0xa011('0x36')]},_0x513abc)[_0xa011('0x2b')](handleResult(_0x31b829))[_0xa011('0x38')](handleError());}if(!_[_0xa011('0x31')](_0x31b829[_0xa011('0x39')])){logger['info'](_0xa011('0x3a'),_0x31b829[_0xa011('0x39')]);return analyticCustomReportController[_0xa011('0x37')]({'id':_0x31b829[_0xa011('0x39')]},_0x513abc)[_0xa011('0x2b')](handleResult(_0x31b829))[_0xa011('0x38')](handleError());}}catch(_0x2ae09a){logger['error'](JSON[_0xa011('0x23')](_0x2ae09a));}return logger[_0xa011('0x2d')](_0xa011('0x3b'));};}function getJobs(_0x73853e){var _0x42f796={};if(_0x73853e){_0x42f796['id']=_0x73853e;}return db[_0xa011('0x3c')][_0xa011('0x3d')]({'where':_0x42f796,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0xa011('0x14')],'include':[{'model':db[_0xa011('0x3e')],'as':_0xa011('0xa')}]}]})[_0xa011('0x2b')](function(_0x1f609f){var _0x313374=_[_0xa011('0x3f')](manager['jobs']);var _0x4a62ef=_[_0xa011('0x40')](_0x1f609f,function(_0x6b7b0a){return _0x6b7b0a['id']['toString']();});var _0x223aaf=_[_0xa011('0x41')](_0x1f609f,function(_0xef12e8){return _0xef12e8['id'][_0xa011('0x42')]();});var _0x11df80=_0x73853e?_0x4a62ef:_['difference'](_0x4a62ef,_0x313374);var _0x20c538=_[_0xa011('0x43')](_0x4a62ef,_0x313374);var _0x116d33=_[_0xa011('0x44')](_0x313374,_0x4a62ef);var _0x15541e;var _0x11ca7c;for(_0x15541e=0x0;_0x15541e<_0x116d33[_0xa011('0x45')]&&!_0x73853e;_0x15541e+=0x1){_0x11ca7c=_0x116d33[_0x15541e][_0xa011('0x42')]();if(manager[_0xa011('0x46')](_0x11ca7c)){manager['stop'](_0x11ca7c);manager[_0xa011('0x47')](_0x11ca7c);logger[_0xa011('0x2d')](_0xa011('0x48'),_0x11ca7c);}}logger[_0xa011('0x2d')]('toRun',JSON['stringify'](_0x11df80));for(_0x15541e=0x0;_0x15541e<_0x11df80[_0xa011('0x45')];_0x15541e+=0x1){_0x11ca7c=_0x11df80[_0x15541e]['toString']();logger[_0xa011('0x2d')](_0xa011('0x49'),_0x11ca7c);if(_0x73853e){logger[_0xa011('0x2d')](_0xa011('0x4a'),_0x73853e);logger[_0xa011('0x2d')](JSON[_0xa011('0x23')](_0x223aaf[_0x11ca7c]));BPromise[_0xa011('0x4b')]()[_0xa011('0x2b')](handleJob(_0x223aaf[_0x11ca7c]));logger[_0xa011('0x2d')](_0xa011('0x4c'),_0x223aaf[_0x11ca7c]['name'],_0x223aaf[_0x11ca7c][_0xa011('0x4d')]);}else if(_0x223aaf[_0x11ca7c][_0xa011('0x4d')]&&_0x223aaf[_0x11ca7c][_0xa011('0x4e')]&&moment()[_0xa011('0x4f')](_0x223aaf[_0x11ca7c]['startAt'],_0x223aaf[_0x11ca7c]['endAt'])){manager[_0xa011('0x50')](_0x11ca7c,_0x223aaf[_0x11ca7c][_0xa011('0x4d')],handleJob(_0x223aaf[_0x11ca7c]));manager['start'](_0x11ca7c);logger[_0xa011('0x2d')](_0xa011('0x51'),_0x223aaf[_0x11ca7c][_0xa011('0x13')],_0x223aaf[_0x11ca7c][_0xa011('0x4d')]);}else if(manager[_0xa011('0x46')](_0x11ca7c)){manager[_0xa011('0x52')](_0x11ca7c);manager[_0xa011('0x47')](_0x11ca7c);logger[_0xa011('0x2d')](_0xa011('0x53'),_0x223aaf[_0x11ca7c]['name'],_0x223aaf[_0x11ca7c][_0xa011('0x4d')]);}}for(_0x15541e=0x0,_0x11ca7c;_0x15541e<_0x20c538[_0xa011('0x45')]&&!_0x73853e;_0x15541e+=0x1){_0x11ca7c=_0x20c538[_0x15541e][_0xa011('0x42')]();if(manager[_0xa011('0x46')](_0x11ca7c)){if(_0x223aaf[_0x11ca7c]['cron']&&_0x223aaf[_0x11ca7c]['active']&&moment()['isBetween'](_0x223aaf[_0x11ca7c]['startAt'],_0x223aaf[_0x11ca7c]['endAt'])){manager[_0xa011('0x54')](_0x11ca7c,_0x223aaf[_0x11ca7c]['cron'],handleJob(_0x223aaf[_0x11ca7c]));logger['info'](_0xa011('0x55'),_0x223aaf[_0x11ca7c][_0xa011('0x13')],_0x223aaf[_0x11ca7c][_0xa011('0x4d')]);}else{manager[_0xa011('0x52')](_0x11ca7c);manager['deleteJob'](_0x11ca7c);logger['info']('stop\x20cron',_0x223aaf[_0x11ca7c][_0xa011('0x13')],_0x223aaf[_0x11ca7c][_0xa011('0x4d')]);}}}})[_0xa011('0x38')](function(_0x1a544d){logger['error'](JSON['stringify'](_0x1a544d));});}exports[_0xa011('0x56')]=function(_0x1175a6){return getJobs(_0x1175a6);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 232c93a..0f73317 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 _0x8aa7=['tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Cloud\x20Provider\x20not\x20available','language','name','error','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','catch','SequelizeValidationError','inspect','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x51a0a9,_0x569499){var _0x4bd20c=function(_0x26235a){while(--_0x26235a){_0x51a0a9['push'](_0x51a0a9['shift']());}};_0x4bd20c(++_0x569499);}(_0x8aa7,0xb6));var _0x78aa=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8aa7[_0x2d7f0e];return _0x110b07;};var _=require('lodash');var AWS=require(_0x78aa('0x0'));var rp=require(_0x78aa('0x1'));var util=require(_0x78aa('0x2'));var BPromise=require(_0x78aa('0x3'));var db=require(_0x78aa('0x4'))['db'];var logger=require(_0x78aa('0x5'))(_0x78aa('0x6'));function getTranscriptionJob(_0x5b46d1,_0x2b9bfa,_0x4055f5,_0x148997){return new Promise(function(_0x229075,_0x2d17c2){var _0x369ee7=new AWS[(_0x78aa('0x7'))]({'accessKeyId':_0x2b9bfa,'secretAccessKey':_0x5b46d1,'region':_0x4055f5});_0x369ee7[_0x78aa('0x8')]({'TranscriptionJobName':_0x148997},function(_0x2368ac,_0x460488){if(_0x2368ac){return _0x2d17c2(_0x2368ac);}else{return _0x229075(_0x460488);}});});}function sentiment(_0x1da0ad,_0x116a77,_0x45d377,_0x41e196,_0x357ab1){return new Promise(function(_0x3bb06f,_0x3df85c){var _0x3b7690=new AWS[(_0x78aa('0x9'))]({'accessKeyId':_0x116a77,'secretAccessKey':_0x1da0ad,'region':_0x45d377});_0x3b7690['detectSentiment']({'Text':_0x41e196,'LanguageCode':_0x357ab1['substring'](0x0,0x2)},function(_0x902d0e,_0x2a0b90){if(_0x902d0e){return _0x3df85c(_0x902d0e);}else{return _0x3bb06f(_0x2a0b90);}});});}function checkTranscribeJob(_0x47de41,_0x1a53ba,_0x41b378){var _0x1ef828;return new BPromise(function(_0x33773a,_0xe0b9f7){logger['info'](util[_0x78aa('0xa')](_0x78aa('0xb'),_0x47de41['id'],_0x47de41[_0x78aa('0xc')]));return getTranscriptionJob(_0x41b378[_0x78aa('0xd')],_0x41b378[_0x78aa('0xe')],_0x1a53ba['transcribeRegion'],_0x47de41[_0x78aa('0xc')])[_0x78aa('0xf')](function(_0x23dbb4){logger[_0x78aa('0x10')](util[_0x78aa('0xa')](_0x78aa('0x11'),_0x47de41['id'],_0x47de41['transcribeName'],_0x23dbb4['TranscriptionJob'][_0x78aa('0x12')]));if(!_0x47de41[_0x78aa('0x13')]){switch(_0x23dbb4[_0x78aa('0x14')][_0x78aa('0x12')]){case _0x78aa('0x15'):var _0x18513e={'transcribeStatus':_0x23dbb4[_0x78aa('0x14')][_0x78aa('0x12')],'fileUri':_0x23dbb4[_0x78aa('0x14')][_0x78aa('0x16')][_0x78aa('0x17')]};logger['info'](util[_0x78aa('0xa')](_0x78aa('0x18'),_0x47de41['id']));return rp({'uri':_0x23dbb4['TranscriptionJob'][_0x78aa('0x16')][_0x78aa('0x17')],'json':!![]})[_0x78aa('0xf')](function(_0x507b19){logger['info'](util[_0x78aa('0xa')](_0x78aa('0x19'),_0x47de41['id']));if(_0x507b19&&_0x507b19['results']&&_0x507b19[_0x78aa('0x1a')][_0x78aa('0x1b')]&&_0x507b19[_0x78aa('0x1a')][_0x78aa('0x1b')]['length']){_0x18513e[_0x78aa('0x13')]='';for(var _0x25463d=0x0;_0x25463d<_0x507b19[_0x78aa('0x1a')][_0x78aa('0x1b')][_0x78aa('0x1c')];_0x25463d++){_0x18513e[_0x78aa('0x13')]+=_0x507b19[_0x78aa('0x1a')][_0x78aa('0x1b')][_0x25463d]['transcript']+'';}}return _0x47de41[_0x78aa('0x1d')](_0x18513e);})['then'](function(){logger[_0x78aa('0x10')](util['format'](_0x78aa('0x1e'),_0x47de41['id']));if(!_0x47de41[_0x78aa('0x1f')]){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))](_0x78aa('0x22'));}if(!_0x1a53ba['sentiment']||!_0x1a53ba[_0x78aa('0x23')]||!_0x1a53ba[_0x78aa('0x24')]||!_0x1a53ba['language']||!_0x1a53ba[_0x78aa('0x25')]){throw new db['Sequelize']['ValidationError'](_0x78aa('0x26'));}if(!_0x18513e['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x1a53ba[_0x78aa('0x23')]===_0x41b378['id']){return _0x41b378;}else{return db[_0x78aa('0x27')][_0x78aa('0x28')]({'where':{'id':_settings[_0x78aa('0x23')]}});}})[_0x78aa('0xf')](function(_0x2a9fad){if(!_0x2a9fad){throw new db[(_0x78aa('0x20'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2a9fad['data1']||!_0x2a9fad[_0x78aa('0xe')]){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))](_0x78aa('0x29'));}_0x1ef828=_0x2a9fad;logger['info'](util[_0x78aa('0xa')](_0x78aa('0x2a'),_0x47de41['id']));return sentiment(_0x1ef828[_0x78aa('0xd')],_0x1ef828['data2'],_0x1a53ba['sentimentRegion'],_0x18513e['fileText'],_0x1a53ba['language']);})[_0x78aa('0xf')](function(_0x3402bd){logger[_0x78aa('0x10')](util[_0x78aa('0xa')](_0x78aa('0x2b'),_0x47de41['id']));return _0x47de41[_0x78aa('0x1d')]({'sentiment':_0x3402bd[_0x78aa('0x2c')],'sPositive':_0x3402bd[_0x78aa('0x2d')][_0x78aa('0x2e')],'sNegative':_0x3402bd['SentimentScore'][_0x78aa('0x2f')],'sMixed':_0x3402bd['SentimentScore'][_0x78aa('0x30')],'sNeutral':_0x3402bd[_0x78aa('0x2d')][_0x78aa('0x31')]});})[_0x78aa('0xf')](function(){logger[_0x78aa('0x10')](util[_0x78aa('0xa')](_0x78aa('0x1e'),_0x47de41['id']));_0x33773a();});case _0x78aa('0x32'):return _0x47de41['update']({'transcribeStatus':_0x78aa('0x32'),'failureReason':_0x23dbb4[_0x78aa('0x14')]['FailureReason']})[_0x78aa('0xf')](function(){logger['info'](util[_0x78aa('0xa')](_0x78aa('0x1e'),_0x47de41['id']));_0x33773a();});default:logger[_0x78aa('0x10')](util[_0x78aa('0xa')](_0x78aa('0x33'),_0x47de41['id']));break;}}else{return BPromise[_0x78aa('0x34')]()[_0x78aa('0xf')](function(){if(!_0x47de41[_0x78aa('0x1f')]){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))](_0x78aa('0x22'));}if(!_0x1a53ba[_0x78aa('0x35')]||!_0x1a53ba[_0x78aa('0x23')]||!_0x1a53ba[_0x78aa('0x24')]||!_0x1a53ba['language']||!_0x1a53ba['bucket']){throw new db[(_0x78aa('0x20'))]['ValidationError'](_0x78aa('0x26'));}if(!_0x47de41[_0x78aa('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x1a53ba[_0x78aa('0x23')]===_0x41b378['id']){return _0x41b378;}else{return db[_0x78aa('0x27')]['findOne']({'where':{'id':_settings[_0x78aa('0x23')]}});}})['then'](function(_0x4d9913){if(!_0x4d9913){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))](_0x78aa('0x36'));}if(!_0x4d9913[_0x78aa('0xd')]||!_0x4d9913['data2']){throw new db[(_0x78aa('0x20'))]['ValidationError'](_0x78aa('0x29'));}_0x1ef828=_0x4d9913;logger[_0x78aa('0x10')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x47de41['id']));return sentiment(_0x1ef828[_0x78aa('0xd')],_0x1ef828['data2'],_0x1a53ba['sentimentRegion'],_0x47de41[_0x78aa('0x13')],_0x1a53ba[_0x78aa('0x37')]);})['then'](function(_0x199c90){logger[_0x78aa('0x10')](util[_0x78aa('0xa')](_0x78aa('0x2b'),_0x47de41['id']));return _0x47de41[_0x78aa('0x1d')]({'sentiment':_0x199c90[_0x78aa('0x2c')],'sPositive':_0x199c90[_0x78aa('0x2d')][_0x78aa('0x2e')],'sNegative':_0x199c90[_0x78aa('0x2d')][_0x78aa('0x2f')],'sMixed':_0x199c90[_0x78aa('0x2d')][_0x78aa('0x30')],'sNeutral':_0x199c90[_0x78aa('0x2d')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x78aa('0xf')](function(){logger[_0x78aa('0x10')](util['format'](_0x78aa('0x1e'),_0x47de41['id']));_0x33773a();});}})['catch'](function(_0xb727c1){if(_0xb727c1){if(!_0xb727c1[_0x78aa('0x38')]||_0xb727c1['name']!=='SequelizeValidationError'){logger[_0x78aa('0x39')](util[_0x78aa('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x47de41['id']),util['inspect'](_0xb727c1,{'showHidden':![],'depth':null}));}}_0x33773a();});});}function checkTranscribe(){var _0x3ae00e;var _0x46e3c2;var _0x580adc;return db[_0x78aa('0x3a')][_0x78aa('0x3b')]({'where':{'transcribeStatus':_0x78aa('0x3c')}})[_0x78aa('0xf')](function(_0x31670d){if(!_0x31670d||!_0x31670d['length']){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))](_0x78aa('0x3d'));}_0x3ae00e=_0x31670d;return db[_0x78aa('0x3e')][_0x78aa('0x28')]({'where':{'id':0x1}});})[_0x78aa('0xf')](function(_0x49be51){if(!_0x49be51){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))](_0x78aa('0x3f'));}_0x46e3c2=_0x49be51;if(!_0x46e3c2['transcribe']||!_0x46e3c2[_0x78aa('0x40')]||!_0x46e3c2['transcribeRegion']||!_0x46e3c2['language']||!_0x46e3c2[_0x78aa('0x25')]){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))]('Transcribe\x20not\x20configured');}return db[_0x78aa('0x27')][_0x78aa('0x28')]({'where':{'id':_0x46e3c2[_0x78aa('0x40')]}});})['then'](function(_0x383d71){if(!_0x383d71){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))](_0x78aa('0x36'));}if(!_0x383d71[_0x78aa('0xd')]||!_0x383d71['data2']){throw new db[(_0x78aa('0x20'))][(_0x78aa('0x21'))](_0x78aa('0x29'));}_0x580adc=_0x383d71;var _0x47e9b4=[];_0x3ae00e[_0x78aa('0x41')](function(_0x44cbee){_0x47e9b4[_0x78aa('0x42')](checkTranscribeJob(_0x44cbee,_0x46e3c2,_0x580adc));});return BPromise['all'](_0x47e9b4);})[_0x78aa('0x43')](function(_0x58d065){if(_0x58d065){if(!_0x58d065[_0x78aa('0x38')]||_0x58d065[_0x78aa('0x38')]!==_0x78aa('0x44')){logger['error'](util[_0x78aa('0x45')](_0x58d065,{'showHidden':![],'depth':null}));}}});}exports[_0x78aa('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd3a8=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','Cloud\x20Provider\x20not\x20available','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','push','all','error','start','lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','info','format','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured'];(function(_0x1e2d3a,_0xe9816f){var _0x58287f=function(_0x48d089){while(--_0x48d089){_0x1e2d3a['push'](_0x1e2d3a['shift']());}};_0x58287f(++_0xe9816f);}(_0xd3a8,0x135));var _0x8d3a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd3a8[_0x1d1779];return _0x2377e9;};var _=require(_0x8d3a('0x0'));var AWS=require('aws-sdk');var rp=require(_0x8d3a('0x1'));var util=require(_0x8d3a('0x2'));var BPromise=require(_0x8d3a('0x3'));var db=require(_0x8d3a('0x4'))['db'];var logger=require('../../config/logger')(_0x8d3a('0x5'));function getTranscriptionJob(_0x2f2826,_0x478dee,_0x5e3983,_0x5ee2ca){return new Promise(function(_0x457b90,_0x59893d){var _0x588567=new AWS[(_0x8d3a('0x6'))]({'accessKeyId':_0x478dee,'secretAccessKey':_0x2f2826,'region':_0x5e3983});_0x588567[_0x8d3a('0x7')]({'TranscriptionJobName':_0x5ee2ca},function(_0x28b131,_0x40bc92){if(_0x28b131){return _0x59893d(_0x28b131);}else{return _0x457b90(_0x40bc92);}});});}function sentiment(_0x2a9a0a,_0x34bb5d,_0x3cd3e3,_0x472233,_0x87efcd){return new Promise(function(_0x117b56,_0x11aaf1){var _0x459c60=new AWS[(_0x8d3a('0x8'))]({'accessKeyId':_0x34bb5d,'secretAccessKey':_0x2a9a0a,'region':_0x3cd3e3});_0x459c60['detectSentiment']({'Text':_0x472233,'LanguageCode':_0x87efcd['substring'](0x0,0x2)},function(_0x527258,_0x222886){if(_0x527258){return _0x11aaf1(_0x527258);}else{return _0x117b56(_0x222886);}});});}function checkTranscribeJob(_0x880a06,_0xc834ec,_0x43b1ca){var _0x4759cd;return new BPromise(function(_0x29b7b9,_0x58b2b7){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x880a06['id'],_0x880a06['transcribeName']));return getTranscriptionJob(_0x43b1ca[_0x8d3a('0xb')],_0x43b1ca['data2'],_0xc834ec[_0x8d3a('0xc')],_0x880a06[_0x8d3a('0xd')])[_0x8d3a('0xe')](function(_0x4c915d){logger[_0x8d3a('0x9')](util['format'](_0x8d3a('0xf'),_0x880a06['id'],_0x880a06['transcribeName'],_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x11')]));if(!_0x880a06[_0x8d3a('0x12')]){switch(_0x4c915d['TranscriptionJob']['TranscriptionJobStatus']){case _0x8d3a('0x13'):var _0xc8208c={'transcribeStatus':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x11')],'fileUri':_0x4c915d[_0x8d3a('0x10')]['Transcript'][_0x8d3a('0x14')]};logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x15'),_0x880a06['id']));return rp({'uri':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x16')]['TranscriptFileUri'],'json':!![]})[_0x8d3a('0xe')](function(_0x3ca6a9){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x880a06['id']));if(_0x3ca6a9&&_0x3ca6a9[_0x8d3a('0x17')]&&_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')]&&_0x3ca6a9['results'][_0x8d3a('0x18')][_0x8d3a('0x19')]){_0xc8208c[_0x8d3a('0x12')]='';for(var _0x327d9a=0x0;_0x327d9a<_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')][_0x8d3a('0x19')];_0x327d9a++){_0xc8208c['fileText']+=_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')][_0x327d9a][_0x8d3a('0x1a')]+'';}}return _0x880a06[_0x8d3a('0x1b')](_0xc8208c);})[_0x8d3a('0xe')](function(){logger[_0x8d3a('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x880a06['id']));if(!_0x880a06[_0x8d3a('0x1c')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x1f'));}if(!_0xc834ec[_0x8d3a('0x20')]||!_0xc834ec[_0x8d3a('0x21')]||!_0xc834ec['sentimentRegion']||!_0xc834ec[_0x8d3a('0x22')]||!_0xc834ec[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x24'));}if(!_0xc8208c[_0x8d3a('0x12')]){throw new Error(_0x8d3a('0x25'));}if(_0xc834ec['sentimentAccountId']===_0x43b1ca['id']){return _0x43b1ca;}else{return db[_0x8d3a('0x26')]['findOne']({'where':{'id':_settings[_0x8d3a('0x21')]}});}})[_0x8d3a('0xe')](function(_0x44dda3){if(!_0x44dda3){throw new db['Sequelize'][(_0x8d3a('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x44dda3['data1']||!_0x44dda3[_0x8d3a('0x27')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x28'));}_0x4759cd=_0x44dda3;logger['info'](util['format'](_0x8d3a('0x29'),_0x880a06['id']));return sentiment(_0x4759cd[_0x8d3a('0xb')],_0x4759cd['data2'],_0xc834ec[_0x8d3a('0x2a')],_0xc8208c[_0x8d3a('0x12')],_0xc834ec[_0x8d3a('0x22')]);})[_0x8d3a('0xe')](function(_0x1a46b1){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x2b'),_0x880a06['id']));return _0x880a06[_0x8d3a('0x1b')]({'sentiment':_0x1a46b1[_0x8d3a('0x2c')],'sPositive':_0x1a46b1['SentimentScore'][_0x8d3a('0x2d')],'sNegative':_0x1a46b1[_0x8d3a('0x2e')]['Negative'],'sMixed':_0x1a46b1['SentimentScore'][_0x8d3a('0x2f')],'sNeutral':_0x1a46b1[_0x8d3a('0x2e')][_0x8d3a('0x30')]});})['then'](function(){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x880a06['id']));_0x29b7b9();});case _0x8d3a('0x31'):return _0x880a06[_0x8d3a('0x1b')]({'transcribeStatus':_0x8d3a('0x31'),'failureReason':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x32')]})[_0x8d3a('0xe')](function(){logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x33'),_0x880a06['id']));_0x29b7b9();});default:logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x34'),_0x880a06['id']));break;}}else{return BPromise[_0x8d3a('0x35')]()[_0x8d3a('0xe')](function(){if(!_0x880a06[_0x8d3a('0x1c')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xc834ec['sentiment']||!_0xc834ec[_0x8d3a('0x21')]||!_0xc834ec[_0x8d3a('0x2a')]||!_0xc834ec[_0x8d3a('0x22')]||!_0xc834ec[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x880a06[_0x8d3a('0x12')]){throw new Error(_0x8d3a('0x25'));}if(_0xc834ec[_0x8d3a('0x21')]===_0x43b1ca['id']){return _0x43b1ca;}else{return db[_0x8d3a('0x26')][_0x8d3a('0x36')]({'where':{'id':_settings[_0x8d3a('0x21')]}});}})[_0x8d3a('0xe')](function(_0x3dd0fd){if(!_0x3dd0fd){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x37'));}if(!_0x3dd0fd[_0x8d3a('0xb')]||!_0x3dd0fd['data2']){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x28'));}_0x4759cd=_0x3dd0fd;logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x29'),_0x880a06['id']));return sentiment(_0x4759cd[_0x8d3a('0xb')],_0x4759cd['data2'],_0xc834ec['sentimentRegion'],_0x880a06[_0x8d3a('0x12')],_0xc834ec[_0x8d3a('0x22')]);})[_0x8d3a('0xe')](function(_0x26296a){logger[_0x8d3a('0x9')](util['format'](_0x8d3a('0x2b'),_0x880a06['id']));return _0x880a06[_0x8d3a('0x1b')]({'sentiment':_0x26296a[_0x8d3a('0x2c')],'sPositive':_0x26296a[_0x8d3a('0x2e')]['Positive'],'sNegative':_0x26296a['SentimentScore']['Negative'],'sMixed':_0x26296a[_0x8d3a('0x2e')][_0x8d3a('0x2f')],'sNeutral':_0x26296a[_0x8d3a('0x2e')][_0x8d3a('0x30')],'transcribeStatus':_0x8d3a('0x13')});})[_0x8d3a('0xe')](function(){logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x33'),_0x880a06['id']));_0x29b7b9();});}})['catch'](function(_0x234a0d){if(_0x234a0d){if(!_0x234a0d[_0x8d3a('0x38')]||_0x234a0d[_0x8d3a('0x38')]!==_0x8d3a('0x39')){logger['error'](util[_0x8d3a('0xa')](_0x8d3a('0x3a'),_0x880a06['id']),util[_0x8d3a('0x3b')](_0x234a0d,{'showHidden':![],'depth':null}));}}_0x29b7b9();});});}function checkTranscribe(){var _0x445595;var _0x178be8;var _0x45361c;return db[_0x8d3a('0x3c')][_0x8d3a('0x3d')]({'where':{'transcribeStatus':_0x8d3a('0x3e')}})[_0x8d3a('0xe')](function(_0x4df4d6){if(!_0x4df4d6||!_0x4df4d6[_0x8d3a('0x19')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x3f'));}_0x445595=_0x4df4d6;return db['Setting'][_0x8d3a('0x36')]({'where':{'id':0x1}});})[_0x8d3a('0xe')](function(_0x1ec81d){if(!_0x1ec81d){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x40'));}_0x178be8=_0x1ec81d;if(!_0x178be8[_0x8d3a('0x5')]||!_0x178be8[_0x8d3a('0x41')]||!_0x178be8[_0x8d3a('0xc')]||!_0x178be8[_0x8d3a('0x22')]||!_0x178be8[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x8d3a('0x36')]({'where':{'id':_0x178be8[_0x8d3a('0x41')]}});})[_0x8d3a('0xe')](function(_0x55dd25){if(!_0x55dd25){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x55dd25[_0x8d3a('0xb')]||!_0x55dd25[_0x8d3a('0x27')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x28'));}_0x45361c=_0x55dd25;var _0x336c5a=[];_0x445595['forEach'](function(_0x38c946){_0x336c5a[_0x8d3a('0x42')](checkTranscribeJob(_0x38c946,_0x178be8,_0x45361c));});return BPromise[_0x8d3a('0x43')](_0x336c5a);})['catch'](function(_0x2100ee){if(_0x2100ee){if(!_0x2100ee[_0x8d3a('0x38')]||_0x2100ee['name']!=='SequelizeValidationError'){logger[_0x8d3a('0x44')](util[_0x8d3a('0x3b')](_0x2100ee,{'showHidden':![],'depth':null}));}}});}exports[_0x8d3a('0x45')]=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 99ea6a8..b0b1b62 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 _0x5e35=['../../mysqldb','../logger','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x5e35,0x1af));var _0x55e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5e35[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x55e3('0x0'));var moment=require(_0x55e3('0x1'));var Redis=require(_0x55e3('0x2'));var util=require('util');var config=require(_0x55e3('0x3'));var db=require(_0x55e3('0x4'))['db'];var logger=require(_0x55e3('0x5'))('schedule');config[_0x55e3('0x6')]=_['defaults'](config[_0x55e3('0x6')],{'host':_0x55e3('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x55e3('0x6')]));function closeInteractions(){var _0x46b78c=[];return db[_0x55e3('0x8')][_0x55e3('0x9')]({'raw':!![],'attributes':['id',_0x55e3('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x55e3('0xb')](0x18,_0x55e3('0xc'))}}})['then'](function(_0x153316){if(_0x153316&&_0x153316[_0x55e3('0xd')]){_0x46b78c=_[_0x55e3('0xe')](_0x153316||[],'id');logger[_0x55e3('0xf')](_0x55e3('0x10'),_0x46b78c[_0x55e3('0x11')]());return db[_0x55e3('0x8')][_0x55e3('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x55e3('0x13'))},{'where':{'id':_0x46b78c}});}})[_0x55e3('0x14')](function(){if(_0x46b78c&&_0x46b78c[_0x55e3('0xd')]){logger[_0x55e3('0xf')](_0x55e3('0x15'),_0x46b78c[_0x55e3('0x11')]());for(var _0x2e695a=0x0;_0x2e695a<_0x46b78c[_0x55e3('0xd')];_0x2e695a++){io[_0x55e3('0x16')](_0x55e3('0x17'),{'id':_0x46b78c[_0x2e695a],'closed':!![]});}}})[_0x55e3('0x18')](function(_0x3233fc){logger[_0x55e3('0x19')](_0x55e3('0x1a'),_0x3233fc?util[_0x55e3('0x1b')](_0x3233fc,{'showHidden':![],'depth':null}):'');});}exports[_0x55e3('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc60b=['info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','findAll','lastMsgAt','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xc60b,0x150));var _0xbc60=function(_0x3e0b93,_0x16b1f3){_0x3e0b93=_0x3e0b93-0x0;var _0x11784a=_0xc60b[_0x3e0b93];return _0x11784a;};'use strict';var _=require(_0xbc60('0x0'));var moment=require(_0xbc60('0x1'));var Redis=require(_0xbc60('0x2'));var util=require(_0xbc60('0x3'));var config=require(_0xbc60('0x4'));var db=require(_0xbc60('0x5'))['db'];var logger=require(_0xbc60('0x6'))(_0xbc60('0x7'));config['redis']=_[_0xbc60('0x8')](config[_0xbc60('0x9')],{'host':_0xbc60('0xa'),'port':0x18eb});var io=require(_0xbc60('0xb'))(new Redis(config[_0xbc60('0x9')]));function closeInteractions(){var _0x110958=[];return db['WhatsappInteraction'][_0xbc60('0xc')]({'raw':!![],'attributes':['id',_0xbc60('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xbc60('0xe')](function(_0x137471){if(_0x137471&&_0x137471[_0xbc60('0xf')]){_0x110958=_['map'](_0x137471||[],'id');logger['info'](_0xbc60('0x10'),_0x110958[_0xbc60('0x11')]());return db[_0xbc60('0x12')][_0xbc60('0x13')]({'closeReason':_0xbc60('0x14'),'disposition':_0xbc60('0x15'),'closed':!![],'closedAt':moment()[_0xbc60('0x16')](_0xbc60('0x17'))},{'where':{'id':_0x110958}});}})[_0xbc60('0xe')](function(){if(_0x110958&&_0x110958[_0xbc60('0xf')]){logger[_0xbc60('0x18')](_0xbc60('0x19'),_0x110958[_0xbc60('0x11')]());for(var _0xee46df=0x0;_0xee46df<_0x110958[_0xbc60('0xf')];_0xee46df++){io[_0xbc60('0x1a')](_0xbc60('0x1b'),{'id':_0x110958[_0xee46df],'closed':!![]});}}})['catch'](function(_0xbce107){logger[_0xbc60('0x1c')](_0xbc60('0x1d'),_0xbce107?util['inspect'](_0xbce107,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e69d1a8..caa3b1f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43c2=['Biondo','innocenzo.biondo','@xcally.com','now','then','CmContact','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo'];(function(_0x1b7707,_0x2a84e1){var _0x985bbd=function(_0x3fb0d3){while(--_0x3fb0d3){_0x1b7707['push'](_0x1b7707['shift']());}};_0x985bbd(++_0x2a84e1);}(_0x43c2,0x164));var _0x243c=function(_0x10afb8,_0x5b0437){_0x10afb8=_0x10afb8-0x0;var _0x7c019=_0x43c2[_0x10afb8];return _0x7c019;};'use strict';var util=require(_0x243c('0x0'));var db=require(_0x243c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x243c('0x2')]({'id':i,'firstName':_0x243c('0x3')+i,'lastName':_0x243c('0x4')+i,'phone':0xf879fb460+i,'email':_0x243c('0x5')+i+_0x243c('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x243c('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x243c('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x243c('0x2')]({'id':i,'firstName':_0x243c('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x243c('0x5')+i+_0x243c('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x243c('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x243c('0x7')]()});}db['CmContact']['destroy']({'where':{}})[_0x243c('0x8')](function(){return db[_0x243c('0x9')][_0x243c('0xa')](contacts);})[_0x243c('0x8')](function(){console[_0x243c('0xb')]('finished\x20populating',_0x243c('0xc'));return db[_0x243c('0xd')]['destroy']({'where':{}});})[_0x243c('0x8')](function(){return db[_0x243c('0xd')]['bulkCreate'](hopper);})[_0x243c('0x8')](function(){console[_0x243c('0xb')](_0x243c('0xe'),_0x243c('0xf'));return db[_0x243c('0x9')][_0x243c('0xa')](contacts2);})[_0x243c('0x8')](function(){console[_0x243c('0xb')]('finished\x20populating','contacts2');return db[_0x243c('0xd')]['bulkCreate'](hopper2);})[_0x243c('0x8')](function(){console['log'](_0x243c('0xe'),_0x243c('0x10'));})[_0x243c('0x11')](function(_0x562e13){console['log'](_0x562e13);}); \ No newline at end of file +var _0x3204=['hopper1','contacts2','catch','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','finished\x20populating','contacts1','CmHopper','bulkCreate','log'];(function(_0x495270,_0x1dda10){var _0x136c98=function(_0x17c930){while(--_0x17c930){_0x495270['push'](_0x495270['shift']());}};_0x136c98(++_0x1dda10);}(_0x3204,0x19b));var _0x4320=function(_0x53d38d,_0x423c1f){_0x53d38d=_0x53d38d-0x0;var _0x5d226c=_0x3204[_0x53d38d];return _0x5d226c;};'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[_0x4320('0x0')]({'id':i,'firstName':_0x4320('0x1')+i,'lastName':_0x4320('0x2')+i,'phone':0xf879fb460+i,'email':_0x4320('0x3')+i+_0x4320('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4320('0x0')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4320('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x4320('0x3')+i+_0x4320('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4320('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x4320('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4320('0x5')](),'updatedAt':Date[_0x4320('0x5')]()});}db[_0x4320('0x6')][_0x4320('0x7')]({'where':{}})[_0x4320('0x8')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x4320('0x8')](function(){console['log'](_0x4320('0x9'),_0x4320('0xa'));return db[_0x4320('0xb')][_0x4320('0x7')]({'where':{}});})['then'](function(){return db[_0x4320('0xb')][_0x4320('0xc')](hopper);})[_0x4320('0x8')](function(){console[_0x4320('0xd')](_0x4320('0x9'),_0x4320('0xe'));return db[_0x4320('0x6')][_0x4320('0xc')](contacts2);})[_0x4320('0x8')](function(){console[_0x4320('0xd')](_0x4320('0x9'),_0x4320('0xf'));return db['CmHopper'][_0x4320('0xc')](hopper2);})['then'](function(){console[_0x4320('0xd')](_0x4320('0x9'),'hopper2');})[_0x4320('0x10')](function(_0x47a954){console[_0x4320('0xd')](_0x47a954);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 7a57c0c..0a9443f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bf1=['actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x44ab77,_0x53c1fe){var _0x4e33e4=function(_0x80b0f7){while(--_0x80b0f7){_0x44ab77['push'](_0x44ab77['shift']());}};_0x4e33e4(++_0x53c1fe);}(_0x4bf1,0x1d5));var _0x14bf=function(_0x32672a,_0x1efb7c){_0x32672a=_0x32672a-0x0;var _0x59e960=_0x4bf1[_0x32672a];return _0x59e960;};'use strict';var util=require(_0x14bf('0x0'));var db=require(_0x14bf('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x14bf('0x2')]({'name':util[_0x14bf('0x3')]('%s%s',_0x14bf('0x4'),i),'fullname':util[_0x14bf('0x3')](_0x14bf('0x5'),_0x14bf('0x4'),i),'email':util[_0x14bf('0x3')]('%s%s@xcally.com',_0x14bf('0x4'),i),'role':_0x14bf('0x4'),'password':_0x14bf('0x6'),'internal':0xfa0+i,'type':_0x14bf('0x7'),'transport':[_0x14bf('0x8'),'ws',_0x14bf('0x9')],'disallow':['all'],'allow':[_0x14bf('0xa')],'defaultuser':util[_0x14bf('0x3')]('%s%s',_0x14bf('0x4'),i),'encryption':_0x14bf('0xb'),'avpf':'yes','force_avp':_0x14bf('0xb'),'icesupport':_0x14bf('0xb'),'dtlsenable':_0x14bf('0xb'),'dtlsverify':'no','dtlscertfile':_0x14bf('0xc'),'dtlsprivatekey':_0x14bf('0xd'),'dtlssetup':_0x14bf('0xe'),'callerid':util[_0x14bf('0x3')]('\x22%s\x22\x20<%s>',util[_0x14bf('0x3')]('%s%s',_0x14bf('0x4'),i),0xfa0+i)});}db[_0x14bf('0xf')][_0x14bf('0x10')](users)[_0x14bf('0x11')](function(){console[_0x14bf('0x12')](_0x14bf('0x13'));})[_0x14bf('0x14')](function(_0x1a0881){console[_0x14bf('0x12')](_0x1a0881);}); \ No newline at end of file +var _0x37b8=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','udp'];(function(_0x1e83cb,_0x13f82c){var _0x31ea5f=function(_0x3ea71a){while(--_0x3ea71a){_0x1e83cb['push'](_0x1e83cb['shift']());}};_0x31ea5f(++_0x13f82c);}(_0x37b8,0x138));var _0x837b=function(_0x12db71,_0x4ac41b){_0x12db71=_0x12db71-0x0;var _0x2dacbd=_0x37b8[_0x12db71];return _0x2dacbd;};'use strict';var util=require(_0x837b('0x0'));var db=require(_0x837b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x837b('0x2')]({'name':util[_0x837b('0x3')]('%s%s',_0x837b('0x4'),i),'fullname':util[_0x837b('0x3')](_0x837b('0x5'),_0x837b('0x4'),i),'email':util[_0x837b('0x3')](_0x837b('0x6'),_0x837b('0x4'),i),'role':_0x837b('0x4'),'password':_0x837b('0x7'),'internal':0xfa0+i,'type':_0x837b('0x8'),'transport':[_0x837b('0x9'),'ws',_0x837b('0xa')],'disallow':[_0x837b('0xb')],'allow':[_0x837b('0xc')],'defaultuser':util['format'](_0x837b('0x5'),'agent',i),'encryption':_0x837b('0xd'),'avpf':'yes','force_avp':'yes','icesupport':_0x837b('0xd'),'dtlsenable':_0x837b('0xd'),'dtlsverify':'no','dtlscertfile':_0x837b('0xe'),'dtlsprivatekey':_0x837b('0xf'),'dtlssetup':_0x837b('0x10'),'callerid':util[_0x837b('0x3')](_0x837b('0x11'),util[_0x837b('0x3')](_0x837b('0x5'),'agent',i),0xfa0+i)});}db[_0x837b('0x12')][_0x837b('0x13')](users)[_0x837b('0x14')](function(){console[_0x837b('0x15')](_0x837b('0x16'));})['catch'](function(_0x2f6683){console['log'](_0x2f6683);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 144c64b..8c118e1 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfba8=['type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','SmsQueues','MailQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','role','Campaign','where','format','user:%s','handshake','query','userProfileId','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','ChatQueue','FaxQueues','OpenchannelQueues','WhatsappQueues','Telephones','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','voice','chat','fax','whatsapp','campaign:%s:%s','removeChatInteractions','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','emit','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','setMaxListeners','address','connection','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0xfba8,0x1d6));var _0x8fba=function(_0x302a8a,_0x1bbf19){_0x302a8a=_0x302a8a-0x0;var _0x234e03=_0xfba8[_0x302a8a];return _0x234e03;};'use strict';var _=require(_0x8fba('0x0'));var util=require(_0x8fba('0x1'));var BPromise=require(_0x8fba('0x2'));var db=require(_0x8fba('0x3'))['db'];var config=require(_0x8fba('0x4'));var queryQueues={'attributes':['id',_0x8fba('0x5')],'include':[{'as':_0x8fba('0x6'),'model':db[_0x8fba('0x7')],'attributes':['id',_0x8fba('0x5'),'role'],'raw':!![],'where':{'role':_0x8fba('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8fba('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8fba('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x8fba('0x5')],'where':{'role':_0x8fba('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8fba('0x5'),_0x8fba('0xa')],'where':{'type':_0x8fba('0xb')}};function getAssociatedResources(_0x577834,_0xdc7b43,_0x589ec6){return db[_0x8fba('0xc')][_0x8fba('0xd')]({'where':{'name':_0x577834,'userProfileId':_0xdc7b43},'raw':!![]})[_0x8fba('0xe')](function(_0x139921){if(_0x139921){if(_0x139921['autoAssociation']){switch(_0x577834){case _0x8fba('0xf'):case _0x8fba('0x10'):case'FaxQueues':case _0x8fba('0x11'):case _0x8fba('0x12'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x589ec6][_0x8fba('0x13')](queryQueues);case'Telephones':return db[_0x589ec6][_0x8fba('0x13')](queryTelephones);case _0x8fba('0x14'):return db[_0x589ec6][_0x8fba('0x13')](queryTrunks);case _0x8fba('0x15'):return db[_0x589ec6][_0x8fba('0x13')](queryCampaigns);}}else{return db[_0x8fba('0x16')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x139921['id']},'raw':!![]})[_0x8fba('0xe')](function(_0xbd4229){if(_0xbd4229){var _0x2fa3ed={'where':{'id':_[_0x8fba('0x17')](_0xbd4229,_0x8fba('0x18'))},'raw':!![]};switch(_0x589ec6){case _0x8fba('0x7'):_0x2fa3ed['where'][_0x8fba('0x19')]=_0x8fba('0x9');break;case _0x8fba('0x1a'):_0x2fa3ed[_0x8fba('0x1b')][_0x8fba('0xa')]=_0x8fba('0xb');break;}return db[_0x589ec6][_0x8fba('0x13')](_0x2fa3ed);}else{return[];}});}}else{return[];}})[_0x8fba('0xe')](function(_0x5e9991){return _0x5e9991;});}function joinOrLeaveQueues(_0x2564cc,_0x1eaeb1,_0x7beb17,_0x1acc72){_0x2564cc[_0x1eaeb1](util[_0x8fba('0x1c')]('%s:queue:%s',_0x7beb17,_0x1acc72[_0x8fba('0x5')]));if(_0x1acc72[_0x8fba('0x6')]){for(var _0x532406=0x0;_0x532406<_0x1acc72[_0x8fba('0x6')]['length'];_0x532406+=0x1){_0x2564cc[_0x1eaeb1](util['format'](_0x8fba('0x1d'),_0x1acc72['Agents'][_0x532406][_0x8fba('0x5')]));}}}function joinOrLeave(_0xb37b7b,_0x393f24,_0x2f3225){var _0x52eebd;if(_0xb37b7b[_0x8fba('0x1e')][_0x8fba('0x1f')]['id']){db[_0x8fba('0x7')]['find']({'attributes':['id',_0x8fba('0x5'),'role',_0x8fba('0x20')],'where':{'id':_0xb37b7b[_0x8fba('0x1e')][_0x8fba('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8fba('0x21')],'as':_0x8fba('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x8fba('0x23')],'as':_0x8fba('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x8fba('0x25')],'as':_0x8fba('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8fba('0x27')],'as':_0x8fba('0x28'),'attributes':['id'],'raw':!![]}]})[_0x8fba('0xe')](function(_0x20fd52){if(_0x20fd52){_0x52eebd=_0x20fd52;_0xb37b7b[_0x393f24](util[_0x8fba('0x1c')](_0x8fba('0x1d'),_0x20fd52[_0x8fba('0x5')]));var _0x17e11b=[];switch(_0x20fd52['role']){case _0x8fba('0x29'):_0xb37b7b[_0x393f24]('voice:inbound');_0xb37b7b[_0x393f24](_0x8fba('0x2a'));if(queryQueues[_0x8fba('0x2b')](_0x8fba('0x2c'))){delete queryQueues[_0x8fba('0x2c')];}_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x2e')][_0x8fba('0x13')](queryQueues));_0x17e11b['push'](db['ChatQueue'][_0x8fba('0x13')](queryQueues));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x2f')][_0x8fba('0x13')](queryQueues));_0x17e11b['push'](db[_0x8fba('0x30')][_0x8fba('0x13')](queryQueues));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x31')][_0x8fba('0x13')](queryQueues));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x32')][_0x8fba('0x13')](queryQueues));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x33')][_0x8fba('0x13')](queryQueues));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x7')][_0x8fba('0x13')](queryTelephones));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x34')]['findAll'](queryTrunks));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x1a')][_0x8fba('0x13')](queryCampaigns));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x7')]['findAll'](queryAgents));break;case _0x8fba('0x35'):_0xb37b7b[_0x393f24](_0x8fba('0x36'));_0xb37b7b[_0x393f24](_0x8fba('0x2a'));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources('VoiceQueues',_0x20fd52[_0x8fba('0x20')],'VoiceQueue'));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources(_0x8fba('0x10'),_0x20fd52[_0x8fba('0x20')],_0x8fba('0x37')));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources(_0x8fba('0x38'),_0x20fd52['userProfileId'],_0x8fba('0x2f')));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources(_0x8fba('0x11'),_0x20fd52[_0x8fba('0x20')],_0x8fba('0x30')));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources(_0x8fba('0x12'),_0x20fd52[_0x8fba('0x20')],_0x8fba('0x31')));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources(_0x8fba('0x39'),_0x20fd52[_0x8fba('0x20')],_0x8fba('0x32')));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources(_0x8fba('0x3a'),_0x20fd52['userProfileId'],'WhatsappQueue'));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources(_0x8fba('0x3b'),_0x20fd52['userProfileId'],_0x8fba('0x7')));_0x17e11b['push'](getAssociatedResources('Trunks',_0x20fd52[_0x8fba('0x20')],_0x8fba('0x34')));_0x17e11b[_0x8fba('0x2d')](getAssociatedResources(_0x8fba('0x15'),_0x20fd52['userProfileId'],_0x8fba('0x1a')));_0x17e11b[_0x8fba('0x2d')](db[_0x8fba('0x7')][_0x8fba('0x13')](queryAgents));break;case'agent':_0xb37b7b[_0x393f24](_0x8fba('0x36'));_0xb37b7b[_0x393f24](_0x8fba('0x2a'));_0x17e11b[_0x8fba('0x2d')](_0x20fd52[_0x8fba('0x3c')]({'attributes':['id',_0x8fba('0x5')]}));_0x17e11b['push'](_0x20fd52[_0x8fba('0x3d')]({'attributes':['id',_0x8fba('0x5')]}));_0x17e11b[_0x8fba('0x2d')](_0x20fd52['getFaxQueues']({'attributes':['id',_0x8fba('0x5')]}));_0x17e11b['push'](_0x20fd52[_0x8fba('0x3e')]({'attributes':['id',_0x8fba('0x5')]}));_0x17e11b[_0x8fba('0x2d')](_0x20fd52[_0x8fba('0x3f')]({'attributes':['id',_0x8fba('0x5')]}));_0x17e11b[_0x8fba('0x2d')](_0x20fd52[_0x8fba('0x40')]({'attributes':['id',_0x8fba('0x5')]}));_0x17e11b[_0x8fba('0x2d')](_0x20fd52['getWhatsappQueues']({'attributes':['id',_0x8fba('0x5')]}));break;}return BPromise['all'](_0x17e11b);}})[_0x8fba('0xe')](function(_0x92face){if(_0x92face&&_0x92face[_0x8fba('0x41')]){for(var _0x575df2=0x0;_0x575df2<_0x92face[_0x8fba('0x41')];_0x575df2+=0x1){for(var _0x294608=0x0;_0x294608<_0x92face[_0x575df2][_0x8fba('0x41')];_0x294608+=0x1){switch(_0x575df2){case 0x0:joinOrLeaveQueues(_0xb37b7b,_0x393f24,_0x8fba('0x42'),_0x92face[_0x575df2][_0x294608]);break;case 0x1:joinOrLeaveQueues(_0xb37b7b,_0x393f24,_0x8fba('0x43'),_0x92face[_0x575df2][_0x294608]);break;case 0x2:joinOrLeaveQueues(_0xb37b7b,_0x393f24,_0x8fba('0x44'),_0x92face[_0x575df2][_0x294608]);break;case 0x3:joinOrLeaveQueues(_0xb37b7b,_0x393f24,'sms',_0x92face[_0x575df2][_0x294608]);break;case 0x4:joinOrLeaveQueues(_0xb37b7b,_0x393f24,'mail',_0x92face[_0x575df2][_0x294608]);break;case 0x5:joinOrLeaveQueues(_0xb37b7b,_0x393f24,'openchannel',_0x92face[_0x575df2][_0x294608]);break;case 0x6:joinOrLeaveQueues(_0xb37b7b,_0x393f24,_0x8fba('0x45'),_0x92face[_0x575df2][_0x294608]);break;case 0x7:if(_0x52eebd[_0x8fba('0x19')]!==_0x8fba('0x8'))_0xb37b7b[_0x393f24](util['format']('telephone:%s',_0x92face[_0x575df2][_0x294608]['name']));break;case 0x8:if(_0x52eebd[_0x8fba('0x19')]!==_0x8fba('0x8'))_0xb37b7b[_0x393f24](util[_0x8fba('0x1c')]('trunk:%s',_0x92face[_0x575df2][_0x294608][_0x8fba('0x5')]));break;case 0x9:if(_0x52eebd['role']!==_0x8fba('0x8'))_0xb37b7b[_0x393f24](util[_0x8fba('0x1c')](_0x8fba('0x46'),_0x92face[_0x575df2][_0x294608][_0x8fba('0xa')],_0x92face[_0x575df2][_0x294608][_0x8fba('0x5')]));break;case 0xa:_0xb37b7b[_0x393f24](util[_0x8fba('0x1c')](_0x8fba('0x1d'),_0x92face[_0x575df2][_0x294608][_0x8fba('0x5')]));break;}}}}})['then'](function(){if(_0x393f24==='leave'){var _0x25c6d2=_[_0x8fba('0x17')](_0x52eebd['ChatInteractions'],'id');return _0x52eebd[_0x8fba('0x47')](_0x25c6d2)['then'](function(){for(var _0x31d60d=0x0;_0x31d60d<_0x25c6d2['length'];_0x31d60d+=0x1){_0x2f3225['emit'](_0x8fba('0x48'),{'ChatInteractionId':Number(_0x25c6d2[_0x31d60d]),'UserId':Number(_0x52eebd['id'])});}});}})['then'](function(){if(_0x393f24===_0x8fba('0x49')){var _0x24201a=_[_0x8fba('0x17')](_0x52eebd['MailInteractions'],'id');return _0x52eebd[_0x8fba('0x4a')](_0x24201a)['then'](function(){for(var _0x55b608=0x0;_0x55b608<_0x24201a[_0x8fba('0x41')];_0x55b608+=0x1){_0x2f3225['emit'](_0x8fba('0x4b'),{'MailInteractionId':Number(_0x24201a[_0x55b608]),'UserId':Number(_0x52eebd['id'])});}});}})[_0x8fba('0xe')](function(){if(_0x393f24==='leave'){var _0x13a2ed=_[_0x8fba('0x17')](_0x52eebd[_0x8fba('0x24')],'id');return _0x52eebd['removeFaxInteractions'](_0x13a2ed)['then'](function(){for(var _0x343f6e=0x0;_0x343f6e<_0x13a2ed[_0x8fba('0x41')];_0x343f6e+=0x1){_0x2f3225['emit'](_0x8fba('0x4c'),{'FaxInteractionId':Number(_0x13a2ed[_0x343f6e]),'UserId':Number(_0x52eebd['id'])});}});}})[_0x8fba('0xe')](function(){if(_0x393f24===_0x8fba('0x49')){var _0x43a91d=_['map'](_0x52eebd[_0x8fba('0x26')],'id');return _0x52eebd[_0x8fba('0x4d')](_0x43a91d)[_0x8fba('0xe')](function(){for(var _0x30c044=0x0;_0x30c044<_0x43a91d[_0x8fba('0x41')];_0x30c044+=0x1){_0x2f3225[_0x8fba('0x4e')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x43a91d[_0x30c044]),'UserId':Number(_0x52eebd['id'])});}});}})['then'](function(){if(_0x393f24===_0x8fba('0x49')){var _0x34c730=_['map'](_0x52eebd['OpenchannelInteractions'],'id');return _0x52eebd[_0x8fba('0x4f')](_0x34c730)['then'](function(){for(var _0x2bd55e=0x0;_0x2bd55e<_0x34c730[_0x8fba('0x41')];_0x2bd55e+=0x1){_0x2f3225[_0x8fba('0x4e')](_0x8fba('0x50'),{'OpenchannelInteractionId':Number(_0x34c730[_0x2bd55e]),'UserId':Number(_0x52eebd['id'])});}});}})[_0x8fba('0xe')](function(){if(_0x393f24==='leave'){var _0x285873=_[_0x8fba('0x17')](_0x52eebd[_0x8fba('0x28')],'id');return _0x52eebd[_0x8fba('0x51')](_0x285873)[_0x8fba('0xe')](function(){for(var _0xa3e78c=0x0;_0xa3e78c<_0x285873[_0x8fba('0x41')];_0xa3e78c+=0x1){_0x2f3225[_0x8fba('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x285873[_0xa3e78c]),'UserId':Number(_0x52eebd['id'])});}});}})[_0x8fba('0x52')](function(_0x43e23a){_0xb37b7b[_0x8fba('0x53')](_0x43e23a);});}}function onDisconnect(_0x2ce5ea,_0x555289){joinOrLeave(_0x2ce5ea,_0x8fba('0x49'),_0x555289);}function onConnect(_0x5d3507){joinOrLeave(_0x5d3507,_0x8fba('0x54'));}exports[_0x8fba('0x55')]=function(_0x4a38ba){_0x4a38ba['on']('connection',function(_0x37030c){_0x37030c[_0x8fba('0x56')](0x0);_0x37030c[_0x8fba('0x57')]=_0x37030c['request'][_0x8fba('0x58')][_0x8fba('0x59')]+':'+_0x37030c[_0x8fba('0x5a')][_0x8fba('0x58')][_0x8fba('0x5b')];_0x37030c[_0x8fba('0x5c')]=new Date();_0x37030c[_0x8fba('0x53')]=function(_0x4c3f58){console['log'](_0x8fba('0x5d')+_0x37030c[_0x8fba('0x5e')][_0x8fba('0x5')]+'['+_0x37030c[_0x8fba('0x57')]+']',_0x4c3f58);};_0x37030c['on'](_0x8fba('0x5f'),function(){onDisconnect(_0x37030c,_0x4a38ba);_0x37030c[_0x8fba('0x53')]('DISCONNECTED');});onConnect(_0x37030c);_0x37030c['log']('CONNECTED');});}; \ No newline at end of file +var _0xdeb3=['WhatsappQueues','findAll','IvrCampaigns','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueues','Telephones','Trunks','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','remoteAddress','request','connectedAt','SocketIO\x20','disconnect','util','bluebird','../mysqldb','Agents','User','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdeb3,0xb7));var _0x3deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var BPromise=require(_0x3deb('0x1'));var db=require(_0x3deb('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x3deb('0x3'),'model':db[_0x3deb('0x4')],'attributes':['id',_0x3deb('0x5'),_0x3deb('0x6')],'raw':!![],'where':{'role':_0x3deb('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x3deb('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x3deb('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3deb('0x5'),_0x3deb('0x9')],'where':{'type':_0x3deb('0xa')}};function getAssociatedResources(_0xacb749,_0x2eb451,_0x1a4974){return db[_0x3deb('0xb')][_0x3deb('0xc')]({'where':{'name':_0xacb749,'userProfileId':_0x2eb451},'raw':!![]})[_0x3deb('0xd')](function(_0x54b603){if(_0x54b603){if(_0x54b603['autoAssociation']){switch(_0xacb749){case _0x3deb('0xe'):case _0x3deb('0xf'):case _0x3deb('0x10'):case'SmsQueues':case _0x3deb('0x11'):case _0x3deb('0x12'):case _0x3deb('0x13'):return db[_0x1a4974][_0x3deb('0x14')](queryQueues);case'Telephones':return db[_0x1a4974]['findAll'](queryTelephones);case'Trunks':return db[_0x1a4974][_0x3deb('0x14')](queryTrunks);case _0x3deb('0x15'):return db[_0x1a4974][_0x3deb('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x3deb('0x14')]({'attributes':[_0x3deb('0x16')],'where':{'sectionId':_0x54b603['id']},'raw':!![]})['then'](function(_0x24b516){if(_0x24b516){var _0x3210e7={'where':{'id':_['map'](_0x24b516,_0x3deb('0x16'))},'raw':!![]};switch(_0x1a4974){case'User':_0x3210e7[_0x3deb('0x17')]['role']='telephone';break;case _0x3deb('0x18'):_0x3210e7[_0x3deb('0x17')][_0x3deb('0x9')]=_0x3deb('0xa');break;}return db[_0x1a4974][_0x3deb('0x14')](_0x3210e7);}else{return[];}});}}else{return[];}})[_0x3deb('0xd')](function(_0x4c8242){return _0x4c8242;});}function joinOrLeaveQueues(_0x311a48,_0x3dd066,_0x4a1173,_0x3eb5fb){_0x311a48[_0x3dd066](util[_0x3deb('0x19')](_0x3deb('0x1a'),_0x4a1173,_0x3eb5fb[_0x3deb('0x5')]));if(_0x3eb5fb[_0x3deb('0x3')]){for(var _0x583dce=0x0;_0x583dce<_0x3eb5fb[_0x3deb('0x3')][_0x3deb('0x1b')];_0x583dce+=0x1){_0x311a48[_0x3dd066](util[_0x3deb('0x19')](_0x3deb('0x1c'),_0x3eb5fb[_0x3deb('0x3')][_0x583dce][_0x3deb('0x5')]));}}}function joinOrLeave(_0x1eaa8f,_0x1f535e,_0x42a8d5){var _0x487283;if(_0x1eaa8f[_0x3deb('0x1d')]['query']['id']){db[_0x3deb('0x4')][_0x3deb('0x1e')]({'attributes':['id',_0x3deb('0x5'),_0x3deb('0x6'),_0x3deb('0x1f')],'where':{'id':_0x1eaa8f[_0x3deb('0x1d')][_0x3deb('0x20')]['id']},'include':[{'model':db[_0x3deb('0x21')],'as':_0x3deb('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x3deb('0x23')],'as':_0x3deb('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x3deb('0x25')],'as':_0x3deb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x3deb('0x27')],'as':_0x3deb('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x3deb('0x29')],'as':_0x3deb('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x3deb('0x2b')],'as':_0x3deb('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x3deb('0xd')](function(_0x4c72c7){if(_0x4c72c7){_0x487283=_0x4c72c7;_0x1eaa8f[_0x1f535e](util[_0x3deb('0x19')](_0x3deb('0x1c'),_0x4c72c7['name']));var _0x8ef0b3=[];switch(_0x4c72c7['role']){case _0x3deb('0x2d'):_0x1eaa8f[_0x1f535e](_0x3deb('0x2e'));_0x1eaa8f[_0x1f535e](_0x3deb('0x2f'));if(queryQueues[_0x3deb('0x30')](_0x3deb('0x31'))){delete queryQueues[_0x3deb('0x31')];}_0x8ef0b3['push'](db[_0x3deb('0x32')][_0x3deb('0x14')](queryQueues));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x34')][_0x3deb('0x14')](queryQueues));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x35')][_0x3deb('0x14')](queryQueues));_0x8ef0b3['push'](db[_0x3deb('0x36')][_0x3deb('0x14')](queryQueues));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x37')][_0x3deb('0x14')](queryQueues));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x38')][_0x3deb('0x14')](queryQueues));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x39')][_0x3deb('0x14')](queryQueues));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x4')][_0x3deb('0x14')](queryTelephones));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x3a')][_0x3deb('0x14')](queryTrunks));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x18')]['findAll'](queryCampaigns));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x4')][_0x3deb('0x14')](queryAgents));break;case _0x3deb('0x3b'):_0x1eaa8f[_0x1f535e]('voice:inbound');_0x1eaa8f[_0x1f535e](_0x3deb('0x2f'));_0x8ef0b3[_0x3deb('0x33')](getAssociatedResources(_0x3deb('0xe'),_0x4c72c7[_0x3deb('0x1f')],_0x3deb('0x32')));_0x8ef0b3['push'](getAssociatedResources('ChatQueues',_0x4c72c7[_0x3deb('0x1f')],_0x3deb('0x34')));_0x8ef0b3[_0x3deb('0x33')](getAssociatedResources(_0x3deb('0x10'),_0x4c72c7[_0x3deb('0x1f')],_0x3deb('0x35')));_0x8ef0b3[_0x3deb('0x33')](getAssociatedResources(_0x3deb('0x3c'),_0x4c72c7[_0x3deb('0x1f')],_0x3deb('0x36')));_0x8ef0b3[_0x3deb('0x33')](getAssociatedResources('MailQueues',_0x4c72c7[_0x3deb('0x1f')],_0x3deb('0x37')));_0x8ef0b3[_0x3deb('0x33')](getAssociatedResources(_0x3deb('0x12'),_0x4c72c7[_0x3deb('0x1f')],_0x3deb('0x38')));_0x8ef0b3[_0x3deb('0x33')](getAssociatedResources('WhatsappQueues',_0x4c72c7['userProfileId'],_0x3deb('0x39')));_0x8ef0b3[_0x3deb('0x33')](getAssociatedResources(_0x3deb('0x3d'),_0x4c72c7[_0x3deb('0x1f')],'User'));_0x8ef0b3[_0x3deb('0x33')](getAssociatedResources(_0x3deb('0x3e'),_0x4c72c7[_0x3deb('0x1f')],_0x3deb('0x3a')));_0x8ef0b3['push'](getAssociatedResources(_0x3deb('0x15'),_0x4c72c7['userProfileId'],'Campaign'));_0x8ef0b3[_0x3deb('0x33')](db[_0x3deb('0x4')]['findAll'](queryAgents));break;case _0x3deb('0x7'):_0x1eaa8f[_0x1f535e](_0x3deb('0x2e'));_0x1eaa8f[_0x1f535e](_0x3deb('0x2f'));_0x8ef0b3[_0x3deb('0x33')](_0x4c72c7[_0x3deb('0x3f')]({'attributes':['id','name']}));_0x8ef0b3[_0x3deb('0x33')](_0x4c72c7[_0x3deb('0x40')]({'attributes':['id','name']}));_0x8ef0b3['push'](_0x4c72c7['getFaxQueues']({'attributes':['id',_0x3deb('0x5')]}));_0x8ef0b3[_0x3deb('0x33')](_0x4c72c7[_0x3deb('0x41')]({'attributes':['id',_0x3deb('0x5')]}));_0x8ef0b3['push'](_0x4c72c7[_0x3deb('0x42')]({'attributes':['id',_0x3deb('0x5')]}));_0x8ef0b3[_0x3deb('0x33')](_0x4c72c7[_0x3deb('0x43')]({'attributes':['id','name']}));_0x8ef0b3['push'](_0x4c72c7[_0x3deb('0x44')]({'attributes':['id',_0x3deb('0x5')]}));break;}return BPromise['all'](_0x8ef0b3);}})['then'](function(_0x83f142){if(_0x83f142&&_0x83f142['length']){for(var _0x294203=0x0;_0x294203<_0x83f142[_0x3deb('0x1b')];_0x294203+=0x1){for(var _0x52a8b6=0x0;_0x52a8b6<_0x83f142[_0x294203][_0x3deb('0x1b')];_0x52a8b6+=0x1){switch(_0x294203){case 0x0:joinOrLeaveQueues(_0x1eaa8f,_0x1f535e,_0x3deb('0x45'),_0x83f142[_0x294203][_0x52a8b6]);break;case 0x1:joinOrLeaveQueues(_0x1eaa8f,_0x1f535e,_0x3deb('0x46'),_0x83f142[_0x294203][_0x52a8b6]);break;case 0x2:joinOrLeaveQueues(_0x1eaa8f,_0x1f535e,_0x3deb('0x47'),_0x83f142[_0x294203][_0x52a8b6]);break;case 0x3:joinOrLeaveQueues(_0x1eaa8f,_0x1f535e,_0x3deb('0x48'),_0x83f142[_0x294203][_0x52a8b6]);break;case 0x4:joinOrLeaveQueues(_0x1eaa8f,_0x1f535e,_0x3deb('0x49'),_0x83f142[_0x294203][_0x52a8b6]);break;case 0x5:joinOrLeaveQueues(_0x1eaa8f,_0x1f535e,_0x3deb('0x4a'),_0x83f142[_0x294203][_0x52a8b6]);break;case 0x6:joinOrLeaveQueues(_0x1eaa8f,_0x1f535e,_0x3deb('0x4b'),_0x83f142[_0x294203][_0x52a8b6]);break;case 0x7:if(_0x487283[_0x3deb('0x6')]!==_0x3deb('0x7'))_0x1eaa8f[_0x1f535e](util[_0x3deb('0x19')](_0x3deb('0x4c'),_0x83f142[_0x294203][_0x52a8b6][_0x3deb('0x5')]));break;case 0x8:if(_0x487283['role']!=='agent')_0x1eaa8f[_0x1f535e](util[_0x3deb('0x19')]('trunk:%s',_0x83f142[_0x294203][_0x52a8b6]['name']));break;case 0x9:if(_0x487283[_0x3deb('0x6')]!==_0x3deb('0x7'))_0x1eaa8f[_0x1f535e](util[_0x3deb('0x19')](_0x3deb('0x4d'),_0x83f142[_0x294203][_0x52a8b6]['type'],_0x83f142[_0x294203][_0x52a8b6][_0x3deb('0x5')]));break;case 0xa:_0x1eaa8f[_0x1f535e](util[_0x3deb('0x19')](_0x3deb('0x1c'),_0x83f142[_0x294203][_0x52a8b6][_0x3deb('0x5')]));break;}}}}})['then'](function(){if(_0x1f535e===_0x3deb('0x4e')){var _0x4f4e65=_[_0x3deb('0x4f')](_0x487283[_0x3deb('0x22')],'id');return _0x487283['removeChatInteractions'](_0x4f4e65)[_0x3deb('0xd')](function(){for(var _0x3d8277=0x0;_0x3d8277<_0x4f4e65[_0x3deb('0x1b')];_0x3d8277+=0x1){_0x42a8d5[_0x3deb('0x50')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4f4e65[_0x3d8277]),'UserId':Number(_0x487283['id'])});}});}})[_0x3deb('0xd')](function(){if(_0x1f535e===_0x3deb('0x4e')){var _0x4595a3=_[_0x3deb('0x4f')](_0x487283[_0x3deb('0x24')],'id');return _0x487283[_0x3deb('0x51')](_0x4595a3)['then'](function(){for(var _0x29a829=0x0;_0x29a829<_0x4595a3[_0x3deb('0x1b')];_0x29a829+=0x1){_0x42a8d5['emit'](_0x3deb('0x52'),{'MailInteractionId':Number(_0x4595a3[_0x29a829]),'UserId':Number(_0x487283['id'])});}});}})[_0x3deb('0xd')](function(){if(_0x1f535e==='leave'){var _0x233da5=_[_0x3deb('0x4f')](_0x487283[_0x3deb('0x26')],'id');return _0x487283[_0x3deb('0x53')](_0x233da5)[_0x3deb('0xd')](function(){for(var _0x573770=0x0;_0x573770<_0x233da5['length'];_0x573770+=0x1){_0x42a8d5['emit'](_0x3deb('0x54'),{'FaxInteractionId':Number(_0x233da5[_0x573770]),'UserId':Number(_0x487283['id'])});}});}})[_0x3deb('0xd')](function(){if(_0x1f535e===_0x3deb('0x4e')){var _0x551d28=_[_0x3deb('0x4f')](_0x487283[_0x3deb('0x28')],'id');return _0x487283[_0x3deb('0x55')](_0x551d28)[_0x3deb('0xd')](function(){for(var _0x59dca1=0x0;_0x59dca1<_0x551d28['length'];_0x59dca1+=0x1){_0x42a8d5[_0x3deb('0x50')](_0x3deb('0x56'),{'SmsInteractionId':Number(_0x551d28[_0x59dca1]),'UserId':Number(_0x487283['id'])});}});}})[_0x3deb('0xd')](function(){if(_0x1f535e===_0x3deb('0x4e')){var _0x1dc959=_[_0x3deb('0x4f')](_0x487283[_0x3deb('0x2a')],'id');return _0x487283[_0x3deb('0x57')](_0x1dc959)[_0x3deb('0xd')](function(){for(var _0x1dc872=0x0;_0x1dc872<_0x1dc959[_0x3deb('0x1b')];_0x1dc872+=0x1){_0x42a8d5[_0x3deb('0x50')](_0x3deb('0x58'),{'OpenchannelInteractionId':Number(_0x1dc959[_0x1dc872]),'UserId':Number(_0x487283['id'])});}});}})['then'](function(){if(_0x1f535e===_0x3deb('0x4e')){var _0x2afd85=_[_0x3deb('0x4f')](_0x487283[_0x3deb('0x2c')],'id');return _0x487283['removeWhatsappInteractions'](_0x2afd85)[_0x3deb('0xd')](function(){for(var _0x40886a=0x0;_0x40886a<_0x2afd85[_0x3deb('0x1b')];_0x40886a+=0x1){_0x42a8d5['emit'](_0x3deb('0x59'),{'WhatsappInteractionId':Number(_0x2afd85[_0x40886a]),'UserId':Number(_0x487283['id'])});}});}})[_0x3deb('0x5a')](function(_0x3a97d5){_0x1eaa8f[_0x3deb('0x5b')](_0x3a97d5);});}}function onDisconnect(_0x2194cf,_0x5666b3){joinOrLeave(_0x2194cf,_0x3deb('0x4e'),_0x5666b3);}function onConnect(_0xa862f7){joinOrLeave(_0xa862f7,_0x3deb('0x5c'));}exports[_0x3deb('0x5d')]=function(_0x4014fc){_0x4014fc['on'](_0x3deb('0x5e'),function(_0x56beb0){_0x56beb0['setMaxListeners'](0x0);_0x56beb0[_0x3deb('0x5f')]=_0x56beb0['request'][_0x3deb('0x5e')][_0x3deb('0x60')]+':'+_0x56beb0[_0x3deb('0x61')][_0x3deb('0x5e')]['remotePort'];_0x56beb0[_0x3deb('0x62')]=new Date();_0x56beb0[_0x3deb('0x5b')]=function(_0x8c4f5d){console[_0x3deb('0x5b')](_0x3deb('0x63')+_0x56beb0['nsp'][_0x3deb('0x5')]+'['+_0x56beb0[_0x3deb('0x5f')]+']',_0x8c4f5d);};_0x56beb0['on'](_0x3deb('0x64'),function(){onDisconnect(_0x56beb0,_0x4014fc);_0x56beb0[_0x3deb('0x5b')]('DISCONNECTED');});onConnect(_0x56beb0);_0x56beb0['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 37ac3d0..79a6a7d 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 _0x2f83=['OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','catch','channel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','then','UserId','User','find','name','fullname','email','internal','interface','format','SIP/%s','incomingmessage','outgoingmessage','get','opened','ContactId','Sequelize','QueryTypes','contact','changed','closed','agent','default','length','hasOwnProperty','hook','callback','toLowerCase','condition','util','../logger','triggers','lodash','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction'];(function(_0xa46b86,_0x5c1465){var _0x417360=function(_0x4800d1){while(--_0x4800d1){_0xa46b86['push'](_0xa46b86['shift']());}};_0x417360(++_0x5c1465);}(_0x2f83,0x1d0));var _0x32f8=function(_0x1bbce7,_0x581b65){_0x1bbce7=_0x1bbce7-0x0;var _0xe3a3ef=_0x2f83[_0x1bbce7];return _0xe3a3ef;};'use strict';var util=require(_0x32f8('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0x32f8('0x1'))(_0x32f8('0x2'));var _=require(_0x32f8('0x3'));var client=jayson[_0x32f8('0x4')][_0x32f8('0x5')]({'port':0x232a});var triggers=[{'channel':_0x32f8('0x6'),'model':_0x32f8('0x7'),'event':_0x32f8('0x8'),'condition':_0x32f8('0x9'),'callback':afterCreate},{'channel':_0x32f8('0x6'),'model':_0x32f8('0x7'),'event':_0x32f8('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0x32f8('0xb'),'event':_0x32f8('0x8'),'condition':_0x32f8('0xc'),'callback':afterCreateMessage},{'channel':_0x32f8('0xd'),'model':_0x32f8('0xe'),'event':_0x32f8('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x32f8('0xd'),'model':_0x32f8('0xe'),'event':_0x32f8('0xa'),'condition':_0x32f8('0xf'),'callback':afterUpdate},{'channel':'Sms','model':_0x32f8('0x10'),'event':_0x32f8('0x8'),'condition':_0x32f8('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x32f8('0x8'),'condition':_0x32f8('0x9'),'callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x32f8('0xa'),'condition':_0x32f8('0xf'),'callback':afterUpdate},{'channel':_0x32f8('0x11'),'model':_0x32f8('0x12'),'event':_0x32f8('0x8'),'condition':_0x32f8('0xc'),'callback':afterCreateMessage},{'channel':_0x32f8('0x13'),'model':_0x32f8('0x14'),'event':'afterCreate','condition':_0x32f8('0x9'),'callback':afterCreate},{'channel':_0x32f8('0x13'),'model':_0x32f8('0x14'),'event':_0x32f8('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x32f8('0x8'),'condition':_0x32f8('0xc'),'callback':afterCreateMessage},{'channel':_0x32f8('0x15'),'model':_0x32f8('0x16'),'event':_0x32f8('0x8'),'condition':_0x32f8('0x9'),'callback':afterCreate},{'channel':_0x32f8('0x15'),'model':_0x32f8('0x16'),'event':_0x32f8('0xa'),'condition':_0x32f8('0xf'),'callback':afterUpdate},{'channel':_0x32f8('0x15'),'model':_0x32f8('0x17'),'event':'afterCreate','condition':_0x32f8('0xc'),'callback':afterCreateMessage},{'channel':_0x32f8('0x18'),'model':_0x32f8('0x19'),'event':_0x32f8('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x32f8('0x18'),'model':_0x32f8('0x19'),'event':_0x32f8('0xa'),'condition':_0x32f8('0xf'),'callback':afterUpdate},{'channel':_0x32f8('0x18'),'model':_0x32f8('0x1a'),'event':'afterCreate','condition':_0x32f8('0xc'),'callback':afterCreateMessage}];function request(_0x376bd8){return client[_0x32f8('0x1b')](_0x32f8('0x1c'),_0x376bd8)['then'](function(_0x26f99a){logger[_0x32f8('0x1d')](_0x32f8('0x1e'),_0x32f8('0x1c'),_0x26f99a);if(_0x26f99a[_0x32f8('0x1f')]){if(_0x26f99a[_0x32f8('0x1f')][_0x32f8('0x20')]===0x1f4){logger['error'](_0x32f8('0x1e'),_0x32f8('0x1c'),_0x26f99a[_0x32f8('0x1f')]);}}})[_0x32f8('0x21')](function(_0xa5776e){logger[_0x32f8('0x1f')](_0x32f8('0x1e'),_0x32f8('0x1c'),_0xa5776e);});}function afterCreateMessage(_0x24a8d9,_0x246d78){return function(_0x1986a3,_0x3909cd){_0x1986a3=_0x1986a3['get']({'plain':!![]});_0x1986a3[_0x32f8('0x22')]=_0x24a8d9;_0x1986a3[_0x32f8('0x23')]=_0x1986a3[_0x32f8('0x24')];var _0x28b859=_0x32f8('0x25')+_0x1986a3['ContactId'];return db[_0x32f8('0x26')][_0x32f8('0x27')](_0x28b859,{'type':db['Sequelize']['QueryTypes'][_0x32f8('0x28')],'raw':!![]})[_0x32f8('0x29')](function(_0xddcbcd){return _0xddcbcd;})['then'](function(_0x4cabb){if(_0x4cabb){_0x1986a3['contact']=_0x4cabb[0x0];}if(_0x1986a3[_0x32f8('0x2a')]){return db[_0x32f8('0x2b')][_0x32f8('0x2c')]({'where':{'id':_0x1986a3[_0x32f8('0x2a')]},'attributes':['id',_0x32f8('0x2d'),_0x32f8('0x2e'),_0x32f8('0x2f'),_0x32f8('0x30')],'raw':!![]})[_0x32f8('0x29')](function(_0x3b0ee1){_0x1986a3[_0x32f8('0x31')]=util[_0x32f8('0x32')](_0x32f8('0x33'),_0x3b0ee1[_0x32f8('0x2d')]);_0x1986a3[_0x32f8('0x22')]=_0x24a8d9;_0x1986a3['agent']=_0x3b0ee1;return request({'event':_0x32f8('0x34'),'message':_0x1986a3});})[_0x32f8('0x21')](function(_0x208319){console[_0x32f8('0x1f')](_0x208319);});}else{return request({'event':_0x32f8('0x35'),'message':_0x1986a3});}});};}function afterCreate(_0x2694cf,_0x59ed03){return function(_0x2715eb,_0x5f6ecd){_0x2715eb=_0x2715eb[_0x32f8('0x36')]({'plain':!![]});_0x2715eb[_0x32f8('0x22')]=_0x2694cf;_0x2715eb[_0x32f8('0x23')]=_0x32f8('0x37');var _0x2bdf58='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2715eb[_0x32f8('0x38')];return db[_0x32f8('0x26')]['query'](_0x2bdf58,{'type':db[_0x32f8('0x39')][_0x32f8('0x3a')][_0x32f8('0x28')],'raw':!![]})[_0x32f8('0x29')](function(_0xcaa1e9){return _0xcaa1e9;})[_0x32f8('0x29')](function(_0x4014cc){if(_0x4014cc){_0x2715eb[_0x32f8('0x3b')]=_0x4014cc[0x0];}return request({'event':_0x59ed03,'message':_0x2715eb});});};}function afterUpdate(_0x57d8be,_0x1b0b3e){return function(_0x1edd15,_0x180b43){if(_0x1edd15[_0x32f8('0x3c')]('closed')&&_0x1edd15[_0x32f8('0x3d')]){_0x1edd15=_0x1edd15['get']({'plain':!![]});_0x1edd15[_0x32f8('0x22')]=_0x57d8be;_0x1edd15['event']='closed';var _0x18d8cb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1edd15[_0x32f8('0x38')];return db[_0x32f8('0x26')][_0x32f8('0x27')](_0x18d8cb,{'type':db[_0x32f8('0x39')]['QueryTypes'][_0x32f8('0x28')],'raw':!![]})['then'](function(_0x3f4ba6){return _0x3f4ba6;})['then'](function(_0x1c0722){if(_0x1c0722){_0x1edd15[_0x32f8('0x3b')]=_0x1c0722[0x0];}if(_0x1edd15[_0x32f8('0x2a')]){return db['User'][_0x32f8('0x2c')]({'where':{'id':_0x1edd15[_0x32f8('0x2a')]},'attributes':['id',_0x32f8('0x2d'),_0x32f8('0x2e'),_0x32f8('0x2f'),_0x32f8('0x30')],'raw':!![]})['then'](function(_0x59fdbb){_0x1edd15[_0x32f8('0x31')]=util[_0x32f8('0x32')]('SIP/%s',_0x59fdbb[_0x32f8('0x2d')]);_0x1edd15[_0x32f8('0x3e')]=_0x59fdbb;return request({'event':_0x1b0b3e,'message':_0x1edd15});})[_0x32f8('0x21')](function(_0x467e69){console[_0x32f8('0x1f')](_0x467e69);});}else{return request({'event':_0x1b0b3e,'message':_0x1edd15});}});}};}exports[_0x32f8('0x3f')]=function(){for(var _0x29ca37=0x0;_0x29ca37=_0x49e0c8[_0x230e('0x17')]){throw Error(_0x230e('0x18'));}_0x342bdf(_0x48713a);})[_0x230e('0x19')](function(_0x5d8eb9){_0x513ef0(_0x5d8eb9);});});}; \ No newline at end of file +var _0x18ed=['agent','User','count','then','agents','catch','lodash','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role'];(function(_0x408153,_0x3f25f2){var _0x49847a=function(_0x49f48e){while(--_0x49f48e){_0x408153['push'](_0x408153['shift']());}};_0x49847a(++_0x3f25f2);}(_0x18ed,0xb5));var _0xd18e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x18ed[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xd18e('0x0'));var BPromise=require('bluebird');var db=require(_0xd18e('0x1'))['db'];var util=require(_0xd18e('0x2'));var channels=[_0xd18e('0x3'),_0xd18e('0x4'),_0xd18e('0x5'),_0xd18e('0x6'),_0xd18e('0x7'),_0xd18e('0x8'),_0xd18e('0x9')];exports[_0xd18e('0xa')]=function(){return channels;};exports[_0xd18e('0xb')]=function(_0x5b3ca2){_0x5b3ca2=_0x5b3ca2[_0xd18e('0xc')]();return _['includes'](channels,_0x5b3ca2);};exports[_0xd18e('0xd')]=function(_0x561a7d,_0x920698,_0x5377d4,_0x1fa40a){var _0x3b1522={'loginAttempts':_0x920698,'blocked':_0x5377d4};if(!_[_0xd18e('0xe')](_0x1fa40a)){_0x3b1522[_0xd18e('0xf')]=_0x1fa40a;}return _0x561a7d[_0xd18e('0x10')](_0x3b1522);};exports[_0xd18e('0x11')]=function(_0x40ccc5){return new BPromise(function(_0x329178,_0x3daefb){var _0x15fc32=0x0;if(_0x40ccc5[_0xd18e('0x12')]!==_0xd18e('0x13')){_0x329178(_0x40ccc5);}db[_0xd18e('0x14')][_0xd18e('0x15')]({'where':{'role':_0xd18e('0x13'),'online':!![],'id':{'$ne':_0x40ccc5['id']}}})[_0xd18e('0x16')](function(_0x105a2b){_0x15fc32=_0x105a2b;return util[_0xd18e('0x11')]();})['then'](function(_0x3b8b69){if(_0x3b8b69&&_0x3b8b69[_0xd18e('0x17')]&&_0x15fc32>=_0x3b8b69[_0xd18e('0x17')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x329178(_0x40ccc5);})[_0xd18e('0x18')](function(_0x2ddf8b){_0x3daefb(_0x2ddf8b);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index d4c69a8..6c36f98 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb55=['json','exports','404','status','render'];(function(_0x43d0ec,_0x14d914){var _0x1288cf=function(_0x17d948){while(--_0x17d948){_0x43d0ec['push'](_0x43d0ec['shift']());}};_0x1288cf(++_0x14d914);}(_0xeb55,0x1cd));var _0x5eb5=function(_0x4088ff,_0x28d61e){_0x4088ff=_0x4088ff-0x0;var _0x536edf=_0xeb55[_0x4088ff];return _0x536edf;};'use strict';module[_0x5eb5('0x0')][0x194]=function pageNotFound(_0x45c48c,_0x7b4fcf){var _0x4c4760=_0x5eb5('0x1');var _0x54d2aa=0x194;var _0x2d416a={'status':_0x54d2aa};_0x7b4fcf[_0x5eb5('0x2')](_0x2d416a['status']);_0x7b4fcf[_0x5eb5('0x3')](_0x4c4760,{},function(_0x53634c,_0x1e5cc2){if(_0x53634c){return _0x7b4fcf[_0x5eb5('0x2')](_0x2d416a['status'])[_0x5eb5('0x4')](_0x2d416a);}_0x7b4fcf['send'](_0x1e5cc2);});}; \ No newline at end of file +var _0x4c29=['status','render','json','send'];(function(_0x597603,_0x3af1a7){var _0x511f9d=function(_0x2f4293){while(--_0x2f4293){_0x597603['push'](_0x597603['shift']());}};_0x511f9d(++_0x3af1a7);}(_0x4c29,0x9c));var _0x94c2=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4c29[_0x68c979];return _0x4f0001;};'use strict';module['exports'][0x194]=function pageNotFound(_0x258765,_0x5b169e){var _0x4cb47f='404';var _0x4fd479=0x194;var _0x4c372f={'status':_0x4fd479};_0x5b169e[_0x94c2('0x0')](_0x4c372f[_0x94c2('0x0')]);_0x5b169e[_0x94c2('0x1')](_0x4cb47f,{},function(_0x23dc82,_0x50836e){if(_0x23dc82){return _0x5b169e[_0x94c2('0x0')](_0x4c372f['status'])[_0x94c2('0x2')](_0x4c372f);}_0x5b169e[_0x94c2('0x3')](_0x50836e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 49dfd15..368bcdd 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b86=['UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','cascade','hasMany','UserId','UserVoiceQueueRt','VoiceQueuesRt','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteraction','ChatInteractions','SmsInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Lists','cm_user_has_lists','user_has_teams','FaxInteractions','SmsInteractions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','UserVoiceQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','hasOne','Imap','Dispositions','CannedAnswer','Messages','Interactions','List','TemplateId','mandatoryDispositionPauseId','Agents','team_has_mail_queues','Teams','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Items','FaxAccountId','Applications','Exntensions','FaxMessage','FaxApplication','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','ListId','SmsAccountId','Answers','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatGroupId','chat_group_has_users','Contacts','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','whatsapp_interaction_has_tags','AllCondition','AnyConditions','TriggerAnyId','TriggerId','Fields','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','Subject','Description','FieldId','VariableId','SugarcrmConfiguration','DeskAccount','Subjects','Field','ZohoAccount','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','VtigerAccount','Dynamics365Account','FromId','ToId','SessionId','ProjectId','SquareProject','MailQueues','team_has_sms_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToUserId','ToChatWebsiteId','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','Extensions','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappQueueReport','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','motion2','xC@LL1234','mysql','utf8_general_ci','sequelizeHistory','defaultsDeep','xcall','utf8','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x6b86,0x1bd));var _0x66b8=function(_0xde43c2,_0x4f6a35){_0xde43c2=_0xde43c2-0x0;var _0x37a763=_0x6b86[_0xde43c2];return _0x37a763;};'use strict';var config=require(_0x66b8('0x0'));var Sequelize=require(_0x66b8('0x1'));var _=require(_0x66b8('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x66b8('0x1')]=_['defaultsDeep'](config[_0x66b8('0x1')],{'database':_0x66b8('0x3'),'username':'xcall','password':_0x66b8('0x4'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x66b8('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x66b8('0x6')}}});config[_0x66b8('0x7')]=_[_0x66b8('0x8')](config[_0x66b8('0x7')],{'database':_0x66b8('0x3'),'username':_0x66b8('0x9'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x66b8('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x66b8('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x66b8('0x1')][_0x66b8('0xb')],config['sequelize'][_0x66b8('0xc')],config[_0x66b8('0x1')][_0x66b8('0xd')],config[_0x66b8('0x1')][_0x66b8('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x66b8('0x7')]['database'],config[_0x66b8('0x7')][_0x66b8('0xc')],config[_0x66b8('0x7')]['password'],config[_0x66b8('0x7')][_0x66b8('0xe')])};db[_0x66b8('0xf')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x10'));db[_0x66b8('0x11')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x13'));db['VoiceContext']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x14'));db[_0x66b8('0x15')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x16'));db[_0x66b8('0x17')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x18'));db['ScreenRecording']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x19'));db[_0x66b8('0x1a')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x1b'));db[_0x66b8('0x1c')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x1d'));db['VoiceCallReport']=db[_0x66b8('0x1')]['import'](_0x66b8('0x1e'));db[_0x66b8('0x1f')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x20'));db[_0x66b8('0x21')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x22'));db[_0x66b8('0x23')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x24'));db[_0x66b8('0x25')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/memberReport/memberReport.model');db[_0x66b8('0x26')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x27'));db[_0x66b8('0x28')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x29'));db['UserVoiceQueueRt']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x2a'));db['UserVoiceQueue']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x2b'));db['UserChatQueue']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x2c'));db[_0x66b8('0x2d')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x2e'));db[_0x66b8('0x2f')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x30'));db[_0x66b8('0x31')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x32'));db[_0x66b8('0x33')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x34'));db[_0x66b8('0x35')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x36'));db[_0x66b8('0x37')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x38'));db['MailAccount']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x39'));db[_0x66b8('0x3a')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x3b'));db['MailSubstatus']=db[_0x66b8('0x1')]['import'](_0x66b8('0x3c'));db[_0x66b8('0x3d')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x3e'));db[_0x66b8('0x3f')]=db['sequelize']['import'](_0x66b8('0x40'));db[_0x66b8('0x41')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/mailApplication/mailApplication.model');db[_0x66b8('0x42')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x43'));db['Dashboard']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x44'));db[_0x66b8('0x45')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x46'));db['FaxApplication']=db[_0x66b8('0x1')]['import']('../api/faxApplication/faxApplication.model');db[_0x66b8('0x47')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x48'));db['FaxMessage']=db['sequelize']['import'](_0x66b8('0x49'));db[_0x66b8('0x4a')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/faxQueue/faxQueue.model');db[_0x66b8('0x4b')]=db['sequelize'][_0x66b8('0x12')]('../api/faxQueueReport/faxQueueReport.model');db[_0x66b8('0x4c')]=db['sequelize']['import'](_0x66b8('0x4d'));db[_0x66b8('0x4e')]=db['sequelize'][_0x66b8('0x12')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x4f'));db[_0x66b8('0x50')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x51'));db[_0x66b8('0x52')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x53'));db[_0x66b8('0x54')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x55'));db['OpenchannelApplication']=db[_0x66b8('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x56'));db[_0x66b8('0x57')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x58'));db['OpenchannelQueue']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x59'));db[_0x66b8('0x5a')]=db['sequelize']['import'](_0x66b8('0x5b'));db[_0x66b8('0x5c')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x5d'));db['ChatApplication']=db[_0x66b8('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0x66b8('0x5e')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x5f'));db[_0x66b8('0x60')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x61'));db[_0x66b8('0x62')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x63'));db[_0x66b8('0x64')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/chatQueue/chatQueue.model');db[_0x66b8('0x65')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x66'));db[_0x66b8('0x67')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x68'));db['CmCompany']=db[_0x66b8('0x1')]['import'](_0x66b8('0x69'));db[_0x66b8('0x6a')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x6b'));db[_0x66b8('0x6c')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x6d'));db[_0x66b8('0x6e')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x6f'));db[_0x66b8('0x70')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x66b8('0x71')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x72'));db['ReportAgentPreview']=db['sequelize'][_0x66b8('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x66b8('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x66b8('0x73')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x74'));db[_0x66b8('0x75')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x76'));db['CannedAnswer']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x77'));db[_0x66b8('0x78')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x79'));db[_0x66b8('0x7a')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x7b'));db['Interval']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x7c'));db[_0x66b8('0x7d')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x7e'));db[_0x66b8('0x7f')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x80'));db[_0x66b8('0x81')]=db['sequelize'][_0x66b8('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x66b8('0x82')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x83'));db[_0x66b8('0x84')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x85'));db[_0x66b8('0x86')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x87'));db[_0x66b8('0x88')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x89'));db[_0x66b8('0x8a')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x8b'));db[_0x66b8('0x8c')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x8d'));db['Integration']=db[_0x66b8('0x1')]['import']('../api/integration/integration.model');db['IntegrationReport']=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x66b8('0x8e')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x8f'));db[_0x66b8('0x90')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x91'));db[_0x66b8('0x92')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x93'));db[_0x66b8('0x94')]=db[_0x66b8('0x1')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x66b8('0x95')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x96'));db[_0x66b8('0x97')]=db[_0x66b8('0x1')]['import'](_0x66b8('0x98'));db[_0x66b8('0x99')]=db['sequelize'][_0x66b8('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0x9a'));db[_0x66b8('0x9b')]=db['sequelize']['import'](_0x66b8('0x9c'));db['SugarcrmConfiguration']=db[_0x66b8('0x1')]['import'](_0x66b8('0x9d'));db[_0x66b8('0x9e')]=db[_0x66b8('0x1')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x9f'));db[_0x66b8('0xa0')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xa1'));db[_0x66b8('0xa2')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xa3'));db['ZohoAccount']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xa4'));db[_0x66b8('0xa5')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xa6'));db[_0x66b8('0xa7')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xa8'));db[_0x66b8('0xa9')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0x66b8('0xaa')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize'][_0x66b8('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0x66b8('0xab')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xac'));db['FreshdeskConfiguration']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xad'));db[_0x66b8('0xae')]=db[_0x66b8('0x1')]['import'](_0x66b8('0xaf'));db['VtigerAccount']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xb0'));db[_0x66b8('0xb1')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xb2'));db[_0x66b8('0xb3')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xb4'));db[_0x66b8('0xb5')]=db[_0x66b8('0x1')]['import'](_0x66b8('0xb6'));db[_0x66b8('0xb7')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xb8'));db[_0x66b8('0xb9')]=db[_0x66b8('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xba'));db[_0x66b8('0xbb')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x66b8('0xbc')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xbd'));db[_0x66b8('0xbe')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xbf'));db[_0x66b8('0xc0')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xc1'));db[_0x66b8('0xc2')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xc3'));db[_0x66b8('0xc4')]=db[_0x66b8('0x1')]['import'](_0x66b8('0xc5'));db[_0x66b8('0xc6')]=db[_0x66b8('0x1')]['import']('../api/network/network.model');db[_0x66b8('0xc7')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xc8'));db[_0x66b8('0xc9')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x66b8('0xca')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xcb'));db[_0x66b8('0xcc')]=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x66b8('0xcd')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xce'));db[_0x66b8('0xcf')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xd0'));db['SquareReport']=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/squareReport/squareReport.model');db[_0x66b8('0xd1')]=db['sequelize'][_0x66b8('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0x66b8('0xd2')]=db['sequelize']['import'](_0x66b8('0xd3'));db['Setting']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xd4'));db[_0x66b8('0xd5')]=db[_0x66b8('0x1')]['import'](_0x66b8('0xd6'));db['SquareProject']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xd7'));db[_0x66b8('0xd8')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xd9'));db['SquareMessage']=db[_0x66b8('0x1')]['import'](_0x66b8('0xda'));db[_0x66b8('0xdb')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xdc'));db[_0x66b8('0xdd')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xde'));db[_0x66b8('0xdf')]=db[_0x66b8('0x1')]['import'](_0x66b8('0xe0'));db[_0x66b8('0xe1')]=db['sequelize']['import'](_0x66b8('0xe2'));db[_0x66b8('0xe3')]=db[_0x66b8('0x1')]['import'](_0x66b8('0xe4'));db[_0x66b8('0xe5')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xe6'));db['MailTransferReport']=db[_0x66b8('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/chatTransferReport/chatTransferReport.model');db[_0x66b8('0xe7')]=db[_0x66b8('0x1')]['import'](_0x66b8('0xe8'));db['OpenchannelTransferReport']=db[_0x66b8('0x1')]['import'](_0x66b8('0xe9'));db[_0x66b8('0xea')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xeb'));db[_0x66b8('0xec')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xed'));db['VoicePrefix']=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xee'));db[_0x66b8('0xef')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0x66b8('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x66b8('0xf0')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xf1'));db[_0x66b8('0xf2')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xf3'));db[_0x66b8('0xf4')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xf5'));db[_0x66b8('0xf6')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xf7'));db[_0x66b8('0xf8')]=db[_0x66b8('0x1')][_0x66b8('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xf9'));db['WhatsappQueueReport']=db[_0x66b8('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x66b8('0xfa')]=db['sequelize'][_0x66b8('0x12')](_0x66b8('0xfb'));db[_0x66b8('0xfc')]=db[_0x66b8('0x1')]['import'](_0x66b8('0xfd'));db[_0x66b8('0xfe')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0xff'));db[_0x66b8('0x100')]=db[_0x66b8('0x1')][_0x66b8('0x12')](_0x66b8('0x101'));db[_0x66b8('0xf')]['hasOne'](db[_0x66b8('0x1a')],{'as':_0x66b8('0x1a'),'onDelete':_0x66b8('0x102'),'foreignKey':'UserId'});db['User'][_0x66b8('0x103')](db[_0x66b8('0x17')],{'as':'Recordings','foreignKey':_0x66b8('0x104')});db[_0x66b8('0xf')][_0x66b8('0x103')](db[_0x66b8('0x105')],{'as':_0x66b8('0x106'),'foreignKey':_0x66b8('0x104')});db['User']['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x66b8('0x102'),'hooks':!![]});db[_0x66b8('0xf')]['hasMany'](db[_0x66b8('0x70')],{'as':_0x66b8('0x107'),'foreignKey':'UserId'});db[_0x66b8('0xf')][_0x66b8('0x103')](db[_0x66b8('0x71')],{'as':_0x66b8('0x108'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0xf')][_0x66b8('0x103')](db[_0x66b8('0x109')],{'as':_0x66b8('0x109'),'foreignKey':_0x66b8('0x104')});db['User'][_0x66b8('0x103')](db[_0x66b8('0x10a')],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0x66b8('0xf')][_0x66b8('0x103')](db[_0x66b8('0x5e')],{'as':_0x66b8('0x10b'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0xf')][_0x66b8('0x103')](db[_0x66b8('0x10c')],{'as':'SmsInteractions','foreignKey':_0x66b8('0x104')});db[_0x66b8('0xf')][_0x66b8('0x103')](db[_0x66b8('0x47')],{'as':'FaxInteractions','foreignKey':_0x66b8('0x104')});db[_0x66b8('0xf')][_0x66b8('0x103')](db[_0x66b8('0x3d')],{'as':_0x66b8('0x10d'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0xf')]['hasMany'](db['WhatsappInteraction'],{'as':_0x66b8('0x10e'),'foreignKey':_0x66b8('0x104')});db['User'][_0x66b8('0x103')](db[_0x66b8('0xf2')],{'as':_0x66b8('0x10f'),'foreignKey':_0x66b8('0x110')});db['User'][_0x66b8('0x111')](db[_0x66b8('0xef')],{'as':_0x66b8('0xef'),'foreignKey':_0x66b8('0x112')});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x65')],{'as':_0x66b8('0x114'),'through':'chat_group_has_users'});db[_0x66b8('0xf')]['belongsToMany'](db['CmContact'],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x66b8('0xf')]['belongsToMany'](db[_0x66b8('0xec')],{'as':_0x66b8('0x115'),'through':_0x66b8('0x116')});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0xdb')],{'through':_0x66b8('0x117')});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x3d')],{'as':_0x66b8('0x10d'),'through':'user_has_mail_interactions'});db['User'][_0x66b8('0x113')](db['ChatInteraction'],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x47')],{'as':_0x66b8('0x118'),'through':'user_has_fax_interactions'});db['User'][_0x66b8('0x113')](db[_0x66b8('0x10c')],{'as':_0x66b8('0x119'),'through':'user_has_sms_interactions'});db['User'][_0x66b8('0x113')](db[_0x66b8('0x10a')],{'as':_0x66b8('0x11a'),'through':_0x66b8('0x11b')});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0xf8')],{'as':'WhatsappInteractions','through':_0x66b8('0x11c')});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x11d')],{'as':_0x66b8('0x11e'),'through':_0x66b8('0x11f'),'required':![]});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x3a')],{'as':'MailQueues','through':_0x66b8('0x2d'),'required':![]});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x64')],{'as':_0x66b8('0x120'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x4a')],{'as':_0x66b8('0x121'),'through':_0x66b8('0x2f'),'required':![]});db['User'][_0x66b8('0x113')](db['SmsQueue'],{'as':_0x66b8('0x122'),'through':_0x66b8('0x31'),'required':![]});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x123')],{'as':_0x66b8('0x124'),'through':_0x66b8('0x33'),'required':![]});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0xfc')],{'as':_0x66b8('0x125'),'through':_0x66b8('0x35'),'required':![]});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0xec')],{'through':_0x66b8('0x116')});db['User'][_0x66b8('0x113')](db[_0x66b8('0x126')],{'as':_0x66b8('0x127'),'through':_0x66b8('0x128'),'required':![]});db['User'][_0x66b8('0x113')](db[_0x66b8('0x5a')],{'as':_0x66b8('0x129'),'through':_0x66b8('0x12a')});db[_0x66b8('0xf')][_0x66b8('0x113')](db[_0x66b8('0x12b')],{'as':_0x66b8('0x12c'),'through':_0x66b8('0x12d')});db[_0x66b8('0xf')]['belongsToMany'](db[_0x66b8('0x12e')],{'as':'MailAccounts','through':_0x66b8('0x12f')});db[_0x66b8('0xf')][_0x66b8('0x113')](db['OpenchannelAccount'],{'as':_0x66b8('0x130'),'through':_0x66b8('0x131')});db['User'][_0x66b8('0x113')](db[_0x66b8('0x4c')],{'as':_0x66b8('0x132'),'through':_0x66b8('0x133')});db['User'][_0x66b8('0x113')](db['WhatsappAccount'],{'as':_0x66b8('0x134'),'through':_0x66b8('0x135')});db[_0x66b8('0xf')][_0x66b8('0x113')](db['SquareProject'],{'as':_0x66b8('0x136'),'through':_0x66b8('0x137')});db[_0x66b8('0x11')][_0x66b8('0x103')](db[_0x66b8('0x15')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x66b8('0x138')});db['VoiceContext']['hasMany'](db[_0x66b8('0x15')],{'onDelete':'cascade'});db[_0x66b8('0x15')][_0x66b8('0x103')](db[_0x66b8('0x15')],{'as':'Applications','onDelete':_0x66b8('0x102')});db['VoiceMusicOnHold'][_0x66b8('0x113')](db['Sound'],{'as':_0x66b8('0x139'),'through':_0x66b8('0x13a')});db[_0x66b8('0x11d')][_0x66b8('0x103')](db[_0x66b8('0x105')],{'as':_0x66b8('0x13b'),'foreignKey':_0x66b8('0x13c')});db['VoiceQueue'][_0x66b8('0x103')](db['CmHopper'],{'as':_0x66b8('0x13d'),'foreignKey':_0x66b8('0x13c')});db[_0x66b8('0x11d')]['hasMany'](db[_0x66b8('0x70')],{'as':_0x66b8('0x107'),'foreignKey':'VoiceQueueId'});db[_0x66b8('0x11d')][_0x66b8('0x103')](db[_0x66b8('0x71')],{'as':_0x66b8('0x13e'),'foreignKey':_0x66b8('0x13c')});db[_0x66b8('0x11d')][_0x66b8('0x103')](db[_0x66b8('0x109')],{'as':_0x66b8('0x109'),'foreignKey':_0x66b8('0x13c')});db[_0x66b8('0x11d')][_0x66b8('0x103')](db[_0x66b8('0x6e')],{'as':_0x66b8('0x13f'),'foreignKey':'VoiceQueueId'});db[_0x66b8('0x11d')][_0x66b8('0x103')](db['JscriptySessionReport'],{'as':_0x66b8('0x140'),'foreignKey':_0x66b8('0x13c')});db[_0x66b8('0x11d')][_0x66b8('0x111')](db['Trunk'],{'as':'Trunk','foreignKey':_0x66b8('0x141')});db[_0x66b8('0x11d')]['belongsTo'](db[_0x66b8('0x26')],{'as':_0x66b8('0x142'),'foreignKey':_0x66b8('0x143')});db['VoiceQueue'][_0x66b8('0x111')](db[_0x66b8('0x144')],{'as':_0x66b8('0x144'),'foreignKey':_0x66b8('0x145')});db['VoiceQueue'][_0x66b8('0x111')](db['Pause'],{'as':_0x66b8('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x66b8('0x11d')][_0x66b8('0x113')](db[_0x66b8('0xec')],{'as':_0x66b8('0x115'),'through':'voice_queues_has_cm_lists'});db[_0x66b8('0x11d')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':'Agents','through':_0x66b8('0x11f')});db[_0x66b8('0x11d')][_0x66b8('0x113')](db[_0x66b8('0xdb')],{'as':'Teams','through':_0x66b8('0x100')});db['VoiceQueue'][_0x66b8('0x113')](db['CmList'],{'as':_0x66b8('0x147'),'through':_0x66b8('0x148')});db[_0x66b8('0x17')][_0x66b8('0x111')](db['User'],{'as':_0x66b8('0xf'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0x149')][_0x66b8('0x111')](db['User'],{'as':'User','foreignKey':_0x66b8('0x104')});db[_0x66b8('0x1a')][_0x66b8('0x103')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x14a'),'sourceKey':_0x66b8('0x14b')});db[_0x66b8('0x1c')][_0x66b8('0x111')](db[_0x66b8('0x1a')],{'foreignKey':_0x66b8('0x14a'),'targetKey':_0x66b8('0x14b')});db[_0x66b8('0x14c')][_0x66b8('0x103')](db[_0x66b8('0x23')],{'as':_0x66b8('0x14d'),'foreignKey':_0x66b8('0x14e'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x66b8('0x21')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x66b8('0x14c')]['belongsTo'](db[_0x66b8('0xf')],{'as':_0x66b8('0xf'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0x14c')][_0x66b8('0x111')](db['CmContact'],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x37')][_0x66b8('0x111')](db[_0x66b8('0x12e')],{'as':_0x66b8('0x12e'),'foreignKey':'MailAccountId'});db['MailServerOut']['belongsTo'](db[_0x66b8('0x12e')],{'as':_0x66b8('0x12e'),'foreignKey':_0x66b8('0x151')});db[_0x66b8('0x12e')][_0x66b8('0x152')](db[_0x66b8('0x37')],{'as':_0x66b8('0x153'),'onDelete':_0x66b8('0x102')});db[_0x66b8('0x12e')][_0x66b8('0x152')](db['MailServerOut'],{'as':'Smtp','onDelete':'cascade'});db['MailAccount'][_0x66b8('0x103')](db[_0x66b8('0x78')],{'as':_0x66b8('0x154'),'foreignKey':_0x66b8('0x151'),'onDelete':'cascade'});db[_0x66b8('0x12e')][_0x66b8('0x103')](db[_0x66b8('0x155')],{'as':'Answers','foreignKey':_0x66b8('0x151')});db['MailAccount'][_0x66b8('0x103')](db[_0x66b8('0x3f')],{'as':_0x66b8('0x156'),'foreignKey':_0x66b8('0x151')});db[_0x66b8('0x12e')]['hasMany'](db[_0x66b8('0x3d')],{'as':_0x66b8('0x157')});db[_0x66b8('0x12e')]['hasMany'](db['MailApplication'],{'as':'Applications'});db['MailAccount'][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':_0x66b8('0x158'),'foreignKey':'ListId'});db['MailAccount'][_0x66b8('0x111')](db[_0x66b8('0x88')],{'as':'Template','foreignKey':_0x66b8('0x159')});db[_0x66b8('0x12e')][_0x66b8('0x111')](db['Pause'],{'as':_0x66b8('0x146'),'foreignKey':_0x66b8('0x15a')});db[_0x66b8('0x12e')][_0x66b8('0x113')](db['User'],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x12f')});db[_0x66b8('0x3a')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x2d')});db[_0x66b8('0x3a')][_0x66b8('0x113')](db['Team'],{'through':_0x66b8('0x15c'),'as':_0x66b8('0x15d')});db[_0x66b8('0x3d')][_0x66b8('0x103')](db[_0x66b8('0x3f')],{'as':_0x66b8('0x156'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x15e')});db[_0x66b8('0x3d')][_0x66b8('0x111')](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db['MailInteraction'][_0x66b8('0x111')](db[_0x66b8('0x6a')],{'as':'Contact','foreignKey':_0x66b8('0x150')});db['MailInteraction'][_0x66b8('0x111')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15f'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0x3d')][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x160'),'as':_0x66b8('0x161')});db[_0x66b8('0x3d')][_0x66b8('0x113')](db['Tag'],{'through':_0x66b8('0x160'),'as':_0x66b8('0x162')});db['MailInteraction'][_0x66b8('0x113')](db['User'],{'as':'Users','through':_0x66b8('0x163'),'foreignKey':'MailInteractionId'});db[_0x66b8('0x3f')]['hasMany'](db[_0x66b8('0xe3')],{'as':_0x66b8('0x164'),'onDelete':'cascade'});db[_0x66b8('0x3f')]['belongsTo'](db[_0x66b8('0xf')],{'as':_0x66b8('0xf')});db[_0x66b8('0x3f')][_0x66b8('0x111')](db['CmContact'],{'onDelete':_0x66b8('0x102'),'as':_0x66b8('0x14f')});db[_0x66b8('0x3f')]['belongsTo'](db[_0x66b8('0x3d')],{'as':_0x66b8('0x165'),'foreignKey':_0x66b8('0x15e')});db[_0x66b8('0x3f')][_0x66b8('0x111')](db[_0x66b8('0x12e')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x151')});db[_0x66b8('0x3f')]['belongsTo'](db['ChatWebsite'],{'as':_0x66b8('0x5a'),'foreignKey':_0x66b8('0x167')});db[_0x66b8('0x3f')]['belongsTo'](db[_0x66b8('0x62')],{'as':_0x66b8('0x62'),'foreignKey':_0x66b8('0x168')});db[_0x66b8('0x41')][_0x66b8('0x111')](db['User'],{'onDelete':_0x66b8('0x169')});db[_0x66b8('0x41')][_0x66b8('0x111')](db[_0x66b8('0x3a')],{'onDelete':_0x66b8('0x169')});db['MailApplication'][_0x66b8('0x111')](db['MailAccount'],{'onDelete':'restrict'});db[_0x66b8('0x41')]['belongsTo'](db[_0x66b8('0x144')],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x145')});db[_0x66b8('0x41')][_0x66b8('0x111')](db[_0x66b8('0x86')],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x16a')});db[_0x66b8('0x42')][_0x66b8('0x111')](db[_0x66b8('0x12e')],{});db['MailQueueReport']['belongsTo'](db[_0x66b8('0xec')],{'as':_0x66b8('0x158'),'foreignKey':'ListId'});db[_0x66b8('0x42')]['belongsTo'](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x42')]['belongsTo'](db[_0x66b8('0x3d')],{});db[_0x66b8('0x42')][_0x66b8('0x111')](db['MailMessage'],{});db[_0x66b8('0x42')][_0x66b8('0x111')](db['User'],{});db['MailQueueReport']['belongsTo'](db[_0x66b8('0x3a')],{});db['Dashboard'][_0x66b8('0x103')](db[_0x66b8('0x45')],{'as':_0x66b8('0x16b'),'onDelete':_0x66b8('0x102')});db['FaxAccount'][_0x66b8('0x103')](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x66b8('0x12b')]['hasMany'](db[_0x66b8('0x155')],{'as':'Answers','foreignKey':_0x66b8('0x16c')});db['FaxAccount'][_0x66b8('0x103')](db[_0x66b8('0x47')],{'as':_0x66b8('0x157')});db['FaxAccount'][_0x66b8('0x103')](db['FaxApplication'],{'as':_0x66b8('0x16d')});db['FaxAccount'][_0x66b8('0x103')](db[_0x66b8('0x15')],{'as':_0x66b8('0x16e'),'onDelete':_0x66b8('0x102')});db[_0x66b8('0x12b')]['hasMany'](db[_0x66b8('0x16f')],{'as':_0x66b8('0x156')});db[_0x66b8('0x12b')][_0x66b8('0x111')](db[_0x66b8('0x26')],{'as':_0x66b8('0x26')});db[_0x66b8('0x12b')][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':'List','foreignKey':'ListId'});db[_0x66b8('0x12b')][_0x66b8('0x111')](db['Pause'],{'as':_0x66b8('0x146'),'foreignKey':_0x66b8('0x15a')});db[_0x66b8('0x12b')][_0x66b8('0x113')](db['User'],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x12d')});db[_0x66b8('0x170')]['belongsTo'](db[_0x66b8('0xf')],{'onDelete':_0x66b8('0x169')});db[_0x66b8('0x170')][_0x66b8('0x111')](db[_0x66b8('0x4a')],{'onDelete':_0x66b8('0x169')});db[_0x66b8('0x170')]['belongsTo'](db[_0x66b8('0x12b')],{'onDelete':_0x66b8('0x169')});db[_0x66b8('0x170')][_0x66b8('0x111')](db[_0x66b8('0x86')],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x16a')});db[_0x66b8('0x47')]['hasMany'](db[_0x66b8('0x16f')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x66b8('0x171')});db[_0x66b8('0x47')][_0x66b8('0x111')](db[_0x66b8('0x12b')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x16c')});db['FaxInteraction'][_0x66b8('0x111')](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x47')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15f'),'foreignKey':'UserId'});db[_0x66b8('0x47')]['belongsToMany'](db[_0x66b8('0x86')],{'through':'fax_interaction_has_tags','as':_0x66b8('0x161')});db[_0x66b8('0x47')][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x172'),'as':_0x66b8('0x162')});db[_0x66b8('0x47')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x173'),'through':'user_has_fax_interactions','foreignKey':_0x66b8('0x171')});db[_0x66b8('0x16f')]['belongsTo'](db[_0x66b8('0xf')],{'onDelete':_0x66b8('0x102'),'as':_0x66b8('0xf')});db[_0x66b8('0x16f')][_0x66b8('0x111')](db[_0x66b8('0x47')],{'as':_0x66b8('0x165'),'foreignKey':_0x66b8('0x171')});db[_0x66b8('0x16f')][_0x66b8('0x111')](db['CmContact'],{'onDelete':'cascade','as':_0x66b8('0x14f')});db[_0x66b8('0x16f')][_0x66b8('0x111')](db[_0x66b8('0xe3')],{'as':_0x66b8('0xe3'),'foreignKey':_0x66b8('0x174')});db[_0x66b8('0x16f')][_0x66b8('0x111')](db[_0x66b8('0x12b')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x16c')});db[_0x66b8('0x4a')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':'UserFaxQueue'});db['FaxQueue'][_0x66b8('0x113')](db[_0x66b8('0xdb')],{'through':_0x66b8('0x175'),'as':_0x66b8('0x15d')});db[_0x66b8('0x4b')]['belongsTo'](db[_0x66b8('0x12b')],{});db[_0x66b8('0x4b')][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':'List','foreignKey':_0x66b8('0x176')});db[_0x66b8('0x4b')]['belongsTo'](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x4b')][_0x66b8('0x111')](db['FaxInteraction'],{});db['FaxQueueReport']['belongsTo'](db[_0x66b8('0x16f')],{});db[_0x66b8('0x4b')][_0x66b8('0x111')](db[_0x66b8('0xf')],{});db['FaxQueueReport'][_0x66b8('0x111')](db[_0x66b8('0x4a')],{});db[_0x66b8('0x4c')][_0x66b8('0x103')](db[_0x66b8('0x78')],{'as':_0x66b8('0x154'),'foreignKey':_0x66b8('0x177'),'onDelete':_0x66b8('0x102')});db['SmsAccount'][_0x66b8('0x103')](db[_0x66b8('0x155')],{'as':_0x66b8('0x178'),'foreignKey':_0x66b8('0x177')});db[_0x66b8('0x4c')][_0x66b8('0x103')](db[_0x66b8('0x50')],{'as':_0x66b8('0x156'),'foreignKey':'SmsAccountId'});db[_0x66b8('0x4c')][_0x66b8('0x103')](db[_0x66b8('0x10c')],{'as':_0x66b8('0x157')});db[_0x66b8('0x4c')]['hasMany'](db[_0x66b8('0x4e')],{'as':_0x66b8('0x16d')});db[_0x66b8('0x4c')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x66b8('0x4c')][_0x66b8('0x111')](db[_0x66b8('0x7d')],{'as':_0x66b8('0x146'),'foreignKey':_0x66b8('0x15a')});db[_0x66b8('0x4c')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x133')});db[_0x66b8('0x4e')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'onDelete':_0x66b8('0x169')});db[_0x66b8('0x4e')][_0x66b8('0x111')](db[_0x66b8('0x52')],{'onDelete':_0x66b8('0x169')});db['SmsApplication'][_0x66b8('0x111')](db['SmsAccount'],{'onDelete':_0x66b8('0x169')});db[_0x66b8('0x4e')][_0x66b8('0x111')](db[_0x66b8('0x144')],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x145')});db['SmsApplication'][_0x66b8('0x111')](db[_0x66b8('0x86')],{'onDelete':'restrict','foreignKey':_0x66b8('0x16a')});db[_0x66b8('0x10c')][_0x66b8('0x103')](db[_0x66b8('0x50')],{'as':_0x66b8('0x156'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x179')});db['SmsInteraction'][_0x66b8('0x111')](db[_0x66b8('0x4c')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x177')});db[_0x66b8('0x10c')][_0x66b8('0x111')](db['CmContact'],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db['SmsInteraction'][_0x66b8('0x111')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15f'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0x10c')][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x17a'),'as':_0x66b8('0x161')});db['SmsInteraction'][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x17a'),'as':_0x66b8('0x162')});db[_0x66b8('0x10c')]['belongsToMany'](db[_0x66b8('0xf')],{'as':_0x66b8('0x173'),'through':_0x66b8('0x17b'),'foreignKey':_0x66b8('0x179')});db[_0x66b8('0x50')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'as':'User'});db[_0x66b8('0x50')]['belongsTo'](db[_0x66b8('0x6a')],{'onDelete':_0x66b8('0x102'),'as':'Contact'});db[_0x66b8('0x50')][_0x66b8('0x111')](db[_0x66b8('0x10c')],{'onDelete':'cascade','as':_0x66b8('0x165'),'foreignKey':_0x66b8('0x179')});db[_0x66b8('0x50')][_0x66b8('0x111')](db[_0x66b8('0x4c')],{'as':'Account','foreignKey':_0x66b8('0x177')});db[_0x66b8('0x52')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x31'),'foreignKey':'SmsQueueId'});db['SmsQueue'][_0x66b8('0x113')](db[_0x66b8('0xdb')],{'through':'team_has_sms_queues','as':_0x66b8('0x15d')});db[_0x66b8('0x54')]['hasMany'](db[_0x66b8('0x78')],{'as':_0x66b8('0x154'),'foreignKey':_0x66b8('0x17c'),'onDelete':_0x66b8('0x102')});db[_0x66b8('0x54')][_0x66b8('0x103')](db[_0x66b8('0x155')],{'as':'Answers','foreignKey':_0x66b8('0x17c')});db[_0x66b8('0x54')][_0x66b8('0x103')](db[_0x66b8('0x10a')],{'as':_0x66b8('0x157'),'foreignKey':_0x66b8('0x17c')});db['OpenchannelAccount'][_0x66b8('0x103')](db[_0x66b8('0x57')],{'as':'Messages','foreignKey':_0x66b8('0x17c')});db[_0x66b8('0x54')]['hasMany'](db[_0x66b8('0x17d')],{'as':'Applications','foreignKey':_0x66b8('0x17c')});db[_0x66b8('0x54')][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':_0x66b8('0x158'),'foreignKey':_0x66b8('0x176')});db[_0x66b8('0x54')][_0x66b8('0x111')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x66b8('0x15a')});db[_0x66b8('0x54')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x66b8('0x17d')][_0x66b8('0x111')](db['User'],{'onDelete':_0x66b8('0x169')});db['OpenchannelApplication'][_0x66b8('0x111')](db[_0x66b8('0x123')],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x17e')});db[_0x66b8('0x17d')][_0x66b8('0x111')](db[_0x66b8('0x54')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x66b8('0x17d')]['belongsTo'](db['Interval'],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x145')});db['OpenchannelApplication'][_0x66b8('0x111')](db[_0x66b8('0x86')],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x16a')});db[_0x66b8('0x10a')]['hasMany'](db[_0x66b8('0x57')],{'as':_0x66b8('0x156'),'onDelete':_0x66b8('0x102'),'foreignKey':'OpenchannelInteractionId'});db[_0x66b8('0x10a')]['belongsTo'](db[_0x66b8('0x54')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x17c')});db[_0x66b8('0x10a')][_0x66b8('0x111')](db['CmContact'],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db['OpenchannelInteraction']['belongsTo'](db[_0x66b8('0xf')],{'as':_0x66b8('0x15f'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0x10a')]['belongsToMany'](db['Tag'],{'through':_0x66b8('0x17f'),'as':_0x66b8('0x161')});db['OpenchannelInteraction'][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x17f'),'as':'ThroughTags'});db[_0x66b8('0x10a')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x173'),'through':_0x66b8('0x11b'),'foreignKey':_0x66b8('0x180')});db['OpenchannelMessage'][_0x66b8('0x111')](db['User'],{'onDelete':_0x66b8('0x102'),'as':_0x66b8('0xf')});db[_0x66b8('0x57')][_0x66b8('0x111')](db[_0x66b8('0x6a')],{'onDelete':_0x66b8('0x102'),'as':_0x66b8('0x14f')});db[_0x66b8('0x57')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x66b8('0x102'),'as':_0x66b8('0x165'),'foreignKey':_0x66b8('0x180')});db[_0x66b8('0x57')][_0x66b8('0x111')](db[_0x66b8('0xe3')],{'as':_0x66b8('0xe3'),'foreignKey':_0x66b8('0x174')});db[_0x66b8('0x57')][_0x66b8('0x111')](db[_0x66b8('0x54')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x17c')});db[_0x66b8('0x123')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':'UserOpenchannelQueue','foreignKey':_0x66b8('0x17e')});db[_0x66b8('0x123')]['belongsToMany'](db[_0x66b8('0xdb')],{'through':_0x66b8('0x181'),'as':_0x66b8('0x15d')});db[_0x66b8('0x5a')][_0x66b8('0x103')](db[_0x66b8('0x78')],{'as':_0x66b8('0x154'),'foreignKey':_0x66b8('0x167'),'onDelete':'cascade'});db[_0x66b8('0x5a')][_0x66b8('0x103')](db[_0x66b8('0x155')],{'as':_0x66b8('0x178'),'foreignKey':_0x66b8('0x167')});db['ChatWebsite']['hasMany'](db[_0x66b8('0x67')],{'as':'ProactiveActions'});db[_0x66b8('0x5a')][_0x66b8('0x103')](db[_0x66b8('0x5e')],{'as':'Interactions'});db[_0x66b8('0x5a')]['hasMany'](db[_0x66b8('0x182')],{'as':_0x66b8('0x16d')});db[_0x66b8('0x5a')]['hasMany'](db[_0x66b8('0x60')],{'as':_0x66b8('0x156')});db[_0x66b8('0x5a')][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':'List','foreignKey':_0x66b8('0x176')});db['ChatWebsite'][_0x66b8('0x111')](db[_0x66b8('0x144')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x66b8('0x5a')][_0x66b8('0x111')](db['MailAccount'],{'as':_0x66b8('0x12e'),'foreignKey':_0x66b8('0x151')});db[_0x66b8('0x5a')][_0x66b8('0x111')](db[_0x66b8('0x7d')],{'as':_0x66b8('0x146'),'foreignKey':_0x66b8('0x15a')});db['ChatWebsite'][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x12a')});db[_0x66b8('0x5c')][_0x66b8('0x111')](db[_0x66b8('0x54')],{});db[_0x66b8('0x5c')][_0x66b8('0x111')](db['CmList'],{'as':_0x66b8('0x158'),'foreignKey':_0x66b8('0x176')});db['OpenchannelQueueReport']['belongsTo'](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x5c')][_0x66b8('0x111')](db[_0x66b8('0x10a')],{});db[_0x66b8('0x5c')][_0x66b8('0x111')](db['OpenchannelMessage'],{});db[_0x66b8('0x5c')]['belongsTo'](db[_0x66b8('0xf')],{});db[_0x66b8('0x5c')][_0x66b8('0x111')](db[_0x66b8('0x123')],{});db[_0x66b8('0x182')]['belongsTo'](db['User'],{'as':_0x66b8('0x183'),'foreignKey':_0x66b8('0x104'),'onDelete':_0x66b8('0x169')});db[_0x66b8('0x182')][_0x66b8('0x111')](db[_0x66b8('0x64')],{'as':_0x66b8('0x184'),'foreignKey':_0x66b8('0x185'),'onDelete':'restrict'});db[_0x66b8('0x182')][_0x66b8('0x111')](db['ChatWebsite'],{'as':_0x66b8('0x186'),'foreignKey':_0x66b8('0x167'),'onDelete':_0x66b8('0x169')});db['ChatApplication'][_0x66b8('0x111')](db[_0x66b8('0x86')],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x16a')});db[_0x66b8('0x5e')][_0x66b8('0x103')](db[_0x66b8('0x60')],{'as':_0x66b8('0x156'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x187')});db[_0x66b8('0x5e')][_0x66b8('0x111')](db['ChatWebsite'],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x167')});db[_0x66b8('0x5e')][_0x66b8('0x111')](db['CmContact'],{'as':_0x66b8('0x14f'),'foreignKey':'ContactId'});db[_0x66b8('0x5e')]['belongsTo'](db[_0x66b8('0xf')],{'as':_0x66b8('0x15f'),'foreignKey':'UserId'});db[_0x66b8('0x5e')][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x188'),'as':'Tags'});db['ChatInteraction'][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x188'),'as':_0x66b8('0x162')});db['ChatInteraction'][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x173'),'through':'user_has_chat_interactions','foreignKey':_0x66b8('0x187')});db[_0x66b8('0x60')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'onDelete':'cascade','as':_0x66b8('0xf')});db[_0x66b8('0x60')][_0x66b8('0x111')](db[_0x66b8('0x6a')],{'onDelete':_0x66b8('0x102'),'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x60')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x66b8('0x102'),'as':_0x66b8('0x165'),'foreignKey':'ChatInteractionId'});db[_0x66b8('0x60')]['belongsTo'](db[_0x66b8('0xe3')],{'as':_0x66b8('0xe3'),'foreignKey':_0x66b8('0x174')});db[_0x66b8('0x60')][_0x66b8('0x111')](db[_0x66b8('0x5a')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x167')});db[_0x66b8('0x62')]['hasMany'](db[_0x66b8('0xe3')],{'as':_0x66b8('0x164'),'foreignKey':_0x66b8('0x168'),'onDelete':'cascade','hooks':!![]});db[_0x66b8('0x62')][_0x66b8('0x111')](db['CmContact'],{'onDelete':_0x66b8('0x102'),'as':'Contact','foreignKey':'ContactId'});db[_0x66b8('0x62')]['belongsTo'](db['ChatWebsite'],{'as':_0x66b8('0x166'),'foreignKey':'ChatWebsiteId'});db[_0x66b8('0x64')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x189'),'hooks':!![]});db[_0x66b8('0x64')]['belongsToMany'](db['Team'],{'through':_0x66b8('0x18a'),'as':_0x66b8('0x15d')});db[_0x66b8('0x65')][_0x66b8('0x103')](db[_0x66b8('0xc9')],{'as':_0x66b8('0x156'),'foreignKey':_0x66b8('0x18b'),'onDelete':'cascade'});db['ChatGroup']['belongsToMany'](db[_0x66b8('0xf')],{'as':_0x66b8('0x13b'),'through':_0x66b8('0x18c')});db['ChatProactiveAction'][_0x66b8('0x111')](db[_0x66b8('0x5a')],{'as':_0x66b8('0x186'),'foreignKey':_0x66b8('0x167')});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0x66b8('0x18d'),'foreignKey':_0x66b8('0x18e')});db[_0x66b8('0x6a')]['hasMany'](db[_0x66b8('0x6c')],{'as':_0x66b8('0x13d'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x6a')][_0x66b8('0x103')](db[_0x66b8('0x70')],{'as':_0x66b8('0x107'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x6a')][_0x66b8('0x103')](db[_0x66b8('0x71')],{'as':_0x66b8('0x13e'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x6a')][_0x66b8('0x103')](db[_0x66b8('0x109')],{'as':_0x66b8('0x109'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0x6a')]['hasMany'](db[_0x66b8('0xcd')],{'as':_0x66b8('0x140'),'foreignKey':'ContactId'});db[_0x66b8('0x6a')]['hasMany'](db[_0x66b8('0x10a')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x66b8('0x169')});db[_0x66b8('0x6a')][_0x66b8('0x103')](db[_0x66b8('0x5e')],{'as':_0x66b8('0x10b'),'foreignKey':'ContactId','onDelete':_0x66b8('0x169')});db[_0x66b8('0x6a')]['hasMany'](db['SmsInteraction'],{'as':_0x66b8('0x119'),'foreignKey':'ContactId','onDelete':_0x66b8('0x169')});db['CmContact'][_0x66b8('0x103')](db[_0x66b8('0x47')],{'as':_0x66b8('0x118'),'foreignKey':'ContactId','onDelete':_0x66b8('0x169')});db[_0x66b8('0x6a')][_0x66b8('0x103')](db[_0x66b8('0x3d')],{'as':_0x66b8('0x10d'),'foreignKey':_0x66b8('0x150'),'onDelete':'restrict'});db[_0x66b8('0x6a')][_0x66b8('0x111')](db['CmCompany'],{'as':_0x66b8('0x18f'),'foreignKey':_0x66b8('0x18e')});db[_0x66b8('0x6a')][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':_0x66b8('0x158'),'foreignKey':'ListId','onDelete':_0x66b8('0x102')});db['CmContact'][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x173'),'through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db[_0x66b8('0x86')],{'as':_0x66b8('0x161'),'through':_0x66b8('0x190')});db[_0x66b8('0x6a')][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x190'),'as':_0x66b8('0x162')});db[_0x66b8('0x6c')][_0x66b8('0x111')](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150'),'onDelete':_0x66b8('0x102')});db[_0x66b8('0x6c')][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':_0x66b8('0x158'),'foreignKey':'ListId','onDelete':_0x66b8('0x102')});db[_0x66b8('0x6c')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'as':_0x66b8('0x183'),'foreignKey':_0x66b8('0x104')});db[_0x66b8('0x6c')][_0x66b8('0x111')](db[_0x66b8('0x11d')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x66b8('0x102')});db['CmHopper']['belongsTo'](db[_0x66b8('0xdf')],{'as':_0x66b8('0xdf'),'foreignKey':_0x66b8('0x191'),'onDelete':_0x66b8('0x102')});db[_0x66b8('0x6c')]['belongsTo'](db[_0x66b8('0xf')],{'as':'Owner','foreignKey':_0x66b8('0x192')});db[_0x66b8('0x6e')]['belongsTo'](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150'),'onDelete':_0x66b8('0x102')});db[_0x66b8('0x6e')]['belongsTo'](db['CmList'],{'as':_0x66b8('0x158'),'foreignKey':'ListId','onDelete':_0x66b8('0x102')});db[_0x66b8('0x6e')]['belongsTo'](db[_0x66b8('0x11d')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x66b8('0x6e')]['belongsTo'](db[_0x66b8('0xdf')],{'as':_0x66b8('0xdf'),'foreignKey':'CampaignId','onDelete':_0x66b8('0x102')});db[_0x66b8('0x75')][_0x66b8('0x103')](db[_0x66b8('0x7a')],{'as':{'plural':'All','singular':_0x66b8('0x193')},'foreignKey':_0x66b8('0x194'),'onDelete':_0x66b8('0x102'),'hooks':!![]});db[_0x66b8('0x75')][_0x66b8('0x103')](db[_0x66b8('0x7a')],{'as':{'plural':_0x66b8('0x195'),'singular':_0x66b8('0x196')},'foreignKey':_0x66b8('0x197'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x66b8('0x103')](db[_0x66b8('0x73')],{'as':_0x66b8('0x198'),'foreignKey':_0x66b8('0x199'),'onDelete':'cascade','hooks':!![]});db[_0x66b8('0x78')]['hasMany'](db['Disposition'],{'as':_0x66b8('0x154'),'foreignKey':_0x66b8('0x19a'),'onDelete':'cascade'});db['Interval'][_0x66b8('0x103')](db[_0x66b8('0x144')],{'as':_0x66b8('0x19b'),'foreignKey':_0x66b8('0x145'),'onDelete':_0x66b8('0x102'),'hooks':!![],'required':![]});db[_0x66b8('0x144')][_0x66b8('0x103')](db[_0x66b8('0x15')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':'restrict'});db[_0x66b8('0x144')][_0x66b8('0x103')](db[_0x66b8('0x41')],{'as':_0x66b8('0x19c'),'foreignKey':_0x66b8('0x145')});db[_0x66b8('0x144')]['hasMany'](db[_0x66b8('0x182')],{'as':'ChatApplications','foreignKey':_0x66b8('0x145')});db[_0x66b8('0x144')][_0x66b8('0x103')](db['FaxApplication'],{'as':_0x66b8('0x19d'),'foreignKey':_0x66b8('0x145')});db[_0x66b8('0x144')][_0x66b8('0x103')](db['SmsApplication'],{'as':_0x66b8('0x19e'),'foreignKey':_0x66b8('0x145')});db[_0x66b8('0x82')][_0x66b8('0x111')](db['MailAccount'],{});db[_0x66b8('0x82')][_0x66b8('0x111')](db[_0x66b8('0x8e')],{'foreignKey':_0x66b8('0x19f')});db[_0x66b8('0x82')]['belongsTo'](db[_0x66b8('0x1a0')],{'foreignKey':_0x66b8('0x1a1')});db[_0x66b8('0x84')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x66b8('0x13a'),'onDelete':_0x66b8('0x169')});db[_0x66b8('0x86')][_0x66b8('0x113')](db['CmContact'],{'through':_0x66b8('0x190')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x66b8('0x188')});db[_0x66b8('0x86')]['belongsToMany'](db['MailInteraction'],{'through':_0x66b8('0x160')});db['Tag'][_0x66b8('0x113')](db[_0x66b8('0x10c')],{'through':'sms_interaction_has_tags'});db[_0x66b8('0x86')]['belongsToMany'](db[_0x66b8('0x47')],{'through':'fax_interaction_has_tags'});db[_0x66b8('0x86')][_0x66b8('0x113')](db[_0x66b8('0x10a')],{'through':_0x66b8('0x17f')});db[_0x66b8('0x86')][_0x66b8('0x113')](db[_0x66b8('0xf8')],{'through':_0x66b8('0x1a2')});db['Trigger'][_0x66b8('0x103')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x66b8('0x1a3')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0x66b8('0x103')](db[_0x66b8('0x7a')],{'as':{'plural':_0x66b8('0x1a4'),'singular':'AnyCondition'},'foreignKey':_0x66b8('0x1a5'),'onDelete':_0x66b8('0x102'),'hooks':!![]});db[_0x66b8('0x8a')][_0x66b8('0x103')](db[_0x66b8('0x73')],{'as':_0x66b8('0x198'),'foreignKey':_0x66b8('0x1a6'),'onDelete':_0x66b8('0x102'),'hooks':!![]});db[_0x66b8('0x1a0')][_0x66b8('0x103')](db[_0x66b8('0x94')],{'as':_0x66b8('0x1a7'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1a1'),'hooks':!![]});db[_0x66b8('0x8e')]['hasMany'](db[_0x66b8('0x94')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x66b8('0x19f')});db['AnalyticMetric'][_0x66b8('0x103')](db[_0x66b8('0x94')],{'as':_0x66b8('0x1a7'),'onDelete':_0x66b8('0x102'),'foreignKey':'MetricId'});db[_0x66b8('0x94')]['belongsTo'](db[_0x66b8('0x92')],{'foreignKey':'MetricId'});db[_0x66b8('0x97')][_0x66b8('0x103')](db['SalesforceConfiguration'],{'as':_0x66b8('0x1a8'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1a9')});db['SalesforceConfiguration'][_0x66b8('0x103')](db[_0x66b8('0x1aa')],{'as':'Subjects','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1ab')});db[_0x66b8('0x99')][_0x66b8('0x103')](db[_0x66b8('0x1aa')],{'as':_0x66b8('0x1ac'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0x99')][_0x66b8('0x103')](db[_0x66b8('0x1aa')],{'as':_0x66b8('0x1a7'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x66b8('0x99')]['belongsTo'](db[_0x66b8('0x97')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0x1aa')][_0x66b8('0x103')](db[_0x66b8('0x1aa')],{'as':_0x66b8('0x1ae'),'foreignKey':_0x66b8('0x1ab')});db['SalesforceField'][_0x66b8('0x103')](db['SalesforceField'],{'as':_0x66b8('0x1af'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0x1aa')][_0x66b8('0x103')](db['SalesforceField'],{'as':'Field','foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0x1aa')][_0x66b8('0x111')](db[_0x66b8('0x8c')],{'as':'Variable','foreignKey':_0x66b8('0x1b1')});db[_0x66b8('0x9b')][_0x66b8('0x103')](db[_0x66b8('0x1b2')],{'as':_0x66b8('0x1a8'),'onDelete':_0x66b8('0x102'),'foreignKey':'AccountId'});db[_0x66b8('0x1b2')]['hasMany'](db[_0x66b8('0x9e')],{'as':'Subjects','onDelete':_0x66b8('0x102'),'foreignKey':'SubjectId'});db[_0x66b8('0x1b2')][_0x66b8('0x103')](db[_0x66b8('0x9e')],{'as':_0x66b8('0x1ac'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1ad')});db['SugarcrmConfiguration']['hasMany'](db[_0x66b8('0x9e')],{'as':_0x66b8('0x1a7'),'onDelete':'cascade','foreignKey':_0x66b8('0x1b0')});db['SugarcrmConfiguration'][_0x66b8('0x111')](db['SugarcrmAccount'],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1a9')});db['SugarcrmField'][_0x66b8('0x103')](db[_0x66b8('0x9e')],{'as':_0x66b8('0x1ae'),'foreignKey':_0x66b8('0x1ab')});db[_0x66b8('0x9e')][_0x66b8('0x103')](db[_0x66b8('0x9e')],{'as':_0x66b8('0x1af'),'foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db[_0x66b8('0x9e')],{'as':'Field','foreignKey':_0x66b8('0x1b0')});db['SugarcrmField'][_0x66b8('0x111')](db[_0x66b8('0x8c')],{'as':_0x66b8('0x8c'),'foreignKey':'VariableId'});db[_0x66b8('0x1b3')][_0x66b8('0x103')](db[_0x66b8('0xa0')],{'as':_0x66b8('0x1a8'),'onDelete':'cascade','foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xa0')]['hasMany'](db[_0x66b8('0xa2')],{'as':_0x66b8('0x1b4'),'onDelete':_0x66b8('0x102'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x66b8('0x103')](db['DeskField'],{'as':'Descriptions','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0xa0')][_0x66b8('0x103')](db[_0x66b8('0xa2')],{'as':'Fields','onDelete':_0x66b8('0x102'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x66b8('0x111')](db[_0x66b8('0x1b3')],{'as':_0x66b8('0x166'),'foreignKey':'AccountId'});db[_0x66b8('0xa0')][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x66b8('0x103')](db['DeskField'],{'as':_0x66b8('0x1ae'),'foreignKey':'SubjectId'});db[_0x66b8('0xa2')][_0x66b8('0x103')](db[_0x66b8('0xa2')],{'as':_0x66b8('0x1af'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0xa2')][_0x66b8('0x103')](db[_0x66b8('0xa2')],{'as':_0x66b8('0x1b5'),'foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0xa2')][_0x66b8('0x111')](db[_0x66b8('0x8c')],{'as':'Variable','foreignKey':_0x66b8('0x1b1')});db['ZohoAccount'][_0x66b8('0x103')](db[_0x66b8('0xa5')],{'as':'Configurations','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xa5')]['hasMany'](db['ZohoField'],{'as':_0x66b8('0x1b4'),'onDelete':_0x66b8('0x102'),'foreignKey':'SubjectId'});db[_0x66b8('0xa5')]['hasMany'](db[_0x66b8('0xa7')],{'as':_0x66b8('0x1ac'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x66b8('0xa5')]['hasMany'](db[_0x66b8('0xa7')],{'as':_0x66b8('0x1a7'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x66b8('0xa5')][_0x66b8('0x111')](db[_0x66b8('0x1b6')],{'as':'Account','foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xa7')][_0x66b8('0x103')](db[_0x66b8('0xa7')],{'as':_0x66b8('0x1ae'),'foreignKey':_0x66b8('0x1ab')});db['ZohoField']['hasMany'](db[_0x66b8('0xa7')],{'as':_0x66b8('0x1af'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0xa7')][_0x66b8('0x103')](db['ZohoField'],{'as':_0x66b8('0x1b5'),'foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0xa7')][_0x66b8('0x111')](db['Variable'],{'as':_0x66b8('0x8c'),'foreignKey':_0x66b8('0x1b1')});db[_0x66b8('0xa9')]['hasMany'](db[_0x66b8('0xaa')],{'as':'Configurations','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xaa')][_0x66b8('0x103')](db[_0x66b8('0x1b7')],{'as':'Subjects','foreignKey':_0x66b8('0x1ab')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x66b8('0x1ac'),'foreignKey':_0x66b8('0x1ad')});db['ZendeskConfiguration'][_0x66b8('0x103')](db[_0x66b8('0x1b7')],{'as':'Fields','foreignKey':'FieldId'});db[_0x66b8('0xaa')]['belongsTo'](db[_0x66b8('0xa9')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xaa')][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x1b8')});db[_0x66b8('0x1b7')]['hasMany'](db['ZendeskField'],{'as':_0x66b8('0x1ae'),'foreignKey':_0x66b8('0x1ab')});db['ZendeskField'][_0x66b8('0x103')](db[_0x66b8('0x1b7')],{'as':_0x66b8('0x1af'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0x1b7')]['hasMany'](db[_0x66b8('0x1b7')],{'as':'Field','foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0x1b7')][_0x66b8('0x111')](db[_0x66b8('0x8c')],{'as':_0x66b8('0x8c'),'foreignKey':_0x66b8('0x1b1')});db[_0x66b8('0xab')][_0x66b8('0x103')](db[_0x66b8('0x1b9')],{'as':_0x66b8('0x1a8'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1a9')});db['FreshdeskConfiguration'][_0x66b8('0x103')](db[_0x66b8('0xae')],{'as':_0x66b8('0x1b4'),'onDelete':_0x66b8('0x102'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x66b8('0x103')](db[_0x66b8('0xae')],{'as':'Descriptions','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0x1b9')][_0x66b8('0x103')](db['FreshdeskField'],{'as':_0x66b8('0x1a7'),'onDelete':'cascade','foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0x1b9')][_0x66b8('0x111')](db[_0x66b8('0xab')],{'as':_0x66b8('0x166'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x66b8('0xae')][_0x66b8('0x103')](db[_0x66b8('0xae')],{'as':_0x66b8('0x1ae'),'foreignKey':_0x66b8('0x1ab')});db[_0x66b8('0xae')][_0x66b8('0x103')](db['FreshdeskField'],{'as':_0x66b8('0x1af'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0xae')]['hasMany'](db[_0x66b8('0xae')],{'as':_0x66b8('0x1b5'),'foreignKey':_0x66b8('0x1b0')});db['FreshdeskField'][_0x66b8('0x111')](db[_0x66b8('0x8c')],{'as':_0x66b8('0x8c'),'foreignKey':_0x66b8('0x1b1')});db[_0x66b8('0x1ba')][_0x66b8('0x103')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xb1')][_0x66b8('0x103')](db[_0x66b8('0xb3')],{'as':'Subjects','foreignKey':_0x66b8('0x1ab')});db[_0x66b8('0xb1')][_0x66b8('0x103')](db[_0x66b8('0xb3')],{'as':'Descriptions','foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0xb1')][_0x66b8('0x103')](db[_0x66b8('0xb3')],{'as':_0x66b8('0x1a7'),'foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0xb1')][_0x66b8('0x111')](db[_0x66b8('0x1ba')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xb3')]['hasMany'](db[_0x66b8('0xb3')],{'as':_0x66b8('0x1ae'),'foreignKey':_0x66b8('0x1ab')});db[_0x66b8('0xb3')][_0x66b8('0x103')](db['VtigerField'],{'as':'Description','foreignKey':_0x66b8('0x1ad')});db['VtigerField']['hasMany'](db[_0x66b8('0xb3')],{'as':_0x66b8('0x1b5'),'foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0xb3')][_0x66b8('0x111')](db[_0x66b8('0x8c')],{'as':'Variable','foreignKey':_0x66b8('0x1b1')});db['ServicenowAccount'][_0x66b8('0x103')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xb7')][_0x66b8('0x103')](db[_0x66b8('0xb9')],{'as':_0x66b8('0x1b4'),'foreignKey':_0x66b8('0x1ab')});db[_0x66b8('0xb7')]['hasMany'](db['ServicenowField'],{'as':_0x66b8('0x1ac'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0xb7')]['hasMany'](db[_0x66b8('0xb9')],{'as':_0x66b8('0x1a7'),'foreignKey':'FieldId'});db[_0x66b8('0xb7')][_0x66b8('0x111')](db['ServicenowAccount'],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xb9')][_0x66b8('0x103')](db[_0x66b8('0xb9')],{'as':_0x66b8('0x1ae'),'foreignKey':_0x66b8('0x1ab')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x66b8('0x1af'),'foreignKey':'DescriptionId'});db[_0x66b8('0xb9')][_0x66b8('0x103')](db[_0x66b8('0xb9')],{'as':_0x66b8('0x1b5'),'foreignKey':'FieldId'});db[_0x66b8('0xb9')][_0x66b8('0x111')](db[_0x66b8('0x8c')],{'as':'Variable','foreignKey':'VariableId'});db[_0x66b8('0x1bb')]['hasMany'](db[_0x66b8('0xbb')],{'as':'Configurations','onDelete':_0x66b8('0x102'),'foreignKey':'AccountId'});db[_0x66b8('0xbb')][_0x66b8('0x103')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x66b8('0x1ab')});db[_0x66b8('0xbb')][_0x66b8('0x103')](db[_0x66b8('0xbc')],{'as':_0x66b8('0x1ac'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0xbb')]['hasMany'](db[_0x66b8('0xbc')],{'as':_0x66b8('0x1a7'),'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0xbb')][_0x66b8('0x111')](db[_0x66b8('0x1bb')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xbc')][_0x66b8('0x103')](db['Dynamics365Field'],{'as':_0x66b8('0x1ae'),'foreignKey':'SubjectId'});db[_0x66b8('0xbc')][_0x66b8('0x103')](db[_0x66b8('0xbc')],{'as':_0x66b8('0x1af'),'foreignKey':_0x66b8('0x1ad')});db['Dynamics365Field']['hasMany'](db[_0x66b8('0xbc')],{'as':_0x66b8('0x1b5'),'foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0xbc')]['belongsTo'](db[_0x66b8('0x8c')],{'as':_0x66b8('0x8c'),'foreignKey':_0x66b8('0x1b1')});db[_0x66b8('0xbe')][_0x66b8('0x103')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1a9')});db['FreshsalesConfiguration'][_0x66b8('0x103')](db[_0x66b8('0xc2')],{'as':'Subjects','foreignKey':_0x66b8('0x1ab')});db[_0x66b8('0xc0')][_0x66b8('0x103')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x66b8('0x1ad')});db[_0x66b8('0xc0')][_0x66b8('0x103')](db[_0x66b8('0xc2')],{'as':'Fields','foreignKey':_0x66b8('0x1b0')});db['FreshsalesConfiguration'][_0x66b8('0x111')](db['FreshsalesAccount'],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1a9')});db[_0x66b8('0xc2')][_0x66b8('0x103')](db[_0x66b8('0xc2')],{'as':_0x66b8('0x1ae'),'foreignKey':_0x66b8('0x1ab')});db['FreshsalesField']['hasMany'](db[_0x66b8('0xc2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x66b8('0xc2')][_0x66b8('0x103')](db[_0x66b8('0xc2')],{'as':'Field','foreignKey':_0x66b8('0x1b0')});db[_0x66b8('0xc2')]['belongsTo'](db[_0x66b8('0x8c')],{'as':_0x66b8('0x8c'),'foreignKey':_0x66b8('0x1b1')});db['ChatQueueReport'][_0x66b8('0x111')](db[_0x66b8('0x5a')],{});db[_0x66b8('0xc7')][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':_0x66b8('0x158'),'foreignKey':_0x66b8('0x176')});db[_0x66b8('0xc7')][_0x66b8('0x111')](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0xc7')][_0x66b8('0x111')](db[_0x66b8('0x5e')],{});db[_0x66b8('0xc7')][_0x66b8('0x111')](db['ChatMessage'],{});db[_0x66b8('0xc7')]['belongsTo'](db[_0x66b8('0xf')],{});db[_0x66b8('0xc7')]['belongsTo'](db[_0x66b8('0x64')],{});db[_0x66b8('0xc9')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0x66b8('0x1bc')});db['ChatInternalMessage'][_0x66b8('0x111')](db[_0x66b8('0xf')],{'onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1bd')});db[_0x66b8('0xcd')][_0x66b8('0x103')](db[_0x66b8('0xcc')],{'foreignKey':_0x66b8('0x1be'),'onDelete':'cascade'});db[_0x66b8('0xcd')][_0x66b8('0x103')](db[_0x66b8('0xca')],{'foreignKey':_0x66b8('0x1be'),'onDelete':_0x66b8('0x102')});db['SmsQueueReport'][_0x66b8('0x111')](db['SmsAccount'],{});db[_0x66b8('0xcf')]['belongsTo'](db['CmList'],{'as':_0x66b8('0x158'),'foreignKey':_0x66b8('0x176')});db[_0x66b8('0xcf')][_0x66b8('0x111')](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0xcf')][_0x66b8('0x111')](db['SmsInteraction'],{});db[_0x66b8('0xcf')][_0x66b8('0x111')](db[_0x66b8('0x50')],{});db[_0x66b8('0xcf')][_0x66b8('0x111')](db[_0x66b8('0xf')],{});db['SmsQueueReport'][_0x66b8('0x111')](db[_0x66b8('0x52')],{});db['JscriptyProject'][_0x66b8('0x103')](db[_0x66b8('0xcd')],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0x66b8('0xcc')],{'foreignKey':_0x66b8('0x1bf')});db[_0x66b8('0xd2')]['hasMany'](db[_0x66b8('0xca')],{'foreignKey':_0x66b8('0x1bf')});db[_0x66b8('0x1c0')][_0x66b8('0x113')](db['User'],{'as':_0x66b8('0x173'),'through':_0x66b8('0x137')});db[_0x66b8('0xdb')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x117')});db[_0x66b8('0xdb')][_0x66b8('0x113')](db[_0x66b8('0x11d')],{'through':_0x66b8('0x100'),'as':_0x66b8('0x11e')});db[_0x66b8('0xdb')][_0x66b8('0x113')](db[_0x66b8('0x3a')],{'through':'team_has_mail_queues','as':_0x66b8('0x1c1')});db['Team'][_0x66b8('0x113')](db['ChatQueue'],{'through':_0x66b8('0x18a'),'as':_0x66b8('0x120')});db[_0x66b8('0xdb')][_0x66b8('0x113')](db['FaxQueue'],{'through':_0x66b8('0x175'),'as':_0x66b8('0x121')});db[_0x66b8('0xdb')][_0x66b8('0x113')](db[_0x66b8('0x52')],{'through':_0x66b8('0x1c2'),'as':'SmsQueues'});db[_0x66b8('0xdb')][_0x66b8('0x113')](db[_0x66b8('0x123')],{'through':'team_has_openchannel_queues','as':_0x66b8('0x124')});db['Team'][_0x66b8('0x113')](db[_0x66b8('0xfc')],{'through':_0x66b8('0x1c3'),'as':_0x66b8('0x125')});db['Campaign'][_0x66b8('0x103')](db[_0x66b8('0x6c')],{'as':_0x66b8('0x13d'),'foreignKey':_0x66b8('0x191')});db[_0x66b8('0xdf')][_0x66b8('0x103')](db[_0x66b8('0x70')],{'as':'HopperFinals','foreignKey':_0x66b8('0x191')});db[_0x66b8('0xdf')][_0x66b8('0x103')](db[_0x66b8('0x71')],{'as':_0x66b8('0x13e'),'foreignKey':_0x66b8('0x191')});db[_0x66b8('0xdf')]['hasMany'](db[_0x66b8('0x6e')],{'as':_0x66b8('0x13f'),'foreignKey':'CampaignId'});db[_0x66b8('0xdf')][_0x66b8('0x111')](db[_0x66b8('0x26')],{'as':_0x66b8('0x26'),'foreignKey':_0x66b8('0x141')});db['Campaign']['belongsTo'](db[_0x66b8('0x26')],{'as':_0x66b8('0x142'),'foreignKey':_0x66b8('0x143')});db[_0x66b8('0xdf')]['belongsTo'](db[_0x66b8('0x144')],{'as':_0x66b8('0x144'),'foreignKey':'IntervalId'});db[_0x66b8('0xdf')][_0x66b8('0x111')](db[_0x66b8('0x1c0')],{'as':_0x66b8('0x1c0'),'foreignKey':_0x66b8('0x1c4')});db['Campaign'][_0x66b8('0x113')](db[_0x66b8('0xec')],{'as':_0x66b8('0x115'),'through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db[_0x66b8('0xec')],{'as':_0x66b8('0x147'),'through':_0x66b8('0x1c5')});db['Attachment'][_0x66b8('0x111')](db[_0x66b8('0x62')],{'as':_0x66b8('0x62'),'foreignKey':'ChatOfflineMessageId'});db[_0x66b8('0x1c6')][_0x66b8('0x111')](db[_0x66b8('0x3f')],{});db[_0x66b8('0x1c6')][_0x66b8('0x111')](db['MailInteraction'],{});db[_0x66b8('0x1c6')][_0x66b8('0x111')](db[_0x66b8('0x12e')],{'foreignKey':_0x66b8('0x1c7'),'as':_0x66b8('0x1c8')});db[_0x66b8('0x1c6')]['belongsTo'](db[_0x66b8('0xf')],{'foreignKey':_0x66b8('0x1c9'),'as':'FromAgent'});db[_0x66b8('0x1c6')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x66b8('0x1ca')});db[_0x66b8('0x1c6')]['belongsTo'](db[_0x66b8('0x3a')],{'foreignKey':_0x66b8('0x1cb'),'as':_0x66b8('0x1cc')});db[_0x66b8('0x1c6')][_0x66b8('0x111')](db['MailAccount'],{'foreignKey':_0x66b8('0x1cd'),'as':_0x66b8('0x1ce')});db['ChatTransferReport']['belongsTo'](db['ChatMessage'],{});db[_0x66b8('0x1cf')][_0x66b8('0x111')](db[_0x66b8('0x5e')],{});db[_0x66b8('0x1cf')][_0x66b8('0x111')](db[_0x66b8('0x5a')],{'foreignKey':_0x66b8('0x1d0'),'as':_0x66b8('0x1c8')});db[_0x66b8('0x1cf')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'foreignKey':_0x66b8('0x1c9'),'as':'FromAgent'});db[_0x66b8('0x1cf')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'foreignKey':_0x66b8('0x1d1'),'as':_0x66b8('0x1ca')});db['ChatTransferReport'][_0x66b8('0x111')](db[_0x66b8('0x64')],{'foreignKey':'ToChatQueueId','as':_0x66b8('0x1cc')});db['ChatTransferReport']['belongsTo'](db[_0x66b8('0x5a')],{'foreignKey':_0x66b8('0x1d2'),'as':_0x66b8('0x1ce')});db[_0x66b8('0xe7')][_0x66b8('0x111')](db[_0x66b8('0x16f')],{});db[_0x66b8('0xe7')][_0x66b8('0x111')](db[_0x66b8('0x47')],{});db['FaxTransferReport']['belongsTo'](db[_0x66b8('0x12b')],{'foreignKey':_0x66b8('0x1d3'),'as':_0x66b8('0x1c8')});db[_0x66b8('0xe7')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'foreignKey':'FromUserId','as':_0x66b8('0x1d4')});db['FaxTransferReport'][_0x66b8('0x111')](db[_0x66b8('0xf')],{'foreignKey':_0x66b8('0x1d1'),'as':_0x66b8('0x1ca')});db[_0x66b8('0xe7')]['belongsTo'](db[_0x66b8('0x4a')],{'foreignKey':_0x66b8('0x1d5'),'as':_0x66b8('0x1cc')});db['FaxTransferReport'][_0x66b8('0x111')](db[_0x66b8('0x12b')],{'foreignKey':_0x66b8('0x1d6'),'as':_0x66b8('0x1ce')});db[_0x66b8('0x1d7')][_0x66b8('0x111')](db[_0x66b8('0x57')],{});db['OpenchannelTransferReport'][_0x66b8('0x111')](db['OpenchannelInteraction'],{});db[_0x66b8('0x1d7')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x66b8('0x1d8'),'as':_0x66b8('0x1c8')});db[_0x66b8('0x1d7')][_0x66b8('0x111')](db['User'],{'foreignKey':_0x66b8('0x1c9'),'as':_0x66b8('0x1d4')});db[_0x66b8('0x1d7')][_0x66b8('0x111')](db[_0x66b8('0xf')],{'foreignKey':_0x66b8('0x1d1'),'as':_0x66b8('0x1ca')});db[_0x66b8('0x1d7')]['belongsTo'](db[_0x66b8('0x123')],{'foreignKey':_0x66b8('0x1d9'),'as':_0x66b8('0x1cc')});db[_0x66b8('0x1d7')][_0x66b8('0x111')](db[_0x66b8('0x54')],{'foreignKey':_0x66b8('0x1da'),'as':'ToAccount'});db[_0x66b8('0xea')][_0x66b8('0x111')](db[_0x66b8('0x50')],{});db[_0x66b8('0xea')][_0x66b8('0x111')](db['SmsInteraction'],{});db[_0x66b8('0xea')][_0x66b8('0x111')](db['SmsAccount'],{'foreignKey':_0x66b8('0x1db'),'as':_0x66b8('0x1c8')});db['SmsTransferReport'][_0x66b8('0x111')](db[_0x66b8('0xf')],{'foreignKey':'FromUserId','as':_0x66b8('0x1d4')});db[_0x66b8('0xea')]['belongsTo'](db[_0x66b8('0xf')],{'foreignKey':_0x66b8('0x1d1'),'as':_0x66b8('0x1ca')});db[_0x66b8('0xea')][_0x66b8('0x111')](db[_0x66b8('0x52')],{'foreignKey':_0x66b8('0x1dc'),'as':_0x66b8('0x1cc')});db[_0x66b8('0xea')][_0x66b8('0x111')](db[_0x66b8('0x4c')],{'foreignKey':_0x66b8('0x1dd'),'as':'ToAccount'});db[_0x66b8('0xec')]['hasMany'](db[_0x66b8('0x78')],{'as':_0x66b8('0x154'),'foreignKey':_0x66b8('0x176'),'onDelete':'cascade'});db[_0x66b8('0xec')][_0x66b8('0x103')](db[_0x66b8('0x1de')],{'as':'CustomFields','foreignKey':_0x66b8('0x176')});db[_0x66b8('0xec')][_0x66b8('0x103')](db['CmContact'],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x66b8('0x176')});db[_0x66b8('0xec')]['hasMany'](db[_0x66b8('0x70')],{'as':_0x66b8('0x107'),'foreignKey':_0x66b8('0x176')});db[_0x66b8('0xec')][_0x66b8('0x103')](db[_0x66b8('0x71')],{'as':'HopperHistory','foreignKey':_0x66b8('0x176')});db[_0x66b8('0xec')]['hasMany'](db[_0x66b8('0x109')],{'as':'ReportAgentPreview','foreignKey':_0x66b8('0x176')});db[_0x66b8('0xec')]['belongsToMany'](db['VoiceQueue'],{'as':_0x66b8('0x1df'),'through':'voice_queues_has_cm_lists'});db[_0x66b8('0xec')][_0x66b8('0x113')](db['User'],{'as':_0x66b8('0x15b'),'through':'cm_user_has_lists'});db[_0x66b8('0x126')][_0x66b8('0x103')](db[_0x66b8('0x15')],{'as':_0x66b8('0x1e0'),'onDelete':_0x66b8('0x102')});db[_0x66b8('0x126')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x128')});db[_0x66b8('0xef')][_0x66b8('0x103')](db['User'],{'as':'Users','foreignKey':_0x66b8('0x112')});db[_0x66b8('0xef')][_0x66b8('0x103')](db[_0x66b8('0x1e1')],{'as':_0x66b8('0x1e2'),'foreignKey':_0x66b8('0x112'),'onDelete':'cascade'});db[_0x66b8('0x1e1')][_0x66b8('0x103')](db[_0x66b8('0xf0')],{'as':_0x66b8('0x1e3'),'foreignKey':_0x66b8('0x1e4'),'onDelete':_0x66b8('0x102')});db[_0x66b8('0xf4')][_0x66b8('0x103')](db[_0x66b8('0x78')],{'as':_0x66b8('0x154'),'foreignKey':_0x66b8('0x1e5'),'onDelete':'cascade'});db[_0x66b8('0xf4')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x66b8('0x1e5')});db[_0x66b8('0xf4')][_0x66b8('0x103')](db[_0x66b8('0x1e6')],{'as':_0x66b8('0x156'),'foreignKey':_0x66b8('0x1e5')});db[_0x66b8('0xf4')][_0x66b8('0x103')](db[_0x66b8('0xf8')],{'as':_0x66b8('0x157')});db['WhatsappAccount'][_0x66b8('0x103')](db['WhatsappApplication'],{'as':_0x66b8('0x16d')});db[_0x66b8('0xf4')][_0x66b8('0x111')](db[_0x66b8('0xec')],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount']['belongsTo'](db[_0x66b8('0x7d')],{'as':_0x66b8('0x146'),'foreignKey':_0x66b8('0x15a')});db[_0x66b8('0xf4')][_0x66b8('0x113')](db['User'],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x135')});db['WhatsappApplication'][_0x66b8('0x111')](db['User'],{'onDelete':_0x66b8('0x169')});db[_0x66b8('0xf6')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x66b8('0x169')});db['WhatsappApplication'][_0x66b8('0x111')](db['WhatsappAccount'],{'onDelete':_0x66b8('0x169')});db[_0x66b8('0xf6')]['belongsTo'](db[_0x66b8('0x144')],{'onDelete':_0x66b8('0x169'),'foreignKey':_0x66b8('0x145')});db[_0x66b8('0xf6')][_0x66b8('0x111')](db[_0x66b8('0x86')],{'onDelete':_0x66b8('0x169'),'foreignKey':'TagId'});db[_0x66b8('0xf8')][_0x66b8('0x103')](db[_0x66b8('0x1e6')],{'as':'Messages','onDelete':_0x66b8('0x102'),'foreignKey':_0x66b8('0x1e7')});db['WhatsappInteraction'][_0x66b8('0x111')](db[_0x66b8('0xf4')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1e5')});db['WhatsappInteraction'][_0x66b8('0x111')](db[_0x66b8('0x6a')],{'as':_0x66b8('0x14f'),'foreignKey':_0x66b8('0x150')});db[_0x66b8('0xf8')][_0x66b8('0x111')](db['User'],{'as':_0x66b8('0x15f'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x66b8('0x113')](db[_0x66b8('0x86')],{'through':_0x66b8('0x1a2'),'as':_0x66b8('0x161')});db['WhatsappInteraction']['belongsToMany'](db[_0x66b8('0x86')],{'through':_0x66b8('0x1a2'),'as':_0x66b8('0x162')});db['WhatsappInteraction'][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':'Users','through':_0x66b8('0x11c'),'foreignKey':'WhatsappInteractionId'});db[_0x66b8('0x1e6')]['belongsTo'](db[_0x66b8('0xf')],{'as':_0x66b8('0xf')});db['WhatsappMessage']['belongsTo'](db[_0x66b8('0x6a')],{'onDelete':_0x66b8('0x102'),'as':_0x66b8('0x14f')});db['WhatsappMessage']['belongsTo'](db[_0x66b8('0xf8')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x66b8('0x1e7')});db['WhatsappMessage']['belongsTo'](db[_0x66b8('0xf4')],{'as':_0x66b8('0x166'),'foreignKey':_0x66b8('0x1e5')});db['WhatsappQueueReport'][_0x66b8('0x111')](db[_0x66b8('0xf4')],{});db[_0x66b8('0x1e8')][_0x66b8('0x111')](db['CmList'],{'as':_0x66b8('0x158'),'foreignKey':_0x66b8('0x176')});db[_0x66b8('0x1e8')]['belongsTo'](db[_0x66b8('0x6a')],{'as':'Contact','foreignKey':_0x66b8('0x150')});db[_0x66b8('0x1e8')][_0x66b8('0x111')](db[_0x66b8('0xf8')],{});db['WhatsappQueueReport'][_0x66b8('0x111')](db[_0x66b8('0xfc')],{});db[_0x66b8('0x1e8')][_0x66b8('0x111')](db[_0x66b8('0x1e6')],{});db[_0x66b8('0x1e8')][_0x66b8('0x111')](db[_0x66b8('0xf')],{});db[_0x66b8('0xfa')][_0x66b8('0x111')](db[_0x66b8('0x1e6')],{});db[_0x66b8('0xfa')][_0x66b8('0x111')](db[_0x66b8('0xf8')],{});db[_0x66b8('0xfa')][_0x66b8('0x111')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x66b8('0x1c8')});db[_0x66b8('0xfa')][_0x66b8('0x111')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0x66b8('0xfa')][_0x66b8('0x111')](db['WhatsappQueue'],{'foreignKey':_0x66b8('0x1e9'),'as':'ToQueue'});db[_0x66b8('0xfa')]['belongsTo'](db['User'],{'foreignKey':_0x66b8('0x1c9'),'as':_0x66b8('0x1d4')});db[_0x66b8('0xfa')]['belongsTo'](db[_0x66b8('0xf')],{'foreignKey':'ToUserId','as':_0x66b8('0x1ca')});db[_0x66b8('0xfc')][_0x66b8('0x113')](db[_0x66b8('0xf')],{'as':_0x66b8('0x15b'),'through':_0x66b8('0x35'),'foreignKey':_0x66b8('0x1ea')});db[_0x66b8('0xfc')][_0x66b8('0x113')](db[_0x66b8('0xdb')],{'through':_0x66b8('0x1c3'),'as':'Teams'});module[_0x66b8('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf576=['CmCustomField','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','VoiceRecording','Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','Team','user_has_mail_interactions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','MailQueues','ChatQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','cm_user_has_lists','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','CmHopper','HopperHistories','VoiceQueueId','HopperBlacks','TrunkId','TrunkBackup','mandatoryDispositionPauseId','Agents','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Dispositions','Answers','List','ListId','team_has_mail_queues','Teams','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','ChatOfflineMessageId','restrict','IntervalId','TagId','Items','Interactions','Exntensions','mandatoryDispositionPause','FaxInteractionId','FaxAccountId','Owner','fax_interaction_has_tags','Users','Interaction','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','JscriptySessions','CampaignId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Action','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','cm_contact_has_tags','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','AccountId','Descriptions','DescriptionId','Subject','SubjectId','Description','FieldId','Variable','SugarcrmField','Subjects','SugarcrmAccount','Field','VariableId','DeskField','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','FreshsalesField','FromId','SessionId','ProjectId','user_has_teams','SmsQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfile','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','options','database','User','../api/user/user.model','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf576,0x173));var _0x6f57=function(_0x57afd2,_0x209f0c){_0x57afd2=_0x57afd2-0x0;var _0x174832=_0xf576[_0x57afd2];return _0x174832;};'use strict';var config=require(_0x6f57('0x0'));var Sequelize=require(_0x6f57('0x1'));var _=require(_0x6f57('0x2'));var jstz=require(_0x6f57('0x3'));var timezone=jstz[_0x6f57('0x4')]();config[_0x6f57('0x1')]=_[_0x6f57('0x5')](config[_0x6f57('0x1')],{'database':_0x6f57('0x6'),'username':_0x6f57('0x7'),'password':_0x6f57('0x8'),'options':{'host':_0x6f57('0x9'),'port':0xcea,'dialect':_0x6f57('0xa'),'dialectOptions':{'charset':_0x6f57('0xb')},'logging':![],'timezone':timezone[_0x6f57('0xc')](),'define':{'charset':_0x6f57('0xd'),'collate':_0x6f57('0xe')}}});config[_0x6f57('0xf')]=_['defaultsDeep'](config[_0x6f57('0xf')],{'database':_0x6f57('0x6'),'username':_0x6f57('0x7'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6f57('0xa'),'dialectOptions':{'charset':_0x6f57('0xb')},'logging':![],'timezone':timezone[_0x6f57('0xc')](),'define':{'charset':_0x6f57('0xd'),'collate':_0x6f57('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6f57('0x1')]['database'],config[_0x6f57('0x1')][_0x6f57('0x10')],config[_0x6f57('0x1')][_0x6f57('0x11')],config[_0x6f57('0x1')][_0x6f57('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x6f57('0x13')],config[_0x6f57('0xf')][_0x6f57('0x10')],config['sequelizeHistory'][_0x6f57('0x11')],config[_0x6f57('0xf')]['options'])};db[_0x6f57('0x14')]=db[_0x6f57('0x1')]['import'](_0x6f57('0x15'));db['VoiceChanSpy']=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x6f57('0x17')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x18'));db[_0x6f57('0x19')]=db[_0x6f57('0x1')]['import'](_0x6f57('0x1a'));db[_0x6f57('0x1b')]=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x6f57('0x1c')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x1d'));db['VoiceRecording']=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/voiceRecording/voiceRecording.model');db[_0x6f57('0x1e')]=db[_0x6f57('0x1')]['import'](_0x6f57('0x1f'));db[_0x6f57('0x20')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x21'));db[_0x6f57('0x22')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x23'));db[_0x6f57('0x24')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x25'));db['VoiceDialReport']=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x26'));db[_0x6f57('0x27')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x28'));db[_0x6f57('0x29')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x2a'));db[_0x6f57('0x2b')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x2c'));db[_0x6f57('0x2d')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x2e'));db['VoiceTransferReport']=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize']['import'](_0x6f57('0x2f'));db[_0x6f57('0x30')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x31'));db[_0x6f57('0x32')]=db[_0x6f57('0x1')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x6f57('0x33')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x34'));db[_0x6f57('0x35')]=db[_0x6f57('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x6f57('0x36')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x37'));db[_0x6f57('0x38')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x39'));db[_0x6f57('0x3a')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x3b'));db[_0x6f57('0x3c')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x3d'));db['MailServerOut']=db[_0x6f57('0x1')]['import'](_0x6f57('0x3e'));db[_0x6f57('0x3f')]=db['sequelize'][_0x6f57('0x16')]('../api/mailAccount/mailAccount.model');db[_0x6f57('0x40')]=db[_0x6f57('0x1')]['import'](_0x6f57('0x41'));db[_0x6f57('0x42')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x43'));db['MailInteraction']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x44'));db[_0x6f57('0x45')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/mailMessage/mailMessage.model');db[_0x6f57('0x46')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x47'));db[_0x6f57('0x48')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x49'));db[_0x6f57('0x4a')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x4b'));db[_0x6f57('0x4c')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x4d'));db[_0x6f57('0x4e')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x4f'));db[_0x6f57('0x50')]=db['sequelize']['import'](_0x6f57('0x51'));db[_0x6f57('0x52')]=db['sequelize'][_0x6f57('0x16')]('../api/faxInteraction/faxInteraction.model');db[_0x6f57('0x53')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x54'));db[_0x6f57('0x55')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x56'));db[_0x6f57('0x57')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x58'));db[_0x6f57('0x59')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x5a'));db[_0x6f57('0x5b')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x5c'));db[_0x6f57('0x5d')]=db[_0x6f57('0x1')]['import'](_0x6f57('0x5e'));db[_0x6f57('0x5f')]=db[_0x6f57('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0x6f57('0x60')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x61'));db[_0x6f57('0x62')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x63'));db[_0x6f57('0x64')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x65'));db[_0x6f57('0x66')]=db['sequelize']['import'](_0x6f57('0x67'));db[_0x6f57('0x68')]=db[_0x6f57('0x1')]['import'](_0x6f57('0x69'));db[_0x6f57('0x6a')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x6b'));db['ChatApplication']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x6c'));db[_0x6f57('0x6d')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x6e'));db[_0x6f57('0x6f')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x70'));db[_0x6f57('0x71')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x72'));db[_0x6f57('0x73')]=db['sequelize'][_0x6f57('0x16')]('../api/chatQueue/chatQueue.model');db[_0x6f57('0x74')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x75'));db[_0x6f57('0x76')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x77'));db[_0x6f57('0x78')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x79'));db[_0x6f57('0x7a')]=db['sequelize'][_0x6f57('0x16')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/cmHopper/cmHopper.model');db[_0x6f57('0x7b')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x7c'));db[_0x6f57('0x7d')]=db[_0x6f57('0x1')]['import'](_0x6f57('0x7e'));db[_0x6f57('0x7f')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x80'));db[_0x6f57('0x81')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x82'));db[_0x6f57('0x83')]=db['sequelize']['import']('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/action/action.model');db[_0x6f57('0x84')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/automation/automation.model');db[_0x6f57('0x85')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x86'));db[_0x6f57('0x87')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x88'));db[_0x6f57('0x89')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x8a'));db[_0x6f57('0x8b')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/interval/interval.model');db[_0x6f57('0x8c')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x8d'));db['Cdr']=db[_0x6f57('0x1')]['import']('../api/cdr/cdr.model');db['VoiceQueuesLog']=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x8e'));db[_0x6f57('0x8f')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x90'));db[_0x6f57('0x91')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x92'));db[_0x6f57('0x93')]=db['sequelize'][_0x6f57('0x16')]('../api/tag/tag.model');db[_0x6f57('0x94')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x95'));db[_0x6f57('0x96')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x97'));db['Variable']=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/variable/variable.model');db[_0x6f57('0x98')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x99'));db[_0x6f57('0x9a')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x9b'));db[_0x6f57('0x9c')]=db[_0x6f57('0x1')]['import'](_0x6f57('0x9d'));db['AnalyticDefaultReport']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x9e'));db[_0x6f57('0x9f')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0xa0'));db[_0x6f57('0xa1')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xa2'));db[_0x6f57('0xa3')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xa4'));db[_0x6f57('0xa5')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0xa6'));db[_0x6f57('0xa7')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xa8'));db[_0x6f57('0xa9')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xaa'));db[_0x6f57('0xab')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xac'));db['SugarcrmAccount']=db['sequelize'][_0x6f57('0x16')](_0x6f57('0xad'));db[_0x6f57('0xae')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xaf'));db['SugarcrmField']=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x6f57('0xb0')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0xb1'));db[_0x6f57('0xb2')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xb3'));db['DeskField']=db['sequelize']['import'](_0x6f57('0xb4'));db[_0x6f57('0xb5')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/intZohoAccount/intZohoAccount.model');db[_0x6f57('0xb6')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x6f57('0xb7')]=db[_0x6f57('0x1')]['import']('../api/intZohoField/intZohoField.model');db[_0x6f57('0xb8')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xb9'));db[_0x6f57('0xba')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xbb'));db[_0x6f57('0xbc')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xbd'));db[_0x6f57('0xbe')]=db['sequelize'][_0x6f57('0x16')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize']['import'](_0x6f57('0xbf'));db[_0x6f57('0xc0')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xc1'));db[_0x6f57('0xc2')]=db[_0x6f57('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x6f57('0xc3')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xc4'));db[_0x6f57('0xc5')]=db['sequelize'][_0x6f57('0x16')](_0x6f57('0xc6'));db['ServicenowAccount']=db['sequelize']['import'](_0x6f57('0xc7'));db[_0x6f57('0xc8')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xc9'));db[_0x6f57('0xca')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xcb'));db['Dynamics365Account']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xcc'));db[_0x6f57('0xcd')]=db[_0x6f57('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x6f57('0xce')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xcf'));db[_0x6f57('0xd0')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xd1'));db[_0x6f57('0xd2')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db['sequelize'][_0x6f57('0x16')](_0x6f57('0xd3'));db[_0x6f57('0x98')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/integration/integration.model');db[_0x6f57('0xd4')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/network/network.model');db[_0x6f57('0xd5')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xd6'));db[_0x6f57('0xd7')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xd8'));db[_0x6f57('0xd9')]=db['sequelize']['import'](_0x6f57('0xda'));db[_0x6f57('0xdb')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xdc'));db[_0x6f57('0xdd')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xde'));db[_0x6f57('0xdf')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xe0'));db[_0x6f57('0xe1')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/squareReport/squareReport.model');db[_0x6f57('0xe2')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xe3'));db[_0x6f57('0xe4')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xe5'));db[_0x6f57('0xe6')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xe7'));db[_0x6f57('0xe8')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xe9'));db[_0x6f57('0xea')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xeb'));db[_0x6f57('0xec')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xed'));db['SquareMessage']=db['sequelize']['import']('../api/squareMessage/squareMessage.model');db['Team']=db['sequelize'][_0x6f57('0x16')](_0x6f57('0xee'));db['License']=db['sequelize'][_0x6f57('0x16')](_0x6f57('0xef'));db[_0x6f57('0xf0')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xf1'));db[_0x6f57('0xf2')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xf3'));db[_0x6f57('0xf4')]=db['sequelize']['import'](_0x6f57('0xf5'));db[_0x6f57('0xf6')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0xf7'));db[_0x6f57('0xf8')]=db['sequelize']['import'](_0x6f57('0xf9'));db[_0x6f57('0xfa')]=db[_0x6f57('0x1')]['import'](_0x6f57('0xfb'));db[_0x6f57('0xfc')]=db['sequelize'][_0x6f57('0x16')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0x6f57('0x1')]['import'](_0x6f57('0xfd'));db[_0x6f57('0xfe')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/smsTransferReport/smsTransferReport.model');db[_0x6f57('0xff')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x100'));db['UserProfile']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x101'));db[_0x6f57('0x102')]=db['sequelize'][_0x6f57('0x16')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x103'));db[_0x6f57('0x104')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/userNotification/userNotification.model');db[_0x6f57('0x105')]=db['sequelize'][_0x6f57('0x16')]('../api/whatsappAccount/whatsappAccount.model');db[_0x6f57('0x106')]=db[_0x6f57('0x1')][_0x6f57('0x16')]('../api/whatsappApplication/whatsappApplication.model');db[_0x6f57('0x107')]=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x108'));db[_0x6f57('0x109')]=db['sequelize'][_0x6f57('0x16')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db['sequelize'][_0x6f57('0x16')](_0x6f57('0x10a'));db['WhatsappTransferReport']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x10b'));db['WhatsappQueue']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x10c'));db['CloudProvider']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x10d'));db['TeamVoiceQueue']=db[_0x6f57('0x1')][_0x6f57('0x16')](_0x6f57('0x10e'));db[_0x6f57('0x14')][_0x6f57('0x10f')](db[_0x6f57('0x20')],{'as':'VoiceMail','onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14')][_0x6f57('0x112')](db[_0x6f57('0x113')],{'as':_0x6f57('0x114'),'foreignKey':_0x6f57('0x111')});db['User'][_0x6f57('0x112')](db[_0x6f57('0x115')],{'as':_0x6f57('0x116'),'foreignKey':'UserId'});db[_0x6f57('0x14')][_0x6f57('0x112')](db[_0x6f57('0x19')],{'as':_0x6f57('0x117'),'onDelete':_0x6f57('0x110'),'hooks':!![]});db['User'][_0x6f57('0x112')](db[_0x6f57('0x7d')],{'as':_0x6f57('0x118'),'foreignKey':'UserId'});db[_0x6f57('0x14')]['hasMany'](db['CmHopperHistory'],{'as':_0x6f57('0x119'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14')][_0x6f57('0x112')](db[_0x6f57('0x81')],{'as':'ReportAgentPreview','foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14')][_0x6f57('0x112')](db[_0x6f57('0x64')],{'as':_0x6f57('0x11a'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14')][_0x6f57('0x112')](db[_0x6f57('0x6d')],{'as':_0x6f57('0x11b'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14')][_0x6f57('0x112')](db['SmsInteraction'],{'as':_0x6f57('0x11c'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14')][_0x6f57('0x112')](db['FaxInteraction'],{'as':_0x6f57('0x11d'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14')][_0x6f57('0x112')](db[_0x6f57('0x11e')],{'as':_0x6f57('0x11f'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14')][_0x6f57('0x112')](db[_0x6f57('0x107')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x6f57('0x14')]['hasMany'](db[_0x6f57('0x104')],{'as':'UserNotifications','foreignKey':_0x6f57('0x120')});db['User'][_0x6f57('0x121')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x6f57('0x122')});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x74')],{'as':_0x6f57('0x124'),'through':'chat_group_has_users'});db['User']['belongsToMany'](db[_0x6f57('0x7a')],{'as':_0x6f57('0x125'),'through':_0x6f57('0x126')});db['User'][_0x6f57('0x123')](db[_0x6f57('0xff')],{'as':_0x6f57('0x127'),'through':'cm_user_has_lists'});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x128')],{'through':'user_has_teams'});db['User']['belongsToMany'](db[_0x6f57('0x11e')],{'as':_0x6f57('0x11f'),'through':_0x6f57('0x129')});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x6d')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x52')],{'as':_0x6f57('0x11d'),'through':_0x6f57('0x12a')});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x5b')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x6f57('0x14')][_0x6f57('0x123')](db['OpenchannelInteraction'],{'as':_0x6f57('0x11a'),'through':_0x6f57('0x12b')});db[_0x6f57('0x14')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0x6f57('0x12c'),'through':_0x6f57('0x12d')});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x1c')],{'as':'VoiceQueues','through':_0x6f57('0x30'),'required':![]});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x40')],{'as':_0x6f57('0x12e'),'through':'UserMailQueue','required':![]});db['User'][_0x6f57('0x123')](db[_0x6f57('0x73')],{'as':_0x6f57('0x12f'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x6f57('0x123')](db[_0x6f57('0x55')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x6f57('0x14')]['belongsToMany'](db[_0x6f57('0x5f')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db['User'][_0x6f57('0x123')](db['OpenchannelQueue'],{'as':_0x6f57('0x130'),'through':'UserOpenchannelQueue','required':![]});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x131')],{'as':_0x6f57('0x132'),'through':'UserWhatsappQueue','required':![]});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0xff')],{'through':_0x6f57('0x133')});db['User'][_0x6f57('0x123')](db[_0x6f57('0x134')],{'as':_0x6f57('0x135'),'through':_0x6f57('0x136'),'required':![]});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x68')],{'as':_0x6f57('0x137'),'through':_0x6f57('0x138')});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x4e')],{'as':_0x6f57('0x139'),'through':_0x6f57('0x13a')});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x3f')],{'as':'MailAccounts','through':_0x6f57('0x13b')});db[_0x6f57('0x14')]['belongsToMany'](db[_0x6f57('0x60')],{'as':_0x6f57('0x13c'),'through':_0x6f57('0x13d')});db[_0x6f57('0x14')][_0x6f57('0x123')](db[_0x6f57('0x57')],{'as':'SmsAccounts','through':_0x6f57('0x13e')});db[_0x6f57('0x14')]['belongsToMany'](db[_0x6f57('0x105')],{'as':_0x6f57('0x13f'),'through':_0x6f57('0x140')});db[_0x6f57('0x14')][_0x6f57('0x123')](db['SquareProject'],{'as':_0x6f57('0x141'),'through':_0x6f57('0x142')});db[_0x6f57('0x143')][_0x6f57('0x112')](db['VoiceExtension'],{'as':_0x6f57('0x144'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x145')});db[_0x6f57('0x17')][_0x6f57('0x112')](db[_0x6f57('0x19')],{'onDelete':'cascade'});db['VoiceExtension'][_0x6f57('0x112')](db[_0x6f57('0x19')],{'as':_0x6f57('0x146'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x1b')][_0x6f57('0x123')](db[_0x6f57('0x91')],{'as':_0x6f57('0x147'),'through':_0x6f57('0x148')});db['VoiceQueue']['hasMany'](db['UserVoiceQueueRt'],{'as':_0x6f57('0x149'),'foreignKey':'VoiceQueueId'});db[_0x6f57('0x1c')][_0x6f57('0x112')](db[_0x6f57('0x14a')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x6f57('0x1c')][_0x6f57('0x112')](db[_0x6f57('0x7d')],{'as':_0x6f57('0x118'),'foreignKey':'VoiceQueueId'});db[_0x6f57('0x1c')][_0x6f57('0x112')](db['CmHopperHistory'],{'as':_0x6f57('0x14b'),'foreignKey':_0x6f57('0x14c')});db['VoiceQueue'][_0x6f57('0x112')](db[_0x6f57('0x81')],{'as':_0x6f57('0x81'),'foreignKey':_0x6f57('0x14c')});db[_0x6f57('0x1c')][_0x6f57('0x112')](db['CmHopperBlack'],{'as':_0x6f57('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x6f57('0x1c')][_0x6f57('0x112')](db[_0x6f57('0xdd')],{'as':'JscriptySessions','foreignKey':_0x6f57('0x14c')});db['VoiceQueue'][_0x6f57('0x121')](db[_0x6f57('0x2d')],{'as':_0x6f57('0x2d'),'foreignKey':_0x6f57('0x14e')});db[_0x6f57('0x1c')][_0x6f57('0x121')](db[_0x6f57('0x2d')],{'as':_0x6f57('0x14f'),'foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db[_0x6f57('0x8b')],{'as':_0x6f57('0x8b'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x6f57('0x121')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6f57('0x150')});db['VoiceQueue'][_0x6f57('0x123')](db[_0x6f57('0xff')],{'as':_0x6f57('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x6f57('0x1c')]['belongsToMany'](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':_0x6f57('0x30')});db[_0x6f57('0x1c')][_0x6f57('0x123')](db[_0x6f57('0x128')],{'as':'Teams','through':_0x6f57('0x152')});db[_0x6f57('0x1c')][_0x6f57('0x123')](db[_0x6f57('0xff')],{'as':_0x6f57('0x153'),'through':_0x6f57('0x154')});db[_0x6f57('0x113')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':'User','foreignKey':'UserId'});db[_0x6f57('0x1e')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':_0x6f57('0x14'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x20')][_0x6f57('0x112')](db[_0x6f57('0x22')],{'as':_0x6f57('0x155'),'onDelete':'cascade','foreignKey':_0x6f57('0x156'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x6f57('0x121')](db[_0x6f57('0x20')],{'foreignKey':_0x6f57('0x156'),'targetKey':_0x6f57('0x157')});db[_0x6f57('0x24')][_0x6f57('0x112')](db[_0x6f57('0x29')],{'as':_0x6f57('0x158'),'foreignKey':_0x6f57('0x159'),'constraints':![]});db['VoiceCallReport'][_0x6f57('0x112')](db['VoiceAgentReport'],{'as':_0x6f57('0x15a'),'foreignKey':_0x6f57('0x159'),'constraints':![]});db['VoiceCallReport'][_0x6f57('0x121')](db['User'],{'as':_0x6f57('0x14'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x24')]['belongsTo'](db['CmContact'],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x3c')][_0x6f57('0x121')](db[_0x6f57('0x3f')],{'as':'MailAccount','foreignKey':_0x6f57('0x15d')});db[_0x6f57('0x15e')][_0x6f57('0x121')](db[_0x6f57('0x3f')],{'as':'MailAccount','foreignKey':_0x6f57('0x15d')});db['MailAccount'][_0x6f57('0x10f')](db[_0x6f57('0x3c')],{'as':_0x6f57('0x15f'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x3f')]['hasOne'](db[_0x6f57('0x15e')],{'as':_0x6f57('0x160'),'onDelete':'cascade'});db['MailAccount'][_0x6f57('0x112')](db['Disposition'],{'as':_0x6f57('0x161'),'foreignKey':'MailAccountId','onDelete':_0x6f57('0x110')});db[_0x6f57('0x3f')][_0x6f57('0x112')](db[_0x6f57('0x85')],{'as':_0x6f57('0x162'),'foreignKey':_0x6f57('0x15d')});db[_0x6f57('0x3f')]['hasMany'](db[_0x6f57('0x45')],{'as':_0x6f57('0x155'),'foreignKey':'MailAccountId'});db[_0x6f57('0x3f')][_0x6f57('0x112')](db[_0x6f57('0x11e')],{'as':'Interactions'});db[_0x6f57('0x3f')][_0x6f57('0x112')](db['MailApplication'],{'as':_0x6f57('0x146')});db['MailAccount']['belongsTo'](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164')});db[_0x6f57('0x3f')]['belongsTo'](db[_0x6f57('0x94')],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount'][_0x6f57('0x121')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6f57('0x150')});db[_0x6f57('0x3f')]['belongsToMany'](db['User'],{'as':_0x6f57('0x151'),'through':_0x6f57('0x13b')});db[_0x6f57('0x40')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':_0x6f57('0x33')});db['MailQueue']['belongsToMany'](db[_0x6f57('0x128')],{'through':_0x6f57('0x165'),'as':_0x6f57('0x166')});db[_0x6f57('0x11e')][_0x6f57('0x112')](db[_0x6f57('0x45')],{'as':_0x6f57('0x155'),'onDelete':'cascade','foreignKey':_0x6f57('0x167')});db[_0x6f57('0x11e')][_0x6f57('0x121')](db[_0x6f57('0x3f')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x15d')});db[_0x6f57('0x11e')][_0x6f57('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x11e')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':'Owner','foreignKey':'UserId'});db['MailInteraction'][_0x6f57('0x123')](db[_0x6f57('0x93')],{'through':_0x6f57('0x169'),'as':_0x6f57('0x16a')});db['MailInteraction'][_0x6f57('0x123')](db[_0x6f57('0x93')],{'through':'mail_interaction_has_tags','as':_0x6f57('0x16b')});db[_0x6f57('0x11e')]['belongsToMany'](db[_0x6f57('0x14')],{'as':'Users','through':_0x6f57('0x129'),'foreignKey':_0x6f57('0x167')});db[_0x6f57('0x45')][_0x6f57('0x112')](db[_0x6f57('0xf4')],{'as':'Attachments','onDelete':_0x6f57('0x110')});db['MailMessage']['belongsTo'](db[_0x6f57('0x14')],{'as':_0x6f57('0x14')});db['MailMessage']['belongsTo'](db[_0x6f57('0x7a')],{'onDelete':_0x6f57('0x110'),'as':_0x6f57('0x15b')});db[_0x6f57('0x45')][_0x6f57('0x121')](db[_0x6f57('0x11e')],{'as':'Interaction','foreignKey':'MailInteractionId'});db['MailMessage'][_0x6f57('0x121')](db[_0x6f57('0x3f')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x15d')});db[_0x6f57('0x45')][_0x6f57('0x121')](db[_0x6f57('0x68')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x6f57('0x45')]['belongsTo'](db[_0x6f57('0x71')],{'as':_0x6f57('0x71'),'foreignKey':_0x6f57('0x16c')});db[_0x6f57('0x46')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x46')][_0x6f57('0x121')](db[_0x6f57('0x40')],{'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x46')][_0x6f57('0x121')](db[_0x6f57('0x3f')],{'onDelete':'restrict'});db[_0x6f57('0x46')][_0x6f57('0x121')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x6f57('0x16e')});db[_0x6f57('0x46')][_0x6f57('0x121')](db[_0x6f57('0x93')],{'onDelete':_0x6f57('0x16d'),'foreignKey':_0x6f57('0x16f')});db[_0x6f57('0x48')][_0x6f57('0x121')](db[_0x6f57('0x3f')],{});db[_0x6f57('0x48')][_0x6f57('0x121')](db[_0x6f57('0xff')],{'as':'List','foreignKey':'ListId'});db[_0x6f57('0x48')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x48')][_0x6f57('0x121')](db[_0x6f57('0x11e')],{});db['MailQueueReport'][_0x6f57('0x121')](db['MailMessage'],{});db[_0x6f57('0x48')][_0x6f57('0x121')](db[_0x6f57('0x14')],{});db['MailQueueReport'][_0x6f57('0x121')](db[_0x6f57('0x40')],{});db['Dashboard'][_0x6f57('0x112')](db['DashboardItem'],{'as':_0x6f57('0x170'),'onDelete':'cascade'});db[_0x6f57('0x4e')][_0x6f57('0x112')](db[_0x6f57('0x87')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x6f57('0x110')});db[_0x6f57('0x4e')][_0x6f57('0x112')](db['CannedAnswer'],{'as':_0x6f57('0x162'),'foreignKey':'FaxAccountId'});db[_0x6f57('0x4e')]['hasMany'](db[_0x6f57('0x52')],{'as':_0x6f57('0x171')});db['FaxAccount'][_0x6f57('0x112')](db[_0x6f57('0x50')],{'as':_0x6f57('0x146')});db[_0x6f57('0x4e')]['hasMany'](db[_0x6f57('0x19')],{'as':_0x6f57('0x172'),'onDelete':'cascade'});db[_0x6f57('0x4e')][_0x6f57('0x112')](db[_0x6f57('0x53')],{'as':_0x6f57('0x155')});db[_0x6f57('0x4e')][_0x6f57('0x121')](db[_0x6f57('0x2d')],{'as':'Trunk'});db[_0x6f57('0x4e')][_0x6f57('0x121')](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':'ListId'});db[_0x6f57('0x4e')][_0x6f57('0x121')](db[_0x6f57('0x8c')],{'as':_0x6f57('0x173'),'foreignKey':_0x6f57('0x150')});db['FaxAccount'][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':'Agents','through':_0x6f57('0x13a')});db['FaxApplication'][_0x6f57('0x121')](db[_0x6f57('0x14')],{'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x50')]['belongsTo'](db[_0x6f57('0x55')],{'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x50')][_0x6f57('0x121')](db[_0x6f57('0x4e')],{'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x50')][_0x6f57('0x121')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db['FaxInteraction']['hasMany'](db[_0x6f57('0x53')],{'as':_0x6f57('0x155'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x174')});db[_0x6f57('0x52')]['belongsTo'](db[_0x6f57('0x4e')],{'as':'Account','foreignKey':_0x6f57('0x175')});db[_0x6f57('0x52')][_0x6f57('0x121')](db['CmContact'],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db['FaxInteraction'][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':_0x6f57('0x176'),'foreignKey':'UserId'});db[_0x6f57('0x52')]['belongsToMany'](db[_0x6f57('0x93')],{'through':_0x6f57('0x177'),'as':_0x6f57('0x16a')});db[_0x6f57('0x52')]['belongsToMany'](db['Tag'],{'through':_0x6f57('0x177'),'as':_0x6f57('0x16b')});db[_0x6f57('0x52')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x178'),'through':_0x6f57('0x12a'),'foreignKey':_0x6f57('0x174')});db[_0x6f57('0x53')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'onDelete':'cascade','as':_0x6f57('0x14')});db[_0x6f57('0x53')][_0x6f57('0x121')](db[_0x6f57('0x52')],{'as':_0x6f57('0x179'),'foreignKey':_0x6f57('0x174')});db[_0x6f57('0x53')]['belongsTo'](db[_0x6f57('0x7a')],{'onDelete':_0x6f57('0x110'),'as':_0x6f57('0x15b')});db['FaxMessage'][_0x6f57('0x121')](db[_0x6f57('0xf4')],{'as':_0x6f57('0xf4'),'foreignKey':_0x6f57('0x17a')});db[_0x6f57('0x53')][_0x6f57('0x121')](db['FaxAccount'],{'as':_0x6f57('0x168'),'foreignKey':'FaxAccountId'});db[_0x6f57('0x55')][_0x6f57('0x123')](db['User'],{'as':_0x6f57('0x151'),'through':_0x6f57('0x35')});db[_0x6f57('0x55')][_0x6f57('0x123')](db[_0x6f57('0x128')],{'through':_0x6f57('0x17b'),'as':'Teams'});db[_0x6f57('0x17c')][_0x6f57('0x121')](db['FaxAccount'],{});db[_0x6f57('0x17c')]['belongsTo'](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':'ListId'});db[_0x6f57('0x17c')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x17c')][_0x6f57('0x121')](db[_0x6f57('0x52')],{});db[_0x6f57('0x17c')]['belongsTo'](db[_0x6f57('0x53')],{});db['FaxQueueReport']['belongsTo'](db['User'],{});db[_0x6f57('0x17c')][_0x6f57('0x121')](db[_0x6f57('0x55')],{});db[_0x6f57('0x57')]['hasMany'](db['Disposition'],{'as':_0x6f57('0x161'),'foreignKey':_0x6f57('0x17d'),'onDelete':'cascade'});db[_0x6f57('0x57')]['hasMany'](db['CannedAnswer'],{'as':_0x6f57('0x162'),'foreignKey':_0x6f57('0x17d')});db[_0x6f57('0x57')][_0x6f57('0x112')](db[_0x6f57('0x5d')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x6f57('0x57')]['hasMany'](db[_0x6f57('0x5b')],{'as':'Interactions'});db[_0x6f57('0x57')]['hasMany'](db[_0x6f57('0x59')],{'as':'Applications'});db[_0x6f57('0x57')]['belongsTo'](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164')});db['SmsAccount']['belongsTo'](db[_0x6f57('0x8c')],{'as':_0x6f57('0x173'),'foreignKey':_0x6f57('0x150')});db['SmsAccount'][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':'user_has_sms_accounts'});db[_0x6f57('0x59')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x59')][_0x6f57('0x121')](db[_0x6f57('0x5f')],{'onDelete':_0x6f57('0x16d')});db['SmsApplication']['belongsTo'](db[_0x6f57('0x57')],{'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x59')][_0x6f57('0x121')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x6f57('0x16e')});db[_0x6f57('0x59')][_0x6f57('0x121')](db['Tag'],{'onDelete':_0x6f57('0x16d'),'foreignKey':_0x6f57('0x16f')});db[_0x6f57('0x5b')][_0x6f57('0x112')](db['SmsMessage'],{'as':'Messages','onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x17e')});db['SmsInteraction']['belongsTo'](db[_0x6f57('0x57')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x17d')});db[_0x6f57('0x5b')]['belongsTo'](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db['SmsInteraction'][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':_0x6f57('0x176'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x5b')]['belongsToMany'](db[_0x6f57('0x93')],{'through':_0x6f57('0x17f'),'as':_0x6f57('0x16a')});db[_0x6f57('0x5b')][_0x6f57('0x123')](db[_0x6f57('0x93')],{'through':_0x6f57('0x17f'),'as':_0x6f57('0x16b')});db['SmsInteraction']['belongsToMany'](db[_0x6f57('0x14')],{'as':_0x6f57('0x178'),'through':_0x6f57('0x180'),'foreignKey':_0x6f57('0x17e')});db[_0x6f57('0x5d')]['belongsTo'](db[_0x6f57('0x14')],{'as':_0x6f57('0x14')});db['SmsMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x6f57('0x110'),'as':_0x6f57('0x15b')});db[_0x6f57('0x5d')][_0x6f57('0x121')](db[_0x6f57('0x5b')],{'onDelete':'cascade','as':_0x6f57('0x179'),'foreignKey':'SmsInteractionId'});db[_0x6f57('0x5d')]['belongsTo'](db[_0x6f57('0x57')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x17d')});db[_0x6f57('0x5f')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':'Agents','through':_0x6f57('0x36'),'foreignKey':_0x6f57('0x181')});db['SmsQueue'][_0x6f57('0x123')](db['Team'],{'through':_0x6f57('0x182'),'as':_0x6f57('0x166')});db[_0x6f57('0x60')][_0x6f57('0x112')](db['Disposition'],{'as':_0x6f57('0x161'),'foreignKey':_0x6f57('0x183'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x60')][_0x6f57('0x112')](db[_0x6f57('0x85')],{'as':'Answers','foreignKey':_0x6f57('0x183')});db[_0x6f57('0x60')][_0x6f57('0x112')](db[_0x6f57('0x64')],{'as':_0x6f57('0x171'),'foreignKey':_0x6f57('0x183')});db[_0x6f57('0x60')][_0x6f57('0x112')](db[_0x6f57('0x184')],{'as':_0x6f57('0x155'),'foreignKey':'OpenchannelAccountId'});db[_0x6f57('0x60')]['hasMany'](db[_0x6f57('0x62')],{'as':'Applications','foreignKey':_0x6f57('0x183')});db[_0x6f57('0x60')][_0x6f57('0x121')](db['CmList'],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164')});db[_0x6f57('0x60')]['belongsTo'](db[_0x6f57('0x8c')],{'as':_0x6f57('0x173'),'foreignKey':_0x6f57('0x150')});db[_0x6f57('0x60')][_0x6f57('0x123')](db['User'],{'as':_0x6f57('0x151'),'through':_0x6f57('0x13d')});db[_0x6f57('0x62')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'onDelete':_0x6f57('0x16d')});db['OpenchannelApplication'][_0x6f57('0x121')](db[_0x6f57('0x66')],{'onDelete':'restrict','foreignKey':_0x6f57('0x185')});db[_0x6f57('0x62')][_0x6f57('0x121')](db[_0x6f57('0x60')],{'onDelete':_0x6f57('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0x6f57('0x62')]['belongsTo'](db['Interval'],{'onDelete':_0x6f57('0x16d'),'foreignKey':_0x6f57('0x16e')});db[_0x6f57('0x62')][_0x6f57('0x121')](db[_0x6f57('0x93')],{'onDelete':_0x6f57('0x16d'),'foreignKey':_0x6f57('0x16f')});db[_0x6f57('0x64')][_0x6f57('0x112')](db['OpenchannelMessage'],{'as':_0x6f57('0x155'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x186')});db[_0x6f57('0x64')][_0x6f57('0x121')](db['OpenchannelAccount'],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x183')});db[_0x6f57('0x64')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x64')][_0x6f57('0x121')](db['User'],{'as':_0x6f57('0x176'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x64')][_0x6f57('0x123')](db[_0x6f57('0x93')],{'through':_0x6f57('0x187'),'as':_0x6f57('0x16a')});db[_0x6f57('0x64')][_0x6f57('0x123')](db[_0x6f57('0x93')],{'through':_0x6f57('0x187'),'as':_0x6f57('0x16b')});db[_0x6f57('0x64')][_0x6f57('0x123')](db['User'],{'as':_0x6f57('0x178'),'through':_0x6f57('0x12b'),'foreignKey':_0x6f57('0x186')});db['OpenchannelMessage']['belongsTo'](db[_0x6f57('0x14')],{'onDelete':_0x6f57('0x110'),'as':_0x6f57('0x14')});db['OpenchannelMessage']['belongsTo'](db[_0x6f57('0x7a')],{'onDelete':'cascade','as':_0x6f57('0x15b')});db[_0x6f57('0x184')][_0x6f57('0x121')](db['OpenchannelInteraction'],{'onDelete':_0x6f57('0x110'),'as':_0x6f57('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x6f57('0x184')][_0x6f57('0x121')](db['Attachment'],{'as':_0x6f57('0xf4'),'foreignKey':_0x6f57('0x17a')});db[_0x6f57('0x184')]['belongsTo'](db[_0x6f57('0x60')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x183')});db['OpenchannelQueue']['belongsToMany'](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':'UserOpenchannelQueue','foreignKey':_0x6f57('0x185')});db[_0x6f57('0x66')][_0x6f57('0x123')](db[_0x6f57('0x128')],{'through':_0x6f57('0x188'),'as':_0x6f57('0x166')});db[_0x6f57('0x68')][_0x6f57('0x112')](db['Disposition'],{'as':_0x6f57('0x161'),'foreignKey':_0x6f57('0x189'),'onDelete':_0x6f57('0x110')});db['ChatWebsite']['hasMany'](db[_0x6f57('0x85')],{'as':_0x6f57('0x162'),'foreignKey':_0x6f57('0x189')});db['ChatWebsite'][_0x6f57('0x112')](db[_0x6f57('0x76')],{'as':_0x6f57('0x18a')});db[_0x6f57('0x68')][_0x6f57('0x112')](db[_0x6f57('0x6d')],{'as':_0x6f57('0x171')});db['ChatWebsite'][_0x6f57('0x112')](db[_0x6f57('0x18b')],{'as':'Applications'});db[_0x6f57('0x68')]['hasMany'](db[_0x6f57('0x6f')],{'as':_0x6f57('0x155')});db['ChatWebsite'][_0x6f57('0x121')](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164')});db['ChatWebsite']['belongsTo'](db['Interval'],{'as':_0x6f57('0x8b'),'foreignKey':_0x6f57('0x16e')});db[_0x6f57('0x68')][_0x6f57('0x121')](db[_0x6f57('0x3f')],{'as':_0x6f57('0x3f'),'foreignKey':_0x6f57('0x15d')});db['ChatWebsite'][_0x6f57('0x121')](db[_0x6f57('0x8c')],{'as':_0x6f57('0x173'),'foreignKey':_0x6f57('0x150')});db[_0x6f57('0x68')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':_0x6f57('0x138')});db[_0x6f57('0x6a')][_0x6f57('0x121')](db[_0x6f57('0x60')],{});db[_0x6f57('0x6a')]['belongsTo'](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164')});db[_0x6f57('0x6a')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x6a')][_0x6f57('0x121')](db[_0x6f57('0x64')],{});db[_0x6f57('0x6a')][_0x6f57('0x121')](db[_0x6f57('0x184')],{});db['OpenchannelQueueReport'][_0x6f57('0x121')](db[_0x6f57('0x14')],{});db[_0x6f57('0x6a')][_0x6f57('0x121')](db['OpenchannelQueue'],{});db[_0x6f57('0x18b')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':_0x6f57('0x18c'),'foreignKey':_0x6f57('0x111'),'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x18b')][_0x6f57('0x121')](db[_0x6f57('0x73')],{'as':_0x6f57('0x18d'),'foreignKey':_0x6f57('0x18e'),'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x18b')]['belongsTo'](db[_0x6f57('0x68')],{'as':_0x6f57('0x18f'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0x6f57('0x121')](db[_0x6f57('0x93')],{'onDelete':'restrict','foreignKey':_0x6f57('0x16f')});db[_0x6f57('0x6d')][_0x6f57('0x112')](db['ChatMessage'],{'as':_0x6f57('0x155'),'onDelete':'cascade','foreignKey':_0x6f57('0x190')});db[_0x6f57('0x6d')]['belongsTo'](db[_0x6f57('0x68')],{'as':_0x6f57('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x6f57('0x6d')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'as':'Contact','foreignKey':_0x6f57('0x15c')});db['ChatInteraction'][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':_0x6f57('0x176'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x6d')][_0x6f57('0x123')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x6f57('0x16a')});db['ChatInteraction']['belongsToMany'](db[_0x6f57('0x93')],{'through':_0x6f57('0x191'),'as':'ThroughTags'});db[_0x6f57('0x6d')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x178'),'through':_0x6f57('0x192'),'foreignKey':_0x6f57('0x190')});db[_0x6f57('0x6f')][_0x6f57('0x121')](db['User'],{'onDelete':_0x6f57('0x110'),'as':_0x6f57('0x14')});db[_0x6f57('0x6f')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'onDelete':'cascade','as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x6f')][_0x6f57('0x121')](db[_0x6f57('0x6d')],{'onDelete':_0x6f57('0x110'),'as':_0x6f57('0x179'),'foreignKey':'ChatInteractionId'});db[_0x6f57('0x6f')]['belongsTo'](db[_0x6f57('0xf4')],{'as':_0x6f57('0xf4'),'foreignKey':_0x6f57('0x17a')});db[_0x6f57('0x6f')][_0x6f57('0x121')](db[_0x6f57('0x68')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x189')});db[_0x6f57('0x71')][_0x6f57('0x112')](db[_0x6f57('0xf4')],{'as':_0x6f57('0x193'),'foreignKey':_0x6f57('0x16c'),'onDelete':_0x6f57('0x110'),'hooks':!![]});db[_0x6f57('0x71')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'onDelete':_0x6f57('0x110'),'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db['ChatOfflineMessage'][_0x6f57('0x121')](db[_0x6f57('0x68')],{'as':'Account','foreignKey':_0x6f57('0x189')});db[_0x6f57('0x73')]['belongsToMany'](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':_0x6f57('0x32'),'hooks':!![]});db[_0x6f57('0x73')][_0x6f57('0x123')](db[_0x6f57('0x128')],{'through':_0x6f57('0x194'),'as':_0x6f57('0x166')});db['ChatGroup']['hasMany'](db['ChatInternalMessage'],{'as':_0x6f57('0x155'),'foreignKey':_0x6f57('0x195'),'onDelete':'cascade'});db[_0x6f57('0x74')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x149'),'through':'chat_group_has_users'});db[_0x6f57('0x76')][_0x6f57('0x121')](db[_0x6f57('0x68')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x6f57('0x78')]['hasMany'](db[_0x6f57('0x7a')],{'as':_0x6f57('0x125'),'foreignKey':_0x6f57('0x196')});db['CmContact'][_0x6f57('0x112')](db[_0x6f57('0x14a')],{'as':'Hoppers','foreignKey':_0x6f57('0x15c')});db['CmContact']['hasMany'](db[_0x6f57('0x7d')],{'as':_0x6f57('0x118'),'foreignKey':'ContactId'});db[_0x6f57('0x7a')][_0x6f57('0x112')](db['CmHopperHistory'],{'as':_0x6f57('0x14b'),'foreignKey':_0x6f57('0x15c')});db['CmContact']['hasMany'](db['ReportAgentPreview'],{'as':_0x6f57('0x81'),'foreignKey':'ContactId'});db['CmContact'][_0x6f57('0x112')](db[_0x6f57('0xdd')],{'as':_0x6f57('0x197'),'foreignKey':'ContactId'});db[_0x6f57('0x7a')][_0x6f57('0x112')](db[_0x6f57('0x64')],{'as':'OpenchannelInteractions','foreignKey':_0x6f57('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x6f57('0x112')](db[_0x6f57('0x6d')],{'as':_0x6f57('0x11b'),'foreignKey':'ContactId','onDelete':_0x6f57('0x16d')});db['CmContact'][_0x6f57('0x112')](db[_0x6f57('0x5b')],{'as':_0x6f57('0x11c'),'foreignKey':'ContactId','onDelete':_0x6f57('0x16d')});db[_0x6f57('0x7a')][_0x6f57('0x112')](db[_0x6f57('0x52')],{'as':_0x6f57('0x11d'),'foreignKey':'ContactId','onDelete':_0x6f57('0x16d')});db[_0x6f57('0x7a')][_0x6f57('0x112')](db[_0x6f57('0x11e')],{'as':'MailInteractions','foreignKey':_0x6f57('0x15c'),'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x7a')][_0x6f57('0x121')](db['CmCompany'],{'as':'Company','foreignKey':_0x6f57('0x196')});db[_0x6f57('0x7a')][_0x6f57('0x121')](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164'),'onDelete':'cascade'});db[_0x6f57('0x7a')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x178'),'through':_0x6f57('0x126')});db[_0x6f57('0x7a')]['belongsToMany'](db[_0x6f57('0x93')],{'as':_0x6f57('0x16a'),'through':'cm_contact_has_tags'});db[_0x6f57('0x7a')][_0x6f57('0x123')](db[_0x6f57('0x93')],{'through':'cm_contact_has_tags','as':_0x6f57('0x16b')});db[_0x6f57('0x14a')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c'),'onDelete':'cascade'});db[_0x6f57('0x14a')]['belongsTo'](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x14a')]['belongsTo'](db['User'],{'as':_0x6f57('0x18c'),'foreignKey':_0x6f57('0x111')});db[_0x6f57('0x14a')][_0x6f57('0x121')](db[_0x6f57('0x1c')],{'as':_0x6f57('0x18d'),'foreignKey':'VoiceQueueId','onDelete':_0x6f57('0x110')});db['CmHopper'][_0x6f57('0x121')](db[_0x6f57('0xf0')],{'as':_0x6f57('0xf0'),'foreignKey':_0x6f57('0x198'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x14a')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':_0x6f57('0x176'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x7b')]['belongsTo'](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x7b')][_0x6f57('0x121')](db['VoiceQueue'],{'as':_0x6f57('0x18d'),'foreignKey':_0x6f57('0x14c'),'onDelete':_0x6f57('0x110')});db['CmHopperBlack']['belongsTo'](db[_0x6f57('0xf0')],{'as':_0x6f57('0xf0'),'foreignKey':_0x6f57('0x198'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x84')]['hasMany'](db[_0x6f57('0x89')],{'as':{'plural':_0x6f57('0x199'),'singular':_0x6f57('0x19a')},'foreignKey':_0x6f57('0x19b'),'onDelete':'cascade','hooks':!![]});db[_0x6f57('0x84')][_0x6f57('0x112')](db[_0x6f57('0x89')],{'as':{'plural':'Any','singular':_0x6f57('0x19c')},'foreignKey':_0x6f57('0x19d'),'onDelete':_0x6f57('0x110'),'hooks':!![]});db[_0x6f57('0x84')][_0x6f57('0x112')](db[_0x6f57('0x19e')],{'as':_0x6f57('0x19f'),'foreignKey':_0x6f57('0x1a0'),'onDelete':_0x6f57('0x110'),'hooks':!![]});db[_0x6f57('0x87')][_0x6f57('0x112')](db[_0x6f57('0x87')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x6f57('0x110')});db[_0x6f57('0x8b')][_0x6f57('0x112')](db[_0x6f57('0x8b')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x6f57('0x110'),'hooks':!![],'required':![]});db[_0x6f57('0x8b')][_0x6f57('0x112')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x6f57('0x16e'),'onDelete':_0x6f57('0x16d')});db[_0x6f57('0x8b')][_0x6f57('0x112')](db[_0x6f57('0x46')],{'as':_0x6f57('0x1a1'),'foreignKey':_0x6f57('0x16e')});db[_0x6f57('0x8b')][_0x6f57('0x112')](db[_0x6f57('0x18b')],{'as':_0x6f57('0x1a2'),'foreignKey':_0x6f57('0x16e')});db['Interval'][_0x6f57('0x112')](db[_0x6f57('0x50')],{'as':_0x6f57('0x1a3'),'foreignKey':'IntervalId'});db[_0x6f57('0x8b')]['hasMany'](db[_0x6f57('0x59')],{'as':_0x6f57('0x1a4'),'foreignKey':'IntervalId'});db[_0x6f57('0x8f')][_0x6f57('0x121')](db[_0x6f57('0x3f')],{});db[_0x6f57('0x8f')][_0x6f57('0x121')](db[_0x6f57('0x1a5')],{'foreignKey':_0x6f57('0x1a6')});db[_0x6f57('0x8f')][_0x6f57('0x121')](db[_0x6f57('0x9c')],{'foreignKey':_0x6f57('0x1a7')});db[_0x6f57('0x91')][_0x6f57('0x123')](db[_0x6f57('0x1b')],{'as':_0x6f57('0x1a8'),'through':_0x6f57('0x148'),'onDelete':'restrict'});db[_0x6f57('0x93')][_0x6f57('0x123')](db['CmContact'],{'through':_0x6f57('0x1a9')});db[_0x6f57('0x93')][_0x6f57('0x123')](db[_0x6f57('0x6d')],{'through':_0x6f57('0x191')});db[_0x6f57('0x93')]['belongsToMany'](db[_0x6f57('0x11e')],{'through':'mail_interaction_has_tags'});db[_0x6f57('0x93')][_0x6f57('0x123')](db[_0x6f57('0x5b')],{'through':'sms_interaction_has_tags'});db[_0x6f57('0x93')]['belongsToMany'](db[_0x6f57('0x52')],{'through':'fax_interaction_has_tags'});db[_0x6f57('0x93')]['belongsToMany'](db[_0x6f57('0x64')],{'through':_0x6f57('0x187')});db['Tag'][_0x6f57('0x123')](db[_0x6f57('0x107')],{'through':_0x6f57('0x1aa')});db[_0x6f57('0x96')]['hasMany'](db[_0x6f57('0x89')],{'as':{'plural':_0x6f57('0x1ab'),'singular':'AllCondition'},'foreignKey':_0x6f57('0x1ac'),'onDelete':_0x6f57('0x110'),'hooks':!![]});db[_0x6f57('0x96')][_0x6f57('0x112')](db[_0x6f57('0x89')],{'as':{'plural':_0x6f57('0x1ad'),'singular':_0x6f57('0x1ae')},'foreignKey':'TriggerAnyId','onDelete':_0x6f57('0x110'),'hooks':!![]});db[_0x6f57('0x96')]['hasMany'](db[_0x6f57('0x19e')],{'as':_0x6f57('0x19f'),'foreignKey':_0x6f57('0x1af'),'onDelete':'cascade','hooks':!![]});db[_0x6f57('0x9c')][_0x6f57('0x112')](db[_0x6f57('0xa3')],{'as':_0x6f57('0x1b0'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1a7'),'hooks':!![]});db[_0x6f57('0x1a5')]['hasMany'](db[_0x6f57('0xa3')],{'as':_0x6f57('0x1b0'),'onDelete':_0x6f57('0x110'),'foreignKey':'DefaultReportId'});db[_0x6f57('0xa1')]['hasMany'](db[_0x6f57('0xa3')],{'as':_0x6f57('0x1b0'),'onDelete':'cascade','foreignKey':_0x6f57('0x1b1')});db[_0x6f57('0xa3')][_0x6f57('0x121')](db[_0x6f57('0xa1')],{'foreignKey':_0x6f57('0x1b1')});db[_0x6f57('0xa7')][_0x6f57('0x112')](db[_0x6f57('0xa9')],{'as':_0x6f57('0x1b2'),'onDelete':'cascade','foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xa9')][_0x6f57('0x112')](db[_0x6f57('0xab')],{'as':'Subjects','onDelete':_0x6f57('0x110'),'foreignKey':'SubjectId'});db[_0x6f57('0xa9')][_0x6f57('0x112')](db['SalesforceField'],{'as':_0x6f57('0x1b4'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xa9')][_0x6f57('0x112')](db[_0x6f57('0xab')],{'as':_0x6f57('0x1b0'),'onDelete':_0x6f57('0x110'),'foreignKey':'FieldId'});db[_0x6f57('0xa9')][_0x6f57('0x121')](db[_0x6f57('0xa7')],{'as':_0x6f57('0x168'),'foreignKey':'AccountId'});db[_0x6f57('0xab')][_0x6f57('0x112')](db[_0x6f57('0xab')],{'as':_0x6f57('0x1b6'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xab')][_0x6f57('0x112')](db[_0x6f57('0xab')],{'as':_0x6f57('0x1b8'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xab')][_0x6f57('0x112')](db[_0x6f57('0xab')],{'as':'Field','foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0xab')][_0x6f57('0x121')](db[_0x6f57('0x1ba')],{'as':_0x6f57('0x1ba'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x6f57('0x112')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xae')]['hasMany'](db[_0x6f57('0x1bb')],{'as':_0x6f57('0x1bc'),'onDelete':_0x6f57('0x110'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration']['hasMany'](db[_0x6f57('0x1bb')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xae')][_0x6f57('0x112')](db[_0x6f57('0x1bb')],{'as':'Fields','onDelete':_0x6f57('0x110'),'foreignKey':'FieldId'});db[_0x6f57('0xae')][_0x6f57('0x121')](db[_0x6f57('0x1bd')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0x1bb')]['hasMany'](db[_0x6f57('0x1bb')],{'as':_0x6f57('0x1b6'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0x6f57('0x112')](db[_0x6f57('0x1bb')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x6f57('0x112')](db['SugarcrmField'],{'as':_0x6f57('0x1be'),'foreignKey':_0x6f57('0x1b9')});db['SugarcrmField'][_0x6f57('0x121')](db['Variable'],{'as':_0x6f57('0x1ba'),'foreignKey':_0x6f57('0x1bf')});db[_0x6f57('0xb0')][_0x6f57('0x112')](db[_0x6f57('0xb2')],{'as':_0x6f57('0x1b2'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xb2')][_0x6f57('0x112')](db[_0x6f57('0x1c0')],{'as':_0x6f57('0x1bc'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xb2')]['hasMany'](db[_0x6f57('0x1c0')],{'as':_0x6f57('0x1b4'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xb2')][_0x6f57('0x112')](db[_0x6f57('0x1c0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0xb2')]['belongsTo'](db[_0x6f57('0xb0')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xb2')][_0x6f57('0x123')](db['Tag'],{'through':_0x6f57('0x1c1')});db['DeskField'][_0x6f57('0x112')](db[_0x6f57('0x1c0')],{'as':_0x6f57('0x1b6'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0x1c0')][_0x6f57('0x112')](db[_0x6f57('0x1c0')],{'as':_0x6f57('0x1b8'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0x1c0')][_0x6f57('0x112')](db[_0x6f57('0x1c0')],{'as':_0x6f57('0x1be'),'foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0x1c0')]['belongsTo'](db[_0x6f57('0x1ba')],{'as':_0x6f57('0x1ba'),'foreignKey':_0x6f57('0x1bf')});db[_0x6f57('0xb5')][_0x6f57('0x112')](db['ZohoConfiguration'],{'as':_0x6f57('0x1b2'),'onDelete':'cascade','foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xb6')]['hasMany'](db[_0x6f57('0xb7')],{'as':_0x6f57('0x1bc'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xb6')][_0x6f57('0x112')](db[_0x6f57('0xb7')],{'as':'Descriptions','onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xb6')]['hasMany'](db[_0x6f57('0xb7')],{'as':'Fields','onDelete':_0x6f57('0x110'),'foreignKey':'FieldId'});db[_0x6f57('0xb6')][_0x6f57('0x121')](db[_0x6f57('0xb5')],{'as':'Account','foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xb7')][_0x6f57('0x112')](db['ZohoField'],{'as':_0x6f57('0x1b6'),'foreignKey':'SubjectId'});db['ZohoField'][_0x6f57('0x112')](db[_0x6f57('0xb7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6f57('0xb7')]['hasMany'](db[_0x6f57('0xb7')],{'as':_0x6f57('0x1be'),'foreignKey':'FieldId'});db[_0x6f57('0xb7')][_0x6f57('0x121')](db[_0x6f57('0x1ba')],{'as':_0x6f57('0x1ba'),'foreignKey':'VariableId'});db[_0x6f57('0xb8')][_0x6f57('0x112')](db[_0x6f57('0xba')],{'as':_0x6f57('0x1b2'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xba')]['hasMany'](db[_0x6f57('0xbc')],{'as':_0x6f57('0x1bc'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xba')]['hasMany'](db[_0x6f57('0xbc')],{'as':_0x6f57('0x1b4'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x6f57('0x112')](db[_0x6f57('0xbc')],{'as':_0x6f57('0x1b0'),'foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0xba')][_0x6f57('0x121')](db[_0x6f57('0xb8')],{'as':_0x6f57('0x168'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x6f57('0x1c2')});db[_0x6f57('0xbc')][_0x6f57('0x112')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xbc')][_0x6f57('0x112')](db[_0x6f57('0xbc')],{'as':_0x6f57('0x1b8'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xbc')][_0x6f57('0x112')](db[_0x6f57('0xbc')],{'as':_0x6f57('0x1be'),'foreignKey':_0x6f57('0x1b9')});db['ZendeskField'][_0x6f57('0x121')](db[_0x6f57('0x1ba')],{'as':_0x6f57('0x1ba'),'foreignKey':_0x6f57('0x1bf')});db[_0x6f57('0xbe')][_0x6f57('0x112')](db[_0x6f57('0x1c3')],{'as':_0x6f57('0x1b2'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b3')});db['FreshdeskConfiguration'][_0x6f57('0x112')](db['FreshdeskField'],{'as':_0x6f57('0x1bc'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0x1c3')]['hasMany'](db[_0x6f57('0xc0')],{'as':'Descriptions','onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b5')});db['FreshdeskConfiguration'][_0x6f57('0x112')](db[_0x6f57('0xc0')],{'as':_0x6f57('0x1b0'),'onDelete':'cascade','foreignKey':_0x6f57('0x1b9')});db['FreshdeskConfiguration']['belongsTo'](db[_0x6f57('0xbe')],{'as':'Account','foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0x1c3')][_0x6f57('0x123')](db['Tag'],{'through':_0x6f57('0x1c4')});db[_0x6f57('0xc0')][_0x6f57('0x112')](db[_0x6f57('0xc0')],{'as':_0x6f57('0x1b6'),'foreignKey':'SubjectId'});db[_0x6f57('0xc0')][_0x6f57('0x112')](db[_0x6f57('0xc0')],{'as':_0x6f57('0x1b8'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xc0')]['hasMany'](db[_0x6f57('0xc0')],{'as':_0x6f57('0x1be'),'foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0xc0')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x6f57('0x1bf')});db[_0x6f57('0xc2')]['hasMany'](db[_0x6f57('0xc3')],{'as':_0x6f57('0x1b2'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xc3')][_0x6f57('0x112')](db[_0x6f57('0xc5')],{'as':_0x6f57('0x1bc'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xc3')]['hasMany'](db[_0x6f57('0xc5')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x6f57('0xc3')]['hasMany'](db['VtigerField'],{'as':_0x6f57('0x1b0'),'foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0xc3')][_0x6f57('0x121')](db['VtigerAccount'],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xc5')]['hasMany'](db[_0x6f57('0xc5')],{'as':_0x6f57('0x1b6'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xc5')][_0x6f57('0x112')](db[_0x6f57('0xc5')],{'as':_0x6f57('0x1b8'),'foreignKey':'DescriptionId'});db[_0x6f57('0xc5')]['hasMany'](db[_0x6f57('0xc5')],{'as':_0x6f57('0x1be'),'foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0xc5')][_0x6f57('0x121')](db[_0x6f57('0x1ba')],{'as':_0x6f57('0x1ba'),'foreignKey':'VariableId'});db[_0x6f57('0x1c5')][_0x6f57('0x112')](db[_0x6f57('0xc8')],{'as':_0x6f57('0x1b2'),'onDelete':'cascade','foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xc8')][_0x6f57('0x112')](db[_0x6f57('0xca')],{'as':'Subjects','foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xc8')][_0x6f57('0x112')](db[_0x6f57('0xca')],{'as':'Descriptions','foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xc8')]['hasMany'](db[_0x6f57('0xca')],{'as':'Fields','foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0xc8')][_0x6f57('0x121')](db['ServicenowAccount'],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xca')][_0x6f57('0x112')](db[_0x6f57('0xca')],{'as':_0x6f57('0x1b6'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0xca')][_0x6f57('0x112')](db['ServicenowField'],{'as':_0x6f57('0x1b8'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xca')][_0x6f57('0x112')](db[_0x6f57('0xca')],{'as':_0x6f57('0x1be'),'foreignKey':_0x6f57('0x1b9')});db['ServicenowField'][_0x6f57('0x121')](db[_0x6f57('0x1ba')],{'as':_0x6f57('0x1ba'),'foreignKey':_0x6f57('0x1bf')});db[_0x6f57('0x1c6')][_0x6f57('0x112')](db[_0x6f57('0xcd')],{'as':_0x6f57('0x1b2'),'onDelete':'cascade','foreignKey':_0x6f57('0x1b3')});db['Dynamics365Configuration'][_0x6f57('0x112')](db[_0x6f57('0xce')],{'as':_0x6f57('0x1bc'),'onDelete':_0x6f57('0x110'),'foreignKey':'SubjectId'});db[_0x6f57('0xcd')][_0x6f57('0x112')](db[_0x6f57('0xce')],{'as':'Descriptions','onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b5')});db[_0x6f57('0xcd')][_0x6f57('0x112')](db[_0x6f57('0xce')],{'as':'Fields','onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b9')});db[_0x6f57('0xcd')][_0x6f57('0x121')](db[_0x6f57('0x1c6')],{'as':_0x6f57('0x168'),'foreignKey':'AccountId'});db[_0x6f57('0xce')][_0x6f57('0x112')](db[_0x6f57('0xce')],{'as':_0x6f57('0x1b6'),'foreignKey':_0x6f57('0x1b7')});db['Dynamics365Field'][_0x6f57('0x112')](db['Dynamics365Field'],{'as':_0x6f57('0x1b8'),'foreignKey':_0x6f57('0x1b5')});db['Dynamics365Field'][_0x6f57('0x112')](db['Dynamics365Field'],{'as':_0x6f57('0x1be'),'foreignKey':_0x6f57('0x1b9')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0x6f57('0x1ba'),'foreignKey':'VariableId'});db[_0x6f57('0xd0')][_0x6f57('0x112')](db[_0x6f57('0xd2')],{'as':_0x6f57('0x1b2'),'onDelete':_0x6f57('0x110'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0xd2')][_0x6f57('0x112')](db['FreshsalesField'],{'as':_0x6f57('0x1bc'),'foreignKey':_0x6f57('0x1b7')});db['FreshsalesConfiguration'][_0x6f57('0x112')](db[_0x6f57('0x1c7')],{'as':_0x6f57('0x1b4'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x6f57('0x112')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x6f57('0x1b9')});db['FreshsalesConfiguration'][_0x6f57('0x121')](db['FreshsalesAccount'],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x1b3')});db[_0x6f57('0x1c7')]['hasMany'](db['FreshsalesField'],{'as':_0x6f57('0x1b6'),'foreignKey':_0x6f57('0x1b7')});db[_0x6f57('0x1c7')][_0x6f57('0x112')](db[_0x6f57('0x1c7')],{'as':'Description','foreignKey':_0x6f57('0x1b5')});db['FreshsalesField']['hasMany'](db[_0x6f57('0x1c7')],{'as':_0x6f57('0x1be'),'foreignKey':_0x6f57('0x1b9')});db['FreshsalesField'][_0x6f57('0x121')](db['Variable'],{'as':_0x6f57('0x1ba'),'foreignKey':_0x6f57('0x1bf')});db['ChatQueueReport'][_0x6f57('0x121')](db[_0x6f57('0x68')],{});db[_0x6f57('0xd5')][_0x6f57('0x121')](db['CmList'],{'as':'List','foreignKey':_0x6f57('0x164')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0xd5')][_0x6f57('0x121')](db[_0x6f57('0x6d')],{});db[_0x6f57('0xd5')][_0x6f57('0x121')](db['ChatMessage'],{});db[_0x6f57('0xd5')][_0x6f57('0x121')](db[_0x6f57('0x14')],{});db['ChatQueueReport'][_0x6f57('0x121')](db['ChatQueue'],{});db[_0x6f57('0xd7')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'onDelete':'cascade','foreignKey':_0x6f57('0x1c8')});db[_0x6f57('0xd7')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'onDelete':_0x6f57('0x110'),'foreignKey':'ToId'});db[_0x6f57('0xdd')][_0x6f57('0x112')](db[_0x6f57('0xdb')],{'foreignKey':_0x6f57('0x1c9'),'onDelete':_0x6f57('0x110')});db['JscriptySessionReport'][_0x6f57('0x112')](db[_0x6f57('0xd9')],{'foreignKey':'SessionId','onDelete':_0x6f57('0x110')});db[_0x6f57('0xdf')][_0x6f57('0x121')](db['SmsAccount'],{});db[_0x6f57('0xdf')][_0x6f57('0x121')](db[_0x6f57('0xff')],{'as':'List','foreignKey':_0x6f57('0x164')});db['SmsQueueReport']['belongsTo'](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0xdf')]['belongsTo'](db[_0x6f57('0x5b')],{});db[_0x6f57('0xdf')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x6f57('0x121')](db[_0x6f57('0x14')],{});db[_0x6f57('0xdf')][_0x6f57('0x121')](db[_0x6f57('0x5f')],{});db[_0x6f57('0xe4')][_0x6f57('0x112')](db['JscriptySessionReport'],{'foreignKey':_0x6f57('0x1ca')});db['JscriptyProject']['hasMany'](db[_0x6f57('0xdb')],{'foreignKey':'ProjectId'});db[_0x6f57('0xe4')]['hasMany'](db[_0x6f57('0xd9')],{'foreignKey':_0x6f57('0x1ca')});db['SquareProject'][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x178'),'through':_0x6f57('0x142')});db[_0x6f57('0x128')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':_0x6f57('0x1cb')});db['Team']['belongsToMany'](db[_0x6f57('0x1c')],{'through':_0x6f57('0x152'),'as':'VoiceQueues'});db['Team'][_0x6f57('0x123')](db[_0x6f57('0x40')],{'through':'team_has_mail_queues','as':_0x6f57('0x12e')});db[_0x6f57('0x128')][_0x6f57('0x123')](db[_0x6f57('0x73')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x6f57('0x128')][_0x6f57('0x123')](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x6f57('0x128')][_0x6f57('0x123')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0x6f57('0x1cc')});db[_0x6f57('0x128')][_0x6f57('0x123')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x6f57('0x130')});db['Team'][_0x6f57('0x123')](db[_0x6f57('0x131')],{'through':_0x6f57('0x1cd'),'as':_0x6f57('0x132')});db['Campaign']['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x6f57('0x198')});db[_0x6f57('0xf0')][_0x6f57('0x112')](db[_0x6f57('0x7d')],{'as':'HopperFinals','foreignKey':_0x6f57('0x198')});db[_0x6f57('0xf0')]['hasMany'](db[_0x6f57('0x7f')],{'as':_0x6f57('0x14b'),'foreignKey':_0x6f57('0x198')});db[_0x6f57('0xf0')][_0x6f57('0x112')](db[_0x6f57('0x7b')],{'as':'HopperBlacks','foreignKey':_0x6f57('0x198')});db[_0x6f57('0xf0')]['belongsTo'](db['Trunk'],{'as':_0x6f57('0x2d'),'foreignKey':'TrunkId'});db[_0x6f57('0xf0')][_0x6f57('0x121')](db[_0x6f57('0x2d')],{'as':_0x6f57('0x14f'),'foreignKey':_0x6f57('0x1ce')});db[_0x6f57('0xf0')][_0x6f57('0x121')](db['Interval'],{'as':_0x6f57('0x8b'),'foreignKey':_0x6f57('0x16e')});db[_0x6f57('0xf0')][_0x6f57('0x121')](db[_0x6f57('0xea')],{'as':_0x6f57('0xea'),'foreignKey':_0x6f57('0x1cf')});db['Campaign'][_0x6f57('0x123')](db[_0x6f57('0xff')],{'as':_0x6f57('0x127'),'through':_0x6f57('0x1d0')});db['Campaign'][_0x6f57('0x123')](db[_0x6f57('0xff')],{'as':_0x6f57('0x153'),'through':'campaigns_has_cm_blacklists'});db[_0x6f57('0xf4')][_0x6f57('0x121')](db[_0x6f57('0x71')],{'as':_0x6f57('0x71'),'foreignKey':_0x6f57('0x16c')});db[_0x6f57('0xf8')][_0x6f57('0x121')](db[_0x6f57('0x45')],{});db[_0x6f57('0xf8')][_0x6f57('0x121')](db[_0x6f57('0x11e')],{});db['MailTransferReport'][_0x6f57('0x121')](db[_0x6f57('0x3f')],{'foreignKey':_0x6f57('0x1d1'),'as':'FromAccount'});db[_0x6f57('0xf8')][_0x6f57('0x121')](db['User'],{'foreignKey':_0x6f57('0x1d2'),'as':_0x6f57('0x1d3')});db[_0x6f57('0xf8')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'foreignKey':_0x6f57('0x1d4'),'as':_0x6f57('0x1d5')});db[_0x6f57('0xf8')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x6f57('0x1d6'),'as':'ToQueue'});db['MailTransferReport']['belongsTo'](db[_0x6f57('0x3f')],{'foreignKey':_0x6f57('0x1d7'),'as':_0x6f57('0x1d8')});db[_0x6f57('0xfa')][_0x6f57('0x121')](db[_0x6f57('0x6f')],{});db[_0x6f57('0xfa')][_0x6f57('0x121')](db[_0x6f57('0x6d')],{});db[_0x6f57('0xfa')][_0x6f57('0x121')](db[_0x6f57('0x68')],{'foreignKey':'FromChatWebsiteId','as':_0x6f57('0x1d9')});db['ChatTransferReport'][_0x6f57('0x121')](db[_0x6f57('0x14')],{'foreignKey':_0x6f57('0x1d2'),'as':_0x6f57('0x1d3')});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x6f57('0x1d4'),'as':_0x6f57('0x1d5')});db['ChatTransferReport']['belongsTo'](db[_0x6f57('0x73')],{'foreignKey':_0x6f57('0x1da'),'as':_0x6f57('0x1db')});db['ChatTransferReport'][_0x6f57('0x121')](db[_0x6f57('0x68')],{'foreignKey':_0x6f57('0x1dc'),'as':_0x6f57('0x1d8')});db[_0x6f57('0xfc')][_0x6f57('0x121')](db[_0x6f57('0x53')],{});db[_0x6f57('0xfc')][_0x6f57('0x121')](db[_0x6f57('0x52')],{});db[_0x6f57('0xfc')]['belongsTo'](db[_0x6f57('0x4e')],{'foreignKey':_0x6f57('0x1dd'),'as':_0x6f57('0x1d9')});db[_0x6f57('0xfc')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'foreignKey':_0x6f57('0x1d2'),'as':_0x6f57('0x1d3')});db[_0x6f57('0xfc')][_0x6f57('0x121')](db['User'],{'foreignKey':_0x6f57('0x1d4'),'as':_0x6f57('0x1d5')});db[_0x6f57('0xfc')][_0x6f57('0x121')](db['FaxQueue'],{'foreignKey':_0x6f57('0x1de'),'as':'ToQueue'});db['FaxTransferReport']['belongsTo'](db[_0x6f57('0x4e')],{'foreignKey':_0x6f57('0x1df'),'as':_0x6f57('0x1d8')});db[_0x6f57('0x1e0')][_0x6f57('0x121')](db[_0x6f57('0x184')],{});db[_0x6f57('0x1e0')][_0x6f57('0x121')](db[_0x6f57('0x64')],{});db[_0x6f57('0x1e0')][_0x6f57('0x121')](db['OpenchannelAccount'],{'foreignKey':_0x6f57('0x1e1'),'as':_0x6f57('0x1d9')});db[_0x6f57('0x1e0')]['belongsTo'](db[_0x6f57('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x6f57('0x1e0')]['belongsTo'](db[_0x6f57('0x14')],{'foreignKey':_0x6f57('0x1d4'),'as':_0x6f57('0x1d5')});db[_0x6f57('0x1e0')][_0x6f57('0x121')](db[_0x6f57('0x66')],{'foreignKey':_0x6f57('0x1e2'),'as':_0x6f57('0x1db')});db[_0x6f57('0x1e0')]['belongsTo'](db[_0x6f57('0x60')],{'foreignKey':_0x6f57('0x1e3'),'as':_0x6f57('0x1d8')});db[_0x6f57('0xfe')][_0x6f57('0x121')](db['SmsMessage'],{});db['SmsTransferReport'][_0x6f57('0x121')](db[_0x6f57('0x5b')],{});db['SmsTransferReport'][_0x6f57('0x121')](db[_0x6f57('0x57')],{'foreignKey':'FromSmsAccountId','as':_0x6f57('0x1d9')});db[_0x6f57('0xfe')][_0x6f57('0x121')](db['User'],{'foreignKey':_0x6f57('0x1d2'),'as':_0x6f57('0x1d3')});db[_0x6f57('0xfe')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'foreignKey':_0x6f57('0x1d4'),'as':_0x6f57('0x1d5')});db[_0x6f57('0xfe')]['belongsTo'](db[_0x6f57('0x5f')],{'foreignKey':_0x6f57('0x1e4'),'as':_0x6f57('0x1db')});db[_0x6f57('0xfe')][_0x6f57('0x121')](db[_0x6f57('0x57')],{'foreignKey':_0x6f57('0x1e5'),'as':_0x6f57('0x1d8')});db[_0x6f57('0xff')][_0x6f57('0x112')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6f57('0x164'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0xff')][_0x6f57('0x112')](db[_0x6f57('0x83')],{'as':_0x6f57('0x1e6'),'foreignKey':_0x6f57('0x164')});db[_0x6f57('0xff')][_0x6f57('0x112')](db[_0x6f57('0x7a')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x6f57('0x164')});db[_0x6f57('0xff')]['hasMany'](db['CmHopperFinal'],{'as':_0x6f57('0x118'),'foreignKey':_0x6f57('0x164')});db[_0x6f57('0xff')][_0x6f57('0x112')](db[_0x6f57('0x7f')],{'as':_0x6f57('0x119'),'foreignKey':_0x6f57('0x164')});db[_0x6f57('0xff')][_0x6f57('0x112')](db[_0x6f57('0x81')],{'as':'ReportAgentPreview','foreignKey':_0x6f57('0x164')});db[_0x6f57('0xff')]['belongsToMany'](db[_0x6f57('0x1c')],{'as':_0x6f57('0x1e7'),'through':'voice_queues_has_cm_lists'});db[_0x6f57('0xff')][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':_0x6f57('0x133')});db[_0x6f57('0x134')][_0x6f57('0x112')](db[_0x6f57('0x19')],{'as':'Extensions','onDelete':_0x6f57('0x110')});db['VoicePrefix'][_0x6f57('0x123')](db[_0x6f57('0x14')],{'as':'Agents','through':_0x6f57('0x136')});db[_0x6f57('0x1e8')][_0x6f57('0x112')](db[_0x6f57('0x14')],{'as':_0x6f57('0x178'),'foreignKey':_0x6f57('0x122')});db[_0x6f57('0x1e8')]['hasMany'](db[_0x6f57('0x102')],{'as':_0x6f57('0x1e9'),'foreignKey':_0x6f57('0x122'),'onDelete':_0x6f57('0x110')});db[_0x6f57('0x102')][_0x6f57('0x112')](db[_0x6f57('0x1ea')],{'as':_0x6f57('0x1eb'),'foreignKey':_0x6f57('0x1ec'),'onDelete':'cascade'});db[_0x6f57('0x105')][_0x6f57('0x112')](db[_0x6f57('0x87')],{'as':_0x6f57('0x161'),'foreignKey':'WhatsappAccountId','onDelete':_0x6f57('0x110')});db['WhatsappAccount'][_0x6f57('0x112')](db[_0x6f57('0x85')],{'as':_0x6f57('0x162'),'foreignKey':_0x6f57('0x1ed')});db['WhatsappAccount'][_0x6f57('0x112')](db[_0x6f57('0x109')],{'as':_0x6f57('0x155'),'foreignKey':_0x6f57('0x1ed')});db[_0x6f57('0x105')][_0x6f57('0x112')](db[_0x6f57('0x107')],{'as':_0x6f57('0x171')});db['WhatsappAccount']['hasMany'](db[_0x6f57('0x106')],{'as':_0x6f57('0x146')});db['WhatsappAccount']['belongsTo'](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164')});db[_0x6f57('0x105')][_0x6f57('0x121')](db['Pause'],{'as':_0x6f57('0x173'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6f57('0x105')][_0x6f57('0x123')](db['User'],{'as':_0x6f57('0x151'),'through':'user_has_whatsapp_accounts'});db[_0x6f57('0x106')]['belongsTo'](db[_0x6f57('0x14')],{'onDelete':'restrict'});db[_0x6f57('0x106')][_0x6f57('0x121')](db[_0x6f57('0x131')],{'onDelete':'restrict'});db[_0x6f57('0x106')][_0x6f57('0x121')](db[_0x6f57('0x105')],{'onDelete':_0x6f57('0x16d')});db['WhatsappApplication']['belongsTo'](db[_0x6f57('0x8b')],{'onDelete':'restrict','foreignKey':_0x6f57('0x16e')});db[_0x6f57('0x106')]['belongsTo'](db[_0x6f57('0x93')],{'onDelete':_0x6f57('0x16d'),'foreignKey':_0x6f57('0x16f')});db[_0x6f57('0x107')]['hasMany'](db[_0x6f57('0x109')],{'as':'Messages','onDelete':_0x6f57('0x110'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x6f57('0x121')](db[_0x6f57('0x105')],{'as':'Account','foreignKey':_0x6f57('0x1ed')});db[_0x6f57('0x107')][_0x6f57('0x121')](db['CmContact'],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x107')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'as':_0x6f57('0x176'),'foreignKey':'UserId'});db[_0x6f57('0x107')][_0x6f57('0x123')](db['Tag'],{'through':_0x6f57('0x1aa'),'as':_0x6f57('0x16a')});db[_0x6f57('0x107')]['belongsToMany'](db[_0x6f57('0x93')],{'through':_0x6f57('0x1aa'),'as':_0x6f57('0x16b')});db['WhatsappInteraction']['belongsToMany'](db[_0x6f57('0x14')],{'as':_0x6f57('0x178'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x6f57('0x121')](db['User'],{'as':'User'});db[_0x6f57('0x109')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'onDelete':_0x6f57('0x110'),'as':'Contact'});db[_0x6f57('0x109')][_0x6f57('0x121')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x6f57('0x179'),'foreignKey':_0x6f57('0x1ee')});db[_0x6f57('0x109')]['belongsTo'](db[_0x6f57('0x105')],{'as':_0x6f57('0x168'),'foreignKey':_0x6f57('0x1ed')});db[_0x6f57('0x1ef')][_0x6f57('0x121')](db[_0x6f57('0x105')],{});db[_0x6f57('0x1ef')][_0x6f57('0x121')](db[_0x6f57('0xff')],{'as':_0x6f57('0x163'),'foreignKey':_0x6f57('0x164')});db[_0x6f57('0x1ef')][_0x6f57('0x121')](db[_0x6f57('0x7a')],{'as':_0x6f57('0x15b'),'foreignKey':_0x6f57('0x15c')});db[_0x6f57('0x1ef')][_0x6f57('0x121')](db[_0x6f57('0x107')],{});db[_0x6f57('0x1ef')][_0x6f57('0x121')](db[_0x6f57('0x131')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x6f57('0x109')],{});db[_0x6f57('0x1ef')][_0x6f57('0x121')](db[_0x6f57('0x14')],{});db['WhatsappTransferReport'][_0x6f57('0x121')](db[_0x6f57('0x109')],{});db['WhatsappTransferReport'][_0x6f57('0x121')](db[_0x6f57('0x107')],{});db[_0x6f57('0x1f0')][_0x6f57('0x121')](db['WhatsappAccount'],{'foreignKey':_0x6f57('0x1f1'),'as':_0x6f57('0x1d9')});db[_0x6f57('0x1f0')]['belongsTo'](db[_0x6f57('0x105')],{'foreignKey':_0x6f57('0x1f2'),'as':_0x6f57('0x1d8')});db[_0x6f57('0x1f0')]['belongsTo'](db[_0x6f57('0x131')],{'foreignKey':_0x6f57('0x1f3'),'as':_0x6f57('0x1db')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x6f57('0x1d2'),'as':_0x6f57('0x1d3')});db[_0x6f57('0x1f0')][_0x6f57('0x121')](db[_0x6f57('0x14')],{'foreignKey':_0x6f57('0x1d4'),'as':_0x6f57('0x1d5')});db[_0x6f57('0x131')]['belongsToMany'](db[_0x6f57('0x14')],{'as':_0x6f57('0x151'),'through':_0x6f57('0x3a'),'foreignKey':_0x6f57('0x1f4')});db['WhatsappQueue'][_0x6f57('0x123')](db[_0x6f57('0x128')],{'through':_0x6f57('0x1cd'),'as':_0x6f57('0x166')});module[_0x6f57('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f6b238b..0ce23ee 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28d0=['default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','other','agent_name','test','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./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/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/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/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','./api/rpc','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','join','root','/demo','/snippet','snippet','3.0.0','/plugins','get','sendFile','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','mobile','clientId','clientSecret','code','accessKey','tenantId','channelSecret','accessToken','authToken','consumerKey','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','pass','localstationid','dsn','secret','oldPassword','isPlainObject','isString','@@{','replace','}@@','includes','lodash','path','express-winston','util','./config/environment','./config/logger','api','auth'];(function(_0x45d238,_0x206062){var _0x1f1dde=function(_0x38bda5){while(--_0x38bda5){_0x45d238['push'](_0x45d238['shift']());}};_0x1f1dde(++_0x206062);}(_0x28d0,0x13f));var _0x028d=function(_0x211618,_0x295c9f){_0x211618=_0x211618-0x0;var _0x587633=_0x28d0[_0x211618];return _0x587633;};'use strict';var _=require(_0x028d('0x0'));var path=require(_0x028d('0x1'));var express=require('express');var ewinston=require(_0x028d('0x2'));var util=require(_0x028d('0x3'));var errors=require('./errors');var config=require(_0x028d('0x4'));var logger=require(_0x028d('0x5'))(_0x028d('0x6'));var authLogger=require(_0x028d('0x5'))(_0x028d('0x7'));exports[_0x028d('0x8')]=function(_0x159474){_0x159474[_0x028d('0x9')](ewinston[_0x028d('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x808f39,_0x5aca3b){var _0x2f7992=_0x028d('0xb');if(!_[_0x028d('0xc')](_0x808f39[_0x028d('0xd')])){_0x2f7992+=_0x028d('0xe');var _0x4b5822=_0x808f39[_0x028d('0xd')];maskSensitiveData(_0x4b5822);}return util[_0x028d('0xf')](_0x2f7992,_0x808f39['method'],_0x808f39[_0x028d('0x10')][_0x028d('0x11')]?_0x808f39['headers']['x-forwarded-for']:_0x808f39[_0x028d('0x12')][_0x028d('0x13')]||_0x808f39['ip'],_0x808f39[_0x028d('0x14')],_0x5aca3b[_0x028d('0x15')],_0x5aca3b[_0x028d('0x16')],_0x808f39[_0x028d('0x17')]?_0x808f39[_0x028d('0x17')]['id']:null,_0x808f39[_0x028d('0x17')]?_0x808f39[_0x028d('0x17')][_0x028d('0x18')]:null,_0x808f39['user']?_0x808f39[_0x028d('0x17')][_0x028d('0x19')]:null,_0x4b5822?util[_0x028d('0x1a')](_0x4b5822,![],null):'');}}));_0x159474[_0x028d('0x9')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x50e514,_0x371b10){var _0x2a872b=_0x028d('0x1b');if(_0x50e514['body']&&_0x50e514['body'][_0x028d('0x1c')]&&_0x50e514[_0x028d('0xd')][_0x028d('0x1d')]){_0x2a872b=_0x028d('0x1e');}return util['format'](_0x2a872b,_0x50e514[_0x028d('0x1f')],_0x50e514[_0x028d('0x10')][_0x028d('0x11')]?_0x50e514['headers']['x-forwarded-for']:_0x50e514[_0x028d('0x12')][_0x028d('0x13')]||_0x50e514['ip'],_0x50e514[_0x028d('0x14')],_0x371b10[_0x028d('0x15')],_0x371b10[_0x028d('0x16')],_0x50e514['user']?_0x50e514[_0x028d('0x17')]['id']:null,_0x50e514['user']?_0x50e514[_0x028d('0x17')][_0x028d('0x18')]:null,_0x50e514[_0x028d('0x17')]?_0x50e514[_0x028d('0x17')][_0x028d('0x19')]:null,_0x50e514[_0x028d('0xd')]&&_0x50e514[_0x028d('0xd')]['device']?_0x50e514[_0x028d('0xd')][_0x028d('0x1c')]:_0x028d('0x20'),_0x50e514['body']&&_0x50e514[_0x028d('0xd')][_0x028d('0x1d')]?_0x50e514['body'][_0x028d('0x1d')]:'',_0x50e514['body']&&_0x50e514[_0x028d('0xd')][_0x028d('0x21')]?_0x50e514[_0x028d('0xd')][_0x028d('0x21')]:'');},'ignoreRoute':function(_0x34047f){var _0x104471=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x104471[_0x028d('0x22')](_0x34047f['url']);}}));_0x159474[_0x028d('0x9')](_0x028d('0x23'),require(_0x028d('0x24')));_0x159474[_0x028d('0x9')]('/api/voice/chanspy',require(_0x028d('0x25')));_0x159474[_0x028d('0x9')](_0x028d('0x26'),require('./api/voiceContext'));_0x159474[_0x028d('0x9')](_0x028d('0x27'),require(_0x028d('0x28')));_0x159474[_0x028d('0x9')](_0x028d('0x29'),require(_0x028d('0x2a')));_0x159474[_0x028d('0x9')](_0x028d('0x2b'),require(_0x028d('0x2c')));_0x159474[_0x028d('0x9')](_0x028d('0x2d'),require(_0x028d('0x2e')));_0x159474[_0x028d('0x9')](_0x028d('0x2f'),require(_0x028d('0x30')));_0x159474['use'](_0x028d('0x31'),require(_0x028d('0x32')));_0x159474[_0x028d('0x9')](_0x028d('0x33'),require(_0x028d('0x34')));_0x159474[_0x028d('0x9')]('/api/voice/calls/reports',require(_0x028d('0x35')));_0x159474[_0x028d('0x9')](_0x028d('0x36'),require('./api/voiceDialReport'));_0x159474[_0x028d('0x9')](_0x028d('0x37'),require('./api/voiceAgentReport'));_0x159474[_0x028d('0x9')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x159474[_0x028d('0x9')](_0x028d('0x38'),require(_0x028d('0x39')));_0x159474[_0x028d('0x9')](_0x028d('0x3a'),require(_0x028d('0x3b')));_0x159474[_0x028d('0x9')]('/api/voice/transfers/reports',require(_0x028d('0x3c')));_0x159474[_0x028d('0x9')](_0x028d('0x3d'),require(_0x028d('0x3e')));_0x159474['use']('/api/mail/accounts',require(_0x028d('0x3f')));_0x159474[_0x028d('0x9')](_0x028d('0x40'),require(_0x028d('0x41')));_0x159474[_0x028d('0x9')](_0x028d('0x42'),require('./api/mailSubstatus'));_0x159474[_0x028d('0x9')](_0x028d('0x43'),require(_0x028d('0x44')));_0x159474[_0x028d('0x9')](_0x028d('0x45'),require(_0x028d('0x46')));_0x159474['use'](_0x028d('0x47'),require('./api/mailApplication'));_0x159474[_0x028d('0x9')](_0x028d('0x48'),require(_0x028d('0x49')));_0x159474['use'](_0x028d('0x4a'),require(_0x028d('0x4b')));_0x159474[_0x028d('0x9')](_0x028d('0x4c'),require(_0x028d('0x4d')));_0x159474[_0x028d('0x9')]('/api/fax/accounts',require(_0x028d('0x4e')));_0x159474[_0x028d('0x9')](_0x028d('0x4f'),require('./api/faxApplication'));_0x159474[_0x028d('0x9')](_0x028d('0x50'),require(_0x028d('0x51')));_0x159474[_0x028d('0x9')](_0x028d('0x52'),require(_0x028d('0x53')));_0x159474[_0x028d('0x9')](_0x028d('0x54'),require(_0x028d('0x55')));_0x159474[_0x028d('0x9')]('/api/fax/reports/queue',require(_0x028d('0x56')));_0x159474[_0x028d('0x9')](_0x028d('0x57'),require('./api/smsAccount'));_0x159474[_0x028d('0x9')]('/api/sms/applications',require(_0x028d('0x58')));_0x159474[_0x028d('0x9')]('/api/sms/interactions',require(_0x028d('0x59')));_0x159474[_0x028d('0x9')](_0x028d('0x5a'),require(_0x028d('0x5b')));_0x159474[_0x028d('0x9')](_0x028d('0x5c'),require('./api/smsQueue'));_0x159474['use'](_0x028d('0x5d'),require('./api/openchannelAccount'));_0x159474[_0x028d('0x9')](_0x028d('0x5e'),require(_0x028d('0x5f')));_0x159474['use'](_0x028d('0x60'),require(_0x028d('0x61')));_0x159474['use']('/api/openchannel/messages',require(_0x028d('0x62')));_0x159474['use']('/api/openchannel/queues',require(_0x028d('0x63')));_0x159474[_0x028d('0x9')](_0x028d('0x64'),require(_0x028d('0x65')));_0x159474[_0x028d('0x9')](_0x028d('0x66'),require(_0x028d('0x67')));_0x159474[_0x028d('0x9')](_0x028d('0x68'),require(_0x028d('0x69')));_0x159474[_0x028d('0x9')](_0x028d('0x6a'),require(_0x028d('0x6b')));_0x159474[_0x028d('0x9')](_0x028d('0x6c'),require('./api/chatMessage'));_0x159474[_0x028d('0x9')](_0x028d('0x6d'),require(_0x028d('0x6e')));_0x159474[_0x028d('0x9')]('/api/chat/queues',require(_0x028d('0x6f')));_0x159474['use']('/api/chat/groups',require(_0x028d('0x70')));_0x159474[_0x028d('0x9')](_0x028d('0x71'),require(_0x028d('0x72')));_0x159474['use'](_0x028d('0x73'),require(_0x028d('0x74')));_0x159474['use'](_0x028d('0x75'),require('./api/cmContact'));_0x159474['use'](_0x028d('0x76'),require(_0x028d('0x77')));_0x159474[_0x028d('0x9')](_0x028d('0x78'),require('./api/cmHopperBlack'));_0x159474[_0x028d('0x9')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x159474['use']('/api/cm/hopper_history',require(_0x028d('0x79')));_0x159474[_0x028d('0x9')]('/api/cm/custom_fields',require(_0x028d('0x7a')));_0x159474[_0x028d('0x9')](_0x028d('0x7b'),require(_0x028d('0x7c')));_0x159474[_0x028d('0x9')]('/api/automations',require(_0x028d('0x7d')));_0x159474[_0x028d('0x9')](_0x028d('0x7e'),require('./api/cannedAnswer'));_0x159474[_0x028d('0x9')](_0x028d('0x7f'),require(_0x028d('0x80')));_0x159474[_0x028d('0x9')]('/api/conditions',require(_0x028d('0x81')));_0x159474[_0x028d('0x9')](_0x028d('0x82'),require(_0x028d('0x83')));_0x159474[_0x028d('0x9')]('/api/pauses',require(_0x028d('0x84')));_0x159474[_0x028d('0x9')](_0x028d('0x85'),require('./api/cdr'));_0x159474[_0x028d('0x9')]('/api/voiceQueuesLog',require(_0x028d('0x86')));_0x159474['use'](_0x028d('0x87'),require(_0x028d('0x88')));_0x159474[_0x028d('0x9')](_0x028d('0x89'),require(_0x028d('0x8a')));_0x159474[_0x028d('0x9')](_0x028d('0x8b'),require(_0x028d('0x8c')));_0x159474[_0x028d('0x9')](_0x028d('0x8d'),require(_0x028d('0x8e')));_0x159474[_0x028d('0x9')]('/api/triggers',require(_0x028d('0x8f')));_0x159474['use']('/api/variables',require(_0x028d('0x90')));_0x159474[_0x028d('0x9')](_0x028d('0x91'),require(_0x028d('0x92')));_0x159474[_0x028d('0x9')](_0x028d('0x93'),require('./api/integrationReport'));_0x159474[_0x028d('0x9')]('/api/analytics/custom_reports',require(_0x028d('0x94')));_0x159474['use'](_0x028d('0x95'),require(_0x028d('0x96')));_0x159474['use'](_0x028d('0x97'),require('./api/analyticExtractedReport'));_0x159474['use'](_0x028d('0x98'),require(_0x028d('0x99')));_0x159474['use'](_0x028d('0x9a'),require(_0x028d('0x9b')));_0x159474['use'](_0x028d('0x9c'),require(_0x028d('0x9d')));_0x159474[_0x028d('0x9')](_0x028d('0x9e'),require(_0x028d('0x9f')));_0x159474['use'](_0x028d('0xa0'),require('./api/intSalesforceConfiguration'));_0x159474[_0x028d('0x9')](_0x028d('0xa1'),require(_0x028d('0xa2')));_0x159474[_0x028d('0x9')](_0x028d('0xa3'),require('./api/intSugarcrmAccount'));_0x159474[_0x028d('0x9')](_0x028d('0xa4'),require(_0x028d('0xa5')));_0x159474[_0x028d('0x9')](_0x028d('0xa6'),require(_0x028d('0xa7')));_0x159474[_0x028d('0x9')]('/api/integrations/desk/accounts',require(_0x028d('0xa8')));_0x159474[_0x028d('0x9')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x159474['use'](_0x028d('0xa9'),require(_0x028d('0xaa')));_0x159474[_0x028d('0x9')](_0x028d('0xab'),require(_0x028d('0xac')));_0x159474[_0x028d('0x9')](_0x028d('0xad'),require(_0x028d('0xae')));_0x159474[_0x028d('0x9')](_0x028d('0xaf'),require(_0x028d('0xb0')));_0x159474[_0x028d('0x9')](_0x028d('0xb1'),require(_0x028d('0xb2')));_0x159474[_0x028d('0x9')](_0x028d('0xb3'),require(_0x028d('0xb4')));_0x159474[_0x028d('0x9')]('/api/integrations/zendesk/fields',require(_0x028d('0xb5')));_0x159474[_0x028d('0x9')](_0x028d('0xb6'),require(_0x028d('0xb7')));_0x159474[_0x028d('0x9')](_0x028d('0xb8'),require(_0x028d('0xb9')));_0x159474['use'](_0x028d('0xba'),require(_0x028d('0xbb')));_0x159474[_0x028d('0x9')](_0x028d('0xbc'),require('./api/intVtigerAccount'));_0x159474[_0x028d('0x9')](_0x028d('0xbd'),require(_0x028d('0xbe')));_0x159474[_0x028d('0x9')](_0x028d('0xbf'),require(_0x028d('0xc0')));_0x159474[_0x028d('0x9')](_0x028d('0xc1'),require(_0x028d('0xc2')));_0x159474[_0x028d('0x9')](_0x028d('0xc3'),require(_0x028d('0xc4')));_0x159474[_0x028d('0x9')](_0x028d('0xc5'),require(_0x028d('0xc6')));_0x159474[_0x028d('0x9')](_0x028d('0xc7'),require(_0x028d('0xc8')));_0x159474[_0x028d('0x9')](_0x028d('0xc9'),require(_0x028d('0xca')));_0x159474[_0x028d('0x9')](_0x028d('0xcb'),require(_0x028d('0xcc')));_0x159474[_0x028d('0x9')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x159474['use'](_0x028d('0xcd'),require(_0x028d('0xce')));_0x159474['use'](_0x028d('0xcf'),require(_0x028d('0xd0')));_0x159474[_0x028d('0x9')]('/api/networks',require(_0x028d('0xd1')));_0x159474[_0x028d('0x9')]('/api/chat/reports/queue',require(_0x028d('0xd2')));_0x159474[_0x028d('0x9')](_0x028d('0xd3'),require(_0x028d('0xd4')));_0x159474['use']('/api/jscripty/answers/reports',require(_0x028d('0xd5')));_0x159474[_0x028d('0x9')](_0x028d('0xd6'),require(_0x028d('0xd7')));_0x159474[_0x028d('0x9')](_0x028d('0xd8'),require(_0x028d('0xd9')));_0x159474['use'](_0x028d('0xda'),require(_0x028d('0xdb')));_0x159474['use'](_0x028d('0xdc'),require('./api/squareReport'));_0x159474[_0x028d('0x9')](_0x028d('0xdd'),require(_0x028d('0xde')));_0x159474['use']('/api/jscripty/projects',require(_0x028d('0xdf')));_0x159474[_0x028d('0x9')](_0x028d('0xe0'),require(_0x028d('0xe1')));_0x159474[_0x028d('0x9')](_0x028d('0xe2'),require(_0x028d('0xe3')));_0x159474[_0x028d('0x9')]('/api/square/projects',require('./api/squareProject'));_0x159474[_0x028d('0x9')]('/api/square/recordings',require(_0x028d('0xe4')));_0x159474[_0x028d('0x9')](_0x028d('0xe5'),require(_0x028d('0xe6')));_0x159474[_0x028d('0x9')](_0x028d('0xe7'),require(_0x028d('0xe8')));_0x159474['use']('/api/license',require(_0x028d('0xe9')));_0x159474[_0x028d('0x9')](_0x028d('0xea'),require(_0x028d('0xeb')));_0x159474['use']('/api/migrations',require(_0x028d('0xec')));_0x159474[_0x028d('0x9')](_0x028d('0xed'),require('./api/attachment'));_0x159474['use'](_0x028d('0xee'),require(_0x028d('0xef')));_0x159474[_0x028d('0x9')]('/api/mail/reports/transfer',require(_0x028d('0xf0')));_0x159474[_0x028d('0x9')](_0x028d('0xf1'),require(_0x028d('0xf2')));_0x159474['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x159474[_0x028d('0x9')](_0x028d('0xf3'),require('./api/openchannelTransferReport'));_0x159474[_0x028d('0x9')](_0x028d('0xf4'),require(_0x028d('0xf5')));_0x159474[_0x028d('0x9')](_0x028d('0xf6'),require(_0x028d('0xf7')));_0x159474['use'](_0x028d('0xf8'),require(_0x028d('0xf9')));_0x159474[_0x028d('0x9')](_0x028d('0xfa'),require(_0x028d('0xfb')));_0x159474['use']('/api/userProfile/sections',require(_0x028d('0xfc')));_0x159474[_0x028d('0x9')]('/api/userProfile/resources',require(_0x028d('0xfd')));_0x159474[_0x028d('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x159474['use'](_0x028d('0xfe'),require('./api/whatsappAccount'));_0x159474[_0x028d('0x9')](_0x028d('0xff'),require(_0x028d('0x100')));_0x159474['use'](_0x028d('0x101'),require(_0x028d('0x102')));_0x159474['use'](_0x028d('0x103'),require('./api/whatsappMessage'));_0x159474[_0x028d('0x9')](_0x028d('0x104'),require(_0x028d('0x105')));_0x159474[_0x028d('0x9')](_0x028d('0x106'),require(_0x028d('0x107')));_0x159474[_0x028d('0x9')](_0x028d('0x108'),require('./api/whatsappQueue'));_0x159474[_0x028d('0x9')](_0x028d('0x109'),require(_0x028d('0x10a')));_0x159474[_0x028d('0x9')](_0x028d('0x10b'),require(_0x028d('0x10c')));_0x159474['use'](_0x028d('0x10d'),require(_0x028d('0x10e')));_0x159474[_0x028d('0x9')](_0x028d('0x10f'),require(_0x028d('0x110')));_0x159474['use']('/api/jira',require(_0x028d('0x111')));_0x159474['use']('/api/rpc',require(_0x028d('0x112')));_0x159474[_0x028d('0x9')]('/api/version',require('./api/version'));_0x159474[_0x028d('0x9')]('/api/system',require('./api/system'));_0x159474[_0x028d('0x9')](_0x028d('0x113'),require(_0x028d('0x114')));_0x159474[_0x028d('0x9')]('/api/webbar',require(_0x028d('0x115')));_0x159474[_0x028d('0x9')](_0x028d('0x116'),express[_0x028d('0x117')](path[_0x028d('0x118')](config[_0x028d('0x119')],_0x028d('0x116'))));_0x159474[_0x028d('0x9')]('/www',express['static'](path[_0x028d('0x118')](config[_0x028d('0x119')],'/www')));_0x159474[_0x028d('0x9')]('/demo',express[_0x028d('0x117')](path[_0x028d('0x118')](config['root'],_0x028d('0x11a'))));_0x159474[_0x028d('0x9')](_0x028d('0x11b'),express[_0x028d('0x117')](path[_0x028d('0x118')](config[_0x028d('0x119')],_0x028d('0x11c'),_0x028d('0x11d'))));_0x159474['use'](_0x028d('0x11e'),express['static'](path['join'](config[_0x028d('0x119')],'/server/files/plugins')));_0x159474['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x028d('0x11f')](errors[0x194]);_0x159474['route']('/*')[_0x028d('0x11f')](function(_0x3eeec1,_0x2561cc){_0x2561cc[_0x028d('0x120')](path['resolve'](_0x159474[_0x028d('0x11f')]('appPath')+_0x028d('0x121')));});};var sensitiveFields=[_0x028d('0x122'),_0x028d('0x123'),_0x028d('0x124'),_0x028d('0x125'),_0x028d('0x126'),_0x028d('0x127'),_0x028d('0x128'),'phone',_0x028d('0x129'),'fax','email',_0x028d('0x12a'),_0x028d('0x12b'),'securityToken',_0x028d('0x12c'),_0x028d('0x12d'),_0x028d('0x12e'),'token',_0x028d('0x12f'),_0x028d('0x130'),'accessTokenSecret',_0x028d('0x131'),_0x028d('0x132'),_0x028d('0x133'),_0x028d('0x134'),_0x028d('0x135'),'calleridnum',_0x028d('0x136'),_0x028d('0x137'),_0x028d('0x138'),_0x028d('0x139'),_0x028d('0x13a'),_0x028d('0x13b'),'key','user',_0x028d('0x13c'),'accountSid',_0x028d('0x13d'),_0x028d('0x13e'),_0x028d('0x13f'),'registry',_0x028d('0x140')];function maskSensitiveData(_0x27abd0){var _0x461299=/(?!^)[\s\S](?!$)/g;if(!_[_0x028d('0x141')](_0x27abd0))return;for(var _0x273003 in _0x27abd0){if(_['isArray'](_0x27abd0[_0x273003])){for(var _0x4a78df=0x0;_0x4a78df<_0x27abd0[_0x273003]['length'];_0x4a78df++){maskSensitiveData(_0x27abd0[_0x273003][_0x4a78df]);}}else if(_[_0x028d('0x141')](_0x27abd0[_0x273003])){maskSensitiveData(_0x27abd0[_0x273003]);}else if(_[_0x028d('0x142')](_0x27abd0[_0x273003])){_0x27abd0[_0x273003]=_0x27abd0[_0x273003]['replace'](/{{{/g,_0x028d('0x143'))[_0x028d('0x144')](/}}}/g,_0x028d('0x145'))[_0x028d('0x144')](/{{/g,'@{')[_0x028d('0x144')](/}}/g,'}@');if(_[_0x028d('0x146')](sensitiveFields,_0x273003)){_0x27abd0[_0x273003]=_0x27abd0[_0x273003][_0x028d('0x144')](_0x461299,'*');}}}} \ No newline at end of file +var _0x42c7=['./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','resolve','username','password','newPassword','apiKey','firstName','street','phone','fax','email','clientId','clientSecret','securityToken','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','lodash','path','express-winston','util','./errors','./config/environment','api','./config/logger','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','role','other','agent_name','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','./api/template','/api/variables','./api/variable','./api/integrationReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations'];(function(_0x5d4974,_0x44d7df){var _0x596f29=function(_0x2e574d){while(--_0x2e574d){_0x5d4974['push'](_0x5d4974['shift']());}};_0x596f29(++_0x44d7df);}(_0x42c7,0x1d7));var _0x742c=function(_0x244b2b,_0x21aa87){_0x244b2b=_0x244b2b-0x0;var _0xd29410=_0x42c7[_0x244b2b];return _0xd29410;};'use strict';var _=require(_0x742c('0x0'));var path=require(_0x742c('0x1'));var express=require('express');var ewinston=require(_0x742c('0x2'));var util=require(_0x742c('0x3'));var errors=require(_0x742c('0x4'));var config=require(_0x742c('0x5'));var logger=require('./config/logger')(_0x742c('0x6'));var authLogger=require(_0x742c('0x7'))(_0x742c('0x8'));exports[_0x742c('0x9')]=function(_0xe908eb){_0xe908eb['use'](ewinston[_0x742c('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2b3e21,_0x47acdf){var _0x534992=_0x742c('0xb');if(!_[_0x742c('0xc')](_0x2b3e21[_0x742c('0xd')])){_0x534992+=_0x742c('0xe');var _0x3f2ea5=_0x2b3e21[_0x742c('0xd')];maskSensitiveData(_0x3f2ea5);}return util[_0x742c('0xf')](_0x534992,_0x2b3e21[_0x742c('0x10')],_0x2b3e21[_0x742c('0x11')][_0x742c('0x12')]?_0x2b3e21[_0x742c('0x11')]['x-forwarded-for']:_0x2b3e21[_0x742c('0x13')][_0x742c('0x14')]||_0x2b3e21['ip'],_0x2b3e21[_0x742c('0x15')],_0x47acdf[_0x742c('0x16')],_0x47acdf[_0x742c('0x17')],_0x2b3e21[_0x742c('0x18')]?_0x2b3e21['user']['id']:null,_0x2b3e21[_0x742c('0x18')]?_0x2b3e21[_0x742c('0x18')][_0x742c('0x19')]:null,_0x2b3e21[_0x742c('0x18')]?_0x2b3e21[_0x742c('0x18')]['role']:null,_0x3f2ea5?util[_0x742c('0x1a')](_0x3f2ea5,![],null):'');}}));_0xe908eb['use'](ewinston[_0x742c('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x20653c,_0x5077cf){var _0x304698=_0x742c('0x1b');if(_0x20653c[_0x742c('0xd')]&&_0x20653c[_0x742c('0xd')][_0x742c('0x1c')]&&_0x20653c['body'][_0x742c('0x1d')]){_0x304698=_0x742c('0x1e');}return util['format'](_0x304698,_0x20653c[_0x742c('0x10')],_0x20653c[_0x742c('0x11')][_0x742c('0x12')]?_0x20653c['headers']['x-forwarded-for']:_0x20653c[_0x742c('0x13')]['remoteAddress']||_0x20653c['ip'],_0x20653c[_0x742c('0x15')],_0x5077cf['statusCode'],_0x5077cf[_0x742c('0x17')],_0x20653c[_0x742c('0x18')]?_0x20653c[_0x742c('0x18')]['id']:null,_0x20653c[_0x742c('0x18')]?_0x20653c[_0x742c('0x18')][_0x742c('0x19')]:null,_0x20653c['user']?_0x20653c[_0x742c('0x18')][_0x742c('0x1f')]:null,_0x20653c['body']&&_0x20653c[_0x742c('0xd')][_0x742c('0x1c')]?_0x20653c[_0x742c('0xd')]['device']:_0x742c('0x20'),_0x20653c[_0x742c('0xd')]&&_0x20653c[_0x742c('0xd')][_0x742c('0x1d')]?_0x20653c['body'][_0x742c('0x1d')]:'',_0x20653c[_0x742c('0xd')]&&_0x20653c[_0x742c('0xd')][_0x742c('0x21')]?_0x20653c[_0x742c('0xd')][_0x742c('0x21')]:'');},'ignoreRoute':function(_0x217e09){var _0x84fdf5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x84fdf5['test'](_0x217e09[_0x742c('0x15')]);}}));_0xe908eb[_0x742c('0x22')](_0x742c('0x23'),require(_0x742c('0x24')));_0xe908eb[_0x742c('0x22')](_0x742c('0x25'),require(_0x742c('0x26')));_0xe908eb['use']('/api/voice/contexts',require(_0x742c('0x27')));_0xe908eb[_0x742c('0x22')](_0x742c('0x28'),require('./api/voiceExtension'));_0xe908eb[_0x742c('0x22')](_0x742c('0x29'),require(_0x742c('0x2a')));_0xe908eb['use'](_0x742c('0x2b'),require('./api/voiceQueue'));_0xe908eb[_0x742c('0x22')](_0x742c('0x2c'),require('./api/voiceRecording'));_0xe908eb['use'](_0x742c('0x2d'),require(_0x742c('0x2e')));_0xe908eb[_0x742c('0x22')](_0x742c('0x2f'),require(_0x742c('0x30')));_0xe908eb['use'](_0x742c('0x31'),require(_0x742c('0x32')));_0xe908eb['use']('/api/voice/calls/reports',require(_0x742c('0x33')));_0xe908eb[_0x742c('0x22')](_0x742c('0x34'),require(_0x742c('0x35')));_0xe908eb['use'](_0x742c('0x36'),require(_0x742c('0x37')));_0xe908eb['use'](_0x742c('0x38'),require('./api/voiceQueueReport'));_0xe908eb[_0x742c('0x22')]('/api/members/reports',require('./api/memberReport'));_0xe908eb[_0x742c('0x22')](_0x742c('0x39'),require(_0x742c('0x3a')));_0xe908eb[_0x742c('0x22')](_0x742c('0x3b'),require(_0x742c('0x3c')));_0xe908eb[_0x742c('0x22')](_0x742c('0x3d'),require('./api/mailServerOut'));_0xe908eb['use']('/api/mail/accounts',require('./api/mailAccount'));_0xe908eb[_0x742c('0x22')]('/api/mail/queues',require(_0x742c('0x3e')));_0xe908eb['use'](_0x742c('0x3f'),require(_0x742c('0x40')));_0xe908eb[_0x742c('0x22')](_0x742c('0x41'),require(_0x742c('0x42')));_0xe908eb[_0x742c('0x22')](_0x742c('0x43'),require(_0x742c('0x44')));_0xe908eb[_0x742c('0x22')](_0x742c('0x45'),require(_0x742c('0x46')));_0xe908eb[_0x742c('0x22')](_0x742c('0x47'),require(_0x742c('0x48')));_0xe908eb[_0x742c('0x22')](_0x742c('0x49'),require(_0x742c('0x4a')));_0xe908eb['use']('/api/dashboards/items',require(_0x742c('0x4b')));_0xe908eb[_0x742c('0x22')](_0x742c('0x4c'),require('./api/faxAccount'));_0xe908eb['use'](_0x742c('0x4d'),require(_0x742c('0x4e')));_0xe908eb['use']('/api/fax/interactions',require(_0x742c('0x4f')));_0xe908eb[_0x742c('0x22')](_0x742c('0x50'),require('./api/faxMessage'));_0xe908eb['use'](_0x742c('0x51'),require(_0x742c('0x52')));_0xe908eb['use'](_0x742c('0x53'),require(_0x742c('0x54')));_0xe908eb[_0x742c('0x22')](_0x742c('0x55'),require(_0x742c('0x56')));_0xe908eb[_0x742c('0x22')](_0x742c('0x57'),require('./api/smsApplication'));_0xe908eb[_0x742c('0x22')](_0x742c('0x58'),require(_0x742c('0x59')));_0xe908eb[_0x742c('0x22')](_0x742c('0x5a'),require(_0x742c('0x5b')));_0xe908eb[_0x742c('0x22')](_0x742c('0x5c'),require(_0x742c('0x5d')));_0xe908eb['use']('/api/openchannel/accounts',require(_0x742c('0x5e')));_0xe908eb[_0x742c('0x22')](_0x742c('0x5f'),require(_0x742c('0x60')));_0xe908eb[_0x742c('0x22')](_0x742c('0x61'),require(_0x742c('0x62')));_0xe908eb[_0x742c('0x22')](_0x742c('0x63'),require(_0x742c('0x64')));_0xe908eb[_0x742c('0x22')](_0x742c('0x65'),require(_0x742c('0x66')));_0xe908eb[_0x742c('0x22')](_0x742c('0x67'),require(_0x742c('0x68')));_0xe908eb[_0x742c('0x22')](_0x742c('0x69'),require(_0x742c('0x6a')));_0xe908eb[_0x742c('0x22')]('/api/chat/applications',require(_0x742c('0x6b')));_0xe908eb[_0x742c('0x22')]('/api/chat/interactions',require(_0x742c('0x6c')));_0xe908eb[_0x742c('0x22')]('/api/chat/messages',require(_0x742c('0x6d')));_0xe908eb[_0x742c('0x22')]('/api/chat/offline_messages',require(_0x742c('0x6e')));_0xe908eb[_0x742c('0x22')](_0x742c('0x6f'),require(_0x742c('0x70')));_0xe908eb[_0x742c('0x22')](_0x742c('0x71'),require(_0x742c('0x72')));_0xe908eb['use']('/api/chat/proactive_actions',require(_0x742c('0x73')));_0xe908eb[_0x742c('0x22')](_0x742c('0x74'),require(_0x742c('0x75')));_0xe908eb[_0x742c('0x22')](_0x742c('0x76'),require(_0x742c('0x77')));_0xe908eb[_0x742c('0x22')]('/api/cm/hopper',require(_0x742c('0x78')));_0xe908eb[_0x742c('0x22')](_0x742c('0x79'),require(_0x742c('0x7a')));_0xe908eb['use']('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0xe908eb[_0x742c('0x22')](_0x742c('0x7b'),require('./api/cmHopperHistory'));_0xe908eb[_0x742c('0x22')](_0x742c('0x7c'),require('./api/cmCustomField'));_0xe908eb[_0x742c('0x22')](_0x742c('0x7d'),require(_0x742c('0x7e')));_0xe908eb[_0x742c('0x22')](_0x742c('0x7f'),require(_0x742c('0x80')));_0xe908eb['use']('/api/canned_answers',require(_0x742c('0x81')));_0xe908eb[_0x742c('0x22')]('/api/dispositions',require(_0x742c('0x82')));_0xe908eb[_0x742c('0x22')](_0x742c('0x83'),require(_0x742c('0x84')));_0xe908eb[_0x742c('0x22')](_0x742c('0x85'),require(_0x742c('0x86')));_0xe908eb[_0x742c('0x22')](_0x742c('0x87'),require(_0x742c('0x88')));_0xe908eb[_0x742c('0x22')](_0x742c('0x89'),require('./api/cdr'));_0xe908eb[_0x742c('0x22')](_0x742c('0x8a'),require(_0x742c('0x8b')));_0xe908eb[_0x742c('0x22')]('/api/schedules',require(_0x742c('0x8c')));_0xe908eb[_0x742c('0x22')](_0x742c('0x8d'),require(_0x742c('0x8e')));_0xe908eb['use']('/api/tags',require('./api/tag'));_0xe908eb[_0x742c('0x22')]('/api/templates',require(_0x742c('0x8f')));_0xe908eb[_0x742c('0x22')]('/api/triggers',require('./api/trigger'));_0xe908eb['use'](_0x742c('0x90'),require(_0x742c('0x91')));_0xe908eb[_0x742c('0x22')]('/api/integrations',require('./api/integration'));_0xe908eb[_0x742c('0x22')]('/api/integrations/reports',require(_0x742c('0x92')));_0xe908eb['use']('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0xe908eb[_0x742c('0x22')](_0x742c('0x93'),require(_0x742c('0x94')));_0xe908eb[_0x742c('0x22')](_0x742c('0x95'),require(_0x742c('0x96')));_0xe908eb[_0x742c('0x22')](_0x742c('0x97'),require(_0x742c('0x98')));_0xe908eb['use']('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0xe908eb[_0x742c('0x22')](_0x742c('0x99'),require(_0x742c('0x9a')));_0xe908eb[_0x742c('0x22')](_0x742c('0x9b'),require(_0x742c('0x9c')));_0xe908eb[_0x742c('0x22')](_0x742c('0x9d'),require(_0x742c('0x9e')));_0xe908eb[_0x742c('0x22')]('/api/integrations/salesforce/fields',require(_0x742c('0x9f')));_0xe908eb['use'](_0x742c('0xa0'),require(_0x742c('0xa1')));_0xe908eb[_0x742c('0x22')]('/api/integrations/sugarcrm/configurations',require(_0x742c('0xa2')));_0xe908eb[_0x742c('0x22')]('/api/integrations/sugarcrm/fields',require(_0x742c('0xa3')));_0xe908eb[_0x742c('0x22')](_0x742c('0xa4'),require(_0x742c('0xa5')));_0xe908eb['use'](_0x742c('0xa6'),require('./api/intDeskConfiguration'));_0xe908eb['use']('/api/integrations/desk/fields',require(_0x742c('0xa7')));_0xe908eb[_0x742c('0x22')](_0x742c('0xa8'),require(_0x742c('0xa9')));_0xe908eb[_0x742c('0x22')]('/api/integrations/zoho/configurations',require(_0x742c('0xaa')));_0xe908eb[_0x742c('0x22')]('/api/integrations/zoho/fields',require(_0x742c('0xab')));_0xe908eb[_0x742c('0x22')](_0x742c('0xac'),require(_0x742c('0xad')));_0xe908eb[_0x742c('0x22')]('/api/integrations/zendesk/configurations',require(_0x742c('0xae')));_0xe908eb[_0x742c('0x22')](_0x742c('0xaf'),require(_0x742c('0xb0')));_0xe908eb[_0x742c('0x22')](_0x742c('0xb1'),require('./api/intFreshdeskAccount'));_0xe908eb[_0x742c('0x22')](_0x742c('0xb2'),require(_0x742c('0xb3')));_0xe908eb[_0x742c('0x22')](_0x742c('0xb4'),require(_0x742c('0xb5')));_0xe908eb[_0x742c('0x22')](_0x742c('0xb6'),require(_0x742c('0xb7')));_0xe908eb[_0x742c('0x22')](_0x742c('0xb8'),require(_0x742c('0xb9')));_0xe908eb['use'](_0x742c('0xba'),require(_0x742c('0xbb')));_0xe908eb[_0x742c('0x22')](_0x742c('0xbc'),require('./api/intServicenowAccount'));_0xe908eb[_0x742c('0x22')](_0x742c('0xbd'),require(_0x742c('0xbe')));_0xe908eb['use'](_0x742c('0xbf'),require(_0x742c('0xc0')));_0xe908eb[_0x742c('0x22')](_0x742c('0xc1'),require('./api/intDynamics365Account'));_0xe908eb[_0x742c('0x22')](_0x742c('0xc2'),require(_0x742c('0xc3')));_0xe908eb[_0x742c('0x22')](_0x742c('0xc4'),require(_0x742c('0xc5')));_0xe908eb[_0x742c('0x22')](_0x742c('0xc6'),require(_0x742c('0xc7')));_0xe908eb[_0x742c('0x22')](_0x742c('0xc8'),require(_0x742c('0xc9')));_0xe908eb['use'](_0x742c('0xca'),require(_0x742c('0xcb')));_0xe908eb['use'](_0x742c('0xcc'),require(_0x742c('0xcd')));_0xe908eb[_0x742c('0x22')](_0x742c('0xce'),require(_0x742c('0xcf')));_0xe908eb[_0x742c('0x22')](_0x742c('0xd0'),require(_0x742c('0xd1')));_0xe908eb[_0x742c('0x22')](_0x742c('0xd2'),require('./api/jscriptyAnswerReport'));_0xe908eb[_0x742c('0x22')](_0x742c('0xd3'),require(_0x742c('0xd4')));_0xe908eb[_0x742c('0x22')](_0x742c('0xd5'),require(_0x742c('0xd6')));_0xe908eb[_0x742c('0x22')](_0x742c('0xd7'),require(_0x742c('0xd8')));_0xe908eb[_0x742c('0x22')]('/api/square/reports',require(_0x742c('0xd9')));_0xe908eb[_0x742c('0x22')](_0x742c('0xda'),require(_0x742c('0xdb')));_0xe908eb[_0x742c('0x22')](_0x742c('0xdc'),require(_0x742c('0xdd')));_0xe908eb['use'](_0x742c('0xde'),require(_0x742c('0xdf')));_0xe908eb['use']('/api/square/odbc',require(_0x742c('0xe0')));_0xe908eb['use']('/api/square/projects',require('./api/squareProject'));_0xe908eb['use']('/api/square/recordings',require(_0x742c('0xe1')));_0xe908eb[_0x742c('0x22')](_0x742c('0xe2'),require(_0x742c('0xe3')));_0xe908eb[_0x742c('0x22')](_0x742c('0xe4'),require(_0x742c('0xe5')));_0xe908eb[_0x742c('0x22')](_0x742c('0xe6'),require(_0x742c('0xe7')));_0xe908eb[_0x742c('0x22')](_0x742c('0xe8'),require(_0x742c('0xe9')));_0xe908eb[_0x742c('0x22')](_0x742c('0xea'),require(_0x742c('0xeb')));_0xe908eb[_0x742c('0x22')](_0x742c('0xec'),require('./api/attachment'));_0xe908eb[_0x742c('0x22')](_0x742c('0xed'),require(_0x742c('0xee')));_0xe908eb[_0x742c('0x22')](_0x742c('0xef'),require(_0x742c('0xf0')));_0xe908eb[_0x742c('0x22')](_0x742c('0xf1'),require('./api/chatTransferReport'));_0xe908eb[_0x742c('0x22')]('/api/fax/reports/transfer',require(_0x742c('0xf2')));_0xe908eb[_0x742c('0x22')](_0x742c('0xf3'),require(_0x742c('0xf4')));_0xe908eb[_0x742c('0x22')](_0x742c('0xf5'),require(_0x742c('0xf6')));_0xe908eb[_0x742c('0x22')]('/api/cm/lists',require(_0x742c('0xf7')));_0xe908eb[_0x742c('0x22')](_0x742c('0xf8'),require('./api/voicePrefix'));_0xe908eb[_0x742c('0x22')](_0x742c('0xf9'),require('./api/userProfile'));_0xe908eb[_0x742c('0x22')](_0x742c('0xfa'),require('./api/userProfileSection'));_0xe908eb['use']('/api/userProfile/resources',require(_0x742c('0xfb')));_0xe908eb['use'](_0x742c('0xfc'),require(_0x742c('0xfd')));_0xe908eb[_0x742c('0x22')](_0x742c('0xfe'),require(_0x742c('0xff')));_0xe908eb[_0x742c('0x22')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0xe908eb[_0x742c('0x22')](_0x742c('0x100'),require(_0x742c('0x101')));_0xe908eb[_0x742c('0x22')]('/api/whatsapp/messages',require(_0x742c('0x102')));_0xe908eb[_0x742c('0x22')](_0x742c('0x103'),require(_0x742c('0x104')));_0xe908eb[_0x742c('0x22')](_0x742c('0x105'),require(_0x742c('0x106')));_0xe908eb['use'](_0x742c('0x107'),require(_0x742c('0x108')));_0xe908eb['use']('/api/cloudProviders',require(_0x742c('0x109')));_0xe908eb[_0x742c('0x22')](_0x742c('0x10a'),require('./api/realtime'));_0xe908eb['use'](_0x742c('0x10b'),require(_0x742c('0x10c')));_0xe908eb[_0x742c('0x22')](_0x742c('0x10d'),require(_0x742c('0x10e')));_0xe908eb[_0x742c('0x22')](_0x742c('0x10f'),require('./api/jira'));_0xe908eb[_0x742c('0x22')](_0x742c('0x110'),require(_0x742c('0x111')));_0xe908eb['use'](_0x742c('0x112'),require(_0x742c('0x113')));_0xe908eb[_0x742c('0x22')]('/api/system',require('./api/system'));_0xe908eb[_0x742c('0x22')](_0x742c('0x114'),require(_0x742c('0x115')));_0xe908eb[_0x742c('0x22')](_0x742c('0x116'),require(_0x742c('0x117')));_0xe908eb['use']('/apidoc',express[_0x742c('0x118')](path[_0x742c('0x119')](config[_0x742c('0x11a')],_0x742c('0x11b'))));_0xe908eb[_0x742c('0x22')](_0x742c('0x11c'),express['static'](path[_0x742c('0x119')](config[_0x742c('0x11a')],_0x742c('0x11c'))));_0xe908eb[_0x742c('0x22')](_0x742c('0x11d'),express[_0x742c('0x118')](path['join'](config[_0x742c('0x11a')],'/demo')));_0xe908eb['use']('/snippet',express[_0x742c('0x118')](path[_0x742c('0x119')](config[_0x742c('0x11a')],_0x742c('0x11e'),'3.0.0')));_0xe908eb[_0x742c('0x22')](_0x742c('0x11f'),express[_0x742c('0x118')](path[_0x742c('0x119')](config[_0x742c('0x11a')],_0x742c('0x120'))));_0xe908eb[_0x742c('0x121')](_0x742c('0x122'))['get'](errors[0x194]);_0xe908eb[_0x742c('0x121')]('/*')['get'](function(_0x4ad8e8,_0x2d9640){_0x2d9640['sendFile'](path[_0x742c('0x123')](_0xe908eb['get']('appPath')+'/index.html'));});};var sensitiveFields=[_0x742c('0x124'),_0x742c('0x125'),_0x742c('0x126'),_0x742c('0x127'),_0x742c('0x128'),'lastName',_0x742c('0x129'),_0x742c('0x12a'),'mobile',_0x742c('0x12b'),_0x742c('0x12c'),_0x742c('0x12d'),_0x742c('0x12e'),_0x742c('0x12f'),_0x742c('0x130'),'accessKey',_0x742c('0x131'),_0x742c('0x132'),_0x742c('0x133'),_0x742c('0x134'),_0x742c('0x135'),_0x742c('0x136'),_0x742c('0x137'),'consumerSecret',_0x742c('0x138'),_0x742c('0x139'),_0x742c('0x13a'),_0x742c('0x13b'),_0x742c('0x13c'),_0x742c('0x13d'),'privateKey',_0x742c('0x13e'),_0x742c('0x13f'),_0x742c('0x140'),_0x742c('0x18'),_0x742c('0x141'),_0x742c('0x142'),_0x742c('0x143'),_0x742c('0x144'),_0x742c('0x145'),_0x742c('0x146'),_0x742c('0x147')];function maskSensitiveData(_0x32088b){var _0x5f58d9=/(?!^)[\s\S](?!$)/g;if(!_[_0x742c('0x148')](_0x32088b))return;for(var _0x4042f0 in _0x32088b){if(_[_0x742c('0x149')](_0x32088b[_0x4042f0])){for(var _0x203257=0x0;_0x203257<_0x32088b[_0x4042f0][_0x742c('0x14a')];_0x203257++){maskSensitiveData(_0x32088b[_0x4042f0][_0x203257]);}}else if(_[_0x742c('0x148')](_0x32088b[_0x4042f0])){maskSensitiveData(_0x32088b[_0x4042f0]);}else if(_[_0x742c('0x14b')](_0x32088b[_0x4042f0])){_0x32088b[_0x4042f0]=_0x32088b[_0x4042f0]['replace'](/{{{/g,_0x742c('0x14c'))[_0x742c('0x14d')](/}}}/g,_0x742c('0x14e'))['replace'](/{{/g,'@{')[_0x742c('0x14d')](/}}/g,'}@');if(_[_0x742c('0x14f')](sensitiveFields,_0x4042f0)){_0x32088b[_0x4042f0]=_0x32088b[_0x4042f0]['replace'](_0x5f58d9,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index b160969..8104ef5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e70=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','server','http','port','rpc','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/mailServerIn/mailServerIn.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/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0x8e70,0x9c));var _0x08e7=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x8e70[_0x36ed48];return _0x51c63a;};'use strict';var jayson=require(_0x08e7('0x0'));var BPromise=require(_0x08e7('0x1'));var _=require('lodash');var config=require(_0x08e7('0x2'));exports[_0x08e7('0x3')]=function(){return new BPromise(function(_0x893017,_0xbb021a){var _0x12e489={};_0x12e489=_['merge'](_0x12e489,require('../api/user/user.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x5')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x6')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x7')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x8')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x9')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0xa')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/memberReport/memberReport.rpc'));_0x12e489=_['merge'](_0x12e489,require('../api/trunk/trunk.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0xb')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0xc')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0xd')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0xe')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0xf')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x10')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x11')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x12')));_0x12e489=_['merge'](_0x12e489,require('../api/faxApplication/faxApplication.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/faxInteraction/faxInteraction.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x13')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x14')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x15')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x16')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x17')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x18')));_0x12e489=_['merge'](_0x12e489,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x19')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x1a')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x1b')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x1c')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x1d')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x1e')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x1f')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x20')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x21')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x22')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x23')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x24')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x25')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x26')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x27')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x28')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x29')));_0x12e489=_['merge'](_0x12e489,require('../api/variable/variable.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x2a')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x2b')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x2c')));_0x12e489=_['merge'](_0x12e489,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x2d')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x2e')));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x2f')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x30')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x31')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/squareReport/squareReport.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x32')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x33')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x34')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/squareProject/squareProject.rpc'));_0x12e489=_['merge'](_0x12e489,require(_0x08e7('0x35')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x36')));_0x12e489=_['merge'](_0x12e489,require('../api/campaign/campaign.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x37')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x38')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x39')));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require(_0x08e7('0x3a')));_0x12e489=_['merge'](_0x12e489,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x12e489=_[_0x08e7('0x4')](_0x12e489,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x40675f=jayson[_0x08e7('0x3b')](_0x12e489)[_0x08e7('0x3c')]();var _0xc19202=config['rpc'][_0x08e7('0x3d')]||config[_0x08e7('0x3d')]+0x1;var _0x11539f=config[_0x08e7('0x3e')]['ip']||_0x08e7('0x3f');_0x40675f['on']('error',function(_0x3fa46b){return _0xbb021a(_0x3fa46b);});_0x40675f[_0x08e7('0x3')](_0xc19202,_0x11539f,function(){console['log'](_0x08e7('0x40'),_0x11539f,_0xc19202);require('../config/triggers')[_0x08e7('0x41')]();return _0x893017(_0x08e7('0x42')+_0x11539f+':'+_0xc19202);});});}; \ No newline at end of file +var _0xf0d9=['../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.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/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/whatsappMessage/whatsappMessage.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc'];(function(_0x5e6f35,_0x32fec7){var _0x5dbdc1=function(_0x239d48){while(--_0x239d48){_0x5e6f35['push'](_0x5e6f35['shift']());}};_0x5dbdc1(++_0x32fec7);}(_0xf0d9,0x1e8));var _0x9f0d=function(_0x19c4a0,_0x4e7fd4){_0x19c4a0=_0x19c4a0-0x0;var _0x3a4d9=_0xf0d9[_0x19c4a0];return _0x3a4d9;};'use strict';var jayson=require(_0x9f0d('0x0'));var BPromise=require(_0x9f0d('0x1'));var _=require('lodash');var config=require(_0x9f0d('0x2'));exports[_0x9f0d('0x3')]=function(){return new BPromise(function(_0x145eb3,_0x5db9aa){var _0x4b299f={};_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x5')));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x6')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/voiceQueue/voiceQueue.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/voiceRecording/voiceRecording.rpc'));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x7')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x8')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x9')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0xa')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0xb')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0xc')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0xd')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0xe')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/mailQueue/mailQueue.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0xf')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/mailMessage/mailMessage.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/mailApplication/mailApplication.rpc'));_0x4b299f=_['merge'](_0x4b299f,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/faxAccount/faxAccount.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x10')));_0x4b299f=_['merge'](_0x4b299f,require('../api/faxInteraction/faxInteraction.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x11')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x12')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x13')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x14')));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x15')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x16')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x17')));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x18')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x19')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x1a')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x1b')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x1c')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/chatInteraction/chatInteraction.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x1d')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/chatQueue/chatQueue.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/cmContact/cmContact.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x1e')));_0x4b299f=_['merge'](_0x4b299f,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x1f')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x20')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x21')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x22')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x23')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x24')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x25')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/variable/variable.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x4b299f=_['merge'](_0x4b299f,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x26')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x27')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x28')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x29')));_0x4b299f=_['merge'](_0x4b299f,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x2a')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x2b')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x2c')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x2d')));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x2e')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x2f')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/setting/setting.rpc'));_0x4b299f=_['merge'](_0x4b299f,require('../api/squareOdbc/squareOdbc.rpc'));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x30')));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x31')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x32')));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x33')));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x34')));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x35')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require(_0x9f0d('0x36')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4b299f=_['merge'](_0x4b299f,require(_0x9f0d('0x37')));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4b299f=_[_0x9f0d('0x4')](_0x4b299f,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x359353=jayson[_0x9f0d('0x38')](_0x4b299f)[_0x9f0d('0x39')]();var _0x324e94=config['rpc'][_0x9f0d('0x3a')]||config[_0x9f0d('0x3a')]+0x1;var _0x2d12f5=config[_0x9f0d('0x3b')]['ip']||_0x9f0d('0x3c');_0x359353['on'](_0x9f0d('0x3d'),function(_0x5d36dd){return _0x5db9aa(_0x5d36dd);});_0x359353['listen'](_0x324e94,_0x2d12f5,function(){console[_0x9f0d('0x3e')](_0x9f0d('0x3f'),_0x2d12f5,_0x324e94);require(_0x9f0d('0x40'))['default']();return _0x145eb3(_0x9f0d('0x41')+_0x2d12f5+':'+_0x324e94);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5bfc763..f6e8b80 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 _0x1203=['replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','close','inherits','prototype','sendRequest','sync','ANSWER','beep','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','continueAt','noop','GOTO\x20%s\x20%s\x20%s','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','line','hangup','emit','substring','search','520\x20End\x20of\x20proper','no\x20code'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x3120('0x0'));var _=require(_0x3120('0x1'));var EventEmitter=require(_0x3120('0x2'))[_0x3120('0x3')];var AGIReply=require(_0x3120('0x4'));var AGIError=require(_0x3120('0x5'));function AGIChannel(_0x1159b3){var _0x1aff37=this,_0xc8c32e=new AGIReply(),_0x809377=![],_0x1b7a3c={};EventEmitter[_0x3120('0x6')](_0x1aff37);_0x1159b3[_0x3120('0x7')](_0x3120('0x8'));_0x1159b3[_0x3120('0x9')](0x8*0x3c*0x3c*0x3e8);_0xc8c32e[_0x3120('0x7')]('utf8');_0xc8c32e['on'](_0x3120('0xa'),function(_0x513da6){for(var _0x5e19f1 in _0x513da6){_0x1aff37[_0x5e19f1]=_0x513da6[_0x5e19f1];}_0x1aff37['emit']('ready');});_0xc8c32e['on'](_0x3120('0xb'),function(_0x39f834){if(_0x39f834['toLowerCase']()==_0x3120('0xc')){_0x1aff37[_0x3120('0xd')](_0x3120('0xc'));return;}if(_0x39f834[_0x3120('0xe')](0x0,0xb)=='520-Invalid'){_0x809377=!![];}if(_0x809377){_0x1b7a3c['rx']+=_0x39f834+'\x0a';if(_0x39f834[_0x3120('0xf')](_0x3120('0x10'))!=-0x1){_0x809377=![];}}else{_0x1b7a3c['rx']=_0x39f834;}if(_0x809377){return;}if(typeof _0x1b7a3c['cb']=='function'){var _0x4a4312=_0x1b7a3c['rx'][_0x3120('0xe')](0x0,0x3),_0x41a236=null,_0x2b1879=null;_0x4a4312=parseInt(_0x4a4312);if(isNaN(_0x4a4312)){_0x1b7a3c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3120('0x11')});return;}if(_0x4a4312!=0xc8){_0x1b7a3c['cb'](null,{'code':_0x4a4312,'result':-0x1,'extra':'KO'});return;}_0x41a236=_0x1b7a3c['rx'][_0x3120('0xe')](0x4)[_0x3120('0x12')](_0x3120('0x13'),'');if(_0x41a236['indexOf']('\x20')!=-0x1){_0x41a236=_0x41a236[_0x3120('0x14')](0x0,_0x41a236[_0x3120('0x15')]('\x20'));}if(_[_0x3120('0x16')](_0x41a236,'-1')){_0x41a236=parseInt(_0x41a236);}_0x2b1879=_0x1b7a3c['rx'][_0x3120('0x17')]('\x20');if(_0x2b1879[_0x3120('0x18')]==0x3){_0x2b1879=_0x2b1879[0x2][_0x3120('0xe')](0x1,_0x2b1879[0x2][_0x3120('0x18')]-0x1);}else if(_0x2b1879['length']>0x3){var _0x308873=/\((.+)\)/;var _0x4cf3db=_0x1b7a3c['rx'][_0x3120('0x19')](_0x308873);if(_0x4cf3db){_0x2b1879=_0x4cf3db[0x1];}else{_0x2b1879=null;}}else{_0x2b1879=null;}_0x1b7a3c['cb'](null,{'code':_0x4a4312,'result':_0x41a236,'extra':_0x2b1879});}});_0x1159b3['on'](_0x3120('0x1a'),function(_0x2bbdb7){_0x1aff37[_0x3120('0xd')](_0x3120('0x1a'),new AGIError(_0x3120('0x1b'),_0x2bbdb7[_0x3120('0x1c')]));});_0x1159b3['on']('close',function(){_0x1aff37[_0x3120('0xd')]('close',new AGIError(_0x3120('0x1d')));});_0x1159b3['on'](_0x3120('0x1e'),function(){_0x1aff37[_0x3120('0xd')]('timeout',new AGIError(_0x3120('0x1f')));_0x1159b3['destroy']();});_0x1159b3[_0x3120('0x20')](_0xc8c32e);this[_0x3120('0x21')]=function(_0x5edd47,_0x1358e0){var _0x5edd47=_0x5edd47||'',_0x1358e0=typeof _0x1358e0==_0x3120('0x22')?_0x1358e0:new Function();_0x1b7a3c={'tx':_0x5edd47,'rx':'','cb':_0x1358e0};_0x1159b3['write'](_0x5edd47+'\x0a');},this[_0x3120('0x23')]=function(){_0x1159b3['destroy']();};}util[_0x3120('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x3120('0x25')][_0x3120('0x26')]=function(_0x56fc9f){return this['command'][_0x3120('0x27')](this,_0x56fc9f);};AGIChannel[_0x3120('0x25')]['answer']=function(){return this[_0x3120('0x26')](_0x3120('0x28'));};AGIChannel[_0x3120('0x25')]['getData']=function(_0x2636b5,_0x4597a6,_0x4412f9){_0x2636b5=_0x2636b5===undefined?_0x3120('0x29'):_0x2636b5;_0x4597a6=_0x4597a6===undefined?'5':_0x4597a6;_0x4412f9=_0x4412f9===undefined?'1':_0x4412f9;return this['sendRequest'](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x2636b5,_0x4597a6*0x3e8,_0x4412f9));};AGIChannel[_0x3120('0x25')]['noop']=function(_0x2bc753){_0x2bc753=_0x2bc753||_0x3120('0x2a');return this[_0x3120('0x26')](util[_0x3120('0x2b')](_0x3120('0x2c'),_0x2bc753));};AGIChannel[_0x3120('0x25')]['exec']=function(_0x109756,_0xeed487){if(_[_0x3120('0x2d')](_0xeed487)){return this[_0x3120('0x26')](util[_0x3120('0x2b')](_0x3120('0x2e'),_0x109756,_0xeed487[_0x3120('0x2f')](',')));}return this[_0x3120('0x26')](util['format']('EXEC\x20%s\x20%s',_0x109756,_0xeed487));};AGIChannel[_0x3120('0x25')][_0x3120('0x30')]=function(_0xd45027){return this[_0x3120('0x26')](util[_0x3120('0x2b')](_0x3120('0x31'),_0xd45027));};AGIChannel['prototype'][_0x3120('0x32')]=function(_0x180ae5){return this[_0x3120('0x26')](util[_0x3120('0x2b')](_0x3120('0x33'),_0x180ae5));};AGIChannel[_0x3120('0x25')][_0x3120('0x34')]=function(_0x571aca){return this[_0x3120('0x26')](util[_0x3120('0x2b')](_0x3120('0x35'),_0x571aca));};AGIChannel[_0x3120('0x25')][_0x3120('0xc')]=function(){return this[_0x3120('0x26')](_0x3120('0x36'));};AGIChannel[_0x3120('0x25')][_0x3120('0x37')]=function(_0x2ed2cc,_0x2fb199){var _0x78c0c2=_[_0x3120('0x38')](_0x2fb199)||_['isNumber'](_0x2fb199)?_0x2fb199['toString']():_0x2fb199;return this[_0x3120('0x26')](util[_0x3120('0x2b')](_0x3120('0x39'),_0x2ed2cc,_0x78c0c2?_0x78c0c2['toString']()[_0x3120('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3120('0x25')][_0x3120('0x3a')]=function(_0x5d414e,_0x2a3209){return this[_0x3120('0x26')](util[_0x3120('0x2b')](_0x3120('0x3b'),_0x5d414e,_0x2a3209));};AGIChannel[_0x3120('0x25')][_0x3120('0x3c')]=function(_0x4bbc5d,_0x5e5200){return this['sendRequest'](util[_0x3120('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x4bbc5d,_0x5e5200));};AGIChannel[_0x3120('0x25')][_0x3120('0x3d')]=function(_0x20bde7,_0x2d7482){return this['sendRequest'](util[_0x3120('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x20bde7,_0x2d7482));};AGIChannel[_0x3120('0x25')][_0x3120('0x3e')]=function(_0x2928a4,_0x209f18,_0x240fba){_0x209f18=_0x209f18||this['extension'];_0x240fba=_0x240fba||0x1;this[_0x3120('0x30')](_0x2928a4);this[_0x3120('0x32')](_0x209f18);this[_0x3120('0x34')](_0x240fba);return this[_0x3120('0x3f')](util['format'](_0x3120('0x40'),_0x2928a4,_0x209f18,_0x240fba));};AGIChannel[_0x3120('0x25')]['getVariable']=function(_0x1f7b81){return this[_0x3120('0x26')](util[_0x3120('0x2b')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1f7b81));};AGIChannel[_0x3120('0x25')][_0x3120('0x41')]=function(_0x546b79,_0x174ece,_0x3f01ac,_0x509e39,_0x4f85ac,_0x380e26){_0x174ece=_0x174ece||_0x3120('0x42');_0x3f01ac=_0x3f01ac||'';_0x509e39=_0x509e39===undefined?-0x1:_0x509e39==='-1'?-0x1:_0x509e39*0x3e8;_0x4f85ac=_0x4f85ac===undefined?'':'s='+_0x4f85ac;_0x380e26=_0x380e26?_0x3120('0x43'):'';return this[_0x3120('0x26')](util[_0x3120('0x2b')](_0x3120('0x44'),_0x546b79,_0x174ece,_0x3f01ac,_0x509e39,_0x380e26,_0x4f85ac));};AGIChannel[_0x3120('0x25')][_0x3120('0x45')]=function(_0x3a5836,_0x4051b6){_0x4051b6=_0x4051b6||'';return this['sendRequest'](util[_0x3120('0x2b')](_0x3120('0x46'),_0x3a5836,_0x4051b6));};AGIChannel[_0x3120('0x25')][_0x3120('0x47')]=function(_0x5c16e5){return this['exec'](_0x3120('0x48'),_0x5c16e5);};AGIChannel['prototype'][_0x3120('0x49')]=function(_0x3a66f7){return this[_0x3120('0x4a')](_0x3120('0x4b'),_0x3a66f7);};AGIChannel[_0x3120('0x25')][_0x3120('0x1a')]=function(_0x33cc5a,_0x22ac87){this['noop'](util[_0x3120('0x2b')](_0x3120('0x4c'),_0x33cc5a['id'],_0x33cc5a[_0x3120('0x4d')],_0x22ac87));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3120('0x4e')]=AGIChannel; \ No newline at end of file +var _0xe2db=['SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','write','destroy','prototype','sendRequest','command','sync','ANSWER','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','format','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber'];(function(_0xde5807,_0x54715b){var _0x147cd5=function(_0x431e48){while(--_0x431e48){_0xde5807['push'](_0xde5807['shift']());}};_0x147cd5(++_0x54715b);}(_0xe2db,0x149));var _0xbe2d=function(_0x59594d,_0x1404ca){_0x59594d=_0x59594d-0x0;var _0x468994=_0xe2db[_0x59594d];return _0x468994;};'use strict';var util=require(_0xbe2d('0x0'));var _=require(_0xbe2d('0x1'));var EventEmitter=require(_0xbe2d('0x2'))[_0xbe2d('0x3')];var AGIReply=require(_0xbe2d('0x4'));var AGIError=require(_0xbe2d('0x5'));function AGIChannel(_0x4c9abb){var _0x4b4d5a=this,_0xd92237=new AGIReply(),_0x5bd958=![],_0x36ee5f={};EventEmitter[_0xbe2d('0x6')](_0x4b4d5a);_0x4c9abb[_0xbe2d('0x7')](_0xbe2d('0x8'));_0x4c9abb[_0xbe2d('0x9')](0x8*0x3c*0x3c*0x3e8);_0xd92237['setEncoding']('utf8');_0xd92237['on'](_0xbe2d('0xa'),function(_0x5d7ffb){for(var _0xc9315 in _0x5d7ffb){_0x4b4d5a[_0xc9315]=_0x5d7ffb[_0xc9315];}_0x4b4d5a[_0xbe2d('0xb')](_0xbe2d('0xc'));});_0xd92237['on'](_0xbe2d('0xd'),function(_0x42e36c){if(_0x42e36c[_0xbe2d('0xe')]()==_0xbe2d('0xf')){_0x4b4d5a[_0xbe2d('0xb')]('hangup');return;}if(_0x42e36c[_0xbe2d('0x10')](0x0,0xb)==_0xbe2d('0x11')){_0x5bd958=!![];}if(_0x5bd958){_0x36ee5f['rx']+=_0x42e36c+'\x0a';if(_0x42e36c[_0xbe2d('0x12')]('520\x20End\x20of\x20proper')!=-0x1){_0x5bd958=![];}}else{_0x36ee5f['rx']=_0x42e36c;}if(_0x5bd958){return;}if(typeof _0x36ee5f['cb']==_0xbe2d('0x13')){var _0x30a648=_0x36ee5f['rx'][_0xbe2d('0x10')](0x0,0x3),_0xfff0ce=null,_0x6d20d3=null;_0x30a648=parseInt(_0x30a648);if(isNaN(_0x30a648)){_0x36ee5f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xbe2d('0x14')});return;}if(_0x30a648!=0xc8){_0x36ee5f['cb'](null,{'code':_0x30a648,'result':-0x1,'extra':'KO'});return;}_0xfff0ce=_0x36ee5f['rx'][_0xbe2d('0x10')](0x4)[_0xbe2d('0x15')]('result=','');if(_0xfff0ce[_0xbe2d('0x16')]('\x20')!=-0x1){_0xfff0ce=_0xfff0ce['substr'](0x0,_0xfff0ce['indexOf']('\x20'));}if(_[_0xbe2d('0x17')](_0xfff0ce,'-1')){_0xfff0ce=parseInt(_0xfff0ce);}_0x6d20d3=_0x36ee5f['rx']['split']('\x20');if(_0x6d20d3[_0xbe2d('0x18')]==0x3){_0x6d20d3=_0x6d20d3[0x2]['substring'](0x1,_0x6d20d3[0x2][_0xbe2d('0x18')]-0x1);}else if(_0x6d20d3['length']>0x3){var _0x4995aa=/\((.+)\)/;var _0x35cc17=_0x36ee5f['rx'][_0xbe2d('0x19')](_0x4995aa);if(_0x35cc17){_0x6d20d3=_0x35cc17[0x1];}else{_0x6d20d3=null;}}else{_0x6d20d3=null;}_0x36ee5f['cb'](null,{'code':_0x30a648,'result':_0xfff0ce,'extra':_0x6d20d3});}});_0x4c9abb['on'](_0xbe2d('0x1a'),function(_0xd293){_0x4b4d5a[_0xbe2d('0xb')](_0xbe2d('0x1a'),new AGIError(_0xbe2d('0x1b'),_0xd293[_0xbe2d('0x1c')]));});_0x4c9abb['on'](_0xbe2d('0x1d'),function(){_0x4b4d5a['emit'](_0xbe2d('0x1d'),new AGIError(_0xbe2d('0x1e')));});_0x4c9abb['on'](_0xbe2d('0x1f'),function(){_0x4b4d5a[_0xbe2d('0xb')](_0xbe2d('0x1f'),new AGIError(_0xbe2d('0x20')));_0x4c9abb['destroy']();});_0x4c9abb[_0xbe2d('0x21')](_0xd92237);this['command']=function(_0x38c9eb,_0x83f1ca){var _0x38c9eb=_0x38c9eb||'',_0x83f1ca=typeof _0x83f1ca==_0xbe2d('0x13')?_0x83f1ca:new Function();_0x36ee5f={'tx':_0x38c9eb,'rx':'','cb':_0x83f1ca};_0x4c9abb[_0xbe2d('0x22')](_0x38c9eb+'\x0a');},this[_0xbe2d('0x1d')]=function(){_0x4c9abb[_0xbe2d('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x25')]=function(_0x2fa476){return this[_0xbe2d('0x26')][_0xbe2d('0x27')](this,_0x2fa476);};AGIChannel[_0xbe2d('0x24')]['answer']=function(){return this[_0xbe2d('0x25')](_0xbe2d('0x28'));};AGIChannel[_0xbe2d('0x24')]['getData']=function(_0x1199b7,_0x552555,_0x452739){_0x1199b7=_0x1199b7===undefined?_0xbe2d('0x29'):_0x1199b7;_0x552555=_0x552555===undefined?'5':_0x552555;_0x452739=_0x452739===undefined?'1':_0x452739;return this['sendRequest'](util['format'](_0xbe2d('0x2a'),_0x1199b7,_0x552555*0x3e8,_0x452739));};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x2b')]=function(_0x184a88){_0x184a88=_0x184a88||_0xbe2d('0x2c');return this[_0xbe2d('0x25')](util['format'](_0xbe2d('0x2d'),_0x184a88));};AGIChannel['prototype'][_0xbe2d('0x2e')]=function(_0x4ebfcd,_0x51285b){if(_[_0xbe2d('0x2f')](_0x51285b)){return this['sendRequest'](util[_0xbe2d('0x30')](_0xbe2d('0x31'),_0x4ebfcd,_0x51285b[_0xbe2d('0x32')](',')));}return this[_0xbe2d('0x25')](util[_0xbe2d('0x30')](_0xbe2d('0x31'),_0x4ebfcd,_0x51285b));};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x33')]=function(_0x11b160){return this[_0xbe2d('0x25')](util[_0xbe2d('0x30')](_0xbe2d('0x34'),_0x11b160));};AGIChannel['prototype']['setExtension']=function(_0x3d1997){return this[_0xbe2d('0x25')](util[_0xbe2d('0x30')](_0xbe2d('0x35'),_0x3d1997));};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x36')]=function(_0x5532e4){return this[_0xbe2d('0x25')](util['format'](_0xbe2d('0x37'),_0x5532e4));};AGIChannel['prototype']['hangup']=function(){return this[_0xbe2d('0x25')](_0xbe2d('0x38'));};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x39')]=function(_0x2ed8f5,_0x10a3d8){var _0x481388=_['isBoolean'](_0x10a3d8)||_['isNumber'](_0x10a3d8)?_0x10a3d8[_0xbe2d('0x3a')]():_0x10a3d8;return this[_0xbe2d('0x25')](util[_0xbe2d('0x30')](_0xbe2d('0x3b'),_0x2ed8f5,_0x481388?_0x481388['toString']()[_0xbe2d('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x3c')]=function(_0x27db93,_0x253ee0){return this[_0xbe2d('0x25')](util[_0xbe2d('0x30')](_0xbe2d('0x3d'),_0x27db93,_0x253ee0));};AGIChannel[_0xbe2d('0x24')]['sayDigits']=function(_0x2048a6,_0x3d476f){return this['sendRequest'](util['format'](_0xbe2d('0x3e'),_0x2048a6,_0x3d476f));};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x3f')]=function(_0x38a18f,_0x26c690){return this[_0xbe2d('0x25')](util[_0xbe2d('0x30')](_0xbe2d('0x40'),_0x38a18f,_0x26c690));};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x41')]=function(_0x490659,_0x405d5e,_0x1d54ce){_0x405d5e=_0x405d5e||this[_0xbe2d('0x42')];_0x1d54ce=_0x1d54ce||0x1;this['setContext'](_0x490659);this['setExtension'](_0x405d5e);this['setPriority'](_0x1d54ce);return this['noop'](util[_0xbe2d('0x30')]('GOTO\x20%s\x20%s\x20%s',_0x490659,_0x405d5e,_0x1d54ce));};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x43')]=function(_0x5857d3){return this[_0xbe2d('0x25')](util['format'](_0xbe2d('0x44'),_0x5857d3));};AGIChannel[_0xbe2d('0x24')]['recordFile']=function(_0x7c6f75,_0x299456,_0x5a679e,_0x4528d7,_0x4639cb,_0x175325){_0x299456=_0x299456||_0xbe2d('0x45');_0x5a679e=_0x5a679e||'';_0x4528d7=_0x4528d7===undefined?-0x1:_0x4528d7==='-1'?-0x1:_0x4528d7*0x3e8;_0x4639cb=_0x4639cb===undefined?'':'s='+_0x4639cb;_0x175325=_0x175325?_0xbe2d('0x46'):'';return this['sendRequest'](util[_0xbe2d('0x30')](_0xbe2d('0x47'),_0x7c6f75,_0x299456,_0x5a679e,_0x4528d7,_0x175325,_0x4639cb));};AGIChannel[_0xbe2d('0x24')]['streamFile']=function(_0x2e0412,_0x3c81ca){_0x3c81ca=_0x3c81ca||'';return this[_0xbe2d('0x25')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x2e0412,_0x3c81ca));};AGIChannel[_0xbe2d('0x24')]['agi']=function(_0x366fc0){return this['exec'](_0xbe2d('0x48'),_0x366fc0);};AGIChannel['prototype'][_0xbe2d('0x49')]=function(_0x547154){return this[_0xbe2d('0x2e')](_0xbe2d('0x4a'),_0x547154);};AGIChannel[_0xbe2d('0x24')][_0xbe2d('0x1a')]=function(_0x462857,_0x2f8c93){this['noop'](util['format'](_0xbe2d('0x4b'),_0x462857['id'],_0x462857[_0xbe2d('0x4c')],_0x2f8c93));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xbe2d('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f478282..c898180 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 _0x3aca=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','apply','message','exports'];(function(_0x490a74,_0x70ade){var _0x338d58=function(_0x26f024){while(--_0x26f024){_0x490a74['push'](_0x490a74['shift']());}};_0x338d58(++_0x70ade);}(_0x3aca,0x14a));var _0xa3ac=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x3aca[_0x4a0e68];return _0x4fb274;};'use strict';var util=require(_0xa3ac('0x0'));var error={'E_AGI_UNDEFINED':_0xa3ac('0x1'),'E_AGI_ARGUMENT_PORT':_0xa3ac('0x2'),'E_AGI_SERVER_ERROR':_0xa3ac('0x3'),'E_AGI_SERVER_CLOSE':_0xa3ac('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xa3ac('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xa3ac('0x6'),'E_AGI_SOCKET_ERROR':_0xa3ac('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xa3ac('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xa3ac('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xc9c39a){var _0xc9c39a=_0xc9c39a||null,_0x28efa5=_0x28efa5||[],_0x17a5fc=0x1,_0x266d6a='';if(!error[_0xc9c39a]){_0xc9c39a='E_AGI_UNDEFINED';}_0x28efa5[_0xa3ac('0xa')](error[_0xc9c39a]);while(arguments[_0x17a5fc]){_0x28efa5[_0xa3ac('0xa')](arguments[_0x17a5fc]);_0x17a5fc++;}_0x266d6a=util[_0xa3ac('0xb')][_0xa3ac('0xc')](util,_0x28efa5);this[_0xa3ac('0xd')]=_0x266d6a;this['name']=_0xc9c39a;}module[_0xa3ac('0xe')]=AGIError; \ No newline at end of file +var _0x3b53=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0x3b53,0xec));var _0x33b5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3b53[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x33b5('0x0'));var error={'E_AGI_UNDEFINED':_0x33b5('0x1'),'E_AGI_ARGUMENT_PORT':_0x33b5('0x2'),'E_AGI_SERVER_ERROR':_0x33b5('0x3'),'E_AGI_SERVER_CLOSE':_0x33b5('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x33b5('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x33b5('0x6'),'E_AGI_SOCKET_ERROR':_0x33b5('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x33b5('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x33b5('0x9')};function AGIError(_0x460b9e){var _0x460b9e=_0x460b9e||null,_0x2f255f=_0x2f255f||[],_0x3b68ad=0x1,_0x4842b2='';if(!error[_0x460b9e]){_0x460b9e=_0x33b5('0xa');}_0x2f255f[_0x33b5('0xb')](error[_0x460b9e]);while(arguments[_0x3b68ad]){_0x2f255f[_0x33b5('0xb')](arguments[_0x3b68ad]);_0x3b68ad++;}_0x4842b2=util[_0x33b5('0xc')][_0x33b5('0xd')](util,_0x2f255f);this[_0x33b5('0xe')]=_0x4842b2;this['name']=_0x460b9e;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 09d0bcd..62a370c 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 _0x4877=['numberOfEdges','prototype','addVertex','addEdge','size','vertices','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','agicommand','vswitch','target','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','edges'];(function(_0x51668e,_0x337bec){var _0x20fde3=function(_0x4f04ba){while(--_0x4f04ba){_0x51668e['push'](_0x51668e['shift']());}};_0x20fde3(++_0x337bec);}(_0x4877,0xa8));var _0x7487=function(_0x4f03d8,_0x21d3b5){_0x4f03d8=_0x4f03d8-0x0;var _0x3ff796=_0x4877[_0x4f03d8];return _0x3ff796;};'use strict';var _=require(_0x7487('0x0'));var logger=require(_0x7487('0x1'))(_0x7487('0x2'));var verticesWithRetry=[_0x7487('0x3'),_0x7487('0x4'),'getsecretdigits'];var Graph=function(){this['vertices']={};this[_0x7487('0x5')]={};this[_0x7487('0x6')]=0x0;};Graph[_0x7487('0x7')][_0x7487('0x8')]=function(_0x4bc675){this['vertices'][_0x4bc675['id']]=_0x4bc675;this[_0x7487('0x5')][_0x4bc675['id']]=[];};Graph[_0x7487('0x7')][_0x7487('0x9')]=function(_0x698f23,_0x1b594d,_0x16390a){this[_0x7487('0x5')][_0x698f23]['push']({'target':_0x1b594d,'condition':_0x16390a});this['numberOfEdges']+=0x1;};Graph[_0x7487('0x7')]['size']=function(){return _[_0x7487('0xa')](this[_0x7487('0xb')]);};Graph[_0x7487('0x7')][_0x7487('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x7487('0x7')][_0x7487('0xd')]=function(_0x1182d4){return this['vertices'][_0x1182d4];};Graph['prototype'][_0x7487('0xe')]=function(_0x4d7bc1,_0xb90bc7){if(!this['vertices'][_0x4d7bc1]){return logger[_0x7487('0xf')](_0x7487('0x10'));}var _0x242c99=_0xb90bc7(this['vertices'][_0x4d7bc1]);if(!_0x242c99){return logger[_0x7487('0xf')](_0x7487('0x11'));}if(this['edges'][_0x4d7bc1]['length']===0x0){return logger[_0x7487('0xf')](_0x7487('0x12'));}for(var _0x262eb5=0x0,_0x3bdc68=[],_0x3c8f89=![];_0x262eb5\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','value','catch','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','start','root','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','toString','continueAt','close','Project\x20%s\x20not\x20found','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/environment','./mailRpc','./vertices','agi','defaults','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s'];(function(_0x4e0174,_0x347ca3){var _0x21b5db=function(_0x2f4b40){while(--_0x2f4b40){_0x4e0174['push'](_0x4e0174['shift']());}};_0x21b5db(++_0x347ca3);}(_0xc489,0x18f));var _0x9c48=function(_0x51246e,_0x4d0d02){_0x51246e=_0x51246e-0x0;var _0x1e4257=_0xc489[_0x51246e];return _0x1e4257;};'use strict';var parser=require(_0x9c48('0x0'));var _=require(_0x9c48('0x1'));var syncho=require(_0x9c48('0x2'));var util=require('util');var moment=require(_0x9c48('0x3'));var config=require(_0x9c48('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0x9c48('0x5'));var Graph=require('./graph');var Vertices=require(_0x9c48('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x9c48('0x7')]=_[_0x9c48('0x8')](config[_0x9c48('0x7')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x5def31){process[_0x9c48('0x9')](function(){syncho(function(){try{setChannelVariables(_0x5def31);agiHandler(_0x5def31);}catch(_0x24c381){logger[_0x9c48('0xa')](_0x24c381[_0x9c48('0xb')]);}});});}function listeningHandler(){console['log'](_0x9c48('0xc'),config[_0x9c48('0x7')][_0x9c48('0xd')]);logger[_0x9c48('0xe')](util[_0x9c48('0xf')](_0x9c48('0x10'),config[_0x9c48('0x7')]['ip'],config['agi'][_0x9c48('0xd')]));}function errorHandler(_0x45282a){if(_0x45282a&&_0x45282a['name']&&_0x45282a[_0x9c48('0x11')]){logger[_0x9c48('0xa')](util[_0x9c48('0xf')](_0x9c48('0x12'),_0x45282a[_0x9c48('0x13')],_0x45282a[_0x9c48('0x11')]));}else{logger[_0x9c48('0xa')](util[_0x9c48('0xf')](_0x9c48('0x14'),_0x45282a[_0x9c48('0xb')]));}}function closeHandler(){logger[_0x9c48('0xe')](util[_0x9c48('0xf')](_0x9c48('0x15'),this[_0x9c48('0x16')],this[_0x9c48('0x17')],this[_0x9c48('0x18')],this[_0x9c48('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x6cbb00){logger[_0x9c48('0xa')](_0x6cbb00[_0x9c48('0xb')]);}}function timeoutHandler(){logger[_0x9c48('0xe')](util[_0x9c48('0xf')](_0x9c48('0x1a'),this['arg_1'],this[_0x9c48('0x17')],this[_0x9c48('0x18')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x9c48('0xe')](util[_0x9c48('0xf')](_0x9c48('0x1b'),this[_0x9c48('0x16')],this[_0x9c48('0x17')],this['callerid'],this[_0x9c48('0x19')],this[_0x9c48('0x1c')]));this[_0x9c48('0x1d')]=!![];}function getRoot(_0x566175){return parser[_0x9c48('0x1e')](_0x566175,{'object':!![]})[_0x9c48('0x1f')]['root'];}function addVertex(_0x22a4d5,_0xf94b33,_0x5869e2){_0xf94b33[_0x9c48('0x20')]=_0x5869e2;if(_0xf94b33[_0x9c48('0x21')](_0x9c48('0x22'))){_0xf94b33[_0x9c48('0x23')]=parseInt(_0xf94b33[_0x9c48('0x22')],0xa);}_0x22a4d5[_0x9c48('0x24')](_[_0x9c48('0x25')](_0xf94b33,_0x9c48('0x26')));}function initGraph(_0x15a843,_0x36fb6b){var _0x33be34=new Graph();for(var _0x32bbf3 in _0x15a843){if(_0x15a843[_0x9c48('0x21')](_0x32bbf3)){if(_['isArray'](_0x15a843[_0x32bbf3])){for(var _0x70d8e9=0x0;_0x70d8e9<_0x15a843[_0x32bbf3][_0x9c48('0x27')];_0x70d8e9+=0x1){addVertex(_0x33be34,_0x15a843[_0x32bbf3][_0x70d8e9],_0x32bbf3);}}else{addVertex(_0x33be34,_0x15a843[_0x32bbf3],_0x32bbf3);}}}for(var _0x353c38=0x0;_0x353c38<_0x36fb6b[_0x9c48('0x27')];_0x353c38+=0x1){if(_0x36fb6b[_0x353c38][_0x9c48('0x28')]&&_0x36fb6b[_0x353c38][_0x9c48('0x29')]){_0x33be34['addEdge'](_0x36fb6b[_0x353c38]['source'],_0x36fb6b[_0x353c38]['target'],_0x36fb6b[_0x353c38][_0x9c48('0x2a')]);}}return _0x33be34;}function getSquareProject(_0x3dd260,_0x532b0e){rpc['getSquareProject'](_0x3dd260)['then'](function(_0x17f1f2){_0x532b0e(null,_0x17f1f2);})[_0x9c48('0x2b')](function(_0xd49623){_0x532b0e(null,_0xd49623);});}function createSquareReport(_0x288c26,_0x4c86ee){rpc['createSquareReport'](_0x288c26)['then'](function(_0x434c1b){if(_0x4c86ee){_0x4c86ee(null,_0x434c1b);}})[_0x9c48('0x2b')](function(_0x1f27c6){if(_0x4c86ee){_0x4c86ee(null,_0x1f27c6);}});}function setChannelVariables(_0xf45c88){for(var _0x5bdfac in _0xf45c88){if(_0xf45c88[_0x9c48('0x21')](_0x5bdfac)){if(_0x5bdfac[_0x9c48('0x2c')](_0x9c48('0x2d'))===0x0){_0xf45c88[_0x5bdfac[_0x9c48('0x2e')](0x4)]=_0xf45c88[_0x5bdfac];delete _0xf45c88[_0x5bdfac];}}}}function getLogFromObject(_0xb4e7cf){return util[_0x9c48('0x2f')](_0xb4e7cf,{'showHidden':![],'depth':null});}function agiHandler(_0x3e7fad){var _0x24317f,_0x162d07,_0x77948a,_0x5c96f9,_0x338cf0;logger[_0x9c48('0x30')]('variables',JSON[_0x9c48('0x31')](_0x3e7fad,null,0x2));logger['info'](util['format'](_0x9c48('0x32'),_0x3e7fad[_0x9c48('0x16')],_0x3e7fad['calleridname'],_0x3e7fad[_0x9c48('0x18')],_0x3e7fad[_0x9c48('0x19')],_0x3e7fad[_0x9c48('0x1c')]));_0x3e7fad['on']('error',errorHandler);_0x3e7fad['on']('close',closeHandler);_0x3e7fad['on'](_0x9c48('0x33'),timeoutHandler);_0x3e7fad[_0x9c48('0x1d')]=![];_0x3e7fad['on'](_0x9c48('0x34'),hangupHandler);var _0x31172f=getSquareProject['sync'](null,_0x3e7fad[_0x9c48('0x16')]);if(_0x31172f){if(_0x31172f['production']){_0x24317f=getRoot(_0x31172f['production']);if(_0x24317f&&_0x24317f[_0x9c48('0x35')]){logger['debug'](_0x9c48('0x36'),JSON['stringify'](_0x24317f,null,0x2));_0x3e7fad[_0x9c48('0x37')]=moment()[_0x9c48('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x162d07=initGraph(_['omit'](_0x24317f,'mxCell'),_0x24317f[_0x9c48('0x26')]);_0x77948a=new Vertices(_0x3e7fad,rpc,mailRpc);logger['info'](util[_0x9c48('0xf')](_0x9c48('0x38'),_0x3e7fad[_0x9c48('0x16')],_0x3e7fad[_0x9c48('0x17')],_0x3e7fad['callerid'],_0x3e7fad['dnid'],_0x3e7fad[_0x9c48('0x1c')]));_0x162d07['traverseBFS'](_0x24317f[_0x9c48('0x35')]['id'],function(_0x381e9c){try{_0x381e9c=_0x77948a[_0x9c48('0x39')](_0x381e9c);logger[_0x9c48('0x30')](_0x9c48('0x3a'),JSON[_0x9c48('0x31')](_0x381e9c,null,0x2));if(_0x381e9c['agicommand']===_0x9c48('0x3b')){logger[_0x9c48('0xe')](_0x9c48('0x3c'));_0x3e7fad[_0x9c48('0x3d')]=_0x381e9c[_0x9c48('0x3d')]||_0x3e7fad[_0x9c48('0x3d')];_0x3e7fad[_0x9c48('0x3e')]=_0x381e9c[_0x9c48('0x3e')];_0x3e7fad[_0x9c48('0x3f')]=_0x381e9c[_0x9c48('0x3f')]?_0x381e9c[_0x9c48('0x3f')]-0x1:0x1;return null;}else if(_0x381e9c&&_0x77948a[_0x381e9c[_0x9c48('0x20')]]){_0x338cf0=_0x77948a[_0x381e9c['agicommand']](_0x381e9c);logger[_0x9c48('0xe')](_0x9c48('0x40'),JSON[_0x9c48('0x31')](_0x338cf0,null,0x2));if(_0x338cf0&&_0x338cf0[_0x9c48('0x41')]===AGI_CODE_SUCCESS&&_0x338cf0[_0x9c48('0x42')]!==AGI_RESULT_ERROR&&!_0x3e7fad[_0x9c48('0x1d')]){logger[_0x9c48('0x30')](_0x9c48('0x40'),getLogFromObject(_0x338cf0));return _[_0x9c48('0x43')](_0x338cf0[_0x9c48('0x42')])?null:_0x338cf0['result']['toString']();}else{logger[_0x9c48('0xa')](_0x9c48('0x40'),getLogFromObject(_0x338cf0));return null;}}else{logger[_0x9c48('0xa')](_0x9c48('0x44'));return null;}}catch(_0x22f7bf){logger[_0x9c48('0xa')](_0x22f7bf[_0x9c48('0xb')]);return null;}});if(_0x24317f['finally']){logger[_0x9c48('0xe')](util[_0x9c48('0xf')](_0x9c48('0x45'),_0x3e7fad[_0x9c48('0x16')],_0x3e7fad['calleridname'],_0x3e7fad[_0x9c48('0x18')],_0x3e7fad[_0x9c48('0x19')],_0x3e7fad[_0x9c48('0x1c')]));_0x162d07['traverseBFS'](_0x24317f[_0x9c48('0x46')]['id'],function(_0x5c6731){try{_0x5c6731=_0x77948a[_0x9c48('0x39')](_0x5c6731);logger[_0x9c48('0x30')](_0x9c48('0x3a'),JSON[_0x9c48('0x31')](_0x5c6731,null,0x2));if(_0x5c6731&&_0x77948a[_0x5c6731[_0x9c48('0x20')]]){_0x338cf0=_0x77948a[_0x5c6731[_0x9c48('0x20')]](_0x5c6731);if(_0x338cf0){logger['debug']('response',getLogFromObject(_0x338cf0));return _[_0x9c48('0x43')](_0x338cf0['result'])?null:_0x338cf0[_0x9c48('0x42')][_0x9c48('0x47')]();}else{logger['error'](_0x9c48('0x40'),getLogFromObject(_0x338cf0));return null;}}else{logger[_0x9c48('0xa')](_0x9c48('0x44'));return null;}}catch(_0x3f80f7){logger[_0x9c48('0xa')](_0x3f80f7['stack']);return null;}});}logger[_0x9c48('0xe')](util[_0x9c48('0xf')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3e7fad['arg_1'],_0x3e7fad['calleridname'],_0x3e7fad[_0x9c48('0x18')],_0x3e7fad['dnid'],_0x3e7fad[_0x9c48('0x1c')]));logger['info'](util[_0x9c48('0xf')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x3e7fad['context'],_0x3e7fad[_0x9c48('0x3e')],parseInt(_0x3e7fad[_0x9c48('0x3f')],0xa)+0x1));_0x3e7fad[_0x9c48('0x48')](_0x3e7fad['context'],_0x3e7fad[_0x9c48('0x3e')],parseInt(_0x3e7fad['priority'],0xa)+0x1);_0x3e7fad[_0x9c48('0x49')]();}}else{logger[_0x9c48('0xa')](util[_0x9c48('0xf')]('Project\x20%s\x20not\x20published',_0x3e7fad[_0x9c48('0x16')]));_0x3e7fad[_0x9c48('0x48')](_0x3e7fad[_0x9c48('0x3d')],_0x3e7fad['extension'],parseInt(_0x3e7fad[_0x9c48('0x3f')],0xa)+0x1);_0x3e7fad['close']();}}else{logger['error'](util[_0x9c48('0xf')](_0x9c48('0x4a'),_0x3e7fad[_0x9c48('0x16')]));_0x3e7fad['continueAt'](_0x3e7fad[_0x9c48('0x3d')],_0x3e7fad['extension'],parseInt(_0x3e7fad[_0x9c48('0x3f')],0xa)+0x1);_0x3e7fad[_0x9c48('0x49')]();}}function main(){var _0x3df196;return utilLicense[_0x9c48('0x4b')]()[_0x9c48('0x4c')](function(_0x151aac){if(_0x151aac){if(_0x151aac[_0x9c48('0x4d')]){if(_0x151aac[_0x9c48('0x4e')]&&_0x151aac[_0x9c48('0x4e')]>0x0){logger[_0x9c48('0xe')](util[_0x9c48('0xf')]('[LICENSE]\x20CHANNELS:\x20%s',_0x151aac[_0x9c48('0x4e')]));_0x3df196=_0x151aac[_0x9c48('0x4e')];}else{logger['info'](_0x9c48('0x4f'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3df196=-0x1;}}})[_0x9c48('0x2b')](function(_0x30f7b9){logger[_0x9c48('0xa')](_0x9c48('0x50'),_0x30f7b9[_0x9c48('0xb')]);})[_0x9c48('0x46')](function(){var _0x52514d=require(_0x9c48('0x51'))(config['agi'][_0x9c48('0xd')],config[_0x9c48('0x7')]['ip'],_0x3df196);_0x52514d['on']('error',errorHandler);_0x52514d['on'](_0x9c48('0x52'),listeningHandler);_0x52514d['on'](_0x9c48('0x53'),connectionHandler);_0x52514d['on'](_0x9c48('0x49'),closeHandler);});}main(); \ No newline at end of file +var _0xcf9a=['getSquareProject','catch','createSquareReport','then','indexOf','agi_','inspect','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','debug','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','stack','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','length','source','target','addEdge'];(function(_0x5c7159,_0x489223){var _0x357427=function(_0x467fef){while(--_0x467fef){_0x5c7159['push'](_0x5c7159['shift']());}};_0x357427(++_0x489223);}(_0xcf9a,0x148));var _0xacf9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcf9a[_0x167cc1];return _0x10bc4b;};'use strict';var parser=require(_0xacf9('0x0'));var _=require(_0xacf9('0x1'));var syncho=require('syncho');var util=require(_0xacf9('0x2'));var moment=require(_0xacf9('0x3'));var config=require(_0xacf9('0x4'));var logger=require(_0xacf9('0x5'))(_0xacf9('0x6'));var utilLicense=require(_0xacf9('0x7'));var rpc=require('./rpc');var mailRpc=require(_0xacf9('0x8'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xacf9('0x6')]=_[_0xacf9('0x9')](config['agi'],{'ip':_0xacf9('0xa'),'port':0x11dd});function connectionHandler(_0x5b31b2){process[_0xacf9('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5b31b2);agiHandler(_0x5b31b2);}catch(_0x57c466){logger[_0xacf9('0xc')](_0x57c466['stack']);}});});}function listeningHandler(){console[_0xacf9('0xd')](_0xacf9('0xe'),config[_0xacf9('0x6')]['port']);logger[_0xacf9('0xf')](util[_0xacf9('0x10')](_0xacf9('0x11'),config[_0xacf9('0x6')]['ip'],config[_0xacf9('0x6')][_0xacf9('0x12')]));}function errorHandler(_0x2b444e){if(_0x2b444e&&_0x2b444e[_0xacf9('0x13')]&&_0x2b444e[_0xacf9('0x14')]){logger['error'](util[_0xacf9('0x10')](_0xacf9('0x15'),_0x2b444e[_0xacf9('0x13')],_0x2b444e[_0xacf9('0x14')]));}else{logger[_0xacf9('0xc')](util['format']('[ERROR]\x20%s',_0x2b444e[_0xacf9('0x16')]));}}function closeHandler(){logger[_0xacf9('0xf')](util[_0xacf9('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xacf9('0x17')],this[_0xacf9('0x18')],this['callerid'],this[_0xacf9('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x2c12b5){logger[_0xacf9('0xc')](_0x2c12b5[_0xacf9('0x16')]);}}function timeoutHandler(){logger[_0xacf9('0xf')](util[_0xacf9('0x10')](_0xacf9('0x1a'),this[_0xacf9('0x17')],this[_0xacf9('0x18')],this[_0xacf9('0x1b')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xacf9('0x10')](_0xacf9('0x1c'),this[_0xacf9('0x17')],this[_0xacf9('0x18')],this[_0xacf9('0x1b')],this['dnid'],this[_0xacf9('0x1d')]));this[_0xacf9('0x1e')]=!![];}function getRoot(_0x58a87d){return parser[_0xacf9('0x1f')](_0x58a87d,{'object':!![]})[_0xacf9('0x20')][_0xacf9('0x21')];}function addVertex(_0x3301b4,_0x2c279c,_0xdc8f68){_0x2c279c[_0xacf9('0x22')]=_0xdc8f68;if(_0x2c279c[_0xacf9('0x23')]('retry')){_0x2c279c[_0xacf9('0x24')]=parseInt(_0x2c279c[_0xacf9('0x25')],0xa);}_0x3301b4[_0xacf9('0x26')](_[_0xacf9('0x27')](_0x2c279c,'mxCell'));}function initGraph(_0x3b8efd,_0x375f9c){var _0x5e8744=new Graph();for(var _0x2942d6 in _0x3b8efd){if(_0x3b8efd[_0xacf9('0x23')](_0x2942d6)){if(_['isArray'](_0x3b8efd[_0x2942d6])){for(var _0x121c94=0x0;_0x121c94<_0x3b8efd[_0x2942d6]['length'];_0x121c94+=0x1){addVertex(_0x5e8744,_0x3b8efd[_0x2942d6][_0x121c94],_0x2942d6);}}else{addVertex(_0x5e8744,_0x3b8efd[_0x2942d6],_0x2942d6);}}}for(var _0x24e7b3=0x0;_0x24e7b3<_0x375f9c[_0xacf9('0x28')];_0x24e7b3+=0x1){if(_0x375f9c[_0x24e7b3][_0xacf9('0x29')]&&_0x375f9c[_0x24e7b3][_0xacf9('0x2a')]){_0x5e8744[_0xacf9('0x2b')](_0x375f9c[_0x24e7b3][_0xacf9('0x29')],_0x375f9c[_0x24e7b3]['target'],_0x375f9c[_0x24e7b3]['value']);}}return _0x5e8744;}function getSquareProject(_0x25ed88,_0x8548e2){rpc[_0xacf9('0x2c')](_0x25ed88)['then'](function(_0x22d598){_0x8548e2(null,_0x22d598);})[_0xacf9('0x2d')](function(_0x548e0d){_0x8548e2(null,_0x548e0d);});}function createSquareReport(_0x1cd1ba,_0x188ddb){rpc[_0xacf9('0x2e')](_0x1cd1ba)[_0xacf9('0x2f')](function(_0x799738){if(_0x188ddb){_0x188ddb(null,_0x799738);}})[_0xacf9('0x2d')](function(_0x3d90cf){if(_0x188ddb){_0x188ddb(null,_0x3d90cf);}});}function setChannelVariables(_0x10d538){for(var _0xf290fc in _0x10d538){if(_0x10d538[_0xacf9('0x23')](_0xf290fc)){if(_0xf290fc[_0xacf9('0x30')](_0xacf9('0x31'))===0x0){_0x10d538[_0xf290fc['substring'](0x4)]=_0x10d538[_0xf290fc];delete _0x10d538[_0xf290fc];}}}}function getLogFromObject(_0x16c9fe){return util[_0xacf9('0x32')](_0x16c9fe,{'showHidden':![],'depth':null});}function agiHandler(_0x283bbb){var _0x4cd735,_0x41c173,_0xd25601,_0x179104,_0x291bf9;logger['debug']('variables',JSON[_0xacf9('0x33')](_0x283bbb,null,0x2));logger[_0xacf9('0xf')](util[_0xacf9('0x10')](_0xacf9('0x34'),_0x283bbb['arg_1'],_0x283bbb[_0xacf9('0x18')],_0x283bbb[_0xacf9('0x1b')],_0x283bbb[_0xacf9('0x19')],_0x283bbb[_0xacf9('0x1d')]));_0x283bbb['on'](_0xacf9('0xc'),errorHandler);_0x283bbb['on'](_0xacf9('0x35'),closeHandler);_0x283bbb['on'](_0xacf9('0x36'),timeoutHandler);_0x283bbb[_0xacf9('0x1e')]=![];_0x283bbb['on'](_0xacf9('0x37'),hangupHandler);var _0x5f148f=getSquareProject[_0xacf9('0x38')](null,_0x283bbb['arg_1']);if(_0x5f148f){if(_0x5f148f[_0xacf9('0x39')]){_0x4cd735=getRoot(_0x5f148f[_0xacf9('0x39')]);if(_0x4cd735&&_0x4cd735['start']){logger[_0xacf9('0x3a')](_0xacf9('0x21'),JSON[_0xacf9('0x33')](_0x4cd735,null,0x2));_0x283bbb[_0xacf9('0x3b')]=moment()[_0xacf9('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x41c173=initGraph(_[_0xacf9('0x27')](_0x4cd735,_0xacf9('0x3c')),_0x4cd735[_0xacf9('0x3c')]);_0xd25601=new Vertices(_0x283bbb,rpc,mailRpc);logger[_0xacf9('0xf')](util[_0xacf9('0x10')](_0xacf9('0x3d'),_0x283bbb[_0xacf9('0x17')],_0x283bbb[_0xacf9('0x18')],_0x283bbb[_0xacf9('0x1b')],_0x283bbb['dnid'],_0x283bbb[_0xacf9('0x1d')]));_0x41c173[_0xacf9('0x3e')](_0x4cd735[_0xacf9('0x3f')]['id'],function(_0x370281){try{_0x370281=_0xd25601['clear'](_0x370281);logger[_0xacf9('0x3a')](_0xacf9('0x40'),JSON[_0xacf9('0x33')](_0x370281,null,0x2));if(_0x370281[_0xacf9('0x22')]===_0xacf9('0x41')){logger['info'](_0xacf9('0x42'));_0x283bbb[_0xacf9('0x43')]=_0x370281[_0xacf9('0x43')]||_0x283bbb[_0xacf9('0x43')];_0x283bbb[_0xacf9('0x44')]=_0x370281[_0xacf9('0x44')];_0x283bbb['priority']=_0x370281[_0xacf9('0x45')]?_0x370281[_0xacf9('0x45')]-0x1:0x1;return null;}else if(_0x370281&&_0xd25601[_0x370281['agicommand']]){_0x291bf9=_0xd25601[_0x370281[_0xacf9('0x22')]](_0x370281);logger[_0xacf9('0xf')](_0xacf9('0x46'),JSON['stringify'](_0x291bf9,null,0x2));if(_0x291bf9&&_0x291bf9[_0xacf9('0x47')]===AGI_CODE_SUCCESS&&_0x291bf9['result']!==AGI_RESULT_ERROR&&!_0x283bbb[_0xacf9('0x1e')]){logger[_0xacf9('0x3a')]('response',getLogFromObject(_0x291bf9));return _[_0xacf9('0x48')](_0x291bf9[_0xacf9('0x49')])?null:_0x291bf9[_0xacf9('0x49')][_0xacf9('0x4a')]();}else{logger[_0xacf9('0xc')](_0xacf9('0x46'),getLogFromObject(_0x291bf9));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4435fa){logger[_0xacf9('0xc')](_0x4435fa[_0xacf9('0x16')]);return null;}});if(_0x4cd735[_0xacf9('0x4b')]){logger[_0xacf9('0xf')](util[_0xacf9('0x10')](_0xacf9('0x4c'),_0x283bbb['arg_1'],_0x283bbb[_0xacf9('0x18')],_0x283bbb[_0xacf9('0x1b')],_0x283bbb['dnid'],_0x283bbb[_0xacf9('0x1d')]));_0x41c173[_0xacf9('0x3e')](_0x4cd735['finally']['id'],function(_0x5213b0){try{_0x5213b0=_0xd25601[_0xacf9('0x4d')](_0x5213b0);logger[_0xacf9('0x3a')](_0xacf9('0x40'),JSON['stringify'](_0x5213b0,null,0x2));if(_0x5213b0&&_0xd25601[_0x5213b0[_0xacf9('0x22')]]){_0x291bf9=_0xd25601[_0x5213b0[_0xacf9('0x22')]](_0x5213b0);if(_0x291bf9){logger[_0xacf9('0x3a')](_0xacf9('0x46'),getLogFromObject(_0x291bf9));return _[_0xacf9('0x48')](_0x291bf9['result'])?null:_0x291bf9[_0xacf9('0x49')]['toString']();}else{logger[_0xacf9('0xc')](_0xacf9('0x46'),getLogFromObject(_0x291bf9));return null;}}else{logger['error'](_0xacf9('0x4e'));return null;}}catch(_0x593f62){logger['error'](_0x593f62[_0xacf9('0x16')]);return null;}});}logger[_0xacf9('0xf')](util['format'](_0xacf9('0x4f'),_0x283bbb[_0xacf9('0x17')],_0x283bbb[_0xacf9('0x18')],_0x283bbb[_0xacf9('0x1b')],_0x283bbb['dnid'],_0x283bbb[_0xacf9('0x1d')]));logger['info'](util['format'](_0xacf9('0x50'),_0x283bbb['context'],_0x283bbb[_0xacf9('0x44')],parseInt(_0x283bbb[_0xacf9('0x45')],0xa)+0x1));_0x283bbb[_0xacf9('0x51')](_0x283bbb[_0xacf9('0x43')],_0x283bbb[_0xacf9('0x44')],parseInt(_0x283bbb[_0xacf9('0x45')],0xa)+0x1);_0x283bbb[_0xacf9('0x35')]();}}else{logger[_0xacf9('0xc')](util['format'](_0xacf9('0x52'),_0x283bbb[_0xacf9('0x17')]));_0x283bbb['continueAt'](_0x283bbb[_0xacf9('0x43')],_0x283bbb[_0xacf9('0x44')],parseInt(_0x283bbb[_0xacf9('0x45')],0xa)+0x1);_0x283bbb[_0xacf9('0x35')]();}}else{logger[_0xacf9('0xc')](util[_0xacf9('0x10')](_0xacf9('0x53'),_0x283bbb[_0xacf9('0x17')]));_0x283bbb[_0xacf9('0x51')](_0x283bbb['context'],_0x283bbb[_0xacf9('0x44')],parseInt(_0x283bbb[_0xacf9('0x45')],0xa)+0x1);_0x283bbb[_0xacf9('0x35')]();}}function main(){var _0x22a87f;return utilLicense[_0xacf9('0x54')]()[_0xacf9('0x2f')](function(_0x5ed567){if(_0x5ed567){if(_0x5ed567[_0xacf9('0x55')]){if(_0x5ed567['callysquare']&&_0x5ed567[_0xacf9('0x56')]>0x0){logger[_0xacf9('0xf')](util[_0xacf9('0x10')](_0xacf9('0x57'),_0x5ed567['callysquare']));_0x22a87f=_0x5ed567['callysquare'];}else{logger[_0xacf9('0xf')](_0xacf9('0x58'));}}else{logger[_0xacf9('0xf')](_0xacf9('0x59'));_0x22a87f=-0x1;}}})[_0xacf9('0x2d')](function(_0x4be97c){logger[_0xacf9('0xc')](_0xacf9('0x5a'),_0x4be97c['stack']);})[_0xacf9('0x4b')](function(){var _0x3943b9=require('./server')(config[_0xacf9('0x6')][_0xacf9('0x12')],config[_0xacf9('0x6')]['ip'],_0x22a87f);_0x3943b9['on'](_0xacf9('0xc'),errorHandler);_0x3943b9['on'](_0xacf9('0x5b'),listeningHandler);_0x3943b9['on'](_0xacf9('0x5c'),connectionHandler);_0x3943b9['on'](_0xacf9('0x35'),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 116ed4c..f5fcc99 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 _0x3063=['jayson/promise','http','request','then','error','message','result','SendMail','bluebird'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x3063,0xe9));var _0x3306=function(_0x17ebae,_0x7da3){_0x17ebae=_0x17ebae-0x0;var _0x8cbe7d=_0x3063[_0x17ebae];return _0x8cbe7d;};'use strict';var BPromise=require(_0x3306('0x0'));var jayson=require(_0x3306('0x1'));var client=jayson['client'][_0x3306('0x2')]({'port':0x232b});function request(_0x1b3cc1,_0x89bf9){return new BPromise(function(_0x2190f3,_0x5be16b){return client[_0x3306('0x3')](_0x1b3cc1,_0x89bf9)[_0x3306('0x4')](function(_0x2619e8){if(_0x2619e8['error']){return _0x5be16b(_0x2619e8[_0x3306('0x5')][_0x3306('0x6')]);}else{return _0x2190f3(_0x2619e8[_0x3306('0x7')]);}})['catch'](function(_0x16834a){return _0x5be16b(_0x16834a);});});}exports['sendMailMessage']=function(_0x3b005f,_0x464ea3){return request(_0x3306('0x8'),{'account':_0x3b005f,'message':_0x464ea3});}; \ No newline at end of file +var _0x5261=['http','request','then','message','result','catch','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x5261,0x75));var _0x1526=function(_0x2f57ec,_0x28f96b){_0x2f57ec=_0x2f57ec-0x0;var _0x24545b=_0x5261[_0x2f57ec];return _0x24545b;};'use strict';var BPromise=require(_0x1526('0x0'));var jayson=require(_0x1526('0x1'));var client=jayson[_0x1526('0x2')][_0x1526('0x3')]({'port':0x232b});function request(_0x11f1d6,_0x49d895){return new BPromise(function(_0x186e0c,_0x3d7032){return client[_0x1526('0x4')](_0x11f1d6,_0x49d895)[_0x1526('0x5')](function(_0x412244){if(_0x412244['error']){return _0x3d7032(_0x412244['error'][_0x1526('0x6')]);}else{return _0x186e0c(_0x412244[_0x1526('0x7')]);}})[_0x1526('0x8')](function(_0x53ea08){return _0x3d7032(_0x53ea08);});});}exports[_0x1526('0x9')]=function(_0x432a29,_0x4696b0){return request('SendMail',{'account':_0x432a29,'message':_0x4696b0});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 4232aa9..9842373 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 _0xd3ef=['line','exports','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','toString','indexOf','substring','length','slice','trim','emit','headers'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xd3ef,0xce));var _0xfd3e=function(_0x114eac,_0x1243ea){_0x114eac=_0x114eac-0x0;var _0x534e0e=_0xd3ef[_0x114eac];return _0x534e0e;};'use strict';var util=require('util');var Transform=require(_0xfd3e('0x0'))[_0xfd3e('0x1')];function AGIReply(_0x6aa93d){Transform[_0xfd3e('0x2')](this,_0x6aa93d);this[_0xfd3e('0x3')]='';this[_0xfd3e('0x4')]=![];}util[_0xfd3e('0x5')](AGIReply,Transform);AGIReply[_0xfd3e('0x6')]['_transform']=function(_0x5ab6e5,_0x3814dd,_0x2be325){var _0x16456a='\x0a',_0x94129d=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x41a08c=-0x1,_0x2a1bee=-0x1,_0x3465e3='',_0x1dcbff=0x0,_0x26e84b='',_0x2dd93b='';this[_0xfd3e('0x3')]+=_0x5ab6e5[_0xfd3e('0x7')]();_0x26e84b=this[_0xfd3e('0x3')];if(!this[_0xfd3e('0x4')]){_0x1dcbff=0x0;while(_0x94129d[_0x1dcbff]){while((_0x2a1bee=_0x26e84b[_0xfd3e('0x8')](_0x94129d[_0x1dcbff]))!=-0x1){_0x3465e3=_0x94129d[_0x1dcbff];_0x2dd93b=_0x26e84b['substring'](0x0,_0x2a1bee);_0x26e84b=_0x26e84b[_0xfd3e('0x9')](_0x2a1bee+_0x3465e3[_0xfd3e('0xa')]);var _0x50754f=_0x2dd93b['split'](_0x16456a),_0x5e3ca0=0x0,_0x2d6671={},_0x58cc95='',_0x26976b='',_0x325145=-0x1;while(_0x50754f[_0x5e3ca0]){_0x325145=_0x50754f[_0x5e3ca0]['indexOf'](':');if(_0x325145!=-0x1){_0x58cc95=_0x50754f[_0x5e3ca0][_0xfd3e('0xb')](0x0,_0x325145)[_0xfd3e('0xc')]();_0x26976b=_0x50754f[_0x5e3ca0][_0xfd3e('0xb')](_0x325145+0x1)[_0xfd3e('0xc')]();if(_0x58cc95[_0xfd3e('0xa')]>0x0){_0x2d6671[_0x58cc95]=_0x26976b;}}else{}_0x5e3ca0++;}this[_0xfd3e('0xd')](_0xfd3e('0xe'),_0x2d6671);this[_0xfd3e('0x4')]=!![];}_0x1dcbff++;}this['_localBuffer']=_0x26e84b;}else{while((_0x41a08c=_0x26e84b[_0xfd3e('0x8')](_0x16456a))!=-0x1){_0x2dd93b=_0x26e84b[_0xfd3e('0x9')](0x0,_0x41a08c);this[_0xfd3e('0xd')](_0xfd3e('0xf'),_0x2dd93b);_0x26e84b=_0x26e84b[_0xfd3e('0x9')](_0x41a08c+_0x16456a['length']);}this[_0xfd3e('0x3')]=_0x26e84b;}_0x2be325();};module[_0xfd3e('0x10')]=AGIReply; \ No newline at end of file +var _0x6474=['\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','split','slice','trim','length','emit','headers','line','util','Transform','_localBuffer','inherits','prototype','_transform'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6474,0x1f2));var _0x4647=function(_0x3bc264,_0x3366bb){_0x3bc264=_0x3bc264-0x0;var _0x44624d=_0x6474[_0x3bc264];return _0x44624d;};'use strict';var util=require(_0x4647('0x0'));var Transform=require('stream')[_0x4647('0x1')];function AGIReply(_0x5f1843){Transform['call'](this,_0x5f1843);this[_0x4647('0x2')]='';this['_inBody']=![];}util[_0x4647('0x3')](AGIReply,Transform);AGIReply[_0x4647('0x4')][_0x4647('0x5')]=function(_0x3fa8aa,_0x44c8ed,_0x4bccbb){var _0x55a592='\x0a',_0x2b9629=['\x0a\x0a',_0x4647('0x6')],_0x2666fc=-0x1,_0x171431=-0x1,_0x19a6f9='',_0x415ace=0x0,_0x45143f='',_0x4f0e5d='';this['_localBuffer']+=_0x3fa8aa[_0x4647('0x7')]();_0x45143f=this['_localBuffer'];if(!this[_0x4647('0x8')]){_0x415ace=0x0;while(_0x2b9629[_0x415ace]){while((_0x171431=_0x45143f[_0x4647('0x9')](_0x2b9629[_0x415ace]))!=-0x1){_0x19a6f9=_0x2b9629[_0x415ace];_0x4f0e5d=_0x45143f[_0x4647('0xa')](0x0,_0x171431);_0x45143f=_0x45143f[_0x4647('0xa')](_0x171431+_0x19a6f9['length']);var _0x522f66=_0x4f0e5d[_0x4647('0xb')](_0x55a592),_0x412736=0x0,_0x33a94a={},_0x3952f2='',_0x35c218='',_0x4730bd=-0x1;while(_0x522f66[_0x412736]){_0x4730bd=_0x522f66[_0x412736][_0x4647('0x9')](':');if(_0x4730bd!=-0x1){_0x3952f2=_0x522f66[_0x412736][_0x4647('0xc')](0x0,_0x4730bd)[_0x4647('0xd')]();_0x35c218=_0x522f66[_0x412736][_0x4647('0xc')](_0x4730bd+0x1)['trim']();if(_0x3952f2[_0x4647('0xe')]>0x0){_0x33a94a[_0x3952f2]=_0x35c218;}}else{}_0x412736++;}this[_0x4647('0xf')](_0x4647('0x10'),_0x33a94a);this[_0x4647('0x8')]=!![];}_0x415ace++;}this['_localBuffer']=_0x45143f;}else{while((_0x2666fc=_0x45143f[_0x4647('0x9')](_0x55a592))!=-0x1){_0x4f0e5d=_0x45143f[_0x4647('0xa')](0x0,_0x2666fc);this['emit'](_0x4647('0x11'),_0x4f0e5d);_0x45143f=_0x45143f['substring'](_0x2666fc+_0x55a592[_0x4647('0xe')]);}this[_0x4647('0x2')]=_0x45143f;}_0x4bccbb();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6c53765..0c913ba 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 _0xc2fe=['createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','message','result','catch','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording'];(function(_0x2b51f4,_0x2c260a){var _0x3de791=function(_0x57de37){while(--_0x57de37){_0x2b51f4['push'](_0x2b51f4['shift']());}};_0x3de791(++_0x2c260a);}(_0xc2fe,0x1b1));var _0xec2f=function(_0x58ebb6,_0x22739f){_0x58ebb6=_0x58ebb6-0x0;var _0x1a237e=_0xc2fe[_0x58ebb6];return _0x1a237e;};'use strict';var BPromise=require(_0xec2f('0x0'));var moment=require(_0xec2f('0x1'));var _=require(_0xec2f('0x2'));var util=require(_0xec2f('0x3'));var jayson=require(_0xec2f('0x4'));var client=jayson[_0xec2f('0x5')][_0xec2f('0x6')]({'port':0x2329});function request(_0x14208b,_0x5e9b65){return new BPromise(function(_0x47df8f,_0x552bd8){return client['request'](_0x14208b,_0x5e9b65)[_0xec2f('0x7')](function(_0x3a18f8){if(_0x3a18f8[_0xec2f('0x8')]){return _0x552bd8(_0x3a18f8[_0xec2f('0x8')][_0xec2f('0x9')]);}else{return _0x47df8f(_0x3a18f8[_0xec2f('0xa')]);}})[_0xec2f('0xb')](function(_0x50aa2b){return _0x552bd8(_0x50aa2b);});});}exports['getSquareProject']=function(_0x55022e){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x55022e},'attributes':[_0xec2f('0xc')]}});};exports[_0xec2f('0xd')]=function(_0x4f19ae){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4f19ae},'include':[{'model':_0xec2f('0xe'),'as':_0xec2f('0xf')}],'attributes':['id',_0xec2f('0x10'),_0xec2f('0x11')]}});};exports[_0xec2f('0x12')]=function(_0x4151d3){return request(_0xec2f('0x13'),{'options':{'where':{'id':_0x4151d3},'attributes':['name']}});};exports[_0xec2f('0x14')]=function(_0x55ac83){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x55ac83},'attributes':['name']}});};exports[_0xec2f('0x15')]=function(_0x6c653b){return request(_0xec2f('0x16'),{'options':{'where':{'id':_0x6c653b},'attributes':[_0xec2f('0x10')]}});};exports[_0xec2f('0x17')]=function(_0x24dbb4){return request(_0xec2f('0x18'),{'options':{'where':{'id':_0x24dbb4},'attributes':[_0xec2f('0x19')]}});};exports['getUserById']=function(_0x2585ab){return request('ShowUser',{'options':{'where':{'id':_0x2585ab},'attributes':[_0xec2f('0x10')]}});};exports[_0xec2f('0x1a')]=function(_0xb5a2f9){return request(_0xec2f('0x1b'),{'options':{'where':{'id':_0xb5a2f9},'attributes':[_0xec2f('0x10')]}});};exports[_0xec2f('0x1c')]=function(_0x4da84f){return request(_0xec2f('0x1d'),{'options':{'where':{'id':_0x4da84f},'attributes':[_0xec2f('0x1e')]}});};exports[_0xec2f('0x1f')]=function(_0x11fc43){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x11fc43},'include':[{'model':_0xec2f('0x20'),'as':_0xec2f('0x21')}]}});};exports[_0xec2f('0x22')]=function(_0x4b17cd){return request(_0xec2f('0x23'),{'options':{'where':{'id':_0x4b17cd},'attributes':['id',_0xec2f('0x10')]}});};exports[_0xec2f('0x24')]=function(_0x3817e0){return request(_0xec2f('0x25'),{'body':_0x3817e0});};exports[_0xec2f('0x26')]=function(_0x564426){return request(_0xec2f('0x27'),{'body':_0x564426});};exports[_0xec2f('0x28')]=function(_0x56fb06){return request('CreateSquareReport',{'body':_[_0xec2f('0x29')](_0x56fb06,{'project_name':_0x56fb06[_0xec2f('0x2a')],'prev_project_name':_0x56fb06[_0xec2f('0x2b')]||'','is_subproject':_0x56fb06[_0xec2f('0x2b')]?!![]:![],'leaveAt':moment()[_0xec2f('0x2c')](_0xec2f('0x2d'))})});};exports[_0xec2f('0x2e')]=function(_0x471320){return request('CreateSquareRecording',{'body':_0x471320});};exports[_0xec2f('0x2f')]=function(_0x4d037a){return request(_0xec2f('0x30'),{'body':_0x4d037a});};exports['createCmContact']=function(_0x3e779){return request(_0xec2f('0x31'),{'options':{'raw':![],'where':{'phone':_0x3e779[_0xec2f('0x32')],'ListId':_0x3e779['ListId']}}})['then'](function(_0x581d3d){if(_0x581d3d){return _0x581d3d;}return request('CreateCmContact',{'body':_0x3e779});});};exports[_0xec2f('0x33')]=function(_0x6dfd2){return request(_0xec2f('0x34'),{'options':{'where':{'id':_0x6dfd2},'attributes':[_0xec2f('0x10')]}});};exports['agentLogin']=function(_0x7ddd06,_0x519fef){return request(_0xec2f('0x35'),{'body':{'interface':_0x519fef},'options':{'where':_0x7ddd06}});};exports[_0xec2f('0x36')]=function(_0x135f1e,_0x350d99,_0x283b53){return request(_0xec2f('0x37'),{'body':{'type':_0x350d99,'uniqueid':_0x283b53},'options':{'where':_0x135f1e}});};exports[_0xec2f('0x38')]=function(_0x55bb01){return request(_0xec2f('0x39'),{'body':{},'options':{'where':_0x55bb01}});};exports[_0xec2f('0x3a')]=function(_0x40d39b){return request(_0xec2f('0x3b'),{'body':{},'options':{'where':_0x40d39b}});}; \ No newline at end of file +var _0x7443=['arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','then','getPauseById','agentLogin','PauseUser','agentUnpause','agentLogout','bluebird','lodash','jayson/promise','http','request','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1'];(function(_0x33b2bd,_0x1ef479){var _0xba7d57=function(_0x443b3f){while(--_0x443b3f){_0x33b2bd['push'](_0x33b2bd['shift']());}};_0xba7d57(++_0x1ef479);}(_0x7443,0x1a5));var _0x3744=function(_0x27d237,_0x5f5480){_0x27d237=_0x27d237-0x0;var _0x132d9b=_0x7443[_0x27d237];return _0x132d9b;};'use strict';var BPromise=require(_0x3744('0x0'));var moment=require('moment');var _=require(_0x3744('0x1'));var util=require('util');var jayson=require(_0x3744('0x2'));var client=jayson['client'][_0x3744('0x3')]({'port':0x2329});function request(_0x3a6ac9,_0x57c11c){return new BPromise(function(_0x421de9,_0x529786){return client[_0x3744('0x4')](_0x3a6ac9,_0x57c11c)['then'](function(_0x279eb2){if(_0x279eb2[_0x3744('0x5')]){return _0x529786(_0x279eb2[_0x3744('0x5')][_0x3744('0x6')]);}else{return _0x421de9(_0x279eb2[_0x3744('0x7')]);}})['catch'](function(_0x423dde){return _0x529786(_0x423dde);});});}exports[_0x3744('0x8')]=function(_0x10248b){return request(_0x3744('0x9'),{'options':{'raw':![],'where':{'name':_0x10248b},'attributes':[_0x3744('0xa')]}});};exports[_0x3744('0xb')]=function(_0x3bc73e){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3bc73e},'include':[{'model':_0x3744('0xc'),'as':_0x3744('0xd')}],'attributes':['id',_0x3744('0xe'),_0x3744('0xf')]}});};exports[_0x3744('0x10')]=function(_0x3e4fc9){return request(_0x3744('0x9'),{'options':{'where':{'id':_0x3e4fc9},'attributes':[_0x3744('0xe')]}});};exports['getVoiceQueueById']=function(_0x479270){return request(_0x3744('0x11'),{'options':{'where':{'id':_0x479270},'attributes':['name']}});};exports[_0x3744('0x12')]=function(_0x93e65e){return request(_0x3744('0x13'),{'options':{'where':{'id':_0x93e65e},'attributes':['name']}});};exports[_0x3744('0x14')]=function(_0x59fe12){return request(_0x3744('0x15'),{'options':{'where':{'id':_0x59fe12},'attributes':['dsn']}});};exports[_0x3744('0x16')]=function(_0x18a2e0){return request(_0x3744('0x17'),{'options':{'where':{'id':_0x18a2e0},'attributes':['name']}});};exports[_0x3744('0x18')]=function(_0x2f5c8f){return request(_0x3744('0x19'),{'options':{'where':{'id':_0x2f5c8f},'attributes':[_0x3744('0xe')]}});};exports['getSoundById']=function(_0x5e54c4){return request(_0x3744('0x1a'),{'options':{'where':{'id':_0x5e54c4},'attributes':[_0x3744('0x1b')]}});};exports[_0x3744('0x1c')]=function(_0x3e240c){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3e240c},'include':[{'model':_0x3744('0x1d'),'as':_0x3744('0x1e')}]}});};exports[_0x3744('0x1f')]=function(_0x375528){return request(_0x3744('0x20'),{'options':{'where':{'id':_0x375528},'attributes':['id',_0x3744('0xe')]}});};exports['createSmsMessage']=function(_0xffafdd){return request(_0x3744('0x21'),{'body':_0xffafdd});};exports[_0x3744('0x22')]=function(_0x2280ea){return request(_0x3744('0x23'),{'body':_0x2280ea});};exports['createSquareReport']=function(_0x223174){return request('CreateSquareReport',{'body':_[_0x3744('0x24')](_0x223174,{'project_name':_0x223174[_0x3744('0x25')],'prev_project_name':_0x223174[_0x3744('0x26')]||'','is_subproject':_0x223174[_0x3744('0x26')]?!![]:![],'leaveAt':moment()['format'](_0x3744('0x27'))})});};exports[_0x3744('0x28')]=function(_0x3ad714){return request(_0x3744('0x29'),{'body':_0x3ad714});};exports[_0x3744('0x2a')]=function(_0x39b21e){return request(_0x3744('0x2b'),{'body':_0x39b21e});};exports['createCmContact']=function(_0x3ce187){return request(_0x3744('0x2c'),{'options':{'raw':![],'where':{'phone':_0x3ce187['phone'],'ListId':_0x3ce187['ListId']}}})[_0x3744('0x2d')](function(_0x540150){if(_0x540150){return _0x540150;}return request('CreateCmContact',{'body':_0x3ce187});});};exports[_0x3744('0x2e')]=function(_0x346e5f){return request('ShowPause',{'options':{'where':{'id':_0x346e5f},'attributes':['name']}});};exports[_0x3744('0x2f')]=function(_0x5a36ff,_0x4782f6){return request('LoginUser',{'body':{'interface':_0x4782f6},'options':{'where':_0x5a36ff}});};exports['agentPause']=function(_0x555c1a,_0x3f98e4,_0x5526bc){return request(_0x3744('0x30'),{'body':{'type':_0x3f98e4,'uniqueid':_0x5526bc},'options':{'where':_0x555c1a}});};exports[_0x3744('0x31')]=function(_0x4c03ae){return request('UnpauseUser',{'body':{},'options':{'where':_0x4c03ae}});};exports[_0x3744('0x32')]=function(_0x493130){return request('LogoutUser',{'body':{},'options':{'where':_0x493130}});}; \ 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 dda3bc0..81ed357 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 _0x75a2=['exports','./polly','./lex'];(function(_0x4d63ba,_0x5b24b8){var _0x438165=function(_0x2d9c44){while(--_0x2d9c44){_0x4d63ba['push'](_0x4d63ba['shift']());}};_0x438165(++_0x5b24b8);}(_0x75a2,0x187));var _0x275a=function(_0x195ef4,_0x5142c1){_0x195ef4=_0x195ef4-0x0;var _0x38bbbc=_0x75a2[_0x195ef4];return _0x38bbbc;};var polly=require(_0x275a('0x0'));var lex=require(_0x275a('0x1'));module[_0x275a('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9d76=['./polly','exports'];(function(_0xd07c3,_0xfc3ca){var _0x1f0f5a=function(_0x3fe06c){while(--_0x3fe06c){_0xd07c3['push'](_0xd07c3['shift']());}};_0x1f0f5a(++_0xfc3ca);}(_0x9d76,0x76));var _0x69d7=function(_0x513704,_0xf15f8b){_0x513704=_0x513704-0x0;var _0x5f0463=_0x9d76[_0x513704];return _0x5f0463;};var polly=require(_0x69d7('0x0'));var lex=require('./lex');module[_0x69d7('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 f40b0ef..bb24979 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 _0xe706=['exports','./lib/api'];(function(_0x55a748,_0x3c2eed){var _0x3bef2b=function(_0x84f64b){while(--_0x84f64b){_0x55a748['push'](_0x55a748['shift']());}};_0x3bef2b(++_0x3c2eed);}(_0xe706,0xa3));var _0x6e70=function(_0xd5584e,_0x251c06){_0xd5584e=_0xd5584e-0x0;var _0xdc594e=_0xe706[_0xd5584e];return _0xdc594e;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ No newline at end of file +var _0x5ff3=['exports'];(function(_0x5e3141,_0x4b9e90){var _0x466f29=function(_0x2d8d1){while(--_0x2d8d1){_0x5e3141['push'](_0x5e3141['shift']());}};_0x466f29(++_0x4b9e90);}(_0x5ff3,0x17d));var _0x35ff=function(_0x29b596,_0x4600ea){_0x29b596=_0x29b596-0x0;var _0x2dd8ad=_0x5ff3[_0x29b596];return _0x2dd8ad;};'use strict';var lex=require('./lib/api');module[_0x35ff('0x0')]=function(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a){return lex(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a);}; \ 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 cdbc1d2..6edd281 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(_0x3f3990,_0x39ce92){var _0x542c68=function(_0x19f07b){while(--_0x19f07b){_0x3f3990['push'](_0x3f3990['shift']());}};_0x542c68(++_0x39ce92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x66e5e6,_0x15b972){var _0x368fc5=function(_0x411106){while(--_0x411106){_0x66e5e6['push'](_0x66e5e6['shift']());}};_0x368fc5(++_0x15b972);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 2f7104d..6794c54 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 _0xb423=['./lib/api'];(function(_0x3c4f2c,_0x3fd819){var _0x16e06d=function(_0x53fbf1){while(--_0x53fbf1){_0x3c4f2c['push'](_0x3c4f2c['shift']());}};_0x16e06d(++_0x3fd819);}(_0xb423,0x183));var _0x3b42=function(_0x53831,_0x3bc701){_0x53831=_0x53831-0x0;var _0xd7d46e=_0xb423[_0x53831];return _0xd7d46e;};'use strict';var polly=require(_0x3b42('0x0'));module['exports']=function(_0x5c1ec2,_0x21e3c6,_0xf0506b,_0x17fddb,_0x2dcf30,_0x2d90c2,_0x477677){return polly(_0x5c1ec2,_0x21e3c6,_0xf0506b,_0x17fddb,_0x2dcf30,_0x2d90c2,_0x477677);}; \ No newline at end of file +var _0x48e7=['./lib/api'];(function(_0x4c02f8,_0x56fd17){var _0x18ead1=function(_0x2494be){while(--_0x2494be){_0x4c02f8['push'](_0x4c02f8['shift']());}};_0x18ead1(++_0x56fd17);}(_0x48e7,0x170));var _0x748e=function(_0xf9a5ed,_0x3da77d){_0xf9a5ed=_0xf9a5ed-0x0;var _0x17f7a6=_0x48e7[_0xf9a5ed];return _0x17f7a6;};'use strict';var polly=require(_0x748e('0x0'));module['exports']=function(_0x26b81f,_0x2958d1,_0x267e1c,_0x4aaadd,_0x4a1055,_0x53252e,_0x2e3df0){return polly(_0x26b81f,_0x2958d1,_0x267e1c,_0x4aaadd,_0x4a1055,_0x53252e,_0x2e3df0);}; \ 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 bfb6ccc..229057a 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 _0xcfdb=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','aws-sdk','synthesizeSpeech'];(function(_0x40f9ee,_0x80a12){var _0x4284d0=function(_0x2dba43){while(--_0x2dba43){_0x40f9ee['push'](_0x40f9ee['shift']());}};_0x4284d0(++_0x80a12);}(_0xcfdb,0x1c0));var _0xbcfd=function(_0x177cc9,_0x3f6fdd){_0x177cc9=_0x177cc9-0x0;var _0x2fe577=_0xcfdb[_0x177cc9];return _0x2fe577;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0xbcfd('0x0'));function pollyResult(_0x188784,_0xa246b4,_0x3667ff){return new BPromise(function(_0x17df8a,_0x4b6436){_0x188784[_0xbcfd('0x1')](_0xa246b4,function(_0x35d4bd,_0x2e455b){if(_0x35d4bd){_0x4b6436(_0x35d4bd);}else if(_0x2e455b){if(_0x2e455b[_0xbcfd('0x2')]instanceof Buffer){fs[_0xbcfd('0x3')](_0x3667ff,_0x2e455b[_0xbcfd('0x2')],function(_0x1a6ec2){if(_0x1a6ec2){_0x4b6436(_0x1a6ec2);}else{_0x17df8a();}});}else{_0x4b6436(new Error(_0xbcfd('0x4')));}}else{_0x4b6436(new Error(_0xbcfd('0x5')));}});});}module[_0xbcfd('0x6')]=function(_0x8e1def,_0x2385c6,_0x2c0c5b,_0x87649f,_0x1a94c5,_0x457b2b,_0x412cca){var _0x4d9c9b=new AWS['Polly']({'accessKeyId':_0x8e1def,'secretAccessKey':_0x2385c6,'region':_0x2c0c5b});var _0x4d06da={'Text':_0x1a94c5,'TextType':_0x457b2b||_0xbcfd('0x7'),'OutputFormat':_0xbcfd('0x8'),'VoiceId':_0x87649f};return pollyResult(_0x4d9c9b,_0x4d06da,_0x412cca);}; \ No newline at end of file +var _0x42f9=['aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','randomstring'];(function(_0x2201d8,_0xc990f){var _0x19cea8=function(_0x44f3d5){while(--_0x44f3d5){_0x2201d8['push'](_0x2201d8['shift']());}};_0x19cea8(++_0xc990f);}(_0x42f9,0x185));var _0x942f=function(_0x2d8270,_0x474996){_0x2d8270=_0x2d8270-0x0;var _0x2fa65f=_0x42f9[_0x2d8270];return _0x2fa65f;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x942f('0x0'));var AWS=require(_0x942f('0x1'));function pollyResult(_0x349995,_0x2fe121,_0x3967f2){return new BPromise(function(_0x16820d,_0x1f5c62){_0x349995[_0x942f('0x2')](_0x2fe121,function(_0x4059ef,_0x5e2ade){if(_0x4059ef){_0x1f5c62(_0x4059ef);}else if(_0x5e2ade){if(_0x5e2ade[_0x942f('0x3')]instanceof Buffer){fs['writeFile'](_0x3967f2,_0x5e2ade[_0x942f('0x3')],function(_0x4b66a7){if(_0x4b66a7){_0x1f5c62(_0x4b66a7);}else{_0x16820d();}});}else{_0x1f5c62(new Error(_0x942f('0x4')));}}else{_0x1f5c62(new Error(_0x942f('0x5')));}});});}module[_0x942f('0x6')]=function(_0x478f0b,_0x367c94,_0x264782,_0x2cb7ad,_0x1963bc,_0x4ff536,_0x3fb126){var _0x593c89=new AWS[(_0x942f('0x7'))]({'accessKeyId':_0x478f0b,'secretAccessKey':_0x367c94,'region':_0x264782});var _0x18b434={'Text':_0x1963bc,'TextType':_0x4ff536||_0x942f('0x8'),'OutputFormat':_0x942f('0x9'),'VoiceId':_0x2cb7ad};return pollyResult(_0x593c89,_0x18b434,_0x3fb126);}; \ 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 f489e97..fac9eb5 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 _0xd735=['./lib/api','exports'];(function(_0xb8f97f,_0x27a8f7){var _0x3b16b1=function(_0x17b6cf){while(--_0x17b6cf){_0xb8f97f['push'](_0xb8f97f['shift']());}};_0x3b16b1(++_0x27a8f7);}(_0xd735,0x1cc));var _0x5d73=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd735[_0x502c7d];return _0x30b7ed;};'use strict';var asr=require(_0x5d73('0x0'));module[_0x5d73('0x1')]=function(_0x15115b,_0x2d4df6,_0x29cdd6,_0x3a79d4){return asr(_0x15115b,_0x2d4df6,_0x29cdd6);}; \ No newline at end of file +var _0x26b3=['exports'];(function(_0x4f30ba,_0x121529){var _0x263131=function(_0x40d132){while(--_0x40d132){_0x4f30ba['push'](_0x4f30ba['shift']());}};_0x263131(++_0x121529);}(_0x26b3,0x1c0));var _0x326b=function(_0x1e420b,_0xcc641a){_0x1e420b=_0x1e420b-0x0;var _0x2dc988=_0x26b3[_0x1e420b];return _0x2dc988;};'use strict';var asr=require('./lib/api');module[_0x326b('0x0')]=function(_0x6fe8a8,_0x3d355f,_0x4b3f5f,_0x44d20b){return asr(_0x6fe8a8,_0x3d355f,_0x4b3f5f);}; \ 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 db3a2bf..643e456 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 _0xb821=['string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com'];(function(_0x212b07,_0x9580fc){var _0x5909a7=function(_0x3469e6){while(--_0x3469e6){_0x212b07['push'](_0x212b07['shift']());}};_0x5909a7(++_0x9580fc);}(_0xb821,0xa7));var _0x1b82=function(_0x58bba5,_0x127277){_0x58bba5=_0x58bba5-0x0;var _0xe21938=_0xb821[_0x58bba5];return _0xe21938;};'use strict';var url=require('url');var BPromise=require(_0x1b82('0x0'));var fs=require('fs');var host=_0x1b82('0x1');module['exports']=function(_0x4a4f81,_0xbab478,_0x578a10){return new BPromise(function(_0x4b1809,_0x3b1d14){var _0x1403ab;if(typeof _0x4a4f81!==_0x1b82('0x2')||_0x4a4f81[_0x1b82('0x3')]===0x0){return _0x3b1d14('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xbab478!==_0x1b82('0x2')||_0xbab478[_0x1b82('0x3')]===0x0){return _0x3b1d14(_0x1b82('0x4'));}if(typeof _0x578a10!==_0x1b82('0x5')&&(typeof _0x578a10!==_0x1b82('0x2')||_0x578a10[_0x1b82('0x3')]===0x0)){return _0x3b1d14(_0x1b82('0x6'));}try{_0x1403ab=fs[_0x1b82('0x7')](_0x4a4f81)[_0x1b82('0x8')]('base64');}catch(_0x4011f2){return _0x3b1d14(_0x4011f2);}return _0x4b1809({'method':_0x1b82('0x9'),'uri':host+_0x1b82('0xa')+_0xbab478,'body':{'config':{'encoding':_0x1b82('0xb'),'sampleRateHertz':_0x1b82('0xc'),'languageCode':_0x578a10},'audio':{'content':_0x1403ab}},'json':!![]});});}; \ No newline at end of file +var _0xd87e=['bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x1e5264,_0xabdbf2){var _0x5277d6=function(_0x4a0385){while(--_0x4a0385){_0x1e5264['push'](_0x1e5264['shift']());}};_0x5277d6(++_0xabdbf2);}(_0xd87e,0x1bf));var _0xed87=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0xd87e[_0x2df1f2];return _0x38652b;};'use strict';var url=require(_0xed87('0x0'));var BPromise=require(_0xed87('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xed87('0x2')]=function(_0x189fdd,_0x16509b,_0x5901be){return new BPromise(function(_0xbbee79,_0x5e960f){var _0x11a5d9;if(typeof _0x189fdd!==_0xed87('0x3')||_0x189fdd['length']===0x0){return _0x5e960f(_0xed87('0x4'));}if(typeof _0x16509b!=='string'||_0x16509b['length']===0x0){return _0x5e960f(_0xed87('0x5'));}if(typeof _0x5901be!==_0xed87('0x6')&&(typeof _0x5901be!==_0xed87('0x3')||_0x5901be[_0xed87('0x7')]===0x0)){return _0x5e960f('lang\x20should\x20be\x20a\x20string');}try{_0x11a5d9=fs[_0xed87('0x8')](_0x189fdd)[_0xed87('0x9')](_0xed87('0xa'));}catch(_0x3c9a3c){return _0x5e960f(_0x3c9a3c);}return _0xbbee79({'method':_0xed87('0xb'),'uri':host+_0xed87('0xc')+_0x16509b,'body':{'config':{'encoding':_0xed87('0xd'),'sampleRateHertz':'8000','languageCode':_0x5901be},'audio':{'content':_0x11a5d9}},'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 cad239f..0ed2528 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 _0x5ac5=['exports','./asr'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5ac5,0x6b));var _0x55ac=function(_0x281357,_0x3dada9){_0x281357=_0x281357-0x0;var _0x3d0f2d=_0x5ac5[_0x281357];return _0x3d0f2d;};var asr=require(_0x55ac('0x0'));module[_0x55ac('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa7d6=['./asr','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7d6,0x1aa));var _0x6a7d=function(_0x6bae2d,_0x4d66ad){_0x6bae2d=_0x6bae2d-0x0;var _0x2df09d=_0xa7d6[_0x6bae2d];return _0x2df09d;};var asr=require(_0x6a7d('0x0'));module[_0x6a7d('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 d5cccfd..8eea341 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 _0x0bd4=['replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20confidence','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','.mp3','from','audioContent','writeFile','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','uri','results','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2'];(function(_0x2c5411,_0x37da99){var _0x1a6a16=function(_0x222813){while(--_0x222813){_0x2c5411['push'](_0x2c5411['shift']());}};_0x1a6a16(++_0x37da99);}(_0x0bd4,0x127));var _0x40bd=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x0bd4[_0x59eacf];return _0x5d74f2;};'use strict';var apiai=require(_0x40bd('0x0'));var BPromise=require(_0x40bd('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x40bd('0x2'));var https=require(_0x40bd('0x3'));var md5=require('md5');var path=require(_0x40bd('0x4'));var querystring=require('querystring');var rp=require(_0x40bd('0x5'));var rs=require(_0x40bd('0x6'));var sox=require(_0x40bd('0x7'));var tts=require(_0x40bd('0x8'));var urlParse=require(_0x40bd('0x9'))[_0x40bd('0xa')];var util=require(_0x40bd('0xb'));var aws=require('./aws');var google=require(_0x40bd('0xc'));var sestek=require(_0x40bd('0xd'));var tilde=require(_0x40bd('0xe'));var logger=require(_0x40bd('0xf'))(_0x40bd('0x10'));var ISPEECH_API=_0x40bd('0x11');function downloadFile(_0x388765,_0x2070bd){return new BPromise(function(_0x58ada0,_0xe08975){var _0x519c53=urlParse(_0x388765);var _0x3b6f9c=_0x519c53[_0x40bd('0x12')]===_0x40bd('0x13')?https:http;var _0x50abb6={'host':_0x519c53[_0x40bd('0x14')],'path':_0x519c53[_0x40bd('0x4')],'headers':{'user-agent':_0x40bd('0x15')}};_0x3b6f9c[_0x40bd('0x16')](_0x50abb6,function(_0x2560b1){if(_0x2560b1[_0x40bd('0x17')]!==0xc8){logger['error'](_0x40bd('0x18')+_0x388765+_0x40bd('0x19')+_0x2560b1['statusCode']+'\x20('+_0x2560b1['statusMessage']+')');_0xe08975(new Error(_0x40bd('0x18')+_0x388765+_0x40bd('0x19')+_0x2560b1[_0x40bd('0x17')]+'\x20('+_0x2560b1[_0x40bd('0x1a')]+')'));return;}var _0x317ecf=fs[_0x40bd('0x1b')](_0x2070bd);_0x317ecf['on']('finish',function(){logger[_0x40bd('0x1c')](_0x40bd('0x1d'));_0x317ecf['close'](_0x58ada0);});_0x317ecf['on'](_0x40bd('0x1e'),function(_0x38f5){fs[_0x40bd('0x1f')](_0x2070bd);logger[_0x40bd('0x1e')](_0x40bd('0x20'),_0x38f5);_0xe08975(_0x38f5);});_0x2560b1[_0x40bd('0x21')](_0x317ecf);})['on']('error',function(_0x126ba5){logger[_0x40bd('0x1e')](_0x126ba5);_0xe08975(_0x126ba5);})['end']();});}function uploadFile(_0x3f1b8f){return new BPromise(function(_0x4135d2,_0xe68547){var _0x2d3960=urlParse(_0x3f1b8f);var _0x4bfbbf=_0x2d3960['protocol']===_0x40bd('0x13')?https:http;var _0x5651ed={'host':_0x2d3960[_0x40bd('0x14')],'path':_0x2d3960[_0x40bd('0x4')],'headers':{'user-agent':_0x40bd('0x15')}};_0x4bfbbf[_0x40bd('0x16')](_0x5651ed,function(_0x2623a4){if(_0x2623a4[_0x40bd('0x17')]!==0xc8){_0xe68547(new Error(_0x40bd('0x18')+_0x3f1b8f+_0x40bd('0x19')+_0x2623a4['statusCode']+'\x20('+_0x2623a4[_0x40bd('0x1a')]+')'));return;}var _0x1f5031='';_0x2623a4['on'](_0x40bd('0x22'),function(_0x3f4732){_0x1f5031+=_0x3f4732;});_0x2623a4['on'](_0x40bd('0x23'),function(){_0x4135d2(_0x1f5031);});})['on'](_0x40bd('0x1e'),function(_0x159330){_0xe68547(_0x159330);})[_0x40bd('0x23')]();});}function convertFile(_0x4e339b,_0xc773e9){return new BPromise(function(_0x474042,_0x32503b){var _0x3627e3=sox[_0x40bd('0x24')](_0x4e339b,_0xc773e9,{'sampleRate':0x1f40,'format':_0x40bd('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3627e3['on']('error',function(_0x1925ee){logger['error'](_0x40bd('0x26'),_0x1925ee);_0x32503b(_0x1925ee);});_0x3627e3['on'](_0x40bd('0x23'),function(){logger[_0x40bd('0x1c')](_0x40bd('0x27'));_0x474042();});_0x3627e3[_0x40bd('0x28')]();});}function base64Decode(_0x514056,_0x5f38ac){var _0x559a14=path['resolve'](__dirname,_0x40bd('0x29'),rs[_0x40bd('0x2a')](0x4)+_0x40bd('0x2b'));fs[_0x40bd('0x2c')](_0x559a14,_0x514056,'base64');return convertFile(_0x559a14,_0x5f38ac)[_0x40bd('0x2d')](function(){try{fs[_0x40bd('0x1f')](_0x559a14);fs[_0x40bd('0x2e')](_0x5f38ac,_0x40bd('0x2f'));}catch(_0x51ffdd){logger['error'](_0x51ffdd);}return _0x5f38ac[_0x40bd('0x30')]('.')[0x0];});}function base64Encode(_0x16254a){var _0x4e1a44=fs[_0x40bd('0x31')](_0x16254a);return new Buffer(_0x4e1a44)['toString'](_0x40bd('0x32'));}exports[_0x40bd('0x33')]=function(_0x396de1,_0x260011,_0x3af8e0,_0x250e96,_0x4b0441,_0x54534b){var _0x1d7b0d,_0x5d4efb;var _0x18069a=_0x40bd('0x34');var _0x18f296=_0x40bd('0x35')+_0x396de1;var _0x11a783={};if(_0x260011===_0x40bd('0x36')){_0x11a783[_0x40bd('0x37')]={'ssml':_0x3af8e0};}else{_0x11a783[_0x40bd('0x37')]={'text':_0x3af8e0};};_0x11a783[_0x40bd('0x38')]={'languageCode':_0x250e96,'ssmlGender':_0x4b0441};_0x11a783[_0x40bd('0x39')]={'audioEncoding':_0x40bd('0x3a'),'sampleRateHertz':0x1f40};var _0x41bf3f={'url':_0x18069a+_0x40bd('0x3b')+_0x18f296,'method':'POST','json':!![],'body':_0x11a783};return rp(_0x41bf3f)['then'](function(_0x4a40fd){return new BPromise(function(_0x5d6bc0,_0x1996b7){_0x1d7b0d=path[_0x40bd('0x3c')](__dirname,_0x40bd('0x29'),rs[_0x40bd('0x2a')](0x4)+_0x40bd('0x3d'));var _0x1cd615=Buffer[_0x40bd('0x3e')](_0x4a40fd[_0x40bd('0x3f')],_0x40bd('0x32'));return fs[_0x40bd('0x40')](_0x1d7b0d,_0x1cd615,function(_0x1595cd){_0x1996b7(_0x1595cd);},function(_0x12c135){fs[_0x40bd('0x2e')](_0x1d7b0d,_0x40bd('0x2f'));_0x5d6bc0(_0x12c135);});});})[_0x40bd('0x2d')](function(_0x486baf){_0x5d4efb=path['resolve'](__dirname,_0x40bd('0x29'),rs[_0x40bd('0x2a')](0x4)+_0x40bd('0x2b'));return convertFile(_0x1d7b0d,_0x5d4efb);})[_0x40bd('0x2d')](function(){try{fs['unlink'](_0x1d7b0d);fs[_0x40bd('0x2e')](_0x5d4efb,_0x40bd('0x2f'));}catch(_0x625d84){logger[_0x40bd('0x1e')](_0x625d84);}logger['info']('googleCloudTTS\x20path',_0x5d4efb[_0x40bd('0x30')]('.')[0x0]);return _0x5d4efb[_0x40bd('0x30')]('.')[0x0];});};exports['googleTTS']=function(_0x4a4f8b,_0x3da192){var _0x5cd3c7='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x58cf94,_0x5268e3;var _0x412200;var _0x67923b={'encoding':_0x40bd('0x41'),'method':_0x40bd('0x42'),'timeout':0x2710,'url':_0x5cd3c7,'headers':{'Content-Type':_0x40bd('0x43')},'body':_0x40bd('0x44')+encodeURIComponent(JSON[_0x40bd('0x45')]([[[_0x40bd('0x46'),JSON['stringify']([_0x4a4f8b,_0x3da192||'en',![],'null']),null,_0x40bd('0x47')]]]))};return rp(_0x67923b)['then'](function(_0x3991ac){try{_0x412200=eval(_0x3991ac[_0x40bd('0x48')](0x5))[0x0][0x2];}catch(_0x5f3c3a){throw new Error(_0x40bd('0x49')+_0x3991ac[_0x40bd('0x22')]);}if(!_0x412200){if(_0x4a4f8b['length']>0xc8){throw new Error(_0x40bd('0x4a'));}else{throw new Error(_0x40bd('0x4b')+_0x3da192+_0x40bd('0x4c'));}}try{_0x412200=eval(_0x412200)[0x0];}catch(_0x2ff8bd){throw new Error(_0x40bd('0x49')+res[_0x40bd('0x22')]);}const _0x5afdd0=_0x412200;_0x58cf94=path[_0x40bd('0x3c')](__dirname,'tmp',rs['generate'](0x4)+_0x40bd('0x3d'));fs[_0x40bd('0x2c')](_0x58cf94,_0x412200,{'encoding':'base64'});_0x5268e3=path[_0x40bd('0x3c')](__dirname,'tmp',rs[_0x40bd('0x2a')](0x4)+'.wav');return convertFile(_0x58cf94,_0x5268e3);})[_0x40bd('0x2d')](function(){try{fs['unlink'](_0x58cf94);fs[_0x40bd('0x2e')](_0x5268e3,_0x40bd('0x2f'));}catch(_0x199eba){logger[_0x40bd('0x1e')](_0x199eba);}logger[_0x40bd('0x1c')]('goggleTTS\x20path',_0x5268e3[_0x40bd('0x30')]('.')[0x0]);return _0x5268e3[_0x40bd('0x30')]('.')[0x0];});};exports['googleASR']=function(_0x8166ac,_0x129120,_0x3b98fb){return google['asr'](_0x8166ac,_0x129120,_0x3b98fb)[_0x40bd('0x2d')](function(_0x4a1ba7){logger[_0x40bd('0x1c')](_0x4a1ba7[_0x40bd('0x4d')]);return rp(_0x4a1ba7);})[_0x40bd('0x2d')](function(_0xe06b7f){var _0x5e0bb6='';var _0x576b7d=0x0;try{fs[_0x40bd('0x1f')](_0x8166ac);}catch(_0x2fc010){logger[_0x40bd('0x1e')](_0x2fc010);}if(_0xe06b7f&&_0xe06b7f[_0x40bd('0x4e')]){_0x5e0bb6=_0xe06b7f[_0x40bd('0x4e')]['map'](function(_0x1dd1d8){return _0x1dd1d8&&_0x1dd1d8[_0x40bd('0x4f')][0x0]&&_0x1dd1d8[_0x40bd('0x4f')][0x0][_0x40bd('0x50')]?_0x1dd1d8['alternatives'][0x0][_0x40bd('0x50')]:'';})['join']('\x0a');_0x576b7d=_0xe06b7f[_0x40bd('0x4e')]['map'](function(_0x109bc6){return _0x109bc6&&_0x109bc6[_0x40bd('0x4f')][0x0]&&_0x109bc6[_0x40bd('0x4f')][0x0][_0x40bd('0x51')]?_0x109bc6[_0x40bd('0x4f')][0x0]['confidence']:0x0;})['join']('\x0a');}logger['info'](_0x40bd('0x52'),_0x5e0bb6);logger[_0x40bd('0x1c')](_0x40bd('0x53'),_0x576b7d);return{'transcript':_0x5e0bb6,'confidence':_0x576b7d};})[_0x40bd('0x54')](function(_0x228d5c){logger[_0x40bd('0x1e')](_0x40bd('0x55'),_0x228d5c['statusCode'],_0x228d5c[_0x40bd('0x56')],_0x228d5c[_0x40bd('0x57')]);});};exports[_0x40bd('0x58')]=function(_0x7cf76a,_0x46324f,_0x5207a3,_0x227977){var _0x83c099=apiai(_0x46324f,{'language':_0x227977||'en'});return _0x83c099[_0x40bd('0x59')](_0x5207a3,{'sessionId':md5(_0x7cf76a)})[_0x40bd('0x2d')](function(_0x1a9db6){logger[_0x40bd('0x1c')](JSON[_0x40bd('0x45')](_0x1a9db6));return{'source':_0x1a9db6[_0x40bd('0x5a')][_0x40bd('0x5b')],'resolvedQuery':_0x1a9db6[_0x40bd('0x5a')][_0x40bd('0x5c')],'action':_0x1a9db6[_0x40bd('0x5a')]['action'],'actionIncomplete':_0x1a9db6[_0x40bd('0x5a')][_0x40bd('0x5d')],'speech':_0x1a9db6[_0x40bd('0x5a')][_0x40bd('0x5e')][_0x40bd('0x5f')],'score':_0x1a9db6[_0x40bd('0x5a')]['score'],'statusCode':_0x1a9db6['status'][_0x40bd('0x60')],'endConversation':_0x1a9db6[_0x40bd('0x5a')]['metadata'][_0x40bd('0x61')]||![],'isFallbackIntent':_0x1a9db6['result'][_0x40bd('0x62')][_0x40bd('0x63')]};});};exports[_0x40bd('0x64')]=function(_0x30f860,_0x2b848a,_0x567175,_0x2a9932,_0x277b61,_0x14e97c){var _0x562c91=_0x2a9932[_0x40bd('0x65')](/\\n/g,'\x0a');var _0x6f3631={'credentials':{'private_key':_0x562c91,'client_email':_0x567175}};var _0x1a363c=new dialogflow[(_0x40bd('0x66'))](_0x6f3631);var _0x2428e6=_0x1a363c[_0x40bd('0x67')](_0x2b848a,md5(_0x30f860));var _0x433f27={'session':_0x2428e6,'queryInput':{'text':{'text':_0x277b61,'languageCode':_0x14e97c}}};return _0x1a363c['detectIntent'](_0x433f27)[_0x40bd('0x2d')](function(_0x150484){if(_0x150484&&_0x150484[_0x40bd('0x68')]){logger[_0x40bd('0x1c')](_0x40bd('0x69'),JSON[_0x40bd('0x45')](_0x150484));var _0x119a11=_0x150484[0x0];if(_0x119a11){var _0xe6c80b={'action':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x6b')],'allRequiredParamsPresent':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x6c')],'endConversation':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x6d')]&&_0x119a11[_0x40bd('0x6a')][_0x40bd('0x6d')]['fields']?_0x119a11['queryResult'][_0x40bd('0x6d')][_0x40bd('0x6e')][_0x40bd('0x6f')]['boolValue']:![],'fulfillmentText':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x70')],'intentName':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x71')][_0x40bd('0x56')],'intentDisplayName':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x71')][_0x40bd('0x72')],'isFallbackIntent':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x71')]['isFallback'],'languageCode':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x73')],'queryText':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x74')],'responseId':_0x119a11['responseId'],'score':_0x119a11[_0x40bd('0x6a')][_0x40bd('0x75')],'speech':_0x119a11['queryResult'][_0x40bd('0x70')],'providerResponse':JSON[_0x40bd('0x45')](_0x150484)};return _0xe6c80b;}}});};exports['tildeASR']=function(_0xadab70,_0x61183b,_0x673699,_0x43cff9){return tilde['asr'](_0xadab70,_0x61183b,_0x673699,_0x43cff9)[_0x40bd('0x2d')](function(_0x26ebbe){try{fs[_0x40bd('0x1f')](_0xadab70);}catch(_0x4c0a33){logger[_0x40bd('0x1e')](_0x4c0a33);}logger[_0x40bd('0x1c')]('Tilde\x20ASR\x20transcription',_0x26ebbe[_0x40bd('0x50')]);logger[_0x40bd('0x1c')](_0x40bd('0x76'),_0x26ebbe['confidence']);return _0x26ebbe;});};exports['awsPolly']=function(_0x357112,_0x3e8871,_0x3bb7a1,_0x1393ff,_0x2c836f,_0x255315){var _0x110a20=path['resolve'](__dirname,_0x40bd('0x29'),rs['generate'](0x4)+_0x40bd('0x3d'));var _0x444297;return aws[_0x40bd('0x77')](_0x357112,_0x3e8871,_0x3bb7a1,_0x1393ff,_0x2c836f,_0x255315,_0x110a20)[_0x40bd('0x2d')](function(){_0x444297=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x40bd('0x2b'));return convertFile(_0x110a20,_0x444297);})['then'](function(){try{fs['unlink'](_0x110a20);fs[_0x40bd('0x2e')](_0x444297,_0x40bd('0x2f'));}catch(_0xb93d1c){logger['error'](_0xb93d1c);}return _0x444297[_0x40bd('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x27afbc,_0x45a736,_0x341854,_0x4c3dda,_0x33b682,_0x440463){return aws[_0x40bd('0x78')](_0x27afbc,_0x45a736,_0x341854,_0x4c3dda,_0x33b682,_0x440463)[_0x40bd('0x2d')](function(_0x5624a8){logger[_0x40bd('0x1c')](JSON[_0x40bd('0x45')](_0x5624a8));return _0x5624a8;});};exports['ispeechTTS']=function(_0x5af0fa,_0x53866f,_0x3aa323,_0xa0dc07){var _0x54b871=util[_0x40bd('0x79')](_0x40bd('0x7a'),ISPEECH_API,_0x5af0fa,encodeURIComponent(_0x53866f),_0x3aa323,_0xa0dc07);var _0x2a58b3=path[_0x40bd('0x3c')](__dirname,_0x40bd('0x29'),rs[_0x40bd('0x2a')](0x4)+_0x40bd('0x3d'));var _0x5be374;return downloadFile(_0x54b871,_0x2a58b3)[_0x40bd('0x2d')](function(){_0x5be374=path[_0x40bd('0x3c')](__dirname,_0x40bd('0x29'),rs[_0x40bd('0x2a')](0x4)+'.wav');return convertFile(_0x2a58b3,_0x5be374);})[_0x40bd('0x2d')](function(){try{fs['unlink'](_0x2a58b3);fs[_0x40bd('0x2e')](_0x5be374,_0x40bd('0x2f'));}catch(_0x378f84){logger[_0x40bd('0x1e')](_0x378f84);}return _0x5be374[_0x40bd('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0x18f8dc,_0x5c3ef6,_0x2e6a64,_0x1a4bf7){var _0x38dd5f=util[_0x40bd('0x79')](_0x40bd('0x7b'),ISPEECH_API,_0x5c3ef6,_0x2e6a64,base64Encode(_0x18f8dc),_0x1a4bf7?util[_0x40bd('0x79')](_0x40bd('0x7c'),encodeURIComponent(_0x1a4bf7)):'freeform=3');return uploadFile(_0x38dd5f)[_0x40bd('0x2d')](function(_0x357506){return querystring['parse'](_0x357506);});};exports['sestekNDA']=function(_0x145377,_0x584098){return sestek['nda'](_0x145377,_0x584098)[_0x40bd('0x2d')](function(_0x2fc37f){logger[_0x40bd('0x1c')](JSON[_0x40bd('0x45')](_0x2fc37f));var _0x36581d={'speech':_0x2fc37f[_0x40bd('0x7d')],'action':_0x2fc37f[_0x40bd('0x7e')]?_0x2fc37f[_0x40bd('0x7e')][_0x40bd('0x7f')]:undefined,'actiondata':_0x2fc37f[_0x40bd('0x7e')]?_0x2fc37f['channelData']['CustomActionData']:undefined};if(_0x2fc37f['channelData']&&_0x2fc37f[_0x40bd('0x7e')][_0x40bd('0x80')]){return base64Decode(_0x2fc37f[_0x40bd('0x7e')]['AudioFromTts'][_0x40bd('0x81')],path[_0x40bd('0x3c')](__dirname,'tmp',rs['generate'](0x4)+_0x40bd('0x2b')))[_0x40bd('0x2d')](function(_0x18c55f){_0x36581d[_0x40bd('0x82')]=_0x18c55f;return _0x36581d;});}return _0x36581d;});};exports[_0x40bd('0x83')]=function(){return __dirname;}; \ No newline at end of file +var _0x9efb=['stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','data','goggleTTS\x20path','googleASR','asr','uri','map','alternatives','transcript','results','join','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','source','result','resolvedQuery','action','fulfillment','speech','score','status','code','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','bluebird','dialogflow','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','../../../config/logger','agi','https:','host','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','unlink','pipe','end','protocol','WHAT_EVER','wav','error\x20convert','finish\x20to\x20convert','start','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','POST','resolve','.mp3','writeFile','generate','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded'];(function(_0x360e5c,_0x1d60de){var _0x3629ea=function(_0x3f12b6){while(--_0x3f12b6){_0x360e5c['push'](_0x360e5c['shift']());}};_0x3629ea(++_0x1d60de);}(_0x9efb,0xc2));var _0xb9ef=function(_0x36ba05,_0x37dac7){_0x36ba05=_0x36ba05-0x0;var _0x3b13ea=_0x9efb[_0x36ba05];return _0x3b13ea;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xb9ef('0x0'));var dialogflow=require(_0xb9ef('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xb9ef('0x2'));var path=require(_0xb9ef('0x3'));var querystring=require(_0xb9ef('0x4'));var rp=require('request-promise');var rs=require(_0xb9ef('0x5'));var sox=require(_0xb9ef('0x6'));var tts=require(_0xb9ef('0x7'));var urlParse=require(_0xb9ef('0x8'))[_0xb9ef('0x9')];var util=require(_0xb9ef('0xa'));var aws=require('./aws');var google=require(_0xb9ef('0xb'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0xb9ef('0xc'))(_0xb9ef('0xd'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x472d84,_0x308843){return new BPromise(function(_0x39322b,_0x3ff05d){var _0x5db896=urlParse(_0x472d84);var _0x486cd9=_0x5db896['protocol']===_0xb9ef('0xe')?https:http;var _0x3a7959={'host':_0x5db896[_0xb9ef('0xf')],'path':_0x5db896['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x486cd9[_0xb9ef('0x10')](_0x3a7959,function(_0x4dac9e){if(_0x4dac9e['statusCode']!==0xc8){logger[_0xb9ef('0x11')](_0xb9ef('0x12')+_0x472d84+'\x20failed,\x20status\x20code\x20=\x20'+_0x4dac9e[_0xb9ef('0x13')]+'\x20('+_0x4dac9e[_0xb9ef('0x14')]+')');_0x3ff05d(new Error(_0xb9ef('0x12')+_0x472d84+_0xb9ef('0x15')+_0x4dac9e[_0xb9ef('0x13')]+'\x20('+_0x4dac9e['statusMessage']+')'));return;}var _0xa36545=fs[_0xb9ef('0x16')](_0x308843);_0xa36545['on'](_0xb9ef('0x17'),function(){logger[_0xb9ef('0x18')]('finish\x20download\x20file');_0xa36545[_0xb9ef('0x19')](_0x39322b);});_0xa36545['on'](_0xb9ef('0x11'),function(_0x321614){fs[_0xb9ef('0x1a')](_0x308843);logger['error']('download\x20error',_0x321614);_0x3ff05d(_0x321614);});_0x4dac9e[_0xb9ef('0x1b')](_0xa36545);})['on'](_0xb9ef('0x11'),function(_0x5afc0e){logger[_0xb9ef('0x11')](_0x5afc0e);_0x3ff05d(_0x5afc0e);})[_0xb9ef('0x1c')]();});}function uploadFile(_0x5ecc9f){return new BPromise(function(_0x365027,_0x129a7a){var _0xa98b3c=urlParse(_0x5ecc9f);var _0x19efc6=_0xa98b3c[_0xb9ef('0x1d')]===_0xb9ef('0xe')?https:http;var _0x5af6bb={'host':_0xa98b3c[_0xb9ef('0xf')],'path':_0xa98b3c[_0xb9ef('0x3')],'headers':{'user-agent':_0xb9ef('0x1e')}};_0x19efc6[_0xb9ef('0x10')](_0x5af6bb,function(_0x2e08a6){if(_0x2e08a6[_0xb9ef('0x13')]!==0xc8){_0x129a7a(new Error(_0xb9ef('0x12')+_0x5ecc9f+'\x20failed,\x20status\x20code\x20=\x20'+_0x2e08a6[_0xb9ef('0x13')]+'\x20('+_0x2e08a6[_0xb9ef('0x14')]+')'));return;}var _0x5f233d='';_0x2e08a6['on']('data',function(_0x4a06b2){_0x5f233d+=_0x4a06b2;});_0x2e08a6['on'](_0xb9ef('0x1c'),function(){_0x365027(_0x5f233d);});})['on'](_0xb9ef('0x11'),function(_0x42e028){_0x129a7a(_0x42e028);})[_0xb9ef('0x1c')]();});}function convertFile(_0x417be3,_0x53ff47){return new BPromise(function(_0x145d34,_0x33be4f){var _0xf6eab1=sox['transcode'](_0x417be3,_0x53ff47,{'sampleRate':0x1f40,'format':_0xb9ef('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf6eab1['on'](_0xb9ef('0x11'),function(_0x516b94){logger['error'](_0xb9ef('0x20'),_0x516b94);_0x33be4f(_0x516b94);});_0xf6eab1['on'](_0xb9ef('0x1c'),function(){logger[_0xb9ef('0x18')](_0xb9ef('0x21'));_0x145d34();});_0xf6eab1[_0xb9ef('0x22')]();});}function base64Decode(_0x48eaea,_0x414af6){var _0x42bd1f=path['resolve'](__dirname,_0xb9ef('0x23'),rs['generate'](0x4)+_0xb9ef('0x24'));fs[_0xb9ef('0x25')](_0x42bd1f,_0x48eaea,_0xb9ef('0x26'));return convertFile(_0x42bd1f,_0x414af6)[_0xb9ef('0x27')](function(){try{fs[_0xb9ef('0x1a')](_0x42bd1f);fs[_0xb9ef('0x28')](_0x414af6,_0xb9ef('0x29'));}catch(_0x599f2a){logger[_0xb9ef('0x11')](_0x599f2a);}return _0x414af6[_0xb9ef('0x2a')]('.')[0x0];});}function base64Encode(_0x1b47e4){var _0x4c7e3f=fs['readFileSync'](_0x1b47e4);return new Buffer(_0x4c7e3f)['toString'](_0xb9ef('0x26'));}exports[_0xb9ef('0x2b')]=function(_0x1f6122,_0x2948b4,_0x573de3,_0xdf2fb5,_0x2c5843,_0x2641ae){var _0x41eb77,_0x567930;var _0x65439a=_0xb9ef('0x2c');var _0x44aafa=_0xb9ef('0x2d')+_0x1f6122;var _0x5d2cdb={};if(_0x2948b4===_0xb9ef('0x2e')){_0x5d2cdb[_0xb9ef('0x2f')]={'ssml':_0x573de3};}else{_0x5d2cdb[_0xb9ef('0x2f')]={'text':_0x573de3};};_0x5d2cdb['voice']={'languageCode':_0xdf2fb5,'ssmlGender':_0x2c5843};_0x5d2cdb['audioConfig']={'audioEncoding':_0xb9ef('0x30'),'sampleRateHertz':0x1f40};var _0x1066e0={'url':_0x65439a+_0xb9ef('0x31')+_0x44aafa,'method':_0xb9ef('0x32'),'json':!![],'body':_0x5d2cdb};return rp(_0x1066e0)[_0xb9ef('0x27')](function(_0x3093c6){return new BPromise(function(_0x30b4f4,_0x13a674){_0x41eb77=path[_0xb9ef('0x33')](__dirname,_0xb9ef('0x23'),rs['generate'](0x4)+_0xb9ef('0x34'));var _0x18b1f6=Buffer['from'](_0x3093c6['audioContent'],_0xb9ef('0x26'));return fs[_0xb9ef('0x35')](_0x41eb77,_0x18b1f6,function(_0x2c4ba3){_0x13a674(_0x2c4ba3);},function(_0x575e3a){fs[_0xb9ef('0x28')](_0x41eb77,_0xb9ef('0x29'));_0x30b4f4(_0x575e3a);});});})['then'](function(_0x23ab8a){_0x567930=path['resolve'](__dirname,_0xb9ef('0x23'),rs[_0xb9ef('0x36')](0x4)+_0xb9ef('0x24'));return convertFile(_0x41eb77,_0x567930);})[_0xb9ef('0x27')](function(){try{fs[_0xb9ef('0x1a')](_0x41eb77);fs[_0xb9ef('0x28')](_0x567930,'777');}catch(_0x5c0f68){logger[_0xb9ef('0x11')](_0x5c0f68);}logger[_0xb9ef('0x18')](_0xb9ef('0x37'),_0x567930[_0xb9ef('0x2a')]('.')[0x0]);return _0x567930[_0xb9ef('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x512472,_0xe6af02){var _0x300195=_0xb9ef('0x38');var _0xa9e41c,_0x1f6c15;var _0x99b91f;var _0x1c13b6={'encoding':'utf8','method':_0xb9ef('0x32'),'timeout':0x2710,'url':_0x300195,'headers':{'Content-Type':_0xb9ef('0x39')},'body':'f.req='+encodeURIComponent(JSON[_0xb9ef('0x3a')]([[['jQ1olc',JSON['stringify']([_0x512472,_0xe6af02||'en',![],_0xb9ef('0x3b')]),null,_0xb9ef('0x3c')]]]))};return rp(_0x1c13b6)[_0xb9ef('0x27')](function(_0x52631c){try{_0x99b91f=eval(_0x52631c[_0xb9ef('0x3d')](0x5))[0x0][0x2];}catch(_0x2daf0e){throw new Error(_0xb9ef('0x3e')+_0x52631c['data']);}if(!_0x99b91f){if(_0x512472[_0xb9ef('0x3f')]>0xc8){throw new Error(_0xb9ef('0x40'));}else{throw new Error(_0xb9ef('0x41')+_0xe6af02+'\x22\x20might\x20not\x20exist');}}try{_0x99b91f=eval(_0x99b91f)[0x0];}catch(_0x477a6f){throw new Error(_0xb9ef('0x3e')+res[_0xb9ef('0x42')]);}const _0x1e4f4f=_0x99b91f;_0xa9e41c=path[_0xb9ef('0x33')](__dirname,_0xb9ef('0x23'),rs[_0xb9ef('0x36')](0x4)+_0xb9ef('0x34'));fs[_0xb9ef('0x25')](_0xa9e41c,_0x99b91f,{'encoding':_0xb9ef('0x26')});_0x1f6c15=path[_0xb9ef('0x33')](__dirname,'tmp',rs[_0xb9ef('0x36')](0x4)+_0xb9ef('0x24'));return convertFile(_0xa9e41c,_0x1f6c15);})[_0xb9ef('0x27')](function(){try{fs[_0xb9ef('0x1a')](_0xa9e41c);fs[_0xb9ef('0x28')](_0x1f6c15,_0xb9ef('0x29'));}catch(_0x379058){logger['error'](_0x379058);}logger[_0xb9ef('0x18')](_0xb9ef('0x43'),_0x1f6c15[_0xb9ef('0x2a')]('.')[0x0]);return _0x1f6c15[_0xb9ef('0x2a')]('.')[0x0];});};exports[_0xb9ef('0x44')]=function(_0x170a09,_0x297b2d,_0x3c9c66){return google[_0xb9ef('0x45')](_0x170a09,_0x297b2d,_0x3c9c66)[_0xb9ef('0x27')](function(_0x281660){logger['info'](_0x281660[_0xb9ef('0x46')]);return rp(_0x281660);})['then'](function(_0xbc751d){var _0x3ade51='';var _0x357586=0x0;try{fs[_0xb9ef('0x1a')](_0x170a09);}catch(_0xce653f){logger[_0xb9ef('0x11')](_0xce653f);}if(_0xbc751d&&_0xbc751d['results']){_0x3ade51=_0xbc751d['results'][_0xb9ef('0x47')](function(_0xdc40c5){return _0xdc40c5&&_0xdc40c5['alternatives'][0x0]&&_0xdc40c5[_0xb9ef('0x48')][0x0][_0xb9ef('0x49')]?_0xdc40c5[_0xb9ef('0x48')][0x0][_0xb9ef('0x49')]:'';})['join']('\x0a');_0x357586=_0xbc751d[_0xb9ef('0x4a')][_0xb9ef('0x47')](function(_0x32342d){return _0x32342d&&_0x32342d[_0xb9ef('0x48')][0x0]&&_0x32342d[_0xb9ef('0x48')][0x0]['confidence']?_0x32342d['alternatives'][0x0]['confidence']:0x0;})[_0xb9ef('0x4b')]('\x0a');}logger[_0xb9ef('0x18')]('googleASR\x20transcription',_0x3ade51);logger['info'](_0xb9ef('0x4c'),_0x357586);return{'transcript':_0x3ade51,'confidence':_0x357586};})[_0xb9ef('0x4d')](function(_0xf8da06){logger[_0xb9ef('0x11')](_0xb9ef('0x4e'),_0xf8da06[_0xb9ef('0x13')],_0xf8da06[_0xb9ef('0x4f')],_0xf8da06[_0xb9ef('0x50')]);});};exports['googleDialogflow']=function(_0x531a82,_0x46f235,_0x632f2e,_0x2f776f){var _0x4be72f=apiai(_0x46f235,{'language':_0x2f776f||'en'});return _0x4be72f[_0xb9ef('0x51')](_0x632f2e,{'sessionId':md5(_0x531a82)})['then'](function(_0x3e01e5){logger['info'](JSON[_0xb9ef('0x3a')](_0x3e01e5));return{'source':_0x3e01e5['result'][_0xb9ef('0x52')],'resolvedQuery':_0x3e01e5[_0xb9ef('0x53')][_0xb9ef('0x54')],'action':_0x3e01e5[_0xb9ef('0x53')][_0xb9ef('0x55')],'actionIncomplete':_0x3e01e5['result']['actionIncomplete'],'speech':_0x3e01e5[_0xb9ef('0x53')][_0xb9ef('0x56')][_0xb9ef('0x57')],'score':_0x3e01e5['result'][_0xb9ef('0x58')],'statusCode':_0x3e01e5[_0xb9ef('0x59')][_0xb9ef('0x5a')],'endConversation':_0x3e01e5[_0xb9ef('0x53')]['metadata']['endConversation']||![],'isFallbackIntent':_0x3e01e5[_0xb9ef('0x53')][_0xb9ef('0x5b')]['isFallbackIntent']};});};exports[_0xb9ef('0x5c')]=function(_0x339f06,_0x21f7db,_0x553521,_0x4dc61b,_0x3214e5,_0x1995b2){var _0x2c285e=_0x4dc61b[_0xb9ef('0x5d')](/\\n/g,'\x0a');var _0x3d9eb7={'credentials':{'private_key':_0x2c285e,'client_email':_0x553521}};var _0x361ed6=new dialogflow[(_0xb9ef('0x5e'))](_0x3d9eb7);var _0x3fd389=_0x361ed6[_0xb9ef('0x5f')](_0x21f7db,md5(_0x339f06));var _0x228e06={'session':_0x3fd389,'queryInput':{'text':{'text':_0x3214e5,'languageCode':_0x1995b2}}};return _0x361ed6[_0xb9ef('0x60')](_0x228e06)[_0xb9ef('0x27')](function(_0x1ecb68){if(_0x1ecb68&&_0x1ecb68[_0xb9ef('0x3f')]){logger[_0xb9ef('0x18')](_0xb9ef('0x61'),JSON[_0xb9ef('0x3a')](_0x1ecb68));var _0xf1eee9=_0x1ecb68[0x0];if(_0xf1eee9){var _0x52aabc={'action':_0xf1eee9[_0xb9ef('0x62')][_0xb9ef('0x55')],'allRequiredParamsPresent':_0xf1eee9['queryResult'][_0xb9ef('0x63')],'endConversation':_0xf1eee9[_0xb9ef('0x62')]['diagnosticInfo']&&_0xf1eee9[_0xb9ef('0x62')][_0xb9ef('0x64')][_0xb9ef('0x65')]?_0xf1eee9[_0xb9ef('0x62')][_0xb9ef('0x64')][_0xb9ef('0x65')][_0xb9ef('0x66')]['boolValue']:![],'fulfillmentText':_0xf1eee9[_0xb9ef('0x62')][_0xb9ef('0x67')],'intentName':_0xf1eee9[_0xb9ef('0x62')][_0xb9ef('0x68')][_0xb9ef('0x4f')],'intentDisplayName':_0xf1eee9[_0xb9ef('0x62')][_0xb9ef('0x68')]['displayName'],'isFallbackIntent':_0xf1eee9[_0xb9ef('0x62')][_0xb9ef('0x68')]['isFallback'],'languageCode':_0xf1eee9['queryResult'][_0xb9ef('0x69')],'queryText':_0xf1eee9[_0xb9ef('0x62')]['queryText'],'responseId':_0xf1eee9[_0xb9ef('0x6a')],'score':_0xf1eee9['queryResult']['intentDetectionConfidence'],'speech':_0xf1eee9[_0xb9ef('0x62')][_0xb9ef('0x67')],'providerResponse':JSON[_0xb9ef('0x3a')](_0x1ecb68)};return _0x52aabc;}}});};exports[_0xb9ef('0x6b')]=function(_0x219e38,_0x51ac54,_0x45226c,_0x5d7ac0){return tilde[_0xb9ef('0x45')](_0x219e38,_0x51ac54,_0x45226c,_0x5d7ac0)[_0xb9ef('0x27')](function(_0x11d726){try{fs[_0xb9ef('0x1a')](_0x219e38);}catch(_0x1fe812){logger[_0xb9ef('0x11')](_0x1fe812);}logger[_0xb9ef('0x18')](_0xb9ef('0x6c'),_0x11d726['transcript']);logger['info'](_0xb9ef('0x6d'),_0x11d726['confidence']);return _0x11d726;});};exports['awsPolly']=function(_0x106c88,_0x1b6739,_0x4d0136,_0x339bce,_0x45cc4b,_0x29a2c9){var _0xf4b7d=path['resolve'](__dirname,_0xb9ef('0x23'),rs[_0xb9ef('0x36')](0x4)+_0xb9ef('0x34'));var _0x10c370;return aws[_0xb9ef('0x6e')](_0x106c88,_0x1b6739,_0x4d0136,_0x339bce,_0x45cc4b,_0x29a2c9,_0xf4b7d)[_0xb9ef('0x27')](function(){_0x10c370=path[_0xb9ef('0x33')](__dirname,'tmp',rs[_0xb9ef('0x36')](0x4)+_0xb9ef('0x24'));return convertFile(_0xf4b7d,_0x10c370);})[_0xb9ef('0x27')](function(){try{fs['unlink'](_0xf4b7d);fs['chmodSync'](_0x10c370,_0xb9ef('0x29'));}catch(_0x2e52af){logger[_0xb9ef('0x11')](_0x2e52af);}return _0x10c370[_0xb9ef('0x2a')]('.')[0x0];});};exports['awsLex']=function(_0x4c1567,_0x489f85,_0x3f45bd,_0x4647d1,_0x31830d,_0x586e0c){return aws[_0xb9ef('0x6f')](_0x4c1567,_0x489f85,_0x3f45bd,_0x4647d1,_0x31830d,_0x586e0c)[_0xb9ef('0x27')](function(_0x5e7fd8){logger[_0xb9ef('0x18')](JSON[_0xb9ef('0x3a')](_0x5e7fd8));return _0x5e7fd8;});};exports[_0xb9ef('0x70')]=function(_0x700e0e,_0x43ed8e,_0x2a54f8,_0x4fe29f){var _0x5ee946=util[_0xb9ef('0x71')](_0xb9ef('0x72'),ISPEECH_API,_0x700e0e,encodeURIComponent(_0x43ed8e),_0x2a54f8,_0x4fe29f);var _0x2418c8=path[_0xb9ef('0x33')](__dirname,_0xb9ef('0x23'),rs[_0xb9ef('0x36')](0x4)+_0xb9ef('0x34'));var _0x4224d0;return downloadFile(_0x5ee946,_0x2418c8)[_0xb9ef('0x27')](function(){_0x4224d0=path[_0xb9ef('0x33')](__dirname,_0xb9ef('0x23'),rs[_0xb9ef('0x36')](0x4)+'.wav');return convertFile(_0x2418c8,_0x4224d0);})[_0xb9ef('0x27')](function(){try{fs[_0xb9ef('0x1a')](_0x2418c8);fs[_0xb9ef('0x28')](_0x4224d0,_0xb9ef('0x29'));}catch(_0x3a759d){logger[_0xb9ef('0x11')](_0x3a759d);}return _0x4224d0[_0xb9ef('0x2a')]('.')[0x0];});};exports[_0xb9ef('0x73')]=function(_0x3ae964,_0x3dd865,_0x5e2fbb,_0xc52f7d){var _0x49cc5a=util['format'](_0xb9ef('0x74'),ISPEECH_API,_0x3dd865,_0x5e2fbb,base64Encode(_0x3ae964),_0xc52f7d?util[_0xb9ef('0x71')](_0xb9ef('0x75'),encodeURIComponent(_0xc52f7d)):_0xb9ef('0x76'));return uploadFile(_0x49cc5a)['then'](function(_0x448893){return querystring['parse'](_0x448893);});};exports['sestekNDA']=function(_0x28dd82,_0x5b56b2){return sestek[_0xb9ef('0x77')](_0x28dd82,_0x5b56b2)[_0xb9ef('0x27')](function(_0x317d8c){logger[_0xb9ef('0x18')](JSON[_0xb9ef('0x3a')](_0x317d8c));var _0x490545={'speech':_0x317d8c['text'],'action':_0x317d8c[_0xb9ef('0x78')]?_0x317d8c['channelData'][_0xb9ef('0x79')]:undefined,'actiondata':_0x317d8c['channelData']?_0x317d8c['channelData'][_0xb9ef('0x7a')]:undefined};if(_0x317d8c['channelData']&&_0x317d8c[_0xb9ef('0x78')][_0xb9ef('0x7b')]){return base64Decode(_0x317d8c['channelData'][_0xb9ef('0x7b')][_0xb9ef('0x7c')],path[_0xb9ef('0x33')](__dirname,'tmp',rs[_0xb9ef('0x36')](0x4)+_0xb9ef('0x24')))[_0xb9ef('0x27')](function(_0x26b19b){_0x490545[_0xb9ef('0x7d')]=_0x26b19b;return _0x490545;});}return _0x490545;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index ae424aa..f4ecb0a 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 _0x6b9f=['./nda'];(function(_0x2d418e,_0x52870d){var _0x10809b=function(_0x524b1f){while(--_0x524b1f){_0x2d418e['push'](_0x2d418e['shift']());}};_0x10809b(++_0x52870d);}(_0x6b9f,0x1ab));var _0xf6b9=function(_0x41a305,_0xedef37){_0x41a305=_0x41a305-0x0;var _0x464783=_0x6b9f[_0x41a305];return _0x464783;};var nda=require(_0xf6b9('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xe774=['exports','./nda'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xe774,0x1cf));var _0x4e77=function(_0x8236a5,_0x498576){_0x8236a5=_0x8236a5-0x0;var _0x24dd0e=_0xe774[_0x8236a5];return _0x24dd0e;};var nda=require(_0x4e77('0x0'));module[_0x4e77('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 c05df1d..f2d1f37 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 _0xa74f=['ndaactivity_type','message','uniqueid','callerid','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','../../../../../config/logger','POST','ndauth_url','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x5cd054,_0x2d3b5d){var _0x5a9331=function(_0x2b2a0b){while(--_0x2b2a0b){_0x5cd054['push'](_0x5cd054['shift']());}};_0x5a9331(++_0x2d3b5d);}(_0xa74f,0x9a));var _0xfa74=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xa74f[_0x22e9fe];return _0x47cd19;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xfa74('0x0'))('agi');module['exports']=function(_0x29e4c8,_0x110824){var _0x394a1e={'method':_0xfa74('0x1'),'uri':url['resolve'](_0x110824[_0xfa74('0x2')],'/token'),'form':{'grant_type':'password','username':_0x110824[_0xfa74('0x3')],'password':_0x110824[_0xfa74('0x4')]},'json':!![]};return rp(_0x394a1e)[_0xfa74('0x5')](function(_0x2d9fa9){var _0x287921={'method':_0xfa74('0x1'),'uri':url['resolve'](_0x110824[_0xfa74('0x6')],_0xfa74('0x7')),'body':{'type':_0x110824[_0xfa74('0x8')]||_0xfa74('0x9'),'channelId':'Nda','conversation':{'id':_0x29e4c8[_0xfa74('0xa')]},'from':{'id':_0x29e4c8[_0xfa74('0xb')],'name':_0x29e4c8['calleridname']},'recipient':{'id':_0x29e4c8[_0xfa74('0xc')],'name':_0x29e4c8[_0xfa74('0xd')]},'text':_0x110824[_0xfa74('0xe')],'channelData':{}},'headers':{'Authorization':_0xfa74('0xf')+_0x2d9fa9['access_token']},'json':!![]};if(_0x110824[_0xfa74('0x10')]){_0x287921[_0xfa74('0x11')][_0xfa74('0x12')][_0xfa74('0x13')]=_0x110824['project'];}if(_0x110824[_0xfa74('0x14')]=='1'){_0x287921[_0xfa74('0x11')][_0xfa74('0x12')][_0xfa74('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xfa74('0x16')};}if(_0x110824['custom_action']){_0x287921[_0xfa74('0x11')][_0xfa74('0x12')][_0xfa74('0x17')]=_0x110824[_0xfa74('0x18')];if(_0x110824[_0xfa74('0x19')]){_0x287921[_0xfa74('0x11')][_0xfa74('0x12')]['CustomActionData']=_0x110824[_0xfa74('0x19')];}}logger[_0xfa74('0x1a')](JSON['stringify'](_0x287921));return rp(_0x287921);});}; \ No newline at end of file +var _0xd61e=['ndagenerate_audio','audio/wav','custom_action','custom_action_data','info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','dnid','project','body','channelData','ProjectName'];(function(_0x38b0f2,_0x23b2b9){var _0x2ee050=function(_0x2416ba){while(--_0x2416ba){_0x38b0f2['push'](_0x38b0f2['shift']());}};_0x2ee050(++_0x23b2b9);}(_0xd61e,0x13d));var _0xed61=function(_0x15b125,_0x28cced){_0x15b125=_0x15b125-0x0;var _0x2bb0e7=_0xd61e[_0x15b125];return _0x2bb0e7;};'use strict';var rp=require(_0xed61('0x0'));var url=require(_0xed61('0x1'));var logger=require(_0xed61('0x2'))(_0xed61('0x3'));module[_0xed61('0x4')]=function(_0x22d436,_0x5ae3f8){var _0x123e01={'method':_0xed61('0x5'),'uri':url[_0xed61('0x6')](_0x5ae3f8[_0xed61('0x7')],_0xed61('0x8')),'form':{'grant_type':_0xed61('0x9'),'username':_0x5ae3f8[_0xed61('0xa')],'password':_0x5ae3f8['password']},'json':!![]};return rp(_0x123e01)['then'](function(_0x59ef0e){var _0x5cbbd7={'method':'POST','uri':url[_0xed61('0x6')](_0x5ae3f8[_0xed61('0xb')],_0xed61('0xc')),'body':{'type':_0x5ae3f8[_0xed61('0xd')]||_0xed61('0xe'),'channelId':'Nda','conversation':{'id':_0x22d436['uniqueid']},'from':{'id':_0x22d436['callerid'],'name':_0x22d436[_0xed61('0xf')]},'recipient':{'id':_0x22d436[_0xed61('0x10')],'name':_0x22d436['extension']},'text':_0x5ae3f8['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x59ef0e['access_token']},'json':!![]};if(_0x5ae3f8[_0xed61('0x11')]){_0x5cbbd7[_0xed61('0x12')][_0xed61('0x13')][_0xed61('0x14')]=_0x5ae3f8['project'];}if(_0x5ae3f8[_0xed61('0x15')]=='1'){_0x5cbbd7[_0xed61('0x12')][_0xed61('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xed61('0x16')};}if(_0x5ae3f8[_0xed61('0x17')]){_0x5cbbd7[_0xed61('0x12')][_0xed61('0x13')]['CustomAction']=_0x5ae3f8[_0xed61('0x17')];if(_0x5ae3f8[_0xed61('0x18')]){_0x5cbbd7[_0xed61('0x12')][_0xed61('0x13')]['CustomActionData']=_0x5ae3f8[_0xed61('0x18')];}}logger[_0xed61('0x19')](JSON['stringify'](_0x5cbbd7));return rp(_0x5cbbd7);});}; \ 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 334f801..bea7971 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 _0xc27c=['./lib/api','exports'];(function(_0x23e785,_0x66b427){var _0x3f0686=function(_0x1d5f41){while(--_0x1d5f41){_0x23e785['push'](_0x23e785['shift']());}};_0x3f0686(++_0x66b427);}(_0xc27c,0x10a));var _0xcc27=function(_0x6c4a38,_0x160674){_0x6c4a38=_0x6c4a38-0x0;var _0x241fa3=_0xc27c[_0x6c4a38];return _0x241fa3;};'use strict';var asr=require(_0xcc27('0x0'));module[_0xcc27('0x1')]=function(_0x2a853b,_0x147878,_0x27d1f8,_0x2d2eb9){return asr(_0x2a853b,_0x147878,_0x27d1f8,_0x2d2eb9);}; \ No newline at end of file +var _0xa4f7=['exports','./lib/api'];(function(_0x3940a4,_0x1c8384){var _0x1ff779=function(_0x22ebda){while(--_0x22ebda){_0x3940a4['push'](_0x3940a4['shift']());}};_0x1ff779(++_0x1c8384);}(_0xa4f7,0x97));var _0x7a4f=function(_0x5dbd3e,_0x4a6f27){_0x5dbd3e=_0x5dbd3e-0x0;var _0xf90b98=_0xa4f7[_0x5dbd3e];return _0xf90b98;};'use strict';var asr=require(_0x7a4f('0x0'));module[_0x7a4f('0x1')]=function(_0xc5c348,_0xb7d750,_0x311fac,_0x2b735f){return asr(_0xc5c348,_0xb7d750,_0x311fac,_0x2b735f);}; \ 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 47fc7d8..688e2bc 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 _0x283f=['hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest'];(function(_0x4a808a,_0xff4d3b){var _0x3e8438=function(_0x4a8b61){while(--_0x4a8b61){_0x4a808a['push'](_0x4a808a['shift']());}};_0x3e8438(++_0xff4d3b);}(_0x283f,0x10b));var _0xf283=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x283f[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var _=require(_0xf283('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf283('0x1'));var crypto=require(_0xf283('0x2'));var logger=require(_0xf283('0x3'))(_0xf283('0x4'));module[_0xf283('0x5')]=function(_0xb921d,_0x593ae9,_0x3a1558,_0x17b0ba){return new BPromise(function(_0x462fe0,_0x5948f8){logger[_0xf283('0x6')](_0xf283('0x7'),_0x17b0ba||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x34c31d=new WebSocket(_0x17b0ba||_0xf283('0x8'),{'perMessageDeflate':![]});var _0x597a86='';var _0x5b20c8='0';var _0x2d394a='1';var _0x457544=_0xf283('0x9');function _0x3522cf(_0x5974a5){var _0x417ac8=crypto[_0xf283('0xa')](_0xf283('0xb'));_0x417ac8['update'](_0x5974a5);return _0x417ac8[_0xf283('0xc')](_0xf283('0xd'));}function _0x3740c5(){try{logger['info'](_0xf283('0xe'));var _0x3061e2=moment()[_0xf283('0xf')]();var _0x5a1783=_0x3522cf(_0x3061e2+_0x593ae9+_0x3a1558);_0x34c31d[_0xf283('0x10')](JSON[_0xf283('0x11')]({'appID':_0x593ae9,'timestamp':_0x3061e2,'appKey':_0x5a1783}));var _0x360ea0=fs['createReadStream'](_0xb921d);_0x360ea0['on'](_0xf283('0x12'),function(_0x3dadb2){_0x34c31d['send'](_0x3dadb2);});_0x360ea0['on'](_0xf283('0x13'),function(){_0x34c31d['send']('EOS');});}catch(_0x328545){logger[_0xf283('0x14')](_0xf283('0x15'),JSON[_0xf283('0x11')](_0x328545));_0x34c31d[_0xf283('0x16')]();}}function _0x15125b(_0x3c1ea5){try{if(_0x3c1ea5){var _0x3ee438=JSON[_0xf283('0x17')](_0x3c1ea5);switch(_0x3ee438[_0xf283('0x18')]){case 0x0:if(_0x3ee438[_0xf283('0x19')]){if(_0x3ee438['result'][_0xf283('0x1a')]){logger[_0xf283('0x6')](_0xf283('0x1b'),JSON[_0xf283('0x11')](_0x3ee438['result'][_0xf283('0x1c')]));_0x597a86=_0x3ee438[_0xf283('0x19')]['hypotheses'][0x0][_0xf283('0x1d')];_0x5b20c8=_0x3ee438[_0xf283('0x19')][_0xf283('0x1c')][0x0][_0xf283('0x1e')];_0x2d394a='0';_0x457544=_0xf283('0x1f');_0x34c31d['terminate']();}}break;case 0x1:logger[_0xf283('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2d394a='1';_0x457544=_0xf283('0x9');break;case 0x2:logger[_0xf283('0x6')](_0xf283('0x20'));_0x2d394a='2';_0x457544='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xf283('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2d394a='9';_0x457544='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xf283('0x6')](_0xf283('0x21'));_0x2d394a='10';_0x457544=_0xf283('0x21');break;case 0xb:logger[_0xf283('0x6')](_0xf283('0x22'));_0x2d394a='11';_0x457544=_0xf283('0x22');}}}catch(_0xd91750){logger[_0xf283('0x14')](_0xf283('0x23'),JSON[_0xf283('0x11')](_0xd91750));_0x34c31d[_0xf283('0x16')]();}}function _0x14a339(){logger[_0xf283('0x6')](_0xf283('0x24'));_0x462fe0({'transcript':_0x597a86,'confidence':_0x5b20c8,'status':_0x2d394a,'status_message':_0x457544});}function _0x2290c0(_0x4b1285){logger[_0xf283('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xf283('0x25')](_0x4b1285)){logger[_0xf283('0x14')](_[_0xf283('0x26')](_0x4b1285)?JSON[_0xf283('0x11')](_0x4b1285):_0x4b1285);}}_0x34c31d['on']('open',_0x3740c5);_0x34c31d['on'](_0xf283('0x27'),_0x15125b);_0x34c31d['on']('close',_0x14a339);_0x34c31d['on']('error',_0x2290c0);});}; \ No newline at end of file +var _0xbc31=['Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','crypto','agi','exports','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error'];(function(_0x2ecebc,_0x2b5690){var _0x430b68=function(_0x469870){while(--_0x469870){_0x2ecebc['push'](_0x2ecebc['shift']());}};_0x430b68(++_0x2b5690);}(_0xbc31,0x12d));var _0x1bc3=function(_0x4319b9,_0x855908){_0x4319b9=_0x4319b9-0x0;var _0x2b03fd=_0xbc31[_0x4319b9];return _0x2b03fd;};'use strict';var BPromise=require(_0x1bc3('0x0'));var _=require(_0x1bc3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x1bc3('0x2'));var logger=require('../../../../../../config/logger')(_0x1bc3('0x3'));module[_0x1bc3('0x4')]=function(_0x3c323b,_0x5e7cc7,_0x410329,_0x14e296){return new BPromise(function(_0x3b51a7,_0x55e30f){logger['info']('Tilde\x20URI',_0x14e296||_0x1bc3('0x5'));var _0xdabb22=new WebSocket(_0x14e296||_0x1bc3('0x5'),{'perMessageDeflate':![]});var _0x115165='';var _0x4ac234='0';var _0x8f9727='1';var _0x15d2cd=_0x1bc3('0x6');function _0x5865c9(_0x495086){var _0x1f804c=crypto[_0x1bc3('0x7')](_0x1bc3('0x8'));_0x1f804c['update'](_0x495086);return _0x1f804c['digest']('hex');}function _0x5c5e6a(){try{logger[_0x1bc3('0x9')](_0x1bc3('0xa'));var _0x5d6d69=moment()[_0x1bc3('0xb')]();var _0x3fe026=_0x5865c9(_0x5d6d69+_0x5e7cc7+_0x410329);_0xdabb22[_0x1bc3('0xc')](JSON[_0x1bc3('0xd')]({'appID':_0x5e7cc7,'timestamp':_0x5d6d69,'appKey':_0x3fe026}));var _0x1acc5b=fs['createReadStream'](_0x3c323b);_0x1acc5b['on'](_0x1bc3('0xe'),function(_0x5d270c){_0xdabb22[_0x1bc3('0xc')](_0x5d270c);});_0x1acc5b['on'](_0x1bc3('0xf'),function(){_0xdabb22[_0x1bc3('0xc')](_0x1bc3('0x10'));});}catch(_0x43abba){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x1bc3('0xd')](_0x43abba));_0xdabb22[_0x1bc3('0x11')]();}}function _0x106568(_0x38b4df){try{if(_0x38b4df){var _0x306d08=JSON['parse'](_0x38b4df);switch(_0x306d08[_0x1bc3('0x12')]){case 0x0:if(_0x306d08[_0x1bc3('0x13')]){if(_0x306d08['result'][_0x1bc3('0x14')]){logger[_0x1bc3('0x9')](_0x1bc3('0x15'),JSON['stringify'](_0x306d08[_0x1bc3('0x13')][_0x1bc3('0x16')]));_0x115165=_0x306d08[_0x1bc3('0x13')][_0x1bc3('0x16')][0x0]['transcript'];_0x4ac234=_0x306d08['result'][_0x1bc3('0x16')][0x0]['likelihood'];_0x8f9727='0';_0x15d2cd=_0x1bc3('0x17');_0xdabb22['terminate']();}}break;case 0x1:logger[_0x1bc3('0x9')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x8f9727='1';_0x15d2cd=_0x1bc3('0x6');break;case 0x2:logger[_0x1bc3('0x9')](_0x1bc3('0x18'));_0x8f9727='2';_0x15d2cd=_0x1bc3('0x18');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x8f9727='9';_0x15d2cd=_0x1bc3('0x19');break;case 0xa:logger[_0x1bc3('0x9')]('Authentication\x20failed.');_0x8f9727='10';_0x15d2cd='Authentication\x20failed.';break;case 0xb:logger[_0x1bc3('0x9')](_0x1bc3('0x1a'));_0x8f9727='11';_0x15d2cd=_0x1bc3('0x1a');}}}catch(_0x35ff48){logger[_0x1bc3('0x1b')](_0x1bc3('0x1c'),JSON[_0x1bc3('0xd')](_0x35ff48));_0xdabb22[_0x1bc3('0x11')]();}}function _0x47b930(){logger[_0x1bc3('0x9')](_0x1bc3('0x1d'));_0x3b51a7({'transcript':_0x115165,'confidence':_0x4ac234,'status':_0x8f9727,'status_message':_0x15d2cd});}function _0x3b976f(_0x1a97fb){logger[_0x1bc3('0x1b')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x1bc3('0x1e')](_0x1a97fb)){logger[_0x1bc3('0x1b')](_[_0x1bc3('0x1f')](_0x1a97fb)?JSON[_0x1bc3('0xd')](_0x1a97fb):_0x1a97fb);}}_0xdabb22['on']('open',_0x5c5e6a);_0xdabb22['on'](_0x1bc3('0x20'),_0x106568);_0xdabb22['on']('close',_0x47b930);_0xdabb22['on'](_0x1bc3('0x1b'),_0x3b976f);});}; \ 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 620d680..7129644 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 _0x4bce=['./asr'];(function(_0x1bfd20,_0x2801a7){var _0x1c3c48=function(_0x93e8e7){while(--_0x93e8e7){_0x1bfd20['push'](_0x1bfd20['shift']());}};_0x1c3c48(++_0x2801a7);}(_0x4bce,0x16c));var _0xe4bc=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x4bce[_0x3792e6];return _0x441e44;};var asr=require(_0xe4bc('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xec0d=['./asr'];(function(_0x204f56,_0x48ab23){var _0x2924a3=function(_0x2b3c77){while(--_0x2b3c77){_0x204f56['push'](_0x204f56['shift']());}};_0x2924a3(++_0x48ab23);}(_0xec0d,0x197));var _0xdec0=function(_0x4a949e,_0xb4a1fb){_0x4a949e=_0x4a949e-0x0;var _0x2bb396=_0xec0d[_0x4a949e];return _0x2bb396;};var asr=require(_0xdec0('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9a55e1e..daaf2b4 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 _0xd512=['ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','events','EventEmitter','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION'];(function(_0x239f93,_0x59d5c6){var _0x449fa8=function(_0x11cef3){while(--_0x11cef3){_0x239f93['push'](_0x239f93['shift']());}};_0x449fa8(++_0x59d5c6);}(_0xd512,0x178));var _0x2d51=function(_0x524773,_0x1e1893){_0x524773=_0x524773-0x0;var _0x196e4f=_0xd512[_0x524773];return _0x196e4f;};'use strict';var util=require('util');var net=require(_0x2d51('0x0'));var EventEmitter=require(_0x2d51('0x1'))[_0x2d51('0x2')];var AGIError=require('./error');var AGIChannel=require('./channel');var AGIServer=function(_0x55bc4b,_0xad8b09,_0x18665f){var _0x4ceebd=this,_0x55bc4b=_0x55bc4b||0x11dd,_0xad8b09=_0xad8b09||_0x2d51('0x3'),_0x565045=null,_0x27658e=0x0;EventEmitter[_0x2d51('0x4')](_0x4ceebd);function _0x304b89(){if(!_0x55bc4b){_0x4ceebd[_0x2d51('0x5')](_0x2d51('0x6'),new AGIError(_0x2d51('0x7')));return![];}_0x565045=net[_0x2d51('0x8')]();_0x565045[_0x2d51('0x9')](_0x55bc4b,_0xad8b09);_0x565045['on'](_0x2d51('0xa'),function(){_0x4ceebd['emit'](_0x2d51('0xa'));});_0x565045['on']('connection',function(_0x5d883f){_0x565045[_0x2d51('0xb')](function(_0x5e12d7,_0x4e14a4){if(_0x5e12d7){_0x4ceebd[_0x2d51('0x5')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x5e12d7));}else if(_0x18665f&&_0x18665f<0x0){_0x4ceebd[_0x2d51('0x5')](_0x2d51('0x6'),new AGIError(_0x2d51('0xc')));_0x5d883f[_0x2d51('0xd')]();}else if(_0x18665f&&_0x18665f>0x0&&_0x18665f<_0x4e14a4){_0x27658e+=0x1;_0x4ceebd['emit'](_0x2d51('0x6'),new AGIError(_0x2d51('0xe'),_0x27658e));_0x5d883f['destroy']();}else{var _0x476fc1=new AGIChannel(_0x5d883f);_0x476fc1['on'](_0x2d51('0xf'),function(){_0x4ceebd[_0x2d51('0x5')](_0x2d51('0x10'),_0x476fc1);});}});});_0x565045['on'](_0x2d51('0x6'),function(_0x2dbf3b){_0x4ceebd['emit'](_0x2d51('0x6'),new AGIError(_0x2d51('0x11'),_0x2dbf3b[_0x2d51('0x12')]));});_0x565045['on'](_0x2d51('0x13'),function(){_0x4ceebd[_0x2d51('0x5')]('close',new AGIError(_0x2d51('0x14')));});}process[_0x2d51('0x15')](function(){_0x304b89();});};util['inherits'](AGIServer,EventEmitter);module[_0x2d51('0x16')]=function(_0x1f5f8d,_0x4ae950,_0x1368ec){return new AGIServer(_0x1f5f8d,_0x4ae950,_0x1368ec);}; \ No newline at end of file +var _0x6eda=['net','events','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listen','emit','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','close','exports','util'];(function(_0x1579ec,_0x40dcf4){var _0x3a3ac4=function(_0x8f3c10){while(--_0x8f3c10){_0x1579ec['push'](_0x1579ec['shift']());}};_0x3a3ac4(++_0x40dcf4);}(_0x6eda,0x68));var _0xa6ed=function(_0x51dd81,_0xf08f7c){_0x51dd81=_0x51dd81-0x0;var _0x433b54=_0x6eda[_0x51dd81];return _0x433b54;};'use strict';var util=require(_0xa6ed('0x0'));var net=require(_0xa6ed('0x1'));var EventEmitter=require(_0xa6ed('0x2'))[_0xa6ed('0x3')];var AGIError=require(_0xa6ed('0x4'));var AGIChannel=require(_0xa6ed('0x5'));var AGIServer=function(_0x17685b,_0x45f3d2,_0x43a82f){var _0x1d7862=this,_0x17685b=_0x17685b||0x11dd,_0x45f3d2=_0x45f3d2||_0xa6ed('0x6'),_0x5b9d75=null,_0x1c0ebf=0x0;EventEmitter[_0xa6ed('0x7')](_0x1d7862);function _0x513315(){if(!_0x17685b){_0x1d7862['emit'](_0xa6ed('0x8'),new AGIError(_0xa6ed('0x9')));return![];}_0x5b9d75=net[_0xa6ed('0xa')]();_0x5b9d75[_0xa6ed('0xb')](_0x17685b,_0x45f3d2);_0x5b9d75['on']('listening',function(){_0x1d7862[_0xa6ed('0xc')]('listening');});_0x5b9d75['on']('connection',function(_0x2020b9){_0x5b9d75['getConnections'](function(_0x4b408b,_0x5f4713){if(_0x4b408b){_0x1d7862['emit'](_0xa6ed('0x8'),new AGIError(_0xa6ed('0xd'),_0x4b408b));}else if(_0x43a82f&&_0x43a82f<0x0){_0x1d7862[_0xa6ed('0xc')](_0xa6ed('0x8'),new AGIError(_0xa6ed('0xe')));_0x2020b9[_0xa6ed('0xf')]();}else if(_0x43a82f&&_0x43a82f>0x0&&_0x43a82f<_0x5f4713){_0x1c0ebf+=0x1;_0x1d7862[_0xa6ed('0xc')](_0xa6ed('0x8'),new AGIError(_0xa6ed('0x10'),_0x1c0ebf));_0x2020b9['destroy']();}else{var _0x5e26ff=new AGIChannel(_0x2020b9);_0x5e26ff['on'](_0xa6ed('0x11'),function(){_0x1d7862[_0xa6ed('0xc')](_0xa6ed('0x12'),_0x5e26ff);});}});});_0x5b9d75['on'](_0xa6ed('0x8'),function(_0x169065){_0x1d7862[_0xa6ed('0xc')](_0xa6ed('0x8'),new AGIError(_0xa6ed('0xd'),_0x169065['code']));});_0x5b9d75['on'](_0xa6ed('0x13'),function(){_0x1d7862[_0xa6ed('0xc')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x513315();});};util['inherits'](AGIServer,EventEmitter);module[_0xa6ed('0x14')]=function(_0x1981b3,_0x34a02b,_0x18017a){return new AGIServer(_0x1981b3,_0x34a02b,_0x18017a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 9945cdf..cff6c1c 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 _0x80c4=['intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','wav','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','Answer','answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','variable_id','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','NOBEEP'];(function(_0x616fb8,_0x177e11){var _0x739e20=function(_0xfe27e9){while(--_0xfe27e9){_0x616fb8['push'](_0x616fb8['shift']());}};_0x739e20(++_0x177e11);}(_0x80c4,0xa3));var _0x480c=function(_0xa3e9a,_0x75d10c){_0xa3e9a=_0xa3e9a-0x0;var _0x57f334=_0x80c4[_0xa3e9a];return _0x57f334;};'use strict';var fs=require('fs');var path=require(_0x480c('0x0'));var util=require('util');var _=require(_0x480c('0x1'));var sh=require(_0x480c('0x2'));var odbc=require(_0x480c('0x3'))();var rs=require(_0x480c('0x4'));var moment=require(_0x480c('0x5'));var Mustache=require(_0x480c('0x6'));var rp=require('request-promise');var logger=require(_0x480c('0x7'))(_0x480c('0x8'));var config=require(_0x480c('0x9'));var scripts=require(_0x480c('0xa'));var FILES_PATH=_0x480c('0xb');var recursiveMapAttributes=[_0x480c('0xc'),_0x480c('0xd')];var verticesWithRetry=[_0x480c('0xe'),_0x480c('0xf'),'getsecretdigits'];var AGIVertices=function(_0x2266fb,_0x2e9de7,_0x292aca){this[_0x480c('0x10')]=_0x2266fb;this[_0x480c('0x11')]=_0x2e9de7;this[_0x480c('0x12')]=_0x292aca;};AGIVertices[_0x480c('0x13')][_0x480c('0x14')]=function(_0x3d4a8b,_0x4deb40){this[_0x480c('0x11')][_0x480c('0x15')](_0x3d4a8b)[_0x480c('0x16')](function(_0x7cccb8){_0x4deb40(null,_0x7cccb8?_0x7cccb8[_0x480c('0x17')]:![]);})[_0x480c('0x18')](function(_0x376da3){_0x4deb40(_0x376da3);});};AGIVertices[_0x480c('0x13')]['getVoiceQueue']=function(_0x42a05a,_0x29613b){this['rpc'][_0x480c('0x19')](_0x42a05a)[_0x480c('0x16')](function(_0x1ff755){_0x29613b(null,_0x1ff755?_0x1ff755['name']:![]);})['catch'](function(_0x445635){_0x29613b(_0x445635);});};AGIVertices[_0x480c('0x13')][_0x480c('0x1a')]=function(_0x14248c,_0x93d6c5){this['rpc']['getSquareProjectById'](_0x14248c)['then'](function(_0xfc8a9f){_0x93d6c5(null,_0xfc8a9f?_0xfc8a9f[_0x480c('0x17')]:![]);})['catch'](function(_0x172103){_0x93d6c5(_0x172103);});};AGIVertices['prototype'][_0x480c('0x1b')]=function(_0x1507d1,_0x41a08a){this['rpc'][_0x480c('0x1c')](_0x1507d1)[_0x480c('0x16')](function(_0x9e5a12){_0x41a08a(null,_0x9e5a12?_0x9e5a12['dsn']:![]);})[_0x480c('0x18')](function(_0x50bb63){_0x41a08a(_0x50bb63);});};AGIVertices[_0x480c('0x13')][_0x480c('0x1d')]=function(_0x5b5a51,_0x3b5bca){this[_0x480c('0x11')][_0x480c('0x1e')](_0x5b5a51)[_0x480c('0x16')](function(_0x5dbf8f){_0x3b5bca(null,_0x5dbf8f?_0x5dbf8f[_0x480c('0x17')]:![]);})[_0x480c('0x18')](function(_0x5288f5){_0x3b5bca(_0x5288f5);});};AGIVertices[_0x480c('0x13')][_0x480c('0x1f')]=function(_0x16ddd6,_0x2b67b8){this[_0x480c('0x11')][_0x480c('0x20')](_0x16ddd6)[_0x480c('0x16')](function(_0x24857e){_0x2b67b8(null,_0x24857e?_0x24857e[_0x480c('0x17')]:![]);})[_0x480c('0x18')](function(_0x1363ef){_0x2b67b8(_0x1363ef);});};AGIVertices['prototype']['getSound']=function(_0x372f96,_0x4eafc7){var _0x5b87e5=this;this['rpc']['getSoundById'](_0x372f96)[_0x480c('0x16')](function(_0x6019aa){_0x4eafc7(null,_0x6019aa?_0x5b87e5[_0x480c('0x21')](_0x6019aa[_0x480c('0x22')]):![]);})['catch'](function(_0x4a54b2){_0x4eafc7(_0x4a54b2);});};AGIVertices['prototype'][_0x480c('0x23')]=function(_0x3eabb3,_0x5c56e5){this[_0x480c('0x11')]['getMailAccountById'](_0x3eabb3)['then'](function(_0x415f68){_0x5c56e5(null,_0x415f68?_0x415f68:![]);})[_0x480c('0x18')](function(_0x3c403b){_0x5c56e5(_0x3c403b);});};AGIVertices[_0x480c('0x13')][_0x480c('0x24')]=function(_0x2fc7ed,_0x20fc3c,_0x440c4a){this['mailRpc']['sendMailMessage'](_0x2fc7ed,_0x20fc3c)[_0x480c('0x16')](function(){_0x440c4a(null);})[_0x480c('0x18')](function(_0x590314){_0x440c4a(_0x590314);});};AGIVertices[_0x480c('0x13')][_0x480c('0x25')]=function(_0x13b7e6,_0x1d287f){this[_0x480c('0x11')][_0x480c('0x26')](_0x13b7e6)[_0x480c('0x16')](function(_0x11034c){if(_0x11034c){if(_0x11034c[_0x480c('0x27')]){_0x1d287f(null,[_0x11034c[_0x480c('0x28')]]);}else{_0x1d287f(null,_[_0x480c('0x29')](_0x11034c[_0x480c('0x2a')],_0x480c('0x28')));}}else{_0x1d287f(null,![]);}})[_0x480c('0x18')](function(_0x2780ae){_0x1d287f(_0x2780ae);});};AGIVertices['prototype'][_0x480c('0x21')]=function(_0x15db14){return util[_0x480c('0x2b')](_0x480c('0x2c'),FILES_PATH,_0x15db14);};AGIVertices['prototype'][_0x480c('0x2d')]=function(_0x1ae830,_0x564b16,_0x8b79fc){odbc['open'](_0x1ae830,function(_0x31c0aa){if(_0x31c0aa){logger[_0x480c('0x2e')](_0x480c('0x2f'),_0x31c0aa);_0x8b79fc(_0x31c0aa);}else{logger['info'](_0x480c('0x30'));odbc[_0x480c('0x31')](_0x564b16,function(_0x1b9b3c,_0x232920){if(_0x1b9b3c){logger['info'](_0x480c('0x32'),_0x564b16);_0x8b79fc(_0x1b9b3c);}else{logger[_0x480c('0x33')](_0x480c('0x34'),_0x564b16);odbc[_0x480c('0x35')](function(_0x3eb279){if(_0x3eb279){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3eb279);}_0x8b79fc(null,_0x232920);});}});}});};AGIVertices[_0x480c('0x13')][_0x480c('0x36')]=function(_0x3d03c1,_0x402940){this['rpc'][_0x480c('0x37')](_0x3d03c1)[_0x480c('0x16')](function(_0x1071d){_0x402940(null,_0x1071d?_0x1071d:![]);})[_0x480c('0x18')](function(_0x221c04){_0x402940(_0x221c04);});};AGIVertices[_0x480c('0x13')][_0x480c('0x38')]=function(_0x5d9811,_0x33664b){this['rpc'][_0x480c('0x38')](_0x5d9811)[_0x480c('0x16')](function(_0x4eb00d){_0x33664b(null,_0x4eb00d);})[_0x480c('0x18')](function(_0x2aad21){_0x33664b(_0x2aad21);});};AGIVertices['prototype'][_0x480c('0x39')]=function(_0x4d62fb,_0x43e8fd,_0x2257bc){this[_0x480c('0x11')]['createSquareDetailsReport']({'uniqueid':this[_0x480c('0x10')][_0x480c('0x3a')],'node':_0x4d62fb[_0x480c('0x3b')],'application':_0x4d62fb[_0x480c('0x3c')],'data':_0x43e8fd||null,'project_name':this[_0x480c('0x10')][_0x480c('0x3d')],'callerid':this[_0x480c('0x10')][_0x480c('0x3e')]})[_0x480c('0x16')](function(_0x13c0d0){if(_0x2257bc){_0x2257bc(null,_0x13c0d0);}})[_0x480c('0x18')](function(_0x4d6e03){if(_0x2257bc){_0x2257bc(_0x4d6e03);}});};AGIVertices[_0x480c('0x13')]['createSquareRecording']=function(_0x3b2571,_0x4fe4fd,_0x348f5b,_0x1a9af7){this[_0x480c('0x11')][_0x480c('0x3f')]({'uniqueid':this[_0x480c('0x10')]['uniqueid'],'callerid':this[_0x480c('0x10')]['callerid'],'calleridname':this[_0x480c('0x10')][_0x480c('0x40')],'context':this['channel']['context'],'extension':this[_0x480c('0x10')]['extension'],'priority':this[_0x480c('0x10')][_0x480c('0x41')],'accountcode':this[_0x480c('0x10')]['accountcode'],'dnid':this['channel']['dnid'],'projectName':this[_0x480c('0x10')]['arg_1'],'saveName':_0x4fe4fd,'filename':_0x3b2571[_0x480c('0x42')]||_0x4fe4fd,'savePath':_0x348f5b})[_0x480c('0x16')](function(_0x282f58){_0x1a9af7(null,_0x282f58);})[_0x480c('0x18')](function(_0x4881dc){_0x1a9af7(_0x4881dc);});};AGIVertices[_0x480c('0x13')][_0x480c('0x43')]=function(_0x326ce3,_0x39d839,_0xffb135,_0x10a03d,_0x34e874){this[_0x480c('0x11')]['createSquareMessage']({'uniqueid':this[_0x480c('0x10')][_0x480c('0x3a')],'body':_0x326ce3,'direction':_0x39d839,'providerName':_0xffb135,'providerResponse':_0x10a03d})['then'](function(_0x5e969f){if(_0x34e874){_0x34e874(null,_0x5e969f);}})[_0x480c('0x18')](function(_0x4dbd9d){if(_0x34e874){_0x34e874(_0x4dbd9d);}});};AGIVertices['prototype']['createCmContact']=function(_0x5cca6e,_0x2b97ff){this['rpc'][_0x480c('0x44')]({'firstName':_[_0x480c('0x45')](_0x5cca6e[_0x480c('0x17')])||_[_0x480c('0x46')](_0x5cca6e['name'])?'callback_'+Math['random']():_0x5cca6e['name'],'lastName':_[_0x480c('0x45')](_0x5cca6e[_0x480c('0x47')])||_[_0x480c('0x46')](_0x5cca6e[_0x480c('0x47')])?null:_0x5cca6e['lastName'],'phone':_0x5cca6e['phone'],'ListId':_0x5cca6e[_0x480c('0x48')],'scheduledat':_0x5cca6e['scheduledAt'],'callbackUniqueid':this[_0x480c('0x10')]['uniqueid'],'tags':_0x480c('0x49'),'description':_0x480c('0x4a')+_0x5cca6e[_0x480c('0x4b')][_0x480c('0x4c')](),'priority':_0x5cca6e['callback_priority']})[_0x480c('0x16')](function(_0x3175cd){_0x2b97ff(null,_0x3175cd);})[_0x480c('0x18')](function(_0x457acd){_0x2b97ff(_0x457acd);});};AGIVertices[_0x480c('0x13')][_0x480c('0x4d')]=function(_0x3497d5,_0x37be32){this[_0x480c('0x11')][_0x480c('0x4e')](_0x3497d5)['then'](function(_0x50486f){_0x37be32(null,_0x50486f?_0x50486f[_0x480c('0x17')]:![]);})[_0x480c('0x18')](function(_0x14d603){_0x37be32(_0x14d603);});};AGIVertices[_0x480c('0x13')][_0x480c('0x4f')]=function(_0x48215e,_0x1ff8c1,_0x51d8b8){var _0x5dcf94={'role':'agent'};_0x5dcf94[_0x48215e]=this[_0x480c('0x10')]['callerid'];this[_0x480c('0x11')][_0x480c('0x4f')](_0x5dcf94,_0x1ff8c1,this[_0x480c('0x10')][_0x480c('0x3a')])['then'](function(_0x362e99){_0x51d8b8(null,_['isNil'](_0x362e99)?![]:!![]);})[_0x480c('0x18')](function(_0x19dfab){logger[_0x480c('0x2e')](_0x19dfab);_0x51d8b8(null,![]);});};AGIVertices[_0x480c('0x13')][_0x480c('0x50')]=function(_0x4b6c51,_0x5c7621){var _0x4c6c47={'role':_0x480c('0x51')};_0x4c6c47[_0x4b6c51]=this[_0x480c('0x10')]['callerid'];this[_0x480c('0x11')][_0x480c('0x50')](_0x4c6c47)[_0x480c('0x16')](function(_0x13883b){_0x5c7621(null,_[_0x480c('0x46')](_0x13883b)?![]:!![]);})[_0x480c('0x18')](function(_0x4beddb){logger[_0x480c('0x2e')](_0x4beddb);_0x5c7621(null,![]);});};AGIVertices[_0x480c('0x13')]['agentLogout']=function(_0x22dad2,_0x1b7bb7){var _0x280bee={'role':_0x480c('0x51')};_0x280bee[_0x22dad2]=this[_0x480c('0x10')]['callerid'];this['rpc'][_0x480c('0x52')](_0x280bee)[_0x480c('0x16')](function(_0xb6128b){_0x1b7bb7(null,_[_0x480c('0x46')](_0xb6128b)?![]:!![]);})['catch'](function(_0x884593){logger[_0x480c('0x2e')](_0x884593);_0x1b7bb7(null,![]);});};AGIVertices[_0x480c('0x13')][_0x480c('0x53')]=function(_0x16d301,_0x489aa6){var _0x30b131={'role':_0x480c('0x51')};_0x30b131[_0x16d301]=this['channel'][_0x480c('0x3e')];var _0x1c6154=_0x16d301!='internal'?util[_0x480c('0x2b')](_0x480c('0x54'),_0x480c('0x55'),this[_0x480c('0x10')][_0x480c('0x3e')]):undefined;this[_0x480c('0x11')][_0x480c('0x53')](_0x30b131,_0x1c6154)[_0x480c('0x16')](function(_0x189419){_0x489aa6(null,_[_0x480c('0x46')](_0x189419)?![]:!![]);})[_0x480c('0x18')](function(_0x23902e){logger[_0x480c('0x2e')](_0x23902e);_0x489aa6(null,![]);});};AGIVertices[_0x480c('0x13')][_0x480c('0x56')]=function(_0x3c227e,_0x5f2859){sh[_0x480c('0x57')](_[_0x480c('0x58')](_0x3c227e),function(_0x4070b9,_0x25a92e){var _0x4cbb32=_0x25a92e[_0x480c('0x59')](/(\r\n|\n|\r)/gm,'');_0x5f2859(null,_0x4cbb32);});};AGIVertices['prototype'][_0x480c('0x5a')]=function(_0x404b5c,_0x139a39){scripts[_0x480c('0x5a')](_0x404b5c[_0x480c('0x5b')],_0x404b5c[_0x480c('0x5c')]||_0x480c('0x5d'),_0x404b5c[_0x480c('0x5d')],_0x404b5c[_0x480c('0x5e')]||'en-US',_0x404b5c[_0x480c('0x5f')]||'MALE',_0x404b5c[_0x480c('0x60')]||_0x480c('0x61'))[_0x480c('0x16')](function(_0x154952){_0x139a39(null,_0x154952);})[_0x480c('0x18')](function(_0x1eacc0){_0x139a39(_0x1eacc0);});};AGIVertices[_0x480c('0x13')][_0x480c('0x62')]=function(_0x349e05,_0x3f3fb2){scripts[_0x480c('0x62')](_0x349e05[_0x480c('0x5d')],_0x349e05['google_tts_language']||'en',0x1)[_0x480c('0x16')](function(_0x4728b9){_0x3f3fb2(null,_0x4728b9);})[_0x480c('0x18')](function(_0x464694){_0x3f3fb2(_0x464694);});};AGIVertices['prototype']['restAPI']=function(_0x45adc2,_0x311f51){var _0x514bd6={'uri':_0x45adc2[_0x480c('0x63')],'method':_0x45adc2['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x45adc2[_0x480c('0x64')])===_0x480c('0x65')&&parseInt(_0x45adc2[_0x480c('0x64')])>=0x1?parseInt(_0x45adc2[_0x480c('0x64')])*0x3e8:0x5*0x3e8};if(_[_0x480c('0x66')]([_0x480c('0x67'),_0x480c('0x68')],_0x514bd6[_0x480c('0x69')][_0x480c('0x6a')]())){try{_0x514bd6[_0x480c('0x6b')]=_0x45adc2[_0x480c('0xd')]?JSON[_0x480c('0x6c')](_0x45adc2['rawBody']):{};}catch(_0x32cc00){logger['error'](_0x480c('0x6d'),_0x32cc00);}}try{_0x514bd6[_0x480c('0x6e')]=_0x45adc2['rawHeaders']?JSON[_0x480c('0x6c')](_0x45adc2[_0x480c('0xc')]):{};}catch(_0x1f11c4){logger[_0x480c('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1f11c4);}if(_0x45adc2[_0x480c('0x6f')]){try{var _0x5833b5=require(_0x45adc2[_0x480c('0x6f')])['sync'](this,_0x514bd6);_0x514bd6['uri']=Mustache[_0x480c('0x70')](_0x45adc2[_0x480c('0x63')],_0x5833b5,{},['$$','$$']);if(_0x514bd6[_0x480c('0x6e')]){_0x514bd6[_0x480c('0x6e')]=JSON[_0x480c('0x6c')](Mustache[_0x480c('0x70')](JSON[_0x480c('0x71')](_0x514bd6[_0x480c('0x6e')]),_0x5833b5,{},['$$','$$']));}if(_0x514bd6[_0x480c('0x6b')]){_0x514bd6['body']=JSON[_0x480c('0x6c')](Mustache['render'](JSON[_0x480c('0x71')](_0x514bd6[_0x480c('0x6b')]),_0x5833b5,{},['$$','$$']));}}catch(_0x920309){logger[_0x480c('0x2e')](_0x480c('0x72'),_0x920309);}}rp(_0x514bd6)['then'](function(_0x5ea12d){var _0x4c4d3c={'statusCode':_0x5ea12d[_0x480c('0x73')]||0xc8,'statusMessage':_0x5ea12d['statusMessage']||'OK','headers':_0x5ea12d[_0x480c('0x6e')]||{},'body':_0x5ea12d[_0x480c('0x6b')]||{}};_0x311f51(null,_0x4c4d3c);})['catch'](function(_0x1978c2){var _0x505bb0={'statusCode':_0x1978c2['statusCode']||0x1f4,'statusMessage':_0x1978c2[_0x480c('0x74')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1978c2[_0x480c('0x75')][_0x480c('0x6e')]||{},'body':_0x1978c2[_0x480c('0x75')][_0x480c('0x6b')]||{}};_0x311f51(null,_0x505bb0);});};AGIVertices['prototype']['googleDialogflow']=function(_0x43f2ad,_0x58adda){scripts[_0x480c('0x76')](this[_0x480c('0x10')][_0x480c('0x3a')],_0x43f2ad['key'],_0x43f2ad[_0x480c('0x5d')],_0x43f2ad[_0x480c('0x77')]||'en')[_0x480c('0x16')](function(_0x332040){_0x58adda(null,_0x332040);})['catch'](function(_0x40edb3){_0x58adda(_0x40edb3);});};AGIVertices[_0x480c('0x13')][_0x480c('0x78')]=function(_0x218fcf,_0x128fcd){scripts['googleDialogflowV2'](this[_0x480c('0x10')][_0x480c('0x3a')],_0x218fcf['dialogflowV2_project_id'],_0x218fcf['client_email'],_0x218fcf[_0x480c('0x79')],_0x218fcf[_0x480c('0x5d')],_0x218fcf[_0x480c('0x7a')]||'en')[_0x480c('0x16')](function(_0xf3f8f8){_0x128fcd(null,_0xf3f8f8);})[_0x480c('0x18')](function(_0x197f0d){_0x128fcd(_0x197f0d);});};AGIVertices[_0x480c('0x13')]['sestekNDA']=function(_0xf76e1d,_0x24027d){scripts[_0x480c('0x7b')](this[_0x480c('0x10')],_0xf76e1d)['then'](function(_0x53db69){_0x24027d(null,_0x53db69);})[_0x480c('0x18')](function(_0x17f20e){_0x24027d(_0x17f20e);});};AGIVertices[_0x480c('0x13')][_0x480c('0x7c')]=function(_0x174c79,_0xa2c1ed){scripts[_0x480c('0x7c')](_0x174c79[_0x480c('0x7d')],_0x174c79[_0x480c('0x5d')],_0x174c79['ispeech_tts_language']||_0x480c('0x7e'),_0x174c79[_0x480c('0x7f')])[_0x480c('0x16')](function(_0x446ec0){_0xa2c1ed(null,_0x446ec0);})[_0x480c('0x18')](function(_0x1845c1){_0xa2c1ed(_0x1845c1);});};AGIVertices[_0x480c('0x13')][_0x480c('0x80')]=function(_0x5bf64a,_0x5d4556,_0x594e7d){scripts[_0x480c('0x80')](_0x5d4556,_0x5bf64a[_0x480c('0x7d')],_0x5bf64a[_0x480c('0x81')]||'en-US',this[_0x480c('0x82')](_0x5bf64a[_0x480c('0x83')])?_0x5bf64a[_0x480c('0x83')]:undefined)[_0x480c('0x16')](function(_0x38ecb9){_0x594e7d(null,_0x38ecb9);})['catch'](function(_0x5b4433){_0x594e7d(_0x5b4433);});};AGIVertices[_0x480c('0x13')][_0x480c('0x84')]=function(_0x22d958,_0x114810){scripts['awsPolly'](_0x22d958[_0x480c('0x85')],_0x22d958[_0x480c('0x86')],_0x22d958[_0x480c('0x87')],_0x22d958[_0x480c('0x88')]||_0x480c('0x89'),_0x22d958['text'],_0x22d958['aws_text_type']||_0x480c('0x5d'))[_0x480c('0x16')](function(_0x5315cf){_0x114810(null,_0x5315cf);})['catch'](function(_0x1d89ec){_0x114810(_0x1d89ec);});};AGIVertices[_0x480c('0x13')][_0x480c('0x8a')]=function(_0x382d5b,_0x1da6e2){scripts['awsLex'](this[_0x480c('0x10')][_0x480c('0x3a')],_0x382d5b['aws_access_key_id'],_0x382d5b[_0x480c('0x86')],_0x382d5b[_0x480c('0x8b')],_0x382d5b[_0x480c('0x5d')],_0x382d5b[_0x480c('0x8c')])[_0x480c('0x16')](function(_0x2f163f){_0x1da6e2(null,_0x2f163f);})[_0x480c('0x18')](function(_0x410946){_0x1da6e2(_0x410946);});};AGIVertices[_0x480c('0x13')][_0x480c('0x8d')]=function(_0x454c72,_0x403bb5,_0x552bdb){scripts[_0x480c('0x8d')](_0x403bb5,_0x454c72[_0x480c('0x7d')],_0x454c72['google_asr_language']||'en-US')[_0x480c('0x16')](function(_0x370ce7){_0x552bdb(null,_0x370ce7);})[_0x480c('0x18')](function(_0x22adfd){_0x552bdb(_0x22adfd);});};AGIVertices[_0x480c('0x13')][_0x480c('0x8e')]=function(_0xff8bff,_0x22039c,_0x42173a){scripts[_0x480c('0x8e')](_0x22039c,_0xff8bff['appid'],_0xff8bff[_0x480c('0x8f')],_0xff8bff[_0x480c('0x90')])[_0x480c('0x16')](function(_0x55cbef){_0x42173a(null,_0x55cbef);})[_0x480c('0x18')](function(_0x27f462){_0x42173a(_0x27f462);});};AGIVertices[_0x480c('0x13')][_0x480c('0x91')]=function(_0x2675b0){var _0x1344a0=_[_0x480c('0x66')](verticesWithRetry,_0x2675b0[_0x480c('0x3c')])?_0x2675b0:_[_0x480c('0x92')](_0x2675b0);for(var _0x46422b in _0x1344a0){if(_0x1344a0[_0x480c('0x93')](_0x46422b)){if(_0x1344a0[_0x46422b]&&_[_0x480c('0x94')](_0x1344a0[_0x46422b])){if(_[_0x480c('0x66')](recursiveMapAttributes,_0x46422b)){_0x1344a0[_0x46422b]=this[_0x480c('0x95')](_0x1344a0[_0x46422b]);}else{_0x1344a0[_0x46422b]=this[_0x480c('0x96')](_0x1344a0[_0x46422b]);}}}}return _0x1344a0;};AGIVertices[_0x480c('0x13')]['recursiveNodeIndex']=function(_0x523b61){for(var _0x5df9bb in _0x523b61){if(_0x523b61[_0x480c('0x93')](_0x5df9bb)){if(_[_0x480c('0x97')](_0x523b61[_0x5df9bb])){this[_0x480c('0x98')](_0x523b61[_0x5df9bb]);}else if(_[_0x480c('0x99')](_0x523b61[_0x5df9bb])){for(var _0xa1a6d5=0x0;_0xa1a6d5<_0x523b61[_0x5df9bb][_0x480c('0x9a')];_0xa1a6d5++){this[_0x480c('0x98')](_0x523b61[_0x5df9bb][_0xa1a6d5]);}}else if(_['isString'](_0x523b61[_0x5df9bb])){_0x523b61[_0x5df9bb]=this[_0x480c('0x96')](_0x523b61[_0x5df9bb]);}}}};AGIVertices['prototype'][_0x480c('0x9b')]=function(_0x2b7d5c,_0x5b9894){for(var _0x5591a0 in _0x2b7d5c){if(_0x2b7d5c[_0x480c('0x93')](_0x5591a0)){if(_['isPlainObject'](_0x2b7d5c[_0x5591a0])){if(!_[_0x480c('0x45')](_0x2b7d5c[_0x5591a0])){this[_0x480c('0x9b')](_0x2b7d5c[_0x5591a0],util[_0x480c('0x2b')]('%s.%s',_0x5b9894,_0x5591a0));}}else if(_[_0x480c('0x99')](_0x2b7d5c[_0x5591a0])){for(var _0xfec2e4=0x0;_0xfec2e4<_0x2b7d5c[_0x5591a0][_0x480c('0x9a')];_0xfec2e4++){this['saveRestApiResult'](_0x2b7d5c[_0x5591a0][_0xfec2e4],util[_0x480c('0x2b')](_0x480c('0x9c'),_0x5b9894,_0x5591a0+'['+_0xfec2e4+']'));}}else{if(!_[_0x480c('0x46')](_0x2b7d5c[_0x5591a0])){this['channel'][_0x480c('0x9d')](util['format'](_0x480c('0x9c'),_0x5b9894,_0x5591a0),_0x2b7d5c[_0x5591a0]);}}}}};AGIVertices['prototype'][_0x480c('0x95')]=function(_0x5addfb){try{var _0x37b0ce=JSON['parse'](_0x5addfb);this[_0x480c('0x98')](_0x37b0ce);return JSON[_0x480c('0x71')](_0x37b0ce);}catch(_0x95e174){return this['replaceAllVariables'](_0x5addfb);}};AGIVertices[_0x480c('0x13')][_0x480c('0x96')]=function(_0x9ec6a7){var _0x3b49d5=_0x9ec6a7[_0x480c('0x9e')]('{');for(var _0xbf36f0=0x1;_0xbf36f0<_0x3b49d5[_0x480c('0x9a')];_0xbf36f0+=0x1){var _0x19e32b=_0x3b49d5[_0xbf36f0]['split']('}');if(_0x19e32b['length']>0x1){_0x9ec6a7=_0x9ec6a7[_0x480c('0x9f')]('{'+_0x19e32b[0x0]+'}',this[_0x480c('0x10')][_0x480c('0x14')](_0x19e32b[0x0])[_0x480c('0xa0')]||_0x19e32b[0x0]);}}if(_0x3b49d5['length']===0x1){return _0x9ec6a7[_0x480c('0x4c')]();}return this[_0x480c('0x96')](_0x9ec6a7);};AGIVertices['prototype'][_0x480c('0xa1')]=function(_0x14bf64,_0xfdad1d){var _0x3b6a50=this['channel'][_0x480c('0x14')](_0x14bf64);if(_0x3b6a50[_0x480c('0xa2')]===-0x1){return _0x3b6a50;}logger[_0x480c('0x33')](util[_0x480c('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xfdad1d,_0x3b6a50[_0x480c('0xa0')]));return this['channel'][_0x480c('0x9d')](_0xfdad1d,_0x3b6a50['extra']);};AGIVertices[_0x480c('0x13')][_0x480c('0x82')]=function(_0x24a2ca){return _0x24a2ca&&_0x24a2ca!=='0'&&_0x24a2ca!=='-1'&&_0x24a2ca!=='';};AGIVertices[_0x480c('0x13')][_0x480c('0xa3')]=function(_0xd88a4d){this[_0x480c('0x39')][_0x480c('0xa4')](this,_0xd88a4d,'-');_0xd88a4d[_0x480c('0xa5')]=_0xd88a4d[_0x480c('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x480c('0xa6')]=function(_0x566fe8){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xa7'),_0x566fe8['label']));if(!this[_0x480c('0x82')](_0x566fe8[_0x480c('0x5d')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x150650='\x22'+_0x566fe8[_0x480c('0x5d')]+'\x22';if(this[_0x480c('0x82')](_0x566fe8[_0x480c('0x75')])){_0x150650+=','+_0x566fe8['options'];}var _0x187960=this['channel'][_0x480c('0x57')]('MRCPSynth',_0x150650);if(_0x187960['result']===-0x1){return _0x187960;}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x150650));};AGIVertices[_0x480c('0x13')][_0x480c('0xa9')]=function(_0x3b9a68){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xaa'),_0x3b9a68[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x3b9a68[_0x480c('0xab')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xac'));}var _0x400ed0=_0x3b9a68[_0x480c('0xab')];if(this[_0x480c('0x82')](_0x3b9a68[_0x480c('0x75')])){_0x400ed0+=','+_0x3b9a68[_0x480c('0x75')];}var _0x201258=this['channel'][_0x480c('0x57')]('MRCPRecog',_0x400ed0);if(_0x201258[_0x480c('0xa2')]===-0x1){return _0x201258;}var _0x576bb7=this['getAndSetVariable'](_0x480c('0xad'),_0x480c('0xae'));if(_0x576bb7[_0x480c('0xa2')]===-0x1){return _0x576bb7;}var _0x1fe9a6=this[_0x480c('0xa1')](_0x480c('0xaf'),_0x480c('0xb0'));if(_0x1fe9a6[_0x480c('0xa2')]===-0x1){return _0x1fe9a6;}var _0x2580ef=this['getAndSetVariable'](_0x480c('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x2580ef[_0x480c('0xa2')]===-0x1){return _0x2580ef;}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x400ed0));};AGIVertices['prototype'][_0x480c('0x8')]=function(_0x494d96){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xb2'),_0x494d96[_0x480c('0x3b')]));return this['channel'][_0x480c('0x8')]([_0x494d96['command'],_0x494d96['args']]);};AGIVertices[_0x480c('0x13')]['answer']=function(_0x111c02){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xb3'),_0x111c02[_0x480c('0x3b')]));if(this[_0x480c('0x82')](_0x111c02[_0x480c('0x64')])){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xb4'),_0x111c02[_0x480c('0x64')]));var _0x4cc514=this['channel'][_0x480c('0xb5')](_0x111c02[_0x480c('0x64')]);if(_0x4cc514[_0x480c('0xa2')]===-0x1){return _0x4cc514;}}return this['channel']['answer']();};AGIVertices[_0x480c('0x13')][_0x480c('0x49')]=function(_0x228016){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x228016[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x228016[_0x480c('0x48')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x228016,'no\x20list\x20selected');}_0x228016[_0x480c('0x4b')]=moment();if(this[_0x480c('0x82')](_0x228016[_0x480c('0xb6')])){_0x228016['scheduledAt']=moment()[_0x480c('0xb7')](_0x228016[_0x480c('0xb6')],'minutes');}if(!this[_0x480c('0x82')](_0x228016[_0x480c('0xb8')])){_0x228016[_0x480c('0xb8')]=0x2;}this['createCmContact'][_0x480c('0xa4')](this,_0x228016);return this[_0x480c('0x10')]['noop'](util[_0x480c('0x2b')](_0x480c('0xb9'),_0x228016[_0x480c('0xba')],_0x228016[_0x480c('0x48')],_0x228016['scheduledAt']));};AGIVertices['prototype'][_0x480c('0xbb')]=function(_0x3e3a19){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x3e3a19['label']));var _0x4f6b49=this[_0x480c('0x10')]['exec'](_0x3e3a19[_0x480c('0xbc')],_0x3e3a19[_0x480c('0x75')]);if(_0x4f6b49['result']===-0x1){return _0x4f6b49;}return this['channel'][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xbd'),_0x3e3a19['application'],_0x3e3a19[_0x480c('0x75')]));};AGIVertices[_0x480c('0x13')][_0x480c('0xbe')]=function(_0x68b021){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xbf'),_0x68b021[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x68b021['text'])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xc0'));}var _0x4b8f83='\x22'+_0x68b021[_0x480c('0x5d')]+'\x22';if(this[_0x480c('0x82')](_0x68b021[_0x480c('0x75')])){_0x4b8f83+=','+_0x68b021[_0x480c('0x75')];}var _0x45e259=this[_0x480c('0x10')][_0x480c('0x57')](_0x480c('0xc1'),_0x4b8f83);if(_0x45e259[_0x480c('0xa2')]===-0x1){return _0x45e259;}return this['channel'][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xc2'),_0x4b8f83));};AGIVertices['prototype'][_0x480c('0xc3')]=function(_0x29c23e){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x29c23e[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x29c23e[_0x480c('0x5d')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xc0'));}var _0x5b1416='\x22'+_0x29c23e[_0x480c('0x5d')]+'\x22';if(this['isConfigured'](_0x29c23e[_0x480c('0x75')])){_0x5b1416+=','+_0x29c23e['options'];}var _0xe620da=this[_0x480c('0x10')][_0x480c('0x57')]('MRCPSynth',_0x5b1416);if(_0xe620da[_0x480c('0xa2')]===-0x1){return _0xe620da;}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xc2'),_0x5b1416));};AGIVertices[_0x480c('0x13')][_0x480c('0xc4')]=function(_0x1b2364){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xc5'),_0x1b2364[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x1b2364[_0x480c('0xab')])){return this[_0x480c('0x10')]['noop'](_0x480c('0xac'));}var _0x2bb7fc=_0x1b2364['grammar'];if(this[_0x480c('0x82')](_0x1b2364['options'])){_0x2bb7fc+=','+_0x1b2364[_0x480c('0x75')];}var _0x565f5a=this[_0x480c('0x10')]['exec'](_0x480c('0xc6'),_0x2bb7fc);if(_0x565f5a[_0x480c('0xa2')]===-0x1){return _0x565f5a;}var _0x25a874=this[_0x480c('0xa1')](_0x480c('0xad'),_0x480c('0xc7'));if(_0x25a874[_0x480c('0xa2')]===-0x1){return _0x25a874;}var _0x110d94=this[_0x480c('0xa1')](_0x480c('0xaf'),_0x480c('0xc8'));if(_0x110d94['result']===-0x1){return _0x110d94;}var _0xb66563=this['getAndSetVariable'](_0x480c('0xb1'),'LUMENVOX_ASR_INSTANCE');if(_0xb66563[_0x480c('0xa2')]===-0x1){return _0xb66563;}return this['channel']['noop'](util[_0x480c('0x2b')](_0x480c('0xc9'),_0x2bb7fc));};AGIVertices[_0x480c('0x13')][_0x480c('0xca')]=function(_0x33ceac){logger[_0x480c('0x33')](util['format'](_0x480c('0xcb'),_0x33ceac[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x33ceac[_0x480c('0xab')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xac'));}var _0x397a99=_0x33ceac[_0x480c('0xab')];if(this[_0x480c('0x82')](_0x33ceac['options'])){_0x397a99+=','+_0x33ceac['options'];}var _0x2e28bc=this[_0x480c('0x10')][_0x480c('0x57')](_0x480c('0xc6'),_0x397a99);if(_0x2e28bc[_0x480c('0xa2')]===-0x1){return _0x2e28bc;}var _0x1c284d=this[_0x480c('0xa1')](_0x480c('0xad'),'SESTEK_ASR_CONFIDENCE');if(_0x1c284d['result']===-0x1){return _0x1c284d;}var _0x32c6cf=this['getAndSetVariable']('RECOG_INPUT()',_0x480c('0xcc'));if(_0x32c6cf[_0x480c('0xa2')]===-0x1){return _0x32c6cf;}var _0x5978c6=this['getAndSetVariable'](_0x480c('0xb1'),_0x480c('0xcd'));if(_0x5978c6[_0x480c('0xa2')]===-0x1){return _0x5978c6;}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xc9'),_0x397a99));};AGIVertices[_0x480c('0x13')][_0x480c('0xce')]=function(_0x128cc8){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xcf'),_0x128cc8['label']));if(!this[_0x480c('0x82')](_0x128cc8[_0x480c('0xd0')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x128cc8,_0x480c('0xd1'));}var _0x2e12ce=this[_0x480c('0x1b')][_0x480c('0xa4')](this,_0x128cc8[_0x480c('0xd0')]);if(!_0x2e12ce){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x128cc8,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x128cc8[_0x480c('0x31')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x128cc8,_0x480c('0xd2'));}var _0x2d2fe9=_0x128cc8[_0x480c('0x31')][_0x480c('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0xd3'),_0x2d2fe9));var _0x152bf9=this['getQueryOdbc']['sync'](this,_0x2e12ce,_0x2d2fe9);this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x128cc8,_0x2d2fe9);if(!this[_0x480c('0x82')](_0x128cc8['variable_id'])){return this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x193818=this['getVariable'][_0x480c('0xa4')](this,_0x128cc8['variable_id']);if(!_0x193818){return this[_0x480c('0x10')]['error'](_0x128cc8,_0x480c('0xd4'));}var _0xeac456=this;_0x152bf9[_0x480c('0xd5')](function(_0xdd0ceb,_0x27de7d){Object[_0x480c('0xd6')](_0xdd0ceb)['forEach'](function(_0x1fd34f){_0xeac456['channel']['setVariable'](util['format']('%s[%s][%s]',_0x193818,_0x27de7d,_0x1fd34f),_0xdd0ceb[_0x1fd34f]);});});this['channel'][_0x480c('0x9d')](util['format'](_0x480c('0xd7'),_0x193818),_0x152bf9[_0x480c('0x9a')]);return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xd8'),_0x193818));};AGIVertices['prototype'][_0x480c('0xd9')]=function(_0x56cd4b){logger[_0x480c('0xda')](util[_0x480c('0x2b')](_0x480c('0xdb'),_0x56cd4b[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x56cd4b[_0x480c('0xdc')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x56cd4b,_0x480c('0xdd'));}var _0x5de5a5=this['getUser']['sync'](this,_0x56cd4b[_0x480c('0xdc')]);if(!_0x5de5a5){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x56cd4b,_0x480c('0xde'));}var _0x221043=this['channel'][_0x480c('0x57')](_0x480c('0xdf'),[util[_0x480c('0x2b')](_0x480c('0xe0'),_0x5de5a5),_0x56cd4b[_0x480c('0x64')],_0x56cd4b['opts'],_0x56cd4b['url']]);if(_0x221043[_0x480c('0xa2')]===-0x1){return _0x221043;}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xe1'),_0x480c('0xdf')));};AGIVertices[_0x480c('0x13')][_0x480c('0xe2')]=function(_0x255286){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xe3'),_0x255286[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x255286['key'])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xe4'));}if(!this[_0x480c('0x82')](_0x255286[_0x480c('0x5d')])){return this['channel'][_0x480c('0xa8')](_0x480c('0xc0'));}this[_0x480c('0x10')][_0x480c('0xe5')]=!![];this[_0x480c('0x39')](_0x255286);this[_0x480c('0x43')](_0x255286[_0x480c('0x5d')],'in','','');this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xe6'),_0x255286[_0x480c('0x5d')]));var _0x156d81=this['googleDialogflow']['sync'](this,_0x255286);if(_0x156d81){for(var _0x1e74c4 in _0x156d81){if(_0x156d81[_0x480c('0x93')](_0x1e74c4)){this['channel'][_0x480c('0x9d')](util['format'](_0x480c('0xe7'),_0x1e74c4[_0x480c('0x6a')]()),_0x156d81[_0x1e74c4]);}}this[_0x480c('0x43')](_0x156d81[_0x480c('0xe8')],_0x480c('0xe9'),'dialogflow','');return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xea'),_0x156d81[_0x480c('0xe8')]));}return this['channel'][_0x480c('0x2e')](_0x255286,_0x480c('0xeb'));};AGIVertices[_0x480c('0x13')]['dialogflowV2']=function(_0x410769){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xec'),_0x410769[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x410769['dialogflowV2_project_id'])){return this[_0x480c('0x10')][_0x480c('0xa8')]('no\x20project_id\x20configured');}if(!this[_0x480c('0x82')](_0x410769['client_email'])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xed'));}if(!this[_0x480c('0x82')](_0x410769[_0x480c('0x79')])){return this[_0x480c('0x10')]['noop'](_0x480c('0xee'));}if(!this[_0x480c('0x82')](_0x410769[_0x480c('0x7a')])){return this[_0x480c('0x10')]['noop'](_0x480c('0xef'));}if(!this[_0x480c('0x82')](_0x410769[_0x480c('0x5d')])){return this[_0x480c('0x10')][_0x480c('0xa8')]('no\x20text\x20configured');}this['channel'][_0x480c('0xe5')]=!![];this['createSquareDetailsReport'](_0x410769);this['createSquareMessage'](_0x410769[_0x480c('0x5d')],'in','','');this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xf0'),_0x410769['text']));var _0x26bfdd=this[_0x480c('0x78')][_0x480c('0xa4')](this,_0x410769);if(_0x26bfdd){for(var _0x440432 in _0x26bfdd){if(_0x26bfdd[_0x480c('0x93')](_0x440432)){if(_0x440432!==_0x480c('0xf1')){this['channel'][_0x480c('0x9d')](util['format'](_0x480c('0xe7'),_0x440432[_0x480c('0x6a')]()),_0x26bfdd[_0x440432]);}}}this['createSquareMessage'](_0x26bfdd[_0x480c('0xe8')],'out',_0x480c('0xf2'),_0x26bfdd['providerResponse']);return this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0xf3'),_0x26bfdd[_0x480c('0xe8')]));}return this[_0x480c('0x10')]['error'](_0x410769,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x480c('0x13')]['sesteknda']=function(_0x38019f){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0xf4'),_0x38019f['label']));if(!this['isConfigured'](_0x38019f[_0x480c('0xf5')])){return this['channel']['noop'](_0x480c('0xf6'));}if(!this[_0x480c('0x82')](_0x38019f[_0x480c('0xf7')])){return this['channel'][_0x480c('0xa8')]('no\x20username\x20configured');}if(!this[_0x480c('0x82')](_0x38019f['password'])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xf8'));}if(!this['isConfigured'](_0x38019f[_0x480c('0xf9')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xc0'));}this[_0x480c('0x10')][_0x480c('0xe5')]=!![];this[_0x480c('0x39')](_0x38019f);this[_0x480c('0x43')](_0x38019f[_0x480c('0x5d')],'in','','');this[_0x480c('0x10')][_0x480c('0xa8')](util['format']('Trying\x20SestekNDA:\x20%s',_0x38019f[_0x480c('0x5d')]));var _0x1b9941=this[_0x480c('0x7b')]['sync'](this,_0x38019f);if(_0x1b9941){for(var _0x45e08b in _0x1b9941){if(_0x1b9941[_0x480c('0x93')](_0x45e08b)){this[_0x480c('0x10')][_0x480c('0x9d')](util[_0x480c('0x2b')](_0x480c('0xfa'),_0x45e08b[_0x480c('0x6a')]()),_0x1b9941[_0x45e08b]);}}this['createSquareMessage'](_0x1b9941['speech'],'out',_0x480c('0xfb'),'');if(_0x1b9941[_0x480c('0xfc')]){this['channel']['noop'](util[_0x480c('0x2b')](_0x480c('0xfd'),_0x1b9941[_0x480c('0xfc')]));var _0x544467=this[_0x480c('0x10')][_0x480c('0xfe')](_0x1b9941[_0x480c('0xfc')]);try{fs[_0x480c('0xff')](_0x1b9941[_0x480c('0xfc')]+_0x480c('0x100'));}catch(_0x1933eb){logger['error'](_0x1933eb);}return _0x544467;}else{return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x101'),_0x1b9941[_0x480c('0xe8')]));}}return this[_0x480c('0x10')][_0x480c('0x2e')](_0x38019f,_0x480c('0x102'));};AGIVertices[_0x480c('0x13')]['end']=function(_0x4ac2b5){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x103'),_0x4ac2b5[_0x480c('0x3b')]));return this[_0x480c('0x10')][_0x480c('0xa8')]('end');};AGIVertices[_0x480c('0x13')]['ext_dial']=function(_0x3a6d72){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x104'),_0x3a6d72[_0x480c('0x3b')]));var _0x1c1d20='';if(_0x3a6d72['trunk_id']){if(!this[_0x480c('0x82')](_0x3a6d72[_0x480c('0x105')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x3a6d72,_0x480c('0x106'));}else{var _0x2a0f24=parseInt(_0x3a6d72[_0x480c('0x105')],0xa);if(isNaN(_0x2a0f24)){_0x1c1d20=_0x3a6d72[_0x480c('0x105')];}else{_0x1c1d20=this[_0x480c('0x1f')][_0x480c('0xa4')](this,_0x3a6d72[_0x480c('0x105')]);if(!_0x1c1d20){return this['channel'][_0x480c('0x2e')](_0x3a6d72,'no\x20trunk\x20found');}}}}else if(_0x3a6d72[_0x480c('0x107')]){_0x1c1d20=_0x3a6d72[_0x480c('0x107')];}else{return this[_0x480c('0x10')][_0x480c('0x2e')](_0x3a6d72,_0x480c('0x106'));}var _0x588398=this[_0x480c('0x10')][_0x480c('0x57')](_0x480c('0xdf'),[util[_0x480c('0x2b')](_0x480c('0x108'),_0x1c1d20,_0x3a6d72[_0x480c('0xba')]),_0x3a6d72['timeout'],_0x3a6d72[_0x480c('0x109')],_0x3a6d72[_0x480c('0x63')]]);if(_0x588398[_0x480c('0xa2')]===-0x1){return _0x588398;}return this['channel'][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xe1'),'DIAL'));};AGIVertices[_0x480c('0x13')][_0x480c('0x10a')]=function(_0x4c6de7){logger['info'](util[_0x480c('0x2b')](_0x480c('0x10b'),_0x4c6de7['label']));return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0x10a'));};AGIVertices[_0x480c('0x13')]['getdigits']=function(_0x364818){logger[_0x480c('0x33')](util['format'](_0x480c('0x10c'),_0x364818[_0x480c('0x3b')]));if(_0x364818[_0x480c('0xa5')]===0x0){return this['maxRetry'](_0x364818);}_0x364818['retry']-=0x1;if(!this[_0x480c('0x82')](_0x364818['file_id'])){return this[_0x480c('0x10')]['error'](_0x364818,_0x480c('0x10d'));}var _0x56e41a=this[_0x480c('0x10e')][_0x480c('0xa4')](this,_0x364818[_0x480c('0x10f')]);if(!_0x56e41a){return this[_0x480c('0x10')]['error'](_0x364818,_0x480c('0x110'));}if(!this['isConfigured'](_0x364818['variable_id'])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x480c('0x111'));}var _0x12c42d=this['channel'][_0x480c('0x112')](_0x56e41a,_0x364818[_0x480c('0x113')],_0x364818[_0x480c('0x114')]);var _0x48fb78=_0x12c42d[_0x480c('0xa2')]?_0x12c42d[_0x480c('0xa2')][_0x480c('0x4c')]():'';logger[_0x480c('0x33')](_0x480c('0x115'),JSON[_0x480c('0x71')](_0x12c42d));if(_0x12c42d['result']===-0x1){this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x364818,_0x48fb78);return _0x12c42d;}else if(_0x12c42d[_0x480c('0xa0')]===_0x480c('0x64')){_0x12c42d[_0x480c('0xa2')]=_0x48fb78[_0x480c('0x9a')]>=parseInt(_0x364818[_0x480c('0x116')])?'x':'i';}else{_0x12c42d[_0x480c('0xa2')]=_0x48fb78[_0x480c('0x9a')]>=parseInt(_0x364818['mindigit'])&&_0x48fb78['length']<=parseInt(_0x364818['maxdigit'])?'x':'i';}var _0xd0c990=this[_0x480c('0x14')][_0x480c('0xa4')](this,_0x364818[_0x480c('0x117')]);if(!_0xd0c990){return this['channel'][_0x480c('0x2e')](_0x364818,'no\x20variable\x20found');}this['channel'][_0x480c('0x9d')](_0xd0c990,_0x48fb78);if(this[_0x480c('0x82')](_0x364818[_0x480c('0x118')])){var _0x12b9b3=parseInt(_0x364818['hiddendigitsnum'],0xa);var _0x2f918f=rs['generate']({'charset':'*','length':_0x12b9b3});var _0x1a944d=_0x48fb78['length'];if(_0x1a944d>0x0){if(_0x1a944d>_0x12b9b3){this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x364818,_0x364818[_0x480c('0x119')]===_0x480c('0x11a')?_0x2f918f+_0x48fb78['substr'](_0x12b9b3):_0x48fb78[_0x480c('0x11b')](0x0,_0x1a944d-_0x12b9b3)+_0x2f918f);}else{this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x364818,rs[_0x480c('0x11c')]({'charset':'*','length':_0x1a944d}));}}else{this['createSquareDetailsReport'][_0x480c('0xa4')](this,_0x364818,'');}}else{this['createSquareDetailsReport'][_0x480c('0xa4')](this,_0x364818,_0x48fb78);}return _0x12c42d;};AGIVertices['prototype']['getsecretdigits']=function(_0x495464){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x11d'),_0x495464[_0x480c('0x3b')]));return this[_0x480c('0xf')](_0x495464);};AGIVertices[_0x480c('0x13')][_0x480c('0x11e')]=function(_0x163a6f){logger['info'](util[_0x480c('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x163a6f[_0x480c('0x3b')]));this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x163a6f,_0x163a6f[_0x480c('0x11f')]);return this['channel'][_0x480c('0xa8')](util['format'](_0x480c('0x120'),_0x163a6f[_0x480c('0x11f')]));};AGIVertices[_0x480c('0x13')]['awspolly']=function(_0x4d3234){logger['info'](util[_0x480c('0x2b')](_0x480c('0x121'),_0x4d3234[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x4d3234['aws_access_key_id'])||!this[_0x480c('0x82')](_0x4d3234[_0x480c('0x86')])){return this[_0x480c('0x10')]['noop'](_0x480c('0x122'));}if(!this[_0x480c('0x82')](_0x4d3234[_0x480c('0x5d')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xc0'));}this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0x123'),_0x4d3234[_0x480c('0x5d')]));var _0x192794=this[_0x480c('0x84')]['sync'](this,_0x4d3234);if(_0x192794){this['channel'][_0x480c('0xa8')](util['format'](_0x480c('0x124'),_0x192794));var _0x20d0a1=this[_0x480c('0x10')]['streamFile'](_0x192794);try{fs[_0x480c('0xff')](_0x192794+_0x480c('0x100'));}catch(_0x4bb18b){logger[_0x480c('0x2e')](_0x4bb18b);}return _0x20d0a1;}return this['channel']['error'](_0x4d3234,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x480c('0x125')]=function(_0x116c1d){logger['info'](util[_0x480c('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x116c1d[_0x480c('0x3b')]));if(!this['isConfigured'](_0x116c1d[_0x480c('0x85')])||!this[_0x480c('0x82')](_0x116c1d[_0x480c('0x86')])){return this[_0x480c('0x10')][_0x480c('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x480c('0x82')](_0x116c1d['aws_bot_name'])){return this['channel'][_0x480c('0xa8')](_0x480c('0x126'));}if(!this[_0x480c('0x82')](_0x116c1d['text'])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xc0'));}this[_0x480c('0x10')][_0x480c('0xe5')]=!![];this['createSquareDetailsReport'](_0x116c1d);this['createSquareMessage'](_0x116c1d[_0x480c('0x5d')],'in','','');this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x127'),_0x116c1d[_0x480c('0x5d')]));var _0x2e0008=this[_0x480c('0x8a')]['sync'](this,_0x116c1d);if(_0x2e0008){for(var _0x77051b in _0x2e0008){if(_0x2e0008[_0x480c('0x93')](_0x77051b)&&_['isString'](_0x2e0008[_0x77051b])){this[_0x480c('0x10')]['setVariable'](util[_0x480c('0x2b')](_0x480c('0x128'),_0x77051b[_0x480c('0x6a')]()),_0x2e0008[_0x77051b]);}}if(_[_0x480c('0x46')](_0x2e0008[_0x480c('0x74')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0x129'));}else{this['createSquareMessage'](_0x2e0008[_0x480c('0x74')],_0x480c('0xe9'),_0x480c('0x12a'),'');return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x12b'),_0x2e0008[_0x480c('0x74')]));}}return this[_0x480c('0x10')][_0x480c('0x2e')](_0x116c1d,_0x480c('0x12c'));};AGIVertices[_0x480c('0x13')][_0x480c('0x12d')]=function(_0x51e5e4){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x51e5e4['label'],_0x51e5e4[_0x480c('0x64')]));if(!this[_0x480c('0x82')](_0x51e5e4[_0x480c('0x7d')])){return this['channel'][_0x480c('0xa8')](_0x480c('0xe4'));}var _0x477fea='wav';var _0x4423b8=util[_0x480c('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1cd12a=util[_0x480c('0x2b')](_0x480c('0x9c'),_0x4423b8,_0x477fea);var _0x3de8e1=!![];if(_0x51e5e4['beep']===_0x480c('0x12e')){_0x3de8e1=![];}var _0x5124f0=this[_0x480c('0x10')]['recordFile'](_0x4423b8,_0x477fea,_0x51e5e4[_0x480c('0x12f')],_0x51e5e4[_0x480c('0x64')],undefined,_0x3de8e1);if(_0x5124f0[_0x480c('0xa2')]!==-0x1){this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0x130'),_0x1cd12a));var _0x275ba=this[_0x480c('0x8d')][_0x480c('0xa4')](this,_0x51e5e4,_0x1cd12a);if(_0x275ba){for(var _0x21e6b1 in _0x275ba){if(_0x275ba[_0x480c('0x93')](_0x21e6b1)){this[_0x480c('0x10')][_0x480c('0x9d')](util[_0x480c('0x2b')](_0x480c('0x131'),_0x21e6b1[_0x480c('0x6a')]()),_0x275ba[_0x21e6b1]);}}return this['channel'][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x132'),JSON[_0x480c('0x71')](_0x275ba)));}}return _0x5124f0;};AGIVertices['prototype'][_0x480c('0x133')]=function(_0x401fc2){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x134'),_0x401fc2[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x401fc2[_0x480c('0x135')])){return this[_0x480c('0x10')][_0x480c('0xa8')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x401fc2['appsecret'])){return this[_0x480c('0x10')]['noop'](_0x480c('0x136'));}var _0xb5a409=_0x480c('0x137');var _0x5eff46=util[_0x480c('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x53158d=util[_0x480c('0x2b')](_0x480c('0x9c'),_0x5eff46,_0xb5a409);var _0xc82b62=!![];if(_0x401fc2[_0x480c('0x138')]===_0x480c('0x12e')){_0xc82b62=![];}var _0x4b8bfb=this[_0x480c('0x10')][_0x480c('0x139')](_0x5eff46,_0xb5a409,_0x401fc2[_0x480c('0x12f')],_0x401fc2[_0x480c('0x64')],undefined,_0xc82b62);if(_0x4b8bfb[_0x480c('0xa2')]!==-0x1){this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x13a'),_0x53158d));var _0x36b6a3=this['tildeASR'][_0x480c('0xa4')](this,_0x401fc2,_0x53158d);if(_0x36b6a3){for(var _0x50d571 in _0x36b6a3){if(_0x36b6a3[_0x480c('0x93')](_0x50d571)){this[_0x480c('0x10')][_0x480c('0x9d')](util['format'](_0x480c('0x13b'),_0x50d571[_0x480c('0x6a')]()),_0x36b6a3[_0x50d571]);}}return this['channel'][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x13c'),JSON[_0x480c('0x71')](_0x36b6a3)));}}return _0x4b8bfb;};AGIVertices['prototype'][_0x480c('0x13d')]=function(_0x1a1f73){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x13e'),_0x1a1f73[_0x480c('0x3b')]));return this[_0x480c('0x10')][_0x480c('0x13f')](_0x1a1f73[_0x480c('0x140')],_0x1a1f73[_0x480c('0x141')],_0x1a1f73[_0x480c('0x41')]);};AGIVertices[_0x480c('0x13')][_0x480c('0x142')]=function(_0x50a85b){logger['info'](util[_0x480c('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x50a85b['label']));if(!this[_0x480c('0x82')](_0x50a85b[_0x480c('0x143')])){return this['channel']['error'](_0x50a85b,_0x480c('0x144'));}try{var _0x2127ff=eval(_0x50a85b[_0x480c('0x143')])?_0x480c('0x145'):_0x480c('0x146');this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0x147'),_0x50a85b[_0x480c('0x143')],_0x2127ff));return{'code':0xc8,'result':_0x2127ff};}catch(_0x2f92a8){return{'code':0xc8,'result':_0x480c('0x146')};}};AGIVertices['prototype'][_0x480c('0x148')]=function(_0xbf959c){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0xbf959c[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0xbf959c[_0x480c('0x149')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0xbf959c,'no\x20interval\x20configured');}var _0x54b622=this[_0x480c('0x25')][_0x480c('0xa4')](this,_0xbf959c[_0x480c('0x149')]);if(!_0x54b622){return this[_0x480c('0x10')][_0x480c('0x2e')](_0xbf959c,_0x480c('0x14a'));}for(var _0x5c1cf5=0x0;_0x5c1cf5<_0x54b622[_0x480c('0x9a')];_0x5c1cf5+=0x1){var _0x2666df=this['channel']['getVariable'](util[_0x480c('0x2b')](_0x480c('0x14b'),_0x54b622[_0x5c1cf5]));if(_0x2666df['result']===-0x1){return _0x2666df;}logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x14c'),_0x54b622[_0x5c1cf5],_0x2666df[_0x480c('0xa0')]));if(_0x2666df['extra']===_0x480c('0x145')){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x14c'),_0x54b622[_0x5c1cf5],'true'));this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')]('IFTIME\x20%s\x20%s',_0x54b622[_0x5c1cf5],'true'));return{'code':0xc8,'result':_0x480c('0x145')};}else{logger[_0x480c('0x33')](util['format'](_0x480c('0x14c'),_0x54b622[_0x5c1cf5],'false'));this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x14c'),_0x54b622[_0x5c1cf5],_0x480c('0x146')));}}return{'code':0xc8,'result':_0x480c('0x146')};};AGIVertices['prototype']['hangup']=function(_0xd1b826){logger['info'](util[_0x480c('0x2b')](_0x480c('0x14d'),_0xd1b826['label']));return this[_0x480c('0x10')][_0x480c('0x14e')]();};AGIVertices[_0x480c('0x13')][_0x480c('0x14f')]=function(_0x4e2810){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x150'),_0x4e2810[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x4e2810['key'])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xe4'));}var _0x1fcaf1='wav';var _0x5a0847=util['format'](_0x480c('0x151'),FILES_PATH,rs[_0x480c('0x11c')](0x4));var _0xa3b007=util[_0x480c('0x2b')]('%s.%s',_0x5a0847,_0x1fcaf1);var _0x17cddd=!![];if(_0x4e2810['beep']===_0x480c('0x12e')){_0x17cddd=![];}var _0x2cb93a=this[_0x480c('0x10')][_0x480c('0x139')](_0x5a0847,_0x1fcaf1,_0x4e2810[_0x480c('0x12f')],_0x4e2810['timeout'],undefined,_0x17cddd);if(_0x2cb93a[_0x480c('0xa2')]!==-0x1){this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x152'),_0xa3b007));var _0xf7e52b=this[_0x480c('0x80')][_0x480c('0xa4')](this,_0x4e2810,_0xa3b007);if(_0xf7e52b){for(var _0x1cc4f5 in _0xf7e52b){if(_0xf7e52b[_0x480c('0x93')](_0x1cc4f5)){this[_0x480c('0x10')][_0x480c('0x9d')](util[_0x480c('0x2b')](_0x480c('0x153'),_0x1cc4f5['toUpperCase']()),_0xf7e52b[_0x1cc4f5]);}}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0xf7e52b)));}}return _0x2cb93a;};AGIVertices[_0x480c('0x13')][_0x480c('0x154')]=function(_0x2acc04){logger[_0x480c('0x33')](util['format'](_0x480c('0x155'),_0x2acc04[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x2acc04[_0x480c('0x7d')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xe4'));}if(!this['isConfigured'](_0x2acc04[_0x480c('0x5d')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xc0'));}this['channel'][_0x480c('0xa8')](util['format'](_0x480c('0x156'),_0x2acc04[_0x480c('0x5d')]));var _0x261a30=this[_0x480c('0x7c')]['sync'](this,_0x2acc04);if(_0x261a30){this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')]('ispeech\x20%s\x20file\x20created',_0x261a30));var _0x4de79b=this['channel'][_0x480c('0xfe')](_0x261a30,_0x2acc04[_0x480c('0x12f')]);try{fs[_0x480c('0xff')](_0x261a30+_0x480c('0x100'));}catch(_0x1fd815){logger[_0x480c('0x2e')](_0x1fd815);}return _0x4de79b;}return this['channel'][_0x480c('0x2e')](_0x2acc04,_0x480c('0x157'));};AGIVertices[_0x480c('0x13')][_0x480c('0x158')]=function(_0x3e69ca){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x159'),_0x3e69ca[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x3e69ca[_0x480c('0x15a')])){return this[_0x480c('0x10')]['error'](_0x3e69ca,_0x480c('0x15b'));}logger[_0x480c('0x33')](util[_0x480c('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x480c('0x3e')],_0x3e69ca[_0x480c('0x15a')]));var _0x1cb6b7=this['agentLogin'][_0x480c('0xa4')](this,_0x3e69ca[_0x480c('0x15a')]);if(_0x1cb6b7){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x15c'),this[_0x480c('0x10')][_0x480c('0x3e')],_0x3e69ca[_0x480c('0x15a')]));this[_0x480c('0x10')][_0x480c('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x480c('0x10')][_0x480c('0x3e')],_0x3e69ca['findBy']));return{'code':0xc8,'result':_0x480c('0x15d')};}else{logger[_0x480c('0x33')](util[_0x480c('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x480c('0x10')]['callerid'],_0x3e69ca[_0x480c('0x15a')]));this[_0x480c('0x10')]['noop'](util[_0x480c('0x2b')](_0x480c('0x15e'),this[_0x480c('0x10')]['callerid'],_0x3e69ca['findBy']));return{'code':0xc8,'result':_0x480c('0x15f')};}};AGIVertices['prototype'][_0x480c('0x160')]=function(_0x512316){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x161'),_0x512316[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x512316[_0x480c('0x15a')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x512316,_0x480c('0x15b'));}logger['info'](util[_0x480c('0x2b')](_0x480c('0x162'),this['channel']['callerid'],_0x512316[_0x480c('0x15a')]));var _0x9f18b8=this[_0x480c('0x52')][_0x480c('0xa4')](this,_0x512316[_0x480c('0x15a')]);if(_0x9f18b8){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x480c('0x3e')],_0x512316[_0x480c('0x15a')]));this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x15c'),this[_0x480c('0x10')]['callerid'],_0x512316[_0x480c('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x480c('0x2b')](_0x480c('0x15e'),this['channel']['callerid'],_0x512316['findBy']));this['channel'][_0x480c('0xa8')](util[_0x480c('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x480c('0x10')][_0x480c('0x3e')],_0x512316[_0x480c('0x15a')]));return{'code':0xc8,'result':_0x480c('0x15f')};}};AGIVertices[_0x480c('0x13')][_0x480c('0x163')]=function(_0x2bcfbd){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2bcfbd['label']));if(!this[_0x480c('0x82')](_0x2bcfbd[_0x480c('0x164')])){return this['channel']['error'](_0x2bcfbd,'no\x20operation\x20configured');}this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')]('math\x20%s',_0x2bcfbd[_0x480c('0x164')]));var _0x2db597=eval(_0x2bcfbd[_0x480c('0x164')]);if(!this[_0x480c('0x82')](_0x2bcfbd[_0x480c('0x117')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0x111'));}var _0x597d0b=this[_0x480c('0x14')][_0x480c('0xa4')](this,_0x2bcfbd[_0x480c('0x117')]);if(!_0x597d0b){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x2bcfbd,_0x480c('0xd4'));}if(_[_0x480c('0x99')](_0x2db597)){var _0x1811f9=this;_0x2db597['forEach'](function(_0x4d5022,_0x245b2f){_0x1811f9['channel'][_0x480c('0x9d')](util[_0x480c('0x2b')]('%s[%s]',_0x597d0b,_0x245b2f),_0x4d5022);});return this[_0x480c('0x10')]['noop'](util[_0x480c('0x2b')](_0x480c('0x165'),_0x597d0b));}else{return this['channel'][_0x480c('0x9d')](_0x597d0b,_0x2db597);}};AGIVertices[_0x480c('0x13')][_0x480c('0xe')]=function(_0x2e7524){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x166'),_0x2e7524[_0x480c('0x3b')]));if(_0x2e7524['retry']===0x0){return this['maxRetry'](_0x2e7524);}_0x2e7524[_0x480c('0xa5')]-=0x1;if(!this[_0x480c('0x82')](_0x2e7524[_0x480c('0x10f')])){return this['channel'][_0x480c('0x2e')](_0x2e7524,_0x480c('0x10d'));}var _0x54c73a=this[_0x480c('0x10e')][_0x480c('0xa4')](this,_0x2e7524[_0x480c('0x10f')]);if(!_0x54c73a){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x2e7524,_0x480c('0x110'));}var _0x475ecd=this[_0x480c('0x10')]['getData'](_0x54c73a,_0x2e7524[_0x480c('0x113')],_0x2e7524[_0x480c('0x167')]);var _0x5bbd97=_0x475ecd['result'];if(_0x475ecd[_0x480c('0xa2')]===-0x1){this['createSquareDetailsReport'][_0x480c('0xa4')](this,_0x2e7524,'-1');return _0x475ecd;}else if(_0x475ecd[_0x480c('0xa0')]===_0x480c('0x64')){_0x475ecd[_0x480c('0xa2')]=_0x475ecd[_0x480c('0xa2')][_0x480c('0x9a')]>0x0?_0x475ecd[_0x480c('0xa2')]:'t';}else if(_[_0x480c('0x45')](_0x475ecd[_0x480c('0xa2')])){_0x475ecd[_0x480c('0xa2')]='#';_0x5bbd97='#';}if(!this[_0x480c('0x82')](_0x2e7524[_0x480c('0x117')])){this[_0x480c('0x10')][_0x480c('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x92c38a=this[_0x480c('0x14')][_0x480c('0xa4')](this,_0x2e7524['variable_id']);if(!_0x92c38a){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x2e7524,_0x480c('0xd4'));}this[_0x480c('0x10')][_0x480c('0x9d')](_0x92c38a,_0x5bbd97);}this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x2e7524,_0x5bbd97);return _0x475ecd;};AGIVertices[_0x480c('0x13')][_0x480c('0xa8')]=function(_0x766d75){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x168'),_0x766d75[_0x480c('0x3b')]));return this['channel'][_0x480c('0xa8')](_0x766d75[_0x480c('0x169')]||_0x766d75['label']);};AGIVertices[_0x480c('0x13')][_0x480c('0x16a')]=function(_0x2443e2){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2443e2[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x2443e2['findBy'])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x2443e2,_0x480c('0x15b'));}logger[_0x480c('0x33')](util[_0x480c('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x480c('0x10')][_0x480c('0x3e')],_0x2443e2[_0x480c('0x15a')]));var _0x2b3b79=this[_0x480c('0x4d')][_0x480c('0xa4')](this,_0x2443e2[_0x480c('0x16b')]);var _0x1e7634=this[_0x480c('0x4f')][_0x480c('0xa4')](this,_0x2443e2[_0x480c('0x15a')],_0x2b3b79);if(_0x1e7634){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x15c'),this[_0x480c('0x10')][_0x480c('0x3e')],_0x2443e2['findBy']));this['channel']['noop'](util[_0x480c('0x2b')](_0x480c('0x15c'),this['channel']['callerid'],_0x2443e2[_0x480c('0x15a')]));return{'code':0xc8,'result':_0x480c('0x15d')};}else{logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x15e'),this[_0x480c('0x10')]['callerid'],_0x2443e2[_0x480c('0x15a')]));this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x15c'),this['channel'][_0x480c('0x3e')],_0x2443e2[_0x480c('0x15a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x480c('0x13')][_0x480c('0x16c')]=function(_0x3e7c0f){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3e7c0f[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x3e7c0f['file_id'])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x3e7c0f,_0x480c('0x10d'));}var _0x503aef=this[_0x480c('0x10e')][_0x480c('0xa4')](this,_0x3e7c0f[_0x480c('0x10f')]);if(!_0x503aef){return this['channel'][_0x480c('0x2e')](_0x3e7c0f,_0x480c('0x110'));}var _0x1a3e3d=this['channel']['exec'](_0x480c('0x16d'),[_0x503aef,_0x3e7c0f[_0x480c('0x109')]]);if(_0x1a3e3d[_0x480c('0xa2')]===-0x1){return _0x1a3e3d;}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xbd'),_0x480c('0x16d'),_0x503aef));};AGIVertices[_0x480c('0x13')][_0x480c('0x16e')]=function(_0x58d671){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x16f'),_0x58d671[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x58d671['queue_id'])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x58d671,_0x480c('0x170'));}var _0xb164df='';var _0x12403d=parseInt(_0x58d671[_0x480c('0x171')],0xa);if(isNaN(_0x12403d)){_0xb164df=_0x58d671[_0x480c('0x171')];}else{_0xb164df=this['getVoiceQueue'][_0x480c('0xa4')](this,_0x58d671[_0x480c('0x171')]);if(!_0xb164df){return this['channel']['error'](_0x58d671,'no\x20queue\x20found');}}var _0x5cdba3='';if(this[_0x480c('0x82')](_0x58d671[_0x480c('0x10f')])){var _0x50a966=this[_0x480c('0x10e')][_0x480c('0xa4')](this,_0x58d671['file_id']);if(_0x50a966){_0x5cdba3=_0x50a966;}}this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x58d671,_0xb164df);if(_0x58d671[_0x480c('0x109')][_0x480c('0x172')]('x')<0x0){_0x58d671[_0x480c('0x109')]+='x';}if(_0x58d671[_0x480c('0x109')][_0x480c('0x172')]('X')<0x0){_0x58d671[_0x480c('0x109')]+='X';}this[_0x480c('0x10')][_0x480c('0x9d')](_0x480c('0x173'),_0xb164df?_0xb164df[_0x480c('0x174')]():'');var _0xbf8d8f=this[_0x480c('0x10')]['exec'](_0x480c('0x175'),[_0xb164df,_0x58d671[_0x480c('0x109')],_0x58d671['url'],_0x5cdba3,_0x58d671['timeout'],_0x58d671[_0x480c('0x8')],_0x58d671[_0x480c('0x176')],_0x58d671[_0x480c('0x177')],'',_0x58d671[_0x480c('0x178')]]);if(_0xbf8d8f[_0x480c('0xa2')]===-0x1){return _0xbf8d8f;}return this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0xbd'),_0x480c('0x175'),_0xb164df));};AGIVertices['prototype']['record']=function(_0x1287be){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x179'),_0x1287be[_0x480c('0x3b')]));var _0xc7aa49=_0x1287be['recordingFormat']||'wav';var _0x56ffde=util[_0x480c('0x2b')](_0x480c('0x17a'),this[_0x480c('0x10')]['uniqueid'],rs[_0x480c('0x11c')](0x5));var _0xddf277=util[_0x480c('0x2b')](_0x480c('0x17b'),FILES_PATH,_0x56ffde,_0xc7aa49);var _0xbdd94c=util[_0x480c('0x2b')]('%s/recordings/%s',FILES_PATH,_0x56ffde);this[_0x480c('0x3f')]['sync'](this,_0x1287be,_0x56ffde,_0xddf277);this[_0x480c('0x10')][_0x480c('0x9d')](_0x480c('0x17c'),_0x56ffde);logger['info'](_0x480c('0x17d'),_0xbdd94c,_0xc7aa49,_0x1287be[_0x480c('0x17e')],_0x1287be[_0x480c('0x64')]);return this['channel'][_0x480c('0x139')](_0xbdd94c,_0xc7aa49,_0x1287be[_0x480c('0x17e')],_0x1287be['timeout'],undefined,!![]);};AGIVertices[_0x480c('0x13')][_0x480c('0x17f')]=function(_0x443e76){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x180'),_0x443e76[_0x480c('0x3b')]));if(!this['isConfigured'](_0x443e76[_0x480c('0x63')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0x181'));}var _0x1e087e=this[_0x480c('0x182')][_0x480c('0xa4')](this,_0x443e76);logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x183'),util[_0x480c('0x184')](_0x1e087e,{'showHidden':![],'depth':null})));if(!this[_0x480c('0x82')](_0x443e76[_0x480c('0x117')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0x185'));}var _0x98ee81=this[_0x480c('0x14')][_0x480c('0xa4')](this,_0x443e76['variable_id']);if(!_0x98ee81){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x443e76,_0x480c('0xd4'));}this[_0x480c('0x10')][_0x480c('0x9d')](util[_0x480c('0x2b')](_0x480c('0x186'),_0x98ee81),_0x1e087e[_0x480c('0x73')]?_0x1e087e[_0x480c('0x73')]:_0x480c('0x187'));this[_0x480c('0x10')][_0x480c('0x9d')](util['format'](_0x480c('0x188'),_0x98ee81),_0x1e087e['statusMessage']?_0x1e087e[_0x480c('0x189')]:'OK');if(_0x1e087e[_0x480c('0x6b')]){try{this['saveRestApiResult'](_0x1e087e[_0x480c('0x6b')],_0x98ee81);}catch(_0x1dbbee){logger[_0x480c('0x2e')](util['format'](_0x480c('0x18a'),_0x98ee81));}}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xd8'),_0x98ee81));};AGIVertices[_0x480c('0x13')][_0x480c('0x18b')]=function(_0x182565){logger['info'](util[_0x480c('0x2b')](_0x480c('0x18c'),_0x182565[_0x480c('0x3b')]));return this['channel'][_0x480c('0x18d')](_0x182565[_0x480c('0x18e')]['replace'](/\s+/g,''),_0x182565[_0x480c('0x17e')]);};AGIVertices[_0x480c('0x13')][_0x480c('0x18f')]=function(_0x52e501){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x190'),_0x52e501[_0x480c('0x3b')]));return this['channel']['sayNumber'](_0x52e501[_0x480c('0x65')][_0x480c('0x59')](/\s+/g,''),_0x52e501['escape_digits']);};AGIVertices[_0x480c('0x13')][_0x480c('0x191')]=function(_0x4dd960){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4dd960[_0x480c('0x3b')]));return this['channel']['sayPhonetic'](_0x4dd960[_0x480c('0x5d')],_0x4dd960['escape_digits']);};AGIVertices[_0x480c('0x13')]['sendMail']=function(_0x5e07bc){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x192'),_0x5e07bc['label']));if(!this[_0x480c('0x82')](_0x5e07bc[_0x480c('0x193')])){return this['channel'][_0x480c('0xa8')](_0x480c('0x194'));}var _0x48a301=this[_0x480c('0x23')][_0x480c('0xa4')](this,_0x5e07bc[_0x480c('0x193')]);if(!_0x48a301||!_0x48a301[_0x480c('0x195')]){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x5e07bc,_0x480c('0x196'));}var _0x2632ea={'from':util[_0x480c('0x2b')](_0x480c('0x197'),_0x48a301[_0x480c('0x17')],_0x48a301[_0x480c('0x198')]||_0x48a301[_0x480c('0x195')][_0x480c('0x199')]),'to':_0x5e07bc['to']||'','cc':_0x5e07bc['cc']||'','bcc':_0x5e07bc['bcc']||'','subject':_0x5e07bc[_0x480c('0x19a')],'html':_0x5e07bc[_0x480c('0x5d')],'text':_0x5e07bc[_0x480c('0x5d')]};var _0x3e50cd={'tls':{'rejectUnauthorized':![]}};if(_0x48a301[_0x480c('0x195')][_0x480c('0x19b')]){_0x3e50cd['service']=_0x48a301[_0x480c('0x195')][_0x480c('0x19b')];}else{_0x3e50cd[_0x480c('0x19c')]=_0x48a301[_0x480c('0x195')][_0x480c('0x19c')];_0x3e50cd[_0x480c('0x19d')]=_0x48a301[_0x480c('0x195')][_0x480c('0x19d')];_0x3e50cd['secure']=_0x48a301[_0x480c('0x195')][_0x480c('0x19e')];}if(_0x48a301[_0x480c('0x195')][_0x480c('0x19f')]){_0x3e50cd['auth']={'user':_0x48a301['Smtp'][_0x480c('0x199')],'pass':_0x48a301[_0x480c('0x195')][_0x480c('0x1a0')]};}if(this[_0x480c('0x82')](_0x5e07bc[_0x480c('0x1a1')])){}logger[_0x480c('0xda')](_0x480c('0x1a2'),JSON[_0x480c('0x71')](_0x2632ea));this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x5e07bc,_0x5e07bc[_0x480c('0x193')]);this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x48a301[_0x480c('0x17')]));this[_0x480c('0x24')][_0x480c('0xa4')](this,_0x3e50cd,_0x2632ea);return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0x1a3'));};AGIVertices[_0x480c('0x13')][_0x480c('0x1a4')]=function(_0x7d1c2e){logger['info'](util[_0x480c('0x2b')](_0x480c('0x1a5'),_0x7d1c2e[_0x480c('0x3b')]));return this[_0x480c('0x10')][_0x480c('0xa8')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x480c('0x13')][_0x480c('0x1a6')]=function(_0xbd0d7c){logger['info'](util[_0x480c('0x2b')](_0x480c('0x1a7'),_0xbd0d7c['label']));if(!this[_0x480c('0x82')](_0xbd0d7c[_0x480c('0x1a8')])){return this[_0x480c('0x10')]['noop'](_0x480c('0x1a9'));}var _0x3b14f8=this[_0x480c('0x36')]['sync'](this,_0xbd0d7c[_0x480c('0x1a8')]);if(!_0x3b14f8){return this[_0x480c('0x10')][_0x480c('0x2e')](_0xbd0d7c,'no\x20sms\x20account\x20found');}var _0x449b7b={'body':_0xbd0d7c[_0x480c('0x1aa')],'phone':_0xbd0d7c['to']||'','SmsAccountId':_0x3b14f8['id']};logger[_0x480c('0xda')](_0x480c('0x1ab'),JSON[_0x480c('0x71')](_0x449b7b));this[_0x480c('0x39')][_0x480c('0xa4')](this,_0xbd0d7c,_0xbd0d7c[_0x480c('0x1a8')]);this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x1ac'),_0x3b14f8['name']));this[_0x480c('0x38')][_0x480c('0xa4')](this,_0x449b7b);return this['channel'][_0x480c('0xa8')](_0x480c('0x1ad'));};AGIVertices[_0x480c('0x13')]['set']=function(_0x11c12b){logger[_0x480c('0x33')](util['format'](_0x480c('0x1ae'),_0x11c12b[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x11c12b[_0x480c('0x117')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x11c12b,_0x480c('0x1af'));}var _0x52f2e3=this[_0x480c('0x14')][_0x480c('0xa4')](this,_0x11c12b['variable_id']);if(!_0x52f2e3){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x11c12b,'no\x20variable\x20found');}return this[_0x480c('0x10')][_0x480c('0x9d')](_0x52f2e3,_0x11c12b[_0x480c('0x1b0')]);};AGIVertices[_0x480c('0x13')]['start']=function(_0x228a0d){logger[_0x480c('0x33')](util['format'](_0x480c('0x1b1'),_0x228a0d['label']));this['channel'][_0x480c('0xa8')]('START\x20CALLY\x20SQUARE');if(_0x228a0d['answer']==='yes'){this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0x1b2'));return this['channel'][_0x480c('0x1b3')]();}return this[_0x480c('0x10')]['noop']('Skipped\x20Answer');};AGIVertices[_0x480c('0x13')]['subproject']=function(_0x109716){logger['info'](util[_0x480c('0x2b')](_0x480c('0x1b4'),_0x109716[_0x480c('0x3b')]));if(!this[_0x480c('0x82')](_0x109716['project_id'])){return this[_0x480c('0x10')]['error'](_0x109716,_0x480c('0x1b5'));}var _0xe163a=this[_0x480c('0x1a')][_0x480c('0xa4')](this,_0x109716['project_id']);if(!this[_0x480c('0x82')](_0xe163a)){return this['channel'][_0x480c('0x2e')](_0x109716,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x109716[_0x480c('0x1b6')]));}if(_0xe163a===this[_0x480c('0x10')][_0x480c('0x3d')]){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x109716,_0x480c('0x1b7'));}this['createSquareDetailsReport'][_0x480c('0xa4')](this,_0x109716,_0xe163a);var _0x3d0933=this[_0x480c('0x10')][_0x480c('0x57')]('AGI',util[_0x480c('0x2b')](_0x480c('0x1b8'),config[_0x480c('0x8')]['host']||_0x480c('0x1b9'),_0xe163a,this[_0x480c('0x10')][_0x480c('0x3d')]));if(_0x3d0933[_0x480c('0xa2')]===-0x1){return _0x3d0933;}return this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0xbd'),_0x480c('0x1ba'),_0xe163a));};AGIVertices[_0x480c('0x13')][_0x480c('0x1bb')]=function(_0x5692c3){logger[_0x480c('0x33')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5692c3[_0x480c('0x3b')]));var _0x202923=this[_0x480c('0x56')]['sync'](this,_0x5692c3[_0x480c('0x1bc')]);this[_0x480c('0x39')][_0x480c('0xa4')](this,_0x5692c3,_0x5692c3[_0x480c('0x1bc')]);if(this[_0x480c('0x82')](_0x5692c3[_0x480c('0x117')])){var _0x43e803=this[_0x480c('0x14')][_0x480c('0xa4')](this,_0x5692c3[_0x480c('0x117')]);if(_0x43e803){this['channel'][_0x480c('0x9d')](_0x43e803,_0x202923);return this['channel']['noop'](util[_0x480c('0x2b')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5692c3['command'],_0x43e803));}}return this['channel'][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x1bd'),_0x5692c3[_0x480c('0x1bc')]));};AGIVertices[_0x480c('0x13')][_0x480c('0x1be')]=function(_0x162999){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x1bf'),_0x162999['label']));_0x162999[_0x480c('0x5d')]=_0x162999[_0x480c('0x5d')][_0x480c('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x480c('0x82')](_0x162999[_0x480c('0x5b')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0x1c0'));}if(!this['isConfigured'](_0x162999['text'])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xc0'));}this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')](_0x480c('0x1c1'),_0x162999['text']));var _0x3a6979=this[_0x480c('0x5a')]['sync'](this,_0x162999);if(_0x3a6979){this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0x1c2'),_0x3a6979));var _0x3e3d2a=this[_0x480c('0x10')]['streamFile'](_0x3a6979);try{fs[_0x480c('0xff')](_0x3a6979+_0x480c('0x100'));}catch(_0x10fed1){logger['error'](_0x10fed1);}return _0x3e3d2a;}return this[_0x480c('0x10')]['error'](_0x162999,_0x480c('0x1c3'));};AGIVertices[_0x480c('0x13')][_0x480c('0x1c4')]=function(_0x2e7c17){logger[_0x480c('0x33')](util[_0x480c('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2e7c17['label']));_0x2e7c17['text']=_0x2e7c17[_0x480c('0x5d')][_0x480c('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2e7c17[_0x480c('0x5d')])){return this[_0x480c('0x10')][_0x480c('0xa8')](_0x480c('0xc0'));}this[_0x480c('0x10')]['noop'](util[_0x480c('0x2b')](_0x480c('0x1c5'),_0x2e7c17[_0x480c('0x5d')]));var _0x335ec7=this[_0x480c('0x62')]['sync'](this,_0x2e7c17);if(_0x335ec7){this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0x1c6'),_0x335ec7));var _0x476ca6=this[_0x480c('0x10')][_0x480c('0xfe')](_0x335ec7);try{fs[_0x480c('0xff')](_0x335ec7+_0x480c('0x100'));}catch(_0xde29c5){logger['error'](_0xde29c5);}return _0x476ca6;}return this[_0x480c('0x10')][_0x480c('0x2e')](_0x2e7c17,_0x480c('0x1c7'));};AGIVertices[_0x480c('0x13')][_0x480c('0x1c8')]=function(_0x13bd8e){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x1c9'),_0x13bd8e[_0x480c('0x3b')]));if(!this['isConfigured'](_0x13bd8e['findBy'])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x13bd8e,_0x480c('0x15b'));}logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x162'),this['channel'][_0x480c('0x3e')],_0x13bd8e[_0x480c('0x15a')]));var _0x1121de=this[_0x480c('0x50')][_0x480c('0xa4')](this,_0x13bd8e[_0x480c('0x15a')]);if(_0x1121de){logger['info'](util[_0x480c('0x2b')](_0x480c('0x15c'),this[_0x480c('0x10')][_0x480c('0x3e')],_0x13bd8e[_0x480c('0x15a')]));this[_0x480c('0x10')][_0x480c('0xa8')](util[_0x480c('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x480c('0x10')][_0x480c('0x3e')],_0x13bd8e[_0x480c('0x15a')]));return{'code':0xc8,'result':_0x480c('0x15d')};}else{logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x15e'),this[_0x480c('0x10')]['callerid'],_0x13bd8e['findBy']));this['channel']['noop'](util[_0x480c('0x2b')](_0x480c('0x15e'),this['channel']['callerid'],_0x13bd8e['findBy']));return{'code':0xc8,'result':_0x480c('0x15f')};}};AGIVertices[_0x480c('0x13')][_0x480c('0x1ca')]=function(_0x32f584){logger[_0x480c('0x33')](util['format'](_0x480c('0x1cb'),_0x32f584[_0x480c('0x3b')]));var _0x13755a=this[_0x480c('0x10')][_0x480c('0x57')](_0x480c('0x1cc'),[_0x32f584[_0x480c('0x1cd')],_0x32f584[_0x480c('0x75')]]);if(_0x13755a['result']===-0x1){return _0x13755a;}return this[_0x480c('0x10')][_0x480c('0xa8')](util['format'](_0x480c('0xbd'),_0x480c('0x1cc'),_0x32f584['mailbox']));};AGIVertices[_0x480c('0x13')][_0x480c('0x1ce')]=function(_0x4573b7){logger[_0x480c('0x33')](util[_0x480c('0x2b')](_0x480c('0x1cf'),_0x4573b7['label']));if(!this['isConfigured'](_0x4573b7[_0x480c('0x117')])){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x4573b7,_0x480c('0x1af'));}var _0x194cba=this['getVariable']['sync'](this,_0x4573b7[_0x480c('0x117')]);if(!_0x194cba){return this[_0x480c('0x10')][_0x480c('0x2e')](_0x4573b7,'no\x20variable\x20found');}var _0x5734b2=this[_0x480c('0x10')]['getVariable'](_0x194cba);return{'code':0xc8,'result':_0x5734b2[_0x480c('0xa0')]?_0x5734b2[_0x480c('0xa0')]:'-'};};String[_0x480c('0x13')]['replaceAll']=function(_0x4c0524,_0x520267){return this[_0x480c('0x9e')](_0x4c0524)[_0x480c('0x1d0')](_0x520267);};module[_0x480c('0x1d1')]=AGIVertices; \ No newline at end of file +var _0x46c2=['lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agentLogout','agent','internal','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','restAPI','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','aws_access_key_id','aws_secret_access_key','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','clear','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','split','extra','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','replace','query:\x20%s','variable_id','forEach','keys','setVariable','%s[%s][%s]','variable\x20%s\x20set','dial','debug','no\x20user\x20selected','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','awslex','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','appsecret','no\x20appsecret\x20configured','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','agentLogin','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','template_id','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\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','project_id','no\x20subproject\x20selected','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','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','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','success','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','replaceAll','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','getVariableById','then','catch','prototype','getVoiceQueue','name','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','mailRpc','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','callerid','createSquareRecording','context','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random'];(function(_0x2303dd,_0x401c3d){var _0x4ada61=function(_0xde40ff){while(--_0xde40ff){_0x2303dd['push'](_0x2303dd['shift']());}};_0x4ada61(++_0x401c3d);}(_0x46c2,0x180));var _0x246c=function(_0x822939,_0x34bc67){_0x822939=_0x822939-0x0;var _0x476773=_0x46c2[_0x822939];return _0x476773;};'use strict';var fs=require('fs');var path=require(_0x246c('0x0'));var util=require(_0x246c('0x1'));var _=require(_0x246c('0x2'));var sh=require(_0x246c('0x3'));var odbc=require(_0x246c('0x4'))();var rs=require(_0x246c('0x5'));var moment=require(_0x246c('0x6'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var scripts=require(_0x246c('0x7'));var FILES_PATH=_0x246c('0x8');var recursiveMapAttributes=[_0x246c('0x9'),_0x246c('0xa')];var verticesWithRetry=['menu',_0x246c('0xb'),_0x246c('0xc')];var AGIVertices=function(_0x490646,_0x44d3c3,_0x29e920){this['channel']=_0x490646;this['rpc']=_0x44d3c3;this['mailRpc']=_0x29e920;};AGIVertices['prototype']['getVariable']=function(_0x555622,_0xf30d80){this[_0x246c('0xd')][_0x246c('0xe')](_0x555622)[_0x246c('0xf')](function(_0x4e13d5){_0xf30d80(null,_0x4e13d5?_0x4e13d5['name']:![]);})[_0x246c('0x10')](function(_0x197ace){_0xf30d80(_0x197ace);});};AGIVertices[_0x246c('0x11')][_0x246c('0x12')]=function(_0x37cee3,_0x275d3f){this[_0x246c('0xd')]['getVoiceQueueById'](_0x37cee3)[_0x246c('0xf')](function(_0x525e79){_0x275d3f(null,_0x525e79?_0x525e79[_0x246c('0x13')]:![]);})['catch'](function(_0x36cf11){_0x275d3f(_0x36cf11);});};AGIVertices[_0x246c('0x11')]['getSquareProject']=function(_0x1aa0df,_0x485b71){this['rpc'][_0x246c('0x14')](_0x1aa0df)[_0x246c('0xf')](function(_0x38181b){_0x485b71(null,_0x38181b?_0x38181b[_0x246c('0x13')]:![]);})[_0x246c('0x10')](function(_0x42c691){_0x485b71(_0x42c691);});};AGIVertices[_0x246c('0x11')][_0x246c('0x15')]=function(_0x3fb06d,_0x45f8e5){this[_0x246c('0xd')][_0x246c('0x16')](_0x3fb06d)[_0x246c('0xf')](function(_0xffd906){_0x45f8e5(null,_0xffd906?_0xffd906[_0x246c('0x17')]:![]);})[_0x246c('0x10')](function(_0x2734e2){_0x45f8e5(_0x2734e2);});};AGIVertices[_0x246c('0x11')][_0x246c('0x18')]=function(_0x28c3f1,_0x3d4f23){this[_0x246c('0xd')][_0x246c('0x19')](_0x28c3f1)[_0x246c('0xf')](function(_0xf082ab){_0x3d4f23(null,_0xf082ab?_0xf082ab['name']:![]);})[_0x246c('0x10')](function(_0x1802bc){_0x3d4f23(_0x1802bc);});};AGIVertices[_0x246c('0x11')][_0x246c('0x1a')]=function(_0x529071,_0x42c858){this[_0x246c('0xd')][_0x246c('0x1b')](_0x529071)[_0x246c('0xf')](function(_0xad305b){_0x42c858(null,_0xad305b?_0xad305b[_0x246c('0x13')]:![]);})[_0x246c('0x10')](function(_0x588dd8){_0x42c858(_0x588dd8);});};AGIVertices[_0x246c('0x11')][_0x246c('0x1c')]=function(_0x324fe3,_0x4e3185){var _0x5259e8=this;this[_0x246c('0xd')][_0x246c('0x1d')](_0x324fe3)[_0x246c('0xf')](function(_0x21d21b){_0x4e3185(null,_0x21d21b?_0x5259e8[_0x246c('0x1e')](_0x21d21b[_0x246c('0x1f')]):![]);})[_0x246c('0x10')](function(_0x563994){_0x4e3185(_0x563994);});};AGIVertices[_0x246c('0x11')][_0x246c('0x20')]=function(_0x2766a5,_0xc0e53){this[_0x246c('0xd')]['getMailAccountById'](_0x2766a5)['then'](function(_0x50608a){_0xc0e53(null,_0x50608a?_0x50608a:![]);})[_0x246c('0x10')](function(_0xf968ae){_0xc0e53(_0xf968ae);});};AGIVertices[_0x246c('0x11')]['sendMailMessage']=function(_0x13f0c7,_0x230777,_0x4733f2){this[_0x246c('0x21')]['sendMailMessage'](_0x13f0c7,_0x230777)[_0x246c('0xf')](function(){_0x4733f2(null);})[_0x246c('0x10')](function(_0x4da1ce){_0x4733f2(_0x4da1ce);});};AGIVertices[_0x246c('0x11')][_0x246c('0x22')]=function(_0x5d70d6,_0xd27bc4){this[_0x246c('0xd')]['getIntervalById'](_0x5d70d6)['then'](function(_0x14da6c){if(_0x14da6c){if(_0x14da6c[_0x246c('0x23')]){_0xd27bc4(null,[_0x14da6c[_0x246c('0x24')]]);}else{_0xd27bc4(null,_[_0x246c('0x25')](_0x14da6c['Intervals'],_0x246c('0x24')));}}else{_0xd27bc4(null,![]);}})[_0x246c('0x10')](function(_0x1584b4){_0xd27bc4(_0x1584b4);});};AGIVertices[_0x246c('0x11')][_0x246c('0x1e')]=function(_0x14c283){return util[_0x246c('0x26')](_0x246c('0x27'),FILES_PATH,_0x14c283);};AGIVertices[_0x246c('0x11')][_0x246c('0x28')]=function(_0xbbd962,_0x48f476,_0x5d23f1){odbc['open'](_0xbbd962,function(_0x28c338){if(_0x28c338){logger[_0x246c('0x29')](_0x246c('0x2a'),_0x28c338);_0x5d23f1(_0x28c338);}else{logger[_0x246c('0x2b')](_0x246c('0x2c'));odbc['query'](_0x48f476,function(_0x4ba292,_0x14309e){if(_0x4ba292){logger['info'](_0x246c('0x2d'),_0x48f476);_0x5d23f1(_0x4ba292);}else{logger[_0x246c('0x2b')](_0x246c('0x2e'),_0x48f476);odbc[_0x246c('0x2f')](function(_0x4531b6){if(_0x4531b6){logger[_0x246c('0x29')](_0x246c('0x30'),_0x4531b6);}_0x5d23f1(null,_0x14309e);});}});}});};AGIVertices[_0x246c('0x11')]['getSmsAccount']=function(_0x10a593,_0x4e2ab6){this[_0x246c('0xd')][_0x246c('0x31')](_0x10a593)['then'](function(_0xbcc3f2){_0x4e2ab6(null,_0xbcc3f2?_0xbcc3f2:![]);})[_0x246c('0x10')](function(_0x45f157){_0x4e2ab6(_0x45f157);});};AGIVertices['prototype'][_0x246c('0x32')]=function(_0x3d36d7,_0x543f60){this[_0x246c('0xd')][_0x246c('0x32')](_0x3d36d7)[_0x246c('0xf')](function(_0x12a490){_0x543f60(null,_0x12a490);})[_0x246c('0x10')](function(_0x27aa7f){_0x543f60(_0x27aa7f);});};AGIVertices[_0x246c('0x11')]['createSquareDetailsReport']=function(_0x2ea637,_0x55a91f,_0x364135){this['rpc'][_0x246c('0x33')]({'uniqueid':this[_0x246c('0x34')][_0x246c('0x35')],'node':_0x2ea637[_0x246c('0x36')],'application':_0x2ea637[_0x246c('0x37')],'data':_0x55a91f||null,'project_name':this[_0x246c('0x34')]['arg_1'],'callerid':this[_0x246c('0x34')][_0x246c('0x38')]})[_0x246c('0xf')](function(_0x1f961d){if(_0x364135){_0x364135(null,_0x1f961d);}})['catch'](function(_0x57cad8){if(_0x364135){_0x364135(_0x57cad8);}});};AGIVertices[_0x246c('0x11')][_0x246c('0x39')]=function(_0x1962ab,_0x4b3db9,_0x1a1f1e,_0x341373){this[_0x246c('0xd')]['createSquareRecording']({'uniqueid':this[_0x246c('0x34')][_0x246c('0x35')],'callerid':this['channel'][_0x246c('0x38')],'calleridname':this[_0x246c('0x34')]['calleridname'],'context':this[_0x246c('0x34')][_0x246c('0x3a')],'extension':this['channel']['extension'],'priority':this['channel']['priority'],'accountcode':this[_0x246c('0x34')][_0x246c('0x3b')],'dnid':this['channel'][_0x246c('0x3c')],'projectName':this[_0x246c('0x34')][_0x246c('0x3d')],'saveName':_0x4b3db9,'filename':_0x1962ab[_0x246c('0x3e')]||_0x4b3db9,'savePath':_0x1a1f1e})[_0x246c('0xf')](function(_0x187551){_0x341373(null,_0x187551);})[_0x246c('0x10')](function(_0x1fb60e){_0x341373(_0x1fb60e);});};AGIVertices[_0x246c('0x11')][_0x246c('0x3f')]=function(_0x37ac75,_0x233670,_0x2153d7,_0x442bdf,_0x439e3f){this[_0x246c('0xd')][_0x246c('0x3f')]({'uniqueid':this['channel'][_0x246c('0x35')],'body':_0x37ac75,'direction':_0x233670,'providerName':_0x2153d7,'providerResponse':_0x442bdf})[_0x246c('0xf')](function(_0x4cc0c2){if(_0x439e3f){_0x439e3f(null,_0x4cc0c2);}})[_0x246c('0x10')](function(_0x23af88){if(_0x439e3f){_0x439e3f(_0x23af88);}});};AGIVertices['prototype'][_0x246c('0x40')]=function(_0x4a69cc,_0x26ec79){this['rpc']['createCmContact']({'firstName':_[_0x246c('0x41')](_0x4a69cc[_0x246c('0x13')])||_[_0x246c('0x42')](_0x4a69cc[_0x246c('0x13')])?_0x246c('0x43')+Math[_0x246c('0x44')]():_0x4a69cc[_0x246c('0x13')],'lastName':_[_0x246c('0x41')](_0x4a69cc['lastName'])||_['isNil'](_0x4a69cc[_0x246c('0x45')])?null:_0x4a69cc['lastName'],'phone':_0x4a69cc[_0x246c('0x46')],'ListId':_0x4a69cc[_0x246c('0x47')],'scheduledat':_0x4a69cc[_0x246c('0x48')],'callbackUniqueid':this[_0x246c('0x34')][_0x246c('0x35')],'tags':'callback','description':_0x246c('0x49')+_0x4a69cc['scheduledAt'][_0x246c('0x4a')](),'priority':_0x4a69cc[_0x246c('0x4b')]})[_0x246c('0xf')](function(_0x312bbf){_0x26ec79(null,_0x312bbf);})[_0x246c('0x10')](function(_0x26a28d){_0x26ec79(_0x26a28d);});};AGIVertices[_0x246c('0x11')][_0x246c('0x4c')]=function(_0x258962,_0x2dc0f3){this[_0x246c('0xd')][_0x246c('0x4d')](_0x258962)[_0x246c('0xf')](function(_0x221ee5){_0x2dc0f3(null,_0x221ee5?_0x221ee5[_0x246c('0x13')]:![]);})[_0x246c('0x10')](function(_0x384715){_0x2dc0f3(_0x384715);});};AGIVertices[_0x246c('0x11')][_0x246c('0x4e')]=function(_0x58274c,_0x16a601,_0x308d21){var _0x24e36f={'role':'agent'};_0x24e36f[_0x58274c]=this[_0x246c('0x34')][_0x246c('0x38')];this['rpc'][_0x246c('0x4e')](_0x24e36f,_0x16a601,this['channel'][_0x246c('0x35')])['then'](function(_0x58b022){_0x308d21(null,_[_0x246c('0x42')](_0x58b022)?![]:!![]);})[_0x246c('0x10')](function(_0x4fb20b){logger[_0x246c('0x29')](_0x4fb20b);_0x308d21(null,![]);});};AGIVertices[_0x246c('0x11')][_0x246c('0x4f')]=function(_0x37e183,_0x2a87fd){var _0x5bf7fb={'role':'agent'};_0x5bf7fb[_0x37e183]=this[_0x246c('0x34')][_0x246c('0x38')];this[_0x246c('0xd')][_0x246c('0x4f')](_0x5bf7fb)[_0x246c('0xf')](function(_0x373915){_0x2a87fd(null,_[_0x246c('0x42')](_0x373915)?![]:!![]);})[_0x246c('0x10')](function(_0x126a22){logger[_0x246c('0x29')](_0x126a22);_0x2a87fd(null,![]);});};AGIVertices['prototype'][_0x246c('0x50')]=function(_0x41c913,_0x2495ac){var _0x5d2fc2={'role':_0x246c('0x51')};_0x5d2fc2[_0x41c913]=this[_0x246c('0x34')][_0x246c('0x38')];this['rpc'][_0x246c('0x50')](_0x5d2fc2)[_0x246c('0xf')](function(_0x6e4203){_0x2495ac(null,_[_0x246c('0x42')](_0x6e4203)?![]:!![]);})[_0x246c('0x10')](function(_0x5b52e4){logger[_0x246c('0x29')](_0x5b52e4);_0x2495ac(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x56066c,_0x5d5957){var _0x5306f3={'role':_0x246c('0x51')};_0x5306f3[_0x56066c]=this[_0x246c('0x34')][_0x246c('0x38')];var _0x479461=_0x56066c!=_0x246c('0x52')?util[_0x246c('0x26')]('%s/%s@from-sip/n','LOCAL',this['channel']['callerid']):undefined;this[_0x246c('0xd')]['agentLogin'](_0x5306f3,_0x479461)[_0x246c('0xf')](function(_0x52c470){_0x5d5957(null,_[_0x246c('0x42')](_0x52c470)?![]:!![]);})[_0x246c('0x10')](function(_0x365f24){logger[_0x246c('0x29')](_0x365f24);_0x5d5957(null,![]);});};AGIVertices[_0x246c('0x11')][_0x246c('0x53')]=function(_0x5242e8,_0x2aed45){sh[_0x246c('0x54')](_[_0x246c('0x55')](_0x5242e8),function(_0x4539a7,_0x5c4e1d){var _0x11e43b=_0x5c4e1d['replace'](/(\r\n|\n|\r)/gm,'');_0x2aed45(null,_0x11e43b);});};AGIVertices[_0x246c('0x11')][_0x246c('0x56')]=function(_0x134ff3,_0x244db4){scripts[_0x246c('0x56')](_0x134ff3['apiKey'],_0x134ff3[_0x246c('0x57')]||'text',_0x134ff3[_0x246c('0x58')],_0x134ff3['languageCode']||_0x246c('0x59'),_0x134ff3[_0x246c('0x5a')]||'MALE',_0x134ff3['audioEncoding']||'MP3')[_0x246c('0xf')](function(_0x426de9){_0x244db4(null,_0x426de9);})['catch'](function(_0x45e3f5){_0x244db4(_0x45e3f5);});};AGIVertices[_0x246c('0x11')]['googleTTS']=function(_0x12b43b,_0x450b07){scripts['googleTTS'](_0x12b43b[_0x246c('0x58')],_0x12b43b['google_tts_language']||'en',0x1)[_0x246c('0xf')](function(_0x55fefb){_0x450b07(null,_0x55fefb);})['catch'](function(_0x460405){_0x450b07(_0x460405);});};AGIVertices[_0x246c('0x11')][_0x246c('0x5b')]=function(_0x4856d8,_0x435ffc){var _0x443729={'uri':_0x4856d8['url'],'method':_0x4856d8[_0x246c('0x5c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4856d8[_0x246c('0x5d')])===_0x246c('0x5e')&&parseInt(_0x4856d8[_0x246c('0x5d')])>=0x1?parseInt(_0x4856d8['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x246c('0x5f')]([_0x246c('0x60'),_0x246c('0x61')],_0x443729['method'][_0x246c('0x62')]())){try{_0x443729[_0x246c('0x63')]=_0x4856d8[_0x246c('0xa')]?JSON['parse'](_0x4856d8[_0x246c('0xa')]):{};}catch(_0x2fa203){logger[_0x246c('0x29')](_0x246c('0x64'),_0x2fa203);}}try{_0x443729[_0x246c('0x65')]=_0x4856d8['rawHeaders']?JSON[_0x246c('0x66')](_0x4856d8[_0x246c('0x9')]):{};}catch(_0x528b4e){logger[_0x246c('0x29')](_0x246c('0x67'),_0x528b4e);}if(_0x4856d8[_0x246c('0x68')]){try{var _0x218134=require(_0x4856d8[_0x246c('0x68')])[_0x246c('0x69')](this,_0x443729);_0x443729[_0x246c('0x6a')]=Mustache[_0x246c('0x6b')](_0x4856d8[_0x246c('0x6c')],_0x218134,{},['$$','$$']);if(_0x443729[_0x246c('0x65')]){_0x443729[_0x246c('0x65')]=JSON[_0x246c('0x66')](Mustache['render'](JSON[_0x246c('0x6d')](_0x443729[_0x246c('0x65')]),_0x218134,{},['$$','$$']));}if(_0x443729[_0x246c('0x63')]){_0x443729[_0x246c('0x63')]=JSON[_0x246c('0x66')](Mustache[_0x246c('0x6b')](JSON['stringify'](_0x443729[_0x246c('0x63')]),_0x218134,{},['$$','$$']));}}catch(_0x123bee){logger['error'](_0x246c('0x6e'),_0x123bee);}}rp(_0x443729)[_0x246c('0xf')](function(_0x461e28){var _0x5d25aa={'statusCode':_0x461e28['statusCode']||0xc8,'statusMessage':_0x461e28[_0x246c('0x6f')]||'OK','headers':_0x461e28['headers']||{},'body':_0x461e28[_0x246c('0x63')]||{}};_0x435ffc(null,_0x5d25aa);})[_0x246c('0x10')](function(_0xb391f3){var _0x5a1176={'statusCode':_0xb391f3['statusCode']||0x1f4,'statusMessage':_0xb391f3[_0x246c('0x70')]||_0x246c('0x71'),'headers':_0xb391f3[_0x246c('0x72')][_0x246c('0x65')]||{},'body':_0xb391f3[_0x246c('0x72')][_0x246c('0x63')]||{}};_0x435ffc(null,_0x5a1176);});};AGIVertices[_0x246c('0x11')]['googleDialogflow']=function(_0x4bb8eb,_0x5d91cb){scripts[_0x246c('0x73')](this[_0x246c('0x34')][_0x246c('0x35')],_0x4bb8eb[_0x246c('0x74')],_0x4bb8eb[_0x246c('0x58')],_0x4bb8eb[_0x246c('0x75')]||'en')[_0x246c('0xf')](function(_0x276b19){_0x5d91cb(null,_0x276b19);})[_0x246c('0x10')](function(_0x3956b6){_0x5d91cb(_0x3956b6);});};AGIVertices[_0x246c('0x11')]['googleDialogflowV2']=function(_0x5114cc,_0x135e04){scripts[_0x246c('0x76')](this[_0x246c('0x34')]['uniqueid'],_0x5114cc['dialogflowV2_project_id'],_0x5114cc[_0x246c('0x77')],_0x5114cc['private_key'],_0x5114cc[_0x246c('0x58')],_0x5114cc[_0x246c('0x78')]||'en')[_0x246c('0xf')](function(_0x262f36){_0x135e04(null,_0x262f36);})['catch'](function(_0x380fdd){_0x135e04(_0x380fdd);});};AGIVertices[_0x246c('0x11')][_0x246c('0x79')]=function(_0x538461,_0xef5b95){scripts[_0x246c('0x79')](this[_0x246c('0x34')],_0x538461)[_0x246c('0xf')](function(_0x260ba2){_0xef5b95(null,_0x260ba2);})['catch'](function(_0x30cbcf){_0xef5b95(_0x30cbcf);});};AGIVertices['prototype'][_0x246c('0x7a')]=function(_0x30f547,_0x3dfb1a){scripts['ispeechTTS'](_0x30f547['key'],_0x30f547[_0x246c('0x58')],_0x30f547['ispeech_tts_language']||_0x246c('0x59'),_0x30f547[_0x246c('0x7b')])[_0x246c('0xf')](function(_0x7a339){_0x3dfb1a(null,_0x7a339);})[_0x246c('0x10')](function(_0x34deb0){_0x3dfb1a(_0x34deb0);});};AGIVertices[_0x246c('0x11')][_0x246c('0x7c')]=function(_0x17097f,_0x127b6f,_0x2988df){scripts[_0x246c('0x7c')](_0x127b6f,_0x17097f[_0x246c('0x74')],_0x17097f['ispeech_asr_language']||_0x246c('0x59'),this['isConfigured'](_0x17097f['model'])?_0x17097f['model']:undefined)[_0x246c('0xf')](function(_0xab8aa9){_0x2988df(null,_0xab8aa9);})[_0x246c('0x10')](function(_0x45f75c){_0x2988df(_0x45f75c);});};AGIVertices[_0x246c('0x11')]['awsPolly']=function(_0x44a320,_0x248865){scripts['awsPolly'](_0x44a320[_0x246c('0x7d')],_0x44a320[_0x246c('0x7e')],_0x44a320['aws_polly_region'],_0x44a320['aws_polly_voice']||'Amy',_0x44a320[_0x246c('0x58')],_0x44a320[_0x246c('0x7f')]||'text')[_0x246c('0xf')](function(_0x4ea908){_0x248865(null,_0x4ea908);})[_0x246c('0x10')](function(_0x2be158){_0x248865(_0x2be158);});};AGIVertices[_0x246c('0x11')][_0x246c('0x80')]=function(_0x58ca48,_0x4d8c4d){scripts[_0x246c('0x80')](this[_0x246c('0x34')]['uniqueid'],_0x58ca48[_0x246c('0x7d')],_0x58ca48[_0x246c('0x7e')],_0x58ca48[_0x246c('0x81')],_0x58ca48[_0x246c('0x58')],_0x58ca48['aws_bot_name'])[_0x246c('0xf')](function(_0x42c3d3){_0x4d8c4d(null,_0x42c3d3);})['catch'](function(_0x19157d){_0x4d8c4d(_0x19157d);});};AGIVertices['prototype'][_0x246c('0x82')]=function(_0x513f37,_0x23ee57,_0xde6799){scripts[_0x246c('0x82')](_0x23ee57,_0x513f37[_0x246c('0x74')],_0x513f37[_0x246c('0x83')]||_0x246c('0x59'))[_0x246c('0xf')](function(_0x382edb){_0xde6799(null,_0x382edb);})[_0x246c('0x10')](function(_0x4d7614){_0xde6799(_0x4d7614);});};AGIVertices[_0x246c('0x11')][_0x246c('0x84')]=function(_0x2a92a9,_0x2cc117,_0x3ae2df){scripts[_0x246c('0x84')](_0x2cc117,_0x2a92a9['appid'],_0x2a92a9['appsecret'],_0x2a92a9['uri'])[_0x246c('0xf')](function(_0x2a0ab2){_0x3ae2df(null,_0x2a0ab2);})[_0x246c('0x10')](function(_0x154755){_0x3ae2df(_0x154755);});};AGIVertices[_0x246c('0x11')][_0x246c('0x85')]=function(_0x7bf11d){var _0x196315=_['includes'](verticesWithRetry,_0x7bf11d[_0x246c('0x37')])?_0x7bf11d:_['clone'](_0x7bf11d);for(var _0x27dec9 in _0x196315){if(_0x196315[_0x246c('0x86')](_0x27dec9)){if(_0x196315[_0x27dec9]&&_['isString'](_0x196315[_0x27dec9])){if(_[_0x246c('0x5f')](recursiveMapAttributes,_0x27dec9)){_0x196315[_0x27dec9]=this[_0x246c('0x87')](_0x196315[_0x27dec9]);}else{_0x196315[_0x27dec9]=this[_0x246c('0x88')](_0x196315[_0x27dec9]);}}}}return _0x196315;};AGIVertices[_0x246c('0x11')][_0x246c('0x89')]=function(_0x3d8fae){for(var _0x409641 in _0x3d8fae){if(_0x3d8fae[_0x246c('0x86')](_0x409641)){if(_[_0x246c('0x8a')](_0x3d8fae[_0x409641])){this[_0x246c('0x89')](_0x3d8fae[_0x409641]);}else if(_[_0x246c('0x8b')](_0x3d8fae[_0x409641])){for(var _0x23ebb2=0x0;_0x23ebb2<_0x3d8fae[_0x409641][_0x246c('0x8c')];_0x23ebb2++){this[_0x246c('0x89')](_0x3d8fae[_0x409641][_0x23ebb2]);}}else if(_[_0x246c('0x8d')](_0x3d8fae[_0x409641])){_0x3d8fae[_0x409641]=this['replaceAllVariables'](_0x3d8fae[_0x409641]);}}}};AGIVertices[_0x246c('0x11')]['saveRestApiResult']=function(_0x247f02,_0xe6badb){for(var _0x35e5aa in _0x247f02){if(_0x247f02[_0x246c('0x86')](_0x35e5aa)){if(_[_0x246c('0x8a')](_0x247f02[_0x35e5aa])){if(!_['isEmpty'](_0x247f02[_0x35e5aa])){this[_0x246c('0x8e')](_0x247f02[_0x35e5aa],util[_0x246c('0x26')](_0x246c('0x8f'),_0xe6badb,_0x35e5aa));}}else if(_[_0x246c('0x8b')](_0x247f02[_0x35e5aa])){for(var _0x47817c=0x0;_0x47817c<_0x247f02[_0x35e5aa][_0x246c('0x8c')];_0x47817c++){this[_0x246c('0x8e')](_0x247f02[_0x35e5aa][_0x47817c],util[_0x246c('0x26')](_0x246c('0x8f'),_0xe6badb,_0x35e5aa+'['+_0x47817c+']'));}}else{if(!_[_0x246c('0x42')](_0x247f02[_0x35e5aa])){this[_0x246c('0x34')]['setVariable'](util[_0x246c('0x26')](_0x246c('0x8f'),_0xe6badb,_0x35e5aa),_0x247f02[_0x35e5aa]);}}}}};AGIVertices[_0x246c('0x11')]['replaceObjectAllVariables']=function(_0x494b74){try{var _0x372848=JSON['parse'](_0x494b74);this['recursiveNodeIndex'](_0x372848);return JSON[_0x246c('0x6d')](_0x372848);}catch(_0x325111){return this[_0x246c('0x88')](_0x494b74);}};AGIVertices['prototype'][_0x246c('0x88')]=function(_0x5e4ef4){var _0x48066d=_0x5e4ef4[_0x246c('0x90')]('{');for(var _0x1480cc=0x1;_0x1480cc<_0x48066d[_0x246c('0x8c')];_0x1480cc+=0x1){var _0x5c0915=_0x48066d[_0x1480cc][_0x246c('0x90')]('}');if(_0x5c0915['length']>0x1){_0x5e4ef4=_0x5e4ef4['replaceAll']('{'+_0x5c0915[0x0]+'}',this[_0x246c('0x34')]['getVariable'](_0x5c0915[0x0])[_0x246c('0x91')]||_0x5c0915[0x0]);}}if(_0x48066d[_0x246c('0x8c')]===0x1){return _0x5e4ef4[_0x246c('0x4a')]();}return this[_0x246c('0x88')](_0x5e4ef4);};AGIVertices[_0x246c('0x11')]['getAndSetVariable']=function(_0x543419,_0x41ab2f){var _0x25c48a=this['channel'][_0x246c('0x92')](_0x543419);if(_0x25c48a[_0x246c('0x93')]===-0x1){return _0x25c48a;}logger['info'](util[_0x246c('0x26')](_0x246c('0x94'),_0x41ab2f,_0x25c48a[_0x246c('0x91')]));return this[_0x246c('0x34')]['setVariable'](_0x41ab2f,_0x25c48a[_0x246c('0x91')]);};AGIVertices[_0x246c('0x11')]['isConfigured']=function(_0x42b83c){return _0x42b83c&&_0x42b83c!=='0'&&_0x42b83c!=='-1'&&_0x42b83c!=='';};AGIVertices[_0x246c('0x11')][_0x246c('0x95')]=function(_0x2890ea){this['createSquareDetailsReport'][_0x246c('0x69')](this,_0x2890ea,'-');_0x2890ea[_0x246c('0x96')]=_0x2890ea[_0x246c('0x95')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x246c('0x11')]['mrcpsynth']=function(_0x285c5c){logger[_0x246c('0x2b')](util['format'](_0x246c('0x97'),_0x285c5c[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x285c5c[_0x246c('0x58')])){return this[_0x246c('0x34')][_0x246c('0x99')]('no\x20text\x20configured');}var _0x21d967='\x22'+_0x285c5c['text']+'\x22';if(this['isConfigured'](_0x285c5c[_0x246c('0x72')])){_0x21d967+=','+_0x285c5c[_0x246c('0x72')];}var _0x2633f2=this[_0x246c('0x34')][_0x246c('0x54')](_0x246c('0x9a'),_0x21d967);if(_0x2633f2[_0x246c('0x93')]===-0x1){return _0x2633f2;}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x9b'),_0x21d967));};AGIVertices[_0x246c('0x11')]['mrcprecog']=function(_0x242e5a){logger['info'](util['format'](_0x246c('0x9c'),_0x242e5a['label']));if(!this['isConfigured'](_0x242e5a[_0x246c('0x9d')])){return this['channel'][_0x246c('0x99')](_0x246c('0x9e'));}var _0x2857f5=_0x242e5a[_0x246c('0x9d')];if(this[_0x246c('0x98')](_0x242e5a[_0x246c('0x72')])){_0x2857f5+=','+_0x242e5a[_0x246c('0x72')];}var _0x2adf95=this[_0x246c('0x34')]['exec'](_0x246c('0x9f'),_0x2857f5);if(_0x2adf95['result']===-0x1){return _0x2adf95;}var _0x5438c8=this[_0x246c('0xa0')]('RECOG_CONFIDENCE()',_0x246c('0xa1'));if(_0x5438c8[_0x246c('0x93')]===-0x1){return _0x5438c8;}var _0x5d9b52=this['getAndSetVariable']('RECOG_INPUT()',_0x246c('0xa2'));if(_0x5d9b52['result']===-0x1){return _0x5d9b52;}var _0x12ce3e=this[_0x246c('0xa0')](_0x246c('0xa3'),_0x246c('0xa4'));if(_0x12ce3e['result']===-0x1){return _0x12ce3e;}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0xa5'),_0x2857f5));};AGIVertices[_0x246c('0x11')]['agi']=function(_0x19197f){logger[_0x246c('0x2b')](util['format'](_0x246c('0xa6'),_0x19197f[_0x246c('0x36')]));return this['channel'][_0x246c('0xa7')]([_0x19197f[_0x246c('0xa8')],_0x19197f[_0x246c('0xa9')]]);};AGIVertices[_0x246c('0x11')][_0x246c('0xaa')]=function(_0xd0429f){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0xab'),_0xd0429f['label']));if(this[_0x246c('0x98')](_0xd0429f['timeout'])){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0xac'),_0xd0429f[_0x246c('0x5d')]));var _0xb2772c=this[_0x246c('0x34')][_0x246c('0xad')](_0xd0429f['timeout']);if(_0xb2772c['result']===-0x1){return _0xb2772c;}}return this[_0x246c('0x34')][_0x246c('0xaa')]();};AGIVertices[_0x246c('0x11')][_0x246c('0xae')]=function(_0x54dc85){logger[_0x246c('0x2b')](util['format'](_0x246c('0xaf'),_0x54dc85[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x54dc85[_0x246c('0x47')])){return this[_0x246c('0x34')][_0x246c('0x29')](_0x54dc85,_0x246c('0xb0'));}_0x54dc85[_0x246c('0x48')]=moment();if(this['isConfigured'](_0x54dc85['delay'])){_0x54dc85[_0x246c('0x48')]=moment()[_0x246c('0xb1')](_0x54dc85[_0x246c('0xb2')],_0x246c('0xb3'));}if(!this[_0x246c('0x98')](_0x54dc85[_0x246c('0x4b')])){_0x54dc85[_0x246c('0x4b')]=0x2;}this[_0x246c('0x40')][_0x246c('0x69')](this,_0x54dc85);return this['channel'][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0xb4'),_0x54dc85[_0x246c('0x46')],_0x54dc85[_0x246c('0x47')],_0x54dc85[_0x246c('0x48')]));};AGIVertices['prototype'][_0x246c('0xb5')]=function(_0x5a8561){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0xb6'),_0x5a8561[_0x246c('0x36')]));var _0xdd8047=this[_0x246c('0x34')][_0x246c('0x54')](_0x5a8561[_0x246c('0xb7')],_0x5a8561[_0x246c('0x72')]);if(_0xdd8047['result']===-0x1){return _0xdd8047;}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')]('Executed\x20command\x20%s\x20%s',_0x5a8561['application'],_0x5a8561[_0x246c('0x72')]));};AGIVertices[_0x246c('0x11')][_0x246c('0xb8')]=function(_0x2cd735){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0xb9'),_0x2cd735[_0x246c('0x36')]));if(!this['isConfigured'](_0x2cd735[_0x246c('0x58')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xba'));}var _0x3639cd='\x22'+_0x2cd735[_0x246c('0x58')]+'\x22';if(this['isConfigured'](_0x2cd735[_0x246c('0x72')])){_0x3639cd+=','+_0x2cd735[_0x246c('0x72')];}var _0xc7530=this[_0x246c('0x34')][_0x246c('0x54')](_0x246c('0x9a'),_0x3639cd);if(_0xc7530[_0x246c('0x93')]===-0x1){return _0xc7530;}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x9b'),_0x3639cd));};AGIVertices[_0x246c('0x11')]['sestektts']=function(_0x285535){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0xbb'),_0x285535[_0x246c('0x36')]));if(!this['isConfigured'](_0x285535[_0x246c('0x58')])){return this[_0x246c('0x34')]['noop'](_0x246c('0xba'));}var _0x4d79be='\x22'+_0x285535[_0x246c('0x58')]+'\x22';if(this['isConfigured'](_0x285535[_0x246c('0x72')])){_0x4d79be+=','+_0x285535[_0x246c('0x72')];}var _0x11a66c=this[_0x246c('0x34')][_0x246c('0x54')](_0x246c('0x9a'),_0x4d79be);if(_0x11a66c[_0x246c('0x93')]===-0x1){return _0x11a66c;}return this[_0x246c('0x34')]['noop'](util['format'](_0x246c('0x9b'),_0x4d79be));};AGIVertices[_0x246c('0x11')][_0x246c('0xbc')]=function(_0x17450d){logger['info'](util[_0x246c('0x26')](_0x246c('0xbd'),_0x17450d[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x17450d[_0x246c('0x9d')])){return this['channel'][_0x246c('0x99')](_0x246c('0x9e'));}var _0x413cc9=_0x17450d[_0x246c('0x9d')];if(this[_0x246c('0x98')](_0x17450d[_0x246c('0x72')])){_0x413cc9+=','+_0x17450d[_0x246c('0x72')];}var _0x155cfc=this[_0x246c('0x34')][_0x246c('0x54')](_0x246c('0x9f'),_0x413cc9);if(_0x155cfc[_0x246c('0x93')]===-0x1){return _0x155cfc;}var _0x204014=this['getAndSetVariable'](_0x246c('0xbe'),_0x246c('0xbf'));if(_0x204014['result']===-0x1){return _0x204014;}var _0x6b371a=this[_0x246c('0xa0')](_0x246c('0xc0'),_0x246c('0xc1'));if(_0x6b371a[_0x246c('0x93')]===-0x1){return _0x6b371a;}var _0x21e0f7=this[_0x246c('0xa0')](_0x246c('0xa3'),_0x246c('0xc2'));if(_0x21e0f7[_0x246c('0x93')]===-0x1){return _0x21e0f7;}return this['channel']['noop'](util[_0x246c('0x26')](_0x246c('0xa5'),_0x413cc9));};AGIVertices[_0x246c('0x11')][_0x246c('0xc3')]=function(_0x2af60e){logger['info'](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2af60e[_0x246c('0x36')]));if(!this['isConfigured'](_0x2af60e[_0x246c('0x9d')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0x9e'));}var _0x27ea83=_0x2af60e[_0x246c('0x9d')];if(this[_0x246c('0x98')](_0x2af60e['options'])){_0x27ea83+=','+_0x2af60e['options'];}var _0xa95040=this[_0x246c('0x34')][_0x246c('0x54')](_0x246c('0x9f'),_0x27ea83);if(_0xa95040['result']===-0x1){return _0xa95040;}var _0x14569a=this[_0x246c('0xa0')](_0x246c('0xbe'),_0x246c('0xc4'));if(_0x14569a[_0x246c('0x93')]===-0x1){return _0x14569a;}var _0x38bd42=this[_0x246c('0xa0')](_0x246c('0xc0'),'SESTEK_ASR_TRANSCRIPT');if(_0x38bd42[_0x246c('0x93')]===-0x1){return _0x38bd42;}var _0x18d5bf=this[_0x246c('0xa0')](_0x246c('0xa3'),_0x246c('0xc5'));if(_0x18d5bf[_0x246c('0x93')]===-0x1){return _0x18d5bf;}return this[_0x246c('0x34')]['noop'](util[_0x246c('0x26')](_0x246c('0xa5'),_0x27ea83));};AGIVertices[_0x246c('0x11')][_0x246c('0xc6')]=function(_0x497d9e){logger[_0x246c('0x2b')](util[_0x246c('0x26')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x497d9e['label']));if(!this[_0x246c('0x98')](_0x497d9e[_0x246c('0xc7')])){return this[_0x246c('0x34')]['error'](_0x497d9e,_0x246c('0xc8'));}var _0x2e4082=this[_0x246c('0x15')][_0x246c('0x69')](this,_0x497d9e[_0x246c('0xc7')]);if(!_0x2e4082){return this[_0x246c('0x34')][_0x246c('0x29')](_0x497d9e,_0x246c('0xc9'));}if(!this[_0x246c('0x98')](_0x497d9e[_0x246c('0xca')])){return this[_0x246c('0x34')][_0x246c('0x29')](_0x497d9e,_0x246c('0xcb'));}var _0x173247=_0x497d9e['query'][_0x246c('0xcc')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x246c('0x99')](util['format'](_0x246c('0xcd'),_0x173247));var _0x31d5d0=this['getQueryOdbc'][_0x246c('0x69')](this,_0x2e4082,_0x173247);this[_0x246c('0x33')][_0x246c('0x69')](this,_0x497d9e,_0x173247);if(!this[_0x246c('0x98')](_0x497d9e['variable_id'])){return this['channel'][_0x246c('0x99')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4422a3=this['getVariable']['sync'](this,_0x497d9e[_0x246c('0xce')]);if(!_0x4422a3){return this[_0x246c('0x34')][_0x246c('0x29')](_0x497d9e,'no\x20variable\x20found');}var _0x5b6342=this;_0x31d5d0[_0x246c('0xcf')](function(_0x3e2482,_0x916f5e){Object[_0x246c('0xd0')](_0x3e2482)[_0x246c('0xcf')](function(_0x5e62e2){_0x5b6342[_0x246c('0x34')][_0x246c('0xd1')](util[_0x246c('0x26')](_0x246c('0xd2'),_0x4422a3,_0x916f5e,_0x5e62e2),_0x3e2482[_0x5e62e2]);});});this[_0x246c('0x34')][_0x246c('0xd1')](util[_0x246c('0x26')]('%s_ROWS_COUNT',_0x4422a3),_0x31d5d0[_0x246c('0x8c')]);return this[_0x246c('0x34')]['noop'](util[_0x246c('0x26')](_0x246c('0xd3'),_0x4422a3));};AGIVertices[_0x246c('0x11')][_0x246c('0xd4')]=function(_0x3c6ac0){logger[_0x246c('0xd5')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3c6ac0[_0x246c('0x36')]));if(!this['isConfigured'](_0x3c6ac0['sip_id'])){return this[_0x246c('0x34')][_0x246c('0x29')](_0x3c6ac0,_0x246c('0xd6'));}var _0x542436=this[_0x246c('0x18')][_0x246c('0x69')](this,_0x3c6ac0[_0x246c('0xd7')]);if(!_0x542436){return this[_0x246c('0x34')][_0x246c('0x29')](_0x3c6ac0,_0x246c('0xd8'));}var _0x2742f5=this['channel'][_0x246c('0x54')]('DIAL',[util[_0x246c('0x26')](_0x246c('0xd9'),_0x542436),_0x3c6ac0[_0x246c('0x5d')],_0x3c6ac0[_0x246c('0xda')],_0x3c6ac0[_0x246c('0x6c')]]);if(_0x2742f5['result']===-0x1){return _0x2742f5;}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0xdb'),_0x246c('0xdc')));};AGIVertices[_0x246c('0x11')][_0x246c('0xdd')]=function(_0x262803){logger[_0x246c('0x2b')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x262803['label']));if(!this[_0x246c('0x98')](_0x262803[_0x246c('0x74')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xde'));}if(!this['isConfigured'](_0x262803['text'])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xba'));}this[_0x246c('0x34')]['bot']=!![];this[_0x246c('0x33')](_0x262803);this[_0x246c('0x3f')](_0x262803[_0x246c('0x58')],'in','','');this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0xdf'),_0x262803[_0x246c('0x58')]));var _0x94f5a2=this[_0x246c('0x73')][_0x246c('0x69')](this,_0x262803);if(_0x94f5a2){for(var _0x43f17b in _0x94f5a2){if(_0x94f5a2[_0x246c('0x86')](_0x43f17b)){this[_0x246c('0x34')]['setVariable'](util[_0x246c('0x26')](_0x246c('0xe0'),_0x43f17b[_0x246c('0x62')]()),_0x94f5a2[_0x43f17b]);}}this['createSquareMessage'](_0x94f5a2[_0x246c('0xe1')],_0x246c('0xe2'),_0x246c('0xdd'),'');return this['channel'][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0xe3'),_0x94f5a2['speech']));}return this[_0x246c('0x34')][_0x246c('0x29')](_0x262803,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x246c('0xe4')]=function(_0x167b6b){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0xe5'),_0x167b6b[_0x246c('0x36')]));if(!this['isConfigured'](_0x167b6b[_0x246c('0xe6')])){return this[_0x246c('0x34')][_0x246c('0x99')]('no\x20project_id\x20configured');}if(!this[_0x246c('0x98')](_0x167b6b[_0x246c('0x77')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xe7'));}if(!this[_0x246c('0x98')](_0x167b6b[_0x246c('0xe8')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xe9'));}if(!this[_0x246c('0x98')](_0x167b6b[_0x246c('0x78')])){return this['channel']['noop'](_0x246c('0xea'));}if(!this[_0x246c('0x98')](_0x167b6b[_0x246c('0x58')])){return this['channel'][_0x246c('0x99')](_0x246c('0xba'));}this[_0x246c('0x34')][_0x246c('0xeb')]=!![];this[_0x246c('0x33')](_0x167b6b);this['createSquareMessage'](_0x167b6b[_0x246c('0x58')],'in','','');this['channel'][_0x246c('0x99')](util[_0x246c('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x167b6b[_0x246c('0x58')]));var _0x540d3f=this[_0x246c('0x76')][_0x246c('0x69')](this,_0x167b6b);if(_0x540d3f){for(var _0x11a251 in _0x540d3f){if(_0x540d3f[_0x246c('0x86')](_0x11a251)){if(_0x11a251!==_0x246c('0xec')){this[_0x246c('0x34')][_0x246c('0xd1')](util[_0x246c('0x26')](_0x246c('0xe0'),_0x11a251[_0x246c('0x62')]()),_0x540d3f[_0x11a251]);}}}this[_0x246c('0x3f')](_0x540d3f[_0x246c('0xe1')],'out',_0x246c('0xe4'),_0x540d3f[_0x246c('0xec')]);return this['channel']['noop'](util['format'](_0x246c('0xed'),_0x540d3f[_0x246c('0xe1')]));}return this[_0x246c('0x34')]['error'](_0x167b6b,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x246c('0x11')][_0x246c('0xee')]=function(_0x4a1a2f){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0xef'),_0x4a1a2f['label']));if(!this[_0x246c('0x98')](_0x4a1a2f[_0x246c('0xf0')])){return this['channel'][_0x246c('0x99')](_0x246c('0xf1'));}if(!this['isConfigured'](_0x4a1a2f['username'])){return this[_0x246c('0x34')]['noop'](_0x246c('0xf2'));}if(!this[_0x246c('0x98')](_0x4a1a2f[_0x246c('0xf3')])){return this['channel'][_0x246c('0x99')](_0x246c('0xf4'));}if(!this[_0x246c('0x98')](_0x4a1a2f[_0x246c('0xf5')])){return this['channel'][_0x246c('0x99')](_0x246c('0xba'));}this[_0x246c('0x34')][_0x246c('0xeb')]=!![];this[_0x246c('0x33')](_0x4a1a2f);this[_0x246c('0x3f')](_0x4a1a2f['text'],'in','','');this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0xf6'),_0x4a1a2f[_0x246c('0x58')]));var _0x17be88=this[_0x246c('0x79')][_0x246c('0x69')](this,_0x4a1a2f);if(_0x17be88){for(var _0x27374c in _0x17be88){if(_0x17be88[_0x246c('0x86')](_0x27374c)){this['channel'][_0x246c('0xd1')](util[_0x246c('0x26')](_0x246c('0xf7'),_0x27374c[_0x246c('0x62')]()),_0x17be88[_0x27374c]);}}this[_0x246c('0x3f')](_0x17be88[_0x246c('0xe1')],_0x246c('0xe2'),_0x246c('0xee'),'');if(_0x17be88[_0x246c('0xf8')]){this[_0x246c('0x34')]['noop'](util[_0x246c('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x17be88[_0x246c('0xf8')]));var _0x5efe9f=this[_0x246c('0x34')][_0x246c('0xf9')](_0x17be88[_0x246c('0xf8')]);try{fs[_0x246c('0xfa')](_0x17be88[_0x246c('0xf8')]+_0x246c('0xfb'));}catch(_0x58ba07){logger[_0x246c('0x29')](_0x58ba07);}return _0x5efe9f;}else{return this['channel'][_0x246c('0x99')](util[_0x246c('0x26')]('SestekNDA\x20Result\x20%s',_0x17be88[_0x246c('0xe1')]));}}return this[_0x246c('0x34')][_0x246c('0x29')](_0x4a1a2f,_0x246c('0xfc'));};AGIVertices[_0x246c('0x11')]['end']=function(_0x186fbc){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0xfd'),_0x186fbc[_0x246c('0x36')]));return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xfe'));};AGIVertices['prototype'][_0x246c('0xff')]=function(_0x50b045){logger[_0x246c('0x2b')](util[_0x246c('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x50b045[_0x246c('0x36')]));var _0x2a0345='';if(_0x50b045['trunk_id']){if(!this[_0x246c('0x98')](_0x50b045['trunk_id'])){return this[_0x246c('0x34')]['error'](_0x50b045,'no\x20trunk\x20selected');}else{var _0xb7eb8c=parseInt(_0x50b045['trunk_id'],0xa);if(isNaN(_0xb7eb8c)){_0x2a0345=_0x50b045[_0x246c('0x100')];}else{_0x2a0345=this[_0x246c('0x1a')][_0x246c('0x69')](this,_0x50b045[_0x246c('0x100')]);if(!_0x2a0345){return this['channel']['error'](_0x50b045,'no\x20trunk\x20found');}}}}else if(_0x50b045[_0x246c('0x101')]){_0x2a0345=_0x50b045[_0x246c('0x101')];}else{return this[_0x246c('0x34')]['error'](_0x50b045,'no\x20trunk\x20selected');}var _0xa58826=this['channel'][_0x246c('0x54')](_0x246c('0xdc'),[util[_0x246c('0x26')](_0x246c('0x102'),_0x2a0345,_0x50b045[_0x246c('0x46')]),_0x50b045[_0x246c('0x5d')],_0x50b045[_0x246c('0xda')],_0x50b045[_0x246c('0x6c')]]);if(_0xa58826[_0x246c('0x93')]===-0x1){return _0xa58826;}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0xdb'),_0x246c('0xdc')));};AGIVertices['prototype']['finally']=function(_0x32653b){logger[_0x246c('0x2b')](util['format'](_0x246c('0x103'),_0x32653b[_0x246c('0x36')]));return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0x104'));};AGIVertices[_0x246c('0x11')][_0x246c('0xb')]=function(_0x35f165){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x105'),_0x35f165['label']));if(_0x35f165[_0x246c('0x96')]===0x0){return this[_0x246c('0x95')](_0x35f165);}_0x35f165[_0x246c('0x96')]-=0x1;if(!this[_0x246c('0x98')](_0x35f165['file_id'])){return this[_0x246c('0x34')]['error'](_0x35f165,'no\x20file\x20audio\x20selected');}var _0x37ce0e=this[_0x246c('0x1c')][_0x246c('0x69')](this,_0x35f165[_0x246c('0x106')]);if(!_0x37ce0e){return this['channel']['error'](_0x35f165,_0x246c('0x107'));}if(!this[_0x246c('0x98')](_0x35f165[_0x246c('0xce')])){return this[_0x246c('0x34')][_0x246c('0x29')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x35838a=this['channel'][_0x246c('0x108')](_0x37ce0e,_0x35f165[_0x246c('0x109')],_0x35f165[_0x246c('0x10a')]);var _0x435352=_0x35838a[_0x246c('0x93')]?_0x35838a[_0x246c('0x93')][_0x246c('0x4a')]():'';logger[_0x246c('0x2b')](_0x246c('0x10b'),JSON[_0x246c('0x6d')](_0x35838a));if(_0x35838a[_0x246c('0x93')]===-0x1){this['createSquareDetailsReport'][_0x246c('0x69')](this,_0x35f165,_0x435352);return _0x35838a;}else if(_0x35838a[_0x246c('0x91')]===_0x246c('0x5d')){_0x35838a[_0x246c('0x93')]=_0x435352[_0x246c('0x8c')]>=parseInt(_0x35f165[_0x246c('0x10c')])?'x':'i';}else{_0x35838a[_0x246c('0x93')]=_0x435352[_0x246c('0x8c')]>=parseInt(_0x35f165[_0x246c('0x10c')])&&_0x435352[_0x246c('0x8c')]<=parseInt(_0x35f165[_0x246c('0x10a')])?'x':'i';}var _0x3e7c12=this[_0x246c('0x92')][_0x246c('0x69')](this,_0x35f165[_0x246c('0xce')]);if(!_0x3e7c12){return this[_0x246c('0x34')]['error'](_0x35f165,_0x246c('0x10d'));}this[_0x246c('0x34')][_0x246c('0xd1')](_0x3e7c12,_0x435352);if(this['isConfigured'](_0x35f165[_0x246c('0x10e')])){var _0x136e02=parseInt(_0x35f165[_0x246c('0x10e')],0xa);var _0x53f021=rs['generate']({'charset':'*','length':_0x136e02});var _0x75e908=_0x435352[_0x246c('0x8c')];if(_0x75e908>0x0){if(_0x75e908>_0x136e02){this['createSquareDetailsReport'][_0x246c('0x69')](this,_0x35f165,_0x35f165[_0x246c('0x10f')]===_0x246c('0x110')?_0x53f021+_0x435352[_0x246c('0x111')](_0x136e02):_0x435352['substr'](0x0,_0x75e908-_0x136e02)+_0x53f021);}else{this[_0x246c('0x33')]['sync'](this,_0x35f165,rs[_0x246c('0x112')]({'charset':'*','length':_0x75e908}));}}else{this['createSquareDetailsReport'][_0x246c('0x69')](this,_0x35f165,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x35f165,_0x435352);}return _0x35838a;};AGIVertices[_0x246c('0x11')][_0x246c('0xc')]=function(_0x1641a2){logger[_0x246c('0x2b')](util[_0x246c('0x26')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1641a2['label']));return this[_0x246c('0xb')](_0x1641a2);};AGIVertices[_0x246c('0x11')]['goal']=function(_0x503ff9){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x113'),_0x503ff9[_0x246c('0x36')]));this[_0x246c('0x33')][_0x246c('0x69')](this,_0x503ff9,_0x503ff9[_0x246c('0x114')]);return this['channel'][_0x246c('0x99')](util[_0x246c('0x26')]('GOAL\x20%s',_0x503ff9[_0x246c('0x114')]));};AGIVertices['prototype'][_0x246c('0x115')]=function(_0x26ac84){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x116'),_0x26ac84[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x26ac84[_0x246c('0x7d')])||!this[_0x246c('0x98')](_0x26ac84[_0x246c('0x7e')])){return this[_0x246c('0x34')]['noop'](_0x246c('0x117'));}if(!this[_0x246c('0x98')](_0x26ac84[_0x246c('0x58')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xba'));}this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x118'),_0x26ac84[_0x246c('0x58')]));var _0x6a4cf7=this[_0x246c('0x119')][_0x246c('0x69')](this,_0x26ac84);if(_0x6a4cf7){this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x11a'),_0x6a4cf7));var _0x498660=this[_0x246c('0x34')][_0x246c('0xf9')](_0x6a4cf7);try{fs['unlink'](_0x6a4cf7+_0x246c('0xfb'));}catch(_0x4b53d1){logger['error'](_0x4b53d1);}return _0x498660;}return this[_0x246c('0x34')][_0x246c('0x29')](_0x26ac84,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x246c('0x11b')]=function(_0x947d5d){logger[_0x246c('0x2b')](util[_0x246c('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x947d5d[_0x246c('0x36')]));if(!this['isConfigured'](_0x947d5d['aws_access_key_id'])||!this[_0x246c('0x98')](_0x947d5d['aws_secret_access_key'])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0x117'));}if(!this['isConfigured'](_0x947d5d[_0x246c('0x11c')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0x11d'));}if(!this[_0x246c('0x98')](_0x947d5d[_0x246c('0x58')])){return this[_0x246c('0x34')]['noop']('no\x20text\x20configured');}this[_0x246c('0x34')][_0x246c('0xeb')]=!![];this[_0x246c('0x33')](_0x947d5d);this[_0x246c('0x3f')](_0x947d5d['text'],'in','','');this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x11e'),_0x947d5d[_0x246c('0x58')]));var _0x19c226=this[_0x246c('0x80')][_0x246c('0x69')](this,_0x947d5d);if(_0x19c226){for(var _0x5f5c18 in _0x19c226){if(_0x19c226[_0x246c('0x86')](_0x5f5c18)&&_[_0x246c('0x8d')](_0x19c226[_0x5f5c18])){this[_0x246c('0x34')][_0x246c('0xd1')](util[_0x246c('0x26')](_0x246c('0x11f'),_0x5f5c18[_0x246c('0x62')]()),_0x19c226[_0x5f5c18]);}}if(_[_0x246c('0x42')](_0x19c226['message'])){return this[_0x246c('0x34')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x19c226[_0x246c('0x70')],_0x246c('0xe2'),_0x246c('0x120'),'');return this[_0x246c('0x34')][_0x246c('0x99')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x19c226[_0x246c('0x70')]));}}return this['channel'][_0x246c('0x29')](_0x947d5d,_0x246c('0x121'));};AGIVertices[_0x246c('0x11')]['googleasr']=function(_0x3ba252){logger['info'](util[_0x246c('0x26')](_0x246c('0x122'),_0x3ba252[_0x246c('0x36')],_0x3ba252['timeout']));if(!this['isConfigured'](_0x3ba252[_0x246c('0x74')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xde'));}var _0x30b070=_0x246c('0x123');var _0x25e938=util['format'](_0x246c('0x124'),FILES_PATH,rs['generate'](0x4));var _0x45708d=util[_0x246c('0x26')](_0x246c('0x8f'),_0x25e938,_0x30b070);var _0x2bae9d=!![];if(_0x3ba252['beep']===_0x246c('0x125')){_0x2bae9d=![];}var _0x5f290d=this[_0x246c('0x34')][_0x246c('0x126')](_0x25e938,_0x30b070,_0x3ba252['intKey'],_0x3ba252[_0x246c('0x5d')],undefined,_0x2bae9d);if(_0x5f290d[_0x246c('0x93')]!==-0x1){this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')]('google\x20%s\x20file\x20created',_0x45708d));var _0x141efa=this[_0x246c('0x82')][_0x246c('0x69')](this,_0x3ba252,_0x45708d);if(_0x141efa){for(var _0x3193f6 in _0x141efa){if(_0x141efa['hasOwnProperty'](_0x3193f6)){this[_0x246c('0x34')]['setVariable'](util['format']('GOOGLE_ASR_%s',_0x3193f6[_0x246c('0x62')]()),_0x141efa[_0x3193f6]);}}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x127'),JSON[_0x246c('0x6d')](_0x141efa)));}}return _0x5f290d;};AGIVertices[_0x246c('0x11')]['tildeasr']=function(_0x313f65){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x128'),_0x313f65[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x313f65[_0x246c('0x129')])){return this[_0x246c('0x34')][_0x246c('0x99')]('no\x20appid\x20configured');}if(!this[_0x246c('0x98')](_0x313f65[_0x246c('0x12a')])){return this[_0x246c('0x34')]['noop'](_0x246c('0x12b'));}var _0x40443a='wav';var _0x3d31db=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x246c('0x112')](0x4));var _0x5a12cf=util['format']('%s.%s',_0x3d31db,_0x40443a);var _0x23531a=!![];if(_0x313f65[_0x246c('0x12c')]===_0x246c('0x125')){_0x23531a=![];}var _0x4c80b2=this[_0x246c('0x34')][_0x246c('0x126')](_0x3d31db,_0x40443a,_0x313f65[_0x246c('0x12d')],_0x313f65[_0x246c('0x5d')],undefined,_0x23531a);if(_0x4c80b2[_0x246c('0x93')]!==-0x1){this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x12e'),_0x5a12cf));var _0x678775=this['tildeASR'][_0x246c('0x69')](this,_0x313f65,_0x5a12cf);if(_0x678775){for(var _0x538396 in _0x678775){if(_0x678775[_0x246c('0x86')](_0x538396)){this[_0x246c('0x34')][_0x246c('0xd1')](util[_0x246c('0x26')](_0x246c('0x12f'),_0x538396[_0x246c('0x62')]()),_0x678775[_0x538396]);}}return this[_0x246c('0x34')]['noop'](util['format'](_0x246c('0x130'),JSON[_0x246c('0x6d')](_0x678775)));}}return _0x4c80b2;};AGIVertices[_0x246c('0x11')][_0x246c('0x131')]=function(_0x3ac6c2){logger[_0x246c('0x2b')](util['format'](_0x246c('0x132'),_0x3ac6c2[_0x246c('0x36')]));return this[_0x246c('0x34')][_0x246c('0x133')](_0x3ac6c2[_0x246c('0x3a')],_0x3ac6c2['extension'],_0x3ac6c2[_0x246c('0x134')]);};AGIVertices[_0x246c('0x11')]['gotoif']=function(_0x228162){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x135'),_0x228162[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x228162[_0x246c('0x136')])){return this['channel'][_0x246c('0x29')](_0x228162,_0x246c('0x137'));}try{var _0x277e45=eval(_0x228162['condition'])?'true':'false';this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x138'),_0x228162[_0x246c('0x136')],_0x277e45));return{'code':0xc8,'result':_0x277e45};}catch(_0x19072c){return{'code':0xc8,'result':_0x246c('0x139')};}};AGIVertices[_0x246c('0x11')]['gotoiftime']=function(_0x275270){logger['info'](util['format'](_0x246c('0x13a'),_0x275270[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x275270[_0x246c('0x13b')])){return this[_0x246c('0x34')]['error'](_0x275270,_0x246c('0x13c'));}var _0x10163a=this[_0x246c('0x22')][_0x246c('0x69')](this,_0x275270[_0x246c('0x13b')]);if(!_0x10163a){return this[_0x246c('0x34')][_0x246c('0x29')](_0x275270,_0x246c('0x13d'));}for(var _0x16f776=0x0;_0x16f776<_0x10163a['length'];_0x16f776+=0x1){var _0x546f51=this[_0x246c('0x34')][_0x246c('0x92')](util[_0x246c('0x26')]('IFTIME(%s?true:false)',_0x10163a[_0x16f776]));if(_0x546f51[_0x246c('0x93')]===-0x1){return _0x546f51;}logger[_0x246c('0x2b')](util['format'](_0x246c('0x13e'),_0x10163a[_0x16f776],_0x546f51[_0x246c('0x91')]));if(_0x546f51[_0x246c('0x91')]==='true'){logger[_0x246c('0x2b')](util[_0x246c('0x26')]('IFTIME\x20%s\x20%s',_0x10163a[_0x16f776],_0x246c('0x13f')));this['channel'][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x13e'),_0x10163a[_0x16f776],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x13e'),_0x10163a[_0x16f776],'false'));this[_0x246c('0x34')]['noop'](util[_0x246c('0x26')](_0x246c('0x13e'),_0x10163a[_0x16f776],_0x246c('0x139')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x246c('0x11')]['hangup']=function(_0x548a63){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x140'),_0x548a63[_0x246c('0x36')]));return this['channel'][_0x246c('0x141')]();};AGIVertices[_0x246c('0x11')]['ispeechasr']=function(_0x5beb68){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x142'),_0x5beb68['label']));if(!this[_0x246c('0x98')](_0x5beb68[_0x246c('0x74')])){return this['channel'][_0x246c('0x99')](_0x246c('0xde'));}var _0x31538b='wav';var _0x141288=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x246c('0x112')](0x4));var _0x556fe6=util[_0x246c('0x26')](_0x246c('0x8f'),_0x141288,_0x31538b);var _0x24c82c=!![];if(_0x5beb68[_0x246c('0x12c')]===_0x246c('0x125')){_0x24c82c=![];}var _0xa07a29=this[_0x246c('0x34')][_0x246c('0x126')](_0x141288,_0x31538b,_0x5beb68[_0x246c('0x12d')],_0x5beb68[_0x246c('0x5d')],undefined,_0x24c82c);if(_0xa07a29[_0x246c('0x93')]!==-0x1){this['channel'][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x143'),_0x556fe6));var _0x559b2b=this['ispeechASR'][_0x246c('0x69')](this,_0x5beb68,_0x556fe6);if(_0x559b2b){for(var _0x3294db in _0x559b2b){if(_0x559b2b[_0x246c('0x86')](_0x3294db)){this['channel'][_0x246c('0xd1')](util[_0x246c('0x26')]('ISPEECH_ASR_%s',_0x3294db[_0x246c('0x62')]()),_0x559b2b[_0x3294db]);}}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x144'),JSON['stringify'](_0x559b2b)));}}return _0xa07a29;};AGIVertices[_0x246c('0x11')]['ispeechtts']=function(_0x1f7aad){logger[_0x246c('0x2b')](util[_0x246c('0x26')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1f7aad[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x1f7aad['key'])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xde'));}if(!this[_0x246c('0x98')](_0x1f7aad[_0x246c('0x58')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0xba'));}this[_0x246c('0x34')][_0x246c('0x99')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x1f7aad[_0x246c('0x58')]));var _0x193ce9=this[_0x246c('0x7a')]['sync'](this,_0x1f7aad);if(_0x193ce9){this[_0x246c('0x34')]['noop'](util['format'](_0x246c('0x143'),_0x193ce9));var _0x1113fb=this[_0x246c('0x34')][_0x246c('0xf9')](_0x193ce9,_0x1f7aad[_0x246c('0x12d')]);try{fs[_0x246c('0xfa')](_0x193ce9+'.wav');}catch(_0x70cf55){logger[_0x246c('0x29')](_0x70cf55);}return _0x1113fb;}return this[_0x246c('0x34')][_0x246c('0x29')](_0x1f7aad,_0x246c('0x145'));};AGIVertices[_0x246c('0x11')][_0x246c('0x146')]=function(_0x35dda7){logger['info'](util[_0x246c('0x26')](_0x246c('0x147'),_0x35dda7[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x35dda7['findBy'])){return this[_0x246c('0x34')]['error'](_0x35dda7,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x246c('0x148'),this['channel'][_0x246c('0x38')],_0x35dda7[_0x246c('0x149')]));var _0xcff455=this[_0x246c('0x14a')]['sync'](this,_0x35dda7[_0x246c('0x149')]);if(_0xcff455){logger[_0x246c('0x2b')](util['format'](_0x246c('0x14b'),this[_0x246c('0x34')][_0x246c('0x38')],_0x35dda7[_0x246c('0x149')]));this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x14b'),this[_0x246c('0x34')]['callerid'],_0x35dda7[_0x246c('0x149')]));return{'code':0xc8,'result':'success'};}else{logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x14c'),this[_0x246c('0x34')][_0x246c('0x38')],_0x35dda7[_0x246c('0x149')]));this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x14c'),this[_0x246c('0x34')][_0x246c('0x38')],_0x35dda7[_0x246c('0x149')]));return{'code':0xc8,'result':_0x246c('0x14d')};}};AGIVertices[_0x246c('0x11')]['logout']=function(_0x207367){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x14e'),_0x207367[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x207367[_0x246c('0x149')])){return this[_0x246c('0x34')][_0x246c('0x29')](_0x207367,'no\x20find\x20by\x20configured');}logger[_0x246c('0x2b')](util[_0x246c('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x246c('0x38')],_0x207367['findBy']));var _0x2daeb5=this[_0x246c('0x50')][_0x246c('0x69')](this,_0x207367['findBy']);if(_0x2daeb5){logger['info'](util[_0x246c('0x26')](_0x246c('0x14b'),this[_0x246c('0x34')][_0x246c('0x38')],_0x207367[_0x246c('0x149')]));this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x14b'),this[_0x246c('0x34')]['callerid'],_0x207367[_0x246c('0x149')]));return{'code':0xc8,'result':'success'};}else{logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x14c'),this[_0x246c('0x34')][_0x246c('0x38')],_0x207367[_0x246c('0x149')]));this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x14c'),this[_0x246c('0x34')][_0x246c('0x38')],_0x207367[_0x246c('0x149')]));return{'code':0xc8,'result':_0x246c('0x14d')};}};AGIVertices[_0x246c('0x11')][_0x246c('0x14f')]=function(_0x268c7c){logger['info'](util[_0x246c('0x26')](_0x246c('0x150'),_0x268c7c[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x268c7c[_0x246c('0x151')])){return this[_0x246c('0x34')]['error'](_0x268c7c,_0x246c('0x152'));}this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x153'),_0x268c7c[_0x246c('0x151')]));var _0x35dc4e=eval(_0x268c7c[_0x246c('0x151')]);if(!this[_0x246c('0x98')](_0x268c7c[_0x246c('0xce')])){return this['channel'][_0x246c('0x99')](_0x246c('0x154'));}var _0x29f48d=this['getVariable'][_0x246c('0x69')](this,_0x268c7c['variable_id']);if(!_0x29f48d){return this[_0x246c('0x34')][_0x246c('0x29')](_0x268c7c,_0x246c('0x10d'));}if(_['isArray'](_0x35dc4e)){var _0x1858d3=this;_0x35dc4e['forEach'](function(_0x4ff834,_0x344177){_0x1858d3['channel']['setVariable'](util[_0x246c('0x26')]('%s[%s]',_0x29f48d,_0x344177),_0x4ff834);});return this[_0x246c('0x34')][_0x246c('0x99')](util['format'](_0x246c('0x155'),_0x29f48d));}else{return this[_0x246c('0x34')][_0x246c('0xd1')](_0x29f48d,_0x35dc4e);}};AGIVertices[_0x246c('0x11')][_0x246c('0x156')]=function(_0x5a0194){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x157'),_0x5a0194[_0x246c('0x36')]));if(_0x5a0194[_0x246c('0x96')]===0x0){return this[_0x246c('0x95')](_0x5a0194);}_0x5a0194['retry']-=0x1;if(!this[_0x246c('0x98')](_0x5a0194[_0x246c('0x106')])){return this[_0x246c('0x34')]['error'](_0x5a0194,_0x246c('0x158'));}var _0x453f9e=this[_0x246c('0x1c')][_0x246c('0x69')](this,_0x5a0194[_0x246c('0x106')]);if(!_0x453f9e){return this[_0x246c('0x34')]['error'](_0x5a0194,_0x246c('0x107'));}var _0x19f8bc=this['channel']['getData'](_0x453f9e,_0x5a0194['response'],_0x5a0194[_0x246c('0x159')]);var _0x171be9=_0x19f8bc['result'];if(_0x19f8bc[_0x246c('0x93')]===-0x1){this['createSquareDetailsReport'][_0x246c('0x69')](this,_0x5a0194,'-1');return _0x19f8bc;}else if(_0x19f8bc[_0x246c('0x91')]===_0x246c('0x5d')){_0x19f8bc['result']=_0x19f8bc[_0x246c('0x93')][_0x246c('0x8c')]>0x0?_0x19f8bc['result']:'t';}else if(_[_0x246c('0x41')](_0x19f8bc[_0x246c('0x93')])){_0x19f8bc['result']='#';_0x171be9='#';}if(!this[_0x246c('0x98')](_0x5a0194[_0x246c('0xce')])){this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0x154'));}else{var _0x515628=this[_0x246c('0x92')][_0x246c('0x69')](this,_0x5a0194[_0x246c('0xce')]);if(!_0x515628){return this['channel']['error'](_0x5a0194,_0x246c('0x10d'));}this[_0x246c('0x34')][_0x246c('0xd1')](_0x515628,_0x171be9);}this[_0x246c('0x33')][_0x246c('0x69')](this,_0x5a0194,_0x171be9);return _0x19f8bc;};AGIVertices[_0x246c('0x11')][_0x246c('0x99')]=function(_0x110dff){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x15a'),_0x110dff['label']));return this[_0x246c('0x34')][_0x246c('0x99')](_0x110dff[_0x246c('0x15b')]||_0x110dff[_0x246c('0x36')]);};AGIVertices['prototype'][_0x246c('0x15c')]=function(_0x47dfb9){logger['info'](util[_0x246c('0x26')](_0x246c('0x15d'),_0x47dfb9[_0x246c('0x36')]));if(!this['isConfigured'](_0x47dfb9['findBy'])){return this[_0x246c('0x34')][_0x246c('0x29')](_0x47dfb9,_0x246c('0x15e'));}logger['info'](util[_0x246c('0x26')](_0x246c('0x148'),this['channel'][_0x246c('0x38')],_0x47dfb9[_0x246c('0x149')]));var _0xe2c27e=this['getPause']['sync'](this,_0x47dfb9['pause_id']);var _0x2eb80b=this['agentPause'][_0x246c('0x69')](this,_0x47dfb9['findBy'],_0xe2c27e);if(_0x2eb80b){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x14b'),this['channel'][_0x246c('0x38')],_0x47dfb9[_0x246c('0x149')]));this[_0x246c('0x34')]['noop'](util[_0x246c('0x26')](_0x246c('0x14b'),this[_0x246c('0x34')][_0x246c('0x38')],_0x47dfb9[_0x246c('0x149')]));return{'code':0xc8,'result':'success'};}else{logger[_0x246c('0x2b')](util['format'](_0x246c('0x14c'),this['channel'][_0x246c('0x38')],_0x47dfb9[_0x246c('0x149')]));this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x14b'),this[_0x246c('0x34')][_0x246c('0x38')],_0x47dfb9['findBy']));return{'code':0xc8,'result':_0x246c('0x14d')};}};AGIVertices[_0x246c('0x11')][_0x246c('0x15f')]=function(_0x8e1023){logger[_0x246c('0x2b')](util['format'](_0x246c('0x160'),_0x8e1023['label']));if(!this[_0x246c('0x98')](_0x8e1023[_0x246c('0x106')])){return this[_0x246c('0x34')]['error'](_0x8e1023,_0x246c('0x158'));}var _0x473ad2=this[_0x246c('0x1c')][_0x246c('0x69')](this,_0x8e1023['file_id']);if(!_0x473ad2){return this['channel'][_0x246c('0x29')](_0x8e1023,_0x246c('0x107'));}var _0x47e8f9=this[_0x246c('0x34')]['exec']('PLAYBACK',[_0x473ad2,_0x8e1023[_0x246c('0xda')]]);if(_0x47e8f9[_0x246c('0x93')]===-0x1){return _0x47e8f9;}return this[_0x246c('0x34')][_0x246c('0x99')](util['format'](_0x246c('0x161'),_0x246c('0x162'),_0x473ad2));};AGIVertices[_0x246c('0x11')][_0x246c('0x163')]=function(_0x305e24){logger[_0x246c('0x2b')](util['format'](_0x246c('0x164'),_0x305e24['label']));if(!this[_0x246c('0x98')](_0x305e24[_0x246c('0x165')])){return this[_0x246c('0x34')]['error'](_0x305e24,_0x246c('0x166'));}var _0xec2637='';var _0x502bed=parseInt(_0x305e24['queue_id'],0xa);if(isNaN(_0x502bed)){_0xec2637=_0x305e24[_0x246c('0x165')];}else{_0xec2637=this[_0x246c('0x12')][_0x246c('0x69')](this,_0x305e24[_0x246c('0x165')]);if(!_0xec2637){return this[_0x246c('0x34')]['error'](_0x305e24,_0x246c('0x167'));}}var _0x10341e='';if(this[_0x246c('0x98')](_0x305e24[_0x246c('0x106')])){var _0x157f51=this[_0x246c('0x1c')]['sync'](this,_0x305e24[_0x246c('0x106')]);if(_0x157f51){_0x10341e=_0x157f51;}}this[_0x246c('0x33')][_0x246c('0x69')](this,_0x305e24,_0xec2637);if(_0x305e24['opts'][_0x246c('0x168')]('x')<0x0){_0x305e24['opts']+='x';}if(_0x305e24[_0x246c('0xda')][_0x246c('0x168')]('X')<0x0){_0x305e24[_0x246c('0xda')]+='X';}this[_0x246c('0x34')]['setVariable'](_0x246c('0x169'),_0xec2637?_0xec2637['toLowerCase']():'');var _0x2ed4c0=this[_0x246c('0x34')][_0x246c('0x54')](_0x246c('0x16a'),[_0xec2637,_0x305e24['opts'],_0x305e24[_0x246c('0x6c')],_0x10341e,_0x305e24['timeout'],_0x305e24[_0x246c('0xa7')],_0x305e24[_0x246c('0x16b')],_0x305e24[_0x246c('0x16c')],'',_0x305e24['position']]);if(_0x2ed4c0[_0x246c('0x93')]===-0x1){return _0x2ed4c0;}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')]('Executed\x20command\x20%s\x20%s','QUEUE',_0xec2637));};AGIVertices[_0x246c('0x11')][_0x246c('0x16d')]=function(_0x1ee0f9){logger['info'](util[_0x246c('0x26')](_0x246c('0x16e'),_0x1ee0f9[_0x246c('0x36')]));var _0x4661ce=_0x1ee0f9['recordingFormat']||'wav';var _0x1eefdd=util[_0x246c('0x26')](_0x246c('0x16f'),this['channel'][_0x246c('0x35')],rs[_0x246c('0x112')](0x5));var _0x110fd7=util[_0x246c('0x26')]('%s/recordings/%s.%s',FILES_PATH,_0x1eefdd,_0x4661ce);var _0x83cf5b=util[_0x246c('0x26')](_0x246c('0x124'),FILES_PATH,_0x1eefdd);this['createSquareRecording'][_0x246c('0x69')](this,_0x1ee0f9,_0x1eefdd,_0x110fd7);this[_0x246c('0x34')][_0x246c('0xd1')](_0x246c('0x170'),_0x1eefdd);logger[_0x246c('0x2b')](_0x246c('0x171'),_0x83cf5b,_0x4661ce,_0x1ee0f9[_0x246c('0x172')],_0x1ee0f9[_0x246c('0x5d')]);return this[_0x246c('0x34')][_0x246c('0x126')](_0x83cf5b,_0x4661ce,_0x1ee0f9[_0x246c('0x172')],_0x1ee0f9[_0x246c('0x5d')],undefined,!![]);};AGIVertices[_0x246c('0x11')][_0x246c('0x173')]=function(_0x89f2a0){logger['info'](util['format'](_0x246c('0x174'),_0x89f2a0[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x89f2a0[_0x246c('0x6c')])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0x175'));}var _0xd3b515=this[_0x246c('0x5b')][_0x246c('0x69')](this,_0x89f2a0);logger[_0x246c('0x2b')](util['format'](_0x246c('0x176'),util[_0x246c('0x177')](_0xd3b515,{'showHidden':![],'depth':null})));if(!this[_0x246c('0x98')](_0x89f2a0['variable_id'])){return this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0x178'));}var _0x38bbed=this[_0x246c('0x92')][_0x246c('0x69')](this,_0x89f2a0[_0x246c('0xce')]);if(!_0x38bbed){return this['channel'][_0x246c('0x29')](_0x89f2a0,'no\x20variable\x20found');}this[_0x246c('0x34')]['setVariable'](util[_0x246c('0x26')](_0x246c('0x179'),_0x38bbed),_0xd3b515[_0x246c('0x17a')]?_0xd3b515['statusCode']:_0x246c('0x17b'));this['channel'][_0x246c('0xd1')](util[_0x246c('0x26')](_0x246c('0x17c'),_0x38bbed),_0xd3b515['statusMessage']?_0xd3b515[_0x246c('0x6f')]:'OK');if(_0xd3b515['body']){try{this[_0x246c('0x8e')](_0xd3b515[_0x246c('0x63')],_0x38bbed);}catch(_0x1109ce){logger['error'](util[_0x246c('0x26')](_0x246c('0x17d'),_0x38bbed));}}return this[_0x246c('0x34')]['noop'](util[_0x246c('0x26')]('variable\x20%s\x20set',_0x38bbed));};AGIVertices[_0x246c('0x11')][_0x246c('0x17e')]=function(_0x2796ff){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x17f'),_0x2796ff['label']));return this['channel']['sayDigits'](_0x2796ff[_0x246c('0x180')][_0x246c('0xcc')](/\s+/g,''),_0x2796ff['escape_digits']);};AGIVertices[_0x246c('0x11')]['saynumber']=function(_0x19ebf0){logger['info'](util[_0x246c('0x26')](_0x246c('0x181'),_0x19ebf0['label']));return this[_0x246c('0x34')][_0x246c('0x182')](_0x19ebf0['number']['replace'](/\s+/g,''),_0x19ebf0[_0x246c('0x172')]);};AGIVertices[_0x246c('0x11')]['sayphonetic']=function(_0x41e85a){logger[_0x246c('0x2b')](util[_0x246c('0x26')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x41e85a[_0x246c('0x36')]));return this[_0x246c('0x34')][_0x246c('0x183')](_0x41e85a[_0x246c('0x58')],_0x41e85a['escape_digits']);};AGIVertices[_0x246c('0x11')]['sendMail']=function(_0x4442e1){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x184'),_0x4442e1[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x4442e1[_0x246c('0x185')])){return this['channel'][_0x246c('0x99')](_0x246c('0x186'));}var _0x2353fd=this['getMailAccount'][_0x246c('0x69')](this,_0x4442e1[_0x246c('0x185')]);if(!_0x2353fd||!_0x2353fd[_0x246c('0x187')]){return this['channel'][_0x246c('0x29')](_0x4442e1,_0x246c('0x188'));}var _0x358756={'from':util[_0x246c('0x26')](_0x246c('0x189'),_0x2353fd['name'],_0x2353fd[_0x246c('0x18a')]||_0x2353fd[_0x246c('0x187')]['user']),'to':_0x4442e1['to']||'','cc':_0x4442e1['cc']||'','bcc':_0x4442e1[_0x246c('0x18b')]||'','subject':_0x4442e1[_0x246c('0x18c')],'html':_0x4442e1[_0x246c('0x58')],'text':_0x4442e1[_0x246c('0x58')]};var _0xdd404e={'tls':{'rejectUnauthorized':![]}};if(_0x2353fd[_0x246c('0x187')][_0x246c('0x18d')]){_0xdd404e[_0x246c('0x18d')]=_0x2353fd[_0x246c('0x187')]['service'];}else{_0xdd404e['host']=_0x2353fd['Smtp'][_0x246c('0x18e')];_0xdd404e[_0x246c('0x18f')]=_0x2353fd[_0x246c('0x187')][_0x246c('0x18f')];_0xdd404e[_0x246c('0x190')]=_0x2353fd[_0x246c('0x187')][_0x246c('0x190')];}if(_0x2353fd[_0x246c('0x187')]['authentication']){_0xdd404e['auth']={'user':_0x2353fd[_0x246c('0x187')]['user'],'pass':_0x2353fd['Smtp']['pass']};}if(this['isConfigured'](_0x4442e1[_0x246c('0x191')])){}logger[_0x246c('0xd5')]('sendMail\x20message',JSON['stringify'](_0x358756));this[_0x246c('0x33')][_0x246c('0x69')](this,_0x4442e1,_0x4442e1[_0x246c('0x185')]);this[_0x246c('0x34')]['noop'](util[_0x246c('0x26')](_0x246c('0x192'),_0x2353fd[_0x246c('0x13')]));this['sendMailMessage'][_0x246c('0x69')](this,_0xdd404e,_0x358756);return this[_0x246c('0x34')]['noop'](_0x246c('0x193'));};AGIVertices[_0x246c('0x11')][_0x246c('0x194')]=function(_0x1757f7){logger[_0x246c('0x2b')](util['format'](_0x246c('0x195'),_0x1757f7[_0x246c('0x36')]));return this['channel'][_0x246c('0x99')](_0x246c('0x196'));};AGIVertices[_0x246c('0x11')][_0x246c('0x197')]=function(_0x575e1a){logger['info'](util['format'](_0x246c('0x198'),_0x575e1a[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x575e1a[_0x246c('0x199')])){return this['channel']['noop'](_0x246c('0x19a'));}var _0x17ebcd=this['getSmsAccount']['sync'](this,_0x575e1a[_0x246c('0x199')]);if(!_0x17ebcd){return this[_0x246c('0x34')][_0x246c('0x29')](_0x575e1a,_0x246c('0x19b'));}var _0x3a769c={'body':_0x575e1a[_0x246c('0x19c')],'phone':_0x575e1a['to']||'','SmsAccountId':_0x17ebcd['id']};logger[_0x246c('0xd5')](_0x246c('0x19d'),JSON[_0x246c('0x6d')](_0x3a769c));this['createSquareDetailsReport'][_0x246c('0x69')](this,_0x575e1a,_0x575e1a[_0x246c('0x199')]);this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x19e'),_0x17ebcd['name']));this[_0x246c('0x32')]['sync'](this,_0x3a769c);return this[_0x246c('0x34')][_0x246c('0x99')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x246c('0x19f')]=function(_0x168ba7){logger['info'](util[_0x246c('0x26')](_0x246c('0x1a0'),_0x168ba7[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x168ba7[_0x246c('0xce')])){return this['channel']['error'](_0x168ba7,_0x246c('0x1a1'));}var _0x248a05=this[_0x246c('0x92')][_0x246c('0x69')](this,_0x168ba7[_0x246c('0xce')]);if(!_0x248a05){return this[_0x246c('0x34')][_0x246c('0x29')](_0x168ba7,'no\x20variable\x20found');}return this[_0x246c('0x34')]['setVariable'](_0x248a05,_0x168ba7[_0x246c('0x1a2')]);};AGIVertices[_0x246c('0x11')][_0x246c('0x1a3')]=function(_0x1e0429){logger[_0x246c('0x2b')](util['format'](_0x246c('0x1a4'),_0x1e0429[_0x246c('0x36')]));this[_0x246c('0x34')][_0x246c('0x99')](_0x246c('0x1a5'));if(_0x1e0429[_0x246c('0xaa')]===_0x246c('0x1a6')){this[_0x246c('0x34')][_0x246c('0x99')]('Answer');return this[_0x246c('0x34')][_0x246c('0xaa')]();}return this[_0x246c('0x34')]['noop'](_0x246c('0x1a7'));};AGIVertices[_0x246c('0x11')]['subproject']=function(_0x19075b){logger[_0x246c('0x2b')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x19075b[_0x246c('0x36')]));if(!this[_0x246c('0x98')](_0x19075b[_0x246c('0x1a8')])){return this['channel'][_0x246c('0x29')](_0x19075b,_0x246c('0x1a9'));}var _0x22e67e=this['getSquareProject'][_0x246c('0x69')](this,_0x19075b['project_id']);if(!this[_0x246c('0x98')](_0x22e67e)){return this[_0x246c('0x34')][_0x246c('0x29')](_0x19075b,util[_0x246c('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x19075b[_0x246c('0x1a8')]));}if(_0x22e67e===this[_0x246c('0x34')][_0x246c('0x3d')]){return this[_0x246c('0x34')][_0x246c('0x29')](_0x19075b,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x19075b,_0x22e67e);var _0x1d748b=this[_0x246c('0x34')][_0x246c('0x54')](_0x246c('0x1aa'),util[_0x246c('0x26')](_0x246c('0x1ab'),config[_0x246c('0xa7')][_0x246c('0x18e')]||_0x246c('0x1ac'),_0x22e67e,this['channel']['arg_1']));if(_0x1d748b[_0x246c('0x93')]===-0x1){return _0x1d748b;}return this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')]('Executed\x20command\x20%s\x20%s','AGI',_0x22e67e));};AGIVertices['prototype'][_0x246c('0x1ad')]=function(_0x11ce3a){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x1ae'),_0x11ce3a[_0x246c('0x36')]));var _0x3907de=this[_0x246c('0x53')][_0x246c('0x69')](this,_0x11ce3a[_0x246c('0xa8')]);this[_0x246c('0x33')][_0x246c('0x69')](this,_0x11ce3a,_0x11ce3a[_0x246c('0xa8')]);if(this[_0x246c('0x98')](_0x11ce3a[_0x246c('0xce')])){var _0x3a03b7=this[_0x246c('0x92')][_0x246c('0x69')](this,_0x11ce3a['variable_id']);if(_0x3a03b7){this[_0x246c('0x34')][_0x246c('0xd1')](_0x3a03b7,_0x3907de);return this['channel'][_0x246c('0x99')](util['format'](_0x246c('0x1af'),_0x11ce3a[_0x246c('0xa8')],_0x3a03b7));}}return this['channel'][_0x246c('0x99')](util['format'](_0x246c('0x1b0'),_0x11ce3a[_0x246c('0xa8')]));};AGIVertices[_0x246c('0x11')][_0x246c('0x1b1')]=function(_0x4c1c62){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x1b2'),_0x4c1c62[_0x246c('0x36')]));_0x4c1c62['text']=_0x4c1c62[_0x246c('0x58')][_0x246c('0xcc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x246c('0x98')](_0x4c1c62[_0x246c('0x1b3')])){return this['channel'][_0x246c('0x99')](_0x246c('0x1b4'));}if(!this[_0x246c('0x98')](_0x4c1c62[_0x246c('0x58')])){return this[_0x246c('0x34')]['noop']('no\x20text\x20configured');}this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x1b5'),_0x4c1c62[_0x246c('0x58')]));var _0x121dda=this[_0x246c('0x56')][_0x246c('0x69')](this,_0x4c1c62);if(_0x121dda){this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x1b6'),_0x121dda));var _0x3824ef=this[_0x246c('0x34')][_0x246c('0xf9')](_0x121dda);try{fs[_0x246c('0xfa')](_0x121dda+_0x246c('0xfb'));}catch(_0x52c6e2){logger[_0x246c('0x29')](_0x52c6e2);}return _0x3824ef;}return this[_0x246c('0x34')][_0x246c('0x29')](_0x4c1c62,_0x246c('0x1b7'));};AGIVertices[_0x246c('0x11')][_0x246c('0x1b8')]=function(_0x531d9f){logger[_0x246c('0x2b')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x531d9f[_0x246c('0x36')]));_0x531d9f[_0x246c('0x58')]=_0x531d9f[_0x246c('0x58')][_0x246c('0xcc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x246c('0x98')](_0x531d9f[_0x246c('0x58')])){return this['channel'][_0x246c('0x99')](_0x246c('0xba'));}this['channel'][_0x246c('0x99')](util[_0x246c('0x26')]('Trying\x20Google\x20TTS\x20%s',_0x531d9f[_0x246c('0x58')]));var _0x59c4a5=this['googleTTS']['sync'](this,_0x531d9f);if(_0x59c4a5){this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x1b9'),_0x59c4a5));var _0x42b058=this['channel'][_0x246c('0xf9')](_0x59c4a5);try{fs['unlink'](_0x59c4a5+'.wav');}catch(_0x23df8d){logger['error'](_0x23df8d);}return _0x42b058;}return this[_0x246c('0x34')][_0x246c('0x29')](_0x531d9f,_0x246c('0x1ba'));};AGIVertices[_0x246c('0x11')][_0x246c('0x1bb')]=function(_0x44f246){logger[_0x246c('0x2b')](util['format'](_0x246c('0x1bc'),_0x44f246[_0x246c('0x36')]));if(!this['isConfigured'](_0x44f246[_0x246c('0x149')])){return this[_0x246c('0x34')][_0x246c('0x29')](_0x44f246,_0x246c('0x15e'));}logger['info'](util['format'](_0x246c('0x148'),this[_0x246c('0x34')][_0x246c('0x38')],_0x44f246[_0x246c('0x149')]));var _0x2e0607=this[_0x246c('0x4f')]['sync'](this,_0x44f246[_0x246c('0x149')]);if(_0x2e0607){logger[_0x246c('0x2b')](util[_0x246c('0x26')](_0x246c('0x14b'),this[_0x246c('0x34')][_0x246c('0x38')],_0x44f246['findBy']));this[_0x246c('0x34')]['noop'](util['format'](_0x246c('0x14b'),this[_0x246c('0x34')][_0x246c('0x38')],_0x44f246['findBy']));return{'code':0xc8,'result':_0x246c('0x1bd')};}else{logger['info'](util[_0x246c('0x26')](_0x246c('0x14c'),this[_0x246c('0x34')][_0x246c('0x38')],_0x44f246[_0x246c('0x149')]));this[_0x246c('0x34')][_0x246c('0x99')](util[_0x246c('0x26')](_0x246c('0x14c'),this['channel'][_0x246c('0x38')],_0x44f246['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x246c('0x11')][_0x246c('0x1be')]=function(_0x240725){logger[_0x246c('0x2b')](util['format'](_0x246c('0x1bf'),_0x240725[_0x246c('0x36')]));var _0x578e91=this[_0x246c('0x34')][_0x246c('0x54')](_0x246c('0x1c0'),[_0x240725[_0x246c('0x1c1')],_0x240725[_0x246c('0x72')]]);if(_0x578e91[_0x246c('0x93')]===-0x1){return _0x578e91;}return this[_0x246c('0x34')]['noop'](util[_0x246c('0x26')](_0x246c('0x161'),'VOICEMAIL',_0x240725['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x41776d){logger['info'](util[_0x246c('0x26')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x41776d[_0x246c('0x36')]));if(!this['isConfigured'](_0x41776d[_0x246c('0xce')])){return this[_0x246c('0x34')][_0x246c('0x29')](_0x41776d,_0x246c('0x1a1'));}var _0x55e98f=this[_0x246c('0x92')][_0x246c('0x69')](this,_0x41776d[_0x246c('0xce')]);if(!_0x55e98f){return this[_0x246c('0x34')][_0x246c('0x29')](_0x41776d,_0x246c('0x10d'));}var _0x1f214c=this['channel']['getVariable'](_0x55e98f);return{'code':0xc8,'result':_0x1f214c[_0x246c('0x91')]?_0x1f214c[_0x246c('0x91')]:'-'};};String[_0x246c('0x11')][_0x246c('0x1c2')]=function(_0x484412,_0xeacd02){return this[_0x246c('0x90')](_0x484412)[_0x246c('0x1c3')](_0xeacd02);};module[_0x246c('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ca4b5a6..36917d1 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 _0xe421=['secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','message','interface','[ACW][syncAgentConnect]\x20%s','acw','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe421,0xc9));var _0x1e42=function(_0x583351,_0x156ab2){_0x583351=_0x583351-0x0;var _0x4753a0=_0xe421[_0x583351];return _0x4753a0;};'use strict';var util=require(_0x1e42('0x0'));var _=require('lodash');var moment=require(_0x1e42('0x1'));var ami=require(_0x1e42('0x2'));var logger=require(_0x1e42('0x3'))('acw');var RpcUser=require(_0x1e42('0x4'));var RpcVoiceAgentReport=require(_0x1e42('0x5'));function Acw(_0x545603){this[_0x1e42('0x6')]=_0x545603[_0x1e42('0x6')];this[_0x1e42('0x7')]=_0x545603['agents'];this[_0x1e42('0x8')]=_0x545603[_0x1e42('0x8')];this['channels']={};ami['on']('agentconnect',this[_0x1e42('0x9')][_0x1e42('0xa')](this));ami['on'](_0x1e42('0xb'),this[_0x1e42('0xc')][_0x1e42('0xa')](this));ami['on'](_0x1e42('0xd'),this[_0x1e42('0xe')][_0x1e42('0xa')](this));ami['on'](_0x1e42('0xf'),this[_0x1e42('0x10')]['bind'](this));ami['on'](_0x1e42('0x11'),this[_0x1e42('0x12')][_0x1e42('0xa')](this));ami['on'](_0x1e42('0x13'),this[_0x1e42('0x14')][_0x1e42('0xa')](this));ami['on'](_0x1e42('0x15'),this[_0x1e42('0x16')][_0x1e42('0xa')](this));}function getDiff(_0x446351){var _0x31cc6f=moment()[_0x1e42('0x17')](0x0);var _0x10dbe1=moment(_0x446351)[_0x1e42('0x17')](0x0);return _0x31cc6f[_0x1e42('0x18')](_0x10dbe1,_0x1e42('0x19'));}Acw[_0x1e42('0x1a')][_0x1e42('0x1b')]=function(_0x2de0ad){try{var _0x1e7696=this;var _0xbf39ea=this['channels'][_0x2de0ad]['interface'];var _0x3dac31=this[_0x1e42('0x1c')][_0x2de0ad][_0x1e42('0x1d')];var _0xfed2cb=this['voiceQueues'][_0x3dac31];var _0x1f27fd=![];var _0x260378=_0x1e42('0x1e');if(_0xfed2cb[_0x1e42('0x1f')]){if(_0xfed2cb['mandatoryDispositionPause'][_0x1e42('0x20')]){_0x1f27fd=!![];_0x260378=_0xfed2cb[_0x1e42('0x21')][_0x1e42('0x20')];}}ami[_0x1e42('0x22')]({'action':_0x1e42('0x23'),'interface':_0xbf39ea,'paused':!![],'reason':_0x260378})[_0x1e42('0x24')](function(_0x231f71){if(_0x1e7696[_0x1e42('0x7')][_0xbf39ea]){return RpcUser[_0x1e42('0x25')](_0x1e7696[_0x1e42('0x7')][_0xbf39ea]['id'])[_0x1e42('0x24')](function(_0x53da54){if(_0x53da54&&!_0x53da54[_0x1e42('0x26')]){logger['info'](_0x1e42('0x27'),_0x2de0ad,_0xbf39ea,_0x3dac31);var _0x2b6c78=_0x1e7696[_0x1e42('0x1c')][_0x2de0ad][_0x1e42('0x28')]&&_0x1e7696[_0x1e42('0x1c')][_0x2de0ad][_0x1e42('0x29')]?_0x1e7696[_0x1e42('0x1c')][_0x2de0ad][_0x1e42('0x29')]:_0x2de0ad;return RpcUser['savePause'](_0x1e7696[_0x1e42('0x7')][_0xbf39ea],_0x260378,_0x2b6c78)['then'](function(_0x3e6f8e){if(!_0x1f27fd){_0x1e7696[_0x1e42('0x8')][_0xbf39ea]={};logger[_0x1e42('0x2a')](_0x1e42('0x2b'),_0x2de0ad,_0x1e7696[_0x1e42('0x6')][_0x3dac31]['acwTimeout'],_0xbf39ea,_0x3dac31);_0x1e7696['timers'][_0xbf39ea][_0x1e42('0x2c')]=setTimeout(_0x1e7696[_0x1e42('0x2d')][_0x1e42('0xa')](_0x1e7696,_0xbf39ea),_0x1e7696['voiceQueues'][_0x3dac31][_0x1e42('0x2e')]*0x3e8);_0x1e7696['timers'][_0xbf39ea]['lastPauseAt']=moment()[_0x1e42('0x2f')](_0x1e42('0x30'));_0x1e7696[_0x1e42('0x8')][_0xbf39ea][_0x1e42('0x31')]=_0x2de0ad;_0x1e7696[_0x1e42('0x8')][_0xbf39ea][_0x1e42('0x1d')]=_0x3dac31;_0x1e7696[_0x1e42('0x8')][_0xbf39ea][_0x1e42('0x32')]=function(){var _0x2783b4=getDiff(_0x1e7696[_0x1e42('0x8')][_0xbf39ea][_0x1e42('0x33')]);clearTimeout(_0x1e7696[_0x1e42('0x8')][_0xbf39ea][_0x1e42('0x2c')]);_0x1e7696[_0x1e42('0x8')][_0xbf39ea][_0x1e42('0x2c')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2783b4},_0x1e7696[_0x1e42('0x8')][_0xbf39ea]['uniqueid'],_0xbf39ea)[_0x1e42('0x24')](function(_0x4218fa){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x2de0ad,_0x2783b4,_0x4218fa);})[_0x1e42('0x34')](function(_0x2b417e){logger[_0x1e42('0x35')](_0x1e42('0x36'),_0x2de0ad,_0x2b417e);});delete _0x1e7696['timers'][_0xbf39ea];};}});}else{logger['info'](_0x1e42('0x37'),_0x2de0ad,_0xbf39ea,_0x3dac31);}});}})['catch'](function(_0x39503c){logger[_0x1e42('0x35')](_0x1e42('0x2b'),_0x2de0ad,_0x1e7696[_0x1e42('0x6')][_0x3dac31][_0x1e42('0x2e')],_0xbf39ea,_0x3dac31);})[_0x1e42('0x38')](function(){delete _0x1e7696['channels'][_0x2de0ad];});}catch(_0x426542){logger['error']('[ACW][START]\x20%s',_0x426542['message']);}};Acw[_0x1e42('0x1a')][_0x1e42('0x2d')]=function(_0x52274c){try{var _0x49b962=this;if(_0x49b962[_0x1e42('0x8')][_0x52274c]){_0x49b962[_0x1e42('0x8')][_0x52274c][_0x1e42('0x2c')]=![];var _0x508d86=_0x49b962[_0x1e42('0x8')][_0x52274c][_0x1e42('0x31')];var _0xf6c6a6=_0x49b962[_0x1e42('0x8')][_0x52274c][_0x1e42('0x1d')];var _0x4f009f=_0x49b962[_0x1e42('0x6')][_0xf6c6a6][_0x1e42('0x2e')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x508d86,_0x52274c);RpcUser[_0x1e42('0x39')](this[_0x1e42('0x7')][_0x52274c]);RpcVoiceAgentReport[_0x1e42('0x3a')]({'acwtime':_0x4f009f,'agentacw':!![]},_0x508d86,_0x52274c)[_0x1e42('0x24')](function(_0x3d313b){logger[_0x1e42('0x2a')](_0x1e42('0x3b'),_0x508d86,_0x4f009f,_0x3d313b);})[_0x1e42('0x34')](function(_0x4f5fb3){logger['error'](_0x1e42('0x36'),_0x508d86,_0x4f5fb3);});}else{logger[_0x1e42('0x35')](_0x1e42('0x3c'),_0x52274c);if(_0x49b962['timers']){logger['info'](_0x1e42('0x3d'),JSON['stringify'](_0x49b962[_0x1e42('0x8')]));}}}catch(_0x5d1518){logger['error']('[ACW][STOP]\x20%s',_0x5d1518[_0x1e42('0x3e')]);}};Acw[_0x1e42('0x1a')][_0x1e42('0x9')]=function(_0x5dea2a){try{if(this['voiceQueues'][_0x5dea2a[_0x1e42('0x1d')]]&&(this[_0x1e42('0x6')][_0x5dea2a['queue']]['acw']||this['voiceQueues'][_0x5dea2a[_0x1e42('0x1d')]][_0x1e42('0x1f')])){if(this['agents'][_0x5dea2a['interface']]){this['channels'][_0x5dea2a[_0x1e42('0x31')]]={'queue':_0x5dea2a[_0x1e42('0x1d')],'interface':_0x5dea2a[_0x1e42('0x3f')],'destlinkedid':_0x5dea2a[_0x1e42('0x29')]};}}}catch(_0x5381d8){logger[_0x1e42('0x35')](_0x1e42('0x40'),_0x5381d8[_0x1e42('0x3e')]);}};Acw[_0x1e42('0x1a')][_0x1e42('0x16')]=function(_0x22ea0f){try{if(this[_0x1e42('0x6')][_0x22ea0f['queue']]&&(this[_0x1e42('0x6')][_0x22ea0f['queue']][_0x1e42('0x41')]||this['voiceQueues'][_0x22ea0f['queue']]['mandatoryDisposition'])){if(this[_0x1e42('0x7')][_0x22ea0f[_0x1e42('0x3f')]]){this[_0x1e42('0x1c')][_0x22ea0f[_0x1e42('0x31')]]={'queue':_0x22ea0f[_0x1e42('0x1d')],'interface':_0x22ea0f['interface']};}}}catch(_0x36090f){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x36090f[_0x1e42('0x3e')]);}};Acw[_0x1e42('0x1a')][_0x1e42('0xc')]=function(_0x451a4c){try{if(this[_0x1e42('0x1c')][_0x451a4c[_0x1e42('0x31')]]&&_[_0x1e42('0x42')](this[_0x1e42('0x1c')][_0x451a4c[_0x1e42('0x31')]][_0x1e42('0x28')])){logger[_0x1e42('0x2a')](_0x1e42('0x43'),_0x451a4c[_0x1e42('0x31')]);this[_0x1e42('0x1b')](_0x451a4c[_0x1e42('0x31')]);}else if(this['channels'][_0x451a4c[_0x1e42('0x44')]]&&_[_0x1e42('0x42')](this[_0x1e42('0x1c')][_0x451a4c[_0x1e42('0x44')]][_0x1e42('0x28')])){logger[_0x1e42('0x2a')](_0x1e42('0x45'),_0x451a4c[_0x1e42('0x44')]);this[_0x1e42('0x1b')](_0x451a4c[_0x1e42('0x44')]);}}catch(_0x203c99){logger[_0x1e42('0x35')](_0x1e42('0x46'),_0x203c99['message']);}};Acw['prototype'][_0x1e42('0xe')]=function(_0x32cb3f){try{if(this['channels'][_0x32cb3f[_0x1e42('0x31')]]&&this[_0x1e42('0x1c')][_0x32cb3f['uniqueid']][_0x1e42('0x28')]){logger[_0x1e42('0x2a')](_0x1e42('0x47'),_0x32cb3f[_0x1e42('0x31')]);this['startAcw'](_0x32cb3f['uniqueid']);}else if(this[_0x1e42('0x1c')][_0x32cb3f[_0x1e42('0x44')]]&&this['channels'][_0x32cb3f['linkedid']][_0x1e42('0x28')]){logger[_0x1e42('0x2a')](_0x1e42('0x48'),_0x32cb3f[_0x1e42('0x44')]);this[_0x1e42('0x1b')](_0x32cb3f[_0x1e42('0x44')]);}}catch(_0x392123){logger[_0x1e42('0x35')](_0x1e42('0x49'),_0x392123[_0x1e42('0x3e')]);}};Acw[_0x1e42('0x1a')][_0x1e42('0x12')]=function(_0x2f3e0d){try{if(!_['isNil'](this[_0x1e42('0x1c')][_0x2f3e0d['transfereeuniqueid']])){this[_0x1e42('0x1b')](_0x2f3e0d[_0x1e42('0x4a')]);if(this[_0x1e42('0x1c')][_0x2f3e0d[_0x1e42('0x4b')]]){this[_0x1e42('0x1c')][_0x2f3e0d[_0x1e42('0x4b')]][_0x1e42('0x28')]=!![];this[_0x1e42('0x1c')][_0x2f3e0d[_0x1e42('0x4c')]]=this[_0x1e42('0x1c')][_0x2f3e0d[_0x1e42('0x4b')]];delete this['channels'][_0x2f3e0d[_0x1e42('0x4b')]];}}else if(!_[_0x1e42('0x4d')](this[_0x1e42('0x1c')][_0x2f3e0d[_0x1e42('0x4c')]])){this[_0x1e42('0x1b')](_0x2f3e0d[_0x1e42('0x4c')]);if(this['channels'][_0x2f3e0d[_0x1e42('0x4e')]]){this['channels'][_0x2f3e0d['origtransfereruniqueid']][_0x1e42('0x28')]=!![];this['channels'][_0x2f3e0d[_0x1e42('0x4a')]]=this[_0x1e42('0x1c')][_0x2f3e0d[_0x1e42('0x4e')]];delete this[_0x1e42('0x1c')][_0x2f3e0d[_0x1e42('0x4e')]];}}}catch(_0x28b57c){logger[_0x1e42('0x35')](_0x1e42('0x4f'),_0x28b57c['message']);}};Acw[_0x1e42('0x1a')][_0x1e42('0x14')]=function(_0x51ec48){try{if(this[_0x1e42('0x1c')][_0x51ec48[_0x1e42('0x50')]]){logger[_0x1e42('0x2a')](_0x1e42('0x51'),JSON[_0x1e42('0x52')](_0x51ec48[_0x1e42('0x50')]));this[_0x1e42('0x1b')](_0x51ec48['transfereruniqueid']);}else if(this[_0x1e42('0x1c')][_0x51ec48[_0x1e42('0x53')]]){logger[_0x1e42('0x2a')](_0x1e42('0x54'),JSON[_0x1e42('0x52')](_0x51ec48[_0x1e42('0x53')]));this['startAcw'](_0x51ec48[_0x1e42('0x53')]);}}catch(_0x85fe7c){logger['error'](_0x1e42('0x55'),_0x85fe7c['message']);}};Acw[_0x1e42('0x1a')]['syncAgentRingNoAnswer']=function(_0x58115a){try{if(this['voiceQueues'][_0x58115a[_0x1e42('0x1d')]]&&this[_0x1e42('0x6')][_0x58115a[_0x1e42('0x1d')]][_0x1e42('0x56')]===_0x1e42('0x57')){if(this[_0x1e42('0x7')][_0x58115a[_0x1e42('0x3f')]]){logger[_0x1e42('0x2a')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x58115a['uniqueid'],_0x58115a[_0x1e42('0x3f')],_0x58115a[_0x1e42('0x1d')]);return RpcUser[_0x1e42('0x58')](this[_0x1e42('0x7')][_0x58115a[_0x1e42('0x3f')]],_0x1e42('0x59'),_0x58115a[_0x1e42('0x31')]);}}}catch(_0x57d8a6){logger[_0x1e42('0x35')](_0x1e42('0x5a'),_0x57d8a6['message']);}};module[_0x1e42('0x5b')]=Acw; \ No newline at end of file +var _0xfb70=['../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','diff','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user'];(function(_0x32b297,_0x3cf096){var _0x15c39f=function(_0x2b56ea){while(--_0x2b56ea){_0x32b297['push'](_0x32b297['shift']());}};_0x15c39f(++_0x3cf096);}(_0xfb70,0x151));var _0x0fb7=function(_0x1192d5,_0x2e444d){_0x1192d5=_0x1192d5-0x0;var _0x542fa5=_0xfb70[_0x1192d5];return _0x542fa5;};'use strict';var util=require(_0x0fb7('0x0'));var _=require(_0x0fb7('0x1'));var moment=require(_0x0fb7('0x2'));var ami=require(_0x0fb7('0x3'));var logger=require(_0x0fb7('0x4'))(_0x0fb7('0x5'));var RpcUser=require(_0x0fb7('0x6'));var RpcVoiceAgentReport=require(_0x0fb7('0x7'));function Acw(_0x1ed091){this[_0x0fb7('0x8')]=_0x1ed091[_0x0fb7('0x8')];this[_0x0fb7('0x9')]=_0x1ed091[_0x0fb7('0x9')];this[_0x0fb7('0xa')]=_0x1ed091['timers'];this[_0x0fb7('0xb')]={};ami['on'](_0x0fb7('0xc'),this[_0x0fb7('0xd')][_0x0fb7('0xe')](this));ami['on'](_0x0fb7('0xf'),this['syncHangupRequest'][_0x0fb7('0xe')](this));ami['on'](_0x0fb7('0x10'),this[_0x0fb7('0x11')][_0x0fb7('0xe')](this));ami['on'](_0x0fb7('0x12'),this[_0x0fb7('0x13')]['bind'](this));ami['on'](_0x0fb7('0x14'),this[_0x0fb7('0x15')][_0x0fb7('0xe')](this));ami['on'](_0x0fb7('0x16'),this[_0x0fb7('0x17')][_0x0fb7('0xe')](this));ami['on'](_0x0fb7('0x18'),this['syncAgentConnectPreview'][_0x0fb7('0xe')](this));}function getDiff(_0xc8dc5c){var _0x541896=moment()['milliseconds'](0x0);var _0x358dae=moment(_0xc8dc5c)['milliseconds'](0x0);return _0x541896[_0x0fb7('0x19')](_0x358dae,_0x0fb7('0x1a'));}Acw['prototype'][_0x0fb7('0x1b')]=function(_0x3dae4d){try{var _0xddfe6b=this;var _0x5ed058=this['channels'][_0x3dae4d][_0x0fb7('0x1c')];var _0x17e6ac=this[_0x0fb7('0xb')][_0x3dae4d][_0x0fb7('0x1d')];var _0x568ec3=this[_0x0fb7('0x8')][_0x17e6ac];var _0x3f25dd=![];var _0x3c6e9b=_0x0fb7('0x1e');if(_0x568ec3[_0x0fb7('0x1f')]){if(_0x568ec3['mandatoryDispositionPause']['name']){_0x3f25dd=!![];_0x3c6e9b=_0x568ec3[_0x0fb7('0x20')][_0x0fb7('0x21')];}}ami[_0x0fb7('0x22')]({'action':_0x0fb7('0x23'),'interface':_0x5ed058,'paused':!![],'reason':_0x3c6e9b})['then'](function(_0x32c799){if(_0xddfe6b['agents'][_0x5ed058]){return RpcUser['getAgent'](_0xddfe6b[_0x0fb7('0x9')][_0x5ed058]['id'])[_0x0fb7('0x24')](function(_0x2ccdd2){if(_0x2ccdd2&&!_0x2ccdd2[_0x0fb7('0x25')]){logger[_0x0fb7('0x26')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3dae4d,_0x5ed058,_0x17e6ac);var _0xb1f7d5=_0xddfe6b['channels'][_0x3dae4d][_0x0fb7('0x27')]&&_0xddfe6b['channels'][_0x3dae4d][_0x0fb7('0x28')]?_0xddfe6b[_0x0fb7('0xb')][_0x3dae4d][_0x0fb7('0x28')]:_0x3dae4d;return RpcUser[_0x0fb7('0x29')](_0xddfe6b[_0x0fb7('0x9')][_0x5ed058],_0x3c6e9b,_0xb1f7d5)[_0x0fb7('0x24')](function(_0x99d55a){if(!_0x3f25dd){_0xddfe6b[_0x0fb7('0xa')][_0x5ed058]={};logger['info'](_0x0fb7('0x2a'),_0x3dae4d,_0xddfe6b['voiceQueues'][_0x17e6ac][_0x0fb7('0x2b')],_0x5ed058,_0x17e6ac);_0xddfe6b[_0x0fb7('0xa')][_0x5ed058][_0x0fb7('0x2c')]=setTimeout(_0xddfe6b[_0x0fb7('0x2d')]['bind'](_0xddfe6b,_0x5ed058),_0xddfe6b['voiceQueues'][_0x17e6ac][_0x0fb7('0x2b')]*0x3e8);_0xddfe6b[_0x0fb7('0xa')][_0x5ed058]['lastPauseAt']=moment()[_0x0fb7('0x2e')](_0x0fb7('0x2f'));_0xddfe6b[_0x0fb7('0xa')][_0x5ed058][_0x0fb7('0x30')]=_0x3dae4d;_0xddfe6b[_0x0fb7('0xa')][_0x5ed058][_0x0fb7('0x1d')]=_0x17e6ac;_0xddfe6b[_0x0fb7('0xa')][_0x5ed058]['updateAcw']=function(){var _0x113ac0=getDiff(_0xddfe6b[_0x0fb7('0xa')][_0x5ed058]['lastPauseAt']);clearTimeout(_0xddfe6b[_0x0fb7('0xa')][_0x5ed058]['timer']);_0xddfe6b[_0x0fb7('0xa')][_0x5ed058]['timer']=![];RpcVoiceAgentReport[_0x0fb7('0x31')]({'acwtime':_0x113ac0},_0xddfe6b[_0x0fb7('0xa')][_0x5ed058][_0x0fb7('0x30')],_0x5ed058)[_0x0fb7('0x24')](function(_0x5c1074){logger['info'](_0x0fb7('0x32'),_0x3dae4d,_0x113ac0,_0x5c1074);})[_0x0fb7('0x33')](function(_0x461d9b){logger[_0x0fb7('0x34')](_0x0fb7('0x35'),_0x3dae4d,_0x461d9b);});delete _0xddfe6b[_0x0fb7('0xa')][_0x5ed058];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x3dae4d,_0x5ed058,_0x17e6ac);}});}})[_0x0fb7('0x33')](function(_0x2ae8b1){logger[_0x0fb7('0x34')](_0x0fb7('0x2a'),_0x3dae4d,_0xddfe6b['voiceQueues'][_0x17e6ac][_0x0fb7('0x2b')],_0x5ed058,_0x17e6ac);})[_0x0fb7('0x36')](function(){delete _0xddfe6b[_0x0fb7('0xb')][_0x3dae4d];});}catch(_0x43257d){logger['error']('[ACW][START]\x20%s',_0x43257d[_0x0fb7('0x37')]);}};Acw[_0x0fb7('0x38')]['stopAcw']=function(_0x4479a4){try{var _0x44d3c2=this;if(_0x44d3c2[_0x0fb7('0xa')][_0x4479a4]){_0x44d3c2[_0x0fb7('0xa')][_0x4479a4][_0x0fb7('0x2c')]=![];var _0x5708cd=_0x44d3c2[_0x0fb7('0xa')][_0x4479a4][_0x0fb7('0x30')];var _0x5d9efe=_0x44d3c2['timers'][_0x4479a4][_0x0fb7('0x1d')];var _0x1d496e=_0x44d3c2[_0x0fb7('0x8')][_0x5d9efe][_0x0fb7('0x2b')];logger[_0x0fb7('0x26')](_0x0fb7('0x39'),_0x5708cd,_0x4479a4);RpcUser[_0x0fb7('0x3a')](this[_0x0fb7('0x9')][_0x4479a4]);RpcVoiceAgentReport[_0x0fb7('0x31')]({'acwtime':_0x1d496e,'agentacw':!![]},_0x5708cd,_0x4479a4)[_0x0fb7('0x24')](function(_0x151cc9){logger[_0x0fb7('0x26')](_0x0fb7('0x32'),_0x5708cd,_0x1d496e,_0x151cc9);})[_0x0fb7('0x33')](function(_0x28ef73){logger[_0x0fb7('0x34')](_0x0fb7('0x35'),_0x5708cd,_0x28ef73);});}else{logger[_0x0fb7('0x34')](_0x0fb7('0x3b'),_0x4479a4);if(_0x44d3c2[_0x0fb7('0xa')]){logger[_0x0fb7('0x26')](_0x0fb7('0x3c'),JSON[_0x0fb7('0x3d')](_0x44d3c2['timers']));}}}catch(_0xd9ae5b){logger[_0x0fb7('0x34')]('[ACW][STOP]\x20%s',_0xd9ae5b[_0x0fb7('0x37')]);}};Acw['prototype']['syncAgentConnect']=function(_0x9b4da7){try{if(this[_0x0fb7('0x8')][_0x9b4da7[_0x0fb7('0x1d')]]&&(this['voiceQueues'][_0x9b4da7[_0x0fb7('0x1d')]]['acw']||this[_0x0fb7('0x8')][_0x9b4da7[_0x0fb7('0x1d')]][_0x0fb7('0x1f')])){if(this['agents'][_0x9b4da7[_0x0fb7('0x1c')]]){this['channels'][_0x9b4da7[_0x0fb7('0x30')]]={'queue':_0x9b4da7[_0x0fb7('0x1d')],'interface':_0x9b4da7[_0x0fb7('0x1c')],'destlinkedid':_0x9b4da7[_0x0fb7('0x28')]};}}}catch(_0xe193ed){logger[_0x0fb7('0x34')](_0x0fb7('0x3e'),_0xe193ed[_0x0fb7('0x37')]);}};Acw[_0x0fb7('0x38')]['syncAgentConnectPreview']=function(_0x21357c){try{if(this[_0x0fb7('0x8')][_0x21357c['queue']]&&(this['voiceQueues'][_0x21357c[_0x0fb7('0x1d')]]['acw']||this[_0x0fb7('0x8')][_0x21357c['queue']][_0x0fb7('0x1f')])){if(this[_0x0fb7('0x9')][_0x21357c[_0x0fb7('0x1c')]]){this['channels'][_0x21357c[_0x0fb7('0x30')]]={'queue':_0x21357c['queue'],'interface':_0x21357c[_0x0fb7('0x1c')]};}}}catch(_0x2b41d5){logger[_0x0fb7('0x34')](_0x0fb7('0x3f'),_0x2b41d5[_0x0fb7('0x37')]);}};Acw[_0x0fb7('0x38')][_0x0fb7('0x40')]=function(_0x356e8a){try{if(this[_0x0fb7('0xb')][_0x356e8a[_0x0fb7('0x30')]]&&_[_0x0fb7('0x41')](this['channels'][_0x356e8a[_0x0fb7('0x30')]][_0x0fb7('0x27')])){logger[_0x0fb7('0x26')](_0x0fb7('0x42'),_0x356e8a[_0x0fb7('0x30')]);this[_0x0fb7('0x1b')](_0x356e8a[_0x0fb7('0x30')]);}else if(this[_0x0fb7('0xb')][_0x356e8a[_0x0fb7('0x43')]]&&_[_0x0fb7('0x41')](this['channels'][_0x356e8a[_0x0fb7('0x43')]]['attended'])){logger[_0x0fb7('0x26')](_0x0fb7('0x44'),_0x356e8a['linkedid']);this[_0x0fb7('0x1b')](_0x356e8a['linkedid']);}}catch(_0x5b050b){logger[_0x0fb7('0x34')](_0x0fb7('0x45'),_0x5b050b[_0x0fb7('0x37')]);}};Acw[_0x0fb7('0x38')][_0x0fb7('0x11')]=function(_0xa6ddb8){try{if(this[_0x0fb7('0xb')][_0xa6ddb8[_0x0fb7('0x30')]]&&this[_0x0fb7('0xb')][_0xa6ddb8['uniqueid']]['attended']){logger[_0x0fb7('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0xa6ddb8['uniqueid']);this[_0x0fb7('0x1b')](_0xa6ddb8['uniqueid']);}else if(this['channels'][_0xa6ddb8[_0x0fb7('0x43')]]&&this[_0x0fb7('0xb')][_0xa6ddb8['linkedid']][_0x0fb7('0x27')]){logger['info'](_0x0fb7('0x46'),_0xa6ddb8[_0x0fb7('0x43')]);this[_0x0fb7('0x1b')](_0xa6ddb8[_0x0fb7('0x43')]);}}catch(_0x52fc76){logger['error'](_0x0fb7('0x47'),_0x52fc76[_0x0fb7('0x37')]);}};Acw[_0x0fb7('0x38')][_0x0fb7('0x15')]=function(_0x328529){try{if(!_[_0x0fb7('0x48')](this['channels'][_0x328529[_0x0fb7('0x49')]])){this['startAcw'](_0x328529[_0x0fb7('0x49')]);if(this[_0x0fb7('0xb')][_0x328529['secondtransfereruniqueid']]){this[_0x0fb7('0xb')][_0x328529['secondtransfereruniqueid']][_0x0fb7('0x27')]=!![];this[_0x0fb7('0xb')][_0x328529[_0x0fb7('0x4a')]]=this[_0x0fb7('0xb')][_0x328529[_0x0fb7('0x4b')]];delete this[_0x0fb7('0xb')][_0x328529[_0x0fb7('0x4b')]];}}else if(!_['isNil'](this[_0x0fb7('0xb')][_0x328529[_0x0fb7('0x4a')]])){this['startAcw'](_0x328529[_0x0fb7('0x4a')]);if(this[_0x0fb7('0xb')][_0x328529[_0x0fb7('0x4c')]]){this[_0x0fb7('0xb')][_0x328529[_0x0fb7('0x4c')]]['attended']=!![];this[_0x0fb7('0xb')][_0x328529[_0x0fb7('0x49')]]=this[_0x0fb7('0xb')][_0x328529['origtransfereruniqueid']];delete this[_0x0fb7('0xb')][_0x328529[_0x0fb7('0x4c')]];}}}catch(_0x338dcc){logger['error'](_0x0fb7('0x4d'),_0x338dcc[_0x0fb7('0x37')]);}};Acw['prototype'][_0x0fb7('0x17')]=function(_0x1cd318){try{if(this[_0x0fb7('0xb')][_0x1cd318[_0x0fb7('0x4e')]]){logger[_0x0fb7('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x0fb7('0x3d')](_0x1cd318[_0x0fb7('0x4e')]));this['startAcw'](_0x1cd318[_0x0fb7('0x4e')]);}else if(this[_0x0fb7('0xb')][_0x1cd318[_0x0fb7('0x4f')]]){logger[_0x0fb7('0x26')](_0x0fb7('0x50'),JSON[_0x0fb7('0x3d')](_0x1cd318['transfererlinkedid']));this['startAcw'](_0x1cd318[_0x0fb7('0x4f')]);}}catch(_0x38dc96){logger[_0x0fb7('0x34')](_0x0fb7('0x51'),_0x38dc96[_0x0fb7('0x37')]);}};Acw[_0x0fb7('0x38')][_0x0fb7('0x13')]=function(_0x5d1cb6){try{if(this[_0x0fb7('0x8')][_0x5d1cb6[_0x0fb7('0x1d')]]&&this[_0x0fb7('0x8')][_0x5d1cb6[_0x0fb7('0x1d')]]['autopause']===_0x0fb7('0x52')){if(this[_0x0fb7('0x9')][_0x5d1cb6['interface']]){logger[_0x0fb7('0x26')](_0x0fb7('0x53'),_0x5d1cb6['uniqueid'],_0x5d1cb6[_0x0fb7('0x1c')],_0x5d1cb6[_0x0fb7('0x1d')]);return RpcUser['savePause'](this[_0x0fb7('0x9')][_0x5d1cb6[_0x0fb7('0x1c')]],_0x0fb7('0x54'),_0x5d1cb6[_0x0fb7('0x30')]);}}}catch(_0x58ee74){logger[_0x0fb7('0x34')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x58ee74[_0x0fb7('0x37')]);}};module[_0x0fb7('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 41ac096..b5da275 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 _0x6761=['queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','exports','asterisk-manager','util','../../config/logger','ami','asterisk','username','password','keepConnected','Action','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary'];(function(_0x1e38d8,_0x1eb00e){var _0x2468f5=function(_0x3bcf9e){while(--_0x3bcf9e){_0x1e38d8['push'](_0x1e38d8['shift']());}};_0x2468f5(++_0x1eb00e);}(_0x6761,0x12e));var _0x1676=function(_0x366a38,_0x3eeda0){_0x366a38=_0x366a38-0x0;var _0x1e8bf1=_0x6761[_0x366a38];return _0x1e8bf1;};'use strict';var Manager=require(_0x1676('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x1676('0x1'));var _=require('lodash');var logger=require(_0x1676('0x2'))(_0x1676('0x3'));var config=require('../../config/environment');var ami=new Manager(config['asterisk']['port'],config[_0x1676('0x4')]['ip'],config[_0x1676('0x4')][_0x1676('0x5')],config[_0x1676('0x4')][_0x1676('0x6')],!![]);ami[_0x1676('0x7')]();ami[_0x1676('0x8')]=BPromise['promisify'](ami[_0x1676('0x9')]);function error(_0x673420){logger[_0x1676('0xa')](util['format'](_0x1676('0xb'),config[_0x1676('0x4')][_0x1676('0x5')],config[_0x1676('0x4')]['ip'],config[_0x1676('0x4')][_0x1676('0xc')],util[_0x1676('0xd')](_0x673420,![],null)));}function close(){logger[_0x1676('0xa')](util[_0x1676('0xe')](_0x1676('0xf'),config['asterisk'][_0x1676('0x5')],config[_0x1676('0x4')]['ip'],config[_0x1676('0x4')][_0x1676('0xc')]));}ami[_0x1676('0x10')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x1676('0x11')]=function(){return function(){return ami[_0x1676('0x8')]({'action':_0x1676('0x12')});};};ami[_0x1676('0x13')]=function(){return function(){return ami[_0x1676('0x8')]({'action':_0x1676('0x14')});};};ami[_0x1676('0x15')]=function(){return function(){return ami[_0x1676('0x8')]({'action':_0x1676('0x16')});};};ami[_0x1676('0x17')]=function(){return function(){return ami['Action']({'action':_0x1676('0x18')});};};function connect(_0x5b329a){logger[_0x1676('0x19')](util[_0x1676('0xe')](_0x1676('0x1a'),config[_0x1676('0x4')][_0x1676('0x5')],config[_0x1676('0x4')]['ip'],config[_0x1676('0x4')][_0x1676('0xc')]));ami[_0x1676('0x1b')]('error',error);ami[_0x1676('0x1b')](_0x1676('0x1c'),close);}ami['on'](_0x1676('0x1d'),connect);ami['on'](_0x1676('0x1e'),function(_0x572a9a){logger[_0x1676('0x19')](util[_0x1676('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x1676('0x5')],config[_0x1676('0x4')]['ip'],config[_0x1676('0x4')]['port'],util[_0x1676('0xd')](_0x572a9a,![],null)));});ami['on'](_0x1676('0x1f'),function(_0x379de9){logger[_0x1676('0x19')](util[_0x1676('0xe')](_0x1676('0x20'),config[_0x1676('0x4')][_0x1676('0x5')],config[_0x1676('0x4')]['ip'],config[_0x1676('0x4')][_0x1676('0xc')]));return BPromise['resolve']()[_0x1676('0x21')](ami[_0x1676('0x10')]())[_0x1676('0x21')](ami[_0x1676('0x11')]())['then'](ami[_0x1676('0x13')]())['then'](ami[_0x1676('0x15')]())[_0x1676('0x21')](ami[_0x1676('0x17')]())[_0x1676('0x22')](function(_0x4b54d7){console['log'](_0x4b54d7);});});ami[_0x1676('0x1b')](_0x1676('0xa'),error);ami[_0x1676('0x1b')]('close',close);module[_0x1676('0x23')]=ami; \ No newline at end of file +var _0xa404=['action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipPeerStatus','then','catch','log','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','asterisk','port'];(function(_0xf8c231,_0x3a6972){var _0x30e97d=function(_0x2bfa2e){while(--_0x2bfa2e){_0xf8c231['push'](_0xf8c231['shift']());}};_0x30e97d(++_0x3a6972);}(_0xa404,0x169));var _0x4a40=function(_0x5b31f7,_0x4bb3e1){_0x5b31f7=_0x5b31f7-0x0;var _0xde129b=_0xa404[_0x5b31f7];return _0xde129b;};'use strict';var Manager=require(_0x4a40('0x0'));var BPromise=require(_0x4a40('0x1'));var moment=require(_0x4a40('0x2'));var util=require('util');var _=require(_0x4a40('0x3'));var logger=require(_0x4a40('0x4'))(_0x4a40('0x5'));var config=require(_0x4a40('0x6'));var ami=new Manager(config[_0x4a40('0x7')][_0x4a40('0x8')],config[_0x4a40('0x7')]['ip'],config[_0x4a40('0x7')]['username'],config[_0x4a40('0x7')]['password'],!![]);ami['keepConnected']();ami['Action']=BPromise['promisify'](ami[_0x4a40('0x9')]);function error(_0x39c755){logger[_0x4a40('0xa')](util['format'](_0x4a40('0xb'),config[_0x4a40('0x7')][_0x4a40('0xc')],config[_0x4a40('0x7')]['ip'],config[_0x4a40('0x7')][_0x4a40('0x8')],util[_0x4a40('0xd')](_0x39c755,![],null)));}function close(){logger[_0x4a40('0xa')](util[_0x4a40('0xe')](_0x4a40('0xf'),config[_0x4a40('0x7')][_0x4a40('0xc')],config['asterisk']['ip'],config[_0x4a40('0x7')]['port']));}ami[_0x4a40('0x10')]=function(){return function(){return ami[_0x4a40('0x11')]({'action':_0x4a40('0x12')});};};ami[_0x4a40('0x13')]=function(){return function(){return ami[_0x4a40('0x11')]({'action':_0x4a40('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x4a40('0x11')]({'action':'sippeerstatus'});};};ami[_0x4a40('0x15')]=function(){return function(){return ami['Action']({'action':_0x4a40('0x16')});};};ami[_0x4a40('0x17')]=function(){return function(){return ami[_0x4a40('0x11')]({'action':_0x4a40('0x18')});};};function connect(_0x15812e){logger[_0x4a40('0x19')](util[_0x4a40('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x4a40('0x7')]['username'],config[_0x4a40('0x7')]['ip'],config[_0x4a40('0x7')][_0x4a40('0x8')]));ami[_0x4a40('0x1a')](_0x4a40('0xa'),error);ami[_0x4a40('0x1a')](_0x4a40('0x1b'),close);}ami['on'](_0x4a40('0x1c'),connect);ami['on']('shutdown',function(_0x4753ea){logger['info'](util['format'](_0x4a40('0x1d'),config[_0x4a40('0x7')][_0x4a40('0xc')],config[_0x4a40('0x7')]['ip'],config[_0x4a40('0x7')][_0x4a40('0x8')],util[_0x4a40('0xd')](_0x4753ea,![],null)));});ami['on'](_0x4a40('0x1e'),function(_0x1ddf02){logger['info'](util['format'](_0x4a40('0x1f'),config[_0x4a40('0x7')][_0x4a40('0xc')],config[_0x4a40('0x7')]['ip'],config[_0x4a40('0x7')][_0x4a40('0x8')]));return BPromise[_0x4a40('0x20')]()['then'](ami['actionSipShowRegistry']())['then'](ami[_0x4a40('0x13')]())['then'](ami[_0x4a40('0x21')]())[_0x4a40('0x22')](ami[_0x4a40('0x15')]())[_0x4a40('0x22')](ami[_0x4a40('0x17')]())[_0x4a40('0x23')](function(_0x5db014){console[_0x4a40('0x24')](_0x5db014);});});ami[_0x4a40('0x1a')](_0x4a40('0xa'),error);ami[_0x4a40('0x1a')](_0x4a40('0x1b'),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 ed9f9ce..27cebb8 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x599aaf,_0x3d3622){var _0xd995f3=function(_0x19825e){while(--_0x19825e){_0x599aaf['push'](_0x599aaf['shift']());}};_0xd995f3(++_0x3d3622);}(_0x9bde,0xe1));var _0xe9bd=function(_0x15eb7e,_0x2261ce){_0x15eb7e=_0x15eb7e-0x0;var _0x159ec5=_0x9bde[_0x15eb7e];return _0x159ec5;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file +var _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x4eae35,_0x3d9d32){var _0x174a7e=function(_0x569e4b){while(--_0x569e4b){_0x4eae35['push'](_0x4eae35['shift']());}};_0x174a7e(++_0x3d9d32);}(_0xaa88,0x137));var _0x8aa8=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0xaa88[_0x369534];return _0x524bf9;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index a1b752e..6afca21 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bf2=['ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','prototype','getCaller','substring','dialCutDigit','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7bf2,0x64));var _0x27bf=function(_0x11a5a0,_0xa682c1){_0x11a5a0=_0x11a5a0-0x0;var _0x8a8d48=_0x7bf2[_0x11a5a0];return _0x8a8d48;};'use strict';var util=require(_0x27bf('0x0'));var _=require(_0x27bf('0x1'));var moment=require(_0x27bf('0x2'));function checkNameSurname(_0x181766,_0x4a787c,_0x338108){var _0x443edc='';if(!_[_0x27bf('0x3')](_0x4a787c)&&_0x27bf('0x4')===typeof _0x4a787c){_0x443edc+=_0x4a787c;}if(!_['isNil'](_0x338108)&&'string'===typeof _0x338108){_0x443edc+='\x20'+_0x338108;}if(_0x443edc!==''){return _0x443edc;}return _0x181766;}function Action(_0x50db49,_0x1fa677,_0x37dca9){this[_0x27bf('0x5')]=_0x50db49;this[_0x27bf('0x6')]=_0x37dca9||undefined;this[_0x27bf('0x7')]=checkNameSurname(_0x1fa677['Contact']['phone'],_0x1fa677[_0x27bf('0x8')][_0x27bf('0x9')],_0x1fa677[_0x27bf('0x8')][_0x27bf('0xa')]);this[_0x27bf('0xb')]=_0x1fa677[_0x27bf('0x8')]['phone'];this[_0x27bf('0xc')]=_0x50db49[_0x27bf('0x7')];this[_0x27bf('0xd')]=_0x1fa677[_0x27bf('0xd')]||![];this[_0x27bf('0xe')]=_0x50db49[_0x27bf('0xe')];this[_0x27bf('0xf')]=_0x50db49[_0x27bf('0xf')]||0x3;this['scheduledat']=_0x1fa677['scheduledat'];this[_0x27bf('0x10')]=_0x1fa677[_0x27bf('0x10')];this['countcongestionretry']=_0x1fa677[_0x27bf('0x11')];this['countnoanswerretry']=_0x1fa677[_0x27bf('0x12')];this[_0x27bf('0x13')]=_0x1fa677['countnosuchnumberretry'];this[_0x27bf('0x14')]=_0x1fa677['countdropretry'];this[_0x27bf('0x15')]=_0x1fa677['countabandonedretry'];this[_0x27bf('0x16')]=_0x1fa677['countmachineretry'];this['countagentrejectretry']=_0x1fa677['countagentrejectretry'];this[_0x27bf('0x17')]=_0x1fa677[_0x27bf('0x17')];this[_0x27bf('0x18')]=_0x1fa677[_0x27bf('0x18')];this[_0x27bf('0x19')]=_0x1fa677[_0x27bf('0x19')];this[_0x27bf('0x1a')]=_0x1fa677[_0x27bf('0x1a')];this['CampaignId']=_0x1fa677['CampaignId'];this[_0x27bf('0x1b')]=_0x1fa677['id'];this[_0x27bf('0x1c')]=_0x1fa677['Contact'][_0x27bf('0x9')]||'';this[_0x27bf('0x1d')]=moment()[_0x27bf('0x1e')](_0x27bf('0x1f'));this[_0x27bf('0x20')]=_0x1fa677[_0x27bf('0x20')];this[_0x27bf('0x21')]=_0x1fa677[_0x27bf('0x21')];this[_0x27bf('0x22')]=_0x1fa677[_0x27bf('0x22')];this['recallme']=_0x1fa677[_0x27bf('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x27bf('0x24')][_0x27bf('0x25')]=function(){return util[_0x27bf('0x1e')]('\x22%s\x22\x20<%s>',this['name'],this[_0x27bf('0x5')]['dialCutDigit']>0x0?this[_0x27bf('0xb')][_0x27bf('0x26')](this[_0x27bf('0x5')][_0x27bf('0x27')]):this[_0x27bf('0xb')]);};Action[_0x27bf('0x24')]['getQueue']=function(){return this[_0x27bf('0xc')];};module[_0x27bf('0x28')]=Action; \ No newline at end of file +var _0x7451=['Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','format','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','util','moment','isNil','string','voiceQueue','uniqueid'];(function(_0x3fa93d,_0x33156b){var _0x3a2dee=function(_0x2b974f){while(--_0x2b974f){_0x3fa93d['push'](_0x3fa93d['shift']());}};_0x3a2dee(++_0x33156b);}(_0x7451,0x9e));var _0x1745=function(_0x280f5a,_0xa9f314){_0x280f5a=_0x280f5a-0x0;var _0x4efe37=_0x7451[_0x280f5a];return _0x4efe37;};'use strict';var util=require(_0x1745('0x0'));var _=require('lodash');var moment=require(_0x1745('0x1'));function checkNameSurname(_0x11e6d9,_0x1e1d25,_0x27c917){var _0x4d7a08='';if(!_[_0x1745('0x2')](_0x1e1d25)&&_0x1745('0x3')===typeof _0x1e1d25){_0x4d7a08+=_0x1e1d25;}if(!_[_0x1745('0x2')](_0x27c917)&&_0x1745('0x3')===typeof _0x27c917){_0x4d7a08+='\x20'+_0x27c917;}if(_0x4d7a08!==''){return _0x4d7a08;}return _0x11e6d9;}function Action(_0x18dbda,_0x1f43da,_0xa9635b){this[_0x1745('0x4')]=_0x18dbda;this[_0x1745('0x5')]=_0xa9635b||undefined;this['name']=checkNameSurname(_0x1f43da[_0x1745('0x6')]['phone'],_0x1f43da[_0x1745('0x6')][_0x1745('0x7')],_0x1f43da[_0x1745('0x6')][_0x1745('0x8')]);this[_0x1745('0x9')]=_0x1f43da[_0x1745('0x6')][_0x1745('0xa')];this[_0x1745('0xb')]=_0x18dbda[_0x1745('0xc')];this[_0x1745('0xd')]=_0x1f43da['active']||![];this['type']=_0x18dbda[_0x1745('0xe')];this[_0x1745('0xf')]=_0x18dbda[_0x1745('0xf')]||0x3;this[_0x1745('0x10')]=_0x1f43da[_0x1745('0x10')];this[_0x1745('0x11')]=_0x1f43da[_0x1745('0x11')];this['countcongestionretry']=_0x1f43da['countcongestionretry'];this[_0x1745('0x12')]=_0x1f43da[_0x1745('0x12')];this['countnosuchnumberretry']=_0x1f43da[_0x1745('0x13')];this['countdropretry']=_0x1f43da['countdropretry'];this[_0x1745('0x14')]=_0x1f43da[_0x1745('0x14')];this['countmachineretry']=_0x1f43da[_0x1745('0x15')];this[_0x1745('0x16')]=_0x1f43da['countagentrejectretry'];this['ContactId']=_0x1f43da[_0x1745('0x17')];this['ListId']=_0x1f43da[_0x1745('0x18')];this['UserId']=_0x1f43da[_0x1745('0x19')];this[_0x1745('0x1a')]=_0x1f43da[_0x1745('0x1a')];this['CampaignId']=_0x1f43da['CampaignId'];this[_0x1745('0x1b')]=_0x1f43da['id'];this[_0x1745('0x1c')]=_0x1f43da[_0x1745('0x6')][_0x1745('0x7')]||'';this[_0x1745('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1745('0x1e')]=_0x1f43da[_0x1745('0x1e')];this['callbackuniqueid']=_0x1f43da[_0x1745('0x1f')];this[_0x1745('0x20')]=_0x1f43da[_0x1745('0x20')];this[_0x1745('0x21')]=_0x1f43da[_0x1745('0x21')];this[_0x1745('0x22')]='';this['originatecalleridname']='';}Action[_0x1745('0x23')]['getCaller']=function(){return util[_0x1745('0x24')](_0x1745('0x25'),this[_0x1745('0xc')],this[_0x1745('0x4')]['dialCutDigit']>0x0?this[_0x1745('0x9')][_0x1745('0x26')](this[_0x1745('0x4')][_0x1745('0x27')]):this[_0x1745('0x9')]);};Action[_0x1745('0x23')][_0x1745('0x28')]=function(){return this[_0x1745('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 12302b6..8751b9b 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c2e=['diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridnum','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds'];(function(_0x1aae6a,_0x56bb19){var _0x297a71=function(_0x471e80){while(--_0x471e80){_0x1aae6a['push'](_0x1aae6a['shift']());}};_0x297a71(++_0x56bb19);}(_0x8c2e,0x17f));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe8c2('0x0'));var _=require(_0xe8c2('0x1'));var moment=require(_0xe8c2('0x2'));function getSeconds(_0x521fc8,_0x3524b1){var _0x46f0c1=moment(_0x521fc8)[_0xe8c2('0x3')](0x0);var _0xeddecc=moment(_0x3524b1)['milliseconds'](0x0);return _0x46f0c1[_0xe8c2('0x4')](_0xeddecc,_0xe8c2('0x5'));}function AgentComplete(_0x39f37c,_0x2b5e14){this['state']=0x4;this[_0xe8c2('0x6')]='Answer';this[_0xe8c2('0x7')]=_0x39f37c['scheduledat'];this[_0xe8c2('0x8')]=_0x39f37c[_0xe8c2('0x8')];this[_0xe8c2('0x9')]=_0x39f37c[_0xe8c2('0x8')]===_0xe8c2('0xa')?_0xe8c2('0xb'):_0x39f37c[_0xe8c2('0x8')];this['countbusyretry']=_0x39f37c[_0xe8c2('0xc')];this[_0xe8c2('0xd')]=_0x39f37c['countcongestionretry'];this['countnoanswerretry']=_0x39f37c[_0xe8c2('0xe')];this['countglobal']=_0x39f37c['countbusyretry']+_0x39f37c['countcongestionretry']+_0x39f37c[_0xe8c2('0xe')]+_0x39f37c[_0xe8c2('0xf')]+_0x39f37c['countdropretry']+_0x39f37c[_0xe8c2('0x10')]+_0x39f37c[_0xe8c2('0x11')]+_0x39f37c[_0xe8c2('0x12')];this['countnosuchnumberretry']=_0x39f37c[_0xe8c2('0xf')];this['countdropretry']=_0x39f37c[_0xe8c2('0x13')];this['countabandonedretry']=_0x39f37c['countabandonedretry'];this[_0xe8c2('0x11')]=_0x39f37c['countmachineretry'];this[_0xe8c2('0x12')]=_0x39f37c[_0xe8c2('0x12')];this[_0xe8c2('0x14')]=_0x2b5e14[_0xe8c2('0x14')];this['calleridname']=_0x39f37c['name'];this[_0xe8c2('0x15')]=_0x39f37c[_0xe8c2('0x16')];this['starttime']=_0x39f37c['starttime'];this[_0xe8c2('0x17')]=_0x39f37c[_0xe8c2('0x17')];this[_0xe8c2('0x18')]=_0x39f37c[_0xe8c2('0x18')];this[_0xe8c2('0x19')]=moment()[_0xe8c2('0x1a')](_0xe8c2('0x1b'));this[_0xe8c2('0x1c')]=getSeconds(_0x39f37c[_0xe8c2('0x17')],_0x39f37c[_0xe8c2('0x1d')]);this['holdtime']=getSeconds(_0x39f37c['answertime'],_0x39f37c[_0xe8c2('0x17')]);this[_0xe8c2('0x1e')]=getSeconds(this[_0xe8c2('0x19')],_0x39f37c[_0xe8c2('0x18')]);this[_0xe8c2('0xb')]=_0x2b5e14['queue'];this[_0xe8c2('0x1f')]=_0x2b5e14['membername'];this[_0xe8c2('0x20')]=_0x2b5e14[_0xe8c2('0x20')];this[_0xe8c2('0x21')]=_0x39f37c[_0xe8c2('0x21')];this[_0xe8c2('0x22')]=_0x39f37c[_0xe8c2('0x22')];this['callbackat']=_0x39f37c[_0xe8c2('0x23')];this[_0xe8c2('0x24')]=_0x39f37c[_0xe8c2('0x24')];this['ContactId']=_0x39f37c['ContactId'];this[_0xe8c2('0x25')]=_0x39f37c[_0xe8c2('0x25')];this[_0xe8c2('0x26')]=_0x39f37c[_0xe8c2('0x26')];this[_0xe8c2('0x27')]=_0x39f37c[_0xe8c2('0x27')];this[_0xe8c2('0x28')]=_0x39f37c[_0xe8c2('0x28')];this[_0xe8c2('0x29')]=_0x39f37c['originatecalleridnum']||'';this[_0xe8c2('0x2a')]=_0x39f37c[_0xe8c2('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x8f07=['queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime'];(function(_0x2b5d13,_0x26083b){var _0x26c145=function(_0x26a59a){while(--_0x26a59a){_0x2b5d13['push'](_0x2b5d13['shift']());}};_0x26c145(++_0x26083b);}(_0x8f07,0x1a4));var _0x78f0=function(_0x294c07,_0xbf9776){_0x294c07=_0x294c07-0x0;var _0x2693af=_0x8f07[_0x294c07];return _0x2693af;};'use strict';var util=require(_0x78f0('0x0'));var _=require(_0x78f0('0x1'));var moment=require(_0x78f0('0x2'));function getSeconds(_0x3d8917,_0xf4c34a){var _0x9d3ad4=moment(_0x3d8917)[_0x78f0('0x3')](0x0);var _0x32e6cd=moment(_0xf4c34a)['milliseconds'](0x0);return _0x9d3ad4[_0x78f0('0x4')](_0x32e6cd,_0x78f0('0x5'));}function AgentComplete(_0x35ad6f,_0x1083ab){this[_0x78f0('0x6')]=0x4;this[_0x78f0('0x7')]='Answer';this[_0x78f0('0x8')]=_0x35ad6f[_0x78f0('0x8')];this[_0x78f0('0x9')]=_0x35ad6f[_0x78f0('0x9')];this['campaigntype']=_0x35ad6f['type']===_0x78f0('0xa')?'queue':_0x35ad6f[_0x78f0('0x9')];this[_0x78f0('0xb')]=_0x35ad6f['countbusyretry'];this[_0x78f0('0xc')]=_0x35ad6f['countcongestionretry'];this[_0x78f0('0xd')]=_0x35ad6f[_0x78f0('0xd')];this[_0x78f0('0xe')]=_0x35ad6f['countbusyretry']+_0x35ad6f['countcongestionretry']+_0x35ad6f['countnoanswerretry']+_0x35ad6f[_0x78f0('0xf')]+_0x35ad6f[_0x78f0('0x10')]+_0x35ad6f[_0x78f0('0x11')]+_0x35ad6f[_0x78f0('0x12')]+_0x35ad6f['countagentrejectretry'];this['countnosuchnumberretry']=_0x35ad6f[_0x78f0('0xf')];this['countdropretry']=_0x35ad6f[_0x78f0('0x10')];this['countabandonedretry']=_0x35ad6f[_0x78f0('0x11')];this['countmachineretry']=_0x35ad6f['countmachineretry'];this[_0x78f0('0x13')]=_0x35ad6f[_0x78f0('0x13')];this[_0x78f0('0x14')]=_0x1083ab[_0x78f0('0x14')];this['calleridname']=_0x35ad6f[_0x78f0('0x15')];this[_0x78f0('0x16')]=_0x35ad6f[_0x78f0('0x17')];this[_0x78f0('0x18')]=_0x35ad6f['starttime'];this['responsetime']=_0x35ad6f[_0x78f0('0x19')];this[_0x78f0('0x1a')]=_0x35ad6f[_0x78f0('0x1a')];this['endtime']=moment()['format'](_0x78f0('0x1b'));this[_0x78f0('0x1c')]=getSeconds(_0x35ad6f[_0x78f0('0x19')],_0x35ad6f[_0x78f0('0x18')]);this[_0x78f0('0x1d')]=getSeconds(_0x35ad6f['answertime'],_0x35ad6f[_0x78f0('0x19')]);this['talktime']=getSeconds(this['endtime'],_0x35ad6f['answertime']);this[_0x78f0('0x1e')]=_0x1083ab[_0x78f0('0x1e')];this[_0x78f0('0x1f')]=_0x1083ab[_0x78f0('0x1f')];this['reason']=_0x1083ab[_0x78f0('0x20')];this[_0x78f0('0x21')]=_0x35ad6f[_0x78f0('0x21')];this[_0x78f0('0x22')]=_0x35ad6f[_0x78f0('0x22')];this['callbackat']=_0x35ad6f[_0x78f0('0x23')];this[_0x78f0('0x24')]=_0x35ad6f['recallme'];this['ContactId']=_0x35ad6f[_0x78f0('0x25')];this[_0x78f0('0x26')]=_0x35ad6f[_0x78f0('0x26')];this['UserId']=_0x35ad6f[_0x78f0('0x27')];this[_0x78f0('0x28')]=_0x35ad6f[_0x78f0('0x28')];this[_0x78f0('0x29')]=_0x35ad6f[_0x78f0('0x29')];this[_0x78f0('0x2a')]=_0x35ad6f[_0x78f0('0x2a')]||'';this[_0x78f0('0x2b')]=_0x35ad6f[_0x78f0('0x2b')]||'';}module[_0x78f0('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 39b7402..3f23176 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa23f=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','ringtime','holdtime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa23f,0x7c));var _0xfa23=function(_0x40415b,_0x34f080){_0x40415b=_0x40415b-0x0;var _0x467153=_0xa23f[_0x40415b];return _0x467153;};'use strict';var util=require(_0xfa23('0x0'));var _=require(_0xfa23('0x1'));var moment=require('moment');function getSeconds(_0x48fd46,_0xb81edf){var _0x3f714c=moment(_0x48fd46)[_0xfa23('0x2')](0x0);var _0x3fe466=moment(_0xb81edf)['milliseconds'](0x0);return _0x3f714c[_0xfa23('0x3')](_0x3fe466,'seconds');}function Final(_0x210057){this[_0xfa23('0x4')]=_0x210057[_0xfa23('0x4')];this[_0xfa23('0x5')]=_0x210057['scheduledat'];this[_0xfa23('0x6')]=_0x210057['type'];this[_0xfa23('0x7')]=_0x210057[_0xfa23('0x6')]===_0xfa23('0x8')?_0xfa23('0x9'):_0x210057[_0xfa23('0x6')];this['countbusyretry']=_0x210057['countbusyretry'];this[_0xfa23('0xa')]=_0x210057['countcongestionretry'];this[_0xfa23('0xb')]=_0x210057['countnoanswerretry'];this[_0xfa23('0xc')]=_0x210057[_0xfa23('0xd')]+_0x210057[_0xfa23('0xa')]+_0x210057['countnoanswerretry']+_0x210057[_0xfa23('0xe')]+_0x210057[_0xfa23('0xf')]+_0x210057[_0xfa23('0x10')]+_0x210057['countmachineretry']+_0x210057['countagentrejectretry'];this[_0xfa23('0xe')]=_0x210057[_0xfa23('0xe')];this[_0xfa23('0xf')]=_0x210057[_0xfa23('0xf')];this['countabandonedretry']=_0x210057[_0xfa23('0x10')];this[_0xfa23('0x11')]=_0x210057[_0xfa23('0x11')];this[_0xfa23('0x12')]=_0x210057['countagentrejectretry'];this[_0xfa23('0x9')]=_0x210057[_0xfa23('0x9')];this[_0xfa23('0x13')]=_0x210057[_0xfa23('0x13')];this[_0xfa23('0x14')]=_0x210057['calleridnum'];this['starttime']=_0x210057['starttime'];this[_0xfa23('0x15')]=_0x210057[_0xfa23('0x15')];this['endtime']=_0x210057[_0xfa23('0x15')];this[_0xfa23('0x16')]=_0x210057[_0xfa23('0x16')]||0x0;this['holdtime']=_0x210057[_0xfa23('0x17')]||0x0;this[_0xfa23('0x18')]=_0x210057['talktime']||0x0;this[_0xfa23('0x19')]=_0x210057[_0xfa23('0x19')];this[_0xfa23('0x1a')]=_0x210057[_0xfa23('0x1a')];this[_0xfa23('0x1b')]=_0x210057[_0xfa23('0x1b')];this[_0xfa23('0x1c')]=_0x210057['recallme'];this[_0xfa23('0x1d')]=_0x210057[_0xfa23('0x1d')];this[_0xfa23('0x1e')]=_0x210057[_0xfa23('0x1e')];this['UserId']=_0x210057[_0xfa23('0x1f')];this['VoiceQueueId']=_0x210057[_0xfa23('0x20')];this[_0xfa23('0x21')]=_0x210057[_0xfa23('0x21')];this[_0xfa23('0x22')]=_0x210057[_0xfa23('0x22')]||'';this[_0xfa23('0x23')]=_0x210057[_0xfa23('0x23')]||'';}module[_0xfa23('0x24')]=Final; \ No newline at end of file +var _0x8819=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridnum','starttime','endtime','responsetime','ringtime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8819,0x94));var _0x9881=function(_0x13eb31,_0x2e8eaf){_0x13eb31=_0x13eb31-0x0;var _0x17d3fd=_0x8819[_0x13eb31];return _0x17d3fd;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9881('0x0'));function getSeconds(_0x27a509,_0x317d26){var _0x14cd6c=moment(_0x27a509)[_0x9881('0x1')](0x0);var _0x5e52c5=moment(_0x317d26)[_0x9881('0x1')](0x0);return _0x14cd6c[_0x9881('0x2')](_0x5e52c5,_0x9881('0x3'));}function Final(_0xc9a2e9){this[_0x9881('0x4')]=_0xc9a2e9[_0x9881('0x4')];this['scheduledat']=_0xc9a2e9[_0x9881('0x5')];this['type']=_0xc9a2e9['type'];this[_0x9881('0x6')]=_0xc9a2e9['type']==='outbound'?_0x9881('0x7'):_0xc9a2e9['type'];this[_0x9881('0x8')]=_0xc9a2e9[_0x9881('0x8')];this[_0x9881('0x9')]=_0xc9a2e9['countcongestionretry'];this[_0x9881('0xa')]=_0xc9a2e9[_0x9881('0xa')];this[_0x9881('0xb')]=_0xc9a2e9[_0x9881('0x8')]+_0xc9a2e9['countcongestionretry']+_0xc9a2e9[_0x9881('0xa')]+_0xc9a2e9[_0x9881('0xc')]+_0xc9a2e9['countdropretry']+_0xc9a2e9[_0x9881('0xd')]+_0xc9a2e9['countmachineretry']+_0xc9a2e9['countagentrejectretry'];this['countnosuchnumberretry']=_0xc9a2e9['countnosuchnumberretry'];this[_0x9881('0xe')]=_0xc9a2e9[_0x9881('0xe')];this[_0x9881('0xd')]=_0xc9a2e9[_0x9881('0xd')];this[_0x9881('0xf')]=_0xc9a2e9[_0x9881('0xf')];this['countagentrejectretry']=_0xc9a2e9[_0x9881('0x10')];this[_0x9881('0x7')]=_0xc9a2e9[_0x9881('0x7')];this['calleridname']=_0xc9a2e9['calleridname'];this['calleridnum']=_0xc9a2e9[_0x9881('0x11')];this['starttime']=_0xc9a2e9[_0x9881('0x12')];this['responsetime']=_0xc9a2e9['responsetime'];this[_0x9881('0x13')]=_0xc9a2e9[_0x9881('0x14')];this[_0x9881('0x15')]=_0xc9a2e9[_0x9881('0x15')]||0x0;this[_0x9881('0x16')]=_0xc9a2e9[_0x9881('0x16')]||0x0;this[_0x9881('0x17')]=_0xc9a2e9[_0x9881('0x17')]||0x0;this[_0x9881('0x18')]=_0xc9a2e9[_0x9881('0x18')];this[_0x9881('0x19')]=_0xc9a2e9[_0x9881('0x19')];this[_0x9881('0x1a')]=_0xc9a2e9[_0x9881('0x1a')];this[_0x9881('0x1b')]=_0xc9a2e9['recallme'];this['ContactId']=_0xc9a2e9[_0x9881('0x1c')];this['ListId']=_0xc9a2e9['ListId'];this[_0x9881('0x1d')]=_0xc9a2e9[_0x9881('0x1d')];this['VoiceQueueId']=_0xc9a2e9['VoiceQueueId'];this[_0x9881('0x1e')]=_0xc9a2e9['CampaignId'];this[_0x9881('0x1f')]=_0xc9a2e9[_0x9881('0x1f')]||'';this[_0x9881('0x20')]=_0xc9a2e9[_0x9881('0x20')]||'';}module[_0x9881('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a2e532c..2efe568 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02fc=['scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','responsetime','format','ringtime','starttime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','state','statedesc','Answer'];(function(_0x2b385d,_0x32eb66){var _0xd76140=function(_0x5afb34){while(--_0x5afb34){_0x2b385d['push'](_0x2b385d['shift']());}};_0xd76140(++_0x32eb66);}(_0x02fc,0x151));var _0xc02f=function(_0x498493,_0x5e8114){_0x498493=_0x498493-0x0;var _0x160ac5=_0x02fc[_0x498493];return _0x160ac5;};'use strict';var util=require('util');var _=require(_0xc02f('0x0'));var moment=require(_0xc02f('0x1'));function getSeconds(_0x46710b,_0xe65d7d){var _0x2bf777=moment(_0x46710b)['milliseconds'](0x0);var _0x429c90=moment(_0xe65d7d)['milliseconds'](0x0);return _0x2bf777['diff'](_0x429c90,'seconds');}function Hangup(_0x585a5b,_0x38c5e2){this[_0xc02f('0x2')]=0x4;this[_0xc02f('0x3')]=_0xc02f('0x4');this[_0xc02f('0x5')]=_0x585a5b[_0xc02f('0x5')];this['type']=_0x585a5b[_0xc02f('0x6')];this[_0xc02f('0x7')]=_0x585a5b['type']==='outbound'?'queue':_0x585a5b[_0xc02f('0x6')];this[_0xc02f('0x8')]=_0x585a5b[_0xc02f('0x8')];this['countcongestionretry']=_0x585a5b[_0xc02f('0x9')];this[_0xc02f('0xa')]=_0x585a5b[_0xc02f('0xa')];this[_0xc02f('0xb')]=_0x585a5b[_0xc02f('0x8')]+_0x585a5b[_0xc02f('0x9')]+_0x585a5b[_0xc02f('0xa')]+_0x585a5b[_0xc02f('0xc')]+_0x585a5b[_0xc02f('0xd')]+_0x585a5b[_0xc02f('0xe')]+_0x585a5b[_0xc02f('0xf')]+_0x585a5b['countagentrejectretry'];this[_0xc02f('0xc')]=_0x585a5b[_0xc02f('0xc')];this['countdropretry']=_0x585a5b[_0xc02f('0xd')];this[_0xc02f('0xe')]=_0x585a5b['countabandonedretry'];this['countmachineretry']=_0x585a5b[_0xc02f('0xf')];this[_0xc02f('0x10')]=_0x585a5b['countagentrejectretry'];this['uniqueid']=_0x38c5e2['uniqueid'];this['calleridname']=_0x585a5b[_0xc02f('0x11')];this['calleridnum']=_0x585a5b[_0xc02f('0x12')];this['starttime']=_0x585a5b['starttime'];this[_0xc02f('0x13')]=_0x585a5b[_0xc02f('0x13')];this['endtime']=moment()[_0xc02f('0x14')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc02f('0x15')]=getSeconds(_0x585a5b['responsetime'],_0x585a5b[_0xc02f('0x16')]);this[_0xc02f('0x17')]=0x0;this[_0xc02f('0x18')]=getSeconds(this['endtime'],_0x585a5b[_0xc02f('0x13')]);this['queue']=_0x585a5b['queue'];this[_0xc02f('0x19')]=_0xc02f('0x1a');this[_0xc02f('0x1b')]=_0x38c5e2[_0xc02f('0x1c')];this[_0xc02f('0x1d')]=_0x585a5b[_0xc02f('0x1d')];this[_0xc02f('0x1e')]=_0x585a5b[_0xc02f('0x1e')];this['callbackat']=_0x585a5b['callbackat'];this[_0xc02f('0x1f')]=_0x585a5b[_0xc02f('0x1f')];this[_0xc02f('0x20')]=_0x585a5b[_0xc02f('0x20')];this[_0xc02f('0x21')]=_0x585a5b[_0xc02f('0x21')];this[_0xc02f('0x22')]=_0x585a5b[_0xc02f('0x22')];this[_0xc02f('0x23')]=_0x585a5b['VoiceQueueId'];this[_0xc02f('0x24')]=_0x585a5b['CampaignId'];}module[_0xc02f('0x25')]=Hangup; \ No newline at end of file +var _0xbb5e=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype'];(function(_0x463cd3,_0x354e00){var _0x22af84=function(_0x16e989){while(--_0x16e989){_0x463cd3['push'](_0x463cd3['shift']());}};_0x22af84(++_0x354e00);}(_0xbb5e,0x138));var _0xebb5=function(_0x2d106f,_0x6bb92a){_0x2d106f=_0x2d106f-0x0;var _0xc9c5cc=_0xbb5e[_0x2d106f];return _0xc9c5cc;};'use strict';var util=require(_0xebb5('0x0'));var _=require(_0xebb5('0x1'));var moment=require(_0xebb5('0x2'));function getSeconds(_0xb1844,_0x44b370){var _0x1c4b10=moment(_0xb1844)[_0xebb5('0x3')](0x0);var _0x22c1c8=moment(_0x44b370)[_0xebb5('0x3')](0x0);return _0x1c4b10[_0xebb5('0x4')](_0x22c1c8,'seconds');}function Hangup(_0x31cf36,_0x378943){this['state']=0x4;this[_0xebb5('0x5')]=_0xebb5('0x6');this[_0xebb5('0x7')]=_0x31cf36[_0xebb5('0x7')];this[_0xebb5('0x8')]=_0x31cf36[_0xebb5('0x8')];this[_0xebb5('0x9')]=_0x31cf36[_0xebb5('0x8')]===_0xebb5('0xa')?_0xebb5('0xb'):_0x31cf36[_0xebb5('0x8')];this[_0xebb5('0xc')]=_0x31cf36['countbusyretry'];this[_0xebb5('0xd')]=_0x31cf36[_0xebb5('0xd')];this[_0xebb5('0xe')]=_0x31cf36[_0xebb5('0xe')];this[_0xebb5('0xf')]=_0x31cf36['countbusyretry']+_0x31cf36[_0xebb5('0xd')]+_0x31cf36[_0xebb5('0xe')]+_0x31cf36[_0xebb5('0x10')]+_0x31cf36[_0xebb5('0x11')]+_0x31cf36[_0xebb5('0x12')]+_0x31cf36['countmachineretry']+_0x31cf36[_0xebb5('0x13')];this['countnosuchnumberretry']=_0x31cf36[_0xebb5('0x10')];this[_0xebb5('0x11')]=_0x31cf36[_0xebb5('0x11')];this[_0xebb5('0x12')]=_0x31cf36['countabandonedretry'];this['countmachineretry']=_0x31cf36[_0xebb5('0x14')];this[_0xebb5('0x13')]=_0x31cf36['countagentrejectretry'];this['uniqueid']=_0x378943[_0xebb5('0x15')];this[_0xebb5('0x16')]=_0x31cf36[_0xebb5('0x17')];this[_0xebb5('0x18')]=_0x31cf36['number'];this[_0xebb5('0x19')]=_0x31cf36['starttime'];this[_0xebb5('0x1a')]=_0x31cf36['responsetime'];this[_0xebb5('0x1b')]=moment()[_0xebb5('0x1c')](_0xebb5('0x1d'));this[_0xebb5('0x1e')]=getSeconds(_0x31cf36['responsetime'],_0x31cf36[_0xebb5('0x19')]);this[_0xebb5('0x1f')]=0x0;this[_0xebb5('0x20')]=getSeconds(this[_0xebb5('0x1b')],_0x31cf36[_0xebb5('0x1a')]);this[_0xebb5('0xb')]=_0x31cf36[_0xebb5('0xb')];this[_0xebb5('0x21')]=_0xebb5('0x22');this[_0xebb5('0x23')]=_0x378943[_0xebb5('0x24')];this[_0xebb5('0x25')]=_0x31cf36[_0xebb5('0x25')];this[_0xebb5('0x26')]=_0x31cf36[_0xebb5('0x26')];this[_0xebb5('0x27')]=_0x31cf36[_0xebb5('0x27')];this[_0xebb5('0x28')]=_0x31cf36[_0xebb5('0x28')];this[_0xebb5('0x29')]=_0x31cf36[_0xebb5('0x29')];this[_0xebb5('0x2a')]=_0x31cf36['ListId'];this[_0xebb5('0x2b')]=_0x31cf36[_0xebb5('0x2b')];this[_0xebb5('0x2c')]=_0x31cf36[_0xebb5('0x2c')];this[_0xebb5('0x2d')]=_0x31cf36[_0xebb5('0x2d')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 604cad9..ce14734 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb345=['countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','campaigntype','outbound','queue','type','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry'];(function(_0x26ae05,_0x53e7ea){var _0x1e8338=function(_0x241a59){while(--_0x241a59){_0x26ae05['push'](_0x26ae05['shift']());}};_0x1e8338(++_0x53e7ea);}(_0xb345,0x1c2));var _0x5b34=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xb345[_0x1e7b16];return _0x37fadc;};'use strict';var util=require(_0x5b34('0x0'));var _=require(_0x5b34('0x1'));var moment=require('moment');function getSeconds(_0x3b3b2b,_0x5ef7e9){var _0x33f3bc=moment(_0x3b3b2b)[_0x5b34('0x2')](0x0);var _0x1fe725=moment(_0x5ef7e9)['milliseconds'](0x0);return _0x33f3bc[_0x5b34('0x3')](_0x1fe725,_0x5b34('0x4'));}function History(_0x493798){this[_0x5b34('0x5')]=_0x493798['uniqueid'];this['scheduledat']=_0x493798['scheduledat']||undefined;this['type']=_0x493798['type'];this[_0x5b34('0x6')]=_0x493798['type']===_0x5b34('0x7')?_0x5b34('0x8'):_0x493798[_0x5b34('0x9')];this[_0x5b34('0xa')]=_0x493798[_0x5b34('0xa')];this['countcongestionretry']=_0x493798['countcongestionretry'];this[_0x5b34('0xb')]=_0x493798[_0x5b34('0xb')];this[_0x5b34('0xc')]=_0x493798[_0x5b34('0xa')]+_0x493798[_0x5b34('0xd')]+_0x493798[_0x5b34('0xb')]+_0x493798[_0x5b34('0xe')]+_0x493798['countdropretry']+_0x493798[_0x5b34('0xf')]+_0x493798[_0x5b34('0x10')]+_0x493798['countagentrejectretry'];this['countnosuchnumberretry']=_0x493798[_0x5b34('0xe')];this['countdropretry']=_0x493798[_0x5b34('0x11')];this['countabandonedretry']=_0x493798['countabandonedretry'];this['countmachineretry']=_0x493798[_0x5b34('0x10')];this['countagentrejectretry']=_0x493798[_0x5b34('0x12')];this[_0x5b34('0x8')]=_0x493798[_0x5b34('0x8')];this[_0x5b34('0x13')]=_0x493798[_0x5b34('0x14')];this[_0x5b34('0x15')]=_0x493798[_0x5b34('0x16')];this[_0x5b34('0x17')]=_0x493798['starttime'];this[_0x5b34('0x18')]=_0x493798[_0x5b34('0x18')];this[_0x5b34('0x19')]=_0x493798[_0x5b34('0x18')];this['ringtime']=getSeconds(_0x493798['responsetime'],_0x493798[_0x5b34('0x17')]);this[_0x5b34('0x1a')]=0x0;this[_0x5b34('0x1b')]=0x0;this[_0x5b34('0x1c')]=_0x493798[_0x5b34('0x1c')];this[_0x5b34('0x1d')]=_0x493798[_0x5b34('0x1d')];this[_0x5b34('0x1e')]=_0x493798['callbackat'];this[_0x5b34('0x1f')]=_0x493798[_0x5b34('0x1f')];this['ContactId']=_0x493798[_0x5b34('0x20')];this['ListId']=_0x493798[_0x5b34('0x21')];this['UserId']=_0x493798[_0x5b34('0x22')];this['VoiceQueueId']=_0x493798[_0x5b34('0x23')];this[_0x5b34('0x24')]=_0x493798['CampaignId'];this[_0x5b34('0x25')]=_0x493798[_0x5b34('0x25')]||'';this[_0x5b34('0x26')]=_0x493798['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file +var _0xc148=['countmachineretry','countagentrejectretry','number','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x494fde,_0xabca09){var _0x2f7078=function(_0x312966){while(--_0x312966){_0x494fde['push'](_0x494fde['shift']());}};_0x2f7078(++_0xabca09);}(_0xc148,0x9d));var _0x8c14=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xc148[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0x8c14('0x0'));var _=require(_0x8c14('0x1'));var moment=require('moment');function getSeconds(_0xa126f8,_0x441a7b){var _0x307ac9=moment(_0xa126f8)[_0x8c14('0x2')](0x0);var _0x4349c7=moment(_0x441a7b)[_0x8c14('0x2')](0x0);return _0x307ac9[_0x8c14('0x3')](_0x4349c7,_0x8c14('0x4'));}function History(_0x4137b0){this[_0x8c14('0x5')]=_0x4137b0[_0x8c14('0x5')];this[_0x8c14('0x6')]=_0x4137b0[_0x8c14('0x6')]||undefined;this[_0x8c14('0x7')]=_0x4137b0['type'];this[_0x8c14('0x8')]=_0x4137b0[_0x8c14('0x7')]===_0x8c14('0x9')?_0x8c14('0xa'):_0x4137b0['type'];this[_0x8c14('0xb')]=_0x4137b0[_0x8c14('0xb')];this['countcongestionretry']=_0x4137b0[_0x8c14('0xc')];this['countnoanswerretry']=_0x4137b0[_0x8c14('0xd')];this[_0x8c14('0xe')]=_0x4137b0[_0x8c14('0xb')]+_0x4137b0[_0x8c14('0xc')]+_0x4137b0[_0x8c14('0xd')]+_0x4137b0[_0x8c14('0xf')]+_0x4137b0[_0x8c14('0x10')]+_0x4137b0[_0x8c14('0x11')]+_0x4137b0[_0x8c14('0x12')]+_0x4137b0[_0x8c14('0x13')];this['countnosuchnumberretry']=_0x4137b0['countnosuchnumberretry'];this[_0x8c14('0x10')]=_0x4137b0[_0x8c14('0x10')];this['countabandonedretry']=_0x4137b0[_0x8c14('0x11')];this[_0x8c14('0x12')]=_0x4137b0[_0x8c14('0x12')];this[_0x8c14('0x13')]=_0x4137b0[_0x8c14('0x13')];this['queue']=_0x4137b0['queue'];this['calleridname']=_0x4137b0['name'];this['calleridnum']=_0x4137b0[_0x8c14('0x14')];this['starttime']=_0x4137b0['starttime'];this[_0x8c14('0x15')]=_0x4137b0[_0x8c14('0x15')];this['endtime']=_0x4137b0[_0x8c14('0x15')];this[_0x8c14('0x16')]=getSeconds(_0x4137b0['responsetime'],_0x4137b0['starttime']);this[_0x8c14('0x17')]=0x0;this[_0x8c14('0x18')]=0x0;this[_0x8c14('0x19')]=_0x4137b0[_0x8c14('0x19')];this[_0x8c14('0x1a')]=_0x4137b0['callbackuniqueid'];this[_0x8c14('0x1b')]=_0x4137b0['callbackat'];this['recallme']=_0x4137b0[_0x8c14('0x1c')];this['ContactId']=_0x4137b0['ContactId'];this['ListId']=_0x4137b0['ListId'];this['UserId']=_0x4137b0[_0x8c14('0x1d')];this[_0x8c14('0x1e')]=_0x4137b0['VoiceQueueId'];this[_0x8c14('0x1f')]=_0x4137b0[_0x8c14('0x1f')];this['originatecalleridnum']=_0x4137b0[_0x8c14('0x20')]||'';this[_0x8c14('0x21')]=_0x4137b0[_0x8c14('0x21')]||'';}module[_0x8c14('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 1edafce..d577bfe 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 _0x6f0d=['Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr]','Machine','countnoanswerretry','countdropretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','syncAgentComplete','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','dialQueueProject2','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','stateinterface','queueBooked','push','merge','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','paused','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','syncQueueSummary','dialMethod','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','emptyContact','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','---------------------------','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Error','milliseconds','diff','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','stringify','md5','format','voice:queue:%s','type','ivr','campaign:ivr:%s','campaign:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','seconds','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','actions','[actions]','isNil'];(function(_0x73eb59,_0x22a4ec){var _0x1ecaa5=function(_0x50d87d){while(--_0x50d87d){_0x73eb59['push'](_0x73eb59['shift']());}};_0x1ecaa5(++_0x22a4ec);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x25d273,_0x763aca){_0x25d273=_0x25d273-0x0;var _0x4ed5a3=_0x6f0d[_0x25d273];return _0x4ed5a3;};'use strict';var util=require('util');var _=require(_0xd6f0('0x0'));var BPromise=require(_0xd6f0('0x1'));var uuid=require(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xd6f0('0x4'));var ut=require(_0xd6f0('0x5'));var config=require(_0xd6f0('0x6'));var logger=require(_0xd6f0('0x7'))(_0xd6f0('0x8'));var loggerBooked=require('../../../config/logger')(_0xd6f0('0x9'));var loggerPredictive=require('../../../config/logger')(_0xd6f0('0xa'));var loggerPredictiveCalls=require(_0xd6f0('0x7'))(_0xd6f0('0xb'));var loggerSyncQueueSummary=require(_0xd6f0('0x7'))('syncQueueSummary');var ami=require('../ami');config[_0xd6f0('0xc')]=_[_0xd6f0('0xd')](config[_0xd6f0('0xc')],{'host':_0xd6f0('0xe'),'port':0x18eb});var io=require(_0xd6f0('0xf'))(new Redis(config['redis']));var cmHopper=require(_0xd6f0('0x10'));var cmHopperHistory=require(_0xd6f0('0x11'));var cmHopperBlack=require(_0xd6f0('0x12'));var voiceQueueRt=require(_0xd6f0('0x13'));var Action=require('./action');var History=require(_0xd6f0('0x14'));var Final=require(_0xd6f0('0x15'));var AgentComplete=require(_0xd6f0('0x16'));var QueueCallerAbandon=require(_0xd6f0('0x17'));var Hangup=require(_0xd6f0('0x18'));var ipAgi=process[_0xd6f0('0x19')][_0xd6f0('0x1a')]||_0xd6f0('0x1b');var strategy={'rrmemory':_0xd6f0('0x1c'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xd6f0('0x1d')][_0xd6f0('0x1e')]=function(_0x4c1559){this[_0xd6f0('0x1f')]=this['tail']?this[_0xd6f0('0x1f')][_0xd6f0('0x20')](_0x4c1559):_0x4c1559();};function Dialer(_0x41bd99,_0x472156){this[_0xd6f0('0x21')]=new Sequence();this[_0xd6f0('0x22')]=_0x472156;this[_0xd6f0('0x23')]=_0x41bd99[_0xd6f0('0x23')];this[_0xd6f0('0x24')]=_0x41bd99[_0xd6f0('0x24')];this[_0xd6f0('0x25')]=_0x41bd99[_0xd6f0('0x25')];this[_0xd6f0('0x26')]=_0x41bd99[_0xd6f0('0x26')];this[_0xd6f0('0x27')]=config[_0xd6f0('0x27')]||0x2;this['channels']={};this['actions']={};this[_0xd6f0('0x28')]={};this[_0xd6f0('0x29')]={};this[_0xd6f0('0x2a')]={};this['startPredictive']={};this[_0xd6f0('0x2b')]={};this[_0xd6f0('0x2c')]={};this['queueBooked']={};this[_0xd6f0('0x2d')]={};ami['on']('agentconnect',this[_0xd6f0('0x2e')][_0xd6f0('0x2f')](this));ami['on']('queuecallerabandon',this[_0xd6f0('0x30')][_0xd6f0('0x2f')](this));ami['on']('originateresponse',this[_0xd6f0('0x31')][_0xd6f0('0x2f')](this));ami['on'](_0xd6f0('0x32'),this['syncAgentComplete'][_0xd6f0('0x2f')](this));ami['on'](_0xd6f0('0x33'),this['syncQueueSummary'][_0xd6f0('0x2f')](this));ami['on']('hangup',this[_0xd6f0('0x34')][_0xd6f0('0x2f')](this));ami['on'](_0xd6f0('0x35'),this[_0xd6f0('0x36')][_0xd6f0('0x2f')](this));ami['on'](_0xd6f0('0x37'),this[_0xd6f0('0x38')][_0xd6f0('0x2f')](this));ami['on']('queuemember',this[_0xd6f0('0x39')][_0xd6f0('0x2f')](this));ami['on']('queuestatuscomplete',this[_0xd6f0('0x3a')][_0xd6f0('0x2f')](this));this[_0xd6f0('0x3b')]();this[_0xd6f0('0x3c')]();}function isNotNull(_0x1a3967){return _0x1a3967!==null&&!_[_0xd6f0('0x3d')](_0x1a3967);}function checkIsLoggedIn(_0x351fda,_0x3151f8){return function(){if(_0x3151f8<=0x0){_0x351fda[_0xd6f0('0x3e')]=_0xd6f0('0x3f');throw _0x351fda[_0xd6f0('0x40')]+_0xd6f0('0x41');}};}function isActive(_0x348529){return _0x348529;}function checkIsActive(_0xa863d9,_0xbdd223){return function(){if(!isActive(_0xbdd223)){_0xa863d9[_0xd6f0('0x3e')]=_0xd6f0('0x42');throw _0xa863d9[_0xd6f0('0x40')]+_0xd6f0('0x43');}};}function checkInterval(_0x180e5f){return function(){if(!isNotNull(_0x180e5f[_0xd6f0('0x44')])){_0x180e5f[_0xd6f0('0x3e')]='INTERVAL_IS_NULL';throw _0x180e5f[_0xd6f0('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x180e5f['Interval'][_0xd6f0('0x45')])){_0x180e5f[_0xd6f0('0x3e')]=_0xd6f0('0x46');throw _0x180e5f[_0xd6f0('0x40')]+_0xd6f0('0x47');}if(!isNotNull(_['isEmpty'](_0x180e5f[_0xd6f0('0x44')]['Intervals']))){_0x180e5f[_0xd6f0('0x3e')]=_0xd6f0('0x46');throw _0x180e5f[_0xd6f0('0x40')]+_0xd6f0('0x47');}};}function msgResponse(_0x518751,_0x5c3132,_0x47b33d){return{'action':_0x518751,'response':_0x5c3132,'message':_0x47b33d,'stack':_0x47b33d};}function myreject(_0x3b6463){return function(_0xe2958d){return _0x3b6463(msgResponse('[ifTime][Action]',_0xd6f0('0x48'),JSON['stringify'](_0xe2958d)));};}function getSeconds(_0x507f66,_0x2fd7b8){var _0x28659e=moment(_0x507f66)[_0xd6f0('0x49')](0x0);var _0x451834=moment(_0x2fd7b8)[_0xd6f0('0x49')](0x0);return _0x28659e[_0xd6f0('0x4a')](_0x451834,'seconds');}function emit(_0x52203d,_0x162537,_0xf879a6){io['to'](_0x52203d)[_0xd6f0('0x4b')](_0x162537,_0xf879a6);}function emitVoiceQueueSummary(_0x5c2d9a){if(_0x5c2d9a['type']===_0xd6f0('0x4c')){var _0x2def01={'id':_0x5c2d9a['id'],'name':_0x5c2d9a[_0xd6f0('0x40')],'strategy':_0x5c2d9a[_0xd6f0('0x4d')],'answered':_0x5c2d9a[_0xd6f0('0x4e')],'available':_0x5c2d9a[_0xd6f0('0x4f')],'loggedIn':_0x5c2d9a[_0xd6f0('0x50')],'pTalking':_0x5c2d9a[_0xd6f0('0x51')],'sumBillable':_0x5c2d9a['sumBillable'],'sumDuration':_0x5c2d9a[_0xd6f0('0x52')],'sumHoldTime':_0x5c2d9a[_0xd6f0('0x53')]||0x0,'talking':_0x5c2d9a[_0xd6f0('0x54')],'total':_0x5c2d9a[_0xd6f0('0x55')],'type':_0x5c2d9a['type'],'unmanaged':_0x5c2d9a[_0xd6f0('0x56')],'abandoned':_0x5c2d9a[_0xd6f0('0x57')],'waiting':_0x5c2d9a[_0xd6f0('0x58')],'loggedInDb':_0x5c2d9a[_0xd6f0('0x59')],'dialActive':_0x5c2d9a[_0xd6f0('0x5a')],'dialMethod':_0x5c2d9a['dialMethod'],'dialOriginateCallerIdName':_0x5c2d9a[_0xd6f0('0x5b')],'dialOriginateCallerIdNumber':_0x5c2d9a[_0xd6f0('0x5c')],'dialOriginateTimeout':_0x5c2d9a[_0xd6f0('0x5d')],'dialPrefix':_0x5c2d9a['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5c2d9a[_0xd6f0('0x5e')],'outboundAnswerCallsDay':_0x5c2d9a[_0xd6f0('0x5f')],'outboundBlacklistCallsDay':_0x5c2d9a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5c2d9a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5c2d9a[_0xd6f0('0x60')],'outboundDropCallsDayACS':_0x5c2d9a[_0xd6f0('0x61')],'outboundDropCallsDayCallersExit':_0x5c2d9a[_0xd6f0('0x62')],'outboundDropCallsDayTimeout':_0x5c2d9a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5c2d9a[_0xd6f0('0x63')],'outboundNoSuchCallsDay':_0x5c2d9a[_0xd6f0('0x64')],'outboundOriginateFailureCallsDay':_0x5c2d9a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5c2d9a[_0xd6f0('0x65')],'outboundRejectCallsDay':_0x5c2d9a[_0xd6f0('0x66')],'outboundUnknownCallsDay':_0x5c2d9a[_0xd6f0('0x67')],'predictiveIntervalAnsweredCalls':_0x5c2d9a[_0xd6f0('0x68')],'predictiveIntervalAvgHoldtime':_0x5c2d9a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5c2d9a[_0xd6f0('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x5c2d9a[_0xd6f0('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x5c2d9a[_0xd6f0('0x6b')],'predictiveIntervalErlangCalls':_0x5c2d9a[_0xd6f0('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x5c2d9a[_0xd6f0('0x6d')],'predictiveIntervalHitRate':_0x5c2d9a[_0xd6f0('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x5c2d9a[_0xd6f0('0x6f')],'predictiveIntervalPauses':_0x5c2d9a[_0xd6f0('0x70')],'predictiveIntervalAvailable':_0x5c2d9a['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5c2d9a[_0xd6f0('0x71')],'message':_0x5c2d9a[_0xd6f0('0x3e')],'originated':_0x5c2d9a['originated'],'erlangCalls':_0x5c2d9a[_0xd6f0('0x72')],'erlangCallToSecond':_0x5c2d9a[_0xd6f0('0x73')],'erlangAbandonmentRate':_0x5c2d9a[_0xd6f0('0x74')],'erlangBusyFactor':_0x5c2d9a[_0xd6f0('0x75')],'startPredictive':_0x5c2d9a['startPredictive'],'startProgressive':_0x5c2d9a[_0xd6f0('0x2b')]};if(_0x5c2d9a[_0xd6f0('0x76')]){_0x2def01['Trunk']={'id':_0x5c2d9a['Trunk']['id'],'name':_0x5c2d9a[_0xd6f0('0x76')]['name'],'active':_0x5c2d9a[_0xd6f0('0x76')][_0xd6f0('0x77')],'callerid':_0x5c2d9a[_0xd6f0('0x76')]['callerid']};}if(_0x5c2d9a[_0xd6f0('0x44')]){_0x2def01[_0xd6f0('0x44')]={'id':_0x5c2d9a[_0xd6f0('0x44')]['id'],'name':_0x5c2d9a[_0xd6f0('0x44')][_0xd6f0('0x40')]};}var _0x4c42ce=md5(JSON[_0xd6f0('0x78')](_0x2def01));if(_0x5c2d9a['md5']!==_0x4c42ce){_0x5c2d9a[_0xd6f0('0x79')]=_0x4c42ce;emit(util[_0xd6f0('0x7a')](_0xd6f0('0x7b'),_0x2def01[_0xd6f0('0x40')]),'voice_queue:save',_0x2def01);}}}function emitCampaignSummary(_0x5ceb6b){if(_0x5ceb6b[_0xd6f0('0x7c')]===_0xd6f0('0x7d')){emit(util['format'](_0xd6f0('0x7e'),_0x5ceb6b['name']),_0xd6f0('0x7f'),_0x5ceb6b);}}function checkGetDataPredictive(_0x3cbbbd){if(isNotNull(_0x3cbbbd)&&!_[_0xd6f0('0x80')](_0x3cbbbd)){loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x82'));loggerPredictive['info'](_0xd6f0('0x83'),_0x3cbbbd[_0xd6f0('0x71')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x84'),_0x3cbbbd[_0xd6f0('0x68')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x85'),_0x3cbbbd[_0xd6f0('0x6b')]);loggerPredictive['info'](_0xd6f0('0x86'),_0x3cbbbd[_0xd6f0('0x6a')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x87'),_0x3cbbbd[_0xd6f0('0x88')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x89'),_0x3cbbbd[_0xd6f0('0x69')]);loggerPredictive[_0xd6f0('0x81')]('---------------------------');if(_0x3cbbbd[_0xd6f0('0x71')]>0x0){if(!_['isUndefined'](_0x3cbbbd['predictiveIntervalAvgTalktime'])&&_0x3cbbbd[_0xd6f0('0x69')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xd6f0('0x3d')](_0x3cbbbd[_0xd6f0('0x88')])&&_0x3cbbbd[_0xd6f0('0x88')]>0x0){return!![];}loggerPredictive['info'](_0xd6f0('0x8a'));}else{loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x8b'));}}else{loggerPredictive['info'](_0xd6f0('0x8c'));}return![];}function mergeDataErlangB(_0x357193){return function(_0x498ca5){loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x8d'));loggerPredictive['info'](_0xd6f0('0x8e'),_0x498ca5[_0xd6f0('0x72')]);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x8f'),_0x498ca5[_0xd6f0('0x73')]);loggerPredictive['info'](_0xd6f0('0x90'),_0x498ca5[_0xd6f0('0x74')]);loggerPredictive['info'](_0xd6f0('0x91'),_0x498ca5[_0xd6f0('0x75')]);loggerPredictive[_0xd6f0('0x81')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x498ca5[_0xd6f0('0x74')]);loggerPredictive['info']('---------------------------');_['merge'](_0x357193,_0x498ca5);};}function getDiff(_0x5c5aa4){var _0x311140=moment()[_0xd6f0('0x49')](0x0);var _0x1a8984=moment(_0x5c5aa4)[_0xd6f0('0x49')](0x0);return _0x311140['diff'](_0x1a8984,_0xd6f0('0x92'));}function ifInterval(_0x5a6ee0,_0x13c194){if(_[_0xd6f0('0x3d')](_0x13c194)){return![];}return getDiff(_0x13c194)<_0x5a6ee0*0x3c;}function freeVariablesPredictive(_0x2ba889){if(isNotNull(_0x2ba889)){if(!_['isUndefined'](_0x2ba889[_0xd6f0('0x2b')])){_0x2ba889[_0xd6f0('0x2b')]=undefined;loggerPredictive[_0xd6f0('0x81')](_0x2ba889[_0xd6f0('0x40')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xd6f0('0x3d')](_0x2ba889[_0xd6f0('0x93')])){_0x2ba889[_0xd6f0('0x93')]=undefined;loggerPredictive['info'](_0x2ba889[_0xd6f0('0x40')],_0xd6f0('0x94'));}if(!_[_0xd6f0('0x3d')](_0x2ba889[_0xd6f0('0x95')])){clearInterval(_0x2ba889['handlePredictive']);_0x2ba889[_0xd6f0('0x95')]=undefined;loggerPredictive[_0xd6f0('0x81')](_0x2ba889[_0xd6f0('0x40')],_0xd6f0('0x96'));}}}function erlangb(_0x49fc4a,_0x535910){if(_0x535910===0x0){return 0x0;}var _0x490bc4=0x1;for(var _0x5ed780=0x1;_0x5ed780<=_0x535910;_0x5ed780+=0x1){_0x490bc4=0x1+_0x490bc4*_0x5ed780/_0x49fc4a;}return 0x1/_0x490bc4;}function isVoiceQueueOutbound(_0x144a77){return _0x144a77===_0xd6f0('0x4c');}function isNotPreview(_0xa1ff68){return _0xa1ff68!==_0xd6f0('0x22');}function isCampaignIvr(_0x318a64){return _0x318a64===_0xd6f0('0x7d');}function getCallerId(_0x39f937,_0x1b298a,_0x1ce601){if(!_['isUndefined'](_0x1ce601)&&typeof _0x1ce601==='string'&&!_[_0xd6f0('0x80')](_0x1ce601)){if(!_['isUndefined'](_0x1b298a)&&typeof _0x1b298a===_0xd6f0('0x97')&&!_[_0xd6f0('0x80')](_0x1b298a)){return util[_0xd6f0('0x7a')](_0xd6f0('0x98'),_0x1b298a,_0x1ce601);}return util[_0xd6f0('0x7a')](_0xd6f0('0x98'),_0x1ce601,_0x1ce601);}if(!_[_0xd6f0('0x3d')](_0x39f937)&&typeof _0x39f937==='string'&&!_[_0xd6f0('0x80')](_0x39f937)){return _0x39f937;}return _0xd6f0('0x99');}function loggerCatchQueueSummary(_0x40cdae,_0x5b687f){return function(_0x20feae){freeVariablesPredictive(_0x5b687f);emitVoiceQueueSummary(_0x5b687f);emitCampaignSummary(_0x5b687f);loggerSyncQueueSummary[_0xd6f0('0x9a')](_0x40cdae,util['inspect'](_0x20feae,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xad50ac,_0x80f21c){return function(_0x1bf313){loggerPredictive[_0xd6f0('0x9a')](_0x80f21c[_0xd6f0('0x40')],_0xad50ac);loggerPredictive[_0xd6f0('0x9a')](_0x1bf313[_0xd6f0('0x9b')]);freeVariablesPredictive(_0x80f21c);};}function loggerCatch(_0x2efbad){return function(_0x3502ea){logger['error'](_0x2efbad,util[_0xd6f0('0x9c')](_0x3502ea,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x205b6a){return _0x205b6a&&!_[_0xd6f0('0x3d')](_0x205b6a)&&_0x205b6a[_0xd6f0('0x9d')]>0x0;}function decremetOriginate(_0x5f1321){if(!_[_0xd6f0('0x3d')](_0x5f1321)&&_0x5f1321!==null){if(typeof _0x5f1321[_0xd6f0('0x9e')]!==_0xd6f0('0x9f')){if(_0x5f1321[_0xd6f0('0x9e')]>0x0){_0x5f1321[_0xd6f0('0x9e')]-=0x1;}else{logger[_0xd6f0('0x9a')](_0xd6f0('0xa0'));}}}else{logger[_0xd6f0('0x9a')](_0xd6f0('0xa1'));}}function checkContactLowerLimitOriginate(_0x1d8221,_0x5df593,_0x440d5c){if(_0x5df593>_0x440d5c){for(var _0x16c255=0x0;_0x16c255<_0x5df593-_0x440d5c;_0x16c255+=0x1){decremetOriginate(_0x1d8221);}}}function loggerGetContactDialer(_0x1dc77c,_0x580c93,_0x12a37c){return function(_0x2b5411){checkContactLowerLimitOriginate(_0x580c93,_0x12a37c,0x0);logger[_0xd6f0('0x9a')](_0x1dc77c,util[_0xd6f0('0x9c')](_0x2b5411,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2f6b18){return function(_0xa41e33){if(isNotNull(_0xa41e33)&&isNotNull(_0xa41e33[0x0])){if(_0xa41e33[0x0][_0xd6f0('0xa2')]>0x0){_0x2f6b18[_0xd6f0('0x3e')]=_0xd6f0('0xa3');logger[_0xd6f0('0x81')](_0xd6f0('0xa4')+_0x2f6b18['name'],_0xa41e33[0x0]['contactsRescheduled'],_0xd6f0('0xa5'));}else{_0x2f6b18[_0xd6f0('0x3e')]=_0xd6f0('0xa6');logger[_0xd6f0('0x81')](_0xd6f0('0xa7')+_0x2f6b18['name']);}}};}function notSendMessagesQueue(_0x15143a){if(_0x15143a[_0xd6f0('0xa8')]){freeVariablesPredictive(_0x15143a);if(_0x15143a['originated']===0x0&&_0x15143a[_0xd6f0('0x54')]===0x0&&_0x15143a['waiting']===0x0&&(_0x15143a[_0xd6f0('0x51')]||0x0)===0x0){_0x15143a[_0xd6f0('0xa8')]=![];_0x15143a[_0xd6f0('0x4f')]=0x0;_0x15143a[_0xd6f0('0x3e')]=_0xd6f0('0x42');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x15143a[_0xd6f0('0x40')],_0xd6f0('0xa9'));}else{_0x15143a['message']=_0xd6f0('0xaa');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x15143a[_0xd6f0('0x40')],'is\x20disactive');}emitVoiceQueueSummary(_0x15143a);}}function notSendMessagesCampaign(_0x5dc1c7){if(_0x5dc1c7['sendMessageOneNotActive']){if(_0x5dc1c7['originated']===0x0){_0x5dc1c7[_0xd6f0('0xa8')]=![];_0x5dc1c7[_0xd6f0('0x3e')]=_0xd6f0('0x42');loggerSyncQueueSummary[_0xd6f0('0x9a')](_0xd6f0('0xab'),_0x5dc1c7[_0xd6f0('0x40')],_0xd6f0('0xa9'));}else{_0x5dc1c7[_0xd6f0('0x3e')]=_0xd6f0('0xaa');loggerSyncQueueSummary['error'](_0xd6f0('0xab'),_0x5dc1c7['name'],'is\x20disactive');}emitCampaignSummary(_0x5dc1c7);}}function createObjHistory(_0x1309d9,_0x83913c,_0x397f2c,_0x54aea7,_0x12e166){_0x1309d9[_0xd6f0('0x3e')]=_0x397f2c;var _0xc0585c=new Action(_0x1309d9,_0x83913c);var _0xf7ade1=new History(_0xc0585c);_0xf7ade1[_0xd6f0('0xac')]=_0x54aea7;_0xf7ade1[_0xd6f0('0xad')]=_0x12e166;_0xf7ade1[_0xd6f0('0xae')]=_0xc0585c[_0xd6f0('0xaf')];return _0xf7ade1;}Dialer['prototype'][_0xd6f0('0x3c')]=function(){var _0x37a29b=this;setInterval(function(){_0x37a29b['clearZombieChannels'](_0x37a29b[_0xd6f0('0x29')],_0xd6f0('0xb0'));_0x37a29b[_0xd6f0('0xb1')](_0x37a29b[_0xd6f0('0xb2')],_0xd6f0('0xb3'));},0x32c8);};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xb1')]=function(_0x51aa88,_0x2de847){var _0x24c31d=this;for(var _0x5c3659 in _0x51aa88){if(typeof _0x51aa88[_0x5c3659]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0xd6f0('0xb4')](_0x51aa88[_0x5c3659])){return ami[_0xd6f0('0xb5')]({'action':_0xd6f0('0xb6'),'channel':_0x51aa88[_0x5c3659][_0xd6f0('0xb7')]})[_0xd6f0('0xb8')](function(_0x48d87d){if(_0x48d87d['message']===_0xd6f0('0xb9')){setTimeout(function(){if(_0x51aa88[_0x5c3659]&&_0x51aa88[_0x5c3659][_0xd6f0('0x7c')]!==_0xd6f0('0x7d')){_0x24c31d[_0xd6f0('0xba')](_0x24c31d['voiceQueues'][_0x51aa88[_0x5c3659][_0xd6f0('0xbb')]]);logger['error'](_0xd6f0('0xbc'),_0x2de847,_0x5c3659,_0x51aa88[_0x5c3659]['queue']);delete _0x51aa88[_0x5c3659];}if(_0x51aa88[_0x5c3659]&&_0x51aa88[_0x5c3659][_0xd6f0('0x7c')]===_0xd6f0('0x7d')){_0x24c31d['updateOriginated'](_0x24c31d[_0xd6f0('0x24')][_0x51aa88[_0x5c3659][_0xd6f0('0xbb')]]);logger[_0xd6f0('0x9a')](_0xd6f0('0xbd'),_0x2de847,_0x5c3659,_0x51aa88[_0x5c3659][_0xd6f0('0xbb')]);delete _0x51aa88[_0x5c3659];}},0x2328);}});}});}}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xbe')]=function(_0xb9ee3a){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopper[_0xd6f0('0xbe')](_0xb9ee3a))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc1')));};Dialer[_0xd6f0('0x1d')]['checkIsBlackList']=function(_0x119865){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopperBlack[_0xd6f0('0xc2')](_0x119865))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc3')));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xc4')]=function(_0x5d0600){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopperBlack[_0xd6f0('0xc4')](_0x5d0600))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc5')));};Dialer['prototype']['averageHandleTime']=function(_0x2638c3){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopperHistory[_0xd6f0('0xc6')](_0x2638c3))[_0xd6f0('0xb8')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xc7')]=function(_0x2d0d8a){return BPromise[_0xd6f0('0xbf')]()['then'](cmHopper[_0xd6f0('0xc7')](_0x2d0d8a))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc8')));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xc9')]=function(_0x229631,_0x50d310,_0x585495){return BPromise[_0xd6f0('0xbf')]()['then'](cmHopper[_0xd6f0('0xc9')](_0x229631,_0x50d310,_0x585495))['catch'](loggerCatch(_0xd6f0('0xca')));};Dialer[_0xd6f0('0x1d')]['getContactDialer']=function(_0x3bf3b9,_0x5cc944,_0x2cec2b,_0x1756c,_0x65b7c){return BPromise[_0xd6f0('0xbf')]()['then'](cmHopper[_0xd6f0('0xcb')](_0x3bf3b9,_0x5cc944,_0x2cec2b,_0x1756c))[_0xd6f0('0xb8')](function(_0x2f64f1){_0x65b7c['temp']-=_0x2cec2b;_0x65b7c[_0xd6f0('0xcc')]=_0x65b7c[_0xd6f0('0xcc')]>0x0?_0x65b7c[_0xd6f0('0xcc')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x2f64f1);});};Dialer['prototype'][_0xd6f0('0xcd')]=function(_0x22c3fa,_0x42b756,_0x4b113a,_0x40d4b3){return BPromise[_0xd6f0('0xbf')]()[_0xd6f0('0xc0')](cmHopper[_0xd6f0('0xcd')](_0x22c3fa,_0x42b756,_0x4b113a))[_0xd6f0('0xb8')](function(_0x37ad52){_0x40d4b3[_0xd6f0('0xcc')]-=_0x42b756;_0x40d4b3['temp']=_0x40d4b3[_0xd6f0('0xcc')]>0x0?_0x40d4b3['temp']:0x0;loggerCatch(_0xd6f0('0xce'))(_0x37ad52);});};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xcf')]=function(_0x4f5f39){return BPromise[_0xd6f0('0xbf')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x4f5f39))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xd0')));};Dialer[_0xd6f0('0x1d')]['moveContactManagedDialer']=function(_0x446896){return BPromise['resolve']()['then'](cmHopper[_0xd6f0('0xd1')](_0x446896))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xd2')));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xd3')]=function(_0x468cf5){return BPromise['resolve']()[_0xd6f0('0xc0')](cmHopperHistory['createHistory'](_0x468cf5))[_0xd6f0('0xb8')](loggerCatch('[createHistory]\x20'));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xba')]=function(_0x58c187){if(!_[_0xd6f0('0x3d')](_0x58c187)&&_0x58c187!==null){if(typeof _0x58c187[_0xd6f0('0x9e')]!==_0xd6f0('0x9f')){if(_0x58c187[_0xd6f0('0x9e')]>0x0){_0x58c187[_0xd6f0('0x9e')]-=0x1;}else{logger[_0xd6f0('0x9a')](_0xd6f0('0xd4'));}}}else{logger[_0xd6f0('0x9a')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xd5')]=function(_0x529c3d,_0x282736){var _0x527e05=this;return function(_0x1f980f){_0x527e05[_0xd6f0('0xba')](_0x282736);logger[_0xd6f0('0x9a')](_0x529c3d,util[_0xd6f0('0x9c')](_0x1f980f,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x3638b7,_0x16160d,_0xe96c8a){var _0xf5b37a={'state':0x19,'statedesc':_0xd6f0('0xd6')};this[_0xd6f0('0xba')](_0x16160d);this[_0xd6f0('0xd7')](_['merge'](_0xf5b37a,_[_0xd6f0('0xd8')](_0xe96c8a,[_0xd6f0('0xd9'),_0xd6f0('0xda'),_0xd6f0('0xdb'),'VoiceQueueId',_0xd6f0('0xdc')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0xd6f0('0x9a')](_0x3638b7);};Dialer['prototype'][_0xd6f0('0xdd')]=function(_0x3e799e){return _0x3e799e===_0xd6f0('0xde');};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xdf')]=function(_0x2c25b4){return!_[_0xd6f0('0x3d')](_0x2c25b4)&&_0x2c25b4&&!_['isUndefined'](_0x2c25b4[_0xd6f0('0x40')])&&!_[_0xd6f0('0x3d')](_0x2c25b4[_0xd6f0('0x77')])&&_0x2c25b4['active']&&(this[_0xd6f0('0x26')][util[_0xd6f0('0x7a')](_0xd6f0('0xe0'),_0x2c25b4[_0xd6f0('0x40')])]['status']===_0xd6f0('0xe1')||this['trunks'][util[_0xd6f0('0x7a')]('SIP/%s',_0x2c25b4[_0xd6f0('0x40')])][_0xd6f0('0xb6')]===_0xd6f0('0xe2'));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xd7')]=function(_0xb997e1,_0x238663,_0x49c544){this['createHistory'](_0xb997e1)[_0xd6f0('0xb8')](loggerCatch(_0x238663));this['moveContactManagedDialer'](_0xb997e1)[_0xd6f0('0xb8')](loggerCatch(_0x49c544));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x38')]=function(_0x2bae25){var _0x961e4f=this[_0xd6f0('0x29')][_0x2bae25[_0xd6f0('0xe3')]];var _0x83b80a;if(!_[_0xd6f0('0xb4')](_0x2bae25)&&!_[_0xd6f0('0xb4')](_0x2bae25[_0xd6f0('0xe4')])&&!_['isNil'](_0x2bae25[_0xd6f0('0xe4')]['amdstatus'])&&_0x2bae25[_0xd6f0('0xe5')]===_0xd6f0('0xe6')&&_0x961e4f){if(_0x961e4f['type']!==_0xd6f0('0x7d')&&this[_0xd6f0('0x23')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0xe7')]&&_0x2bae25[_0xd6f0('0xe8')]===_0xd6f0('0xe9')){delete this[_0xd6f0('0x29')][_0x2bae25[_0xd6f0('0xe3')]];this[_0xd6f0('0xba')](this['voiceQueues'][_0x961e4f[_0xd6f0('0xbb')]]);this[_0xd6f0('0x23')][_0x961e4f['queue']][_0xd6f0('0x5f')]+=0x1;this['voiceQueues'][_0x961e4f['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x83b80a=new Hangup(_0x961e4f,_0x2bae25);_0x83b80a[_0xd6f0('0xac')]=0x12;_0x83b80a[_0xd6f0('0xad')]='HangupInAMD';_0x83b80a[_0xd6f0('0xea')]=_0xd6f0('0xeb');ami[_0xd6f0('0x4b')](_0xd6f0('0xec'),ut[_0xd6f0('0xed')](_0x83b80a,_0xd6f0('0xee')));this[_0xd6f0('0xd7')](_0x83b80a,_0xd6f0('0xef'),'[syncHangupInAMD]');}if(_0x961e4f[_0xd6f0('0x7c')]!==_0xd6f0('0x7d')&&this['voiceQueues'][_0x961e4f[_0xd6f0('0xbb')]]['dialAMDActive']&&_0x2bae25[_0xd6f0('0xe8')]===_0xd6f0('0xf0')){var _0xa3546a=this;return new BPromise(function(_0x405d56,_0x5a7129){delete _0xa3546a[_0xd6f0('0x29')][_0x2bae25['uniqueid']];_0xa3546a['updateOriginated'](_0xa3546a[_0xd6f0('0x23')][_0x961e4f[_0xd6f0('0xbb')]]);_0xa3546a[_0xd6f0('0x23')][_0x961e4f['queue']][_0xd6f0('0x5f')]+=0x1;_0xa3546a[_0xd6f0('0x23')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0x5e')]+=0x1;var _0x259b01=_0xa3546a['voiceQueues'][_0x961e4f[_0xd6f0('0xbb')]];var _0x265fd4=new Hangup(_0x961e4f,_0x2bae25);_0x265fd4['state']=0x13;_0x265fd4[_0xd6f0('0xad')]='Machine';_0x265fd4[_0xd6f0('0xea')]=_0xd6f0('0xeb');_0x265fd4[_0xd6f0('0xf1')]+=0x1;_0x265fd4[_0xd6f0('0xf2')]+=0x1;_0x265fd4[_0xd6f0('0xee')]=!![];ami[_0xd6f0('0x4b')](_0xd6f0('0xec'),ut['buildObj'](_0x265fd4,'amd'));_0xa3546a[_0xd6f0('0xd3')](_0x265fd4)['catch'](loggerCatch(_0xd6f0('0xf3')));if(_0x265fd4[_0xd6f0('0xf4')]+_0x265fd4[_0xd6f0('0xf5')]+_0x265fd4['countnoanswerretry']+_0x265fd4[_0xd6f0('0xf6')]+_0x265fd4['countdropretry']+_0x265fd4[_0xd6f0('0xf7')]+_0x265fd4[_0xd6f0('0xf1')]+_0x265fd4['countagentrejectretry']>=_0x259b01[_0xd6f0('0xf8')]){_0xa3546a[_0xd6f0('0xf9')](_0x265fd4,_0x405d56,_0x5a7129,'reason19\x20machine....');}else{if(_0x265fd4['countmachineretry']>=_0x259b01['dialMachineMaxRetry']){_0xa3546a[_0xd6f0('0xfa')](_0x265fd4,_0x405d56,_0x5a7129,_0xd6f0('0xfb'));}else{_0xa3546a[_0xd6f0('0xc7')]({'active':![],'countmachineretry':_0x265fd4[_0xd6f0('0xf1')],'scheduledat':moment()[_0xd6f0('0xfc')](_0x259b01['dialMachineRetryFrequency'],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x265fd4[_0xd6f0('0xd9')],'ListId':_0x265fd4[_0xd6f0('0xda')],'VoiceQueueId':_0x265fd4[_0xd6f0('0xff')]||undefined,'CampaignId':_0x265fd4[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x100')));_0x405d56({'reschedule':0x1});}}});}if(_0x961e4f[_0xd6f0('0x7c')]===_0xd6f0('0x7d')&&this[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0xe7')]&&_0x2bae25['value']==='HANGUP'){delete this[_0xd6f0('0x29')][_0x2bae25[_0xd6f0('0xe3')]];this['updateOriginated'](this[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]]);_0x83b80a=new Hangup(_0x961e4f,_0x2bae25);_0x83b80a[_0xd6f0('0xac')]=0x12;_0x83b80a[_0xd6f0('0xad')]=_0xd6f0('0x101');_0x83b80a[_0xd6f0('0xea')]=_0xd6f0('0xeb');ami['emit'](_0xd6f0('0xec'),ut[_0xd6f0('0xed')](_0x83b80a,_0xd6f0('0xee')));this[_0xd6f0('0xd7')](_0x83b80a,'[syncHangupInAMDIvr][createHistory]',_0xd6f0('0x102'));}if(_0x961e4f[_0xd6f0('0x7c')]===_0xd6f0('0x7d')&&this['campaigns'][_0x961e4f[_0xd6f0('0xbb')]]['dialAMDActive']&&_0x2bae25[_0xd6f0('0xe8')]===_0xd6f0('0xf0')){var _0xa3546a=this;return new BPromise(function(_0x2aa249,_0x356b9b){delete _0xa3546a[_0xd6f0('0x29')][_0x2bae25[_0xd6f0('0xe3')]];_0xa3546a[_0xd6f0('0xba')](_0xa3546a[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]]);_0xa3546a[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0x5f')]+=0x1;_0xa3546a[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]][_0xd6f0('0x5e')]+=0x1;var _0x482248=_0xa3546a[_0xd6f0('0x24')][_0x961e4f[_0xd6f0('0xbb')]];var _0x31d723=new Hangup(_0x961e4f,_0x2bae25);_0x31d723[_0xd6f0('0xac')]=0x13;_0x31d723['statedesc']=_0xd6f0('0x103');_0x31d723['membername']='AMD';_0x31d723[_0xd6f0('0xf1')]+=0x1;_0x31d723['countglobal']+=0x1;_0x31d723[_0xd6f0('0xee')]=!![];ami[_0xd6f0('0x4b')](_0xd6f0('0xec'),ut['buildObj'](_0x31d723,_0xd6f0('0xee')));_0xa3546a['createHistory'](_0x31d723)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xf3')));if(_0x31d723[_0xd6f0('0xf4')]+_0x31d723['countcongestionretry']+_0x31d723[_0xd6f0('0x104')]+_0x31d723[_0xd6f0('0xf6')]+_0x31d723[_0xd6f0('0x105')]+_0x31d723[_0xd6f0('0xf7')]+_0x31d723[_0xd6f0('0xf1')]+_0x31d723[_0xd6f0('0x106')]>=_0x482248['dialGlobalMaxRetry']){_0xa3546a[_0xd6f0('0xf9')](_0x31d723,_0x2aa249,_0x356b9b,_0xd6f0('0x107'));}else{if(_0x31d723[_0xd6f0('0xf1')]>=_0x482248[_0xd6f0('0x108')]){_0xa3546a['createStateFinal'](_0x31d723,_0x2aa249,_0x356b9b,_0xd6f0('0xfb'));}else{_0xa3546a['rescheduleContact']({'active':![],'countmachineretry':_0x31d723[_0xd6f0('0xf1')],'scheduledat':moment()['add'](_0x482248['dialMachineRetryFrequency'],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x31d723['ContactId'],'ListId':_0x31d723[_0xd6f0('0xda')],'VoiceQueueId':_0x31d723['VoiceQueueId']||undefined,'CampaignId':_0x31d723[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x100')));_0x2aa249({'reschedule':0x1});}}});}}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x34')]=function(_0x33a5c9){var _0x3cdcf1=this[_0xd6f0('0x29')][_0x33a5c9[_0xd6f0('0xe3')]];var _0x148bf3=this;var _0x26a9ef;if(_0x3cdcf1&&_0x3cdcf1[_0xd6f0('0x7c')]==='ivr'){delete this['uniqueId'][_0x33a5c9[_0xd6f0('0xe3')]];this[_0xd6f0('0xba')](this[_0xd6f0('0x24')][_0x3cdcf1[_0xd6f0('0xbb')]]);this['campaigns'][_0x3cdcf1[_0xd6f0('0xbb')]]['ivrAnswerCallsDay']+=0x1;_0x26a9ef=new Hangup(_0x3cdcf1,_0x33a5c9);this[_0xd6f0('0xd3')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x109')));this[_0xd6f0('0xd1')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch('[syncHangupIvr]'));}if(_0x3cdcf1&&_0x3cdcf1[_0xd6f0('0x7c')]!==_0xd6f0('0x7d')&&isNotNull(this['voiceQueues'][_0x3cdcf1[_0xd6f0('0xbb')]][_0xd6f0('0x10a')])){delete this[_0xd6f0('0x29')][_0x33a5c9[_0xd6f0('0xe3')]];this['updateOriginated'](this['voiceQueues'][_0x3cdcf1[_0xd6f0('0xbb')]]);this[_0xd6f0('0x23')][_0x3cdcf1[_0xd6f0('0xbb')]][_0xd6f0('0x5f')]+=0x1;this[_0xd6f0('0x23')][_0x3cdcf1[_0xd6f0('0xbb')]][_0xd6f0('0x5e')]+=0x1;_0x26a9ef=new Hangup(_0x3cdcf1,_0x33a5c9);_0x26a9ef[_0xd6f0('0xac')]=0x10;_0x26a9ef['statedesc']=_0xd6f0('0x10b');_0x26a9ef[_0xd6f0('0xea')]=_0xd6f0('0x10c');this[_0xd6f0('0xd3')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x109')));this[_0xd6f0('0xd1')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x10d')));}if(_0x3cdcf1&&_0x3cdcf1[_0xd6f0('0x7c')]!==_0xd6f0('0x7d')&&!isNotNull(this['voiceQueues'][_0x3cdcf1['queue']][_0xd6f0('0x10a')])){delete this['uniqueId'][_0x33a5c9[_0xd6f0('0xe3')]];this[_0xd6f0('0xba')](this[_0xd6f0('0x23')][_0x3cdcf1[_0xd6f0('0xbb')]]);this[_0xd6f0('0x23')][_0x3cdcf1[_0xd6f0('0xbb')]][_0xd6f0('0x67')]+=0x1;_0x26a9ef=new Hangup(_0x3cdcf1,_0x33a5c9);_0x26a9ef['state']=0xc;_0x26a9ef[_0xd6f0('0xad')]=_0x33a5c9[_0xd6f0('0x10e')];_0x26a9ef[_0xd6f0('0xea')]='Unknow';this['createHistory'](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x109')));this[_0xd6f0('0xd1')](_0x26a9ef)[_0xd6f0('0xb8')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x10f')]=function(_0x5a4203){var _0x2b98f4=this[_0xd6f0('0x29')][_0x5a4203[_0xd6f0('0xe3')]];var _0xb2bce6=this;if(this['voiceQueues'][_0x5a4203[_0xd6f0('0xbb')]]){if(_0x2b98f4&&_0x2b98f4[_0xd6f0('0x7c')]!=='ivr'){delete this['uniqueId'][_0x5a4203[_0xd6f0('0xe3')]];this[_0xd6f0('0x23')][_0x5a4203[_0xd6f0('0xbb')]][_0xd6f0('0x5f')]+=0x1;var _0x1acefc=new AgentComplete(_0x2b98f4,_0x5a4203);if(_0x5a4203[_0xd6f0('0x110')]===_0xd6f0('0x111')){_0x1acefc[_0xd6f0('0x112')]=this[_0xd6f0('0x23')][_0x5a4203[_0xd6f0('0xbb')]]['dialQueueProject2']&&this[_0xd6f0('0x23')][_0x5a4203[_0xd6f0('0xbb')]][_0xd6f0('0x113')]?moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe')):undefined;}this[_0xd6f0('0xd3')](_0x1acefc)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xd6f0('0xd1')](_0x1acefc)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x114')));}}};Dialer[_0xd6f0('0x1d')]['syncAgentConnect']=function(_0x477673){if(this[_0xd6f0('0x23')][_0x477673[_0xd6f0('0xbb')]]){if(this[_0xd6f0('0x29')][_0x477673[_0xd6f0('0xe3')]]&&this['uniqueId'][_0x477673[_0xd6f0('0xe3')]][_0xd6f0('0x7c')]!=='ivr'){this[_0xd6f0('0xba')](this[_0xd6f0('0x23')][_0x477673['queue']]);this[_0xd6f0('0x29')][_0x477673[_0xd6f0('0xe3')]][_0xd6f0('0x115')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));}}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x116')]=function(_0x3c1e84){this[_0xd6f0('0xd3')](_0x3c1e84)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x117')));this['moveContactManagedDialer'](_0x3c1e84)[_0xd6f0('0xb8')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x30')]=function(_0x336cba){var _0x585084=this[_0xd6f0('0x29')][_0x336cba[_0xd6f0('0xe3')]];var _0x3ddd4b=this;if(this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]]){if(_0x585084&&_0x585084['type']!=='ivr'){delete this[_0xd6f0('0x29')][_0x336cba[_0xd6f0('0xe3')]];this[_0xd6f0('0xba')](this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]]);_0x585084[_0xd6f0('0x118')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));var _0x4a5407=new QueueCallerAbandon(_0x585084,_0x336cba);if(getSeconds(_0x585084['droptime'],_0x585084['responsetime'])>=_0x585084[_0xd6f0('0x119')]){this['voiceQueues'][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x6b')]+=0x1;this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x11a')]+=0x1;this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x6d')]+=0x1;_0x4a5407[_0xd6f0('0xac')]=0xa;_0x4a5407[_0xd6f0('0xad')]='Drop';_0x4a5407[_0xd6f0('0x11b')]='TIMEOUT';_0x4a5407[_0xd6f0('0x112')]=this[_0xd6f0('0x23')][_0x336cba['queue']][_0xd6f0('0x11c')]?moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe')):undefined;_0x4a5407[_0xd6f0('0x105')]+=0x1;_0x4a5407[_0xd6f0('0xf2')]+=0x1;if(_0x4a5407['countdropretry']>=this['voiceQueues'][_0x336cba['queue']]['dialDropMaxRetry']){this[_0xd6f0('0x116')](_0x4a5407);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x4a5407[_0xd6f0('0x105')],'scheduledat':moment()[_0xd6f0('0xfc')](this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x11d')],_0xd6f0('0xfd'))['format'](_0xd6f0('0xfe')),'ContactId':_0x585084[_0xd6f0('0xd9')],'ListId':_0x585084[_0xd6f0('0xda')],'VoiceQueueId':_0x585084[_0xd6f0('0xff')]||undefined,'CampaignId':_0x585084[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch('[rescheduleContact][Drop]'));var _0x1520cc=new History(_0x4a5407);_0x1520cc[_0xd6f0('0xac')]=0xa;_0x1520cc[_0xd6f0('0xad')]='Drop';_0x1520cc[_0xd6f0('0xaf')]=moment()[_0xd6f0('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1520cc[_0xd6f0('0xae')]=_0x1520cc[_0xd6f0('0xaf')];_0x1520cc[_0xd6f0('0x11e')]=_0x4a5407['calleridname'];_0x1520cc[_0xd6f0('0x11f')]=_0x4a5407[_0xd6f0('0x11f')];this[_0xd6f0('0xd3')](_0x1520cc)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x120')));}}else{this['voiceQueues'][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x6a')]+=0x1;this[_0xd6f0('0x23')][_0x336cba[_0xd6f0('0xbb')]][_0xd6f0('0x62')]+=0x1;_0x4a5407[_0xd6f0('0xac')]=0xb;_0x4a5407[_0xd6f0('0xad')]=_0xd6f0('0x121');_0x4a5407[_0xd6f0('0x11b')]=_0xd6f0('0x122');_0x4a5407[_0xd6f0('0xf7')]+=0x1;_0x4a5407['countglobal']+=0x1;if(_0x4a5407[_0xd6f0('0xf7')]>=this[_0xd6f0('0x23')][_0x336cba['queue']][_0xd6f0('0x123')]){this['queueCallerAbandonCreateState'](_0x4a5407);}else{this[_0xd6f0('0xc7')]({'active':![],'countabandonedretry':_0x4a5407[_0xd6f0('0xf7')],'scheduledat':moment()['add'](this[_0xd6f0('0x23')][_0x336cba['queue']][_0xd6f0('0x124')],'minutes')[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x585084['ContactId'],'ListId':_0x585084['ListId'],'VoiceQueueId':_0x585084[_0xd6f0('0xff')]||undefined,'CampaignId':_0x585084[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x1520cc=new History(_0x4a5407);_0x1520cc[_0xd6f0('0xac')]=0xb;_0x1520cc[_0xd6f0('0xad')]=_0xd6f0('0x121');_0x1520cc[_0xd6f0('0xaf')]=moment()['format'](_0xd6f0('0xfe'));_0x1520cc[_0xd6f0('0xae')]=_0x1520cc[_0xd6f0('0xaf')];_0x1520cc[_0xd6f0('0x11e')]=_0x4a5407[_0xd6f0('0x11e')];_0x1520cc[_0xd6f0('0x11f')]=_0x4a5407[_0xd6f0('0x11f')];this['createHistory'](_0x1520cc)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x125')));}}}}};Dialer['prototype'][_0xd6f0('0x36')]=function(_0x47126a){if(this['actions'][_0x47126a[_0xd6f0('0xe3')]]){this[_0xd6f0('0xb2')][_0x47126a[_0xd6f0('0xe3')]][_0xd6f0('0xb7')]=_0x47126a[_0xd6f0('0xb7')];}if(this[_0xd6f0('0x29')][_0x47126a[_0xd6f0('0xe3')]]){this[_0xd6f0('0x29')][_0x47126a['uniqueid']][_0xd6f0('0xb7')]=_0x47126a[_0xd6f0('0xb7')];}};Dialer['prototype'][_0xd6f0('0x39')]=function(_0x48f192){if(strategy[this[_0xd6f0('0x23')][this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0xbb')]][_0xd6f0('0x4d')]]===_0xd6f0('0x127')){if(this[_0xd6f0('0xb2')][_0x48f192['actionid']]&&_[_0xd6f0('0xb4')](this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0x128')])&&_0x48f192[_0xd6f0('0xb6')]==='1'&&_0x48f192['paused']==='0'){if(this[_0xd6f0('0x25')][_0x48f192['stateinterface']]){if(!this[_0xd6f0('0x25')][_0x48f192['stateinterface']][_0xd6f0('0x128')]){this[_0xd6f0('0x25')][_0x48f192['stateinterface']][_0xd6f0('0x128')]=!![];this['actions'][_0x48f192['actionid']][_0xd6f0('0x128')]=!![];this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0x129')]=_0x48f192[_0xd6f0('0x129')];}}}}else if((strategy[this[_0xd6f0('0x23')][this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0xbb')]][_0xd6f0('0x4d')]]||_0xd6f0('0x1c'))===_0xd6f0('0x1c')){if(this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]]){if(this[_0xd6f0('0x25')][_0x48f192['stateinterface']]){this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]]['stateinterface']=_0x48f192[_0xd6f0('0x129')];if(_[_0xd6f0('0xb4')](this[_0xd6f0('0x12a')][this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0xbb')]])){this[_0xd6f0('0x12a')][this['actions'][_0x48f192[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]=[];}this[_0xd6f0('0x12a')][this[_0xd6f0('0xb2')][_0x48f192[_0xd6f0('0x126')]]['queue']][_0xd6f0('0x12b')](_[_0xd6f0('0x12c')](_[_0xd6f0('0xd8')](this['actions'][_0x48f192[_0xd6f0('0x126')]],[_0xd6f0('0x12d'),_0xd6f0('0x129')]),{'status':_0x48f192[_0xd6f0('0xb6')],'paused':_0x48f192['paused']}));}}}};function unlockQueueStatus(_0xc2bf9d,_0x3a76c6){setTimeout(function(){if(_[_0xd6f0('0x3d')](_0xc2bf9d[_0xd6f0('0x12e')])){loggerBooked[_0xd6f0('0x9a')](_0xd6f0('0x12f'),_0x3a76c6);}_0xc2bf9d[_0xd6f0('0x12e')]=!![];loggerBooked[_0xd6f0('0x81')](_0xd6f0('0x130'),_0x3a76c6,JSON[_0xd6f0('0x78')](_['pick'](_0xc2bf9d,['name',_0xd6f0('0x12e')])));},0x1f3);}Dialer[_0xd6f0('0x1d')][_0xd6f0('0x3a')]=function(_0x3f0b23){var _0x422cd8=this;var _0x40bbd9=_0x422cd8[_0xd6f0('0x23')][_0x422cd8[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]];if(strategy[this[_0xd6f0('0x23')][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]][_0xd6f0('0x4d')]]==='roundrobin'){if(this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]&&this['actions'][_0x3f0b23[_0xd6f0('0x126')]]['stateinterface']){this[_0xd6f0('0x22')][_0xd6f0('0x131')](this[_0xd6f0('0xb2')][_0x3f0b23['actionid']][_0xd6f0('0x12d')],this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0x129')])['catch'](function(_0x227a3f){logger[_0xd6f0('0x9a')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xd6f0('0x9c')](_0x227a3f,{'showHidden':![],'depth':null}));})[_0xd6f0('0x20')](function(){_0x422cd8[_0xd6f0('0xba')](_0x422cd8[_0xd6f0('0x23')][_0x422cd8['actions'][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]);_0x422cd8['agents'][_0x422cd8[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]['stateinterface']][_0xd6f0('0x128')]=![];delete _0x422cd8[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]];unlockQueueStatus(_0x40bbd9);});}else{this[_0xd6f0('0xba')](this[_0xd6f0('0x23')][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]);this[_0xd6f0('0xc7')]({'active':![],'ContactId':this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]['ContactId'],'ListId':this[_0xd6f0('0xb2')][_0x3f0b23['actionid']][_0xd6f0('0xda')],'VoiceQueueId':this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xff')]||undefined,'CampaignId':this['actions'][_0x3f0b23['actionid']][_0xd6f0('0xdc')]||undefined})['catch'](loggerCatch(_0xd6f0('0x132')));delete this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]];unlockQueueStatus(_0x40bbd9);}}else if((strategy[this['voiceQueues'][this['actions'][_0x3f0b23[_0xd6f0('0x126')]]['queue']][_0xd6f0('0x4d')]]||_0xd6f0('0x1c'))===_0xd6f0('0x1c')){var _0x202805;if(this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]&&!_['isEmpty'](this[_0xd6f0('0x12a')][this[_0xd6f0('0xb2')][_0x3f0b23['actionid']][_0xd6f0('0xbb')]])){if(this[_0xd6f0('0x2d')][_0x422cd8[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]){this['queueBookedRR'][_0x422cd8['actions'][_0x3f0b23[_0xd6f0('0x126')]]['queue']]=this[_0xd6f0('0x2d')][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]]['queue']]?this['queueBookedRR'][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]:this[_0xd6f0('0x12a')][this['actions'][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]]?this['queueBooked'][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]][_0xd6f0('0x133')]||0x0:0x0;}this[_0xd6f0('0x12a')][this['actions'][_0x3f0b23['actionid']][_0xd6f0('0xbb')]][_0xd6f0('0x133')]=this['queueBookedRR'][this[_0xd6f0('0xb2')][_0x3f0b23[_0xd6f0('0x126')]][_0xd6f0('0xbb')]];for(var _0x2de951=0x0;_0x2de951=0x0;})[_0xd6f0('0xb8')](myreject(_0x31f41a)));}}else{_0x7d5ab4[_0xd6f0('0x12b')](ami[_0xd6f0('0xb5')]({'action':'command','command':util[_0xd6f0('0x7a')](_0xd6f0('0x14e'),_0x323e20,!_[_0xd6f0('0x3d')](config[_0xd6f0('0x149')][_0x5350a4])?_0x5350a4:'')})['then'](function(_0x1f3b5c){return _0x1f3b5c['content'][_0xd6f0('0x151')]('true')>=0x0;})[_0xd6f0('0xb8')](myreject(_0x31f41a)));}BPromise[_0xd6f0('0x153')](_0x7d5ab4)[_0xd6f0('0xc0')](function(_0xdade07){var _0x50b6a7=_[_0xd6f0('0x154')](_0xdade07);if(_0x50b6a7){return _0x131008(_0x50b6a7);}else{_0x104ce5['message']=_0x44dca4?_0xd6f0('0x155'):_0xd6f0('0x156');return _0x31f41a(msgResponse('[ifTime][promiseAll]',_0xd6f0('0x147'),_0xd6f0('0x157')+_0x44dca4+'\x20'+_0x17ab54+_0xd6f0('0x158')+util[_0xd6f0('0x9c')](_0x323e20,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x5350a4));}})[_0xd6f0('0xb8')](function(_0x2e9d29){return _0x31f41a(msgResponse('ifTime',_0xd6f0('0x147'),JSON[_0xd6f0('0x78')](_0x2e9d29)));});});};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x159')]=function(_0x143f66){var _0x194cbd=this;return function(){switch(_0x143f66['dialMethod']){case _0xd6f0('0x15a'):freeVariablesPredictive(_0x143f66);_0x194cbd[_0xd6f0('0x15b')](_0x143f66,0x1);break;case _0xd6f0('0x15c'):freeVariablesPredictive(_0x143f66);_0x194cbd[_0xd6f0('0x15b')](_0x143f66,_0x143f66[_0xd6f0('0x15d')]);break;case _0xd6f0('0xa'):_0x194cbd[_0xd6f0('0xa')](_0x143f66);break;case _0xd6f0('0x9'):freeVariablesPredictive(_0x143f66);_0x194cbd[_0xd6f0('0x15b')](_0x143f66,0x1);break;default:freeVariablesPredictive(_0x143f66);logger[_0xd6f0('0x9a')](_0xd6f0('0x15e'),_0x143f66[_0xd6f0('0x40')],_0xd6f0('0x15f'));}};};Dialer[_0xd6f0('0x1d')]['launchHandleIvr']=function(_0x1e2489){var _0x518b14=this;return function(){_0x518b14['handleIvr'](_0x1e2489);};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x160')]=function(_0x1d004a){var _0x5ae610=this;if(isNotPreview(_0x1d004a[_0xd6f0('0x161')])){if(isVoiceQueueOutbound(_0x1d004a[_0xd6f0('0x7c')])&&isActive(_0x1d004a[_0xd6f0('0x5a')])){_0x1d004a['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xd6f0('0xc0')](checkIsLoggedIn(_0x1d004a,_0x1d004a[_0xd6f0('0x50')]))[_0xd6f0('0xc0')](checkIsActive(_0x1d004a,_0x1d004a['dialActive']))[_0xd6f0('0xc0')](checkInterval(_0x1d004a))[_0xd6f0('0xc0')](_0x5ae610['checkIsTrunkReachable'](_0x1d004a))['then'](_0x5ae610[_0xd6f0('0x143')](_0x1d004a[_0xd6f0('0x162')],_0x1d004a['dialTimezone'],_0x1d004a[_0xd6f0('0x40')],_0x1d004a))['then'](_0x5ae610[_0xd6f0('0x163')](_0x1d004a['Interval'],_0x1d004a[_0xd6f0('0x164')],_0x1d004a[_0xd6f0('0x40')],_0x1d004a))[_0xd6f0('0xc0')](_0x5ae610[_0xd6f0('0x159')](_0x1d004a))[_0xd6f0('0xb8')](loggerCatchQueueSummary(_0xd6f0('0x165'),_0x1d004a));}else{notSendMessagesQueue(_0x1d004a);}}else{freeVariablesPredictive(_0x1d004a);}};Dialer['prototype'][_0xd6f0('0x13e')]=function(){var _0x60191a=this;var _0x25d74b;for(var _0x920a62 in this[_0xd6f0('0x24')]){if(typeof this[_0xd6f0('0x24')][_0x920a62]!==_0xd6f0('0x9f')){_0x25d74b=this[_0xd6f0('0x24')][_0x920a62];if(isCampaignIvr(_0x25d74b[_0xd6f0('0x7c')])&&isActive(_0x25d74b[_0xd6f0('0x77')])){_0x25d74b[_0xd6f0('0xa8')]=!![];BPromise['resolve']()[_0xd6f0('0xc0')](checkIsActive(_0x25d74b,_0x25d74b[_0xd6f0('0x77')]))[_0xd6f0('0xc0')](checkInterval(_0x25d74b))[_0xd6f0('0xc0')](_0x60191a[_0xd6f0('0x13f')](_0x25d74b))[_0xd6f0('0xc0')](_0x60191a[_0xd6f0('0x143')](_0x25d74b['dialGlobalInterval'],_0x25d74b[_0xd6f0('0x164')],_0x25d74b['name'],_0x25d74b))[_0xd6f0('0xc0')](_0x60191a[_0xd6f0('0x163')](_0x25d74b[_0xd6f0('0x44')],_0x25d74b['dialTimezone'],_0x25d74b['name'],_0x25d74b))['then'](_0x60191a[_0xd6f0('0x166')](_0x25d74b))[_0xd6f0('0xb8')](loggerCatchQueueSummary(_0xd6f0('0x167'),_0x25d74b));}else{notSendMessagesCampaign(_0x25d74b);}}}};function getCallerIdRandom(_0x27eba0,_0x4ace28){var _0x15d8b1;var _0x1cd834;var _0x5840cd;if(_0x4ace28<=0x0){_0x4ace28=0x1;}_0x15d8b1=new RegExp(_0xd6f0('0x168')+_0x4ace28+'}$');_0x1cd834=Math[_0xd6f0('0x169')](0xa,_0x4ace28-0x1);_0x5840cd=Math[_0xd6f0('0x169')](0xa,_0x4ace28)-0x1;return util[_0xd6f0('0x7a')]('%s',_['replace'](_0x27eba0,_0x15d8b1,_[_0xd6f0('0x16a')](_0x1cd834,_0x5840cd)));}function extractCalleridName(_0x369dcf){var _0x16533b=_0x369dcf[_0xd6f0('0x16b')](/"(.*?)"/);return _0x16533b?_0x16533b[0x1]:_0x369dcf;}function extractCalleridNumber(_0x1ac07c){var _0x4e7cb4=_0x1ac07c[_0xd6f0('0x16b')](/<(.*?)>/);return _0x4e7cb4?_0x4e7cb4[0x1]:_0x1ac07c;}Dialer[_0xd6f0('0x1d')][_0xd6f0('0x16c')]=function(_0x439aca,_0x18085f){var _0x31c40c=this;var _0x945e09=uuid['v4']();this[_0xd6f0('0xb2')][_0x945e09]=new Action(_0x439aca,_0x18085f,_0x945e09);return new BPromise(function(_0x1ee291,_0x100b4d){if(_[_0xd6f0('0x3d')](_0x439aca)&&typeof _0x439aca!==_0xd6f0('0x16d')){return _0x100b4d(msgResponse(_0xd6f0('0x16e'),_0xd6f0('0x147'),'voiceQueue\x20is\x20undefine'));}if(_[_0xd6f0('0x3d')](_0x18085f[_0xd6f0('0x16f')][_0xd6f0('0x170')])||_0x18085f[_0xd6f0('0x16f')]['phone']===null){return _0x100b4d(msgResponse(_0xd6f0('0x16e'),_0xd6f0('0x147'),_0xd6f0('0x171')));}var _0x33c9a8={'XMD-CALLERID':_0x31c40c[_0xd6f0('0xb2')][_0x945e09][_0xd6f0('0x172')](),'XMD-AGI':_0x439aca[_0xd6f0('0x10a')]?util[_0xd6f0('0x7a')](_0xd6f0('0x173'),ipAgi,_0x439aca['dialQueueProject']):_0xd6f0('0x174'),'XMD-AGIAFTER':_0x439aca[_0xd6f0('0x11c')]?util['format'](_0xd6f0('0x173'),ipAgi,_0x439aca[_0xd6f0('0x11c')]):'NONE','XMD-QUEUE':_0x439aca[_0xd6f0('0x7c')]===_0xd6f0('0x4c')?util['format'](_0xd6f0('0x175'),_0x439aca['name'],_0x439aca[_0xd6f0('0x176')]||'',_0x439aca[_0xd6f0('0x113')]?'c':'',_0x439aca[_0xd6f0('0x119')]||0x3):'NONE','XMD-CONTACTID':_0x18085f[_0xd6f0('0xd9')],'XMD-CDRTYPE':_0xd6f0('0x8'),'CALLERID(all)':_0x31c40c[_0xd6f0('0xb2')][_0x945e09][_0xd6f0('0x172')](),'XMD-AMD':_0x439aca[_0xd6f0('0xe7')]?_0xd6f0('0x177'):_0xd6f0('0x174'),'XMD-DESTINATION':_0xd6f0('0xe6')};if(_0x439aca['dialAMDActive']){_0x33c9a8[_0xd6f0('0x178')]=_0x439aca[_0xd6f0('0x179')]||0x9c4;_0x33c9a8['XMD-AMDGREETING']=_0x439aca[_0xd6f0('0x17a')]||0x5dc;_0x33c9a8[_0xd6f0('0x17b')]=_0x439aca[_0xd6f0('0x17c')]||0x320;_0x33c9a8[_0xd6f0('0x17d')]=_0x439aca[_0xd6f0('0x17e')]||0x1388;_0x33c9a8[_0xd6f0('0x17f')]=_0x439aca[_0xd6f0('0x180')]||0x64;_0x33c9a8[_0xd6f0('0x181')]=_0x439aca[_0xd6f0('0x182')]||0x32;_0x33c9a8[_0xd6f0('0x183')]=_0x439aca[_0xd6f0('0x184')]||0x3;_0x33c9a8[_0xd6f0('0x185')]=_0x439aca['dialAMDSilenceThreshold']||0x100;_0x33c9a8[_0xd6f0('0x186')]=_0x439aca['dialAMDMaximumWordLength']||0x1388;}if(_0x439aca[_0xd6f0('0x7c')]===_0xd6f0('0x4c')){_0x33c9a8[_0xd6f0('0x187')]=_0x18085f[_0xd6f0('0xff')];}else{_0x33c9a8[_0xd6f0('0x188')]=_0x18085f['CampaignId'];}for(var _0x52ce04 in _0x18085f[_0xd6f0('0x16f')]){if(typeof _0x18085f[_0xd6f0('0x16f')][_0x52ce04]!==_0xd6f0('0x9f')){if(isNotNull(_0x18085f[_0xd6f0('0x16f')][_0x52ce04])&&_0x52ce04!=='id'&&_0x52ce04!==_0xd6f0('0x189')&&_0x52ce04!=='createdAt'&&_0x52ce04!==_0xd6f0('0x18a')){_0x33c9a8[util[_0xd6f0('0x7a')](_0xd6f0('0x18b'),'XMD-',_[_0xd6f0('0x18c')](_0x52ce04))]=_0x18085f[_0xd6f0('0x16f')][_0x52ce04];}}}var _0x455f9c=_0x31c40c[_0xd6f0('0xdf')](_0x439aca[_0xd6f0('0x76')])?getCallerId(_0x439aca[_0xd6f0('0x76')]['callerid'],_0x439aca['dialOriginateCallerIdName'],_0x439aca[_0xd6f0('0x18d')]>0x0?getCallerIdRandom(_0x439aca[_0xd6f0('0x5c')],_0x439aca['dialRandomLastDigitCallerIdNumber']):_0x439aca['dialOriginateCallerIdNumber']):getCallerId(_[_0xd6f0('0xb4')](_0x439aca[_0xd6f0('0x140')])?_0x439aca[_0xd6f0('0x76')]['callerid']:_0x439aca[_0xd6f0('0x140')]['callerid'],_0x439aca[_0xd6f0('0x5b')],_0x439aca['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x439aca['dialOriginateCallerIdNumber'],_0x439aca[_0xd6f0('0x18d')]):_0x439aca['dialOriginateCallerIdNumber']);if(_0x455f9c){_0x33c9a8[_0xd6f0('0x18e')]=_0x31c40c[_0xd6f0('0xb2')][_0x945e09][_0xd6f0('0x18f')]=extractCalleridName(_0x455f9c);_0x33c9a8[_0xd6f0('0x190')]=_0x31c40c[_0xd6f0('0xb2')][_0x945e09]['originatecalleridnum']=extractCalleridNumber(_0x455f9c);}return ami['Action']({'actionid':_0x945e09,'action':_0xd6f0('0x16e'),'channel':_0x31c40c[_0xd6f0('0xdf')](_0x439aca[_0xd6f0('0x76')])?util[_0xd6f0('0x7a')]('SIP/%s/%s%s',_0x439aca[_0xd6f0('0x76')]['name'],isNotNull(_0x439aca['dialPrefix'])?_0x439aca[_0xd6f0('0x191')][_0xd6f0('0x192')]()||'':'',_0x439aca[_0xd6f0('0x193')]>0x0?_0x18085f[_0xd6f0('0x16f')]['phone'][_0xd6f0('0x194')](_0x439aca[_0xd6f0('0x193')]):_0x18085f[_0xd6f0('0x16f')][_0xd6f0('0x170')]):util['format'](_0xd6f0('0x195'),_['isNil'](_0x439aca[_0xd6f0('0x140')])?_0x439aca['Trunk']['name']:_0x439aca[_0xd6f0('0x140')][_0xd6f0('0x40')],isNotNull(_0x439aca['dialPrefix'])?_0x439aca[_0xd6f0('0x191')]['trim']()||'':'',_0x439aca['dialCutDigit']>0x0?_0x18085f['Contact']['phone'][_0xd6f0('0x194')](_0x439aca[_0xd6f0('0x193')]):_0x18085f[_0xd6f0('0x16f')][_0xd6f0('0x170')]),'callerid':_0x455f9c,'Exten':_0xd6f0('0xe6'),'Context':_0xd6f0('0x196'),'Priority':'1','variable':_0x33c9a8,'timeout':(_0x439aca[_0xd6f0('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x945e09})[_0xd6f0('0xc0')](function(_0x58b12b){return _0x1ee291(_0x58b12b);})['catch'](function(_0x5af027){_0x439aca['outboundOriginateFailureCallsDay']+=0x1;var _0x58a848=new History(_0x31c40c[_0xd6f0('0xb2')][_0x945e09]);logger[_0xd6f0('0x9a')](util[_0xd6f0('0x7a')]('[originateError]:\x20%s',JSON[_0xd6f0('0x78')](_0x5af027)));_0x58a848[_0xd6f0('0xac')]=0xe;_0x58a848[_0xd6f0('0xad')]='OriginateError';_0x58a848[_0xd6f0('0xaf')]=moment()[_0xd6f0('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x58a848[_0xd6f0('0xae')]=_0x58a848['starttime'];_0x31c40c[_0xd6f0('0xd3')](_0x58a848)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x197')));_0x31c40c[_0xd6f0('0xd1')](_0x58a848)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x197')))[_0xd6f0('0x20')](function(){delete _0x31c40c[_0xd6f0('0xb2')][_0x945e09];return _0x100b4d(msgResponse(_0xd6f0('0x16e'),_0xd6f0('0x48'),_0xd6f0('0x198')));});});});};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x31')]=function(_0x55f6b1){var _0x1aa29d=this[_0xd6f0('0xb2')][_0x55f6b1[_0xd6f0('0x126')]];if(_0x1aa29d){delete this[_0xd6f0('0xb2')][_0x55f6b1[_0xd6f0('0x126')]];_0x1aa29d[_0xd6f0('0x199')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));var _0x565bca=_0x1aa29d[_0xd6f0('0x7c')]===_0xd6f0('0x7d')?this[_0xd6f0('0x24')][_0x1aa29d[_0xd6f0('0xbb')]]:this[_0xd6f0('0x23')][_0x1aa29d[_0xd6f0('0x19a')]()];if(!this['isSuccess'](_0x55f6b1[_0xd6f0('0x19b')])){this['updateOriginated'](_0x565bca);return this[_0xd6f0('0x19c')](_0x1aa29d,_0x565bca,_0x55f6b1)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x19d')));}this['uniqueId'][_0x55f6b1[_0xd6f0('0xe3')]]=_0x1aa29d;}};Dialer[_0xd6f0('0x1d')]['checkRetriveMax']=function(_0x129f95,_0x22afa5,_0x56133d){var _0x2e26d8=new History(_0x22afa5);if(_0x2e26d8[_0xd6f0('0xf4')]+_0x2e26d8['countcongestionretry']+_0x2e26d8[_0xd6f0('0x104')]+_0x2e26d8[_0xd6f0('0xf6')]+_0x2e26d8[_0xd6f0('0x105')]+_0x2e26d8[_0xd6f0('0xf7')]+_0x2e26d8[_0xd6f0('0xf1')]+_0x2e26d8[_0xd6f0('0x106')]>=_0x56133d[_0xd6f0('0xf8')]-0x1){return!![];}switch(_0x129f95){case 0x3:if(_0x2e26d8['countnoanswerretry']>=_0x56133d['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x2e26d8[_0xd6f0('0x104')]+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x19e')],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8['ContactId'],'ListId':_0x2e26d8['ListId'],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})['catch'](loggerCatch(_0xd6f0('0x19f')));break;case 0x5:if(_0x2e26d8['countbusyretry']>=_0x56133d[_0xd6f0('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x2e26d8[_0xd6f0('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x56133d['dialBusyRetryFrequency'],_0xd6f0('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e26d8['ContactId'],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})['catch'](loggerCatch(_0xd6f0('0x1a1')));break;case 0x8:if(_0x2e26d8[_0xd6f0('0xf5')]>=_0x56133d['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x2e26d8[_0xd6f0('0xf5')]+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x1a2')],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8['VoiceQueueId']||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1a3')));break;case 0x0:if(_0x2e26d8['countnosuchnumberretry']>=_0x56133d[_0xd6f0('0x1a4')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x2e26d8[_0xd6f0('0xf6')]+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x1a5')],'minutes')[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8['CampaignId']||undefined})['catch'](loggerCatch(_0xd6f0('0x1a6')));}break;case 0xa:if(_0x2e26d8[_0xd6f0('0x105')]>=_0x56133d['dialDropMaxRetry']-0x1){return!![];}this[_0xd6f0('0xc7')]({'active':![],'countdropretry':_0x2e26d8['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x56133d['dialDropRetryFrequency'],_0xd6f0('0xfd'))[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8['CampaignId']||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1a7')));break;case 0xb:if(_0x2e26d8[_0xd6f0('0xf7')]>=_0x56133d[_0xd6f0('0x123')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x2e26d8['countabandonedretry']+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x124')],'minutes')[_0xd6f0('0x7a')](_0xd6f0('0xfe')),'ContactId':_0x2e26d8['ContactId'],'ListId':_0x2e26d8['ListId'],'VoiceQueueId':_0x2e26d8['VoiceQueueId']||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1a8')));break;case 0x13:if(_0x2e26d8[_0xd6f0('0xf1')]>=_0x56133d['dialMachineMaxRetry']-0x1){return!![];}this[_0xd6f0('0xc7')]({'active':![],'countmachineretry':_0x2e26d8[_0xd6f0('0xf1')]+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d['dialMachineRetryFrequency'],_0xd6f0('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8[_0xd6f0('0xda')],'VoiceQueueId':_0x2e26d8[_0xd6f0('0xff')]||undefined,'CampaignId':_0x2e26d8['CampaignId']||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x100')));break;case 0x14:if(_0x2e26d8[_0xd6f0('0x106')]>=_0x56133d[_0xd6f0('0x1a9')]-0x1){return!![];}this[_0xd6f0('0xc7')]({'active':![],'countagentrejectretry':_0x2e26d8['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xd6f0('0xfc')](_0x56133d[_0xd6f0('0x1aa')],_0xd6f0('0xfd'))['format'](_0xd6f0('0xfe')),'ContactId':_0x2e26d8[_0xd6f0('0xd9')],'ListId':_0x2e26d8['ListId'],'VoiceQueueId':_0x2e26d8['VoiceQueueId']||undefined,'CampaignId':_0x2e26d8[_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1ab')));break;default:return!![];}};Dialer[_0xd6f0('0x1d')]['callProgressDetecting']=function(_0x9bc9c1,_0xd12f50,_0xea0635){var _0x402900=this;var _0x172e8a=new History(_0x9bc9c1);return new BPromise(function(_0x19a51c,_0x31b16d){if(_['isUndefined'](_0xd12f50)&&typeof _0xd12f50!=='object'){return _0x31b16d(msgResponse(_0xd6f0('0x1ac'),'Failure','entity\x20is\x20undefine'));}if(_[_0xd6f0('0x3d')](_0xea0635)&&typeof _0xea0635!=='object'){return _0x31b16d(msgResponse('[callProgressDetecting]',_0xd6f0('0x147'),_0xd6f0('0x1ad')));}switch(_0xea0635[_0xd6f0('0x110')]){case'0':_0xd12f50['outboundNoSuchCallsDay']+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x0;_0x172e8a[_0xd6f0('0xad')]=_0xd6f0('0x1ae');_0x172e8a[_0xd6f0('0xf6')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')](_0xd6f0('0x1af'),ut[_0xd6f0('0xed')](_0x9bc9c1,_0xd6f0('0x1b0')));_0x402900[_0xd6f0('0xd3')](_0x172e8a)['catch'](loggerCatch(_0xd6f0('0xf3')));if(_0x402900[_0xd6f0('0x1b1')](0x0,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0xf6')]>=_0xd12f50[_0xd6f0('0x1a4')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1b2'));}else{_0x402900['stateGlobal'](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1b2'));}}break;case'3':_0xd12f50[_0xd6f0('0x63')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x3;_0x172e8a[_0xd6f0('0xad')]=_0xd6f0('0x1b3');_0x172e8a[_0xd6f0('0x104')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')]('custom:agentnoanswer',ut['buildObj'](_0x9bc9c1,_0xd6f0('0x1b4')));_0x402900[_0xd6f0('0xd3')](_0x172e8a)['catch'](loggerCatch(_0xd6f0('0x1b5')));if(_0x402900[_0xd6f0('0x1b1')](0x3,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0x104')]>=_0xd12f50[_0xd6f0('0x1b6')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1b7'));}else{_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1b7'));}}break;case'5':_0xd12f50[_0xd6f0('0x1b8')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x5;_0x172e8a['statedesc']=_0xd6f0('0x1b9');_0x172e8a[_0xd6f0('0xf4')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')](_0xd6f0('0x1ba'),ut[_0xd6f0('0xed')](_0x9bc9c1,_0xd6f0('0x1bb')));_0x402900[_0xd6f0('0xd3')](_0x172e8a)['catch'](loggerCatch(_0xd6f0('0x1bc')));if(_0x402900[_0xd6f0('0x1b1')](0x5,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0xf4')]>=_0xd12f50[_0xd6f0('0x1a0')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1bd'));}else{_0x402900['stateGlobal'](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1bd'));}}break;case'8':_0xd12f50[_0xd6f0('0x60')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x8;_0x172e8a[_0xd6f0('0xad')]=_0xd6f0('0x1be');_0x172e8a[_0xd6f0('0xf5')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')](_0xd6f0('0x1bf'),ut['buildObj'](_0x9bc9c1,_0xd6f0('0x1c0')));_0x402900['createHistory'](_0x172e8a)[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1c1')));if(_0x402900['checkRetriveMax'](0x8,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0xf5')]>=_0xd12f50[_0xd6f0('0x1c2')]){_0x402900['createStateFinal'](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c3'));}else{_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c3'));}}break;case'11':_0xd12f50[_0xd6f0('0x1c4')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0xb;_0x172e8a[_0xd6f0('0xad')]=_0xd6f0('0x121');_0x172e8a['countabandonedretry']+=0x1;_0x172e8a['countglobal']+=0x1;_0x402900[_0xd6f0('0xd3')](_0x172e8a)['catch'](loggerCatch(_0xd6f0('0x125')));if(_0x402900[_0xd6f0('0x1b1')](0xb,_0x9bc9c1,_0xd12f50)){if(_0x172e8a[_0xd6f0('0xf7')]>=_0xd12f50[_0xd6f0('0x123')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,'reason\x2011\x20abandoned');}else{_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c5'));}}break;case'20':_0xd12f50[_0xd6f0('0x66')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0x14;_0x172e8a['statedesc']='AgentReject';_0x172e8a[_0xd6f0('0x106')]+=0x1;_0x172e8a[_0xd6f0('0xf2')]+=0x1;ami[_0xd6f0('0x4b')](_0xd6f0('0x1c6'),ut['buildObj'](_0x9bc9c1,'agentreject'));_0x402900[_0xd6f0('0xd3')](_0x172e8a)[_0xd6f0('0xb8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x402900[_0xd6f0('0x1b1')](0x14,_0x9bc9c1,_0xd12f50)){if(_0x172e8a['countagentrejectretry']>=_0xd12f50[_0xd6f0('0x1a9')]){_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c7'));}else{_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xd6f0('0x1c7'));}}break;default:_0xd12f50[_0xd6f0('0x67')]+=0x1;_0x172e8a[_0xd6f0('0xac')]=0xc;_0x172e8a['statedesc']=_0xea0635[_0xd6f0('0x110')];_0x402900[_0xd6f0('0xd3')](_0x172e8a)[_0xd6f0('0xb8')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x402900[_0xd6f0('0x1b1')](_0xea0635[_0xd6f0('0x110')],_0x9bc9c1,_0xd12f50)){if(_0x172e8a['countbusyretry']+_0x172e8a[_0xd6f0('0xf5')]+_0x172e8a[_0xd6f0('0x104')]+_0x172e8a[_0xd6f0('0xf6')]+_0x172e8a[_0xd6f0('0x105')]+_0x172e8a[_0xd6f0('0xf7')]+_0x172e8a['countmachineretry']+_0x172e8a[_0xd6f0('0x106')]>=_0xd12f50['dialGlobalMaxRetry']){_0x402900[_0xd6f0('0xf9')](_0x172e8a,_0x19a51c,_0x31b16d,_0xea0635[_0xd6f0('0x110')]);}else{_0x402900[_0xd6f0('0xfa')](_0x172e8a,_0x19a51c,_0x31b16d,_0xea0635[_0xd6f0('0x110')]);}}}});};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xf9')]=function(_0x2e90ec,_0x4e9df5,_0x510f8d,_0x25e297){var _0x50e1ef=new Final(_0x2e90ec);_0x50e1ef[_0xd6f0('0xac')]=0xf;_0x50e1ef[_0xd6f0('0xad')]=_0xd6f0('0x1c8');this[_0xd6f0('0xfa')](_0x50e1ef,_0x4e9df5,_0x510f8d,_0x25e297);};Dialer[_0xd6f0('0x1d')][_0xd6f0('0xfa')]=function(_0x367791,_0x388dd0,_0x4ee4d1,_0x1679ae){this[_0xd6f0('0xd1')](_0x367791)[_0xd6f0('0xc0')](function(){return _0x388dd0(msgResponse(_0xd6f0('0x1ac'),_0xd6f0('0xde'),_0x1679ae));})[_0xd6f0('0xb8')](function(){return _0x4ee4d1(msgResponse('[moveContactManagedDialer][0]','Failure',_0xd6f0('0x1c9')));});};Dialer['prototype'][_0xd6f0('0xa')]=function(_0x4cd339){var _0x51de1f=_0x4cd339[_0xd6f0('0x1ca')]/0x64;var _0x3c541d=_0x4cd339[_0xd6f0('0x11a')]/(_0x4cd339['outboundDropCallsDayTimeout']+_0x4cd339[_0xd6f0('0x5f')]);var _0x1e59ba=Math['round'](_0x4cd339[_0xd6f0('0x1cb')]*(_0x4cd339[_0xd6f0('0x1cc')]/0x64));var _0x1b9a30=Math[_0xd6f0('0x1cd')](_0x4cd339[_0xd6f0('0x1cb')]*(_0x4cd339[_0xd6f0('0x1ce')]/0x64));var _0x498ac8=_0x4cd339[_0xd6f0('0x4f')]+_0x4cd339[_0xd6f0('0x54')];var _0x212f18=Math[_0xd6f0('0x1cf')](_0x4cd339[_0xd6f0('0x72')]*_0x4cd339[_0xd6f0('0x74')]*_0x4cd339['predictiveIntervalHitRate']*_0x4cd339[_0xd6f0('0x6f')]);if(_[_0xd6f0('0x3d')](_0x4cd339['startProgressive'])){if(!_['isUndefined'](_0x4cd339[_0xd6f0('0x93')])){_0x4cd339[_0xd6f0('0x93')]=undefined;loggerPredictive[_0xd6f0('0x9a')](_0xd6f0('0x1d0'),_0xd6f0('0x1d1'));}if(!_['isUndefined'](_0x4cd339[_0xd6f0('0x95')])){loggerPredictive['error'](_0xd6f0('0x1d0'),_0xd6f0('0x1d2'));clearInterval(_0x4cd339['handlePredictive']);_0x4cd339[_0xd6f0('0x95')]=undefined;}_0x4cd339[_0xd6f0('0x2b')]=moment()[_0xd6f0('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xd6f0('0x81')](_0x4cd339[_0xd6f0('0x40')],_0xd6f0('0x1d3'),_0x4cd339[_0xd6f0('0x2b')]);this[_0xd6f0('0x15b')](_0x4cd339,0x1);}else if(ifInterval(_0x4cd339[_0xd6f0('0x1d4')],_0x4cd339['startProgressive'])){this[_0xd6f0('0x15b')](_0x4cd339,0x1);loggerPredictiveCalls[_0xd6f0('0x81')](_0xd6f0('0x1d5'),_0x4cd339[_0xd6f0('0x2b')],_0x4cd339['name']);_0x4cd339[_0xd6f0('0x72')]=0x0;_0x4cd339['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x51de1f<_0x3c541d&&_0x4cd339[_0xd6f0('0x1d6')]===_0xd6f0('0x1d7')){freeVariablesPredictive(_0x4cd339);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x1d8'),'Dropped\x20calls\x20day',_0x3c541d,'startProgressive',_0x4cd339[_0xd6f0('0x40')]);}else if(_0x212f18<_0x4cd339['predictiveIntervalErlangCallsDroppedCalls']&&_0x4cd339[_0xd6f0('0x1d6')]===_0xd6f0('0x1d7')){freeVariablesPredictive(_0x4cd339);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x1d9'),_0xd6f0('0x1da'),_0x212f18,'Drop\x20in\x20this\x20interval',_0x4cd339[_0xd6f0('0x6d')],_0xd6f0('0x2b'),_0x4cd339[_0xd6f0('0x40')]);}else if(!ifInterval(_0x4cd339[_0xd6f0('0x1d4')],_0x4cd339[_0xd6f0('0x2b')])&&_[_0xd6f0('0x3d')](_0x4cd339[_0xd6f0('0x93')])&&!_[_0xd6f0('0x3d')](_0x4cd339[_0xd6f0('0x2b')])){_0x4cd339[_0xd6f0('0x93')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));loggerPredictive[_0xd6f0('0x81')](_0x4cd339[_0xd6f0('0x40')],_0xd6f0('0x1db'),_0x4cd339[_0xd6f0('0x93')]);this['averageHandleTime'](_0x4cd339[_0xd6f0('0x1d4')])['then'](this[_0xd6f0('0x1dc')](_0x4cd339))['then'](mergeDataErlangB(_0x4cd339))['then'](this[_0xd6f0('0x1dd')](_0x4cd339))[_0xd6f0('0xb8')](loggerCatchPredictive(_0xd6f0('0x1de'),_0x4cd339));}else if(!ifInterval(_0x4cd339[_0xd6f0('0x1d4')],_0x4cd339[_0xd6f0('0x93')])){_0x4cd339[_0xd6f0('0x6d')]=0x0;_0x4cd339[_0xd6f0('0x93')]=moment()[_0xd6f0('0x7a')](_0xd6f0('0xfe'));loggerPredictive['info'](_0x4cd339['name'],_0xd6f0('0x1df'),_0x4cd339[_0xd6f0('0x93')]);clearInterval(_0x4cd339['handlePredictive']);_0x4cd339[_0xd6f0('0x95')]=undefined;this['averageHandleTime'](_0x4cd339[_0xd6f0('0x1d4')])['then'](this['getDataPredictive'](_0x4cd339))[_0xd6f0('0xc0')](mergeDataErlangB(_0x4cd339))[_0xd6f0('0xc0')](this['startMethodPredictive'](_0x4cd339))[_0xd6f0('0xb8')](loggerCatchPredictive(_0xd6f0('0x1e0'),_0x4cd339));}else if(_0x4cd339['predictiveIntervalAvailable']&&_0x498ac8<_0x4cd339[_0xd6f0('0x1cb')]-_0x1b9a30){freeVariablesPredictive(_0x4cd339);loggerPredictive[_0xd6f0('0x81')](_0x4cd339['name'],_0xd6f0('0x1e1'),_0x498ac8,_0xd6f0('0x1e2'),_0x4cd339[_0xd6f0('0x1cb')],'-',_0x1b9a30,'=',_0x4cd339[_0xd6f0('0x1cb')]-_0x1b9a30,')');}else if(_0x4cd339[_0xd6f0('0x1cb')]&&_0x498ac8>_0x4cd339[_0xd6f0('0x1cb')]+_0x1e59ba){freeVariablesPredictive(_0x4cd339);loggerPredictive['info'](_0x4cd339['name'],_0xd6f0('0x1e1'),_0x498ac8,_0xd6f0('0x1e3'),_0x4cd339[_0xd6f0('0x1cb')],'+',_0x1e59ba,'=',_0x4cd339[_0xd6f0('0x1cb')]+_0x1e59ba,')');}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x1dc')]=function(_0x53eb93){var _0x386dc2=this;return function(_0x1f9774){return new BPromise(function(_0x278c16,_0x460bd5){_[_0xd6f0('0x12c')](_0x53eb93,_0x1f9774[0x0]);if(checkGetDataPredictive(_0x1f9774[0x0])){var _0x1ad377=_0x53eb93[_0xd6f0('0x1cb')]=_0x53eb93['talking']+_0x53eb93[_0xd6f0('0x4f')];var _0x14f925=_0x53eb93[_0xd6f0('0x1d4')]*0x3c;var _0x48235b=_0x1f9774[0x0][_0xd6f0('0x69')]+_0x1f9774[0x0]['predictiveIntervalAvgHoldtime'];var _0x54b755=(_0x1f9774[0x0][_0xd6f0('0x68')]+_0x1f9774[0x0][_0xd6f0('0x6b')]+_0x1f9774[0x0][_0xd6f0('0x6a')])/_0x1f9774[0x0][_0xd6f0('0x71')];_0x53eb93['predictiveIntervalHitRate']=_0x54b755>0x0?_0x54b755:0x1;switch(_0x53eb93[_0xd6f0('0x1d6')]){case _0xd6f0('0x1d7'):var _0x515257=_0x53eb93[_0xd6f0('0x1ca')]/0x64;return _0x386dc2[_0xd6f0('0x1e4')](_0x1ad377,_0x14f925,_0x48235b,_0x54b755,_0x515257)['then'](function(_0x2c48a6){return _0x278c16(_0x2c48a6);});case _0xd6f0('0x1e5'):var _0x663471=_0x53eb93[_0xd6f0('0x1ca')]/0x64;return _0x386dc2[_0xd6f0('0x1e6')](_0x1ad377,_0x14f925,_0x48235b,_0x54b755,_0x663471)[_0xd6f0('0xc0')](function(_0x2e0294){return _0x278c16(_0x2e0294);});default:return _0x460bd5(msgResponse(_0xd6f0('0x1e7'),_0xd6f0('0x147'),'Unknown\x20Predictive'));}}else{return _0x460bd5(msgResponse(_0xd6f0('0x1e7'),_0xd6f0('0x147'),_0xd6f0('0x1e8')));}});};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x1e9')]=function(_0x8a4988){var _0x454dd5=this;return function(_0x245549){return new BPromise(function(_0x41ec2d,_0x7d0081){_[_0xd6f0('0x12c')](_0x8a4988,_0x245549[0x0]);if(checkGetDataPredictive(_0x245549[0x0])){loggerPredictive[_0xd6f0('0x81')](JSON[_0xd6f0('0x78')](_0x245549[0x0]));if(_0x8a4988[_0xd6f0('0x1d6')]===_0xd6f0('0x1d7')){return _0x454dd5[_0xd6f0('0xcf')](_0x8a4988['id'])[_0xd6f0('0xc0')](function(_0x1c743c){var _0x670494=_0x8a4988[_0xd6f0('0x50')]-_0x1c743c[0x0][_0xd6f0('0x1ea')];var _0x4d9328=_0x8a4988[_0xd6f0('0x1d4')]*0x3c;var _0x2aafb4=_0x245549[0x0][_0xd6f0('0x69')]+_0x245549[0x0][_0xd6f0('0x88')];var _0x1846e9=(_0x245549[0x0][_0xd6f0('0x68')]+_0x245549[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x245549[0x0][_0xd6f0('0x6a')])/_0x245549[0x0]['predictiveIntervalTotalCalls'];var _0x12db26=_0x8a4988[_0xd6f0('0x1ca')]/0x64;_0x8a4988['predictiveIntervalPauses']=_0x1c743c[0x0][_0xd6f0('0x1ea')]||0x0;_0x8a4988[_0xd6f0('0x6e')]=_0x1846e9>0x0?_0x1846e9:0x1;return _0x454dd5['abandonmentRate'](_0x670494,_0x4d9328,_0x2aafb4,_0x1846e9,_0x12db26);})[_0xd6f0('0xc0')](function(_0x14beff){return _0x41ec2d(_0x14beff);})[_0xd6f0('0xb8')](function(_0x53afb0){return _0x7d0081(msgResponse(_0xd6f0('0x1eb'),_0xd6f0('0x147'),JSON[_0xd6f0('0x78')](_0x53afb0)));});}if(_0x8a4988['dialPredictiveOptimization']==='agentBusyFactor'){return _0x454dd5[_0xd6f0('0xcf')](_0x8a4988['id'])[_0xd6f0('0xc0')](function(_0x3a8562){var _0x332117=_0x8a4988[_0xd6f0('0x50')]-_0x3a8562[0x0][_0xd6f0('0x1ea')];var _0x33ca87=_0x8a4988['dialPredictiveInterval']*0x3c;var _0x44329e=_0x245549[0x0][_0xd6f0('0x69')]+_0x245549[0x0][_0xd6f0('0x88')];var _0x558955=(_0x245549[0x0][_0xd6f0('0x68')]+_0x245549[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x245549[0x0][_0xd6f0('0x6a')])/_0x245549[0x0][_0xd6f0('0x71')];var _0x2bf94b=_0x8a4988[_0xd6f0('0x1ca')]/0x64;_0x8a4988[_0xd6f0('0x70')]=_0x3a8562[0x0][_0xd6f0('0x1ea')]||0x0;_0x8a4988[_0xd6f0('0x6e')]=_0x558955>0x0?_0x558955:0x1;return _0x454dd5[_0xd6f0('0x1e6')](_0x332117,_0x33ca87,_0x44329e,_0x558955,_0x2bf94b);})[_0xd6f0('0xc0')](function(_0x8941e2){return _0x41ec2d(_0x8941e2);})[_0xd6f0('0xb8')](function(_0x50fd01){return _0x7d0081(msgResponse('[CatchErlangB]',_0xd6f0('0x147'),JSON[_0xd6f0('0x78')](_0x50fd01)));});}}else{return _0x7d0081(msgResponse(_0xd6f0('0x1e7'),_0xd6f0('0x147'),_0xd6f0('0x1e8')));}});};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x1dd')]=function(_0x1d0f6c){var _0xcf9328=this;return function(){var _0x437523=0x0;var _0x181e90=Math[_0xd6f0('0x1cf')](_0x1d0f6c[_0xd6f0('0x73')]*0x3e8);if(_0x181e90>0x0){_0x181e90=_0x181e90<0x64?0x64:_0x181e90;loggerPredictive[_0xd6f0('0x81')](_0x1d0f6c[_0xd6f0('0x40')],_0xd6f0('0x1ec'),_0x181e90,_0xd6f0('0x49'));_0x1d0f6c[_0xd6f0('0x95')]=setInterval(function(){_0xcf9328['handlePredictive'](_0x1d0f6c);loggerPredictiveCalls[_0xd6f0('0x81')]('[handlePredictive]',_0x437523+=0x1);},_0x181e90);}else{loggerPredictive[_0xd6f0('0x81')](_0x1d0f6c[_0xd6f0('0x40')],_0xd6f0('0x1ed'));}};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x1ee')]=function(_0xcad5a3,_0x55011b){var _0x1fe44d=this;return function(_0x172397){if(_[_0xd6f0('0x80')](_0x172397)){if(_[_0xd6f0('0xb4')](_0x55011b['UserId'])||!_0x55011b[_0xd6f0('0x1ef')]){if(_0xcad5a3[_0xd6f0('0x161')]==='booked'){_0xcad5a3[_0xd6f0('0x12e')]=_['isUndefined'](_0xcad5a3['queueStatusComplete'])?!![]:_0xcad5a3['queueStatusComplete'];var _0x4532e5=uuid['v4']();_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5]=new Action(_0xcad5a3,_0x55011b,_0x4532e5);loggerBooked[_0xd6f0('0x81')](_0xd6f0('0x1f0'),_0x4532e5,_0xd6f0('0x1f1'),JSON[_0xd6f0('0x78')](_0xcad5a3['queueStatusComplete']),'Queue:\x20',_0xcad5a3[_0xd6f0('0x40')]);if(_0xcad5a3['queueStatusComplete']){_0xcad5a3[_0xd6f0('0x12e')]=![];_0x1fe44d[_0xd6f0('0x12a')][_0x1fe44d['actions'][_0x4532e5]['queue']]=[];ami['Action']({'actionid':_0x4532e5,'action':'queuestatus','queue':_0xcad5a3['name']})[_0xd6f0('0xb8')](function(){_0x1fe44d['updateOriginated'](_0xcad5a3);_0x1fe44d[_0xd6f0('0xc7')]({'active':![],'ContactId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5]['ContactId'],'ListId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xda')],'VoiceQueueId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xff')]||undefined,'CampaignId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xdc')]||undefined})['catch'](loggerCatch(_0xd6f0('0x1f2')));delete _0x1fe44d[_0xd6f0('0xb2')][_0x4532e5];});}else{loggerBooked['info'](_0xd6f0('0x1f3'),JSON[_0xd6f0('0x78')](_0xcad5a3['queueStatusComplete']),'Queue:\x20',_0xcad5a3[_0xd6f0('0x40')]);_0x1fe44d[_0xd6f0('0xba')](_0xcad5a3);_0x1fe44d[_0xd6f0('0xc7')]({'active':![],'ContactId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5]['ContactId'],'ListId':_0x1fe44d['actions'][_0x4532e5][_0xd6f0('0xda')],'VoiceQueueId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xff')]||undefined,'CampaignId':_0x1fe44d[_0xd6f0('0xb2')][_0x4532e5][_0xd6f0('0xdc')]||undefined})[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1f2')));delete _0x1fe44d['actions'][_0x4532e5];}}else{return _0x1fe44d[_0xd6f0('0x16c')](_0xcad5a3,_0x55011b);}}else{if(getDiff(_0x55011b[_0xd6f0('0x1f4')])<_0xcad5a3[_0xd6f0('0x1f5')]*0x3c){if(_0x55011b[_0xd6f0('0x1f6')]&&!_0x55011b[_0xd6f0('0x1f6')][_0xd6f0('0x1f7')]){_0x1fe44d[_0xd6f0('0x22')]['run'](_0x55011b['id'])[_0xd6f0('0x20')](function(){_0x1fe44d['updateOriginated'](_0xcad5a3);});}else{_0x1fe44d['unlockContact']({'active':![]},_0x55011b['id'],0x1)[_0xd6f0('0x20')](function(){_0x1fe44d[_0xd6f0('0xba')](_0xcad5a3);});}}else{_0xcad5a3['outboundReCallsDay']+=0x1;_0x1fe44d['updateOriginated'](_0xcad5a3);if(_0xcad5a3[_0xd6f0('0x1f8')]){_0x1fe44d[_0xd6f0('0xc7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x55011b[_0xd6f0('0xd9')],'ListId':_0x55011b[_0xd6f0('0xda')],'VoiceQueueId':_0x55011b[_0xd6f0('0xff')]||undefined,'CampaignId':_0x55011b['CampaignId']||undefined})[_0xd6f0('0xb8')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x1fe44d[_0xd6f0('0xd3')](createObjHistory(_0xcad5a3,_0x55011b,'RECALLINQUEUE',0x17,_0xd6f0('0x1f9')))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0x1fa')));}else{_0x1fe44d[_0xd6f0('0xd7')](createObjHistory(_0xcad5a3,_0x55011b,'RECALLFAILEDTIMEOUT',0x16,_0xd6f0('0x1fb')),_0xd6f0('0x1fc'),_0xd6f0('0x1fd'));}}}}else{_0xcad5a3['outboundBlacklistCallsDay']+=0x1;_0x1fe44d['saveInDb'](createObjHistory(_0xcad5a3,_0x55011b,'BLACKLIST',0xd,'Blacklist'),_0xd6f0('0x1fe'),_0xd6f0('0x1ff'));throw _0xd6f0('0x200');}};};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x201')]=function(_0x430416){var _0x35edfe=this;var _0x1bc35b=_0x430416[_0xd6f0('0x202')]-_0x430416[_0xd6f0('0x9e')]-_0x430416[_0xd6f0('0xcc')];emitCampaignSummary(_0x430416);if(_0x1bc35b>0x0){if(_0x1bc35b>this[_0xd6f0('0x27')]){_0x1bc35b=this['maxNumberOriginate'];}_0x430416[_0xd6f0('0xcc')]+=_0x1bc35b;this[_0xd6f0('0xcd')](_0x430416['id'],_0x1bc35b,_0x430416[_0xd6f0('0x203')],_0x430416)[_0xd6f0('0xc0')](function(_0x54d973){_0x430416[_0xd6f0('0xcc')]-=_0x1bc35b;_0x430416[_0xd6f0('0xcc')]=_0x430416[_0xd6f0('0xcc')]>0x0?_0x430416['temp']:0x0;if(!checkContactEmpty(_0x54d973)){_0x430416[_0xd6f0('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xd6f0('0x81')]('[getContactCampaign2][Empty]'+_0x430416[_0xd6f0('0x40')]);}else{_0x430416[_0xd6f0('0x9e')]+=_0x54d973[_0xd6f0('0x9d')];_0x430416['message']=_0xd6f0('0x204');for(var _0x55d512=0x0;_0x55d512<_0x54d973[_0xd6f0('0x9d')];_0x55d512+=0x1){_0x430416[_0xd6f0('0x205')]+=0x1;if(_[_0xd6f0('0xb4')](_0x54d973[_0x55d512])||_['isNil'](_0x54d973[_0x55d512][_0xd6f0('0x16f')])||_[_0xd6f0('0xb4')](_0x54d973[_0x55d512][_0xd6f0('0x16f')][_0xd6f0('0x170')])){_0x35edfe['emptyContact'](_0xd6f0('0x206'),_0x430416,_0x54d973[_0x55d512]);}else{_0x35edfe[_0xd6f0('0xc4')](_[_0xd6f0('0xd8')](_0x54d973[_0x55d512],[_0xd6f0('0xdc'),'Contact.phone']))['then'](_0x35edfe[_0xd6f0('0x1ee')](_0x430416,_0x54d973[_0x55d512]))[_0xd6f0('0xb8')](_0x35edfe[_0xd6f0('0xd5')]('[actionOriginateIvr]\x20',_0x430416));}}}})[_0xd6f0('0xb8')](loggerGetContactDialer(_0xd6f0('0x207'),_0x430416,_0x1bc35b));}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x15b')]=function(_0x1e27b9,_0x28de3a){var _0x2d1c6f=this;var _0x4e2992=[];var _0x250cb9=_0x28de3a>=0x1?_0x28de3a:0x1;if(_0x1e27b9[_0xd6f0('0x161')]===_0xd6f0('0x9')){_0x250cb9=0x1;}var _0x3963cb=Math[_0xd6f0('0x1cf')](_0x1e27b9[_0xd6f0('0x4f')]*_0x250cb9)-_0x1e27b9[_0xd6f0('0x9e')]-_0x1e27b9[_0xd6f0('0xcc')];emitVoiceQueueSummary(_0x1e27b9);if(_0x1e27b9[_0xd6f0('0x208')]>0x0){var _0x2bbf7f=_0x1e27b9[_0xd6f0('0x208')]-_0x1e27b9[_0xd6f0('0x9e')]-_0x1e27b9[_0xd6f0('0x54')]-_0x1e27b9[_0xd6f0('0xcc')]-_0x1e27b9[_0xd6f0('0x51')];if(_0x3963cb>_0x2bbf7f){_0x3963cb=_0x2bbf7f;}}if(_0x3963cb>0x0){if(_0x1e27b9[_0xd6f0('0x161')]==='booked'){_0x3963cb=0x1;}if(_0x3963cb>this['maxNumberOriginate']){_0x3963cb=this[_0xd6f0('0x27')];}_0x1e27b9['temp']+=_0x3963cb;for(var _0x501f8c in this[_0xd6f0('0x25')]){if(typeof this[_0xd6f0('0x25')][_0x501f8c]!=='undefined'){if(this['agents'][_0x501f8c][_0xd6f0('0xac')]===_0xd6f0('0x209')&&this[_0xd6f0('0x25')][_0x501f8c][_0xd6f0('0xb6')]===_0xd6f0('0xe1')){_0x4e2992[_0xd6f0('0x12b')](this[_0xd6f0('0x25')][_0x501f8c]['id']);}}}this[_0xd6f0('0xcb')](_0x1e27b9['id'],_0x4e2992,_0x3963cb,_0x1e27b9[_0xd6f0('0x203')],_0x1e27b9)[_0xd6f0('0xc0')](function(_0x37d0a5){_0x1e27b9[_0xd6f0('0xcc')]-=_0x3963cb;_0x1e27b9['temp']=_0x1e27b9[_0xd6f0('0xcc')]>0x0?_0x1e27b9[_0xd6f0('0xcc')]:0x0;if(!checkContactEmpty(_0x37d0a5)){_0x2d1c6f[_0xd6f0('0xbe')](_0x1e27b9)[_0xd6f0('0xc0')](sendMessageReschedule(_0x1e27b9))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc1')));}else{_0x1e27b9[_0xd6f0('0x9e')]+=_0x37d0a5[_0xd6f0('0x9d')];_0x1e27b9[_0xd6f0('0x3e')]=_0x1e27b9[_0xd6f0('0x161')]==='booked'?'ACTIVE':_0xd6f0('0x204');for(var _0x57a646=0x0;_0x57a646<_0x37d0a5[_0xd6f0('0x9d')];_0x57a646+=0x1){if(_['isNil'](_0x37d0a5[_0x57a646])||_[_0xd6f0('0xb4')](_0x37d0a5[_0x57a646][_0xd6f0('0x16f')])||_['isNil'](_0x37d0a5[_0x57a646][_0xd6f0('0x16f')][_0xd6f0('0x170')])){_0x2d1c6f[_0xd6f0('0x20a')](_0xd6f0('0x206'),_0x1e27b9,_0x37d0a5[_0x57a646]);}else{_0x2d1c6f[_0xd6f0('0xc2')](_[_0xd6f0('0xd8')](_0x37d0a5[_0x57a646],[_0xd6f0('0xff'),_0xd6f0('0x20b')]))['then'](_0x2d1c6f[_0xd6f0('0x1ee')](_0x1e27b9,_0x37d0a5[_0x57a646]))[_0xd6f0('0xb8')](_0x2d1c6f[_0xd6f0('0xd5')](_0xd6f0('0x206'),_0x1e27b9));}}}})[_0xd6f0('0xb8')](loggerGetContactDialer('[getContactDialer2]',_0x1e27b9,_0x3963cb));}};Dialer['prototype'][_0xd6f0('0x95')]=function(_0x381dd0){if(_0x381dd0[_0xd6f0('0x208')]>0x0){var _0xb8d8b8=_0x381dd0[_0xd6f0('0x208')]-_0x381dd0[_0xd6f0('0x9e')]-_0x381dd0[_0xd6f0('0x54')];if(_0xb8d8b8>0x0){this[_0xd6f0('0x20c')](_0x381dd0);}else{loggerPredictiveCalls['info'](_0xd6f0('0x20d'));}}else{this[_0xd6f0('0x20c')](_0x381dd0);}};Dialer[_0xd6f0('0x1d')][_0xd6f0('0x20c')]=function(_0x5c642a){var _0xd3a7f=this;var _0xa00cef=[];_0x5c642a[_0xd6f0('0x9e')]+=0x1;for(var _0x289b58 in this[_0xd6f0('0x25')]){if(typeof this['agents'][_0x289b58]!==_0xd6f0('0x9f')){if(this[_0xd6f0('0x25')][_0x289b58][_0xd6f0('0xac')]===_0xd6f0('0x209')&&this[_0xd6f0('0x25')][_0x289b58]['status']===_0xd6f0('0xe1')){_0xa00cef[_0xd6f0('0x12b')](this['agents'][_0x289b58]['id']);}}}this[_0xd6f0('0xcb')](_0x5c642a['id'],_0xa00cef,0x1,_0x5c642a[_0xd6f0('0x203')],_0x5c642a)[_0xd6f0('0xc0')](function(_0x59f2f6){if(!checkContactEmpty(_0x59f2f6)){checkContactLowerLimitOriginate(_0x5c642a,0x1,0x0);_0xd3a7f[_0xd6f0('0xbe')](_0x5c642a)[_0xd6f0('0xc0')](sendMessageReschedule(_0x5c642a))[_0xd6f0('0xb8')](loggerCatch(_0xd6f0('0xc1')));}else{_0x5c642a[_0xd6f0('0x3e')]=_0xd6f0('0x204');if(_['isNil'](_0x59f2f6[0x0])||_['isNil'](_0x59f2f6[0x0][_0xd6f0('0x16f')])||_[_0xd6f0('0xb4')](_0x59f2f6[0x0]['Contact']['phone'])){_0xd3a7f[_0xd6f0('0x20a')]('[actionOriginate]\x20',_0x5c642a,_0x59f2f6[0x0]);}else{_0xd3a7f[_0xd6f0('0xc2')](_[_0xd6f0('0xd8')](_0x59f2f6[0x0],[_0xd6f0('0xff'),'Contact.phone']))[_0xd6f0('0xc0')](_0xd3a7f['checkContactBlack'](_0x5c642a,_0x59f2f6[0x0]))[_0xd6f0('0xb8')](_0xd3a7f[_0xd6f0('0xd5')](_0xd6f0('0x20e'),_0x5c642a));}}})[_0xd6f0('0xb8')](loggerGetContactDialer(_0xd6f0('0x20f'),_0x5c642a,0x1));emitVoiceQueueSummary(_0x5c642a);};Dialer['prototype'][_0xd6f0('0x1e4')]=function(_0x213025,_0x4cb65f,_0x2d027a,_0x23ceff,_0x49b590,_0xd5f542){loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x210'));loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x211'),_0x213025);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x212'),_0x4cb65f);loggerPredictive['info'](_0xd6f0('0x213'),_0x2d027a);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x214'),_0x23ceff);loggerPredictive[_0xd6f0('0x81')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x49b590);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x215'));return new BPromise(function(_0x218d5a,_0x2a824c){if(_0x213025<=0x0||isNaN(_0x213025)){return _0x2a824c(msgResponse(_0xd6f0('0x216'),_0xd6f0('0x48'),_0xd6f0('0x217')+_0x213025));}if(_0x2d027a<=0x0||isNaN(_0x2d027a)){return _0x2a824c(msgResponse(_0xd6f0('0x216'),_0xd6f0('0x48'),_0xd6f0('0x218')+_0x2d027a));}if(_0x23ceff<=0x0||isNaN(_0x23ceff)){return _0x2a824c(msgResponse('[abandonmentRate]','Error',_0xd6f0('0x219')+_0x23ceff));}if(_0x4cb65f<=0x0||isNaN(_0x4cb65f)){return _0x2a824c(msgResponse(_0xd6f0('0x216'),_0xd6f0('0x48'),_0xd6f0('0x21a')+_0x4cb65f));}if(_0x49b590<=0x0||isNaN(_0x49b590)){return _0x2a824c(msgResponse('[abandonmentRate]',_0xd6f0('0x48'),_0xd6f0('0x21b')+_0x49b590));}_0xd5f542=_0xd5f542||0x0;var _0x1e9462=0x1/_0x2d027a;var _0x40b0e3=0x0;var _0x539152=0x0;var _0x5223df=0x0;var _0x1b2cd9=0x0;for(var _0x56596e=0x0;_0x5223df<_0x49b590;_0x56596e+=0x1){_0x539152=_0x56596e/_0x4cb65f;_0x40b0e3=(_0x23ceff*_0x539152+_0xd5f542)/_0x1e9462;_0x5223df=erlangb(_0x40b0e3,_0x213025);_0x1b2cd9=_0x40b0e3/_0x213025*(0x1-erlangb(_0x40b0e3,_0x213025));}return _0x218d5a({'erlangCalls':_0x56596e,'erlangCallToSecond':_0x4cb65f/_0x56596e,'erlangAbandonmentRate':_0x5223df,'erlangBusyFactor':_0x1b2cd9});});};Dialer['prototype']['busyFactor']=function(_0x522199,_0x41e6eb,_0x3f1a60,_0x675918,_0x478ff9,_0x2a8bd5){loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x21c'));loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x211'),_0x522199);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x212'),_0x41e6eb);loggerPredictive['info'](_0xd6f0('0x213'),_0x3f1a60);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x214'),_0x675918);loggerPredictive['info'](_0xd6f0('0x21d'),_0x478ff9);loggerPredictive[_0xd6f0('0x81')](_0xd6f0('0x215'));return new BPromise(function(_0x3b52d8,_0x192c04){if(_0x522199<=0x0||isNaN(_0x522199)){return _0x192c04(msgResponse(_0xd6f0('0x21e'),_0xd6f0('0x48'),_0xd6f0('0x217')+_0x522199));}if(_0x3f1a60<=0x0||isNaN(_0x3f1a60)){return _0x192c04(msgResponse('[busyFactor]',_0xd6f0('0x48'),_0xd6f0('0x218')+_0x3f1a60));}if(_0x675918<=0x0||isNaN(_0x675918)){return _0x192c04(msgResponse('[busyFactor]',_0xd6f0('0x48'),'p\x20=\x20'+_0x675918));}if(_0x41e6eb<=0x0||isNaN(_0x41e6eb)){return _0x192c04(msgResponse(_0xd6f0('0x21e'),'Error','interval\x20=\x20'+_0x41e6eb));}if(_0x478ff9<=0x0||isNaN(_0x478ff9)){return _0x192c04(msgResponse(_0xd6f0('0x21e'),_0xd6f0('0x48'),_0xd6f0('0x21f')+_0x478ff9));}_0x2a8bd5=_0x2a8bd5||0x0;var _0x1cd81c=0x1/_0x3f1a60;var _0x407af9=0x0;var _0x2df05c=0x0;var _0x4fdc47=0x0;var _0x3bd6ee=0x0;for(var _0x137fe4=0x0;_0x3bd6ee<_0x478ff9;_0x137fe4+=0x1){_0x2df05c=_0x137fe4/_0x41e6eb;_0x407af9=(_0x675918*_0x2df05c+_0x2a8bd5)/_0x1cd81c;_0x4fdc47=erlangb(_0x407af9,_0x522199);_0x3bd6ee=_0x407af9/_0x522199*(0x1-erlangb(_0x407af9,_0x522199));}return _0x3b52d8({'erlangCalls':_0x137fe4,'erlangCallToSecond':_0x41e6eb/_0x137fe4,'erlangAbandonmentRate':_0x4fdc47,'erlangBusyFactor':_0x3bd6ee});});};module[_0xd6f0('0x220')]=Dialer; \ No newline at end of file +var _0x35a9=['checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','lodash','bluebird','uuid','moment','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperBlack','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','Intervals','\x20INTERVAL_IS_NULL','isEmpty','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','waiting','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','[uniqueid]','actions','[actions]','sequence','isNil','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','VoiceQueueId','CampaignId','isSuccess','Success','isTrunkReachable','status','reachable','SIP/%s','saveInDb','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countnosuchnumberretry','countabandonedretry','stateGlobal','reason19\x20machine....','add','dialMachineRetryFrequency','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','interval','content','indexOf','iftime\x20%s,%s','all','GLOBAL_INTERVAL_IS_OVERTIME','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','reason','custom:agentnosuchnumber'];(function(_0x488d54,_0x2169a1){var _0x3397e3=function(_0x4d3dcf){while(--_0x4d3dcf){_0x488d54['push'](_0x488d54['shift']());}};_0x3397e3(++_0x2169a1);}(_0x35a9,0x73));var _0x935a=function(_0x187796,_0x4f8cb1){_0x187796=_0x187796-0x0;var _0x107658=_0x35a9[_0x187796];return _0x107658;};'use strict';var util=require('util');var _=require(_0x935a('0x0'));var BPromise=require(_0x935a('0x1'));var uuid=require(_0x935a('0x2'));var moment=require(_0x935a('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x935a('0x4'));var config=require('../../../config/environment/');var logger=require(_0x935a('0x5'))(_0x935a('0x6'));var loggerBooked=require(_0x935a('0x5'))(_0x935a('0x7'));var loggerPredictive=require(_0x935a('0x5'))(_0x935a('0x8'));var loggerPredictiveCalls=require(_0x935a('0x5'))(_0x935a('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x935a('0xa'));var ami=require(_0x935a('0xb'));config[_0x935a('0xc')]=_[_0x935a('0xd')](config[_0x935a('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x935a('0xe'))(new Redis(config[_0x935a('0xc')]));var cmHopper=require(_0x935a('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x935a('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x935a('0x11'));var Final=require(_0x935a('0x12'));var AgentComplete=require(_0x935a('0x13'));var QueueCallerAbandon=require(_0x935a('0x14'));var Hangup=require(_0x935a('0x15'));var ipAgi=process[_0x935a('0x16')][_0x935a('0x17')]||_0x935a('0x18');var strategy={'rrmemory':'rrmemory','roundrobin':_0x935a('0x19')};var Sequence=function(){};Sequence[_0x935a('0x1a')][_0x935a('0x1b')]=function(_0x2cccbc){this[_0x935a('0x1c')]=this[_0x935a('0x1c')]?this[_0x935a('0x1c')][_0x935a('0x1d')](_0x2cccbc):_0x2cccbc();};function Dialer(_0xd67695,_0x17b013){this['sequence']=new Sequence();this[_0x935a('0x1e')]=_0x17b013;this[_0x935a('0x1f')]=_0xd67695[_0x935a('0x1f')];this[_0x935a('0x20')]=_0xd67695[_0x935a('0x20')];this[_0x935a('0x21')]=_0xd67695[_0x935a('0x21')];this['trunks']=_0xd67695[_0x935a('0x22')];this[_0x935a('0x23')]=config[_0x935a('0x23')]||0x2;this[_0x935a('0x24')]={};this['actions']={};this[_0x935a('0x25')]={};this[_0x935a('0x26')]={};this['optionPredictive']={};this[_0x935a('0x27')]={};this[_0x935a('0x28')]={};this[_0x935a('0x29')]={};this[_0x935a('0x2a')]={};this[_0x935a('0x2b')]={};ami['on']('agentconnect',this[_0x935a('0x2c')][_0x935a('0x2d')](this));ami['on'](_0x935a('0x2e'),this['syncQueueCallerAbandon'][_0x935a('0x2d')](this));ami['on'](_0x935a('0x2f'),this[_0x935a('0x30')][_0x935a('0x2d')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x935a('0x2d')](this));ami['on'](_0x935a('0x31'),this['syncQueueSummary'][_0x935a('0x2d')](this));ami['on'](_0x935a('0x32'),this[_0x935a('0x33')][_0x935a('0x2d')](this));ami['on'](_0x935a('0x34'),this[_0x935a('0x35')][_0x935a('0x2d')](this));ami['on'](_0x935a('0x36'),this[_0x935a('0x37')][_0x935a('0x2d')](this));ami['on'](_0x935a('0x38'),this[_0x935a('0x39')]['bind'](this));ami['on'](_0x935a('0x3a'),this[_0x935a('0x3b')][_0x935a('0x2d')](this));this['loopCampaigns']();this[_0x935a('0x3c')]();}function isNotNull(_0x26f891){return _0x26f891!==null&&!_[_0x935a('0x3d')](_0x26f891);}function checkIsLoggedIn(_0x1bb4e4,_0x48c9b5){return function(){if(_0x48c9b5<=0x0){_0x1bb4e4[_0x935a('0x3e')]=_0x935a('0x3f');throw _0x1bb4e4[_0x935a('0x40')]+_0x935a('0x41');}};}function isActive(_0x5794ff){return _0x5794ff;}function checkIsActive(_0x51bd56,_0x2d98e1){return function(){if(!isActive(_0x2d98e1)){_0x51bd56[_0x935a('0x3e')]='NOT_ACTIVE';throw _0x51bd56['name']+_0x935a('0x42');}};}function checkInterval(_0x2f4292){return function(){if(!isNotNull(_0x2f4292['Interval'])){_0x2f4292[_0x935a('0x3e')]='INTERVAL_IS_NULL';throw _0x2f4292[_0x935a('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2f4292[_0x935a('0x43')][_0x935a('0x44')])){_0x2f4292['message']='INTERVAL_IS_NULL';throw _0x2f4292[_0x935a('0x40')]+_0x935a('0x45');}if(!isNotNull(_[_0x935a('0x46')](_0x2f4292[_0x935a('0x43')][_0x935a('0x44')]))){_0x2f4292[_0x935a('0x3e')]=_0x935a('0x47');throw _0x2f4292[_0x935a('0x40')]+_0x935a('0x45');}};}function msgResponse(_0x371562,_0x4c7af5,_0x5f5964){return{'action':_0x371562,'response':_0x4c7af5,'message':_0x5f5964,'stack':_0x5f5964};}function myreject(_0x5b0b75){return function(_0x2c7aea){return _0x5b0b75(msgResponse(_0x935a('0x48'),_0x935a('0x49'),JSON[_0x935a('0x4a')](_0x2c7aea)));};}function getSeconds(_0xb716c3,_0x27c657){var _0x552470=moment(_0xb716c3)[_0x935a('0x4b')](0x0);var _0x581d2f=moment(_0x27c657)[_0x935a('0x4b')](0x0);return _0x552470[_0x935a('0x4c')](_0x581d2f,_0x935a('0x4d'));}function emit(_0x19233e,_0x5ec0b8,_0x1227dc){io['to'](_0x19233e)[_0x935a('0x4e')](_0x5ec0b8,_0x1227dc);}function emitVoiceQueueSummary(_0x319642){if(_0x319642[_0x935a('0x4f')]===_0x935a('0x50')){var _0x4dc91c={'id':_0x319642['id'],'name':_0x319642['name'],'strategy':_0x319642[_0x935a('0x51')],'answered':_0x319642[_0x935a('0x52')],'available':_0x319642[_0x935a('0x53')],'loggedIn':_0x319642[_0x935a('0x54')],'pTalking':_0x319642[_0x935a('0x55')],'sumBillable':_0x319642[_0x935a('0x56')],'sumDuration':_0x319642[_0x935a('0x57')],'sumHoldTime':_0x319642[_0x935a('0x58')]||0x0,'talking':_0x319642[_0x935a('0x59')],'total':_0x319642[_0x935a('0x5a')],'type':_0x319642[_0x935a('0x4f')],'unmanaged':_0x319642['unmanaged'],'abandoned':_0x319642[_0x935a('0x5b')],'waiting':_0x319642['waiting'],'loggedInDb':_0x319642['loggedInDb'],'dialActive':_0x319642[_0x935a('0x5c')],'dialMethod':_0x319642['dialMethod'],'dialOriginateCallerIdName':_0x319642[_0x935a('0x5d')],'dialOriginateCallerIdNumber':_0x319642[_0x935a('0x5e')],'dialOriginateTimeout':_0x319642[_0x935a('0x5f')],'dialPrefix':_0x319642[_0x935a('0x60')],'outboundAnswerAgiCallsDay':_0x319642[_0x935a('0x61')],'outboundAnswerCallsDay':_0x319642[_0x935a('0x62')],'outboundBlacklistCallsDay':_0x319642[_0x935a('0x63')],'outboundBusyCallsDay':_0x319642['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x319642[_0x935a('0x64')],'outboundDropCallsDayACS':_0x319642['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x319642[_0x935a('0x65')],'outboundDropCallsDayTimeout':_0x319642[_0x935a('0x66')],'outboundNoAnswerCallsDay':_0x319642[_0x935a('0x67')],'outboundNoSuchCallsDay':_0x319642[_0x935a('0x68')],'outboundOriginateFailureCallsDay':_0x319642[_0x935a('0x69')],'outboundReCallsDay':_0x319642[_0x935a('0x6a')],'outboundRejectCallsDay':_0x319642['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x319642[_0x935a('0x6b')],'predictiveIntervalAnsweredCalls':_0x319642['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x319642[_0x935a('0x6c')],'predictiveIntervalAvgTalktime':_0x319642['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x319642[_0x935a('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x319642[_0x935a('0x6e')],'predictiveIntervalErlangCalls':_0x319642['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x319642[_0x935a('0x6f')],'predictiveIntervalHitRate':_0x319642[_0x935a('0x70')],'predictiveIntervalMultiplicativeFactor':_0x319642[_0x935a('0x71')],'predictiveIntervalPauses':_0x319642[_0x935a('0x72')],'predictiveIntervalAvailable':_0x319642[_0x935a('0x73')],'predictiveIntervalTotalCalls':_0x319642[_0x935a('0x74')],'message':_0x319642['message'],'originated':_0x319642['originated'],'erlangCalls':_0x319642[_0x935a('0x75')],'erlangCallToSecond':_0x319642['erlangCallToSecond'],'erlangAbandonmentRate':_0x319642[_0x935a('0x76')],'erlangBusyFactor':_0x319642[_0x935a('0x77')],'startPredictive':_0x319642[_0x935a('0x27')],'startProgressive':_0x319642[_0x935a('0x28')]};if(_0x319642[_0x935a('0x78')]){_0x4dc91c[_0x935a('0x78')]={'id':_0x319642[_0x935a('0x78')]['id'],'name':_0x319642[_0x935a('0x78')]['name'],'active':_0x319642[_0x935a('0x78')][_0x935a('0x79')],'callerid':_0x319642[_0x935a('0x78')][_0x935a('0x7a')]};}if(_0x319642[_0x935a('0x43')]){_0x4dc91c[_0x935a('0x43')]={'id':_0x319642[_0x935a('0x43')]['id'],'name':_0x319642[_0x935a('0x43')]['name']};}var _0x23e85f=md5(JSON['stringify'](_0x4dc91c));if(_0x319642['md5']!==_0x23e85f){_0x319642['md5']=_0x23e85f;emit(util[_0x935a('0x7b')](_0x935a('0x7c'),_0x4dc91c[_0x935a('0x40')]),_0x935a('0x7d'),_0x4dc91c);}}}function emitCampaignSummary(_0x59d133){if(_0x59d133[_0x935a('0x4f')]==='ivr'){emit(util['format'](_0x935a('0x7e'),_0x59d133[_0x935a('0x40')]),_0x935a('0x7f'),_0x59d133);}}function checkGetDataPredictive(_0x899ced){if(isNotNull(_0x899ced)&&!_[_0x935a('0x46')](_0x899ced)){loggerPredictive[_0x935a('0x80')](_0x935a('0x81'));loggerPredictive['info'](_0x935a('0x82'),_0x899ced[_0x935a('0x74')]);loggerPredictive['info'](_0x935a('0x83'),_0x899ced['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x899ced[_0x935a('0x6e')]);loggerPredictive[_0x935a('0x80')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x899ced[_0x935a('0x6d')]);loggerPredictive[_0x935a('0x80')](_0x935a('0x84'),_0x899ced[_0x935a('0x6c')]);loggerPredictive[_0x935a('0x80')](_0x935a('0x85'),_0x899ced[_0x935a('0x86')]);loggerPredictive[_0x935a('0x80')](_0x935a('0x87'));if(_0x899ced[_0x935a('0x74')]>0x0){if(!_[_0x935a('0x3d')](_0x899ced['predictiveIntervalAvgTalktime'])&&_0x899ced[_0x935a('0x86')]>0x0){return!![];}loggerPredictive[_0x935a('0x80')](_0x935a('0x88'));if(!_[_0x935a('0x3d')](_0x899ced[_0x935a('0x6c')])&&_0x899ced['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x935a('0x89'));}else{loggerPredictive['info'](_0x935a('0x8a'));}}else{loggerPredictive[_0x935a('0x80')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x11f08d){return function(_0x347bac){loggerPredictive[_0x935a('0x80')](_0x935a('0x8b'));loggerPredictive[_0x935a('0x80')](_0x935a('0x8c'),_0x347bac['erlangCalls']);loggerPredictive['info'](_0x935a('0x8d'),_0x347bac['erlangCallToSecond']);loggerPredictive[_0x935a('0x80')](_0x935a('0x8e'),_0x347bac[_0x935a('0x76')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x347bac[_0x935a('0x77')]);loggerPredictive[_0x935a('0x80')](_0x935a('0x8e'),_0x347bac[_0x935a('0x76')]);loggerPredictive[_0x935a('0x80')](_0x935a('0x87'));_[_0x935a('0x8f')](_0x11f08d,_0x347bac);};}function getDiff(_0x5404f1){var _0x2155a8=moment()[_0x935a('0x4b')](0x0);var _0x166d8e=moment(_0x5404f1)[_0x935a('0x4b')](0x0);return _0x2155a8[_0x935a('0x4c')](_0x166d8e,_0x935a('0x4d'));}function ifInterval(_0x271fde,_0x3e7d06){if(_[_0x935a('0x3d')](_0x3e7d06)){return![];}return getDiff(_0x3e7d06)<_0x271fde*0x3c;}function freeVariablesPredictive(_0x20fbd9){if(isNotNull(_0x20fbd9)){if(!_[_0x935a('0x3d')](_0x20fbd9[_0x935a('0x28')])){_0x20fbd9[_0x935a('0x28')]=undefined;loggerPredictive[_0x935a('0x80')](_0x20fbd9[_0x935a('0x40')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x935a('0x3d')](_0x20fbd9[_0x935a('0x27')])){_0x20fbd9['startPredictive']=undefined;loggerPredictive[_0x935a('0x80')](_0x20fbd9[_0x935a('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x935a('0x3d')](_0x20fbd9[_0x935a('0x90')])){clearInterval(_0x20fbd9[_0x935a('0x90')]);_0x20fbd9[_0x935a('0x90')]=undefined;loggerPredictive[_0x935a('0x80')](_0x20fbd9[_0x935a('0x40')],_0x935a('0x91'));}}}function erlangb(_0x1028a9,_0x43f897){if(_0x43f897===0x0){return 0x0;}var _0xdbe25b=0x1;for(var _0x1f7ffc=0x1;_0x1f7ffc<=_0x43f897;_0x1f7ffc+=0x1){_0xdbe25b=0x1+_0xdbe25b*_0x1f7ffc/_0x1028a9;}return 0x1/_0xdbe25b;}function isVoiceQueueOutbound(_0x53bbad){return _0x53bbad==='outbound';}function isNotPreview(_0x193d76){return _0x193d76!==_0x935a('0x1e');}function isCampaignIvr(_0x24fc7b){return _0x24fc7b===_0x935a('0x92');}function getCallerId(_0x337888,_0x5f0378,_0x91e6d1){if(!_[_0x935a('0x3d')](_0x91e6d1)&&typeof _0x91e6d1==='string'&&!_[_0x935a('0x46')](_0x91e6d1)){if(!_['isUndefined'](_0x5f0378)&&typeof _0x5f0378===_0x935a('0x93')&&!_['isEmpty'](_0x5f0378)){return util[_0x935a('0x7b')](_0x935a('0x94'),_0x5f0378,_0x91e6d1);}return util['format'](_0x935a('0x94'),_0x91e6d1,_0x91e6d1);}if(!_[_0x935a('0x3d')](_0x337888)&&typeof _0x337888===_0x935a('0x93')&&!_[_0x935a('0x46')](_0x337888)){return _0x337888;}return _0x935a('0x95');}function loggerCatchQueueSummary(_0x448292,_0x1da906){return function(_0x303327){freeVariablesPredictive(_0x1da906);emitVoiceQueueSummary(_0x1da906);emitCampaignSummary(_0x1da906);loggerSyncQueueSummary['error'](_0x448292,util[_0x935a('0x96')](_0x303327,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4ee338,_0x98b2ec){return function(_0x1c96d4){loggerPredictive[_0x935a('0x97')](_0x98b2ec[_0x935a('0x40')],_0x4ee338);loggerPredictive[_0x935a('0x97')](_0x1c96d4[_0x935a('0x98')]);freeVariablesPredictive(_0x98b2ec);};}function loggerCatch(_0x8c6026){return function(_0x242343){logger[_0x935a('0x97')](_0x8c6026,util[_0x935a('0x96')](_0x242343,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1a417c){return _0x1a417c&&!_[_0x935a('0x3d')](_0x1a417c)&&_0x1a417c[_0x935a('0x99')]>0x0;}function decremetOriginate(_0x495a9d){if(!_[_0x935a('0x3d')](_0x495a9d)&&_0x495a9d!==null){if(typeof _0x495a9d[_0x935a('0x9a')]!==_0x935a('0x9b')){if(_0x495a9d[_0x935a('0x9a')]>0x0){_0x495a9d[_0x935a('0x9a')]-=0x1;}else{logger['error'](_0x935a('0x9c'));}}}else{logger[_0x935a('0x97')](_0x935a('0x9d'));}}function checkContactLowerLimitOriginate(_0x55e598,_0x1a2b77,_0x204a5e){if(_0x1a2b77>_0x204a5e){for(var _0x3140ee=0x0;_0x3140ee<_0x1a2b77-_0x204a5e;_0x3140ee+=0x1){decremetOriginate(_0x55e598);}}}function loggerGetContactDialer(_0x15eb5d,_0x543878,_0x2f53bc){return function(_0x197c23){checkContactLowerLimitOriginate(_0x543878,_0x2f53bc,0x0);logger[_0x935a('0x97')](_0x15eb5d,util[_0x935a('0x96')](_0x197c23,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1596c2){return function(_0x368173){if(isNotNull(_0x368173)&&isNotNull(_0x368173[0x0])){if(_0x368173[0x0][_0x935a('0x9e')]>0x0){_0x1596c2[_0x935a('0x3e')]='RESCHEDULED_CONTACTS';logger['info'](_0x935a('0x9f')+_0x1596c2[_0x935a('0x40')],_0x368173[0x0][_0x935a('0x9e')],_0x935a('0xa0'));}else{_0x1596c2[_0x935a('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x935a('0x80')](_0x935a('0xa1')+_0x1596c2[_0x935a('0x40')]);}}};}function notSendMessagesQueue(_0x58f387){if(_0x58f387['sendMessageOneNotActive']){freeVariablesPredictive(_0x58f387);if(_0x58f387[_0x935a('0x9a')]===0x0&&_0x58f387[_0x935a('0x59')]===0x0&&_0x58f387[_0x935a('0xa2')]===0x0&&(_0x58f387[_0x935a('0x55')]||0x0)===0x0){_0x58f387['sendMessageOneNotActive']=![];_0x58f387[_0x935a('0x53')]=0x0;_0x58f387[_0x935a('0x3e')]=_0x935a('0xa3');loggerSyncQueueSummary['error'](_0x935a('0xa4'),_0x58f387[_0x935a('0x40')],_0x935a('0xa5'));}else{_0x58f387[_0x935a('0x3e')]=_0x935a('0xa6');loggerSyncQueueSummary[_0x935a('0x97')](_0x935a('0xa4'),_0x58f387[_0x935a('0x40')],_0x935a('0xa7'));}emitVoiceQueueSummary(_0x58f387);}}function notSendMessagesCampaign(_0x4a4009){if(_0x4a4009[_0x935a('0xa8')]){if(_0x4a4009[_0x935a('0x9a')]===0x0){_0x4a4009[_0x935a('0xa8')]=![];_0x4a4009['message']=_0x935a('0xa3');loggerSyncQueueSummary[_0x935a('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4a4009['name'],_0x935a('0xa5'));}else{_0x4a4009[_0x935a('0x3e')]=_0x935a('0xa6');loggerSyncQueueSummary[_0x935a('0x97')](_0x935a('0xa9'),_0x4a4009[_0x935a('0x40')],'is\x20disactive');}emitCampaignSummary(_0x4a4009);}}function createObjHistory(_0x2ba5f7,_0x5671c4,_0x352a6b,_0x501645,_0x317c89){_0x2ba5f7['message']=_0x352a6b;var _0x55826f=new Action(_0x2ba5f7,_0x5671c4);var _0x3c5afb=new History(_0x55826f);_0x3c5afb[_0x935a('0xaa')]=_0x501645;_0x3c5afb[_0x935a('0xab')]=_0x317c89;_0x3c5afb[_0x935a('0xac')]=_0x55826f['starttime'];return _0x3c5afb;}Dialer[_0x935a('0x1a')][_0x935a('0x3c')]=function(){var _0x419528=this;setInterval(function(){_0x419528[_0x935a('0xad')](_0x419528[_0x935a('0x26')],_0x935a('0xae'));_0x419528[_0x935a('0xad')](_0x419528[_0x935a('0xaf')],_0x935a('0xb0'));},0x32c8);};Dialer['prototype'][_0x935a('0xad')]=function(_0x3bdcab,_0x6ff826){var _0x685814=this;for(var _0x33105c in _0x3bdcab){if(typeof _0x3bdcab[_0x33105c]!==_0x935a('0x9b')){this[_0x935a('0xb1')][_0x935a('0x1b')](function(){if(!_[_0x935a('0xb2')](_0x3bdcab[_0x33105c])){return ami['Action']({'action':'status','channel':_0x3bdcab[_0x33105c][_0x935a('0xb3')]})[_0x935a('0xb4')](function(_0x459a42){if(_0x459a42[_0x935a('0x3e')]===_0x935a('0xb5')){setTimeout(function(){if(_0x3bdcab[_0x33105c]&&_0x3bdcab[_0x33105c]['type']!==_0x935a('0x92')){_0x685814['updateOriginated'](_0x685814[_0x935a('0x1f')][_0x3bdcab[_0x33105c][_0x935a('0xb6')]]);logger[_0x935a('0x97')](_0x935a('0xb7'),_0x6ff826,_0x33105c,_0x3bdcab[_0x33105c][_0x935a('0xb6')]);delete _0x3bdcab[_0x33105c];}if(_0x3bdcab[_0x33105c]&&_0x3bdcab[_0x33105c][_0x935a('0x4f')]==='ivr'){_0x685814['updateOriginated'](_0x685814[_0x935a('0x20')][_0x3bdcab[_0x33105c]['queue']]);logger[_0x935a('0x97')](_0x935a('0xb8'),_0x6ff826,_0x33105c,_0x3bdcab[_0x33105c][_0x935a('0xb6')]);delete _0x3bdcab[_0x33105c];}},0x2328);}});}});}}};Dialer['prototype'][_0x935a('0xb9')]=function(_0x1135e6){return BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](cmHopper[_0x935a('0xb9')](_0x1135e6))[_0x935a('0xb4')](loggerCatch(_0x935a('0xbc')));};Dialer[_0x935a('0x1a')][_0x935a('0xbd')]=function(_0x2697d3){return BPromise['resolve']()[_0x935a('0xbb')](cmHopperBlack[_0x935a('0xbd')](_0x2697d3))['catch'](loggerCatch(_0x935a('0xbe')));};Dialer[_0x935a('0x1a')][_0x935a('0xbf')]=function(_0x3d58ac){return BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](cmHopperBlack[_0x935a('0xbf')](_0x3d58ac))['catch'](loggerCatch(_0x935a('0xc0')));};Dialer[_0x935a('0x1a')]['averageHandleTime']=function(_0x244411){return BPromise['resolve']()[_0x935a('0xbb')](cmHopperHistory[_0x935a('0xc1')](_0x244411))[_0x935a('0xb4')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x935a('0x1a')][_0x935a('0xc2')]=function(_0x8ee540){return BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](cmHopper[_0x935a('0xc2')](_0x8ee540))['catch'](loggerCatch(_0x935a('0xc3')));};Dialer['prototype']['unlockContact']=function(_0x4208df,_0x12727f,_0x14258d){return BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](cmHopper['unlockContact'](_0x4208df,_0x12727f,_0x14258d))[_0x935a('0xb4')](loggerCatch(_0x935a('0xc4')));};Dialer[_0x935a('0x1a')]['getContactDialer']=function(_0x54d2cb,_0x2bb44b,_0x1835e0,_0x7e7130,_0x25ac05){return BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](cmHopper[_0x935a('0xc5')](_0x54d2cb,_0x2bb44b,_0x1835e0,_0x7e7130))[_0x935a('0xb4')](function(_0x20541c){_0x25ac05[_0x935a('0xc6')]-=_0x1835e0;_0x25ac05['temp']=_0x25ac05[_0x935a('0xc6')]>0x0?_0x25ac05[_0x935a('0xc6')]:0x0;loggerCatch(_0x935a('0xc7'))(_0x20541c);});};Dialer[_0x935a('0x1a')][_0x935a('0xc8')]=function(_0x17aa20,_0x4cd208,_0x1220fb,_0x4f3d6f){return BPromise['resolve']()[_0x935a('0xbb')](cmHopper[_0x935a('0xc8')](_0x17aa20,_0x4cd208,_0x1220fb))[_0x935a('0xb4')](function(_0x19d047){_0x4f3d6f[_0x935a('0xc6')]-=_0x4cd208;_0x4f3d6f[_0x935a('0xc6')]=_0x4f3d6f[_0x935a('0xc6')]>0x0?_0x4f3d6f[_0x935a('0xc6')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x19d047);});};Dialer[_0x935a('0x1a')][_0x935a('0xc9')]=function(_0x18d700){return BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](voiceQueueRt[_0x935a('0xc9')](_0x18d700))['catch'](loggerCatch(_0x935a('0xca')));};Dialer[_0x935a('0x1a')][_0x935a('0xcb')]=function(_0x444848){return BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](cmHopper[_0x935a('0xcb')](_0x444848))[_0x935a('0xb4')](loggerCatch(_0x935a('0xcc')));};Dialer[_0x935a('0x1a')][_0x935a('0xcd')]=function(_0x5e12ab){return BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](cmHopperHistory[_0x935a('0xcd')](_0x5e12ab))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0x935a('0x1a')][_0x935a('0xce')]=function(_0x5a00e8){if(!_[_0x935a('0x3d')](_0x5a00e8)&&_0x5a00e8!==null){if(typeof _0x5a00e8[_0x935a('0x9a')]!==_0x935a('0x9b')){if(_0x5a00e8['originated']>0x0){_0x5a00e8['originated']-=0x1;}else{logger['error'](_0x935a('0xcf'));}}}else{logger[_0x935a('0x97')](_0x935a('0xd0'));}};Dialer[_0x935a('0x1a')][_0x935a('0xd1')]=function(_0x3cb695,_0x328d92){var _0xb4c2fb=this;return function(_0x31cdde){_0xb4c2fb['updateOriginated'](_0x328d92);logger[_0x935a('0x97')](_0x3cb695,util[_0x935a('0x96')](_0x31cdde,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x935a('0xd2')]=function(_0x2916a3,_0xc3546e,_0xaf1611){var _0x1ba9ab={'state':0x19,'statedesc':_0x935a('0xd3')};this['updateOriginated'](_0xc3546e);this['saveInDb'](_[_0x935a('0x8f')](_0x1ba9ab,_[_0x935a('0xd4')](_0xaf1611,[_0x935a('0xd5'),_0x935a('0xd6'),'UserId',_0x935a('0xd7'),_0x935a('0xd8')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0x935a('0x97')](_0x2916a3);};Dialer[_0x935a('0x1a')][_0x935a('0xd9')]=function(_0x231906){return _0x231906===_0x935a('0xda');};Dialer[_0x935a('0x1a')][_0x935a('0xdb')]=function(_0x8d6be0){return!_[_0x935a('0x3d')](_0x8d6be0)&&_0x8d6be0&&!_['isUndefined'](_0x8d6be0[_0x935a('0x40')])&&!_[_0x935a('0x3d')](_0x8d6be0[_0x935a('0x79')])&&_0x8d6be0[_0x935a('0x79')]&&(this[_0x935a('0x22')][util[_0x935a('0x7b')]('SIP/%s',_0x8d6be0['name'])][_0x935a('0xdc')]===_0x935a('0xdd')||this[_0x935a('0x22')][util[_0x935a('0x7b')](_0x935a('0xde'),_0x8d6be0[_0x935a('0x40')])][_0x935a('0xdc')]==='unmonitored');};Dialer[_0x935a('0x1a')][_0x935a('0xdf')]=function(_0x2f14e3,_0xa9375c,_0xe62a17){this['createHistory'](_0x2f14e3)['catch'](loggerCatch(_0xa9375c));this[_0x935a('0xcb')](_0x2f14e3)[_0x935a('0xb4')](loggerCatch(_0xe62a17));};Dialer[_0x935a('0x1a')][_0x935a('0x37')]=function(_0xf48e1c){var _0x488255=this[_0x935a('0x26')][_0xf48e1c['uniqueid']];var _0x5dd3b3;if(!_[_0x935a('0xb2')](_0xf48e1c)&&!_[_0x935a('0xb2')](_0xf48e1c[_0x935a('0xe0')])&&!_[_0x935a('0xb2')](_0xf48e1c[_0x935a('0xe0')][_0x935a('0xe1')])&&_0xf48e1c[_0x935a('0xe2')]===_0x935a('0xe3')&&_0x488255){if(_0x488255[_0x935a('0x4f')]!==_0x935a('0x92')&&this[_0x935a('0x1f')][_0x488255[_0x935a('0xb6')]][_0x935a('0xe4')]&&_0xf48e1c[_0x935a('0xe5')]===_0x935a('0xe6')){delete this[_0x935a('0x26')][_0xf48e1c[_0x935a('0xe7')]];this[_0x935a('0xce')](this[_0x935a('0x1f')][_0x488255[_0x935a('0xb6')]]);this[_0x935a('0x1f')][_0x488255['queue']][_0x935a('0x62')]+=0x1;this[_0x935a('0x1f')][_0x488255[_0x935a('0xb6')]][_0x935a('0x61')]+=0x1;_0x5dd3b3=new Hangup(_0x488255,_0xf48e1c);_0x5dd3b3['state']=0x12;_0x5dd3b3[_0x935a('0xab')]='HangupInAMD';_0x5dd3b3['membername']=_0x935a('0xe8');ami['emit'](_0x935a('0xe9'),ut[_0x935a('0xea')](_0x5dd3b3,_0x935a('0xeb')));this[_0x935a('0xdf')](_0x5dd3b3,_0x935a('0xec'),_0x935a('0xed'));}if(_0x488255[_0x935a('0x4f')]!==_0x935a('0x92')&&this['voiceQueues'][_0x488255[_0x935a('0xb6')]][_0x935a('0xe4')]&&_0xf48e1c[_0x935a('0xe5')]===_0x935a('0xee')){var _0x10a01e=this;return new BPromise(function(_0x2da5a8,_0x16c6d6){delete _0x10a01e['uniqueId'][_0xf48e1c[_0x935a('0xe7')]];_0x10a01e[_0x935a('0xce')](_0x10a01e[_0x935a('0x1f')][_0x488255[_0x935a('0xb6')]]);_0x10a01e[_0x935a('0x1f')][_0x488255[_0x935a('0xb6')]][_0x935a('0x62')]+=0x1;_0x10a01e[_0x935a('0x1f')][_0x488255[_0x935a('0xb6')]][_0x935a('0x61')]+=0x1;var _0xbc27de=_0x10a01e[_0x935a('0x1f')][_0x488255['queue']];var _0x137b64=new Hangup(_0x488255,_0xf48e1c);_0x137b64[_0x935a('0xaa')]=0x13;_0x137b64[_0x935a('0xab')]=_0x935a('0xef');_0x137b64[_0x935a('0xf0')]='AMD';_0x137b64[_0x935a('0xf1')]+=0x1;_0x137b64[_0x935a('0xf2')]+=0x1;_0x137b64['amd']=!![];ami['emit'](_0x935a('0xe9'),ut[_0x935a('0xea')](_0x137b64,_0x935a('0xeb')));_0x10a01e[_0x935a('0xcd')](_0x137b64)[_0x935a('0xb4')](loggerCatch(_0x935a('0xf3')));if(_0x137b64['countbusyretry']+_0x137b64[_0x935a('0xf4')]+_0x137b64[_0x935a('0xf5')]+_0x137b64['countnosuchnumberretry']+_0x137b64[_0x935a('0xf6')]+_0x137b64['countabandonedretry']+_0x137b64[_0x935a('0xf1')]+_0x137b64[_0x935a('0xf7')]>=_0xbc27de[_0x935a('0xf8')]){_0x10a01e['stateGlobal'](_0x137b64,_0x2da5a8,_0x16c6d6,'reason19\x20machine....');}else{if(_0x137b64[_0x935a('0xf1')]>=_0xbc27de[_0x935a('0xf9')]){_0x10a01e[_0x935a('0xfa')](_0x137b64,_0x2da5a8,_0x16c6d6,_0x935a('0xfb'));}else{_0x10a01e['rescheduleContact']({'active':![],'countmachineretry':_0x137b64[_0x935a('0xf1')],'scheduledat':moment()['add'](_0xbc27de['dialMachineRetryFrequency'],'minutes')[_0x935a('0x7b')](_0x935a('0xfc')),'ContactId':_0x137b64['ContactId'],'ListId':_0x137b64[_0x935a('0xd6')],'VoiceQueueId':_0x137b64[_0x935a('0xd7')]||undefined,'CampaignId':_0x137b64[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0xfd')));_0x2da5a8({'reschedule':0x1});}}});}if(_0x488255[_0x935a('0x4f')]===_0x935a('0x92')&&this[_0x935a('0x20')][_0x488255[_0x935a('0xb6')]]['dialAMDActive']&&_0xf48e1c[_0x935a('0xe5')]==='HANGUP'){delete this[_0x935a('0x26')][_0xf48e1c[_0x935a('0xe7')]];this[_0x935a('0xce')](this['campaigns'][_0x488255[_0x935a('0xb6')]]);_0x5dd3b3=new Hangup(_0x488255,_0xf48e1c);_0x5dd3b3[_0x935a('0xaa')]=0x12;_0x5dd3b3[_0x935a('0xab')]=_0x935a('0xfe');_0x5dd3b3['membername']=_0x935a('0xe8');ami[_0x935a('0x4e')](_0x935a('0xe9'),ut['buildObj'](_0x5dd3b3,_0x935a('0xeb')));this[_0x935a('0xdf')](_0x5dd3b3,_0x935a('0xff'),_0x935a('0x100'));}if(_0x488255[_0x935a('0x4f')]===_0x935a('0x92')&&this[_0x935a('0x20')][_0x488255[_0x935a('0xb6')]][_0x935a('0xe4')]&&_0xf48e1c[_0x935a('0xe5')]===_0x935a('0xee')){var _0x10a01e=this;return new BPromise(function(_0x507a84,_0x45ab42){delete _0x10a01e[_0x935a('0x26')][_0xf48e1c['uniqueid']];_0x10a01e[_0x935a('0xce')](_0x10a01e[_0x935a('0x20')][_0x488255[_0x935a('0xb6')]]);_0x10a01e[_0x935a('0x20')][_0x488255[_0x935a('0xb6')]][_0x935a('0x62')]+=0x1;_0x10a01e[_0x935a('0x20')][_0x488255['queue']][_0x935a('0x61')]+=0x1;var _0x55db7a=_0x10a01e['campaigns'][_0x488255[_0x935a('0xb6')]];var _0x3ab273=new Hangup(_0x488255,_0xf48e1c);_0x3ab273[_0x935a('0xaa')]=0x13;_0x3ab273['statedesc']=_0x935a('0xef');_0x3ab273[_0x935a('0xf0')]=_0x935a('0xe8');_0x3ab273[_0x935a('0xf1')]+=0x1;_0x3ab273[_0x935a('0xf2')]+=0x1;_0x3ab273['amd']=!![];ami[_0x935a('0x4e')](_0x935a('0xe9'),ut[_0x935a('0xea')](_0x3ab273,_0x935a('0xeb')));_0x10a01e[_0x935a('0xcd')](_0x3ab273)[_0x935a('0xb4')](loggerCatch(_0x935a('0xf3')));if(_0x3ab273[_0x935a('0x101')]+_0x3ab273[_0x935a('0xf4')]+_0x3ab273[_0x935a('0xf5')]+_0x3ab273[_0x935a('0x102')]+_0x3ab273[_0x935a('0xf6')]+_0x3ab273[_0x935a('0x103')]+_0x3ab273[_0x935a('0xf1')]+_0x3ab273[_0x935a('0xf7')]>=_0x55db7a[_0x935a('0xf8')]){_0x10a01e[_0x935a('0x104')](_0x3ab273,_0x507a84,_0x45ab42,_0x935a('0x105'));}else{if(_0x3ab273[_0x935a('0xf1')]>=_0x55db7a[_0x935a('0xf9')]){_0x10a01e['createStateFinal'](_0x3ab273,_0x507a84,_0x45ab42,_0x935a('0xfb'));}else{_0x10a01e[_0x935a('0xc2')]({'active':![],'countmachineretry':_0x3ab273['countmachineretry'],'scheduledat':moment()[_0x935a('0x106')](_0x55db7a[_0x935a('0x107')],_0x935a('0x108'))[_0x935a('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ab273[_0x935a('0xd5')],'ListId':_0x3ab273['ListId'],'VoiceQueueId':_0x3ab273['VoiceQueueId']||undefined,'CampaignId':_0x3ab273[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0xfd')));_0x507a84({'reschedule':0x1});}}});}}};Dialer[_0x935a('0x1a')]['syncHangup']=function(_0xc19bd9){var _0x5e9bd9=this[_0x935a('0x26')][_0xc19bd9[_0x935a('0xe7')]];var _0x17f34a=this;var _0x3a0e2e;if(_0x5e9bd9&&_0x5e9bd9['type']===_0x935a('0x92')){delete this['uniqueId'][_0xc19bd9['uniqueid']];this[_0x935a('0xce')](this[_0x935a('0x20')][_0x5e9bd9[_0x935a('0xb6')]]);this[_0x935a('0x20')][_0x5e9bd9[_0x935a('0xb6')]][_0x935a('0x109')]+=0x1;_0x3a0e2e=new Hangup(_0x5e9bd9,_0xc19bd9);this[_0x935a('0xcd')](_0x3a0e2e)[_0x935a('0xb4')](loggerCatch(_0x935a('0x10a')));this[_0x935a('0xcb')](_0x3a0e2e)[_0x935a('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x5e9bd9&&_0x5e9bd9[_0x935a('0x4f')]!==_0x935a('0x92')&&isNotNull(this[_0x935a('0x1f')][_0x5e9bd9[_0x935a('0xb6')]][_0x935a('0x10b')])){delete this['uniqueId'][_0xc19bd9[_0x935a('0xe7')]];this['updateOriginated'](this['voiceQueues'][_0x5e9bd9[_0x935a('0xb6')]]);this[_0x935a('0x1f')][_0x5e9bd9[_0x935a('0xb6')]][_0x935a('0x62')]+=0x1;this['voiceQueues'][_0x5e9bd9[_0x935a('0xb6')]][_0x935a('0x61')]+=0x1;_0x3a0e2e=new Hangup(_0x5e9bd9,_0xc19bd9);_0x3a0e2e[_0x935a('0xaa')]=0x10;_0x3a0e2e[_0x935a('0xab')]=_0x935a('0x10c');_0x3a0e2e[_0x935a('0xf0')]=_0x935a('0x10d');this['createHistory'](_0x3a0e2e)[_0x935a('0xb4')](loggerCatch(_0x935a('0x10a')));this[_0x935a('0xcb')](_0x3a0e2e)[_0x935a('0xb4')](loggerCatch(_0x935a('0x10e')));}if(_0x5e9bd9&&_0x5e9bd9[_0x935a('0x4f')]!==_0x935a('0x92')&&!isNotNull(this[_0x935a('0x1f')][_0x5e9bd9[_0x935a('0xb6')]]['dialQueueProject'])){delete this['uniqueId'][_0xc19bd9['uniqueid']];this[_0x935a('0xce')](this[_0x935a('0x1f')][_0x5e9bd9[_0x935a('0xb6')]]);this['voiceQueues'][_0x5e9bd9[_0x935a('0xb6')]][_0x935a('0x6b')]+=0x1;_0x3a0e2e=new Hangup(_0x5e9bd9,_0xc19bd9);_0x3a0e2e[_0x935a('0xaa')]=0xc;_0x3a0e2e[_0x935a('0xab')]=_0xc19bd9[_0x935a('0x10f')];_0x3a0e2e[_0x935a('0xf0')]='Unknow';this[_0x935a('0xcd')](_0x3a0e2e)[_0x935a('0xb4')](loggerCatch(_0x935a('0x10a')));this[_0x935a('0xcb')](_0x3a0e2e)[_0x935a('0xb4')](loggerCatch(_0x935a('0x10e')));}};Dialer[_0x935a('0x1a')]['syncAgentComplete']=function(_0x51bf57){var _0x2fb192=this[_0x935a('0x26')][_0x51bf57[_0x935a('0xe7')]];var _0xf4f14e=this;if(this['voiceQueues'][_0x51bf57['queue']]){if(_0x2fb192&&_0x2fb192[_0x935a('0x4f')]!==_0x935a('0x92')){delete this['uniqueId'][_0x51bf57[_0x935a('0xe7')]];this[_0x935a('0x1f')][_0x51bf57[_0x935a('0xb6')]][_0x935a('0x62')]+=0x1;var _0xbff614=new AgentComplete(_0x2fb192,_0x51bf57);if(_0x51bf57['reason']===_0x935a('0x110')){_0xbff614[_0x935a('0x111')]=this[_0x935a('0x1f')][_0x51bf57[_0x935a('0xb6')]]['dialQueueProject2']&&this[_0x935a('0x1f')][_0x51bf57[_0x935a('0xb6')]]['dialAgiAfterHangupAgent']?moment()[_0x935a('0x7b')](_0x935a('0xfc')):undefined;}this[_0x935a('0xcd')](_0xbff614)['catch'](loggerCatch(_0x935a('0x112')));this[_0x935a('0xcb')](_0xbff614)['catch'](loggerCatch(_0x935a('0x113')));}}};Dialer[_0x935a('0x1a')]['syncAgentConnect']=function(_0x527bdc){if(this[_0x935a('0x1f')][_0x527bdc[_0x935a('0xb6')]]){if(this[_0x935a('0x26')][_0x527bdc['uniqueid']]&&this['uniqueId'][_0x527bdc[_0x935a('0xe7')]][_0x935a('0x4f')]!=='ivr'){this['updateOriginated'](this[_0x935a('0x1f')][_0x527bdc[_0x935a('0xb6')]]);this[_0x935a('0x26')][_0x527bdc[_0x935a('0xe7')]][_0x935a('0x114')]=moment()[_0x935a('0x7b')](_0x935a('0xfc'));}}};Dialer[_0x935a('0x1a')][_0x935a('0x115')]=function(_0x534db6){this[_0x935a('0xcd')](_0x534db6)['catch'](loggerCatch(_0x935a('0x112')));this[_0x935a('0xcb')](_0x534db6)['catch'](loggerCatch(_0x935a('0x116')));};Dialer[_0x935a('0x1a')]['syncQueueCallerAbandon']=function(_0x26d3ea){var _0x52db06=this[_0x935a('0x26')][_0x26d3ea[_0x935a('0xe7')]];var _0x4c0bb7=this;if(this['voiceQueues'][_0x26d3ea[_0x935a('0xb6')]]){if(_0x52db06&&_0x52db06['type']!==_0x935a('0x92')){delete this[_0x935a('0x26')][_0x26d3ea['uniqueid']];this[_0x935a('0xce')](this[_0x935a('0x1f')][_0x26d3ea['queue']]);_0x52db06['droptime']=moment()['format'](_0x935a('0xfc'));var _0x26fdab=new QueueCallerAbandon(_0x52db06,_0x26d3ea);if(getSeconds(_0x52db06[_0x935a('0x117')],_0x52db06[_0x935a('0x118')])>=_0x52db06[_0x935a('0x119')]){this['voiceQueues'][_0x26d3ea[_0x935a('0xb6')]][_0x935a('0x6e')]+=0x1;this['voiceQueues'][_0x26d3ea['queue']][_0x935a('0x66')]+=0x1;this[_0x935a('0x1f')][_0x26d3ea['queue']][_0x935a('0x6f')]+=0x1;_0x26fdab[_0x935a('0xaa')]=0xa;_0x26fdab[_0x935a('0xab')]=_0x935a('0x11a');_0x26fdab['dropreason']=_0x935a('0x11b');_0x26fdab[_0x935a('0x111')]=this[_0x935a('0x1f')][_0x26d3ea[_0x935a('0xb6')]][_0x935a('0x11c')]?moment()['format'](_0x935a('0xfc')):undefined;_0x26fdab[_0x935a('0xf6')]+=0x1;_0x26fdab[_0x935a('0xf2')]+=0x1;if(_0x26fdab[_0x935a('0xf6')]>=this[_0x935a('0x1f')][_0x26d3ea[_0x935a('0xb6')]][_0x935a('0x11d')]){this[_0x935a('0x115')](_0x26fdab);}else{this[_0x935a('0xc2')]({'active':![],'countdropretry':_0x26fdab['countdropretry'],'scheduledat':moment()['add'](this[_0x935a('0x1f')][_0x26d3ea[_0x935a('0xb6')]][_0x935a('0x11e')],_0x935a('0x108'))[_0x935a('0x7b')](_0x935a('0xfc')),'ContactId':_0x52db06[_0x935a('0xd5')],'ListId':_0x52db06[_0x935a('0xd6')],'VoiceQueueId':_0x52db06[_0x935a('0xd7')]||undefined,'CampaignId':_0x52db06[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0x11f')));var _0x2c8c02=new History(_0x26fdab);_0x2c8c02[_0x935a('0xaa')]=0xa;_0x2c8c02[_0x935a('0xab')]=_0x935a('0x11a');_0x2c8c02['starttime']=moment()[_0x935a('0x7b')](_0x935a('0xfc'));_0x2c8c02[_0x935a('0xac')]=_0x2c8c02[_0x935a('0x120')];_0x2c8c02['calleridname']=_0x26fdab[_0x935a('0x121')];_0x2c8c02[_0x935a('0x122')]=_0x26fdab[_0x935a('0x122')];this[_0x935a('0xcd')](_0x2c8c02)[_0x935a('0xb4')](loggerCatch(_0x935a('0x123')));}}else{this[_0x935a('0x1f')][_0x26d3ea[_0x935a('0xb6')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x26d3ea[_0x935a('0xb6')]][_0x935a('0x65')]+=0x1;_0x26fdab[_0x935a('0xaa')]=0xb;_0x26fdab['statedesc']=_0x935a('0x124');_0x26fdab[_0x935a('0x125')]=_0x935a('0x126');_0x26fdab[_0x935a('0x103')]+=0x1;_0x26fdab[_0x935a('0xf2')]+=0x1;if(_0x26fdab[_0x935a('0x103')]>=this['voiceQueues'][_0x26d3ea['queue']][_0x935a('0x127')]){this[_0x935a('0x115')](_0x26fdab);}else{this[_0x935a('0xc2')]({'active':![],'countabandonedretry':_0x26fdab[_0x935a('0x103')],'scheduledat':moment()['add'](this[_0x935a('0x1f')][_0x26d3ea[_0x935a('0xb6')]][_0x935a('0x128')],'minutes')[_0x935a('0x7b')](_0x935a('0xfc')),'ContactId':_0x52db06['ContactId'],'ListId':_0x52db06[_0x935a('0xd6')],'VoiceQueueId':_0x52db06['VoiceQueueId']||undefined,'CampaignId':_0x52db06[_0x935a('0xd8')]||undefined})['catch'](loggerCatch(_0x935a('0x129')));var _0x2c8c02=new History(_0x26fdab);_0x2c8c02[_0x935a('0xaa')]=0xb;_0x2c8c02[_0x935a('0xab')]=_0x935a('0x124');_0x2c8c02[_0x935a('0x120')]=moment()[_0x935a('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c8c02[_0x935a('0xac')]=_0x2c8c02[_0x935a('0x120')];_0x2c8c02[_0x935a('0x121')]=_0x26fdab[_0x935a('0x121')];_0x2c8c02[_0x935a('0x122')]=_0x26fdab[_0x935a('0x122')];this['createHistory'](_0x2c8c02)[_0x935a('0xb4')](loggerCatch(_0x935a('0x12a')));}}}}};Dialer[_0x935a('0x1a')][_0x935a('0x35')]=function(_0x2e5a67){if(this[_0x935a('0xaf')][_0x2e5a67[_0x935a('0xe7')]]){this[_0x935a('0xaf')][_0x2e5a67[_0x935a('0xe7')]]['channel']=_0x2e5a67['channel'];}if(this['uniqueId'][_0x2e5a67[_0x935a('0xe7')]]){this[_0x935a('0x26')][_0x2e5a67[_0x935a('0xe7')]][_0x935a('0xb3')]=_0x2e5a67['channel'];}};Dialer[_0x935a('0x1a')]['syncQueueMember']=function(_0x2be759){if(strategy[this[_0x935a('0x1f')][this[_0x935a('0xaf')][_0x2be759[_0x935a('0x12b')]]['queue']][_0x935a('0x51')]]===_0x935a('0x19')){if(this[_0x935a('0xaf')][_0x2be759[_0x935a('0x12b')]]&&_[_0x935a('0xb2')](this['actions'][_0x2be759[_0x935a('0x12b')]][_0x935a('0x12c')])&&_0x2be759[_0x935a('0xdc')]==='1'&&_0x2be759[_0x935a('0x12d')]==='0'){if(this[_0x935a('0x21')][_0x2be759[_0x935a('0x12e')]]){if(!this[_0x935a('0x21')][_0x2be759[_0x935a('0x12e')]][_0x935a('0x12c')]){this[_0x935a('0x21')][_0x2be759[_0x935a('0x12e')]][_0x935a('0x12c')]=!![];this['actions'][_0x2be759[_0x935a('0x12b')]][_0x935a('0x12c')]=!![];this[_0x935a('0xaf')][_0x2be759['actionid']][_0x935a('0x12e')]=_0x2be759[_0x935a('0x12e')];}}}}else if((strategy[this[_0x935a('0x1f')][this[_0x935a('0xaf')][_0x2be759[_0x935a('0x12b')]][_0x935a('0xb6')]]['strategy']]||_0x935a('0x12f'))===_0x935a('0x12f')){if(this['actions'][_0x2be759[_0x935a('0x12b')]]){if(this[_0x935a('0x21')][_0x2be759[_0x935a('0x12e')]]){this[_0x935a('0xaf')][_0x2be759[_0x935a('0x12b')]][_0x935a('0x12e')]=_0x2be759[_0x935a('0x12e')];if(_['isNil'](this[_0x935a('0x2a')][this[_0x935a('0xaf')][_0x2be759[_0x935a('0x12b')]][_0x935a('0xb6')]])){this['queueBooked'][this[_0x935a('0xaf')][_0x2be759[_0x935a('0x12b')]][_0x935a('0xb6')]]=[];}this[_0x935a('0x2a')][this[_0x935a('0xaf')][_0x2be759['actionid']][_0x935a('0xb6')]][_0x935a('0x130')](_[_0x935a('0x8f')](_[_0x935a('0xd4')](this[_0x935a('0xaf')][_0x2be759[_0x935a('0x12b')]],[_0x935a('0x131'),_0x935a('0x12e')]),{'status':_0x2be759['status'],'paused':_0x2be759['paused']}));}}}};function unlockQueueStatus(_0x334c36,_0x5e1f0c){setTimeout(function(){if(_['isUndefined'](_0x334c36[_0x935a('0x132')])){loggerBooked[_0x935a('0x97')](_0x935a('0x133'),_0x5e1f0c);}_0x334c36[_0x935a('0x132')]=!![];loggerBooked['info'](_0x935a('0x134'),_0x5e1f0c,JSON[_0x935a('0x4a')](_[_0x935a('0xd4')](_0x334c36,[_0x935a('0x40'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x935a('0x1a')][_0x935a('0x3b')]=function(_0x4f0617){var _0x6f73e9=this;var _0x84ab12=_0x6f73e9['voiceQueues'][_0x6f73e9[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]][_0x935a('0xb6')]];if(strategy[this[_0x935a('0x1f')][this['actions'][_0x4f0617[_0x935a('0x12b')]][_0x935a('0xb6')]][_0x935a('0x51')]]===_0x935a('0x19')){if(this[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]]&&this['actions'][_0x4f0617['actionid']][_0x935a('0x12e')]){this['preview'][_0x935a('0x135')](this['actions'][_0x4f0617[_0x935a('0x12b')]][_0x935a('0x131')],this[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]][_0x935a('0x12e')])[_0x935a('0xb4')](function(_0x207db3){logger[_0x935a('0x97')](_0x935a('0x136'),util['inspect'](_0x207db3,{'showHidden':![],'depth':null}));})[_0x935a('0x1d')](function(){_0x6f73e9[_0x935a('0xce')](_0x6f73e9['voiceQueues'][_0x6f73e9['actions'][_0x4f0617['actionid']][_0x935a('0xb6')]]);_0x6f73e9[_0x935a('0x21')][_0x6f73e9[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]][_0x935a('0x12e')]][_0x935a('0x12c')]=![];delete _0x6f73e9[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]];unlockQueueStatus(_0x84ab12);});}else{this['updateOriginated'](this[_0x935a('0x1f')][this[_0x935a('0xaf')][_0x4f0617['actionid']][_0x935a('0xb6')]]);this[_0x935a('0xc2')]({'active':![],'ContactId':this[_0x935a('0xaf')][_0x4f0617['actionid']]['ContactId'],'ListId':this['actions'][_0x4f0617['actionid']][_0x935a('0xd6')],'VoiceQueueId':this[_0x935a('0xaf')][_0x4f0617['actionid']][_0x935a('0xd7')]||undefined,'CampaignId':this[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]]['CampaignId']||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0x137')));delete this['actions'][_0x4f0617['actionid']];unlockQueueStatus(_0x84ab12);}}else if((strategy[this[_0x935a('0x1f')][this[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]][_0x935a('0xb6')]][_0x935a('0x51')]]||_0x935a('0x12f'))==='rrmemory'){var _0x42a7d9;if(this[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]]&&!_[_0x935a('0x46')](this['queueBooked'][this[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]]['queue']])){if(this[_0x935a('0x2b')][_0x6f73e9[_0x935a('0xaf')][_0x4f0617['actionid']][_0x935a('0xb6')]]){this['queueBookedRR'][_0x6f73e9[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]]['queue']]=this['queueBookedRR'][this[_0x935a('0xaf')][_0x4f0617['actionid']]['queue']]?this[_0x935a('0x2b')][this[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]][_0x935a('0xb6')]]:this[_0x935a('0x2a')][this[_0x935a('0xaf')][_0x4f0617['actionid']][_0x935a('0xb6')]]?this[_0x935a('0x2a')][this[_0x935a('0xaf')][_0x4f0617['actionid']][_0x935a('0xb6')]]['_rr']||0x0:0x0;}this[_0x935a('0x2a')][this[_0x935a('0xaf')][_0x4f0617[_0x935a('0x12b')]]['queue']][_0x935a('0x138')]=this[_0x935a('0x2b')][this['actions'][_0x4f0617[_0x935a('0x12b')]][_0x935a('0xb6')]];for(var _0x2e54cb=0x0;_0x2e54cb=0x0;})[_0x935a('0xb4')](myreject(_0x1b7a2c)));}}else{_0x5dea3d[_0x935a('0x130')](ami[_0x935a('0x150')]({'action':'command','command':util[_0x935a('0x7b')](_0x935a('0x154'),_0x408045,!_[_0x935a('0x3d')](config[_0x935a('0x14c')][_0xb3ec4])?_0xb3ec4:'')})[_0x935a('0xbb')](function(_0x3676fd){return _0x3676fd['content'][_0x935a('0x153')]('true')>=0x0;})['catch'](myreject(_0x1b7a2c)));}BPromise[_0x935a('0x155')](_0x5dea3d)[_0x935a('0xbb')](function(_0x575370){var _0x1d3fbe=_['some'](_0x575370);if(_0x1d3fbe){return _0x31a927(_0x1d3fbe);}else{_0x27ffab[_0x935a('0x3e')]=_0x220951?_0x935a('0x156'):'INTERVAL_IS_OVERTIME';return _0x1b7a2c(msgResponse('[ifTime][promiseAll]',_0x935a('0x149'),'Global:\x20'+_0x220951+'\x20'+_0x381e3b+'\x20Interval\x20is\x20overtime:\x20'+util[_0x935a('0x96')](_0x408045,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0xb3ec4));}})['catch'](function(_0x57e31c){return _0x1b7a2c(msgResponse(_0x935a('0x147'),_0x935a('0x149'),JSON[_0x935a('0x4a')](_0x57e31c)));});});};Dialer['prototype'][_0x935a('0x157')]=function(_0x5b75d3){var _0x3115a9=this;return function(){switch(_0x5b75d3[_0x935a('0x158')]){case _0x935a('0x159'):freeVariablesPredictive(_0x5b75d3);_0x3115a9[_0x935a('0x15a')](_0x5b75d3,0x1);break;case _0x935a('0x15b'):freeVariablesPredictive(_0x5b75d3);_0x3115a9[_0x935a('0x15a')](_0x5b75d3,_0x5b75d3[_0x935a('0x15c')]);break;case _0x935a('0x8'):_0x3115a9[_0x935a('0x8')](_0x5b75d3);break;case'booked':freeVariablesPredictive(_0x5b75d3);_0x3115a9[_0x935a('0x15a')](_0x5b75d3,0x1);break;default:freeVariablesPredictive(_0x5b75d3);logger[_0x935a('0x97')](_0x935a('0x15d'),_0x5b75d3[_0x935a('0x40')],_0x935a('0x15e'));}};};Dialer[_0x935a('0x1a')]['launchHandleIvr']=function(_0x1cb70d){var _0x223580=this;return function(){_0x223580['handleIvr'](_0x1cb70d);};};Dialer['prototype'][_0x935a('0xa')]=function(_0x507be5){var _0x26e715=this;if(isNotPreview(_0x507be5[_0x935a('0x158')])){if(isVoiceQueueOutbound(_0x507be5['type'])&&isActive(_0x507be5[_0x935a('0x5c')])){_0x507be5[_0x935a('0xa8')]=!![];BPromise[_0x935a('0xba')]()[_0x935a('0xbb')](checkIsLoggedIn(_0x507be5,_0x507be5['loggedIn']))[_0x935a('0xbb')](checkIsActive(_0x507be5,_0x507be5[_0x935a('0x5c')]))[_0x935a('0xbb')](checkInterval(_0x507be5))[_0x935a('0xbb')](_0x26e715[_0x935a('0x142')](_0x507be5))[_0x935a('0xbb')](_0x26e715['checkIfTime'](_0x507be5[_0x935a('0x15f')],_0x507be5[_0x935a('0x160')],_0x507be5[_0x935a('0x40')],_0x507be5))[_0x935a('0xbb')](_0x26e715[_0x935a('0x148')](_0x507be5[_0x935a('0x43')],_0x507be5[_0x935a('0x160')],_0x507be5[_0x935a('0x40')],_0x507be5))['then'](_0x26e715[_0x935a('0x157')](_0x507be5))[_0x935a('0xb4')](loggerCatchQueueSummary(_0x935a('0x161'),_0x507be5));}else{notSendMessagesQueue(_0x507be5);}}else{freeVariablesPredictive(_0x507be5);}};Dialer['prototype'][_0x935a('0x141')]=function(){var _0x38eef0=this;var _0x28584d;for(var _0x3d2bf3 in this['campaigns']){if(typeof this[_0x935a('0x20')][_0x3d2bf3]!=='undefined'){_0x28584d=this[_0x935a('0x20')][_0x3d2bf3];if(isCampaignIvr(_0x28584d[_0x935a('0x4f')])&&isActive(_0x28584d['active'])){_0x28584d[_0x935a('0xa8')]=!![];BPromise['resolve']()[_0x935a('0xbb')](checkIsActive(_0x28584d,_0x28584d[_0x935a('0x79')]))['then'](checkInterval(_0x28584d))[_0x935a('0xbb')](_0x38eef0[_0x935a('0x142')](_0x28584d))[_0x935a('0xbb')](_0x38eef0[_0x935a('0x146')](_0x28584d['dialGlobalInterval'],_0x28584d['dialTimezone'],_0x28584d[_0x935a('0x40')],_0x28584d))[_0x935a('0xbb')](_0x38eef0['checkIfTimeIntervals'](_0x28584d[_0x935a('0x43')],_0x28584d['dialTimezone'],_0x28584d[_0x935a('0x40')],_0x28584d))[_0x935a('0xbb')](_0x38eef0[_0x935a('0x162')](_0x28584d))[_0x935a('0xb4')](loggerCatchQueueSummary('[syncCampaigns]',_0x28584d));}else{notSendMessagesCampaign(_0x28584d);}}}};function getCallerIdRandom(_0x5abc2e,_0x173bc2){var _0x2a419c;var _0x2e78df;var _0x5cdd37;if(_0x173bc2<=0x0){_0x173bc2=0x1;}_0x2a419c=new RegExp(_0x935a('0x163')+_0x173bc2+'}$');_0x2e78df=Math[_0x935a('0x164')](0xa,_0x173bc2-0x1);_0x5cdd37=Math[_0x935a('0x164')](0xa,_0x173bc2)-0x1;return util[_0x935a('0x7b')]('%s',_[_0x935a('0x165')](_0x5abc2e,_0x2a419c,_['random'](_0x2e78df,_0x5cdd37)));}function extractCalleridName(_0x294ef5){var _0x3dcde9=_0x294ef5[_0x935a('0x166')](/"(.*?)"/);return _0x3dcde9?_0x3dcde9[0x1]:_0x294ef5;}function extractCalleridNumber(_0x2b14e1){var _0x5501a1=_0x2b14e1[_0x935a('0x166')](/<(.*?)>/);return _0x5501a1?_0x5501a1[0x1]:_0x2b14e1;}Dialer[_0x935a('0x1a')][_0x935a('0x167')]=function(_0x2d11c2,_0x5b61a2){var _0x4ca97f=this;var _0x896cb6=uuid['v4']();this['actions'][_0x896cb6]=new Action(_0x2d11c2,_0x5b61a2,_0x896cb6);return new BPromise(function(_0x1d0614,_0x347ae3){if(_[_0x935a('0x3d')](_0x2d11c2)&&typeof _0x2d11c2!==_0x935a('0x168')){return _0x347ae3(msgResponse(_0x935a('0x169'),_0x935a('0x149'),_0x935a('0x16a')));}if(_[_0x935a('0x3d')](_0x5b61a2['Contact']['phone'])||_0x5b61a2['Contact'][_0x935a('0x16b')]===null){return _0x347ae3(msgResponse(_0x935a('0x169'),_0x935a('0x149'),_0x935a('0x16c')));}var _0x3c1923={'XMD-CALLERID':_0x4ca97f[_0x935a('0xaf')][_0x896cb6]['getCaller'](),'XMD-AGI':_0x2d11c2[_0x935a('0x10b')]?util[_0x935a('0x7b')](_0x935a('0x16d'),ipAgi,_0x2d11c2[_0x935a('0x10b')]):_0x935a('0x16e'),'XMD-AGIAFTER':_0x2d11c2['dialQueueProject2']?util[_0x935a('0x7b')](_0x935a('0x16d'),ipAgi,_0x2d11c2[_0x935a('0x11c')]):'NONE','XMD-QUEUE':_0x2d11c2[_0x935a('0x4f')]===_0x935a('0x50')?util[_0x935a('0x7b')]('\x22%s,%s%s,,,%s\x22',_0x2d11c2[_0x935a('0x40')],_0x2d11c2[_0x935a('0x16f')]||'',_0x2d11c2[_0x935a('0x170')]?'c':'',_0x2d11c2['dialQueueTimeout']||0x3):_0x935a('0x16e'),'XMD-CONTACTID':_0x5b61a2['ContactId'],'XMD-CDRTYPE':_0x935a('0x6'),'CALLERID(all)':_0x4ca97f['actions'][_0x896cb6][_0x935a('0x171')](),'XMD-AMD':_0x2d11c2['dialAMDActive']?_0x935a('0x172'):_0x935a('0x16e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2d11c2[_0x935a('0xe4')]){_0x3c1923[_0x935a('0x173')]=_0x2d11c2[_0x935a('0x174')]||0x9c4;_0x3c1923[_0x935a('0x175')]=_0x2d11c2[_0x935a('0x176')]||0x5dc;_0x3c1923[_0x935a('0x177')]=_0x2d11c2[_0x935a('0x178')]||0x320;_0x3c1923[_0x935a('0x179')]=_0x2d11c2[_0x935a('0x17a')]||0x1388;_0x3c1923['XMD-AMDMINWORDLENGTH']=_0x2d11c2['dialAMDMinWordLength']||0x64;_0x3c1923[_0x935a('0x17b')]=_0x2d11c2[_0x935a('0x17c')]||0x32;_0x3c1923[_0x935a('0x17d')]=_0x2d11c2[_0x935a('0x17e')]||0x3;_0x3c1923[_0x935a('0x17f')]=_0x2d11c2[_0x935a('0x180')]||0x100;_0x3c1923[_0x935a('0x181')]=_0x2d11c2['dialAMDMaximumWordLength']||0x1388;}if(_0x2d11c2[_0x935a('0x4f')]===_0x935a('0x50')){_0x3c1923[_0x935a('0x182')]=_0x5b61a2['VoiceQueueId'];}else{_0x3c1923[_0x935a('0x183')]=_0x5b61a2[_0x935a('0xd8')];}for(var _0x409f27 in _0x5b61a2[_0x935a('0x184')]){if(typeof _0x5b61a2[_0x935a('0x184')][_0x409f27]!=='undefined'){if(isNotNull(_0x5b61a2[_0x935a('0x184')][_0x409f27])&&_0x409f27!=='id'&&_0x409f27!==_0x935a('0x185')&&_0x409f27!==_0x935a('0x186')&&_0x409f27!==_0x935a('0x187')){_0x3c1923[util['format'](_0x935a('0x188'),_0x935a('0x189'),_[_0x935a('0x18a')](_0x409f27))]=_0x5b61a2[_0x935a('0x184')][_0x409f27];}}}var _0x3199cd=_0x4ca97f['isTrunkReachable'](_0x2d11c2[_0x935a('0x78')])?getCallerId(_0x2d11c2[_0x935a('0x78')][_0x935a('0x7a')],_0x2d11c2[_0x935a('0x5d')],_0x2d11c2[_0x935a('0x18b')]>0x0?getCallerIdRandom(_0x2d11c2[_0x935a('0x5e')],_0x2d11c2[_0x935a('0x18b')]):_0x2d11c2[_0x935a('0x5e')]):getCallerId(_[_0x935a('0xb2')](_0x2d11c2['TrunkBackup'])?_0x2d11c2[_0x935a('0x78')][_0x935a('0x7a')]:_0x2d11c2[_0x935a('0x143')]['callerid'],_0x2d11c2[_0x935a('0x5d')],_0x2d11c2[_0x935a('0x18b')]>0x0?getCallerIdRandom(_0x2d11c2['dialOriginateCallerIdNumber'],_0x2d11c2[_0x935a('0x18b')]):_0x2d11c2[_0x935a('0x5e')]);if(_0x3199cd){_0x3c1923[_0x935a('0x18c')]=_0x4ca97f[_0x935a('0xaf')][_0x896cb6][_0x935a('0x18d')]=extractCalleridName(_0x3199cd);_0x3c1923[_0x935a('0x18e')]=_0x4ca97f['actions'][_0x896cb6]['originatecalleridnum']=extractCalleridNumber(_0x3199cd);}return ami[_0x935a('0x150')]({'actionid':_0x896cb6,'action':_0x935a('0x169'),'channel':_0x4ca97f['isTrunkReachable'](_0x2d11c2['Trunk'])?util[_0x935a('0x7b')]('SIP/%s/%s%s',_0x2d11c2[_0x935a('0x78')][_0x935a('0x40')],isNotNull(_0x2d11c2[_0x935a('0x60')])?_0x2d11c2[_0x935a('0x60')][_0x935a('0x18f')]()||'':'',_0x2d11c2[_0x935a('0x190')]>0x0?_0x5b61a2[_0x935a('0x184')]['phone'][_0x935a('0x191')](_0x2d11c2['dialCutDigit']):_0x5b61a2[_0x935a('0x184')]['phone']):util[_0x935a('0x7b')]('SIP/%s/%s%s',_[_0x935a('0xb2')](_0x2d11c2[_0x935a('0x143')])?_0x2d11c2[_0x935a('0x78')][_0x935a('0x40')]:_0x2d11c2[_0x935a('0x143')][_0x935a('0x40')],isNotNull(_0x2d11c2[_0x935a('0x60')])?_0x2d11c2[_0x935a('0x60')][_0x935a('0x18f')]()||'':'',_0x2d11c2['dialCutDigit']>0x0?_0x5b61a2[_0x935a('0x184')][_0x935a('0x16b')][_0x935a('0x191')](_0x2d11c2[_0x935a('0x190')]):_0x5b61a2[_0x935a('0x184')]['phone']),'callerid':_0x3199cd,'Exten':_0x935a('0xe3'),'Context':_0x935a('0x192'),'Priority':'1','variable':_0x3c1923,'timeout':(_0x2d11c2[_0x935a('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x896cb6})['then'](function(_0x3874ce){return _0x1d0614(_0x3874ce);})[_0x935a('0xb4')](function(_0x496193){_0x2d11c2['outboundOriginateFailureCallsDay']+=0x1;var _0x39dd9a=new History(_0x4ca97f['actions'][_0x896cb6]);logger[_0x935a('0x97')](util[_0x935a('0x7b')](_0x935a('0x193'),JSON[_0x935a('0x4a')](_0x496193)));_0x39dd9a['state']=0xe;_0x39dd9a[_0x935a('0xab')]='OriginateError';_0x39dd9a[_0x935a('0x120')]=moment()['format'](_0x935a('0xfc'));_0x39dd9a[_0x935a('0xac')]=_0x39dd9a['starttime'];_0x4ca97f['createHistory'](_0x39dd9a)['catch'](loggerCatch(_0x935a('0x194')));_0x4ca97f[_0x935a('0xcb')](_0x39dd9a)[_0x935a('0xb4')](loggerCatch(_0x935a('0x194')))[_0x935a('0x1d')](function(){delete _0x4ca97f[_0x935a('0xaf')][_0x896cb6];return _0x347ae3(msgResponse(_0x935a('0x169'),'Error',_0x935a('0x195')));});});});};Dialer[_0x935a('0x1a')]['syncOriginateResponse']=function(_0x31b36d){var _0x5dbc76=this[_0x935a('0xaf')][_0x31b36d[_0x935a('0x12b')]];if(_0x5dbc76){delete this[_0x935a('0xaf')][_0x31b36d['actionid']];_0x5dbc76['responsetime']=moment()[_0x935a('0x7b')](_0x935a('0xfc'));var _0x2bb46b=_0x5dbc76['type']===_0x935a('0x92')?this[_0x935a('0x20')][_0x5dbc76[_0x935a('0xb6')]]:this['voiceQueues'][_0x5dbc76[_0x935a('0x196')]()];if(!this['isSuccess'](_0x31b36d[_0x935a('0x197')])){this[_0x935a('0xce')](_0x2bb46b);return this['callProgressDetecting'](_0x5dbc76,_0x2bb46b,_0x31b36d)[_0x935a('0xb4')](loggerCatch(_0x935a('0x198')));}this[_0x935a('0x26')][_0x31b36d[_0x935a('0xe7')]]=_0x5dbc76;}};Dialer[_0x935a('0x1a')]['checkRetriveMax']=function(_0x40416c,_0x42cc15,_0x46f16b){var _0x415ee3=new History(_0x42cc15);if(_0x415ee3[_0x935a('0x101')]+_0x415ee3['countcongestionretry']+_0x415ee3[_0x935a('0xf5')]+_0x415ee3[_0x935a('0x102')]+_0x415ee3[_0x935a('0xf6')]+_0x415ee3[_0x935a('0x103')]+_0x415ee3[_0x935a('0xf1')]+_0x415ee3[_0x935a('0xf7')]>=_0x46f16b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x40416c){case 0x3:if(_0x415ee3[_0x935a('0xf5')]>=_0x46f16b[_0x935a('0x199')]-0x1){return!![];}this[_0x935a('0xc2')]({'active':![],'countnoanswerretry':_0x415ee3[_0x935a('0xf5')]+=0x1,'scheduledat':moment()[_0x935a('0x106')](_0x46f16b[_0x935a('0x19a')],'minutes')[_0x935a('0x7b')](_0x935a('0xfc')),'ContactId':_0x415ee3[_0x935a('0xd5')],'ListId':_0x415ee3[_0x935a('0xd6')],'VoiceQueueId':_0x415ee3[_0x935a('0xd7')]||undefined,'CampaignId':_0x415ee3['CampaignId']||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0x19b')));break;case 0x5:if(_0x415ee3[_0x935a('0x101')]>=_0x46f16b[_0x935a('0x19c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x415ee3[_0x935a('0x101')]+=0x1,'scheduledat':moment()[_0x935a('0x106')](_0x46f16b[_0x935a('0x19d')],_0x935a('0x108'))[_0x935a('0x7b')](_0x935a('0xfc')),'ContactId':_0x415ee3[_0x935a('0xd5')],'ListId':_0x415ee3[_0x935a('0xd6')],'VoiceQueueId':_0x415ee3[_0x935a('0xd7')]||undefined,'CampaignId':_0x415ee3[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0x19e')));break;case 0x8:if(_0x415ee3[_0x935a('0xf4')]>=_0x46f16b[_0x935a('0x19f')]-0x1){return!![];}this[_0x935a('0xc2')]({'active':![],'countcongestionretry':_0x415ee3[_0x935a('0xf4')]+=0x1,'scheduledat':moment()[_0x935a('0x106')](_0x46f16b[_0x935a('0x1a0')],'minutes')['format'](_0x935a('0xfc')),'ContactId':_0x415ee3[_0x935a('0xd5')],'ListId':_0x415ee3[_0x935a('0xd6')],'VoiceQueueId':_0x415ee3[_0x935a('0xd7')]||undefined,'CampaignId':_0x415ee3[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x415ee3[_0x935a('0x102')]>=_0x46f16b['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x935a('0xc2')]({'active':![],'countnosuchnumberretry':_0x415ee3[_0x935a('0x102')]+=0x1,'scheduledat':moment()[_0x935a('0x106')](_0x46f16b[_0x935a('0x1a1')],_0x935a('0x108'))[_0x935a('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x415ee3[_0x935a('0xd5')],'ListId':_0x415ee3[_0x935a('0xd6')],'VoiceQueueId':_0x415ee3['VoiceQueueId']||undefined,'CampaignId':_0x415ee3[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0x1a2')));}break;case 0xa:if(_0x415ee3['countdropretry']>=_0x46f16b[_0x935a('0x11d')]-0x1){return!![];}this[_0x935a('0xc2')]({'active':![],'countdropretry':_0x415ee3[_0x935a('0xf6')]+=0x1,'scheduledat':moment()[_0x935a('0x106')](_0x46f16b[_0x935a('0x11e')],'minutes')[_0x935a('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x415ee3[_0x935a('0xd5')],'ListId':_0x415ee3['ListId'],'VoiceQueueId':_0x415ee3[_0x935a('0xd7')]||undefined,'CampaignId':_0x415ee3[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0x11f')));break;case 0xb:if(_0x415ee3[_0x935a('0x103')]>=_0x46f16b[_0x935a('0x127')]-0x1){return!![];}this[_0x935a('0xc2')]({'active':![],'countabandonedretry':_0x415ee3[_0x935a('0x103')]+=0x1,'scheduledat':moment()[_0x935a('0x106')](_0x46f16b['dialAbandonedRetryFrequency'],_0x935a('0x108'))[_0x935a('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x415ee3[_0x935a('0xd5')],'ListId':_0x415ee3[_0x935a('0xd6')],'VoiceQueueId':_0x415ee3[_0x935a('0xd7')]||undefined,'CampaignId':_0x415ee3[_0x935a('0xd8')]||undefined})['catch'](loggerCatch(_0x935a('0x129')));break;case 0x13:if(_0x415ee3[_0x935a('0xf1')]>=_0x46f16b['dialMachineMaxRetry']-0x1){return!![];}this[_0x935a('0xc2')]({'active':![],'countmachineretry':_0x415ee3[_0x935a('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x46f16b[_0x935a('0x107')],_0x935a('0x108'))[_0x935a('0x7b')](_0x935a('0xfc')),'ContactId':_0x415ee3['ContactId'],'ListId':_0x415ee3[_0x935a('0xd6')],'VoiceQueueId':_0x415ee3[_0x935a('0xd7')]||undefined,'CampaignId':_0x415ee3[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x415ee3[_0x935a('0xf7')]>=_0x46f16b[_0x935a('0x1a3')]-0x1){return!![];}this[_0x935a('0xc2')]({'active':![],'countagentrejectretry':_0x415ee3[_0x935a('0xf7')]+=0x1,'scheduledat':moment()[_0x935a('0x106')](_0x46f16b[_0x935a('0x1a4')],_0x935a('0x108'))[_0x935a('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x415ee3['ContactId'],'ListId':_0x415ee3[_0x935a('0xd6')],'VoiceQueueId':_0x415ee3[_0x935a('0xd7')]||undefined,'CampaignId':_0x415ee3[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x935a('0x1a')]['callProgressDetecting']=function(_0x579566,_0xf03a89,_0x561e3c){var _0x123d52=this;var _0x6b0140=new History(_0x579566);return new BPromise(function(_0x42754d,_0x250ad0){if(_[_0x935a('0x3d')](_0xf03a89)&&typeof _0xf03a89!==_0x935a('0x168')){return _0x250ad0(msgResponse(_0x935a('0x1a5'),_0x935a('0x149'),_0x935a('0x1a6')));}if(_['isUndefined'](_0x561e3c)&&typeof _0x561e3c!==_0x935a('0x168')){return _0x250ad0(msgResponse(_0x935a('0x1a5'),'Failure','evt\x20is\x20undefine'));}switch(_0x561e3c[_0x935a('0x1a7')]){case'0':_0xf03a89['outboundNoSuchCallsDay']+=0x1;_0x6b0140[_0x935a('0xaa')]=0x0;_0x6b0140[_0x935a('0xab')]='NoSuchNumber';_0x6b0140['countnosuchnumberretry']+=0x1;_0x6b0140[_0x935a('0xf2')]+=0x1;ami['emit'](_0x935a('0x1a8'),ut[_0x935a('0xea')](_0x579566,'nosuchnumber'));_0x123d52[_0x935a('0xcd')](_0x6b0140)['catch'](loggerCatch(_0x935a('0xf3')));if(_0x123d52[_0x935a('0x1a9')](0x0,_0x579566,_0xf03a89)){if(_0x6b0140[_0x935a('0x102')]>=_0xf03a89[_0x935a('0x1aa')]){_0x123d52[_0x935a('0xfa')](_0x6b0140,_0x42754d,_0x250ad0,'reason\x200\x20no\x20such\x20number....');}else{_0x123d52[_0x935a('0x104')](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1ab'));}}break;case'3':_0xf03a89[_0x935a('0x67')]+=0x1;_0x6b0140['state']=0x3;_0x6b0140[_0x935a('0xab')]=_0x935a('0x1ac');_0x6b0140['countnoanswerretry']+=0x1;_0x6b0140[_0x935a('0xf2')]+=0x1;ami[_0x935a('0x4e')](_0x935a('0x1ad'),ut['buildObj'](_0x579566,_0x935a('0x1ae')));_0x123d52['createHistory'](_0x6b0140)['catch'](loggerCatch(_0x935a('0x1af')));if(_0x123d52[_0x935a('0x1a9')](0x3,_0x579566,_0xf03a89)){if(_0x6b0140['countnoanswerretry']>=_0xf03a89[_0x935a('0x199')]){_0x123d52[_0x935a('0xfa')](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1b0'));}else{_0x123d52[_0x935a('0x104')](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1b0'));}}break;case'5':_0xf03a89[_0x935a('0x1b1')]+=0x1;_0x6b0140['state']=0x5;_0x6b0140[_0x935a('0xab')]=_0x935a('0x1b2');_0x6b0140['countbusyretry']+=0x1;_0x6b0140['countglobal']+=0x1;ami['emit'](_0x935a('0x1b3'),ut['buildObj'](_0x579566,_0x935a('0x1b4')));_0x123d52[_0x935a('0xcd')](_0x6b0140)[_0x935a('0xb4')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x123d52['checkRetriveMax'](0x5,_0x579566,_0xf03a89)){if(_0x6b0140['countbusyretry']>=_0xf03a89['dialBusyMaxRetry']){_0x123d52[_0x935a('0xfa')](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1b5'));}else{_0x123d52[_0x935a('0x104')](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1b5'));}}break;case'8':_0xf03a89[_0x935a('0x64')]+=0x1;_0x6b0140[_0x935a('0xaa')]=0x8;_0x6b0140[_0x935a('0xab')]=_0x935a('0x1b6');_0x6b0140[_0x935a('0xf4')]+=0x1;_0x6b0140[_0x935a('0xf2')]+=0x1;ami['emit'](_0x935a('0x1b7'),ut[_0x935a('0xea')](_0x579566,_0x935a('0x1b8')));_0x123d52[_0x935a('0xcd')](_0x6b0140)[_0x935a('0xb4')](loggerCatch(_0x935a('0x1b9')));if(_0x123d52[_0x935a('0x1a9')](0x8,_0x579566,_0xf03a89)){if(_0x6b0140['countcongestionretry']>=_0xf03a89[_0x935a('0x19f')]){_0x123d52['createStateFinal'](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1ba'));}else{_0x123d52[_0x935a('0x104')](_0x6b0140,_0x42754d,_0x250ad0,'reason\x208\x20congestion');}}break;case'11':_0xf03a89['outboundAbandonedCallsDay']+=0x1;_0x6b0140['state']=0xb;_0x6b0140[_0x935a('0xab')]=_0x935a('0x124');_0x6b0140[_0x935a('0x103')]+=0x1;_0x6b0140[_0x935a('0xf2')]+=0x1;_0x123d52[_0x935a('0xcd')](_0x6b0140)[_0x935a('0xb4')](loggerCatch(_0x935a('0x12a')));if(_0x123d52[_0x935a('0x1a9')](0xb,_0x579566,_0xf03a89)){if(_0x6b0140[_0x935a('0x103')]>=_0xf03a89[_0x935a('0x127')]){_0x123d52[_0x935a('0xfa')](_0x6b0140,_0x42754d,_0x250ad0,'reason\x2011\x20abandoned');}else{_0x123d52['stateGlobal'](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1bb'));}}break;case'20':_0xf03a89[_0x935a('0x1bc')]+=0x1;_0x6b0140[_0x935a('0xaa')]=0x14;_0x6b0140['statedesc']=_0x935a('0x1bd');_0x6b0140[_0x935a('0xf7')]+=0x1;_0x6b0140[_0x935a('0xf2')]+=0x1;ami['emit'](_0x935a('0x1be'),ut[_0x935a('0xea')](_0x579566,'agentreject'));_0x123d52[_0x935a('0xcd')](_0x6b0140)[_0x935a('0xb4')](loggerCatch(_0x935a('0x1bf')));if(_0x123d52[_0x935a('0x1a9')](0x14,_0x579566,_0xf03a89)){if(_0x6b0140[_0x935a('0xf7')]>=_0xf03a89[_0x935a('0x1a3')]){_0x123d52[_0x935a('0xfa')](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1c0'));}else{_0x123d52[_0x935a('0x104')](_0x6b0140,_0x42754d,_0x250ad0,_0x935a('0x1c0'));}}break;default:_0xf03a89[_0x935a('0x6b')]+=0x1;_0x6b0140['state']=0xc;_0x6b0140[_0x935a('0xab')]=_0x561e3c[_0x935a('0x1a7')];_0x123d52['createHistory'](_0x6b0140)[_0x935a('0xb4')](loggerCatch(_0x935a('0x1c1')));if(_0x123d52[_0x935a('0x1a9')](_0x561e3c[_0x935a('0x1a7')],_0x579566,_0xf03a89)){if(_0x6b0140[_0x935a('0x101')]+_0x6b0140[_0x935a('0xf4')]+_0x6b0140[_0x935a('0xf5')]+_0x6b0140[_0x935a('0x102')]+_0x6b0140['countdropretry']+_0x6b0140['countabandonedretry']+_0x6b0140['countmachineretry']+_0x6b0140['countagentrejectretry']>=_0xf03a89[_0x935a('0xf8')]){_0x123d52[_0x935a('0x104')](_0x6b0140,_0x42754d,_0x250ad0,_0x561e3c[_0x935a('0x1a7')]);}else{_0x123d52[_0x935a('0xfa')](_0x6b0140,_0x42754d,_0x250ad0,_0x561e3c[_0x935a('0x1a7')]);}}}});};Dialer[_0x935a('0x1a')]['stateGlobal']=function(_0x2bbddb,_0x129221,_0x20d5d3,_0x4714c9){var _0x1b9536=new Final(_0x2bbddb);_0x1b9536['state']=0xf;_0x1b9536['statedesc']=_0x935a('0x1c2');this['createStateFinal'](_0x1b9536,_0x129221,_0x20d5d3,_0x4714c9);};Dialer['prototype']['createStateFinal']=function(_0x289049,_0xb2e541,_0x2e66a7,_0x20b4dc){this['moveContactManagedDialer'](_0x289049)[_0x935a('0xbb')](function(){return _0xb2e541(msgResponse('[callProgressDetecting]',_0x935a('0xda'),_0x20b4dc));})[_0x935a('0xb4')](function(){return _0x2e66a7(msgResponse(_0x935a('0x1c3'),'Failure',_0x935a('0x1c4')));});};Dialer['prototype'][_0x935a('0x8')]=function(_0x31f8c9){var _0x4a6ddc=_0x31f8c9[_0x935a('0x1c5')]/0x64;var _0x4038ef=_0x31f8c9[_0x935a('0x66')]/(_0x31f8c9[_0x935a('0x66')]+_0x31f8c9[_0x935a('0x62')]);var _0x1a19e6=Math[_0x935a('0x1c6')](_0x31f8c9[_0x935a('0x73')]*(_0x31f8c9['predictiveIntervalMaxThreshold']/0x64));var _0xaf7fb4=Math[_0x935a('0x1c6')](_0x31f8c9['predictiveIntervalAvailable']*(_0x31f8c9['predictiveIntervalMinThreshold']/0x64));var _0x3f7b88=_0x31f8c9[_0x935a('0x53')]+_0x31f8c9[_0x935a('0x59')];var _0x35c2a7=Math[_0x935a('0x1c7')](_0x31f8c9['erlangCalls']*_0x31f8c9['erlangAbandonmentRate']*_0x31f8c9[_0x935a('0x70')]*_0x31f8c9[_0x935a('0x71')]);if(_[_0x935a('0x3d')](_0x31f8c9[_0x935a('0x28')])){if(!_['isUndefined'](_0x31f8c9[_0x935a('0x27')])){_0x31f8c9['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x935a('0x1c8'));}if(!_[_0x935a('0x3d')](_0x31f8c9[_0x935a('0x90')])){loggerPredictive['error'](_0x935a('0x1c9'),_0x935a('0x1ca'));clearInterval(_0x31f8c9[_0x935a('0x90')]);_0x31f8c9[_0x935a('0x90')]=undefined;}_0x31f8c9[_0x935a('0x28')]=moment()['format'](_0x935a('0xfc'));loggerPredictive[_0x935a('0x80')](_0x31f8c9['name'],_0x935a('0x1cb'),_0x31f8c9[_0x935a('0x28')]);this['handlePower'](_0x31f8c9,0x1);}else if(ifInterval(_0x31f8c9[_0x935a('0x1cc')],_0x31f8c9['startProgressive'])){this[_0x935a('0x15a')](_0x31f8c9,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x31f8c9[_0x935a('0x28')],_0x31f8c9[_0x935a('0x40')]);_0x31f8c9[_0x935a('0x75')]=0x0;_0x31f8c9[_0x935a('0x6f')]=0x0;}else if(_0x4a6ddc<_0x4038ef&&_0x31f8c9[_0x935a('0x1cd')]===_0x935a('0x1ce')){freeVariablesPredictive(_0x31f8c9);loggerPredictive[_0x935a('0x80')](_0x935a('0x1cf'),_0x935a('0x1d0'),_0x4038ef,_0x935a('0x28'),_0x31f8c9[_0x935a('0x40')]);}else if(_0x35c2a7<_0x31f8c9[_0x935a('0x6f')]&&_0x31f8c9[_0x935a('0x1cd')]===_0x935a('0x1ce')){freeVariablesPredictive(_0x31f8c9);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x35c2a7,_0x935a('0x1d1'),_0x31f8c9[_0x935a('0x6f')],_0x935a('0x28'),_0x31f8c9['name']);}else if(!ifInterval(_0x31f8c9[_0x935a('0x1cc')],_0x31f8c9['startProgressive'])&&_['isUndefined'](_0x31f8c9[_0x935a('0x27')])&&!_[_0x935a('0x3d')](_0x31f8c9[_0x935a('0x28')])){_0x31f8c9[_0x935a('0x27')]=moment()[_0x935a('0x7b')](_0x935a('0xfc'));loggerPredictive[_0x935a('0x80')](_0x31f8c9['name'],_0x935a('0x1d2'),_0x31f8c9[_0x935a('0x27')]);this[_0x935a('0x1d3')](_0x31f8c9[_0x935a('0x1cc')])[_0x935a('0xbb')](this['getDataPredictive'](_0x31f8c9))[_0x935a('0xbb')](mergeDataErlangB(_0x31f8c9))['then'](this[_0x935a('0x1d4')](_0x31f8c9))[_0x935a('0xb4')](loggerCatchPredictive(_0x935a('0x1d5'),_0x31f8c9));}else if(!ifInterval(_0x31f8c9['dialPredictiveInterval'],_0x31f8c9[_0x935a('0x27')])){_0x31f8c9[_0x935a('0x6f')]=0x0;_0x31f8c9[_0x935a('0x27')]=moment()[_0x935a('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x935a('0x80')](_0x31f8c9[_0x935a('0x40')],_0x935a('0x1d6'),_0x31f8c9[_0x935a('0x27')]);clearInterval(_0x31f8c9[_0x935a('0x90')]);_0x31f8c9[_0x935a('0x90')]=undefined;this[_0x935a('0x1d3')](_0x31f8c9[_0x935a('0x1cc')])['then'](this[_0x935a('0x1d7')](_0x31f8c9))[_0x935a('0xbb')](mergeDataErlangB(_0x31f8c9))[_0x935a('0xbb')](this[_0x935a('0x1d4')](_0x31f8c9))[_0x935a('0xb4')](loggerCatchPredictive(_0x935a('0x1d8'),_0x31f8c9));}else if(_0x31f8c9['predictiveIntervalAvailable']&&_0x3f7b88<_0x31f8c9[_0x935a('0x73')]-_0xaf7fb4){freeVariablesPredictive(_0x31f8c9);loggerPredictive['info'](_0x31f8c9[_0x935a('0x40')],_0x935a('0x1d9'),_0x3f7b88,_0x935a('0x1da'),_0x31f8c9[_0x935a('0x73')],'-',_0xaf7fb4,'=',_0x31f8c9[_0x935a('0x73')]-_0xaf7fb4,')');}else if(_0x31f8c9[_0x935a('0x73')]&&_0x3f7b88>_0x31f8c9[_0x935a('0x73')]+_0x1a19e6){freeVariablesPredictive(_0x31f8c9);loggerPredictive['info'](_0x31f8c9[_0x935a('0x40')],_0x935a('0x1d9'),_0x3f7b88,_0x935a('0x1db'),_0x31f8c9[_0x935a('0x73')],'+',_0x1a19e6,'=',_0x31f8c9[_0x935a('0x73')]+_0x1a19e6,')');}};Dialer[_0x935a('0x1a')][_0x935a('0x1d7')]=function(_0x193c0d){var _0x4c4398=this;return function(_0x47cf0f){return new BPromise(function(_0x498015,_0x59e45d){_['merge'](_0x193c0d,_0x47cf0f[0x0]);if(checkGetDataPredictive(_0x47cf0f[0x0])){var _0x3e0703=_0x193c0d[_0x935a('0x73')]=_0x193c0d[_0x935a('0x59')]+_0x193c0d[_0x935a('0x53')];var _0x105a9d=_0x193c0d[_0x935a('0x1cc')]*0x3c;var _0x43b57e=_0x47cf0f[0x0][_0x935a('0x86')]+_0x47cf0f[0x0][_0x935a('0x6c')];var _0x2e097b=(_0x47cf0f[0x0][_0x935a('0x1dc')]+_0x47cf0f[0x0][_0x935a('0x6e')]+_0x47cf0f[0x0][_0x935a('0x6d')])/_0x47cf0f[0x0][_0x935a('0x74')];_0x193c0d[_0x935a('0x70')]=_0x2e097b>0x0?_0x2e097b:0x1;switch(_0x193c0d[_0x935a('0x1cd')]){case _0x935a('0x1ce'):var _0x32f869=_0x193c0d[_0x935a('0x1c5')]/0x64;return _0x4c4398['abandonmentRate'](_0x3e0703,_0x105a9d,_0x43b57e,_0x2e097b,_0x32f869)[_0x935a('0xbb')](function(_0x586c18){return _0x498015(_0x586c18);});case'agentBusyFactor':var _0x401fec=_0x193c0d[_0x935a('0x1c5')]/0x64;return _0x4c4398[_0x935a('0x1dd')](_0x3e0703,_0x105a9d,_0x43b57e,_0x2e097b,_0x401fec)[_0x935a('0xbb')](function(_0x12cfcd){return _0x498015(_0x12cfcd);});default:return _0x59e45d(msgResponse(_0x935a('0x1de'),'Failure',_0x935a('0x1df')));}}else{return _0x59e45d(msgResponse(_0x935a('0x1de'),_0x935a('0x149'),_0x935a('0x1e0')));}});};};Dialer[_0x935a('0x1a')]['getDataPredictiveOld']=function(_0x3fdd0b){var _0x23cdbe=this;return function(_0x5a2dfa){return new BPromise(function(_0x27ea88,_0x1b562e){_[_0x935a('0x8f')](_0x3fdd0b,_0x5a2dfa[0x0]);if(checkGetDataPredictive(_0x5a2dfa[0x0])){loggerPredictive[_0x935a('0x80')](JSON[_0x935a('0x4a')](_0x5a2dfa[0x0]));if(_0x3fdd0b[_0x935a('0x1cd')]==='dropRate'){return _0x23cdbe['getVoiceQueueRtPauses'](_0x3fdd0b['id'])[_0x935a('0xbb')](function(_0x292b7a){var _0x5a735f=_0x3fdd0b[_0x935a('0x54')]-_0x292b7a[0x0][_0x935a('0x1e1')];var _0x688014=_0x3fdd0b[_0x935a('0x1cc')]*0x3c;var _0x5ecbb5=_0x5a2dfa[0x0][_0x935a('0x86')]+_0x5a2dfa[0x0]['predictiveIntervalAvgHoldtime'];var _0x8607ad=(_0x5a2dfa[0x0]['predictiveIntervalAnsweredCalls']+_0x5a2dfa[0x0][_0x935a('0x6e')]+_0x5a2dfa[0x0][_0x935a('0x6d')])/_0x5a2dfa[0x0]['predictiveIntervalTotalCalls'];var _0x1fba41=_0x3fdd0b['dialPredictiveOptimizationPercentage']/0x64;_0x3fdd0b[_0x935a('0x72')]=_0x292b7a[0x0]['outboundQueuePauses']||0x0;_0x3fdd0b[_0x935a('0x70')]=_0x8607ad>0x0?_0x8607ad:0x1;return _0x23cdbe['abandonmentRate'](_0x5a735f,_0x688014,_0x5ecbb5,_0x8607ad,_0x1fba41);})['then'](function(_0x3a8b4c){return _0x27ea88(_0x3a8b4c);})[_0x935a('0xb4')](function(_0x57194d){return _0x1b562e(msgResponse('[CatchErlangB]',_0x935a('0x149'),JSON[_0x935a('0x4a')](_0x57194d)));});}if(_0x3fdd0b[_0x935a('0x1cd')]===_0x935a('0x1e2')){return _0x23cdbe['getVoiceQueueRtPauses'](_0x3fdd0b['id'])[_0x935a('0xbb')](function(_0xbfb472){var _0x59a3e6=_0x3fdd0b[_0x935a('0x54')]-_0xbfb472[0x0][_0x935a('0x1e1')];var _0x2daedf=_0x3fdd0b['dialPredictiveInterval']*0x3c;var _0x1b5362=_0x5a2dfa[0x0]['predictiveIntervalAvgTalktime']+_0x5a2dfa[0x0][_0x935a('0x6c')];var _0x1382c2=(_0x5a2dfa[0x0][_0x935a('0x1dc')]+_0x5a2dfa[0x0][_0x935a('0x6e')]+_0x5a2dfa[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5a2dfa[0x0][_0x935a('0x74')];var _0x296d97=_0x3fdd0b[_0x935a('0x1c5')]/0x64;_0x3fdd0b[_0x935a('0x72')]=_0xbfb472[0x0][_0x935a('0x1e1')]||0x0;_0x3fdd0b[_0x935a('0x70')]=_0x1382c2>0x0?_0x1382c2:0x1;return _0x23cdbe[_0x935a('0x1dd')](_0x59a3e6,_0x2daedf,_0x1b5362,_0x1382c2,_0x296d97);})[_0x935a('0xbb')](function(_0x34962c){return _0x27ea88(_0x34962c);})['catch'](function(_0x1fc804){return _0x1b562e(msgResponse(_0x935a('0x1e3'),'Failure',JSON[_0x935a('0x4a')](_0x1fc804)));});}}else{return _0x1b562e(msgResponse('[getDataPredictive]',_0x935a('0x149'),_0x935a('0x1e0')));}});};};Dialer['prototype'][_0x935a('0x1d4')]=function(_0x3c404b){var _0x30cf80=this;return function(){var _0x483525=0x0;var _0x567b9b=Math[_0x935a('0x1c7')](_0x3c404b[_0x935a('0x1e4')]*0x3e8);if(_0x567b9b>0x0){_0x567b9b=_0x567b9b<0x64?0x64:_0x567b9b;loggerPredictive[_0x935a('0x80')](_0x3c404b[_0x935a('0x40')],_0x935a('0x1e5'),_0x567b9b,_0x935a('0x4b'));_0x3c404b[_0x935a('0x90')]=setInterval(function(){_0x30cf80['handlePredictive'](_0x3c404b);loggerPredictiveCalls[_0x935a('0x80')](_0x935a('0x1e6'),_0x483525+=0x1);},_0x567b9b);}else{loggerPredictive[_0x935a('0x80')](_0x3c404b['name'],_0x935a('0x1e7'));}};};Dialer[_0x935a('0x1a')]['checkContactBlack']=function(_0x22cdb8,_0x53bf05){var _0xf570a=this;return function(_0x28b36d){if(_['isEmpty'](_0x28b36d)){if(_['isNil'](_0x53bf05['UserId'])||!_0x53bf05['recallme']){if(_0x22cdb8[_0x935a('0x158')]===_0x935a('0x7')){_0x22cdb8[_0x935a('0x132')]=_[_0x935a('0x3d')](_0x22cdb8[_0x935a('0x132')])?!![]:_0x22cdb8[_0x935a('0x132')];var _0x5d1010=uuid['v4']();_0xf570a[_0x935a('0xaf')][_0x5d1010]=new Action(_0x22cdb8,_0x53bf05,_0x5d1010);loggerBooked[_0x935a('0x80')](_0x935a('0x1e8'),_0x5d1010,_0x935a('0x1e9'),JSON[_0x935a('0x4a')](_0x22cdb8[_0x935a('0x132')]),_0x935a('0x1ea'),_0x22cdb8[_0x935a('0x40')]);if(_0x22cdb8['queueStatusComplete']){_0x22cdb8[_0x935a('0x132')]=![];_0xf570a[_0x935a('0x2a')][_0xf570a['actions'][_0x5d1010][_0x935a('0xb6')]]=[];ami[_0x935a('0x150')]({'actionid':_0x5d1010,'action':_0x935a('0x1eb'),'queue':_0x22cdb8[_0x935a('0x40')]})[_0x935a('0xb4')](function(){_0xf570a[_0x935a('0xce')](_0x22cdb8);_0xf570a['rescheduleContact']({'active':![],'ContactId':_0xf570a[_0x935a('0xaf')][_0x5d1010]['ContactId'],'ListId':_0xf570a[_0x935a('0xaf')][_0x5d1010]['ListId'],'VoiceQueueId':_0xf570a[_0x935a('0xaf')][_0x5d1010][_0x935a('0xd7')]||undefined,'CampaignId':_0xf570a[_0x935a('0xaf')][_0x5d1010][_0x935a('0xd8')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xf570a[_0x935a('0xaf')][_0x5d1010];});}else{loggerBooked[_0x935a('0x80')]('[booked][checkContactBlack][else]',JSON[_0x935a('0x4a')](_0x22cdb8[_0x935a('0x132')]),'Queue:\x20',_0x22cdb8[_0x935a('0x40')]);_0xf570a[_0x935a('0xce')](_0x22cdb8);_0xf570a[_0x935a('0xc2')]({'active':![],'ContactId':_0xf570a[_0x935a('0xaf')][_0x5d1010]['ContactId'],'ListId':_0xf570a['actions'][_0x5d1010][_0x935a('0xd6')],'VoiceQueueId':_0xf570a[_0x935a('0xaf')][_0x5d1010][_0x935a('0xd7')]||undefined,'CampaignId':_0xf570a[_0x935a('0xaf')][_0x5d1010][_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0x1ec')));delete _0xf570a[_0x935a('0xaf')][_0x5d1010];}}else{return _0xf570a[_0x935a('0x167')](_0x22cdb8,_0x53bf05);}}else{if(getDiff(_0x53bf05[_0x935a('0x1ed')])<_0x22cdb8[_0x935a('0x1ee')]*0x3c){if(_0x53bf05[_0x935a('0x1ef')]&&!_0x53bf05[_0x935a('0x1ef')]['voicePause']){_0xf570a['preview'][_0x935a('0x135')](_0x53bf05['id'])[_0x935a('0x1d')](function(){_0xf570a[_0x935a('0xce')](_0x22cdb8);});}else{_0xf570a[_0x935a('0x1f0')]({'active':![]},_0x53bf05['id'],0x1)[_0x935a('0x1d')](function(){_0xf570a[_0x935a('0xce')](_0x22cdb8);});}}else{_0x22cdb8['outboundReCallsDay']+=0x1;_0xf570a[_0x935a('0xce')](_0x22cdb8);if(_0x22cdb8[_0x935a('0x1f1')]){_0xf570a[_0x935a('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x53bf05[_0x935a('0xd5')],'ListId':_0x53bf05[_0x935a('0xd6')],'VoiceQueueId':_0x53bf05[_0x935a('0xd7')]||undefined,'CampaignId':_0x53bf05[_0x935a('0xd8')]||undefined})[_0x935a('0xb4')](loggerCatch(_0x935a('0x1f2')));_0xf570a[_0x935a('0xcd')](createObjHistory(_0x22cdb8,_0x53bf05,_0x935a('0x1f3'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x935a('0x1f4')));}else{_0xf570a[_0x935a('0xdf')](createObjHistory(_0x22cdb8,_0x53bf05,_0x935a('0x1f5'),0x16,_0x935a('0x1f6')),_0x935a('0x1f7'),_0x935a('0x1f8'));}}}}else{_0x22cdb8[_0x935a('0x63')]+=0x1;_0xf570a['saveInDb'](createObjHistory(_0x22cdb8,_0x53bf05,_0x935a('0x1f9'),0xd,'Blacklist'),_0x935a('0x1fa'),'[Originate][MoveBlacklist]');throw _0x935a('0x1fb');}};};Dialer[_0x935a('0x1a')]['handleIvr']=function(_0x337362){var _0x33fac1=this;var _0x1e607d=_0x337362[_0x935a('0x1fc')]-_0x337362[_0x935a('0x9a')]-_0x337362[_0x935a('0xc6')];emitCampaignSummary(_0x337362);if(_0x1e607d>0x0){if(_0x1e607d>this[_0x935a('0x23')]){_0x1e607d=this[_0x935a('0x23')];}_0x337362[_0x935a('0xc6')]+=_0x1e607d;this['getContactDialerIvr'](_0x337362['id'],_0x1e607d,_0x337362['dialOrderByScheduledAt'],_0x337362)[_0x935a('0xbb')](function(_0x3a8052){_0x337362[_0x935a('0xc6')]-=_0x1e607d;_0x337362[_0x935a('0xc6')]=_0x337362[_0x935a('0xc6')]>0x0?_0x337362[_0x935a('0xc6')]:0x0;if(!checkContactEmpty(_0x3a8052)){_0x337362[_0x935a('0x3e')]=_0x935a('0x1fd');logger[_0x935a('0x80')](_0x935a('0x1fe')+_0x337362[_0x935a('0x40')]);}else{_0x337362[_0x935a('0x9a')]+=_0x3a8052[_0x935a('0x99')];_0x337362[_0x935a('0x3e')]=_0x935a('0x1ff');for(var _0x3dbbc7=0x0;_0x3dbbc7<_0x3a8052['length'];_0x3dbbc7+=0x1){_0x337362[_0x935a('0x200')]+=0x1;if(_[_0x935a('0xb2')](_0x3a8052[_0x3dbbc7])||_[_0x935a('0xb2')](_0x3a8052[_0x3dbbc7][_0x935a('0x184')])||_[_0x935a('0xb2')](_0x3a8052[_0x3dbbc7][_0x935a('0x184')][_0x935a('0x16b')])){_0x33fac1[_0x935a('0xd2')]('[actionOriginate]\x20',_0x337362,_0x3a8052[_0x3dbbc7]);}else{_0x33fac1[_0x935a('0xbf')](_[_0x935a('0xd4')](_0x3a8052[_0x3dbbc7],['CampaignId',_0x935a('0x201')]))[_0x935a('0xbb')](_0x33fac1[_0x935a('0x202')](_0x337362,_0x3a8052[_0x3dbbc7]))[_0x935a('0xb4')](_0x33fac1[_0x935a('0xd1')](_0x935a('0x203'),_0x337362));}}}})['catch'](loggerGetContactDialer(_0x935a('0x204'),_0x337362,_0x1e607d));}};Dialer['prototype'][_0x935a('0x15a')]=function(_0x500780,_0x1b4a26){var _0x164001=this;var _0x39f049=[];var _0xfe83e0=_0x1b4a26>=0x1?_0x1b4a26:0x1;if(_0x500780[_0x935a('0x158')]===_0x935a('0x7')){_0xfe83e0=0x1;}var _0x198b55=Math[_0x935a('0x1c7')](_0x500780[_0x935a('0x53')]*_0xfe83e0)-_0x500780[_0x935a('0x9a')]-_0x500780[_0x935a('0xc6')];emitVoiceQueueSummary(_0x500780);if(_0x500780['dialLimitQueue']>0x0){var _0x33d118=_0x500780[_0x935a('0x205')]-_0x500780[_0x935a('0x9a')]-_0x500780['talking']-_0x500780['temp']-_0x500780[_0x935a('0x55')];if(_0x198b55>_0x33d118){_0x198b55=_0x33d118;}}if(_0x198b55>0x0){if(_0x500780[_0x935a('0x158')]===_0x935a('0x7')){_0x198b55=0x1;}if(_0x198b55>this[_0x935a('0x23')]){_0x198b55=this[_0x935a('0x23')];}_0x500780[_0x935a('0xc6')]+=_0x198b55;for(var _0x17537d in this[_0x935a('0x21')]){if(typeof this[_0x935a('0x21')][_0x17537d]!==_0x935a('0x9b')){if(this['agents'][_0x17537d][_0x935a('0xaa')]==='not_inuse'&&this[_0x935a('0x21')][_0x17537d][_0x935a('0xdc')]===_0x935a('0xdd')){_0x39f049[_0x935a('0x130')](this[_0x935a('0x21')][_0x17537d]['id']);}}}this[_0x935a('0xc5')](_0x500780['id'],_0x39f049,_0x198b55,_0x500780[_0x935a('0x206')],_0x500780)[_0x935a('0xbb')](function(_0xe58ae8){_0x500780[_0x935a('0xc6')]-=_0x198b55;_0x500780[_0x935a('0xc6')]=_0x500780[_0x935a('0xc6')]>0x0?_0x500780[_0x935a('0xc6')]:0x0;if(!checkContactEmpty(_0xe58ae8)){_0x164001[_0x935a('0xb9')](_0x500780)[_0x935a('0xbb')](sendMessageReschedule(_0x500780))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x500780[_0x935a('0x9a')]+=_0xe58ae8[_0x935a('0x99')];_0x500780['message']=_0x500780['dialMethod']===_0x935a('0x7')?_0x935a('0x172'):_0x935a('0x1ff');for(var _0x57ab2c=0x0;_0x57ab2c<_0xe58ae8['length'];_0x57ab2c+=0x1){if(_[_0x935a('0xb2')](_0xe58ae8[_0x57ab2c])||_[_0x935a('0xb2')](_0xe58ae8[_0x57ab2c][_0x935a('0x184')])||_[_0x935a('0xb2')](_0xe58ae8[_0x57ab2c][_0x935a('0x184')][_0x935a('0x16b')])){_0x164001[_0x935a('0xd2')](_0x935a('0x207'),_0x500780,_0xe58ae8[_0x57ab2c]);}else{_0x164001[_0x935a('0xbd')](_['pick'](_0xe58ae8[_0x57ab2c],[_0x935a('0xd7'),_0x935a('0x201')]))[_0x935a('0xbb')](_0x164001[_0x935a('0x202')](_0x500780,_0xe58ae8[_0x57ab2c]))[_0x935a('0xb4')](_0x164001[_0x935a('0xd1')](_0x935a('0x207'),_0x500780));}}}})[_0x935a('0xb4')](loggerGetContactDialer(_0x935a('0x208'),_0x500780,_0x198b55));}};Dialer[_0x935a('0x1a')][_0x935a('0x90')]=function(_0x39f6d6){if(_0x39f6d6['dialLimitQueue']>0x0){var _0x5da740=_0x39f6d6['dialLimitQueue']-_0x39f6d6[_0x935a('0x9a')]-_0x39f6d6[_0x935a('0x59')];if(_0x5da740>0x0){this['tryOriginatePredictive'](_0x39f6d6);}else{loggerPredictiveCalls[_0x935a('0x80')]('[handlePredictive][limitChannel]');}}else{this[_0x935a('0x209')](_0x39f6d6);}};Dialer[_0x935a('0x1a')][_0x935a('0x209')]=function(_0x476e88){var _0x336676=this;var _0x1bd72b=[];_0x476e88[_0x935a('0x9a')]+=0x1;for(var _0xc8948b in this[_0x935a('0x21')]){if(typeof this[_0x935a('0x21')][_0xc8948b]!==_0x935a('0x9b')){if(this[_0x935a('0x21')][_0xc8948b][_0x935a('0xaa')]===_0x935a('0x20a')&&this['agents'][_0xc8948b][_0x935a('0xdc')]===_0x935a('0xdd')){_0x1bd72b[_0x935a('0x130')](this[_0x935a('0x21')][_0xc8948b]['id']);}}}this[_0x935a('0xc5')](_0x476e88['id'],_0x1bd72b,0x1,_0x476e88[_0x935a('0x206')],_0x476e88)[_0x935a('0xbb')](function(_0x403d0c){if(!checkContactEmpty(_0x403d0c)){checkContactLowerLimitOriginate(_0x476e88,0x1,0x0);_0x336676['countReScheduled'](_0x476e88)[_0x935a('0xbb')](sendMessageReschedule(_0x476e88))[_0x935a('0xb4')](loggerCatch(_0x935a('0xbc')));}else{_0x476e88[_0x935a('0x3e')]=_0x935a('0x1ff');if(_[_0x935a('0xb2')](_0x403d0c[0x0])||_[_0x935a('0xb2')](_0x403d0c[0x0][_0x935a('0x184')])||_['isNil'](_0x403d0c[0x0][_0x935a('0x184')][_0x935a('0x16b')])){_0x336676[_0x935a('0xd2')](_0x935a('0x207'),_0x476e88,_0x403d0c[0x0]);}else{_0x336676[_0x935a('0xbd')](_[_0x935a('0xd4')](_0x403d0c[0x0],[_0x935a('0xd7'),_0x935a('0x201')]))['then'](_0x336676[_0x935a('0x202')](_0x476e88,_0x403d0c[0x0]))[_0x935a('0xb4')](_0x336676[_0x935a('0xd1')](_0x935a('0x20b'),_0x476e88));}}})[_0x935a('0xb4')](loggerGetContactDialer(_0x935a('0x20c'),_0x476e88,0x1));emitVoiceQueueSummary(_0x476e88);};Dialer['prototype']['abandonmentRate']=function(_0x41424d,_0x45083f,_0x17be59,_0x44074f,_0x50e0cf,_0x37171c){loggerPredictive[_0x935a('0x80')](_0x935a('0x20d'));loggerPredictive['info'](_0x935a('0x20e'),_0x41424d);loggerPredictive[_0x935a('0x80')](_0x935a('0x20f'),_0x45083f);loggerPredictive[_0x935a('0x80')](_0x935a('0x210'),_0x17be59);loggerPredictive[_0x935a('0x80')](_0x935a('0x211'),_0x44074f);loggerPredictive[_0x935a('0x80')](_0x935a('0x212'),_0x50e0cf);loggerPredictive['info'](_0x935a('0x87'));return new BPromise(function(_0x338aac,_0xdc0b5b){if(_0x41424d<=0x0||isNaN(_0x41424d)){return _0xdc0b5b(msgResponse(_0x935a('0x213'),_0x935a('0x49'),_0x935a('0x214')+_0x41424d));}if(_0x17be59<=0x0||isNaN(_0x17be59)){return _0xdc0b5b(msgResponse(_0x935a('0x213'),_0x935a('0x49'),_0x935a('0x215')+_0x17be59));}if(_0x44074f<=0x0||isNaN(_0x44074f)){return _0xdc0b5b(msgResponse(_0x935a('0x213'),'Error',_0x935a('0x216')+_0x44074f));}if(_0x45083f<=0x0||isNaN(_0x45083f)){return _0xdc0b5b(msgResponse('[abandonmentRate]','Error',_0x935a('0x217')+_0x45083f));}if(_0x50e0cf<=0x0||isNaN(_0x50e0cf)){return _0xdc0b5b(msgResponse(_0x935a('0x213'),_0x935a('0x49'),_0x935a('0x218')+_0x50e0cf));}_0x37171c=_0x37171c||0x0;var _0x252f78=0x1/_0x17be59;var _0x3666af=0x0;var _0x244ee0=0x0;var _0x274bcb=0x0;var _0x232974=0x0;for(var _0x46027d=0x0;_0x274bcb<_0x50e0cf;_0x46027d+=0x1){_0x244ee0=_0x46027d/_0x45083f;_0x3666af=(_0x44074f*_0x244ee0+_0x37171c)/_0x252f78;_0x274bcb=erlangb(_0x3666af,_0x41424d);_0x232974=_0x3666af/_0x41424d*(0x1-erlangb(_0x3666af,_0x41424d));}return _0x338aac({'erlangCalls':_0x46027d,'erlangCallToSecond':_0x45083f/_0x46027d,'erlangAbandonmentRate':_0x274bcb,'erlangBusyFactor':_0x232974});});};Dialer[_0x935a('0x1a')][_0x935a('0x1dd')]=function(_0x46a273,_0x306358,_0x42f411,_0x78746d,_0x923c8,_0x1184c9){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x935a('0x80')](_0x935a('0x20e'),_0x46a273);loggerPredictive[_0x935a('0x80')](_0x935a('0x20f'),_0x306358);loggerPredictive['info'](_0x935a('0x210'),_0x42f411);loggerPredictive[_0x935a('0x80')](_0x935a('0x211'),_0x78746d);loggerPredictive['info'](_0x935a('0x219'),_0x923c8);loggerPredictive[_0x935a('0x80')](_0x935a('0x87'));return new BPromise(function(_0x3fd796,_0x5832c2){if(_0x46a273<=0x0||isNaN(_0x46a273)){return _0x5832c2(msgResponse(_0x935a('0x21a'),_0x935a('0x49'),_0x935a('0x214')+_0x46a273));}if(_0x42f411<=0x0||isNaN(_0x42f411)){return _0x5832c2(msgResponse(_0x935a('0x21a'),'Error','Ts\x20=\x20'+_0x42f411));}if(_0x78746d<=0x0||isNaN(_0x78746d)){return _0x5832c2(msgResponse(_0x935a('0x21a'),'Error',_0x935a('0x216')+_0x78746d));}if(_0x306358<=0x0||isNaN(_0x306358)){return _0x5832c2(msgResponse('[busyFactor]',_0x935a('0x49'),'interval\x20=\x20'+_0x306358));}if(_0x923c8<=0x0||isNaN(_0x923c8)){return _0x5832c2(msgResponse(_0x935a('0x21a'),_0x935a('0x49'),_0x935a('0x21b')+_0x923c8));}_0x1184c9=_0x1184c9||0x0;var _0x9a3197=0x1/_0x42f411;var _0x40a377=0x0;var _0x27a5c2=0x0;var _0x17df92=0x0;var _0x343b7b=0x0;for(var _0x2daec7=0x0;_0x343b7b<_0x923c8;_0x2daec7+=0x1){_0x27a5c2=_0x2daec7/_0x306358;_0x40a377=(_0x78746d*_0x27a5c2+_0x1184c9)/_0x9a3197;_0x17df92=erlangb(_0x40a377,_0x46a273);_0x343b7b=_0x40a377/_0x46a273*(0x1-erlangb(_0x40a377,_0x46a273));}return _0x3fd796({'erlangCalls':_0x2daec7,'erlangCallToSecond':_0x306358/_0x2daec7,'erlangAbandonmentRate':_0x17df92,'erlangBusyFactor':_0x343b7b});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4af2773..68703ef 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfce5=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xfce5,0x1d5));var _0x5fce=function(_0x3926ba,_0x237901){_0x3926ba=_0x3926ba-0x0;var _0x18756e=_0xfce5[_0x3926ba];return _0x18756e;};'use strict';var util=require(_0x5fce('0x0'));var _=require(_0x5fce('0x1'));var moment=require(_0x5fce('0x2'));function getSeconds(_0x3ed57b,_0x4e1e3b){var _0x33bbff=moment(_0x3ed57b)[_0x5fce('0x3')](0x0);var _0x41f7c4=moment(_0x4e1e3b)['milliseconds'](0x0);return _0x33bbff[_0x5fce('0x4')](_0x41f7c4,_0x5fce('0x5'));}function QueueCallerAbandon(_0x17fa26,_0x3a1256){this['scheduledat']=_0x17fa26[_0x5fce('0x6')];this[_0x5fce('0x7')]=_0x17fa26[_0x5fce('0x7')];this[_0x5fce('0x8')]=_0x17fa26[_0x5fce('0x7')]==='outbound'?'queue':_0x17fa26[_0x5fce('0x7')];this[_0x5fce('0x9')]=_0x17fa26[_0x5fce('0x9')];this['countcongestionretry']=_0x17fa26['countcongestionretry'];this['countnoanswerretry']=_0x17fa26[_0x5fce('0xa')];this[_0x5fce('0xb')]=_0x17fa26[_0x5fce('0x9')]+_0x17fa26[_0x5fce('0xc')]+_0x17fa26[_0x5fce('0xa')]+_0x17fa26[_0x5fce('0xd')]+_0x17fa26[_0x5fce('0xe')]+_0x17fa26[_0x5fce('0xf')]+_0x17fa26[_0x5fce('0x10')]+_0x17fa26[_0x5fce('0x11')];this['countnosuchnumberretry']=_0x17fa26[_0x5fce('0xd')];this[_0x5fce('0xe')]=_0x17fa26[_0x5fce('0xe')];this[_0x5fce('0xf')]=_0x17fa26[_0x5fce('0xf')];this['countmachineretry']=_0x17fa26[_0x5fce('0x10')];this['countagentrejectretry']=_0x17fa26['countagentrejectretry'];this[_0x5fce('0x12')]=_0x3a1256[_0x5fce('0x12')];this[_0x5fce('0x13')]=_0x17fa26[_0x5fce('0x14')];this[_0x5fce('0x15')]=_0x17fa26['number'];this[_0x5fce('0x16')]=_0x17fa26[_0x5fce('0x16')];this[_0x5fce('0x17')]=_0x17fa26['responsetime'];this['droptime']=_0x17fa26[_0x5fce('0x18')];this[_0x5fce('0x19')]=this[_0x5fce('0x18')];this[_0x5fce('0x1a')]=getSeconds(_0x17fa26['responsetime'],_0x17fa26[_0x5fce('0x16')]);this[_0x5fce('0x1b')]=getSeconds(this[_0x5fce('0x18')],_0x17fa26[_0x5fce('0x17')]);this[_0x5fce('0x1c')]=0x0;this['queue']=_0x3a1256['queue'];this[_0x5fce('0x1d')]=_0x3a1256[_0x5fce('0x1e')];this[_0x5fce('0x1f')]=_0x3a1256[_0x5fce('0x1f')];this[_0x5fce('0x20')]=_0x17fa26[_0x5fce('0x20')];this[_0x5fce('0x21')]=_0x17fa26[_0x5fce('0x21')];this['callbackat']=_0x17fa26[_0x5fce('0x22')];this[_0x5fce('0x23')]=_0x17fa26[_0x5fce('0x23')];this['ContactId']=_0x17fa26[_0x5fce('0x24')];this[_0x5fce('0x25')]=_0x17fa26[_0x5fce('0x25')];this[_0x5fce('0x26')]=_0x17fa26['UserId'];this[_0x5fce('0x27')]=_0x17fa26[_0x5fce('0x27')];this[_0x5fce('0x28')]=_0x17fa26[_0x5fce('0x28')];this[_0x5fce('0x29')]=_0x17fa26[_0x5fce('0x29')]||'';this['originatecalleridname']=_0x17fa26[_0x5fce('0x2a')]||'';}module[_0x5fce('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x4677=['countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x5265a3,_0x1b3d13){var _0x53c1da=function(_0x5e0be7){while(--_0x5e0be7){_0x5265a3['push'](_0x5265a3['shift']());}};_0x53c1da(++_0x1b3d13);}(_0x4677,0x159));var _0x7467=function(_0x3df803,_0x5ce908){_0x3df803=_0x3df803-0x0;var _0x19d25e=_0x4677[_0x3df803];return _0x19d25e;};'use strict';var util=require('util');var _=require(_0x7467('0x0'));var moment=require('moment');function getSeconds(_0x40d3dc,_0x28a384){var _0x59cd23=moment(_0x40d3dc)[_0x7467('0x1')](0x0);var _0x3386b8=moment(_0x28a384)[_0x7467('0x1')](0x0);return _0x59cd23[_0x7467('0x2')](_0x3386b8,_0x7467('0x3'));}function QueueCallerAbandon(_0x5a00d9,_0x1683ef){this[_0x7467('0x4')]=_0x5a00d9[_0x7467('0x4')];this['type']=_0x5a00d9[_0x7467('0x5')];this[_0x7467('0x6')]=_0x5a00d9[_0x7467('0x5')]==='outbound'?_0x7467('0x7'):_0x5a00d9[_0x7467('0x5')];this['countbusyretry']=_0x5a00d9['countbusyretry'];this[_0x7467('0x8')]=_0x5a00d9[_0x7467('0x8')];this[_0x7467('0x9')]=_0x5a00d9[_0x7467('0x9')];this[_0x7467('0xa')]=_0x5a00d9['countbusyretry']+_0x5a00d9[_0x7467('0x8')]+_0x5a00d9[_0x7467('0x9')]+_0x5a00d9[_0x7467('0xb')]+_0x5a00d9['countdropretry']+_0x5a00d9[_0x7467('0xc')]+_0x5a00d9[_0x7467('0xd')]+_0x5a00d9[_0x7467('0xe')];this[_0x7467('0xb')]=_0x5a00d9[_0x7467('0xb')];this[_0x7467('0xf')]=_0x5a00d9[_0x7467('0xf')];this['countabandonedretry']=_0x5a00d9[_0x7467('0xc')];this[_0x7467('0xd')]=_0x5a00d9[_0x7467('0xd')];this['countagentrejectretry']=_0x5a00d9['countagentrejectretry'];this[_0x7467('0x10')]=_0x1683ef[_0x7467('0x10')];this[_0x7467('0x11')]=_0x5a00d9['name'];this[_0x7467('0x12')]=_0x5a00d9[_0x7467('0x13')];this[_0x7467('0x14')]=_0x5a00d9[_0x7467('0x14')];this[_0x7467('0x15')]=_0x5a00d9[_0x7467('0x15')];this[_0x7467('0x16')]=_0x5a00d9[_0x7467('0x16')];this[_0x7467('0x17')]=this[_0x7467('0x16')];this[_0x7467('0x18')]=getSeconds(_0x5a00d9[_0x7467('0x15')],_0x5a00d9[_0x7467('0x14')]);this[_0x7467('0x19')]=getSeconds(this[_0x7467('0x16')],_0x5a00d9[_0x7467('0x15')]);this[_0x7467('0x1a')]=0x0;this['queue']=_0x1683ef[_0x7467('0x7')];this['membername']=_0x1683ef[_0x7467('0x1b')];this['reason']=_0x1683ef[_0x7467('0x1c')];this[_0x7467('0x1d')]=_0x5a00d9['callback'];this[_0x7467('0x1e')]=_0x5a00d9[_0x7467('0x1e')];this[_0x7467('0x1f')]=_0x5a00d9[_0x7467('0x1f')];this[_0x7467('0x20')]=_0x5a00d9[_0x7467('0x20')];this[_0x7467('0x21')]=_0x5a00d9[_0x7467('0x21')];this[_0x7467('0x22')]=_0x5a00d9[_0x7467('0x22')];this[_0x7467('0x23')]=_0x5a00d9[_0x7467('0x23')];this[_0x7467('0x24')]=_0x5a00d9[_0x7467('0x24')];this[_0x7467('0x25')]=_0x5a00d9[_0x7467('0x25')];this['originatecalleridnum']=_0x5a00d9['originatecalleridnum']||'';this['originatecalleridname']=_0x5a00d9[_0x7467('0x26')]||'';}module[_0x7467('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1150f3f..8963d37 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(_0x2fadfb,_0x32c6ed){var _0xdb2b36=function(_0x2737b5){while(--_0x2737b5){_0x2fadfb['push'](_0x2fadfb['shift']());}};_0xdb2b36(++_0x32c6ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x57a8a9,_0x145001){var _0x13aa00=function(_0x2d85fd){while(--_0x2d85fd){_0x57a8a9['push'](_0x57a8a9['shift']());}};_0x13aa00(++_0x145001);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 3870f6d..dd3939c 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 _0x87f2=['from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','application/pdf','then','.pdf','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','Trunk','format','parse','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','util','lodash','uuid','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context'];(function(_0x9701,_0x1e6447){var _0x15b6d8=function(_0x419d34){while(--_0x419d34){_0x9701['push'](_0x9701['shift']());}};_0x15b6d8(++_0x1e6447);}(_0x87f2,0xbd));var _0x287f=function(_0x594d31,_0x8ef2e3){_0x594d31=_0x594d31-0x0;var _0x5e54ab=_0x87f2[_0x594d31];return _0x5e54ab;};'use strict';var util=require(_0x287f('0x0'));var _=require(_0x287f('0x1'));var BPromise=require('bluebird');var uuid=require(_0x287f('0x2'));var moment=require('moment');var path=require(_0x287f('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x287f('0x4'));var logger=require(_0x287f('0x5'))(_0x287f('0x6'));var ami=require('../ami');var rpcDb=require(_0x287f('0x7'));var Channel=require(_0x287f('0x8'));var ut=require(_0x287f('0x9'));var Action=require(_0x287f('0xa'));var faxAccount=require(_0x287f('0xb'));var attachment=require(_0x287f('0xc'));var faxMessage=require(_0x287f('0xd'));function Fax(_0x25da17){this[_0x287f('0xe')]={};this[_0x287f('0xf')]=_0x25da17[_0x287f('0xf')];this[_0x287f('0x10')]=_0x25da17[_0x287f('0x10')];this['actions']={};ami['on']('newchannel',this[_0x287f('0x11')][_0x287f('0x12')](this));ami['on']('varset',this[_0x287f('0x13')][_0x287f('0x12')](this));ami['on'](_0x287f('0x14'),this[_0x287f('0x15')][_0x287f('0x12')](this));ami['on'](_0x287f('0x16'),this['syncNewExten'][_0x287f('0x12')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x287f('0x12')](this));ami['on'](_0x287f('0x17'),this[_0x287f('0x18')][_0x287f('0x12')](this));ami['on'](_0x287f('0x19'),this[_0x287f('0x1a')]['bind'](this));ami['on'](_0x287f('0x1b'),this[_0x287f('0x1c')][_0x287f('0x12')](this));}Fax[_0x287f('0x1d')]['syncNewchannel']=function(_0x4c8c18){if(_0x4c8c18[_0x287f('0x1e')]===_0x287f('0x1f')){for(var _0x43cfdd in this[_0x287f('0xf')]){if(this['faxAccounts'][_0x287f('0x20')](_0x43cfdd)){if(_0x4c8c18[_0x287f('0x21')]===this[_0x287f('0xf')][_0x43cfdd][_0x287f('0x22')]){this[_0x287f('0xe')][_0x4c8c18[_0x287f('0x23')]]={};this[_0x287f('0xe')][_0x4c8c18[_0x287f('0x23')]]['channel']=_0x4c8c18[_0x287f('0x24')];this[_0x287f('0xe')][_0x4c8c18[_0x287f('0x23')]]['id']=this[_0x287f('0xf')][_0x43cfdd]['id'];this[_0x287f('0xe')][_0x4c8c18['uniqueid']]['name']=this['faxAccounts'][_0x43cfdd][_0x287f('0x25')];logger[_0x287f('0x26')](_0x4c8c18[_0x287f('0x23')],_0x287f('0x27'));}}}}if(this[_0x287f('0x28')][_0x4c8c18[_0x287f('0x23')]]){this[_0x287f('0xe')][_0x4c8c18[_0x287f('0x23')]]={};this[_0x287f('0xe')][_0x4c8c18['uniqueid']][_0x287f('0x24')]=_0x4c8c18['channel'];logger['info'](_0x4c8c18[_0x287f('0x23')],_0x287f('0x27'));}};Fax[_0x287f('0x1d')][_0x287f('0x13')]=function(_0x49903a){if(this[_0x287f('0xe')][_0x49903a[_0x287f('0x23')]]){for(var _0x1a0e36 in _0x49903a[_0x287f('0x29')]){if(_0x49903a[_0x287f('0x29')][_0x287f('0x20')](_0x1a0e36)){this['channels'][_0x49903a['uniqueid']][_0x1a0e36]=_0x49903a[_0x287f('0x2a')];}}}};Fax[_0x287f('0x1d')][_0x287f('0x15')]=function(_0x19435d){if(this[_0x287f('0xe')][_0x19435d['uniqueid']]){this['channels'][_0x19435d['uniqueid']][_0x287f('0x2b')]=_0x19435d[_0x287f('0x2b')];this[_0x287f('0xe')][_0x19435d[_0x287f('0x23')]][_0x287f('0x2c')]=_0x19435d[_0x287f('0x2c')];}};Fax[_0x287f('0x1d')]['syncNewExten']=function(_0x22ddd5){if(this[_0x287f('0xe')][_0x22ddd5[_0x287f('0x23')]]){for(var _0x32128d in _0x22ddd5[_0x287f('0x29')]){if(_0x22ddd5[_0x287f('0x29')][_0x287f('0x20')](_0x32128d)){this[_0x287f('0xe')][_0x22ddd5[_0x287f('0x23')]][_0x32128d]=_0x22ddd5[_0x287f('0x2a')];}}}};Fax[_0x287f('0x1d')]['syncFaxStatus']=function(_0x359304){if(this['channels'][_0x359304[_0x287f('0x23')]]){this[_0x287f('0xe')][_0x359304[_0x287f('0x23')]][_0x287f('0x2d')]=_0x359304['operation'];this['channels'][_0x359304[_0x287f('0x23')]]['status']=_0x359304[_0x287f('0x2e')];this['channels'][_0x359304[_0x287f('0x23')]][_0x287f('0x22')]=_0x359304[_0x287f('0x22')];this[_0x287f('0xe')][_0x359304[_0x287f('0x23')]][_0x287f('0x2f')]=_0x359304['filename'];logger[_0x287f('0x26')](_0x359304[_0x287f('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x287f('0x1d')]['syncReceiveFax']=function(_0x3d4257){var _0x1868e6=this;if(this['channels'][_0x3d4257[_0x287f('0x23')]]){var _0x461240=this[_0x287f('0xe')][_0x3d4257[_0x287f('0x23')]]['id'];this[_0x287f('0xe')][_0x3d4257[_0x287f('0x23')]]['remotestationid']=_0x3d4257[_0x287f('0x30')];this[_0x287f('0xe')][_0x3d4257['uniqueid']]['pagestransferred']=_0x3d4257[_0x287f('0x31')];this[_0x287f('0xe')][_0x3d4257[_0x287f('0x23')]]['localstationid']=_0x3d4257['localstationid'];this[_0x287f('0xe')][_0x3d4257[_0x287f('0x23')]][_0x287f('0x32')]=_0x3d4257['resolution'];this[_0x287f('0xe')][_0x3d4257[_0x287f('0x23')]][_0x287f('0x33')]=_0x3d4257[_0x287f('0x33')];this['channels'][_0x3d4257['uniqueid']][_0x287f('0x2f')]=_0x3d4257['filename'];this[_0x287f('0xe')][_0x3d4257[_0x287f('0x23')]][_0x287f('0x34')]=_0x3d4257[_0x287f('0x34')];if(this['channels'][_0x3d4257[_0x287f('0x23')]][_0x287f('0x31')]>0x0){tiff2pdf(_0x3d4257['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x2f3194){logger[_0x287f('0x26')](_0x3d4257[_0x287f('0x23')],_0x287f('0x35'),_0x2f3194[_0x287f('0x36')]);attachment[_0x287f('0x37')]({'name':path['parse'](_0x3d4257['filename'])[_0x287f('0x25')],'basename':path['parse'](_0x3d4257[_0x287f('0x2f')])[_0x287f('0x25')]+'.pdf','type':_0x287f('0x38')})[_0x287f('0x39')](function(_0x432346){faxAccount['notify'](_0x461240,{'from':_0x3d4257[_0x287f('0x34')],'mapKey':_0x287f('0x6'),'body':path['parse'](_0x3d4257[_0x287f('0x2f')])[_0x287f('0x25')]+_0x287f('0x3a'),'AttachmentId':_0x432346['id']})[_0x287f('0x3b')](function(_0x3f7ed5){logger[_0x287f('0x3c')](_0x3d4257[_0x287f('0x23')],'\x20notify\x20',JSON['stringify'](_0x3f7ed5));});})['catch'](function(_0x256b89){logger[_0x287f('0x3c')](_0x3d4257[_0x287f('0x23')],_0x287f('0x3d'),JSON[_0x287f('0x3e')](_0x256b89));});});}logger[_0x287f('0x26')](_0x3d4257[_0x287f('0x23')],_0x287f('0x3d'));}};Fax[_0x287f('0x1d')]['syncOriginateResponse']=function(_0x436022){if(this[_0x287f('0x28')][_0x436022['uniqueid']]){_[_0x287f('0x3f')](this[_0x287f('0xe')][_0x436022['uniqueid']],_[_0x287f('0x40')](_0x436022,['response',_0x287f('0x41')]));}};function updateStatus(_0x93b6ff){if(_0x93b6ff[_0x287f('0x42')]){faxMessage[_0x287f('0x43')](_0x93b6ff[_0x287f('0x42')],{'failMessage':_0x287f('0x44')})[_0x287f('0x39')](function(_0x4727ab){ut[_0x287f('0x45')]('[Fax][Message][Error][Updated]',_0x4727ab);})['catch'](function(_0x1eb09e){ut[_0x287f('0x45')](_0x287f('0x46'),_0x1eb09e);});}else{ut[_0x287f('0x45')](_0x287f('0x47'));}}Fax[_0x287f('0x1d')][_0x287f('0x48')]=function(_0x412517,_0x25b94e,_0x4bfa1e){var _0x480246=this;var _0x7cc2b4={};if(_0x25b94e){_0x7cc2b4={'read':_0x25b94e};}else{_0x7cc2b4={'failMessage':_0x4bfa1e};}if(this[_0x287f('0x28')][_0x412517][_0x287f('0x42')]){faxMessage[_0x287f('0x43')](this[_0x287f('0x28')][_0x412517][_0x287f('0x42')],_0x7cc2b4)[_0x287f('0x39')](function(_0x2e9eac){ut[_0x287f('0x45')]('[Fax][Message][Updated]',_0x2e9eac);})[_0x287f('0x3b')](function(_0x1f4220){ut[_0x287f('0x45')]('[Fax][Message][NoUpdate1]',_0x1f4220);})[_0x287f('0x49')](function(){delete _0x480246['channels'][_0x412517];delete _0x480246[_0x287f('0x28')][_0x412517];});}else{ut[_0x287f('0x45')]('[Fax][Message][NoUpdate2]');delete this[_0x287f('0xe')][_0x412517];delete this[_0x287f('0x28')][_0x412517];}};Fax[_0x287f('0x1d')]['syncHangup']=function(_0x507840){var _0x41fd5b=this;if(this[_0x287f('0xe')][_0x507840[_0x287f('0x23')]]){if(this[_0x287f('0x28')][_0x507840[_0x287f('0x23')]]){this[_0x287f('0xe')][_0x507840['uniqueid']]['id']=this[_0x287f('0x28')][_0x507840['uniqueid']]['id'];this[_0x287f('0xe')][_0x507840[_0x287f('0x23')]][_0x287f('0x25')]=this['actions'][_0x507840[_0x287f('0x23')]][_0x287f('0x25')];}logger[_0x287f('0x26')](_0x507840['uniqueid'],this[_0x287f('0x28')][_0x507840[_0x287f('0x23')]]?_0x287f('0x4a'):_0x287f('0x4b'),JSON[_0x287f('0x3e')](this[_0x287f('0xe')][_0x507840[_0x287f('0x23')]]));if(this[_0x287f('0x28')][_0x507840[_0x287f('0x23')]]){if(this[_0x287f('0xe')][_0x507840[_0x287f('0x23')]][_0x287f('0x4c')]>0x0&&this['channels'][_0x507840[_0x287f('0x23')]][_0x287f('0x4d')]===_0x287f('0x4e')){this[_0x287f('0x48')](_0x507840['uniqueid'],!![]);}else{this[_0x287f('0x48')](_0x507840[_0x287f('0x23')],![],this[_0x287f('0xe')][_0x507840[_0x287f('0x23')]][_0x287f('0x4f')]?_0x287f('0x50')+this[_0x287f('0xe')][_0x507840[_0x287f('0x23')]][_0x287f('0x4f')]:_0x287f('0x51'));}}}};Fax[_0x287f('0x1d')][_0x287f('0x52')]=function(_0x1500e3){var _0x512bed=this;return new BPromise(function(_0x2b4477,_0xa031f8){_0x512bed[_0x287f('0x53')](_0x1500e3,_0x512bed[_0x287f('0xf')][_0x1500e3[_0x287f('0x54')]])['then'](function(_0x531d74){ut[_0x287f('0x45')](_0x287f('0x55'),_0x531d74);_0x2b4477(ut[_0x287f('0x36')](_0x287f('0x56')));})[_0x287f('0x3b')](function(_0x179145){ut['logger']('[Fax][execOriginate][failure]',_0x179145);updateStatus(_0x1500e3);_0xa031f8(ut[_0x287f('0x36')]('Fax\x20failed'));});});};Fax[_0x287f('0x1d')][_0x287f('0x57')]=function(_0x5ed323){var _0x221ae7=this;return new BPromise(function(_0x305734,_0x54b158){var _0x53d6b2=_0x221ae7[_0x287f('0x58')](_0x221ae7[_0x287f('0xf')][_0x5ed323[_0x287f('0x54')]][_0x287f('0x59')],_0x5ed323);if(_0x53d6b2['isValid']){_0x305734(ut[_0x287f('0x36')]('Trunk\x20Reachable'));}else{_0x54b158(ut[_0x287f('0x36')](_0x53d6b2[_0x287f('0x36')]));}});};function originate(_0x21ad94,_0x100292,_0x1122f4){return new BPromise(function(_0x600051,_0x23aaa4){if(_0x1122f4){var _0x39194c=util[_0x287f('0x5a')]('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[_0x287f('0x5b')](_0x21ad94[_0x287f('0x3')])[_0x287f('0x25')],_0x21ad94[_0x287f('0x3')]);gs['execute'](_0x39194c)['then'](function(){_0x21ad94[_0x287f('0x3')]=util[_0x287f('0x5a')](_0x287f('0x5c'),path[_0x287f('0x5b')](_0x21ad94[_0x287f('0x3')])[_0x287f('0x5d')],path[_0x287f('0x5b')](_0x21ad94['path'])[_0x287f('0x25')]);_0x100292[_0x287f('0x5e')]=_0x21ad94[_0x287f('0x3')];ut[_0x287f('0x45')](_0x287f('0x5f'),'');ami[_0x287f('0x60')](ut['variablesAction'](_0x21ad94,_0x100292))['then'](function(_0x1a9826){_0x600051(_0x1a9826);})[_0x287f('0x3b')](function(_0x2711d6){_0x23aaa4(_0x2711d6);});})[_0x287f('0x3b')](function(_0x21090e){_0x23aaa4(_0x21090e);});}else{ami[_0x287f('0x60')](ut[_0x287f('0x61')](_0x21ad94,_0x100292))[_0x287f('0x39')](function(_0x28811e){_0x600051(_0x28811e);})['catch'](function(_0x58ebb2){_0x23aaa4(_0x58ebb2);});}});}Fax[_0x287f('0x1d')][_0x287f('0x53')]=function(_0x17e7cf,_0x36f02a){var _0xa3b663=this;return new BPromise(function(_0xd4c468,_0x691310){var _0x410cda=uuid['v4']();var _0xc2428=ut[_0x287f('0x62')](_0x17e7cf,_0x36f02a);_0xa3b663[_0x287f('0x28')][_0x410cda]=new Action(_0x410cda,_0x36f02a,_0x17e7cf);var _0x231368=_0xa3b663[_0x287f('0x28')][_0x410cda];if(path[_0x287f('0x5b')](_0x17e7cf[_0x287f('0x3')])[_0x287f('0x63')]===_0x287f('0x3a')){originate(_0x231368,_0xc2428,!![])[_0x287f('0x39')](function(_0x15ab41){_0xd4c468(_0x15ab41);})[_0x287f('0x3b')](function(_0x3fae2e){_0x691310(_0x3fae2e);});}else{originate(_0x231368,_0xc2428,![])[_0x287f('0x39')](function(_0x326d42){_0xd4c468(_0x326d42);})[_0x287f('0x3b')](function(_0x24ffbc){_0x691310(_0x24ffbc);});}});};Fax[_0x287f('0x1d')][_0x287f('0x64')]=function(_0x10e97a){return!_[_0x287f('0x65')](_0x10e97a)&&!_[_0x287f('0x65')](_0x10e97a['name'])&&!_['isNil'](_0x10e97a[_0x287f('0x66')])&&_0x10e97a[_0x287f('0x66')]&&!_[_0x287f('0x65')](this[_0x287f('0x10')][util[_0x287f('0x5a')]('SIP/%s',_0x10e97a[_0x287f('0x25')])])&&!_[_0x287f('0x65')](this[_0x287f('0x10')][util['format']('SIP/%s',_0x10e97a[_0x287f('0x25')])][_0x287f('0x2e')])&&(this[_0x287f('0x10')][util[_0x287f('0x5a')](_0x287f('0x67'),_0x10e97a[_0x287f('0x25')])][_0x287f('0x2e')]===_0x287f('0x68')||this[_0x287f('0x10')][util[_0x287f('0x5a')](_0x287f('0x67'),_0x10e97a[_0x287f('0x25')])]['status']===_0x287f('0x69'));};Fax[_0x287f('0x1d')][_0x287f('0x58')]=function(_0x49bc16,_0x3e3230){if(!this[_0x287f('0x64')](_0x49bc16)){ut[_0x287f('0x45')](_0x287f('0x6a'),_[_0x287f('0x65')](_0x49bc16)?'':_0x49bc16[_0x287f('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x287f('0x6b')};}if(_[_0x287f('0x65')](_0x3e3230[_0x287f('0x6')])){ut[_0x287f('0x45')](_0x287f('0x6c'),JSON[_0x287f('0x3e')](_0x3e3230));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x287f('0x65')](_0x3e3230[_0x287f('0x3')])){ut[_0x287f('0x45')](_0x287f('0x6d'),JSON['stringify'](_0x3e3230));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x3291=['Action','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncOriginateResponse','context','hasOwnProperty','exten','uniqueid','channel','name','info','prototype','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','dir','XMF-PATH','variablesAction'];(function(_0x4312f7,_0x4b31a4){var _0x52cb67=function(_0x408755){while(--_0x408755){_0x4312f7['push'](_0x4312f7['shift']());}};_0x52cb67(++_0x4b31a4);}(_0x3291,0x89));var _0x1329=function(_0xf060fd,_0xcfb219){_0xf060fd=_0xf060fd-0x0;var _0x4d624f=_0x3291[_0xf060fd];return _0x4d624f;};'use strict';var util=require(_0x1329('0x0'));var _=require(_0x1329('0x1'));var BPromise=require(_0x1329('0x2'));var uuid=require(_0x1329('0x3'));var moment=require(_0x1329('0x4'));var path=require(_0x1329('0x5'));var tiff2pdf=require(_0x1329('0x6'));var gs=require(_0x1329('0x7'));var logger=require(_0x1329('0x8'))(_0x1329('0x9'));var ami=require(_0x1329('0xa'));var rpcDb=require('./rpcDb');var Channel=require(_0x1329('0xb'));var ut=require(_0x1329('0xc'));var Action=require(_0x1329('0xd'));var faxAccount=require(_0x1329('0xe'));var attachment=require(_0x1329('0xf'));var faxMessage=require(_0x1329('0x10'));function Fax(_0x5c62dc){this[_0x1329('0x11')]={};this[_0x1329('0x12')]=_0x5c62dc[_0x1329('0x12')];this['trunks']=_0x5c62dc[_0x1329('0x13')];this[_0x1329('0x14')]={};ami['on'](_0x1329('0x15'),this[_0x1329('0x16')][_0x1329('0x17')](this));ami['on'](_0x1329('0x18'),this[_0x1329('0x19')]['bind'](this));ami['on'](_0x1329('0x1a'),this[_0x1329('0x1b')]['bind'](this));ami['on'](_0x1329('0x1c'),this[_0x1329('0x1d')][_0x1329('0x17')](this));ami['on'](_0x1329('0x1e'),this[_0x1329('0x1f')][_0x1329('0x17')](this));ami['on'](_0x1329('0x20'),this[_0x1329('0x21')][_0x1329('0x17')](this));ami['on']('hangup',this['syncHangup'][_0x1329('0x17')](this));ami['on']('originateresponse',this[_0x1329('0x22')][_0x1329('0x17')](this));}Fax['prototype']['syncNewchannel']=function(_0x16b84d){if(_0x16b84d[_0x1329('0x23')]==='from-voip-provider'){for(var _0x3c743d in this[_0x1329('0x12')]){if(this[_0x1329('0x12')][_0x1329('0x24')](_0x3c743d)){if(_0x16b84d[_0x1329('0x25')]===this[_0x1329('0x12')][_0x3c743d]['localstationid']){this[_0x1329('0x11')][_0x16b84d[_0x1329('0x26')]]={};this[_0x1329('0x11')][_0x16b84d[_0x1329('0x26')]][_0x1329('0x27')]=_0x16b84d[_0x1329('0x27')];this['channels'][_0x16b84d[_0x1329('0x26')]]['id']=this[_0x1329('0x12')][_0x3c743d]['id'];this[_0x1329('0x11')][_0x16b84d[_0x1329('0x26')]][_0x1329('0x28')]=this[_0x1329('0x12')][_0x3c743d][_0x1329('0x28')];logger[_0x1329('0x29')](_0x16b84d[_0x1329('0x26')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x16b84d[_0x1329('0x26')]]){this['channels'][_0x16b84d[_0x1329('0x26')]]={};this[_0x1329('0x11')][_0x16b84d[_0x1329('0x26')]][_0x1329('0x27')]=_0x16b84d['channel'];logger[_0x1329('0x29')](_0x16b84d[_0x1329('0x26')],'\x20syncNewchannel\x20');}};Fax[_0x1329('0x2a')][_0x1329('0x19')]=function(_0x149759){if(this[_0x1329('0x11')][_0x149759[_0x1329('0x26')]]){for(var _0x4031ce in _0x149759['variable']){if(_0x149759[_0x1329('0x2b')][_0x1329('0x24')](_0x4031ce)){this[_0x1329('0x11')][_0x149759[_0x1329('0x26')]][_0x4031ce]=_0x149759[_0x1329('0x2c')];}}}};Fax['prototype'][_0x1329('0x1b')]=function(_0x47f3a6){if(this[_0x1329('0x11')][_0x47f3a6[_0x1329('0x26')]]){this[_0x1329('0x11')][_0x47f3a6[_0x1329('0x26')]][_0x1329('0x2d')]=_0x47f3a6['channelstate'];this[_0x1329('0x11')][_0x47f3a6['uniqueid']]['channelstatedesc']=_0x47f3a6[_0x1329('0x2e')];}};Fax[_0x1329('0x2a')][_0x1329('0x1d')]=function(_0x1bfc92){if(this[_0x1329('0x11')][_0x1bfc92[_0x1329('0x26')]]){for(var _0x5bdf4e in _0x1bfc92[_0x1329('0x2b')]){if(_0x1bfc92[_0x1329('0x2b')][_0x1329('0x24')](_0x5bdf4e)){this[_0x1329('0x11')][_0x1bfc92[_0x1329('0x26')]][_0x5bdf4e]=_0x1bfc92[_0x1329('0x2c')];}}}};Fax[_0x1329('0x2a')][_0x1329('0x1f')]=function(_0x45a1d6){if(this[_0x1329('0x11')][_0x45a1d6[_0x1329('0x26')]]){this[_0x1329('0x11')][_0x45a1d6[_0x1329('0x26')]][_0x1329('0x2f')]=_0x45a1d6[_0x1329('0x2f')];this[_0x1329('0x11')][_0x45a1d6[_0x1329('0x26')]][_0x1329('0x30')]=_0x45a1d6['status'];this['channels'][_0x45a1d6['uniqueid']][_0x1329('0x31')]=_0x45a1d6[_0x1329('0x31')];this['channels'][_0x45a1d6['uniqueid']][_0x1329('0x32')]=_0x45a1d6[_0x1329('0x32')];logger[_0x1329('0x29')](_0x45a1d6[_0x1329('0x26')],_0x1329('0x33'));}};Fax[_0x1329('0x2a')][_0x1329('0x21')]=function(_0x4f7508){var _0x1f962b=this;if(this['channels'][_0x4f7508['uniqueid']]){var _0x19cdc3=this['channels'][_0x4f7508[_0x1329('0x26')]]['id'];this[_0x1329('0x11')][_0x4f7508[_0x1329('0x26')]]['remotestationid']=_0x4f7508[_0x1329('0x34')];this[_0x1329('0x11')][_0x4f7508[_0x1329('0x26')]]['pagestransferred']=_0x4f7508[_0x1329('0x35')];this[_0x1329('0x11')][_0x4f7508[_0x1329('0x26')]][_0x1329('0x31')]=_0x4f7508[_0x1329('0x31')];this[_0x1329('0x11')][_0x4f7508[_0x1329('0x26')]]['resolution']=_0x4f7508[_0x1329('0x36')];this[_0x1329('0x11')][_0x4f7508['uniqueid']][_0x1329('0x37')]=_0x4f7508['transferrate'];this[_0x1329('0x11')][_0x4f7508[_0x1329('0x26')]][_0x1329('0x32')]=_0x4f7508[_0x1329('0x32')];this[_0x1329('0x11')][_0x4f7508[_0x1329('0x26')]][_0x1329('0x38')]=_0x4f7508['calleridnum'];if(this[_0x1329('0x11')][_0x4f7508[_0x1329('0x26')]][_0x1329('0x35')]>0x0){tiff2pdf(_0x4f7508[_0x1329('0x32')],_0x1329('0x39'),function(_0xc1839e){logger[_0x1329('0x29')](_0x4f7508[_0x1329('0x26')],'\x20result\x20conversion\x20file\x20',_0xc1839e[_0x1329('0x3a')]);attachment['create']({'name':path[_0x1329('0x3b')](_0x4f7508['filename'])[_0x1329('0x28')],'basename':path[_0x1329('0x3b')](_0x4f7508['filename'])['name']+_0x1329('0x3c'),'type':_0x1329('0x3d')})[_0x1329('0x3e')](function(_0x36818b){faxAccount[_0x1329('0x3f')](_0x19cdc3,{'from':_0x4f7508[_0x1329('0x38')],'mapKey':_0x1329('0x9'),'body':path[_0x1329('0x3b')](_0x4f7508['filename'])['name']+_0x1329('0x3c'),'AttachmentId':_0x36818b['id']})[_0x1329('0x40')](function(_0x47ca6b){logger['error'](_0x4f7508[_0x1329('0x26')],_0x1329('0x41'),JSON[_0x1329('0x42')](_0x47ca6b));});})[_0x1329('0x40')](function(_0xa14f2c){logger[_0x1329('0x43')](_0x4f7508[_0x1329('0x26')],_0x1329('0x44'),JSON[_0x1329('0x42')](_0xa14f2c));});});}logger[_0x1329('0x29')](_0x4f7508[_0x1329('0x26')],'\x20receiveFax\x20');}};Fax[_0x1329('0x2a')][_0x1329('0x22')]=function(_0x161b35){if(this[_0x1329('0x14')][_0x161b35[_0x1329('0x26')]]){_[_0x1329('0x45')](this[_0x1329('0x11')][_0x161b35[_0x1329('0x26')]],_[_0x1329('0x46')](_0x161b35,['response',_0x1329('0x47')]));}};function updateStatus(_0x3a9ca3){if(_0x3a9ca3['AttachmentId']){faxMessage['update'](_0x3a9ca3[_0x1329('0x48')],{'failMessage':_0x1329('0x49')})[_0x1329('0x3e')](function(_0x40c0bf){ut[_0x1329('0x4a')](_0x1329('0x4b'),_0x40c0bf);})['catch'](function(_0x3f0e63){ut[_0x1329('0x4a')](_0x1329('0x4c'),_0x3f0e63);});}else{ut[_0x1329('0x4a')](_0x1329('0x4d'));}}Fax[_0x1329('0x2a')][_0x1329('0x4e')]=function(_0x29b064,_0x51c0a9,_0x3009e5){var _0x861cf6=this;var _0x502386={};if(_0x51c0a9){_0x502386={'read':_0x51c0a9};}else{_0x502386={'failMessage':_0x3009e5};}if(this[_0x1329('0x14')][_0x29b064][_0x1329('0x48')]){faxMessage[_0x1329('0x4f')](this[_0x1329('0x14')][_0x29b064][_0x1329('0x48')],_0x502386)[_0x1329('0x3e')](function(_0x311631){ut['logger']('[Fax][Message][Updated]',_0x311631);})[_0x1329('0x40')](function(_0x2c6b1d){ut['logger'](_0x1329('0x50'),_0x2c6b1d);})[_0x1329('0x51')](function(){delete _0x861cf6[_0x1329('0x11')][_0x29b064];delete _0x861cf6[_0x1329('0x14')][_0x29b064];});}else{ut[_0x1329('0x4a')](_0x1329('0x52'));delete this['channels'][_0x29b064];delete this[_0x1329('0x14')][_0x29b064];}};Fax[_0x1329('0x2a')][_0x1329('0x53')]=function(_0x46e766){var _0x5bd6f5=this;if(this[_0x1329('0x11')][_0x46e766[_0x1329('0x26')]]){if(this[_0x1329('0x14')][_0x46e766[_0x1329('0x26')]]){this[_0x1329('0x11')][_0x46e766[_0x1329('0x26')]]['id']=this[_0x1329('0x14')][_0x46e766['uniqueid']]['id'];this['channels'][_0x46e766['uniqueid']][_0x1329('0x28')]=this['actions'][_0x46e766[_0x1329('0x26')]][_0x1329('0x28')];}logger[_0x1329('0x29')](_0x46e766[_0x1329('0x26')],this[_0x1329('0x14')][_0x46e766[_0x1329('0x26')]]?_0x1329('0x54'):_0x1329('0x55'),JSON[_0x1329('0x42')](this[_0x1329('0x11')][_0x46e766[_0x1329('0x26')]]));if(this[_0x1329('0x14')][_0x46e766[_0x1329('0x26')]]){if(this[_0x1329('0x11')][_0x46e766[_0x1329('0x26')]][_0x1329('0x56')]>0x0&&this[_0x1329('0x11')][_0x46e766[_0x1329('0x26')]][_0x1329('0x1e')]===_0x1329('0x57')){this[_0x1329('0x4e')](_0x46e766['uniqueid'],!![]);}else{this[_0x1329('0x4e')](_0x46e766[_0x1329('0x26')],![],this[_0x1329('0x11')][_0x46e766[_0x1329('0x26')]][_0x1329('0x58')]?'SENDING\x20FAILED:\x20'+this[_0x1329('0x11')][_0x46e766['uniqueid']][_0x1329('0x58')]:'SENDING\x20FAILED');}}}};Fax[_0x1329('0x2a')]['send']=function(_0x50e650){var _0x23de82=this;return new BPromise(function(_0x27d524,_0x1b6968){_0x23de82['execOriginate'](_0x50e650,_0x23de82[_0x1329('0x12')][_0x50e650[_0x1329('0x59')]])[_0x1329('0x3e')](function(_0x1c5d41){ut['logger'](_0x1329('0x5a'),_0x1c5d41);_0x27d524(ut['message'](_0x1329('0x5b')));})[_0x1329('0x40')](function(_0x186f74){ut[_0x1329('0x4a')](_0x1329('0x5c'),_0x186f74);updateStatus(_0x50e650);_0x1b6968(ut[_0x1329('0x3a')]('Fax\x20failed'));});});};Fax[_0x1329('0x2a')]['checkAfterSend']=function(_0x1f8c5e){var _0x427c46=this;return new BPromise(function(_0x81260b,_0x2800c7){var _0x544fc4=_0x427c46[_0x1329('0x5d')](_0x427c46['faxAccounts'][_0x1f8c5e[_0x1329('0x59')]][_0x1329('0x5e')],_0x1f8c5e);if(_0x544fc4['isValid']){_0x81260b(ut[_0x1329('0x3a')](_0x1329('0x5f')));}else{_0x2800c7(ut[_0x1329('0x3a')](_0x544fc4[_0x1329('0x3a')]));}});};function originate(_0xaa4244,_0x249742,_0x48b4b0){return new BPromise(function(_0x303006,_0x184835){if(_0x48b4b0){var _0x1f6c10=util[_0x1329('0x60')](_0x1329('0x61'),path['parse'](_0xaa4244[_0x1329('0x5')])[_0x1329('0x28')],_0xaa4244[_0x1329('0x5')]);gs['execute'](_0x1f6c10)[_0x1329('0x3e')](function(){_0xaa4244[_0x1329('0x5')]=util[_0x1329('0x60')]('%s/%s.tif',path[_0x1329('0x3b')](_0xaa4244[_0x1329('0x5')])[_0x1329('0x62')],path[_0x1329('0x3b')](_0xaa4244['path'])[_0x1329('0x28')]);_0x249742[_0x1329('0x63')]=_0xaa4244[_0x1329('0x5')];ut[_0x1329('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x1329('0x64')](_0xaa4244,_0x249742))[_0x1329('0x3e')](function(_0x43f3f5){_0x303006(_0x43f3f5);})['catch'](function(_0x5322b9){_0x184835(_0x5322b9);});})[_0x1329('0x40')](function(_0x52ddd7){_0x184835(_0x52ddd7);});}else{ami[_0x1329('0x65')](ut[_0x1329('0x64')](_0xaa4244,_0x249742))[_0x1329('0x3e')](function(_0x5c674b){_0x303006(_0x5c674b);})[_0x1329('0x40')](function(_0x2b9c76){_0x184835(_0x2b9c76);});}});}Fax[_0x1329('0x2a')][_0x1329('0x66')]=function(_0x586efa,_0x349fe2){var _0x257d79=this;return new BPromise(function(_0x93bffd,_0x47c632){var _0x31612b=uuid['v4']();var _0x5b47af=ut[_0x1329('0x67')](_0x586efa,_0x349fe2);_0x257d79['actions'][_0x31612b]=new Action(_0x31612b,_0x349fe2,_0x586efa);var _0x4812bb=_0x257d79[_0x1329('0x14')][_0x31612b];if(path['parse'](_0x586efa[_0x1329('0x5')])[_0x1329('0x68')]===_0x1329('0x3c')){originate(_0x4812bb,_0x5b47af,!![])[_0x1329('0x3e')](function(_0x4ce4d3){_0x93bffd(_0x4ce4d3);})[_0x1329('0x40')](function(_0x77dcb4){_0x47c632(_0x77dcb4);});}else{originate(_0x4812bb,_0x5b47af,![])['then'](function(_0x539aeb){_0x93bffd(_0x539aeb);})[_0x1329('0x40')](function(_0x43c138){_0x47c632(_0x43c138);});}});};Fax['prototype']['isTrunkReachable']=function(_0xf6ec7f){return!_['isNil'](_0xf6ec7f)&&!_[_0x1329('0x69')](_0xf6ec7f[_0x1329('0x28')])&&!_[_0x1329('0x69')](_0xf6ec7f[_0x1329('0x6a')])&&_0xf6ec7f[_0x1329('0x6a')]&&!_[_0x1329('0x69')](this[_0x1329('0x13')][util[_0x1329('0x60')]('SIP/%s',_0xf6ec7f[_0x1329('0x28')])])&&!_[_0x1329('0x69')](this[_0x1329('0x13')][util['format'](_0x1329('0x6b'),_0xf6ec7f[_0x1329('0x28')])][_0x1329('0x30')])&&(this[_0x1329('0x13')][util['format']('SIP/%s',_0xf6ec7f['name'])][_0x1329('0x30')]===_0x1329('0x6c')||this[_0x1329('0x13')][util['format'](_0x1329('0x6b'),_0xf6ec7f[_0x1329('0x28')])][_0x1329('0x30')]===_0x1329('0x6d'));};Fax[_0x1329('0x2a')]['checkTrunk']=function(_0x310c92,_0x42cbfa){if(!this[_0x1329('0x6e')](_0x310c92)){ut[_0x1329('0x4a')](_0x1329('0x6f'),_[_0x1329('0x69')](_0x310c92)?'':_0x310c92[_0x1329('0x28')]+_0x1329('0x70'));return{'isValid':![],'message':_0x1329('0x71')};}if(_[_0x1329('0x69')](_0x42cbfa[_0x1329('0x9')])){ut['logger'](_0x1329('0x72'),JSON['stringify'](_0x42cbfa));return{'isValid':![],'message':_0x1329('0x73')};}if(_[_0x1329('0x69')](_0x42cbfa[_0x1329('0x5')])){ut['logger'](_0x1329('0x74'),JSON[_0x1329('0x42')](_0x42cbfa));return{'isValid':![],'message':_0x1329('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x1329('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 7274d26..a0c18dc 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 _0x9f81=['util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','resolve','notify','[Notify]\x20'];(function(_0x5dfd68,_0x1dfc34){var _0x5e066a=function(_0xea5ab6){while(--_0xea5ab6){_0x5dfd68['push'](_0x5dfd68['shift']());}};_0x5e066a(++_0x1dfc34);}(_0x9f81,0xaa));var _0x19f8=function(_0x57495a,_0x14d070){_0x57495a=_0x57495a-0x0;var _0x1ca73a=_0x9f81[_0x57495a];return _0x1ca73a;};'use strict';var util=require(_0x19f8('0x0'));var BPromise=require(_0x19f8('0x1'));var logger=require(_0x19f8('0x2'))('preview');var _=require(_0x19f8('0x3'));var faxAccount=require(_0x19f8('0x4'));function loggerCatch(_0x808f16){return function(_0x2249b0){logger[_0x19f8('0x5')](_0x808f16,util[_0x19f8('0x6')](_0x2249b0,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x598c0e,_0x12d447){return BPromise[_0x19f8('0x7')]()['then'](faxAccount[_0x19f8('0x8')](_0x598c0e,_0x12d447))['catch'](loggerCatch(_0x19f8('0x9')));}; \ No newline at end of file +var _0x6d0f=['preview','lodash','../rpc/faxAccount','error','inspect','resolve','notify','catch','[Notify]\x20','../../../config/logger'];(function(_0xa26931,_0x43aab4){var _0x4696ee=function(_0x5946a4){while(--_0x5946a4){_0xa26931['push'](_0xa26931['shift']());}};_0x4696ee(++_0x43aab4);}(_0x6d0f,0x117));var _0xf6d0=function(_0x1c8f7e,_0x1106ff){_0x1c8f7e=_0x1c8f7e-0x0;var _0x332de1=_0x6d0f[_0x1c8f7e];return _0x332de1;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xf6d0('0x0'))(_0xf6d0('0x1'));var _=require(_0xf6d0('0x2'));var faxAccount=require(_0xf6d0('0x3'));function loggerCatch(_0x547db8){return function(_0x15b7c6){logger[_0xf6d0('0x4')](_0x547db8,util[_0xf6d0('0x5')](_0x15b7c6,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x590056,_0x5b858a){return BPromise[_0xf6d0('0x6')]()['then'](faxAccount[_0xf6d0('0x7')](_0x590056,_0x5b858a))[_0xf6d0('0x8')](loggerCatch(_0xf6d0('0x9')));}; \ 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 f9a2556..f749fd3 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 _0x0b91=['inspect','../../../../config/logger','fax','bluebird','exec','execute','Exec\x20gs','info','\x20Error\x20:'];(function(_0x4dc1c5,_0x4eb905){var _0x228e5d=function(_0x10245f){while(--_0x10245f){_0x4dc1c5['push'](_0x4dc1c5['shift']());}};_0x228e5d(++_0x4eb905);}(_0x0b91,0x1f0));var _0x10b9=function(_0x5e7431,_0x2b6c78){_0x5e7431=_0x5e7431-0x0;var _0x57a7da=_0x0b91[_0x5e7431];return _0x57a7da;};'use strict';var util=require('util');var logger=require(_0x10b9('0x0'))(_0x10b9('0x1'));var BPromise=require(_0x10b9('0x2'));var exec=require('child_process')[_0x10b9('0x3')];exports[_0x10b9('0x4')]=function(_0x3ecacb){return new BPromise(function(_0x11f5b4,_0x2b8c59){exec(_0x3ecacb,function(_0x2ddab4,_0x268799,_0x2cdbf2){logger['info'](_0x10b9('0x5'),_0x268799);if(_0x2ddab4){logger[_0x10b9('0x6')](_0x10b9('0x5'),_0x10b9('0x7'),util[_0x10b9('0x8')](_0x2ddab4,{'showHidden':![],'depth':null}),_0x268799,_0x2cdbf2);_0x2b8c59(_0x2ddab4);}_0x11f5b4(_0x268799);});});}; \ No newline at end of file +var _0x0a22=['info','Exec\x20gs','inspect','util','fax','bluebird','child_process','execute'];(function(_0x221350,_0x186915){var _0x26c5f9=function(_0x1d20ea){while(--_0x1d20ea){_0x221350['push'](_0x221350['shift']());}};_0x26c5f9(++_0x186915);}(_0x0a22,0x1cb));var _0x20a2=function(_0x426022,_0x288816){_0x426022=_0x426022-0x0;var _0x47ff11=_0x0a22[_0x426022];return _0x47ff11;};'use strict';var util=require(_0x20a2('0x0'));var logger=require('../../../../config/logger')(_0x20a2('0x1'));var BPromise=require(_0x20a2('0x2'));var exec=require(_0x20a2('0x3'))['exec'];exports[_0x20a2('0x4')]=function(_0x54ab1c){return new BPromise(function(_0x48e5ff,_0x1cc70f){exec(_0x54ab1c,function(_0x29e9d7,_0x2a5576,_0x45061e){logger[_0x20a2('0x5')]('Exec\x20gs',_0x2a5576);if(_0x29e9d7){logger[_0x20a2('0x5')](_0x20a2('0x6'),'\x20Error\x20:',util[_0x20a2('0x7')](_0x29e9d7,{'showHidden':![],'depth':null}),_0x2a5576,_0x45061e);_0x1cc70f(_0x29e9d7);}_0x48e5ff(_0x2a5576);});});}; \ 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 9de43de..faf16d0 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 _0x771d=['variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','localstationid','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','headerinfo','minrate','format','\x22%s\x22','faxdetect','t38timeout','path'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x771d,0x132));var _0xd771=function(_0x5777cf,_0x218914){_0x5777cf=_0x5777cf-0x0;var _0x369c43=_0x771d[_0x5777cf];return _0x369c43;};'use strict';var util=require('util');var _=require(_0xd771('0x0'));var moment=require(_0xd771('0x1'));var logger=require(_0xd771('0x2'))(_0xd771('0x3'));exports[_0xd771('0x4')]=function(_0x12e93a){return{'message':_0x12e93a};};exports[_0xd771('0x5')]=function(_0x2f3d76,_0x4c95d5){logger[_0xd771('0x6')](_0x2f3d76,util[_0xd771('0x7')](_0x4c95d5,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1425c6,_0x42f0ef){var _0x3a1506={'XMF-ECM':_0x42f0ef[_0xd771('0x8')],'XMF-HEADERINFO':_0x42f0ef[_0xd771('0x9')],'XMF-MINRATE':_0x42f0ef[_0xd771('0xa')],'XMF-MAXRATE':_0x42f0ef['maxrate'],'XMF-MODEM':util[_0xd771('0xb')](_0xd771('0xc'),_0x42f0ef['modem']),'XMF-GATEWAY':_0x42f0ef['gateway'],'XMF-FAXDETECT':_0x42f0ef[_0xd771('0xd')],'XMF-T38TIMEOUT':_0x42f0ef[_0xd771('0xe')],'XMF-LOCALSTATIONID':_0x42f0ef['localstationid'],'XMF-PATH':_0x1425c6[_0xd771('0xf')]};return _0x3a1506;};exports[_0xd771('0x10')]=function(_0x20a43e,_0x55b49e){return{'actionid':_0x20a43e[_0xd771('0x11')],'action':_0xd771('0x12'),'channel':_0x20a43e[_0xd771('0x13')],'Exten':_0xd771('0x14'),'Context':_0xd771('0x15'),'Priority':'1','callerid':util[_0xd771('0xb')]('\x22%s\x22\x20<%s>',_0x20a43e[_0xd771('0x9')]?_0x20a43e[_0xd771('0x9')]:'',_0x20a43e[_0xd771('0x16')]),'variable':_0x55b49e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x20a43e[_0xd771('0x11')]};}; \ No newline at end of file +var _0x250e=['minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','from-sip','uniqueid','util','../../../../config/logger','message','logger','info','inspect','headerinfo'];(function(_0x4de4c3,_0x5736e1){var _0x1483ef=function(_0x4d9cef){while(--_0x4d9cef){_0x4de4c3['push'](_0x4de4c3['shift']());}};_0x1483ef(++_0x5736e1);}(_0x250e,0x134));var _0xe250=function(_0x5c36e2,_0x4635f4){_0x5c36e2=_0x5c36e2-0x0;var _0x2a9bd4=_0x250e[_0x5c36e2];return _0x2a9bd4;};'use strict';var util=require(_0xe250('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xe250('0x1'))('fax');exports[_0xe250('0x2')]=function(_0x3df94c){return{'message':_0x3df94c};};exports[_0xe250('0x3')]=function(_0x5e3af3,_0xde5107){logger[_0xe250('0x4')](_0x5e3af3,util[_0xe250('0x5')](_0xde5107,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0xe6bded,_0x1ce102){var _0x113eae={'XMF-ECM':_0x1ce102['ecm'],'XMF-HEADERINFO':_0x1ce102[_0xe250('0x6')],'XMF-MINRATE':_0x1ce102[_0xe250('0x7')],'XMF-MAXRATE':_0x1ce102[_0xe250('0x8')],'XMF-MODEM':util['format'](_0xe250('0x9'),_0x1ce102[_0xe250('0xa')]),'XMF-GATEWAY':_0x1ce102[_0xe250('0xb')],'XMF-FAXDETECT':_0x1ce102[_0xe250('0xc')],'XMF-T38TIMEOUT':_0x1ce102[_0xe250('0xd')],'XMF-LOCALSTATIONID':_0x1ce102[_0xe250('0xe')],'XMF-PATH':_0xe6bded[_0xe250('0xf')]};return _0x113eae;};exports[_0xe250('0x10')]=function(_0x34cf38,_0x268c65){return{'actionid':_0x34cf38['uniqueid'],'action':_0xe250('0x11'),'channel':_0x34cf38[_0xe250('0x12')],'Exten':'xcally-motion-fax','Context':_0xe250('0x13'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x34cf38[_0xe250('0x6')]?_0x34cf38[_0xe250('0x6')]:'',_0x34cf38[_0xe250('0xe')]),'variable':_0x268c65,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x34cf38[_0xe250('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3300d16..f724bce 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 _0x598c=['initCampaigns','initVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts'];(function(_0x4e471a,_0x12214a){var _0x2980ea=function(_0x2ed409){while(--_0x2ed409){_0x4e471a['push'](_0x4e471a['shift']());}};_0x2980ea(++_0x12214a);}(_0x598c,0x1a9));var _0xc598=function(_0x123c1f,_0x29a3e1){_0x123c1f=_0x123c1f-0x0;var _0x3c3398=_0x598c[_0x123c1f];return _0x3c3398;};'use strict';var BPromise=require('bluebird');var util=require(_0xc598('0x0'));var moment=require(_0xc598('0x1'));var server=require(_0xc598('0x2'));var Realtime=require(_0xc598('0x3'));var Report=require(_0xc598('0x4'));var Acw=require(_0xc598('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xc598('0x6'));var Preview=require(_0xc598('0x7'));var Fax=require(_0xc598('0x8'));var user=require(_0xc598('0x9'));var voiceQueue=require(_0xc598('0xa'));var voiceQueueReport=require(_0xc598('0xb'));var voiceCallReport=require(_0xc598('0xc'));var trunk=require('./rpc/trunk');var trigger=require(_0xc598('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0xc598('0xe'));var campaign=require(_0xc598('0xf'));var voiceExtension=require(_0xc598('0x10'));var faxAccount=require(_0xc598('0x11'));var zendesk=require(_0xc598('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xc598('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xc598('0x14'));var vtiger=require(_0xc598('0x15'));var freshsales=require(_0xc598('0x16'));var servicenow=require(_0xc598('0x17'));var dynamics365=require(_0xc598('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc598('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc598('0x1a')]()['then'](user[_0xc598('0x1b')]())[_0xc598('0x1c')](realtime[_0xc598('0x1d')]())['then'](user[_0xc598('0x1e')]())[_0xc598('0x1c')](realtime[_0xc598('0x1f')]())['then'](trunk[_0xc598('0x20')]())[_0xc598('0x1c')](realtime[_0xc598('0x21')]())['then'](voiceQueue[_0xc598('0x22')]())[_0xc598('0x1c')](realtime[_0xc598('0x23')]())[_0xc598('0x1c')](trigger[_0xc598('0x24')]())[_0xc598('0x1c')](realtime['initTriggers']())[_0xc598('0x1c')](template[_0xc598('0x25')]())[_0xc598('0x1c')](realtime[_0xc598('0x26')]())[_0xc598('0x1c')](zendesk[_0xc598('0x27')]())[_0xc598('0x1c')](realtime[_0xc598('0x28')]())['then'](salesforce[_0xc598('0x29')]())[_0xc598('0x1c')](realtime[_0xc598('0x2a')]())[_0xc598('0x1c')](sugarcrm[_0xc598('0x2b')]())[_0xc598('0x1c')](realtime[_0xc598('0x2c')]())['then'](freshdesk[_0xc598('0x2d')]())['then'](realtime[_0xc598('0x2e')]())[_0xc598('0x1c')](desk[_0xc598('0x2f')]())[_0xc598('0x1c')](realtime[_0xc598('0x30')]())[_0xc598('0x1c')](zoho[_0xc598('0x31')]())[_0xc598('0x1c')](realtime[_0xc598('0x32')]())[_0xc598('0x1c')](vtiger[_0xc598('0x33')]())[_0xc598('0x1c')](realtime[_0xc598('0x34')]())[_0xc598('0x1c')](freshsales[_0xc598('0x35')]())[_0xc598('0x1c')](realtime[_0xc598('0x36')]())[_0xc598('0x1c')](servicenow['getServicenowAccounts']())[_0xc598('0x1c')](realtime[_0xc598('0x37')]())['then'](dynamics365[_0xc598('0x38')]())[_0xc598('0x1c')](realtime[_0xc598('0x39')]())[_0xc598('0x1c')](campaign['getCampaigns']())[_0xc598('0x1c')](realtime[_0xc598('0x3a')]())[_0xc598('0x1c')](voiceExtension['getVoiceExtensions']())[_0xc598('0x1c')](realtime[_0xc598('0x3b')]())[_0xc598('0x1c')](faxAccount['getFaxAccounts']())[_0xc598('0x1c')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xc598('0x1a')]()[_0xc598('0x1c')](voiceQueueReport[_0xc598('0x3c')]())[_0xc598('0x1c')](realtime[_0xc598('0x3d')]())[_0xc598('0x1c')](cmHopperHistory[_0xc598('0x3e')]())[_0xc598('0x1c')](realtime[_0xc598('0x3f')]())[_0xc598('0x1c')](cmHopperHistory[_0xc598('0x40')]())[_0xc598('0x1c')](realtime['initCampaignHopperHistory']())[_0xc598('0x1c')](voiceCallReport[_0xc598('0x41')]())[_0xc598('0x1c')](realtime[_0xc598('0x42')]())['then'](function(_0x3aa74a){})[_0xc598('0x43')](function(_0xf1429){console[_0xc598('0x44')](_0xf1429);});}function main(){return server['listen'](realtime,preview,fax)[_0xc598('0x1c')](function(_0x3a8a73){return initRealtime();})[_0xc598('0x1c')](function(){return initParams();})[_0xc598('0x1c')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xc598('0x43')](function(_0x4af5f7){console['log'](_0x4af5f7);});}main(); \ No newline at end of file +var _0xebdf=['initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts'];(function(_0x7c5834,_0xa96cfb){var _0x40becf=function(_0x579649){while(--_0x579649){_0x7c5834['push'](_0x7c5834['shift']());}};_0x40becf(++_0xa96cfb);}(_0xebdf,0x17d));var _0xfebd=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xebdf[_0x34bc30];return _0x5706de;};'use strict';var BPromise=require(_0xfebd('0x0'));var util=require(_0xfebd('0x1'));var moment=require(_0xfebd('0x2'));var server=require(_0xfebd('0x3'));var Realtime=require(_0xfebd('0x4'));var Report=require(_0xfebd('0x5'));var Acw=require('./acw');var Trigger=require(_0xfebd('0x6'));var Dialer=require(_0xfebd('0x7'));var Preview=require(_0xfebd('0x8'));var Fax=require(_0xfebd('0x9'));var user=require(_0xfebd('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xfebd('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xfebd('0xc'));var trigger=require('./rpc/trigger');var template=require(_0xfebd('0xd'));var cmHopperHistory=require(_0xfebd('0xe'));var campaign=require(_0xfebd('0xf'));var voiceExtension=require(_0xfebd('0x10'));var faxAccount=require(_0xfebd('0x11'));var zendesk=require(_0xfebd('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xfebd('0x13'));var freshdesk=require(_0xfebd('0x14'));var desk=require(_0xfebd('0x15'));var zoho=require(_0xfebd('0x16'));var vtiger=require(_0xfebd('0x17'));var freshsales=require(_0xfebd('0x18'));var servicenow=require(_0xfebd('0x19'));var dynamics365=require(_0xfebd('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xfebd('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfebd('0x1b')](_0xfebd('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xfebd('0x1d')]()[_0xfebd('0x1e')](user[_0xfebd('0x1f')]())[_0xfebd('0x1e')](realtime['initAgents']())['then'](user[_0xfebd('0x20')]())['then'](realtime[_0xfebd('0x21')]())[_0xfebd('0x1e')](trunk[_0xfebd('0x22')]())['then'](realtime[_0xfebd('0x23')]())[_0xfebd('0x1e')](voiceQueue[_0xfebd('0x24')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x25')]())['then'](trigger[_0xfebd('0x26')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x27')]())[_0xfebd('0x1e')](template[_0xfebd('0x28')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x29')]())[_0xfebd('0x1e')](zendesk[_0xfebd('0x2a')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x2b')]())['then'](salesforce[_0xfebd('0x2c')]())['then'](realtime[_0xfebd('0x2d')]())[_0xfebd('0x1e')](sugarcrm[_0xfebd('0x2e')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x2f')]())[_0xfebd('0x1e')](freshdesk[_0xfebd('0x30')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x31')]())[_0xfebd('0x1e')](desk[_0xfebd('0x32')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x33')]())[_0xfebd('0x1e')](zoho[_0xfebd('0x34')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x35')]())[_0xfebd('0x1e')](vtiger[_0xfebd('0x36')]())['then'](realtime[_0xfebd('0x37')]())['then'](freshsales['getFreshsalesAccounts']())[_0xfebd('0x1e')](realtime[_0xfebd('0x38')]())[_0xfebd('0x1e')](servicenow[_0xfebd('0x39')]())[_0xfebd('0x1e')](realtime[_0xfebd('0x3a')]())[_0xfebd('0x1e')](dynamics365[_0xfebd('0x3b')]())[_0xfebd('0x1e')](realtime['initDynamics365Accounts']())[_0xfebd('0x1e')](campaign[_0xfebd('0x3c')]())[_0xfebd('0x1e')](realtime['initCampaigns']())['then'](voiceExtension[_0xfebd('0x3d')]())[_0xfebd('0x1e')](realtime['initVoiceExtensions']())[_0xfebd('0x1e')](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xfebd('0x3e')]())['then'](cmHopperHistory[_0xfebd('0x3f')]())[_0xfebd('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0xfebd('0x1e')](cmHopperHistory[_0xfebd('0x40')]())['then'](realtime['initCampaignHopperHistory']())[_0xfebd('0x1e')](voiceCallReport[_0xfebd('0x41')]())['then'](realtime[_0xfebd('0x42')]())[_0xfebd('0x1e')](function(_0x2dafeb){})[_0xfebd('0x43')](function(_0x10e6a2){console[_0xfebd('0x44')](_0x10e6a2);});}function main(){return server[_0xfebd('0x45')](realtime,preview,fax)['then'](function(_0x4fa4aa){return initRealtime();})[_0xfebd('0x1e')](function(){return initParams();})[_0xfebd('0x1e')](function(){report[_0xfebd('0x46')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x50f407){console[_0xfebd('0x44')](_0x50f407);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 4fd9abd..fb5e78e 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x3fb282,_0xc01c40){var _0x4d0e2c=function(_0x1f93a2){while(--_0x1f93a2){_0x3fb282['push'](_0x3fb282['shift']());}};_0x4d0e2c(++_0xc01c40);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0xcb91[_0xdefbc3];return _0x367798;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x4b6cc8,_0x355e5b){var _0x5c4743=function(_0x68d0f6){while(--_0x68d0f6){_0x4b6cc8['push'](_0x4b6cc8['shift']());}};_0x5c4743(++_0x355e5b);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index eb3149d..8685044 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 _0x4dc4=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x2e66e9,_0x5e9458){var _0x1535d6=function(_0x419e47){while(--_0x419e47){_0x2e66e9['push'](_0x2e66e9['shift']());}};_0x1535d6(++_0x5e9458);}(_0x4dc4,0x73));var _0x44dc=function(_0x11a85a,_0x449ec1){_0x11a85a=_0x11a85a-0x0;var _0x4d4a99=_0x4dc4[_0x11a85a];return _0x4d4a99;};'use strict';function Campaign(_0x1bc118){this['id']=_0x1bc118['id']||0x0;this[_0x44dc('0x0')]=_0x1bc118[_0x44dc('0x0')]||'';this['type']=_0x1bc118[_0x44dc('0x1')]||'campaign';this['originated']=0x0;this[_0x44dc('0x2')]=0x0;this[_0x44dc('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x44dc('0x4')]='';this[_0x44dc('0x5')]=!![];this['active']=_0x1bc118['active'];this[_0x44dc('0x6')]=_0x1bc118[_0x44dc('0x6')];this['dialTimezone']=_0x1bc118[_0x44dc('0x7')]||null;this[_0x44dc('0x8')]=_0x1bc118[_0x44dc('0x8')]?_0x1bc118[_0x44dc('0x8')]:null;this[_0x44dc('0x9')]=_0x1bc118[_0x44dc('0x9')];this[_0x44dc('0xa')]=_0x1bc118[_0x44dc('0xa')];this[_0x44dc('0xb')]=_0x1bc118[_0x44dc('0xb')]||0x1e;this[_0x44dc('0xc')]=_0x1bc118[_0x44dc('0xc')];this[_0x44dc('0xd')]=_0x1bc118[_0x44dc('0xd')];this['dialBusyMaxRetry']=_0x1bc118['dialBusyMaxRetry'];this[_0x44dc('0xe')]=_0x1bc118[_0x44dc('0xe')];this[_0x44dc('0xf')]=_0x1bc118[_0x44dc('0xf')];this[_0x44dc('0x10')]=_0x1bc118[_0x44dc('0x10')];this[_0x44dc('0x11')]=_0x1bc118[_0x44dc('0x11')];this[_0x44dc('0x12')]=_0x1bc118['dialNoSuchNumberMaxRetry']||0x3;this[_0x44dc('0x13')]=_0x1bc118[_0x44dc('0x13')]||0x96;this[_0x44dc('0x14')]=_0x1bc118[_0x44dc('0x14')]||0x3;this[_0x44dc('0x15')]=_0x1bc118['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x1bc118[_0x44dc('0x16')]||0x3;this[_0x44dc('0x17')]=_0x1bc118[_0x44dc('0x17')]||0x96;this[_0x44dc('0x18')]=_0x1bc118['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x1bc118[_0x44dc('0x19')]||0x96;this[_0x44dc('0x1a')]=_0x1bc118[_0x44dc('0x1a')]||0x3;this[_0x44dc('0x1b')]=_0x1bc118[_0x44dc('0x1b')]||0x96;this[_0x44dc('0x1c')]=_0x1bc118['dialOrderByScheduledAt']||_0x44dc('0x1d');this[_0x44dc('0x1e')]=_0x1bc118[_0x44dc('0x1e')]||undefined;this[_0x44dc('0x1f')]=_0x1bc118[_0x44dc('0x1f')]||undefined;this['dialCutDigit']=_0x1bc118[_0x44dc('0x20')]||undefined;this[_0x44dc('0x21')]=_0x1bc118[_0x44dc('0x21')]?_0x1bc118['TrunkBackup']:undefined;this[_0x44dc('0x22')]=_0x1bc118[_0x44dc('0x22')]?_0x1bc118['Trunk']:undefined;this[_0x44dc('0x23')]=_0x1bc118[_0x44dc('0x23')]?_0x1bc118[_0x44dc('0x23')]:undefined;this[_0x44dc('0x24')]=_0x1bc118[_0x44dc('0x24')]?_0x1bc118[_0x44dc('0x24')]:undefined;this['dialQueueProject']=_0x1bc118[_0x44dc('0x24')]?_0x1bc118['SquareProject'][_0x44dc('0x0')]:undefined;this[_0x44dc('0x25')]=_0x1bc118[_0x44dc('0x25')]||![];this[_0x44dc('0x26')]=_0x1bc118['dialAMDInitialSilence'];this[_0x44dc('0x27')]=_0x1bc118['dialAMDGreeting'];this[_0x44dc('0x28')]=_0x1bc118[_0x44dc('0x28')];this[_0x44dc('0x29')]=_0x1bc118[_0x44dc('0x29')];this[_0x44dc('0x2a')]=_0x1bc118[_0x44dc('0x2a')];this[_0x44dc('0x2b')]=_0x1bc118[_0x44dc('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x1bc118[_0x44dc('0x2c')];this[_0x44dc('0x2d')]=_0x1bc118[_0x44dc('0x2d')];this[_0x44dc('0x2e')]=_0x1bc118['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0xd0f2=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry'];(function(_0x15e5f5,_0x5be5ba){var _0xf0feaa=function(_0x4b4e69){while(--_0x4b4e69){_0x15e5f5['push'](_0x15e5f5['shift']());}};_0xf0feaa(++_0x5be5ba);}(_0xd0f2,0x19d));var _0x2d0f=function(_0x967c6d,_0x350ddb){_0x967c6d=_0x967c6d-0x0;var _0x32dcf3=_0xd0f2[_0x967c6d];return _0x32dcf3;};'use strict';function Campaign(_0x7682ad){this['id']=_0x7682ad['id']||0x0;this[_0x2d0f('0x0')]=_0x7682ad[_0x2d0f('0x0')]||'';this[_0x2d0f('0x1')]=_0x7682ad[_0x2d0f('0x1')]||_0x2d0f('0x2');this[_0x2d0f('0x3')]=0x0;this[_0x2d0f('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x2d0f('0x5')]=0x0;this[_0x2d0f('0x6')]='';this[_0x2d0f('0x7')]=!![];this[_0x2d0f('0x8')]=_0x7682ad[_0x2d0f('0x8')];this[_0x2d0f('0x9')]=_0x7682ad['limitCalls'];this[_0x2d0f('0xa')]=_0x7682ad[_0x2d0f('0xa')]||null;this[_0x2d0f('0xb')]=_0x7682ad[_0x2d0f('0xb')]?_0x7682ad['dialGlobalInterval']:null;this[_0x2d0f('0xc')]=_0x7682ad['dialOriginateCallerIdName'];this[_0x2d0f('0xd')]=_0x7682ad['dialOriginateCallerIdNumber'];this[_0x2d0f('0xe')]=_0x7682ad[_0x2d0f('0xe')]||0x1e;this[_0x2d0f('0xf')]=_0x7682ad[_0x2d0f('0xf')];this[_0x2d0f('0x10')]=_0x7682ad[_0x2d0f('0x10')];this['dialBusyMaxRetry']=_0x7682ad[_0x2d0f('0x11')];this[_0x2d0f('0x12')]=_0x7682ad[_0x2d0f('0x12')];this[_0x2d0f('0x13')]=_0x7682ad[_0x2d0f('0x13')];this['dialNoAnswerRetryFrequency']=_0x7682ad['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x7682ad[_0x2d0f('0x14')];this[_0x2d0f('0x15')]=_0x7682ad[_0x2d0f('0x15')]||0x3;this[_0x2d0f('0x16')]=_0x7682ad[_0x2d0f('0x16')]||0x96;this[_0x2d0f('0x17')]=_0x7682ad[_0x2d0f('0x17')]||0x3;this[_0x2d0f('0x18')]=_0x7682ad[_0x2d0f('0x18')]||0x96;this[_0x2d0f('0x19')]=_0x7682ad[_0x2d0f('0x19')]||0x3;this[_0x2d0f('0x1a')]=_0x7682ad[_0x2d0f('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x7682ad[_0x2d0f('0x1b')]||0x3;this[_0x2d0f('0x1c')]=_0x7682ad['dialMachineRetryFrequency']||0x96;this[_0x2d0f('0x1d')]=_0x7682ad[_0x2d0f('0x1d')]||0x3;this[_0x2d0f('0x1e')]=_0x7682ad[_0x2d0f('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x7682ad[_0x2d0f('0x1f')]||'DESC';this[_0x2d0f('0x20')]=_0x7682ad[_0x2d0f('0x20')]||undefined;this[_0x2d0f('0x21')]=_0x7682ad[_0x2d0f('0x21')]||undefined;this[_0x2d0f('0x22')]=_0x7682ad[_0x2d0f('0x22')]||undefined;this[_0x2d0f('0x23')]=_0x7682ad['TrunkBackup']?_0x7682ad['TrunkBackup']:undefined;this['Trunk']=_0x7682ad['Trunk']?_0x7682ad['Trunk']:undefined;this[_0x2d0f('0x24')]=_0x7682ad['Interval']?_0x7682ad[_0x2d0f('0x24')]:undefined;this[_0x2d0f('0x25')]=_0x7682ad[_0x2d0f('0x25')]?_0x7682ad[_0x2d0f('0x25')]:undefined;this['dialQueueProject']=_0x7682ad['SquareProject']?_0x7682ad[_0x2d0f('0x25')][_0x2d0f('0x0')]:undefined;this[_0x2d0f('0x26')]=_0x7682ad['dialAMDActive']||![];this[_0x2d0f('0x27')]=_0x7682ad[_0x2d0f('0x27')];this[_0x2d0f('0x28')]=_0x7682ad[_0x2d0f('0x28')];this[_0x2d0f('0x29')]=_0x7682ad[_0x2d0f('0x29')];this[_0x2d0f('0x2a')]=_0x7682ad['dialAMDTotalAnalysisTime'];this[_0x2d0f('0x2b')]=_0x7682ad['dialAMDMinWordLength'];this[_0x2d0f('0x2c')]=_0x7682ad['dialAMDBetweenWordsSilence'];this[_0x2d0f('0x2d')]=_0x7682ad[_0x2d0f('0x2d')];this[_0x2d0f('0x2e')]=_0x7682ad[_0x2d0f('0x2e')];this[_0x2d0f('0x2f')]=_0x7682ad[_0x2d0f('0x2f')];}module[_0x2d0f('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 1475418..5b01cb0 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 _0x7732=['monitorFilename','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','unmanaged','abandoned','lastapplication','duration','tag','disposition','monitor'];(function(_0x1787bb,_0x2fb7db){var _0x3749c2=function(_0x451a81){while(--_0x451a81){_0x1787bb['push'](_0x1787bb['shift']());}};_0x3749c2(++_0x2fb7db);}(_0x7732,0x7d));var _0x2773=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x7732[_0x37a79c];return _0x561d89;};'use strict';function Channel(){this[_0x2773('0x0')]=null;this[_0x2773('0x1')]='';this['destinationchannel']='';this[_0x2773('0x2')]=0x0;this[_0x2773('0x3')]='';this[_0x2773('0x4')]=undefined;this[_0x2773('0x5')]=undefined;this[_0x2773('0x6')]=0x0;this[_0x2773('0x7')]='';this[_0x2773('0x8')]=0x0;this[_0x2773('0x9')]=0x0;this['exten']=0x0;this[_0x2773('0xa')]=![];this[_0x2773('0xb')]=null;this['endtime']=null;this[_0x2773('0xc')]=![];this[_0x2773('0xd')]=![];this[_0x2773('0xe')]='';this['lastdata']='';this[_0x2773('0xf')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0x2773('0x10')]=null;this[_0x2773('0x11')]=null;this[_0x2773('0x12')]=![];this[_0x2773('0x13')]=null;this['queue']=null;this['monitors']=[];this[_0x2773('0x14')]=undefined;this[_0x2773('0x15')]=undefined;this[_0x2773('0x16')]=undefined;this[_0x2773('0x17')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xa965=['exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','calleridnum','calleridname','connectedlinenum','connectedlinename','uniqueid'];(function(_0x182b77,_0x3632f9){var _0x2105cc=function(_0x5e3b55){while(--_0x5e3b55){_0x182b77['push'](_0x182b77['shift']());}};_0x2105cc(++_0x3632f9);}(_0xa965,0x172));var _0x5a96=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0xa965[_0x2a453b];return _0x132f79;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this['destinationchannel']='';this[_0x5a96('0x0')]=0x0;this[_0x5a96('0x1')]='';this[_0x5a96('0x2')]=undefined;this[_0x5a96('0x3')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x5a96('0x4')]=0x0;this['linkedid']=0x0;this[_0x5a96('0x5')]=0x0;this[_0x5a96('0x6')]=![];this[_0x5a96('0x7')]=null;this[_0x5a96('0x8')]=null;this['unmanaged']=![];this[_0x5a96('0x9')]=![];this[_0x5a96('0xa')]='';this[_0x5a96('0xb')]='';this[_0x5a96('0xc')]=0x0;this['billableseconds']=0x0;this[_0x5a96('0xd')]=0x0;this[_0x5a96('0xe')]=null;this[_0x5a96('0xf')]=null;this['disposition']=null;this[_0x5a96('0x10')]=![];this[_0x5a96('0x11')]=null;this[_0x5a96('0x12')]=null;this[_0x5a96('0x13')]=[];this[_0x5a96('0x14')]=undefined;this[_0x5a96('0x15')]=undefined;this[_0x5a96('0x16')]=undefined;this[_0x5a96('0x17')]=0x0;}module[_0x5a96('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e2f8435..6dac456 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 _0xec00=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','name','username'];(function(_0x32a5d8,_0x1d43b1){var _0x4f2f0e=function(_0x12c09f){while(--_0x12c09f){_0x32a5d8['push'](_0x32a5d8['shift']());}};_0x4f2f0e(++_0x1d43b1);}(_0xec00,0x134));var _0x0ec0=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xec00[_0x1b1e76];return _0x3d743a;};'use strict';function DeskAccount(_0x3de84c){this['id']=_0x3de84c['id']||0x0;this[_0x0ec0('0x0')]=_0x3de84c[_0x0ec0('0x0')]||'';this[_0x0ec0('0x1')]=_0x3de84c[_0x0ec0('0x1')]||'';this[_0x0ec0('0x2')]=_0x3de84c[_0x0ec0('0x2')]||'';this[_0x0ec0('0x3')]=_0x3de84c['authType']||'';this[_0x0ec0('0x4')]=_0x3de84c[_0x0ec0('0x4')]||'';this[_0x0ec0('0x5')]=_0x3de84c[_0x0ec0('0x5')]||'';this[_0x0ec0('0x6')]=_0x3de84c['consumerSecret']||'';this['token']=_0x3de84c[_0x0ec0('0x7')]||'';this[_0x0ec0('0x8')]=_0x3de84c[_0x0ec0('0x8')]||'';this[_0x0ec0('0x9')]=_0x3de84c['type']||'';this['serverUrl']=_0x3de84c['serverUrl']||'';this['Configurations']=_0x3de84c['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x82a0=['tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x15105e,_0xef49b){var _0x4b5afb=function(_0x225037){while(--_0x225037){_0x15105e['push'](_0x15105e['shift']());}};_0x4b5afb(++_0xef49b);}(_0x82a0,0x119));var _0x082a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x82a0[_0x46e363];return _0x3fb059;};'use strict';function DeskAccount(_0x37abd2){this['id']=_0x37abd2['id']||0x0;this['name']=_0x37abd2['name']||'';this[_0x082a('0x0')]=_0x37abd2[_0x082a('0x0')]||'';this[_0x082a('0x1')]=_0x37abd2[_0x082a('0x1')]||'';this[_0x082a('0x2')]=_0x37abd2['authType']||'';this[_0x082a('0x3')]=_0x37abd2[_0x082a('0x3')]||'';this[_0x082a('0x4')]=_0x37abd2['consumerKey']||'';this[_0x082a('0x5')]=_0x37abd2[_0x082a('0x5')]||'';this['token']=_0x37abd2[_0x082a('0x6')]||'';this[_0x082a('0x7')]=_0x37abd2[_0x082a('0x7')]||'';this[_0x082a('0x8')]=_0x37abd2[_0x082a('0x8')]||'';this[_0x082a('0x9')]=_0x37abd2['serverUrl']||'';this[_0x082a('0xa')]=_0x37abd2[_0x082a('0xa')]||{};}module[_0x082a('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 239d4b7..6d4606d 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 _0xf7b4=['Configurations','exports','username','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x4fa3d2,_0x1bb8db){var _0x1ea3fd=function(_0x4d832e){while(--_0x4d832e){_0x4fa3d2['push'](_0x4fa3d2['shift']());}};_0x1ea3fd(++_0x1bb8db);}(_0xf7b4,0x152));var _0x4f7b=function(_0x690d52,_0x5755fb){_0x690d52=_0x690d52-0x0;var _0x3e6435=_0xf7b4[_0x690d52];return _0x3e6435;};'use strict';function Dynamics365Account(_0x4e182d){this['id']=_0x4e182d['id']||0x0;this['name']=_0x4e182d['name']||'';this[_0x4f7b('0x0')]=_0x4e182d[_0x4f7b('0x0')]||'';this['password']=_0x4e182d['password']||'';this[_0x4f7b('0x1')]=_0x4e182d[_0x4f7b('0x1')]||'';this[_0x4f7b('0x2')]=_0x4e182d[_0x4f7b('0x2')]||'';this[_0x4f7b('0x3')]=_0x4e182d[_0x4f7b('0x3')]||'';this[_0x4f7b('0x4')]=_0x4e182d[_0x4f7b('0x4')]||{};this[_0x4f7b('0x5')]=_0x4e182d[_0x4f7b('0x5')]||'';this[_0x4f7b('0x6')]=_0x4e182d[_0x4f7b('0x6')]||{};}module[_0x4f7b('0x7')]=Dynamics365Account; \ No newline at end of file +var _0xf109=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name'];(function(_0x5e5a0a,_0x2cbb51){var _0x546a19=function(_0x3128a1){while(--_0x3128a1){_0x5e5a0a['push'](_0x5e5a0a['shift']());}};_0x546a19(++_0x2cbb51);}(_0xf109,0xce));var _0x9f10=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xf109[_0x4f9b18];return _0x29f20c;};'use strict';function Dynamics365Account(_0x4debcd){this['id']=_0x4debcd['id']||0x0;this[_0x9f10('0x0')]=_0x4debcd[_0x9f10('0x0')]||'';this['username']=_0x4debcd['username']||'';this['password']=_0x4debcd[_0x9f10('0x1')]||'';this[_0x9f10('0x2')]=_0x4debcd[_0x9f10('0x2')]||'';this[_0x9f10('0x3')]=_0x4debcd[_0x9f10('0x3')]||'';this[_0x9f10('0x4')]=_0x4debcd[_0x9f10('0x4')]||'';this[_0x9f10('0x5')]=_0x4debcd[_0x9f10('0x5')]||{};this[_0x9f10('0x6')]=_0x4debcd[_0x9f10('0x6')]||'';this['Configurations']=_0x4debcd[_0x9f10('0x7')]||{};}module[_0x9f10('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a3f6cde..555fc23 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 _0x2da4=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x465cee,_0x44a86d){var _0x3c3aa3=function(_0x4dcb6d){while(--_0x4dcb6d){_0x465cee['push'](_0x465cee['shift']());}};_0x3c3aa3(++_0x44a86d);}(_0x2da4,0x198));var _0x42da=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2da4[_0x14add3];return _0x4a174f;};'use strict';function FaxAccount(_0x4ae8ed){this['id']=_0x4ae8ed['id']||0x0;this[_0x42da('0x0')]=_0x4ae8ed[_0x42da('0x0')]||'';this[_0x42da('0x1')]=_0x4ae8ed[_0x42da('0x1')];this['ecm']=_0x4ae8ed['ecm'];this['headerinfo']=_0x4ae8ed[_0x42da('0x2')];this[_0x42da('0x3')]=_0x4ae8ed[_0x42da('0x3')];this['minrate']=_0x4ae8ed[_0x42da('0x4')]||0x960;this['maxrate']=_0x4ae8ed[_0x42da('0x5')]||0x3840;this[_0x42da('0x6')]=_0x4ae8ed[_0x42da('0x6')]||_0x42da('0x7');this['gateway']=_0x4ae8ed[_0x42da('0x8')]||'no';this['faxdetect']=_0x4ae8ed[_0x42da('0x9')]||'no';this[_0x42da('0xa')]=_0x4ae8ed[_0x42da('0xa')]||0x1388;this[_0x42da('0xb')]=_0x4ae8ed[_0x42da('0xb')]||_0x42da('0xc');this[_0x42da('0xd')]=_0x4ae8ed['Trunk']?_0x4ae8ed[_0x42da('0xd')]:undefined;this[_0x42da('0xe')]=_0x4ae8ed[_0x42da('0xe')];this[_0x42da('0xf')]=_0x4ae8ed[_0x42da('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x73a3=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo'];(function(_0x559dbf,_0x249d39){var _0x578eb7=function(_0x18389e){while(--_0x18389e){_0x559dbf['push'](_0x559dbf['shift']());}};_0x578eb7(++_0x249d39);}(_0x73a3,0x7c));var _0x373a=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x73a3[_0xefd519];return _0x4bb882;};'use strict';function FaxAccount(_0xf607d1){this['id']=_0xf607d1['id']||0x0;this[_0x373a('0x0')]=_0xf607d1[_0x373a('0x0')]||'';this[_0x373a('0x1')]=_0xf607d1[_0x373a('0x1')];this['ecm']=_0xf607d1[_0x373a('0x2')];this['headerinfo']=_0xf607d1[_0x373a('0x3')];this[_0x373a('0x4')]=_0xf607d1[_0x373a('0x4')];this[_0x373a('0x5')]=_0xf607d1[_0x373a('0x5')]||0x960;this[_0x373a('0x6')]=_0xf607d1[_0x373a('0x6')]||0x3840;this[_0x373a('0x7')]=_0xf607d1['modem']||_0x373a('0x8');this[_0x373a('0x9')]=_0xf607d1['gateway']||'no';this[_0x373a('0xa')]=_0xf607d1[_0x373a('0xa')]||'no';this[_0x373a('0xb')]=_0xf607d1['t38timeout']||0x1388;this[_0x373a('0xc')]=_0xf607d1[_0x373a('0xc')]||'SIP';this[_0x373a('0xd')]=_0xf607d1[_0x373a('0xd')]?_0xf607d1[_0x373a('0xd')]:undefined;this['ListId']=_0xf607d1[_0x373a('0xe')];this['key']=_0xf607d1[_0x373a('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 87be796..9e064d2 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 _0xce44=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x24b5d8,_0x203128){var _0x54908d=function(_0x3b0db0){while(--_0x3b0db0){_0x24b5d8['push'](_0x24b5d8['shift']());}};_0x54908d(++_0x203128);}(_0xce44,0x19a));var _0x4ce4=function(_0x3d3262,_0x4bf31f){_0x3d3262=_0x3d3262-0x0;var _0x5db3d1=_0xce44[_0x3d3262];return _0x5db3d1;};'use strict';function FreshdeskAccount(_0x5ba869){this['id']=_0x5ba869['id']||0x0;this['name']=_0x5ba869[_0x4ce4('0x0')]||'';this['username']=_0x5ba869[_0x4ce4('0x1')]||'';this[_0x4ce4('0x2')]=_0x5ba869[_0x4ce4('0x3')]||'';this[_0x4ce4('0x4')]=_0x5ba869[_0x4ce4('0x4')]||'';this['serverUrl']=_0x5ba869[_0x4ce4('0x5')]||'';this[_0x4ce4('0x6')]=_0x5ba869['Configurations']||{};}module[_0x4ce4('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xfa6a=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x19da1a,_0x356695){var _0x1144c6=function(_0x310a0b){while(--_0x310a0b){_0x19da1a['push'](_0x19da1a['shift']());}};_0x1144c6(++_0x356695);}(_0xfa6a,0x12e));var _0xafa6=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xfa6a[_0x1cc8fe];return _0x230054;};'use strict';function FreshdeskAccount(_0x27fb9b){this['id']=_0x27fb9b['id']||0x0;this[_0xafa6('0x0')]=_0x27fb9b[_0xafa6('0x0')]||'';this[_0xafa6('0x1')]=_0x27fb9b[_0xafa6('0x1')]||'';this['apiKey']=_0x27fb9b[_0xafa6('0x2')]||'';this[_0xafa6('0x3')]=_0x27fb9b[_0xafa6('0x3')]||'';this[_0xafa6('0x4')]=_0x27fb9b[_0xafa6('0x4')]||'';this['Configurations']=_0x27fb9b[_0xafa6('0x5')]||{};}module[_0xafa6('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 515d8d6..f048938 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 _0xff3c=['serverUrl','Configurations','name','username','remoteUri'];(function(_0xc4488c,_0x31a20d){var _0x59db20=function(_0x381061){while(--_0x381061){_0xc4488c['push'](_0xc4488c['shift']());}};_0x59db20(++_0x31a20d);}(_0xff3c,0x179));var _0xcff3=function(_0x1c7cc9,_0x2b6eed){_0x1c7cc9=_0x1c7cc9-0x0;var _0x1cfc62=_0xff3c[_0x1c7cc9];return _0x1cfc62;};'use strict';function FreshsalesAccount(_0x316a7c){this['id']=_0x316a7c['id']||0x0;this[_0xcff3('0x0')]=_0x316a7c['name']||'';this[_0xcff3('0x1')]=_0x316a7c[_0xcff3('0x1')]||'';this['apiKey']=_0x316a7c['token']||'';this[_0xcff3('0x2')]=_0x316a7c[_0xcff3('0x2')]||'';this[_0xcff3('0x3')]=_0x316a7c[_0xcff3('0x3')]||'';this[_0xcff3('0x4')]=_0x316a7c[_0xcff3('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xc15b=['apiKey','remoteUri','serverUrl','name','username'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc15b,0xe4));var _0xbc15=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xc15b[_0x456fb1];return _0x4083d6;};'use strict';function FreshsalesAccount(_0x31e197){this['id']=_0x31e197['id']||0x0;this['name']=_0x31e197[_0xbc15('0x0')]||'';this[_0xbc15('0x1')]=_0x31e197[_0xbc15('0x1')]||'';this[_0xbc15('0x2')]=_0x31e197['token']||'';this['remoteUri']=_0x31e197[_0xbc15('0x3')]||'';this[_0xbc15('0x4')]=_0x31e197[_0xbc15('0x4')]||'';this['Configurations']=_0x31e197['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 962e976..6184e89 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 _0xf3df=['queuecallercomplete','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon'];(function(_0x1db3d4,_0x50c07a){var _0x39d118=function(_0x5e8ae5){while(--_0x5e8ae5){_0x1db3d4['push'](_0x1db3d4['shift']());}};_0x39d118(++_0x50c07a);}(_0xf3df,0x1ee));var _0xff3d=function(_0x1cbcb2,_0x1237a3){_0x1cbcb2=_0x1cbcb2-0x0;var _0x41ac9f=_0xf3df[_0x1cbcb2];return _0x41ac9f;};'use strict';function QueueReport(){this[_0xff3d('0x0')]=_0xff3d('0x1');this[_0xff3d('0x2')]='';this[_0xff3d('0x3')]='';this[_0xff3d('0x4')]='';this[_0xff3d('0x5')]='';this[_0xff3d('0x6')]=null;this[_0xff3d('0x7')]=null;this['position']=0x1;this[_0xff3d('0x8')]=0x1;this[_0xff3d('0x9')]=![];this['queuecallerabandonAt']=null;this[_0xff3d('0xa')]=![];this['queuecallercompleteAt']=null;this[_0xff3d('0xb')]=![];this[_0xff3d('0xc')]=null;this['originalposition']=0x1;this['channel']='';this[_0xff3d('0xd')]='';this[_0xff3d('0xe')]='';this[_0xff3d('0xf')]='';this[_0xff3d('0x10')]='';this['exten']='';this[_0xff3d('0x11')]='';this[_0xff3d('0x12')]=0x0;this[_0xff3d('0x13')]=![];this[_0xff3d('0x14')]='';this[_0xff3d('0x15')]=0x0;this[_0xff3d('0x16')]={};}module[_0xff3d('0x17')]=QueueReport; \ No newline at end of file +var _0x7b25=['queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','assigned','lastAssignedTo','mohtime','exports','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt'];(function(_0x2a0a46,_0xe7676c){var _0x431417=function(_0x28995a){while(--_0x28995a){_0x2a0a46['push'](_0x2a0a46['shift']());}};_0x431417(++_0xe7676c);}(_0x7b25,0x65));var _0x57b2=function(_0x1dd82c,_0x3b3aef){_0x1dd82c=_0x1dd82c-0x0;var _0x1c8592=_0x7b25[_0x1dd82c];return _0x1c8592;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this[_0x57b2('0x0')]='';this[_0x57b2('0x1')]='';this[_0x57b2('0x2')]='';this['queuecallerjoinAt']=null;this[_0x57b2('0x3')]=null;this[_0x57b2('0x4')]=0x1;this[_0x57b2('0x5')]=0x1;this[_0x57b2('0x6')]=![];this[_0x57b2('0x7')]=null;this['queuecallercomplete']=![];this[_0x57b2('0x8')]=null;this[_0x57b2('0x9')]=![];this[_0x57b2('0xa')]=null;this[_0x57b2('0xb')]=0x1;this[_0x57b2('0xc')]='';this[_0x57b2('0xd')]='';this['connectedlinename']='';this[_0x57b2('0xe')]='';this[_0x57b2('0xf')]='';this[_0x57b2('0x10')]='';this[_0x57b2('0x11')]='';this['holdtime']=0x0;this[_0x57b2('0x12')]=![];this[_0x57b2('0x13')]='';this[_0x57b2('0x14')]=0x0;this['variables']={};}module[_0x57b2('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 3c8d4ea..f01f651 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 _0xec33=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x2640af,_0x2eebb7){var _0x3bb51b=function(_0x5d01f8){while(--_0x5d01f8){_0x2640af['push'](_0x2640af['shift']());}};_0x3bb51b(++_0x2eebb7);}(_0xec33,0x1f4));var _0x3ec3=function(_0x409e29,_0x33ae4b){_0x409e29=_0x409e29-0x0;var _0x45acc2=_0xec33[_0x409e29];return _0x45acc2;};'use strict';function SalesforceAccount(_0x45e98b){this['id']=_0x45e98b['id']||0x0;this[_0x3ec3('0x0')]=_0x45e98b[_0x3ec3('0x0')]||'';this[_0x3ec3('0x1')]=_0x45e98b[_0x3ec3('0x1')]||'';this[_0x3ec3('0x2')]=_0x45e98b[_0x3ec3('0x2')]||'';this['password']=_0x45e98b[_0x3ec3('0x3')]||'';this[_0x3ec3('0x4')]=_0x45e98b[_0x3ec3('0x4')]||'';this[_0x3ec3('0x5')]=_0x45e98b['clientSecret']||'';this[_0x3ec3('0x6')]=_0x45e98b['securityToken']||'';this['type']=_0x45e98b[_0x3ec3('0x7')]||_0x3ec3('0x8');this[_0x3ec3('0x9')]=_0x45e98b['serverUrl']||'';this[_0x3ec3('0xa')]=_0x45e98b[_0x3ec3('0xa')]||{};}module[_0x3ec3('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xb1a6=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x72fc6f,_0xee02aa){var _0x37bbc8=function(_0x39bdf3){while(--_0x39bdf3){_0x72fc6f['push'](_0x72fc6f['shift']());}};_0x37bbc8(++_0xee02aa);}(_0xb1a6,0x143));var _0x6b1a=function(_0x4d28d8,_0x13230a){_0x4d28d8=_0x4d28d8-0x0;var _0x256c49=_0xb1a6[_0x4d28d8];return _0x256c49;};'use strict';function SalesforceAccount(_0x33cb10){this['id']=_0x33cb10['id']||0x0;this[_0x6b1a('0x0')]=_0x33cb10[_0x6b1a('0x0')]||'';this['username']=_0x33cb10[_0x6b1a('0x1')]||'';this[_0x6b1a('0x2')]=_0x33cb10['remoteUri']||'';this[_0x6b1a('0x3')]=_0x33cb10[_0x6b1a('0x3')]||'';this[_0x6b1a('0x4')]=_0x33cb10[_0x6b1a('0x4')]||'';this['clientSecret']=_0x33cb10[_0x6b1a('0x5')]||'';this[_0x6b1a('0x6')]=_0x33cb10[_0x6b1a('0x6')]||'';this['type']=_0x33cb10[_0x6b1a('0x7')]||_0x6b1a('0x8');this[_0x6b1a('0x9')]=_0x33cb10[_0x6b1a('0x9')]||'';this['Configurations']=_0x33cb10[_0x6b1a('0xa')]||{};}module[_0x6b1a('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 851e692..1ca5103 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 _0x0ce9=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x527c39,_0x3ea2a6){var _0x3f4dd6=function(_0x1ec265){while(--_0x1ec265){_0x527c39['push'](_0x527c39['shift']());}};_0x3f4dd6(++_0x3ea2a6);}(_0x0ce9,0x195));var _0x90ce=function(_0x3bdb20,_0x22c32b){_0x3bdb20=_0x3bdb20-0x0;var _0x274408=_0x0ce9[_0x3bdb20];return _0x274408;};'use strict';function ServicenowAccount(_0x41e0a6){this['id']=_0x41e0a6['id']||0x0;this[_0x90ce('0x0')]=_0x41e0a6[_0x90ce('0x0')]||'';this[_0x90ce('0x1')]=_0x41e0a6[_0x90ce('0x1')]||'';this['password']=_0x41e0a6['password']||'';this[_0x90ce('0x2')]=_0x41e0a6['remoteUri']||'';this[_0x90ce('0x3')]=_0x41e0a6['serverUrl']||'';this[_0x90ce('0x4')]=_0x41e0a6[_0x90ce('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xe06e=['password','serverUrl','Configurations','name','username'];(function(_0x2f4d7f,_0x62f4b7){var _0x147ba1=function(_0x14ef36){while(--_0x14ef36){_0x2f4d7f['push'](_0x2f4d7f['shift']());}};_0x147ba1(++_0x62f4b7);}(_0xe06e,0x80));var _0xee06=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xe06e[_0x2f3848];return _0x102668;};'use strict';function ServicenowAccount(_0x5a2141){this['id']=_0x5a2141['id']||0x0;this[_0xee06('0x0')]=_0x5a2141[_0xee06('0x0')]||'';this[_0xee06('0x1')]=_0x5a2141[_0xee06('0x1')]||'';this[_0xee06('0x2')]=_0x5a2141[_0xee06('0x2')]||'';this['remoteUri']=_0x5a2141['remoteUri']||'';this[_0xee06('0x3')]=_0x5a2141['serverUrl']||'';this[_0xee06('0x4')]=_0x5a2141['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 409d65f..4248652 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 _0x80b5=['password','remoteUri','serverUrl','exports','name','username'];(function(_0x28237e,_0x2a7f11){var _0x1c014b=function(_0xaa0d6d){while(--_0xaa0d6d){_0x28237e['push'](_0x28237e['shift']());}};_0x1c014b(++_0x2a7f11);}(_0x80b5,0x70));var _0x580b=function(_0x56fbaa,_0x3bc5a6){_0x56fbaa=_0x56fbaa-0x0;var _0x49fbc1=_0x80b5[_0x56fbaa];return _0x49fbc1;};'use strict';function SugarcrmAccount(_0x2c2f92){this['id']=_0x2c2f92['id']||0x0;this[_0x580b('0x0')]=_0x2c2f92[_0x580b('0x0')]||'';this[_0x580b('0x1')]=_0x2c2f92[_0x580b('0x1')]||'';this[_0x580b('0x2')]=_0x2c2f92[_0x580b('0x2')]||'';this[_0x580b('0x3')]=_0x2c2f92['remoteUri']||'';this[_0x580b('0x4')]=_0x2c2f92['serverUrl']||'';this['Configurations']=_0x2c2f92['Configurations']||{};}module[_0x580b('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xa00f=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0xa00f,0xeb));var _0xfa00=function(_0x11f3c5,_0x4766a3){_0x11f3c5=_0x11f3c5-0x0;var _0xc0b593=_0xa00f[_0x11f3c5];return _0xc0b593;};'use strict';function SugarcrmAccount(_0x4c031b){this['id']=_0x4c031b['id']||0x0;this[_0xfa00('0x0')]=_0x4c031b[_0xfa00('0x0')]||'';this['username']=_0x4c031b[_0xfa00('0x1')]||'';this['password']=_0x4c031b[_0xfa00('0x2')]||'';this['remoteUri']=_0x4c031b[_0xfa00('0x3')]||'';this[_0xfa00('0x4')]=_0x4c031b[_0xfa00('0x4')]||'';this[_0xfa00('0x5')]=_0x4c031b['Configurations']||{};}module[_0xfa00('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 7217add..6fe7ea8 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 _0x33c4=['exports','name','accountcode','state','unknown','stateTime','address'];(function(_0x37e705,_0xba61db){var _0xba0a12=function(_0x293335){while(--_0x293335){_0x37e705['push'](_0x37e705['shift']());}};_0xba0a12(++_0xba61db);}(_0x33c4,0xef));var _0x433c=function(_0x3336b6,_0x127d4f){_0x3336b6=_0x3336b6-0x0;var _0x520cba=_0x33c4[_0x3336b6];return _0x520cba;};'use strict';function Telephone(_0x270a2d){this['id']=_0x270a2d['id']||0x0;this[_0x433c('0x0')]=_0x270a2d[_0x433c('0x0')]||'';this[_0x433c('0x1')]=_0x270a2d[_0x433c('0x1')]||'';this[_0x433c('0x2')]=_0x433c('0x3');this[_0x433c('0x4')]=0x0;this['status']=_0x433c('0x3');this[_0x433c('0x5')]='';}module[_0x433c('0x6')]=Telephone; \ No newline at end of file +var _0x0c96=['status','unknown','name','accountcode','state'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0c96,0x1a6));var _0x60c9=function(_0x4de430,_0x488105){_0x4de430=_0x4de430-0x0;var _0x1a02e1=_0x0c96[_0x4de430];return _0x1a02e1;};'use strict';function Telephone(_0x337deb){this['id']=_0x337deb['id']||0x0;this['name']=_0x337deb[_0x60c9('0x0')]||'';this[_0x60c9('0x1')]=_0x337deb[_0x60c9('0x1')]||'';this[_0x60c9('0x2')]='unknown';this['stateTime']=0x0;this[_0x60c9('0x3')]=_0x60c9('0x4');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 598a7e0..7ae59df 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(_0x3e2260,_0x28355d){var _0x4d4f7d=function(_0x9f1ab2){while(--_0x9f1ab2){_0x3e2260['push'](_0x3e2260['shift']());}};_0x4d4f7d(++_0x28355d);}(_0xb10b,0x12a));var _0xbb10=function(_0x156a77,_0x522c13){_0x156a77=_0x156a77-0x0;var _0x32398a=_0xb10b[_0x156a77];return _0x32398a;};'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(_0x1c3c56,_0x651112){var _0x1e916b=function(_0x474ab0){while(--_0x474ab0){_0x1c3c56['push'](_0x1c3c56['shift']());}};_0x1e916b(++_0x651112);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 97b3653..57d8ea5 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x3c1315,_0x5aa5e1){var _0x1c979e=function(_0x4f498d){while(--_0x4f498d){_0x3c1315['push'](_0x3c1315['shift']());}};_0x1c979e(++_0x5aa5e1);}(_0xda2d,0x102));var _0xdda2=function(_0x25b8fc,_0xbb6a16){_0x25b8fc=_0x25b8fc-0x0;var _0x31e065=_0xda2d[_0x25b8fc];return _0x31e065;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 815395c..3a1693f 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 _0x6cf8=['exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime','defaultuser'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x6cf8,0xcd));var _0x86cf=function(_0x26c3ae,_0x11032d){_0x26c3ae=_0x26c3ae-0x0;var _0x506c5e=_0x6cf8[_0x26c3ae];return _0x506c5e;};'use strict';function Trunk(_0x3bda7d){this['id']=_0x3bda7d['id']||0x0;this[_0x86cf('0x0')]=_0x3bda7d[_0x86cf('0x0')]||![];this[_0x86cf('0x1')]=_0x3bda7d[_0x86cf('0x1')]||'';this[_0x86cf('0x2')]='unknown';this[_0x86cf('0x3')]=0x0;this[_0x86cf('0x4')]=_0x86cf('0x5');this[_0x86cf('0x6')]=_0x3bda7d['registry']&&_0x3bda7d[_0x86cf('0x6')][_0x86cf('0x7')](':')?_0x3bda7d[_0x86cf('0x6')][_0x86cf('0x8')](':')[0x0]:'';this[_0x86cf('0x9')]='';this[_0x86cf('0xa')]='';this['domain']='';this[_0x86cf('0xb')]='';this[_0x86cf('0xc')]='';this[_0x86cf('0xd')]='unknown';this[_0x86cf('0xe')]='';this['address']='';this[_0x86cf('0xf')]=_0x3bda7d[_0x86cf('0xf')]||'';}module[_0x86cf('0x10')]=Trunk; \ No newline at end of file +var _0xf6cc=['exports','active','state','unknown','stateTime','registry','indexOf','split','host','domain','domainport','stateRegistry','address','defaultuser'];(function(_0x1dfc77,_0x2d36af){var _0x5a41a3=function(_0x4bbc62){while(--_0x4bbc62){_0x1dfc77['push'](_0x1dfc77['shift']());}};_0x5a41a3(++_0x2d36af);}(_0xf6cc,0x151));var _0xcf6c=function(_0x4da84c,_0x225601){_0x4da84c=_0x4da84c-0x0;var _0x4998ef=_0xf6cc[_0x4da84c];return _0x4998ef;};'use strict';function Trunk(_0x233e84){this['id']=_0x233e84['id']||0x0;this[_0xcf6c('0x0')]=_0x233e84[_0xcf6c('0x0')]||![];this['name']=_0x233e84['name']||'';this[_0xcf6c('0x1')]=_0xcf6c('0x2');this[_0xcf6c('0x3')]=0x0;this['status']=_0xcf6c('0x2');this[_0xcf6c('0x4')]=_0x233e84['registry']&&_0x233e84['registry'][_0xcf6c('0x5')](':')?_0x233e84[_0xcf6c('0x4')][_0xcf6c('0x6')](':')[0x0]:'';this[_0xcf6c('0x7')]='';this['port']='';this[_0xcf6c('0x8')]='';this[_0xcf6c('0x9')]='';this['refresh']='';this[_0xcf6c('0xa')]=_0xcf6c('0x2');this['registrationtime']='';this[_0xcf6c('0xb')]='';this[_0xcf6c('0xc')]=_0x233e84[_0xcf6c('0xc')]||'';}module[_0xcf6c('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d9a0446..651b31e 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 _0xa19c=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0xf10df,_0x42ca8d){var _0x43dd76=function(_0x19be0e){while(--_0x19be0e){_0xf10df['push'](_0xf10df['shift']());}};_0x43dd76(++_0x42ca8d);}(_0xa19c,0x1ce));var _0xca19=function(_0x417de2,_0x2898e0){_0x417de2=_0x417de2-0x0;var _0x4ff3cb=_0xa19c[_0x417de2];return _0x4ff3cb;};'use strict';function voiceExtension(_0x4363cb){this['id']=_0x4363cb['id']||0x0;this[_0xca19('0x0')]=_0x4363cb[_0xca19('0x0')]||'';this[_0xca19('0x1')]=_0x4363cb[_0xca19('0x1')]||_0xca19('0x2');this[_0xca19('0x3')]=_0x4363cb[_0xca19('0x3')]||![];}module[_0xca19('0x4')]=voiceExtension; \ No newline at end of file +var _0xe479=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x2acd64,_0x4e8ce8){var _0x3d3fce=function(_0x5570df){while(--_0x5570df){_0x2acd64['push'](_0x2acd64['shift']());}};_0x3d3fce(++_0x4e8ce8);}(_0xe479,0x12c));var _0x9e47=function(_0x2e5690,_0x38f974){_0x2e5690=_0x2e5690-0x0;var _0x576759=_0xe479[_0x2e5690];return _0x576759;};'use strict';function voiceExtension(_0x11cb51){this['id']=_0x11cb51['id']||0x0;this[_0x9e47('0x0')]=_0x11cb51['exten']||'';this[_0x9e47('0x1')]=_0x11cb51['recordingFormat']||'none';this[_0x9e47('0x2')]=_0x11cb51[_0x9e47('0x2')]||![];}module[_0x9e47('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e6927c1..ca49a66 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 _0xe34e=['acw','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','name','monitor_format','type','waiting','total','answered','sumBillable','unmanaged','abandoned','available'];(function(_0x5752c8,_0x1e1393){var _0x2eb875=function(_0x1cadc4){while(--_0x1cadc4){_0x5752c8['push'](_0x5752c8['shift']());}};_0x2eb875(++_0x1e1393);}(_0xe34e,0x132));var _0xee34=function(_0x426c47,_0x4ebf0b){_0x426c47=_0x426c47-0x0;var _0x10a020=_0xe34e[_0x426c47];return _0x10a020;};'use strict';var statusDesc=[_0xee34('0x0'),_0xee34('0x1'),'inuse',_0xee34('0x2'),_0xee34('0x3'),_0xee34('0x4'),_0xee34('0x5'),_0xee34('0x6'),_0xee34('0x7')];var monitorFormat={'wav':_0xee34('0x8'),'wav49':_0xee34('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0xee34('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x45e589){this['id']=_0x45e589['id']||0x0;this[_0xee34('0xb')]=_0x45e589[_0xee34('0xb')]||'';this[_0xee34('0xc')]=_0x45e589[_0xee34('0xc')]||'';this[_0xee34('0xd')]=_0x45e589[_0xee34('0xd')]||'inbound';this[_0xee34('0xe')]=0x0;this['talking']=0x0;this[_0xee34('0xf')]=0x0;this[_0xee34('0x10')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xee34('0x11')]=0x0;this[_0xee34('0x12')]=0x0;this[_0xee34('0x13')]=0x0;this['loggedIn']=0x0;this[_0xee34('0x14')]=0x0;this[_0xee34('0x15')]=_0x45e589[_0xee34('0x15')]||![];this['acwTimeout']=_0x45e589['acwTimeout']||0xa;this[_0xee34('0x16')]=_0x45e589[_0xee34('0x16')]||'no';this[_0xee34('0x17')]=!![];this['message']='';this[_0xee34('0x18')]=0x0;this['temp']=0x0;this[_0xee34('0x19')]=_0x45e589[_0xee34('0x19')]||null;this[_0xee34('0x1a')]=_0x45e589['dialGlobalInterval']?_0x45e589[_0xee34('0x1a')]:null;this[_0xee34('0x1b')]=_0x45e589[_0xee34('0x1b')];this[_0xee34('0x1c')]=_0x45e589['dialMethod']||_0xee34('0x1d');this[_0xee34('0x1e')]=_0x45e589[_0xee34('0x1e')]||0x0;this['dialLimitQueue']=_0x45e589[_0xee34('0x1f')]||0x0;this[_0xee34('0x20')]=_0x45e589[_0xee34('0x20')]||0x1;this['dialPredictiveOptimization']=_0x45e589['dialPredictiveOptimization']||_0xee34('0x21');this[_0xee34('0x22')]=_0x45e589[_0xee34('0x22')]||0.03;this[_0xee34('0x23')]=_0x45e589[_0xee34('0x23')]||0x258;this[_0xee34('0x24')]=_0x45e589[_0xee34('0x24')]||_0xee34('0x25');this[_0xee34('0x26')]=_0x45e589['dialOriginateCallerIdNumber']||_0xee34('0x25');this[_0xee34('0x27')]=_0x45e589[_0xee34('0x27')]||0x1e;this[_0xee34('0x28')]=_0x45e589['dialQueueOptions']||'tTxX';this['dialQueueTimeout']=_0x45e589[_0xee34('0x29')]||0x3;this[_0xee34('0x2a')]=_0x45e589[_0xee34('0x2a')]||undefined;this['dialCongestionMaxRetry']=_0x45e589[_0xee34('0x2b')]||0x3;this['dialCongestionRetryFrequency']=_0x45e589['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x45e589[_0xee34('0x2c')]||0x3;this[_0xee34('0x2d')]=_0x45e589[_0xee34('0x2d')]||0x96;this['dialNoAnswerMaxRetry']=_0x45e589['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x45e589[_0xee34('0x2e')]||0x96;this[_0xee34('0x2f')]=_0x45e589[_0xee34('0x2f')]||0x3;this[_0xee34('0x30')]=_0x45e589[_0xee34('0x30')]||0x96;this['dialDropMaxRetry']=_0x45e589[_0xee34('0x31')]||0x3;this[_0xee34('0x32')]=_0x45e589[_0xee34('0x32')]||0x96;this[_0xee34('0x33')]=_0x45e589[_0xee34('0x33')]||0x3;this[_0xee34('0x34')]=_0x45e589[_0xee34('0x34')]||0x96;this[_0xee34('0x35')]=_0x45e589[_0xee34('0x35')]||0x3;this['dialMachineRetryFrequency']=_0x45e589['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x45e589['dialAgentRejectMaxRetry']||0x3;this[_0xee34('0x36')]=_0x45e589[_0xee34('0x36')]||0x96;this[_0xee34('0x37')]=_0x45e589[_0xee34('0x37')]||0x4;this[_0xee34('0x38')]=_0x45e589['Trunk']?_0x45e589[_0xee34('0x38')]:undefined;this['TrunkBackup']=_0x45e589[_0xee34('0x39')]?_0x45e589['TrunkBackup']:undefined;this[_0xee34('0x3a')]=_0x45e589[_0xee34('0x3a')]||undefined;this[_0xee34('0x3b')]=_0x45e589[_0xee34('0x3b')]?_0x45e589[_0xee34('0x3b')]:undefined;this[_0xee34('0x3c')]=_0x45e589[_0xee34('0x3c')]||_0xee34('0x3d');this[_0xee34('0x3e')]=_0x45e589[_0xee34('0x3e')]||undefined;this[_0xee34('0x3f')]=_0x45e589[_0xee34('0x3f')]||undefined;this['strategy']=strategy[_0x45e589[_0xee34('0x40')]]||_0xee34('0xa');this['queueStatusComplete']=!![];this[_0xee34('0x41')]=_0x45e589[_0xee34('0x41')]||![];this[_0xee34('0x42')]=_0x45e589[_0xee34('0x42')];this[_0xee34('0x43')]=_0x45e589['dialAMDGreeting'];this[_0xee34('0x44')]=_0x45e589['dialAMDAfterGreetingSilence'];this[_0xee34('0x45')]=_0x45e589[_0xee34('0x45')];this[_0xee34('0x46')]=_0x45e589[_0xee34('0x46')];this['dialAMDBetweenWordsSilence']=_0x45e589['dialAMDBetweenWordsSilence'];this[_0xee34('0x47')]=_0x45e589[_0xee34('0x47')];this[_0xee34('0x48')]=_0x45e589[_0xee34('0x48')];this[_0xee34('0x49')]=_0x45e589[_0xee34('0x49')];this[_0xee34('0x4a')]=0x0;this[_0xee34('0x4b')]=0x0;this[_0xee34('0x4c')]=_0x45e589[_0xee34('0x4c')];this[_0xee34('0x4d')]=0x0;this[_0xee34('0x4e')]=0x0;this[_0xee34('0x4f')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xee34('0x50')]=0x0;this[_0xee34('0x51')]=0x0;this[_0xee34('0x52')]=0x0;this[_0xee34('0x53')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xee34('0x54')]=0x0;this[_0xee34('0x55')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xee34('0x56')]=undefined;this[_0xee34('0x57')]=undefined;this[_0xee34('0x58')]=1.05;this[_0xee34('0x59')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xee34('0x5a')]=0x0;this[_0xee34('0x5b')]=0x0;this[_0xee34('0x5c')]=0x0;this[_0xee34('0x5d')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xee34('0x5e')]=0x0;this[_0xee34('0x5f')]=_0x45e589[_0xee34('0x60')]||0x14;this['predictiveIntervalMinThreshold']=_0x45e589[_0xee34('0x60')]||0xa;this[_0xee34('0x61')]=0x0;this[_0xee34('0x62')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xee34('0x63')]=0x0;this[_0xee34('0x64')]=0x0;this[_0xee34('0x65')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x45e589[_0xee34('0x66')]||0x1e;this['dialRecallInQueue']=_0x45e589[_0xee34('0x67')]||![];this[_0xee34('0x68')]=_0x45e589[_0xee34('0x68')]||undefined;this[_0xee34('0x69')]=_0x45e589[_0xee34('0x69')]||![];this[_0xee34('0x6a')]=_0x45e589[_0xee34('0x6a')]||![];this[_0xee34('0xc')]=monitorFormat[_0x45e589['monitor_format']]?monitorFormat[_0x45e589['monitor_format']]:undefined;this['mandatoryDisposition']=_0x45e589[_0xee34('0x6b')]||![];this[_0xee34('0x6c')]=_0x45e589[_0xee34('0x6c')]?_0x45e589['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x50b4=['wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumBillable','unmanaged','acw','acwTimeout','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','Trunk','TrunkBackup','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold'];(function(_0xc1a117,_0x28b47c){var _0x497220=function(_0x42c6d7){while(--_0x42c6d7){_0xc1a117['push'](_0xc1a117['shift']());}};_0x497220(++_0x28b47c);}(_0x50b4,0x67));var _0x450b=function(_0x5be098,_0x1727f8){_0x5be098=_0x5be098-0x0;var _0x37d3c9=_0x50b4[_0x5be098];return _0x37d3c9;};'use strict';var statusDesc=['unknown',_0x450b('0x0'),_0x450b('0x1'),'busy',_0x450b('0x2'),_0x450b('0x3'),_0x450b('0x4'),_0x450b('0x5'),_0x450b('0x6')];var monitorFormat={'wav':'wav','wav49':_0x450b('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x450b('0x8'),'roundrobin':_0x450b('0x9')};function VoiceQueue(_0x40fe49){this['id']=_0x40fe49['id']||0x0;this[_0x450b('0xa')]=_0x40fe49[_0x450b('0xa')]||'';this[_0x450b('0xb')]=_0x40fe49[_0x450b('0xb')]||'';this[_0x450b('0xc')]=_0x40fe49[_0x450b('0xc')]||_0x450b('0xd');this['waiting']=0x0;this[_0x450b('0xe')]=0x0;this[_0x450b('0xf')]=0x0;this[_0x450b('0x10')]=0x0;this[_0x450b('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x450b('0x12')]=0x0;this[_0x450b('0x13')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x450b('0x14')]=_0x40fe49['acw']||![];this[_0x450b('0x15')]=_0x40fe49[_0x450b('0x15')]||0xa;this['autopause']=_0x40fe49['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x450b('0x16')]=0x0;this[_0x450b('0x17')]=0x0;this[_0x450b('0x18')]=_0x40fe49[_0x450b('0x18')]||null;this[_0x450b('0x19')]=_0x40fe49[_0x450b('0x19')]?_0x40fe49[_0x450b('0x19')]:null;this['dialActive']=_0x40fe49[_0x450b('0x1a')];this[_0x450b('0x1b')]=_0x40fe49[_0x450b('0x1b')]||'progressive';this[_0x450b('0x1c')]=_0x40fe49[_0x450b('0x1c')]||0x0;this['dialLimitQueue']=_0x40fe49['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x40fe49['dialPowerLevel']||0x1;this[_0x450b('0x1d')]=_0x40fe49[_0x450b('0x1d')]||_0x450b('0x1e');this[_0x450b('0x1f')]=_0x40fe49[_0x450b('0x1f')]||0.03;this[_0x450b('0x20')]=_0x40fe49[_0x450b('0x20')]||0x258;this[_0x450b('0x21')]=_0x40fe49['dialOriginateCallerIdName']||_0x450b('0x22');this[_0x450b('0x23')]=_0x40fe49[_0x450b('0x23')]||_0x450b('0x22');this[_0x450b('0x24')]=_0x40fe49['dialOriginateTimeout']||0x1e;this[_0x450b('0x25')]=_0x40fe49['dialQueueOptions']||_0x450b('0x26');this[_0x450b('0x27')]=_0x40fe49[_0x450b('0x27')]||0x3;this['dialQueueProject']=_0x40fe49[_0x450b('0x28')]||undefined;this[_0x450b('0x29')]=_0x40fe49[_0x450b('0x29')]||0x3;this[_0x450b('0x2a')]=_0x40fe49[_0x450b('0x2a')]||0x96;this[_0x450b('0x2b')]=_0x40fe49['dialBusyMaxRetry']||0x3;this[_0x450b('0x2c')]=_0x40fe49['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x40fe49[_0x450b('0x2d')]||0x3;this['dialNoAnswerRetryFrequency']=_0x40fe49[_0x450b('0x2e')]||0x96;this[_0x450b('0x2f')]=_0x40fe49[_0x450b('0x2f')]||0x3;this[_0x450b('0x30')]=_0x40fe49['dialNoSuchNumberRetryFrequency']||0x96;this[_0x450b('0x31')]=_0x40fe49['dialDropMaxRetry']||0x3;this[_0x450b('0x32')]=_0x40fe49[_0x450b('0x32')]||0x96;this[_0x450b('0x33')]=_0x40fe49[_0x450b('0x33')]||0x3;this[_0x450b('0x34')]=_0x40fe49[_0x450b('0x34')]||0x96;this[_0x450b('0x35')]=_0x40fe49[_0x450b('0x35')]||0x3;this[_0x450b('0x36')]=_0x40fe49[_0x450b('0x36')]||0x96;this[_0x450b('0x37')]=_0x40fe49['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x40fe49[_0x450b('0x38')]||0x96;this['dialGlobalMaxRetry']=_0x40fe49['dialGlobalMaxRetry']||0x4;this[_0x450b('0x39')]=_0x40fe49[_0x450b('0x39')]?_0x40fe49['Trunk']:undefined;this[_0x450b('0x3a')]=_0x40fe49[_0x450b('0x3a')]?_0x40fe49[_0x450b('0x3a')]:undefined;this['dialPrefix']=_0x40fe49['dialPrefix']||undefined;this[_0x450b('0x3b')]=_0x40fe49[_0x450b('0x3b')]?_0x40fe49['Interval']:undefined;this['dialOrderByScheduledAt']=_0x40fe49['dialOrderByScheduledAt']||_0x450b('0x3c');this[_0x450b('0x3d')]=_0x40fe49[_0x450b('0x3d')]||undefined;this['dialCutDigit']=_0x40fe49[_0x450b('0x3e')]||undefined;this[_0x450b('0x3f')]=strategy[_0x40fe49[_0x450b('0x3f')]]||_0x450b('0x8');this[_0x450b('0x40')]=!![];this[_0x450b('0x41')]=_0x40fe49[_0x450b('0x41')]||![];this['dialAMDInitialSilence']=_0x40fe49[_0x450b('0x42')];this[_0x450b('0x43')]=_0x40fe49[_0x450b('0x43')];this[_0x450b('0x44')]=_0x40fe49[_0x450b('0x44')];this[_0x450b('0x45')]=_0x40fe49['dialAMDTotalAnalysisTime'];this[_0x450b('0x46')]=_0x40fe49[_0x450b('0x46')];this[_0x450b('0x47')]=_0x40fe49['dialAMDBetweenWordsSilence'];this[_0x450b('0x48')]=_0x40fe49[_0x450b('0x48')];this[_0x450b('0x49')]=_0x40fe49['dialAMDSilenceThreshold'];this[_0x450b('0x4a')]=_0x40fe49[_0x450b('0x4a')];this[_0x450b('0x4b')]=0x0;this['pTalking']=0x0;this[_0x450b('0x4c')]=_0x40fe49[_0x450b('0x4c')];this['outboundAnswerCallsDay']=0x0;this[_0x450b('0x4d')]=0x0;this[_0x450b('0x4e')]=0x0;this[_0x450b('0x4f')]=0x0;this[_0x450b('0x50')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x450b('0x51')]=0x0;this[_0x450b('0x52')]=0x0;this[_0x450b('0x53')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x450b('0x54')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x450b('0x55')]=0x0;this[_0x450b('0x56')]=0x0;this[_0x450b('0x57')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x450b('0x58')]=0x0;this[_0x450b('0x59')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x450b('0x5a')]=0x0;this[_0x450b('0x5b')]=0x0;this[_0x450b('0x5c')]=0x0;this[_0x450b('0x5d')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x40fe49[_0x450b('0x5e')]||0x14;this[_0x450b('0x5f')]=_0x40fe49['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x450b('0x60')]=0x0;this[_0x450b('0x61')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x450b('0x62')]=0x0;this[_0x450b('0x63')]=0x0;this[_0x450b('0x64')]=0x0;this[_0x450b('0x65')]=0x0;this['dialRecallMeTimeout']=_0x40fe49[_0x450b('0x66')]||0x1e;this[_0x450b('0x67')]=_0x40fe49[_0x450b('0x67')]||![];this[_0x450b('0x68')]=_0x40fe49[_0x450b('0x68')]||undefined;this[_0x450b('0x69')]=_0x40fe49[_0x450b('0x69')]||![];this[_0x450b('0x6a')]=_0x40fe49[_0x450b('0x6a')]||![];this[_0x450b('0xb')]=monitorFormat[_0x40fe49[_0x450b('0xb')]]?monitorFormat[_0x40fe49[_0x450b('0xb')]]:undefined;this['mandatoryDisposition']=_0x40fe49[_0x450b('0x6b')]||![];this['mandatoryDispositionPause']=_0x40fe49[_0x450b('0x6c')]?_0x40fe49[_0x450b('0x6c')]:undefined;}module[_0x450b('0x6d')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 450e0de..caae4ec 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 _0x0a12=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x0a12,0xc6));var _0x20a1=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x0a12[_0x59d89e];return _0x554e93;};'use strict';function VtigerAccount(_0x1b656d){this['id']=_0x1b656d['id']||0x0;this[_0x20a1('0x0')]=_0x1b656d[_0x20a1('0x0')]||'';this[_0x20a1('0x1')]=_0x1b656d[_0x20a1('0x1')]||'';this[_0x20a1('0x2')]=_0x1b656d[_0x20a1('0x2')]||'';this['remoteUri']=_0x1b656d[_0x20a1('0x3')]||'';this[_0x20a1('0x4')]=_0x1b656d[_0x20a1('0x4')]||'';this[_0x20a1('0x5')]=_0x1b656d[_0x20a1('0x5')]||{};}module[_0x20a1('0x6')]=VtigerAccount; \ No newline at end of file +var _0x8052=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x24bbed,_0x3eaf48){var _0x38c6ce=function(_0x2d7b6c){while(--_0x2d7b6c){_0x24bbed['push'](_0x24bbed['shift']());}};_0x38c6ce(++_0x3eaf48);}(_0x8052,0x13e));var _0x2805=function(_0x304bd5,_0xea943d){_0x304bd5=_0x304bd5-0x0;var _0x2bcd87=_0x8052[_0x304bd5];return _0x2bcd87;};'use strict';function VtigerAccount(_0x5f4adb){this['id']=_0x5f4adb['id']||0x0;this[_0x2805('0x0')]=_0x5f4adb[_0x2805('0x0')]||'';this[_0x2805('0x1')]=_0x5f4adb[_0x2805('0x1')]||'';this[_0x2805('0x2')]=_0x5f4adb['accessKey']||'';this[_0x2805('0x3')]=_0x5f4adb[_0x2805('0x3')]||'';this[_0x2805('0x4')]=_0x5f4adb[_0x2805('0x4')]||'';this[_0x2805('0x5')]=_0x5f4adb['Configurations']||{};}module[_0x2805('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 735219b..47d4422 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 _0x4b55=['username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name'];(function(_0x215dc6,_0x11984c){var _0x45dc88=function(_0x59bad4){while(--_0x59bad4){_0x215dc6['push'](_0x215dc6['shift']());}};_0x45dc88(++_0x11984c);}(_0x4b55,0xef));var _0x54b5=function(_0x1bab75,_0x3f6e76){_0x1bab75=_0x1bab75-0x0;var _0x24b332=_0x4b55[_0x1bab75];return _0x24b332;};'use strict';function ZendeskAccount(_0x33ccc2){this['id']=_0x33ccc2['id']||0x0;this[_0x54b5('0x0')]=_0x33ccc2[_0x54b5('0x0')]||'';this['username']=_0x33ccc2[_0x54b5('0x1')]||'';this[_0x54b5('0x2')]=_0x33ccc2[_0x54b5('0x2')]||'';this[_0x54b5('0x3')]=_0x33ccc2[_0x54b5('0x3')]||'';this['remoteUri']=_0x33ccc2[_0x54b5('0x4')]||'';this[_0x54b5('0x5')]=_0x33ccc2[_0x54b5('0x5')]||'';this[_0x54b5('0x6')]=_0x33ccc2[_0x54b5('0x6')]||'integrationTab';this[_0x54b5('0x7')]=_0x33ccc2['serverUrl']||'';this[_0x54b5('0x8')]=_0x33ccc2[_0x54b5('0x8')]||{};}module[_0x54b5('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xe2ee=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x39c890,_0x4b1cfb){var _0x379c0b=function(_0x5308fa){while(--_0x5308fa){_0x39c890['push'](_0x39c890['shift']());}};_0x379c0b(++_0x4b1cfb);}(_0xe2ee,0x1cf));var _0xee2e=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0xe2ee[_0x2f4c1c];return _0x25e0f2;};'use strict';function ZendeskAccount(_0x1e8141){this['id']=_0x1e8141['id']||0x0;this[_0xee2e('0x0')]=_0x1e8141[_0xee2e('0x0')]||'';this[_0xee2e('0x1')]=_0x1e8141[_0xee2e('0x1')]||'';this[_0xee2e('0x2')]=_0x1e8141[_0xee2e('0x2')]||'';this[_0xee2e('0x3')]=_0x1e8141[_0xee2e('0x3')]||'';this[_0xee2e('0x4')]=_0x1e8141[_0xee2e('0x4')]||'';this[_0xee2e('0x5')]=_0x1e8141[_0xee2e('0x5')]||'';this[_0xee2e('0x6')]=_0x1e8141['type']||_0xee2e('0x7');this[_0xee2e('0x8')]=_0x1e8141[_0xee2e('0x8')]||'';this[_0xee2e('0x9')]=_0x1e8141[_0xee2e('0x9')]||{};}module[_0xee2e('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 43c98cf..6ddf326 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 _0x70f2=['host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description'];(function(_0x19cae9,_0xd6039b){var _0x163452=function(_0xee5d92){while(--_0xee5d92){_0x19cae9['push'](_0x19cae9['shift']());}};_0x163452(++_0xd6039b);}(_0x70f2,0x127));var _0x270f=function(_0x1a6a9,_0x1bd70a){_0x1a6a9=_0x1a6a9-0x0;var _0x4504e6=_0x70f2[_0x1a6a9];return _0x4504e6;};'use strict';function ZohoAccount(_0x1ca5fa){this['id']=_0x1ca5fa['id']||0x0;this[_0x270f('0x0')]=_0x1ca5fa[_0x270f('0x0')]||'';this['description']=_0x1ca5fa[_0x270f('0x1')]||'';this[_0x270f('0x2')]=_0x1ca5fa['host']||'';this['zone']=_0x1ca5fa['zone']||'';this['clientId']=_0x1ca5fa[_0x270f('0x3')]||'';this[_0x270f('0x4')]=_0x1ca5fa['clientSecret']||'';this[_0x270f('0x5')]=_0x1ca5fa[_0x270f('0x5')]||'';this[_0x270f('0x6')]=_0x1ca5fa['code']||'';this['refreshToken']=_0x1ca5fa[_0x270f('0x7')]||'';this[_0x270f('0x8')]=_0x1ca5fa[_0x270f('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xc55e=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x550a9f,_0x4784c6){var _0x2a8aa4=function(_0x31bb3b){while(--_0x31bb3b){_0x550a9f['push'](_0x550a9f['shift']());}};_0x2a8aa4(++_0x4784c6);}(_0xc55e,0xb5));var _0xec55=function(_0x4dcbca,_0x2d6445){_0x4dcbca=_0x4dcbca-0x0;var _0x278d7c=_0xc55e[_0x4dcbca];return _0x278d7c;};'use strict';function ZohoAccount(_0x219187){this['id']=_0x219187['id']||0x0;this['name']=_0x219187[_0xec55('0x0')]||'';this[_0xec55('0x1')]=_0x219187['description']||'';this[_0xec55('0x2')]=_0x219187[_0xec55('0x2')]||'';this[_0xec55('0x3')]=_0x219187['zone']||'';this[_0xec55('0x4')]=_0x219187['clientId']||'';this[_0xec55('0x5')]=_0x219187[_0xec55('0x5')]||'';this[_0xec55('0x6')]=_0x219187[_0xec55('0x6')]||'';this[_0xec55('0x7')]=_0x219187[_0xec55('0x7')]||'';this[_0xec55('0x8')]=_0x219187[_0xec55('0x8')]||'';this[_0xec55('0x9')]=_0x219187['Configurations']||{};}module[_0xec55('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 9490c51..fc50a60 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 _0xbee9=['getCaller','calleridname','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','originatecalleridnum'];(function(_0x1042b9,_0x4a42fe){var _0x4a8ec6=function(_0x2a6ed1){while(--_0x2a6ed1){_0x1042b9['push'](_0x1042b9['shift']());}};_0x4a8ec6(++_0x4a42fe);}(_0xbee9,0x1e3));var _0x9bee=function(_0x13f8f9,_0x441957){_0x13f8f9=_0x13f8f9-0x0;var _0x22a8ec=_0xbee9[_0x13f8f9];return _0x22a8ec;};'use strict';var util=require('util');var _=require(_0x9bee('0x0'));var moment=require(_0x9bee('0x1'));function checkNameSurname(_0x3f6763,_0x361c2b,_0x4d8696){var _0x320777='';if(!_[_0x9bee('0x2')](_0x361c2b)&&_0x9bee('0x3')===typeof _0x361c2b){_0x320777+=_0x361c2b;}if(!_[_0x9bee('0x2')](_0x4d8696)&&'string'===typeof _0x4d8696){_0x320777+='\x20'+_0x4d8696;}if(_0x320777!==''){return _0x320777;}return _0x3f6763;}function Action(_0x35fade,_0x602220,_0x6c34ef,_0x2258b0,_0x5b4782){this[_0x9bee('0x4')]=_0x6c34ef||undefined;this[_0x9bee('0x5')]=_0x35fade['id'];this[_0x9bee('0x6')]=_0x602220[_0x9bee('0x7')];this[_0x9bee('0x8')]=_0x602220[_0x9bee('0x8')];this[_0x9bee('0x9')]=_0x9bee('0x6');this[_0x9bee('0xa')]=![];this[_0x9bee('0xb')]=_[_0x9bee('0x2')](_0x35fade[_0x9bee('0xc')])?undefined:_0x35fade[_0x9bee('0xc')][_0x9bee('0x7')];this[_0x9bee('0xd')]=this[_0x9bee('0xb')]?util[_0x9bee('0xe')](_0x9bee('0xf'),this['membername']):_0x2258b0||undefined;this['calleridname']=checkNameSurname(_0x35fade[_0x9bee('0x10')][_0x9bee('0x11')],_0x35fade[_0x9bee('0x10')]['firstName'],_0x35fade['Contact']['lastName']);this[_0x9bee('0x12')]=_0x35fade[_0x9bee('0x12')]||![];this['calleridnum']=_0x35fade[_0x9bee('0x10')]['phone'];this[_0x9bee('0x13')]=_0x35fade[_0x9bee('0x13')];this[_0x9bee('0x14')]=_0x35fade[_0x9bee('0x14')]||0x0;this['countcongestionretry']=_0x35fade[_0x9bee('0x15')]||0x0;this['countnoanswerretry']=_0x35fade[_0x9bee('0x16')]||0x0;this['countglobal']=(_0x35fade['countbusyretry']||0x0)+(_0x35fade[_0x9bee('0x15')]||0x0)+(_0x35fade[_0x9bee('0x16')]||0x0)+(_0x35fade[_0x9bee('0x17')]||0x0)+(_0x35fade[_0x9bee('0x18')]||0x0)+(_0x35fade[_0x9bee('0x19')]||0x0)+(_0x35fade[_0x9bee('0x1a')]||0x0)+(_0x35fade['countagentrejectretry']||0x0);this[_0x9bee('0x17')]=_0x35fade['countnosuchnumberretry']||0x0;this[_0x9bee('0x18')]=_0x35fade[_0x9bee('0x18')]||0x0;this['countabandonedretry']=_0x35fade['countabandonedretry']||0x0;this['countmachineretry']=_0x35fade[_0x9bee('0x1a')]||0x0;this[_0x9bee('0x1b')]=_0x35fade[_0x9bee('0x1b')]||0x0;this[_0x9bee('0x1c')]=_0x35fade[_0x9bee('0x1c')];this[_0x9bee('0x1d')]=_0x35fade[_0x9bee('0x1d')];this['callbackat']=_0x35fade['callbackat'];this[_0x9bee('0x1e')]=_0x35fade[_0x9bee('0x1e')];this[_0x9bee('0x1f')]=_0x35fade[_0x9bee('0x1f')];this[_0x9bee('0x20')]=_0x35fade[_0x9bee('0x20')];this[_0x9bee('0x21')]=_['isNil'](_0x35fade['Agent'])?_0x35fade['UserId']:_0x35fade[_0x9bee('0xc')]['id'];this['VoiceQueueId']=_0x35fade['VoiceQueueId'];this[_0x9bee('0x22')]='';this['originatecalleridname']='';}Action['prototype'][_0x9bee('0x23')]=function(){return util[_0x9bee('0xe')]('\x22%s\x22\x20<%s>',this[_0x9bee('0x24')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x8279=['originatecalleridname','\x22%s\x22\x20<%s>','number','exports','moment','string','idContact','queue','name','type','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','phone','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','isNil','VoiceQueueId','originatecalleridnum'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8279,0x175));var _0x9827=function(_0x30c4ce,_0x449d51){_0x30c4ce=_0x30c4ce-0x0;var _0x14c808=_0x8279[_0x30c4ce];return _0x14c808;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9827('0x0'));function checkNameSurname(_0x2bb648,_0x1f220d,_0x124b5c){var _0x309d6e='';if(!_['isNil'](_0x1f220d)&&'string'===typeof _0x1f220d){_0x309d6e+=_0x1f220d;}if(!_['isNil'](_0x124b5c)&&_0x9827('0x1')===typeof _0x124b5c){_0x309d6e+='\x20'+_0x124b5c;}if(_0x309d6e!==''){return _0x309d6e;}return _0x2bb648;}function Action(_0x147650,_0x4d7c16,_0x42ca53,_0x515431,_0x9a2009){this['uniqueid']=_0x42ca53||undefined;this[_0x9827('0x2')]=_0x147650['id'];this[_0x9827('0x3')]=_0x4d7c16[_0x9827('0x4')];this['type']=_0x4d7c16[_0x9827('0x5')];this['campaigntype']=_0x9827('0x3');this[_0x9827('0x6')]=![];this['membername']=_['isNil'](_0x147650['Agent'])?undefined:_0x147650[_0x9827('0x7')][_0x9827('0x4')];this[_0x9827('0x8')]=this[_0x9827('0x9')]?util[_0x9827('0xa')](_0x9827('0xb'),this[_0x9827('0x9')]):_0x515431||undefined;this[_0x9827('0xc')]=checkNameSurname(_0x147650['Contact'][_0x9827('0xd')],_0x147650[_0x9827('0xe')]['firstName'],_0x147650[_0x9827('0xe')][_0x9827('0xf')]);this[_0x9827('0x10')]=_0x147650[_0x9827('0x10')]||![];this[_0x9827('0x11')]=_0x147650[_0x9827('0xe')][_0x9827('0xd')];this[_0x9827('0x12')]=_0x147650['scheduledat'];this['countbusyretry']=_0x147650[_0x9827('0x13')]||0x0;this[_0x9827('0x14')]=_0x147650[_0x9827('0x14')]||0x0;this[_0x9827('0x15')]=_0x147650[_0x9827('0x15')]||0x0;this['countglobal']=(_0x147650['countbusyretry']||0x0)+(_0x147650[_0x9827('0x14')]||0x0)+(_0x147650[_0x9827('0x15')]||0x0)+(_0x147650[_0x9827('0x16')]||0x0)+(_0x147650[_0x9827('0x17')]||0x0)+(_0x147650[_0x9827('0x18')]||0x0)+(_0x147650[_0x9827('0x19')]||0x0)+(_0x147650[_0x9827('0x1a')]||0x0);this[_0x9827('0x16')]=_0x147650[_0x9827('0x16')]||0x0;this[_0x9827('0x17')]=_0x147650[_0x9827('0x17')]||0x0;this[_0x9827('0x18')]=_0x147650[_0x9827('0x18')]||0x0;this[_0x9827('0x19')]=_0x147650[_0x9827('0x19')]||0x0;this[_0x9827('0x1a')]=_0x147650['countagentrejectretry']||0x0;this[_0x9827('0x1b')]=_0x147650[_0x9827('0x1b')];this[_0x9827('0x1c')]=_0x147650['callbackuniqueid'];this[_0x9827('0x1d')]=_0x147650[_0x9827('0x1d')];this[_0x9827('0x1e')]=_0x147650[_0x9827('0x1e')];this['ContactId']=_0x147650[_0x9827('0x1f')];this[_0x9827('0x20')]=_0x147650['ListId'];this[_0x9827('0x21')]=_[_0x9827('0x22')](_0x147650[_0x9827('0x7')])?_0x147650[_0x9827('0x21')]:_0x147650[_0x9827('0x7')]['id'];this['VoiceQueueId']=_0x147650[_0x9827('0x23')];this[_0x9827('0x24')]='';this[_0x9827('0x25')]='';}Action['prototype']['getCaller']=function(){return util['format'](_0x9827('0x26'),this[_0x9827('0xc')],this[_0x9827('0x27')]);};module[_0x9827('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5fa4131..7b20ad6 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 _0x4c87=['pTalking:\x20','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','uniqueid','\x20Queue','custom:agentconnect','custom:agentConnectPreview','buildAcw','buildObj','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','starttime','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','response','custom:agentringnoanswer','callProgressDetectingAgent','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','variables','filterKey','keys','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','bind','hanguprequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','type','outbound','name','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','md5','voice:queue:%s','voice_queue:save','info','format','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','prototype','preview','dialMethod','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','queue'];(function(_0x18a3ad,_0x3ea059){var _0x532d8a=function(_0xdae1e6){while(--_0xdae1e6){_0x18a3ad['push'](_0x18a3ad['shift']());}};_0x532d8a(++_0x3ea059);}(_0x4c87,0xe7));var _0x74c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c87[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x74c8('0x0'));var _=require(_0x74c8('0x1'));var BPromise=require(_0x74c8('0x2'));var uuid=require(_0x74c8('0x3'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x74c8('0x4'));var config=require(_0x74c8('0x5'));var logger=require(_0x74c8('0x6'))('preview');var loggerAction=require(_0x74c8('0x6'))(_0x74c8('0x7'));var ami=require(_0x74c8('0x8'));var rpcDb=require(_0x74c8('0x9'));var Action=require(_0x74c8('0xa'));var ut=require(_0x74c8('0xb'));config[_0x74c8('0xc')]=_[_0x74c8('0xd')](config[_0x74c8('0xc')],{'host':_0x74c8('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x74c8('0xc')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x21832a){this[_0x74c8('0xf')]=this[_0x74c8('0xf')]?this[_0x74c8('0xf')][_0x74c8('0x10')](_0x21832a):_0x21832a();};function Preview(_0x1fe42b){this[_0x74c8('0x11')]=new Sequence();this['campaignsPreview']=_0x1fe42b[_0x74c8('0x12')];this[_0x74c8('0x13')]=_0x1fe42b['trunks'];this[_0x74c8('0x14')]={};this['agents']=_0x1fe42b[_0x74c8('0x15')];this[_0x74c8('0x16')]=0x0;ami['on'](_0x74c8('0x17'),this[_0x74c8('0x18')]['bind'](this));ami['on'](_0x74c8('0x19'),this['syncHangup'][_0x74c8('0x1a')](this));ami['on'](_0x74c8('0x1b'),this['syncHangupRequest'][_0x74c8('0x1a')](this));ami['on'](_0x74c8('0x1c'),this[_0x74c8('0x1d')]['bind'](this));ami['on'](_0x74c8('0x1e'),this['syncNewExten'][_0x74c8('0x1a')](this));ami['on']('varset',this[_0x74c8('0x1f')][_0x74c8('0x1a')](this));ami['on'](_0x74c8('0x20'),this['syncAttendedTransfer'][_0x74c8('0x1a')](this));ami['on'](_0x74c8('0x21'),this[_0x74c8('0x22')]['bind'](this));this[_0x74c8('0x23')](this[_0x74c8('0x24')]);}function emit(_0x268204,_0x273833,_0x40bdad){io['to'](_0x268204)['emit'](_0x273833,_0x40bdad);}function emitCampaignPreview(_0x4eca91){if(_0x4eca91[_0x74c8('0x25')]===_0x74c8('0x26')){var _0x4a5551={'id':_0x4eca91['id'],'name':_0x4eca91[_0x74c8('0x27')],'strategy':_0x4eca91['strategy'],'answered':_0x4eca91['answered'],'available':_0x4eca91[_0x74c8('0x28')],'loggedIn':_0x4eca91[_0x74c8('0x29')],'pTalking':_0x4eca91[_0x74c8('0x2a')],'sumBillable':_0x4eca91[_0x74c8('0x2b')],'sumDuration':_0x4eca91['sumDuration'],'sumHoldTime':_0x4eca91[_0x74c8('0x2c')]||0x0,'talking':_0x4eca91[_0x74c8('0x2d')],'total':_0x4eca91[_0x74c8('0x2e')],'type':_0x4eca91[_0x74c8('0x25')],'unmanaged':_0x4eca91[_0x74c8('0x2f')],'abandoned':_0x4eca91['abandoned'],'waiting':_0x4eca91[_0x74c8('0x30')],'loggedInDb':_0x4eca91[_0x74c8('0x31')],'dialActive':_0x4eca91['dialActive'],'dialMethod':_0x4eca91['dialMethod'],'dialOriginateCallerIdName':_0x4eca91['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4eca91[_0x74c8('0x32')],'dialOriginateTimeout':_0x4eca91[_0x74c8('0x33')],'dialPrefix':_0x4eca91[_0x74c8('0x34')],'outboundAnswerAgiCallsDay':_0x4eca91['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4eca91[_0x74c8('0x35')],'outboundBlacklistCallsDay':_0x4eca91['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4eca91[_0x74c8('0x36')],'outboundCongestionCallsDay':_0x4eca91[_0x74c8('0x37')],'outboundDropCallsDayACS':_0x4eca91['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4eca91[_0x74c8('0x38')],'outboundDropCallsDayTimeout':_0x4eca91[_0x74c8('0x39')],'outboundNoAnswerCallsDay':_0x4eca91[_0x74c8('0x3a')],'outboundNoSuchCallsDay':_0x4eca91['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4eca91[_0x74c8('0x3b')],'outboundReCallsDay':_0x4eca91['outboundReCallsDay'],'outboundRejectCallsDay':_0x4eca91['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4eca91[_0x74c8('0x3c')],'outboundAbandonedCallsDay':_0x4eca91[_0x74c8('0x3d')],'predictiveIntervalAnsweredCalls':_0x4eca91[_0x74c8('0x3e')],'predictiveIntervalAvgHoldtime':_0x4eca91[_0x74c8('0x3f')],'predictiveIntervalAvgTalktime':_0x4eca91[_0x74c8('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x4eca91['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4eca91['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4eca91[_0x74c8('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x4eca91[_0x74c8('0x42')],'predictiveIntervalHitRate':_0x4eca91[_0x74c8('0x43')],'predictiveIntervalMultiplicativeFactor':_0x4eca91[_0x74c8('0x44')],'predictiveIntervalPauses':_0x4eca91[_0x74c8('0x45')],'predictiveIntervalAvailable':_0x4eca91[_0x74c8('0x46')],'predictiveIntervalTotalCalls':_0x4eca91[_0x74c8('0x47')],'message':_0x4eca91[_0x74c8('0x48')],'originated':_0x4eca91[_0x74c8('0x49')],'erlangCalls':_0x4eca91[_0x74c8('0x4a')],'erlangCallToSecond':_0x4eca91[_0x74c8('0x4b')],'erlangAbandonmentRate':_0x4eca91['erlangAbandonmentRate'],'erlangBusyFactor':_0x4eca91[_0x74c8('0x4c')],'startPredictive':_0x4eca91[_0x74c8('0x4d')],'startProgressive':_0x4eca91[_0x74c8('0x4e')]};if(_0x4eca91['Trunk']){_0x4a5551[_0x74c8('0x4f')]={'id':_0x4eca91['Trunk']['id'],'name':_0x4eca91['Trunk']['name'],'active':_0x4eca91[_0x74c8('0x4f')]['active'],'callerid':_0x4eca91['Trunk'][_0x74c8('0x50')]};}if(_0x4eca91[_0x74c8('0x51')]){_0x4a5551[_0x74c8('0x51')]={'id':_0x4eca91['Interval']['id'],'name':_0x4eca91['Interval'][_0x74c8('0x27')]};}var _0x50763b=md5(JSON[_0x74c8('0x52')](_0x4a5551));if(_0x4eca91[_0x74c8('0x53')]!==_0x50763b){_0x4eca91[_0x74c8('0x53')]=_0x50763b;emit(util['format'](_0x74c8('0x54'),_0x4a5551[_0x74c8('0x27')]),_0x74c8('0x55'),_0x4a5551);}}}function emitVoiceQueueChannelRemove(_0x54769e){logger[_0x74c8('0x56')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x74c8('0x52')](_0x54769e));emit(util[_0x74c8('0x57')](_0x74c8('0x54'),_0x54769e[_0x74c8('0x27')]),_0x74c8('0x58'),_0x54769e);io[_0x74c8('0x59')](_0x74c8('0x5a'),_0x54769e);}function notSendMessagesQueue(_0x3177d2){if(_0x3177d2[_0x74c8('0x5b')]){if(_0x3177d2[_0x74c8('0x49')]===0x0&&_0x3177d2[_0x74c8('0x2a')]===0x0){_0x3177d2['sendMessageOneNotActive']=![];_0x3177d2[_0x74c8('0x28')]=0x0;_0x3177d2['paused']=0x0;_0x3177d2[_0x74c8('0x48')]=_0x74c8('0x5c');ut[_0x74c8('0x5d')](_0x74c8('0x5e'),_0x3177d2[_0x74c8('0x27')]+_0x74c8('0x5f'));}else{_0x3177d2[_0x74c8('0x48')]='IS_DISACTIVED';ut[_0x74c8('0x5d')](_0x74c8('0x5e'),_0x3177d2['name']+_0x74c8('0x60'));}emitCampaignPreview(_0x3177d2);}}Preview[_0x74c8('0x61')][_0x74c8('0x23')]=function(){var _0xa06dd3=this;setInterval(function(){_0xa06dd3['syncCampaigns']();},0x7cf);};Preview[_0x74c8('0x61')]['syncCampaigns']=function(){var _0x466592=this[_0x74c8('0x24')];this[_0x74c8('0x16')]+=0x1;for(var _0x1a6191 in _0x466592){if(_0x466592['hasOwnProperty'](_0x1a6191)&&(_0x466592[_0x1a6191]['dialMethod']===_0x74c8('0x62')||_0x466592[_0x1a6191][_0x74c8('0x63')]==='booked')&&_0x466592[_0x1a6191]['type']===_0x74c8('0x26')){if(this[_0x74c8('0x16')]>0x7){this[_0x74c8('0x16')]=0x0;this[_0x74c8('0x64')]();}}if(_0x466592[_0x74c8('0x65')](_0x1a6191)&&_0x466592[_0x1a6191][_0x74c8('0x63')]===_0x74c8('0x62')&&_0x466592[_0x1a6191][_0x74c8('0x25')]==='outbound'){if(_0x466592[_0x1a6191][_0x74c8('0x66')]){this[_0x74c8('0x67')](_0x466592[_0x1a6191]);this[_0x74c8('0x68')](_0x466592[_0x1a6191]);}else{notSendMessagesQueue(_0x466592[_0x1a6191]);}}}};Preview[_0x74c8('0x61')][_0x74c8('0x69')]=function(_0x17f743){var _0x3697ca=this;this[_0x74c8('0x11')][_0x74c8('0x6a')](function(){if(!_['isNil'](_0x3697ca[_0x74c8('0x14')][_0x17f743])){loggerAction[_0x74c8('0x56')](_0x74c8('0x6b'),_0x17f743,'Queue',_0x3697ca[_0x74c8('0x14')][_0x17f743][_0x74c8('0x6c')],'originated:\x20',JSON['stringify'](_0x3697ca[_0x74c8('0x24')][_0x3697ca[_0x74c8('0x14')][_0x17f743][_0x74c8('0x6c')]]['originated']),_0x74c8('0x6d'),JSON[_0x74c8('0x52')](_0x3697ca[_0x74c8('0x24')][_0x3697ca[_0x74c8('0x14')][_0x17f743]['queue']]['pTalking']),JSON[_0x74c8('0x52')](_0x3697ca[_0x74c8('0x14')][_0x17f743]['dialAnswer']),JSON[_0x74c8('0x52')](_[_0x74c8('0x6e')](_0x3697ca[_0x74c8('0x14')][_0x17f743],[_0x74c8('0x6f'),'UserId',_0x74c8('0x70'),_0x74c8('0x71')])));return ami[_0x74c8('0x72')]({'action':_0x74c8('0x73'),'channel':_0x3697ca[_0x74c8('0x14')][_0x17f743][_0x74c8('0x74')]})[_0x74c8('0x75')](function(_0x2360c7){if(_0x2360c7[_0x74c8('0x48')]===_0x74c8('0x76')){setTimeout(function(){if(_0x3697ca['actions'][_0x17f743]){ut[_0x74c8('0x77')](_0x3697ca[_0x74c8('0x24')][_0x3697ca[_0x74c8('0x14')][_0x17f743][_0x74c8('0x6c')]],'[clearZombieChannel]');if(_0x3697ca['actions'][_0x17f743][_0x74c8('0x78')]===!![]){ut[_0x74c8('0x79')](_0x3697ca[_0x74c8('0x24')][_0x3697ca['actions'][_0x17f743][_0x74c8('0x6c')]],_0x74c8('0x7a'));ut['loggerError'](_0x74c8('0x7b')+_0x17f743,_0x3697ca[_0x74c8('0x14')][_0x17f743][_0x74c8('0x6c')]);}ut['loggerError'](_0x74c8('0x7c')+_0x17f743,_0x3697ca['actions'][_0x17f743]['queue']);delete _0x3697ca[_0x74c8('0x14')][_0x17f743];}},0x2328);}});}});};Preview['prototype'][_0x74c8('0x64')]=function(){var _0x616abb=this;loggerAction[_0x74c8('0x56')](_0x74c8('0x7d'),_[_0x74c8('0x7e')](this[_0x74c8('0x14')]));for(var _0x5578bc in this[_0x74c8('0x14')]){if(_0x616abb[_0x74c8('0x14')][_0x74c8('0x65')](_0x5578bc)){_0x616abb[_0x74c8('0x69')](_0x5578bc);}}};Preview[_0x74c8('0x61')][_0x74c8('0x68')]=function(_0x2fa84e){var _0x5c5acb=this;rpcDb['getContactRecallMe'](_0x2fa84e['id'],ut[_0x74c8('0x7f')](this[_0x74c8('0x15')]))[_0x74c8('0x80')](function(_0x26b460){if(!_[_0x74c8('0x81')](_0x26b460)){for(var _0x2c91fd=0x0;_0x2c91fd<_0x26b460[_0x74c8('0x82')];_0x2c91fd+=0x1){if(ut[_0x74c8('0x83')](_0x26b460[_0x2c91fd][_0x74c8('0x84')])<_0x2fa84e[_0x74c8('0x85')]*0x3c){if(_0x26b460[_0x2c91fd][_0x74c8('0x86')]&&!_0x26b460[_0x2c91fd][_0x74c8('0x86')][_0x74c8('0x87')]){_0x5c5acb[_0x74c8('0x88')](_0x26b460[_0x2c91fd]['id'])['then'](ut['logger2'](_0x74c8('0x89')))[_0x74c8('0x75')](ut[_0x74c8('0x8a')](_0x74c8('0x89')));}else{rpcDb[_0x74c8('0x8b')](_0x26b460[_0x2c91fd]['id']);}}else{var _0x305a81=new Action(_0x26b460[_0x2c91fd],_0x2fa84e);_0x305a81['starttime']=moment()[_0x74c8('0x57')](_0x74c8('0x8c'));_0x2fa84e['outboundReCallsDay']+=0x1;ut[_0x74c8('0x8d')](_0x305a81,0x17,_0x74c8('0x8e'));if(_0x2fa84e['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x74c8('0x8f')](_0x26b460[_0x2c91fd]));rpcDb['createCustomerHistory'](_0x305a81,_0x74c8('0x90'));}else{ut[_0x74c8('0x8d')](_0x305a81,0x16,'RecallFailedTimeout');rpcDb[_0x74c8('0x91')](_0x305a81,'[HistoryRecallClose]');rpcDb[_0x74c8('0x92')](_0x305a81,_0x74c8('0x93'));}}}}})[_0x74c8('0x75')](ut[_0x74c8('0x8a')](_0x74c8('0x94')));};Preview['prototype'][_0x74c8('0x67')]=function(_0x4e5e83){_0x4e5e83[_0x74c8('0x5b')]=!![];if(ut[_0x74c8('0x95')](_0x4e5e83['loggedIn'])){_0x4e5e83[_0x74c8('0x48')]=_0x74c8('0x96');}else if(!ut['isActive'](_0x4e5e83[_0x74c8('0x66')])){_0x4e5e83[_0x74c8('0x48')]='NOT_ACTIVE';}else if(!this[_0x74c8('0x97')](_0x4e5e83[_0x74c8('0x4f')])){if(!this[_0x74c8('0x97')](_0x4e5e83['TrunkBackup'])){_0x4e5e83[_0x74c8('0x48')]=_0x74c8('0x98');}else{_0x4e5e83['message']=_0x74c8('0x99');}}else{_0x4e5e83['message']='ACTIVE';}emitCampaignPreview(_0x4e5e83);};Preview[_0x74c8('0x61')][_0x74c8('0x9a')]=function(_0x36f3c3,_0xc614fc,_0x3984a4){var _0x40a8e8=this;var _0x972762=this['actions'][_0xc614fc];var _0x1900d8=this[_0x74c8('0x24')][_0x972762['queue']];var _0xd93f5f;if(_0x1900d8){switch(_0x3984a4){case'1':_0x1900d8[_0x74c8('0x9b')]+=0x1;_0x972762[_0x74c8('0x9c')]+=0x1;_0x972762[_0x74c8('0x9d')]=ut[_0x74c8('0x9e')](_0x972762);ut[_0x74c8('0x8d')](_0x972762,0x0,_0x74c8('0x9f'));ami[_0x74c8('0x59')](_0x74c8('0xa0'),ut['buildObj'](_0x972762,_0x74c8('0xa1')));rpcDb[_0x74c8('0x91')](_0x972762,_0x74c8('0xa2'));if(ut[_0x74c8('0x9e')](_0x972762)>=_0x1900d8[_0x74c8('0xa3')]){_0xd93f5f=ut[_0x74c8('0xa4')](_0x972762,0xf,'Global');rpcDb[_0x74c8('0x92')](_0xd93f5f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x972762[_0x74c8('0x9c')]>=_0x1900d8['dialNoSuchNumberMaxRetry']){rpcDb[_0x74c8('0x92')](_0x972762,_0x74c8('0xa5'));}else{rpcDb[_0x74c8('0xa6')](ut[_0x74c8('0xa7')](_0x972762,'countnosuchnumberretry',_0x1900d8[_0x74c8('0xa8')]),_0x972762[_0x74c8('0xa9')],_0x972762[_0x74c8('0xaa')]);}}delete this['actions'][_0x36f3c3[_0x74c8('0xab')]];break;case _0x74c8('0xac'):var _0x2a2b3e=moment()['format'](_0x74c8('0x8c'));_0x972762[_0x74c8('0xad')]=_0x2a2b3e;_0x972762['answertime']=_0x2a2b3e;_0x972762[_0x74c8('0x78')]=!![];_0x1900d8[_0x74c8('0x2a')]+=0x1;logger[_0x74c8('0x56')]('[syncHangup][talking][increment]',_0x972762[_0x74c8('0xae')],_0x74c8('0xaf'),_0x1900d8['name'],'pTalking:\x20',_0x1900d8[_0x74c8('0x2a')]);ami[_0x74c8('0x59')](_0x74c8('0xb0'),ut['buildObj'](_0x972762,'connect',this[_0x74c8('0x24')][_0x972762[_0x74c8('0x6c')]]));if(_0x1900d8['acw']){ami[_0x74c8('0x59')](_0x74c8('0xb1'),ut[_0x74c8('0xb2')](_0x972762));}break;case'16':ami[_0x74c8('0x59')]('custom:agentcomplete',ut[_0x74c8('0xb3')](_0x972762,'complete',this[_0x74c8('0x24')][_0x972762[_0x74c8('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0x74c8('0xb3')](_0x972762,'complete'));_0x1900d8['outboundAnswerCallsDay']+=0x1;_0x1900d8[_0x74c8('0x2e')]+=0x1;_0x1900d8[_0x74c8('0xb4')]+=0x1;ut[_0x74c8('0x79')](_0x1900d8,_0x74c8('0xb5'));_0x972762['countglobal']=ut[_0x74c8('0x9e')](_0x972762);ut[_0x74c8('0x8d')](_0x972762,0x4,_0x74c8('0xb6'));rpcDb[_0x74c8('0x91')](_0x972762,_0x74c8('0xb7'));rpcDb['createCustomerFinal'](_0x972762,_0x74c8('0xb8'));rpcDb[_0x74c8('0xb9')](_0x972762);_0x1900d8[_0x74c8('0xba')]+=_0x972762[_0x74c8('0xbb')];_0x1900d8['sumBillable']+=_0x972762[_0x74c8('0xbb')];logger['info'](_0x74c8('0xbc'),_0x972762[_0x74c8('0xae')],_0x74c8('0xaf'),_0x1900d8[_0x74c8('0x27')],_0x74c8('0x6d'),_0x1900d8[_0x74c8('0x2a')]);delete this[_0x74c8('0x14')][_0x36f3c3[_0x74c8('0xab')]];break;case _0x74c8('0xbd'):_0x1900d8[_0x74c8('0x36')]+=0x1;_0x972762['countbusyretry']+=0x1;_0x972762[_0x74c8('0x9d')]=ut['totalGlobal'](_0x972762);ut[_0x74c8('0x8d')](_0x972762,0x5,_0x74c8('0xbe'));ami[_0x74c8('0x59')](_0x74c8('0xbf'),ut[_0x74c8('0xb3')](_0x972762,_0x74c8('0xc0')));rpcDb[_0x74c8('0x91')](_0x972762,_0x74c8('0xc1'));if(ut[_0x74c8('0x9e')](_0x972762)>=_0x1900d8['dialGlobalMaxRetry']){_0xd93f5f=ut[_0x74c8('0xa4')](_0x972762,0xf,_0x74c8('0xc2'));rpcDb['createCustomerFinal'](_0xd93f5f,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x972762[_0x74c8('0xc3')]>=_0x1900d8[_0x74c8('0xc4')]){rpcDb[_0x74c8('0x92')](_0x972762,_0x74c8('0xc1'));}else{rpcDb[_0x74c8('0xa6')](ut[_0x74c8('0xa7')](_0x972762,_0x74c8('0xc3'),_0x1900d8[_0x74c8('0xc5')]),_0x972762[_0x74c8('0xa9')],_0x972762[_0x74c8('0xaa')]);}}break;case _0x74c8('0xc6'):_0x1900d8[_0x74c8('0x3a')]+=0x1;_0x972762[_0x74c8('0xc7')]+=0x1;_0x972762[_0x74c8('0x9d')]=ut[_0x74c8('0x9e')](_0x972762);ut['logCustomer'](_0x972762,0x3,_0x74c8('0xc8'));ami['emit'](_0x74c8('0xc9'),ut['buildObj'](_0x972762,_0x74c8('0xca')));rpcDb['createCustomerHistory'](_0x972762,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x74c8('0x9e')](_0x972762)>=_0x1900d8[_0x74c8('0xa3')]){_0xd93f5f=ut['cloneAction'](_0x972762,0xf,'Global');rpcDb[_0x74c8('0x92')](_0xd93f5f,_0x74c8('0xcb'));}else{if(_0x972762[_0x74c8('0xc7')]>=_0x1900d8[_0x74c8('0xcc')]){rpcDb[_0x74c8('0x92')](_0x972762,_0x74c8('0xcd'));}else{rpcDb[_0x74c8('0xa6')](ut[_0x74c8('0xa7')](_0x972762,_0x74c8('0xc7'),_0x1900d8[_0x74c8('0xce')]),_0x972762[_0x74c8('0xa9')],_0x972762[_0x74c8('0xaa')]);}}break;case'CONGESTION':_0x1900d8['outboundCongestionCallsDay']+=0x1;_0x972762['countcongestionretry']+=0x1;_0x972762[_0x74c8('0x9d')]=ut[_0x74c8('0x9e')](_0x972762);ut['logCustomer'](_0x972762,0x8,'Congestion');ami[_0x74c8('0x59')]('custom:agentcongestion',ut['buildObj'](_0x972762,_0x74c8('0xcf')));rpcDb[_0x74c8('0x91')](_0x972762,_0x74c8('0xd0'));if(ut[_0x74c8('0x9e')](_0x972762)>=_0x1900d8['dialGlobalMaxRetry']){_0xd93f5f=ut[_0x74c8('0xa4')](_0x972762,0xf,_0x74c8('0xc2'));rpcDb[_0x74c8('0x92')](_0xd93f5f,_0x74c8('0xd1'));}else{if(_0x972762['countcongestionretry']>=_0x1900d8[_0x74c8('0xd2')]){rpcDb[_0x74c8('0x92')](_0x972762,_0x74c8('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0x74c8('0xa7')](_0x972762,_0x74c8('0xd3'),_0x1900d8[_0x74c8('0xc5')]),_0x972762['unlockAgent'],_0x972762[_0x74c8('0xaa')]);}}break;case _0x74c8('0xd4'):_0x1900d8[_0x74c8('0xd5')]+=0x1;_0x972762[_0x74c8('0xd6')]+=0x1;_0x972762[_0x74c8('0x9d')]=ut[_0x74c8('0x9e')](_0x972762);ut[_0x74c8('0x8d')](_0x972762,0x14,_0x74c8('0xd7'));ami['emit'](_0x74c8('0xd8'),ut[_0x74c8('0xb3')](_0x972762,'agentreject'));rpcDb[_0x74c8('0x91')](_0x972762,_0x74c8('0xd9'));if(ut[_0x74c8('0x9e')](_0x972762)>=_0x1900d8[_0x74c8('0xa3')]){_0xd93f5f=ut[_0x74c8('0xa4')](_0x972762,0x14,_0x74c8('0xd7'));rpcDb[_0x74c8('0x92')](_0xd93f5f,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x972762['countagentrejectretry']>=_0x1900d8[_0x74c8('0xda')]){rpcDb['createCustomerFinal'](_0x972762,_0x74c8('0xdb'));}else{rpcDb[_0x74c8('0xa6')](ut['scheduledAt'](_0x972762,'countagentrejectretry',_0x1900d8[_0x74c8('0xdc')]),_0x972762[_0x74c8('0xa9')],_0x972762[_0x74c8('0xaa')]);}}break;case _0x74c8('0xdd'):_0x1900d8[_0x74c8('0x3d')]+=0x1;_0x972762[_0x74c8('0xde')]+=0x1;_0x972762[_0x74c8('0x9d')]=ut[_0x74c8('0x9e')](_0x972762);ut[_0x74c8('0x8d')](_0x972762,0xb,_0x74c8('0xdf'));rpcDb[_0x74c8('0x91')](_0x972762,_0x74c8('0xe0'));if(ut['totalGlobal'](_0x972762)>=_0x1900d8['dialGlobalMaxRetry']){_0xd93f5f=ut[_0x74c8('0xa4')](_0x972762,0xf,_0x74c8('0xc2'));rpcDb['createCustomerFinal'](_0xd93f5f,_0x74c8('0xe0'));}else{if(_0x972762[_0x74c8('0xe1')]>=_0x1900d8[_0x74c8('0xe2')]){rpcDb[_0x74c8('0x92')](_0x972762,_0x74c8('0xe0'));}else{rpcDb[_0x74c8('0xa6')](ut[_0x74c8('0xa7')](_0x972762,_0x74c8('0xde'),_0x1900d8[_0x74c8('0xe3')]),_0x972762[_0x74c8('0xa9')],_0x972762['activeContact']);}}break;case'18':_0x1900d8['outboundUnknownCallsDay']+=0x1;_0x972762[_0x74c8('0xe4')]+=0x1;_0x972762[_0x74c8('0x9d')]=ut[_0x74c8('0x9e')](_0x972762);ut['logCustomer'](_0x972762,0x12,_0x36f3c3[_0x74c8('0xe5')]||_0x36f3c3[_0x74c8('0xe6')]);ami[_0x74c8('0x59')](_0x74c8('0xe7'),ut[_0x74c8('0xb3')](_0x972762,'amd'));rpcDb[_0x74c8('0x91')](_0x972762,_0x74c8('0xe8'));if(ut[_0x74c8('0x9e')](_0x972762)>=_0x1900d8[_0x74c8('0xa3')]){_0xd93f5f=ut[_0x74c8('0xa4')](_0x972762,0xf,'Global');rpcDb[_0x74c8('0x92')](_0xd93f5f,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x74c8('0x92')](_0x972762,_0x74c8('0xe8'));}delete this[_0x74c8('0x14')][_0x36f3c3['linkedid']];break;case'19':_0x1900d8[_0x74c8('0x3c')]+=0x1;_0x972762[_0x74c8('0x9d')]=ut[_0x74c8('0x9e')](_0x972762);ut['logCustomer'](_0x972762,0x13,_0x36f3c3[_0x74c8('0xe5')]||_0x36f3c3[_0x74c8('0xe6')]);ami[_0x74c8('0x59')](_0x74c8('0xe7'),ut[_0x74c8('0xb3')](_0x972762,_0x74c8('0xe9')));rpcDb[_0x74c8('0x91')](_0x972762,_0x74c8('0xea'));if(ut[_0x74c8('0x9e')](_0x972762)>=_0x1900d8[_0x74c8('0xa3')]){_0xd93f5f=ut[_0x74c8('0xa4')](_0x972762,0xf,_0x74c8('0xc2'));rpcDb[_0x74c8('0x92')](_0xd93f5f,_0x74c8('0xea'));}else{rpcDb['createCustomerFinal'](_0x972762,_0x74c8('0xea'));}delete this[_0x74c8('0x14')][_0x36f3c3['linkedid']];break;default:if(_0x972762['dialAnswer']){ut[_0x74c8('0x79')](_0x1900d8,_0x74c8('0xeb'));ut['loggerError'](_0x74c8('0xec')+_0x1900d8[_0x74c8('0x27')],_0x36f3c3);}_0x1900d8[_0x74c8('0x3c')]+=0x1;_0x972762[_0x74c8('0x9d')]=ut[_0x74c8('0x9e')](_0x972762);ut[_0x74c8('0x8d')](_0x972762,0xc,_0x36f3c3['cause-txt']||_0x36f3c3[_0x74c8('0xe6')]);rpcDb['createCustomerHistory'](_0x972762,_0x74c8('0xed'));if(ut['totalGlobal'](_0x972762)>=_0x1900d8['dialGlobalMaxRetry']){_0xd93f5f=ut['cloneAction'](_0x972762,0xf,_0x74c8('0xc2'));rpcDb[_0x74c8('0x92')](_0xd93f5f,_0x74c8('0xee'));}else{rpcDb[_0x74c8('0x92')](_0x972762,_0x74c8('0xee'));}delete this['actions'][_0x36f3c3[_0x74c8('0xab')]];}if(!(_0x972762[_0x74c8('0x78')]&&_0x3984a4==='16')){ut[_0x74c8('0x77')](_0x1900d8,_0x74c8('0xef'));logger[_0x74c8('0x56')](_0x74c8('0xf0'),_0x972762[_0x74c8('0xae')],_0x74c8('0xaf'),_0x1900d8[_0x74c8('0x27')],_0x74c8('0xf1'),_0x1900d8[_0x74c8('0x49')]);}if(_0x3984a4!==_0x74c8('0xac')){delete this['actions'][_0x36f3c3[_0x74c8('0xab')]];delete this[_0x74c8('0x14')][_0x36f3c3[_0x74c8('0xf2')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0xe46524,_0x261621,_0x2516f8){if(_[_0x74c8('0xf3')](_0x261621)&&_0x74c8('0xf4')!==typeof _0x261621){return;}if(_[_0x74c8('0xf3')](_0x2516f8)&&_0x74c8('0xf4')!==typeof _0x2516f8){return;}switch(_0x2516f8[_0x74c8('0xf5')]){case'0':ut[_0x74c8('0xf6')](_0xe46524,0x0,_0x74c8('0x9f'));rpcDb[_0x74c8('0xf7')](_0xe46524,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x74c8('0xf6')](_0xe46524,0x3,'NoAnswer');rpcDb[_0x74c8('0xf7')](_0xe46524,_0x74c8('0xf8'));break;case'5':ut[_0x74c8('0xf6')](_0xe46524,0x5,'Busy');rpcDb['createAgentHistory'](_0xe46524,_0x74c8('0xf9'));break;case'8':ut['logAgent'](_0xe46524,0x8,'Congestion');rpcDb['createAgentHistory'](_0xe46524,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x74c8('0xf6')](_0xe46524,0x16,'AnswerAGI');rpcDb[_0x74c8('0xf7')](_0xe46524,_0x74c8('0xfa'));break;default:ut[_0x74c8('0xf6')](_0xe46524,0xc,_0x2516f8['reason']);rpcDb[_0x74c8('0xf7')](_0xe46524,'[callProgressDetectingAgent][logCongestion]');}ut[_0x74c8('0x77')](_0x261621,'[callProgressDetectingAgent]');logger[_0x74c8('0x56')](_0x74c8('0xfb'),_0xe46524[_0x74c8('0xae')],_0x74c8('0xaf'),_0x261621['name'],_0x74c8('0xf1'),_0x261621[_0x74c8('0x49')]);delete this[_0x74c8('0x14')][_0xe46524[_0x74c8('0xae')]];};Preview[_0x74c8('0x61')]['checkInBlack']=function(_0x398c7a,_0x261355,_0x371386,_0x1b227c,_0x355889){var _0x3cf062=this;return new BPromise(function(_0x39fa2c,_0x28a2bb){if(_[_0x74c8('0x81')](_0x261355)||_['isNil'](_0x261355[_0x74c8('0xfc')])||_['isNil'](_0x261355[_0x74c8('0xfc')][_0x74c8('0xfd')])||_[_0x74c8('0x81')](_0x261355[_0x74c8('0x70')])){_0x28a2bb(ut[_0x74c8('0x48')](_0x74c8('0xfe'),_0x1b227c,_0x355889));return;}var _0x51c03c=uuid['v4']();var _0x2a3526=_0x3cf062['campaignsPreview'][_0x261355[_0x74c8('0xff')]['name']];var _0x4cb4be=_0x371386?_0x3cf062['agents'][_0x371386]['id']:undefined;_0x3cf062[_0x74c8('0x14')][_0x51c03c]=new Action(_0x261355,_0x2a3526,_0x51c03c,_0x371386,_0x4cb4be);var _0x48a470=_0x3cf062[_0x74c8('0x14')][_0x51c03c];_0x48a470[_0x74c8('0xa9')]=_0x1b227c;_0x48a470[_0x74c8('0xaa')]=_0x355889;_0x48a470[_0x74c8('0x100')]=_0x371386;if(_[_0x74c8('0x101')](_0x398c7a)){_0x3cf062[_0x74c8('0x102')](_0x48a470,_0x2a3526,_0x261355,_0x371386)[_0x74c8('0x80')](function(_0x483595){logger[_0x74c8('0x56')](_0x74c8('0x103'),'Queue:\x20'+_0x48a470[_0x74c8('0x6c')]+'\x20IdHopper:\x20'+_0x48a470[_0x74c8('0x104')],JSON[_0x74c8('0x52')](_0x483595));ami[_0x74c8('0x59')](_0x74c8('0x105'),ut[_0x74c8('0xb3')](_0x48a470,'called',_0x3cf062[_0x74c8('0x24')][_0x48a470[_0x74c8('0x6c')]]));_0x39fa2c(ut['message']('Calling'));})[_0x74c8('0x75')](function(_0x36537e){ut[_0x74c8('0x5d')](_0x74c8('0x106'),_0x36537e);_0x28a2bb(ut['message'](_0x74c8('0x107'),_0x1b227c,_0x355889));});}else{_0x2a3526[_0x74c8('0x108')]+=0x1;ut[_0x74c8('0x109')](_0x48a470);rpcDb[_0x74c8('0x10a')](_0x48a470,'[Blacklist][error]');delete _0x3cf062['actions'][_0x51c03c];_0x28a2bb(ut[_0x74c8('0x48')](_0x74c8('0x10b'),_0x1b227c,_0x355889));}});};Preview[_0x74c8('0x61')]['isTrunkReachable']=function(_0xb7ce4c){return!_['isNil'](_0xb7ce4c)&&!_[_0x74c8('0x81')](_0xb7ce4c[_0x74c8('0x27')])&&!_['isNil'](_0xb7ce4c[_0x74c8('0x10c')])&&_0xb7ce4c[_0x74c8('0x10c')]&&!_[_0x74c8('0x81')](this[_0x74c8('0x13')][util[_0x74c8('0x57')](_0x74c8('0x10d'),_0xb7ce4c[_0x74c8('0x27')])])&&!_[_0x74c8('0x81')](this[_0x74c8('0x13')][util['format'](_0x74c8('0x10d'),_0xb7ce4c[_0x74c8('0x27')])][_0x74c8('0x73')])&&(this[_0x74c8('0x13')][util[_0x74c8('0x57')](_0x74c8('0x10d'),_0xb7ce4c['name'])]['status']===_0x74c8('0x10e')||this[_0x74c8('0x13')][util['format']('SIP/%s',_0xb7ce4c[_0x74c8('0x27')])][_0x74c8('0x73')]===_0x74c8('0x10f'));};Preview[_0x74c8('0x61')]['run']=function(_0x5caaa2,_0x36decc){var _0x183bc0=this;return new BPromise(function(_0xbb5c5d,_0x234916){_0x183bc0[_0x74c8('0x110')](_0x5caaa2,_0x36decc)[_0x74c8('0x80')](function(_0x5514d1){_0xbb5c5d(_[_0x74c8('0x6e')](_0x5514d1,[_0x74c8('0x48')]));})[_0x74c8('0x75')](function(_0x32d856){if(_0x32d856[_0x74c8('0x111')]){rpcDb[_0x74c8('0x112')](_0x5caaa2);}if(_0x32d856[_0x74c8('0x10c')]){rpcDb[_0x74c8('0x8b')](_0x5caaa2);}_0x234916(_[_0x74c8('0x6e')](_0x32d856,['message']));});});};Preview['prototype'][_0x74c8('0x110')]=function(_0x3f2faf,_0x456b08){var _0x2d864f=this;return new BPromise(function(_0x325d03,_0x3c5473){var _0x54cca6,_0x21b461;rpcDb['getContactPreview'](_0x3f2faf)[_0x74c8('0x80')](function(_0x58abe3){if(!_[_0x74c8('0x81')](_0x58abe3[0x0])){_0x21b461=_0x58abe3[0x0]['recallme']?![]:!![];_0x54cca6=_0x58abe3[0x0][_0x74c8('0x113')]?!![]:![];_0x54cca6=_0x456b08?!![]:_0x54cca6;}var _0x104325=_0x2d864f[_0x74c8('0x114')](_0x58abe3);if(_0x104325[_0x74c8('0x115')]){rpcDb[_0x74c8('0x116')](_[_0x74c8('0x6e')](_0x58abe3[0x0],[_0x74c8('0x70'),'Contact.phone']))[_0x74c8('0x80')](function(_0x4518d1){_0x2d864f['checkInBlack'](_0x4518d1,_0x58abe3[0x0],_0x456b08,_0x21b461,_0x54cca6)['then'](function(_0x20c912){_0x325d03(_0x20c912);})[_0x74c8('0x75')](function(_0x20d05){_0x3c5473(_0x20d05);});})[_0x74c8('0x75')](function(_0x6498ed){ut[_0x74c8('0x5d')](_0x74c8('0x117'),_0x6498ed);_0x3c5473(ut[_0x74c8('0x48')](_0x74c8('0x118'),_0x21b461,_0x54cca6));});}else{_0x3c5473(ut[_0x74c8('0x48')](_0x104325['message'],_0x21b461,_0x54cca6));}})['catch'](function(_0x5a7182){ut[_0x74c8('0x5d')](_0x74c8('0x119'),_0x5a7182);_0x3c5473(ut[_0x74c8('0x48')](_0x74c8('0x118'),![],!![]));});});};Preview[_0x74c8('0x61')][_0x74c8('0x114')]=function(_0x177f6e){if(_['isNil'](_0x177f6e)||_['isEmpty'](_0x177f6e)||!_[_0x74c8('0x81')](_0x177f6e[0x0][_0x74c8('0x86')])&&_[_0x74c8('0x81')](_0x177f6e[0x0][_0x74c8('0x86')][_0x74c8('0x27')])){ut[_0x74c8('0x5d')]('[Preview][validateContact][Empty\x20Contact]',_0x177f6e);return{'isValid':![],'message':_0x74c8('0x11a')};}var _0x5c5204=this['campaignsPreview'][_0x177f6e[0x0][_0x74c8('0xff')][_0x74c8('0x27')]];_0x5c5204[_0x74c8('0x48')]=_0x74c8('0x99');if(_[_0x74c8('0x81')](_0x5c5204)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x5c5204);return{'isValid':![],'message':_0x74c8('0x11b')};}if(!this['isTrunkReachable'](_0x5c5204[_0x74c8('0x4f')])){ut[_0x74c8('0x5d')](_0x74c8('0x11c'),_0x74c8('0x11d')+_0x5c5204['name']+_0x74c8('0x11e'));if(!this[_0x74c8('0x97')](_0x5c5204[_0x74c8('0x11f')])){ut[_0x74c8('0x5d')](_0x74c8('0x11c'),_0x5c5204['name']+_0x74c8('0x120'));return{'isValid':![],'message':_0x74c8('0x121')};}}if(!ut['isActive'](_0x5c5204[_0x74c8('0x66')])){ut[_0x74c8('0x5d')](_0x74c8('0x122'),_0x5c5204[_0x74c8('0x27')]+_0x74c8('0x123'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x5c5204[_0x74c8('0x27')]+_0x74c8('0x123')};}return{'isValid':!![],'message':_0x74c8('0x124')};};Preview[_0x74c8('0x61')][_0x74c8('0x102')]=function(_0x1a6c67,_0x5c244d,_0x32347c,_0x504742){var _0x54046c=this;return new BPromise(function(_0x3a64c5,_0xbc37f8){var _0x126822=_0x1a6c67[_0x74c8('0xae')];var _0x5520c1=_0x54046c['isTrunkReachable'](_0x5c244d[_0x74c8('0x4f')])?util[_0x74c8('0x57')](_0x74c8('0x125'),_0x5c244d[_0x74c8('0x4f')]['name'],_[_0x74c8('0x81')](_0x5c244d[_0x74c8('0x34')])?'':_0x5c244d[_0x74c8('0x34')]['trim']()||'',_0x5c244d[_0x74c8('0x126')]>0x0?_0x32347c[_0x74c8('0xfc')][_0x74c8('0xfd')][_0x74c8('0x127')](_0x5c244d[_0x74c8('0x126')]):_0x32347c[_0x74c8('0xfc')][_0x74c8('0xfd')]):util[_0x74c8('0x57')](_0x74c8('0x125'),_[_0x74c8('0x81')](_0x5c244d['TrunkBackup'])?_0x5c244d['Trunk'][_0x74c8('0x27')]:_0x5c244d[_0x74c8('0x11f')]['name'],_[_0x74c8('0x81')](_0x5c244d['dialPrefix'])?'':_0x5c244d[_0x74c8('0x34')]['trim']()||'',_0x5c244d[_0x74c8('0x126')]>0x0?_0x32347c['Contact'][_0x74c8('0xfd')][_0x74c8('0x127')](_0x5c244d[_0x74c8('0x126')]):_0x32347c[_0x74c8('0xfc')]['phone']);var _0x3e8f6a=_0x54046c[_0x74c8('0x97')](_0x5c244d['Trunk'])?ut['getCallerId'](_0x5c244d['Trunk']['callerid'],_0x5c244d[_0x74c8('0x128')],_0x5c244d[_0x74c8('0x129')]>0x0?ut[_0x74c8('0x12a')](_0x5c244d[_0x74c8('0x32')],_0x5c244d[_0x74c8('0x129')]):_0x5c244d[_0x74c8('0x32')]):ut[_0x74c8('0x12b')](_[_0x74c8('0x81')](_0x5c244d[_0x74c8('0x11f')])?_0x5c244d[_0x74c8('0x4f')][_0x74c8('0x50')]:_0x5c244d[_0x74c8('0x11f')][_0x74c8('0x50')],_0x5c244d[_0x74c8('0x128')],_0x5c244d['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x74c8('0x12a')](_0x5c244d[_0x74c8('0x32')],_0x5c244d[_0x74c8('0x129')]):_0x5c244d[_0x74c8('0x32')]);if(_0x3e8f6a){_0x1a6c67['originatecalleridname']=ut[_0x74c8('0x12c')](_0x3e8f6a);_0x1a6c67[_0x74c8('0x12d')]=ut[_0x74c8('0x12e')](_0x3e8f6a);}var _0x2dc454=ut[_0x74c8('0x12f')](_0x5c244d,_0x32347c,_0x5520c1,_0x3e8f6a,_0x126822,_0x1a6c67);_['merge'](_0x1a6c67,ut[_0x74c8('0x130')](_0x2dc454));_0x1a6c67[_0x74c8('0x131')]=moment()['format'](_0x74c8('0x8c'));ami[_0x74c8('0x72')](ut['variablesAction'](_0x1a6c67,_0x5c244d,_0x2dc454,_0x1a6c67[_0x74c8('0xaa')],_0x504742))['then'](function(_0x2f0a12){var _0x5b7d58=_0x1a6c67[_0x74c8('0x132')];if(!_[_0x74c8('0x81')](_0x5b7d58)){if(!_[_0x74c8('0x81')](_0x54046c['agents'][_0x5b7d58])){_0x54046c[_0x74c8('0x15')][_0x5b7d58][_0x74c8('0x133')]=_0x1a6c67[_0x74c8('0x134')];emit(util['format'](_0x74c8('0x135'),_0x54046c[_0x74c8('0x15')][_0x5b7d58]['name']),_0x74c8('0x136'),{'destaccountcode':_0x54046c[_0x74c8('0x15')][_0x5b7d58][_0x74c8('0x137')],'destconnectedlinenum':_0x1a6c67[_0x74c8('0x134')]});}}_0x5c244d[_0x74c8('0x49')]+=0x1;logger['info'](_0x74c8('0x138'),_0x126822,_0x74c8('0xaf'),_0x5c244d[_0x74c8('0x27')],_0x74c8('0xf1'),_0x5c244d[_0x74c8('0x49')]);_0x3a64c5(_0x2f0a12);})[_0x74c8('0x75')](function(_0x366814){ut[_0x74c8('0xf6')](_0x1a6c67,0xe,_0x74c8('0x139'));rpcDb[_0x74c8('0xf7')](_0x1a6c67,_0x74c8('0x13a'));_0xbc37f8(_0x366814);});});};Preview['prototype'][_0x74c8('0x13b')]=function(_0x177005){if(this['actions'][_0x177005[_0x74c8('0xab')]]){this['actions'][_0x177005['linkedid']][_0x74c8('0x74')]=_0x177005['channel'];}};Preview['prototype'][_0x74c8('0x18')]=function(_0x394a16){var _0x4d02e2=this;var _0xf74987=this[_0x74c8('0x14')][_0x394a16['actionid']];if(_0xf74987){if(_0xf74987[_0x74c8('0x100')]&&this[_0x74c8('0x15')][_0xf74987[_0x74c8('0x100')]]){ut[_0x74c8('0x13c')](_0xf74987,this['agents'][_0xf74987[_0x74c8('0x100')]][_0x74c8('0x27')],this[_0x74c8('0x15')][_0xf74987[_0x74c8('0x100')]]['id']);}var _0x16cc3c=_['clone'](_0xf74987);_0x16cc3c[_0x74c8('0xad')]=moment()[_0x74c8('0x57')]('YYYY-MM-DD\x20HH:mm:ss');var _0x33bbb0=_0x4d02e2[_0x74c8('0x24')][_0xf74987['queue']];if(ut['isFailure'](_0x394a16[_0x74c8('0x13d')])){if(_0xf74987['unlockAgent']){rpcDb[_0x74c8('0x112')](_0xf74987[_0x74c8('0x104')]);}if(_0xf74987[_0x74c8('0xaa')]){rpcDb['disableContact'](_0xf74987[_0x74c8('0x104')]);}ami[_0x74c8('0x59')](_0x74c8('0x13e'),ut[_0x74c8('0xb3')](_0xf74987,'rejected',this['campaignsPreview'][_0xf74987[_0x74c8('0x6c')]]));this[_0x74c8('0x13f')](_0x16cc3c,_0x33bbb0,_0x394a16);}else{_0xf74987[_0x74c8('0x131')]=moment()['format'](_0x74c8('0x8c'));ut['logAgent'](_0x16cc3c,0x4,_0x74c8('0xb6'));rpcDb[_0x74c8('0xf7')](_0x16cc3c,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x74c8('0x61')][_0x74c8('0x140')]=function(_0x3e9a61){var _0x15c0df=this;var _0x5df5ce=this[_0x74c8('0x14')][_0x3e9a61['linkedid']];var _0x36f561;if(_0x5df5ce){_0x36f561=this[_0x74c8('0x24')][_0x5df5ce[_0x74c8('0x6c')]];logger[_0x74c8('0x56')](_0x74c8('0x141'),_0x3e9a61['linkedid'],'\x20Queue',_0x36f561[_0x74c8('0x27')],_0x74c8('0x6d'),_0x36f561[_0x74c8('0x2a')]);}if(this['actions'][_0x3e9a61[_0x74c8('0xab')]]&&_0x3e9a61[_0x74c8('0xab')]!==_0x3e9a61['uniqueid']){if(_0x3e9a61['cause']==='16'&&this['actions'][_0x3e9a61[_0x74c8('0xab')]]['dialAnswer']){this[_0x74c8('0x9a')](_0x3e9a61,_0x3e9a61[_0x74c8('0xab')],_0x3e9a61[_0x74c8('0x142')]);}else if(this[_0x74c8('0x14')][_0x3e9a61[_0x74c8('0xab')]][_0x74c8('0x78')]){logger[_0x74c8('0x56')](_0x74c8('0x143'),_0x3e9a61[_0x74c8('0xab')],_0x3e9a61['cause'],_0x74c8('0xaf'),_0x36f561['name'],_0x74c8('0x6d'),_0x36f561[_0x74c8('0x2a')]);this[_0x74c8('0x9a')](_0x3e9a61,_0x3e9a61[_0x74c8('0xab')],_0x3e9a61['cause']);}}else if(_0x5df5ce&&_[_0x74c8('0x81')](_0x5df5ce[_0x74c8('0x144')])&&_0x36f561['dialQueueProject']&&_0x3e9a61[_0x74c8('0xab')]===_0x3e9a61['uniqueid']&&_[_0x74c8('0x81')](_0x3e9a61[_0x74c8('0xf5')])&&_0x3e9a61[_0x74c8('0x142')]==='16'&&_0x3e9a61['channelstate']==='6'&&_['isUndefined'](_0x5df5ce[_0x74c8('0x145')])){if(_0x5df5ce[_0x74c8('0xa9')]){rpcDb[_0x74c8('0x112')](_0x5df5ce[_0x74c8('0x104')]);}if(_0x5df5ce[_0x74c8('0xaa')]){rpcDb[_0x74c8('0x8b')](_0x5df5ce[_0x74c8('0x104')]);}_0x3e9a61['reason']='22';this['callProgressDetectingAgent'](_0x5df5ce,_0x36f561,_0x3e9a61);}else if(_0x5df5ce&&_0x5df5ce[_0x74c8('0x145')]){if(_0x3e9a61['cause']==='16'&&this[_0x74c8('0x14')][_0x3e9a61['linkedid']][_0x74c8('0x78')]){logger[_0x74c8('0x56')](_0x74c8('0x146'),_0x3e9a61[_0x74c8('0xab')],_0x3e9a61['cause'],_0x74c8('0xaf'),_0x36f561[_0x74c8('0x27')],_0x74c8('0x6d'),_0x36f561['pTalking']);this[_0x74c8('0x9a')](_0x3e9a61,_0x3e9a61[_0x74c8('0xab')],_0x3e9a61['cause']);}else if(this[_0x74c8('0x14')][_0x3e9a61[_0x74c8('0xab')]][_0x74c8('0x78')]){logger['info'](_0x74c8('0x143'),_0x3e9a61[_0x74c8('0xab')],_0x3e9a61[_0x74c8('0x142')],_0x74c8('0xaf'),_0x36f561[_0x74c8('0x27')],_0x74c8('0x6d'),_0x36f561[_0x74c8('0x2a')]);this[_0x74c8('0x9a')](_0x3e9a61,_0x3e9a61[_0x74c8('0xab')],_0x3e9a61[_0x74c8('0x142')]);}}};Preview['prototype'][_0x74c8('0x1d')]=function(_0x4dbb65){if(this[_0x74c8('0x14')][_0x4dbb65[_0x74c8('0xf2')]]&&_0x4dbb65[_0x74c8('0xf2')]!==_0x4dbb65[_0x74c8('0x147')]){this[_0x74c8('0x9a')](_0x4dbb65,_0x4dbb65[_0x74c8('0xf2')],_0x4dbb65[_0x74c8('0xe6')]);}};Preview['prototype'][_0x74c8('0x148')]=function(_0x3b83bf){if(this[_0x74c8('0x14')][_0x3b83bf['linkedid']]&&_0x3b83bf[_0x74c8('0xab')]!==_0x3b83bf[_0x74c8('0xae')]&&!this[_0x74c8('0x14')][_0x3b83bf['linkedid']][_0x74c8('0x78')]){if(_0x3b83bf[_0x74c8('0x142')]==='1'){this[_0x74c8('0x9a')](_0x3b83bf,_0x3b83bf[_0x74c8('0xab')],_0x3b83bf[_0x74c8('0x142')]);}}};Preview['prototype']['addVariable']=function(_0x38762c,_0x568c29,_0x2f34aa){if(this[_0x74c8('0x14')][_0x38762c]){if(_[_0x74c8('0x81')](this[_0x74c8('0x14')][_0x38762c]['variables'])){this[_0x74c8('0x14')][_0x38762c]['variables']={};}this[_0x74c8('0x14')][_0x38762c][_0x74c8('0x149')][_0x568c29]=_0x2f34aa;}};Preview['prototype'][_0x74c8('0x1f')]=function(_0x2cb893){try{if(!_['isNil'](_0x2cb893)){if(ut[_0x74c8('0x14a')](_[_0x74c8('0x14b')](_0x2cb893['variable'])[0x0])){this[_0x74c8('0x14c')](_0x2cb893[_0x74c8('0xae')],_['keys'](_0x2cb893['variable'])[0x0],_0x2cb893[_0x74c8('0x14d')]);}}}catch(_0x405df3){logger[_0x74c8('0x14e')](_0x74c8('0x14f'),util[_0x74c8('0x150')](_0x405df3,{'showHidden':![],'depth':null}));}};Preview[_0x74c8('0x61')]['syncAttendedTransfer']=function(_0x6bf780){if(_0x6bf780){if(this[_0x74c8('0x14')][_0x6bf780[_0x74c8('0x151')]]){this[_0x74c8('0x14')][_0x6bf780['transfertargetlinkedid']][_0x74c8('0x145')]=!![];}}};Preview[_0x74c8('0x61')][_0x74c8('0x22')]=function(_0x18e7cf){if(_0x18e7cf){if(this[_0x74c8('0x14')][_0x18e7cf[_0x74c8('0x152')]]){this['actions'][_0x18e7cf[_0x74c8('0x152')]][_0x74c8('0x145')]=!![];}}};module[_0x74c8('0x153')]=Preview; \ No newline at end of file +var _0x88fb=['acw','custom:agentConnectPreview','complete','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','pTalking:\x20','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','createAgentHistory','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','channelAgent','user:%s','user:agentconnect','calleridnum','[originateFailure][logOriginateFailure]','logLookAgent','responsetime','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','syncDialEnd','destuniqueid','addVariable','variables','variable','keys','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','md5','ioredis','../../../config/environment','preview','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','hangup','bind','syncHangupRequest','newexten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','message','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','name','Interval','stringify','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','loopCampaigns','syncCampaigns','campaignsPreview','hasOwnProperty','dialMethod','recallMe','clearZombieChannel','isNil','Queue','queue','pTalking','dialAnswer','pick','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','info','size','getContactRecallMe','agentReadyId','then','length','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','createCustomerFinal','[HistoryRecallClose]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect'];(function(_0x1acf52,_0x213204){var _0xba9368=function(_0x155fa4){while(--_0x155fa4){_0x1acf52['push'](_0x1acf52['shift']());}};_0xba9368(++_0x213204);}(_0x88fb,0x1db));var _0xb88f=function(_0xcb1e3,_0x5b8e8f){_0xcb1e3=_0xcb1e3-0x0;var _0x972b98=_0x88fb[_0xcb1e3];return _0x972b98;};'use strict';var util=require(_0xb88f('0x0'));var _=require(_0xb88f('0x1'));var BPromise=require(_0xb88f('0x2'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0xb88f('0x3'));var Redis=require(_0xb88f('0x4'));var config=require(_0xb88f('0x5'));var logger=require('../../../config/logger')(_0xb88f('0x6'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xb88f('0x7'));var ut=require(_0xb88f('0x8'));config[_0xb88f('0x9')]=_['defaults'](config[_0xb88f('0x9')],{'host':_0xb88f('0xa'),'port':0x18eb});var io=require(_0xb88f('0xb'))(new Redis(config[_0xb88f('0x9')]));var Sequence=function(){};Sequence[_0xb88f('0xc')][_0xb88f('0xd')]=function(_0x4979a7){this['tail']=this[_0xb88f('0xe')]?this[_0xb88f('0xe')][_0xb88f('0xf')](_0x4979a7):_0x4979a7();};function Preview(_0x3e85e9){this[_0xb88f('0x10')]=new Sequence();this['campaignsPreview']=_0x3e85e9[_0xb88f('0x11')];this['trunks']=_0x3e85e9[_0xb88f('0x12')];this[_0xb88f('0x13')]={};this[_0xb88f('0x14')]=_0x3e85e9['agents'];this[_0xb88f('0x15')]=0x0;ami['on']('originateresponse',this[_0xb88f('0x16')]['bind'](this));ami['on'](_0xb88f('0x17'),this['syncHangup'][_0xb88f('0x18')](this));ami['on']('hanguprequest',this[_0xb88f('0x19')]['bind'](this));ami['on']('dialend',this['syncDialEnd'][_0xb88f('0x18')](this));ami['on'](_0xb88f('0x1a'),this['syncNewExten']['bind'](this));ami['on'](_0xb88f('0x1b'),this[_0xb88f('0x1c')][_0xb88f('0x18')](this));ami['on'](_0xb88f('0x1d'),this['syncAttendedTransfer'][_0xb88f('0x18')](this));ami['on'](_0xb88f('0x1e'),this[_0xb88f('0x1f')][_0xb88f('0x18')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x26ee74,_0x23213c,_0xbf1d25){io['to'](_0x26ee74)[_0xb88f('0x20')](_0x23213c,_0xbf1d25);}function emitCampaignPreview(_0x4a1b2c){if(_0x4a1b2c[_0xb88f('0x21')]===_0xb88f('0x22')){var _0x2cbf38={'id':_0x4a1b2c['id'],'name':_0x4a1b2c['name'],'strategy':_0x4a1b2c[_0xb88f('0x23')],'answered':_0x4a1b2c[_0xb88f('0x24')],'available':_0x4a1b2c[_0xb88f('0x25')],'loggedIn':_0x4a1b2c[_0xb88f('0x26')],'pTalking':_0x4a1b2c['pTalking'],'sumBillable':_0x4a1b2c[_0xb88f('0x27')],'sumDuration':_0x4a1b2c[_0xb88f('0x28')],'sumHoldTime':_0x4a1b2c[_0xb88f('0x29')]||0x0,'talking':_0x4a1b2c[_0xb88f('0x2a')],'total':_0x4a1b2c['total'],'type':_0x4a1b2c[_0xb88f('0x21')],'unmanaged':_0x4a1b2c[_0xb88f('0x2b')],'abandoned':_0x4a1b2c['abandoned'],'waiting':_0x4a1b2c['waiting'],'loggedInDb':_0x4a1b2c[_0xb88f('0x2c')],'dialActive':_0x4a1b2c[_0xb88f('0x2d')],'dialMethod':_0x4a1b2c['dialMethod'],'dialOriginateCallerIdName':_0x4a1b2c[_0xb88f('0x2e')],'dialOriginateCallerIdNumber':_0x4a1b2c[_0xb88f('0x2f')],'dialOriginateTimeout':_0x4a1b2c[_0xb88f('0x30')],'dialPrefix':_0x4a1b2c[_0xb88f('0x31')],'outboundAnswerAgiCallsDay':_0x4a1b2c[_0xb88f('0x32')],'outboundAnswerCallsDay':_0x4a1b2c[_0xb88f('0x33')],'outboundBlacklistCallsDay':_0x4a1b2c[_0xb88f('0x34')],'outboundBusyCallsDay':_0x4a1b2c[_0xb88f('0x35')],'outboundCongestionCallsDay':_0x4a1b2c[_0xb88f('0x36')],'outboundDropCallsDayACS':_0x4a1b2c['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4a1b2c['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x4a1b2c[_0xb88f('0x37')],'outboundNoAnswerCallsDay':_0x4a1b2c['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4a1b2c[_0xb88f('0x38')],'outboundOriginateFailureCallsDay':_0x4a1b2c['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4a1b2c[_0xb88f('0x39')],'outboundRejectCallsDay':_0x4a1b2c['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4a1b2c[_0xb88f('0x3a')],'outboundAbandonedCallsDay':_0x4a1b2c[_0xb88f('0x3b')],'predictiveIntervalAnsweredCalls':_0x4a1b2c['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4a1b2c[_0xb88f('0x3c')],'predictiveIntervalAvgTalktime':_0x4a1b2c[_0xb88f('0x3d')],'predictiveIntervalDroppedCallsCallersExit':_0x4a1b2c[_0xb88f('0x3e')],'predictiveIntervalDroppedCallsTimeout':_0x4a1b2c[_0xb88f('0x3f')],'predictiveIntervalErlangCalls':_0x4a1b2c[_0xb88f('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a1b2c[_0xb88f('0x41')],'predictiveIntervalHitRate':_0x4a1b2c[_0xb88f('0x42')],'predictiveIntervalMultiplicativeFactor':_0x4a1b2c[_0xb88f('0x43')],'predictiveIntervalPauses':_0x4a1b2c['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4a1b2c['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4a1b2c['predictiveIntervalTotalCalls'],'message':_0x4a1b2c[_0xb88f('0x44')],'originated':_0x4a1b2c[_0xb88f('0x45')],'erlangCalls':_0x4a1b2c['erlangCalls'],'erlangCallToSecond':_0x4a1b2c['erlangCallToSecond'],'erlangAbandonmentRate':_0x4a1b2c[_0xb88f('0x46')],'erlangBusyFactor':_0x4a1b2c[_0xb88f('0x47')],'startPredictive':_0x4a1b2c[_0xb88f('0x48')],'startProgressive':_0x4a1b2c['startProgressive']};if(_0x4a1b2c[_0xb88f('0x49')]){_0x2cbf38[_0xb88f('0x49')]={'id':_0x4a1b2c[_0xb88f('0x49')]['id'],'name':_0x4a1b2c[_0xb88f('0x49')][_0xb88f('0x4a')],'active':_0x4a1b2c['Trunk']['active'],'callerid':_0x4a1b2c[_0xb88f('0x49')]['callerid']};}if(_0x4a1b2c[_0xb88f('0x4b')]){_0x2cbf38[_0xb88f('0x4b')]={'id':_0x4a1b2c['Interval']['id'],'name':_0x4a1b2c[_0xb88f('0x4b')][_0xb88f('0x4a')]};}var _0x4f9108=md5(JSON[_0xb88f('0x4c')](_0x2cbf38));if(_0x4a1b2c[_0xb88f('0x3')]!==_0x4f9108){_0x4a1b2c[_0xb88f('0x3')]=_0x4f9108;emit(util[_0xb88f('0x4d')](_0xb88f('0x4e'),_0x2cbf38[_0xb88f('0x4a')]),_0xb88f('0x4f'),_0x2cbf38);}}}function emitVoiceQueueChannelRemove(_0x5cf102){logger['info'](_0xb88f('0x50'),JSON[_0xb88f('0x4c')](_0x5cf102));emit(util['format'](_0xb88f('0x4e'),_0x5cf102[_0xb88f('0x4a')]),'voice_queue_channel:remove',_0x5cf102);io[_0xb88f('0x20')](_0xb88f('0x51'),_0x5cf102);}function notSendMessagesQueue(_0x18279f){if(_0x18279f['sendMessageOneNotActive']){if(_0x18279f[_0xb88f('0x45')]===0x0&&_0x18279f['pTalking']===0x0){_0x18279f[_0xb88f('0x52')]=![];_0x18279f[_0xb88f('0x25')]=0x0;_0x18279f[_0xb88f('0x53')]=0x0;_0x18279f['message']=_0xb88f('0x54');ut[_0xb88f('0x55')](_0xb88f('0x56'),_0x18279f[_0xb88f('0x4a')]+'\x20is\x20not\x20active');}else{_0x18279f[_0xb88f('0x44')]=_0xb88f('0x57');ut[_0xb88f('0x55')](_0xb88f('0x56'),_0x18279f[_0xb88f('0x4a')]+'\x20is\x20disactive');}emitCampaignPreview(_0x18279f);}}Preview['prototype'][_0xb88f('0x58')]=function(){var _0x5f5623=this;setInterval(function(){_0x5f5623['syncCampaigns']();},0x7cf);};Preview[_0xb88f('0xc')][_0xb88f('0x59')]=function(){var _0x2f7edd=this[_0xb88f('0x5a')];this[_0xb88f('0x15')]+=0x1;for(var _0x1c4b49 in _0x2f7edd){if(_0x2f7edd[_0xb88f('0x5b')](_0x1c4b49)&&(_0x2f7edd[_0x1c4b49][_0xb88f('0x5c')]===_0xb88f('0x6')||_0x2f7edd[_0x1c4b49]['dialMethod']==='booked')&&_0x2f7edd[_0x1c4b49]['type']===_0xb88f('0x22')){if(this[_0xb88f('0x15')]>0x7){this[_0xb88f('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x2f7edd['hasOwnProperty'](_0x1c4b49)&&_0x2f7edd[_0x1c4b49][_0xb88f('0x5c')]===_0xb88f('0x6')&&_0x2f7edd[_0x1c4b49][_0xb88f('0x21')]===_0xb88f('0x22')){if(_0x2f7edd[_0x1c4b49][_0xb88f('0x2d')]){this['setMessage'](_0x2f7edd[_0x1c4b49]);this[_0xb88f('0x5d')](_0x2f7edd[_0x1c4b49]);}else{notSendMessagesQueue(_0x2f7edd[_0x1c4b49]);}}}};Preview['prototype'][_0xb88f('0x5e')]=function(_0x4dba1e){var _0x3d9e52=this;this[_0xb88f('0x10')][_0xb88f('0xd')](function(){if(!_[_0xb88f('0x5f')](_0x3d9e52[_0xb88f('0x13')][_0x4dba1e])){loggerAction['info']('[clearZombieChannels][talking]',_0x4dba1e,_0xb88f('0x60'),_0x3d9e52[_0xb88f('0x13')][_0x4dba1e]['queue'],'originated:\x20',JSON[_0xb88f('0x4c')](_0x3d9e52[_0xb88f('0x5a')][_0x3d9e52[_0xb88f('0x13')][_0x4dba1e]['queue']][_0xb88f('0x45')]),'pTalking:\x20',JSON['stringify'](_0x3d9e52[_0xb88f('0x5a')][_0x3d9e52[_0xb88f('0x13')][_0x4dba1e][_0xb88f('0x61')]][_0xb88f('0x62')]),JSON[_0xb88f('0x4c')](_0x3d9e52[_0xb88f('0x13')][_0x4dba1e][_0xb88f('0x63')]),JSON[_0xb88f('0x4c')](_[_0xb88f('0x64')](_0x3d9e52['actions'][_0x4dba1e],['contactId',_0xb88f('0x65'),_0xb88f('0x66'),'ListId'])));return ami[_0xb88f('0x67')]({'action':_0xb88f('0x68'),'channel':_0x3d9e52[_0xb88f('0x13')][_0x4dba1e][_0xb88f('0x69')]})[_0xb88f('0x6a')](function(_0x45ff27){if(_0x45ff27[_0xb88f('0x44')]===_0xb88f('0x6b')){setTimeout(function(){if(_0x3d9e52[_0xb88f('0x13')][_0x4dba1e]){ut[_0xb88f('0x6c')](_0x3d9e52[_0xb88f('0x5a')][_0x3d9e52[_0xb88f('0x13')][_0x4dba1e][_0xb88f('0x61')]],_0xb88f('0x6d'));if(_0x3d9e52[_0xb88f('0x13')][_0x4dba1e]['dialAnswer']===!![]){ut[_0xb88f('0x6e')](_0x3d9e52[_0xb88f('0x5a')][_0x3d9e52[_0xb88f('0x13')][_0x4dba1e][_0xb88f('0x61')]],_0xb88f('0x6d'));ut[_0xb88f('0x6f')](_0xb88f('0x70')+_0x4dba1e,_0x3d9e52[_0xb88f('0x13')][_0x4dba1e]['queue']);}ut[_0xb88f('0x6f')](_0xb88f('0x71')+_0x4dba1e,_0x3d9e52[_0xb88f('0x13')][_0x4dba1e]['queue']);delete _0x3d9e52[_0xb88f('0x13')][_0x4dba1e];}},0x2328);}});}});};Preview[_0xb88f('0xc')][_0xb88f('0x72')]=function(){var _0x5b137e=this;loggerAction[_0xb88f('0x73')]('[action]',_[_0xb88f('0x74')](this['actions']));for(var _0x520523 in this[_0xb88f('0x13')]){if(_0x5b137e[_0xb88f('0x13')][_0xb88f('0x5b')](_0x520523)){_0x5b137e['clearZombieChannel'](_0x520523);}}};Preview[_0xb88f('0xc')][_0xb88f('0x5d')]=function(_0x4d7d47){var _0x478604=this;rpcDb[_0xb88f('0x75')](_0x4d7d47['id'],ut[_0xb88f('0x76')](this[_0xb88f('0x14')]))[_0xb88f('0x77')](function(_0x3e4813){if(!_[_0xb88f('0x5f')](_0x3e4813)){for(var _0x25d604=0x0;_0x25d604<_0x3e4813[_0xb88f('0x78')];_0x25d604+=0x1){if(ut['getDiff'](_0x3e4813[_0x25d604][_0xb88f('0x79')])<_0x4d7d47['dialRecallMeTimeout']*0x3c){if(_0x3e4813[_0x25d604][_0xb88f('0x7a')]&&!_0x3e4813[_0x25d604][_0xb88f('0x7a')][_0xb88f('0x7b')]){_0x478604[_0xb88f('0x7c')](_0x3e4813[_0x25d604]['id'])[_0xb88f('0x77')](ut[_0xb88f('0x7d')](_0xb88f('0x7e')))[_0xb88f('0x6a')](ut[_0xb88f('0x7d')]('[RecallMe]'));}else{rpcDb[_0xb88f('0x7f')](_0x3e4813[_0x25d604]['id']);}}else{var _0x173c0c=new Action(_0x3e4813[_0x25d604],_0x4d7d47);_0x173c0c[_0xb88f('0x80')]=moment()[_0xb88f('0x4d')](_0xb88f('0x81'));_0x4d7d47[_0xb88f('0x39')]+=0x1;ut['logCustomer'](_0x173c0c,0x17,'RecallInQueue');if(_0x4d7d47[_0xb88f('0x82')]){rpcDb[_0xb88f('0x83')](ut[_0xb88f('0x84')](_0x3e4813[_0x25d604]));rpcDb[_0xb88f('0x85')](_0x173c0c,_0xb88f('0x86'));}else{ut[_0xb88f('0x87')](_0x173c0c,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x173c0c,'[HistoryRecallClose]');rpcDb[_0xb88f('0x88')](_0x173c0c,_0xb88f('0x89'));}}}}})['catch'](ut[_0xb88f('0x7d')]('[getContactRecallMe]'));};Preview[_0xb88f('0xc')][_0xb88f('0x8a')]=function(_0x41c313){_0x41c313[_0xb88f('0x52')]=!![];if(ut[_0xb88f('0x8b')](_0x41c313[_0xb88f('0x26')])){_0x41c313['message']=_0xb88f('0x8c');}else if(!ut[_0xb88f('0x8d')](_0x41c313[_0xb88f('0x2d')])){_0x41c313[_0xb88f('0x44')]=_0xb88f('0x54');}else if(!this['isTrunkReachable'](_0x41c313['Trunk'])){if(!this[_0xb88f('0x8e')](_0x41c313['TrunkBackup'])){_0x41c313[_0xb88f('0x44')]=_0xb88f('0x8f');}else{_0x41c313[_0xb88f('0x44')]='ACTIVE';}}else{_0x41c313[_0xb88f('0x44')]=_0xb88f('0x90');}emitCampaignPreview(_0x41c313);};Preview[_0xb88f('0xc')]['callProgressDetectingCustomer']=function(_0x46af0e,_0x49687d,_0x58f668){var _0x541a65=this;var _0x39901f=this['actions'][_0x49687d];var _0x110778=this[_0xb88f('0x5a')][_0x39901f[_0xb88f('0x61')]];var _0x1dcf9e;if(_0x110778){switch(_0x58f668){case'1':_0x110778[_0xb88f('0x38')]+=0x1;_0x39901f[_0xb88f('0x91')]+=0x1;_0x39901f[_0xb88f('0x92')]=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0x0,'NoSuchNumber');ami['emit'](_0xb88f('0x94'),ut[_0xb88f('0x95')](_0x39901f,_0xb88f('0x96')));rpcDb['createCustomerHistory'](_0x39901f,_0xb88f('0x97'));if(ut['totalGlobal'](_0x39901f)>=_0x110778[_0xb88f('0x98')]){_0x1dcf9e=ut['cloneAction'](_0x39901f,0xf,_0xb88f('0x99'));rpcDb[_0xb88f('0x88')](_0x1dcf9e,_0xb88f('0x9a'));}else{if(_0x39901f[_0xb88f('0x91')]>=_0x110778[_0xb88f('0x9b')]){rpcDb[_0xb88f('0x88')](_0x39901f,_0xb88f('0x9a'));}else{rpcDb[_0xb88f('0x9c')](ut[_0xb88f('0x9d')](_0x39901f,_0xb88f('0x91'),_0x110778['dialNoSuchNumberRetryFrequency']),_0x39901f[_0xb88f('0x9e')],_0x39901f[_0xb88f('0x9f')]);}}delete this['actions'][_0x46af0e['linkedid']];break;case'ANSWER':var _0x3f60f0=moment()[_0xb88f('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x39901f['responsetime']=_0x3f60f0;_0x39901f['answertime']=_0x3f60f0;_0x39901f['dialAnswer']=!![];_0x110778[_0xb88f('0x62')]+=0x1;logger[_0xb88f('0x73')](_0xb88f('0xa0'),_0x39901f[_0xb88f('0xa1')],_0xb88f('0xa2'),_0x110778[_0xb88f('0x4a')],'pTalking:\x20',_0x110778[_0xb88f('0x62')]);ami[_0xb88f('0x20')](_0xb88f('0xa3'),ut[_0xb88f('0x95')](_0x39901f,_0xb88f('0xa4'),this['campaignsPreview'][_0x39901f[_0xb88f('0x61')]]));if(_0x110778[_0xb88f('0xa5')]){ami['emit'](_0xb88f('0xa6'),ut['buildAcw'](_0x39901f));}break;case'16':ami[_0xb88f('0x20')]('custom:agentcomplete',ut[_0xb88f('0x95')](_0x39901f,'complete',this[_0xb88f('0x5a')][_0x39901f[_0xb88f('0x61')]]));emitVoiceQueueChannelRemove(ut[_0xb88f('0x95')](_0x39901f,_0xb88f('0xa7')));_0x110778[_0xb88f('0x33')]+=0x1;_0x110778[_0xb88f('0xa8')]+=0x1;_0x110778[_0xb88f('0x24')]+=0x1;ut['decrementTalkink'](_0x110778,_0xb88f('0xa9'));_0x39901f[_0xb88f('0x92')]=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0x4,_0xb88f('0xaa'));rpcDb[_0xb88f('0x85')](_0x39901f,_0xb88f('0xab'));rpcDb['createCustomerFinal'](_0x39901f,_0xb88f('0xac'));rpcDb['crateCustomerReportQueue'](_0x39901f);_0x110778[_0xb88f('0x28')]+=_0x39901f[_0xb88f('0xad')];_0x110778[_0xb88f('0x27')]+=_0x39901f[_0xb88f('0xad')];logger[_0xb88f('0x73')]('[syncHangup][talking][decrement]',_0x39901f[_0xb88f('0xa1')],_0xb88f('0xa2'),_0x110778[_0xb88f('0x4a')],_0xb88f('0xae'),_0x110778[_0xb88f('0x62')]);delete this[_0xb88f('0x13')][_0x46af0e['linkedid']];break;case'BUSY':_0x110778[_0xb88f('0x35')]+=0x1;_0x39901f[_0xb88f('0xaf')]+=0x1;_0x39901f['countglobal']=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0x5,_0xb88f('0xb0'));ami[_0xb88f('0x20')](_0xb88f('0xb1'),ut[_0xb88f('0x95')](_0x39901f,'busy'));rpcDb[_0xb88f('0x85')](_0x39901f,_0xb88f('0xb2'));if(ut[_0xb88f('0x93')](_0x39901f)>=_0x110778[_0xb88f('0x98')]){_0x1dcf9e=ut[_0xb88f('0xb3')](_0x39901f,0xf,_0xb88f('0x99'));rpcDb['createCustomerFinal'](_0x1dcf9e,_0xb88f('0xb4'));}else{if(_0x39901f['countbusyretry']>=_0x110778['dialBusyMaxRetry']){rpcDb[_0xb88f('0x88')](_0x39901f,_0xb88f('0xb2'));}else{rpcDb[_0xb88f('0x9c')](ut[_0xb88f('0x9d')](_0x39901f,_0xb88f('0xaf'),_0x110778[_0xb88f('0xb5')]),_0x39901f[_0xb88f('0x9e')],_0x39901f[_0xb88f('0x9f')]);}}break;case _0xb88f('0xb6'):_0x110778[_0xb88f('0xb7')]+=0x1;_0x39901f['countnoanswerretry']+=0x1;_0x39901f[_0xb88f('0x92')]=ut['totalGlobal'](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0x3,_0xb88f('0xb8'));ami['emit']('custom:agentnoanswer',ut[_0xb88f('0x95')](_0x39901f,'noanswer'));rpcDb[_0xb88f('0x85')](_0x39901f,_0xb88f('0xb9'));if(ut[_0xb88f('0x93')](_0x39901f)>=_0x110778['dialGlobalMaxRetry']){_0x1dcf9e=ut[_0xb88f('0xb3')](_0x39901f,0xf,'Global');rpcDb[_0xb88f('0x88')](_0x1dcf9e,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x39901f[_0xb88f('0xba')]>=_0x110778[_0xb88f('0xbb')]){rpcDb['createCustomerFinal'](_0x39901f,_0xb88f('0xb9'));}else{rpcDb[_0xb88f('0x9c')](ut[_0xb88f('0x9d')](_0x39901f,_0xb88f('0xba'),_0x110778['dialNoAnswerRetryFrequency']),_0x39901f[_0xb88f('0x9e')],_0x39901f['activeContact']);}}break;case _0xb88f('0xbc'):_0x110778[_0xb88f('0x36')]+=0x1;_0x39901f[_0xb88f('0xbd')]+=0x1;_0x39901f[_0xb88f('0x92')]=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0x8,_0xb88f('0xbe'));ami['emit'](_0xb88f('0xbf'),ut[_0xb88f('0x95')](_0x39901f,_0xb88f('0xc0')));rpcDb[_0xb88f('0x85')](_0x39901f,_0xb88f('0xc1'));if(ut['totalGlobal'](_0x39901f)>=_0x110778[_0xb88f('0x98')]){_0x1dcf9e=ut[_0xb88f('0xb3')](_0x39901f,0xf,_0xb88f('0x99'));rpcDb[_0xb88f('0x88')](_0x1dcf9e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x39901f['countcongestionretry']>=_0x110778[_0xb88f('0xc2')]){rpcDb[_0xb88f('0x88')](_0x39901f,_0xb88f('0xc1'));}else{rpcDb[_0xb88f('0x9c')](ut[_0xb88f('0x9d')](_0x39901f,_0xb88f('0xbd'),_0x110778[_0xb88f('0xb5')]),_0x39901f[_0xb88f('0x9e')],_0x39901f[_0xb88f('0x9f')]);}}break;case _0xb88f('0xc3'):_0x110778['outboundRejectCallsDay']+=0x1;_0x39901f['countagentrejectretry']+=0x1;_0x39901f[_0xb88f('0x92')]=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0x14,_0xb88f('0xc4'));ami[_0xb88f('0x20')](_0xb88f('0xc5'),ut[_0xb88f('0x95')](_0x39901f,_0xb88f('0xc6')));rpcDb[_0xb88f('0x85')](_0x39901f,_0xb88f('0xc7'));if(ut[_0xb88f('0x93')](_0x39901f)>=_0x110778[_0xb88f('0x98')]){_0x1dcf9e=ut[_0xb88f('0xb3')](_0x39901f,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x1dcf9e,_0xb88f('0xc8'));}else{if(_0x39901f[_0xb88f('0xc9')]>=_0x110778[_0xb88f('0xca')]){rpcDb[_0xb88f('0x88')](_0x39901f,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x39901f,'countagentrejectretry',_0x110778['dialAgentRejectRetryFrequency']),_0x39901f[_0xb88f('0x9e')],_0x39901f[_0xb88f('0x9f')]);}}break;case _0xb88f('0xcb'):_0x110778[_0xb88f('0x3b')]+=0x1;_0x39901f['countabandonedretry']+=0x1;_0x39901f[_0xb88f('0x92')]=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0xb,'Abandoned');rpcDb[_0xb88f('0x85')](_0x39901f,_0xb88f('0xcc'));if(ut[_0xb88f('0x93')](_0x39901f)>=_0x110778[_0xb88f('0x98')]){_0x1dcf9e=ut[_0xb88f('0xb3')](_0x39901f,0xf,_0xb88f('0x99'));rpcDb[_0xb88f('0x88')](_0x1dcf9e,_0xb88f('0xcc'));}else{if(_0x39901f[_0xb88f('0xcd')]>=_0x110778[_0xb88f('0xce')]){rpcDb[_0xb88f('0x88')](_0x39901f,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xb88f('0x9d')](_0x39901f,'countabandonedretry',_0x110778['dialAbandonedRetryFrequency']),_0x39901f['unlockAgent'],_0x39901f[_0xb88f('0x9f')]);}}break;case'18':_0x110778['outboundUnknownCallsDay']+=0x1;_0x39901f[_0xb88f('0xcf')]+=0x1;_0x39901f[_0xb88f('0x92')]=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0x12,_0x46af0e[_0xb88f('0xd0')]||_0x46af0e[_0xb88f('0xd1')]);ami[_0xb88f('0x20')](_0xb88f('0xd2'),ut[_0xb88f('0x95')](_0x39901f,_0xb88f('0xd3')));rpcDb['createCustomerHistory'](_0x39901f,_0xb88f('0xd4'));if(ut[_0xb88f('0x93')](_0x39901f)>=_0x110778[_0xb88f('0x98')]){_0x1dcf9e=ut[_0xb88f('0xb3')](_0x39901f,0xf,_0xb88f('0x99'));rpcDb[_0xb88f('0x88')](_0x1dcf9e,_0xb88f('0xd4'));}else{rpcDb[_0xb88f('0x88')](_0x39901f,_0xb88f('0xd4'));}delete this['actions'][_0x46af0e[_0xb88f('0xd5')]];break;case'19':_0x110778[_0xb88f('0x3a')]+=0x1;_0x39901f[_0xb88f('0x92')]=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0x13,_0x46af0e['cause-txt']||_0x46af0e[_0xb88f('0xd1')]);ami[_0xb88f('0x20')](_0xb88f('0xd2'),ut[_0xb88f('0x95')](_0x39901f,_0xb88f('0xd3')));rpcDb['createCustomerHistory'](_0x39901f,_0xb88f('0xd6'));if(ut[_0xb88f('0x93')](_0x39901f)>=_0x110778[_0xb88f('0x98')]){_0x1dcf9e=ut[_0xb88f('0xb3')](_0x39901f,0xf,_0xb88f('0x99'));rpcDb[_0xb88f('0x88')](_0x1dcf9e,_0xb88f('0xd6'));}else{rpcDb[_0xb88f('0x88')](_0x39901f,_0xb88f('0xd6'));}delete this[_0xb88f('0x13')][_0x46af0e[_0xb88f('0xd5')]];break;default:if(_0x39901f[_0xb88f('0x63')]){ut['decrementTalkink'](_0x110778,'[default]');ut[_0xb88f('0x6f')](_0xb88f('0xd7')+_0x110778[_0xb88f('0x4a')],_0x46af0e);}_0x110778[_0xb88f('0x3a')]+=0x1;_0x39901f['countglobal']=ut[_0xb88f('0x93')](_0x39901f);ut[_0xb88f('0x87')](_0x39901f,0xc,_0x46af0e[_0xb88f('0xd0')]||_0x46af0e[_0xb88f('0xd1')]);rpcDb['createCustomerHistory'](_0x39901f,_0xb88f('0xd8'));if(ut[_0xb88f('0x93')](_0x39901f)>=_0x110778['dialGlobalMaxRetry']){_0x1dcf9e=ut[_0xb88f('0xb3')](_0x39901f,0xf,_0xb88f('0x99'));rpcDb['createCustomerFinal'](_0x1dcf9e,_0xb88f('0xd9'));}else{rpcDb[_0xb88f('0x88')](_0x39901f,_0xb88f('0xd9'));}delete this['actions'][_0x46af0e[_0xb88f('0xd5')]];}if(!(_0x39901f['dialAnswer']&&_0x58f668==='16')){ut[_0xb88f('0x6c')](_0x110778,'[callProgressDetectingCustomer]');logger[_0xb88f('0x73')](_0xb88f('0xda'),_0x39901f[_0xb88f('0xa1')],_0xb88f('0xa2'),_0x110778[_0xb88f('0x4a')],_0xb88f('0xdb'),_0x110778['originated']);}if(_0x58f668!==_0xb88f('0xdc')){delete this[_0xb88f('0x13')][_0x46af0e[_0xb88f('0xd5')]];delete this[_0xb88f('0x13')][_0x46af0e[_0xb88f('0xdd')]];}}};Preview[_0xb88f('0xc')][_0xb88f('0xde')]=function(_0x3dcadb,_0x3e8b26,_0x40f370){if(_[_0xb88f('0xdf')](_0x3e8b26)&&_0xb88f('0xe0')!==typeof _0x3e8b26){return;}if(_['isUndefined'](_0x40f370)&&'object'!==typeof _0x40f370){return;}switch(_0x40f370[_0xb88f('0xe1')]){case'0':ut['logAgent'](_0x3dcadb,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x3dcadb,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xb88f('0xe2')](_0x3dcadb,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x3dcadb,_0xb88f('0xe3'));break;case'5':ut[_0xb88f('0xe2')](_0x3dcadb,0x5,_0xb88f('0xb0'));rpcDb['createAgentHistory'](_0x3dcadb,_0xb88f('0xe4'));break;case'8':ut[_0xb88f('0xe2')](_0x3dcadb,0x8,'Congestion');rpcDb[_0xb88f('0xe5')](_0x3dcadb,_0xb88f('0xe6'));break;case'22':ut['logAgent'](_0x3dcadb,0x16,'AnswerAGI');rpcDb[_0xb88f('0xe5')](_0x3dcadb,_0xb88f('0xe7'));break;default:ut[_0xb88f('0xe2')](_0x3dcadb,0xc,_0x40f370[_0xb88f('0xe1')]);rpcDb[_0xb88f('0xe5')](_0x3dcadb,_0xb88f('0xe6'));}ut[_0xb88f('0x6c')](_0x3e8b26,_0xb88f('0xe8'));logger[_0xb88f('0x73')]('[originated][decrement][callProgressDetectingAgent]',_0x3dcadb[_0xb88f('0xa1')],'\x20Queue',_0x3e8b26[_0xb88f('0x4a')],_0xb88f('0xdb'),_0x3e8b26['originated']);delete this[_0xb88f('0x13')][_0x3dcadb[_0xb88f('0xa1')]];};Preview[_0xb88f('0xc')][_0xb88f('0xe9')]=function(_0x266f9c,_0x28dd67,_0x40fdf8,_0x2278c5,_0x576e0d){var _0x1e5b8d=this;return new BPromise(function(_0x1fa37e,_0x552d79){if(_['isNil'](_0x28dd67)||_[_0xb88f('0x5f')](_0x28dd67[_0xb88f('0xea')])||_['isNil'](_0x28dd67[_0xb88f('0xea')][_0xb88f('0xeb')])||_[_0xb88f('0x5f')](_0x28dd67[_0xb88f('0x66')])){_0x552d79(ut[_0xb88f('0x44')]('Contact\x20is\x20undefined',_0x2278c5,_0x576e0d));return;}var _0x2234a2=uuid['v4']();var _0x3cb997=_0x1e5b8d[_0xb88f('0x5a')][_0x28dd67['Queue'][_0xb88f('0x4a')]];var _0x4f9e68=_0x40fdf8?_0x1e5b8d[_0xb88f('0x14')][_0x40fdf8]['id']:undefined;_0x1e5b8d[_0xb88f('0x13')][_0x2234a2]=new Action(_0x28dd67,_0x3cb997,_0x2234a2,_0x40fdf8,_0x4f9e68);var _0x4b52b0=_0x1e5b8d[_0xb88f('0x13')][_0x2234a2];_0x4b52b0['unlockAgent']=_0x2278c5;_0x4b52b0[_0xb88f('0x9f')]=_0x576e0d;_0x4b52b0[_0xb88f('0xec')]=_0x40fdf8;if(_['isEmpty'](_0x266f9c)){_0x1e5b8d['execCall'](_0x4b52b0,_0x3cb997,_0x28dd67,_0x40fdf8)[_0xb88f('0x77')](function(_0x1c09b0){logger[_0xb88f('0x73')](_0xb88f('0xed'),_0xb88f('0xee')+_0x4b52b0[_0xb88f('0x61')]+_0xb88f('0xef')+_0x4b52b0[_0xb88f('0xf0')],JSON[_0xb88f('0x4c')](_0x1c09b0));ami[_0xb88f('0x20')](_0xb88f('0xf1'),ut[_0xb88f('0x95')](_0x4b52b0,_0xb88f('0xf2'),_0x1e5b8d[_0xb88f('0x5a')][_0x4b52b0[_0xb88f('0x61')]]));_0x1fa37e(ut['message']('Calling'));})[_0xb88f('0x6a')](function(_0x4b64cc){ut[_0xb88f('0x55')](_0xb88f('0xf3'),_0x4b64cc);_0x552d79(ut['message'](_0xb88f('0xf4'),_0x2278c5,_0x576e0d));});}else{_0x3cb997[_0xb88f('0x34')]+=0x1;ut[_0xb88f('0xf5')](_0x4b52b0);rpcDb[_0xb88f('0xf6')](_0x4b52b0,_0xb88f('0xf7'));delete _0x1e5b8d[_0xb88f('0x13')][_0x2234a2];_0x552d79(ut['message'](_0xb88f('0xf8'),_0x2278c5,_0x576e0d));}});};Preview[_0xb88f('0xc')][_0xb88f('0x8e')]=function(_0x1778b4){return!_['isNil'](_0x1778b4)&&!_[_0xb88f('0x5f')](_0x1778b4[_0xb88f('0x4a')])&&!_[_0xb88f('0x5f')](_0x1778b4[_0xb88f('0xf9')])&&_0x1778b4[_0xb88f('0xf9')]&&!_[_0xb88f('0x5f')](this[_0xb88f('0x12')][util['format'](_0xb88f('0xfa'),_0x1778b4[_0xb88f('0x4a')])])&&!_[_0xb88f('0x5f')](this[_0xb88f('0x12')][util[_0xb88f('0x4d')](_0xb88f('0xfa'),_0x1778b4['name'])][_0xb88f('0x68')])&&(this[_0xb88f('0x12')][util[_0xb88f('0x4d')](_0xb88f('0xfa'),_0x1778b4[_0xb88f('0x4a')])][_0xb88f('0x68')]===_0xb88f('0xfb')||this[_0xb88f('0x12')][util[_0xb88f('0x4d')](_0xb88f('0xfa'),_0x1778b4['name'])][_0xb88f('0x68')]==='unmonitored');};Preview[_0xb88f('0xc')]['run']=function(_0x106770,_0x305604){var _0x4c04d3=this;return new BPromise(function(_0x40fd7c,_0x2f7296){_0x4c04d3[_0xb88f('0xfc')](_0x106770,_0x305604)[_0xb88f('0x77')](function(_0x4d538c){_0x40fd7c(_[_0xb88f('0x64')](_0x4d538c,[_0xb88f('0x44')]));})[_0xb88f('0x6a')](function(_0x5bac65){if(_0x5bac65['unlock']){rpcDb['unlockContact'](_0x106770);}if(_0x5bac65[_0xb88f('0xf9')]){rpcDb[_0xb88f('0x7f')](_0x106770);}_0x2f7296(_[_0xb88f('0x64')](_0x5bac65,[_0xb88f('0x44')]));});});};Preview[_0xb88f('0xc')][_0xb88f('0xfc')]=function(_0x3fcc23,_0x56e5f8){var _0xdcf918=this;return new BPromise(function(_0x3f0299,_0xf6f7d8){var _0x26b44f,_0x4c36e9;rpcDb[_0xb88f('0xfd')](_0x3fcc23)[_0xb88f('0x77')](function(_0x4ebac5){if(!_[_0xb88f('0x5f')](_0x4ebac5[0x0])){_0x4c36e9=_0x4ebac5[0x0]['recallme']?![]:!![];_0x26b44f=_0x4ebac5[0x0][_0xb88f('0xfe')]?!![]:![];_0x26b44f=_0x56e5f8?!![]:_0x26b44f;}var _0x4c426a=_0xdcf918[_0xb88f('0xff')](_0x4ebac5);if(_0x4c426a[_0xb88f('0x100')]){rpcDb['checkIsBlackList'](_[_0xb88f('0x64')](_0x4ebac5[0x0],['VoiceQueueId',_0xb88f('0x101')]))[_0xb88f('0x77')](function(_0x210ed3){_0xdcf918[_0xb88f('0xe9')](_0x210ed3,_0x4ebac5[0x0],_0x56e5f8,_0x4c36e9,_0x26b44f)['then'](function(_0x37f393){_0x3f0299(_0x37f393);})[_0xb88f('0x6a')](function(_0x58ddc7){_0xf6f7d8(_0x58ddc7);});})[_0xb88f('0x6a')](function(_0x179876){ut['logger'](_0xb88f('0x102'),_0x179876);_0xf6f7d8(ut[_0xb88f('0x44')](_0xb88f('0x103'),_0x4c36e9,_0x26b44f));});}else{_0xf6f7d8(ut[_0xb88f('0x44')](_0x4c426a[_0xb88f('0x44')],_0x4c36e9,_0x26b44f));}})['catch'](function(_0x494f81){ut[_0xb88f('0x55')](_0xb88f('0x104'),_0x494f81);_0xf6f7d8(ut[_0xb88f('0x44')](_0xb88f('0x103'),![],!![]));});});};Preview['prototype'][_0xb88f('0xff')]=function(_0x3288ea){if(_[_0xb88f('0x5f')](_0x3288ea)||_[_0xb88f('0x105')](_0x3288ea)||!_['isNil'](_0x3288ea[0x0][_0xb88f('0x7a')])&&_['isNil'](_0x3288ea[0x0][_0xb88f('0x7a')]['name'])){ut[_0xb88f('0x55')](_0xb88f('0x106'),_0x3288ea);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x548272=this[_0xb88f('0x5a')][_0x3288ea[0x0][_0xb88f('0x60')][_0xb88f('0x4a')]];_0x548272[_0xb88f('0x44')]='ACTIVE';if(_[_0xb88f('0x5f')](_0x548272)){ut[_0xb88f('0x55')](_0xb88f('0x107'),_0x548272);return{'isValid':![],'message':_0xb88f('0x108')};}if(!this[_0xb88f('0x8e')](_0x548272['Trunk'])){ut[_0xb88f('0x55')](_0xb88f('0x109'),_0xb88f('0x10a')+_0x548272[_0xb88f('0x4a')]+_0xb88f('0x10b'));if(!this[_0xb88f('0x8e')](_0x548272[_0xb88f('0x10c')])){ut[_0xb88f('0x55')](_0xb88f('0x109'),_0x548272[_0xb88f('0x4a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x548272[_0xb88f('0x2d')])){ut[_0xb88f('0x55')](_0xb88f('0x10d'),_0x548272['name']+_0xb88f('0x10e'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x548272[_0xb88f('0x4a')]+_0xb88f('0x10e')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xb88f('0xc')][_0xb88f('0x10f')]=function(_0x3e3b2b,_0x291283,_0x2a2990,_0x375282){var _0x256757=this;return new BPromise(function(_0xc2e0e7,_0x58e978){var _0x542473=_0x3e3b2b[_0xb88f('0xa1')];var _0x3509b0=_0x256757[_0xb88f('0x8e')](_0x291283[_0xb88f('0x49')])?util['format'](_0xb88f('0x110'),_0x291283[_0xb88f('0x49')]['name'],_[_0xb88f('0x5f')](_0x291283[_0xb88f('0x31')])?'':_0x291283['dialPrefix']['trim']()||'',_0x291283[_0xb88f('0x111')]>0x0?_0x2a2990[_0xb88f('0xea')]['phone'][_0xb88f('0x112')](_0x291283[_0xb88f('0x111')]):_0x2a2990[_0xb88f('0xea')][_0xb88f('0xeb')]):util[_0xb88f('0x4d')](_0xb88f('0x110'),_[_0xb88f('0x5f')](_0x291283[_0xb88f('0x10c')])?_0x291283[_0xb88f('0x49')][_0xb88f('0x4a')]:_0x291283[_0xb88f('0x10c')]['name'],_[_0xb88f('0x5f')](_0x291283[_0xb88f('0x31')])?'':_0x291283[_0xb88f('0x31')]['trim']()||'',_0x291283[_0xb88f('0x111')]>0x0?_0x2a2990[_0xb88f('0xea')][_0xb88f('0xeb')]['substring'](_0x291283['dialCutDigit']):_0x2a2990[_0xb88f('0xea')]['phone']);var _0x27cf3b=_0x256757[_0xb88f('0x8e')](_0x291283[_0xb88f('0x49')])?ut[_0xb88f('0x113')](_0x291283[_0xb88f('0x49')][_0xb88f('0x114')],_0x291283[_0xb88f('0x2e')],_0x291283[_0xb88f('0x115')]>0x0?ut[_0xb88f('0x116')](_0x291283[_0xb88f('0x2f')],_0x291283[_0xb88f('0x115')]):_0x291283[_0xb88f('0x2f')]):ut['getCallerId'](_[_0xb88f('0x5f')](_0x291283[_0xb88f('0x10c')])?_0x291283['Trunk'][_0xb88f('0x114')]:_0x291283['TrunkBackup'][_0xb88f('0x114')],_0x291283[_0xb88f('0x2e')],_0x291283['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb88f('0x116')](_0x291283[_0xb88f('0x2f')],_0x291283[_0xb88f('0x115')]):_0x291283[_0xb88f('0x2f')]);if(_0x27cf3b){_0x3e3b2b[_0xb88f('0x117')]=ut[_0xb88f('0x118')](_0x27cf3b);_0x3e3b2b[_0xb88f('0x119')]=ut[_0xb88f('0x11a')](_0x27cf3b);}var _0x1a008a=ut[_0xb88f('0x11b')](_0x291283,_0x2a2990,_0x3509b0,_0x27cf3b,_0x542473,_0x3e3b2b);_[_0xb88f('0x11c')](_0x3e3b2b,ut[_0xb88f('0x11d')](_0x1a008a));_0x3e3b2b[_0xb88f('0x80')]=moment()[_0xb88f('0x4d')](_0xb88f('0x81'));ami['Action'](ut[_0xb88f('0x11e')](_0x3e3b2b,_0x291283,_0x1a008a,_0x3e3b2b['activeContact'],_0x375282))[_0xb88f('0x77')](function(_0xa1361c){var _0x632847=_0x3e3b2b[_0xb88f('0x11f')];if(!_[_0xb88f('0x5f')](_0x632847)){if(!_[_0xb88f('0x5f')](_0x256757[_0xb88f('0x14')][_0x632847])){_0x256757[_0xb88f('0x14')][_0x632847]['destconnectedlinenum']=_0x3e3b2b['calleridnum'];emit(util['format'](_0xb88f('0x120'),_0x256757[_0xb88f('0x14')][_0x632847][_0xb88f('0x4a')]),_0xb88f('0x121'),{'destaccountcode':_0x256757['agents'][_0x632847]['accountcode'],'destconnectedlinenum':_0x3e3b2b[_0xb88f('0x122')]});}}_0x291283['originated']+=0x1;logger[_0xb88f('0x73')]('[originated][increment]',_0x542473,_0xb88f('0xa2'),_0x291283[_0xb88f('0x4a')],_0xb88f('0xdb'),_0x291283[_0xb88f('0x45')]);_0xc2e0e7(_0xa1361c);})['catch'](function(_0x1d13f8){ut['logAgent'](_0x3e3b2b,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x3e3b2b,_0xb88f('0x123'));_0x58e978(_0x1d13f8);});});};Preview[_0xb88f('0xc')]['syncNewExten']=function(_0x4ab185){if(this[_0xb88f('0x13')][_0x4ab185['linkedid']]){this[_0xb88f('0x13')][_0x4ab185[_0xb88f('0xd5')]]['channel']=_0x4ab185[_0xb88f('0x69')];}};Preview['prototype'][_0xb88f('0x16')]=function(_0x28cc90){var _0x63c11c=this;var _0x4d0a0c=this[_0xb88f('0x13')][_0x28cc90['actionid']];if(_0x4d0a0c){if(_0x4d0a0c[_0xb88f('0xec')]&&this['agents'][_0x4d0a0c[_0xb88f('0xec')]]){ut[_0xb88f('0x124')](_0x4d0a0c,this['agents'][_0x4d0a0c['lookAgent']][_0xb88f('0x4a')],this[_0xb88f('0x14')][_0x4d0a0c['lookAgent']]['id']);}var _0x107653=_['clone'](_0x4d0a0c);_0x107653[_0xb88f('0x125')]=moment()['format'](_0xb88f('0x81'));var _0x3c6c10=_0x63c11c[_0xb88f('0x5a')][_0x4d0a0c[_0xb88f('0x61')]];if(ut['isFailure'](_0x28cc90['response'])){if(_0x4d0a0c[_0xb88f('0x9e')]){rpcDb[_0xb88f('0x126')](_0x4d0a0c['idContact']);}if(_0x4d0a0c[_0xb88f('0x9f')]){rpcDb[_0xb88f('0x7f')](_0x4d0a0c['idContact']);}ami[_0xb88f('0x20')](_0xb88f('0x127'),ut[_0xb88f('0x95')](_0x4d0a0c,_0xb88f('0x128'),this['campaignsPreview'][_0x4d0a0c['queue']]));this[_0xb88f('0xde')](_0x107653,_0x3c6c10,_0x28cc90);}else{_0x4d0a0c[_0xb88f('0x80')]=moment()[_0xb88f('0x4d')](_0xb88f('0x81'));ut['logAgent'](_0x107653,0x4,_0xb88f('0xaa'));rpcDb['createAgentHistory'](_0x107653,_0xb88f('0x129'));}}};Preview['prototype'][_0xb88f('0x12a')]=function(_0x487a68){var _0x1d32a2=this;var _0x134049=this[_0xb88f('0x13')][_0x487a68[_0xb88f('0xd5')]];var _0x3321b6;if(_0x134049){_0x3321b6=this[_0xb88f('0x5a')][_0x134049[_0xb88f('0x61')]];logger['info']('[syncHangup][talking]',_0x487a68[_0xb88f('0xd5')],_0xb88f('0xa2'),_0x3321b6['name'],_0xb88f('0xae'),_0x3321b6[_0xb88f('0x62')]);}if(this[_0xb88f('0x13')][_0x487a68[_0xb88f('0xd5')]]&&_0x487a68[_0xb88f('0xd5')]!==_0x487a68['uniqueid']){if(_0x487a68[_0xb88f('0x12b')]==='16'&&this['actions'][_0x487a68[_0xb88f('0xd5')]][_0xb88f('0x63')]){this[_0xb88f('0x12c')](_0x487a68,_0x487a68['linkedid'],_0x487a68['cause']);}else if(this['actions'][_0x487a68['linkedid']][_0xb88f('0x63')]){logger[_0xb88f('0x73')](_0xb88f('0x12d'),_0x487a68[_0xb88f('0xd5')],_0x487a68[_0xb88f('0x12b')],_0xb88f('0xa2'),_0x3321b6['name'],_0xb88f('0xae'),_0x3321b6[_0xb88f('0x62')]);this[_0xb88f('0x12c')](_0x487a68,_0x487a68['linkedid'],_0x487a68[_0xb88f('0x12b')]);}}else if(_0x134049&&_[_0xb88f('0x5f')](_0x134049[_0xb88f('0x12e')])&&_0x3321b6[_0xb88f('0x12f')]&&_0x487a68[_0xb88f('0xd5')]===_0x487a68[_0xb88f('0xa1')]&&_['isNil'](_0x487a68[_0xb88f('0xe1')])&&_0x487a68[_0xb88f('0x12b')]==='16'&&_0x487a68[_0xb88f('0x130')]==='6'&&_['isUndefined'](_0x134049[_0xb88f('0x131')])){if(_0x134049[_0xb88f('0x9e')]){rpcDb[_0xb88f('0x126')](_0x134049[_0xb88f('0xf0')]);}if(_0x134049[_0xb88f('0x9f')]){rpcDb['disableContact'](_0x134049[_0xb88f('0xf0')]);}_0x487a68['reason']='22';this[_0xb88f('0xde')](_0x134049,_0x3321b6,_0x487a68);}else if(_0x134049&&_0x134049['transfer']){if(_0x487a68['cause']==='16'&&this[_0xb88f('0x13')][_0x487a68['linkedid']][_0xb88f('0x63')]){logger[_0xb88f('0x73')]('[syncHangup][talking][transfer]',_0x487a68[_0xb88f('0xd5')],_0x487a68['cause'],_0xb88f('0xa2'),_0x3321b6['name'],_0xb88f('0xae'),_0x3321b6[_0xb88f('0x62')]);this[_0xb88f('0x12c')](_0x487a68,_0x487a68[_0xb88f('0xd5')],_0x487a68['cause']);}else if(this[_0xb88f('0x13')][_0x487a68[_0xb88f('0xd5')]][_0xb88f('0x63')]){logger[_0xb88f('0x73')](_0xb88f('0x12d'),_0x487a68[_0xb88f('0xd5')],_0x487a68[_0xb88f('0x12b')],'\x20Queue',_0x3321b6[_0xb88f('0x4a')],_0xb88f('0xae'),_0x3321b6[_0xb88f('0x62')]);this[_0xb88f('0x12c')](_0x487a68,_0x487a68[_0xb88f('0xd5')],_0x487a68[_0xb88f('0x12b')]);}}};Preview[_0xb88f('0xc')][_0xb88f('0x132')]=function(_0x3196aa){if(this['actions'][_0x3196aa[_0xb88f('0xdd')]]&&_0x3196aa['destlinkedid']!==_0x3196aa[_0xb88f('0x133')]){this[_0xb88f('0x12c')](_0x3196aa,_0x3196aa['destlinkedid'],_0x3196aa[_0xb88f('0xd1')]);}};Preview[_0xb88f('0xc')]['syncHangupRequest']=function(_0xf2dc06){if(this[_0xb88f('0x13')][_0xf2dc06[_0xb88f('0xd5')]]&&_0xf2dc06[_0xb88f('0xd5')]!==_0xf2dc06['uniqueid']&&!this[_0xb88f('0x13')][_0xf2dc06[_0xb88f('0xd5')]]['dialAnswer']){if(_0xf2dc06[_0xb88f('0x12b')]==='1'){this[_0xb88f('0x12c')](_0xf2dc06,_0xf2dc06['linkedid'],_0xf2dc06[_0xb88f('0x12b')]);}}};Preview['prototype'][_0xb88f('0x134')]=function(_0x451831,_0x22ae18,_0x17e942){if(this[_0xb88f('0x13')][_0x451831]){if(_['isNil'](this[_0xb88f('0x13')][_0x451831][_0xb88f('0x135')])){this['actions'][_0x451831][_0xb88f('0x135')]={};}this[_0xb88f('0x13')][_0x451831][_0xb88f('0x135')][_0x22ae18]=_0x17e942;}};Preview['prototype'][_0xb88f('0x1c')]=function(_0x67d909){try{if(!_['isNil'](_0x67d909)){if(ut['filterKey'](_['keys'](_0x67d909[_0xb88f('0x136')])[0x0])){this[_0xb88f('0x134')](_0x67d909[_0xb88f('0xa1')],_[_0xb88f('0x137')](_0x67d909[_0xb88f('0x136')])[0x0],_0x67d909[_0xb88f('0x138')]);}}}catch(_0x42b6b3){logger[_0xb88f('0x139')](_0xb88f('0x13a'),util[_0xb88f('0x13b')](_0x42b6b3,{'showHidden':![],'depth':null}));}};Preview[_0xb88f('0xc')][_0xb88f('0x13c')]=function(_0x4c2762){if(_0x4c2762){if(this[_0xb88f('0x13')][_0x4c2762[_0xb88f('0x13d')]]){this[_0xb88f('0x13')][_0x4c2762[_0xb88f('0x13d')]][_0xb88f('0x131')]=!![];}}};Preview[_0xb88f('0xc')][_0xb88f('0x1f')]=function(_0x45819f){if(_0x45819f){if(this['actions'][_0x45819f[_0xb88f('0x13e')]]){this[_0xb88f('0x13')][_0x45819f[_0xb88f('0x13e')]][_0xb88f('0x131')]=!![];}}};module[_0xb88f('0x13f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6c7ca1f..06188d9 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 _0xace9=['[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact'];(function(_0x598408,_0x5e6f74){var _0x560720=function(_0x56a96d){while(--_0x56a96d){_0x598408['push'](_0x598408['shift']());}};_0x560720(++_0x5e6f74);}(_0xace9,0x1c0));var _0x9ace=function(_0x1d598a,_0x927c9f){_0x1d598a=_0x1d598a-0x0;var _0x33b4e6=_0xace9[_0x1d598a];return _0x33b4e6;};'use strict';var util=require(_0x9ace('0x0'));var BPromise=require(_0x9ace('0x1'));var logger=require(_0x9ace('0x2'))(_0x9ace('0x3'));var _=require(_0x9ace('0x4'));var cmHopper=require(_0x9ace('0x5'));var cmHopperFinal=require(_0x9ace('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9ace('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x9ace('0x8'));var voiceQueueReport=require(_0x9ace('0x9'));function loggerCatch(_0x593662){return function(_0x3f6dd7){logger[_0x9ace('0xa')](_0x593662,util[_0x9ace('0xb')](_0x3f6dd7,{'showHidden':![],'depth':null}));};}function create(_0x51493b){return BPromise['resolve']()[_0x9ace('0xc')](cmHopperHistory[_0x9ace('0xd')](_0x51493b))[_0x9ace('0xe')](loggerCatch(_0x9ace('0xf')));}function createAgent(_0x1c774a){return BPromise['resolve']()[_0x9ace('0xc')](agentReportPreview['createHistory'](_0x1c774a))[_0x9ace('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x50638a){return BPromise[_0x9ace('0x10')]()['then'](cmHopper[_0x9ace('0x11')](_0x50638a,!![]))[_0x9ace('0xe')](loggerCatch(_0x9ace('0x12')));}exports[_0x9ace('0x13')]=function(_0x33a5a6){return BPromise[_0x9ace('0x10')]()[_0x9ace('0xc')](cmHopperBlack[_0x9ace('0x13')](_0x33a5a6))['catch'](loggerCatch(_0x9ace('0x14')));};exports[_0x9ace('0x15')]=function(_0x3ed23d){return BPromise[_0x9ace('0x10')]()[_0x9ace('0xc')](cmHopper[_0x9ace('0x15')](_0x3ed23d))[_0x9ace('0xe')](loggerCatch(_0x9ace('0x16')));};exports['createHistory']=function(_0xfec378,_0x3ce4e7){create(_0xfec378)[_0x9ace('0xe')](loggerCatch(_0x3ce4e7));moveContact(_0xfec378)[_0x9ace('0xe')](loggerCatch(_0x3ce4e7));};exports[_0x9ace('0x17')]=function(_0x16d7b6,_0x18144c){createAgent(_0x16d7b6)[_0x9ace('0xe')](loggerCatch(_0x18144c));};exports['createCustomerHistory']=function(_0x231fee,_0x2bb914){create(_0x231fee)[_0x9ace('0xe')](loggerCatch(_0x2bb914));};exports['createCustomerFinal']=function(_0x2e26e2,_0x3b58db){moveContact(_0x2e26e2)[_0x9ace('0xe')](loggerCatch(_0x3b58db));};exports[_0x9ace('0x18')]=function(_0x508b78,_0x4841fa,_0x33a75a){if(_0x4841fa){_0x508b78[_0x9ace('0x19')]=null;}if(_0x33a75a){_0x508b78[_0x9ace('0x1a')]=![];}return BPromise[_0x9ace('0x10')]()['then'](cmHopper[_0x9ace('0x18')](_0x508b78))[_0x9ace('0xe')](loggerCatch(_0x9ace('0x1b')));};exports[_0x9ace('0x1c')]=function(_0x521095){return BPromise[_0x9ace('0x10')]()[_0x9ace('0xc')](cmHopper[_0x9ace('0x1c')](_0x521095))[_0x9ace('0xe')](loggerCatch(_0x9ace('0x1d')));};exports[_0x9ace('0x1e')]=function(_0x26c6a1){return BPromise[_0x9ace('0x10')]()[_0x9ace('0xc')](cmHopper[_0x9ace('0x1e')]({'UserId':null},_0x26c6a1,0x1))[_0x9ace('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x9ace('0x1f')]=function(_0x2baf96){return BPromise[_0x9ace('0x10')]()[_0x9ace('0xc')](cmHopper['unlockContact']({'active':![]},_0x2baf96,0x1))[_0x9ace('0xe')](loggerCatch(_0x9ace('0x20')));};exports[_0x9ace('0x21')]=function(_0x1aa2fc){var _0x39ec70={};_0x39ec70[_0x9ace('0x22')]=_0x1aa2fc['type'];_0x39ec70[_0x9ace('0x23')]=_0x1aa2fc[_0x9ace('0x23')];_0x39ec70[_0x9ace('0x24')]=_0x1aa2fc[_0x9ace('0x24')];_0x39ec70[_0x9ace('0x25')]=_0x1aa2fc[_0x9ace('0x25')];_0x39ec70[_0x9ace('0x26')]=_0x1aa2fc[_0x9ace('0x26')];_0x39ec70[_0x9ace('0x27')]=_0x1aa2fc[_0x9ace('0x28')];_0x39ec70[_0x9ace('0x29')]=_0x1aa2fc[_0x9ace('0x28')];_0x39ec70[_0x9ace('0x2a')]=0x1;_0x39ec70[_0x9ace('0x2b')]=_0x1aa2fc[_0x9ace('0x2c')];_0x39ec70[_0x9ace('0x2d')]=_0x1aa2fc[_0x9ace('0x2e')];_0x39ec70[_0x9ace('0x2f')]=_0x9ace('0x30');_0x39ec70[_0x9ace('0x31')]=_0x9ace('0x32');_0x39ec70[_0x9ace('0x33')]=0x0;_0x39ec70[_0x9ace('0x34')]=0x1;_0x39ec70[_0x9ace('0x35')]=_0x1aa2fc[_0x9ace('0x2e')];_0x39ec70[_0x9ace('0x36')]=_0x9ace('0x37');return BPromise['resolve']()[_0x9ace('0xc')](voiceQueueReport['create'](_0x39ec70))[_0x9ace('0xe')](loggerCatch(_0x9ace('0x38')));};exports[_0x9ace('0x39')]=function(_0x52912b,_0x3ceb1c){return BPromise['resolve']()[_0x9ace('0xc')](cmHopper[_0x9ace('0x39')](_0x52912b,_0x3ceb1c))[_0x9ace('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9ace('0x3a')]=function(_0x5cf5b2){return BPromise[_0x9ace('0x10')]()[_0x9ace('0xc')](cmHopper['rescheduleContact'](_0x5cf5b2,!![],!![]))[_0x9ace('0xe')](loggerCatch(_0x9ace('0x3b')));}; \ No newline at end of file +var _0x4160=['membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','moveContactManagedDialer','catch','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename'];(function(_0x4d96ec,_0x38afec){var _0x510ebe=function(_0x598615){while(--_0x598615){_0x4d96ec['push'](_0x4d96ec['shift']());}};_0x510ebe(++_0x38afec);}(_0x4160,0x170));var _0x0416=function(_0x19f55a,_0x41e450){_0x19f55a=_0x19f55a-0x0;var _0x12271a=_0x4160[_0x19f55a];return _0x12271a;};'use strict';var util=require('util');var BPromise=require(_0x0416('0x0'));var logger=require(_0x0416('0x1'))(_0x0416('0x2'));var _=require(_0x0416('0x3'));var cmHopper=require(_0x0416('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x0416('0x5'));var cmHopperBlack=require(_0x0416('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x0416('0x7'));function loggerCatch(_0x3d3622){return function(_0x13118d){logger[_0x0416('0x8')](_0x3d3622,util[_0x0416('0x9')](_0x13118d,{'showHidden':![],'depth':null}));};}function create(_0x5c5483){return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](cmHopperHistory[_0x0416('0xc')](_0x5c5483))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x960065){return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](agentReportPreview[_0x0416('0xc')](_0x960065))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x10374b){return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](cmHopper[_0x0416('0xd')](_0x10374b,!![]))[_0x0416('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x0416('0xf')]=function(_0x2d279c){return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](cmHopperBlack['checkIsBlackList'](_0x2d279c))[_0x0416('0xe')](loggerCatch(_0x0416('0x10')));};exports[_0x0416('0x11')]=function(_0x3eb858){return BPromise[_0x0416('0xa')]()['then'](cmHopper[_0x0416('0x11')](_0x3eb858))[_0x0416('0xe')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x1d002c,_0x1aa791){create(_0x1d002c)[_0x0416('0xe')](loggerCatch(_0x1aa791));moveContact(_0x1d002c)[_0x0416('0xe')](loggerCatch(_0x1aa791));};exports[_0x0416('0x12')]=function(_0x491241,_0x560091){createAgent(_0x491241)[_0x0416('0xe')](loggerCatch(_0x560091));};exports[_0x0416('0x13')]=function(_0x1e2512,_0x4448ca){create(_0x1e2512)[_0x0416('0xe')](loggerCatch(_0x4448ca));};exports['createCustomerFinal']=function(_0x539606,_0x22e8f3){moveContact(_0x539606)[_0x0416('0xe')](loggerCatch(_0x22e8f3));};exports[_0x0416('0x14')]=function(_0x59601b,_0x3b1cc3,_0x187fe8){if(_0x3b1cc3){_0x59601b[_0x0416('0x15')]=null;}if(_0x187fe8){_0x59601b[_0x0416('0x16')]=![];}return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](cmHopper['rescheduleContact'](_0x59601b))[_0x0416('0xe')](loggerCatch(_0x0416('0x17')));};exports['countReScheduled']=function(_0x3d3631){return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](cmHopper[_0x0416('0x18')](_0x3d3631))[_0x0416('0xe')](loggerCatch(_0x0416('0x19')));};exports[_0x0416('0x1a')]=function(_0x414c19){return BPromise[_0x0416('0xa')]()['then'](cmHopper[_0x0416('0x1a')]({'UserId':null},_0x414c19,0x1))[_0x0416('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x0416('0x1b')]=function(_0x21cd85){return BPromise['resolve']()[_0x0416('0xb')](cmHopper[_0x0416('0x1a')]({'active':![]},_0x21cd85,0x1))[_0x0416('0xe')](loggerCatch(_0x0416('0x1c')));};exports[_0x0416('0x1d')]=function(_0x58906a){var _0x5ab502={};_0x5ab502['type']=_0x58906a['type'];_0x5ab502['uniqueid']=_0x58906a[_0x0416('0x1e')];_0x5ab502[_0x0416('0x1f')]=_0x58906a[_0x0416('0x1f')];_0x5ab502[_0x0416('0x20')]=_0x58906a[_0x0416('0x20')];_0x5ab502[_0x0416('0x21')]=_0x58906a['queue'];_0x5ab502['queuecallerjoinAt']=_0x58906a[_0x0416('0x22')];_0x5ab502[_0x0416('0x23')]=_0x58906a['answertime'];_0x5ab502[_0x0416('0x24')]=0x1;_0x5ab502[_0x0416('0x25')]=_0x58906a[_0x0416('0x26')];_0x5ab502[_0x0416('0x27')]=_0x58906a[_0x0416('0x28')];_0x5ab502[_0x0416('0x29')]=_0x0416('0x2a');_0x5ab502[_0x0416('0x2b')]='xcally-motion-preview';_0x5ab502[_0x0416('0x2c')]=0x0;_0x5ab502['assigned']=0x1;_0x5ab502[_0x0416('0x2d')]=_0x58906a['membername'];_0x5ab502[_0x0416('0x2e')]='COMPLETED';return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](voiceQueueReport[_0x0416('0x2f')](_0x5ab502))[_0x0416('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x402030,_0xd91cfb){return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](cmHopper[_0x0416('0x30')](_0x402030,_0xd91cfb))[_0x0416('0xe')](loggerCatch(_0x0416('0x31')));};exports[_0x0416('0x32')]=function(_0x53c02d){return BPromise[_0x0416('0xa')]()[_0x0416('0xb')](cmHopper[_0x0416('0x14')](_0x53c02d,!![],!![]))[_0x0416('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 9d19792..cac5042 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 _0x41b2=['VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','mandatoryDisposition','not_inuse','reachable','push','createBody','CampaignId','filterKey','idContact','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','error','logger','inspect','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','%s%s','XMD-','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','starttime','responsetime','endtime','state','ringtime','logLookAgent','membername','UserId','statedesc','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','scheduledAt','active','scheduledat','add','minutes','ListId'];(function(_0xe27810,_0x8b3e76){var _0x53dcec=function(_0x4a83c7){while(--_0x4a83c7){_0xe27810['push'](_0xe27810['shift']());}};_0x53dcec(++_0x8b3e76);}(_0x41b2,0xaf));var _0x241b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x241b('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x241b('0x1'))(_0x241b('0x2'));var ipAgi=process[_0x241b('0x3')][_0x241b('0x4')]||'127.0.0.1';function getSeconds(_0xc453ee,_0x2b5826){var _0x8bab9d=moment(_0xc453ee)[_0x241b('0x5')](0x0);var _0x43ef76=moment(_0x2b5826)[_0x241b('0x5')](0x0);return _0x8bab9d[_0x241b('0x6')](_0x43ef76,_0x241b('0x7'));}exports['loggerCatch']=function(_0x183d91){return function(_0x1e134c){logger[_0x241b('0x8')](_0x183d91,util['inspect'](_0x1e134c,{'showHidden':![],'depth':null}));};};exports[_0x241b('0x9')]=function(_0x325828,_0x4197a3){logger['info'](_0x325828,util[_0x241b('0xa')](_0x4197a3,{'showHidden':![],'depth':null}));};exports[_0x241b('0xb')]=function(_0x55413c,_0x37bc33){logger[_0x241b('0x8')](_0x55413c,util['inspect'](_0x37bc33,{'showHidden':![],'depth':null}));};exports[_0x241b('0xc')]=function(_0x2cb6aa){return function(_0x1964a1){logger[_0x241b('0xd')](_0x2cb6aa,util['inspect'](_0x1964a1,{'showHidden':![],'depth':null}));};};exports[_0x241b('0xe')]=function(_0x5765ca,_0x4ad937,_0x290c00){return{'message':_0x5765ca,'unlock':_0x4ad937,'active':_0x290c00};};exports[_0x241b('0xf')]=function(_0x5f3857,_0xd67ee2,_0x4fb124){if(!_[_0x241b('0x10')](_0x4fb124)&&_0x241b('0x11')===typeof _0x4fb124&&!_['isEmpty'](_0x4fb124)){if(!_['isUndefined'](_0xd67ee2)&&_0x241b('0x11')===typeof _0xd67ee2&&!_[_0x241b('0x12')](_0xd67ee2)){return util[_0x241b('0x13')](_0x241b('0x14'),_0xd67ee2,_0x4fb124);}return util[_0x241b('0x13')](_0x241b('0x14'),_0x4fb124,_0x4fb124);}if(!_[_0x241b('0x10')](_0x5f3857)&&_0x241b('0x11')===typeof _0x5f3857&&!_[_0x241b('0x12')](_0x5f3857)){return _0x5f3857;}return _0x241b('0x15');};exports[_0x241b('0x16')]=function(_0x560c51){if(_['isNil'](_0x560c51)){return![];}return _0x560c51;};exports[_0x241b('0x17')]=function(_0x9ebfd5,_0x237ae4,_0x18f1f5,_0x1827e9,_0x55a9a7,_0x3d0bb2){var _0x1dfcff={'XMD-QUEUE':_0x237ae4['Queue']?_0x237ae4[_0x241b('0x18')]['name']:'','XMD-CALLERID':_0x1827e9,'XMD-CALLERID-PREVIEW':_0x3d0bb2?util[_0x241b('0x13')](_0x241b('0x14'),_0x3d0bb2[_0x241b('0x19')],_0x3d0bb2[_0x241b('0x1a')]):_0x1827e9,'XMD-DIALID':_0x55a9a7,'XMD-CONTACTID':_0x237ae4[_0x241b('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1827e9,'XMD-VOICEQUEUEID':_0x237ae4['VoiceQueueId'],'XMD-DIALCHANNEL':_0x18f1f5,'XMD-DIALTIMEOUT':_0x9ebfd5['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x241b('0x1c'),_0x9ebfd5[_0x241b('0x1d')]?'g':'',_[_0x241b('0x12')](_0x9ebfd5[_0x241b('0x1e')])?'':_0x241b('0x1f')),'XMD-DIALURL':_0x9ebfd5[_0x241b('0x20')]||'','XMD-AGI':_0x9ebfd5['dialQueueProject']?util[_0x241b('0x13')](_0x241b('0x21'),ipAgi,_0x9ebfd5[_0x241b('0x22')]):_0x241b('0x23'),'XMD-AGIAFTER':_0x9ebfd5[_0x241b('0x1d')]?util[_0x241b('0x13')](_0x241b('0x21'),ipAgi,_0x9ebfd5[_0x241b('0x1d')]):_0x241b('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x3d0bb2?_0x3d0bb2[_0x241b('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x3d0bb2?_0x3d0bb2[_0x241b('0x25')]:'','XMD-DESTINATION':_0x241b('0x26')};if(!_['isEmpty'](_0x9ebfd5[_0x241b('0x1e')])){_0x1dfcff[util[_0x241b('0x13')]('%s',_0x241b('0x27'))]=_0x9ebfd5[_0x241b('0x1e')];_0x1dfcff[util[_0x241b('0x13')]('%s',_0x241b('0x28'))]=_0x55a9a7;}if(_0x237ae4&&_0x237ae4['Contact']){for(var _0x1b5bf9 in _0x237ae4['Contact']){if(_0x237ae4[_0x241b('0x29')][_0x241b('0x2a')](_0x1b5bf9)){if(!_[_0x241b('0x2b')](_0x237ae4[_0x241b('0x29')][_0x1b5bf9])&&_0x1b5bf9!=='id'&&_0x1b5bf9!==_0x241b('0x2c')&&_0x1b5bf9!==_0x241b('0x2d')&&_0x1b5bf9!=='updatedAt'){_0x1dfcff[util['format'](_0x241b('0x2e'),_0x241b('0x2f'),_['toUpper'](_0x1b5bf9))]=_0x237ae4[_0x241b('0x29')][_0x1b5bf9];}}}}return _0x1dfcff;};exports[_0x241b('0x30')]=function(_0x4392b4){var _0x42802d={};for(var _0x33e1f3 in _0x4392b4){if(_0x4392b4[_0x241b('0x2a')](_0x33e1f3)){_0x42802d[util[_0x241b('0x13')]('%s',_[_0x241b('0x31')](_0x33e1f3))]=_0x4392b4[_0x33e1f3];}}return{'variables':_0x42802d};};exports['updateOriginated']=function(_0x452f92,_0x1b2071){if(!_[_0x241b('0x2b')](_0x452f92)){if(_0x452f92[_0x241b('0x2a')](_0x241b('0x32'))){if(_0x452f92[_0x241b('0x32')]>0x0){_0x452f92['originated']-=0x1;}else{logger[_0x241b('0x8')](_0x241b('0x33'),_0x1b2071);}}}else{logger[_0x241b('0x8')](_0x241b('0x34'),_0x1b2071);}};exports[_0x241b('0x35')]=function(_0x3b0545){var _0x57b912=moment()[_0x241b('0x13')](_0x241b('0x36'));_0x3b0545['state']=0xd;_0x3b0545['statedesc']='Blacklist';_0x3b0545[_0x241b('0x37')]=_0x57b912;_0x3b0545[_0x241b('0x38')]=_0x57b912;_0x3b0545[_0x241b('0x39')]=_0x57b912;};exports['logAgent']=function(_0x58b2d4,_0x56db95,_0x5d297b){var _0x2b98e8=moment()[_0x241b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x58b2d4[_0x241b('0x3a')]=_0x56db95;_0x58b2d4['statedesc']=_0x5d297b;_0x58b2d4[_0x241b('0x38')]=_0x2b98e8;_0x58b2d4[_0x241b('0x3b')]=getSeconds(_0x58b2d4[_0x241b('0x38')],_0x58b2d4[_0x241b('0x37')]);};exports[_0x241b('0x3c')]=function(_0x44f400,_0x441737,_0x5c4308){_0x44f400[_0x241b('0x3d')]=_0x441737;_0x44f400[_0x241b('0x3e')]=_0x5c4308;};exports['logCustomer']=function(_0x2c3647,_0x33d019,_0x5edd67){var _0x27fc85=moment()[_0x241b('0x13')](_0x241b('0x36'));_0x2c3647[_0x241b('0x3a')]=_0x33d019;_0x2c3647[_0x241b('0x3f')]=_0x5edd67;_0x2c3647[_0x241b('0x38')]=_0x2c3647['responsetime']?_0x2c3647['responsetime']:_0x27fc85;_0x2c3647[_0x241b('0x39')]=_0x2c3647['endtime']?_0x2c3647[_0x241b('0x39')]:_0x27fc85;_0x2c3647[_0x241b('0x3b')]=getSeconds(_0x2c3647[_0x241b('0x38')]||0x0,_0x2c3647[_0x241b('0x37')]||0x0);_0x2c3647[_0x241b('0x40')]=_0x2c3647[_0x241b('0x41')]?getSeconds(_0x2c3647['endtime'],_0x2c3647[_0x241b('0x41')]):0x0;};exports[_0x241b('0x42')]=function(_0x151b9c){return _0x151b9c===_0x241b('0x43');};exports[_0x241b('0x44')]=function(_0x1dfd8b,_0x3b5207,_0x3bcb28,_0x529e9b,_0x5d250e){var _0x27dcd1=_0x529e9b?_0x241b('0x45'):_0x1dfd8b[_0x241b('0x19')];_0x27dcd1=_0x5d250e?_0x241b('0x46'):_0x27dcd1;return{'actionid':_0x1dfd8b[_0x241b('0x47')],'action':_0x241b('0x48'),'channel':_0x1dfd8b[_0x241b('0x49')],'callerid':util[_0x241b('0x13')](_0x241b('0x14'),_0x27dcd1,_0x1dfd8b[_0x241b('0x1a')]),'Exten':_0x241b('0x26'),'Context':_0x241b('0x4a'),'Priority':'1','variable':_0x3bcb28,'timeout':(_0x3b5207[_0x241b('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1dfd8b['uniqueid']};};exports['totalGlobal']=function(_0x1d5b02){return _0x1d5b02[_0x241b('0x4c')]+_0x1d5b02[_0x241b('0x4d')]+_0x1d5b02[_0x241b('0x4e')]+_0x1d5b02['countagentrejectretry']+_0x1d5b02[_0x241b('0x4f')];};exports[_0x241b('0x50')]=function(_0x556cd6){var _0x30fd24=_['clone'](_0x556cd6);_0x30fd24[_0x241b('0x3a')]=0xf;_0x30fd24['statedesc']='Global';return _0x30fd24;};exports[_0x241b('0x51')]=function(_0xdf69c4,_0xb8c6be,_0xcf2e57){var _0x7b14fa={};_0x7b14fa[_0xb8c6be]=_0xdf69c4[_0xb8c6be];_0x7b14fa[_0x241b('0x52')]=![];_0x7b14fa[_0x241b('0x53')]=moment()[_0x241b('0x54')](_0xcf2e57,_0x241b('0x55'))[_0x241b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x7b14fa[_0x241b('0x1b')]=_0xdf69c4['ContactId'];_0x7b14fa[_0x241b('0x56')]=_0xdf69c4[_0x241b('0x56')];_0x7b14fa[_0x241b('0x57')]=_0xdf69c4[_0x241b('0x57')]||undefined;return _0x7b14fa;};exports[_0x241b('0x58')]=function(_0x356a20,_0x43a0a1){if(!_['isNil'](_0x356a20)){if(_0x356a20['pTalking']>0x0){_0x356a20[_0x241b('0x59')]-=0x1;}else{logger[_0x241b('0x8')](_0x43a0a1,_0x241b('0x5a'));}}else{logger[_0x241b('0x8')](_0x43a0a1,_0x241b('0x5b'));}};exports['IsNotLoggedIn']=function(_0xdadd41){if(_0xdadd41<=0x0){return!![];}return![];};exports['buildObj']=function(_0x148572,_0x210807,_0x1fe5f5){_0x148572[_0x241b('0x5c')]=_0x210807;_0x148572['name']=_0x148572[_0x241b('0x5d')];_0x148572[_0x241b('0x5e')]=_0x148572[_0x241b('0x49')];if(_0x1fe5f5){_0x148572[_0x241b('0x5f')]=_0x1fe5f5['mandatoryDisposition'];}return _0x148572;};exports['buildAcw']=function(_0x1c8532){var _0x1103ec={};_0x1103ec['queue']=_0x1c8532[_0x241b('0x5d')];_0x1103ec[_0x241b('0x5e')]=_0x1c8532[_0x241b('0x49')];_0x1103ec[_0x241b('0x47')]=_0x1c8532[_0x241b('0x47')];return _0x1103ec;};exports['agentReadyId']=function(_0x4c2a04){var _0x1fd8f0=[];for(var _0x5a3f0f in _0x4c2a04){if(_0x4c2a04['hasOwnProperty'](_0x5a3f0f)){if(!_[_0x241b('0x2b')](_0x4c2a04[_0x5a3f0f])&&_0x4c2a04[_0x5a3f0f][_0x241b('0x3a')]===_0x241b('0x60')&&_0x4c2a04[_0x5a3f0f]['status']===_0x241b('0x61')){_0x1fd8f0[_0x241b('0x62')](_0x4c2a04[_0x5a3f0f]['id']);}}}return _0x1fd8f0;};exports['getDiff']=function(_0x8cf906){var _0x50abcb=moment()[_0x241b('0x5')](0x0);var _0x1e7330=moment(_0x8cf906)[_0x241b('0x5')](0x0);return _0x50abcb[_0x241b('0x6')](_0x1e7330,_0x241b('0x7'));};exports[_0x241b('0x63')]=function(_0x1be94e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1be94e[_0x241b('0x1b')],'ListId':_0x1be94e['ListId'],'VoiceQueueId':_0x1be94e['VoiceQueueId']||undefined,'CampaignId':_0x1be94e[_0x241b('0x64')]||undefined};};exports[_0x241b('0x65')]=function(_0x5788dd){if(_0x5788dd===_0x241b('0x47')||_0x5788dd===_0x241b('0x66')||_0x5788dd===_0x241b('0x5d')||_0x5788dd==='type'||_0x5788dd==='campaigntype'||_0x5788dd===_0x241b('0x67')||_0x5788dd===_0x241b('0x3d')||_0x5788dd===_0x241b('0x49')||_0x5788dd===_0x241b('0x19')||_0x5788dd===_0x241b('0x52')||_0x5788dd===_0x241b('0x1a')||_0x5788dd==='scheduledat'||_0x5788dd==='countbusyretry'||_0x5788dd===_0x241b('0x4d')||_0x5788dd===_0x241b('0x4e')||_0x5788dd===_0x241b('0x68')||_0x5788dd===_0x241b('0x69')||_0x5788dd===_0x241b('0x6a')||_0x5788dd===_0x241b('0x6b')||_0x5788dd===_0x241b('0x6c')||_0x5788dd===_0x241b('0x1b')||_0x5788dd===_0x241b('0x56')||_0x5788dd==='UserId'||_0x5788dd===_0x241b('0x57')||_0x5788dd===_0x241b('0x6d')||_0x5788dd==='xmd-voicequeueid'||_0x5788dd===_0x241b('0x6e')||_0x5788dd==='xmd-phone'||_0x5788dd==='xmd-listid'||_0x5788dd===_0x241b('0x6f')||_0x5788dd==='xmd-dialtimeout'||_0x5788dd===_0x241b('0x70')||_0x5788dd==='xmd-dialid'||_0x5788dd===_0x241b('0x71')||_0x5788dd==='xmd-contactid'||_0x5788dd===_0x241b('0x72')||_0x5788dd==='xmd-callerid'||_0x5788dd===_0x241b('0x73')||_0x5788dd==='xmd-agi'||_0x5788dd==='rtpaudioqos'||_0x5788dd===_0x241b('0x74')||_0x5788dd===_0x241b('0x75')||_0x5788dd===_0x241b('0x76')||_0x5788dd==='rtpaudioqosloss'||_0x5788dd===_0x241b('0x77')||_0x5788dd===_0x241b('0x78')||_0x5788dd==='rtpaudioqosrttbridged'||_0x5788dd==='rtpaudioqos'||_0x5788dd===_0x241b('0x74')||_0x5788dd==='rtpaudioqosjitter'||_0x5788dd===_0x241b('0x76')||_0x5788dd===_0x241b('0x79')||_0x5788dd===_0x241b('0x77')||_0x5788dd===_0x241b('0x78')||_0x5788dd==='rtpaudioqosrttbridged'||_0x5788dd===_0x241b('0x7a')||_0x5788dd===_0x241b('0x7b')||_0x5788dd==='state'||_0x5788dd===_0x241b('0x3f')){return![];}return!![];};exports[_0x241b('0x7c')]=function(_0x397ce6,_0x21b839){var _0x473ece,_0x3da2a5,_0x4c9cf6;if(_0x21b839<=0x0){_0x21b839=0x1;}_0x473ece=new RegExp(_0x241b('0x7d')+_0x21b839+'}$');_0x3da2a5=Math['pow'](0xa,_0x21b839-0x1);_0x4c9cf6=Math[_0x241b('0x7e')](0xa,_0x21b839)-0x1;return util[_0x241b('0x13')]('%s',_[_0x241b('0x7f')](_0x397ce6,_0x473ece,_[_0x241b('0x80')](_0x3da2a5,_0x4c9cf6)));};exports[_0x241b('0x81')]=function(_0x48bf4d){var _0x117f0d=_0x48bf4d['match'](/"(.*?)"/);return _0x117f0d?_0x117f0d[0x1]:_0x48bf4d;};exports[_0x241b('0x82')]=function(_0x175687){var _0x22ca5a=_0x175687['match'](/<(.*?)>/);return _0x22ca5a?_0x22ca5a[0x1]:_0x175687;}; \ No newline at end of file +var _0xcd48=['Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','info','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','endtime','logAgent','statedesc','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone'];(function(_0x3bbb68,_0x2e2d15){var _0x16305e=function(_0x2b365b){while(--_0x2b365b){_0x3bbb68['push'](_0x3bbb68['shift']());}};_0x16305e(++_0x2e2d15);}(_0xcd48,0x161));var _0x8cd4=function(_0x3c97a8,_0xc1eb41){_0x3c97a8=_0x3c97a8-0x0;var _0x23780e=_0xcd48[_0x3c97a8];return _0x23780e;};'use strict';var util=require(_0x8cd4('0x0'));var _=require(_0x8cd4('0x1'));var moment=require('moment');var logger=require(_0x8cd4('0x2'))(_0x8cd4('0x3'));var ipAgi=process[_0x8cd4('0x4')][_0x8cd4('0x5')]||_0x8cd4('0x6');function getSeconds(_0x3c343a,_0x39916f){var _0x44c14a=moment(_0x3c343a)['milliseconds'](0x0);var _0x5b1a2f=moment(_0x39916f)[_0x8cd4('0x7')](0x0);return _0x44c14a[_0x8cd4('0x8')](_0x5b1a2f,_0x8cd4('0x9'));}exports[_0x8cd4('0xa')]=function(_0x5d2573){return function(_0x20e556){logger[_0x8cd4('0xb')](_0x5d2573,util['inspect'](_0x20e556,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x3225ea,_0x5409cd){logger[_0x8cd4('0xc')](_0x3225ea,util[_0x8cd4('0xd')](_0x5409cd,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1fc3ba,_0x2e9984){logger['error'](_0x1fc3ba,util[_0x8cd4('0xd')](_0x2e9984,{'showHidden':![],'depth':null}));};exports[_0x8cd4('0xe')]=function(_0x12d000){return function(_0x264b8b){logger['info'](_0x12d000,util[_0x8cd4('0xd')](_0x264b8b,{'showHidden':![],'depth':null}));};};exports[_0x8cd4('0xf')]=function(_0x5ed963,_0x21fc14,_0x3c8868){return{'message':_0x5ed963,'unlock':_0x21fc14,'active':_0x3c8868};};exports[_0x8cd4('0x10')]=function(_0x110f37,_0x5bbbc9,_0x1de859){if(!_[_0x8cd4('0x11')](_0x1de859)&&_0x8cd4('0x12')===typeof _0x1de859&&!_['isEmpty'](_0x1de859)){if(!_['isUndefined'](_0x5bbbc9)&&_0x8cd4('0x12')===typeof _0x5bbbc9&&!_[_0x8cd4('0x13')](_0x5bbbc9)){return util['format'](_0x8cd4('0x14'),_0x5bbbc9,_0x1de859);}return util[_0x8cd4('0x15')]('\x22%s\x22\x20<%s>',_0x1de859,_0x1de859);}if(!_[_0x8cd4('0x11')](_0x110f37)&&_0x8cd4('0x12')===typeof _0x110f37&&!_[_0x8cd4('0x13')](_0x110f37)){return _0x110f37;}return'\x22\x22\x20<>';};exports['isActive']=function(_0xcdd000){if(_[_0x8cd4('0x16')](_0xcdd000)){return![];}return _0xcdd000;};exports[_0x8cd4('0x17')]=function(_0x3426f2,_0x2b0a83,_0x58022f,_0x435d85,_0x36357d,_0x5ec44e){var _0x1bcbf3={'XMD-QUEUE':_0x2b0a83[_0x8cd4('0x18')]?_0x2b0a83[_0x8cd4('0x18')][_0x8cd4('0x19')]:'','XMD-CALLERID':_0x435d85,'XMD-CALLERID-PREVIEW':_0x5ec44e?util[_0x8cd4('0x15')](_0x8cd4('0x14'),_0x5ec44e['calleridname'],_0x5ec44e[_0x8cd4('0x1a')]):_0x435d85,'XMD-DIALID':_0x36357d,'XMD-CONTACTID':_0x2b0a83[_0x8cd4('0x1b')],'XMD-CDRTYPE':_0x8cd4('0x1c'),'CALLERID(all)':_0x435d85,'XMD-VOICEQUEUEID':_0x2b0a83[_0x8cd4('0x1d')],'XMD-DIALCHANNEL':_0x58022f,'XMD-DIALTIMEOUT':_0x3426f2[_0x8cd4('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x8cd4('0x15')](_0x8cd4('0x1f'),_0x3426f2[_0x8cd4('0x20')]?'g':'',_['isEmpty'](_0x3426f2[_0x8cd4('0x21')])?'':_0x8cd4('0x22')),'XMD-DIALURL':_0x3426f2[_0x8cd4('0x23')]||'','XMD-AGI':_0x3426f2['dialQueueProject']?util[_0x8cd4('0x15')](_0x8cd4('0x24'),ipAgi,_0x3426f2[_0x8cd4('0x25')]):_0x8cd4('0x26'),'XMD-AGIAFTER':_0x3426f2[_0x8cd4('0x20')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3426f2[_0x8cd4('0x20')]):_0x8cd4('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x5ec44e?_0x5ec44e[_0x8cd4('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x5ec44e?_0x5ec44e[_0x8cd4('0x28')]:'','XMD-DESTINATION':_0x8cd4('0x29')};if(!_[_0x8cd4('0x13')](_0x3426f2['monitor_format'])){_0x1bcbf3[util[_0x8cd4('0x15')]('%s',_0x8cd4('0x2a'))]=_0x3426f2['monitor_format'];_0x1bcbf3[util[_0x8cd4('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x36357d;}if(_0x2b0a83&&_0x2b0a83['Contact']){for(var _0x35af27 in _0x2b0a83[_0x8cd4('0x2b')]){if(_0x2b0a83[_0x8cd4('0x2b')][_0x8cd4('0x2c')](_0x35af27)){if(!_['isNil'](_0x2b0a83[_0x8cd4('0x2b')][_0x35af27])&&_0x35af27!=='id'&&_0x35af27!==_0x8cd4('0x2d')&&_0x35af27!==_0x8cd4('0x2e')&&_0x35af27!==_0x8cd4('0x2f')){_0x1bcbf3[util[_0x8cd4('0x15')](_0x8cd4('0x30'),'XMD-',_['toUpper'](_0x35af27))]=_0x2b0a83['Contact'][_0x35af27];}}}}return _0x1bcbf3;};exports[_0x8cd4('0x31')]=function(_0x85c2c){var _0x5a8512={};for(var _0x2f7adc in _0x85c2c){if(_0x85c2c[_0x8cd4('0x2c')](_0x2f7adc)){_0x5a8512[util['format']('%s',_[_0x8cd4('0x32')](_0x2f7adc))]=_0x85c2c[_0x2f7adc];}}return{'variables':_0x5a8512};};exports[_0x8cd4('0x33')]=function(_0x1a600d,_0x312c7d){if(!_[_0x8cd4('0x16')](_0x1a600d)){if(_0x1a600d[_0x8cd4('0x2c')](_0x8cd4('0x34'))){if(_0x1a600d[_0x8cd4('0x34')]>0x0){_0x1a600d[_0x8cd4('0x34')]-=0x1;}else{logger['error'](_0x8cd4('0x35'),_0x312c7d);}}}else{logger[_0x8cd4('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x312c7d);}};exports[_0x8cd4('0x36')]=function(_0x36c059){var _0x4da85a=moment()[_0x8cd4('0x15')](_0x8cd4('0x37'));_0x36c059[_0x8cd4('0x38')]=0xd;_0x36c059['statedesc']='Blacklist';_0x36c059[_0x8cd4('0x39')]=_0x4da85a;_0x36c059['responsetime']=_0x4da85a;_0x36c059[_0x8cd4('0x3a')]=_0x4da85a;};exports[_0x8cd4('0x3b')]=function(_0x118fd2,_0x457268,_0x4505c7){var _0x48d966=moment()[_0x8cd4('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x118fd2[_0x8cd4('0x38')]=_0x457268;_0x118fd2[_0x8cd4('0x3c')]=_0x4505c7;_0x118fd2[_0x8cd4('0x3d')]=_0x48d966;_0x118fd2[_0x8cd4('0x3e')]=getSeconds(_0x118fd2[_0x8cd4('0x3d')],_0x118fd2['starttime']);};exports[_0x8cd4('0x3f')]=function(_0x76d340,_0x59b09d,_0xb007a2){_0x76d340[_0x8cd4('0x40')]=_0x59b09d;_0x76d340[_0x8cd4('0x41')]=_0xb007a2;};exports[_0x8cd4('0x42')]=function(_0x9bbcdf,_0x390cc3,_0x8f8da7){var _0x4246bb=moment()[_0x8cd4('0x15')](_0x8cd4('0x37'));_0x9bbcdf[_0x8cd4('0x38')]=_0x390cc3;_0x9bbcdf[_0x8cd4('0x3c')]=_0x8f8da7;_0x9bbcdf['responsetime']=_0x9bbcdf[_0x8cd4('0x3d')]?_0x9bbcdf[_0x8cd4('0x3d')]:_0x4246bb;_0x9bbcdf[_0x8cd4('0x3a')]=_0x9bbcdf[_0x8cd4('0x3a')]?_0x9bbcdf[_0x8cd4('0x3a')]:_0x4246bb;_0x9bbcdf[_0x8cd4('0x3e')]=getSeconds(_0x9bbcdf[_0x8cd4('0x3d')]||0x0,_0x9bbcdf[_0x8cd4('0x39')]||0x0);_0x9bbcdf[_0x8cd4('0x43')]=_0x9bbcdf[_0x8cd4('0x44')]?getSeconds(_0x9bbcdf[_0x8cd4('0x3a')],_0x9bbcdf[_0x8cd4('0x44')]):0x0;};exports[_0x8cd4('0x45')]=function(_0x3cb5fb){return _0x3cb5fb===_0x8cd4('0x46');};exports[_0x8cd4('0x47')]=function(_0x5cf1d8,_0x381ecb,_0xcb3de1,_0x3c3719,_0x571264){var _0x2d6cd4=_0x3c3719?_0x8cd4('0x48'):_0x5cf1d8['calleridname'];_0x2d6cd4=_0x571264?_0x8cd4('0x49'):_0x2d6cd4;return{'actionid':_0x5cf1d8[_0x8cd4('0x4a')],'action':_0x8cd4('0x4b'),'channel':_0x5cf1d8[_0x8cd4('0x4c')],'callerid':util[_0x8cd4('0x15')]('\x22%s\x22\x20<%s>',_0x2d6cd4,_0x5cf1d8['calleridnum']),'Exten':_0x8cd4('0x29'),'Context':_0x8cd4('0x4d'),'Priority':'1','variable':_0xcb3de1,'timeout':(_0x381ecb[_0x8cd4('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5cf1d8[_0x8cd4('0x4a')]};};exports[_0x8cd4('0x4f')]=function(_0x15781e){return _0x15781e[_0x8cd4('0x50')]+_0x15781e['countcongestionretry']+_0x15781e['countnoanswerretry']+_0x15781e[_0x8cd4('0x51')]+_0x15781e[_0x8cd4('0x52')];};exports[_0x8cd4('0x53')]=function(_0x590175){var _0x243d4e=_[_0x8cd4('0x54')](_0x590175);_0x243d4e[_0x8cd4('0x38')]=0xf;_0x243d4e['statedesc']=_0x8cd4('0x55');return _0x243d4e;};exports['scheduledAt']=function(_0x2e50f4,_0x485b8b,_0x1d2950){var _0x4a7548={};_0x4a7548[_0x485b8b]=_0x2e50f4[_0x485b8b];_0x4a7548[_0x8cd4('0x56')]=![];_0x4a7548[_0x8cd4('0x57')]=moment()[_0x8cd4('0x58')](_0x1d2950,_0x8cd4('0x59'))[_0x8cd4('0x15')](_0x8cd4('0x37'));_0x4a7548[_0x8cd4('0x1b')]=_0x2e50f4['ContactId'];_0x4a7548[_0x8cd4('0x5a')]=_0x2e50f4[_0x8cd4('0x5a')];_0x4a7548[_0x8cd4('0x1d')]=_0x2e50f4[_0x8cd4('0x1d')]||undefined;return _0x4a7548;};exports[_0x8cd4('0x5b')]=function(_0x10c9a8,_0x915364){if(!_[_0x8cd4('0x16')](_0x10c9a8)){if(_0x10c9a8[_0x8cd4('0x5c')]>0x0){_0x10c9a8[_0x8cd4('0x5c')]-=0x1;}else{logger[_0x8cd4('0xb')](_0x915364,_0x8cd4('0x5d'));}}else{logger['error'](_0x915364,_0x8cd4('0x5e'));}};exports[_0x8cd4('0x5f')]=function(_0x33b112){if(_0x33b112<=0x0){return!![];}return![];};exports[_0x8cd4('0x60')]=function(_0x14d2e5,_0x4ae3f8,_0x3eed85){_0x14d2e5['lastevent']=_0x4ae3f8;_0x14d2e5['name']=_0x14d2e5[_0x8cd4('0x61')];_0x14d2e5[_0x8cd4('0x62')]=_0x14d2e5[_0x8cd4('0x4c')];if(_0x3eed85){_0x14d2e5['mandatoryDisposition']=_0x3eed85['mandatoryDisposition'];}return _0x14d2e5;};exports[_0x8cd4('0x63')]=function(_0x4d0fe7){var _0xec6ba7={};_0xec6ba7[_0x8cd4('0x61')]=_0x4d0fe7[_0x8cd4('0x61')];_0xec6ba7[_0x8cd4('0x62')]=_0x4d0fe7['channelAgent'];_0xec6ba7[_0x8cd4('0x4a')]=_0x4d0fe7[_0x8cd4('0x4a')];return _0xec6ba7;};exports[_0x8cd4('0x64')]=function(_0x345b06){var _0x341d60=[];for(var _0x371ded in _0x345b06){if(_0x345b06[_0x8cd4('0x2c')](_0x371ded)){if(!_[_0x8cd4('0x16')](_0x345b06[_0x371ded])&&_0x345b06[_0x371ded][_0x8cd4('0x38')]===_0x8cd4('0x65')&&_0x345b06[_0x371ded][_0x8cd4('0x66')]===_0x8cd4('0x67')){_0x341d60[_0x8cd4('0x68')](_0x345b06[_0x371ded]['id']);}}}return _0x341d60;};exports[_0x8cd4('0x69')]=function(_0x175387){var _0x4860c2=moment()[_0x8cd4('0x7')](0x0);var _0x491272=moment(_0x175387)[_0x8cd4('0x7')](0x0);return _0x4860c2[_0x8cd4('0x8')](_0x491272,_0x8cd4('0x9'));};exports[_0x8cd4('0x6a')]=function(_0x1202da){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1202da[_0x8cd4('0x1b')],'ListId':_0x1202da[_0x8cd4('0x5a')],'VoiceQueueId':_0x1202da['VoiceQueueId']||undefined,'CampaignId':_0x1202da[_0x8cd4('0x6b')]||undefined};};exports['filterKey']=function(_0x3b2790){if(_0x3b2790==='uniqueid'||_0x3b2790===_0x8cd4('0x6c')||_0x3b2790==='queue'||_0x3b2790===_0x8cd4('0x6d')||_0x3b2790===_0x8cd4('0x6e')||_0x3b2790===_0x8cd4('0x6f')||_0x3b2790===_0x8cd4('0x40')||_0x3b2790===_0x8cd4('0x4c')||_0x3b2790==='calleridname'||_0x3b2790===_0x8cd4('0x56')||_0x3b2790===_0x8cd4('0x1a')||_0x3b2790===_0x8cd4('0x57')||_0x3b2790===_0x8cd4('0x50')||_0x3b2790==='countcongestionretry'||_0x3b2790==='countnoanswerretry'||_0x3b2790==='countglobal'||_0x3b2790===_0x8cd4('0x70')||_0x3b2790===_0x8cd4('0x71')||_0x3b2790===_0x8cd4('0x72')||_0x3b2790===_0x8cd4('0x73')||_0x3b2790==='ContactId'||_0x3b2790===_0x8cd4('0x5a')||_0x3b2790===_0x8cd4('0x41')||_0x3b2790===_0x8cd4('0x1d')||_0x3b2790==='sipcallid'||_0x3b2790===_0x8cd4('0x74')||_0x3b2790===_0x8cd4('0x75')||_0x3b2790===_0x8cd4('0x76')||_0x3b2790==='xmd-listid'||_0x3b2790===_0x8cd4('0x77')||_0x3b2790===_0x8cd4('0x78')||_0x3b2790===_0x8cd4('0x79')||_0x3b2790===_0x8cd4('0x7a')||_0x3b2790===_0x8cd4('0x7b')||_0x3b2790==='xmd-contactid'||_0x3b2790===_0x8cd4('0x7c')||_0x3b2790===_0x8cd4('0x7d')||_0x3b2790===_0x8cd4('0x7e')||_0x3b2790===_0x8cd4('0x7f')||_0x3b2790===_0x8cd4('0x80')||_0x3b2790===_0x8cd4('0x81')||_0x3b2790===_0x8cd4('0x82')||_0x3b2790===_0x8cd4('0x83')||_0x3b2790===_0x8cd4('0x84')||_0x3b2790===_0x8cd4('0x85')||_0x3b2790===_0x8cd4('0x86')||_0x3b2790==='rtpaudioqosrttbridged'||_0x3b2790===_0x8cd4('0x80')||_0x3b2790===_0x8cd4('0x81')||_0x3b2790===_0x8cd4('0x82')||_0x3b2790===_0x8cd4('0x83')||_0x3b2790==='rtpaudioqosloss'||_0x3b2790===_0x8cd4('0x85')||_0x3b2790===_0x8cd4('0x86')||_0x3b2790===_0x8cd4('0x87')||_0x3b2790===_0x8cd4('0x88')||_0x3b2790===_0x8cd4('0x89')||_0x3b2790===_0x8cd4('0x38')||_0x3b2790===_0x8cd4('0x3c')){return![];}return!![];};exports[_0x8cd4('0x8a')]=function(_0x4b8a1f,_0x3d5776){var _0x62ebe3,_0x537784,_0x816321;if(_0x3d5776<=0x0){_0x3d5776=0x1;}_0x62ebe3=new RegExp(_0x8cd4('0x8b')+_0x3d5776+'}$');_0x537784=Math[_0x8cd4('0x8c')](0xa,_0x3d5776-0x1);_0x816321=Math['pow'](0xa,_0x3d5776)-0x1;return util['format']('%s',_[_0x8cd4('0x8d')](_0x4b8a1f,_0x62ebe3,_[_0x8cd4('0x8e')](_0x537784,_0x816321)));};exports[_0x8cd4('0x8f')]=function(_0x28282a){var _0x44ce87=_0x28282a[_0x8cd4('0x90')](/"(.*?)"/);return _0x44ce87?_0x44ce87[0x1]:_0x28282a;};exports[_0x8cd4('0x91')]=function(_0x25af4c){var _0x3176fe=_0x25af4c[_0x8cd4('0x90')](/<(.*?)>/);return _0x3176fe?_0x3176fe[0x1]:_0x25af4c;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index fad9d8f..a05ce20 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 _0xb227=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb227,0x1ef));var _0x7b22=function(_0x22d7fc,_0xdd3faa){_0x22d7fc=_0x22d7fc-0x0;var _0x50c16e=_0xb227[_0x22d7fc];return _0x50c16e;};'use strict';exports[_0x7b22('0x0')]={'queue':{'type':_0x7b22('0x1'),'required':!![]},'interface':{'type':_0x7b22('0x1'),'required':!![]},'membername':{'type':_0x7b22('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x7b22('0x2'),'required':![]}};exports[_0x7b22('0x3')]={'queue':{'type':_0x7b22('0x1'),'required':!![]},'interface':{'type':_0x7b22('0x1'),'required':!![]}};exports[_0x7b22('0x4')]={'interface':{'type':_0x7b22('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x7b22('0x1'),'required':![]}};exports[_0x7b22('0x5')]={'module':{'type':_0x7b22('0x1'),'required':![]}};exports[_0x7b22('0x6')]={'uniqueid':{'type':_0x7b22('0x1'),'required':!![]}};exports[_0x7b22('0x7')]={'uniqueid':{'type':_0x7b22('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x7b22('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x7b22('0x8')]={'uniqueid':{'type':_0x7b22('0x1'),'required':!![]}};exports[_0x7b22('0x9')]={'uniqueid':{'type':_0x7b22('0x1'),'required':!![]},'exten':{'type':_0x7b22('0x1'),'required':!![]},'context':{'type':_0x7b22('0x1')}}; \ No newline at end of file +var _0xb3ac=['voicequeuechannelhangup','voicequeuechannelredirect','string','boolean','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb3ac,0xb2));var _0xcb3a=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xb3ac[_0x36ed3c];return _0x52a2e0;};'use strict';exports['queueadd']={'queue':{'type':_0xcb3a('0x0'),'required':!![]},'interface':{'type':_0xcb3a('0x0'),'required':!![]},'membername':{'type':_0xcb3a('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xcb3a('0x1'),'required':![]}};exports['queueremove']={'queue':{'type':_0xcb3a('0x0'),'required':!![]},'interface':{'type':_0xcb3a('0x0'),'required':!![]}};exports[_0xcb3a('0x2')]={'interface':{'type':_0xcb3a('0x0'),'required':!![]},'paused':{'type':_0xcb3a('0x1')},'reason':{'type':'string','required':![]}};exports[_0xcb3a('0x3')]={'module':{'type':'string','required':![]}};exports[_0xcb3a('0x4')]={'uniqueid':{'type':_0xcb3a('0x0'),'required':!![]}};exports[_0xcb3a('0x5')]={'uniqueid':{'type':_0xcb3a('0x0'),'required':!![]},'filename':{'type':_0xcb3a('0x0')},'format':{'type':_0xcb3a('0x0')},'mixmonitorid':{'type':_0xcb3a('0x0')}};exports[_0xcb3a('0x6')]={'uniqueid':{'type':_0xcb3a('0x0'),'required':!![]}};exports[_0xcb3a('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xcb3a('0x0'),'required':!![]},'context':{'type':_0xcb3a('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1b18ba0..652e07d 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 _0xd171=['initFaxAccounts','faxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','initTelephones','isUndefined','initTrunks','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0xd171,0xe2));var _0x1d17=function(_0x5c84a6,_0x321f95){_0x5c84a6=_0x5c84a6-0x0;var _0xb8c5f0=_0xd171[_0x5c84a6];return _0xb8c5f0;};'use strict';var BPromise=require(_0x1d17('0x0'));var util=require(_0x1d17('0x1'));var _=require(_0x1d17('0x2'));var moment=require(_0x1d17('0x3'));var Agent=require(_0x1d17('0x4'));var Telephone=require(_0x1d17('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x1d17('0x6'));var Trigger=require(_0x1d17('0x7'));var Template=require('../model/template');var Campaign=require(_0x1d17('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x1d17('0x9'));var SalesforceAccount=require(_0x1d17('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x1d17('0xb'));var ZohoAccount=require(_0x1d17('0xc'));var DeskAccount=require(_0x1d17('0xd'));var VtigerAccount=require(_0x1d17('0xe'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x1d17('0xf'));var FreshsalesAccount=require(_0x1d17('0x10'));var FaxAccount=require(_0x1d17('0x11'));var Realtime=function(){this[_0x1d17('0x12')]={};this[_0x1d17('0x13')]={};this[_0x1d17('0x14')]={};this['voiceQueues']={};this[_0x1d17('0x15')]={};this['campaigns']={};this[_0x1d17('0x16')]={};this[_0x1d17('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x1d17('0x18')]={};this[_0x1d17('0x19')]={};this[_0x1d17('0x1a')]={};this[_0x1d17('0x1b')]={};this[_0x1d17('0x1c')]={};this[_0x1d17('0x1d')]={};this['salesforceAccounts']={};this[_0x1d17('0x1e')]={};this[_0x1d17('0x1f')]={};this[_0x1d17('0x20')]={};this[_0x1d17('0x21')]={};this[_0x1d17('0x22')]={};this[_0x1d17('0x23')]={};this[_0x1d17('0x24')]={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x24f7aa,_0x44e4af,_0x1dee38){var _0x146745=_[_0x1d17('0x25')](_0x24f7aa,function(_0x1c0907,_0x1d6d46){return _0x1c0907[_0x1dee38];});for(var _0x3eec5d in _0x44e4af){if(_0x44e4af[_0x1d17('0x26')](_0x3eec5d)){if(!_0x146745[_0x3eec5d]){delete _0x44e4af[_0x3eec5d];}}}}function freeIsNotKeySip(_0x44f6c7,_0x73c140){var _0x2d9526=_[_0x1d17('0x25')](_0x44f6c7,function(_0x28b9d4,_0x23a927){return util[_0x1d17('0x27')](_0x1d17('0x28'),_0x28b9d4[_0x1d17('0x29')]);});for(var _0x1eb524 in _0x73c140){if(_0x73c140[_0x1d17('0x26')](_0x1eb524)){if(!_0x2d9526[_0x1eb524]){delete _0x73c140[_0x1eb524];}}}}function freeIsNotKeyAgent(_0x5cea02,_0xea5a36){var _0x11d45e=_['mapKeys'](_0x5cea02,function(_0x44dda2,_0x3d276d){var _0xa425d2=_[_0x1d17('0x2a')](_0x44dda2[_0x1d17('0x2b')])?util['format']('SIP/%s',_0x44dda2[_0x1d17('0x29')]):_0x44dda2[_0x1d17('0x2b')];return _0xa425d2;});for(var _0x264a7b in _0xea5a36){if(_0xea5a36[_0x1d17('0x26')](_0x264a7b)){if(!_0x11d45e[_0x264a7b]){delete _0xea5a36[_0x264a7b];}}}}function clearVoiceCallReports(_0x285b0d){_0x285b0d['total']=0x0;_0x285b0d[_0x1d17('0x2c')]=0x0;_0x285b0d[_0x1d17('0x2d')]=0x0;_0x285b0d[_0x1d17('0x2e')]=0x0;_0x285b0d[_0x1d17('0x2f')]=0x0;}function clearCampaigns(_0x28a30d){if(!_[_0x1d17('0x30')](_0x28a30d)){for(var _0x43b45d in _0x28a30d){if(_0x28a30d['hasOwnProperty'](_0x43b45d)){_0x28a30d[_0x43b45d][_0x1d17('0x31')]=0x0;_0x28a30d[_0x43b45d][_0x1d17('0x32')]=0x0;}}}}function clearVoiceQueues(_0xa06d4){if(!_[_0x1d17('0x30')](_0xa06d4)){for(var _0x4e163b in _0xa06d4){if(_0xa06d4[_0x1d17('0x26')](_0x4e163b)){_0xa06d4[_0x4e163b][_0x1d17('0x33')]=0x0;_0xa06d4[_0x4e163b]['answered']=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x34')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x35')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x2d')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x2e')]=0x0;_0xa06d4[_0x4e163b]['sumBillable']=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x36')]=0x0;_0xa06d4[_0x4e163b]['outboundNoAnswerCallsDay']=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x37')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x38')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x39')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x3a')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x3b')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x3c')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x3d')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x3e')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x3f')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x40')]=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x36')]=0x0;_0xa06d4[_0x4e163b]['outboundAnswerCallsDay']=0x0;_0xa06d4[_0x4e163b][_0x1d17('0x41')]=!![];}}}}Realtime[_0x1d17('0x42')][_0x1d17('0x43')]=function(_0x2de3ea,_0x232592){for(var _0x4f1776 in _0x232592){if(_0x2de3ea[_0x1d17('0x26')](_0x4f1776)){_0x2de3ea[_0x4f1776]=_0x232592[_0x4f1776];}}};Realtime[_0x1d17('0x42')][_0x1d17('0x44')]=function(){var _0x157b9f=this;return function(_0x228e3f){if(_0x228e3f){freeIsNotKeyAgent(_0x228e3f,_0x157b9f[_0x1d17('0x12')]);for(var _0x3b76cb=0x0,_0x1b09e3={},_0x617eed={};_0x3b76cb<_0x228e3f[_0x1d17('0x45')];_0x3b76cb+=0x1){_0x1b09e3=_0x228e3f[_0x3b76cb];var _0x20bf79=_['isNil'](_0x1b09e3['interface'])?util[_0x1d17('0x27')](_0x1d17('0x28'),_0x1b09e3[_0x1d17('0x29')]):_0x1b09e3[_0x1d17('0x2b')];if(_['isUndefined'](_0x157b9f['agents'][_0x20bf79])){_0x157b9f['agents'][_0x20bf79]=new Agent(_0x1b09e3);}else{_0x157b9f['mergeFromDatabase'](_0x157b9f['agents'][_0x20bf79],_0x1b09e3);}}}return _0x157b9f[_0x1d17('0x12')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x46')]=function(){var _0x22cd7e=this;return function(_0x26adab){if(_0x26adab){freeIsNotKeySip(_0x26adab,_0x22cd7e[_0x1d17('0x13')]);for(var _0x4b214f=0x0,_0x93bac7={},_0x2d1554={};_0x4b214f<_0x26adab[_0x1d17('0x45')];_0x4b214f+=0x1){_0x93bac7=_0x26adab[_0x4b214f];if(_[_0x1d17('0x47')](_0x22cd7e[_0x1d17('0x13')][util[_0x1d17('0x27')](_0x1d17('0x28'),_0x93bac7[_0x1d17('0x29')])])){_0x22cd7e[_0x1d17('0x13')][util[_0x1d17('0x27')](_0x1d17('0x28'),_0x93bac7[_0x1d17('0x29')])]=new Telephone(_0x93bac7);}else{_0x22cd7e[_0x1d17('0x43')](_0x22cd7e[_0x1d17('0x13')][util[_0x1d17('0x27')](_0x1d17('0x28'),_0x93bac7[_0x1d17('0x29')])],_0x93bac7);}}}return _0x22cd7e[_0x1d17('0x13')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x48')]=function(){var _0x207b91=this;return function(_0x2d6cda){if(_0x2d6cda){freeIsNotKeySip(_0x2d6cda,_0x207b91[_0x1d17('0x14')]);for(var _0x4739b2=0x0,_0x3a3bab={},_0x37ec3a={};_0x4739b2<_0x2d6cda[_0x1d17('0x45')];_0x4739b2+=0x1){_0x3a3bab=_0x2d6cda[_0x4739b2];if(_[_0x1d17('0x47')](_0x207b91['trunks'][util[_0x1d17('0x27')]('SIP/%s',_0x3a3bab[_0x1d17('0x29')])])){_0x207b91[_0x1d17('0x14')][util['format'](_0x1d17('0x28'),_0x3a3bab['name'])]=new Trunk(_0x3a3bab);}else{_0x207b91[_0x1d17('0x43')](_0x207b91[_0x1d17('0x14')][util[_0x1d17('0x27')](_0x1d17('0x28'),_0x3a3bab[_0x1d17('0x29')])],_0x3a3bab);}}}return _0x207b91[_0x1d17('0x14')];};};Realtime[_0x1d17('0x42')]['initVoiceQueues']=function(){var _0x5ce171=this;return function(_0x35edc5){if(_0x35edc5){freeIsNotKey(_0x35edc5,_0x5ce171['voiceQueues'],_0x1d17('0x29'));for(var _0x390040=0x0,_0x38b544={},_0x5f9904={};_0x390040<_0x35edc5[_0x1d17('0x45')];_0x390040+=0x1){_0x38b544=_0x35edc5[_0x390040];if(_[_0x1d17('0x47')](_0x5ce171[_0x1d17('0x49')][_0x38b544[_0x1d17('0x29')]])){_0x5ce171[_0x1d17('0x49')][_0x38b544[_0x1d17('0x29')]]=new VoiceQueue(_0x38b544);}else{_0x5ce171[_0x1d17('0x43')](_0x5ce171['voiceQueues'][_0x38b544['name']],_0x38b544);}}}return _0x5ce171[_0x1d17('0x49')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x4a')]=function(){var _0x576bf5=this;return function(_0x5cfba4){if(_0x5cfba4){freeIsNotKey(_0x5cfba4,_0x576bf5['triggers'],'id');for(var _0x33e843=0x0,_0x57d3c0={},_0x4fc680={};_0x33e843<_0x5cfba4[_0x1d17('0x45')];_0x33e843+=0x1){_0x57d3c0=_0x5cfba4[_0x33e843];if(_[_0x1d17('0x47')](_0x576bf5['triggers'][_0x57d3c0['id']])){_0x576bf5[_0x1d17('0x15')][_0x57d3c0['id']]=new Trigger(_0x57d3c0);}else{_0x576bf5[_0x1d17('0x43')](_0x576bf5[_0x1d17('0x15')][_0x57d3c0['id']],_0x57d3c0);}}}return _0x576bf5[_0x1d17('0x15')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x4b')]=function(){var _0x55531b=this;return function(_0x1f2399){if(_0x1f2399){freeIsNotKey(_0x1f2399,_0x55531b[_0x1d17('0x16')],'id');for(var _0xfa6384=0x0,_0x192c57={},_0x3da1cf={};_0xfa6384<_0x1f2399[_0x1d17('0x45')];_0xfa6384+=0x1){_0x192c57=_0x1f2399[_0xfa6384];if(_[_0x1d17('0x47')](_0x55531b[_0x1d17('0x16')][_0x192c57['id']])){_0x55531b[_0x1d17('0x16')][_0x192c57['id']]=new Template(_0x192c57);}else{_0x55531b[_0x1d17('0x43')](_0x55531b[_0x1d17('0x16')][_0x192c57['id']],_0x192c57);}}}return _0x55531b[_0x1d17('0x16')];};};Realtime['prototype'][_0x1d17('0x4c')]=function(){var _0xe52b48=this;return function(_0x45e5a9){if(_0x45e5a9){freeIsNotKey(_0x45e5a9,_0xe52b48[_0x1d17('0x1d')],'id');for(var _0x2c11ca=0x0,_0xd39ab6={},_0x1fda22={};_0x2c11ca<_0x45e5a9[_0x1d17('0x45')];_0x2c11ca+=0x1){_0xd39ab6=_0x45e5a9[_0x2c11ca];if(_['isUndefined'](_0xe52b48['zendeskAccounts'][_0xd39ab6['id']])){_0xe52b48[_0x1d17('0x1d')][_0xd39ab6['id']]=new ZendeskAccount(_0xd39ab6);}else{_0xe52b48[_0x1d17('0x43')](_0xe52b48[_0x1d17('0x1d')][_0xd39ab6['id']],_0xd39ab6);}}}return _0xe52b48[_0x1d17('0x1d')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x4d')]=function(){var _0xb904e2=this;return function(_0x5042d8){if(_0x5042d8){freeIsNotKey(_0x5042d8,_0xb904e2[_0x1d17('0x4e')],'id');for(var _0x30e9e5=0x0,_0x51e3b6={},_0x2597f0={};_0x30e9e5<_0x5042d8[_0x1d17('0x45')];_0x30e9e5+=0x1){_0x51e3b6=_0x5042d8[_0x30e9e5];if(_[_0x1d17('0x47')](_0xb904e2[_0x1d17('0x4e')][_0x51e3b6['id']])){_0xb904e2[_0x1d17('0x4e')][_0x51e3b6['id']]=new SalesforceAccount(_0x51e3b6);}else{_0xb904e2[_0x1d17('0x43')](_0xb904e2[_0x1d17('0x4e')][_0x51e3b6['id']],_0x51e3b6);}}}return _0xb904e2[_0x1d17('0x4e')];};};Realtime[_0x1d17('0x42')]['initFreshdeskAccounts']=function(){var _0x350433=this;return function(_0x55c44d){if(_0x55c44d){freeIsNotKey(_0x55c44d,_0x350433[_0x1d17('0x1f')],'id');for(var _0x1357b7=0x0,_0x130b28={},_0x564f73={};_0x1357b7<_0x55c44d[_0x1d17('0x45')];_0x1357b7+=0x1){_0x130b28=_0x55c44d[_0x1357b7];if(_[_0x1d17('0x47')](_0x350433[_0x1d17('0x1f')][_0x130b28['id']])){_0x350433[_0x1d17('0x1f')][_0x130b28['id']]=new FreshdeskAccount(_0x130b28);}else{_0x350433['mergeFromDatabase'](_0x350433[_0x1d17('0x1f')][_0x130b28['id']],_0x130b28);}}}return _0x350433[_0x1d17('0x1f')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x4f')]=function(){var _0x190672=this;return function(_0x503cd0){if(_0x503cd0){freeIsNotKey(_0x503cd0,_0x190672[_0x1d17('0x20')],'id');for(var _0x57289c=0x0,_0x16d17f={},_0x11bd13={};_0x57289c<_0x503cd0[_0x1d17('0x45')];_0x57289c+=0x1){_0x16d17f=_0x503cd0[_0x57289c];if(_['isUndefined'](_0x190672[_0x1d17('0x20')][_0x16d17f['id']])){_0x190672['zohoAccounts'][_0x16d17f['id']]=new ZohoAccount(_0x16d17f);}else{_0x190672[_0x1d17('0x43')](_0x190672[_0x1d17('0x20')][_0x16d17f['id']],_0x16d17f);}}}return _0x190672[_0x1d17('0x20')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x2db067=this;return function(_0x1d33ca){if(_0x1d33ca){freeIsNotKey(_0x1d33ca,_0x2db067[_0x1d17('0x21')],'id');for(var _0x4482fd=0x0,_0x56d5d9={},_0x4df117={};_0x4482fd<_0x1d33ca[_0x1d17('0x45')];_0x4482fd+=0x1){_0x56d5d9=_0x1d33ca[_0x4482fd];if(_[_0x1d17('0x47')](_0x2db067[_0x1d17('0x21')][_0x56d5d9['id']])){_0x2db067[_0x1d17('0x21')][_0x56d5d9['id']]=new DeskAccount(_0x56d5d9);}else{_0x2db067['mergeFromDatabase'](_0x2db067['deskAccounts'][_0x56d5d9['id']],_0x56d5d9);}}}return _0x2db067[_0x1d17('0x21')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x50')]=function(){var _0x446952=this;return function(_0x2e0530){if(_0x2e0530){freeIsNotKey(_0x2e0530,_0x446952['sugarcrmAccounts'],'id');for(var _0x4e247c=0x0,_0x2d969a={},_0x4dcf1f={};_0x4e247c<_0x2e0530[_0x1d17('0x45')];_0x4e247c+=0x1){_0x2d969a=_0x2e0530[_0x4e247c];if(_[_0x1d17('0x47')](_0x446952[_0x1d17('0x1e')][_0x2d969a['id']])){_0x446952[_0x1d17('0x1e')][_0x2d969a['id']]=new SugarcrmAccount(_0x2d969a);}else{_0x446952[_0x1d17('0x43')](_0x446952[_0x1d17('0x1e')][_0x2d969a['id']],_0x2d969a);}}}return _0x446952[_0x1d17('0x1e')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x51')]=function(){var _0xe1815d=this;return function(_0x5845a0){if(_0x5845a0){freeIsNotKey(_0x5845a0,_0xe1815d[_0x1d17('0x22')],'id');for(var _0x2fc243=0x0,_0x251651={},_0x37054c={};_0x2fc243<_0x5845a0[_0x1d17('0x45')];_0x2fc243+=0x1){_0x251651=_0x5845a0[_0x2fc243];if(_['isUndefined'](_0xe1815d[_0x1d17('0x22')][_0x251651['id']])){_0xe1815d[_0x1d17('0x22')][_0x251651['id']]=new VtigerAccount(_0x251651);}else{_0xe1815d[_0x1d17('0x43')](_0xe1815d[_0x1d17('0x22')][_0x251651['id']],_0x251651);}}}return _0xe1815d[_0x1d17('0x22')];};};Realtime[_0x1d17('0x42')]['initServicenowAccounts']=function(){var _0x409898=this;return function(_0x55d50b){if(_0x55d50b){freeIsNotKey(_0x55d50b,_0x409898[_0x1d17('0x23')],'id');for(var _0x4cf27b=0x0,_0x8cca5e={},_0x48b31d={};_0x4cf27b<_0x55d50b[_0x1d17('0x45')];_0x4cf27b+=0x1){_0x8cca5e=_0x55d50b[_0x4cf27b];if(_[_0x1d17('0x47')](_0x409898['servicenowAccounts'][_0x8cca5e['id']])){_0x409898[_0x1d17('0x23')][_0x8cca5e['id']]=new ServicenowAccount(_0x8cca5e);}else{_0x409898[_0x1d17('0x43')](_0x409898['servicenowAccounts'][_0x8cca5e['id']],_0x8cca5e);}}}return _0x409898[_0x1d17('0x23')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x52')]=function(){var _0x350b68=this;return function(_0x5a36e4){if(_0x5a36e4){freeIsNotKey(_0x5a36e4,_0x350b68[_0x1d17('0x24')],'id');for(var _0x5b85fb=0x0,_0x226839={},_0x362457={};_0x5b85fb<_0x5a36e4[_0x1d17('0x45')];_0x5b85fb+=0x1){_0x226839=_0x5a36e4[_0x5b85fb];if(_[_0x1d17('0x47')](_0x350b68['dynamics365Accounts'][_0x226839['id']])){_0x350b68['dynamics365Accounts'][_0x226839['id']]=new Dynamics365Account(_0x226839);}else{_0x350b68[_0x1d17('0x43')](_0x350b68[_0x1d17('0x24')][_0x226839['id']],_0x226839);}}}return _0x350b68['dynamics365Accounts'];};};Realtime[_0x1d17('0x42')][_0x1d17('0x53')]=function(){var _0x5a2f31=this;return function(_0x29e513){if(_0x29e513){freeIsNotKey(_0x29e513,_0x5a2f31[_0x1d17('0x54')],'id');for(var _0x18f3e0=0x0,_0x1031b7={},_0x4e69bc={};_0x18f3e0<_0x29e513[_0x1d17('0x45')];_0x18f3e0+=0x1){_0x1031b7=_0x29e513[_0x18f3e0];if(_[_0x1d17('0x47')](_0x5a2f31['freshsalesAccounts'][_0x1031b7['id']])){_0x5a2f31[_0x1d17('0x54')][_0x1031b7['id']]=new FreshsalesAccount(_0x1031b7);}else{_0x5a2f31['mergeFromDatabase'](_0x5a2f31[_0x1d17('0x54')][_0x1031b7['id']],_0x1031b7);}}}return _0x5a2f31['freshsalesAccounts'];};};Realtime[_0x1d17('0x42')][_0x1d17('0x55')]=function(){var _0x20c01d=this;return function(_0x2ee8b1){for(var _0x54a29f=0x0;_0x54a29f<_0x2ee8b1['length'];_0x54a29f+=0x1){_[_0x1d17('0x56')](_0x20c01d[_0x1d17('0x49')][_0x2ee8b1[_0x54a29f][_0x1d17('0x29')]],_0x2ee8b1[_0x54a29f]);}return _0x20c01d['voiceQueues'];};};Realtime[_0x1d17('0x42')][_0x1d17('0x57')]=function(){var _0x3cc139=this;return function(_0x28a7dd){clearVoiceQueues(_0x3cc139[_0x1d17('0x49')]);if(_0x28a7dd){_0x28a7dd=_[_0x1d17('0x58')](_0x28a7dd,_0x1d17('0x59'));for(var _0x58c72e in _0x28a7dd){if(_0x28a7dd[_0x1d17('0x26')](_0x58c72e)){var _0xa7b5a1={};for(var _0x10a195=0x0;_0x10a195<_0x28a7dd[_0x58c72e][_0x1d17('0x45')];_0x10a195+=0x1){var _0x364713=_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x5a')];if(_0x3cc139[_0x1d17('0x49')][_0x364713]){if(_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x5b')]){_0x3cc139[_0x1d17('0x49')][_0x364713][_0x1d17('0x34')]+=0x1;}if(_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x5c')]){_0x3cc139['voiceQueues'][_0x364713]['abandoned']+=0x1;}_0x3cc139['voiceQueues'][_0x364713][_0x1d17('0x2d')]+=moment(_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x5d')])[_0x1d17('0x5e')](moment(_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x5f')]),_0x1d17('0x60'))||0x0;if(_0x10a195===_0x28a7dd[_0x58c72e][_0x1d17('0x45')]-0x1){_0x3cc139[_0x1d17('0x49')][_0x364713][_0x1d17('0x2e')]+=moment(_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x61')]||_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x62')]||_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x63')])[_0x1d17('0x5e')](moment(_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x5f')]),_0x1d17('0x60'))||0x0;_0x3cc139['voiceQueues'][_0x364713][_0x1d17('0x33')]+=0x1;if(_0x28a7dd[_0x58c72e][_0x10a195]['queuecallercomplete']){_0x3cc139['voiceQueues'][_0x364713][_0x1d17('0x2c')]+=0x1;_0x3cc139[_0x1d17('0x49')][_0x364713][_0x1d17('0x2f')]+=moment(_0x28a7dd[_0x58c72e][_0x10a195][_0x1d17('0x61')])[_0x1d17('0x5e')](moment(_0x28a7dd[_0x58c72e][_0x10a195]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x3cc139[_0x1d17('0x49')][_0x364713][_0x1d17('0x2e')]+=_0x3cc139[_0x1d17('0x49')][_0x364713][_0x1d17('0x2d')]||0x0;}}}}}}return _0x3cc139[_0x1d17('0x49')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x64')]=function(){var _0x4a618b=this;return function(_0x5a5311){clearVoiceCallReports(_0x4a618b[_0x1d17('0x17')]);if(_0x5a5311){for(var _0x25a9ac=0x0;_0x25a9ac<_0x5a5311[_0x1d17('0x45')];_0x25a9ac+=0x1){_0x4a618b[_0x1d17('0x17')][_0x1d17('0x33')]+=0x1;_0x4a618b[_0x1d17('0x17')][_0x1d17('0x2e')]+=_0x5a5311[_0x25a9ac][_0x1d17('0x65')];if(_0x5a5311[_0x25a9ac][_0x1d17('0x66')]===_0x1d17('0x67')){_0x4a618b[_0x1d17('0x17')]['answered']+=0x1;_0x4a618b['outbound'][_0x1d17('0x2d')]+=_0x5a5311[_0x25a9ac][_0x1d17('0x65')]-_0x5a5311[_0x25a9ac][_0x1d17('0x68')]||0x0;_0x4a618b[_0x1d17('0x17')][_0x1d17('0x2f')]+=_0x5a5311[_0x25a9ac]['billableseconds'];}}}return _0x4a618b[_0x1d17('0x17')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x69')]=function(){var _0x569bf9=this;return function(_0xf43543){if(_0xf43543){freeIsNotKey(_0xf43543,_0x569bf9['campaigns'],_0x1d17('0x29'));for(var _0x4aeb4e=0x0,_0x86b258={};_0x4aeb4e<_0xf43543[_0x1d17('0x45')];_0x4aeb4e+=0x1){_0x86b258=_0xf43543[_0x4aeb4e];if(_[_0x1d17('0x47')](_0x569bf9['campaigns'][_0x86b258[_0x1d17('0x29')]])){_0x569bf9[_0x1d17('0x6a')][_0x86b258[_0x1d17('0x29')]]=new Campaign(_0x86b258);}else{_0x569bf9[_0x1d17('0x43')](_0x569bf9['campaigns'][_0x86b258[_0x1d17('0x29')]],_0x86b258);_0x569bf9[_0x1d17('0x6a')][_0x86b258['name']][_0x1d17('0x6b')]=_0x86b258[_0x1d17('0x6c')]?_0x86b258['SquareProject']['name']:undefined;}}}return _0x569bf9[_0x1d17('0x6a')];};};Realtime[_0x1d17('0x42')]['initVoiceExtensions']=function(){var _0x53289a=this;return function(_0x30567a){if(_0x30567a){freeIsNotKey(_0x30567a,_0x53289a['voiceExtensions'],'id');for(var _0x3ec829=0x0,_0x7730fe={};_0x3ec829<_0x30567a[_0x1d17('0x45')];_0x3ec829+=0x1){_0x7730fe=_0x30567a[_0x3ec829];if(_[_0x1d17('0x47')](_0x53289a[_0x1d17('0x6d')][_0x7730fe['id']])){_0x53289a[_0x1d17('0x6d')][_0x7730fe['id']]=new VoiceExtension(_0x7730fe);}else{_0x53289a[_0x1d17('0x43')](_0x53289a['voiceExtensions'][_0x7730fe['id']],_0x7730fe);}}}return _0x53289a['voiceExtensions'];};};Realtime[_0x1d17('0x42')]['initCampaignHopperHistory']=function(){var _0x1c5c7f=this;return function(_0x4df625){clearCampaigns(_0x1c5c7f['campaigns']);for(var _0xfc28=0x0;_0xfc28<_0x4df625['length'];_0xfc28+=0x1){_['merge'](_0x1c5c7f[_0x1d17('0x6a')][_0x4df625[_0xfc28][_0x1d17('0x29')]],_0x4df625[_0xfc28]);}return _0x1c5c7f[_0x1d17('0x6a')];};};Realtime[_0x1d17('0x42')][_0x1d17('0x6e')]=function(){var _0x5c7698=this;return function(_0x2f2e2f){if(_0x2f2e2f){freeIsNotKey(_0x2f2e2f,_0x5c7698['faxAccounts'],'id');for(var _0x3c17d4=0x0,_0x198250={},_0x422b42={};_0x3c17d4<_0x2f2e2f[_0x1d17('0x45')];_0x3c17d4+=0x1){_0x198250=_0x2f2e2f[_0x3c17d4];if(_['isUndefined'](_0x5c7698[_0x1d17('0x6f')][_0x198250['id']])){_0x5c7698['faxAccounts'][_0x198250['id']]=new FaxAccount(_0x198250);}else{_0x5c7698[_0x1d17('0x43')](_0x5c7698[_0x1d17('0x6f')][_0x198250['id']],_0x198250);}}}return _0x5c7698[_0x1d17('0x6f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x8675=['outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','isNil','isUndefined','prototype','initTelephones','mergeFromDatabase','length','initVoiceQueues','initTriggers','initTemplates','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','abandoned','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','util','lodash','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout'];(function(_0xdda6b7,_0x879423){var _0x56541d=function(_0x1d4dfb){while(--_0x1d4dfb){_0xdda6b7['push'](_0xdda6b7['shift']());}};_0x56541d(++_0x879423);}(_0x8675,0xa1));var _0x5867=function(_0x1e6f26,_0x27d992){_0x1e6f26=_0x1e6f26-0x0;var _0x4820f9=_0x8675[_0x1e6f26];return _0x4820f9;};'use strict';var BPromise=require(_0x5867('0x0'));var util=require(_0x5867('0x1'));var _=require(_0x5867('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require(_0x5867('0x3'));var Campaign=require(_0x5867('0x4'));var VoiceExtension=require(_0x5867('0x5'));var ZendeskAccount=require(_0x5867('0x6'));var SalesforceAccount=require(_0x5867('0x7'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x5867('0x8'));var ZohoAccount=require(_0x5867('0x9'));var DeskAccount=require(_0x5867('0xa'));var VtigerAccount=require(_0x5867('0xb'));var ServicenowAccount=require(_0x5867('0xc'));var Dynamics365Account=require(_0x5867('0xd'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x5867('0xe'));var Realtime=function(){this[_0x5867('0xf')]={};this[_0x5867('0x10')]={};this[_0x5867('0x11')]={};this[_0x5867('0x12')]={};this[_0x5867('0x13')]={};this['campaigns']={};this[_0x5867('0x14')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5867('0x15')]={};this[_0x5867('0x16')]={};this[_0x5867('0x17')]={};this[_0x5867('0x18')]={};this[_0x5867('0x19')]={};this[_0x5867('0x1a')]={};this[_0x5867('0x1b')]={};this[_0x5867('0x1c')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x5867('0x1d')]={};this[_0x5867('0x1e')]={};this[_0x5867('0x1f')]={};this[_0x5867('0x20')]={};this[_0x5867('0x21')]={};this['freshsalesAccounts']={};this[_0x5867('0x22')]={};};function freeIsNotKey(_0x13bf85,_0x954b77,_0x224d73){var _0x28e315=_[_0x5867('0x23')](_0x13bf85,function(_0x8aa1ca,_0x1faaa5){return _0x8aa1ca[_0x224d73];});for(var _0x23e5ec in _0x954b77){if(_0x954b77['hasOwnProperty'](_0x23e5ec)){if(!_0x28e315[_0x23e5ec]){delete _0x954b77[_0x23e5ec];}}}}function freeIsNotKeySip(_0x1e63dd,_0x12e004){var _0x5c4d51=_[_0x5867('0x23')](_0x1e63dd,function(_0x1c26d8,_0x5dc254){return util[_0x5867('0x24')](_0x5867('0x25'),_0x1c26d8[_0x5867('0x26')]);});for(var _0x210f07 in _0x12e004){if(_0x12e004[_0x5867('0x27')](_0x210f07)){if(!_0x5c4d51[_0x210f07]){delete _0x12e004[_0x210f07];}}}}function freeIsNotKeyAgent(_0x27547f,_0x5c493c){var _0xd6876e=_[_0x5867('0x23')](_0x27547f,function(_0x2f43c1,_0x2a56b2){var _0x3f1370=_['isNil'](_0x2f43c1['interface'])?util[_0x5867('0x24')](_0x5867('0x25'),_0x2f43c1['name']):_0x2f43c1[_0x5867('0x28')];return _0x3f1370;});for(var _0x35a019 in _0x5c493c){if(_0x5c493c[_0x5867('0x27')](_0x35a019)){if(!_0xd6876e[_0x35a019]){delete _0x5c493c[_0x35a019];}}}}function clearVoiceCallReports(_0x1fe25a){_0x1fe25a[_0x5867('0x29')]=0x0;_0x1fe25a[_0x5867('0x2a')]=0x0;_0x1fe25a[_0x5867('0x2b')]=0x0;_0x1fe25a[_0x5867('0x2c')]=0x0;_0x1fe25a[_0x5867('0x2d')]=0x0;}function clearCampaigns(_0x21bd36){if(!_[_0x5867('0x2e')](_0x21bd36)){for(var _0x59678b in _0x21bd36){if(_0x21bd36[_0x5867('0x27')](_0x59678b)){_0x21bd36[_0x59678b][_0x5867('0x2f')]=0x0;_0x21bd36[_0x59678b][_0x5867('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4a5db8){if(!_[_0x5867('0x2e')](_0x4a5db8)){for(var _0x4961ed in _0x4a5db8){if(_0x4a5db8[_0x5867('0x27')](_0x4961ed)){_0x4a5db8[_0x4961ed][_0x5867('0x29')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x2a')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x31')]=0x0;_0x4a5db8[_0x4961ed]['abandoned']=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x2b')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x2c')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x2d')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x32')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x33')]=0x0;_0x4a5db8[_0x4961ed]['outboundBusyCallsDay']=0x0;_0x4a5db8[_0x4961ed]['outboundCongestionCallsDay']=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x34')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x35')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x36')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x37')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x38')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x39')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x3a')]=0x0;_0x4a5db8[_0x4961ed]['outboundReCallsDay']=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x32')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x3b')]=0x0;_0x4a5db8[_0x4961ed][_0x5867('0x3c')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1c71df,_0x528fff){for(var _0x10eb6a in _0x528fff){if(_0x1c71df[_0x5867('0x27')](_0x10eb6a)){_0x1c71df[_0x10eb6a]=_0x528fff[_0x10eb6a];}}};Realtime['prototype']['initAgents']=function(){var _0x5300cd=this;return function(_0xc3a8ec){if(_0xc3a8ec){freeIsNotKeyAgent(_0xc3a8ec,_0x5300cd[_0x5867('0xf')]);for(var _0x2775e6=0x0,_0x5e2392={},_0x12897b={};_0x2775e6<_0xc3a8ec['length'];_0x2775e6+=0x1){_0x5e2392=_0xc3a8ec[_0x2775e6];var _0x38eb3d=_[_0x5867('0x3d')](_0x5e2392[_0x5867('0x28')])?util[_0x5867('0x24')](_0x5867('0x25'),_0x5e2392['name']):_0x5e2392[_0x5867('0x28')];if(_[_0x5867('0x3e')](_0x5300cd[_0x5867('0xf')][_0x38eb3d])){_0x5300cd[_0x5867('0xf')][_0x38eb3d]=new Agent(_0x5e2392);}else{_0x5300cd['mergeFromDatabase'](_0x5300cd[_0x5867('0xf')][_0x38eb3d],_0x5e2392);}}}return _0x5300cd[_0x5867('0xf')];};};Realtime[_0x5867('0x3f')][_0x5867('0x40')]=function(){var _0x3a4723=this;return function(_0x4df03f){if(_0x4df03f){freeIsNotKeySip(_0x4df03f,_0x3a4723['telephones']);for(var _0x276778=0x0,_0x5932af={},_0x1d115d={};_0x276778<_0x4df03f['length'];_0x276778+=0x1){_0x5932af=_0x4df03f[_0x276778];if(_[_0x5867('0x3e')](_0x3a4723[_0x5867('0x10')][util[_0x5867('0x24')](_0x5867('0x25'),_0x5932af[_0x5867('0x26')])])){_0x3a4723[_0x5867('0x10')][util['format'](_0x5867('0x25'),_0x5932af[_0x5867('0x26')])]=new Telephone(_0x5932af);}else{_0x3a4723[_0x5867('0x41')](_0x3a4723[_0x5867('0x10')][util[_0x5867('0x24')](_0x5867('0x25'),_0x5932af[_0x5867('0x26')])],_0x5932af);}}}return _0x3a4723['telephones'];};};Realtime[_0x5867('0x3f')]['initTrunks']=function(){var _0x3de6c2=this;return function(_0x59b291){if(_0x59b291){freeIsNotKeySip(_0x59b291,_0x3de6c2[_0x5867('0x11')]);for(var _0x224fc4=0x0,_0x1ddc32={},_0x13c349={};_0x224fc4<_0x59b291[_0x5867('0x42')];_0x224fc4+=0x1){_0x1ddc32=_0x59b291[_0x224fc4];if(_['isUndefined'](_0x3de6c2['trunks'][util['format']('SIP/%s',_0x1ddc32[_0x5867('0x26')])])){_0x3de6c2[_0x5867('0x11')][util[_0x5867('0x24')](_0x5867('0x25'),_0x1ddc32[_0x5867('0x26')])]=new Trunk(_0x1ddc32);}else{_0x3de6c2[_0x5867('0x41')](_0x3de6c2[_0x5867('0x11')][util[_0x5867('0x24')]('SIP/%s',_0x1ddc32[_0x5867('0x26')])],_0x1ddc32);}}}return _0x3de6c2[_0x5867('0x11')];};};Realtime['prototype'][_0x5867('0x43')]=function(){var _0x42efa5=this;return function(_0x5509d0){if(_0x5509d0){freeIsNotKey(_0x5509d0,_0x42efa5['voiceQueues'],_0x5867('0x26'));for(var _0xbb933=0x0,_0x47144b={},_0x2ca317={};_0xbb933<_0x5509d0['length'];_0xbb933+=0x1){_0x47144b=_0x5509d0[_0xbb933];if(_[_0x5867('0x3e')](_0x42efa5[_0x5867('0x12')][_0x47144b[_0x5867('0x26')]])){_0x42efa5['voiceQueues'][_0x47144b[_0x5867('0x26')]]=new VoiceQueue(_0x47144b);}else{_0x42efa5[_0x5867('0x41')](_0x42efa5[_0x5867('0x12')][_0x47144b[_0x5867('0x26')]],_0x47144b);}}}return _0x42efa5[_0x5867('0x12')];};};Realtime[_0x5867('0x3f')][_0x5867('0x44')]=function(){var _0x1a2efb=this;return function(_0x5ee47e){if(_0x5ee47e){freeIsNotKey(_0x5ee47e,_0x1a2efb[_0x5867('0x13')],'id');for(var _0x2d5413=0x0,_0x30fe45={},_0x3aad7f={};_0x2d5413<_0x5ee47e[_0x5867('0x42')];_0x2d5413+=0x1){_0x30fe45=_0x5ee47e[_0x2d5413];if(_[_0x5867('0x3e')](_0x1a2efb['triggers'][_0x30fe45['id']])){_0x1a2efb['triggers'][_0x30fe45['id']]=new Trigger(_0x30fe45);}else{_0x1a2efb['mergeFromDatabase'](_0x1a2efb['triggers'][_0x30fe45['id']],_0x30fe45);}}}return _0x1a2efb[_0x5867('0x13')];};};Realtime[_0x5867('0x3f')][_0x5867('0x45')]=function(){var _0x41f957=this;return function(_0xefdc24){if(_0xefdc24){freeIsNotKey(_0xefdc24,_0x41f957[_0x5867('0x14')],'id');for(var _0x20a73b=0x0,_0x3cc199={},_0x2a3305={};_0x20a73b<_0xefdc24['length'];_0x20a73b+=0x1){_0x3cc199=_0xefdc24[_0x20a73b];if(_[_0x5867('0x3e')](_0x41f957[_0x5867('0x14')][_0x3cc199['id']])){_0x41f957['templates'][_0x3cc199['id']]=new Template(_0x3cc199);}else{_0x41f957[_0x5867('0x41')](_0x41f957[_0x5867('0x14')][_0x3cc199['id']],_0x3cc199);}}}return _0x41f957[_0x5867('0x14')];};};Realtime[_0x5867('0x3f')]['initZendeskAccounts']=function(){var _0x54b0ed=this;return function(_0x128b8b){if(_0x128b8b){freeIsNotKey(_0x128b8b,_0x54b0ed[_0x5867('0x1b')],'id');for(var _0x155a78=0x0,_0x18ab1d={},_0x116e2a={};_0x155a78<_0x128b8b[_0x5867('0x42')];_0x155a78+=0x1){_0x18ab1d=_0x128b8b[_0x155a78];if(_[_0x5867('0x3e')](_0x54b0ed[_0x5867('0x1b')][_0x18ab1d['id']])){_0x54b0ed[_0x5867('0x1b')][_0x18ab1d['id']]=new ZendeskAccount(_0x18ab1d);}else{_0x54b0ed['mergeFromDatabase'](_0x54b0ed[_0x5867('0x1b')][_0x18ab1d['id']],_0x18ab1d);}}}return _0x54b0ed[_0x5867('0x1b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x1bcc17=this;return function(_0xd29947){if(_0xd29947){freeIsNotKey(_0xd29947,_0x1bcc17[_0x5867('0x1c')],'id');for(var _0x3cfa52=0x0,_0x3e51cc={},_0x1744a4={};_0x3cfa52<_0xd29947[_0x5867('0x42')];_0x3cfa52+=0x1){_0x3e51cc=_0xd29947[_0x3cfa52];if(_[_0x5867('0x3e')](_0x1bcc17['salesforceAccounts'][_0x3e51cc['id']])){_0x1bcc17['salesforceAccounts'][_0x3e51cc['id']]=new SalesforceAccount(_0x3e51cc);}else{_0x1bcc17[_0x5867('0x41')](_0x1bcc17[_0x5867('0x1c')][_0x3e51cc['id']],_0x3e51cc);}}}return _0x1bcc17[_0x5867('0x1c')];};};Realtime[_0x5867('0x3f')][_0x5867('0x46')]=function(){var _0x2995fb=this;return function(_0x4e857c){if(_0x4e857c){freeIsNotKey(_0x4e857c,_0x2995fb[_0x5867('0x47')],'id');for(var _0x36f7bb=0x0,_0x1c3c7c={},_0x1f7147={};_0x36f7bb<_0x4e857c[_0x5867('0x42')];_0x36f7bb+=0x1){_0x1c3c7c=_0x4e857c[_0x36f7bb];if(_['isUndefined'](_0x2995fb[_0x5867('0x47')][_0x1c3c7c['id']])){_0x2995fb[_0x5867('0x47')][_0x1c3c7c['id']]=new FreshdeskAccount(_0x1c3c7c);}else{_0x2995fb[_0x5867('0x41')](_0x2995fb[_0x5867('0x47')][_0x1c3c7c['id']],_0x1c3c7c);}}}return _0x2995fb[_0x5867('0x47')];};};Realtime['prototype'][_0x5867('0x48')]=function(){var _0x2ecb14=this;return function(_0x16d8c2){if(_0x16d8c2){freeIsNotKey(_0x16d8c2,_0x2ecb14[_0x5867('0x1d')],'id');for(var _0x1be7f7=0x0,_0x521fd6={},_0x55679a={};_0x1be7f7<_0x16d8c2[_0x5867('0x42')];_0x1be7f7+=0x1){_0x521fd6=_0x16d8c2[_0x1be7f7];if(_[_0x5867('0x3e')](_0x2ecb14[_0x5867('0x1d')][_0x521fd6['id']])){_0x2ecb14[_0x5867('0x1d')][_0x521fd6['id']]=new ZohoAccount(_0x521fd6);}else{_0x2ecb14['mergeFromDatabase'](_0x2ecb14[_0x5867('0x1d')][_0x521fd6['id']],_0x521fd6);}}}return _0x2ecb14[_0x5867('0x1d')];};};Realtime[_0x5867('0x3f')][_0x5867('0x49')]=function(){var _0x179377=this;return function(_0x47f7dc){if(_0x47f7dc){freeIsNotKey(_0x47f7dc,_0x179377[_0x5867('0x1e')],'id');for(var _0x238849=0x0,_0x56bf00={},_0x46dc9c={};_0x238849<_0x47f7dc[_0x5867('0x42')];_0x238849+=0x1){_0x56bf00=_0x47f7dc[_0x238849];if(_[_0x5867('0x3e')](_0x179377[_0x5867('0x1e')][_0x56bf00['id']])){_0x179377[_0x5867('0x1e')][_0x56bf00['id']]=new DeskAccount(_0x56bf00);}else{_0x179377[_0x5867('0x41')](_0x179377[_0x5867('0x1e')][_0x56bf00['id']],_0x56bf00);}}}return _0x179377[_0x5867('0x1e')];};};Realtime[_0x5867('0x3f')][_0x5867('0x4a')]=function(){var _0x47f393=this;return function(_0x126a68){if(_0x126a68){freeIsNotKey(_0x126a68,_0x47f393[_0x5867('0x4b')],'id');for(var _0x4f7755=0x0,_0xabe74e={},_0x26304f={};_0x4f7755<_0x126a68[_0x5867('0x42')];_0x4f7755+=0x1){_0xabe74e=_0x126a68[_0x4f7755];if(_[_0x5867('0x3e')](_0x47f393[_0x5867('0x4b')][_0xabe74e['id']])){_0x47f393[_0x5867('0x4b')][_0xabe74e['id']]=new SugarcrmAccount(_0xabe74e);}else{_0x47f393[_0x5867('0x41')](_0x47f393[_0x5867('0x4b')][_0xabe74e['id']],_0xabe74e);}}}return _0x47f393[_0x5867('0x4b')];};};Realtime[_0x5867('0x3f')][_0x5867('0x4c')]=function(){var _0x54786a=this;return function(_0x44efc0){if(_0x44efc0){freeIsNotKey(_0x44efc0,_0x54786a[_0x5867('0x1f')],'id');for(var _0x10aa86=0x0,_0x37aba8={},_0x4d8c43={};_0x10aa86<_0x44efc0[_0x5867('0x42')];_0x10aa86+=0x1){_0x37aba8=_0x44efc0[_0x10aa86];if(_['isUndefined'](_0x54786a[_0x5867('0x1f')][_0x37aba8['id']])){_0x54786a[_0x5867('0x1f')][_0x37aba8['id']]=new VtigerAccount(_0x37aba8);}else{_0x54786a[_0x5867('0x41')](_0x54786a[_0x5867('0x1f')][_0x37aba8['id']],_0x37aba8);}}}return _0x54786a[_0x5867('0x1f')];};};Realtime[_0x5867('0x3f')][_0x5867('0x4d')]=function(){var _0x3e770d=this;return function(_0x1d89ad){if(_0x1d89ad){freeIsNotKey(_0x1d89ad,_0x3e770d[_0x5867('0x20')],'id');for(var _0xb1d984=0x0,_0x14e377={},_0x52c502={};_0xb1d984<_0x1d89ad[_0x5867('0x42')];_0xb1d984+=0x1){_0x14e377=_0x1d89ad[_0xb1d984];if(_['isUndefined'](_0x3e770d['servicenowAccounts'][_0x14e377['id']])){_0x3e770d[_0x5867('0x20')][_0x14e377['id']]=new ServicenowAccount(_0x14e377);}else{_0x3e770d[_0x5867('0x41')](_0x3e770d[_0x5867('0x20')][_0x14e377['id']],_0x14e377);}}}return _0x3e770d[_0x5867('0x20')];};};Realtime['prototype'][_0x5867('0x4e')]=function(){var _0x4544bc=this;return function(_0x47a723){if(_0x47a723){freeIsNotKey(_0x47a723,_0x4544bc['dynamics365Accounts'],'id');for(var _0xe6a1ef=0x0,_0x5e4b45={},_0x333d03={};_0xe6a1ef<_0x47a723['length'];_0xe6a1ef+=0x1){_0x5e4b45=_0x47a723[_0xe6a1ef];if(_[_0x5867('0x3e')](_0x4544bc[_0x5867('0x21')][_0x5e4b45['id']])){_0x4544bc['dynamics365Accounts'][_0x5e4b45['id']]=new Dynamics365Account(_0x5e4b45);}else{_0x4544bc[_0x5867('0x41')](_0x4544bc[_0x5867('0x21')][_0x5e4b45['id']],_0x5e4b45);}}}return _0x4544bc[_0x5867('0x21')];};};Realtime[_0x5867('0x3f')][_0x5867('0x4f')]=function(){var _0x47cbf6=this;return function(_0xdc5b7a){if(_0xdc5b7a){freeIsNotKey(_0xdc5b7a,_0x47cbf6[_0x5867('0x50')],'id');for(var _0x318d48=0x0,_0x2157bf={},_0x2104fb={};_0x318d48<_0xdc5b7a[_0x5867('0x42')];_0x318d48+=0x1){_0x2157bf=_0xdc5b7a[_0x318d48];if(_[_0x5867('0x3e')](_0x47cbf6[_0x5867('0x50')][_0x2157bf['id']])){_0x47cbf6[_0x5867('0x50')][_0x2157bf['id']]=new FreshsalesAccount(_0x2157bf);}else{_0x47cbf6['mergeFromDatabase'](_0x47cbf6[_0x5867('0x50')][_0x2157bf['id']],_0x2157bf);}}}return _0x47cbf6[_0x5867('0x50')];};};Realtime[_0x5867('0x3f')][_0x5867('0x51')]=function(){var _0x10b5b3=this;return function(_0x8a0f7d){for(var _0x373857=0x0;_0x373857<_0x8a0f7d[_0x5867('0x42')];_0x373857+=0x1){_[_0x5867('0x52')](_0x10b5b3[_0x5867('0x12')][_0x8a0f7d[_0x373857][_0x5867('0x26')]],_0x8a0f7d[_0x373857]);}return _0x10b5b3[_0x5867('0x12')];};};Realtime[_0x5867('0x3f')][_0x5867('0x53')]=function(){var _0x5d3585=this;return function(_0x819112){clearVoiceQueues(_0x5d3585['voiceQueues']);if(_0x819112){_0x819112=_[_0x5867('0x54')](_0x819112,_0x5867('0x55'));for(var _0x1399f9 in _0x819112){if(_0x819112[_0x5867('0x27')](_0x1399f9)){var _0x5a9ba0={};for(var _0x3a75a0=0x0;_0x3a75a0<_0x819112[_0x1399f9][_0x5867('0x42')];_0x3a75a0+=0x1){var _0x20262f=_0x819112[_0x1399f9][_0x3a75a0]['queue'];if(_0x5d3585[_0x5867('0x12')][_0x20262f]){if(_0x819112[_0x1399f9][_0x3a75a0][_0x5867('0x56')]){_0x5d3585[_0x5867('0x12')][_0x20262f][_0x5867('0x31')]+=0x1;}if(_0x819112[_0x1399f9][_0x3a75a0]['queuecallerabandon']){_0x5d3585[_0x5867('0x12')][_0x20262f][_0x5867('0x57')]+=0x1;}_0x5d3585[_0x5867('0x12')][_0x20262f]['sumHoldTime']+=moment(_0x819112[_0x1399f9][_0x3a75a0][_0x5867('0x58')])[_0x5867('0x59')](moment(_0x819112[_0x1399f9][_0x3a75a0][_0x5867('0x5a')]),_0x5867('0x5b'))||0x0;if(_0x3a75a0===_0x819112[_0x1399f9][_0x5867('0x42')]-0x1){_0x5d3585[_0x5867('0x12')][_0x20262f][_0x5867('0x2c')]+=moment(_0x819112[_0x1399f9][_0x3a75a0][_0x5867('0x5c')]||_0x819112[_0x1399f9][_0x3a75a0]['queuecallerabandonAt']||_0x819112[_0x1399f9][_0x3a75a0][_0x5867('0x5d')])['diff'](moment(_0x819112[_0x1399f9][_0x3a75a0][_0x5867('0x5a')]),'seconds')||0x0;_0x5d3585[_0x5867('0x12')][_0x20262f][_0x5867('0x29')]+=0x1;if(_0x819112[_0x1399f9][_0x3a75a0][_0x5867('0x5e')]){_0x5d3585[_0x5867('0x12')][_0x20262f][_0x5867('0x2a')]+=0x1;_0x5d3585[_0x5867('0x12')][_0x20262f][_0x5867('0x2d')]+=moment(_0x819112[_0x1399f9][_0x3a75a0][_0x5867('0x5c')])[_0x5867('0x59')](moment(_0x819112[_0x1399f9][_0x3a75a0]['queuecallerleaveAt']),_0x5867('0x5b'))||0x0;}}else{_0x5d3585[_0x5867('0x12')][_0x20262f][_0x5867('0x2c')]+=_0x5d3585[_0x5867('0x12')][_0x20262f]['sumHoldTime']||0x0;}}}}}}return _0x5d3585['voiceQueues'];};};Realtime[_0x5867('0x3f')][_0x5867('0x5f')]=function(){var _0x3b000c=this;return function(_0x29900b){clearVoiceCallReports(_0x3b000c['outbound']);if(_0x29900b){for(var _0x35d67e=0x0;_0x35d67e<_0x29900b[_0x5867('0x42')];_0x35d67e+=0x1){_0x3b000c['outbound'][_0x5867('0x29')]+=0x1;_0x3b000c['outbound']['sumDuration']+=_0x29900b[_0x35d67e]['duration'];if(_0x29900b[_0x35d67e][_0x5867('0x60')]===_0x5867('0x61')){_0x3b000c[_0x5867('0x62')]['answered']+=0x1;_0x3b000c[_0x5867('0x62')][_0x5867('0x2b')]+=_0x29900b[_0x35d67e][_0x5867('0x63')]-_0x29900b[_0x35d67e][_0x5867('0x64')]||0x0;_0x3b000c['outbound'][_0x5867('0x2d')]+=_0x29900b[_0x35d67e][_0x5867('0x64')];}}}return _0x3b000c['outbound'];};};Realtime[_0x5867('0x3f')][_0x5867('0x65')]=function(){var _0x5d3723=this;return function(_0x33070d){if(_0x33070d){freeIsNotKey(_0x33070d,_0x5d3723[_0x5867('0x66')],_0x5867('0x26'));for(var _0x5f3909=0x0,_0x54d0f5={};_0x5f3909<_0x33070d[_0x5867('0x42')];_0x5f3909+=0x1){_0x54d0f5=_0x33070d[_0x5f3909];if(_[_0x5867('0x3e')](_0x5d3723[_0x5867('0x66')][_0x54d0f5['name']])){_0x5d3723[_0x5867('0x66')][_0x54d0f5['name']]=new Campaign(_0x54d0f5);}else{_0x5d3723['mergeFromDatabase'](_0x5d3723['campaigns'][_0x54d0f5[_0x5867('0x26')]],_0x54d0f5);_0x5d3723['campaigns'][_0x54d0f5[_0x5867('0x26')]][_0x5867('0x67')]=_0x54d0f5[_0x5867('0x68')]?_0x54d0f5[_0x5867('0x68')]['name']:undefined;}}}return _0x5d3723[_0x5867('0x66')];};};Realtime[_0x5867('0x3f')][_0x5867('0x69')]=function(){var _0x4408ca=this;return function(_0x127173){if(_0x127173){freeIsNotKey(_0x127173,_0x4408ca['voiceExtensions'],'id');for(var _0x50b485=0x0,_0xa5a857={};_0x50b485<_0x127173[_0x5867('0x42')];_0x50b485+=0x1){_0xa5a857=_0x127173[_0x50b485];if(_[_0x5867('0x3e')](_0x4408ca[_0x5867('0x15')][_0xa5a857['id']])){_0x4408ca[_0x5867('0x15')][_0xa5a857['id']]=new VoiceExtension(_0xa5a857);}else{_0x4408ca['mergeFromDatabase'](_0x4408ca[_0x5867('0x15')][_0xa5a857['id']],_0xa5a857);}}}return _0x4408ca[_0x5867('0x15')];};};Realtime[_0x5867('0x3f')][_0x5867('0x6a')]=function(){var _0x4e6d8e=this;return function(_0x1e9213){clearCampaigns(_0x4e6d8e['campaigns']);for(var _0x25a034=0x0;_0x25a034<_0x1e9213[_0x5867('0x42')];_0x25a034+=0x1){_[_0x5867('0x52')](_0x4e6d8e[_0x5867('0x66')][_0x1e9213[_0x25a034][_0x5867('0x26')]],_0x1e9213[_0x25a034]);}return _0x4e6d8e[_0x5867('0x66')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x2aee1d=this;return function(_0x10e82b){if(_0x10e82b){freeIsNotKey(_0x10e82b,_0x2aee1d[_0x5867('0x22')],'id');for(var _0x51362b=0x0,_0x20d3ce={},_0x194c22={};_0x51362b<_0x10e82b[_0x5867('0x42')];_0x51362b+=0x1){_0x20d3ce=_0x10e82b[_0x51362b];if(_[_0x5867('0x3e')](_0x2aee1d['faxAccounts'][_0x20d3ce['id']])){_0x2aee1d[_0x5867('0x22')][_0x20d3ce['id']]=new FaxAccount(_0x20d3ce);}else{_0x2aee1d['mergeFromDatabase'](_0x2aee1d[_0x5867('0x22')][_0x20d3ce['id']],_0x20d3ce);}}}return _0x2aee1d[_0x5867('0x22')];};};module[_0x5867('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index da8a661..31d4a66 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 _0x41b7=['telephones','prototype','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','length','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','exten','type','lastapplication','queue','context','callerid','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents'];(function(_0x2529f,_0x42f79f){var _0x1fd85b=function(_0x2ae5a6){while(--_0x2ae5a6){_0x2529f['push'](_0x2529f['shift']());}};_0x1fd85b(++_0x42f79f);}(_0x41b7,0x1ea));var _0x741b=function(_0x532bc6,_0x130bb6){_0x532bc6=_0x532bc6-0x0;var _0x5c2cdf=_0x41b7[_0x532bc6];return _0x5c2cdf;};'use strict';var _=require(_0x741b('0x0'));var moment=require(_0x741b('0x1'));var util=require(_0x741b('0x2'));var config=require('../../../config/environment');var ami=require(_0x741b('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x741b('0x4'));var RpcVoiceDialReport=require(_0x741b('0x5'));var RpcMemberReport=require(_0x741b('0x6'));var RpcVoiceQueueReport=require(_0x741b('0x7'));var RpcVoiceRecording=require(_0x741b('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x741b('0x9'));var VoiceCallReport=require(_0x741b('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x741b('0xb'));function Report(_0x94aff6){this[_0x741b('0xc')]=_0x94aff6;this[_0x741b('0xd')]=_0x94aff6['agents'];this[_0x741b('0xe')]=_0x94aff6[_0x741b('0xe')];}Report[_0x741b('0xf')]['sync']=function(_0x118455){var _0x2b7a71=new VoiceQueueReport(this[_0x741b('0xc')]);var _0x13c434=new VoiceAgentReport(this[_0x741b('0xc')]);var _0x628c85=new VoiceDialReport(this['realtime']);var _0x479447=new VoiceCallReport(this[_0x741b('0xc')]);var _0x2f4c81=new UserReport(this[_0x741b('0xc')]);if(config[_0x741b('0x10')]&&config[_0x741b('0x10')][_0x741b('0x11')]){ami['on']('custom:voiceQueueReport',this[_0x741b('0x12')]['bind'](this));ami['on'](_0x741b('0x13'),this[_0x741b('0x14')][_0x741b('0x15')](this));ami['on'](_0x741b('0x16'),this[_0x741b('0x17')][_0x741b('0x15')](this));ami['on'](_0x741b('0x18'),this[_0x741b('0x19')]['bind'](this));ami['on'](_0x741b('0x1a'),this[_0x741b('0x1b')][_0x741b('0x15')](this));ami['on'](_0x741b('0x1c'),this[_0x741b('0x1d')][_0x741b('0x15')](this));}};Report[_0x741b('0xf')][_0x741b('0x1e')]=function(_0x3dfb81){var _0x497a90;_0x497a90=_[_0x741b('0x1f')](this[_0x741b('0xd')],function(_0x23c34b){return _0x23c34b[_0x741b('0x20')]==_0x3dfb81||_0x23c34b[_0x741b('0x21')]==_0x3dfb81;});if(_[_0x741b('0x22')](_0x497a90)){var _0x65918b=_[_0x741b('0x1f')](this[_0x741b('0xe')],function(_0x361063){return _0x361063[_0x741b('0x20')]==_0x3dfb81||_0x361063[_0x741b('0x21')]==_0x3dfb81;});if(_0x65918b){_0x497a90=_['find'](this[_0x741b('0xd')],function(_0x89db14){return _0x89db14[_0x741b('0x23')]==util[_0x741b('0x24')]('SIP/%s',_0x65918b[_0x741b('0x21')]);});}}return _0x497a90;};Report[_0x741b('0xf')][_0x741b('0x12')]=function(_0x2be8ae){for(var _0x4c3f4f=0x0;_0x4c3f4f<_0x2be8ae[_0x741b('0x25')];_0x4c3f4f+=0x1){var _0x292581=this[_0x741b('0x1e')](_0x2be8ae[_0x4c3f4f][_0x741b('0x26')]);if(_0x292581){_0x2be8ae[_0x4c3f4f]['accountcode']=_0x292581[_0x741b('0x20')];_0x2be8ae[_0x4c3f4f][_0x741b('0x27')]=!![];_0x2be8ae[_0x4c3f4f][_0x741b('0x28')]=_0x292581[_0x741b('0x21')];_0x2be8ae[_0x4c3f4f][_0x741b('0x23')]=_[_0x741b('0x22')](_0x292581[_0x741b('0x23')])?util[_0x741b('0x24')](_0x741b('0x29'),_0x292581[_0x741b('0x21')]):_0x292581[_0x741b('0x23')];if(_0x2be8ae[_0x4c3f4f][_0x741b('0x2a')]){_0x2be8ae[_0x4c3f4f][_0x741b('0x2b')]=moment()[_0x741b('0x24')](_0x741b('0x2c'));}if(_0x2be8ae[_0x4c3f4f][_0x741b('0x2d')]){_0x2be8ae[_0x4c3f4f]['queuecallerexitAt']=moment()['format'](_0x741b('0x2c'));}RpcMemberReport[_0x741b('0x12')](_0x2be8ae[_0x4c3f4f]);}RpcVoiceQueueReport[_0x741b('0x2e')](_0x2be8ae[_0x4c3f4f]);}};function extractCalleridNumber(_0x328252){var _0x2128a7=_0x328252[_0x741b('0x2f')](/<(.*?)>/);return _0x2128a7?_0x2128a7[0x1]:_0x328252;}Report[_0x741b('0xf')][_0x741b('0x14')]=function(_0x101e8f){_0x101e8f[_0x741b('0x30')]=_0x101e8f['destination']||_0x101e8f[_0x741b('0x31')];if(_0x101e8f[_0x741b('0x32')]=='dialer'){_0x101e8f[_0x741b('0x33')]=_0x741b('0x34');_0x101e8f['lastdata']=_0x101e8f[_0x741b('0x34')];if(_0x101e8f[_0x741b('0x35')]=='from-voip-provider'){_0x101e8f[_0x741b('0x20')]='';_0x101e8f['destination']=extractCalleridNumber(_0x101e8f[_0x741b('0x36')]);}else if(_0x101e8f['context']==_0x741b('0x37')){if(_0x101e8f[_0x741b('0x30')]==_0x741b('0x38')){_0x101e8f[_0x741b('0x30')]=extractCalleridNumber(_0x101e8f['calleridpreview']);_0x101e8f[_0x741b('0x39')]=_0x101e8f[_0x741b('0x3a')];_0x101e8f[_0x741b('0x3b')]=[_0x101e8f[_0x741b('0x3c')],_0x101e8f[_0x741b('0x3c')]=_0x101e8f[_0x741b('0x3b')]][0x0];_0x101e8f[_0x741b('0x36')]=_0x101e8f['calleridpreview'];}else{_0x101e8f[_0x741b('0x30')]=_0x101e8f['calleridnum'];_0x101e8f[_0x741b('0x39')]=_0x101e8f[_0x741b('0x3a')];if(_0x101e8f[_0x741b('0x3d')]=='ANSWERED'){_0x101e8f[_0x741b('0x20')]=_0x101e8f[_0x741b('0x26')];}else{_0x101e8f[_0x741b('0x20')]='';}}}}else{_0x101e8f[_0x741b('0x36')]=util[_0x741b('0x24')](_0x741b('0x3e'),_0x101e8f['calleridname'],_0x101e8f[_0x741b('0x39')]);}if(RpcVoiceTransferReport[_0x741b('0x3f')][_0x101e8f['linkedid']]){var _0x45ac91=RpcVoiceTransferReport[_0x741b('0x3f')][_0x101e8f[_0x741b('0x40')]];_0x45ac91[_0x741b('0x41')]=_0x101e8f[_0x741b('0x42')];RpcVoiceTransferReport[_0x741b('0x1b')](_0x45ac91);delete RpcVoiceTransferReport['transfers'][_0x101e8f['linkedid']];}RpcVoiceCallReport[_0x741b('0x2e')](_0x101e8f);if(_0x101e8f[_0x741b('0x43')]){for(var _0x2bf438=0x0;_0x2bf438<_0x101e8f[_0x741b('0x44')]['length'];_0x2bf438+=0x1){_0x101e8f[_0x741b('0x45')]=_0x101e8f['monitors'][_0x2bf438][_0x741b('0x46')];_0x101e8f[_0x741b('0x47')]=_0x101e8f[_0x741b('0x44')][_0x2bf438][_0x741b('0x47')];if(_0x101e8f[_0x741b('0x31')]==_0x741b('0x38')){_0x101e8f['calleridnum']=_0x101e8f['connectedlinenum'];_0x101e8f[_0x741b('0x48')]=_0x101e8f[_0x741b('0x49')];_0x101e8f[_0x741b('0x26')]=_0x101e8f[_0x741b('0x20')];_0x101e8f['connectedlinename']=_0x101e8f['membername'];_0x101e8f['exten']=_0x101e8f[_0x741b('0x3a')];}else if(_0x101e8f[_0x741b('0x31')]==_0x741b('0x4a')){_0x101e8f['calleridnum']=_0x101e8f[_0x741b('0x30')];_0x101e8f[_0x741b('0x31')]=_0x101e8f[_0x741b('0x3a')];}RpcVoiceRecording[_0x741b('0x2e')](_0x101e8f);}}};Report[_0x741b('0xf')][_0x741b('0x17')]=function(_0x375d25){if(_[_0x741b('0x4b')](_0x375d25)){_0x375d25[_0x741b('0x4c')](function(_0xcff17a){RpcVoiceAgentReport[_0x741b('0x2e')](_0xcff17a);});}else{RpcVoiceAgentReport[_0x741b('0x2e')](_0x375d25);}};Report[_0x741b('0xf')][_0x741b('0x19')]=function(_0x32be90){RpcVoiceDialReport['create'](_0x32be90);var _0x1b033b;var _0x24efc9;var _0x1f257d=_0x32be90[_0x741b('0x3c')];if(_[_0x741b('0x4d')](_0x1f257d,'Local')){_0x24efc9=_0x1f257d[_0x741b('0x4e')](_0x1f257d[_0x741b('0x4f')]('/')+0x1,_0x1f257d[_0x741b('0x4f')]('@'));_0x1b033b=_[_0x741b('0x1f')](this[_0x741b('0xd')],function(_0x4b53c7){return _0x4b53c7['mobile']==_0x24efc9||_0x4b53c7[_0x741b('0x50')]==_0x24efc9||_0x4b53c7[_0x741b('0x20')]==_0x24efc9;});}else{_0x24efc9=_0x1f257d[_0x741b('0x4e')](_0x1f257d[_0x741b('0x4f')]('/')+0x1,_0x1f257d[_0x741b('0x51')]('-'));_0x1b033b=this[_0x741b('0x1e')](_0x24efc9);}if(_0x1b033b){_0x32be90[_0x741b('0x23')]=_[_0x741b('0x22')](_0x1b033b['interface'])?util[_0x741b('0x24')](_0x741b('0x29'),_0x1b033b[_0x741b('0x21')]):_0x1b033b['interface'];_0x32be90['membername']=_0x1b033b['name'];_0x32be90[_0x741b('0x20')]=_0x1b033b[_0x741b('0x20')];RpcMemberReport[_0x741b('0x19')](_0x32be90);}};Report[_0x741b('0xf')][_0x741b('0x1b')]=function(_0x59b374){RpcVoiceTransferReport[_0x741b('0x3f')][_0x59b374[_0x741b('0x52')]]=_0x59b374;};Report[_0x741b('0xf')][_0x741b('0x1d')]=function(_0x349120){RpcVoiceTransferReport[_0x741b('0x1d')](_0x349120);};module[_0x741b('0x53')]=Report; \ No newline at end of file +var _0x1e3f=['SIP/%s','length','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','match','exten','dialer','queue','context','destination','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','create','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0x1e3f,0x1dc));var _0xf1e3=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x1e3f[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require(_0xf1e3('0x0'));var moment=require(_0xf1e3('0x1'));var util=require(_0xf1e3('0x2'));var config=require(_0xf1e3('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xf1e3('0x4'));var RpcMemberReport=require(_0xf1e3('0x5'));var RpcVoiceQueueReport=require(_0xf1e3('0x6'));var RpcVoiceRecording=require(_0xf1e3('0x7'));var RpcVoiceTransferReport=require(_0xf1e3('0x8'));var VoiceQueueReport=require(_0xf1e3('0x9'));var VoiceCallReport=require(_0xf1e3('0xa'));var VoiceAgentReport=require(_0xf1e3('0xb'));var VoiceDialReport=require(_0xf1e3('0xc'));var UserReport=require(_0xf1e3('0xd'));function Report(_0x18c9ec){this[_0xf1e3('0xe')]=_0x18c9ec;this[_0xf1e3('0xf')]=_0x18c9ec[_0xf1e3('0xf')];this[_0xf1e3('0x10')]=_0x18c9ec[_0xf1e3('0x10')];}Report[_0xf1e3('0x11')][_0xf1e3('0x12')]=function(_0x4a9af4){var _0x690f2e=new VoiceQueueReport(this['realtime']);var _0x23f3db=new VoiceAgentReport(this[_0xf1e3('0xe')]);var _0x588d2b=new VoiceDialReport(this[_0xf1e3('0xe')]);var _0x1faa18=new VoiceCallReport(this[_0xf1e3('0xe')]);var _0x4b55d7=new UserReport(this['realtime']);if(config[_0xf1e3('0x13')]&&config['xdr']['disabled']){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xf1e3('0x14')](this));ami['on'](_0xf1e3('0x15'),this[_0xf1e3('0x16')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xf1e3('0x17')]['bind'](this));ami['on'](_0xf1e3('0x18'),this['voiceDialReport'][_0xf1e3('0x14')](this));ami['on'](_0xf1e3('0x19'),this[_0xf1e3('0x1a')][_0xf1e3('0x14')](this));ami['on']('attendedtransfer',this[_0xf1e3('0x1b')][_0xf1e3('0x14')](this));}};Report[_0xf1e3('0x11')][_0xf1e3('0x1c')]=function(_0x282bae){var _0x5b5402;_0x5b5402=_[_0xf1e3('0x1d')](this[_0xf1e3('0xf')],function(_0x5e42e7){return _0x5e42e7[_0xf1e3('0x1e')]==_0x282bae||_0x5e42e7[_0xf1e3('0x1f')]==_0x282bae;});if(_[_0xf1e3('0x20')](_0x5b5402)){var _0x160f99=_[_0xf1e3('0x1d')](this[_0xf1e3('0x10')],function(_0x57c723){return _0x57c723[_0xf1e3('0x1e')]==_0x282bae||_0x57c723[_0xf1e3('0x1f')]==_0x282bae;});if(_0x160f99){_0x5b5402=_[_0xf1e3('0x1d')](this[_0xf1e3('0xf')],function(_0x2c9281){return _0x2c9281[_0xf1e3('0x21')]==util['format'](_0xf1e3('0x22'),_0x160f99[_0xf1e3('0x1f')]);});}}return _0x5b5402;};Report['prototype']['voiceQueueReport']=function(_0x4ff6c8){for(var _0x11e4dd=0x0;_0x11e4dd<_0x4ff6c8[_0xf1e3('0x23')];_0x11e4dd+=0x1){var _0x3e3dcb=this[_0xf1e3('0x1c')](_0x4ff6c8[_0x11e4dd]['connectedlinenum']);if(_0x3e3dcb){_0x4ff6c8[_0x11e4dd]['accountcode']=_0x3e3dcb['accountcode'];_0x4ff6c8[_0x11e4dd][_0xf1e3('0x24')]=!![];_0x4ff6c8[_0x11e4dd]['lastAssignedTo']=_0x3e3dcb[_0xf1e3('0x1f')];_0x4ff6c8[_0x11e4dd][_0xf1e3('0x21')]=_['isNil'](_0x3e3dcb['interface'])?util[_0xf1e3('0x25')](_0xf1e3('0x22'),_0x3e3dcb[_0xf1e3('0x1f')]):_0x3e3dcb['interface'];if(_0x4ff6c8[_0x11e4dd][_0xf1e3('0x26')]){_0x4ff6c8[_0x11e4dd][_0xf1e3('0x27')]=moment()[_0xf1e3('0x25')](_0xf1e3('0x28'));}if(_0x4ff6c8[_0x11e4dd][_0xf1e3('0x29')]){_0x4ff6c8[_0x11e4dd][_0xf1e3('0x2a')]=moment()[_0xf1e3('0x25')](_0xf1e3('0x28'));}RpcMemberReport[_0xf1e3('0x2b')](_0x4ff6c8[_0x11e4dd]);}RpcVoiceQueueReport['create'](_0x4ff6c8[_0x11e4dd]);}};function extractCalleridNumber(_0x594a7c){var _0x27da66=_0x594a7c[_0xf1e3('0x2c')](/<(.*?)>/);return _0x27da66?_0x27da66[0x1]:_0x594a7c;}Report[_0xf1e3('0x11')][_0xf1e3('0x16')]=function(_0x52a440){_0x52a440['destination']=_0x52a440['destination']||_0x52a440[_0xf1e3('0x2d')];if(_0x52a440['type']==_0xf1e3('0x2e')){_0x52a440['lastapplication']=_0xf1e3('0x2f');_0x52a440['lastdata']=_0x52a440[_0xf1e3('0x2f')];if(_0x52a440[_0xf1e3('0x30')]=='from-voip-provider'){_0x52a440[_0xf1e3('0x1e')]='';_0x52a440[_0xf1e3('0x31')]=extractCalleridNumber(_0x52a440[_0xf1e3('0x32')]);}else if(_0x52a440[_0xf1e3('0x30')]==_0xf1e3('0x33')){if(_0x52a440[_0xf1e3('0x31')]=='xcally-motion-preview'){_0x52a440[_0xf1e3('0x31')]=extractCalleridNumber(_0x52a440[_0xf1e3('0x34')]);_0x52a440[_0xf1e3('0x35')]=_0x52a440[_0xf1e3('0x36')];_0x52a440['destinationchannel']=[_0x52a440[_0xf1e3('0x37')],_0x52a440[_0xf1e3('0x37')]=_0x52a440[_0xf1e3('0x38')]][0x0];_0x52a440['callerid']=_0x52a440[_0xf1e3('0x34')];}else{_0x52a440[_0xf1e3('0x31')]=_0x52a440['calleridnum'];_0x52a440['calleridnum']=_0x52a440[_0xf1e3('0x36')];if(_0x52a440[_0xf1e3('0x39')]==_0xf1e3('0x3a')){_0x52a440['accountcode']=_0x52a440[_0xf1e3('0x3b')];}else{_0x52a440['accountcode']='';}}}}else{_0x52a440[_0xf1e3('0x32')]=util[_0xf1e3('0x25')](_0xf1e3('0x3c'),_0x52a440[_0xf1e3('0x3d')],_0x52a440[_0xf1e3('0x35')]);}if(RpcVoiceTransferReport[_0xf1e3('0x3e')][_0x52a440[_0xf1e3('0x3f')]]){var _0x4f90a6=RpcVoiceTransferReport[_0xf1e3('0x3e')][_0x52a440[_0xf1e3('0x3f')]];_0x4f90a6[_0xf1e3('0x40')]=_0x52a440[_0xf1e3('0x41')];RpcVoiceTransferReport['blindTransfer'](_0x4f90a6);delete RpcVoiceTransferReport[_0xf1e3('0x3e')][_0x52a440[_0xf1e3('0x3f')]];}RpcVoiceCallReport[_0xf1e3('0x42')](_0x52a440);if(_0x52a440['monitor']){for(var _0x213414=0x0;_0x213414<_0x52a440[_0xf1e3('0x43')]['length'];_0x213414+=0x1){_0x52a440[_0xf1e3('0x44')]=_0x52a440[_0xf1e3('0x43')][_0x213414][_0xf1e3('0x45')];_0x52a440[_0xf1e3('0x46')]=_0x52a440[_0xf1e3('0x43')][_0x213414]['createdAt'];if(_0x52a440['exten']=='xcally-motion-preview'){_0x52a440[_0xf1e3('0x35')]=_0x52a440[_0xf1e3('0x3b')];_0x52a440[_0xf1e3('0x3d')]=_0x52a440[_0xf1e3('0x47')];_0x52a440[_0xf1e3('0x3b')]=_0x52a440[_0xf1e3('0x1e')];_0x52a440[_0xf1e3('0x47')]=_0x52a440[_0xf1e3('0x48')];_0x52a440[_0xf1e3('0x2d')]=_0x52a440['originatecalleridnum'];}else if(_0x52a440[_0xf1e3('0x2d')]==_0xf1e3('0x49')){_0x52a440[_0xf1e3('0x35')]=_0x52a440[_0xf1e3('0x31')];_0x52a440[_0xf1e3('0x2d')]=_0x52a440[_0xf1e3('0x36')];}RpcVoiceRecording[_0xf1e3('0x42')](_0x52a440);}}};Report[_0xf1e3('0x11')][_0xf1e3('0x17')]=function(_0x3e30a0){if(_['isArray'](_0x3e30a0)){_0x3e30a0[_0xf1e3('0x4a')](function(_0x3d8934){RpcVoiceAgentReport[_0xf1e3('0x42')](_0x3d8934);});}else{RpcVoiceAgentReport[_0xf1e3('0x42')](_0x3e30a0);}};Report[_0xf1e3('0x11')][_0xf1e3('0x4b')]=function(_0x446c5e){RpcVoiceDialReport['create'](_0x446c5e);var _0x507c13;var _0x2c3369;var _0x18257f=_0x446c5e[_0xf1e3('0x37')];if(_[_0xf1e3('0x4c')](_0x18257f,_0xf1e3('0x4d'))){_0x2c3369=_0x18257f[_0xf1e3('0x4e')](_0x18257f[_0xf1e3('0x4f')]('/')+0x1,_0x18257f[_0xf1e3('0x4f')]('@'));_0x507c13=_[_0xf1e3('0x1d')](this['agents'],function(_0x5570a7){return _0x5570a7[_0xf1e3('0x50')]==_0x2c3369||_0x5570a7[_0xf1e3('0x51')]==_0x2c3369||_0x5570a7[_0xf1e3('0x1e')]==_0x2c3369;});}else{_0x2c3369=_0x18257f[_0xf1e3('0x4e')](_0x18257f[_0xf1e3('0x4f')]('/')+0x1,_0x18257f[_0xf1e3('0x52')]('-'));_0x507c13=this['findAgent'](_0x2c3369);}if(_0x507c13){_0x446c5e['interface']=_[_0xf1e3('0x20')](_0x507c13[_0xf1e3('0x21')])?util[_0xf1e3('0x25')](_0xf1e3('0x22'),_0x507c13['name']):_0x507c13['interface'];_0x446c5e[_0xf1e3('0x48')]=_0x507c13[_0xf1e3('0x1f')];_0x446c5e[_0xf1e3('0x1e')]=_0x507c13[_0xf1e3('0x1e')];RpcMemberReport[_0xf1e3('0x4b')](_0x446c5e);}};Report[_0xf1e3('0x11')]['blindTransfer']=function(_0x3ce76b){RpcVoiceTransferReport[_0xf1e3('0x3e')][_0x3ce76b[_0xf1e3('0x53')]]=_0x3ce76b;};Report[_0xf1e3('0x11')][_0xf1e3('0x1b')]=function(_0x4b0031){RpcVoiceTransferReport[_0xf1e3('0x1b')](_0x4b0031);};module[_0xf1e3('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 64a5058..6bb9911 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcb6=['device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','bind','syncRegistry','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','stateRegistry','state','merge','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save'];(function(_0x4cf8d4,_0x5aee73){var _0x2c1beb=function(_0x39b0a4){while(--_0x39b0a4){_0x4cf8d4['push'](_0x4cf8d4['shift']());}};_0x2c1beb(++_0x5aee73);}(_0xdcb6,0xae));var _0x6dcb=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xdcb6[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x6dcb('0x0'));var moment=require(_0x6dcb('0x1'));var util=require(_0x6dcb('0x2'));var Redis=require(_0x6dcb('0x3'));var BPromise=require(_0x6dcb('0x4'));var config=require(_0x6dcb('0x5'));var logger=require(_0x6dcb('0x6'))(_0x6dcb('0x7'));var ami=require(_0x6dcb('0x8'));config[_0x6dcb('0x9')]=_['defaults'](config['redis'],{'host':_0x6dcb('0xa'),'port':0x18eb});var io=require(_0x6dcb('0xb'))(new Redis(config[_0x6dcb('0x9')]));function UserReport(_0x363a89){this['trunks']=_0x363a89[_0x6dcb('0xc')];this[_0x6dcb('0xd')]=_0x363a89[_0x6dcb('0xd')];this[_0x6dcb('0xe')]=_0x363a89['telephones'];ami['on']('registryentry',this['syncRegistry'][_0x6dcb('0xf')](this));ami['on']('registry',this[_0x6dcb('0x10')][_0x6dcb('0xf')](this));ami['on']('devicestatechange',this[_0x6dcb('0x11')][_0x6dcb('0xf')](this));ami['on'](_0x6dcb('0x12'),this[_0x6dcb('0x13')][_0x6dcb('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x6dcb('0x14')]()[_0x6dcb('0x15')](ami[_0x6dcb('0x16')]())['catch'](function(_0x421f16){logger[_0x6dcb('0x17')](_0x6dcb('0x18'),util[_0x6dcb('0x19')](_0x421f16,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x6dcb('0x1a')]())[_0x6dcb('0x1b')](function(_0x3117ec){logger[_0x6dcb('0x17')](_0x6dcb('0x1c'),util[_0x6dcb('0x19')](_0x3117ec,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x6dcb('0x14')]()[_0x6dcb('0x15')](ami[_0x6dcb('0x1d')]())[_0x6dcb('0x1b')](function(_0xa0687f){logger[_0x6dcb('0x17')](_0x6dcb('0x1e'),util[_0x6dcb('0x19')](_0xa0687f,{'showHidden':![],'depth':null}));});}UserReport[_0x6dcb('0x1f')][_0x6dcb('0x20')]=function(){setInterval(function(){BPromise[_0x6dcb('0x14')]()[_0x6dcb('0x15')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x6dcb('0x1f')][_0x6dcb('0x21')]=function(_0x21c0d9){return _0x21c0d9!==null&&!_[_0x6dcb('0x22')](_0x21c0d9);};UserReport[_0x6dcb('0x1f')][_0x6dcb('0x23')]=function(_0x1208f7,_0x33bae1,_0x47334a){io['to'](_0x1208f7)[_0x6dcb('0x23')](_0x33bae1,_0x47334a);};UserReport[_0x6dcb('0x1f')][_0x6dcb('0x10')]=function(_0x153ee8){try{if(this[_0x6dcb('0x21')](_0x153ee8)){logger[_0x6dcb('0x24')](_0x6dcb('0x25'),_0x153ee8[_0x6dcb('0x26')],_0x153ee8['state']);logger[_0x6dcb('0x27')](_0x6dcb('0x28'),util[_0x6dcb('0x19')](_0x153ee8,{'showHidden':![],'depth':null}));var _0x196288=_[_0x6dcb('0x29')](this[_0x6dcb('0xc')],{'defaultuser':_0x153ee8['username']});if(_0x196288){_0x153ee8[_0x6dcb('0x2a')]=_0x153ee8[_0x6dcb('0x2b')];_[_0x6dcb('0x2c')](_0x196288,_['omit'](_0x153ee8,[_0x6dcb('0x2d'),'actionid',_0x6dcb('0x26'),_0x6dcb('0x2b')]));logger[_0x6dcb('0x27')](_0x6dcb('0x2e'),util[_0x6dcb('0x19')](_0x196288,{'showHidden':![],'depth':null}));this[_0x6dcb('0x23')](util[_0x6dcb('0x2f')](_0x6dcb('0x30'),_0x196288[_0x6dcb('0x31')]),_0x6dcb('0x32'),_0x196288);}}}catch(_0x4e7dda){logger[_0x6dcb('0x17')](_0x6dcb('0x28'),util[_0x6dcb('0x19')](_0x4e7dda,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x6dcb('0x11')]=function(_0x4e32de){try{if(this[_0x6dcb('0x21')](_0x4e32de)){logger[_0x6dcb('0x24')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x4e32de[_0x6dcb('0x33')],_0x4e32de[_0x6dcb('0x2b')]);logger[_0x6dcb('0x27')]('[userReport][devicestatechange]',util[_0x6dcb('0x19')](_0x4e32de,{'showHidden':![],'depth':null}));if(this[_0x6dcb('0xd')][_0x4e32de[_0x6dcb('0x33')]]){if(!this[_0x6dcb('0xd')][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x34')]||_0x4e32de[_0x6dcb('0x2b')]['toLowerCase']()==_0x6dcb('0x35')){this['agents'][_0x4e32de['device']][_0x6dcb('0x34')]=![];if(this[_0x6dcb('0xd')][_0x4e32de['device']][_0x6dcb('0x2b')]!==_0x4e32de[_0x6dcb('0x2b')][_0x6dcb('0x36')]()){this['agents'][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x37')]=_[_0x6dcb('0x38')](moment()[_0x6dcb('0x2f')]('x'));}this[_0x6dcb('0xd')][_0x4e32de['device']][_0x6dcb('0x2b')]=_0x4e32de[_0x6dcb('0x2b')][_0x6dcb('0x36')]();this['agents'][_0x4e32de['device']][_0x6dcb('0x39')](_0x4e32de);}}else if(this[_0x6dcb('0xe')][_0x4e32de[_0x6dcb('0x33')]]){if(this[_0x6dcb('0xe')][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x2b')]!==_0x4e32de[_0x6dcb('0x2b')]['toLowerCase']()){this['telephones'][_0x4e32de['device']][_0x6dcb('0x37')]=_['toNumber'](moment()[_0x6dcb('0x2f')]('x'));}this[_0x6dcb('0xe')][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x2b')]=_0x4e32de[_0x6dcb('0x2b')][_0x6dcb('0x36')]();logger[_0x6dcb('0x27')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x6dcb('0xe')][_0x4e32de[_0x6dcb('0x33')]],{'showHidden':![],'depth':null}));this[_0x6dcb('0x23')](util[_0x6dcb('0x2f')](_0x6dcb('0x3a'),this[_0x6dcb('0xe')][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x31')]),'telephone:save',this[_0x6dcb('0xe')][_0x4e32de[_0x6dcb('0x33')]]);}else if(this[_0x6dcb('0xc')][_0x4e32de['device']]){if(this['trunks'][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x2b')]!==_0x4e32de[_0x6dcb('0x2b')]['toLowerCase']()){this[_0x6dcb('0xc')][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x37')]=_[_0x6dcb('0x38')](moment()[_0x6dcb('0x2f')]('x'));}this[_0x6dcb('0xc')][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x2b')]=_0x4e32de[_0x6dcb('0x2b')]['toLowerCase']();logger[_0x6dcb('0x27')](_0x6dcb('0x3b'),util['inspect'](this['trunks'][_0x4e32de[_0x6dcb('0x33')]],{'showHidden':![],'depth':null}));this[_0x6dcb('0x23')](util[_0x6dcb('0x2f')](_0x6dcb('0x30'),this[_0x6dcb('0xc')][_0x4e32de[_0x6dcb('0x33')]][_0x6dcb('0x31')]),'trunk:save',this[_0x6dcb('0xc')][_0x4e32de[_0x6dcb('0x33')]]);}else if(_[_0x6dcb('0x3c')](_0x4e32de[_0x6dcb('0x33')],'Local')){var _0x5bbc6f=_0x4e32de[_0x6dcb('0x33')];var _0x248164=_0x5bbc6f[_0x6dcb('0x3d')](_0x5bbc6f[_0x6dcb('0x3e')]('/')+0x1,_0x5bbc6f[_0x6dcb('0x3e')]('@'));var _0x46c079=_[_0x6dcb('0x29')](this[_0x6dcb('0xd')],function(_0x4ce8f1){return _0x4ce8f1[_0x6dcb('0x3f')]==_0x248164||_0x4ce8f1[_0x6dcb('0x40')]==_0x248164||_0x4ce8f1[_0x6dcb('0x41')]==_0x248164;});if(_0x46c079){if(_0x46c079['state']!==_0x4e32de[_0x6dcb('0x2b')][_0x6dcb('0x36')]()){_0x46c079[_0x6dcb('0x37')]=_[_0x6dcb('0x38')](moment()[_0x6dcb('0x2f')]('x'));}_0x46c079[_0x6dcb('0x2b')]=_0x4e32de[_0x6dcb('0x2b')][_0x6dcb('0x36')]();_0x46c079['local']=!![];_0x46c079[_0x6dcb('0x39')](_0x4e32de);}}}}catch(_0x486bab){logger[_0x6dcb('0x17')](_0x6dcb('0x42'),util[_0x6dcb('0x19')](_0x486bab,{'showHidden':![],'depth':null}));}};UserReport[_0x6dcb('0x1f')][_0x6dcb('0x13')]=function(_0x1f0cc8){try{if(this[_0x6dcb('0x21')](_0x1f0cc8)&&this[_0x6dcb('0x21')](_0x1f0cc8[_0x6dcb('0x12')])){logger[_0x6dcb('0x24')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1f0cc8[_0x6dcb('0x43')],_0x1f0cc8[_0x6dcb('0x44')],_0x1f0cc8['peerstatus']);logger[_0x6dcb('0x27')](_0x6dcb('0x45'),util[_0x6dcb('0x19')](_0x1f0cc8,{'showHidden':![],'depth':null}));if(this[_0x6dcb('0xd')][_0x1f0cc8[_0x6dcb('0x43')]]){if(!this[_0x6dcb('0xd')][_0x1f0cc8[_0x6dcb('0x43')]][_0x6dcb('0x34')]||_0x1f0cc8[_0x6dcb('0x12')][_0x6dcb('0x36')]()==_0x6dcb('0x46')){this[_0x6dcb('0xd')][_0x1f0cc8['peer']][_0x6dcb('0x34')]=![];this[_0x6dcb('0xd')][_0x1f0cc8[_0x6dcb('0x43')]]['status']=_0x1f0cc8[_0x6dcb('0x12')][_0x6dcb('0x36')]();this['agents'][_0x1f0cc8[_0x6dcb('0x43')]][_0x6dcb('0x44')]=_0x1f0cc8[_0x6dcb('0x44')];this[_0x6dcb('0xd')][_0x1f0cc8[_0x6dcb('0x43')]][_0x6dcb('0x39')](_0x1f0cc8);}}else if(this[_0x6dcb('0xe')][_0x1f0cc8['peer']]){this['telephones'][_0x1f0cc8[_0x6dcb('0x43')]][_0x6dcb('0x47')]=_0x1f0cc8[_0x6dcb('0x12')]['toLowerCase']();this[_0x6dcb('0xe')][_0x1f0cc8[_0x6dcb('0x43')]][_0x6dcb('0x44')]=_0x1f0cc8[_0x6dcb('0x44')];logger[_0x6dcb('0x27')](_0x6dcb('0x48'),util[_0x6dcb('0x19')](this[_0x6dcb('0xe')][_0x1f0cc8['peer']],{'showHidden':![],'depth':null}));this[_0x6dcb('0x23')](util[_0x6dcb('0x2f')](_0x6dcb('0x3a'),this[_0x6dcb('0xe')][_0x1f0cc8[_0x6dcb('0x43')]][_0x6dcb('0x31')]),'telephone:save',this[_0x6dcb('0xe')][_0x1f0cc8[_0x6dcb('0x43')]]);}else if(this[_0x6dcb('0xc')][_0x1f0cc8[_0x6dcb('0x43')]]){this[_0x6dcb('0xc')][_0x1f0cc8[_0x6dcb('0x43')]][_0x6dcb('0x47')]=_0x1f0cc8[_0x6dcb('0x12')]['toLowerCase']();this['trunks'][_0x1f0cc8[_0x6dcb('0x43')]]['address']=_0x1f0cc8['address'];logger['debug'](_0x6dcb('0x49'),util[_0x6dcb('0x19')](this['trunks'][_0x1f0cc8[_0x6dcb('0x43')]],{'showHidden':![],'depth':null}));this[_0x6dcb('0x23')](util[_0x6dcb('0x2f')]('trunk:%s',this[_0x6dcb('0xc')][_0x1f0cc8['peer']][_0x6dcb('0x31')]),_0x6dcb('0x32'),this[_0x6dcb('0xc')][_0x1f0cc8['peer']]);}}}catch(_0x5297ca){logger[_0x6dcb('0x17')](_0x6dcb('0x45'),util[_0x6dcb('0x19')](_0x5297ca,{'showHidden':![],'depth':null}));}};module[_0x6dcb('0x4a')]=UserReport; \ No newline at end of file +var _0x741e=['../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','syncPeerStatus','then','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','find','username','merge','omit','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','trunk:save','Local','substring','mobile','phone','accountcode','isNotNull','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]','lodash','moment','ioredis','bluebird'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x741e,0x114));var _0xe741=function(_0xa0de8,_0x7f9804){_0xa0de8=_0xa0de8-0x0;var _0x96d7a9=_0x741e[_0xa0de8];return _0x96d7a9;};'use strict';var _=require(_0xe741('0x0'));var moment=require(_0xe741('0x1'));var util=require('util');var Redis=require(_0xe741('0x2'));var BPromise=require(_0xe741('0x3'));var config=require('../../../config/environment');var logger=require(_0xe741('0x4'))(_0xe741('0x5'));var ami=require('../ami');config[_0xe741('0x6')]=_[_0xe741('0x7')](config[_0xe741('0x6')],{'host':_0xe741('0x8'),'port':0x18eb});var io=require(_0xe741('0x9'))(new Redis(config[_0xe741('0x6')]));function UserReport(_0x164ad8){this[_0xe741('0xa')]=_0x164ad8[_0xe741('0xa')];this[_0xe741('0xb')]=_0x164ad8[_0xe741('0xb')];this[_0xe741('0xc')]=_0x164ad8['telephones'];ami['on'](_0xe741('0xd'),this[_0xe741('0xe')][_0xe741('0xf')](this));ami['on'](_0xe741('0x10'),this['syncRegistry'][_0xe741('0xf')](this));ami['on']('devicestatechange',this[_0xe741('0x11')]['bind'](this));ami['on']('peerstatus',this[_0xe741('0x12')][_0xe741('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0xe741('0x13')](ami['actionSipShowRegistry']())[_0xe741('0x14')](function(_0x2807ce){logger[_0xe741('0x15')](_0xe741('0x16'),util[_0xe741('0x17')](_0x2807ce,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xe741('0x13')](ami[_0xe741('0x18')]())[_0xe741('0x14')](function(_0x19b59b){logger[_0xe741('0x15')](_0xe741('0x19'),util[_0xe741('0x17')](_0x19b59b,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xe741('0x13')](ami[_0xe741('0x1a')]())[_0xe741('0x14')](function(_0x1c72c0){logger['error'](_0xe741('0x1b'),util[_0xe741('0x17')](_0x1c72c0,{'showHidden':![],'depth':null}));});}UserReport[_0xe741('0x1c')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())['then'](listDeviceStates())[_0xe741('0x13')](showPeersStatus());},0x32c8);};UserReport[_0xe741('0x1c')]['isNotNull']=function(_0x1a1551){return _0x1a1551!==null&&!_[_0xe741('0x1d')](_0x1a1551);};UserReport[_0xe741('0x1c')][_0xe741('0x1e')]=function(_0x380580,_0x277f89,_0x5a7f06){io['to'](_0x380580)[_0xe741('0x1e')](_0x277f89,_0x5a7f06);};UserReport[_0xe741('0x1c')][_0xe741('0xe')]=function(_0x31e208){try{if(this['isNotNull'](_0x31e208)){logger[_0xe741('0x1f')](_0xe741('0x20'),_0x31e208['username'],_0x31e208[_0xe741('0x21')]);logger[_0xe741('0x22')]('[userReport][registry]',util['inspect'](_0x31e208,{'showHidden':![],'depth':null}));var _0x3f6f5b=_[_0xe741('0x23')](this[_0xe741('0xa')],{'defaultuser':_0x31e208[_0xe741('0x24')]});if(_0x3f6f5b){_0x31e208['stateRegistry']=_0x31e208['state'];_[_0xe741('0x25')](_0x3f6f5b,_[_0xe741('0x26')](_0x31e208,['event','actionid',_0xe741('0x24'),_0xe741('0x21')]));logger['debug'](_0xe741('0x27'),util['inspect'](_0x3f6f5b,{'showHidden':![],'depth':null}));this[_0xe741('0x1e')](util[_0xe741('0x28')](_0xe741('0x29'),_0x3f6f5b[_0xe741('0x2a')]),'trunk:save',_0x3f6f5b);}}}catch(_0x317662){logger[_0xe741('0x15')]('[userReport][registry]',util['inspect'](_0x317662,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xe741('0x11')]=function(_0x2154fe){try{if(this['isNotNull'](_0x2154fe)){logger[_0xe741('0x1f')](_0xe741('0x2b'),_0x2154fe['device'],_0x2154fe['state']);logger[_0xe741('0x22')](_0xe741('0x2c'),util[_0xe741('0x17')](_0x2154fe,{'showHidden':![],'depth':null}));if(this['agents'][_0x2154fe[_0xe741('0x2d')]]){if(!this[_0xe741('0xb')][_0x2154fe['device']]['local']||_0x2154fe[_0xe741('0x21')][_0xe741('0x2e')]()==_0xe741('0x2f')){this[_0xe741('0xb')][_0x2154fe['device']][_0xe741('0x30')]=![];if(this[_0xe741('0xb')][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x21')]!==_0x2154fe[_0xe741('0x21')][_0xe741('0x2e')]()){this['agents'][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x31')]=_['toNumber'](moment()[_0xe741('0x28')]('x'));}this[_0xe741('0xb')][_0x2154fe[_0xe741('0x2d')]]['state']=_0x2154fe[_0xe741('0x21')][_0xe741('0x2e')]();this[_0xe741('0xb')][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x32')](_0x2154fe);}}else if(this[_0xe741('0xc')][_0x2154fe[_0xe741('0x2d')]]){if(this[_0xe741('0xc')][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x21')]!==_0x2154fe['state'][_0xe741('0x2e')]()){this[_0xe741('0xc')][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x31')]=_[_0xe741('0x33')](moment()[_0xe741('0x28')]('x'));}this['telephones'][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x21')]=_0x2154fe[_0xe741('0x21')][_0xe741('0x2e')]();logger[_0xe741('0x22')](_0xe741('0x34'),util[_0xe741('0x17')](this[_0xe741('0xc')][_0x2154fe[_0xe741('0x2d')]],{'showHidden':![],'depth':null}));this[_0xe741('0x1e')](util[_0xe741('0x28')](_0xe741('0x35'),this[_0xe741('0xc')][_0x2154fe['device']]['name']),_0xe741('0x36'),this[_0xe741('0xc')][_0x2154fe[_0xe741('0x2d')]]);}else if(this[_0xe741('0xa')][_0x2154fe[_0xe741('0x2d')]]){if(this[_0xe741('0xa')][_0x2154fe[_0xe741('0x2d')]]['state']!==_0x2154fe[_0xe741('0x21')][_0xe741('0x2e')]()){this[_0xe741('0xa')][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x31')]=_[_0xe741('0x33')](moment()[_0xe741('0x28')]('x'));}this[_0xe741('0xa')][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x21')]=_0x2154fe[_0xe741('0x21')][_0xe741('0x2e')]();logger[_0xe741('0x22')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xe741('0x17')](this[_0xe741('0xa')][_0x2154fe[_0xe741('0x2d')]],{'showHidden':![],'depth':null}));this[_0xe741('0x1e')](util[_0xe741('0x28')](_0xe741('0x29'),this['trunks'][_0x2154fe[_0xe741('0x2d')]][_0xe741('0x2a')]),_0xe741('0x37'),this[_0xe741('0xa')][_0x2154fe[_0xe741('0x2d')]]);}else if(_['startsWith'](_0x2154fe['device'],_0xe741('0x38'))){var _0x10a9b4=_0x2154fe[_0xe741('0x2d')];var _0xf1c882=_0x10a9b4[_0xe741('0x39')](_0x10a9b4['indexOf']('/')+0x1,_0x10a9b4['indexOf']('@'));var _0x37d360=_[_0xe741('0x23')](this[_0xe741('0xb')],function(_0x3d0f47){return _0x3d0f47[_0xe741('0x3a')]==_0xf1c882||_0x3d0f47[_0xe741('0x3b')]==_0xf1c882||_0x3d0f47[_0xe741('0x3c')]==_0xf1c882;});if(_0x37d360){if(_0x37d360[_0xe741('0x21')]!==_0x2154fe[_0xe741('0x21')][_0xe741('0x2e')]()){_0x37d360['stateTime']=_[_0xe741('0x33')](moment()[_0xe741('0x28')]('x'));}_0x37d360[_0xe741('0x21')]=_0x2154fe[_0xe741('0x21')][_0xe741('0x2e')]();_0x37d360['local']=!![];_0x37d360[_0xe741('0x32')](_0x2154fe);}}}}catch(_0x52756b){logger[_0xe741('0x15')](_0xe741('0x2c'),util[_0xe741('0x17')](_0x52756b,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xe741('0x12')]=function(_0x57a277){try{if(this['isNotNull'](_0x57a277)&&this[_0xe741('0x3d')](_0x57a277[_0xe741('0x3e')])){logger[_0xe741('0x1f')](_0xe741('0x3f'),_0x57a277['peer'],_0x57a277[_0xe741('0x40')],_0x57a277['peerstatus']);logger['debug']('[userReport][peerstatus]',util[_0xe741('0x17')](_0x57a277,{'showHidden':![],'depth':null}));if(this['agents'][_0x57a277[_0xe741('0x41')]]){if(!this[_0xe741('0xb')][_0x57a277[_0xe741('0x41')]]['local']||_0x57a277[_0xe741('0x3e')][_0xe741('0x2e')]()==_0xe741('0x42')){this['agents'][_0x57a277[_0xe741('0x41')]][_0xe741('0x30')]=![];this['agents'][_0x57a277['peer']][_0xe741('0x43')]=_0x57a277[_0xe741('0x3e')]['toLowerCase']();this[_0xe741('0xb')][_0x57a277[_0xe741('0x41')]]['address']=_0x57a277['address'];this[_0xe741('0xb')][_0x57a277[_0xe741('0x41')]][_0xe741('0x32')](_0x57a277);}}else if(this['telephones'][_0x57a277[_0xe741('0x41')]]){this[_0xe741('0xc')][_0x57a277[_0xe741('0x41')]][_0xe741('0x43')]=_0x57a277[_0xe741('0x3e')][_0xe741('0x2e')]();this[_0xe741('0xc')][_0x57a277[_0xe741('0x41')]]['address']=_0x57a277['address'];logger[_0xe741('0x22')](_0xe741('0x44'),util[_0xe741('0x17')](this[_0xe741('0xc')][_0x57a277['peer']],{'showHidden':![],'depth':null}));this[_0xe741('0x1e')](util[_0xe741('0x28')](_0xe741('0x35'),this[_0xe741('0xc')][_0x57a277[_0xe741('0x41')]][_0xe741('0x2a')]),_0xe741('0x36'),this[_0xe741('0xc')][_0x57a277[_0xe741('0x41')]]);}else if(this[_0xe741('0xa')][_0x57a277[_0xe741('0x41')]]){this[_0xe741('0xa')][_0x57a277[_0xe741('0x41')]][_0xe741('0x43')]=_0x57a277['peerstatus'][_0xe741('0x2e')]();this[_0xe741('0xa')][_0x57a277[_0xe741('0x41')]][_0xe741('0x40')]=_0x57a277[_0xe741('0x40')];logger[_0xe741('0x22')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xe741('0xa')][_0x57a277[_0xe741('0x41')]],{'showHidden':![],'depth':null}));this[_0xe741('0x1e')](util[_0xe741('0x28')](_0xe741('0x29'),this['trunks'][_0x57a277['peer']]['name']),_0xe741('0x37'),this['trunks'][_0x57a277['peer']]);}}}catch(_0x5a065e){logger[_0xe741('0x15')](_0xe741('0x45'),util[_0xe741('0x17')](_0x5a065e,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 4063c49..8a9dd51 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0xc450a6,_0x39c279){var _0x5cc767=function(_0x179216){while(--_0x179216){_0xc450a6['push'](_0xc450a6['shift']());}};_0x5cc767(++_0x39c279);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x18b5b8,_0xdf47c7){var _0x44f309=function(_0x40295b){while(--_0x40295b){_0x18b5b8['push'](_0x18b5b8['shift']());}};_0x44f309(++_0xdf47c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index dcd4df5..248c5e8 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 _0x7b13=['channel','exten','split','destconnectedlinenum','connectedlinenum','emit','format','user:%s','name','user:agentconnect','accountcode','debug','OutgoingSpoolFailed','info','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','toNumber','UserId','membername','routealias','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','find','isNil','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','ATTENDED','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','../model/channel','busy','ringing','ringinuse','set','queue','agi','dial','playback','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','context'];(function(_0x229e53,_0x584c51){var _0x170c25=function(_0x3dcbe6){while(--_0x3dcbe6){_0x229e53['push'](_0x229e53['shift']());}};_0x170c25(++_0x584c51);}(_0x7b13,0x8a));var _0x37b1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7b13[_0x4b369d];return _0x571a98;};'use strict';var BPromise=require(_0x37b1('0x0'));var _=require(_0x37b1('0x1'));var moment=require(_0x37b1('0x2'));var util=require(_0x37b1('0x3'));var path=require(_0x37b1('0x4'));var Redis=require(_0x37b1('0x5'));var config=require(_0x37b1('0x6'));var logger=require('../../../config/logger')(_0x37b1('0x7'));var ami=require(_0x37b1('0x8'));var Channel=require(_0x37b1('0x9'));var RpcSetting=require('../rpc/setting');var statusDesc=['unknown','not_inuse','inuse',_0x37b1('0xa'),'invalid','unavailable',_0x37b1('0xb'),_0x37b1('0xc'),'onhold'];var applications=[_0x37b1('0xd'),_0x37b1('0xe'),_0x37b1('0xf'),_0x37b1('0x10'),_0x37b1('0x11'),'voicemail'];var dispositions=[_0x37b1('0x12'),_0x37b1('0x13'),_0x37b1('0x13'),'NO\x20ANSWER','NO\x20ANSWER',_0x37b1('0x12'),'ANSWERED',_0x37b1('0x14'),_0x37b1('0x13'),'FAILED',_0x37b1('0x13')];var actions={};config[_0x37b1('0x15')]=_[_0x37b1('0x16')](config[_0x37b1('0x15')],{'host':_0x37b1('0x17'),'port':0x18eb});var io=require(_0x37b1('0x18'))(new Redis(config['redis']));function VoiceCallReport(_0x347e51){this[_0x37b1('0x19')]=_0x347e51[_0x37b1('0x19')];this[_0x37b1('0x1a')]=_0x347e51[_0x37b1('0x1a')];this[_0x37b1('0x1b')]={};ami['on'](_0x37b1('0x1c'),this[_0x37b1('0x1d')][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x1f'),this['syncNewExten'][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x20'),this[_0x37b1('0x21')][_0x37b1('0x1e')](this));ami['on']('newstate',this[_0x37b1('0x22')][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x23'),this[_0x37b1('0x24')][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x25'),this[_0x37b1('0x26')][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x27'),this[_0x37b1('0x28')][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x29'),this[_0x37b1('0x2a')][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x2b'),this[_0x37b1('0x2c')][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x2d'),this[_0x37b1('0x2e')][_0x37b1('0x1e')](this));ami['on'](_0x37b1('0x2f'),this[_0x37b1('0x30')]['bind'](this));try{logger['info']('[voiceCallReport][coreshowchannels]\x20started');ami[_0x37b1('0x31')]();}catch(_0x151f33){logger[_0x37b1('0x32')](_0x37b1('0x33'),util[_0x37b1('0x34')](_0x151f33,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x37b1('0x35')][_0x37b1('0x36')]=function(_0x7d1217){return _0x7d1217!==null&&!_['isUndefined'](_0x7d1217);};VoiceCallReport[_0x37b1('0x35')]['emit']=function(_0x4a1fa2,_0xe2b67e,_0x42c09a){io['to'](_0x4a1fa2)['emit'](_0xe2b67e,_0x42c09a);};VoiceCallReport[_0x37b1('0x35')][_0x37b1('0x28')]=function(_0x5cb05e){try{if(this[_0x37b1('0x36')](_0x5cb05e)){logger['info'](_0x37b1('0x37'),_0x5cb05e[_0x37b1('0x38')],_0x5cb05e[_0x37b1('0x39')],_0x5cb05e[_0x37b1('0x3a')]);logger['debug'](_0x37b1('0x3b'),_0x5cb05e[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x5cb05e,{'showHidden':![],'depth':null}));if(_0x5cb05e[_0x37b1('0x38')]===_0x5cb05e[_0x37b1('0x3c')]){if(!_[_0x37b1('0x3d')](this['channels'][_0x5cb05e[_0x37b1('0x38')]])){_[_0x37b1('0x3e')](this[_0x37b1('0x19')][_0x5cb05e[_0x37b1('0x38')]],_[_0x37b1('0x3f')](_0x5cb05e,_[_0x37b1('0x40')](this[_0x37b1('0x19')][_0x5cb05e['uniqueid']])));}}if(_0x5cb05e[_0x37b1('0x41')]==='from-sip'){if(this[_0x37b1('0x1a')][_0x5cb05e[_0x37b1('0x42')]['split']('-')[0x0]]){if(_0x5cb05e[_0x37b1('0x43')]=='xcally-motion-preview'){this['agents'][_0x5cb05e['channel'][_0x37b1('0x44')]('-')[0x0]][_0x37b1('0x45')]=_0x5cb05e[_0x37b1('0x46')];this[_0x37b1('0x47')](util[_0x37b1('0x48')](_0x37b1('0x49'),this[_0x37b1('0x1a')][_0x5cb05e[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]][_0x37b1('0x4a')]),_0x37b1('0x4b'),{'destaccountcode':this[_0x37b1('0x1a')][_0x5cb05e['channel'][_0x37b1('0x44')]('-')[0x0]][_0x37b1('0x4c')],'destconnectedlinenum':_0x5cb05e[_0x37b1('0x46')]});}}}}}catch(_0x255339){logger[_0x37b1('0x32')]('[%s][voiceCallReport][newcallerid]',_0x5cb05e[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x255339,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x1cda98){try{if(this['isNotNull'](_0x1cda98)){logger[_0x37b1('0x4d')]('[%s][voiceCallReport][newchannel]\x20event:',_0x1cda98[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x1cda98,{'showHidden':![],'depth':null}));if(_0x1cda98[_0x37b1('0x38')]===_0x1cda98['linkedid']&&_0x1cda98[_0x37b1('0x42')]!=_0x37b1('0x4e')){if(_[_0x37b1('0x3d')](this[_0x37b1('0x19')][_0x1cda98[_0x37b1('0x38')]])){logger[_0x37b1('0x4f')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x1cda98['uniqueid'],_0x1cda98['context'],_0x1cda98[_0x37b1('0x43')]);this['channels'][_0x1cda98[_0x37b1('0x38')]]=new Channel();this['channels'][_0x1cda98[_0x37b1('0x38')]][_0x37b1('0x50')]=moment()[_0x37b1('0x48')](_0x37b1('0x51'));this[_0x37b1('0x19')][_0x1cda98[_0x37b1('0x38')]][_0x37b1('0x52')]=dispositions[_['toNumber'](_0x1cda98[_0x37b1('0x53')])];_[_0x37b1('0x3e')](this[_0x37b1('0x19')][_0x1cda98[_0x37b1('0x38')]],_['pick'](_0x1cda98,_[_0x37b1('0x40')](this[_0x37b1('0x19')][_0x1cda98['uniqueid']])));if(_0x1cda98['context']===_0x37b1('0x54')){if(this[_0x37b1('0x1a')][_0x1cda98['channel'][_0x37b1('0x44')]('-')[0x0]]){if(_['isUndefined'](this['agents'][_0x1cda98[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]][_0x37b1('0x45')])){this[_0x37b1('0x1a')][_0x1cda98[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x1cda98[_0x37b1('0x43')];logger[_0x37b1('0x4d')](_0x37b1('0x55'),_0x1cda98[_0x37b1('0x38')],util[_0x37b1('0x34')]({'destaccountcode':this[_0x37b1('0x1a')][_0x1cda98['channel'][_0x37b1('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1cda98['exten']},{'showHidden':![],'depth':null}));this[_0x37b1('0x47')](util[_0x37b1('0x48')]('user:%s',this[_0x37b1('0x1a')][_0x1cda98[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['name']),_0x37b1('0x4b'),{'destaccountcode':this[_0x37b1('0x1a')][_0x1cda98['channel'][_0x37b1('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1cda98[_0x37b1('0x43')]});}}}}}}}catch(_0x346b86){logger[_0x37b1('0x32')](_0x37b1('0x56'),_0x1cda98[_0x37b1('0x38')],util['inspect'](_0x346b86,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x37b1('0x35')][_0x37b1('0x1d')]=function(_0x198093){try{if(this[_0x37b1('0x36')](_0x198093)){logger[_0x37b1('0x4d')](_0x37b1('0x57'),_0x198093['uniqueid'],util[_0x37b1('0x34')](_0x198093,{'showHidden':![],'depth':null}));if(_0x198093['uniqueid']===_0x198093[_0x37b1('0x3c')]&&_0x198093[_0x37b1('0x43')]!='h'&&_0x198093[_0x37b1('0x42')]!=_0x37b1('0x4e')){_0x198093[_0x37b1('0x58')]=_0x198093[_0x37b1('0x58')]['toLowerCase']();_0x198093[_0x37b1('0x59')]=_0x198093[_0x37b1('0x5a')]&&_0x198093[_0x37b1('0x5a')][_0x37b1('0x5b')]('CDR(routeAlias)')?_0x198093[_0x37b1('0x5a')]:(_0x198093[_0x37b1('0x5a')]||_0x198093[_0x37b1('0x59')])[_0x37b1('0x5c')]();logger[_0x37b1('0x4f')](_0x37b1('0x5d'),_0x198093[_0x37b1('0x38')],_0x198093[_0x37b1('0x58')],_0x198093[_0x37b1('0x59')]);if(_['isUndefined'](this[_0x37b1('0x19')][_0x198093[_0x37b1('0x38')]])){this['channels'][_0x198093[_0x37b1('0x38')]]=new Channel();this['channels'][_0x198093[_0x37b1('0x38')]][_0x37b1('0x50')]=_0x198093['duration']?moment()[_0x37b1('0x5e')](moment[_0x37b1('0x5f')](_0x198093[_0x37b1('0x5f')])[_0x37b1('0x60')](),'seconds')[_0x37b1('0x48')](_0x37b1('0x51')):moment()[_0x37b1('0x48')](_0x37b1('0x51'));this['channels'][_0x198093[_0x37b1('0x38')]]['disposition']=_0x37b1('0x12');}_['merge'](this[_0x37b1('0x19')][_0x198093[_0x37b1('0x38')]],_[_0x37b1('0x3f')](_0x198093,_['keys'](this['channels'][_0x198093[_0x37b1('0x38')]])));if(_[_0x37b1('0x61')](applications,_0x198093['application'])){this[_0x37b1('0x19')][_0x198093[_0x37b1('0x38')]][_0x37b1('0x62')]=_0x198093['application'];this['channels'][_0x198093[_0x37b1('0x38')]]['lastdata']=_0x198093[_0x37b1('0x59')];if(_0x198093[_0x37b1('0x58')]===_0x37b1('0xd')&&_[_0x37b1('0x5b')](_0x198093[_0x37b1('0x59')]['toLowerCase'](),'cdr(')){var _0x3af303=_0x198093[_0x37b1('0x59')][_0x37b1('0x44')]('=');var _0x45f332=_0x3af303[0x0][_0x37b1('0x5c')]()[_0x37b1('0x63')](/cdr\((.*)\)/);if(_0x45f332){this['channels'][_0x198093[_0x37b1('0x38')]][_0x45f332[0x1]]=_0x3af303[0x1];}}else if(_0x198093[_0x37b1('0x58')]===_0x37b1('0xe')){this[_0x37b1('0x19')][_0x198093[_0x37b1('0x38')]][_0x37b1('0xe')]=_0x198093[_0x37b1('0x59')][_0x37b1('0x44')](',')[0x0];}}}}}catch(_0x3b7645){logger[_0x37b1('0x32')](_0x37b1('0x64'),_0x198093['uniqueid'],util[_0x37b1('0x34')](_0x3b7645,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x37b1('0x35')][_0x37b1('0x22')]=function(_0x147707){try{if(this[_0x37b1('0x36')](_0x147707)){logger['info'](_0x37b1('0x65'),_0x147707['uniqueid'],_0x147707[_0x37b1('0x3c')],_0x147707[_0x37b1('0x39')],_0x147707[_0x37b1('0x3a')]);logger[_0x37b1('0x4d')]('[%s][voiceCallReport][newstate]\x20event:',_0x147707[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x147707,{'showHidden':![],'depth':null}));if(_0x147707['uniqueid']!==_0x147707[_0x37b1('0x3c')]){if(this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]]){if(_0x147707['channelstate']==='6'){if(!this[_0x37b1('0x19')][_0x147707['linkedid']][_0x37b1('0x66')]){var _0x1aa0aa=moment();this['channels'][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x66')]=!![];this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x67')]=_0x1aa0aa[_0x37b1('0x48')](_0x37b1('0x51'));if(this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x50')]){this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x68')]=_0x1aa0aa[_0x37b1('0x69')](this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]]['starttime'],_0x37b1('0x60'));}}this['channels'][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x3c')]=_0x147707['uniqueid'];if(_0x147707[_0x37b1('0x3a')]!==_0x37b1('0x6a')){this[_0x37b1('0x19')][_0x147707['linkedid']][_0x37b1('0x46')]=_0x147707['calleridnum'];}this['channels'][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x6b')]=_0x147707['calleridname'];this['channels'][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x6c')]=_0x147707[_0x37b1('0x42')];this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x52')]=dispositions[_[_0x37b1('0x6d')](_0x147707[_0x37b1('0x53')])];if(this[_0x37b1('0x1a')][_0x147707[_0x37b1('0x42')]['split']('-')[0x0]]){this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x6e')]=this[_0x37b1('0x1a')][_0x147707[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['id'];this[_0x37b1('0x19')][_0x147707['linkedid']][_0x37b1('0x6f')]=this[_0x37b1('0x1a')][_0x147707['channel'][_0x37b1('0x44')]('-')[0x0]]['name'];}}}}else{if(this[_0x37b1('0x19')][_0x147707[_0x37b1('0x38')]]){if(_0x147707[_0x37b1('0x53')]==='6'){if(this[_0x37b1('0x1a')][_0x147707[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]){this[_0x37b1('0x19')][_0x147707[_0x37b1('0x38')]][_0x37b1('0x6e')]=this['agents'][_0x147707[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['id'];this[_0x37b1('0x19')][_0x147707['uniqueid']][_0x37b1('0x6f')]=this[_0x37b1('0x1a')][_0x147707[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]][_0x37b1('0x4a')];}}}}if(_0x147707[_0x37b1('0x53')]==='6'&&_0x147707[_0x37b1('0x41')]===_0x37b1('0x54')){if(this[_0x37b1('0x1a')][_0x147707['channel'][_0x37b1('0x44')]('-')[0x0]]){this[_0x37b1('0x1a')][_0x147707[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x147707[_0x37b1('0x43')];var _0x39b0a4;if(this[_0x37b1('0x19')][_0x147707[_0x37b1('0x38')]])_0x39b0a4=this[_0x37b1('0x19')][_0x147707[_0x37b1('0x38')]]['routealias'];else if(this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]])_0x39b0a4=this[_0x37b1('0x19')][_0x147707[_0x37b1('0x3c')]][_0x37b1('0x70')];logger[_0x37b1('0x4d')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x147707[_0x37b1('0x38')],util['inspect']({'destaccountcode':this[_0x37b1('0x1a')][_0x147707[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]][_0x37b1('0x4c')],'destconnectedlinenum':_0x147707[_0x37b1('0x43')],'routealias':_0x39b0a4},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x37b1('0x49'),this[_0x37b1('0x1a')][_0x147707[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]][_0x37b1('0x4a')]),_0x37b1('0x4b'),{'destaccountcode':this[_0x37b1('0x1a')][_0x147707[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x147707['exten'],'routealias':_0x39b0a4});}}}}catch(_0x32121e){logger[_0x37b1('0x32')](_0x37b1('0x71'),_0x147707[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x32121e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x37b1('0x35')][_0x37b1('0x72')]=function(_0x4e3330,_0x4fb55a){try{if(this[_0x37b1('0x19')][_0x4e3330]){logger[_0x37b1('0x4f')](_0x37b1('0x73'),_0x4e3330,_0x4fb55a);this['channels'][_0x4e3330][_0x37b1('0x74')]=!![];if(_[_0x37b1('0x75')](_0x4fb55a,'.wav49')){_0x4fb55a=_0x4fb55a[_0x37b1('0x76')](_0x37b1('0x77'),_0x37b1('0x78'));}this[_0x37b1('0x19')][_0x4e3330][_0x37b1('0x79')]=_0x4fb55a;var _0x207da0=_[_0x37b1('0x7a')](this[_0x37b1('0x19')][_0x4e3330]['monitors'],{'filename':_0x4fb55a});if(_[_0x37b1('0x7b')](_0x207da0)){this[_0x37b1('0x19')][_0x4e3330][_0x37b1('0x7c')]['push']({'filename':_0x4fb55a,'createdAt':moment()[_0x37b1('0x48')](_0x37b1('0x51')),'mixmonitorid':'','status':_0x37b1('0x7d')});}}}catch(_0xca710d){logger[_0x37b1('0x32')](_0x37b1('0x7e'),_0x4e3330,util[_0x37b1('0x34')](_0xca710d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x37b1('0x35')][_0x37b1('0x24')]=function(_0x29306e){try{if(this['isNotNull'](_0x29306e)){logger[_0x37b1('0x4d')](_0x37b1('0x7f'),_0x29306e[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x29306e,{'showHidden':![],'depth':null}));if(this[_0x37b1('0x19')][_0x29306e['uniqueid']]&&_0x29306e[_0x37b1('0x42')]!=_0x37b1('0x4e')){if(this[_0x37b1('0x36')](_0x29306e[_0x37b1('0x80')])){if(this['isNotNull'](_0x29306e[_0x37b1('0x80')][_0x37b1('0x81')])){logger['info'](_0x37b1('0x82'),_0x29306e[_0x37b1('0x38')],_0x29306e[_0x37b1('0x83')]);this['syncMixMonitorFilename'](_0x29306e[_0x37b1('0x38')],_0x29306e['value']);}else if(this[_0x37b1('0x36')](_0x29306e[_0x37b1('0x80')]['xmd-phone'])){logger['info'](_0x37b1('0x84'),_0x29306e[_0x37b1('0x38')],_0x29306e['value']);this[_0x37b1('0x19')][_0x29306e[_0x37b1('0x38')]][_0x37b1('0x3a')]=_0x29306e['value'];}else if(this[_0x37b1('0x36')](_0x29306e[_0x37b1('0x80')]['xmd-callerid'])){logger[_0x37b1('0x4f')](_0x37b1('0x85'),_0x29306e[_0x37b1('0x38')],_0x29306e[_0x37b1('0x83')]);this[_0x37b1('0x19')][_0x29306e[_0x37b1('0x38')]][_0x37b1('0x86')]=_0x29306e[_0x37b1('0x83')];}else if(this[_0x37b1('0x36')](_0x29306e['variable'][_0x37b1('0x87')])){logger[_0x37b1('0x4f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x29306e[_0x37b1('0x38')],_0x29306e[_0x37b1('0x83')]);this[_0x37b1('0x19')][_0x29306e['uniqueid']]['type']=_0x29306e[_0x37b1('0x83')];}else if(this[_0x37b1('0x36')](_0x29306e[_0x37b1('0x80')][_0x37b1('0x88')])){logger['info'](_0x37b1('0x89'),_0x29306e['uniqueid'],_0x29306e[_0x37b1('0x83')][_0x37b1('0x44')](',')[0x0]);this[_0x37b1('0x19')][_0x29306e[_0x37b1('0x38')]][_0x37b1('0xe')]=_0x29306e[_0x37b1('0x83')][_0x37b1('0x44')](',')[0x0];}else if(this['isNotNull'](_0x29306e[_0x37b1('0x80')][_0x37b1('0x8a')])){logger[_0x37b1('0x4f')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x29306e[_0x37b1('0x38')],_0x29306e[_0x37b1('0x83')]);this[_0x37b1('0x19')][_0x29306e[_0x37b1('0x38')]][_0x37b1('0x8b')]=_0x29306e[_0x37b1('0x83')];}else if(this['isNotNull'](_0x29306e[_0x37b1('0x80')][_0x37b1('0x8c')])){logger['info'](_0x37b1('0x8d'),_0x29306e['uniqueid'],_0x29306e[_0x37b1('0x83')]);this['channels'][_0x29306e[_0x37b1('0x38')]][_0x37b1('0x8e')]=_0x29306e['value'];}else if(this['isNotNull'](_0x29306e[_0x37b1('0x80')]['xmd-callerid-preview'])){logger['info'](_0x37b1('0x8f'),_0x29306e[_0x37b1('0x38')],_0x29306e[_0x37b1('0x83')]);this[_0x37b1('0x19')][_0x29306e['uniqueid']][_0x37b1('0x90')]=_0x29306e[_0x37b1('0x83')];}else if(this[_0x37b1('0x36')](_0x29306e[_0x37b1('0x80')]['xmcs-queue'])){logger['info'](_0x37b1('0x91'),_0x29306e[_0x37b1('0x38')],_0x29306e['value']);this[_0x37b1('0x19')][_0x29306e[_0x37b1('0x38')]][_0x37b1('0xe')]=_0x29306e[_0x37b1('0x83')];}else if(this['isNotNull'](_0x29306e[_0x37b1('0x80')][_0x37b1('0x92')])){logger['info'](_0x37b1('0x93'),_0x29306e[_0x37b1('0x38')],_0x29306e['value']);this['channels'][_0x29306e[_0x37b1('0x38')]][_0x37b1('0x94')]=_0x29306e[_0x37b1('0x83')];}}}else if(this[_0x37b1('0x36')](_0x29306e['variable'][_0x37b1('0x81')])){if(_0x29306e[_0x37b1('0x83')]){var _0x18a5ad=path[_0x37b1('0x95')](_0x29306e[_0x37b1('0x83')])[_0x37b1('0x4a')];logger[_0x37b1('0x4f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x18a5ad,_0x29306e[_0x37b1('0x83')]);this['syncMixMonitorFilename'](_0x18a5ad,_0x29306e[_0x37b1('0x83')]);}}else if(this['channels'][_0x29306e[_0x37b1('0x3c')]]){if(this[_0x37b1('0x36')](_0x29306e[_0x37b1('0x80')])){if(this[_0x37b1('0x36')](_0x29306e[_0x37b1('0x80')][_0x37b1('0x92')])){logger[_0x37b1('0x4f')](_0x37b1('0x93'),_0x29306e[_0x37b1('0x3c')],_0x29306e[_0x37b1('0x83')]);this[_0x37b1('0x19')][_0x29306e[_0x37b1('0x3c')]][_0x37b1('0x96')]=_0x29306e['value'];}}}}}catch(_0x3309f0){logger[_0x37b1('0x32')]('[%s][voiceCallReport][varset]',_0x29306e[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x3309f0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x37b1('0x35')]['syncHangup']=function(_0x1df9f2){try{if(this[_0x37b1('0x36')](_0x1df9f2)){logger[_0x37b1('0x4d')](_0x37b1('0x97'),_0x1df9f2['uniqueid'],util[_0x37b1('0x34')](_0x1df9f2,{'showHidden':![],'depth':null}));if(this[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]]){logger[_0x37b1('0x4f')](_0x37b1('0x98'),_0x1df9f2[_0x37b1('0x38')],_0x1df9f2['cause-txt']);var _0x28b6c5=moment();this[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]]['endtime']=_0x28b6c5[_0x37b1('0x48')](_0x37b1('0x51'));this[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]]['duration']=_0x28b6c5[_0x37b1('0x69')](this['channels'][_0x1df9f2[_0x37b1('0x38')]][_0x37b1('0x50')],_0x37b1('0x60'));if(this[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]]['answered']){this[_0x37b1('0x19')][_0x1df9f2['uniqueid']][_0x37b1('0x99')]=_0x28b6c5[_0x37b1('0x69')](this[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]][_0x37b1('0x67')],_0x37b1('0x60'));this['channels'][_0x1df9f2[_0x37b1('0x38')]]['holdtime']=this[_0x37b1('0x19')][_0x1df9f2['uniqueid']][_0x37b1('0x5f')]-this[_0x37b1('0x19')][_0x1df9f2['uniqueid']]['billableseconds'];}if(_0x1df9f2[_0x37b1('0x41')]==='from-sip'){if(this['agents'][_0x1df9f2[_0x37b1('0x42')]['split']('-')[0x0]]){this[_0x37b1('0x1a')][_0x1df9f2['channel'][_0x37b1('0x44')]('-')[0x0]]=_[_0x37b1('0x9a')](this[_0x37b1('0x1a')][_0x1df9f2['channel']['split']('-')[0x0]],[_0x37b1('0x45')]);logger['debug'](_0x37b1('0x9b'),_0x1df9f2['uniqueid'],util[_0x37b1('0x34')]({'id':this[_0x37b1('0x1a')][_0x1df9f2[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x37b1('0x1a')][_0x1df9f2[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x37b1('0x47')](util[_0x37b1('0x48')](_0x37b1('0x49'),this[_0x37b1('0x1a')][_0x1df9f2[_0x37b1('0x42')]['split']('-')[0x0]][_0x37b1('0x4a')]),_0x37b1('0x9c'),{'id':this[_0x37b1('0x1a')][_0x1df9f2[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x37b1('0x1a')][_0x1df9f2[_0x37b1('0x42')][_0x37b1('0x44')]('-')[0x0]][_0x37b1('0x4c')]});}}var _0x80c625=this;Promise[_0x37b1('0x9d')]()[_0x37b1('0x9e')](function(){var _0x2c5bf4=_0x80c625[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]];if(typeof _0x2c5bf4[_0x37b1('0x9f')]==='undefined')return;if(_[_0x37b1('0xa0')](_0x2c5bf4[_0x37b1('0x7c')]))return;return RpcSetting[_0x37b1('0xa1')]()[_0x37b1('0x9e')](function(_0x368f60){if(!_0x368f60[_0x37b1('0xa2')])return;return Promise[_0x37b1('0x9d')]()[_0x37b1('0x9e')](function(){return ami[_0x37b1('0xa3')]({'action':_0x37b1('0xa4'),'channel':_0x2c5bf4[_0x37b1('0x42')]})[_0x37b1('0xa5')](function(){});})[_0x37b1('0x9e')](function(){return ami[_0x37b1('0xa3')]({'action':_0x37b1('0xa4'),'channel':_0x2c5bf4['destinationchannel']})[_0x37b1('0xa5')](function(){})[_0x37b1('0xa6')](function(){var _0x128b0d=_0x80c625['agents'][_0x2c5bf4[_0x37b1('0x6c')][_0x37b1('0x44')]('-')[0x0]];if(!_0x128b0d)return;io[_0x37b1('0x47')](_0x37b1('0xa7'),{'agentId':_0x128b0d['id'],'uniqueid':_0x2c5bf4[_0x37b1('0x38')]});});});});})[_0x37b1('0x9e')](function(){if(_0x1df9f2[_0x37b1('0xa8')]===_0x37b1('0xa9')){_0x80c625[_0x37b1('0x1b')][_0x1df9f2[_0x37b1('0x38')]]=_0x80c625['channels'][_0x1df9f2[_0x37b1('0x38')]];}else{if(_0x80c625[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]][_0x37b1('0xaa')]===_0x37b1('0xab')&&_0x80c625['blindTransfers'][_0x1df9f2[_0x37b1('0x38')]]){_0x80c625[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]][_0x37b1('0x38')]=[_0x80c625[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]][_0x37b1('0x3c')],_0x80c625[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]][_0x37b1('0x3c')]=_0x80c625[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]]['uniqueid']][0x0];delete _0x80c625[_0x37b1('0x1b')][_0x1df9f2[_0x37b1('0x38')]];}}logger[_0x37b1('0x4d')](_0x37b1('0xac'),_0x1df9f2['uniqueid'],util[_0x37b1('0x34')](_0x80c625[_0x37b1('0x19')][_0x1df9f2['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x37b1('0x47')](_0x37b1('0xad'),_0x80c625[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]]);delete _0x80c625[_0x37b1('0x19')][_0x1df9f2[_0x37b1('0x38')]];});}}}catch(_0x6343b3){logger['error'](_0x37b1('0xae'),_0x1df9f2[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x6343b3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x37b1('0x2a')]=function(_0xe8c130){try{if(this[_0x37b1('0x36')](_0xe8c130)){logger[_0x37b1('0x4f')](_0x37b1('0xaf'),_0xe8c130['uniqueid'],_0xe8c130['origtransferercalleridnum'],_0xe8c130[_0x37b1('0xb0')]);logger['debug'](_0x37b1('0xb1'),_0xe8c130[_0x37b1('0x38')],util[_0x37b1('0x34')](_0xe8c130,{'showHidden':![],'depth':null}));if(this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb2')]]){this['channels'][_0xe8c130['transfereeuniqueid']][_0x37b1('0xb3')]=_0xe8c130['origtransferercalleridnum'];this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb2')]][_0x37b1('0xb4')]=_0xe8c130[_0x37b1('0xb0')];if(this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb5')]]){var _0x411c91=this['channels'][_0xe8c130[_0x37b1('0xb5')]];this['channels'][_0xe8c130['secondtransfereruniqueid']]=this['channels'][_0xe8c130[_0x37b1('0xb2')]];this['channels'][_0xe8c130[_0x37b1('0xb2')]]=_0x411c91;}}else if(this['channels'][_0xe8c130[_0x37b1('0xb6')]]){this['channels'][_0xe8c130[_0x37b1('0xb6')]]['transfercalleridnum']=_0xe8c130[_0x37b1('0xb7')];this['channels'][_0xe8c130[_0x37b1('0xb6')]][_0x37b1('0xb4')]=_0xe8c130['transfertargetcalleridnum'];if(this[_0x37b1('0x19')][_0xe8c130['origtransfereruniqueid']]){var _0x411c91=this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb8')]];this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb8')]]=this['channels'][_0xe8c130[_0x37b1('0xb6')]];this[_0x37b1('0x19')][_0xe8c130['transfertargetuniqueid']]=_0x411c91;}}if((this['channels'][_0xe8c130[_0x37b1('0xb8')]]||this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb9')]])&&this['channels'][_0xe8c130['secondtransfereruniqueid']]){var _0x27ca41=_[_0x37b1('0xba')]([this['channels'][_0xe8c130[_0x37b1('0xb8')]],this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb9')]],this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb5')]]],function(_0x5850fa){return _0x5850fa&&_0x5850fa[_0x37b1('0xaa')]===_0x37b1('0xab')&&_0x5850fa['routeid'];});if(_0x27ca41){if(this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb8')]])this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb8')]][_0x37b1('0x9f')]=_0x37b1('0xbb');if(this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb9')]])this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb9')]][_0x37b1('0x9f')]=_0x37b1('0xbb');this[_0x37b1('0x19')][_0xe8c130[_0x37b1('0xb5')]][_0x37b1('0x9f')]=_0x37b1('0xbb');}}}}catch(_0x12caaf){logger[_0x37b1('0x32')]('[%s][voiceCallReport][attendedtransfer]',_0xe8c130['uniqueid'],util['inspect'](_0x12caaf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x37b1('0x35')]['syncBlindTransfer']=function(_0x14dc38){try{if(this[_0x37b1('0x36')](_0x14dc38)){logger['info'](_0x37b1('0xbc'),_0x14dc38[_0x37b1('0x38')],_0x14dc38['transfereecalleridnum'],_0x14dc38[_0x37b1('0xbd')]);logger[_0x37b1('0x4d')](_0x37b1('0xbe'),_0x14dc38[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x14dc38,{'showHidden':![],'depth':null}));if(this[_0x37b1('0x19')][_0x14dc38[_0x37b1('0xb2')]]){this[_0x37b1('0x19')][_0x14dc38[_0x37b1('0xb2')]]['transfercalleridnum']=_0x14dc38[_0x37b1('0xbf')];this[_0x37b1('0x19')][_0x14dc38['transfereeuniqueid']][_0x37b1('0xb4')]=_0x14dc38[_0x37b1('0xbd')];this[_0x37b1('0x19')][_0x14dc38[_0x37b1('0xb2')]][_0x37b1('0x9f')]=_0x37b1('0xc0');this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x14dc38['transfereeuniqueid'],'context':_0x14dc38['context'],'channel':_0x14dc38[_0x37b1('0xc1')]});}else{this['channels'][_0x14dc38[_0x37b1('0xc2')]]['transferType']='BLIND';}}}catch(_0x548498){logger[_0x37b1('0x32')](_0x37b1('0xc3'),_0x14dc38[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x548498,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x37b1('0x35')]['syncMusicOnHoldStart']=function(_0x187d15){try{if(this['isNotNull'](_0x187d15)){logger[_0x37b1('0x4d')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x187d15[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x187d15,{'showHidden':![],'depth':null}));if(this['channels'][_0x187d15[_0x37b1('0x38')]]){if(!_['isNil'](this['channels'][_0x187d15['uniqueid']]['answertime'])){this[_0x37b1('0x19')][_0x187d15[_0x37b1('0x38')]][_0x37b1('0xc4')]=moment()['format'](_0x37b1('0x51'));logger[_0x37b1('0x4f')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x187d15['uniqueid'],this[_0x37b1('0x19')][_0x187d15['uniqueid']]['mohstarttime']);}}}}catch(_0x271d5a){logger['error'](_0x37b1('0xc5'),_0x187d15[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x271d5a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x37b1('0x35')][_0x37b1('0x30')]=function(_0x47164e){try{if(this[_0x37b1('0x36')](_0x47164e)){logger[_0x37b1('0x4d')](_0x37b1('0xc6'),_0x47164e[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x47164e,{'showHidden':![],'depth':null}));if(this[_0x37b1('0x19')][_0x47164e[_0x37b1('0x38')]]){if(!_[_0x37b1('0x7b')](this[_0x37b1('0x19')][_0x47164e[_0x37b1('0x38')]][_0x37b1('0xc4')])){this[_0x37b1('0x19')][_0x47164e[_0x37b1('0x38')]][_0x37b1('0xc7')]+=moment()[_0x37b1('0xc8')](0x0)[_0x37b1('0x69')](this[_0x37b1('0x19')][_0x47164e[_0x37b1('0x38')]]['mohstarttime'],'seconds');logger[_0x37b1('0x4f')](_0x37b1('0xc9'),_0x47164e['uniqueid'],this[_0x37b1('0x19')][_0x47164e[_0x37b1('0x38')]][_0x37b1('0xc7')]);delete this[_0x37b1('0x19')][_0x47164e[_0x37b1('0x38')]][_0x37b1('0xc4')];}}}}catch(_0x190c96){logger['error'](_0x37b1('0xca'),_0x47164e[_0x37b1('0x38')],util[_0x37b1('0x34')](_0x190c96,{'showHidden':![],'depth':null}));}};module[_0x37b1('0xcb')]=VoiceCallReport; \ No newline at end of file +var _0x6ea9=['Action','StopMixMonitor','catch','destinationchannel','finally','webbar:stopmonitors','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','BlindTransfer','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','isNil','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','not_inuse','invalid','unavailable','ringing','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','isUndefined','merge','pick','keys','context','from-sip','channel','exten','xcally-motion-preview','split','destconnectedlinenum','connectedlinenum','format','user:%s','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','name','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','applicationdata','appdata','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','calleridnum','connectedlinename','toNumber','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer'];(function(_0x5cd993,_0x1ba345){var _0x4ad55e=function(_0x569de7){while(--_0x569de7){_0x5cd993['push'](_0x5cd993['shift']());}};_0x4ad55e(++_0x1ba345);}(_0x6ea9,0xfd));var _0x96ea=function(_0x2ca33e,_0xba96d1){_0x2ca33e=_0x2ca33e-0x0;var _0x31045e=_0x6ea9[_0x2ca33e];return _0x31045e;};'use strict';var BPromise=require(_0x96ea('0x0'));var _=require(_0x96ea('0x1'));var moment=require(_0x96ea('0x2'));var util=require(_0x96ea('0x3'));var path=require(_0x96ea('0x4'));var Redis=require(_0x96ea('0x5'));var config=require(_0x96ea('0x6'));var logger=require(_0x96ea('0x7'))(_0x96ea('0x8'));var ami=require('../ami');var Channel=require(_0x96ea('0x9'));var RpcSetting=require(_0x96ea('0xa'));var statusDesc=[_0x96ea('0xb'),_0x96ea('0xc'),'inuse','busy',_0x96ea('0xd'),_0x96ea('0xe'),_0x96ea('0xf'),'ringinuse','onhold'];var applications=[_0x96ea('0x10'),_0x96ea('0x11'),'agi',_0x96ea('0x12'),_0x96ea('0x13'),_0x96ea('0x14')];var dispositions=[_0x96ea('0x15'),'FAILED',_0x96ea('0x16'),_0x96ea('0x15'),_0x96ea('0x15'),_0x96ea('0x15'),_0x96ea('0x17'),_0x96ea('0x18'),_0x96ea('0x16'),_0x96ea('0x16'),'FAILED'];var actions={};config['redis']=_[_0x96ea('0x19')](config[_0x96ea('0x1a')],{'host':_0x96ea('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x2d9399){this[_0x96ea('0x1c')]=_0x2d9399[_0x96ea('0x1c')];this[_0x96ea('0x1d')]=_0x2d9399[_0x96ea('0x1d')];this[_0x96ea('0x1e')]={};ami['on'](_0x96ea('0x1f'),this['syncNewExten'][_0x96ea('0x20')](this));ami['on'](_0x96ea('0x21'),this[_0x96ea('0x22')][_0x96ea('0x20')](this));ami['on'](_0x96ea('0x23'),this[_0x96ea('0x24')]['bind'](this));ami['on'](_0x96ea('0x25'),this[_0x96ea('0x26')]['bind'](this));ami['on'](_0x96ea('0x27'),this[_0x96ea('0x28')][_0x96ea('0x20')](this));ami['on'](_0x96ea('0x29'),this[_0x96ea('0x2a')][_0x96ea('0x20')](this));ami['on'](_0x96ea('0x2b'),this[_0x96ea('0x2c')][_0x96ea('0x20')](this));ami['on']('attendedtransfer',this[_0x96ea('0x2d')][_0x96ea('0x20')](this));ami['on'](_0x96ea('0x2e'),this['syncBlindTransfer'][_0x96ea('0x20')](this));ami['on'](_0x96ea('0x2f'),this[_0x96ea('0x30')][_0x96ea('0x20')](this));ami['on'](_0x96ea('0x31'),this[_0x96ea('0x32')][_0x96ea('0x20')](this));try{logger[_0x96ea('0x33')](_0x96ea('0x34'));ami[_0x96ea('0x35')]();}catch(_0x1edd64){logger['error'](_0x96ea('0x36'),util[_0x96ea('0x37')](_0x1edd64,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x96ea('0x38')][_0x96ea('0x39')]=function(_0x11c93b){return _0x11c93b!==null&&!_['isUndefined'](_0x11c93b);};VoiceCallReport[_0x96ea('0x38')][_0x96ea('0x3a')]=function(_0x47cd54,_0x5995f1,_0x1c2f70){io['to'](_0x47cd54)[_0x96ea('0x3a')](_0x5995f1,_0x1c2f70);};VoiceCallReport[_0x96ea('0x38')][_0x96ea('0x2c')]=function(_0x458cd1){try{if(this[_0x96ea('0x39')](_0x458cd1)){logger[_0x96ea('0x33')](_0x96ea('0x3b'),_0x458cd1[_0x96ea('0x3c')],_0x458cd1[_0x96ea('0x3d')],_0x458cd1['calleridnum']);logger[_0x96ea('0x3e')](_0x96ea('0x3f'),_0x458cd1[_0x96ea('0x3c')],util['inspect'](_0x458cd1,{'showHidden':![],'depth':null}));if(_0x458cd1['uniqueid']===_0x458cd1[_0x96ea('0x40')]){if(!_[_0x96ea('0x41')](this[_0x96ea('0x1c')][_0x458cd1['uniqueid']])){_[_0x96ea('0x42')](this[_0x96ea('0x1c')][_0x458cd1[_0x96ea('0x3c')]],_[_0x96ea('0x43')](_0x458cd1,_[_0x96ea('0x44')](this[_0x96ea('0x1c')][_0x458cd1['uniqueid']])));}}if(_0x458cd1[_0x96ea('0x45')]===_0x96ea('0x46')){if(this['agents'][_0x458cd1[_0x96ea('0x47')]['split']('-')[0x0]]){if(_0x458cd1[_0x96ea('0x48')]==_0x96ea('0x49')){this[_0x96ea('0x1d')][_0x458cd1['channel'][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x4b')]=_0x458cd1[_0x96ea('0x4c')];this[_0x96ea('0x3a')](util[_0x96ea('0x4d')](_0x96ea('0x4e'),this[_0x96ea('0x1d')][_0x458cd1[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]['name']),_0x96ea('0x4f'),{'destaccountcode':this['agents'][_0x458cd1['channel'][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x50')],'destconnectedlinenum':_0x458cd1['connectedlinenum']});}}}}}catch(_0xe97296){logger[_0x96ea('0x51')](_0x96ea('0x52'),_0x458cd1[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0xe97296,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x407818){try{if(this[_0x96ea('0x39')](_0x407818)){logger[_0x96ea('0x3e')](_0x96ea('0x53'),_0x407818[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0x407818,{'showHidden':![],'depth':null}));if(_0x407818['uniqueid']===_0x407818[_0x96ea('0x40')]&&_0x407818[_0x96ea('0x47')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x96ea('0x1c')][_0x407818[_0x96ea('0x3c')]])){logger[_0x96ea('0x33')](_0x96ea('0x54'),_0x407818['uniqueid'],_0x407818[_0x96ea('0x45')],_0x407818[_0x96ea('0x48')]);this['channels'][_0x407818[_0x96ea('0x3c')]]=new Channel();this[_0x96ea('0x1c')][_0x407818[_0x96ea('0x3c')]][_0x96ea('0x55')]=moment()[_0x96ea('0x4d')](_0x96ea('0x56'));this['channels'][_0x407818[_0x96ea('0x3c')]][_0x96ea('0x57')]=dispositions[_['toNumber'](_0x407818[_0x96ea('0x58')])];_[_0x96ea('0x42')](this[_0x96ea('0x1c')][_0x407818[_0x96ea('0x3c')]],_[_0x96ea('0x43')](_0x407818,_[_0x96ea('0x44')](this['channels'][_0x407818[_0x96ea('0x3c')]])));if(_0x407818['context']==='from-sip'){if(this[_0x96ea('0x1d')][_0x407818[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]){if(_[_0x96ea('0x41')](this[_0x96ea('0x1d')][_0x407818['channel'][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x4b')])){this['agents'][_0x407818[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]['destconnectedlinenum']=_0x407818[_0x96ea('0x48')];logger[_0x96ea('0x3e')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x407818['uniqueid'],util[_0x96ea('0x37')]({'destaccountcode':this[_0x96ea('0x1d')][_0x407818[_0x96ea('0x47')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x407818[_0x96ea('0x48')]},{'showHidden':![],'depth':null}));this[_0x96ea('0x3a')](util[_0x96ea('0x4d')]('user:%s',this[_0x96ea('0x1d')][_0x407818[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x59')]),_0x96ea('0x4f'),{'destaccountcode':this['agents'][_0x407818[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x50')],'destconnectedlinenum':_0x407818['exten']});}}}}}}}catch(_0x574acd){logger['error']('[%s][voiceCallReport][newchannel]',_0x407818['uniqueid'],util['inspect'](_0x574acd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x96ea('0x22')]=function(_0x1be87a){try{if(this[_0x96ea('0x39')](_0x1be87a)){logger['debug'](_0x96ea('0x5a'),_0x1be87a['uniqueid'],util['inspect'](_0x1be87a,{'showHidden':![],'depth':null}));if(_0x1be87a['uniqueid']===_0x1be87a['linkedid']&&_0x1be87a[_0x96ea('0x48')]!='h'&&_0x1be87a[_0x96ea('0x47')]!=_0x96ea('0x5b')){_0x1be87a[_0x96ea('0x5c')]=_0x1be87a[_0x96ea('0x5c')]['toLowerCase']();_0x1be87a[_0x96ea('0x5d')]=_0x1be87a[_0x96ea('0x5e')]&&_0x1be87a[_0x96ea('0x5e')]['startsWith'](_0x96ea('0x5f'))?_0x1be87a['appdata']:(_0x1be87a[_0x96ea('0x5e')]||_0x1be87a[_0x96ea('0x5d')])[_0x96ea('0x60')]();logger[_0x96ea('0x33')](_0x96ea('0x61'),_0x1be87a[_0x96ea('0x3c')],_0x1be87a[_0x96ea('0x5c')],_0x1be87a['applicationdata']);if(_[_0x96ea('0x41')](this[_0x96ea('0x1c')][_0x1be87a[_0x96ea('0x3c')]])){this[_0x96ea('0x1c')][_0x1be87a[_0x96ea('0x3c')]]=new Channel();this[_0x96ea('0x1c')][_0x1be87a[_0x96ea('0x3c')]]['starttime']=_0x1be87a[_0x96ea('0x62')]?moment()[_0x96ea('0x63')](moment[_0x96ea('0x62')](_0x1be87a[_0x96ea('0x62')])[_0x96ea('0x64')](),'seconds')[_0x96ea('0x4d')](_0x96ea('0x56')):moment()['format'](_0x96ea('0x56'));this[_0x96ea('0x1c')][_0x1be87a[_0x96ea('0x3c')]][_0x96ea('0x57')]=_0x96ea('0x15');}_[_0x96ea('0x42')](this[_0x96ea('0x1c')][_0x1be87a['uniqueid']],_[_0x96ea('0x43')](_0x1be87a,_['keys'](this[_0x96ea('0x1c')][_0x1be87a[_0x96ea('0x3c')]])));if(_[_0x96ea('0x65')](applications,_0x1be87a['application'])){this[_0x96ea('0x1c')][_0x1be87a[_0x96ea('0x3c')]][_0x96ea('0x66')]=_0x1be87a[_0x96ea('0x5c')];this[_0x96ea('0x1c')][_0x1be87a[_0x96ea('0x3c')]][_0x96ea('0x67')]=_0x1be87a[_0x96ea('0x5d')];if(_0x1be87a[_0x96ea('0x5c')]===_0x96ea('0x10')&&_[_0x96ea('0x68')](_0x1be87a[_0x96ea('0x5d')][_0x96ea('0x60')](),_0x96ea('0x69'))){var _0x58d891=_0x1be87a[_0x96ea('0x5d')][_0x96ea('0x4a')]('=');var _0x4c5f98=_0x58d891[0x0][_0x96ea('0x60')]()['match'](/cdr\((.*)\)/);if(_0x4c5f98){this[_0x96ea('0x1c')][_0x1be87a[_0x96ea('0x3c')]][_0x4c5f98[0x1]]=_0x58d891[0x1];}}else if(_0x1be87a[_0x96ea('0x5c')]===_0x96ea('0x11')){this[_0x96ea('0x1c')][_0x1be87a['uniqueid']]['queue']=_0x1be87a[_0x96ea('0x5d')]['split'](',')[0x0];}}}}}catch(_0x502718){logger[_0x96ea('0x51')](_0x96ea('0x6a'),_0x1be87a[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0x502718,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96ea('0x38')][_0x96ea('0x26')]=function(_0x122124){try{if(this[_0x96ea('0x39')](_0x122124)){logger['info'](_0x96ea('0x6b'),_0x122124['uniqueid'],_0x122124[_0x96ea('0x40')],_0x122124['calleridname'],_0x122124['calleridnum']);logger['debug'](_0x96ea('0x6c'),_0x122124[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0x122124,{'showHidden':![],'depth':null}));if(_0x122124['uniqueid']!==_0x122124['linkedid']){if(this['channels'][_0x122124[_0x96ea('0x40')]]){if(_0x122124[_0x96ea('0x58')]==='6'){if(!this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x40')]][_0x96ea('0x6d')]){var _0x6ff1f5=moment();this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x40')]][_0x96ea('0x6d')]=!![];this['channels'][_0x122124['linkedid']][_0x96ea('0x6e')]=_0x6ff1f5[_0x96ea('0x4d')](_0x96ea('0x56'));if(this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x40')]][_0x96ea('0x55')]){this['channels'][_0x122124[_0x96ea('0x40')]][_0x96ea('0x6f')]=_0x6ff1f5['diff'](this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x40')]]['starttime'],_0x96ea('0x64'));}}this['channels'][_0x122124[_0x96ea('0x40')]][_0x96ea('0x40')]=_0x122124[_0x96ea('0x3c')];if(_0x122124['calleridnum']!=='xcally-motion-preview'){this[_0x96ea('0x1c')][_0x122124['linkedid']]['connectedlinenum']=_0x122124[_0x96ea('0x70')];}this[_0x96ea('0x1c')][_0x122124['linkedid']][_0x96ea('0x71')]=_0x122124['calleridname'];this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x40')]]['destinationchannel']=_0x122124['channel'];this[_0x96ea('0x1c')][_0x122124['linkedid']]['disposition']=dispositions[_[_0x96ea('0x72')](_0x122124[_0x96ea('0x58')])];if(this[_0x96ea('0x1d')][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]){this[_0x96ea('0x1c')][_0x122124['linkedid']][_0x96ea('0x73')]=this[_0x96ea('0x1d')][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]['id'];this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x40')]][_0x96ea('0x74')]=this[_0x96ea('0x1d')][_0x122124[_0x96ea('0x47')]['split']('-')[0x0]][_0x96ea('0x59')];}}}}else{if(this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x3c')]]){if(_0x122124[_0x96ea('0x58')]==='6'){if(this[_0x96ea('0x1d')][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]){this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x3c')]][_0x96ea('0x73')]=this['agents'][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]['id'];this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x3c')]][_0x96ea('0x74')]=this[_0x96ea('0x1d')][_0x122124['channel'][_0x96ea('0x4a')]('-')[0x0]]['name'];}}}}if(_0x122124[_0x96ea('0x58')]==='6'&&_0x122124[_0x96ea('0x45')]===_0x96ea('0x46')){if(this[_0x96ea('0x1d')][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]){this[_0x96ea('0x1d')][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]['destconnectedlinenum']=_0x122124[_0x96ea('0x48')];var _0x1812a3;if(this['channels'][_0x122124[_0x96ea('0x3c')]])_0x1812a3=this[_0x96ea('0x1c')][_0x122124[_0x96ea('0x3c')]]['routealias'];else if(this[_0x96ea('0x1c')][_0x122124['linkedid']])_0x1812a3=this['channels'][_0x122124['linkedid']][_0x96ea('0x75')];logger[_0x96ea('0x3e')](_0x96ea('0x76'),_0x122124[_0x96ea('0x3c')],util[_0x96ea('0x37')]({'destaccountcode':this[_0x96ea('0x1d')][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x50')],'destconnectedlinenum':_0x122124['exten'],'routealias':_0x1812a3},{'showHidden':![],'depth':null}));this[_0x96ea('0x3a')](util[_0x96ea('0x4d')](_0x96ea('0x4e'),this['agents'][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x59')]),_0x96ea('0x4f'),{'destaccountcode':this[_0x96ea('0x1d')][_0x122124[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x122124[_0x96ea('0x48')],'routealias':_0x1812a3});}}}}catch(_0x127cf0){logger[_0x96ea('0x51')](_0x96ea('0x77'),_0x122124[_0x96ea('0x3c')],util['inspect'](_0x127cf0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96ea('0x38')][_0x96ea('0x78')]=function(_0xd3f9f,_0x4ae8d7){try{if(this[_0x96ea('0x1c')][_0xd3f9f]){logger[_0x96ea('0x33')](_0x96ea('0x79'),_0xd3f9f,_0x4ae8d7);this[_0x96ea('0x1c')][_0xd3f9f][_0x96ea('0x7a')]=!![];if(_[_0x96ea('0x7b')](_0x4ae8d7,_0x96ea('0x7c'))){_0x4ae8d7=_0x4ae8d7[_0x96ea('0x7d')](_0x96ea('0x7c'),_0x96ea('0x7e'));}this[_0x96ea('0x1c')][_0xd3f9f]['monitorFilename']=_0x4ae8d7;var _0x480df8=_[_0x96ea('0x7f')](this['channels'][_0xd3f9f][_0x96ea('0x80')],{'filename':_0x4ae8d7});if(_['isNil'](_0x480df8)){this[_0x96ea('0x1c')][_0xd3f9f]['monitors'][_0x96ea('0x81')]({'filename':_0x4ae8d7,'createdAt':moment()[_0x96ea('0x4d')](_0x96ea('0x56')),'mixmonitorid':'','status':_0x96ea('0x82')});}}}catch(_0x440241){logger[_0x96ea('0x51')](_0x96ea('0x83'),_0xd3f9f,util[_0x96ea('0x37')](_0x440241,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96ea('0x38')]['syncVarSet']=function(_0x731da7){try{if(this['isNotNull'](_0x731da7)){logger[_0x96ea('0x3e')](_0x96ea('0x84'),_0x731da7[_0x96ea('0x3c')],util['inspect'](_0x731da7,{'showHidden':![],'depth':null}));if(this[_0x96ea('0x1c')][_0x731da7[_0x96ea('0x3c')]]&&_0x731da7[_0x96ea('0x47')]!=_0x96ea('0x5b')){if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')])){if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')][_0x96ea('0x86')])){logger[_0x96ea('0x33')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x731da7[_0x96ea('0x3c')],_0x731da7['value']);this[_0x96ea('0x78')](_0x731da7[_0x96ea('0x3c')],_0x731da7[_0x96ea('0x87')]);}else if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')]['xmd-phone'])){logger[_0x96ea('0x33')](_0x96ea('0x88'),_0x731da7['uniqueid'],_0x731da7[_0x96ea('0x87')]);this[_0x96ea('0x1c')][_0x731da7['uniqueid']][_0x96ea('0x70')]=_0x731da7[_0x96ea('0x87')];}else if(this[_0x96ea('0x39')](_0x731da7['variable']['xmd-callerid'])){logger[_0x96ea('0x33')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x731da7[_0x96ea('0x3c')],_0x731da7[_0x96ea('0x87')]);this[_0x96ea('0x1c')][_0x731da7['uniqueid']][_0x96ea('0x89')]=_0x731da7['value'];}else if(this['isNotNull'](_0x731da7[_0x96ea('0x85')]['xmd-cdrtype'])){logger[_0x96ea('0x33')](_0x96ea('0x8a'),_0x731da7['uniqueid'],_0x731da7[_0x96ea('0x87')]);this[_0x96ea('0x1c')][_0x731da7[_0x96ea('0x3c')]][_0x96ea('0x8b')]=_0x731da7[_0x96ea('0x87')];}else if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')]['xmd-queue'])){logger[_0x96ea('0x33')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x731da7['uniqueid'],_0x731da7[_0x96ea('0x87')]['split'](',')[0x0]);this[_0x96ea('0x1c')][_0x731da7[_0x96ea('0x3c')]]['queue']=_0x731da7[_0x96ea('0x87')][_0x96ea('0x4a')](',')[0x0];}else if(this['isNotNull'](_0x731da7[_0x96ea('0x85')][_0x96ea('0x8c')])){logger[_0x96ea('0x33')](_0x96ea('0x8d'),_0x731da7['uniqueid'],_0x731da7[_0x96ea('0x87')]);this[_0x96ea('0x1c')][_0x731da7[_0x96ea('0x3c')]][_0x96ea('0x8e')]=_0x731da7['value'];}else if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')][_0x96ea('0x8f')])){logger[_0x96ea('0x33')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x731da7[_0x96ea('0x3c')],_0x731da7['value']);this['channels'][_0x731da7[_0x96ea('0x3c')]]['destination']=_0x731da7[_0x96ea('0x87')];}else if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')][_0x96ea('0x90')])){logger[_0x96ea('0x33')](_0x96ea('0x91'),_0x731da7[_0x96ea('0x3c')],_0x731da7[_0x96ea('0x87')]);this['channels'][_0x731da7['uniqueid']][_0x96ea('0x92')]=_0x731da7['value'];}else if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')][_0x96ea('0x93')])){logger[_0x96ea('0x33')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x731da7[_0x96ea('0x3c')],_0x731da7[_0x96ea('0x87')]);this['channels'][_0x731da7['uniqueid']][_0x96ea('0x11')]=_0x731da7[_0x96ea('0x87')];}else if(this['isNotNull'](_0x731da7[_0x96ea('0x85')]['sipcallid'])){logger[_0x96ea('0x33')](_0x96ea('0x94'),_0x731da7['uniqueid'],_0x731da7[_0x96ea('0x87')]);this[_0x96ea('0x1c')][_0x731da7[_0x96ea('0x3c')]]['sipcalluniqueid']=_0x731da7[_0x96ea('0x87')];}}}else if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')]['mixmonitor_filename'])){if(_0x731da7[_0x96ea('0x87')]){var _0x1ba396=path[_0x96ea('0x95')](_0x731da7[_0x96ea('0x87')])['name'];logger[_0x96ea('0x33')](_0x96ea('0x96'),_0x1ba396,_0x731da7[_0x96ea('0x87')]);this[_0x96ea('0x78')](_0x1ba396,_0x731da7['value']);}}else if(this[_0x96ea('0x1c')][_0x731da7['linkedid']]){if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')])){if(this[_0x96ea('0x39')](_0x731da7[_0x96ea('0x85')][_0x96ea('0x97')])){logger[_0x96ea('0x33')](_0x96ea('0x94'),_0x731da7[_0x96ea('0x40')],_0x731da7[_0x96ea('0x87')]);this[_0x96ea('0x1c')][_0x731da7[_0x96ea('0x40')]][_0x96ea('0x98')]=_0x731da7['value'];}}}}}catch(_0x4f7743){logger[_0x96ea('0x51')](_0x96ea('0x99'),_0x731da7['uniqueid'],util[_0x96ea('0x37')](_0x4f7743,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96ea('0x38')][_0x96ea('0x2a')]=function(_0x24b490){try{if(this[_0x96ea('0x39')](_0x24b490)){logger[_0x96ea('0x3e')](_0x96ea('0x9a'),_0x24b490[_0x96ea('0x3c')],util['inspect'](_0x24b490,{'showHidden':![],'depth':null}));if(this['channels'][_0x24b490[_0x96ea('0x3c')]]){logger[_0x96ea('0x33')](_0x96ea('0x9b'),_0x24b490[_0x96ea('0x3c')],_0x24b490[_0x96ea('0x9c')]);var _0x44db07=moment();this['channels'][_0x24b490[_0x96ea('0x3c')]][_0x96ea('0x9d')]=_0x44db07[_0x96ea('0x4d')](_0x96ea('0x56'));this[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]][_0x96ea('0x62')]=_0x44db07[_0x96ea('0x9e')](this[_0x96ea('0x1c')][_0x24b490['uniqueid']][_0x96ea('0x55')],'seconds');if(this[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]][_0x96ea('0x6d')]){this[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]]['billableseconds']=_0x44db07[_0x96ea('0x9e')](this[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]][_0x96ea('0x6e')],'seconds');this[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]]['holdtime']=this[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]][_0x96ea('0x62')]-this[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]]['billableseconds'];}if(_0x24b490[_0x96ea('0x45')]===_0x96ea('0x46')){if(this['agents'][_0x24b490[_0x96ea('0x47')]['split']('-')[0x0]]){this[_0x96ea('0x1d')][_0x24b490[_0x96ea('0x47')]['split']('-')[0x0]]=_[_0x96ea('0x9f')](this[_0x96ea('0x1d')][_0x24b490[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]],[_0x96ea('0x4b')]);logger['debug'](_0x96ea('0xa0'),_0x24b490[_0x96ea('0x3c')],util[_0x96ea('0x37')]({'id':this['agents'][_0x24b490[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x24b490[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x50')]},{'showHidden':![],'depth':null}));this[_0x96ea('0x3a')](util[_0x96ea('0x4d')](_0x96ea('0x4e'),this[_0x96ea('0x1d')][_0x24b490[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]]['name']),_0x96ea('0xa1'),{'id':this[_0x96ea('0x1d')][_0x24b490['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x96ea('0x1d')][_0x24b490[_0x96ea('0x47')][_0x96ea('0x4a')]('-')[0x0]][_0x96ea('0x50')]});}}var _0x1cd7f3=this;Promise[_0x96ea('0xa2')]()[_0x96ea('0xa3')](function(){var _0x40791f=_0x1cd7f3[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]];if(typeof _0x40791f[_0x96ea('0xa4')]===_0x96ea('0xa5'))return;if(_[_0x96ea('0xa6')](_0x40791f[_0x96ea('0x80')]))return;return RpcSetting[_0x96ea('0xa7')]()[_0x96ea('0xa3')](function(_0x18abf0){if(!_0x18abf0[_0x96ea('0xa8')])return;return Promise[_0x96ea('0xa2')]()['then'](function(){return ami[_0x96ea('0xa9')]({'action':_0x96ea('0xaa'),'channel':_0x40791f[_0x96ea('0x47')]})[_0x96ea('0xab')](function(){});})['then'](function(){return ami[_0x96ea('0xa9')]({'action':'StopMixMonitor','channel':_0x40791f[_0x96ea('0xac')]})[_0x96ea('0xab')](function(){})[_0x96ea('0xad')](function(){var _0x1612a5=_0x1cd7f3[_0x96ea('0x1d')][_0x40791f[_0x96ea('0xac')]['split']('-')[0x0]];if(!_0x1612a5)return;io[_0x96ea('0x3a')](_0x96ea('0xae'),{'agentId':_0x1612a5['id'],'uniqueid':_0x40791f[_0x96ea('0x3c')]});});});});})['then'](function(){if(_0x24b490['event']==='BlindTransfer'){_0x1cd7f3[_0x96ea('0x1e')][_0x24b490[_0x96ea('0x3c')]]=_0x1cd7f3[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]];}else{if(_0x1cd7f3['channels'][_0x24b490[_0x96ea('0x3c')]][_0x96ea('0x8b')]===_0x96ea('0xaf')&&_0x1cd7f3[_0x96ea('0x1e')][_0x24b490[_0x96ea('0x3c')]]){_0x1cd7f3[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]][_0x96ea('0x3c')]=[_0x1cd7f3['channels'][_0x24b490[_0x96ea('0x3c')]][_0x96ea('0x40')],_0x1cd7f3['channels'][_0x24b490[_0x96ea('0x3c')]]['linkedid']=_0x1cd7f3[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]]['uniqueid']][0x0];delete _0x1cd7f3[_0x96ea('0x1e')][_0x24b490[_0x96ea('0x3c')]];}}logger[_0x96ea('0x3e')](_0x96ea('0xb0'),_0x24b490[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0x1cd7f3['channels'][_0x24b490[_0x96ea('0x3c')]],{'showHidden':![],'depth':null}));ami[_0x96ea('0x3a')](_0x96ea('0xb1'),_0x1cd7f3['channels'][_0x24b490[_0x96ea('0x3c')]]);delete _0x1cd7f3[_0x96ea('0x1c')][_0x24b490[_0x96ea('0x3c')]];});}}}catch(_0x1c292a){logger['error'](_0x96ea('0xb2'),_0x24b490['uniqueid'],util[_0x96ea('0x37')](_0x1c292a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96ea('0x38')][_0x96ea('0x2d')]=function(_0x3fc1bc){try{if(this[_0x96ea('0x39')](_0x3fc1bc)){logger['info'](_0x96ea('0xb3'),_0x3fc1bc[_0x96ea('0x3c')],_0x3fc1bc['origtransferercalleridnum'],_0x3fc1bc[_0x96ea('0xb4')]);logger[_0x96ea('0x3e')](_0x96ea('0xb5'),_0x3fc1bc['uniqueid'],util[_0x96ea('0x37')](_0x3fc1bc,{'showHidden':![],'depth':null}));if(this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb6')]]){this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb6')]][_0x96ea('0xb7')]=_0x3fc1bc[_0x96ea('0xb8')];this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb6')]]['transferconnectedlinenum']=_0x3fc1bc[_0x96ea('0xb4')];if(this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb9')]]){var _0x365cdf=this['channels'][_0x3fc1bc[_0x96ea('0xb9')]];this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb9')]]=this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb6')]];this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb6')]]=_0x365cdf;}}else if(this['channels'][_0x3fc1bc[_0x96ea('0xba')]]){this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xba')]][_0x96ea('0xb7')]=_0x3fc1bc[_0x96ea('0xb8')];this['channels'][_0x3fc1bc[_0x96ea('0xba')]][_0x96ea('0xbb')]=_0x3fc1bc[_0x96ea('0xb4')];if(this[_0x96ea('0x1c')][_0x3fc1bc['origtransfereruniqueid']]){var _0x365cdf=this[_0x96ea('0x1c')][_0x3fc1bc['origtransfereruniqueid']];this['channels'][_0x3fc1bc[_0x96ea('0xbc')]]=this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xba')]];this[_0x96ea('0x1c')][_0x3fc1bc['transfertargetuniqueid']]=_0x365cdf;}}if((this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xbc')]]||this[_0x96ea('0x1c')][_0x3fc1bc['origtransfererlinkedid']])&&this[_0x96ea('0x1c')][_0x3fc1bc['secondtransfereruniqueid']]){var _0x3cda74=_['some']([this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xbc')]],this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xbd')]],this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb9')]]],function(_0x229f14){return _0x229f14&&_0x229f14[_0x96ea('0x8b')]===_0x96ea('0xaf')&&_0x229f14['routeid'];});if(_0x3cda74){if(this['channels'][_0x3fc1bc['origtransfereruniqueid']])this['channels'][_0x3fc1bc[_0x96ea('0xbc')]][_0x96ea('0xa4')]=_0x96ea('0xbe');if(this['channels'][_0x3fc1bc['origtransfererlinkedid']])this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xbd')]][_0x96ea('0xa4')]=_0x96ea('0xbe');this[_0x96ea('0x1c')][_0x3fc1bc[_0x96ea('0xb9')]][_0x96ea('0xa4')]=_0x96ea('0xbe');}}}}catch(_0x558657){logger[_0x96ea('0x51')](_0x96ea('0xbf'),_0x3fc1bc[_0x96ea('0x3c')],util['inspect'](_0x558657,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96ea('0x38')][_0x96ea('0xc0')]=function(_0x1a56b8){try{if(this[_0x96ea('0x39')](_0x1a56b8)){logger[_0x96ea('0x33')](_0x96ea('0xc1'),_0x1a56b8[_0x96ea('0x3c')],_0x1a56b8[_0x96ea('0xc2')],_0x1a56b8['extension']);logger[_0x96ea('0x3e')](_0x96ea('0xc3'),_0x1a56b8[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0x1a56b8,{'showHidden':![],'depth':null}));if(this[_0x96ea('0x1c')][_0x1a56b8[_0x96ea('0xb6')]]){this[_0x96ea('0x1c')][_0x1a56b8[_0x96ea('0xb6')]][_0x96ea('0xb7')]=_0x1a56b8[_0x96ea('0xc2')];this['channels'][_0x1a56b8['transfereeuniqueid']][_0x96ea('0xbb')]=_0x1a56b8[_0x96ea('0xc4')];this[_0x96ea('0x1c')][_0x1a56b8[_0x96ea('0xb6')]][_0x96ea('0xa4')]=_0x96ea('0xc5');this[_0x96ea('0x2a')]({'event':_0x96ea('0xc6'),'uniqueid':_0x1a56b8[_0x96ea('0xb6')],'context':_0x1a56b8[_0x96ea('0x45')],'channel':_0x1a56b8['transfererchannel']});}else{this[_0x96ea('0x1c')][_0x1a56b8[_0x96ea('0xc7')]][_0x96ea('0xa4')]=_0x96ea('0xc5');}}}catch(_0x4cf385){logger['error'](_0x96ea('0xc8'),_0x1a56b8[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0x4cf385,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x3b02ca){try{if(this[_0x96ea('0x39')](_0x3b02ca)){logger[_0x96ea('0x3e')](_0x96ea('0xc9'),_0x3b02ca[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0x3b02ca,{'showHidden':![],'depth':null}));if(this['channels'][_0x3b02ca[_0x96ea('0x3c')]]){if(!_['isNil'](this['channels'][_0x3b02ca['uniqueid']]['answertime'])){this[_0x96ea('0x1c')][_0x3b02ca['uniqueid']][_0x96ea('0xca')]=moment()['format'](_0x96ea('0x56'));logger[_0x96ea('0x33')](_0x96ea('0xcb'),_0x3b02ca[_0x96ea('0x3c')],this['channels'][_0x3b02ca[_0x96ea('0x3c')]][_0x96ea('0xca')]);}}}}catch(_0x5de55f){logger[_0x96ea('0x51')](_0x96ea('0xcc'),_0x3b02ca[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0x5de55f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x96ea('0x38')][_0x96ea('0x32')]=function(_0xf525dc){try{if(this['isNotNull'](_0xf525dc)){logger['debug'](_0x96ea('0xcd'),_0xf525dc[_0x96ea('0x3c')],util[_0x96ea('0x37')](_0xf525dc,{'showHidden':![],'depth':null}));if(this[_0x96ea('0x1c')][_0xf525dc[_0x96ea('0x3c')]]){if(!_[_0x96ea('0xce')](this[_0x96ea('0x1c')][_0xf525dc[_0x96ea('0x3c')]][_0x96ea('0xca')])){this[_0x96ea('0x1c')][_0xf525dc[_0x96ea('0x3c')]][_0x96ea('0xcf')]+=moment()[_0x96ea('0xd0')](0x0)[_0x96ea('0x9e')](this['channels'][_0xf525dc['uniqueid']]['mohstarttime'],_0x96ea('0x64'));logger[_0x96ea('0x33')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0xf525dc[_0x96ea('0x3c')],this[_0x96ea('0x1c')][_0xf525dc[_0x96ea('0x3c')]][_0x96ea('0xcf')]);delete this[_0x96ea('0x1c')][_0xf525dc['uniqueid']][_0x96ea('0xca')];}}}}catch(_0x12e060){logger[_0x96ea('0x51')](_0x96ea('0xd1'),_0xf525dc['uniqueid'],util[_0x96ea('0x37')](_0x12e060,{'showHidden':![],'depth':null}));}};module[_0x96ea('0xd2')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index cf5f448..e7b67d2 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 _0x290c=['emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring','custom:dialconnect','[%s][voiceDialReport][dialend]','addVariable','value','variable','outboundrouteid','keys','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','answertime','holdtime','seconds','billableseconds','sumHoldTime','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:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','exports','lodash','moment','util','ioredis','../../../config/environment','ami','socket.io-emitter','channels','outbound','applications','variables','dialbegin','syncDialBegin','syncDialEnd','bind','varset','syncVarSet','newexten','hangup','syncHangup','prototype','isNotNull','isUndefined'];(function(_0x30fc8f,_0x215149){var _0x17b462=function(_0x1b4c3a){while(--_0x1b4c3a){_0x30fc8f['push'](_0x30fc8f['shift']());}};_0x17b462(++_0x215149);}(_0x290c,0x148));var _0xc290=function(_0x33ff08,_0x31ff57){_0x33ff08=_0x33ff08-0x0;var _0x630576=_0x290c[_0x33ff08];return _0x630576;};'use strict';var _=require(_0xc290('0x0'));var moment=require(_0xc290('0x1'));var util=require(_0xc290('0x2'));var Redis=require(_0xc290('0x3'));var config=require(_0xc290('0x4'));var logger=require('../../../config/logger')(_0xc290('0x5'));var ami=require('../ami');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc290('0x6'))(new Redis(config['redis']));function VoiceDialReport(_0x54366e){this[_0xc290('0x7')]=_0x54366e['outboundChannels'];this['outbound']=_0x54366e[_0xc290('0x8')];this[_0xc290('0x9')]={};this[_0xc290('0xa')]={};ami['on'](_0xc290('0xb'),this[_0xc290('0xc')]['bind'](this));ami['on']('dialend',this[_0xc290('0xd')][_0xc290('0xe')](this));ami['on'](_0xc290('0xf'),this[_0xc290('0x10')][_0xc290('0xe')](this));ami['on'](_0xc290('0x11'),this['syncNewExten']['bind'](this));ami['on'](_0xc290('0x12'),this[_0xc290('0x13')]['bind'](this));}VoiceDialReport[_0xc290('0x14')][_0xc290('0x15')]=function(_0xf4c984){return _0xf4c984!==null&&!_[_0xc290('0x16')](_0xf4c984);};VoiceDialReport[_0xc290('0x14')][_0xc290('0x17')]=function(_0x121917,_0x1f95b3,_0xcbf6d2){io['to'](_0x121917)[_0xc290('0x17')](_0x1f95b3,_0xcbf6d2);};VoiceDialReport[_0xc290('0x14')][_0xc290('0xc')]=function(_0x2f7661){try{if(this['isNotNull'](_0x2f7661)){logger[_0xc290('0x18')](_0xc290('0x19'),_0x2f7661[_0xc290('0x1a')],util[_0xc290('0x1b')](_0x2f7661,{'showHidden':![],'depth':null}));if(this[_0xc290('0x7')][_0x2f7661['uniqueid']]){_[_0xc290('0x1c')](this['channels'][_0x2f7661[_0xc290('0x1a')]],{'starttime':moment()[_0xc290('0x1d')](_0xc290('0x1e')),'lastevent':_0xc290('0x1f'),'interface':_0x2f7661['channel']['substring'](0x0,_0x2f7661[_0xc290('0x20')][_0xc290('0x21')]('-')),'membername':_0x2f7661[_0xc290('0x20')]['substring'](_0x2f7661[_0xc290('0x20')][_0xc290('0x21')]('/')+0x1,_0x2f7661[_0xc290('0x20')][_0xc290('0x21')]('-'))},_[_0xc290('0x22')](_0x2f7661,[_0xc290('0x23'),_0xc290('0x24')]));logger[_0xc290('0x25')](_0xc290('0x26'),_0x2f7661[_0xc290('0x1a')],this[_0xc290('0x7')][_0x2f7661['uniqueid']][_0xc290('0x27')],this[_0xc290('0x7')][_0x2f7661[_0xc290('0x1a')]][_0xc290('0x28')]);logger[_0xc290('0x18')](_0xc290('0x29'),_0x2f7661[_0xc290('0x1a')],util[_0xc290('0x1b')](this[_0xc290('0x7')][_0x2f7661['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0xc290('0x9')][_0x2f7661[_0xc290('0x1a')]])_[_0xc290('0x1c')](this[_0xc290('0x7')][_0x2f7661['uniqueid']],this[_0xc290('0x9')][_0x2f7661['uniqueid']]);this['emit'](_0xc290('0x2a'),_0xc290('0x2b'),this[_0xc290('0x7')][_0x2f7661[_0xc290('0x1a')]]);logger[_0xc290('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x2f7661['uniqueid'],util[_0xc290('0x1b')](this['channels'][_0x2f7661[_0xc290('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xc290('0x2c'),this[_0xc290('0x7')][_0x2f7661[_0xc290('0x1a')]]);}}}catch(_0x549539){logger[_0xc290('0x2d')](_0xc290('0x2e'),_0x2f7661['uniqueid'],util[_0xc290('0x1b')](_0x549539,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc290('0x14')][_0xc290('0xd')]=function(_0x4135b7){try{if(this['isNotNull'](_0x4135b7)){logger['debug'](_0xc290('0x2f'),_0x4135b7[_0xc290('0x1a')],util[_0xc290('0x1b')](_0x4135b7,{'showHidden':![],'depth':null}));if(this[_0xc290('0x7')][_0x4135b7[_0xc290('0x1a')]]){this[_0xc290('0x7')][_0x4135b7[_0xc290('0x1a')]][_0xc290('0x30')]=_0x4135b7[_0xc290('0x30')];if(_0x4135b7[_0xc290('0x30')]===_0xc290('0x31')){this['channels'][_0x4135b7[_0xc290('0x1a')]][_0xc290('0x32')]=_0x4135b7[_0xc290('0x32')];this[_0xc290('0x7')][_0x4135b7[_0xc290('0x1a')]][_0xc290('0x33')]=_0x4135b7[_0xc290('0x33')];this[_0xc290('0x7')][_0x4135b7[_0xc290('0x1a')]]['answertime']=moment()['format'](_0xc290('0x1e'));this[_0xc290('0x7')][_0x4135b7[_0xc290('0x1a')]][_0xc290('0x34')]=_0xc290('0x35');logger[_0xc290('0x25')](_0xc290('0x36'),_0x4135b7[_0xc290('0x1a')],_0x4135b7[_0xc290('0x20')][_0xc290('0x37')](_0x4135b7[_0xc290('0x20')][_0xc290('0x21')]('/')+0x1,_0x4135b7[_0xc290('0x20')]['lastIndexOf']('-')));logger[_0xc290('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x4135b7[_0xc290('0x1a')],util[_0xc290('0x1b')](this[_0xc290('0x7')][_0x4135b7[_0xc290('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xc290('0x17')](_0xc290('0x38'),this[_0xc290('0x7')][_0x4135b7[_0xc290('0x1a')]]);}logger[_0xc290('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4135b7[_0xc290('0x1a')],util[_0xc290('0x1b')](this[_0xc290('0x7')][_0x4135b7['uniqueid']],{'showHidden':![],'depth':null}));this[_0xc290('0x17')]('voice:outbound',_0xc290('0x2b'),this[_0xc290('0x7')][_0x4135b7[_0xc290('0x1a')]]);}}}catch(_0x44fa89){logger[_0xc290('0x2d')](_0xc290('0x39'),_0x4135b7['uniqueid'],util[_0xc290('0x1b')](_0x44fa89,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xc290('0x10')]=function(_0x2abfaa){try{if(this[_0xc290('0x15')](_0x2abfaa)){logger[_0xc290('0x18')]('[%s][voiceDialReport][varset]\x20event:',_0x2abfaa['uniqueid'],util[_0xc290('0x1b')](_0x2abfaa,{'showHidden':![],'depth':null}));this[_0xc290('0x3a')](_0x2abfaa[_0xc290('0x1a')],_['keys'](_0x2abfaa['variable'])[0x0],_0x2abfaa[_0xc290('0x3b')]);if(this[_0xc290('0x15')](_0x2abfaa['variable'])&&this[_0xc290('0x15')](_0x2abfaa[_0xc290('0x3c')][_0xc290('0x3d')])){if(_[_0xc290('0x16')](this[_0xc290('0x7')][_0x2abfaa[_0xc290('0x1a')]])){this[_0xc290('0x7')][_0x2abfaa[_0xc290('0x1a')]]={'routeId':_0x2abfaa[_0xc290('0x3b')],'variables':this[_0xc290('0xa')][_0x2abfaa[_0xc290('0x1a')]]};logger[_0xc290('0x25')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x2abfaa[_0xc290('0x1a')],_0x2abfaa[_0xc290('0x3c')]['outboundrouteid'],_[_0xc290('0x3e')](_0x2abfaa[_0xc290('0x3c')])[0x0],_0x2abfaa[_0xc290('0x3b')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2abfaa[_0xc290('0x1a')],util[_0xc290('0x1b')](this['channels'][_0x2abfaa[_0xc290('0x1a')]],{'showHidden':![],'depth':null}));this[_0xc290('0x17')]('voice:outbound','voice_outbound_channel:save',this[_0xc290('0x7')][_0x2abfaa['uniqueid']]);}}}}catch(_0xb665e7){logger[_0xc290('0x2d')](_0xc290('0x3f'),_0x2abfaa[_0xc290('0x1a')],util[_0xc290('0x1b')](_0xb665e7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc290('0x14')][_0xc290('0x3a')]=function(_0x593b44,_0x1a8220,_0x6f798){var _0x4282f5=[_0xc290('0x40'),_0xc290('0x41'),_0xc290('0x42'),_0xc290('0x43'),_0xc290('0x44'),'rtpaudioqoslossbridged',_0xc290('0x45'),_0xc290('0x46'),_0xc290('0x47'),_0xc290('0x48'),_0xc290('0x49'),_0xc290('0x4a'),_0xc290('0x4b'),_0xc290('0x4c'),_0xc290('0x4d'),_0xc290('0x4e'),_0xc290('0x27'),_0xc290('0x4f'),'memberrealtime'];if(!_[_0xc290('0x50')](_0x1a8220)&&!_[_0xc290('0x51')](_0x4282f5,_0x1a8220)){if(_['isUndefined'](this[_0xc290('0xa')][_0x593b44])){this[_0xc290('0xa')][_0x593b44]={};}this['variables'][_0x593b44][_0x1a8220]=_0x6f798;}};VoiceDialReport[_0xc290('0x14')][_0xc290('0x13')]=function(_0x55c1bb){try{if(this[_0xc290('0x15')](_0x55c1bb)){logger['debug'](_0xc290('0x52'),_0x55c1bb[_0xc290('0x1a')],util[_0xc290('0x1b')](_0x55c1bb,{'showHidden':![],'depth':null}));if(this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]]){logger[_0xc290('0x25')](_0xc290('0x53'),_0x55c1bb[_0xc290('0x1a')],_0x55c1bb[_0xc290('0x54')]);this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x55')]=moment()[_0xc290('0x1d')](_0xc290('0x1e'));this['channels'][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x56')]=moment(this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]]['endtime'])[_0xc290('0x57')](this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x58')],'seconds');this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]]['lastevent']='complete';this['outbound']['total']+=0x1;if(this['channels'][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x59')]){this[_0xc290('0x8')]['answered']+=0x1;this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x5a')]=moment(this[_0xc290('0x7')][_0x55c1bb['uniqueid']][_0xc290('0x59')])[_0xc290('0x57')](this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]]['starttime'],_0xc290('0x5b'));this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x5c')]=moment(this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x55')])['diff'](this[_0xc290('0x7')][_0x55c1bb['uniqueid']][_0xc290('0x59')],_0xc290('0x5b'));this['outbound'][_0xc290('0x5d')]+=this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x5a')]||0x0;this[_0xc290('0x8')]['sumBillable']+=this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x5c')];}this[_0xc290('0x8')][_0xc290('0x5e')]+=this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]][_0xc290('0x56')];logger[_0xc290('0x18')](_0xc290('0x5f'),_0x55c1bb[_0xc290('0x1a')],util[_0xc290('0x1b')](this['channels'][_0x55c1bb[_0xc290('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xc290('0x17')](_0xc290('0x60'),this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]]);logger['debug'](_0xc290('0x61'),_0x55c1bb['uniqueid'],util[_0xc290('0x1b')](this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xc290('0x17')]('custom:dialend',this['channels'][_0x55c1bb['uniqueid']]);logger[_0xc290('0x18')](_0xc290('0x62'),_0x55c1bb[_0xc290('0x1a')],util[_0xc290('0x1b')](this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]],{'showHidden':![],'depth':null}));this[_0xc290('0x17')](_0xc290('0x2a'),_0xc290('0x63'),this[_0xc290('0x8')]);logger[_0xc290('0x25')](_0xc290('0x64'),JSON[_0xc290('0x65')](this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x1a')]]));logger[_0xc290('0x18')](_0xc290('0x66'),_0x55c1bb[_0xc290('0x1a')],util[_0xc290('0x1b')](this['channels'][_0x55c1bb[_0xc290('0x1a')]],{'showHidden':![],'depth':null}));this[_0xc290('0x17')](_0xc290('0x2a'),_0xc290('0x67'),this['channels'][_0x55c1bb[_0xc290('0x1a')]]);delete this['channels'][_0x55c1bb[_0xc290('0x1a')]];}else if(this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x68')]]){this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x68')]][_0xc290('0x1a')]=this[_0xc290('0x7')][_0x55c1bb[_0xc290('0x68')]][_0xc290('0x69')];}if(this[_0xc290('0xa')][_0x55c1bb['uniqueid']]){delete this[_0xc290('0xa')][_0x55c1bb[_0xc290('0x1a')]];}}}catch(_0xe9dfd9){logger[_0xc290('0x2d')](_0xc290('0x6a'),_0x55c1bb[_0xc290('0x1a')],util['inspect'](_0xe9dfd9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc290('0x14')][_0xc290('0x6b')]=function(_0x3f9eb7){try{if(this['isNotNull'](_0x3f9eb7)){logger[_0xc290('0x18')](_0xc290('0x6c'),_0x3f9eb7[_0xc290('0x1a')],util[_0xc290('0x1b')](_0x3f9eb7,{'showHidden':![],'depth':null}));if(_0x3f9eb7[_0xc290('0x6d')][_0xc290('0x6e')]()===_0xc290('0x6f')){_0x3f9eb7[_0xc290('0x70')]=(_0x3f9eb7['appdata']||_0x3f9eb7[_0xc290('0x70')])[_0xc290('0x6e')]();if(_['startsWith'](_0x3f9eb7[_0xc290('0x70')],_0xc290('0x71'))){if(_[_0xc290('0x16')](this[_0xc290('0x9')][_0x3f9eb7[_0xc290('0x1a')]]))this['applications'][_0x3f9eb7[_0xc290('0x1a')]]={};logger[_0xc290('0x25')](_0xc290('0x72'),_0x3f9eb7[_0xc290('0x1a')],_0x3f9eb7[_0xc290('0x6d')],_0x3f9eb7[_0xc290('0x70')]);var _0x5da574=_0x3f9eb7[_0xc290('0x70')][_0xc290('0x73')]('=');var _0x4b2125=_0x5da574[0x0]['match'](/cdr\((.*)\)/);if(_0x4b2125)this[_0xc290('0x9')][_0x3f9eb7[_0xc290('0x1a')]][_0x4b2125[0x1]]=_0x5da574[0x1];}}}}catch(_0x38623f){logger[_0xc290('0x2d')]('[%s][voiceDialReport][newexten]',_0x3f9eb7[_0xc290('0x1a')],util[_0xc290('0x1b')](_0x38623f,{'showHidden':![],'depth':null}));}};module[_0xc290('0x74')]=VoiceDialReport; \ No newline at end of file +var _0x1ed9=['keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','lastevent','complete','total','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','split','[%s][voiceDialReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','applications','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ed9,0x1a7));var _0x91ed=function(_0x52c181,_0x1a66b5){_0x52c181=_0x52c181-0x0;var _0x5578aa=_0x1ed9[_0x52c181];return _0x5578aa;};'use strict';var _=require(_0x91ed('0x0'));var moment=require('moment');var util=require(_0x91ed('0x1'));var Redis=require(_0x91ed('0x2'));var config=require(_0x91ed('0x3'));var logger=require(_0x91ed('0x4'))('ami');var ami=require(_0x91ed('0x5'));config['redis']=_[_0x91ed('0x6')](config[_0x91ed('0x7')],{'host':_0x91ed('0x8'),'port':0x18eb});var io=require(_0x91ed('0x9'))(new Redis(config[_0x91ed('0x7')]));function VoiceDialReport(_0x5721b2){this['channels']=_0x5721b2[_0x91ed('0xa')];this[_0x91ed('0xb')]=_0x5721b2[_0x91ed('0xb')];this['applications']={};this[_0x91ed('0xc')]={};ami['on'](_0x91ed('0xd'),this[_0x91ed('0xe')][_0x91ed('0xf')](this));ami['on'](_0x91ed('0x10'),this[_0x91ed('0x11')]['bind'](this));ami['on']('varset',this[_0x91ed('0x12')][_0x91ed('0xf')](this));ami['on']('newexten',this['syncNewExten'][_0x91ed('0xf')](this));ami['on'](_0x91ed('0x13'),this[_0x91ed('0x14')][_0x91ed('0xf')](this));}VoiceDialReport[_0x91ed('0x15')][_0x91ed('0x16')]=function(_0x5f0bb2){return _0x5f0bb2!==null&&!_[_0x91ed('0x17')](_0x5f0bb2);};VoiceDialReport['prototype'][_0x91ed('0x18')]=function(_0x5ad78c,_0x132bd1,_0x2f61a6){io['to'](_0x5ad78c)['emit'](_0x132bd1,_0x2f61a6);};VoiceDialReport[_0x91ed('0x15')][_0x91ed('0xe')]=function(_0x483695){try{if(this[_0x91ed('0x16')](_0x483695)){logger['debug'](_0x91ed('0x19'),_0x483695[_0x91ed('0x1a')],util[_0x91ed('0x1b')](_0x483695,{'showHidden':![],'depth':null}));if(this[_0x91ed('0x1c')][_0x483695[_0x91ed('0x1a')]]){_['merge'](this[_0x91ed('0x1c')][_0x483695[_0x91ed('0x1a')]],{'starttime':moment()[_0x91ed('0x1d')](_0x91ed('0x1e')),'lastevent':_0x91ed('0x1f'),'interface':_0x483695[_0x91ed('0x20')][_0x91ed('0x21')](0x0,_0x483695[_0x91ed('0x20')][_0x91ed('0x22')]('-')),'membername':_0x483695[_0x91ed('0x20')][_0x91ed('0x21')](_0x483695[_0x91ed('0x20')]['lastIndexOf']('/')+0x1,_0x483695[_0x91ed('0x20')][_0x91ed('0x22')]('-'))},_['omit'](_0x483695,[_0x91ed('0x23'),_0x91ed('0x24')]));logger[_0x91ed('0x25')](_0x91ed('0x26'),_0x483695['uniqueid'],this[_0x91ed('0x1c')][_0x483695[_0x91ed('0x1a')]][_0x91ed('0x27')],this[_0x91ed('0x1c')][_0x483695[_0x91ed('0x1a')]][_0x91ed('0x28')]);logger[_0x91ed('0x29')](_0x91ed('0x2a'),_0x483695[_0x91ed('0x1a')],util['inspect'](this['channels'][_0x483695[_0x91ed('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x483695['uniqueid']])_[_0x91ed('0x2b')](this[_0x91ed('0x1c')][_0x483695['uniqueid']],this[_0x91ed('0x2c')][_0x483695[_0x91ed('0x1a')]]);this[_0x91ed('0x18')](_0x91ed('0x2d'),_0x91ed('0x2e'),this[_0x91ed('0x1c')][_0x483695[_0x91ed('0x1a')]]);logger[_0x91ed('0x29')](_0x91ed('0x2f'),_0x483695[_0x91ed('0x1a')],util['inspect'](this[_0x91ed('0x1c')][_0x483695['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x91ed('0x18')]('custom:dialbegin',this[_0x91ed('0x1c')][_0x483695[_0x91ed('0x1a')]]);}}}catch(_0x2ca25a){logger[_0x91ed('0x30')](_0x91ed('0x31'),_0x483695['uniqueid'],util['inspect'](_0x2ca25a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x91ed('0x15')][_0x91ed('0x11')]=function(_0x3fd60a){try{if(this[_0x91ed('0x16')](_0x3fd60a)){logger['debug'](_0x91ed('0x32'),_0x3fd60a['uniqueid'],util['inspect'](_0x3fd60a,{'showHidden':![],'depth':null}));if(this[_0x91ed('0x1c')][_0x3fd60a[_0x91ed('0x1a')]]){this[_0x91ed('0x1c')][_0x3fd60a[_0x91ed('0x1a')]][_0x91ed('0x33')]=_0x3fd60a[_0x91ed('0x33')];if(_0x3fd60a['dialstatus']===_0x91ed('0x34')){this[_0x91ed('0x1c')][_0x3fd60a[_0x91ed('0x1a')]][_0x91ed('0x35')]=_0x3fd60a[_0x91ed('0x35')];this['channels'][_0x3fd60a['uniqueid']]['connectedlinename']=_0x3fd60a[_0x91ed('0x36')];this[_0x91ed('0x1c')][_0x3fd60a[_0x91ed('0x1a')]][_0x91ed('0x37')]=moment()[_0x91ed('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x91ed('0x1c')][_0x3fd60a['uniqueid']]['lastevent']=_0x91ed('0x38');logger[_0x91ed('0x25')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x3fd60a['uniqueid'],_0x3fd60a[_0x91ed('0x20')][_0x91ed('0x21')](_0x3fd60a['channel'][_0x91ed('0x22')]('/')+0x1,_0x3fd60a[_0x91ed('0x20')]['lastIndexOf']('-')));logger[_0x91ed('0x29')](_0x91ed('0x39'),_0x3fd60a[_0x91ed('0x1a')],util[_0x91ed('0x1b')](this[_0x91ed('0x1c')][_0x3fd60a['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x91ed('0x18')]('custom:dialconnect',this[_0x91ed('0x1c')][_0x3fd60a['uniqueid']]);}logger[_0x91ed('0x29')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x3fd60a[_0x91ed('0x1a')],util[_0x91ed('0x1b')](this[_0x91ed('0x1c')][_0x3fd60a['uniqueid']],{'showHidden':![],'depth':null}));this[_0x91ed('0x18')]('voice:outbound',_0x91ed('0x2e'),this[_0x91ed('0x1c')][_0x3fd60a[_0x91ed('0x1a')]]);}}}catch(_0x2e783a){logger[_0x91ed('0x30')](_0x91ed('0x3a'),_0x3fd60a[_0x91ed('0x1a')],util[_0x91ed('0x1b')](_0x2e783a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x91ed('0x15')]['syncVarSet']=function(_0x2c5303){try{if(this[_0x91ed('0x16')](_0x2c5303)){logger[_0x91ed('0x29')](_0x91ed('0x3b'),_0x2c5303[_0x91ed('0x1a')],util[_0x91ed('0x1b')](_0x2c5303,{'showHidden':![],'depth':null}));this[_0x91ed('0x3c')](_0x2c5303[_0x91ed('0x1a')],_[_0x91ed('0x3d')](_0x2c5303[_0x91ed('0x3e')])[0x0],_0x2c5303[_0x91ed('0x3f')]);if(this[_0x91ed('0x16')](_0x2c5303[_0x91ed('0x3e')])&&this[_0x91ed('0x16')](_0x2c5303[_0x91ed('0x3e')][_0x91ed('0x40')])){if(_[_0x91ed('0x17')](this[_0x91ed('0x1c')][_0x2c5303[_0x91ed('0x1a')]])){this[_0x91ed('0x1c')][_0x2c5303['uniqueid']]={'routeId':_0x2c5303[_0x91ed('0x3f')],'variables':this['variables'][_0x2c5303['uniqueid']]};logger[_0x91ed('0x25')](_0x91ed('0x41'),_0x2c5303[_0x91ed('0x1a')],_0x2c5303[_0x91ed('0x3e')]['outboundrouteid'],_['keys'](_0x2c5303[_0x91ed('0x3e')])[0x0],_0x2c5303[_0x91ed('0x3f')]);logger[_0x91ed('0x29')](_0x91ed('0x42'),_0x2c5303[_0x91ed('0x1a')],util[_0x91ed('0x1b')](this[_0x91ed('0x1c')][_0x2c5303['uniqueid']],{'showHidden':![],'depth':null}));this[_0x91ed('0x18')](_0x91ed('0x2d'),_0x91ed('0x2e'),this[_0x91ed('0x1c')][_0x2c5303[_0x91ed('0x1a')]]);}}}}catch(_0x171dfc){logger['error'](_0x91ed('0x43'),_0x2c5303[_0x91ed('0x1a')],util['inspect'](_0x171dfc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x91ed('0x15')][_0x91ed('0x3c')]=function(_0x310cdd,_0x25e5a8,_0x5ac288){var _0x193888=['rtpaudioqos',_0x91ed('0x44'),_0x91ed('0x45'),_0x91ed('0x46'),_0x91ed('0x47'),_0x91ed('0x48'),_0x91ed('0x49'),_0x91ed('0x4a'),_0x91ed('0x4b'),'sipuri','bridgepeer',_0x91ed('0x4c'),_0x91ed('0x4d'),_0x91ed('0x4e'),_0x91ed('0x4f'),_0x91ed('0x50'),'membername',_0x91ed('0x51'),_0x91ed('0x52')];if(!_['isNil'](_0x25e5a8)&&!_[_0x91ed('0x53')](_0x193888,_0x25e5a8)){if(_[_0x91ed('0x17')](this[_0x91ed('0xc')][_0x310cdd])){this[_0x91ed('0xc')][_0x310cdd]={};}this[_0x91ed('0xc')][_0x310cdd][_0x25e5a8]=_0x5ac288;}};VoiceDialReport[_0x91ed('0x15')][_0x91ed('0x14')]=function(_0x1f8867){try{if(this['isNotNull'](_0x1f8867)){logger[_0x91ed('0x29')](_0x91ed('0x54'),_0x1f8867[_0x91ed('0x1a')],util[_0x91ed('0x1b')](_0x1f8867,{'showHidden':![],'depth':null}));if(this['channels'][_0x1f8867['uniqueid']]){logger['info'](_0x91ed('0x55'),_0x1f8867[_0x91ed('0x1a')],_0x1f8867[_0x91ed('0x56')]);this[_0x91ed('0x1c')][_0x1f8867['uniqueid']][_0x91ed('0x57')]=moment()[_0x91ed('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x58')]=moment(this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x57')])[_0x91ed('0x59')](this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x5a')],_0x91ed('0x5b'));this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x5c')]=_0x91ed('0x5d');this['outbound'][_0x91ed('0x5e')]+=0x1;if(this['channels'][_0x1f8867['uniqueid']][_0x91ed('0x37')]){this[_0x91ed('0xb')]['answered']+=0x1;this['channels'][_0x1f8867['uniqueid']][_0x91ed('0x5f')]=moment(this['channels'][_0x1f8867['uniqueid']][_0x91ed('0x37')])[_0x91ed('0x59')](this['channels'][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x5a')],_0x91ed('0x5b'));this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x60')]=moment(this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x57')])[_0x91ed('0x59')](this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x37')],_0x91ed('0x5b'));this[_0x91ed('0xb')][_0x91ed('0x61')]+=this['channels'][_0x1f8867['uniqueid']][_0x91ed('0x5f')]||0x0;this[_0x91ed('0xb')][_0x91ed('0x62')]+=this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x60')];}this[_0x91ed('0xb')][_0x91ed('0x63')]+=this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]][_0x91ed('0x58')];logger[_0x91ed('0x29')](_0x91ed('0x64'),_0x1f8867[_0x91ed('0x1a')],util[_0x91ed('0x1b')](this[_0x91ed('0x1c')][_0x1f8867['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x91ed('0x18')]('custom:voiceDialReport',this['channels'][_0x1f8867[_0x91ed('0x1a')]]);logger[_0x91ed('0x29')](_0x91ed('0x65'),_0x1f8867[_0x91ed('0x1a')],util[_0x91ed('0x1b')](this['channels'][_0x1f8867[_0x91ed('0x1a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]]);logger[_0x91ed('0x29')](_0x91ed('0x66'),_0x1f8867['uniqueid'],util['inspect'](this[_0x91ed('0x1c')][_0x1f8867['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x91ed('0x2d'),_0x91ed('0x67'),this['outbound']);logger[_0x91ed('0x25')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x1f8867['uniqueid']]));logger[_0x91ed('0x29')](_0x91ed('0x68'),_0x1f8867[_0x91ed('0x1a')],util[_0x91ed('0x1b')](this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x91ed('0x2d'),_0x91ed('0x69'),this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x1a')]]);delete this['channels'][_0x1f8867[_0x91ed('0x1a')]];}else if(this['channels'][_0x1f8867[_0x91ed('0x6a')]]){this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x6a')]][_0x91ed('0x1a')]=this[_0x91ed('0x1c')][_0x1f8867[_0x91ed('0x6a')]][_0x91ed('0x6b')];}if(this[_0x91ed('0xc')][_0x1f8867[_0x91ed('0x1a')]]){delete this[_0x91ed('0xc')][_0x1f8867[_0x91ed('0x1a')]];}}}catch(_0x3430f5){logger['error'](_0x91ed('0x6c'),_0x1f8867[_0x91ed('0x1a')],util[_0x91ed('0x1b')](_0x3430f5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x91ed('0x15')][_0x91ed('0x6d')]=function(_0x25ac68){try{if(this[_0x91ed('0x16')](_0x25ac68)){logger['debug'](_0x91ed('0x6e'),_0x25ac68[_0x91ed('0x1a')],util[_0x91ed('0x1b')](_0x25ac68,{'showHidden':![],'depth':null}));if(_0x25ac68[_0x91ed('0x6f')][_0x91ed('0x70')]()===_0x91ed('0x71')){_0x25ac68[_0x91ed('0x72')]=(_0x25ac68[_0x91ed('0x73')]||_0x25ac68['applicationdata'])[_0x91ed('0x70')]();if(_[_0x91ed('0x74')](_0x25ac68[_0x91ed('0x72')],_0x91ed('0x75'))){if(_[_0x91ed('0x17')](this['applications'][_0x25ac68[_0x91ed('0x1a')]]))this['applications'][_0x25ac68[_0x91ed('0x1a')]]={};logger[_0x91ed('0x25')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x25ac68[_0x91ed('0x1a')],_0x25ac68['application'],_0x25ac68['applicationdata']);var _0x901c0e=_0x25ac68[_0x91ed('0x72')][_0x91ed('0x76')]('=');var _0x3e1251=_0x901c0e[0x0]['match'](/cdr\((.*)\)/);if(_0x3e1251)this[_0x91ed('0x2c')][_0x25ac68[_0x91ed('0x1a')]][_0x3e1251[0x1]]=_0x901c0e[0x1];}}}}catch(_0x5e75b7){logger[_0x91ed('0x30')](_0x91ed('0x77'),_0x25ac68[_0x91ed('0x1a')],util[_0x91ed('0x1b')](_0x5e75b7,{'showHidden':![],'depth':null}));}};module[_0x91ed('0x78')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 90d1149..8f0dc99 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 _0xa902=['total','unmanaged','abandoned','Trunk','active','Interval','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','[voiceQueueReport][queuesummary]','queue','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','talking','waiting','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','syncQueueSummaryComplete','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','queuecallerexitAt','queuecallerjoinAt','add','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','queuestatus','value','CONTINUE','TIMEOUT','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','isNil','includes','[%s][voiceQueueReport][hangup]','length','diff','seconds','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferuniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','lodash','moment','util','md5','ioredis','../../../config/logger','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','queueReports','agents','channels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','queueStatusComplete','clearZombieChannels','switch','sequence','enqueue','Action','status','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','error','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','emit','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime'];(function(_0x1b23d5,_0x1bd25d){var _0x8a2e3e=function(_0xbc705a){while(--_0xbc705a){_0x1b23d5['push'](_0x1b23d5['shift']());}};_0x8a2e3e(++_0x1bd25d);}(_0xa902,0x8d));var _0x2a90=function(_0x52715c,_0x296138){_0x52715c=_0x52715c-0x0;var _0xbdd94c=_0xa902[_0x52715c];return _0xbdd94c;};'use strict';var _=require(_0x2a90('0x0'));var moment=require(_0x2a90('0x1'));var util=require(_0x2a90('0x2'));var md5=require(_0x2a90('0x3'));var Redis=require(_0x2a90('0x4'));var config=require('../../../config/environment');var logger=require(_0x2a90('0x5'))('ami');var ami=require('../ami');var QueueReport=require(_0x2a90('0x6'));config[_0x2a90('0x7')]=_[_0x2a90('0x8')](config[_0x2a90('0x7')],{'host':_0x2a90('0x9'),'port':0x18eb});var io=require(_0x2a90('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x2a90('0xb')]['enqueue']=function(_0x5ec2b9){this[_0x2a90('0xc')]=this[_0x2a90('0xc')]?this[_0x2a90('0xc')][_0x2a90('0xd')](_0x5ec2b9):_0x5ec2b9();};function VoiceQueueReport(_0x18a60e){this['sequence']=new Sequence();this[_0x2a90('0xe')]={};this[_0x2a90('0xf')]=_0x18a60e[_0x2a90('0xf')];this[_0x2a90('0x10')]=_0x18a60e['queueChannels'];this[_0x2a90('0x11')]=_0x18a60e['voiceQueues'];this[_0x2a90('0x12')]=!![];this['campaigns']=_0x18a60e[_0x2a90('0x13')];this['variables']={};ami['on'](_0x2a90('0x14'),this[_0x2a90('0x15')][_0x2a90('0x16')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x2a90('0x17'),this[_0x2a90('0x18')]['bind'](this));ami['on'](_0x2a90('0x19'),this[_0x2a90('0x1a')][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x1b'),this[_0x2a90('0x1c')][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x1d'),this[_0x2a90('0x1e')][_0x2a90('0x16')](this));ami['on']('agentconnect',this[_0x2a90('0x1f')][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x20'),this['syncVarSet'][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x21'),this[_0x2a90('0x22')][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x23'),this[_0x2a90('0x24')][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x25'),this[_0x2a90('0x26')][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x27'),this[_0x2a90('0x28')]['bind'](this));ami['on'](_0x2a90('0x29'),this[_0x2a90('0x2a')][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x2b'),this['syncAttendedTransfer'][_0x2a90('0x16')](this));ami['on'](_0x2a90('0x2c'),this['syncBlindTransfer'][_0x2a90('0x16')](this));this[_0x2a90('0x2d')]();this[_0x2a90('0x2e')]();}function clearChannels(_0x2a4e28){if(!_[_0x2a90('0x2f')](_0x2a4e28)){for(var _0x1303d9 in _0x2a4e28){if(_0x2a4e28[_0x2a90('0x30')](_0x1303d9)){delete _0x2a4e28[_0x1303d9];}}}}function clearCampaigns(_0x24a6d3){if(!_['isEmpty'](_0x24a6d3)){for(var _0x27f883 in _0x24a6d3){if(_0x24a6d3[_0x2a90('0x30')](_0x27f883)){_0x24a6d3[_0x27f883][_0x2a90('0x31')]=0x0;}}}}function clearVoiceQueues(_0x40c61a){if(!_[_0x2a90('0x2f')](_0x40c61a)){for(var _0x5208d8 in _0x40c61a){if(_0x40c61a['hasOwnProperty'](_0x5208d8)){_0x40c61a[_0x5208d8][_0x2a90('0x31')]=0x0;_0x40c61a[_0x5208d8]['talking']=0x0;_0x40c61a[_0x5208d8]['pTalking']=0x0;_0x40c61a[_0x5208d8]['waiting']=0x0;_0x40c61a[_0x5208d8][_0x2a90('0x32')]=!![];}}}}function clearAgentBooked(_0x3c78f5){if(!_['isEmpty'](_0x3c78f5)){for(var _0x5bd700 in _0x3c78f5){if(_0x3c78f5[_0x2a90('0x30')](_0x5bd700)){_0x3c78f5[_0x5bd700]['unlockRR']=!![];}}}}VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x33')]=function(){var _0x3b580f=this;for(var _0x27b6b6 in this[_0x2a90('0x10')]){if(this[_0x2a90('0x10')][_0x2a90('0x30')](_0x27b6b6)&&!this['channels'][_0x27b6b6][_0x2a90('0x34')]){this[_0x2a90('0x35')][_0x2a90('0x36')](function(){if(!_['isNil'](_0x3b580f[_0x2a90('0x10')][_0x27b6b6])){return ami[_0x2a90('0x37')]({'action':_0x2a90('0x38'),'channel':_0x3b580f[_0x2a90('0x10')][_0x27b6b6]['channel']})[_0x2a90('0x39')](function(_0x1b5f73){if(_0x1b5f73[_0x2a90('0x3a')]===_0x2a90('0x3b')){setTimeout(function(){if(_0x3b580f[_0x2a90('0x10')][_0x27b6b6]){delete _0x3b580f[_0x2a90('0x10')][_0x27b6b6];logger['error'](_0x2a90('0x3c'),_0x27b6b6,util[_0x2a90('0x3d')](_0x1b5f73,{'showHidden':![],'depth':null}));}if(_0x3b580f[_0x2a90('0xe')][_0x27b6b6]){delete _0x3b580f[_0x2a90('0xe')][_0x27b6b6];logger['error'](_0x2a90('0x3e'),_0x27b6b6,util[_0x2a90('0x3d')](_0x1b5f73,{'showHidden':![],'depth':null}));}if(_0x3b580f['variables'][_0x27b6b6]){delete _0x3b580f[_0x2a90('0x3f')][_0x27b6b6];logger[_0x2a90('0x40')]('[%s][voiceQueueReport][checkVariables]',_0x27b6b6,util['inspect'](_0x1b5f73,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x24')]=function(){logger[_0x2a90('0x40')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x2a90('0x10')]);this['clearQueueReport'](this[_0x2a90('0xe')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x2a90('0x11')]);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype'][_0x2a90('0x41')]=function(_0x47d568){var _0x463721=this;if(!_[_0x2a90('0x2f')](_0x47d568)){for(var _0x218727 in _0x47d568){if(_0x47d568['hasOwnProperty'](_0x218727)){_0x463721[_0x2a90('0x42')](_0x47d568[_0x218727],_0x2a90('0x43'));delete _0x47d568[_0x218727];}}}};VoiceQueueReport[_0x2a90('0xb')]['emit']=function(_0x1cecc2,_0x2d6a44,_0x1a9c04){io['to'](_0x1cecc2)['emit'](_0x2d6a44,_0x1a9c04);};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x44')]=function(_0x504643,_0x2771e8){logger[_0x2a90('0x45')](_0x2a90('0x46')+_0x2771e8+_0x2a90('0x47'),_0x504643[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x504643,{'showHidden':![],'depth':null}));this[_0x2a90('0x49')](util[_0x2a90('0x4a')](_0x2a90('0x4b'),_0x504643[_0x2a90('0x4c')]),_0x2a90('0x4d'),_0x504643);io[_0x2a90('0x49')](_0x2a90('0x4e'),_0x504643);};VoiceQueueReport[_0x2a90('0xb')]['emitVoiceQueueChannelRemove']=function(_0x45cbc2,_0x3a70fe){logger['debug'](_0x2a90('0x46')+_0x3a70fe+_0x2a90('0x4f'),_0x45cbc2[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x45cbc2,{'showHidden':![],'depth':null}));this[_0x2a90('0x49')](util['format'](_0x2a90('0x4b'),_0x45cbc2['name']),_0x2a90('0x50'),_0x45cbc2);io['emit'](_0x2a90('0x51'),_0x45cbc2);};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x52')]=function(_0x31c69f,_0x315c78){if(_0x31c69f[_0x2a90('0x53')]===_0x2a90('0x54')){var _0x48d464={'id':_0x31c69f['id'],'name':_0x31c69f['name'],'strategy':_0x31c69f[_0x2a90('0x55')],'answered':_0x31c69f[_0x2a90('0x56')],'available':_0x31c69f[_0x2a90('0x57')],'loggedIn':_0x31c69f[_0x2a90('0x58')],'pTalking':_0x31c69f[_0x2a90('0x59')],'sumBillable':_0x31c69f[_0x2a90('0x5a')],'sumDuration':_0x31c69f[_0x2a90('0x5b')],'sumHoldTime':_0x31c69f[_0x2a90('0x5c')]||0x0,'talking':_0x31c69f['talking'],'total':_0x31c69f[_0x2a90('0x5d')],'type':_0x31c69f['type'],'unmanaged':_0x31c69f[_0x2a90('0x5e')],'abandoned':_0x31c69f[_0x2a90('0x5f')],'waiting':_0x31c69f['waiting']};if(_0x31c69f[_0x2a90('0x60')]){_0x48d464[_0x2a90('0x60')]={'id':_0x31c69f[_0x2a90('0x60')]['id'],'name':_0x31c69f[_0x2a90('0x60')][_0x2a90('0x4c')],'active':_0x31c69f[_0x2a90('0x60')][_0x2a90('0x61')],'callerid':_0x31c69f['Trunk']['callerid']};}if(_0x31c69f[_0x2a90('0x62')]){_0x48d464[_0x2a90('0x62')]={'id':_0x31c69f[_0x2a90('0x62')]['id'],'name':_0x31c69f[_0x2a90('0x62')][_0x2a90('0x4c')]};}var _0x5e203f=md5(JSON['stringify'](_0x48d464));if(_0x31c69f[_0x2a90('0x3')]!==_0x5e203f){_0x31c69f[_0x2a90('0x3')]=_0x5e203f;logger['debug']('[voiceQueueReport]['+_0x315c78+']\x20sending\x20voice_queue:save\x20event:',util[_0x2a90('0x3d')](_0x48d464,{'showHidden':![],'depth':null}));this['emit'](util[_0x2a90('0x4a')](_0x2a90('0x4b'),_0x48d464[_0x2a90('0x4c')]),_0x2a90('0x63'),_0x48d464);}}};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x64')]=function(_0x4f507a){return _0x4f507a!==null&&!_[_0x2a90('0x65')](_0x4f507a);};VoiceQueueReport[_0x2a90('0xb')]['loopQueueShow']=function(){var _0x265769=this;setInterval(function(){_0x265769['clearZombieChannels']();ami['Action']({'action':_0x2a90('0x66')})[_0x2a90('0x39')](function(_0x5819ab){logger['error'](_0x2a90('0x67'),util['inspect'](_0x5819ab,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x2d')]=function(){var _0x561bae=this;setInterval(function(){if(_0x561bae[_0x2a90('0x12')]){return ami[_0x2a90('0x37')]({'action':_0x2a90('0x14')})['then'](function(_0x44b3eb){_0x561bae[_0x2a90('0x12')]=![];})['catch'](function(_0x548426){logger[_0x2a90('0x40')](_0x2a90('0x68'),util['inspect'](_0x548426,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x2a90('0xb')]['syncQueueSummary']=function(_0x1302b9){try{if(this['isNotNull'](_0x1302b9)&&this[_0x2a90('0x64')](_0x1302b9[_0x2a90('0x69')])){logger[_0x2a90('0x45')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x1302b9,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x1302b9[_0x2a90('0x69')]]){logger[_0x2a90('0x6a')](_0x2a90('0x6b'),_0x1302b9[_0x2a90('0x69')]);var _0x2e5762=_[_0x2a90('0x6c')](this[_0x2a90('0x10')],_0x2a90('0x69'))[_0x1302b9[_0x2a90('0x69')]]||0x0;var _0x4f4dc6=_0x2e5762-_0x1302b9[_0x2a90('0x6d')];if(this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]]['waiting']!==_['toNumber'](_0x1302b9['callers'])||this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]][_0x2a90('0x58')]!==_[_0x2a90('0x6e')](_0x1302b9[_0x2a90('0x6f')])||this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]][_0x2a90('0x57')]!==_[_0x2a90('0x6e')](_0x1302b9[_0x2a90('0x57')])||this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]][_0x2a90('0x70')]!==_0x4f4dc6){this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]][_0x2a90('0x71')]=_['toNumber'](_0x1302b9[_0x2a90('0x6d')]);this['voiceQueues'][_0x1302b9[_0x2a90('0x69')]][_0x2a90('0x58')]=_[_0x2a90('0x6e')](_0x1302b9[_0x2a90('0x6f')]);this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]][_0x2a90('0x57')]=_['toNumber'](_0x1302b9[_0x2a90('0x57')]);this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]]['talking']=_0x4f4dc6>0x0?_0x4f4dc6:0x0;this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]][_0x2a90('0x70')]=this[_0x2a90('0x11')][_0x1302b9['queue']][_0x2a90('0x70')]>_['toNumber'](_0x1302b9[_0x2a90('0x6f')])?_[_0x2a90('0x6e')](_0x1302b9[_0x2a90('0x6f')]):this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]][_0x2a90('0x70')];this['emitVoiceQueueSummary'](this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]],_0x2a90('0x14'));}logger[_0x2a90('0x45')](_0x2a90('0x72'),util[_0x2a90('0x3d')](this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]],{'showHidden':![],'depth':null}));ami[_0x2a90('0x49')]('custom:queuesummary',this[_0x2a90('0x11')][_0x1302b9[_0x2a90('0x69')]]);}}}catch(_0x3f6580){logger['error'](_0x2a90('0x68'),util[_0x2a90('0x3d')](_0x3f6580,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x73')]=function(_0x1fd54a){logger['debug'](_0x2a90('0x74'),util['inspect'](_0x1fd54a,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x2a90('0xb')]['syncQueueCallerJoin']=function(_0x49dcda){try{if(this[_0x2a90('0x64')](_0x49dcda)){logger['debug'](_0x2a90('0x75'),_0x49dcda[_0x2a90('0x48')],util['inspect'](_0x49dcda,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x2a90('0xe')][_0x49dcda['uniqueid']]))this['queueReports'][_0x49dcda[_0x2a90('0x48')]]=[];if(_[_0x2a90('0x65')](this[_0x2a90('0x10')][_0x49dcda[_0x2a90('0x48')]]))this['channels'][_0x49dcda['uniqueid']]={};var _0x370144=new QueueReport();_0x370144[_0x2a90('0x4c')]=_0x49dcda[_0x2a90('0x69')];_0x370144[_0x2a90('0x53')]=this[_0x2a90('0x11')][_0x370144[_0x2a90('0x4c')]]&&this[_0x2a90('0x11')][_0x370144[_0x2a90('0x4c')]][_0x2a90('0x53')]?this[_0x2a90('0x11')][_0x370144[_0x2a90('0x4c')]][_0x2a90('0x53')]||'inbound':_0x2a90('0x54');_0x370144['queue']=_0x49dcda[_0x2a90('0x69')];_0x370144['queuecallerjoinAt']=moment()[_0x2a90('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x370144['position']=_0x49dcda[_0x2a90('0x76')];_0x370144[_0x2a90('0x77')]=_0x49dcda[_0x2a90('0x77')];_0x370144[_0x2a90('0x48')]=_0x49dcda['uniqueid'];_0x370144['routealias']=this[_0x2a90('0x10')][_0x49dcda[_0x2a90('0x48')]][_0x2a90('0x78')];logger[_0x2a90('0x6a')](_0x2a90('0x79'),_0x370144[_0x2a90('0x4c')],_0x370144[_0x2a90('0x53')]);_[_0x2a90('0x7a')](_0x370144,_[_0x2a90('0x7b')](_0x49dcda,_[_0x2a90('0x7c')](_0x370144)));this[_0x2a90('0xe')][_0x49dcda[_0x2a90('0x48')]]['push'](_0x370144);this[_0x2a90('0x10')][_0x49dcda[_0x2a90('0x48')]]=_0x370144;this[_0x2a90('0x44')](_0x370144,_0x2a90('0x17'));}}catch(_0x3729d2){logger[_0x2a90('0x40')](_0x2a90('0x75'),_0x49dcda[_0x2a90('0x48')],util['inspect'](_0x3729d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x1a')]=function(_0x47abdd){try{if(this[_0x2a90('0x64')](_0x47abdd)){logger[_0x2a90('0x45')](_0x2a90('0x7d'),_0x47abdd[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x47abdd,{'showHidden':![],'depth':null}));if(this[_0x2a90('0xe')][_0x47abdd['uniqueid']]){var _0x45ea35=_[_0x2a90('0x7e')](this[_0x2a90('0xe')][_0x47abdd[_0x2a90('0x48')]]);_0x45ea35[_0x2a90('0x7f')]=![];_0x45ea35[_0x2a90('0x80')]=null;_0x45ea35[_0x2a90('0x81')]=_0x47abdd[_0x2a90('0x81')];_0x45ea35['originalposition']=_0x47abdd[_0x2a90('0x82')];_0x45ea35[_0x2a90('0x19')]=!![];_0x45ea35[_0x2a90('0x83')]=moment()[_0x2a90('0x4a')](_0x2a90('0x84'));_0x45ea35[_0x2a90('0x85')]='ABANDONED';_0x45ea35[_0x2a90('0x86')]=null;logger[_0x2a90('0x6a')](_0x2a90('0x87'),_0x45ea35['name'],_0x45ea35[_0x2a90('0x53')]);this[_0x2a90('0x10')][_0x47abdd[_0x2a90('0x48')]]=_0x45ea35;this['emitVoiceQueueChannelRemove'](_0x45ea35,'queuecallerabandon');}}}catch(_0x32f443){logger[_0x2a90('0x40')]('[%s][voiceQueueReport][queuecallerabandon]',_0x47abdd[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x32f443,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2a90('0x1c')]=function(_0x3bfeed){try{if(this['isNotNull'](_0x3bfeed)){logger[_0x2a90('0x45')](_0x2a90('0x88'),_0x3bfeed['uniqueid'],util['inspect'](_0x3bfeed,{'showHidden':![],'depth':null}));if(this[_0x2a90('0xe')][_0x3bfeed[_0x2a90('0x48')]]){var _0x184263=_[_0x2a90('0x7e')](this[_0x2a90('0xe')][_0x3bfeed[_0x2a90('0x48')]]);_0x184263[_0x2a90('0x89')]=moment()[_0x2a90('0x4a')](_0x2a90('0x84'));_0x184263[_0x2a90('0x8a')]=_0x3bfeed[_0x2a90('0x8a')];_0x184263['connectedlinename']=_0x3bfeed[_0x2a90('0x8b')];logger[_0x2a90('0x6a')](_0x2a90('0x8c'),_0x184263['name'],_0x184263[_0x2a90('0x53')],_0x3bfeed[_0x2a90('0x8a')],_0x3bfeed[_0x2a90('0x8b')]);this['channels'][_0x3bfeed[_0x2a90('0x48')]]=_0x184263;this[_0x2a90('0x44')](_0x184263,_0x2a90('0x1b'));}}}catch(_0x123c72){logger[_0x2a90('0x40')](_0x2a90('0x88'),_0x3bfeed[_0x2a90('0x48')],util['inspect'](_0x123c72,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2a90('0x1f')]=function(_0x58d256){try{if(this[_0x2a90('0x64')](_0x58d256)){logger[_0x2a90('0x45')]('[%s][voiceQueueReport][agentconnect]',_0x58d256[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x58d256,{'showHidden':![],'depth':null}));if(this[_0x2a90('0xe')][_0x58d256[_0x2a90('0x48')]]){var _0x90338c=_[_0x2a90('0x7e')](this[_0x2a90('0xe')][_0x58d256[_0x2a90('0x48')]]);_0x90338c[_0x2a90('0x7f')]=!![];_0x90338c['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x2a90('0x6a')](_0x2a90('0x8d'),_0x90338c[_0x2a90('0x4c')],_0x90338c[_0x2a90('0x53')]);}}}catch(_0x43bf9a){logger[_0x2a90('0x40')](_0x2a90('0x8e'),_0x58d256[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x43bf9a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0x1e')]=function(_0xa8c5ef){try{if(this[_0x2a90('0x64')](_0xa8c5ef)){logger[_0x2a90('0x45')](_0x2a90('0x8f'),_0xa8c5ef[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0xa8c5ef,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xa8c5ef[_0x2a90('0x48')]]){var _0x41d882=_[_0x2a90('0x7e')](this[_0x2a90('0xe')][_0xa8c5ef['uniqueid']]);_0x41d882[_0x2a90('0x19')]=![];_0x41d882[_0x2a90('0x83')]=null;_0x41d882[_0x2a90('0x90')]=!![];_0x41d882['lastAssignedTo']=_0xa8c5ef[_0x2a90('0x91')];_0x41d882[_0x2a90('0x81')]=_0xa8c5ef[_0x2a90('0x81')];_0x41d882[_0x2a90('0x7f')]=!![];_0x41d882[_0x2a90('0x92')]=![];_0x41d882['queuecallerexitAt']=null;if(!_0x41d882['transfer']){if(_0xa8c5ef[_0x2a90('0x93')]==_0x2a90('0x94')){_0x41d882['queuecallerexitreason']=_0x2a90('0x95');logger[_0x2a90('0x6a')](_0x2a90('0x96'),_0x41d882[_0x2a90('0x4c')],_0x41d882[_0x2a90('0x53')]);}else{if(_[_0x2a90('0x97')](_0xa8c5ef[_0x2a90('0x98')][_0x2a90('0x99')](),_0x2a90('0x9a'))){if(this[_0x2a90('0xe')][_0xa8c5ef['linkedid']]){var _0x23f5f7=_[_0x2a90('0x7e')](this[_0x2a90('0xe')][_0xa8c5ef[_0x2a90('0x9b')]]);_0x23f5f7[_0x2a90('0x7f')]=![];_0x23f5f7[_0x2a90('0x92')]=!![];_0x23f5f7[_0x2a90('0x9c')]=moment(_0x41d882[_0x2a90('0x9d')])[_0x2a90('0x9e')](_0xa8c5ef[_0x2a90('0x81')],'seconds')[_0x2a90('0x4a')](_0x2a90('0x84'));_0x23f5f7[_0x2a90('0x85')]='FORWARDTRANSFER';_0x23f5f7[_0x2a90('0x94')]=!![];_0x23f5f7[_0x2a90('0x9f')]=_0x2a90('0xa0');_0x23f5f7[_0x2a90('0xa1')]=_0xa8c5ef[_0x2a90('0xa2')];_0x23f5f7['transferuniqueid']=_0xa8c5ef['uniqueid'];logger['info'](_0x2a90('0xa3'),_0x23f5f7[_0x2a90('0x4c')],_0x23f5f7[_0x2a90('0x53')]);var _0x1889ce=this[_0x2a90('0xe')][_0xa8c5ef[_0x2a90('0x9b')]];this[_0x2a90('0xe')][_0xa8c5ef[_0x2a90('0x9b')]]=this['queueReports'][_0xa8c5ef[_0x2a90('0x48')]];this[_0x2a90('0xe')][_0xa8c5ef[_0x2a90('0x48')]]=_0x1889ce;}}else{_0x41d882[_0x2a90('0x85')]=_0x2a90('0xa4')+_0xa8c5ef[_0x2a90('0x93')][_0x2a90('0xa5')]();logger[_0x2a90('0x6a')](_0x2a90('0xa6'),_0x41d882['name'],_0x41d882[_0x2a90('0x53')],_0x41d882[_0x2a90('0x85')]);}}}this[_0x2a90('0x10')][_0xa8c5ef[_0x2a90('0x48')]]=_0x41d882;this[_0x2a90('0x42')](_0x41d882,_0x2a90('0x1d'));}}}catch(_0x548643){logger[_0x2a90('0x40')](_0x2a90('0x8f'),_0xa8c5ef[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x548643,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2a90('0xb')]['syncVarSet']=function(_0x101477){try{if(this[_0x2a90('0x64')](_0x101477)){logger[_0x2a90('0x45')](_0x2a90('0xa7'),_0x101477['uniqueid'],util[_0x2a90('0x3d')](_0x101477,{'showHidden':![],'depth':null}));this[_0x2a90('0xa8')](_0x101477[_0x2a90('0x48')],_[_0x2a90('0x7c')](_0x101477['variable'])[0x0],_0x101477['value']);if(this[_0x2a90('0xe')][_0x101477['uniqueid']]){var _0x222d8d=_['last'](this['queueReports'][_0x101477[_0x2a90('0x48')]]);if(_0x222d8d){if(this['isNotNull'](_0x101477[_0x2a90('0xa9')])&&this[_0x2a90('0x64')](_0x101477[_0x2a90('0xa9')][_0x2a90('0xaa')])){switch(_0x101477[_0x2a90('0xab')]){case _0x2a90('0xac'):_0x222d8d[_0x2a90('0x92')]=![];_0x222d8d[_0x2a90('0x9c')]=null;break;case _0x2a90('0xad'):_0x222d8d[_0x2a90('0xae')]='timeout';_0x222d8d['queuecallerexit']=!![];_0x222d8d[_0x2a90('0x9c')]=moment()[_0x2a90('0x4a')](_0x2a90('0x84'));_0x222d8d[_0x2a90('0x89')]=moment()[_0x2a90('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x2a90('0xaf'),_0x101477[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x222d8d,{'showHidden':![],'depth':null}));ami[_0x2a90('0x49')](_0x2a90('0xb0'),_0x222d8d);break;default:_0x222d8d[_0x2a90('0x92')]=!![];_0x222d8d[_0x2a90('0x9c')]=moment()[_0x2a90('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x222d8d[_0x2a90('0x89')]=moment()[_0x2a90('0x4a')](_0x2a90('0x84'));}_0x222d8d['queuecallerabandon']=![];_0x222d8d[_0x2a90('0x83')]=null;_0x222d8d[_0x2a90('0x85')]=_0x101477[_0x2a90('0xab')];this['channels'][_0x101477[_0x2a90('0x48')]]=_0x222d8d;this['emitVoiceQueueChannelRemove'](_0x222d8d,_0x2a90('0x20'));}else if(this['isNotNull'](_0x101477[_0x2a90('0xa9')])&&this[_0x2a90('0x64')](_0x101477[_0x2a90('0xa9')][_0x2a90('0xb1')])){if(!_0x222d8d[_0x2a90('0x19')]){_0x222d8d[_0x2a90('0x92')]=!![];_0x222d8d[_0x2a90('0x9c')]=moment()[_0x2a90('0x4a')](_0x2a90('0x84'));_0x222d8d[_0x2a90('0x85')]='EXITWITHKEY';_0x222d8d['queuecallerleaveAt']=moment()[_0x2a90('0x4a')](_0x2a90('0x84'));this['channels'][_0x101477[_0x2a90('0x48')]]=_0x222d8d;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x101477[_0x2a90('0x48')],_0x222d8d[_0x2a90('0x4c')],_0x222d8d[_0x2a90('0x53')],_[_0x2a90('0x7c')](_0x101477[_0x2a90('0xa9')])[0x0],_0x101477[_0x2a90('0xab')]);_0x222d8d['variables']=this['variables'][_0x101477[_0x2a90('0x48')]];}}}}catch(_0x59fec5){logger[_0x2a90('0x40')](_0x2a90('0xa7'),_0x101477[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x59fec5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2a90('0xb')][_0x2a90('0xa8')]=function(_0x775576,_0x5d46d4,_0xc4b461){var _0x1e89c9=[_0x2a90('0xb2'),_0x2a90('0xb3'),_0x2a90('0xb4'),'rtpaudioqosjitterbridged',_0x2a90('0xb5'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x2a90('0xb6'),_0x2a90('0xb7'),_0x2a90('0xb8'),'bridgepvtcallid',_0x2a90('0xb9'),_0x2a90('0xba'),'memberinterface',_0x2a90('0xbb'),'membername',_0x2a90('0xbc'),'memberrealtime'];if(!_[_0x2a90('0xbd')](_0x5d46d4)&&!_[_0x2a90('0xbe')](_0x1e89c9,_0x5d46d4)){if(_[_0x2a90('0x65')](this[_0x2a90('0x3f')][_0x775576])){this[_0x2a90('0x3f')][_0x775576]={};}this[_0x2a90('0x3f')][_0x775576][_0x5d46d4]=_0xc4b461;}};VoiceQueueReport[_0x2a90('0xb')]['syncHangup']=function(_0x1f8c31){try{if(this['isNotNull'](_0x1f8c31)){logger[_0x2a90('0x45')](_0x2a90('0xbf'),_0x1f8c31[_0x2a90('0x48')],util[_0x2a90('0x3d')](_0x1f8c31,{'showHidden':![],'depth':null}));if(this[_0x2a90('0xe')][_0x1f8c31[_0x2a90('0x48')]]){for(var _0x10cf34=0x0,_0x2c765c={};_0x10cf340x0?_0x2c7841:0x0;this[_0x8acb('0x12')][_0x3ee20c[_0x8acb('0x6e')]][_0x8acb('0x32')]=this[_0x8acb('0x12')][_0x3ee20c[_0x8acb('0x6e')]][_0x8acb('0x32')]>_[_0x8acb('0x72')](_0x3ee20c['loggedin'])?_[_0x8acb('0x72')](_0x3ee20c[_0x8acb('0x73')]):this[_0x8acb('0x12')][_0x3ee20c[_0x8acb('0x6e')]]['talking'];this['emitVoiceQueueSummary'](this[_0x8acb('0x12')][_0x3ee20c['queue']],'queuesummary');}logger[_0x8acb('0x48')](_0x8acb('0x74'),util[_0x8acb('0x42')](this['voiceQueues'][_0x3ee20c[_0x8acb('0x6e')]],{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummary',this[_0x8acb('0x12')][_0x3ee20c['queue']]);}}}catch(_0x102269){logger[_0x8acb('0x40')](_0x8acb('0x6c'),util['inspect'](_0x102269,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8acb('0xb')]['syncQueueSummaryComplete']=function(_0x3a5614){logger[_0x8acb('0x48')](_0x8acb('0x75'),util[_0x8acb('0x42')](_0x3a5614,{'showHidden':![],'depth':null}));this[_0x8acb('0x13')]=!![];};VoiceQueueReport[_0x8acb('0xb')]['syncQueueCallerJoin']=function(_0x5d11cd){try{if(this[_0x8acb('0x76')](_0x5d11cd)){logger[_0x8acb('0x48')](_0x8acb('0x77'),_0x5d11cd[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x5d11cd,{'showHidden':![],'depth':null}));if(_[_0x8acb('0x66')](this[_0x8acb('0xf')][_0x5d11cd[_0x8acb('0x4a')]]))this['queueReports'][_0x5d11cd[_0x8acb('0x4a')]]=[];if(_[_0x8acb('0x66')](this['channels'][_0x5d11cd[_0x8acb('0x4a')]]))this[_0x8acb('0x38')][_0x5d11cd[_0x8acb('0x4a')]]={};var _0x2c92d9=new QueueReport();_0x2c92d9['name']=_0x5d11cd[_0x8acb('0x6e')];_0x2c92d9['type']=this['voiceQueues'][_0x2c92d9[_0x8acb('0x4c')]]&&this['voiceQueues'][_0x2c92d9['name']][_0x8acb('0x78')]?this[_0x8acb('0x12')][_0x2c92d9[_0x8acb('0x4c')]]['type']||_0x8acb('0x53'):_0x8acb('0x53');_0x2c92d9['queue']=_0x5d11cd[_0x8acb('0x6e')];_0x2c92d9[_0x8acb('0x79')]=moment()[_0x8acb('0x64')](_0x8acb('0x7a'));_0x2c92d9[_0x8acb('0x7b')]=_0x5d11cd[_0x8acb('0x7b')];_0x2c92d9[_0x8acb('0x7c')]=_0x5d11cd[_0x8acb('0x7c')];_0x2c92d9[_0x8acb('0x4a')]=_0x5d11cd[_0x8acb('0x4a')];_0x2c92d9[_0x8acb('0x7d')]=this['channels'][_0x5d11cd[_0x8acb('0x4a')]][_0x8acb('0x7d')];logger[_0x8acb('0x7e')](_0x8acb('0x7f'),_0x2c92d9[_0x8acb('0x4c')],_0x2c92d9[_0x8acb('0x78')]);_[_0x8acb('0x80')](_0x2c92d9,_['pick'](_0x5d11cd,_[_0x8acb('0x81')](_0x2c92d9)));this[_0x8acb('0xf')][_0x5d11cd[_0x8acb('0x4a')]]['push'](_0x2c92d9);this['channels'][_0x5d11cd[_0x8acb('0x4a')]]=_0x2c92d9;this[_0x8acb('0x47')](_0x2c92d9,'queuecallerjoin');}}catch(_0x337e7a){logger[_0x8acb('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x5d11cd['uniqueid'],util[_0x8acb('0x42')](_0x337e7a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8acb('0xb')][_0x8acb('0x1d')]=function(_0x391d42){try{if(this[_0x8acb('0x76')](_0x391d42)){logger[_0x8acb('0x48')](_0x8acb('0x82'),_0x391d42[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x391d42,{'showHidden':![],'depth':null}));if(this[_0x8acb('0xf')][_0x391d42['uniqueid']]){var _0x5bc690=_[_0x8acb('0x83')](this[_0x8acb('0xf')][_0x391d42[_0x8acb('0x4a')]]);_0x5bc690[_0x8acb('0x84')]=![];_0x5bc690[_0x8acb('0x85')]=null;_0x5bc690['holdtime']=_0x391d42[_0x8acb('0x86')];_0x5bc690[_0x8acb('0x87')]=_0x391d42[_0x8acb('0x87')];_0x5bc690[_0x8acb('0x1c')]=!![];_0x5bc690[_0x8acb('0x88')]=moment()[_0x8acb('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x5bc690['queuecallerexitreason']=_0x8acb('0x89');_0x5bc690[_0x8acb('0x8a')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5bc690[_0x8acb('0x4c')],_0x5bc690[_0x8acb('0x78')]);this[_0x8acb('0x38')][_0x391d42[_0x8acb('0x4a')]]=_0x5bc690;this[_0x8acb('0x4f')](_0x5bc690,_0x8acb('0x1c'));}}}catch(_0x32d7e8){logger[_0x8acb('0x40')](_0x8acb('0x82'),_0x391d42['uniqueid'],util[_0x8acb('0x42')](_0x32d7e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8acb('0xb')][_0x8acb('0x1f')]=function(_0xf3fb80){try{if(this[_0x8acb('0x76')](_0xf3fb80)){logger[_0x8acb('0x48')](_0x8acb('0x8b'),_0xf3fb80[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0xf3fb80,{'showHidden':![],'depth':null}));if(this[_0x8acb('0xf')][_0xf3fb80['uniqueid']]){var _0xee8c8a=_[_0x8acb('0x83')](this[_0x8acb('0xf')][_0xf3fb80['uniqueid']]);_0xee8c8a[_0x8acb('0x8c')]=moment()[_0x8acb('0x64')](_0x8acb('0x7a'));_0xee8c8a[_0x8acb('0x8d')]=_0xf3fb80[_0x8acb('0x8d')];_0xee8c8a[_0x8acb('0x8e')]=_0xf3fb80['connectedlinename'];logger[_0x8acb('0x7e')](_0x8acb('0x8f'),_0xee8c8a[_0x8acb('0x4c')],_0xee8c8a[_0x8acb('0x78')],_0xf3fb80['connectedlinenum'],_0xf3fb80[_0x8acb('0x8e')]);this[_0x8acb('0x38')][_0xf3fb80[_0x8acb('0x4a')]]=_0xee8c8a;this[_0x8acb('0x47')](_0xee8c8a,_0x8acb('0x1e'));}}}catch(_0x1eed90){logger[_0x8acb('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0xf3fb80['uniqueid'],util[_0x8acb('0x42')](_0x1eed90,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8acb('0xb')][_0x8acb('0x22')]=function(_0x2f78b7){try{if(this[_0x8acb('0x76')](_0x2f78b7)){logger[_0x8acb('0x48')](_0x8acb('0x90'),_0x2f78b7[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x2f78b7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2f78b7[_0x8acb('0x4a')]]){var _0x16587e=_[_0x8acb('0x83')](this[_0x8acb('0xf')][_0x2f78b7[_0x8acb('0x4a')]]);_0x16587e['queuecallercomplete']=!![];_0x16587e['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x8acb('0x7e')](_0x8acb('0x91'),_0x16587e[_0x8acb('0x4c')],_0x16587e[_0x8acb('0x78')]);}}}catch(_0x3229c9){logger[_0x8acb('0x40')](_0x8acb('0x90'),_0x2f78b7[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x3229c9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8acb('0x21')]=function(_0x337bc9){try{if(this[_0x8acb('0x76')](_0x337bc9)){logger['debug'](_0x8acb('0x92'),_0x337bc9[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x337bc9,{'showHidden':![],'depth':null}));if(this[_0x8acb('0xf')][_0x337bc9[_0x8acb('0x4a')]]){var _0x28e57b=_['last'](this[_0x8acb('0xf')][_0x337bc9[_0x8acb('0x4a')]]);_0x28e57b[_0x8acb('0x1c')]=![];_0x28e57b[_0x8acb('0x88')]=null;_0x28e57b['assigned']=!![];_0x28e57b[_0x8acb('0x8a')]=_0x337bc9['membername'];_0x28e57b[_0x8acb('0x86')]=_0x337bc9[_0x8acb('0x86')];_0x28e57b[_0x8acb('0x84')]=!![];_0x28e57b[_0x8acb('0x93')]=![];_0x28e57b[_0x8acb('0x94')]=null;if(!_0x28e57b[_0x8acb('0x95')]){if(_0x337bc9['reason']==_0x8acb('0x95')){_0x28e57b['queuecallerexitreason']=_0x8acb('0x96');logger[_0x8acb('0x7e')](_0x8acb('0x97'),_0x28e57b['name'],_0x28e57b[_0x8acb('0x78')]);}else{if(_[_0x8acb('0x98')](_0x337bc9[_0x8acb('0x3c')]['toLowerCase'](),_0x8acb('0x99'))){if(this[_0x8acb('0xf')][_0x337bc9[_0x8acb('0x9a')]]){var _0x67df86=_[_0x8acb('0x83')](this[_0x8acb('0xf')][_0x337bc9[_0x8acb('0x9a')]]);_0x67df86[_0x8acb('0x84')]=![];_0x67df86[_0x8acb('0x93')]=!![];_0x67df86['queuecallerexitAt']=moment(_0x28e57b[_0x8acb('0x79')])['add'](_0x337bc9[_0x8acb('0x86')],'seconds')['format'](_0x8acb('0x7a'));_0x67df86[_0x8acb('0x9b')]=_0x8acb('0x9c');_0x67df86['transfer']=!![];_0x67df86[_0x8acb('0x9d')]=_0x8acb('0x9e');_0x67df86[_0x8acb('0x9f')]=_0x337bc9[_0x8acb('0xa0')];_0x67df86[_0x8acb('0xa1')]=_0x337bc9['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x67df86[_0x8acb('0x4c')],_0x67df86[_0x8acb('0x78')]);var _0x42fca5=this['queueReports'][_0x337bc9[_0x8acb('0x9a')]];this[_0x8acb('0xf')][_0x337bc9['linkedid']]=this[_0x8acb('0xf')][_0x337bc9[_0x8acb('0x4a')]];this[_0x8acb('0xf')][_0x337bc9[_0x8acb('0x4a')]]=_0x42fca5;}}else{_0x28e57b['queuecallerexitreason']=_0x8acb('0xa2')+_0x337bc9[_0x8acb('0xa3')][_0x8acb('0xa4')]();logger[_0x8acb('0x7e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x28e57b[_0x8acb('0x4c')],_0x28e57b[_0x8acb('0x78')],_0x28e57b[_0x8acb('0x9b')]);}}}this[_0x8acb('0x38')][_0x337bc9['uniqueid']]=_0x28e57b;this['emitVoiceQueueChannelRemove'](_0x28e57b,_0x8acb('0x20'));}}}catch(_0x1a9d21){logger['error'](_0x8acb('0x92'),_0x337bc9[_0x8acb('0x4a')],util['inspect'](_0x1a9d21,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8acb('0xa5')]=function(_0x27b1d0){try{if(this['isNotNull'](_0x27b1d0)){logger[_0x8acb('0x48')](_0x8acb('0xa6'),_0x27b1d0[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x27b1d0,{'showHidden':![],'depth':null}));this[_0x8acb('0xa7')](_0x27b1d0[_0x8acb('0x4a')],_[_0x8acb('0x81')](_0x27b1d0[_0x8acb('0xa8')])[0x0],_0x27b1d0[_0x8acb('0xa9')]);if(this[_0x8acb('0xf')][_0x27b1d0[_0x8acb('0x4a')]]){var _0x2d1fa2=_[_0x8acb('0x83')](this[_0x8acb('0xf')][_0x27b1d0['uniqueid']]);if(_0x2d1fa2){if(this['isNotNull'](_0x27b1d0[_0x8acb('0xa8')])&&this[_0x8acb('0x76')](_0x27b1d0[_0x8acb('0xa8')]['queuestatus'])){switch(_0x27b1d0[_0x8acb('0xa9')]){case _0x8acb('0xaa'):_0x2d1fa2[_0x8acb('0x93')]=![];_0x2d1fa2['queuecallerexitAt']=null;break;case _0x8acb('0xab'):_0x2d1fa2[_0x8acb('0xac')]=_0x8acb('0xad');_0x2d1fa2[_0x8acb('0x93')]=!![];_0x2d1fa2[_0x8acb('0x94')]=moment()['format'](_0x8acb('0x7a'));_0x2d1fa2[_0x8acb('0x8c')]=moment()[_0x8acb('0x64')](_0x8acb('0x7a'));logger[_0x8acb('0x48')](_0x8acb('0xae'),_0x27b1d0[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x2d1fa2,{'showHidden':![],'depth':null}));ami[_0x8acb('0x46')](_0x8acb('0xaf'),_0x2d1fa2);break;default:_0x2d1fa2[_0x8acb('0x93')]=!![];_0x2d1fa2[_0x8acb('0x94')]=moment()[_0x8acb('0x64')](_0x8acb('0x7a'));_0x2d1fa2[_0x8acb('0x8c')]=moment()[_0x8acb('0x64')](_0x8acb('0x7a'));}_0x2d1fa2[_0x8acb('0x1c')]=![];_0x2d1fa2['queuecallerabandonAt']=null;_0x2d1fa2[_0x8acb('0x9b')]=_0x27b1d0[_0x8acb('0xa9')];this[_0x8acb('0x38')][_0x27b1d0[_0x8acb('0x4a')]]=_0x2d1fa2;this[_0x8acb('0x4f')](_0x2d1fa2,_0x8acb('0xb0'));}else if(this[_0x8acb('0x76')](_0x27b1d0['variable'])&&this[_0x8acb('0x76')](_0x27b1d0[_0x8acb('0xa8')][_0x8acb('0xb1')])){if(!_0x2d1fa2[_0x8acb('0x1c')]){_0x2d1fa2[_0x8acb('0x93')]=!![];_0x2d1fa2['queuecallerexitAt']=moment()[_0x8acb('0x64')](_0x8acb('0x7a'));_0x2d1fa2[_0x8acb('0x9b')]=_0x8acb('0xb2');_0x2d1fa2[_0x8acb('0x8c')]=moment()['format'](_0x8acb('0x7a'));this[_0x8acb('0x38')][_0x27b1d0[_0x8acb('0x4a')]]=_0x2d1fa2;}}logger['info'](_0x8acb('0xb3'),_0x27b1d0['uniqueid'],_0x2d1fa2[_0x8acb('0x4c')],_0x2d1fa2[_0x8acb('0x78')],_[_0x8acb('0x81')](_0x27b1d0[_0x8acb('0xa8')])[0x0],_0x27b1d0['value']);_0x2d1fa2[_0x8acb('0x15')]=this['variables'][_0x27b1d0[_0x8acb('0x4a')]];}}}}catch(_0x1fa45a){logger[_0x8acb('0x40')](_0x8acb('0xa6'),_0x27b1d0[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x1fa45a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8acb('0xb')][_0x8acb('0xa7')]=function(_0x25efc0,_0x1d1106,_0x10232c){var _0x2c7a7a=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter',_0x8acb('0xb4'),_0x8acb('0xb5'),_0x8acb('0xb6'),'rtpaudioqosrtt',_0x8acb('0xb7'),_0x8acb('0xb8'),_0x8acb('0xb9'),_0x8acb('0xba'),_0x8acb('0xbb'),_0x8acb('0xbc'),_0x8acb('0xbd'),_0x8acb('0xbe'),_0x8acb('0xbf'),_0x8acb('0xc0'),_0x8acb('0xc1'),_0x8acb('0xc2')];if(!_[_0x8acb('0x3a')](_0x1d1106)&&!_[_0x8acb('0xc3')](_0x2c7a7a,_0x1d1106)){if(_[_0x8acb('0x66')](this[_0x8acb('0x15')][_0x25efc0])){this['variables'][_0x25efc0]={};}this[_0x8acb('0x15')][_0x25efc0][_0x1d1106]=_0x10232c;}};VoiceQueueReport[_0x8acb('0xb')][_0x8acb('0x23')]=function(_0x3d2f7f){try{if(this[_0x8acb('0x76')](_0x3d2f7f)){logger['debug'](_0x8acb('0xc4'),_0x3d2f7f[_0x8acb('0x4a')],util[_0x8acb('0x42')](_0x3d2f7f,{'showHidden':![],'depth':null}));if(this[_0x8acb('0xf')][_0x3d2f7f[_0x8acb('0x4a')]]){for(var _0x53501c=0x0,_0x328677={};_0x53501c=0x0?moment(_0x3e101b[_0x8676('0x15')])[_0x8676('0x16')](_0x3e101b[_0x8676('0x14')],_0x8676('0x17')):null,'data1':_0x8676('0x18'),'data2':_0x3e101b[_0x8676('0x10')],'data3':_0x3e101b[_0x8676('0x19')],'data4':_0x3e101b[_0x8676('0x1a')]||null,'role':_0x8676('0xf'),'internal':_0x3e101b['accountcode']?_[_0x8676('0x11')](_0x3e101b['accountcode']):undefined,'uniqueid':_0x3e101b[_0x8676('0x1b')]},'log':_0x8676('0x6')});}; \ No newline at end of file +var _0x7269=['Request','voice','interface','format','SIP/%s','lastAssignedTo','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','TALKING','starttime','endtime','outbound','dialstring','agent','moment','lodash','util','queuecallerexitAt'];(function(_0x561d3f,_0x5282ba){var _0x3b734e=function(_0x109fc5){while(--_0x109fc5){_0x561d3f['push'](_0x561d3f['shift']());}};_0x3b734e(++_0x5282ba);}(_0x7269,0x1a0));var _0x9726=function(_0x1e6f2d,_0x5971e7){_0x1e6f2d=_0x1e6f2d-0x0;var _0x268f2c=_0x7269[_0x1e6f2d];return _0x268f2c;};'use strict';var moment=require(_0x9726('0x0'));var _=require(_0x9726('0x1'));var util=require(_0x9726('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x1c325a){var _0x3e407d=_0x1c325a['queuecallercompleteAt']||_0x1c325a[_0x9726('0x3')];return client[_0x9726('0x4')]('CreateMemberReport',{'body':{'channel':_0x9726('0x5'),'membername':_0x1c325a['lastAssignedTo'],'interface':_['isNil'](_0x1c325a[_0x9726('0x6')])?util[_0x9726('0x7')](_0x9726('0x8'),_0x1c325a[_0x9726('0x9')]):_0x1c325a['interface'],'type':'TALKING','enterAt':_0x1c325a[_0x9726('0xa')],'exitAt':_0x3e407d,'duration':moment(_0x3e407d)[_0x9726('0xb')](_0x1c325a['queuecallerleaveAt'],_0x9726('0xc')),'data1':'inbound','data2':_0x1c325a[_0x9726('0xd')],'data3':_0x1c325a[_0x9726('0xe')],'data4':null,'data5':_0x1c325a[_0x9726('0xf')],'role':'agent','internal':_0x1c325a[_0x9726('0x10')]?_[_0x9726('0x11')](_0x1c325a[_0x9726('0x10')]):undefined,'uniqueid':_0x1c325a[_0x9726('0x12')]},'log':_0x9726('0x13')});};exports[_0x9726('0x14')]=function(_0x5122d0){return client[_0x9726('0x4')](_0x9726('0x13'),{'body':{'channel':_0x9726('0x5'),'membername':_0x5122d0[_0x9726('0x15')],'interface':_0x5122d0[_0x9726('0x6')],'type':_0x9726('0x16'),'enterAt':_0x5122d0[_0x9726('0x17')],'exitAt':_0x5122d0['endtime'],'duration':moment(_0x5122d0[_0x9726('0x18')])[_0x9726('0xb')](_0x5122d0[_0x9726('0x17')],_0x9726('0xc'))>=0x0?moment(_0x5122d0[_0x9726('0x18')])[_0x9726('0xb')](_0x5122d0['starttime'],_0x9726('0xc')):null,'data1':_0x9726('0x19'),'data2':_0x5122d0[_0x9726('0x10')],'data3':_0x5122d0[_0x9726('0xe')],'data4':_0x5122d0[_0x9726('0x1a')]||null,'role':_0x9726('0x1b'),'internal':_0x5122d0[_0x9726('0x10')]?_[_0x9726('0x11')](_0x5122d0[_0x9726('0x10')]):undefined,'uniqueid':_0x5122d0[_0x9726('0x12')]},'log':_0x9726('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 6ccc8de..44e0e76 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 _0xe563=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x324fe8,_0x1ccb46){var _0x4a1cd9=function(_0x506af2){while(--_0x506af2){_0x324fe8['push'](_0x324fe8['shift']());}};_0x4a1cd9(++_0x1ccb46);}(_0xe563,0x125));var _0x3e56=function(_0xee4747,_0x571892){_0xee4747=_0xee4747-0x0;var _0x43e550=_0xe563[_0xee4747];return _0x43e550;};'use strict';var client=require(_0x3e56('0x0'));exports[_0x3e56('0x1')]=function(){return client[_0x3e56('0x2')](_0x3e56('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3e56('0x4')]},'log':_0x3e56('0x5')});}; \ No newline at end of file +var _0x1db3=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x4b58fe,_0x37ea5c){var _0x42a87f=function(_0x2adf5b){while(--_0x2adf5b){_0x4b58fe['push'](_0x4b58fe['shift']());}};_0x42a87f(++_0x37ea5c);}(_0x1db3,0x1e5));var _0x31db=function(_0x31878d,_0x13851c){_0x31878d=_0x31878d-0x0;var _0x3c3b54=_0x1db3[_0x31878d];return _0x3c3b54;};'use strict';var client=require('../client');exports[_0x31db('0x0')]=function(){return client[_0x31db('0x1')](_0x31db('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x31db('0x3')]},'log':_0x31db('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f039eb1..241a8c0 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 _0xf891=['GetTemplate','html','../client','getTemplates','Request'];(function(_0x2000c8,_0x5baa48){var _0x58ed5b=function(_0x307bbe){while(--_0x307bbe){_0x2000c8['push'](_0x2000c8['shift']());}};_0x58ed5b(++_0x5baa48);}(_0xf891,0x93));var _0x1f89=function(_0x5e36eb,_0x18cba9){_0x5e36eb=_0x5e36eb-0x0;var _0x6244d6=_0xf891[_0x5e36eb];return _0x6244d6;};'use strict';var client=require(_0x1f89('0x0'));exports[_0x1f89('0x1')]=function(_0x58404b){return function(_0x521951){return client[_0x1f89('0x2')](_0x1f89('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x1f89('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xa109=['html','GetTemplate','../client','Request','name'];(function(_0x354385,_0x4825ef){var _0x28e9a5=function(_0x51989b){while(--_0x51989b){_0x354385['push'](_0x354385['shift']());}};_0x28e9a5(++_0x4825ef);}(_0xa109,0xf2));var _0x9a10=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa109[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require(_0x9a10('0x0'));exports['getTemplates']=function(_0x26b7a8){return function(_0x3f559e){return client[_0x9a10('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9a10('0x2'),_0x9a10('0x3')]},'log':_0x9a10('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 46e6008..fd89136 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 _0xfbee=['data5','data6','data7','getTriggers','Request','GetTrigger','channel','Condition','AllConditions','field','operator','value','Action','Actions','action','data4'];(function(_0x57eee9,_0x3540f7){var _0x36c05d=function(_0xd5ad1a){while(--_0xd5ad1a){_0x57eee9['push'](_0x57eee9['shift']());}};_0x36c05d(++_0x3540f7);}(_0xfbee,0xe3));var _0xefbe=function(_0x25b590,_0x3e174d){_0x25b590=_0x25b590-0x0;var _0x247a49=_0xfbee[_0x25b590];return _0x247a49;};'use strict';var client=require('../client');exports[_0xefbe('0x0')]=function(_0x243b1d){return function(_0x1a77e4){return client[_0xefbe('0x1')](_0xefbe('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xefbe('0x3'),'status'],'include':[{'model':_0xefbe('0x4'),'as':_0xefbe('0x5'),'attributes':['id',_0xefbe('0x6'),_0xefbe('0x7'),_0xefbe('0x8')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0xefbe('0x6'),_0xefbe('0x7'),_0xefbe('0x8')]},{'model':_0xefbe('0x9'),'as':_0xefbe('0xa'),'attributes':['id',_0xefbe('0xb'),'data1','data2','data3',_0xefbe('0xc'),_0xefbe('0xd'),_0xefbe('0xe'),_0xefbe('0xf')]}]},'log':_0xefbe('0x2')});};}; \ No newline at end of file +var _0x2b6b=['status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','action','data2','data3','data5','data6','data7','GetTrigger','name'];(function(_0x24202,_0x4eb3eb){var _0x5428f7=function(_0x3bbd27){while(--_0x3bbd27){_0x24202['push'](_0x24202['shift']());}};_0x5428f7(++_0x4eb3eb);}(_0x2b6b,0x185));var _0xb2b6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2b6b[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x4f679f){return function(_0x150a4c){return client['Request'](_0xb2b6('0x0'),{'options':{'raw':![],'attributes':['id',_0xb2b6('0x1'),'channel',_0xb2b6('0x2')],'include':[{'model':'Condition','as':_0xb2b6('0x3'),'attributes':['id',_0xb2b6('0x4'),_0xb2b6('0x5'),_0xb2b6('0x6')]},{'model':_0xb2b6('0x7'),'as':_0xb2b6('0x8'),'attributes':['id','field',_0xb2b6('0x5'),_0xb2b6('0x6')]},{'model':_0xb2b6('0x9'),'as':_0xb2b6('0xa'),'attributes':['id',_0xb2b6('0xb'),'data1',_0xb2b6('0xc'),_0xb2b6('0xd'),'data4',_0xb2b6('0xe'),_0xb2b6('0xf'),_0xb2b6('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b707c77..3e6f02a 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 _0x3c7e=['name','registry','defaultuser','getTrunks','Request','GetTrunk'];(function(_0x596de3,_0xf801c0){var _0xbf541f=function(_0x3b7460){while(--_0x3b7460){_0x596de3['push'](_0x596de3['shift']());}};_0xbf541f(++_0xf801c0);}(_0x3c7e,0xdb));var _0xe3c7=function(_0x13e758,_0x317d23){_0x13e758=_0x13e758-0x0;var _0x5b53c3=_0x3c7e[_0x13e758];return _0x5b53c3;};'use strict';var client=require('../client');exports[_0xe3c7('0x0')]=function(_0x4df101){return function(_0x448fb5){return client[_0xe3c7('0x1')](_0xe3c7('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe3c7('0x3'),_0xe3c7('0x4'),_0xe3c7('0x5')]},'log':_0xe3c7('0x2')});};}; \ No newline at end of file +var _0xf924=['getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x1249f4,_0x27226c){var _0x47c8a9=function(_0x2d9917){while(--_0x2d9917){_0x1249f4['push'](_0x1249f4['shift']());}};_0x47c8a9(++_0x27226c);}(_0xf924,0x1db));var _0x4f92=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0xf924[_0x10dfdf];return _0x4d857d;};'use strict';var client=require('../client');exports[_0x4f92('0x0')]=function(_0x5129a3){return function(_0x4c1459){return client['Request'](_0x4f92('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4f92('0x2'),_0x4f92('0x3'),_0x4f92('0x4')]},'log':_0x4f92('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 45622b9..66db316 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(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe706,0xa3));var _0x6e70=function(_0x104857,_0x34844c){_0x104857=_0x104857-0x0;var _0x5c7d6d=_0xe706[_0x104857];return _0x5c7d6d;};'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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x524cda,_0xc46904){var _0x51a467=function(_0x319cfb){while(--_0x319cfb){_0x524cda['push'](_0x524cda['shift']());}};_0x51a467(++_0xc46904);}(_0x70e0,0x17b));var _0x070e=function(_0x20283a,_0x3c3dec){_0x20283a=_0x20283a-0x0;var _0x1f8b9e=_0x70e0[_0x20283a];return _0x1f8b9e;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 3153181..c578321 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 _0xf9d7=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x52b128,_0x3e4cce){var _0x24685f=function(_0x1423bd){while(--_0x1423bd){_0x52b128['push'](_0x52b128['shift']());}};_0x24685f(++_0x3e4cce);}(_0xf9d7,0xb4));var _0x7f9d=function(_0x15ee41,_0x9275d8){_0x15ee41=_0x15ee41-0x0;var _0x2b2846=_0xf9d7[_0x15ee41];return _0x2b2846;};'use strict';var client=require(_0x7f9d('0x0'));exports['create']=function(_0x15c486){return client[_0x7f9d('0x1')](_0x7f9d('0x2'),{'body':_0x15c486,'log':_0x7f9d('0x2')});};exports[_0x7f9d('0x3')]=function(_0x15e10b,_0x1acf8d,_0x2ae594){return client[_0x7f9d('0x1')](_0x7f9d('0x4'),{'body':_0x15e10b,'options':{'where':{'uniqueid':_0x1acf8d,'interface':_0x2ae594,'agentcomplete':!![]}},'log':_0x7f9d('0x4')});}; \ No newline at end of file +var _0xb46c=['update','Request','UpdateVoiceAgentReport','create','CreateVoiceAgentReport'];(function(_0x11d104,_0xbfcc3e){var _0x205fc4=function(_0x48c540){while(--_0x48c540){_0x11d104['push'](_0x11d104['shift']());}};_0x205fc4(++_0xbfcc3e);}(_0xb46c,0xd0));var _0xcb46=function(_0x40ad2b,_0x4710c8){_0x40ad2b=_0x40ad2b-0x0;var _0x3d6881=_0xb46c[_0x40ad2b];return _0x3d6881;};'use strict';var client=require('../client');exports[_0xcb46('0x0')]=function(_0x4e5600){return client['Request'](_0xcb46('0x1'),{'body':_0x4e5600,'log':'CreateVoiceAgentReport'});};exports[_0xcb46('0x2')]=function(_0x4fa209,_0x734efc,_0x4c3204){return client[_0xcb46('0x3')](_0xcb46('0x4'),{'body':_0x4fa209,'options':{'where':{'uniqueid':_0x734efc,'interface':_0x4c3204,'agentcomplete':!![]}},'log':_0xcb46('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index e955872..b6c7d03 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 _0x4f7d=['YYYY-MM-DD\x20HH:mm:ss','endOf','duration','billableseconds','GetVoiceCallReports','moment','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','day','format'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4f7d,0x1c7));var _0xd4f7=function(_0x6ff948,_0x53f864){_0x6ff948=_0x6ff948-0x0;var _0x4584de=_0x4f7d[_0x6ff948];return _0x4584de;};'use strict';var moment=require(_0xd4f7('0x0'));var util=require('util');var _=require('lodash');var client=require(_0xd4f7('0x1'));exports[_0xd4f7('0x2')]=function(_0x1070dc){return client[_0xd4f7('0x3')](_0xd4f7('0x4'),{'body':_[_0xd4f7('0x5')](_0x1070dc,{'source':_0x1070dc[_0xd4f7('0x6')],'destinationcontext':_0x1070dc[_0xd4f7('0x7')],'callerid':_0x1070dc[_0xd4f7('0x8')],'amaflags':_0xd4f7('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0xd4f7('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0xd4f7('0xb'))[_0xd4f7('0xc')](_0xd4f7('0xd')),moment()[_0xd4f7('0xe')]('day')[_0xd4f7('0xc')](_0xd4f7('0xd'))]}},'attributes':['type','disposition',_0xd4f7('0xf'),_0xd4f7('0x10')]},'log':_0xd4f7('0x11')});};}; \ No newline at end of file +var _0xdd03=['duration','billableseconds','GetVoiceCallReports','lodash','create','Request','calleridnum','DOCUMENTATION','getVoiceCallReports','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','type','disposition'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xdd03,0x1ac));var _0x3dd0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdd03[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x3dd0('0x0'));var client=require('../client');exports[_0x3dd0('0x1')]=function(_0x20ab35){return client[_0x3dd0('0x2')]('CreateVoiceCallReport',{'body':_['merge'](_0x20ab35,{'source':_0x20ab35[_0x3dd0('0x3')],'destinationcontext':_0x20ab35['context'],'callerid':_0x20ab35['callerid'],'amaflags':_0x3dd0('0x4')}),'log':'CreateVoiceCallReport'});};exports[_0x3dd0('0x5')]=function(){return function(){return client[_0x3dd0('0x2')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x3dd0('0x6')],'createdAt':{'$between':[moment()[_0x3dd0('0x7')]('day')['format'](_0x3dd0('0x8')),moment()[_0x3dd0('0x9')](_0x3dd0('0xa'))[_0x3dd0('0xb')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x3dd0('0xc'),_0x3dd0('0xd'),_0x3dd0('0xe'),_0x3dd0('0xf')]},'log':_0x3dd0('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a52ab39..8961ca9 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 _0x8c43=['create','CreateVoiceDialReport','../client'];(function(_0x10c328,_0x1ec2d8){var _0x946d80=function(_0x5c2089){while(--_0x5c2089){_0x10c328['push'](_0x10c328['shift']());}};_0x946d80(++_0x1ec2d8);}(_0x8c43,0x1a6));var _0x38c4=function(_0x193d48,_0x3b1b5c){_0x193d48=_0x193d48-0x0;var _0x7bc892=_0x8c43[_0x193d48];return _0x7bc892;};'use strict';var client=require(_0x38c4('0x0'));exports[_0x38c4('0x1')]=function(_0x3f5c01){return client['Request']('CreateVoiceDialReport',{'body':_0x3f5c01,'log':_0x38c4('0x2')});}; \ No newline at end of file +var _0xc462=['Request','CreateVoiceDialReport','../client','create'];(function(_0x42e988,_0xd8abe0){var _0x5ce1fb=function(_0x2531bc){while(--_0x2531bc){_0x42e988['push'](_0x42e988['shift']());}};_0x5ce1fb(++_0xd8abe0);}(_0xc462,0x1e6));var _0x2c46=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc462[_0x68c979];return _0x4f0001;};'use strict';var client=require(_0x2c46('0x0'));exports[_0x2c46('0x1')]=function(_0x299c6f){return client[_0x2c46('0x2')](_0x2c46('0x3'),{'body':_0x299c6f,'log':_0x2c46('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 0a13846..e72c033 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 _0xc6d8=['Request','exten','getVoiceExtensions','../client'];(function(_0x270331,_0x30d991){var _0x39f4e7=function(_0x36da4a){while(--_0x36da4a){_0x270331['push'](_0x270331['shift']());}};_0x39f4e7(++_0x30d991);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x52eb16,_0x89c3d8){_0x52eb16=_0x52eb16-0x0;var _0x382d3f=_0xc6d8[_0x52eb16];return _0x382d3f;};'use strict';var client=require(_0x8c6d('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x8c6d('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x8c6d('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x8c6d('0x3')});};}; \ No newline at end of file +var _0x2504=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x413b3f,_0x1f203b){var _0x321b21=function(_0x2eca34){while(--_0x2eca34){_0x413b3f['push'](_0x413b3f['shift']());}};_0x321b21(++_0x1f203b);}(_0x2504,0xee));var _0x4250=function(_0x221b9a,_0x4e06f2){_0x221b9a=_0x221b9a-0x0;var _0x3d24e3=_0x2504[_0x221b9a];return _0x3d24e3;};'use strict';var client=require(_0x4250('0x0'));exports[_0x4250('0x1')]=function(){return function(){return client[_0x4250('0x2')](_0x4250('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4250('0x4'),_0x4250('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x4250('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ad72611..314d4a1 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 _0xf003=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xf003,0x105));var _0x3f00=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xf003[_0x218972];return _0x1bb1a8;};'use strict';var client=require(_0x3f00('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x3f00('0x1')](_0x3f00('0x2'),{'options':{'raw':![],'attributes':['id',_0x3f00('0x3'),_0x3f00('0x4'),_0x3f00('0x5'),_0x3f00('0x6'),_0x3f00('0x7'),_0x3f00('0x8'),_0x3f00('0x9'),_0x3f00('0xa'),_0x3f00('0xb'),_0x3f00('0xc'),'dialPowerLevel',_0x3f00('0xd'),_0x3f00('0xe'),_0x3f00('0xf'),_0x3f00('0x10'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x3f00('0x11'),_0x3f00('0x12'),'dialQueueProject',_0x3f00('0x13'),'dialCongestionRetryFrequency',_0x3f00('0x14'),_0x3f00('0x15'),_0x3f00('0x16'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0x3f00('0x17'),_0x3f00('0x18'),'dialCheckDuplicateType',_0x3f00('0x19'),_0x3f00('0x1a'),_0x3f00('0x1b'),_0x3f00('0x1c'),_0x3f00('0x1d'),_0x3f00('0x1e'),_0x3f00('0x1f'),_0x3f00('0x20'),_0x3f00('0x21'),_0x3f00('0x22'),_0x3f00('0x23'),_0x3f00('0x24'),_0x3f00('0x25'),_0x3f00('0x26'),'dialAgiAfterHangupAgent',_0x3f00('0x27'),_0x3f00('0x28'),'monitor_format','strategy','dialRandomLastDigitCallerIdNumber',_0x3f00('0x29'),'dialNoSuchNumberMaxRetry',_0x3f00('0x2a'),'dialDropMaxRetry',_0x3f00('0x2b'),_0x3f00('0x2c'),'dialAbandonedRetryFrequency',_0x3f00('0x2d'),_0x3f00('0x2e'),_0x3f00('0x2f'),_0x3f00('0x30'),'mandatoryDisposition',_0x3f00('0x31'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x3f00('0x32'),'as':'Trunk','attributes':['id',_0x3f00('0x3'),_0x3f00('0x33'),'active']},{'model':_0x3f00('0x34'),'as':_0x3f00('0x35'),'attributes':['id',_0x3f00('0x3')]},{'model':_0x3f00('0x32'),'as':_0x3f00('0x36'),'attributes':['id','name',_0x3f00('0x33'),_0x3f00('0x37')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0x3f00('0x38'),'as':'Intervals','attributes':['id',_0x3f00('0x3'),'interval']}]}]},'log':_0x3f00('0x39')});};}; \ No newline at end of file +var _0x5593=['dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','autopause','type','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent'];(function(_0x48a73e,_0x39f1ac){var _0x390c0b=function(_0x369beb){while(--_0x369beb){_0x48a73e['push'](_0x48a73e['shift']());}};_0x390c0b(++_0x39f1ac);}(_0x5593,0x142));var _0x3559=function(_0x3865ea,_0x45f818){_0x3865ea=_0x3865ea-0x0;var _0x9845a6=_0x5593[_0x3865ea];return _0x9845a6;};'use strict';var client=require(_0x3559('0x0'));exports[_0x3559('0x1')]=function(){return function(){return client['Request'](_0x3559('0x2'),{'options':{'raw':![],'attributes':['id',_0x3559('0x3'),_0x3559('0x4'),'acwTimeout',_0x3559('0x5'),'monitor_format',_0x3559('0x6'),'dialActive',_0x3559('0x7'),_0x3559('0x8'),'dialLimitQueue','dialPowerLevel',_0x3559('0x9'),'dialPredictiveOptimizationPercentage',_0x3559('0xa'),_0x3559('0xb'),'dialOriginateCallerIdNumber',_0x3559('0xc'),'dialQueueOptions',_0x3559('0xd'),_0x3559('0xe'),_0x3559('0xf'),_0x3559('0x10'),'dialBusyMaxRetry',_0x3559('0x11'),_0x3559('0x12'),'dialNoAnswerRetryFrequency',_0x3559('0x13'),_0x3559('0x14'),_0x3559('0x15'),_0x3559('0x16'),_0x3559('0x17'),_0x3559('0x18'),_0x3559('0x19'),_0x3559('0x1a'),'dialAMDAfterGreetingSilence',_0x3559('0x1b'),_0x3559('0x1c'),_0x3559('0x1d'),_0x3559('0x1e'),_0x3559('0x1f'),_0x3559('0x20'),_0x3559('0x21'),_0x3559('0x22'),_0x3559('0x23'),_0x3559('0x24'),_0x3559('0x25'),_0x3559('0x26'),_0x3559('0x27'),'monitor_format',_0x3559('0x28'),_0x3559('0x29'),_0x3559('0x2a'),'dialNoSuchNumberMaxRetry',_0x3559('0x2b'),_0x3559('0x2c'),'dialDropRetryFrequency',_0x3559('0x2d'),_0x3559('0x2e'),_0x3559('0x2f'),_0x3559('0x30'),'dialAgentRejectMaxRetry',_0x3559('0x31'),_0x3559('0x32'),_0x3559('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x3559('0x34'),'as':_0x3559('0x34'),'attributes':['id',_0x3559('0x3'),_0x3559('0x35'),_0x3559('0x36')]},{'model':_0x3559('0x37'),'as':_0x3559('0x38'),'attributes':['id',_0x3559('0x3')]},{'model':'Trunk','as':_0x3559('0x39'),'attributes':['id','name',_0x3559('0x35'),'active']},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':'Interval','as':_0x3559('0x3a'),'attributes':['id',_0x3559('0x3'),_0x3559('0x3b')]}]}]},'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 39d5e47..65e6ab1 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(_0x46b295,_0x554b00){var _0x1c4c10=function(_0x58c71b){while(--_0x58c71b){_0x46b295['push'](_0x46b295['shift']());}};_0x1c4c10(++_0x554b00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x245b1f,_0x95cff9){var _0x404706=function(_0xac490e){while(--_0xac490e){_0x245b1f['push'](_0x245b1f['shift']());}};_0x404706(++_0x95cff9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 45a8946..c6205ce 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 _0x3850=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x51b1dd,_0x2c8c92){var _0x4ec5cf=function(_0x126ca6){while(--_0x126ca6){_0x51b1dd['push'](_0x51b1dd['shift']());}};_0x4ec5cf(++_0x2c8c92);}(_0x3850,0x73));var _0x0385=function(_0x5ebaec,_0x1e995f){_0x5ebaec=_0x5ebaec-0x0;var _0x3b0ade=_0x3850[_0x5ebaec];return _0x3b0ade;};'use strict';var client=require(_0x0385('0x0'));exports[_0x0385('0x1')]=function(_0x2eb5aa){return function(){return client[_0x0385('0x2')](_0x0385('0x3'),{'options':{'where':{'VoiceQueueId':_0x2eb5aa,'paused':!![]},'raw':!![]},'log':_0x0385('0x1')});};}; \ No newline at end of file +var _0xce28=['../client','Request'];(function(_0x1e09a1,_0x1c14f9){var _0x24ac77=function(_0x272fa1){while(--_0x272fa1){_0x1e09a1['push'](_0x1e09a1['shift']());}};_0x24ac77(++_0x1c14f9);}(_0xce28,0xa2));var _0x8ce2=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xce28[_0x26f702];return _0x11417d;};'use strict';var client=require(_0x8ce2('0x0'));exports['getVoiceQueueRtPauses']=function(_0x1b05b7){return function(){return client[_0x8ce2('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1b05b7,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 96c83f4..f45651e 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(_0x34f29f,_0xbb5799){var _0x329b61=function(_0x2ed036){while(--_0x2ed036){_0x34f29f['push'](_0x34f29f['shift']());}};_0x329b61(++_0xbb5799);}(_0x7a54,0x106));var _0x47a5=function(_0x42e851,_0x3d526d){_0x42e851=_0x42e851-0x0;var _0x984fd7=_0x7a54[_0x42e851];return _0x984fd7;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xc73472,_0x2f3e59){var _0x30228f=function(_0x2359ae){while(--_0x2359ae){_0xc73472['push'](_0xc73472['shift']());}};_0x30228f(++_0x2f3e59);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c8fcf18..9532389 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 _0x373e=['transfereelinkedid','isexternal','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext'];(function(_0x3d498a,_0x52c532){var _0x3cb401=function(_0x58b500){while(--_0x58b500){_0x3d498a['push'](_0x3d498a['shift']());}};_0x3cb401(++_0x52c532);}(_0x373e,0x173));var _0xe373=function(_0x59f271,_0xb71cb5){_0x59f271=_0x59f271-0x0;var _0x161c21=_0x373e[_0x59f271];return _0x161c21;};'use strict';var client=require(_0xe373('0x0'));exports[_0xe373('0x1')]={};exports[_0xe373('0x2')]=function(_0x35cf65){return client[_0xe373('0x3')](_0xe373('0x4'),{'body':{'result':_0x35cf65[_0xe373('0x5')],'transfererchannel':_0x35cf65['transfererchannel'],'transferercalleridnum':_0x35cf65[_0xe373('0x6')],'transferercalleridname':_0x35cf65[_0xe373('0x7')],'transfererconnectedlinenum':_0x35cf65[_0xe373('0x8')],'transfererconnectedlinename':_0x35cf65[_0xe373('0x9')],'transfereraccountcode':_0x35cf65[_0xe373('0xa')],'transferercontext':_0x35cf65[_0xe373('0xb')],'transfererexten':_0x35cf65['transfererexten'],'transfererlinkedid':_0x35cf65[_0xe373('0xc')],'transfereechannel':_0x35cf65['transfereechannel'],'transfereecalleridnum':_0x35cf65[_0xe373('0xd')],'transfereecalleridname':_0x35cf65[_0xe373('0xe')],'transfereeconnectedlinenum':_0x35cf65[_0xe373('0xf')],'transfereeconnectedlinename':_0x35cf65[_0xe373('0x10')],'transfereeaccountcode':_0x35cf65[_0xe373('0x11')],'transfereecontext':_0x35cf65[_0xe373('0x12')],'transfereeexten':_0x35cf65['transfereeexten'],'transfereelinkedid':_0x35cf65[_0xe373('0x13')],'isexternal':_0x35cf65[_0xe373('0x14')],'context':_0x35cf65['context'],'extension':_0x35cf65[_0xe373('0x15')],'type':_0xe373('0x16')},'log':_0xe373('0x4')});};exports['attendedTransfer']=function(_0x54344d){return client[_0xe373('0x3')](_0xe373('0x4'),{'body':{'result':_0x54344d[_0xe373('0x5')],'transfererchannel':_0x54344d[_0xe373('0x17')],'transferercalleridnum':_0x54344d[_0xe373('0x18')],'transferercalleridname':_0x54344d[_0xe373('0x19')],'transfererconnectedlinenum':_0x54344d[_0xe373('0x1a')],'transfererconnectedlinename':_0x54344d[_0xe373('0x1b')],'transfereraccountcode':_0x54344d[_0xe373('0x1c')],'transferercontext':_0x54344d[_0xe373('0x1d')],'transfererexten':_0x54344d[_0xe373('0x1e')],'transfererlinkedid':_0x54344d['origtransfererlinkedid'],'transfereechannel':_0x54344d[_0xe373('0x1f')],'transfereecalleridnum':_0x54344d[_0xe373('0x20')],'transfereecalleridname':_0x54344d[_0xe373('0x21')],'transfereeconnectedlinenum':_0x54344d[_0xe373('0x22')],'transfereeconnectedlinename':_0x54344d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x54344d['transfertargetaccountcode'],'transfereecontext':_0x54344d[_0xe373('0x23')],'transfereeexten':_0x54344d['transfertargetexten'],'transfereelinkedid':_0x54344d['transfertargetlinkedid'],'isexternal':_0x54344d[_0xe373('0x14')],'context':_0x54344d[_0xe373('0x24')],'extension':_0x54344d[_0xe373('0x25')],'type':_0xe373('0x26')},'log':_0xe373('0x4')});}; \ No newline at end of file +var _0xd01f=['transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','isexternal','blind','attendedTransfer','Request','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','transfers','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfereechannel','transfereecalleridname'];(function(_0x266dab,_0x211142){var _0x2acc69=function(_0x33c40e){while(--_0x33c40e){_0x266dab['push'](_0x266dab['shift']());}};_0x2acc69(++_0x211142);}(_0xd01f,0x7a));var _0xfd01=function(_0x25c37a,_0x410a1a){_0x25c37a=_0x25c37a-0x0;var _0x408ad2=_0xd01f[_0x25c37a];return _0x408ad2;};'use strict';var client=require('../client');exports[_0xfd01('0x0')]={};exports['blindTransfer']=function(_0x725696){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x725696[_0xfd01('0x1')],'transfererchannel':_0x725696[_0xfd01('0x2')],'transferercalleridnum':_0x725696[_0xfd01('0x3')],'transferercalleridname':_0x725696[_0xfd01('0x4')],'transfererconnectedlinenum':_0x725696[_0xfd01('0x5')],'transfererconnectedlinename':_0x725696[_0xfd01('0x6')],'transfereraccountcode':_0x725696['transfereraccountcode'],'transferercontext':_0x725696['transferercontext'],'transfererexten':_0x725696[_0xfd01('0x7')],'transfererlinkedid':_0x725696['transfererlinkedid'],'transfereechannel':_0x725696[_0xfd01('0x8')],'transfereecalleridnum':_0x725696['transfereecalleridnum'],'transfereecalleridname':_0x725696[_0xfd01('0x9')],'transfereeconnectedlinenum':_0x725696[_0xfd01('0xa')],'transfereeconnectedlinename':_0x725696['transfereeconnectedlinename'],'transfereeaccountcode':_0x725696[_0xfd01('0xb')],'transfereecontext':_0x725696[_0xfd01('0xc')],'transfereeexten':_0x725696['transfereeexten'],'transfereelinkedid':_0x725696['transfereelinkedid'],'isexternal':_0x725696[_0xfd01('0xd')],'context':_0x725696['context'],'extension':_0x725696['extension'],'type':_0xfd01('0xe')},'log':'CreateVoiceTransferReport'});};exports[_0xfd01('0xf')]=function(_0x1e1b20){return client[_0xfd01('0x10')](_0xfd01('0x11'),{'body':{'result':_0x1e1b20[_0xfd01('0x1')],'transfererchannel':_0x1e1b20[_0xfd01('0x12')],'transferercalleridnum':_0x1e1b20[_0xfd01('0x13')],'transferercalleridname':_0x1e1b20[_0xfd01('0x14')],'transfererconnectedlinenum':_0x1e1b20['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1e1b20['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1e1b20[_0xfd01('0x15')],'transferercontext':_0x1e1b20['secondtransferercontext'],'transfererexten':_0x1e1b20[_0xfd01('0x16')],'transfererlinkedid':_0x1e1b20[_0xfd01('0x17')],'transfereechannel':_0x1e1b20[_0xfd01('0x18')],'transfereecalleridnum':_0x1e1b20[_0xfd01('0x19')],'transfereecalleridname':_0x1e1b20['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1e1b20[_0xfd01('0x1a')],'transfereeconnectedlinename':_0x1e1b20['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1e1b20[_0xfd01('0x1b')],'transfereecontext':_0x1e1b20[_0xfd01('0x1c')],'transfereeexten':_0x1e1b20[_0xfd01('0x1d')],'transfereelinkedid':_0x1e1b20[_0xfd01('0x1e')],'isexternal':_0x1e1b20[_0xfd01('0xd')],'context':_0x1e1b20[_0xfd01('0x1f')],'extension':_0x1e1b20['origtransfererexten'],'type':_0xfd01('0x20')},'log':_0xfd01('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0613bd6..de3642f 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 _0x6596=['erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','values','map','channels','uniqueid','channel','filename','wav','ai(mixmonitorid)','then','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','status','stop','%s.%s','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','listen','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','join','pick','keys','module','action','Reload','catch','message','ami\x20disconnected','command','Command','Action','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x5b9717,_0x1fbbc2){var _0x3351a8=function(_0x3617b9){while(--_0x3617b9){_0x5b9717['push'](_0x5b9717['shift']());}};_0x3351a8(++_0x1fbbc2);}(_0x6596,0x1d3));var _0x6659=function(_0x811f43,_0xa3353c){_0x811f43=_0x811f43-0x0;var _0xb8575b=_0x6596[_0x811f43];return _0xb8575b;};'use strict';var _=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var jayson=require('jayson/promise');var schema=require(_0x6659('0x2'));var BPromise=require(_0x6659('0x3'));var moment=require(_0x6659('0x4'));var config=require(_0x6659('0x5'));var properties=require(_0x6659('0x6'));var ami=require(_0x6659('0x7'));exports['listen']=function(_0x483945,_0x7edf11,_0x3091f1){return new BPromise(function(_0xd6bf59,_0x1ed458){var _0x29292b={'QueuePause':function(_0x4a900d){return new Promise(function(_0x485ea0,_0x24bfdf){var _0x7b07d5=util[_0x6659('0x8')](_0x6659('0x9'),_0x6659('0xa'),_0x4a900d[_0x6659('0xb')]);if(_0x483945['timers']&&_0x483945[_0x6659('0xc')][_0x7b07d5]&&_0x483945['timers'][_0x7b07d5]['timer']){_0x483945[_0x6659('0xc')][_0x7b07d5]['updateAcw']();}if(_0x483945[_0x6659('0xd')][_0x7b07d5]){_0x483945[_0x6659('0xd')][_0x7b07d5][_0x6659('0xe')]({'statePause':_0x4a900d[_0x6659('0xf')]?!![]:![]});}_0x485ea0({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3d68c5){var _0x329ebc=this;return new Promise(function(_0x518769,_0x2b3118){if(ami[_0x6659('0x10')]()==![]){return _0x2b3118(_0x329ebc[_0x6659('0x11')](0x1f4,[config[_0x6659('0x12')]['ip'],config[_0x6659('0x12')][_0x6659('0x13')],'ami\x20disconnected'][_0x6659('0x14')]('\x20')));}_0x3d68c5=_[_0x6659('0x15')](_0x3d68c5,_[_0x6659('0x16')](properties[_0x6659('0x17')]));_0x3d68c5[_0x6659('0x18')]=_0x6659('0x19');return ami['Action'](_0x3d68c5)['then'](function(_0x441d6d){_0x518769({'code':0xc8,'message':_0x441d6d['message']});})[_0x6659('0x1a')](function(_0x38e4d6){_0x2b3118(_0x329ebc['error'](0x1f5,_0x38e4d6[_0x6659('0x1b')]));});});},'Command':function(_0x5253e5){var _0xa5e094=this;return new Promise(function(_0x1dc4f1,_0x522f2e){if(ami[_0x6659('0x10')]()==![]){return _0x522f2e(_0xa5e094[_0x6659('0x11')](0x1f4,[config[_0x6659('0x12')]['ip'],config[_0x6659('0x12')][_0x6659('0x13')],_0x6659('0x1c')][_0x6659('0x14')]('\x20')));}_0x5253e5=_['pick'](_0x5253e5,_0x6659('0x1d'));_0x5253e5[_0x6659('0x18')]=_0x6659('0x1e');return ami[_0x6659('0x1f')](_0x5253e5)['then'](function(_0x4ce553){_0x1dc4f1({'code':0xc8,'message':_0x4ce553['content']});})['catch'](function(_0xbad53f){_0x522f2e(_0xa5e094[_0x6659('0x11')](0x1f5,_0xbad53f[_0x6659('0x1b')]));});});},'VoiceQueues':function(_0x6fc27){return new Promise(function(_0x45effc,_0x12b218){var _0x436691=[];for(var _0x3cb0dc in _0x483945[_0x6659('0x20')]){if(_0x483945['voiceQueues'][_0x6659('0x21')](_0x3cb0dc)){var _0x373a3d=_0x483945[_0x6659('0x20')][_0x3cb0dc];var _0x4866e0={'id':_0x373a3d['id'],'name':_0x373a3d['name'],'strategy':_0x373a3d[_0x6659('0x22')],'answered':_0x373a3d[_0x6659('0x23')],'available':_0x373a3d['available'],'loggedIn':_0x373a3d[_0x6659('0x24')],'pTalking':_0x373a3d[_0x6659('0x25')],'sumBillable':_0x373a3d[_0x6659('0x26')],'sumDuration':_0x373a3d[_0x6659('0x27')],'sumHoldTime':_0x373a3d[_0x6659('0x28')]||0x0,'talking':_0x373a3d['talking'],'total':_0x373a3d[_0x6659('0x29')],'type':_0x373a3d[_0x6659('0x2a')],'unmanaged':_0x373a3d[_0x6659('0x2b')],'abandoned':_0x373a3d[_0x6659('0x2c')],'waiting':_0x373a3d[_0x6659('0x2d')],'loggedInDb':_0x373a3d['loggedInDb']};if(_0x373a3d[_0x6659('0x2a')]===_0x6659('0x2e')){_0x4866e0[_0x6659('0x2f')]=_0x373a3d[_0x6659('0x2f')];_0x4866e0[_0x6659('0x30')]=_0x373a3d[_0x6659('0x30')];_0x4866e0[_0x6659('0x31')]=_0x373a3d['dialOriginateCallerIdName'];_0x4866e0[_0x6659('0x32')]=_0x373a3d[_0x6659('0x32')];_0x4866e0['dialOriginateTimeout']=_0x373a3d[_0x6659('0x33')];_0x4866e0['dialPrefix']=_0x373a3d[_0x6659('0x34')];_0x4866e0['temp']=_0x373a3d[_0x6659('0x35')];_0x4866e0[_0x6659('0x36')]=_0x373a3d['outboundAnswerAgiCallsDay'];_0x4866e0['outboundAnswerCallsDay']=_0x373a3d[_0x6659('0x37')];_0x4866e0['outboundBlacklistCallsDay']=_0x373a3d[_0x6659('0x38')];_0x4866e0['outboundBusyCallsDay']=_0x373a3d[_0x6659('0x39')];_0x4866e0['outboundCongestionCallsDay']=_0x373a3d[_0x6659('0x3a')];_0x4866e0[_0x6659('0x3b')]=_0x373a3d['outboundDropCallsDayACS'];_0x4866e0[_0x6659('0x3c')]=_0x373a3d[_0x6659('0x3c')];_0x4866e0[_0x6659('0x3d')]=_0x373a3d[_0x6659('0x3d')];_0x4866e0[_0x6659('0x3e')]=_0x373a3d['outboundNoAnswerCallsDay'];_0x4866e0[_0x6659('0x3f')]=_0x373a3d['outboundNoSuchCallsDay'];_0x4866e0['outboundOriginateFailureCallsDay']=_0x373a3d[_0x6659('0x40')];_0x4866e0[_0x6659('0x41')]=_0x373a3d[_0x6659('0x41')];_0x4866e0['outboundRejectCallsDay']=_0x373a3d[_0x6659('0x42')];_0x4866e0['outboundUnknownCallsDay']=_0x373a3d['outboundUnknownCallsDay'];_0x4866e0[_0x6659('0x43')]=_0x373a3d[_0x6659('0x43')];_0x4866e0[_0x6659('0x44')]=_0x373a3d[_0x6659('0x44')];_0x4866e0[_0x6659('0x45')]=_0x373a3d[_0x6659('0x45')];_0x4866e0[_0x6659('0x46')]=_0x373a3d['predictiveIntervalDroppedCallsCallersExit'];_0x4866e0['predictiveIntervalDroppedCallsTimeout']=_0x373a3d[_0x6659('0x47')];_0x4866e0[_0x6659('0x48')]=_0x373a3d[_0x6659('0x48')];_0x4866e0['predictiveIntervalErlangCallsDroppedCalls']=_0x373a3d[_0x6659('0x49')];_0x4866e0[_0x6659('0x4a')]=_0x373a3d['predictiveIntervalHitRate'];_0x4866e0[_0x6659('0x4b')]=_0x373a3d[_0x6659('0x4b')];_0x4866e0[_0x6659('0x4c')]=_0x373a3d[_0x6659('0x4c')];_0x4866e0[_0x6659('0x4d')]=_0x373a3d['predictiveIntervalAvailable'];_0x4866e0['predictiveIntervalTotalCalls']=_0x373a3d['predictiveIntervalTotalCalls'];_0x4866e0['message']=_0x373a3d[_0x6659('0x1b')];_0x4866e0['originated']=_0x373a3d['originated'];_0x4866e0[_0x6659('0x4e')]=_0x373a3d[_0x6659('0x4e')];_0x4866e0['erlangCallToSecond']=_0x373a3d[_0x6659('0x4f')];_0x4866e0[_0x6659('0x50')]=_0x373a3d['erlangAbandonmentRate'];_0x4866e0[_0x6659('0x51')]=_0x373a3d[_0x6659('0x51')];_0x4866e0[_0x6659('0x52')]=_0x373a3d[_0x6659('0x52')];_0x4866e0['startProgressive']=_0x373a3d[_0x6659('0x53')];}if(_0x373a3d['Trunk']){_0x4866e0[_0x6659('0x54')]={'id':_0x373a3d[_0x6659('0x54')]['id'],'name':_0x373a3d[_0x6659('0x54')][_0x6659('0xb')],'active':_0x373a3d[_0x6659('0x54')][_0x6659('0x55')],'callerid':_0x373a3d['Trunk']['callerid']};}if(_0x373a3d[_0x6659('0x56')]){_0x4866e0[_0x6659('0x56')]={'id':_0x373a3d[_0x6659('0x56')]['id'],'name':_0x373a3d[_0x6659('0x56')][_0x6659('0xb')]};}_0x436691[_0x6659('0x57')](_0x4866e0);}}_0x45effc({'count':_0x436691[_0x6659('0x58')],'rows':_0x436691});});},'UpdateVoiceQueue':function(_0x358f15){return new Promise(function(_0x3077a8,_0x440c7c){var _0x529f35=_[_0x6659('0x59')](_0x483945['voiceQueues'],{'id':parseInt(_0x358f15['id'])});var _0x104d61=_[_0x6659('0x5a')](_0x358f15,['id']);if(_0x529f35){for(var _0x577d7f in _0x104d61){if(typeof _0x104d61[_0x577d7f]!==_0x6659('0x5b')&&typeof _0x529f35[_0x577d7f]!==_0x6659('0x5b')){_0x529f35[_0x577d7f]=_0x104d61[_0x577d7f];}}_0x3077a8(_0x529f35);}else{_0x440c7c();}});},'VoiceChannels':function(_0x5cfef5){return new Promise(function(_0x2cbd80,_0x345313){var _0x6e0e41=_[_0x6659('0x5c')](_0x483945['channels']);_0x2cbd80({'count':_0x6e0e41['length'],'rows':_0x6e0e41});});},'VoiceChannelMixMonitor':function(_0x1832cc){var _0x268e06=this;return new Promise(function(_0x2c4c0e,_0x29f7f1){if(ami[_0x6659('0x10')]()==![]){return _0x29f7f1(_0x268e06[_0x6659('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x6659('0x12')][_0x6659('0x13')],'ami\x20disconnected'][_0x6659('0x14')]('\x20')));}var _0x29e7cc=schema(properties['voicechannel'])[_0x6659('0x2')](_0x1832cc);if(_0x29e7cc[_0x6659('0x58')]>0x0){return _0x29f7f1(_0x268e06[_0x6659('0x11')](0x1f4,_[_0x6659('0x5d')](_0x29e7cc,_0x6659('0x1b'))[_0x6659('0x14')](',\x20')));}var _0x4686d3=_[_0x6659('0x59')](_0x483945[_0x6659('0x5e')],{'uniqueid':_0x1832cc[_0x6659('0x5f')]});if(_0x4686d3&&_0x4686d3[_0x6659('0x60')]){var _0x499c47=util['format']('%s.%s',_0x1832cc[_0x6659('0x61')]||_0x1832cc[_0x6659('0x5f')],_0x1832cc['format']||_0x6659('0x62'));return ami[_0x6659('0x1f')]({'action':'MixMonitor','channel':_0x4686d3[_0x6659('0x60')],'file':_0x499c47,'options':_0x6659('0x63')})[_0x6659('0x64')](function(_0x4f9abf){var _0xf2348f=_['find'](_0x4686d3['monitors'],{'filename':_0x6659('0x65')+_0x499c47[_0x6659('0x66')]()});if(_[_0x6659('0x67')](_0xf2348f)){_0x4686d3[_0x6659('0x68')][_0x6659('0x57')]({'filename':_0x6659('0x65')+_0x499c47[_0x6659('0x66')](),'createdAt':moment()[_0x6659('0x8')](_0x6659('0x69')),'mixmonitorid':_0x4f9abf[_0x6659('0x6a')],'status':_0x6659('0x6b')});}else{_0xf2348f[_0x6659('0x6a')]=_0x4f9abf[_0x6659('0x6a')];_0xf2348f['status']=_0x6659('0x6b');}_0x2c4c0e({'code':0xc8,'message':[_0x1832cc[_0x6659('0x5f')],'MixMonitor\x20Success',_0x4f9abf[_0x6659('0x6a')]][_0x6659('0x14')]('\x20'),'mixmonitorid':_0x4f9abf[_0x6659('0x6a')]});})['catch'](function(_0x21a365){_0x29f7f1(_0x268e06[_0x6659('0x11')](0x1f5,[_0x1832cc[_0x6659('0x5f')],_0x21a365[_0x6659('0x1b')][_0x6659('0x66')]()][_0x6659('0x14')]('\x20')));});}else{return _0x29f7f1(_0x268e06['error'](0x1f5,_0x6659('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x35ac7d){var _0x316cb0=this;return new Promise(function(_0x230e61,_0x479178){if(ami[_0x6659('0x10')]()==![]){return _0x479178(_0x316cb0[_0x6659('0x11')](0x1f4,[config[_0x6659('0x12')]['ip'],config[_0x6659('0x12')][_0x6659('0x13')],_0x6659('0x1c')][_0x6659('0x14')]('\x20')));}var _0x55db3e=schema(properties['voicechannel'])['validate'](_0x35ac7d);if(_0x55db3e['length']>0x0){return _0x479178(_0x316cb0['error'](0x1f4,_['map'](_0x55db3e,_0x6659('0x1b'))[_0x6659('0x14')](',\x20')));}var _0x13f31d=_['find'](_0x483945[_0x6659('0x5e')],{'uniqueid':_0x35ac7d[_0x6659('0x5f')]});if(_0x13f31d){return BPromise['resolve']()[_0x6659('0x64')](function(){if(_0x13f31d[_0x6659('0x60')]){return ami[_0x6659('0x1f')]({'action':_0x6659('0x6d'),'channel':_0x13f31d['channel'],'mixmonitorid':_0x35ac7d[_0x6659('0x6a')]})[_0x6659('0x1a')](function(_0x1162e8){});}})[_0x6659('0x64')](function(){if(_0x13f31d[_0x6659('0x6e')]){return ami[_0x6659('0x1f')]({'action':'StopMixMonitor','channel':_0x13f31d[_0x6659('0x6e')],'mixmonitorid':_0x35ac7d[_0x6659('0x6a')]})[_0x6659('0x1a')](function(_0x23ba92){});}})['then'](function(_0x34b12e){var _0x4a551d=_['find'](_0x13f31d[_0x6659('0x68')],{'mixmonitorid':_0x35ac7d['mixmonitorid']});if(_0x4a551d){_0x4a551d[_0x6659('0x6f')]=_0x6659('0x70');}})['then'](function(){var _0x3977be=util[_0x6659('0x8')](_0x6659('0x71'),_0x35ac7d['filename']||_0x35ac7d[_0x6659('0x5f')],_0x35ac7d[_0x6659('0x8')]||_0x6659('0x62'));var _0x4c2b65=_['find'](_0x13f31d[_0x6659('0x68')],{'filename':_0x6659('0x65')+_0x3977be[_0x6659('0x66')]()});if(_0x4c2b65){_0x4c2b65['status']=_0x6659('0x70');}})[_0x6659('0x64')](function(){_0x230e61({'code':0xc8,'message':[_0x35ac7d[_0x6659('0x5f')],_0x6659('0x72')][_0x6659('0x14')]('\x20')});})[_0x6659('0x1a')](function(_0x1fcf50){_0x479178(_0x316cb0['error'](0x1f5,[_0x35ac7d[_0x6659('0x5f')],_0x1fcf50[_0x6659('0x1b')][_0x6659('0x66')]()][_0x6659('0x14')]('\x20')));});}else{return _0x479178(_0x316cb0['error'](0x1f5,_0x6659('0x6c')));}});},'VoiceQueuesChannels':function(_0x50b75e){return new Promise(function(_0x466210,_0x4cb1aa){var _0x1027b4=_[_0x6659('0x5c')](_0x483945['queueChannels']);_0x466210({'count':_0x1027b4['length'],'rows':_0x1027b4});});},'VoiceQueuesChannel':function(_0x58755b){var _0x42e469=this;return new Promise(function(_0x58220d,_0x4e7e3e){var _0x445d9b=schema(properties[_0x6659('0x73')])[_0x6659('0x2')](_0x58755b);if(_0x445d9b[_0x6659('0x58')]>0x0){return _0x4e7e3e(_0x42e469['error'](0x1f4,_[_0x6659('0x5d')](_0x445d9b,_0x6659('0x1b'))[_0x6659('0x14')](',\x20')));}var _0x6d5339=_[_0x6659('0x59')](_0x483945[_0x6659('0x74')],{'uniqueid':_0x58755b[_0x6659('0x5f')]});if(_0x6d5339){_0x58220d(_0x6d5339);}else{return _0x4e7e3e(_0x42e469['error'](0x1f5,_0x6659('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x55a3a9){var _0x2cf584=this;return new Promise(function(_0x27fbf7,_0x5d0a46){if(ami['isConnected']()==![]){return _0x5d0a46(_0x2cf584[_0x6659('0x11')](0x1f4,[config[_0x6659('0x12')]['ip'],config[_0x6659('0x12')]['username'],_0x6659('0x1c')][_0x6659('0x14')]('\x20')));}var _0x2704e8=schema(properties['voicequeuechannelhangup'])[_0x6659('0x2')](_0x55a3a9);if(_0x2704e8[_0x6659('0x58')]>0x0){return _0x5d0a46(_0x2cf584['error'](0x1f4,_['map'](_0x2704e8,_0x6659('0x1b'))['join'](',\x20')));}var _0x445fa8=_[_0x6659('0x59')](_0x483945[_0x6659('0x74')],{'uniqueid':_0x55a3a9[_0x6659('0x5f')]});if(_0x445fa8&&_0x445fa8[_0x6659('0x60')]){return ami[_0x6659('0x1f')]({'action':_0x6659('0x75'),'channel':_0x445fa8[_0x6659('0x60')]})[_0x6659('0x64')](function(_0x24b310){_0x27fbf7({'code':0xc8,'message':[_0x55a3a9[_0x6659('0x5f')],_0x24b310[_0x6659('0x1b')][_0x6659('0x66')]()][_0x6659('0x14')]('\x20')});})[_0x6659('0x1a')](function(_0x472485){_0x5d0a46(_0x2cf584[_0x6659('0x11')](0x1f5,[_0x55a3a9[_0x6659('0x5f')],_0x472485[_0x6659('0x1b')][_0x6659('0x66')]()][_0x6659('0x14')]('\x20')));});}else{return _0x5d0a46(_0x2cf584['error'](0x1f5,_0x6659('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x43a607){var _0x39bd7d=this;return new Promise(function(_0x55e3e1,_0x1c6bff){if(ami[_0x6659('0x10')]()==![]){return _0x1c6bff(_0x39bd7d[_0x6659('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x6659('0x12')][_0x6659('0x13')],'ami\x20disconnected'][_0x6659('0x14')]('\x20')));}var _0x4f2c4f=schema(properties[_0x6659('0x76')])[_0x6659('0x2')](_0x43a607);if(_0x4f2c4f[_0x6659('0x58')]>0x0){return _0x1c6bff(_0x39bd7d[_0x6659('0x11')](0x1f4,_['map'](_0x4f2c4f,'message')[_0x6659('0x14')](',\x20')));}var _0x1cf948=_[_0x6659('0x59')](_0x483945[_0x6659('0x74')],{'uniqueid':_0x43a607[_0x6659('0x5f')]});if(_0x1cf948&&_0x1cf948[_0x6659('0x60')]){return ami[_0x6659('0x1f')]({'action':_0x6659('0x77'),'channel':_0x1cf948[_0x6659('0x60')],'exten':_0x43a607[_0x6659('0x78')],'context':_0x43a607[_0x6659('0x79')]||_0x1cf948['context'],'priority':0x1})[_0x6659('0x64')](function(_0x52eee1){_0x55e3e1({'code':0xc8,'message':[_0x43a607[_0x6659('0x5f')],_0x52eee1[_0x6659('0x1b')][_0x6659('0x66')]()][_0x6659('0x14')]('\x20')});})['catch'](function(_0x373c74){_0x1c6bff(_0x39bd7d[_0x6659('0x11')](0x1f5,[_0x43a607[_0x6659('0x5f')],_0x373c74['message'][_0x6659('0x66')]()][_0x6659('0x14')]('\x20')));});}else{return _0x1c6bff(_0x39bd7d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2637b2){return new Promise(function(_0x42dffc,_0x58631d){var _0x38f9d8=_[_0x6659('0x5c')](_0x483945['agents']);_0x42dffc({'count':_0x38f9d8[_0x6659('0x58')],'rows':_0x38f9d8});});},'Telephones':function(_0x10a6e5){return new Promise(function(_0x3a5530,_0x597b0a){var _0x3abac8=_[_0x6659('0x5c')](_0x483945[_0x6659('0x7a')]);_0x3a5530({'count':_0x3abac8['length'],'rows':_0x3abac8});});},'Trunks':function(_0x1aeebc){return new Promise(function(_0x4e91b6,_0x5e8a39){var _0x5b0e0d=_[_0x6659('0x5c')](_0x483945['trunks']);_0x4e91b6({'count':_0x5b0e0d[_0x6659('0x58')],'rows':_0x5b0e0d});});},'OutboundChannels':function(_0x51f147){return new Promise(function(_0x339a4b,_0x3aabe9){var _0x377f91=_[_0x6659('0x5c')](_0x483945[_0x6659('0x7b')]);_0x339a4b({'count':_0x377f91['length'],'rows':_0x377f91});});},'Outbound':function(_0x52a25e){return new Promise(function(_0x2d8ffd,_0x5589e5){_0x2d8ffd(_0x483945[_0x6659('0x2e')]);});},'Campaigns':function(_0x257235){return new Promise(function(_0x460916,_0x23fe5b){var _0x17222b=_['values'](_0x483945[_0x6659('0x7c')]);_0x460916({'count':_0x17222b['length'],'rows':_0x17222b});});},'VoiceQueuesPreview':function(_0x3653ca){var _0x3b7f51=this;return new Promise(function(_0x5cd96a,_0x5f259a){_0x7edf11[_0x6659('0x7d')](_0x3653ca['id'])[_0x6659('0x64')](function(_0x407371){_0x5cd96a({'code':0xc8,'message':_0x407371[_0x6659('0x1b')]});})[_0x6659('0x1a')](function(_0x140261){_0x5f259a(_0x3b7f51[_0x6659('0x11')](0x1f4,_0x140261[_0x6659('0x1b')]));});});},'EventManager':function(_0x47b382){var _0x14ee7b=this;return new Promise(function(_0xb58af9,_0x33c6d9){if(!_0x47b382[_0x6659('0x7e')]){return _0x33c6d9(_0x14ee7b[_0x6659('0x11')](0x1f4,_0x6659('0x7f')));}ami['emit'](_0x6659('0x80')+_0x47b382['event'],_0x47b382[_0x6659('0x1b')]);_0xb58af9({'code':0xc8,'message':_0x47b382});});},'FaxAccounts':function(_0x3bd970){return new Promise(function(_0x590b7c,_0x3b0534){var _0x188807=_[_0x6659('0x5c')](_0x483945[_0x6659('0x81')]);_0x590b7c({'count':_0x188807[_0x6659('0x58')],'rows':_0x188807});});},'SendFax':function(_0x3fcf16){var _0x21fd8d=this;return new Promise(function(_0x22415c,_0x3b1dcf){_0x3091f1[_0x6659('0x82')](_0x3fcf16)['then'](function(_0x2ddc13){_0x22415c({'code':0xc8,'message':_0x2ddc13[_0x6659('0x1b')]});})[_0x6659('0x1a')](function(_0x1265b0){_0x3b1dcf(_0x21fd8d[_0x6659('0x11')](0x1f4,_0x1265b0[_0x6659('0x1b')]));});});},'CheckAfterSend':function(_0x2c5caf){var _0xfa0367=this;return new Promise(function(_0x43bb74,_0x1642fd){_0x3091f1[_0x6659('0x83')](_0x2c5caf)[_0x6659('0x64')](function(_0x310958){_0x43bb74({'code':0xc8,'message':_0x310958[_0x6659('0x1b')]});})[_0x6659('0x1a')](function(_0x350e91){_0x1642fd(_0xfa0367[_0x6659('0x11')](0x1f4,_0x350e91[_0x6659('0x1b')]));});});}};var _0x4b7f92=jayson[_0x6659('0x84')](_0x29292b)[_0x6659('0x85')]();_0x4b7f92['on']('error',function(_0x46cc91){return _0x1ed458(_0x46cc91);});_0x4b7f92[_0x6659('0x86')](0x232a,_0x6659('0x87'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0xd6bf59(_0x6659('0x88')+0x232a);});});}; \ No newline at end of file +var _0x8af6=['username','ami\x20disconnected','join','pick','module','action','Reload','Action','message','catch','isConnected','command','Command','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','waiting','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','undefined','values','channels','channel','format','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','then','monitors','isNil','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','map','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','event','emit','custom:','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','SIP','name','timers','timer','updateAcw','agents','pause','error','asterisk'];(function(_0x193dc4,_0x2946c4){var _0x4a73d0=function(_0x177461){while(--_0x177461){_0x193dc4['push'](_0x193dc4['shift']());}};_0x4a73d0(++_0x2946c4);}(_0x8af6,0x76));var _0x68af=function(_0x3979a4,_0x3f3582){_0x3979a4=_0x3979a4-0x0;var _0x180d1b=_0x8af6[_0x3979a4];return _0x180d1b;};'use strict';var _=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var jayson=require(_0x68af('0x2'));var schema=require(_0x68af('0x3'));var BPromise=require(_0x68af('0x4'));var moment=require(_0x68af('0x5'));var config=require(_0x68af('0x6'));var properties=require(_0x68af('0x7'));var ami=require(_0x68af('0x8'));exports[_0x68af('0x9')]=function(_0x52bd87,_0x32992b,_0x5a23da){return new BPromise(function(_0x36e91a,_0x2be0c1){var _0x89146f={'QueuePause':function(_0x1e77b0){return new Promise(function(_0x3c6018,_0x20d61c){var _0x2a6bda=util['format']('%s/%s',_0x68af('0xa'),_0x1e77b0[_0x68af('0xb')]);if(_0x52bd87['timers']&&_0x52bd87[_0x68af('0xc')][_0x2a6bda]&&_0x52bd87[_0x68af('0xc')][_0x2a6bda][_0x68af('0xd')]){_0x52bd87[_0x68af('0xc')][_0x2a6bda][_0x68af('0xe')]();}if(_0x52bd87[_0x68af('0xf')][_0x2a6bda]){_0x52bd87['agents'][_0x2a6bda]['updateStatusRealtime']({'statePause':_0x1e77b0[_0x68af('0x10')]?!![]:![]});}_0x3c6018({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x5cfc81){var _0x368fa5=this;return new Promise(function(_0x7e53d7,_0xdba0d){if(ami['isConnected']()==![]){return _0xdba0d(_0x368fa5[_0x68af('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x68af('0x12')][_0x68af('0x13')],_0x68af('0x14')][_0x68af('0x15')]('\x20')));}_0x5cfc81=_[_0x68af('0x16')](_0x5cfc81,_['keys'](properties[_0x68af('0x17')]));_0x5cfc81[_0x68af('0x18')]=_0x68af('0x19');return ami[_0x68af('0x1a')](_0x5cfc81)['then'](function(_0x5357b1){_0x7e53d7({'code':0xc8,'message':_0x5357b1[_0x68af('0x1b')]});})[_0x68af('0x1c')](function(_0x4e1c41){_0xdba0d(_0x368fa5[_0x68af('0x11')](0x1f5,_0x4e1c41[_0x68af('0x1b')]));});});},'Command':function(_0x3d3e6f){var _0x1a82f0=this;return new Promise(function(_0x53ecde,_0x2ed0a6){if(ami[_0x68af('0x1d')]()==![]){return _0x2ed0a6(_0x1a82f0['error'](0x1f4,[config['asterisk']['ip'],config[_0x68af('0x12')][_0x68af('0x13')],_0x68af('0x14')][_0x68af('0x15')]('\x20')));}_0x3d3e6f=_[_0x68af('0x16')](_0x3d3e6f,_0x68af('0x1e'));_0x3d3e6f['action']=_0x68af('0x1f');return ami[_0x68af('0x1a')](_0x3d3e6f)['then'](function(_0x3ebd57){_0x53ecde({'code':0xc8,'message':_0x3ebd57['content']});})[_0x68af('0x1c')](function(_0x1f0d0e){_0x2ed0a6(_0x1a82f0[_0x68af('0x11')](0x1f5,_0x1f0d0e[_0x68af('0x1b')]));});});},'VoiceQueues':function(_0x2deb06){return new Promise(function(_0x218811,_0x5851b9){var _0x514ebc=[];for(var _0x29f003 in _0x52bd87[_0x68af('0x20')]){if(_0x52bd87[_0x68af('0x20')][_0x68af('0x21')](_0x29f003)){var _0x375d38=_0x52bd87[_0x68af('0x20')][_0x29f003];var _0x1839f9={'id':_0x375d38['id'],'name':_0x375d38[_0x68af('0xb')],'strategy':_0x375d38['strategy'],'answered':_0x375d38[_0x68af('0x22')],'available':_0x375d38[_0x68af('0x23')],'loggedIn':_0x375d38[_0x68af('0x24')],'pTalking':_0x375d38[_0x68af('0x25')],'sumBillable':_0x375d38['sumBillable'],'sumDuration':_0x375d38['sumDuration'],'sumHoldTime':_0x375d38[_0x68af('0x26')]||0x0,'talking':_0x375d38[_0x68af('0x27')],'total':_0x375d38[_0x68af('0x28')],'type':_0x375d38['type'],'unmanaged':_0x375d38['unmanaged'],'abandoned':_0x375d38[_0x68af('0x29')],'waiting':_0x375d38[_0x68af('0x2a')],'loggedInDb':_0x375d38['loggedInDb']};if(_0x375d38[_0x68af('0x2b')]===_0x68af('0x2c')){_0x1839f9[_0x68af('0x2d')]=_0x375d38[_0x68af('0x2d')];_0x1839f9[_0x68af('0x2e')]=_0x375d38[_0x68af('0x2e')];_0x1839f9[_0x68af('0x2f')]=_0x375d38['dialOriginateCallerIdName'];_0x1839f9[_0x68af('0x30')]=_0x375d38[_0x68af('0x30')];_0x1839f9[_0x68af('0x31')]=_0x375d38['dialOriginateTimeout'];_0x1839f9[_0x68af('0x32')]=_0x375d38[_0x68af('0x32')];_0x1839f9['temp']=_0x375d38[_0x68af('0x33')];_0x1839f9[_0x68af('0x34')]=_0x375d38['outboundAnswerAgiCallsDay'];_0x1839f9[_0x68af('0x35')]=_0x375d38['outboundAnswerCallsDay'];_0x1839f9['outboundBlacklistCallsDay']=_0x375d38[_0x68af('0x36')];_0x1839f9[_0x68af('0x37')]=_0x375d38[_0x68af('0x37')];_0x1839f9[_0x68af('0x38')]=_0x375d38[_0x68af('0x38')];_0x1839f9[_0x68af('0x39')]=_0x375d38['outboundDropCallsDayACS'];_0x1839f9['outboundDropCallsDayCallersExit']=_0x375d38['outboundDropCallsDayCallersExit'];_0x1839f9[_0x68af('0x3a')]=_0x375d38[_0x68af('0x3a')];_0x1839f9['outboundNoAnswerCallsDay']=_0x375d38[_0x68af('0x3b')];_0x1839f9[_0x68af('0x3c')]=_0x375d38[_0x68af('0x3c')];_0x1839f9['outboundOriginateFailureCallsDay']=_0x375d38[_0x68af('0x3d')];_0x1839f9[_0x68af('0x3e')]=_0x375d38[_0x68af('0x3e')];_0x1839f9[_0x68af('0x3f')]=_0x375d38[_0x68af('0x3f')];_0x1839f9['outboundUnknownCallsDay']=_0x375d38[_0x68af('0x40')];_0x1839f9[_0x68af('0x41')]=_0x375d38[_0x68af('0x41')];_0x1839f9[_0x68af('0x42')]=_0x375d38[_0x68af('0x42')];_0x1839f9[_0x68af('0x43')]=_0x375d38[_0x68af('0x43')];_0x1839f9[_0x68af('0x44')]=_0x375d38[_0x68af('0x44')];_0x1839f9[_0x68af('0x45')]=_0x375d38['predictiveIntervalDroppedCallsTimeout'];_0x1839f9[_0x68af('0x46')]=_0x375d38[_0x68af('0x46')];_0x1839f9['predictiveIntervalErlangCallsDroppedCalls']=_0x375d38[_0x68af('0x47')];_0x1839f9[_0x68af('0x48')]=_0x375d38[_0x68af('0x48')];_0x1839f9[_0x68af('0x49')]=_0x375d38[_0x68af('0x49')];_0x1839f9['predictiveIntervalPauses']=_0x375d38['predictiveIntervalPauses'];_0x1839f9['predictiveIntervalAvailable']=_0x375d38[_0x68af('0x4a')];_0x1839f9[_0x68af('0x4b')]=_0x375d38['predictiveIntervalTotalCalls'];_0x1839f9[_0x68af('0x1b')]=_0x375d38[_0x68af('0x1b')];_0x1839f9[_0x68af('0x4c')]=_0x375d38[_0x68af('0x4c')];_0x1839f9['erlangCalls']=_0x375d38[_0x68af('0x4d')];_0x1839f9[_0x68af('0x4e')]=_0x375d38[_0x68af('0x4e')];_0x1839f9[_0x68af('0x4f')]=_0x375d38[_0x68af('0x4f')];_0x1839f9[_0x68af('0x50')]=_0x375d38[_0x68af('0x50')];_0x1839f9[_0x68af('0x51')]=_0x375d38[_0x68af('0x51')];_0x1839f9[_0x68af('0x52')]=_0x375d38['startProgressive'];}if(_0x375d38['Trunk']){_0x1839f9[_0x68af('0x53')]={'id':_0x375d38[_0x68af('0x53')]['id'],'name':_0x375d38[_0x68af('0x53')][_0x68af('0xb')],'active':_0x375d38[_0x68af('0x53')]['active'],'callerid':_0x375d38[_0x68af('0x53')][_0x68af('0x54')]};}if(_0x375d38[_0x68af('0x55')]){_0x1839f9['Interval']={'id':_0x375d38[_0x68af('0x55')]['id'],'name':_0x375d38[_0x68af('0x55')][_0x68af('0xb')]};}_0x514ebc[_0x68af('0x56')](_0x1839f9);}}_0x218811({'count':_0x514ebc[_0x68af('0x57')],'rows':_0x514ebc});});},'UpdateVoiceQueue':function(_0x22a045){return new Promise(function(_0x3c4e20,_0x589bd2){var _0x276356=_[_0x68af('0x58')](_0x52bd87[_0x68af('0x20')],{'id':parseInt(_0x22a045['id'])});var _0x120d82=_['omit'](_0x22a045,['id']);if(_0x276356){for(var _0x122d50 in _0x120d82){if(typeof _0x120d82[_0x122d50]!==_0x68af('0x59')&&typeof _0x276356[_0x122d50]!=='undefined'){_0x276356[_0x122d50]=_0x120d82[_0x122d50];}}_0x3c4e20(_0x276356);}else{_0x589bd2();}});},'VoiceChannels':function(_0x4718b7){return new Promise(function(_0x56725a,_0x31c074){var _0x5bab92=_[_0x68af('0x5a')](_0x52bd87[_0x68af('0x5b')]);_0x56725a({'count':_0x5bab92[_0x68af('0x57')],'rows':_0x5bab92});});},'VoiceChannelMixMonitor':function(_0x7740db){var _0x3abd48=this;return new Promise(function(_0x2ef471,_0x28e83f){if(ami[_0x68af('0x1d')]()==![]){return _0x28e83f(_0x3abd48[_0x68af('0x11')](0x1f4,[config[_0x68af('0x12')]['ip'],config[_0x68af('0x12')][_0x68af('0x13')],'ami\x20disconnected'][_0x68af('0x15')]('\x20')));}var _0x1a399f=schema(properties['voicechannel'])[_0x68af('0x3')](_0x7740db);if(_0x1a399f[_0x68af('0x57')]>0x0){return _0x28e83f(_0x3abd48[_0x68af('0x11')](0x1f4,_['map'](_0x1a399f,_0x68af('0x1b'))[_0x68af('0x15')](',\x20')));}var _0x641c67=_[_0x68af('0x58')](_0x52bd87[_0x68af('0x5b')],{'uniqueid':_0x7740db['uniqueid']});if(_0x641c67&&_0x641c67[_0x68af('0x5c')]){var _0x2617ac=util[_0x68af('0x5d')](_0x68af('0x5e'),_0x7740db[_0x68af('0x5f')]||_0x7740db[_0x68af('0x60')],_0x7740db[_0x68af('0x5d')]||_0x68af('0x61'));return ami[_0x68af('0x1a')]({'action':_0x68af('0x62'),'channel':_0x641c67['channel'],'file':_0x2617ac,'options':_0x68af('0x63')})[_0x68af('0x64')](function(_0x1f4bce){var _0x4b3b54=_[_0x68af('0x58')](_0x641c67[_0x68af('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x2617ac['toLowerCase']()});if(_[_0x68af('0x66')](_0x4b3b54)){_0x641c67['monitors']['push']({'filename':_0x68af('0x67')+_0x2617ac[_0x68af('0x68')](),'createdAt':moment()[_0x68af('0x5d')](_0x68af('0x69')),'mixmonitorid':_0x1f4bce[_0x68af('0x6a')],'status':_0x68af('0x6b')});}else{_0x4b3b54[_0x68af('0x6a')]=_0x1f4bce['mixmonitorid'];_0x4b3b54[_0x68af('0x6c')]=_0x68af('0x6b');}_0x2ef471({'code':0xc8,'message':[_0x7740db[_0x68af('0x60')],_0x68af('0x6d'),_0x1f4bce[_0x68af('0x6a')]][_0x68af('0x15')]('\x20'),'mixmonitorid':_0x1f4bce[_0x68af('0x6a')]});})[_0x68af('0x1c')](function(_0x2f30e3){_0x28e83f(_0x3abd48['error'](0x1f5,[_0x7740db[_0x68af('0x60')],_0x2f30e3[_0x68af('0x1b')][_0x68af('0x68')]()][_0x68af('0x15')]('\x20')));});}else{return _0x28e83f(_0x3abd48[_0x68af('0x11')](0x1f5,_0x68af('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x582e82){var _0x1f2ba6=this;return new Promise(function(_0x5a2c16,_0x2fea5f){if(ami['isConnected']()==![]){return _0x2fea5f(_0x1f2ba6['error'](0x1f4,[config['asterisk']['ip'],config[_0x68af('0x12')]['username'],_0x68af('0x14')][_0x68af('0x15')]('\x20')));}var _0x39388f=schema(properties[_0x68af('0x6f')])[_0x68af('0x3')](_0x582e82);if(_0x39388f[_0x68af('0x57')]>0x0){return _0x2fea5f(_0x1f2ba6[_0x68af('0x11')](0x1f4,_['map'](_0x39388f,_0x68af('0x1b'))['join'](',\x20')));}var _0x2492d4=_[_0x68af('0x58')](_0x52bd87[_0x68af('0x5b')],{'uniqueid':_0x582e82['uniqueid']});if(_0x2492d4){return BPromise[_0x68af('0x70')]()[_0x68af('0x64')](function(){if(_0x2492d4[_0x68af('0x5c')]){return ami[_0x68af('0x1a')]({'action':'StopMixMonitor','channel':_0x2492d4[_0x68af('0x5c')],'mixmonitorid':_0x582e82['mixmonitorid']})[_0x68af('0x1c')](function(_0x56835d){});}})[_0x68af('0x64')](function(){if(_0x2492d4[_0x68af('0x71')]){return ami[_0x68af('0x1a')]({'action':'StopMixMonitor','channel':_0x2492d4[_0x68af('0x71')],'mixmonitorid':_0x582e82[_0x68af('0x6a')]})[_0x68af('0x1c')](function(_0x36b9ae){});}})['then'](function(_0x2deeb3){var _0x5cf983=_[_0x68af('0x58')](_0x2492d4['monitors'],{'mixmonitorid':_0x582e82['mixmonitorid']});if(_0x5cf983){_0x5cf983[_0x68af('0x6c')]='stop';}})[_0x68af('0x64')](function(){var _0x4b07c6=util[_0x68af('0x5d')](_0x68af('0x5e'),_0x582e82['filename']||_0x582e82[_0x68af('0x60')],_0x582e82[_0x68af('0x5d')]||'wav');var _0x265d0c=_[_0x68af('0x58')](_0x2492d4[_0x68af('0x65')],{'filename':_0x68af('0x67')+_0x4b07c6[_0x68af('0x68')]()});if(_0x265d0c){_0x265d0c['status']=_0x68af('0x72');}})[_0x68af('0x64')](function(){_0x5a2c16({'code':0xc8,'message':[_0x582e82[_0x68af('0x60')],_0x68af('0x73')][_0x68af('0x15')]('\x20')});})[_0x68af('0x1c')](function(_0x125d2a){_0x2fea5f(_0x1f2ba6[_0x68af('0x11')](0x1f5,[_0x582e82[_0x68af('0x60')],_0x125d2a['message'][_0x68af('0x68')]()]['join']('\x20')));});}else{return _0x2fea5f(_0x1f2ba6[_0x68af('0x11')](0x1f5,_0x68af('0x6e')));}});},'VoiceQueuesChannels':function(_0x59580e){return new Promise(function(_0x4b23e6,_0x3a5058){var _0x487d52=_['values'](_0x52bd87[_0x68af('0x74')]);_0x4b23e6({'count':_0x487d52[_0x68af('0x57')],'rows':_0x487d52});});},'VoiceQueuesChannel':function(_0x196a01){var _0x2bff0c=this;return new Promise(function(_0x5dbf33,_0x14c37e){var _0x328be6=schema(properties[_0x68af('0x75')])[_0x68af('0x3')](_0x196a01);if(_0x328be6['length']>0x0){return _0x14c37e(_0x2bff0c['error'](0x1f4,_[_0x68af('0x76')](_0x328be6,_0x68af('0x1b'))['join'](',\x20')));}var _0x351d52=_[_0x68af('0x58')](_0x52bd87[_0x68af('0x74')],{'uniqueid':_0x196a01[_0x68af('0x60')]});if(_0x351d52){_0x5dbf33(_0x351d52);}else{return _0x14c37e(_0x2bff0c[_0x68af('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x22cd4c){var _0x111b46=this;return new Promise(function(_0x1e827b,_0x5c257d){if(ami[_0x68af('0x1d')]()==![]){return _0x5c257d(_0x111b46[_0x68af('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x68af('0x13')],_0x68af('0x14')][_0x68af('0x15')]('\x20')));}var _0x324205=schema(properties['voicequeuechannelhangup'])[_0x68af('0x3')](_0x22cd4c);if(_0x324205['length']>0x0){return _0x5c257d(_0x111b46['error'](0x1f4,_['map'](_0x324205,_0x68af('0x1b'))['join'](',\x20')));}var _0x4949a6=_[_0x68af('0x58')](_0x52bd87[_0x68af('0x74')],{'uniqueid':_0x22cd4c[_0x68af('0x60')]});if(_0x4949a6&&_0x4949a6[_0x68af('0x5c')]){return ami[_0x68af('0x1a')]({'action':_0x68af('0x77'),'channel':_0x4949a6[_0x68af('0x5c')]})['then'](function(_0x36d27e){_0x1e827b({'code':0xc8,'message':[_0x22cd4c[_0x68af('0x60')],_0x36d27e[_0x68af('0x1b')]['toLowerCase']()][_0x68af('0x15')]('\x20')});})['catch'](function(_0x3bc30a){_0x5c257d(_0x111b46[_0x68af('0x11')](0x1f5,[_0x22cd4c[_0x68af('0x60')],_0x3bc30a[_0x68af('0x1b')][_0x68af('0x68')]()][_0x68af('0x15')]('\x20')));});}else{return _0x5c257d(_0x111b46[_0x68af('0x11')](0x1f5,_0x68af('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x42f45f){var _0x34932e=this;return new Promise(function(_0x3e8660,_0x27e434){if(ami[_0x68af('0x1d')]()==![]){return _0x27e434(_0x34932e['error'](0x1f4,[config[_0x68af('0x12')]['ip'],config[_0x68af('0x12')]['username'],_0x68af('0x14')][_0x68af('0x15')]('\x20')));}var _0x3cf23a=schema(properties[_0x68af('0x78')])[_0x68af('0x3')](_0x42f45f);if(_0x3cf23a[_0x68af('0x57')]>0x0){return _0x27e434(_0x34932e['error'](0x1f4,_[_0x68af('0x76')](_0x3cf23a,_0x68af('0x1b'))[_0x68af('0x15')](',\x20')));}var _0x5cd284=_['find'](_0x52bd87[_0x68af('0x74')],{'uniqueid':_0x42f45f[_0x68af('0x60')]});if(_0x5cd284&&_0x5cd284[_0x68af('0x5c')]){return ami['Action']({'action':_0x68af('0x79'),'channel':_0x5cd284[_0x68af('0x5c')],'exten':_0x42f45f[_0x68af('0x7a')],'context':_0x42f45f[_0x68af('0x7b')]||_0x5cd284['context'],'priority':0x1})[_0x68af('0x64')](function(_0x1e6cc8){_0x3e8660({'code':0xc8,'message':[_0x42f45f[_0x68af('0x60')],_0x1e6cc8[_0x68af('0x1b')][_0x68af('0x68')]()]['join']('\x20')});})[_0x68af('0x1c')](function(_0x224bd7){_0x27e434(_0x34932e[_0x68af('0x11')](0x1f5,[_0x42f45f['uniqueid'],_0x224bd7[_0x68af('0x1b')][_0x68af('0x68')]()][_0x68af('0x15')]('\x20')));});}else{return _0x27e434(_0x34932e[_0x68af('0x11')](0x1f5,_0x68af('0x6e')));}});},'Agents':function(_0x37a22e){return new Promise(function(_0x58901d,_0x331cfc){var _0x476833=_[_0x68af('0x5a')](_0x52bd87['agents']);_0x58901d({'count':_0x476833['length'],'rows':_0x476833});});},'Telephones':function(_0x470804){return new Promise(function(_0x42b58d,_0x1ce09a){var _0x2d629f=_['values'](_0x52bd87[_0x68af('0x7c')]);_0x42b58d({'count':_0x2d629f[_0x68af('0x57')],'rows':_0x2d629f});});},'Trunks':function(_0x4a2797){return new Promise(function(_0x584796,_0x3a348c){var _0x1f77c1=_['values'](_0x52bd87[_0x68af('0x7d')]);_0x584796({'count':_0x1f77c1[_0x68af('0x57')],'rows':_0x1f77c1});});},'OutboundChannels':function(_0x1e86e8){return new Promise(function(_0x47640b,_0x5cb1bd){var _0x12a8c2=_[_0x68af('0x5a')](_0x52bd87['outboundChannels']);_0x47640b({'count':_0x12a8c2['length'],'rows':_0x12a8c2});});},'Outbound':function(_0x71cd13){return new Promise(function(_0x32396b,_0x566776){_0x32396b(_0x52bd87[_0x68af('0x2c')]);});},'Campaigns':function(_0x5df74f){return new Promise(function(_0x2dcaaa,_0x5750b1){var _0x55f31c=_['values'](_0x52bd87[_0x68af('0x7e')]);_0x2dcaaa({'count':_0x55f31c[_0x68af('0x57')],'rows':_0x55f31c});});},'VoiceQueuesPreview':function(_0x3c3313){var _0x3749f2=this;return new Promise(function(_0x165c3b,_0x59f150){_0x32992b[_0x68af('0x7f')](_0x3c3313['id'])[_0x68af('0x64')](function(_0x47948b){_0x165c3b({'code':0xc8,'message':_0x47948b[_0x68af('0x1b')]});})[_0x68af('0x1c')](function(_0x506a07){_0x59f150(_0x3749f2[_0x68af('0x11')](0x1f4,_0x506a07[_0x68af('0x1b')]));});});},'EventManager':function(_0x2699ce){var _0xc9e13a=this;return new Promise(function(_0x48b175,_0x31ebb5){if(!_0x2699ce[_0x68af('0x80')]){return _0x31ebb5(_0xc9e13a[_0x68af('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x68af('0x81')](_0x68af('0x82')+_0x2699ce[_0x68af('0x80')],_0x2699ce[_0x68af('0x1b')]);_0x48b175({'code':0xc8,'message':_0x2699ce});});},'FaxAccounts':function(_0x3350b4){return new Promise(function(_0xcad3a7,_0x423082){var _0x48e9ae=_[_0x68af('0x5a')](_0x52bd87['faxAccounts']);_0xcad3a7({'count':_0x48e9ae[_0x68af('0x57')],'rows':_0x48e9ae});});},'SendFax':function(_0x48f249){var _0x431c2f=this;return new Promise(function(_0x24c151,_0x481db5){_0x5a23da[_0x68af('0x83')](_0x48f249)[_0x68af('0x64')](function(_0x41a008){_0x24c151({'code':0xc8,'message':_0x41a008[_0x68af('0x1b')]});})[_0x68af('0x1c')](function(_0x1fb3d6){_0x481db5(_0x431c2f[_0x68af('0x11')](0x1f4,_0x1fb3d6['message']));});});},'CheckAfterSend':function(_0x3afa1e){var _0x5580a3=this;return new Promise(function(_0x1aa260,_0x46d328){_0x5a23da[_0x68af('0x84')](_0x3afa1e)['then'](function(_0x24c4cf){_0x1aa260({'code':0xc8,'message':_0x24c4cf['message']});})['catch'](function(_0x132812){_0x46d328(_0x5580a3[_0x68af('0x11')](0x1f4,_0x132812[_0x68af('0x1b')]));});});}};var _0x510dcb=jayson[_0x68af('0x85')](_0x89146f)['http']();_0x510dcb['on'](_0x68af('0x11'),function(_0x3055da){return _0x2be0c1(_0x3055da);});_0x510dcb[_0x68af('0x9')](0x232a,_0x68af('0x86'),function(){console[_0x68af('0x87')](_0x68af('0x88'),0x232a);return _0x36e91a('RPC\x20listening\x20on\x20port:'+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 90cb101..62c0797 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 _0x8038=['action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','calleridnum','lastName','phone','scheduledAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','data4','isNil','firstName','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','user:%s','name','format'];(function(_0x2c1e34,_0x2d7149){var _0x117034=function(_0x220889){while(--_0x220889){_0x2c1e34['push'](_0x2c1e34['shift']());}};_0x117034(++_0x2d7149);}(_0x8038,0x176));var _0x8803=function(_0x4dbefa,_0x4bfc80){_0x4dbefa=_0x4dbefa-0x0;var _0x3efe6f=_0x8038[_0x4dbefa];return _0x3efe6f;};'use strict';var _=require(_0x8803('0x0'));var BPromise=require('bluebird');var Redis=require(_0x8803('0x1'));var util=require(_0x8803('0x2'));var config=require(_0x8803('0x3'));var logger=require('../../../../config/logger')(_0x8803('0x4'));var cmContactRpc=require(_0x8803('0x5'));config[_0x8803('0x6')]=_[_0x8803('0x7')](config[_0x8803('0x6')],{'host':_0x8803('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8803('0x6')]));function emit(_0xc2f43a,_0x34438d,_0xdcf5e4,_0x1aac8a,_0x190cac){logger[_0x8803('0x9')](_0x8803('0xa'),_0xc2f43a,_0x34438d['id'],_0xdcf5e4,_0x1aac8a,JSON[_0x8803('0xb')](_0x190cac));io['to'](_0xdcf5e4)[_0x8803('0xc')](_0x1aac8a,_0x190cac);}exports[_0x8803('0xd')]=function(_0x35f1b8,_0x1821fe,_0x63375e,_0x373bc2){var _0x1d7a1a,_0x1e248f;var _0x393681={};var _0x566e32=Number(_0x63375e[_0x8803('0xe')]);var _0x20ac15=_0x63375e[_0x8803('0xf')]?Boolean(Number(_0x63375e['data2'])):![];var _0x5b4b0e;if(_0x373bc2[_0x8803('0x10')]){_0x393681['id']=_0x373bc2[_0x8803('0x10')];}if(!_0x393681['id']){_0x393681[_0x8803('0x11')]=_0x566e32;_0x5b4b0e=_0x63375e[_0x8803('0x12')]&&_0x63375e['data3']!=='0'?_0x63375e['data3'][_0x8803('0x13')](','):['phone'];_0x393681[_0x8803('0x14')]=_['map'](_0x5b4b0e,function(_0x3b77a6){var _0x4dbd2b={};_0x4dbd2b[_0x3b77a6]=_0x373bc2[_0x8803('0x15')]?_0x373bc2[_0x8803('0x16')]:_0x373bc2[_0x8803('0x17')];return _0x4dbd2b;});}var _0x581fb4=['id','firstName',_0x8803('0x18'),_0x8803('0x19'),'mobile','fax',_0x8803('0x11'),'createdAt',_0x8803('0x1a'),'updatedAt'];var _0x3426ae=_['union'](_0x581fb4,_0x5b4b0e);BPromise[_0x8803('0x1b')]()[_0x8803('0x1c')](cmContactRpc[_0x8803('0x1d')]({'attributes':_0x3426ae,'where':_0x393681}))[_0x8803('0x1c')](function(_0x3e9bec){_0x1e248f=_0x3e9bec;if(!_[_0x8803('0x1e')](_0x1e248f)){if(_0x1e248f[_0x8803('0x1f')]===0x1){_0x1d7a1a=_0x1e248f[0x0];logger['info'](_0x8803('0x20'),_0x373bc2['uniqueid'],_0x1821fe['id'],_0x1d7a1a['id']);}else{logger[_0x8803('0x9')](_0x8803('0x21'),_0x373bc2[_0x8803('0x22')],_0x1821fe['id'],_[_0x8803('0x23')](_0x1e248f,'id')['join'](','));}return;}else{logger[_0x8803('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x373bc2[_0x8803('0x22')],_0x1821fe['id']);var _0x20f152={'ListId':_0x566e32};var _0x187220=_0x63375e[_0x8803('0x24')]&&_0x63375e[_0x8803('0x24')]!=='0'?_0x63375e[_0x8803('0x24')]:_0x8803('0x19');if(_0x20ac15){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x373bc2[_0x8803('0x22')],_0x1821fe['id']);_0x20f152[_0x187220]=_[_0x8803('0x25')](_0x373bc2[_0x8803('0x15')])?_0x373bc2[_0x8803('0x17')]:_0x373bc2[_0x8803('0x16')];if(_[_0x8803('0x25')](_0x373bc2['routeId'])){_0x20f152[_0x8803('0x26')]=_0x373bc2['calleridname']&&_0x373bc2[_0x8803('0x27')]!==''?_0x373bc2['calleridname']:_0x8803('0x28');}else{_0x20f152[_0x8803('0x26')]=_0x373bc2['destcalleridname']&&_0x373bc2[_0x8803('0x29')]!==''?_0x373bc2[_0x8803('0x29')]:_0x8803('0x28');}return BPromise[_0x8803('0x1b')]()['then'](cmContactRpc[_0x8803('0x2a')](_0x20f152))[_0x8803('0x1c')](function(_0x1b28ca){_0x1d7a1a=_0x1b28ca;_0x1e248f[_0x8803('0x2b')](_0x1b28ca);if(_0x1d7a1a){logger[_0x8803('0x9')](_0x8803('0x2c'),_0x373bc2['uniqueid'],_0x1821fe['id'],_0x1d7a1a['id']);}return;});}else{logger[_0x8803('0x9')](_0x8803('0x2d'),_0x373bc2['uniqueid'],_0x1821fe['id']);_0x20f152[_0x187220]=_[_0x8803('0x25')](_0x373bc2[_0x8803('0x15')])?_0x373bc2[_0x8803('0x17')]:_0x373bc2[_0x8803('0x16')];if(_[_0x8803('0x25')](_0x373bc2['routeId'])){_0x20f152[_0x8803('0x26')]=_0x373bc2[_0x8803('0x27')]&&_0x373bc2[_0x8803('0x27')]!==_0x8803('0x2e')?_0x373bc2[_0x8803('0x27')]:_0x8803('0x28');}else{_0x20f152[_0x8803('0x26')]=_0x373bc2[_0x8803('0x29')]&&_0x373bc2[_0x8803('0x29')]!==''?_0x373bc2['destcalleridname']:_0x8803('0x28');}_0x1d7a1a=_0x20f152;_0x1e248f['push'](_0x20f152);return;}}})[_0x8803('0x1c')](function(){if(_0x35f1b8){emit(_0x373bc2['uniqueid'],_0x1821fe,util['format'](_0x8803('0x2f'),_0x35f1b8[_0x8803('0x30')]),util[_0x8803('0x31')]('trigger:%s',_0x63375e[_0x8803('0x32')][_0x8803('0x33')]()),{'evt':_[_0x8803('0x34')](_0x373bc2,{'autoCreate':_0x20ac15}),'contact':_0x1d7a1a===undefined?{}:_0x1d7a1a,'contacts':_0x1e248f['length']===0x0?undefined:_0x1e248f});}});}; \ No newline at end of file +var _0x9e7f=['fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','redis','defaults','localhost','info','[CM][%s][%s]','stringify','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName'];(function(_0x1d455c,_0x1d8535){var _0x4f232b=function(_0x38934e){while(--_0x38934e){_0x1d455c['push'](_0x1d455c['shift']());}};_0x4f232b(++_0x1d8535);}(_0x9e7f,0x1b4));var _0xf9e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9e7f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf9e7('0x0'));var BPromise=require(_0xf9e7('0x1'));var Redis=require(_0xf9e7('0x2'));var util=require(_0xf9e7('0x3'));var config=require(_0xf9e7('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0xf9e7('0x5')]=_[_0xf9e7('0x6')](config[_0xf9e7('0x5')],{'host':_0xf9e7('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf9e7('0x5')]));function emit(_0x5b72eb,_0x5b107a,_0x5d0a78,_0x461e5f,_0x2776c7){logger[_0xf9e7('0x8')](_0xf9e7('0x9'),_0x5b72eb,_0x5b107a['id'],_0x5d0a78,_0x461e5f,JSON[_0xf9e7('0xa')](_0x2776c7));io['to'](_0x5d0a78)['emit'](_0x461e5f,_0x2776c7);}exports['exec']=function(_0x17ca7f,_0x4ea431,_0x439226,_0x41498b){var _0x6cc167,_0x282a90;var _0x512a23={};var _0x28f559=Number(_0x439226[_0xf9e7('0xb')]);var _0x2a145f=_0x439226[_0xf9e7('0xc')]?Boolean(Number(_0x439226[_0xf9e7('0xc')])):![];var _0x1bb5c2;if(_0x41498b['xmd-contactid']){_0x512a23['id']=_0x41498b[_0xf9e7('0xd')];}if(!_0x512a23['id']){_0x512a23[_0xf9e7('0xe')]=_0x28f559;_0x1bb5c2=_0x439226['data3']&&_0x439226[_0xf9e7('0xf')]!=='0'?_0x439226[_0xf9e7('0xf')][_0xf9e7('0x10')](','):[_0xf9e7('0x11')];_0x512a23[_0xf9e7('0x12')]=_['map'](_0x1bb5c2,function(_0x2829fe){var _0x238fae={};_0x238fae[_0x2829fe]=_0x41498b[_0xf9e7('0x13')]?_0x41498b[_0xf9e7('0x14')]:_0x41498b[_0xf9e7('0x15')];return _0x238fae;});}var _0x48dc57=['id',_0xf9e7('0x16'),'lastName','phone','mobile',_0xf9e7('0x17'),_0xf9e7('0xe'),_0xf9e7('0x18'),_0xf9e7('0x19'),_0xf9e7('0x1a')];var _0x49de02=_[_0xf9e7('0x1b')](_0x48dc57,_0x1bb5c2);BPromise[_0xf9e7('0x1c')]()[_0xf9e7('0x1d')](cmContactRpc[_0xf9e7('0x1e')]({'attributes':_0x49de02,'where':_0x512a23}))['then'](function(_0x51143b){_0x282a90=_0x51143b;if(!_[_0xf9e7('0x1f')](_0x282a90)){if(_0x282a90['length']===0x1){_0x6cc167=_0x282a90[0x0];logger[_0xf9e7('0x8')](_0xf9e7('0x20'),_0x41498b[_0xf9e7('0x21')],_0x4ea431['id'],_0x6cc167['id']);}else{logger[_0xf9e7('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x41498b['uniqueid'],_0x4ea431['id'],_['map'](_0x282a90,'id')['join'](','));}return;}else{logger[_0xf9e7('0x8')](_0xf9e7('0x22'),_0x41498b['uniqueid'],_0x4ea431['id']);var _0x38de2b={'ListId':_0x28f559};var _0x20d9e2=_0x439226[_0xf9e7('0x23')]&&_0x439226[_0xf9e7('0x23')]!=='0'?_0x439226['data4']:'phone';if(_0x2a145f){logger['info'](_0xf9e7('0x24'),_0x41498b[_0xf9e7('0x21')],_0x4ea431['id']);_0x38de2b[_0x20d9e2]=_['isNil'](_0x41498b[_0xf9e7('0x13')])?_0x41498b[_0xf9e7('0x15')]:_0x41498b[_0xf9e7('0x14')];if(_[_0xf9e7('0x25')](_0x41498b[_0xf9e7('0x13')])){_0x38de2b[_0xf9e7('0x16')]=_0x41498b['calleridname']&&_0x41498b[_0xf9e7('0x26')]!==_0xf9e7('0x27')?_0x41498b[_0xf9e7('0x26')]:_0xf9e7('0x28');}else{_0x38de2b[_0xf9e7('0x16')]=_0x41498b[_0xf9e7('0x29')]&&_0x41498b[_0xf9e7('0x29')]!==_0xf9e7('0x27')?_0x41498b[_0xf9e7('0x29')]:_0xf9e7('0x28');}return BPromise[_0xf9e7('0x1c')]()[_0xf9e7('0x1d')](cmContactRpc['createContact'](_0x38de2b))[_0xf9e7('0x1d')](function(_0x101378){_0x6cc167=_0x101378;_0x282a90[_0xf9e7('0x2a')](_0x101378);if(_0x6cc167){logger[_0xf9e7('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x41498b[_0xf9e7('0x21')],_0x4ea431['id'],_0x6cc167['id']);}return;});}else{logger[_0xf9e7('0x8')](_0xf9e7('0x2b'),_0x41498b[_0xf9e7('0x21')],_0x4ea431['id']);_0x38de2b[_0x20d9e2]=_['isNil'](_0x41498b[_0xf9e7('0x13')])?_0x41498b[_0xf9e7('0x15')]:_0x41498b[_0xf9e7('0x14')];if(_[_0xf9e7('0x25')](_0x41498b[_0xf9e7('0x13')])){_0x38de2b[_0xf9e7('0x16')]=_0x41498b['calleridname']&&_0x41498b[_0xf9e7('0x26')]!==_0xf9e7('0x27')?_0x41498b[_0xf9e7('0x26')]:_0xf9e7('0x28');}else{_0x38de2b[_0xf9e7('0x16')]=_0x41498b['destcalleridname']&&_0x41498b['destcalleridname']!==_0xf9e7('0x27')?_0x41498b[_0xf9e7('0x29')]:_0xf9e7('0x28');}_0x6cc167=_0x38de2b;_0x282a90[_0xf9e7('0x2a')](_0x38de2b);return;}}})[_0xf9e7('0x1d')](function(){if(_0x17ca7f){emit(_0x41498b['uniqueid'],_0x4ea431,util['format']('user:%s',_0x17ca7f[_0xf9e7('0x2c')]),util[_0xf9e7('0x2d')](_0xf9e7('0x2e'),_0x439226[_0xf9e7('0x2f')][_0xf9e7('0x30')]()),{'evt':_[_0xf9e7('0x31')](_0x41498b,{'autoCreate':_0x2a145f}),'contact':_0x6cc167===undefined?{}:_0x6cc167,'contacts':_0x282a90[_0xf9e7('0x32')]===0x0?undefined:_0x282a90});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 223b540..3c26d8f 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 _0xc3cb=['templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','zendeskAccounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','emit','info','stringify','prototype','clone','interface','checkTriggers','checkTrigger','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','render','uri','isNil','data3','data4','location','uriLocation','windowWidth','windowHeight','600','data6','winArguments','format','user:%s','name','trigger:%s:%s','data1','merge','trigger:%s','exec','integration','accounts','queue','routeId','urlforward','buildUri','parse','query','search','replace','AllConditions','every','checkConditions','channel','AnyConditions','some','field','operator','ChatWebsiteId','upperFirst','AccountId','interaction','event','value','agent','membername','lastevent','exports','util','lodash','url','mustache','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc3cb,0xd7));var _0xbc3c=function(_0x57a87b,_0xbe019b){_0x57a87b=_0x57a87b-0x0;var _0xfc916a=_0xc3cb[_0x57a87b];return _0xfc916a;};'use strict';var util=require(_0xbc3c('0x0'));var _=require(_0xbc3c('0x1'));var url=require(_0xbc3c('0x2'));var Mustache=require(_0xbc3c('0x3'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0xbc3c('0x4'));var cmContact=require(_0xbc3c('0x5'));var script=require(_0xbc3c('0x6'));var config=require(_0xbc3c('0x7'));var logger=require(_0xbc3c('0x8'))('trigger');var ami=require(_0xbc3c('0x9'));config['redis']=_[_0xbc3c('0xa')](config[_0xbc3c('0xb')],{'host':_0xbc3c('0xc'),'port':0x18eb});var io=require(_0xbc3c('0xd'))(new Redis(config[_0xbc3c('0xb')]));var operators={'equals':function(_0x544a72,_0x34f1a4){return _0x544a72==_0x34f1a4;},'not_equals':function(_0x925a89,_0x26fd36){return _0x925a89!=_0x26fd36;}};var barAndWebActions=[_0xbc3c('0xe'),_0xbc3c('0x2'),_0xbc3c('0xf')];function Trigger(_0x5103b7){this[_0xbc3c('0x10')]=_0x5103b7[_0xbc3c('0x10')];this[_0xbc3c('0x11')]=_0x5103b7[_0xbc3c('0x11')];this[_0xbc3c('0x12')]=_0x5103b7[_0xbc3c('0x12')];this[_0xbc3c('0x13')]=_0x5103b7['templates'];this[_0xbc3c('0x14')]=_0x5103b7[_0xbc3c('0x14')];this['zendeskAccounts']=_0x5103b7['zendeskAccounts'];this[_0xbc3c('0x15')]=_0x5103b7[_0xbc3c('0x15')];this['salesforceAccounts']=_0x5103b7[_0xbc3c('0x16')];this['sugarcrmAccounts']=_0x5103b7[_0xbc3c('0x17')];this[_0xbc3c('0x18')]=_0x5103b7[_0xbc3c('0x18')];this[_0xbc3c('0x19')]=_0x5103b7[_0xbc3c('0x19')];this['vtigerAccounts']=_0x5103b7[_0xbc3c('0x1a')];this[_0xbc3c('0x1b')]=_0x5103b7['servicenowAccounts'];this[_0xbc3c('0x1c')]=_0x5103b7['dynamics365Accounts'];this['freshsalesAccounts']=_0x5103b7['freshsalesAccounts'];this['accounts']={'zendesk':this[_0xbc3c('0x1d')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xbc3c('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xbc3c('0x19')],'vtiger':this[_0xbc3c('0x1a')],'dynamics365':this[_0xbc3c('0x1c')],'freshsales':this[_0xbc3c('0x1e')],'servicenow':this['servicenowAccounts']};ami['on'](_0xbc3c('0x1f'),this['syncCustomEvent'][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x21'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x23'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x24'),this[_0xbc3c('0x22')]['bind'](this));ami['on'](_0xbc3c('0x25'),this['syncCustomEvent'][_0xbc3c('0x20')](this));ami['on']('custom:agentnoanswer',this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x26'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x27'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x28'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x29'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x2a'),this['syncCustomEvent'][_0xbc3c('0x20')](this));ami['on']('custom:timeout',this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x2b'),this[_0xbc3c('0x2c')]['bind'](this));ami['on'](_0xbc3c('0x2d'),this['syncAgentDial']['bind'](this));ami['on'](_0xbc3c('0x2e'),this[_0xbc3c('0x2c')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x2f'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x30'),this['syncCustomEvent'][_0xbc3c('0x20')](this));ami['on']('custom:incomingmessage',this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x31'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on'](_0xbc3c('0x32'),this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));ami['on']('custom:rejectmessage',this[_0xbc3c('0x22')][_0xbc3c('0x20')](this));}Trigger['prototype'][_0xbc3c('0x33')]=function(_0x2e522b,_0x487e78,_0x2e4ae3){logger[_0xbc3c('0x34')](_0x2e522b,_0x487e78,JSON[_0xbc3c('0x35')](_0x2e4ae3));io['to'](_0x2e522b)['emit'](_0x487e78,_0x2e4ae3);};Trigger[_0xbc3c('0x36')][_0xbc3c('0x22')]=function(_0x8f0dbb){var _0x260cf0=_[_0xbc3c('0x37')](_0x8f0dbb);this['checkTriggers'](_0x260cf0);};Trigger[_0xbc3c('0x36')][_0xbc3c('0x2c')]=function(_0x48c915){if(this[_0xbc3c('0x11')][_0x48c915[_0xbc3c('0x38')]]){this[_0xbc3c('0x22')](_0x48c915);}};Trigger[_0xbc3c('0x36')][_0xbc3c('0x39')]=function(_0x5b8beb){var _0x3758c6;for(var _0x5bf240 in this['triggers']){if(this['triggers']['hasOwnProperty'](_0x5bf240)){if(this[_0xbc3c('0x10')][_0x5bf240]['status']){_0x3758c6=this[_0xbc3c('0x3a')](this['triggers'][_0x5bf240],_0x5b8beb);if(_0x3758c6){_['merge'](_0x5b8beb,_0x5b8beb['variables']);for(var _0x197065=0x0,_0x3cdb6f,_0x4fd557,_0x396eb1;_0x1970650x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5fc3,0xa8));var _0x35fc=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x5fc3[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 3a9ac03..d35bec8 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 _0x65ee=['calleridnum','contacts','/systemusers(','Bearer\x20','4.0','substring','lastIndexOf','enduserId','outbound','%2b','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','includes','string','type','nameField','idField','indexOf','content','ticketType','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','callDirection','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase','message','GET','value','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','destcalleridnum'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x65ee,0x9b));var _0xe65e=function(_0x16afe1,_0x223ab7){_0x16afe1=_0x16afe1-0x0;var _0x467198=_0x65ee[_0x16afe1];return _0x467198;};'use strict';var _=require(_0xe65e('0x0'));var BPromise=require(_0xe65e('0x1'));var rp=require(_0xe65e('0x2'));var util=require(_0xe65e('0x3'));var intUtil=require('./util');var md5=require(_0xe65e('0x4'));var Redis=require(_0xe65e('0x5'));var logger=require(_0xe65e('0x6'))(_0xe65e('0x7'));var config=require(_0xe65e('0x8'));config[_0xe65e('0x9')]=_[_0xe65e('0xa')](config[_0xe65e('0x9')],{'host':_0xe65e('0xb'),'port':0x18eb});var io=require(_0xe65e('0xc'))(new Redis(config[_0xe65e('0x9')]));function getAuthToken(_0x5c1de5,_0x58831f,_0x43b737){var _0x897162={'method':'POST','uri':_0x58831f,'form':{'client_id':_0x5c1de5[_0xe65e('0xd')],'resource':_0x5c1de5[_0xe65e('0xe')],'username':_0x5c1de5[_0xe65e('0xf')],'password':_0x5c1de5['password'],'grant_type':_0xe65e('0x10'),'client_secret':_0x5c1de5[_0xe65e('0x11')]},'json':!![]};return rp(_0x897162)[_0xe65e('0x12')](function(_0x1ceff0){return _0x1ceff0[_0xe65e('0x13')];})[_0xe65e('0x14')](function(_0x3e99f3){logger['error']('['+[_0x43b737[_0xe65e('0x15')]()]+']\x20Wrong\x20credentials!');return _0x3e99f3[_0xe65e('0x16')];});}function getUser(_0x3637d5,_0x4a0b74,_0x185b53,_0x17731c,_0x194b66,_0x55ab85){return new BPromise(function(_0x6a0238,_0x996986){return getAuthToken(_0x4a0b74,_0x17731c,_0x55ab85)[_0xe65e('0x12')](function(_0x243ea1){var _0xbdceca={'method':_0xe65e('0x17'),'uri':_0x194b66+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x243ea1,'OData-Version':'4.0'},'json':!![]};return rp(_0xbdceca);})[_0xe65e('0x12')](function(_0x3062aa){var _0x16c207=_0x3062aa[_0xe65e('0x18')];var _0x452752=![];var _0x29790e=null;if(!_['isNil'](_0x185b53)){if(intUtil['validateEmail'](_0x185b53[_0xe65e('0x19')])){_0x3637d5[_0xe65e('0x1a')]=_0x185b53['email'];for(_0x29790e=0x0;_0x29790e<_0x16c207[_0xe65e('0x1b')];_0x29790e++){if(_0x16c207[_0x29790e][_0xe65e('0x1c')]===_0x185b53[_0xe65e('0x19')]&&!_0x16c207[_0x29790e][_0xe65e('0x1d')]){_0x452752=!![];logger[_0xe65e('0x1e')]('['+[_0x55ab85['toUpperCase']()]+_0xe65e('0x1f')+_0x16c207[_0x29790e][_0xe65e('0x20')]+'!');_0x3637d5['userId']=_0x16c207[_0x29790e][_0xe65e('0x20')];}}}}if(!_0x452752){logger[_0xe65e('0x1e')]('['+[_0x55ab85[_0xe65e('0x15')]()]+_0xe65e('0x21'));_0x3637d5['userEmail']=_0x4a0b74[_0xe65e('0xf')];for(_0x29790e=0x0;_0x29790e<_0x16c207['length'];_0x29790e++){if(_0x16c207[_0x29790e]['internalemailaddress']===_0x4a0b74[_0xe65e('0xf')]){_0x3637d5[_0xe65e('0x22')]=_0x16c207[_0x29790e][_0xe65e('0x20')];}}}_0x6a0238(_0x3637d5);})['catch'](function(_0x5b7f78){_0x996986(_0x5b7f78[_0xe65e('0x16')]);});});}function createEndUser(_0x420a72,_0x1f2224,_0x567bef,_0x44e84f,_0x403c10,_0x464508){return new BPromise(function(_0x3df31d,_0x9f943){return getAuthToken(_0x1f2224,_0x567bef,_0x464508)['then'](function(_0xcf93e1){var _0x5e0b07=_0x464508[_0xe65e('0x23')]()==='outbound'?_0x403c10[_0xe65e('0x24')]:_0x403c10[_0xe65e('0x25')];var _0x23fec7={'method':'POST','uri':_0x44e84f+_0xe65e('0x26'),'body':{'telephone1':_0x5e0b07,'fullname':_0x5e0b07,'firstname':_0x5e0b07,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe65e('0x27')+_0x420a72[_0xe65e('0x22')]+')'},'headers':{'Authorization':_0xe65e('0x28')+_0xcf93e1,'OData-Version':_0xe65e('0x29')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x23fec7);})[_0xe65e('0x12')](function(_0x4acd87){var _0x11415e=_0x4acd87['headers']['odata-entityid'];var _0x2ecf56=_0x11415e[_0xe65e('0x2a')](_0x11415e[_0xe65e('0x2b')]('(')+0x1,_0x11415e['lastIndexOf'](')'));_0x420a72[_0xe65e('0x2c')]=_0x2ecf56;_0x3df31d(_0x420a72);})[_0xe65e('0x14')](function(_0x316963){_0x9f943(_0x316963['message']);});});}function getEndUser(_0x2731d1,_0x171fae,_0x434563,_0xdd8b0b,_0x2014a4,_0x2c5e01){return new BPromise(function(_0x59f275,_0x48d550){var _0x33d023=_0x2c5e01[_0xe65e('0x23')]()===_0xe65e('0x2d')?_0x2014a4[_0xe65e('0x24')]:_0x2014a4[_0xe65e('0x25')];return getAuthToken(_0x171fae,_0x434563,_0x2c5e01)['then'](function(_0x5eced4){var _0x2bf128={'method':_0xe65e('0x17'),'uri':_0xdd8b0b+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x33d023['replace']('+',_0xe65e('0x2e'))+'\x27','headers':{'Authorization':_0xe65e('0x28')+_0x5eced4,'If-None-Match':null,'OData-Version':_0xe65e('0x29')},'json':!![]};return rp(_0x2bf128);})[_0xe65e('0x12')](function(_0x10f5f6){var _0x2c50e3=null;if(_0x10f5f6){var _0x4b99b2=_0x10f5f6[_0xe65e('0x18')];var _0x139661=![];for(_0x2c50e3=0x0;_0x2c50e3<_0x4b99b2[_0xe65e('0x1b')];_0x2c50e3++){if(_0x4b99b2[_0x2c50e3][_0xe65e('0x2f')]===_0x33d023){_0x139661=!![];_0x2731d1[_0xe65e('0x2c')]=_0x4b99b2[_0x2c50e3][_0xe65e('0x30')];}}if(_0x139661){_0x59f275(_0x2731d1);}else{return createEndUser(_0x2731d1,_0x171fae,_0x434563,_0xdd8b0b,_0x2014a4,_0x2c5e01)[_0xe65e('0x12')](function(_0x469569){logger[_0xe65e('0x1e')]('['+[_0x2c5e01[_0xe65e('0x15')]()]+_0xe65e('0x31'),_0x469569[_0xe65e('0x2c')]);_0x59f275(_0x469569);});}}else{return createEndUser(_0x2731d1,_0x171fae,_0x434563,_0xdd8b0b,_0x2014a4,_0x2c5e01)[_0xe65e('0x12')](function(_0x36efe0){logger[_0xe65e('0x1e')]('['+[_0x2c5e01['toUpperCase']()]+_0xe65e('0x32'),_0x36efe0['enduserId']);_0x59f275(_0x36efe0);});}});});}function getCustomFields(_0x211d6c,_0x4d19cd,_0x76a812){var _0x46816b={};if(_0x211d6c['length']>0x0){_['forEach'](_0x211d6c,function(_0x5a4cbc){if(_[_0xe65e('0x33')]([_0xe65e('0x34'),'picklist'],_0x5a4cbc[_0xe65e('0x35')])&&_0x5a4cbc[_0xe65e('0x36')]&&!_0x5a4cbc['customField']){var _0x2d1629=_0x5a4cbc[_0xe65e('0x37')]['toLowerCase']();var _0x435f76=_0x2d1629[_0xe65e('0x2a')](0x0,_0x2d1629[_0xe65e('0x38')]('_'));var _0x59e151=_0x2d1629['substring'](_0x2d1629['indexOf']('_')+0x1);if(_0x435f76===_0x76a812){_0x46816b[_0x59e151]=_0x5a4cbc[_0xe65e('0x39')];}}});}return _0x46816b;}function getTicket(_0x48936b,_0x35f6e3,_0x56a3ea,_0x25a6de,_0x31ce5b,_0x1efe7f,_0x34053e){return new BPromise(function(_0x23b725,_0x1b1633){var _0x28bdb6;return getAuthToken(_0x35f6e3,_0x56a3ea,_0x34053e)[_0xe65e('0x12')](function(_0x16c5dc){if(_0x1efe7f[_0xe65e('0x3a')]==='incident'){_0x28bdb6={'method':'POST','uri':_0x25a6de+'incidents','body':Object[_0xe65e('0x3b')]({},{'title':intUtil[_0xe65e('0x3c')](_0x1efe7f[_0xe65e('0x3d')],_0x31ce5b,'\x20'),'description':intUtil[_0xe65e('0x3c')](_0x1efe7f[_0xe65e('0x3e')],_0x31ce5b,'\x0a'),'customerid_contact@odata.bind':_0xe65e('0x3f')+_0x48936b[_0xe65e('0x2c')]+')','ownerid@odata.bind':_0xe65e('0x27')+_0x48936b['userId']+')','caseorigincode':'1'},getCustomFields(_0x1efe7f[_0xe65e('0x40')],_0x31ce5b,_0x1efe7f[_0xe65e('0x3a')])),'headers':{'Authorization':_0xe65e('0x28')+_0x16c5dc,'OData-Version':_0xe65e('0x29')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1efe7f['ticketType']===_0xe65e('0x41')){_0x28bdb6={'method':'POST','uri':_0x25a6de+'phonecalls','body':Object[_0xe65e('0x3b')]({},{'subject':intUtil[_0xe65e('0x3c')](_0x1efe7f[_0xe65e('0x3d')],_0x31ce5b,'\x20'),'phonenumber':String(_0x31ce5b[_0xe65e('0x25')]),'description':intUtil['getString'](_0x1efe7f['Descriptions'],_0x31ce5b,'\x0a'),'regardingobjectid_contact@odata.bind':_0xe65e('0x3f')+_0x48936b[_0xe65e('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x48936b[_0xe65e('0x22')]+')','directioncode':_0x48936b['callDirection']===_0xe65e('0x42')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe65e('0x27')+_0x48936b['userId']+')','participationtypemask':_0x48936b['callDirection']===_0xe65e('0x42')?0x2:0x1},{'partyid_contact@odata.bind':_0xe65e('0x3f')+_0x48936b[_0xe65e('0x2c')]+')','participationtypemask':_0x48936b['callDirection']===_0xe65e('0x42')?0x1:0x2}]},getCustomFields(_0x1efe7f[_0xe65e('0x40')],_0x31ce5b,_0x1efe7f[_0xe65e('0x3a')])),'headers':{'Authorization':'Bearer\x20'+_0x16c5dc,'OData-Version':_0xe65e('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x28bdb6);})[_0xe65e('0x12')](function(_0x5dd6d9){var _0x4fd044=_0x5dd6d9[_0xe65e('0x43')]['odata-entityid'];var _0x3b8d06=_0x4fd044[_0xe65e('0x2a')](_0x4fd044[_0xe65e('0x2b')]('(')+0x1,_0x4fd044[_0xe65e('0x2b')](')'));_0x48936b[_0xe65e('0x44')]=_0x3b8d06;_0x23b725(_0x48936b);})['catch'](function(_0x5b65ca){_0x1b1633(_0x5b65ca['message']);});});}function emit(_0x2e4720,_0x46469f,_0x3f1c30,_0x29a653){var _0x407649={'uri':util[_0xe65e('0x45')](_0xe65e('0x46'),_0x2e4720,_0x3f1c30,_0x29a653)};io['to'](util['format'](_0xe65e('0x47'),_0x46469f))[_0xe65e('0x48')](_0xe65e('0x49'),_0x407649);}exports['cs']=function(_0x302467,_0x2176eb,_0x4ef786,_0x28165b,_0x2f375f,_0x543c3c,_0x4785e9,_0x5ec5d0){var _0x30a045={};_0x543c3c[_0xe65e('0xe')]=intUtil[_0xe65e('0x4a')](_0x543c3c[_0xe65e('0xe')]);_0x543c3c[_0xe65e('0x4b')]=intUtil['stripTrailingSlash'](_0x543c3c[_0xe65e('0x4b')]);_0x30a045[_0xe65e('0x4c')]=_0x5ec5d0==='queue'||_0x5ec5d0===_0xe65e('0x4d')?_0xe65e('0x42'):_0xe65e('0x2d');var _0x69eb64=util[_0xe65e('0x45')]('%s/api/data/v9.0/',_0x543c3c[_0xe65e('0xe')]);var _0x178166=util[_0xe65e('0x45')](_0xe65e('0x4e'),_0x543c3c[_0xe65e('0x4f')]);var _0x413a0c=util[_0xe65e('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x543c3c[_0xe65e('0x4b')],_0x2176eb[_0xe65e('0x50')],md5(_0x2176eb[_0xe65e('0x50')]));if(_0x2f375f&&_0x2f375f[_0xe65e('0x51')]){logger[_0xe65e('0x1e')](_0xe65e('0x52'),_0xe65e('0x53'));_0x2176eb[_0xe65e('0x54')]=_0x413a0c;}else if(_0x4785e9&&_0x4785e9[_0xe65e('0x55')]&&_0x4785e9[_0xe65e('0x55')]!==_0xe65e('0x56')){logger[_0xe65e('0x1e')](_0xe65e('0x57'),_0xe65e('0x53'));_0x2176eb['recordingURL']=_0x413a0c;}else{_0x2176eb[_0xe65e('0x54')]='';}return getUser(_0x30a045,_0x543c3c,_0x28165b,_0x178166,_0x69eb64,_0x5ec5d0)[_0xe65e('0x12')](function(_0x13f56a){logger[_0xe65e('0x1e')]('['+_0x5ec5d0[_0xe65e('0x15')]()+_0xe65e('0x58'),_0x13f56a[_0xe65e('0x22')]);logger[_0xe65e('0x1e')]('['+_0x5ec5d0[_0xe65e('0x15')]()+_0xe65e('0x59'),_0x13f56a['userEmail']);return getEndUser(_0x13f56a,_0x543c3c,_0x178166,_0x69eb64,_0x2176eb,_0x5ec5d0);})[_0xe65e('0x12')](function(_0x19f45a){logger[_0xe65e('0x1e')]('['+_0x5ec5d0[_0xe65e('0x15')]()+_0xe65e('0x5a'),_0x19f45a[_0xe65e('0x2c')]);logger[_0xe65e('0x1e')]('['+_0x5ec5d0[_0xe65e('0x15')]()+_0xe65e('0x5b'),_0x2176eb[_0xe65e('0x25')]);return getTicket(_0x19f45a,_0x543c3c,_0x178166,_0x69eb64,_0x2176eb,_0x4ef786,_0x5ec5d0);})[_0xe65e('0x12')](function(_0x47ee0a){logger[_0xe65e('0x1e')](util[_0xe65e('0x45')]('['+_0x5ec5d0['toUpperCase']()+_0xe65e('0x5c'),_0x4ef786[_0xe65e('0x3a')],_0x47ee0a[_0xe65e('0x44')]));logger[_0xe65e('0x1e')](util[_0xe65e('0x45')]('['+_0x5ec5d0['toUpperCase']()+_0xe65e('0x5d'),_0x5ec5d0));if(_0x5ec5d0!==_0xe65e('0x4d')){logger[_0xe65e('0x1e')]('['+_0x5ec5d0[_0xe65e('0x15')]()+']',_0xe65e('0x5e'));emit(_0x543c3c[_0xe65e('0xe')],_0x28165b[_0xe65e('0x5f')],_0x4ef786[_0xe65e('0x3a')],_0x47ee0a[_0xe65e('0x44')]);}})['catch'](function(_0x3b46ff){logger['error']('['+_0x5ec5d0[_0xe65e('0x15')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x3b46ff,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x43c2=['POST','clientId','remoteUri','password','clientSecret','then','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','userEmail','username','systemuserid','catch','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','toLowerCase','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','Bearer\x20','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','incidents','assign','getString','Subjects','Descriptions','Fields','ticketType','phonecall','/contacts(','queue','callDirection','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter'];(function(_0x2ecd07,_0x12359b){var _0x25c909=function(_0x1661e2){while(--_0x1661e2){_0x2ecd07['push'](_0x2ecd07['shift']());}};_0x25c909(++_0x12359b);}(_0x43c2,0x1e7));var _0x243c=function(_0x197948,_0x50019a){_0x197948=_0x197948-0x0;var _0x511a35=_0x43c2[_0x197948];return _0x511a35;};'use strict';var _=require(_0x243c('0x0'));var BPromise=require(_0x243c('0x1'));var rp=require(_0x243c('0x2'));var util=require(_0x243c('0x3'));var intUtil=require(_0x243c('0x4'));var md5=require(_0x243c('0x5'));var Redis=require(_0x243c('0x6'));var logger=require(_0x243c('0x7'))(_0x243c('0x8'));var config=require(_0x243c('0x9'));config['redis']=_['defaults'](config[_0x243c('0xa')],{'host':_0x243c('0xb'),'port':0x18eb});var io=require(_0x243c('0xc'))(new Redis(config[_0x243c('0xa')]));function getAuthToken(_0x448a82,_0x26476e,_0x277f9b){var _0xe61171={'method':_0x243c('0xd'),'uri':_0x26476e,'form':{'client_id':_0x448a82[_0x243c('0xe')],'resource':_0x448a82[_0x243c('0xf')],'username':_0x448a82['username'],'password':_0x448a82[_0x243c('0x10')],'grant_type':'password','client_secret':_0x448a82[_0x243c('0x11')]},'json':!![]};return rp(_0xe61171)[_0x243c('0x12')](function(_0x27af77){return _0x27af77[_0x243c('0x13')];})['catch'](function(_0x51a895){logger['error']('['+[_0x277f9b[_0x243c('0x14')]()]+_0x243c('0x15'));return _0x51a895[_0x243c('0x16')];});}function getUser(_0x2593b8,_0x313b37,_0x99f3,_0xc23793,_0xd5b25d,_0x26f247){return new BPromise(function(_0x54da07,_0x43b126){return getAuthToken(_0x313b37,_0xc23793,_0x26f247)[_0x243c('0x12')](function(_0x3814a5){var _0x17f002={'method':'GET','uri':_0xd5b25d+_0x243c('0x17'),'headers':{'Authorization':'Bearer\x20'+_0x3814a5,'OData-Version':_0x243c('0x18')},'json':!![]};return rp(_0x17f002);})[_0x243c('0x12')](function(_0x18a693){var _0x5925b2=_0x18a693['value'];var _0x24265e=![];var _0x512da9=null;if(!_[_0x243c('0x19')](_0x99f3)){if(intUtil[_0x243c('0x1a')](_0x99f3['email'])){_0x2593b8['userEmail']=_0x99f3[_0x243c('0x1b')];for(_0x512da9=0x0;_0x512da9<_0x5925b2[_0x243c('0x1c')];_0x512da9++){if(_0x5925b2[_0x512da9][_0x243c('0x1d')]===_0x99f3[_0x243c('0x1b')]&&!_0x5925b2[_0x512da9][_0x243c('0x1e')]){_0x24265e=!![];logger[_0x243c('0x1f')]('['+[_0x26f247['toUpperCase']()]+_0x243c('0x20')+_0x5925b2[_0x512da9]['systemuserid']+'!');_0x2593b8[_0x243c('0x21')]=_0x5925b2[_0x512da9]['systemuserid'];}}}}if(!_0x24265e){logger[_0x243c('0x1f')]('['+[_0x26f247[_0x243c('0x14')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2593b8[_0x243c('0x22')]=_0x313b37[_0x243c('0x23')];for(_0x512da9=0x0;_0x512da9<_0x5925b2[_0x243c('0x1c')];_0x512da9++){if(_0x5925b2[_0x512da9][_0x243c('0x1d')]===_0x313b37[_0x243c('0x23')]){_0x2593b8[_0x243c('0x21')]=_0x5925b2[_0x512da9][_0x243c('0x24')];}}}_0x54da07(_0x2593b8);})[_0x243c('0x25')](function(_0x6b2ebd){_0x43b126(_0x6b2ebd[_0x243c('0x16')]);});});}function createEndUser(_0x397c1f,_0x59fd06,_0xb3db77,_0x2ac6bf,_0x58c87f,_0x3b7e40){return new BPromise(function(_0x488222,_0x3e5f14){return getAuthToken(_0x59fd06,_0xb3db77,_0x3b7e40)[_0x243c('0x12')](function(_0x4911a9){var _0x890fbb=_0x3b7e40['toLowerCase']()==='outbound'?_0x58c87f['destcalleridnum']:_0x58c87f[_0x243c('0x26')];var _0x271218={'method':_0x243c('0xd'),'uri':_0x2ac6bf+_0x243c('0x27'),'body':{'telephone1':_0x890fbb,'fullname':_0x890fbb,'firstname':_0x890fbb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x243c('0x28')+_0x397c1f[_0x243c('0x21')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4911a9,'OData-Version':_0x243c('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x271218);})[_0x243c('0x12')](function(_0x535e60){var _0x49ac74=_0x535e60[_0x243c('0x29')][_0x243c('0x2a')];var _0x38d267=_0x49ac74[_0x243c('0x2b')](_0x49ac74[_0x243c('0x2c')]('(')+0x1,_0x49ac74['lastIndexOf'](')'));_0x397c1f['enduserId']=_0x38d267;_0x488222(_0x397c1f);})['catch'](function(_0x4e0981){_0x3e5f14(_0x4e0981[_0x243c('0x16')]);});});}function getEndUser(_0x2495f7,_0x1346f7,_0x1d89f0,_0x59a42c,_0x344e6f,_0x235e51){return new BPromise(function(_0x279177,_0x4a1c58){var _0x190668=_0x235e51[_0x243c('0x2d')]()==='outbound'?_0x344e6f['destcalleridnum']:_0x344e6f[_0x243c('0x26')];return getAuthToken(_0x1346f7,_0x1d89f0,_0x235e51)[_0x243c('0x12')](function(_0x2f1407){var _0x1841eb={'method':_0x243c('0x2e'),'uri':_0x59a42c+_0x243c('0x2f')+_0x190668['replace']('+',_0x243c('0x30'))+'\x27','headers':{'Authorization':_0x243c('0x31')+_0x2f1407,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1841eb);})[_0x243c('0x12')](function(_0x2cb642){var _0x422db0=null;if(_0x2cb642){var _0xf71eb3=_0x2cb642['value'];var _0x2ee472=![];for(_0x422db0=0x0;_0x422db0<_0xf71eb3[_0x243c('0x1c')];_0x422db0++){if(_0xf71eb3[_0x422db0]['telephone1']===_0x190668){_0x2ee472=!![];_0x2495f7[_0x243c('0x32')]=_0xf71eb3[_0x422db0][_0x243c('0x33')];}}if(_0x2ee472){_0x279177(_0x2495f7);}else{return createEndUser(_0x2495f7,_0x1346f7,_0x1d89f0,_0x59a42c,_0x344e6f,_0x235e51)['then'](function(_0x80ce48){logger[_0x243c('0x1f')]('['+[_0x235e51[_0x243c('0x14')]()]+_0x243c('0x34'),_0x80ce48['enduserId']);_0x279177(_0x80ce48);});}}else{return createEndUser(_0x2495f7,_0x1346f7,_0x1d89f0,_0x59a42c,_0x344e6f,_0x235e51)[_0x243c('0x12')](function(_0x3df25d){logger[_0x243c('0x1f')]('['+[_0x235e51[_0x243c('0x14')]()]+_0x243c('0x35'),_0x3df25d[_0x243c('0x32')]);_0x279177(_0x3df25d);});}});});}function getCustomFields(_0x30ff04,_0x4b4fbd,_0x285117){var _0x5cf603={};if(_0x30ff04[_0x243c('0x1c')]>0x0){_[_0x243c('0x36')](_0x30ff04,function(_0x529104){if(_[_0x243c('0x37')]([_0x243c('0x38'),_0x243c('0x39')],_0x529104[_0x243c('0x3a')])&&_0x529104[_0x243c('0x3b')]&&!_0x529104[_0x243c('0x3c')]){var _0x2d657b=_0x529104[_0x243c('0x3d')]['toLowerCase']();var _0x4dca76=_0x2d657b[_0x243c('0x2b')](0x0,_0x2d657b[_0x243c('0x3e')]('_'));var _0x48922c=_0x2d657b['substring'](_0x2d657b[_0x243c('0x3e')]('_')+0x1);if(_0x4dca76===_0x285117){_0x5cf603[_0x48922c]=_0x529104[_0x243c('0x3f')];}}});}return _0x5cf603;}function getTicket(_0xc61dab,_0x5aabfe,_0x20f2da,_0x385154,_0x465d5d,_0x3d6572,_0x1b88d5){return new BPromise(function(_0x31ad8b,_0x1dd2cd){var _0x42125c;return getAuthToken(_0x5aabfe,_0x20f2da,_0x1b88d5)[_0x243c('0x12')](function(_0x3e6c60){if(_0x3d6572['ticketType']==='incident'){_0x42125c={'method':'POST','uri':_0x385154+_0x243c('0x40'),'body':Object[_0x243c('0x41')]({},{'title':intUtil[_0x243c('0x42')](_0x3d6572[_0x243c('0x43')],_0x465d5d,'\x20'),'description':intUtil[_0x243c('0x42')](_0x3d6572[_0x243c('0x44')],_0x465d5d,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0xc61dab['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0xc61dab[_0x243c('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x3d6572[_0x243c('0x45')],_0x465d5d,_0x3d6572[_0x243c('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x3e6c60,'OData-Version':_0x243c('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3d6572[_0x243c('0x46')]===_0x243c('0x47')){_0x42125c={'method':'POST','uri':_0x385154+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x243c('0x42')](_0x3d6572[_0x243c('0x43')],_0x465d5d,'\x20'),'phonenumber':String(_0x465d5d['calleridnum']),'description':intUtil[_0x243c('0x42')](_0x3d6572[_0x243c('0x44')],_0x465d5d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x243c('0x48')+_0xc61dab[_0x243c('0x32')]+')','ownerid@odata.bind':_0x243c('0x28')+_0xc61dab[_0x243c('0x21')]+')','directioncode':_0xc61dab['callDirection']===_0x243c('0x49')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x243c('0x28')+_0xc61dab['userId']+')','participationtypemask':_0xc61dab['callDirection']===_0x243c('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x243c('0x48')+_0xc61dab[_0x243c('0x32')]+')','participationtypemask':_0xc61dab[_0x243c('0x4a')]===_0x243c('0x49')?0x1:0x2}]},getCustomFields(_0x3d6572[_0x243c('0x45')],_0x465d5d,_0x3d6572[_0x243c('0x46')])),'headers':{'Authorization':_0x243c('0x31')+_0x3e6c60,'OData-Version':_0x243c('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x42125c);})['then'](function(_0x337caf){var _0x573026=_0x337caf[_0x243c('0x29')]['odata-entityid'];var _0x57171a=_0x573026[_0x243c('0x2b')](_0x573026['lastIndexOf']('(')+0x1,_0x573026[_0x243c('0x2c')](')'));_0xc61dab[_0x243c('0x4b')]=_0x57171a;_0x31ad8b(_0xc61dab);})[_0x243c('0x25')](function(_0x46e6dc){_0x1dd2cd(_0x46e6dc[_0x243c('0x16')]);});});}function emit(_0x5a2a9a,_0x58466f,_0x6022a2,_0x1b17ae){var _0x26baec={'uri':util[_0x243c('0x4c')](_0x243c('0x4d'),_0x5a2a9a,_0x6022a2,_0x1b17ae)};io['to'](util[_0x243c('0x4c')](_0x243c('0x4e'),_0x58466f))[_0x243c('0x4f')]('trigger:browser:url',_0x26baec);}exports['cs']=function(_0x580361,_0x579547,_0x2f9035,_0x3b6f02,_0x13f1c7,_0x57a4f4,_0x2e0369,_0xe562f7){var _0x1db80f={};_0x57a4f4[_0x243c('0xf')]=intUtil[_0x243c('0x50')](_0x57a4f4[_0x243c('0xf')]);_0x57a4f4[_0x243c('0x51')]=intUtil[_0x243c('0x50')](_0x57a4f4[_0x243c('0x51')]);_0x1db80f[_0x243c('0x4a')]=_0xe562f7===_0x243c('0x49')||_0xe562f7==='unmanaged'?_0x243c('0x49'):_0x243c('0x52');var _0x44830a=util[_0x243c('0x4c')](_0x243c('0x53'),_0x57a4f4['remoteUri']);var _0x4c2e1b=util[_0x243c('0x4c')](_0x243c('0x54'),_0x57a4f4[_0x243c('0x55')]);var _0x4c3bc9=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x57a4f4['serverUrl'],_0x579547['uniqueid'],md5(_0x579547[_0x243c('0x56')]));if(_0x13f1c7&&_0x13f1c7[_0x243c('0x57')]){logger[_0x243c('0x1f')]('[QUEUE]','Recording\x20is\x20enabled!');_0x579547[_0x243c('0x58')]=_0x4c3bc9;}else if(_0x2e0369&&_0x2e0369[_0x243c('0x59')]&&_0x2e0369[_0x243c('0x59')]!==_0x243c('0x5a')){logger[_0x243c('0x1f')](_0x243c('0x5b'),_0x243c('0x5c'));_0x579547[_0x243c('0x58')]=_0x4c3bc9;}else{_0x579547[_0x243c('0x58')]='';}return getUser(_0x1db80f,_0x57a4f4,_0x3b6f02,_0x4c2e1b,_0x44830a,_0xe562f7)[_0x243c('0x12')](function(_0x3bf24c){logger[_0x243c('0x1f')]('['+_0xe562f7[_0x243c('0x14')]()+_0x243c('0x5d'),_0x3bf24c['userId']);logger[_0x243c('0x1f')]('['+_0xe562f7[_0x243c('0x14')]()+']\x20The\x20User\x20email\x20is:',_0x3bf24c[_0x243c('0x22')]);return getEndUser(_0x3bf24c,_0x57a4f4,_0x4c2e1b,_0x44830a,_0x579547,_0xe562f7);})[_0x243c('0x12')](function(_0x2c2174){logger['info']('['+_0xe562f7[_0x243c('0x14')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2c2174[_0x243c('0x32')]);logger[_0x243c('0x1f')]('['+_0xe562f7[_0x243c('0x14')]()+_0x243c('0x5e'),_0x579547[_0x243c('0x26')]);return getTicket(_0x2c2174,_0x57a4f4,_0x4c2e1b,_0x44830a,_0x579547,_0x2f9035,_0xe562f7);})[_0x243c('0x12')](function(_0x2f81de){logger[_0x243c('0x1f')](util[_0x243c('0x4c')]('['+_0xe562f7[_0x243c('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2f9035[_0x243c('0x46')],_0x2f81de[_0x243c('0x4b')]));logger['info'](util[_0x243c('0x4c')]('['+_0xe562f7[_0x243c('0x14')]()+']\x20Call\x20direction:\x20%s',_0xe562f7));if(_0xe562f7!==_0x243c('0x5f')){logger[_0x243c('0x1f')]('['+_0xe562f7[_0x243c('0x14')]()+']',_0x243c('0x60'));emit(_0x57a4f4['remoteUri'],_0x3b6f02['name'],_0x2f9035[_0x243c('0x46')],_0x2f81de['ticketId']);}})[_0x243c('0x25')](function(_0x36d675){logger[_0x243c('0x61')]('['+_0xe562f7[_0x243c('0x14')]()+_0x243c('0x62'),util[_0x243c('0x63')](_0x36d675,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index a3d7e42..f5d9579 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 _0x5775=['Basic\x20%s','base64','[HTTP]','map','forEach','includes','string','picklist','type','content','idField','customField','push','variable','variableName','toString','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','none','[OUTBOUND]','uniqueid','destcalleridname','The\x20Ticket\x20ID\x20is:','stringify','toUpperCase','lastevent','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x3d9b8c,_0x1accd9){var _0x5afdbc=function(_0x4ac82c){while(--_0x4ac82c){_0x3d9b8c['push'](_0x3d9b8c['shift']());}};_0x5afdbc(++_0x1accd9);}(_0x5775,0xdb));var _0x5577=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x5775[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x5577('0x0'));var rp=require('request-promise');var md5=require(_0x5577('0x1'));var util=require(_0x5577('0x2'));var Redis=require(_0x5577('0x3'));var intUtil=require(_0x5577('0x4'));var config=require(_0x5577('0x5'));var logger=require(_0x5577('0x6'))(_0x5577('0x7'));config[_0x5577('0x8')]=_[_0x5577('0x9')](config['redis'],{'host':_0x5577('0xa'),'port':0x18eb});var io=require(_0x5577('0xb'))(new Redis(config[_0x5577('0x8')]));var headers={'Content-Type':_0x5577('0xc'),'Accept':_0x5577('0xc')};function emit(_0x221e9f,_0x1bc3c1,_0x360bbb){io['to'](_0x221e9f)['emit'](_0x1bc3c1,_0x360bbb);}function getTicket(_0x34ed93,_0x5655e1,_0x4ca098,_0x52864d,_0x118d09){logger[_0x5577('0xd')](_0x5577('0xe'));var _0x3b494b=_[_0x5577('0xf')]({'responder_id':_0x5655e1['id'],'requester_id':_0x4ca098['id'],'name':util[_0x5577('0x10')](_0x5577('0x11'),_0x118d09[_0x5577('0x12')]),'phone':_0x118d09['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5577('0x13')](_0x52864d[_0x5577('0x14')],_0x118d09,'\x20'),'description':intUtil[_0x5577('0x13')](_0x52864d[_0x5577('0x15')],_0x118d09,_0x5577('0x16')),'tags':getTags(_0x52864d[_0x5577('0x17')],_0x5577('0x18'))},getCustomFields(_0x52864d[_0x5577('0x19')],_0x118d09));_0x3b494b[_0x5577('0x1a')]=_[_0x5577('0x1b')](_[_0x5577('0x1c')](_0x3b494b[_0x5577('0x1a')],'id'),'value');return request({'uri':util[_0x5577('0x10')]('%s/api/v2/tickets',_0x34ed93[_0x5577('0x1d')]),'method':_0x5577('0x1e'),'body':_0x3b494b})[_0x5577('0x1f')](function(_0x4b8b48){logger[_0x5577('0xd')](_0x5577('0x20'));return _0x4b8b48;});}function getUser(_0x552d4f,_0x5b47dc){if(intUtil['validateEmail'](_0x5b47dc)){return request({'uri':util['format'](_0x5577('0x21'),_0x552d4f[_0x5577('0x1d')]),'qs':{'email':_0x5b47dc}})[_0x5577('0x1f')](function(_0x26fd71){if(_0x26fd71[_0x5577('0x22')]){logger['info'](_0x5577('0x23'));return _[_0x5577('0x24')](_0x26fd71,function(_0x2126d0){return _0x2126d0[_0x5577('0x25')][_0x5577('0x26')]===_0x5b47dc;});}else{logger[_0x5577('0xd')](_0x5577('0x27'));return request({'uri':util[_0x5577('0x10')]('%s/api/v2/agents/me',_0x552d4f[_0x5577('0x1d')])})[_0x5577('0x1f')](function(_0x297575){logger[_0x5577('0xd')]('Admin\x20account\x20selected.');return _0x297575;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5577('0x10')](_0x5577('0x28'),_0x552d4f[_0x5577('0x1d')])})[_0x5577('0x1f')](function(_0x228b4a){logger[_0x5577('0xd')]('Admin\x20account\x20selected.');return _0x228b4a;});}}function getEndUser(_0x5cc936,_0x2c88cf,_0x5e6b54){logger[_0x5577('0xd')](_0x5577('0x29'),_0x5e6b54);return request({'uri':util[_0x5577('0x10')](_0x5577('0x2a'),_0x5cc936[_0x5577('0x1d')]),'qs':{'phone':_0x5e6b54}})[_0x5577('0x1f')](function(_0x5ea6c9){if(_0x5ea6c9[_0x5577('0x22')]){logger[_0x5577('0xd')](_0x5577('0x2b'));return _[_0x5577('0x24')](_0x5ea6c9,{'phone':_0x5e6b54});}else{logger['info'](_0x5577('0x2c'));return request({'uri':util['format'](_0x5577('0x2a'),_0x5cc936['remoteUri']),'method':_0x5577('0x1e'),'body':{'name':_0x2c88cf,'phone':_0x5e6b54}})[_0x5577('0x1f')](function(_0x2a0129){logger[_0x5577('0xd')]('Enduser\x20created.');return _0x2a0129;});}});}function getAuth(_0x5684f2){return util[_0x5577('0x10')](_0x5577('0x2d'),new Buffer(_0x5684f2['apiKey']+':X')['toString'](_0x5577('0x2e')));}function request(_0x1aa0f2){logger['debug'](_0x5577('0x2f'),JSON['stringify'](_0x1aa0f2));return rp(_[_0x5577('0x9')](_0x1aa0f2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x343daf,_0x36d0ca){var _0x1d917c=[];if(_0x343daf&&_0x343daf[_0x5577('0x22')]>0x0){_0x1d917c=_[_0x5577('0x30')](_0x343daf,_0x36d0ca);}return _0x1d917c;}function getCustomFields(_0xbf501c,_0x4be517){var _0x499343=[];var _0x4a49f8={'custom_fields':[]};if(_0xbf501c[_0x5577('0x22')]>0x0){_[_0x5577('0x31')](_0xbf501c,function(_0x3115d8){if(_[_0x5577('0x32')]([_0x5577('0x33'),_0x5577('0x34')],_0x3115d8[_0x5577('0x35')])&&_0x3115d8['nameField']&&!_0x3115d8['customField']){_0x4a49f8[_0x3115d8['nameField']['toLowerCase']()]=_0x3115d8[_0x5577('0x36')]['toString']();}else if(_[_0x5577('0x32')](['string',_0x5577('0x34')],_0x3115d8[_0x5577('0x35')])&&_0x3115d8[_0x5577('0x37')]&&_0x3115d8[_0x5577('0x38')]){_0x4a49f8[_0x5577('0x1a')][_0x5577('0x39')]({'id':_0x3115d8[_0x5577('0x37')],'value':_0x3115d8[_0x5577('0x36')]['toString']()});}else if(_0x3115d8[_0x5577('0x35')]===_0x5577('0x3a')&&_0x3115d8[_0x5577('0x3b')]&&_0x3115d8[_0x5577('0x37')]&&_0x3115d8['customField']){_0x4be517[_0x3115d8[_0x5577('0x3b')]]&&_0x4a49f8[_0x5577('0x1a')][_0x5577('0x39')]({'id':_0x3115d8[_0x5577('0x37')],'value':_0x4be517[_0x3115d8[_0x5577('0x3b')]][_0x5577('0x3c')]()});}else if(_0x3115d8[_0x5577('0x35')]==='customVariable'&&_0x3115d8['Variable']&&_0x3115d8[_0x5577('0x3d')]['name']&&_0x3115d8[_0x5577('0x37')]&&_0x3115d8[_0x5577('0x38')]){_0x4be517[_0x3115d8[_0x5577('0x3d')]['name'][_0x5577('0x3e')]()]&&_0x4a49f8['custom_fields'][_0x5577('0x39')]({'id':_0x3115d8[_0x5577('0x37')],'value':_0x4be517[_0x3115d8[_0x5577('0x3d')][_0x5577('0x18')]['toLowerCase']()]['toString']()});}});}return _0x4a49f8;}exports[_0x5577('0x3f')]=function(_0x7d80fd,_0x2c34d4,_0x20ce6a,_0x2b9196,_0x2f6267,_0x585a2c){var _0x36200a,_0x6bf957;_0x585a2c[_0x5577('0x1d')]=intUtil[_0x5577('0x40')](_0x585a2c[_0x5577('0x1d')]);_0x585a2c['serverUrl']=intUtil[_0x5577('0x40')](_0x585a2c[_0x5577('0x41')]);if(_0x2f6267&&_0x2f6267[_0x5577('0x42')]){logger['info'](_0x5577('0x43'),_0x5577('0x44'));_0x2c34d4[_0x5577('0x45')]=util[_0x5577('0x10')](_0x5577('0x46'),_0x585a2c[_0x5577('0x41')],_0x2c34d4['uniqueid'],md5(_0x2c34d4['uniqueid']));}else{_0x2c34d4['recordingURL']='';}headers[_0x5577('0x47')]=getAuth(_0x585a2c);return getUser(_0x585a2c,_0x2b9196[_0x5577('0x26')])[_0x5577('0x1f')](function(_0x2600e2){_0x36200a=_0x2600e2;logger[_0x5577('0xd')](_0x5577('0x48'),_0x36200a['id']);return getEndUser(_0x585a2c,_0x2c34d4[_0x5577('0x12')],_0x2c34d4[_0x5577('0x49')]);})['then'](function(_0x621349){_0x6bf957=_0x621349;logger[_0x5577('0xd')](_0x5577('0x4a'),_0x6bf957['id']);return getTicket(_0x585a2c,_0x36200a,_0x6bf957,_0x20ce6a,_0x2c34d4);})[_0x5577('0x1f')](function(_0x58ae7b){if(_0x58ae7b&&_0x58ae7b['id']){logger['info'](_0x5577('0x20'));logger[_0x5577('0xd')]('The\x20Ticket\x20ID\x20is:',_0x58ae7b['id']);logger[_0x5577('0xd')](_0x5577('0x43'),_0x5577('0x4b'));emit(util[_0x5577('0x10')]('user:%s',_0x2b9196[_0x5577('0x18')]),_0x5577('0x4c'),{'uri':util[_0x5577('0x10')](_0x5577('0x4d'),_0x585a2c[_0x5577('0x1d')],_0x58ae7b['id'])});}})[_0x5577('0x4e')](function(_0x25761f){logger[_0x5577('0x4f')](_0x5577('0x43'),JSON['stringify'](_0x25761f));});};exports['outbound']=function(_0x184c58,_0x202352,_0x24d204,_0xf97339,_0x4ae8a3,_0x5036c2,_0x20d772){var _0x523d32,_0x5b676d;_0x5036c2[_0x5577('0x1d')]=intUtil['stripTrailingSlash'](_0x5036c2[_0x5577('0x1d')]);_0x5036c2['serverUrl']=intUtil[_0x5577('0x40')](_0x5036c2[_0x5577('0x41')]);if(_0x20d772&&_0x20d772['recordingFormat']&&_0x20d772['recordingFormat']!==_0x5577('0x50')){logger[_0x5577('0xd')](_0x5577('0x51'),_0x5577('0x44'));_0x202352[_0x5577('0x45')]=util['format'](_0x5577('0x46'),_0x5036c2[_0x5577('0x41')],_0x202352[_0x5577('0x52')],md5(_0x202352['uniqueid']));}headers[_0x5577('0x47')]=getAuth(_0x5036c2);return getUser(_0x5036c2,_0xf97339['email'])[_0x5577('0x1f')](function(_0x5ab6fc){_0x523d32=_0x5ab6fc;logger[_0x5577('0xd')]('The\x20User\x20ID\x20is:',_0x523d32['id']);return getEndUser(_0x5036c2,_0x202352[_0x5577('0x53')],_0x202352['destcalleridnum']);})[_0x5577('0x1f')](function(_0x1f0795){_0x5b676d=_0x1f0795;logger['info'](_0x5577('0x4a'),_0x5b676d['id']);return getTicket(_0x5036c2,_0x523d32,_0x5b676d,_0x24d204,_0x202352);})[_0x5577('0x1f')](function(_0x474c58){if(_0x474c58&&_0x474c58['id']){logger[_0x5577('0xd')]('Ticket\x20created!');logger[_0x5577('0xd')](_0x5577('0x54'),_0x474c58['id']);logger['info']('[OUTBOUND]',_0x5577('0x4b'));emit(util['format']('user:%s',_0xf97339[_0x5577('0x18')]),'trigger:browser:url',{'uri':util[_0x5577('0x10')](_0x5577('0x4d'),_0x5036c2[_0x5577('0x1d')],_0x474c58['id'])});}})[_0x5577('0x4e')](function(_0x1328ba){logger[_0x5577('0x4f')](_0x5577('0x51'),JSON[_0x5577('0x55')](_0x1328ba));});};exports['unmanaged']=function(_0x8199c,_0x5e50e9,_0x4f613f,_0x440f75,_0x5c3cc7,_0x462ed4){var _0x43e027,_0x3cb611;_0x462ed4[_0x5577('0x1d')]=intUtil[_0x5577('0x40')](_0x462ed4[_0x5577('0x1d')]);_0x462ed4[_0x5577('0x41')]=intUtil[_0x5577('0x40')](_0x462ed4[_0x5577('0x41')]);if(_0x5c3cc7&&_0x5c3cc7['monitor_format']){logger[_0x5577('0xd')]('['+_0x5e50e9['lastevent'][_0x5577('0x56')]()+']',_0x5577('0x44'));_0x5e50e9[_0x5577('0x45')]=util[_0x5577('0x10')](_0x5577('0x46'),_0x462ed4[_0x5577('0x41')],_0x5e50e9[_0x5577('0x52')],md5(_0x5e50e9[_0x5577('0x52')]));}else{_0x5e50e9[_0x5577('0x45')]='';}headers['Authorization']=getAuth(_0x462ed4);return getUser(_0x462ed4,'')[_0x5577('0x1f')](function(_0xe5f75c){_0x43e027=_0xe5f75c;logger['info'](_0x5577('0x48'),_0x43e027['id']);return getEndUser(_0x462ed4,_0x5e50e9['calleridname'],_0x5e50e9[_0x5577('0x49')]);})[_0x5577('0x1f')](function(_0x566f5a){_0x3cb611=_0x566f5a;logger[_0x5577('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3cb611['id']);return getTicket(_0x462ed4,_0x43e027,_0x3cb611,_0x4f613f,_0x5e50e9);})['then'](function(_0x49183d){if(_0x49183d){logger[_0x5577('0xd')]('Ticket\x20created!');logger[_0x5577('0xd')](_0x5577('0x54'),_0x49183d['id']);}})[_0x5577('0x4e')](function(_0x3f3599){logger['error']('['+_0x5e50e9[_0x5577('0x57')]['toUpperCase']()+']',JSON['stringify'](_0x3f3599));});}; \ No newline at end of file +var _0xc454=['toLowerCase','idField','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','recordingFormat','none','recordingURL','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','util','./util','../../../../config/environment','defaults','localhost','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','toString','debug','GET','includes','string','picklist','type','nameField','customField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc454,0x11b));var _0x4c45=function(_0x5935dc,_0x4a5df8){_0x5935dc=_0x5935dc-0x0;var _0x445acb=_0xc454[_0x5935dc];return _0x445acb;};'use strict';var _=require(_0x4c45('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x4c45('0x1'));var Redis=require('ioredis');var intUtil=require(_0x4c45('0x2'));var config=require(_0x4c45('0x3'));var logger=require('../../../../config/logger')('freshdesk');config['redis']=_[_0x4c45('0x4')](config['redis'],{'host':_0x4c45('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c45('0x6')]));var headers={'Content-Type':_0x4c45('0x7'),'Accept':_0x4c45('0x7')};function emit(_0x5b90c1,_0x3bfb03,_0x1ce8ed){io['to'](_0x5b90c1)[_0x4c45('0x8')](_0x3bfb03,_0x1ce8ed);}function getTicket(_0x272bca,_0x376d4c,_0x1ef352,_0x448245,_0x48a2fb){logger[_0x4c45('0x9')](_0x4c45('0xa'));var _0x55b924=_[_0x4c45('0xb')]({'responder_id':_0x376d4c['id'],'requester_id':_0x1ef352['id'],'name':util[_0x4c45('0xc')](_0x4c45('0xd'),_0x48a2fb[_0x4c45('0xe')]),'phone':_0x48a2fb[_0x4c45('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4c45('0x10')](_0x448245[_0x4c45('0x11')],_0x48a2fb,'\x20'),'description':intUtil[_0x4c45('0x10')](_0x448245[_0x4c45('0x12')],_0x48a2fb,'
'),'tags':getTags(_0x448245['Tags'],_0x4c45('0x13'))},getCustomFields(_0x448245[_0x4c45('0x14')],_0x48a2fb));_0x55b924[_0x4c45('0x15')]=_[_0x4c45('0x16')](_[_0x4c45('0x17')](_0x55b924[_0x4c45('0x15')],'id'),_0x4c45('0x18'));return request({'uri':util[_0x4c45('0xc')](_0x4c45('0x19'),_0x272bca['remoteUri']),'method':_0x4c45('0x1a'),'body':_0x55b924})['then'](function(_0x5258d7){logger[_0x4c45('0x9')](_0x4c45('0x1b'));return _0x5258d7;});}function getUser(_0x4f87be,_0x2f0d78){if(intUtil[_0x4c45('0x1c')](_0x2f0d78)){return request({'uri':util[_0x4c45('0xc')](_0x4c45('0x1d'),_0x4f87be[_0x4c45('0x1e')]),'qs':{'email':_0x2f0d78}})[_0x4c45('0x1f')](function(_0x388320){if(_0x388320[_0x4c45('0x20')]){logger[_0x4c45('0x9')](_0x4c45('0x21'));return _['find'](_0x388320,function(_0x4ea2b0){return _0x4ea2b0[_0x4c45('0x22')][_0x4c45('0x23')]===_0x2f0d78;});}else{logger[_0x4c45('0x9')](_0x4c45('0x24'));return request({'uri':util[_0x4c45('0xc')](_0x4c45('0x25'),_0x4f87be[_0x4c45('0x1e')])})[_0x4c45('0x1f')](function(_0x497441){logger['info'](_0x4c45('0x26'));return _0x497441;});}});}else{logger[_0x4c45('0x9')](_0x4c45('0x27'));return request({'uri':util[_0x4c45('0xc')](_0x4c45('0x25'),_0x4f87be[_0x4c45('0x1e')])})[_0x4c45('0x1f')](function(_0x50a924){logger[_0x4c45('0x9')](_0x4c45('0x26'));return _0x50a924;});}}function getEndUser(_0x3c68e9,_0x2cca4f,_0x38b390){logger['info'](_0x4c45('0x28'),_0x38b390);return request({'uri':util[_0x4c45('0xc')]('%s/api/v2/contacts',_0x3c68e9[_0x4c45('0x1e')]),'qs':{'phone':_0x38b390}})[_0x4c45('0x1f')](function(_0x34124f){if(_0x34124f[_0x4c45('0x20')]){logger[_0x4c45('0x9')](_0x4c45('0x29'));return _['find'](_0x34124f,{'phone':_0x38b390});}else{logger['info'](_0x4c45('0x2a'));return request({'uri':util[_0x4c45('0xc')]('%s/api/v2/contacts',_0x3c68e9[_0x4c45('0x1e')]),'method':_0x4c45('0x1a'),'body':{'name':_0x2cca4f,'phone':_0x38b390}})[_0x4c45('0x1f')](function(_0xe143b9){logger[_0x4c45('0x9')]('Enduser\x20created.');return _0xe143b9;});}});}function getAuth(_0x4e4109){return util[_0x4c45('0xc')](_0x4c45('0x2b'),new Buffer(_0x4e4109['apiKey']+':X')[_0x4c45('0x2c')]('base64'));}function request(_0x418aed){logger[_0x4c45('0x2d')]('[HTTP]',JSON['stringify'](_0x418aed));return rp(_[_0x4c45('0x4')](_0x418aed,{'method':_0x4c45('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x1935de,_0x258a46){var _0xc771e7=[];if(_0x1935de&&_0x1935de[_0x4c45('0x20')]>0x0){_0xc771e7=_['map'](_0x1935de,_0x258a46);}return _0xc771e7;}function getCustomFields(_0x28fd98,_0x53eea3){var _0x551ebd=[];var _0x128c25={'custom_fields':[]};if(_0x28fd98[_0x4c45('0x20')]>0x0){_['forEach'](_0x28fd98,function(_0x5ad11e){if(_[_0x4c45('0x2f')]([_0x4c45('0x30'),_0x4c45('0x31')],_0x5ad11e[_0x4c45('0x32')])&&_0x5ad11e[_0x4c45('0x33')]&&!_0x5ad11e[_0x4c45('0x34')]){_0x128c25[_0x5ad11e['nameField'][_0x4c45('0x35')]()]=_0x5ad11e['content'][_0x4c45('0x2c')]();}else if(_[_0x4c45('0x2f')]([_0x4c45('0x30'),_0x4c45('0x31')],_0x5ad11e['type'])&&_0x5ad11e[_0x4c45('0x36')]&&_0x5ad11e[_0x4c45('0x34')]){_0x128c25[_0x4c45('0x15')]['push']({'id':_0x5ad11e[_0x4c45('0x36')],'value':_0x5ad11e['content'][_0x4c45('0x2c')]()});}else if(_0x5ad11e[_0x4c45('0x32')]==='variable'&&_0x5ad11e[_0x4c45('0x37')]&&_0x5ad11e[_0x4c45('0x36')]&&_0x5ad11e[_0x4c45('0x34')]){_0x53eea3[_0x5ad11e[_0x4c45('0x37')]]&&_0x128c25[_0x4c45('0x15')][_0x4c45('0x38')]({'id':_0x5ad11e[_0x4c45('0x36')],'value':_0x53eea3[_0x5ad11e[_0x4c45('0x37')]][_0x4c45('0x2c')]()});}else if(_0x5ad11e[_0x4c45('0x32')]===_0x4c45('0x39')&&_0x5ad11e[_0x4c45('0x3a')]&&_0x5ad11e[_0x4c45('0x3a')]['name']&&_0x5ad11e[_0x4c45('0x36')]&&_0x5ad11e[_0x4c45('0x34')]){_0x53eea3[_0x5ad11e[_0x4c45('0x3a')][_0x4c45('0x13')][_0x4c45('0x35')]()]&&_0x128c25['custom_fields'][_0x4c45('0x38')]({'id':_0x5ad11e['idField'],'value':_0x53eea3[_0x5ad11e[_0x4c45('0x3a')][_0x4c45('0x13')]['toLowerCase']()][_0x4c45('0x2c')]()});}});}return _0x128c25;}exports[_0x4c45('0x3b')]=function(_0x398953,_0x333c38,_0x3f31a4,_0x38136d,_0x2cfd9b,_0x2b15ed){var _0x47901b,_0x2482db;_0x2b15ed[_0x4c45('0x1e')]=intUtil[_0x4c45('0x3c')](_0x2b15ed[_0x4c45('0x1e')]);_0x2b15ed[_0x4c45('0x3d')]=intUtil[_0x4c45('0x3c')](_0x2b15ed['serverUrl']);if(_0x2cfd9b&&_0x2cfd9b[_0x4c45('0x3e')]){logger['info'](_0x4c45('0x3f'),'Recording\x20is\x20enabled!');_0x333c38['recordingURL']=util[_0x4c45('0xc')](_0x4c45('0x40'),_0x2b15ed[_0x4c45('0x3d')],_0x333c38[_0x4c45('0x41')],md5(_0x333c38[_0x4c45('0x41')]));}else{_0x333c38['recordingURL']='';}headers[_0x4c45('0x42')]=getAuth(_0x2b15ed);return getUser(_0x2b15ed,_0x38136d['email'])[_0x4c45('0x1f')](function(_0x456365){_0x47901b=_0x456365;logger[_0x4c45('0x9')](_0x4c45('0x43'),_0x47901b['id']);return getEndUser(_0x2b15ed,_0x333c38['calleridname'],_0x333c38['calleridnum']);})['then'](function(_0x1ca82c){_0x2482db=_0x1ca82c;logger[_0x4c45('0x9')](_0x4c45('0x44'),_0x2482db['id']);return getTicket(_0x2b15ed,_0x47901b,_0x2482db,_0x3f31a4,_0x333c38);})[_0x4c45('0x1f')](function(_0x23c5ab){if(_0x23c5ab&&_0x23c5ab['id']){logger[_0x4c45('0x9')](_0x4c45('0x1b'));logger['info'](_0x4c45('0x45'),_0x23c5ab['id']);logger[_0x4c45('0x9')](_0x4c45('0x3f'),_0x4c45('0x46'));emit(util[_0x4c45('0xc')]('user:%s',_0x38136d[_0x4c45('0x13')]),'trigger:browser:url',{'uri':util[_0x4c45('0xc')]('%s/helpdesk/tickets/%d',_0x2b15ed[_0x4c45('0x1e')],_0x23c5ab['id'])});}})[_0x4c45('0x47')](function(_0x1afbbb){logger['error']('[QUEUE]',JSON['stringify'](_0x1afbbb));});};exports['outbound']=function(_0x347846,_0x37894f,_0x41fdb7,_0x13cf00,_0x430c73,_0x3b4d0a,_0x1ca11b){var _0x35374e,_0x151534;_0x3b4d0a[_0x4c45('0x1e')]=intUtil[_0x4c45('0x3c')](_0x3b4d0a[_0x4c45('0x1e')]);_0x3b4d0a[_0x4c45('0x3d')]=intUtil[_0x4c45('0x3c')](_0x3b4d0a[_0x4c45('0x3d')]);if(_0x1ca11b&&_0x1ca11b['recordingFormat']&&_0x1ca11b[_0x4c45('0x48')]!==_0x4c45('0x49')){logger[_0x4c45('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x37894f[_0x4c45('0x4a')]=util['format'](_0x4c45('0x40'),_0x3b4d0a[_0x4c45('0x3d')],_0x37894f[_0x4c45('0x41')],md5(_0x37894f[_0x4c45('0x41')]));}headers[_0x4c45('0x42')]=getAuth(_0x3b4d0a);return getUser(_0x3b4d0a,_0x13cf00[_0x4c45('0x23')])[_0x4c45('0x1f')](function(_0x39328e){_0x35374e=_0x39328e;logger[_0x4c45('0x9')](_0x4c45('0x43'),_0x35374e['id']);return getEndUser(_0x3b4d0a,_0x37894f[_0x4c45('0x4b')],_0x37894f[_0x4c45('0x4c')]);})[_0x4c45('0x1f')](function(_0x387de3){_0x151534=_0x387de3;logger[_0x4c45('0x9')](_0x4c45('0x44'),_0x151534['id']);return getTicket(_0x3b4d0a,_0x35374e,_0x151534,_0x41fdb7,_0x37894f);})[_0x4c45('0x1f')](function(_0x44d037){if(_0x44d037&&_0x44d037['id']){logger[_0x4c45('0x9')](_0x4c45('0x1b'));logger[_0x4c45('0x9')](_0x4c45('0x45'),_0x44d037['id']);logger['info'](_0x4c45('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4c45('0xc')](_0x4c45('0x4e'),_0x13cf00[_0x4c45('0x13')]),_0x4c45('0x4f'),{'uri':util['format'](_0x4c45('0x50'),_0x3b4d0a[_0x4c45('0x1e')],_0x44d037['id'])});}})[_0x4c45('0x47')](function(_0x427726){logger['error'](_0x4c45('0x4d'),JSON['stringify'](_0x427726));});};exports['unmanaged']=function(_0x56567b,_0x2e8dab,_0x58cba3,_0xfdc3ae,_0x1427ac,_0x347a8f){var _0x54cba1,_0xa45053;_0x347a8f[_0x4c45('0x1e')]=intUtil[_0x4c45('0x3c')](_0x347a8f[_0x4c45('0x1e')]);_0x347a8f[_0x4c45('0x3d')]=intUtil[_0x4c45('0x3c')](_0x347a8f[_0x4c45('0x3d')]);if(_0x1427ac&&_0x1427ac['monitor_format']){logger['info']('['+_0x2e8dab[_0x4c45('0x51')][_0x4c45('0x52')]()+']',_0x4c45('0x53'));_0x2e8dab[_0x4c45('0x4a')]=util[_0x4c45('0xc')](_0x4c45('0x40'),_0x347a8f[_0x4c45('0x3d')],_0x2e8dab[_0x4c45('0x41')],md5(_0x2e8dab[_0x4c45('0x41')]));}else{_0x2e8dab['recordingURL']='';}headers[_0x4c45('0x42')]=getAuth(_0x347a8f);return getUser(_0x347a8f,'')[_0x4c45('0x1f')](function(_0x146bfd){_0x54cba1=_0x146bfd;logger[_0x4c45('0x9')](_0x4c45('0x43'),_0x54cba1['id']);return getEndUser(_0x347a8f,_0x2e8dab['calleridname'],_0x2e8dab['calleridnum']);})['then'](function(_0x2e7a26){_0xa45053=_0x2e7a26;logger[_0x4c45('0x9')](_0x4c45('0x44'),_0xa45053['id']);return getTicket(_0x347a8f,_0x54cba1,_0xa45053,_0x58cba3,_0x2e8dab);})[_0x4c45('0x1f')](function(_0x4fc881){if(_0x4fc881){logger[_0x4c45('0x9')](_0x4c45('0x1b'));logger[_0x4c45('0x9')](_0x4c45('0x45'),_0x4fc881['id']);}})[_0x4c45('0x47')](function(_0x5f0565){logger['error']('['+_0x2e8dab[_0x4c45('0x51')][_0x4c45('0x52')]()+']',JSON['stringify'](_0x5f0565));});}; \ 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 0dd16ab..e4ceac2 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 _0x8228=['Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&entities=contact','find','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Subjects','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format'];(function(_0x478455,_0xfab4ff){var _0x5062dd=function(_0x5d4aca){while(--_0x5d4aca){_0x478455['push'](_0x478455['shift']());}};_0x5062dd(++_0xfab4ff);}(_0x8228,0x1ed));var _0x8822=function(_0x140f9c,_0x3b7b87){_0x140f9c=_0x140f9c-0x0;var _0x1ccb77=_0x8228[_0x140f9c];return _0x1ccb77;};'use strict';var _=require(_0x8822('0x0'));var rp=require('request-promise');var md5=require(_0x8822('0x1'));var util=require(_0x8822('0x2'));var moment=require('moment');var Promise=require(_0x8822('0x3'));var Redis=require(_0x8822('0x4'));var intUtil=require('./util');var config=require(_0x8822('0x5'));var logger=require(_0x8822('0x6'))('freshsales');config[_0x8822('0x7')]=_[_0x8822('0x8')](config[_0x8822('0x7')],{'host':_0x8822('0x9'),'port':0x18eb});var io=require(_0x8822('0xa'))(new Redis(config[_0x8822('0x7')]));function getAdminId(_0x3eb33a,_0x134a7f,_0x24e9b2,_0x5e3da2){return new Promise(function(_0x30d5d0,_0x11b449){var _0x140a6f=![];var _0xb3a7fe={'method':_0x8822('0xb'),'uri':_0x5e3da2+_0x8822('0xc'),'json':!![]};_0xb3a7fe[_0x8822('0xd')]=_0x24e9b2;logger[_0x8822('0xe')](_0x8822('0xf'));return rp(_0xb3a7fe)[_0x8822('0x10')](function(_0x5ee0a2){if(_0x5ee0a2){var _0x1badc7=_0x5ee0a2[_0x8822('0x11')];var _0x3890e2=null;for(_0x3890e2=0x0;_0x3890e2<_0x1badc7[_0x8822('0x12')];_0x3890e2++){if(_0x1badc7[_0x3890e2][_0x8822('0x13')]===_0x3eb33a[_0x8822('0x14')]){_0x3eb33a[_0x8822('0x15')]=_0x1badc7[_0x3890e2]['id'];_0x140a6f=!![];}}if(_0x140a6f){logger[_0x8822('0xe')](_0x8822('0x16'),_0x3eb33a[_0x8822('0x15')]);_0x30d5d0(_0x3eb33a);}else{_0x11b449({'statusCode':0x194,'message':_0x8822('0x17')});}}else{_0x11b449({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x8822('0x18')](function(_0x34b417){logger[_0x8822('0x19')]('['+[_0x134a7f[_0x8822('0x1a')]()]+']',_0x34b417[_0x8822('0x1b')]);_0x11b449(_0x34b417);});});}function getUser(_0x154a88,_0x48e9b8,_0x2fb820){return function(_0x2d2a4c){return new Promise(function(_0x5c193f,_0x55c92d){var _0x26de9c={'method':_0x8822('0xb'),'uri':_0x2fb820+'/api/selector/owners','json':!![]};_0x26de9c[_0x8822('0xd')]=_0x48e9b8;logger[_0x8822('0xe')](_0x8822('0x1c'));return rp(_0x26de9c)[_0x8822('0x10')](function(_0x32a034){if(_0x32a034){var _0xc63112=_0x32a034[_0x8822('0x11')];var _0x11de1d=![];var _0x333fe9=null;if(_0x2d2a4c['agentEmail']!==null){logger[_0x8822('0xe')](_0x8822('0x1d'),_0x2d2a4c[_0x8822('0x1e')]);_0x2d2a4c[_0x8822('0x1f')]=_0x2d2a4c[_0x8822('0x1e')];for(_0x333fe9=0x0;_0x333fe9<_0xc63112[_0x8822('0x12')];_0x333fe9++){if(_0xc63112[_0x333fe9][_0x8822('0x13')]===_0x2d2a4c[_0x8822('0x1e')]){_0x11de1d=!![];_0x2d2a4c[_0x8822('0x20')]=_0xc63112[_0x333fe9]['id'];logger['info'](_0x8822('0x21'),_0x2d2a4c[_0x8822('0x20')]);}}}if(!_0x11de1d){logger[_0x8822('0xe')](_0x8822('0x22'));_0x2d2a4c[_0x8822('0x1f')]=_0x2d2a4c[_0x8822('0x14')];_0x2d2a4c[_0x8822('0x20')]=_0x2d2a4c['adminId'];_0x11de1d=!![];}if(_0x11de1d){_0x5c193f(_0x2d2a4c);}else{_0x55c92d({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x55c92d({'statusCode':0x194,'message':_0x8822('0x17')});}})[_0x8822('0x18')](function(_0x5f0943){logger[_0x8822('0x19')]('['+[_0x154a88[_0x8822('0x1a')]()]+']',_0x5f0943[_0x8822('0x1b')]);_0x55c92d(_0x5f0943);});});};}function searchContact(_0x517e33,_0x2b9029,_0x24cb93,_0x7b1b18){return new Promise(function(_0x3ffbd7,_0x3d1d04){var _0x21c10a={'method':_0x8822('0xb'),'headers':_0x2b9029,'uri':_0x517e33+_0x8822('0x23')+_0x7b1b18+'&f='+_0x24cb93+_0x8822('0x24'),'json':!![]};rp(_0x21c10a)[_0x8822('0x10')](function(_0x5d9dbb){var _0x40f1de=_[_0x8822('0x25')](_0x5d9dbb['contacts']['contacts'],[_0x24cb93,_0x7b1b18]);_0x3ffbd7(_0x40f1de);})[_0x8822('0x18')](function(_0x1ff224){_0x3d1d04(_0x1ff224);});});}function getEndUser(_0x31eb0d,_0x5b8f35,_0x383d1d){return function(_0x1b77fe){return new Promise(function(_0x56b742,_0x3e713c){logger['info'](util['format'](_0x8822('0x26'),_0x1b77fe[_0x8822('0x27')]));searchContact(_0x383d1d,_0x5b8f35,_0x8822('0x28'),_0x1b77fe[_0x8822('0x27')])[_0x8822('0x10')](function(_0x34c41a){if(_0x34c41a){_0x1b77fe[_0x8822('0x29')]=_0x34c41a['id'];logger[_0x8822('0xe')](_0x8822('0x2a'),_0x1b77fe[_0x8822('0x29')]);return _0x56b742(_0x1b77fe);}searchContact(_0x383d1d,_0x5b8f35,_0x8822('0x2b'),_0x1b77fe[_0x8822('0x27')])[_0x8822('0x10')](function(_0x1e4750){if(_0x1e4750){_0x1b77fe['endUserId']=_0x1e4750['id'];logger[_0x8822('0xe')]('Contact\x20found\x20work_number:',_0x1b77fe[_0x8822('0x29')]);return _0x56b742(_0x1b77fe);}createEndUser(_0x1b77fe,_0x31eb0d,_0x5b8f35,_0x383d1d)[_0x8822('0x10')](function(_0x3c3934){logger['info'](_0x8822('0x2c'),_0x3c3934[_0x8822('0x29')]);return _0x56b742(_0x3c3934);});});})[_0x8822('0x18')](function(_0x519cb6){_0x3e713c(_0x519cb6);});});};}function createEndUser(_0x1cfaf4,_0x5b019d,_0x43319a,_0x430673){return new Promise(function(_0x31cecf,_0x318c72){var _0x331b41=moment();var _0x518a57={'method':_0x8822('0x2d'),'uri':_0x430673+'/api/contacts','body':{'contact':{'last_name':_0x1cfaf4[_0x8822('0x27')],'work_number':_0x1cfaf4[_0x8822('0x27')],'mobile_number':_0x1cfaf4[_0x8822('0x27')],'owner_id':_0x1cfaf4[_0x8822('0x20')],'created_at':_0x331b41[_0x8822('0x2e')](_0x8822('0x2f'))}},'json':!![]};_0x518a57[_0x8822('0xd')]=_0x43319a;logger[_0x8822('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x518a57)[_0x8822('0x10')](function(_0x3283fa){_0x1cfaf4[_0x8822('0x29')]=_0x3283fa[_0x8822('0x30')]['id'];_0x31cecf(_0x1cfaf4);})[_0x8822('0x18')](function(_0x558f47){logger['error']('['+[_0x5b019d[_0x8822('0x1a')]()]+']',_0x558f47['message']);_0x318c72(_0x558f47['message']);});});}function getTicket(_0xdd98a5,_0x562fe7,_0x3d308f,_0x102d6c,_0x566e2b){return function(_0xa304dd){logger[_0x8822('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x1328b8,_0x54e1d8){var _0xcbfc8a=moment();var _0x5ab437={'method':_0x8822('0x2d'),'uri':_0x3d308f+_0x8822('0x31'),'body':{'title':intUtil[_0x8822('0x32')](_0x102d6c[_0x8822('0x33')],_0x566e2b,'\x20'),'description':intUtil[_0x8822('0x32')](_0x102d6c[_0x8822('0x34')],_0x566e2b,'\x0a'),'owner_id':_0xa304dd['userId'],'creater_id':_0xa304dd[_0x8822('0x15')],'targetable_id':_0xa304dd[_0x8822('0x29')],'targetable_type':'Contact','created_at':_0xcbfc8a['format'](_0x8822('0x2f')),'due_date':_0xcbfc8a['add'](0x1e,'m')[_0x8822('0x2e')](_0x8822('0x2f'))},'json':!![]};_0x5ab437['headers']=_0x562fe7;return rp(_0x5ab437)[_0x8822('0x10')](function(_0x192cf2){_0xa304dd[_0x8822('0x35')]=_0x192cf2[_0x8822('0x36')]['id'];logger[_0x8822('0xe')](_0x8822('0x37'),_0xa304dd[_0x8822('0x35')]);_0x1328b8(_0xa304dd);})[_0x8822('0x18')](function(_0x568423){logger[_0x8822('0x19')]('['+[_0xdd98a5[_0x8822('0x1a')]()]+']',_0x568423['message']);_0x54e1d8(_0x568423[_0x8822('0x1b')]);});});};}function emit(_0x3cccee,_0xcb238,_0x220295){var _0x30dfac={'uri':_0x3cccee+_0x8822('0x38')+_0x220295};io['to'](util[_0x8822('0x2e')](_0x8822('0x39'),_0xcb238))[_0x8822('0x3a')](_0x8822('0x3b'),_0x30dfac);}exports['cs']=function(_0x8991eb,_0x38189d,_0x4760fc,_0x413cf2,_0x3343ad,_0x356dac,_0x5b8570,_0x4d31f9){var _0x583694={};var _0x3c621a={'Authorization':_0x8822('0x3c')+_0x356dac[_0x8822('0x3d')]};_0x356dac[_0x8822('0x3e')]=intUtil['stripTrailingSlash'](_0x356dac[_0x8822('0x3e')]);_0x356dac[_0x8822('0x3f')]=intUtil[_0x8822('0x40')](_0x356dac[_0x8822('0x3f')]);var _0x32405a=_0x356dac['remoteUri'];_0x583694[_0x8822('0x14')]=_0x356dac[_0x8822('0x41')];_0x583694['contactNumber']=_0x4d31f9[_0x8822('0x42')]()===_0x8822('0x43')?_0x38189d[_0x8822('0x44')]:_0x38189d['calleridnum'];_0x583694[_0x8822('0x45')]=_0x4d31f9==='queue'||_0x4d31f9==='unmanaged'?_0x8822('0x46'):'outbound';if(_0x413cf2){_0x583694['agentEmail']=_0x413cf2[_0x8822('0x13')];}var _0x298208=util['format'](_0x8822('0x47'),_0x356dac['serverUrl'],_0x38189d['uniqueid'],md5(_0x38189d[_0x8822('0x48')]));if(_0x3343ad&&_0x3343ad[_0x8822('0x49')]){logger[_0x8822('0xe')]('[QUEUE]',_0x8822('0x4a'));_0x38189d[_0x8822('0x4b')]=_0x298208;}else if(_0x5b8570&&_0x5b8570['recordingFormat']&&_0x5b8570['recordingFormat']!==_0x8822('0x4c')){logger[_0x8822('0xe')](_0x8822('0x4d'),'Recording\x20is\x20enabled!');_0x38189d[_0x8822('0x4b')]=_0x298208;}else{_0x38189d[_0x8822('0x4b')]='';}return getAdminId(_0x583694,_0x4d31f9,_0x3c621a,_0x32405a)['then'](getUser(_0x4d31f9,_0x3c621a,_0x32405a))[_0x8822('0x10')](getEndUser(_0x4d31f9,_0x3c621a,_0x32405a))[_0x8822('0x10')](getTicket(_0x4d31f9,_0x3c621a,_0x32405a,_0x4760fc,_0x38189d))[_0x8822('0x10')](function(_0x9e40d){logger[_0x8822('0xe')](util[_0x8822('0x2e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x9e40d[_0x8822('0x35')]));if(_0x4d31f9!=='unmanaged'){logger[_0x8822('0xe')]('['+[_0x4d31f9['toUpperCase']()]+']',_0x8822('0x4e'));emit(_0x32405a,_0x413cf2['name'],_0x9e40d[_0x8822('0x29')]);}})['catch'](function(_0x3a2f2e){logger['error']('['+[_0x4d31f9[_0x8822('0x1a')]()]+_0x8822('0x4f'),util[_0x8822('0x50')](_0x3a2f2e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xaf54=['info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','users','email','adminEmail'];(function(_0x35131a,_0x1e552e){var _0xa304a2=function(_0x4f55d4){while(--_0x4f55d4){_0x35131a['push'](_0x35131a['shift']());}};_0xa304a2(++_0x1e552e);}(_0xaf54,0xf0));var _0x4af5=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0xaf54[_0x254b22];return _0x1279db;};'use strict';var _=require(_0x4af5('0x0'));var rp=require(_0x4af5('0x1'));var md5=require(_0x4af5('0x2'));var util=require(_0x4af5('0x3'));var moment=require(_0x4af5('0x4'));var Promise=require(_0x4af5('0x5'));var Redis=require(_0x4af5('0x6'));var intUtil=require('./util');var config=require(_0x4af5('0x7'));var logger=require(_0x4af5('0x8'))('freshsales');config[_0x4af5('0x9')]=_[_0x4af5('0xa')](config[_0x4af5('0x9')],{'host':_0x4af5('0xb'),'port':0x18eb});var io=require(_0x4af5('0xc'))(new Redis(config[_0x4af5('0x9')]));function getAdminId(_0xf5b94d,_0x3e4cae,_0x3025c8,_0x214fcb){return new Promise(function(_0xa0ef9c,_0x3655fb){var _0x429c30=![];var _0x157d50={'method':_0x4af5('0xd'),'uri':_0x214fcb+_0x4af5('0xe'),'json':!![]};_0x157d50['headers']=_0x3025c8;logger['info']('Getting\x20admin\x20information');return rp(_0x157d50)['then'](function(_0x11d540){if(_0x11d540){var _0x34ec76=_0x11d540[_0x4af5('0xf')];var _0x4933bf=null;for(_0x4933bf=0x0;_0x4933bf<_0x34ec76['length'];_0x4933bf++){if(_0x34ec76[_0x4933bf][_0x4af5('0x10')]===_0xf5b94d[_0x4af5('0x11')]){_0xf5b94d['adminId']=_0x34ec76[_0x4933bf]['id'];_0x429c30=!![];}}if(_0x429c30){logger[_0x4af5('0x12')](_0x4af5('0x13'),_0xf5b94d[_0x4af5('0x14')]);_0xa0ef9c(_0xf5b94d);}else{_0x3655fb({'statusCode':0x194,'message':_0x4af5('0x15')});}}else{_0x3655fb({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4af5('0x16')](function(_0x499149){logger[_0x4af5('0x17')]('['+[_0x3e4cae[_0x4af5('0x18')]()]+']',_0x499149[_0x4af5('0x19')]);_0x3655fb(_0x499149);});});}function getUser(_0x4dc00c,_0x3a4000,_0x9b270b){return function(_0x459cda){return new Promise(function(_0x1db62c,_0x369b76){var _0x5d1690={'method':_0x4af5('0xd'),'uri':_0x9b270b+_0x4af5('0xe'),'json':!![]};_0x5d1690[_0x4af5('0x1a')]=_0x3a4000;logger[_0x4af5('0x12')](_0x4af5('0x1b'));return rp(_0x5d1690)[_0x4af5('0x1c')](function(_0x4f6508){if(_0x4f6508){var _0x1ad234=_0x4f6508['users'];var _0x32e41d=![];var _0x1e18fd=null;if(_0x459cda[_0x4af5('0x1d')]!==null){logger[_0x4af5('0x12')](_0x4af5('0x1e'),_0x459cda['agentEmail']);_0x459cda[_0x4af5('0x1f')]=_0x459cda['agentEmail'];for(_0x1e18fd=0x0;_0x1e18fd<_0x1ad234[_0x4af5('0x20')];_0x1e18fd++){if(_0x1ad234[_0x1e18fd][_0x4af5('0x10')]===_0x459cda[_0x4af5('0x1d')]){_0x32e41d=!![];_0x459cda[_0x4af5('0x21')]=_0x1ad234[_0x1e18fd]['id'];logger[_0x4af5('0x12')](_0x4af5('0x22'),_0x459cda[_0x4af5('0x21')]);}}}if(!_0x32e41d){logger[_0x4af5('0x12')](_0x4af5('0x23'));_0x459cda['userEmail']=_0x459cda['adminEmail'];_0x459cda['userId']=_0x459cda['adminId'];_0x32e41d=!![];}if(_0x32e41d){_0x1db62c(_0x459cda);}else{_0x369b76({'statusCode':0x194,'message':_0x4af5('0x15')});}}else{_0x369b76({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x4af5('0x16')](function(_0x6c7942){logger[_0x4af5('0x17')]('['+[_0x4dc00c[_0x4af5('0x18')]()]+']',_0x6c7942[_0x4af5('0x19')]);_0x369b76(_0x6c7942);});});};}function searchContact(_0x590655,_0x3ae26f,_0x3013e4,_0x3eef5c){return new Promise(function(_0x1acebd,_0x329a01){var _0x4e4229={'method':_0x4af5('0xd'),'headers':_0x3ae26f,'uri':_0x590655+_0x4af5('0x24')+_0x3eef5c+_0x4af5('0x25')+_0x3013e4+_0x4af5('0x26'),'json':!![]};rp(_0x4e4229)[_0x4af5('0x1c')](function(_0x44526c){var _0x257f00=_[_0x4af5('0x27')](_0x44526c[_0x4af5('0x28')][_0x4af5('0x28')],[_0x3013e4,_0x3eef5c]);_0x1acebd(_0x257f00);})[_0x4af5('0x16')](function(_0x50feab){_0x329a01(_0x50feab);});});}function getEndUser(_0x52c2be,_0x1efce9,_0x59e0a0){return function(_0x25299d){return new Promise(function(_0x35c5ef,_0x11a97f){logger[_0x4af5('0x12')](util[_0x4af5('0x29')]('Searching\x20contact\x20with\x20phone\x20%s',_0x25299d[_0x4af5('0x2a')]));searchContact(_0x59e0a0,_0x1efce9,_0x4af5('0x2b'),_0x25299d[_0x4af5('0x2a')])['then'](function(_0x249471){if(_0x249471){_0x25299d[_0x4af5('0x2c')]=_0x249471['id'];logger[_0x4af5('0x12')](_0x4af5('0x2d'),_0x25299d['endUserId']);return _0x35c5ef(_0x25299d);}searchContact(_0x59e0a0,_0x1efce9,_0x4af5('0x2e'),_0x25299d['contactNumber'])[_0x4af5('0x1c')](function(_0x38cc3d){if(_0x38cc3d){_0x25299d[_0x4af5('0x2c')]=_0x38cc3d['id'];logger['info']('Contact\x20found\x20work_number:',_0x25299d[_0x4af5('0x2c')]);return _0x35c5ef(_0x25299d);}createEndUser(_0x25299d,_0x52c2be,_0x1efce9,_0x59e0a0)[_0x4af5('0x1c')](function(_0x23e92a){logger[_0x4af5('0x12')](_0x4af5('0x2f'),_0x23e92a['endUserId']);return _0x35c5ef(_0x23e92a);});});})['catch'](function(_0x1692ba){_0x11a97f(_0x1692ba);});});};}function createEndUser(_0xead6f9,_0xd28f27,_0x3ea106,_0x37f93d){return new Promise(function(_0xde633,_0x2243c1){var _0x368b59=moment();var _0x3cdb9f={'method':_0x4af5('0x30'),'uri':_0x37f93d+_0x4af5('0x31'),'body':{'contact':{'last_name':_0xead6f9['contactNumber'],'work_number':_0xead6f9['contactNumber'],'mobile_number':_0xead6f9[_0x4af5('0x2a')],'owner_id':_0xead6f9[_0x4af5('0x21')],'created_at':_0x368b59[_0x4af5('0x29')](_0x4af5('0x32'))}},'json':!![]};_0x3cdb9f[_0x4af5('0x1a')]=_0x3ea106;logger[_0x4af5('0x12')](_0x4af5('0x33'));return rp(_0x3cdb9f)[_0x4af5('0x1c')](function(_0xe340af){_0xead6f9[_0x4af5('0x2c')]=_0xe340af[_0x4af5('0x34')]['id'];_0xde633(_0xead6f9);})[_0x4af5('0x16')](function(_0x43a26e){logger[_0x4af5('0x17')]('['+[_0xd28f27[_0x4af5('0x18')]()]+']',_0x43a26e[_0x4af5('0x19')]);_0x2243c1(_0x43a26e[_0x4af5('0x19')]);});});}function getTicket(_0x4b4bf9,_0x133a74,_0x362fca,_0x551c49,_0x300884){return function(_0x1c5159){logger[_0x4af5('0x12')](_0x4af5('0x35'));return new Promise(function(_0x189ffb,_0x5b16a7){var _0xf8f9a7=moment();var _0x9f94fd={'method':_0x4af5('0x30'),'uri':_0x362fca+_0x4af5('0x36'),'body':{'title':intUtil[_0x4af5('0x37')](_0x551c49[_0x4af5('0x38')],_0x300884,'\x20'),'description':intUtil[_0x4af5('0x37')](_0x551c49[_0x4af5('0x39')],_0x300884,'\x0a'),'owner_id':_0x1c5159['userId'],'creater_id':_0x1c5159[_0x4af5('0x14')],'targetable_id':_0x1c5159['endUserId'],'targetable_type':_0x4af5('0x3a'),'created_at':_0xf8f9a7[_0x4af5('0x29')](_0x4af5('0x32')),'due_date':_0xf8f9a7[_0x4af5('0x3b')](0x1e,'m')['format'](_0x4af5('0x32'))},'json':!![]};_0x9f94fd[_0x4af5('0x1a')]=_0x133a74;return rp(_0x9f94fd)[_0x4af5('0x1c')](function(_0x25c17f){_0x1c5159[_0x4af5('0x3c')]=_0x25c17f['task']['id'];logger['info'](_0x4af5('0x3d'),_0x1c5159[_0x4af5('0x3c')]);_0x189ffb(_0x1c5159);})['catch'](function(_0x2b85db){logger[_0x4af5('0x17')]('['+[_0x4b4bf9['toUpperCase']()]+']',_0x2b85db[_0x4af5('0x19')]);_0x5b16a7(_0x2b85db['message']);});});};}function emit(_0x494927,_0x534b0d,_0x2d78b5){var _0x4dd404={'uri':_0x494927+_0x4af5('0x3e')+_0x2d78b5};io['to'](util[_0x4af5('0x29')](_0x4af5('0x3f'),_0x534b0d))[_0x4af5('0x40')](_0x4af5('0x41'),_0x4dd404);}exports['cs']=function(_0x451bb1,_0x2cb1bf,_0x40f39b,_0xa05d1e,_0x3baa97,_0x182393,_0x3fd86e,_0x5e7693){var _0x319860={};var _0x2d8a68={'Authorization':_0x4af5('0x42')+_0x182393[_0x4af5('0x43')]};_0x182393[_0x4af5('0x44')]=intUtil[_0x4af5('0x45')](_0x182393[_0x4af5('0x44')]);_0x182393[_0x4af5('0x46')]=intUtil[_0x4af5('0x45')](_0x182393[_0x4af5('0x46')]);var _0x44923b=_0x182393[_0x4af5('0x44')];_0x319860[_0x4af5('0x11')]=_0x182393['username'];_0x319860[_0x4af5('0x2a')]=_0x5e7693['toLowerCase']()==='outbound'?_0x2cb1bf[_0x4af5('0x47')]:_0x2cb1bf[_0x4af5('0x48')];_0x319860[_0x4af5('0x49')]=_0x5e7693===_0x4af5('0x4a')||_0x5e7693===_0x4af5('0x4b')?_0x4af5('0x4a'):_0x4af5('0x4c');if(_0xa05d1e){_0x319860['agentEmail']=_0xa05d1e[_0x4af5('0x10')];}var _0x2eaf5e=util[_0x4af5('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x182393['serverUrl'],_0x2cb1bf['uniqueid'],md5(_0x2cb1bf[_0x4af5('0x4d')]));if(_0x3baa97&&_0x3baa97['monitor_format']){logger[_0x4af5('0x12')](_0x4af5('0x4e'),_0x4af5('0x4f'));_0x2cb1bf[_0x4af5('0x50')]=_0x2eaf5e;}else if(_0x3fd86e&&_0x3fd86e['recordingFormat']&&_0x3fd86e['recordingFormat']!==_0x4af5('0x51')){logger[_0x4af5('0x12')](_0x4af5('0x52'),_0x4af5('0x4f'));_0x2cb1bf['recordingURL']=_0x2eaf5e;}else{_0x2cb1bf['recordingURL']='';}return getAdminId(_0x319860,_0x5e7693,_0x2d8a68,_0x44923b)[_0x4af5('0x1c')](getUser(_0x5e7693,_0x2d8a68,_0x44923b))[_0x4af5('0x1c')](getEndUser(_0x5e7693,_0x2d8a68,_0x44923b))[_0x4af5('0x1c')](getTicket(_0x5e7693,_0x2d8a68,_0x44923b,_0x40f39b,_0x2cb1bf))[_0x4af5('0x1c')](function(_0x243a77){logger[_0x4af5('0x12')](util[_0x4af5('0x29')](_0x4af5('0x53'),_0x243a77[_0x4af5('0x3c')]));if(_0x5e7693!==_0x4af5('0x4b')){logger[_0x4af5('0x12')]('['+[_0x5e7693[_0x4af5('0x18')]()]+']',_0x4af5('0x54'));emit(_0x44923b,_0xa05d1e[_0x4af5('0x55')],_0x243a77['endUserId']);}})[_0x4af5('0x16')](function(_0x27b841){logger[_0x4af5('0x17')]('['+[_0x5e7693[_0x4af5('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x27b841,{'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 4497ec4..8d7f352 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 _0xaec8=['zendesk','salesforce','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','./zendesk','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log'];(function(_0xcf9f28,_0x34df8d){var _0x5760dd=function(_0x5d276c){while(--_0x5d276c){_0xcf9f28['push'](_0xcf9f28['shift']());}};_0x5760dd(++_0x34df8d);}(_0xaec8,0x71));var _0x8aec=function(_0x365841,_0x5a028f){_0x365841=_0x365841-0x0;var _0x56dd93=_0xaec8[_0x365841];return _0x56dd93;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x8aec('0x0'));var salesforce=require('./salesforce');var sugarcrm=require(_0x8aec('0x1'));var freshdesk=require(_0x8aec('0x2'));var zoho=require(_0x8aec('0x3'));var desk=require('./desk');var vtiger=require(_0x8aec('0x4'));var servicenow=require(_0x8aec('0x5'));var dynamics365=require(_0x8aec('0x6'));var freshsales=require(_0x8aec('0x7'));var integrations=['zendesk','salesforce',_0x8aec('0x8'),_0x8aec('0x9'),_0x8aec('0xa'),_0x8aec('0xb'),_0x8aec('0xc'),_0x8aec('0xd'),_0x8aec('0xe'),_0x8aec('0xf')];exports[_0x8aec('0x10')]=function(_0x36e9f6,_0x243217,_0xe8d1d1,_0xe1d25c,_0x38dde4,_0x2af39a){if(_0xe8d1d1){if(_[_0x8aec('0x11')](integrations,_0x36e9f6[_0x8aec('0x12')][_0x8aec('0x13')]())){try{var _0x58e784=null;var _0x2cea22='';var _0xa22ecb=_0xe8d1d1[_0x36e9f6[_0x8aec('0x12')][_0x8aec('0x13')]()];if(_0xa22ecb){var _0x3577a6=_0xa22ecb[_0x36e9f6[_0x8aec('0x14')]];if(_0x3577a6){var _0x4b3a49=_['find'](_0x3577a6[_0x8aec('0x15')],{'id':parseInt(_0x36e9f6[_0x8aec('0x16')],0xa)});if(_0x4b3a49){if(_0xe1d25c){if(_0x38dde4&&_0x243217[_0x8aec('0x17')]){_0x2cea22='queue';}else if(_0x243217[_0x8aec('0x18')]){_0x2cea22=_0x8aec('0x19');}else{console[_0x8aec('0x1a')]('EVENT\x20UNKNOWN',_0x243217);}}else{_0x2cea22='unmanaged';}switch(_0x36e9f6[_0x8aec('0x12')][_0x8aec('0x13')]()){case _0x8aec('0x1b'):zendesk[_0x2cea22](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a);break;case _0x8aec('0x1c'):salesforce[_0x2cea22](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a);break;case _0x8aec('0x8'):sugarcrm[_0x2cea22](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a);break;case _0x8aec('0x9'):freshdesk[_0x2cea22](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a);break;case _0x8aec('0xa'):zoho[_0x2cea22](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a);break;case _0x8aec('0xb'):desk[_0x2cea22](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a);break;case _0x8aec('0xc'):vtiger[_0x2cea22](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a);break;case'freshsales':freshsales['cs'](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a,_0x2cea22);break;case _0x8aec('0xf'):servicenow['cs'](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a,_0x2cea22);break;case _0x8aec('0xd'):dynamics365['cs'](_0x36e9f6,_0x243217,_0x4b3a49,_0xe1d25c,_0x38dde4,_0x3577a6,_0x2af39a,_0x2cea22);break;default:console['log'](_0x8aec('0x1d'));}}else{_0x58e784=require(_0x8aec('0x1e'))(_0x36e9f6['data1']['toLowerCase']());_0x58e784[_0x8aec('0x1f')]('[EXEC]',util[_0x8aec('0x20')](_0x8aec('0x21'),_0x36e9f6[_0x8aec('0x12')]['toLowerCase'](),_0x36e9f6['data3']));}}else{_0x58e784=require(_0x8aec('0x1e'))(_0x36e9f6['data1']['toLowerCase']());_0x58e784['error']('[EXEC]',util['format'](_0x8aec('0x22'),_0x36e9f6[_0x8aec('0x12')][_0x8aec('0x13')](),_0x36e9f6[_0x8aec('0x14')]));}}else{}}catch(_0x58a4a7){console['error'](_0x58a4a7);}}}}; \ No newline at end of file +var _0xa9c6=['data1','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','toLowerCase','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes'];(function(_0x227cfb,_0x4f42cf){var _0x131407=function(_0x37ddbb){while(--_0x37ddbb){_0x227cfb['push'](_0x227cfb['shift']());}};_0x131407(++_0x4f42cf);}(_0xa9c6,0xa0));var _0x6a9c=function(_0x4c1967,_0x8df4d9){_0x4c1967=_0x4c1967-0x0;var _0x3d22f4=_0xa9c6[_0x4c1967];return _0x3d22f4;};'use strict';var _=require(_0x6a9c('0x0'));var util=require(_0x6a9c('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x6a9c('0x2'));var zoho=require(_0x6a9c('0x3'));var desk=require(_0x6a9c('0x4'));var vtiger=require(_0x6a9c('0x5'));var servicenow=require(_0x6a9c('0x6'));var dynamics365=require(_0x6a9c('0x7'));var freshsales=require(_0x6a9c('0x8'));var integrations=[_0x6a9c('0x9'),_0x6a9c('0xa'),'sugarcrm',_0x6a9c('0xb'),_0x6a9c('0xc'),_0x6a9c('0xd'),_0x6a9c('0xe'),_0x6a9c('0xf'),_0x6a9c('0x10'),_0x6a9c('0x11')];exports[_0x6a9c('0x12')]=function(_0x26900e,_0x45465c,_0x4dde49,_0x143393,_0x3d729e,_0x44804c){if(_0x4dde49){if(_[_0x6a9c('0x13')](integrations,_0x26900e[_0x6a9c('0x14')]['toLowerCase']())){try{var _0xec6437=null;var _0xda7807='';var _0x28010b=_0x4dde49[_0x26900e[_0x6a9c('0x14')]['toLowerCase']()];if(_0x28010b){var _0x1ae891=_0x28010b[_0x26900e[_0x6a9c('0x15')]];if(_0x1ae891){var _0x18c8f4=_['find'](_0x1ae891[_0x6a9c('0x16')],{'id':parseInt(_0x26900e[_0x6a9c('0x17')],0xa)});if(_0x18c8f4){if(_0x143393){if(_0x3d729e&&_0x45465c[_0x6a9c('0x18')]){_0xda7807='queue';}else if(_0x45465c[_0x6a9c('0x19')]){_0xda7807=_0x6a9c('0x1a');}else{console[_0x6a9c('0x1b')](_0x6a9c('0x1c'),_0x45465c);}}else{_0xda7807='unmanaged';}switch(_0x26900e[_0x6a9c('0x14')][_0x6a9c('0x1d')]()){case _0x6a9c('0x9'):zendesk[_0xda7807](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c);break;case _0x6a9c('0xa'):salesforce[_0xda7807](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c);break;case'sugarcrm':sugarcrm[_0xda7807](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c);break;case _0x6a9c('0xb'):freshdesk[_0xda7807](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c);break;case _0x6a9c('0xc'):zoho[_0xda7807](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c);break;case'desk':desk[_0xda7807](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c);break;case _0x6a9c('0xe'):vtiger[_0xda7807](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c);break;case _0x6a9c('0x10'):freshsales['cs'](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c,_0xda7807);break;case'servicenow':servicenow['cs'](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c,_0xda7807);break;case _0x6a9c('0xf'):dynamics365['cs'](_0x26900e,_0x45465c,_0x18c8f4,_0x143393,_0x3d729e,_0x1ae891,_0x44804c,_0xda7807);break;default:console[_0x6a9c('0x1b')](_0x6a9c('0x1e'));}}else{_0xec6437=require('../../../../config/logger')(_0x26900e[_0x6a9c('0x14')][_0x6a9c('0x1d')]());_0xec6437[_0x6a9c('0x1f')](_0x6a9c('0x20'),util[_0x6a9c('0x21')](_0x6a9c('0x22'),_0x26900e[_0x6a9c('0x14')][_0x6a9c('0x1d')](),_0x26900e[_0x6a9c('0x17')]));}}else{_0xec6437=require('../../../../config/logger')(_0x26900e[_0x6a9c('0x14')][_0x6a9c('0x1d')]());_0xec6437[_0x6a9c('0x1f')]('[EXEC]',util[_0x6a9c('0x21')](_0x6a9c('0x23'),_0x26900e[_0x6a9c('0x14')]['toLowerCase'](),_0x26900e[_0x6a9c('0x15')]));}}else{}}catch(_0x1fd0e4){console[_0x6a9c('0x1f')](_0x1fd0e4);}}}}; \ 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 c76e741..66d3d1e 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 _0xce4f=['Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','LastName','format','Caller\x20-\x20%s','','upperFirst','includes','string','picklist','type','toString','variable','variableName','idField','customVariable','Variable','name','password','concat','Connection','remoteUri','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','isNil','calleridnum','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','contact','endUserType','WhoId','account','WhatId','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','sobject','User','find','then','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','length','additionalSearchLead','Lead','additionalSearchAccount','Account','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found'];(function(_0x34839f,_0x39ba16){var _0x34b8f5=function(_0x35ba46){while(--_0x35ba46){_0x34839f['push'](_0x34839f['shift']());}};_0x34b8f5(++_0x39ba16);}(_0xce4f,0xbf));var _0xfce4=function(_0x12832d,_0x3238c3){_0x12832d=_0x12832d-0x0;var _0x567ddf=_0xce4f[_0x12832d];return _0x567ddf;};'use strict';var _=require(_0xfce4('0x0'));var rp=require(_0xfce4('0x1'));var moment=require(_0xfce4('0x2'));var BPromise=require(_0xfce4('0x3'));var md5=require(_0xfce4('0x4'));var jsforce=require(_0xfce4('0x5'));var util=require(_0xfce4('0x6'));var Redis=require(_0xfce4('0x7'));var intUtil=require(_0xfce4('0x8'));var config=require(_0xfce4('0x9'));var logger=require(_0xfce4('0xa'))(_0xfce4('0xb'));config[_0xfce4('0xc')]=_[_0xfce4('0xd')](config[_0xfce4('0xc')],{'host':_0xfce4('0xe'),'port':0x18eb});var io=require(_0xfce4('0xf'))(new Redis(config[_0xfce4('0xc')]));function emit(_0x39b11d,_0x4808d0,_0x39403e){io['to'](_0x39b11d)[_0xfce4('0x10')](_0x4808d0,_0x39403e);}function getTicket(_0x56aea8,_0x39667a,_0x3c43bc,_0x486bec,_0x1e3056,_0x2d5baf,_0x2f90d6,_0x551eba){var _0x230844=Object[_0xfce4('0x11')]({},{'OwnerId':_0x39667a['id'],'Subject':intUtil[_0xfce4('0x12')](_0x486bec[_0xfce4('0x13')],_0x1e3056,'\x20'),'Description':intUtil[_0xfce4('0x12')](_0x486bec[_0xfce4('0x14')],_0x1e3056,'\x0a')},getCustomFields(_0x2d5baf,_0x1e3056));if(_0x3c43bc){if(_0x486bec[_0xfce4('0x15')]===_0xfce4('0x16')){_0x230844[_0xfce4('0x17')]=moment[_0xfce4('0x18')]();_0x230844['IsReminderSet']=![];_0x230844['IsRecurrence']=![];if(_0x3c43bc['endUserType']===_0xfce4('0x19')||_0x3c43bc[_0xfce4('0x1a')]==='lead'){_0x230844[_0xfce4('0x1b')]=_0x3c43bc['id'];}else if(_0x3c43bc[_0xfce4('0x1a')]===_0xfce4('0x1c')){_0x230844[_0xfce4('0x1d')]=_0x3c43bc['id'];}}else if(_0x486bec['ticketType']==='Case'){if(_0x3c43bc[_0xfce4('0x1a')]==='contact'){_0x230844[_0xfce4('0x1e')]=_0x3c43bc['id'];}else if(_0x3c43bc[_0xfce4('0x1a')]===_0xfce4('0x1c')){_0x230844[_0xfce4('0x1f')]=_0x3c43bc['id'];}else if(_0x3c43bc[_0xfce4('0x1a')]===_0xfce4('0x20')&&_0x486bec['leadId']){_0x230844[_0x486bec[_0xfce4('0x21')]]=_0x3c43bc['id'];}else{logger[_0xfce4('0x22')](_0xfce4('0x23'));}}}return _0x2f90d6['sobject'](_0x486bec[_0xfce4('0x15')])[_0xfce4('0x24')](_0x230844);}function getUser(_0x42f92b,_0x4762eb,_0x4ccf7e){if(!_['isNil'](_0x4762eb)&&intUtil[_0xfce4('0x25')](_0x4762eb)){var _0x1318e2={'Email':_0x4762eb};var _0x4224c4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ccf7e[_0xfce4('0x26')](_0xfce4('0x27'))[_0xfce4('0x28')](_0x1318e2,_0x4224c4)['execute']()[_0xfce4('0x29')](function(_0x42ec17){if(_0x42ec17['length']){var _0x41bbe4=_[_0xfce4('0x28')](_0x42ec17,function(_0x9ed8e6){return _0x9ed8e6[_0xfce4('0x2a')]===_0x4762eb;});if(_0x41bbe4){logger[_0xfce4('0x22')](_0xfce4('0x2b'),_0x4762eb);return BPromise[_0xfce4('0x2c')]({'id':_0x41bbe4['Id'],'name':_0x41bbe4[_0xfce4('0x2d')]});}}else{logger['info'](_0xfce4('0x2e'),_0x4762eb);return _0x4ccf7e['identity']()[_0xfce4('0x29')](function(_0x4c912a){return BPromise[_0xfce4('0x2c')]({'id':_0x4c912a[_0xfce4('0x2f')],'name':_0x4c912a[_0xfce4('0x30')]});});}});}else{logger['info'](_0xfce4('0x2e'),_0x4762eb);return _0x4ccf7e[_0xfce4('0x31')]()['then'](function(_0x3a867a){return BPromise['resolve']({'id':_0x3a867a['user_id'],'name':_0x3a867a[_0xfce4('0x30')]});});}}function getEndUser(_0x1c74ee,_0x7171c4,_0x543b5e,_0x27f2f1,_0x205a4b){var _0x321f38={'$or':{'Phone':_0x27f2f1}};var _0x20793e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfce4('0x2c')]()[_0xfce4('0x29')](function(){logger[_0xfce4('0x22')](_0xfce4('0x32'),_0x27f2f1,_0x7171c4[_0xfce4('0x33')]);switch(_0x7171c4[_0xfce4('0x33')]){case _0xfce4('0x34'):var _0xd586c4=_[_0xfce4('0x35')](_0x321f38);if(_0x7171c4['additionalSearchContact']){var _0x2bbe39={};_0x2bbe39[_0x7171c4[_0xfce4('0x36')]]=_0x27f2f1;_[_0xfce4('0x37')](_0xd586c4[_0xfce4('0x38')],_0x2bbe39);}return _0x205a4b[_0xfce4('0x26')](_0xfce4('0x39'))[_0xfce4('0x28')](_0xd586c4,_0x20793e)[_0xfce4('0x3a')]()[_0xfce4('0x29')](function(_0x3a16ba){if(_0x3a16ba&&_0x3a16ba[_0xfce4('0x3b')]){return _0x3a16ba;}else{var _0x239126=_[_0xfce4('0x35')](_0x321f38);if(_0x7171c4['additionalSearchLead']){var _0x4eddad={};_0x4eddad[_0x7171c4[_0xfce4('0x3c')]]=_0x27f2f1;_[_0xfce4('0x37')](_0x239126[_0xfce4('0x38')],_0x4eddad);}return _0x205a4b['sobject'](_0xfce4('0x3d'))[_0xfce4('0x28')](_0x239126,_0x20793e);}});case'account_contact_lead':var _0x4aea28=_[_0xfce4('0x35')](_0x321f38);if(_0x7171c4['additionalSearchAccount']){var _0x2bbe39={};_0x2bbe39[_0x7171c4[_0xfce4('0x3e')]]=_0x27f2f1;_[_0xfce4('0x37')](_0x4aea28['$or'],_0x2bbe39);}return _0x205a4b['sobject'](_0xfce4('0x3f'))['find'](_0x4aea28,_0x20793e)[_0xfce4('0x3a')]()['then'](function(_0x587244){if(_0x587244&&_0x587244[_0xfce4('0x3b')]){return _0x587244;}else{var _0x187be3=_['cloneDeep'](_0x321f38);if(_0x7171c4[_0xfce4('0x36')]){var _0x1d4c68={};_0x1d4c68[_0x7171c4[_0xfce4('0x36')]]=_0x27f2f1;_['merge'](_0x187be3[_0xfce4('0x38')],_0x1d4c68);}return _0x205a4b['sobject'](_0xfce4('0x39'))[_0xfce4('0x28')](_0x187be3,_0x20793e)[_0xfce4('0x29')](function(_0x4a68cd){if(_0x4a68cd&&_0x4a68cd[_0xfce4('0x3b')]){return _0x4a68cd;}else{var _0x24bc06=_[_0xfce4('0x35')](_0x321f38);if(_0x7171c4[_0xfce4('0x3c')]){var _0x209c2d={};_0x209c2d[_0x7171c4['additionalSearchLead']]=_0x27f2f1;_[_0xfce4('0x37')](_0x24bc06[_0xfce4('0x38')],_0x209c2d);}return _0x205a4b[_0xfce4('0x26')](_0xfce4('0x3d'))['find'](_0x24bc06,_0x20793e);}});}});case _0xfce4('0x19'):var _0xd586c4=_[_0xfce4('0x35')](_0x321f38);if(_0x7171c4['additionalSearchContact']){var _0x2bbe39={};_0x2bbe39[_0x7171c4[_0xfce4('0x36')]]=_0x27f2f1;_[_0xfce4('0x37')](_0xd586c4[_0xfce4('0x38')],_0x2bbe39);}return _0x205a4b[_0xfce4('0x26')](_0xfce4('0x39'))[_0xfce4('0x28')](_0xd586c4,_0x20793e)[_0xfce4('0x3a')]();case _0xfce4('0x20'):var _0x4c668e=_[_0xfce4('0x35')](_0x321f38);if(_0x7171c4['additionalSearchLead']){var _0x2bbe39={};_0x2bbe39[_0x7171c4[_0xfce4('0x3c')]]=_0x27f2f1;_[_0xfce4('0x37')](_0x4c668e[_0xfce4('0x38')],_0x2bbe39);}return _0x205a4b[_0xfce4('0x26')](_0xfce4('0x3d'))[_0xfce4('0x28')](_0x4c668e,_0x20793e);case _0xfce4('0x1c'):var _0x4aea28=_[_0xfce4('0x35')](_0x321f38);if(_0x7171c4[_0xfce4('0x3e')]){var _0x2bbe39={};_0x2bbe39[_0x7171c4[_0xfce4('0x3e')]]=_0x27f2f1;_[_0xfce4('0x37')](_0x4aea28['$or'],_0x2bbe39);}return _0x205a4b['sobject'](_0xfce4('0x3f'))['find'](_0x4aea28,_0x20793e);default:return null;}})['then'](function(_0x259460){if(_0x259460&&_0x259460[_0xfce4('0x3b')]){var _0x27cf3f=_[_0xfce4('0x40')](_0x259460);if(_0x27cf3f){return BPromise[_0xfce4('0x2c')]({'id':_0x27cf3f['Id'],'name':_0x27cf3f[_0xfce4('0x2d')],'phone':_0x27cf3f['Phone'],'endUserType':_0x27cf3f[_0xfce4('0x41')]['type'][_0xfce4('0x42')]()});}}})[_0xfce4('0x29')](function(_0x1c4a34){if(_0x1c4a34){logger[_0xfce4('0x22')](_0xfce4('0x43'),_0x1c4a34[_0xfce4('0x1a')],_0x27f2f1);return BPromise['resolve'](_0x1c4a34);}else{logger['info'](_0xfce4('0x44'),_0x27f2f1);var _0x226806={'Phone':_0x27f2f1};if(_0x7171c4['moduleCreate']){if(_0x7171c4['moduleCreate']==='contact'){logger['info'](_0xfce4('0x45'),_0x27f2f1,_0x7171c4[_0xfce4('0x46')]);_0x226806['LastName']=_0x543b5e!==''?_0x543b5e:util['format']('Caller\x20-\x20%s',_0x27f2f1);}else if(_0x7171c4[_0xfce4('0x46')]==='lead'){logger['info'](_0xfce4('0x45'),_0x27f2f1,_0x7171c4['moduleCreate']);_0x226806[_0xfce4('0x47')]=_0x543b5e!==''?_0x543b5e:util[_0xfce4('0x48')](_0xfce4('0x49'),_0x27f2f1);_0x226806['Company']='No\x20Company';}else if(_0x7171c4['moduleCreate']==='account'){logger[_0xfce4('0x22')](_0xfce4('0x45'),_0x27f2f1,_0x7171c4[_0xfce4('0x46')]);_0x226806[_0xfce4('0x2d')]=_0x543b5e!==_0xfce4('0x4a')?_0x543b5e:util[_0xfce4('0x48')]('Caller\x20-\x20%s',_0x27f2f1);}else{return null;}}return _0x205a4b[_0xfce4('0x26')](_[_0xfce4('0x4b')](_0x7171c4[_0xfce4('0x46')]))[_0xfce4('0x24')](_0x226806)[_0xfce4('0x29')](function(_0x2daa81){return BPromise['resolve']({'id':_0x2daa81['id'],'endUserType':_0x7171c4[_0xfce4('0x46')]});});}});}function getCustomFields(_0x1c7aa8,_0x41406d){var _0x2f661a={};if(_0x1c7aa8[_0xfce4('0x3b')]>0x0){_['forEach'](_0x1c7aa8,function(_0x254462){if(_[_0xfce4('0x4c')]([_0xfce4('0x4d'),_0xfce4('0x4e')],_0x254462[_0xfce4('0x4f')])&&_0x254462['idField']){_0x2f661a[_0x254462['idField']]=_0x254462['content'][_0xfce4('0x50')]();}else if(_0x254462['type']===_0xfce4('0x51')&&_0x254462[_0xfce4('0x52')]&&_0x254462[_0xfce4('0x53')]){_0x41406d[_0x254462[_0xfce4('0x52')]]&&(_0x2f661a[_0x254462[_0xfce4('0x53')]]=_0x41406d[_0x254462['variableName']][_0xfce4('0x50')]());}else if(_0x254462[_0xfce4('0x4f')]===_0xfce4('0x54')&&_0x254462[_0xfce4('0x55')]&&_0x254462[_0xfce4('0x55')]['name']&&_0x254462[_0xfce4('0x53')]){_0x41406d[_0x254462[_0xfce4('0x55')][_0xfce4('0x56')]['toLowerCase']()]&&(_0x2f661a[_0x254462[_0xfce4('0x53')]]=_0x41406d[_0x254462['Variable'][_0xfce4('0x56')][_0xfce4('0x42')]()][_0xfce4('0x50')]());}});}return _0x2f661a;}function getConnection(_0x58ef3c){var _0x15dad0=_0x58ef3c[_0xfce4('0x57')][_0xfce4('0x58')](_0x58ef3c['securityToken']);var _0xc53759=new jsforce[(_0xfce4('0x59'))]({'oauth2':{'loginUrl':_0x58ef3c[_0xfce4('0x5a')]||'https://login.salesforce.com','clientId':_0x58ef3c['clientId'],'clientSecret':_0x58ef3c['clientSecret']}});return _0xc53759[_0xfce4('0x5b')](_0x58ef3c[_0xfce4('0x5c')],_0x15dad0)[_0xfce4('0x29')](function(){logger['info']('Connection\x20established.');return _0xc53759;});}exports[_0xfce4('0x5d')]=function(_0x5717ca,_0x36e884,_0x4dbdd1,_0x4b90cd,_0x3149be,_0x1e03d3){var _0x1eca35,_0x581093,_0x1ad8ec,_0x628a9c;_0x1e03d3[_0xfce4('0x5e')]=intUtil[_0xfce4('0x5f')](_0x1e03d3['serverUrl']);_0x1e03d3['remoteUri']=intUtil[_0xfce4('0x5f')](_0x1e03d3[_0xfce4('0x5a')]);if(_0x3149be&&_0x3149be[_0xfce4('0x60')]){logger[_0xfce4('0x22')]('[QUEUE]',_0xfce4('0x61'));_0x36e884[_0xfce4('0x62')]=util[_0xfce4('0x48')](_0xfce4('0x63'),_0x1e03d3[_0xfce4('0x5e')],_0x36e884[_0xfce4('0x64')],md5(_0x36e884[_0xfce4('0x64')]));}else{_0x36e884[_0xfce4('0x62')]='';}return getConnection(_0x1e03d3)[_0xfce4('0x29')](function(_0x550f73){_0x628a9c=_0x550f73;return getUser(_0x1e03d3,_0x4b90cd['email'],_0x628a9c);})[_0xfce4('0x29')](function(_0x835fce){_0x1eca35=_0x835fce;return getEndUser(_0x1e03d3,_0x4dbdd1,_0x36e884[_0xfce4('0x65')],_0x36e884['calleridnum'],_0x628a9c);})[_0xfce4('0x29')](function(_0x20f1d8){_0x581093=_0x20f1d8;return getTicket(_0x1e03d3,_0x1eca35,_0x581093,_0x4dbdd1,_0x36e884,_0x4dbdd1[_0xfce4('0x66')],_0x628a9c,'queue');})[_0xfce4('0x29')](function(_0x112192){_0x1ad8ec=_0x112192;logger[_0xfce4('0x22')](_0xfce4('0x67'),_0x1ad8ec['id']);logger[_0xfce4('0x22')](_0xfce4('0x68'),_0x1ad8ec['id'],_0x4b90cd[_0xfce4('0x56')],_0x1e03d3[_0xfce4('0x4f')]);switch(_0x1e03d3[_0xfce4('0x4f')]){case'integrationTab':emit(util[_0xfce4('0x48')](_0xfce4('0x69'),_0x4b90cd[_0xfce4('0x56')]),_0xfce4('0x6a'),{'recordId':_0x1ad8ec['id']});break;case'newTab':emit(util[_0xfce4('0x48')]('user:%s',_0x4b90cd[_0xfce4('0x56')]),_0xfce4('0x6b'),{'uri':util['format']('%s/%s/e',_0x628a9c[_0xfce4('0x6c')],_0x1ad8ec['id'])});break;default:logger['error'](_0xfce4('0x6d'));}})[_0xfce4('0x6e')](function(_0x59bde5){logger[_0xfce4('0x6f')](_0xfce4('0x70'),_0x59bde5);});};exports[_0xfce4('0x71')]=function(_0x4e1d01,_0x1a87f2,_0x2a4bbe,_0x88f078,_0x11341c,_0x15cb74,_0xd8fdd8){var _0x752cb5,_0x541228,_0x21eddb,_0x2a44f7;_0x15cb74[_0xfce4('0x5e')]=intUtil[_0xfce4('0x5f')](_0x15cb74[_0xfce4('0x5e')]);_0x15cb74[_0xfce4('0x5a')]=intUtil['stripTrailingSlash'](_0x15cb74[_0xfce4('0x5a')]);if(_0xd8fdd8&&_0xd8fdd8['recordingFormat']&&_0xd8fdd8[_0xfce4('0x72')]!==_0xfce4('0x73')){logger[_0xfce4('0x22')](_0xfce4('0x74'),_0xfce4('0x61'));_0x1a87f2[_0xfce4('0x62')]=util[_0xfce4('0x48')](_0xfce4('0x63'),_0x15cb74[_0xfce4('0x5e')],_0x1a87f2['uniqueid'],md5(_0x1a87f2[_0xfce4('0x64')]));}return getConnection(_0x15cb74)[_0xfce4('0x29')](function(_0x1e98fe){_0x2a44f7=_0x1e98fe;return getUser(_0x15cb74,_0x88f078[_0xfce4('0x75')],_0x2a44f7);})[_0xfce4('0x29')](function(_0x116492){_0x752cb5=_0x116492;return getEndUser(_0x15cb74,_0x2a4bbe,_0x1a87f2[_0xfce4('0x76')],_0x1a87f2[_0xfce4('0x77')],_0x2a44f7);})['then'](function(_0x3c58e5){_0x541228=_0x3c58e5;return getTicket(_0x15cb74,_0x752cb5,_0x541228,_0x2a4bbe,_0x1a87f2,_0x2a4bbe[_0xfce4('0x66')],_0x2a44f7,'outbound');})[_0xfce4('0x29')](function(_0x2e415c){_0x21eddb=_0x2e415c;logger[_0xfce4('0x22')](_0xfce4('0x78'),_0x21eddb['id']);logger[_0xfce4('0x22')](_0xfce4('0x79'),_0x21eddb['id'],_0x88f078['name'],_0x15cb74[_0xfce4('0x4f')]);switch(_0x15cb74['type']){case'integrationTab':emit(util[_0xfce4('0x48')](_0xfce4('0x69'),_0x88f078[_0xfce4('0x56')]),_0xfce4('0x6a'),{'recordId':_0x21eddb['id']});break;case _0xfce4('0x7a'):emit(util[_0xfce4('0x48')]('user:%s',_0x88f078[_0xfce4('0x56')]),_0xfce4('0x6b'),{'uri':util[_0xfce4('0x48')]('%s/%s/e',_0x2a44f7[_0xfce4('0x6c')],_0x21eddb['id'])});break;default:logger[_0xfce4('0x6f')](_0xfce4('0x74'),_0xfce4('0x7b'));}})[_0xfce4('0x6e')](function(_0x1a2dc1){logger[_0xfce4('0x6f')]('[OUTBOUND]',_0x1a2dc1);});};exports[_0xfce4('0x7c')]=function(_0x5e6b72,_0x17af0a,_0x4e90ba,_0x1a8250,_0xa22305,_0x320f3b){var _0x1b3a22,_0x47db1b,_0x25c284,_0x5c15bb;_0x320f3b[_0xfce4('0x5e')]=intUtil[_0xfce4('0x5f')](_0x320f3b[_0xfce4('0x5e')]);_0x320f3b[_0xfce4('0x5a')]=intUtil['stripTrailingSlash'](_0x320f3b[_0xfce4('0x5a')]);if(_0xa22305&&_0xa22305[_0xfce4('0x60')]){logger[_0xfce4('0x22')]('['+_0x17af0a['lastevent'][_0xfce4('0x7d')]()+']',_0xfce4('0x61'));_0x17af0a[_0xfce4('0x62')]=util[_0xfce4('0x48')](_0xfce4('0x63'),_0x320f3b[_0xfce4('0x5e')],_0x17af0a[_0xfce4('0x64')],md5(_0x17af0a[_0xfce4('0x64')]));}else{_0x17af0a[_0xfce4('0x62')]='';}return getConnection(_0x320f3b)[_0xfce4('0x29')](function(_0x4fc933){_0x5c15bb=_0x4fc933;if(!_[_0xfce4('0x7e')](_0x1a8250)){return getUser(_0x320f3b,_0x1a8250[_0xfce4('0x56')],_0x5c15bb);}else{return getUser(_0x320f3b,null,_0x5c15bb);}})[_0xfce4('0x29')](function(_0x52f290){_0x1b3a22=_0x52f290;return getEndUser(_0x320f3b,_0x4e90ba,_0x17af0a[_0xfce4('0x65')],_0x17af0a[_0xfce4('0x7f')],_0x5c15bb);})[_0xfce4('0x29')](function(_0x19b491){_0x47db1b=_0x19b491;return getTicket(_0x320f3b,_0x1b3a22,_0x47db1b,_0x4e90ba,_0x17af0a,_0x4e90ba[_0xfce4('0x66')],_0x5c15bb);})[_0xfce4('0x29')](function(_0x161fbd){_0x25c284=_0x161fbd;logger[_0xfce4('0x22')]('['+_0x17af0a[_0xfce4('0x80')][_0xfce4('0x7d')]()+']\x20Ticket\x20%s\x20created.',_0x25c284['id']);logger[_0xfce4('0x22')]('['+_0x17af0a[_0xfce4('0x80')][_0xfce4('0x7d')]()+_0xfce4('0x81'),_0x320f3b['type']);})[_0xfce4('0x6e')](function(_0x4ba8ef){logger[_0xfce4('0x6f')]('['+_0x17af0a[_0xfce4('0x80')][_0xfce4('0x7d')]()+']',_0x4ba8ef);});}; \ No newline at end of file +var _0x8648=['additionalSearchLead','$or','Lead','additionalSearchAccount','Contact','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','[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','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','uniqueid','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','ticketType','Case','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge'];(function(_0x1f7996,_0x299a14){var _0x584609=function(_0x14c34a){while(--_0x14c34a){_0x1f7996['push'](_0x1f7996['shift']());}};_0x584609(++_0x299a14);}(_0x8648,0xcc));var _0x8864=function(_0x10d6bb,_0x1d4c66){_0x10d6bb=_0x10d6bb-0x0;var _0x3c3504=_0x8648[_0x10d6bb];return _0x3c3504;};'use strict';var _=require(_0x8864('0x0'));var rp=require(_0x8864('0x1'));var moment=require('moment');var BPromise=require(_0x8864('0x2'));var md5=require(_0x8864('0x3'));var jsforce=require(_0x8864('0x4'));var util=require(_0x8864('0x5'));var Redis=require(_0x8864('0x6'));var intUtil=require('./util');var config=require(_0x8864('0x7'));var logger=require(_0x8864('0x8'))(_0x8864('0x9'));config[_0x8864('0xa')]=_[_0x8864('0xb')](config[_0x8864('0xa')],{'host':_0x8864('0xc'),'port':0x18eb});var io=require(_0x8864('0xd'))(new Redis(config[_0x8864('0xa')]));function emit(_0x14db0a,_0x456b80,_0x473563){io['to'](_0x14db0a)[_0x8864('0xe')](_0x456b80,_0x473563);}function getTicket(_0x5c1dbf,_0x128c73,_0x2d9569,_0xb5ab80,_0x2ac956,_0x57a6df,_0x599146,_0x5ea246){var _0x50946d=Object[_0x8864('0xf')]({},{'OwnerId':_0x128c73['id'],'Subject':intUtil['getString'](_0xb5ab80['Subjects'],_0x2ac956,'\x20'),'Description':intUtil[_0x8864('0x10')](_0xb5ab80[_0x8864('0x11')],_0x2ac956,'\x0a')},getCustomFields(_0x57a6df,_0x2ac956));if(_0x2d9569){if(_0xb5ab80['ticketType']===_0x8864('0x12')){_0x50946d[_0x8864('0x13')]=moment[_0x8864('0x14')]();_0x50946d[_0x8864('0x15')]=![];_0x50946d[_0x8864('0x16')]=![];if(_0x2d9569[_0x8864('0x17')]===_0x8864('0x18')||_0x2d9569[_0x8864('0x17')]==='lead'){_0x50946d[_0x8864('0x19')]=_0x2d9569['id'];}else if(_0x2d9569[_0x8864('0x17')]===_0x8864('0x1a')){_0x50946d[_0x8864('0x1b')]=_0x2d9569['id'];}}else if(_0xb5ab80[_0x8864('0x1c')]===_0x8864('0x1d')){if(_0x2d9569['endUserType']===_0x8864('0x18')){_0x50946d['ContactId']=_0x2d9569['id'];}else if(_0x2d9569['endUserType']===_0x8864('0x1a')){_0x50946d[_0x8864('0x1e')]=_0x2d9569['id'];}else if(_0x2d9569[_0x8864('0x17')]===_0x8864('0x1f')&&_0xb5ab80['leadId']){_0x50946d[_0xb5ab80[_0x8864('0x20')]]=_0x2d9569['id'];}else{logger[_0x8864('0x21')](_0x8864('0x22'));}}}return _0x599146[_0x8864('0x23')](_0xb5ab80[_0x8864('0x1c')])[_0x8864('0x24')](_0x50946d);}function getUser(_0x564c98,_0x315452,_0x615e0b){if(!_[_0x8864('0x25')](_0x315452)&&intUtil[_0x8864('0x26')](_0x315452)){var _0x532985={'Email':_0x315452};var _0x4151ba={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x615e0b[_0x8864('0x23')](_0x8864('0x27'))['find'](_0x532985,_0x4151ba)[_0x8864('0x28')]()[_0x8864('0x29')](function(_0x1ff3f1){if(_0x1ff3f1[_0x8864('0x2a')]){var _0x3a26f1=_[_0x8864('0x2b')](_0x1ff3f1,function(_0x2c2368){return _0x2c2368['Email']===_0x315452;});if(_0x3a26f1){logger[_0x8864('0x21')]('Agent\x20%s\x20found.',_0x315452);return BPromise[_0x8864('0x2c')]({'id':_0x3a26f1['Id'],'name':_0x3a26f1[_0x8864('0x2d')]});}}else{logger['info'](_0x8864('0x2e'),_0x315452);return _0x615e0b['identity']()[_0x8864('0x29')](function(_0x186e22){return BPromise['resolve']({'id':_0x186e22[_0x8864('0x2f')],'name':_0x186e22[_0x8864('0x30')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x315452);return _0x615e0b[_0x8864('0x31')]()['then'](function(_0x583966){return BPromise['resolve']({'id':_0x583966[_0x8864('0x2f')],'name':_0x583966['display_name']});});}}function getEndUser(_0xdcb56c,_0x1d12b6,_0x553136,_0x4425b1,_0x5479ae){var _0x2a56b4={'$or':{'Phone':_0x4425b1}};var _0x3cb35e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x8864('0x29')](function(){logger[_0x8864('0x21')](_0x8864('0x32'),_0x4425b1,_0x1d12b6[_0x8864('0x33')]);switch(_0x1d12b6[_0x8864('0x33')]){case _0x8864('0x34'):var _0x1b9a8c=_[_0x8864('0x35')](_0x2a56b4);if(_0x1d12b6[_0x8864('0x36')]){var _0x8809d7={};_0x8809d7[_0x1d12b6['additionalSearchContact']]=_0x4425b1;_[_0x8864('0x37')](_0x1b9a8c['$or'],_0x8809d7);}return _0x5479ae['sobject']('Contact')[_0x8864('0x2b')](_0x1b9a8c,_0x3cb35e)[_0x8864('0x28')]()['then'](function(_0x38aef9){if(_0x38aef9&&_0x38aef9['length']){return _0x38aef9;}else{var _0x41a9c2=_['cloneDeep'](_0x2a56b4);if(_0x1d12b6[_0x8864('0x38')]){var _0x2bc195={};_0x2bc195[_0x1d12b6['additionalSearchLead']]=_0x4425b1;_[_0x8864('0x37')](_0x41a9c2[_0x8864('0x39')],_0x2bc195);}return _0x5479ae[_0x8864('0x23')](_0x8864('0x3a'))[_0x8864('0x2b')](_0x41a9c2,_0x3cb35e);}});case'account_contact_lead':var _0x79c3ef=_[_0x8864('0x35')](_0x2a56b4);if(_0x1d12b6['additionalSearchAccount']){var _0x8809d7={};_0x8809d7[_0x1d12b6[_0x8864('0x3b')]]=_0x4425b1;_[_0x8864('0x37')](_0x79c3ef[_0x8864('0x39')],_0x8809d7);}return _0x5479ae[_0x8864('0x23')]('Account')['find'](_0x79c3ef,_0x3cb35e)[_0x8864('0x28')]()[_0x8864('0x29')](function(_0x5544db){if(_0x5544db&&_0x5544db[_0x8864('0x2a')]){return _0x5544db;}else{var _0x3c2dd0=_[_0x8864('0x35')](_0x2a56b4);if(_0x1d12b6[_0x8864('0x36')]){var _0x5aba87={};_0x5aba87[_0x1d12b6[_0x8864('0x36')]]=_0x4425b1;_['merge'](_0x3c2dd0[_0x8864('0x39')],_0x5aba87);}return _0x5479ae[_0x8864('0x23')](_0x8864('0x3c'))[_0x8864('0x2b')](_0x3c2dd0,_0x3cb35e)[_0x8864('0x29')](function(_0x227cad){if(_0x227cad&&_0x227cad[_0x8864('0x2a')]){return _0x227cad;}else{var _0x4d969b=_[_0x8864('0x35')](_0x2a56b4);if(_0x1d12b6[_0x8864('0x38')]){var _0x4f7cbb={};_0x4f7cbb[_0x1d12b6[_0x8864('0x38')]]=_0x4425b1;_[_0x8864('0x37')](_0x4d969b['$or'],_0x4f7cbb);}return _0x5479ae[_0x8864('0x23')](_0x8864('0x3a'))[_0x8864('0x2b')](_0x4d969b,_0x3cb35e);}});}});case'contact':var _0x1b9a8c=_[_0x8864('0x35')](_0x2a56b4);if(_0x1d12b6[_0x8864('0x36')]){var _0x8809d7={};_0x8809d7[_0x1d12b6[_0x8864('0x36')]]=_0x4425b1;_[_0x8864('0x37')](_0x1b9a8c[_0x8864('0x39')],_0x8809d7);}return _0x5479ae[_0x8864('0x23')](_0x8864('0x3c'))['find'](_0x1b9a8c,_0x3cb35e)[_0x8864('0x28')]();case'lead':var _0x4926d1=_['cloneDeep'](_0x2a56b4);if(_0x1d12b6[_0x8864('0x38')]){var _0x8809d7={};_0x8809d7[_0x1d12b6['additionalSearchLead']]=_0x4425b1;_[_0x8864('0x37')](_0x4926d1[_0x8864('0x39')],_0x8809d7);}return _0x5479ae['sobject'](_0x8864('0x3a'))[_0x8864('0x2b')](_0x4926d1,_0x3cb35e);case _0x8864('0x1a'):var _0x79c3ef=_[_0x8864('0x35')](_0x2a56b4);if(_0x1d12b6[_0x8864('0x3b')]){var _0x8809d7={};_0x8809d7[_0x1d12b6['additionalSearchAccount']]=_0x4425b1;_[_0x8864('0x37')](_0x79c3ef[_0x8864('0x39')],_0x8809d7);}return _0x5479ae[_0x8864('0x23')](_0x8864('0x3d'))[_0x8864('0x2b')](_0x79c3ef,_0x3cb35e);default:return null;}})['then'](function(_0x4a9e73){if(_0x4a9e73&&_0x4a9e73['length']){var _0x4d1e95=_[_0x8864('0x3e')](_0x4a9e73);if(_0x4d1e95){return BPromise['resolve']({'id':_0x4d1e95['Id'],'name':_0x4d1e95[_0x8864('0x2d')],'phone':_0x4d1e95[_0x8864('0x3f')],'endUserType':_0x4d1e95[_0x8864('0x40')][_0x8864('0x41')][_0x8864('0x42')]()});}}})[_0x8864('0x29')](function(_0x32c9fb){if(_0x32c9fb){logger[_0x8864('0x21')](_0x8864('0x43'),_0x32c9fb[_0x8864('0x17')],_0x4425b1);return BPromise[_0x8864('0x2c')](_0x32c9fb);}else{logger[_0x8864('0x21')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4425b1);var _0x3095cc={'Phone':_0x4425b1};if(_0x1d12b6[_0x8864('0x44')]){if(_0x1d12b6[_0x8864('0x44')]===_0x8864('0x18')){logger[_0x8864('0x21')](_0x8864('0x45'),_0x4425b1,_0x1d12b6['moduleCreate']);_0x3095cc['LastName']=_0x553136!==_0x8864('0x46')?_0x553136:util[_0x8864('0x47')](_0x8864('0x48'),_0x4425b1);}else if(_0x1d12b6['moduleCreate']==='lead'){logger[_0x8864('0x21')](_0x8864('0x45'),_0x4425b1,_0x1d12b6[_0x8864('0x44')]);_0x3095cc[_0x8864('0x49')]=_0x553136!==''?_0x553136:util[_0x8864('0x47')](_0x8864('0x48'),_0x4425b1);_0x3095cc['Company']=_0x8864('0x4a');}else if(_0x1d12b6[_0x8864('0x44')]===_0x8864('0x1a')){logger[_0x8864('0x21')](_0x8864('0x45'),_0x4425b1,_0x1d12b6[_0x8864('0x44')]);_0x3095cc[_0x8864('0x2d')]=_0x553136!==_0x8864('0x46')?_0x553136:util[_0x8864('0x47')](_0x8864('0x48'),_0x4425b1);}else{return null;}}return _0x5479ae['sobject'](_[_0x8864('0x4b')](_0x1d12b6['moduleCreate']))['create'](_0x3095cc)['then'](function(_0x307926){return BPromise['resolve']({'id':_0x307926['id'],'endUserType':_0x1d12b6[_0x8864('0x44')]});});}});}function getCustomFields(_0x9766b2,_0x57fdfe){var _0x4996c5={};if(_0x9766b2[_0x8864('0x2a')]>0x0){_[_0x8864('0x4c')](_0x9766b2,function(_0x379937){if(_[_0x8864('0x4d')]([_0x8864('0x4e'),_0x8864('0x4f')],_0x379937['type'])&&_0x379937[_0x8864('0x50')]){_0x4996c5[_0x379937[_0x8864('0x50')]]=_0x379937[_0x8864('0x51')][_0x8864('0x52')]();}else if(_0x379937['type']===_0x8864('0x53')&&_0x379937[_0x8864('0x54')]&&_0x379937[_0x8864('0x50')]){_0x57fdfe[_0x379937[_0x8864('0x54')]]&&(_0x4996c5[_0x379937[_0x8864('0x50')]]=_0x57fdfe[_0x379937['variableName']][_0x8864('0x52')]());}else if(_0x379937[_0x8864('0x41')]===_0x8864('0x55')&&_0x379937[_0x8864('0x56')]&&_0x379937[_0x8864('0x56')][_0x8864('0x57')]&&_0x379937[_0x8864('0x50')]){_0x57fdfe[_0x379937[_0x8864('0x56')][_0x8864('0x57')][_0x8864('0x42')]()]&&(_0x4996c5[_0x379937[_0x8864('0x50')]]=_0x57fdfe[_0x379937[_0x8864('0x56')][_0x8864('0x57')]['toLowerCase']()][_0x8864('0x52')]());}});}return _0x4996c5;}function getConnection(_0xeabc73){var _0x3bb776=_0xeabc73[_0x8864('0x58')][_0x8864('0x59')](_0xeabc73[_0x8864('0x5a')]);var _0x2350ec=new jsforce['Connection']({'oauth2':{'loginUrl':_0xeabc73[_0x8864('0x5b')]||_0x8864('0x5c'),'clientId':_0xeabc73['clientId'],'clientSecret':_0xeabc73['clientSecret']}});return _0x2350ec[_0x8864('0x5d')](_0xeabc73[_0x8864('0x5e')],_0x3bb776)[_0x8864('0x29')](function(){logger[_0x8864('0x21')]('Connection\x20established.');return _0x2350ec;});}exports[_0x8864('0x5f')]=function(_0x4a53ce,_0x155d03,_0x33b62f,_0x2c967f,_0x126ae1,_0x2e36c9){var _0x18cdd5,_0x482194,_0x12e5c8,_0x5196ea;_0x2e36c9[_0x8864('0x60')]=intUtil[_0x8864('0x61')](_0x2e36c9[_0x8864('0x60')]);_0x2e36c9[_0x8864('0x5b')]=intUtil[_0x8864('0x61')](_0x2e36c9[_0x8864('0x5b')]);if(_0x126ae1&&_0x126ae1[_0x8864('0x62')]){logger['info'](_0x8864('0x63'),_0x8864('0x64'));_0x155d03[_0x8864('0x65')]=util['format'](_0x8864('0x66'),_0x2e36c9[_0x8864('0x60')],_0x155d03['uniqueid'],md5(_0x155d03['uniqueid']));}else{_0x155d03[_0x8864('0x65')]='';}return getConnection(_0x2e36c9)[_0x8864('0x29')](function(_0x144773){_0x5196ea=_0x144773;return getUser(_0x2e36c9,_0x2c967f['email'],_0x5196ea);})[_0x8864('0x29')](function(_0x4c671c){_0x18cdd5=_0x4c671c;return getEndUser(_0x2e36c9,_0x33b62f,_0x155d03[_0x8864('0x67')],_0x155d03['calleridnum'],_0x5196ea);})[_0x8864('0x29')](function(_0x2ae4fa){_0x482194=_0x2ae4fa;return getTicket(_0x2e36c9,_0x18cdd5,_0x482194,_0x33b62f,_0x155d03,_0x33b62f['Fields'],_0x5196ea,_0x8864('0x5f'));})['then'](function(_0x4ea54a){_0x12e5c8=_0x4ea54a;logger[_0x8864('0x21')](_0x8864('0x68'),_0x12e5c8['id']);logger[_0x8864('0x21')](_0x8864('0x69'),_0x12e5c8['id'],_0x2c967f[_0x8864('0x57')],_0x2e36c9[_0x8864('0x41')]);switch(_0x2e36c9[_0x8864('0x41')]){case _0x8864('0x6a'):emit(util[_0x8864('0x47')](_0x8864('0x6b'),_0x2c967f['name']),_0x8864('0x6c'),{'recordId':_0x12e5c8['id']});break;case'newTab':emit(util['format']('user:%s',_0x2c967f[_0x8864('0x57')]),_0x8864('0x6d'),{'uri':util[_0x8864('0x47')](_0x8864('0x6e'),_0x5196ea[_0x8864('0x6f')],_0x12e5c8['id'])});break;default:logger[_0x8864('0x70')](_0x8864('0x71'));}})['catch'](function(_0x578842){logger['error'](_0x8864('0x63'),_0x578842);});};exports[_0x8864('0x72')]=function(_0x55c9a9,_0x66746b,_0x253b72,_0x237ecb,_0x1d6a4b,_0x376525,_0x2e52ff){var _0x9c5315,_0x1d4d95,_0x2a77c9,_0x3238be;_0x376525[_0x8864('0x60')]=intUtil[_0x8864('0x61')](_0x376525[_0x8864('0x60')]);_0x376525[_0x8864('0x5b')]=intUtil[_0x8864('0x61')](_0x376525['remoteUri']);if(_0x2e52ff&&_0x2e52ff[_0x8864('0x73')]&&_0x2e52ff['recordingFormat']!==_0x8864('0x74')){logger[_0x8864('0x21')]('[OUTBOUND]',_0x8864('0x64'));_0x66746b[_0x8864('0x65')]=util['format'](_0x8864('0x66'),_0x376525['serverUrl'],_0x66746b['uniqueid'],md5(_0x66746b['uniqueid']));}return getConnection(_0x376525)[_0x8864('0x29')](function(_0x3de7e8){_0x3238be=_0x3de7e8;return getUser(_0x376525,_0x237ecb['email'],_0x3238be);})[_0x8864('0x29')](function(_0x54495c){_0x9c5315=_0x54495c;return getEndUser(_0x376525,_0x253b72,_0x66746b['destcalleridname'],_0x66746b[_0x8864('0x75')],_0x3238be);})['then'](function(_0x4e1b7b){_0x1d4d95=_0x4e1b7b;return getTicket(_0x376525,_0x9c5315,_0x1d4d95,_0x253b72,_0x66746b,_0x253b72['Fields'],_0x3238be,'outbound');})[_0x8864('0x29')](function(_0x1f378c){_0x2a77c9=_0x1f378c;logger[_0x8864('0x21')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2a77c9['id']);logger[_0x8864('0x21')](_0x8864('0x76'),_0x2a77c9['id'],_0x237ecb[_0x8864('0x57')],_0x376525[_0x8864('0x41')]);switch(_0x376525[_0x8864('0x41')]){case _0x8864('0x6a'):emit(util[_0x8864('0x47')](_0x8864('0x6b'),_0x237ecb['name']),_0x8864('0x6c'),{'recordId':_0x2a77c9['id']});break;case _0x8864('0x77'):emit(util[_0x8864('0x47')](_0x8864('0x6b'),_0x237ecb[_0x8864('0x57')]),_0x8864('0x6d'),{'uri':util[_0x8864('0x47')](_0x8864('0x6e'),_0x3238be[_0x8864('0x6f')],_0x2a77c9['id'])});break;default:logger[_0x8864('0x70')](_0x8864('0x78'),_0x8864('0x79'));}})[_0x8864('0x7a')](function(_0x326fad){logger['error']('[OUTBOUND]',_0x326fad);});};exports[_0x8864('0x7b')]=function(_0x3f4179,_0x202788,_0x18b0a7,_0x3d3c85,_0x59846b,_0x5ca84d){var _0x469665,_0x243ae8,_0x5bb49a,_0x457427;_0x5ca84d['serverUrl']=intUtil['stripTrailingSlash'](_0x5ca84d[_0x8864('0x60')]);_0x5ca84d[_0x8864('0x5b')]=intUtil[_0x8864('0x61')](_0x5ca84d[_0x8864('0x5b')]);if(_0x59846b&&_0x59846b[_0x8864('0x62')]){logger['info']('['+_0x202788[_0x8864('0x7c')]['toUpperCase']()+']',_0x8864('0x64'));_0x202788[_0x8864('0x65')]=util['format'](_0x8864('0x66'),_0x5ca84d[_0x8864('0x60')],_0x202788['uniqueid'],md5(_0x202788[_0x8864('0x7d')]));}else{_0x202788[_0x8864('0x65')]='';}return getConnection(_0x5ca84d)[_0x8864('0x29')](function(_0x1ef1f3){_0x457427=_0x1ef1f3;if(!_[_0x8864('0x25')](_0x3d3c85)){return getUser(_0x5ca84d,_0x3d3c85[_0x8864('0x57')],_0x457427);}else{return getUser(_0x5ca84d,null,_0x457427);}})[_0x8864('0x29')](function(_0x410aa3){_0x469665=_0x410aa3;return getEndUser(_0x5ca84d,_0x18b0a7,_0x202788['calleridname'],_0x202788[_0x8864('0x7e')],_0x457427);})[_0x8864('0x29')](function(_0x68feaa){_0x243ae8=_0x68feaa;return getTicket(_0x5ca84d,_0x469665,_0x243ae8,_0x18b0a7,_0x202788,_0x18b0a7['Fields'],_0x457427);})[_0x8864('0x29')](function(_0xf80001){_0x5bb49a=_0xf80001;logger[_0x8864('0x21')]('['+_0x202788['lastevent'][_0x8864('0x7f')]()+_0x8864('0x80'),_0x5bb49a['id']);logger['info']('['+_0x202788[_0x8864('0x7c')][_0x8864('0x7f')]()+_0x8864('0x81'),_0x5ca84d[_0x8864('0x41')]);})[_0x8864('0x7a')](function(_0x3ed8ca){logger[_0x8864('0x70')]('['+_0x202788[_0x8864('0x7c')]['toUpperCase']()+']',_0x3ed8ca);});}; \ 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 8bf5205..33df6de 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 _0x7a2d=['remoteUri','isNil','email','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','content','toString','toLowerCase','variableName','idField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','Incident\x20-\x20','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','format','%s/api/now/table/'];(function(_0xcb10b6,_0x1a0432){var _0x55d485=function(_0x473049){while(--_0x473049){_0xcb10b6['push'](_0xcb10b6['shift']());}};_0x55d485(++_0x1a0432);}(_0x7a2d,0x14d));var _0xd7a2=function(_0x5b5f9b,_0x52aae){_0x5b5f9b=_0x5b5f9b-0x0;var _0x51e05b=_0x7a2d[_0x5b5f9b];return _0x51e05b;};'use strict';var _=require('lodash');var Promise=require(_0xd7a2('0x0'));var rp=require(_0xd7a2('0x1'));var util=require(_0xd7a2('0x2'));var md5=require(_0xd7a2('0x3'));var Redis=require(_0xd7a2('0x4'));var intUtil=require(_0xd7a2('0x5'));var config=require(_0xd7a2('0x6'));var logger=require(_0xd7a2('0x7'))(_0xd7a2('0x8'));config[_0xd7a2('0x9')]=_[_0xd7a2('0xa')](config[_0xd7a2('0x9')],{'host':_0xd7a2('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x287643,_0x124225,_0x1c6694,_0x5cdb2d,_0xfac334,_0x114dd1){return new Promise(function(_0xfc35b8,_0x2cc178){var _0x51c23c={'method':_0xd7a2('0xc'),'uri':_0x5cdb2d+_0xd7a2('0xd')+'&'+_0xfac334+'&'+_0x114dd1,'auth':_0x124225,'json':!![]};return rp(_0x51c23c)[_0xd7a2('0xe')](function(_0x4a8242){if(_0x4a8242[_0xd7a2('0xf')][_0xd7a2('0x10')]>0x0){_0x1c6694[_0xd7a2('0x11')]=_0x4a8242[_0xd7a2('0xf')][0x0][_0xd7a2('0x12')];}logger[_0xd7a2('0x13')]('['+[_0x287643['toUpperCase']()]+_0xd7a2('0x14'),_0x1c6694);_0xfc35b8(_0x1c6694);})[_0xd7a2('0x15')](function(_0x36e914){logger[_0xd7a2('0x16')]('['+[_0x287643[_0xd7a2('0x17')]()]+']',_0x36e914[_0xd7a2('0x18')]);_0x2cc178(_0x36e914[_0xd7a2('0x18')]);});});}function getUser(_0x4ffcf8,_0xd29692,_0x4aa5f2,_0x509129,_0x9644cc){return function(_0x2a584a){logger[_0xd7a2('0x13')]('['+[_0x4ffcf8[_0xd7a2('0x17')]()]+_0xd7a2('0x19'),_0x2a584a);return new Promise(function(_0xe20c05,_0xc8ec54){if(intUtil['validateEmail'](_0x2a584a[_0xd7a2('0x1a')])){var _0x4fa438={'method':_0xd7a2('0xc'),'uri':_0x4aa5f2+_0xd7a2('0x1b')+_0x2a584a[_0xd7a2('0x1a')]+'&'+_0x509129+'&'+_0x9644cc,'auth':_0xd29692,'json':!![]};logger[_0xd7a2('0x13')]('['+[_0x4ffcf8[_0xd7a2('0x17')]()]+_0xd7a2('0x1c'),_0x4fa438);return rp(_0x4fa438)[_0xd7a2('0xe')](function(_0x197aac){logger['info']('['+[_0x4ffcf8[_0xd7a2('0x17')]()]+_0xd7a2('0x1d'),_0x197aac);if(_0x197aac[_0xd7a2('0xf')][_0xd7a2('0x10')]>0x0&&String(_0x197aac[_0xd7a2('0xf')][0x0]['active'])===_0xd7a2('0x1e')){_0x2a584a[_0xd7a2('0x1f')]=_0x197aac[_0xd7a2('0xf')][0x0][_0xd7a2('0x12')];}else{_0x2a584a[_0xd7a2('0x1f')]=_0x2a584a[_0xd7a2('0x11')];_0x2a584a[_0xd7a2('0x1a')]=_0x2a584a[_0xd7a2('0x20')];}logger[_0xd7a2('0x13')]('['+[_0x4ffcf8[_0xd7a2('0x17')]()]+'],\x20getUser\x20crm',_0x2a584a);_0xe20c05(_0x2a584a);})[_0xd7a2('0x15')](function(_0x8e287e){logger['error']('['+[_0x4ffcf8[_0xd7a2('0x17')]()]+']',_0x8e287e['message']);_0xc8ec54(_0x8e287e[_0xd7a2('0x18')]);});}else{logger[_0xd7a2('0x13')]('['+[_0x4ffcf8['toUpperCase']()]+_0xd7a2('0x21'));_0x2a584a[_0xd7a2('0x1f')]=_0x2a584a[_0xd7a2('0x11')];_0x2a584a[_0xd7a2('0x1a')]=_0x2a584a['adminEmail'];_0xe20c05(_0x2a584a);}});};}function createEndUser(_0x1d445e,_0x19b165,_0x130e13,_0x3894f8,_0x24fee6){logger['info']('['+[_0x1d445e[_0xd7a2('0x17')]()]+_0xd7a2('0x22'),_0x130e13);return new Promise(function(_0x4def1d,_0x1583b6){var _0x557625={'method':_0xd7a2('0x23'),'uri':_0x3894f8+'sys_user?'+_0x24fee6,'body':{'user_name':_0x130e13[_0xd7a2('0x24')],'roles':_0xd7a2('0x25'),'first_name':_0x130e13['endUserNumber'],'active':'true','date_format':'System','phone':_0x130e13[_0xd7a2('0x24')]},'auth':_0x19b165,'json':!![]};return rp(_0x557625)[_0xd7a2('0xe')](function(_0x51bd33){logger[_0xd7a2('0x13')]('['+[_0x1d445e[_0xd7a2('0x17')]()]+'],\x20EndUser\x20schema',_0x51bd33['result']);_0x130e13[_0xd7a2('0x26')]=_0x51bd33[_0xd7a2('0xf')][_0xd7a2('0x12')];_0x4def1d(_0x130e13);})['catch'](function(_0x55328f){logger[_0xd7a2('0x16')]('['+[_0x1d445e['toUpperCase']()]+']',_0x55328f[_0xd7a2('0x18')]);_0x1583b6(_0x55328f[_0xd7a2('0x18')]);});});}function getEndUser(_0x5b9294,_0x8339c2,_0x1bccac,_0x1390bc,_0x26d5cf){return function(_0x64c3bc){logger['info']('['+[_0x5b9294[_0xd7a2('0x17')]()]+_0xd7a2('0x27'),_0x64c3bc);return new Promise(function(_0x340e7f,_0x4d3c58){var _0x2a9fcb={'method':_0xd7a2('0xc'),'uri':_0x1bccac+'sys_user?sysparm_query=phone%3D'+_0x64c3bc['endUserNumber']+'&'+_0x1390bc+'&'+_0x26d5cf,'auth':_0x8339c2,'json':!![]};return rp(_0x2a9fcb)[_0xd7a2('0xe')](function(_0x31d490){if(_0x31d490['result'][_0xd7a2('0x10')]>0x0){_0x64c3bc[_0xd7a2('0x26')]=_0x31d490[_0xd7a2('0xf')][0x0][_0xd7a2('0x12')];logger['info']('['+[_0x5b9294['toUpperCase']()]+_0xd7a2('0x28'),_0x64c3bc);_0x340e7f(_0x64c3bc);}else{return createEndUser(_0x5b9294,_0x8339c2,_0x64c3bc,_0x1bccac,_0x1390bc)[_0xd7a2('0xe')](function(_0x2e6fa3){logger[_0xd7a2('0x13')]('['+[_0x5b9294[_0xd7a2('0x17')]()]+_0xd7a2('0x29'),_0x2e6fa3);_0x340e7f(_0x2e6fa3);});}})[_0xd7a2('0x15')](function(_0x592ca6){logger[_0xd7a2('0x16')]('['+[_0x5b9294['toUpperCase']()]+']',_0x592ca6[_0xd7a2('0x18')]);_0x4d3c58(_0x592ca6[_0xd7a2('0x18')]);});});};}function getCustomFields(_0x577e06,_0xa064d2){var _0xc96d35={};if(_0x577e06['length']>0x0){_['forEach'](_0x577e06,function(_0x53d67a){if(_[_0xd7a2('0x2a')]([_0xd7a2('0x2b'),_0xd7a2('0x2c')],_0x53d67a[_0xd7a2('0x2d')])&&_0x53d67a[_0xd7a2('0x2e')]&&!_0x53d67a[_0xd7a2('0x2f')]){_0xc96d35[_0x53d67a[_0xd7a2('0x2e')]['toLowerCase']()]=_0x53d67a[_0xd7a2('0x30')][_0xd7a2('0x31')]();}else if(_[_0xd7a2('0x2a')]([_0xd7a2('0x2b'),_0xd7a2('0x2c')],_0x53d67a[_0xd7a2('0x2d')])&&_0x53d67a['idField']&&_0x53d67a[_0xd7a2('0x2f')]){_0xc96d35[_0x53d67a['idField'][_0xd7a2('0x32')]()]=_0x53d67a['content'][_0xd7a2('0x31')]();}else if(_0x53d67a['type']==='variable'&&_0x53d67a[_0xd7a2('0x33')]&&_0x53d67a['idField']&&_0x53d67a['customField']){_0xc96d35[_0x53d67a[_0xd7a2('0x34')][_0xd7a2('0x32')]()]=_0xa064d2[_0x53d67a[_0xd7a2('0x33')]]['toString']();}else if(_0x53d67a[_0xd7a2('0x2d')]===_0xd7a2('0x35')&&_0x53d67a['Variable']&&_0x53d67a[_0xd7a2('0x36')]['name']&&_0x53d67a[_0xd7a2('0x34')]&&_0x53d67a['customField']){_0xc96d35[_0x53d67a['idField'][_0xd7a2('0x32')]()]=_0xa064d2[_0x53d67a[_0xd7a2('0x36')][_0xd7a2('0x37')][_0xd7a2('0x32')]()][_0xd7a2('0x31')]();}});}return _0xc96d35;}function getTicket(_0x1df6c2,_0x414a60,_0x53f5ff,_0x2301c7,_0x445c8a,_0x22b8f4){return function(_0x3574a7){logger[_0xd7a2('0x13')]('['+[_0x1df6c2[_0xd7a2('0x17')]()]+_0xd7a2('0x38'),_0x3574a7);return new Promise(function(_0x2a6e67,_0x1d9232){var _0x743827=_0x1df6c2[_0xd7a2('0x32')]()==='outbound'?_0x3574a7[_0xd7a2('0x1f')]:_0x3574a7['endUserId'];var _0x22d626={'method':_0xd7a2('0x23'),'uri':_0x53f5ff+_0xd7a2('0x39')+'?'+_0x22b8f4,'body':Object[_0xd7a2('0x3a')]({},{'active':_0xd7a2('0x1e'),'caller_id':_0x743827,'assigned_to':_0x3574a7[_0xd7a2('0x1f')],'short_description':intUtil[_0xd7a2('0x3b')](_0x2301c7['Subjects'],_0x445c8a,'\x20'),'description':intUtil[_0xd7a2('0x3b')](_0x2301c7[_0xd7a2('0x3c')],_0x445c8a,'\x0a')},getCustomFields(_0x2301c7[_0xd7a2('0x3d')],_0x445c8a)),'auth':_0x414a60,'json':!![]};return rp(_0x22d626)['then'](function(_0xaee636){logger['info']('['+[_0x1df6c2[_0xd7a2('0x17')]()]+_0xd7a2('0x3e'),_0xaee636['result']);_0x3574a7[_0xd7a2('0x3f')]=_0xaee636[_0xd7a2('0xf')]['sys_id'];_0x3574a7['ticketNumber']=_0xaee636['result'][_0xd7a2('0x40')];logger[_0xd7a2('0x13')]('['+[_0x1df6c2[_0xd7a2('0x17')]()]+']\x20getTicket\x20crm',_0x3574a7);_0x2a6e67(_0x3574a7);})[_0xd7a2('0x15')](function(_0x31dd4b){logger['error']('['+[_0x1df6c2[_0xd7a2('0x17')]()]+']',_0x31dd4b[_0xd7a2('0x18')]);_0x1d9232(_0x31dd4b[_0xd7a2('0x18')]);});});};}function createRemoteTag(_0x32fb57,_0x48ec65,_0x4afd98,_0x1f4af9){return new Promise(function(_0x30f29b,_0x345bea){var _0x16d4b0={'method':_0xd7a2('0x23'),'uri':_0x4afd98+_0xd7a2('0x41')+'?'+_0x1f4af9,'body':{'short_description':_0x32fb57,'global':!![],'active':!![],'name':_0x32fb57},'auth':_0x48ec65,'json':!![]};return rp(_0x16d4b0)[_0xd7a2('0xe')](function(_0x378da8){var _0x4e7515=_0x378da8[_0xd7a2('0xf')]['sys_id'];_0x30f29b(_0x4e7515);});});}function getRemoteTag(_0x3983cb,_0x1604c1,_0x334581,_0x242f02,_0x682696){return new Promise(function(_0x23522b,_0x1f5f76){var _0x14d464={'method':_0xd7a2('0xc'),'uri':_0x334581+_0xd7a2('0x41')+_0xd7a2('0x42')+_0x3983cb+'&'+_0x242f02,'auth':_0x1604c1,'json':!![]};return rp(_0x14d464)['then'](function(_0x3cf7ca){if(_0x3cf7ca['result']['length']>0x0){var _0x31495f=_0x3cf7ca[_0xd7a2('0xf')][0x0][_0xd7a2('0x12')];_0x23522b(_0x31495f);}else{return createRemoteTag(_0x3983cb,_0x1604c1,_0x334581,_0x242f02)[_0xd7a2('0xe')](function(_0x1e8e03){_0x23522b(_0x1e8e03);});}});});}function assignTagToIncident(_0x43235b,_0x247228,_0x589663,_0x3f37d2,_0x4dc668){return new Promise(function(_0xde176c,_0x5e141b){var _0x37d993={'method':_0xd7a2('0x23'),'uri':_0x589663+'label_entry'+'?'+_0x4dc668,'body':{'label':_0x43235b,'table':_0xd7a2('0x39'),'id_type':'Incident','table_key':_0x3f37d2[_0xd7a2('0x3f')],'title':_0xd7a2('0x43')+_0x3f37d2[_0xd7a2('0x44')],'id_display':_0x3f37d2[_0xd7a2('0x44')]},'auth':_0x247228,'json':!![]};return rp(_0x37d993)[_0xd7a2('0xe')](function(_0xdfdf07){_0xde176c();})[_0xd7a2('0x15')](function(){_0xde176c();});});}function manageTags(_0x448d9f,_0xb54ac9,_0x321bfd,_0x74a367,_0x3eab16,_0x53e34a,_0x35f950){return new Promise(function(_0x4e269a,_0x354503){var _0x2872e3=[];_0xb54ac9[_0xd7a2('0x45')](function(_0x2c769f){_0x2872e3[_0xd7a2('0x46')](getRemoteTag(_0x2c769f,_0x321bfd,_0x74a367,_0x53e34a,_0x35f950));});return Promise[_0xd7a2('0x47')](_0x2872e3)['then'](function(_0x510009){if(_0x510009['length']){logger['info']('['+[_0x448d9f['toUpperCase']()]+_0xd7a2('0x48'),_0x510009);var _0x44e813=[];_0x510009[_0xd7a2('0x45')](function(_0x435252){_0x44e813['push'](assignTagToIncident(_0x435252,_0x321bfd,_0x74a367,_0x3eab16,_0x53e34a));});return Promise['all'](_0x44e813)[_0xd7a2('0xe')](function(){_0x4e269a();})['catch'](function(){_0x4e269a();});}else{_0x4e269a();}});});}function getTags(_0x5ed67b,_0x5db93a,_0x475240,_0x36b73a,_0x1b7fd6,_0x30fb10){return function(_0x38ab8e){return new Promise(function(_0x503c49,_0x307520){var _0x4eed8c=[];var _0x275c54=_0x36b73a[_0xd7a2('0x49')];if(_0x275c54&&_0x275c54['length']>0x0){_0x4eed8c=_[_0xd7a2('0x4a')](_0x275c54,_0xd7a2('0x37'));}if(_0x4eed8c[_0xd7a2('0x10')]>0x0){return manageTags(_0x5ed67b,_0x4eed8c,_0x5db93a,_0x475240,_0x38ab8e,_0x1b7fd6,_0x30fb10)['then'](function(){_0x503c49(_0x38ab8e);});}else{_0x503c49(_0x38ab8e);}});};}function emit(_0x1e5a5b,_0x4329a4,_0x17c354){var _0x3c252d=_0xd7a2('0x4b')+_0xd7a2('0x4c')+_0xd7a2('0x4d')+'%255EORDERBYDESCnumber';var _0x71d925={'uri':_0x1e5a5b+_0xd7a2('0x4e')+_0x17c354+_0x3c252d};io['to'](util['format'](_0xd7a2('0x4f'),_0x4329a4))[_0xd7a2('0x50')]('trigger:browser:url',_0x71d925);}exports['cs']=function(_0x3de448,_0x3f8afa,_0x3fd34d,_0x1b646b,_0x432615,_0x467eaa,_0x4d0032,_0x1af028){var _0x40a3ae={};var _0x315f1c={'user':_0x467eaa['username'],'pass':_0x467eaa['password']};var _0x1edd37=_0xd7a2('0x51');var _0x456504=_0xd7a2('0x52');_0x467eaa['remoteUri']=intUtil[_0xd7a2('0x53')](_0x467eaa['remoteUri']);_0x467eaa['serverUrl']=intUtil[_0xd7a2('0x53')](_0x467eaa[_0xd7a2('0x54')]);var _0x21b255=util[_0xd7a2('0x55')](_0xd7a2('0x56'),_0x467eaa[_0xd7a2('0x57')]);_0x40a3ae[_0xd7a2('0x1a')]=!_[_0xd7a2('0x58')](_0x1b646b)?_0x1b646b[_0xd7a2('0x59')]:null;_0x40a3ae[_0xd7a2('0x20')]=_0x467eaa[_0xd7a2('0x59')];_0x40a3ae[_0xd7a2('0x24')]=_0x1af028[_0xd7a2('0x32')]()==='outbound'?_0x3f8afa['destcalleridnum']:_0x3f8afa[_0xd7a2('0x5a')];_0x40a3ae['callDirection']=_0x1af028===_0xd7a2('0x5b')||_0x1af028===_0xd7a2('0x5c')?_0xd7a2('0x5b'):_0xd7a2('0x5d');var _0x158fbd=util[_0xd7a2('0x55')](_0xd7a2('0x5e'),_0x467eaa[_0xd7a2('0x54')],_0x3f8afa[_0xd7a2('0x5f')],md5(_0x3f8afa[_0xd7a2('0x5f')]));if(_0x432615&&_0x432615[_0xd7a2('0x60')]){logger[_0xd7a2('0x13')]('[QUEUE]',_0xd7a2('0x61'));_0x3f8afa[_0xd7a2('0x62')]=_0x158fbd;}else if(_0x4d0032&&_0x4d0032[_0xd7a2('0x63')]&&_0x4d0032[_0xd7a2('0x63')]!=='none'){logger['info'](_0xd7a2('0x64'),_0xd7a2('0x61'));_0x3f8afa[_0xd7a2('0x62')]=_0x158fbd;}else{_0x3f8afa[_0xd7a2('0x62')]='';}return getAdminUser(_0x1af028,_0x315f1c,_0x40a3ae,_0x21b255,_0x456504,_0x1edd37)[_0xd7a2('0xe')](getUser(_0x1af028,_0x315f1c,_0x21b255,_0x456504,_0x1edd37))[_0xd7a2('0xe')](getEndUser(_0x1af028,_0x315f1c,_0x21b255,_0x456504,_0x1edd37))[_0xd7a2('0xe')](getTicket(_0x1af028,_0x315f1c,_0x21b255,_0x3fd34d,_0x3f8afa,_0x456504))[_0xd7a2('0xe')](function(_0x36f28a){logger[_0xd7a2('0x13')](util['format'](_0xd7a2('0x65'),_0x36f28a[_0xd7a2('0x3f')]));logger[_0xd7a2('0x13')](util[_0xd7a2('0x55')](_0xd7a2('0x66'),_0x1af028));if(_0x1af028!=='unmanaged'){logger[_0xd7a2('0x13')]('['+[_0x1af028[_0xd7a2('0x17')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x467eaa['remoteUri'],_0x1b646b[_0xd7a2('0x37')],_0x36f28a[_0xd7a2('0x3f')]);}})[_0xd7a2('0x15')](function(_0x1b33ec){logger[_0xd7a2('0x16')]('['+[_0x1af028[_0xd7a2('0x17')]()]+_0xd7a2('0x67'),util[_0xd7a2('0x68')](_0x1b33ec,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7377=['recordingFormat','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','sys_user?sysparm_query=email%3D','userEmail','then','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','customField','content','toString','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0x7377,0x1bc));var _0x7737=function(_0x4b3230,_0x1afbb1){_0x4b3230=_0x4b3230-0x0;var _0x3dde7e=_0x7377[_0x4b3230];return _0x3dde7e;};'use strict';var _=require(_0x7737('0x0'));var Promise=require(_0x7737('0x1'));var rp=require('request-promise');var util=require(_0x7737('0x2'));var md5=require(_0x7737('0x3'));var Redis=require(_0x7737('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x7737('0x5'))(_0x7737('0x6'));config[_0x7737('0x7')]=_[_0x7737('0x8')](config['redis'],{'host':_0x7737('0x9'),'port':0x18eb});var io=require(_0x7737('0xa'))(new Redis(config['redis']));function getAdminUser(_0x2a0b2f,_0x451c4f,_0x2933b8,_0x3e5635,_0x3e8328,_0x496903){return new Promise(function(_0x8d230a,_0x1647d1){var _0x157be4={'method':_0x7737('0xb'),'uri':_0x3e5635+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3e8328+'&'+_0x496903,'auth':_0x451c4f,'json':!![]};return rp(_0x157be4)['then'](function(_0x46dc6a){if(_0x46dc6a[_0x7737('0xc')][_0x7737('0xd')]>0x0){_0x2933b8[_0x7737('0xe')]=_0x46dc6a[_0x7737('0xc')][0x0][_0x7737('0xf')];}logger[_0x7737('0x10')]('['+[_0x2a0b2f[_0x7737('0x11')]()]+_0x7737('0x12'),_0x2933b8);_0x8d230a(_0x2933b8);})[_0x7737('0x13')](function(_0x5eb0e2){logger[_0x7737('0x14')]('['+[_0x2a0b2f[_0x7737('0x11')]()]+']',_0x5eb0e2['message']);_0x1647d1(_0x5eb0e2[_0x7737('0x15')]);});});}function getUser(_0x395927,_0x110752,_0x42aa71,_0x40785e,_0x42ab3b){return function(_0xa2425b){logger[_0x7737('0x10')]('['+[_0x395927[_0x7737('0x11')]()]+'],\x20getUser\x20input\x20crm',_0xa2425b);return new Promise(function(_0x48f08f,_0x4ee30a){if(intUtil[_0x7737('0x16')](_0xa2425b['userEmail'])){var _0x19247d={'method':_0x7737('0xb'),'uri':_0x42aa71+_0x7737('0x17')+_0xa2425b[_0x7737('0x18')]+'&'+_0x40785e+'&'+_0x42ab3b,'auth':_0x110752,'json':!![]};logger[_0x7737('0x10')]('['+[_0x395927[_0x7737('0x11')]()]+'],\x20getUser\x20rp\x20obj',_0x19247d);return rp(_0x19247d)[_0x7737('0x19')](function(_0x1f5b6b){logger[_0x7737('0x10')]('['+[_0x395927[_0x7737('0x11')]()]+'],\x20getUser\x20entity',_0x1f5b6b);if(_0x1f5b6b[_0x7737('0xc')]['length']>0x0&&String(_0x1f5b6b[_0x7737('0xc')][0x0][_0x7737('0x1a')])===_0x7737('0x1b')){_0xa2425b[_0x7737('0x1c')]=_0x1f5b6b[_0x7737('0xc')][0x0][_0x7737('0xf')];}else{_0xa2425b[_0x7737('0x1c')]=_0xa2425b[_0x7737('0xe')];_0xa2425b[_0x7737('0x18')]=_0xa2425b['adminEmail'];}logger[_0x7737('0x10')]('['+[_0x395927['toUpperCase']()]+_0x7737('0x1d'),_0xa2425b);_0x48f08f(_0xa2425b);})[_0x7737('0x13')](function(_0x4a28ff){logger[_0x7737('0x14')]('['+[_0x395927[_0x7737('0x11')]()]+']',_0x4a28ff[_0x7737('0x15')]);_0x4ee30a(_0x4a28ff[_0x7737('0x15')]);});}else{logger[_0x7737('0x10')]('['+[_0x395927[_0x7737('0x11')]()]+_0x7737('0x1e'));_0xa2425b['userId']=_0xa2425b['adminId'];_0xa2425b['userEmail']=_0xa2425b[_0x7737('0x1f')];_0x48f08f(_0xa2425b);}});};}function createEndUser(_0x33ea64,_0xde7609,_0x4e9bff,_0x5f2410,_0x262c76){logger[_0x7737('0x10')]('['+[_0x33ea64[_0x7737('0x11')]()]+_0x7737('0x20'),_0x4e9bff);return new Promise(function(_0x6a82b8,_0x3a03e0){var _0x5d31a1={'method':_0x7737('0x21'),'uri':_0x5f2410+_0x7737('0x22')+_0x262c76,'body':{'user_name':_0x4e9bff[_0x7737('0x23')],'roles':_0x7737('0x24'),'first_name':_0x4e9bff[_0x7737('0x23')],'active':_0x7737('0x1b'),'date_format':_0x7737('0x25'),'phone':_0x4e9bff[_0x7737('0x23')]},'auth':_0xde7609,'json':!![]};return rp(_0x5d31a1)[_0x7737('0x19')](function(_0x598391){logger[_0x7737('0x10')]('['+[_0x33ea64[_0x7737('0x11')]()]+_0x7737('0x26'),_0x598391[_0x7737('0xc')]);_0x4e9bff[_0x7737('0x27')]=_0x598391[_0x7737('0xc')][_0x7737('0xf')];_0x6a82b8(_0x4e9bff);})[_0x7737('0x13')](function(_0x105240){logger[_0x7737('0x14')]('['+[_0x33ea64[_0x7737('0x11')]()]+']',_0x105240[_0x7737('0x15')]);_0x3a03e0(_0x105240[_0x7737('0x15')]);});});}function getEndUser(_0xde80cd,_0x507245,_0x2b3915,_0x1ebcfa,_0x48c7c4){return function(_0x49e16a){logger[_0x7737('0x10')]('['+[_0xde80cd[_0x7737('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x49e16a);return new Promise(function(_0x489180,_0x1db652){var _0x15fe26={'method':_0x7737('0xb'),'uri':_0x2b3915+_0x7737('0x28')+_0x49e16a[_0x7737('0x23')]+'&'+_0x1ebcfa+'&'+_0x48c7c4,'auth':_0x507245,'json':!![]};return rp(_0x15fe26)[_0x7737('0x19')](function(_0x5684f7){if(_0x5684f7[_0x7737('0xc')][_0x7737('0xd')]>0x0){_0x49e16a[_0x7737('0x27')]=_0x5684f7['result'][0x0][_0x7737('0xf')];logger[_0x7737('0x10')]('['+[_0xde80cd['toUpperCase']()]+_0x7737('0x29'),_0x49e16a);_0x489180(_0x49e16a);}else{return createEndUser(_0xde80cd,_0x507245,_0x49e16a,_0x2b3915,_0x1ebcfa)[_0x7737('0x19')](function(_0x2057f2){logger[_0x7737('0x10')]('['+[_0xde80cd['toUpperCase']()]+_0x7737('0x2a'),_0x2057f2);_0x489180(_0x2057f2);});}})[_0x7737('0x13')](function(_0x460cd8){logger[_0x7737('0x14')]('['+[_0xde80cd[_0x7737('0x11')]()]+']',_0x460cd8['message']);_0x1db652(_0x460cd8[_0x7737('0x15')]);});});};}function getCustomFields(_0x233d03,_0x5aa598){var _0x4eb515={};if(_0x233d03['length']>0x0){_['forEach'](_0x233d03,function(_0x53113c){if(_[_0x7737('0x2b')]([_0x7737('0x2c'),_0x7737('0x2d')],_0x53113c[_0x7737('0x2e')])&&_0x53113c[_0x7737('0x2f')]&&!_0x53113c[_0x7737('0x30')]){_0x4eb515[_0x53113c[_0x7737('0x2f')]['toLowerCase']()]=_0x53113c[_0x7737('0x31')][_0x7737('0x32')]();}else if(_[_0x7737('0x2b')]([_0x7737('0x2c'),_0x7737('0x2d')],_0x53113c[_0x7737('0x2e')])&&_0x53113c[_0x7737('0x33')]&&_0x53113c[_0x7737('0x30')]){_0x4eb515[_0x53113c[_0x7737('0x33')][_0x7737('0x34')]()]=_0x53113c['content'][_0x7737('0x32')]();}else if(_0x53113c[_0x7737('0x2e')]===_0x7737('0x35')&&_0x53113c[_0x7737('0x36')]&&_0x53113c[_0x7737('0x33')]&&_0x53113c['customField']){_0x4eb515[_0x53113c['idField'][_0x7737('0x34')]()]=_0x5aa598[_0x53113c[_0x7737('0x36')]][_0x7737('0x32')]();}else if(_0x53113c['type']===_0x7737('0x37')&&_0x53113c[_0x7737('0x38')]&&_0x53113c['Variable'][_0x7737('0x39')]&&_0x53113c['idField']&&_0x53113c[_0x7737('0x30')]){_0x4eb515[_0x53113c[_0x7737('0x33')][_0x7737('0x34')]()]=_0x5aa598[_0x53113c['Variable'][_0x7737('0x39')][_0x7737('0x34')]()][_0x7737('0x32')]();}});}return _0x4eb515;}function getTicket(_0x3a88cb,_0x4e2585,_0x4eec48,_0x21423b,_0x3bdce8,_0x3a25c1){return function(_0x3eece4){logger[_0x7737('0x10')]('['+[_0x3a88cb['toUpperCase']()]+_0x7737('0x3a'),_0x3eece4);return new Promise(function(_0x12e68c,_0x3cbc10){var _0x10b384=_0x3a88cb[_0x7737('0x34')]()==='outbound'?_0x3eece4[_0x7737('0x1c')]:_0x3eece4['endUserId'];var _0x45ae25={'method':'POST','uri':_0x4eec48+_0x7737('0x3b')+'?'+_0x3a25c1,'body':Object[_0x7737('0x3c')]({},{'active':_0x7737('0x1b'),'caller_id':_0x10b384,'assigned_to':_0x3eece4['userId'],'short_description':intUtil[_0x7737('0x3d')](_0x21423b[_0x7737('0x3e')],_0x3bdce8,'\x20'),'description':intUtil[_0x7737('0x3d')](_0x21423b[_0x7737('0x3f')],_0x3bdce8,'\x0a')},getCustomFields(_0x21423b[_0x7737('0x40')],_0x3bdce8)),'auth':_0x4e2585,'json':!![]};return rp(_0x45ae25)[_0x7737('0x19')](function(_0x189ced){logger[_0x7737('0x10')]('['+[_0x3a88cb[_0x7737('0x11')]()]+_0x7737('0x41'),_0x189ced['result']);_0x3eece4[_0x7737('0x42')]=_0x189ced[_0x7737('0xc')][_0x7737('0xf')];_0x3eece4[_0x7737('0x43')]=_0x189ced['result'][_0x7737('0x44')];logger[_0x7737('0x10')]('['+[_0x3a88cb[_0x7737('0x11')]()]+']\x20getTicket\x20crm',_0x3eece4);_0x12e68c(_0x3eece4);})['catch'](function(_0x12014e){logger['error']('['+[_0x3a88cb[_0x7737('0x11')]()]+']',_0x12014e[_0x7737('0x15')]);_0x3cbc10(_0x12014e[_0x7737('0x15')]);});});};}function createRemoteTag(_0x2870ba,_0x255f52,_0x3e1d91,_0x21ad8e){return new Promise(function(_0x22dcf3,_0x1c95ef){var _0x1d220c={'method':_0x7737('0x21'),'uri':_0x3e1d91+_0x7737('0x45')+'?'+_0x21ad8e,'body':{'short_description':_0x2870ba,'global':!![],'active':!![],'name':_0x2870ba},'auth':_0x255f52,'json':!![]};return rp(_0x1d220c)[_0x7737('0x19')](function(_0x1c3527){var _0x42f3aa=_0x1c3527[_0x7737('0xc')][_0x7737('0xf')];_0x22dcf3(_0x42f3aa);});});}function getRemoteTag(_0x2cc3a8,_0x46467c,_0x53371e,_0xfb8641,_0x182824){return new Promise(function(_0x45c269,_0x131c1d){var _0x3556d={'method':_0x7737('0xb'),'uri':_0x53371e+'label'+_0x7737('0x46')+_0x2cc3a8+'&'+_0xfb8641,'auth':_0x46467c,'json':!![]};return rp(_0x3556d)[_0x7737('0x19')](function(_0x4546d4){if(_0x4546d4[_0x7737('0xc')][_0x7737('0xd')]>0x0){var _0x2ef4e5=_0x4546d4[_0x7737('0xc')][0x0][_0x7737('0xf')];_0x45c269(_0x2ef4e5);}else{return createRemoteTag(_0x2cc3a8,_0x46467c,_0x53371e,_0xfb8641)[_0x7737('0x19')](function(_0xfe761c){_0x45c269(_0xfe761c);});}});});}function assignTagToIncident(_0x201957,_0x14753b,_0x39f80b,_0x176f4a,_0x76458f){return new Promise(function(_0x4999b6,_0x422aea){var _0x244605={'method':'POST','uri':_0x39f80b+_0x7737('0x47')+'?'+_0x76458f,'body':{'label':_0x201957,'table':_0x7737('0x3b'),'id_type':_0x7737('0x48'),'table_key':_0x176f4a[_0x7737('0x42')],'title':_0x7737('0x49')+_0x176f4a[_0x7737('0x43')],'id_display':_0x176f4a['ticketNumber']},'auth':_0x14753b,'json':!![]};return rp(_0x244605)[_0x7737('0x19')](function(_0x437548){_0x4999b6();})[_0x7737('0x13')](function(){_0x4999b6();});});}function manageTags(_0x108ecc,_0x385b1d,_0x2dc4ce,_0x4204fd,_0x116369,_0x82bce3,_0x3e1017){return new Promise(function(_0x28c0bb,_0x3d9bee){var _0x14b3a5=[];_0x385b1d[_0x7737('0x4a')](function(_0xa0422){_0x14b3a5[_0x7737('0x4b')](getRemoteTag(_0xa0422,_0x2dc4ce,_0x4204fd,_0x82bce3,_0x3e1017));});return Promise[_0x7737('0x4c')](_0x14b3a5)['then'](function(_0x407492){if(_0x407492['length']){logger[_0x7737('0x10')]('['+[_0x108ecc['toUpperCase']()]+_0x7737('0x4d'),_0x407492);var _0x3c1164=[];_0x407492[_0x7737('0x4a')](function(_0x24950d){_0x3c1164[_0x7737('0x4b')](assignTagToIncident(_0x24950d,_0x2dc4ce,_0x4204fd,_0x116369,_0x82bce3));});return Promise[_0x7737('0x4c')](_0x3c1164)['then'](function(){_0x28c0bb();})[_0x7737('0x13')](function(){_0x28c0bb();});}else{_0x28c0bb();}});});}function getTags(_0x4cc586,_0x55b542,_0x44a653,_0x5152c1,_0x1911ce,_0x1517a2){return function(_0x5c4ec3){return new Promise(function(_0x4314a3,_0x368ba3){var _0x17c770=[];var _0x359614=_0x5152c1[_0x7737('0x4e')];if(_0x359614&&_0x359614['length']>0x0){_0x17c770=_[_0x7737('0x4f')](_0x359614,_0x7737('0x39'));}if(_0x17c770[_0x7737('0xd')]>0x0){return manageTags(_0x4cc586,_0x17c770,_0x55b542,_0x44a653,_0x5c4ec3,_0x1911ce,_0x1517a2)[_0x7737('0x19')](function(){_0x4314a3(_0x5c4ec3);});}else{_0x4314a3(_0x5c4ec3);}});};}function emit(_0x2cf5fd,_0x59f095,_0x591e24){var _0x945294=_0x7737('0x50')+_0x7737('0x51')+_0x7737('0x52')+_0x7737('0x53');var _0x1fe758={'uri':_0x2cf5fd+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x591e24+_0x945294};io['to'](util[_0x7737('0x54')](_0x7737('0x55'),_0x59f095))[_0x7737('0x56')](_0x7737('0x57'),_0x1fe758);}exports['cs']=function(_0x453c98,_0x1a76e8,_0x51fc15,_0x396f6b,_0x23fe1d,_0x56b103,_0x5b2161,_0x13b88c){var _0x2bf554={};var _0x1f1378={'user':_0x56b103[_0x7737('0x58')],'pass':_0x56b103[_0x7737('0x59')]};var _0x2a7b1f='sysparm_limit=1';var _0x3487eb=_0x7737('0x5a');_0x56b103[_0x7737('0x5b')]=intUtil[_0x7737('0x5c')](_0x56b103[_0x7737('0x5b')]);_0x56b103['serverUrl']=intUtil['stripTrailingSlash'](_0x56b103[_0x7737('0x5d')]);var _0x44180e=util[_0x7737('0x54')]('%s/api/now/table/',_0x56b103[_0x7737('0x5b')]);_0x2bf554['userEmail']=!_[_0x7737('0x5e')](_0x396f6b)?_0x396f6b[_0x7737('0x5f')]:null;_0x2bf554[_0x7737('0x1f')]=_0x56b103[_0x7737('0x5f')];_0x2bf554['endUserNumber']=_0x13b88c[_0x7737('0x34')]()==='outbound'?_0x1a76e8[_0x7737('0x60')]:_0x1a76e8[_0x7737('0x61')];_0x2bf554['callDirection']=_0x13b88c===_0x7737('0x62')||_0x13b88c===_0x7737('0x63')?'queue':'outbound';var _0x59c136=util[_0x7737('0x54')](_0x7737('0x64'),_0x56b103[_0x7737('0x5d')],_0x1a76e8[_0x7737('0x65')],md5(_0x1a76e8[_0x7737('0x65')]));if(_0x23fe1d&&_0x23fe1d[_0x7737('0x66')]){logger[_0x7737('0x10')](_0x7737('0x67'),_0x7737('0x68'));_0x1a76e8[_0x7737('0x69')]=_0x59c136;}else if(_0x5b2161&&_0x5b2161[_0x7737('0x6a')]&&_0x5b2161['recordingFormat']!=='none'){logger[_0x7737('0x10')]('[OUTBOUND]',_0x7737('0x68'));_0x1a76e8[_0x7737('0x69')]=_0x59c136;}else{_0x1a76e8[_0x7737('0x69')]='';}return getAdminUser(_0x13b88c,_0x1f1378,_0x2bf554,_0x44180e,_0x3487eb,_0x2a7b1f)[_0x7737('0x19')](getUser(_0x13b88c,_0x1f1378,_0x44180e,_0x3487eb,_0x2a7b1f))[_0x7737('0x19')](getEndUser(_0x13b88c,_0x1f1378,_0x44180e,_0x3487eb,_0x2a7b1f))[_0x7737('0x19')](getTicket(_0x13b88c,_0x1f1378,_0x44180e,_0x51fc15,_0x1a76e8,_0x3487eb))[_0x7737('0x19')](function(_0x2d8d28){logger['info'](util[_0x7737('0x54')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2d8d28['ticketId']));logger[_0x7737('0x10')](util[_0x7737('0x54')]('call\x20direction:\x20%s',_0x13b88c));if(_0x13b88c!==_0x7737('0x63')){logger['info']('['+[_0x13b88c[_0x7737('0x11')]()]+']',_0x7737('0x6b'));emit(_0x56b103['remoteUri'],_0x396f6b['name'],_0x2d8d28[_0x7737('0x42')]);}})[_0x7737('0x13')](function(_0x4ddabe){logger[_0x7737('0x14')]('['+[_0x13b88c['toUpperCase']()]+_0x7737('0x6c'),util[_0x7737('0x6d')](_0x4ddabe,{'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 125c6bd..b5d6994 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 _0xdc04=['Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','string','nameField','customField','content','type','custom_fields','idField','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','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','The\x20User\x20ID\x20is:','calleridname','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','trigger:browser:url','unmanaged','%s/service/v4_1/rest.php','lastevent','toUpperCase','isNil','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','POST','emit','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value'];(function(_0x4c5cc5,_0x40004e){var _0x2ef537=function(_0xbfb69b){while(--_0xbfb69b){_0x4c5cc5['push'](_0x4c5cc5['shift']());}};_0x2ef537(++_0x40004e);}(_0xdc04,0x1d3));var _0x4dc0=function(_0x17954d,_0x323089){_0x17954d=_0x17954d-0x0;var _0x1e1a29=_0xdc04[_0x17954d];return _0x1e1a29;};'use strict';var _=require(_0x4dc0('0x0'));var rp=require(_0x4dc0('0x1'));var BPromise=require(_0x4dc0('0x2'));var md5=require(_0x4dc0('0x3'));var util=require(_0x4dc0('0x4'));var Redis=require(_0x4dc0('0x5'));var intUtil=require(_0x4dc0('0x6'));var config=require(_0x4dc0('0x7'));var logger=require(_0x4dc0('0x8'))('sugarcrm');config[_0x4dc0('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4dc0('0xa'))(new Redis(config[_0x4dc0('0x9')]));var def={'method':_0x4dc0('0xb'),'json':!![]};function emit(_0x3c06c4,_0x468858,_0x57789f){io['to'](_0x3c06c4)[_0x4dc0('0xc')](_0x468858,_0x57789f);}function getTicket(_0x2a2d3a,_0x3a80cb,_0x469244,_0x59ff00,_0x3e1c4f,_0x54792e,_0x385bf8,_0x1f775c){logger['info']('Creating\x20new\x20ticket...');var _0x140537=new Date();var _0xdc9c16=[{'name':_0x4dc0('0xd'),'value':intUtil[_0x4dc0('0xe')](_0x59ff00[_0x4dc0('0xf')],_0x3e1c4f,'\x20')},{'name':_0x4dc0('0x10'),'value':_0x3a80cb['id']},{'name':_0x4dc0('0x11'),'value':_0x3a80cb['id']},{'name':_0x4dc0('0x12'),'value':intUtil['getString'](_0x59ff00[_0x4dc0('0x13')],_0x3e1c4f,'\x0a')},{'name':'date_start','value':_0x140537[_0x4dc0('0x14')]()[_0x4dc0('0x15')](0x0,0x13)[_0x4dc0('0x16')]('T','\x20')},{'name':_0x4dc0('0x17'),'value':'0'},{'name':_0x4dc0('0x18'),'value':'15'},{'name':_0x4dc0('0x19'),'value':_0x469244['id']},{'name':_0x4dc0('0x1a'),'value':_0x4dc0('0x1b')},{'name':_0x4dc0('0x1c'),'value':_0x469244[_0x4dc0('0xd')]},{'name':'direction','value':_0x1f775c}];if(_0x54792e[_0x4dc0('0x1d')]){_[_0x4dc0('0x1e')](_0x54792e,function(_0x5d4e13){if(_0x3e1c4f[_0x5d4e13[_0x4dc0('0x1f')]]){_0xdc9c16[_0x4dc0('0x20')]({'name':_0x5d4e13['idField'],'value':_0x3e1c4f[_0x5d4e13[_0x4dc0('0x1f')]]});}});}return request({'form':{'method':_0x4dc0('0x21'),'input_type':_0x4dc0('0x22'),'response_type':_0x4dc0('0x22'),'rest_data':JSON[_0x4dc0('0x23')]({'session':_0x385bf8['id'],'module_name':_0x4dc0('0x24'),'name_value_list':_0xdc9c16})}});}function getAuth(_0x4f8d0f){return util[_0x4dc0('0x25')](_0x4dc0('0x26'),new Buffer(_0x4f8d0f[_0x4dc0('0x27')]+':X')[_0x4dc0('0x28')](_0x4dc0('0x29')));}function getServerInfo(_0x3360a6){return request({'form':{'method':_0x4dc0('0x2a'),'input_type':_0x4dc0('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3360a6['id']})}});}function getUser(_0x3938df,_0x4a7b3f,_0x136fb1){if(!_['isNil'](_0x4a7b3f)){logger[_0x4dc0('0x2b')](_0x4dc0('0x2c'),_0x4a7b3f);return request({'form':{'method':_0x4dc0('0x2d'),'input_type':_0x4dc0('0x22'),'response_type':_0x4dc0('0x22'),'rest_data':JSON[_0x4dc0('0x23')]({'session':_0x136fb1['id'],'module_name':_0x4dc0('0x2e'),'query':util[_0x4dc0('0x25')](_0x4dc0('0x2f'),_0x4a7b3f),'order_by':'','offset':'0','select_fields':['id',_0x4dc0('0xd'),_0x4dc0('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4dc0('0x31')](function(_0x7a42f9){if(_0x7a42f9[_0x4dc0('0x32')]['length']){var _0x43a6a4=_['find'](_0x7a42f9['entry_list'],function(_0x8b3c5b){return _0x8b3c5b[_0x4dc0('0x33')][_0x4dc0('0x30')][_0x4dc0('0x34')]===_0x4a7b3f;});if(_0x43a6a4){logger[_0x4dc0('0x2b')](_0x4dc0('0x35'));return BPromise[_0x4dc0('0x36')]({'id':_0x43a6a4[_0x4dc0('0x33')]['id'][_0x4dc0('0x34')],'name':_0x43a6a4[_0x4dc0('0x33')][_0x4dc0('0xd')][_0x4dc0('0x34')]});}}logger[_0x4dc0('0x2b')](_0x4dc0('0x37'));return BPromise['resolve']({'id':_0x136fb1['name_value_list'][_0x4dc0('0x38')][_0x4dc0('0x34')],'name':_0x136fb1[_0x4dc0('0x33')][_0x4dc0('0x30')][_0x4dc0('0x34')]});});}else{logger[_0x4dc0('0x2b')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x136fb1[_0x4dc0('0x33')]['user_id'][_0x4dc0('0x34')],'name':_0x136fb1[_0x4dc0('0x33')][_0x4dc0('0x30')][_0x4dc0('0x34')]});}}function getEndUser(_0x2d3061,_0x30d78d,_0x2557d3,_0x5cda8b){logger['info'](_0x4dc0('0x39'),_0x2557d3);return request({'form':{'method':_0x4dc0('0x2d'),'input_type':_0x4dc0('0x22'),'response_type':'JSON','rest_data':JSON[_0x4dc0('0x23')]({'session':_0x5cda8b['id'],'module_name':'Contacts','query':util[_0x4dc0('0x25')](_0x4dc0('0x3a'),_0x2557d3),'order_by':'','offset':'0','select_fields':['id',_0x4dc0('0xd'),_0x4dc0('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4dc0('0x31')](function(_0x22905e){if(_0x22905e[_0x4dc0('0x32')][_0x4dc0('0x1d')]){var _0x431402=_[_0x4dc0('0x3c')](_0x22905e[_0x4dc0('0x32')],function(_0x12f5a3){return _0x12f5a3[_0x4dc0('0x33')][_0x4dc0('0x3b')][_0x4dc0('0x34')]===_0x2557d3;});if(_0x431402){logger[_0x4dc0('0x2b')](_0x4dc0('0x3d'));return BPromise[_0x4dc0('0x36')]({'id':_0x431402[_0x4dc0('0x33')]['id'][_0x4dc0('0x34')],'name':_0x431402[_0x4dc0('0x33')][_0x4dc0('0xd')]['value'],'phone':_0x431402[_0x4dc0('0x33')]['phone_home'][_0x4dc0('0x34')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x4dc0('0x21'),'input_type':_0x4dc0('0x22'),'response_type':_0x4dc0('0x22'),'rest_data':JSON[_0x4dc0('0x23')]({'session':_0x5cda8b['id'],'module_name':_0x4dc0('0x1b'),'name_value_list':[{'name':'first_name','value':_0x30d78d!==_0x4dc0('0x3e')?_0x30d78d:util[_0x4dc0('0x25')](_0x4dc0('0x3f'),_0x2557d3)},{'name':'phone_home','value':_0x2557d3}]})}})[_0x4dc0('0x31')](function(_0xf3b911){logger['info'](_0x4dc0('0x40'));return BPromise[_0x4dc0('0x36')]({'id':_0xf3b911['id'],'name':_0xf3b911[_0x4dc0('0x32')][_0x4dc0('0x41')][_0x4dc0('0x34')],'phone':_0xf3b911[_0x4dc0('0x32')][_0x4dc0('0x3b')]['value']});});}});}function request(_0x3c2b3f){logger[_0x4dc0('0x42')](_0x4dc0('0x43'),JSON['stringify'](_0x3c2b3f));return rp(_[_0x4dc0('0x44')](def,_0x3c2b3f));}function getTags(_0x3179b2,_0x49bcef){var _0x20be92=[];if(_0x3179b2&&_0x3179b2[_0x4dc0('0x1d')]>0x0){_0x20be92=_[_0x4dc0('0x45')](_0x3179b2,_0x49bcef);}return _0x20be92;}function getCustomFields(_0x5de3ba,_0x3a48c7){var _0x515673=[];var _0x2bc210={'custom_fields':[]};if(_0x5de3ba[_0x4dc0('0x1d')]>0x0){_[_0x4dc0('0x1e')](_0x5de3ba,function(_0x5bf04a){if(_0x5bf04a['type']===_0x4dc0('0x46')&&_0x5bf04a[_0x4dc0('0x47')]&&!_0x5bf04a[_0x4dc0('0x48')]){_0x2bc210[_0x5bf04a[_0x4dc0('0x47')]['toLowerCase']()]=_0x5bf04a[_0x4dc0('0x49')][_0x4dc0('0x28')]();}else if(_0x5bf04a[_0x4dc0('0x4a')]===_0x4dc0('0x46')&&_0x5bf04a['idField']&&_0x5bf04a['customField']){_0x2bc210[_0x4dc0('0x4b')]['push']({'id':_0x5bf04a[_0x4dc0('0x4c')],'value':_0x5bf04a['content']['toString']()});}else if(_0x5bf04a[_0x4dc0('0x4a')]==='variable'&&_0x5bf04a['variableName']&&_0x5bf04a[_0x4dc0('0x4c')]&&_0x5bf04a[_0x4dc0('0x48')]){_0x3a48c7[_0x5bf04a['variableName']]&&_0x2bc210['custom_fields'][_0x4dc0('0x20')]({'id':_0x5bf04a[_0x4dc0('0x4c')],'value':_0x3a48c7[_0x5bf04a[_0x4dc0('0x1f')]][_0x4dc0('0x28')]()});}else if(_0x5bf04a[_0x4dc0('0x4a')]===_0x4dc0('0x4d')&&_0x5bf04a[_0x4dc0('0x4e')]&&_0x5bf04a[_0x4dc0('0x4e')][_0x4dc0('0xd')]&&_0x5bf04a[_0x4dc0('0x4c')]&&_0x5bf04a[_0x4dc0('0x48')]){_0x3a48c7[_0x5bf04a['Variable'][_0x4dc0('0xd')][_0x4dc0('0x4f')]()]&&_0x2bc210['custom_fields'][_0x4dc0('0x20')]({'id':_0x5bf04a['idField'],'value':_0x3a48c7[_0x5bf04a[_0x4dc0('0x4e')][_0x4dc0('0xd')][_0x4dc0('0x4f')]()][_0x4dc0('0x28')]()});}});}return _0x2bc210;}function getConnection(_0x466d19){return request({'method':_0x4dc0('0xb'),'form':{'method':_0x4dc0('0x50'),'input_type':_0x4dc0('0x22'),'response_type':_0x4dc0('0x22'),'rest_data':JSON[_0x4dc0('0x23')]({'user_auth':{'user_name':_0x466d19[_0x4dc0('0x51')],'password':_0x466d19[_0x4dc0('0x52')],'encryption':_0x4dc0('0x53')},'application':_0x4dc0('0x54')})}})['then'](function(_0x379b0a){var _0x3743b1=_0x379b0a;if(_0x3743b1['id']){def[_0x4dc0('0x55')]=_0x3743b1['id'];return BPromise[_0x4dc0('0x36')](_0x3743b1);}else{throw new Error(util['format'](_0x4dc0('0x56'),_0x466d19['id']));}});}function setRelationship(_0x11eb5a,_0x2910e1,_0x2b1c0b,_0x4c61c9){return request({'form':{'method':_0x4dc0('0x57'),'input_type':_0x4dc0('0x22'),'response_type':_0x4dc0('0x22'),'rest_data':JSON[_0x4dc0('0x23')]({'session':_0x11eb5a['id'],'module_name':_0x4dc0('0x24'),'module_id':_0x2b1c0b['id'],'link_field_name':_0x4c61c9,'related_ids':[_0x2910e1['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4dc0('0x58')]=function(_0x3a12cd,_0x16cdbc,_0x59f0e4,_0x3e967f,_0x25423f,_0x415cb6){var _0x2ca6e7,_0x403c90,_0x3b0618,_0x478bb2;_0x415cb6[_0x4dc0('0x59')]=intUtil[_0x4dc0('0x5a')](_0x415cb6[_0x4dc0('0x59')]);_0x415cb6[_0x4dc0('0x5b')]=intUtil[_0x4dc0('0x5a')](_0x415cb6[_0x4dc0('0x5b')]);def[_0x4dc0('0x5c')]=util['format']('%s/service/v4_1/rest.php',_0x415cb6[_0x4dc0('0x59')]);if(_0x25423f&&_0x25423f[_0x4dc0('0x5d')]){logger[_0x4dc0('0x2b')](_0x4dc0('0x5e'),_0x4dc0('0x5f'));_0x16cdbc[_0x4dc0('0x60')]=util[_0x4dc0('0x25')](_0x4dc0('0x61'),_0x415cb6[_0x4dc0('0x5b')],_0x16cdbc[_0x4dc0('0x62')],md5(_0x16cdbc['uniqueid']));}else{_0x16cdbc[_0x4dc0('0x60')]='';}return getConnection(_0x415cb6)[_0x4dc0('0x31')](function(_0x20dbe5){_0x478bb2=_0x20dbe5;return getUser(_0x415cb6,_0x3e967f[_0x4dc0('0xd')],_0x478bb2);})[_0x4dc0('0x31')](function(_0x256c5d){_0x2ca6e7=_0x256c5d;logger[_0x4dc0('0x2b')](_0x4dc0('0x63'),_0x2ca6e7['id']);return getEndUser(_0x415cb6,_0x16cdbc[_0x4dc0('0x64')],_0x16cdbc['calleridnum'],_0x478bb2);})[_0x4dc0('0x31')](function(_0x435f24){_0x403c90=_0x435f24;logger['info']('The\x20Enduser\x20ID\x20is:',_0x403c90['id']);return getTicket(_0x415cb6,_0x2ca6e7,_0x403c90,_0x59f0e4,_0x16cdbc,_0x59f0e4['Fields'],_0x478bb2,_0x4dc0('0x65'));})[_0x4dc0('0x31')](function(_0x4cade2){_0x3b0618=_0x4cade2;logger[_0x4dc0('0x2b')](_0x4dc0('0x66'));logger[_0x4dc0('0x2b')](_0x4dc0('0x67'),_0x3b0618['id']);return setRelationship(_0x478bb2,_0x2ca6e7,_0x3b0618,_0x4dc0('0x68'));})[_0x4dc0('0x31')](function(){return setRelationship(_0x478bb2,_0x403c90,_0x3b0618,'contacts');})['then'](function(){return getServerInfo(_0x478bb2);})[_0x4dc0('0x31')](function(_0x3fd6c9){var _0x1b6676=parseInt(_0x3fd6c9[_0x4dc0('0x69')][_0x4dc0('0x6a')](0x0));var _0x5b4ac9=util['format'](_0x4dc0('0x6b'),_0x415cb6[_0x4dc0('0x59')],_0x3b0618['id']);if(_0x1b6676>0x6){_0x5b4ac9=util[_0x4dc0('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x415cb6[_0x4dc0('0x59')],_0x3b0618['id']);}logger[_0x4dc0('0x2b')](_0x4dc0('0x5e'),_0x4dc0('0x6c'));emit(util['format'](_0x4dc0('0x6d'),_0x3e967f[_0x4dc0('0xd')]),'trigger:browser:url',{'uri':_0x5b4ac9});})[_0x4dc0('0x6e')](function(_0x2545c9){logger[_0x4dc0('0x6f')]('[QUEUE]',JSON[_0x4dc0('0x23')](_0x2545c9));});};exports[_0x4dc0('0x70')]=function(_0x5d7866,_0x1af301,_0x21b741,_0x1de85b,_0x1c848e,_0x548416,_0x590951){var _0x1760f3,_0x3870f1,_0x4b3e1d,_0x8cf6b1;_0x548416[_0x4dc0('0x59')]=intUtil[_0x4dc0('0x5a')](_0x548416[_0x4dc0('0x59')]);_0x548416[_0x4dc0('0x5b')]=intUtil['stripTrailingSlash'](_0x548416['serverUrl']);def[_0x4dc0('0x5c')]=util[_0x4dc0('0x25')]('%s/service/v4_1/rest.php',_0x548416[_0x4dc0('0x59')]);if(_0x590951&&_0x590951[_0x4dc0('0x71')]&&_0x590951[_0x4dc0('0x71')]!==_0x4dc0('0x72')){logger[_0x4dc0('0x2b')]('[OUTBOUND]',_0x4dc0('0x5f'));_0x1af301[_0x4dc0('0x60')]=util[_0x4dc0('0x25')](_0x4dc0('0x61'),_0x548416[_0x4dc0('0x5b')],_0x1af301[_0x4dc0('0x62')],md5(_0x1af301[_0x4dc0('0x62')]));}return getConnection(_0x548416)['then'](function(_0x2712a2){_0x8cf6b1=_0x2712a2;return getUser(_0x548416,_0x1de85b[_0x4dc0('0xd')],_0x8cf6b1);})[_0x4dc0('0x31')](function(_0x2db14e){_0x1760f3=_0x2db14e;logger[_0x4dc0('0x2b')]('The\x20User\x20ID\x20is:',_0x1760f3['id']);return getEndUser(_0x548416,_0x1af301[_0x4dc0('0x73')],_0x1af301[_0x4dc0('0x74')],_0x8cf6b1);})[_0x4dc0('0x31')](function(_0x3e868e){_0x3870f1=_0x3e868e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3870f1['id']);return getTicket(_0x548416,_0x1760f3,_0x3870f1,_0x21b741,_0x1af301,_0x21b741['Fields'],_0x8cf6b1,_0x4dc0('0x75'));})['then'](function(_0x31f0d6){_0x4b3e1d=_0x31f0d6;logger[_0x4dc0('0x2b')](_0x4dc0('0x66'));logger[_0x4dc0('0x2b')](_0x4dc0('0x67'),_0x4b3e1d['id']);return setRelationship(_0x8cf6b1,_0x1760f3,_0x4b3e1d,_0x4dc0('0x68'));})[_0x4dc0('0x31')](function(){return setRelationship(_0x8cf6b1,_0x3870f1,_0x4b3e1d,_0x4dc0('0x76'));})[_0x4dc0('0x31')](function(){return getServerInfo(_0x8cf6b1);})[_0x4dc0('0x31')](function(_0x809e86){var _0x30a1dc=parseInt(_0x809e86[_0x4dc0('0x69')][_0x4dc0('0x6a')](0x0));var _0x38683d=util[_0x4dc0('0x25')](_0x4dc0('0x6b'),_0x548416[_0x4dc0('0x59')],_0x4b3e1d['id']);if(_0x30a1dc>0x6){_0x38683d=util[_0x4dc0('0x25')](_0x4dc0('0x77'),_0x548416['remoteUri'],_0x4b3e1d['id']);}logger['info'](_0x4dc0('0x78'),_0x4dc0('0x6c'));emit(util[_0x4dc0('0x25')]('user:%s',_0x1de85b[_0x4dc0('0xd')]),_0x4dc0('0x79'),{'uri':_0x38683d});})[_0x4dc0('0x6e')](function(_0x3d592b){logger[_0x4dc0('0x6f')](_0x4dc0('0x78'),JSON[_0x4dc0('0x23')](_0x3d592b));});};exports[_0x4dc0('0x7a')]=function(_0x22d973,_0x1abfbe,_0x2a6fbb,_0x2539b7,_0x59f35b,_0x3fcc41){var _0x3fa7bf,_0x3e5297,_0x3bf6f0,_0x56f9d5;_0x3fcc41['remoteUri']=intUtil[_0x4dc0('0x5a')](_0x3fcc41['remoteUri']);_0x3fcc41[_0x4dc0('0x5b')]=intUtil[_0x4dc0('0x5a')](_0x3fcc41['serverUrl']);def[_0x4dc0('0x5c')]=util[_0x4dc0('0x25')](_0x4dc0('0x7b'),_0x3fcc41[_0x4dc0('0x59')]);if(_0x59f35b&&_0x59f35b[_0x4dc0('0x5d')]){logger[_0x4dc0('0x2b')]('['+_0x1abfbe[_0x4dc0('0x7c')][_0x4dc0('0x7d')]()+']','Recording\x20is\x20enabled!');_0x1abfbe[_0x4dc0('0x60')]=util[_0x4dc0('0x25')](_0x4dc0('0x61'),_0x3fcc41[_0x4dc0('0x5b')],_0x1abfbe['uniqueid'],md5(_0x1abfbe['uniqueid']));}else{_0x1abfbe[_0x4dc0('0x60')]='';}return getConnection(_0x3fcc41)['then'](function(_0x21c8a8){_0x56f9d5=_0x21c8a8;if(!_[_0x4dc0('0x7e')](_0x2539b7)){return getUser(_0x3fcc41,_0x2539b7['name'],_0x56f9d5);}else{return getUser(_0x3fcc41,null,_0x56f9d5);}})[_0x4dc0('0x31')](function(_0x1dee38){_0x3fa7bf=_0x1dee38;logger[_0x4dc0('0x2b')](_0x4dc0('0x63'),_0x3fa7bf['id']);return getEndUser(_0x3fcc41,_0x1abfbe[_0x4dc0('0x64')],_0x1abfbe[_0x4dc0('0x7f')],_0x56f9d5);})[_0x4dc0('0x31')](function(_0x3fa852){_0x3e5297=_0x3fa852;logger[_0x4dc0('0x2b')](_0x4dc0('0x80'),_0x3e5297['id']);return getTicket(_0x3fcc41,_0x3fa7bf,_0x3e5297,_0x2a6fbb,_0x1abfbe,_0x2a6fbb[_0x4dc0('0x81')],_0x56f9d5,_0x4dc0('0x65'));})[_0x4dc0('0x31')](function(_0x468b46){_0x3bf6f0=_0x468b46;logger['info'](_0x4dc0('0x66'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3bf6f0['id']);return setRelationship(_0x56f9d5,_0x3fa7bf,_0x3bf6f0,_0x4dc0('0x68'));})[_0x4dc0('0x31')](function(){return setRelationship(_0x56f9d5,_0x3e5297,_0x3bf6f0,_0x4dc0('0x76'));})[_0x4dc0('0x31')](function(){return getServerInfo(_0x56f9d5);})[_0x4dc0('0x6e')](function(_0x37a760){logger[_0x4dc0('0x6f')]('['+_0x1abfbe[_0x4dc0('0x7c')][_0x4dc0('0x7d')]()+']',JSON[_0x4dc0('0x23')](_0x37a760));});}; \ No newline at end of file +var _0xec95=['Basic\x20%s','apiKey','toString','base64','isNil','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','[HTTP]','merge','map','forEach','type','string','nameField','customField','content','idField','variable','custom_fields','customVariable','Variable','toLowerCase','username','set_relationship','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridnum','Fields','Inbound','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','stripTrailingSlash','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','unmanaged','toUpperCase','calleridname','Ticket\x20created!','lastevent','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','variableName','push','set_entry','JSON','stringify'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xec95,0x141));var _0x5ec9=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0xec95[_0x5f08a6];return _0x5d0641;};'use strict';var _=require(_0x5ec9('0x0'));var rp=require(_0x5ec9('0x1'));var BPromise=require('bluebird');var md5=require(_0x5ec9('0x2'));var util=require(_0x5ec9('0x3'));var Redis=require('ioredis');var intUtil=require(_0x5ec9('0x4'));var config=require(_0x5ec9('0x5'));var logger=require(_0x5ec9('0x6'))('sugarcrm');config[_0x5ec9('0x7')]=_[_0x5ec9('0x8')](config['redis'],{'host':_0x5ec9('0x9'),'port':0x18eb});var io=require(_0x5ec9('0xa'))(new Redis(config[_0x5ec9('0x7')]));var def={'method':_0x5ec9('0xb'),'json':!![]};function emit(_0xdb104e,_0x27747c,_0x3cb1b8){io['to'](_0xdb104e)[_0x5ec9('0xc')](_0x27747c,_0x3cb1b8);}function getTicket(_0x463f34,_0x8d67a2,_0x34e785,_0x2fea34,_0x44054c,_0x56da91,_0x27795d,_0x32a683){logger[_0x5ec9('0xd')](_0x5ec9('0xe'));var _0x38a852=new Date();var _0x1f1fb2=[{'name':_0x5ec9('0xf'),'value':intUtil[_0x5ec9('0x10')](_0x2fea34[_0x5ec9('0x11')],_0x44054c,'\x20')},{'name':_0x5ec9('0x12'),'value':_0x8d67a2['id']},{'name':'created_by','value':_0x8d67a2['id']},{'name':_0x5ec9('0x13'),'value':intUtil[_0x5ec9('0x10')](_0x2fea34[_0x5ec9('0x14')],_0x44054c,'\x0a')},{'name':_0x5ec9('0x15'),'value':_0x38a852[_0x5ec9('0x16')]()['slice'](0x0,0x13)[_0x5ec9('0x17')]('T','\x20')},{'name':_0x5ec9('0x18'),'value':'0'},{'name':_0x5ec9('0x19'),'value':'15'},{'name':_0x5ec9('0x1a'),'value':_0x34e785['id']},{'name':_0x5ec9('0x1b'),'value':_0x5ec9('0x1c')},{'name':_0x5ec9('0x1d'),'value':_0x34e785[_0x5ec9('0xf')]},{'name':'direction','value':_0x32a683}];if(_0x56da91[_0x5ec9('0x1e')]){_['forEach'](_0x56da91,function(_0x4896a9){if(_0x44054c[_0x4896a9[_0x5ec9('0x1f')]]){_0x1f1fb2[_0x5ec9('0x20')]({'name':_0x4896a9['idField'],'value':_0x44054c[_0x4896a9[_0x5ec9('0x1f')]]});}});}return request({'form':{'method':_0x5ec9('0x21'),'input_type':_0x5ec9('0x22'),'response_type':'JSON','rest_data':JSON[_0x5ec9('0x23')]({'session':_0x27795d['id'],'module_name':'Calls','name_value_list':_0x1f1fb2})}});}function getAuth(_0x376436){return util['format'](_0x5ec9('0x24'),new Buffer(_0x376436[_0x5ec9('0x25')]+':X')[_0x5ec9('0x26')](_0x5ec9('0x27')));}function getServerInfo(_0x2d397d){return request({'form':{'method':'get_server_info','input_type':_0x5ec9('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2d397d['id']})}});}function getUser(_0x5eb01d,_0x1ec413,_0x11de5f){if(!_[_0x5ec9('0x28')](_0x1ec413)){logger[_0x5ec9('0xd')]('Getting\x20agent\x20with\x20name',_0x1ec413);return request({'form':{'method':_0x5ec9('0x29'),'input_type':_0x5ec9('0x22'),'response_type':_0x5ec9('0x22'),'rest_data':JSON[_0x5ec9('0x23')]({'session':_0x11de5f['id'],'module_name':_0x5ec9('0x2a'),'query':util[_0x5ec9('0x2b')](_0x5ec9('0x2c'),_0x1ec413),'order_by':'','offset':'0','select_fields':['id',_0x5ec9('0xf'),_0x5ec9('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5ec9('0x2e')](function(_0x2ea0a9){if(_0x2ea0a9[_0x5ec9('0x2f')][_0x5ec9('0x1e')]){var _0x3c7b0a=_[_0x5ec9('0x30')](_0x2ea0a9[_0x5ec9('0x2f')],function(_0x317b99){return _0x317b99[_0x5ec9('0x31')][_0x5ec9('0x2d')]['value']===_0x1ec413;});if(_0x3c7b0a){logger[_0x5ec9('0xd')](_0x5ec9('0x32'));return BPromise[_0x5ec9('0x33')]({'id':_0x3c7b0a[_0x5ec9('0x31')]['id'][_0x5ec9('0x34')],'name':_0x3c7b0a[_0x5ec9('0x31')]['name'][_0x5ec9('0x34')]});}}logger[_0x5ec9('0xd')](_0x5ec9('0x35'));return BPromise['resolve']({'id':_0x11de5f[_0x5ec9('0x31')][_0x5ec9('0x36')][_0x5ec9('0x34')],'name':_0x11de5f[_0x5ec9('0x31')][_0x5ec9('0x2d')][_0x5ec9('0x34')]});});}else{logger[_0x5ec9('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x11de5f[_0x5ec9('0x31')][_0x5ec9('0x36')]['value'],'name':_0x11de5f[_0x5ec9('0x31')]['user_name']['value']});}}function getEndUser(_0x4681a3,_0x2ea50d,_0x35cf8f,_0x37d1e8){logger[_0x5ec9('0xd')](_0x5ec9('0x37'),_0x35cf8f);return request({'form':{'method':_0x5ec9('0x29'),'input_type':'JSON','response_type':_0x5ec9('0x22'),'rest_data':JSON[_0x5ec9('0x23')]({'session':_0x37d1e8['id'],'module_name':'Contacts','query':util[_0x5ec9('0x2b')](_0x5ec9('0x38'),_0x35cf8f),'order_by':'','offset':'0','select_fields':['id','name',_0x5ec9('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5ec9('0x2e')](function(_0x1cb97b){if(_0x1cb97b['entry_list']['length']){var _0x499915=_[_0x5ec9('0x30')](_0x1cb97b[_0x5ec9('0x2f')],function(_0x2abf9a){return _0x2abf9a['name_value_list']['phone_home']['value']===_0x35cf8f;});if(_0x499915){logger[_0x5ec9('0xd')](_0x5ec9('0x3a'));return BPromise['resolve']({'id':_0x499915['name_value_list']['id'][_0x5ec9('0x34')],'name':_0x499915[_0x5ec9('0x31')][_0x5ec9('0xf')][_0x5ec9('0x34')],'phone':_0x499915[_0x5ec9('0x31')]['phone_home'][_0x5ec9('0x34')]});}}else{logger[_0x5ec9('0xd')](_0x5ec9('0x3b'));return request({'form':{'method':_0x5ec9('0x21'),'input_type':_0x5ec9('0x22'),'response_type':_0x5ec9('0x22'),'rest_data':JSON['stringify']({'session':_0x37d1e8['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x2ea50d!==_0x5ec9('0x3c')?_0x2ea50d:util['format'](_0x5ec9('0x3d'),_0x35cf8f)},{'name':'phone_home','value':_0x35cf8f}]})}})[_0x5ec9('0x2e')](function(_0x145c9a){logger[_0x5ec9('0xd')](_0x5ec9('0x3e'));return BPromise[_0x5ec9('0x33')]({'id':_0x145c9a['id'],'name':_0x145c9a['entry_list'][_0x5ec9('0x3f')][_0x5ec9('0x34')],'phone':_0x145c9a[_0x5ec9('0x2f')][_0x5ec9('0x39')][_0x5ec9('0x34')]});});}});}function request(_0x5aa685){logger['debug'](_0x5ec9('0x40'),JSON[_0x5ec9('0x23')](_0x5aa685));return rp(_[_0x5ec9('0x41')](def,_0x5aa685));}function getTags(_0x4ec1a2,_0x559dae){var _0x46874a=[];if(_0x4ec1a2&&_0x4ec1a2[_0x5ec9('0x1e')]>0x0){_0x46874a=_[_0x5ec9('0x42')](_0x4ec1a2,_0x559dae);}return _0x46874a;}function getCustomFields(_0x1d4ef3,_0x17d3a8){var _0x3fe5cd=[];var _0x54e301={'custom_fields':[]};if(_0x1d4ef3['length']>0x0){_[_0x5ec9('0x43')](_0x1d4ef3,function(_0x2a7e45){if(_0x2a7e45[_0x5ec9('0x44')]===_0x5ec9('0x45')&&_0x2a7e45[_0x5ec9('0x46')]&&!_0x2a7e45[_0x5ec9('0x47')]){_0x54e301[_0x2a7e45[_0x5ec9('0x46')]['toLowerCase']()]=_0x2a7e45[_0x5ec9('0x48')][_0x5ec9('0x26')]();}else if(_0x2a7e45[_0x5ec9('0x44')]===_0x5ec9('0x45')&&_0x2a7e45[_0x5ec9('0x49')]&&_0x2a7e45[_0x5ec9('0x47')]){_0x54e301['custom_fields'][_0x5ec9('0x20')]({'id':_0x2a7e45[_0x5ec9('0x49')],'value':_0x2a7e45[_0x5ec9('0x48')]['toString']()});}else if(_0x2a7e45['type']===_0x5ec9('0x4a')&&_0x2a7e45[_0x5ec9('0x1f')]&&_0x2a7e45[_0x5ec9('0x49')]&&_0x2a7e45[_0x5ec9('0x47')]){_0x17d3a8[_0x2a7e45[_0x5ec9('0x1f')]]&&_0x54e301[_0x5ec9('0x4b')][_0x5ec9('0x20')]({'id':_0x2a7e45[_0x5ec9('0x49')],'value':_0x17d3a8[_0x2a7e45['variableName']][_0x5ec9('0x26')]()});}else if(_0x2a7e45[_0x5ec9('0x44')]===_0x5ec9('0x4c')&&_0x2a7e45[_0x5ec9('0x4d')]&&_0x2a7e45[_0x5ec9('0x4d')]['name']&&_0x2a7e45[_0x5ec9('0x49')]&&_0x2a7e45[_0x5ec9('0x47')]){_0x17d3a8[_0x2a7e45[_0x5ec9('0x4d')]['name'][_0x5ec9('0x4e')]()]&&_0x54e301['custom_fields'][_0x5ec9('0x20')]({'id':_0x2a7e45['idField'],'value':_0x17d3a8[_0x2a7e45[_0x5ec9('0x4d')][_0x5ec9('0xf')][_0x5ec9('0x4e')]()][_0x5ec9('0x26')]()});}});}return _0x54e301;}function getConnection(_0x1cfe9b){return request({'method':_0x5ec9('0xb'),'form':{'method':'login','input_type':_0x5ec9('0x22'),'response_type':_0x5ec9('0x22'),'rest_data':JSON[_0x5ec9('0x23')]({'user_auth':{'user_name':_0x1cfe9b[_0x5ec9('0x4f')],'password':_0x1cfe9b['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x5ec9('0x2e')](function(_0x40ee70){var _0x278efa=_0x40ee70;if(_0x278efa['id']){def['sessionID']=_0x278efa['id'];return BPromise['resolve'](_0x278efa);}else{throw new Error(util[_0x5ec9('0x2b')]('Account\x20%d\x20is\x20not\x20valid',_0x1cfe9b['id']));}});}function setRelationship(_0x3f7a10,_0x31d886,_0x5cc60a,_0x2348d1){return request({'form':{'method':_0x5ec9('0x50'),'input_type':_0x5ec9('0x22'),'response_type':'JSON','rest_data':JSON[_0x5ec9('0x23')]({'session':_0x3f7a10['id'],'module_name':'Calls','module_id':_0x5cc60a['id'],'link_field_name':_0x2348d1,'related_ids':[_0x31d886['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2e68eb,_0x1f40eb,_0x438e19,_0xbdb6a4,_0x2eb132,_0x3ef725){var _0x38c4cc,_0x30e470,_0x4eb7be,_0x2d5eb8;_0x3ef725[_0x5ec9('0x51')]=intUtil['stripTrailingSlash'](_0x3ef725[_0x5ec9('0x51')]);_0x3ef725[_0x5ec9('0x52')]=intUtil['stripTrailingSlash'](_0x3ef725[_0x5ec9('0x52')]);def[_0x5ec9('0x53')]=util['format'](_0x5ec9('0x54'),_0x3ef725[_0x5ec9('0x51')]);if(_0x2eb132&&_0x2eb132[_0x5ec9('0x55')]){logger[_0x5ec9('0xd')](_0x5ec9('0x56'),_0x5ec9('0x57'));_0x1f40eb[_0x5ec9('0x58')]=util[_0x5ec9('0x2b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ef725[_0x5ec9('0x52')],_0x1f40eb[_0x5ec9('0x59')],md5(_0x1f40eb[_0x5ec9('0x59')]));}else{_0x1f40eb[_0x5ec9('0x58')]='';}return getConnection(_0x3ef725)[_0x5ec9('0x2e')](function(_0x5a7e82){_0x2d5eb8=_0x5a7e82;return getUser(_0x3ef725,_0xbdb6a4['name'],_0x2d5eb8);})[_0x5ec9('0x2e')](function(_0x1d5946){_0x38c4cc=_0x1d5946;logger[_0x5ec9('0xd')]('The\x20User\x20ID\x20is:',_0x38c4cc['id']);return getEndUser(_0x3ef725,_0x1f40eb['calleridname'],_0x1f40eb[_0x5ec9('0x5a')],_0x2d5eb8);})[_0x5ec9('0x2e')](function(_0x1ab70f){_0x30e470=_0x1ab70f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x30e470['id']);return getTicket(_0x3ef725,_0x38c4cc,_0x30e470,_0x438e19,_0x1f40eb,_0x438e19[_0x5ec9('0x5b')],_0x2d5eb8,_0x5ec9('0x5c'));})['then'](function(_0x1dc1b5){_0x4eb7be=_0x1dc1b5;logger[_0x5ec9('0xd')]('Ticket\x20created!');logger[_0x5ec9('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4eb7be['id']);return setRelationship(_0x2d5eb8,_0x38c4cc,_0x4eb7be,_0x5ec9('0x5d'));})[_0x5ec9('0x2e')](function(){return setRelationship(_0x2d5eb8,_0x30e470,_0x4eb7be,_0x5ec9('0x5e'));})[_0x5ec9('0x2e')](function(){return getServerInfo(_0x2d5eb8);})['then'](function(_0x387bf5){var _0x1d0171=parseInt(_0x387bf5[_0x5ec9('0x5f')][_0x5ec9('0x60')](0x0));var _0x2f06a4=util[_0x5ec9('0x2b')](_0x5ec9('0x61'),_0x3ef725[_0x5ec9('0x51')],_0x4eb7be['id']);if(_0x1d0171>0x6){_0x2f06a4=util[_0x5ec9('0x2b')](_0x5ec9('0x62'),_0x3ef725['remoteUri'],_0x4eb7be['id']);}logger[_0x5ec9('0xd')](_0x5ec9('0x56'),_0x5ec9('0x63'));emit(util['format'](_0x5ec9('0x64'),_0xbdb6a4[_0x5ec9('0xf')]),_0x5ec9('0x65'),{'uri':_0x2f06a4});})[_0x5ec9('0x66')](function(_0x366ad0){logger[_0x5ec9('0x67')](_0x5ec9('0x56'),JSON[_0x5ec9('0x23')](_0x366ad0));});};exports['outbound']=function(_0x51cf84,_0x1f1cad,_0x17c8ca,_0x59bf39,_0x29178f,_0x4609b0,_0x56a160){var _0xbe084,_0x12d010,_0x2e30b4,_0x175aee;_0x4609b0[_0x5ec9('0x51')]=intUtil[_0x5ec9('0x68')](_0x4609b0[_0x5ec9('0x51')]);_0x4609b0[_0x5ec9('0x52')]=intUtil['stripTrailingSlash'](_0x4609b0[_0x5ec9('0x52')]);def[_0x5ec9('0x53')]=util[_0x5ec9('0x2b')]('%s/service/v4_1/rest.php',_0x4609b0['remoteUri']);if(_0x56a160&&_0x56a160[_0x5ec9('0x69')]&&_0x56a160[_0x5ec9('0x69')]!=='none'){logger['info'](_0x5ec9('0x6a'),_0x5ec9('0x57'));_0x1f1cad[_0x5ec9('0x58')]=util['format'](_0x5ec9('0x6b'),_0x4609b0['serverUrl'],_0x1f1cad[_0x5ec9('0x59')],md5(_0x1f1cad[_0x5ec9('0x59')]));}return getConnection(_0x4609b0)[_0x5ec9('0x2e')](function(_0x30f8d0){_0x175aee=_0x30f8d0;return getUser(_0x4609b0,_0x59bf39['name'],_0x175aee);})[_0x5ec9('0x2e')](function(_0x3a7ca2){_0xbe084=_0x3a7ca2;logger[_0x5ec9('0xd')](_0x5ec9('0x6c'),_0xbe084['id']);return getEndUser(_0x4609b0,_0x1f1cad[_0x5ec9('0x6d')],_0x1f1cad[_0x5ec9('0x6e')],_0x175aee);})['then'](function(_0x51ee32){_0x12d010=_0x51ee32;logger[_0x5ec9('0xd')](_0x5ec9('0x6f'),_0x12d010['id']);return getTicket(_0x4609b0,_0xbe084,_0x12d010,_0x17c8ca,_0x1f1cad,_0x17c8ca[_0x5ec9('0x5b')],_0x175aee,_0x5ec9('0x70'));})['then'](function(_0x549b56){_0x2e30b4=_0x549b56;logger[_0x5ec9('0xd')]('Ticket\x20created!');logger[_0x5ec9('0xd')](_0x5ec9('0x71'),_0x2e30b4['id']);return setRelationship(_0x175aee,_0xbe084,_0x2e30b4,_0x5ec9('0x5d'));})['then'](function(){return setRelationship(_0x175aee,_0x12d010,_0x2e30b4,_0x5ec9('0x5e'));})[_0x5ec9('0x2e')](function(){return getServerInfo(_0x175aee);})[_0x5ec9('0x2e')](function(_0x47d584){var _0x3055d3=parseInt(_0x47d584[_0x5ec9('0x5f')][_0x5ec9('0x60')](0x0));var _0x4b7761=util['format'](_0x5ec9('0x61'),_0x4609b0[_0x5ec9('0x51')],_0x2e30b4['id']);if(_0x3055d3>0x6){_0x4b7761=util[_0x5ec9('0x2b')](_0x5ec9('0x62'),_0x4609b0[_0x5ec9('0x51')],_0x2e30b4['id']);}logger['info'](_0x5ec9('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5ec9('0x64'),_0x59bf39[_0x5ec9('0xf')]),_0x5ec9('0x65'),{'uri':_0x4b7761});})[_0x5ec9('0x66')](function(_0x29a1d6){logger[_0x5ec9('0x67')]('[OUTBOUND]',JSON['stringify'](_0x29a1d6));});};exports[_0x5ec9('0x72')]=function(_0xec40e4,_0x54be90,_0x167dfc,_0x2d5bf2,_0x434b9d,_0x240919){var _0x3cecae,_0x29676a,_0x32490b,_0x265ab7;_0x240919[_0x5ec9('0x51')]=intUtil[_0x5ec9('0x68')](_0x240919[_0x5ec9('0x51')]);_0x240919[_0x5ec9('0x52')]=intUtil[_0x5ec9('0x68')](_0x240919['serverUrl']);def[_0x5ec9('0x53')]=util[_0x5ec9('0x2b')](_0x5ec9('0x54'),_0x240919[_0x5ec9('0x51')]);if(_0x434b9d&&_0x434b9d[_0x5ec9('0x55')]){logger[_0x5ec9('0xd')]('['+_0x54be90['lastevent'][_0x5ec9('0x73')]()+']',_0x5ec9('0x57'));_0x54be90[_0x5ec9('0x58')]=util[_0x5ec9('0x2b')](_0x5ec9('0x6b'),_0x240919[_0x5ec9('0x52')],_0x54be90[_0x5ec9('0x59')],md5(_0x54be90[_0x5ec9('0x59')]));}else{_0x54be90['recordingURL']='';}return getConnection(_0x240919)['then'](function(_0x560812){_0x265ab7=_0x560812;if(!_[_0x5ec9('0x28')](_0x2d5bf2)){return getUser(_0x240919,_0x2d5bf2[_0x5ec9('0xf')],_0x265ab7);}else{return getUser(_0x240919,null,_0x265ab7);}})[_0x5ec9('0x2e')](function(_0x38ea42){_0x3cecae=_0x38ea42;logger[_0x5ec9('0xd')]('The\x20User\x20ID\x20is:',_0x3cecae['id']);return getEndUser(_0x240919,_0x54be90[_0x5ec9('0x74')],_0x54be90[_0x5ec9('0x5a')],_0x265ab7);})[_0x5ec9('0x2e')](function(_0x372182){_0x29676a=_0x372182;logger['info']('The\x20Enduser\x20ID\x20is:',_0x29676a['id']);return getTicket(_0x240919,_0x3cecae,_0x29676a,_0x167dfc,_0x54be90,_0x167dfc[_0x5ec9('0x5b')],_0x265ab7,_0x5ec9('0x5c'));})['then'](function(_0x461855){_0x32490b=_0x461855;logger['info'](_0x5ec9('0x75'));logger[_0x5ec9('0xd')]('The\x20Ticket\x20ID\x20is:',_0x32490b['id']);return setRelationship(_0x265ab7,_0x3cecae,_0x32490b,_0x5ec9('0x5d'));})['then'](function(){return setRelationship(_0x265ab7,_0x29676a,_0x32490b,_0x5ec9('0x5e'));})[_0x5ec9('0x2e')](function(){return getServerInfo(_0x265ab7);})[_0x5ec9('0x66')](function(_0x20273d){logger[_0x5ec9('0x67')]('['+_0x54be90[_0x5ec9('0x76')]['toUpperCase']()+']',JSON[_0x5ec9('0x23')](_0x20273d));});}; \ 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 b47fcf2..86f86a8 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 _0x912b=['keyType','key','format','keyContent','%s:\x20%s','slice','substring','validateEmail','isNil','lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x243cf9,_0x4b9645){var _0xe84acb=function(_0x597efc){while(--_0x597efc){_0x243cf9['push'](_0x243cf9['shift']());}};_0xe84acb(++_0x4b9645);}(_0x912b,0x1c3));var _0xb912=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0x912b[_0x1428d9];return _0x438019;};'use strict';var _=require(_0xb912('0x0'));var util=require(_0xb912('0x1'));exports[_0xb912('0x2')]=function(_0x1c3859,_0x13a803,_0x408009){var _0x3fe82b=[];if(_0x1c3859[_0xb912('0x3')]>0x0){var _0x46572b=_[_0xb912('0x4')](_0x1c3859,['id']);for(var _0x4e2072=0x0;_0x4e2072<_0x46572b['length'];_0x4e2072++){var _0x619e61=_0x46572b[_0x4e2072];if(_0x619e61['type']===_0xb912('0x5')){_0x3fe82b[_0xb912('0x6')](_0x619e61[_0xb912('0x7')]);}else if(_0x619e61[_0xb912('0x8')]===_0xb912('0x9')&&_0x619e61[_0xb912('0xa')]){_0x13a803[_0x619e61[_0xb912('0xa')]]&&_0x3fe82b[_0xb912('0x6')](_0x13a803[_0x619e61[_0xb912('0xa')]][_0xb912('0xb')]());}else if(_0x619e61['type']===_0xb912('0xc')&&_0x619e61[_0xb912('0xd')]&&_0x619e61[_0xb912('0xd')][_0xb912('0xe')]){_0x13a803[_0x619e61[_0xb912('0xd')][_0xb912('0xe')][_0xb912('0xf')]()]&&_0x3fe82b[_0xb912('0x6')](_0x13a803[_0x619e61['Variable'][_0xb912('0xe')][_0xb912('0xf')]()][_0xb912('0xb')]());}else if(_0x619e61[_0xb912('0x8')]===_0xb912('0x10')){if(_0x619e61[_0xb912('0x11')]==='string'&&_0x619e61[_0xb912('0x12')]){_0x3fe82b['push'](util[_0xb912('0x13')]('%s:\x20%s',_0x619e61[_0xb912('0x12')],_0x619e61[_0xb912('0x14')]));}else if(_0x619e61['keyType']===_0xb912('0x9')&&_0x619e61['variableName']&&_0x619e61['key']){_0x13a803[_0x619e61['variableName']]&&_0x3fe82b[_0xb912('0x6')](util['format'](_0xb912('0x15'),_0x619e61[_0xb912('0x12')],_0x13a803[_0x619e61[_0xb912('0xa')]]));}else if(_0x619e61[_0xb912('0x11')]==='customVariable'&&_0x619e61[_0xb912('0xd')]&&_0x619e61['Variable'][_0xb912('0xe')]&&_0x619e61['key']){_0x13a803[_0x619e61[_0xb912('0xd')][_0xb912('0xe')]['toLowerCase']()]&&_0x3fe82b[_0xb912('0x6')](util[_0xb912('0x13')]('%s:\x20%s',_0x619e61[_0xb912('0x12')],_0x13a803[_0x619e61[_0xb912('0xd')]['name']['toLowerCase']()]));}}}}return _0x3fe82b['join'](_0x408009);};exports['stripTrailingSlash']=function(_0x205c44){var _0x49fcb3=_0x205c44[_0xb912('0x16')](-0x1);if(_0x49fcb3==='/'){_0x205c44=_0x205c44[_0xb912('0x17')](0x0,_0x205c44['lastIndexOf'](_0x49fcb3));}return _0x205c44;};exports[_0xb912('0x18')]=function(_0x2e9c6a){if(!_[_0xb912('0x19')](_0x2e9c6a)&&_0x2e9c6a!==''){var _0x2441c6=/^(([^<>()\[\]\\.,;:\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 _0x2441c6['test'](String(_0x2e9c6a)[_0xb912('0xf')]());}else{return![];}}; \ No newline at end of file +var _0xb14b=['format','%s:\x20%s','keyContent','slice','substring','lastIndexOf','lodash','getString','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key'];(function(_0x440892,_0x51289b){var _0xa47b62=function(_0x1f8a3b){while(--_0x1f8a3b){_0x440892['push'](_0x440892['shift']());}};_0xa47b62(++_0x51289b);}(_0xb14b,0xbe));var _0xbb14=function(_0x36cc27,_0x481e2c){_0x36cc27=_0x36cc27-0x0;var _0x2c31ef=_0xb14b[_0x36cc27];return _0x2c31ef;};'use strict';var _=require(_0xbb14('0x0'));var util=require('util');exports[_0xbb14('0x1')]=function(_0x50b8f5,_0x45b114,_0x19acb8){var _0x36baff=[];if(_0x50b8f5[_0xbb14('0x2')]>0x0){var _0x296291=_[_0xbb14('0x3')](_0x50b8f5,['id']);for(var _0x32893a=0x0;_0x32893a<_0x296291[_0xbb14('0x2')];_0x32893a++){var _0x3da236=_0x296291[_0x32893a];if(_0x3da236[_0xbb14('0x4')]===_0xbb14('0x5')){_0x36baff[_0xbb14('0x6')](_0x3da236[_0xbb14('0x7')]);}else if(_0x3da236[_0xbb14('0x4')]===_0xbb14('0x8')&&_0x3da236[_0xbb14('0x9')]){_0x45b114[_0x3da236['variableName']]&&_0x36baff['push'](_0x45b114[_0x3da236[_0xbb14('0x9')]][_0xbb14('0xa')]());}else if(_0x3da236['type']===_0xbb14('0xb')&&_0x3da236[_0xbb14('0xc')]&&_0x3da236['Variable'][_0xbb14('0xd')]){_0x45b114[_0x3da236[_0xbb14('0xc')][_0xbb14('0xd')][_0xbb14('0xe')]()]&&_0x36baff[_0xbb14('0x6')](_0x45b114[_0x3da236['Variable'][_0xbb14('0xd')][_0xbb14('0xe')]()]['toString']());}else if(_0x3da236[_0xbb14('0x4')]==='keyValue'){if(_0x3da236[_0xbb14('0xf')]===_0xbb14('0x5')&&_0x3da236[_0xbb14('0x10')]){_0x36baff['push'](util[_0xbb14('0x11')](_0xbb14('0x12'),_0x3da236['key'],_0x3da236[_0xbb14('0x13')]));}else if(_0x3da236['keyType']===_0xbb14('0x8')&&_0x3da236['variableName']&&_0x3da236[_0xbb14('0x10')]){_0x45b114[_0x3da236[_0xbb14('0x9')]]&&_0x36baff[_0xbb14('0x6')](util[_0xbb14('0x11')](_0xbb14('0x12'),_0x3da236[_0xbb14('0x10')],_0x45b114[_0x3da236[_0xbb14('0x9')]]));}else if(_0x3da236[_0xbb14('0xf')]===_0xbb14('0xb')&&_0x3da236[_0xbb14('0xc')]&&_0x3da236['Variable']['name']&&_0x3da236['key']){_0x45b114[_0x3da236[_0xbb14('0xc')][_0xbb14('0xd')][_0xbb14('0xe')]()]&&_0x36baff[_0xbb14('0x6')](util[_0xbb14('0x11')]('%s:\x20%s',_0x3da236[_0xbb14('0x10')],_0x45b114[_0x3da236['Variable']['name']['toLowerCase']()]));}}}}return _0x36baff['join'](_0x19acb8);};exports['stripTrailingSlash']=function(_0x1e7e60){var _0x358b06=_0x1e7e60[_0xbb14('0x14')](-0x1);if(_0x358b06==='/'){_0x1e7e60=_0x1e7e60[_0xbb14('0x15')](0x0,_0x1e7e60[_0xbb14('0x16')](_0x358b06));}return _0x1e7e60;};exports['validateEmail']=function(_0x31020a){if(!_['isNil'](_0x31020a)&&_0x31020a!==''){var _0x2db80b=/^(([^<>()\[\]\\.,;:\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 _0x2db80b['test'](String(_0x31020a)[_0xbb14('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index f1202ad..451842e 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 _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(_0x5cec1a,_0x465521){var _0x59cadb=function(_0x403ec4){while(--_0x403ec4){_0x5cec1a['push'](_0x5cec1a['shift']());}};_0x59cadb(++_0x465521);}(_0xe706,0xa3));var _0x6e70=function(_0x4c7c25,_0x1e16a8){_0x4c7c25=_0x4c7c25-0x0;var _0x297619=_0xe706[_0x4c7c25];return _0x297619;};'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 +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','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','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ 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 35d2d95..1bf021d 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 _0xa0a7=['zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','results','Enduser\x20found!','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','content','idField','custom_fields','variable','variableName','customField','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','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','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','replace','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xa0a7,0x148));var _0x7a0a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa0a7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7a0a('0x0'));var rp=require(_0x7a0a('0x1'));var md5=require(_0x7a0a('0x2'));var util=require(_0x7a0a('0x3'));var Redis=require(_0x7a0a('0x4'));var intUtil=require(_0x7a0a('0x5'));var config=require(_0x7a0a('0x6'));var logger=require(_0x7a0a('0x7'))(_0x7a0a('0x8'));config[_0x7a0a('0x9')]=_[_0x7a0a('0xa')](config[_0x7a0a('0x9')],{'host':_0x7a0a('0xb'),'port':0x18eb});var io=require(_0x7a0a('0xc'))(new Redis(config[_0x7a0a('0x9')]));function emit(_0x20f542,_0x30c3ab,_0xb221f3){io['to'](_0x20f542)[_0x7a0a('0xd')](_0x30c3ab,_0xb221f3);}var headers={'Content-Type':_0x7a0a('0xe'),'Accept':_0x7a0a('0xe')};function getTicket(_0x5c2d27,_0x279850,_0x203c5c,_0x4b0789,_0x3865b6){logger[_0x7a0a('0xf')](_0x7a0a('0x10'));return request({'uri':util[_0x7a0a('0x11')](_0x7a0a('0x12'),_0x5c2d27[_0x7a0a('0x13')]),'method':_0x7a0a('0x14'),'body':{'ticket':_[_0x7a0a('0x15')]({'requester_id':_0x203c5c['id'],'submitter_id':_0x279850?_0x279850['id']:undefined,'assignee_id':_0x279850?_0x279850['id']:undefined,'tags':getTags(_0x4b0789[_0x7a0a('0x16')],_0x7a0a('0x17')),'subject':intUtil[_0x7a0a('0x18')](_0x4b0789[_0x7a0a('0x19')],_0x3865b6,'\x20'),'description':intUtil['getString'](_0x4b0789[_0x7a0a('0x1a')],_0x3865b6,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7a0a('0x18')](_0x4b0789[_0x7a0a('0x1a')],_0x3865b6,'\x0a')}},getCustomFields(_0x4b0789[_0x7a0a('0x1b')],_0x3865b6))}})[_0x7a0a('0x1c')](function(_0x55b0d2){logger[_0x7a0a('0xf')](_0x7a0a('0x1d'));return _0x55b0d2[_0x7a0a('0x1e')];});}function getUser(_0x16d69d,_0x4d439b){if(intUtil['validateEmail'](_0x4d439b)){logger[_0x7a0a('0xf')](_0x7a0a('0x1f'),_0x4d439b);return request({'uri':util[_0x7a0a('0x11')](_0x7a0a('0x20'),_0x16d69d[_0x7a0a('0x13')]),'qs':{'query':util[_0x7a0a('0x11')]('type:user\x20role:agent\x20email:%s',_0x4d439b)}})[_0x7a0a('0x1c')](function(_0x5e72ff){if(_0x5e72ff['count']){logger[_0x7a0a('0xf')](_0x7a0a('0x21'));return _['find'](_0x5e72ff['results'],{'email':_0x4d439b,'role':'agent'});}else{logger[_0x7a0a('0xf')](_0x7a0a('0x22'));return request({'uri':util[_0x7a0a('0x11')](_0x7a0a('0x23'),_0x16d69d[_0x7a0a('0x13')])})[_0x7a0a('0x1c')](function(_0x4cb298){logger[_0x7a0a('0xf')](_0x7a0a('0x24'));return _0x4cb298[_0x7a0a('0x25')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7a0a('0x11')](_0x7a0a('0x23'),_0x16d69d[_0x7a0a('0x13')])})[_0x7a0a('0x1c')](function(_0x3e0624){logger[_0x7a0a('0xf')](_0x7a0a('0x24'));return _0x3e0624[_0x7a0a('0x25')];});}}function getEndUser(_0x25f9ff,_0x376b83,_0x360c70){logger[_0x7a0a('0xf')](_0x7a0a('0x26'),_0x360c70);return request({'uri':util[_0x7a0a('0x11')](_0x7a0a('0x20'),_0x25f9ff[_0x7a0a('0x13')]),'qs':{'query':util[_0x7a0a('0x11')](_0x7a0a('0x27'),_0x360c70)}})[_0x7a0a('0x1c')](function(_0x1589d1){var _0x19752d;if(_0x1589d1['results'][_0x7a0a('0x28')]){_0x1589d1[_0x7a0a('0x29')]=_['filter'](_0x1589d1[_0x7a0a('0x29')],{'suspended':![],'role':'end-user'});if(_0x1589d1[_0x7a0a('0x29')][_0x7a0a('0x28')]){_0x19752d=_['first'](_0x1589d1['results']);}}if(_0x19752d){logger[_0x7a0a('0xf')](_0x7a0a('0x2a'));return _0x19752d;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x25f9ff[_0x7a0a('0x13')]),'method':_0x7a0a('0x14'),'body':{'user':{'role':'end-user','name':util['format']('Caller\x20-\x20%s',_0x376b83||_0x360c70),'phone':_0x360c70}}})[_0x7a0a('0x1c')](function(_0xd5c14a){logger['info'](_0x7a0a('0x2b'));return _0xd5c14a[_0x7a0a('0x25')];});}});}function getAuth(_0x41e902){var _0x41b3f5;if(_0x41e902[_0x7a0a('0x2c')]===_0x7a0a('0x2d')){_0x41b3f5=util[_0x7a0a('0x11')](_0x7a0a('0x2e'),_0x41e902['username'],_0x41e902['password']);}else if(_0x41e902[_0x7a0a('0x2c')]===_0x7a0a('0x2f')){_0x41b3f5=util[_0x7a0a('0x11')](_0x7a0a('0x30'),_0x41e902[_0x7a0a('0x31')],_0x41e902[_0x7a0a('0x2f')]);}return util[_0x7a0a('0x11')](_0x7a0a('0x32'),new Buffer(_0x41b3f5)[_0x7a0a('0x33')](_0x7a0a('0x34')));}function request(_0x423448){logger[_0x7a0a('0x35')](_0x7a0a('0x36'),JSON[_0x7a0a('0x37')](_0x423448));return rp(_[_0x7a0a('0xa')](_0x423448,{'method':_0x7a0a('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x4a7918,_0x3e8ef4){var _0x427313=[];if(_0x4a7918&&_0x4a7918['length']>0x0){_0x427313=_['map'](_0x4a7918,_0x3e8ef4);}return _0x427313;}function getCustomFields(_0x14a453,_0x2a9262){var _0x384208=[];var _0x595d3e={'custom_fields':[]};if(_0x14a453[_0x7a0a('0x28')]>0x0){_[_0x7a0a('0x39')](_0x14a453,function(_0x67b0c5){if(_[_0x7a0a('0x3a')]([_0x7a0a('0x3b'),_0x7a0a('0x3c')],_0x67b0c5[_0x7a0a('0x3d')])&&_0x67b0c5['nameField']&&!_0x67b0c5['customField']){_0x595d3e[_0x67b0c5['nameField']['toLowerCase']()]=_0x67b0c5[_0x7a0a('0x3e')][_0x7a0a('0x33')]();}else if(_[_0x7a0a('0x3a')]([_0x7a0a('0x3b'),'picklist'],_0x67b0c5[_0x7a0a('0x3d')])&&_0x67b0c5[_0x7a0a('0x3f')]&&_0x67b0c5['customField']){_0x595d3e[_0x7a0a('0x40')]['push']({'id':_0x67b0c5[_0x7a0a('0x3f')],'value':_0x67b0c5[_0x7a0a('0x3e')]['toString']()});}else if(_0x67b0c5['type']===_0x7a0a('0x41')&&_0x67b0c5[_0x7a0a('0x42')]&&_0x67b0c5[_0x7a0a('0x3f')]&&_0x67b0c5[_0x7a0a('0x43')]){_0x2a9262[_0x67b0c5[_0x7a0a('0x42')]]&&_0x595d3e['custom_fields'][_0x7a0a('0x44')]({'id':_0x67b0c5[_0x7a0a('0x3f')],'value':_0x2a9262[_0x67b0c5['variableName']][_0x7a0a('0x33')]()});}else if(_0x67b0c5[_0x7a0a('0x3d')]===_0x7a0a('0x45')&&_0x67b0c5['Variable']&&_0x67b0c5['Variable'][_0x7a0a('0x17')]&&_0x67b0c5[_0x7a0a('0x3f')]&&_0x67b0c5['customField']){_0x2a9262[_0x67b0c5[_0x7a0a('0x46')][_0x7a0a('0x17')][_0x7a0a('0x47')]()]&&_0x595d3e[_0x7a0a('0x40')]['push']({'id':_0x67b0c5['idField'],'value':_0x2a9262[_0x67b0c5['Variable']['name']['toLowerCase']()][_0x7a0a('0x33')]()});}});}return _0x595d3e;}exports[_0x7a0a('0x48')]=function(_0x3d968d,_0x3dac9f,_0x411b4d,_0x117e89,_0x442e6f,_0x20e001){var _0x303027,_0x2c5b37;_0x20e001['remoteUri']=intUtil[_0x7a0a('0x49')](_0x20e001[_0x7a0a('0x13')]);_0x20e001[_0x7a0a('0x4a')]=intUtil['stripTrailingSlash'](_0x20e001[_0x7a0a('0x4a')]);if(_0x442e6f&&_0x442e6f[_0x7a0a('0x4b')]){logger[_0x7a0a('0xf')](_0x7a0a('0x4c'),_0x7a0a('0x4d'));_0x3dac9f['recordingURL']=util[_0x7a0a('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20e001[_0x7a0a('0x4a')],_0x3dac9f[_0x7a0a('0x4e')],md5(_0x3dac9f[_0x7a0a('0x4e')]));}else{_0x3dac9f[_0x7a0a('0x4f')]='';}headers['Authorization']=getAuth(_0x20e001);return getUser(_0x20e001,_0x117e89[_0x7a0a('0x50')])[_0x7a0a('0x1c')](function(_0x398afe){_0x303027=_0x398afe;logger[_0x7a0a('0xf')](_0x7a0a('0x51'),_0x303027['id']);return getEndUser(_0x20e001,_0x3dac9f['calleridname'],_0x3dac9f[_0x7a0a('0x52')]);})[_0x7a0a('0x1c')](function(_0x5ad679){_0x2c5b37=_0x5ad679;logger[_0x7a0a('0xf')](_0x7a0a('0x53'),_0x2c5b37['id']);return getTicket(_0x20e001,_0x303027,_0x2c5b37,_0x411b4d,_0x3dac9f);})[_0x7a0a('0x1c')](function(_0x18952c){if(_0x18952c){logger[_0x7a0a('0xf')](_0x7a0a('0x54'),_0x18952c['id']);switch(_0x20e001[_0x7a0a('0x3d')]){case _0x7a0a('0x55'):logger[_0x7a0a('0xf')]('[QUEUE]',_0x7a0a('0x56'));return request({'uri':util['format'](_0x7a0a('0x57'),_0x20e001[_0x7a0a('0x13')],_0x303027['id'],_0x18952c['id']),'method':_0x7a0a('0x14')});case _0x7a0a('0x58'):logger[_0x7a0a('0xf')](_0x7a0a('0x4c'),_0x7a0a('0x59'));emit(util[_0x7a0a('0x11')](_0x7a0a('0x5a'),_0x117e89[_0x7a0a('0x17')]),'trigger:browser:url',{'uri':util[_0x7a0a('0x11')](_0x7a0a('0x5b'),_0x20e001[_0x7a0a('0x13')]['replace'](_0x7a0a('0x5c'),''),_0x18952c['id'])});break;default:logger[_0x7a0a('0x5d')](_0x7a0a('0x4c'),_0x7a0a('0x5e'));}}})[_0x7a0a('0x5f')](function(_0xbdbeca){logger['error'](_0x7a0a('0x60'),util[_0x7a0a('0x61')](_0xbdbeca,{'showHidden':!![],'depth':null}));});};exports[_0x7a0a('0x62')]=function(_0x2611e4,_0x49e998,_0x5792d3,_0x384929,_0x574302,_0x5d1940,_0x5aec48){var _0x2a341d,_0x50e9c1;_0x5d1940[_0x7a0a('0x13')]=intUtil['stripTrailingSlash'](_0x5d1940['remoteUri']);_0x5d1940[_0x7a0a('0x4a')]=intUtil[_0x7a0a('0x49')](_0x5d1940[_0x7a0a('0x4a')]);if(_0x5aec48&&_0x5aec48['recordingFormat']&&_0x5aec48[_0x7a0a('0x63')]!==_0x7a0a('0x64')){logger[_0x7a0a('0xf')]('[OUTBOUND]',_0x7a0a('0x4d'));_0x49e998[_0x7a0a('0x4f')]=util['format'](_0x7a0a('0x65'),_0x5d1940['serverUrl'],_0x49e998[_0x7a0a('0x4e')],md5(_0x49e998['uniqueid']));}headers[_0x7a0a('0x66')]=getAuth(_0x5d1940);return getUser(_0x5d1940,_0x384929[_0x7a0a('0x50')])[_0x7a0a('0x1c')](function(_0x463568){_0x2a341d=_0x463568;logger[_0x7a0a('0xf')](_0x7a0a('0x51'),_0x2a341d['id']);return getEndUser(_0x5d1940,_0x49e998[_0x7a0a('0x67')],_0x49e998[_0x7a0a('0x68')]);})[_0x7a0a('0x1c')](function(_0x7be6bc){_0x50e9c1=_0x7be6bc;logger[_0x7a0a('0xf')](_0x7a0a('0x53'),_0x50e9c1['id']);return getTicket(_0x5d1940,_0x2a341d,_0x50e9c1,_0x5792d3,_0x49e998);})[_0x7a0a('0x1c')](function(_0x3abaf0){if(_0x3abaf0){logger[_0x7a0a('0xf')](_0x7a0a('0x54'),_0x3abaf0['id']);switch(_0x5d1940[_0x7a0a('0x3d')]){case _0x7a0a('0x55'):logger['info']('[OUTBOUND]',_0x7a0a('0x56'));return request({'uri':util[_0x7a0a('0x11')](_0x7a0a('0x57'),_0x5d1940[_0x7a0a('0x13')],_0x2a341d['id'],_0x3abaf0['id']),'method':'POST'});case'newTab':logger['info'](_0x7a0a('0x69'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7a0a('0x11')](_0x7a0a('0x5a'),_0x384929[_0x7a0a('0x17')]),_0x7a0a('0x6a'),{'uri':util[_0x7a0a('0x11')](_0x7a0a('0x5b'),_0x5d1940[_0x7a0a('0x13')][_0x7a0a('0x6b')](_0x7a0a('0x5c'),''),_0x3abaf0['id'])});break;default:logger[_0x7a0a('0x5d')]('[OUTBOUND]',_0x7a0a('0x5e'));}}})['catch'](function(_0x28c995){logger[_0x7a0a('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x7a0a('0x61')](_0x28c995,{'showHidden':!![],'depth':null}));});};exports[_0x7a0a('0x6c')]=function(_0x452f5c,_0x27dd85,_0x1a10be,_0x5852b0,_0x1fad7a,_0x3aa8db){var _0x4003c3,_0x58d30f;_0x3aa8db[_0x7a0a('0x13')]=intUtil['stripTrailingSlash'](_0x3aa8db[_0x7a0a('0x13')]);_0x3aa8db['serverUrl']=intUtil[_0x7a0a('0x49')](_0x3aa8db[_0x7a0a('0x4a')]);if(_0x1fad7a&&_0x1fad7a[_0x7a0a('0x4b')]){logger[_0x7a0a('0xf')]('['+_0x27dd85[_0x7a0a('0x6d')][_0x7a0a('0x6e')]()+']',_0x7a0a('0x4d'));_0x27dd85[_0x7a0a('0x4f')]=util[_0x7a0a('0x11')](_0x7a0a('0x65'),_0x3aa8db[_0x7a0a('0x4a')],_0x27dd85['uniqueid'],md5(_0x27dd85[_0x7a0a('0x4e')]));}else{_0x27dd85['recordingURL']='';}headers[_0x7a0a('0x66')]=getAuth(_0x3aa8db);return getUser(_0x3aa8db)['then'](function(_0x4e2b46){_0x4003c3=_0x4e2b46;logger[_0x7a0a('0xf')]('The\x20User\x20ID\x20is:',_0x4003c3['id']);return getEndUser(_0x3aa8db,_0x27dd85[_0x7a0a('0x6f')],_0x27dd85[_0x7a0a('0x52')]);})[_0x7a0a('0x1c')](function(_0x588a7e){_0x58d30f=_0x588a7e;logger['info'](_0x7a0a('0x53'),_0x58d30f['id']);return getTicket(_0x3aa8db,_0x4003c3,_0x58d30f,_0x1a10be,_0x27dd85);})[_0x7a0a('0x1c')](function(_0x133837){if(_0x133837){logger[_0x7a0a('0xf')](_0x7a0a('0x54'),_0x133837['id']);}})[_0x7a0a('0x5f')](function(_0x1fddab){logger[_0x7a0a('0x5d')]('['+_0x27dd85[_0x7a0a('0x6d')][_0x7a0a('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7a0a('0x61')](_0x1fddab,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdce0=['Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','results','filter','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','nameField','customField','toLowerCase','content','type','idField','push','variable','custom_fields','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','integrationTab','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','name','getString','then','Ticket\x20created!','info'];(function(_0x54e99a,_0x40b569){var _0x387b73=function(_0x57677f){while(--_0x57677f){_0x54e99a['push'](_0x54e99a['shift']());}};_0x387b73(++_0x40b569);}(_0xdce0,0xbe));var _0x0dce=function(_0x45c0e2,_0x41e9f2){_0x45c0e2=_0x45c0e2-0x0;var _0x226cb3=_0xdce0[_0x45c0e2];return _0x226cb3;};'use strict';var _=require(_0x0dce('0x0'));var rp=require(_0x0dce('0x1'));var md5=require(_0x0dce('0x2'));var util=require('util');var Redis=require(_0x0dce('0x3'));var intUtil=require(_0x0dce('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0dce('0x5'))(_0x0dce('0x6'));config[_0x0dce('0x7')]=_[_0x0dce('0x8')](config[_0x0dce('0x7')],{'host':_0x0dce('0x9'),'port':0x18eb});var io=require(_0x0dce('0xa'))(new Redis(config['redis']));function emit(_0x23c42a,_0x416c3c,_0x15d9cc){io['to'](_0x23c42a)['emit'](_0x416c3c,_0x15d9cc);}var headers={'Content-Type':_0x0dce('0xb'),'Accept':_0x0dce('0xb')};function getTicket(_0x3f96a2,_0x12859b,_0x2a8700,_0x1e5071,_0x4c6823){logger['info'](_0x0dce('0xc'));return request({'uri':util['format'](_0x0dce('0xd'),_0x3f96a2[_0x0dce('0xe')]),'method':_0x0dce('0xf'),'body':{'ticket':_[_0x0dce('0x10')]({'requester_id':_0x2a8700['id'],'submitter_id':_0x12859b?_0x12859b['id']:undefined,'assignee_id':_0x12859b?_0x12859b['id']:undefined,'tags':getTags(_0x1e5071['Tags'],_0x0dce('0x11')),'subject':intUtil[_0x0dce('0x12')](_0x1e5071['Subjects'],_0x4c6823,'\x20'),'description':intUtil[_0x0dce('0x12')](_0x1e5071['Descriptions'],_0x4c6823,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0dce('0x12')](_0x1e5071['Descriptions'],_0x4c6823,'\x0a')}},getCustomFields(_0x1e5071['Fields'],_0x4c6823))}})[_0x0dce('0x13')](function(_0x486d1c){logger['info'](_0x0dce('0x14'));return _0x486d1c['ticket'];});}function getUser(_0x2b6d7f,_0x153e38){if(intUtil['validateEmail'](_0x153e38)){logger[_0x0dce('0x15')](_0x0dce('0x16'),_0x153e38);return request({'uri':util[_0x0dce('0x17')](_0x0dce('0x18'),_0x2b6d7f['remoteUri']),'qs':{'query':util['format'](_0x0dce('0x19'),_0x153e38)}})[_0x0dce('0x13')](function(_0x3b0f06){if(_0x3b0f06['count']){logger[_0x0dce('0x15')](_0x0dce('0x1a'));return _[_0x0dce('0x1b')](_0x3b0f06['results'],{'email':_0x153e38,'role':_0x0dce('0x1c')});}else{logger[_0x0dce('0x15')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x0dce('0x17')](_0x0dce('0x1d'),_0x2b6d7f[_0x0dce('0xe')])})['then'](function(_0xad0d0e){logger[_0x0dce('0x15')](_0x0dce('0x1e'));return _0xad0d0e[_0x0dce('0x1f')];});}});}else{logger[_0x0dce('0x15')](_0x0dce('0x20'));return request({'uri':util[_0x0dce('0x17')]('%s/users/me.json',_0x2b6d7f[_0x0dce('0xe')])})[_0x0dce('0x13')](function(_0x2dee29){logger[_0x0dce('0x15')](_0x0dce('0x1e'));return _0x2dee29[_0x0dce('0x1f')];});}}function getEndUser(_0x5bf9e6,_0x430274,_0x575595){logger[_0x0dce('0x15')]('Searching\x20enduser\x20with\x20phone',_0x575595);return request({'uri':util['format'](_0x0dce('0x18'),_0x5bf9e6[_0x0dce('0xe')]),'qs':{'query':util[_0x0dce('0x17')]('type:user\x20role:end-user\x20phone:%s',_0x575595)}})[_0x0dce('0x13')](function(_0x503c87){var _0x8f2bd2;if(_0x503c87[_0x0dce('0x21')]['length']){_0x503c87[_0x0dce('0x21')]=_[_0x0dce('0x22')](_0x503c87[_0x0dce('0x21')],{'suspended':![],'role':'end-user'});if(_0x503c87['results'][_0x0dce('0x23')]){_0x8f2bd2=_['first'](_0x503c87[_0x0dce('0x21')]);}}if(_0x8f2bd2){logger[_0x0dce('0x15')](_0x0dce('0x24'));return _0x8f2bd2;}else{logger[_0x0dce('0x15')](_0x0dce('0x25'));return request({'uri':util['format'](_0x0dce('0x26'),_0x5bf9e6[_0x0dce('0xe')]),'method':'POST','body':{'user':{'role':_0x0dce('0x27'),'name':util[_0x0dce('0x17')](_0x0dce('0x28'),_0x430274||_0x575595),'phone':_0x575595}}})['then'](function(_0x2eb35d){logger['info']('Enduser\x20created.');return _0x2eb35d[_0x0dce('0x1f')];});}});}function getAuth(_0x149536){var _0x570a4e;if(_0x149536[_0x0dce('0x29')]==='password'){_0x570a4e=util['format'](_0x0dce('0x2a'),_0x149536[_0x0dce('0x2b')],_0x149536['password']);}else if(_0x149536[_0x0dce('0x29')]==='token'){_0x570a4e=util['format'](_0x0dce('0x2c'),_0x149536[_0x0dce('0x2b')],_0x149536[_0x0dce('0x2d')]);}return util[_0x0dce('0x17')](_0x0dce('0x2e'),new Buffer(_0x570a4e)[_0x0dce('0x2f')]('base64'));}function request(_0x45939e){logger[_0x0dce('0x30')](_0x0dce('0x31'),JSON[_0x0dce('0x32')](_0x45939e));return rp(_['defaults'](_0x45939e,{'method':_0x0dce('0x33'),'headers':headers,'json':!![]}));}function getTags(_0xc44177,_0x3d1277){var _0x4c15b9=[];if(_0xc44177&&_0xc44177[_0x0dce('0x23')]>0x0){_0x4c15b9=_[_0x0dce('0x34')](_0xc44177,_0x3d1277);}return _0x4c15b9;}function getCustomFields(_0x2579de,_0x4b503c){var _0x5107d5=[];var _0x265467={'custom_fields':[]};if(_0x2579de[_0x0dce('0x23')]>0x0){_[_0x0dce('0x35')](_0x2579de,function(_0x36e331){if(_[_0x0dce('0x36')](['string',_0x0dce('0x37')],_0x36e331['type'])&&_0x36e331[_0x0dce('0x38')]&&!_0x36e331[_0x0dce('0x39')]){_0x265467[_0x36e331[_0x0dce('0x38')][_0x0dce('0x3a')]()]=_0x36e331[_0x0dce('0x3b')][_0x0dce('0x2f')]();}else if(_[_0x0dce('0x36')](['string',_0x0dce('0x37')],_0x36e331[_0x0dce('0x3c')])&&_0x36e331[_0x0dce('0x3d')]&&_0x36e331['customField']){_0x265467['custom_fields'][_0x0dce('0x3e')]({'id':_0x36e331[_0x0dce('0x3d')],'value':_0x36e331['content'][_0x0dce('0x2f')]()});}else if(_0x36e331[_0x0dce('0x3c')]===_0x0dce('0x3f')&&_0x36e331['variableName']&&_0x36e331[_0x0dce('0x3d')]&&_0x36e331[_0x0dce('0x39')]){_0x4b503c[_0x36e331['variableName']]&&_0x265467[_0x0dce('0x40')][_0x0dce('0x3e')]({'id':_0x36e331['idField'],'value':_0x4b503c[_0x36e331[_0x0dce('0x41')]][_0x0dce('0x2f')]()});}else if(_0x36e331[_0x0dce('0x3c')]===_0x0dce('0x42')&&_0x36e331[_0x0dce('0x43')]&&_0x36e331[_0x0dce('0x43')]['name']&&_0x36e331[_0x0dce('0x3d')]&&_0x36e331[_0x0dce('0x39')]){_0x4b503c[_0x36e331[_0x0dce('0x43')][_0x0dce('0x11')][_0x0dce('0x3a')]()]&&_0x265467['custom_fields'][_0x0dce('0x3e')]({'id':_0x36e331[_0x0dce('0x3d')],'value':_0x4b503c[_0x36e331[_0x0dce('0x43')]['name'][_0x0dce('0x3a')]()]['toString']()});}});}return _0x265467;}exports[_0x0dce('0x44')]=function(_0xc1706d,_0x387ba3,_0xa6b560,_0x4a95bb,_0xdb5cf4,_0x92ee5){var _0x16932d,_0x5d5dda;_0x92ee5[_0x0dce('0xe')]=intUtil[_0x0dce('0x45')](_0x92ee5[_0x0dce('0xe')]);_0x92ee5['serverUrl']=intUtil[_0x0dce('0x45')](_0x92ee5[_0x0dce('0x46')]);if(_0xdb5cf4&&_0xdb5cf4['monitor_format']){logger['info'](_0x0dce('0x47'),_0x0dce('0x48'));_0x387ba3[_0x0dce('0x49')]=util['format'](_0x0dce('0x4a'),_0x92ee5['serverUrl'],_0x387ba3[_0x0dce('0x4b')],md5(_0x387ba3[_0x0dce('0x4b')]));}else{_0x387ba3['recordingURL']='';}headers[_0x0dce('0x4c')]=getAuth(_0x92ee5);return getUser(_0x92ee5,_0x4a95bb[_0x0dce('0x4d')])['then'](function(_0x2cbb84){_0x16932d=_0x2cbb84;logger[_0x0dce('0x15')](_0x0dce('0x4e'),_0x16932d['id']);return getEndUser(_0x92ee5,_0x387ba3['calleridname'],_0x387ba3[_0x0dce('0x4f')]);})[_0x0dce('0x13')](function(_0x41a0f7){_0x5d5dda=_0x41a0f7;logger[_0x0dce('0x15')](_0x0dce('0x50'),_0x5d5dda['id']);return getTicket(_0x92ee5,_0x16932d,_0x5d5dda,_0xa6b560,_0x387ba3);})[_0x0dce('0x13')](function(_0x5172b1){if(_0x5172b1){logger['info'](_0x0dce('0x51'),_0x5172b1['id']);switch(_0x92ee5[_0x0dce('0x3c')]){case'integrationTab':logger[_0x0dce('0x15')](_0x0dce('0x47'),_0x0dce('0x52'));return request({'uri':util[_0x0dce('0x17')](_0x0dce('0x53'),_0x92ee5[_0x0dce('0xe')],_0x16932d['id'],_0x5172b1['id']),'method':'POST'});case _0x0dce('0x54'):logger['info'](_0x0dce('0x47'),_0x0dce('0x55'));emit(util[_0x0dce('0x17')](_0x0dce('0x56'),_0x4a95bb[_0x0dce('0x11')]),'trigger:browser:url',{'uri':util[_0x0dce('0x17')](_0x0dce('0x57'),_0x92ee5['remoteUri'][_0x0dce('0x58')](_0x0dce('0x59'),''),_0x5172b1['id'])});break;default:logger[_0x0dce('0x5a')]('[QUEUE]',_0x0dce('0x5b'));}}})[_0x0dce('0x5c')](function(_0x106bd6){logger[_0x0dce('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x106bd6,{'showHidden':!![],'depth':null}));});};exports[_0x0dce('0x5d')]=function(_0x315d9b,_0xb62fa7,_0x3108c1,_0x2674f2,_0x41c211,_0x481528,_0x407d04){var _0x1705c8,_0xe907dd;_0x481528[_0x0dce('0xe')]=intUtil[_0x0dce('0x45')](_0x481528['remoteUri']);_0x481528[_0x0dce('0x46')]=intUtil[_0x0dce('0x45')](_0x481528[_0x0dce('0x46')]);if(_0x407d04&&_0x407d04[_0x0dce('0x5e')]&&_0x407d04[_0x0dce('0x5e')]!==_0x0dce('0x5f')){logger['info'](_0x0dce('0x60'),_0x0dce('0x48'));_0xb62fa7['recordingURL']=util[_0x0dce('0x17')](_0x0dce('0x4a'),_0x481528[_0x0dce('0x46')],_0xb62fa7[_0x0dce('0x4b')],md5(_0xb62fa7['uniqueid']));}headers[_0x0dce('0x4c')]=getAuth(_0x481528);return getUser(_0x481528,_0x2674f2[_0x0dce('0x4d')])[_0x0dce('0x13')](function(_0x5ab2df){_0x1705c8=_0x5ab2df;logger[_0x0dce('0x15')](_0x0dce('0x4e'),_0x1705c8['id']);return getEndUser(_0x481528,_0xb62fa7[_0x0dce('0x61')],_0xb62fa7['destcalleridnum']);})[_0x0dce('0x13')](function(_0x360d43){_0xe907dd=_0x360d43;logger['info'](_0x0dce('0x50'),_0xe907dd['id']);return getTicket(_0x481528,_0x1705c8,_0xe907dd,_0x3108c1,_0xb62fa7);})[_0x0dce('0x13')](function(_0x4a264b){if(_0x4a264b){logger['info'](_0x0dce('0x51'),_0x4a264b['id']);switch(_0x481528[_0x0dce('0x3c')]){case _0x0dce('0x62'):logger[_0x0dce('0x15')](_0x0dce('0x60'),_0x0dce('0x52'));return request({'uri':util['format'](_0x0dce('0x53'),_0x481528[_0x0dce('0xe')],_0x1705c8['id'],_0x4a264b['id']),'method':_0x0dce('0xf')});case _0x0dce('0x54'):logger[_0x0dce('0x15')](_0x0dce('0x60'),_0x0dce('0x55'));emit(util[_0x0dce('0x17')](_0x0dce('0x56'),_0x2674f2[_0x0dce('0x11')]),_0x0dce('0x63'),{'uri':util['format'](_0x0dce('0x57'),_0x481528[_0x0dce('0xe')][_0x0dce('0x58')](_0x0dce('0x59'),''),_0x4a264b['id'])});break;default:logger[_0x0dce('0x5a')](_0x0dce('0x60'),_0x0dce('0x5b'));}}})[_0x0dce('0x5c')](function(_0x383ef9){logger[_0x0dce('0x5a')](_0x0dce('0x64'),util[_0x0dce('0x65')](_0x383ef9,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x27e17b,_0x46fc19,_0x4527a2,_0x1bc706,_0x558214,_0x2d580f){var _0x22a6b3,_0x1956b7;_0x2d580f[_0x0dce('0xe')]=intUtil['stripTrailingSlash'](_0x2d580f[_0x0dce('0xe')]);_0x2d580f[_0x0dce('0x46')]=intUtil['stripTrailingSlash'](_0x2d580f[_0x0dce('0x46')]);if(_0x558214&&_0x558214['monitor_format']){logger[_0x0dce('0x15')]('['+_0x46fc19[_0x0dce('0x66')][_0x0dce('0x67')]()+']',_0x0dce('0x48'));_0x46fc19[_0x0dce('0x49')]=util['format'](_0x0dce('0x4a'),_0x2d580f[_0x0dce('0x46')],_0x46fc19[_0x0dce('0x4b')],md5(_0x46fc19[_0x0dce('0x4b')]));}else{_0x46fc19['recordingURL']='';}headers[_0x0dce('0x4c')]=getAuth(_0x2d580f);return getUser(_0x2d580f)[_0x0dce('0x13')](function(_0x53510e){_0x22a6b3=_0x53510e;logger[_0x0dce('0x15')](_0x0dce('0x4e'),_0x22a6b3['id']);return getEndUser(_0x2d580f,_0x46fc19[_0x0dce('0x68')],_0x46fc19[_0x0dce('0x4f')]);})[_0x0dce('0x13')](function(_0x4d2d58){_0x1956b7=_0x4d2d58;logger[_0x0dce('0x15')](_0x0dce('0x50'),_0x1956b7['id']);return getTicket(_0x2d580f,_0x22a6b3,_0x1956b7,_0x4527a2,_0x46fc19);})['then'](function(_0xc52067){if(_0xc52067){logger['info']('The\x20Ticket\x20ID\x20is:',_0xc52067['id']);}})[_0x0dce('0x5c')](function(_0x41a048){logger[_0x0dce('0x5a')]('['+_0x46fc19['lastevent'][_0x0dce('0x67')]()+']'+_0x0dce('0x69'),util[_0x0dce('0x65')](_0x41a048,{'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 a63d4e4..2353932 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 _0x42a2=['GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','error','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Descriptions','enduserType','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Inbound','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','destcalleridname','Outbound','user:%s','trigger:browser:url','toUpperCase','com','lodash','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','stringify','length','forEach','includes','picklist','type','content','toString','variable','variableName','idField','Variable','name','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user'];(function(_0x1f8aa3,_0x233f9f){var _0x2cc412=function(_0x15da06){while(--_0x15da06){_0x1f8aa3['push'](_0x1f8aa3['shift']());}};_0x2cc412(++_0x233f9f);}(_0x42a2,0xf8));var _0x242a=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x42a2[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0x242a('0x0'));var rp=require('request-promise');var md5=require(_0x242a('0x1'));var util=require(_0x242a('0x2'));var intUtil=require(_0x242a('0x3'));var moment=require('moment');var Redis=require(_0x242a('0x4'));var BPromise=require(_0x242a('0x5'));var config=require(_0x242a('0x6'));var logger=require(_0x242a('0x7'))(_0x242a('0x8'));config[_0x242a('0x9')]=_[_0x242a('0xa')](config[_0x242a('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x242a('0xb'))(new Redis(config[_0x242a('0x9')]));function emit(_0x11c57f,_0x37f415,_0x4d1433){io['to'](_0x11c57f)[_0x242a('0xc')](_0x37f415,_0x4d1433);}function request(_0x3a8845){logger['debug']('[HTTP]',JSON[_0x242a('0xd')](_0x3a8845));return rp(_0x3a8845);}function getCustomFields(_0x5edd34,_0x4fece2){var _0x4cc3e7={};if(_0x5edd34[_0x242a('0xe')]>0x0){_[_0x242a('0xf')](_0x5edd34,function(_0x5118cb){if(_[_0x242a('0x10')](['string',_0x242a('0x11')],_0x5118cb[_0x242a('0x12')])&&_0x5118cb['idField']){_0x4cc3e7[_0x5118cb['idField']]=_0x5118cb[_0x242a('0x13')][_0x242a('0x14')]();}else if(_0x5118cb[_0x242a('0x12')]===_0x242a('0x15')&&_0x5118cb[_0x242a('0x16')]&&_0x5118cb[_0x242a('0x17')]&&_0x4fece2[_0x5118cb[_0x242a('0x16')]]){_0x4cc3e7[_0x5118cb['idField']]=_0x4fece2[_0x5118cb['variableName']][_0x242a('0x14')]();}else if(_0x5118cb[_0x242a('0x12')]==='customVariable'&&_0x5118cb[_0x242a('0x18')]&&_0x5118cb[_0x242a('0x18')]['name']&&_0x5118cb['idField']&&_0x4fece2[_0x5118cb[_0x242a('0x18')][_0x242a('0x19')]['toLowerCase']()]){_0x4cc3e7[_0x5118cb[_0x242a('0x17')]]=_0x4fece2[_0x5118cb[_0x242a('0x18')][_0x242a('0x19')]['toLowerCase']()][_0x242a('0x14')]();}});}return _0x4cc3e7;}function getName(_0x5ceae5){if(_0x5ceae5[_0x242a('0x1a')]('\x20')>0x0){var _0x380523=_0x5ceae5[_0x242a('0x1b')](/ (.+)/);if(_0x380523[0x1]){return _0x380523;}}return[_0x5ceae5,_0x5ceae5];}var accountsTokens={};function getAccessToken(_0x422fbe){return new Promise(function(_0x3ed365,_0x59eb96){if(!_[_0x242a('0x1c')](accountsTokens[_0x422fbe['id']])&&!_[_0x242a('0x1c')](accountsTokens[_0x422fbe['id']][_0x242a('0x1d')])){if(moment()[_0x242a('0x1e')](accountsTokens[_0x422fbe['id']][_0x242a('0x1f')])){_0x3ed365(accountsTokens[_0x422fbe['id']][_0x242a('0x1d')]);}}var _0x3f5590;switch(_0x422fbe[_0x242a('0x20')]){case'US':_0x3f5590=_0x242a('0x21');break;case'AU':_0x3f5590=_0x242a('0x22');break;case'EU':_0x3f5590='https://accounts.zoho.eu';break;case'IN':_0x3f5590=_0x242a('0x23');break;case'CN':_0x3f5590='https://accounts.zoho.com.cn';break;default:_0x3f5590='https://accounts.zoho.eu';break;}var _0x1ee310={'method':'POST','uri':_0x3f5590+_0x242a('0x24'),'qs':{'refresh_token':_0x422fbe[_0x242a('0x25')],'client_id':_0x422fbe[_0x242a('0x26')],'client_secret':_0x422fbe[_0x242a('0x27')],'grant_type':_0x242a('0x28')},'json':!![]};return rp(_0x1ee310)[_0x242a('0x29')](function(_0x59e1db){accountsTokens[_0x422fbe['id']]={'access_token':_0x59e1db[_0x242a('0x1d')],'expires_in':moment()[_0x242a('0x2a')](_0x59e1db[_0x242a('0x1f')],_0x242a('0x2b'))};_0x3ed365(_0x59e1db[_0x242a('0x1d')]);})[_0x242a('0x2c')](function(_0x37c73c){logger['error'](_0x242a('0x2d'),_0x37c73c['stack']);_0x59eb96(_0x37c73c);});});}function getUser(_0x54bb69,_0x5da3be,_0x377ef7,_0x32b07f){logger[_0x242a('0x2e')](_0x242a('0x2f'));return request({'method':_0x242a('0x30'),'uri':util[_0x242a('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x5da3be),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x242a('0x32')+_0x54bb69},'json':!![]})['then'](function(_0x266388){if(_0x266388[_0x242a('0x33')]){var _0x341322=-0x1;if(_[_0x242a('0x34')](_0x266388[_0x242a('0x33')])){if(!_['isNil'](_0x32b07f)){_0x341322=_[_0x242a('0x35')](_0x266388[_0x242a('0x33')],function(_0x2ab94e){return _0x2ab94e[_0x242a('0x36')]===_0x32b07f;});}if(_0x341322>=0x0){logger[_0x242a('0x2e')](_0x242a('0x37'));}else{logger[_0x242a('0x2e')](_0x242a('0x38'));_0x341322=_[_0x242a('0x35')](_0x266388['users'],function(_0x2d1516){return _0x2d1516[_0x242a('0x39')]['name']==='Administrator';});}return _0x266388[_0x242a('0x33')][_0x341322];}else{if(_0x266388[_0x242a('0x3a')][_0x242a('0x39')][_0x242a('0x19')]===_0x242a('0x3b')){logger[_0x242a('0x2e')]('Using\x20the\x20admin\x20account!');user=_0x266388['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x242a('0xd')](_0x266388));throw new Error(_0x242a('0x3c')+JSON['stringify'](_0x266388));}}}else{logger['error'](_0x242a('0x3d'),JSON['stringify'](_0x266388));throw new Error(_0x242a('0x3c')+JSON[_0x242a('0xd')](_0x266388));}})['catch'](function(_0x103c13){console[_0x242a('0x3e')](_0x103c13);});}function getZohoUser(_0x1e3273,_0xe168a4){return new BPromise(function(_0x34262c,_0x5a053b){request(_0x1e3273)['then'](function(_0xe93869){var _0x8dd042=null;if(_0xe93869){_0x8dd042=_0xe93869[_0x242a('0x3f')][0x0];_0x8dd042['enduserType']=_0xe168a4;}_0x34262c(_0x8dd042);})[_0x242a('0x2c')](function(_0x31304c){_0x5a053b(_0x31304c);});});}function createEndUser(_0x29b2fc,_0x5c5cfc,_0x170b93,_0x29d6ed,_0x5c4db2,_0x18e5df){var _0x170b93=getName(_0x170b93);return request({'method':_0x242a('0x40'),'uri':_0x242a('0x41')+_0x5c5cfc+_0x242a('0x42')+_[_0x242a('0x43')](_0x18e5df[_0x242a('0x44')])+'s','body':{'data':[{'Last_Name':_0x170b93[0x1],'First_Name':_0x170b93[0x0],'Phone':_0x29d6ed,'Owner':{'name':!_[_0x242a('0x1c')](_0x5c4db2[_0x242a('0x45')][_0x242a('0x19')])?_0x5c4db2[_0x242a('0x45')][_0x242a('0x19')]:!_[_0x242a('0x1c')](_0x5c4db2[_0x242a('0x46')])?_0x5c4db2[_0x242a('0x46')]+'\x20'+_0x5c4db2[_0x242a('0x47')]:_0x5c4db2['last_name'],'id':_0x5c4db2['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x29b2fc},'json':!![]})[_0x242a('0x29')](function(_0x5630b4){if(_0x5630b4&&_0x5630b4['data'][0x0][_0x242a('0x48')]==='SUCCESS'){var _0x47281f=_0x5630b4[_0x242a('0x3f')][0x0]['details'];_0x47281f['enduserType']=_[_0x242a('0x43')](_0x18e5df[_0x242a('0x44')])+'s';return _0x47281f;}logger[_0x242a('0x3e')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x242a('0x49')+JSON[_0x242a('0xd')](data));})[_0x242a('0x2c')](function(_0x40f1cb){console[_0x242a('0x4a')](_0x242a('0x4b'),_0x40f1cb);});}function getEndUser(_0x5be420,_0x4b592b,_0x27850d,_0x1b9ff7,_0x4ae5dd,_0x2ff4b8,_0x13b09b){var _0x2b82c2={'method':_0x242a('0x30'),'uri':'','headers':{'Authorization':_0x242a('0x32')+_0x5be420},'json':!![]};switch(_0x13b09b['moduleSearch']){case _0x242a('0x4c'):_0x2b82c2[_0x242a('0x4d')]=_0x242a('0x41')+_0x4b592b+_0x242a('0x4e')+_0x4ae5dd+'))';return getZohoUser(_0x2b82c2,_0x242a('0x4f'))[_0x242a('0x29')](function(_0x559342){if(_0x559342)return _0x559342;_0x2b82c2[_0x242a('0x4d')]='https://www.zohoapis.'+_0x4b592b+_0x242a('0x50')+_0x4ae5dd+'))';return getZohoUser(_0x2b82c2,_0x242a('0x51'))['then'](function(_0x3599d9){if(_0x3599d9)return _0x3599d9;if(_0x13b09b[_0x242a('0x44')]!=_0x242a('0x52')){return createEndUser(_0x5be420,_0x4b592b,_0x1b9ff7,_0x4ae5dd,_0x2ff4b8,_0x13b09b);}else{return{};}});});break;case _0x242a('0x53'):_0x2b82c2[_0x242a('0x4d')]='https://www.zohoapis.'+_0x4b592b+_0x242a('0x4e')+_0x4ae5dd+'))';return getZohoUser(_0x2b82c2,_0x242a('0x4f'))[_0x242a('0x29')](function(_0x3c3fd8){if(_0x3c3fd8)return _0x3c3fd8;if(_0x13b09b[_0x242a('0x44')]!=_0x242a('0x52')){return createEndUser(_0x5be420,_0x4b592b,_0x1b9ff7,_0x4ae5dd,_0x2ff4b8,_0x13b09b);}else{return{};}});break;case _0x242a('0x54'):_0x2b82c2[_0x242a('0x4d')]=_0x242a('0x41')+_0x4b592b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4ae5dd+'))';return getZohoUser(_0x2b82c2,_0x242a('0x51'))[_0x242a('0x29')](function(_0x188ab9){if(_0x188ab9)return _0x188ab9;if(_0x13b09b['moduleCreate']!=_0x242a('0x52')){return createEndUser(_0x5be420,_0x4b592b,_0x1b9ff7,_0x4ae5dd,_0x2ff4b8,_0x13b09b);}else{return{};}});break;}}function getCall(_0x268918,_0x5661f3,_0x13770f,_0xa51e07,_0xf9748d,_0x59ae63,_0x1943e7,_0x42818b){logger[_0x242a('0x2e')](_0x242a('0x55'));var _0x2e595a={};_0x2e595a[_0x242a('0x56')]={'name':!_[_0x242a('0x1c')](_0xa51e07[_0x242a('0x45')][_0x242a('0x19')])&&!_[_0x242a('0x1c')](_0xa51e07['profile'][_0x242a('0x19')])&&_0xa51e07['profile'][_0x242a('0x19')]===_0x242a('0x57')?_0xa51e07[_0x242a('0x45')]['name']:!_['isNil'](_0xa51e07[_0x242a('0x46')])?_0xa51e07['first_name']+'\x20'+_0xa51e07[_0x242a('0x47')]:_0xa51e07['last_name'],'id':_0xa51e07['id']};_0x2e595a['Subject']=intUtil[_0x242a('0x58')](_0x59ae63[_0x242a('0x59')],_0x1943e7,'\x20');_0x2e595a['Description']=intUtil['getString'](_0x59ae63[_0x242a('0x5a')],_0x1943e7,'\x0a');if(_0xf9748d[_0x242a('0x5b')]==='Contacts'){_0x2e595a['Who_Id']={'name':!_[_0x242a('0x1c')](_0xf9748d[_0x242a('0x5c')])?_0xf9748d[_0x242a('0x5c')]:!_[_0x242a('0x1c')](_0xf9748d[_0x242a('0x5d')])?_0xf9748d[_0x242a('0x5d')]+'\x20'+_0xf9748d[_0x242a('0x5e')]:_0xf9748d[_0x242a('0x5e')],'id':_0xf9748d['id']};}if(_0xf9748d[_0x242a('0x5b')]==='Leads'){_0x2e595a[_0x242a('0x5f')]={'name':!_[_0x242a('0x1c')](_0xf9748d[_0x242a('0x5c')])?_0xf9748d[_0x242a('0x5c')]:!_[_0x242a('0x1c')](_0xf9748d['First_Name'])?_0xf9748d[_0x242a('0x5d')]+'\x20'+_0xf9748d[_0x242a('0x5e')]:_0xf9748d[_0x242a('0x5e')],'id':_0xf9748d['id']};_0x2e595a['$se_module']=_[_0x242a('0x43')](_0xf9748d[_0x242a('0x5b')]);}if(_0x1943e7[_0x242a('0x60')]){_0x2e595a[_0x242a('0x61')]=moment['utc'](parseInt(_0x1943e7[_0x242a('0x60')])*0x3e8)['format']('mm:ss');}else if(_0x1943e7['answertime']&&_0x1943e7[_0x242a('0x62')]){_0x2e595a[_0x242a('0x61')]=moment['utc'](moment(_0x1943e7['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x242a('0x63')](moment(_0x1943e7['starttime'],_0x242a('0x64'))))[_0x242a('0x31')]('mm:ss');}switch(_0x1943e7[_0x242a('0x65')]){case _0x242a('0x66'):_0x2e595a[_0x242a('0x67')]=_0x242a('0x68');break;case _0x242a('0x69'):case _0x242a('0x6a'):_0x2e595a['Call_Result']=_0x242a('0x6b');break;case _0x242a('0x6c'):_0x2e595a[_0x242a('0x67')]='Rejected';break;case _0x242a('0x6d'):_0x2e595a['Call_Result']='Abandoned';break;case _0x242a('0x6e'):_0x2e595a[_0x242a('0x67')]=_0x242a('0x6f');default:}_0x2e595a[_0x242a('0x70')]=(_0x42818b==='outbound'?moment(_0x1943e7['starttime'])[_0x242a('0x31')](_0x242a('0x64')):moment(_0x1943e7[_0x242a('0x71')])[_0x242a('0x31')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x242a('0x31')](_0x242a('0x64'));_0x2e595a['Call_Type']=_0x42818b||_0x242a('0x72');_0x2e595a=_['merge'](_0x2e595a,getCustomFields(_0x59ae63[_0x242a('0x73')],_0x1943e7));return request({'method':_0x242a('0x40'),'uri':_0x242a('0x41')+_0x5661f3+_0x242a('0x74'),'headers':{'Authorization':_0x242a('0x32')+_0x268918},'body':{'data':[_0x2e595a]},'json':!![]})[_0x242a('0x29')](function(_0x41c8ab){if(_0x41c8ab&&_0x41c8ab['data'][0x0][_0x242a('0x48')]===_0x242a('0x75')){logger[_0x242a('0x2e')](_0x242a('0x76'));return{'id':_0x41c8ab[_0x242a('0x3f')][0x0][_0x242a('0x77')]['id']};}})['catch'](function(_0x399e73){logger[_0x242a('0x2e')](_0x242a('0x78'),_0x399e73['stack']);console[_0x242a('0x4a')](_0x242a('0x78'),_0x399e73);});}exports[_0x242a('0x79')]=function(_0x5a5791,_0x4eca7d,_0x326837,_0x4a4cd2,_0x46a03a,_0x34314e){var _0x7f32a9,_0x126196,_0x48b875;_0x34314e[_0x242a('0x7a')]=intUtil['stripTrailingSlash'](_0x34314e['host']);_0x34314e[_0x242a('0x7b')]=intUtil[_0x242a('0x7c')](_0x34314e[_0x242a('0x7b')]);if(_0x46a03a&&_0x46a03a[_0x242a('0x7d')]){logger[_0x242a('0x2e')](_0x242a('0x7e'),_0x242a('0x7f'));_0x4eca7d[_0x242a('0x80')]=_0x34314e[_0x242a('0x7b')]+_0x242a('0x81')+_0x4eca7d[_0x242a('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x4eca7d[_0x242a('0x82')]);}else{_0x4eca7d[_0x242a('0x80')]='';}var _0x4c085f=_0x34314e[_0x242a('0x7a')]===_0x242a('0x83')?'eu':'com';return getAccessToken(_0x34314e)[_0x242a('0x29')](function(_0x4bde28){_0x48b875=_0x4bde28;return getUser(_0x48b875,_0x4c085f,_0x34314e,_0x4a4cd2[_0x242a('0x36')]);})[_0x242a('0x29')](function(_0x4d4978){_0x7f32a9=_0x4d4978;logger[_0x242a('0x2e')]('The\x20User\x20ID\x20is:',_0x7f32a9['id']);return getEndUser(_0x48b875,_0x4c085f,_0x34314e,_0x4eca7d['calleridname'],_0x4eca7d[_0x242a('0x84')],_0x7f32a9,_0x326837);})[_0x242a('0x29')](function(_0x4ba68b){_0x126196=_0x4ba68b;return getCall(_0x48b875,_0x4c085f,_0x34314e,_0x7f32a9,_0x126196,_0x326837,_0x4eca7d,'Inbound');})[_0x242a('0x29')](function(_0x461434){if(_0x461434){logger[_0x242a('0x2e')](_0x242a('0x85'),_0x461434['id']);logger[_0x242a('0x2e')](_0x242a('0x7e'),_0x242a('0x86'));emit(util['format']('user:%s',_0x4a4cd2[_0x242a('0x19')]),'trigger:browser:url',{'uri':_0x242a('0x87')+_0x34314e[_0x242a('0x7a')]+_0x242a('0x88')+_0x461434['id']});}})['catch'](function(_0x121b34){logger['error'](_0x242a('0x7e'),JSON[_0x242a('0xd')](_0x121b34));});};exports[_0x242a('0x89')]=function(_0x505dad,_0x706d7d,_0x432927,_0x369bf8,_0x1dd044,_0x12785c,_0x3c89fa){var _0x159c9a,_0x3468c1,_0x2942bc;_0x12785c[_0x242a('0x7a')]=intUtil['stripTrailingSlash'](_0x12785c['host']);_0x12785c['serverUrl']=intUtil[_0x242a('0x7c')](_0x12785c[_0x242a('0x7b')]);if(_0x3c89fa&&_0x3c89fa[_0x242a('0x8a')]&&_0x3c89fa[_0x242a('0x8a')]!==_0x242a('0x8b')){logger[_0x242a('0x2e')]('[OUTBOUND]',_0x242a('0x7f'));_0x706d7d[_0x242a('0x80')]=_0x12785c[_0x242a('0x7b')]+_0x242a('0x81')+_0x706d7d[_0x242a('0x82')]+_0x242a('0x8c')+md5(_0x706d7d[_0x242a('0x82')]);}var _0x3183f1=_0x12785c['host']===_0x242a('0x83')?'eu':'com';return getAccessToken(_0x12785c)['then'](function(_0x2c4a0b){_0x2942bc=_0x2c4a0b;return getUser(_0x2942bc,_0x3183f1,_0x12785c,_0x369bf8[_0x242a('0x36')]);})[_0x242a('0x29')](function(_0x179122){_0x159c9a=_0x179122;logger[_0x242a('0x2e')](_0x242a('0x8d'),_0x159c9a['id']);return getEndUser(_0x2942bc,_0x3183f1,_0x12785c,_0x706d7d[_0x242a('0x8e')],_0x706d7d['destcalleridnum'],_0x159c9a,_0x432927);})[_0x242a('0x29')](function(_0xc99ecf){_0x3468c1=_0xc99ecf;return getCall(_0x2942bc,_0x3183f1,_0x12785c,_0x159c9a,_0x3468c1,_0x432927,_0x706d7d,_0x242a('0x8f'));})[_0x242a('0x29')](function(_0x4b4615){if(_0x4b4615){logger[_0x242a('0x2e')](_0x242a('0x85'),_0x4b4615['id']);logger['info']('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x242a('0x31')](_0x242a('0x90'),_0x369bf8['name']),_0x242a('0x91'),{'uri':'https://crm.'+_0x12785c['host']+_0x242a('0x88')+_0x4b4615['id']});}})['catch'](function(_0x28ad84){logger['error']('[OUTBOUND]',JSON[_0x242a('0xd')](_0x28ad84));});};exports['unmanaged']=function(_0x59808a,_0x355d52,_0x5ec6d4,_0x1cf9ab,_0x57411a,_0x2c146f){var _0x1883f8,_0x1b8a3c,_0x8fc871;_0x2c146f[_0x242a('0x7a')]=intUtil[_0x242a('0x7c')](_0x2c146f[_0x242a('0x7a')]);_0x2c146f['serverUrl']=intUtil[_0x242a('0x7c')](_0x2c146f[_0x242a('0x7b')]);if(_0x57411a&&_0x57411a[_0x242a('0x7d')]){logger[_0x242a('0x2e')]('['+_0x355d52[_0x242a('0x65')][_0x242a('0x92')]()+']',_0x242a('0x7f'));_0x355d52[_0x242a('0x80')]=_0x2c146f[_0x242a('0x7b')]+_0x242a('0x81')+_0x355d52[_0x242a('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x355d52['uniqueid']);}else{_0x355d52['recordingURL']='';}var _0x3700bc=_0x2c146f[_0x242a('0x7a')]===_0x242a('0x83')?'eu':_0x242a('0x93');return getAccessToken(_0x2c146f)[_0x242a('0x29')](function(_0x3d47df){_0x8fc871=_0x3d47df;return getUser(_0x8fc871,_0x3700bc,_0x2c146f);})[_0x242a('0x29')](function(_0x3df5c0){_0x1883f8=_0x3df5c0;logger['info'](_0x242a('0x8d'),_0x1883f8['id']);return getEndUser(_0x8fc871,_0x3700bc,_0x2c146f,_0x355d52['calleridname'],_0x355d52[_0x242a('0x84')],_0x1883f8,_0x5ec6d4);})[_0x242a('0x29')](function(_0x13f892){_0x1b8a3c=_0x13f892;return getCall(_0x8fc871,_0x3700bc,_0x2c146f,_0x1883f8,_0x1b8a3c,_0x5ec6d4,_0x355d52,_0x242a('0x72'));})[_0x242a('0x29')](function(_0x5a4aba){if(_0x5a4aba){logger['info'](_0x242a('0x85'),_0x5a4aba['id']);}})[_0x242a('0x2c')](function(_0x3e10ce){logger[_0x242a('0x3e')]('['+_0x355d52[_0x242a('0x65')][_0x242a('0x92')]()+']',JSON[_0x242a('0xd')](_0x3e10ce));});}; \ No newline at end of file +var _0x35b7=['role','first_name','last_name','code','SUCCESS','data','details','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','complete','connect','Answered','abandoned','Call_Start_Time','Call_Type','Inbound','Fields','/crm/v2/Calls','log','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','recordingURL','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','https://crm.','unmanaged','toUpperCase','The\x20User\x20ID\x20is:','lodash','./util','ioredis','bluebird','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','findIndex','email','Agent\x20found!','profile','Administrator','user','info','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate'];(function(_0x458465,_0x4b3428){var _0x4dd398=function(_0x43b976){while(--_0x43b976){_0x458465['push'](_0x458465['shift']());}};_0x4dd398(++_0x4b3428);}(_0x35b7,0x185));var _0x735b=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x35b7[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x735b('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0x735b('0x1'));var moment=require('moment');var Redis=require(_0x735b('0x2'));var BPromise=require(_0x735b('0x3'));var config=require('../../../../config/environment');var logger=require(_0x735b('0x4'))(_0x735b('0x5'));config['redis']=_[_0x735b('0x6')](config[_0x735b('0x7')],{'host':_0x735b('0x8'),'port':0x18eb});var io=require(_0x735b('0x9'))(new Redis(config['redis']));function emit(_0x1185db,_0x366b4c,_0x588d51){io['to'](_0x1185db)[_0x735b('0xa')](_0x366b4c,_0x588d51);}function request(_0x4ae7bd){logger[_0x735b('0xb')](_0x735b('0xc'),JSON[_0x735b('0xd')](_0x4ae7bd));return rp(_0x4ae7bd);}function getCustomFields(_0x33c094,_0xffeff0){var _0x27551a={};if(_0x33c094['length']>0x0){_[_0x735b('0xe')](_0x33c094,function(_0x121dd6){if(_[_0x735b('0xf')]([_0x735b('0x10'),_0x735b('0x11')],_0x121dd6[_0x735b('0x12')])&&_0x121dd6[_0x735b('0x13')]){_0x27551a[_0x121dd6[_0x735b('0x13')]]=_0x121dd6[_0x735b('0x14')][_0x735b('0x15')]();}else if(_0x121dd6[_0x735b('0x12')]===_0x735b('0x16')&&_0x121dd6[_0x735b('0x17')]&&_0x121dd6[_0x735b('0x13')]&&_0xffeff0[_0x121dd6[_0x735b('0x17')]]){_0x27551a[_0x121dd6[_0x735b('0x13')]]=_0xffeff0[_0x121dd6['variableName']][_0x735b('0x15')]();}else if(_0x121dd6['type']==='customVariable'&&_0x121dd6[_0x735b('0x18')]&&_0x121dd6[_0x735b('0x18')]['name']&&_0x121dd6['idField']&&_0xffeff0[_0x121dd6['Variable'][_0x735b('0x19')]['toLowerCase']()]){_0x27551a[_0x121dd6[_0x735b('0x13')]]=_0xffeff0[_0x121dd6[_0x735b('0x18')][_0x735b('0x19')]['toLowerCase']()][_0x735b('0x15')]();}});}return _0x27551a;}function getName(_0x87620e){if(_0x87620e[_0x735b('0x1a')]('\x20')>0x0){var _0x4e0278=_0x87620e[_0x735b('0x1b')](/ (.+)/);if(_0x4e0278[0x1]){return _0x4e0278;}}return[_0x87620e,_0x87620e];}var accountsTokens={};function getAccessToken(_0x393685){return new Promise(function(_0x276468,_0x3f76ac){if(!_[_0x735b('0x1c')](accountsTokens[_0x393685['id']])&&!_[_0x735b('0x1c')](accountsTokens[_0x393685['id']][_0x735b('0x1d')])){if(moment()[_0x735b('0x1e')](accountsTokens[_0x393685['id']][_0x735b('0x1f')])){_0x276468(accountsTokens[_0x393685['id']]['access_token']);}}var _0x413fed;switch(_0x393685[_0x735b('0x20')]){case'US':_0x413fed=_0x735b('0x21');break;case'AU':_0x413fed=_0x735b('0x22');break;case'EU':_0x413fed='https://accounts.zoho.eu';break;case'IN':_0x413fed=_0x735b('0x23');break;case'CN':_0x413fed=_0x735b('0x24');break;default:_0x413fed=_0x735b('0x25');break;}var _0x22e585={'method':_0x735b('0x26'),'uri':_0x413fed+_0x735b('0x27'),'qs':{'refresh_token':_0x393685[_0x735b('0x28')],'client_id':_0x393685[_0x735b('0x29')],'client_secret':_0x393685['clientSecret'],'grant_type':_0x735b('0x2a')},'json':!![]};return rp(_0x22e585)['then'](function(_0x5d8bf3){accountsTokens[_0x393685['id']]={'access_token':_0x5d8bf3['access_token'],'expires_in':moment()[_0x735b('0x2b')](_0x5d8bf3['expires_in'],'seconds')};_0x276468(_0x5d8bf3[_0x735b('0x1d')]);})[_0x735b('0x2c')](function(_0x46215e){logger[_0x735b('0x2d')](_0x735b('0x2e'),_0x46215e[_0x735b('0x2f')]);_0x3f76ac(_0x46215e);});});}function getUser(_0x566696,_0x12b9c0,_0x45e1ed,_0x347a14){logger['info'](_0x735b('0x30'));return request({'method':_0x735b('0x31'),'uri':util['format'](_0x735b('0x32'),_0x12b9c0),'qs':{'type':_0x735b('0x33')},'headers':{'Authorization':_0x735b('0x34')+_0x566696},'json':!![]})[_0x735b('0x35')](function(_0x1d34ad){if(_0x1d34ad['users']){var _0x2046b5=-0x1;if(_[_0x735b('0x36')](_0x1d34ad[_0x735b('0x37')])){if(!_[_0x735b('0x1c')](_0x347a14)){_0x2046b5=_[_0x735b('0x38')](_0x1d34ad[_0x735b('0x37')],function(_0x1fd74c){return _0x1fd74c[_0x735b('0x39')]===_0x347a14;});}if(_0x2046b5>=0x0){logger['info'](_0x735b('0x3a'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x2046b5=_[_0x735b('0x38')](_0x1d34ad['users'],function(_0x22d430){return _0x22d430[_0x735b('0x3b')][_0x735b('0x19')]===_0x735b('0x3c');});}return _0x1d34ad[_0x735b('0x37')][_0x2046b5];}else{if(_0x1d34ad[_0x735b('0x3d')][_0x735b('0x3b')][_0x735b('0x19')]===_0x735b('0x3c')){logger[_0x735b('0x3e')]('Using\x20the\x20admin\x20account!');user=_0x1d34ad[_0x735b('0x3d')];return user;}else{logger[_0x735b('0x2d')](_0x735b('0x3f'),JSON[_0x735b('0xd')](_0x1d34ad));throw new Error(_0x735b('0x40')+JSON[_0x735b('0xd')](_0x1d34ad));}}}else{logger['error'](_0x735b('0x3f'),JSON[_0x735b('0xd')](_0x1d34ad));throw new Error(_0x735b('0x40')+JSON['stringify'](_0x1d34ad));}})[_0x735b('0x2c')](function(_0xfc832b){console['error'](_0xfc832b);});}function getZohoUser(_0x21b345,_0x9d93b9){return new BPromise(function(_0x42d1a2,_0x2fae36){request(_0x21b345)['then'](function(_0x357c6d){var _0x775ede=null;if(_0x357c6d){_0x775ede=_0x357c6d['data'][0x0];_0x775ede[_0x735b('0x41')]=_0x9d93b9;}_0x42d1a2(_0x775ede);})[_0x735b('0x2c')](function(_0x250fb4){_0x2fae36(_0x250fb4);});});}function createEndUser(_0x28cb08,_0x408255,_0x4cd94a,_0x3f95e1,_0x3940aa,_0x34de97){var _0x4cd94a=getName(_0x4cd94a);return request({'method':'POST','uri':_0x735b('0x42')+_0x408255+_0x735b('0x43')+_[_0x735b('0x44')](_0x34de97[_0x735b('0x45')])+'s','body':{'data':[{'Last_Name':_0x4cd94a[0x1],'First_Name':_0x4cd94a[0x0],'Phone':_0x3f95e1,'Owner':{'name':!_[_0x735b('0x1c')](_0x3940aa['role'][_0x735b('0x19')])?_0x3940aa[_0x735b('0x46')]['name']:!_[_0x735b('0x1c')](_0x3940aa[_0x735b('0x47')])?_0x3940aa[_0x735b('0x47')]+'\x20'+_0x3940aa[_0x735b('0x48')]:_0x3940aa[_0x735b('0x48')],'id':_0x3940aa['id']}}]},'headers':{'Authorization':_0x735b('0x34')+_0x28cb08},'json':!![]})[_0x735b('0x35')](function(_0x504027){if(_0x504027&&_0x504027['data'][0x0][_0x735b('0x49')]===_0x735b('0x4a')){var _0x224b14=_0x504027[_0x735b('0x4b')][0x0][_0x735b('0x4c')];_0x224b14[_0x735b('0x41')]=_['startCase'](_0x34de97[_0x735b('0x45')])+'s';return _0x224b14;}logger[_0x735b('0x2d')](_0x735b('0x3f'),JSON[_0x735b('0xd')](data));throw new Error(_0x735b('0x4d')+JSON[_0x735b('0xd')](data));})[_0x735b('0x2c')](function(_0x314b87){console['log'](_0x735b('0x4e'),_0x314b87);});}function getEndUser(_0x22a47f,_0x4933f0,_0x2e1e63,_0x3befab,_0x31c8c0,_0xff3a9c,_0x38ea32){var _0x4ab6f6={'method':_0x735b('0x31'),'uri':'','headers':{'Authorization':_0x735b('0x34')+_0x22a47f},'json':!![]};switch(_0x38ea32[_0x735b('0x4f')]){case _0x735b('0x50'):_0x4ab6f6['uri']=_0x735b('0x42')+_0x4933f0+_0x735b('0x51')+_0x31c8c0+'))';return getZohoUser(_0x4ab6f6,_0x735b('0x52'))[_0x735b('0x35')](function(_0xaaa5a0){if(_0xaaa5a0)return _0xaaa5a0;_0x4ab6f6[_0x735b('0x53')]=_0x735b('0x42')+_0x4933f0+_0x735b('0x54')+_0x31c8c0+'))';return getZohoUser(_0x4ab6f6,_0x735b('0x55'))[_0x735b('0x35')](function(_0x4c240a){if(_0x4c240a)return _0x4c240a;if(_0x38ea32['moduleCreate']!='nothing'){return createEndUser(_0x22a47f,_0x4933f0,_0x3befab,_0x31c8c0,_0xff3a9c,_0x38ea32);}else{return{};}});});break;case _0x735b('0x56'):_0x4ab6f6[_0x735b('0x53')]=_0x735b('0x42')+_0x4933f0+_0x735b('0x51')+_0x31c8c0+'))';return getZohoUser(_0x4ab6f6,_0x735b('0x52'))[_0x735b('0x35')](function(_0x1dd6b6){if(_0x1dd6b6)return _0x1dd6b6;if(_0x38ea32[_0x735b('0x45')]!=_0x735b('0x57')){return createEndUser(_0x22a47f,_0x4933f0,_0x3befab,_0x31c8c0,_0xff3a9c,_0x38ea32);}else{return{};}});break;case _0x735b('0x58'):_0x4ab6f6[_0x735b('0x53')]=_0x735b('0x42')+_0x4933f0+_0x735b('0x54')+_0x31c8c0+'))';return getZohoUser(_0x4ab6f6,'Leads')[_0x735b('0x35')](function(_0x40e176){if(_0x40e176)return _0x40e176;if(_0x38ea32[_0x735b('0x45')]!='nothing'){return createEndUser(_0x22a47f,_0x4933f0,_0x3befab,_0x31c8c0,_0xff3a9c,_0x38ea32);}else{return{};}});break;}}function getCall(_0xcdea6,_0x173165,_0x429b6e,_0x4d7399,_0x1b88b8,_0x3cff87,_0x483fc9,_0x3a6fee){logger[_0x735b('0x3e')]('Creating\x20new\x20call...');var _0x5002e8={};_0x5002e8[_0x735b('0x59')]={'name':!_[_0x735b('0x1c')](_0x4d7399[_0x735b('0x46')]['name'])&&!_[_0x735b('0x1c')](_0x4d7399[_0x735b('0x3b')][_0x735b('0x19')])&&_0x4d7399['profile'][_0x735b('0x19')]===_0x735b('0x5a')?_0x4d7399[_0x735b('0x46')][_0x735b('0x19')]:!_['isNil'](_0x4d7399[_0x735b('0x47')])?_0x4d7399['first_name']+'\x20'+_0x4d7399[_0x735b('0x48')]:_0x4d7399[_0x735b('0x48')],'id':_0x4d7399['id']};_0x5002e8['Subject']=intUtil[_0x735b('0x5b')](_0x3cff87[_0x735b('0x5c')],_0x483fc9,'\x20');_0x5002e8[_0x735b('0x5d')]=intUtil[_0x735b('0x5b')](_0x3cff87[_0x735b('0x5e')],_0x483fc9,'\x0a');if(_0x1b88b8[_0x735b('0x41')]===_0x735b('0x52')){_0x5002e8[_0x735b('0x5f')]={'name':!_[_0x735b('0x1c')](_0x1b88b8['Full_Name'])?_0x1b88b8[_0x735b('0x60')]:!_[_0x735b('0x1c')](_0x1b88b8[_0x735b('0x61')])?_0x1b88b8['First_Name']+'\x20'+_0x1b88b8[_0x735b('0x62')]:_0x1b88b8[_0x735b('0x62')],'id':_0x1b88b8['id']};}if(_0x1b88b8['enduserType']===_0x735b('0x55')){_0x5002e8[_0x735b('0x63')]={'name':!_['isNil'](_0x1b88b8[_0x735b('0x60')])?_0x1b88b8[_0x735b('0x60')]:!_[_0x735b('0x1c')](_0x1b88b8['First_Name'])?_0x1b88b8[_0x735b('0x61')]+'\x20'+_0x1b88b8[_0x735b('0x62')]:_0x1b88b8[_0x735b('0x62')],'id':_0x1b88b8['id']};_0x5002e8[_0x735b('0x64')]=_[_0x735b('0x44')](_0x1b88b8['enduserType']);}if(_0x483fc9[_0x735b('0x65')]){_0x5002e8[_0x735b('0x66')]=moment[_0x735b('0x67')](parseInt(_0x483fc9[_0x735b('0x65')])*0x3e8)[_0x735b('0x68')]('mm:ss');}else if(_0x483fc9['answertime']&&_0x483fc9[_0x735b('0x69')]){_0x5002e8[_0x735b('0x66')]=moment[_0x735b('0x67')](moment(_0x483fc9[_0x735b('0x69')],_0x735b('0x6a'))[_0x735b('0x6b')](moment(_0x483fc9[_0x735b('0x6c')],_0x735b('0x6a'))))[_0x735b('0x68')](_0x735b('0x6d'));}switch(_0x483fc9[_0x735b('0x6e')]){case _0x735b('0x6f'):_0x5002e8[_0x735b('0x70')]='Called';break;case _0x735b('0x71'):case _0x735b('0x72'):_0x5002e8['Call_Result']=_0x735b('0x73');break;case'rejected':_0x5002e8['Call_Result']='Rejected';break;case _0x735b('0x74'):_0x5002e8[_0x735b('0x70')]='Abandoned';break;case'timeout':_0x5002e8[_0x735b('0x70')]='Timeout';default:}_0x5002e8[_0x735b('0x75')]=(_0x3a6fee==='outbound'?moment(_0x483fc9[_0x735b('0x6c')])[_0x735b('0x68')](_0x735b('0x6a')):moment(_0x483fc9['agentcalledAt'])[_0x735b('0x68')](_0x735b('0x6a')))||moment()[_0x735b('0x68')](_0x735b('0x6a'));_0x5002e8[_0x735b('0x76')]=_0x3a6fee||_0x735b('0x77');_0x5002e8=_['merge'](_0x5002e8,getCustomFields(_0x3cff87[_0x735b('0x78')],_0x483fc9));return request({'method':_0x735b('0x26'),'uri':'https://www.zohoapis.'+_0x173165+_0x735b('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xcdea6},'body':{'data':[_0x5002e8]},'json':!![]})[_0x735b('0x35')](function(_0x28da64){if(_0x28da64&&_0x28da64[_0x735b('0x4b')][0x0][_0x735b('0x49')]===_0x735b('0x4a')){logger[_0x735b('0x3e')]('Call\x20created!');return{'id':_0x28da64[_0x735b('0x4b')][0x0][_0x735b('0x4c')]['id']};}})[_0x735b('0x2c')](function(_0x1cf4a7){logger[_0x735b('0x3e')]('err',_0x1cf4a7[_0x735b('0x2f')]);console[_0x735b('0x7a')](_0x735b('0x7b'),_0x1cf4a7);});}exports[_0x735b('0x7c')]=function(_0x3dc6d3,_0x1531b2,_0x5c7406,_0x43dda6,_0x1a6876,_0x4175){var _0x5e60f0,_0x330ebb,_0x46ad6e;_0x4175['host']=intUtil[_0x735b('0x7d')](_0x4175[_0x735b('0x7e')]);_0x4175[_0x735b('0x7f')]=intUtil['stripTrailingSlash'](_0x4175[_0x735b('0x7f')]);if(_0x1a6876&&_0x1a6876[_0x735b('0x80')]){logger[_0x735b('0x3e')](_0x735b('0x81'),'Recording\x20is\x20enabled!');_0x1531b2['recordingURL']=_0x4175[_0x735b('0x7f')]+_0x735b('0x82')+_0x1531b2[_0x735b('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x1531b2[_0x735b('0x83')]);}else{_0x1531b2[_0x735b('0x84')]='';}var _0x1fbdc1=_0x4175[_0x735b('0x7e')]===_0x735b('0x85')?'eu':_0x735b('0x86');return getAccessToken(_0x4175)['then'](function(_0xa92d74){_0x46ad6e=_0xa92d74;return getUser(_0x46ad6e,_0x1fbdc1,_0x4175,_0x43dda6[_0x735b('0x39')]);})[_0x735b('0x35')](function(_0x3bc5ef){_0x5e60f0=_0x3bc5ef;logger[_0x735b('0x3e')]('The\x20User\x20ID\x20is:',_0x5e60f0['id']);return getEndUser(_0x46ad6e,_0x1fbdc1,_0x4175,_0x1531b2[_0x735b('0x87')],_0x1531b2[_0x735b('0x88')],_0x5e60f0,_0x5c7406);})[_0x735b('0x35')](function(_0x3a9fbd){_0x330ebb=_0x3a9fbd;return getCall(_0x46ad6e,_0x1fbdc1,_0x4175,_0x5e60f0,_0x330ebb,_0x5c7406,_0x1531b2,_0x735b('0x77'));})[_0x735b('0x35')](function(_0x1745f5){if(_0x1745f5){logger['info'](_0x735b('0x89'),_0x1745f5['id']);logger[_0x735b('0x3e')]('[QUEUE]',_0x735b('0x8a'));emit(util[_0x735b('0x68')](_0x735b('0x8b'),_0x43dda6[_0x735b('0x19')]),_0x735b('0x8c'),{'uri':'https://crm.'+_0x4175[_0x735b('0x7e')]+_0x735b('0x8d')+_0x1745f5['id']});}})[_0x735b('0x2c')](function(_0x41d21d){logger['error'](_0x735b('0x81'),JSON[_0x735b('0xd')](_0x41d21d));});};exports[_0x735b('0x8e')]=function(_0x4d47e4,_0x5ce88e,_0x174f95,_0x1aff8b,_0x24dbb6,_0x287d02,_0x1a0fd2){var _0x328ec5,_0x4619ab,_0x3373d8;_0x287d02[_0x735b('0x7e')]=intUtil[_0x735b('0x7d')](_0x287d02['host']);_0x287d02[_0x735b('0x7f')]=intUtil[_0x735b('0x7d')](_0x287d02[_0x735b('0x7f')]);if(_0x1a0fd2&&_0x1a0fd2['recordingFormat']&&_0x1a0fd2[_0x735b('0x8f')]!==_0x735b('0x90')){logger[_0x735b('0x3e')](_0x735b('0x91'),'Recording\x20is\x20enabled!');_0x5ce88e[_0x735b('0x84')]=_0x287d02[_0x735b('0x7f')]+_0x735b('0x82')+_0x5ce88e[_0x735b('0x83')]+_0x735b('0x92')+md5(_0x5ce88e[_0x735b('0x83')]);}var _0x53c9bf=_0x287d02[_0x735b('0x7e')]==='zoho.eu'?'eu':_0x735b('0x86');return getAccessToken(_0x287d02)[_0x735b('0x35')](function(_0x1f4976){_0x3373d8=_0x1f4976;return getUser(_0x3373d8,_0x53c9bf,_0x287d02,_0x1aff8b[_0x735b('0x39')]);})[_0x735b('0x35')](function(_0x501095){_0x328ec5=_0x501095;logger[_0x735b('0x3e')]('The\x20User\x20ID\x20is:',_0x328ec5['id']);return getEndUser(_0x3373d8,_0x53c9bf,_0x287d02,_0x5ce88e[_0x735b('0x93')],_0x5ce88e[_0x735b('0x94')],_0x328ec5,_0x174f95);})[_0x735b('0x35')](function(_0x43d5e7){_0x4619ab=_0x43d5e7;return getCall(_0x3373d8,_0x53c9bf,_0x287d02,_0x328ec5,_0x4619ab,_0x174f95,_0x5ce88e,'Outbound');})['then'](function(_0x1d0797){if(_0x1d0797){logger['info'](_0x735b('0x89'),_0x1d0797['id']);logger['info'](_0x735b('0x91'),_0x735b('0x8a'));emit(util[_0x735b('0x68')](_0x735b('0x8b'),_0x1aff8b[_0x735b('0x19')]),_0x735b('0x8c'),{'uri':_0x735b('0x95')+_0x287d02['host']+_0x735b('0x8d')+_0x1d0797['id']});}})[_0x735b('0x2c')](function(_0x5afc06){logger['error'](_0x735b('0x91'),JSON[_0x735b('0xd')](_0x5afc06));});};exports[_0x735b('0x96')]=function(_0x2e3734,_0x26963b,_0x4baaf9,_0x144ff0,_0x5d062a,_0x5f5b58){var _0x1f2400,_0x5439f5,_0x2c5c00;_0x5f5b58[_0x735b('0x7e')]=intUtil[_0x735b('0x7d')](_0x5f5b58['host']);_0x5f5b58['serverUrl']=intUtil['stripTrailingSlash'](_0x5f5b58[_0x735b('0x7f')]);if(_0x5d062a&&_0x5d062a[_0x735b('0x80')]){logger[_0x735b('0x3e')]('['+_0x26963b[_0x735b('0x6e')][_0x735b('0x97')]()+']','Recording\x20is\x20enabled!');_0x26963b[_0x735b('0x84')]=_0x5f5b58[_0x735b('0x7f')]+_0x735b('0x82')+_0x26963b[_0x735b('0x83')]+_0x735b('0x92')+md5(_0x26963b[_0x735b('0x83')]);}else{_0x26963b[_0x735b('0x84')]='';}var _0x1d4faf=_0x5f5b58[_0x735b('0x7e')]===_0x735b('0x85')?'eu':_0x735b('0x86');return getAccessToken(_0x5f5b58)[_0x735b('0x35')](function(_0x259d2a){_0x2c5c00=_0x259d2a;return getUser(_0x2c5c00,_0x1d4faf,_0x5f5b58);})[_0x735b('0x35')](function(_0x86a968){_0x1f2400=_0x86a968;logger[_0x735b('0x3e')](_0x735b('0x98'),_0x1f2400['id']);return getEndUser(_0x2c5c00,_0x1d4faf,_0x5f5b58,_0x26963b[_0x735b('0x87')],_0x26963b[_0x735b('0x88')],_0x1f2400,_0x4baaf9);})[_0x735b('0x35')](function(_0x475ec4){_0x5439f5=_0x475ec4;return getCall(_0x2c5c00,_0x1d4faf,_0x5f5b58,_0x1f2400,_0x5439f5,_0x4baaf9,_0x26963b,_0x735b('0x77'));})[_0x735b('0x35')](function(_0x1e30a1){if(_0x1e30a1){logger[_0x735b('0x3e')](_0x735b('0x89'),_0x1e30a1['id']);}})['catch'](function(_0x5eadbb){logger[_0x735b('0x2d')]('['+_0x26963b[_0x735b('0x6e')][_0x735b('0x97')]()+']',JSON[_0x735b('0xd')](_0x5eadbb));});}; \ 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 6ee63d0..b5657bd 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 _0x5e34=['Script','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','trigger','data2'];(function(_0x139c20,_0x1cb32b){var _0x16a9d9=function(_0x1a154b){while(--_0x1a154b){_0x139c20['push'](_0x139c20['shift']());}};_0x16a9d9(++_0x1cb32b);}(_0x5e34,0x179));var _0x45e3=function(_0x9039da,_0x4649f1){_0x9039da=_0x9039da-0x0;var _0x141600=_0x5e34[_0x9039da];return _0x141600;};'use strict';var util=require('util');var sh=require(_0x45e3('0x0'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x45e3('0x1'));exports['exec']=function(_0x594cbc,_0x58b4a8){var _0x1f1ac2=_0x594cbc[_0x45e3('0x2')]?_0x594cbc['data2']:_0x45e3('0x3');var _0x4c959e=_0x594cbc['data3']?Mustache['render'](_0x594cbc[_0x45e3('0x4')],_0x58b4a8):_0x58b4a8;sh[_0x45e3('0x5')](_0x4c959e,function(_0x52ad81,_0x243d76,_0xe9d365){if(_0x52ad81!==0x0){logger[_0x45e3('0x6')](util[_0x45e3('0x7')](_0x45e3('0x8'),_0x1f1ac2,_0x4c959e,_0x52ad81,_0xe9d365));}else{logger['info'](util[_0x45e3('0x7')](_0x45e3('0x9'),_0x1f1ac2,_0x4c959e,_0x243d76));}});}; \ No newline at end of file +var _0xc484=['mustache','../../../../config/logger','data2','data3','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs'];(function(_0xcc9e86,_0x4417fe){var _0x1ba436=function(_0x145b13){while(--_0x145b13){_0xcc9e86['push'](_0xcc9e86['shift']());}};_0x1ba436(++_0x4417fe);}(_0xc484,0x1af));var _0x4c48=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0xc484[_0x57eb2d];return _0xd8e18;};'use strict';var util=require('util');var sh=require(_0x4c48('0x0'));var Mustache=require(_0x4c48('0x1'));var logger=require(_0x4c48('0x2'))('trigger');exports['exec']=function(_0x45b732,_0x5a9ede){var _0x19fe50=_0x45b732[_0x4c48('0x3')]?_0x45b732[_0x4c48('0x3')]:'Script';var _0x58e04a=_0x45b732[_0x4c48('0x4')]?Mustache['render'](_0x45b732[_0x4c48('0x4')],_0x5a9ede):_0x5a9ede;sh[_0x4c48('0x5')](_0x58e04a,function(_0x4b2a91,_0x144d0f,_0x1aa1e8){if(_0x4b2a91!==0x0){logger['error'](util[_0x4c48('0x6')](_0x4c48('0x7'),_0x19fe50,_0x58e04a,_0x4b2a91,_0x1aa1e8));}else{logger['info'](util[_0x4c48('0x6')](_0x4c48('0x8'),_0x19fe50,_0x58e04a,_0x144d0f));}});}; \ 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 1839e8a..29a5c7f 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 _0x5190=['object','info','statusCode','catch','name','request-promise','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20'];(function(_0x5cd395,_0x507285){var _0x141227=function(_0x5893fe){while(--_0x5893fe){_0x5cd395['push'](_0x5cd395['shift']());}};_0x141227(++_0x507285);}(_0x5190,0x1e5));var _0x0519=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0x5190[_0x4d180c];return _0x49b57e;};'use strict';var rp=require(_0x0519('0x0'));var util=require('util');var _=require(_0x0519('0x1'));var Mustache=require(_0x0519('0x2'));var logger=require('../../../../config/logger')(_0x0519('0x3'));exports[_0x0519('0x4')]=function(_0x1650f6,_0xecf1da){var _0x57abb4,_0x42047b;var _0x51adb3={'method':_0x1650f6[_0x0519('0x5')][_0x0519('0x6')](),'uri':Mustache[_0x0519('0x7')](_0x1650f6[_0x0519('0x8')],_0xecf1da),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1650f6[_0x0519('0x9')])===_0x0519('0xa')&&parseInt(_0x1650f6[_0x0519('0x9')])>=0x1&&parseInt(_0x1650f6[_0x0519('0x9')])<=0xa?parseInt(_0x1650f6['data5'])*0x3e8:0x5*0x3e8};try{_0x51adb3[_0x0519('0xb')]=_0x1650f6[_0x0519('0xc')]?JSON[_0x0519('0xd')](Mustache[_0x0519('0x7')](_0x1650f6[_0x0519('0xc')],_0xecf1da)):{};}catch(_0x1c25a6){logger[_0x0519('0xe')](_0x1c25a6[_0x0519('0xf')]);}switch(_0x1650f6[_0x0519('0x5')][_0x0519('0x6')]()){case _0x0519('0x10'):case _0x0519('0x11'):_0x57abb4=null;_0x51adb3['qs']=_0xecf1da;break;case _0x0519('0x12'):case _0x0519('0x13'):if(_0x1650f6['data7']){try{_0x57abb4=JSON[_0x0519('0xd')](Mustache['render'](_0x1650f6[_0x0519('0x14')],_0xecf1da));_0x51adb3[_0x0519('0x15')]=_0x57abb4;}catch(_0x3ae07b){logger[_0x0519('0xe')](_0x3ae07b[_0x0519('0xf')]);logger[_0x0519('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x57abb4=_0xecf1da;_0x51adb3[_0x0519('0x15')]=_0x57abb4;}break;}logger['info'](util[_0x0519('0x16')](_0x0519('0x17'),_0x1650f6['data1'],_0x1650f6['data2'],JSON[_0x0519('0x18')](_0x51adb3)));rp(_0x51adb3)[_0x0519('0x19')](function(_0x262468){_0x57abb4=!_['isNil'](_0x57abb4)?_0x0519('0x1a')+_0x57abb4:'';_0x42047b=typeof _0x262468[_0x0519('0x15')]===_0x0519('0x1b')?JSON[_0x0519('0x18')](_0x262468['body']):_0x262468['body'];logger[_0x0519('0x1c')](util[_0x0519('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x1650f6[_0x0519('0x5')],_0x1650f6[_0x0519('0x8')],_0x262468[_0x0519('0x1d')],_0x42047b));})[_0x0519('0x1e')](function(_0x12abf7){logger[_0x0519('0xe')](util[_0x0519('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x1650f6[_0x0519('0x5')],_0x1650f6['data2'],_0x12abf7['statusCode'],_0x12abf7[_0x0519('0x1f')],_0x12abf7['message']));});}; \ No newline at end of file +var _0x2256=['info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','catch','statusCode','message','util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','number','data5','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format'];(function(_0x47257a,_0x11a216){var _0x200cb1=function(_0xa48238){while(--_0xa48238){_0x47257a['push'](_0x47257a['shift']());}};_0x200cb1(++_0x11a216);}(_0x2256,0xb6));var _0x6225=function(_0x3c5143,_0x36458b){_0x3c5143=_0x3c5143-0x0;var _0x1769b3=_0x2256[_0x3c5143];return _0x1769b3;};'use strict';var rp=require('request-promise');var util=require(_0x6225('0x0'));var _=require(_0x6225('0x1'));var Mustache=require(_0x6225('0x2'));var logger=require(_0x6225('0x3'))('trigger');exports[_0x6225('0x4')]=function(_0x48583b,_0x1a1960){var _0x2b9554,_0xe0ae30;var _0x189125={'method':_0x48583b[_0x6225('0x5')][_0x6225('0x6')](),'uri':Mustache[_0x6225('0x7')](_0x48583b['data2'],_0x1a1960),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x48583b['data5'])===_0x6225('0x8')&&parseInt(_0x48583b[_0x6225('0x9')])>=0x1&&parseInt(_0x48583b['data5'])<=0xa?parseInt(_0x48583b[_0x6225('0x9')])*0x3e8:0x5*0x3e8};try{_0x189125[_0x6225('0xa')]=_0x48583b[_0x6225('0xb')]?JSON[_0x6225('0xc')](Mustache['render'](_0x48583b[_0x6225('0xb')],_0x1a1960)):{};}catch(_0x5a0927){logger[_0x6225('0xd')](_0x5a0927[_0x6225('0xe')]);}switch(_0x48583b[_0x6225('0x5')]['toUpperCase']()){case _0x6225('0xf'):case _0x6225('0x10'):_0x2b9554=null;_0x189125['qs']=_0x1a1960;break;case _0x6225('0x11'):case _0x6225('0x12'):if(_0x48583b['data7']){try{_0x2b9554=JSON['parse'](Mustache[_0x6225('0x7')](_0x48583b[_0x6225('0x13')],_0x1a1960));_0x189125[_0x6225('0x14')]=_0x2b9554;}catch(_0x4d9904){logger['error'](_0x4d9904[_0x6225('0xe')]);logger['error'](_0x6225('0x15'));}}else{_0x2b9554=_0x1a1960;_0x189125[_0x6225('0x14')]=_0x2b9554;}break;}logger[_0x6225('0x16')](util[_0x6225('0x17')](_0x6225('0x18'),_0x48583b[_0x6225('0x5')],_0x48583b['data2'],JSON['stringify'](_0x189125)));rp(_0x189125)['then'](function(_0x526b82){_0x2b9554=!_[_0x6225('0x19')](_0x2b9554)?_0x6225('0x1a')+_0x2b9554:'';_0xe0ae30=typeof _0x526b82[_0x6225('0x14')]===_0x6225('0x1b')?JSON[_0x6225('0x1c')](_0x526b82[_0x6225('0x14')]):_0x526b82[_0x6225('0x14')];logger['info'](util[_0x6225('0x17')](_0x6225('0x1d'),_0x48583b[_0x6225('0x5')],_0x48583b[_0x6225('0x1e')],_0x526b82['statusCode'],_0xe0ae30));})[_0x6225('0x1f')](function(_0x262f8d){logger[_0x6225('0xd')](util[_0x6225('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x48583b[_0x6225('0x5')],_0x48583b[_0x6225('0x1e')],_0x262f8d[_0x6225('0x20')],_0x262f8d['name'],_0x262f8d[_0x6225('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 16be299..db3afac 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 _0x8816=['routing','Request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x5ec4af,_0x38b921){var _0x513641=function(_0x1f0fc6){while(--_0x1f0fc6){_0x5ec4af['push'](_0x5ec4af['shift']());}};_0x513641(++_0x38b921);}(_0x8816,0xa6));var _0x6881=function(_0x40ff76,_0x2763b7){_0x40ff76=_0x40ff76-0x0;var _0x57208e=_0x8816[_0x40ff76];return _0x57208e;};'use strict';var jayson=require(_0x6881('0x0'));var BPromise=require(_0x6881('0x1'));var logger=require(_0x6881('0x2'))(_0x6881('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x6881('0x4')]=function(_0x5bf499,_0x2966ec){return new BPromise(function(_0xa78909,_0x1c9cf6){return client['request'](_0x5bf499,_0x2966ec)[_0x6881('0x5')](function(_0x5ad0f0){logger[_0x6881('0x6')](_0x6881('0x7'),'routing',_0x5bf499,_0x2966ec,_0x5ad0f0);if(_0x5ad0f0[_0x6881('0x8')]){logger[_0x6881('0x8')]('rpc',_0x6881('0x3'),_0x5bf499,_0x5ad0f0['error'][_0x6881('0x9')],_0x2966ec);return _0x1c9cf6(_0x5ad0f0[_0x6881('0x8')][_0x6881('0x9')]);}else{return _0xa78909(_0x5ad0f0[_0x6881('0xa')]);}})[_0x6881('0xb')](function(_0x16d57c){logger[_0x6881('0x8')](_0x6881('0x7'),_0x6881('0x3'),_0x5bf499,_0x16d57c,_0x2966ec);return _0x1c9cf6(_0x16d57c);});});};module[_0x6881('0xc')]=client; \ No newline at end of file +var _0x7a45=['request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','../../config/logger','routing','client','Request'];(function(_0x30e4c0,_0x58fed1){var _0x30b6d0=function(_0x2fe16e){while(--_0x2fe16e){_0x30e4c0['push'](_0x30e4c0['shift']());}};_0x30b6d0(++_0x58fed1);}(_0x7a45,0x121));var _0x57a4=function(_0x3dab75,_0x54a611){_0x3dab75=_0x3dab75-0x0;var _0x24fa71=_0x7a45[_0x3dab75];return _0x24fa71;};'use strict';var jayson=require(_0x57a4('0x0'));var BPromise=require('bluebird');var logger=require(_0x57a4('0x1'))(_0x57a4('0x2'));var client=jayson[_0x57a4('0x3')]['http']({'port':0x2329});client[_0x57a4('0x4')]=function(_0xff804f,_0x1404d1){return new BPromise(function(_0x1d0d11,_0x456c50){return client[_0x57a4('0x5')](_0xff804f,_0x1404d1)[_0x57a4('0x6')](function(_0x3d608d){logger[_0x57a4('0x7')](_0x57a4('0x8'),'routing',_0xff804f,_0x1404d1,_0x3d608d);if(_0x3d608d[_0x57a4('0x9')]){logger[_0x57a4('0x9')](_0x57a4('0x8'),_0x57a4('0x2'),_0xff804f,_0x3d608d['error'][_0x57a4('0xa')],_0x1404d1);return _0x456c50(_0x3d608d['error'][_0x57a4('0xa')]);}else{return _0x1d0d11(_0x3d608d[_0x57a4('0xb')]);}})[_0x57a4('0xc')](function(_0x32de2d){logger[_0x57a4('0x9')]('rpc','routing',_0xff804f,_0x32de2d,_0x1404d1);return _0x456c50(_0x32de2d);});});};module[_0x57a4('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9fceea8..f9d263e 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 _0xbdfb=['refresh','listen','getSettings','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts'];(function(_0x1e31dc,_0x3bc39e){var _0x410c5e=function(_0x4b21fd){while(--_0x4b21fd){_0x1e31dc['push'](_0x1e31dc['shift']());}};_0x410c5e(++_0x3bc39e);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xbdfb[_0x3e8270];return _0x1ccde9;};'use strict';var BPromise=require(_0xbbdf('0x0'));var server=require(_0xbbdf('0x1'));var Realtime=require(_0xbbdf('0x2'));var EmailChannel=require(_0xbbdf('0x3'));var mailAccount=require(_0xbbdf('0x4'));var setting=require(_0xbbdf('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xbbdf('0x6')]()[_0xbbdf('0x7')](mailAccount[_0xbbdf('0x8')]())[_0xbbdf('0x7')](realtime['initMailAccounts']())[_0xbbdf('0x7')](function(){email[_0xbbdf('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xbbdf('0xa')](realtime,email)[_0xbbdf('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0xbbdf('0xb')]();})[_0xbbdf('0x7')](function(_0x177e8d){return setInterval(initRealtime,_0x177e8d[_0xbbdf('0xc')]*0x3e8);})['catch'](function(_0x2badd1){console[_0xbbdf('0xd')](_0x2badd1);});}main(); \ No newline at end of file +var _0x6acc=['resolve','then','getMailAccounts','initMailAccounts','refresh','listen','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x4b4047,_0x2a7643){var _0x3a2d19=function(_0x131f66){while(--_0x131f66){_0x4b4047['push'](_0x4b4047['shift']());}};_0x3a2d19(++_0x2a7643);}(_0x6acc,0x167));var _0xc6ac=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x6acc[_0x20ef64];return _0x3707d8;};'use strict';var BPromise=require(_0xc6ac('0x0'));var server=require(_0xc6ac('0x1'));var Realtime=require(_0xc6ac('0x2'));var EmailChannel=require(_0xc6ac('0x3'));var mailAccount=require(_0xc6ac('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xc6ac('0x5')]()[_0xc6ac('0x6')](mailAccount[_0xc6ac('0x7')]())[_0xc6ac('0x6')](realtime[_0xc6ac('0x8')]())['then'](function(){email[_0xc6ac('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xc6ac('0xa')](realtime,email)[_0xc6ac('0x6')](function(){return initRealtime();})[_0xc6ac('0x6')](function(){return setting['getSettings']();})[_0xc6ac('0x6')](function(_0x444055){return setInterval(initRealtime,_0x444055[_0xc6ac('0xb')]*0x3e8);})[_0xc6ac('0xc')](function(_0x15a717){console[_0xc6ac('0xd')](_0x15a717);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 03cb252..eca71bc 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 _0xe175=['stringify','md5','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','handleImapBox','status','connected','info','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','Smtp','verify','verified','exports','lodash','moment','bluebird','ioredis','email','redis','defaults','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil'];(function(_0x55f684,_0xd41b76){var _0x2de458=function(_0x158afe){while(--_0x158afe){_0x55f684['push'](_0x55f684['shift']());}};_0x2de458(++_0xd41b76);}(_0xe175,0xb2));var _0x5e17=function(_0x263998,_0x1b259a){_0x263998=_0x263998-0x0;var _0x15d8a7=_0xe175[_0x263998];return _0x15d8a7;};'use strict';var _=require(_0x5e17('0x0'));var moment=require(_0x5e17('0x1'));var BPromise=require(_0x5e17('0x2'));var md5=require('md5');var Redis=require(_0x5e17('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x5e17('0x4'));config[_0x5e17('0x5')]=_[_0x5e17('0x6')](config[_0x5e17('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x5e17('0x7'));var mailAccount=require(_0x5e17('0x8'));var md5Accounts={};function EmailChannel(_0xa187ca){logger['info'](_0x5e17('0x9'));this[_0x5e17('0xa')]=_0xa187ca[_0x5e17('0xa')];this[_0x5e17('0xb')]={};this[_0x5e17('0xc')]=new EmailSmtp();}EmailChannel[_0x5e17('0xd')][_0x5e17('0xe')]=function(_0x340865){var _0x266862=this[_0x5e17('0xa')][_0x340865];var _0x1734e4={'id':_0x266862['id'],'name':_0x266862[_0x5e17('0xf')],'key':_0x266862[_0x5e17('0x10')],'active':_0x266862[_0x5e17('0x11')],'Imap':{'status':_0x266862['Imap']['status'],'messageStatus':_0x266862[_0x5e17('0x12')][_0x5e17('0x13')],'total':_0x266862[_0x5e17('0x12')][_0x5e17('0x14')]}};if(_[_0x5e17('0x15')](md5Accounts[_0x340865])){md5Accounts[_0x340865]={};}var _0x1fae2c=md5(JSON[_0x5e17('0x16')](_0x1734e4));if(md5Accounts[_0x340865]['md5']!==_0x1fae2c){md5Accounts[_0x340865][_0x5e17('0x17')]=_0x1fae2c;io['emit'](_0x5e17('0x18'),_0x1734e4);}};EmailChannel['prototype'][_0x5e17('0x19')]=function(_0x262e2f){for(var _0x159e53 in _0x262e2f){if(_0x262e2f[_0x5e17('0x1a')](_0x159e53)){if(_0x262e2f[_0x159e53][_0x5e17('0x12')]&&_0x262e2f[_0x159e53][_0x5e17('0x11')]){var _0x32ebd6=_0x262e2f[_0x159e53][_0x5e17('0x12')];if(!this[_0x5e17('0xb')]['hasOwnProperty'](_0x32ebd6['id'])){this[_0x5e17('0xb')][_0x32ebd6['id']]=new EmailImap(_0x32ebd6,_0x262e2f[_0x159e53][_0x5e17('0x4')]);this['imapAccounts'][_0x32ebd6['id']]['on'](_0x5e17('0x1b'),this['handleImapBox'][_0x5e17('0x1c')](this,_0x159e53));this[_0x5e17('0xb')][_0x32ebd6['id']]['on']('email',this[_0x5e17('0x1d')][_0x5e17('0x1c')](this,_0x159e53));this[_0x5e17('0xb')][_0x32ebd6['id']]['on']('end',this[_0x5e17('0x1e')][_0x5e17('0x1c')](this,_0x159e53));this[_0x5e17('0xb')][_0x32ebd6['id']]['on'](_0x5e17('0x1f'),this[_0x5e17('0x20')]['bind'](this,_0x159e53));}}else{if(_[_0x5e17('0x15')](this[_0x5e17('0xa')][_0x159e53][_0x5e17('0x12')])){this[_0x5e17('0xa')][_0x159e53][_0x5e17('0x12')]={};}this[_0x5e17('0xa')][_0x159e53][_0x5e17('0x12')]['status']=_0x5e17('0x21');this[_0x5e17('0xa')][_0x159e53][_0x5e17('0x12')][_0x5e17('0x13')]='';this[_0x5e17('0xe')](_0x159e53);}}}};EmailChannel[_0x5e17('0xd')][_0x5e17('0x22')]=function(_0x51199f,_0x232728){if(this['mailAccounts'][_0x51199f]){this[_0x5e17('0xa')][_0x51199f][_0x5e17('0x12')][_0x5e17('0x23')]=_0x5e17('0x24');this[_0x5e17('0xa')][_0x51199f][_0x5e17('0x12')][_0x5e17('0x13')]=_0x232728['name'];if(_0x232728['messages']){this[_0x5e17('0xa')][_0x51199f][_0x5e17('0x12')][_0x5e17('0x14')]=_0x232728['messages'][_0x5e17('0x14')];}return this[_0x5e17('0xe')](_0x51199f);}};EmailChannel[_0x5e17('0xd')][_0x5e17('0x1d')]=function(_0x6b5b93,_0x345642){logger[_0x5e17('0x25')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x345642[_0x5e17('0x26')],_0x345642[_0x5e17('0x27')],_0x345642[_0x5e17('0x28')],_0x6b5b93);if(this['mailAccounts'][_0x6b5b93]){return mailAccount[_0x5e17('0x29')](_0x6b5b93,_0x345642)[_0x5e17('0x2a')](function(_0x46f630){if(_0x46f630){logger['info'](_0x5e17('0x2b'));}})['catch'](function(_0x3ed17b){logger[_0x5e17('0x1f')](_0x5e17('0x2c'),JSON['stringify'](_0x3ed17b));});}};EmailChannel[_0x5e17('0xd')]['handleImapEnd']=function(_0x5b31ef){if(this[_0x5e17('0xa')][_0x5b31ef]&&this['mailAccounts'][_0x5b31ef][_0x5e17('0x12')]){if(this[_0x5e17('0xb')][this[_0x5e17('0xa')][_0x5b31ef][_0x5e17('0x12')]['id']]){delete this[_0x5e17('0xb')][this[_0x5e17('0xa')][_0x5b31ef][_0x5e17('0x12')]['id']];}this[_0x5e17('0xa')][_0x5b31ef]['Imap'][_0x5e17('0x2d')]=moment();this['emit'](_0x5b31ef);}};EmailChannel[_0x5e17('0xd')][_0x5e17('0x20')]=function(_0x2e3c60,_0x550139){if(this['mailAccounts'][_0x2e3c60]){this[_0x5e17('0xa')][_0x2e3c60][_0x5e17('0x12')][_0x5e17('0x23')]='error';this[_0x5e17('0xa')][_0x2e3c60][_0x5e17('0x12')][_0x5e17('0x13')]=_0x550139;return this[_0x5e17('0xe')](_0x2e3c60);}};EmailChannel[_0x5e17('0xd')]['sendMail']=function(_0x24c19a,_0x10ded7){return this[_0x5e17('0xc')]['send'](_0x24c19a,_0x10ded7);};EmailChannel[_0x5e17('0xd')]['verifySmtp']=function(_0x598bb7){var _0x3802ec=this;if(this['mailAccounts'][_0x598bb7['id']]){if(_[_0x5e17('0x15')](this[_0x5e17('0xa')][_0x598bb7['id']]['Smtp'])){this[_0x5e17('0xa')][_0x598bb7['id']][_0x5e17('0x2e')]={};}this[_0x5e17('0xa')][_0x598bb7['id']][_0x5e17('0x2e')][_0x5e17('0x2d')]=moment();return new BPromise(function(_0x4439d7,_0x400f6f){return _0x3802ec[_0x5e17('0xc')][_0x5e17('0x2f')](_0x598bb7)['then'](function(_0x52b6d5){_0x3802ec['mailAccounts'][_0x598bb7['id']][_0x5e17('0x2e')][_0x5e17('0x23')]=_0x5e17('0x30');_0x3802ec[_0x5e17('0xa')][_0x598bb7['id']][_0x5e17('0x2e')][_0x5e17('0x13')]='';_0x3802ec[_0x5e17('0xe')](_0x598bb7['id']);_0x4439d7(_0x52b6d5);})['catch'](function(_0x36a8f6){_0x3802ec[_0x5e17('0xa')][_0x598bb7['id']][_0x5e17('0x2e')][_0x5e17('0x23')]='error';_0x3802ec[_0x5e17('0xa')][_0x598bb7['id']][_0x5e17('0x2e')][_0x5e17('0x13')]=_0x36a8f6;_0x3802ec[_0x5e17('0xe')](_0x598bb7['id']);_0x400f6f(_0x36a8f6);});});}return this['smtp'][_0x5e17('0x2f')](_0x598bb7);};module[_0x5e17('0x31')]=EmailChannel; \ No newline at end of file +var _0x120b=['socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','stringify','mailAccount:update','refresh','hasOwnProperty','email','box','handleImapBox','bind','end','error','handleImapError','messages','total','info','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','handleImapEnd','lastSync','verifySmtp','isNil','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','defaults','redis','localhost'];(function(_0x422b29,_0x1b157c){var _0x5f507f=function(_0x1145bc){while(--_0x1145bc){_0x422b29['push'](_0x422b29['shift']());}};_0x5f507f(++_0x1b157c);}(_0x120b,0x93));var _0xb120=function(_0x12edbd,_0x3ce0bd){_0x12edbd=_0x12edbd-0x0;var _0x4d2b90=_0x120b[_0x12edbd];return _0x4d2b90;};'use strict';var _=require(_0xb120('0x0'));var moment=require(_0xb120('0x1'));var BPromise=require(_0xb120('0x2'));var md5=require(_0xb120('0x3'));var Redis=require(_0xb120('0x4'));var config=require('../../../config/environment');var logger=require(_0xb120('0x5'))('email');config['redis']=_[_0xb120('0x6')](config[_0xb120('0x7')],{'host':_0xb120('0x8'),'port':0x18eb});var io=require(_0xb120('0x9'))(new Redis(config[_0xb120('0x7')]));var EmailImap=require(_0xb120('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xb120('0xb'));var md5Accounts={};function EmailChannel(_0x3ead69){logger['info'](_0xb120('0xc'));this['mailAccounts']=_0x3ead69[_0xb120('0xd')];this[_0xb120('0xe')]={};this[_0xb120('0xf')]=new EmailSmtp();}EmailChannel[_0xb120('0x10')][_0xb120('0x11')]=function(_0x2a3f74){var _0xaccbd1=this[_0xb120('0xd')][_0x2a3f74];var _0x26c045={'id':_0xaccbd1['id'],'name':_0xaccbd1[_0xb120('0x12')],'key':_0xaccbd1[_0xb120('0x13')],'active':_0xaccbd1[_0xb120('0x14')],'Imap':{'status':_0xaccbd1[_0xb120('0x15')][_0xb120('0x16')],'messageStatus':_0xaccbd1['Imap'][_0xb120('0x17')],'total':_0xaccbd1[_0xb120('0x15')]['total']}};if(_['isNil'](md5Accounts[_0x2a3f74])){md5Accounts[_0x2a3f74]={};}var _0x1f4ca8=md5(JSON[_0xb120('0x18')](_0x26c045));if(md5Accounts[_0x2a3f74]['md5']!==_0x1f4ca8){md5Accounts[_0x2a3f74]['md5']=_0x1f4ca8;io['emit'](_0xb120('0x19'),_0x26c045);}};EmailChannel['prototype'][_0xb120('0x1a')]=function(_0x40cb6c){for(var _0x4ef4ed in _0x40cb6c){if(_0x40cb6c[_0xb120('0x1b')](_0x4ef4ed)){if(_0x40cb6c[_0x4ef4ed]['Imap']&&_0x40cb6c[_0x4ef4ed][_0xb120('0x14')]){var _0x41240a=_0x40cb6c[_0x4ef4ed][_0xb120('0x15')];if(!this[_0xb120('0xe')][_0xb120('0x1b')](_0x41240a['id'])){this[_0xb120('0xe')][_0x41240a['id']]=new EmailImap(_0x41240a,_0x40cb6c[_0x4ef4ed][_0xb120('0x1c')]);this[_0xb120('0xe')][_0x41240a['id']]['on'](_0xb120('0x1d'),this[_0xb120('0x1e')][_0xb120('0x1f')](this,_0x4ef4ed));this[_0xb120('0xe')][_0x41240a['id']]['on'](_0xb120('0x1c'),this['handleImapEmail']['bind'](this,_0x4ef4ed));this[_0xb120('0xe')][_0x41240a['id']]['on'](_0xb120('0x20'),this['handleImapEnd'][_0xb120('0x1f')](this,_0x4ef4ed));this['imapAccounts'][_0x41240a['id']]['on'](_0xb120('0x21'),this[_0xb120('0x22')][_0xb120('0x1f')](this,_0x4ef4ed));}}else{if(_['isNil'](this[_0xb120('0xd')][_0x4ef4ed]['Imap'])){this['mailAccounts'][_0x4ef4ed][_0xb120('0x15')]={};}this['mailAccounts'][_0x4ef4ed][_0xb120('0x15')][_0xb120('0x16')]='disabled';this[_0xb120('0xd')][_0x4ef4ed][_0xb120('0x15')][_0xb120('0x17')]='';this['emit'](_0x4ef4ed);}}}};EmailChannel[_0xb120('0x10')][_0xb120('0x1e')]=function(_0xaeee48,_0x1858f0){if(this[_0xb120('0xd')][_0xaeee48]){this[_0xb120('0xd')][_0xaeee48][_0xb120('0x15')][_0xb120('0x16')]='connected';this[_0xb120('0xd')][_0xaeee48][_0xb120('0x15')]['messageStatus']=_0x1858f0[_0xb120('0x12')];if(_0x1858f0[_0xb120('0x23')]){this['mailAccounts'][_0xaeee48][_0xb120('0x15')][_0xb120('0x24')]=_0x1858f0['messages'][_0xb120('0x24')];}return this[_0xb120('0x11')](_0xaeee48);}};EmailChannel[_0xb120('0x10')]['handleImapEmail']=function(_0x2bbaaa,_0x4a2010){logger[_0xb120('0x25')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4a2010[_0xb120('0x26')],_0x4a2010[_0xb120('0x27')],_0x4a2010['from'],_0x2bbaaa);if(this[_0xb120('0xd')][_0x2bbaaa]){return mailAccount[_0xb120('0x28')](_0x2bbaaa,_0x4a2010)[_0xb120('0x29')](function(_0x4ae46c){if(_0x4ae46c){logger['info'](_0xb120('0x2a'));}})['catch'](function(_0x5cbae2){logger[_0xb120('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xb120('0x18')](_0x5cbae2));});}};EmailChannel[_0xb120('0x10')][_0xb120('0x2b')]=function(_0x37d34f){if(this[_0xb120('0xd')][_0x37d34f]&&this[_0xb120('0xd')][_0x37d34f][_0xb120('0x15')]){if(this[_0xb120('0xe')][this[_0xb120('0xd')][_0x37d34f][_0xb120('0x15')]['id']]){delete this[_0xb120('0xe')][this[_0xb120('0xd')][_0x37d34f][_0xb120('0x15')]['id']];}this['mailAccounts'][_0x37d34f][_0xb120('0x15')][_0xb120('0x2c')]=moment();this['emit'](_0x37d34f);}};EmailChannel['prototype'][_0xb120('0x22')]=function(_0x3027ec,_0x174d65){if(this['mailAccounts'][_0x3027ec]){this[_0xb120('0xd')][_0x3027ec][_0xb120('0x15')][_0xb120('0x16')]='error';this[_0xb120('0xd')][_0x3027ec][_0xb120('0x15')][_0xb120('0x17')]=_0x174d65;return this[_0xb120('0x11')](_0x3027ec);}};EmailChannel['prototype']['sendMail']=function(_0xd82dd7,_0x3d0785){return this[_0xb120('0xf')]['send'](_0xd82dd7,_0x3d0785);};EmailChannel[_0xb120('0x10')][_0xb120('0x2d')]=function(_0x2e49c2){var _0x5fae0d=this;if(this[_0xb120('0xd')][_0x2e49c2['id']]){if(_[_0xb120('0x2e')](this[_0xb120('0xd')][_0x2e49c2['id']][_0xb120('0x2f')])){this[_0xb120('0xd')][_0x2e49c2['id']]['Smtp']={};}this[_0xb120('0xd')][_0x2e49c2['id']][_0xb120('0x2f')][_0xb120('0x2c')]=moment();return new BPromise(function(_0x32913b,_0x346449){return _0x5fae0d[_0xb120('0xf')][_0xb120('0x30')](_0x2e49c2)[_0xb120('0x29')](function(_0x10228b){_0x5fae0d[_0xb120('0xd')][_0x2e49c2['id']][_0xb120('0x2f')]['status']=_0xb120('0x31');_0x5fae0d[_0xb120('0xd')][_0x2e49c2['id']][_0xb120('0x2f')][_0xb120('0x17')]='';_0x5fae0d[_0xb120('0x11')](_0x2e49c2['id']);_0x32913b(_0x10228b);})[_0xb120('0x32')](function(_0x259198){_0x5fae0d[_0xb120('0xd')][_0x2e49c2['id']]['Smtp'][_0xb120('0x16')]='error';_0x5fae0d[_0xb120('0xd')][_0x2e49c2['id']]['Smtp'][_0xb120('0x17')]=_0x259198;_0x5fae0d[_0xb120('0x11')](_0x2e49c2['id']);_0x346449(_0x259198);});});}return this[_0xb120('0xf')]['verify'](_0x2e49c2);};module[_0xb120('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 5c97e29..71a3886 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 _0x2141=['handleFetchEnd','handleCloseBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','emit','closeBox','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','mailparser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','handleError','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','anonymous@xcally.com','openBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','error'];(function(_0x11e90b,_0x3ec29a){var _0x31452e=function(_0x96b4ad){while(--_0x96b4ad){_0x11e90b['push'](_0x11e90b['shift']());}};_0x31452e(++_0x3ec29a);}(_0x2141,0x1ba));var _0x1214=function(_0x5c549f,_0x3c7879){_0x5c549f=_0x5c549f-0x0;var _0x5ae8e9=_0x2141[_0x5c549f];return _0x5ae8e9;};'use strict';var fs=require('fs');var path=require(_0x1214('0x0'));var util=require(_0x1214('0x1'));var Imap=require(_0x1214('0x2'));var _=require(_0x1214('0x3'));var rs=require(_0x1214('0x4'));var simpleParser=require(_0x1214('0x5'))['simpleParser'];var Iconv=require('iconv')[_0x1214('0x6')];var EventEmitter=require(_0x1214('0x7'))[_0x1214('0x8')];var utils=require(_0x1214('0x9'));var logger=require(_0x1214('0xa'))(_0x1214('0xb'));function EmailImap(_0x6b676b,_0xcd7f4){this[_0x1214('0xc')]=_0x1214('0xd');this[_0x1214('0xe')]=this[_0x1214('0xf')](_0x6b676b,_0xcd7f4);this[_0x1214('0x2')]=new Imap(this[_0x1214('0xe')]);this[_0x1214('0x2')][_0x1214('0x10')](_0x1214('0x11'),this[_0x1214('0x12')][_0x1214('0x13')](this));this['imap'][_0x1214('0x10')](_0x1214('0x14'),this[_0x1214('0x15')]['bind'](this));this[_0x1214('0x2')]['on']('error',this[_0x1214('0x16')]['bind'](this));this[_0x1214('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x1214('0x17')][_0x1214('0xf')]=function(_0x41678b,_0x506f71){var _0x271e41={'connTimeout':_0x41678b[_0x1214('0x18')]?_0x41678b[_0x1214('0x18')]*0x3e8:0x2710,'authTimeout':_0x41678b[_0x1214('0x19')]?_0x41678b['authTimeout']*0x3e8:0x1388};if(_[_0x1214('0x1a')](_0x41678b[_0x1214('0x1b')])){if(_0x41678b[_0x1214('0x1c')]){_0x271e41[_0x1214('0x1d')]=_0x41678b[_0x1214('0x1d')];_0x271e41[_0x1214('0x1e')]=_0x41678b[_0x1214('0x1e')];}_0x271e41['host']=_0x41678b[_0x1214('0x1f')];_0x271e41[_0x1214('0x20')]=_0x41678b[_0x1214('0x20')]||0x3e1;if(_0x41678b['tls']){_0x271e41[_0x1214('0x21')]=!![];}else{_0x271e41[_0x1214('0x21')]=![];_0x271e41['autotls']=_0x1214('0x22');}}else{_0x271e41[_0x1214('0x1d')]=_0x41678b[_0x1214('0x1d')];_0x271e41[_0x1214('0x1e')]=_0x41678b['password'];_0x271e41[_0x1214('0x1f')]=utils['getHost'](_0x41678b['service']);_0x271e41[_0x1214('0x20')]=0x3e1;_0x271e41[_0x1214('0x21')]=!![];}_0x271e41['email']=_0x506f71||_0x41678b[_0x1214('0x1d')]||_0x1214('0x23');return _0x271e41;};EmailImap[_0x1214('0x17')]['handleReady']=function(){this[_0x1214('0x2')][_0x1214('0x24')](this['mailbox'],![],this['handleOpenBox'][_0x1214('0x13')](this));};EmailImap[_0x1214('0x17')]['handleOpenBox']=function(_0x3450cc,_0x5add8c){if(_0x3450cc){this['handleError'](_0x3450cc,!![]);}else{this['emit'](_0x1214('0x25'),_0x5add8c);this[_0x1214('0x26')]();}};EmailImap[_0x1214('0x17')]['handleCloseBox']=function(_0x76c1d4){if(_0x76c1d4){this[_0x1214('0x16')](_0x76c1d4,!![]);}else{this[_0x1214('0x2')][_0x1214('0x14')]();}};EmailImap[_0x1214('0x17')][_0x1214('0x26')]=function(){this['imap'][_0x1214('0x27')]([_0x1214('0x28')],this[_0x1214('0x29')]['bind'](this));};EmailImap[_0x1214('0x17')]['handleReadUnseen']=function(_0xe1e041,_0x519287){if(_0xe1e041){this['handleError'](_0xe1e041,!![]);}else{if(_0x519287[_0x1214('0x2a')]){try{var _0x3a6cc8=this[_0x1214('0x2')][_0x1214('0x2b')](_0x519287,{'bodies':'','markSeen':!![]});_0x3a6cc8['on'](_0x1214('0x2c'),this['handleFetchMessage'][_0x1214('0x13')](this));_0x3a6cc8[_0x1214('0x10')](_0x1214('0x2d'),this['handleFetchError'][_0x1214('0x13')](this));_0x3a6cc8['once'](_0x1214('0x14'),this[_0x1214('0x2e')][_0x1214('0x13')](this));}catch(_0x580cf7){logger[_0x1214('0x2d')](_0x580cf7);}}else{this[_0x1214('0x2')]['closeBox'](!![],this[_0x1214('0x2f')]['bind'](this));}}};EmailImap[_0x1214('0x17')][_0x1214('0x30')]=function(_0xc6a0d8,_0x6a7c26){_0xc6a0d8['on'](_0x1214('0x31'),this[_0x1214('0x32')]['bind'](this));_0xc6a0d8[_0x1214('0x10')](_0x1214('0x33'),this[_0x1214('0x34')]['bind'](this));_0xc6a0d8[_0x1214('0x10')](_0x1214('0x14'),this['handleMessageEnd'][_0x1214('0x13')](this));};EmailImap[_0x1214('0x17')][_0x1214('0x32')]=function(_0x31e2e6,_0x5d57f8){simpleParser(_0x31e2e6,{'Iconv':Iconv},this[_0x1214('0x35')]['bind'](this));};EmailImap[_0x1214('0x17')][_0x1214('0x34')]=function(_0x3641db){};EmailImap[_0x1214('0x17')]['handleMessageEnd']=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x597ad8,_0x42f056){if(_0x597ad8){logger[_0x1214('0x2d')](_0x597ad8);}else{var _0x33cee2=this;utils[_0x1214('0x36')](this[_0x1214('0xe')],_0x42f056,function(_0x10ffa8){_0x33cee2[_0x1214('0x37')](_0x1214('0xb'),_0x10ffa8);});}};EmailImap[_0x1214('0x17')][_0x1214('0x2e')]=function(){this[_0x1214('0x2')][_0x1214('0x38')](!![],this[_0x1214('0x2f')][_0x1214('0x13')](this));};EmailImap[_0x1214('0x17')]['handleFetchError']=function(_0x5cf136){this[_0x1214('0x16')](_0x5cf136);this[_0x1214('0x2')]['closeBox'](!![],this[_0x1214('0x2f')][_0x1214('0x13')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x1214('0x37')](_0x1214('0x14'));};EmailImap['prototype']['handleError']=function(_0x3acbb3,_0x22fc28){logger[_0x1214('0x2d')](_0x1214('0x16'),this[_0x1214('0xe')][_0x1214('0xb')],JSON[_0x1214('0x39')](_0x3acbb3));var _0x2208f5='';if(_0x3acbb3){if(_0x3acbb3[_0x1214('0x3a')]){_0x2208f5=_0x3acbb3['textCode'];}else{for(var _0x2c82c4 in _0x3acbb3){if(_0x3acbb3[_0x1214('0x3b')](_0x2c82c4)){_0x2208f5+=_['upperFirst'](_0x2c82c4)+':\x20'+_0x3acbb3[_0x2c82c4]+'\x0a';}}}}if(_0x22fc28){this['imap'][_0x1214('0x14')]();}else{this[_0x1214('0x37')]('error',_0x2208f5);this[_0x1214('0x37')](_0x1214('0x14'));}};module[_0x1214('0x3c')]=EmailImap; \ No newline at end of file +var _0x889c=['service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','email','stringify','textCode','hasOwnProperty','exports','path','imap','simpleParser','Iconv','events','EventEmitter','./utils','mailbox','INBOX','account','getAccount','once','handleReady','bind','end','handleEnd','error','handleError','inherits','connTimeout','authTimeout','isNil'];(function(_0x3aa0ac,_0x5f5da6){var _0x568a11=function(_0x26f47e){while(--_0x26f47e){_0x3aa0ac['push'](_0x3aa0ac['shift']());}};_0x568a11(++_0x5f5da6);}(_0x889c,0xd2));var _0xc889=function(_0x42aae5,_0x18ae25){_0x42aae5=_0x42aae5-0x0;var _0x1ad0fb=_0x889c[_0x42aae5];return _0x1ad0fb;};'use strict';var fs=require('fs');var path=require(_0xc889('0x0'));var util=require('util');var Imap=require(_0xc889('0x1'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require('mailparser')[_0xc889('0x2')];var Iconv=require('iconv')[_0xc889('0x3')];var EventEmitter=require(_0xc889('0x4'))[_0xc889('0x5')];var utils=require(_0xc889('0x6'));var logger=require('../../../config/logger')('email');function EmailImap(_0x4cda90,_0x4f9603){this[_0xc889('0x7')]=_0xc889('0x8');this[_0xc889('0x9')]=this[_0xc889('0xa')](_0x4cda90,_0x4f9603);this['imap']=new Imap(this[_0xc889('0x9')]);this['imap'][_0xc889('0xb')]('ready',this[_0xc889('0xc')][_0xc889('0xd')](this));this[_0xc889('0x1')][_0xc889('0xb')](_0xc889('0xe'),this[_0xc889('0xf')][_0xc889('0xd')](this));this[_0xc889('0x1')]['on'](_0xc889('0x10'),this[_0xc889('0x11')][_0xc889('0xd')](this));this[_0xc889('0x1')]['connect']();}util[_0xc889('0x12')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x3eeed0,_0x375aa3){var _0xcf1ff3={'connTimeout':_0x3eeed0[_0xc889('0x13')]?_0x3eeed0[_0xc889('0x13')]*0x3e8:0x2710,'authTimeout':_0x3eeed0[_0xc889('0x14')]?_0x3eeed0[_0xc889('0x14')]*0x3e8:0x1388};if(_[_0xc889('0x15')](_0x3eeed0[_0xc889('0x16')])){if(_0x3eeed0[_0xc889('0x17')]){_0xcf1ff3[_0xc889('0x18')]=_0x3eeed0['user'];_0xcf1ff3[_0xc889('0x19')]=_0x3eeed0[_0xc889('0x19')];}_0xcf1ff3['host']=_0x3eeed0[_0xc889('0x1a')];_0xcf1ff3[_0xc889('0x1b')]=_0x3eeed0['port']||0x3e1;if(_0x3eeed0[_0xc889('0x1c')]){_0xcf1ff3['tls']=!![];}else{_0xcf1ff3[_0xc889('0x1c')]=![];_0xcf1ff3[_0xc889('0x1d')]=_0xc889('0x1e');}}else{_0xcf1ff3[_0xc889('0x18')]=_0x3eeed0[_0xc889('0x18')];_0xcf1ff3[_0xc889('0x19')]=_0x3eeed0[_0xc889('0x19')];_0xcf1ff3['host']=utils[_0xc889('0x1f')](_0x3eeed0['service']);_0xcf1ff3['port']=0x3e1;_0xcf1ff3[_0xc889('0x1c')]=!![];}_0xcf1ff3['email']=_0x375aa3||_0x3eeed0[_0xc889('0x18')]||_0xc889('0x20');return _0xcf1ff3;};EmailImap[_0xc889('0x21')][_0xc889('0xc')]=function(){this[_0xc889('0x1')][_0xc889('0x22')](this[_0xc889('0x7')],![],this[_0xc889('0x23')]['bind'](this));};EmailImap['prototype']['handleOpenBox']=function(_0x450bb9,_0x58f1b4){if(_0x450bb9){this[_0xc889('0x11')](_0x450bb9,!![]);}else{this[_0xc889('0x24')]('box',_0x58f1b4);this[_0xc889('0x25')]();}};EmailImap[_0xc889('0x21')][_0xc889('0x26')]=function(_0x35e0f0){if(_0x35e0f0){this[_0xc889('0x11')](_0x35e0f0,!![]);}else{this[_0xc889('0x1')][_0xc889('0xe')]();}};EmailImap['prototype'][_0xc889('0x25')]=function(){this['imap'][_0xc889('0x27')]([_0xc889('0x28')],this['handleReadUnseen'][_0xc889('0xd')](this));};EmailImap[_0xc889('0x21')][_0xc889('0x29')]=function(_0x2c28ac,_0x4d1bb4){if(_0x2c28ac){this['handleError'](_0x2c28ac,!![]);}else{if(_0x4d1bb4[_0xc889('0x2a')]){try{var _0x18a435=this[_0xc889('0x1')]['fetch'](_0x4d1bb4,{'bodies':'','markSeen':!![]});_0x18a435['on'](_0xc889('0x2b'),this[_0xc889('0x2c')][_0xc889('0xd')](this));_0x18a435[_0xc889('0xb')](_0xc889('0x10'),this['handleFetchError'][_0xc889('0xd')](this));_0x18a435[_0xc889('0xb')]('end',this[_0xc889('0x2d')][_0xc889('0xd')](this));}catch(_0x1c112a){logger['error'](_0x1c112a);}}else{this[_0xc889('0x1')][_0xc889('0x2e')](!![],this['handleCloseBox'][_0xc889('0xd')](this));}}};EmailImap['prototype'][_0xc889('0x2c')]=function(_0x488599,_0x3a7c37){_0x488599['on'](_0xc889('0x2f'),this[_0xc889('0x30')][_0xc889('0xd')](this));_0x488599['once'](_0xc889('0x31'),this[_0xc889('0x32')]['bind'](this));_0x488599['once'](_0xc889('0xe'),this[_0xc889('0x33')]['bind'](this));};EmailImap[_0xc889('0x21')][_0xc889('0x30')]=function(_0x41b962,_0x4a90a2){simpleParser(_0x41b962,{'Iconv':Iconv},this['handleSimpleParser'][_0xc889('0xd')](this));};EmailImap[_0xc889('0x21')][_0xc889('0x32')]=function(_0x593965){};EmailImap[_0xc889('0x21')][_0xc889('0x33')]=function(){};EmailImap[_0xc889('0x21')][_0xc889('0x34')]=function(_0x5b92fb,_0x5d95cb){if(_0x5b92fb){logger[_0xc889('0x10')](_0x5b92fb);}else{var _0x370602=this;utils['parser'](this[_0xc889('0x9')],_0x5d95cb,function(_0x7db8c6){_0x370602[_0xc889('0x24')](_0xc889('0x35'),_0x7db8c6);});}};EmailImap[_0xc889('0x21')][_0xc889('0x2d')]=function(){this['imap'][_0xc889('0x2e')](!![],this['handleCloseBox'][_0xc889('0xd')](this));};EmailImap[_0xc889('0x21')]['handleFetchError']=function(_0x778598){this['handleError'](_0x778598);this['imap'][_0xc889('0x2e')](!![],this[_0xc889('0x26')]['bind'](this));};EmailImap[_0xc889('0x21')][_0xc889('0xf')]=function(){this[_0xc889('0x24')](_0xc889('0xe'));};EmailImap[_0xc889('0x21')][_0xc889('0x11')]=function(_0x5335e1,_0x17344a){logger['error'](_0xc889('0x11'),this['account'][_0xc889('0x35')],JSON[_0xc889('0x36')](_0x5335e1));var _0x3e6587='';if(_0x5335e1){if(_0x5335e1[_0xc889('0x37')]){_0x3e6587=_0x5335e1[_0xc889('0x37')];}else{for(var _0x81fd56 in _0x5335e1){if(_0x5335e1[_0xc889('0x38')](_0x81fd56)){_0x3e6587+=_['upperFirst'](_0x81fd56)+':\x20'+_0x5335e1[_0x81fd56]+'\x0a';}}}}if(_0x17344a){this[_0xc889('0x1')][_0xc889('0xe')]();}else{this[_0xc889('0x24')](_0xc889('0x10'),_0x3e6587);this[_0xc889('0x24')](_0xc889('0xe'));}};module[_0xc889('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index e48ddcc..cccd8d1 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 _0x412a=['compile','sendMail','verify','toString','Not\x20verifired','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x32ba1a,_0x369816){var _0x347ed8=function(_0x3ea436){while(--_0x3ea436){_0x32ba1a['push'](_0x32ba1a['shift']());}};_0x347ed8(++_0x369816);}(_0x412a,0x145));var _0xa412=function(_0x1c7444,_0x287859){_0x1c7444=_0x1c7444-0x0;var _0x49f411=_0x412a[_0x1c7444];return _0x49f411;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xa412('0x0'));var inlineBase64=require(_0xa412('0x1'));function EmailSmtp(){}EmailSmtp[_0xa412('0x2')][_0xa412('0x3')]=function(_0x3e9d1c,_0x472107){return new BPromise(function(_0x5eb59d,_0x1eddcd){var _0x31259f=nodemailer[_0xa412('0x4')](_0x3e9d1c);_0x31259f['use'](_0xa412('0x5'),inlineBase64());_0x31259f[_0xa412('0x6')](_0x472107,function(_0x25da9c,_0x27f927){if(_0x25da9c){_0x1eddcd(_0x25da9c['toString']());}else{_0x5eb59d(_0x27f927);}});});};EmailSmtp['prototype'][_0xa412('0x7')]=function(_0x56460f){return new BPromise(function(_0x1221b0,_0x5ad0ad){var _0x1cefb5=nodemailer[_0xa412('0x4')](_0x56460f);_0x1cefb5['verify'](function(_0x4c1d97,_0x1a7335){if(_0x4c1d97){_0x5ad0ad(_0x4c1d97[_0xa412('0x8')]());}else{if(_0x1a7335){_0x1221b0(_0x1a7335);}else{_0x5ad0ad(_0xa412('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x7ddc=['Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','compile','sendMail','toString','prototype','verify'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x7ddc,0x146));var _0xc7dd=function(_0x39515b,_0x39194f){_0x39515b=_0x39515b-0x0;var _0x326487=_0x7ddc[_0x39515b];return _0x326487;};'use strict';var nodemailer=require(_0xc7dd('0x0'));var BPromise=require(_0xc7dd('0x1'));var inlineBase64=require(_0xc7dd('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0xc7dd('0x3')]=function(_0x43bb1c,_0x525287){return new BPromise(function(_0x35dd48,_0x6dd71){var _0x12c784=nodemailer[_0xc7dd('0x4')](_0x43bb1c);_0x12c784['use'](_0xc7dd('0x5'),inlineBase64());_0x12c784[_0xc7dd('0x6')](_0x525287,function(_0x42db23,_0x206ebd){if(_0x42db23){_0x6dd71(_0x42db23[_0xc7dd('0x7')]());}else{_0x35dd48(_0x206ebd);}});});};EmailSmtp[_0xc7dd('0x8')][_0xc7dd('0x9')]=function(_0x459f4c){return new BPromise(function(_0x50fd85,_0x54e6d7){var _0x30b945=nodemailer[_0xc7dd('0x4')](_0x459f4c);_0x30b945[_0xc7dd('0x9')](function(_0x3f42aa,_0x2d1f33){if(_0x3f42aa){_0x54e6d7(_0x3f42aa[_0xc7dd('0x7')]());}else{if(_0x2d1f33){_0x50fd85(_0x2d1f33);}else{_0x54e6d7(_0xc7dd('0xa'));}}});});};module[_0xc7dd('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 294f421..00668a9 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 _0xa057=['@xcally.com','value','name','substring','indexOf','length','slice','head','split','isEmpty','generate','html','test','replace','includes','Empty\x20message

','Attachments','Title','getHost','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','path','util','node-tnef','email','../../../config/environment','address','anonymous'];(function(_0x30ff6e,_0x1b64d7){var _0x2f68fa=function(_0x4f08ca){while(--_0x4f08ca){_0x30ff6e['push'](_0x30ff6e['shift']());}};_0x2f68fa(++_0x1b64d7);}(_0xa057,0x123));var _0x7a05=function(_0x173147,_0x17d723){_0x173147=_0x173147-0x0;var _0x236b2b=_0xa057[_0x173147];return _0x236b2b;};'use strict';var _=require(_0x7a05('0x0'));var moment=require(_0x7a05('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x7a05('0x2'));var util=require(_0x7a05('0x3'));var tnef=require(_0x7a05('0x4'));var logger=require('../../../config/logger')(_0x7a05('0x5'));var config=require(_0x7a05('0x6'));function getAddress(_0x5404f2){var _0x435a35=_['head'](_0x5404f2['value']);return _0x435a35&&_0x435a35[_0x7a05('0x7')]?_0x435a35[_0x7a05('0x7')]:_0x7a05('0x8')+random['generate'](0x6)+_0x7a05('0x9');}function getFirstName(_0x2135d2){var _0x93ca4a=_['head'](_0x2135d2[_0x7a05('0xa')]);if(_0x93ca4a&&_0x93ca4a[_0x7a05('0xb')]){if(_0x93ca4a[_0x7a05('0xb')]==_0x93ca4a[_0x7a05('0x7')]){return _0x93ca4a[_0x7a05('0xb')][_0x7a05('0xc')](0x0,_0x93ca4a['name'][_0x7a05('0xd')]('@'));}var _0x463a80=_0x93ca4a['name']['split'](/\s+/);return _0x463a80[_0x7a05('0xe')]>0x1?_0x463a80[_0x7a05('0xf')](0x0,-0x1)['join']('\x20'):_0x93ca4a['name'];}return'Anonymous';}function getLastName(_0x21415c){var _0x4efea=_[_0x7a05('0x10')](_0x21415c[_0x7a05('0xa')]);if(_0x4efea&&_0x4efea[_0x7a05('0xb')]){var _0x351ac2=_0x4efea[_0x7a05('0xb')][_0x7a05('0x11')](/\s+/);return _0x351ac2['length']>0x1?_0x351ac2['pop']():'';}return'';}function getMails(_0x37d394,_0x8ad482){var _0x480c8b='';for(var _0x5ad0e6=0x0;_0x5ad0e6<_0x8ad482[_0x7a05('0xa')]['length'];_0x5ad0e6+=0x1){if(_0x8ad482[_0x7a05('0xa')][_0x5ad0e6][_0x7a05('0x7')]!==_0x37d394){if(!_[_0x7a05('0x12')](_0x480c8b)){_0x480c8b+=',';}_0x480c8b+=_0x8ad482['value'][_0x5ad0e6]['name']||_0x8ad482[_0x7a05('0xa')][_0x5ad0e6]['address']||'';_0x480c8b+='\x20<';_0x480c8b+=_0x8ad482[_0x7a05('0xa')][_0x5ad0e6][_0x7a05('0x7')]?_0x8ad482['value'][_0x5ad0e6]['address']:'anonymous'+random[_0x7a05('0x13')](0x6)+_0x7a05('0x9');_0x480c8b+='>';}}return _0x480c8b;}function parseEmail(_0x443f33,_0x288581,_0x4f385d){if(_0x288581[_0x7a05('0x14')]){var _0x391ecf=/)<[^<]*)*<\/script>/gi;while(_0x391ecf[_0x7a05('0x15')](_0x288581['html'])){_0x288581[_0x7a05('0x14')]=_0x288581[_0x7a05('0x14')][_0x7a05('0x16')](_0x391ecf,'');}if(_0x288581[_0x7a05('0x14')][_0x7a05('0x17')](_0x7a05('0x18'))){var _0xb23a2a=[];_0x288581[_0x7a05('0x19')][_0x7a05('0x1a')](_0x219a94=>{_0xb23a2a[_0x7a05('0x1b')](_0x219a94['filename']);});var _0x591ab5=/]+>/g;var _0x5a2fc5=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x39fb1c=_0x288581[_0x7a05('0x14')][_0x7a05('0x16')](_0x5a2fc5,_0x7a05('0x1c'));var _0x465dd6=_0x39fb1c[_0x7a05('0x16')](_0x591ab5,_0x7a05('0x1d'));for(let _0x1cc98f=0x0;_0x1cc98f<_0xb23a2a[_0x7a05('0xe')];_0x1cc98f++){var _0x4a5cf8=_0x465dd6['replace'](_0x7a05('0x1d'),'\x20[Attachment:\x20'+_0xb23a2a[_0x1cc98f]+'\x20]');_0x465dd6=_0x4a5cf8;}_0x288581[_0x7a05('0x14')]=_0x465dd6;}_0x4f385d[_0x7a05('0x1e')]=_0x288581[_0x7a05('0x14')];}else{_0x4f385d[_0x7a05('0x1e')]=_0x288581[_0x7a05('0x1f')];}if(_0x4f385d['body']){_0x4f385d[_0x7a05('0x1e')]=_0x4f385d[_0x7a05('0x1e')][_0x7a05('0x16')](/0x0){var _0x2948fe=['Auto-Submitted:\x20auto-replied',_0x7a05('0x30'),_0x7a05('0x31')];for(var _0x254352=0x0;_0x254352<_0x288581[_0x7a05('0x2f')][_0x7a05('0xe')];_0x254352++){var _0x2f8e0e=_[_0x7a05('0xd')](_0x2948fe,_0x288581[_0x7a05('0x2f')][_0x254352]['line']);if(_0x2f8e0e>=0x0){_0x4f385d[_0x7a05('0x32')]=!![];}}}return _0x4f385d;}exports[_0x7a05('0x33')]=function(_0x255d61,_0x487e85,_0x12d5f0){var _0x624da5={'from':getAddress(_0x487e85[_0x7a05('0x34')]),'firstName':getFirstName(_0x487e85[_0x7a05('0x34')]),'lastName':getLastName(_0x487e85['from']),'mapKey':_0x7a05('0x5'),'message':{'from':getMails(_0x255d61['email'],_0x487e85['from']),'to':_0x255d61[_0x7a05('0x5')],'cc':'','subject':_0x487e85[_0x7a05('0x35')]||'','messageId':_0x487e85['messageId'],'inReplyTo':_0x487e85[_0x7a05('0x36')],'sentAt':moment(_0x487e85[_0x7a05('0x37')])[_0x7a05('0x26')](_0x7a05('0x38')),'attach':![],'attachments':[]}};if(!_0x487e85[_0x7a05('0x14')]&&!_0x487e85[_0x7a05('0x1f')]){var _0x32cedc=_[_0x7a05('0x39')](_0x487e85[_0x7a05('0x19')],{'contentType':_0x7a05('0x3a')});if(_0x32cedc[_0x7a05('0xe')]){logger[_0x7a05('0x3b')](util[_0x7a05('0x26')](_0x7a05('0x3c'),_0x487e85[_0x7a05('0x3d')]));tnef['parseBuffer'](_[_0x7a05('0x3e')](_0x32cedc)[_0x7a05('0x2d')],function(_0x19488f,_0x143acf){if(_0x143acf){_0x487e85['html']=_0x143acf[_0x7a05('0x3f')]||_0x7a05('0x40');if(_0x143acf[_0x7a05('0x41')]){for(var _0x906d08=0x0;_0x906d08<_0x143acf['Attachments'][_0x7a05('0xe')];_0x906d08++){var _0x537d2c=_0x143acf[_0x7a05('0x41')][_0x906d08];_0x624da5[_0x7a05('0x20')]['attachments'][_0x7a05('0x1b')]({'filename':_0x537d2c[_0x7a05('0x42')],'content':Buffer[_0x7a05('0x34')](_0x537d2c['Data'])});}}}_0x12d5f0(parseEmail(_0x255d61,_0x487e85,_0x624da5));});}else{_0x487e85[_0x7a05('0x14')]=_0x7a05('0x40');_0x12d5f0(parseEmail(_0x255d61,_0x487e85,_0x624da5));}}else{_0x12d5f0(parseEmail(_0x255d61,_0x487e85,_0x624da5));}};exports[_0x7a05('0x43')]=function(_0x269770){switch(_0x269770){case'gmail':return _0x7a05('0x44');case'yahoo':return _0x7a05('0x45');case _0x7a05('0x46'):return _0x7a05('0x47');case _0x7a05('0x48'):return _0x7a05('0x49');}return _0x7a05('0x4a');}; \ No newline at end of file +var _0xf9ac=['replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','127.0.0.1','lodash','path','util','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','length','slice','Anonymous','split','pop','isEmpty','html','test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9ac,0x87));var _0xcf9a=function(_0x5d984b,_0x40d186){_0x5d984b=_0x5d984b-0x0;var _0x5eef3f=_0xf9ac[_0x5d984b];return _0x5eef3f;};'use strict';var _=require(_0xcf9a('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0xcf9a('0x1'));var util=require(_0xcf9a('0x2'));var tnef=require('node-tnef');var logger=require(_0xcf9a('0x3'))('email');var config=require(_0xcf9a('0x4'));function getAddress(_0x518dc3){var _0x48da91=_[_0xcf9a('0x5')](_0x518dc3[_0xcf9a('0x6')]);return _0x48da91&&_0x48da91[_0xcf9a('0x7')]?_0x48da91[_0xcf9a('0x7')]:'anonymous'+random[_0xcf9a('0x8')](0x6)+_0xcf9a('0x9');}function getFirstName(_0x4c0665){var _0x536f2f=_[_0xcf9a('0x5')](_0x4c0665['value']);if(_0x536f2f&&_0x536f2f[_0xcf9a('0xa')]){if(_0x536f2f['name']==_0x536f2f[_0xcf9a('0x7')]){return _0x536f2f['name'][_0xcf9a('0xb')](0x0,_0x536f2f[_0xcf9a('0xa')][_0xcf9a('0xc')]('@'));}var _0x53c5ae=_0x536f2f['name']['split'](/\s+/);return _0x53c5ae[_0xcf9a('0xd')]>0x1?_0x53c5ae[_0xcf9a('0xe')](0x0,-0x1)['join']('\x20'):_0x536f2f[_0xcf9a('0xa')];}return _0xcf9a('0xf');}function getLastName(_0xe8fe56){var _0x583cdf=_[_0xcf9a('0x5')](_0xe8fe56['value']);if(_0x583cdf&&_0x583cdf['name']){var _0x58cdd2=_0x583cdf['name'][_0xcf9a('0x10')](/\s+/);return _0x58cdd2[_0xcf9a('0xd')]>0x1?_0x58cdd2[_0xcf9a('0x11')]():'';}return'';}function getMails(_0xaadfd7,_0x16b7d){var _0xced14a='';for(var _0x25dc10=0x0;_0x25dc10<_0x16b7d['value'][_0xcf9a('0xd')];_0x25dc10+=0x1){if(_0x16b7d[_0xcf9a('0x6')][_0x25dc10]['address']!==_0xaadfd7){if(!_[_0xcf9a('0x12')](_0xced14a)){_0xced14a+=',';}_0xced14a+=_0x16b7d['value'][_0x25dc10][_0xcf9a('0xa')]||_0x16b7d['value'][_0x25dc10][_0xcf9a('0x7')]||'';_0xced14a+='\x20<';_0xced14a+=_0x16b7d[_0xcf9a('0x6')][_0x25dc10][_0xcf9a('0x7')]?_0x16b7d[_0xcf9a('0x6')][_0x25dc10][_0xcf9a('0x7')]:'anonymous'+random['generate'](0x6)+_0xcf9a('0x9');_0xced14a+='>';}}return _0xced14a;}function parseEmail(_0x5f3ac0,_0x46d8b0,_0x2e308a){if(_0x46d8b0[_0xcf9a('0x13')]){var _0x5e8019=/)<[^<]*)*<\/script>/gi;while(_0x5e8019[_0xcf9a('0x14')](_0x46d8b0[_0xcf9a('0x13')])){_0x46d8b0[_0xcf9a('0x13')]=_0x46d8b0['html'][_0xcf9a('0x15')](_0x5e8019,'');}if(_0x46d8b0[_0xcf9a('0x13')][_0xcf9a('0x16')]('{_0x4f43b9[_0xcf9a('0x19')](_0x11f372[_0xcf9a('0x1a')]);});var _0x3d2135=/]+>/g;var _0x4f9b8c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2c46c5=_0x46d8b0['html']['replace'](_0x4f9b8c,_0xcf9a('0x1b'));var _0x798016=_0x2c46c5[_0xcf9a('0x15')](_0x3d2135,_0xcf9a('0x1c'));for(let _0x3497f4=0x0;_0x3497f4<_0x4f43b9[_0xcf9a('0xd')];_0x3497f4++){var _0x17386b=_0x798016['replace']('_IMG',_0xcf9a('0x1d')+_0x4f43b9[_0x3497f4]+_0xcf9a('0x1e'));_0x798016=_0x17386b;}_0x46d8b0['html']=_0x798016;}_0x2e308a['body']=_0x46d8b0['html'];}else{_0x2e308a[_0xcf9a('0x1f')]=_0x46d8b0[_0xcf9a('0x20')];}if(_0x2e308a[_0xcf9a('0x1f')]){_0x2e308a['body']=_0x2e308a[_0xcf9a('0x1f')][_0xcf9a('0x15')](/0x0){var _0x2da846=[_0xcf9a('0x32'),_0xcf9a('0x33'),_0xcf9a('0x34')];for(var _0x27273a=0x0;_0x27273a<_0x46d8b0[_0xcf9a('0x31')][_0xcf9a('0xd')];_0x27273a++){var _0x3a6a6d=_['indexOf'](_0x2da846,_0x46d8b0['headerLines'][_0x27273a][_0xcf9a('0x35')]);if(_0x3a6a6d>=0x0){_0x2e308a['isAutoreply']=!![];}}}return _0x2e308a;}exports[_0xcf9a('0x36')]=function(_0x325d85,_0x46233c,_0x4ad76b){var _0x424476={'from':getAddress(_0x46233c[_0xcf9a('0x37')]),'firstName':getFirstName(_0x46233c[_0xcf9a('0x37')]),'lastName':getLastName(_0x46233c[_0xcf9a('0x37')]),'mapKey':'email','message':{'from':getMails(_0x325d85[_0xcf9a('0x23')],_0x46233c[_0xcf9a('0x37')]),'to':_0x325d85[_0xcf9a('0x23')],'cc':'','subject':_0x46233c[_0xcf9a('0x38')]||'','messageId':_0x46233c['messageId'],'inReplyTo':_0x46233c[_0xcf9a('0x39')],'sentAt':moment(_0x46233c[_0xcf9a('0x3a')])[_0xcf9a('0x29')](_0xcf9a('0x3b')),'attach':![],'attachments':[]}};if(!_0x46233c[_0xcf9a('0x13')]&&!_0x46233c[_0xcf9a('0x20')]){var _0x48b3af=_['filter'](_0x46233c[_0xcf9a('0x17')],{'contentType':_0xcf9a('0x3c')});if(_0x48b3af[_0xcf9a('0xd')]){logger[_0xcf9a('0x3d')](util[_0xcf9a('0x29')](_0xcf9a('0x3e'),_0x46233c[_0xcf9a('0x3f')]));tnef[_0xcf9a('0x40')](_[_0xcf9a('0x41')](_0x48b3af)[_0xcf9a('0x2f')],function(_0xacf25,_0x435973){if(_0x435973){_0x46233c[_0xcf9a('0x13')]=_0x435973[_0xcf9a('0x42')]||_0xcf9a('0x43');if(_0x435973['Attachments']){for(var _0x15a195=0x0;_0x15a195<_0x435973[_0xcf9a('0x44')][_0xcf9a('0xd')];_0x15a195++){var _0x2b02bf=_0x435973[_0xcf9a('0x44')][_0x15a195];_0x424476[_0xcf9a('0x24')][_0xcf9a('0x17')][_0xcf9a('0x19')]({'filename':_0x2b02bf[_0xcf9a('0x45')],'content':Buffer[_0xcf9a('0x37')](_0x2b02bf['Data'])});}}}_0x4ad76b(parseEmail(_0x325d85,_0x46233c,_0x424476));});}else{_0x46233c[_0xcf9a('0x13')]=_0xcf9a('0x43');_0x4ad76b(parseEmail(_0x325d85,_0x46233c,_0x424476));}}else{_0x4ad76b(parseEmail(_0x325d85,_0x46233c,_0x424476));}};exports[_0xcf9a('0x46')]=function(_0x5058d8){switch(_0x5058d8){case _0xcf9a('0x47'):return _0xcf9a('0x48');case _0xcf9a('0x49'):return _0xcf9a('0x4a');case _0xcf9a('0x4b'):return _0xcf9a('0x4c');case'outlook365':return'outlook.office365.com';}return _0xcf9a('0x4d');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a987dc3..cb4584d 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 _0x830e=['name','Service','key','active','Imap','Smtp','exports','lodash'];(function(_0x572883,_0x323692){var _0x382b2a=function(_0x501a08){while(--_0x501a08){_0x572883['push'](_0x572883['shift']());}};_0x382b2a(++_0x323692);}(_0x830e,0x7f));var _0xe830=function(_0xc7b88e,_0x4fbbb2){_0xc7b88e=_0xc7b88e-0x0;var _0x81f625=_0x830e[_0xc7b88e];return _0x81f625;};'use strict';var _=require(_0xe830('0x0'));function MailAccount(_0x11167b){this['id']=_0x11167b['id']||0x0;this[_0xe830('0x1')]=_0x11167b[_0xe830('0x1')]||_0xe830('0x2');this[_0xe830('0x3')]=_0x11167b[_0xe830('0x3')]||'SERV';this[_0xe830('0x4')]=_0x11167b['active']||![];this[_0xe830('0x5')]=_0x11167b[_0xe830('0x5')]||[];this['Smtp']=_0x11167b[_0xe830('0x6')]||[];}module[_0xe830('0x7')]=MailAccount; \ No newline at end of file +var _0x3ffd=['Smtp','exports','lodash','Service','key','SERV','active','Imap'];(function(_0x2805d2,_0x35cf73){var _0x5040a8=function(_0x3d30f7){while(--_0x3d30f7){_0x2805d2['push'](_0x2805d2['shift']());}};_0x5040a8(++_0x35cf73);}(_0x3ffd,0xd2));var _0xd3ff=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x3ffd[_0x43c8b8];return _0x413be3;};'use strict';var _=require(_0xd3ff('0x0'));function MailAccount(_0x39f898){this['id']=_0x39f898['id']||0x0;this['name']=_0x39f898['name']||_0xd3ff('0x1');this[_0xd3ff('0x2')]=_0x39f898[_0xd3ff('0x2')]||_0xd3ff('0x3');this[_0xd3ff('0x4')]=_0x39f898['active']||![];this[_0xd3ff('0x5')]=_0x39f898[_0xd3ff('0x5')]||[];this[_0xd3ff('0x6')]=_0x39f898[_0xd3ff('0x6')]||[];}module[_0xd3ff('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index fed2332..db01472 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 _0xc332=['prototype','initMailAccounts','mailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty'];(function(_0x32517b,_0x53c7c9){var _0x446529=function(_0x25703f){while(--_0x25703f){_0x32517b['push'](_0x32517b['shift']());}};_0x446529(++_0x53c7c9);}(_0xc332,0x1c8));var _0x2c33=function(_0x4a8558,_0x40392f){_0x4a8558=_0x4a8558-0x0;var _0x29e7e7=_0xc332[_0x4a8558];return _0x29e7e7;};'use strict';var _=require(_0x2c33('0x0'));var MailAccount=require(_0x2c33('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x43cd4b,_0x2c10df,_0x275bb2){var _0x1ec653=_[_0x2c33('0x2')](_0x43cd4b,function(_0x42a861,_0x592cb4){return _0x42a861[_0x275bb2];});for(var _0x413339 in _0x2c10df){if(_0x2c10df[_0x2c33('0x3')](_0x413339)){if(!_0x1ec653[_0x413339]){delete _0x2c10df[_0x413339];}}}}Realtime[_0x2c33('0x4')]['mergeFromDatabase']=function(_0x1ec30f,_0x2a05ae){for(var _0x94fb97 in _0x2a05ae){if(_0x1ec30f[_0x2c33('0x3')](_0x94fb97)){_0x1ec30f[_0x94fb97]=_0x2a05ae[_0x94fb97];}}};Realtime[_0x2c33('0x4')][_0x2c33('0x5')]=function(){var _0x52d268=this;return function(_0x4121ed){if(_0x4121ed){freeIsNotKey(_0x4121ed,_0x52d268[_0x2c33('0x6')],'id');for(var _0x4afdbb=0x0,_0x59e40c={},_0x41f57a={};_0x4afdbb<_0x4121ed[_0x2c33('0x7')];_0x4afdbb+=0x1){_0x59e40c=_0x4121ed[_0x4afdbb];if(_[_0x2c33('0x8')](_0x52d268['mailAccounts'][_0x59e40c['id']])){_0x52d268[_0x2c33('0x6')][_0x59e40c['id']]=new MailAccount(_0x59e40c);}else{_['merge'](_0x52d268['mailAccounts'][_0x59e40c['id']],_0x59e40c);}}}return _0x52d268[_0x2c33('0x6')];};};module[_0x2c33('0x9')]=Realtime; \ No newline at end of file +var _0x84a5=['merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined'];(function(_0x336db5,_0x138ef8){var _0x55eca6=function(_0x350e42){while(--_0x350e42){_0x336db5['push'](_0x336db5['shift']());}};_0x55eca6(++_0x138ef8);}(_0x84a5,0xc2));var _0x584a=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x84a5[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x584a('0x0'));var MailAccount=require(_0x584a('0x1'));var Realtime=function(){this[_0x584a('0x2')]={};};function freeIsNotKey(_0x377f04,_0x2a09f4,_0x2d8c77){var _0x11f4f9=_[_0x584a('0x3')](_0x377f04,function(_0x38aab2,_0x4b6fe6){return _0x38aab2[_0x2d8c77];});for(var _0x34ab1b in _0x2a09f4){if(_0x2a09f4[_0x584a('0x4')](_0x34ab1b)){if(!_0x11f4f9[_0x34ab1b]){delete _0x2a09f4[_0x34ab1b];}}}}Realtime[_0x584a('0x5')][_0x584a('0x6')]=function(_0xc6d6ab,_0x4edb78){for(var _0x1ad381 in _0x4edb78){if(_0xc6d6ab[_0x584a('0x4')](_0x1ad381)){_0xc6d6ab[_0x1ad381]=_0x4edb78[_0x1ad381];}}};Realtime[_0x584a('0x5')][_0x584a('0x7')]=function(){var _0x3188c2=this;return function(_0xc767a3){if(_0xc767a3){freeIsNotKey(_0xc767a3,_0x3188c2[_0x584a('0x2')],'id');for(var _0x6c261c=0x0,_0x55b18d={},_0xf807a7={};_0x6c261c<_0xc767a3[_0x584a('0x8')];_0x6c261c+=0x1){_0x55b18d=_0xc767a3[_0x6c261c];if(_[_0x584a('0x9')](_0x3188c2[_0x584a('0x2')][_0x55b18d['id']])){_0x3188c2[_0x584a('0x2')][_0x55b18d['id']]=new MailAccount(_0x55b18d);}else{_[_0x584a('0xa')](_0x3188c2[_0x584a('0x2')][_0x55b18d['id']],_0x55b18d);}}}return _0x3188c2['mailAccounts'];};};module[_0x584a('0xb')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 03a1ab7..5159b85 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 _0x07d7=['GetMailAccount','name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x07d7,0x85));var _0x707d=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x07d7[_0x296754];return _0x1d9f1d;};'use strict';var client=require(_0x707d('0x0'));exports[_0x707d('0x1')]=function(){return function(){return client[_0x707d('0x2')](_0x707d('0x3'),{'options':{'attributes':['id',_0x707d('0x4'),_0x707d('0x5'),_0x707d('0x6'),_0x707d('0x7'),_0x707d('0x8'),_0x707d('0x9'),_0x707d('0xa')],'raw':![],'include':[{'model':_0x707d('0xb'),'as':_0x707d('0xc')},{'model':_0x707d('0xd'),'as':_0x707d('0xe')}]},'log':_0x707d('0xf')});};};exports['notify']=function(_0x4c9e57,_0x5fe2d4){return client[_0x707d('0x2')](_0x707d('0x10'),{'account':{'id':_0x4c9e57},'body':_0x5fe2d4,'log':_0x707d('0x10')});}; \ No newline at end of file +var _0x80eb=['active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','service'];(function(_0x1f703f,_0x266ba9){var _0x3ad2ec=function(_0x306f81){while(--_0x306f81){_0x1f703f['push'](_0x1f703f['shift']());}};_0x3ad2ec(++_0x266ba9);}(_0x80eb,0x118));var _0xb80e=function(_0x23b7fd,_0x5f0c41){_0x23b7fd=_0x23b7fd-0x0;var _0x4e96b7=_0x80eb[_0x23b7fd];return _0x4e96b7;};'use strict';var client=require(_0xb80e('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xb80e('0x1')](_0xb80e('0x2'),{'options':{'attributes':['id',_0xb80e('0x3'),_0xb80e('0x4'),'email',_0xb80e('0x5'),_0xb80e('0x6'),_0xb80e('0x7'),_0xb80e('0x8')],'raw':![],'include':[{'model':_0xb80e('0x9'),'as':_0xb80e('0xa')},{'model':_0xb80e('0xb'),'as':'Smtp'}]},'log':_0xb80e('0xc')});};};exports[_0xb80e('0xd')]=function(_0x5e10c5,_0x46b765){return client[_0xb80e('0x1')](_0xb80e('0xe'),{'account':{'id':_0x5e10c5},'body':_0x46b765,'log':_0xb80e('0xe')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index fc9d74d..dd97ceb 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 _0xe037=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0xe037,0xf9));var _0x7e03=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0xe037[_0x3ab928];return _0xf47692;};'use strict';var client=require(_0x7e03('0x0'));exports[_0x7e03('0x1')]=function(){return client['Request'](_0x7e03('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7e03('0x3')]},'log':_0x7e03('0x4')});}; \ No newline at end of file +var _0x8a36=['GetSettings','getSettings','Request','ShowSetting'];(function(_0x2605bd,_0x564e9a){var _0x8e9210=function(_0xce9cce){while(--_0xce9cce){_0x2605bd['push'](_0x2605bd['shift']());}};_0x8e9210(++_0x564e9a);}(_0x8a36,0x6d));var _0x68a3=function(_0x2a0bbb,_0xbc6235){_0x2a0bbb=_0x2a0bbb-0x0;var _0x36ec04=_0x8a36[_0x2a0bbb];return _0x36ec04;};'use strict';var client=require('../client');exports[_0x68a3('0x0')]=function(){return client[_0x68a3('0x1')](_0x68a3('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x68a3('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7e55bbd..ac74718 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 4261d57..51e189a 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 _0xb0c3=['../../config/socketio','../../config/express','default','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','http','express','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb0c3,0x195));var _0x3b0c=function(_0x59730b,_0x211184){_0x59730b=_0x59730b-0x0;var _0x25fa40=_0xb0c3[_0x59730b];return _0x25fa40;};'use strict';var _=require('lodash');var http=require(_0x3b0c('0x0'));var express=require(_0x3b0c('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x3b0c('0x2'));var app=express();var server=http[_0x3b0c('0x3')](app);server[_0x3b0c('0x4')]=0xdbba0;if(sticky[_0x3b0c('0x5')](server,config[_0x3b0c('0x6')])){var socketio=require(_0x3b0c('0x7'))(server,{'transports':[_0x3b0c('0x8'),'polling']});config[_0x3b0c('0x9')]=_[_0x3b0c('0xa')](config[_0x3b0c('0x9')],{'host':_0x3b0c('0xb'),'port':0x18eb});socketio[_0x3b0c('0xc')](require(_0x3b0c('0xd'))({'pubClient':new Redis(config[_0x3b0c('0x9')]),'subClient':new Redis(config[_0x3b0c('0x9')])}));require(_0x3b0c('0xe'))['default']();require(_0x3b0c('0xf'))['default'](socketio);require(_0x3b0c('0x10'))[_0x3b0c('0x11')](app);require('../../routes')[_0x3b0c('0x11')](app);}else{server['once'](_0x3b0c('0x12'),function(){console[_0x3b0c('0x13')](_0x3b0c('0x14'),config[_0x3b0c('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xf73e=['polling','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','websocket'];(function(_0x588adf,_0xd20a9d){var _0x4e6acf=function(_0xd9df02){while(--_0xd9df02){_0x588adf['push'](_0x588adf['shift']());}};_0x4e6acf(++_0xd20a9d);}(_0xf73e,0x72));var _0xef73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf73e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xef73('0x0'));var http=require(_0xef73('0x1'));var express=require(_0xef73('0x2'));var sticky=require(_0xef73('0x3'));var Redis=require('ioredis');var config=require(_0xef73('0x4'));var app=express();var server=http[_0xef73('0x5')](app);server[_0xef73('0x6')]=0xdbba0;if(sticky[_0xef73('0x7')](server,config[_0xef73('0x8')])){var socketio=require(_0xef73('0x9'))(server,{'transports':[_0xef73('0xa'),_0xef73('0xb')]});config['redis']=_[_0xef73('0xc')](config[_0xef73('0xd')],{'host':_0xef73('0xe'),'port':0x18eb});socketio[_0xef73('0xf')](require(_0xef73('0x10'))({'pubClient':new Redis(config[_0xef73('0xd')]),'subClient':new Redis(config['redis'])}));require(_0xef73('0x11'))['default']();require(_0xef73('0x12'))[_0xef73('0x13')](socketio);require(_0xef73('0x14'))[_0xef73('0x13')](app);require('../../routes')[_0xef73('0x13')](app);}else{server[_0xef73('0x15')](_0xef73('0x16'),function(){console['log'](_0xef73('0x17'),config[_0xef73('0x8')]);});}exports=module[_0xef73('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 1053bec..f6a4fac 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 _0xa391=['Request','request','then','error','rpc','message','catch','exports','jayson/promise','bluebird','routing','http'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa391,0x110));var _0x1a39=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xa391[_0x36c5b0];return _0xf19333;};'use strict';var jayson=require(_0x1a39('0x0'));var BPromise=require(_0x1a39('0x1'));var logger=require('../../config/logger')(_0x1a39('0x2'));var client=jayson['client'][_0x1a39('0x3')]({'port':0x2329});client[_0x1a39('0x4')]=function(_0x568721,_0x2b4a2b){return new BPromise(function(_0x1c4a6b,_0x359b29){return client[_0x1a39('0x5')](_0x568721,_0x2b4a2b)[_0x1a39('0x6')](function(_0x2fe70f){logger['debug']('rpc','routing',_0x568721,_0x2b4a2b,_0x2fe70f);if(_0x2fe70f[_0x1a39('0x7')]){logger['error'](_0x1a39('0x8'),_0x1a39('0x2'),_0x568721,_0x2fe70f[_0x1a39('0x7')]['message'],_0x2b4a2b);return _0x359b29(_0x2fe70f[_0x1a39('0x7')][_0x1a39('0x9')]);}else{return _0x1c4a6b(_0x2fe70f['result']);}})[_0x1a39('0xa')](function(_0x58bd8b){logger[_0x1a39('0x7')](_0x1a39('0x8'),_0x1a39('0x2'),_0x568721,_0x58bd8b,_0x2b4a2b);return _0x359b29(_0x58bd8b);});});};module[_0x1a39('0xb')]=client; \ No newline at end of file +var _0x800a=['jayson/promise','bluebird','../../config/logger','routing','Request','request','then','debug','rpc','error','message','result','exports'];(function(_0x1d2e01,_0x4d88ae){var _0x5b9562=function(_0xa041e9){while(--_0xa041e9){_0x1d2e01['push'](_0x1d2e01['shift']());}};_0x5b9562(++_0x4d88ae);}(_0x800a,0x16c));var _0xa800=function(_0x10a3d9,_0x386599){_0x10a3d9=_0x10a3d9-0x0;var _0x459576=_0x800a[_0x10a3d9];return _0x459576;};'use strict';var jayson=require(_0xa800('0x0'));var BPromise=require(_0xa800('0x1'));var logger=require(_0xa800('0x2'))(_0xa800('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xa800('0x4')]=function(_0x5c4c33,_0x333997){return new BPromise(function(_0x48363a,_0x4d76a8){return client[_0xa800('0x5')](_0x5c4c33,_0x333997)[_0xa800('0x6')](function(_0x4c0643){logger[_0xa800('0x7')](_0xa800('0x8'),_0xa800('0x3'),_0x5c4c33,_0x333997,_0x4c0643);if(_0x4c0643[_0xa800('0x9')]){logger['error'](_0xa800('0x8'),'routing',_0x5c4c33,_0x4c0643['error']['message'],_0x333997);return _0x4d76a8(_0x4c0643['error'][_0xa800('0xa')]);}else{return _0x48363a(_0x4c0643[_0xa800('0xb')]);}})['catch'](function(_0x3cd67a){logger[_0xa800('0x9')](_0xa800('0x8'),_0xa800('0x3'),_0x5c4c33,_0x3cd67a,_0x333997);return _0x4d76a8(_0x3cd67a);});});};module[_0xa800('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 78a0605..b34b46f 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 _0xcac8=['listen','log','bluebird','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x8172ed,_0x18178a){var _0xace188=function(_0x1b1a01){while(--_0x1b1a01){_0x8172ed['push'](_0x8172ed['shift']());}};_0xace188(++_0x18178a);}(_0xcac8,0x160));var _0x8cac=function(_0x1045cf,_0x3d5e3e){_0x1045cf=_0x1045cf-0x0;var _0xa04932=_0xcac8[_0x1045cf];return _0xa04932;};'use strict';var BPromise=require(_0x8cac('0x0'));var server=require('./server');var Realtime=require(_0x8cac('0x1'));var user=require('./rpc/user');var interval=require(_0x8cac('0x2'));var openchannelQueue=require(_0x8cac('0x3'));var chatQueue=require(_0x8cac('0x4'));var smsQueue=require(_0x8cac('0x5'));var mailQueue=require(_0x8cac('0x6'));var faxQueue=require(_0x8cac('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x8cac('0x8')]()[_0x8cac('0x9')](user[_0x8cac('0xa')]())[_0x8cac('0x9')](realtime[_0x8cac('0xb')]())['then'](interval[_0x8cac('0xc')]())[_0x8cac('0x9')](realtime['initIntervals']())[_0x8cac('0x9')](openchannelQueue[_0x8cac('0xd')]())[_0x8cac('0x9')](realtime[_0x8cac('0xe')]())[_0x8cac('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0x8cac('0xf')]())[_0x8cac('0x9')](smsQueue['getSmsQueues']())[_0x8cac('0x9')](realtime[_0x8cac('0x10')]())['then'](mailQueue[_0x8cac('0x11')]())[_0x8cac('0x9')](realtime[_0x8cac('0x12')]())['then'](faxQueue[_0x8cac('0x13')]())[_0x8cac('0x9')](realtime[_0x8cac('0x14')]())[_0x8cac('0x9')](whatsappQueue[_0x8cac('0x15')]())[_0x8cac('0x9')](realtime[_0x8cac('0x16')]())[_0x8cac('0x9')](function(){return realtime;});}function main(){return server[_0x8cac('0x17')](realtime)[_0x8cac('0x9')](function(_0x4737e2){return initRealtime();})[_0x8cac('0x9')](function(_0x3e7e17){return setInterval(initRealtime,0x1388);})['catch'](function(_0x2de935){console[_0x8cac('0x18')](_0x2de935);});}main(); \ No newline at end of file +var _0xe86d=['catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues'];(function(_0x384a27,_0x2d03c8){var _0x34e55f=function(_0x5b4009){while(--_0x5b4009){_0x384a27['push'](_0x384a27['shift']());}};_0x34e55f(++_0x2d03c8);}(_0xe86d,0x154));var _0xde86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe86d[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xde86('0x0'));var server=require('./server');var Realtime=require(_0xde86('0x1'));var user=require(_0xde86('0x2'));var interval=require(_0xde86('0x3'));var openchannelQueue=require(_0xde86('0x4'));var chatQueue=require(_0xde86('0x5'));var smsQueue=require(_0xde86('0x6'));var mailQueue=require(_0xde86('0x7'));var faxQueue=require(_0xde86('0x8'));var whatsappQueue=require(_0xde86('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xde86('0xa')]()[_0xde86('0xb')](user[_0xde86('0xc')]())['then'](realtime[_0xde86('0xd')]())[_0xde86('0xb')](interval['getIntervals']())[_0xde86('0xb')](realtime[_0xde86('0xe')]())[_0xde86('0xb')](openchannelQueue['getOpenchannelQueues']())[_0xde86('0xb')](realtime[_0xde86('0xf')]())['then'](chatQueue[_0xde86('0x10')]())[_0xde86('0xb')](realtime[_0xde86('0x11')]())[_0xde86('0xb')](smsQueue[_0xde86('0x12')]())[_0xde86('0xb')](realtime[_0xde86('0x13')]())[_0xde86('0xb')](mailQueue[_0xde86('0x14')]())['then'](realtime['initMailQueues']())[_0xde86('0xb')](faxQueue[_0xde86('0x15')]())[_0xde86('0xb')](realtime[_0xde86('0x16')]())[_0xde86('0xb')](whatsappQueue[_0xde86('0x17')]())[_0xde86('0xb')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xde86('0xb')](function(_0x5b12d2){return initRealtime();})['then'](function(_0x40bd6e){return setInterval(initRealtime,0x1388);})[_0xde86('0x18')](function(_0x1077d6){console[_0xde86('0x19')](_0x1077d6);});}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 cd7519a..120c38a 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4a177c,_0x2bd612){var _0x54dd37=function(_0x58b775){while(--_0x58b775){_0x4a177c['push'](_0x4a177c['shift']());}};_0x54dd37(++_0x2bd612);}(_0x326f,0xd1));var _0xf326=function(_0x24f0bf,_0x281907){_0x24f0bf=_0x24f0bf-0x0;var _0x12abdf=_0x326f[_0x24f0bf];return _0x12abdf;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x4212f6,_0xf9fb41){var _0x57aaa9=function(_0x54135e){while(--_0x54135e){_0x4212f6['push'](_0x4212f6['shift']());}};_0x57aaa9(++_0xf9fb41);}(_0x814b,0x1a2));var _0xb814=function(_0x89a001,_0x3a9a8c){_0x89a001=_0x89a001-0x0;var _0x5f3ec2=_0x814b[_0x89a001];return _0x5f3ec2;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 3bd7f8d..041c7b0 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 _0x1dfa=['error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1dfa,0x175));var _0xa1df=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x1dfa[_0x4e6ae6];return _0x23c108;};'use strict';var BPromise=require(_0xa1df('0x0'));var jayson=require(_0xa1df('0x1'));var client=jayson[_0xa1df('0x2')]['http']({'port':0x232b});function request(_0x376375,_0x2c1ba9){return new BPromise(function(_0x17c197,_0x1172cc){return client['request'](_0x376375,_0x2c1ba9)['then'](function(_0xe3387d){if(_0xe3387d[_0xa1df('0x3')]){return _0x1172cc(_0xe3387d[_0xa1df('0x3')][_0xa1df('0x4')]);}else{return _0x17c197(_0xe3387d[_0xa1df('0x5')]);}})[_0xa1df('0x6')](function(_0x1c5c66){return _0x1172cc(_0x1c5c66);});});}exports[_0xa1df('0x7')]=function(_0x3c02ce,_0x2fb152){return request('SendMail',{'account':_0x3c02ce,'message':_0x2fb152});}; \ No newline at end of file +var _0xb599=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb599,0xaa));var _0x9b59=function(_0x368df6,_0x73b3d5){_0x368df6=_0x368df6-0x0;var _0x3a23ff=_0xb599[_0x368df6];return _0x3a23ff;};'use strict';var BPromise=require(_0x9b59('0x0'));var jayson=require(_0x9b59('0x1'));var client=jayson[_0x9b59('0x2')][_0x9b59('0x3')]({'port':0x232b});function request(_0x3682c3,_0x150526){return new BPromise(function(_0x277f5c,_0x56dfe8){return client[_0x9b59('0x4')](_0x3682c3,_0x150526)[_0x9b59('0x5')](function(_0x5658db){if(_0x5658db[_0x9b59('0x6')]){return _0x56dfe8(_0x5658db['error']['message']);}else{return _0x277f5c(_0x5658db[_0x9b59('0x7')]);}})[_0x9b59('0x8')](function(_0x35c04a){return _0x56dfe8(_0x35c04a);});});}exports[_0x9b59('0x9')]=function(_0x6dd00a,_0xf204b0){return request('SendMail',{'account':_0x6dd00a,'message':_0xf204b0});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index f26fc10..ea43ff4 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 _0xb126=['chatStatusTime','faxStatus','smsCurrentCapacity','whatsappStatus','openchannelStatusTime','openchannelCurrentCapacity','busy','stringify','emit','exports','lodash','moment','md5','ioredis','defaults','redis','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','working','idle','openchannel','fax','sms','whatsapp','length','format','Status'];(function(_0x2510a6,_0x5114ce){var _0x58e556=function(_0x2df0de){while(--_0x2df0de){_0x2510a6['push'](_0x2510a6['shift']());}};_0x58e556(++_0x5114ce);}(_0xb126,0x127));var _0x6b12=function(_0x41f0af,_0xe5683e){_0x41f0af=_0x41f0af-0x0;var _0x5d6d7b=_0xb126[_0x41f0af];return _0x5d6d7b;};'use strict';var _=require(_0x6b12('0x0'));var moment=require(_0x6b12('0x1'));var md5=require(_0x6b12('0x2'));var Redis=require(_0x6b12('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x6b12('0x4')](config[_0x6b12('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6b12('0x5')]));function Agent(_0x3f9a4f){this['id']=_0x3f9a4f['id']||0x0;this['name']=_0x3f9a4f['name']||'';this[_0x6b12('0x6')]=_0x3f9a4f['online']||!![];this[_0x6b12('0x7')]=_0x3f9a4f[_0x6b12('0x7')]||![];this[_0x6b12('0x8')]=_0x3f9a4f[_0x6b12('0x8')]||![];this[_0x6b12('0x9')]=_0x3f9a4f['mailPause']||![];this[_0x6b12('0xa')]=_0x3f9a4f[_0x6b12('0xa')]||![];this[_0x6b12('0xb')]=_0x3f9a4f['smsPause']||![];this[_0x6b12('0xc')]=_0x3f9a4f[_0x6b12('0xc')]||![];this[_0x6b12('0xd')]=_0x6b12('0xe');this['chatStatusTime']=0x0;this['chatCapacity']=_0x3f9a4f[_0x6b12('0xf')]||0x0;this[_0x6b12('0x10')]=0x0;this[_0x6b12('0x11')]=_0x6b12('0xe');this[_0x6b12('0x12')]=0x0;this[_0x6b12('0x13')]=_0x3f9a4f[_0x6b12('0x13')]||0x0;this[_0x6b12('0x14')]=0x0;this['faxStatus']='unknown';this[_0x6b12('0x15')]=0x0;this[_0x6b12('0x16')]=_0x3f9a4f['faxCapacity']||0x0;this[_0x6b12('0x17')]=0x0;this[_0x6b12('0x18')]=_0x6b12('0xe');this[_0x6b12('0x19')]=0x0;this[_0x6b12('0x1a')]=_0x3f9a4f[_0x6b12('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x6b12('0xe');this[_0x6b12('0x1b')]=0x0;this[_0x6b12('0x1c')]=_0x3f9a4f['whatsappCapacity']||0x0;this[_0x6b12('0x1d')]=0x0;this[_0x6b12('0x1e')]=_0x6b12('0xe');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x3f9a4f[_0x6b12('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x6b12('0x20')]=undefined;this[_0x6b12('0x2')]='';this[_0x6b12('0x21')]();}Agent[_0x6b12('0x22')][_0x6b12('0x23')]=function(_0x2bddb0){if(this[_0x2bddb0+'CurrentCapacity']>0x0){if(this[_0x2bddb0+_0x6b12('0x24')]>0x0&&this[_0x2bddb0+'CurrentCapacity']>=this[_0x2bddb0+_0x6b12('0x24')]){return _0x6b12('0x25');}else{return _0x6b12('0x26');}}else{return _0x6b12('0x27');}};Agent['prototype'][_0x6b12('0x21')]=function(){var _0x110cd3=['mail','chat',_0x6b12('0x28'),_0x6b12('0x29'),_0x6b12('0x2a'),_0x6b12('0x2b')];for(var _0x8acb45=0x0;_0x8acb45<_0x110cd3[_0x6b12('0x2c')];_0x8acb45+=0x1){var _0x24093b=this[_0x6b12('0x23')](_0x110cd3[_0x8acb45]);if(this[_0x110cd3[_0x8acb45]+'Status']!==_0x24093b){this[_0x110cd3[_0x8acb45]+'StatusTime']=_['toNumber'](moment()[_0x6b12('0x2d')]('x'));}this[_0x110cd3[_0x8acb45]+_0x6b12('0x2e')]=_0x24093b;}var _0x1dc6db={'id':this['id'],'name':this['name'],'online':this[_0x6b12('0x6')],'voicePause':this[_0x6b12('0x7')],'chatPause':this[_0x6b12('0x8')],'mailPause':this[_0x6b12('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x6b12('0xa')],'openchannelPause':this[_0x6b12('0xc')],'chatStatus':this[_0x6b12('0xd')],'chatStatusTime':this[_0x6b12('0x2f')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x6b12('0x10')],'mailStatus':this[_0x6b12('0x11')],'mailStatusTime':this[_0x6b12('0x12')],'mailCapacity':this[_0x6b12('0x13')],'mailCurrentCapacity':this[_0x6b12('0x14')],'faxStatus':this[_0x6b12('0x30')],'faxStatusTime':this[_0x6b12('0x15')],'faxCapacity':this[_0x6b12('0x16')],'faxCurrentCapacity':this[_0x6b12('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x6b12('0x19')],'smsCapacity':this[_0x6b12('0x1a')],'smsCurrentCapacity':this[_0x6b12('0x31')],'whatsappStatus':this[_0x6b12('0x32')],'whatsappStatusTime':this[_0x6b12('0x1b')],'whatsappCapacity':this[_0x6b12('0x1c')],'whatsappCurrentCapacity':this[_0x6b12('0x1d')],'openchannelStatus':this[_0x6b12('0x1e')],'openchannelStatusTime':this[_0x6b12('0x33')],'openchannelCapacity':this[_0x6b12('0x1f')],'openchannelCurrentCapacity':this[_0x6b12('0x34')],'busy':this[_0x6b12('0x35')],'busyQueue':this[_0x6b12('0x20')]};var _0x265208=md5(JSON[_0x6b12('0x36')](_0x1dc6db));if(this[_0x6b12('0x2')]!==_0x265208){this[_0x6b12('0x2')]=_0x265208;io[_0x6b12('0x37')]('user:save',_0x1dc6db);}};module[_0x6b12('0x38')]=Agent; \ No newline at end of file +var _0xa792=['smsCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','CurrentCapacity','Capacity','working','idle','prototype','mail','chat','fax','whatsapp','getChannelStatus','StatusTime','toNumber','format','chatStatus','mailStatusTime','whatsappStatus','whatsappStatusTime','whatsappCapacity','busyQueue','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime'];(function(_0x532c21,_0x1a3d23){var _0x2367c8=function(_0x225d5b){while(--_0x225d5b){_0x532c21['push'](_0x532c21['shift']());}};_0x2367c8(++_0x1a3d23);}(_0xa792,0x142));var _0x2a79=function(_0x39a55e,_0x6a0688){_0x39a55e=_0x39a55e-0x0;var _0x28e0f1=_0xa792[_0x39a55e];return _0x28e0f1;};'use strict';var _=require('lodash');var moment=require(_0x2a79('0x0'));var md5=require(_0x2a79('0x1'));var Redis=require(_0x2a79('0x2'));var config=require(_0x2a79('0x3'));config[_0x2a79('0x4')]=_[_0x2a79('0x5')](config[_0x2a79('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x2a0d00){this['id']=_0x2a0d00['id']||0x0;this['name']=_0x2a0d00[_0x2a79('0x6')]||'';this[_0x2a79('0x7')]=_0x2a0d00[_0x2a79('0x7')]||!![];this['voicePause']=_0x2a0d00[_0x2a79('0x8')]||![];this[_0x2a79('0x9')]=_0x2a0d00[_0x2a79('0x9')]||![];this[_0x2a79('0xa')]=_0x2a0d00['mailPause']||![];this[_0x2a79('0xb')]=_0x2a0d00['faxPause']||![];this[_0x2a79('0xc')]=_0x2a0d00['smsPause']||![];this[_0x2a79('0xd')]=_0x2a0d00[_0x2a79('0xd')]||![];this['chatStatus']=_0x2a79('0xe');this[_0x2a79('0xf')]=0x0;this[_0x2a79('0x10')]=_0x2a0d00[_0x2a79('0x10')]||0x0;this[_0x2a79('0x11')]=0x0;this['mailStatus']=_0x2a79('0xe');this['mailStatusTime']=0x0;this[_0x2a79('0x12')]=_0x2a0d00[_0x2a79('0x12')]||0x0;this[_0x2a79('0x13')]=0x0;this[_0x2a79('0x14')]=_0x2a79('0xe');this[_0x2a79('0x15')]=0x0;this['faxCapacity']=_0x2a0d00[_0x2a79('0x16')]||0x0;this[_0x2a79('0x17')]=0x0;this[_0x2a79('0x18')]=_0x2a79('0xe');this[_0x2a79('0x19')]=0x0;this[_0x2a79('0x1a')]=_0x2a0d00[_0x2a79('0x1a')]||0x0;this[_0x2a79('0x1b')]=0x0;this['whatsappStatus']=_0x2a79('0xe');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x2a0d00['whatsappCapacity']||0x0;this[_0x2a79('0x1c')]=0x0;this[_0x2a79('0x1d')]=_0x2a79('0xe');this[_0x2a79('0x1e')]=0x0;this[_0x2a79('0x1f')]=_0x2a0d00['openchannelCapacity']||0x0;this[_0x2a79('0x20')]=0x0;this[_0x2a79('0x21')]=![];this['busyQueue']=undefined;this[_0x2a79('0x1')]='';this[_0x2a79('0x22')]();}Agent['prototype']['getChannelStatus']=function(_0x23734e){if(this[_0x23734e+_0x2a79('0x23')]>0x0){if(this[_0x23734e+'Capacity']>0x0&&this[_0x23734e+'CurrentCapacity']>=this[_0x23734e+_0x2a79('0x24')]){return'maxcapacity';}else{return _0x2a79('0x25');}}else{return _0x2a79('0x26');}};Agent[_0x2a79('0x27')]['updateRealtime']=function(){var _0xe68a1d=[_0x2a79('0x28'),_0x2a79('0x29'),'openchannel',_0x2a79('0x2a'),'sms',_0x2a79('0x2b')];for(var _0x25e62c=0x0;_0x25e62c<_0xe68a1d['length'];_0x25e62c+=0x1){var _0x50824d=this[_0x2a79('0x2c')](_0xe68a1d[_0x25e62c]);if(this[_0xe68a1d[_0x25e62c]+'Status']!==_0x50824d){this[_0xe68a1d[_0x25e62c]+_0x2a79('0x2d')]=_[_0x2a79('0x2e')](moment()[_0x2a79('0x2f')]('x'));}this[_0xe68a1d[_0x25e62c]+'Status']=_0x50824d;}var _0x26f027={'id':this['id'],'name':this[_0x2a79('0x6')],'online':this[_0x2a79('0x7')],'voicePause':this[_0x2a79('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x2a79('0xa')],'smsPause':this[_0x2a79('0xc')],'faxPause':this['faxPause'],'openchannelPause':this[_0x2a79('0xd')],'chatStatus':this[_0x2a79('0x30')],'chatStatusTime':this[_0x2a79('0xf')],'chatCapacity':this[_0x2a79('0x10')],'chatCurrentCapacity':this[_0x2a79('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x2a79('0x31')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x2a79('0x13')],'faxStatus':this[_0x2a79('0x14')],'faxStatusTime':this[_0x2a79('0x15')],'faxCapacity':this[_0x2a79('0x16')],'faxCurrentCapacity':this[_0x2a79('0x17')],'smsStatus':this[_0x2a79('0x18')],'smsStatusTime':this[_0x2a79('0x19')],'smsCapacity':this[_0x2a79('0x1a')],'smsCurrentCapacity':this[_0x2a79('0x1b')],'whatsappStatus':this[_0x2a79('0x32')],'whatsappStatusTime':this[_0x2a79('0x33')],'whatsappCapacity':this[_0x2a79('0x34')],'whatsappCurrentCapacity':this[_0x2a79('0x1c')],'openchannelStatus':this[_0x2a79('0x1d')],'openchannelStatusTime':this[_0x2a79('0x1e')],'openchannelCapacity':this[_0x2a79('0x1f')],'openchannelCurrentCapacity':this[_0x2a79('0x20')],'busy':this[_0x2a79('0x21')],'busyQueue':this[_0x2a79('0x35')]};var _0x12785e=md5(JSON[_0x2a79('0x36')](_0x26f027));if(this['md5']!==_0x12785e){this[_0x2a79('0x1')]=_0x12785e;io[_0x2a79('0x37')](_0x2a79('0x38'),_0x26f027);}};module[_0x2a79('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 13c4f41..d302466 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 _0x2b1e=['stringify','format','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','length','online','loggedIn','chatPause','available','paused'];(function(_0x581e7d,_0x125495){var _0x58d2b1=function(_0xe544e3){while(--_0xe544e3){_0x581e7d['push'](_0x581e7d['shift']());}};_0x58d2b1(++_0x125495);}(_0x2b1e,0x18b));var _0xe2b1=function(_0x112145,_0x41423d){_0x112145=_0x112145-0x0;var _0x66edde=_0x2b1e[_0x112145];return _0x66edde;};'use strict';var _=require(_0xe2b1('0x0'));var md5=require(_0xe2b1('0x1'));var util=require('util');var Redis=require(_0xe2b1('0x2'));var config=require(_0xe2b1('0x3'));config[_0xe2b1('0x4')]=_[_0xe2b1('0x5')](config[_0xe2b1('0x4')],{'host':_0xe2b1('0x6'),'port':0x18eb});var io=require(_0xe2b1('0x7'))(new Redis(config[_0xe2b1('0x4')]));function ChatQueue(_0x29e1e6){this['id']=_0x29e1e6['id']||0x0;this[_0xe2b1('0x8')]=_0x29e1e6[_0xe2b1('0x8')]||'';this[_0xe2b1('0x9')]=_0x29e1e6['timeout']||0xa;this[_0xe2b1('0xa')]=_0x29e1e6[_0xe2b1('0xa')]||_0xe2b1('0xb');this[_0xe2b1('0xc')]=_0x29e1e6['Agents'];this[_0xe2b1('0xd')]={};this[_0xe2b1('0xe')]=0x0;this[_0xe2b1('0x1')]='';this['updateRouting']();this[_0xe2b1('0xf')]();}ChatQueue[_0xe2b1('0x10')][_0xe2b1('0x11')]=function(){var _0x4ad241=this[_0xe2b1('0xd')]['_rr'];this[_0xe2b1('0xd')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xe2b1('0x12')]=_0x4ad241;};ChatQueue[_0xe2b1('0x10')][_0xe2b1('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4de6c3=0x0;_0x4de6c3=0x0?this['available']:0x0;var _0x191346={'id':this['id'],'available':this[_0xe2b1('0x17')],'loggedIn':this[_0xe2b1('0x15')],'name':this[_0xe2b1('0x8')],'paused':this[_0xe2b1('0x18')],'waiting':this[_0xe2b1('0xe')]};var _0x54cf36=md5(JSON[_0xe2b1('0x19')](_0x191346));if(this['md5']!==_0x54cf36){this[_0xe2b1('0x1')]=_0x54cf36;io['to'](util[_0xe2b1('0x1a')]('chat:queue:%s',_0x191346[_0xe2b1('0x8')]))[_0xe2b1('0x1b')](_0xe2b1('0x1c'),_0x191346);}};module[_0xe2b1('0x1d')]=ChatQueue; \ No newline at end of file +var _0x43c9=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','paused','online','loggedIn','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x4f304e,_0x2d64b7){var _0x202b08=function(_0x27d3e1){while(--_0x27d3e1){_0x4f304e['push'](_0x4f304e['shift']());}};_0x202b08(++_0x2d64b7);}(_0x43c9,0x182));var _0x943c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x43c9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x943c('0x0'));var md5=require(_0x943c('0x1'));var util=require(_0x943c('0x2'));var Redis=require(_0x943c('0x3'));var config=require(_0x943c('0x4'));config[_0x943c('0x5')]=_['defaults'](config[_0x943c('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x943c('0x6'))(new Redis(config[_0x943c('0x5')]));function ChatQueue(_0x47a428){this['id']=_0x47a428['id']||0x0;this[_0x943c('0x7')]=_0x47a428['name']||'';this[_0x943c('0x8')]=_0x47a428[_0x943c('0x8')]||0xa;this['strategy']=_0x47a428[_0x943c('0x9')]||_0x943c('0xa');this[_0x943c('0xb')]=_0x47a428[_0x943c('0xb')];this[_0x943c('0xc')]={};this[_0x943c('0xd')]=0x0;this[_0x943c('0x1')]='';this[_0x943c('0xe')]();this['updateRealtime']();}ChatQueue[_0x943c('0xf')][_0x943c('0xe')]=function(){var _0x2914f8=this['mapAgentsId'][_0x943c('0x10')];this['mapAgentsId']=_[_0x943c('0x11')](this['Agents'],'id');this[_0x943c('0xc')][_0x943c('0x10')]=_0x2914f8;};ChatQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x943c('0x12')]=0x0;for(var _0x5a46de=0x0;_0x5a46de=0x0?this[_0x943c('0x15')]:0x0;var _0x186940={'id':this['id'],'available':this[_0x943c('0x15')],'loggedIn':this[_0x943c('0x14')],'name':this[_0x943c('0x7')],'paused':this[_0x943c('0x12')],'waiting':this[_0x943c('0xd')]};var _0x33a5a8=md5(JSON[_0x943c('0x16')](_0x186940));if(this[_0x943c('0x1')]!==_0x33a5a8){this[_0x943c('0x1')]=_0x33a5a8;io['to'](util[_0x943c('0x17')](_0x943c('0x18'),_0x186940['name']))[_0x943c('0x19')](_0x943c('0x1a'),_0x186940);}};module[_0x943c('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index a785167..63356e1 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 _0x74b8=['Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','online','faxPause','available','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x74b8,0x10c));var _0x874b=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x74b8[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x874b('0x0'));var md5=require(_0x874b('0x1'));var util=require(_0x874b('0x2'));var Redis=require(_0x874b('0x3'));var config=require(_0x874b('0x4'));config[_0x874b('0x5')]=_[_0x874b('0x6')](config[_0x874b('0x5')],{'host':_0x874b('0x7'),'port':0x18eb});var io=require(_0x874b('0x8'))(new Redis(config['redis']));function FaxQueue(_0x477fda){this['id']=_0x477fda['id']||0x0;this[_0x874b('0x9')]=_0x477fda[_0x874b('0x9')]||'';this[_0x874b('0xa')]=_0x477fda[_0x874b('0xa')]||0xa;this['strategy']=_0x477fda[_0x874b('0xb')]||'beepall';this[_0x874b('0xc')]=_0x477fda[_0x874b('0xc')];this[_0x874b('0xd')]={};this[_0x874b('0xe')]=0x0;this[_0x874b('0x1')]='';this[_0x874b('0xf')]();this['updateRealtime']();}FaxQueue[_0x874b('0x10')][_0x874b('0xf')]=function(){var _0x11c413=this[_0x874b('0xd')]['_rr'];this[_0x874b('0xd')]=_['map'](this[_0x874b('0xc')],'id');this[_0x874b('0xd')][_0x874b('0x11')]=_0x11c413;};FaxQueue[_0x874b('0x10')][_0x874b('0x12')]=function(){this[_0x874b('0x13')]=0x0;this[_0x874b('0x14')]=0x0;for(var _0x2e9508=0x0;_0x2e9508=0x0?this[_0x874b('0x17')]:0x0;var _0x3fedf3={'id':this['id'],'available':this[_0x874b('0x17')],'loggedIn':this[_0x874b('0x13')],'name':this[_0x874b('0x9')],'paused':this[_0x874b('0x14')],'waiting':this['waiting']};var _0x7b2d30=md5(JSON['stringify'](_0x3fedf3));if(this[_0x874b('0x1')]!==_0x7b2d30){this['md5']=_0x7b2d30;io['to'](util[_0x874b('0x18')](_0x874b('0x19'),_0x3fedf3[_0x874b('0x9')]))['emit'](_0x874b('0x1a'),_0x3fedf3);}};module[_0x874b('0x1b')]=FaxQueue; \ No newline at end of file +var _0xd0e6=['updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','faxPause','available','waiting','stringify','emit','exports','lodash','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','md5'];(function(_0x12c280,_0x51dd07){var _0x3638d3=function(_0x53b273){while(--_0x53b273){_0x12c280['push'](_0x12c280['shift']());}};_0x3638d3(++_0x51dd07);}(_0xd0e6,0x196));var _0x6d0e=function(_0x32349f,_0x30fd65){_0x32349f=_0x32349f-0x0;var _0x2209ae=_0xd0e6[_0x32349f];return _0x2209ae;};'use strict';var _=require(_0x6d0e('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x6d0e('0x1'));config[_0x6d0e('0x2')]=_[_0x6d0e('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6d0e('0x4'))(new Redis(config[_0x6d0e('0x2')]));function FaxQueue(_0x206fba){this['id']=_0x206fba['id']||0x0;this[_0x6d0e('0x5')]=_0x206fba['name']||'';this['timeout']=_0x206fba[_0x6d0e('0x6')]||0xa;this[_0x6d0e('0x7')]=_0x206fba[_0x6d0e('0x7')]||'beepall';this[_0x6d0e('0x8')]=_0x206fba[_0x6d0e('0x8')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x6d0e('0x9')]='';this[_0x6d0e('0xa')]();this[_0x6d0e('0xb')]();}FaxQueue[_0x6d0e('0xc')][_0x6d0e('0xa')]=function(){var _0x54953c=this[_0x6d0e('0xd')]['_rr'];this['mapAgentsId']=_[_0x6d0e('0xe')](this[_0x6d0e('0x8')],'id');this[_0x6d0e('0xd')][_0x6d0e('0xf')]=_0x54953c;};FaxQueue[_0x6d0e('0xc')]['updateRealtime']=function(){this[_0x6d0e('0x10')]=0x0;this[_0x6d0e('0x11')]=0x0;for(var _0x49672f=0x0;_0x49672f=0x0?this[_0x6d0e('0x15')]:0x0;var _0x1bfe42={'id':this['id'],'available':this[_0x6d0e('0x15')],'loggedIn':this[_0x6d0e('0x10')],'name':this[_0x6d0e('0x5')],'paused':this[_0x6d0e('0x11')],'waiting':this[_0x6d0e('0x16')]};var _0x219413=md5(JSON[_0x6d0e('0x17')](_0x1bfe42));if(this[_0x6d0e('0x9')]!==_0x219413){this['md5']=_0x219413;io['to'](util['format']('fax:queue:%s',_0x1bfe42[_0x6d0e('0x5')]))[_0x6d0e('0x18')]('fax_queue:save',_0x1bfe42);}};module[_0x6d0e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 91be9fe..740e350 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 _0x6d26=['name','Intervals'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6d26,0x158));var _0x66d2=function(_0x19a690,_0x5b777a){_0x19a690=_0x19a690-0x0;var _0x1ebdca=_0x6d26[_0x19a690];return _0x1ebdca;};'use strict';function Interval(_0x3c77ee){this['id']=_0x3c77ee['id']||0x0;this[_0x66d2('0x0')]=_0x3c77ee['name']||'';this[_0x66d2('0x1')]=_0x3c77ee['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x0102=['name','Intervals','exports'];(function(_0x57866b,_0x24785f){var _0x527705=function(_0x40a8a7){while(--_0x40a8a7){_0x57866b['push'](_0x57866b['shift']());}};_0x527705(++_0x24785f);}(_0x0102,0xf3));var _0x2010=function(_0x70d595,_0x58172d){_0x70d595=_0x70d595-0x0;var _0x2003e1=_0x0102[_0x70d595];return _0x2003e1;};'use strict';function Interval(_0x283522){this['id']=_0x283522['id']||0x0;this[_0x2010('0x0')]=_0x283522[_0x2010('0x0')]||'';this[_0x2010('0x1')]=_0x283522[_0x2010('0x1')]||{};}module[_0x2010('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index ed5d58e..cc769ae 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 _0x00a7=['redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','online','paused','available','stringify','format','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment'];(function(_0x52496c,_0x2010c0){var _0x1f4c03=function(_0x32b818){while(--_0x32b818){_0x52496c['push'](_0x52496c['shift']());}};_0x1f4c03(++_0x2010c0);}(_0x00a7,0x168));var _0x700a=function(_0x2895da,_0x427533){_0x2895da=_0x2895da-0x0;var _0x3b1f97=_0x00a7[_0x2895da];return _0x3b1f97;};'use strict';var _=require('lodash');var md5=require(_0x700a('0x0'));var util=require(_0x700a('0x1'));var Redis=require(_0x700a('0x2'));var config=require(_0x700a('0x3'));config[_0x700a('0x4')]=_[_0x700a('0x5')](config[_0x700a('0x4')],{'host':_0x700a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x25d2e0){this['id']=_0x25d2e0['id']||0x0;this['name']=_0x25d2e0[_0x700a('0x7')]||'';this['timeout']=_0x25d2e0[_0x700a('0x8')]||0xa;this['strategy']=_0x25d2e0[_0x700a('0x9')]||_0x700a('0xa');this[_0x700a('0xb')]=_0x25d2e0[_0x700a('0xb')];this[_0x700a('0xc')]={};this[_0x700a('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x700a('0xe')]();}MailQueue[_0x700a('0xf')][_0x700a('0x10')]=function(){var _0x35502d=this[_0x700a('0xc')][_0x700a('0x11')];this['mapAgentsId']=_[_0x700a('0x12')](this[_0x700a('0xb')],'id');this[_0x700a('0xc')][_0x700a('0x11')]=_0x35502d;};MailQueue[_0x700a('0xf')][_0x700a('0xe')]=function(){this[_0x700a('0x13')]=0x0;this['paused']=0x0;for(var _0x59af84=0x0;_0x59af84=0x0?this[_0x700a('0x16')]:0x0;var _0x10dffb={'id':this['id'],'available':this[_0x700a('0x16')],'loggedIn':this[_0x700a('0x13')],'name':this[_0x700a('0x7')],'paused':this[_0x700a('0x15')],'waiting':this[_0x700a('0xd')]};var _0xc69782=md5(JSON[_0x700a('0x17')](_0x10dffb));if(this[_0x700a('0x0')]!==_0xc69782){this[_0x700a('0x0')]=_0xc69782;io['to'](util[_0x700a('0x18')]('mail:queue:%s',_0x10dffb[_0x700a('0x7')]))[_0x700a('0x19')](_0x700a('0x1a'),_0x10dffb);}};module[_0x700a('0x1b')]=MailQueue; \ No newline at end of file +var _0x1053=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x3ca829,_0xc55f17){var _0x3b416b=function(_0x592aae){while(--_0x592aae){_0x3ca829['push'](_0x3ca829['shift']());}};_0x3b416b(++_0xc55f17);}(_0x1053,0x144));var _0x3105=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x1053[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0x3105('0x0'));var md5=require(_0x3105('0x1'));var util=require(_0x3105('0x2'));var Redis=require(_0x3105('0x3'));var config=require(_0x3105('0x4'));config[_0x3105('0x5')]=_['defaults'](config[_0x3105('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3105('0x6'))(new Redis(config[_0x3105('0x5')]));function MailQueue(_0x13f534){this['id']=_0x13f534['id']||0x0;this['name']=_0x13f534[_0x3105('0x7')]||'';this[_0x3105('0x8')]=_0x13f534['timeout']||0xa;this[_0x3105('0x9')]=_0x13f534['strategy']||_0x3105('0xa');this['Agents']=_0x13f534[_0x3105('0xb')];this[_0x3105('0xc')]={};this[_0x3105('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x3105('0xe')]();}MailQueue['prototype'][_0x3105('0xf')]=function(){var _0x44b692=this[_0x3105('0xc')][_0x3105('0x10')];this[_0x3105('0xc')]=_[_0x3105('0x11')](this['Agents'],'id');this[_0x3105('0xc')][_0x3105('0x10')]=_0x44b692;};MailQueue['prototype'][_0x3105('0xe')]=function(){this[_0x3105('0x12')]=0x0;this[_0x3105('0x13')]=0x0;for(var _0xc3ec9a=0x0;_0xc3ec9a=0x0?this[_0x3105('0x17')]:0x0;var _0x2c7d71={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3105('0x12')],'name':this[_0x3105('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x45613a=md5(JSON[_0x3105('0x18')](_0x2c7d71));if(this[_0x3105('0x1')]!==_0x45613a){this[_0x3105('0x1')]=_0x45613a;io['to'](util[_0x3105('0x19')](_0x3105('0x1a'),_0x2c7d71[_0x3105('0x7')]))[_0x3105('0x1b')](_0x3105('0x1c'),_0x2c7d71);}};module[_0x3105('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 886455b..659ca90 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x1261,0x144));var _0x1126=function(_0x342696,_0x146f50){_0x342696=_0x342696-0x0;var _0x15b8e4=_0x1261[_0x342696];return _0x15b8e4;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x2ef3,0xba));var _0x32ef=function(_0x232a63,_0x59d832){_0x232a63=_0x232a63-0x0;var _0x4991aa=_0x2ef3[_0x232a63];return _0x4991aa;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ff72f1a..33397a7 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 _0x6c32=['loggedIn','paused','online','smsPause','available','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype'];(function(_0x6f211e,_0x305987){var _0x3f28ea=function(_0x40cd7d){while(--_0x40cd7d){_0x6f211e['push'](_0x6f211e['shift']());}};_0x3f28ea(++_0x305987);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var md5=require(_0x26c3('0x1'));var util=require(_0x26c3('0x2'));var Redis=require(_0x26c3('0x3'));var config=require(_0x26c3('0x4'));config[_0x26c3('0x5')]=_[_0x26c3('0x6')](config[_0x26c3('0x5')],{'host':_0x26c3('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x26c3('0x5')]));function SmsQueue(_0x3f7065){this['id']=_0x3f7065['id']||0x0;this[_0x26c3('0x8')]=_0x3f7065['name']||'';this[_0x26c3('0x9')]=_0x3f7065['timeout']||0xa;this[_0x26c3('0xa')]=_0x3f7065[_0x26c3('0xa')]||_0x26c3('0xb');this[_0x26c3('0xc')]=_0x3f7065[_0x26c3('0xc')];this[_0x26c3('0xd')]={};this[_0x26c3('0xe')]=0x0;this[_0x26c3('0x1')]='';this[_0x26c3('0xf')]();this[_0x26c3('0x10')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x4aa8e2=this['mapAgentsId'][_0x26c3('0x11')];this[_0x26c3('0xd')]=_[_0x26c3('0x12')](this[_0x26c3('0xc')],'id');this['mapAgentsId']['_rr']=_0x4aa8e2;};SmsQueue[_0x26c3('0x13')][_0x26c3('0x10')]=function(){this[_0x26c3('0x14')]=0x0;this[_0x26c3('0x15')]=0x0;for(var _0x17c399=0x0;_0x17c399=0x0?this[_0x26c3('0x18')]:0x0;var _0x50a3e5={'id':this['id'],'available':this[_0x26c3('0x18')],'loggedIn':this[_0x26c3('0x14')],'name':this[_0x26c3('0x8')],'paused':this[_0x26c3('0x15')],'waiting':this[_0x26c3('0xe')]};var _0x497441=md5(JSON['stringify'](_0x50a3e5));if(this[_0x26c3('0x1')]!==_0x497441){this[_0x26c3('0x1')]=_0x497441;io['to'](util['format']('sms:queue:%s',_0x50a3e5[_0x26c3('0x8')]))['emit']('sms_queue:save',_0x50a3e5);}};module[_0x26c3('0x19')]=SmsQueue; \ No newline at end of file +var _0x1782=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','available','stringify','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents'];(function(_0x530151,_0x27ab6d){var _0x129774=function(_0x57f945){while(--_0x57f945){_0x530151['push'](_0x530151['shift']());}};_0x129774(++_0x27ab6d);}(_0x1782,0x13e));var _0x2178=function(_0x1c50d9,_0x530bbe){_0x1c50d9=_0x1c50d9-0x0;var _0x142649=_0x1782[_0x1c50d9];return _0x142649;};'use strict';var _=require(_0x2178('0x0'));var md5=require('md5');var util=require(_0x2178('0x1'));var Redis=require(_0x2178('0x2'));var config=require(_0x2178('0x3'));config[_0x2178('0x4')]=_[_0x2178('0x5')](config['redis'],{'host':_0x2178('0x6'),'port':0x18eb});var io=require(_0x2178('0x7'))(new Redis(config['redis']));function SmsQueue(_0x59ebf6){this['id']=_0x59ebf6['id']||0x0;this[_0x2178('0x8')]=_0x59ebf6[_0x2178('0x8')]||'';this['timeout']=_0x59ebf6['timeout']||0xa;this['strategy']=_0x59ebf6[_0x2178('0x9')]||_0x2178('0xa');this[_0x2178('0xb')]=_0x59ebf6[_0x2178('0xb')];this[_0x2178('0xc')]={};this[_0x2178('0xd')]=0x0;this['md5']='';this[_0x2178('0xe')]();this[_0x2178('0xf')]();}SmsQueue[_0x2178('0x10')][_0x2178('0xe')]=function(){var _0x46db79=this[_0x2178('0xc')][_0x2178('0x11')];this[_0x2178('0xc')]=_[_0x2178('0x12')](this[_0x2178('0xb')],'id');this['mapAgentsId'][_0x2178('0x11')]=_0x46db79;};SmsQueue[_0x2178('0x10')]['updateRealtime']=function(){this[_0x2178('0x13')]=0x0;this[_0x2178('0x14')]=0x0;for(var _0x32f65c=0x0;_0x32f65c=0x0?this['available']:0x0;var _0x3d7e36={'id':this['id'],'available':this[_0x2178('0x16')],'loggedIn':this[_0x2178('0x13')],'name':this[_0x2178('0x8')],'paused':this[_0x2178('0x14')],'waiting':this[_0x2178('0xd')]};var _0x23f84d=md5(JSON[_0x2178('0x17')](_0x3d7e36));if(this[_0x2178('0x18')]!==_0x23f84d){this[_0x2178('0x18')]=_0x23f84d;io['to'](util[_0x2178('0x19')](_0x2178('0x1a'),_0x3d7e36['name']))[_0x2178('0x1b')](_0x2178('0x1c'),_0x3d7e36);}};module[_0x2178('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 13f7d49..97057a6 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 _0x3302=['waiting','stringify','whatsapp:queue:%s','emit','exports','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','whatsappPause','available'];(function(_0xd2055a,_0x121ffd){var _0x429d1a=function(_0x5c838b){while(--_0x5c838b){_0xd2055a['push'](_0xd2055a['shift']());}};_0x429d1a(++_0x121ffd);}(_0x3302,0x149));var _0x2330=function(_0x5e4a4c,_0x1b8d7e){_0x5e4a4c=_0x5e4a4c-0x0;var _0x1afefb=_0x3302[_0x5e4a4c];return _0x1afefb;};'use strict';var _=require('lodash');var md5=require(_0x2330('0x0'));var util=require(_0x2330('0x1'));var Redis=require('ioredis');var config=require(_0x2330('0x2'));config[_0x2330('0x3')]=_[_0x2330('0x4')](config[_0x2330('0x3')],{'host':_0x2330('0x5'),'port':0x18eb});var io=require(_0x2330('0x6'))(new Redis(config[_0x2330('0x3')]));function WhatsappQueue(_0x282680){this['id']=_0x282680['id']||0x0;this[_0x2330('0x7')]=_0x282680[_0x2330('0x7')]||'';this[_0x2330('0x8')]=_0x282680[_0x2330('0x8')]||0xa;this[_0x2330('0x9')]=_0x282680[_0x2330('0x9')]||_0x2330('0xa');this[_0x2330('0xb')]=_0x282680[_0x2330('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x2330('0x0')]='';this['updateRouting']();this[_0x2330('0xc')]();}WhatsappQueue[_0x2330('0xd')]['updateRouting']=function(){var _0x1f1c68=this[_0x2330('0xe')][_0x2330('0xf')];this[_0x2330('0xe')]=_['map'](this['Agents'],'id');this[_0x2330('0xe')][_0x2330('0xf')]=_0x1f1c68;};WhatsappQueue[_0x2330('0xd')]['updateRealtime']=function(){this[_0x2330('0x10')]=0x0;this[_0x2330('0x11')]=0x0;for(var _0x990359=0x0;_0x990359=0x0?this[_0x2330('0x15')]:0x0;var _0x5d097d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2330('0x10')],'name':this[_0x2330('0x7')],'paused':this[_0x2330('0x11')],'waiting':this[_0x2330('0x16')]};var _0x2691e7=md5(JSON[_0x2330('0x17')](_0x5d097d));if(this['md5']!==_0x2691e7){this[_0x2330('0x0')]=_0x2691e7;io['to'](util['format'](_0x2330('0x18'),_0x5d097d[_0x2330('0x7')]))[_0x2330('0x19')]('whatsapp_queue:save',_0x5d097d);}};module[_0x2330('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xe200=['paused','online','loggedIn','whatsappPause','available','format','emit','lodash','md5','util','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x222043,_0x309dd1){var _0x4cfea6=function(_0x3ac483){while(--_0x3ac483){_0x222043['push'](_0x222043['shift']());}};_0x4cfea6(++_0x309dd1);}(_0xe200,0x18d));var _0x0e20=function(_0x2c8109,_0x51a8bc){_0x2c8109=_0x2c8109-0x0;var _0x191384=_0xe200[_0x2c8109];return _0x191384;};'use strict';var _=require(_0x0e20('0x0'));var md5=require(_0x0e20('0x1'));var util=require(_0x0e20('0x2'));var Redis=require(_0x0e20('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x0e20('0x4')](config[_0x0e20('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0e20('0x6'))(new Redis(config[_0x0e20('0x5')]));function WhatsappQueue(_0x6295da){this['id']=_0x6295da['id']||0x0;this[_0x0e20('0x7')]=_0x6295da['name']||'';this[_0x0e20('0x8')]=_0x6295da[_0x0e20('0x8')]||0xa;this['strategy']=_0x6295da[_0x0e20('0x9')]||_0x0e20('0xa');this[_0x0e20('0xb')]=_0x6295da['Agents'];this[_0x0e20('0xc')]={};this[_0x0e20('0xd')]=0x0;this[_0x0e20('0x1')]='';this[_0x0e20('0xe')]();this[_0x0e20('0xf')]();}WhatsappQueue[_0x0e20('0x10')][_0x0e20('0xe')]=function(){var _0x6eb4e=this[_0x0e20('0xc')][_0x0e20('0x11')];this['mapAgentsId']=_[_0x0e20('0x12')](this['Agents'],'id');this[_0x0e20('0xc')]['_rr']=_0x6eb4e;};WhatsappQueue[_0x0e20('0x10')][_0x0e20('0xf')]=function(){this['loggedIn']=0x0;this[_0x0e20('0x13')]=0x0;for(var _0x319ce1=0x0;_0x319ce1=0x0?this[_0x0e20('0x17')]:0x0;var _0x3d4e7a={'id':this['id'],'available':this[_0x0e20('0x17')],'loggedIn':this[_0x0e20('0x15')],'name':this[_0x0e20('0x7')],'paused':this[_0x0e20('0x13')],'waiting':this[_0x0e20('0xd')]};var _0x36a591=md5(JSON['stringify'](_0x3d4e7a));if(this[_0x0e20('0x1')]!==_0x36a591){this[_0x0e20('0x1')]=_0x36a591;io['to'](util[_0x0e20('0x18')]('whatsapp:queue:%s',_0x3d4e7a['name']))[_0x0e20('0x19')]('whatsapp_queue:save',_0x3d4e7a);}};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 1f47805..51d6cfd 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0x66ba0d,_0x89a235){var _0x4dedc6=function(_0x3a578f){while(--_0x3a578f){_0x66ba0d['push'](_0x66ba0d['shift']());}};_0x4dedc6(++_0x89a235);}(_0xb10b,0x12a));var _0xbb10=function(_0x493df0,_0x3808fe){_0x493df0=_0x493df0-0x0;var _0x4b6a03=_0xb10b[_0x493df0];return _0x4b6a03;};'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 cca4786..0d66668 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 _0xc1d7=['addTags','Request','AddTagsToChatInteraction','../client','update','updateChatInteraction'];(function(_0x58fa16,_0x2f1c6d){var _0x193736=function(_0x3d58f7){while(--_0x3d58f7){_0x58fa16['push'](_0x58fa16['shift']());}};_0x193736(++_0x2f1c6d);}(_0xc1d7,0x69));var _0x7c1d=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0xc1d7[_0x2d72ab];return _0x256423;};'use strict';var client=require(_0x7c1d('0x0'));exports[_0x7c1d('0x1')]=function(_0x1c2de4,_0x39b5e8){return client['Request']('UpdateChatInteraction',{'body':_0x39b5e8,'options':{'where':{'id':_0x1c2de4}},'log':_0x7c1d('0x2')});};exports[_0x7c1d('0x3')]=function(_0x5cdd38,_0x41345e){return client[_0x7c1d('0x4')](_0x7c1d('0x5'),{'body':_0x41345e,'options':{'where':{'id':_0x5cdd38}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xfd57=['AddTagsToChatInteraction','addTagsToChatInteraction','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x1ca59f,_0x1a5cd7){var _0x2f3153=function(_0xcd56ca){while(--_0xcd56ca){_0x1ca59f['push'](_0x1ca59f['shift']());}};_0x2f3153(++_0x1a5cd7);}(_0xfd57,0x1ce));var _0x7fd5=function(_0x374a15,_0x32bda8){_0x374a15=_0x374a15-0x0;var _0x18c6db=_0xfd57[_0x374a15];return _0x18c6db;};'use strict';var client=require('../client');exports['update']=function(_0x55d2d7,_0xb65898){return client['Request'](_0x7fd5('0x0'),{'body':_0xb65898,'options':{'where':{'id':_0x55d2d7}},'log':_0x7fd5('0x1')});};exports[_0x7fd5('0x2')]=function(_0x3394f4,_0x34cc3e){return client['Request'](_0x7fd5('0x3'),{'body':_0x34cc3e,'options':{'where':{'id':_0x3394f4}},'log':_0x7fd5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 463a200..5c1e9d7 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 _0xf75b=['createChatMessage','Request','CreateChatMessage'];(function(_0x51cc37,_0x298fa9){var _0x4648f0=function(_0x4faf8a){while(--_0x4faf8a){_0x51cc37['push'](_0x51cc37['shift']());}};_0x4648f0(++_0x298fa9);}(_0xf75b,0x1e1));var _0xbf75=function(_0x2f5eff,_0x1a2508){_0x2f5eff=_0x2f5eff-0x0;var _0x28fa46=_0xf75b[_0x2f5eff];return _0x28fa46;};'use strict';var client=require('../client');exports['create']=function(_0x211b4b){return client[_0xbf75('0x0')](_0xbf75('0x1'),{'body':_0x211b4b,'log':_0xbf75('0x2')});}; \ No newline at end of file +var _0x7dc1=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x1d3c53,_0x9adff2){var _0x56013b=function(_0x51002a){while(--_0x51002a){_0x1d3c53['push'](_0x1d3c53['shift']());}};_0x56013b(++_0x9adff2);}(_0x7dc1,0xec));var _0x17dc=function(_0x3bf3d3,_0x3c0d9d){_0x3bf3d3=_0x3bf3d3-0x0;var _0x2eedf1=_0x7dc1[_0x3bf3d3];return _0x2eedf1;};'use strict';var client=require(_0x17dc('0x0'));exports[_0x17dc('0x1')]=function(_0x254878){return client['Request'](_0x17dc('0x2'),{'body':_0x254878,'log':_0x17dc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a8f7cf6..24bc787 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 _0x7f90=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','User','Agents','online'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x7f90,0xf4));var _0x07f9=function(_0x5b7e57,_0xc38d2a){_0x5b7e57=_0x5b7e57-0x0;var _0x5bfd74=_0x7f90[_0x5b7e57];return _0x5bfd74;};'use strict';var client=require(_0x07f9('0x0'));exports[_0x07f9('0x1')]=function(){return function(){return client[_0x07f9('0x2')](_0x07f9('0x3'),{'options':{'raw':![],'attributes':['id',_0x07f9('0x4'),'timeout','strategy'],'include':[{'model':_0x07f9('0x5'),'as':_0x07f9('0x6'),'attributes':['id','name',_0x07f9('0x7'),_0x07f9('0x8')]}]},'log':_0x07f9('0x1')});};}; \ No newline at end of file +var _0x50d0=['name','timeout','strategy','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x5670a0,_0x1319be){var _0x181895=function(_0x193bea){while(--_0x193bea){_0x5670a0['push'](_0x5670a0['shift']());}};_0x181895(++_0x1319be);}(_0x50d0,0x101));var _0x050d=function(_0x337224,_0x42dad9){_0x337224=_0x337224-0x0;var _0x2f99f6=_0x50d0[_0x337224];return _0x2f99f6;};'use strict';var client=require(_0x050d('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x050d('0x1')](_0x050d('0x2'),{'options':{'raw':![],'attributes':['id',_0x050d('0x3'),_0x050d('0x4'),_0x050d('0x5')],'include':[{'model':'User','as':_0x050d('0x6'),'attributes':['id',_0x050d('0x3'),_0x050d('0x7'),_0x050d('0x8')]}]},'log':_0x050d('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 9fbaa4b..9ae1771 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 _0x47c7=['DESC','../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x24e0c9,_0x284109){var _0x4448f0=function(_0x576980){while(--_0x576980){_0x24e0c9['push'](_0x24e0c9['shift']());}};_0x4448f0(++_0x284109);}(_0x47c7,0x1ab));var _0x747c=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x47c7[_0x3c504b];return _0x2e5354;};'use strict';var client=require(_0x747c('0x0'));exports['create']=function(_0x1e4b3d){return client[_0x747c('0x1')]('CreateChatQueueReport',{'body':_0x1e4b3d,'log':_0x747c('0x2')});};exports[_0x747c('0x3')]=function(_0x51f4bc,_0x3313cd){return client[_0x747c('0x1')](_0x747c('0x4'),{'body':_0x3313cd,'options':{'where':{'uniqueid':_0x51f4bc},'order':[['id',_0x747c('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xa9e0=['Request','UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport'];(function(_0x1818da,_0x10805e){var _0x14b71d=function(_0x3ccac9){while(--_0x3ccac9){_0x1818da['push'](_0x1818da['shift']());}};_0x14b71d(++_0x10805e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return client['Request']('CreateChatQueueReport',{'body':_0x29929c,'log':_0x0a9e('0x2')});};exports['update']=function(_0x333808,_0x432180){return client[_0x0a9e('0x3')](_0x0a9e('0x4'),{'body':_0x432180,'options':{'where':{'uniqueid':_0x333808},'order':[['id',_0x0a9e('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 4649bfc..60a709f 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x44d19b,_0x4ad6ea){var _0x5e42e6=function(_0x4d9430){while(--_0x4d9430){_0x44d19b['push'](_0x44d19b['shift']());}};_0x5e42e6(++_0x4ad6ea);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x7a54,0x106));var _0x47a5=function(_0x1dd22d,_0x1edc54){_0x1dd22d=_0x1dd22d-0x0;var _0x2c7bad=_0x7a54[_0x1dd22d];return _0x2c7bad;};'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 27200be..a8aeeb4 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 _0xd7f8=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x5c8b25,_0x57f3a7){var _0x5f2f79=function(_0x567a5b){while(--_0x567a5b){_0x5c8b25['push'](_0x5c8b25['shift']());}};_0x5f2f79(++_0x57f3a7);}(_0xd7f8,0x109));var _0x8d7f=function(_0xbad150,_0x2ff29d){_0xbad150=_0xbad150-0x0;var _0xa8a34=_0xd7f8[_0xbad150];return _0xa8a34;};'use strict';var client=require(_0x8d7f('0x0'));exports[_0x8d7f('0x1')]=function(_0x15cf39){return client[_0x8d7f('0x2')](_0x8d7f('0x3'),{'body':_0x15cf39,'log':_0x8d7f('0x4')});}; \ No newline at end of file +var _0x83da=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x42c8ea,_0x29e167){var _0x4306e5=function(_0x48f8ef){while(--_0x48f8ef){_0x42c8ea['push'](_0x42c8ea['shift']());}};_0x4306e5(++_0x29e167);}(_0x83da,0xb9));var _0xa83d=function(_0x2d8c04,_0x551b0d){_0x2d8c04=_0x2d8c04-0x0;var _0x214e25=_0x83da[_0x2d8c04];return _0x214e25;};'use strict';var client=require(_0xa83d('0x0'));exports[_0xa83d('0x1')]=function(_0x5103ff){return client[_0xa83d('0x2')](_0xa83d('0x3'),{'body':_0x5103ff,'log':_0xa83d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 003479b..c9921f1 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 _0xdf63=['strategy','User','Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf63,0x181));var _0x3df6=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0xdf63[_0x293e7a];return _0xb78342;};'use strict';var client=require('../client');exports[_0x3df6('0x0')]=function(){return function(){return client[_0x3df6('0x1')](_0x3df6('0x2'),{'options':{'raw':![],'attributes':['id',_0x3df6('0x3'),_0x3df6('0x4'),_0x3df6('0x5')],'include':[{'model':_0x3df6('0x6'),'as':_0x3df6('0x7'),'attributes':['id','name',_0x3df6('0x8'),_0x3df6('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x824d=['Agents','online','faxPause','../client','getFaxQueues','Request','name','timeout','strategy','User'];(function(_0xa2049b,_0x7eeb1e){var _0x2fd615=function(_0x7dbb84){while(--_0x7dbb84){_0xa2049b['push'](_0xa2049b['shift']());}};_0x2fd615(++_0x7eeb1e);}(_0x824d,0x16b));var _0xd824=function(_0xb5202f,_0x4f00ff){_0xb5202f=_0xb5202f-0x0;var _0x5f299c=_0x824d[_0xb5202f];return _0x5f299c;};'use strict';var client=require(_0xd824('0x0'));exports[_0xd824('0x1')]=function(){return function(){return client[_0xd824('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xd824('0x3'),_0xd824('0x4'),_0xd824('0x5')],'include':[{'model':_0xd824('0x6'),'as':_0xd824('0x7'),'attributes':['id',_0xd824('0x3'),_0xd824('0x8'),_0xd824('0x9')]}]},'log':_0xd824('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e3347bf..ba97bfb 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 _0x0976=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x490fce,_0x3e18a8){var _0x158a90=function(_0x1f73b0){while(--_0x1f73b0){_0x490fce['push'](_0x490fce['shift']());}};_0x158a90(++_0x3e18a8);}(_0x0976,0xcd));var _0x6097=function(_0x50003a,_0x3d43d1){_0x50003a=_0x50003a-0x0;var _0x54c194=_0x0976[_0x50003a];return _0x54c194;};'use strict';var client=require(_0x6097('0x0'));exports[_0x6097('0x1')]=function(_0x4dd876){return client[_0x6097('0x2')](_0x6097('0x3'),{'body':_0x4dd876,'log':_0x6097('0x3')});};exports[_0x6097('0x4')]=function(_0x4fee05,_0x5be00a){return client['Request'](_0x6097('0x5'),{'body':_0x5be00a,'options':{'where':{'uniqueid':_0x4fee05},'order':[['id','DESC']],'limit':0x1},'log':_0x6097('0x5')});}; \ No newline at end of file +var _0x633c=['UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport','update'];(function(_0x1338b4,_0x14989e){var _0x93a094=function(_0x202b68){while(--_0x202b68){_0x1338b4['push'](_0x1338b4['shift']());}};_0x93a094(++_0x14989e);}(_0x633c,0xb0));var _0xc633=function(_0x3ea10a,_0x288732){_0x3ea10a=_0x3ea10a-0x0;var _0x38c8bb=_0x633c[_0x3ea10a];return _0x38c8bb;};'use strict';var client=require('../client');exports[_0xc633('0x0')]=function(_0x347ea8){return client[_0xc633('0x1')]('CreateFaxQueueReport',{'body':_0x347ea8,'log':_0xc633('0x2')});};exports[_0xc633('0x3')]=function(_0x13af40,_0x4e1561){return client[_0xc633('0x1')](_0xc633('0x4'),{'body':_0x4e1561,'options':{'where':{'uniqueid':_0x13af40},'order':[['id',_0xc633('0x5')]],'limit':0x1},'log':_0xc633('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 34464bc..816fd6f 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 _0x0cd0=['Intervals','interval','getIntervals','../client','Request','name','Interval'];(function(_0x2ab17c,_0x3b66fa){var _0x5c4fef=function(_0x1f0ad5){while(--_0x1f0ad5){_0x2ab17c['push'](_0x2ab17c['shift']());}};_0x5c4fef(++_0x3b66fa);}(_0x0cd0,0x106));var _0x00cd=function(_0x4c1f8b,_0x38dc29){_0x4c1f8b=_0x4c1f8b-0x0;var _0x522fd4=_0x0cd0[_0x4c1f8b];return _0x522fd4;};'use strict';var client=require(_0x00cd('0x0'));exports['getIntervals']=function(){return function(){return client[_0x00cd('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x00cd('0x2')],'include':[{'model':_0x00cd('0x3'),'as':_0x00cd('0x4'),'attributes':['id',_0x00cd('0x2'),_0x00cd('0x5')]}]},'log':_0x00cd('0x6')});};}; \ No newline at end of file +var _0x295f=['Interval','name','interval','../client','getIntervals','Request'];(function(_0x6ce7fa,_0x222bd9){var _0x55c6a5=function(_0x573c64){while(--_0x573c64){_0x6ce7fa['push'](_0x6ce7fa['shift']());}};_0x55c6a5(++_0x222bd9);}(_0x295f,0xe1));var _0xf295=function(_0x784192,_0x4220e2){_0x784192=_0x784192-0x0;var _0x3bfae2=_0x295f[_0x784192];return _0x3bfae2;};'use strict';var client=require(_0xf295('0x0'));exports[_0xf295('0x1')]=function(){return function(){return client[_0xf295('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xf295('0x3'),'as':'Intervals','attributes':['id',_0xf295('0x4'),_0xf295('0x5')]}]},'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 159846b..7f3205e 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 _0xeb3b=['../client','update','Request','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x236209,_0x32bb45){var _0x27b20c=function(_0x430e33){while(--_0x430e33){_0x236209['push'](_0x236209['shift']());}};_0x27b20c(++_0x32bb45);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x5e8fc,_0x1ccc06){_0x5e8fc=_0x5e8fc-0x0;var _0x41c58c=_0xeb3b[_0x5e8fc];return _0x41c58c;};'use strict';var client=require(_0xbeb3('0x0'));exports[_0xbeb3('0x1')]=function(_0xc5aaa3,_0x33e049){return client[_0xbeb3('0x2')]('UpdateMailInteraction',{'body':_0x33e049,'options':{'where':{'id':_0xc5aaa3}},'log':'updateMailInteraction'});};exports[_0xbeb3('0x3')]=function(_0x5b0e3b,_0x2e8ce3){return client['Request'](_0xbeb3('0x4'),{'body':_0x2e8ce3,'options':{'where':{'id':_0x5b0e3b}},'log':_0xbeb3('0x5')});}; \ No newline at end of file +var _0x1775=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x5f2113,_0xd81baa){var _0x3b6685=function(_0x5f4d31){while(--_0x5f4d31){_0x5f2113['push'](_0x5f2113['shift']());}};_0x3b6685(++_0xd81baa);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x5177('0x0')]=function(_0x26ce12,_0x6abfb8){return client[_0x5177('0x1')](_0x5177('0x2'),{'body':_0x6abfb8,'options':{'where':{'id':_0x26ce12}},'log':_0x5177('0x3')});};exports[_0x5177('0x4')]=function(_0x2027bf,_0x359401){return client[_0x5177('0x1')](_0x5177('0x5'),{'body':_0x359401,'options':{'where':{'id':_0x2027bf}},'log':_0x5177('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b2e85b7..9227e9f 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 _0x9afc=['../client','Request','CreateMailMessage','createMailMessage'];(function(_0x57f3c5,_0x56ca4b){var _0x5af3f0=function(_0xa30d6f){while(--_0xa30d6f){_0x57f3c5['push'](_0x57f3c5['shift']());}};_0x5af3f0(++_0x56ca4b);}(_0x9afc,0x184));var _0xc9af=function(_0x1cd23d,_0xec4ea5){_0x1cd23d=_0x1cd23d-0x0;var _0x5e8ad5=_0x9afc[_0x1cd23d];return _0x5e8ad5;};'use strict';var client=require(_0xc9af('0x0'));exports['create']=function(_0x254126){return client[_0xc9af('0x1')](_0xc9af('0x2'),{'body':_0x254126,'log':_0xc9af('0x3')});}; \ No newline at end of file +var _0x93f9=['Request','CreateMailMessage','../client','create'];(function(_0x581be2,_0x33c20d){var _0x12eecb=function(_0x481ef7){while(--_0x481ef7){_0x581be2['push'](_0x581be2['shift']());}};_0x12eecb(++_0x33c20d);}(_0x93f9,0x13e));var _0x993f=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x93f9[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0x993f('0x0'));exports[_0x993f('0x1')]=function(_0x556621){return client[_0x993f('0x2')](_0x993f('0x3'),{'body':_0x556621,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 65d70db..4391098 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 _0x679d=['getMailQueues','Request','name','strategy','User','online','mailPause','../client'];(function(_0x2949b3,_0x3f7950){var _0x1094e3=function(_0x254a82){while(--_0x254a82){_0x2949b3['push'](_0x2949b3['shift']());}};_0x1094e3(++_0x3f7950);}(_0x679d,0xcf));var _0xd679=function(_0x21d48f,_0x28d44b){_0x21d48f=_0x21d48f-0x0;var _0x5f0127=_0x679d[_0x21d48f];return _0x5f0127;};'use strict';var client=require(_0xd679('0x0'));exports[_0xd679('0x1')]=function(){return function(){return client[_0xd679('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xd679('0x3'),'timeout',_0xd679('0x4')],'include':[{'model':_0xd679('0x5'),'as':'Agents','attributes':['id',_0xd679('0x3'),_0xd679('0x6'),_0xd679('0x7')]}]},'log':_0xd679('0x1')});};}; \ No newline at end of file +var _0xd8e5=['Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','User'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8e5,0xd2));var _0x5d8e=function(_0x4be85d,_0x50d661){_0x4be85d=_0x4be85d-0x0;var _0x3f77ec=_0xd8e5[_0x4be85d];return _0x3f77ec;};'use strict';var client=require(_0x5d8e('0x0'));exports[_0x5d8e('0x1')]=function(){return function(){return client[_0x5d8e('0x2')](_0x5d8e('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5d8e('0x4'),'strategy'],'include':[{'model':_0x5d8e('0x5'),'as':_0x5d8e('0x6'),'attributes':['id','name',_0x5d8e('0x7'),_0x5d8e('0x8')]}]},'log':_0x5d8e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 611e717..3446d11 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 _0x5bb3=['create','CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client'];(function(_0x1a4861,_0x510d80){var _0x55c004=function(_0x5c8dd0){while(--_0x5c8dd0){_0x1a4861['push'](_0x1a4861['shift']());}};_0x55c004(++_0x510d80);}(_0x5bb3,0xc3));var _0x35bb=function(_0x4465f9,_0xaa65b7){_0x4465f9=_0x4465f9-0x0;var _0x4a78ba=_0x5bb3[_0x4465f9];return _0x4a78ba;};'use strict';var client=require(_0x35bb('0x0'));exports[_0x35bb('0x1')]=function(_0x140330){return client['Request'](_0x35bb('0x2'),{'body':_0x140330,'log':_0x35bb('0x2')});};exports[_0x35bb('0x3')]=function(_0x1c173d,_0x424f87){return client[_0x35bb('0x4')](_0x35bb('0x5'),{'body':_0x424f87,'options':{'where':{'uniqueid':_0x1c173d},'order':[['id',_0x35bb('0x6')]],'limit':0x1},'log':_0x35bb('0x5')});}; \ No newline at end of file +var _0x9e6e=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x4be57c,_0x151881){var _0x5901da=function(_0x455972){while(--_0x455972){_0x4be57c['push'](_0x4be57c['shift']());}};_0x5901da(++_0x151881);}(_0x9e6e,0x9e));var _0xe9e6=function(_0x467b55,_0x51cad2){_0x467b55=_0x467b55-0x0;var _0x3ed372=_0x9e6e[_0x467b55];return _0x3ed372;};'use strict';var client=require(_0xe9e6('0x0'));exports[_0xe9e6('0x1')]=function(_0x458181){return client[_0xe9e6('0x2')]('CreateMailQueueReport',{'body':_0x458181,'log':_0xe9e6('0x3')});};exports['update']=function(_0xdfa1c,_0x42bb02){return client[_0xe9e6('0x2')](_0xe9e6('0x4'),{'body':_0x42bb02,'options':{'where':{'uniqueid':_0xdfa1c},'order':[['id',_0xe9e6('0x5')]],'limit':0x1},'log':_0xe9e6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e078117..ad0c566 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 _0xb07a=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','Request','UpdateOpenchannelInteraction'];(function(_0x2ec886,_0xc57a39){var _0x3387bd=function(_0x391590){while(--_0x391590){_0x2ec886['push'](_0x2ec886['shift']());}};_0x3387bd(++_0xc57a39);}(_0xb07a,0x120));var _0xab07=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0xb07a[_0xa3400];return _0x33dba2;};'use strict';var client=require('../client');exports['update']=function(_0x42bf21,_0x50a798){return client[_0xab07('0x0')](_0xab07('0x1'),{'body':_0x50a798,'options':{'where':{'id':_0x42bf21}},'log':_0xab07('0x2')});};exports['addTags']=function(_0x2ea5c3,_0x4104b1){return client['Request'](_0xab07('0x3'),{'body':_0x4104b1,'options':{'where':{'id':_0x2ea5c3}},'log':_0xab07('0x4')});}; \ No newline at end of file +var _0x0a6b=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x5381ef,_0x3d16f0){var _0x9b790e=function(_0x18c1ad){while(--_0x18c1ad){_0x5381ef['push'](_0x5381ef['shift']());}};_0x9b790e(++_0x3d16f0);}(_0x0a6b,0x168));var _0xb0a6=function(_0x1f848e,_0x2aff9c){_0x1f848e=_0x1f848e-0x0;var _0x1b592b=_0x0a6b[_0x1f848e];return _0x1b592b;};'use strict';var client=require('../client');exports[_0xb0a6('0x0')]=function(_0x369673,_0x187a38){return client[_0xb0a6('0x1')](_0xb0a6('0x2'),{'body':_0x187a38,'options':{'where':{'id':_0x369673}},'log':_0xb0a6('0x3')});};exports['addTags']=function(_0x28cb8d,_0x16abb0){return client[_0xb0a6('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x16abb0,'options':{'where':{'id':_0x28cb8d}},'log':_0xb0a6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c4377df..b2904b5 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 _0x7d4c=['createOpenchannelMessage','../client','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7d4c,0x11e));var _0xc7d4=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x7d4c[_0xcaf223];return _0x17e00d;};'use strict';var client=require(_0xc7d4('0x0'));exports[_0xc7d4('0x1')]=function(_0xc6b8bd){return client['Request']('CreateOpenchannelMessage',{'body':_0xc6b8bd,'log':_0xc7d4('0x2')});}; \ No newline at end of file +var _0x127c=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x127c,0x100));var _0xc127=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x127c[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0xc127('0x0'));exports['create']=function(_0x1a3d8c){return client[_0xc127('0x1')](_0xc127('0x2'),{'body':_0x1a3d8c,'log':_0xc127('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 0710a93..daec9fc 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 _0xfc90=['Agents','online','getOpenchannelQueues','GetOpenchannelQueue','name','strategy','User'];(function(_0x4f096e,_0x30d3c3){var _0x4a33ce=function(_0x107ba6){while(--_0x107ba6){_0x4f096e['push'](_0x4f096e['shift']());}};_0x4a33ce(++_0x30d3c3);}(_0xfc90,0xf8));var _0x0fc9=function(_0x3771b5,_0x3e1130){_0x3771b5=_0x3771b5-0x0;var _0x55f532=_0xfc90[_0x3771b5];return _0x55f532;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x0fc9('0x0'),{'options':{'raw':![],'attributes':['id',_0x0fc9('0x1'),'timeout',_0x0fc9('0x2')],'include':[{'model':_0x0fc9('0x3'),'as':_0x0fc9('0x4'),'attributes':['id',_0x0fc9('0x1'),_0x0fc9('0x5'),'openchannelPause']}]},'log':_0x0fc9('0x6')});};}; \ No newline at end of file +var _0x61d4=['strategy','User','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0x61d4,0xbb));var _0x461d=function(_0x1df644,_0x513cd7){_0x1df644=_0x1df644-0x0;var _0x236bdb=_0x61d4[_0x1df644];return _0x236bdb;};'use strict';var client=require('../client');exports[_0x461d('0x0')]=function(){return function(){return client[_0x461d('0x1')](_0x461d('0x2'),{'options':{'raw':![],'attributes':['id',_0x461d('0x3'),_0x461d('0x4'),_0x461d('0x5')],'include':[{'model':_0x461d('0x6'),'as':'Agents','attributes':['id','name','online',_0x461d('0x7')]}]},'log':_0x461d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 760ab5c..7f3bcfb 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 _0x39aa=['UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x39aa,0x11b));var _0xa39a=function(_0x3ba3c0,_0x129464){_0x3ba3c0=_0x3ba3c0-0x0;var _0x574ae9=_0x39aa[_0x3ba3c0];return _0x574ae9;};'use strict';var client=require(_0xa39a('0x0'));exports[_0xa39a('0x1')]=function(_0x5ce203){return client[_0xa39a('0x2')](_0xa39a('0x3'),{'body':_0x5ce203,'log':_0xa39a('0x3')});};exports[_0xa39a('0x4')]=function(_0x46d88f,_0x42be13){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x42be13,'options':{'where':{'uniqueid':_0x46d88f},'order':[['id','DESC']],'limit':0x1},'log':_0xa39a('0x5')});}; \ No newline at end of file +var _0x125f=['Request','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x125f,0x1e4));var _0xf125=function(_0xd482ff,_0x455fce){_0xd482ff=_0xd482ff-0x0;var _0x3c289d=_0x125f[_0xd482ff];return _0x3c289d;};'use strict';var client=require(_0xf125('0x0'));exports['create']=function(_0x565b05){return client[_0xf125('0x1')]('CreateOpenchannelQueueReport',{'body':_0x565b05,'log':'CreateOpenchannelQueueReport'});};exports[_0xf125('0x2')]=function(_0x3358b1,_0x1e2563){return client[_0xf125('0x1')](_0xf125('0x3'),{'body':_0x1e2563,'options':{'where':{'uniqueid':_0x3358b1},'order':[['id',_0xf125('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e6d3031..b4bc9b3 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 _0x379e=['addTags','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x201c34,_0x3ced43){var _0xd87aea=function(_0x1675ee){while(--_0x1675ee){_0x201c34['push'](_0x201c34['shift']());}};_0xd87aea(++_0x3ced43);}(_0x379e,0x104));var _0xe379=function(_0x466801,_0x58417b){_0x466801=_0x466801-0x0;var _0x470ef0=_0x379e[_0x466801];return _0x470ef0;};'use strict';var client=require(_0xe379('0x0'));exports['update']=function(_0x565eb4,_0x4bbe70){return client[_0xe379('0x1')](_0xe379('0x2'),{'body':_0x4bbe70,'options':{'where':{'id':_0x565eb4}},'log':_0xe379('0x3')});};exports[_0xe379('0x4')]=function(_0x3db31a,_0x475418){return client[_0xe379('0x1')]('AddTagsToSmsInteraction',{'body':_0x475418,'options':{'where':{'id':_0x3db31a}},'log':_0xe379('0x5')});}; \ No newline at end of file +var _0x6c32=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x5a093a,_0x2786e5){var _0x38217d=function(_0x5888bd){while(--_0x5888bd){_0x5a093a['push'](_0x5a093a['shift']());}};_0x38217d(++_0x2786e5);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x26c3('0x0'));exports[_0x26c3('0x1')]=function(_0x3049a5,_0x416a62){return client[_0x26c3('0x2')](_0x26c3('0x3'),{'body':_0x416a62,'options':{'where':{'id':_0x3049a5}},'log':_0x26c3('0x4')});};exports[_0x26c3('0x5')]=function(_0x36528a,_0x49d4a1){return client[_0x26c3('0x2')](_0x26c3('0x6'),{'body':_0x49d4a1,'options':{'where':{'id':_0x36528a}},'log':_0x26c3('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index b2a45e3..d9e97b4 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 _0xb3a2=['createSmsMessage','../client','create','Request'];(function(_0x195fd6,_0x17240a){var _0x297f29=function(_0x57125d){while(--_0x57125d){_0x195fd6['push'](_0x195fd6['shift']());}};_0x297f29(++_0x17240a);}(_0xb3a2,0x1bd));var _0x2b3a=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xb3a2[_0x15bc81];return _0x59440e;};'use strict';var client=require(_0x2b3a('0x0'));exports[_0x2b3a('0x1')]=function(_0x222c2e){return client[_0x2b3a('0x2')]('CreateSmsMessage',{'body':_0x222c2e,'log':_0x2b3a('0x3')});}; \ No newline at end of file +var _0xd96a=['CreateSmsMessage','createSmsMessage','../client','Request'];(function(_0x4536e9,_0x4912bc){var _0x109242=function(_0x25df74){while(--_0x25df74){_0x4536e9['push'](_0x4536e9['shift']());}};_0x109242(++_0x4912bc);}(_0xd96a,0xa2));var _0xad96=function(_0x257b15,_0x2c635b){_0x257b15=_0x257b15-0x0;var _0x3b8ece=_0xd96a[_0x257b15];return _0x3b8ece;};'use strict';var client=require(_0xad96('0x0'));exports['create']=function(_0xdf0cba){return client[_0xad96('0x1')](_0xad96('0x2'),{'body':_0xdf0cba,'log':_0xad96('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index d11204b..3bb7451 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(_0x2f613b,_0x231b15){var _0x34e9cb=function(_0x329e5d){while(--_0x329e5d){_0x2f613b['push'](_0x2f613b['shift']());}};_0x34e9cb(++_0x231b15);}(_0x70e0,0x17b));var _0x070e=function(_0x2ac055,_0x271444){_0x2ac055=_0x2ac055-0x0;var _0x43df6e=_0x70e0[_0x2ac055];return _0x43df6e;};'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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x31f668,_0x20e044){var _0x57cedf=function(_0x2a83e4){while(--_0x2a83e4){_0x31f668['push'](_0x31f668['shift']());}};_0x57cedf(++_0x20e044);}(_0xe706,0xa3));var _0x6e70=function(_0x2515a3,_0x356de5){_0x2515a3=_0x2515a3-0x0;var _0xe8bbb=_0xe706[_0x2515a3];return _0xe8bbb;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 186dc31..8ee54eb 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x2d0bcf,_0x3d9ce4){var _0x266e5e=function(_0xfbc5d6){while(--_0xfbc5d6){_0x2d0bcf['push'](_0x2d0bcf['shift']());}};_0x266e5e(++_0x3d9ce4);}(_0x55ca,0x126));var _0xa55c=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0x55ca[_0x2e1af3];return _0x4150cd;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x112b29,_0x4917ec){var _0x29d8a6=function(_0x54c420){while(--_0x54c420){_0x112b29['push'](_0x112b29['shift']());}};_0x29d8a6(++_0x4917ec);}(_0x55ca,0x126));var _0xa55c=function(_0x32b79a,_0xd2538a){_0x32b79a=_0x32b79a-0x0;var _0x483450=_0x55ca[_0x32b79a];return _0x483450;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2beb1fd..1b15fd9 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(_0x4842d7,_0xd92eee){var _0x1e856c=function(_0x5b21b5){while(--_0x5b21b5){_0x4842d7['push'](_0x4842d7['shift']());}};_0x1e856c(++_0xd92eee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x8922a1,_0x8e9cb0){var _0x3d8de8=function(_0x40a51f){while(--_0x40a51f){_0x8922a1['push'](_0x8922a1['shift']());}};_0x3d8de8(++_0x8e9cb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 6c4292f..62069ef 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 _0xb4b6=['update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x758c4f,_0x3c61cb){var _0x7c64a9=function(_0x12c691){while(--_0x12c691){_0x758c4f['push'](_0x758c4f['shift']());}};_0x7c64a9(++_0x3c61cb);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x17deec,_0x419aad){_0x17deec=_0x17deec-0x0;var _0x4b8df0=_0xb4b6[_0x17deec];return _0x4b8df0;};'use strict';var client=require('../client');exports[_0x6b4b('0x0')]=function(_0x475f60,_0x1ee7bf){return client[_0x6b4b('0x1')](_0x6b4b('0x2'),{'body':_0x1ee7bf,'options':{'where':{'id':_0x475f60}},'log':_0x6b4b('0x3')});};exports[_0x6b4b('0x4')]=function(_0xff2737,_0x422b21){return client['Request'](_0x6b4b('0x5'),{'body':_0x422b21,'options':{'where':{'id':_0xff2737}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x6333=['updateWhatsappInteraction','Request','AddTagsToWhatsappInteraction','UpdateWhatsappInteraction'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x6333,0x83));var _0x3633=function(_0x3945a5,_0x2c9f3f){_0x3945a5=_0x3945a5-0x0;var _0x4dfd2e=_0x6333[_0x3945a5];return _0x4dfd2e;};'use strict';var client=require('../client');exports['update']=function(_0x5e5d69,_0x2aa20f){return client['Request'](_0x3633('0x0'),{'body':_0x2aa20f,'options':{'where':{'id':_0x5e5d69}},'log':_0x3633('0x1')});};exports['addTags']=function(_0x3e0961,_0x5cb6c6){return client[_0x3633('0x2')](_0x3633('0x3'),{'body':_0x5cb6c6,'options':{'where':{'id':_0x3e0961}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index bee4ef9..1ff401a 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 _0xc01d=['Request'];(function(_0x4d3b67,_0x4beb74){var _0x19a978=function(_0x34c55d){while(--_0x34c55d){_0x4d3b67['push'](_0x4d3b67['shift']());}};_0x19a978(++_0x4beb74);}(_0xc01d,0x14f));var _0xdc01=function(_0x451d17,_0x52534b){_0x451d17=_0x451d17-0x0;var _0x55baa4=_0xc01d[_0x451d17];return _0x55baa4;};'use strict';var client=require('../client');exports['create']=function(_0x29ecb4){return client[_0xdc01('0x0')]('CreateWhatsappMessage',{'body':_0x29ecb4,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x549a=['Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x1ac527,_0x50838d){var _0x435141=function(_0x26b607){while(--_0x26b607){_0x1ac527['push'](_0x1ac527['shift']());}};_0x435141(++_0x50838d);}(_0x549a,0x1b6));var _0xa549=function(_0x1a2617,_0x1e799c){_0x1a2617=_0x1a2617-0x0;var _0x2216e7=_0x549a[_0x1a2617];return _0x2216e7;};'use strict';var client=require('../client');exports['create']=function(_0x31cedc){return client[_0xa549('0x0')](_0xa549('0x1'),{'body':_0x31cedc,'log':_0xa549('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index da41571..a6cd4d6 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 _0x5535=['strategy','Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5535,0x163));var _0x5553=function(_0x5a2ffe,_0x3511e4){_0x5a2ffe=_0x5a2ffe-0x0;var _0x58e854=_0x5535[_0x5a2ffe];return _0x58e854;};'use strict';var client=require(_0x5553('0x0'));exports[_0x5553('0x1')]=function(){return function(){return client['Request'](_0x5553('0x2'),{'options':{'raw':![],'attributes':['id',_0x5553('0x3'),_0x5553('0x4'),_0x5553('0x5')],'include':[{'model':'User','as':_0x5553('0x6'),'attributes':['id',_0x5553('0x3'),_0x5553('0x7'),_0x5553('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x8806=['strategy','User','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout'];(function(_0x34ebc6,_0x201e65){var _0x16f800=function(_0x2c72fc){while(--_0x2c72fc){_0x34ebc6['push'](_0x34ebc6['shift']());}};_0x16f800(++_0x201e65);}(_0x8806,0x74));var _0x6880=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x8806[_0x580647];return _0x5f0792;};'use strict';var client=require(_0x6880('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x6880('0x1'),{'options':{'raw':![],'attributes':['id',_0x6880('0x2'),_0x6880('0x3'),_0x6880('0x4')],'include':[{'model':_0x6880('0x5'),'as':'Agents','attributes':['id','name','online',_0x6880('0x6')]}]},'log':_0x6880('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 9fa2667..000bc5e 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 _0xa213=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x477878,_0x4cc7cd){var _0x56c7c4=function(_0x43b937){while(--_0x43b937){_0x477878['push'](_0x477878['shift']());}};_0x56c7c4(++_0x4cc7cd);}(_0xa213,0xb4));var _0x3a21=function(_0x18d4ee,_0x23737a){_0x18d4ee=_0x18d4ee-0x0;var _0x25d717=_0xa213[_0x18d4ee];return _0x25d717;};'use strict';var client=require(_0x3a21('0x0'));exports[_0x3a21('0x1')]=function(_0x3a9166){return client[_0x3a21('0x2')]('CreateWhatsappQueueReport',{'body':_0x3a9166,'log':_0x3a21('0x3')});};exports['update']=function(_0x289bbf,_0x377bac){return client[_0x3a21('0x2')](_0x3a21('0x4'),{'body':_0x377bac,'options':{'where':{'uniqueid':_0x289bbf},'order':[['id',_0x3a21('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xe38a=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0xfa2f68,_0x23836e){var _0x252d9a=function(_0x285e61){while(--_0x285e61){_0xfa2f68['push'](_0xfa2f68['shift']());}};_0x252d9a(++_0x23836e);}(_0xe38a,0x1a9));var _0xae38=function(_0x59881a,_0x5ef668){_0x59881a=_0x59881a-0x0;var _0x33a221=_0xe38a[_0x59881a];return _0x33a221;};'use strict';var client=require('../client');exports['create']=function(_0x5e4f14){return client[_0xae38('0x0')](_0xae38('0x1'),{'body':_0x5e4f14,'log':'CreateWhatsappQueueReport'});};exports[_0xae38('0x2')]=function(_0x5b8384,_0x4c9ccf){return client['Request'](_0xae38('0x3'),{'body':_0x4c9ccf,'options':{'where':{'uniqueid':_0x5b8384},'order':[['id',_0xae38('0x4')]],'limit':0x1},'log':_0xae38('0x3')});}; \ 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 4374394..3fa3b68 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 _0xf3e7=['close','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','stop','find','agents','timeout','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xf3e7,0x126));var _0x7f3e=function(_0x3db58d,_0x3f0c01){_0x3db58d=_0x3db58d-0x0;var _0x17158d=_0xf3e7[_0x3db58d];return _0x17158d;};'use strict';var schema=require(_0x7f3e('0x0'));var _=require(_0x7f3e('0x1'));var util=require(_0x7f3e('0x2'));var seqqueue=require(_0x7f3e('0x3'));var logger=require(_0x7f3e('0x4'))(_0x7f3e('0x5'));var strategy=require(_0x7f3e('0x6'));var queue=schema({'name':{'type':_0x7f3e('0x7'),'required':!![],'message':_0x7f3e('0x8')},'timeout':{'type':'number','message':_0x7f3e('0x9')}});function writeLog(_0x1d2556,_0x334b23,_0x124e38){return logger[_0x7f3e('0xa')](util[_0x7f3e('0xb')](_0x7f3e('0xc'),_0x1d2556,_0x334b23[_0x7f3e('0xd')],_0x124e38));}function handleFindAgent(_0x3f211e){return function(_0x2a5f08){return _0x2a5f08[_0x7f3e('0xd')][_0x7f3e('0xe')]()===_0x3f211e['toLowerCase']();};}exports[_0x7f3e('0xf')]=function(_0xd3b751,_0x4e22a4,_0x5b0bb9,_0x596138){return function(_0x2a2133){try{var _0x5b4919={'name':_0x4e22a4[0x0],'timeout':_0x4e22a4[0x1]};var _0x10af81=queue[_0x7f3e('0x0')](_0x5b4919,{'typecast':!![]});if(_0x10af81[_0x7f3e('0x10')]){logger['error'](_0x7f3e('0x11'),_0xd3b751,_[_0x7f3e('0x12')](_0x10af81,'message')['join'](',\x20'));_0x2a2133[_0x7f3e('0x13')]();}else{var _0x3a708e=_[_0x7f3e('0x14')](_0x5b0bb9[_0x7f3e('0x15')],handleFindAgent(_0x5b4919[_0x7f3e('0xd')]));if(_0x3a708e){var _0x1b32c5=(_0x5b4919[_0x7f3e('0x16')]||0xa)*0x3e8;var _0xe6e75a,_0x367c2d;var _0x40ed26=seqqueue['createQueue'](_0x1b32c5);_0x40ed26['id']=_0xd3b751;_0x40ed26[_0x7f3e('0x17')]=_0x1b32c5;_0x40ed26['channel']=_0x596138[_0x7f3e('0x18')];writeLog(_0xd3b751,_0x3a708e,util[_0x7f3e('0xb')](_0x7f3e('0x19'),_0x1b32c5));_0x5b0bb9[_0x7f3e('0x1a')][_0xd3b751]['on']('end',function(){logger[_0x7f3e('0xa')](_0x7f3e('0x1b'),_0xd3b751);clearTimeout(_0x367c2d);_0x367c2d=undefined;_0x40ed26['close']();if(_0x5b0bb9[_0x7f3e('0x1a')][_0xd3b751]){delete _0x5b0bb9[_0x7f3e('0x1a')][_0xd3b751];}_0x2a2133[_0x7f3e('0x13')]();});_0x5b0bb9['rules'][_0xd3b751]['on'](_0x7f3e('0x1c'),function(){if(_0x5b0bb9['rules'][_0xd3b751]){delete _0x5b0bb9[_0x7f3e('0x1a')][_0xd3b751];}});_0x367c2d=setTimeout(function(){logger[_0x7f3e('0xa')](_0x7f3e('0x1d'),_0xd3b751);clearTimeout(_0x367c2d);_0x40ed26[_0x7f3e('0x1e')]();_0x2a2133['next']();},_0x1b32c5);strategy['agent'](_0x40ed26,_0x3a708e,_0x5b0bb9,_0x596138);}else{logger[_0x7f3e('0x1f')](_0x7f3e('0x20'),_0xd3b751,_0x5b4919[_0x7f3e('0xd')]);_0x2a2133[_0x7f3e('0x13')]();}}}catch(_0x49510e){console[_0x7f3e('0x21')](_0x49510e);logger[_0x7f3e('0x1f')](_0x7f3e('0x22'),_0xd3b751,_0x49510e[_0x7f3e('0x23')]);_0x2a2133[_0x7f3e('0x13')]();}};}; \ No newline at end of file +var _0x12b7=['[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','seq-queue','../../../../config/logger','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','[%s][AGENT]\x20%s','message','join','find','agents','timeout','createQueue','atimeout','channel','end'];(function(_0x5c59e9,_0x253541){var _0x56b0b3=function(_0xeb6ad2){while(--_0xeb6ad2){_0x5c59e9['push'](_0x5c59e9['shift']());}};_0x56b0b3(++_0x253541);}(_0x12b7,0x6d));var _0x712b=function(_0x4a4eee,_0x3b8958){_0x4a4eee=_0x4a4eee-0x0;var _0x214a77=_0x12b7[_0x4a4eee];return _0x214a77;};'use strict';var schema=require('validate');var _=require(_0x712b('0x0'));var util=require('util');var seqqueue=require(_0x712b('0x1'));var logger=require(_0x712b('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x712b('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x712b('0x4'),'message':_0x712b('0x5')}});function writeLog(_0x829d9f,_0x22a158,_0x3c401c){return logger[_0x712b('0x6')](util[_0x712b('0x7')](_0x712b('0x8'),_0x829d9f,_0x22a158[_0x712b('0x9')],_0x3c401c));}function handleFindAgent(_0xadeec6){return function(_0x130157){return _0x130157[_0x712b('0x9')][_0x712b('0xa')]()===_0xadeec6[_0x712b('0xa')]();};}exports[_0x712b('0xb')]=function(_0x518b26,_0x2a1bd6,_0xb8c0be,_0x1601b3){return function(_0x585570){try{var _0x211f1c={'name':_0x2a1bd6[0x0],'timeout':_0x2a1bd6[0x1]};var _0x5e4312=queue[_0x712b('0xc')](_0x211f1c,{'typecast':!![]});if(_0x5e4312['length']){logger['error'](_0x712b('0xd'),_0x518b26,_['map'](_0x5e4312,_0x712b('0xe'))[_0x712b('0xf')](',\x20'));_0x585570['stop']();}else{var _0x231761=_[_0x712b('0x10')](_0xb8c0be[_0x712b('0x11')],handleFindAgent(_0x211f1c[_0x712b('0x9')]));if(_0x231761){var _0x525595=(_0x211f1c[_0x712b('0x12')]||0xa)*0x3e8;var _0x13fbc4,_0xb31faa;var _0x50e59f=seqqueue[_0x712b('0x13')](_0x525595);_0x50e59f['id']=_0x518b26;_0x50e59f[_0x712b('0x14')]=_0x525595;_0x50e59f[_0x712b('0x15')]=_0x1601b3['channel'];writeLog(_0x518b26,_0x231761,util[_0x712b('0x7')]('START:%s',_0x525595));_0xb8c0be['rules'][_0x518b26]['on'](_0x712b('0x16'),function(){logger[_0x712b('0x6')](_0x712b('0x17'),_0x518b26);clearTimeout(_0xb31faa);_0xb31faa=undefined;_0x50e59f[_0x712b('0x18')]();if(_0xb8c0be[_0x712b('0x19')][_0x518b26]){delete _0xb8c0be['rules'][_0x518b26];}_0x585570[_0x712b('0x1a')]();});_0xb8c0be[_0x712b('0x19')][_0x518b26]['on']('complete',function(){if(_0xb8c0be[_0x712b('0x19')][_0x518b26]){delete _0xb8c0be['rules'][_0x518b26];}});_0xb31faa=setTimeout(function(){logger[_0x712b('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x518b26);clearTimeout(_0xb31faa);_0x50e59f[_0x712b('0x18')]();_0x585570[_0x712b('0x1b')]();},_0x525595);strategy[_0x712b('0x1c')](_0x50e59f,_0x231761,_0xb8c0be,_0x1601b3);}else{logger[_0x712b('0x1d')](_0x712b('0x1e'),_0x518b26,_0x211f1c[_0x712b('0x9')]);_0x585570[_0x712b('0x1a')]();}}}catch(_0x460dd9){console[_0x712b('0x1f')](_0x460dd9);logger[_0x712b('0x1d')]('[%s][QUEUE]\x20%s',_0x518b26,_0x460dd9[_0x712b('0x20')]);_0x585570[_0x712b('0x1a')]();}};}; \ 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 d62af78..d008367 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 _0xc1ea=['$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','stringify','Message','dialogState','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime'];(function(_0x17e516,_0x51f83f){var _0x3925bb=function(_0x5d6683){while(--_0x5d6683){_0x17e516['push'](_0x17e516['shift']());}};_0x3925bb(++_0x51f83f);}(_0xc1ea,0x136));var _0xac1e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc1ea[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var moment=require(_0xac1e('0x0'));var AWS=require(_0xac1e('0x1'));var utils=require('./utils');var logger=require(_0xac1e('0x2'))(_0xac1e('0x3'));var rpc={'chatMessage':require(_0xac1e('0x4')),'openchannelMessage':require(_0xac1e('0x5')),'mailMessage':require(_0xac1e('0x6')),'smsMessage':require(_0xac1e('0x7')),'faxMessage':require(_0xac1e('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x3768bd,_0x1c456d){return function(_0x2dd96b){try{if(!_[_0xac1e('0x9')](this[_0xac1e('0xa')]['UserId'])){logger[_0xac1e('0xb')](_0xac1e('0xc'),_0x3768bd,_0xac1e('0xd'));return _0x2dd96b[_0xac1e('0xe')]();}var _0x52fbb1={'ContactId':this[_0xac1e('0xf')]['id'],'sentAt':moment()[_0xac1e('0x10')](_0xac1e('0x11')),'direction':_0xac1e('0x12')};if(this[_0xac1e('0x13')]==='sms'||this[_0xac1e('0x13')]===_0xac1e('0x14')){_0x52fbb1[_0xac1e('0x15')]=this[_0xac1e('0xa')][_0xac1e('0x15')];}var _0x67e902=this['channel'];if(_0x67e902===_0xac1e('0x16')){_0x52fbb1[_0xac1e('0x17')]=this[_0xac1e('0x18')]['id'];}else{_0x52fbb1[_['upperFirst'](_0x67e902)+_0xac1e('0x19')]=this[_0xac1e('0x18')]['id'];}_0x52fbb1[_[_0xac1e('0x1a')](_0x67e902)+_0xac1e('0x1b')]=this[_0xac1e('0xa')]['id'];if(this[_0xac1e('0xa')][_0xac1e('0x1c')]){var _0x19054a=_0x1c456d[0x4];if(!_[_0xac1e('0x1d')](_0x19054a)){_0x52fbb1[_0xac1e('0x1e')]=utils[_0xac1e('0x1f')](_0x19054a,this);return rpc[_0x67e902+'Message'][_0xac1e('0x20')](_0x52fbb1)[_0xac1e('0x21')](function(_0x4167f1){logger['info'](_0xac1e('0xc'),_0x3768bd,_0x52fbb1[_0xac1e('0x1e')]);})[_0xac1e('0x22')](function(_0x3a7930){logger[_0xac1e('0x23')]('[%s][AMAZONLEX]\x20%s',_0x3768bd,JSON['stringify'](_0x3a7930));})[_0xac1e('0x24')](function(){logger[_0xac1e('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3768bd);_0x2dd96b['stop']();});}else{logger[_0xac1e('0xb')](_0xac1e('0x25'),_0x3768bd);_0x2dd96b[_0xac1e('0x26')]();}}else{var _0x34b104=this;var _0x13c32a=new AWS[(_0xac1e('0x27'))]({'accessKeyId':_0x1c456d[0x0],'secretAccessKey':_0x1c456d[0x1],'region':_0x1c456d[0x2]});var _0x36209c={'botAlias':_0xac1e('0x28'),'botName':_0x1c456d[0x3],'inputText':this[_0xac1e('0x29')][_0xac1e('0x1e')],'userId':this[_0xac1e('0x13')]+':'+this[_0xac1e('0xa')]['id'][_0xac1e('0x2a')]()};_0x13c32a[_0xac1e('0x2b')](_0x36209c,function(_0x5be4d0,_0x748b8f){if(_0x5be4d0){logger[_0xac1e('0x23')](_0xac1e('0xc'),_0x3768bd,_0x5be4d0[_0xac1e('0x29')]);_0x2dd96b[_0xac1e('0xe')]();}else if(_0x748b8f&&_0x748b8f[_0xac1e('0x29')]){_0x34b104[_0xac1e('0x1e')]['amazonlex']=_0x748b8f;_0x52fbb1[_0xac1e('0x1e')]=_0x748b8f[_0xac1e('0x29')];_0x52fbb1[_0xac1e('0x2c')]=_0xac1e('0x2d');_0x52fbb1[_0xac1e('0x2e')]=JSON[_0xac1e('0x2f')](_0x748b8f);return rpc[_0x67e902+_0xac1e('0x30')][_0xac1e('0x20')](_0x52fbb1)['then'](function(_0x242a08){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3768bd,_0x52fbb1['body']);if(_0x748b8f[_0xac1e('0x31')]=='Failed'){_0x2dd96b[_0xac1e('0xe')]();}else{_0x2dd96b[_0xac1e('0x26')]();}})[_0xac1e('0x22')](function(_0x52edaa){logger[_0xac1e('0x23')](_0xac1e('0xc'),_0x3768bd,JSON[_0xac1e('0x2f')](_0x52edaa));_0x2dd96b[_0xac1e('0xe')]();});}else{_0x2dd96b[_0xac1e('0xe')]();}});}}catch(_0x215bdd){logger[_0xac1e('0x23')]('[%s][AMAZONLEX]\x20%s',_0x3768bd,JSON[_0xac1e('0x2f')](_0x215bdd));_0x2dd96b['stop']();}};}; \ No newline at end of file +var _0x81dc=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','Failed','catch','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x81dc,0xd2));var _0xc81d=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x81dc[_0x286726];return _0xcd4fe9;};'use strict';var _=require(_0xc81d('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xc81d('0x1'))(_0xc81d('0x2'));var rpc={'chatMessage':require(_0xc81d('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc81d('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc81d('0x5')]=function(_0xfceaaa,_0x891a4e){return function(_0x149ec5){try{if(!_[_0xc81d('0x6')](this['interaction'][_0xc81d('0x7')])){logger[_0xc81d('0x8')](_0xc81d('0x9'),_0xfceaaa,_0xc81d('0xa'));return _0x149ec5[_0xc81d('0xb')]();}var _0x342865={'ContactId':this[_0xc81d('0xc')]['id'],'sentAt':moment()[_0xc81d('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc81d('0xe')};if(this['channel']==='sms'||this[_0xc81d('0xf')]===_0xc81d('0x10')){_0x342865[_0xc81d('0x11')]=this['interaction'][_0xc81d('0x11')];}var _0x4ead24=this[_0xc81d('0xf')];if(_0x4ead24===_0xc81d('0x12')){_0x342865[_0xc81d('0x13')]=this[_0xc81d('0x14')]['id'];}else{_0x342865[_[_0xc81d('0x15')](_0x4ead24)+_0xc81d('0x16')]=this['account']['id'];}_0x342865[_[_0xc81d('0x15')](_0x4ead24)+_0xc81d('0x17')]=this[_0xc81d('0x18')]['id'];if(this[_0xc81d('0x18')][_0xc81d('0x19')]){var _0x539527=_0x891a4e[0x4];if(!_[_0xc81d('0x1a')](_0x539527)){_0x342865[_0xc81d('0x1b')]=utils[_0xc81d('0x1c')](_0x539527,this);return rpc[_0x4ead24+_0xc81d('0x1d')][_0xc81d('0x1e')](_0x342865)[_0xc81d('0x1f')](function(_0x4e9470){logger['info']('[%s][AMAZONLEX]\x20%s',_0xfceaaa,_0x342865[_0xc81d('0x1b')]);})['catch'](function(_0x241450){logger[_0xc81d('0x20')](_0xc81d('0x9'),_0xfceaaa,JSON[_0xc81d('0x21')](_0x241450));})[_0xc81d('0x22')](function(){logger[_0xc81d('0x8')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xfceaaa);_0x149ec5[_0xc81d('0x23')]();});}else{logger[_0xc81d('0x8')](_0xc81d('0x24'),_0xfceaaa);_0x149ec5['stop']();}}else{var _0x584afb=this;var _0x98acc7=new AWS['LexRuntime']({'accessKeyId':_0x891a4e[0x0],'secretAccessKey':_0x891a4e[0x1],'region':_0x891a4e[0x2]});var _0x4afadf={'botAlias':_0xc81d('0x25'),'botName':_0x891a4e[0x3],'inputText':this[_0xc81d('0x26')]['body'],'userId':this[_0xc81d('0xf')]+':'+this[_0xc81d('0x18')]['id'][_0xc81d('0x27')]()};_0x98acc7[_0xc81d('0x28')](_0x4afadf,function(_0x5552e6,_0xae286f){if(_0x5552e6){logger[_0xc81d('0x20')](_0xc81d('0x9'),_0xfceaaa,_0x5552e6[_0xc81d('0x26')]);_0x149ec5['next']();}else if(_0xae286f&&_0xae286f['message']){_0x584afb['body'][_0xc81d('0x29')]=_0xae286f;_0x342865[_0xc81d('0x1b')]=_0xae286f[_0xc81d('0x26')];_0x342865['providerName']=_0xc81d('0x29');_0x342865['providerResponse']=JSON[_0xc81d('0x21')](_0xae286f);return rpc[_0x4ead24+_0xc81d('0x1d')][_0xc81d('0x1e')](_0x342865)['then'](function(_0x202dd0){logger['info'](_0xc81d('0x9'),_0xfceaaa,_0x342865[_0xc81d('0x1b')]);if(_0xae286f['dialogState']==_0xc81d('0x2a')){_0x149ec5[_0xc81d('0xb')]();}else{_0x149ec5[_0xc81d('0x23')]();}})[_0xc81d('0x2b')](function(_0x2bef7e){logger['error'](_0xc81d('0x9'),_0xfceaaa,JSON['stringify'](_0x2bef7e));_0x149ec5[_0xc81d('0xb')]();});}else{_0x149ec5['next']();}});}}catch(_0x10345d){logger[_0xc81d('0x20')](_0xc81d('0x9'),_0xfceaaa,JSON[_0xc81d('0x21')](_0x10345d));_0x149ec5[_0xc81d('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index eb9588b..1c510da 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 _0xf31f=['[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','body','Interaction','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','inReplyTo','html','','headers','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','[%s][AUTOREPLY]\x20%s','stringify','catch','error'];(function(_0x3009f6,_0x3f1d8e){var _0x2161d0=function(_0x4f0450){while(--_0x4f0450){_0x3009f6['push'](_0x3009f6['shift']());}};_0x2161d0(++_0x3f1d8e);}(_0xf31f,0x193));var _0xff31=function(_0x2b0095,_0x367501){_0x2b0095=_0x2b0095-0x0;var _0x4d31c9=_0xf31f[_0x2b0095];return _0x4d31c9;};'use strict';var _=require(_0xff31('0x0'));var moment=require(_0xff31('0x1'));var utils=require(_0xff31('0x2'));var logger=require(_0xff31('0x3'))(_0xff31('0x4'));var rpc={'chatMessage':require(_0xff31('0x5')),'openchannelMessage':require(_0xff31('0x6')),'mailMessage':require(_0xff31('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xff31('0x8')),'whatsappMessage':require(_0xff31('0x9')),'chatInteraction':require(_0xff31('0xa')),'openchannelInteraction':require(_0xff31('0xb')),'mailInteraction':require(_0xff31('0xc')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xff31('0xd')),'whatsappInteraction':require(_0xff31('0xe'))};var mailRpc=require(_0xff31('0xf'));exports[_0xff31('0x10')]=function(_0x42c537,_0x2f7a18,_0x581501,_0x309340){return function(_0x36ab6b){try{var _0x317735=this[_0xff31('0x11')];if(_0x317735===_0xff31('0x12')&&_0x309340['body'][_0xff31('0x13')]){logger[_0xff31('0x14')]('[%s][AUTOREPLY]\x20%s',_0x42c537,_0xff31('0x15'));return _0x36ab6b[_0xff31('0x16')]();}if(_0x2f7a18[0x0]==='1'&&(_[_0xff31('0x17')](this['interaction'][_0xff31('0x18')])||!this[_0xff31('0x19')][_0xff31('0x18')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x42c537,_0xff31('0x1a'));return _0x36ab6b['next']();}if(_0x2f7a18[0x0]==='2'&&this[_0xff31('0x19')][_0xff31('0x1b')]){logger['info'](_0xff31('0x1c'),_0x42c537,'One\x20Time\x20already\x20sent');return _0x36ab6b['next']();}var _0x1dc86e={'ContactId':this[_0xff31('0x1d')]['id'],'sentAt':moment()[_0xff31('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xff31('0x1f')};if(this[_0xff31('0x11')]===_0xff31('0x12')){_0x1dc86e['body']=utils['getMustacheRender'](_0x2f7a18[0x2],this);}else{_0x1dc86e['body']=utils[_0xff31('0x20')](_0x2f7a18[0x1],this);}if(this[_0xff31('0x21')]){_0x1dc86e['to']=this['message']['from']||'';if(this[_0xff31('0x11')]===_0xff31('0x12')&&_0x2f7a18[0x1]==='1'){_0x1dc86e['cc']=this['message']['cc']||'';}_0x1dc86e[_0xff31('0x22')]=this[_0xff31('0x21')]['to']||'';_0x1dc86e['phone']=this['message'][_0xff31('0x23')]||'';_0x1dc86e[_0xff31('0x24')]=!![];if(this[_0xff31('0x21')][_0xff31('0x25')]){_0x1dc86e[_0xff31('0x25')]='';_0x1dc86e[_0xff31('0x25')]+=_[_0xff31('0x26')](this[_0xff31('0x21')][_0xff31('0x25')],_0xff31('0x27'))?'':_0xff31('0x28');_0x1dc86e[_0xff31('0x25')]+=this[_0xff31('0x21')][_0xff31('0x25')];}}if(this[_0xff31('0x11')]===_0xff31('0x29')){_0x1dc86e[_0xff31('0x2a')]=this[_0xff31('0x2b')]['id'];}else{_0x1dc86e[_['upperFirst'](this[_0xff31('0x11')])+_0xff31('0x2c')]=this[_0xff31('0x2b')]['id'];}_0x1dc86e[_[_0xff31('0x2d')](this[_0xff31('0x11')])+_0xff31('0x2e')]=this[_0xff31('0x19')]['id'];var _0x1def33=this[_0xff31('0x19')];if(rpc[this[_0xff31('0x11')]+_0xff31('0x2f')]){if(this[_0xff31('0x11')]===_0xff31('0x12')){var _0x4c4a16={'tls':{'rejectUnauthorized':![]}};if(this[_0xff31('0x2b')][_0xff31('0x30')][_0xff31('0x31')]){_0x4c4a16[_0xff31('0x31')]=this[_0xff31('0x2b')]['Smtp']['service'];}else{_0x4c4a16[_0xff31('0x32')]=this[_0xff31('0x2b')][_0xff31('0x30')]['host'];_0x4c4a16[_0xff31('0x33')]=this['account'][_0xff31('0x30')]['port'];_0x4c4a16[_0xff31('0x34')]=this['account'][_0xff31('0x30')][_0xff31('0x34')];}if(this['account']['Smtp']['authentication']){_0x4c4a16[_0xff31('0x35')]={'user':this['account']['Smtp'][_0xff31('0x36')],'pass':this[_0xff31('0x2b')][_0xff31('0x30')]['pass']};}_0x1dc86e[_0xff31('0x37')]=this['message']['messageId'];_0x1dc86e[_0xff31('0x38')]=''+_['replace'](_0x1dc86e['body'],_0xff31('0x39'),_0xff31('0x3a'))+_0xff31('0x3b');_0x1dc86e[_0xff31('0x3c')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xff31('0x3d'),'Precedence':_0xff31('0x3e')};return mailRpc['sendMailMessage'](_0x4c4a16,_0x1dc86e)[_0xff31('0x3f')](function(_0x46976e){logger['info'](_0xff31('0x40'),_0x42c537);_0x1dc86e[_0xff31('0x41')]=_0x46976e[_0xff31('0x21')]['messageId'];return rpc[_0x317735+_0xff31('0x2f')][_0xff31('0x42')](_0x1dc86e);})['then'](function(_0x37db91){logger[_0xff31('0x14')](_0xff31('0x43'),_0x42c537,JSON[_0xff31('0x44')](_0x37db91));})[_0xff31('0x45')](function(_0x45524a){logger[_0xff31('0x46')](_0xff31('0x47'),_0x42c537,JSON['stringify'](_0x45524a));})[_0xff31('0x48')](function(){Promise[_0xff31('0x49')]()[_0xff31('0x3f')](function(){if(_0x2f7a18[0x0]!=='2'||_0x1def33['autoreplyExecuted'])return;return rpc[_0x317735+'Interaction'][_0xff31('0x4a')](_0x1def33['id'],{'autoreplyExecuted':!![]})[_0xff31('0x3f')](function(_0x308317){logger[_0xff31('0x14')](_0xff31('0x1c'),_0x42c537,JSON['stringify'](_0x308317));})[_0xff31('0x45')](function(_0x2e6619){logger[_0xff31('0x46')](_0xff31('0x4b'),_0x42c537,JSON[_0xff31('0x44')](_0x2e6619));});})[_0xff31('0x3f')](function(){_0x36ab6b[_0xff31('0x16')]();});});}else{return rpc[this['channel']+'Message'][_0xff31('0x42')](_0x1dc86e)['then'](function(_0x471efd){logger['info'](_0xff31('0x43'),_0x42c537,_0x1dc86e[_0xff31('0x4c')]);})[_0xff31('0x45')](function(_0x5bf162){logger[_0xff31('0x46')]('[%s][AUTOREPLY]\x20%s',_0x42c537,JSON[_0xff31('0x44')](_0x5bf162));})[_0xff31('0x48')](function(){Promise[_0xff31('0x49')]()[_0xff31('0x3f')](function(){if(_0x2f7a18[0x0]!=='2'||_0x1def33[_0xff31('0x1b')])return;return rpc[_0x317735+_0xff31('0x4d')][_0xff31('0x4a')](_0x1def33['id'],{'autoreplyExecuted':!![]})[_0xff31('0x3f')](function(_0x1d57ac){logger[_0xff31('0x14')](_0xff31('0x1c'),_0x42c537,JSON['stringify'](_0x1d57ac));})['catch'](function(_0x59b825){logger[_0xff31('0x46')](_0xff31('0x4b'),_0x42c537,JSON[_0xff31('0x44')](_0x59b825));});})[_0xff31('0x3f')](function(){_0x36ab6b[_0xff31('0x16')]();});});}}}catch(_0x4e2519){logger[_0xff31('0x46')](_0xff31('0x43'),_0x42c537,JSON[_0xff31('0x44')](_0x4e2519));_0x36ab6b[_0xff31('0x4e')]();}};}; \ No newline at end of file +var _0x4af0=['host','port','secure','authentication','auth','pass','inReplyTo','messageId','html','','','headers','auto-replied','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../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','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x4af0,0x100));var _0x04af=function(_0x56a86e,_0x51f246){_0x56a86e=_0x56a86e-0x0;var _0x48ae90=_0x4af0[_0x56a86e];return _0x48ae90;};'use strict';var _=require(_0x04af('0x0'));var moment=require(_0x04af('0x1'));var utils=require(_0x04af('0x2'));var logger=require(_0x04af('0x3'))(_0x04af('0x4'));var rpc={'chatMessage':require(_0x04af('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x04af('0x6')),'faxMessage':require(_0x04af('0x7')),'whatsappMessage':require(_0x04af('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x04af('0x9')),'mailInteraction':require(_0x04af('0xa')),'smsInteraction':require(_0x04af('0xb')),'faxInteraction':require(_0x04af('0xc')),'whatsappInteraction':require(_0x04af('0xd'))};var mailRpc=require(_0x04af('0xe'));exports[_0x04af('0xf')]=function(_0x23baee,_0x3c9cf1,_0x6d2498,_0x4a67d5){return function(_0x29226c){try{var _0x27f64e=this[_0x04af('0x10')];if(_0x27f64e===_0x04af('0x11')&&_0x4a67d5[_0x04af('0x12')][_0x04af('0x13')]){logger[_0x04af('0x14')](_0x04af('0x15'),_0x23baee,_0x04af('0x16'));return _0x29226c[_0x04af('0x17')]();}if(_0x3c9cf1[0x0]==='1'&&(_[_0x04af('0x18')](this[_0x04af('0x19')][_0x04af('0x1a')])||!this['interaction'][_0x04af('0x1a')])){logger[_0x04af('0x14')]('[%s][AUTOREPLY]\x20%s',_0x23baee,_0x04af('0x1b'));return _0x29226c[_0x04af('0x17')]();}if(_0x3c9cf1[0x0]==='2'&&this[_0x04af('0x19')][_0x04af('0x1c')]){logger[_0x04af('0x14')](_0x04af('0x1d'),_0x23baee,'One\x20Time\x20already\x20sent');return _0x29226c[_0x04af('0x17')]();}var _0x30d0d3={'ContactId':this[_0x04af('0x1e')]['id'],'sentAt':moment()[_0x04af('0x1f')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x04af('0x10')]===_0x04af('0x11')){_0x30d0d3[_0x04af('0x12')]=utils[_0x04af('0x20')](_0x3c9cf1[0x2],this);}else{_0x30d0d3[_0x04af('0x12')]=utils[_0x04af('0x20')](_0x3c9cf1[0x1],this);}if(this['message']){_0x30d0d3['to']=this[_0x04af('0x21')][_0x04af('0x22')]||'';if(this['channel']===_0x04af('0x11')&&_0x3c9cf1[0x1]==='1'){_0x30d0d3['cc']=this[_0x04af('0x21')]['cc']||'';}_0x30d0d3[_0x04af('0x22')]=this[_0x04af('0x21')]['to']||'';_0x30d0d3[_0x04af('0x23')]=this['message']['phone']||'';_0x30d0d3[_0x04af('0x24')]=!![];if(this['message'][_0x04af('0x25')]){_0x30d0d3[_0x04af('0x25')]='';_0x30d0d3[_0x04af('0x25')]+=_['startsWith'](this[_0x04af('0x21')][_0x04af('0x25')],_0x04af('0x26'))?'':_0x04af('0x27');_0x30d0d3[_0x04af('0x25')]+=this['message'][_0x04af('0x25')];}}if(this[_0x04af('0x10')]===_0x04af('0x28')){_0x30d0d3[_0x04af('0x29')]=this[_0x04af('0x2a')]['id'];}else{_0x30d0d3[_['upperFirst'](this['channel'])+'AccountId']=this[_0x04af('0x2a')]['id'];}_0x30d0d3[_[_0x04af('0x2b')](this[_0x04af('0x10')])+_0x04af('0x2c')]=this[_0x04af('0x19')]['id'];var _0x4ece7b=this[_0x04af('0x19')];if(rpc[this[_0x04af('0x10')]+_0x04af('0x2d')]){if(this[_0x04af('0x10')]===_0x04af('0x11')){var _0x1724c0={'tls':{'rejectUnauthorized':![]}};if(this[_0x04af('0x2a')][_0x04af('0x2e')][_0x04af('0x2f')]){_0x1724c0[_0x04af('0x2f')]=this[_0x04af('0x2a')]['Smtp'][_0x04af('0x2f')];}else{_0x1724c0[_0x04af('0x30')]=this[_0x04af('0x2a')][_0x04af('0x2e')]['host'];_0x1724c0[_0x04af('0x31')]=this[_0x04af('0x2a')]['Smtp'][_0x04af('0x31')];_0x1724c0[_0x04af('0x32')]=this['account'][_0x04af('0x2e')]['secure'];}if(this[_0x04af('0x2a')][_0x04af('0x2e')][_0x04af('0x33')]){_0x1724c0[_0x04af('0x34')]={'user':this[_0x04af('0x2a')][_0x04af('0x2e')]['user'],'pass':this[_0x04af('0x2a')][_0x04af('0x2e')][_0x04af('0x35')]};}_0x30d0d3[_0x04af('0x36')]=this[_0x04af('0x21')][_0x04af('0x37')];_0x30d0d3[_0x04af('0x38')]=_0x04af('0x39')+_['replace'](_0x30d0d3[_0x04af('0x12')],_0x04af('0x3a'),_0x04af('0x3b'))+_0x04af('0x3c');_0x30d0d3[_0x04af('0x3d')]={'Auto-Submitted':_0x04af('0x3e'),'X-Auto-Response-Suppress':'All','Precedence':_0x04af('0x3f')};return mailRpc['sendMailMessage'](_0x1724c0,_0x30d0d3)[_0x04af('0x40')](function(_0x2f4f80){logger['info'](_0x04af('0x41'),_0x23baee);_0x30d0d3[_0x04af('0x37')]=_0x2f4f80[_0x04af('0x21')][_0x04af('0x37')];return rpc[_0x27f64e+_0x04af('0x2d')][_0x04af('0x42')](_0x30d0d3);})[_0x04af('0x40')](function(_0x3fc75f){logger[_0x04af('0x14')]('[%s][AUTOREPLY]\x20%s',_0x23baee,JSON[_0x04af('0x43')](_0x3fc75f));})[_0x04af('0x44')](function(_0x11ce74){logger[_0x04af('0x45')](_0x04af('0x46'),_0x23baee,JSON[_0x04af('0x43')](_0x11ce74));})[_0x04af('0x47')](function(){Promise['resolve']()[_0x04af('0x40')](function(){if(_0x3c9cf1[0x0]!=='2'||_0x4ece7b[_0x04af('0x1c')])return;return rpc[_0x27f64e+_0x04af('0x48')][_0x04af('0x49')](_0x4ece7b['id'],{'autoreplyExecuted':!![]})[_0x04af('0x40')](function(_0x220120){logger['info'](_0x04af('0x1d'),_0x23baee,JSON[_0x04af('0x43')](_0x220120));})[_0x04af('0x44')](function(_0x41c62d){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x23baee,JSON['stringify'](_0x41c62d));});})[_0x04af('0x40')](function(){_0x29226c[_0x04af('0x17')]();});});}else{return rpc[this['channel']+_0x04af('0x2d')][_0x04af('0x42')](_0x30d0d3)[_0x04af('0x40')](function(_0x1038a7){logger[_0x04af('0x14')](_0x04af('0x15'),_0x23baee,_0x30d0d3[_0x04af('0x12')]);})[_0x04af('0x44')](function(_0x54d78d){logger[_0x04af('0x45')](_0x04af('0x15'),_0x23baee,JSON[_0x04af('0x43')](_0x54d78d));})[_0x04af('0x47')](function(){Promise[_0x04af('0x4a')]()['then'](function(){if(_0x3c9cf1[0x0]!=='2'||_0x4ece7b[_0x04af('0x1c')])return;return rpc[_0x27f64e+_0x04af('0x48')][_0x04af('0x49')](_0x4ece7b['id'],{'autoreplyExecuted':!![]})[_0x04af('0x40')](function(_0x1df4ee){logger[_0x04af('0x14')](_0x04af('0x1d'),_0x23baee,JSON[_0x04af('0x43')](_0x1df4ee));})[_0x04af('0x44')](function(_0x484068){logger['error'](_0x04af('0x4b'),_0x23baee,JSON[_0x04af('0x43')](_0x484068));});})[_0x04af('0x40')](function(){_0x29226c[_0x04af('0x17')]();});});}}}catch(_0x2657d4){logger[_0x04af('0x45')](_0x04af('0x15'),_0x23baee,JSON['stringify'](_0x2657d4));_0x29226c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 5879e6c..8167511 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a1a=['channel','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','[%s][CLOSE]\x20%s','error','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x481c5e,_0x5f03bf){var _0x2d3ea0=function(_0x11cf2b){while(--_0x11cf2b){_0x481c5e['push'](_0x481c5e['shift']());}};_0x2d3ea0(++_0x5f03bf);}(_0x5a1a,0x159));var _0xa5a1=function(_0x9731b4,_0x26aac3){_0x9731b4=_0x9731b4-0x0;var _0x3d7a66=_0x5a1a[_0x9731b4];return _0x3d7a66;};'use strict';var moment=require(_0xa5a1('0x0'));var logger=require(_0xa5a1('0x1'))(_0xa5a1('0x2'));var rpc={'chatInteraction':require(_0xa5a1('0x3')),'openchannelInteraction':require(_0xa5a1('0x4')),'smsInteraction':require(_0xa5a1('0x5')),'mailInteraction':require(_0xa5a1('0x6')),'faxInteraction':require(_0xa5a1('0x7')),'whatsappInteraction':require(_0xa5a1('0x8'))};exports[_0xa5a1('0x9')]=function(_0x5b1455,_0x3c008a,_0x364ce5,_0x9018b1){return function(_0x1218be){try{logger[_0xa5a1('0xa')](_0xa5a1('0xb'),_0x5b1455,_0x3c008a[0x0]);var _0x2cf7bb={'closed':0x1,'closedAt':moment()[_0xa5a1('0xc')](_0xa5a1('0xd')),'closeReason':_0xa5a1('0xe'),'disposition':_0x3c008a[0x0]};if(rpc[_0x9018b1['channel']+'Interaction']){rpc[_0x9018b1[_0xa5a1('0xf')]+'Interaction'][_0xa5a1('0x10')](_0x9018b1['interaction']['id'],_0x2cf7bb)['then'](function(_0x2019d0){logger[_0xa5a1('0xa')](_0xa5a1('0x11'),_0x5b1455,_0x9018b1[_0xa5a1('0x12')]['id']);})[_0xa5a1('0x13')](function(_0x53fbca){logger['error'](_0xa5a1('0x14'),_0x5b1455,JSON['stringify'](_0x53fbca));})['finally'](function(){_0x1218be['stop']();});}}catch(_0x5bcc97){logger[_0xa5a1('0x15')](_0xa5a1('0x14'),_0x5b1455,JSON[_0xa5a1('0x16')](_0x5bcc97));_0x1218be[_0xa5a1('0x17')]();}};}; \ No newline at end of file +var _0xb850=['YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','stringify','finally','stop','error','[%s][CLOSE]\x20%s','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x1587e2,_0x4874ce){var _0x5ff193=function(_0x496f70){while(--_0x496f70){_0x1587e2['push'](_0x1587e2['shift']());}};_0x5ff193(++_0x4874ce);}(_0xb850,0x1c3));var _0x0b85=function(_0x57ff9f,_0x43f627){_0x57ff9f=_0x57ff9f-0x0;var _0x14be3d=_0xb850[_0x57ff9f];return _0x14be3d;};'use strict';var moment=require(_0x0b85('0x0'));var logger=require('../../../../config/logger')(_0x0b85('0x1'));var rpc={'chatInteraction':require(_0x0b85('0x2')),'openchannelInteraction':require(_0x0b85('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x0b85('0x4')),'faxInteraction':require(_0x0b85('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x0b85('0x6')]=function(_0x52a6c7,_0x2074a6,_0x345895,_0x5d1a56){return function(_0x59d2b4){try{logger['info'](_0x0b85('0x7'),_0x52a6c7,_0x2074a6[0x0]);var _0x53a17e={'closed':0x1,'closedAt':moment()[_0x0b85('0x8')](_0x0b85('0x9')),'closeReason':_0x0b85('0xa'),'disposition':_0x2074a6[0x0]};if(rpc[_0x5d1a56[_0x0b85('0xb')]+_0x0b85('0xc')]){rpc[_0x5d1a56[_0x0b85('0xb')]+_0x0b85('0xc')][_0x0b85('0xd')](_0x5d1a56[_0x0b85('0xe')]['id'],_0x53a17e)[_0x0b85('0xf')](function(_0x497b03){logger['info'](_0x0b85('0x10'),_0x52a6c7,_0x5d1a56[_0x0b85('0xe')]['id']);})[_0x0b85('0x11')](function(_0x39b2e3){logger['error']('[%s][CLOSE]\x20%s',_0x52a6c7,JSON[_0x0b85('0x12')](_0x39b2e3));})[_0x0b85('0x13')](function(){_0x59d2b4[_0x0b85('0x14')]();});}}catch(_0x411462){logger[_0x0b85('0x15')](_0x0b85('0x16'),_0x52a6c7,JSON['stringify'](_0x411462));_0x59d2b4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 4797f2f..10f674b 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7374=['out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','result','fulfillment','speech','providerName','dialogflow','metadata','endConversation','stop','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact'];(function(_0x11d962,_0x16d1e2){var _0x48d902=function(_0x186f68){while(--_0x186f68){_0x11d962['push'](_0x11d962['shift']());}};_0x48d902(++_0x16d1e2);}(_0x7374,0x1b9));var _0x4737=function(_0x447905,_0x3745ed){_0x447905=_0x447905-0x0;var _0x4c927a=_0x7374[_0x447905];return _0x4c927a;};'use strict';var _=require(_0x4737('0x0'));var moment=require(_0x4737('0x1'));var apiai=require(_0x4737('0x2'));var md5=require(_0x4737('0x3'));var utils=require(_0x4737('0x4'));var logger=require('../../../../config/logger')(_0x4737('0x5'));var rpc={'chatMessage':require(_0x4737('0x6')),'openchannelMessage':require(_0x4737('0x7')),'mailMessage':require(_0x4737('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4737('0x9'))};exports[_0x4737('0xa')]=function(_0x311410,_0x3d18dd){return function(_0x4f9804){try{if(!_[_0x4737('0xb')](this[_0x4737('0xc')][_0x4737('0xd')])){logger[_0x4737('0xe')](_0x4737('0xf'),_0x311410,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4f9804[_0x4737('0x10')]();}var _0x3a51a8={'ContactId':this[_0x4737('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4737('0x12')};if(this[_0x4737('0x13')]===_0x4737('0x14')||this[_0x4737('0x13')]===_0x4737('0x15')){_0x3a51a8[_0x4737('0x16')]=this[_0x4737('0xc')][_0x4737('0x16')];}var _0x130705=this['channel'];if(_0x130705===_0x4737('0x17')){_0x3a51a8[_0x4737('0x18')]=this[_0x4737('0x19')]['id'];}else{_0x3a51a8[_[_0x4737('0x1a')](_0x130705)+_0x4737('0x1b')]=this['account']['id'];}_0x3a51a8[_['upperFirst'](_0x130705)+_0x4737('0x1c')]=this['interaction']['id'];if(this[_0x4737('0xc')][_0x4737('0x1d')]){var _0x5f415d=_0x3d18dd[0x2];if(!_[_0x4737('0x1e')](_0x5f415d)){_0x3a51a8[_0x4737('0x1f')]=utils[_0x4737('0x20')](_0x5f415d,this);return rpc[_0x130705+'Message'][_0x4737('0x21')](_0x3a51a8)['then'](function(_0x37b74d){logger[_0x4737('0xe')](_0x4737('0xf'),_0x311410,_0x3a51a8[_0x4737('0x1f')]);})[_0x4737('0x22')](function(_0x4f1b09){logger[_0x4737('0x23')](_0x4737('0xf'),_0x311410,JSON[_0x4737('0x24')](_0x4f1b09));})[_0x4737('0x25')](function(){logger['info'](_0x4737('0x26'),_0x311410);_0x4f9804['stop']();});}else{logger[_0x4737('0xe')](_0x4737('0x27'),_0x311410);_0x4f9804['stop']();}}else{var _0x67fac=this;var _0x1c004f=apiai(_0x3d18dd[0x0],{'language':_0x3d18dd[0x1]||'en'});return _0x1c004f[_0x4737('0x28')](this[_0x4737('0x29')]['body'],{'sessionId':md5(this[_0x4737('0xc')]['id'])})[_0x4737('0x2a')](function(_0x49eddf){_0x67fac[_0x4737('0x1f')]['dialogflow']=_0x49eddf;_0x3a51a8[_0x4737('0x1f')]=_0x49eddf[_0x4737('0x2b')][_0x4737('0x2c')][_0x4737('0x2d')];_0x3a51a8[_0x4737('0x2e')]=_0x4737('0x2f');_0x3a51a8['providerResponse']=JSON[_0x4737('0x24')](_0x49eddf);return rpc[_0x130705+'Message'][_0x4737('0x21')](_0x3a51a8)['then'](function(_0x29618d){logger[_0x4737('0xe')](_0x4737('0xf'),_0x311410,_0x3a51a8['body']);if(_0x49eddf['result'][_0x4737('0x30')][_0x4737('0x31')]){_0x4f9804[_0x4737('0x10')]();}else{_0x4f9804[_0x4737('0x32')]();}})[_0x4737('0x22')](function(_0x5d6a2a){logger[_0x4737('0x23')](_0x4737('0xf'),_0x311410,JSON[_0x4737('0x24')](_0x5d6a2a));_0x4f9804[_0x4737('0x10')]();});})[_0x4737('0x22')](function(_0x2e1689){logger[_0x4737('0x23')](_0x4737('0xf'),_0x311410,_0x2e1689['message']);_0x4f9804[_0x4737('0x10')]();});}}catch(_0x365d66){logger[_0x4737('0x23')](_0x4737('0xf'),_0x311410,JSON[_0x4737('0x24')](_0x365d66));_0x4f9804[_0x4737('0x32')]();}};}; \ No newline at end of file +var _0x6596=['catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','body','dialogflow','result','fulfillment','speech','providerName','create','metadata','endConversation','error','message','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','then'];(function(_0x42ecb6,_0x521513){var _0xcb03fd=function(_0x2192c6){while(--_0x2192c6){_0x42ecb6['push'](_0x42ecb6['shift']());}};_0xcb03fd(++_0x521513);}(_0x6596,0x1d3));var _0x6659=function(_0x291554,_0x13ae4d){_0x291554=_0x291554-0x0;var _0x1a6980=_0x6596[_0x291554];return _0x1a6980;};'use strict';var _=require(_0x6659('0x0'));var moment=require(_0x6659('0x1'));var apiai=require('apiai-promise');var md5=require(_0x6659('0x2'));var utils=require(_0x6659('0x3'));var logger=require(_0x6659('0x4'))(_0x6659('0x5'));var rpc={'chatMessage':require(_0x6659('0x6')),'openchannelMessage':require(_0x6659('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6659('0x8')),'whatsappMessage':require(_0x6659('0x9'))};exports[_0x6659('0xa')]=function(_0x1ed458,_0x29292b){return function(_0x4a900d){try{if(!_['isNil'](this[_0x6659('0xb')][_0x6659('0xc')])){logger[_0x6659('0xd')](_0x6659('0xe'),_0x1ed458,_0x6659('0xf'));return _0x4a900d[_0x6659('0x10')]();}var _0x4e5c6c={'ContactId':this[_0x6659('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x6659('0x12')};if(this['channel']===_0x6659('0x13')||this[_0x6659('0x14')]===_0x6659('0x15')){_0x4e5c6c[_0x6659('0x16')]=this['interaction'][_0x6659('0x16')];}var _0x329ebc=this['channel'];if(_0x329ebc===_0x6659('0x17')){_0x4e5c6c[_0x6659('0x18')]=this[_0x6659('0x19')]['id'];}else{_0x4e5c6c[_[_0x6659('0x1a')](_0x329ebc)+_0x6659('0x1b')]=this[_0x6659('0x19')]['id'];}_0x4e5c6c[_['upperFirst'](_0x329ebc)+_0x6659('0x1c')]=this[_0x6659('0xb')]['id'];if(this[_0x6659('0xb')][_0x6659('0x1d')]){var _0x324fbc=_0x29292b[0x2];if(!_[_0x6659('0x1e')](_0x324fbc)){_0x4e5c6c['body']=utils['getMustacheRender'](_0x324fbc,this);return rpc[_0x329ebc+_0x6659('0x1f')]['create'](_0x4e5c6c)[_0x6659('0x20')](function(_0x38e4d6){logger['info'](_0x6659('0xe'),_0x1ed458,_0x4e5c6c['body']);})[_0x6659('0x21')](function(_0x1dc4f1){logger['error'](_0x6659('0xe'),_0x1ed458,JSON[_0x6659('0x22')](_0x1dc4f1));})[_0x6659('0x23')](function(){logger[_0x6659('0xd')](_0x6659('0x24'),_0x1ed458);_0x4a900d[_0x6659('0x25')]();});}else{logger[_0x6659('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1ed458);_0x4a900d[_0x6659('0x25')]();}}else{var _0x3506fd=this;var _0x314e40=apiai(_0x29292b[0x0],{'language':_0x29292b[0x1]||'en'});return _0x314e40[_0x6659('0x26')](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0xbad53f){_0x3506fd[_0x6659('0x27')][_0x6659('0x28')]=_0xbad53f;_0x4e5c6c[_0x6659('0x27')]=_0xbad53f[_0x6659('0x29')][_0x6659('0x2a')][_0x6659('0x2b')];_0x4e5c6c[_0x6659('0x2c')]=_0x6659('0x28');_0x4e5c6c['providerResponse']=JSON[_0x6659('0x22')](_0xbad53f);return rpc[_0x329ebc+_0x6659('0x1f')][_0x6659('0x2d')](_0x4e5c6c)['then'](function(_0x4f6787){logger[_0x6659('0xd')](_0x6659('0xe'),_0x1ed458,_0x4e5c6c['body']);if(_0xbad53f[_0x6659('0x29')][_0x6659('0x2e')][_0x6659('0x2f')]){_0x4a900d[_0x6659('0x10')]();}else{_0x4a900d[_0x6659('0x25')]();}})['catch'](function(_0x23ee05){logger[_0x6659('0x30')](_0x6659('0xe'),_0x1ed458,JSON[_0x6659('0x22')](_0x23ee05));_0x4a900d[_0x6659('0x10')]();});})['catch'](function(_0x32ba2a){logger[_0x6659('0x30')](_0x6659('0xe'),_0x1ed458,_0x32ba2a[_0x6659('0x31')]);_0x4a900d[_0x6659('0x10')]();});}}catch(_0x41094b){logger[_0x6659('0x30')]('[%s][DIALOGFLOW]\x20%s',_0x1ed458,JSON[_0x6659('0x22')](_0x41094b));_0x4a900d[_0x6659('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 34d8561..be4ab00 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3248=['intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','all','message','dialogflow','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','create','then','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','getMustacheRender','Message','catch','error','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE'];(function(_0x549fe1,_0x2e3bef){var _0x1b560a=function(_0x1c40b4){while(--_0x1c40b4){_0x549fe1['push'](_0x549fe1['shift']());}};_0x1b560a(++_0x2e3bef);}(_0x3248,0x1bc));var _0x8324=function(_0x5d8dc4,_0x484ddd){_0x5d8dc4=_0x5d8dc4-0x0;var _0x5961fa=_0x3248[_0x5d8dc4];return _0x5961fa;};'use strict';var _=require('lodash');var dialogflow=require(_0x8324('0x0'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x8324('0x1'));var logger=require(_0x8324('0x2'))(_0x8324('0x3'));var utils=require(_0x8324('0x4'));var rpc={'chatMessage':require(_0x8324('0x5')),'openchannelMessage':require(_0x8324('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8324('0x7')),'faxMessage':require(_0x8324('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x25ee7a,_0x459a62,_0x4302c5,_0x1514c0){return new Promise(function(_0x5a482d,_0x374820){var _0x114c03=_[_0x8324('0x9')](_0x4302c5);_0x114c03[_0x8324('0xa')]=_0x1514c0;return rpc[_0x459a62+'Message'][_0x8324('0xb')](_0x114c03)[_0x8324('0xc')](function(){logger['info'](_0x8324('0xd'),_0x25ee7a,_0x114c03[_0x8324('0xa')]);_0x5a482d();})['catch'](function(_0x50128c){logger['error'](_0x8324('0xd'),_0x25ee7a,JSON[_0x8324('0xe')](_0x50128c));_0x374820(_0x50128c);});});}exports[_0x8324('0xf')]=function(_0x3619ec,_0x5f4d08){return function(_0x296bda){try{if(!_[_0x8324('0x10')](this[_0x8324('0x11')][_0x8324('0x12')])){logger[_0x8324('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x3619ec,_0x8324('0x14'));return _0x296bda[_0x8324('0x15')]();}var _0x411e41={'ContactId':this[_0x8324('0x16')]['id'],'sentAt':moment()[_0x8324('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8324('0x18')};if(this[_0x8324('0x19')]===_0x8324('0x1a')||this[_0x8324('0x19')]==='whatsapp'){_0x411e41['phone']=this['interaction']['phone'];}var _0x1c4e04=this[_0x8324('0x19')];if(_0x1c4e04===_0x8324('0x1b')){_0x411e41[_0x8324('0x1c')]=this['account']['id'];}else{_0x411e41[_[_0x8324('0x1d')](_0x1c4e04)+_0x8324('0x1e')]=this[_0x8324('0x1f')]['id'];}_0x411e41[_[_0x8324('0x1d')](_0x1c4e04)+_0x8324('0x20')]=this['interaction']['id'];if(this[_0x8324('0x11')][_0x8324('0x21')]){var _0x165f4c=_0x5f4d08[0x4];if(!_['isEmpty'](_0x165f4c)){_0x411e41[_0x8324('0xa')]=utils[_0x8324('0x22')](_0x165f4c,this);return rpc[_0x1c4e04+_0x8324('0x23')][_0x8324('0xb')](_0x411e41)[_0x8324('0xc')](function(_0x4d0e92){logger[_0x8324('0x13')](_0x8324('0xd'),_0x3619ec,_0x411e41['body']);})[_0x8324('0x24')](function(_0xd50595){logger[_0x8324('0x25')](_0x8324('0xd'),_0x3619ec,JSON[_0x8324('0xe')](_0xd50595));})['finally'](function(){logger['info'](_0x8324('0x26'),_0x3619ec);_0x296bda[_0x8324('0x27')]();});}else{logger[_0x8324('0x13')](_0x8324('0x28'),_0x3619ec);_0x296bda[_0x8324('0x27')]();}}else{var _0x41e2fd=this;var _0x5b2a1a=_0x5f4d08[0x2][_0x8324('0x29')](/\\n/g,'\x0a');var _0x542154={'credentials':{'private_key':_0x5b2a1a,'client_email':_0x5f4d08[0x1]}};var _0x599563=new dialogflow[(_0x8324('0x2a'))](_0x542154);var _0x3afd87=_0x599563[_0x8324('0x2b')](_0x5f4d08[0x0],md5(_0x41e2fd[_0x8324('0x11')]['id']));var _0x312f7e={'session':_0x3afd87,'queryInput':{'text':{'text':_0x41e2fd['message']['body'],'languageCode':_0x5f4d08[0x3]||'en'}}};return _0x599563[_0x8324('0x2c')](_0x312f7e)['then'](function(_0x5ea108){if(_0x5ea108&&_0x5ea108[_0x8324('0x2d')]){_0x41e2fd['body']['dialogflowV2']=_0x5ea108;var _0x32a4c5=_0x5ea108[0x0];var _0x14f9e0=_0x32a4c5[_0x8324('0x2e')][_0x8324('0x2f')]&&_0x32a4c5['queryResult'][_0x8324('0x2f')][_0x8324('0x30')]?_0x32a4c5[_0x8324('0x2e')]['diagnosticInfo'][_0x8324('0x30')][_0x8324('0x31')][_0x8324('0x32')]:![];_0x41e2fd['body'][_0x8324('0x33')]=_0x32a4c5[_0x8324('0x2e')]['action'];_0x41e2fd[_0x8324('0xa')][_0x8324('0x34')]=_0x32a4c5[_0x8324('0x2e')][_0x8324('0x35')];_0x41e2fd[_0x8324('0xa')][_0x8324('0x36')]=_0x32a4c5[_0x8324('0x2e')][_0x8324('0x2f')]&&_0x32a4c5[_0x8324('0x2e')][_0x8324('0x2f')][_0x8324('0x30')]?_0x32a4c5['queryResult'][_0x8324('0x2f')][_0x8324('0x30')][_0x8324('0x31')][_0x8324('0x32')]:![];_0x41e2fd[_0x8324('0xa')][_0x8324('0x37')]=_0x32a4c5[_0x8324('0x2e')]['intent'][_0x8324('0x38')];_0x41e2fd[_0x8324('0xa')][_0x8324('0x39')]=_0x32a4c5[_0x8324('0x2e')][_0x8324('0x3a')][_0x8324('0x3b')];_0x41e2fd[_0x8324('0xa')][_0x8324('0x3c')]=_0x32a4c5['queryResult'][_0x8324('0x3a')][_0x8324('0x3d')];_0x41e2fd[_0x8324('0xa')][_0x8324('0x3e')]=_0x32a4c5[_0x8324('0x2e')][_0x8324('0x3f')];_0x41e2fd[_0x8324('0xa')][_0x8324('0x40')]=_0x32a4c5[_0x8324('0x2e')][_0x8324('0x41')];_0x41e2fd['body'][_0x8324('0x42')]=_0x32a4c5[_0x8324('0x2e')][_0x8324('0x43')];_0x411e41['providerName']=_0x8324('0x44');_0x411e41[_0x8324('0x45')]=JSON[_0x8324('0xe')](_0x5ea108);var _0x5dac5f=[];for(var _0x2ed870=0x0;_0x2ed870<_0x5ea108[_0x8324('0x2d')];_0x2ed870++){var _0x48bf39=_0x5ea108[_0x2ed870];if(_0x48bf39&&_0x48bf39['queryResult']&&_0x48bf39['queryResult'][_0x8324('0x46')]){_0x5dac5f['push'](createMessage(_0x3619ec,_0x1c4e04,_0x411e41,_0x48bf39[_0x8324('0x2e')][_0x8324('0x46')]));}}return Promise[_0x8324('0x47')](_0x5dac5f)[_0x8324('0xc')](function(){if(_0x14f9e0){_0x296bda[_0x8324('0x15')]();}else{_0x296bda[_0x8324('0x27')]();}})[_0x8324('0x24')](function(_0x5e1fb8){logger[_0x8324('0x25')](_0x8324('0xd'),_0x3619ec,JSON[_0x8324('0xe')](_0x5e1fb8));_0x296bda[_0x8324('0x15')]();});}})[_0x8324('0x24')](function(_0x5826a6){logger[_0x8324('0x25')](_0x8324('0xd'),_0x3619ec,_0x5826a6[_0x8324('0x48')]);_0x296bda[_0x8324('0x15')]();});}}catch(_0x3346eb){logger[_0x8324('0x25')]('[%s][DIALOGFLOWV2]\x20%s',_0x3619ec,JSON[_0x8324('0xe')](_0x3346eb));_0x296bda[_0x8324('0x27')]();}};}; \ No newline at end of file +var _0x40fd=['InteractionId','isEmpty','getMustacheRender','Message','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','intent','name','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','next','lodash','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','create','then','catch','error','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId'];(function(_0x2e334b,_0x426b6e){var _0x390570=function(_0x46a2a5){while(--_0x46a2a5){_0x2e334b['push'](_0x2e334b['shift']());}};_0x390570(++_0x426b6e);}(_0x40fd,0x187));var _0xd40f=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0x40fd[_0x542f45];return _0x38c609;};'use strict';var _=require(_0xd40f('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xd40f('0x1'));var moment=require('moment');var Promise=require(_0xd40f('0x2'));var logger=require(_0xd40f('0x3'))(_0xd40f('0x4'));var utils=require(_0xd40f('0x5'));var rpc={'chatMessage':require(_0xd40f('0x6')),'openchannelMessage':require(_0xd40f('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd40f('0x8')),'faxMessage':require(_0xd40f('0x9')),'whatsappMessage':require(_0xd40f('0xa'))};function createMessage(_0x4a0afc,_0x522053,_0x34e4b6,_0x55ef58){return new Promise(function(_0x2a64d2,_0x1481bd){var _0x2f6945=_['clone'](_0x34e4b6);_0x2f6945[_0xd40f('0xb')]=_0x55ef58;return rpc[_0x522053+'Message'][_0xd40f('0xc')](_0x2f6945)[_0xd40f('0xd')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x4a0afc,_0x2f6945[_0xd40f('0xb')]);_0x2a64d2();})[_0xd40f('0xe')](function(_0x1cdb90){logger[_0xd40f('0xf')](_0xd40f('0x10'),_0x4a0afc,JSON['stringify'](_0x1cdb90));_0x1481bd(_0x1cdb90);});});}exports[_0xd40f('0x11')]=function(_0x437726,_0x59decb){return function(_0xead8da){try{if(!_[_0xd40f('0x12')](this[_0xd40f('0x13')][_0xd40f('0x14')])){logger[_0xd40f('0x15')](_0xd40f('0x10'),_0x437726,_0xd40f('0x16'));return _0xead8da['next']();}var _0x3e7682={'ContactId':this[_0xd40f('0x17')]['id'],'sentAt':moment()[_0xd40f('0x18')](_0xd40f('0x19')),'direction':_0xd40f('0x1a')};if(this[_0xd40f('0x1b')]===_0xd40f('0x1c')||this[_0xd40f('0x1b')]===_0xd40f('0x1d')){_0x3e7682[_0xd40f('0x1e')]=this[_0xd40f('0x13')][_0xd40f('0x1e')];}var _0x57f865=this[_0xd40f('0x1b')];if(_0x57f865===_0xd40f('0x1f')){_0x3e7682[_0xd40f('0x20')]=this['account']['id'];}else{_0x3e7682[_[_0xd40f('0x21')](_0x57f865)+_0xd40f('0x22')]=this['account']['id'];}_0x3e7682[_[_0xd40f('0x21')](_0x57f865)+_0xd40f('0x23')]=this['interaction']['id'];if(this[_0xd40f('0x13')]['created']){var _0x4c9f72=_0x59decb[0x4];if(!_[_0xd40f('0x24')](_0x4c9f72)){_0x3e7682[_0xd40f('0xb')]=utils[_0xd40f('0x25')](_0x4c9f72,this);return rpc[_0x57f865+_0xd40f('0x26')][_0xd40f('0xc')](_0x3e7682)[_0xd40f('0xd')](function(_0xcdd492){logger['info'](_0xd40f('0x10'),_0x437726,_0x3e7682[_0xd40f('0xb')]);})[_0xd40f('0xe')](function(_0x540713){logger[_0xd40f('0xf')](_0xd40f('0x10'),_0x437726,JSON[_0xd40f('0x27')](_0x540713));})['finally'](function(){logger[_0xd40f('0x15')](_0xd40f('0x28'),_0x437726);_0xead8da[_0xd40f('0x29')]();});}else{logger[_0xd40f('0x15')](_0xd40f('0x2a'),_0x437726);_0xead8da[_0xd40f('0x29')]();}}else{var _0x5e342a=this;var _0xa3b7c8=_0x59decb[0x2][_0xd40f('0x2b')](/\\n/g,'\x0a');var _0x1467ba={'credentials':{'private_key':_0xa3b7c8,'client_email':_0x59decb[0x1]}};var _0x326440=new dialogflow[(_0xd40f('0x2c'))](_0x1467ba);var _0x5152df=_0x326440[_0xd40f('0x2d')](_0x59decb[0x0],md5(_0x5e342a['interaction']['id']));var _0x3c1a7d={'session':_0x5152df,'queryInput':{'text':{'text':_0x5e342a['message'][_0xd40f('0xb')],'languageCode':_0x59decb[0x3]||'en'}}};return _0x326440[_0xd40f('0x2e')](_0x3c1a7d)[_0xd40f('0xd')](function(_0x24249d){if(_0x24249d&&_0x24249d[_0xd40f('0x2f')]){_0x5e342a[_0xd40f('0xb')][_0xd40f('0x30')]=_0x24249d;var _0x9f3329=_0x24249d[0x0];var _0x1ff4a7=_0x9f3329['queryResult'][_0xd40f('0x31')]&&_0x9f3329[_0xd40f('0x32')][_0xd40f('0x31')][_0xd40f('0x33')]?_0x9f3329[_0xd40f('0x32')][_0xd40f('0x31')][_0xd40f('0x33')][_0xd40f('0x34')]['boolValue']:![];_0x5e342a[_0xd40f('0xb')][_0xd40f('0x35')]=_0x9f3329['queryResult'][_0xd40f('0x36')];_0x5e342a[_0xd40f('0xb')][_0xd40f('0x37')]=_0x9f3329[_0xd40f('0x32')][_0xd40f('0x38')];_0x5e342a[_0xd40f('0xb')][_0xd40f('0x39')]=_0x9f3329[_0xd40f('0x32')][_0xd40f('0x31')]&&_0x9f3329['queryResult']['diagnosticInfo']['fields']?_0x9f3329[_0xd40f('0x32')][_0xd40f('0x31')]['fields'][_0xd40f('0x34')][_0xd40f('0x3a')]:![];_0x5e342a['body']['DIALOGFLOWV2_INTENTNAME']=_0x9f3329['queryResult'][_0xd40f('0x3b')][_0xd40f('0x3c')];_0x5e342a['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x9f3329[_0xd40f('0x32')][_0xd40f('0x3b')]['displayName'];_0x5e342a[_0xd40f('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x9f3329[_0xd40f('0x32')][_0xd40f('0x3b')]['isFallback'];_0x5e342a[_0xd40f('0xb')][_0xd40f('0x3d')]=_0x9f3329[_0xd40f('0x32')][_0xd40f('0x3e')];_0x5e342a['body'][_0xd40f('0x3f')]=_0x9f3329[_0xd40f('0x32')]['queryText'];_0x5e342a[_0xd40f('0xb')][_0xd40f('0x40')]=_0x9f3329['queryResult'][_0xd40f('0x41')];_0x3e7682[_0xd40f('0x42')]='dialogflowV2';_0x3e7682[_0xd40f('0x43')]=JSON[_0xd40f('0x27')](_0x24249d);var _0x49676a=[];for(var _0x2cd32f=0x0;_0x2cd32f<_0x24249d[_0xd40f('0x2f')];_0x2cd32f++){var _0x5d7fdb=_0x24249d[_0x2cd32f];if(_0x5d7fdb&&_0x5d7fdb[_0xd40f('0x32')]&&_0x5d7fdb[_0xd40f('0x32')][_0xd40f('0x44')]){_0x49676a['push'](createMessage(_0x437726,_0x57f865,_0x3e7682,_0x5d7fdb['queryResult'][_0xd40f('0x44')]));}}return Promise[_0xd40f('0x45')](_0x49676a)['then'](function(){if(_0x1ff4a7){_0xead8da['next']();}else{_0xead8da[_0xd40f('0x29')]();}})[_0xd40f('0xe')](function(_0x2ce51c){logger[_0xd40f('0xf')](_0xd40f('0x10'),_0x437726,JSON[_0xd40f('0x27')](_0x2ce51c));_0xead8da[_0xd40f('0x46')]();});}})[_0xd40f('0xe')](function(_0x119168){logger[_0xd40f('0xf')](_0xd40f('0x10'),_0x437726,_0x119168['message']);_0xead8da[_0xd40f('0x46')]();});}}catch(_0x4d7b5b){logger[_0xd40f('0xf')](_0xd40f('0x10'),_0x437726,JSON[_0xd40f('0x27')](_0x4d7b5b));_0xead8da['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index bdd75bc..8f26094 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb015=['join','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','message'];(function(_0x2b4d7f,_0x1a1408){var _0x164f50=function(_0xfa02a4){while(--_0xfa02a4){_0x2b4d7f['push'](_0x2b4d7f['shift']());}};_0x164f50(++_0x1a1408);}(_0xb015,0x13f));var _0x5b01=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xb015[_0x39e84d];return _0x1991bc;};'use strict';var schema=require(_0x5b01('0x0'));var _=require(_0x5b01('0x1'));var htmlToText=require(_0x5b01('0x2'));var utils=require(_0x5b01('0x3'));var logger=require(_0x5b01('0x4'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x5b01('0x5')},'priorityTrue':{'type':_0x5b01('0x6'),'message':_0x5b01('0x7')},'priorityFalse':{'type':_0x5b01('0x6'),'message':_0x5b01('0x8')}});exports[_0x5b01('0x9')]=function(_0xff52c9,_0x1a48eb){return function(_0x4b321a){try{var _0x2333b1={'condition':htmlToText[_0x5b01('0xa')](utils[_0x5b01('0xb')](_0x1a48eb[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1a48eb[0x1],'priorityFalse':_0x1a48eb[0x2]};var _0x54b695=gotoif['validate'](_0x2333b1,{'typecast':!![]});if(_0x54b695[_0x5b01('0xc')]){logger[_0x5b01('0xd')](_0x5b01('0xe'),_0xff52c9,_[_0x5b01('0xf')](_0x54b695,_0x5b01('0x10'))[_0x5b01('0x11')](',\x20'));_0x4b321a[_0x5b01('0x12')]();}else{try{var _0x2538a5=eval('('+_0x2333b1[_0x5b01('0x13')]+')');var _0x2032fe=_0x2538a5?_0x2333b1[_0x5b01('0x14')]:_0x2333b1[_0x5b01('0x15')];logger[_0x5b01('0x16')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xff52c9,_0x2333b1[_0x5b01('0x13')],_0x2538a5,_0x2032fe||_0x5b01('0x17'));if(_0x2032fe){var _0x1e4933=_[_0x5b01('0x18')](_0x4b321a[_0x5b01('0x19')](),{'p':_0x2032fe});if(_0x1e4933>=0x0){logger[_0x5b01('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xff52c9,_0x2032fe||_0x5b01('0x17'),_0x1e4933);_0x4b321a['next'](_0x1e4933);}else{logger['info'](_0x5b01('0x1a'),_0xff52c9,_0x2032fe||'next');_0x4b321a[_0x5b01('0x12')]();}}else{_0x4b321a[_0x5b01('0x17')]();}}catch(_0x539592){logger['error'](_0x5b01('0x1b'),_0xff52c9,_0x539592[_0x5b01('0x10')]);_0x4b321a[_0x5b01('0x12')]();}}}catch(_0x42e240){logger[_0x5b01('0xd')](_0x5b01('0xe'),_0xff52c9,JSON['stringify'](_0x42e240));_0x4b321a[_0x5b01('0x12')]();}};}; \ No newline at end of file +var _0x70eb=['condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','message','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70eb,0x10f));var _0xb70e=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x70eb[_0x485b5a];return _0xd2b34d;};'use strict';var schema=require('validate');var _=require(_0xb70e('0x0'));var htmlToText=require(_0xb70e('0x1'));var utils=require(_0xb70e('0x2'));var logger=require('../../../../config/logger')(_0xb70e('0x3'));var gotoif=schema({'condition':{'type':_0xb70e('0x4'),'required':!![],'message':_0xb70e('0x5')},'priorityTrue':{'type':_0xb70e('0x6'),'message':_0xb70e('0x7')},'priorityFalse':{'type':_0xb70e('0x6'),'message':_0xb70e('0x8')}});exports[_0xb70e('0x9')]=function(_0x1afa3a,_0x11875f){return function(_0x4f673f){try{var _0x4bbbc0={'condition':htmlToText[_0xb70e('0xa')](utils[_0xb70e('0xb')](_0x11875f[0x0],this),{'wordwrap':![]})[_0xb70e('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x11875f[0x1],'priorityFalse':_0x11875f[0x2]};var _0xe799=gotoif[_0xb70e('0xd')](_0x4bbbc0,{'typecast':!![]});if(_0xe799[_0xb70e('0xe')]){logger[_0xb70e('0xf')](_0xb70e('0x10'),_0x1afa3a,_['map'](_0xe799,_0xb70e('0x11'))['join'](',\x20'));_0x4f673f[_0xb70e('0x12')]();}else{try{var _0x560487=eval('('+_0x4bbbc0[_0xb70e('0x13')]+')');var _0x5b130b=_0x560487?_0x4bbbc0['priorityTrue']:_0x4bbbc0[_0xb70e('0x14')];logger['info'](_0xb70e('0x15'),_0x1afa3a,_0x4bbbc0['condition'],_0x560487,_0x5b130b||'next');if(_0x5b130b){var _0x4f19d2=_[_0xb70e('0x16')](_0x4f673f[_0xb70e('0x17')](),{'p':_0x5b130b});if(_0x4f19d2>=0x0){logger[_0xb70e('0x18')](_0xb70e('0x19'),_0x1afa3a,_0x5b130b||'next',_0x4f19d2);_0x4f673f[_0xb70e('0x1a')](_0x4f19d2);}else{logger[_0xb70e('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1afa3a,_0x5b130b||_0xb70e('0x1a'));_0x4f673f[_0xb70e('0x12')]();}}else{_0x4f673f[_0xb70e('0x1a')]();}}catch(_0xc7bf55){logger[_0xb70e('0xf')](_0xb70e('0x1b'),_0x1afa3a,_0xc7bf55[_0xb70e('0x11')]);_0x4f673f[_0xb70e('0x12')]();}}}catch(_0x1c20eb){logger[_0xb70e('0xf')](_0xb70e('0x10'),_0x1afa3a,JSON[_0xb70e('0x1c')](_0x1c20eb));_0x4f673f[_0xb70e('0x12')]();}};}; \ 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 6e0456d..8f94909 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 _0x95fe=['info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','join','stop','priority','findIndex','rules'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x95fe,0x113));var _0xe95f=function(_0x185656,_0x36b620){_0x185656=_0x185656-0x0;var _0x24a077=_0x95fe[_0x185656];return _0x24a077;};'use strict';var schema=require(_0xe95f('0x0'));var _=require(_0xe95f('0x1'));var logger=require(_0xe95f('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xe95f('0x3')}});exports[_0xe95f('0x4')]=function(_0x57031d,_0x5f0344){return function(_0x21caf3){try{var _0xf77365={'priority':_0x5f0344[0x0]};var _0x2af680=gotop['validate'](_0xf77365,{'typecast':!![]});if(_0x2af680['length']){logger[_0xe95f('0x5')](_0xe95f('0x6'),_0x57031d,_[_0xe95f('0x7')](_0x2af680,'message')[_0xe95f('0x8')](',\x20'));_0x21caf3[_0xe95f('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x57031d,_0xf77365[_0xe95f('0xa')]);if(_0xf77365[_0xe95f('0xa')]){var _0x40beea=_[_0xe95f('0xb')](_0x21caf3[_0xe95f('0xc')](),{'p':_0xf77365['priority']});if(_0x40beea>=0x0){logger[_0xe95f('0xd')](_0xe95f('0xe'),_0x57031d,_0xf77365[_0xe95f('0xa')]||_0xe95f('0xf'),_0x40beea);_0x21caf3[_0xe95f('0xf')](_0x40beea);}else{logger[_0xe95f('0xd')](_0xe95f('0x10'),_0x57031d,_0xf77365[_0xe95f('0xa')]||_0xe95f('0xf'));_0x21caf3[_0xe95f('0x9')]();}}else{_0x21caf3[_0xe95f('0xf')]();}}}catch(_0xa49e72){logger[_0xe95f('0x5')](_0xe95f('0x6'),_0x57031d,JSON[_0xe95f('0x11')](_0xa49e72));_0x21caf3[_0xe95f('0x9')]();}};}; \ No newline at end of file +var _0xb0bb=['consequence','validate','error','map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x4d43cb,_0x3b4cdf){var _0x2f32c5=function(_0x1ca2bc){while(--_0x1ca2bc){_0x4d43cb['push'](_0x4d43cb['shift']());}};_0x2f32c5(++_0x3b4cdf);}(_0xb0bb,0xe0));var _0xbb0b=function(_0x187bee,_0x1ed07b){_0x187bee=_0x187bee-0x0;var _0x110f90=_0xb0bb[_0x187bee];return _0x110f90;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xbb0b('0x0'))(_0xbb0b('0x1'));var gotop=schema({'priority':{'type':_0xbb0b('0x2'),'required':!![],'message':_0xbb0b('0x3')}});exports[_0xbb0b('0x4')]=function(_0xef5774,_0x58191b){return function(_0x19fded){try{var _0x400750={'priority':_0x58191b[0x0]};var _0x11b94b=gotop[_0xbb0b('0x5')](_0x400750,{'typecast':!![]});if(_0x11b94b['length']){logger[_0xbb0b('0x6')]('[%s][GOTOP]\x20%s',_0xef5774,_[_0xbb0b('0x7')](_0x11b94b,_0xbb0b('0x8'))[_0xbb0b('0x9')](',\x20'));_0x19fded[_0xbb0b('0xa')]();}else{logger[_0xbb0b('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0xef5774,_0x400750['priority']);if(_0x400750[_0xbb0b('0xc')]){var _0x18c823=_[_0xbb0b('0xd')](_0x19fded[_0xbb0b('0xe')](),{'p':_0x400750['priority']});if(_0x18c823>=0x0){logger[_0xbb0b('0xb')](_0xbb0b('0xf'),_0xef5774,_0x400750[_0xbb0b('0xc')]||_0xbb0b('0x10'),_0x18c823);_0x19fded['next'](_0x18c823);}else{logger[_0xbb0b('0xb')](_0xbb0b('0x11'),_0xef5774,_0x400750[_0xbb0b('0xc')]||_0xbb0b('0x10'));_0x19fded['stop']();}}else{_0x19fded[_0xbb0b('0x10')]();}}}catch(_0x596340){logger[_0xbb0b('0x6')](_0xbb0b('0x12'),_0xef5774,JSON['stringify'](_0x596340));_0x19fded[_0xbb0b('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 5e1a4a9..17433e0 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 _0x936d=['Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stop','error','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','upperFirst','channel','account','InteractionId','interaction'];(function(_0x431689,_0x175548){var _0x5f1520=function(_0x56eeaa){while(--_0x56eeaa){_0x431689['push'](_0x431689['shift']());}};_0x5f1520(++_0x175548);}(_0x936d,0x183));var _0xd936=function(_0xaefeaf,_0x3d60e9){_0xaefeaf=_0xaefeaf-0x0;var _0x4d9c0c=_0x936d[_0xaefeaf];return _0x4d9c0c;};'use strict';var _=require(_0xd936('0x0'));var utils=require(_0xd936('0x1'));var logger=require(_0xd936('0x2'))(_0xd936('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd936('0x4')),'mailMessage':require(_0xd936('0x5')),'smsMessage':require(_0xd936('0x6')),'faxMessage':require(_0xd936('0x7')),'whatsappMessage':require(_0xd936('0x8'))};exports[_0xd936('0x9')]=function(_0x29853b,_0x5ace28){return function(_0x1714d7){try{var _0x1eac11={'body':utils[_0xd936('0xa')](_0x5ace28[0x0],this),'ContactId':this[_0xd936('0xb')]['id']};if(this['channel']===_0xd936('0xc')){_0x1eac11[_0xd936('0xd')]=this['account']['id'];}else{_0x1eac11[_[_0xd936('0xe')](this[_0xd936('0xf')])+'AccountId']=this[_0xd936('0x10')]['id'];}_0x1eac11[_['upperFirst'](this[_0xd936('0xf')])+_0xd936('0x11')]=this[_0xd936('0x12')]['id'];if(rpc[this[_0xd936('0xf')]+_0xd936('0x13')]){return rpc[this[_0xd936('0xf')]+_0xd936('0x13')][_0xd936('0x14')](_0x1eac11)[_0xd936('0x15')](function(_0x884e08){logger[_0xd936('0x16')](_0xd936('0x17'),_0x29853b,_0x1eac11['body']);_0x1714d7[_0xd936('0x18')]();})[_0xd936('0x19')](function(_0xae89f4){logger['error']('[%s][MESSAGE]\x20%s',_0x29853b,JSON['stringify'](_0xae89f4));_0x1714d7[_0xd936('0x1a')]();});}}catch(_0x38a890){logger[_0xd936('0x1b')](_0xd936('0x17'),_0x29853b,JSON[_0xd936('0x1c')](_0x38a890));_0x1714d7[_0xd936('0x1a')]();}};}; \ No newline at end of file +var _0x7fee=['[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','AccountId','upperFirst','Message','create','then','info'];(function(_0x318c52,_0x155bf8){var _0x17a986=function(_0x5ae464){while(--_0x5ae464){_0x318c52['push'](_0x318c52['shift']());}};_0x17a986(++_0x155bf8);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x7fee[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xe7fe('0x0'));var utils=require(_0xe7fe('0x1'));var logger=require(_0xe7fe('0x2'))(_0xe7fe('0x3'));var rpc={'chatMessage':require(_0xe7fe('0x4')),'openchannelMessage':require(_0xe7fe('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xe7fe('0x6')),'faxMessage':require(_0xe7fe('0x7')),'whatsappMessage':require(_0xe7fe('0x8'))};exports['consequence']=function(_0x2db068,_0x5b6d58){return function(_0x183b0b){try{var _0xeca7d9={'body':utils[_0xe7fe('0x9')](_0x5b6d58[0x0],this),'ContactId':this[_0xe7fe('0xa')]['id']};if(this[_0xe7fe('0xb')]===_0xe7fe('0xc')){_0xeca7d9[_0xe7fe('0xd')]=this['account']['id'];}else{_0xeca7d9[_['upperFirst'](this['channel'])+_0xe7fe('0xe')]=this['account']['id'];}_0xeca7d9[_[_0xe7fe('0xf')](this[_0xe7fe('0xb')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xe7fe('0xb')]+_0xe7fe('0x10')]){return rpc[this['channel']+_0xe7fe('0x10')][_0xe7fe('0x11')](_0xeca7d9)[_0xe7fe('0x12')](function(_0x4a6aa2){logger[_0xe7fe('0x13')](_0xe7fe('0x14'),_0x2db068,_0xeca7d9[_0xe7fe('0x15')]);_0x183b0b['next']();})[_0xe7fe('0x16')](function(_0x29e745){logger[_0xe7fe('0x17')](_0xe7fe('0x14'),_0x2db068,JSON[_0xe7fe('0x18')](_0x29e745));_0x183b0b[_0xe7fe('0x19')]();});}}catch(_0x14172e){logger[_0xe7fe('0x17')](_0xe7fe('0x14'),_0x2db068,JSON[_0xe7fe('0x18')](_0x14172e));_0x183b0b[_0xe7fe('0x19')]();}};}; \ 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 3dcfa45..1518d34 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 _0xc524=['stringify','stop','../../../../config/logger','consequence','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0xc524,0x140));var _0x4c52=function(_0x31e348,_0x2dff63){_0x31e348=_0x31e348-0x0;var _0x2c87f7=_0xc524[_0x31e348];return _0x2c87f7;};'use strict';var utils=require('./utils');var logger=require(_0x4c52('0x0'))('routing');exports[_0x4c52('0x1')]=function(_0x5051a6,_0x179081){return function(_0x249f69){try{logger['info'](_0x4c52('0x2'),_0x5051a6,utils[_0x4c52('0x3')](_0x179081[0x0],this));_0x249f69['next']();}catch(_0x2b9161){logger['error'](_0x4c52('0x2'),_0x5051a6,JSON[_0x4c52('0x4')](_0x2b9161));_0x249f69[_0x4c52('0x5')]();}};}; \ No newline at end of file +var _0x7227=['info','next','error','[%s][NOOP]\x20%s','stop','./utils','../../../../config/logger','consequence'];(function(_0x518502,_0x23df26){var _0x59791d=function(_0x1a9845){while(--_0x1a9845){_0x518502['push'](_0x518502['shift']());}};_0x59791d(++_0x23df26);}(_0x7227,0x12d));var _0x7722=function(_0x214140,_0x273e62){_0x214140=_0x214140-0x0;var _0x1f45fa=_0x7227[_0x214140];return _0x1f45fa;};'use strict';var utils=require(_0x7722('0x0'));var logger=require(_0x7722('0x1'))('routing');exports[_0x7722('0x2')]=function(_0x442682,_0x226851){return function(_0x1c0a4f){try{logger[_0x7722('0x3')]('[%s][NOOP]\x20%s',_0x442682,utils['getMustacheRender'](_0x226851[0x0],this));_0x1c0a4f[_0x7722('0x4')]();}catch(_0x3d3e9e){logger[_0x7722('0x5')](_0x7722('0x6'),_0x442682,JSON['stringify'](_0x3d3e9e));_0x1c0a4f[_0x7722('0x7')]();}};}; \ 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 9f5a3c2..1be2e56 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 _0x7509=['[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','InteractionId','interaction','upperFirst','MessageId','message','AccountId','info','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length'];(function(_0x20319,_0x486248){var _0x30ee2a=function(_0x5d4766){while(--_0x5d4766){_0x20319['push'](_0x20319['shift']());}};_0x30ee2a(++_0x486248);}(_0x7509,0xf0));var _0x9750=function(_0x3f64b3,_0x1a7b39){_0x3f64b3=_0x3f64b3-0x0;var _0x451889=_0x7509[_0x3f64b3];return _0x451889;};'use strict';var schema=require(_0x9750('0x0'));var _=require(_0x9750('0x1'));var util=require(_0x9750('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require('ioredis');var config=require(_0x9750('0x3'));var logger=require(_0x9750('0x4'))('routing');var strategy=require(_0x9750('0x5'));config[_0x9750('0x6')]=_[_0x9750('0x7')](config[_0x9750('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9750('0x8'))(new Redis(config[_0x9750('0x6')]));var attributes=['id',_0x9750('0x9'),_0x9750('0xa'),_0x9750('0xb'),_0x9750('0xc'),_0x9750('0xd')];function emit(_0x15e3d9,_0x4793f5,_0x400de1){io['to'](_0x15e3d9)[_0x9750('0xe')](_0x4793f5,_0x400de1);}function emitChannelQueueInteraction(_0xa640d8,_0x5c0c11,_0x45bbde,_0x2f7008,_0x6b5c9,_0x4e2e80,_0x32d670,_0x186898){var _0x24e492=_['clone'](_0x45bbde);_0x24e492['queue_id']=_0x186898;_0x24e492[_0x9750('0xb')]=_0x5c0c11;_0x24e492['account']=_0x2f7008;_0x24e492['id']=_0x6b5c9;if(_0x4e2e80){_0x32d670[util[_0x9750('0xf')](_0x9750('0x10'),_0xa640d8)][_0x6b5c9]=_[_0x9750('0x11')](_0x24e492,attributes);}else{delete _0x32d670[util[_0x9750('0xf')](_0x9750('0x10'),_0xa640d8)][_0x6b5c9];}emit(util[_0x9750('0xf')](_0x9750('0x12'),_0xa640d8,_0x5c0c11),util[_0x9750('0xf')](_0x9750('0x13'),_0xa640d8,_0x4e2e80?_0x9750('0x14'):_0x9750('0x15')),_['pick'](_0x24e492,attributes));}var rpc={'openchannelQueueReport':require(_0x9750('0x16')),'mailQueueReport':require(_0x9750('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x9750('0x18')),'whatsappQueueReport':require(_0x9750('0x19'))};var queue=schema({'name':{'type':_0x9750('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9750('0x1b'),'message':_0x9750('0x1c')}});function startRouting(_0x4d6a58,_0x922c51,_0x1e69b5,_0x4070c2){if(_0x4d6a58&&_0x922c51&&_0x1e69b5){_0x922c51[_0x9750('0x1d')]+=0x1;var _0x463412={'uniqueid':_0x4d6a58,'from':_0x1e69b5[_0x9750('0x1e')]?_0x1e69b5[_0x9750('0x1e')][_0x9750('0xc')]:'','joinAt':moment()[_0x9750('0xf')](_0x9750('0x1f')),'ContactId':_0x1e69b5[_0x9750('0x20')]?_0x1e69b5[_0x9750('0x20')]['id']:null,'ListId':_0x1e69b5['list']?_0x1e69b5[_0x9750('0x21')]['id']:null};_0x463412[_['upperFirst'](_0x1e69b5[_0x9750('0x22')])+_0x9750('0x23')]=_0x922c51['id']||null;_0x463412[_['upperFirst'](_0x1e69b5['channel'])+_0x9750('0x24')]=_0x1e69b5['interaction']?_0x1e69b5[_0x9750('0x25')]['id']:null;_0x463412[_[_0x9750('0x26')](_0x1e69b5[_0x9750('0x22')])+_0x9750('0x27')]=_0x1e69b5['message']?_0x1e69b5[_0x9750('0x28')]['id']:null;_0x463412[_['upperFirst'](_0x1e69b5[_0x9750('0x22')])+(_0x1e69b5[_0x9750('0x22')]!=='chat'?_0x9750('0x29'):'WebsiteId')]=_0x1e69b5['account']?_0x1e69b5['account']['id']:null;logger[_0x9750('0x2a')](util[_0x9750('0xf')]('[%s][START:QUEUE][NAME:%s]',_0x4d6a58,_0x922c51[_0x9750('0x2b')]));emitChannelQueueInteraction(_0x1e69b5[_0x9750('0x22')],_0x922c51['name'],_0x463412,_0x1e69b5['account'][_0x9750('0x2b')],_0x1e69b5['message']['id'],!![],_0x4070c2,_0x922c51['id']);if(rpc[_0x1e69b5[_0x9750('0x22')]+_0x9750('0x2c')]){return rpc[_0x1e69b5[_0x9750('0x22')]+_0x9750('0x2c')][_0x9750('0x2d')](_0x463412)[_0x9750('0x2e')](function(_0x242d27){logger['error'](_0x9750('0x2f'));});}}}function stopRouting(_0x14b0cf,_0x1c07a4,_0x4bce06,_0x48d9f7){if(_0x14b0cf&&_0x1c07a4){_0x1c07a4['waiting']-=0x1;var _0x203166={'leaveAt':moment()[_0x9750('0xf')](_0x9750('0x1f')),'acceptAt':moment()[_0x9750('0xf')](_0x9750('0x1f')),'reason':_0x9750('0x30')};logger[_0x9750('0x2a')](util[_0x9750('0xf')](_0x9750('0x31'),_0x14b0cf,_0x1c07a4[_0x9750('0x2b')]));emitChannelQueueInteraction(_0x4bce06[_0x9750('0x22')],_0x1c07a4[_0x9750('0x2b')],_0x4bce06[_0x9750('0x1e')],_0x4bce06['account'][_0x9750('0x2b')],_0x4bce06[_0x9750('0x28')]['id'],![],_0x48d9f7,_0x1c07a4['id']);if(rpc[_0x4bce06[_0x9750('0x22')]+_0x9750('0x2c')]){return rpc[_0x4bce06[_0x9750('0x22')]+_0x9750('0x2c')]['update'](_0x14b0cf,_0x203166)[_0x9750('0x2e')](function(_0xc7eafe){logger[_0x9750('0x32')](_0x9750('0x33'));});}}}function endRouting(_0x313ee0,_0x3adbd8,_0x4eedac,_0x345af3){if(_0x313ee0&&_0x3adbd8){_0x3adbd8[_0x9750('0x1d')]-=0x1;var _0x3c49a6={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x9750('0xf')](_0x9750('0x1f')),'reason':_0x9750('0x34')};logger[_0x9750('0x2a')](util[_0x9750('0xf')](_0x9750('0x35'),_0x313ee0,_0x3adbd8[_0x9750('0x2b')]));emitChannelQueueInteraction(_0x4eedac[_0x9750('0x22')],_0x3adbd8[_0x9750('0x2b')],_0x4eedac[_0x9750('0x1e')],_0x4eedac[_0x9750('0xa')][_0x9750('0x2b')],_0x4eedac['message']['id'],![],_0x345af3);if(rpc[_0x4eedac['channel']+_0x9750('0x2c')]){return rpc[_0x4eedac['channel']+_0x9750('0x2c')]['update'](_0x313ee0,_0x3c49a6)[_0x9750('0x2e')](function(_0x54a87c){logger[_0x9750('0x32')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x593bc3){return function(_0x24ea5c){return _0x24ea5c[_0x9750('0x2b')]['toLowerCase']()===_0x593bc3[_0x9750('0x36')]();};}exports['consequence']=function(_0x3fe74a,_0x113f34,_0x4b9d8d,_0x49189b){return function(_0x100296){try{var _0x4e330e={'name':_0x113f34[0x0],'timeout':_0x113f34[0x1]};var _0x3abde8=queue[_0x9750('0x0')](_0x4e330e,{'typecast':!![]});if(_0x3abde8[_0x9750('0x37')]){logger[_0x9750('0x32')](_0x9750('0x38'),_0x3fe74a,_[_0x9750('0x39')](_0x3abde8,_0x9750('0x28'))[_0x9750('0x3a')](',\x20'));_0x100296[_0x9750('0x3b')]();}else{var _0x53d9e4=_[_0x9750('0x3c')](_0x4b9d8d[_0x49189b[_0x9750('0x22')]+'Queues'],handleFindQueue(_0x4e330e[_0x9750('0x2b')]));if(_0x53d9e4){startRouting(_0x3fe74a,_0x53d9e4,_0x49189b,_0x4b9d8d);var _0x1cc8a9=(_0x53d9e4[_0x9750('0x34')]||0xa)*0x3e8;var _0x3a0fec=(_0x4e330e[_0x9750('0x34')]||0x14)*0x3e8;var _0x99c317,_0x45e32c;if(_0x1cc8a9>_0x3a0fec){_0x3a0fec=_0x1cc8a9;}var _0x56b498=seqqueue[_0x9750('0x3d')](_0x1cc8a9);_0x56b498['id']=_0x3fe74a;_0x56b498[_0x9750('0x3e')]=_0x1cc8a9;_0x56b498['qtimeout']=_0x3a0fec;_0x56b498['channel']=_0x49189b[_0x9750('0x22')];_0x4b9d8d[_0x9750('0x3f')][_0x3fe74a]['on'](_0x9750('0x40'),function(){logger[_0x9750('0x2a')](_0x9750('0x41'),_0x3fe74a);stopRouting(_0x3fe74a,_0x53d9e4,_0x49189b,_0x4b9d8d);clearTimeout(_0x99c317);_0x99c317=undefined;_0x56b498[_0x9750('0x42')](!![]);if(_0x4b9d8d[_0x9750('0x3f')][_0x3fe74a]){delete _0x4b9d8d['rules'][_0x3fe74a];}_0x100296['stop']();});_0x4b9d8d['rules'][_0x3fe74a]['on']('complete',function(){if(_0x4b9d8d[_0x9750('0x3f')][_0x3fe74a]){delete _0x4b9d8d[_0x9750('0x3f')][_0x3fe74a];}});_0x99c317=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x3fe74a);endRouting(_0x3fe74a,_0x53d9e4,_0x49189b,_0x4b9d8d);clearTimeout(_0x99c317);_0x56b498[_0x9750('0x42')](!![]);_0x100296[_0x9750('0x43')]();},_0x3a0fec);switch(_0x53d9e4[_0x9750('0x44')]){case'rrmemory':strategy[_0x9750('0x45')](_0x56b498,_0x53d9e4,_0x4b9d8d,_0x49189b);break;default:strategy[_0x9750('0x46')](_0x56b498,_0x53d9e4,_0x4b9d8d,_0x49189b);}}else{logger[_0x9750('0x32')](_0x9750('0x47'),_0x3fe74a,_0x4e330e[_0x9750('0x2b')]);_0x100296[_0x9750('0x3b')]();}}}catch(_0x3c88a7){console[_0x9750('0x48')](_0x3c88a7);logger['error'](_0x9750('0x38'),_0x3fe74a,_0x3c88a7[_0x9750('0x49')]);_0x100296[_0x9750('0x3b')]();}};}; \ No newline at end of file +var _0x16bf=['qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','lodash','seq-queue','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','socket.io-emitter','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','timeout','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout'];(function(_0x203e66,_0x51d1c1){var _0x47c89c=function(_0x35da3b){while(--_0x35da3b){_0x203e66['push'](_0x203e66['shift']());}};_0x47c89c(++_0x51d1c1);}(_0x16bf,0x178));var _0xf16b=function(_0x40bfc0,_0x16ee63){_0x40bfc0=_0x40bfc0-0x0;var _0x47c5b6=_0x16bf[_0x40bfc0];return _0x47c5b6;};'use strict';var schema=require('validate');var _=require(_0xf16b('0x0'));var util=require('util');var seqqueue=require(_0xf16b('0x1'));var moment=require('moment');var Redis=require(_0xf16b('0x2'));var config=require(_0xf16b('0x3'));var logger=require('../../../../config/logger')(_0xf16b('0x4'));var strategy=require(_0xf16b('0x5'));config[_0xf16b('0x6')]=_[_0xf16b('0x7')](config[_0xf16b('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf16b('0x8'))(new Redis(config[_0xf16b('0x6')]));var attributes=['id','queue_id',_0xf16b('0x9'),_0xf16b('0xa'),_0xf16b('0xb'),_0xf16b('0xc')];function emit(_0x1293f3,_0x539f86,_0x2f1b6b){io['to'](_0x1293f3)[_0xf16b('0xd')](_0x539f86,_0x2f1b6b);}function emitChannelQueueInteraction(_0x42ddec,_0x12387f,_0x5340a3,_0x447439,_0x11eaf4,_0x1a6615,_0x2d3e3d,_0x25a640){var _0x370d85=_[_0xf16b('0xe')](_0x5340a3);_0x370d85['queue_id']=_0x25a640;_0x370d85[_0xf16b('0xa')]=_0x12387f;_0x370d85[_0xf16b('0x9')]=_0x447439;_0x370d85['id']=_0x11eaf4;if(_0x1a6615){_0x2d3e3d[util['format'](_0xf16b('0xf'),_0x42ddec)][_0x11eaf4]=_[_0xf16b('0x10')](_0x370d85,attributes);}else{delete _0x2d3e3d[util['format']('%sQueuesWaitingInteractions',_0x42ddec)][_0x11eaf4];}emit(util[_0xf16b('0x11')]('%s:queue:%s',_0x42ddec,_0x12387f),util[_0xf16b('0x11')](_0xf16b('0x12'),_0x42ddec,_0x1a6615?_0xf16b('0x13'):_0xf16b('0x14')),_[_0xf16b('0x10')](_0x370d85,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xf16b('0x15')),'faxQueueReport':require(_0xf16b('0x16')),'whatsappQueueReport':require(_0xf16b('0x17'))};var queue=schema({'name':{'type':_0xf16b('0x18'),'required':!![],'message':_0xf16b('0x19')},'timeout':{'type':_0xf16b('0x1a'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x5f2f74,_0x396aad,_0x5a5340,_0x3f314a){if(_0x5f2f74&&_0x396aad&&_0x5a5340){_0x396aad[_0xf16b('0x1b')]+=0x1;var _0x349f22={'uniqueid':_0x5f2f74,'from':_0x5a5340['body']?_0x5a5340[_0xf16b('0x1c')][_0xf16b('0xb')]:'','joinAt':moment()['format'](_0xf16b('0x1d')),'ContactId':_0x5a5340['contact']?_0x5a5340[_0xf16b('0x1e')]['id']:null,'ListId':_0x5a5340['list']?_0x5a5340[_0xf16b('0x1f')]['id']:null};_0x349f22[_[_0xf16b('0x20')](_0x5a5340[_0xf16b('0x21')])+'QueueId']=_0x396aad['id']||null;_0x349f22[_['upperFirst'](_0x5a5340[_0xf16b('0x21')])+_0xf16b('0x22')]=_0x5a5340[_0xf16b('0x23')]?_0x5a5340['interaction']['id']:null;_0x349f22[_[_0xf16b('0x20')](_0x5a5340[_0xf16b('0x21')])+_0xf16b('0x24')]=_0x5a5340[_0xf16b('0x25')]?_0x5a5340[_0xf16b('0x25')]['id']:null;_0x349f22[_[_0xf16b('0x20')](_0x5a5340['channel'])+(_0x5a5340['channel']!==_0xf16b('0x26')?_0xf16b('0x27'):_0xf16b('0x28'))]=_0x5a5340[_0xf16b('0x9')]?_0x5a5340[_0xf16b('0x9')]['id']:null;logger['info'](util[_0xf16b('0x11')](_0xf16b('0x29'),_0x5f2f74,_0x396aad['name']));emitChannelQueueInteraction(_0x5a5340[_0xf16b('0x21')],_0x396aad[_0xf16b('0x2a')],_0x349f22,_0x5a5340['account'][_0xf16b('0x2a')],_0x5a5340[_0xf16b('0x25')]['id'],!![],_0x3f314a,_0x396aad['id']);if(rpc[_0x5a5340[_0xf16b('0x21')]+_0xf16b('0x2b')]){return rpc[_0x5a5340[_0xf16b('0x21')]+_0xf16b('0x2b')][_0xf16b('0x2c')](_0x349f22)['catch'](function(_0x16a1ea){logger[_0xf16b('0x2d')](_0xf16b('0x2e'));});}}}function stopRouting(_0x4514c7,_0xdf7731,_0x34b50c,_0x4663b5){if(_0x4514c7&&_0xdf7731){_0xdf7731[_0xf16b('0x1b')]-=0x1;var _0x2f980f={'leaveAt':moment()[_0xf16b('0x11')](_0xf16b('0x1d')),'acceptAt':moment()['format'](_0xf16b('0x1d')),'reason':_0xf16b('0x2f')};logger[_0xf16b('0x30')](util[_0xf16b('0x11')](_0xf16b('0x31'),_0x4514c7,_0xdf7731['name']));emitChannelQueueInteraction(_0x34b50c[_0xf16b('0x21')],_0xdf7731['name'],_0x34b50c[_0xf16b('0x1c')],_0x34b50c['account'][_0xf16b('0x2a')],_0x34b50c[_0xf16b('0x25')]['id'],![],_0x4663b5,_0xdf7731['id']);if(rpc[_0x34b50c['channel']+_0xf16b('0x2b')]){return rpc[_0x34b50c[_0xf16b('0x21')]+_0xf16b('0x2b')][_0xf16b('0x32')](_0x4514c7,_0x2f980f)[_0xf16b('0x33')](function(_0x265afa){logger[_0xf16b('0x2d')](_0xf16b('0x34'));});}}}function endRouting(_0x510a3d,_0x15140b,_0x41012a,_0x4533c4){if(_0x510a3d&&_0x15140b){_0x15140b[_0xf16b('0x1b')]-=0x1;var _0x1b759c={'leaveAt':moment()[_0xf16b('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xf16b('0x35')};logger[_0xf16b('0x30')](util[_0xf16b('0x11')]('[%s][END:QUEUE][NAME:%s]',_0x510a3d,_0x15140b[_0xf16b('0x2a')]));emitChannelQueueInteraction(_0x41012a['channel'],_0x15140b[_0xf16b('0x2a')],_0x41012a[_0xf16b('0x1c')],_0x41012a[_0xf16b('0x9')][_0xf16b('0x2a')],_0x41012a['message']['id'],![],_0x4533c4);if(rpc[_0x41012a['channel']+_0xf16b('0x2b')]){return rpc[_0x41012a[_0xf16b('0x21')]+_0xf16b('0x2b')]['update'](_0x510a3d,_0x1b759c)['catch'](function(_0x4adc6d){logger[_0xf16b('0x2d')](_0xf16b('0x34'));});}}}function handleFindQueue(_0xb041b4){return function(_0x539a7e){return _0x539a7e[_0xf16b('0x2a')][_0xf16b('0x36')]()===_0xb041b4[_0xf16b('0x36')]();};}exports[_0xf16b('0x37')]=function(_0x5a26ba,_0x256adc,_0x522b5b,_0x3072e5){return function(_0x2eafd1){try{var _0x11c8fd={'name':_0x256adc[0x0],'timeout':_0x256adc[0x1]};var _0x277a03=queue['validate'](_0x11c8fd,{'typecast':!![]});if(_0x277a03['length']){logger['error'](_0xf16b('0x38'),_0x5a26ba,_[_0xf16b('0x39')](_0x277a03,'message')['join'](',\x20'));_0x2eafd1[_0xf16b('0x3a')]();}else{var _0x3f4c44=_['find'](_0x522b5b[_0x3072e5[_0xf16b('0x21')]+_0xf16b('0x3b')],handleFindQueue(_0x11c8fd[_0xf16b('0x2a')]));if(_0x3f4c44){startRouting(_0x5a26ba,_0x3f4c44,_0x3072e5,_0x522b5b);var _0x2c74e6=(_0x3f4c44[_0xf16b('0x35')]||0xa)*0x3e8;var _0x166493=(_0x11c8fd[_0xf16b('0x35')]||0x14)*0x3e8;var _0x500a88,_0x419056;if(_0x2c74e6>_0x166493){_0x166493=_0x2c74e6;}var _0x596eff=seqqueue[_0xf16b('0x3c')](_0x2c74e6);_0x596eff['id']=_0x5a26ba;_0x596eff[_0xf16b('0x3d')]=_0x2c74e6;_0x596eff[_0xf16b('0x3e')]=_0x166493;_0x596eff['channel']=_0x3072e5[_0xf16b('0x21')];_0x522b5b[_0xf16b('0x3f')][_0x5a26ba]['on'](_0xf16b('0x40'),function(){logger[_0xf16b('0x30')](_0xf16b('0x41'),_0x5a26ba);stopRouting(_0x5a26ba,_0x3f4c44,_0x3072e5,_0x522b5b);clearTimeout(_0x500a88);_0x500a88=undefined;_0x596eff[_0xf16b('0x42')](!![]);if(_0x522b5b['rules'][_0x5a26ba]){delete _0x522b5b[_0xf16b('0x3f')][_0x5a26ba];}_0x2eafd1['stop']();});_0x522b5b[_0xf16b('0x3f')][_0x5a26ba]['on'](_0xf16b('0x43'),function(){if(_0x522b5b[_0xf16b('0x3f')][_0x5a26ba]){delete _0x522b5b[_0xf16b('0x3f')][_0x5a26ba];}});_0x500a88=setTimeout(function(){logger[_0xf16b('0x30')](_0xf16b('0x44'),_0x5a26ba);endRouting(_0x5a26ba,_0x3f4c44,_0x3072e5,_0x522b5b);clearTimeout(_0x500a88);_0x596eff[_0xf16b('0x42')](!![]);_0x2eafd1['next']();},_0x166493);switch(_0x3f4c44[_0xf16b('0x45')]){case _0xf16b('0x46'):strategy[_0xf16b('0x46')](_0x596eff,_0x3f4c44,_0x522b5b,_0x3072e5);break;default:strategy['beepall'](_0x596eff,_0x3f4c44,_0x522b5b,_0x3072e5);}}else{logger['error'](_0xf16b('0x47'),_0x5a26ba,_0x11c8fd[_0xf16b('0x2a')]);_0x2eafd1[_0xf16b('0x3a')]();}}}catch(_0x310941){console[_0xf16b('0x48')](_0x310941);logger[_0xf16b('0x2d')](_0xf16b('0x38'),_0x5a26ba,_0x310941['stack']);_0x2eafd1[_0xf16b('0x3a')]();}};}; \ 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 cf2b893..da36755 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 _0xd2a8=['./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','TIMEOUT','exports','uuid'];(function(_0x50789a,_0x397b1f){var _0x243165=function(_0x545edd){while(--_0x545edd){_0x50789a['push'](_0x50789a['shift']());}};_0x243165(++_0x397b1f);}(_0xd2a8,0x1ee));var _0x8d2a=function(_0x131f6d,_0x5765ef){_0x131f6d=_0x131f6d-0x0;var _0x1741a8=_0xd2a8[_0x131f6d];return _0x1741a8;};'use strict';var _=require('lodash');var uuid=require(_0x8d2a('0x0'));var util=require(_0x8d2a('0x1'));var logger=require(_0x8d2a('0x2'))('routing');var Agent=function(_0x3c1cc4,_0x5ce8e5,_0x4072b1,_0x49001f){this[_0x8d2a('0x3')]=uuid['v4']();this[_0x8d2a('0x4')]=_0x3c1cc4;this[_0x8d2a('0x5')]=_0x5ce8e5;this[_0x8d2a('0x6')]=_0x4072b1;this[_0x8d2a('0x7')]=_0x49001f;this[_0x8d2a('0x4')]['push'](this[_0x8d2a('0x8')][_0x8d2a('0x9')](this),this[_0x8d2a('0xa')][_0x8d2a('0x9')](this));this[_0x8d2a('0x4')]['on'](_0x8d2a('0xb'),this[_0x8d2a('0xa')][_0x8d2a('0x9')](this));this[_0x8d2a('0x4')]['on'](_0x8d2a('0xc'),this[_0x8d2a('0xd')][_0x8d2a('0x9')](this));};Agent[_0x8d2a('0xe')][_0x8d2a('0xf')]=function(){this[_0x8d2a('0x4')][_0x8d2a('0xf')](this[_0x8d2a('0x8')][_0x8d2a('0x9')](this),this['handleTimeout']['bind'](this));};Agent['prototype'][_0x8d2a('0xd')]=function(){this[_0x8d2a('0xa')](!![]);};Agent[_0x8d2a('0xe')][_0x8d2a('0x8')]=function(_0x18d6bc){logger[_0x8d2a('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0x8d2a('0x11')](this[_0x8d2a('0x6')][_0x8d2a('0x12')][this[_0x8d2a('0x5')]['id']])){logger['info'](_0x8d2a('0x13'),this[_0x8d2a('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x8d2a('0xf')][_0x8d2a('0x9')](this),0x3e8);}else{if(this[_0x8d2a('0x7')][_0x8d2a('0x14')]||util[_0x8d2a('0x15')](this[_0x8d2a('0x4')]['id'],this[_0x8d2a('0x6')][_0x8d2a('0x12')][this[_0x8d2a('0x5')]['id']],this[_0x8d2a('0x4')][_0x8d2a('0x16')],![])){this[_0x8d2a('0x6')][_0x8d2a('0x12')][this[_0x8d2a('0x5')]['id']]['busy']=!![];this[_0x8d2a('0x6')][_0x8d2a('0x12')][this[_0x8d2a('0x5')]['id']][_0x8d2a('0x17')]=undefined;util[_0x8d2a('0x18')](this['notificationId'],this[_0x8d2a('0x4')]['id'],this[_0x8d2a('0x6')]['agents'][this[_0x8d2a('0x5')]['id']],null,this['routing']);util[_0x8d2a('0x19')](this[_0x8d2a('0x4')]['id'],this[_0x8d2a('0x6')][_0x8d2a('0x12')][this[_0x8d2a('0x5')]['id']],'RINGING'+(this[_0x8d2a('0x7')][_0x8d2a('0x14')]?_0x8d2a('0x1a'):''));}else{logger['info'](_0x8d2a('0x1b'),this[_0x8d2a('0x4')]['id'],this[_0x8d2a('0x5')]['id']);setTimeout(this[_0x8d2a('0xf')][_0x8d2a('0x9')](this),0x3e8);}}};Agent[_0x8d2a('0xe')][_0x8d2a('0xa')]=function(_0x565019){if(_[_0x8d2a('0x11')](this[_0x8d2a('0x6')][_0x8d2a('0x12')][this[_0x8d2a('0x5')]['id']])){return logger[_0x8d2a('0x10')](_0x8d2a('0x13'),this['squeue']['id'],this[_0x8d2a('0x5')]['id']);}else{logger['info'](_0x8d2a('0x1c'),this[_0x8d2a('0x4')]['id'],this[_0x8d2a('0x5')]['id']);util['hideNotification'](this[_0x8d2a('0x3')],this['squeue']['id'],this[_0x8d2a('0x6')][_0x8d2a('0x12')][this[_0x8d2a('0x5')]['id']],null,this['routing']);this[_0x8d2a('0x6')]['agents'][this[_0x8d2a('0x5')]['id']][_0x8d2a('0x1d')]=![];this[_0x8d2a('0x6')]['agents'][this['agent']['id']][_0x8d2a('0x17')]=undefined;util[_0x8d2a('0x19')](this[_0x8d2a('0x4')]['id'],this['realtime'][_0x8d2a('0x12')][this['agent']['id']],_0x565019?_0x8d2a('0x1e'):_0x8d2a('0x1f'));}if(!_0x565019){setTimeout(this[_0x8d2a('0xf')]['bind'](this),0x3e8);}};function agent(_0x12b270,_0x537c70,_0x4eb4e5,_0x524e7b){return new Agent(_0x12b270,_0x537c70,_0x4eb4e5,_0x524e7b);}module[_0x8d2a('0x20')]=agent; \ No newline at end of file +var _0x85d6=['drained','handleDrained','prototype','push','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','agents','busy','writeLog','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busyQueue','./util','../../../../../config/logger','notificationId','agent','routing','squeue','handleRun','bind','handleTimeout','timeout'];(function(_0x1a175f,_0x4c2f6c){var _0x370aef=function(_0x453a79){while(--_0x453a79){_0x1a175f['push'](_0x1a175f['shift']());}};_0x370aef(++_0x4c2f6c);}(_0x85d6,0x1dc));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x685d('0x0'));var logger=require(_0x685d('0x1'))('routing');var Agent=function(_0x566fa6,_0x27558d,_0x1f9aac,_0x3e7729){this[_0x685d('0x2')]=uuid['v4']();this['squeue']=_0x566fa6;this[_0x685d('0x3')]=_0x27558d;this['realtime']=_0x1f9aac;this[_0x685d('0x4')]=_0x3e7729;this[_0x685d('0x5')]['push'](this[_0x685d('0x6')][_0x685d('0x7')](this),this[_0x685d('0x8')][_0x685d('0x7')](this));this['squeue']['on'](_0x685d('0x9'),this[_0x685d('0x8')]['bind'](this));this[_0x685d('0x5')]['on'](_0x685d('0xa'),this[_0x685d('0xb')]['bind'](this));};Agent[_0x685d('0xc')][_0x685d('0xd')]=function(){this[_0x685d('0x5')][_0x685d('0xd')](this[_0x685d('0x6')][_0x685d('0x7')](this),this[_0x685d('0x8')][_0x685d('0x7')](this));};Agent[_0x685d('0xc')][_0x685d('0xb')]=function(){this[_0x685d('0x8')](!![]);};Agent[_0x685d('0xc')]['handleRun']=function(_0xb1b6a4){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x685d('0x5')]['id'],this['agent']['id']);if(_[_0x685d('0xe')](this[_0x685d('0xf')]['agents'][this[_0x685d('0x3')]['id']])){logger['info'](_0x685d('0x10'),this[_0x685d('0x5')]['id'],this[_0x685d('0x3')]['id']);setTimeout(this[_0x685d('0xd')][_0x685d('0x7')](this),0x3e8);}else{if(this['routing'][_0x685d('0x11')]||util[_0x685d('0x12')](this[_0x685d('0x5')]['id'],this['realtime']['agents'][this[_0x685d('0x3')]['id']],this[_0x685d('0x5')][_0x685d('0x13')],![])){this[_0x685d('0xf')][_0x685d('0x14')][this[_0x685d('0x3')]['id']][_0x685d('0x15')]=!![];this[_0x685d('0xf')]['agents'][this[_0x685d('0x3')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0x685d('0x2')],this[_0x685d('0x5')]['id'],this[_0x685d('0xf')]['agents'][this['agent']['id']],null,this[_0x685d('0x4')]);util[_0x685d('0x16')](this[_0x685d('0x5')]['id'],this[_0x685d('0xf')][_0x685d('0x14')][this[_0x685d('0x3')]['id']],'RINGING'+(this['routing'][_0x685d('0x11')]?':FORCED':''));}else{logger[_0x685d('0x17')](_0x685d('0x18'),this['squeue']['id'],this[_0x685d('0x3')]['id']);setTimeout(this[_0x685d('0xd')]['bind'](this),0x3e8);}}};Agent[_0x685d('0xc')][_0x685d('0x8')]=function(_0x155bdb){if(_[_0x685d('0xe')](this[_0x685d('0xf')][_0x685d('0x14')][this['agent']['id']])){return logger[_0x685d('0x17')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);}else{logger[_0x685d('0x17')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x685d('0x19')](this[_0x685d('0x2')],this[_0x685d('0x5')]['id'],this[_0x685d('0xf')][_0x685d('0x14')][this[_0x685d('0x3')]['id']],null,this['routing']);this[_0x685d('0xf')][_0x685d('0x14')][this[_0x685d('0x3')]['id']]['busy']=![];this[_0x685d('0xf')][_0x685d('0x14')][this['agent']['id']][_0x685d('0x1a')]=undefined;util[_0x685d('0x16')](this[_0x685d('0x5')]['id'],this[_0x685d('0xf')]['agents'][this[_0x685d('0x3')]['id']],_0x155bdb?'STOP':'TIMEOUT');}if(!_0x155bdb){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x29f5f3,_0x421bba,_0x198e34,_0x298e78){return new Agent(_0x29f5f3,_0x421bba,_0x198e34,_0x298e78);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index c334e43..30068cb 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 _0xaa48=['length','info','isAgentAvailable','agents','channel','writeLog','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','Agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','isNil'];(function(_0x59e55f,_0x95bfe5){var _0x25b8cb=function(_0x2ee3d5){while(--_0x2ee3d5){_0x59e55f['push'](_0x59e55f['shift']());}};_0x25b8cb(++_0x95bfe5);}(_0xaa48,0x15a));var _0x8aa4=function(_0x202aaf,_0x215758){_0x202aaf=_0x202aaf-0x0;var _0x3a91be=_0xaa48[_0x202aaf];return _0x3a91be;};'use strict';var _=require(_0x8aa4('0x0'));var uuid=require(_0x8aa4('0x1'));var util=require(_0x8aa4('0x2'));var logger=require(_0x8aa4('0x3'))(_0x8aa4('0x4'));var Beepall=function(_0x31afa9,_0x3a0672,_0x4357b2,_0x229357){this[_0x8aa4('0x5')]=uuid['v4']();this[_0x8aa4('0x6')]=_0x31afa9;this[_0x8aa4('0x7')]=_0x3a0672;this[_0x8aa4('0x8')]=_0x4357b2;this[_0x8aa4('0x4')]=_0x229357;this[_0x8aa4('0x6')][_0x8aa4('0x9')](this[_0x8aa4('0xa')][_0x8aa4('0xb')](this),this[_0x8aa4('0xc')]['bind'](this));this[_0x8aa4('0x6')]['on'](_0x8aa4('0xd'),this['handleTimeout'][_0x8aa4('0xb')](this));this[_0x8aa4('0x6')]['on']('drained',this[_0x8aa4('0xe')][_0x8aa4('0xb')](this));};Beepall[_0x8aa4('0xf')][_0x8aa4('0x9')]=function(){this[_0x8aa4('0x6')][_0x8aa4('0x9')](this[_0x8aa4('0xa')][_0x8aa4('0xb')](this),this[_0x8aa4('0xc')][_0x8aa4('0xb')](this));};Beepall['prototype']['handleDrained']=function(_0x3143f7){this[_0x8aa4('0xc')](!![]);};Beepall[_0x8aa4('0xf')][_0x8aa4('0xa')]=function(_0x7b909c){var _0x406f0e=!![];if(!_[_0x8aa4('0x10')](this[_0x8aa4('0x7')])&&!_[_0x8aa4('0x10')](this[_0x8aa4('0x7')]['Agents'])&&this['queue']['Agents'][_0x8aa4('0x11')]>0x0){for(var _0x188e24=0x0,_0x2dd078;_0x188e240x0){for(var _0x349f3c=0x0,_0x4033da;_0x349f3c0x0&&_0x3fd56b[_0x57d26e+'CurrentCapacity']>=_0x3fd56b[_0x57d26e+_0xc430('0x1d')]){writeLog(_0x56dd16,_0x3fd56b,_0x57d26e[_0xc430('0x1f')]()+_0xc430('0x20'));return![];}}return!![];};exports[_0xc430('0x21')]=function(_0x285407,_0x57cd72,_0x2ccc13,_0x1a9512,_0x1c1da9){return sendNotification(!![],_0x285407,_0x57cd72,_0x2ccc13,_0x1a9512,_0x1c1da9);};exports[_0xc430('0x22')]=function(_0x542cba,_0x1f8086,_0x4cf56c,_0x1d65ee,_0x4ad29e){return sendNotification(![],_0x542cba,_0x1f8086,_0x4cf56c,_0x1d65ee,_0x4ad29e);};exports[_0xc430('0x23')]=writeLog; \ No newline at end of file +var _0x5fdc=['user:%s','name','emit','user:save','split','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','info','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format'];(function(_0x1db863,_0x12f884){var _0x4b8321=function(_0x195775){while(--_0x195775){_0x1db863['push'](_0x1db863['shift']());}};_0x4b8321(++_0x12f884);}(_0x5fdc,0x127));var _0xc5fd=function(_0x1fd30d,_0x2ff6b6){_0x1fd30d=_0x1fd30d-0x0;var _0x2aebdd=_0x5fdc[_0x1fd30d];return _0x2aebdd;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var utils=require(_0xc5fd('0x2'));var Mustache=require(_0xc5fd('0x3'));var Redis=require(_0xc5fd('0x4'));var config=require(_0xc5fd('0x5'));var logger=require(_0xc5fd('0x6'))(_0xc5fd('0x7'));config[_0xc5fd('0x8')]=_[_0xc5fd('0x9')](config[_0xc5fd('0x8')],{'host':_0xc5fd('0xa'),'port':0x18eb});var io=require(_0xc5fd('0xb'))(new Redis(config[_0xc5fd('0x8')]));function emit(_0x15ffe7,_0x5a2eb4,_0x5d86e5){io['to'](_0x15ffe7)['emit'](_0x5a2eb4,_0x5d86e5);}function sendNotification(_0x224801,_0x46bce3,_0x158e58,_0x45c91f,_0x4e6d35,_0x4e1e94){io['to'](util[_0xc5fd('0xc')](_0xc5fd('0xd'),_0x45c91f[_0xc5fd('0xe')]))[_0xc5fd('0xf')](_0xc5fd('0x10'),_0x45c91f);var _0x368c80=_0x4e1e94||{};var _0x484bbd=_0x158e58[_0xc5fd('0x11')]('.');var _0x5c3577={'uniqueid':_0x46bce3,'channel':_0x484bbd[0x0],'id':_0x484bbd[0x1],'title':_0x484bbd[0x0]+'\x20interaction','interactionId':_0x484bbd[0x2],'queue':_0x4e6d35?_0x4e6d35[_0xc5fd('0xe')]:null,'sound':_0x368c80[_0xc5fd('0x12')][_0xc5fd('0x13')],'shake':_0x368c80[_0xc5fd('0x12')][_0xc5fd('0x14')]};try{if(!_0x368c80[_0xc5fd('0x15')]){_0x368c80[_0xc5fd('0x15')]={};}if(_0x4e6d35){_0x368c80[_0xc5fd('0x15')]['queue']=_0x4e6d35;}else if(_0x368c80[_0xc5fd('0x15')][_0xc5fd('0x16')]){delete _0x368c80[_0xc5fd('0x15')][_0xc5fd('0x16')];}_0x5c3577['msg']=utils['getMustacheRender'](_0x368c80['account']['notificationTemplate'],_0x368c80);}catch(_0x508539){_0x5c3577[_0xc5fd('0x17')]=_0xc5fd('0x18');logger[_0xc5fd('0x19')](util[_0xc5fd('0xc')](_0xc5fd('0x1a'),_0x46bce3,_0x508539[_0xc5fd('0x1b')]));}io['to'](util[_0xc5fd('0xc')]('user:%s',_0x45c91f[_0xc5fd('0xe')]))[_0xc5fd('0xf')](util[_0xc5fd('0xc')](_0xc5fd('0x1c'),_0x224801?_0xc5fd('0x1d'):'remove'),_0x5c3577);}function writeLog(_0x3966a2,_0x24e5e9,_0x18048e){return logger[_0xc5fd('0x1e')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x3966a2,_0x24e5e9[_0xc5fd('0xe')],_0x18048e));}exports[_0xc5fd('0x1f')]=function(_0x3d7211,_0x42d7f4,_0x334401,_0x311952){if(_0x42d7f4['busy']){writeLog(_0x3d7211,_0x42d7f4,_0xc5fd('0x20'));return![];}if(!_0x42d7f4[_0xc5fd('0x21')]){writeLog(_0x3d7211,_0x42d7f4,_0xc5fd('0x22'));return![];}if(_0x42d7f4[_0x334401+_0xc5fd('0x23')]){writeLog(_0x3d7211,_0x42d7f4,_0xc5fd('0x24'));return![];}if(_0x311952&&_0x42d7f4[_0xc5fd('0x25')](_0x334401+_0xc5fd('0x26'))&&_0x42d7f4['hasOwnProperty'](_0x334401+_0xc5fd('0x27'))){if(_0x42d7f4[_0x334401+'Capacity']>0x0&&_0x42d7f4[_0x334401+_0xc5fd('0x27')]>=_0x42d7f4[_0x334401+_0xc5fd('0x26')]){writeLog(_0x3d7211,_0x42d7f4,_0x334401[_0xc5fd('0x28')]()+_0xc5fd('0x29'));return![];}}return!![];};exports['showNotification']=function(_0x176313,_0x1bbdc4,_0x19c4a0,_0x42cbf0,_0x19df33){return sendNotification(!![],_0x176313,_0x1bbdc4,_0x19c4a0,_0x42cbf0,_0x19df33);};exports[_0xc5fd('0x2a')]=function(_0x541c12,_0x412ef7,_0x5d4f70,_0x4859f7,_0x12a962){return sendNotification(![],_0x541c12,_0x412ef7,_0x5d4f70,_0x4859f7,_0x12a962);};exports[_0xc5fd('0x2b')]=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 2c47db6..05941b4 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 _0xd200=['message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','consequence','length','[%s][SYSTEM]\x20%s','map'];(function(_0x1f0816,_0x5e3f7b){var _0x5925ce=function(_0xdbfcca){while(--_0xdbfcca){_0x1f0816['push'](_0x1f0816['shift']());}};_0x5925ce(++_0x5e3f7b);}(_0xd200,0x7d));var _0x0d20=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd200[_0x465a0c];return _0x1e202e;};'use strict';var schema=require(_0x0d20('0x0'));var sh=require(_0x0d20('0x1'));var _=require(_0x0d20('0x2'));var utils=require(_0x0d20('0x3'));var logger=require('../../../../config/logger')(_0x0d20('0x4'));var system=schema({'command':{'type':_0x0d20('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x0d20('0x6')]=function(_0x5d1d61,_0x45a895){return function(_0x3f6594){try{var _0x33e97c={'command':_0x45a895[0x0]};var _0x2842a1=system[_0x0d20('0x0')](_0x33e97c,{'typecast':!![]});if(_0x2842a1[_0x0d20('0x7')]){logger['error'](_0x0d20('0x8'),_0x5d1d61,_[_0x0d20('0x9')](_0x2842a1,_0x0d20('0xa'))[_0x0d20('0xb')](',\x20'));logger[_0x0d20('0xc')](_0x0d20('0xd'),_0x5d1d61);_0x3f6594[_0x0d20('0xe')]();}else{var _0x22142c=this;var _0x351a4b=utils[_0x0d20('0xf')](_0x45a895[0x0],this);logger[_0x0d20('0xc')](_0x0d20('0x10'),_0x5d1d61,_0x351a4b);sh[_0x0d20('0x11')](_[_0x0d20('0x12')](_0x351a4b),function(_0x30deea,_0x294b9c){logger[_0x0d20('0xc')](_0x0d20('0x13'),_0x5d1d61,_0x30deea);if(_0x30deea==0x0){var _0x110cd2=_0x294b9c[_0x0d20('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x0d20('0x15')](_0x45a895[0x1])||_[_0x0d20('0x16')](_0x45a895[0x1])){logger['info'](_0x0d20('0x17'),_0x5d1d61);_0x22142c['body'][_0x45a895[0x1]]=_0x110cd2;}else{logger[_0x0d20('0xc')](_0x0d20('0x18'),_0x5d1d61,_0x45a895[0x1],_0x110cd2);_0x22142c['body'][_0x45a895[0x1]]=_0x110cd2;}}_0x3f6594['next']();});}}catch(_0x35fdaf){logger['error'](_0x0d20('0x8'),_0x5d1d61,_[_0x0d20('0x19')](_0x35fdaf)?JSON[_0x0d20('0x1a')](_0x35fdaf):_0x35fdaf);logger[_0x0d20('0xc')](_0x0d20('0xd'),_0x5d1d61);_0x3f6594['next']();}};}; \ No newline at end of file +var _0x0c3f=['message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0x0c3f,0xb3));var _0xf0c3=function(_0x26915d,_0x145f09){_0x26915d=_0x26915d-0x0;var _0x54b66f=_0x0c3f[_0x26915d];return _0x54b66f;};'use strict';var schema=require(_0xf0c3('0x0'));var sh=require(_0xf0c3('0x1'));var _=require('lodash');var utils=require(_0xf0c3('0x2'));var logger=require('../../../../config/logger')(_0xf0c3('0x3'));var system=schema({'command':{'type':_0xf0c3('0x4'),'required':!![],'message':_0xf0c3('0x5')}});exports['consequence']=function(_0x5d4507,_0x48c685){return function(_0x8a9702){try{var _0x36d20b={'command':_0x48c685[0x0]};var _0x2f4562=system[_0xf0c3('0x0')](_0x36d20b,{'typecast':!![]});if(_0x2f4562[_0xf0c3('0x6')]){logger[_0xf0c3('0x7')](_0xf0c3('0x8'),_0x5d4507,_[_0xf0c3('0x9')](_0x2f4562,_0xf0c3('0xa'))['join'](',\x20'));logger[_0xf0c3('0xb')](_0xf0c3('0xc'),_0x5d4507);_0x8a9702[_0xf0c3('0xd')]();}else{var _0x4b6182=this;var _0x219882=utils[_0xf0c3('0xe')](_0x48c685[0x0],this);logger[_0xf0c3('0xb')](_0xf0c3('0xf'),_0x5d4507,_0x219882);sh[_0xf0c3('0x10')](_[_0xf0c3('0x11')](_0x219882),function(_0x45aa88,_0x58b5cb){logger[_0xf0c3('0xb')](_0xf0c3('0x12'),_0x5d4507,_0x45aa88);if(_0x45aa88==0x0){var _0x4ee3a6=_0x58b5cb[_0xf0c3('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xf0c3('0x14')](_0x48c685[0x1])||_[_0xf0c3('0x15')](_0x48c685[0x1])){logger[_0xf0c3('0xb')](_0xf0c3('0x16'),_0x5d4507);_0x4b6182[_0xf0c3('0x17')][_0x48c685[0x1]]=_0x4ee3a6;}else{logger[_0xf0c3('0xb')](_0xf0c3('0x18'),_0x5d4507,_0x48c685[0x1],_0x4ee3a6);_0x4b6182['body'][_0x48c685[0x1]]=_0x4ee3a6;}}_0x8a9702[_0xf0c3('0xd')]();});}}catch(_0xb3781a){logger[_0xf0c3('0x7')](_0xf0c3('0x8'),_0x5d4507,_[_0xf0c3('0x19')](_0xb3781a)?JSON[_0xf0c3('0x1a')](_0xb3781a):_0xb3781a);logger[_0xf0c3('0xb')](_0xf0c3('0xc'),_0x5d4507);_0x8a9702['next']();}};}; \ 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 b65b368..0872dbf 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 _0xd94b=['info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','next','channel','Interaction','addTags','interaction','then'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0xd94b,0x163));var _0xbd94=function(_0x3d1807,_0x4fabc2){_0x3d1807=_0x3d1807-0x0;var _0x2b15c0=_0xd94b[_0x3d1807];return _0x2b15c0;};'use strict';var schema=require(_0xbd94('0x0'));var _=require(_0xbd94('0x1'));var rpc={'chatInteraction':require(_0xbd94('0x2')),'openchannelInteraction':require(_0xbd94('0x3')),'smsInteraction':require(_0xbd94('0x4')),'mailInteraction':require(_0xbd94('0x5')),'faxInteraction':require(_0xbd94('0x6')),'whatsappInteraction':require(_0xbd94('0x7'))};var logger=require('../../../../config/logger')(_0xbd94('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xbd94('0x9')}});exports[_0xbd94('0xa')]=function(_0x5c7065,_0x2652a1,_0x153c39,_0xa54b79){return function(_0x8c624d){try{var _0x37e2aa={'tag':_0x2652a1[0x0]};var _0x4f4acf=tag[_0xbd94('0x0')](_0x37e2aa,{'typecast':!![]});if(_0x4f4acf[_0xbd94('0xb')]){logger[_0xbd94('0xc')]('[%s][TAG]\x20%s',_0x5c7065,_[_0xbd94('0xd')](_0x4f4acf,_0xbd94('0xe'))[_0xbd94('0xf')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5c7065);_0x8c624d[_0xbd94('0x10')]();}else{var _0x35a1b3={'ids':[_0x2652a1[0x0]]};if(rpc[_0xa54b79[_0xbd94('0x11')]+_0xbd94('0x12')]){rpc[_0xa54b79[_0xbd94('0x11')]+_0xbd94('0x12')][_0xbd94('0x13')](_0xa54b79[_0xbd94('0x14')]['id'],_0x35a1b3)[_0xbd94('0x15')](function(_0x1b30cc){logger[_0xbd94('0x16')](_0xbd94('0x17'),_0x5c7065,_0x2652a1[0x1],_0xa54b79['channel'],_0xa54b79[_0xbd94('0x14')]['id']);})[_0xbd94('0x18')](function(_0x29498d){logger['error'](_0xbd94('0x19'),_0x5c7065,JSON['stringify'](_0x29498d));logger[_0xbd94('0x16')](_0xbd94('0x1a'),_0x5c7065);})[_0xbd94('0x1b')](function(){_0x8c624d[_0xbd94('0x10')]();});}}}catch(_0xa94d07){logger[_0xbd94('0xc')]('[%s][TAG]\x20%s',_0x5c7065,_[_0xbd94('0x1c')](_0xa94d07)?JSON['stringify'](_0xa94d07):_0xa94d07);logger[_0xbd94('0x16')](_0xbd94('0x1a'),_0x5c7065);_0x8c624d[_0xbd94('0x10')]();}};}; \ No newline at end of file +var _0x430c=['../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','length','[%s][TAG]\x20%s','map','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','error','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction'];(function(_0x4f3fdf,_0x32b5ff){var _0x3e78d1=function(_0x194f3e){while(--_0x194f3e){_0x4f3fdf['push'](_0x4f3fdf['shift']());}};_0x3e78d1(++_0x32b5ff);}(_0x430c,0x14d));var _0xc430=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x430c[_0x5a2d95];return _0x2c3986;};'use strict';var schema=require(_0xc430('0x0'));var _=require(_0xc430('0x1'));var rpc={'chatInteraction':require(_0xc430('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xc430('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xc430('0x4'))};var logger=require(_0xc430('0x5'))(_0xc430('0x6'));var tag=schema({'tag':{'type':_0xc430('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0xcddc62,_0xca6b97,_0x558916,_0x50537a){return function(_0x454c25){try{var _0x5b3e8f={'tag':_0xca6b97[0x0]};var _0x1bda50=tag[_0xc430('0x0')](_0x5b3e8f,{'typecast':!![]});if(_0x1bda50[_0xc430('0x8')]){logger['error'](_0xc430('0x9'),_0xcddc62,_[_0xc430('0xa')](_0x1bda50,'message')[_0xc430('0xb')](',\x20'));logger[_0xc430('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xcddc62);_0x454c25[_0xc430('0xd')]();}else{var _0x2e7778={'ids':[_0xca6b97[0x0]]};if(rpc[_0x50537a[_0xc430('0xe')]+'Interaction']){rpc[_0x50537a[_0xc430('0xe')]+_0xc430('0xf')][_0xc430('0x10')](_0x50537a[_0xc430('0x11')]['id'],_0x2e7778)[_0xc430('0x12')](function(_0x3eb87c){logger[_0xc430('0xc')](_0xc430('0x13'),_0xcddc62,_0xca6b97[0x1],_0x50537a['channel'],_0x50537a[_0xc430('0x11')]['id']);})['catch'](function(_0x40464d){logger['error'](_0xc430('0x9'),_0xcddc62,JSON[_0xc430('0x14')](_0x40464d));logger[_0xc430('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xcddc62);})[_0xc430('0x15')](function(){_0x454c25[_0xc430('0xd')]();});}}}catch(_0x2c8445){logger[_0xc430('0x16')]('[%s][TAG]\x20%s',_0xcddc62,_['isObject'](_0x2c8445)?JSON['stringify'](_0x2c8445):_0x2c8445);logger[_0xc430('0xc')](_0xc430('0x17'),_0xcddc62);_0x454c25[_0xc430('0xd')]();}};}; \ 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 6e86e24..2244ad8 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4c087b,_0x4ead5c){var _0x2f077e=function(_0x4b5dbd){while(--_0x4b5dbd){_0x4c087b['push'](_0x4c087b['shift']());}};_0x2f077e(++_0x4ead5c);}(_0xe706,0xa3));var _0x6e70=function(_0x26bb15,_0x39b070){_0x26bb15=_0x26bb15-0x0;var _0x7aa58a=_0xe706[_0x26bb15];return _0x7aa58a;};'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 +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x36e54a,_0x3e1b60){var _0x40b8dd=function(_0x2752fd){while(--_0x2752fd){_0x36e54a['push'](_0x36e54a['shift']());}};_0x40b8dd(++_0x3e1b60);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ef53bff..687a3f9 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 _0x7dea=['../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7dea,0x16b));var _0xa7de=function(_0x93660b,_0x4146a4){_0x93660b=_0x93660b-0x0;var _0x2bf919=_0x7dea[_0x93660b];return _0x2bf919;};'use strict';var _=require(_0xa7de('0x0'));var util=require(_0xa7de('0x1'));var path=require(_0xa7de('0x2'));var fs=require('fs');var jayson=require(_0xa7de('0x3'));var BPromise=require(_0xa7de('0x4'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xa7de('0x5')),'chatQueueReport':require(_0xa7de('0x6')),'smsQueueReport':require(_0xa7de('0x7')),'faxQueueReport':require(_0xa7de('0x8')),'whatsappQueueReport':require(_0xa7de('0x9'))};var RuleEngine=require(_0xa7de('0xa'));function getId(_0x42dbb1,_0x29a458,_0x460f44){return util['format'](_0xa7de('0xb'),_0x42dbb1,_0x29a458||0x0,_0x460f44||0x0);}function getIntervals(_0x2dec88,_0x59e44e){var _0x1b03a6=[];if(!_['isNil'](_0x59e44e[_0xa7de('0xc')])&&!_[_0xa7de('0xd')](_0x2dec88[_0x59e44e[_0xa7de('0xc')]])&&!_['isNil'](_0x2dec88[_0x59e44e['IntervalId']][_0xa7de('0xe')])){_0x1b03a6=_['map'](_0x2dec88[_0x59e44e['IntervalId']][_0xa7de('0xe')],_0xa7de('0xf'));}else if(!_['isNil'](_0x59e44e[_0xa7de('0xf')])){_0x1b03a6=[_0x59e44e[_0xa7de('0xf')]];}return _0x1b03a6;}exports['listen']=function(_0x5d5e4d){_0x5d5e4d[_0xa7de('0x10')]={};return new BPromise(function(_0x3f0b11,_0x29a9a4){var _0x3b6c01={'Start':function(_0x35463d){var _0x95b351=this;return new Promise(function(_0x50f467,_0x27761b){if(_0x35463d){try{var _0x2a0832=[];var _0x13282d=getId(_0x35463d[_0xa7de('0x11')],_0x35463d[_0xa7de('0x12')]?_0x35463d[_0xa7de('0x12')]['id']:0x0,_0x35463d[_0xa7de('0x13')]?_0x35463d[_0xa7de('0x13')]['id']:0x0);if(_0x35463d[_0xa7de('0x14')]&&_[_0xa7de('0x15')](_0x35463d[_0xa7de('0x14')])&&_0x35463d[_0xa7de('0x14')][_0xa7de('0x16')]){for(var _0x2131fa=0x0;_0x2131fa<_0x35463d['applications'][_0xa7de('0x16')];_0x2131fa+=0x1){var _0x183c3a=_0x35463d[_0xa7de('0x14')][_0x2131fa];if(fs[_0xa7de('0x17')](path[_0xa7de('0x18')](__dirname,_0xa7de('0x14'),_0x183c3a[_0xa7de('0x19')]+_0xa7de('0x1a')))){var _0x51663b=[];switch(_0x183c3a[_0xa7de('0x19')]['toLowerCase']()){case _0xa7de('0x1b'):var _0x4cb326=_0x183c3a['appdata'][_0xa7de('0x1c')](',');if(_0x35463d[_0xa7de('0x11')]===_0xa7de('0x1d')){_0x51663b[_0xa7de('0x1e')](_0x4cb326[0x0]);_0x51663b[_0xa7de('0x1e')](_0x4cb326[0x1]);_0x51663b[_0xa7de('0x1e')](_0x4cb326[_0xa7de('0x1f')](0x2,_0x4cb326[_0xa7de('0x16')])[_0xa7de('0x18')](','));}else{_0x51663b['push'](_0x4cb326[0x0]);_0x51663b['push'](_0x4cb326[_0xa7de('0x1f')](0x1,_0x4cb326[_0xa7de('0x16')])[_0xa7de('0x18')](','));}break;case _0xa7de('0x20'):var _0x3f23e6=_0x183c3a[_0xa7de('0x21')][_0xa7de('0x1c')](',');_0x51663b[_0xa7de('0x1e')](_0x3f23e6[0x0]);_0x51663b[_0xa7de('0x1e')](_0x3f23e6[0x1]);_0x51663b['push'](_0x3f23e6[_0xa7de('0x1f')](0x2,_0x3f23e6[_0xa7de('0x16')])[_0xa7de('0x18')](','));break;case _0xa7de('0x22'):var _0x35d46a=_0x183c3a[_0xa7de('0x21')][_0xa7de('0x1c')](',');_0x51663b[_0xa7de('0x1e')](_0x35d46a[0x0]);_0x51663b[_0xa7de('0x1e')](_0x35d46a[0x1]);_0x51663b[_0xa7de('0x1e')](_0x35d46a[0x2]);_0x51663b[_0xa7de('0x1e')](_0x35d46a[0x3]);_0x51663b['push'](_0x35d46a[_0xa7de('0x1f')](0x4,_0x35d46a[_0xa7de('0x16')])[_0xa7de('0x18')](','));break;case _0xa7de('0x23'):var _0x1985ef=_0x183c3a[_0xa7de('0x21')]['split'](',');_0x51663b[_0xa7de('0x1e')](_0x1985ef[0x0]);_0x51663b[_0xa7de('0x1e')](_0x1985ef[0x1]);_0x51663b[_0xa7de('0x1e')](_0x1985ef[0x2]);_0x51663b['push'](_0x1985ef[0x3]);_0x51663b[_0xa7de('0x1e')](_0x1985ef[_0xa7de('0x1f')](0x4,_0x1985ef[_0xa7de('0x16')])[_0xa7de('0x18')](','));break;case _0xa7de('0x12'):_0x51663b[_0xa7de('0x1e')](_0x183c3a['appdata']);break;case _0xa7de('0x24'):_0x51663b[_0xa7de('0x1e')](_0x183c3a[_0xa7de('0x25')]);_0x51663b[_0xa7de('0x1e')](_0x183c3a[_0xa7de('0x21')]);break;default:_0x51663b=_[_0xa7de('0xd')](_0x183c3a[_0xa7de('0x21')])?[]:_0x183c3a['appdata']['split'](',');}var _0x3baf6a={'id':util['format'](_0xa7de('0x26'),_0x13282d,_0x183c3a['id'],_0x183c3a['app']),'condition':require('./interval')['condition'](_0x13282d,getIntervals(_0x5d5e4d[_0xa7de('0x27')],_0x183c3a),_0x5d5e4d),'consequence':require(_0xa7de('0x28')+_0x183c3a['app'])['consequence'](_0x13282d,_0x51663b,_0x5d5e4d,_0x35463d),'p':_0x183c3a['priority']||0x0};logger[_0xa7de('0x29')](_0xa7de('0x2a'),_0x3baf6a['id'],_0xa7de('0x2b'),getIntervals(_0x5d5e4d[_0xa7de('0x27')],_0x183c3a)['join'](_0xa7de('0x2c')));_0x2a0832[_0xa7de('0x1e')](_0x3baf6a);}else{logger[_0xa7de('0x2d')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xa7de('0x18')](__dirname,_0xa7de('0x14'),_0x183c3a[_0xa7de('0x19')]+_0xa7de('0x1a')));}}_0x5d5e4d['rules'][_0x13282d]=new RuleEngine(_0x2a0832);_0x5d5e4d[_0xa7de('0x10')][_0x13282d][_0xa7de('0x2e')](_0x35463d,function(_0x1a07df){logger[_0xa7de('0x29')](_0xa7de('0x2f'),JSON['stringify'](_0x1a07df[_0xa7de('0x30')]));if(_0x5d5e4d[_0xa7de('0x10')][_0x13282d]){_0x5d5e4d[_0xa7de('0x10')][_0x13282d][_0xa7de('0x31')]('complete');}});return _0x50f467({'code':0xc8,'message':_0x35463d});}else{logger[_0xa7de('0x29')](_0xa7de('0x32'));return _0x50f467({'code':0xc8,'message':_0x35463d});}}catch(_0x22d3d5){logger[_0xa7de('0x2d')](_0x22d3d5[_0xa7de('0x33')]);return _0x27761b(_0x95b351[_0xa7de('0x2d')](0x1f4,_0x22d3d5));}}return _0x27761b('routing\x20is\x20empty');});},'AcceptMessage':function(_0x3d06ab){var _0x1007e3=this;return new Promise(function(_0x1bda7e,_0x3d181a){if(_0x3d06ab[_0xa7de('0x34')]&&_0x3d06ab[_0xa7de('0x34')]['id']){if(_0x5d5e4d[_0xa7de('0x35')][_0x3d06ab[_0xa7de('0x34')]['id']]){_0x5d5e4d[_0xa7de('0x35')][_0x3d06ab['agent']['id']][_0xa7de('0x36')]=![];_0x5d5e4d[_0xa7de('0x35')][_0x3d06ab[_0xa7de('0x34')]['id']][_0xa7de('0x37')]=undefined;}}if(_0x3d06ab[_0xa7de('0x12')]&&_0x3d06ab[_0xa7de('0x12')]['id']){try{var _0x152e5b=getId(_0x3d06ab[_0xa7de('0x11')],_0x3d06ab[_0xa7de('0x12')]?_0x3d06ab[_0xa7de('0x12')]['id']:0x0,_0x3d06ab[_0xa7de('0x13')]?_0x3d06ab[_0xa7de('0x13')]['id']:0x0);if(_0x5d5e4d[_0xa7de('0x10')][_0x152e5b]){_0x5d5e4d[_0xa7de('0x10')][_0x152e5b]['emit'](_0xa7de('0x38'));if(rpc[_0x3d06ab[_0xa7de('0x11')]+_0xa7de('0x39')]){rpc[_0x3d06ab['channel']+'QueueReport'][_0xa7de('0x3a')](_0x152e5b,{'UserId':_0x3d06ab[_0xa7de('0x12')][_0xa7de('0x3b')]})['catch'](function(_0x117fc3){logger['error'](_0xa7de('0x3c'));});}}return _0x1bda7e({'code':0xc8,'message':_0x3d06ab});}catch(_0x395986){logger[_0xa7de('0x2d')](_0x395986[_0xa7de('0x33')]);return _0x3d181a(_0x1007e3['error'](0x1f4,_0x395986));}}logger[_0xa7de('0x2d')]('message\x20is\x20empty');return _0x3d181a(_0x1007e3[_0xa7de('0x2d')](0x1f4,_0xa7de('0x3d')));});},'RejectMessage':function(_0x492f15){var _0xb0cb46=this;return new Promise(function(_0x944880,_0x5ae9d1){if(_0x492f15[_0xa7de('0x34')]&&_0x492f15[_0xa7de('0x34')]['id']){try{if(_0x5d5e4d[_0xa7de('0x35')][_0x492f15[_0xa7de('0x34')]['id']]){_0x5d5e4d[_0xa7de('0x35')][_0x492f15['agent']['id']][_0xa7de('0x36')]=![];_0x5d5e4d['agents'][_0x492f15['agent']['id']][_0xa7de('0x37')]=undefined;}return _0x944880({'code':0xc8,'message':_0x492f15});}catch(_0x7af0cc){logger[_0xa7de('0x2d')](_0x7af0cc[_0xa7de('0x33')]);return _0x5ae9d1(_0xb0cb46[_0xa7de('0x2d')](0x1f4,_0x7af0cc));}}logger[_0xa7de('0x2d')]('message\x20is\x20empty');return _0x5ae9d1(_0xb0cb46['error'](0x1f4,_0xa7de('0x3d')));});},'AbandonInteraction':function(_0x340a00){var _0xcb7ca5=this;return new Promise(function(_0x2d6439,_0x2de1b0){if(_0x340a00[_0xa7de('0x11')]&&_0x340a00['interaction']&&_0x340a00[_0xa7de('0x13')]['id']){try{var _0xb44408=getId(_0x340a00['channel'],_0x340a00[_0xa7de('0x12')]?_0x340a00[_0xa7de('0x12')]['id']:0x0,_0x340a00[_0xa7de('0x13')]?_0x340a00[_0xa7de('0x13')]['id']:0x0);if(_0x5d5e4d[_0xa7de('0x10')][_0xb44408]){_0x5d5e4d[_0xa7de('0x10')][_0xb44408][_0xa7de('0x31')](_0xa7de('0x38'));}return _0x2d6439({'code':0xc8,'message':_0x340a00});}catch(_0x58fd6b){logger['error'](_0x58fd6b[_0xa7de('0x33')]);return _0x2de1b0(_0xcb7ca5[_0xa7de('0x2d')](0x1f4,_0x58fd6b));}}logger[_0xa7de('0x2d')](_0xa7de('0x3d'));return _0x2de1b0(_0xcb7ca5[_0xa7de('0x2d')](0x1f4,_0xa7de('0x3d')));});},'AgentCapacity':function(_0x29ffbe){var _0x523e48=this;return new Promise(function(_0x14fce4,_0x19ff01){if(_0x5d5e4d['agents'][_0xa7de('0x3e')](_0x29ffbe['id'])){for(var _0x45a084 in _0x29ffbe[_0xa7de('0x3f')]){if(_0x29ffbe[_0xa7de('0x3f')][_0xa7de('0x3e')](_0x45a084)){if(_0x5d5e4d[_0xa7de('0x35')][_0x29ffbe['id']][_0xa7de('0x3e')](_0x45a084+_0xa7de('0x40'))){_0x5d5e4d[_0xa7de('0x35')][_0x29ffbe['id']][_0x45a084+_0xa7de('0x40')]=parseInt(_0x29ffbe[_0xa7de('0x3f')][_0x45a084],0xa);}}}_0x5d5e4d[_0xa7de('0x35')][_0x29ffbe['id']][_0xa7de('0x41')]();return _0x14fce4({'code':0xc8,'message':_0x5d5e4d[_0xa7de('0x35')][_0x29ffbe['id']]});}else{return _0x19ff01(_0x523e48[_0xa7de('0x2d')](0x1f4,_0xa7de('0x42')));}});},'Agents':function(_0xc21a0c){return new Promise(function(_0x3c58ee,_0x4304ef){var _0x3f9f1b=_[_0xa7de('0x43')](_0x5d5e4d[_0xa7de('0x35')]);_0x3c58ee({'count':_0x3f9f1b[_0xa7de('0x16')],'rows':_0x3f9f1b});});},'ChatQueues':function(_0x43d8bf){return new Promise(function(_0x41ef7f,_0x5d370f){var _0x27785a=[];for(var _0x14f36f in _0x5d5e4d[_0xa7de('0x44')]){if(_0x5d5e4d[_0xa7de('0x44')][_0xa7de('0x3e')](_0x14f36f)){var _0x53f43f=_0x5d5e4d[_0xa7de('0x44')][_0x14f36f];var _0x1554d7={'id':_0x53f43f['id'],'available':_0x53f43f[_0xa7de('0x45')],'loggedIn':_0x53f43f[_0xa7de('0x46')],'name':_0x53f43f[_0xa7de('0x47')],'paused':_0x53f43f[_0xa7de('0x48')],'waiting':_0x53f43f[_0xa7de('0x49')]};_0x27785a[_0xa7de('0x1e')](_0x1554d7);}}_0x41ef7f({'count':_0x27785a[_0xa7de('0x16')],'rows':_0x27785a});});},'MailQueues':function(_0xdeb239){return new Promise(function(_0x45c6a8,_0x3f2401){var _0x5753b1=[];for(var _0x2bd424 in _0x5d5e4d['mailQueues']){if(_0x5d5e4d[_0xa7de('0x4a')][_0xa7de('0x3e')](_0x2bd424)){var _0x33fdc8=_0x5d5e4d[_0xa7de('0x4a')][_0x2bd424];var _0x40860a={'id':_0x33fdc8['id'],'available':_0x33fdc8['available'],'loggedIn':_0x33fdc8['loggedIn'],'name':_0x33fdc8[_0xa7de('0x47')],'paused':_0x33fdc8[_0xa7de('0x48')],'waiting':_0x33fdc8[_0xa7de('0x49')]};_0x5753b1[_0xa7de('0x1e')](_0x40860a);}}_0x45c6a8({'count':_0x5753b1[_0xa7de('0x16')],'rows':_0x5753b1});});},'OpenchannelQueues':function(_0x49b9e4){return new Promise(function(_0x43e096,_0x1a857e){var _0x1d904f=[];for(var _0x134b00 in _0x5d5e4d[_0xa7de('0x4b')]){if(_0x5d5e4d[_0xa7de('0x4b')]['hasOwnProperty'](_0x134b00)){var _0x41c74d=_0x5d5e4d[_0xa7de('0x4b')][_0x134b00];var _0x230665={'id':_0x41c74d['id'],'available':_0x41c74d[_0xa7de('0x45')],'loggedIn':_0x41c74d['loggedIn'],'name':_0x41c74d[_0xa7de('0x47')],'paused':_0x41c74d[_0xa7de('0x48')],'waiting':_0x41c74d[_0xa7de('0x49')]};_0x1d904f[_0xa7de('0x1e')](_0x230665);}}_0x43e096({'count':_0x1d904f[_0xa7de('0x16')],'rows':_0x1d904f});});},'SmsQueues':function(_0x2610c1){return new Promise(function(_0x5a282e,_0x3b0038){var _0x1e505b=[];for(var _0x9a8fd5 in _0x5d5e4d[_0xa7de('0x4c')]){if(_0x5d5e4d[_0xa7de('0x4c')][_0xa7de('0x3e')](_0x9a8fd5)){var _0x3ae997=_0x5d5e4d[_0xa7de('0x4c')][_0x9a8fd5];var _0x55bb1d={'id':_0x3ae997['id'],'available':_0x3ae997[_0xa7de('0x45')],'loggedIn':_0x3ae997['loggedIn'],'name':_0x3ae997['name'],'paused':_0x3ae997[_0xa7de('0x48')],'waiting':_0x3ae997['waiting']};_0x1e505b[_0xa7de('0x1e')](_0x55bb1d);}}_0x5a282e({'count':_0x1e505b[_0xa7de('0x16')],'rows':_0x1e505b});});},'FaxQueues':function(_0x55edf4){return new Promise(function(_0x4a4615,_0x3e5c9b){var _0x447359=[];for(var _0x3b7822 in _0x5d5e4d['faxQueues']){if(_0x5d5e4d[_0xa7de('0x4d')][_0xa7de('0x3e')](_0x3b7822)){var _0x127612=_0x5d5e4d[_0xa7de('0x4d')][_0x3b7822];var _0x538d0a={'id':_0x127612['id'],'available':_0x127612['available'],'loggedIn':_0x127612[_0xa7de('0x46')],'name':_0x127612['name'],'paused':_0x127612[_0xa7de('0x48')],'waiting':_0x127612[_0xa7de('0x49')]};_0x447359[_0xa7de('0x1e')](_0x538d0a);}}_0x4a4615({'count':_0x447359[_0xa7de('0x16')],'rows':_0x447359});});},'WhatsappQueues':function(_0x56dd31){return new Promise(function(_0x31d1fa,_0x5ee5c2){var _0x8600cf=[];for(var _0x53f64d in _0x5d5e4d['whatsappQueues']){if(_0x5d5e4d[_0xa7de('0x4e')][_0xa7de('0x3e')](_0x53f64d)){var _0x25271c=_0x5d5e4d[_0xa7de('0x4e')][_0x53f64d];var _0x423956={'id':_0x25271c['id'],'available':_0x25271c[_0xa7de('0x45')],'loggedIn':_0x25271c['loggedIn'],'name':_0x25271c[_0xa7de('0x47')],'paused':_0x25271c[_0xa7de('0x48')],'waiting':_0x25271c[_0xa7de('0x49')]};_0x8600cf[_0xa7de('0x1e')](_0x423956);}}_0x31d1fa({'count':_0x8600cf[_0xa7de('0x16')],'rows':_0x8600cf});});},'ChatQueuesWaitingInteractions':function(_0xf1f92a){return new Promise(function(_0x3ad01f,_0xa3a4e1){var _0xfc7053=_[_0xa7de('0x43')](_0x5d5e4d[_0xa7de('0x4f')]);_0x3ad01f({'count':_0xfc7053['length'],'rows':_0xfc7053});});},'MailQueuesWaitingInteractions':function(_0x2fe4f1){return new Promise(function(_0x2196c7,_0x5b0544){var _0xb7829d=_[_0xa7de('0x43')](_0x5d5e4d[_0xa7de('0x50')]);_0x2196c7({'count':_0xb7829d[_0xa7de('0x16')],'rows':_0xb7829d});});},'OpenchannelQueuesWaitingInteractions':function(_0x44f7b9){return new Promise(function(_0x413761,_0x390ff2){var _0x239f14=_[_0xa7de('0x43')](_0x5d5e4d[_0xa7de('0x51')]);_0x413761({'count':_0x239f14[_0xa7de('0x16')],'rows':_0x239f14});});},'SmsQueuesWaitingInteractions':function(_0x4ee673){return new Promise(function(_0x12c8f4,_0x576f68){var _0x1e86a7=_[_0xa7de('0x43')](_0x5d5e4d[_0xa7de('0x52')]);_0x12c8f4({'count':_0x1e86a7['length'],'rows':_0x1e86a7});});},'FaxQueuesWaitingInteractions':function(_0x26bb28){return new Promise(function(_0x5a47a6,_0x425038){var _0x39e2ba=_[_0xa7de('0x43')](_0x5d5e4d[_0xa7de('0x53')]);_0x5a47a6({'count':_0x39e2ba['length'],'rows':_0x39e2ba});});},'WhatsappQueuesWaitingInteractions':function(_0xce5099){return new Promise(function(_0xeaa54f,_0x53686f){var _0x33104a=_['values'](_0x5d5e4d[_0xa7de('0x54')]);_0xeaa54f({'count':_0x33104a['length'],'rows':_0x33104a});});}};var _0x4eca3d=jayson[_0xa7de('0x55')](_0x3b6c01)[_0xa7de('0x56')]();_0x4eca3d['on'](_0xa7de('0x2d'),function(_0x12f078){logger[_0xa7de('0x2d')](JSON[_0xa7de('0x57')](_0x12f078));return _0x29a9a4(_0x12f078);});_0x4eca3d[_0xa7de('0x58')](0x232c,'127.0.0.1',function(){console[_0xa7de('0x59')](_0xa7de('0x5a'),0x232c);return _0x3f0b11(_0xa7de('0x5b')+0x232c);});});}; \ No newline at end of file +var _0xb60e=['values','chatQueues','available','loggedIn','paused','mailQueues','waiting','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','lodash','util','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','channel','push','slice','join','dialogflow','split','dialogflowv2','appdata','tag','%s:%s:%s','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','UserId','catch','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity'];(function(_0x2e61fc,_0x5b0d4e){var _0x4cfea3=function(_0x5b29a2){while(--_0x5b29a2){_0x2e61fc['push'](_0x2e61fc['shift']());}};_0x4cfea3(++_0x5b0d4e);}(_0xb60e,0x118));var _0xeb60=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0xb60e[_0x1e5cc3];return _0x15c596;};'use strict';var _=require(_0xeb60('0x0'));var util=require(_0xeb60('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xeb60('0x2'));var BPromise=require(_0xeb60('0x3'));var uuid=require(_0xeb60('0x4'));var config=require(_0xeb60('0x5'));var logger=require(_0xeb60('0x6'))(_0xeb60('0x7'));var rpc={'openchannelQueueReport':require(_0xeb60('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xeb60('0x9')),'smsQueueReport':require(_0xeb60('0xa')),'faxQueueReport':require(_0xeb60('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xeb60('0xc'));function getId(_0x1a0a26,_0x27466e,_0x115e16){return util[_0xeb60('0xd')]('%s.%s.%s',_0x1a0a26,_0x27466e||0x0,_0x115e16||0x0);}function getIntervals(_0x16a607,_0x366fe1){var _0x30dcfe=[];if(!_[_0xeb60('0xe')](_0x366fe1[_0xeb60('0xf')])&&!_[_0xeb60('0xe')](_0x16a607[_0x366fe1[_0xeb60('0xf')]])&&!_[_0xeb60('0xe')](_0x16a607[_0x366fe1[_0xeb60('0xf')]][_0xeb60('0x10')])){_0x30dcfe=_['map'](_0x16a607[_0x366fe1[_0xeb60('0xf')]][_0xeb60('0x10')],_0xeb60('0x11'));}else if(!_[_0xeb60('0xe')](_0x366fe1[_0xeb60('0x11')])){_0x30dcfe=[_0x366fe1[_0xeb60('0x11')]];}return _0x30dcfe;}exports[_0xeb60('0x12')]=function(_0x365846){_0x365846[_0xeb60('0x13')]={};return new BPromise(function(_0x11b099,_0x436790){var _0x5e177e={'Start':function(_0x4ce204){var _0x1644df=this;return new Promise(function(_0x5229d8,_0x58dd4d){if(_0x4ce204){try{var _0x4eb0d6=[];var _0x5bd181=getId(_0x4ce204['channel'],_0x4ce204[_0xeb60('0x14')]?_0x4ce204[_0xeb60('0x14')]['id']:0x0,_0x4ce204[_0xeb60('0x15')]?_0x4ce204[_0xeb60('0x15')]['id']:0x0);if(_0x4ce204[_0xeb60('0x16')]&&_[_0xeb60('0x17')](_0x4ce204[_0xeb60('0x16')])&&_0x4ce204[_0xeb60('0x16')][_0xeb60('0x18')]){for(var _0xdfb694=0x0;_0xdfb694<_0x4ce204[_0xeb60('0x16')][_0xeb60('0x18')];_0xdfb694+=0x1){var _0x30c681=_0x4ce204['applications'][_0xdfb694];if(fs[_0xeb60('0x19')](path['join'](__dirname,_0xeb60('0x16'),_0x30c681[_0xeb60('0x1a')]+_0xeb60('0x1b')))){var _0x1e5e75=[];switch(_0x30c681[_0xeb60('0x1a')][_0xeb60('0x1c')]()){case'autoreply':var _0x5b43f4=_0x30c681['appdata']['split'](',');if(_0x4ce204[_0xeb60('0x1d')]==='mail'){_0x1e5e75[_0xeb60('0x1e')](_0x5b43f4[0x0]);_0x1e5e75['push'](_0x5b43f4[0x1]);_0x1e5e75[_0xeb60('0x1e')](_0x5b43f4[_0xeb60('0x1f')](0x2,_0x5b43f4['length'])['join'](','));}else{_0x1e5e75['push'](_0x5b43f4[0x0]);_0x1e5e75[_0xeb60('0x1e')](_0x5b43f4[_0xeb60('0x1f')](0x1,_0x5b43f4[_0xeb60('0x18')])[_0xeb60('0x20')](','));}break;case _0xeb60('0x21'):var _0x1b4711=_0x30c681['appdata'][_0xeb60('0x22')](',');_0x1e5e75[_0xeb60('0x1e')](_0x1b4711[0x0]);_0x1e5e75[_0xeb60('0x1e')](_0x1b4711[0x1]);_0x1e5e75[_0xeb60('0x1e')](_0x1b4711[_0xeb60('0x1f')](0x2,_0x1b4711[_0xeb60('0x18')])[_0xeb60('0x20')](','));break;case _0xeb60('0x23'):var _0xc5c981=_0x30c681[_0xeb60('0x24')]['split'](',');_0x1e5e75[_0xeb60('0x1e')](_0xc5c981[0x0]);_0x1e5e75[_0xeb60('0x1e')](_0xc5c981[0x1]);_0x1e5e75[_0xeb60('0x1e')](_0xc5c981[0x2]);_0x1e5e75[_0xeb60('0x1e')](_0xc5c981[0x3]);_0x1e5e75['push'](_0xc5c981[_0xeb60('0x1f')](0x4,_0xc5c981[_0xeb60('0x18')])['join'](','));break;case'amazonlex':var _0x3be40f=_0x30c681[_0xeb60('0x24')][_0xeb60('0x22')](',');_0x1e5e75['push'](_0x3be40f[0x0]);_0x1e5e75[_0xeb60('0x1e')](_0x3be40f[0x1]);_0x1e5e75[_0xeb60('0x1e')](_0x3be40f[0x2]);_0x1e5e75[_0xeb60('0x1e')](_0x3be40f[0x3]);_0x1e5e75[_0xeb60('0x1e')](_0x3be40f[_0xeb60('0x1f')](0x4,_0x3be40f[_0xeb60('0x18')])[_0xeb60('0x20')](','));break;case'message':_0x1e5e75[_0xeb60('0x1e')](_0x30c681[_0xeb60('0x24')]);break;case _0xeb60('0x25'):_0x1e5e75[_0xeb60('0x1e')](_0x30c681['TagId']);_0x1e5e75[_0xeb60('0x1e')](_0x30c681[_0xeb60('0x24')]);break;default:_0x1e5e75=_[_0xeb60('0xe')](_0x30c681['appdata'])?[]:_0x30c681[_0xeb60('0x24')]['split'](',');}var _0x2879d7={'id':util[_0xeb60('0xd')](_0xeb60('0x26'),_0x5bd181,_0x30c681['id'],_0x30c681[_0xeb60('0x1a')]),'condition':require('./interval')['condition'](_0x5bd181,getIntervals(_0x365846[_0xeb60('0x27')],_0x30c681),_0x365846),'consequence':require(_0xeb60('0x28')+_0x30c681[_0xeb60('0x1a')])['consequence'](_0x5bd181,_0x1e5e75,_0x365846,_0x4ce204),'p':_0x30c681[_0xeb60('0x29')]||0x0};logger[_0xeb60('0x2a')](_0xeb60('0x2b'),_0x2879d7['id'],_0xeb60('0x2c'),getIntervals(_0x365846[_0xeb60('0x27')],_0x30c681)[_0xeb60('0x20')](_0xeb60('0x2d')));_0x4eb0d6[_0xeb60('0x1e')](_0x2879d7);}else{logger['error'](_0xeb60('0x2e'),path[_0xeb60('0x20')](__dirname,_0xeb60('0x16'),_0x30c681[_0xeb60('0x1a')]+_0xeb60('0x1b')));}}_0x365846[_0xeb60('0x13')][_0x5bd181]=new RuleEngine(_0x4eb0d6);_0x365846[_0xeb60('0x13')][_0x5bd181][_0xeb60('0x2f')](_0x4ce204,function(_0x25c3aa){logger[_0xeb60('0x2a')](_0xeb60('0x30'),JSON[_0xeb60('0x31')](_0x25c3aa['matchPath']));if(_0x365846[_0xeb60('0x13')][_0x5bd181]){_0x365846[_0xeb60('0x13')][_0x5bd181][_0xeb60('0x32')](_0xeb60('0x33'));}});return _0x5229d8({'code':0xc8,'message':_0x4ce204});}else{logger[_0xeb60('0x2a')](_0xeb60('0x34'));return _0x5229d8({'code':0xc8,'message':_0x4ce204});}}catch(_0x5eee99){logger[_0xeb60('0x35')](_0x5eee99[_0xeb60('0x36')]);return _0x58dd4d(_0x1644df[_0xeb60('0x35')](0x1f4,_0x5eee99));}}return _0x58dd4d(_0xeb60('0x37'));});},'AcceptMessage':function(_0x3a1667){var _0x3ed2eb=this;return new Promise(function(_0x19bffa,_0x16bba6){if(_0x3a1667[_0xeb60('0x38')]&&_0x3a1667['agent']['id']){if(_0x365846[_0xeb60('0x39')][_0x3a1667[_0xeb60('0x38')]['id']]){_0x365846[_0xeb60('0x39')][_0x3a1667[_0xeb60('0x38')]['id']][_0xeb60('0x3a')]=![];_0x365846[_0xeb60('0x39')][_0x3a1667['agent']['id']][_0xeb60('0x3b')]=undefined;}}if(_0x3a1667[_0xeb60('0x14')]&&_0x3a1667[_0xeb60('0x14')]['id']){try{var _0xfe2375=getId(_0x3a1667[_0xeb60('0x1d')],_0x3a1667[_0xeb60('0x14')]?_0x3a1667['message']['id']:0x0,_0x3a1667['interaction']?_0x3a1667[_0xeb60('0x15')]['id']:0x0);if(_0x365846['rules'][_0xfe2375]){_0x365846['rules'][_0xfe2375]['emit']('end');if(rpc[_0x3a1667['channel']+'QueueReport']){rpc[_0x3a1667[_0xeb60('0x1d')]+_0xeb60('0x3c')]['update'](_0xfe2375,{'UserId':_0x3a1667[_0xeb60('0x14')][_0xeb60('0x3d')]})[_0xeb60('0x3e')](function(_0xcb4666){logger[_0xeb60('0x35')]('error\x20update\x20queue\x20report');});}}return _0x19bffa({'code':0xc8,'message':_0x3a1667});}catch(_0xb5b339){logger[_0xeb60('0x35')](_0xb5b339[_0xeb60('0x36')]);return _0x16bba6(_0x3ed2eb[_0xeb60('0x35')](0x1f4,_0xb5b339));}}logger[_0xeb60('0x35')](_0xeb60('0x3f'));return _0x16bba6(_0x3ed2eb[_0xeb60('0x35')](0x1f4,_0xeb60('0x3f')));});},'RejectMessage':function(_0xd66916){var _0x20b0a5=this;return new Promise(function(_0x51ae6f,_0x46737b){if(_0xd66916[_0xeb60('0x38')]&&_0xd66916[_0xeb60('0x38')]['id']){try{if(_0x365846[_0xeb60('0x39')][_0xd66916[_0xeb60('0x38')]['id']]){_0x365846[_0xeb60('0x39')][_0xd66916[_0xeb60('0x38')]['id']]['busy']=![];_0x365846[_0xeb60('0x39')][_0xd66916[_0xeb60('0x38')]['id']][_0xeb60('0x3b')]=undefined;}return _0x51ae6f({'code':0xc8,'message':_0xd66916});}catch(_0x2b6b27){logger['error'](_0x2b6b27[_0xeb60('0x36')]);return _0x46737b(_0x20b0a5['error'](0x1f4,_0x2b6b27));}}logger[_0xeb60('0x35')](_0xeb60('0x3f'));return _0x46737b(_0x20b0a5[_0xeb60('0x35')](0x1f4,_0xeb60('0x3f')));});},'AbandonInteraction':function(_0x41e602){var _0x49180c=this;return new Promise(function(_0x41f694,_0x4664f1){if(_0x41e602[_0xeb60('0x1d')]&&_0x41e602[_0xeb60('0x15')]&&_0x41e602[_0xeb60('0x15')]['id']){try{var _0x13cfc1=getId(_0x41e602[_0xeb60('0x1d')],_0x41e602[_0xeb60('0x14')]?_0x41e602[_0xeb60('0x14')]['id']:0x0,_0x41e602['interaction']?_0x41e602[_0xeb60('0x15')]['id']:0x0);if(_0x365846[_0xeb60('0x13')][_0x13cfc1]){_0x365846[_0xeb60('0x13')][_0x13cfc1][_0xeb60('0x32')](_0xeb60('0x40'));}return _0x41f694({'code':0xc8,'message':_0x41e602});}catch(_0x104a9b){logger[_0xeb60('0x35')](_0x104a9b['stack']);return _0x4664f1(_0x49180c[_0xeb60('0x35')](0x1f4,_0x104a9b));}}logger[_0xeb60('0x35')]('message\x20is\x20empty');return _0x4664f1(_0x49180c['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x24249f){var _0x278269=this;return new Promise(function(_0xd3f49d,_0x42a41c){if(_0x365846[_0xeb60('0x39')][_0xeb60('0x41')](_0x24249f['id'])){for(var _0x32c004 in _0x24249f[_0xeb60('0x42')]){if(_0x24249f[_0xeb60('0x42')]['hasOwnProperty'](_0x32c004)){if(_0x365846['agents'][_0x24249f['id']][_0xeb60('0x41')](_0x32c004+_0xeb60('0x43'))){_0x365846[_0xeb60('0x39')][_0x24249f['id']][_0x32c004+_0xeb60('0x43')]=parseInt(_0x24249f[_0xeb60('0x42')][_0x32c004],0xa);}}}_0x365846[_0xeb60('0x39')][_0x24249f['id']]['updateRealtime']();return _0xd3f49d({'code':0xc8,'message':_0x365846[_0xeb60('0x39')][_0x24249f['id']]});}else{return _0x42a41c(_0x278269[_0xeb60('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x218f9a){return new Promise(function(_0x2e5b28,_0x2f0d06){var _0x48afa1=_[_0xeb60('0x44')](_0x365846['agents']);_0x2e5b28({'count':_0x48afa1[_0xeb60('0x18')],'rows':_0x48afa1});});},'ChatQueues':function(_0x4f989b){return new Promise(function(_0x299c28,_0xa8cd46){var _0x598361=[];for(var _0xdfea6b in _0x365846[_0xeb60('0x45')]){if(_0x365846[_0xeb60('0x45')][_0xeb60('0x41')](_0xdfea6b)){var _0x4357ed=_0x365846['chatQueues'][_0xdfea6b];var _0x4cd36b={'id':_0x4357ed['id'],'available':_0x4357ed[_0xeb60('0x46')],'loggedIn':_0x4357ed[_0xeb60('0x47')],'name':_0x4357ed['name'],'paused':_0x4357ed[_0xeb60('0x48')],'waiting':_0x4357ed['waiting']};_0x598361[_0xeb60('0x1e')](_0x4cd36b);}}_0x299c28({'count':_0x598361[_0xeb60('0x18')],'rows':_0x598361});});},'MailQueues':function(_0x471ce7){return new Promise(function(_0x354df,_0x5016cf){var _0x3ebcb9=[];for(var _0x582674 in _0x365846['mailQueues']){if(_0x365846[_0xeb60('0x49')][_0xeb60('0x41')](_0x582674)){var _0x2f6055=_0x365846[_0xeb60('0x49')][_0x582674];var _0x5bbc92={'id':_0x2f6055['id'],'available':_0x2f6055[_0xeb60('0x46')],'loggedIn':_0x2f6055['loggedIn'],'name':_0x2f6055['name'],'paused':_0x2f6055[_0xeb60('0x48')],'waiting':_0x2f6055[_0xeb60('0x4a')]};_0x3ebcb9[_0xeb60('0x1e')](_0x5bbc92);}}_0x354df({'count':_0x3ebcb9[_0xeb60('0x18')],'rows':_0x3ebcb9});});},'OpenchannelQueues':function(_0x219fbf){return new Promise(function(_0x5d7cb5,_0x580f8b){var _0x1e35cf=[];for(var _0x204e1a in _0x365846[_0xeb60('0x4b')]){if(_0x365846[_0xeb60('0x4b')][_0xeb60('0x41')](_0x204e1a)){var _0x2eed45=_0x365846['openchannelQueues'][_0x204e1a];var _0x1367ed={'id':_0x2eed45['id'],'available':_0x2eed45[_0xeb60('0x46')],'loggedIn':_0x2eed45[_0xeb60('0x47')],'name':_0x2eed45[_0xeb60('0x4c')],'paused':_0x2eed45['paused'],'waiting':_0x2eed45[_0xeb60('0x4a')]};_0x1e35cf[_0xeb60('0x1e')](_0x1367ed);}}_0x5d7cb5({'count':_0x1e35cf[_0xeb60('0x18')],'rows':_0x1e35cf});});},'SmsQueues':function(_0x1dcaed){return new Promise(function(_0x44a059,_0x313178){var _0x3288b0=[];for(var _0x36242d in _0x365846[_0xeb60('0x4d')]){if(_0x365846[_0xeb60('0x4d')][_0xeb60('0x41')](_0x36242d)){var _0x53f0af=_0x365846['smsQueues'][_0x36242d];var _0x990a2f={'id':_0x53f0af['id'],'available':_0x53f0af[_0xeb60('0x46')],'loggedIn':_0x53f0af[_0xeb60('0x47')],'name':_0x53f0af[_0xeb60('0x4c')],'paused':_0x53f0af['paused'],'waiting':_0x53f0af['waiting']};_0x3288b0[_0xeb60('0x1e')](_0x990a2f);}}_0x44a059({'count':_0x3288b0[_0xeb60('0x18')],'rows':_0x3288b0});});},'FaxQueues':function(_0x5e70a6){return new Promise(function(_0x2d0cb8,_0x1db286){var _0x2564b3=[];for(var _0x174fc8 in _0x365846[_0xeb60('0x4e')]){if(_0x365846['faxQueues'][_0xeb60('0x41')](_0x174fc8)){var _0x4446f2=_0x365846[_0xeb60('0x4e')][_0x174fc8];var _0x3432b0={'id':_0x4446f2['id'],'available':_0x4446f2[_0xeb60('0x46')],'loggedIn':_0x4446f2[_0xeb60('0x47')],'name':_0x4446f2[_0xeb60('0x4c')],'paused':_0x4446f2['paused'],'waiting':_0x4446f2[_0xeb60('0x4a')]};_0x2564b3['push'](_0x3432b0);}}_0x2d0cb8({'count':_0x2564b3[_0xeb60('0x18')],'rows':_0x2564b3});});},'WhatsappQueues':function(_0x5eaaeb){return new Promise(function(_0x53876c,_0x26443f){var _0x5905a9=[];for(var _0x563022 in _0x365846[_0xeb60('0x4f')]){if(_0x365846['whatsappQueues'][_0xeb60('0x41')](_0x563022)){var _0x571e91=_0x365846[_0xeb60('0x4f')][_0x563022];var _0x377cde={'id':_0x571e91['id'],'available':_0x571e91['available'],'loggedIn':_0x571e91['loggedIn'],'name':_0x571e91[_0xeb60('0x4c')],'paused':_0x571e91[_0xeb60('0x48')],'waiting':_0x571e91[_0xeb60('0x4a')]};_0x5905a9['push'](_0x377cde);}}_0x53876c({'count':_0x5905a9['length'],'rows':_0x5905a9});});},'ChatQueuesWaitingInteractions':function(_0x4f562d){return new Promise(function(_0x432bb3,_0x531d22){var _0x36466e=_['values'](_0x365846['chatQueuesWaitingInteractions']);_0x432bb3({'count':_0x36466e[_0xeb60('0x18')],'rows':_0x36466e});});},'MailQueuesWaitingInteractions':function(_0x243470){return new Promise(function(_0x580452,_0x4430a7){var _0x290252=_['values'](_0x365846[_0xeb60('0x50')]);_0x580452({'count':_0x290252[_0xeb60('0x18')],'rows':_0x290252});});},'OpenchannelQueuesWaitingInteractions':function(_0x36f8c3){return new Promise(function(_0x3ebad6,_0x25e166){var _0x1979a8=_[_0xeb60('0x44')](_0x365846[_0xeb60('0x51')]);_0x3ebad6({'count':_0x1979a8[_0xeb60('0x18')],'rows':_0x1979a8});});},'SmsQueuesWaitingInteractions':function(_0x51068f){return new Promise(function(_0x262517,_0x5a5c58){var _0xca28b6=_[_0xeb60('0x44')](_0x365846[_0xeb60('0x52')]);_0x262517({'count':_0xca28b6[_0xeb60('0x18')],'rows':_0xca28b6});});},'FaxQueuesWaitingInteractions':function(_0x4371c0){return new Promise(function(_0x4c3e7f,_0x551d87){var _0x58b809=_[_0xeb60('0x44')](_0x365846[_0xeb60('0x53')]);_0x4c3e7f({'count':_0x58b809[_0xeb60('0x18')],'rows':_0x58b809});});},'WhatsappQueuesWaitingInteractions':function(_0x53c472){return new Promise(function(_0x3f4b3b,_0x41a655){var _0x14df2c=_[_0xeb60('0x44')](_0x365846[_0xeb60('0x54')]);_0x3f4b3b({'count':_0x14df2c[_0xeb60('0x18')],'rows':_0x14df2c});});}};var _0x509499=jayson[_0xeb60('0x55')](_0x5e177e)['http']();_0x509499['on'](_0xeb60('0x35'),function(_0x700687){logger[_0xeb60('0x35')](JSON['stringify'](_0x700687));return _0x436790(_0x700687);});_0x509499[_0xeb60('0x12')](0x232c,'127.0.0.1',function(){console[_0xeb60('0x56')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x11b099('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1f87724..e88d2b7 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 _0x402b=['push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','util','lodash','../../../config/logger','client','http','then','error','message','result','catch','condition','rules','stop','length'];(function(_0xa1181c,_0x1724a4){var _0x1ef296=function(_0x1233e0){while(--_0x1233e0){_0xa1181c['push'](_0xa1181c['shift']());}};_0x1ef296(++_0x1724a4);}(_0x402b,0x19b));var _0xb402=function(_0x52d481,_0x5cef5c){_0x52d481=_0x52d481-0x0;var _0x3c4aa7=_0x402b[_0x52d481];return _0x3c4aa7;};'use strict';var util=require(_0xb402('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xb402('0x1'));var logger=require(_0xb402('0x2'))('routing');var client=jayson[_0xb402('0x3')][_0xb402('0x4')]({'port':0x232a});function request(_0x47e61e,_0x5c526c){return new BPromise(function(_0x3b91e8,_0x4cb71e){return client['request'](_0x47e61e,_0x5c526c)[_0xb402('0x5')](function(_0x24b624){if(_0x24b624[_0xb402('0x6')]){return _0x4cb71e(_0x24b624[_0xb402('0x6')][_0xb402('0x7')]);}else{return _0x3b91e8(_0x24b624[_0xb402('0x8')]);}})[_0xb402('0x9')](function(_0x338c68){return _0x4cb71e(_0x338c68);});});}exports[_0xb402('0xa')]=function(_0x3f1dc5,_0xd25ee5,_0x221125){return function(_0x326164){if(_0x221125[_0xb402('0xb')]&&!_0x221125[_0xb402('0xb')][_0x3f1dc5]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3f1dc5);return _0x326164[_0xb402('0xc')]();}var _0x1ff161=[];for(var _0x36ce1e=0x0;_0x36ce1e<_0xd25ee5[_0xb402('0xd')];_0x36ce1e+=0x1){_0x1ff161[_0xb402('0xe')](request(_0xb402('0xf'),{'command':util[_0xb402('0x10')](_0xb402('0x11'),_0xd25ee5[_0x36ce1e])})[_0xb402('0x5')](function(_0x5466d2){return _0x5466d2&&_0x5466d2[_0xb402('0x7')]&&_0x5466d2['message'][_0xb402('0x12')](_0xb402('0x13'))>=0x0?!![]:![];})[_0xb402('0x9')](function(_0x3c940f){logger[_0xb402('0x6')](_0xb402('0x14'),_0x3f1dc5,_0xd25ee5[_0x36ce1e]);}));}BPromise['all'](_0x1ff161)[_0xb402('0x5')](function(_0x349900){var _0x299d01=_[_0xb402('0x15')](_0x349900);logger['info'](_0xb402('0x16'),_0x3f1dc5,_0xd25ee5['join'](_0xb402('0x17')),_0x299d01);_0x326164['when'](_0x299d01);})['catch'](function(_0x18c8b3){console['log'](_0x18c8b3);logger[_0xb402('0x6')](_0xb402('0x16'),_0x3f1dc5,_0xd25ee5['join'](_0xb402('0x17')),_0x18c8b3[_0xb402('0x18')]);_0x326164['stop']();});};}; \ No newline at end of file +var _0xe096=['stop','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','bluebird','jayson/promise','lodash','routing','client','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x58fc61,_0x18f572){var _0x244b36=function(_0x32c0ce){while(--_0x32c0ce){_0x58fc61['push'](_0x58fc61['shift']());}};_0x244b36(++_0x18f572);}(_0xe096,0x125));var _0x6e09=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0xe096[_0x4fdc46];return _0x2c178a;};'use strict';var util=require('util');var BPromise=require(_0x6e09('0x0'));var jayson=require(_0x6e09('0x1'));var _=require(_0x6e09('0x2'));var logger=require('../../../config/logger')(_0x6e09('0x3'));var client=jayson[_0x6e09('0x4')]['http']({'port':0x232a});function request(_0x4f99b5,_0x47f92d){return new BPromise(function(_0x1b36ae,_0x2218eb){return client[_0x6e09('0x5')](_0x4f99b5,_0x47f92d)[_0x6e09('0x6')](function(_0x55de78){if(_0x55de78[_0x6e09('0x7')]){return _0x2218eb(_0x55de78[_0x6e09('0x7')][_0x6e09('0x8')]);}else{return _0x1b36ae(_0x55de78[_0x6e09('0x9')]);}})[_0x6e09('0xa')](function(_0x4b1fbc){return _0x2218eb(_0x4b1fbc);});});}exports[_0x6e09('0xb')]=function(_0xfd0aa4,_0x1d4095,_0x2dbded){return function(_0x5ca3c2){if(_0x2dbded[_0x6e09('0xc')]&&!_0x2dbded[_0x6e09('0xc')][_0xfd0aa4]){logger[_0x6e09('0xd')](_0x6e09('0xe'),_0xfd0aa4);return _0x5ca3c2[_0x6e09('0xf')]();}var _0x950c0=[];for(var _0x2cbb2c=0x0;_0x2cbb2c<_0x1d4095['length'];_0x2cbb2c+=0x1){_0x950c0['push'](request(_0x6e09('0x10'),{'command':util[_0x6e09('0x11')](_0x6e09('0x12'),_0x1d4095[_0x2cbb2c])})[_0x6e09('0x6')](function(_0x2b7d60){return _0x2b7d60&&_0x2b7d60[_0x6e09('0x8')]&&_0x2b7d60['message'][_0x6e09('0x13')](_0x6e09('0x14'))>=0x0?!![]:![];})[_0x6e09('0xa')](function(_0x12d64c){logger[_0x6e09('0x7')](_0x6e09('0x15'),_0xfd0aa4,_0x1d4095[_0x2cbb2c]);}));}BPromise['all'](_0x950c0)[_0x6e09('0x6')](function(_0x1ba17d){var _0x48e9a6=_[_0x6e09('0x16')](_0x1ba17d);logger[_0x6e09('0xd')](_0x6e09('0x17'),_0xfd0aa4,_0x1d4095[_0x6e09('0x18')](_0x6e09('0x19')),_0x48e9a6);_0x5ca3c2['when'](_0x48e9a6);})[_0x6e09('0xa')](function(_0x5429c2){console[_0x6e09('0x1a')](_0x5429c2);logger[_0x6e09('0x7')](_0x6e09('0x17'),_0xfd0aa4,_0x1d4095[_0x6e09('0x18')](_0x6e09('0x19')),_0x5429c2[_0x6e09('0x1b')]);_0x5ca3c2['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index fee4a2c..a00475f 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 _0x2bc6=['lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum'];(function(_0x29857d,_0x355f09){var _0x12a7d=function(_0x7305d3){while(--_0x7305d3){_0x29857d['push'](_0x29857d['shift']());}};_0x12a7d(++_0x355f09);}(_0x2bc6,0x163));var _0x62bc=function(_0x513dde,_0x27b9c2){_0x513dde=_0x513dde-0x0;var _0x592532=_0x2bc6[_0x513dde];return _0x592532;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var utils=require(_0x62bc('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x56939b,_0x4b4e73){utils['info'](util['format'](_0x62bc('0x3'),_0x56939b['uniqueid'],_0x56939b[_0x62bc('0x4')],_0x56939b[_0x62bc('0x5')],_0x56939b['membername'],_0x56939b[_0x62bc('0x6')],_0x56939b[_0x62bc('0x7')],_0x56939b[_0x62bc('0x8')],_0x56939b[_0x62bc('0x9')]));if(_0x56939b[_0x62bc('0x5')]){utils[_0x62bc('0xa')](_0x56939b['queue'])[_0x62bc('0xb')](function(_0x762c71){if(_0x762c71){_0x56939b[_0x62bc('0xc')]=_0x762c71[_0x62bc('0xc')];_0x56939b['agentacw']=_0x56939b[_0x62bc('0xd')]?_0x762c71[_0x62bc('0xe')]:![];_0x56939b[_0x62bc('0xf')]=_0x56939b['agentacw']?_0x762c71[_0x62bc('0x10')]:0x0;}utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);});}else{utils[_0x62bc('0x11')](_0x62bc('0x12'),_0x56939b);}if(_0x4b4e73){delete transfers[_0x56939b[_0x62bc('0x13')]];}else{delete agents[_0x56939b[_0x62bc('0x14')]];}}exports['agentcalled']=function(_0x2a96ae){try{utils[_0x62bc('0x15')](util['format'](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x2a96ae);agents[_0x2a96ae[_0x62bc('0x14')]]=_0x2a96ae;agents[_0x2a96ae['destuniqueid']][_0x62bc('0x17')]=utils[_0x62bc('0x18')]();agents[_0x2a96ae['destuniqueid']]['lastevent']=_0x62bc('0x19');agents[_0x2a96ae[_0x62bc('0x14')]]['connectedlinenum']=null;agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1a')]=null;utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1d'),_0x2a96ae[_0x62bc('0x13')],agents[_0x2a96ae[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x2a96ae[_0x62bc('0x14')]));}catch(_0x5ed51c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x16'),_0x2a96ae[_0x62bc('0x13')]),_0x5ed51c);}};exports['agentringnoanswer']=function(_0x380621){try{if(!_['isNil'](agents[_0x380621[_0x62bc('0x14')]])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')]('[%s][agents][agentringnoanswer]',_0x380621[_0x62bc('0x13')]),_0x380621);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x1f'),_0x380621[_0x62bc('0x13')],agents[_0x380621[_0x62bc('0x14')]]['membername'],_0x380621[_0x62bc('0x14')]));agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x20')]=!![];agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x21')]=utils['now']();agents[_0x380621['destuniqueid']][_0x62bc('0x9')]='timeout';agents[_0x380621[_0x62bc('0x14')]][_0x62bc('0x22')]=_0x62bc('0x23');agents[_0x380621['destuniqueid']][_0x62bc('0x24')]=_0x380621[_0x62bc('0x25')]?parseInt(_0x380621[_0x62bc('0x25')])/0x3e8:0x0;agents[_0x380621['destuniqueid']]['talktime']=0x0;unanswered[_0x62bc('0x26')](_0x380621[_0x62bc('0x14')]);}}catch(_0x23817c){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x27'),_0x380621[_0x62bc('0x13')]),_0x23817c);}};exports[_0x62bc('0x28')]=function(_0x5a9302){try{_[_0x62bc('0x29')](agents,function(_0x5e4491,_0x26701b){if(_0x5e4491[_0x62bc('0x13')]==_0x5a9302[_0x62bc('0x13')]&&!_[_0x62bc('0x2a')](unanswered,_0x5e4491[_0x62bc('0x14')])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x2b'),_0x5a9302[_0x62bc('0x13')]),_0x5a9302);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x2c'),_0x5a9302[_0x62bc('0x13')],_0x5e4491[_0x62bc('0x1e')],_0x5e4491[_0x62bc('0x14')]));_0x5e4491[_0x62bc('0x20')]=!![];_0x5e4491[_0x62bc('0x21')]=utils['now']();_0x5e4491[_0x62bc('0x9')]='abandoned';_0x5e4491['reason']=_0x62bc('0x2d');_0x5e4491['holdtime']=_0x5a9302['holdtime'];_0x5e4491['talktime']=0x0;writeDB(_0x5e4491);}});}catch(_0x3f22c1){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][queuecallerabandon]',_0x5a9302['uniqueid']),_0x3f22c1);}};exports['agentconnect']=function(_0x3c938d){try{if(agents[_0x3c938d[_0x62bc('0x14')]]){utils['debug'](util['format'](_0x62bc('0x2f'),_0x3c938d[_0x62bc('0x13')]),_0x3c938d);utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x30'),_0x3c938d[_0x62bc('0x13')],agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x1e')],_0x3c938d['destuniqueid']));agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x31')]=utils['now']();agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x8')]=_0x3c938d[_0x62bc('0x8')];agents[_0x3c938d[_0x62bc('0x14')]]['connectedlinename']=_0x3c938d[_0x62bc('0x1a')];agents[_0x3c938d['destuniqueid']][_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];agents[_0x3c938d[_0x62bc('0x14')]][_0x62bc('0x9')]='connect';_[_0x62bc('0x29')](agents,function(_0x5c806b,_0x392550){if(_0x5c806b[_0x62bc('0x14')]!=_0x3c938d[_0x62bc('0x14')]&&_0x5c806b[_0x62bc('0x13')]==_0x3c938d[_0x62bc('0x13')]){_0x5c806b[_0x62bc('0x32')]=0x0;_0x5c806b[_0x62bc('0x24')]=_0x3c938d[_0x62bc('0x25')];_0x5c806b[_0x62bc('0x20')]=!![];_0x5c806b['agentringnoanswerAt']=utils['now']();_0x5c806b[_0x62bc('0x9')]=_0x62bc('0x33');_0x5c806b['reason']=_0x62bc('0x33');_0x5c806b[_0x62bc('0x34')]=_0x3c938d[_0x62bc('0x14')];_0x5c806b[_0x62bc('0x35')]=_0x3c938d[_0x62bc('0x1e')];writeDB(_0x5c806b);}});}}catch(_0x5f3752){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')]('[%s][agents][agentconnect]',_0x3c938d['uniqueid']),_0x5f3752);}};exports[_0x62bc('0xd')]=function(_0xdbd9ee){try{if(!_[_0x62bc('0x36')](agents[_0xdbd9ee['destuniqueid']])){utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0xdbd9ee);utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xdbd9ee[_0x62bc('0x13')],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x1e')],_0xdbd9ee[_0x62bc('0x14')]));agents[_0xdbd9ee[_0x62bc('0x14')]]['agentcomplete']=!![];agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt']=utils[_0x62bc('0x18')]();agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0xdbd9ee['destuniqueid']]['agentcompleteAt'],agents[_0xdbd9ee['destuniqueid']][_0x62bc('0x31')]);agents[_0xdbd9ee[_0x62bc('0x14')]][_0x62bc('0x22')]=_0xdbd9ee[_0x62bc('0x22')];agents[_0xdbd9ee[_0x62bc('0x14')]]['lastevent']=_0x62bc('0x39');writeDB(agents[_0xdbd9ee[_0x62bc('0x14')]]);}}catch(_0x4859fc){utils[_0x62bc('0x2e')](util['format'](_0x62bc('0x37'),_0xdbd9ee[_0x62bc('0x13')]),_0x4859fc);}};exports[_0x62bc('0x3a')]=function(_0xca6190){try{if(!_[_0x62bc('0x36')](agents[_0xca6190[_0x62bc('0x3b')]])){utils[_0x62bc('0x15')](util['format'](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0xca6190);utils['info'](util[_0x62bc('0x1c')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0xca6190[_0x62bc('0x13')],agents[_0xca6190[_0x62bc('0x3b')]]['membername'],agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')]));agents[_0xca6190[_0x62bc('0x3b')]]['transfer']=!![];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3d')]=_0x62bc('0x3e');agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x3f')]=_0xca6190[_0x62bc('0x40')];agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x41')]=agents[_0xca6190[_0x62bc('0x3b')]][_0x62bc('0x13')];}}catch(_0x44d2a2){utils[_0x62bc('0x2e')](util[_0x62bc('0x1c')](_0x62bc('0x3c'),_0xca6190[_0x62bc('0x13')]),_0x44d2a2);}};exports[_0x62bc('0x42')]=function(_0x5b0e9b){try{utils[_0x62bc('0x15')](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x5b0e9b);if(_0x5b0e9b[_0x62bc('0x44')]==_0x5b0e9b[_0x62bc('0x45')]){if(!_[_0x62bc('0x36')](agents[_0x5b0e9b[_0x62bc('0x46')]])){utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x47'),_0x5b0e9b[_0x62bc('0x44')],agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x1e')]));agents[_0x5b0e9b['secondtransfereruniqueid']][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x3f')]=_0x5b0e9b[_0x62bc('0x4a')];agents[_0x5b0e9b[_0x62bc('0x46')]]['transferuniqueid']=_0x5b0e9b['origtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x4b')]&&agents[_0x5b0e9b[_0x62bc('0x4b')]]){agents[_0x5b0e9b[_0x62bc('0x4b')]]['agententerreason']=0x1;transfers[_0x5b0e9b[_0x62bc('0x4b')]]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x4b')]]);transfers[_0x5b0e9b[_0x62bc('0x4b')]]['calleridnum']=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x7')];transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4d')]=agents[_0x5b0e9b[_0x62bc('0x46')]][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x4b')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b['transfereeuniqueid']][_0x62bc('0x24')]=0x0;transfers[_0x5b0e9b[_0x62bc('0x4b')]][_0x62bc('0x4e')]=0x2;}}else if(_0x5b0e9b['secondtransfereruniqueid']==_0x5b0e9b[_0x62bc('0x4f')]){if(!_['isNil'](agents[_0x5b0e9b[_0x62bc('0x44')]])){utils[_0x62bc('0x1b')](util['format'](_0x62bc('0x47'),_0x5b0e9b['origtransfereruniqueid'],agents[_0x5b0e9b[_0x62bc('0x44')]]['membername']));agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x48')]=!![];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x3d')]=_0x62bc('0x49');agents[_0x5b0e9b[_0x62bc('0x44')]]['transferexten']=_0x5b0e9b[_0x62bc('0x50')];agents[_0x5b0e9b[_0x62bc('0x44')]][_0x62bc('0x41')]=_0x5b0e9b['secondtransfereruniqueid'];}if(_0x5b0e9b[_0x62bc('0x51')]&&agents[_0x5b0e9b[_0x62bc('0x51')]]){agents[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x1;transfers[_0x5b0e9b['transfertargetuniqueid']]=_[_0x62bc('0x4c')](agents[_0x5b0e9b[_0x62bc('0x51')]]);transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x7')]=agents[_0x5b0e9b[_0x62bc('0x44')]]['calleridnum'];transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x4d')]=agents[_0x5b0e9b['origtransfereruniqueid']][_0x62bc('0x4d')];transfers[_0x5b0e9b[_0x62bc('0x51')]]['agentcalledAt']=utils[_0x62bc('0x18')]();transfers[_0x5b0e9b['transfertargetuniqueid']][_0x62bc('0x31')]=utils['now']();transfers[_0x5b0e9b[_0x62bc('0x51')]]['holdtime']=0x0;transfers[_0x5b0e9b[_0x62bc('0x51')]][_0x62bc('0x4e')]=0x2;}}}catch(_0x6bb64b){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x43'),_0x5b0e9b[_0x62bc('0x44')]),_0x6bb64b);}};exports[_0x62bc('0x52')]=function(_0x177fba){try{utils['debug'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba[_0x62bc('0x13')]),_0x177fba);if(agents[_0x177fba[_0x62bc('0x13')]]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]===_0x62bc('0x23')){if(_0x177fba[_0x62bc('0x54')]==='21'){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')]=_0x62bc('0x55');agents[_0x177fba['uniqueid']][_0x62bc('0x9')]=_0x62bc('0x55');}utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);var _0x5698a4=unanswered[_0x62bc('0x56')](_0x177fba[_0x62bc('0x13')]);if(_0x5698a4>-0x1){unanswered[_0x62bc('0x57')](_0x5698a4,0x1);}}if(transfers[_0x177fba[_0x62bc('0x13')]]){transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](transfers[_0x177fba['uniqueid']][_0x62bc('0x58')],transfers[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);transfers[_0x177fba[_0x62bc('0x13')]]['reason']=_0x62bc('0x59');transfers[_0x177fba[_0x62bc('0x13')]]['lastevent']=_0x62bc('0x39');utils['info'](util[_0x62bc('0x1c')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x177fba[_0x62bc('0x13')],transfers[_0x177fba['uniqueid']][_0x62bc('0x1e')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x22')],transfers[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]));writeDB(transfers[_0x177fba[_0x62bc('0x13')]],!![]);}if(agents[_0x177fba['uniqueid']]&&agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x31')]){agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0xd')]=!![];agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')]=utils[_0x62bc('0x18')]();agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x32')]=utils[_0x62bc('0x38')](agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x58')],agents[_0x177fba[_0x62bc('0x13')]]['agentconnectAt']);agents[_0x177fba['uniqueid']]['reason']=agents[_0x177fba[_0x62bc('0x13')]]['transfer']?_0x62bc('0x48'):_0x62bc('0x59');agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x9')]=_0x62bc('0x39');utils[_0x62bc('0x1b')](util[_0x62bc('0x1c')](_0x62bc('0x5a'),_0x177fba['uniqueid'],agents[_0x177fba[_0x62bc('0x13')]][_0x62bc('0x1e')],agents[_0x177fba[_0x62bc('0x13')]]['reason'],agents[_0x177fba[_0x62bc('0x13')]]['lastevent']));writeDB(agents[_0x177fba[_0x62bc('0x13')]]);}}catch(_0x3aa295){utils['error'](util[_0x62bc('0x1c')](_0x62bc('0x53'),_0x177fba['uniqueid']),_0x3aa295);}}; \ No newline at end of file +var _0xb688=['agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','util','./utils','info','format','uniqueid','channel','queue','membername','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','push','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','reason','talktime','[%s][agents][queuecallerabandon]'];(function(_0x264d96,_0x850a8d){var _0xffd266=function(_0x17286b){while(--_0x17286b){_0x264d96['push'](_0x264d96['shift']());}};_0xffd266(++_0x850a8d);}(_0xb688,0xcf));var _0x8b68=function(_0x40ab16,_0x33e4af){_0x40ab16=_0x40ab16-0x0;var _0x1e2c78=_0xb688[_0x40ab16];return _0x1e2c78;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var utils=require(_0x8b68('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x266285,_0x1080e8){utils[_0x8b68('0x2')](util[_0x8b68('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x266285[_0x8b68('0x4')],_0x266285[_0x8b68('0x5')],_0x266285[_0x8b68('0x6')],_0x266285[_0x8b68('0x7')],_0x266285['interface'],_0x266285[_0x8b68('0x8')],_0x266285['connectedlinenum'],_0x266285[_0x8b68('0x9')]));if(_0x266285[_0x8b68('0x6')]){utils[_0x8b68('0xa')](_0x266285[_0x8b68('0x6')])[_0x8b68('0xb')](function(_0x3f9685){if(_0x3f9685){_0x266285[_0x8b68('0xc')]=_0x3f9685[_0x8b68('0xc')];_0x266285[_0x8b68('0xd')]=_0x266285[_0x8b68('0xe')]?_0x3f9685[_0x8b68('0xf')]:![];_0x266285[_0x8b68('0x10')]=_0x266285[_0x8b68('0xd')]?_0x3f9685['acwTimeout']:0x0;}utils[_0x8b68('0x11')](_0x8b68('0x12'),_0x266285);});}else{utils[_0x8b68('0x11')](_0x8b68('0x12'),_0x266285);}if(_0x1080e8){delete transfers[_0x266285[_0x8b68('0x4')]];}else{delete agents[_0x266285[_0x8b68('0x13')]];}}exports[_0x8b68('0x14')]=function(_0x137c8e){try{utils[_0x8b68('0x15')](util['format'](_0x8b68('0x16'),_0x137c8e['uniqueid']),_0x137c8e);agents[_0x137c8e['destuniqueid']]=_0x137c8e;agents[_0x137c8e[_0x8b68('0x13')]][_0x8b68('0x17')]=utils[_0x8b68('0x18')]();agents[_0x137c8e['destuniqueid']]['lastevent']=_0x8b68('0x19');agents[_0x137c8e['destuniqueid']][_0x8b68('0x1a')]=null;agents[_0x137c8e[_0x8b68('0x13')]][_0x8b68('0x1b')]=null;utils[_0x8b68('0x2')](util['format'](_0x8b68('0x1c'),_0x137c8e[_0x8b68('0x4')],agents[_0x137c8e['destuniqueid']][_0x8b68('0x7')],_0x137c8e[_0x8b68('0x13')]));}catch(_0x3cf3bd){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')]('[%s][agents][agentcalled]',_0x137c8e[_0x8b68('0x4')]),_0x3cf3bd);}};exports[_0x8b68('0x1e')]=function(_0x59e9b1){try{if(!_[_0x8b68('0x1f')](agents[_0x59e9b1[_0x8b68('0x13')]])){utils[_0x8b68('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x59e9b1[_0x8b68('0x4')]),_0x59e9b1);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x20'),_0x59e9b1[_0x8b68('0x4')],agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x7')],_0x59e9b1[_0x8b68('0x13')]));agents[_0x59e9b1['destuniqueid']][_0x8b68('0x1e')]=!![];agents[_0x59e9b1[_0x8b68('0x13')]]['agentringnoanswerAt']=utils[_0x8b68('0x18')]();agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x9')]='timeout';agents[_0x59e9b1['destuniqueid']]['reason']=_0x8b68('0x21');agents[_0x59e9b1[_0x8b68('0x13')]][_0x8b68('0x22')]=_0x59e9b1['ringtime']?parseInt(_0x59e9b1[_0x8b68('0x23')])/0x3e8:0x0;agents[_0x59e9b1['destuniqueid']]['talktime']=0x0;unanswered[_0x8b68('0x24')](_0x59e9b1['destuniqueid']);}}catch(_0x26cad7){utils[_0x8b68('0x1d')](util['format']('[%s][agents][agentringnoanswer]',_0x59e9b1[_0x8b68('0x4')]),_0x26cad7);}};exports[_0x8b68('0x25')]=function(_0x1e7c06){try{_[_0x8b68('0x26')](agents,function(_0x210926,_0x2ad2df){if(_0x210926[_0x8b68('0x4')]==_0x1e7c06['uniqueid']&&!_[_0x8b68('0x27')](unanswered,_0x210926['destuniqueid'])){utils[_0x8b68('0x15')](util[_0x8b68('0x3')]('[%s][agents][queuecallerabandon]',_0x1e7c06[_0x8b68('0x4')]),_0x1e7c06);utils[_0x8b68('0x2')](util[_0x8b68('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1e7c06['uniqueid'],_0x210926[_0x8b68('0x7')],_0x210926[_0x8b68('0x13')]));_0x210926[_0x8b68('0x1e')]=!![];_0x210926[_0x8b68('0x28')]=utils[_0x8b68('0x18')]();_0x210926[_0x8b68('0x9')]=_0x8b68('0x29');_0x210926[_0x8b68('0x2a')]=_0x8b68('0x29');_0x210926[_0x8b68('0x22')]=_0x1e7c06[_0x8b68('0x22')];_0x210926[_0x8b68('0x2b')]=0x0;writeDB(_0x210926);}});}catch(_0x232fa9){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')](_0x8b68('0x2c'),_0x1e7c06[_0x8b68('0x4')]),_0x232fa9);}};exports[_0x8b68('0x2d')]=function(_0x120b34){try{if(agents[_0x120b34[_0x8b68('0x13')]]){utils[_0x8b68('0x15')](util[_0x8b68('0x3')]('[%s][agents][agentconnect]',_0x120b34['uniqueid']),_0x120b34);utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x2e'),_0x120b34[_0x8b68('0x4')],agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x7')],_0x120b34[_0x8b68('0x13')]));agents[_0x120b34[_0x8b68('0x13')]]['agentconnectAt']=utils[_0x8b68('0x18')]();agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x1a')]=_0x120b34[_0x8b68('0x1a')];agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x1b')]=_0x120b34[_0x8b68('0x1b')];agents[_0x120b34[_0x8b68('0x13')]]['holdtime']=_0x120b34[_0x8b68('0x23')];agents[_0x120b34[_0x8b68('0x13')]][_0x8b68('0x9')]=_0x8b68('0x2f');_[_0x8b68('0x26')](agents,function(_0x3b3394,_0xa748c2){if(_0x3b3394['destuniqueid']!=_0x120b34[_0x8b68('0x13')]&&_0x3b3394[_0x8b68('0x4')]==_0x120b34['uniqueid']){_0x3b3394[_0x8b68('0x2b')]=0x0;_0x3b3394[_0x8b68('0x22')]=_0x120b34['ringtime'];_0x3b3394['agentringnoanswer']=!![];_0x3b3394['agentringnoanswerAt']=utils['now']();_0x3b3394[_0x8b68('0x9')]=_0x8b68('0x30');_0x3b3394['reason']=_0x8b68('0x30');_0x3b3394['answeredelsewheredestinationuniqueid']=_0x120b34[_0x8b68('0x13')];_0x3b3394[_0x8b68('0x31')]=_0x120b34['membername'];writeDB(_0x3b3394);}});}}catch(_0x2f90d9){utils['error'](util['format']('[%s][agents][agentconnect]',_0x120b34[_0x8b68('0x4')]),_0x2f90d9);}};exports[_0x8b68('0xe')]=function(_0x3ba80e){try{if(!_[_0x8b68('0x1f')](agents[_0x3ba80e['destuniqueid']])){utils[_0x8b68('0x15')](util['format'](_0x8b68('0x32'),_0x3ba80e[_0x8b68('0x4')]),_0x3ba80e);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x33'),_0x3ba80e[_0x8b68('0x4')],agents[_0x3ba80e[_0x8b68('0x13')]]['membername'],_0x3ba80e[_0x8b68('0x13')]));agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0xe')]=!![];agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x34')],agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x36')]);agents[_0x3ba80e[_0x8b68('0x13')]][_0x8b68('0x2a')]=_0x3ba80e[_0x8b68('0x2a')];agents[_0x3ba80e['destuniqueid']][_0x8b68('0x9')]=_0x8b68('0x37');writeDB(agents[_0x3ba80e['destuniqueid']]);}}catch(_0xeab810){utils['error'](util['format']('[%s][agents][agentcomplete]',_0x3ba80e[_0x8b68('0x4')]),_0xeab810);}};exports[_0x8b68('0x38')]=function(_0x34047c){try{if(!_[_0x8b68('0x1f')](agents[_0x34047c['transfereruniqueid']])){utils['debug'](util[_0x8b68('0x3')](_0x8b68('0x39'),_0x34047c[_0x8b68('0x4')]),_0x34047c);utils['info'](util[_0x8b68('0x3')](_0x8b68('0x3a'),_0x34047c['uniqueid'],agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x7')],agents[_0x34047c['transfereruniqueid']][_0x8b68('0x4')]));agents[_0x34047c[_0x8b68('0x3b')]]['transfer']=!![];agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x3c')]='blind';agents[_0x34047c['transfereruniqueid']]['transferexten']=_0x34047c[_0x8b68('0x3d')];agents[_0x34047c[_0x8b68('0x3b')]][_0x8b68('0x3e')]=agents[_0x34047c[_0x8b68('0x3b')]]['uniqueid'];}}catch(_0x5a1711){utils[_0x8b68('0x1d')](util[_0x8b68('0x3')](_0x8b68('0x39'),_0x34047c['uniqueid']),_0x5a1711);}};exports[_0x8b68('0x3f')]=function(_0xe1ba20){try{utils[_0x8b68('0x15')](util['format'](_0x8b68('0x40'),_0xe1ba20['origtransfereruniqueid']),_0xe1ba20);if(_0xe1ba20[_0x8b68('0x41')]==_0xe1ba20[_0x8b68('0x42')]){if(!_['isNil'](agents[_0xe1ba20[_0x8b68('0x43')]])){utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x44'),_0xe1ba20[_0x8b68('0x41')],agents[_0xe1ba20['secondtransfereruniqueid']][_0x8b68('0x7')]));agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x45')]=!![];agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x3c')]=_0x8b68('0x46');agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x47')]=_0xe1ba20['origtransfererexten'];agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x3e')]=_0xe1ba20[_0x8b68('0x41')];}if(_0xe1ba20[_0x8b68('0x48')]&&agents[_0xe1ba20[_0x8b68('0x48')]]){agents[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x49')]=0x1;transfers[_0xe1ba20[_0x8b68('0x48')]]=_[_0x8b68('0x4a')](agents[_0xe1ba20[_0x8b68('0x48')]]);transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x8')]=agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x8')];transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x4b')]=agents[_0xe1ba20[_0x8b68('0x43')]][_0x8b68('0x4b')];transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x17')]=utils['now']();transfers[_0xe1ba20[_0x8b68('0x48')]]['agentconnectAt']=utils['now']();transfers[_0xe1ba20[_0x8b68('0x48')]]['holdtime']=0x0;transfers[_0xe1ba20[_0x8b68('0x48')]][_0x8b68('0x49')]=0x2;}}else if(_0xe1ba20[_0x8b68('0x43')]==_0xe1ba20['secondtransfererlinkedid']){if(!_[_0x8b68('0x1f')](agents[_0xe1ba20[_0x8b68('0x41')]])){utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x44'),_0xe1ba20[_0x8b68('0x41')],agents[_0xe1ba20[_0x8b68('0x41')]]['membername']));agents[_0xe1ba20['origtransfereruniqueid']][_0x8b68('0x45')]=!![];agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x3c')]=_0x8b68('0x46');agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x47')]=_0xe1ba20[_0x8b68('0x4c')];agents[_0xe1ba20[_0x8b68('0x41')]][_0x8b68('0x3e')]=_0xe1ba20[_0x8b68('0x43')];}if(_0xe1ba20[_0x8b68('0x4d')]&&agents[_0xe1ba20[_0x8b68('0x4d')]]){agents[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x49')]=0x1;transfers[_0xe1ba20[_0x8b68('0x4d')]]=_[_0x8b68('0x4a')](agents[_0xe1ba20[_0x8b68('0x4d')]]);transfers[_0xe1ba20[_0x8b68('0x4d')]]['calleridnum']=agents[_0xe1ba20['origtransfereruniqueid']][_0x8b68('0x8')];transfers[_0xe1ba20[_0x8b68('0x4d')]]['calleridname']=agents[_0xe1ba20['origtransfereruniqueid']]['calleridname'];transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x17')]=utils[_0x8b68('0x18')]();transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x36')]=utils['now']();transfers[_0xe1ba20[_0x8b68('0x4d')]][_0x8b68('0x22')]=0x0;transfers[_0xe1ba20['transfertargetuniqueid']][_0x8b68('0x49')]=0x2;}}}catch(_0x5aa883){utils['error'](util['format'](_0x8b68('0x40'),_0xe1ba20[_0x8b68('0x41')]),_0x5aa883);}};exports[_0x8b68('0x4e')]=function(_0x7269fd){try{utils[_0x8b68('0x15')](util[_0x8b68('0x3')](_0x8b68('0x4f'),_0x7269fd[_0x8b68('0x4')]),_0x7269fd);if(agents[_0x7269fd[_0x8b68('0x4')]]&&agents[_0x7269fd[_0x8b68('0x4')]]['reason']===_0x8b68('0x21')){if(_0x7269fd[_0x8b68('0x50')]==='21'){agents[_0x7269fd[_0x8b68('0x4')]]['reason']='rejected';agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]='rejected';}utils[_0x8b68('0x2')](util[_0x8b68('0x3')](_0x8b68('0x51'),_0x7269fd[_0x8b68('0x4')],agents[_0x7269fd['uniqueid']][_0x8b68('0x7')],agents[_0x7269fd['uniqueid']]['reason'],agents[_0x7269fd[_0x8b68('0x4')]]['lastevent']));writeDB(agents[_0x7269fd[_0x8b68('0x4')]]);var _0x385eda=unanswered['indexOf'](_0x7269fd[_0x8b68('0x4')]);if(_0x385eda>-0x1){unanswered[_0x8b68('0x52')](_0x385eda,0x1);}}if(transfers[_0x7269fd[_0x8b68('0x4')]]){transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0xe')]=!![];transfers[_0x7269fd['uniqueid']][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](transfers[_0x7269fd['uniqueid']]['agentcompleteAt'],transfers[_0x7269fd[_0x8b68('0x4')]]['agentconnectAt']);transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')]=_0x8b68('0x53');transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]=_0x8b68('0x37');utils[_0x8b68('0x2')](util['format'](_0x8b68('0x51'),_0x7269fd['uniqueid'],transfers[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x7')],transfers[_0x7269fd[_0x8b68('0x4')]]['reason'],transfers[_0x7269fd[_0x8b68('0x4')]]['lastevent']));writeDB(transfers[_0x7269fd[_0x8b68('0x4')]],!![]);}if(agents[_0x7269fd['uniqueid']]&&agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x36')]){agents[_0x7269fd[_0x8b68('0x4')]]['agentcomplete']=!![];agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x34')]=utils[_0x8b68('0x18')]();agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2b')]=utils[_0x8b68('0x35')](agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x34')],agents[_0x7269fd[_0x8b68('0x4')]]['agentconnectAt']);agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')]=agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x45')]?_0x8b68('0x45'):'agent';agents[_0x7269fd[_0x8b68('0x4')]]['lastevent']=_0x8b68('0x37');utils[_0x8b68('0x2')](util['format'](_0x8b68('0x51'),_0x7269fd[_0x8b68('0x4')],agents[_0x7269fd[_0x8b68('0x4')]]['membername'],agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x2a')],agents[_0x7269fd[_0x8b68('0x4')]][_0x8b68('0x9')]));writeDB(agents[_0x7269fd[_0x8b68('0x4')]]);}}catch(_0x42464c){utils['error'](util[_0x8b68('0x3')](_0x8b68('0x4f'),_0x7269fd[_0x8b68('0x4')]),_0x42464c);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index fa9ed33..def2d42 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 _0x469a=['origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./transfers.controller','FAILED','NO\x20ANSWER','BUSY','blinds','uniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','format','context','now','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','ANSWERED','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','billableseconds','diffTime'];(function(_0x1ff818,_0x93b0d8){var _0x31a937=function(_0x26b987){while(--_0x26b987){_0x1ff818['push'](_0x1ff818['shift']());}};_0x31a937(++_0x93b0d8);}(_0x469a,0xa4));var _0xa469=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x469a[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0xa469('0x0'));var util=require(_0xa469('0x1'));var utils=require('./utils');var transfers=require(_0xa469('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0xa469('0x3'),_0xa469('0x4'),_0xa469('0x4'),'NO\x20ANSWER','ANSWERED',_0xa469('0x5'),'FAILED','FAILED','FAILED'];var channels={};function writeDB(_0x520d17){var _0x5ce97c;if(transfers[_0xa469('0x6')][_0x520d17['uniqueid']]){_0x5ce97c=_0x520d17['uniqueid'];_0x520d17['uniqueid']=transfers[_0xa469('0x6')][_0x520d17[_0xa469('0x7')]]['transfereeuniqueid'];}utils[_0xa469('0x8')](util['format'](_0xa469('0x9'),_0x520d17[_0xa469('0x7')],_0x520d17[_0xa469('0xa')],_0x520d17['queue'],_0x520d17[_0xa469('0xb')],_0x520d17[_0xa469('0xc')],_0x520d17[_0xa469('0xd')],_0x520d17[_0xa469('0xe')],_0x520d17[_0xa469('0xf')]));if(_0x520d17[_0xa469('0x10')]){utils[_0xa469('0x11')](_0x520d17['accountcode'])[_0xa469('0x12')](function(_0x28cdec){if(_0x28cdec){_0x520d17['UserId']=_0x28cdec['id'];}utils[_0xa469('0x13')](_0xa469('0x14'),_0x520d17);});}else{utils[_0xa469('0x13')](_0xa469('0x14'),_0x520d17);}if(channels[_0x520d17[_0xa469('0x7')]]){delete channels[_0x520d17[_0xa469('0x7')]];}else if(_0x5ce97c&&channels[_0x5ce97c]){delete transfers[_0xa469('0x6')][_0x5ce97c];delete channels[_0x5ce97c];}}exports[_0xa469('0x15')]=function(_0x21f77e){try{utils[_0xa469('0x16')](util['format'](_0xa469('0x17'),_0x21f77e[_0xa469('0x7')]),_0x21f77e);if(_0x21f77e[_0xa469('0x7')]==_0x21f77e[_0xa469('0x18')]&&_0x21f77e[_0xa469('0xa')]!=_0xa469('0x19')){utils['info'](util[_0xa469('0x1a')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x21f77e[_0xa469('0x7')],_0x21f77e[_0xa469('0x1b')],_0x21f77e['exten']));channels[_0x21f77e[_0xa469('0x7')]]={'uniqueid':_0x21f77e[_0xa469('0x7')],'accountcode':_0x21f77e[_0xa469('0x10')],'source':_0x21f77e[_0xa469('0xd')],'destination':_0x21f77e['exten'],'destinationcontext':_0x21f77e[_0xa469('0x1b')],'channel':_0x21f77e[_0xa469('0xa')],'starttime':utils[_0xa469('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa469('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x225e3f){utils[_0xa469('0x1d')](util[_0xa469('0x1a')]('[%s][calls][newchannel]',_0x21f77e[_0xa469('0x7')]),_0x225e3f);}};exports[_0xa469('0x1e')]=function(_0x14fb76){try{utils['debug'](util['format'](_0xa469('0x1f'),_0x14fb76['uniqueid']),_0x14fb76);if(!_[_0xa469('0x20')](channels[_0x14fb76['uniqueid']])&&_0x14fb76[_0xa469('0x21')]==0x6){utils[_0xa469('0x8')](util['format'](_0xa469('0x22'),_0x14fb76[_0xa469('0x7')],_0x14fb76[_0xa469('0x1b')],_0x14fb76[_0xa469('0xa')]));if(_['isNil'](channels[_0x14fb76['uniqueid']][_0xa469('0x23')])){channels[_0x14fb76[_0xa469('0x7')]][_0xa469('0x23')]=utils[_0xa469('0x1c')]();}}else if(!_[_0xa469('0x20')](channels[_0x14fb76[_0xa469('0x18')]])&&_0x14fb76[_0xa469('0x21')]==0x6&&_0x14fb76['context']!=_0xa469('0x24')){utils[_0xa469('0x8')](util[_0xa469('0x1a')](_0xa469('0x25'),_0x14fb76['uniqueid'],_0x14fb76[_0xa469('0x18')],_0x14fb76[_0xa469('0x1b')],_0x14fb76['channel']));channels[_0x14fb76[_0xa469('0x18')]][_0xa469('0x10')]=_0x14fb76[_0xa469('0x10')];channels[_0x14fb76[_0xa469('0x18')]][_0xa469('0x26')]=_0x14fb76[_0xa469('0xa')];if(_['isNil'](channels[_0x14fb76[_0xa469('0x18')]][_0xa469('0x27')])){channels[_0x14fb76[_0xa469('0x18')]]['answertime']=utils[_0xa469('0x1c')]();}channels[_0x14fb76[_0xa469('0x18')]][_0xa469('0x28')]=dispositions[_[_0xa469('0x29')](_0x14fb76[_0xa469('0x21')])]||_0xa469('0x2a');}}catch(_0x56a3db){utils[_0xa469('0x1d')](util[_0xa469('0x1a')](_0xa469('0x1f'),_0x14fb76[_0xa469('0x7')]),_0x56a3db);}};exports['hangup']=function(_0x39e885){try{if(!_[_0xa469('0x20')](channels[_0x39e885['uniqueid']])){utils['debug'](util['format'](_0xa469('0x2b'),_0x39e885[_0xa469('0x7')]),_0x39e885);if(_['isNil'](channels[_0x39e885[_0xa469('0x7')]][_0xa469('0x2c')])){channels[_0x39e885['uniqueid']][_0xa469('0x2c')]=_0x39e885[_0xa469('0x2d')]+'\x20<'+_0x39e885['calleridnum']+'>';}utils[_0xa469('0x8')](util[_0xa469('0x1a')](_0xa469('0x2e'),_0x39e885[_0xa469('0x7')],channels[_0x39e885[_0xa469('0x7')]][_0xa469('0x2c')],_0x39e885['cause-txt']));channels[_0x39e885[_0xa469('0x7')]]['endtime']=utils['now']();channels[_0x39e885[_0xa469('0x7')]]['duration']=utils['diffTime'](channels[_0x39e885['uniqueid']][_0xa469('0x2f')],channels[_0x39e885['uniqueid']]['starttime']);channels[_0x39e885[_0xa469('0x7')]][_0xa469('0x30')]=channels[_0x39e885['uniqueid']][_0xa469('0x27')]?utils[_0xa469('0x31')](channels[_0x39e885[_0xa469('0x7')]]['endtime'],channels[_0x39e885['uniqueid']]['answertime']):0x0;writeDB(channels[_0x39e885[_0xa469('0x7')]]);}}catch(_0x16d69a){utils['error'](util[_0xa469('0x1a')]('[%s][calls][hangup]',_0x39e885[_0xa469('0x7')]),_0x16d69a);}};exports['attendedtransfer']=function(_0x133d40){try{if(!_['isNil'](channels[_0x133d40['localtwolinkedid']])){utils[_0xa469('0x16')](util[_0xa469('0x1a')]('[%s][calls][attendedtransfer]',_0x133d40[_0xa469('0x32')]),_0x133d40);if(channels[_0x133d40[_0xa469('0x33')]]['channel']==_0x133d40[_0xa469('0x34')]){utils[_0xa469('0x8')](util[_0xa469('0x1a')](_0xa469('0x35'),_0x133d40[_0xa469('0x32')],_0x133d40[_0xa469('0x33')],_0x133d40[_0xa469('0x36')]));channels[_0x133d40['localtwolinkedid']][_0xa469('0x26')]=_0x133d40['secondtransfererchannel'];channels[_0x133d40[_0xa469('0x33')]]['userfield']=_0xa469('0x37');}else if(channels[_0x133d40[_0xa469('0x33')]][_0xa469('0xa')]=_0x133d40['transfertargetchannel']){utils['info'](util[_0xa469('0x1a')](_0xa469('0x35'),_0x133d40[_0xa469('0x32')],_0x133d40[_0xa469('0x33')],_0x133d40[_0xa469('0x38')]));channels[_0x133d40['localtwolinkedid']][_0xa469('0x26')]=_0x133d40[_0xa469('0x38')];channels[_0x133d40['localtwolinkedid']]['userfield']=_0xa469('0x37');}}}catch(_0x52630b){utils['error'](util[_0xa469('0x1a')](_0xa469('0x39'),_0x133d40[_0xa469('0x32')]),_0x52630b);}};exports[_0xa469('0x3a')]=function(_0xc49cde){try{if(!_['isNil'](channels[_0xc49cde[_0xa469('0x7')]])){utils['debug'](util[_0xa469('0x1a')](_0xa469('0x3b'),_0xc49cde[_0xa469('0x7')]),_0xc49cde);channels[_0xc49cde[_0xa469('0x7')]][_0xa469('0x3c')]=utils[_0xa469('0x1c')]();utils[_0xa469('0x8')](util['format'](_0xa469('0x3d'),_0xc49cde['uniqueid'],channels[_0xc49cde[_0xa469('0x7')]][_0xa469('0x3c')]));}}catch(_0x98cbc4){utils['error'](util['format'](_0xa469('0x3b'),_0xc49cde[_0xa469('0x7')]),_0x98cbc4);}};exports[_0xa469('0x3e')]=function(_0x8f7211){try{if(!_['isNil'](channels[_0x8f7211[_0xa469('0x7')]])){utils[_0xa469('0x16')](util['format'](_0xa469('0x3f'),_0x8f7211[_0xa469('0x7')]),_0x8f7211);if(!_[_0xa469('0x20')](channels[_0x8f7211[_0xa469('0x7')]][_0xa469('0x3c')])){channels[_0x8f7211[_0xa469('0x7')]][_0xa469('0x40')]+=utils[_0xa469('0x31')](utils[_0xa469('0x1c')](),channels[_0x8f7211[_0xa469('0x7')]][_0xa469('0x3c')]);utils[_0xa469('0x8')](util[_0xa469('0x1a')](_0xa469('0x41'),_0x8f7211[_0xa469('0x7')],channels[_0x8f7211['uniqueid']][_0xa469('0x40')]));delete channels[_0x8f7211['uniqueid']][_0xa469('0x3c')];}}}catch(_0x1ba994){utils[_0xa469('0x1d')](util[_0xa469('0x1a')](_0xa469('0x3f'),_0x8f7211[_0xa469('0x7')]),_0x1ba994);}};exports[_0xa469('0x42')]=function(_0xd0fb0c){try{if(!_[_0xa469('0x20')](channels[_0xd0fb0c['uniqueid']])){utils[_0xa469('0x16')](util[_0xa469('0x1a')](_0xa469('0x43'),_0xd0fb0c['uniqueid']),_0xd0fb0c);if(!_[_0xa469('0x20')](_0xd0fb0c['variable'][_0xa469('0x44')])){utils[_0xa469('0x8')](util['format'](_0xa469('0x45'),_0xd0fb0c[_0xa469('0x7')],_0xd0fb0c[_0xa469('0x46')]));channels[_0xd0fb0c[_0xa469('0x7')]]['source']=_0xd0fb0c[_0xa469('0x46')];}if(!_['isNil'](_0xd0fb0c[_0xa469('0x47')]['xmd-phone'])){utils['info'](util['format'](_0xa469('0x48'),_0xd0fb0c[_0xa469('0x7')],_0xd0fb0c[_0xa469('0x46')]));channels[_0xd0fb0c[_0xa469('0x7')]][_0xa469('0x49')]=_0xd0fb0c[_0xa469('0x46')];channels[_0xd0fb0c[_0xa469('0x7')]][_0xa469('0x2c')]='\x22'+_0xd0fb0c[_0xa469('0x46')]+'\x22\x20<'+_0xd0fb0c[_0xa469('0x46')]+'>';}if(!_['isNil'](_0xd0fb0c[_0xa469('0x47')][_0xa469('0x4a')])||!_[_0xa469('0x20')](_0xd0fb0c['variable']['xmd-callerid'])){utils[_0xa469('0x8')](util[_0xa469('0x1a')](_0xa469('0x4b'),_0xd0fb0c['uniqueid'],!_[_0xa469('0x20')](_0xd0fb0c['variable'][_0xa469('0x4a')])?'xmd-callerid-preview':_0xa469('0x4c'),_0xd0fb0c[_0xa469('0x46')]));channels[_0xd0fb0c[_0xa469('0x7')]][_0xa469('0x2c')]=_0xd0fb0c[_0xa469('0x46')];}if(!_['isNil'](_0xd0fb0c['variable'][_0xa469('0x4d')])||!_[_0xa469('0x20')](_0xd0fb0c['variable'][_0xa469('0x4e')])){utils[_0xa469('0x8')](util[_0xa469('0x1a')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xd0fb0c[_0xa469('0x7')],!_['isNil'](_0xd0fb0c[_0xa469('0x47')][_0xa469('0x4d')])?'xmd-queue':_0xa469('0x4e'),_0xd0fb0c[_0xa469('0x46')]));channels[_0xd0fb0c[_0xa469('0x7')]][_0xa469('0x4f')]=_0xa469('0x50');channels[_0xd0fb0c['uniqueid']][_0xa469('0x51')]=_0xd0fb0c[_0xa469('0x46')];channels[_0xd0fb0c[_0xa469('0x7')]][_0xa469('0x52')]=!![];}if(!_[_0xa469('0x20')](_0xd0fb0c[_0xa469('0x47')][_0xa469('0x53')])){utils['info'](util[_0xa469('0x1a')](_0xa469('0x54'),_0xd0fb0c[_0xa469('0x7')],_0xd0fb0c[_0xa469('0x46')]));channels[_0xd0fb0c[_0xa469('0x7')]][_0xa469('0x55')]=_0xd0fb0c[_0xa469('0x46')];}if(!_[_0xa469('0x20')](_0xd0fb0c[_0xa469('0x47')][_0xa469('0x56')])){utils[_0xa469('0x8')](util[_0xa469('0x1a')](_0xa469('0x57'),_0xd0fb0c[_0xa469('0x7')],_0xd0fb0c[_0xa469('0x46')]));channels[_0xd0fb0c['uniqueid']][_0xa469('0x58')]=_0xd0fb0c[_0xa469('0x46')];}if(!_[_0xa469('0x20')](_0xd0fb0c[_0xa469('0x47')]['outboundrouteid'])){utils[_0xa469('0x8')](util[_0xa469('0x1a')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xd0fb0c[_0xa469('0x7')],_0xd0fb0c[_0xa469('0x46')]));channels[_0xd0fb0c[_0xa469('0x7')]][_0xa469('0x59')]=_0xd0fb0c[_0xa469('0x46')];}if(!_['isNil'](_0xd0fb0c[_0xa469('0x47')][_0xa469('0x5a')])){utils[_0xa469('0x8')](util[_0xa469('0x1a')](_0xa469('0x5b'),_0xd0fb0c[_0xa469('0x7')],_0xd0fb0c[_0xa469('0x46')]));channels[_0xd0fb0c['uniqueid']]['sipcallid']=_0xd0fb0c[_0xa469('0x46')];}}}catch(_0x494342){utils[_0xa469('0x1d')](util['format']('[%s][calls][varset]',_0xd0fb0c[_0xa469('0x7')]),_0x494342);}};exports['newexten']=function(_0x5be0e4){try{if(!_[_0xa469('0x20')](channels[_0x5be0e4[_0xa469('0x7')]])){utils[_0xa469('0x16')](util['format']('[%s][calls][newexten]',_0x5be0e4[_0xa469('0x7')]),_0x5be0e4);utils[_0xa469('0x8')](util[_0xa469('0x1a')](_0xa469('0x5c'),_0x5be0e4[_0xa469('0x7')],_0x5be0e4['application'],_0x5be0e4[_0xa469('0x5d')]));if(_0x5be0e4[_0xa469('0x5e')][_0xa469('0x5f')]()==_0xa469('0x60')&&_[_0xa469('0x61')](_0x5be0e4[_0xa469('0x5d')][_0xa469('0x5f')](),_0xa469('0x62'))){var _0x1d28e2=_0x5be0e4[_0xa469('0x5d')][_0xa469('0x63')]('=');var _0x3b3143=_0x1d28e2[0x0][_0xa469('0x64')](_0x1d28e2[0x0][_0xa469('0x65')]('(')+0x1,_0x1d28e2[0x0][_0xa469('0x65')](')'));var _0x599e97=_0x1d28e2[0x1];channels[_0x5be0e4[_0xa469('0x7')]][_0x3b3143]=_0x599e97;}if(!_[_0xa469('0x66')]([_0xa469('0x67'),_0xa469('0x68'),_0xa469('0x69'),_0xa469('0x60'),_0xa469('0x6a')],_0x5be0e4['application'][_0xa469('0x5f')]())){channels[_0x5be0e4['uniqueid']][_0xa469('0x4f')]=_0x5be0e4[_0xa469('0x5e')];channels[_0x5be0e4[_0xa469('0x7')]][_0xa469('0x51')]=_0x5be0e4[_0xa469('0x5d')];}}}catch(_0x10fee7){utils[_0xa469('0x1d')](util[_0xa469('0x1a')]('[%s][calls][newexten]',_0x5be0e4['uniqueid']),_0x10fee7);}}; \ No newline at end of file +var _0x9a3c=['blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','debug','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','set','gotoif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY'];(function(_0x4bc8d0,_0x371f8c){var _0x39985f=function(_0x3fcceb){while(--_0x3fcceb){_0x4bc8d0['push'](_0x4bc8d0['shift']());}};_0x39985f(++_0x371f8c);}(_0x9a3c,0xdc));var _0xc9a3=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x9a3c[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var util=require(_0xc9a3('0x0'));var utils=require(_0xc9a3('0x1'));var transfers=require(_0xc9a3('0x2'));var dispositions=[_0xc9a3('0x3'),_0xc9a3('0x4'),'FAILED',_0xc9a3('0x3'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED',_0xc9a3('0x5'),'FAILED',_0xc9a3('0x4'),_0xc9a3('0x4')];var channels={};function writeDB(_0x420564){var _0x38e312;if(transfers[_0xc9a3('0x6')][_0x420564[_0xc9a3('0x7')]]){_0x38e312=_0x420564[_0xc9a3('0x7')];_0x420564[_0xc9a3('0x7')]=transfers['blinds'][_0x420564[_0xc9a3('0x7')]][_0xc9a3('0x8')];}utils[_0xc9a3('0x9')](util['format'](_0xc9a3('0xa'),_0x420564['uniqueid'],_0x420564[_0xc9a3('0xb')],_0x420564[_0xc9a3('0xc')],_0x420564[_0xc9a3('0xd')],_0x420564[_0xc9a3('0xe')],_0x420564[_0xc9a3('0xf')],_0x420564[_0xc9a3('0x10')],_0x420564[_0xc9a3('0x11')]));if(_0x420564[_0xc9a3('0x12')]){utils[_0xc9a3('0x13')](_0x420564['accountcode'])[_0xc9a3('0x14')](function(_0xef7a66){if(_0xef7a66){_0x420564[_0xc9a3('0x15')]=_0xef7a66['id'];}utils[_0xc9a3('0x16')](_0xc9a3('0x17'),_0x420564);});}else{utils[_0xc9a3('0x16')](_0xc9a3('0x17'),_0x420564);}if(channels[_0x420564[_0xc9a3('0x7')]]){delete channels[_0x420564[_0xc9a3('0x7')]];}else if(_0x38e312&&channels[_0x38e312]){delete transfers[_0xc9a3('0x6')][_0x38e312];delete channels[_0x38e312];}}exports[_0xc9a3('0x18')]=function(_0x2d12fd){try{utils['debug'](util[_0xc9a3('0x19')](_0xc9a3('0x1a'),_0x2d12fd[_0xc9a3('0x7')]),_0x2d12fd);if(_0x2d12fd[_0xc9a3('0x7')]==_0x2d12fd[_0xc9a3('0x1b')]&&_0x2d12fd[_0xc9a3('0xb')]!=_0xc9a3('0x1c')){utils[_0xc9a3('0x9')](util[_0xc9a3('0x19')](_0xc9a3('0x1d'),_0x2d12fd['uniqueid'],_0x2d12fd[_0xc9a3('0x1e')],_0x2d12fd['exten']));channels[_0x2d12fd[_0xc9a3('0x7')]]={'uniqueid':_0x2d12fd[_0xc9a3('0x7')],'accountcode':_0x2d12fd[_0xc9a3('0x12')],'source':_0x2d12fd[_0xc9a3('0xf')],'destination':_0x2d12fd[_0xc9a3('0x1f')],'destinationcontext':_0x2d12fd['context'],'channel':_0x2d12fd['channel'],'starttime':utils[_0xc9a3('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc9a3('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x53d100){utils[_0xc9a3('0x21')](util[_0xc9a3('0x19')]('[%s][calls][newchannel]',_0x2d12fd['uniqueid']),_0x53d100);}};exports[_0xc9a3('0x22')]=function(_0x1bc091){try{utils[_0xc9a3('0x23')](util[_0xc9a3('0x19')]('[%s][calls][newstate]',_0x1bc091[_0xc9a3('0x7')]),_0x1bc091);if(!_[_0xc9a3('0x24')](channels[_0x1bc091['uniqueid']])&&_0x1bc091['channelstate']==0x6){utils[_0xc9a3('0x9')](util[_0xc9a3('0x19')](_0xc9a3('0x25'),_0x1bc091[_0xc9a3('0x7')],_0x1bc091[_0xc9a3('0x1e')],_0x1bc091[_0xc9a3('0xb')]));if(_[_0xc9a3('0x24')](channels[_0x1bc091[_0xc9a3('0x7')]]['systemanswertime'])){channels[_0x1bc091[_0xc9a3('0x7')]]['systemanswertime']=utils[_0xc9a3('0x20')]();}}else if(!_[_0xc9a3('0x24')](channels[_0x1bc091[_0xc9a3('0x1b')]])&&_0x1bc091[_0xc9a3('0x26')]==0x6&&_0x1bc091[_0xc9a3('0x1e')]!=_0xc9a3('0x27')){utils['info'](util[_0xc9a3('0x19')](_0xc9a3('0x28'),_0x1bc091['uniqueid'],_0x1bc091[_0xc9a3('0x1b')],_0x1bc091[_0xc9a3('0x1e')],_0x1bc091[_0xc9a3('0xb')]));channels[_0x1bc091['linkedid']]['accountcode']=_0x1bc091[_0xc9a3('0x12')];channels[_0x1bc091[_0xc9a3('0x1b')]][_0xc9a3('0x29')]=_0x1bc091[_0xc9a3('0xb')];if(_[_0xc9a3('0x24')](channels[_0x1bc091[_0xc9a3('0x1b')]][_0xc9a3('0x2a')])){channels[_0x1bc091[_0xc9a3('0x1b')]]['answertime']=utils[_0xc9a3('0x20')]();}channels[_0x1bc091['linkedid']][_0xc9a3('0x2b')]=dispositions[_[_0xc9a3('0x2c')](_0x1bc091[_0xc9a3('0x26')])]||'ANSWERED';}}catch(_0x2dcfc4){utils[_0xc9a3('0x21')](util[_0xc9a3('0x19')](_0xc9a3('0x2d'),_0x1bc091['uniqueid']),_0x2dcfc4);}};exports[_0xc9a3('0x2e')]=function(_0x365822){try{if(!_[_0xc9a3('0x24')](channels[_0x365822[_0xc9a3('0x7')]])){utils['debug'](util['format'](_0xc9a3('0x2f'),_0x365822[_0xc9a3('0x7')]),_0x365822);if(_['isNil'](channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x30')])){channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x30')]=_0x365822[_0xc9a3('0x31')]+'\x20<'+_0x365822[_0xc9a3('0xf')]+'>';}utils[_0xc9a3('0x9')](util[_0xc9a3('0x19')](_0xc9a3('0x32'),_0x365822[_0xc9a3('0x7')],channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x30')],_0x365822[_0xc9a3('0x33')]));channels[_0x365822['uniqueid']][_0xc9a3('0x34')]=utils[_0xc9a3('0x20')]();channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x35')]=utils[_0xc9a3('0x36')](channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x34')],channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x37')]);channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x38')]=channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x2a')]?utils[_0xc9a3('0x36')](channels[_0x365822[_0xc9a3('0x7')]]['endtime'],channels[_0x365822[_0xc9a3('0x7')]][_0xc9a3('0x2a')]):0x0;writeDB(channels[_0x365822[_0xc9a3('0x7')]]);}}catch(_0x351e33){utils[_0xc9a3('0x21')](util[_0xc9a3('0x19')](_0xc9a3('0x2f'),_0x365822[_0xc9a3('0x7')]),_0x351e33);}};exports[_0xc9a3('0x39')]=function(_0x299e02){try{if(!_[_0xc9a3('0x24')](channels[_0x299e02[_0xc9a3('0x3a')]])){utils[_0xc9a3('0x23')](util[_0xc9a3('0x19')](_0xc9a3('0x3b'),_0x299e02['origtransfereruniqueid']),_0x299e02);if(channels[_0x299e02[_0xc9a3('0x3a')]][_0xc9a3('0xb')]==_0x299e02[_0xc9a3('0x3c')]){utils[_0xc9a3('0x9')](util[_0xc9a3('0x19')](_0xc9a3('0x3d'),_0x299e02[_0xc9a3('0x3e')],_0x299e02[_0xc9a3('0x3a')],_0x299e02[_0xc9a3('0x3f')]));channels[_0x299e02[_0xc9a3('0x3a')]][_0xc9a3('0x29')]=_0x299e02[_0xc9a3('0x3f')];channels[_0x299e02[_0xc9a3('0x3a')]]['userfield']=_0xc9a3('0x40');}else if(channels[_0x299e02[_0xc9a3('0x3a')]]['channel']=_0x299e02['transfertargetchannel']){utils['info'](util[_0xc9a3('0x19')](_0xc9a3('0x3d'),_0x299e02['origtransfereruniqueid'],_0x299e02[_0xc9a3('0x3a')],_0x299e02['origtransfererchannel']));channels[_0x299e02[_0xc9a3('0x3a')]]['destinationchannel']=_0x299e02[_0xc9a3('0x41')];channels[_0x299e02[_0xc9a3('0x3a')]][_0xc9a3('0x42')]='_attended';}}}catch(_0x3fd080){utils['error'](util['format'](_0xc9a3('0x3b'),_0x299e02[_0xc9a3('0x3e')]),_0x3fd080);}};exports[_0xc9a3('0x43')]=function(_0x5e53c3){try{if(!_[_0xc9a3('0x24')](channels[_0x5e53c3['uniqueid']])){utils[_0xc9a3('0x23')](util['format'](_0xc9a3('0x44'),_0x5e53c3['uniqueid']),_0x5e53c3);channels[_0x5e53c3['uniqueid']][_0xc9a3('0x45')]=utils[_0xc9a3('0x20')]();utils['info'](util[_0xc9a3('0x19')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5e53c3[_0xc9a3('0x7')],channels[_0x5e53c3[_0xc9a3('0x7')]]['musiconholdstartAt']));}}catch(_0x507532){utils[_0xc9a3('0x21')](util[_0xc9a3('0x19')](_0xc9a3('0x44'),_0x5e53c3[_0xc9a3('0x7')]),_0x507532);}};exports['musiconholdstop']=function(_0x106eaf){try{if(!_[_0xc9a3('0x24')](channels[_0x106eaf[_0xc9a3('0x7')]])){utils[_0xc9a3('0x23')](util[_0xc9a3('0x19')]('[%s][calls][musiconholdstop]',_0x106eaf[_0xc9a3('0x7')]),_0x106eaf);if(!_[_0xc9a3('0x24')](channels[_0x106eaf['uniqueid']][_0xc9a3('0x45')])){channels[_0x106eaf['uniqueid']][_0xc9a3('0x46')]+=utils[_0xc9a3('0x36')](utils[_0xc9a3('0x20')](),channels[_0x106eaf[_0xc9a3('0x7')]][_0xc9a3('0x45')]);utils[_0xc9a3('0x9')](util[_0xc9a3('0x19')](_0xc9a3('0x47'),_0x106eaf['uniqueid'],channels[_0x106eaf[_0xc9a3('0x7')]][_0xc9a3('0x46')]));delete channels[_0x106eaf[_0xc9a3('0x7')]][_0xc9a3('0x45')];}}}catch(_0x23b0b6){utils['error'](util[_0xc9a3('0x19')](_0xc9a3('0x48'),_0x106eaf['uniqueid']),_0x23b0b6);}};exports[_0xc9a3('0x49')]=function(_0x341044){try{if(!_[_0xc9a3('0x24')](channels[_0x341044[_0xc9a3('0x7')]])){utils[_0xc9a3('0x23')](util[_0xc9a3('0x19')](_0xc9a3('0x4a'),_0x341044[_0xc9a3('0x7')]),_0x341044);if(!_['isNil'](_0x341044[_0xc9a3('0x4b')]['xmd-originatecalleridnum'])){utils[_0xc9a3('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x341044['uniqueid'],_0x341044[_0xc9a3('0x4c')]));channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0x4d')]=_0x341044[_0xc9a3('0x4c')];}if(!_[_0xc9a3('0x24')](_0x341044[_0xc9a3('0x4b')][_0xc9a3('0x4e')])){utils[_0xc9a3('0x9')](util[_0xc9a3('0x19')](_0xc9a3('0x4f'),_0x341044['uniqueid'],_0x341044[_0xc9a3('0x4c')]));channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0x50')]=_0x341044[_0xc9a3('0x4c')];channels[_0x341044[_0xc9a3('0x7')]]['callerid']='\x22'+_0x341044[_0xc9a3('0x4c')]+'\x22\x20<'+_0x341044['value']+'>';}if(!_[_0xc9a3('0x24')](_0x341044['variable'][_0xc9a3('0x51')])||!_[_0xc9a3('0x24')](_0x341044[_0xc9a3('0x4b')][_0xc9a3('0x52')])){utils['info'](util[_0xc9a3('0x19')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x341044[_0xc9a3('0x7')],!_[_0xc9a3('0x24')](_0x341044[_0xc9a3('0x4b')]['xmd-callerid-preview'])?_0xc9a3('0x51'):'xmd-callerid',_0x341044['value']));channels[_0x341044['uniqueid']][_0xc9a3('0x30')]=_0x341044[_0xc9a3('0x4c')];}if(!_[_0xc9a3('0x24')](_0x341044[_0xc9a3('0x4b')][_0xc9a3('0x53')])||!_[_0xc9a3('0x24')](_0x341044['variable'][_0xc9a3('0x54')])){utils['info'](util[_0xc9a3('0x19')](_0xc9a3('0x55'),_0x341044[_0xc9a3('0x7')],!_[_0xc9a3('0x24')](_0x341044[_0xc9a3('0x4b')][_0xc9a3('0x53')])?_0xc9a3('0x53'):_0xc9a3('0x54'),_0x341044['value']));channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0x56')]=_0xc9a3('0x57');channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0x58')]=_0x341044[_0xc9a3('0x4c')];channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0xc')]=!![];}if(!_['isNil'](_0x341044[_0xc9a3('0x4b')][_0xc9a3('0x59')])){utils['info'](util[_0xc9a3('0x19')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x341044[_0xc9a3('0x7')],_0x341044['value']));channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0x5a')]=_0x341044[_0xc9a3('0x4c')];}if(!_[_0xc9a3('0x24')](_0x341044[_0xc9a3('0x4b')][_0xc9a3('0x5b')])){utils[_0xc9a3('0x9')](util[_0xc9a3('0x19')](_0xc9a3('0x5c'),_0x341044[_0xc9a3('0x7')],_0x341044[_0xc9a3('0x4c')]));channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0x5d')]=_0x341044[_0xc9a3('0x4c')];}if(!_[_0xc9a3('0x24')](_0x341044[_0xc9a3('0x4b')][_0xc9a3('0x5e')])){utils['info'](util[_0xc9a3('0x19')](_0xc9a3('0x5f'),_0x341044[_0xc9a3('0x7')],_0x341044[_0xc9a3('0x4c')]));channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0x60')]=_0x341044[_0xc9a3('0x4c')];}if(!_[_0xc9a3('0x24')](_0x341044[_0xc9a3('0x4b')][_0xc9a3('0x61')])){utils['info'](util['format'](_0xc9a3('0x62'),_0x341044[_0xc9a3('0x7')],_0x341044[_0xc9a3('0x4c')]));channels[_0x341044[_0xc9a3('0x7')]][_0xc9a3('0x61')]=_0x341044[_0xc9a3('0x4c')];}}}catch(_0x5898e6){utils[_0xc9a3('0x21')](util['format'](_0xc9a3('0x4a'),_0x341044[_0xc9a3('0x7')]),_0x5898e6);}};exports['newexten']=function(_0x209d9e){try{if(!_['isNil'](channels[_0x209d9e[_0xc9a3('0x7')]])){utils['debug'](util[_0xc9a3('0x19')](_0xc9a3('0x63'),_0x209d9e['uniqueid']),_0x209d9e);utils[_0xc9a3('0x9')](util['format'](_0xc9a3('0x64'),_0x209d9e[_0xc9a3('0x7')],_0x209d9e[_0xc9a3('0x65')],_0x209d9e[_0xc9a3('0x66')]));if(_0x209d9e[_0xc9a3('0x65')][_0xc9a3('0x67')]()=='set'&&_[_0xc9a3('0x68')](_0x209d9e[_0xc9a3('0x66')]['toLowerCase'](),_0xc9a3('0x69'))){var _0x306942=_0x209d9e[_0xc9a3('0x66')]['split']('=');var _0x161514=_0x306942[0x0][_0xc9a3('0x6a')](_0x306942[0x0][_0xc9a3('0x6b')]('(')+0x1,_0x306942[0x0][_0xc9a3('0x6b')](')'));var _0x2d86c2=_0x306942[0x1];channels[_0x209d9e[_0xc9a3('0x7')]][_0x161514]=_0x2d86c2;}if(!_[_0xc9a3('0x6c')]([_0xc9a3('0x2e'),_0xc9a3('0x6d'),_0xc9a3('0x6e'),_0xc9a3('0x6f'),_0xc9a3('0x70')],_0x209d9e[_0xc9a3('0x65')][_0xc9a3('0x67')]())){channels[_0x209d9e[_0xc9a3('0x7')]][_0xc9a3('0x56')]=_0x209d9e['application'];channels[_0x209d9e[_0xc9a3('0x7')]]['lastdata']=_0x209d9e[_0xc9a3('0x66')];}}}catch(_0x5f623e){utils[_0xc9a3('0x21')](util[_0xc9a3('0x19')](_0xc9a3('0x63'),_0x209d9e['uniqueid']),_0x5f623e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 69dedc5..6d6fa55 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 _0xd21f=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent'];(function(_0x2fb7e4,_0x2132d7){var _0x171c63=function(_0x18f169){while(--_0x18f169){_0x2fb7e4['push'](_0x2fb7e4['shift']());}};_0x171c63(++_0x2132d7);}(_0xd21f,0x8f));var _0xfd21=function(_0x574d9b,_0x2063da){_0x574d9b=_0x574d9b-0x0;var _0x31d2a5=_0xd21f[_0x574d9b];return _0x31d2a5;};'use strict';var utils=require('./utils');exports[_0xfd21('0x0')]=function(){utils[_0xfd21('0x1')](_0xfd21('0x2'));};exports[_0xfd21('0x3')]=function(){utils['info'](_0xfd21('0x4'));};exports[_0xfd21('0x5')]=function(){utils['info'](_0xfd21('0x6'));};exports[_0xfd21('0x7')]=function(_0x49e97b){utils[_0xfd21('0x7')]('[core]\x20error',_0x49e97b);};exports[_0xfd21('0x8')]=function(){utils[_0xfd21('0x1')](_0xfd21('0x9'));};exports[_0xfd21('0xa')]=function(_0x230662){}; \ No newline at end of file +var _0x78b7=['shutdown','info','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','managerevent','./utils','connect','[core]\x20connected'];(function(_0xc9b9e7,_0x1d8e13){var _0x4ae924=function(_0x4e91b4){while(--_0x4e91b4){_0xc9b9e7['push'](_0xc9b9e7['shift']());}};_0x4ae924(++_0x1d8e13);}(_0x78b7,0x194));var _0x778b=function(_0x3ba335,_0x33b0fb){_0x3ba335=_0x3ba335-0x0;var _0x5dd44a=_0x78b7[_0x3ba335];return _0x5dd44a;};'use strict';var utils=require(_0x778b('0x0'));exports[_0x778b('0x1')]=function(){utils['info'](_0x778b('0x2'));};exports[_0x778b('0x3')]=function(){utils[_0x778b('0x4')](_0x778b('0x5'));};exports[_0x778b('0x6')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x778b('0x7')]=function(_0x260062){utils[_0x778b('0x7')](_0x778b('0x8'),_0x260062);};exports[_0x778b('0x9')]=function(){utils[_0x778b('0x4')]('[core]\x20close');};exports[_0x778b('0xa')]=function(_0x233288){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 04c9fb0..b2a99c7 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 _0x3f60=['connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','calleridname','complete','duration','diffTime','endtime','[%s][dials][hangup]','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','debug','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','error','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialstatus','assign','answertime'];(function(_0x336193,_0x555044){var _0x8791c8=function(_0x53c31d){while(--_0x53c31d){_0x336193['push'](_0x336193['shift']());}};_0x8791c8(++_0x555044);}(_0x3f60,0xeb));var _0x03f6=function(_0x369cf2,_0x47e28c){_0x369cf2=_0x369cf2-0x0;var _0x5c7d3e=_0x3f60[_0x369cf2];return _0x5c7d3e;};'use strict';var _=require(_0x03f6('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x315e22){utils[_0x03f6('0x1')](util[_0x03f6('0x2')](_0x03f6('0x3'),_0x315e22[_0x03f6('0x4')],_0x315e22[_0x03f6('0x5')],_0x315e22[_0x03f6('0x6')],_0x315e22[_0x03f6('0x7')],_0x315e22[_0x03f6('0x8')],_0x315e22['dialstatus']));utils['request'](_0x03f6('0x9'),_0x315e22);delete dials[_0x315e22[_0x03f6('0x4')]];}exports[_0x03f6('0xa')]=function(_0x663c9c){try{utils[_0x03f6('0xb')](util['format']('[%s][dials][newexten]',_0x663c9c[_0x03f6('0x4')]),_0x663c9c);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x663c9c[_0x03f6('0x4')],_0x663c9c[_0x03f6('0xc')],_0x663c9c[_0x03f6('0xd')]));if(_0x663c9c['application'][_0x03f6('0xe')]()==_0x03f6('0xf')&&_[_0x03f6('0x10')](_0x663c9c[_0x03f6('0xd')]['toLowerCase'](),_0x03f6('0x11'))){var _0x29ac5a=_0x663c9c['appdata']['split']('=');dials[_0x663c9c[_0x03f6('0x4')]]={'routeId':_0x29ac5a[0x1]};}}catch(_0x3f4ed5){utils['error'](util[_0x03f6('0x2')]('[%s][dials][newexten]',_0x663c9c['uniqueid']),_0x3f4ed5);}};exports[_0x03f6('0x12')]=function(_0x300e4c){try{utils[_0x03f6('0xb')](util[_0x03f6('0x2')](_0x03f6('0x13'),_0x300e4c[_0x03f6('0x4')]),_0x300e4c);if(!_[_0x03f6('0x14')](_0x300e4c[_0x03f6('0x15')][_0x03f6('0x16')])){utils[_0x03f6('0x1')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x300e4c['uniqueid'],_0x300e4c[_0x03f6('0x17')]));dials[_0x300e4c['uniqueid']]={'routeId':_0x300e4c[_0x03f6('0x17')]};}}catch(_0x5d6a9f){utils[_0x03f6('0x18')](util[_0x03f6('0x2')]('[%s][dials][varset]',_0x300e4c[_0x03f6('0x4')]),_0x5d6a9f);}};exports[_0x03f6('0x19')]=function(_0x212cdd){try{if(!_[_0x03f6('0x14')](dials[_0x212cdd[_0x03f6('0x4')]])){utils[_0x03f6('0xb')](util['format'](_0x03f6('0x1a'),_0x212cdd[_0x03f6('0x4')]),_0x212cdd);dials[_0x212cdd[_0x03f6('0x4')]]=_['assign'](dials[_0x212cdd[_0x03f6('0x4')]],_0x212cdd);dials[_0x212cdd[_0x03f6('0x4')]][_0x03f6('0x1b')]=utils[_0x03f6('0x1c')]();dials[_0x212cdd['uniqueid']][_0x03f6('0x1d')]=_0x03f6('0x1e');utils['info'](util[_0x03f6('0x2')](_0x03f6('0x1f'),_0x212cdd['uniqueid'],dials[_0x212cdd[_0x03f6('0x4')]]['starttime']));}}catch(_0x439ca0){utils[_0x03f6('0x18')](util[_0x03f6('0x2')](_0x03f6('0x1a'),_0x212cdd['uniqueid']),_0x439ca0);}};exports['dialend']=function(_0x418561){try{if(!_[_0x03f6('0x14')](dials[_0x418561[_0x03f6('0x4')]])){utils[_0x03f6('0xb')](util[_0x03f6('0x2')]('[%s][dials][dialend]',_0x418561[_0x03f6('0x4')]),_0x418561);dials[_0x418561[_0x03f6('0x4')]][_0x03f6('0x20')]=_0x418561[_0x03f6('0x20')];if(_0x418561[_0x03f6('0x20')]=='ANSWER'){dials[_0x418561[_0x03f6('0x4')]]=_[_0x03f6('0x21')](dials[_0x418561[_0x03f6('0x4')]],_0x418561);dials[_0x418561['uniqueid']][_0x03f6('0x22')]=utils[_0x03f6('0x1c')]();dials[_0x418561[_0x03f6('0x4')]][_0x03f6('0x1d')]=_0x03f6('0x23');utils[_0x03f6('0x1')](util['format'](_0x03f6('0x24'),_0x418561[_0x03f6('0x4')],_0x418561[_0x03f6('0x20')],dials[_0x418561[_0x03f6('0x4')]]['answertime']));}else{utils[_0x03f6('0x1')](util[_0x03f6('0x2')](_0x03f6('0x25'),_0x418561['uniqueid'],_0x418561['dialstatus']));}}}catch(_0x4e2154){utils[_0x03f6('0x18')](util[_0x03f6('0x2')](_0x03f6('0x26'),_0x418561[_0x03f6('0x4')]),_0x4e2154);}};exports['hangup']=function(_0x48ec49){try{if(!_[_0x03f6('0x14')](dials[_0x48ec49[_0x03f6('0x4')]])){utils[_0x03f6('0xb')](util[_0x03f6('0x2')]('[%s][dials][hangup]',_0x48ec49[_0x03f6('0x4')]),_0x48ec49);utils[_0x03f6('0x1')](util[_0x03f6('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x48ec49[_0x03f6('0x4')],_0x48ec49[_0x03f6('0x7')],_0x48ec49[_0x03f6('0x27')],_0x48ec49['cause-txt']));dials[_0x48ec49[_0x03f6('0x4')]]=_[_0x03f6('0x21')](dials[_0x48ec49[_0x03f6('0x4')]],{'endtime':utils[_0x03f6('0x1c')](),'lastevent':_0x03f6('0x28')});dials[_0x48ec49[_0x03f6('0x4')]][_0x03f6('0x29')]=utils[_0x03f6('0x2a')](dials[_0x48ec49[_0x03f6('0x4')]][_0x03f6('0x2b')],dials[_0x48ec49['uniqueid']]['starttime']);dials[_0x48ec49[_0x03f6('0x4')]]['holdtime']=utils[_0x03f6('0x2a')](dials[_0x48ec49[_0x03f6('0x4')]][_0x03f6('0x22')]||dials[_0x48ec49[_0x03f6('0x4')]][_0x03f6('0x2b')],dials[_0x48ec49[_0x03f6('0x4')]][_0x03f6('0x1b')]);dials[_0x48ec49[_0x03f6('0x4')]]['billableseconds']=dials[_0x48ec49[_0x03f6('0x4')]][_0x03f6('0x22')]?utils[_0x03f6('0x2a')](dials[_0x48ec49[_0x03f6('0x4')]]['endtime'],dials[_0x48ec49[_0x03f6('0x4')]]['answertime']):0x0;writeDB(dials[_0x48ec49[_0x03f6('0x4')]]);}}catch(_0x312a4b){utils[_0x03f6('0x18')](util['format'](_0x03f6('0x2c'),_0x48ec49[_0x03f6('0x4')]),_0x312a4b);}}; \ No newline at end of file +var _0x577c=['varset','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','isNil','starttime','lastevent','called','[%s][dials][dialbegin]','ANSWER','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','./utils','info','format','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','appdata','application','toLowerCase','set','startsWith','split','error'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x577c,0xae));var _0xc577=function(_0x5d18b9,_0x1b51dc){_0x5d18b9=_0x5d18b9-0x0;var _0x35adb1=_0x577c[_0x5d18b9];return _0x35adb1;};'use strict';var _=require(_0xc577('0x0'));var util=require('util');var utils=require(_0xc577('0x1'));var dials={};function writeDB(_0x3ac042){utils[_0xc577('0x2')](util[_0xc577('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x3ac042['uniqueid'],_0x3ac042[_0xc577('0x4')],_0x3ac042[_0xc577('0x5')],_0x3ac042[_0xc577('0x6')],_0x3ac042[_0xc577('0x7')],_0x3ac042[_0xc577('0x8')]));utils[_0xc577('0x9')](_0xc577('0xa'),_0x3ac042);delete dials[_0x3ac042[_0xc577('0xb')]];}exports[_0xc577('0xc')]=function(_0x3c68a3){try{utils[_0xc577('0xd')](util['format'](_0xc577('0xe'),_0x3c68a3[_0xc577('0xb')]),_0x3c68a3);utils[_0xc577('0x2')](util[_0xc577('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3c68a3[_0xc577('0xb')],_0x3c68a3['application'],_0x3c68a3[_0xc577('0xf')]));if(_0x3c68a3[_0xc577('0x10')][_0xc577('0x11')]()==_0xc577('0x12')&&_[_0xc577('0x13')](_0x3c68a3[_0xc577('0xf')][_0xc577('0x11')](),'cdr(routeid)')){var _0x4bc3fd=_0x3c68a3['appdata'][_0xc577('0x14')]('=');dials[_0x3c68a3[_0xc577('0xb')]]={'routeId':_0x4bc3fd[0x1]};}}catch(_0x517760){utils[_0xc577('0x15')](util[_0xc577('0x3')]('[%s][dials][newexten]',_0x3c68a3[_0xc577('0xb')]),_0x517760);}};exports[_0xc577('0x16')]=function(_0x226690){try{utils[_0xc577('0xd')](util[_0xc577('0x3')]('[%s][dials][varset]',_0x226690[_0xc577('0xb')]),_0x226690);if(!_['isNil'](_0x226690[_0xc577('0x17')]['outboundrouteid'])){utils[_0xc577('0x2')](util[_0xc577('0x3')](_0xc577('0x18'),_0x226690[_0xc577('0xb')],_0x226690[_0xc577('0x19')]));dials[_0x226690[_0xc577('0xb')]]={'routeId':_0x226690['value']};}}catch(_0x2abb7c){utils[_0xc577('0x15')](util[_0xc577('0x3')](_0xc577('0x1a'),_0x226690[_0xc577('0xb')]),_0x2abb7c);}};exports[_0xc577('0x1b')]=function(_0x5d802c){try{if(!_[_0xc577('0x1c')](dials[_0x5d802c['uniqueid']])){utils['debug'](util[_0xc577('0x3')]('[%s][dials][dialbegin]',_0x5d802c[_0xc577('0xb')]),_0x5d802c);dials[_0x5d802c[_0xc577('0xb')]]=_['assign'](dials[_0x5d802c[_0xc577('0xb')]],_0x5d802c);dials[_0x5d802c[_0xc577('0xb')]][_0xc577('0x1d')]=utils['now']();dials[_0x5d802c[_0xc577('0xb')]][_0xc577('0x1e')]=_0xc577('0x1f');utils[_0xc577('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x5d802c['uniqueid'],dials[_0x5d802c[_0xc577('0xb')]][_0xc577('0x1d')]));}}catch(_0x1c8520){utils['error'](util[_0xc577('0x3')](_0xc577('0x20'),_0x5d802c['uniqueid']),_0x1c8520);}};exports['dialend']=function(_0x2563ab){try{if(!_['isNil'](dials[_0x2563ab['uniqueid']])){utils['debug'](util[_0xc577('0x3')]('[%s][dials][dialend]',_0x2563ab[_0xc577('0xb')]),_0x2563ab);dials[_0x2563ab[_0xc577('0xb')]][_0xc577('0x8')]=_0x2563ab[_0xc577('0x8')];if(_0x2563ab[_0xc577('0x8')]==_0xc577('0x21')){dials[_0x2563ab[_0xc577('0xb')]]=_[_0xc577('0x22')](dials[_0x2563ab[_0xc577('0xb')]],_0x2563ab);dials[_0x2563ab['uniqueid']][_0xc577('0x23')]=utils[_0xc577('0x24')]();dials[_0x2563ab[_0xc577('0xb')]][_0xc577('0x1e')]=_0xc577('0x25');utils[_0xc577('0x2')](util[_0xc577('0x3')](_0xc577('0x26'),_0x2563ab[_0xc577('0xb')],_0x2563ab[_0xc577('0x8')],dials[_0x2563ab[_0xc577('0xb')]][_0xc577('0x23')]));}else{utils['info'](util[_0xc577('0x3')](_0xc577('0x27'),_0x2563ab[_0xc577('0xb')],_0x2563ab[_0xc577('0x8')]));}}}catch(_0x9f3e4d){utils['error'](util['format']('[%s][dials][dialend]',_0x2563ab['uniqueid']),_0x9f3e4d);}};exports[_0xc577('0x28')]=function(_0x5751f4){try{if(!_['isNil'](dials[_0x5751f4[_0xc577('0xb')]])){utils['debug'](util[_0xc577('0x3')]('[%s][dials][hangup]',_0x5751f4[_0xc577('0xb')]),_0x5751f4);utils['info'](util[_0xc577('0x3')](_0xc577('0x29'),_0x5751f4[_0xc577('0xb')],_0x5751f4[_0xc577('0x6')],_0x5751f4[_0xc577('0x2a')],_0x5751f4[_0xc577('0x2b')]));dials[_0x5751f4[_0xc577('0xb')]]=_[_0xc577('0x22')](dials[_0x5751f4[_0xc577('0xb')]],{'endtime':utils[_0xc577('0x24')](),'lastevent':_0xc577('0x2c')});dials[_0x5751f4[_0xc577('0xb')]][_0xc577('0x2d')]=utils[_0xc577('0x2e')](dials[_0x5751f4[_0xc577('0xb')]][_0xc577('0x2f')],dials[_0x5751f4[_0xc577('0xb')]][_0xc577('0x1d')]);dials[_0x5751f4[_0xc577('0xb')]][_0xc577('0x30')]=utils[_0xc577('0x2e')](dials[_0x5751f4['uniqueid']][_0xc577('0x23')]||dials[_0x5751f4['uniqueid']][_0xc577('0x2f')],dials[_0x5751f4[_0xc577('0xb')]][_0xc577('0x1d')]);dials[_0x5751f4['uniqueid']]['billableseconds']=dials[_0x5751f4[_0xc577('0xb')]][_0xc577('0x23')]?utils[_0xc577('0x2e')](dials[_0x5751f4['uniqueid']][_0xc577('0x2f')],dials[_0x5751f4[_0xc577('0xb')]]['answertime']):0x0;writeDB(dials[_0x5751f4[_0xc577('0xb')]]);}}catch(_0x4c829c){utils[_0xc577('0x15')](util[_0xc577('0x3')]('[%s][dials][hangup]',_0x5751f4[_0xc577('0xb')]),_0x4c829c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index def0237..eae692e 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 _0xbabd=['asterisk-manager','../../config/environment','util','asterisk','port','password','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend'];(function(_0x39479f,_0x822ae4){var _0x4a6d96=function(_0x55bfba){while(--_0x55bfba){_0x39479f['push'](_0x39479f['shift']());}};_0x4a6d96(++_0x822ae4);}(_0xbabd,0x84));var _0xdbab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbabd[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xdbab('0x0'));var config=require(_0xdbab('0x1'));var utils=require('./utils');var util=require(_0xdbab('0x2'));var ami=new AsteriskManager(config[_0xdbab('0x3')][_0xdbab('0x4')],config[_0xdbab('0x3')]['ip'],config['asterisk']['username'],config[_0xdbab('0x3')][_0xdbab('0x5')],!![]);ami[_0xdbab('0x6')]();if(config[_0xdbab('0x7')]&&config[_0xdbab('0x7')][_0xdbab('0x8')]){utils[_0xdbab('0x9')]('XDR\x20DISABLED');}else{var agents=require(_0xdbab('0xa'));var calls=require(_0xdbab('0xb'));var queues=require(_0xdbab('0xc'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xdbab('0xd'));var core=require('./core.controller');ami['on'](_0xdbab('0xe'),core[_0xdbab('0xe')]);ami['on'](_0xdbab('0xf'),core[_0xdbab('0xf')]);ami['on'](_0xdbab('0x10'),core['fullybooted']);ami['on']('error',core[_0xdbab('0x11')]);ami['on']('close',core[_0xdbab('0x12')]);ami['on']('managerevent',core[_0xdbab('0x13')]);ami['on'](_0xdbab('0x14'),function(_0x43797b){try{utils['debug'](util[_0xdbab('0x15')](_0xdbab('0x16'),_0x43797b[_0xdbab('0x17')]),_0x43797b);members[_0xdbab('0x14')](_0x43797b);}catch(_0x50670e){utils[_0xdbab('0x11')](util[_0xdbab('0x15')](_0xdbab('0x16'),_0x43797b[_0xdbab('0x17')]),_0x50670e);}});ami['on']('agentcalled',function(_0x43c128){try{utils['debug'](util[_0xdbab('0x15')](_0xdbab('0x18'),_0x43c128[_0xdbab('0x19')]),_0x43c128);agents[_0xdbab('0x1a')](_0x43c128);}catch(_0x1cecac){utils['error'](util[_0xdbab('0x15')](_0xdbab('0x18'),_0x43c128[_0xdbab('0x19')]),_0x1cecac);}});ami['on'](_0xdbab('0x1b'),function(_0x60abb4){try{utils[_0xdbab('0x1c')](util[_0xdbab('0x15')](_0xdbab('0x1d'),_0x60abb4[_0xdbab('0x19')]),_0x60abb4);agents[_0xdbab('0x1b')](_0x60abb4);}catch(_0x40c8dd){utils['error'](util[_0xdbab('0x15')]('[%s][index][agentringnoanswer]',_0x60abb4[_0xdbab('0x19')]),_0x40c8dd);}});ami['on'](_0xdbab('0x1e'),function(_0x58a742){try{utils[_0xdbab('0x1c')](util[_0xdbab('0x15')](_0xdbab('0x1f'),_0x58a742['uniqueid']),_0x58a742);agents['agentconnect'](_0x58a742);queues['agentconnect'](_0x58a742);}catch(_0x55bc03){utils[_0xdbab('0x11')](util[_0xdbab('0x15')](_0xdbab('0x1f'),_0x58a742['uniqueid']),_0x55bc03);}});ami['on'](_0xdbab('0x20'),function(_0x5dd780){try{utils[_0xdbab('0x1c')](util['format'](_0xdbab('0x21'),_0x5dd780[_0xdbab('0x19')]),_0x5dd780);agents['agentcomplete'](_0x5dd780);queues[_0xdbab('0x20')](_0x5dd780);members[_0xdbab('0x20')](_0x5dd780);}catch(_0x48155a){utils[_0xdbab('0x11')](util[_0xdbab('0x15')]('[%s][index][agentcomplete]',_0x5dd780[_0xdbab('0x19')]),_0x48155a);}});ami['on'](_0xdbab('0x22'),function(_0x965f11){try{utils[_0xdbab('0x1c')](util['format'](_0xdbab('0x23'),_0x965f11[_0xdbab('0x19')]),_0x965f11);agents[_0xdbab('0x22')](_0x965f11);queues['queuecallerabandon'](_0x965f11);}catch(_0x56849f){utils[_0xdbab('0x11')](util[_0xdbab('0x15')]('[%s][index][queuecallerabandon]',_0x965f11[_0xdbab('0x19')]),_0x56849f);}});ami['on'](_0xdbab('0x24'),function(_0x5dca33){try{utils[_0xdbab('0x1c')](util['format'](_0xdbab('0x25'),_0x5dca33[_0xdbab('0x19')]),_0x5dca33);queues[_0xdbab('0x24')](_0x5dca33);recordings['queuecallerjoin'](_0x5dca33);}catch(_0x3c9c9a){utils['error'](util[_0xdbab('0x15')](_0xdbab('0x25'),_0x5dca33[_0xdbab('0x19')]),_0x3c9c9a);}});ami['on'](_0xdbab('0x26'),function(_0x48811b){try{utils[_0xdbab('0x1c')](util['format'](_0xdbab('0x27'),_0x48811b[_0xdbab('0x19')]),_0x48811b);queues['queuecallerleave'](_0x48811b);}catch(_0x27142f){utils[_0xdbab('0x11')](util[_0xdbab('0x15')](_0xdbab('0x27'),_0x48811b[_0xdbab('0x19')]),_0x27142f);}});ami['on'](_0xdbab('0x28'),function(_0x23edd6){try{utils['debug'](util[_0xdbab('0x15')](_0xdbab('0x29'),_0x23edd6['uniqueid']),_0x23edd6);queues[_0xdbab('0x28')](_0x23edd6);calls['musiconholdstart'](_0x23edd6);}catch(_0x24a75d){utils[_0xdbab('0x11')](util['format'](_0xdbab('0x29'),_0x23edd6[_0xdbab('0x19')]),_0x24a75d);}});ami['on'](_0xdbab('0x2a'),function(_0x4ed30a){try{utils[_0xdbab('0x1c')](util[_0xdbab('0x15')](_0xdbab('0x2b'),_0x4ed30a[_0xdbab('0x19')]),_0x4ed30a);queues[_0xdbab('0x2a')](_0x4ed30a);calls[_0xdbab('0x2a')](_0x4ed30a);}catch(_0x36f4a0){utils['error'](util[_0xdbab('0x15')](_0xdbab('0x2b'),_0x4ed30a[_0xdbab('0x19')]),_0x36f4a0);}});ami['on']('newstate',function(_0x626eb0){try{utils[_0xdbab('0x1c')](util[_0xdbab('0x15')](_0xdbab('0x2c'),_0x626eb0['uniqueid']),_0x626eb0);calls[_0xdbab('0x2d')](_0x626eb0);recordings['newstate'](_0x626eb0);}catch(_0x17c034){utils[_0xdbab('0x11')](util[_0xdbab('0x15')](_0xdbab('0x2c'),_0x626eb0[_0xdbab('0x19')]),_0x17c034);}});ami['on']('hangup',function(_0x3bee3f){try{utils[_0xdbab('0x1c')](util['format'](_0xdbab('0x2e'),_0x3bee3f[_0xdbab('0x19')]),_0x3bee3f);calls[_0xdbab('0x2f')](_0x3bee3f);recordings['hangup'](_0x3bee3f);dials[_0xdbab('0x2f')](_0x3bee3f);agents['hangup'](_0x3bee3f);queues[_0xdbab('0x2f')](_0x3bee3f);}catch(_0x254fd5){utils[_0xdbab('0x11')](util[_0xdbab('0x15')](_0xdbab('0x2e'),_0x3bee3f[_0xdbab('0x19')]),_0x254fd5);}});ami['on']('cdr',function(_0xda7a8a){try{utils[_0xdbab('0x1c')](util[_0xdbab('0x15')](_0xdbab('0x30'),_0xda7a8a[_0xdbab('0x19')]),_0xda7a8a);members[_0xdbab('0x31')](_0xda7a8a);}catch(_0x30f329){utils['error'](util[_0xdbab('0x15')](_0xdbab('0x30'),_0xda7a8a[_0xdbab('0x19')]),_0x30f329);}});ami['on'](_0xdbab('0x32'),function(_0x128292){try{utils[_0xdbab('0x1c')](util[_0xdbab('0x15')](_0xdbab('0x33'),_0x128292['uniqueid']),_0x128292);queues[_0xdbab('0x32')](_0x128292);agents[_0xdbab('0x32')](_0x128292);transfers[_0xdbab('0x32')](_0x128292);}catch(_0x340bfe){utils[_0xdbab('0x11')](util[_0xdbab('0x15')](_0xdbab('0x33'),_0x128292[_0xdbab('0x19')]),_0x340bfe);}});ami['on'](_0xdbab('0x34'),function(_0x17bfd7){try{utils[_0xdbab('0x1c')](util[_0xdbab('0x15')](_0xdbab('0x35'),_0x17bfd7[_0xdbab('0x36')]),_0x17bfd7);queues[_0xdbab('0x34')](_0x17bfd7);transfers[_0xdbab('0x34')](_0x17bfd7);agents[_0xdbab('0x34')](_0x17bfd7);calls[_0xdbab('0x34')](_0x17bfd7);}catch(_0x4a0b0a){utils['error'](util[_0xdbab('0x15')]('[%s][index][attendedtransfer]',_0x17bfd7[_0xdbab('0x36')]),_0x4a0b0a);}});ami['on'](_0xdbab('0x37'),function(_0x2c4945){try{utils['debug'](util[_0xdbab('0x15')](_0xdbab('0x38'),_0x2c4945[_0xdbab('0x19')]),_0x2c4945);queues[_0xdbab('0x37')](_0x2c4945);recordings[_0xdbab('0x37')](_0x2c4945);calls[_0xdbab('0x37')](_0x2c4945);dials['varset'](_0x2c4945);}catch(_0x14f778){utils['error'](util['format'](_0xdbab('0x38'),_0x2c4945[_0xdbab('0x19')]),_0x14f778);}});ami['on'](_0xdbab('0x39'),function(_0xbdf345){try{utils[_0xdbab('0x1c')](util[_0xdbab('0x15')](_0xdbab('0x3a'),_0xbdf345[_0xdbab('0x19')]),_0xbdf345);calls[_0xdbab('0x39')](_0xbdf345);recordings['newexten'](_0xbdf345);dials[_0xdbab('0x39')](_0xbdf345);}catch(_0x2a6d12){utils[_0xdbab('0x11')](util['format'](_0xdbab('0x3a'),_0xbdf345[_0xdbab('0x19')]),_0x2a6d12);}});ami['on'](_0xdbab('0x3b'),function(_0x2c2419){try{utils[_0xdbab('0x1c')](util['format'](_0xdbab('0x3c'),_0x2c2419['uniqueid']),_0x2c2419);calls['newchannel'](_0x2c2419);recordings[_0xdbab('0x3b')](_0x2c2419);}catch(_0x53f850){utils[_0xdbab('0x11')](util[_0xdbab('0x15')]('[%s][index][newchannel]',_0x2c2419[_0xdbab('0x19')]),_0x53f850);}});ami['on'](_0xdbab('0x3d'),function(_0x7ccd8b){try{utils[_0xdbab('0x1c')](util['format'](_0xdbab('0x3e'),_0x7ccd8b['uniqueid']),_0x7ccd8b);dials[_0xdbab('0x3d')](_0x7ccd8b);}catch(_0x35c55b){utils[_0xdbab('0x11')](util[_0xdbab('0x15')](_0xdbab('0x3f'),_0x7ccd8b[_0xdbab('0x19')]),_0x35c55b);}});ami['on']('dialend',function(_0x313fd4){try{utils[_0xdbab('0x1c')](util['format'](_0xdbab('0x40'),_0x313fd4[_0xdbab('0x19')]),_0x313fd4);dials[_0xdbab('0x41')](_0x313fd4);}catch(_0x1cc93f){utils['error'](util['format'](_0xdbab('0x40'),_0x313fd4[_0xdbab('0x19')]),_0x1cc93f);}});} \ No newline at end of file +var _0x7f81=['[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f81,0x96));var _0x17f8=function(_0x34fe6e,_0x58c566){_0x34fe6e=_0x34fe6e-0x0;var _0x4e201c=_0x7f81[_0x34fe6e];return _0x4e201c;};var AsteriskManager=require(_0x17f8('0x0'));var config=require(_0x17f8('0x1'));var utils=require(_0x17f8('0x2'));var util=require(_0x17f8('0x3'));var ami=new AsteriskManager(config[_0x17f8('0x4')][_0x17f8('0x5')],config[_0x17f8('0x4')]['ip'],config[_0x17f8('0x4')]['username'],config[_0x17f8('0x4')]['password'],!![]);ami[_0x17f8('0x6')]();if(config[_0x17f8('0x7')]&&config[_0x17f8('0x7')][_0x17f8('0x8')]){utils[_0x17f8('0x9')](_0x17f8('0xa'));}else{var agents=require(_0x17f8('0xb'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x17f8('0xc'));var members=require(_0x17f8('0xd'));var dials=require(_0x17f8('0xe'));var transfers=require(_0x17f8('0xf'));var core=require('./core.controller');ami['on']('connect',core[_0x17f8('0x10')]);ami['on']('shutdown',core[_0x17f8('0x11')]);ami['on'](_0x17f8('0x12'),core['fullybooted']);ami['on'](_0x17f8('0x13'),core[_0x17f8('0x13')]);ami['on'](_0x17f8('0x14'),core['close']);ami['on']('managerevent',core[_0x17f8('0x15')]);ami['on']('devicestatechange',function(_0x36415c){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x18'),_0x36415c[_0x17f8('0x19')]),_0x36415c);members[_0x17f8('0x1a')](_0x36415c);}catch(_0x33720b){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x18'),_0x36415c[_0x17f8('0x19')]),_0x33720b);}});ami['on'](_0x17f8('0x1b'),function(_0x1b415d){try{utils['debug'](util[_0x17f8('0x17')](_0x17f8('0x1c'),_0x1b415d[_0x17f8('0x1d')]),_0x1b415d);agents['agentcalled'](_0x1b415d);}catch(_0x2d4264){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x1c'),_0x1b415d[_0x17f8('0x1d')]),_0x2d4264);}});ami['on'](_0x17f8('0x1e'),function(_0xaf5287){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x1f'),_0xaf5287[_0x17f8('0x1d')]),_0xaf5287);agents[_0x17f8('0x1e')](_0xaf5287);}catch(_0x18a0f9){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x1f'),_0xaf5287[_0x17f8('0x1d')]),_0x18a0f9);}});ami['on'](_0x17f8('0x20'),function(_0x11a163){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x21'),_0x11a163[_0x17f8('0x1d')]),_0x11a163);agents[_0x17f8('0x20')](_0x11a163);queues[_0x17f8('0x20')](_0x11a163);}catch(_0x52ee6b){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x21'),_0x11a163[_0x17f8('0x1d')]),_0x52ee6b);}});ami['on'](_0x17f8('0x22'),function(_0x5a7893){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x23'),_0x5a7893[_0x17f8('0x1d')]),_0x5a7893);agents[_0x17f8('0x22')](_0x5a7893);queues[_0x17f8('0x22')](_0x5a7893);members[_0x17f8('0x22')](_0x5a7893);}catch(_0x21caee){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x23'),_0x5a7893[_0x17f8('0x1d')]),_0x21caee);}});ami['on'](_0x17f8('0x24'),function(_0x31c519){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x25'),_0x31c519[_0x17f8('0x1d')]),_0x31c519);agents[_0x17f8('0x24')](_0x31c519);queues['queuecallerabandon'](_0x31c519);}catch(_0x1c0faf){utils[_0x17f8('0x13')](util['format'](_0x17f8('0x25'),_0x31c519['uniqueid']),_0x1c0faf);}});ami['on'](_0x17f8('0x26'),function(_0x1b98f4){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')]('[%s][index][queuecallerjoin]',_0x1b98f4[_0x17f8('0x1d')]),_0x1b98f4);queues[_0x17f8('0x26')](_0x1b98f4);recordings[_0x17f8('0x26')](_0x1b98f4);}catch(_0x3484bf){utils[_0x17f8('0x13')](util[_0x17f8('0x17')]('[%s][index][queuecallerjoin]',_0x1b98f4['uniqueid']),_0x3484bf);}});ami['on']('queuecallerleave',function(_0x11a8f8){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x27'),_0x11a8f8[_0x17f8('0x1d')]),_0x11a8f8);queues[_0x17f8('0x28')](_0x11a8f8);}catch(_0x191b49){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x27'),_0x11a8f8['uniqueid']),_0x191b49);}});ami['on'](_0x17f8('0x29'),function(_0x1ed73d){try{utils[_0x17f8('0x16')](util['format']('[%s][index][musiconholdstart]',_0x1ed73d[_0x17f8('0x1d')]),_0x1ed73d);queues[_0x17f8('0x29')](_0x1ed73d);calls[_0x17f8('0x29')](_0x1ed73d);}catch(_0x5ede27){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x2a'),_0x1ed73d['uniqueid']),_0x5ede27);}});ami['on'](_0x17f8('0x2b'),function(_0x558ca8){try{utils[_0x17f8('0x16')](util['format']('[%s][index][musiconholdstop]',_0x558ca8[_0x17f8('0x1d')]),_0x558ca8);queues[_0x17f8('0x2b')](_0x558ca8);calls[_0x17f8('0x2b')](_0x558ca8);}catch(_0x383768){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x2c'),_0x558ca8['uniqueid']),_0x383768);}});ami['on']('newstate',function(_0x3382ab){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')]('[%s][index][newstate]',_0x3382ab[_0x17f8('0x1d')]),_0x3382ab);calls['newstate'](_0x3382ab);recordings[_0x17f8('0x2d')](_0x3382ab);}catch(_0x579a90){utils[_0x17f8('0x13')](util[_0x17f8('0x17')]('[%s][index][newstate]',_0x3382ab[_0x17f8('0x1d')]),_0x579a90);}});ami['on'](_0x17f8('0x2e'),function(_0x6ab10){try{utils[_0x17f8('0x16')](util['format'](_0x17f8('0x2f'),_0x6ab10[_0x17f8('0x1d')]),_0x6ab10);calls[_0x17f8('0x2e')](_0x6ab10);recordings[_0x17f8('0x2e')](_0x6ab10);dials[_0x17f8('0x2e')](_0x6ab10);agents['hangup'](_0x6ab10);queues[_0x17f8('0x2e')](_0x6ab10);}catch(_0xb8f100){utils[_0x17f8('0x13')](util[_0x17f8('0x17')]('[%s][index][hangup]',_0x6ab10[_0x17f8('0x1d')]),_0xb8f100);}});ami['on'](_0x17f8('0x30'),function(_0x2735f4){try{utils['debug'](util[_0x17f8('0x17')](_0x17f8('0x31'),_0x2735f4[_0x17f8('0x1d')]),_0x2735f4);members['cdr'](_0x2735f4);}catch(_0x39e810){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x31'),_0x2735f4[_0x17f8('0x1d')]),_0x39e810);}});ami['on'](_0x17f8('0x32'),function(_0x3e1356){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x33'),_0x3e1356['uniqueid']),_0x3e1356);queues[_0x17f8('0x32')](_0x3e1356);agents['blindtransfer'](_0x3e1356);transfers[_0x17f8('0x32')](_0x3e1356);}catch(_0x1f79a4){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x33'),_0x3e1356['uniqueid']),_0x1f79a4);}});ami['on'](_0x17f8('0x34'),function(_0x179909){try{utils[_0x17f8('0x16')](util['format'](_0x17f8('0x35'),_0x179909[_0x17f8('0x36')]),_0x179909);queues['attendedtransfer'](_0x179909);transfers[_0x17f8('0x34')](_0x179909);agents['attendedtransfer'](_0x179909);calls[_0x17f8('0x34')](_0x179909);}catch(_0x36319d){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x35'),_0x179909[_0x17f8('0x36')]),_0x36319d);}});ami['on']('varset',function(_0x5c98dd){try{utils['debug'](util[_0x17f8('0x17')]('[%s][index][varset]',_0x5c98dd[_0x17f8('0x1d')]),_0x5c98dd);queues[_0x17f8('0x37')](_0x5c98dd);recordings[_0x17f8('0x37')](_0x5c98dd);calls[_0x17f8('0x37')](_0x5c98dd);dials['varset'](_0x5c98dd);}catch(_0x5bb381){utils['error'](util[_0x17f8('0x17')](_0x17f8('0x38'),_0x5c98dd[_0x17f8('0x1d')]),_0x5bb381);}});ami['on'](_0x17f8('0x39'),function(_0x3c96b5){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x3a'),_0x3c96b5['uniqueid']),_0x3c96b5);calls[_0x17f8('0x39')](_0x3c96b5);recordings[_0x17f8('0x39')](_0x3c96b5);dials[_0x17f8('0x39')](_0x3c96b5);}catch(_0x8c7804){utils[_0x17f8('0x13')](util['format']('[%s][index][newexten]',_0x3c96b5[_0x17f8('0x1d')]),_0x8c7804);}});ami['on']('newchannel',function(_0x10a56d){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')]('[%s][index][newchannel]',_0x10a56d[_0x17f8('0x1d')]),_0x10a56d);calls['newchannel'](_0x10a56d);recordings[_0x17f8('0x3b')](_0x10a56d);}catch(_0x492e18){utils[_0x17f8('0x13')](util[_0x17f8('0x17')]('[%s][index][newchannel]',_0x10a56d[_0x17f8('0x1d')]),_0x492e18);}});ami['on'](_0x17f8('0x3c'),function(_0x38c888){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')]('[%s][index][dialbegin]',_0x38c888[_0x17f8('0x1d')]),_0x38c888);dials[_0x17f8('0x3c')](_0x38c888);}catch(_0x139f0e){utils[_0x17f8('0x13')](util['format']('[%s]dialbegin',_0x38c888[_0x17f8('0x1d')]),_0x139f0e);}});ami['on'](_0x17f8('0x3d'),function(_0x57b9f4){try{utils[_0x17f8('0x16')](util[_0x17f8('0x17')](_0x17f8('0x3e'),_0x57b9f4[_0x17f8('0x1d')]),_0x57b9f4);dials[_0x17f8('0x3d')](_0x57b9f4);}catch(_0x2fd946){utils[_0x17f8('0x13')](util[_0x17f8('0x17')](_0x17f8('0x3e'),_0x57b9f4[_0x17f8('0x1d')]),_0x2fd946);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 47a436e..1d97d38 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 _0xb701=['NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][cdr]','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','now','agent'];(function(_0x29b1a7,_0x1ed6b6){var _0x4a69af=function(_0x174bff){while(--_0x174bff){_0x29b1a7['push'](_0x29b1a7['shift']());}};_0x4a69af(++_0x1ed6b6);}(_0xb701,0x144));var _0x1b70=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb701[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x1b70('0x0'));var utils=require('./utils');var members={};var exclude=[_0x1b70('0x1'),'Queue:'];function writeDB(_0x5c87ab){utils[_0x1b70('0x2')](util[_0x1b70('0x3')](_0x1b70('0x4'),_0x5c87ab[_0x1b70('0x5')],_0x5c87ab[_0x1b70('0x6')],_0x5c87ab[_0x1b70('0x7')],_0x5c87ab[_0x1b70('0x8')],_0x5c87ab[_0x1b70('0x9')],_0x5c87ab[_0x1b70('0xa')]));if(_0x5c87ab[_0x1b70('0x6')]){utils['getUserByInterface'](_0x5c87ab[_0x1b70('0x6')])[_0x1b70('0xb')](function(_0x114b44){if(_0x114b44){_0x5c87ab[_0x1b70('0x9')]=_0x114b44[_0x1b70('0xc')];_0x5c87ab[_0x1b70('0xd')]=_0x114b44[_0x1b70('0xd')];utils['request'](_0x1b70('0xe'),_0x5c87ab);}else{utils[_0x1b70('0xf')](_0x5c87ab[_0x1b70('0x6')][_0x1b70('0x10')]('/')[0x1])[_0x1b70('0xb')](function(_0x1e636d){if(_0x1e636d){_0x5c87ab[_0x1b70('0x9')]=_0x1e636d[_0x1b70('0xc')];_0x5c87ab[_0x1b70('0xd')]=_0x1e636d[_0x1b70('0xd')];utils[_0x1b70('0x11')](_0x1b70('0xe'),_0x5c87ab);}});}})[_0x1b70('0x12')](function(_0x51ed99){utils[_0x1b70('0x13')](util[_0x1b70('0x3')](_0x1b70('0x14'),_0x5c87ab[_0x1b70('0x5')]),_0x51ed99);});}delete members[_0x5c87ab['interface']];}function startsWith(_0x5c3548,_0x50bf6b){return _[_0x1b70('0x15')](_0x5c3548,function(_0x3e28ee){return _[_0x1b70('0x16')](_0x50bf6b,_0x3e28ee);});}exports[_0x1b70('0x17')]=function(_0x314ebb){try{utils[_0x1b70('0x18')](util['format'](_0x1b70('0x19'),members[_0x314ebb[_0x1b70('0x1a')]]?members[_0x314ebb[_0x1b70('0x1a')]]['uniqueid']:_0x314ebb[_0x1b70('0x1a')]),_0x314ebb);utils[_0x1b70('0x2')](util[_0x1b70('0x3')](_0x1b70('0x1b'),members[_0x314ebb[_0x1b70('0x1a')]]?members[_0x314ebb[_0x1b70('0x1a')]][_0x1b70('0x5')]:_0x314ebb[_0x1b70('0x1a')],_0x314ebb['state'],_0x314ebb[_0x1b70('0x1a')]));switch(_0x314ebb[_0x1b70('0x1c')]){case _0x1b70('0x1d'):case'BUSY':if(!startsWith(exclude,_0x314ebb[_0x1b70('0x1a')])){members[_0x314ebb[_0x1b70('0x1a')]]={'channel':_0x1b70('0x1e'),'interface':_0x314ebb[_0x1b70('0x1a')],'type':'TALKING','enterAt':utils[_0x1b70('0x1f')](),'role':_0x1b70('0x20')};}break;case _0x1b70('0x21'):if(!_[_0x1b70('0x22')](members[_0x314ebb[_0x1b70('0x1a')]])){members[_0x314ebb[_0x1b70('0x1a')]][_0x1b70('0x23')]=utils[_0x1b70('0x1f')]();members[_0x314ebb[_0x1b70('0x1a')]][_0x1b70('0x24')]=utils[_0x1b70('0x25')](members[_0x314ebb['device']]['exitAt'],members[_0x314ebb[_0x1b70('0x1a')]][_0x1b70('0x26')]);if(members[_0x314ebb['device']][_0x1b70('0x5')]){writeDB(members[_0x314ebb[_0x1b70('0x1a')]]);}}break;default:break;}}catch(_0xe0a20f){utils[_0x1b70('0x13')](util['format']('[%s][members][devicestatechange]',members[_0x314ebb[_0x1b70('0x1a')]]?members[_0x314ebb[_0x1b70('0x1a')]][_0x1b70('0x5')]:_0x314ebb[_0x1b70('0x1a')]),_0xe0a20f);}};exports[_0x1b70('0x27')]=function(_0x4bbe5a){try{if(!_[_0x1b70('0x22')](members[_0x4bbe5a[_0x1b70('0x6')]])){utils['debug'](util[_0x1b70('0x3')](_0x1b70('0x28'),_0x4bbe5a[_0x1b70('0x5')]),_0x4bbe5a);utils['info'](util[_0x1b70('0x3')](_0x1b70('0x29'),_0x4bbe5a[_0x1b70('0x5')],_0x4bbe5a[_0x1b70('0x6')],_0x4bbe5a[_0x1b70('0x2a')]));members[_0x4bbe5a[_0x1b70('0x6')]]=_['assign'](members[_0x4bbe5a[_0x1b70('0x6')]],{'data4':_0x4bbe5a[_0x1b70('0x2a')],'uniqueid':_0x4bbe5a[_0x1b70('0x5')]});}}catch(_0x2a69cc){utils[_0x1b70('0x13')](util[_0x1b70('0x3')]('[%s][members][agentcomplete]',_0x4bbe5a[_0x1b70('0x5')]),_0x2a69cc);}};exports['cdr']=function(_0x5295f9){try{utils[_0x1b70('0x18')](util[_0x1b70('0x3')](_0x1b70('0x2b'),_0x5295f9[_0x1b70('0x5')]),_0x5295f9);if(_0x5295f9[_0x1b70('0x7')]){var _0x43ebe3=_0x5295f9[_0x1b70('0x7')][_0x1b70('0x10')]('-')[0x0];if(!_[_0x1b70('0x22')](members[_0x43ebe3])){members[_0x43ebe3]=_[_0x1b70('0x2c')](members[_0x43ebe3],{'data1':members[_0x43ebe3][_0x1b70('0x2d')]||_0x5295f9[_0x1b70('0xa')],'data2':members[_0x43ebe3][_0x1b70('0x8')]||_0x5295f9[_0x1b70('0x2e')],'data3':members[_0x43ebe3][_0x1b70('0x2f')]||_0x5295f9[_0x1b70('0x30')],'uniqueid':members[_0x43ebe3][_0x1b70('0x5')]||_0x5295f9['uniqueid']});utils['info'](util[_0x1b70('0x3')](_0x1b70('0x31'),_0x5295f9['uniqueid'],members[_0x43ebe3][_0x1b70('0x2d')],members[_0x43ebe3][_0x1b70('0x8')],members[_0x43ebe3][_0x1b70('0x2f')]));if(members[_0x43ebe3][_0x1b70('0x23')]){writeDB(members[_0x43ebe3]);}}}if(_0x5295f9[_0x1b70('0x32')]){var _0x220470=_0x5295f9[_0x1b70('0x32')][_0x1b70('0x10')]('-')[0x0];if(!_[_0x1b70('0x22')](members[_0x220470])){members[_0x220470]=_[_0x1b70('0x2c')](members[_0x220470],{'data1':members[_0x220470]['data1']||_0x5295f9[_0x1b70('0xa')],'data2':members[_0x220470][_0x1b70('0x8')]||_0x5295f9[_0x1b70('0x2e')],'data3':members[_0x220470][_0x1b70('0x2f')]||_0x5295f9[_0x1b70('0x30')],'uniqueid':members[_0x220470][_0x1b70('0x5')]||_0x5295f9[_0x1b70('0x5')]});utils[_0x1b70('0x2')](util[_0x1b70('0x3')](_0x1b70('0x31'),_0x5295f9['uniqueid'],members[_0x220470][_0x1b70('0x2d')],members[_0x220470][_0x1b70('0x8')],members[_0x220470][_0x1b70('0x2f')]));if(members[_0x220470]['exitAt']){writeDB(members[_0x220470]);}}}}catch(_0x754d26){utils['error'](util[_0x1b70('0x3')](_0x1b70('0x2b'),_0x5295f9['uniqueid']),_0x754d26);}}; \ No newline at end of file +var _0x4c91=['[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','destination','[%s][members][cdr]','lodash','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','state','INUSE','voice','TALKING','now','agent','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]'];(function(_0x2652e9,_0x1b1faa){var _0x30652e=function(_0x4d8edf){while(--_0x4d8edf){_0x2652e9['push'](_0x2652e9['shift']());}};_0x30652e(++_0x1b1faa);}(_0x4c91,0x161));var _0x14c9=function(_0x556784,_0x1bcd8c){_0x556784=_0x556784-0x0;var _0x501331=_0x4c91[_0x556784];return _0x501331;};'use strict';var _=require(_0x14c9('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x14c9('0x1'),_0x14c9('0x2')];function writeDB(_0x192b1c){utils[_0x14c9('0x3')](util[_0x14c9('0x4')](_0x14c9('0x5'),_0x192b1c['uniqueid'],_0x192b1c[_0x14c9('0x6')],_0x192b1c[_0x14c9('0x7')],_0x192b1c[_0x14c9('0x8')],_0x192b1c[_0x14c9('0x9')],_0x192b1c[_0x14c9('0xa')]));if(_0x192b1c['interface']){utils[_0x14c9('0xb')](_0x192b1c[_0x14c9('0x6')])[_0x14c9('0xc')](function(_0x3054ad){if(_0x3054ad){_0x192b1c['membername']=_0x3054ad[_0x14c9('0xd')];_0x192b1c[_0x14c9('0xe')]=_0x3054ad[_0x14c9('0xe')];utils[_0x14c9('0xf')](_0x14c9('0x10'),_0x192b1c);}else{utils[_0x14c9('0x11')](_0x192b1c[_0x14c9('0x6')][_0x14c9('0x12')]('/')[0x1])['then'](function(_0x5819ed){if(_0x5819ed){_0x192b1c[_0x14c9('0x9')]=_0x5819ed[_0x14c9('0xd')];_0x192b1c[_0x14c9('0xe')]=_0x5819ed[_0x14c9('0xe')];utils[_0x14c9('0xf')]('CreateMemberReport',_0x192b1c);}});}})['catch'](function(_0x1f06d2){utils[_0x14c9('0x13')](util[_0x14c9('0x4')](_0x14c9('0x14'),_0x192b1c['uniqueid']),_0x1f06d2);});}delete members[_0x192b1c[_0x14c9('0x6')]];}function startsWith(_0x46a16b,_0x45825a){return _['some'](_0x46a16b,function(_0x450264){return _[_0x14c9('0x15')](_0x45825a,_0x450264);});}exports[_0x14c9('0x16')]=function(_0x526b10){try{utils[_0x14c9('0x17')](util[_0x14c9('0x4')](_0x14c9('0x18'),members[_0x526b10[_0x14c9('0x19')]]?members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x1a')]:_0x526b10[_0x14c9('0x19')]),_0x526b10);utils['info'](util[_0x14c9('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x526b10[_0x14c9('0x19')]]?members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x1a')]:_0x526b10[_0x14c9('0x19')],_0x526b10[_0x14c9('0x1b')],_0x526b10[_0x14c9('0x19')]));switch(_0x526b10[_0x14c9('0x1b')]){case _0x14c9('0x1c'):case'BUSY':if(!startsWith(exclude,_0x526b10['device'])){members[_0x526b10[_0x14c9('0x19')]]={'channel':_0x14c9('0x1d'),'interface':_0x526b10[_0x14c9('0x19')],'type':_0x14c9('0x1e'),'enterAt':utils[_0x14c9('0x1f')](),'role':_0x14c9('0x20')};}break;case'NOT_INUSE':if(!_[_0x14c9('0x21')](members[_0x526b10[_0x14c9('0x19')]])){members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x22')]=utils['now']();members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x23')]=utils[_0x14c9('0x24')](members[_0x526b10['device']][_0x14c9('0x22')],members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x25')]);if(members[_0x526b10[_0x14c9('0x19')]]['uniqueid']){writeDB(members[_0x526b10[_0x14c9('0x19')]]);}}break;default:break;}}catch(_0x17dae3){utils[_0x14c9('0x13')](util[_0x14c9('0x4')]('[%s][members][devicestatechange]',members[_0x526b10[_0x14c9('0x19')]]?members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x1a')]:_0x526b10['device']),_0x17dae3);}};exports['agentcomplete']=function(_0x7f394e){try{if(!_[_0x14c9('0x21')](members[_0x7f394e['interface']])){utils['debug'](util[_0x14c9('0x4')](_0x14c9('0x26'),_0x7f394e[_0x14c9('0x1a')]),_0x7f394e);utils[_0x14c9('0x3')](util['format'](_0x14c9('0x27'),_0x7f394e['uniqueid'],_0x7f394e[_0x14c9('0x6')],_0x7f394e['queue']));members[_0x7f394e[_0x14c9('0x6')]]=_[_0x14c9('0x28')](members[_0x7f394e[_0x14c9('0x6')]],{'data4':_0x7f394e[_0x14c9('0x29')],'uniqueid':_0x7f394e[_0x14c9('0x1a')]});}}catch(_0x5533a6){utils['error'](util[_0x14c9('0x4')](_0x14c9('0x26'),_0x7f394e['uniqueid']),_0x5533a6);}};exports['cdr']=function(_0xaba681){try{utils[_0x14c9('0x17')](util['format']('[%s][members][cdr]',_0xaba681[_0x14c9('0x1a')]),_0xaba681);if(_0xaba681[_0x14c9('0x7')]){var _0x32f8d2=_0xaba681[_0x14c9('0x7')]['split']('-')[0x0];if(!_[_0x14c9('0x21')](members[_0x32f8d2])){members[_0x32f8d2]=_[_0x14c9('0x28')](members[_0x32f8d2],{'data1':members[_0x32f8d2]['data1']||_0xaba681[_0x14c9('0xa')],'data2':members[_0x32f8d2][_0x14c9('0x8')]||_0xaba681[_0x14c9('0x2a')],'data3':members[_0x32f8d2][_0x14c9('0x2b')]||_0xaba681['destination'],'uniqueid':members[_0x32f8d2][_0x14c9('0x1a')]||_0xaba681['uniqueid']});utils[_0x14c9('0x3')](util['format'](_0x14c9('0x2c'),_0xaba681[_0x14c9('0x1a')],members[_0x32f8d2][_0x14c9('0x2d')],members[_0x32f8d2][_0x14c9('0x8')],members[_0x32f8d2][_0x14c9('0x2b')]));if(members[_0x32f8d2]['exitAt']){writeDB(members[_0x32f8d2]);}}}if(_0xaba681['destinationchannel']){var _0x3d761d=_0xaba681[_0x14c9('0x2e')][_0x14c9('0x12')]('-')[0x0];if(!_[_0x14c9('0x21')](members[_0x3d761d])){members[_0x3d761d]=_['assign'](members[_0x3d761d],{'data1':members[_0x3d761d][_0x14c9('0x2d')]||_0xaba681[_0x14c9('0xa')],'data2':members[_0x3d761d][_0x14c9('0x8')]||_0xaba681['source'],'data3':members[_0x3d761d][_0x14c9('0x2b')]||_0xaba681[_0x14c9('0x2f')],'uniqueid':members[_0x3d761d][_0x14c9('0x1a')]||_0xaba681[_0x14c9('0x1a')]});utils[_0x14c9('0x3')](util[_0x14c9('0x4')](_0x14c9('0x2c'),_0xaba681['uniqueid'],members[_0x3d761d][_0x14c9('0x2d')],members[_0x3d761d][_0x14c9('0x8')],members[_0x3d761d][_0x14c9('0x2b')]));if(members[_0x3d761d]['exitAt']){writeDB(members[_0x3d761d]);}}}}catch(_0x11fe14){utils[_0x14c9('0x13')](util[_0x14c9('0x4')](_0x14c9('0x30'),_0xaba681[_0x14c9('0x1a')]),_0x11fe14);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c3a8d21..f01e8aa 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 _0x9e48=['agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','extension','transferuniqueid','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9e48,0x179));var _0x89e4=function(_0x4895d7,_0x1c2920){_0x4895d7=_0x4895d7-0x0;var _0xc0253b=_0x9e48[_0x4895d7];return _0xc0253b;};'use strict';var _=require(_0x89e4('0x0'));var util=require('util');var utils=require(_0x89e4('0x1'));var queues={};function writeDB(_0x278f07){utils[_0x89e4('0x2')](util[_0x89e4('0x3')](_0x89e4('0x4'),_0x278f07[_0x89e4('0x5')],_0x278f07[_0x89e4('0x6')],_0x278f07[_0x89e4('0x7')],_0x278f07[_0x89e4('0x8')],_0x278f07['calleridnum'],_0x278f07[_0x89e4('0x9')],_0x278f07[_0x89e4('0xa')]));if(_0x278f07[_0x89e4('0x7')]){utils[_0x89e4('0xb')](_0x278f07[_0x89e4('0x7')])[_0x89e4('0xc')](function(_0x5cee48){if(_0x5cee48){_0x278f07['type']=_0x5cee48['type'];}utils[_0x89e4('0xd')](_0x89e4('0xe'),_0x278f07);});}else{utils[_0x89e4('0xd')](_0x89e4('0xe'),_0x278f07);}if(_0x278f07[_0x89e4('0xf')]){delete queues[_0x278f07['transfereduniqueid']];}else{delete queues[_0x278f07[_0x89e4('0x5')]];}}exports[_0x89e4('0x10')]=function(_0x499b53){try{utils[_0x89e4('0x11')](util[_0x89e4('0x3')](_0x89e4('0x12'),_0x499b53[_0x89e4('0x5')]),_0x499b53);utils[_0x89e4('0x2')](util[_0x89e4('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x499b53[_0x89e4('0x5')],_0x499b53[_0x89e4('0x7')],_0x499b53[_0x89e4('0x13')]));queues[_0x499b53[_0x89e4('0x5')]]=_[_0x89e4('0x14')](_0x499b53,{'originalposition':_0x499b53['position'],'queuecallerjoinAt':utils[_0x89e4('0x15')](),'mohtime':0x0});}catch(_0x2556d1){utils[_0x89e4('0x16')](util[_0x89e4('0x3')](_0x89e4('0x12'),_0x499b53['uniqueid']),_0x2556d1);}};exports[_0x89e4('0x17')]=function(_0x593a01){try{if(!_[_0x89e4('0x18')](queues[_0x593a01['uniqueid']])){utils['debug'](util[_0x89e4('0x3')]('[%s][queues][hangup]',_0x593a01['uniqueid']),_0x593a01);if(queues[_0x593a01[_0x89e4('0x5')]]['queuecallerleaveAt']){if(!queues[_0x593a01[_0x89e4('0x5')]][_0x89e4('0x19')]&&!queues[_0x593a01[_0x89e4('0x5')]][_0x89e4('0x1a')]){queues[_0x593a01[_0x89e4('0x5')]][_0x89e4('0x1b')]=!![];queues[_0x593a01[_0x89e4('0x5')]][_0x89e4('0x1c')]=utils[_0x89e4('0x15')]();queues[_0x593a01[_0x89e4('0x5')]]['queuecallerexitreason']=_0x89e4('0x1d');}utils[_0x89e4('0x2')](util[_0x89e4('0x3')](_0x89e4('0x1e'),_0x593a01[_0x89e4('0x5')],queues[_0x593a01['uniqueid']][_0x89e4('0x1f')],queues[_0x593a01[_0x89e4('0x5')]][_0x89e4('0xa')]));writeDB(queues[_0x593a01[_0x89e4('0x5')]]);}else if(queues[_0x593a01['uniqueid']][_0x89e4('0xf')]){utils['info'](util['format'](_0x89e4('0x20'),_0x593a01[_0x89e4('0x5')],queues[_0x593a01[_0x89e4('0x5')]][_0x89e4('0x1f')],queues[_0x593a01[_0x89e4('0x5')]]['transfereduniqueid']));queues[queues[_0x593a01['uniqueid']][_0x89e4('0xf')]]=queues[_0x593a01[_0x89e4('0x5')]];queues[queues[_0x593a01[_0x89e4('0x5')]][_0x89e4('0xf')]][_0x89e4('0x21')]=0x2;delete queues[_0x593a01[_0x89e4('0x5')]];}}}catch(_0x29b398){utils[_0x89e4('0x16')](util['format'](_0x89e4('0x22'),_0x593a01[_0x89e4('0x5')]),_0x29b398);}};exports[_0x89e4('0x23')]=function(_0x1e18d0){try{utils['debug'](util[_0x89e4('0x3')](_0x89e4('0x24'),_0x1e18d0[_0x89e4('0x5')]),_0x1e18d0);if(!_[_0x89e4('0x18')](_0x1e18d0['variable'][_0x89e4('0x25')])&&_0x1e18d0[_0x89e4('0x26')][_0x89e4('0x27')]()!==_0x89e4('0x28')){if(!_[_0x89e4('0x18')](queues[_0x1e18d0[_0x89e4('0x5')]])){queues[_0x1e18d0[_0x89e4('0x5')]][_0x89e4('0x19')]=![];queues[_0x1e18d0[_0x89e4('0x5')]]['queuecallerabandonAt']=null;queues[_0x1e18d0[_0x89e4('0x5')]]['queuecallerexit']=!![];queues[_0x1e18d0[_0x89e4('0x5')]][_0x89e4('0x29')]=utils[_0x89e4('0x15')]();queues[_0x1e18d0[_0x89e4('0x5')]]['queuecallerexitreason']=_0x1e18d0[_0x89e4('0x26')][_0x89e4('0x27')]();utils[_0x89e4('0x2')](util[_0x89e4('0x3')](_0x89e4('0x2a'),_0x1e18d0['uniqueid'],queues[_0x1e18d0['uniqueid']][_0x89e4('0x1f')],_0x1e18d0[_0x89e4('0x26')],queues[_0x1e18d0[_0x89e4('0x5')]][_0x89e4('0xa')]));writeDB(queues[_0x1e18d0[_0x89e4('0x5')]]);}}else if(!_[_0x89e4('0x18')](_0x1e18d0[_0x89e4('0x2b')][_0x89e4('0x2c')])){if(!_[_0x89e4('0x18')](queues[_0x1e18d0[_0x89e4('0x5')]])&&!queues[_0x1e18d0['uniqueid']]['queuecallerabandon']){queues[_0x1e18d0[_0x89e4('0x5')]][_0x89e4('0x19')]=![];queues[_0x1e18d0[_0x89e4('0x5')]][_0x89e4('0x2d')]=null;queues[_0x1e18d0[_0x89e4('0x5')]][_0x89e4('0x1a')]=!![];queues[_0x1e18d0[_0x89e4('0x5')]][_0x89e4('0x29')]=utils['now']();queues[_0x1e18d0['uniqueid']]['queuecallerexitreason']=_0x89e4('0x2e');utils['info'](util[_0x89e4('0x3')](_0x89e4('0x2f'),_0x1e18d0[_0x89e4('0x5')],queues[_0x1e18d0[_0x89e4('0x5')]]['name'],_0x1e18d0[_0x89e4('0x26')],queues[_0x1e18d0['uniqueid']]['queuecallerexitreason']));}}}catch(_0x4f7abf){utils[_0x89e4('0x16')](util[_0x89e4('0x3')]('[%s][queues][varset]',_0x1e18d0[_0x89e4('0x5')]),_0x4f7abf);}};exports[_0x89e4('0x19')]=function(_0x436598){try{if(!_[_0x89e4('0x18')](queues[_0x436598[_0x89e4('0x5')]])){utils[_0x89e4('0x11')](util[_0x89e4('0x3')](_0x89e4('0x30'),_0x436598[_0x89e4('0x5')]),_0x436598);queues[_0x436598[_0x89e4('0x5')]][_0x89e4('0x1a')]=![];queues[_0x436598[_0x89e4('0x5')]]['queuecallerexitAt']=null;queues[_0x436598[_0x89e4('0x5')]][_0x89e4('0x19')]=!![];queues[_0x436598[_0x89e4('0x5')]][_0x89e4('0x2d')]=utils[_0x89e4('0x15')]();queues[_0x436598['uniqueid']][_0x89e4('0xa')]='ABANDONED';utils[_0x89e4('0x2')](util[_0x89e4('0x3')](_0x89e4('0x31'),_0x436598[_0x89e4('0x5')],queues[_0x436598[_0x89e4('0x5')]][_0x89e4('0x1f')],queues[_0x436598[_0x89e4('0x5')]]['queuecallerexitreason']));}}catch(_0x364883){utils[_0x89e4('0x16')](util[_0x89e4('0x3')](_0x89e4('0x30'),_0x436598[_0x89e4('0x5')]),_0x364883);}};exports[_0x89e4('0x32')]=function(_0x5cde02){try{if(!_[_0x89e4('0x18')](queues[_0x5cde02[_0x89e4('0x5')]])){utils[_0x89e4('0x11')](util[_0x89e4('0x3')](_0x89e4('0x33'),_0x5cde02[_0x89e4('0x5')]),_0x5cde02);utils[_0x89e4('0x2')](util[_0x89e4('0x3')](_0x89e4('0x34'),_0x5cde02[_0x89e4('0x5')],queues[_0x5cde02[_0x89e4('0x5')]][_0x89e4('0x1f')],_0x5cde02['connectedlinenum'],_0x5cde02[_0x89e4('0x35')]));queues[_0x5cde02[_0x89e4('0x5')]][_0x89e4('0x32')]=!![];queues[_0x5cde02[_0x89e4('0x5')]][_0x89e4('0x36')]=utils[_0x89e4('0x15')]();queues[_0x5cde02['uniqueid']][_0x89e4('0x37')]=utils[_0x89e4('0x38')](queues[_0x5cde02[_0x89e4('0x5')]][_0x89e4('0x36')],queues[_0x5cde02[_0x89e4('0x5')]][_0x89e4('0x39')]);queues[_0x5cde02[_0x89e4('0x5')]][_0x89e4('0x13')]=_0x5cde02[_0x89e4('0x13')];queues[_0x5cde02['uniqueid']][_0x89e4('0x3a')]=_0x5cde02[_0x89e4('0x3a')];queues[_0x5cde02[_0x89e4('0x5')]]['connectedlinenum']=_0x5cde02['connectedlinenum'];queues[_0x5cde02[_0x89e4('0x5')]][_0x89e4('0x35')]=_0x5cde02['connectedlinename'];}}catch(_0x1374e6){utils[_0x89e4('0x16')](util['format']('[%s][queues][queuecallerleave]',_0x5cde02[_0x89e4('0x5')]),_0x1374e6);}};exports[_0x89e4('0x3b')]=function(_0x19da25){try{if(!_[_0x89e4('0x18')](queues[_0x19da25[_0x89e4('0x5')]])){utils['debug'](util[_0x89e4('0x3')]('[%s][queues][agentconnect]',_0x19da25['uniqueid']),_0x19da25);utils['info'](util[_0x89e4('0x3')](_0x89e4('0x3c'),_0x19da25[_0x89e4('0x5')],queues[_0x19da25[_0x89e4('0x5')]][_0x89e4('0x1f')],_0x19da25[_0x89e4('0x3d')],_0x19da25[_0x89e4('0x3e')]));queues[_0x19da25[_0x89e4('0x5')]][_0x89e4('0x19')]=![];queues[_0x19da25[_0x89e4('0x5')]][_0x89e4('0x19')]=![];queues[_0x19da25[_0x89e4('0x5')]][_0x89e4('0x2d')]=null;queues[_0x19da25['uniqueid']]['queuecallerexit']=![];queues[_0x19da25['uniqueid']][_0x89e4('0xa')]=null;queues[_0x19da25['uniqueid']][_0x89e4('0x29')]=null;queues[_0x19da25[_0x89e4('0x5')]][_0x89e4('0x3f')]=!![];queues[_0x19da25[_0x89e4('0x5')]][_0x89e4('0x9')]=_0x19da25['destaccountcode'];queues[_0x19da25['uniqueid']][_0x89e4('0x8')]=_0x19da25[_0x89e4('0x3d')];}}catch(_0x2f45ba){utils[_0x89e4('0x16')](util[_0x89e4('0x3')](_0x89e4('0x40'),_0x19da25[_0x89e4('0x5')]),_0x2f45ba);}};exports[_0x89e4('0x41')]=function(_0x2dc48e){try{if(!_[_0x89e4('0x18')](queues[_0x2dc48e[_0x89e4('0x5')]])){if(queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x36')]){utils[_0x89e4('0x11')](util[_0x89e4('0x3')]('[%s][queues][agentcomplete]',_0x2dc48e['uniqueid']),_0x2dc48e);queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x19')]=![];queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x19')]=![];queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x2d')]=null;queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x1a')]=![];queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x29')]=null;queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x3f')]=!![];queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x8')]=_0x2dc48e['membername'];queues[_0x2dc48e[_0x89e4('0x5')]]['queuecallercomplete']=!![];queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x1c')]=utils[_0x89e4('0x15')]();if(_0x2dc48e[_0x89e4('0x42')]==_0x89e4('0x43')){if(!queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x43')]){queues[_0x2dc48e['uniqueid']][_0x89e4('0xa')]=_0x89e4('0x44');}}else{queues[_0x2dc48e['uniqueid']]['queuecallerexitreason']=_0x89e4('0x45')+_0x2dc48e[_0x89e4('0x42')][_0x89e4('0x27')]();}utils[_0x89e4('0x2')](util['format'](_0x89e4('0x46'),_0x2dc48e['uniqueid'],queues[_0x2dc48e[_0x89e4('0x5')]][_0x89e4('0x1f')],_0x2dc48e[_0x89e4('0x3d')],queues[_0x2dc48e['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2dc48e[_0x89e4('0x5')]]);}}}catch(_0x36d751){utils['error'](util[_0x89e4('0x3')](_0x89e4('0x47'),_0x2dc48e[_0x89e4('0x5')]),_0x36d751);}};exports[_0x89e4('0x48')]=function(_0x36de4b){try{if(!_[_0x89e4('0x18')](queues[_0x36de4b[_0x89e4('0x49')]])){utils[_0x89e4('0x11')](util[_0x89e4('0x3')](_0x89e4('0x4a'),_0x36de4b[_0x89e4('0x5')]),_0x36de4b);queues[_0x36de4b['transfereeuniqueid']][_0x89e4('0x43')]=!![];queues[_0x36de4b[_0x89e4('0x49')]]['transfertype']=_0x89e4('0x4b');queues[_0x36de4b[_0x89e4('0x49')]]['transferexten']=_0x36de4b[_0x89e4('0x4c')];queues[_0x36de4b[_0x89e4('0x49')]][_0x89e4('0x4d')]=_0x36de4b[_0x89e4('0x49')];queues[_0x36de4b[_0x89e4('0x49')]][_0x89e4('0xa')]='BLINDTRANSFER';utils[_0x89e4('0x2')](util[_0x89e4('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x36de4b[_0x89e4('0x5')],queues[_0x36de4b['transfereeuniqueid']]['name'],_0x36de4b['transfereeuniqueid'],_0x36de4b[_0x89e4('0x4c')]));}}catch(_0x1c22c5){utils[_0x89e4('0x16')](util['format'](_0x89e4('0x4a'),_0x36de4b[_0x89e4('0x5')]),_0x1c22c5);}};exports[_0x89e4('0x4e')]=function(_0x592e6c){try{utils[_0x89e4('0x11')](util[_0x89e4('0x3')](_0x89e4('0x4f'),_0x592e6c[_0x89e4('0x50')]),_0x592e6c);if(_0x592e6c['origtransfereruniqueid']==_0x592e6c[_0x89e4('0x51')]){if(!_['isNil'](queues[_0x592e6c['secondtransfererlinkedid']])){utils[_0x89e4('0x2')](util['format'](_0x89e4('0x52'),_0x592e6c['origtransfereruniqueid'],queues[_0x592e6c[_0x89e4('0x53')]][_0x89e4('0x1f')],_0x592e6c[_0x89e4('0x54')]));queues[_0x592e6c[_0x89e4('0x53')]][_0x89e4('0x43')]=!![];queues[_0x592e6c['secondtransfererlinkedid']][_0x89e4('0x55')]=_0x89e4('0x56');queues[_0x592e6c[_0x89e4('0x53')]][_0x89e4('0x57')]=_0x592e6c['origtransfererexten'];queues[_0x592e6c[_0x89e4('0x53')]][_0x89e4('0x4d')]=_0x592e6c['origtransfereruniqueid'];queues[_0x592e6c[_0x89e4('0x53')]]['queuecallerexitreason']=_0x89e4('0x58');}if(!_['isNil'](queues[_0x592e6c['origtransfererlinkedid']])){if(_0x592e6c['transfereelinkedid']&&queues[_0x592e6c['transfereelinkedid']]){queues[_0x592e6c[_0x89e4('0x59')]][_0x89e4('0x21')]=0x1;queues[_0x592e6c[_0x89e4('0x49')]]=_[_0x89e4('0x5a')](queues[_0x592e6c[_0x89e4('0x59')]]);queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0xf')]=_0x592e6c[_0x89e4('0x5b')];queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0x21')]=0x2;queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0x5c')]=queues[_0x592e6c[_0x89e4('0x53')]][_0x89e4('0x5c')];queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0x5d')]=queues[_0x592e6c[_0x89e4('0x53')]][_0x89e4('0x5d')];queues[_0x592e6c['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x89e4('0x15')]();queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0x36')]=utils[_0x89e4('0x15')]();queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0x37')]=0x0;queues[_0x592e6c[_0x89e4('0x49')]]['mohtime']=0x0;utils[_0x89e4('0x2')](util[_0x89e4('0x3')](_0x89e4('0x5e'),_0x592e6c[_0x89e4('0x50')],queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0x1f')],queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0x5c')],queues[_0x592e6c[_0x89e4('0x49')]][_0x89e4('0x5d')]));}else{utils['info'](util['format'](_0x89e4('0x5f'),_0x592e6c['origtransfereruniqueid'],queues[_0x592e6c[_0x89e4('0x51')]][_0x89e4('0x1f')],_0x592e6c['secondtransfererlinkedid']));queues[_0x592e6c[_0x89e4('0x51')]][_0x89e4('0xf')]=_0x592e6c['secondtransfererlinkedid'];}}}else if(_0x592e6c['secondtransfereruniqueid']==_0x592e6c[_0x89e4('0x53')]){if(!_['isNil'](queues[_0x592e6c['origtransfererlinkedid']])){utils[_0x89e4('0x2')](util[_0x89e4('0x3')](_0x89e4('0x60'),_0x592e6c[_0x89e4('0x50')],queues[_0x592e6c['origtransfererlinkedid']][_0x89e4('0x1f')],_0x592e6c[_0x89e4('0x61')],_0x592e6c[_0x89e4('0x62')]));queues[_0x592e6c[_0x89e4('0x51')]]['transfer']=!![];queues[_0x592e6c[_0x89e4('0x51')]][_0x89e4('0x55')]=_0x89e4('0x56');queues[_0x592e6c[_0x89e4('0x51')]][_0x89e4('0x57')]=_0x592e6c[_0x89e4('0x62')];queues[_0x592e6c[_0x89e4('0x51')]][_0x89e4('0x4d')]=_0x592e6c['secondtransfereruniqueid'];queues[_0x592e6c[_0x89e4('0x51')]][_0x89e4('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x89e4('0x18')](queues[_0x592e6c[_0x89e4('0x53')]])){if(_0x592e6c[_0x89e4('0x63')]&&queues[_0x592e6c['transfertargetlinkedid']]){queues[_0x592e6c[_0x89e4('0x63')]]['queuecallerenterreason']=0x1;queues[_0x592e6c['transfertargetuniqueid']]=_[_0x89e4('0x5a')](queues[_0x592e6c[_0x89e4('0x63')]]);queues[_0x592e6c[_0x89e4('0x5b')]][_0x89e4('0xf')]=_0x592e6c[_0x89e4('0x5b')];queues[_0x592e6c[_0x89e4('0x5b')]]['queuecallerenterreason']=0x2;queues[_0x592e6c['transfertargetuniqueid']][_0x89e4('0x5c')]=queues[_0x592e6c[_0x89e4('0x51')]][_0x89e4('0x5c')];queues[_0x592e6c[_0x89e4('0x5b')]][_0x89e4('0x5d')]=queues[_0x592e6c['origtransfererlinkedid']][_0x89e4('0x5d')];queues[_0x592e6c[_0x89e4('0x5b')]]['queuecallerjoinAt']=utils['now']();queues[_0x592e6c[_0x89e4('0x5b')]][_0x89e4('0x36')]=utils[_0x89e4('0x15')]();queues[_0x592e6c[_0x89e4('0x5b')]][_0x89e4('0x37')]=0x0;queues[_0x592e6c[_0x89e4('0x5b')]][_0x89e4('0x64')]=0x0;utils['info'](util[_0x89e4('0x3')](_0x89e4('0x65'),_0x592e6c[_0x89e4('0x50')],queues[_0x592e6c[_0x89e4('0x5b')]]['name'],queues[_0x592e6c[_0x89e4('0x5b')]][_0x89e4('0xf')],queues[_0x592e6c[_0x89e4('0x5b')]][_0x89e4('0x5c')],queues[_0x592e6c[_0x89e4('0x5b')]][_0x89e4('0x5d')]));}else{utils[_0x89e4('0x2')](util['format'](_0x89e4('0x5f'),_0x592e6c[_0x89e4('0x50')],queues[_0x592e6c[_0x89e4('0x53')]][_0x89e4('0x1f')],_0x592e6c[_0x89e4('0x51')]));queues[_0x592e6c[_0x89e4('0x53')]][_0x89e4('0xf')]=_0x592e6c[_0x89e4('0x51')];}}}}catch(_0x4fcd65){utils[_0x89e4('0x16')](util[_0x89e4('0x3')]('[%s][queues][attendedtransfer]',_0x592e6c['origtransfereruniqueid']),_0x4fcd65);}};exports[_0x89e4('0x66')]=function(_0x18d640){try{if(!_[_0x89e4('0x18')](queues[_0x18d640[_0x89e4('0x5')]])){utils['debug'](util['format'](_0x89e4('0x67'),_0x18d640[_0x89e4('0x5')]),_0x18d640);queues[_0x18d640[_0x89e4('0x5')]]['musiconholdstartAt']=utils[_0x89e4('0x15')]();utils[_0x89e4('0x2')](util[_0x89e4('0x3')](_0x89e4('0x68'),_0x18d640[_0x89e4('0x5')],queues[_0x18d640[_0x89e4('0x5')]][_0x89e4('0x1f')],queues[_0x18d640[_0x89e4('0x5')]][_0x89e4('0x69')]));}}catch(_0x3844c4){utils[_0x89e4('0x16')](util['format']('[%s][queues][musiconholdstart]',_0x18d640[_0x89e4('0x5')]),_0x3844c4);}};exports[_0x89e4('0x6a')]=function(_0x200292){try{if(!_[_0x89e4('0x18')](queues[_0x200292[_0x89e4('0x5')]])){if(!_[_0x89e4('0x18')](queues[_0x200292[_0x89e4('0x5')]]['musiconholdstartAt'])){utils[_0x89e4('0x11')](util['format']('[%s][queues][musiconholdstop]',_0x200292['uniqueid']),_0x200292);queues[_0x200292[_0x89e4('0x5')]]['mohtime']+=utils[_0x89e4('0x38')](utils[_0x89e4('0x15')](),queues[_0x200292[_0x89e4('0x5')]][_0x89e4('0x69')]);utils[_0x89e4('0x2')](util['format'](_0x89e4('0x6b'),_0x200292[_0x89e4('0x5')],queues[_0x200292[_0x89e4('0x5')]][_0x89e4('0x1f')],queues[_0x200292['uniqueid']][_0x89e4('0x64')]));delete queues[_0x200292[_0x89e4('0x5')]]['musiconholdstartAt'];}}}catch(_0x1c1f36){utils['error'](util['format'](_0x89e4('0x6c'),_0x200292['uniqueid']),_0x1c1f36);}}; \ No newline at end of file +var _0x6994=['COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferuniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','format','uniqueid','channel','queue','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER'];(function(_0x55d32a,_0xe1abef){var _0x24a4e4=function(_0x5a3145){while(--_0x5a3145){_0x55d32a['push'](_0x55d32a['shift']());}};_0x24a4e4(++_0xe1abef);}(_0x6994,0xf2));var _0x4699=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x6994[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x4699('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x107e2f){utils['info'](util[_0x4699('0x1')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x107e2f[_0x4699('0x2')],_0x107e2f[_0x4699('0x3')],_0x107e2f[_0x4699('0x4')],_0x107e2f['lastAssignedTo'],_0x107e2f[_0x4699('0x5')],_0x107e2f['accountcode'],_0x107e2f[_0x4699('0x6')]));if(_0x107e2f[_0x4699('0x4')]){utils[_0x4699('0x7')](_0x107e2f[_0x4699('0x4')])[_0x4699('0x8')](function(_0x342c26){if(_0x342c26){_0x107e2f[_0x4699('0x9')]=_0x342c26[_0x4699('0x9')];}utils[_0x4699('0xa')]('CreateVoiceQueueReport',_0x107e2f);});}else{utils[_0x4699('0xa')]('CreateVoiceQueueReport',_0x107e2f);}if(_0x107e2f[_0x4699('0xb')]){delete queues[_0x107e2f['transfereduniqueid']];}else{delete queues[_0x107e2f[_0x4699('0x2')]];}}exports[_0x4699('0xc')]=function(_0x306140){try{utils[_0x4699('0xd')](util[_0x4699('0x1')](_0x4699('0xe'),_0x306140['uniqueid']),_0x306140);utils[_0x4699('0xf')](util[_0x4699('0x1')](_0x4699('0x10'),_0x306140['uniqueid'],_0x306140[_0x4699('0x4')],_0x306140[_0x4699('0x11')]));queues[_0x306140[_0x4699('0x2')]]=_['assign'](_0x306140,{'originalposition':_0x306140[_0x4699('0x11')],'queuecallerjoinAt':utils[_0x4699('0x12')](),'mohtime':0x0});}catch(_0x59fd77){utils[_0x4699('0x13')](util[_0x4699('0x1')](_0x4699('0xe'),_0x306140['uniqueid']),_0x59fd77);}};exports['hangup']=function(_0x15feba){try{if(!_[_0x4699('0x14')](queues[_0x15feba[_0x4699('0x2')]])){utils['debug'](util[_0x4699('0x1')](_0x4699('0x15'),_0x15feba[_0x4699('0x2')]),_0x15feba);if(queues[_0x15feba['uniqueid']][_0x4699('0x16')]){if(!queues[_0x15feba['uniqueid']][_0x4699('0x17')]&&!queues[_0x15feba[_0x4699('0x2')]][_0x4699('0x18')]){queues[_0x15feba['uniqueid']][_0x4699('0x19')]=!![];queues[_0x15feba['uniqueid']][_0x4699('0x1a')]=utils[_0x4699('0x12')]();queues[_0x15feba[_0x4699('0x2')]][_0x4699('0x6')]=_0x4699('0x1b');}utils[_0x4699('0xf')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x15feba[_0x4699('0x2')],queues[_0x15feba[_0x4699('0x2')]]['name'],queues[_0x15feba[_0x4699('0x2')]][_0x4699('0x6')]));writeDB(queues[_0x15feba['uniqueid']]);}else if(queues[_0x15feba[_0x4699('0x2')]][_0x4699('0xb')]){utils[_0x4699('0xf')](util[_0x4699('0x1')](_0x4699('0x1c'),_0x15feba[_0x4699('0x2')],queues[_0x15feba[_0x4699('0x2')]]['name'],queues[_0x15feba[_0x4699('0x2')]][_0x4699('0xb')]));queues[queues[_0x15feba[_0x4699('0x2')]][_0x4699('0xb')]]=queues[_0x15feba[_0x4699('0x2')]];queues[queues[_0x15feba['uniqueid']][_0x4699('0xb')]][_0x4699('0x1d')]=0x2;delete queues[_0x15feba['uniqueid']];}}}catch(_0x3e12e3){utils[_0x4699('0x13')](util[_0x4699('0x1')](_0x4699('0x15'),_0x15feba[_0x4699('0x2')]),_0x3e12e3);}};exports[_0x4699('0x1e')]=function(_0x8b1d4f){try{utils[_0x4699('0xd')](util['format'](_0x4699('0x1f'),_0x8b1d4f['uniqueid']),_0x8b1d4f);if(!_[_0x4699('0x14')](_0x8b1d4f[_0x4699('0x20')][_0x4699('0x21')])&&_0x8b1d4f[_0x4699('0x22')][_0x4699('0x23')]()!==_0x4699('0x24')){if(!_[_0x4699('0x14')](queues[_0x8b1d4f['uniqueid']])){queues[_0x8b1d4f[_0x4699('0x2')]]['queuecallerabandon']=![];queues[_0x8b1d4f[_0x4699('0x2')]][_0x4699('0x25')]=null;queues[_0x8b1d4f[_0x4699('0x2')]][_0x4699('0x18')]=!![];queues[_0x8b1d4f['uniqueid']][_0x4699('0x26')]=utils['now']();queues[_0x8b1d4f[_0x4699('0x2')]][_0x4699('0x6')]=_0x8b1d4f[_0x4699('0x22')]['toUpperCase']();utils[_0x4699('0xf')](util[_0x4699('0x1')](_0x4699('0x27'),_0x8b1d4f[_0x4699('0x2')],queues[_0x8b1d4f[_0x4699('0x2')]][_0x4699('0x28')],_0x8b1d4f[_0x4699('0x22')],queues[_0x8b1d4f['uniqueid']][_0x4699('0x6')]));writeDB(queues[_0x8b1d4f[_0x4699('0x2')]]);}}else if(!_[_0x4699('0x14')](_0x8b1d4f['variable'][_0x4699('0x29')])){if(!_[_0x4699('0x14')](queues[_0x8b1d4f[_0x4699('0x2')]])&&!queues[_0x8b1d4f[_0x4699('0x2')]]['queuecallerabandon']){queues[_0x8b1d4f['uniqueid']]['queuecallerabandon']=![];queues[_0x8b1d4f['uniqueid']][_0x4699('0x25')]=null;queues[_0x8b1d4f[_0x4699('0x2')]][_0x4699('0x18')]=!![];queues[_0x8b1d4f['uniqueid']][_0x4699('0x26')]=utils['now']();queues[_0x8b1d4f[_0x4699('0x2')]][_0x4699('0x6')]=_0x4699('0x2a');utils[_0x4699('0xf')](util[_0x4699('0x1')](_0x4699('0x2b'),_0x8b1d4f[_0x4699('0x2')],queues[_0x8b1d4f[_0x4699('0x2')]][_0x4699('0x28')],_0x8b1d4f[_0x4699('0x22')],queues[_0x8b1d4f[_0x4699('0x2')]][_0x4699('0x6')]));}}}catch(_0x41325b){utils[_0x4699('0x13')](util[_0x4699('0x1')](_0x4699('0x1f'),_0x8b1d4f[_0x4699('0x2')]),_0x41325b);}};exports['queuecallerabandon']=function(_0x52599b){try{if(!_[_0x4699('0x14')](queues[_0x52599b[_0x4699('0x2')]])){utils[_0x4699('0xd')](util['format'](_0x4699('0x2c'),_0x52599b[_0x4699('0x2')]),_0x52599b);queues[_0x52599b[_0x4699('0x2')]][_0x4699('0x18')]=![];queues[_0x52599b[_0x4699('0x2')]][_0x4699('0x26')]=null;queues[_0x52599b[_0x4699('0x2')]]['queuecallerabandon']=!![];queues[_0x52599b[_0x4699('0x2')]][_0x4699('0x25')]=utils[_0x4699('0x12')]();queues[_0x52599b['uniqueid']]['queuecallerexitreason']=_0x4699('0x2d');utils[_0x4699('0xf')](util[_0x4699('0x1')](_0x4699('0x2e'),_0x52599b['uniqueid'],queues[_0x52599b['uniqueid']]['name'],queues[_0x52599b[_0x4699('0x2')]][_0x4699('0x6')]));}}catch(_0x3f6a6a){utils[_0x4699('0x13')](util[_0x4699('0x1')](_0x4699('0x2c'),_0x52599b[_0x4699('0x2')]),_0x3f6a6a);}};exports['queuecallerleave']=function(_0x5e94af){try{if(!_[_0x4699('0x14')](queues[_0x5e94af[_0x4699('0x2')]])){utils['debug'](util[_0x4699('0x1')](_0x4699('0x2f'),_0x5e94af[_0x4699('0x2')]),_0x5e94af);utils['info'](util[_0x4699('0x1')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5e94af['uniqueid'],queues[_0x5e94af[_0x4699('0x2')]][_0x4699('0x28')],_0x5e94af['connectedlinenum'],_0x5e94af['connectedlinename']));queues[_0x5e94af['uniqueid']][_0x4699('0x30')]=!![];queues[_0x5e94af[_0x4699('0x2')]][_0x4699('0x16')]=utils[_0x4699('0x12')]();queues[_0x5e94af[_0x4699('0x2')]][_0x4699('0x31')]=utils['diffTime'](queues[_0x5e94af['uniqueid']][_0x4699('0x16')],queues[_0x5e94af[_0x4699('0x2')]][_0x4699('0x32')]);queues[_0x5e94af[_0x4699('0x2')]][_0x4699('0x11')]=_0x5e94af[_0x4699('0x11')];queues[_0x5e94af['uniqueid']][_0x4699('0x33')]=_0x5e94af[_0x4699('0x33')];queues[_0x5e94af[_0x4699('0x2')]][_0x4699('0x34')]=_0x5e94af[_0x4699('0x34')];queues[_0x5e94af['uniqueid']]['connectedlinename']=_0x5e94af[_0x4699('0x35')];}}catch(_0x5441b3){utils['error'](util[_0x4699('0x1')]('[%s][queues][queuecallerleave]',_0x5e94af[_0x4699('0x2')]),_0x5441b3);}};exports[_0x4699('0x36')]=function(_0xc4a82f){try{if(!_[_0x4699('0x14')](queues[_0xc4a82f[_0x4699('0x2')]])){utils['debug'](util[_0x4699('0x1')](_0x4699('0x37'),_0xc4a82f[_0x4699('0x2')]),_0xc4a82f);utils[_0x4699('0xf')](util[_0x4699('0x1')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0xc4a82f[_0x4699('0x2')],queues[_0xc4a82f[_0x4699('0x2')]][_0x4699('0x28')],_0xc4a82f[_0x4699('0x38')],_0xc4a82f[_0x4699('0x39')]));queues[_0xc4a82f['uniqueid']]['queuecallerabandon']=![];queues[_0xc4a82f[_0x4699('0x2')]]['queuecallerabandon']=![];queues[_0xc4a82f['uniqueid']][_0x4699('0x25')]=null;queues[_0xc4a82f[_0x4699('0x2')]][_0x4699('0x18')]=![];queues[_0xc4a82f['uniqueid']][_0x4699('0x6')]=null;queues[_0xc4a82f['uniqueid']][_0x4699('0x26')]=null;queues[_0xc4a82f[_0x4699('0x2')]]['assigned']=!![];queues[_0xc4a82f[_0x4699('0x2')]]['accountcode']=_0xc4a82f[_0x4699('0x39')];queues[_0xc4a82f['uniqueid']][_0x4699('0x3a')]=_0xc4a82f['membername'];}}catch(_0x2fbb8e){utils['error'](util['format'](_0x4699('0x37'),_0xc4a82f[_0x4699('0x2')]),_0x2fbb8e);}};exports[_0x4699('0x3b')]=function(_0x2dfa2b){try{if(!_['isNil'](queues[_0x2dfa2b[_0x4699('0x2')]])){if(queues[_0x2dfa2b[_0x4699('0x2')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0x4699('0x3c'),_0x2dfa2b[_0x4699('0x2')]),_0x2dfa2b);queues[_0x2dfa2b[_0x4699('0x2')]][_0x4699('0x17')]=![];queues[_0x2dfa2b[_0x4699('0x2')]][_0x4699('0x17')]=![];queues[_0x2dfa2b[_0x4699('0x2')]][_0x4699('0x25')]=null;queues[_0x2dfa2b[_0x4699('0x2')]][_0x4699('0x18')]=![];queues[_0x2dfa2b[_0x4699('0x2')]][_0x4699('0x26')]=null;queues[_0x2dfa2b['uniqueid']][_0x4699('0x3d')]=!![];queues[_0x2dfa2b[_0x4699('0x2')]]['lastAssignedTo']=_0x2dfa2b[_0x4699('0x38')];queues[_0x2dfa2b[_0x4699('0x2')]][_0x4699('0x19')]=!![];queues[_0x2dfa2b['uniqueid']]['queuecallercompleteAt']=utils[_0x4699('0x12')]();if(_0x2dfa2b['reason']==_0x4699('0x3e')){if(!queues[_0x2dfa2b['uniqueid']]['transfer']){queues[_0x2dfa2b[_0x4699('0x2')]][_0x4699('0x6')]=_0x4699('0x3f');}}else{queues[_0x2dfa2b[_0x4699('0x2')]][_0x4699('0x6')]=_0x4699('0x40')+_0x2dfa2b[_0x4699('0x41')][_0x4699('0x23')]();}utils[_0x4699('0xf')](util['format'](_0x4699('0x42'),_0x2dfa2b[_0x4699('0x2')],queues[_0x2dfa2b['uniqueid']][_0x4699('0x28')],_0x2dfa2b[_0x4699('0x38')],queues[_0x2dfa2b['uniqueid']][_0x4699('0x6')]));writeDB(queues[_0x2dfa2b[_0x4699('0x2')]]);}}}catch(_0x27e992){utils[_0x4699('0x13')](util[_0x4699('0x1')](_0x4699('0x3c'),_0x2dfa2b[_0x4699('0x2')]),_0x27e992);}};exports['blindtransfer']=function(_0x1e3903){try{if(!_['isNil'](queues[_0x1e3903[_0x4699('0x43')]])){utils['debug'](util[_0x4699('0x1')]('[%s][queues][blindtransfer]',_0x1e3903['uniqueid']),_0x1e3903);queues[_0x1e3903[_0x4699('0x43')]][_0x4699('0x3e')]=!![];queues[_0x1e3903[_0x4699('0x43')]][_0x4699('0x44')]=_0x4699('0x45');queues[_0x1e3903[_0x4699('0x43')]]['transferexten']=_0x1e3903[_0x4699('0x46')];queues[_0x1e3903[_0x4699('0x43')]]['transferuniqueid']=_0x1e3903[_0x4699('0x43')];queues[_0x1e3903[_0x4699('0x43')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x4699('0xf')](util[_0x4699('0x1')](_0x4699('0x47'),_0x1e3903[_0x4699('0x2')],queues[_0x1e3903[_0x4699('0x43')]][_0x4699('0x28')],_0x1e3903[_0x4699('0x43')],_0x1e3903['extension']));}}catch(_0x379511){utils[_0x4699('0x13')](util['format'](_0x4699('0x48'),_0x1e3903['uniqueid']),_0x379511);}};exports[_0x4699('0x49')]=function(_0x341b5f){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x341b5f[_0x4699('0x4a')]),_0x341b5f);if(_0x341b5f['origtransfereruniqueid']==_0x341b5f['origtransfererlinkedid']){if(!_[_0x4699('0x14')](queues[_0x341b5f[_0x4699('0x4b')]])){utils[_0x4699('0xf')](util['format'](_0x4699('0x4c'),_0x341b5f[_0x4699('0x4a')],queues[_0x341b5f[_0x4699('0x4b')]][_0x4699('0x28')],_0x341b5f[_0x4699('0x4d')]));queues[_0x341b5f[_0x4699('0x4b')]][_0x4699('0x3e')]=!![];queues[_0x341b5f[_0x4699('0x4b')]]['transfertype']=_0x4699('0x4e');queues[_0x341b5f[_0x4699('0x4b')]][_0x4699('0x4f')]=_0x341b5f[_0x4699('0x4d')];queues[_0x341b5f[_0x4699('0x4b')]]['transferuniqueid']=_0x341b5f['origtransfereruniqueid'];queues[_0x341b5f[_0x4699('0x4b')]][_0x4699('0x6')]=_0x4699('0x50');}if(!_[_0x4699('0x14')](queues[_0x341b5f[_0x4699('0x51')]])){if(_0x341b5f[_0x4699('0x52')]&&queues[_0x341b5f['transfereelinkedid']]){queues[_0x341b5f['transfereelinkedid']][_0x4699('0x1d')]=0x1;queues[_0x341b5f[_0x4699('0x43')]]=_['clone'](queues[_0x341b5f[_0x4699('0x52')]]);queues[_0x341b5f[_0x4699('0x43')]][_0x4699('0xb')]=_0x341b5f[_0x4699('0x53')];queues[_0x341b5f['transfereeuniqueid']][_0x4699('0x1d')]=0x2;queues[_0x341b5f[_0x4699('0x43')]]['calleridnum']=queues[_0x341b5f[_0x4699('0x4b')]][_0x4699('0x5')];queues[_0x341b5f[_0x4699('0x43')]]['calleridname']=queues[_0x341b5f[_0x4699('0x4b')]][_0x4699('0x54')];queues[_0x341b5f[_0x4699('0x43')]][_0x4699('0x32')]=utils[_0x4699('0x12')]();queues[_0x341b5f[_0x4699('0x43')]][_0x4699('0x16')]=utils[_0x4699('0x12')]();queues[_0x341b5f[_0x4699('0x43')]]['holdtime']=0x0;queues[_0x341b5f[_0x4699('0x43')]][_0x4699('0x55')]=0x0;utils['info'](util[_0x4699('0x1')](_0x4699('0x56'),_0x341b5f['origtransfereruniqueid'],queues[_0x341b5f[_0x4699('0x43')]][_0x4699('0x28')],queues[_0x341b5f[_0x4699('0x43')]][_0x4699('0x5')],queues[_0x341b5f[_0x4699('0x43')]]['calleridname']));}else{utils[_0x4699('0xf')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x341b5f[_0x4699('0x4a')],queues[_0x341b5f['origtransfererlinkedid']]['name'],_0x341b5f[_0x4699('0x4b')]));queues[_0x341b5f[_0x4699('0x51')]]['transfereduniqueid']=_0x341b5f['secondtransfererlinkedid'];}}}else if(_0x341b5f[_0x4699('0x57')]==_0x341b5f[_0x4699('0x4b')]){if(!_[_0x4699('0x14')](queues[_0x341b5f[_0x4699('0x51')]])){utils[_0x4699('0xf')](util[_0x4699('0x1')](_0x4699('0x58'),_0x341b5f[_0x4699('0x4a')],queues[_0x341b5f[_0x4699('0x51')]][_0x4699('0x28')],_0x341b5f[_0x4699('0x57')],_0x341b5f[_0x4699('0x59')]));queues[_0x341b5f['origtransfererlinkedid']][_0x4699('0x3e')]=!![];queues[_0x341b5f[_0x4699('0x51')]][_0x4699('0x44')]=_0x4699('0x4e');queues[_0x341b5f[_0x4699('0x51')]][_0x4699('0x4f')]=_0x341b5f['secondtransfererexten'];queues[_0x341b5f[_0x4699('0x51')]][_0x4699('0x5a')]=_0x341b5f[_0x4699('0x57')];queues[_0x341b5f[_0x4699('0x51')]][_0x4699('0x6')]=_0x4699('0x50');}if(!_['isNil'](queues[_0x341b5f[_0x4699('0x4b')]])){if(_0x341b5f[_0x4699('0x5b')]&&queues[_0x341b5f[_0x4699('0x5b')]]){queues[_0x341b5f[_0x4699('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x341b5f[_0x4699('0x53')]]=_['clone'](queues[_0x341b5f['transfertargetlinkedid']]);queues[_0x341b5f[_0x4699('0x53')]][_0x4699('0xb')]=_0x341b5f[_0x4699('0x53')];queues[_0x341b5f[_0x4699('0x53')]]['queuecallerenterreason']=0x2;queues[_0x341b5f['transfertargetuniqueid']][_0x4699('0x5')]=queues[_0x341b5f['origtransfererlinkedid']]['calleridnum'];queues[_0x341b5f[_0x4699('0x53')]][_0x4699('0x54')]=queues[_0x341b5f[_0x4699('0x51')]][_0x4699('0x54')];queues[_0x341b5f['transfertargetuniqueid']][_0x4699('0x32')]=utils[_0x4699('0x12')]();queues[_0x341b5f[_0x4699('0x53')]][_0x4699('0x16')]=utils[_0x4699('0x12')]();queues[_0x341b5f['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x341b5f['transfertargetuniqueid']]['mohtime']=0x0;utils['info'](util[_0x4699('0x1')](_0x4699('0x5c'),_0x341b5f[_0x4699('0x4a')],queues[_0x341b5f[_0x4699('0x53')]]['name'],queues[_0x341b5f[_0x4699('0x53')]][_0x4699('0xb')],queues[_0x341b5f['transfertargetuniqueid']]['calleridnum'],queues[_0x341b5f[_0x4699('0x53')]]['calleridname']));}else{utils[_0x4699('0xf')](util['format'](_0x4699('0x5d'),_0x341b5f[_0x4699('0x4a')],queues[_0x341b5f[_0x4699('0x4b')]][_0x4699('0x28')],_0x341b5f[_0x4699('0x51')]));queues[_0x341b5f['secondtransfererlinkedid']][_0x4699('0xb')]=_0x341b5f[_0x4699('0x51')];}}}}catch(_0x246c25){utils[_0x4699('0x13')](util['format'](_0x4699('0x5e'),_0x341b5f[_0x4699('0x4a')]),_0x246c25);}};exports[_0x4699('0x5f')]=function(_0x37f8da){try{if(!_[_0x4699('0x14')](queues[_0x37f8da[_0x4699('0x2')]])){utils[_0x4699('0xd')](util[_0x4699('0x1')](_0x4699('0x60'),_0x37f8da[_0x4699('0x2')]),_0x37f8da);queues[_0x37f8da[_0x4699('0x2')]]['musiconholdstartAt']=utils[_0x4699('0x12')]();utils[_0x4699('0xf')](util['format'](_0x4699('0x61'),_0x37f8da['uniqueid'],queues[_0x37f8da[_0x4699('0x2')]]['name'],queues[_0x37f8da[_0x4699('0x2')]][_0x4699('0x62')]));}}catch(_0x34febb){utils[_0x4699('0x13')](util[_0x4699('0x1')](_0x4699('0x60'),_0x37f8da[_0x4699('0x2')]),_0x34febb);}};exports['musiconholdstop']=function(_0x3f8696){try{if(!_[_0x4699('0x14')](queues[_0x3f8696[_0x4699('0x2')]])){if(!_['isNil'](queues[_0x3f8696['uniqueid']][_0x4699('0x62')])){utils[_0x4699('0xd')](util[_0x4699('0x1')](_0x4699('0x63'),_0x3f8696[_0x4699('0x2')]),_0x3f8696);queues[_0x3f8696[_0x4699('0x2')]][_0x4699('0x55')]+=utils[_0x4699('0x64')](utils['now'](),queues[_0x3f8696['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0x4699('0x1')](_0x4699('0x65'),_0x3f8696[_0x4699('0x2')],queues[_0x3f8696[_0x4699('0x2')]][_0x4699('0x28')],queues[_0x3f8696[_0x4699('0x2')]]['mohtime']));delete queues[_0x3f8696[_0x4699('0x2')]][_0x4699('0x62')];}}}catch(_0x1d5379){utils['error'](util[_0x4699('0x1')](_0x4699('0x63'),_0x3f8696[_0x4699('0x2')]),_0x1d5379);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c420a00..b2af611 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 _0xc9ba=['uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','context','exten','channel','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','find','monitors','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','util','info'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xc9ba,0xe6));var _0xac9b=function(_0x4057f9,_0x17c5b5){_0x4057f9=_0x4057f9-0x0;var _0x5552b7=_0xc9ba[_0x4057f9];return _0x5552b7;};'use strict';var _=require('lodash');var util=require(_0xac9b('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x42ce68){utils[_0xac9b('0x1')](util['format']('[%s][recordings][writeDB]',_0x42ce68[_0xac9b('0x2')]));if(_0x42ce68[_0xac9b('0x3')]){utils[_0xac9b('0x4')](_0x42ce68[_0xac9b('0x3')])[_0xac9b('0x5')](function(_0x1df78f){if(_0x1df78f){_0x42ce68[_0xac9b('0x6')]=_0x1df78f['name'];_0x42ce68[_0xac9b('0x7')]=_0x1df78f['id'];}utils[_0xac9b('0x8')](_0xac9b('0x9'),_0x42ce68);});}else{utils[_0xac9b('0x8')](_0xac9b('0x9'),_0x42ce68);}}exports[_0xac9b('0xa')]=function(_0x198fcb){try{utils[_0xac9b('0xb')](util[_0xac9b('0xc')](_0xac9b('0xd'),_0x198fcb[_0xac9b('0x2')]),_0x198fcb);if(_0x198fcb[_0xac9b('0x2')]==_0x198fcb[_0xac9b('0xe')]){utils[_0xac9b('0x1')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x198fcb[_0xac9b('0x2')],_0x198fcb[_0xac9b('0xf')],_0x198fcb[_0xac9b('0x10')]));recordings[_0x198fcb['uniqueid']]={'uniqueid':_0x198fcb[_0xac9b('0x2')],'accountcode':_0x198fcb[_0xac9b('0x3')],'exten':_0x198fcb['exten'],'context':_0x198fcb['context'],'channel':_0x198fcb[_0xac9b('0x11')],'monitors':[]};}}catch(_0x23d99c){utils['error'](util[_0xac9b('0xc')]('[%s][recordings][newchannel]',_0x198fcb[_0xac9b('0x2')]),_0x23d99c);}};exports['newstate']=function(_0x4a0b92){try{utils[_0xac9b('0xb')](util[_0xac9b('0xc')](_0xac9b('0x12'),_0x4a0b92['uniqueid']),_0x4a0b92);if(!_[_0xac9b('0x13')](recordings[_0x4a0b92['uniqueid']])&&_0x4a0b92[_0xac9b('0x14')]==0x6){utils['info'](util[_0xac9b('0xc')](_0xac9b('0x15'),_0x4a0b92[_0xac9b('0x2')],_0x4a0b92['context'],_0x4a0b92[_0xac9b('0x11')]));}else if(!_[_0xac9b('0x13')](recordings[_0x4a0b92[_0xac9b('0xe')]])&&_0x4a0b92[_0xac9b('0x14')]==0x6&&_0x4a0b92['context']!='transfer'){utils['info'](util[_0xac9b('0xc')](_0xac9b('0x16'),_0x4a0b92[_0xac9b('0x2')],_0x4a0b92[_0xac9b('0xe')],_0x4a0b92[_0xac9b('0xf')],_0x4a0b92[_0xac9b('0x11')]));recordings[_0x4a0b92[_0xac9b('0xe')]][_0xac9b('0x3')]=_0x4a0b92[_0xac9b('0x3')];}}catch(_0x2d4a1c){utils[_0xac9b('0x17')](util[_0xac9b('0xc')]('[%s][recordings][newstate]',_0x4a0b92[_0xac9b('0x2')]),_0x2d4a1c);}};exports[_0xac9b('0x18')]=function(_0x12d1af){try{if(!_[_0xac9b('0x13')](_0x12d1af['variable'])&&!_[_0xac9b('0x13')](_0x12d1af[_0xac9b('0x19')][_0xac9b('0x1a')])){utils['debug'](util['format'](_0xac9b('0x1b'),_0x12d1af[_0xac9b('0x2')]),_0x12d1af);utils['info'](util[_0xac9b('0xc')](_0xac9b('0x1c'),_0x12d1af[_0xac9b('0x2')],_0x12d1af[_0xac9b('0x19')],_0x12d1af[_0xac9b('0x1d')]));if(_['endsWith'](_0x12d1af['value'],'.wav49')){_0x12d1af[_0xac9b('0x1d')]=_0x12d1af[_0xac9b('0x1d')]['replace']('.wav49','.WAV');}if(recordings[_0x12d1af[_0xac9b('0xe')]]){var _0xb41aeb=_[_0xac9b('0x1e')](recordings[_0x12d1af[_0xac9b('0xe')]]['monitors'],{'value':_0x12d1af[_0xac9b('0x1d')]});if(_[_0xac9b('0x13')](_0xb41aeb)){recordings[_0x12d1af['linkedid']][_0xac9b('0x1f')]['push']({'value':_0x12d1af['value']});}}}}catch(_0x4172aa){utils[_0xac9b('0x17')](util[_0xac9b('0xc')]('[%s][recordings][varset]',_0x12d1af[_0xac9b('0x2')]),_0x4172aa);}};exports['hangup']=function(_0x53223d){try{if(!_[_0xac9b('0x13')](recordings[_0x53223d[_0xac9b('0x2')]])){utils['debug'](util[_0xac9b('0xc')]('[%s][recordings][hangup]',_0x53223d['uniqueid']),_0x53223d);utils[_0xac9b('0x1')](util[_0xac9b('0xc')](_0xac9b('0x20'),_0x53223d['uniqueid'],_0x53223d[_0xac9b('0x21')],_0x53223d[_0xac9b('0x22')],_0x53223d[_0xac9b('0x23')]));recordings[_0x53223d[_0xac9b('0x2')]][_0xac9b('0x21')]=_0x53223d[_0xac9b('0x21')];recordings[_0x53223d[_0xac9b('0x2')]][_0xac9b('0x22')]=_0x53223d[_0xac9b('0x22')];recordings[_0x53223d[_0xac9b('0x2')]][_0xac9b('0x24')]=_0x53223d[_0xac9b('0x24')];recordings[_0x53223d['uniqueid']][_0xac9b('0x25')]=_0x53223d[_0xac9b('0x25')];if(recordings[_0x53223d[_0xac9b('0x2')]][_0xac9b('0x26')]==_0xac9b('0x27')&&recordings[_0x53223d[_0xac9b('0x2')]][_0xac9b('0x3')]){recordings[_0x53223d[_0xac9b('0x2')]][_0xac9b('0x24')]=recordings[_0x53223d['uniqueid']]['accountcode'];recordings[_0x53223d[_0xac9b('0x2')]][_0xac9b('0x25')]='';}recordings[_0x53223d[_0xac9b('0x2')]][_0xac9b('0x1f')][_0xac9b('0x28')](function(_0x5da84e){var _0x37f046=_[_0xac9b('0x29')](recordings[_0x53223d[_0xac9b('0x2')]]);_0x37f046[_0xac9b('0x1d')]=_0x5da84e['value'];writeDB(_0x37f046);});delete recordings[_0x53223d['uniqueid']];}}catch(_0x435ce2){utils[_0xac9b('0x17')](util['format'](_0xac9b('0x2a'),_0x53223d['uniqueid']),_0x435ce2);}};exports[_0xac9b('0x2b')]=function(_0x555aae){try{if(!_[_0xac9b('0x13')](recordings[_0x555aae['uniqueid']])){utils[_0xac9b('0xb')](util['format'](_0xac9b('0x2c'),_0x555aae['uniqueid']),_0x555aae);utils['info'](util['format'](_0xac9b('0x2d'),_0x555aae[_0xac9b('0x2')],_0x555aae[_0xac9b('0x2e')],_0x555aae[_0xac9b('0x2f')]));if(_0x555aae['application'][_0xac9b('0x30')]()==_0xac9b('0x31')&&_[_0xac9b('0x32')](_0x555aae[_0xac9b('0x2f')]['toLowerCase'](),_0xac9b('0x33'))){var _0x461d6a=_0x555aae[_0xac9b('0x2f')][_0xac9b('0x34')]('=');var _0x3c5a88=_0x461d6a[0x0][_0xac9b('0x35')](_0x461d6a[0x0][_0xac9b('0x36')]('(')+0x1,_0x461d6a[0x0][_0xac9b('0x36')](')'));var _0x42d707=_0x461d6a[0x1];recordings[_0x555aae[_0xac9b('0x2')]][_0x3c5a88]=_0x42d707;}}}catch(_0x3f5460){utils[_0xac9b('0x17')](util[_0xac9b('0xc')]('[%s][recordings][newexten]',_0x555aae[_0xac9b('0x2')]),_0x3f5460);}};exports[_0xac9b('0x37')]=function(_0x1cc265){try{if(!_[_0xac9b('0x13')](recordings[_0x1cc265['uniqueid']])){utils[_0xac9b('0xb')](util[_0xac9b('0xc')](_0xac9b('0x38'),_0x1cc265[_0xac9b('0x2')]),_0x1cc265);utils[_0xac9b('0x1')](util[_0xac9b('0xc')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x1cc265[_0xac9b('0x2')],_0x1cc265['queue']));recordings[_0x1cc265['uniqueid']][_0xac9b('0x39')]=_0x1cc265[_0xac9b('0x39')];}}catch(_0x31d7c2){utils[_0xac9b('0x17')](util[_0xac9b('0xc')](_0xac9b('0x38'),_0x1cc265[_0xac9b('0x2')]),_0x31d7c2);}}; \ No newline at end of file +var _0x3683=['[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','./utils','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x3683,0xa5));var _0x3368=function(_0x1ffda8,_0xe5f682){_0x1ffda8=_0x1ffda8-0x0;var _0x1989c1=_0x3683[_0x1ffda8];return _0x1989c1;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x3368('0x0'));var recordings={};function writeDB(_0x4c6079){utils['info'](util[_0x3368('0x1')](_0x3368('0x2'),_0x4c6079[_0x3368('0x3')]));if(_0x4c6079['accountcode']){utils[_0x3368('0x4')](_0x4c6079[_0x3368('0x5')])[_0x3368('0x6')](function(_0x4ec036){if(_0x4ec036){_0x4c6079[_0x3368('0x7')]=_0x4ec036[_0x3368('0x8')];_0x4c6079[_0x3368('0x9')]=_0x4ec036['id'];}utils[_0x3368('0xa')](_0x3368('0xb'),_0x4c6079);});}else{utils['request'](_0x3368('0xb'),_0x4c6079);}}exports[_0x3368('0xc')]=function(_0x4892d3){try{utils[_0x3368('0xd')](util['format'](_0x3368('0xe'),_0x4892d3[_0x3368('0x3')]),_0x4892d3);if(_0x4892d3[_0x3368('0x3')]==_0x4892d3[_0x3368('0xf')]){utils[_0x3368('0x10')](util['format'](_0x3368('0x11'),_0x4892d3['uniqueid'],_0x4892d3['context'],_0x4892d3[_0x3368('0x12')]));recordings[_0x4892d3[_0x3368('0x3')]]={'uniqueid':_0x4892d3['uniqueid'],'accountcode':_0x4892d3[_0x3368('0x5')],'exten':_0x4892d3['exten'],'context':_0x4892d3[_0x3368('0x13')],'channel':_0x4892d3[_0x3368('0x14')],'monitors':[]};}}catch(_0x203835){utils[_0x3368('0x15')](util['format'](_0x3368('0xe'),_0x4892d3['uniqueid']),_0x203835);}};exports[_0x3368('0x16')]=function(_0x14f0b9){try{utils[_0x3368('0xd')](util[_0x3368('0x1')](_0x3368('0x17'),_0x14f0b9[_0x3368('0x3')]),_0x14f0b9);if(!_['isNil'](recordings[_0x14f0b9['uniqueid']])&&_0x14f0b9['channelstate']==0x6){utils[_0x3368('0x10')](util[_0x3368('0x1')](_0x3368('0x18'),_0x14f0b9[_0x3368('0x3')],_0x14f0b9[_0x3368('0x13')],_0x14f0b9[_0x3368('0x14')]));}else if(!_[_0x3368('0x19')](recordings[_0x14f0b9['linkedid']])&&_0x14f0b9['channelstate']==0x6&&_0x14f0b9['context']!=_0x3368('0x1a')){utils[_0x3368('0x10')](util[_0x3368('0x1')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x14f0b9['uniqueid'],_0x14f0b9[_0x3368('0xf')],_0x14f0b9['context'],_0x14f0b9[_0x3368('0x14')]));recordings[_0x14f0b9[_0x3368('0xf')]][_0x3368('0x5')]=_0x14f0b9[_0x3368('0x5')];}}catch(_0x3a9ebe){utils['error'](util[_0x3368('0x1')]('[%s][recordings][newstate]',_0x14f0b9[_0x3368('0x3')]),_0x3a9ebe);}};exports[_0x3368('0x1b')]=function(_0x37884b){try{if(!_[_0x3368('0x19')](_0x37884b[_0x3368('0x1c')])&&!_[_0x3368('0x19')](_0x37884b['variable']['mixmonitor_filename'])){utils[_0x3368('0xd')](util[_0x3368('0x1')](_0x3368('0x1d'),_0x37884b[_0x3368('0x3')]),_0x37884b);utils[_0x3368('0x10')](util[_0x3368('0x1')](_0x3368('0x1e'),_0x37884b['uniqueid'],_0x37884b[_0x3368('0x1c')],_0x37884b[_0x3368('0x1f')]));if(_[_0x3368('0x20')](_0x37884b[_0x3368('0x1f')],_0x3368('0x21'))){_0x37884b[_0x3368('0x1f')]=_0x37884b[_0x3368('0x1f')][_0x3368('0x22')](_0x3368('0x21'),_0x3368('0x23'));}if(recordings[_0x37884b[_0x3368('0xf')]]){var _0x3fb1c4=_[_0x3368('0x24')](recordings[_0x37884b['linkedid']][_0x3368('0x25')],{'value':_0x37884b[_0x3368('0x1f')]});if(_['isNil'](_0x3fb1c4)){recordings[_0x37884b[_0x3368('0xf')]][_0x3368('0x25')][_0x3368('0x26')]({'value':_0x37884b[_0x3368('0x1f')]});}}}}catch(_0x1e307f){utils[_0x3368('0x15')](util[_0x3368('0x1')]('[%s][recordings][varset]',_0x37884b[_0x3368('0x3')]),_0x1e307f);}};exports[_0x3368('0x27')]=function(_0x599e8f){try{if(!_[_0x3368('0x19')](recordings[_0x599e8f[_0x3368('0x3')]])){utils[_0x3368('0xd')](util['format'](_0x3368('0x28'),_0x599e8f[_0x3368('0x3')]),_0x599e8f);utils['info'](util[_0x3368('0x1')](_0x3368('0x29'),_0x599e8f[_0x3368('0x3')],_0x599e8f[_0x3368('0x2a')],_0x599e8f['calleridname'],_0x599e8f[_0x3368('0x2b')]));recordings[_0x599e8f['uniqueid']]['calleridnum']=_0x599e8f[_0x3368('0x2a')];recordings[_0x599e8f[_0x3368('0x3')]]['calleridname']=_0x599e8f[_0x3368('0x2c')];recordings[_0x599e8f[_0x3368('0x3')]][_0x3368('0x2d')]=_0x599e8f[_0x3368('0x2d')];recordings[_0x599e8f[_0x3368('0x3')]][_0x3368('0x2e')]=_0x599e8f[_0x3368('0x2e')];if(recordings[_0x599e8f[_0x3368('0x3')]][_0x3368('0x2f')]=='outbound'&&recordings[_0x599e8f[_0x3368('0x3')]]['accountcode']){recordings[_0x599e8f[_0x3368('0x3')]][_0x3368('0x2d')]=recordings[_0x599e8f[_0x3368('0x3')]][_0x3368('0x5')];recordings[_0x599e8f[_0x3368('0x3')]][_0x3368('0x2e')]='';}recordings[_0x599e8f[_0x3368('0x3')]][_0x3368('0x25')][_0x3368('0x30')](function(_0x48a299){var _0x48d3a7=_[_0x3368('0x31')](recordings[_0x599e8f[_0x3368('0x3')]]);_0x48d3a7['value']=_0x48a299[_0x3368('0x1f')];writeDB(_0x48d3a7);});delete recordings[_0x599e8f[_0x3368('0x3')]];}}catch(_0x60861c){utils[_0x3368('0x15')](util[_0x3368('0x1')](_0x3368('0x28'),_0x599e8f['uniqueid']),_0x60861c);}};exports[_0x3368('0x32')]=function(_0x2837cc){try{if(!_['isNil'](recordings[_0x2837cc[_0x3368('0x3')]])){utils[_0x3368('0xd')](util[_0x3368('0x1')](_0x3368('0x33'),_0x2837cc[_0x3368('0x3')]),_0x2837cc);utils['info'](util[_0x3368('0x1')](_0x3368('0x34'),_0x2837cc[_0x3368('0x3')],_0x2837cc['application'],_0x2837cc[_0x3368('0x35')]));if(_0x2837cc['application']['toLowerCase']()=='set'&&_['startsWith'](_0x2837cc['appdata'][_0x3368('0x36')](),_0x3368('0x37'))){var _0x28b3a4=_0x2837cc['appdata'][_0x3368('0x38')]('=');var _0x116830=_0x28b3a4[0x0][_0x3368('0x39')](_0x28b3a4[0x0][_0x3368('0x3a')]('(')+0x1,_0x28b3a4[0x0][_0x3368('0x3a')](')'));var _0x22a6ba=_0x28b3a4[0x1];recordings[_0x2837cc['uniqueid']][_0x116830]=_0x22a6ba;}}}catch(_0x551453){utils[_0x3368('0x15')](util[_0x3368('0x1')](_0x3368('0x33'),_0x2837cc['uniqueid']),_0x551453);}};exports[_0x3368('0x3b')]=function(_0x463fd7){try{if(!_[_0x3368('0x19')](recordings[_0x463fd7[_0x3368('0x3')]])){utils[_0x3368('0xd')](util[_0x3368('0x1')](_0x3368('0x3c'),_0x463fd7[_0x3368('0x3')]),_0x463fd7);utils[_0x3368('0x10')](util['format'](_0x3368('0x3d'),_0x463fd7['uniqueid'],_0x463fd7['queue']));recordings[_0x463fd7[_0x3368('0x3')]]['queue']=_0x463fd7[_0x3368('0x3e')];}}catch(_0x184368){utils[_0x3368('0x15')](util[_0x3368('0x1')](_0x3368('0x3c'),_0x463fd7[_0x3368('0x3')]),_0x184368);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 37c1a50..e8f6bd1 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 _0xd0ad=['origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','type','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','attended'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xd0ad,0xdb));var _0xdd0a=function(_0x23b146,_0x24958d){_0x23b146=_0x23b146-0x0;var _0x2bc2b1=_0xd0ad[_0x23b146];return _0x2bc2b1;};'use strict';var _=require(_0xdd0a('0x0'));var util=require(_0xdd0a('0x1'));var utils=require(_0xdd0a('0x2'));function writeDB(_0x1d1cb6){utils[_0xdd0a('0x3')](util[_0xdd0a('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x1d1cb6['type']===_0xdd0a('0x5')?_0x1d1cb6[_0xdd0a('0x6')]:_0x1d1cb6[_0xdd0a('0x7')],_0x1d1cb6['type']));utils[_0xdd0a('0x8')](_0xdd0a('0x9'),_0x1d1cb6);}exports[_0xdd0a('0xa')]={};exports[_0xdd0a('0xb')]=function(_0x52bfd6){try{utils[_0xdd0a('0xc')](util[_0xdd0a('0x4')]('[%s][transfers][blindtransfer]',_0x52bfd6[_0xdd0a('0x7')]),_0x52bfd6);utils[_0xdd0a('0x3')](util[_0xdd0a('0x4')](_0xdd0a('0xd'),_0x52bfd6['uniqueid'],_0x52bfd6[_0xdd0a('0xe')],_0x52bfd6[_0xdd0a('0xf')],_0x52bfd6[_0xdd0a('0x10')],_0x52bfd6['transfereecalleridname']));_0x52bfd6[_0xdd0a('0x11')]=_0xdd0a('0x12');exports[_0xdd0a('0xa')][_0x52bfd6['transfereruniqueid']]=_0x52bfd6;writeDB(_0x52bfd6);}catch(_0xda1fcb){utils[_0xdd0a('0x13')](util[_0xdd0a('0x4')]('[%s][transfers][blindtransfer]',_0x52bfd6[_0xdd0a('0x7')]),_0xda1fcb);}};exports[_0xdd0a('0x14')]=function(_0x8d45e1){try{utils[_0xdd0a('0xc')](util[_0xdd0a('0x4')](_0xdd0a('0x15'),_0x8d45e1[_0xdd0a('0x6')]),_0x8d45e1);utils[_0xdd0a('0x3')](util[_0xdd0a('0x4')](_0xdd0a('0x16'),_0x8d45e1[_0xdd0a('0x6')],_0x8d45e1[_0xdd0a('0x17')],_0x8d45e1['origtransferercalleridname'],_0x8d45e1['transfertargetcalleridnum'],_0x8d45e1[_0xdd0a('0x18')]));_0x8d45e1=_[_0xdd0a('0x19')](_0x8d45e1,{'transfererchannel':_0x8d45e1[_0xdd0a('0x1a')],'transferercalleridnum':_0x8d45e1[_0xdd0a('0x17')],'transferercalleridname':_0x8d45e1[_0xdd0a('0x1b')],'transfererconnectedlinenum':_0x8d45e1[_0xdd0a('0x1c')],'transfererconnectedlinename':_0x8d45e1[_0xdd0a('0x1d')],'transfereraccountcode':_0x8d45e1[_0xdd0a('0x1e')],'transferercontext':_0x8d45e1[_0xdd0a('0x1f')],'transfererexten':_0x8d45e1[_0xdd0a('0x20')],'transfererlinkedid':_0x8d45e1[_0xdd0a('0x21')],'context':_0x8d45e1[_0xdd0a('0x22')],'extension':_0x8d45e1[_0xdd0a('0x23')],'type':_0xdd0a('0x5')});if(_[_0xdd0a('0x24')](_0x8d45e1[_0xdd0a('0x25')])){_0x8d45e1=_['assign'](_0x8d45e1,{'transfereechannel':_0x8d45e1['transfertargetchannel'],'transfereecalleridnum':_0x8d45e1[_0xdd0a('0x26')],'transfereecalleridname':_0x8d45e1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x8d45e1[_0xdd0a('0x27')],'transfereeconnectedlinename':_0x8d45e1[_0xdd0a('0x28')],'transfereeaccountcode':_0x8d45e1[_0xdd0a('0x29')],'transfereecontext':_0x8d45e1[_0xdd0a('0x2a')],'transfereeexten':_0x8d45e1[_0xdd0a('0x2b')],'transfereelinkedid':_0x8d45e1[_0xdd0a('0x2c')]});}writeDB(_0x8d45e1);}catch(_0x15d6f7){utils['error'](util[_0xdd0a('0x4')]('[%s][transfers][attendedtransfer]',_0x8d45e1['origtransfereruniqueid']),_0x15d6f7);}}; \ No newline at end of file +var _0x58f9=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blinds','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','transfertargetchannel'];(function(_0x521dec,_0x34c9e1){var _0x9500ce=function(_0x19611b){while(--_0x19611b){_0x521dec['push'](_0x521dec['shift']());}};_0x9500ce(++_0x34c9e1);}(_0x58f9,0x1c9));var _0x958f=function(_0xe4ed36,_0x3d329b){_0xe4ed36=_0xe4ed36-0x0;var _0x46e58f=_0x58f9[_0xe4ed36];return _0x46e58f;};'use strict';var _=require(_0x958f('0x0'));var util=require(_0x958f('0x1'));var utils=require('./utils');function writeDB(_0x2e21bb){utils['info'](util[_0x958f('0x2')](_0x958f('0x3'),_0x2e21bb[_0x958f('0x4')]===_0x958f('0x5')?_0x2e21bb[_0x958f('0x6')]:_0x2e21bb[_0x958f('0x7')],_0x2e21bb['type']));utils['request']('CreateVoiceTransferReport',_0x2e21bb);}exports['blinds']={};exports[_0x958f('0x8')]=function(_0x54f39c){try{utils[_0x958f('0x9')](util[_0x958f('0x2')](_0x958f('0xa'),_0x54f39c[_0x958f('0x7')]),_0x54f39c);utils[_0x958f('0xb')](util[_0x958f('0x2')](_0x958f('0xc'),_0x54f39c['uniqueid'],_0x54f39c[_0x958f('0xd')],_0x54f39c[_0x958f('0xe')],_0x54f39c[_0x958f('0xf')],_0x54f39c[_0x958f('0x10')]));_0x54f39c[_0x958f('0x4')]='blind';exports[_0x958f('0x11')][_0x54f39c[_0x958f('0x12')]]=_0x54f39c;writeDB(_0x54f39c);}catch(_0x26c9e9){utils[_0x958f('0x13')](util[_0x958f('0x2')](_0x958f('0xa'),_0x54f39c['uniqueid']),_0x26c9e9);}};exports[_0x958f('0x14')]=function(_0x1a2e90){try{utils[_0x958f('0x9')](util[_0x958f('0x2')](_0x958f('0x15'),_0x1a2e90[_0x958f('0x6')]),_0x1a2e90);utils[_0x958f('0xb')](util[_0x958f('0x2')](_0x958f('0x16'),_0x1a2e90['origtransfereruniqueid'],_0x1a2e90['origtransferercalleridnum'],_0x1a2e90[_0x958f('0x17')],_0x1a2e90[_0x958f('0x18')],_0x1a2e90[_0x958f('0x19')]));_0x1a2e90=_[_0x958f('0x1a')](_0x1a2e90,{'transfererchannel':_0x1a2e90['origtransfererchannel'],'transferercalleridnum':_0x1a2e90[_0x958f('0x1b')],'transferercalleridname':_0x1a2e90[_0x958f('0x17')],'transfererconnectedlinenum':_0x1a2e90[_0x958f('0x1c')],'transfererconnectedlinename':_0x1a2e90[_0x958f('0x1d')],'transfereraccountcode':_0x1a2e90['origtransfereraccountcode'],'transferercontext':_0x1a2e90['secondtransferercontext'],'transfererexten':_0x1a2e90[_0x958f('0x1e')],'transfererlinkedid':_0x1a2e90[_0x958f('0x1f')],'context':_0x1a2e90['origtransferercontext'],'extension':_0x1a2e90[_0x958f('0x20')],'type':_0x958f('0x5')});if(_['isNil'](_0x1a2e90[_0x958f('0x21')])){_0x1a2e90=_[_0x958f('0x1a')](_0x1a2e90,{'transfereechannel':_0x1a2e90[_0x958f('0x22')],'transfereecalleridnum':_0x1a2e90[_0x958f('0x18')],'transfereecalleridname':_0x1a2e90[_0x958f('0x19')],'transfereeconnectedlinenum':_0x1a2e90[_0x958f('0x23')],'transfereeconnectedlinename':_0x1a2e90[_0x958f('0x24')],'transfereeaccountcode':_0x1a2e90[_0x958f('0x25')],'transfereecontext':_0x1a2e90[_0x958f('0x26')],'transfereeexten':_0x1a2e90[_0x958f('0x27')],'transfereelinkedid':_0x1a2e90[_0x958f('0x28')]});}writeDB(_0x1a2e90);}catch(_0x42b530){utils[_0x958f('0x13')](util['format'](_0x958f('0x15'),_0x1a2e90['origtransfereruniqueid']),_0x42b530);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 5278bc0..58419d1 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 _0xdc12=['[utils][getVoiceQueueByName]','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','isAfter','bluebird','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','internal','name','result','length','getUserByInternal','then','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s'];(function(_0xa491f1,_0x5cc5a9){var _0x26cc8e=function(_0x57610d){while(--_0x57610d){_0xa491f1['push'](_0xa491f1['shift']());}};_0x26cc8e(++_0x5cc5a9);}(_0xdc12,0x1c2));var _0x2dc1=function(_0x481821,_0x1b2854){_0x481821=_0x481821-0x0;var _0xec6bba=_0xdc12[_0x481821];return _0xec6bba;};'use strict';var BPromise=require(_0x2dc1('0x0'));var jayson=require('jayson/promise');var moment=require(_0x2dc1('0x1'));var util=require('util');var client=jayson[_0x2dc1('0x2')][_0x2dc1('0x3')]({'port':0x2329});var logger=require(_0x2dc1('0x4'))(_0x2dc1('0x5'));exports[_0x2dc1('0x6')]=function(_0x21b931,_0x563754){logger[_0x2dc1('0x6')](_0x21b931,_0x563754?util[_0x2dc1('0x7')](_0x563754,{'showHidden':![],'depth':null}):'');};exports[_0x2dc1('0x8')]=function(_0x491698,_0x470a7f){logger[_0x2dc1('0x8')](_0x491698,_0x470a7f?util[_0x2dc1('0x7')](_0x470a7f,{'showHidden':![],'depth':null}):'');};exports[_0x2dc1('0x9')]=function(_0x56ec0a,_0x183ebf){logger[_0x2dc1('0x9')](_0x56ec0a,_0x183ebf?util[_0x2dc1('0x7')](_0x183ebf,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4edd3c,_0x8ccbee){return client[_0x2dc1('0xa')](_0x4edd3c,{'body':_0x8ccbee})['then'](function(_0x3ef9b1){logger['debug']('[utils][request]\x20name:%s',_0x4edd3c,_0x3ef9b1?util['inspect'](_0x3ef9b1,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3004e8){logger[_0x2dc1('0x9')]('[utils][request]\x20name:%s',_0x4edd3c,_0x3004e8?util[_0x2dc1('0x7')](_0x3004e8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x36b236){return client[_0x2dc1('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x2dc1('0xb'),_0x2dc1('0xc'),'interface'],'where':_0x36b236,'limit':0x1}})['then'](function(_0x309502){logger[_0x2dc1('0x8')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x36b236),_0x309502?util[_0x2dc1('0x7')](_0x309502,{'showHidden':![],'depth':null}):'');return _0x309502[_0x2dc1('0xd')][_0x2dc1('0xe')]?_0x309502[_0x2dc1('0xd')][0x0]:null;});}exports[_0x2dc1('0xf')]=function(_0x1933c2){return new BPromise(function(_0x59db7e,_0xc9f769){if(_0x1933c2){return getUser({'internal':_0x1933c2})[_0x2dc1('0x10')](function(_0x6a112f){logger[_0x2dc1('0x6')](_0x2dc1('0x11'),_0x1933c2,_0x6a112f?'found':_0x2dc1('0x12'));return _0x59db7e(_0x6a112f);})[_0x2dc1('0x13')](function(_0x5eb420){logger[_0x2dc1('0x9')](_0x2dc1('0x14'),_0x5eb420?util[_0x2dc1('0x7')](_0x5eb420,{'showHidden':![],'depth':null}):'');return _0x59db7e(null);});}return _0x59db7e(null);});};exports[_0x2dc1('0x15')]=function(_0x4bfd2e){return new BPromise(function(_0x5a762e,_0x19f493){if(_0x4bfd2e){return getUser({'interface':_0x4bfd2e})['then'](function(_0x345560){logger[_0x2dc1('0x6')](_0x2dc1('0x16'),_0x4bfd2e,_0x345560?_0x2dc1('0x17'):_0x2dc1('0x12'));return _0x5a762e(_0x345560);})['catch'](function(_0x359d17){logger[_0x2dc1('0x9')](_0x2dc1('0x18'),_0x359d17?util[_0x2dc1('0x7')](_0x359d17,{'showHidden':![],'depth':null}):'');return _0x5a762e(null);});}return _0x5a762e(null);});};exports[_0x2dc1('0x19')]=function(_0x9cae6e){return new BPromise(function(_0x3d0b7e,_0x230873){if(_0x9cae6e){return getUser({'name':_0x9cae6e})[_0x2dc1('0x10')](function(_0x48f1c6){logger['info'](_0x2dc1('0x1a'),_0x9cae6e,_0x48f1c6?'found':'notfound');return _0x3d0b7e(_0x48f1c6);})['catch'](function(_0xa8ce20){logger['error'](_0x2dc1('0x1b'),_0xa8ce20?util[_0x2dc1('0x7')](_0xa8ce20,{'showHidden':![],'depth':null}):'');return _0x3d0b7e(null);});}return _0x3d0b7e(null);});};exports[_0x2dc1('0x1c')]=function(_0x4fee39){return new BPromise(function(_0x527adf,_0x4a9745){if(_0x4fee39){return client[_0x2dc1('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x2dc1('0xc'),_0x2dc1('0x1d'),_0x2dc1('0x1e'),_0x2dc1('0x1f')],'where':{'name':_0x4fee39},'limit':0x1}})['then'](function(_0x4f2c21){logger[_0x2dc1('0x8')](_0x2dc1('0x20'),_0x4fee39,_0x4f2c21?util['inspect'](_0x4f2c21,{'showHidden':![],'depth':null}):'');logger[_0x2dc1('0x6')](_0x2dc1('0x21'),_0x4fee39,_0x4f2c21?_0x2dc1('0x17'):_0x2dc1('0x12'));return _0x527adf(_0x4f2c21[_0x2dc1('0xd')][_0x2dc1('0xe')]?_0x4f2c21[_0x2dc1('0xd')][0x0]:null);})[_0x2dc1('0x13')](function(_0x250891){logger[_0x2dc1('0x9')](_0x2dc1('0x22'),_0x250891?util[_0x2dc1('0x7')](_0x250891,{'showHidden':![],'depth':null}):'');return _0x527adf(null);});}return _0x527adf(null);});};exports['addTime']=function(_0x696ef3,_0x2b62e8){return moment(_0x696ef3)[_0x2dc1('0x23')](_0x2b62e8,_0x2dc1('0x24'))[_0x2dc1('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2dc1('0x26')]=function(_0x231e3b,_0x50d429){return moment(_0x231e3b)[_0x2dc1('0x27')](_0x50d429,_0x2dc1('0x24'))[_0x2dc1('0x25')](_0x2dc1('0x28'));};exports[_0x2dc1('0x29')]=function(_0x27803b,_0x4c4f7d){return moment(_0x27803b)['diff'](moment(_0x4c4f7d),_0x2dc1('0x24'));};exports[_0x2dc1('0x2a')]=function(_0x461ae0,_0x58629b){return parseInt(_0x461ae0,0xa)+parseInt(_0x58629b,0xa);};exports['now']=function(){return moment()['format'](_0x2dc1('0x28'));};exports[_0x2dc1('0x2b')]=function(_0x519c6a,_0x395db2){if(_0x395db2){return moment(_0x519c6a)[_0x2dc1('0x2b')](_0x395db2);}return!![];};exports['isBefore']=function(_0x144653,_0x361039){if(_0x361039){return moment(_0x144653)['isBefore'](_0x361039);}else if(_0x144653){return!![];}return![];}; \ No newline at end of file +var _0x6df4=['length','result','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x52e881,_0x5bcfe8){var _0x482df6=function(_0x4a1b83){while(--_0x4a1b83){_0x52e881['push'](_0x52e881['shift']());}};_0x482df6(++_0x5bcfe8);}(_0x6df4,0xa6));var _0x46df=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0x6df4[_0x17c8cc];return _0x3db4eb;};'use strict';var BPromise=require(_0x46df('0x0'));var jayson=require(_0x46df('0x1'));var moment=require(_0x46df('0x2'));var util=require('util');var client=jayson[_0x46df('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x46df('0x4'));exports['info']=function(_0x4d4355,_0x5671c4){logger[_0x46df('0x5')](_0x4d4355,_0x5671c4?util[_0x46df('0x6')](_0x5671c4,{'showHidden':![],'depth':null}):'');};exports[_0x46df('0x7')]=function(_0x444494,_0x25f8a4){logger[_0x46df('0x7')](_0x444494,_0x25f8a4?util[_0x46df('0x6')](_0x25f8a4,{'showHidden':![],'depth':null}):'');};exports[_0x46df('0x8')]=function(_0x52adc5,_0x22e809){logger[_0x46df('0x8')](_0x52adc5,_0x22e809?util['inspect'](_0x22e809,{'showHidden':![],'depth':null}):'');};exports[_0x46df('0x9')]=function(_0x6dc567,_0x1bba36){return client['request'](_0x6dc567,{'body':_0x1bba36})['then'](function(_0x463124){logger[_0x46df('0x7')](_0x46df('0xa'),_0x6dc567,_0x463124?util[_0x46df('0x6')](_0x463124,{'showHidden':![],'depth':null}):'');})[_0x46df('0xb')](function(_0xcce625){logger['error'](_0x46df('0xa'),_0x6dc567,_0xcce625?util[_0x46df('0x6')](_0xcce625,{'showHidden':![],'depth':null}):'');});};function getUser(_0x29e931){return client[_0x46df('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x46df('0xc'),_0x46df('0xd'),_0x46df('0xe')],'where':_0x29e931,'limit':0x1}})[_0x46df('0xf')](function(_0x3948df){logger[_0x46df('0x7')](_0x46df('0x10'),JSON[_0x46df('0x11')](_0x29e931),_0x3948df?util[_0x46df('0x6')](_0x3948df,{'showHidden':![],'depth':null}):'');return _0x3948df['result'][_0x46df('0x12')]?_0x3948df[_0x46df('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x2d5ed3){return new BPromise(function(_0x3b0636,_0x3ceb0f){if(_0x2d5ed3){return getUser({'internal':_0x2d5ed3})[_0x46df('0xf')](function(_0x4a5a17){logger[_0x46df('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2d5ed3,_0x4a5a17?_0x46df('0x14'):_0x46df('0x15'));return _0x3b0636(_0x4a5a17);})[_0x46df('0xb')](function(_0x10f2eb){logger[_0x46df('0x8')]('[utils][getUserByInternal]',_0x10f2eb?util[_0x46df('0x6')](_0x10f2eb,{'showHidden':![],'depth':null}):'');return _0x3b0636(null);});}return _0x3b0636(null);});};exports[_0x46df('0x16')]=function(_0x37c43a){return new BPromise(function(_0x1fcc39,_0x4c67cd){if(_0x37c43a){return getUser({'interface':_0x37c43a})[_0x46df('0xf')](function(_0x4eead3){logger['info'](_0x46df('0x17'),_0x37c43a,_0x4eead3?_0x46df('0x14'):_0x46df('0x15'));return _0x1fcc39(_0x4eead3);})[_0x46df('0xb')](function(_0x6c7b1){logger[_0x46df('0x8')](_0x46df('0x18'),_0x6c7b1?util[_0x46df('0x6')](_0x6c7b1,{'showHidden':![],'depth':null}):'');return _0x1fcc39(null);});}return _0x1fcc39(null);});};exports[_0x46df('0x19')]=function(_0x58a09d){return new BPromise(function(_0x4bf7df,_0x371bae){if(_0x58a09d){return getUser({'name':_0x58a09d})['then'](function(_0x8a8c37){logger['info'](_0x46df('0x1a'),_0x58a09d,_0x8a8c37?_0x46df('0x14'):'notfound');return _0x4bf7df(_0x8a8c37);})[_0x46df('0xb')](function(_0x1ecf11){logger['error'](_0x46df('0x1b'),_0x1ecf11?util[_0x46df('0x6')](_0x1ecf11,{'showHidden':![],'depth':null}):'');return _0x4bf7df(null);});}return _0x4bf7df(null);});};exports[_0x46df('0x1c')]=function(_0x124cbf){return new BPromise(function(_0x195062,_0x431927){if(_0x124cbf){return client[_0x46df('0x9')](_0x46df('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x46df('0xd'),'type',_0x46df('0x1e'),_0x46df('0x1f')],'where':{'name':_0x124cbf},'limit':0x1}})['then'](function(_0x1e8375){logger[_0x46df('0x7')](_0x46df('0x20'),_0x124cbf,_0x1e8375?util[_0x46df('0x6')](_0x1e8375,{'showHidden':![],'depth':null}):'');logger['info'](_0x46df('0x21'),_0x124cbf,_0x1e8375?_0x46df('0x14'):_0x46df('0x15'));return _0x195062(_0x1e8375[_0x46df('0x13')][_0x46df('0x12')]?_0x1e8375[_0x46df('0x13')][0x0]:null);})['catch'](function(_0x474793){logger['error'](_0x46df('0x22'),_0x474793?util['inspect'](_0x474793,{'showHidden':![],'depth':null}):'');return _0x195062(null);});}return _0x195062(null);});};exports[_0x46df('0x23')]=function(_0x257fea,_0x4c6d46){return moment(_0x257fea)[_0x46df('0x24')](_0x4c6d46,_0x46df('0x25'))[_0x46df('0x26')](_0x46df('0x27'));};exports[_0x46df('0x28')]=function(_0x2702d0,_0xa52376){return moment(_0x2702d0)[_0x46df('0x29')](_0xa52376,_0x46df('0x25'))[_0x46df('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x2e3766,_0xd053c3){return moment(_0x2e3766)[_0x46df('0x2a')](moment(_0xd053c3),_0x46df('0x25'));};exports['sumTime']=function(_0x2ce046,_0x55a8f4){return parseInt(_0x2ce046,0xa)+parseInt(_0x55a8f4,0xa);};exports[_0x46df('0x2b')]=function(){return moment()[_0x46df('0x26')](_0x46df('0x27'));};exports['isAfter']=function(_0x5bd9ce,_0x48ad3b){if(_0x48ad3b){return moment(_0x5bd9ce)[_0x46df('0x2c')](_0x48ad3b);}return!![];};exports['isBefore']=function(_0x1f60e8,_0x1ec516){if(_0x1ec516){return moment(_0x1f60e8)[_0x46df('0x2d')](_0x1ec516);}else if(_0x1f60e8){return!![];}return![];}; \ No newline at end of file